Theme_Upgrader_Skin

Theme Upgrader Skin for WordPress Theme Upgrades.

Defined (1)

The class is defined in the following location(s).

/wp-admin/includes/class-theme-upgrader-skin.php  
  1. class Theme_Upgrader_Skin extends WP_Upgrader_Skin { 
  2. public $theme = ''; 
  3.  
  4. /** 
  5. * @param array $args 
  6. */ 
  7. public function __construct($args = array()) { 
  8. $defaults = array( 'url' => '', 'theme' => '', 'nonce' => '', 'title' => __('Update Theme') ); 
  9. $args = wp_parse_args($args, $defaults); 
  10.  
  11. $this->theme = $args['theme']; 
  12.  
  13. parent::__construct($args); 
  14.  
  15. /** 
  16. * @access public 
  17. */ 
  18. public function after() { 
  19. $this->decrement_update_count( 'theme' ); 
  20.  
  21. $update_actions = array(); 
  22. if ( ! empty( $this->upgrader->result['destination_name'] ) && $theme_info = $this->upgrader->theme_info() ) { 
  23. $name = $theme_info->display('Name'); 
  24. $stylesheet = $this->upgrader->result['destination_name']; 
  25. $template = $theme_info->get_template(); 
  26.  
  27. $activate_link = add_query_arg( array( 
  28. 'action' => 'activate',  
  29. 'template' => urlencode( $template ),  
  30. 'stylesheet' => urlencode( $stylesheet ),  
  31. ), admin_url('themes.php') ); 
  32. $activate_link = wp_nonce_url( $activate_link, 'switch-theme_' . $stylesheet ); 
  33.  
  34. if ( get_stylesheet() == $stylesheet ) { 
  35. if ( current_user_can( 'edit_theme_options' ) && current_user_can( 'customize' ) ) { 
  36. $update_actions['preview'] = '<a href="' . wp_customize_url( $stylesheet ) . '" class="hide-if-no-customize load-customize"><span aria-hidden="true">' . __( 'Customize' ) . '</span><span class="screen-reader-text">' . sprintf( __( 'Customize “%s”' ), $name ) . '</span></a>'; 
  37. } elseif ( current_user_can( 'switch_themes' ) ) { 
  38. if ( current_user_can( 'edit_theme_options' ) && current_user_can( 'customize' ) ) { 
  39. $update_actions['preview'] = '<a href="' . wp_customize_url( $stylesheet ) . '" class="hide-if-no-customize load-customize"><span aria-hidden="true">' . __( 'Live Preview' ) . '</span><span class="screen-reader-text">' . sprintf( __( 'Live Preview “%s”' ), $name ) . '</span></a>'; 
  40. $update_actions['activate'] = '<a href="' . esc_url( $activate_link ) . '" class="activatelink"><span aria-hidden="true">' . __( 'Activate' ) . '</span><span class="screen-reader-text">' . sprintf( __( 'Activate “%s”' ), $name ) . '</span></a>'; 
  41.  
  42. if ( ! $this->result || is_wp_error( $this->result ) || is_network_admin() ) 
  43. unset( $update_actions['preview'], $update_actions['activate'] ); 
  44.  
  45. $update_actions['themes_page'] = '<a href="' . self_admin_url( 'themes.php' ) . '" target="_parent">' . __( 'Return to Themes page' ) . '</a>'; 
  46.  
  47. /** 
  48. * Filters the list of action links available following a single theme update. 
  49. * @since 2.8.0 
  50. * @param array $update_actions Array of theme action links. 
  51. * @param string $theme Theme directory name. 
  52. */ 
  53. $update_actions = apply_filters( 'update_theme_complete_actions', $update_actions, $this->theme ); 
  54.  
  55. if ( ! empty($update_actions) ) 
  56. $this->feedback(implode(' | ', (array)$update_actions));