Changeset 43571 for trunk/src/wp-admin/update-core.php
- Timestamp:
- 08/17/2018 01:50:26 AM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/update-core.php
r43569 r43571 137 137 $show_text = esc_js( __( 'Show hidden updates' ) ); 138 138 $hide_text = esc_js( __( 'Hide hidden updates' ) ); 139 ?>139 ?> 140 140 <script type="text/javascript"> 141 141 jQuery(function( $ ) { … … 145 145 }); 146 146 </script> 147 <?php147 <?php 148 148 echo '<p class="hide-if-no-js"><button type="button" class="button" id="show-dismissed" aria-expanded="false">' . __( 'Show hidden updates' ) . '</button></p>'; 149 149 echo '<ul id="dismissed-updates" class="core-updates dismissed">'; 150 foreach ( (array) $dismissed as $update ) {151 echo '<li>';152 list_core_update( $update );153 echo '</li>';154 }150 foreach ( (array) $dismissed as $update ) { 151 echo '<li>'; 152 list_core_update( $update ); 153 echo '</li>'; 154 } 155 155 echo '</ul>'; 156 156 } … … 250 250 <p><?php _e( 'The following plugins have new versions available. Check the ones you want to update and then click “Update Plugins”.' ); ?></p> 251 251 <form method="post" action="<?php echo esc_url( $form_action ); ?>" name="upgrade-plugins" class="upgrade"> 252 <?php wp_nonce_field( 'upgrade-core' ); ?>252 <?php wp_nonce_field( 'upgrade-core' ); ?> 253 253 <p><input id="upgrade-plugins" class="button" type="submit" value="<?php esc_attr_e( 'Update Plugins' ); ?>" name="upgrade" /></p> 254 254 <table class="widefat updates-table" id="update-plugins-table"> … … 261 261 262 262 <tbody class="plugins"> 263 <?php 264 foreach ( (array) $plugins as $plugin_file => $plugin_data ) { 265 $plugin_data = (object) _get_plugin_data_markup_translate( $plugin_file, (array) $plugin_data, false, true ); 266 267 $icon = '<span class="dashicons dashicons-admin-plugins"></span>'; 268 $preferred_icons = array( 'svg', '2x', '1x', 'default' ); 269 foreach ( $preferred_icons as $preferred_icon ) { 270 if ( ! empty( $plugin_data->update->icons[ $preferred_icon ] ) ) { 271 $icon = '<img src="' . esc_url( $plugin_data->update->icons[ $preferred_icon ] ) . '" alt="" />'; 272 break; 273 } 274 } 275 276 // Get plugin compat for running version of WordPress. 277 if ( isset( $plugin_data->update->tested ) && version_compare( $plugin_data->update->tested, $cur_wp_version, '>=' ) ) { 278 $compat = '<br />' . sprintf( __( 'Compatibility with WordPress %1$s: 100%% (according to its author)' ), $cur_wp_version ); 279 } else { 280 $compat = '<br />' . sprintf( __( 'Compatibility with WordPress %1$s: Unknown' ), $cur_wp_version ); 281 } 282 // Get plugin compat for updated version of WordPress. 283 if ( $core_update_version ) { 284 if ( isset( $plugin_data->update->tested ) && version_compare( $plugin_data->update->tested, $core_update_version, '>=' ) ) { 285 $compat .= '<br />' . sprintf( __( 'Compatibility with WordPress %1$s: 100%% (according to its author)' ), $core_update_version ); 263 <?php 264 foreach ( (array) $plugins as $plugin_file => $plugin_data ) { 265 $plugin_data = (object) _get_plugin_data_markup_translate( $plugin_file, (array) $plugin_data, false, true ); 266 267 $icon = '<span class="dashicons dashicons-admin-plugins"></span>'; 268 $preferred_icons = array( 'svg', '2x', '1x', 'default' ); 269 foreach ( $preferred_icons as $preferred_icon ) { 270 if ( ! empty( $plugin_data->update->icons[ $preferred_icon ] ) ) { 271 $icon = '<img src="' . esc_url( $plugin_data->update->icons[ $preferred_icon ] ) . '" alt="" />'; 272 break; 273 } 274 } 275 276 // Get plugin compat for running version of WordPress. 277 if ( isset( $plugin_data->update->tested ) && version_compare( $plugin_data->update->tested, $cur_wp_version, '>=' ) ) { 278 $compat = '<br />' . sprintf( __( 'Compatibility with WordPress %1$s: 100%% (according to its author)' ), $cur_wp_version ); 286 279 } else { 287 $compat .= '<br />' . sprintf( __( 'Compatibility with WordPress %1$s: Unknown' ), $core_update_version ); 288 } 289 } 290 // Get the upgrade notice for the new plugin version. 291 if ( isset( $plugin_data->update->upgrade_notice ) ) { 292 $upgrade_notice = '<br />' . strip_tags( $plugin_data->update->upgrade_notice ); 293 } else { 294 $upgrade_notice = ''; 295 } 296 297 $details_url = self_admin_url( 'plugin-install.php?tab=plugin-information&plugin=' . $plugin_data->update->slug . '§ion=changelog&TB_iframe=true&width=640&height=662' ); 298 $details = sprintf( 299 '<a href="%1$s" class="thickbox open-plugin-details-modal" aria-label="%2$s">%3$s</a>', 300 esc_url( $details_url ), 301 /* translators: 1: plugin name, 2: version number */ 302 esc_attr( sprintf( __( 'View %1$s version %2$s details' ), $plugin_data->Name, $plugin_data->update->new_version ) ), 303 /* translators: %s: plugin version */ 304 sprintf( __( 'View version %s details.' ), $plugin_data->update->new_version ) 305 ); 306 307 $checkbox_id = 'checkbox_' . md5( $plugin_data->Name ); 308 ?> 280 $compat = '<br />' . sprintf( __( 'Compatibility with WordPress %1$s: Unknown' ), $cur_wp_version ); 281 } 282 // Get plugin compat for updated version of WordPress. 283 if ( $core_update_version ) { 284 if ( isset( $plugin_data->update->tested ) && version_compare( $plugin_data->update->tested, $core_update_version, '>=' ) ) { 285 $compat .= '<br />' . sprintf( __( 'Compatibility with WordPress %1$s: 100%% (according to its author)' ), $core_update_version ); 286 } else { 287 $compat .= '<br />' . sprintf( __( 'Compatibility with WordPress %1$s: Unknown' ), $core_update_version ); 288 } 289 } 290 // Get the upgrade notice for the new plugin version. 291 if ( isset( $plugin_data->update->upgrade_notice ) ) { 292 $upgrade_notice = '<br />' . strip_tags( $plugin_data->update->upgrade_notice ); 293 } else { 294 $upgrade_notice = ''; 295 } 296 297 $details_url = self_admin_url( 'plugin-install.php?tab=plugin-information&plugin=' . $plugin_data->update->slug . '§ion=changelog&TB_iframe=true&width=640&height=662' ); 298 $details = sprintf( 299 '<a href="%1$s" class="thickbox open-plugin-details-modal" aria-label="%2$s">%3$s</a>', 300 esc_url( $details_url ), 301 /* translators: 1: plugin name, 2: version number */ 302 esc_attr( sprintf( __( 'View %1$s version %2$s details' ), $plugin_data->Name, $plugin_data->update->new_version ) ), 303 /* translators: %s: plugin version */ 304 sprintf( __( 'View version %s details.' ), $plugin_data->update->new_version ) 305 ); 306 307 $checkbox_id = 'checkbox_' . md5( $plugin_data->Name ); 308 ?> 309 309 <tr> 310 310 <td class="check-column"> … … 321 321 </td> 322 322 <td class="plugin-title"><p> 323 <?php echo $icon; ?>323 <?php echo $icon; ?> 324 324 <strong><?php echo $plugin_data->Name; ?></strong> 325 325 <?php … … 330 330 $plugin_data->update->new_version 331 331 ); 332 echo ' ' . $details . $compat . $upgrade_notice;333 ?>332 echo ' ' . $details . $compat . $upgrade_notice; 333 ?> 334 334 </p></td> 335 335 </tr> 336 <?php337 }338 ?>336 <?php 337 } 338 ?> 339 339 </tbody> 340 340 … … 348 348 <p><input id="upgrade-plugins-2" class="button" type="submit" value="<?php esc_attr_e( 'Update Plugins' ); ?>" name="upgrade" /></p> 349 349 </form> 350 <?php350 <?php 351 351 } 352 352 … … 363 363 364 364 $form_action = 'update-core.php?action=do-theme-upgrade'; 365 ?>365 ?> 366 366 <h2><?php _e( 'Themes' ); ?></h2> 367 367 <p><?php _e( 'The following themes have new versions available. Check the ones you want to update and then click “Update Themes”.' ); ?></p> 368 368 <p><?php printf( __( '<strong>Please Note:</strong> Any customizations you have made to theme files will be lost. Please consider using <a href="%s">child themes</a> for modifications.' ), __( 'https://codex.wordpress.org/Child_Themes' ) ); ?></p> 369 369 <form method="post" action="<?php echo esc_url( $form_action ); ?>" name="upgrade-themes" class="upgrade"> 370 <?php wp_nonce_field( 'upgrade-core' ); ?>370 <?php wp_nonce_field( 'upgrade-core' ); ?> 371 371 <p><input id="upgrade-themes" class="button" type="submit" value="<?php esc_attr_e( 'Update Themes' ); ?>" name="upgrade" /></p> 372 372 <table class="widefat updates-table" id="update-themes-table"> … … 379 379 380 380 <tbody class="plugins"> 381 <?php382 foreach ( $themes as $stylesheet => $theme ) {383 $checkbox_id = 'checkbox_' . md5( $theme->get( 'Name' ) );384 ?>381 <?php 382 foreach ( $themes as $stylesheet => $theme ) { 383 $checkbox_id = 'checkbox_' . md5( $theme->get( 'Name' ) ); 384 ?> 385 385 <tr> 386 386 <td class="check-column"> … … 406 406 $theme->update['new_version'] 407 407 ); 408 ?>408 ?> 409 409 </p></td> 410 410 </tr> 411 <?php412 }413 ?>411 <?php 412 } 413 ?> 414 414 </tbody> 415 415 … … 423 423 <p><input id="upgrade-themes-2" class="button" type="submit" value="<?php esc_attr_e( 'Update Themes' ); ?>" name="upgrade" /></p> 424 424 </form> 425 <?php425 <?php 426 426 } 427 427 … … 482 482 $allow_relaxed_file_ownership = ! $reinstall && isset( $update->new_files ) && ! $update->new_files; 483 483 484 ?>484 ?> 485 485 <div class="wrap"> 486 486 <h1><?php _e( 'Update WordPress' ); ?></h1> 487 <?php488 489 if ( false === ( $credentials = request_filesystem_credentials( $url, '', false, ABSPATH, array( 'version', 'locale' ), $allow_relaxed_file_ownership ) ) ) {490 echo '</div>';491 return;492 }493 494 if ( ! WP_Filesystem( $credentials, ABSPATH, $allow_relaxed_file_ownership ) ) {495 // Failed to connect, Error and request again496 request_filesystem_credentials( $url, '', true, ABSPATH, array( 'version', 'locale' ), $allow_relaxed_file_ownership );497 echo '</div>';498 return;499 }500 501 if ( $wp_filesystem->errors->has_errors() ) {502 foreach ( $wp_filesystem->errors->get_error_messages() as $message ) {503 show_message( $message );504 }505 echo '</div>';506 return;507 }508 509 if ( $reinstall ) {510 $update->response = 'reinstall';511 }487 <?php 488 489 if ( false === ( $credentials = request_filesystem_credentials( $url, '', false, ABSPATH, array( 'version', 'locale' ), $allow_relaxed_file_ownership ) ) ) { 490 echo '</div>'; 491 return; 492 } 493 494 if ( ! WP_Filesystem( $credentials, ABSPATH, $allow_relaxed_file_ownership ) ) { 495 // Failed to connect, Error and request again 496 request_filesystem_credentials( $url, '', true, ABSPATH, array( 'version', 'locale' ), $allow_relaxed_file_ownership ); 497 echo '</div>'; 498 return; 499 } 500 501 if ( $wp_filesystem->errors->has_errors() ) { 502 foreach ( $wp_filesystem->errors->get_error_messages() as $message ) { 503 show_message( $message ); 504 } 505 echo '</div>'; 506 return; 507 } 508 509 if ( $reinstall ) { 510 $update->response = 'reinstall'; 511 } 512 512 513 513 add_filter( 'update_feedback', 'show_message' ); … … 515 515 $upgrader = new Core_Upgrader(); 516 516 $result = $upgrader->upgrade( 517 $update, array( 517 $update, 518 array( 518 519 'allow_relaxed_file_ownership' => $allow_relaxed_file_ownership, 519 520 ) 520 521 ); 521 522 522 if ( is_wp_error( $result ) ) {523 show_message( $result );524 if ( 'up_to_date' != $result->get_error_code() && 'locked' != $result->get_error_code() ) {525 show_message( __( 'Installation Failed' ) );526 }527 echo '</div>';528 return;529 }523 if ( is_wp_error( $result ) ) { 524 show_message( $result ); 525 if ( 'up_to_date' != $result->get_error_code() && 'locked' != $result->get_error_code() ) { 526 show_message( __( 'Installation Failed' ) ); 527 } 528 echo '</div>'; 529 return; 530 } 530 531 531 532 show_message( __( 'WordPress updated successfully' ) ); … … 669 670 670 671 wp_localize_script( 671 'updates', '_wpUpdatesItemCounts', array( 672 'updates', 673 '_wpUpdatesItemCounts', 674 array( 672 675 'totals' => wp_get_update_data(), 673 676 ) … … 703 706 704 707 wp_localize_script( 705 'updates', '_wpUpdatesItemCounts', array( 708 'updates', 709 '_wpUpdatesItemCounts', 710 array( 706 711 'totals' => wp_get_update_data(), 707 712 ) … … 739 744 740 745 wp_localize_script( 741 'updates', '_wpUpdatesItemCounts', array( 746 'updates', 747 '_wpUpdatesItemCounts', 748 array( 742 749 'totals' => wp_get_update_data(), 743 750 ) … … 777 784 778 785 wp_localize_script( 779 'updates', '_wpUpdatesItemCounts', array( 786 'updates', 787 '_wpUpdatesItemCounts', 788 array( 780 789 'totals' => wp_get_update_data(), 781 790 ) … … 804 813 805 814 wp_localize_script( 806 'updates', '_wpUpdatesItemCounts', array( 815 'updates', 816 '_wpUpdatesItemCounts', 817 array( 807 818 'totals' => wp_get_update_data(), 808 819 )
Note: See TracChangeset
for help on using the changeset viewer.