--- a/wp/wp-admin/includes/class-theme-upgrader-skin.php Tue Oct 22 16:11:46 2019 +0200
+++ b/wp/wp-admin/includes/class-theme-upgrader-skin.php Tue Dec 15 13:49:49 2020 +0100
@@ -16,10 +16,25 @@
* @see WP_Upgrader_Skin
*/
class Theme_Upgrader_Skin extends WP_Upgrader_Skin {
+
+ /**
+ * Holds the theme slug in the Theme Directory.
+ *
+ * @since 2.8.0
+ *
+ * @var object
+ */
public $theme = '';
/**
- * @param array $args
+ * Constructor.
+ *
+ * Sets up the theme upgrader skin.
+ *
+ * @since 2.8.0
+ *
+ * @param array $args Optional. The theme upgrader skin arguments to
+ * override default options. Default empty array.
*/
public function __construct( $args = array() ) {
$defaults = array(
@@ -36,12 +51,16 @@
}
/**
+ * Action to perform following a single theme update.
+ *
+ * @since 2.8.0
*/
public function after() {
$this->decrement_update_count( 'theme' );
$update_actions = array();
- if ( ! empty( $this->upgrader->result['destination_name'] ) && $theme_info = $this->upgrader->theme_info() ) {
+ $theme_info = $this->upgrader->theme_info();
+ if ( $theme_info ) {
$name = $theme_info->display( 'Name' );
$stylesheet = $this->upgrader->result['destination_name'];
$template = $theme_info->get_template();
@@ -63,24 +82,38 @@
),
admin_url( 'customize.php' )
);
- if ( get_stylesheet() == $stylesheet ) {
+
+ if ( get_stylesheet() === $stylesheet ) {
if ( current_user_can( 'edit_theme_options' ) && current_user_can( 'customize' ) ) {
- $update_actions['preview'] = '<a href="' . esc_url( $customize_url ) . '" class="hide-if-no-customize load-customize">';
- $update_actions['preview'] .= '<span aria-hidden="true">' . __( 'Customize' ) . '</span>';
- /* translators: %s: theme name */
- $update_actions['preview'] .= '<span class="screen-reader-text">' . sprintf( __( 'Customize “%s”' ), $name ) . '</span></a>';
+ $update_actions['preview'] = sprintf(
+ '<a href="%s" class="hide-if-no-customize load-customize">' .
+ '<span aria-hidden="true">%s</span><span class="screen-reader-text">%s</span></a>',
+ esc_url( $customize_url ),
+ __( 'Customize' ),
+ /* translators: %s: Theme name. */
+ sprintf( __( 'Customize “%s”' ), $name )
+ );
}
} elseif ( current_user_can( 'switch_themes' ) ) {
if ( current_user_can( 'edit_theme_options' ) && current_user_can( 'customize' ) ) {
- $update_actions['preview'] = '<a href="' . esc_url( $customize_url ) . '" class="hide-if-no-customize load-customize">';
- $update_actions['preview'] .= '<span aria-hidden="true">' . __( 'Live Preview' ) . '</span>';
- /* translators: %s: theme name */
- $update_actions['preview'] .= '<span class="screen-reader-text">' . sprintf( __( 'Live Preview “%s”' ), $name ) . '</span></a>';
+ $update_actions['preview'] = sprintf(
+ '<a href="%s" class="hide-if-no-customize load-customize">' .
+ '<span aria-hidden="true">%s</span><span class="screen-reader-text">%s</span></a>',
+ esc_url( $customize_url ),
+ __( 'Live Preview' ),
+ /* translators: %s: Theme name. */
+ sprintf( __( 'Live Preview “%s”' ), $name )
+ );
}
- $update_actions['activate'] = '<a href="' . esc_url( $activate_link ) . '" class="activatelink">';
- $update_actions['activate'] .= '<span aria-hidden="true">' . __( 'Activate' ) . '</span>';
- /* translators: %s: theme name */
- $update_actions['activate'] .= '<span class="screen-reader-text">' . sprintf( __( 'Activate “%s”' ), $name ) . '</span></a>';
+
+ $update_actions['activate'] = sprintf(
+ '<a href="%s" class="activatelink">' .
+ '<span aria-hidden="true">%s</span><span class="screen-reader-text">%s</span></a>',
+ esc_url( $activate_link ),
+ __( 'Activate' ),
+ /* translators: %s: Theme name. */
+ sprintf( _x( 'Activate “%s”', 'theme' ), $name )
+ );
}
if ( ! $this->result || is_wp_error( $this->result ) || is_network_admin() ) {
@@ -88,7 +121,11 @@
}
}
- $update_actions['themes_page'] = '<a href="' . self_admin_url( 'themes.php' ) . '" target="_parent">' . __( 'Return to Themes page' ) . '</a>';
+ $update_actions['themes_page'] = sprintf(
+ '<a href="%s" target="_parent">%s</a>',
+ self_admin_url( 'themes.php' ),
+ __( 'Return to Themes page' )
+ );
/**
* Filters the list of action links available following a single theme update.