Make WordPress Core

Ticket #29046: 29046.diff

File 29046.diff, 2.7 KB (added by voldemortensen, 12 years ago)
  • src/wp-admin/includes/update.php

     
    196196
    197197        global $pagenow;
    198198
     199        $plugin_needs_update = maybe_unserialize( get_site_transient('update_plugins'));
     200        foreach( $plugin_needs_update->response as $plugins => $plugin_slugs ) {
     201                $plugin_slug =  $plugin_slugs->slug;
     202                $url = $http_url = 'http://api.wordpress.org/plugins/info/1.0/';
     203                if ( $ssl = wp_http_supports( array( 'ssl' ) ) )
     204                        $url = set_url_scheme( $url, 'https' );
     205                // Check the Plugin repo for plugin information
     206                $request = wp_remote_post( $url . $plugin_slug );
     207                $res = maybe_unserialize( wp_remote_retrieve_body( $request ) );
     208                // Check for the "security-update" tag on the .org repo
     209                if( isset( $res->tags['security-update'] ) ) {
     210                        $plugin_security_update = $res->tags['security-update'];
     211                }
     212        }
     213
    199214        if ( 'update-core.php' == $pagenow )
    200215                return;
    201216
    202217        $cur = get_preferred_from_update_core();
    203218
    204         if ( ! isset( $cur->response ) || $cur->response != 'upgrade' )
    205                 return false;
    206 
    207         if ( current_user_can('update_core') ) {
    208                 $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' ) );
     219        if ( isset( $cur->response ) || $cur->response == 'upgrade' ) {
     220                if ( current_user_can('update_core') ) {
     221                        $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' ) );
     222                } else {
     223                        $msg = sprintf( __('<a href="http://codex.wordpress.org/Version_%1$s">WordPress %1$s</a> is available! Please notify the site administrator.'), $cur->current );
     224                        echo "<div class='update-nag'>$msg</div>";
     225                }
    209226        } else {
    210                 $msg = sprintf( __('<a href="http://codex.wordpress.org/Version_%1$s">WordPress %1$s</a> is available! Please notify the site administrator.'), $cur->current );
     227                return;
    211228        }
    212         echo "<div class='update-nag'>$msg</div>";
     229
     230        if ( isset( $plugin_security_update ) && $plugin_security_update == 'security-update' ) {
     231                if ( current_user_can( 'update_plugins' ) ) {
     232                        $msg = sprintf( __('A plugin you have installed has issued a security release. <a href="%1$s">Please update now.</a>'), network_admin_url( 'update-core.php' ) );
     233                        echo "<div class='update-nag'>$msg</div>";
     234                } else {
     235                        return;
     236                }
     237        }
    213238}
    214239add_action( 'admin_notices', 'update_nag', 3 );
    215240add_action( 'network_admin_notices', 'update_nag', 3 );