home *** CD-ROM | disk | FTP | other *** search
/ HTML Examples / WP.iso / wordpress2 / wp-admin / includes / class-language-pack-upgrader-skin.php < prev    next >
Encoding:
PHP Script  |  2017-07-26  |  2.1 KB  |  85 lines

  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.      *
  26.      * @param array $args
  27.      */
  28.     public function __construct( $args = array() ) {
  29.         $defaults = array( 'url' => '', 'nonce' => '', 'title' => __( 'Update Translations' ), 'skip_header_footer' => false );
  30.         $args = wp_parse_args( $args, $defaults );
  31.         if ( $args['skip_header_footer'] ) {
  32.             $this->done_header = true;
  33.             $this->done_footer = true;
  34.             $this->display_footer_actions = false;
  35.         }
  36.         parent::__construct( $args );
  37.     }
  38.  
  39.     /**
  40.      */
  41.     public function before() {
  42.         $name = $this->upgrader->get_name_for_update( $this->language_update );
  43.  
  44.         echo '<div class="update-messages lp-show-latest">';
  45.  
  46.         printf( '<h2>' . __( 'Updating translations for %1$s (%2$s)…' ) . '</h2>', $name, $this->language_update->language );
  47.     }
  48.  
  49.     /**
  50.      *
  51.      * @param string|WP_Error $error
  52.      */
  53.     public function error( $error ) {
  54.         echo '<div class="lp-error">';
  55.         parent::error( $error );
  56.         echo '</div>';
  57.     }
  58.  
  59.     /**
  60.      */
  61.     public function after() {
  62.         echo '</div>';
  63.     }
  64.  
  65.     /**
  66.      */
  67.     public function bulk_footer() {
  68.         $this->decrement_update_count( 'translation' );
  69.         $update_actions = array();
  70.         $update_actions['updates_page'] = '<a href="' . self_admin_url( 'update-core.php' ) . '" target="_parent">' . __( 'Return to WordPress Updates page' ) . '</a>';
  71.  
  72.         /**
  73.          * Filters the list of action links available following a translations update.
  74.          *
  75.          * @since 3.7.0
  76.          *
  77.          * @param array $update_actions Array of translations update links.
  78.          */
  79.         $update_actions = apply_filters( 'update_translations_complete_actions', $update_actions );
  80.  
  81.         if ( $update_actions && $this->display_footer_actions )
  82.             $this->feedback( implode( ' | ', $update_actions ) );
  83.     }
  84. }
  85.