X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/fa11948979fd6a4ea5705dc613b239699a459db3..41578db67d72562346e4dbb2a14889b23d522813:/wp-admin/includes/class-wp-upgrader-skins.php
diff --git a/wp-admin/includes/class-wp-upgrader-skins.php b/wp-admin/includes/class-wp-upgrader-skins.php
index b8c82c7a..8c484076 100644
--- a/wp-admin/includes/class-wp-upgrader-skins.php
+++ b/wp-admin/includes/class-wp-upgrader-skins.php
@@ -51,7 +51,6 @@ class WP_Upgrader_Skin {
return;
$this->done_header = true;
echo '
';
- screen_icon();
echo '
' . $this->options['title'] . '
';
}
function footer() {
@@ -66,7 +65,7 @@ class WP_Upgrader_Skin {
} elseif ( is_wp_error($errors) && $errors->get_error_code() ) {
foreach ( $errors->get_error_messages() as $message ) {
if ( $errors->get_error_data() && is_string( $errors->get_error_data() ) )
- $this->feedback($message . ' ' . esc_html( $errors->get_error_data() ) );
+ $this->feedback($message . ' ' . esc_html( strip_tags( $errors->get_error_data() ) ) );
else
$this->feedback($message);
}
@@ -93,6 +92,26 @@ class WP_Upgrader_Skin {
function before() {}
function after() {}
+ /**
+ * Output JavaScript that calls function to decrement the update counts.
+ *
+ * @since 3.9.0
+ *
+ * @param string $type Type of update count to decrement. Likely values include 'plugin',
+ * 'theme', 'translation', etc.
+ */
+ protected function decrement_update_count( $type ) {
+ if ( ! $this->result || is_wp_error( $this->result ) || 'up_to_date' === $this->result ) {
+ return;
+ }
+ echo '';
+ }
}
/**
@@ -125,6 +144,8 @@ class Plugin_Upgrader_Skin extends WP_Upgrader_Skin {
echo '
';
}
+ $this->decrement_update_count( 'plugin' );
+
$update_actions = array(
'activate_plugin' => '
' . __('Activate Plugin') . '',
'plugins_page' => '
' . __('Return to Plugins page') . ''
@@ -132,17 +153,19 @@ class Plugin_Upgrader_Skin extends WP_Upgrader_Skin {
if ( $this->plugin_active || ! $this->result || is_wp_error( $this->result ) || ! current_user_can( 'activate_plugins' ) )
unset( $update_actions['activate_plugin'] );
- $update_actions = apply_filters('update_plugin_complete_actions', $update_actions, $this->plugin);
+ /**
+ * Filter the list of action links available following a single plugin update.
+ *
+ * @since 2.7.0
+ *
+ * @param array $update_actions Array of plugin action links.
+ * @param string $plugin Path to the plugin file.
+ */
+ $update_actions = apply_filters( 'update_plugin_complete_actions', $update_actions, $this->plugin );
+
if ( ! empty($update_actions) )
$this->feedback(implode(' | ', (array)$update_actions));
}
-
- function before() {
- if ( $this->upgrader->show_before ) {
- echo $this->upgrader->show_before;
- $this->upgrader->show_before = '';
- }
- }
}
/**
@@ -206,7 +229,7 @@ class Bulk_Upgrader_Skin extends WP_Upgrader_Skin {
if ( is_wp_error($error) ) {
foreach ( $error->get_error_messages() as $emessage ) {
if ( $error->get_error_data() && is_string( $error->get_error_data() ) )
- $messages[] = $emessage . ' ' . esc_html( $error->get_error_data() );
+ $messages[] = $emessage . ' ' . esc_html( strip_tags( $error->get_error_data() ) );
else
$messages[] = $emessage;
}
@@ -260,6 +283,25 @@ class Bulk_Upgrader_Skin extends WP_Upgrader_Skin {
wp_ob_end_flush_all();
flush();
}
+
+ /**
+ * Output JavaScript that sends message to parent window to decrement the update counts.
+ *
+ * @since 3.9.0
+ *
+ * @param string $type Type of update count to decrement. Likely values include 'plugin',
+ * 'theme', 'translation', etc.
+ */
+ protected function decrement_update_count( $type ) {
+ if ( ! $this->result || is_wp_error( $this->result ) || 'up_to_date' === $this->result ) {
+ return;
+ }
+ echo '';
+ }
}
class Bulk_Plugin_Upgrader_Skin extends Bulk_Upgrader_Skin {
@@ -280,6 +322,7 @@ class Bulk_Plugin_Upgrader_Skin extends Bulk_Upgrader_Skin {
function after($title = '') {
parent::after($this->plugin_info['Title']);
+ $this->decrement_update_count( 'plugin' );
}
function bulk_footer() {
parent::bulk_footer();
@@ -290,7 +333,16 @@ class Bulk_Plugin_Upgrader_Skin extends Bulk_Upgrader_Skin {
if ( ! current_user_can( 'activate_plugins' ) )
unset( $update_actions['plugins_page'] );
- $update_actions = apply_filters('update_bulk_plugins_complete_actions', $update_actions, $this->plugin_info);
+ /**
+ * Filter the list of action links available following bulk plugin updates.
+ *
+ * @since 3.0.0
+ *
+ * @param array $update_actions Array of plugin action links.
+ * @param array $plugin_info Array of information for the last-updated plugin.
+ */
+ $update_actions = apply_filters( 'update_bulk_plugins_complete_actions', $update_actions, $this->plugin_info );
+
if ( ! empty($update_actions) )
$this->feedback(implode(' | ', (array)$update_actions));
}
@@ -314,6 +366,7 @@ class Bulk_Theme_Upgrader_Skin extends Bulk_Upgrader_Skin {
function after($title = '') {
parent::after( $this->theme_info->display('Name') );
+ $this->decrement_update_count( 'theme' );
}
function bulk_footer() {
@@ -325,7 +378,16 @@ class Bulk_Theme_Upgrader_Skin extends Bulk_Upgrader_Skin {
if ( ! current_user_can( 'switch_themes' ) && ! current_user_can( 'edit_theme_options' ) )
unset( $update_actions['themes_page'] );
- $update_actions = apply_filters('update_bulk_theme_complete_actions', $update_actions, $this->theme_info );
+ /**
+ * Filter the list of action links available following bulk theme updates.
+ *
+ * @since 3.0.0
+ *
+ * @param array $update_actions Array of theme action links.
+ * @param array $theme_info Array of information for the last-updated theme.
+ */
+ $update_actions = apply_filters( 'update_bulk_theme_complete_actions', $update_actions, $this->theme_info );
+
if ( ! empty($update_actions) )
$this->feedback(implode(' | ', (array)$update_actions));
}
@@ -388,7 +450,19 @@ class Plugin_Installer_Skin extends WP_Upgrader_Skin {
unset( $install_actions['activate_plugin'] );
}
- $install_actions = apply_filters('install_plugin_complete_actions', $install_actions, $this->api, $plugin_file);
+ /**
+ * Filter the list of action links available following a single plugin installation.
+ *
+ * @since 2.7.0
+ *
+ * @param array $install_actions Array of plugin action links.
+ * @param object $api Object containing WordPress.org API plugin data. Empty
+ * for non-API installs, such as when a plugin is installed
+ * via upload.
+ * @param string $plugin_file Path to the plugin file.
+ */
+ $install_actions = apply_filters( 'install_plugin_complete_actions', $install_actions, $this->api, $plugin_file );
+
if ( ! empty($install_actions) )
$this->feedback(implode(' | ', (array)$install_actions));
}
@@ -461,7 +535,17 @@ class Theme_Installer_Skin extends WP_Upgrader_Skin {
if ( ! $this->result || is_wp_error($this->result) || is_network_admin() || ! current_user_can( 'switch_themes' ) )
unset( $install_actions['activate'], $install_actions['preview'] );
- $install_actions = apply_filters('install_theme_complete_actions', $install_actions, $this->api, $stylesheet, $theme_info);
+ /**
+ * Filter the list of action links available following a single theme installation.
+ *
+ * @since 2.8.0
+ *
+ * @param array $install_actions Array of theme action links.
+ * @param object $api Object containing WordPress.org API theme data.
+ * @param string $stylesheet Theme directory name.
+ * @param WP_Theme $theme_info Theme object.
+ */
+ $install_actions = apply_filters( 'install_theme_complete_actions', $install_actions, $this->api, $stylesheet, $theme_info );
if ( ! empty($install_actions) )
$this->feedback(implode(' | ', (array)$install_actions));
}
@@ -487,6 +571,7 @@ class Theme_Upgrader_Skin extends WP_Upgrader_Skin {
}
function after() {
+ $this->decrement_update_count( 'theme' );
$update_actions = array();
if ( ! empty( $this->upgrader->result['destination_name'] ) && $theme_info = $this->upgrader->theme_info() ) {
@@ -522,7 +607,16 @@ class Theme_Upgrader_Skin extends WP_Upgrader_Skin {
$update_actions['themes_page'] = '
' . __('Return to Themes page') . '';
- $update_actions = apply_filters('update_theme_complete_actions', $update_actions, $this->theme);
+ /**
+ * Filter the list of action links available following a single theme update.
+ *
+ * @since 2.8.0
+ *
+ * @param array $update_actions Array of theme action links.
+ * @param string $theme Theme directory name.
+ */
+ $update_actions = apply_filters( 'update_theme_complete_actions', $update_actions, $this->theme );
+
if ( ! empty($update_actions) )
$this->feedback(implode(' | ', (array)$update_actions));
}
@@ -569,8 +663,17 @@ class Language_Pack_Upgrader_Skin extends WP_Upgrader_Skin {
}
function bulk_footer() {
+ $this->decrement_update_count( 'translation' );
$update_actions = array();
$update_actions['updates_page'] = '
' . __( 'Return to WordPress Updates' ) . '';
+
+ /**
+ * Filter the list of action links available following a translations update.
+ *
+ * @since 3.7.0
+ *
+ * @param array $update_actions Array of translations update links.
+ */
$update_actions = apply_filters( 'update_translations_complete_actions', $update_actions );
if ( $update_actions && $this->display_footer_actions )