Changeset 7237
- Timestamp:
- 03/11/08 16:13:07 (10 months ago)
- Files:
-
- trunk/wp-admin/includes/update.php (modified) (3 diffs)
- trunk/wp-admin/index.php (modified) (1 diff)
- trunk/wp-includes/update.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/wp-admin/includes/update.php
r7209 r7237 1 1 <?php 2 2 3 // The admin side of our 1. 0update system3 // The admin side of our 1.1 update system 4 4 5 5 function core_update_footer( $msg = '' ) { … … 11 11 switch ( $cur->response ) { 12 12 case 'development' : 13 return sprintf( '| '.__( 'You are using a development version (%s). Cool! Please <a href="%s">stay updated</a>.' ), $GLOBALS['wp_version'], 'http://wordpress.org/download/svn/');13 return sprintf( '| '.__( 'You are using a development version (%s). Cool! Please <a href="%s">stay updated</a>.' ), $GLOBALS['wp_version'], $cur->url, $cur->current ); 14 14 break; 15 15 16 16 case 'upgrade' : 17 return sprintf( '| <strong>'.__( 'Your WordPress %s is out of date. <a href="%s">Please update</a>.' ).'</strong>', $GLOBALS['wp_version'], $cur->url ); 18 break; 17 if ( current_user_can('manage_options') ) { 18 return sprintf( '| <strong>'.__( '<a href="%2$s">Get Version %3$s</a>' ).'</strong>', $GLOBALS['wp_version'], $cur->url, $cur->current ); 19 break; 20 } 19 21 20 22 case 'latest' : 21 23 default : 22 return sprintf( '| '.__( 'Version %s' ), $GLOBALS['wp_version'] );24 return sprintf( '| '.__( 'Version %s' ), $GLOBALS['wp_version'], $cur->url, $cur->current ); 23 25 break; 24 26 } … … 33 35 34 36 if ( current_user_can('manage_options') ) 35 $msg = sprintf( __(' A new version of WordPress is available! <a href="%s">Please update now</a>.'), $cur->url);37 $msg = sprintf( __('WordPress %2$s is available! <a href="%1$s">Please update now</a>.'), $cur->url, $cur->current ); 36 38 else 37 $msg = __('A new version of WordPress is available! Please notify the site administrator.');39 $msg = sprintf( __('WordPress %2$s is available! Please notify the site administrator.'), $cur->url, $cur->current ); 38 40 39 41 echo "<div id='update-nag'>$msg</div>"; 40 42 } 41 43 add_action( 'admin_notices', 'update_nag', 3 ); 44 45 // Called directly from dashboard 46 function update_right_now_message() { 47 $cur = get_option( 'update_core' ); 48 49 $msg = sprintf( __('This is WordPress version %s.'), $GLOBALS['wp_version'] ); 50 if ( isset( $cur->response ) && $cur->response == 'upgrade' && current_user_can('manage_options') ) 51 $msg .= " <a href='$cur->url' class='rbutton'>" . sprintf( __('Update to %s'), $cur->current ? $cur->current : __( 'Latest' ) ) . '</a>'; 52 53 echo "<span id='wp-version-message'>$msg</span>"; 54 } 42 55 43 56 function wp_update_plugins() { trunk/wp-admin/index.php
r7217 r7237 102 102 <a href="themes.php" class="rbutton"><?php _e('Change Theme'); ?></a> 103 103 <?php endif; ?> 104 <?php printf( __( "This is WordPress version %s." ), $GLOBALS['wp_version']); ?>104 <?php update_right_now_message(); ?> 105 105 </p> 106 106 trunk/wp-includes/update.php
r6925 r7237 40 40 $new_option->version_checked = $wp_version; 41 41 42 $http_request = "GET /core/version-check/1. 0/?version=$wp_version&php=$php_version&locale=$locale HTTP/1.0\r\n";42 $http_request = "GET /core/version-check/1.1/?version=$wp_version&php=$php_version&locale=$locale HTTP/1.0\r\n"; 43 43 $http_request .= "Host: api.wordpress.org\r\n"; 44 44 $http_request .= 'Content-Type: application/x-www-form-urlencoded; charset=' . get_option('blog_charset') . "\r\n"; … … 54 54 55 55 $response = explode("\r\n\r\n", $response, 2); 56 if ( !preg_match( '|HTTP/.*? 200|', $response[0] ) ) 57 return false; 58 56 59 $body = trim( $response[1] ); 57 60 $body = str_replace(array("\r\n", "\r"), "\n", $body); … … 59 62 $returns = explode("\n", $body); 60 63 61 $new_option->response = $returns[0];64 $new_option->response = attribute_escape( $returns[0] ); 62 65 if ( isset( $returns[1] ) ) 63 $new_option->url = $returns[1]; 66 $new_option->url = clean_url( $returns[1] ); 67 if ( isset( $returns[2] ) ) 68 $new_option->current = attribute_escape( $returns[2] ); 64 69 } 65 70 update_option( 'update_core', $new_option );
