14 * @since 4.6.0 Moved to its own file from wp-admin/includes/class-wp-upgrader-skins.php. |
14 * @since 4.6.0 Moved to its own file from wp-admin/includes/class-wp-upgrader-skins.php. |
15 * |
15 * |
16 * @see WP_Upgrader_Skin |
16 * @see WP_Upgrader_Skin |
17 */ |
17 */ |
18 class Language_Pack_Upgrader_Skin extends WP_Upgrader_Skin { |
18 class Language_Pack_Upgrader_Skin extends WP_Upgrader_Skin { |
19 public $language_update = null; |
19 public $language_update = null; |
20 public $done_header = false; |
20 public $done_header = false; |
21 public $done_footer = false; |
21 public $done_footer = false; |
22 public $display_footer_actions = true; |
22 public $display_footer_actions = true; |
23 |
23 |
24 /** |
24 /** |
25 * |
|
26 * @param array $args |
25 * @param array $args |
27 */ |
26 */ |
28 public function __construct( $args = array() ) { |
27 public function __construct( $args = array() ) { |
29 $defaults = array( 'url' => '', 'nonce' => '', 'title' => __( 'Update Translations' ), 'skip_header_footer' => false ); |
28 $defaults = array( |
30 $args = wp_parse_args( $args, $defaults ); |
29 'url' => '', |
|
30 'nonce' => '', |
|
31 'title' => __( 'Update Translations' ), |
|
32 'skip_header_footer' => false, |
|
33 ); |
|
34 $args = wp_parse_args( $args, $defaults ); |
31 if ( $args['skip_header_footer'] ) { |
35 if ( $args['skip_header_footer'] ) { |
32 $this->done_header = true; |
36 $this->done_header = true; |
33 $this->done_footer = true; |
37 $this->done_footer = true; |
34 $this->display_footer_actions = false; |
38 $this->display_footer_actions = false; |
35 } |
39 } |
36 parent::__construct( $args ); |
40 parent::__construct( $args ); |
37 } |
41 } |
38 |
42 |
41 public function before() { |
45 public function before() { |
42 $name = $this->upgrader->get_name_for_update( $this->language_update ); |
46 $name = $this->upgrader->get_name_for_update( $this->language_update ); |
43 |
47 |
44 echo '<div class="update-messages lp-show-latest">'; |
48 echo '<div class="update-messages lp-show-latest">'; |
45 |
49 |
|
50 /* translators: 1: name of project, 2: language */ |
46 printf( '<h2>' . __( 'Updating translations for %1$s (%2$s)…' ) . '</h2>', $name, $this->language_update->language ); |
51 printf( '<h2>' . __( 'Updating translations for %1$s (%2$s)…' ) . '</h2>', $name, $this->language_update->language ); |
47 } |
52 } |
48 |
53 |
49 /** |
54 /** |
50 * |
|
51 * @param string|WP_Error $error |
55 * @param string|WP_Error $error |
52 */ |
56 */ |
53 public function error( $error ) { |
57 public function error( $error ) { |
54 echo '<div class="lp-error">'; |
58 echo '<div class="lp-error">'; |
55 parent::error( $error ); |
59 parent::error( $error ); |
64 |
68 |
65 /** |
69 /** |
66 */ |
70 */ |
67 public function bulk_footer() { |
71 public function bulk_footer() { |
68 $this->decrement_update_count( 'translation' ); |
72 $this->decrement_update_count( 'translation' ); |
69 $update_actions = array(); |
73 $update_actions = array(); |
70 $update_actions['updates_page'] = '<a href="' . self_admin_url( 'update-core.php' ) . '" target="_parent">' . __( 'Return to WordPress Updates page' ) . '</a>'; |
74 $update_actions['updates_page'] = '<a href="' . self_admin_url( 'update-core.php' ) . '" target="_parent">' . __( 'Return to WordPress Updates page' ) . '</a>'; |
71 |
75 |
72 /** |
76 /** |
73 * Filters the list of action links available following a translations update. |
77 * Filters the list of action links available following a translations update. |
74 * |
78 * |
75 * @since 3.7.0 |
79 * @since 3.7.0 |
76 * |
80 * |
77 * @param array $update_actions Array of translations update links. |
81 * @param string[] $update_actions Array of translations update links. |
78 */ |
82 */ |
79 $update_actions = apply_filters( 'update_translations_complete_actions', $update_actions ); |
83 $update_actions = apply_filters( 'update_translations_complete_actions', $update_actions ); |
80 |
84 |
81 if ( $update_actions && $this->display_footer_actions ) |
85 if ( $update_actions && $this->display_footer_actions ) { |
82 $this->feedback( implode( ' | ', $update_actions ) ); |
86 $this->feedback( implode( ' | ', $update_actions ) ); |
|
87 } |
83 } |
88 } |
84 } |
89 } |