diff -r 3d4e9c994f10 -r a86126ab1dd4 wp/wp-admin/includes/class-theme-upgrader-skin.php --- 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'] = ''; - $update_actions['preview'] .= ''; - /* translators: %s: theme name */ - $update_actions['preview'] .= '' . sprintf( __( 'Customize “%s”' ), $name ) . ''; + $update_actions['preview'] = sprintf( + '' . + '%s', + 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'] = ''; - $update_actions['preview'] .= ''; - /* translators: %s: theme name */ - $update_actions['preview'] .= '' . sprintf( __( 'Live Preview “%s”' ), $name ) . ''; + $update_actions['preview'] = sprintf( + '' . + '%s', + esc_url( $customize_url ), + __( 'Live Preview' ), + /* translators: %s: Theme name. */ + sprintf( __( 'Live Preview “%s”' ), $name ) + ); } - $update_actions['activate'] = ''; - $update_actions['activate'] .= ''; - /* translators: %s: theme name */ - $update_actions['activate'] .= '' . sprintf( __( 'Activate “%s”' ), $name ) . ''; + + $update_actions['activate'] = sprintf( + '' . + '%s', + 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'] = '' . __( 'Return to Themes page' ) . ''; + $update_actions['themes_page'] = sprintf( + '%s', + self_admin_url( 'themes.php' ), + __( 'Return to Themes page' ) + ); /** * Filters the list of action links available following a single theme update.