5 * @package WordPress |
5 * @package WordPress |
6 * @subpackage Administration |
6 * @subpackage Administration |
7 */ |
7 */ |
8 |
8 |
9 /** WordPress Administration Bootstrap */ |
9 /** WordPress Administration Bootstrap */ |
10 require_once( dirname( __FILE__ ) . '/admin.php' ); |
10 require_once __DIR__ . '/admin.php'; |
11 |
11 |
12 wp_enqueue_style( 'plugin-install' ); |
12 wp_enqueue_style( 'plugin-install' ); |
13 wp_enqueue_script( 'plugin-install' ); |
13 wp_enqueue_script( 'plugin-install' ); |
14 wp_enqueue_script( 'updates' ); |
14 wp_enqueue_script( 'updates' ); |
15 add_thickbox(); |
15 add_thickbox(); |
16 |
16 |
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' ) && ! current_user_can( 'update_languages' ) ) { |
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( __( 'Sorry, you are not allowed to update this site.' ) ); |
23 wp_die( __( 'Sorry, you are not allowed to update this site.' ) ); |
24 } |
24 } |
25 |
25 |
26 /** |
26 /** |
27 * @global string $wp_local_package |
27 * Lists available core updates. |
28 * @global wpdb $wpdb |
28 * |
29 * |
29 * @since 2.7.0 |
30 * @staticvar bool $first_pass |
30 * |
|
31 * @global string $wp_local_package Locale code of the package. |
|
32 * @global wpdb $wpdb WordPress database abstraction object. |
31 * |
33 * |
32 * @param object $update |
34 * @param object $update |
33 */ |
35 */ |
34 function list_core_update( $update ) { |
36 function list_core_update( $update ) { |
35 global $wp_local_package, $wpdb; |
37 global $wp_local_package, $wpdb; |
36 static $first_pass = true; |
38 static $first_pass = true; |
37 |
39 |
38 $wp_version = get_bloginfo( 'version' ); |
40 $wp_version = get_bloginfo( 'version' ); |
39 |
41 $version_string = sprintf( '%s–<strong>%s</strong>', $update->current, $update->locale ); |
40 if ( 'en_US' == $update->locale && 'en_US' == get_locale() ) { |
42 |
|
43 if ( 'en_US' === $update->locale && 'en_US' === get_locale() ) { |
41 $version_string = $update->current; |
44 $version_string = $update->current; |
42 } elseif ( 'en_US' == $update->locale && $update->packages->partial && $wp_version == $update->partial_version && ( $updates = get_core_updates() ) && 1 == count( $updates ) ) { |
45 } elseif ( 'en_US' === $update->locale && $update->packages->partial && $wp_version == $update->partial_version ) { |
43 // If the only available update is a partial builds, it doesn't need a language-specific version string. |
46 $updates = get_core_updates(); |
44 $version_string = $update->current; |
47 if ( $updates && 1 === count( $updates ) ) { |
45 } else { |
48 // If the only available update is a partial builds, it doesn't need a language-specific version string. |
46 $version_string = sprintf( '%s–<strong>%s</strong>', $update->current, $update->locale ); |
49 $version_string = $update->current; |
|
50 } |
47 } |
51 } |
48 |
52 |
49 $current = false; |
53 $current = false; |
50 if ( ! isset( $update->response ) || 'latest' == $update->response ) { |
54 if ( ! isset( $update->response ) || 'latest' === $update->response ) { |
51 $current = true; |
55 $current = true; |
52 } |
56 } |
53 $submit = __( 'Update Now' ); |
57 $submit = __( 'Update Now' ); |
54 $form_action = 'update-core.php?action=do-core-upgrade'; |
58 $form_action = 'update-core.php?action=do-core-upgrade'; |
55 $php_version = phpversion(); |
59 $php_version = phpversion(); |
56 $mysql_version = $wpdb->db_version(); |
60 $mysql_version = $wpdb->db_version(); |
57 $show_buttons = true; |
61 $show_buttons = true; |
58 if ( 'development' == $update->response ) { |
62 if ( 'development' === $update->response ) { |
59 $message = __( 'You are using a development version of WordPress. You can update to the latest nightly build automatically:' ); |
63 $message = __( 'You are using a development version of WordPress. You can update to the latest nightly build automatically:' ); |
60 } else { |
64 } else { |
61 if ( $current ) { |
65 if ( $current ) { |
|
66 /* translators: %s: WordPress version. */ |
62 $message = sprintf( __( 'If you need to re-install version %s, you can do so here:' ), $version_string ); |
67 $message = sprintf( __( 'If you need to re-install version %s, you can do so here:' ), $version_string ); |
63 $submit = __( 'Re-install Now' ); |
68 $submit = __( 'Re-install Now' ); |
64 $form_action = 'update-core.php?action=do-core-reinstall'; |
69 $form_action = 'update-core.php?action=do-core-reinstall'; |
65 } else { |
70 } else { |
66 $php_compat = version_compare( $php_version, $update->php_version, '>=' ); |
71 $php_compat = version_compare( $php_version, $update->php_version, '>=' ); |
69 } else { |
74 } else { |
70 $mysql_compat = version_compare( $mysql_version, $update->mysql_version, '>=' ); |
75 $mysql_compat = version_compare( $mysql_version, $update->mysql_version, '>=' ); |
71 } |
76 } |
72 |
77 |
73 $version_url = sprintf( |
78 $version_url = sprintf( |
74 /* translators: %s: WordPress version */ |
79 /* translators: %s: WordPress version. */ |
75 esc_url( __( 'https://wordpress.org/support/wordpress-version/version-%s/' ) ), |
80 esc_url( __( 'https://wordpress.org/support/wordpress-version/version-%s/' ) ), |
76 sanitize_title( $update->current ) |
81 sanitize_title( $update->current ) |
77 ); |
82 ); |
78 |
83 |
79 /* translators: %s: Update PHP page URL */ |
84 $php_update_message = '</p><p>' . sprintf( |
80 $php_update_message = '</p><p>' . sprintf( __( '<a href="%s">Learn more about updating PHP</a>.' ), esc_url( wp_get_update_php_url() ) ); |
85 /* translators: %s: URL to Update PHP page. */ |
|
86 __( '<a href="%s">Learn more about updating PHP</a>.' ), |
|
87 esc_url( wp_get_update_php_url() ) |
|
88 ); |
81 |
89 |
82 $annotation = wp_get_update_php_annotation(); |
90 $annotation = wp_get_update_php_annotation(); |
|
91 |
83 if ( $annotation ) { |
92 if ( $annotation ) { |
84 $php_update_message .= '</p><p><em>' . $annotation . '</em>'; |
93 $php_update_message .= '</p><p><em>' . $annotation . '</em>'; |
85 } |
94 } |
86 |
95 |
87 if ( ! $mysql_compat && ! $php_compat ) { |
96 if ( ! $mysql_compat && ! $php_compat ) { |
88 /* translators: 1: URL to WordPress release notes, 2: WordPress version number, 3: Minimum required PHP version number, 4: Minimum required MySQL version number, 5: Current PHP version number, 6: Current MySQL version number */ |
97 $message = sprintf( |
89 $message = sprintf( __( 'You cannot update because <a href="%1$s">WordPress %2$s</a> requires PHP version %3$s or higher and MySQL version %4$s or higher. You are running PHP version %5$s and MySQL version %6$s.' ), $version_url, $update->current, $update->php_version, $update->mysql_version, $php_version, $mysql_version ) . $php_update_message; |
98 /* translators: 1: URL to WordPress release notes, 2: WordPress version number, 3: Minimum required PHP version number, 4: Minimum required MySQL version number, 5: Current PHP version number, 6: Current MySQL version number. */ |
|
99 __( 'You cannot update because <a href="%1$s">WordPress %2$s</a> requires PHP version %3$s or higher and MySQL version %4$s or higher. You are running PHP version %5$s and MySQL version %6$s.' ), |
|
100 $version_url, |
|
101 $update->current, |
|
102 $update->php_version, |
|
103 $update->mysql_version, |
|
104 $php_version, |
|
105 $mysql_version |
|
106 ) . $php_update_message; |
90 } elseif ( ! $php_compat ) { |
107 } elseif ( ! $php_compat ) { |
91 /* translators: 1: URL to WordPress release notes, 2: WordPress version number, 3: Minimum required PHP version number, 4: Current PHP version number */ |
108 $message = sprintf( |
92 $message = sprintf( __( 'You cannot update because <a href="%1$s">WordPress %2$s</a> requires PHP version %3$s or higher. You are running version %4$s.' ), $version_url, $update->current, $update->php_version, $php_version ) . $php_update_message; |
109 /* translators: 1: URL to WordPress release notes, 2: WordPress version number, 3: Minimum required PHP version number, 4: Current PHP version number. */ |
|
110 __( 'You cannot update because <a href="%1$s">WordPress %2$s</a> requires PHP version %3$s or higher. You are running version %4$s.' ), |
|
111 $version_url, |
|
112 $update->current, |
|
113 $update->php_version, |
|
114 $php_version |
|
115 ) . $php_update_message; |
93 } elseif ( ! $mysql_compat ) { |
116 } elseif ( ! $mysql_compat ) { |
94 /* translators: 1: URL to WordPress release notes, 2: WordPress version number, 3: Minimum required MySQL version number, 4: Current MySQL version number */ |
117 $message = sprintf( |
95 $message = sprintf( __( 'You cannot update because <a href="%1$s">WordPress %2$s</a> requires MySQL version %3$s or higher. You are running version %4$s.' ), $version_url, $update->current, $update->mysql_version, $mysql_version ); |
118 /* translators: 1: URL to WordPress release notes, 2: WordPress version number, 3: Minimum required MySQL version number, 4: Current MySQL version number. */ |
|
119 __( 'You cannot update because <a href="%1$s">WordPress %2$s</a> requires MySQL version %3$s or higher. You are running version %4$s.' ), |
|
120 $version_url, |
|
121 $update->current, |
|
122 $update->mysql_version, |
|
123 $mysql_version |
|
124 ); |
96 } else { |
125 } else { |
97 /* translators: 1: URL to WordPress release notes, 2: WordPress version number including locale if necessary */ |
126 $message = sprintf( |
98 $message = sprintf( __( 'You can update to <a href="%1$s">WordPress %2$s</a> automatically:' ), $version_url, $version_string ); |
127 /* translators: 1: URL to WordPress release notes, 2: WordPress version number including locale if necessary. */ |
|
128 __( 'You can update to <a href="%1$s">WordPress %2$s</a> automatically:' ), |
|
129 $version_url, |
|
130 $version_string |
|
131 ); |
99 } |
132 } |
100 if ( ! $mysql_compat || ! $php_compat ) { |
133 if ( ! $mysql_compat || ! $php_compat ) { |
101 $show_buttons = false; |
134 $show_buttons = false; |
102 } |
135 } |
103 } |
136 } |
117 $first_pass = false; |
150 $first_pass = false; |
118 } else { |
151 } else { |
119 submit_button( $submit, '', 'upgrade', false ); |
152 submit_button( $submit, '', 'upgrade', false ); |
120 } |
153 } |
121 } |
154 } |
122 if ( 'en_US' != $update->locale ) { |
155 if ( 'en_US' !== $update->locale ) { |
123 if ( ! isset( $update->dismissed ) || ! $update->dismissed ) { |
156 if ( ! isset( $update->dismissed ) || ! $update->dismissed ) { |
124 submit_button( __( 'Hide this update' ), '', 'dismiss', false ); |
157 submit_button( __( 'Hide this update' ), '', 'dismiss', false ); |
125 } else { |
158 } else { |
126 submit_button( __( 'Bring back this update' ), '', 'undismiss', false ); |
159 submit_button( __( 'Bring back this update' ), '', 'undismiss', false ); |
127 } |
160 } |
128 } |
161 } |
129 echo '</p>'; |
162 echo '</p>'; |
130 if ( 'en_US' != $update->locale && ( ! isset( $wp_local_package ) || $wp_local_package != $update->locale ) ) { |
163 if ( 'en_US' !== $update->locale && ( ! isset( $wp_local_package ) || $wp_local_package != $update->locale ) ) { |
131 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>'; |
164 echo '<p class="hint">' . __( 'This localized version contains both the translation and various other localization fixes.' ) . '</p>'; |
132 } elseif ( 'en_US' == $update->locale && get_locale() != 'en_US' && ( ! $update->packages->partial && $wp_version == $update->partial_version ) ) { |
165 } elseif ( 'en_US' === $update->locale && 'en_US' !== get_locale() && ( ! $update->packages->partial && $wp_version == $update->partial_version ) ) { |
133 // Partial builds don't need language-specific warnings. |
166 // Partial builds don't need language-specific warnings. |
134 echo '<p class="hint">' . sprintf( __( 'You are about to install WordPress %s <strong>in English (US).</strong> There is a chance this update will break your translation. You may prefer to wait for the localized version to be released.' ), $update->response != 'development' ? $update->current : '' ) . '</p>'; |
167 echo '<p class="hint">' . sprintf( |
|
168 /* translators: %s: WordPress version. */ |
|
169 __( 'You are about to install WordPress %s <strong>in English (US).</strong> There is a chance this update will break your translation. You may prefer to wait for the localized version to be released.' ), |
|
170 'development' !== $update->response ? $update->current : '' |
|
171 ) . '</p>'; |
135 } |
172 } |
136 echo '</form>'; |
173 echo '</form>'; |
137 |
174 |
138 } |
175 } |
139 |
176 |
140 /** |
177 /** |
|
178 * Display dismissed updates. |
|
179 * |
141 * @since 2.7.0 |
180 * @since 2.7.0 |
142 */ |
181 */ |
143 function dismissed_updates() { |
182 function dismissed_updates() { |
144 $dismissed = get_core_updates( |
183 $dismissed = get_core_updates( |
145 array( |
184 array( |
174 /** |
213 /** |
175 * Display upgrade WordPress for downloading latest or upgrading automatically form. |
214 * Display upgrade WordPress for downloading latest or upgrading automatically form. |
176 * |
215 * |
177 * @since 2.7.0 |
216 * @since 2.7.0 |
178 * |
217 * |
179 * @global string $required_php_version |
218 * @global string $required_php_version The required PHP version string. |
180 * @global string $required_mysql_version |
219 * @global string $required_mysql_version The required MySQL version string. |
181 */ |
220 */ |
182 function core_upgrade_preamble() { |
221 function core_upgrade_preamble() { |
183 global $required_php_version, $required_mysql_version; |
222 global $required_php_version, $required_mysql_version; |
184 |
223 |
185 $wp_version = get_bloginfo( 'version' ); |
224 $wp_version = get_bloginfo( 'version' ); |
186 $updates = get_core_updates(); |
225 $updates = get_core_updates(); |
187 |
226 |
188 if ( ! isset( $updates[0]->response ) || 'latest' == $updates[0]->response ) { |
227 if ( ! isset( $updates[0]->response ) || 'latest' === $updates[0]->response ) { |
189 echo '<h2>'; |
228 echo '<h2>'; |
190 _e( 'You have the latest version of WordPress.' ); |
229 _e( 'You have the latest version of WordPress.' ); |
191 |
230 |
192 if ( wp_http_supports( array( 'ssl' ) ) ) { |
231 if ( wp_http_supports( array( 'ssl' ) ) ) { |
193 require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php'; |
232 require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php'; |
202 if ( $should_auto_update ) { |
241 if ( $should_auto_update ) { |
203 echo ' ' . __( 'Future security updates will be applied automatically.' ); |
242 echo ' ' . __( 'Future security updates will be applied automatically.' ); |
204 } |
243 } |
205 } |
244 } |
206 echo '</h2>'; |
245 echo '</h2>'; |
207 } else { |
246 } |
|
247 |
|
248 if ( isset( $updates[0]->version ) && version_compare( $updates[0]->version, $wp_version, '>' ) ) { |
208 echo '<div class="notice notice-warning"><p>'; |
249 echo '<div class="notice notice-warning"><p>'; |
209 _e( '<strong>Important:</strong> Before updating, please <a href="https://codex.wordpress.org/WordPress_Backups">back up your database and files</a>. For help with updates, visit the <a href="https://codex.wordpress.org/Updating_WordPress">Updating WordPress</a> Codex page.' ); |
250 printf( |
|
251 /* translators: 1: Documentation on WordPress backups, 2: Documentation on updating WordPress. */ |
|
252 __( '<strong>Important:</strong> Before updating, please <a href="%1$s">back up your database and files</a>. For help with updates, visit the <a href="%2$s">Updating WordPress</a> documentation page.' ), |
|
253 __( 'https://wordpress.org/support/article/wordpress-backups/' ), |
|
254 __( 'https://wordpress.org/support/article/updating-wordpress/' ) |
|
255 ); |
210 echo '</p></div>'; |
256 echo '</p></div>'; |
211 |
257 |
212 echo '<h2 class="response">'; |
258 echo '<h2 class="response">'; |
213 _e( 'An updated version of WordPress is available.' ); |
259 _e( 'An updated version of WordPress is available.' ); |
214 echo '</h2>'; |
260 echo '</h2>'; |
215 } |
261 } |
216 |
262 |
217 if ( isset( $updates[0] ) && $updates[0]->response == 'development' ) { |
263 if ( isset( $updates[0] ) && 'development' === $updates[0]->response ) { |
218 require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php'; |
264 require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php'; |
219 $upgrader = new WP_Automatic_Updater; |
265 $upgrader = new WP_Automatic_Updater; |
220 if ( wp_http_supports( 'ssl' ) && $upgrader->should_update( 'core', $updates[0], ABSPATH ) ) { |
266 if ( wp_http_supports( 'ssl' ) && $upgrader->should_update( 'core', $updates[0], ABSPATH ) ) { |
221 echo '<div class="updated inline"><p>'; |
267 echo '<div class="updated inline"><p>'; |
222 echo '<strong>' . __( 'BETA TESTERS:' ) . '</strong> ' . __( 'This site is set up to install updates of future beta versions automatically.' ); |
268 echo '<strong>' . __( 'BETA TESTERS:' ) . '</strong> ' . __( 'This site is set up to install updates of future beta versions automatically.' ); |
230 list_core_update( $update ); |
276 list_core_update( $update ); |
231 echo '</li>'; |
277 echo '</li>'; |
232 } |
278 } |
233 echo '</ul>'; |
279 echo '</ul>'; |
234 // Don't show the maintenance mode notice when we are only showing a single re-install option. |
280 // Don't show the maintenance mode notice when we are only showing a single re-install option. |
235 if ( $updates && ( count( $updates ) > 1 || $updates[0]->response != 'latest' ) ) { |
281 if ( $updates && ( count( $updates ) > 1 || 'latest' !== $updates[0]->response ) ) { |
236 echo '<p>' . __( 'While your site is being updated, it will be in maintenance mode. As soon as your updates are complete, your site will return to normal.' ) . '</p>'; |
282 echo '<p>' . __( 'While your site is being updated, it will be in maintenance mode. As soon as your updates are complete, this mode will be deactivated.' ) . '</p>'; |
237 } elseif ( ! $updates ) { |
283 } elseif ( ! $updates ) { |
238 list( $normalized_version ) = explode( '-', $wp_version ); |
284 list( $normalized_version ) = explode( '-', $wp_version ); |
239 echo '<p>' . sprintf( __( '<a href="%1$s">Learn more about WordPress %2$s</a>.' ), esc_url( self_admin_url( 'about.php' ) ), $normalized_version ) . '</p>'; |
285 echo '<p>' . sprintf( |
|
286 /* translators: 1: URL to About screen, 2: WordPress version. */ |
|
287 __( '<a href="%1$s">Learn more about WordPress %2$s</a>.' ), |
|
288 esc_url( self_admin_url( 'about.php' ) ), |
|
289 $normalized_version |
|
290 ) . '</p>'; |
240 } |
291 } |
241 dismissed_updates(); |
292 dismissed_updates(); |
242 } |
293 } |
243 |
294 |
|
295 /** |
|
296 * Display the upgrade plugins form. |
|
297 * |
|
298 * @since 2.9.0 |
|
299 */ |
244 function list_plugin_updates() { |
300 function list_plugin_updates() { |
245 $wp_version = get_bloginfo( 'version' ); |
301 $wp_version = get_bloginfo( 'version' ); |
246 $cur_wp_version = preg_replace( '/-.*$/', '', $wp_version ); |
302 $cur_wp_version = preg_replace( '/-.*$/', '', $wp_version ); |
247 |
303 |
248 require_once( ABSPATH . 'wp-admin/includes/plugin-install.php' ); |
304 require_once ABSPATH . 'wp-admin/includes/plugin-install.php'; |
249 $plugins = get_plugin_updates(); |
305 $plugins = get_plugin_updates(); |
250 if ( empty( $plugins ) ) { |
306 if ( empty( $plugins ) ) { |
251 echo '<h2>' . __( 'Plugins' ) . '</h2>'; |
307 echo '<h2>' . __( 'Plugins' ) . '</h2>'; |
252 echo '<p>' . __( 'Your plugins are all up to date.' ) . '</p>'; |
308 echo '<p>' . __( 'Your plugins are all up to date.' ) . '</p>'; |
253 return; |
309 return; |
254 } |
310 } |
255 $form_action = 'update-core.php?action=do-plugin-upgrade'; |
311 $form_action = 'update-core.php?action=do-plugin-upgrade'; |
256 |
312 |
257 $core_updates = get_core_updates(); |
313 $core_updates = get_core_updates(); |
258 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, '=' ) ) { |
314 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, '=' ) ) { |
259 $core_update_version = false; |
315 $core_update_version = false; |
260 } else { |
316 } else { |
261 $core_update_version = $core_updates[0]->current; |
317 $core_update_version = $core_updates[0]->current; |
262 } |
318 } |
263 ?> |
319 ?> |
274 </tr> |
330 </tr> |
275 </thead> |
331 </thead> |
276 |
332 |
277 <tbody class="plugins"> |
333 <tbody class="plugins"> |
278 <?php |
334 <?php |
|
335 |
|
336 $auto_updates = array(); |
|
337 if ( wp_is_auto_update_enabled_for_type( 'plugin' ) ) { |
|
338 $auto_updates = (array) get_site_option( 'auto_update_plugins', array() ); |
|
339 $auto_update_notice = ' | ' . wp_get_auto_update_message(); |
|
340 } |
|
341 |
279 foreach ( (array) $plugins as $plugin_file => $plugin_data ) { |
342 foreach ( (array) $plugins as $plugin_file => $plugin_data ) { |
280 $plugin_data = (object) _get_plugin_data_markup_translate( $plugin_file, (array) $plugin_data, false, true ); |
343 $plugin_data = (object) _get_plugin_data_markup_translate( $plugin_file, (array) $plugin_data, false, true ); |
281 |
344 |
282 $icon = '<span class="dashicons dashicons-admin-plugins"></span>'; |
345 $icon = '<span class="dashicons dashicons-admin-plugins"></span>'; |
283 $preferred_icons = array( 'svg', '2x', '1x', 'default' ); |
346 $preferred_icons = array( 'svg', '2x', '1x', 'default' ); |
288 } |
351 } |
289 } |
352 } |
290 |
353 |
291 // Get plugin compat for running version of WordPress. |
354 // Get plugin compat for running version of WordPress. |
292 if ( isset( $plugin_data->update->tested ) && version_compare( $plugin_data->update->tested, $cur_wp_version, '>=' ) ) { |
355 if ( isset( $plugin_data->update->tested ) && version_compare( $plugin_data->update->tested, $cur_wp_version, '>=' ) ) { |
293 $compat = '<br />' . sprintf( __( 'Compatibility with WordPress %1$s: 100%% (according to its author)' ), $cur_wp_version ); |
356 /* translators: %s: WordPress version. */ |
|
357 $compat = '<br />' . sprintf( __( 'Compatibility with WordPress %s: 100%% (according to its author)' ), $cur_wp_version ); |
294 } else { |
358 } else { |
295 $compat = '<br />' . sprintf( __( 'Compatibility with WordPress %1$s: Unknown' ), $cur_wp_version ); |
359 /* translators: %s: WordPress version. */ |
|
360 $compat = '<br />' . sprintf( __( 'Compatibility with WordPress %s: Unknown' ), $cur_wp_version ); |
296 } |
361 } |
297 // Get plugin compat for updated version of WordPress. |
362 // Get plugin compat for updated version of WordPress. |
298 if ( $core_update_version ) { |
363 if ( $core_update_version ) { |
299 if ( isset( $plugin_data->update->tested ) && version_compare( $plugin_data->update->tested, $core_update_version, '>=' ) ) { |
364 if ( isset( $plugin_data->update->tested ) && version_compare( $plugin_data->update->tested, $core_update_version, '>=' ) ) { |
300 $compat .= '<br />' . sprintf( __( 'Compatibility with WordPress %1$s: 100%% (according to its author)' ), $core_update_version ); |
365 /* translators: %s: WordPress version. */ |
|
366 $compat .= '<br />' . sprintf( __( 'Compatibility with WordPress %s: 100%% (according to its author)' ), $core_update_version ); |
301 } else { |
367 } else { |
302 $compat .= '<br />' . sprintf( __( 'Compatibility with WordPress %1$s: Unknown' ), $core_update_version ); |
368 /* translators: %s: WordPress version. */ |
|
369 $compat .= '<br />' . sprintf( __( 'Compatibility with WordPress %s: Unknown' ), $core_update_version ); |
303 } |
370 } |
304 } |
371 } |
305 |
372 |
306 $requires_php = isset( $plugin_data->update->requires_php ) ? $plugin_data->update->requires_php : null; |
373 $requires_php = isset( $plugin_data->update->requires_php ) ? $plugin_data->update->requires_php : null; |
307 $compatible_php = is_php_version_compatible( $requires_php ); |
374 $compatible_php = is_php_version_compatible( $requires_php ); |
308 |
375 |
309 if ( ! $compatible_php && current_user_can( 'update_php' ) ) { |
376 if ( ! $compatible_php && current_user_can( 'update_php' ) ) { |
310 $compat .= '<br>' . __( 'This update doesn’t work with your version of PHP.' ) . ' '; |
377 $compat .= '<br>' . __( 'This update doesn’t work with your version of PHP.' ) . ' '; |
311 /* translators: %s: Update PHP page URL */ |
|
312 $compat .= sprintf( |
378 $compat .= sprintf( |
|
379 /* translators: %s: URL to Update PHP page. */ |
313 __( '<a href="%s">Learn more about updating PHP</a>.' ), |
380 __( '<a href="%s">Learn more about updating PHP</a>.' ), |
314 esc_url( wp_get_update_php_url() ) |
381 esc_url( wp_get_update_php_url() ) |
315 ); |
382 ); |
316 |
383 |
317 $annotation = wp_get_update_php_annotation(); |
384 $annotation = wp_get_update_php_annotation(); |
330 |
397 |
331 $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' ); |
398 $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' ); |
332 $details = sprintf( |
399 $details = sprintf( |
333 '<a href="%1$s" class="thickbox open-plugin-details-modal" aria-label="%2$s">%3$s</a>', |
400 '<a href="%1$s" class="thickbox open-plugin-details-modal" aria-label="%2$s">%3$s</a>', |
334 esc_url( $details_url ), |
401 esc_url( $details_url ), |
335 /* translators: 1: plugin name, 2: version number */ |
402 /* translators: 1: Plugin name, 2: Version number. */ |
336 esc_attr( sprintf( __( 'View %1$s version %2$s details' ), $plugin_data->Name, $plugin_data->update->new_version ) ), |
403 esc_attr( sprintf( __( 'View %1$s version %2$s details' ), $plugin_data->Name, $plugin_data->update->new_version ) ), |
337 /* translators: %s: plugin version */ |
404 /* translators: %s: Plugin version. */ |
338 sprintf( __( 'View version %s details.' ), $plugin_data->update->new_version ) |
405 sprintf( __( 'View version %s details.' ), $plugin_data->update->new_version ) |
339 ); |
406 ); |
340 |
407 |
341 $checkbox_id = 'checkbox_' . md5( $plugin_data->Name ); |
408 $checkbox_id = 'checkbox_' . md5( $plugin_data->Name ); |
342 ?> |
409 ?> |
343 <tr> |
410 <tr> |
344 <td class="check-column"> |
411 <td class="check-column"> |
345 <?php if ( $compatible_php ) : ?> |
412 <?php if ( $compatible_php ) : ?> |
346 <input type="checkbox" name="checked[]" id="<?php echo $checkbox_id; ?>" value="<?php echo esc_attr( $plugin_file ); ?>" /> |
413 <input type="checkbox" name="checked[]" id="<?php echo $checkbox_id; ?>" value="<?php echo esc_attr( $plugin_file ); ?>" /> |
347 <label for="<?php echo $checkbox_id; ?>" class="screen-reader-text"> |
414 <label for="<?php echo $checkbox_id; ?>" class="screen-reader-text"> |
348 <?php |
415 <?php |
349 /* translators: %s: plugin name */ |
416 /* translators: %s: Plugin name. */ |
350 printf( |
417 printf( __( 'Select %s' ), $plugin_data->Name ); |
351 __( 'Select %s' ), |
418 ?> |
352 $plugin_data->Name |
419 </label> |
353 ); |
420 <?php endif; ?> |
354 ?> |
|
355 </label> |
|
356 <?php endif; ?> |
|
357 </td> |
421 </td> |
358 <td class="plugin-title"><p> |
422 <td class="plugin-title"><p> |
359 <?php echo $icon; ?> |
423 <?php echo $icon; ?> |
360 <strong><?php echo $plugin_data->Name; ?></strong> |
424 <strong><?php echo $plugin_data->Name; ?></strong> |
361 <?php |
425 <?php |
362 /* translators: 1: plugin version, 2: new version */ |
|
363 printf( |
426 printf( |
|
427 /* translators: 1: Plugin version, 2: New version. */ |
364 __( 'You have version %1$s installed. Update to %2$s.' ), |
428 __( 'You have version %1$s installed. Update to %2$s.' ), |
365 $plugin_data->Version, |
429 $plugin_data->Version, |
366 $plugin_data->update->new_version |
430 $plugin_data->update->new_version |
367 ); |
431 ); |
|
432 |
368 echo ' ' . $details . $compat . $upgrade_notice; |
433 echo ' ' . $details . $compat . $upgrade_notice; |
|
434 |
|
435 if ( in_array( $plugin_file, $auto_updates, true ) ) { |
|
436 echo $auto_update_notice; |
|
437 } |
369 ?> |
438 ?> |
370 </p></td> |
439 </p></td> |
371 </tr> |
440 </tr> |
372 <?php |
441 <?php |
373 } |
442 } |
374 ?> |
443 ?> |
375 </tbody> |
444 </tbody> |
376 |
445 |
377 <tfoot> |
446 <tfoot> |
421 </tr> |
492 </tr> |
422 </thead> |
493 </thead> |
423 |
494 |
424 <tbody class="plugins"> |
495 <tbody class="plugins"> |
425 <?php |
496 <?php |
|
497 $auto_updates = array(); |
|
498 if ( wp_is_auto_update_enabled_for_type( 'theme' ) ) { |
|
499 $auto_updates = (array) get_site_option( 'auto_update_themes', array() ); |
|
500 $auto_update_notice = ' | ' . wp_get_auto_update_message(); |
|
501 } |
|
502 |
426 foreach ( $themes as $stylesheet => $theme ) { |
503 foreach ( $themes as $stylesheet => $theme ) { |
|
504 $requires_wp = isset( $theme->update['requires'] ) ? $theme->update['requires'] : null; |
|
505 $requires_php = isset( $theme->update['requires_php'] ) ? $theme->update['requires_php'] : null; |
|
506 |
|
507 $compatible_wp = is_wp_version_compatible( $requires_wp ); |
|
508 $compatible_php = is_php_version_compatible( $requires_php ); |
|
509 |
|
510 $compat = ''; |
|
511 |
|
512 if ( ! $compatible_wp && ! $compatible_php ) { |
|
513 $compat .= '<br>' . __( 'This update doesn’t work with your versions of WordPress and PHP.' ) . ' '; |
|
514 if ( current_user_can( 'update_core' ) && current_user_can( 'update_php' ) ) { |
|
515 $compat .= sprintf( |
|
516 /* translators: 1: URL to WordPress Updates screen, 2: URL to Update PHP page. */ |
|
517 __( '<a href="%1$s">Please update WordPress</a>, and then <a href="%2$s">learn more about updating PHP</a>.' ), |
|
518 self_admin_url( 'update-core.php' ), |
|
519 esc_url( wp_get_update_php_url() ) |
|
520 ); |
|
521 |
|
522 $annotation = wp_get_update_php_annotation(); |
|
523 |
|
524 if ( $annotation ) { |
|
525 $compat .= '</p><p><em>' . $annotation . '</em>'; |
|
526 } |
|
527 } elseif ( current_user_can( 'update_core' ) ) { |
|
528 $compat .= sprintf( |
|
529 /* translators: %s: URL to WordPress Updates screen. */ |
|
530 __( '<a href="%s">Please update WordPress</a>.' ), |
|
531 self_admin_url( 'update-core.php' ) |
|
532 ); |
|
533 } elseif ( current_user_can( 'update_php' ) ) { |
|
534 $compat .= sprintf( |
|
535 /* translators: %s: URL to Update PHP page. */ |
|
536 __( '<a href="%s">Learn more about updating PHP</a>.' ), |
|
537 esc_url( wp_get_update_php_url() ) |
|
538 ); |
|
539 |
|
540 $annotation = wp_get_update_php_annotation(); |
|
541 |
|
542 if ( $annotation ) { |
|
543 $compat .= '</p><p><em>' . $annotation . '</em>'; |
|
544 } |
|
545 } |
|
546 } elseif ( ! $compatible_wp ) { |
|
547 $compat .= '<br>' . __( 'This update doesn’t work with your version of WordPress.' ) . ' '; |
|
548 if ( current_user_can( 'update_core' ) ) { |
|
549 $compat .= sprintf( |
|
550 /* translators: %s: URL to WordPress Updates screen. */ |
|
551 __( '<a href="%s">Please update WordPress</a>.' ), |
|
552 self_admin_url( 'update-core.php' ) |
|
553 ); |
|
554 } |
|
555 } elseif ( ! $compatible_php ) { |
|
556 $compat .= '<br>' . __( 'This update doesn’t work with your version of PHP.' ) . ' '; |
|
557 if ( current_user_can( 'update_php' ) ) { |
|
558 $compat .= sprintf( |
|
559 /* translators: %s: URL to Update PHP page. */ |
|
560 __( '<a href="%s">Learn more about updating PHP</a>.' ), |
|
561 esc_url( wp_get_update_php_url() ) |
|
562 ); |
|
563 |
|
564 $annotation = wp_get_update_php_annotation(); |
|
565 |
|
566 if ( $annotation ) { |
|
567 $compat .= '</p><p><em>' . $annotation . '</em>'; |
|
568 } |
|
569 } |
|
570 } |
|
571 |
427 $checkbox_id = 'checkbox_' . md5( $theme->get( 'Name' ) ); |
572 $checkbox_id = 'checkbox_' . md5( $theme->get( 'Name' ) ); |
428 ?> |
573 ?> |
429 <tr> |
574 <tr> |
430 <td class="check-column"> |
575 <td class="check-column"> |
431 <input type="checkbox" name="checked[]" id="<?php echo $checkbox_id; ?>" value="<?php echo esc_attr( $stylesheet ); ?>" /> |
576 <?php if ( $compatible_wp && $compatible_php ) : ?> |
432 <label for="<?php echo $checkbox_id; ?>" class="screen-reader-text"> |
577 <input type="checkbox" name="checked[]" id="<?php echo $checkbox_id; ?>" value="<?php echo esc_attr( $stylesheet ); ?>" /> |
433 <?php |
578 <label for="<?php echo $checkbox_id; ?>" class="screen-reader-text"> |
434 /* translators: %s: theme name */ |
579 <?php |
435 printf( |
580 /* translators: %s: Theme name. */ |
436 __( 'Select %s' ), |
581 printf( __( 'Select %s' ), $theme->display( 'Name' ) ); |
437 $theme->display( 'Name' ) |
582 ?> |
438 ); |
583 </label> |
439 ?> |
584 <?php endif; ?> |
440 </label> |
|
441 </td> |
585 </td> |
442 <td class="plugin-title"><p> |
586 <td class="plugin-title"><p> |
443 <img src="<?php echo esc_url( $theme->get_screenshot() ); ?>" width="85" height="64" class="updates-table-screenshot" alt="" /> |
587 <img src="<?php echo esc_url( $theme->get_screenshot() ); ?>" width="85" height="64" class="updates-table-screenshot" alt="" /> |
444 <strong><?php echo $theme->display( 'Name' ); ?></strong> |
588 <strong><?php echo $theme->display( 'Name' ); ?></strong> |
445 <?php |
589 <?php |
446 /* translators: 1: theme version, 2: new version */ |
|
447 printf( |
590 printf( |
|
591 /* translators: 1: Theme version, 2: New version. */ |
448 __( 'You have version %1$s installed. Update to %2$s.' ), |
592 __( 'You have version %1$s installed. Update to %2$s.' ), |
449 $theme->display( 'Version' ), |
593 $theme->display( 'Version' ), |
450 $theme->update['new_version'] |
594 $theme->update['new_version'] |
451 ); |
595 ); |
|
596 |
|
597 echo ' ' . $compat; |
|
598 |
|
599 if ( in_array( $stylesheet, $auto_updates, true ) ) { |
|
600 echo $auto_update_notice; |
|
601 } |
452 ?> |
602 ?> |
453 </p></td> |
603 </p></td> |
454 </tr> |
604 </tr> |
455 <?php |
605 <?php |
456 } |
606 } |
528 ?> |
680 ?> |
529 <div class="wrap"> |
681 <div class="wrap"> |
530 <h1><?php _e( 'Update WordPress' ); ?></h1> |
682 <h1><?php _e( 'Update WordPress' ); ?></h1> |
531 <?php |
683 <?php |
532 |
684 |
533 if ( false === ( $credentials = request_filesystem_credentials( $url, '', false, ABSPATH, array( 'version', 'locale' ), $allow_relaxed_file_ownership ) ) ) { |
685 $credentials = request_filesystem_credentials( $url, '', false, ABSPATH, array( 'version', 'locale' ), $allow_relaxed_file_ownership ); |
|
686 if ( false === $credentials ) { |
534 echo '</div>'; |
687 echo '</div>'; |
535 return; |
688 return; |
536 } |
689 } |
537 |
690 |
538 if ( ! WP_Filesystem( $credentials, ABSPATH, $allow_relaxed_file_ownership ) ) { |
691 if ( ! WP_Filesystem( $credentials, ABSPATH, $allow_relaxed_file_ownership ) ) { |
539 // Failed to connect, Error and request again |
692 // Failed to connect. Error and request again. |
540 request_filesystem_credentials( $url, '', true, ABSPATH, array( 'version', 'locale' ), $allow_relaxed_file_ownership ); |
693 request_filesystem_credentials( $url, '', true, ABSPATH, array( 'version', 'locale' ), $allow_relaxed_file_ownership ); |
541 echo '</div>'; |
694 echo '</div>'; |
542 return; |
695 return; |
543 } |
696 } |
544 |
697 |
565 ); |
718 ); |
566 |
719 |
567 if ( is_wp_error( $result ) ) { |
720 if ( is_wp_error( $result ) ) { |
568 show_message( $result ); |
721 show_message( $result ); |
569 if ( 'up_to_date' != $result->get_error_code() && 'locked' != $result->get_error_code() ) { |
722 if ( 'up_to_date' != $result->get_error_code() && 'locked' != $result->get_error_code() ) { |
570 show_message( __( 'Installation Failed' ) ); |
723 show_message( __( 'Installation failed.' ) ); |
571 } |
724 } |
572 echo '</div>'; |
725 echo '</div>'; |
573 return; |
726 return; |
574 } |
727 } |
575 |
728 |
576 show_message( __( 'WordPress updated successfully' ) ); |
729 show_message( __( 'WordPress updated successfully.' ) ); |
577 show_message( '<span class="hide-if-no-js">' . sprintf( __( 'Welcome to WordPress %1$s. You will be redirected to the About WordPress screen. If not, click <a href="%2$s">here</a>.' ), $result, esc_url( self_admin_url( 'about.php?updated' ) ) ) . '</span>' ); |
730 show_message( |
578 show_message( '<span class="hide-if-js">' . sprintf( __( 'Welcome to WordPress %1$s. <a href="%2$s">Learn more</a>.' ), $result, esc_url( self_admin_url( 'about.php?updated' ) ) ) . '</span>' ); |
731 '<span class="hide-if-no-js">' . sprintf( |
|
732 /* translators: 1: WordPress version, 2: URL to About screen. */ |
|
733 __( 'Welcome to WordPress %1$s. You will be redirected to the About WordPress screen. If not, click <a href="%2$s">here</a>.' ), |
|
734 $result, |
|
735 esc_url( self_admin_url( 'about.php?updated' ) ) |
|
736 ) . '</span>' |
|
737 ); |
|
738 show_message( |
|
739 '<span class="hide-if-js">' . sprintf( |
|
740 /* translators: 1: WordPress version, 2: URL to About screen. */ |
|
741 __( 'Welcome to WordPress %1$s. <a href="%2$s">Learn more</a>.' ), |
|
742 $result, |
|
743 esc_url( self_admin_url( 'about.php?updated' ) ) |
|
744 ) . '</span>' |
|
745 ); |
579 ?> |
746 ?> |
580 </div> |
747 </div> |
581 <script type="text/javascript"> |
748 <script type="text/javascript"> |
582 window.location = '<?php echo self_admin_url( 'about.php?updated' ); ?>'; |
749 window.location = '<?php echo self_admin_url( 'about.php?updated' ); ?>'; |
583 </script> |
750 </script> |
584 <?php |
751 <?php |
585 } |
752 } |
586 |
753 |
587 /** |
754 /** |
|
755 * Dismiss a core update. |
|
756 * |
588 * @since 2.7.0 |
757 * @since 2.7.0 |
589 */ |
758 */ |
590 function do_dismiss_core_update() { |
759 function do_dismiss_core_update() { |
591 $version = isset( $_POST['version'] ) ? $_POST['version'] : false; |
760 $version = isset( $_POST['version'] ) ? $_POST['version'] : false; |
592 $locale = isset( $_POST['locale'] ) ? $_POST['locale'] : 'en_US'; |
761 $locale = isset( $_POST['locale'] ) ? $_POST['locale'] : 'en_US'; |
638 ); |
809 ); |
639 |
810 |
640 $updates_howto = '<p>' . __( '<strong>WordPress</strong> — Updating your WordPress installation is a simple one-click procedure: just <strong>click on the “Update Now” button</strong> when you are notified that a new version is available.' ) . ' ' . __( 'In most cases, WordPress will automatically apply maintenance and security updates in the background for you.' ) . '</p>'; |
811 $updates_howto = '<p>' . __( '<strong>WordPress</strong> — Updating your WordPress installation is a simple one-click procedure: just <strong>click on the “Update Now” button</strong> when you are notified that a new version is available.' ) . ' ' . __( 'In most cases, WordPress will automatically apply maintenance and security updates in the background for you.' ) . '</p>'; |
641 $updates_howto .= '<p>' . __( '<strong>Themes and Plugins</strong> — To update individual themes or plugins from this screen, use the checkboxes to make your selection, then <strong>click on the appropriate “Update” button</strong>. To update all of your themes or plugins at once, you can check the box at the top of the section to select all before clicking the update button.' ) . '</p>'; |
812 $updates_howto .= '<p>' . __( '<strong>Themes and Plugins</strong> — To update individual themes or plugins from this screen, use the checkboxes to make your selection, then <strong>click on the appropriate “Update” button</strong>. To update all of your themes or plugins at once, you can check the box at the top of the section to select all before clicking the update button.' ) . '</p>'; |
642 |
813 |
643 if ( 'en_US' != get_locale() ) { |
814 if ( 'en_US' !== get_locale() ) { |
644 $updates_howto .= '<p>' . __( '<strong>Translations</strong> — The files translating WordPress into your language are updated for you whenever any other updates occur. But if these files are out of date, you can <strong>click the “Update Translations”</strong> button.' ) . '</p>'; |
815 $updates_howto .= '<p>' . __( '<strong>Translations</strong> — The files translating WordPress into your language are updated for you whenever any other updates occur. But if these files are out of date, you can <strong>click the “Update Translations”</strong> button.' ) . '</p>'; |
645 } |
816 } |
646 |
817 |
647 get_current_screen()->add_help_tab( |
818 get_current_screen()->add_help_tab( |
648 array( |
819 array( |
650 'title' => __( 'How to Update' ), |
821 'title' => __( 'How to Update' ), |
651 'content' => $updates_howto, |
822 'content' => $updates_howto, |
652 ) |
823 ) |
653 ); |
824 ); |
654 |
825 |
|
826 $help_sidebar_autoupdates = ''; |
|
827 |
|
828 if ( ( current_user_can( 'update_themes' ) && wp_is_auto_update_enabled_for_type( 'theme' ) ) || ( current_user_can( 'update_plugins' ) && wp_is_auto_update_enabled_for_type( 'plugin' ) ) ) { |
|
829 $help_tab_autoupdates = '<p>' . __( 'Auto-updates can be enabled or disabled for each individual theme or plugin. Themes or plugins with auto-updates enabled will display the estimated date of the next auto-update. Auto-updates depends on the WP-Cron task scheduling system.' ) . '</p>'; |
|
830 $help_tab_autoupdates .= '<p>' . __( 'Please note: Third-party themes and plugins, or custom code, may override WordPress scheduling.' ) . '</p>'; |
|
831 |
|
832 get_current_screen()->add_help_tab( |
|
833 array( |
|
834 'id' => 'plugins-themes-auto-updates', |
|
835 'title' => __( 'Auto-updates' ), |
|
836 'content' => $help_tab_autoupdates, |
|
837 ) |
|
838 ); |
|
839 |
|
840 $help_sidebar_autoupdates = '<p>' . __( '<a href="https://wordpress.org/support/article/plugins-themes-auto-updates/">Learn more: Auto-updates documentation</a>' ) . '</p>'; |
|
841 } |
|
842 |
655 get_current_screen()->set_help_sidebar( |
843 get_current_screen()->set_help_sidebar( |
656 '<p><strong>' . __( 'For more information:' ) . '</strong></p>' . |
844 '<p><strong>' . __( 'For more information:' ) . '</strong></p>' . |
657 '<p>' . __( '<a href="https://codex.wordpress.org/Dashboard_Updates_Screen">Documentation on Updating WordPress</a>' ) . '</p>' . |
845 '<p>' . __( '<a href="https://wordpress.org/support/article/dashboard-updates-screen/">Documentation on Updating WordPress</a>' ) . '</p>' . |
|
846 $help_sidebar_autoupdates . |
658 '<p>' . __( '<a href="https://wordpress.org/support/">Support</a>' ) . '</p>' |
847 '<p>' . __( '<a href="https://wordpress.org/support/">Support</a>' ) . '</p>' |
659 ); |
848 ); |
660 |
849 |
661 if ( 'upgrade-core' == $action ) { |
850 if ( 'upgrade-core' === $action ) { |
662 // Force a update check when requested |
851 // Force a update check when requested. |
663 $force_check = ! empty( $_GET['force-check'] ); |
852 $force_check = ! empty( $_GET['force-check'] ); |
664 wp_version_check( array(), $force_check ); |
853 wp_version_check( array(), $force_check ); |
665 |
854 |
666 require_once( ABSPATH . 'wp-admin/admin-header.php' ); |
855 require_once ABSPATH . 'wp-admin/admin-header.php'; |
667 ?> |
856 ?> |
668 <div class="wrap"> |
857 <div class="wrap"> |
669 <h1><?php _e( 'WordPress Updates' ); ?></h1> |
858 <h1><?php _e( 'WordPress Updates' ); ?></h1> |
670 <?php |
859 <?php |
671 if ( $upgrade_error ) { |
860 if ( $upgrade_error ) { |
672 echo '<div class="error"><p>'; |
861 echo '<div class="error"><p>'; |
673 if ( $upgrade_error == 'themes' ) { |
862 if ( 'themes' === $upgrade_error ) { |
674 _e( 'Please select one or more themes to update.' ); |
863 _e( 'Please select one or more themes to update.' ); |
675 } else { |
864 } else { |
676 _e( 'Please select one or more plugins to update.' ); |
865 _e( 'Please select one or more plugins to update.' ); |
677 } |
866 } |
678 echo '</p></div>'; |
867 echo '</p></div>'; |
684 if ( $current && isset( $current->last_checked ) ) { |
873 if ( $current && isset( $current->last_checked ) ) { |
685 $last_update_check = $current->last_checked + get_option( 'gmt_offset' ) * HOUR_IN_SECONDS; |
874 $last_update_check = $current->last_checked + get_option( 'gmt_offset' ) * HOUR_IN_SECONDS; |
686 } |
875 } |
687 |
876 |
688 echo '<p>'; |
877 echo '<p>'; |
689 /* translators: 1: date, 2: time */ |
878 /* translators: 1: Date, 2: Time. */ |
690 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 ) ); |
879 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 ) ); |
691 echo ' <a class="button" href="' . esc_url( self_admin_url( 'update-core.php?force-check=1' ) ) . '">' . __( 'Check Again' ) . '</a>'; |
880 echo ' <a class="button" href="' . esc_url( self_admin_url( 'update-core.php?force-check=1' ) ) . '">' . __( 'Check Again' ) . '</a>'; |
692 echo '</p>'; |
881 echo '</p>'; |
693 |
882 |
694 if ( current_user_can( 'update_core' ) ) { |
883 if ( current_user_can( 'update_core' ) ) { |
778 $url = 'update.php?action=update-selected&plugins=' . urlencode( implode( ',', $plugins ) ); |
967 $url = 'update.php?action=update-selected&plugins=' . urlencode( implode( ',', $plugins ) ); |
779 $url = wp_nonce_url( $url, 'bulk-update-plugins' ); |
968 $url = wp_nonce_url( $url, 'bulk-update-plugins' ); |
780 |
969 |
781 $title = __( 'Update Plugins' ); |
970 $title = __( 'Update Plugins' ); |
782 |
971 |
783 require_once( ABSPATH . 'wp-admin/admin-header.php' ); |
972 require_once ABSPATH . 'wp-admin/admin-header.php'; |
784 echo '<div class="wrap">'; |
973 echo '<div class="wrap">'; |
785 echo '<h1>' . __( 'Update Plugins' ) . '</h1>'; |
974 echo '<h1>' . __( 'Update Plugins' ) . '</h1>'; |
786 echo '<iframe src="', $url, '" style="width: 100%; height: 100%; min-height: 750px;" frameborder="0" title="' . esc_attr__( 'Update progress' ) . '"></iframe>'; |
975 echo '<iframe src="', $url, '" style="width: 100%; height: 100%; min-height: 750px;" frameborder="0" title="' . esc_attr__( 'Update progress' ) . '"></iframe>'; |
787 echo '</div>'; |
976 echo '</div>'; |
788 |
977 |
832 array( |
1021 array( |
833 'totals' => wp_get_update_data(), |
1022 'totals' => wp_get_update_data(), |
834 ) |
1023 ) |
835 ); |
1024 ); |
836 |
1025 |
837 include( ABSPATH . 'wp-admin/admin-footer.php' ); |
1026 require_once ABSPATH . 'wp-admin/admin-footer.php'; |
838 |
1027 |
839 } elseif ( 'do-translation-upgrade' == $action ) { |
1028 } elseif ( 'do-translation-upgrade' === $action ) { |
840 |
1029 |
841 if ( ! current_user_can( 'update_languages' ) ) { |
1030 if ( ! current_user_can( 'update_languages' ) ) { |
842 wp_die( __( 'Sorry, you are not allowed to update this site.' ) ); |
1031 wp_die( __( 'Sorry, you are not allowed to update this site.' ) ); |
843 } |
1032 } |
844 |
1033 |
845 check_admin_referer( 'upgrade-translations' ); |
1034 check_admin_referer( 'upgrade-translations' ); |
846 |
1035 |
847 require_once( ABSPATH . 'wp-admin/admin-header.php' ); |
1036 require_once ABSPATH . 'wp-admin/admin-header.php'; |
848 include_once( ABSPATH . 'wp-admin/includes/class-wp-upgrader.php' ); |
1037 require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php'; |
849 |
1038 |
850 $url = 'update-core.php?action=do-translation-upgrade'; |
1039 $url = 'update-core.php?action=do-translation-upgrade'; |
851 $nonce = 'upgrade-translations'; |
1040 $nonce = 'upgrade-translations'; |
852 $title = __( 'Update Translations' ); |
1041 $title = __( 'Update Translations' ); |
853 $context = WP_LANG_DIR; |
1042 $context = WP_LANG_DIR; |