wppaste
WordPress

Theme_Upgrader_Skin

Since
2.8.0, 4.6.0
Source
wp-admin/includes/class-theme-upgrader-skin.php:18
Theme Upgrader Skin for WordPress Theme Upgrades.

Compatibility

WordPress
since 4.6.0
  • 6.7.7
  • 6.8.8
  • 6.9.7
  • 7.0.4
  • 7.1.0

Present in every tracked release (6.7.7 to 7.1.0).

Hooks and filters fired · 1

Every hook that fires from inside Theme_Upgrader_Skin, in the order it appears in the class, grouped by the method that fires it.

Properties · 1

$themestringpublic
Holds the theme slug in the Theme Directory.

Methods · 2

Source code

class Theme_Upgrader_Skin extends WP_Upgrader_Skin { 	/**	 * Holds the theme slug in the Theme Directory.	 *	 * @since 2.8.0	 *	 * @var string	 */	public $theme = ''; 	/**	 * 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(			'url'   => '',			'theme' => '',			'nonce' => '',			'title' => __( 'Update Theme' ),		);		$args     = wp_parse_args( $args, $defaults ); 		$this->theme = $args['theme']; 		parent::__construct( $args );	} 	/**	 * Performs an action following a single theme update.	 *	 * @since 2.8.0	 */	public function after() {		$this->decrement_update_count( 'theme' ); 		$update_actions = array();		$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(); 			$activate_link = add_query_arg(				array(					'action'     => 'activate',					'template'   => urlencode( $template ),					'stylesheet' => urlencode( $stylesheet ),				),				admin_url( 'themes.php' )			);			$activate_link = wp_nonce_url( $activate_link, 'switch-theme_' . $stylesheet ); 			$customize_url = add_query_arg(				array(					'theme'  => urlencode( $stylesheet ),					'return' => urlencode( admin_url( 'themes.php' ) ),				),				admin_url( 'customize.php' )			); 			if ( get_stylesheet() === $stylesheet ) {				if ( current_user_can( 'edit_theme_options' ) && current_user_can( 'customize' ) ) {					$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: Hidden accessibility text. %s: Theme name. */						sprintf( __( 'Customize &#8220;%s&#8221;' ), $name )					);				}			} elseif ( current_user_can( 'switch_themes' ) ) {

Changelog

Introduced in 2.8.0. Unchanged from 6.7.7 through 7.1.0.

  1. 6.7.7
  2. 6.8.8
  3. 6.9.7
  4. 7.0.4
  5. 7.1.0

Signature, return type and hooks compared across 5 parsed releases.

4.6.0
Moved to its own file from wp-admin/includes/class-wp-upgrader-skins.php.from the docblock
2.8.0
Introduced.from the docblock

About this page

Parsed data
Generated from the wordpress-develop 6.7.7 tag, from src/wp-admin/includes/class-theme-upgrader-skin.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.
Corrections
Something wrong on this page? Report it and it gets fixed in the next regeneration.