2016-05-10 07:11:30 -04:00
|
|
|
<?php
|
|
|
|
/**
|
2016-05-10 07:31:28 -04:00
|
|
|
* Upgrader API: Language_Pack_Upgrader_Skin class
|
2016-05-10 07:11:30 -04:00
|
|
|
*
|
|
|
|
* @package WordPress
|
|
|
|
* @subpackage Upgrader
|
2016-05-10 07:31:28 -04:00
|
|
|
* @since 4.6.0
|
2016-05-10 07:11:30 -04:00
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Translation Upgrader Skin for WordPress Translation Upgrades.
|
|
|
|
*
|
|
|
|
* @since 3.7.0
|
2016-05-13 16:59:27 -04:00
|
|
|
* @since 4.6.0 Moved to its own file from wp-admin/includes/class-wp-upgrader-skins.php.
|
2016-07-09 09:45:33 -04:00
|
|
|
*
|
|
|
|
* @see WP_Upgrader_Skin
|
2016-05-10 07:11:30 -04:00
|
|
|
*/
|
|
|
|
class Language_Pack_Upgrader_Skin extends WP_Upgrader_Skin {
|
2017-11-30 18:11:00 -05:00
|
|
|
public $language_update = null;
|
|
|
|
public $done_header = false;
|
|
|
|
public $done_footer = false;
|
2016-05-10 07:11:30 -04:00
|
|
|
public $display_footer_actions = true;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param array $args
|
|
|
|
*/
|
|
|
|
public function __construct( $args = array() ) {
|
2017-11-30 18:11:00 -05:00
|
|
|
$defaults = array(
|
|
|
|
'url' => '',
|
|
|
|
'nonce' => '',
|
|
|
|
'title' => __( 'Update Translations' ),
|
|
|
|
'skip_header_footer' => false,
|
|
|
|
);
|
|
|
|
$args = wp_parse_args( $args, $defaults );
|
2016-05-10 07:11:30 -04:00
|
|
|
if ( $args['skip_header_footer'] ) {
|
2017-11-30 18:11:00 -05:00
|
|
|
$this->done_header = true;
|
|
|
|
$this->done_footer = true;
|
2016-05-10 07:11:30 -04:00
|
|
|
$this->display_footer_actions = false;
|
|
|
|
}
|
|
|
|
parent::__construct( $args );
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
*/
|
|
|
|
public function before() {
|
|
|
|
$name = $this->upgrader->get_name_for_update( $this->language_update );
|
|
|
|
|
|
|
|
echo '<div class="update-messages lp-show-latest">';
|
|
|
|
|
|
|
|
printf( '<h2>' . __( 'Updating translations for %1$s (%2$s)…' ) . '</h2>', $name, $this->language_update->language );
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param string|WP_Error $error
|
|
|
|
*/
|
|
|
|
public function error( $error ) {
|
|
|
|
echo '<div class="lp-error">';
|
|
|
|
parent::error( $error );
|
|
|
|
echo '</div>';
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
*/
|
|
|
|
public function after() {
|
|
|
|
echo '</div>';
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
*/
|
|
|
|
public function bulk_footer() {
|
|
|
|
$this->decrement_update_count( 'translation' );
|
2017-11-30 18:11:00 -05:00
|
|
|
$update_actions = array();
|
2016-05-10 07:11:30 -04:00
|
|
|
$update_actions['updates_page'] = '<a href="' . self_admin_url( 'update-core.php' ) . '" target="_parent">' . __( 'Return to WordPress Updates page' ) . '</a>';
|
|
|
|
|
|
|
|
/**
|
2016-05-22 14:01:30 -04:00
|
|
|
* Filters the list of action links available following a translations update.
|
2016-05-10 07:11:30 -04:00
|
|
|
*
|
|
|
|
* @since 3.7.0
|
|
|
|
*
|
|
|
|
* @param array $update_actions Array of translations update links.
|
|
|
|
*/
|
|
|
|
$update_actions = apply_filters( 'update_translations_complete_actions', $update_actions );
|
|
|
|
|
2017-11-30 18:11:00 -05:00
|
|
|
if ( $update_actions && $this->display_footer_actions ) {
|
2016-05-10 07:11:30 -04:00
|
|
|
$this->feedback( implode( ' | ', $update_actions ) );
|
2017-11-30 18:11:00 -05:00
|
|
|
}
|
2016-05-10 07:11:30 -04:00
|
|
|
}
|
|
|
|
}
|