web/wp-admin/includes/update.php
changeset 204 09a1c134465b
parent 194 32102edaa81b
equal deleted inserted replaced
203:f507feede89a 204:09a1c134465b
    81 	return false;
    81 	return false;
    82 }
    82 }
    83 
    83 
    84 function core_update_footer( $msg = '' ) {
    84 function core_update_footer( $msg = '' ) {
    85 	if ( !current_user_can('update_core') )
    85 	if ( !current_user_can('update_core') )
    86 		return sprintf( __( 'Version %s' ), $GLOBALS['wp_version'] );
    86 		return sprintf( __( 'Version %s' ), get_bloginfo( 'version', 'display' ) );
    87 
    87 
    88 	$cur = get_preferred_from_update_core();
    88 	$cur = get_preferred_from_update_core();
       
    89 	if ( ! is_object( $cur ) )
       
    90 		$cur = new stdClass;
       
    91 
    89 	if ( ! isset( $cur->current ) )
    92 	if ( ! isset( $cur->current ) )
    90 		$cur->current = '';
    93 		$cur->current = '';
    91 
    94 
    92 	if ( ! isset( $cur->url ) )
    95 	if ( ! isset( $cur->url ) )
    93 		$cur->url = '';
    96 		$cur->url = '';
    95 	if ( ! isset( $cur->response ) )
    98 	if ( ! isset( $cur->response ) )
    96 		$cur->response = '';
    99 		$cur->response = '';
    97 
   100 
    98 	switch ( $cur->response ) {
   101 	switch ( $cur->response ) {
    99 	case 'development' :
   102 	case 'development' :
   100 		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' ) );
   103 		return sprintf( __( 'You are using a development version (%1$s). Cool! Please <a href="%2$s">stay updated</a>.' ), get_bloginfo( 'version', 'display' ), network_admin_url( 'update-core.php' ) );
   101 	break;
   104 	break;
   102 
   105 
   103 	case 'upgrade' :
   106 	case 'upgrade' :
   104 		return sprintf( '<strong>'.__( '<a href="%1$s">Get Version %2$s</a>' ).'</strong>', network_admin_url( '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);
   105 	break;
   108 	break;
   106 
   109 
   107 	case 'latest' :
   110 	case 'latest' :
   108 	default :
   111 	default :
   109 		return sprintf( __( 'Version %s' ), $GLOBALS['wp_version'] );
   112 		return sprintf( __( 'Version %s' ), get_bloginfo( 'version', 'display' ) );
   110 	break;
   113 	break;
   111 	}
   114 	}
   112 }
   115 }
   113 add_filter( 'update_footer', 'core_update_footer' );
   116 add_filter( 'update_footer', 'core_update_footer' );
   114 
   117 
   132 		$msg = sprintf( __('<a href="http://codex.wordpress.org/Version_%1$s">WordPress %1$s</a> is available! Please notify the site administrator.'), $cur->current );
   135 		$msg = sprintf( __('<a href="http://codex.wordpress.org/Version_%1$s">WordPress %1$s</a> is available! Please notify the site administrator.'), $cur->current );
   133 	}
   136 	}
   134 	echo "<div class='update-nag'>$msg</div>";
   137 	echo "<div class='update-nag'>$msg</div>";
   135 }
   138 }
   136 add_action( 'admin_notices', 'update_nag', 3 );
   139 add_action( 'admin_notices', 'update_nag', 3 );
       
   140 add_action( 'network_admin_notices', 'update_nag', 3 );
   137 
   141 
   138 // Called directly from dashboard
   142 // Called directly from dashboard
   139 function update_right_now_message() {
   143 function update_right_now_message() {
   140 	$msg = sprintf( __('You are using <span class="b">WordPress %s</span>.'), $GLOBALS['wp_version'] );
   144 	$msg = sprintf( __( 'You are using <span class="b">WordPress %s</span>.' ), get_bloginfo( 'version', 'display' ) );
   141 
   145 
   142 	if ( current_user_can('update_core') ) {
   146 	if ( current_user_can('update_core') ) {
   143 		$cur = get_preferred_from_update_core();
   147 		$cur = get_preferred_from_update_core();
   144 
   148 
   145 		if ( isset( $cur->response ) && $cur->response == 'upgrade' )
   149 		if ( isset( $cur->response ) && $cur->response == 'upgrade' )