WordPress.org

Make WordPress Core

Changeset 11525


Ignore:
Timestamp:
06/06/09 08:14:41 (5 years ago)
Author:
azaozz
Message:

WP Upgrader improvements, props DD32, fixes #9836

Location:
trunk/wp-admin
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/includes/class-wp-upgrader.php

    r11506 r11525  
    392392        $current = get_transient( 'update_plugins' ); 
    393393        if ( !isset( $current->response[ $plugin ] ) ) { 
     394            $this->skin->set_result(false); 
    394395            $this->skin->error('up_to_date'); 
     396            $this->skin->after(); 
    395397            return false; 
    396             //return new WP_Error('up_to_date', $this->strings['up_to_date']); 
    397398        } 
    398399 
     
    554555        // Is an update available? 
    555556        $current = get_transient( 'update_themes' ); 
    556         if ( !isset( $current->response[ $theme ] ) ) 
    557             return new WP_Error('up_to_date', $this->strings['up_to_date']); 
    558  
     557        if ( !isset( $current->response[ $theme ] ) ) { 
     558            $this->skin->set_result(false); 
     559            $this->skin->error('up_to_date'); 
     560            $this->skin->after(); 
     561            return false; 
     562        } 
     563         
    559564        $r = $current->response[ $theme ]; 
    560565 
     
    985990    function after() { 
    986991 
    987         if ( empty($this->upgrader->result['destination_name']) ) 
    988             return; 
    989  
    990         $theme_info = $this->upgrader->theme_info(); 
    991         if ( empty($theme_info) ) 
    992             return; 
    993         $name = $theme_info['Name']; 
    994         $stylesheet = $this->upgrader->result['destination_name']; 
    995         $template = !empty($theme_info['Template']) ? $theme_info['Template'] : $stylesheet; 
    996  
    997         $preview_link = htmlspecialchars( add_query_arg( array('preview' => 1, 'template' => $template, 'stylesheet' => $stylesheet, 'TB_iframe' => 'true' ), trailingslashit(esc_url(get_option('home'))) ) ); 
    998         $activate_link = wp_nonce_url("themes.php?action=activate&template=" . urlencode($template) . "&stylesheet=" . urlencode($stylesheet), 'switch-theme_' . $template); 
    999  
    1000         $update_actions =  array( 
    1001             'preview' => '<a href="' . $preview_link . '" class="thickbox thickbox-preview" title="' . esc_attr(sprintf(__('Preview &#8220;%s&#8221;'), $name)) . '">' . __('Preview') . '</a>', 
    1002             'activate' => '<a href="' . $activate_link .  '" class="activatelink" title="' . esc_attr( sprintf( __('Activate &#8220;%s&#8221;'), $name ) ) . '">' . __('Activate') . '</a>', 
    1003             'themes_page' => '<a href="' . admin_url('themes.php') . '" title="' . esc_attr__('Return to Themes page') . '" target="_parent">' . __('Return to Themes page') . '</a>', 
    1004         ); 
    1005         if ( ( ! $this->result || is_wp_error($this->result) ) || $stylesheet == get_stylesheet() ) 
    1006             unset($update_actions['preview'], $update_actions['activate']); 
     992        if ( !empty($this->upgrader->result['destination_name']) && 
     993            ($theme_info = $this->upgrader->theme_info()) && 
     994            !empty($theme_info) ) { 
     995 
     996            $name = $theme_info['Name']; 
     997            $stylesheet = $this->upgrader->result['destination_name']; 
     998            $template = !empty($theme_info['Template']) ? $theme_info['Template'] : $stylesheet; 
     999     
     1000            $preview_link = htmlspecialchars( add_query_arg( array('preview' => 1, 'template' => $template, 'stylesheet' => $stylesheet, 'TB_iframe' => 'true' ), trailingslashit(esc_url(get_option('home'))) ) ); 
     1001            $activate_link = wp_nonce_url("themes.php?action=activate&amp;template=" . urlencode($template) . "&amp;stylesheet=" . urlencode($stylesheet), 'switch-theme_' . $template); 
     1002     
     1003            $update_actions =  array( 
     1004                'preview' => '<a href="' . $preview_link . '" class="thickbox thickbox-preview" title="' . esc_attr(sprintf(__('Preview &#8220;%s&#8221;'), $name)) . '">' . __('Preview') . '</a>', 
     1005                'activate' => '<a href="' . $activate_link .  '" class="activatelink" title="' . esc_attr( sprintf( __('Activate &#8220;%s&#8221;'), $name ) ) . '">' . __('Activate') . '</a>', 
     1006            ); 
     1007            if ( ( ! $this->result || is_wp_error($this->result) ) || $stylesheet == get_stylesheet() ) 
     1008                unset($update_actions['preview'], $update_actions['activate']); 
     1009        } 
     1010 
     1011        $update_actions['themes_page'] = '<a href="' . admin_url('themes.php') . '" title="' . esc_attr__('Return to Themes page') . '" target="_parent">' . __('Return to Themes page') . '</a>'; 
    10071012 
    10081013        $update_actions = apply_filters('update_theme_complete_actions', $update_actions, $this->theme); 
  • trunk/wp-admin/themes.php

    r11505 r11525  
    113113 
    114114        if ( ! current_user_can('update_themes') ) 
    115             printf( '<p>' . __('There is a new version of %1$s available. <a href="%2$s" class="thickbox" title="%1$s">View version %3$s Details</a>.') . '</p>', $theme_name, $details_url, $update['new_version']); 
     115            printf( '<p><strong>' . __('There is a new version of %1$s available. <a href="%2$s" class="thickbox" title="%1$s">View version %3$s Details</a>.') . '</strong></p>', $theme_name, $details_url, $update['new_version']); 
    116116        else if ( empty($update->package) ) 
    117             printf( '<p>' . __('There is a new version of %1$s available. <a href="%2$s" class="thickbox" title="%1$s">View version %3$s Details</a> <em>automatic upgrade unavailable for this theme</em>.') . '</p>', $theme_name, $details_url, $update['new_version']); 
     117            printf( '<p><strong>' . __('There is a new version of %1$s available. <a href="%2$s" class="thickbox" title="%1$s">View version %3$s Details</a> <em>automatic upgrade unavailable for this theme</em>.') . '</strong></p>', $theme_name, $details_url, $update['new_version']); 
    118118        else 
    119             printf( '<p>' . __('There is a new version of %1$s available. <a href="%2$s" class="thickbox" title="%1$s">View version %3$s Details</a> or <a href="%4$s" %5$s >upgrade automatically</a>.') . '</p>', $theme_name, $details_url, $update['new_version'], $update_url, $update_onclick ); 
     119            printf( '<p><strong>' . __('There is a new version of %1$s available. <a href="%2$s" class="thickbox" title="%1$s">View version %3$s Details</a> or <a href="%4$s" %5$s >upgrade automatically</a>.') . '</strong></p>', $theme_name, $details_url, $update['new_version'], $update_url, $update_onclick ); 
    120120    } 
    121121} 
  • trunk/wp-admin/wp-admin.css

    r11523 r11525  
    816816} 
    817817 
    818 #update-nag a, 
    819 .plugin-update a { 
    820     font-size: 1.1em; 
    821 } 
    822  
    823818#pass-strength-result { 
    824819    border-style: solid; 
Note: See TracChangeset for help on using the changeset viewer.