]> scripts.mit.edu Git - autoinstalls/wordpress.git/blob - wp-admin/includes/class-language-pack-upgrader-skin.php
WordPress 4.7.2
[autoinstalls/wordpress.git] / wp-admin / includes / class-language-pack-upgrader-skin.php
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          * @access public
41          */
42         public function before() {
43                 $name = $this->upgrader->get_name_for_update( $this->language_update );
44
45                 echo '<div class="update-messages lp-show-latest">';
46
47                 printf( '<h2>' . __( 'Updating translations for %1$s (%2$s)&#8230;' ) . '</h2>', $name, $this->language_update->language );
48         }
49
50         /**
51          *
52          * @param string|WP_Error $error
53          */
54         public function error( $error ) {
55                 echo '<div class="lp-error">';
56                 parent::error( $error );
57                 echo '</div>';
58         }
59
60         /**
61          * @access public
62          */
63         public function after() {
64                 echo '</div>';
65         }
66
67         /**
68          * @access public
69          */
70         public function bulk_footer() {
71                 $this->decrement_update_count( 'translation' );
72                 $update_actions = array();
73                 $update_actions['updates_page'] = '<a href="' . self_admin_url( 'update-core.php' ) . '" target="_parent">' . __( 'Return to WordPress Updates page' ) . '</a>';
74
75                 /**
76                  * Filters the list of action links available following a translations update.
77                  *
78                  * @since 3.7.0
79                  *
80                  * @param array $update_actions Array of translations update links.
81                  */
82                 $update_actions = apply_filters( 'update_translations_complete_actions', $update_actions );
83
84                 if ( $update_actions && $this->display_footer_actions )
85                         $this->feedback( implode( ' | ', $update_actions ) );
86         }
87 }