[ 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       * @param string|WP_Error $error
  56       */
  57  	public function error( $error ) {
  58          echo '<div class="lp-error">';
  59          parent::error( $error );
  60          echo '</div>';
  61      }
  62  
  63      /**
  64       */
  65  	public function after() {
  66          echo '</div>';
  67      }
  68  
  69      /**
  70       */
  71  	public function bulk_footer() {
  72          $this->decrement_update_count( 'translation' );
  73  
  74          $update_actions = array(
  75              'updates_page' => sprintf(
  76                  '<a href="%s" target="_parent">%s</a>',
  77                  self_admin_url( 'update-core.php' ),
  78                  __( 'Return to WordPress Updates page' )
  79              ),
  80          );
  81  
  82          /**
  83           * Filters the list of action links available following a translations update.
  84           *
  85           * @since 3.7.0
  86           *
  87           * @param string[] $update_actions Array of translations update links.
  88           */
  89          $update_actions = apply_filters( 'update_translations_complete_actions', $update_actions );
  90  
  91          if ( $update_actions && $this->display_footer_actions ) {
  92              $this->feedback( implode( ' | ', $update_actions ) );
  93          }
  94      }
  95  }


Generated: Thu Nov 14 01:00:04 2019 Cross-referenced by PHPXref 0.7.1