Changeset 9543
- Timestamp:
- 11/06/2008 03:31:41 AM (16 years ago)
- Location:
- trunk/wp-admin
- Files:
-
- 1 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/includes/update.php
r9524 r9543 95 95 switch ( $cur->response ) { 96 96 case 'development' : 97 return sprintf( __( 'You are using a development version (%1$s). Cool! Please <a href="%2$s">stay updated</a>.' ), $GLOBALS['wp_version'], 'update .php?action=upgrade-core');97 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'); 98 98 break; 99 99 100 100 case 'upgrade' : 101 101 if ( current_user_can('manage_options') ) { 102 return sprintf( '<strong>'.__( '<a href="%1$s">Get Version %2$s</a>' ).'</strong>', wp_nonce_url('update.php?action=upgrade-core', 'upgrade-core'), $cur->current);102 return sprintf( '<strong>'.__( '<a href="%1$s">Get Version %2$s</a>' ).'</strong>', 'update-core.php', $cur->current); 103 103 break; 104 104 } … … 119 119 120 120 if ( current_user_can('manage_options') ) 121 $msg = sprintf( __('WordPress %1$s is available! <a href="%2$s">Please update now</a>.'), $cur->current, 'update .php?action=upgrade-core' );121 $msg = sprintf( __('WordPress %1$s is available! <a href="%2$s">Please update now</a>.'), $cur->current, 'update-core.php' ); 122 122 else 123 123 $msg = sprintf( __('WordPress %1$s is available! Please notify the site administrator.'), $cur->current ); … … 133 133 $msg = sprintf( __('You are using <span class="b">WordPress %s</span>.'), $GLOBALS['wp_version'] ); 134 134 if ( isset( $cur->response ) && $cur->response == 'upgrade' && current_user_can('manage_options') ) 135 $msg .= " <a href='update .php?action=upgrade-core' class='button'>" . sprintf( __('Update to %s'), $cur->current ? $cur->current : __( 'Latest' ) ) . '</a>';135 $msg .= " <a href='update-core.php' class='button'>" . sprintf( __('Update to %s'), $cur->current ? $cur->current : __( 'Latest' ) ) . '</a>'; 136 136 137 137 echo "<span id='wp-version-message'>$msg</span>"; … … 480 480 481 481 if ( current_user_can('manage_options') ) 482 $msg = sprintf( __('An automated WordPress update has failed to complete - <a href="%s">please attempt the update again now</a>.'), 'update .php?action=upgrade-core' );482 $msg = sprintf( __('An automated WordPress update has failed to complete - <a href="%s">please attempt the update again now</a>.'), 'update-core.php' ); 483 483 else 484 484 $msg = __('An automated WordPress update has failed to complete! Please notify the site administrator.'); -
trunk/wp-admin/menu.php
r9537 r9543 92 92 if ( ! $is_opera ) 93 93 $submenu['import.php'][20] = array( __('Turbo'), 'read', 'turbo.php' ); 94 $submenu['import.php'][30] = array( __('Update'), 'read', wp_nonce_url('update.php?action=upgrade-core', 'upgrade-core'));94 $submenu['import.php'][30] = array( __('Update'), 'read', 'update-core.php'); 95 95 96 96 $menu[50] = array( __('Settings'), 'manage_options', 'options-general.php', '', 'menu-top-last', 'menu-settings', 'images/menu/settings.png' ); -
trunk/wp-admin/update.php
r9441 r9543 1 1 <?php 2 2 /** 3 * Update Plugin / Core administration panel.3 * Update Plugin/Theme administration panel. 4 4 * 5 5 * @package WordPress … … 123 123 } 124 124 125 function list_core_update( $update ) {126 $version_string = 'en_US' == $update->locale?127 $update->current : sprintf("%s–<strong>%s</strong>", $update->current, $update->locale);128 if ( 'development' == $update->response ) {129 $message = __('You are using a development version of WordPress. You can upgrade to the latest nightly build automatically or download the nightly build and install it manually:');130 $submit = __('Download nightly build');131 } else {132 $message = sprintf(__('You can upgrade to version %s automatically or download the package and install it manually:'), $version_string);133 $submit = sprintf(__('Download %s'), $version_string);134 }135 136 echo '<p>';137 echo $message;138 echo '</p>';139 echo '<form method="post" action="update.php?action=do-core-upgrade" name="upgrade" class="upgrade">';140 wp_nonce_field('upgrade-core');141 echo '<p>';142 echo '<input id="upgrade" class="button" type="submit" value="' . __('Upgrade Automatically') . '" name="upgrade" /> ';143 echo '<input name="version" value="'.$update->current.'" type="hidden"/>';144 echo '<input name="locale" value="'.$update->locale.'" type="hidden"/>';145 echo '<a href="' . $update->package . '" class="button">' . $submit . '</a> ';146 if ( 'en_US' != $update->locale )147 if ( !isset( $update->dismissed ) || !$update->dismissed )148 echo '<input id="dismiss" class="button" type="submit" value="' . attribute_escape(__('Hide this update')) . '" name="dismiss" />';149 else150 echo '<input id="undismiss" class="button" type="submit" value="' . attribute_escape(__('Bring back this update')) . '" name="undismiss" />';151 echo '</p>';152 echo '</form>';153 154 }155 156 function dismissed_updates() {157 $dismissed = get_core_updates( array( 'dismissed' => true, 'available' => false ) );158 if ( $dismissed ) {159 160 $show_text = js_escape(__('Show hidden updates'));161 $hide_text = js_escape(__('Hide hidden updates'));162 ?>163 <script type="text/javascript">164 165 jQuery(function($) {166 $('dismissed-updates').show();167 $('#show-dismissed').toggle(function(){$(this).text('<?php echo $hide_text; ?>');}, function() {$(this).text('<?php echo $show_text; ?>')});168 $('#show-dismissed').click(function() { $('#dismissed-updates').toggle('slow');});169 });170 </script>171 <?php172 echo '<p class="hide-if-no-js"><a id="show-dismissed" href="#">'.__('Show hidden updates').'</a></p>';173 echo '<ul id="dismissed-updates" class="core-updates dismissed">';174 foreach($dismissed as $update) {175 echo '<li>';176 list_core_update( $update );177 echo '</li>';178 }179 echo '</ul>';180 }181 }182 183 /**184 * Display upgrade WordPress for downloading latest or upgrading automatically form.185 *186 * @since 2.7187 *188 * @return null189 */190 function core_upgrade_preamble() {191 $updates = get_core_updates();192 193 echo '<div class="wrap">';194 echo '<h2>' . __('Upgrade WordPress') . '</h2>';195 196 if ( !isset($updates[0]->response) || 'latest' == $updates[0]->response ) {197 echo '<h3>';198 _e('You have the latest version of WordPress. You do not need to upgrade');199 echo '</h3>';200 dismissed_updates();201 echo '</div>';202 return;203 }204 205 echo '<div class="updated fade"><p>';206 _e('<strong>Important:</strong> before upgrading, please <a href="http://codex.wordpress.org/WordPress_Backups">backup your database and files</a>.');207 echo '</p></div>';208 209 echo '<h3 class="response">';210 _e( 'There is a new version of WordPress available for upgrade' );211 echo '</h3>';212 echo '<ul class="core-updates">';213 $alternate = true;214 foreach( $updates as $update ) {215 $class = $alternate? ' class="alternate"' : '';216 $alternate = !$alternate;217 echo "<li $class>";218 list_core_update( $update );219 echo '</li>';220 }221 echo '</ul>';222 dismissed_updates();223 echo '</div>';224 }225 226 227 /**228 * Upgrade WordPress core display.229 *230 * @since 2.7231 *232 * @return null233 */234 function do_core_upgrade() {235 global $wp_filesystem;236 237 $url = wp_nonce_url('update.php?action=do-core-upgrade', 'upgrade-core');238 if ( false === ($credentials = request_filesystem_credentials($url)) )239 return;240 241 $version = isset( $_POST['version'] )? $_POST['version'] : false;242 $locale = isset( $_POST['locale'] )? $_POST['locale'] : 'en_US';243 $update = find_core_update( $version, $locale );244 if ( !$update )245 return;246 247 248 if ( ! WP_Filesystem($credentials) ) {249 request_filesystem_credentials($url, '', true); //Failed to connect, Error and request again250 return;251 }252 253 echo '<div class="wrap">';254 echo '<h2>' . __('Upgrade WordPress') . '</h2>';255 if ( $wp_filesystem->errors->get_error_code() ) {256 foreach ( $wp_filesystem->errors->get_error_messages() as $message )257 show_message($message);258 echo '</div>';259 return;260 }261 262 $result = wp_update_core($update, 'show_message');263 264 if ( is_wp_error($result) ) {265 show_message($result);266 if ('up_to_date' != $result->get_error_code() )267 show_message( __('Installation Failed') );268 } else {269 show_message( __('WordPress upgraded successfully') );270 }271 echo '</div>';272 }273 274 function do_dismiss_core_update() {275 $version = isset( $_POST['version'] )? $_POST['version'] : false;276 $locale = isset( $_POST['locale'] )? $_POST['locale'] : 'en_US';277 $update = find_core_update( $version, $locale );278 if ( !$update )279 return;280 dismiss_core_update( $update );281 wp_redirect( wp_nonce_url('update.php?action=upgrade-core', 'upgrade-core') );282 }283 284 function do_undismiss_core_update() {285 $version = isset( $_POST['version'] )? $_POST['version'] : false;286 $locale = isset( $_POST['locale'] )? $_POST['locale'] : 'en_US';287 $update = find_core_update( $version, $locale );288 if ( !$update )289 return;290 undismiss_core_update( $version, $locale );291 wp_redirect( wp_nonce_url('update.php?action=upgrade-core', 'upgrade-core') );292 }293 294 125 if ( isset($_GET['action']) ) { 295 126 $plugin = isset($_GET['plugin']) ? trim($_GET['plugin']) : ''; … … 323 154 } 324 155 iframe_footer(); 325 } elseif ( 'upgrade-core' == $action ) {326 $title = __('Upgrade WordPress');327 $parent_file = 'index.php';328 require_once('admin-header.php');329 core_upgrade_preamble();330 include('admin-footer.php');331 } elseif ( 'do-core-upgrade' == $action ) {332 check_admin_referer('upgrade-core');333 $title = __('Upgrade WordPress');334 $parent_file = 'index.php';335 // do the (un)dismiss actions before headers,336 // so that they can redirect337 if ( isset( $_POST['dismiss'] ) )338 do_dismiss_core_update();339 elseif ( isset( $_POST['undismiss'] ) )340 do_undismiss_core_update();341 require_once('admin-header.php');342 if ( isset( $_POST['upgrade'] ) )343 do_core_upgrade();344 include('admin-footer.php');345 156 } elseif ( 'upgrade-theme' == $action ) { 346 157 check_admin_referer('upgrade-theme_' . $theme);
Note: See TracChangeset
for help on using the changeset viewer.