17 if ( is_multisite() && ! is_network_admin() ) { |
17 if ( is_multisite() && ! is_network_admin() ) { |
18 wp_redirect( network_admin_url( 'update-core.php' ) ); |
18 wp_redirect( network_admin_url( 'update-core.php' ) ); |
19 exit(); |
19 exit(); |
20 } |
20 } |
21 |
21 |
22 if ( ! current_user_can( 'update_core' ) && ! current_user_can( 'update_themes' ) && ! current_user_can( 'update_plugins' ) ) |
22 if ( ! current_user_can( 'update_core' ) && ! current_user_can( 'update_themes' ) && ! current_user_can( 'update_plugins' ) && ! current_user_can( 'update_languages' ) ) |
23 wp_die( __( 'You do not have sufficient permissions to update this site.' ) ); |
23 wp_die( __( 'Sorry, you are not allowed to update this site.' ) ); |
24 |
24 |
|
25 /** |
|
26 * |
|
27 * @global string $wp_local_package |
|
28 * @global wpdb $wpdb |
|
29 * |
|
30 * @staticvar bool $first_pass |
|
31 * |
|
32 * @param object $update |
|
33 */ |
25 function list_core_update( $update ) { |
34 function list_core_update( $update ) { |
26 global $wp_local_package, $wpdb, $wp_version; |
35 global $wp_local_package, $wpdb; |
27 static $first_pass = true; |
36 static $first_pass = true; |
|
37 |
|
38 $wp_version = get_bloginfo( 'version' ); |
28 |
39 |
29 if ( 'en_US' == $update->locale && 'en_US' == get_locale() ) |
40 if ( 'en_US' == $update->locale && 'en_US' == get_locale() ) |
30 $version_string = $update->current; |
41 $version_string = $update->current; |
31 // If the only available update is a partial builds, it doesn't need a language-specific version string. |
42 // If the only available update is a partial builds, it doesn't need a language-specific version string. |
32 elseif ( 'en_US' == $update->locale && $update->packages->partial && $wp_version == $update->partial_version && ( $updates = get_core_updates() ) && 1 == count( $updates ) ) |
43 elseif ( 'en_US' == $update->locale && $update->packages->partial && $wp_version == $update->partial_version && ( $updates = get_core_updates() ) && 1 == count( $updates ) ) |
41 $form_action = 'update-core.php?action=do-core-upgrade'; |
52 $form_action = 'update-core.php?action=do-core-upgrade'; |
42 $php_version = phpversion(); |
53 $php_version = phpversion(); |
43 $mysql_version = $wpdb->db_version(); |
54 $mysql_version = $wpdb->db_version(); |
44 $show_buttons = true; |
55 $show_buttons = true; |
45 if ( 'development' == $update->response ) { |
56 if ( 'development' == $update->response ) { |
46 $message = __('You are using a development version of WordPress. You can update to the latest nightly build automatically or download the nightly build and install it manually:'); |
57 $message = __('You are using a development version of WordPress. You can update to the latest nightly build automatically:'); |
47 $download = __('Download nightly build'); |
|
48 } else { |
58 } else { |
49 if ( $current ) { |
59 if ( $current ) { |
50 $message = sprintf( __( 'If you need to re-install version %s, you can do so here or download the package and re-install manually:' ), $version_string ); |
60 $message = sprintf( __( 'If you need to re-install version %s, you can do so here:' ), $version_string ); |
51 $submit = __('Re-install Now'); |
61 $submit = __('Re-install Now'); |
52 $form_action = 'update-core.php?action=do-core-reinstall'; |
62 $form_action = 'update-core.php?action=do-core-reinstall'; |
53 } else { |
63 } else { |
54 $php_compat = version_compare( $php_version, $update->php_version, '>=' ); |
64 $php_compat = version_compare( $php_version, $update->php_version, '>=' ); |
55 if ( file_exists( WP_CONTENT_DIR . '/db.php' ) && empty( $wpdb->is_mysql ) ) |
65 if ( file_exists( WP_CONTENT_DIR . '/db.php' ) && empty( $wpdb->is_mysql ) ) |
56 $mysql_compat = true; |
66 $mysql_compat = true; |
57 else |
67 else |
58 $mysql_compat = version_compare( $mysql_version, $update->mysql_version, '>=' ); |
68 $mysql_compat = version_compare( $mysql_version, $update->mysql_version, '>=' ); |
59 |
69 |
60 if ( !$mysql_compat && !$php_compat ) |
70 if ( !$mysql_compat && !$php_compat ) |
|
71 /* translators: 1: WordPress version number, 2: Minimum required PHP version number, 3: Minimum required MySQL version number, 4: Current PHP version number, 5: Current MySQL version number */ |
61 $message = sprintf( __('You cannot update because <a href="https://codex.wordpress.org/Version_%1$s">WordPress %1$s</a> requires PHP version %2$s or higher and MySQL version %3$s or higher. You are running PHP version %4$s and MySQL version %5$s.'), $update->current, $update->php_version, $update->mysql_version, $php_version, $mysql_version ); |
72 $message = sprintf( __('You cannot update because <a href="https://codex.wordpress.org/Version_%1$s">WordPress %1$s</a> requires PHP version %2$s or higher and MySQL version %3$s or higher. You are running PHP version %4$s and MySQL version %5$s.'), $update->current, $update->php_version, $update->mysql_version, $php_version, $mysql_version ); |
62 elseif ( !$php_compat ) |
73 elseif ( !$php_compat ) |
|
74 /* translators: 1: WordPress version number, 2: Minimum required PHP version number, 3: Current PHP version number */ |
63 $message = sprintf( __('You cannot update because <a href="https://codex.wordpress.org/Version_%1$s">WordPress %1$s</a> requires PHP version %2$s or higher. You are running version %3$s.'), $update->current, $update->php_version, $php_version ); |
75 $message = sprintf( __('You cannot update because <a href="https://codex.wordpress.org/Version_%1$s">WordPress %1$s</a> requires PHP version %2$s or higher. You are running version %3$s.'), $update->current, $update->php_version, $php_version ); |
64 elseif ( !$mysql_compat ) |
76 elseif ( !$mysql_compat ) |
|
77 /* translators: 1: WordPress version number, 2: Minimum required MySQL version number, 3: Current MySQL version number */ |
65 $message = sprintf( __('You cannot update because <a href="https://codex.wordpress.org/Version_%1$s">WordPress %1$s</a> requires MySQL version %2$s or higher. You are running version %3$s.'), $update->current, $update->mysql_version, $mysql_version ); |
78 $message = sprintf( __('You cannot update because <a href="https://codex.wordpress.org/Version_%1$s">WordPress %1$s</a> requires MySQL version %2$s or higher. You are running version %3$s.'), $update->current, $update->mysql_version, $mysql_version ); |
66 else |
79 else |
67 $message = sprintf(__('You can update to <a href="https://codex.wordpress.org/Version_%1$s">WordPress %2$s</a> automatically or download the package and install it manually:'), $update->current, $version_string); |
80 /* translators: 1: WordPress version number, 2: WordPress version number including locale if necessary */ |
|
81 $message = sprintf(__('You can update to <a href="https://codex.wordpress.org/Version_%1$s">WordPress %2$s</a> automatically:'), $update->current, $version_string); |
68 if ( !$mysql_compat || !$php_compat ) |
82 if ( !$mysql_compat || !$php_compat ) |
69 $show_buttons = false; |
83 $show_buttons = false; |
70 } |
84 } |
71 $download = sprintf(__('Download %s'), $version_string); |
|
72 } |
85 } |
73 |
86 |
74 echo '<p>'; |
87 echo '<p>'; |
75 echo $message; |
88 echo $message; |
76 echo '</p>'; |
89 echo '</p>'; |
79 echo '<p>'; |
92 echo '<p>'; |
80 echo '<input name="version" value="'. esc_attr($update->current) .'" type="hidden"/>'; |
93 echo '<input name="version" value="'. esc_attr($update->current) .'" type="hidden"/>'; |
81 echo '<input name="locale" value="'. esc_attr($update->locale) .'" type="hidden"/>'; |
94 echo '<input name="locale" value="'. esc_attr($update->locale) .'" type="hidden"/>'; |
82 if ( $show_buttons ) { |
95 if ( $show_buttons ) { |
83 if ( $first_pass ) { |
96 if ( $first_pass ) { |
84 submit_button( $submit, $current ? 'button' : 'primary regular', 'upgrade', false ); |
97 submit_button( $submit, $current ? '' : 'primary regular', 'upgrade', false ); |
85 $first_pass = false; |
98 $first_pass = false; |
86 } else { |
99 } else { |
87 submit_button( $submit, 'button', 'upgrade', false ); |
100 submit_button( $submit, '', 'upgrade', false ); |
88 } |
101 } |
89 echo ' <a href="' . esc_url( $update->download ) . '" class="button">' . $download . '</a> '; |
|
90 } |
102 } |
91 if ( 'en_US' != $update->locale ) |
103 if ( 'en_US' != $update->locale ) |
92 if ( !isset( $update->dismissed ) || !$update->dismissed ) |
104 if ( !isset( $update->dismissed ) || !$update->dismissed ) |
93 submit_button( __('Hide this update'), 'button', 'dismiss', false ); |
105 submit_button( __( 'Hide this update' ), '', 'dismiss', false ); |
94 else |
106 else |
95 submit_button( __('Bring back this update'), 'button', 'undismiss', false ); |
107 submit_button( __( 'Bring back this update' ), '', 'undismiss', false ); |
96 echo '</p>'; |
108 echo '</p>'; |
97 if ( 'en_US' != $update->locale && ( !isset($wp_local_package) || $wp_local_package != $update->locale ) ) |
109 if ( 'en_US' != $update->locale && ( !isset($wp_local_package) || $wp_local_package != $update->locale ) ) |
98 echo '<p class="hint">'.__('This localized version contains both the translation and various other localization fixes. You can skip upgrading if you want to keep your current translation.').'</p>'; |
110 echo '<p class="hint">'.__('This localized version contains both the translation and various other localization fixes. You can skip upgrading if you want to keep your current translation.').'</p>'; |
99 // Partial builds don't need language-specific warnings. |
111 // Partial builds don't need language-specific warnings. |
100 elseif ( 'en_US' == $update->locale && get_locale() != 'en_US' && ( ! $update->packages->partial && $wp_version == $update->partial_version ) ) { |
112 elseif ( 'en_US' == $update->locale && get_locale() != 'en_US' && ( ! $update->packages->partial && $wp_version == $update->partial_version ) ) { |
216 if ( !isset($core_updates[0]->response) || 'latest' == $core_updates[0]->response || 'development' == $core_updates[0]->response || version_compare( $core_updates[0]->current, $cur_wp_version, '=') ) |
232 if ( !isset($core_updates[0]->response) || 'latest' == $core_updates[0]->response || 'development' == $core_updates[0]->response || version_compare( $core_updates[0]->current, $cur_wp_version, '=') ) |
217 $core_update_version = false; |
233 $core_update_version = false; |
218 else |
234 else |
219 $core_update_version = $core_updates[0]->current; |
235 $core_update_version = $core_updates[0]->current; |
220 ?> |
236 ?> |
221 <h3><?php _e( 'Plugins' ); ?></h3> |
237 <h2><?php _e( 'Plugins' ); ?></h2> |
222 <p><?php _e( 'The following plugins have new versions available. Check the ones you want to update and then click “Update Plugins”.' ); ?></p> |
238 <p><?php _e( 'The following plugins have new versions available. Check the ones you want to update and then click “Update Plugins”.' ); ?></p> |
223 <form method="post" action="<?php echo esc_url( $form_action ); ?>" name="upgrade-plugins" class="upgrade"> |
239 <form method="post" action="<?php echo esc_url( $form_action ); ?>" name="upgrade-plugins" class="upgrade"> |
224 <?php wp_nonce_field('upgrade-core'); ?> |
240 <?php wp_nonce_field('upgrade-core'); ?> |
225 <p><input id="upgrade-plugins" class="button" type="submit" value="<?php esc_attr_e('Update Plugins'); ?>" name="upgrade" /></p> |
241 <p><input id="upgrade-plugins" class="button" type="submit" value="<?php esc_attr_e('Update Plugins'); ?>" name="upgrade" /></p> |
226 <table class="widefat" id="update-plugins-table"> |
242 <table class="widefat updates-table" id="update-plugins-table"> |
227 <thead> |
243 <thead> |
228 <tr> |
244 <tr> |
229 <th scope="col" class="manage-column check-column"><input type="checkbox" id="plugins-select-all" /></th> |
245 <td class="manage-column check-column"><input type="checkbox" id="plugins-select-all" /></td> |
230 <th scope="col" class="manage-column"><label for="plugins-select-all"><?php _e('Select All'); ?></label></th> |
246 <td class="manage-column"><label for="plugins-select-all"><?php _e( 'Select All' ); ?></label></td> |
231 </tr> |
247 </tr> |
232 </thead> |
248 </thead> |
233 |
249 |
234 <tbody class="plugins"> |
250 <tbody class="plugins"> |
235 <?php |
251 <?php |
236 foreach ( (array) $plugins as $plugin_file => $plugin_data) { |
252 foreach ( (array) $plugins as $plugin_file => $plugin_data ) { |
237 $info = plugins_api('plugin_information', array('slug' => $plugin_data->update->slug )); |
253 $plugin_data = (object) _get_plugin_data_markup_translate( $plugin_file, (array) $plugin_data, false, true ); |
238 if ( is_wp_error( $info ) ) { |
254 |
239 $info = false; |
255 $icon = '<span class="dashicons dashicons-admin-plugins"></span>'; |
|
256 $preferred_icons = array( 'svg', '1x', '2x', 'default' ); |
|
257 foreach ( $preferred_icons as $preferred_icon ) { |
|
258 if ( ! empty( $plugin_data->update->icons[ $preferred_icon ] ) ) { |
|
259 $icon = '<img src="' . esc_url( $plugin_data->update->icons[ $preferred_icon ] ) . '" alt="" />'; |
|
260 break; |
|
261 } |
240 } |
262 } |
241 |
263 |
242 // Get plugin compat for running version of WordPress. |
264 // Get plugin compat for running version of WordPress. |
243 if ( isset($info->tested) && version_compare($info->tested, $cur_wp_version, '>=') ) { |
265 if ( isset($plugin_data->update->tested) && version_compare($plugin_data->update->tested, $cur_wp_version, '>=') ) { |
244 $compat = '<br />' . sprintf(__('Compatibility with WordPress %1$s: 100%% (according to its author)'), $cur_wp_version); |
266 $compat = '<br />' . sprintf(__('Compatibility with WordPress %1$s: 100%% (according to its author)'), $cur_wp_version); |
245 } elseif ( isset($info->compatibility[$cur_wp_version][$plugin_data->update->new_version]) ) { |
267 } elseif ( isset($plugin_data->update->compatibility->{$cur_wp_version}) ) { |
246 $compat = $info->compatibility[$cur_wp_version][$plugin_data->update->new_version]; |
268 $compat = $plugin_data->update->compatibility->{$cur_wp_version}; |
247 $compat = '<br />' . sprintf(__('Compatibility with WordPress %1$s: %2$d%% (%3$d "works" votes out of %4$d total)'), $cur_wp_version, $compat[0], $compat[2], $compat[1]); |
269 $compat = '<br />' . sprintf(__('Compatibility with WordPress %1$s: %2$d%% (%3$d "works" votes out of %4$d total)'), $cur_wp_version, $compat->percent, $compat->votes, $compat->total_votes); |
248 } else { |
270 } else { |
249 $compat = '<br />' . sprintf(__('Compatibility with WordPress %1$s: Unknown'), $cur_wp_version); |
271 $compat = '<br />' . sprintf(__('Compatibility with WordPress %1$s: Unknown'), $cur_wp_version); |
250 } |
272 } |
251 // Get plugin compat for updated version of WordPress. |
273 // Get plugin compat for updated version of WordPress. |
252 if ( $core_update_version ) { |
274 if ( $core_update_version ) { |
253 if ( isset($info->compatibility[$core_update_version][$plugin_data->update->new_version]) ) { |
275 if ( isset( $plugin_data->update->tested ) && version_compare( $plugin_data->update->tested, $core_update_version, '>=' ) ) { |
254 $update_compat = $info->compatibility[$core_update_version][$plugin_data->update->new_version]; |
276 $compat .= '<br />' . sprintf( __( 'Compatibility with WordPress %1$s: 100%% (according to its author)' ), $core_update_version ); |
255 $compat .= '<br />' . sprintf(__('Compatibility with WordPress %1$s: %2$d%% (%3$d "works" votes out of %4$d total)'), $core_update_version, $update_compat[0], $update_compat[2], $update_compat[1]); |
277 } elseif ( isset( $plugin_data->update->compatibility->{$core_update_version} ) ) { |
|
278 $update_compat = $plugin_data->update->compatibility->{$core_update_version}; |
|
279 $compat .= '<br />' . sprintf(__('Compatibility with WordPress %1$s: %2$d%% (%3$d "works" votes out of %4$d total)'), $core_update_version, $update_compat->percent, $update_compat->votes, $update_compat->total_votes); |
256 } else { |
280 } else { |
257 $compat .= '<br />' . sprintf(__('Compatibility with WordPress %1$s: Unknown'), $core_update_version); |
281 $compat .= '<br />' . sprintf(__('Compatibility with WordPress %1$s: Unknown'), $core_update_version); |
258 } |
282 } |
259 } |
283 } |
260 // Get the upgrade notice for the new plugin version. |
284 // Get the upgrade notice for the new plugin version. |
263 } else { |
287 } else { |
264 $upgrade_notice = ''; |
288 $upgrade_notice = ''; |
265 } |
289 } |
266 |
290 |
267 $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'); |
291 $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'); |
268 $details_text = sprintf(__('View version %1$s details'), $plugin_data->update->new_version); |
292 $details = sprintf( |
269 $details = sprintf('<a href="%1$s" class="thickbox" title="%2$s">%3$s</a>.', esc_url($details_url), esc_attr($plugin_data->Name), $details_text); |
293 '<a href="%1$s" class="thickbox open-plugin-details-modal" aria-label="%2$s">%3$s</a>', |
270 |
294 esc_url( $details_url ), |
271 echo " |
295 /* translators: 1: plugin name, 2: version number */ |
272 <tr> |
296 esc_attr( sprintf( __( 'View %1$s version %2$s details' ), $plugin_data->Name, $plugin_data->update->new_version ) ), |
273 <th scope='row' class='check-column'><input type='checkbox' name='checked[]' value='" . esc_attr($plugin_file) . "' /></th> |
297 /* translators: %s: plugin version */ |
274 <td><p><strong>{$plugin_data->Name}</strong><br />" . sprintf(__('You have version %1$s installed. Update to %2$s.'), $plugin_data->Version, $plugin_data->update->new_version) . ' ' . $details . $compat . $upgrade_notice . "</p></td> |
298 sprintf( __( 'View version %s details.' ), $plugin_data->update->new_version ) |
275 </tr>"; |
299 ); |
|
300 |
|
301 $checkbox_id = "checkbox_" . md5( $plugin_data->Name ); |
|
302 ?> |
|
303 <tr> |
|
304 <td class="check-column"> |
|
305 <input type="checkbox" name="checked[]" id="<?php echo $checkbox_id; ?>" value="<?php echo esc_attr( $plugin_file ); ?>" /> |
|
306 <label for="<?php echo $checkbox_id; ?>" class="screen-reader-text"><?php |
|
307 /* translators: %s: plugin name */ |
|
308 printf( __( 'Select %s' ), |
|
309 $plugin_data->Name |
|
310 ); |
|
311 ?></label> |
|
312 </td> |
|
313 <td class="plugin-title"><p> |
|
314 <?php echo $icon; ?> |
|
315 <strong><?php echo $plugin_data->Name; ?></strong> |
|
316 <?php |
|
317 /* translators: 1: plugin version, 2: new version */ |
|
318 printf( __( 'You have version %1$s installed. Update to %2$s.' ), |
|
319 $plugin_data->Version, |
|
320 $plugin_data->update->new_version |
|
321 ); |
|
322 echo ' ' . $details . $compat . $upgrade_notice; |
|
323 ?> |
|
324 </p></td> |
|
325 </tr> |
|
326 <?php |
276 } |
327 } |
277 ?> |
328 ?> |
278 </tbody> |
329 </tbody> |
279 |
330 |
280 <tfoot> |
331 <tfoot> |
281 <tr> |
332 <tr> |
282 <th scope="col" class="manage-column check-column"><input type="checkbox" id="plugins-select-all-2" /></th> |
333 <td class="manage-column check-column"><input type="checkbox" id="plugins-select-all-2" /></td> |
283 <th scope="col" class="manage-column"><label for="plugins-select-all-2"><?php _e( 'Select All' ); ?></label></th> |
334 <td class="manage-column"><label for="plugins-select-all-2"><?php _e( 'Select All' ); ?></label></td> |
284 </tr> |
335 </tr> |
285 </tfoot> |
336 </tfoot> |
286 </table> |
337 </table> |
287 <p><input id="upgrade-plugins-2" class="button" type="submit" value="<?php esc_attr_e('Update Plugins'); ?>" name="upgrade" /></p> |
338 <p><input id="upgrade-plugins-2" class="button" type="submit" value="<?php esc_attr_e('Update Plugins'); ?>" name="upgrade" /></p> |
288 </form> |
339 </form> |
289 <?php |
340 <?php |
290 } |
341 } |
291 |
342 |
|
343 /** |
|
344 * @since 2.9.0 |
|
345 */ |
292 function list_theme_updates() { |
346 function list_theme_updates() { |
293 $themes = get_theme_updates(); |
347 $themes = get_theme_updates(); |
294 if ( empty( $themes ) ) { |
348 if ( empty( $themes ) ) { |
295 echo '<h3>' . __( 'Themes' ) . '</h3>'; |
349 echo '<h2>' . __( 'Themes' ) . '</h2>'; |
296 echo '<p>' . __( 'Your themes are all up to date.' ) . '</p>'; |
350 echo '<p>' . __( 'Your themes are all up to date.' ) . '</p>'; |
297 return; |
351 return; |
298 } |
352 } |
299 |
353 |
300 $form_action = 'update-core.php?action=do-theme-upgrade'; |
354 $form_action = 'update-core.php?action=do-theme-upgrade'; |
301 |
|
302 ?> |
355 ?> |
303 <h3><?php _e( 'Themes' ); ?></h3> |
356 <h2><?php _e( 'Themes' ); ?></h2> |
304 <p><?php _e( 'The following themes have new versions available. Check the ones you want to update and then click “Update Themes”.' ); ?></p> |
357 <p><?php _e( 'The following themes have new versions available. Check the ones you want to update and then click “Update Themes”.' ); ?></p> |
305 <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> |
358 <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> |
306 <form method="post" action="<?php echo esc_url( $form_action ); ?>" name="upgrade-themes" class="upgrade"> |
359 <form method="post" action="<?php echo esc_url( $form_action ); ?>" name="upgrade-themes" class="upgrade"> |
307 <?php wp_nonce_field('upgrade-core'); ?> |
360 <?php wp_nonce_field('upgrade-core'); ?> |
308 <p><input id="upgrade-themes" class="button" type="submit" value="<?php esc_attr_e('Update Themes'); ?>" name="upgrade" /></p> |
361 <p><input id="upgrade-themes" class="button" type="submit" value="<?php esc_attr_e('Update Themes'); ?>" name="upgrade" /></p> |
309 <table class="widefat" id="update-themes-table"> |
362 <table class="widefat updates-table" id="update-themes-table"> |
310 <thead> |
363 <thead> |
311 <tr> |
364 <tr> |
312 <th scope="col" class="manage-column check-column"><input type="checkbox" id="themes-select-all" /></th> |
365 <td class="manage-column check-column"><input type="checkbox" id="themes-select-all" /></td> |
313 <th scope="col" class="manage-column"><label for="themes-select-all"><?php _e('Select All'); ?></label></th> |
366 <td class="manage-column"><label for="themes-select-all"><?php _e( 'Select All' ); ?></label></td> |
314 </tr> |
367 </tr> |
315 </thead> |
368 </thead> |
316 |
369 |
317 <tbody class="plugins"> |
370 <tbody class="plugins"> |
318 <?php |
371 <?php |
319 foreach ( $themes as $stylesheet => $theme ) { |
372 foreach ( $themes as $stylesheet => $theme ) { |
320 echo " |
373 $checkbox_id = 'checkbox_' . md5( $theme->get( 'Name' ) ); |
321 <tr> |
374 ?> |
322 <th scope='row' class='check-column'><input type='checkbox' name='checked[]' value='" . esc_attr( $stylesheet ) . "' /></th> |
375 <tr> |
323 <td class='plugin-title'><img src='" . esc_url( $theme->get_screenshot() ) . "' width='85' height='64' style='float:left; padding: 0 5px 5px' /><strong>" . $theme->display('Name') . '</strong> ' . sprintf( __( 'You have version %1$s installed. Update to %2$s.' ), $theme->display('Version'), $theme->update['new_version'] ) . "</td> |
376 <td class="check-column"> |
324 </tr>"; |
377 <input type="checkbox" name="checked[]" id="<?php echo $checkbox_id; ?>" value="<?php echo esc_attr( $stylesheet ); ?>" /> |
|
378 <label for="<?php echo $checkbox_id; ?>" class="screen-reader-text"><?php |
|
379 /* translators: %s: theme name */ |
|
380 printf( __( 'Select %s' ), |
|
381 $theme->display( 'Name' ) |
|
382 ); |
|
383 ?></label> |
|
384 </td> |
|
385 <td class="plugin-title"><p> |
|
386 <img src="<?php echo esc_url( $theme->get_screenshot() ); ?>" width="85" height="64" class="updates-table-screenshot" alt="" /> |
|
387 <strong><?php echo $theme->display( 'Name' ); ?></strong> |
|
388 <?php |
|
389 /* translators: 1: theme version, 2: new version */ |
|
390 printf( __( 'You have version %1$s installed. Update to %2$s.' ), |
|
391 $theme->display( 'Version' ), |
|
392 $theme->update['new_version'] |
|
393 ); |
|
394 ?> |
|
395 </p></td> |
|
396 </tr> |
|
397 <?php |
325 } |
398 } |
326 ?> |
399 ?> |
327 </tbody> |
400 </tbody> |
328 |
401 |
329 <tfoot> |
402 <tfoot> |
330 <tr> |
403 <tr> |
331 <th scope="col" class="manage-column check-column"><input type="checkbox" id="themes-select-all-2" /></th> |
404 <td class="manage-column check-column"><input type="checkbox" id="themes-select-all-2" /></td> |
332 <th scope="col" class="manage-column"><label for="themes-select-all-2"><?php _e( 'Select All' ); ?></label></th> |
405 <td class="manage-column"><label for="themes-select-all-2"><?php _e( 'Select All' ); ?></label></td> |
333 </tr> |
406 </tr> |
334 </tfoot> |
407 </tfoot> |
335 </table> |
408 </table> |
336 <p><input id="upgrade-themes-2" class="button" type="submit" value="<?php esc_attr_e('Update Themes'); ?>" name="upgrade" /></p> |
409 <p><input id="upgrade-themes-2" class="button" type="submit" value="<?php esc_attr_e('Update Themes'); ?>" name="upgrade" /></p> |
337 </form> |
410 </form> |
338 <?php |
411 <?php |
339 } |
412 } |
340 |
413 |
|
414 /** |
|
415 * @since 3.7.0 |
|
416 */ |
341 function list_translation_updates() { |
417 function list_translation_updates() { |
342 $updates = wp_get_translation_updates(); |
418 $updates = wp_get_translation_updates(); |
343 if ( ! $updates ) { |
419 if ( ! $updates ) { |
344 if ( 'en_US' != get_locale() ) { |
420 if ( 'en_US' != get_locale() ) { |
345 echo '<h3>' . __( 'Translations' ) . '</h3>'; |
421 echo '<h2>' . __( 'Translations' ) . '</h2>'; |
346 echo '<p>' . __( 'Your translations are all up to date.' ) . '</p>'; |
422 echo '<p>' . __( 'Your translations are all up to date.' ) . '</p>'; |
347 } |
423 } |
348 return; |
424 return; |
349 } |
425 } |
350 |
426 |
351 $form_action = 'update-core.php?action=do-translation-upgrade'; |
427 $form_action = 'update-core.php?action=do-translation-upgrade'; |
352 ?> |
428 ?> |
353 <h3><?php _e( 'Translations' ); ?></h3> |
429 <h2><?php _e( 'Translations' ); ?></h2> |
354 <form method="post" action="<?php echo esc_url( $form_action ); ?>" name="upgrade-translations" class="upgrade"> |
430 <form method="post" action="<?php echo esc_url( $form_action ); ?>" name="upgrade-translations" class="upgrade"> |
355 <p><?php _e( 'New translations are available.' ); ?></p> |
431 <p><?php _e( 'New translations are available.' ); ?></p> |
356 <?php wp_nonce_field( 'upgrade-translations' ); ?> |
432 <?php wp_nonce_field( 'upgrade-translations' ); ?> |
357 <p><input class="button" type="submit" value="<?php esc_attr_e( 'Update Translations' ); ?>" name="upgrade" /></p> |
433 <p><input class="button" type="submit" value="<?php esc_attr_e( 'Update Translations' ); ?>" name="upgrade" /></p> |
358 </form> |
434 </form> |
496 'content' => $updates_howto |
580 'content' => $updates_howto |
497 ) ); |
581 ) ); |
498 |
582 |
499 get_current_screen()->set_help_sidebar( |
583 get_current_screen()->set_help_sidebar( |
500 '<p><strong>' . __('For more information:') . '</strong></p>' . |
584 '<p><strong>' . __('For more information:') . '</strong></p>' . |
501 '<p>' . __( '<a href="https://codex.wordpress.org/Dashboard_Updates_Screen" target="_blank">Documentation on Updating WordPress</a>' ) . '</p>' . |
585 '<p>' . __( '<a href="https://codex.wordpress.org/Dashboard_Updates_Screen">Documentation on Updating WordPress</a>' ) . '</p>' . |
502 '<p>' . __( '<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>' ) . '</p>' |
586 '<p>' . __( '<a href="https://wordpress.org/support/">Support Forums</a>' ) . '</p>' |
503 ); |
587 ); |
504 |
588 |
505 if ( 'upgrade-core' == $action ) { |
589 if ( 'upgrade-core' == $action ) { |
506 // Force a update check when requested |
590 // Force a update check when requested |
507 $force_check = ! empty( $_GET['force-check'] ); |
591 $force_check = ! empty( $_GET['force-check'] ); |
508 wp_version_check( array(), $force_check ); |
592 wp_version_check( array(), $force_check ); |
509 |
593 |
510 require_once(ABSPATH . 'wp-admin/admin-header.php'); |
594 require_once(ABSPATH . 'wp-admin/admin-header.php'); |
511 ?> |
595 ?> |
512 <div class="wrap"> |
596 <div class="wrap"> |
513 <h2><?php _e('WordPress Updates'); ?></h2> |
597 <h1><?php _e( 'WordPress Updates' ); ?></h1> |
514 <?php |
598 <?php |
515 if ( $upgrade_error ) { |
599 if ( $upgrade_error ) { |
516 echo '<div class="error"><p>'; |
600 echo '<div class="error"><p>'; |
517 if ( $upgrade_error == 'themes' ) |
601 if ( $upgrade_error == 'themes' ) |
518 _e('Please select one or more themes to update.'); |
602 _e('Please select one or more themes to update.'); |
519 else |
603 else |
520 _e('Please select one or more plugins to update.'); |
604 _e('Please select one or more plugins to update.'); |
521 echo '</p></div>'; |
605 echo '</p></div>'; |
522 } |
606 } |
523 |
607 |
|
608 $last_update_check = false; |
|
609 $current = get_site_transient( 'update_core' ); |
|
610 |
|
611 if ( $current && isset ( $current->last_checked ) ) { |
|
612 $last_update_check = $current->last_checked + get_option( 'gmt_offset' ) * HOUR_IN_SECONDS; |
|
613 } |
|
614 |
524 echo '<p>'; |
615 echo '<p>'; |
525 /* translators: %1 date, %2 time. */ |
616 /* translators: %1 date, %2 time. */ |
526 printf( __('Last checked on %1$s at %2$s.'), date_i18n( get_option( 'date_format' ) ), date_i18n( get_option( 'time_format' ) ) ); |
617 printf( __( 'Last checked on %1$s at %2$s.' ), date_i18n( __( 'F j, Y' ), $last_update_check ), date_i18n( __( 'g:i a' ), $last_update_check ) ); |
527 echo ' <a class="button" href="' . esc_url( self_admin_url('update-core.php?force-check=1') ) . '">' . __( 'Check Again' ) . '</a>'; |
618 echo ' <a class="button" href="' . esc_url( self_admin_url('update-core.php?force-check=1') ) . '">' . __( 'Check Again' ) . '</a>'; |
528 echo '</p>'; |
619 echo '</p>'; |
529 |
620 |
530 if ( $core = current_user_can( 'update_core' ) ) |
621 if ( current_user_can( 'update_core' ) ) { |
531 core_upgrade_preamble(); |
622 core_upgrade_preamble(); |
532 if ( $plugins = current_user_can( 'update_plugins' ) ) |
623 } |
|
624 if ( current_user_can( 'update_plugins' ) ) { |
533 list_plugin_updates(); |
625 list_plugin_updates(); |
534 if ( $themes = current_user_can( 'update_themes' ) ) |
626 } |
|
627 if ( current_user_can( 'update_themes' ) ) { |
535 list_theme_updates(); |
628 list_theme_updates(); |
536 if ( $core || $plugins || $themes ) |
629 } |
|
630 if ( current_user_can( 'update_languages' ) ) { |
537 list_translation_updates(); |
631 list_translation_updates(); |
538 unset( $core, $plugins, $themes ); |
632 } |
|
633 |
539 /** |
634 /** |
540 * Fires after the core, plugin, and theme update tables. |
635 * Fires after the core, plugin, and theme update tables. |
541 * |
636 * |
542 * @since 2.9.0 |
637 * @since 2.9.0 |
543 */ |
638 */ |
544 do_action( 'core_upgrade_preamble' ); |
639 do_action( 'core_upgrade_preamble' ); |
545 echo '</div>'; |
640 echo '</div>'; |
|
641 |
|
642 wp_localize_script( 'updates', '_wpUpdatesItemCounts', array( |
|
643 'totals' => wp_get_update_data(), |
|
644 ) ); |
|
645 |
546 include(ABSPATH . 'wp-admin/admin-footer.php'); |
646 include(ABSPATH . 'wp-admin/admin-footer.php'); |
547 |
647 |
548 } elseif ( 'do-core-upgrade' == $action || 'do-core-reinstall' == $action ) { |
648 } elseif ( 'do-core-upgrade' == $action || 'do-core-reinstall' == $action ) { |
549 |
649 |
550 if ( ! current_user_can( 'update_core' ) ) |
650 if ( ! current_user_can( 'update_core' ) ) |
551 wp_die( __( 'You do not have sufficient permissions to update this site.' ) ); |
651 wp_die( __( 'Sorry, you are not allowed to update this site.' ) ); |
552 |
652 |
553 check_admin_referer('upgrade-core'); |
653 check_admin_referer('upgrade-core'); |
554 |
654 |
555 // Do the (un)dismiss actions before headers, so that they can redirect. |
655 // Do the (un)dismiss actions before headers, so that they can redirect. |
556 if ( isset( $_POST['dismiss'] ) ) |
656 if ( isset( $_POST['dismiss'] ) ) |
590 |
694 |
591 $title = __('Update Plugins'); |
695 $title = __('Update Plugins'); |
592 |
696 |
593 require_once(ABSPATH . 'wp-admin/admin-header.php'); |
697 require_once(ABSPATH . 'wp-admin/admin-header.php'); |
594 echo '<div class="wrap">'; |
698 echo '<div class="wrap">'; |
595 echo '<h2>' . esc_html__('Update Plugins') . '</h2>'; |
699 echo '<h1>' . __( 'Update Plugins' ) . '</h1>'; |
596 echo '<iframe src="', $url, '" style="width: 100%; height: 100%; min-height: 750px;" frameborder="0"></iframe>'; |
700 echo '<iframe src="', $url, '" style="width: 100%; height: 100%; min-height: 750px;" frameborder="0" title="' . esc_attr__( 'Update progress' ) . '"></iframe>'; |
597 echo '</div>'; |
701 echo '</div>'; |
|
702 |
|
703 wp_localize_script( 'updates', '_wpUpdatesItemCounts', array( |
|
704 'totals' => wp_get_update_data(), |
|
705 ) ); |
|
706 |
598 include(ABSPATH . 'wp-admin/admin-footer.php'); |
707 include(ABSPATH . 'wp-admin/admin-footer.php'); |
599 |
708 |
600 } elseif ( 'do-theme-upgrade' == $action ) { |
709 } elseif ( 'do-theme-upgrade' == $action ) { |
601 |
710 |
602 if ( ! current_user_can( 'update_themes' ) ) |
711 if ( ! current_user_can( 'update_themes' ) ) |
603 wp_die( __( 'You do not have sufficient permissions to update this site.' ) ); |
712 wp_die( __( 'Sorry, you are not allowed to update this site.' ) ); |
604 |
713 |
605 check_admin_referer('upgrade-core'); |
714 check_admin_referer('upgrade-core'); |
606 |
715 |
607 if ( isset( $_GET['themes'] ) ) { |
716 if ( isset( $_GET['themes'] ) ) { |
608 $themes = explode( ',', $_GET['themes'] ); |
717 $themes = explode( ',', $_GET['themes'] ); |
619 $title = __('Update Themes'); |
728 $title = __('Update Themes'); |
620 |
729 |
621 require_once(ABSPATH . 'wp-admin/admin-header.php'); |
730 require_once(ABSPATH . 'wp-admin/admin-header.php'); |
622 ?> |
731 ?> |
623 <div class="wrap"> |
732 <div class="wrap"> |
624 <h2><?php echo esc_html__('Update Themes') ?></h2> |
733 <h1><?php _e( 'Update Themes' ); ?></h1> |
625 <iframe src="<?php echo $url ?>" style="width: 100%; height: 100%; min-height: 750px;" frameborder="0"></iframe> |
734 <iframe src="<?php echo $url ?>" style="width: 100%; height: 100%; min-height: 750px;" frameborder="0" title="<?php esc_attr_e( 'Update progress' ); ?>"></iframe> |
626 </div> |
735 </div> |
627 <?php |
736 <?php |
|
737 |
|
738 wp_localize_script( 'updates', '_wpUpdatesItemCounts', array( |
|
739 'totals' => wp_get_update_data(), |
|
740 ) ); |
|
741 |
628 include(ABSPATH . 'wp-admin/admin-footer.php'); |
742 include(ABSPATH . 'wp-admin/admin-footer.php'); |
629 |
743 |
630 } elseif ( 'do-translation-upgrade' == $action ) { |
744 } elseif ( 'do-translation-upgrade' == $action ) { |
631 |
745 |
632 if ( ! current_user_can( 'update_core' ) && ! current_user_can( 'update_plugins' ) && ! current_user_can( 'update_themes' ) ) |
746 if ( ! current_user_can( 'update_languages' ) ) |
633 wp_die( __( 'You do not have sufficient permissions to update this site.' ) ); |
747 wp_die( __( 'Sorry, you are not allowed to update this site.' ) ); |
634 |
748 |
635 check_admin_referer( 'upgrade-translations' ); |
749 check_admin_referer( 'upgrade-translations' ); |
636 |
750 |
637 require_once( ABSPATH . 'wp-admin/admin-header.php' ); |
751 require_once( ABSPATH . 'wp-admin/admin-header.php' ); |
638 include_once( ABSPATH . 'wp-admin/includes/class-wp-upgrader.php' ); |
752 include_once( ABSPATH . 'wp-admin/includes/class-wp-upgrader.php' ); |