- Timestamp:
- 11/30/2017 11:09:33 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/includes/class-theme-upgrader-skin.php
r41797 r42343 20 20 21 21 /** 22 *23 22 * @param array $args 24 23 */ 25 public function __construct($args = array()) { 26 $defaults = array( 'url' => '', 'theme' => '', 'nonce' => '', 'title' => __('Update Theme') ); 27 $args = wp_parse_args($args, $defaults); 24 public function __construct( $args = array() ) { 25 $defaults = array( 26 'url' => '', 27 'theme' => '', 28 'nonce' => '', 29 'title' => __( 'Update Theme' ), 30 ); 31 $args = wp_parse_args( $args, $defaults ); 28 32 29 33 $this->theme = $args['theme']; 30 34 31 parent::__construct( $args);35 parent::__construct( $args ); 32 36 } 33 37 … … 39 43 $update_actions = array(); 40 44 if ( ! empty( $this->upgrader->result['destination_name'] ) && $theme_info = $this->upgrader->theme_info() ) { 41 $name = $theme_info->display( 'Name');45 $name = $theme_info->display( 'Name' ); 42 46 $stylesheet = $this->upgrader->result['destination_name']; 43 47 $template = $theme_info->get_template(); 44 48 45 $activate_link = add_query_arg( array( 46 'action' => 'activate', 47 'template' => urlencode( $template ), 48 'stylesheet' => urlencode( $stylesheet ), 49 ), admin_url('themes.php') ); 49 $activate_link = add_query_arg( 50 array( 51 'action' => 'activate', 52 'template' => urlencode( $template ), 53 'stylesheet' => urlencode( $stylesheet ), 54 ), admin_url( 'themes.php' ) 55 ); 50 56 $activate_link = wp_nonce_url( $activate_link, 'switch-theme_' . $stylesheet ); 51 57 52 58 $customize_url = add_query_arg( 53 59 array( 54 'theme' => urlencode( $stylesheet ),60 'theme' => urlencode( $stylesheet ), 55 61 'return' => urlencode( admin_url( 'themes.php' ) ), 56 62 ), … … 59 65 if ( get_stylesheet() == $stylesheet ) { 60 66 if ( current_user_can( 'edit_theme_options' ) && current_user_can( 'customize' ) ) { 61 $update_actions['preview'] 67 $update_actions['preview'] = '<a href="' . esc_url( $customize_url ) . '" class="hide-if-no-customize load-customize"><span aria-hidden="true">' . __( 'Customize' ) . '</span><span class="screen-reader-text">' . sprintf( __( 'Customize “%s”' ), $name ) . '</span></a>'; 62 68 } 63 69 } elseif ( current_user_can( 'switch_themes' ) ) { … … 68 74 } 69 75 70 if ( ! $this->result || is_wp_error( $this->result ) || is_network_admin() ) 76 if ( ! $this->result || is_wp_error( $this->result ) || is_network_admin() ) { 71 77 unset( $update_actions['preview'], $update_actions['activate'] ); 78 } 72 79 } 73 80 … … 84 91 $update_actions = apply_filters( 'update_theme_complete_actions', $update_actions, $this->theme ); 85 92 86 if ( ! empty($update_actions) ) 87 $this->feedback(implode(' | ', (array)$update_actions)); 93 if ( ! empty( $update_actions ) ) { 94 $this->feedback( implode( ' | ', (array) $update_actions ) ); 95 } 88 96 } 89 97 }
Note: See TracChangeset
for help on using the changeset viewer.