[ Index ]

PHP Cross Reference of WordPress

title

Body

[close]

/wp-admin/includes/ -> class-language-pack-upgrader-skin.php (source)

   1  <?php
   2  /**
   3   * Upgrader API: Language_Pack_Upgrader_Skin class
   4   *
   5   * @package WordPress
   6   * @subpackage Upgrader
   7   * @since 4.6.0
   8   */
   9  
  10  /**
  11   * Translation Upgrader Skin for WordPress Translation Upgrades.
  12   *
  13   * @since 3.7.0
  14   * @since 4.6.0 Moved to its own file from wp-admin/includes/class-wp-upgrader-skins.php.
  15   *
  16   * @see WP_Upgrader_Skin
  17   */
  18  class Language_Pack_Upgrader_Skin extends WP_Upgrader_Skin {
  19      public $language_update        = null;
  20      public $done_header            = false;
  21      public $done_footer            = false;
  22      public $display_footer_actions = true;
  23  
  24      /**
  25       * @param array $args
  26       */
  27  	public function __construct( $args = array() ) {
  28          $defaults = array(
  29              'url'                => '',
  30              'nonce'              => '',
  31              'title'              => __( 'Update Translations' ),
  32              'skip_header_footer' => false,
  33          );
  34          $args     = wp_parse_args( $args, $defaults );
  35          if ( $args['skip_header_footer'] ) {
  36              $this->done_header            = true;
  37              $this->done_footer            = true;
  38              $this->display_footer_actions = false;
  39          }
  40          parent::__construct( $args );
  41      }
  42  
  43      /**
  44       */
  45  	public function before() {
  46          $name = $this->upgrader->get_name_for_update( $this->language_update );
  47  
  48          echo '<div class="update-messages lp-show-latest">';
  49  
  50          /* translators: 1: Project name (plugin, theme, or WordPress), 2: Language. */
  51          printf( '<h2>' . __( 'Updating translations for %1$s (%2$s)&#8230;' ) . '</h2>', $name, $this->language_update->language );
  52      }
  53  
  54      /**
  55       * @since 5.9.0 Renamed `$error` to `$errors` for PHP 8 named parameter support.
  56       *
  57       * @param string|WP_Error $errors Errors.
  58       */
  59  	public function error( $errors ) {
  60          echo '<div class="lp-error">';
  61          parent::error( $errors );
  62          echo '</div>';
  63      }
  64  
  65      /**
  66       */
  67  	public function after() {
  68          echo '</div>';
  69      }
  70  
  71      /**
  72       */
  73  	public function bulk_footer() {
  74          $this->decrement_update_count( 'translation' );
  75  
  76          $update_actions = array(
  77              'updates_page' => sprintf(
  78                  '<a href="%s" target="_parent">%s</a>',
  79                  self_admin_url( 'update-core.php' ),
  80                  __( 'Go to WordPress Updates page' )
  81              ),
  82          );
  83  
  84          /**
  85           * Filters the list of action links available following a translations update.
  86           *
  87           * @since 3.7.0
  88           *
  89           * @param string[] $update_actions Array of translations update links.
  90           */
  91          $update_actions = apply_filters( 'update_translations_complete_actions', $update_actions );
  92  
  93          if ( $update_actions && $this->display_footer_actions ) {
  94              $this->feedback( implode( ' | ', $update_actions ) );
  95          }
  96      }
  97  }


Generated: Mon Nov 29 01:00:03 2021 Cross-referenced by PHPXref 0.7.1