[ Index ]

PHP Cross Reference of WordPress Trunk (Updated Daily)

Search

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      /**
  20       * The upgrader instance.
  21       *
  22       * @since 3.7.0
  23       * @var Language_Pack_Upgrader
  24       */
  25      public $upgrader;
  26  
  27      public $language_update        = null;
  28      public $done_header            = false;
  29      public $done_footer            = false;
  30      public $display_footer_actions = true;
  31  
  32      /**
  33       * Constructor.
  34       *
  35       * Sets up the language pack upgrader skin.
  36       *
  37       * @since 3.7.0
  38       *
  39       * @param array $args
  40       */
  41  	public function __construct( $args = array() ) {
  42          $defaults = array(
  43              'url'                => '',
  44              'nonce'              => '',
  45              'title'              => __( 'Update Translations' ),
  46              'skip_header_footer' => false,
  47          );
  48          $args     = wp_parse_args( $args, $defaults );
  49          if ( $args['skip_header_footer'] ) {
  50              $this->done_header            = true;
  51              $this->done_footer            = true;
  52              $this->display_footer_actions = false;
  53          }
  54          parent::__construct( $args );
  55      }
  56  
  57      /**
  58       * Performs an action before a language pack update.
  59       *
  60       * @since 3.7.0
  61       */
  62  	public function before() {
  63          $name = $this->upgrader->get_name_for_update( $this->language_update );
  64  
  65          echo '<div class="update-messages lp-show-latest">';
  66  
  67          /* translators: 1: Project name (plugin, theme, or WordPress), 2: Language. */
  68          printf( '<h2>' . __( 'Updating translations for %1$s (%2$s)&#8230;' ) . '</h2>', $name, $this->language_update->language );
  69      }
  70  
  71      /**
  72       * Displays an error message about the update.
  73       *
  74       * @since 3.7.0
  75       * @since 5.9.0 Renamed `$error` to `$errors` for PHP 8 named parameter support.
  76       *
  77       * @param string|WP_Error $errors Errors.
  78       */
  79  	public function error( $errors ) {
  80          echo '<div class="lp-error">';
  81          parent::error( $errors );
  82          echo '</div>';
  83      }
  84  
  85      /**
  86       * Performs an action following a language pack update.
  87       *
  88       * @since 3.7.0
  89       */
  90  	public function after() {
  91          echo '</div>';
  92      }
  93  
  94      /**
  95       * Displays the footer following the bulk update process.
  96       *
  97       * @since 3.7.0
  98       */
  99  	public function bulk_footer() {
 100          $this->decrement_update_count( 'translation' );
 101  
 102          $update_actions = array(
 103              'updates_page' => sprintf(
 104                  '<a href="%s" target="_parent">%s</a>',
 105                  self_admin_url( 'update-core.php' ),
 106                  __( 'Go to WordPress Updates page' )
 107              ),
 108          );
 109  
 110          /**
 111           * Filters the list of action links available following a translations update.
 112           *
 113           * @since 3.7.0
 114           *
 115           * @param string[] $update_actions Array of translations update links.
 116           */
 117          $update_actions = apply_filters( 'update_translations_complete_actions', $update_actions );
 118  
 119          if ( $update_actions && $this->display_footer_actions ) {
 120              $this->feedback( implode( ' | ', $update_actions ) );
 121          }
 122      }
 123  }


Generated : Thu Sep 3 08:20:25 2026 Cross-referenced by PHPXref