Make WordPress Core


Ignore:
File:
1 edited

Legend:

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

    r14319 r17322  
    101101    switch ( $cur->response ) {
    102102    case 'development' :
    103         return sprintf( __( 'You are using a development version (%1$s). Cool! Please <a href="%2$s">stay updated</a>.' ), $GLOBALS['wp_version'], 'update-core.php');
     103        return sprintf( __( 'You are using a development version (%1$s). Cool! Please <a href="%2$s">stay updated</a>.' ), $GLOBALS['wp_version'], network_admin_url( 'update-core.php' ) );
    104104    break;
    105105
    106106    case 'upgrade' :
    107         return sprintf( '<strong>'.__( '<a href="%1$s">Get Version %2$s</a>' ).'</strong>', 'update-core.php', $cur->current);
     107        return sprintf( '<strong>'.__( '<a href="%1$s">Get Version %2$s</a>' ).'</strong>', network_admin_url( 'update-core.php' ), $cur->current);
    108108    break;
    109109
     
    130130        return false;
    131131
    132     if ( current_user_can('update_core') )
    133         $msg = sprintf( __('<a href="http://codex.wordpress.org/Version_%1$s">WordPress %1$s</a> is available! <a href="%2$s">Please update now</a>.'), $cur->current, 'update-core.php' );
    134     else
     132    if ( current_user_can('update_core') ) {
     133        $msg = sprintf( __('<a href="http://codex.wordpress.org/Version_%1$s">WordPress %1$s</a> is available! <a href="%2$s">Please update now</a>.'), $cur->current, network_admin_url( 'update-core.php' ) );
     134    } else {
    135135        $msg = sprintf( __('<a href="http://codex.wordpress.org/Version_%1$s">WordPress %1$s</a> is available! Please notify the site administrator.'), $cur->current );
    136 
     136    }
    137137    echo "<div class='update-nag'>$msg</div>";
    138138}
     
    147147
    148148    $msg = sprintf( __('You are using <span class="b">WordPress %s</span>.'), $GLOBALS['wp_version'] );
    149     if ( isset( $cur->response ) && $cur->response == 'upgrade' && current_user_can('update_core') )
    150         $msg .= " <a href='update-core.php' class='button'>" . sprintf( __('Update to %s'), $cur->current ? $cur->current : __( 'Latest' ) ) . '</a>';
     149
     150    if ( isset( $cur->response ) && $cur->response == 'upgrade' && current_user_can('update_core') ) {
     151        $msg .= " <a href='" . network_admin_url( 'update-core.php' ) . "' class='button'>" . sprintf( __('Update to %s'), $cur->current ? $cur->current : __( 'Latest' ) ) . '</a>';
     152    }
    151153
    152154    echo "<span id='wp-version-message'>$msg</span>";
     
    191193    $plugin_name = wp_kses( $plugin_data['Name'], $plugins_allowedtags );
    192194
    193     $details_url = admin_url('plugin-install.php?tab=plugin-information&plugin=' . $r->slug . '&TB_iframe=true&width=600&height=800');
    194 
    195     echo '<tr class="plugin-update-tr"><td colspan="3" class="plugin-update"><div class="update-message">';
    196     if ( ! current_user_can('update_plugins') )
    197         printf( __('There is a new version of %1$s available. <a href="%2$s" class="thickbox" title="%3$s">View version %4$s Details</a>.'), $plugin_name, esc_url($details_url), esc_attr($plugin_name), $r->new_version );
    198     else if ( empty($r->package) )
    199         printf( __('There is a new version of %1$s available. <a href="%2$s" class="thickbox" title="%3$s">View version %4$s Details</a> <em>automatic upgrade unavailable for this plugin</em>.'), $plugin_name, esc_url($details_url), esc_attr($plugin_name), $r->new_version );
    200     else
    201         printf( __('There is a new version of %1$s available. <a href="%2$s" class="thickbox" title="%3$s">View version %4$s Details</a> or <a href="%5$s">upgrade automatically</a>.'), $plugin_name, esc_url($details_url), esc_attr($plugin_name), $r->new_version, wp_nonce_url('update.php?action=upgrade-plugin&plugin=' . $file, 'upgrade-plugin_' . $file) );
     195    $details_url = self_admin_url('plugin-install.php?tab=plugin-information&plugin=' . $r->slug . '&TB_iframe=true&width=600&height=800');
     196
     197    $wp_list_table = _get_list_table('WP_Plugins_List_Table');
     198
     199    if ( is_network_admin() || !is_multisite() ) {
     200        echo '<tr class="plugin-update-tr"><td colspan="' . $wp_list_table->get_column_count() . '" class="plugin-update colspanchange"><div class="update-message">';
     201        if ( ! current_user_can('update_plugins') )
     202            printf( __('There is a new version of %1$s available. <a href="%2$s" class="thickbox" title="%3$s">View version %4$s details</a>.'), $plugin_name, esc_url($details_url), esc_attr($plugin_name), $r->new_version );
     203        else if ( empty($r->package) )
     204            printf( __('There is a new version of %1$s available. <a href="%2$s" class="thickbox" title="%3$s">View version %4$s details</a>. <em>Automatic update is unavailable for this plugin.</em>'), $plugin_name, esc_url($details_url), esc_attr($plugin_name), $r->new_version );
     205        else
     206            printf( __('There is a new version of %1$s available. <a href="%2$s" class="thickbox" title="%3$s">View version %4$s details</a> or <a href="%5$s">update automatically</a>.'), $plugin_name, esc_url($details_url), esc_attr($plugin_name), $r->new_version, wp_nonce_url( self_admin_url('update.php?action=upgrade-plugin&plugin=') . $file, 'upgrade-plugin_' . $file) );
     207    }
    202208
    203209    do_action( "in_plugin_update_message-$file", $plugin_data, $r );
     
    240246}
    241247
     248function wp_theme_update_rows() {
     249    if ( !current_user_can('update_themes' ) )
     250        return;
     251
     252    $themes = get_site_transient( 'update_themes' );
     253    if ( isset($themes->response) && is_array($themes->response) ) {
     254        $themes = array_keys( $themes->response );
     255
     256        foreach( $themes as $theme ) {
     257            add_action( "after_theme_row_$theme", 'wp_theme_update_row', 10, 2 );
     258        }
     259    }
     260}
     261add_action( 'admin_init', 'wp_theme_update_rows' );
     262
     263function wp_theme_update_row( $theme_key, $theme ) {
     264    $current = get_site_transient( 'update_themes' );
     265    if ( !isset( $current->response[ $theme_key ] ) )
     266        return false;
     267    $r = $current->response[ $theme_key ];
     268    $themes_allowedtags = array('a' => array('href' => array(),'title' => array()),'abbr' => array('title' => array()),'acronym' => array('title' => array()),'code' => array(),'em' => array(),'strong' => array());
     269    $theme_name = wp_kses( $theme['Name'], $themes_allowedtags );
     270
     271    $details_url = self_admin_url("theme-install.php?tab=theme-information&theme=$theme_key&TB_iframe=true&width=600&height=400");
     272
     273    $wp_list_table = _get_list_table('WP_MS_Themes_List_Table');
     274
     275    echo '<tr class="plugin-update-tr"><td colspan="' . $wp_list_table->get_column_count() . '" class="plugin-update colspanchange"><div class="update-message">';
     276    if ( ! current_user_can('update_themes') )
     277        printf( __('There is a new version of %1$s available. <a href="%2$s" class="thickbox" title="%3$s">View version %4$s details</a>.'), $theme['Name'], esc_url($details_url), esc_attr($theme['Name']), $r->new_version );
     278    else if ( empty( $r['package'] ) )
     279        printf( __('There is a new version of %1$s available. <a href="%2$s" class="thickbox" title="%3$s">View version %4$s details</a>. <em>Automatic update is unavailable for this plugin.</em>'), $theme['Name'], esc_url($details_url), esc_attr($theme['Name']), $r['new_version'] );
     280    else
     281        printf( __('There is a new version of %1$s available. <a href="%2$s" class="thickbox" title="%3$s">View version %4$s details</a> or <a href="%5$s">update automatically</a>.'), $theme['Name'], esc_url($details_url), esc_attr($theme['Name']), $r['new_version'], wp_nonce_url( self_admin_url('update.php?action=upgrade-theme&theme=') . $theme_key, 'upgrade-theme_' . $theme_key) );
     282
     283    do_action( "in_theme_update_message-$theme_key", $theme, $r );
     284
     285    echo '</div></td></tr>';
     286}
    242287
    243288function wp_update_core($current, $feedback = '') {
Note: See TracChangeset for help on using the changeset viewer.