@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | * @return bool |
28 | 28 | */ |
29 | 29 | public function ajax_user_can() { |
30 | - return current_user_can( 'install_plugins' ); |
|
30 | + return current_user_can('install_plugins'); |
|
31 | 31 | } |
32 | 32 | |
33 | 33 | /** |
@@ -44,21 +44,21 @@ discard block |
||
44 | 44 | protected function get_installed_plugins() { |
45 | 45 | $plugins = array(); |
46 | 46 | |
47 | - $plugin_info = get_site_transient( 'update_plugins' ); |
|
48 | - if ( isset( $plugin_info->no_update ) ) { |
|
49 | - foreach ( $plugin_info->no_update as $plugin ) { |
|
50 | - if ( isset( $plugin->slug ) ) { |
|
47 | + $plugin_info = get_site_transient('update_plugins'); |
|
48 | + if (isset($plugin_info->no_update)) { |
|
49 | + foreach ($plugin_info->no_update as $plugin) { |
|
50 | + if (isset($plugin->slug)) { |
|
51 | 51 | $plugin->upgrade = false; |
52 | - $plugins[ $plugin->slug ] = $plugin; |
|
52 | + $plugins[$plugin->slug] = $plugin; |
|
53 | 53 | } |
54 | 54 | } |
55 | 55 | } |
56 | 56 | |
57 | - if ( isset( $plugin_info->response ) ) { |
|
58 | - foreach ( $plugin_info->response as $plugin ) { |
|
59 | - if ( isset( $plugin->slug ) ) { |
|
57 | + if (isset($plugin_info->response)) { |
|
58 | + foreach ($plugin_info->response as $plugin) { |
|
59 | + if (isset($plugin->slug)) { |
|
60 | 60 | $plugin->upgrade = true; |
61 | - $plugins[ $plugin->slug ] = $plugin; |
|
61 | + $plugins[$plugin->slug] = $plugin; |
|
62 | 62 | } |
63 | 63 | } |
64 | 64 | } |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | * @return array |
79 | 79 | */ |
80 | 80 | protected function get_installed_plugin_slugs() { |
81 | - return array_keys( $this->get_installed_plugins() ); |
|
81 | + return array_keys($this->get_installed_plugins()); |
|
82 | 82 | } |
83 | 83 | |
84 | 84 | /** |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | |
94 | 94 | global $tabs, $tab, $paged, $type, $term; |
95 | 95 | |
96 | - wp_reset_vars( array( 'tab' ) ); |
|
96 | + wp_reset_vars(array('tab')); |
|
97 | 97 | |
98 | 98 | $paged = $this->get_pagenum(); |
99 | 99 | |
@@ -102,26 +102,26 @@ discard block |
||
102 | 102 | // These are the tabs which are shown on the page. |
103 | 103 | $tabs = array(); |
104 | 104 | |
105 | - if ( 'search' === $tab ) { |
|
106 | - $tabs['search'] = __( 'Search Results' ); |
|
105 | + if ('search' === $tab) { |
|
106 | + $tabs['search'] = __('Search Results'); |
|
107 | 107 | } |
108 | 108 | |
109 | - if ( 'beta' === $tab || false !== strpos( get_bloginfo( 'version' ), '-' ) ) { |
|
110 | - $tabs['beta'] = _x( 'Beta Testing', 'Plugin Installer' ); |
|
109 | + if ('beta' === $tab || false !== strpos(get_bloginfo('version'), '-')) { |
|
110 | + $tabs['beta'] = _x('Beta Testing', 'Plugin Installer'); |
|
111 | 111 | } |
112 | 112 | |
113 | - $tabs['featured'] = _x( 'Featured', 'Plugin Installer' ); |
|
114 | - $tabs['popular'] = _x( 'Popular', 'Plugin Installer' ); |
|
115 | - $tabs['recommended'] = _x( 'Recommended', 'Plugin Installer' ); |
|
116 | - $tabs['favorites'] = _x( 'Favorites', 'Plugin Installer' ); |
|
113 | + $tabs['featured'] = _x('Featured', 'Plugin Installer'); |
|
114 | + $tabs['popular'] = _x('Popular', 'Plugin Installer'); |
|
115 | + $tabs['recommended'] = _x('Recommended', 'Plugin Installer'); |
|
116 | + $tabs['favorites'] = _x('Favorites', 'Plugin Installer'); |
|
117 | 117 | |
118 | - if ( current_user_can( 'upload_plugins' ) ) { |
|
118 | + if (current_user_can('upload_plugins')) { |
|
119 | 119 | // No longer a real tab. Here for filter compatibility. |
120 | 120 | // Gets skipped in get_views(). |
121 | - $tabs['upload'] = __( 'Upload Plugin' ); |
|
121 | + $tabs['upload'] = __('Upload Plugin'); |
|
122 | 122 | } |
123 | 123 | |
124 | - $nonmenu_tabs = array( 'plugin-information' ); // Valid actions to perform which do not have a Menu item. |
|
124 | + $nonmenu_tabs = array('plugin-information'); // Valid actions to perform which do not have a Menu item. |
|
125 | 125 | |
126 | 126 | /** |
127 | 127 | * Filters the tabs shown on the Add Plugins screen. |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | * @param string[] $tabs The tabs shown on the Add Plugins screen. Defaults include |
132 | 132 | * 'featured', 'popular', 'recommended', 'favorites', and 'upload'. |
133 | 133 | */ |
134 | - $tabs = apply_filters( 'install_plugins_tabs', $tabs ); |
|
134 | + $tabs = apply_filters('install_plugins_tabs', $tabs); |
|
135 | 135 | |
136 | 136 | /** |
137 | 137 | * Filters tabs not associated with a menu item on the Add Plugins screen. |
@@ -140,11 +140,11 @@ discard block |
||
140 | 140 | * |
141 | 141 | * @param string[] $nonmenu_tabs The tabs that don't have a menu item on the Add Plugins screen. |
142 | 142 | */ |
143 | - $nonmenu_tabs = apply_filters( 'install_plugins_nonmenu_tabs', $nonmenu_tabs ); |
|
143 | + $nonmenu_tabs = apply_filters('install_plugins_nonmenu_tabs', $nonmenu_tabs); |
|
144 | 144 | |
145 | 145 | // If a non-valid menu tab has been selected, And it's not a non-menu action. |
146 | - if ( empty( $tab ) || ( ! isset( $tabs[ $tab ] ) && ! in_array( $tab, (array) $nonmenu_tabs, true ) ) ) { |
|
147 | - $tab = key( $tabs ); |
|
146 | + if (empty($tab) || (!isset($tabs[$tab]) && !in_array($tab, (array) $nonmenu_tabs, true))) { |
|
147 | + $tab = key($tabs); |
|
148 | 148 | } |
149 | 149 | |
150 | 150 | $installed_plugins = $this->get_installed_plugins(); |
@@ -156,14 +156,14 @@ discard block |
||
156 | 156 | 'locale' => get_user_locale(), |
157 | 157 | ); |
158 | 158 | |
159 | - switch ( $tab ) { |
|
159 | + switch ($tab) { |
|
160 | 160 | case 'search': |
161 | - $type = isset( $_REQUEST['type'] ) ? wp_unslash( $_REQUEST['type'] ) : 'term'; |
|
162 | - $term = isset( $_REQUEST['s'] ) ? wp_unslash( $_REQUEST['s'] ) : ''; |
|
161 | + $type = isset($_REQUEST['type']) ? wp_unslash($_REQUEST['type']) : 'term'; |
|
162 | + $term = isset($_REQUEST['s']) ? wp_unslash($_REQUEST['s']) : ''; |
|
163 | 163 | |
164 | - switch ( $type ) { |
|
164 | + switch ($type) { |
|
165 | 165 | case 'tag': |
166 | - $args['tag'] = sanitize_title_with_dashes( $term ); |
|
166 | + $args['tag'] = sanitize_title_with_dashes($term); |
|
167 | 167 | break; |
168 | 168 | case 'term': |
169 | 169 | $args['search'] = $term; |
@@ -184,28 +184,28 @@ discard block |
||
184 | 184 | case 'recommended': |
185 | 185 | $args['browse'] = $tab; |
186 | 186 | // Include the list of installed plugins so we can get relevant results. |
187 | - $args['installed_plugins'] = array_keys( $installed_plugins ); |
|
187 | + $args['installed_plugins'] = array_keys($installed_plugins); |
|
188 | 188 | break; |
189 | 189 | |
190 | 190 | case 'favorites': |
191 | 191 | $action = 'save_wporg_username_' . get_current_user_id(); |
192 | - if ( isset( $_GET['_wpnonce'] ) && wp_verify_nonce( wp_unslash( $_GET['_wpnonce'] ), $action ) ) { |
|
193 | - $user = isset( $_GET['user'] ) ? wp_unslash( $_GET['user'] ) : get_user_option( 'wporg_favorites' ); |
|
192 | + if (isset($_GET['_wpnonce']) && wp_verify_nonce(wp_unslash($_GET['_wpnonce']), $action)) { |
|
193 | + $user = isset($_GET['user']) ? wp_unslash($_GET['user']) : get_user_option('wporg_favorites'); |
|
194 | 194 | |
195 | 195 | // If the save url parameter is passed with a falsey value, don't save the favorite user. |
196 | - if ( ! isset( $_GET['save'] ) || $_GET['save'] ) { |
|
197 | - update_user_meta( get_current_user_id(), 'wporg_favorites', $user ); |
|
196 | + if (!isset($_GET['save']) || $_GET['save']) { |
|
197 | + update_user_meta(get_current_user_id(), 'wporg_favorites', $user); |
|
198 | 198 | } |
199 | 199 | } else { |
200 | - $user = get_user_option( 'wporg_favorites' ); |
|
200 | + $user = get_user_option('wporg_favorites'); |
|
201 | 201 | } |
202 | - if ( $user ) { |
|
202 | + if ($user) { |
|
203 | 203 | $args['user'] = $user; |
204 | 204 | } else { |
205 | 205 | $args = false; |
206 | 206 | } |
207 | 207 | |
208 | - add_action( 'install_plugins_favorites', 'install_plugins_favorites_form', 9, 0 ); |
|
208 | + add_action('install_plugins_favorites', 'install_plugins_favorites_form', 9, 0); |
|
209 | 209 | break; |
210 | 210 | |
211 | 211 | default: |
@@ -232,23 +232,23 @@ discard block |
||
232 | 232 | * |
233 | 233 | * @param array|false $args Plugin install API arguments. |
234 | 234 | */ |
235 | - $args = apply_filters( "install_plugins_table_api_args_{$tab}", $args ); |
|
235 | + $args = apply_filters("install_plugins_table_api_args_{$tab}", $args); |
|
236 | 236 | |
237 | - if ( ! $args ) { |
|
237 | + if (!$args) { |
|
238 | 238 | return; |
239 | 239 | } |
240 | 240 | |
241 | - $api = plugins_api( 'query_plugins', $args ); |
|
241 | + $api = plugins_api('query_plugins', $args); |
|
242 | 242 | |
243 | - if ( is_wp_error( $api ) ) { |
|
243 | + if (is_wp_error($api)) { |
|
244 | 244 | $this->error = $api; |
245 | 245 | return; |
246 | 246 | } |
247 | 247 | |
248 | 248 | $this->items = $api->plugins; |
249 | 249 | |
250 | - if ( $this->orderby ) { |
|
251 | - uasort( $this->items, array( $this, 'order_callback' ) ); |
|
250 | + if ($this->orderby) { |
|
251 | + uasort($this->items, array($this, 'order_callback')); |
|
252 | 252 | } |
253 | 253 | |
254 | 254 | $this->set_pagination_args( |
@@ -258,21 +258,21 @@ discard block |
||
258 | 258 | ) |
259 | 259 | ); |
260 | 260 | |
261 | - if ( isset( $api->info['groups'] ) ) { |
|
261 | + if (isset($api->info['groups'])) { |
|
262 | 262 | $this->groups = $api->info['groups']; |
263 | 263 | } |
264 | 264 | |
265 | - if ( $installed_plugins ) { |
|
265 | + if ($installed_plugins) { |
|
266 | 266 | $js_plugins = array_fill_keys( |
267 | - array( 'all', 'search', 'active', 'inactive', 'recently_activated', 'mustuse', 'dropins' ), |
|
267 | + array('all', 'search', 'active', 'inactive', 'recently_activated', 'mustuse', 'dropins'), |
|
268 | 268 | array() |
269 | 269 | ); |
270 | 270 | |
271 | - $js_plugins['all'] = array_values( wp_list_pluck( $installed_plugins, 'plugin' ) ); |
|
272 | - $upgrade_plugins = wp_filter_object_list( $installed_plugins, array( 'upgrade' => true ), 'and', 'plugin' ); |
|
271 | + $js_plugins['all'] = array_values(wp_list_pluck($installed_plugins, 'plugin')); |
|
272 | + $upgrade_plugins = wp_filter_object_list($installed_plugins, array('upgrade' => true), 'and', 'plugin'); |
|
273 | 273 | |
274 | - if ( $upgrade_plugins ) { |
|
275 | - $js_plugins['upgrade'] = array_values( $upgrade_plugins ); |
|
274 | + if ($upgrade_plugins) { |
|
275 | + $js_plugins['upgrade'] = array_values($upgrade_plugins); |
|
276 | 276 | } |
277 | 277 | |
278 | 278 | wp_localize_script( |
@@ -289,12 +289,12 @@ discard block |
||
289 | 289 | /** |
290 | 290 | */ |
291 | 291 | public function no_items() { |
292 | - if ( isset( $this->error ) ) { ?> |
|
292 | + if (isset($this->error)) { ?> |
|
293 | 293 | <div class="inline error"><p><?php echo $this->error->get_error_message(); ?></p> |
294 | - <p class="hide-if-no-js"><button class="button try-again"><?php _e( 'Try Again' ); ?></button></p> |
|
294 | + <p class="hide-if-no-js"><button class="button try-again"><?php _e('Try Again'); ?></button></p> |
|
295 | 295 | </div> |
296 | 296 | <?php } else { ?> |
297 | - <div class="no-plugin-results"><?php _e( 'No plugins found. Try a different search.' ); ?></div> |
|
297 | + <div class="no-plugin-results"><?php _e('No plugins found. Try a different search.'); ?></div> |
|
298 | 298 | <?php |
299 | 299 | } |
300 | 300 | } |
@@ -309,13 +309,13 @@ discard block |
||
309 | 309 | global $tabs, $tab; |
310 | 310 | |
311 | 311 | $display_tabs = array(); |
312 | - foreach ( (array) $tabs as $action => $text ) { |
|
313 | - $current_link_attributes = ( $action === $tab ) ? ' class="current" aria-current="page"' : ''; |
|
314 | - $href = self_admin_url( 'plugin-install.php?tab=' . $action ); |
|
315 | - $display_tabs[ 'plugin-install-' . $action ] = "<a href='$href'$current_link_attributes>$text</a>"; |
|
312 | + foreach ((array) $tabs as $action => $text) { |
|
313 | + $current_link_attributes = ($action === $tab) ? ' class="current" aria-current="page"' : ''; |
|
314 | + $href = self_admin_url('plugin-install.php?tab=' . $action); |
|
315 | + $display_tabs['plugin-install-' . $action] = "<a href='$href'$current_link_attributes>$text</a>"; |
|
316 | 316 | } |
317 | 317 | // No longer a real tab. |
318 | - unset( $display_tabs['plugin-install-upload'] ); |
|
318 | + unset($display_tabs['plugin-install-upload']); |
|
319 | 319 | |
320 | 320 | return $display_tabs; |
321 | 321 | } |
@@ -327,18 +327,18 @@ discard block |
||
327 | 327 | $views = $this->get_views(); |
328 | 328 | |
329 | 329 | /** This filter is documented in wp-admin/inclues/class-wp-list-table.php */ |
330 | - $views = apply_filters( "views_{$this->screen->id}", $views ); |
|
330 | + $views = apply_filters("views_{$this->screen->id}", $views); |
|
331 | 331 | |
332 | - $this->screen->render_screen_reader_content( 'heading_views' ); |
|
332 | + $this->screen->render_screen_reader_content('heading_views'); |
|
333 | 333 | ?> |
334 | 334 | <div class="wp-filter"> |
335 | 335 | <ul class="filter-links"> |
336 | 336 | <?php |
337 | - if ( ! empty( $views ) ) { |
|
338 | - foreach ( $views as $class => $view ) { |
|
339 | - $views[ $class ] = "\t<li class='$class'>$view"; |
|
337 | + if (!empty($views)) { |
|
338 | + foreach ($views as $class => $view) { |
|
339 | + $views[$class] = "\t<li class='$class'>$view"; |
|
340 | 340 | } |
341 | - echo implode( " </li>\n", $views ) . "</li>\n"; |
|
341 | + echo implode(" </li>\n", $views) . "</li>\n"; |
|
342 | 342 | } |
343 | 343 | ?> |
344 | 344 | </ul> |
@@ -360,23 +360,23 @@ discard block |
||
360 | 360 | |
361 | 361 | $data_attr = ''; |
362 | 362 | |
363 | - if ( $singular ) { |
|
363 | + if ($singular) { |
|
364 | 364 | $data_attr = " data-wp-lists='list:$singular'"; |
365 | 365 | } |
366 | 366 | |
367 | - $this->display_tablenav( 'top' ); |
|
367 | + $this->display_tablenav('top'); |
|
368 | 368 | |
369 | 369 | ?> |
370 | -<div class="wp-list-table <?php echo implode( ' ', $this->get_table_classes() ); ?>"> |
|
370 | +<div class="wp-list-table <?php echo implode(' ', $this->get_table_classes()); ?>"> |
|
371 | 371 | <?php |
372 | - $this->screen->render_screen_reader_content( 'heading_list' ); |
|
372 | + $this->screen->render_screen_reader_content('heading_list'); |
|
373 | 373 | ?> |
374 | 374 | <div id="the-list"<?php echo $data_attr; ?>> |
375 | 375 | <?php $this->display_rows_or_placeholder(); ?> |
376 | 376 | </div> |
377 | 377 | </div> |
378 | 378 | <?php |
379 | - $this->display_tablenav( 'bottom' ); |
|
379 | + $this->display_tablenav('bottom'); |
|
380 | 380 | } |
381 | 381 | |
382 | 382 | /** |
@@ -384,12 +384,12 @@ discard block |
||
384 | 384 | * |
385 | 385 | * @param string $which |
386 | 386 | */ |
387 | - protected function display_tablenav( $which ) { |
|
388 | - if ( 'featured' === $GLOBALS['tab'] ) { |
|
387 | + protected function display_tablenav($which) { |
|
388 | + if ('featured' === $GLOBALS['tab']) { |
|
389 | 389 | return; |
390 | 390 | } |
391 | 391 | |
392 | - if ( 'top' === $which ) { |
|
392 | + if ('top' === $which) { |
|
393 | 393 | wp_referer_field(); |
394 | 394 | ?> |
395 | 395 | <div class="tablenav top"> |
@@ -400,15 +400,15 @@ discard block |
||
400 | 400 | * |
401 | 401 | * @since 2.7.0 |
402 | 402 | */ |
403 | - do_action( 'install_plugins_table_header' ); |
|
403 | + do_action('install_plugins_table_header'); |
|
404 | 404 | ?> |
405 | 405 | </div> |
406 | - <?php $this->pagination( $which ); ?> |
|
406 | + <?php $this->pagination($which); ?> |
|
407 | 407 | <br class="clear" /> |
408 | 408 | </div> |
409 | 409 | <?php } else { ?> |
410 | 410 | <div class="tablenav bottom"> |
411 | - <?php $this->pagination( $which ); ?> |
|
411 | + <?php $this->pagination($which); ?> |
|
412 | 412 | <br class="clear" /> |
413 | 413 | </div> |
414 | 414 | <?php |
@@ -419,7 +419,7 @@ discard block |
||
419 | 419 | * @return array |
420 | 420 | */ |
421 | 421 | protected function get_table_classes() { |
422 | - return array( 'widefat', $this->_args['plural'] ); |
|
422 | + return array('widefat', $this->_args['plural']); |
|
423 | 423 | } |
424 | 424 | |
425 | 425 | /** |
@@ -434,23 +434,23 @@ discard block |
||
434 | 434 | * @param object $plugin_b |
435 | 435 | * @return int |
436 | 436 | */ |
437 | - private function order_callback( $plugin_a, $plugin_b ) { |
|
437 | + private function order_callback($plugin_a, $plugin_b) { |
|
438 | 438 | $orderby = $this->orderby; |
439 | - if ( ! isset( $plugin_a->$orderby, $plugin_b->$orderby ) ) { |
|
439 | + if (!isset($plugin_a->$orderby, $plugin_b->$orderby)) { |
|
440 | 440 | return 0; |
441 | 441 | } |
442 | 442 | |
443 | 443 | $a = $plugin_a->$orderby; |
444 | 444 | $b = $plugin_b->$orderby; |
445 | 445 | |
446 | - if ( $a === $b ) { |
|
446 | + if ($a === $b) { |
|
447 | 447 | return 0; |
448 | 448 | } |
449 | 449 | |
450 | - if ( 'DESC' === $this->order ) { |
|
451 | - return ( $a < $b ) ? 1 : -1; |
|
450 | + if ('DESC' === $this->order) { |
|
451 | + return ($a < $b) ? 1 : -1; |
|
452 | 452 | } else { |
453 | - return ( $a < $b ) ? -1 : 1; |
|
453 | + return ($a < $b) ? -1 : 1; |
|
454 | 454 | } |
455 | 455 | } |
456 | 456 | |
@@ -461,8 +461,8 @@ discard block |
||
461 | 461 | 'title' => array(), |
462 | 462 | 'target' => array(), |
463 | 463 | ), |
464 | - 'abbr' => array( 'title' => array() ), |
|
465 | - 'acronym' => array( 'title' => array() ), |
|
464 | + 'abbr' => array('title' => array()), |
|
465 | + 'acronym' => array('title' => array()), |
|
466 | 466 | 'code' => array(), |
467 | 467 | 'pre' => array(), |
468 | 468 | 'em' => array(), |
@@ -475,45 +475,45 @@ discard block |
||
475 | 475 | ); |
476 | 476 | |
477 | 477 | $plugins_group_titles = array( |
478 | - 'Performance' => _x( 'Performance', 'Plugin installer group title' ), |
|
479 | - 'Social' => _x( 'Social', 'Plugin installer group title' ), |
|
480 | - 'Tools' => _x( 'Tools', 'Plugin installer group title' ), |
|
478 | + 'Performance' => _x('Performance', 'Plugin installer group title'), |
|
479 | + 'Social' => _x('Social', 'Plugin installer group title'), |
|
480 | + 'Tools' => _x('Tools', 'Plugin installer group title'), |
|
481 | 481 | ); |
482 | 482 | |
483 | 483 | $group = null; |
484 | 484 | |
485 | - foreach ( (array) $this->items as $plugin ) { |
|
486 | - if ( is_object( $plugin ) ) { |
|
485 | + foreach ((array) $this->items as $plugin) { |
|
486 | + if (is_object($plugin)) { |
|
487 | 487 | $plugin = (array) $plugin; |
488 | 488 | } |
489 | 489 | |
490 | 490 | // Display the group heading if there is one. |
491 | - if ( isset( $plugin['group'] ) && $plugin['group'] !== $group ) { |
|
492 | - if ( isset( $this->groups[ $plugin['group'] ] ) ) { |
|
493 | - $group_name = $this->groups[ $plugin['group'] ]; |
|
494 | - if ( isset( $plugins_group_titles[ $group_name ] ) ) { |
|
495 | - $group_name = $plugins_group_titles[ $group_name ]; |
|
491 | + if (isset($plugin['group']) && $plugin['group'] !== $group) { |
|
492 | + if (isset($this->groups[$plugin['group']])) { |
|
493 | + $group_name = $this->groups[$plugin['group']]; |
|
494 | + if (isset($plugins_group_titles[$group_name])) { |
|
495 | + $group_name = $plugins_group_titles[$group_name]; |
|
496 | 496 | } |
497 | 497 | } else { |
498 | 498 | $group_name = $plugin['group']; |
499 | 499 | } |
500 | 500 | |
501 | 501 | // Starting a new group, close off the divs of the last one. |
502 | - if ( ! empty( $group ) ) { |
|
502 | + if (!empty($group)) { |
|
503 | 503 | echo '</div></div>'; |
504 | 504 | } |
505 | 505 | |
506 | - echo '<div class="plugin-group"><h3>' . esc_html( $group_name ) . '</h3>'; |
|
506 | + echo '<div class="plugin-group"><h3>' . esc_html($group_name) . '</h3>'; |
|
507 | 507 | // Needs an extra wrapping div for nth-child selectors to work. |
508 | 508 | echo '<div class="plugin-items">'; |
509 | 509 | |
510 | 510 | $group = $plugin['group']; |
511 | 511 | } |
512 | 512 | |
513 | - $title = wp_kses( $plugin['name'], $plugins_allowedtags ); |
|
513 | + $title = wp_kses($plugin['name'], $plugins_allowedtags); |
|
514 | 514 | |
515 | 515 | // Remove any HTML from the description. |
516 | - $description = strip_tags( $plugin['short_description'] ); |
|
516 | + $description = strip_tags($plugin['short_description']); |
|
517 | 517 | |
518 | 518 | /** |
519 | 519 | * Filters the plugin card description on the Add Plugins screen. |
@@ -524,69 +524,69 @@ discard block |
||
524 | 524 | * @param array $plugin An array of plugin data. See {@see plugins_api()} |
525 | 525 | * for the list of possible values. |
526 | 526 | */ |
527 | - $description = apply_filters( 'plugin_install_description', $description, $plugin ); |
|
527 | + $description = apply_filters('plugin_install_description', $description, $plugin); |
|
528 | 528 | |
529 | - $version = wp_kses( $plugin['version'], $plugins_allowedtags ); |
|
529 | + $version = wp_kses($plugin['version'], $plugins_allowedtags); |
|
530 | 530 | |
531 | - $name = strip_tags( $title . ' ' . $version ); |
|
531 | + $name = strip_tags($title . ' ' . $version); |
|
532 | 532 | |
533 | - $author = wp_kses( $plugin['author'], $plugins_allowedtags ); |
|
534 | - if ( ! empty( $author ) ) { |
|
533 | + $author = wp_kses($plugin['author'], $plugins_allowedtags); |
|
534 | + if (!empty($author)) { |
|
535 | 535 | /* translators: %s: Plugin author. */ |
536 | - $author = ' <cite>' . sprintf( __( 'By %s' ), $author ) . '</cite>'; |
|
536 | + $author = ' <cite>' . sprintf(__('By %s'), $author) . '</cite>'; |
|
537 | 537 | } |
538 | 538 | |
539 | - $requires_php = isset( $plugin['requires_php'] ) ? $plugin['requires_php'] : null; |
|
540 | - $requires_wp = isset( $plugin['requires'] ) ? $plugin['requires'] : null; |
|
539 | + $requires_php = isset($plugin['requires_php']) ? $plugin['requires_php'] : null; |
|
540 | + $requires_wp = isset($plugin['requires']) ? $plugin['requires'] : null; |
|
541 | 541 | |
542 | - $compatible_php = is_php_version_compatible( $requires_php ); |
|
543 | - $compatible_wp = is_wp_version_compatible( $requires_wp ); |
|
544 | - $tested_wp = ( empty( $plugin['tested'] ) || version_compare( get_bloginfo( 'version' ), $plugin['tested'], '<=' ) ); |
|
542 | + $compatible_php = is_php_version_compatible($requires_php); |
|
543 | + $compatible_wp = is_wp_version_compatible($requires_wp); |
|
544 | + $tested_wp = (empty($plugin['tested']) || version_compare(get_bloginfo('version'), $plugin['tested'], '<=')); |
|
545 | 545 | |
546 | 546 | $action_links = array(); |
547 | 547 | |
548 | - if ( current_user_can( 'install_plugins' ) || current_user_can( 'update_plugins' ) ) { |
|
549 | - $status = install_plugin_install_status( $plugin ); |
|
548 | + if (current_user_can('install_plugins') || current_user_can('update_plugins')) { |
|
549 | + $status = install_plugin_install_status($plugin); |
|
550 | 550 | |
551 | - switch ( $status['status'] ) { |
|
551 | + switch ($status['status']) { |
|
552 | 552 | case 'install': |
553 | - if ( $status['url'] ) { |
|
554 | - if ( $compatible_php && $compatible_wp ) { |
|
553 | + if ($status['url']) { |
|
554 | + if ($compatible_php && $compatible_wp) { |
|
555 | 555 | $action_links[] = sprintf( |
556 | 556 | '<a class="install-now button" data-slug="%s" href="%s" aria-label="%s" data-name="%s">%s</a>', |
557 | - esc_attr( $plugin['slug'] ), |
|
558 | - esc_url( $status['url'] ), |
|
557 | + esc_attr($plugin['slug']), |
|
558 | + esc_url($status['url']), |
|
559 | 559 | /* translators: %s: Plugin name and version. */ |
560 | - esc_attr( sprintf( _x( 'Install %s now', 'plugin' ), $name ) ), |
|
561 | - esc_attr( $name ), |
|
562 | - __( 'Install Now' ) |
|
560 | + esc_attr(sprintf(_x('Install %s now', 'plugin'), $name)), |
|
561 | + esc_attr($name), |
|
562 | + __('Install Now') |
|
563 | 563 | ); |
564 | 564 | } else { |
565 | 565 | $action_links[] = sprintf( |
566 | 566 | '<button type="button" class="button button-disabled" disabled="disabled">%s</button>', |
567 | - _x( 'Cannot Install', 'plugin' ) |
|
567 | + _x('Cannot Install', 'plugin') |
|
568 | 568 | ); |
569 | 569 | } |
570 | 570 | } |
571 | 571 | break; |
572 | 572 | |
573 | 573 | case 'update_available': |
574 | - if ( $status['url'] ) { |
|
575 | - if ( $compatible_php && $compatible_wp ) { |
|
574 | + if ($status['url']) { |
|
575 | + if ($compatible_php && $compatible_wp) { |
|
576 | 576 | $action_links[] = sprintf( |
577 | 577 | '<a class="update-now button aria-button-if-js" data-plugin="%s" data-slug="%s" href="%s" aria-label="%s" data-name="%s">%s</a>', |
578 | - esc_attr( $status['file'] ), |
|
579 | - esc_attr( $plugin['slug'] ), |
|
580 | - esc_url( $status['url'] ), |
|
578 | + esc_attr($status['file']), |
|
579 | + esc_attr($plugin['slug']), |
|
580 | + esc_url($status['url']), |
|
581 | 581 | /* translators: %s: Plugin name and version. */ |
582 | - esc_attr( sprintf( _x( 'Update %s now', 'plugin' ), $name ) ), |
|
583 | - esc_attr( $name ), |
|
584 | - __( 'Update Now' ) |
|
582 | + esc_attr(sprintf(_x('Update %s now', 'plugin'), $name)), |
|
583 | + esc_attr($name), |
|
584 | + __('Update Now') |
|
585 | 585 | ); |
586 | 586 | } else { |
587 | 587 | $action_links[] = sprintf( |
588 | 588 | '<button type="button" class="button button-disabled" disabled="disabled">%s</button>', |
589 | - _x( 'Cannot Update', 'plugin' ) |
|
589 | + _x('Cannot Update', 'plugin') |
|
590 | 590 | ); |
591 | 591 | } |
592 | 592 | } |
@@ -594,48 +594,48 @@ discard block |
||
594 | 594 | |
595 | 595 | case 'latest_installed': |
596 | 596 | case 'newer_installed': |
597 | - if ( is_plugin_active( $status['file'] ) ) { |
|
597 | + if (is_plugin_active($status['file'])) { |
|
598 | 598 | $action_links[] = sprintf( |
599 | 599 | '<button type="button" class="button button-disabled" disabled="disabled">%s</button>', |
600 | - _x( 'Active', 'plugin' ) |
|
600 | + _x('Active', 'plugin') |
|
601 | 601 | ); |
602 | - } elseif ( current_user_can( 'activate_plugin', $status['file'] ) ) { |
|
603 | - if ( $compatible_php && $compatible_wp ) { |
|
604 | - $button_text = __( 'Activate' ); |
|
602 | + } elseif (current_user_can('activate_plugin', $status['file'])) { |
|
603 | + if ($compatible_php && $compatible_wp) { |
|
604 | + $button_text = __('Activate'); |
|
605 | 605 | /* translators: %s: Plugin name. */ |
606 | - $button_label = _x( 'Activate %s', 'plugin' ); |
|
606 | + $button_label = _x('Activate %s', 'plugin'); |
|
607 | 607 | $activate_url = add_query_arg( |
608 | 608 | array( |
609 | - '_wpnonce' => wp_create_nonce( 'activate-plugin_' . $status['file'] ), |
|
609 | + '_wpnonce' => wp_create_nonce('activate-plugin_' . $status['file']), |
|
610 | 610 | 'action' => 'activate', |
611 | 611 | 'plugin' => $status['file'], |
612 | 612 | ), |
613 | - network_admin_url( 'plugins.php' ) |
|
613 | + network_admin_url('plugins.php') |
|
614 | 614 | ); |
615 | 615 | |
616 | - if ( is_network_admin() ) { |
|
617 | - $button_text = __( 'Network Activate' ); |
|
616 | + if (is_network_admin()) { |
|
617 | + $button_text = __('Network Activate'); |
|
618 | 618 | /* translators: %s: Plugin name. */ |
619 | - $button_label = _x( 'Network Activate %s', 'plugin' ); |
|
620 | - $activate_url = add_query_arg( array( 'networkwide' => 1 ), $activate_url ); |
|
619 | + $button_label = _x('Network Activate %s', 'plugin'); |
|
620 | + $activate_url = add_query_arg(array('networkwide' => 1), $activate_url); |
|
621 | 621 | } |
622 | 622 | |
623 | 623 | $action_links[] = sprintf( |
624 | 624 | '<a href="%1$s" class="button activate-now" aria-label="%2$s">%3$s</a>', |
625 | - esc_url( $activate_url ), |
|
626 | - esc_attr( sprintf( $button_label, $plugin['name'] ) ), |
|
625 | + esc_url($activate_url), |
|
626 | + esc_attr(sprintf($button_label, $plugin['name'])), |
|
627 | 627 | $button_text |
628 | 628 | ); |
629 | 629 | } else { |
630 | 630 | $action_links[] = sprintf( |
631 | 631 | '<button type="button" class="button button-disabled" disabled="disabled">%s</button>', |
632 | - _x( 'Cannot Activate', 'plugin' ) |
|
632 | + _x('Cannot Activate', 'plugin') |
|
633 | 633 | ); |
634 | 634 | } |
635 | 635 | } else { |
636 | 636 | $action_links[] = sprintf( |
637 | 637 | '<button type="button" class="button button-disabled" disabled="disabled">%s</button>', |
638 | - _x( 'Installed', 'plugin' ) |
|
638 | + _x('Installed', 'plugin') |
|
639 | 639 | ); |
640 | 640 | } |
641 | 641 | break; |
@@ -649,18 +649,18 @@ discard block |
||
649 | 649 | |
650 | 650 | $action_links[] = sprintf( |
651 | 651 | '<a href="%s" class="thickbox open-plugin-details-modal" aria-label="%s" data-title="%s">%s</a>', |
652 | - esc_url( $details_link ), |
|
652 | + esc_url($details_link), |
|
653 | 653 | /* translators: %s: Plugin name and version. */ |
654 | - esc_attr( sprintf( __( 'More information about %s' ), $name ) ), |
|
655 | - esc_attr( $name ), |
|
656 | - __( 'More Details' ) |
|
654 | + esc_attr(sprintf(__('More information about %s'), $name)), |
|
655 | + esc_attr($name), |
|
656 | + __('More Details') |
|
657 | 657 | ); |
658 | 658 | |
659 | - if ( ! empty( $plugin['icons']['svg'] ) ) { |
|
659 | + if (!empty($plugin['icons']['svg'])) { |
|
660 | 660 | $plugin_icon_url = $plugin['icons']['svg']; |
661 | - } elseif ( ! empty( $plugin['icons']['2x'] ) ) { |
|
661 | + } elseif (!empty($plugin['icons']['2x'])) { |
|
662 | 662 | $plugin_icon_url = $plugin['icons']['2x']; |
663 | - } elseif ( ! empty( $plugin['icons']['1x'] ) ) { |
|
663 | + } elseif (!empty($plugin['icons']['1x'])) { |
|
664 | 664 | $plugin_icon_url = $plugin['icons']['1x']; |
665 | 665 | } else { |
666 | 666 | $plugin_icon_url = $plugin['icons']['default']; |
@@ -676,56 +676,56 @@ discard block |
||
676 | 676 | * @param array $plugin An array of plugin data. See {@see plugins_api()} |
677 | 677 | * for the list of possible values. |
678 | 678 | */ |
679 | - $action_links = apply_filters( 'plugin_install_action_links', $action_links, $plugin ); |
|
679 | + $action_links = apply_filters('plugin_install_action_links', $action_links, $plugin); |
|
680 | 680 | |
681 | - $last_updated_timestamp = strtotime( $plugin['last_updated'] ); |
|
681 | + $last_updated_timestamp = strtotime($plugin['last_updated']); |
|
682 | 682 | ?> |
683 | - <div class="plugin-card plugin-card-<?php echo sanitize_html_class( $plugin['slug'] ); ?>"> |
|
683 | + <div class="plugin-card plugin-card-<?php echo sanitize_html_class($plugin['slug']); ?>"> |
|
684 | 684 | <?php |
685 | - if ( ! $compatible_php || ! $compatible_wp ) { |
|
685 | + if (!$compatible_php || !$compatible_wp) { |
|
686 | 686 | echo '<div class="notice inline notice-error notice-alt"><p>'; |
687 | - if ( ! $compatible_php && ! $compatible_wp ) { |
|
688 | - _e( 'This plugin does not work with your versions of WordPress and PHP.' ); |
|
689 | - if ( current_user_can( 'update_core' ) && current_user_can( 'update_php' ) ) { |
|
687 | + if (!$compatible_php && !$compatible_wp) { |
|
688 | + _e('This plugin does not work with your versions of WordPress and PHP.'); |
|
689 | + if (current_user_can('update_core') && current_user_can('update_php')) { |
|
690 | 690 | printf( |
691 | 691 | /* translators: 1: URL to WordPress Updates screen, 2: URL to Update PHP page. */ |
692 | - ' ' . __( '<a href="%1$s">Please update WordPress</a>, and then <a href="%2$s">learn more about updating PHP</a>.' ), |
|
693 | - self_admin_url( 'update-core.php' ), |
|
694 | - esc_url( wp_get_update_php_url() ) |
|
692 | + ' ' . __('<a href="%1$s">Please update WordPress</a>, and then <a href="%2$s">learn more about updating PHP</a>.'), |
|
693 | + self_admin_url('update-core.php'), |
|
694 | + esc_url(wp_get_update_php_url()) |
|
695 | 695 | ); |
696 | - wp_update_php_annotation( '</p><p><em>', '</em>' ); |
|
697 | - } elseif ( current_user_can( 'update_core' ) ) { |
|
696 | + wp_update_php_annotation('</p><p><em>', '</em>'); |
|
697 | + } elseif (current_user_can('update_core')) { |
|
698 | 698 | printf( |
699 | 699 | /* translators: %s: URL to WordPress Updates screen. */ |
700 | - ' ' . __( '<a href="%s">Please update WordPress</a>.' ), |
|
701 | - self_admin_url( 'update-core.php' ) |
|
700 | + ' ' . __('<a href="%s">Please update WordPress</a>.'), |
|
701 | + self_admin_url('update-core.php') |
|
702 | 702 | ); |
703 | - } elseif ( current_user_can( 'update_php' ) ) { |
|
703 | + } elseif (current_user_can('update_php')) { |
|
704 | 704 | printf( |
705 | 705 | /* translators: %s: URL to Update PHP page. */ |
706 | - ' ' . __( '<a href="%s">Learn more about updating PHP</a>.' ), |
|
707 | - esc_url( wp_get_update_php_url() ) |
|
706 | + ' ' . __('<a href="%s">Learn more about updating PHP</a>.'), |
|
707 | + esc_url(wp_get_update_php_url()) |
|
708 | 708 | ); |
709 | - wp_update_php_annotation( '</p><p><em>', '</em>' ); |
|
709 | + wp_update_php_annotation('</p><p><em>', '</em>'); |
|
710 | 710 | } |
711 | - } elseif ( ! $compatible_wp ) { |
|
712 | - _e( 'This plugin does not work with your version of WordPress.' ); |
|
713 | - if ( current_user_can( 'update_core' ) ) { |
|
711 | + } elseif (!$compatible_wp) { |
|
712 | + _e('This plugin does not work with your version of WordPress.'); |
|
713 | + if (current_user_can('update_core')) { |
|
714 | 714 | printf( |
715 | 715 | /* translators: %s: URL to WordPress Updates screen. */ |
716 | - ' ' . __( '<a href="%s">Please update WordPress</a>.' ), |
|
717 | - self_admin_url( 'update-core.php' ) |
|
716 | + ' ' . __('<a href="%s">Please update WordPress</a>.'), |
|
717 | + self_admin_url('update-core.php') |
|
718 | 718 | ); |
719 | 719 | } |
720 | - } elseif ( ! $compatible_php ) { |
|
721 | - _e( 'This plugin does not work with your version of PHP.' ); |
|
722 | - if ( current_user_can( 'update_php' ) ) { |
|
720 | + } elseif (!$compatible_php) { |
|
721 | + _e('This plugin does not work with your version of PHP.'); |
|
722 | + if (current_user_can('update_php')) { |
|
723 | 723 | printf( |
724 | 724 | /* translators: %s: URL to Update PHP page. */ |
725 | - ' ' . __( '<a href="%s">Learn more about updating PHP</a>.' ), |
|
726 | - esc_url( wp_get_update_php_url() ) |
|
725 | + ' ' . __('<a href="%s">Learn more about updating PHP</a>.'), |
|
726 | + esc_url(wp_get_update_php_url()) |
|
727 | 727 | ); |
728 | - wp_update_php_annotation( '</p><p><em>', '</em>' ); |
|
728 | + wp_update_php_annotation('</p><p><em>', '</em>'); |
|
729 | 729 | } |
730 | 730 | } |
731 | 731 | echo '</p></div>'; |
@@ -734,16 +734,16 @@ discard block |
||
734 | 734 | <div class="plugin-card-top"> |
735 | 735 | <div class="name column-name"> |
736 | 736 | <h3> |
737 | - <a href="<?php echo esc_url( $details_link ); ?>" class="thickbox open-plugin-details-modal"> |
|
737 | + <a href="<?php echo esc_url($details_link); ?>" class="thickbox open-plugin-details-modal"> |
|
738 | 738 | <?php echo $title; ?> |
739 | - <img src="<?php echo esc_url( $plugin_icon_url ); ?>" class="plugin-icon" alt="" /> |
|
739 | + <img src="<?php echo esc_url($plugin_icon_url); ?>" class="plugin-icon" alt="" /> |
|
740 | 740 | </a> |
741 | 741 | </h3> |
742 | 742 | </div> |
743 | 743 | <div class="action-links"> |
744 | 744 | <?php |
745 | - if ( $action_links ) { |
|
746 | - echo '<ul class="plugin-action-buttons"><li>' . implode( '</li><li>', $action_links ) . '</li></ul>'; |
|
745 | + if ($action_links) { |
|
746 | + echo '<ul class="plugin-action-buttons"><li>' . implode('</li><li>', $action_links) . '</li></ul>'; |
|
747 | 747 | } |
748 | 748 | ?> |
749 | 749 | </div> |
@@ -763,41 +763,41 @@ discard block |
||
763 | 763 | ) |
764 | 764 | ); |
765 | 765 | ?> |
766 | - <span class="num-ratings" aria-hidden="true">(<?php echo number_format_i18n( $plugin['num_ratings'] ); ?>)</span> |
|
766 | + <span class="num-ratings" aria-hidden="true">(<?php echo number_format_i18n($plugin['num_ratings']); ?>)</span> |
|
767 | 767 | </div> |
768 | 768 | <div class="column-updated"> |
769 | - <strong><?php _e( 'Last Updated:' ); ?></strong> |
|
769 | + <strong><?php _e('Last Updated:'); ?></strong> |
|
770 | 770 | <?php |
771 | 771 | /* translators: %s: Human-readable time difference. */ |
772 | - printf( __( '%s ago' ), human_time_diff( $last_updated_timestamp ) ); |
|
772 | + printf(__('%s ago'), human_time_diff($last_updated_timestamp)); |
|
773 | 773 | ?> |
774 | 774 | </div> |
775 | 775 | <div class="column-downloaded"> |
776 | 776 | <?php |
777 | - if ( $plugin['active_installs'] >= 1000000 ) { |
|
778 | - $active_installs_millions = floor( $plugin['active_installs'] / 1000000 ); |
|
777 | + if ($plugin['active_installs'] >= 1000000) { |
|
778 | + $active_installs_millions = floor($plugin['active_installs'] / 1000000); |
|
779 | 779 | $active_installs_text = sprintf( |
780 | 780 | /* translators: %s: Number of millions. */ |
781 | - _nx( '%s+ Million', '%s+ Million', $active_installs_millions, 'Active plugin installations' ), |
|
782 | - number_format_i18n( $active_installs_millions ) |
|
781 | + _nx('%s+ Million', '%s+ Million', $active_installs_millions, 'Active plugin installations'), |
|
782 | + number_format_i18n($active_installs_millions) |
|
783 | 783 | ); |
784 | - } elseif ( 0 === $plugin['active_installs'] ) { |
|
785 | - $active_installs_text = _x( 'Less Than 10', 'Active plugin installations' ); |
|
784 | + } elseif (0 === $plugin['active_installs']) { |
|
785 | + $active_installs_text = _x('Less Than 10', 'Active plugin installations'); |
|
786 | 786 | } else { |
787 | - $active_installs_text = number_format_i18n( $plugin['active_installs'] ) . '+'; |
|
787 | + $active_installs_text = number_format_i18n($plugin['active_installs']) . '+'; |
|
788 | 788 | } |
789 | 789 | /* translators: %s: Number of installations. */ |
790 | - printf( __( '%s Active Installations' ), $active_installs_text ); |
|
790 | + printf(__('%s Active Installations'), $active_installs_text); |
|
791 | 791 | ?> |
792 | 792 | </div> |
793 | 793 | <div class="column-compatibility"> |
794 | 794 | <?php |
795 | - if ( ! $tested_wp ) { |
|
796 | - echo '<span class="compatibility-untested">' . __( 'Untested with your version of WordPress' ) . '</span>'; |
|
797 | - } elseif ( ! $compatible_wp ) { |
|
798 | - echo '<span class="compatibility-incompatible">' . __( '<strong>Incompatible</strong> with your version of WordPress' ) . '</span>'; |
|
795 | + if (!$tested_wp) { |
|
796 | + echo '<span class="compatibility-untested">' . __('Untested with your version of WordPress') . '</span>'; |
|
797 | + } elseif (!$compatible_wp) { |
|
798 | + echo '<span class="compatibility-incompatible">' . __('<strong>Incompatible</strong> with your version of WordPress') . '</span>'; |
|
799 | 799 | } else { |
800 | - echo '<span class="compatibility-compatible">' . __( '<strong>Compatible</strong> with your version of WordPress' ) . '</span>'; |
|
800 | + echo '<span class="compatibility-compatible">' . __('<strong>Compatible</strong> with your version of WordPress') . '</span>'; |
|
801 | 801 | } |
802 | 802 | ?> |
803 | 803 | </div> |
@@ -807,7 +807,7 @@ discard block |
||
807 | 807 | } |
808 | 808 | |
809 | 809 | // Close off the group divs of the last one. |
810 | - if ( ! empty( $group ) ) { |
|
810 | + if (!empty($group)) { |
|
811 | 811 | echo '</div></div>'; |
812 | 812 | } |
813 | 813 | } |
@@ -37,22 +37,22 @@ discard block |
||
37 | 37 | |
38 | 38 | // Save few function calls. |
39 | 39 | $upload_dir = wp_upload_dir(); |
40 | - $permalink_structure = get_option( 'permalink_structure' ); |
|
40 | + $permalink_structure = get_option('permalink_structure'); |
|
41 | 41 | $is_ssl = is_ssl(); |
42 | 42 | $is_multisite = is_multisite(); |
43 | - $users_can_register = get_option( 'users_can_register' ); |
|
44 | - $blog_public = get_option( 'blog_public' ); |
|
45 | - $default_comment_status = get_option( 'default_comment_status' ); |
|
43 | + $users_can_register = get_option('users_can_register'); |
|
44 | + $blog_public = get_option('blog_public'); |
|
45 | + $default_comment_status = get_option('default_comment_status'); |
|
46 | 46 | $environment_type = wp_get_environment_type(); |
47 | - $core_version = get_bloginfo( 'version' ); |
|
47 | + $core_version = get_bloginfo('version'); |
|
48 | 48 | $core_updates = get_core_updates(); |
49 | 49 | $core_update_needed = ''; |
50 | 50 | |
51 | - if ( is_array( $core_updates ) ) { |
|
52 | - foreach ( $core_updates as $core => $update ) { |
|
53 | - if ( 'upgrade' === $update->response ) { |
|
51 | + if (is_array($core_updates)) { |
|
52 | + foreach ($core_updates as $core => $update) { |
|
53 | + if ('upgrade' === $update->response) { |
|
54 | 54 | /* translators: %s: Latest WordPress version number. */ |
55 | - $core_update_needed = ' ' . sprintf( __( '(Latest version: %s)' ), $update->version ); |
|
55 | + $core_update_needed = ' ' . sprintf(__('(Latest version: %s)'), $update->version); |
|
56 | 56 | } else { |
57 | 57 | $core_update_needed = ''; |
58 | 58 | } |
@@ -63,187 +63,187 @@ discard block |
||
63 | 63 | $info = array(); |
64 | 64 | |
65 | 65 | $info['wp-core'] = array( |
66 | - 'label' => __( 'WordPress' ), |
|
66 | + 'label' => __('WordPress'), |
|
67 | 67 | 'fields' => array( |
68 | 68 | 'version' => array( |
69 | - 'label' => __( 'Version' ), |
|
69 | + 'label' => __('Version'), |
|
70 | 70 | 'value' => $core_version . $core_update_needed, |
71 | 71 | 'debug' => $core_version, |
72 | 72 | ), |
73 | 73 | 'site_language' => array( |
74 | - 'label' => __( 'Site Language' ), |
|
74 | + 'label' => __('Site Language'), |
|
75 | 75 | 'value' => get_locale(), |
76 | 76 | ), |
77 | 77 | 'user_language' => array( |
78 | - 'label' => __( 'User Language' ), |
|
78 | + 'label' => __('User Language'), |
|
79 | 79 | 'value' => get_user_locale(), |
80 | 80 | ), |
81 | 81 | 'timezone' => array( |
82 | - 'label' => __( 'Timezone' ), |
|
82 | + 'label' => __('Timezone'), |
|
83 | 83 | 'value' => wp_timezone_string(), |
84 | 84 | ), |
85 | 85 | 'home_url' => array( |
86 | - 'label' => __( 'Home URL' ), |
|
87 | - 'value' => get_bloginfo( 'url' ), |
|
86 | + 'label' => __('Home URL'), |
|
87 | + 'value' => get_bloginfo('url'), |
|
88 | 88 | 'private' => true, |
89 | 89 | ), |
90 | 90 | 'site_url' => array( |
91 | - 'label' => __( 'Site URL' ), |
|
92 | - 'value' => get_bloginfo( 'wpurl' ), |
|
91 | + 'label' => __('Site URL'), |
|
92 | + 'value' => get_bloginfo('wpurl'), |
|
93 | 93 | 'private' => true, |
94 | 94 | ), |
95 | 95 | 'permalink' => array( |
96 | - 'label' => __( 'Permalink structure' ), |
|
97 | - 'value' => $permalink_structure ? $permalink_structure : __( 'No permalink structure set' ), |
|
96 | + 'label' => __('Permalink structure'), |
|
97 | + 'value' => $permalink_structure ? $permalink_structure : __('No permalink structure set'), |
|
98 | 98 | 'debug' => $permalink_structure, |
99 | 99 | ), |
100 | 100 | 'https_status' => array( |
101 | - 'label' => __( 'Is this site using HTTPS?' ), |
|
102 | - 'value' => $is_ssl ? __( 'Yes' ) : __( 'No' ), |
|
101 | + 'label' => __('Is this site using HTTPS?'), |
|
102 | + 'value' => $is_ssl ? __('Yes') : __('No'), |
|
103 | 103 | 'debug' => $is_ssl, |
104 | 104 | ), |
105 | 105 | 'multisite' => array( |
106 | - 'label' => __( 'Is this a multisite?' ), |
|
107 | - 'value' => $is_multisite ? __( 'Yes' ) : __( 'No' ), |
|
106 | + 'label' => __('Is this a multisite?'), |
|
107 | + 'value' => $is_multisite ? __('Yes') : __('No'), |
|
108 | 108 | 'debug' => $is_multisite, |
109 | 109 | ), |
110 | 110 | 'user_registration' => array( |
111 | - 'label' => __( 'Can anyone register on this site?' ), |
|
112 | - 'value' => $users_can_register ? __( 'Yes' ) : __( 'No' ), |
|
111 | + 'label' => __('Can anyone register on this site?'), |
|
112 | + 'value' => $users_can_register ? __('Yes') : __('No'), |
|
113 | 113 | 'debug' => $users_can_register, |
114 | 114 | ), |
115 | 115 | 'blog_public' => array( |
116 | - 'label' => __( 'Is this site discouraging search engines?' ), |
|
117 | - 'value' => $blog_public ? __( 'No' ) : __( 'Yes' ), |
|
116 | + 'label' => __('Is this site discouraging search engines?'), |
|
117 | + 'value' => $blog_public ? __('No') : __('Yes'), |
|
118 | 118 | 'debug' => $blog_public, |
119 | 119 | ), |
120 | 120 | 'default_comment_status' => array( |
121 | - 'label' => __( 'Default comment status' ), |
|
122 | - 'value' => 'open' === $default_comment_status ? _x( 'Open', 'comment status' ) : _x( 'Closed', 'comment status' ), |
|
121 | + 'label' => __('Default comment status'), |
|
122 | + 'value' => 'open' === $default_comment_status ? _x('Open', 'comment status') : _x('Closed', 'comment status'), |
|
123 | 123 | 'debug' => $default_comment_status, |
124 | 124 | ), |
125 | 125 | 'environment_type' => array( |
126 | - 'label' => __( 'Environment type' ), |
|
126 | + 'label' => __('Environment type'), |
|
127 | 127 | 'value' => $environment_type, |
128 | 128 | 'debug' => $environment_type, |
129 | 129 | ), |
130 | 130 | ), |
131 | 131 | ); |
132 | 132 | |
133 | - if ( ! $is_multisite ) { |
|
133 | + if (!$is_multisite) { |
|
134 | 134 | $info['wp-paths-sizes'] = array( |
135 | - 'label' => __( 'Directories and Sizes' ), |
|
135 | + 'label' => __('Directories and Sizes'), |
|
136 | 136 | 'fields' => array(), |
137 | 137 | ); |
138 | 138 | } |
139 | 139 | |
140 | 140 | $info['wp-dropins'] = array( |
141 | - 'label' => __( 'Drop-ins' ), |
|
141 | + 'label' => __('Drop-ins'), |
|
142 | 142 | 'show_count' => true, |
143 | 143 | 'description' => sprintf( |
144 | 144 | /* translators: %s: wp-content directory name. */ |
145 | - __( 'Drop-ins are single files, found in the %s directory, that replace or enhance WordPress features in ways that are not possible for traditional plugins.' ), |
|
146 | - '<code>' . str_replace( ABSPATH, '', WP_CONTENT_DIR ) . '</code>' |
|
145 | + __('Drop-ins are single files, found in the %s directory, that replace or enhance WordPress features in ways that are not possible for traditional plugins.'), |
|
146 | + '<code>' . str_replace(ABSPATH, '', WP_CONTENT_DIR) . '</code>' |
|
147 | 147 | ), |
148 | 148 | 'fields' => array(), |
149 | 149 | ); |
150 | 150 | |
151 | 151 | $info['wp-active-theme'] = array( |
152 | - 'label' => __( 'Active Theme' ), |
|
152 | + 'label' => __('Active Theme'), |
|
153 | 153 | 'fields' => array(), |
154 | 154 | ); |
155 | 155 | |
156 | 156 | $info['wp-parent-theme'] = array( |
157 | - 'label' => __( 'Parent Theme' ), |
|
157 | + 'label' => __('Parent Theme'), |
|
158 | 158 | 'fields' => array(), |
159 | 159 | ); |
160 | 160 | |
161 | 161 | $info['wp-themes-inactive'] = array( |
162 | - 'label' => __( 'Inactive Themes' ), |
|
162 | + 'label' => __('Inactive Themes'), |
|
163 | 163 | 'show_count' => true, |
164 | 164 | 'fields' => array(), |
165 | 165 | ); |
166 | 166 | |
167 | 167 | $info['wp-mu-plugins'] = array( |
168 | - 'label' => __( 'Must Use Plugins' ), |
|
168 | + 'label' => __('Must Use Plugins'), |
|
169 | 169 | 'show_count' => true, |
170 | 170 | 'fields' => array(), |
171 | 171 | ); |
172 | 172 | |
173 | 173 | $info['wp-plugins-active'] = array( |
174 | - 'label' => __( 'Active Plugins' ), |
|
174 | + 'label' => __('Active Plugins'), |
|
175 | 175 | 'show_count' => true, |
176 | 176 | 'fields' => array(), |
177 | 177 | ); |
178 | 178 | |
179 | 179 | $info['wp-plugins-inactive'] = array( |
180 | - 'label' => __( 'Inactive Plugins' ), |
|
180 | + 'label' => __('Inactive Plugins'), |
|
181 | 181 | 'show_count' => true, |
182 | 182 | 'fields' => array(), |
183 | 183 | ); |
184 | 184 | |
185 | 185 | $info['wp-media'] = array( |
186 | - 'label' => __( 'Media Handling' ), |
|
186 | + 'label' => __('Media Handling'), |
|
187 | 187 | 'fields' => array(), |
188 | 188 | ); |
189 | 189 | |
190 | 190 | $info['wp-server'] = array( |
191 | - 'label' => __( 'Server' ), |
|
192 | - 'description' => __( 'The options shown below relate to your server setup. If changes are required, you may need your web host’s assistance.' ), |
|
191 | + 'label' => __('Server'), |
|
192 | + 'description' => __('The options shown below relate to your server setup. If changes are required, you may need your web host’s assistance.'), |
|
193 | 193 | 'fields' => array(), |
194 | 194 | ); |
195 | 195 | |
196 | 196 | $info['wp-database'] = array( |
197 | - 'label' => __( 'Database' ), |
|
197 | + 'label' => __('Database'), |
|
198 | 198 | 'fields' => array(), |
199 | 199 | ); |
200 | 200 | |
201 | 201 | // Check if WP_DEBUG_LOG is set. |
202 | - $wp_debug_log_value = __( 'Disabled' ); |
|
202 | + $wp_debug_log_value = __('Disabled'); |
|
203 | 203 | |
204 | - if ( is_string( WP_DEBUG_LOG ) ) { |
|
204 | + if (is_string(WP_DEBUG_LOG)) { |
|
205 | 205 | $wp_debug_log_value = WP_DEBUG_LOG; |
206 | - } elseif ( WP_DEBUG_LOG ) { |
|
207 | - $wp_debug_log_value = __( 'Enabled' ); |
|
206 | + } elseif (WP_DEBUG_LOG) { |
|
207 | + $wp_debug_log_value = __('Enabled'); |
|
208 | 208 | } |
209 | 209 | |
210 | 210 | // Check CONCATENATE_SCRIPTS. |
211 | - if ( defined( 'CONCATENATE_SCRIPTS' ) ) { |
|
212 | - $concatenate_scripts = CONCATENATE_SCRIPTS ? __( 'Enabled' ) : __( 'Disabled' ); |
|
211 | + if (defined('CONCATENATE_SCRIPTS')) { |
|
212 | + $concatenate_scripts = CONCATENATE_SCRIPTS ? __('Enabled') : __('Disabled'); |
|
213 | 213 | $concatenate_scripts_debug = CONCATENATE_SCRIPTS ? 'true' : 'false'; |
214 | 214 | } else { |
215 | - $concatenate_scripts = __( 'Undefined' ); |
|
215 | + $concatenate_scripts = __('Undefined'); |
|
216 | 216 | $concatenate_scripts_debug = 'undefined'; |
217 | 217 | } |
218 | 218 | |
219 | 219 | // Check COMPRESS_SCRIPTS. |
220 | - if ( defined( 'COMPRESS_SCRIPTS' ) ) { |
|
221 | - $compress_scripts = COMPRESS_SCRIPTS ? __( 'Enabled' ) : __( 'Disabled' ); |
|
220 | + if (defined('COMPRESS_SCRIPTS')) { |
|
221 | + $compress_scripts = COMPRESS_SCRIPTS ? __('Enabled') : __('Disabled'); |
|
222 | 222 | $compress_scripts_debug = COMPRESS_SCRIPTS ? 'true' : 'false'; |
223 | 223 | } else { |
224 | - $compress_scripts = __( 'Undefined' ); |
|
224 | + $compress_scripts = __('Undefined'); |
|
225 | 225 | $compress_scripts_debug = 'undefined'; |
226 | 226 | } |
227 | 227 | |
228 | 228 | // Check COMPRESS_CSS. |
229 | - if ( defined( 'COMPRESS_CSS' ) ) { |
|
230 | - $compress_css = COMPRESS_CSS ? __( 'Enabled' ) : __( 'Disabled' ); |
|
229 | + if (defined('COMPRESS_CSS')) { |
|
230 | + $compress_css = COMPRESS_CSS ? __('Enabled') : __('Disabled'); |
|
231 | 231 | $compress_css_debug = COMPRESS_CSS ? 'true' : 'false'; |
232 | 232 | } else { |
233 | - $compress_css = __( 'Undefined' ); |
|
233 | + $compress_css = __('Undefined'); |
|
234 | 234 | $compress_css_debug = 'undefined'; |
235 | 235 | } |
236 | 236 | |
237 | 237 | // Check WP_ENVIRONMENT_TYPE. |
238 | - if ( defined( 'WP_ENVIRONMENT_TYPE' ) ) { |
|
238 | + if (defined('WP_ENVIRONMENT_TYPE')) { |
|
239 | 239 | $wp_environment_type = WP_ENVIRONMENT_TYPE; |
240 | 240 | } else { |
241 | - $wp_environment_type = __( 'Undefined' ); |
|
241 | + $wp_environment_type = __('Undefined'); |
|
242 | 242 | } |
243 | 243 | |
244 | 244 | $info['wp-constants'] = array( |
245 | - 'label' => __( 'WordPress Constants' ), |
|
246 | - 'description' => __( 'These settings alter where and how parts of WordPress are loaded.' ), |
|
245 | + 'label' => __('WordPress Constants'), |
|
246 | + 'description' => __('These settings alter where and how parts of WordPress are loaded.'), |
|
247 | 247 | 'fields' => array( |
248 | 248 | 'ABSPATH' => array( |
249 | 249 | 'label' => 'ABSPATH', |
@@ -252,13 +252,13 @@ discard block |
||
252 | 252 | ), |
253 | 253 | 'WP_HOME' => array( |
254 | 254 | 'label' => 'WP_HOME', |
255 | - 'value' => ( defined( 'WP_HOME' ) ? WP_HOME : __( 'Undefined' ) ), |
|
256 | - 'debug' => ( defined( 'WP_HOME' ) ? WP_HOME : 'undefined' ), |
|
255 | + 'value' => (defined('WP_HOME') ? WP_HOME : __('Undefined')), |
|
256 | + 'debug' => (defined('WP_HOME') ? WP_HOME : 'undefined'), |
|
257 | 257 | ), |
258 | 258 | 'WP_SITEURL' => array( |
259 | 259 | 'label' => 'WP_SITEURL', |
260 | - 'value' => ( defined( 'WP_SITEURL' ) ? WP_SITEURL : __( 'Undefined' ) ), |
|
261 | - 'debug' => ( defined( 'WP_SITEURL' ) ? WP_SITEURL : 'undefined' ), |
|
260 | + 'value' => (defined('WP_SITEURL') ? WP_SITEURL : __('Undefined')), |
|
261 | + 'debug' => (defined('WP_SITEURL') ? WP_SITEURL : 'undefined'), |
|
262 | 262 | ), |
263 | 263 | 'WP_CONTENT_DIR' => array( |
264 | 264 | 'label' => 'WP_CONTENT_DIR', |
@@ -278,12 +278,12 @@ discard block |
||
278 | 278 | ), |
279 | 279 | 'WP_DEBUG' => array( |
280 | 280 | 'label' => 'WP_DEBUG', |
281 | - 'value' => WP_DEBUG ? __( 'Enabled' ) : __( 'Disabled' ), |
|
281 | + 'value' => WP_DEBUG ? __('Enabled') : __('Disabled'), |
|
282 | 282 | 'debug' => WP_DEBUG, |
283 | 283 | ), |
284 | 284 | 'WP_DEBUG_DISPLAY' => array( |
285 | 285 | 'label' => 'WP_DEBUG_DISPLAY', |
286 | - 'value' => WP_DEBUG_DISPLAY ? __( 'Enabled' ) : __( 'Disabled' ), |
|
286 | + 'value' => WP_DEBUG_DISPLAY ? __('Enabled') : __('Disabled'), |
|
287 | 287 | 'debug' => WP_DEBUG_DISPLAY, |
288 | 288 | ), |
289 | 289 | 'WP_DEBUG_LOG' => array( |
@@ -293,12 +293,12 @@ discard block |
||
293 | 293 | ), |
294 | 294 | 'SCRIPT_DEBUG' => array( |
295 | 295 | 'label' => 'SCRIPT_DEBUG', |
296 | - 'value' => SCRIPT_DEBUG ? __( 'Enabled' ) : __( 'Disabled' ), |
|
296 | + 'value' => SCRIPT_DEBUG ? __('Enabled') : __('Disabled'), |
|
297 | 297 | 'debug' => SCRIPT_DEBUG, |
298 | 298 | ), |
299 | 299 | 'WP_CACHE' => array( |
300 | 300 | 'label' => 'WP_CACHE', |
301 | - 'value' => WP_CACHE ? __( 'Enabled' ) : __( 'Disabled' ), |
|
301 | + 'value' => WP_CACHE ? __('Enabled') : __('Disabled'), |
|
302 | 302 | 'debug' => WP_CACHE, |
303 | 303 | ), |
304 | 304 | 'CONCATENATE_SCRIPTS' => array( |
@@ -323,57 +323,57 @@ discard block |
||
323 | 323 | ), |
324 | 324 | 'DB_CHARSET' => array( |
325 | 325 | 'label' => 'DB_CHARSET', |
326 | - 'value' => ( defined( 'DB_CHARSET' ) ? DB_CHARSET : __( 'Undefined' ) ), |
|
327 | - 'debug' => ( defined( 'DB_CHARSET' ) ? DB_CHARSET : 'undefined' ), |
|
326 | + 'value' => (defined('DB_CHARSET') ? DB_CHARSET : __('Undefined')), |
|
327 | + 'debug' => (defined('DB_CHARSET') ? DB_CHARSET : 'undefined'), |
|
328 | 328 | ), |
329 | 329 | 'DB_COLLATE' => array( |
330 | 330 | 'label' => 'DB_COLLATE', |
331 | - 'value' => ( defined( 'DB_COLLATE' ) ? DB_COLLATE : __( 'Undefined' ) ), |
|
332 | - 'debug' => ( defined( 'DB_COLLATE' ) ? DB_COLLATE : 'undefined' ), |
|
331 | + 'value' => (defined('DB_COLLATE') ? DB_COLLATE : __('Undefined')), |
|
332 | + 'debug' => (defined('DB_COLLATE') ? DB_COLLATE : 'undefined'), |
|
333 | 333 | ), |
334 | 334 | ), |
335 | 335 | ); |
336 | 336 | |
337 | - $is_writable_abspath = wp_is_writable( ABSPATH ); |
|
338 | - $is_writable_wp_content_dir = wp_is_writable( WP_CONTENT_DIR ); |
|
339 | - $is_writable_upload_dir = wp_is_writable( $upload_dir['basedir'] ); |
|
340 | - $is_writable_wp_plugin_dir = wp_is_writable( WP_PLUGIN_DIR ); |
|
341 | - $is_writable_template_directory = wp_is_writable( get_theme_root( get_template() ) ); |
|
337 | + $is_writable_abspath = wp_is_writable(ABSPATH); |
|
338 | + $is_writable_wp_content_dir = wp_is_writable(WP_CONTENT_DIR); |
|
339 | + $is_writable_upload_dir = wp_is_writable($upload_dir['basedir']); |
|
340 | + $is_writable_wp_plugin_dir = wp_is_writable(WP_PLUGIN_DIR); |
|
341 | + $is_writable_template_directory = wp_is_writable(get_theme_root(get_template())); |
|
342 | 342 | |
343 | 343 | $info['wp-filesystem'] = array( |
344 | - 'label' => __( 'Filesystem Permissions' ), |
|
345 | - 'description' => __( 'Shows whether WordPress is able to write to the directories it needs access to.' ), |
|
344 | + 'label' => __('Filesystem Permissions'), |
|
345 | + 'description' => __('Shows whether WordPress is able to write to the directories it needs access to.'), |
|
346 | 346 | 'fields' => array( |
347 | 347 | 'wordpress' => array( |
348 | - 'label' => __( 'The main WordPress directory' ), |
|
349 | - 'value' => ( $is_writable_abspath ? __( 'Writable' ) : __( 'Not writable' ) ), |
|
350 | - 'debug' => ( $is_writable_abspath ? 'writable' : 'not writable' ), |
|
348 | + 'label' => __('The main WordPress directory'), |
|
349 | + 'value' => ($is_writable_abspath ? __('Writable') : __('Not writable')), |
|
350 | + 'debug' => ($is_writable_abspath ? 'writable' : 'not writable'), |
|
351 | 351 | ), |
352 | 352 | 'wp-content' => array( |
353 | - 'label' => __( 'The wp-content directory' ), |
|
354 | - 'value' => ( $is_writable_wp_content_dir ? __( 'Writable' ) : __( 'Not writable' ) ), |
|
355 | - 'debug' => ( $is_writable_wp_content_dir ? 'writable' : 'not writable' ), |
|
353 | + 'label' => __('The wp-content directory'), |
|
354 | + 'value' => ($is_writable_wp_content_dir ? __('Writable') : __('Not writable')), |
|
355 | + 'debug' => ($is_writable_wp_content_dir ? 'writable' : 'not writable'), |
|
356 | 356 | ), |
357 | 357 | 'uploads' => array( |
358 | - 'label' => __( 'The uploads directory' ), |
|
359 | - 'value' => ( $is_writable_upload_dir ? __( 'Writable' ) : __( 'Not writable' ) ), |
|
360 | - 'debug' => ( $is_writable_upload_dir ? 'writable' : 'not writable' ), |
|
358 | + 'label' => __('The uploads directory'), |
|
359 | + 'value' => ($is_writable_upload_dir ? __('Writable') : __('Not writable')), |
|
360 | + 'debug' => ($is_writable_upload_dir ? 'writable' : 'not writable'), |
|
361 | 361 | ), |
362 | 362 | 'plugins' => array( |
363 | - 'label' => __( 'The plugins directory' ), |
|
364 | - 'value' => ( $is_writable_wp_plugin_dir ? __( 'Writable' ) : __( 'Not writable' ) ), |
|
365 | - 'debug' => ( $is_writable_wp_plugin_dir ? 'writable' : 'not writable' ), |
|
363 | + 'label' => __('The plugins directory'), |
|
364 | + 'value' => ($is_writable_wp_plugin_dir ? __('Writable') : __('Not writable')), |
|
365 | + 'debug' => ($is_writable_wp_plugin_dir ? 'writable' : 'not writable'), |
|
366 | 366 | ), |
367 | 367 | 'themes' => array( |
368 | - 'label' => __( 'The themes directory' ), |
|
369 | - 'value' => ( $is_writable_template_directory ? __( 'Writable' ) : __( 'Not writable' ) ), |
|
370 | - 'debug' => ( $is_writable_template_directory ? 'writable' : 'not writable' ), |
|
368 | + 'label' => __('The themes directory'), |
|
369 | + 'value' => ($is_writable_template_directory ? __('Writable') : __('Not writable')), |
|
370 | + 'debug' => ($is_writable_template_directory ? 'writable' : 'not writable'), |
|
371 | 371 | ), |
372 | 372 | ), |
373 | 373 | ); |
374 | 374 | |
375 | 375 | // Conditionally add debug information for multisite setups. |
376 | - if ( is_multisite() ) { |
|
376 | + if (is_multisite()) { |
|
377 | 377 | $network_query = new WP_Network_Query(); |
378 | 378 | $network_ids = $network_query->query( |
379 | 379 | array( |
@@ -384,42 +384,42 @@ discard block |
||
384 | 384 | ); |
385 | 385 | |
386 | 386 | $site_count = 0; |
387 | - foreach ( $network_ids as $network_id ) { |
|
388 | - $site_count += get_blog_count( $network_id ); |
|
387 | + foreach ($network_ids as $network_id) { |
|
388 | + $site_count += get_blog_count($network_id); |
|
389 | 389 | } |
390 | 390 | |
391 | 391 | $info['wp-core']['fields']['site_count'] = array( |
392 | - 'label' => __( 'Site count' ), |
|
392 | + 'label' => __('Site count'), |
|
393 | 393 | 'value' => $site_count, |
394 | 394 | ); |
395 | 395 | |
396 | 396 | $info['wp-core']['fields']['network_count'] = array( |
397 | - 'label' => __( 'Network count' ), |
|
397 | + 'label' => __('Network count'), |
|
398 | 398 | 'value' => $network_query->found_networks, |
399 | 399 | ); |
400 | 400 | } |
401 | 401 | |
402 | 402 | $info['wp-core']['fields']['user_count'] = array( |
403 | - 'label' => __( 'User count' ), |
|
403 | + 'label' => __('User count'), |
|
404 | 404 | 'value' => get_user_count(), |
405 | 405 | ); |
406 | 406 | |
407 | 407 | // WordPress features requiring processing. |
408 | - $wp_dotorg = wp_remote_get( 'https://wordpress.org', array( 'timeout' => 10 ) ); |
|
408 | + $wp_dotorg = wp_remote_get('https://wordpress.org', array('timeout' => 10)); |
|
409 | 409 | |
410 | - if ( ! is_wp_error( $wp_dotorg ) ) { |
|
410 | + if (!is_wp_error($wp_dotorg)) { |
|
411 | 411 | $info['wp-core']['fields']['dotorg_communication'] = array( |
412 | - 'label' => __( 'Communication with WordPress.org' ), |
|
413 | - 'value' => __( 'WordPress.org is reachable' ), |
|
412 | + 'label' => __('Communication with WordPress.org'), |
|
413 | + 'value' => __('WordPress.org is reachable'), |
|
414 | 414 | 'debug' => 'true', |
415 | 415 | ); |
416 | 416 | } else { |
417 | 417 | $info['wp-core']['fields']['dotorg_communication'] = array( |
418 | - 'label' => __( 'Communication with WordPress.org' ), |
|
418 | + 'label' => __('Communication with WordPress.org'), |
|
419 | 419 | 'value' => sprintf( |
420 | 420 | /* translators: 1: The IP address WordPress.org resolves to. 2: The error returned by the lookup. */ |
421 | - __( 'Unable to reach WordPress.org at %1$s: %2$s' ), |
|
422 | - gethostbyname( 'wordpress.org' ), |
|
421 | + __('Unable to reach WordPress.org at %1$s: %2$s'), |
|
422 | + gethostbyname('wordpress.org'), |
|
423 | 423 | $wp_dotorg->get_error_message() |
424 | 424 | ), |
425 | 425 | 'debug' => $wp_dotorg->get_error_message(), |
@@ -427,53 +427,53 @@ discard block |
||
427 | 427 | } |
428 | 428 | |
429 | 429 | // Remove accordion for Directories and Sizes if in Multisite. |
430 | - if ( ! $is_multisite ) { |
|
431 | - $loading = __( 'Loading…' ); |
|
430 | + if (!$is_multisite) { |
|
431 | + $loading = __('Loading…'); |
|
432 | 432 | |
433 | 433 | $info['wp-paths-sizes']['fields'] = array( |
434 | 434 | 'wordpress_path' => array( |
435 | - 'label' => __( 'WordPress directory location' ), |
|
436 | - 'value' => untrailingslashit( ABSPATH ), |
|
435 | + 'label' => __('WordPress directory location'), |
|
436 | + 'value' => untrailingslashit(ABSPATH), |
|
437 | 437 | ), |
438 | 438 | 'wordpress_size' => array( |
439 | - 'label' => __( 'WordPress directory size' ), |
|
439 | + 'label' => __('WordPress directory size'), |
|
440 | 440 | 'value' => $loading, |
441 | 441 | 'debug' => 'loading...', |
442 | 442 | ), |
443 | 443 | 'uploads_path' => array( |
444 | - 'label' => __( 'Uploads directory location' ), |
|
444 | + 'label' => __('Uploads directory location'), |
|
445 | 445 | 'value' => $upload_dir['basedir'], |
446 | 446 | ), |
447 | 447 | 'uploads_size' => array( |
448 | - 'label' => __( 'Uploads directory size' ), |
|
448 | + 'label' => __('Uploads directory size'), |
|
449 | 449 | 'value' => $loading, |
450 | 450 | 'debug' => 'loading...', |
451 | 451 | ), |
452 | 452 | 'themes_path' => array( |
453 | - 'label' => __( 'Themes directory location' ), |
|
453 | + 'label' => __('Themes directory location'), |
|
454 | 454 | 'value' => get_theme_root(), |
455 | 455 | ), |
456 | 456 | 'themes_size' => array( |
457 | - 'label' => __( 'Themes directory size' ), |
|
457 | + 'label' => __('Themes directory size'), |
|
458 | 458 | 'value' => $loading, |
459 | 459 | 'debug' => 'loading...', |
460 | 460 | ), |
461 | 461 | 'plugins_path' => array( |
462 | - 'label' => __( 'Plugins directory location' ), |
|
462 | + 'label' => __('Plugins directory location'), |
|
463 | 463 | 'value' => WP_PLUGIN_DIR, |
464 | 464 | ), |
465 | 465 | 'plugins_size' => array( |
466 | - 'label' => __( 'Plugins directory size' ), |
|
466 | + 'label' => __('Plugins directory size'), |
|
467 | 467 | 'value' => $loading, |
468 | 468 | 'debug' => 'loading...', |
469 | 469 | ), |
470 | 470 | 'database_size' => array( |
471 | - 'label' => __( 'Database size' ), |
|
471 | + 'label' => __('Database size'), |
|
472 | 472 | 'value' => $loading, |
473 | 473 | 'debug' => 'loading...', |
474 | 474 | ), |
475 | 475 | 'total_size' => array( |
476 | - 'label' => __( 'Total installation size' ), |
|
476 | + 'label' => __('Total installation size'), |
|
477 | 477 | 'value' => $loading, |
478 | 478 | 'debug' => 'loading...', |
479 | 479 | ), |
@@ -487,139 +487,139 @@ discard block |
||
487 | 487 | $dropin_descriptions = _get_dropins(); |
488 | 488 | |
489 | 489 | // Spare few function calls. |
490 | - $not_available = __( 'Not available' ); |
|
490 | + $not_available = __('Not available'); |
|
491 | 491 | |
492 | - foreach ( $dropins as $dropin_key => $dropin ) { |
|
493 | - $info['wp-dropins']['fields'][ sanitize_text_field( $dropin_key ) ] = array( |
|
492 | + foreach ($dropins as $dropin_key => $dropin) { |
|
493 | + $info['wp-dropins']['fields'][sanitize_text_field($dropin_key)] = array( |
|
494 | 494 | 'label' => $dropin_key, |
495 | - 'value' => $dropin_descriptions[ $dropin_key ][0], |
|
495 | + 'value' => $dropin_descriptions[$dropin_key][0], |
|
496 | 496 | 'debug' => 'true', |
497 | 497 | ); |
498 | 498 | } |
499 | 499 | |
500 | 500 | // Populate the media fields. |
501 | 501 | $info['wp-media']['fields']['image_editor'] = array( |
502 | - 'label' => __( 'Active editor' ), |
|
502 | + 'label' => __('Active editor'), |
|
503 | 503 | 'value' => _wp_image_editor_choose(), |
504 | 504 | ); |
505 | 505 | |
506 | 506 | // Get ImageMagic information, if available. |
507 | - if ( class_exists( 'Imagick' ) ) { |
|
507 | + if (class_exists('Imagick')) { |
|
508 | 508 | // Save the Imagick instance for later use. |
509 | 509 | $imagick = new Imagick(); |
510 | 510 | $imagemagick_version = $imagick->getVersion(); |
511 | 511 | } else { |
512 | - $imagemagick_version = __( 'Not available' ); |
|
512 | + $imagemagick_version = __('Not available'); |
|
513 | 513 | } |
514 | 514 | |
515 | 515 | $info['wp-media']['fields']['imagick_module_version'] = array( |
516 | - 'label' => __( 'ImageMagick version number' ), |
|
517 | - 'value' => ( is_array( $imagemagick_version ) ? $imagemagick_version['versionNumber'] : $imagemagick_version ), |
|
516 | + 'label' => __('ImageMagick version number'), |
|
517 | + 'value' => (is_array($imagemagick_version) ? $imagemagick_version['versionNumber'] : $imagemagick_version), |
|
518 | 518 | ); |
519 | 519 | |
520 | 520 | $info['wp-media']['fields']['imagemagick_version'] = array( |
521 | - 'label' => __( 'ImageMagick version string' ), |
|
522 | - 'value' => ( is_array( $imagemagick_version ) ? $imagemagick_version['versionString'] : $imagemagick_version ), |
|
521 | + 'label' => __('ImageMagick version string'), |
|
522 | + 'value' => (is_array($imagemagick_version) ? $imagemagick_version['versionString'] : $imagemagick_version), |
|
523 | 523 | ); |
524 | 524 | |
525 | - $imagick_version = phpversion( 'imagick' ); |
|
525 | + $imagick_version = phpversion('imagick'); |
|
526 | 526 | |
527 | 527 | $info['wp-media']['fields']['imagick_version'] = array( |
528 | - 'label' => __( 'Imagick version' ), |
|
529 | - 'value' => ( $imagick_version ) ? $imagick_version : __( 'Not available' ), |
|
528 | + 'label' => __('Imagick version'), |
|
529 | + 'value' => ($imagick_version) ? $imagick_version : __('Not available'), |
|
530 | 530 | ); |
531 | 531 | |
532 | - if ( ! function_exists( 'ini_get' ) ) { |
|
532 | + if (!function_exists('ini_get')) { |
|
533 | 533 | $info['wp-media']['fields']['ini_get'] = array( |
534 | - 'label' => __( 'File upload settings' ), |
|
534 | + 'label' => __('File upload settings'), |
|
535 | 535 | 'value' => sprintf( |
536 | 536 | /* translators: %s: ini_get() */ |
537 | - __( 'Unable to determine some settings, as the %s function has been disabled.' ), |
|
537 | + __('Unable to determine some settings, as the %s function has been disabled.'), |
|
538 | 538 | 'ini_get()' |
539 | 539 | ), |
540 | 540 | 'debug' => 'ini_get() is disabled', |
541 | 541 | ); |
542 | 542 | } else { |
543 | 543 | // Get the PHP ini directive values. |
544 | - $post_max_size = ini_get( 'post_max_size' ); |
|
545 | - $upload_max_filesize = ini_get( 'upload_max_filesize' ); |
|
546 | - $max_file_uploads = ini_get( 'max_file_uploads' ); |
|
547 | - $effective = min( wp_convert_hr_to_bytes( $post_max_size ), wp_convert_hr_to_bytes( $upload_max_filesize ) ); |
|
544 | + $post_max_size = ini_get('post_max_size'); |
|
545 | + $upload_max_filesize = ini_get('upload_max_filesize'); |
|
546 | + $max_file_uploads = ini_get('max_file_uploads'); |
|
547 | + $effective = min(wp_convert_hr_to_bytes($post_max_size), wp_convert_hr_to_bytes($upload_max_filesize)); |
|
548 | 548 | |
549 | 549 | // Add info in Media section. |
550 | - $info['wp-media']['fields']['file_uploads'] = array( |
|
551 | - 'label' => __( 'File uploads' ), |
|
552 | - 'value' => empty( ini_get( 'file_uploads' ) ) ? __( 'Disabled' ) : __( 'Enabled' ), |
|
550 | + $info['wp-media']['fields']['file_uploads'] = array( |
|
551 | + 'label' => __('File uploads'), |
|
552 | + 'value' => empty(ini_get('file_uploads')) ? __('Disabled') : __('Enabled'), |
|
553 | 553 | 'debug' => 'File uploads is turned off', |
554 | 554 | ); |
555 | - $info['wp-media']['fields']['post_max_size'] = array( |
|
556 | - 'label' => __( 'Max size of post data allowed' ), |
|
555 | + $info['wp-media']['fields']['post_max_size'] = array( |
|
556 | + 'label' => __('Max size of post data allowed'), |
|
557 | 557 | 'value' => $post_max_size, |
558 | 558 | ); |
559 | 559 | $info['wp-media']['fields']['upload_max_filesize'] = array( |
560 | - 'label' => __( 'Max size of an uploaded file' ), |
|
560 | + 'label' => __('Max size of an uploaded file'), |
|
561 | 561 | 'value' => $upload_max_filesize, |
562 | 562 | ); |
563 | - $info['wp-media']['fields']['max_effective_size'] = array( |
|
564 | - 'label' => __( 'Max effective file size' ), |
|
565 | - 'value' => size_format( $effective ), |
|
563 | + $info['wp-media']['fields']['max_effective_size'] = array( |
|
564 | + 'label' => __('Max effective file size'), |
|
565 | + 'value' => size_format($effective), |
|
566 | 566 | ); |
567 | - $info['wp-media']['fields']['max_file_uploads'] = array( |
|
568 | - 'label' => __( 'Max number of files allowed' ), |
|
569 | - 'value' => number_format( $max_file_uploads ), |
|
567 | + $info['wp-media']['fields']['max_file_uploads'] = array( |
|
568 | + 'label' => __('Max number of files allowed'), |
|
569 | + 'value' => number_format($max_file_uploads), |
|
570 | 570 | ); |
571 | 571 | } |
572 | 572 | |
573 | 573 | // If Imagick is used as our editor, provide some more information about its limitations. |
574 | - if ( 'WP_Image_Editor_Imagick' === _wp_image_editor_choose() && isset( $imagick ) && $imagick instanceof Imagick ) { |
|
574 | + if ('WP_Image_Editor_Imagick' === _wp_image_editor_choose() && isset($imagick) && $imagick instanceof Imagick) { |
|
575 | 575 | $limits = array( |
576 | - 'area' => ( defined( 'imagick::RESOURCETYPE_AREA' ) ? size_format( $imagick->getResourceLimit( imagick::RESOURCETYPE_AREA ) ) : $not_available ), |
|
577 | - 'disk' => ( defined( 'imagick::RESOURCETYPE_DISK' ) ? $imagick->getResourceLimit( imagick::RESOURCETYPE_DISK ) : $not_available ), |
|
578 | - 'file' => ( defined( 'imagick::RESOURCETYPE_FILE' ) ? $imagick->getResourceLimit( imagick::RESOURCETYPE_FILE ) : $not_available ), |
|
579 | - 'map' => ( defined( 'imagick::RESOURCETYPE_MAP' ) ? size_format( $imagick->getResourceLimit( imagick::RESOURCETYPE_MAP ) ) : $not_available ), |
|
580 | - 'memory' => ( defined( 'imagick::RESOURCETYPE_MEMORY' ) ? size_format( $imagick->getResourceLimit( imagick::RESOURCETYPE_MEMORY ) ) : $not_available ), |
|
581 | - 'thread' => ( defined( 'imagick::RESOURCETYPE_THREAD' ) ? $imagick->getResourceLimit( imagick::RESOURCETYPE_THREAD ) : $not_available ), |
|
576 | + 'area' => (defined('imagick::RESOURCETYPE_AREA') ? size_format($imagick->getResourceLimit(imagick::RESOURCETYPE_AREA)) : $not_available), |
|
577 | + 'disk' => (defined('imagick::RESOURCETYPE_DISK') ? $imagick->getResourceLimit(imagick::RESOURCETYPE_DISK) : $not_available), |
|
578 | + 'file' => (defined('imagick::RESOURCETYPE_FILE') ? $imagick->getResourceLimit(imagick::RESOURCETYPE_FILE) : $not_available), |
|
579 | + 'map' => (defined('imagick::RESOURCETYPE_MAP') ? size_format($imagick->getResourceLimit(imagick::RESOURCETYPE_MAP)) : $not_available), |
|
580 | + 'memory' => (defined('imagick::RESOURCETYPE_MEMORY') ? size_format($imagick->getResourceLimit(imagick::RESOURCETYPE_MEMORY)) : $not_available), |
|
581 | + 'thread' => (defined('imagick::RESOURCETYPE_THREAD') ? $imagick->getResourceLimit(imagick::RESOURCETYPE_THREAD) : $not_available), |
|
582 | 582 | ); |
583 | 583 | |
584 | 584 | $limits_debug = array( |
585 | - 'imagick::RESOURCETYPE_AREA' => ( defined( 'imagick::RESOURCETYPE_AREA' ) ? size_format( $imagick->getResourceLimit( imagick::RESOURCETYPE_AREA ) ) : 'not available' ), |
|
586 | - 'imagick::RESOURCETYPE_DISK' => ( defined( 'imagick::RESOURCETYPE_DISK' ) ? $imagick->getResourceLimit( imagick::RESOURCETYPE_DISK ) : 'not available' ), |
|
587 | - 'imagick::RESOURCETYPE_FILE' => ( defined( 'imagick::RESOURCETYPE_FILE' ) ? $imagick->getResourceLimit( imagick::RESOURCETYPE_FILE ) : 'not available' ), |
|
588 | - 'imagick::RESOURCETYPE_MAP' => ( defined( 'imagick::RESOURCETYPE_MAP' ) ? size_format( $imagick->getResourceLimit( imagick::RESOURCETYPE_MAP ) ) : 'not available' ), |
|
589 | - 'imagick::RESOURCETYPE_MEMORY' => ( defined( 'imagick::RESOURCETYPE_MEMORY' ) ? size_format( $imagick->getResourceLimit( imagick::RESOURCETYPE_MEMORY ) ) : 'not available' ), |
|
590 | - 'imagick::RESOURCETYPE_THREAD' => ( defined( 'imagick::RESOURCETYPE_THREAD' ) ? $imagick->getResourceLimit( imagick::RESOURCETYPE_THREAD ) : 'not available' ), |
|
585 | + 'imagick::RESOURCETYPE_AREA' => (defined('imagick::RESOURCETYPE_AREA') ? size_format($imagick->getResourceLimit(imagick::RESOURCETYPE_AREA)) : 'not available'), |
|
586 | + 'imagick::RESOURCETYPE_DISK' => (defined('imagick::RESOURCETYPE_DISK') ? $imagick->getResourceLimit(imagick::RESOURCETYPE_DISK) : 'not available'), |
|
587 | + 'imagick::RESOURCETYPE_FILE' => (defined('imagick::RESOURCETYPE_FILE') ? $imagick->getResourceLimit(imagick::RESOURCETYPE_FILE) : 'not available'), |
|
588 | + 'imagick::RESOURCETYPE_MAP' => (defined('imagick::RESOURCETYPE_MAP') ? size_format($imagick->getResourceLimit(imagick::RESOURCETYPE_MAP)) : 'not available'), |
|
589 | + 'imagick::RESOURCETYPE_MEMORY' => (defined('imagick::RESOURCETYPE_MEMORY') ? size_format($imagick->getResourceLimit(imagick::RESOURCETYPE_MEMORY)) : 'not available'), |
|
590 | + 'imagick::RESOURCETYPE_THREAD' => (defined('imagick::RESOURCETYPE_THREAD') ? $imagick->getResourceLimit(imagick::RESOURCETYPE_THREAD) : 'not available'), |
|
591 | 591 | ); |
592 | 592 | |
593 | 593 | $info['wp-media']['fields']['imagick_limits'] = array( |
594 | - 'label' => __( 'Imagick Resource Limits' ), |
|
594 | + 'label' => __('Imagick Resource Limits'), |
|
595 | 595 | 'value' => $limits, |
596 | 596 | 'debug' => $limits_debug, |
597 | 597 | ); |
598 | 598 | |
599 | 599 | try { |
600 | - $formats = Imagick::queryFormats( '*' ); |
|
601 | - } catch ( Exception $e ) { |
|
600 | + $formats = Imagick::queryFormats('*'); |
|
601 | + } catch (Exception $e) { |
|
602 | 602 | $formats = array(); |
603 | 603 | } |
604 | 604 | |
605 | 605 | $info['wp-media']['fields']['imagemagick_file_formats'] = array( |
606 | - 'label' => __( 'ImageMagick supported file formats' ), |
|
607 | - 'value' => ( empty( $formats ) ) ? __( 'Unable to determine' ) : implode( ', ', $formats ), |
|
608 | - 'debug' => ( empty( $formats ) ) ? 'Unable to determine' : implode( ', ', $formats ), |
|
606 | + 'label' => __('ImageMagick supported file formats'), |
|
607 | + 'value' => (empty($formats)) ? __('Unable to determine') : implode(', ', $formats), |
|
608 | + 'debug' => (empty($formats)) ? 'Unable to determine' : implode(', ', $formats), |
|
609 | 609 | ); |
610 | 610 | } |
611 | 611 | |
612 | 612 | // Get GD information, if available. |
613 | - if ( function_exists( 'gd_info' ) ) { |
|
613 | + if (function_exists('gd_info')) { |
|
614 | 614 | $gd = gd_info(); |
615 | 615 | } else { |
616 | 616 | $gd = false; |
617 | 617 | } |
618 | 618 | |
619 | 619 | $info['wp-media']['fields']['gd_version'] = array( |
620 | - 'label' => __( 'GD version' ), |
|
621 | - 'value' => ( is_array( $gd ) ? $gd['GD Version'] : $not_available ), |
|
622 | - 'debug' => ( is_array( $gd ) ? $gd['GD Version'] : 'not available' ), |
|
620 | + 'label' => __('GD version'), |
|
621 | + 'value' => (is_array($gd) ? $gd['GD Version'] : $not_available), |
|
622 | + 'debug' => (is_array($gd) ? $gd['GD Version'] : 'not available'), |
|
623 | 623 | ); |
624 | 624 | |
625 | 625 | $gd_image_formats = array(); |
@@ -635,175 +635,175 @@ discard block |
||
635 | 635 | 'XPM' => 'XPM', |
636 | 636 | ); |
637 | 637 | |
638 | - foreach ( $gd_supported_formats as $format_key => $format ) { |
|
638 | + foreach ($gd_supported_formats as $format_key => $format) { |
|
639 | 639 | $index = $format_key . ' Support'; |
640 | - if ( isset( $gd[ $index ] ) && $gd[ $index ] ) { |
|
641 | - array_push( $gd_image_formats, $format ); |
|
640 | + if (isset($gd[$index]) && $gd[$index]) { |
|
641 | + array_push($gd_image_formats, $format); |
|
642 | 642 | } |
643 | 643 | } |
644 | 644 | |
645 | - if ( ! empty( $gd_image_formats ) ) { |
|
645 | + if (!empty($gd_image_formats)) { |
|
646 | 646 | $info['wp-media']['fields']['gd_formats'] = array( |
647 | - 'label' => __( 'GD supported file formats' ), |
|
648 | - 'value' => implode( ', ', $gd_image_formats ), |
|
647 | + 'label' => __('GD supported file formats'), |
|
648 | + 'value' => implode(', ', $gd_image_formats), |
|
649 | 649 | ); |
650 | 650 | } |
651 | 651 | |
652 | 652 | // Get Ghostscript information, if available. |
653 | - if ( function_exists( 'exec' ) ) { |
|
654 | - $gs = exec( 'gs --version' ); |
|
653 | + if (function_exists('exec')) { |
|
654 | + $gs = exec('gs --version'); |
|
655 | 655 | |
656 | - if ( empty( $gs ) ) { |
|
656 | + if (empty($gs)) { |
|
657 | 657 | $gs = $not_available; |
658 | 658 | $gs_debug = 'not available'; |
659 | 659 | } else { |
660 | 660 | $gs_debug = $gs; |
661 | 661 | } |
662 | 662 | } else { |
663 | - $gs = __( 'Unable to determine if Ghostscript is installed' ); |
|
663 | + $gs = __('Unable to determine if Ghostscript is installed'); |
|
664 | 664 | $gs_debug = 'unknown'; |
665 | 665 | } |
666 | 666 | |
667 | 667 | $info['wp-media']['fields']['ghostscript_version'] = array( |
668 | - 'label' => __( 'Ghostscript version' ), |
|
668 | + 'label' => __('Ghostscript version'), |
|
669 | 669 | 'value' => $gs, |
670 | 670 | 'debug' => $gs_debug, |
671 | 671 | ); |
672 | 672 | |
673 | 673 | // Populate the server debug fields. |
674 | - if ( function_exists( 'php_uname' ) ) { |
|
675 | - $server_architecture = sprintf( '%s %s %s', php_uname( 's' ), php_uname( 'r' ), php_uname( 'm' ) ); |
|
674 | + if (function_exists('php_uname')) { |
|
675 | + $server_architecture = sprintf('%s %s %s', php_uname('s'), php_uname('r'), php_uname('m')); |
|
676 | 676 | } else { |
677 | 677 | $server_architecture = 'unknown'; |
678 | 678 | } |
679 | 679 | |
680 | - if ( function_exists( 'phpversion' ) ) { |
|
680 | + if (function_exists('phpversion')) { |
|
681 | 681 | $php_version_debug = phpversion(); |
682 | 682 | // Whether PHP supports 64-bit. |
683 | - $php64bit = ( PHP_INT_SIZE * 8 === 64 ); |
|
683 | + $php64bit = (PHP_INT_SIZE * 8 === 64); |
|
684 | 684 | |
685 | 685 | $php_version = sprintf( |
686 | 686 | '%s %s', |
687 | 687 | $php_version_debug, |
688 | - ( $php64bit ? __( '(Supports 64bit values)' ) : __( '(Does not support 64bit values)' ) ) |
|
688 | + ($php64bit ? __('(Supports 64bit values)') : __('(Does not support 64bit values)')) |
|
689 | 689 | ); |
690 | 690 | |
691 | - if ( $php64bit ) { |
|
691 | + if ($php64bit) { |
|
692 | 692 | $php_version_debug .= ' 64bit'; |
693 | 693 | } |
694 | 694 | } else { |
695 | - $php_version = __( 'Unable to determine PHP version' ); |
|
695 | + $php_version = __('Unable to determine PHP version'); |
|
696 | 696 | $php_version_debug = 'unknown'; |
697 | 697 | } |
698 | 698 | |
699 | - if ( function_exists( 'php_sapi_name' ) ) { |
|
699 | + if (function_exists('php_sapi_name')) { |
|
700 | 700 | $php_sapi = php_sapi_name(); |
701 | 701 | } else { |
702 | 702 | $php_sapi = 'unknown'; |
703 | 703 | } |
704 | 704 | |
705 | 705 | $info['wp-server']['fields']['server_architecture'] = array( |
706 | - 'label' => __( 'Server architecture' ), |
|
707 | - 'value' => ( 'unknown' !== $server_architecture ? $server_architecture : __( 'Unable to determine server architecture' ) ), |
|
706 | + 'label' => __('Server architecture'), |
|
707 | + 'value' => ('unknown' !== $server_architecture ? $server_architecture : __('Unable to determine server architecture')), |
|
708 | 708 | 'debug' => $server_architecture, |
709 | 709 | ); |
710 | - $info['wp-server']['fields']['httpd_software'] = array( |
|
711 | - 'label' => __( 'Web server' ), |
|
712 | - 'value' => ( isset( $_SERVER['SERVER_SOFTWARE'] ) ? $_SERVER['SERVER_SOFTWARE'] : __( 'Unable to determine what web server software is used' ) ), |
|
713 | - 'debug' => ( isset( $_SERVER['SERVER_SOFTWARE'] ) ? $_SERVER['SERVER_SOFTWARE'] : 'unknown' ), |
|
710 | + $info['wp-server']['fields']['httpd_software'] = array( |
|
711 | + 'label' => __('Web server'), |
|
712 | + 'value' => (isset($_SERVER['SERVER_SOFTWARE']) ? $_SERVER['SERVER_SOFTWARE'] : __('Unable to determine what web server software is used')), |
|
713 | + 'debug' => (isset($_SERVER['SERVER_SOFTWARE']) ? $_SERVER['SERVER_SOFTWARE'] : 'unknown'), |
|
714 | 714 | ); |
715 | - $info['wp-server']['fields']['php_version'] = array( |
|
716 | - 'label' => __( 'PHP version' ), |
|
715 | + $info['wp-server']['fields']['php_version'] = array( |
|
716 | + 'label' => __('PHP version'), |
|
717 | 717 | 'value' => $php_version, |
718 | 718 | 'debug' => $php_version_debug, |
719 | 719 | ); |
720 | - $info['wp-server']['fields']['php_sapi'] = array( |
|
721 | - 'label' => __( 'PHP SAPI' ), |
|
722 | - 'value' => ( 'unknown' !== $php_sapi ? $php_sapi : __( 'Unable to determine PHP SAPI' ) ), |
|
720 | + $info['wp-server']['fields']['php_sapi'] = array( |
|
721 | + 'label' => __('PHP SAPI'), |
|
722 | + 'value' => ('unknown' !== $php_sapi ? $php_sapi : __('Unable to determine PHP SAPI')), |
|
723 | 723 | 'debug' => $php_sapi, |
724 | 724 | ); |
725 | 725 | |
726 | 726 | // Some servers disable `ini_set()` and `ini_get()`, we check this before trying to get configuration values. |
727 | - if ( ! function_exists( 'ini_get' ) ) { |
|
727 | + if (!function_exists('ini_get')) { |
|
728 | 728 | $info['wp-server']['fields']['ini_get'] = array( |
729 | - 'label' => __( 'Server settings' ), |
|
729 | + 'label' => __('Server settings'), |
|
730 | 730 | 'value' => sprintf( |
731 | 731 | /* translators: %s: ini_get() */ |
732 | - __( 'Unable to determine some settings, as the %s function has been disabled.' ), |
|
732 | + __('Unable to determine some settings, as the %s function has been disabled.'), |
|
733 | 733 | 'ini_get()' |
734 | 734 | ), |
735 | 735 | 'debug' => 'ini_get() is disabled', |
736 | 736 | ); |
737 | 737 | } else { |
738 | 738 | $info['wp-server']['fields']['max_input_variables'] = array( |
739 | - 'label' => __( 'PHP max input variables' ), |
|
740 | - 'value' => ini_get( 'max_input_vars' ), |
|
739 | + 'label' => __('PHP max input variables'), |
|
740 | + 'value' => ini_get('max_input_vars'), |
|
741 | 741 | ); |
742 | - $info['wp-server']['fields']['time_limit'] = array( |
|
743 | - 'label' => __( 'PHP time limit' ), |
|
744 | - 'value' => ini_get( 'max_execution_time' ), |
|
742 | + $info['wp-server']['fields']['time_limit'] = array( |
|
743 | + 'label' => __('PHP time limit'), |
|
744 | + 'value' => ini_get('max_execution_time'), |
|
745 | 745 | ); |
746 | 746 | |
747 | - if ( WP_Site_Health::get_instance()->php_memory_limit !== ini_get( 'memory_limit' ) ) { |
|
748 | - $info['wp-server']['fields']['memory_limit'] = array( |
|
749 | - 'label' => __( 'PHP memory limit' ), |
|
747 | + if (WP_Site_Health::get_instance()->php_memory_limit !== ini_get('memory_limit')) { |
|
748 | + $info['wp-server']['fields']['memory_limit'] = array( |
|
749 | + 'label' => __('PHP memory limit'), |
|
750 | 750 | 'value' => WP_Site_Health::get_instance()->php_memory_limit, |
751 | 751 | ); |
752 | 752 | $info['wp-server']['fields']['admin_memory_limit'] = array( |
753 | - 'label' => __( 'PHP memory limit (only for admin screens)' ), |
|
754 | - 'value' => ini_get( 'memory_limit' ), |
|
753 | + 'label' => __('PHP memory limit (only for admin screens)'), |
|
754 | + 'value' => ini_get('memory_limit'), |
|
755 | 755 | ); |
756 | 756 | } else { |
757 | 757 | $info['wp-server']['fields']['memory_limit'] = array( |
758 | - 'label' => __( 'PHP memory limit' ), |
|
759 | - 'value' => ini_get( 'memory_limit' ), |
|
758 | + 'label' => __('PHP memory limit'), |
|
759 | + 'value' => ini_get('memory_limit'), |
|
760 | 760 | ); |
761 | 761 | } |
762 | 762 | |
763 | - $info['wp-server']['fields']['max_input_time'] = array( |
|
764 | - 'label' => __( 'Max input time' ), |
|
765 | - 'value' => ini_get( 'max_input_time' ), |
|
763 | + $info['wp-server']['fields']['max_input_time'] = array( |
|
764 | + 'label' => __('Max input time'), |
|
765 | + 'value' => ini_get('max_input_time'), |
|
766 | 766 | ); |
767 | 767 | $info['wp-server']['fields']['upload_max_filesize'] = array( |
768 | - 'label' => __( 'Upload max filesize' ), |
|
769 | - 'value' => ini_get( 'upload_max_filesize' ), |
|
768 | + 'label' => __('Upload max filesize'), |
|
769 | + 'value' => ini_get('upload_max_filesize'), |
|
770 | 770 | ); |
771 | - $info['wp-server']['fields']['php_post_max_size'] = array( |
|
772 | - 'label' => __( 'PHP post max size' ), |
|
773 | - 'value' => ini_get( 'post_max_size' ), |
|
771 | + $info['wp-server']['fields']['php_post_max_size'] = array( |
|
772 | + 'label' => __('PHP post max size'), |
|
773 | + 'value' => ini_get('post_max_size'), |
|
774 | 774 | ); |
775 | 775 | } |
776 | 776 | |
777 | - if ( function_exists( 'curl_version' ) ) { |
|
777 | + if (function_exists('curl_version')) { |
|
778 | 778 | $curl = curl_version(); |
779 | 779 | |
780 | 780 | $info['wp-server']['fields']['curl_version'] = array( |
781 | - 'label' => __( 'cURL version' ), |
|
782 | - 'value' => sprintf( '%s %s', $curl['version'], $curl['ssl_version'] ), |
|
781 | + 'label' => __('cURL version'), |
|
782 | + 'value' => sprintf('%s %s', $curl['version'], $curl['ssl_version']), |
|
783 | 783 | ); |
784 | 784 | } else { |
785 | 785 | $info['wp-server']['fields']['curl_version'] = array( |
786 | - 'label' => __( 'cURL version' ), |
|
786 | + 'label' => __('cURL version'), |
|
787 | 787 | 'value' => $not_available, |
788 | 788 | 'debug' => 'not available', |
789 | 789 | ); |
790 | 790 | } |
791 | 791 | |
792 | 792 | // SUHOSIN. |
793 | - $suhosin_loaded = ( extension_loaded( 'suhosin' ) || ( defined( 'SUHOSIN_PATCH' ) && constant( 'SUHOSIN_PATCH' ) ) ); |
|
793 | + $suhosin_loaded = (extension_loaded('suhosin') || (defined('SUHOSIN_PATCH') && constant('SUHOSIN_PATCH'))); |
|
794 | 794 | |
795 | 795 | $info['wp-server']['fields']['suhosin'] = array( |
796 | - 'label' => __( 'Is SUHOSIN installed?' ), |
|
797 | - 'value' => ( $suhosin_loaded ? __( 'Yes' ) : __( 'No' ) ), |
|
796 | + 'label' => __('Is SUHOSIN installed?'), |
|
797 | + 'value' => ($suhosin_loaded ? __('Yes') : __('No')), |
|
798 | 798 | 'debug' => $suhosin_loaded, |
799 | 799 | ); |
800 | 800 | |
801 | 801 | // Imagick. |
802 | - $imagick_loaded = extension_loaded( 'imagick' ); |
|
802 | + $imagick_loaded = extension_loaded('imagick'); |
|
803 | 803 | |
804 | 804 | $info['wp-server']['fields']['imagick_availability'] = array( |
805 | - 'label' => __( 'Is the Imagick library available?' ), |
|
806 | - 'value' => ( $imagick_loaded ? __( 'Yes' ) : __( 'No' ) ), |
|
805 | + 'label' => __('Is the Imagick library available?'), |
|
806 | + 'value' => ($imagick_loaded ? __('Yes') : __('No')), |
|
807 | 807 | 'debug' => $imagick_loaded, |
808 | 808 | ); |
809 | 809 | |
@@ -811,54 +811,54 @@ discard block |
||
811 | 811 | $pretty_permalinks_supported = got_url_rewrite(); |
812 | 812 | |
813 | 813 | $info['wp-server']['fields']['pretty_permalinks'] = array( |
814 | - 'label' => __( 'Are pretty permalinks supported?' ), |
|
815 | - 'value' => ( $pretty_permalinks_supported ? __( 'Yes' ) : __( 'No' ) ), |
|
814 | + 'label' => __('Are pretty permalinks supported?'), |
|
815 | + 'value' => ($pretty_permalinks_supported ? __('Yes') : __('No')), |
|
816 | 816 | 'debug' => $pretty_permalinks_supported, |
817 | 817 | ); |
818 | 818 | |
819 | 819 | // Check if a .htaccess file exists. |
820 | - if ( is_file( ABSPATH . '.htaccess' ) ) { |
|
820 | + if (is_file(ABSPATH . '.htaccess')) { |
|
821 | 821 | // If the file exists, grab the content of it. |
822 | - $htaccess_content = file_get_contents( ABSPATH . '.htaccess' ); |
|
822 | + $htaccess_content = file_get_contents(ABSPATH . '.htaccess'); |
|
823 | 823 | |
824 | 824 | // Filter away the core WordPress rules. |
825 | - $filtered_htaccess_content = trim( preg_replace( '/\# BEGIN WordPress[\s\S]+?# END WordPress/si', '', $htaccess_content ) ); |
|
826 | - $filtered_htaccess_content = ! empty( $filtered_htaccess_content ); |
|
825 | + $filtered_htaccess_content = trim(preg_replace('/\# BEGIN WordPress[\s\S]+?# END WordPress/si', '', $htaccess_content)); |
|
826 | + $filtered_htaccess_content = !empty($filtered_htaccess_content); |
|
827 | 827 | |
828 | - if ( $filtered_htaccess_content ) { |
|
828 | + if ($filtered_htaccess_content) { |
|
829 | 829 | /* translators: %s: .htaccess */ |
830 | - $htaccess_rules_string = sprintf( __( 'Custom rules have been added to your %s file.' ), '.htaccess' ); |
|
830 | + $htaccess_rules_string = sprintf(__('Custom rules have been added to your %s file.'), '.htaccess'); |
|
831 | 831 | } else { |
832 | 832 | /* translators: %s: .htaccess */ |
833 | - $htaccess_rules_string = sprintf( __( 'Your %s file contains only core WordPress features.' ), '.htaccess' ); |
|
833 | + $htaccess_rules_string = sprintf(__('Your %s file contains only core WordPress features.'), '.htaccess'); |
|
834 | 834 | } |
835 | 835 | |
836 | 836 | $info['wp-server']['fields']['htaccess_extra_rules'] = array( |
837 | - 'label' => __( '.htaccess rules' ), |
|
837 | + 'label' => __('.htaccess rules'), |
|
838 | 838 | 'value' => $htaccess_rules_string, |
839 | 839 | 'debug' => $filtered_htaccess_content, |
840 | 840 | ); |
841 | 841 | } |
842 | 842 | |
843 | 843 | // Populate the database debug fields. |
844 | - if ( is_resource( $wpdb->dbh ) ) { |
|
844 | + if (is_resource($wpdb->dbh)) { |
|
845 | 845 | // Old mysql extension. |
846 | 846 | $extension = 'mysql'; |
847 | - } elseif ( is_object( $wpdb->dbh ) ) { |
|
847 | + } elseif (is_object($wpdb->dbh)) { |
|
848 | 848 | // mysqli or PDO. |
849 | - $extension = get_class( $wpdb->dbh ); |
|
849 | + $extension = get_class($wpdb->dbh); |
|
850 | 850 | } else { |
851 | 851 | // Unknown sql extension. |
852 | 852 | $extension = null; |
853 | 853 | } |
854 | 854 | |
855 | - $server = $wpdb->get_var( 'SELECT VERSION()' ); |
|
855 | + $server = $wpdb->get_var('SELECT VERSION()'); |
|
856 | 856 | |
857 | - if ( isset( $wpdb->use_mysqli ) && $wpdb->use_mysqli ) { |
|
857 | + if (isset($wpdb->use_mysqli) && $wpdb->use_mysqli) { |
|
858 | 858 | $client_version = $wpdb->dbh->client_info; |
859 | 859 | } else { |
860 | 860 | // phpcs:ignore WordPress.DB.RestrictedFunctions.mysql_mysql_get_client_info,PHPCompatibility.Extensions.RemovedExtensions.mysql_DeprecatedRemoved |
861 | - if ( preg_match( '|[0-9]{1,2}\.[0-9]{1,2}\.[0-9]{1,2}|', mysql_get_client_info(), $matches ) ) { |
|
861 | + if (preg_match('|[0-9]{1,2}\.[0-9]{1,2}\.[0-9]{1,2}|', mysql_get_client_info(), $matches)) { |
|
862 | 862 | $client_version = $matches[0]; |
863 | 863 | } else { |
864 | 864 | $client_version = null; |
@@ -866,95 +866,95 @@ discard block |
||
866 | 866 | } |
867 | 867 | |
868 | 868 | $info['wp-database']['fields']['extension'] = array( |
869 | - 'label' => __( 'Extension' ), |
|
869 | + 'label' => __('Extension'), |
|
870 | 870 | 'value' => $extension, |
871 | 871 | ); |
872 | 872 | |
873 | 873 | $info['wp-database']['fields']['server_version'] = array( |
874 | - 'label' => __( 'Server version' ), |
|
874 | + 'label' => __('Server version'), |
|
875 | 875 | 'value' => $server, |
876 | 876 | ); |
877 | 877 | |
878 | 878 | $info['wp-database']['fields']['client_version'] = array( |
879 | - 'label' => __( 'Client version' ), |
|
879 | + 'label' => __('Client version'), |
|
880 | 880 | 'value' => $client_version, |
881 | 881 | ); |
882 | 882 | |
883 | 883 | $info['wp-database']['fields']['database_user'] = array( |
884 | - 'label' => __( 'Database username' ), |
|
884 | + 'label' => __('Database username'), |
|
885 | 885 | 'value' => $wpdb->dbuser, |
886 | 886 | 'private' => true, |
887 | 887 | ); |
888 | 888 | |
889 | 889 | $info['wp-database']['fields']['database_host'] = array( |
890 | - 'label' => __( 'Database host' ), |
|
890 | + 'label' => __('Database host'), |
|
891 | 891 | 'value' => $wpdb->dbhost, |
892 | 892 | 'private' => true, |
893 | 893 | ); |
894 | 894 | |
895 | 895 | $info['wp-database']['fields']['database_name'] = array( |
896 | - 'label' => __( 'Database name' ), |
|
896 | + 'label' => __('Database name'), |
|
897 | 897 | 'value' => $wpdb->dbname, |
898 | 898 | 'private' => true, |
899 | 899 | ); |
900 | 900 | |
901 | 901 | $info['wp-database']['fields']['database_prefix'] = array( |
902 | - 'label' => __( 'Table prefix' ), |
|
902 | + 'label' => __('Table prefix'), |
|
903 | 903 | 'value' => $wpdb->prefix, |
904 | 904 | 'private' => true, |
905 | 905 | ); |
906 | 906 | |
907 | 907 | $info['wp-database']['fields']['database_charset'] = array( |
908 | - 'label' => __( 'Database charset' ), |
|
908 | + 'label' => __('Database charset'), |
|
909 | 909 | 'value' => $wpdb->charset, |
910 | 910 | 'private' => true, |
911 | 911 | ); |
912 | 912 | |
913 | 913 | $info['wp-database']['fields']['database_collate'] = array( |
914 | - 'label' => __( 'Database collation' ), |
|
914 | + 'label' => __('Database collation'), |
|
915 | 915 | 'value' => $wpdb->collate, |
916 | 916 | 'private' => true, |
917 | 917 | ); |
918 | 918 | |
919 | 919 | $info['wp-database']['fields']['max_allowed_packet'] = array( |
920 | - 'label' => __( 'Max allowed packet size' ), |
|
921 | - 'value' => self::get_mysql_var( 'max_allowed_packet' ), |
|
920 | + 'label' => __('Max allowed packet size'), |
|
921 | + 'value' => self::get_mysql_var('max_allowed_packet'), |
|
922 | 922 | ); |
923 | 923 | |
924 | 924 | $info['wp-database']['fields']['max_connections'] = array( |
925 | - 'label' => __( 'Max connections number' ), |
|
926 | - 'value' => self::get_mysql_var( 'max_connections' ), |
|
925 | + 'label' => __('Max connections number'), |
|
926 | + 'value' => self::get_mysql_var('max_connections'), |
|
927 | 927 | ); |
928 | 928 | |
929 | 929 | // List must use plugins if there are any. |
930 | 930 | $mu_plugins = get_mu_plugins(); |
931 | 931 | |
932 | - foreach ( $mu_plugins as $plugin_path => $plugin ) { |
|
932 | + foreach ($mu_plugins as $plugin_path => $plugin) { |
|
933 | 933 | $plugin_version = $plugin['Version']; |
934 | 934 | $plugin_author = $plugin['Author']; |
935 | 935 | |
936 | - $plugin_version_string = __( 'No version or author information is available.' ); |
|
936 | + $plugin_version_string = __('No version or author information is available.'); |
|
937 | 937 | $plugin_version_string_debug = 'author: (undefined), version: (undefined)'; |
938 | 938 | |
939 | - if ( ! empty( $plugin_version ) && ! empty( $plugin_author ) ) { |
|
939 | + if (!empty($plugin_version) && !empty($plugin_author)) { |
|
940 | 940 | /* translators: 1: Plugin version number. 2: Plugin author name. */ |
941 | - $plugin_version_string = sprintf( __( 'Version %1$s by %2$s' ), $plugin_version, $plugin_author ); |
|
942 | - $plugin_version_string_debug = sprintf( 'version: %s, author: %s', $plugin_version, $plugin_author ); |
|
941 | + $plugin_version_string = sprintf(__('Version %1$s by %2$s'), $plugin_version, $plugin_author); |
|
942 | + $plugin_version_string_debug = sprintf('version: %s, author: %s', $plugin_version, $plugin_author); |
|
943 | 943 | } else { |
944 | - if ( ! empty( $plugin_author ) ) { |
|
944 | + if (!empty($plugin_author)) { |
|
945 | 945 | /* translators: %s: Plugin author name. */ |
946 | - $plugin_version_string = sprintf( __( 'By %s' ), $plugin_author ); |
|
947 | - $plugin_version_string_debug = sprintf( 'author: %s, version: (undefined)', $plugin_author ); |
|
946 | + $plugin_version_string = sprintf(__('By %s'), $plugin_author); |
|
947 | + $plugin_version_string_debug = sprintf('author: %s, version: (undefined)', $plugin_author); |
|
948 | 948 | } |
949 | 949 | |
950 | - if ( ! empty( $plugin_version ) ) { |
|
950 | + if (!empty($plugin_version)) { |
|
951 | 951 | /* translators: %s: Plugin version number. */ |
952 | - $plugin_version_string = sprintf( __( 'Version %s' ), $plugin_version ); |
|
953 | - $plugin_version_string_debug = sprintf( 'author: (undefined), version: %s', $plugin_version ); |
|
952 | + $plugin_version_string = sprintf(__('Version %s'), $plugin_version); |
|
953 | + $plugin_version_string_debug = sprintf('author: (undefined), version: %s', $plugin_version); |
|
954 | 954 | } |
955 | 955 | } |
956 | 956 | |
957 | - $info['wp-mu-plugins']['fields'][ sanitize_text_field( $plugin['Name'] ) ] = array( |
|
957 | + $info['wp-mu-plugins']['fields'][sanitize_text_field($plugin['Name'])] = array( |
|
958 | 958 | 'label' => $plugin['Name'], |
959 | 959 | 'value' => $plugin_version_string, |
960 | 960 | 'debug' => $plugin_version_string_debug, |
@@ -964,54 +964,54 @@ discard block |
||
964 | 964 | // List all available plugins. |
965 | 965 | $plugins = get_plugins(); |
966 | 966 | $plugin_updates = get_plugin_updates(); |
967 | - $transient = get_site_transient( 'update_plugins' ); |
|
967 | + $transient = get_site_transient('update_plugins'); |
|
968 | 968 | |
969 | 969 | $auto_updates = array(); |
970 | 970 | |
971 | - $auto_updates_enabled = wp_is_auto_update_enabled_for_type( 'plugin' ); |
|
971 | + $auto_updates_enabled = wp_is_auto_update_enabled_for_type('plugin'); |
|
972 | 972 | |
973 | - if ( $auto_updates_enabled ) { |
|
974 | - $auto_updates = (array) get_site_option( 'auto_update_plugins', array() ); |
|
973 | + if ($auto_updates_enabled) { |
|
974 | + $auto_updates = (array) get_site_option('auto_update_plugins', array()); |
|
975 | 975 | } |
976 | 976 | |
977 | - foreach ( $plugins as $plugin_path => $plugin ) { |
|
978 | - $plugin_part = ( is_plugin_active( $plugin_path ) ) ? 'wp-plugins-active' : 'wp-plugins-inactive'; |
|
977 | + foreach ($plugins as $plugin_path => $plugin) { |
|
978 | + $plugin_part = (is_plugin_active($plugin_path)) ? 'wp-plugins-active' : 'wp-plugins-inactive'; |
|
979 | 979 | |
980 | 980 | $plugin_version = $plugin['Version']; |
981 | 981 | $plugin_author = $plugin['Author']; |
982 | 982 | |
983 | - $plugin_version_string = __( 'No version or author information is available.' ); |
|
983 | + $plugin_version_string = __('No version or author information is available.'); |
|
984 | 984 | $plugin_version_string_debug = 'author: (undefined), version: (undefined)'; |
985 | 985 | |
986 | - if ( ! empty( $plugin_version ) && ! empty( $plugin_author ) ) { |
|
986 | + if (!empty($plugin_version) && !empty($plugin_author)) { |
|
987 | 987 | /* translators: 1: Plugin version number. 2: Plugin author name. */ |
988 | - $plugin_version_string = sprintf( __( 'Version %1$s by %2$s' ), $plugin_version, $plugin_author ); |
|
989 | - $plugin_version_string_debug = sprintf( 'version: %s, author: %s', $plugin_version, $plugin_author ); |
|
988 | + $plugin_version_string = sprintf(__('Version %1$s by %2$s'), $plugin_version, $plugin_author); |
|
989 | + $plugin_version_string_debug = sprintf('version: %s, author: %s', $plugin_version, $plugin_author); |
|
990 | 990 | } else { |
991 | - if ( ! empty( $plugin_author ) ) { |
|
991 | + if (!empty($plugin_author)) { |
|
992 | 992 | /* translators: %s: Plugin author name. */ |
993 | - $plugin_version_string = sprintf( __( 'By %s' ), $plugin_author ); |
|
994 | - $plugin_version_string_debug = sprintf( 'author: %s, version: (undefined)', $plugin_author ); |
|
993 | + $plugin_version_string = sprintf(__('By %s'), $plugin_author); |
|
994 | + $plugin_version_string_debug = sprintf('author: %s, version: (undefined)', $plugin_author); |
|
995 | 995 | } |
996 | 996 | |
997 | - if ( ! empty( $plugin_version ) ) { |
|
997 | + if (!empty($plugin_version)) { |
|
998 | 998 | /* translators: %s: Plugin version number. */ |
999 | - $plugin_version_string = sprintf( __( 'Version %s' ), $plugin_version ); |
|
1000 | - $plugin_version_string_debug = sprintf( 'author: (undefined), version: %s', $plugin_version ); |
|
999 | + $plugin_version_string = sprintf(__('Version %s'), $plugin_version); |
|
1000 | + $plugin_version_string_debug = sprintf('author: (undefined), version: %s', $plugin_version); |
|
1001 | 1001 | } |
1002 | 1002 | } |
1003 | 1003 | |
1004 | - if ( array_key_exists( $plugin_path, $plugin_updates ) ) { |
|
1004 | + if (array_key_exists($plugin_path, $plugin_updates)) { |
|
1005 | 1005 | /* translators: %s: Latest plugin version number. */ |
1006 | - $plugin_version_string .= ' ' . sprintf( __( '(Latest version: %s)' ), $plugin_updates[ $plugin_path ]->update->new_version ); |
|
1007 | - $plugin_version_string_debug .= sprintf( ' (latest version: %s)', $plugin_updates[ $plugin_path ]->update->new_version ); |
|
1006 | + $plugin_version_string .= ' ' . sprintf(__('(Latest version: %s)'), $plugin_updates[$plugin_path]->update->new_version); |
|
1007 | + $plugin_version_string_debug .= sprintf(' (latest version: %s)', $plugin_updates[$plugin_path]->update->new_version); |
|
1008 | 1008 | } |
1009 | 1009 | |
1010 | - if ( $auto_updates_enabled ) { |
|
1011 | - if ( isset( $transient->response[ $plugin_path ] ) ) { |
|
1012 | - $item = $transient->response[ $plugin_path ]; |
|
1013 | - } elseif ( isset( $transient->no_update[ $plugin_path ] ) ) { |
|
1014 | - $item = $transient->no_update[ $plugin_path ]; |
|
1010 | + if ($auto_updates_enabled) { |
|
1011 | + if (isset($transient->response[$plugin_path])) { |
|
1012 | + $item = $transient->response[$plugin_path]; |
|
1013 | + } elseif (isset($transient->no_update[$plugin_path])) { |
|
1014 | + $item = $transient->no_update[$plugin_path]; |
|
1015 | 1015 | } else { |
1016 | 1016 | $item = array( |
1017 | 1017 | 'id' => $plugin_path, |
@@ -1027,21 +1027,21 @@ discard block |
||
1027 | 1027 | 'requires_php' => '', |
1028 | 1028 | 'compatibility' => new stdClass(), |
1029 | 1029 | ); |
1030 | - $item = wp_parse_args( $plugin, $item ); |
|
1030 | + $item = wp_parse_args($plugin, $item); |
|
1031 | 1031 | } |
1032 | 1032 | |
1033 | - $auto_update_forced = wp_is_auto_update_forced_for_item( 'plugin', null, (object) $item ); |
|
1033 | + $auto_update_forced = wp_is_auto_update_forced_for_item('plugin', null, (object) $item); |
|
1034 | 1034 | |
1035 | - if ( ! is_null( $auto_update_forced ) ) { |
|
1035 | + if (!is_null($auto_update_forced)) { |
|
1036 | 1036 | $enabled = $auto_update_forced; |
1037 | 1037 | } else { |
1038 | - $enabled = in_array( $plugin_path, $auto_updates, true ); |
|
1038 | + $enabled = in_array($plugin_path, $auto_updates, true); |
|
1039 | 1039 | } |
1040 | 1040 | |
1041 | - if ( $enabled ) { |
|
1042 | - $auto_updates_string = __( 'Auto-updates enabled' ); |
|
1041 | + if ($enabled) { |
|
1042 | + $auto_updates_string = __('Auto-updates enabled'); |
|
1043 | 1043 | } else { |
1044 | - $auto_updates_string = __( 'Auto-updates disabled' ); |
|
1044 | + $auto_updates_string = __('Auto-updates disabled'); |
|
1045 | 1045 | } |
1046 | 1046 | |
1047 | 1047 | /** |
@@ -1054,13 +1054,13 @@ discard block |
||
1054 | 1054 | * @param array $plugin An array of plugin data. |
1055 | 1055 | * @param bool $enabled Whether auto-updates are enabled for this item. |
1056 | 1056 | */ |
1057 | - $auto_updates_string = apply_filters( 'plugin_auto_update_debug_string', $auto_updates_string, $plugin_path, $plugin, $enabled ); |
|
1057 | + $auto_updates_string = apply_filters('plugin_auto_update_debug_string', $auto_updates_string, $plugin_path, $plugin, $enabled); |
|
1058 | 1058 | |
1059 | 1059 | $plugin_version_string .= ' | ' . $auto_updates_string; |
1060 | 1060 | $plugin_version_string_debug .= ', ' . $auto_updates_string; |
1061 | 1061 | } |
1062 | 1062 | |
1063 | - $info[ $plugin_part ]['fields'][ sanitize_text_field( $plugin['Name'] ) ] = array( |
|
1063 | + $info[$plugin_part]['fields'][sanitize_text_field($plugin['Name'])] = array( |
|
1064 | 1064 | 'label' => $plugin['Name'], |
1065 | 1065 | 'value' => $plugin_version_string, |
1066 | 1066 | 'debug' => $plugin_version_string_debug, |
@@ -1071,39 +1071,39 @@ discard block |
||
1071 | 1071 | global $_wp_theme_features; |
1072 | 1072 | $theme_features = array(); |
1073 | 1073 | |
1074 | - if ( ! empty( $_wp_theme_features ) ) { |
|
1075 | - foreach ( $_wp_theme_features as $feature => $options ) { |
|
1074 | + if (!empty($_wp_theme_features)) { |
|
1075 | + foreach ($_wp_theme_features as $feature => $options) { |
|
1076 | 1076 | $theme_features[] = $feature; |
1077 | 1077 | } |
1078 | 1078 | } |
1079 | 1079 | |
1080 | 1080 | $active_theme = wp_get_theme(); |
1081 | 1081 | $theme_updates = get_theme_updates(); |
1082 | - $transient = get_site_transient( 'update_themes' ); |
|
1082 | + $transient = get_site_transient('update_themes'); |
|
1083 | 1083 | |
1084 | 1084 | $active_theme_version = $active_theme->version; |
1085 | 1085 | $active_theme_version_debug = $active_theme_version; |
1086 | 1086 | |
1087 | 1087 | $auto_updates = array(); |
1088 | - $auto_updates_enabled = wp_is_auto_update_enabled_for_type( 'theme' ); |
|
1089 | - if ( $auto_updates_enabled ) { |
|
1090 | - $auto_updates = (array) get_site_option( 'auto_update_themes', array() ); |
|
1088 | + $auto_updates_enabled = wp_is_auto_update_enabled_for_type('theme'); |
|
1089 | + if ($auto_updates_enabled) { |
|
1090 | + $auto_updates = (array) get_site_option('auto_update_themes', array()); |
|
1091 | 1091 | } |
1092 | 1092 | |
1093 | - if ( array_key_exists( $active_theme->stylesheet, $theme_updates ) ) { |
|
1094 | - $theme_update_new_version = $theme_updates[ $active_theme->stylesheet ]->update['new_version']; |
|
1093 | + if (array_key_exists($active_theme->stylesheet, $theme_updates)) { |
|
1094 | + $theme_update_new_version = $theme_updates[$active_theme->stylesheet]->update['new_version']; |
|
1095 | 1095 | |
1096 | 1096 | /* translators: %s: Latest theme version number. */ |
1097 | - $active_theme_version .= ' ' . sprintf( __( '(Latest version: %s)' ), $theme_update_new_version ); |
|
1098 | - $active_theme_version_debug .= sprintf( ' (latest version: %s)', $theme_update_new_version ); |
|
1097 | + $active_theme_version .= ' ' . sprintf(__('(Latest version: %s)'), $theme_update_new_version); |
|
1098 | + $active_theme_version_debug .= sprintf(' (latest version: %s)', $theme_update_new_version); |
|
1099 | 1099 | } |
1100 | 1100 | |
1101 | - $active_theme_author_uri = $active_theme->display( 'AuthorURI' ); |
|
1101 | + $active_theme_author_uri = $active_theme->display('AuthorURI'); |
|
1102 | 1102 | |
1103 | - if ( $active_theme->parent_theme ) { |
|
1103 | + if ($active_theme->parent_theme) { |
|
1104 | 1104 | $active_theme_parent_theme = sprintf( |
1105 | 1105 | /* translators: 1: Theme name. 2: Theme slug. */ |
1106 | - __( '%1$s (%2$s)' ), |
|
1106 | + __('%1$s (%2$s)'), |
|
1107 | 1107 | $active_theme->parent_theme, |
1108 | 1108 | $active_theme->template |
1109 | 1109 | ); |
@@ -1113,54 +1113,54 @@ discard block |
||
1113 | 1113 | $active_theme->template |
1114 | 1114 | ); |
1115 | 1115 | } else { |
1116 | - $active_theme_parent_theme = __( 'None' ); |
|
1116 | + $active_theme_parent_theme = __('None'); |
|
1117 | 1117 | $active_theme_parent_theme_debug = 'none'; |
1118 | 1118 | } |
1119 | 1119 | |
1120 | 1120 | $info['wp-active-theme']['fields'] = array( |
1121 | 1121 | 'name' => array( |
1122 | - 'label' => __( 'Name' ), |
|
1122 | + 'label' => __('Name'), |
|
1123 | 1123 | 'value' => sprintf( |
1124 | 1124 | /* translators: 1: Theme name. 2: Theme slug. */ |
1125 | - __( '%1$s (%2$s)' ), |
|
1125 | + __('%1$s (%2$s)'), |
|
1126 | 1126 | $active_theme->name, |
1127 | 1127 | $active_theme->stylesheet |
1128 | 1128 | ), |
1129 | 1129 | ), |
1130 | 1130 | 'version' => array( |
1131 | - 'label' => __( 'Version' ), |
|
1131 | + 'label' => __('Version'), |
|
1132 | 1132 | 'value' => $active_theme_version, |
1133 | 1133 | 'debug' => $active_theme_version_debug, |
1134 | 1134 | ), |
1135 | 1135 | 'author' => array( |
1136 | - 'label' => __( 'Author' ), |
|
1137 | - 'value' => wp_kses( $active_theme->author, array() ), |
|
1136 | + 'label' => __('Author'), |
|
1137 | + 'value' => wp_kses($active_theme->author, array()), |
|
1138 | 1138 | ), |
1139 | 1139 | 'author_website' => array( |
1140 | - 'label' => __( 'Author website' ), |
|
1141 | - 'value' => ( $active_theme_author_uri ? $active_theme_author_uri : __( 'Undefined' ) ), |
|
1142 | - 'debug' => ( $active_theme_author_uri ? $active_theme_author_uri : '(undefined)' ), |
|
1140 | + 'label' => __('Author website'), |
|
1141 | + 'value' => ($active_theme_author_uri ? $active_theme_author_uri : __('Undefined')), |
|
1142 | + 'debug' => ($active_theme_author_uri ? $active_theme_author_uri : '(undefined)'), |
|
1143 | 1143 | ), |
1144 | 1144 | 'parent_theme' => array( |
1145 | - 'label' => __( 'Parent theme' ), |
|
1145 | + 'label' => __('Parent theme'), |
|
1146 | 1146 | 'value' => $active_theme_parent_theme, |
1147 | 1147 | 'debug' => $active_theme_parent_theme_debug, |
1148 | 1148 | ), |
1149 | 1149 | 'theme_features' => array( |
1150 | - 'label' => __( 'Theme features' ), |
|
1151 | - 'value' => implode( ', ', $theme_features ), |
|
1150 | + 'label' => __('Theme features'), |
|
1151 | + 'value' => implode(', ', $theme_features), |
|
1152 | 1152 | ), |
1153 | 1153 | 'theme_path' => array( |
1154 | - 'label' => __( 'Theme directory location' ), |
|
1154 | + 'label' => __('Theme directory location'), |
|
1155 | 1155 | 'value' => get_stylesheet_directory(), |
1156 | 1156 | ), |
1157 | 1157 | ); |
1158 | 1158 | |
1159 | - if ( $auto_updates_enabled ) { |
|
1160 | - if ( isset( $transient->response[ $active_theme->stylesheet ] ) ) { |
|
1161 | - $item = $transient->response[ $active_theme->stylesheet ]; |
|
1162 | - } elseif ( isset( $transient->no_update[ $active_theme->stylesheet ] ) ) { |
|
1163 | - $item = $transient->no_update[ $active_theme->stylesheet ]; |
|
1159 | + if ($auto_updates_enabled) { |
|
1160 | + if (isset($transient->response[$active_theme->stylesheet])) { |
|
1161 | + $item = $transient->response[$active_theme->stylesheet]; |
|
1162 | + } elseif (isset($transient->no_update[$active_theme->stylesheet])) { |
|
1163 | + $item = $transient->no_update[$active_theme->stylesheet]; |
|
1164 | 1164 | } else { |
1165 | 1165 | $item = array( |
1166 | 1166 | 'theme' => $active_theme->stylesheet, |
@@ -1172,25 +1172,25 @@ discard block |
||
1172 | 1172 | ); |
1173 | 1173 | } |
1174 | 1174 | |
1175 | - $auto_update_forced = wp_is_auto_update_forced_for_item( 'theme', null, (object) $item ); |
|
1175 | + $auto_update_forced = wp_is_auto_update_forced_for_item('theme', null, (object) $item); |
|
1176 | 1176 | |
1177 | - if ( ! is_null( $auto_update_forced ) ) { |
|
1177 | + if (!is_null($auto_update_forced)) { |
|
1178 | 1178 | $enabled = $auto_update_forced; |
1179 | 1179 | } else { |
1180 | - $enabled = in_array( $active_theme->stylesheet, $auto_updates, true ); |
|
1180 | + $enabled = in_array($active_theme->stylesheet, $auto_updates, true); |
|
1181 | 1181 | } |
1182 | 1182 | |
1183 | - if ( $enabled ) { |
|
1184 | - $auto_updates_string = __( 'Enabled' ); |
|
1183 | + if ($enabled) { |
|
1184 | + $auto_updates_string = __('Enabled'); |
|
1185 | 1185 | } else { |
1186 | - $auto_updates_string = __( 'Disabled' ); |
|
1186 | + $auto_updates_string = __('Disabled'); |
|
1187 | 1187 | } |
1188 | 1188 | |
1189 | 1189 | /** This filter is documented in wp-admin/includes/class-wp-debug-data.php */ |
1190 | - $auto_updates_string = apply_filters( 'theme_auto_update_debug_string', $auto_updates_string, $active_theme, $enabled ); |
|
1190 | + $auto_updates_string = apply_filters('theme_auto_update_debug_string', $auto_updates_string, $active_theme, $enabled); |
|
1191 | 1191 | |
1192 | 1192 | $info['wp-active-theme']['fields']['auto_update'] = array( |
1193 | - 'label' => __( 'Auto-updates' ), |
|
1193 | + 'label' => __('Auto-updates'), |
|
1194 | 1194 | 'value' => $auto_updates_string, |
1195 | 1195 | 'debug' => $auto_updates_string, |
1196 | 1196 | ); |
@@ -1198,55 +1198,55 @@ discard block |
||
1198 | 1198 | |
1199 | 1199 | $parent_theme = $active_theme->parent(); |
1200 | 1200 | |
1201 | - if ( $parent_theme ) { |
|
1201 | + if ($parent_theme) { |
|
1202 | 1202 | $parent_theme_version = $parent_theme->version; |
1203 | 1203 | $parent_theme_version_debug = $parent_theme_version; |
1204 | 1204 | |
1205 | - if ( array_key_exists( $parent_theme->stylesheet, $theme_updates ) ) { |
|
1206 | - $parent_theme_update_new_version = $theme_updates[ $parent_theme->stylesheet ]->update['new_version']; |
|
1205 | + if (array_key_exists($parent_theme->stylesheet, $theme_updates)) { |
|
1206 | + $parent_theme_update_new_version = $theme_updates[$parent_theme->stylesheet]->update['new_version']; |
|
1207 | 1207 | |
1208 | 1208 | /* translators: %s: Latest theme version number. */ |
1209 | - $parent_theme_version .= ' ' . sprintf( __( '(Latest version: %s)' ), $parent_theme_update_new_version ); |
|
1210 | - $parent_theme_version_debug .= sprintf( ' (latest version: %s)', $parent_theme_update_new_version ); |
|
1209 | + $parent_theme_version .= ' ' . sprintf(__('(Latest version: %s)'), $parent_theme_update_new_version); |
|
1210 | + $parent_theme_version_debug .= sprintf(' (latest version: %s)', $parent_theme_update_new_version); |
|
1211 | 1211 | } |
1212 | 1212 | |
1213 | - $parent_theme_author_uri = $parent_theme->display( 'AuthorURI' ); |
|
1213 | + $parent_theme_author_uri = $parent_theme->display('AuthorURI'); |
|
1214 | 1214 | |
1215 | 1215 | $info['wp-parent-theme']['fields'] = array( |
1216 | 1216 | 'name' => array( |
1217 | - 'label' => __( 'Name' ), |
|
1217 | + 'label' => __('Name'), |
|
1218 | 1218 | 'value' => sprintf( |
1219 | 1219 | /* translators: 1: Theme name. 2: Theme slug. */ |
1220 | - __( '%1$s (%2$s)' ), |
|
1220 | + __('%1$s (%2$s)'), |
|
1221 | 1221 | $parent_theme->name, |
1222 | 1222 | $parent_theme->stylesheet |
1223 | 1223 | ), |
1224 | 1224 | ), |
1225 | 1225 | 'version' => array( |
1226 | - 'label' => __( 'Version' ), |
|
1226 | + 'label' => __('Version'), |
|
1227 | 1227 | 'value' => $parent_theme_version, |
1228 | 1228 | 'debug' => $parent_theme_version_debug, |
1229 | 1229 | ), |
1230 | 1230 | 'author' => array( |
1231 | - 'label' => __( 'Author' ), |
|
1232 | - 'value' => wp_kses( $parent_theme->author, array() ), |
|
1231 | + 'label' => __('Author'), |
|
1232 | + 'value' => wp_kses($parent_theme->author, array()), |
|
1233 | 1233 | ), |
1234 | 1234 | 'author_website' => array( |
1235 | - 'label' => __( 'Author website' ), |
|
1236 | - 'value' => ( $parent_theme_author_uri ? $parent_theme_author_uri : __( 'Undefined' ) ), |
|
1237 | - 'debug' => ( $parent_theme_author_uri ? $parent_theme_author_uri : '(undefined)' ), |
|
1235 | + 'label' => __('Author website'), |
|
1236 | + 'value' => ($parent_theme_author_uri ? $parent_theme_author_uri : __('Undefined')), |
|
1237 | + 'debug' => ($parent_theme_author_uri ? $parent_theme_author_uri : '(undefined)'), |
|
1238 | 1238 | ), |
1239 | 1239 | 'theme_path' => array( |
1240 | - 'label' => __( 'Theme directory location' ), |
|
1240 | + 'label' => __('Theme directory location'), |
|
1241 | 1241 | 'value' => get_template_directory(), |
1242 | 1242 | ), |
1243 | 1243 | ); |
1244 | 1244 | |
1245 | - if ( $auto_updates_enabled ) { |
|
1246 | - if ( isset( $transient->response[ $parent_theme->stylesheet ] ) ) { |
|
1247 | - $item = $transient->response[ $parent_theme->stylesheet ]; |
|
1248 | - } elseif ( isset( $transient->no_update[ $parent_theme->stylesheet ] ) ) { |
|
1249 | - $item = $transient->no_update[ $parent_theme->stylesheet ]; |
|
1245 | + if ($auto_updates_enabled) { |
|
1246 | + if (isset($transient->response[$parent_theme->stylesheet])) { |
|
1247 | + $item = $transient->response[$parent_theme->stylesheet]; |
|
1248 | + } elseif (isset($transient->no_update[$parent_theme->stylesheet])) { |
|
1249 | + $item = $transient->no_update[$parent_theme->stylesheet]; |
|
1250 | 1250 | } else { |
1251 | 1251 | $item = array( |
1252 | 1252 | 'theme' => $parent_theme->stylesheet, |
@@ -1258,25 +1258,25 @@ discard block |
||
1258 | 1258 | ); |
1259 | 1259 | } |
1260 | 1260 | |
1261 | - $auto_update_forced = wp_is_auto_update_forced_for_item( 'theme', null, (object) $item ); |
|
1261 | + $auto_update_forced = wp_is_auto_update_forced_for_item('theme', null, (object) $item); |
|
1262 | 1262 | |
1263 | - if ( ! is_null( $auto_update_forced ) ) { |
|
1263 | + if (!is_null($auto_update_forced)) { |
|
1264 | 1264 | $enabled = $auto_update_forced; |
1265 | 1265 | } else { |
1266 | - $enabled = in_array( $parent_theme->stylesheet, $auto_updates, true ); |
|
1266 | + $enabled = in_array($parent_theme->stylesheet, $auto_updates, true); |
|
1267 | 1267 | } |
1268 | 1268 | |
1269 | - if ( $enabled ) { |
|
1270 | - $parent_theme_auto_update_string = __( 'Enabled' ); |
|
1269 | + if ($enabled) { |
|
1270 | + $parent_theme_auto_update_string = __('Enabled'); |
|
1271 | 1271 | } else { |
1272 | - $parent_theme_auto_update_string = __( 'Disabled' ); |
|
1272 | + $parent_theme_auto_update_string = __('Disabled'); |
|
1273 | 1273 | } |
1274 | 1274 | |
1275 | 1275 | /** This filter is documented in wp-admin/includes/class-wp-debug-data.php */ |
1276 | - $parent_theme_auto_update_string = apply_filters( 'theme_auto_update_debug_string', $auto_updates_string, $parent_theme, $enabled ); |
|
1276 | + $parent_theme_auto_update_string = apply_filters('theme_auto_update_debug_string', $auto_updates_string, $parent_theme, $enabled); |
|
1277 | 1277 | |
1278 | 1278 | $info['wp-parent-theme']['fields']['auto_update'] = array( |
1279 | - 'label' => __( 'Auto-update' ), |
|
1279 | + 'label' => __('Auto-update'), |
|
1280 | 1280 | 'value' => $parent_theme_auto_update_string, |
1281 | 1281 | 'debug' => $parent_theme_auto_update_string, |
1282 | 1282 | ); |
@@ -1286,14 +1286,14 @@ discard block |
||
1286 | 1286 | // Populate a list of all themes available in the install. |
1287 | 1287 | $all_themes = wp_get_themes(); |
1288 | 1288 | |
1289 | - foreach ( $all_themes as $theme_slug => $theme ) { |
|
1289 | + foreach ($all_themes as $theme_slug => $theme) { |
|
1290 | 1290 | // Exclude the currently active theme from the list of all themes. |
1291 | - if ( $active_theme->stylesheet === $theme_slug ) { |
|
1291 | + if ($active_theme->stylesheet === $theme_slug) { |
|
1292 | 1292 | continue; |
1293 | 1293 | } |
1294 | 1294 | |
1295 | 1295 | // Exclude the currently active parent theme from the list of all themes. |
1296 | - if ( ! empty( $parent_theme ) && $parent_theme->stylesheet === $theme_slug ) { |
|
1296 | + if (!empty($parent_theme) && $parent_theme->stylesheet === $theme_slug) { |
|
1297 | 1297 | continue; |
1298 | 1298 | } |
1299 | 1299 | |
@@ -1301,40 +1301,40 @@ discard block |
||
1301 | 1301 | $theme_author = $theme->author; |
1302 | 1302 | |
1303 | 1303 | // Sanitize. |
1304 | - $theme_author = wp_kses( $theme_author, array() ); |
|
1304 | + $theme_author = wp_kses($theme_author, array()); |
|
1305 | 1305 | |
1306 | - $theme_version_string = __( 'No version or author information is available.' ); |
|
1306 | + $theme_version_string = __('No version or author information is available.'); |
|
1307 | 1307 | $theme_version_string_debug = 'undefined'; |
1308 | 1308 | |
1309 | - if ( ! empty( $theme_version ) && ! empty( $theme_author ) ) { |
|
1309 | + if (!empty($theme_version) && !empty($theme_author)) { |
|
1310 | 1310 | /* translators: 1: Theme version number. 2: Theme author name. */ |
1311 | - $theme_version_string = sprintf( __( 'Version %1$s by %2$s' ), $theme_version, $theme_author ); |
|
1312 | - $theme_version_string_debug = sprintf( 'version: %s, author: %s', $theme_version, $theme_author ); |
|
1311 | + $theme_version_string = sprintf(__('Version %1$s by %2$s'), $theme_version, $theme_author); |
|
1312 | + $theme_version_string_debug = sprintf('version: %s, author: %s', $theme_version, $theme_author); |
|
1313 | 1313 | } else { |
1314 | - if ( ! empty( $theme_author ) ) { |
|
1314 | + if (!empty($theme_author)) { |
|
1315 | 1315 | /* translators: %s: Theme author name. */ |
1316 | - $theme_version_string = sprintf( __( 'By %s' ), $theme_author ); |
|
1317 | - $theme_version_string_debug = sprintf( 'author: %s, version: (undefined)', $theme_author ); |
|
1316 | + $theme_version_string = sprintf(__('By %s'), $theme_author); |
|
1317 | + $theme_version_string_debug = sprintf('author: %s, version: (undefined)', $theme_author); |
|
1318 | 1318 | } |
1319 | 1319 | |
1320 | - if ( ! empty( $theme_version ) ) { |
|
1320 | + if (!empty($theme_version)) { |
|
1321 | 1321 | /* translators: %s: Theme version number. */ |
1322 | - $theme_version_string = sprintf( __( 'Version %s' ), $theme_version ); |
|
1323 | - $theme_version_string_debug = sprintf( 'author: (undefined), version: %s', $theme_version ); |
|
1322 | + $theme_version_string = sprintf(__('Version %s'), $theme_version); |
|
1323 | + $theme_version_string_debug = sprintf('author: (undefined), version: %s', $theme_version); |
|
1324 | 1324 | } |
1325 | 1325 | } |
1326 | 1326 | |
1327 | - if ( array_key_exists( $theme_slug, $theme_updates ) ) { |
|
1327 | + if (array_key_exists($theme_slug, $theme_updates)) { |
|
1328 | 1328 | /* translators: %s: Latest theme version number. */ |
1329 | - $theme_version_string .= ' ' . sprintf( __( '(Latest version: %s)' ), $theme_updates[ $theme_slug ]->update['new_version'] ); |
|
1330 | - $theme_version_string_debug .= sprintf( ' (latest version: %s)', $theme_updates[ $theme_slug ]->update['new_version'] ); |
|
1329 | + $theme_version_string .= ' ' . sprintf(__('(Latest version: %s)'), $theme_updates[$theme_slug]->update['new_version']); |
|
1330 | + $theme_version_string_debug .= sprintf(' (latest version: %s)', $theme_updates[$theme_slug]->update['new_version']); |
|
1331 | 1331 | } |
1332 | 1332 | |
1333 | - if ( $auto_updates_enabled ) { |
|
1334 | - if ( isset( $transient->response[ $theme_slug ] ) ) { |
|
1335 | - $item = $transient->response[ $theme_slug ]; |
|
1336 | - } elseif ( isset( $transient->no_update[ $theme_slug ] ) ) { |
|
1337 | - $item = $transient->no_update[ $theme_slug ]; |
|
1333 | + if ($auto_updates_enabled) { |
|
1334 | + if (isset($transient->response[$theme_slug])) { |
|
1335 | + $item = $transient->response[$theme_slug]; |
|
1336 | + } elseif (isset($transient->no_update[$theme_slug])) { |
|
1337 | + $item = $transient->no_update[$theme_slug]; |
|
1338 | 1338 | } else { |
1339 | 1339 | $item = array( |
1340 | 1340 | 'theme' => $theme_slug, |
@@ -1346,18 +1346,18 @@ discard block |
||
1346 | 1346 | ); |
1347 | 1347 | } |
1348 | 1348 | |
1349 | - $auto_update_forced = wp_is_auto_update_forced_for_item( 'theme', null, (object) $item ); |
|
1349 | + $auto_update_forced = wp_is_auto_update_forced_for_item('theme', null, (object) $item); |
|
1350 | 1350 | |
1351 | - if ( ! is_null( $auto_update_forced ) ) { |
|
1351 | + if (!is_null($auto_update_forced)) { |
|
1352 | 1352 | $enabled = $auto_update_forced; |
1353 | 1353 | } else { |
1354 | - $enabled = in_array( $theme_slug, $auto_updates, true ); |
|
1354 | + $enabled = in_array($theme_slug, $auto_updates, true); |
|
1355 | 1355 | } |
1356 | 1356 | |
1357 | - if ( $enabled ) { |
|
1358 | - $auto_updates_string = __( 'Auto-updates enabled' ); |
|
1357 | + if ($enabled) { |
|
1358 | + $auto_updates_string = __('Auto-updates enabled'); |
|
1359 | 1359 | } else { |
1360 | - $auto_updates_string = __( 'Auto-updates disabled' ); |
|
1360 | + $auto_updates_string = __('Auto-updates disabled'); |
|
1361 | 1361 | } |
1362 | 1362 | |
1363 | 1363 | /** |
@@ -1369,16 +1369,16 @@ discard block |
||
1369 | 1369 | * @param WP_Theme $theme An object of theme data. |
1370 | 1370 | * @param bool $enabled Whether auto-updates are enabled for this item. |
1371 | 1371 | */ |
1372 | - $auto_updates_string = apply_filters( 'theme_auto_update_debug_string', $auto_updates_string, $theme, $enabled ); |
|
1372 | + $auto_updates_string = apply_filters('theme_auto_update_debug_string', $auto_updates_string, $theme, $enabled); |
|
1373 | 1373 | |
1374 | 1374 | $theme_version_string .= ' | ' . $auto_updates_string; |
1375 | 1375 | $theme_version_string_debug .= ', ' . $auto_updates_string; |
1376 | 1376 | } |
1377 | 1377 | |
1378 | - $info['wp-themes-inactive']['fields'][ sanitize_text_field( $theme->name ) ] = array( |
|
1378 | + $info['wp-themes-inactive']['fields'][sanitize_text_field($theme->name)] = array( |
|
1379 | 1379 | 'label' => sprintf( |
1380 | 1380 | /* translators: 1: Theme name. 2: Theme slug. */ |
1381 | - __( '%1$s (%2$s)' ), |
|
1381 | + __('%1$s (%2$s)'), |
|
1382 | 1382 | $theme->name, |
1383 | 1383 | $theme_slug |
1384 | 1384 | ), |
@@ -1388,13 +1388,13 @@ discard block |
||
1388 | 1388 | } |
1389 | 1389 | |
1390 | 1390 | // Add more filesystem checks. |
1391 | - if ( defined( 'WPMU_PLUGIN_DIR' ) && is_dir( WPMU_PLUGIN_DIR ) ) { |
|
1392 | - $is_writable_wpmu_plugin_dir = wp_is_writable( WPMU_PLUGIN_DIR ); |
|
1391 | + if (defined('WPMU_PLUGIN_DIR') && is_dir(WPMU_PLUGIN_DIR)) { |
|
1392 | + $is_writable_wpmu_plugin_dir = wp_is_writable(WPMU_PLUGIN_DIR); |
|
1393 | 1393 | |
1394 | 1394 | $info['wp-filesystem']['fields']['mu-plugins'] = array( |
1395 | - 'label' => __( 'The must use plugins directory' ), |
|
1396 | - 'value' => ( $is_writable_wpmu_plugin_dir ? __( 'Writable' ) : __( 'Not writable' ) ), |
|
1397 | - 'debug' => ( $is_writable_wpmu_plugin_dir ? 'writable' : 'not writable' ), |
|
1395 | + 'label' => __('The must use plugins directory'), |
|
1396 | + 'value' => ($is_writable_wpmu_plugin_dir ? __('Writable') : __('Not writable')), |
|
1397 | + 'debug' => ($is_writable_wpmu_plugin_dir ? 'writable' : 'not writable'), |
|
1398 | 1398 | ); |
1399 | 1399 | } |
1400 | 1400 | |
@@ -1458,7 +1458,7 @@ discard block |
||
1458 | 1458 | * } |
1459 | 1459 | * } |
1460 | 1460 | */ |
1461 | - $info = apply_filters( 'debug_information', $info ); |
|
1461 | + $info = apply_filters('debug_information', $info); |
|
1462 | 1462 | |
1463 | 1463 | return $info; |
1464 | 1464 | } |
@@ -1473,15 +1473,15 @@ discard block |
||
1473 | 1473 | * @param string $mysql_var Name of the MySQL system variable. |
1474 | 1474 | * @return string|null The variable value on success. Null if the variable does not exist. |
1475 | 1475 | */ |
1476 | - public static function get_mysql_var( $mysql_var ) { |
|
1476 | + public static function get_mysql_var($mysql_var) { |
|
1477 | 1477 | global $wpdb; |
1478 | 1478 | |
1479 | 1479 | $result = $wpdb->get_row( |
1480 | - $wpdb->prepare( 'SHOW VARIABLES LIKE %s', $mysql_var ), |
|
1480 | + $wpdb->prepare('SHOW VARIABLES LIKE %s', $mysql_var), |
|
1481 | 1481 | ARRAY_A |
1482 | 1482 | ); |
1483 | 1483 | |
1484 | - if ( ! empty( $result ) && array_key_exists( 'Value', $result ) ) { |
|
1484 | + if (!empty($result) && array_key_exists('Value', $result)) { |
|
1485 | 1485 | return $result['Value']; |
1486 | 1486 | } |
1487 | 1487 | |
@@ -1497,12 +1497,12 @@ discard block |
||
1497 | 1497 | * @param string $data_type The data type to return, either 'info' or 'debug'. |
1498 | 1498 | * @return string The formatted data. |
1499 | 1499 | */ |
1500 | - public static function format( $info_array, $data_type ) { |
|
1500 | + public static function format($info_array, $data_type) { |
|
1501 | 1501 | $return = "`\n"; |
1502 | 1502 | |
1503 | - foreach ( $info_array as $section => $details ) { |
|
1503 | + foreach ($info_array as $section => $details) { |
|
1504 | 1504 | // Skip this section if there are no fields, or the section has been declared as private. |
1505 | - if ( empty( $details['fields'] ) || ( isset( $details['private'] ) && $details['private'] ) ) { |
|
1505 | + if (empty($details['fields']) || (isset($details['private']) && $details['private'])) { |
|
1506 | 1506 | continue; |
1507 | 1507 | } |
1508 | 1508 | |
@@ -1511,42 +1511,42 @@ discard block |
||
1511 | 1511 | $return .= sprintf( |
1512 | 1512 | "### %s%s ###\n\n", |
1513 | 1513 | $section_label, |
1514 | - ( isset( $details['show_count'] ) && $details['show_count'] ? sprintf( ' (%d)', count( $details['fields'] ) ) : '' ) |
|
1514 | + (isset($details['show_count']) && $details['show_count'] ? sprintf(' (%d)', count($details['fields'])) : '') |
|
1515 | 1515 | ); |
1516 | 1516 | |
1517 | - foreach ( $details['fields'] as $field_name => $field ) { |
|
1518 | - if ( isset( $field['private'] ) && true === $field['private'] ) { |
|
1517 | + foreach ($details['fields'] as $field_name => $field) { |
|
1518 | + if (isset($field['private']) && true === $field['private']) { |
|
1519 | 1519 | continue; |
1520 | 1520 | } |
1521 | 1521 | |
1522 | - if ( 'debug' === $data_type && isset( $field['debug'] ) ) { |
|
1522 | + if ('debug' === $data_type && isset($field['debug'])) { |
|
1523 | 1523 | $debug_data = $field['debug']; |
1524 | 1524 | } else { |
1525 | 1525 | $debug_data = $field['value']; |
1526 | 1526 | } |
1527 | 1527 | |
1528 | 1528 | // Can be array, one level deep only. |
1529 | - if ( is_array( $debug_data ) ) { |
|
1529 | + if (is_array($debug_data)) { |
|
1530 | 1530 | $value = ''; |
1531 | 1531 | |
1532 | - foreach ( $debug_data as $sub_field_name => $sub_field_value ) { |
|
1533 | - $value .= sprintf( "\n\t%s: %s", $sub_field_name, $sub_field_value ); |
|
1532 | + foreach ($debug_data as $sub_field_name => $sub_field_value) { |
|
1533 | + $value .= sprintf("\n\t%s: %s", $sub_field_name, $sub_field_value); |
|
1534 | 1534 | } |
1535 | - } elseif ( is_bool( $debug_data ) ) { |
|
1535 | + } elseif (is_bool($debug_data)) { |
|
1536 | 1536 | $value = $debug_data ? 'true' : 'false'; |
1537 | - } elseif ( empty( $debug_data ) && '0' !== $debug_data ) { |
|
1537 | + } elseif (empty($debug_data) && '0' !== $debug_data) { |
|
1538 | 1538 | $value = 'undefined'; |
1539 | 1539 | } else { |
1540 | 1540 | $value = $debug_data; |
1541 | 1541 | } |
1542 | 1542 | |
1543 | - if ( 'debug' === $data_type ) { |
|
1543 | + if ('debug' === $data_type) { |
|
1544 | 1544 | $label = $field_name; |
1545 | 1545 | } else { |
1546 | 1546 | $label = $field['label']; |
1547 | 1547 | } |
1548 | 1548 | |
1549 | - $return .= sprintf( "%s: %s\n", $label, $value ); |
|
1549 | + $return .= sprintf("%s: %s\n", $label, $value); |
|
1550 | 1550 | } |
1551 | 1551 | |
1552 | 1552 | $return .= "\n"; |
@@ -1567,10 +1567,10 @@ discard block |
||
1567 | 1567 | public static function get_database_size() { |
1568 | 1568 | global $wpdb; |
1569 | 1569 | $size = 0; |
1570 | - $rows = $wpdb->get_results( 'SHOW TABLE STATUS', ARRAY_A ); |
|
1570 | + $rows = $wpdb->get_results('SHOW TABLE STATUS', ARRAY_A); |
|
1571 | 1571 | |
1572 | - if ( $wpdb->num_rows > 0 ) { |
|
1573 | - foreach ( $rows as $row ) { |
|
1572 | + if ($wpdb->num_rows > 0) { |
|
1573 | + foreach ($rows as $row) { |
|
1574 | 1574 | $size += $row['Data_length'] + $row['Index_length']; |
1575 | 1575 | } |
1576 | 1576 | } |
@@ -1595,17 +1595,17 @@ discard block |
||
1595 | 1595 | * from causing a timeout. The default value is 30 seconds, and some |
1596 | 1596 | * hosts do not allow you to read configuration values. |
1597 | 1597 | */ |
1598 | - if ( function_exists( 'ini_get' ) ) { |
|
1599 | - $max_execution_time = ini_get( 'max_execution_time' ); |
|
1598 | + if (function_exists('ini_get')) { |
|
1599 | + $max_execution_time = ini_get('max_execution_time'); |
|
1600 | 1600 | } |
1601 | 1601 | |
1602 | 1602 | // The max_execution_time defaults to 0 when PHP runs from cli. |
1603 | 1603 | // We still want to limit it below. |
1604 | - if ( empty( $max_execution_time ) ) { |
|
1604 | + if (empty($max_execution_time)) { |
|
1605 | 1605 | $max_execution_time = 30; |
1606 | 1606 | } |
1607 | 1607 | |
1608 | - if ( $max_execution_time > 20 ) { |
|
1608 | + if ($max_execution_time > 20) { |
|
1609 | 1609 | // If the max_execution_time is set to lower than 20 seconds, reduce it a bit to prevent |
1610 | 1610 | // edge-case timeouts that may happen after the size loop has finished running. |
1611 | 1611 | $max_execution_time -= 2; |
@@ -1614,64 +1614,64 @@ discard block |
||
1614 | 1614 | // Go through the various installation directories and calculate their sizes. |
1615 | 1615 | // No trailing slashes. |
1616 | 1616 | $paths = array( |
1617 | - 'wordpress_size' => untrailingslashit( ABSPATH ), |
|
1617 | + 'wordpress_size' => untrailingslashit(ABSPATH), |
|
1618 | 1618 | 'themes_size' => get_theme_root(), |
1619 | 1619 | 'plugins_size' => WP_PLUGIN_DIR, |
1620 | 1620 | 'uploads_size' => $upload_dir['basedir'], |
1621 | 1621 | ); |
1622 | 1622 | |
1623 | 1623 | $exclude = $paths; |
1624 | - unset( $exclude['wordpress_size'] ); |
|
1625 | - $exclude = array_values( $exclude ); |
|
1624 | + unset($exclude['wordpress_size']); |
|
1625 | + $exclude = array_values($exclude); |
|
1626 | 1626 | |
1627 | 1627 | $size_total = 0; |
1628 | 1628 | $all_sizes = array(); |
1629 | 1629 | |
1630 | 1630 | // Loop over all the directories we want to gather the sizes for. |
1631 | - foreach ( $paths as $name => $path ) { |
|
1631 | + foreach ($paths as $name => $path) { |
|
1632 | 1632 | $dir_size = null; // Default to timeout. |
1633 | 1633 | $results = array( |
1634 | 1634 | 'path' => $path, |
1635 | 1635 | 'raw' => 0, |
1636 | 1636 | ); |
1637 | 1637 | |
1638 | - if ( microtime( true ) - WP_START_TIMESTAMP < $max_execution_time ) { |
|
1639 | - if ( 'wordpress_size' === $name ) { |
|
1640 | - $dir_size = recurse_dirsize( $path, $exclude, $max_execution_time ); |
|
1638 | + if (microtime(true) - WP_START_TIMESTAMP < $max_execution_time) { |
|
1639 | + if ('wordpress_size' === $name) { |
|
1640 | + $dir_size = recurse_dirsize($path, $exclude, $max_execution_time); |
|
1641 | 1641 | } else { |
1642 | - $dir_size = recurse_dirsize( $path, null, $max_execution_time ); |
|
1642 | + $dir_size = recurse_dirsize($path, null, $max_execution_time); |
|
1643 | 1643 | } |
1644 | 1644 | } |
1645 | 1645 | |
1646 | - if ( false === $dir_size ) { |
|
1646 | + if (false === $dir_size) { |
|
1647 | 1647 | // Error reading. |
1648 | - $results['size'] = __( 'The size cannot be calculated. The directory is not accessible. Usually caused by invalid permissions.' ); |
|
1648 | + $results['size'] = __('The size cannot be calculated. The directory is not accessible. Usually caused by invalid permissions.'); |
|
1649 | 1649 | $results['debug'] = 'not accessible'; |
1650 | 1650 | |
1651 | 1651 | // Stop total size calculation. |
1652 | 1652 | $size_total = null; |
1653 | - } elseif ( null === $dir_size ) { |
|
1653 | + } elseif (null === $dir_size) { |
|
1654 | 1654 | // Timeout. |
1655 | - $results['size'] = __( 'The directory size calculation has timed out. Usually caused by a very large number of sub-directories and files.' ); |
|
1655 | + $results['size'] = __('The directory size calculation has timed out. Usually caused by a very large number of sub-directories and files.'); |
|
1656 | 1656 | $results['debug'] = 'timeout while calculating size'; |
1657 | 1657 | |
1658 | 1658 | // Stop total size calculation. |
1659 | 1659 | $size_total = null; |
1660 | 1660 | } else { |
1661 | - if ( null !== $size_total ) { |
|
1661 | + if (null !== $size_total) { |
|
1662 | 1662 | $size_total += $dir_size; |
1663 | 1663 | } |
1664 | 1664 | |
1665 | 1665 | $results['raw'] = $dir_size; |
1666 | - $results['size'] = size_format( $dir_size, 2 ); |
|
1666 | + $results['size'] = size_format($dir_size, 2); |
|
1667 | 1667 | $results['debug'] = $results['size'] . " ({$dir_size} bytes)"; |
1668 | 1668 | } |
1669 | 1669 | |
1670 | - $all_sizes[ $name ] = $results; |
|
1670 | + $all_sizes[$name] = $results; |
|
1671 | 1671 | } |
1672 | 1672 | |
1673 | - if ( $size_db > 0 ) { |
|
1674 | - $database_size = size_format( $size_db, 2 ); |
|
1673 | + if ($size_db > 0) { |
|
1674 | + $database_size = size_format($size_db, 2); |
|
1675 | 1675 | |
1676 | 1676 | $all_sizes['database_size'] = array( |
1677 | 1677 | 'raw' => $size_db, |
@@ -1680,14 +1680,14 @@ discard block |
||
1680 | 1680 | ); |
1681 | 1681 | } else { |
1682 | 1682 | $all_sizes['database_size'] = array( |
1683 | - 'size' => __( 'Not available' ), |
|
1683 | + 'size' => __('Not available'), |
|
1684 | 1684 | 'debug' => 'not available', |
1685 | 1685 | ); |
1686 | 1686 | } |
1687 | 1687 | |
1688 | - if ( null !== $size_total && $size_db > 0 ) { |
|
1688 | + if (null !== $size_total && $size_db > 0) { |
|
1689 | 1689 | $total_size = $size_total + $size_db; |
1690 | - $total_size_mb = size_format( $total_size, 2 ); |
|
1690 | + $total_size_mb = size_format($total_size, 2); |
|
1691 | 1691 | |
1692 | 1692 | $all_sizes['total_size'] = array( |
1693 | 1693 | 'raw' => $total_size, |
@@ -1696,7 +1696,7 @@ discard block |
||
1696 | 1696 | ); |
1697 | 1697 | } else { |
1698 | 1698 | $all_sizes['total_size'] = array( |
1699 | - 'size' => __( 'Total size is not available. Some errors were encountered when determining the size of your installation.' ), |
|
1699 | + 'size' => __('Total size is not available. Some errors were encountered when determining the size of your installation.'), |
|
1700 | 1700 | 'debug' => 'not available', |
1701 | 1701 | ); |
1702 | 1702 | } |
@@ -24,31 +24,31 @@ discard block |
||
24 | 24 | /** |
25 | 25 | * @param array $args |
26 | 26 | */ |
27 | - public function __construct( $args = array() ) { |
|
27 | + public function __construct($args = array()) { |
|
28 | 28 | $defaults = array( |
29 | 29 | 'url' => '', |
30 | 30 | 'nonce' => '', |
31 | - 'title' => __( 'Update Translations' ), |
|
31 | + 'title' => __('Update Translations'), |
|
32 | 32 | 'skip_header_footer' => false, |
33 | 33 | ); |
34 | - $args = wp_parse_args( $args, $defaults ); |
|
35 | - if ( $args['skip_header_footer'] ) { |
|
34 | + $args = wp_parse_args($args, $defaults); |
|
35 | + if ($args['skip_header_footer']) { |
|
36 | 36 | $this->done_header = true; |
37 | 37 | $this->done_footer = true; |
38 | 38 | $this->display_footer_actions = false; |
39 | 39 | } |
40 | - parent::__construct( $args ); |
|
40 | + parent::__construct($args); |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | /** |
44 | 44 | */ |
45 | 45 | public function before() { |
46 | - $name = $this->upgrader->get_name_for_update( $this->language_update ); |
|
46 | + $name = $this->upgrader->get_name_for_update($this->language_update); |
|
47 | 47 | |
48 | 48 | echo '<div class="update-messages lp-show-latest">'; |
49 | 49 | |
50 | 50 | /* translators: 1: Project name (plugin, theme, or WordPress), 2: Language. */ |
51 | - printf( '<h2>' . __( 'Updating translations for %1$s (%2$s)…' ) . '</h2>', $name, $this->language_update->language ); |
|
51 | + printf('<h2>' . __('Updating translations for %1$s (%2$s)…') . '</h2>', $name, $this->language_update->language); |
|
52 | 52 | } |
53 | 53 | |
54 | 54 | /** |
@@ -56,9 +56,9 @@ discard block |
||
56 | 56 | * |
57 | 57 | * @param string|WP_Error $errors Errors. |
58 | 58 | */ |
59 | - public function error( $errors ) { |
|
59 | + public function error($errors) { |
|
60 | 60 | echo '<div class="lp-error">'; |
61 | - parent::error( $errors ); |
|
61 | + parent::error($errors); |
|
62 | 62 | echo '</div>'; |
63 | 63 | } |
64 | 64 | |
@@ -71,13 +71,13 @@ discard block |
||
71 | 71 | /** |
72 | 72 | */ |
73 | 73 | public function bulk_footer() { |
74 | - $this->decrement_update_count( 'translation' ); |
|
74 | + $this->decrement_update_count('translation'); |
|
75 | 75 | |
76 | 76 | $update_actions = array( |
77 | 77 | 'updates_page' => sprintf( |
78 | 78 | '<a href="%s" target="_parent">%s</a>', |
79 | - self_admin_url( 'update-core.php' ), |
|
80 | - __( 'Go to WordPress Updates page' ) |
|
79 | + self_admin_url('update-core.php'), |
|
80 | + __('Go to WordPress Updates page') |
|
81 | 81 | ), |
82 | 82 | ); |
83 | 83 | |
@@ -88,10 +88,10 @@ discard block |
||
88 | 88 | * |
89 | 89 | * @param string[] $update_actions Array of translations update links. |
90 | 90 | */ |
91 | - $update_actions = apply_filters( 'update_translations_complete_actions', $update_actions ); |
|
91 | + $update_actions = apply_filters('update_translations_complete_actions', $update_actions); |
|
92 | 92 | |
93 | - if ( $update_actions && $this->display_footer_actions ) { |
|
94 | - $this->feedback( implode( ' | ', $update_actions ) ); |
|
93 | + if ($update_actions && $this->display_footer_actions) { |
|
94 | + $this->feedback(implode(' | ', $update_actions)); |
|
95 | 95 | } |
96 | 96 | } |
97 | 97 | } |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | * @ignore |
67 | 67 | */ |
68 | 68 | function is_admin() { |
69 | - return true;} |
|
69 | + return true; } |
|
70 | 70 | |
71 | 71 | /** |
72 | 72 | * @ignore |
@@ -93,13 +93,13 @@ discard block |
||
93 | 93 | */ |
94 | 94 | function wp_guess_url() {} |
95 | 95 | |
96 | -function get_file( $path ) { |
|
96 | +function get_file($path) { |
|
97 | 97 | |
98 | - $path = realpath( $path ); |
|
98 | + $path = realpath($path); |
|
99 | 99 | |
100 | - if ( ! $path || ! @is_file( $path ) ) { |
|
100 | + if (!$path || !@is_file($path)) { |
|
101 | 101 | return ''; |
102 | 102 | } |
103 | 103 | |
104 | - return @file_get_contents( $path ); |
|
104 | + return @file_get_contents($path); |
|
105 | 105 | } |
@@ -37,47 +37,47 @@ discard block |
||
37 | 37 | * |
38 | 38 | * @param array $args An associative array of arguments. |
39 | 39 | */ |
40 | - public function __construct( $args = array() ) { |
|
40 | + public function __construct($args = array()) { |
|
41 | 41 | global $status, $page; |
42 | 42 | |
43 | 43 | parent::__construct( |
44 | 44 | array( |
45 | 45 | 'plural' => 'plugins', |
46 | - 'screen' => isset( $args['screen'] ) ? $args['screen'] : null, |
|
46 | + 'screen' => isset($args['screen']) ? $args['screen'] : null, |
|
47 | 47 | ) |
48 | 48 | ); |
49 | 49 | |
50 | - $allowed_statuses = array( 'active', 'inactive', 'recently_activated', 'upgrade', 'mustuse', 'dropins', 'search', 'paused', 'auto-update-enabled', 'auto-update-disabled' ); |
|
50 | + $allowed_statuses = array('active', 'inactive', 'recently_activated', 'upgrade', 'mustuse', 'dropins', 'search', 'paused', 'auto-update-enabled', 'auto-update-disabled'); |
|
51 | 51 | |
52 | 52 | $status = 'all'; |
53 | - if ( isset( $_REQUEST['plugin_status'] ) && in_array( $_REQUEST['plugin_status'], $allowed_statuses, true ) ) { |
|
53 | + if (isset($_REQUEST['plugin_status']) && in_array($_REQUEST['plugin_status'], $allowed_statuses, true)) { |
|
54 | 54 | $status = $_REQUEST['plugin_status']; |
55 | 55 | } |
56 | 56 | |
57 | - if ( isset( $_REQUEST['s'] ) ) { |
|
58 | - $_SERVER['REQUEST_URI'] = add_query_arg( 's', wp_unslash( $_REQUEST['s'] ) ); |
|
57 | + if (isset($_REQUEST['s'])) { |
|
58 | + $_SERVER['REQUEST_URI'] = add_query_arg('s', wp_unslash($_REQUEST['s'])); |
|
59 | 59 | } |
60 | 60 | |
61 | 61 | $page = $this->get_pagenum(); |
62 | 62 | |
63 | - $this->show_autoupdates = wp_is_auto_update_enabled_for_type( 'plugin' ) |
|
64 | - && current_user_can( 'update_plugins' ) |
|
65 | - && ( ! is_multisite() || $this->screen->in_admin( 'network' ) ) |
|
66 | - && ! in_array( $status, array( 'mustuse', 'dropins' ), true ); |
|
63 | + $this->show_autoupdates = wp_is_auto_update_enabled_for_type('plugin') |
|
64 | + && current_user_can('update_plugins') |
|
65 | + && (!is_multisite() || $this->screen->in_admin('network')) |
|
66 | + && !in_array($status, array('mustuse', 'dropins'), true); |
|
67 | 67 | } |
68 | 68 | |
69 | 69 | /** |
70 | 70 | * @return array |
71 | 71 | */ |
72 | 72 | protected function get_table_classes() { |
73 | - return array( 'widefat', $this->_args['plural'] ); |
|
73 | + return array('widefat', $this->_args['plural']); |
|
74 | 74 | } |
75 | 75 | |
76 | 76 | /** |
77 | 77 | * @return bool |
78 | 78 | */ |
79 | 79 | public function ajax_user_can() { |
80 | - return current_user_can( 'activate_plugins' ); |
|
80 | + return current_user_can('activate_plugins'); |
|
81 | 81 | } |
82 | 82 | |
83 | 83 | /** |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | public function prepare_items() { |
93 | 93 | global $status, $plugins, $totals, $page, $orderby, $order, $s; |
94 | 94 | |
95 | - wp_reset_vars( array( 'orderby', 'order' ) ); |
|
95 | + wp_reset_vars(array('orderby', 'order')); |
|
96 | 96 | |
97 | 97 | /** |
98 | 98 | * Filters the full array of plugins to list in the Plugins list table. |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | * |
104 | 104 | * @param array $all_plugins An array of plugins to display in the list table. |
105 | 105 | */ |
106 | - $all_plugins = apply_filters( 'all_plugins', get_plugins() ); |
|
106 | + $all_plugins = apply_filters('all_plugins', get_plugins()); |
|
107 | 107 | |
108 | 108 | $plugins = array( |
109 | 109 | 'all' => $all_plugins, |
@@ -116,8 +116,8 @@ discard block |
||
116 | 116 | 'dropins' => array(), |
117 | 117 | 'paused' => array(), |
118 | 118 | ); |
119 | - if ( $this->show_autoupdates ) { |
|
120 | - $auto_updates = (array) get_site_option( 'auto_update_plugins', array() ); |
|
119 | + if ($this->show_autoupdates) { |
|
120 | + $auto_updates = (array) get_site_option('auto_update_plugins', array()); |
|
121 | 121 | |
122 | 122 | $plugins['auto-update-enabled'] = array(); |
123 | 123 | $plugins['auto-update-disabled'] = array(); |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | |
126 | 126 | $screen = $this->screen; |
127 | 127 | |
128 | - if ( ! is_multisite() || ( $screen->in_admin( 'network' ) && current_user_can( 'manage_network_plugins' ) ) ) { |
|
128 | + if (!is_multisite() || ($screen->in_admin('network') && current_user_can('manage_network_plugins'))) { |
|
129 | 129 | |
130 | 130 | /** |
131 | 131 | * Filters whether to display the advanced plugins list table. |
@@ -142,28 +142,28 @@ discard block |
||
142 | 142 | * plugin type. Default true. |
143 | 143 | * @param string $type The plugin type. Accepts 'mustuse', 'dropins'. |
144 | 144 | */ |
145 | - if ( apply_filters( 'show_advanced_plugins', true, 'mustuse' ) ) { |
|
145 | + if (apply_filters('show_advanced_plugins', true, 'mustuse')) { |
|
146 | 146 | $plugins['mustuse'] = get_mu_plugins(); |
147 | 147 | } |
148 | 148 | |
149 | 149 | /** This action is documented in wp-admin/includes/class-wp-plugins-list-table.php */ |
150 | - if ( apply_filters( 'show_advanced_plugins', true, 'dropins' ) ) { |
|
150 | + if (apply_filters('show_advanced_plugins', true, 'dropins')) { |
|
151 | 151 | $plugins['dropins'] = get_dropins(); |
152 | 152 | } |
153 | 153 | |
154 | - if ( current_user_can( 'update_plugins' ) ) { |
|
155 | - $current = get_site_transient( 'update_plugins' ); |
|
156 | - foreach ( (array) $plugins['all'] as $plugin_file => $plugin_data ) { |
|
157 | - if ( isset( $current->response[ $plugin_file ] ) ) { |
|
158 | - $plugins['all'][ $plugin_file ]['update'] = true; |
|
159 | - $plugins['upgrade'][ $plugin_file ] = $plugins['all'][ $plugin_file ]; |
|
154 | + if (current_user_can('update_plugins')) { |
|
155 | + $current = get_site_transient('update_plugins'); |
|
156 | + foreach ((array) $plugins['all'] as $plugin_file => $plugin_data) { |
|
157 | + if (isset($current->response[$plugin_file])) { |
|
158 | + $plugins['all'][$plugin_file]['update'] = true; |
|
159 | + $plugins['upgrade'][$plugin_file] = $plugins['all'][$plugin_file]; |
|
160 | 160 | } |
161 | 161 | } |
162 | 162 | } |
163 | 163 | } |
164 | 164 | |
165 | - if ( ! $screen->in_admin( 'network' ) ) { |
|
166 | - $show = current_user_can( 'manage_network_plugins' ); |
|
165 | + if (!$screen->in_admin('network')) { |
|
166 | + $show = current_user_can('manage_network_plugins'); |
|
167 | 167 | /** |
168 | 168 | * Filters whether to display network-active plugins alongside plugins active for the current site. |
169 | 169 | * |
@@ -177,36 +177,36 @@ discard block |
||
177 | 177 | * @param bool $show Whether to show network-active plugins. Default is whether the current |
178 | 178 | * user can manage network plugins (ie. a Super Admin). |
179 | 179 | */ |
180 | - $show_network_active = apply_filters( 'show_network_active_plugins', $show ); |
|
180 | + $show_network_active = apply_filters('show_network_active_plugins', $show); |
|
181 | 181 | } |
182 | 182 | |
183 | - if ( $screen->in_admin( 'network' ) ) { |
|
184 | - $recently_activated = get_site_option( 'recently_activated', array() ); |
|
183 | + if ($screen->in_admin('network')) { |
|
184 | + $recently_activated = get_site_option('recently_activated', array()); |
|
185 | 185 | } else { |
186 | - $recently_activated = get_option( 'recently_activated', array() ); |
|
186 | + $recently_activated = get_option('recently_activated', array()); |
|
187 | 187 | } |
188 | 188 | |
189 | - foreach ( $recently_activated as $key => $time ) { |
|
190 | - if ( $time + WEEK_IN_SECONDS < time() ) { |
|
191 | - unset( $recently_activated[ $key ] ); |
|
189 | + foreach ($recently_activated as $key => $time) { |
|
190 | + if ($time + WEEK_IN_SECONDS < time()) { |
|
191 | + unset($recently_activated[$key]); |
|
192 | 192 | } |
193 | 193 | } |
194 | 194 | |
195 | - if ( $screen->in_admin( 'network' ) ) { |
|
196 | - update_site_option( 'recently_activated', $recently_activated ); |
|
195 | + if ($screen->in_admin('network')) { |
|
196 | + update_site_option('recently_activated', $recently_activated); |
|
197 | 197 | } else { |
198 | - update_option( 'recently_activated', $recently_activated ); |
|
198 | + update_option('recently_activated', $recently_activated); |
|
199 | 199 | } |
200 | 200 | |
201 | - $plugin_info = get_site_transient( 'update_plugins' ); |
|
201 | + $plugin_info = get_site_transient('update_plugins'); |
|
202 | 202 | |
203 | - foreach ( (array) $plugins['all'] as $plugin_file => $plugin_data ) { |
|
203 | + foreach ((array) $plugins['all'] as $plugin_file => $plugin_data) { |
|
204 | 204 | // Extra info if known. array_merge() ensures $plugin_data has precedence if keys collide. |
205 | - if ( isset( $plugin_info->response[ $plugin_file ] ) ) { |
|
206 | - $plugin_data = array_merge( (array) $plugin_info->response[ $plugin_file ], array( 'update-supported' => true ), $plugin_data ); |
|
207 | - } elseif ( isset( $plugin_info->no_update[ $plugin_file ] ) ) { |
|
208 | - $plugin_data = array_merge( (array) $plugin_info->no_update[ $plugin_file ], array( 'update-supported' => true ), $plugin_data ); |
|
209 | - } elseif ( empty( $plugin_data['update-supported'] ) ) { |
|
205 | + if (isset($plugin_info->response[$plugin_file])) { |
|
206 | + $plugin_data = array_merge((array) $plugin_info->response[$plugin_file], array('update-supported' => true), $plugin_data); |
|
207 | + } elseif (isset($plugin_info->no_update[$plugin_file])) { |
|
208 | + $plugin_data = array_merge((array) $plugin_info->no_update[$plugin_file], array('update-supported' => true), $plugin_data); |
|
209 | + } elseif (empty($plugin_data['update-supported'])) { |
|
210 | 210 | $plugin_data['update-supported'] = false; |
211 | 211 | } |
212 | 212 | |
@@ -230,94 +230,94 @@ discard block |
||
230 | 230 | 'compatibility' => new stdClass(), |
231 | 231 | ); |
232 | 232 | |
233 | - $filter_payload = (object) wp_parse_args( $plugin_data, $filter_payload ); |
|
233 | + $filter_payload = (object) wp_parse_args($plugin_data, $filter_payload); |
|
234 | 234 | |
235 | - $auto_update_forced = wp_is_auto_update_forced_for_item( 'plugin', null, $filter_payload ); |
|
235 | + $auto_update_forced = wp_is_auto_update_forced_for_item('plugin', null, $filter_payload); |
|
236 | 236 | |
237 | - if ( ! is_null( $auto_update_forced ) ) { |
|
237 | + if (!is_null($auto_update_forced)) { |
|
238 | 238 | $plugin_data['auto-update-forced'] = $auto_update_forced; |
239 | 239 | } |
240 | 240 | |
241 | - $plugins['all'][ $plugin_file ] = $plugin_data; |
|
241 | + $plugins['all'][$plugin_file] = $plugin_data; |
|
242 | 242 | // Make sure that $plugins['upgrade'] also receives the extra info since it is used on ?plugin_status=upgrade. |
243 | - if ( isset( $plugins['upgrade'][ $plugin_file ] ) ) { |
|
244 | - $plugins['upgrade'][ $plugin_file ] = $plugin_data; |
|
243 | + if (isset($plugins['upgrade'][$plugin_file])) { |
|
244 | + $plugins['upgrade'][$plugin_file] = $plugin_data; |
|
245 | 245 | } |
246 | 246 | |
247 | 247 | // Filter into individual sections. |
248 | - if ( is_multisite() && ! $screen->in_admin( 'network' ) && is_network_only_plugin( $plugin_file ) && ! is_plugin_active( $plugin_file ) ) { |
|
249 | - if ( $show_network_active ) { |
|
248 | + if (is_multisite() && !$screen->in_admin('network') && is_network_only_plugin($plugin_file) && !is_plugin_active($plugin_file)) { |
|
249 | + if ($show_network_active) { |
|
250 | 250 | // On the non-network screen, show inactive network-only plugins if allowed. |
251 | - $plugins['inactive'][ $plugin_file ] = $plugin_data; |
|
251 | + $plugins['inactive'][$plugin_file] = $plugin_data; |
|
252 | 252 | } else { |
253 | 253 | // On the non-network screen, filter out network-only plugins as long as they're not individually active. |
254 | - unset( $plugins['all'][ $plugin_file ] ); |
|
254 | + unset($plugins['all'][$plugin_file]); |
|
255 | 255 | } |
256 | - } elseif ( ! $screen->in_admin( 'network' ) && is_plugin_active_for_network( $plugin_file ) ) { |
|
257 | - if ( $show_network_active ) { |
|
256 | + } elseif (!$screen->in_admin('network') && is_plugin_active_for_network($plugin_file)) { |
|
257 | + if ($show_network_active) { |
|
258 | 258 | // On the non-network screen, show network-active plugins if allowed. |
259 | - $plugins['active'][ $plugin_file ] = $plugin_data; |
|
259 | + $plugins['active'][$plugin_file] = $plugin_data; |
|
260 | 260 | } else { |
261 | 261 | // On the non-network screen, filter out network-active plugins. |
262 | - unset( $plugins['all'][ $plugin_file ] ); |
|
262 | + unset($plugins['all'][$plugin_file]); |
|
263 | 263 | } |
264 | - } elseif ( ( ! $screen->in_admin( 'network' ) && is_plugin_active( $plugin_file ) ) |
|
265 | - || ( $screen->in_admin( 'network' ) && is_plugin_active_for_network( $plugin_file ) ) ) { |
|
264 | + } elseif ((!$screen->in_admin('network') && is_plugin_active($plugin_file)) |
|
265 | + || ($screen->in_admin('network') && is_plugin_active_for_network($plugin_file))) { |
|
266 | 266 | // On the non-network screen, populate the active list with plugins that are individually activated. |
267 | 267 | // On the network admin screen, populate the active list with plugins that are network-activated. |
268 | - $plugins['active'][ $plugin_file ] = $plugin_data; |
|
268 | + $plugins['active'][$plugin_file] = $plugin_data; |
|
269 | 269 | |
270 | - if ( ! $screen->in_admin( 'network' ) && is_plugin_paused( $plugin_file ) ) { |
|
271 | - $plugins['paused'][ $plugin_file ] = $plugin_data; |
|
270 | + if (!$screen->in_admin('network') && is_plugin_paused($plugin_file)) { |
|
271 | + $plugins['paused'][$plugin_file] = $plugin_data; |
|
272 | 272 | } |
273 | 273 | } else { |
274 | - if ( isset( $recently_activated[ $plugin_file ] ) ) { |
|
274 | + if (isset($recently_activated[$plugin_file])) { |
|
275 | 275 | // Populate the recently activated list with plugins that have been recently activated. |
276 | - $plugins['recently_activated'][ $plugin_file ] = $plugin_data; |
|
276 | + $plugins['recently_activated'][$plugin_file] = $plugin_data; |
|
277 | 277 | } |
278 | 278 | // Populate the inactive list with plugins that aren't activated. |
279 | - $plugins['inactive'][ $plugin_file ] = $plugin_data; |
|
279 | + $plugins['inactive'][$plugin_file] = $plugin_data; |
|
280 | 280 | } |
281 | 281 | |
282 | - if ( $this->show_autoupdates ) { |
|
283 | - $enabled = in_array( $plugin_file, $auto_updates, true ) && $plugin_data['update-supported']; |
|
284 | - if ( isset( $plugin_data['auto-update-forced'] ) ) { |
|
282 | + if ($this->show_autoupdates) { |
|
283 | + $enabled = in_array($plugin_file, $auto_updates, true) && $plugin_data['update-supported']; |
|
284 | + if (isset($plugin_data['auto-update-forced'])) { |
|
285 | 285 | $enabled = (bool) $plugin_data['auto-update-forced']; |
286 | 286 | } |
287 | 287 | |
288 | - if ( $enabled ) { |
|
289 | - $plugins['auto-update-enabled'][ $plugin_file ] = $plugin_data; |
|
288 | + if ($enabled) { |
|
289 | + $plugins['auto-update-enabled'][$plugin_file] = $plugin_data; |
|
290 | 290 | } else { |
291 | - $plugins['auto-update-disabled'][ $plugin_file ] = $plugin_data; |
|
291 | + $plugins['auto-update-disabled'][$plugin_file] = $plugin_data; |
|
292 | 292 | } |
293 | 293 | } |
294 | 294 | } |
295 | 295 | |
296 | - if ( strlen( $s ) ) { |
|
296 | + if (strlen($s)) { |
|
297 | 297 | $status = 'search'; |
298 | - $plugins['search'] = array_filter( $plugins['all'], array( $this, '_search_callback' ) ); |
|
298 | + $plugins['search'] = array_filter($plugins['all'], array($this, '_search_callback')); |
|
299 | 299 | } |
300 | 300 | |
301 | 301 | $totals = array(); |
302 | - foreach ( $plugins as $type => $list ) { |
|
303 | - $totals[ $type ] = count( $list ); |
|
302 | + foreach ($plugins as $type => $list) { |
|
303 | + $totals[$type] = count($list); |
|
304 | 304 | } |
305 | 305 | |
306 | - if ( empty( $plugins[ $status ] ) && ! in_array( $status, array( 'all', 'search' ), true ) ) { |
|
306 | + if (empty($plugins[$status]) && !in_array($status, array('all', 'search'), true)) { |
|
307 | 307 | $status = 'all'; |
308 | 308 | } |
309 | 309 | |
310 | 310 | $this->items = array(); |
311 | - foreach ( $plugins[ $status ] as $plugin_file => $plugin_data ) { |
|
311 | + foreach ($plugins[$status] as $plugin_file => $plugin_data) { |
|
312 | 312 | // Translate, don't apply markup, sanitize HTML. |
313 | - $this->items[ $plugin_file ] = _get_plugin_data_markup_translate( $plugin_file, $plugin_data, false, true ); |
|
313 | + $this->items[$plugin_file] = _get_plugin_data_markup_translate($plugin_file, $plugin_data, false, true); |
|
314 | 314 | } |
315 | 315 | |
316 | - $total_this_page = $totals[ $status ]; |
|
316 | + $total_this_page = $totals[$status]; |
|
317 | 317 | |
318 | 318 | $js_plugins = array(); |
319 | - foreach ( $plugins as $key => $list ) { |
|
320 | - $js_plugins[ $key ] = array_keys( $list ); |
|
319 | + foreach ($plugins as $key => $list) { |
|
320 | + $js_plugins[$key] = array_keys($list); |
|
321 | 321 | } |
322 | 322 | |
323 | 323 | wp_localize_script( |
@@ -329,22 +329,22 @@ discard block |
||
329 | 329 | ) |
330 | 330 | ); |
331 | 331 | |
332 | - if ( ! $orderby ) { |
|
332 | + if (!$orderby) { |
|
333 | 333 | $orderby = 'Name'; |
334 | 334 | } else { |
335 | - $orderby = ucfirst( $orderby ); |
|
335 | + $orderby = ucfirst($orderby); |
|
336 | 336 | } |
337 | 337 | |
338 | - $order = strtoupper( $order ); |
|
338 | + $order = strtoupper($order); |
|
339 | 339 | |
340 | - uasort( $this->items, array( $this, '_order_callback' ) ); |
|
340 | + uasort($this->items, array($this, '_order_callback')); |
|
341 | 341 | |
342 | - $plugins_per_page = $this->get_items_per_page( str_replace( '-', '_', $screen->id . '_per_page' ), 999 ); |
|
342 | + $plugins_per_page = $this->get_items_per_page(str_replace('-', '_', $screen->id . '_per_page'), 999); |
|
343 | 343 | |
344 | - $start = ( $page - 1 ) * $plugins_per_page; |
|
344 | + $start = ($page - 1) * $plugins_per_page; |
|
345 | 345 | |
346 | - if ( $total_this_page > $plugins_per_page ) { |
|
347 | - $this->items = array_slice( $this->items, $start, $plugins_per_page ); |
|
346 | + if ($total_this_page > $plugins_per_page) { |
|
347 | + $this->items = array_slice($this->items, $start, $plugins_per_page); |
|
348 | 348 | } |
349 | 349 | |
350 | 350 | $this->set_pagination_args( |
@@ -361,11 +361,11 @@ discard block |
||
361 | 361 | * @param array $plugin |
362 | 362 | * @return bool |
363 | 363 | */ |
364 | - public function _search_callback( $plugin ) { |
|
364 | + public function _search_callback($plugin) { |
|
365 | 365 | global $s; |
366 | 366 | |
367 | - foreach ( $plugin as $value ) { |
|
368 | - if ( is_string( $value ) && false !== stripos( strip_tags( $value ), urldecode( $s ) ) ) { |
|
367 | + foreach ($plugin as $value) { |
|
368 | + if (is_string($value) && false !== stripos(strip_tags($value), urldecode($s))) { |
|
369 | 369 | return true; |
370 | 370 | } |
371 | 371 | } |
@@ -380,20 +380,20 @@ discard block |
||
380 | 380 | * @param array $plugin_b |
381 | 381 | * @return int |
382 | 382 | */ |
383 | - public function _order_callback( $plugin_a, $plugin_b ) { |
|
383 | + public function _order_callback($plugin_a, $plugin_b) { |
|
384 | 384 | global $orderby, $order; |
385 | 385 | |
386 | - $a = $plugin_a[ $orderby ]; |
|
387 | - $b = $plugin_b[ $orderby ]; |
|
386 | + $a = $plugin_a[$orderby]; |
|
387 | + $b = $plugin_b[$orderby]; |
|
388 | 388 | |
389 | - if ( $a === $b ) { |
|
389 | + if ($a === $b) { |
|
390 | 390 | return 0; |
391 | 391 | } |
392 | 392 | |
393 | - if ( 'DESC' === $order ) { |
|
394 | - return strcasecmp( $b, $a ); |
|
393 | + if ('DESC' === $order) { |
|
394 | + return strcasecmp($b, $a); |
|
395 | 395 | } else { |
396 | - return strcasecmp( $a, $b ); |
|
396 | + return strcasecmp($a, $b); |
|
397 | 397 | } |
398 | 398 | } |
399 | 399 | |
@@ -403,20 +403,20 @@ discard block |
||
403 | 403 | public function no_items() { |
404 | 404 | global $plugins; |
405 | 405 | |
406 | - if ( ! empty( $_REQUEST['s'] ) ) { |
|
407 | - $s = esc_html( wp_unslash( $_REQUEST['s'] ) ); |
|
406 | + if (!empty($_REQUEST['s'])) { |
|
407 | + $s = esc_html(wp_unslash($_REQUEST['s'])); |
|
408 | 408 | |
409 | 409 | /* translators: %s: Plugin search term. */ |
410 | - printf( __( 'No plugins found for: %s.' ), '<strong>' . $s . '</strong>' ); |
|
410 | + printf(__('No plugins found for: %s.'), '<strong>' . $s . '</strong>'); |
|
411 | 411 | |
412 | 412 | // We assume that somebody who can install plugins in multisite is experienced enough to not need this helper link. |
413 | - if ( ! is_multisite() && current_user_can( 'install_plugins' ) ) { |
|
414 | - echo ' <a href="' . esc_url( admin_url( 'plugin-install.php?tab=search&s=' . urlencode( $s ) ) ) . '">' . __( 'Search for plugins in the WordPress Plugin Directory.' ) . '</a>'; |
|
413 | + if (!is_multisite() && current_user_can('install_plugins')) { |
|
414 | + echo ' <a href="' . esc_url(admin_url('plugin-install.php?tab=search&s=' . urlencode($s))) . '">' . __('Search for plugins in the WordPress Plugin Directory.') . '</a>'; |
|
415 | 415 | } |
416 | - } elseif ( ! empty( $plugins['all'] ) ) { |
|
417 | - _e( 'No plugins found.' ); |
|
416 | + } elseif (!empty($plugins['all'])) { |
|
417 | + _e('No plugins found.'); |
|
418 | 418 | } else { |
419 | - _e( 'No plugins are currently available.' ); |
|
419 | + _e('No plugins are currently available.'); |
|
420 | 420 | } |
421 | 421 | } |
422 | 422 | |
@@ -428,24 +428,24 @@ discard block |
||
428 | 428 | * @param string $text The 'submit' button label. |
429 | 429 | * @param string $input_id ID attribute value for the search input field. |
430 | 430 | */ |
431 | - public function search_box( $text, $input_id ) { |
|
432 | - if ( empty( $_REQUEST['s'] ) && ! $this->has_items() ) { |
|
431 | + public function search_box($text, $input_id) { |
|
432 | + if (empty($_REQUEST['s']) && !$this->has_items()) { |
|
433 | 433 | return; |
434 | 434 | } |
435 | 435 | |
436 | 436 | $input_id = $input_id . '-search-input'; |
437 | 437 | |
438 | - if ( ! empty( $_REQUEST['orderby'] ) ) { |
|
439 | - echo '<input type="hidden" name="orderby" value="' . esc_attr( $_REQUEST['orderby'] ) . '" />'; |
|
438 | + if (!empty($_REQUEST['orderby'])) { |
|
439 | + echo '<input type="hidden" name="orderby" value="' . esc_attr($_REQUEST['orderby']) . '" />'; |
|
440 | 440 | } |
441 | - if ( ! empty( $_REQUEST['order'] ) ) { |
|
442 | - echo '<input type="hidden" name="order" value="' . esc_attr( $_REQUEST['order'] ) . '" />'; |
|
441 | + if (!empty($_REQUEST['order'])) { |
|
442 | + echo '<input type="hidden" name="order" value="' . esc_attr($_REQUEST['order']) . '" />'; |
|
443 | 443 | } |
444 | 444 | ?> |
445 | 445 | <p class="search-box"> |
446 | - <label class="screen-reader-text" for="<?php echo esc_attr( $input_id ); ?>"><?php echo $text; ?>:</label> |
|
447 | - <input type="search" id="<?php echo esc_attr( $input_id ); ?>" class="wp-filter-search" name="s" value="<?php _admin_search_query(); ?>" placeholder="<?php esc_attr_e( 'Search installed plugins...' ); ?>" /> |
|
448 | - <?php submit_button( $text, 'hide-if-js', '', false, array( 'id' => 'search-submit' ) ); ?> |
|
446 | + <label class="screen-reader-text" for="<?php echo esc_attr($input_id); ?>"><?php echo $text; ?>:</label> |
|
447 | + <input type="search" id="<?php echo esc_attr($input_id); ?>" class="wp-filter-search" name="s" value="<?php _admin_search_query(); ?>" placeholder="<?php esc_attr_e('Search installed plugins...'); ?>" /> |
|
448 | + <?php submit_button($text, 'hide-if-js', '', false, array('id' => 'search-submit')); ?> |
|
449 | 449 | </p> |
450 | 450 | <?php |
451 | 451 | } |
@@ -458,13 +458,13 @@ discard block |
||
458 | 458 | global $status; |
459 | 459 | |
460 | 460 | $columns = array( |
461 | - 'cb' => ! in_array( $status, array( 'mustuse', 'dropins' ), true ) ? '<input type="checkbox" />' : '', |
|
462 | - 'name' => __( 'Plugin' ), |
|
463 | - 'description' => __( 'Description' ), |
|
461 | + 'cb' => !in_array($status, array('mustuse', 'dropins'), true) ? '<input type="checkbox" />' : '', |
|
462 | + 'name' => __('Plugin'), |
|
463 | + 'description' => __('Description'), |
|
464 | 464 | ); |
465 | 465 | |
466 | - if ( $this->show_autoupdates ) { |
|
467 | - $columns['auto-updates'] = __( 'Automatic Updates' ); |
|
466 | + if ($this->show_autoupdates) { |
|
467 | + $columns['auto-updates'] = __('Automatic Updates'); |
|
468 | 468 | } |
469 | 469 | |
470 | 470 | return $columns; |
@@ -486,12 +486,12 @@ discard block |
||
486 | 486 | global $totals, $status; |
487 | 487 | |
488 | 488 | $status_links = array(); |
489 | - foreach ( $totals as $type => $count ) { |
|
490 | - if ( ! $count ) { |
|
489 | + foreach ($totals as $type => $count) { |
|
490 | + if (!$count) { |
|
491 | 491 | continue; |
492 | 492 | } |
493 | 493 | |
494 | - switch ( $type ) { |
|
494 | + switch ($type) { |
|
495 | 495 | case 'all': |
496 | 496 | /* translators: %s: Number of plugins. */ |
497 | 497 | $text = _nx( |
@@ -575,12 +575,12 @@ discard block |
||
575 | 575 | break; |
576 | 576 | } |
577 | 577 | |
578 | - if ( 'search' !== $type ) { |
|
579 | - $status_links[ $type ] = sprintf( |
|
578 | + if ('search' !== $type) { |
|
579 | + $status_links[$type] = sprintf( |
|
580 | 580 | "<a href='%s'%s>%s</a>", |
581 | - add_query_arg( 'plugin_status', $type, 'plugins.php' ), |
|
582 | - ( $type === $status ) ? ' class="current" aria-current="page"' : '', |
|
583 | - sprintf( $text, number_format_i18n( $count ) ) |
|
581 | + add_query_arg('plugin_status', $type, 'plugins.php'), |
|
582 | + ($type === $status) ? ' class="current" aria-current="page"' : '', |
|
583 | + sprintf($text, number_format_i18n($count)) |
|
584 | 584 | ); |
585 | 585 | } |
586 | 586 | } |
@@ -597,29 +597,29 @@ discard block |
||
597 | 597 | |
598 | 598 | $actions = array(); |
599 | 599 | |
600 | - if ( 'active' !== $status ) { |
|
601 | - $actions['activate-selected'] = $this->screen->in_admin( 'network' ) ? __( 'Network Activate' ) : __( 'Activate' ); |
|
600 | + if ('active' !== $status) { |
|
601 | + $actions['activate-selected'] = $this->screen->in_admin('network') ? __('Network Activate') : __('Activate'); |
|
602 | 602 | } |
603 | 603 | |
604 | - if ( 'inactive' !== $status && 'recent' !== $status ) { |
|
605 | - $actions['deactivate-selected'] = $this->screen->in_admin( 'network' ) ? __( 'Network Deactivate' ) : __( 'Deactivate' ); |
|
604 | + if ('inactive' !== $status && 'recent' !== $status) { |
|
605 | + $actions['deactivate-selected'] = $this->screen->in_admin('network') ? __('Network Deactivate') : __('Deactivate'); |
|
606 | 606 | } |
607 | 607 | |
608 | - if ( ! is_multisite() || $this->screen->in_admin( 'network' ) ) { |
|
609 | - if ( current_user_can( 'update_plugins' ) ) { |
|
610 | - $actions['update-selected'] = __( 'Update' ); |
|
608 | + if (!is_multisite() || $this->screen->in_admin('network')) { |
|
609 | + if (current_user_can('update_plugins')) { |
|
610 | + $actions['update-selected'] = __('Update'); |
|
611 | 611 | } |
612 | 612 | |
613 | - if ( current_user_can( 'delete_plugins' ) && ( 'active' !== $status ) ) { |
|
614 | - $actions['delete-selected'] = __( 'Delete' ); |
|
613 | + if (current_user_can('delete_plugins') && ('active' !== $status)) { |
|
614 | + $actions['delete-selected'] = __('Delete'); |
|
615 | 615 | } |
616 | 616 | |
617 | - if ( $this->show_autoupdates ) { |
|
618 | - if ( 'auto-update-enabled' !== $status ) { |
|
619 | - $actions['enable-auto-update-selected'] = __( 'Enable Auto-updates' ); |
|
617 | + if ($this->show_autoupdates) { |
|
618 | + if ('auto-update-enabled' !== $status) { |
|
619 | + $actions['enable-auto-update-selected'] = __('Enable Auto-updates'); |
|
620 | 620 | } |
621 | - if ( 'auto-update-disabled' !== $status ) { |
|
622 | - $actions['disable-auto-update-selected'] = __( 'Disable Auto-updates' ); |
|
621 | + if ('auto-update-disabled' !== $status) { |
|
622 | + $actions['disable-auto-update-selected'] = __('Disable Auto-updates'); |
|
623 | 623 | } |
624 | 624 | } |
625 | 625 | } |
@@ -631,42 +631,42 @@ discard block |
||
631 | 631 | * @global string $status |
632 | 632 | * @param string $which |
633 | 633 | */ |
634 | - public function bulk_actions( $which = '' ) { |
|
634 | + public function bulk_actions($which = '') { |
|
635 | 635 | global $status; |
636 | 636 | |
637 | - if ( in_array( $status, array( 'mustuse', 'dropins' ), true ) ) { |
|
637 | + if (in_array($status, array('mustuse', 'dropins'), true)) { |
|
638 | 638 | return; |
639 | 639 | } |
640 | 640 | |
641 | - parent::bulk_actions( $which ); |
|
641 | + parent::bulk_actions($which); |
|
642 | 642 | } |
643 | 643 | |
644 | 644 | /** |
645 | 645 | * @global string $status |
646 | 646 | * @param string $which |
647 | 647 | */ |
648 | - protected function extra_tablenav( $which ) { |
|
648 | + protected function extra_tablenav($which) { |
|
649 | 649 | global $status; |
650 | 650 | |
651 | - if ( ! in_array( $status, array( 'recently_activated', 'mustuse', 'dropins' ), true ) ) { |
|
651 | + if (!in_array($status, array('recently_activated', 'mustuse', 'dropins'), true)) { |
|
652 | 652 | return; |
653 | 653 | } |
654 | 654 | |
655 | 655 | echo '<div class="alignleft actions">'; |
656 | 656 | |
657 | - if ( 'recently_activated' === $status ) { |
|
658 | - submit_button( __( 'Clear List' ), '', 'clear-recent-list', false ); |
|
659 | - } elseif ( 'top' === $which && 'mustuse' === $status ) { |
|
657 | + if ('recently_activated' === $status) { |
|
658 | + submit_button(__('Clear List'), '', 'clear-recent-list', false); |
|
659 | + } elseif ('top' === $which && 'mustuse' === $status) { |
|
660 | 660 | echo '<p>' . sprintf( |
661 | 661 | /* translators: %s: mu-plugins directory name. */ |
662 | - __( 'Files in the %s directory are executed automatically.' ), |
|
663 | - '<code>' . str_replace( ABSPATH, '/', WPMU_PLUGIN_DIR ) . '</code>' |
|
662 | + __('Files in the %s directory are executed automatically.'), |
|
663 | + '<code>' . str_replace(ABSPATH, '/', WPMU_PLUGIN_DIR) . '</code>' |
|
664 | 664 | ) . '</p>'; |
665 | - } elseif ( 'top' === $which && 'dropins' === $status ) { |
|
665 | + } elseif ('top' === $which && 'dropins' === $status) { |
|
666 | 666 | echo '<p>' . sprintf( |
667 | 667 | /* translators: %s: wp-content directory name. */ |
668 | - __( 'Drop-ins are single files, found in the %s directory, that replace or enhance WordPress features in ways that are not possible for traditional plugins.' ), |
|
669 | - '<code>' . str_replace( ABSPATH, '', WP_CONTENT_DIR ) . '</code>' |
|
668 | + __('Drop-ins are single files, found in the %s directory, that replace or enhance WordPress features in ways that are not possible for traditional plugins.'), |
|
669 | + '<code>' . str_replace(ABSPATH, '', WP_CONTENT_DIR) . '</code>' |
|
670 | 670 | ) . '</p>'; |
671 | 671 | } |
672 | 672 | echo '</div>'; |
@@ -676,7 +676,7 @@ discard block |
||
676 | 676 | * @return string |
677 | 677 | */ |
678 | 678 | public function current_action() { |
679 | - if ( isset( $_POST['clear-recent-list'] ) ) { |
|
679 | + if (isset($_POST['clear-recent-list'])) { |
|
680 | 680 | return 'clear-recent-list'; |
681 | 681 | } |
682 | 682 | |
@@ -689,12 +689,12 @@ discard block |
||
689 | 689 | public function display_rows() { |
690 | 690 | global $status; |
691 | 691 | |
692 | - if ( is_multisite() && ! $this->screen->in_admin( 'network' ) && in_array( $status, array( 'mustuse', 'dropins' ), true ) ) { |
|
692 | + if (is_multisite() && !$this->screen->in_admin('network') && in_array($status, array('mustuse', 'dropins'), true)) { |
|
693 | 693 | return; |
694 | 694 | } |
695 | 695 | |
696 | - foreach ( $this->items as $plugin_file => $plugin_data ) { |
|
697 | - $this->single_row( array( $plugin_file, $plugin_data ) ); |
|
696 | + foreach ($this->items as $plugin_file => $plugin_data) { |
|
697 | + $this->single_row(array($plugin_file, $plugin_data)); |
|
698 | 698 | } |
699 | 699 | } |
700 | 700 | |
@@ -706,18 +706,18 @@ discard block |
||
706 | 706 | * |
707 | 707 | * @param array $item |
708 | 708 | */ |
709 | - public function single_row( $item ) { |
|
709 | + public function single_row($item) { |
|
710 | 710 | global $status, $page, $s, $totals; |
711 | 711 | static $plugin_id_attrs = array(); |
712 | 712 | |
713 | - list( $plugin_file, $plugin_data ) = $item; |
|
713 | + list($plugin_file, $plugin_data) = $item; |
|
714 | 714 | |
715 | - $plugin_slug = isset( $plugin_data['slug'] ) ? $plugin_data['slug'] : sanitize_title( $plugin_data['Name'] ); |
|
715 | + $plugin_slug = isset($plugin_data['slug']) ? $plugin_data['slug'] : sanitize_title($plugin_data['Name']); |
|
716 | 716 | $plugin_id_attr = $plugin_slug; |
717 | 717 | |
718 | 718 | // Ensure the ID attribute is unique. |
719 | 719 | $suffix = 2; |
720 | - while ( in_array( $plugin_id_attr, $plugin_id_attrs, true ) ) { |
|
720 | + while (in_array($plugin_id_attr, $plugin_id_attrs, true)) { |
|
721 | 721 | $plugin_id_attr = "$plugin_slug-$suffix"; |
722 | 722 | $suffix++; |
723 | 723 | } |
@@ -739,160 +739,160 @@ discard block |
||
739 | 739 | $restrict_network_active = false; |
740 | 740 | $restrict_network_only = false; |
741 | 741 | |
742 | - $requires_php = isset( $plugin_data['RequiresPHP'] ) ? $plugin_data['RequiresPHP'] : null; |
|
743 | - $requires_wp = isset( $plugin_data['RequiresWP'] ) ? $plugin_data['RequiresWP'] : null; |
|
742 | + $requires_php = isset($plugin_data['RequiresPHP']) ? $plugin_data['RequiresPHP'] : null; |
|
743 | + $requires_wp = isset($plugin_data['RequiresWP']) ? $plugin_data['RequiresWP'] : null; |
|
744 | 744 | |
745 | - $compatible_php = is_php_version_compatible( $requires_php ); |
|
746 | - $compatible_wp = is_wp_version_compatible( $requires_wp ); |
|
745 | + $compatible_php = is_php_version_compatible($requires_php); |
|
746 | + $compatible_wp = is_wp_version_compatible($requires_wp); |
|
747 | 747 | |
748 | - if ( 'mustuse' === $context ) { |
|
748 | + if ('mustuse' === $context) { |
|
749 | 749 | $is_active = true; |
750 | - } elseif ( 'dropins' === $context ) { |
|
750 | + } elseif ('dropins' === $context) { |
|
751 | 751 | $dropins = _get_dropins(); |
752 | 752 | $plugin_name = $plugin_file; |
753 | 753 | |
754 | - if ( $plugin_file !== $plugin_data['Name'] ) { |
|
754 | + if ($plugin_file !== $plugin_data['Name']) { |
|
755 | 755 | $plugin_name .= '<br/>' . $plugin_data['Name']; |
756 | 756 | } |
757 | 757 | |
758 | - if ( true === ( $dropins[ $plugin_file ][1] ) ) { // Doesn't require a constant. |
|
758 | + if (true === ($dropins[$plugin_file][1])) { // Doesn't require a constant. |
|
759 | 759 | $is_active = true; |
760 | - $description = '<p><strong>' . $dropins[ $plugin_file ][0] . '</strong></p>'; |
|
761 | - } elseif ( defined( $dropins[ $plugin_file ][1] ) && constant( $dropins[ $plugin_file ][1] ) ) { // Constant is true. |
|
760 | + $description = '<p><strong>' . $dropins[$plugin_file][0] . '</strong></p>'; |
|
761 | + } elseif (defined($dropins[$plugin_file][1]) && constant($dropins[$plugin_file][1])) { // Constant is true. |
|
762 | 762 | $is_active = true; |
763 | - $description = '<p><strong>' . $dropins[ $plugin_file ][0] . '</strong></p>'; |
|
763 | + $description = '<p><strong>' . $dropins[$plugin_file][0] . '</strong></p>'; |
|
764 | 764 | } else { |
765 | 765 | $is_active = false; |
766 | - $description = '<p><strong>' . $dropins[ $plugin_file ][0] . ' <span class="error-message">' . __( 'Inactive:' ) . '</span></strong> ' . |
|
766 | + $description = '<p><strong>' . $dropins[$plugin_file][0] . ' <span class="error-message">' . __('Inactive:') . '</span></strong> ' . |
|
767 | 767 | sprintf( |
768 | 768 | /* translators: 1: Drop-in constant name, 2: wp-config.php */ |
769 | - __( 'Requires %1$s in %2$s file.' ), |
|
770 | - "<code>define('" . $dropins[ $plugin_file ][1] . "', true);</code>", |
|
769 | + __('Requires %1$s in %2$s file.'), |
|
770 | + "<code>define('" . $dropins[$plugin_file][1] . "', true);</code>", |
|
771 | 771 | '<code>wp-config.php</code>' |
772 | 772 | ) . '</p>'; |
773 | 773 | } |
774 | 774 | |
775 | - if ( $plugin_data['Description'] ) { |
|
775 | + if ($plugin_data['Description']) { |
|
776 | 776 | $description .= '<p>' . $plugin_data['Description'] . '</p>'; |
777 | 777 | } |
778 | 778 | } else { |
779 | - if ( $screen->in_admin( 'network' ) ) { |
|
780 | - $is_active = is_plugin_active_for_network( $plugin_file ); |
|
779 | + if ($screen->in_admin('network')) { |
|
780 | + $is_active = is_plugin_active_for_network($plugin_file); |
|
781 | 781 | } else { |
782 | - $is_active = is_plugin_active( $plugin_file ); |
|
783 | - $restrict_network_active = ( is_multisite() && is_plugin_active_for_network( $plugin_file ) ); |
|
784 | - $restrict_network_only = ( is_multisite() && is_network_only_plugin( $plugin_file ) && ! $is_active ); |
|
782 | + $is_active = is_plugin_active($plugin_file); |
|
783 | + $restrict_network_active = (is_multisite() && is_plugin_active_for_network($plugin_file)); |
|
784 | + $restrict_network_only = (is_multisite() && is_network_only_plugin($plugin_file) && !$is_active); |
|
785 | 785 | } |
786 | 786 | |
787 | - if ( $screen->in_admin( 'network' ) ) { |
|
788 | - if ( $is_active ) { |
|
789 | - if ( current_user_can( 'manage_network_plugins' ) ) { |
|
787 | + if ($screen->in_admin('network')) { |
|
788 | + if ($is_active) { |
|
789 | + if (current_user_can('manage_network_plugins')) { |
|
790 | 790 | $actions['deactivate'] = sprintf( |
791 | 791 | '<a href="%s" id="deactivate-%s" aria-label="%s">%s</a>', |
792 | - wp_nonce_url( 'plugins.php?action=deactivate&plugin=' . urlencode( $plugin_file ) . '&plugin_status=' . $context . '&paged=' . $page . '&s=' . $s, 'deactivate-plugin_' . $plugin_file ), |
|
793 | - esc_attr( $plugin_id_attr ), |
|
792 | + wp_nonce_url('plugins.php?action=deactivate&plugin=' . urlencode($plugin_file) . '&plugin_status=' . $context . '&paged=' . $page . '&s=' . $s, 'deactivate-plugin_' . $plugin_file), |
|
793 | + esc_attr($plugin_id_attr), |
|
794 | 794 | /* translators: %s: Plugin name. */ |
795 | - esc_attr( sprintf( _x( 'Network Deactivate %s', 'plugin' ), $plugin_data['Name'] ) ), |
|
796 | - __( 'Network Deactivate' ) |
|
795 | + esc_attr(sprintf(_x('Network Deactivate %s', 'plugin'), $plugin_data['Name'])), |
|
796 | + __('Network Deactivate') |
|
797 | 797 | ); |
798 | 798 | } |
799 | 799 | } else { |
800 | - if ( current_user_can( 'manage_network_plugins' ) ) { |
|
801 | - if ( $compatible_php && $compatible_wp ) { |
|
800 | + if (current_user_can('manage_network_plugins')) { |
|
801 | + if ($compatible_php && $compatible_wp) { |
|
802 | 802 | $actions['activate'] = sprintf( |
803 | 803 | '<a href="%s" id="activate-%s" class="edit" aria-label="%s">%s</a>', |
804 | - wp_nonce_url( 'plugins.php?action=activate&plugin=' . urlencode( $plugin_file ) . '&plugin_status=' . $context . '&paged=' . $page . '&s=' . $s, 'activate-plugin_' . $plugin_file ), |
|
805 | - esc_attr( $plugin_id_attr ), |
|
804 | + wp_nonce_url('plugins.php?action=activate&plugin=' . urlencode($plugin_file) . '&plugin_status=' . $context . '&paged=' . $page . '&s=' . $s, 'activate-plugin_' . $plugin_file), |
|
805 | + esc_attr($plugin_id_attr), |
|
806 | 806 | /* translators: %s: Plugin name. */ |
807 | - esc_attr( sprintf( _x( 'Network Activate %s', 'plugin' ), $plugin_data['Name'] ) ), |
|
808 | - __( 'Network Activate' ) |
|
807 | + esc_attr(sprintf(_x('Network Activate %s', 'plugin'), $plugin_data['Name'])), |
|
808 | + __('Network Activate') |
|
809 | 809 | ); |
810 | 810 | } else { |
811 | 811 | $actions['activate'] = sprintf( |
812 | 812 | '<span>%s</span>', |
813 | - _x( 'Cannot Activate', 'plugin' ) |
|
813 | + _x('Cannot Activate', 'plugin') |
|
814 | 814 | ); |
815 | 815 | } |
816 | 816 | } |
817 | 817 | |
818 | - if ( current_user_can( 'delete_plugins' ) && ! is_plugin_active( $plugin_file ) ) { |
|
818 | + if (current_user_can('delete_plugins') && !is_plugin_active($plugin_file)) { |
|
819 | 819 | $actions['delete'] = sprintf( |
820 | 820 | '<a href="%s" id="delete-%s" class="delete" aria-label="%s">%s</a>', |
821 | - wp_nonce_url( 'plugins.php?action=delete-selected&checked[]=' . urlencode( $plugin_file ) . '&plugin_status=' . $context . '&paged=' . $page . '&s=' . $s, 'bulk-plugins' ), |
|
822 | - esc_attr( $plugin_id_attr ), |
|
821 | + wp_nonce_url('plugins.php?action=delete-selected&checked[]=' . urlencode($plugin_file) . '&plugin_status=' . $context . '&paged=' . $page . '&s=' . $s, 'bulk-plugins'), |
|
822 | + esc_attr($plugin_id_attr), |
|
823 | 823 | /* translators: %s: Plugin name. */ |
824 | - esc_attr( sprintf( _x( 'Delete %s', 'plugin' ), $plugin_data['Name'] ) ), |
|
825 | - __( 'Delete' ) |
|
824 | + esc_attr(sprintf(_x('Delete %s', 'plugin'), $plugin_data['Name'])), |
|
825 | + __('Delete') |
|
826 | 826 | ); |
827 | 827 | } |
828 | 828 | } |
829 | 829 | } else { |
830 | - if ( $restrict_network_active ) { |
|
830 | + if ($restrict_network_active) { |
|
831 | 831 | $actions = array( |
832 | - 'network_active' => __( 'Network Active' ), |
|
832 | + 'network_active' => __('Network Active'), |
|
833 | 833 | ); |
834 | - } elseif ( $restrict_network_only ) { |
|
834 | + } elseif ($restrict_network_only) { |
|
835 | 835 | $actions = array( |
836 | - 'network_only' => __( 'Network Only' ), |
|
836 | + 'network_only' => __('Network Only'), |
|
837 | 837 | ); |
838 | - } elseif ( $is_active ) { |
|
839 | - if ( current_user_can( 'deactivate_plugin', $plugin_file ) ) { |
|
838 | + } elseif ($is_active) { |
|
839 | + if (current_user_can('deactivate_plugin', $plugin_file)) { |
|
840 | 840 | $actions['deactivate'] = sprintf( |
841 | 841 | '<a href="%s" id="deactivate-%s" aria-label="%s">%s</a>', |
842 | - wp_nonce_url( 'plugins.php?action=deactivate&plugin=' . urlencode( $plugin_file ) . '&plugin_status=' . $context . '&paged=' . $page . '&s=' . $s, 'deactivate-plugin_' . $plugin_file ), |
|
843 | - esc_attr( $plugin_id_attr ), |
|
842 | + wp_nonce_url('plugins.php?action=deactivate&plugin=' . urlencode($plugin_file) . '&plugin_status=' . $context . '&paged=' . $page . '&s=' . $s, 'deactivate-plugin_' . $plugin_file), |
|
843 | + esc_attr($plugin_id_attr), |
|
844 | 844 | /* translators: %s: Plugin name. */ |
845 | - esc_attr( sprintf( _x( 'Deactivate %s', 'plugin' ), $plugin_data['Name'] ) ), |
|
846 | - __( 'Deactivate' ) |
|
845 | + esc_attr(sprintf(_x('Deactivate %s', 'plugin'), $plugin_data['Name'])), |
|
846 | + __('Deactivate') |
|
847 | 847 | ); |
848 | 848 | } |
849 | 849 | |
850 | - if ( current_user_can( 'resume_plugin', $plugin_file ) && is_plugin_paused( $plugin_file ) ) { |
|
850 | + if (current_user_can('resume_plugin', $plugin_file) && is_plugin_paused($plugin_file)) { |
|
851 | 851 | $actions['resume'] = sprintf( |
852 | 852 | '<a href="%s" id="resume-%s" class="resume-link" aria-label="%s">%s</a>', |
853 | - wp_nonce_url( 'plugins.php?action=resume&plugin=' . urlencode( $plugin_file ) . '&plugin_status=' . $context . '&paged=' . $page . '&s=' . $s, 'resume-plugin_' . $plugin_file ), |
|
854 | - esc_attr( $plugin_id_attr ), |
|
853 | + wp_nonce_url('plugins.php?action=resume&plugin=' . urlencode($plugin_file) . '&plugin_status=' . $context . '&paged=' . $page . '&s=' . $s, 'resume-plugin_' . $plugin_file), |
|
854 | + esc_attr($plugin_id_attr), |
|
855 | 855 | /* translators: %s: Plugin name. */ |
856 | - esc_attr( sprintf( _x( 'Resume %s', 'plugin' ), $plugin_data['Name'] ) ), |
|
857 | - __( 'Resume' ) |
|
856 | + esc_attr(sprintf(_x('Resume %s', 'plugin'), $plugin_data['Name'])), |
|
857 | + __('Resume') |
|
858 | 858 | ); |
859 | 859 | } |
860 | 860 | } else { |
861 | - if ( current_user_can( 'activate_plugin', $plugin_file ) ) { |
|
862 | - if ( $compatible_php && $compatible_wp ) { |
|
861 | + if (current_user_can('activate_plugin', $plugin_file)) { |
|
862 | + if ($compatible_php && $compatible_wp) { |
|
863 | 863 | $actions['activate'] = sprintf( |
864 | 864 | '<a href="%s" id="activate-%s" class="edit" aria-label="%s">%s</a>', |
865 | - wp_nonce_url( 'plugins.php?action=activate&plugin=' . urlencode( $plugin_file ) . '&plugin_status=' . $context . '&paged=' . $page . '&s=' . $s, 'activate-plugin_' . $plugin_file ), |
|
866 | - esc_attr( $plugin_id_attr ), |
|
865 | + wp_nonce_url('plugins.php?action=activate&plugin=' . urlencode($plugin_file) . '&plugin_status=' . $context . '&paged=' . $page . '&s=' . $s, 'activate-plugin_' . $plugin_file), |
|
866 | + esc_attr($plugin_id_attr), |
|
867 | 867 | /* translators: %s: Plugin name. */ |
868 | - esc_attr( sprintf( _x( 'Activate %s', 'plugin' ), $plugin_data['Name'] ) ), |
|
869 | - __( 'Activate' ) |
|
868 | + esc_attr(sprintf(_x('Activate %s', 'plugin'), $plugin_data['Name'])), |
|
869 | + __('Activate') |
|
870 | 870 | ); |
871 | 871 | } else { |
872 | 872 | $actions['activate'] = sprintf( |
873 | 873 | '<span>%s</span>', |
874 | - _x( 'Cannot Activate', 'plugin' ) |
|
874 | + _x('Cannot Activate', 'plugin') |
|
875 | 875 | ); |
876 | 876 | } |
877 | 877 | } |
878 | 878 | |
879 | - if ( ! is_multisite() && current_user_can( 'delete_plugins' ) ) { |
|
879 | + if (!is_multisite() && current_user_can('delete_plugins')) { |
|
880 | 880 | $actions['delete'] = sprintf( |
881 | 881 | '<a href="%s" id="delete-%s" class="delete" aria-label="%s">%s</a>', |
882 | - wp_nonce_url( 'plugins.php?action=delete-selected&checked[]=' . urlencode( $plugin_file ) . '&plugin_status=' . $context . '&paged=' . $page . '&s=' . $s, 'bulk-plugins' ), |
|
883 | - esc_attr( $plugin_id_attr ), |
|
882 | + wp_nonce_url('plugins.php?action=delete-selected&checked[]=' . urlencode($plugin_file) . '&plugin_status=' . $context . '&paged=' . $page . '&s=' . $s, 'bulk-plugins'), |
|
883 | + esc_attr($plugin_id_attr), |
|
884 | 884 | /* translators: %s: Plugin name. */ |
885 | - esc_attr( sprintf( _x( 'Delete %s', 'plugin' ), $plugin_data['Name'] ) ), |
|
886 | - __( 'Delete' ) |
|
885 | + esc_attr(sprintf(_x('Delete %s', 'plugin'), $plugin_data['Name'])), |
|
886 | + __('Delete') |
|
887 | 887 | ); |
888 | 888 | } |
889 | 889 | } // End if $is_active. |
890 | 890 | } // End if $screen->in_admin( 'network' ). |
891 | 891 | } // End if $context. |
892 | 892 | |
893 | - $actions = array_filter( $actions ); |
|
893 | + $actions = array_filter($actions); |
|
894 | 894 | |
895 | - if ( $screen->in_admin( 'network' ) ) { |
|
895 | + if ($screen->in_admin('network')) { |
|
896 | 896 | |
897 | 897 | /** |
898 | 898 | * Filters the action links displayed for each plugin in the Network Admin Plugins list table. |
@@ -909,7 +909,7 @@ discard block |
||
909 | 909 | * 'active', 'inactive', 'recently_activated', 'upgrade', |
910 | 910 | * 'mustuse', 'dropins', and 'search'. |
911 | 911 | */ |
912 | - $actions = apply_filters( 'network_admin_plugin_action_links', $actions, $plugin_file, $plugin_data, $context ); |
|
912 | + $actions = apply_filters('network_admin_plugin_action_links', $actions, $plugin_file, $plugin_data, $context); |
|
913 | 913 | |
914 | 914 | /** |
915 | 915 | * Filters the list of action links displayed for a specific plugin in the Network Admin Plugins list table. |
@@ -929,7 +929,7 @@ discard block |
||
929 | 929 | * 'active', 'inactive', 'recently_activated', 'upgrade', |
930 | 930 | * 'mustuse', 'dropins', and 'search'. |
931 | 931 | */ |
932 | - $actions = apply_filters( "network_admin_plugin_action_links_{$plugin_file}", $actions, $plugin_file, $plugin_data, $context ); |
|
932 | + $actions = apply_filters("network_admin_plugin_action_links_{$plugin_file}", $actions, $plugin_file, $plugin_data, $context); |
|
933 | 933 | |
934 | 934 | } else { |
935 | 935 | |
@@ -951,7 +951,7 @@ discard block |
||
951 | 951 | * 'active', 'inactive', 'recently_activated', 'upgrade', |
952 | 952 | * 'mustuse', 'dropins', and 'search'. |
953 | 953 | */ |
954 | - $actions = apply_filters( 'plugin_action_links', $actions, $plugin_file, $plugin_data, $context ); |
|
954 | + $actions = apply_filters('plugin_action_links', $actions, $plugin_file, $plugin_data, $context); |
|
955 | 955 | |
956 | 956 | /** |
957 | 957 | * Filters the list of action links displayed for a specific plugin in the Plugins list table. |
@@ -973,14 +973,14 @@ discard block |
||
973 | 973 | * 'active', 'inactive', 'recently_activated', 'upgrade', |
974 | 974 | * 'mustuse', 'dropins', and 'search'. |
975 | 975 | */ |
976 | - $actions = apply_filters( "plugin_action_links_{$plugin_file}", $actions, $plugin_file, $plugin_data, $context ); |
|
976 | + $actions = apply_filters("plugin_action_links_{$plugin_file}", $actions, $plugin_file, $plugin_data, $context); |
|
977 | 977 | |
978 | 978 | } |
979 | 979 | |
980 | 980 | $class = $is_active ? 'active' : 'inactive'; |
981 | - $checkbox_id = 'checkbox_' . md5( $plugin_file ); |
|
981 | + $checkbox_id = 'checkbox_' . md5($plugin_file); |
|
982 | 982 | |
983 | - if ( $restrict_network_active || $restrict_network_only || in_array( $status, array( 'mustuse', 'dropins' ), true ) || ! $compatible_php ) { |
|
983 | + if ($restrict_network_active || $restrict_network_only || in_array($status, array('mustuse', 'dropins'), true) || !$compatible_php) { |
|
984 | 984 | $checkbox = ''; |
985 | 985 | } else { |
986 | 986 | $checkbox = sprintf( |
@@ -988,57 +988,57 @@ discard block |
||
988 | 988 | '<input type="checkbox" name="checked[]" value="%3$s" id="%1$s" />', |
989 | 989 | $checkbox_id, |
990 | 990 | /* translators: %s: Plugin name. */ |
991 | - sprintf( __( 'Select %s' ), $plugin_data['Name'] ), |
|
992 | - esc_attr( $plugin_file ) |
|
991 | + sprintf(__('Select %s'), $plugin_data['Name']), |
|
992 | + esc_attr($plugin_file) |
|
993 | 993 | ); |
994 | 994 | } |
995 | 995 | |
996 | - if ( 'dropins' !== $context ) { |
|
997 | - $description = '<p>' . ( $plugin_data['Description'] ? $plugin_data['Description'] : ' ' ) . '</p>'; |
|
996 | + if ('dropins' !== $context) { |
|
997 | + $description = '<p>' . ($plugin_data['Description'] ? $plugin_data['Description'] : ' ') . '</p>'; |
|
998 | 998 | $plugin_name = $plugin_data['Name']; |
999 | 999 | } |
1000 | 1000 | |
1001 | - if ( ! empty( $totals['upgrade'] ) && ! empty( $plugin_data['update'] ) |
|
1002 | - || ! $compatible_php || ! $compatible_wp |
|
1001 | + if (!empty($totals['upgrade']) && !empty($plugin_data['update']) |
|
1002 | + || !$compatible_php || !$compatible_wp |
|
1003 | 1003 | ) { |
1004 | 1004 | $class .= ' update'; |
1005 | 1005 | } |
1006 | 1006 | |
1007 | - $paused = ! $screen->in_admin( 'network' ) && is_plugin_paused( $plugin_file ); |
|
1007 | + $paused = !$screen->in_admin('network') && is_plugin_paused($plugin_file); |
|
1008 | 1008 | |
1009 | - if ( $paused ) { |
|
1009 | + if ($paused) { |
|
1010 | 1010 | $class .= ' paused'; |
1011 | 1011 | } |
1012 | 1012 | |
1013 | - if ( is_uninstallable_plugin( $plugin_file ) ) { |
|
1013 | + if (is_uninstallable_plugin($plugin_file)) { |
|
1014 | 1014 | $class .= ' is-uninstallable'; |
1015 | 1015 | } |
1016 | 1016 | |
1017 | 1017 | printf( |
1018 | 1018 | '<tr class="%s" data-slug="%s" data-plugin="%s">', |
1019 | - esc_attr( $class ), |
|
1020 | - esc_attr( $plugin_slug ), |
|
1021 | - esc_attr( $plugin_file ) |
|
1019 | + esc_attr($class), |
|
1020 | + esc_attr($plugin_slug), |
|
1021 | + esc_attr($plugin_file) |
|
1022 | 1022 | ); |
1023 | 1023 | |
1024 | - list( $columns, $hidden, $sortable, $primary ) = $this->get_column_info(); |
|
1024 | + list($columns, $hidden, $sortable, $primary) = $this->get_column_info(); |
|
1025 | 1025 | |
1026 | - $auto_updates = (array) get_site_option( 'auto_update_plugins', array() ); |
|
1027 | - $available_updates = get_site_transient( 'update_plugins' ); |
|
1026 | + $auto_updates = (array) get_site_option('auto_update_plugins', array()); |
|
1027 | + $available_updates = get_site_transient('update_plugins'); |
|
1028 | 1028 | |
1029 | - foreach ( $columns as $column_name => $column_display_name ) { |
|
1029 | + foreach ($columns as $column_name => $column_display_name) { |
|
1030 | 1030 | $extra_classes = ''; |
1031 | - if ( in_array( $column_name, $hidden, true ) ) { |
|
1031 | + if (in_array($column_name, $hidden, true)) { |
|
1032 | 1032 | $extra_classes = ' hidden'; |
1033 | 1033 | } |
1034 | 1034 | |
1035 | - switch ( $column_name ) { |
|
1035 | + switch ($column_name) { |
|
1036 | 1036 | case 'cb': |
1037 | 1037 | echo "<th scope='row' class='check-column'>$checkbox</th>"; |
1038 | 1038 | break; |
1039 | 1039 | case 'name': |
1040 | 1040 | echo "<td class='plugin-title column-primary'><strong>$plugin_name</strong>"; |
1041 | - echo $this->row_actions( $actions, true ); |
|
1041 | + echo $this->row_actions($actions, true); |
|
1042 | 1042 | echo '</td>'; |
1043 | 1043 | break; |
1044 | 1044 | case 'description': |
@@ -1049,21 +1049,21 @@ discard block |
||
1049 | 1049 | <div class='$class second plugin-version-author-uri'>"; |
1050 | 1050 | |
1051 | 1051 | $plugin_meta = array(); |
1052 | - if ( ! empty( $plugin_data['Version'] ) ) { |
|
1052 | + if (!empty($plugin_data['Version'])) { |
|
1053 | 1053 | /* translators: %s: Plugin version number. */ |
1054 | - $plugin_meta[] = sprintf( __( 'Version %s' ), $plugin_data['Version'] ); |
|
1054 | + $plugin_meta[] = sprintf(__('Version %s'), $plugin_data['Version']); |
|
1055 | 1055 | } |
1056 | - if ( ! empty( $plugin_data['Author'] ) ) { |
|
1056 | + if (!empty($plugin_data['Author'])) { |
|
1057 | 1057 | $author = $plugin_data['Author']; |
1058 | - if ( ! empty( $plugin_data['AuthorURI'] ) ) { |
|
1058 | + if (!empty($plugin_data['AuthorURI'])) { |
|
1059 | 1059 | $author = '<a href="' . $plugin_data['AuthorURI'] . '">' . $plugin_data['Author'] . '</a>'; |
1060 | 1060 | } |
1061 | 1061 | /* translators: %s: Plugin author name. */ |
1062 | - $plugin_meta[] = sprintf( __( 'By %s' ), $author ); |
|
1062 | + $plugin_meta[] = sprintf(__('By %s'), $author); |
|
1063 | 1063 | } |
1064 | 1064 | |
1065 | 1065 | // Details link using API info, if available. |
1066 | - if ( isset( $plugin_data['slug'] ) && current_user_can( 'install_plugins' ) ) { |
|
1066 | + if (isset($plugin_data['slug']) && current_user_can('install_plugins')) { |
|
1067 | 1067 | $plugin_meta[] = sprintf( |
1068 | 1068 | '<a href="%s" class="thickbox open-plugin-details-modal" aria-label="%s" data-title="%s">%s</a>', |
1069 | 1069 | esc_url( |
@@ -1073,19 +1073,19 @@ discard block |
||
1073 | 1073 | ) |
1074 | 1074 | ), |
1075 | 1075 | /* translators: %s: Plugin name. */ |
1076 | - esc_attr( sprintf( __( 'More information about %s' ), $plugin_name ) ), |
|
1077 | - esc_attr( $plugin_name ), |
|
1078 | - __( 'View details' ) |
|
1076 | + esc_attr(sprintf(__('More information about %s'), $plugin_name)), |
|
1077 | + esc_attr($plugin_name), |
|
1078 | + __('View details') |
|
1079 | 1079 | ); |
1080 | - } elseif ( ! empty( $plugin_data['PluginURI'] ) ) { |
|
1080 | + } elseif (!empty($plugin_data['PluginURI'])) { |
|
1081 | 1081 | /* translators: %s: Plugin name. */ |
1082 | - $aria_label = sprintf( __( 'Visit plugin site for %s' ), $plugin_name ); |
|
1082 | + $aria_label = sprintf(__('Visit plugin site for %s'), $plugin_name); |
|
1083 | 1083 | |
1084 | 1084 | $plugin_meta[] = sprintf( |
1085 | 1085 | '<a href="%s" aria-label="%s">%s</a>', |
1086 | - esc_url( $plugin_data['PluginURI'] ), |
|
1087 | - esc_attr( $aria_label ), |
|
1088 | - __( 'Visit plugin site' ) |
|
1086 | + esc_url($plugin_data['PluginURI']), |
|
1087 | + esc_attr($aria_label), |
|
1088 | + __('Visit plugin site') |
|
1089 | 1089 | ); |
1090 | 1090 | } |
1091 | 1091 | |
@@ -1135,28 +1135,28 @@ discard block |
||
1135 | 1135 | * 'upgrade', 'mustuse', 'dropins', 'search', 'paused', |
1136 | 1136 | * 'auto-update-enabled', 'auto-update-disabled'. |
1137 | 1137 | */ |
1138 | - $plugin_meta = apply_filters( 'plugin_row_meta', $plugin_meta, $plugin_file, $plugin_data, $status ); |
|
1138 | + $plugin_meta = apply_filters('plugin_row_meta', $plugin_meta, $plugin_file, $plugin_data, $status); |
|
1139 | 1139 | |
1140 | - echo implode( ' | ', $plugin_meta ); |
|
1140 | + echo implode(' | ', $plugin_meta); |
|
1141 | 1141 | |
1142 | 1142 | echo '</div>'; |
1143 | 1143 | |
1144 | - if ( $paused ) { |
|
1145 | - $notice_text = __( 'This plugin failed to load properly and is paused during recovery mode.' ); |
|
1144 | + if ($paused) { |
|
1145 | + $notice_text = __('This plugin failed to load properly and is paused during recovery mode.'); |
|
1146 | 1146 | |
1147 | - printf( '<p><span class="dashicons dashicons-warning"></span> <strong>%s</strong></p>', $notice_text ); |
|
1147 | + printf('<p><span class="dashicons dashicons-warning"></span> <strong>%s</strong></p>', $notice_text); |
|
1148 | 1148 | |
1149 | - $error = wp_get_plugin_error( $plugin_file ); |
|
1149 | + $error = wp_get_plugin_error($plugin_file); |
|
1150 | 1150 | |
1151 | - if ( false !== $error ) { |
|
1152 | - printf( '<div class="error-display"><p>%s</p></div>', wp_get_extension_error_description( $error ) ); |
|
1151 | + if (false !== $error) { |
|
1152 | + printf('<div class="error-display"><p>%s</p></div>', wp_get_extension_error_description($error)); |
|
1153 | 1153 | } |
1154 | 1154 | } |
1155 | 1155 | |
1156 | 1156 | echo '</td>'; |
1157 | 1157 | break; |
1158 | 1158 | case 'auto-updates': |
1159 | - if ( ! $this->show_autoupdates ) { |
|
1159 | + if (!$this->show_autoupdates) { |
|
1160 | 1160 | break; |
1161 | 1161 | } |
1162 | 1162 | |
@@ -1164,25 +1164,25 @@ discard block |
||
1164 | 1164 | |
1165 | 1165 | $html = array(); |
1166 | 1166 | |
1167 | - if ( isset( $plugin_data['auto-update-forced'] ) ) { |
|
1168 | - if ( $plugin_data['auto-update-forced'] ) { |
|
1167 | + if (isset($plugin_data['auto-update-forced'])) { |
|
1168 | + if ($plugin_data['auto-update-forced']) { |
|
1169 | 1169 | // Forced on. |
1170 | - $text = __( 'Auto-updates enabled' ); |
|
1170 | + $text = __('Auto-updates enabled'); |
|
1171 | 1171 | } else { |
1172 | - $text = __( 'Auto-updates disabled' ); |
|
1172 | + $text = __('Auto-updates disabled'); |
|
1173 | 1173 | } |
1174 | 1174 | $action = 'unavailable'; |
1175 | 1175 | $time_class = ' hidden'; |
1176 | - } elseif ( empty( $plugin_data['update-supported'] ) ) { |
|
1176 | + } elseif (empty($plugin_data['update-supported'])) { |
|
1177 | 1177 | $text = ''; |
1178 | 1178 | $action = 'unavailable'; |
1179 | 1179 | $time_class = ' hidden'; |
1180 | - } elseif ( in_array( $plugin_file, $auto_updates, true ) ) { |
|
1181 | - $text = __( 'Disable auto-updates' ); |
|
1180 | + } elseif (in_array($plugin_file, $auto_updates, true)) { |
|
1181 | + $text = __('Disable auto-updates'); |
|
1182 | 1182 | $action = 'disable'; |
1183 | 1183 | $time_class = ''; |
1184 | 1184 | } else { |
1185 | - $text = __( 'Enable auto-updates' ); |
|
1185 | + $text = __('Enable auto-updates'); |
|
1186 | 1186 | $action = 'enable'; |
1187 | 1187 | $time_class = ' hidden'; |
1188 | 1188 | } |
@@ -1194,14 +1194,14 @@ discard block |
||
1194 | 1194 | 'plugin_status' => $status, |
1195 | 1195 | ); |
1196 | 1196 | |
1197 | - $url = add_query_arg( $query_args, 'plugins.php' ); |
|
1197 | + $url = add_query_arg($query_args, 'plugins.php'); |
|
1198 | 1198 | |
1199 | - if ( 'unavailable' === $action ) { |
|
1199 | + if ('unavailable' === $action) { |
|
1200 | 1200 | $html[] = '<span class="label">' . $text . '</span>'; |
1201 | 1201 | } else { |
1202 | 1202 | $html[] = sprintf( |
1203 | 1203 | '<a href="%s" class="toggle-auto-update aria-button-if-js" data-wp-action="%s">', |
1204 | - wp_nonce_url( $url, 'updates' ), |
|
1204 | + wp_nonce_url($url, 'updates'), |
|
1205 | 1205 | $action |
1206 | 1206 | ); |
1207 | 1207 | |
@@ -1210,7 +1210,7 @@ discard block |
||
1210 | 1210 | $html[] = '</a>'; |
1211 | 1211 | } |
1212 | 1212 | |
1213 | - if ( ! empty( $plugin_data['update'] ) ) { |
|
1213 | + if (!empty($plugin_data['update'])) { |
|
1214 | 1214 | $html[] = sprintf( |
1215 | 1215 | '<div class="auto-update-time%s">%s</div>', |
1216 | 1216 | $time_class, |
@@ -1218,7 +1218,7 @@ discard block |
||
1218 | 1218 | ); |
1219 | 1219 | } |
1220 | 1220 | |
1221 | - $html = implode( '', $html ); |
|
1221 | + $html = implode('', $html); |
|
1222 | 1222 | |
1223 | 1223 | /** |
1224 | 1224 | * Filters the HTML of the auto-updates setting for each plugin in the Plugins list table. |
@@ -1233,7 +1233,7 @@ discard block |
||
1233 | 1233 | * and the {@see 'plugin_row_meta'} filter for the list |
1234 | 1234 | * of possible values. |
1235 | 1235 | */ |
1236 | - echo apply_filters( 'plugin_auto_update_setting_html', $html, $plugin_file, $plugin_data ); |
|
1236 | + echo apply_filters('plugin_auto_update_setting_html', $html, $plugin_file, $plugin_data); |
|
1237 | 1237 | |
1238 | 1238 | echo '<div class="notice notice-error notice-alt inline hidden"><p></p></div>'; |
1239 | 1239 | echo '</td>'; |
@@ -1255,7 +1255,7 @@ discard block |
||
1255 | 1255 | * and the {@see 'plugin_row_meta'} filter for the list |
1256 | 1256 | * of possible values. |
1257 | 1257 | */ |
1258 | - do_action( 'manage_plugins_custom_column', $column_name, $plugin_file, $plugin_data ); |
|
1258 | + do_action('manage_plugins_custom_column', $column_name, $plugin_file, $plugin_data); |
|
1259 | 1259 | |
1260 | 1260 | echo '</td>'; |
1261 | 1261 | } |
@@ -1263,56 +1263,56 @@ discard block |
||
1263 | 1263 | |
1264 | 1264 | echo '</tr>'; |
1265 | 1265 | |
1266 | - if ( ! $compatible_php || ! $compatible_wp ) { |
|
1266 | + if (!$compatible_php || !$compatible_wp) { |
|
1267 | 1267 | printf( |
1268 | 1268 | '<tr class="plugin-update-tr">' . |
1269 | 1269 | '<td colspan="%s" class="plugin-update colspanchange">' . |
1270 | 1270 | '<div class="update-message notice inline notice-error notice-alt"><p>', |
1271 | - esc_attr( $this->get_column_count() ) |
|
1271 | + esc_attr($this->get_column_count()) |
|
1272 | 1272 | ); |
1273 | 1273 | |
1274 | - if ( ! $compatible_php && ! $compatible_wp ) { |
|
1275 | - _e( 'This plugin does not work with your versions of WordPress and PHP.' ); |
|
1276 | - if ( current_user_can( 'update_core' ) && current_user_can( 'update_php' ) ) { |
|
1274 | + if (!$compatible_php && !$compatible_wp) { |
|
1275 | + _e('This plugin does not work with your versions of WordPress and PHP.'); |
|
1276 | + if (current_user_can('update_core') && current_user_can('update_php')) { |
|
1277 | 1277 | printf( |
1278 | 1278 | /* translators: 1: URL to WordPress Updates screen, 2: URL to Update PHP page. */ |
1279 | - ' ' . __( '<a href="%1$s">Please update WordPress</a>, and then <a href="%2$s">learn more about updating PHP</a>.' ), |
|
1280 | - self_admin_url( 'update-core.php' ), |
|
1281 | - esc_url( wp_get_update_php_url() ) |
|
1279 | + ' ' . __('<a href="%1$s">Please update WordPress</a>, and then <a href="%2$s">learn more about updating PHP</a>.'), |
|
1280 | + self_admin_url('update-core.php'), |
|
1281 | + esc_url(wp_get_update_php_url()) |
|
1282 | 1282 | ); |
1283 | - wp_update_php_annotation( '</p><p><em>', '</em>' ); |
|
1284 | - } elseif ( current_user_can( 'update_core' ) ) { |
|
1283 | + wp_update_php_annotation('</p><p><em>', '</em>'); |
|
1284 | + } elseif (current_user_can('update_core')) { |
|
1285 | 1285 | printf( |
1286 | 1286 | /* translators: %s: URL to WordPress Updates screen. */ |
1287 | - ' ' . __( '<a href="%s">Please update WordPress</a>.' ), |
|
1288 | - self_admin_url( 'update-core.php' ) |
|
1287 | + ' ' . __('<a href="%s">Please update WordPress</a>.'), |
|
1288 | + self_admin_url('update-core.php') |
|
1289 | 1289 | ); |
1290 | - } elseif ( current_user_can( 'update_php' ) ) { |
|
1290 | + } elseif (current_user_can('update_php')) { |
|
1291 | 1291 | printf( |
1292 | 1292 | /* translators: %s: URL to Update PHP page. */ |
1293 | - ' ' . __( '<a href="%s">Learn more about updating PHP</a>.' ), |
|
1294 | - esc_url( wp_get_update_php_url() ) |
|
1293 | + ' ' . __('<a href="%s">Learn more about updating PHP</a>.'), |
|
1294 | + esc_url(wp_get_update_php_url()) |
|
1295 | 1295 | ); |
1296 | - wp_update_php_annotation( '</p><p><em>', '</em>' ); |
|
1296 | + wp_update_php_annotation('</p><p><em>', '</em>'); |
|
1297 | 1297 | } |
1298 | - } elseif ( ! $compatible_wp ) { |
|
1299 | - _e( 'This plugin does not work with your version of WordPress.' ); |
|
1300 | - if ( current_user_can( 'update_core' ) ) { |
|
1298 | + } elseif (!$compatible_wp) { |
|
1299 | + _e('This plugin does not work with your version of WordPress.'); |
|
1300 | + if (current_user_can('update_core')) { |
|
1301 | 1301 | printf( |
1302 | 1302 | /* translators: %s: URL to WordPress Updates screen. */ |
1303 | - ' ' . __( '<a href="%s">Please update WordPress</a>.' ), |
|
1304 | - self_admin_url( 'update-core.php' ) |
|
1303 | + ' ' . __('<a href="%s">Please update WordPress</a>.'), |
|
1304 | + self_admin_url('update-core.php') |
|
1305 | 1305 | ); |
1306 | 1306 | } |
1307 | - } elseif ( ! $compatible_php ) { |
|
1308 | - _e( 'This plugin does not work with your version of PHP.' ); |
|
1309 | - if ( current_user_can( 'update_php' ) ) { |
|
1307 | + } elseif (!$compatible_php) { |
|
1308 | + _e('This plugin does not work with your version of PHP.'); |
|
1309 | + if (current_user_can('update_php')) { |
|
1310 | 1310 | printf( |
1311 | 1311 | /* translators: %s: URL to Update PHP page. */ |
1312 | - ' ' . __( '<a href="%s">Learn more about updating PHP</a>.' ), |
|
1313 | - esc_url( wp_get_update_php_url() ) |
|
1312 | + ' ' . __('<a href="%s">Learn more about updating PHP</a>.'), |
|
1313 | + esc_url(wp_get_update_php_url()) |
|
1314 | 1314 | ); |
1315 | - wp_update_php_annotation( '</p><p><em>', '</em>' ); |
|
1315 | + wp_update_php_annotation('</p><p><em>', '</em>'); |
|
1316 | 1316 | } |
1317 | 1317 | } |
1318 | 1318 | |
@@ -1335,7 +1335,7 @@ discard block |
||
1335 | 1335 | * 'recently_activated', 'upgrade', 'mustuse', 'dropins', |
1336 | 1336 | * 'search', 'paused', 'auto-update-enabled', 'auto-update-disabled'. |
1337 | 1337 | */ |
1338 | - do_action( 'after_plugin_row', $plugin_file, $plugin_data, $status ); |
|
1338 | + do_action('after_plugin_row', $plugin_file, $plugin_data, $status); |
|
1339 | 1339 | |
1340 | 1340 | /** |
1341 | 1341 | * Fires after each specific row in the Plugins list table. |
@@ -1356,7 +1356,7 @@ discard block |
||
1356 | 1356 | * 'recently_activated', 'upgrade', 'mustuse', 'dropins', |
1357 | 1357 | * 'search', 'paused', 'auto-update-enabled', 'auto-update-disabled'. |
1358 | 1358 | */ |
1359 | - do_action( "after_plugin_row_{$plugin_file}", $plugin_file, $plugin_data, $status ); |
|
1359 | + do_action("after_plugin_row_{$plugin_file}", $plugin_file, $plugin_data, $status); |
|
1360 | 1360 | } |
1361 | 1361 | |
1362 | 1362 | /** |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | * @param array $args Optional. Arguments to pass to the class. Accepts 'screen'. |
20 | 20 | * @return WP_List_Table|false List table object on success, false if the class does not exist. |
21 | 21 | */ |
22 | -function _get_list_table( $class_name, $args = array() ) { |
|
22 | +function _get_list_table($class_name, $args = array()) { |
|
23 | 23 | $core_classes = array( |
24 | 24 | // Site Admin. |
25 | 25 | 'WP_Posts_List_Table' => 'posts', |
@@ -27,11 +27,11 @@ discard block |
||
27 | 27 | 'WP_Terms_List_Table' => 'terms', |
28 | 28 | 'WP_Users_List_Table' => 'users', |
29 | 29 | 'WP_Comments_List_Table' => 'comments', |
30 | - 'WP_Post_Comments_List_Table' => array( 'comments', 'post-comments' ), |
|
30 | + 'WP_Post_Comments_List_Table' => array('comments', 'post-comments'), |
|
31 | 31 | 'WP_Links_List_Table' => 'links', |
32 | 32 | 'WP_Plugin_Install_List_Table' => 'plugin-install', |
33 | 33 | 'WP_Themes_List_Table' => 'themes', |
34 | - 'WP_Theme_Install_List_Table' => array( 'themes', 'theme-install' ), |
|
34 | + 'WP_Theme_Install_List_Table' => array('themes', 'theme-install'), |
|
35 | 35 | 'WP_Plugins_List_Table' => 'plugins', |
36 | 36 | 'WP_Application_Passwords_List_Table' => 'application-passwords', |
37 | 37 | |
@@ -45,20 +45,20 @@ discard block |
||
45 | 45 | 'WP_Privacy_Data_Removal_Requests_List_Table' => 'privacy-data-removal-requests', |
46 | 46 | ); |
47 | 47 | |
48 | - if ( isset( $core_classes[ $class_name ] ) ) { |
|
49 | - foreach ( (array) $core_classes[ $class_name ] as $required ) { |
|
48 | + if (isset($core_classes[$class_name])) { |
|
49 | + foreach ((array) $core_classes[$class_name] as $required) { |
|
50 | 50 | require_once ABSPATH . 'wp-admin/includes/class-wp-' . $required . '-list-table.php'; |
51 | 51 | } |
52 | 52 | |
53 | - if ( isset( $args['screen'] ) ) { |
|
54 | - $args['screen'] = convert_to_screen( $args['screen'] ); |
|
55 | - } elseif ( isset( $GLOBALS['hook_suffix'] ) ) { |
|
53 | + if (isset($args['screen'])) { |
|
54 | + $args['screen'] = convert_to_screen($args['screen']); |
|
55 | + } elseif (isset($GLOBALS['hook_suffix'])) { |
|
56 | 56 | $args['screen'] = get_current_screen(); |
57 | 57 | } else { |
58 | 58 | $args['screen'] = null; |
59 | 59 | } |
60 | 60 | |
61 | - return new $class_name( $args ); |
|
61 | + return new $class_name($args); |
|
62 | 62 | } |
63 | 63 | |
64 | 64 | return false; |
@@ -76,8 +76,8 @@ discard block |
||
76 | 76 | * @param string[] $columns An array of columns with column IDs as the keys and translated |
77 | 77 | * column names as the values. |
78 | 78 | */ |
79 | -function register_column_headers( $screen, $columns ) { |
|
80 | - new _WP_List_Table_Compat( $screen, $columns ); |
|
79 | +function register_column_headers($screen, $columns) { |
|
80 | + new _WP_List_Table_Compat($screen, $columns); |
|
81 | 81 | } |
82 | 82 | |
83 | 83 | /** |
@@ -88,8 +88,8 @@ discard block |
||
88 | 88 | * @param string|WP_Screen $screen The screen hook name or screen object. |
89 | 89 | * @param bool $with_id Whether to set the ID attribute or not. |
90 | 90 | */ |
91 | -function print_column_headers( $screen, $with_id = true ) { |
|
92 | - $wp_list_table = new _WP_List_Table_Compat( $screen ); |
|
91 | +function print_column_headers($screen, $with_id = true) { |
|
92 | + $wp_list_table = new _WP_List_Table_Compat($screen); |
|
93 | 93 | |
94 | - $wp_list_table->print_column_headers( $with_id ); |
|
94 | + $wp_list_table->print_column_headers($with_id); |
|
95 | 95 | } |
@@ -46,15 +46,15 @@ discard block |
||
46 | 46 | * a Language_Pack_Upgrader instance, the method will bail to |
47 | 47 | * avoid recursion. Otherwise unused. Default false. |
48 | 48 | */ |
49 | - public static function async_upgrade( $upgrader = false ) { |
|
49 | + public static function async_upgrade($upgrader = false) { |
|
50 | 50 | // Avoid recursion. |
51 | - if ( $upgrader && $upgrader instanceof Language_Pack_Upgrader ) { |
|
51 | + if ($upgrader && $upgrader instanceof Language_Pack_Upgrader) { |
|
52 | 52 | return; |
53 | 53 | } |
54 | 54 | |
55 | 55 | // Nothing to do? |
56 | 56 | $language_updates = wp_get_translation_updates(); |
57 | - if ( ! $language_updates ) { |
|
57 | + if (!$language_updates) { |
|
58 | 58 | return; |
59 | 59 | } |
60 | 60 | |
@@ -63,12 +63,12 @@ discard block |
||
63 | 63 | * Noted: this is not the ideal way to accomplish this. |
64 | 64 | */ |
65 | 65 | $check_vcs = new WP_Automatic_Updater; |
66 | - if ( $check_vcs->is_vcs_checkout( WP_CONTENT_DIR ) ) { |
|
66 | + if ($check_vcs->is_vcs_checkout(WP_CONTENT_DIR)) { |
|
67 | 67 | return; |
68 | 68 | } |
69 | 69 | |
70 | - foreach ( $language_updates as $key => $language_update ) { |
|
71 | - $update = ! empty( $language_update->autoupdate ); |
|
70 | + foreach ($language_updates as $key => $language_update) { |
|
71 | + $update = !empty($language_update->autoupdate); |
|
72 | 72 | |
73 | 73 | /** |
74 | 74 | * Filters whether to asynchronously update translation for core, a plugin, or a theme. |
@@ -78,19 +78,19 @@ discard block |
||
78 | 78 | * @param bool $update Whether to update. |
79 | 79 | * @param object $language_update The update offer. |
80 | 80 | */ |
81 | - $update = apply_filters( 'async_update_translation', $update, $language_update ); |
|
81 | + $update = apply_filters('async_update_translation', $update, $language_update); |
|
82 | 82 | |
83 | - if ( ! $update ) { |
|
84 | - unset( $language_updates[ $key ] ); |
|
83 | + if (!$update) { |
|
84 | + unset($language_updates[$key]); |
|
85 | 85 | } |
86 | 86 | } |
87 | 87 | |
88 | - if ( empty( $language_updates ) ) { |
|
88 | + if (empty($language_updates)) { |
|
89 | 89 | return; |
90 | 90 | } |
91 | 91 | |
92 | 92 | // Re-use the automatic upgrader skin if the parent upgrader is using it. |
93 | - if ( $upgrader && $upgrader->skin instanceof Automatic_Upgrader_Skin ) { |
|
93 | + if ($upgrader && $upgrader->skin instanceof Automatic_Upgrader_Skin) { |
|
94 | 94 | $skin = $upgrader->skin; |
95 | 95 | } else { |
96 | 96 | $skin = new Language_Pack_Upgrader_Skin( |
@@ -100,8 +100,8 @@ discard block |
||
100 | 100 | ); |
101 | 101 | } |
102 | 102 | |
103 | - $lp_upgrader = new Language_Pack_Upgrader( $skin ); |
|
104 | - $lp_upgrader->bulk_upgrade( $language_updates ); |
|
103 | + $lp_upgrader = new Language_Pack_Upgrader($skin); |
|
104 | + $lp_upgrader->bulk_upgrade($language_updates); |
|
105 | 105 | } |
106 | 106 | |
107 | 107 | /** |
@@ -110,16 +110,16 @@ discard block |
||
110 | 110 | * @since 3.7.0 |
111 | 111 | */ |
112 | 112 | public function upgrade_strings() { |
113 | - $this->strings['starting_upgrade'] = __( 'Some of your translations need updating. Sit tight for a few more seconds while they are updated as well.' ); |
|
114 | - $this->strings['up_to_date'] = __( 'Your translations are all up to date.' ); |
|
115 | - $this->strings['no_package'] = __( 'Update package not available.' ); |
|
113 | + $this->strings['starting_upgrade'] = __('Some of your translations need updating. Sit tight for a few more seconds while they are updated as well.'); |
|
114 | + $this->strings['up_to_date'] = __('Your translations are all up to date.'); |
|
115 | + $this->strings['no_package'] = __('Update package not available.'); |
|
116 | 116 | /* translators: %s: Package URL. */ |
117 | - $this->strings['downloading_package'] = sprintf( __( 'Downloading translation from %s…' ), '<span class="code">%s</span>' ); |
|
118 | - $this->strings['unpack_package'] = __( 'Unpacking the update…' ); |
|
119 | - $this->strings['process_failed'] = __( 'Translation update failed.' ); |
|
120 | - $this->strings['process_success'] = __( 'Translation updated successfully.' ); |
|
121 | - $this->strings['remove_old'] = __( 'Removing the old version of the translation…' ); |
|
122 | - $this->strings['remove_old_failed'] = __( 'Could not remove the old translation.' ); |
|
117 | + $this->strings['downloading_package'] = sprintf(__('Downloading translation from %s…'), '<span class="code">%s</span>'); |
|
118 | + $this->strings['unpack_package'] = __('Unpacking the update…'); |
|
119 | + $this->strings['process_failed'] = __('Translation update failed.'); |
|
120 | + $this->strings['process_success'] = __('Translation updated successfully.'); |
|
121 | + $this->strings['remove_old'] = __('Removing the old version of the translation…'); |
|
122 | + $this->strings['remove_old_failed'] = __('Could not remove the old translation.'); |
|
123 | 123 | } |
124 | 124 | |
125 | 125 | /** |
@@ -132,14 +132,14 @@ discard block |
||
132 | 132 | * Language_Pack_Upgrader::bulk_upgrade(). Default empty array. |
133 | 133 | * @return array|bool|WP_Error The result of the upgrade, or a WP_Error object instead. |
134 | 134 | */ |
135 | - public function upgrade( $update = false, $args = array() ) { |
|
136 | - if ( $update ) { |
|
137 | - $update = array( $update ); |
|
135 | + public function upgrade($update = false, $args = array()) { |
|
136 | + if ($update) { |
|
137 | + $update = array($update); |
|
138 | 138 | } |
139 | 139 | |
140 | - $results = $this->bulk_upgrade( $update, $args ); |
|
140 | + $results = $this->bulk_upgrade($update, $args); |
|
141 | 141 | |
142 | - if ( ! is_array( $results ) ) { |
|
142 | + if (!is_array($results)) { |
|
143 | 143 | return $results; |
144 | 144 | } |
145 | 145 | |
@@ -164,77 +164,77 @@ discard block |
||
164 | 164 | * @return array|bool|WP_Error Will return an array of results, or true if there are no updates, |
165 | 165 | * false or WP_Error for initial errors. |
166 | 166 | */ |
167 | - public function bulk_upgrade( $language_updates = array(), $args = array() ) { |
|
167 | + public function bulk_upgrade($language_updates = array(), $args = array()) { |
|
168 | 168 | global $wp_filesystem; |
169 | 169 | |
170 | 170 | $defaults = array( |
171 | 171 | 'clear_update_cache' => true, |
172 | 172 | ); |
173 | - $parsed_args = wp_parse_args( $args, $defaults ); |
|
173 | + $parsed_args = wp_parse_args($args, $defaults); |
|
174 | 174 | |
175 | 175 | $this->init(); |
176 | 176 | $this->upgrade_strings(); |
177 | 177 | |
178 | - if ( ! $language_updates ) { |
|
178 | + if (!$language_updates) { |
|
179 | 179 | $language_updates = wp_get_translation_updates(); |
180 | 180 | } |
181 | 181 | |
182 | - if ( empty( $language_updates ) ) { |
|
182 | + if (empty($language_updates)) { |
|
183 | 183 | $this->skin->header(); |
184 | - $this->skin->set_result( true ); |
|
185 | - $this->skin->feedback( 'up_to_date' ); |
|
184 | + $this->skin->set_result(true); |
|
185 | + $this->skin->feedback('up_to_date'); |
|
186 | 186 | $this->skin->bulk_footer(); |
187 | 187 | $this->skin->footer(); |
188 | 188 | return true; |
189 | 189 | } |
190 | 190 | |
191 | - if ( 'upgrader_process_complete' === current_filter() ) { |
|
192 | - $this->skin->feedback( 'starting_upgrade' ); |
|
191 | + if ('upgrader_process_complete' === current_filter()) { |
|
192 | + $this->skin->feedback('starting_upgrade'); |
|
193 | 193 | } |
194 | 194 | |
195 | 195 | // Remove any existing upgrade filters from the plugin/theme upgraders #WP29425 & #WP29230. |
196 | - remove_all_filters( 'upgrader_pre_install' ); |
|
197 | - remove_all_filters( 'upgrader_clear_destination' ); |
|
198 | - remove_all_filters( 'upgrader_post_install' ); |
|
199 | - remove_all_filters( 'upgrader_source_selection' ); |
|
196 | + remove_all_filters('upgrader_pre_install'); |
|
197 | + remove_all_filters('upgrader_clear_destination'); |
|
198 | + remove_all_filters('upgrader_post_install'); |
|
199 | + remove_all_filters('upgrader_source_selection'); |
|
200 | 200 | |
201 | - add_filter( 'upgrader_source_selection', array( $this, 'check_package' ), 10, 2 ); |
|
201 | + add_filter('upgrader_source_selection', array($this, 'check_package'), 10, 2); |
|
202 | 202 | |
203 | 203 | $this->skin->header(); |
204 | 204 | |
205 | 205 | // Connect to the filesystem first. |
206 | - $res = $this->fs_connect( array( WP_CONTENT_DIR, WP_LANG_DIR ) ); |
|
207 | - if ( ! $res ) { |
|
206 | + $res = $this->fs_connect(array(WP_CONTENT_DIR, WP_LANG_DIR)); |
|
207 | + if (!$res) { |
|
208 | 208 | $this->skin->footer(); |
209 | 209 | return false; |
210 | 210 | } |
211 | 211 | |
212 | 212 | $results = array(); |
213 | 213 | |
214 | - $this->update_count = count( $language_updates ); |
|
214 | + $this->update_count = count($language_updates); |
|
215 | 215 | $this->update_current = 0; |
216 | 216 | |
217 | 217 | /* |
218 | 218 | * The filesystem's mkdir() is not recursive. Make sure WP_LANG_DIR exists, |
219 | 219 | * as we then may need to create a /plugins or /themes directory inside of it. |
220 | 220 | */ |
221 | - $remote_destination = $wp_filesystem->find_folder( WP_LANG_DIR ); |
|
222 | - if ( ! $wp_filesystem->exists( $remote_destination ) ) { |
|
223 | - if ( ! $wp_filesystem->mkdir( $remote_destination, FS_CHMOD_DIR ) ) { |
|
224 | - return new WP_Error( 'mkdir_failed_lang_dir', $this->strings['mkdir_failed'], $remote_destination ); |
|
221 | + $remote_destination = $wp_filesystem->find_folder(WP_LANG_DIR); |
|
222 | + if (!$wp_filesystem->exists($remote_destination)) { |
|
223 | + if (!$wp_filesystem->mkdir($remote_destination, FS_CHMOD_DIR)) { |
|
224 | + return new WP_Error('mkdir_failed_lang_dir', $this->strings['mkdir_failed'], $remote_destination); |
|
225 | 225 | } |
226 | 226 | } |
227 | 227 | |
228 | 228 | $language_updates_results = array(); |
229 | 229 | |
230 | - foreach ( $language_updates as $language_update ) { |
|
230 | + foreach ($language_updates as $language_update) { |
|
231 | 231 | |
232 | 232 | $this->skin->language_update = $language_update; |
233 | 233 | |
234 | 234 | $destination = WP_LANG_DIR; |
235 | - if ( 'plugin' === $language_update->type ) { |
|
235 | + if ('plugin' === $language_update->type) { |
|
236 | 236 | $destination .= '/plugins'; |
237 | - } elseif ( 'theme' === $language_update->type ) { |
|
237 | + } elseif ('theme' === $language_update->type) { |
|
238 | 238 | $destination .= '/themes'; |
239 | 239 | } |
240 | 240 | |
@@ -253,28 +253,28 @@ discard block |
||
253 | 253 | ), |
254 | 254 | ); |
255 | 255 | |
256 | - $result = $this->run( $options ); |
|
256 | + $result = $this->run($options); |
|
257 | 257 | |
258 | 258 | $results[] = $this->result; |
259 | 259 | |
260 | 260 | // Prevent credentials auth screen from displaying multiple times. |
261 | - if ( false === $result ) { |
|
261 | + if (false === $result) { |
|
262 | 262 | break; |
263 | 263 | } |
264 | 264 | |
265 | 265 | $language_updates_results[] = array( |
266 | 266 | 'language' => $language_update->language, |
267 | 267 | 'type' => $language_update->type, |
268 | - 'slug' => isset( $language_update->slug ) ? $language_update->slug : 'default', |
|
268 | + 'slug' => isset($language_update->slug) ? $language_update->slug : 'default', |
|
269 | 269 | 'version' => $language_update->version, |
270 | 270 | ); |
271 | 271 | } |
272 | 272 | |
273 | 273 | // Remove upgrade hooks which are not required for translation updates. |
274 | - remove_action( 'upgrader_process_complete', array( 'Language_Pack_Upgrader', 'async_upgrade' ), 20 ); |
|
275 | - remove_action( 'upgrader_process_complete', 'wp_version_check' ); |
|
276 | - remove_action( 'upgrader_process_complete', 'wp_update_plugins' ); |
|
277 | - remove_action( 'upgrader_process_complete', 'wp_update_themes' ); |
|
274 | + remove_action('upgrader_process_complete', array('Language_Pack_Upgrader', 'async_upgrade'), 20); |
|
275 | + remove_action('upgrader_process_complete', 'wp_version_check'); |
|
276 | + remove_action('upgrader_process_complete', 'wp_update_plugins'); |
|
277 | + remove_action('upgrader_process_complete', 'wp_update_themes'); |
|
278 | 278 | |
279 | 279 | /** This action is documented in wp-admin/includes/class-wp-upgrader.php */ |
280 | 280 | do_action( |
@@ -289,19 +289,19 @@ discard block |
||
289 | 289 | ); |
290 | 290 | |
291 | 291 | // Re-add upgrade hooks. |
292 | - add_action( 'upgrader_process_complete', array( 'Language_Pack_Upgrader', 'async_upgrade' ), 20 ); |
|
293 | - add_action( 'upgrader_process_complete', 'wp_version_check', 10, 0 ); |
|
294 | - add_action( 'upgrader_process_complete', 'wp_update_plugins', 10, 0 ); |
|
295 | - add_action( 'upgrader_process_complete', 'wp_update_themes', 10, 0 ); |
|
292 | + add_action('upgrader_process_complete', array('Language_Pack_Upgrader', 'async_upgrade'), 20); |
|
293 | + add_action('upgrader_process_complete', 'wp_version_check', 10, 0); |
|
294 | + add_action('upgrader_process_complete', 'wp_update_plugins', 10, 0); |
|
295 | + add_action('upgrader_process_complete', 'wp_update_themes', 10, 0); |
|
296 | 296 | |
297 | 297 | $this->skin->bulk_footer(); |
298 | 298 | |
299 | 299 | $this->skin->footer(); |
300 | 300 | |
301 | 301 | // Clean up our hooks, in case something else does an upgrade on this connection. |
302 | - remove_filter( 'upgrader_source_selection', array( $this, 'check_package' ) ); |
|
302 | + remove_filter('upgrader_source_selection', array($this, 'check_package')); |
|
303 | 303 | |
304 | - if ( $parsed_args['clear_update_cache'] ) { |
|
304 | + if ($parsed_args['clear_update_cache']) { |
|
305 | 305 | wp_clean_update_cache(); |
306 | 306 | } |
307 | 307 | |
@@ -322,34 +322,34 @@ discard block |
||
322 | 322 | * @param string $remote_source Remote file source location. |
323 | 323 | * @return string|WP_Error The source as passed, or a WP_Error object on failure. |
324 | 324 | */ |
325 | - public function check_package( $source, $remote_source ) { |
|
325 | + public function check_package($source, $remote_source) { |
|
326 | 326 | global $wp_filesystem; |
327 | 327 | |
328 | - if ( is_wp_error( $source ) ) { |
|
328 | + if (is_wp_error($source)) { |
|
329 | 329 | return $source; |
330 | 330 | } |
331 | 331 | |
332 | 332 | // Check that the folder contains a valid language. |
333 | - $files = $wp_filesystem->dirlist( $remote_source ); |
|
333 | + $files = $wp_filesystem->dirlist($remote_source); |
|
334 | 334 | |
335 | 335 | // Check to see if a .po and .mo exist in the folder. |
336 | 336 | $po = false; |
337 | 337 | $mo = false; |
338 | - foreach ( (array) $files as $file => $filedata ) { |
|
339 | - if ( '.po' === substr( $file, -3 ) ) { |
|
338 | + foreach ((array) $files as $file => $filedata) { |
|
339 | + if ('.po' === substr($file, -3)) { |
|
340 | 340 | $po = true; |
341 | - } elseif ( '.mo' === substr( $file, -3 ) ) { |
|
341 | + } elseif ('.mo' === substr($file, -3)) { |
|
342 | 342 | $mo = true; |
343 | 343 | } |
344 | 344 | } |
345 | 345 | |
346 | - if ( ! $mo || ! $po ) { |
|
346 | + if (!$mo || !$po) { |
|
347 | 347 | return new WP_Error( |
348 | 348 | 'incompatible_archive_pomo', |
349 | 349 | $this->strings['incompatible_archive'], |
350 | 350 | sprintf( |
351 | 351 | /* translators: 1: .po, 2: .mo */ |
352 | - __( 'The language pack is missing either the %1$s or %2$s files.' ), |
|
352 | + __('The language pack is missing either the %1$s or %2$s files.'), |
|
353 | 353 | '<code>.po</code>', |
354 | 354 | '<code>.mo</code>' |
355 | 355 | ) |
@@ -367,21 +367,21 @@ discard block |
||
367 | 367 | * @param object $update The data for an update. |
368 | 368 | * @return string The name of the item being updated. |
369 | 369 | */ |
370 | - public function get_name_for_update( $update ) { |
|
371 | - switch ( $update->type ) { |
|
370 | + public function get_name_for_update($update) { |
|
371 | + switch ($update->type) { |
|
372 | 372 | case 'core': |
373 | 373 | return 'WordPress'; // Not translated. |
374 | 374 | |
375 | 375 | case 'theme': |
376 | - $theme = wp_get_theme( $update->slug ); |
|
377 | - if ( $theme->exists() ) { |
|
378 | - return $theme->Get( 'Name' ); |
|
376 | + $theme = wp_get_theme($update->slug); |
|
377 | + if ($theme->exists()) { |
|
378 | + return $theme->Get('Name'); |
|
379 | 379 | } |
380 | 380 | break; |
381 | 381 | case 'plugin': |
382 | - $plugin_data = get_plugins( '/' . $update->slug ); |
|
383 | - $plugin_data = reset( $plugin_data ); |
|
384 | - if ( $plugin_data ) { |
|
382 | + $plugin_data = get_plugins('/' . $update->slug); |
|
383 | + $plugin_data = reset($plugin_data); |
|
384 | + if ($plugin_data) { |
|
385 | 385 | return $plugin_data['Name']; |
386 | 386 | } |
387 | 387 | break; |
@@ -399,13 +399,13 @@ discard block |
||
399 | 399 | * @param string $remote_destination The location on the remote filesystem to be cleared. |
400 | 400 | * @return bool|WP_Error True upon success, WP_Error on failure. |
401 | 401 | */ |
402 | - public function clear_destination( $remote_destination ) { |
|
402 | + public function clear_destination($remote_destination) { |
|
403 | 403 | global $wp_filesystem; |
404 | 404 | |
405 | 405 | $language_update = $this->skin->language_update; |
406 | 406 | $language_directory = WP_LANG_DIR . '/'; // Local path for use with glob(). |
407 | 407 | |
408 | - if ( 'core' === $language_update->type ) { |
|
408 | + if ('core' === $language_update->type) { |
|
409 | 409 | $files = array( |
410 | 410 | $remote_destination . $language_update->language . '.po', |
411 | 411 | $remote_destination . $language_update->language . '.mo', |
@@ -417,10 +417,10 @@ discard block |
||
417 | 417 | $remote_destination . 'continents-cities-' . $language_update->language . '.mo', |
418 | 418 | ); |
419 | 419 | |
420 | - $json_translation_files = glob( $language_directory . $language_update->language . '-*.json' ); |
|
421 | - if ( $json_translation_files ) { |
|
422 | - foreach ( $json_translation_files as $json_translation_file ) { |
|
423 | - $files[] = str_replace( $language_directory, $remote_destination, $json_translation_file ); |
|
420 | + $json_translation_files = glob($language_directory . $language_update->language . '-*.json'); |
|
421 | + if ($json_translation_files) { |
|
422 | + foreach ($json_translation_files as $json_translation_file) { |
|
423 | + $files[] = str_replace($language_directory, $remote_destination, $json_translation_file); |
|
424 | 424 | } |
425 | 425 | } |
426 | 426 | } else { |
@@ -430,18 +430,18 @@ discard block |
||
430 | 430 | ); |
431 | 431 | |
432 | 432 | $language_directory = $language_directory . $language_update->type . 's/'; |
433 | - $json_translation_files = glob( $language_directory . $language_update->slug . '-' . $language_update->language . '-*.json' ); |
|
434 | - if ( $json_translation_files ) { |
|
435 | - foreach ( $json_translation_files as $json_translation_file ) { |
|
436 | - $files[] = str_replace( $language_directory, $remote_destination, $json_translation_file ); |
|
433 | + $json_translation_files = glob($language_directory . $language_update->slug . '-' . $language_update->language . '-*.json'); |
|
434 | + if ($json_translation_files) { |
|
435 | + foreach ($json_translation_files as $json_translation_file) { |
|
436 | + $files[] = str_replace($language_directory, $remote_destination, $json_translation_file); |
|
437 | 437 | } |
438 | 438 | } |
439 | 439 | } |
440 | 440 | |
441 | - $files = array_filter( $files, array( $wp_filesystem, 'exists' ) ); |
|
441 | + $files = array_filter($files, array($wp_filesystem, 'exists')); |
|
442 | 442 | |
443 | 443 | // No files to delete. |
444 | - if ( ! $files ) { |
|
444 | + if (!$files) { |
|
445 | 445 | return true; |
446 | 446 | } |
447 | 447 | |
@@ -449,23 +449,23 @@ discard block |
||
449 | 449 | $unwritable_files = array(); |
450 | 450 | |
451 | 451 | // Check writability. |
452 | - foreach ( $files as $file ) { |
|
453 | - if ( ! $wp_filesystem->is_writable( $file ) ) { |
|
452 | + foreach ($files as $file) { |
|
453 | + if (!$wp_filesystem->is_writable($file)) { |
|
454 | 454 | // Attempt to alter permissions to allow writes and try again. |
455 | - $wp_filesystem->chmod( $file, FS_CHMOD_FILE ); |
|
456 | - if ( ! $wp_filesystem->is_writable( $file ) ) { |
|
455 | + $wp_filesystem->chmod($file, FS_CHMOD_FILE); |
|
456 | + if (!$wp_filesystem->is_writable($file)) { |
|
457 | 457 | $unwritable_files[] = $file; |
458 | 458 | } |
459 | 459 | } |
460 | 460 | } |
461 | 461 | |
462 | - if ( ! empty( $unwritable_files ) ) { |
|
463 | - return new WP_Error( 'files_not_writable', $this->strings['files_not_writable'], implode( ', ', $unwritable_files ) ); |
|
462 | + if (!empty($unwritable_files)) { |
|
463 | + return new WP_Error('files_not_writable', $this->strings['files_not_writable'], implode(', ', $unwritable_files)); |
|
464 | 464 | } |
465 | 465 | |
466 | - foreach ( $files as $file ) { |
|
467 | - if ( ! $wp_filesystem->delete( $file ) ) { |
|
468 | - return new WP_Error( 'remove_old_failed', $this->strings['remove_old_failed'] ); |
|
466 | + foreach ($files as $file) { |
|
467 | + if (!$wp_filesystem->delete($file)) { |
|
468 | + return new WP_Error('remove_old_failed', $this->strings['remove_old_failed']); |
|
469 | 469 | } |
470 | 470 | } |
471 | 471 |
@@ -53,15 +53,15 @@ discard block |
||
53 | 53 | * @since 2.8.0 |
54 | 54 | */ |
55 | 55 | public function upgrade_strings() { |
56 | - $this->strings['up_to_date'] = __( 'The theme is at the latest version.' ); |
|
57 | - $this->strings['no_package'] = __( 'Update package not available.' ); |
|
56 | + $this->strings['up_to_date'] = __('The theme is at the latest version.'); |
|
57 | + $this->strings['no_package'] = __('Update package not available.'); |
|
58 | 58 | /* translators: %s: Package URL. */ |
59 | - $this->strings['downloading_package'] = sprintf( __( 'Downloading update from %s…' ), '<span class="code">%s</span>' ); |
|
60 | - $this->strings['unpack_package'] = __( 'Unpacking the update…' ); |
|
61 | - $this->strings['remove_old'] = __( 'Removing the old version of the theme…' ); |
|
62 | - $this->strings['remove_old_failed'] = __( 'Could not remove the old theme.' ); |
|
63 | - $this->strings['process_failed'] = __( 'Theme update failed.' ); |
|
64 | - $this->strings['process_success'] = __( 'Theme updated successfully.' ); |
|
59 | + $this->strings['downloading_package'] = sprintf(__('Downloading update from %s…'), '<span class="code">%s</span>'); |
|
60 | + $this->strings['unpack_package'] = __('Unpacking the update…'); |
|
61 | + $this->strings['remove_old'] = __('Removing the old version of the theme…'); |
|
62 | + $this->strings['remove_old_failed'] = __('Could not remove the old theme.'); |
|
63 | + $this->strings['process_failed'] = __('Theme update failed.'); |
|
64 | + $this->strings['process_success'] = __('Theme updated successfully.'); |
|
65 | 65 | } |
66 | 66 | |
67 | 67 | /** |
@@ -70,41 +70,41 @@ discard block |
||
70 | 70 | * @since 2.8.0 |
71 | 71 | */ |
72 | 72 | public function install_strings() { |
73 | - $this->strings['no_package'] = __( 'Installation package not available.' ); |
|
73 | + $this->strings['no_package'] = __('Installation package not available.'); |
|
74 | 74 | /* translators: %s: Package URL. */ |
75 | - $this->strings['downloading_package'] = sprintf( __( 'Downloading installation package from %s…' ), '<span class="code">%s</span>' ); |
|
76 | - $this->strings['unpack_package'] = __( 'Unpacking the package…' ); |
|
77 | - $this->strings['installing_package'] = __( 'Installing the theme…' ); |
|
78 | - $this->strings['remove_old'] = __( 'Removing the old version of the theme…' ); |
|
79 | - $this->strings['remove_old_failed'] = __( 'Could not remove the old theme.' ); |
|
80 | - $this->strings['no_files'] = __( 'The theme contains no files.' ); |
|
81 | - $this->strings['process_failed'] = __( 'Theme installation failed.' ); |
|
82 | - $this->strings['process_success'] = __( 'Theme installed successfully.' ); |
|
75 | + $this->strings['downloading_package'] = sprintf(__('Downloading installation package from %s…'), '<span class="code">%s</span>'); |
|
76 | + $this->strings['unpack_package'] = __('Unpacking the package…'); |
|
77 | + $this->strings['installing_package'] = __('Installing the theme…'); |
|
78 | + $this->strings['remove_old'] = __('Removing the old version of the theme…'); |
|
79 | + $this->strings['remove_old_failed'] = __('Could not remove the old theme.'); |
|
80 | + $this->strings['no_files'] = __('The theme contains no files.'); |
|
81 | + $this->strings['process_failed'] = __('Theme installation failed.'); |
|
82 | + $this->strings['process_success'] = __('Theme installed successfully.'); |
|
83 | 83 | /* translators: 1: Theme name, 2: Theme version. */ |
84 | - $this->strings['process_success_specific'] = __( 'Successfully installed the theme <strong>%1$s %2$s</strong>.' ); |
|
85 | - $this->strings['parent_theme_search'] = __( 'This theme requires a parent theme. Checking if it is installed…' ); |
|
84 | + $this->strings['process_success_specific'] = __('Successfully installed the theme <strong>%1$s %2$s</strong>.'); |
|
85 | + $this->strings['parent_theme_search'] = __('This theme requires a parent theme. Checking if it is installed…'); |
|
86 | 86 | /* translators: 1: Theme name, 2: Theme version. */ |
87 | - $this->strings['parent_theme_prepare_install'] = __( 'Preparing to install <strong>%1$s %2$s</strong>…' ); |
|
87 | + $this->strings['parent_theme_prepare_install'] = __('Preparing to install <strong>%1$s %2$s</strong>…'); |
|
88 | 88 | /* translators: 1: Theme name, 2: Theme version. */ |
89 | - $this->strings['parent_theme_currently_installed'] = __( 'The parent theme, <strong>%1$s %2$s</strong>, is currently installed.' ); |
|
89 | + $this->strings['parent_theme_currently_installed'] = __('The parent theme, <strong>%1$s %2$s</strong>, is currently installed.'); |
|
90 | 90 | /* translators: 1: Theme name, 2: Theme version. */ |
91 | - $this->strings['parent_theme_install_success'] = __( 'Successfully installed the parent theme, <strong>%1$s %2$s</strong>.' ); |
|
91 | + $this->strings['parent_theme_install_success'] = __('Successfully installed the parent theme, <strong>%1$s %2$s</strong>.'); |
|
92 | 92 | /* translators: %s: Theme name. */ |
93 | - $this->strings['parent_theme_not_found'] = sprintf( __( '<strong>The parent theme could not be found.</strong> You will need to install the parent theme, %s, before you can use this child theme.' ), '<strong>%s</strong>' ); |
|
93 | + $this->strings['parent_theme_not_found'] = sprintf(__('<strong>The parent theme could not be found.</strong> You will need to install the parent theme, %s, before you can use this child theme.'), '<strong>%s</strong>'); |
|
94 | 94 | /* translators: %s: Theme error. */ |
95 | - $this->strings['current_theme_has_errors'] = __( 'The active theme has the following error: "%s".' ); |
|
95 | + $this->strings['current_theme_has_errors'] = __('The active theme has the following error: "%s".'); |
|
96 | 96 | |
97 | - if ( ! empty( $this->skin->overwrite ) ) { |
|
98 | - if ( 'update-theme' === $this->skin->overwrite ) { |
|
99 | - $this->strings['installing_package'] = __( 'Updating the theme…' ); |
|
100 | - $this->strings['process_failed'] = __( 'Theme update failed.' ); |
|
101 | - $this->strings['process_success'] = __( 'Theme updated successfully.' ); |
|
97 | + if (!empty($this->skin->overwrite)) { |
|
98 | + if ('update-theme' === $this->skin->overwrite) { |
|
99 | + $this->strings['installing_package'] = __('Updating the theme…'); |
|
100 | + $this->strings['process_failed'] = __('Theme update failed.'); |
|
101 | + $this->strings['process_success'] = __('Theme updated successfully.'); |
|
102 | 102 | } |
103 | 103 | |
104 | - if ( 'downgrade-theme' === $this->skin->overwrite ) { |
|
105 | - $this->strings['installing_package'] = __( 'Downgrading the theme…' ); |
|
106 | - $this->strings['process_failed'] = __( 'Theme downgrade failed.' ); |
|
107 | - $this->strings['process_success'] = __( 'Theme downgraded successfully.' ); |
|
104 | + if ('downgrade-theme' === $this->skin->overwrite) { |
|
105 | + $this->strings['installing_package'] = __('Downgrading the theme…'); |
|
106 | + $this->strings['process_failed'] = __('Theme downgrade failed.'); |
|
107 | + $this->strings['process_success'] = __('Theme downgraded successfully.'); |
|
108 | 108 | } |
109 | 109 | } |
110 | 110 | } |
@@ -121,18 +121,18 @@ discard block |
||
121 | 121 | * @param array $child_result |
122 | 122 | * @return bool |
123 | 123 | */ |
124 | - public function check_parent_theme_filter( $install_result, $hook_extra, $child_result ) { |
|
124 | + public function check_parent_theme_filter($install_result, $hook_extra, $child_result) { |
|
125 | 125 | // Check to see if we need to install a parent theme. |
126 | 126 | $theme_info = $this->theme_info(); |
127 | 127 | |
128 | - if ( ! $theme_info->parent() ) { |
|
128 | + if (!$theme_info->parent()) { |
|
129 | 129 | return $install_result; |
130 | 130 | } |
131 | 131 | |
132 | - $this->skin->feedback( 'parent_theme_search' ); |
|
132 | + $this->skin->feedback('parent_theme_search'); |
|
133 | 133 | |
134 | - if ( ! $theme_info->parent()->errors() ) { |
|
135 | - $this->skin->feedback( 'parent_theme_currently_installed', $theme_info->parent()->display( 'Name' ), $theme_info->parent()->display( 'Version' ) ); |
|
134 | + if (!$theme_info->parent()->errors()) { |
|
135 | + $this->skin->feedback('parent_theme_currently_installed', $theme_info->parent()->display('Name'), $theme_info->parent()->display('Version')); |
|
136 | 136 | // We already have the theme, fall through. |
137 | 137 | return $install_result; |
138 | 138 | } |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | $api = themes_api( |
142 | 142 | 'theme_information', |
143 | 143 | array( |
144 | - 'slug' => $theme_info->get( 'Template' ), |
|
144 | + 'slug' => $theme_info->get('Template'), |
|
145 | 145 | 'fields' => array( |
146 | 146 | 'sections' => false, |
147 | 147 | 'tags' => false, |
@@ -149,10 +149,10 @@ discard block |
||
149 | 149 | ) |
150 | 150 | ); // Save on a bit of bandwidth. |
151 | 151 | |
152 | - if ( ! $api || is_wp_error( $api ) ) { |
|
153 | - $this->skin->feedback( 'parent_theme_not_found', $theme_info->get( 'Template' ) ); |
|
152 | + if (!$api || is_wp_error($api)) { |
|
153 | + $this->skin->feedback('parent_theme_not_found', $theme_info->get('Template')); |
|
154 | 154 | // Don't show activate or preview actions after installation. |
155 | - add_filter( 'install_theme_complete_actions', array( $this, 'hide_activate_preview_actions' ) ); |
|
155 | + add_filter('install_theme_complete_actions', array($this, 'hide_activate_preview_actions')); |
|
156 | 156 | return $install_result; |
157 | 157 | } |
158 | 158 | |
@@ -165,9 +165,9 @@ discard block |
||
165 | 165 | |
166 | 166 | $this->strings['process_success_specific'] = $this->strings['parent_theme_install_success']; |
167 | 167 | |
168 | - $this->skin->feedback( 'parent_theme_prepare_install', $api->name, $api->version ); |
|
168 | + $this->skin->feedback('parent_theme_prepare_install', $api->name, $api->version); |
|
169 | 169 | |
170 | - add_filter( 'install_theme_complete_actions', '__return_false', 999 ); // Don't show any actions after installing the theme. |
|
170 | + add_filter('install_theme_complete_actions', '__return_false', 999); // Don't show any actions after installing the theme. |
|
171 | 171 | |
172 | 172 | // Install the parent theme. |
173 | 173 | $parent_result = $this->run( |
@@ -179,12 +179,12 @@ discard block |
||
179 | 179 | ) |
180 | 180 | ); |
181 | 181 | |
182 | - if ( is_wp_error( $parent_result ) ) { |
|
183 | - add_filter( 'install_theme_complete_actions', array( $this, 'hide_activate_preview_actions' ) ); |
|
182 | + if (is_wp_error($parent_result)) { |
|
183 | + add_filter('install_theme_complete_actions', array($this, 'hide_activate_preview_actions')); |
|
184 | 184 | } |
185 | 185 | |
186 | 186 | // Start cleaning up after the parent's installation. |
187 | - remove_filter( 'install_theme_complete_actions', '__return_false', 999 ); |
|
187 | + remove_filter('install_theme_complete_actions', '__return_false', 999); |
|
188 | 188 | |
189 | 189 | // Reset child's result and data. |
190 | 190 | $this->result = $child_result; |
@@ -206,8 +206,8 @@ discard block |
||
206 | 206 | * @param array $actions Preview actions. |
207 | 207 | * @return array |
208 | 208 | */ |
209 | - public function hide_activate_preview_actions( $actions ) { |
|
210 | - unset( $actions['activate'], $actions['preview'] ); |
|
209 | + public function hide_activate_preview_actions($actions) { |
|
210 | + unset($actions['activate'], $actions['preview']); |
|
211 | 211 | return $actions; |
212 | 212 | } |
213 | 213 | |
@@ -227,22 +227,22 @@ discard block |
||
227 | 227 | * |
228 | 228 | * @return bool|WP_Error True if the installation was successful, false or a WP_Error object otherwise. |
229 | 229 | */ |
230 | - public function install( $package, $args = array() ) { |
|
231 | - $defaults = array( |
|
230 | + public function install($package, $args = array()) { |
|
231 | + $defaults = array( |
|
232 | 232 | 'clear_update_cache' => true, |
233 | 233 | 'overwrite_package' => false, // Do not overwrite files. |
234 | 234 | ); |
235 | - $parsed_args = wp_parse_args( $args, $defaults ); |
|
235 | + $parsed_args = wp_parse_args($args, $defaults); |
|
236 | 236 | |
237 | 237 | $this->init(); |
238 | 238 | $this->install_strings(); |
239 | 239 | |
240 | - add_filter( 'upgrader_source_selection', array( $this, 'check_package' ) ); |
|
241 | - add_filter( 'upgrader_post_install', array( $this, 'check_parent_theme_filter' ), 10, 3 ); |
|
240 | + add_filter('upgrader_source_selection', array($this, 'check_package')); |
|
241 | + add_filter('upgrader_post_install', array($this, 'check_parent_theme_filter'), 10, 3); |
|
242 | 242 | |
243 | - if ( $parsed_args['clear_update_cache'] ) { |
|
243 | + if ($parsed_args['clear_update_cache']) { |
|
244 | 244 | // Clear cache so wp_update_themes() knows about the new theme. |
245 | - add_action( 'upgrader_process_complete', 'wp_clean_themes_cache', 9, 0 ); |
|
245 | + add_action('upgrader_process_complete', 'wp_clean_themes_cache', 9, 0); |
|
246 | 246 | } |
247 | 247 | |
248 | 248 | $this->run( |
@@ -258,20 +258,20 @@ discard block |
||
258 | 258 | ) |
259 | 259 | ); |
260 | 260 | |
261 | - remove_action( 'upgrader_process_complete', 'wp_clean_themes_cache', 9 ); |
|
262 | - remove_filter( 'upgrader_source_selection', array( $this, 'check_package' ) ); |
|
263 | - remove_filter( 'upgrader_post_install', array( $this, 'check_parent_theme_filter' ) ); |
|
261 | + remove_action('upgrader_process_complete', 'wp_clean_themes_cache', 9); |
|
262 | + remove_filter('upgrader_source_selection', array($this, 'check_package')); |
|
263 | + remove_filter('upgrader_post_install', array($this, 'check_parent_theme_filter')); |
|
264 | 264 | |
265 | - if ( ! $this->result || is_wp_error( $this->result ) ) { |
|
265 | + if (!$this->result || is_wp_error($this->result)) { |
|
266 | 266 | return $this->result; |
267 | 267 | } |
268 | 268 | |
269 | 269 | // Refresh the Theme Update information. |
270 | - wp_clean_themes_cache( $parsed_args['clear_update_cache'] ); |
|
270 | + wp_clean_themes_cache($parsed_args['clear_update_cache']); |
|
271 | 271 | |
272 | - if ( $parsed_args['overwrite_package'] ) { |
|
272 | + if ($parsed_args['overwrite_package']) { |
|
273 | 273 | /** This action is documented in wp-admin/includes/class-plugin-upgrader.php */ |
274 | - do_action( 'upgrader_overwrote_package', $package, $this->new_theme_data, 'theme' ); |
|
274 | + do_action('upgrader_overwrote_package', $package, $this->new_theme_data, 'theme'); |
|
275 | 275 | } |
276 | 276 | |
277 | 277 | return true; |
@@ -292,39 +292,39 @@ discard block |
||
292 | 292 | * } |
293 | 293 | * @return bool|WP_Error True if the upgrade was successful, false or a WP_Error object otherwise. |
294 | 294 | */ |
295 | - public function upgrade( $theme, $args = array() ) { |
|
295 | + public function upgrade($theme, $args = array()) { |
|
296 | 296 | $defaults = array( |
297 | 297 | 'clear_update_cache' => true, |
298 | 298 | ); |
299 | - $parsed_args = wp_parse_args( $args, $defaults ); |
|
299 | + $parsed_args = wp_parse_args($args, $defaults); |
|
300 | 300 | |
301 | 301 | $this->init(); |
302 | 302 | $this->upgrade_strings(); |
303 | 303 | |
304 | 304 | // Is an update available? |
305 | - $current = get_site_transient( 'update_themes' ); |
|
306 | - if ( ! isset( $current->response[ $theme ] ) ) { |
|
305 | + $current = get_site_transient('update_themes'); |
|
306 | + if (!isset($current->response[$theme])) { |
|
307 | 307 | $this->skin->before(); |
308 | - $this->skin->set_result( false ); |
|
309 | - $this->skin->error( 'up_to_date' ); |
|
308 | + $this->skin->set_result(false); |
|
309 | + $this->skin->error('up_to_date'); |
|
310 | 310 | $this->skin->after(); |
311 | 311 | return false; |
312 | 312 | } |
313 | 313 | |
314 | - $r = $current->response[ $theme ]; |
|
314 | + $r = $current->response[$theme]; |
|
315 | 315 | |
316 | - add_filter( 'upgrader_pre_install', array( $this, 'current_before' ), 10, 2 ); |
|
317 | - add_filter( 'upgrader_post_install', array( $this, 'current_after' ), 10, 2 ); |
|
318 | - add_filter( 'upgrader_clear_destination', array( $this, 'delete_old_theme' ), 10, 4 ); |
|
319 | - if ( $parsed_args['clear_update_cache'] ) { |
|
316 | + add_filter('upgrader_pre_install', array($this, 'current_before'), 10, 2); |
|
317 | + add_filter('upgrader_post_install', array($this, 'current_after'), 10, 2); |
|
318 | + add_filter('upgrader_clear_destination', array($this, 'delete_old_theme'), 10, 4); |
|
319 | + if ($parsed_args['clear_update_cache']) { |
|
320 | 320 | // Clear cache so wp_update_themes() knows about the new theme. |
321 | - add_action( 'upgrader_process_complete', 'wp_clean_themes_cache', 9, 0 ); |
|
321 | + add_action('upgrader_process_complete', 'wp_clean_themes_cache', 9, 0); |
|
322 | 322 | } |
323 | 323 | |
324 | 324 | $this->run( |
325 | 325 | array( |
326 | 326 | 'package' => $r['package'], |
327 | - 'destination' => get_theme_root( $theme ), |
|
327 | + 'destination' => get_theme_root($theme), |
|
328 | 328 | 'clear_destination' => true, |
329 | 329 | 'clear_working' => true, |
330 | 330 | 'hook_extra' => array( |
@@ -335,24 +335,24 @@ discard block |
||
335 | 335 | ) |
336 | 336 | ); |
337 | 337 | |
338 | - remove_action( 'upgrader_process_complete', 'wp_clean_themes_cache', 9 ); |
|
339 | - remove_filter( 'upgrader_pre_install', array( $this, 'current_before' ) ); |
|
340 | - remove_filter( 'upgrader_post_install', array( $this, 'current_after' ) ); |
|
341 | - remove_filter( 'upgrader_clear_destination', array( $this, 'delete_old_theme' ) ); |
|
338 | + remove_action('upgrader_process_complete', 'wp_clean_themes_cache', 9); |
|
339 | + remove_filter('upgrader_pre_install', array($this, 'current_before')); |
|
340 | + remove_filter('upgrader_post_install', array($this, 'current_after')); |
|
341 | + remove_filter('upgrader_clear_destination', array($this, 'delete_old_theme')); |
|
342 | 342 | |
343 | - if ( ! $this->result || is_wp_error( $this->result ) ) { |
|
343 | + if (!$this->result || is_wp_error($this->result)) { |
|
344 | 344 | return $this->result; |
345 | 345 | } |
346 | 346 | |
347 | - wp_clean_themes_cache( $parsed_args['clear_update_cache'] ); |
|
347 | + wp_clean_themes_cache($parsed_args['clear_update_cache']); |
|
348 | 348 | |
349 | 349 | // Ensure any future auto-update failures trigger a failure email by removing |
350 | 350 | // the last failure notification from the list when themes update successfully. |
351 | - $past_failure_emails = get_option( 'auto_plugin_theme_update_emails', array() ); |
|
351 | + $past_failure_emails = get_option('auto_plugin_theme_update_emails', array()); |
|
352 | 352 | |
353 | - if ( isset( $past_failure_emails[ $theme ] ) ) { |
|
354 | - unset( $past_failure_emails[ $theme ] ); |
|
355 | - update_option( 'auto_plugin_theme_update_emails', $past_failure_emails ); |
|
353 | + if (isset($past_failure_emails[$theme])) { |
|
354 | + unset($past_failure_emails[$theme]); |
|
355 | + update_option('auto_plugin_theme_update_emails', $past_failure_emails); |
|
356 | 356 | } |
357 | 357 | |
358 | 358 | return true; |
@@ -373,27 +373,27 @@ discard block |
||
373 | 373 | * } |
374 | 374 | * @return array[]|false An array of results, or false if unable to connect to the filesystem. |
375 | 375 | */ |
376 | - public function bulk_upgrade( $themes, $args = array() ) { |
|
376 | + public function bulk_upgrade($themes, $args = array()) { |
|
377 | 377 | $defaults = array( |
378 | 378 | 'clear_update_cache' => true, |
379 | 379 | ); |
380 | - $parsed_args = wp_parse_args( $args, $defaults ); |
|
380 | + $parsed_args = wp_parse_args($args, $defaults); |
|
381 | 381 | |
382 | 382 | $this->init(); |
383 | 383 | $this->bulk = true; |
384 | 384 | $this->upgrade_strings(); |
385 | 385 | |
386 | - $current = get_site_transient( 'update_themes' ); |
|
386 | + $current = get_site_transient('update_themes'); |
|
387 | 387 | |
388 | - add_filter( 'upgrader_pre_install', array( $this, 'current_before' ), 10, 2 ); |
|
389 | - add_filter( 'upgrader_post_install', array( $this, 'current_after' ), 10, 2 ); |
|
390 | - add_filter( 'upgrader_clear_destination', array( $this, 'delete_old_theme' ), 10, 4 ); |
|
388 | + add_filter('upgrader_pre_install', array($this, 'current_before'), 10, 2); |
|
389 | + add_filter('upgrader_post_install', array($this, 'current_after'), 10, 2); |
|
390 | + add_filter('upgrader_clear_destination', array($this, 'delete_old_theme'), 10, 4); |
|
391 | 391 | |
392 | 392 | $this->skin->header(); |
393 | 393 | |
394 | 394 | // Connect to the filesystem first. |
395 | - $res = $this->fs_connect( array( WP_CONTENT_DIR ) ); |
|
396 | - if ( ! $res ) { |
|
395 | + $res = $this->fs_connect(array(WP_CONTENT_DIR)); |
|
396 | + if (!$res) { |
|
397 | 397 | $this->skin->footer(); |
398 | 398 | return false; |
399 | 399 | } |
@@ -406,39 +406,39 @@ discard block |
||
406 | 406 | * - a theme with an update available is currently in use. |
407 | 407 | * @todo For multisite, maintenance mode should only kick in for individual sites if at all possible. |
408 | 408 | */ |
409 | - $maintenance = ( is_multisite() && ! empty( $themes ) ); |
|
410 | - foreach ( $themes as $theme ) { |
|
409 | + $maintenance = (is_multisite() && !empty($themes)); |
|
410 | + foreach ($themes as $theme) { |
|
411 | 411 | $maintenance = $maintenance || get_stylesheet() === $theme || get_template() === $theme; |
412 | 412 | } |
413 | - if ( $maintenance ) { |
|
414 | - $this->maintenance_mode( true ); |
|
413 | + if ($maintenance) { |
|
414 | + $this->maintenance_mode(true); |
|
415 | 415 | } |
416 | 416 | |
417 | 417 | $results = array(); |
418 | 418 | |
419 | - $this->update_count = count( $themes ); |
|
419 | + $this->update_count = count($themes); |
|
420 | 420 | $this->update_current = 0; |
421 | - foreach ( $themes as $theme ) { |
|
421 | + foreach ($themes as $theme) { |
|
422 | 422 | $this->update_current++; |
423 | 423 | |
424 | - $this->skin->theme_info = $this->theme_info( $theme ); |
|
424 | + $this->skin->theme_info = $this->theme_info($theme); |
|
425 | 425 | |
426 | - if ( ! isset( $current->response[ $theme ] ) ) { |
|
427 | - $this->skin->set_result( true ); |
|
426 | + if (!isset($current->response[$theme])) { |
|
427 | + $this->skin->set_result(true); |
|
428 | 428 | $this->skin->before(); |
429 | - $this->skin->feedback( 'up_to_date' ); |
|
429 | + $this->skin->feedback('up_to_date'); |
|
430 | 430 | $this->skin->after(); |
431 | - $results[ $theme ] = true; |
|
431 | + $results[$theme] = true; |
|
432 | 432 | continue; |
433 | 433 | } |
434 | 434 | |
435 | 435 | // Get the URL to the zip file. |
436 | - $r = $current->response[ $theme ]; |
|
436 | + $r = $current->response[$theme]; |
|
437 | 437 | |
438 | 438 | $result = $this->run( |
439 | 439 | array( |
440 | 440 | 'package' => $r['package'], |
441 | - 'destination' => get_theme_root( $theme ), |
|
441 | + 'destination' => get_theme_root($theme), |
|
442 | 442 | 'clear_destination' => true, |
443 | 443 | 'clear_working' => true, |
444 | 444 | 'is_multi' => true, |
@@ -448,18 +448,18 @@ discard block |
||
448 | 448 | ) |
449 | 449 | ); |
450 | 450 | |
451 | - $results[ $theme ] = $result; |
|
451 | + $results[$theme] = $result; |
|
452 | 452 | |
453 | 453 | // Prevent credentials auth screen from displaying multiple times. |
454 | - if ( false === $result ) { |
|
454 | + if (false === $result) { |
|
455 | 455 | break; |
456 | 456 | } |
457 | 457 | } // End foreach $themes. |
458 | 458 | |
459 | - $this->maintenance_mode( false ); |
|
459 | + $this->maintenance_mode(false); |
|
460 | 460 | |
461 | 461 | // Refresh the Theme Update information. |
462 | - wp_clean_themes_cache( $parsed_args['clear_update_cache'] ); |
|
462 | + wp_clean_themes_cache($parsed_args['clear_update_cache']); |
|
463 | 463 | |
464 | 464 | /** This action is documented in wp-admin/includes/class-wp-upgrader.php */ |
465 | 465 | do_action( |
@@ -478,24 +478,24 @@ discard block |
||
478 | 478 | $this->skin->footer(); |
479 | 479 | |
480 | 480 | // Cleanup our hooks, in case something else does a upgrade on this connection. |
481 | - remove_filter( 'upgrader_pre_install', array( $this, 'current_before' ) ); |
|
482 | - remove_filter( 'upgrader_post_install', array( $this, 'current_after' ) ); |
|
483 | - remove_filter( 'upgrader_clear_destination', array( $this, 'delete_old_theme' ) ); |
|
481 | + remove_filter('upgrader_pre_install', array($this, 'current_before')); |
|
482 | + remove_filter('upgrader_post_install', array($this, 'current_after')); |
|
483 | + remove_filter('upgrader_clear_destination', array($this, 'delete_old_theme')); |
|
484 | 484 | |
485 | 485 | // Ensure any future auto-update failures trigger a failure email by removing |
486 | 486 | // the last failure notification from the list when themes update successfully. |
487 | - $past_failure_emails = get_option( 'auto_plugin_theme_update_emails', array() ); |
|
487 | + $past_failure_emails = get_option('auto_plugin_theme_update_emails', array()); |
|
488 | 488 | |
489 | - foreach ( $results as $theme => $result ) { |
|
489 | + foreach ($results as $theme => $result) { |
|
490 | 490 | // Maintain last failure notification when themes failed to update manually. |
491 | - if ( ! $result || is_wp_error( $result ) || ! isset( $past_failure_emails[ $theme ] ) ) { |
|
491 | + if (!$result || is_wp_error($result) || !isset($past_failure_emails[$theme])) { |
|
492 | 492 | continue; |
493 | 493 | } |
494 | 494 | |
495 | - unset( $past_failure_emails[ $theme ] ); |
|
495 | + unset($past_failure_emails[$theme]); |
|
496 | 496 | } |
497 | 497 | |
498 | - update_option( 'auto_plugin_theme_update_emails', $past_failure_emails ); |
|
498 | + update_option('auto_plugin_theme_update_emails', $past_failure_emails); |
|
499 | 499 | |
500 | 500 | return $results; |
501 | 501 | } |
@@ -513,29 +513,29 @@ discard block |
||
513 | 513 | * @param string $source The path to the downloaded package source. |
514 | 514 | * @return string|WP_Error The source as passed, or a WP_Error object on failure. |
515 | 515 | */ |
516 | - public function check_package( $source ) { |
|
516 | + public function check_package($source) { |
|
517 | 517 | global $wp_filesystem, $wp_version; |
518 | 518 | |
519 | 519 | $this->new_theme_data = array(); |
520 | 520 | |
521 | - if ( is_wp_error( $source ) ) { |
|
521 | + if (is_wp_error($source)) { |
|
522 | 522 | return $source; |
523 | 523 | } |
524 | 524 | |
525 | 525 | // Check that the folder contains a valid theme. |
526 | - $working_directory = str_replace( $wp_filesystem->wp_content_dir(), trailingslashit( WP_CONTENT_DIR ), $source ); |
|
527 | - if ( ! is_dir( $working_directory ) ) { // Sanity check, if the above fails, let's not prevent installation. |
|
526 | + $working_directory = str_replace($wp_filesystem->wp_content_dir(), trailingslashit(WP_CONTENT_DIR), $source); |
|
527 | + if (!is_dir($working_directory)) { // Sanity check, if the above fails, let's not prevent installation. |
|
528 | 528 | return $source; |
529 | 529 | } |
530 | 530 | |
531 | 531 | // A proper archive should have a style.css file in the single subdirectory. |
532 | - if ( ! file_exists( $working_directory . 'style.css' ) ) { |
|
532 | + if (!file_exists($working_directory . 'style.css')) { |
|
533 | 533 | return new WP_Error( |
534 | 534 | 'incompatible_archive_theme_no_style', |
535 | 535 | $this->strings['incompatible_archive'], |
536 | 536 | sprintf( |
537 | 537 | /* translators: %s: style.css */ |
538 | - __( 'The theme is missing the %s stylesheet.' ), |
|
538 | + __('The theme is missing the %s stylesheet.'), |
|
539 | 539 | '<code>style.css</code>' |
540 | 540 | ) |
541 | 541 | ); |
@@ -554,13 +554,13 @@ discard block |
||
554 | 554 | ) |
555 | 555 | ); |
556 | 556 | |
557 | - if ( empty( $info['Name'] ) ) { |
|
557 | + if (empty($info['Name'])) { |
|
558 | 558 | return new WP_Error( |
559 | 559 | 'incompatible_archive_theme_no_name', |
560 | 560 | $this->strings['incompatible_archive'], |
561 | 561 | sprintf( |
562 | 562 | /* translators: %s: style.css */ |
563 | - __( 'The %s stylesheet does not contain a valid theme header.' ), |
|
563 | + __('The %s stylesheet does not contain a valid theme header.'), |
|
564 | 564 | '<code>style.css</code>' |
565 | 565 | ) |
566 | 566 | ); |
@@ -572,48 +572,48 @@ discard block |
||
572 | 572 | * - block themes require /templates/index.html or block-templates/index.html (deprecated 5.9.0). |
573 | 573 | */ |
574 | 574 | if ( |
575 | - empty( $info['Template'] ) && |
|
576 | - ! file_exists( $working_directory . 'index.php' ) && |
|
577 | - ! file_exists( $working_directory . 'templates/index.html' ) && |
|
578 | - ! file_exists( $working_directory . 'block-templates/index.html' ) |
|
575 | + empty($info['Template']) && |
|
576 | + !file_exists($working_directory . 'index.php') && |
|
577 | + !file_exists($working_directory . 'templates/index.html') && |
|
578 | + !file_exists($working_directory . 'block-templates/index.html') |
|
579 | 579 | ) { |
580 | 580 | return new WP_Error( |
581 | 581 | 'incompatible_archive_theme_no_index', |
582 | 582 | $this->strings['incompatible_archive'], |
583 | 583 | sprintf( |
584 | 584 | /* translators: 1: templates/index.html, 2: index.php, 3: Documentation URL, 4: Template, 5: style.css */ |
585 | - __( 'Template is missing. Standalone themes need to have a %1$s or %2$s template file. <a href="%3$s">Child themes</a> need to have a %4$s header in the %5$s stylesheet.' ), |
|
585 | + __('Template is missing. Standalone themes need to have a %1$s or %2$s template file. <a href="%3$s">Child themes</a> need to have a %4$s header in the %5$s stylesheet.'), |
|
586 | 586 | '<code>templates/index.html</code>', |
587 | 587 | '<code>index.php</code>', |
588 | - __( 'https://developer.wordpress.org/themes/advanced-topics/child-themes/' ), |
|
588 | + __('https://developer.wordpress.org/themes/advanced-topics/child-themes/'), |
|
589 | 589 | '<code>Template</code>', |
590 | 590 | '<code>style.css</code>' |
591 | 591 | ) |
592 | 592 | ); |
593 | 593 | } |
594 | 594 | |
595 | - $requires_php = isset( $info['RequiresPHP'] ) ? $info['RequiresPHP'] : null; |
|
596 | - $requires_wp = isset( $info['RequiresWP'] ) ? $info['RequiresWP'] : null; |
|
595 | + $requires_php = isset($info['RequiresPHP']) ? $info['RequiresPHP'] : null; |
|
596 | + $requires_wp = isset($info['RequiresWP']) ? $info['RequiresWP'] : null; |
|
597 | 597 | |
598 | - if ( ! is_php_version_compatible( $requires_php ) ) { |
|
598 | + if (!is_php_version_compatible($requires_php)) { |
|
599 | 599 | $error = sprintf( |
600 | 600 | /* translators: 1: Current PHP version, 2: Version required by the uploaded theme. */ |
601 | - __( 'The PHP version on your server is %1$s, however the uploaded theme requires %2$s.' ), |
|
601 | + __('The PHP version on your server is %1$s, however the uploaded theme requires %2$s.'), |
|
602 | 602 | phpversion(), |
603 | 603 | $requires_php |
604 | 604 | ); |
605 | 605 | |
606 | - return new WP_Error( 'incompatible_php_required_version', $this->strings['incompatible_archive'], $error ); |
|
606 | + return new WP_Error('incompatible_php_required_version', $this->strings['incompatible_archive'], $error); |
|
607 | 607 | } |
608 | - if ( ! is_wp_version_compatible( $requires_wp ) ) { |
|
608 | + if (!is_wp_version_compatible($requires_wp)) { |
|
609 | 609 | $error = sprintf( |
610 | 610 | /* translators: 1: Current WordPress version, 2: Version required by the uploaded theme. */ |
611 | - __( 'Your WordPress version is %1$s, however the uploaded theme requires %2$s.' ), |
|
611 | + __('Your WordPress version is %1$s, however the uploaded theme requires %2$s.'), |
|
612 | 612 | $wp_version, |
613 | 613 | $requires_wp |
614 | 614 | ); |
615 | 615 | |
616 | - return new WP_Error( 'incompatible_wp_required_version', $this->strings['incompatible_archive'], $error ); |
|
616 | + return new WP_Error('incompatible_wp_required_version', $this->strings['incompatible_archive'], $error); |
|
617 | 617 | } |
618 | 618 | |
619 | 619 | $this->new_theme_data = $info; |
@@ -633,21 +633,21 @@ discard block |
||
633 | 633 | * @param array $theme Theme arguments. |
634 | 634 | * @return bool|WP_Error The original `$response` parameter or WP_Error. |
635 | 635 | */ |
636 | - public function current_before( $response, $theme ) { |
|
637 | - if ( is_wp_error( $response ) ) { |
|
636 | + public function current_before($response, $theme) { |
|
637 | + if (is_wp_error($response)) { |
|
638 | 638 | return $response; |
639 | 639 | } |
640 | 640 | |
641 | - $theme = isset( $theme['theme'] ) ? $theme['theme'] : ''; |
|
641 | + $theme = isset($theme['theme']) ? $theme['theme'] : ''; |
|
642 | 642 | |
643 | 643 | // Only run if active theme. |
644 | - if ( get_stylesheet() !== $theme ) { |
|
644 | + if (get_stylesheet() !== $theme) { |
|
645 | 645 | return $response; |
646 | 646 | } |
647 | 647 | |
648 | 648 | // Change to maintenance mode. Bulk edit handles this separately. |
649 | - if ( ! $this->bulk ) { |
|
650 | - $this->maintenance_mode( true ); |
|
649 | + if (!$this->bulk) { |
|
650 | + $this->maintenance_mode(true); |
|
651 | 651 | } |
652 | 652 | |
653 | 653 | return $response; |
@@ -665,28 +665,28 @@ discard block |
||
665 | 665 | * @param array $theme Theme arguments. |
666 | 666 | * @return bool|WP_Error The original `$response` parameter or WP_Error. |
667 | 667 | */ |
668 | - public function current_after( $response, $theme ) { |
|
669 | - if ( is_wp_error( $response ) ) { |
|
668 | + public function current_after($response, $theme) { |
|
669 | + if (is_wp_error($response)) { |
|
670 | 670 | return $response; |
671 | 671 | } |
672 | 672 | |
673 | - $theme = isset( $theme['theme'] ) ? $theme['theme'] : ''; |
|
673 | + $theme = isset($theme['theme']) ? $theme['theme'] : ''; |
|
674 | 674 | |
675 | 675 | // Only run if active theme. |
676 | - if ( get_stylesheet() !== $theme ) { |
|
676 | + if (get_stylesheet() !== $theme) { |
|
677 | 677 | return $response; |
678 | 678 | } |
679 | 679 | |
680 | 680 | // Ensure stylesheet name hasn't changed after the upgrade: |
681 | - if ( get_stylesheet() === $theme && $theme !== $this->result['destination_name'] ) { |
|
681 | + if (get_stylesheet() === $theme && $theme !== $this->result['destination_name']) { |
|
682 | 682 | wp_clean_themes_cache(); |
683 | 683 | $stylesheet = $this->result['destination_name']; |
684 | - switch_theme( $stylesheet ); |
|
684 | + switch_theme($stylesheet); |
|
685 | 685 | } |
686 | 686 | |
687 | 687 | // Time to remove maintenance mode. Bulk edit handles this separately. |
688 | - if ( ! $this->bulk ) { |
|
689 | - $this->maintenance_mode( false ); |
|
688 | + if (!$this->bulk) { |
|
689 | + $this->maintenance_mode(false); |
|
690 | 690 | } |
691 | 691 | return $response; |
692 | 692 | } |
@@ -707,21 +707,21 @@ discard block |
||
707 | 707 | * @param array $theme |
708 | 708 | * @return bool |
709 | 709 | */ |
710 | - public function delete_old_theme( $removed, $local_destination, $remote_destination, $theme ) { |
|
710 | + public function delete_old_theme($removed, $local_destination, $remote_destination, $theme) { |
|
711 | 711 | global $wp_filesystem; |
712 | 712 | |
713 | - if ( is_wp_error( $removed ) ) { |
|
713 | + if (is_wp_error($removed)) { |
|
714 | 714 | return $removed; // Pass errors through. |
715 | 715 | } |
716 | 716 | |
717 | - if ( ! isset( $theme['theme'] ) ) { |
|
717 | + if (!isset($theme['theme'])) { |
|
718 | 718 | return $removed; |
719 | 719 | } |
720 | 720 | |
721 | 721 | $theme = $theme['theme']; |
722 | - $themes_dir = trailingslashit( $wp_filesystem->wp_themes_dir( $theme ) ); |
|
723 | - if ( $wp_filesystem->exists( $themes_dir . $theme ) ) { |
|
724 | - if ( ! $wp_filesystem->delete( $themes_dir . $theme, true ) ) { |
|
722 | + $themes_dir = trailingslashit($wp_filesystem->wp_themes_dir($theme)); |
|
723 | + if ($wp_filesystem->exists($themes_dir . $theme)) { |
|
724 | + if (!$wp_filesystem->delete($themes_dir . $theme, true)) { |
|
725 | 725 | return false; |
726 | 726 | } |
727 | 727 | } |
@@ -740,16 +740,16 @@ discard block |
||
740 | 740 | * @return WP_Theme|false The theme's info object, or false `$theme` is not supplied |
741 | 741 | * and the last result isn't set. |
742 | 742 | */ |
743 | - public function theme_info( $theme = null ) { |
|
744 | - if ( empty( $theme ) ) { |
|
745 | - if ( ! empty( $this->result['destination_name'] ) ) { |
|
743 | + public function theme_info($theme = null) { |
|
744 | + if (empty($theme)) { |
|
745 | + if (!empty($this->result['destination_name'])) { |
|
746 | 746 | $theme = $this->result['destination_name']; |
747 | 747 | } else { |
748 | 748 | return false; |
749 | 749 | } |
750 | 750 | } |
751 | 751 | |
752 | - $theme = wp_get_theme( $theme ); |
|
752 | + $theme = wp_get_theme($theme); |
|
753 | 753 | $theme->cache_delete(); |
754 | 754 | |
755 | 755 | return $theme; |
@@ -26,11 +26,11 @@ discard block |
||
26 | 26 | */ |
27 | 27 | public function get_columns() { |
28 | 28 | return array( |
29 | - 'name' => __( 'Name' ), |
|
30 | - 'created' => __( 'Created' ), |
|
31 | - 'last_used' => __( 'Last Used' ), |
|
32 | - 'last_ip' => __( 'Last IP' ), |
|
33 | - 'revoke' => __( 'Revoke' ), |
|
29 | + 'name' => __('Name'), |
|
30 | + 'created' => __('Created'), |
|
31 | + 'last_used' => __('Last Used'), |
|
32 | + 'last_ip' => __('Last IP'), |
|
33 | + 'revoke' => __('Revoke'), |
|
34 | 34 | ); |
35 | 35 | } |
36 | 36 | |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | */ |
44 | 44 | public function prepare_items() { |
45 | 45 | global $user_id; |
46 | - $this->items = array_reverse( WP_Application_Passwords::get_user_application_passwords( $user_id ) ); |
|
46 | + $this->items = array_reverse(WP_Application_Passwords::get_user_application_passwords($user_id)); |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | /** |
@@ -53,8 +53,8 @@ discard block |
||
53 | 53 | * |
54 | 54 | * @param array $item The current application password item. |
55 | 55 | */ |
56 | - public function column_name( $item ) { |
|
57 | - echo esc_html( $item['name'] ); |
|
56 | + public function column_name($item) { |
|
57 | + echo esc_html($item['name']); |
|
58 | 58 | } |
59 | 59 | |
60 | 60 | /** |
@@ -64,11 +64,11 @@ discard block |
||
64 | 64 | * |
65 | 65 | * @param array $item The current application password item. |
66 | 66 | */ |
67 | - public function column_created( $item ) { |
|
68 | - if ( empty( $item['created'] ) ) { |
|
67 | + public function column_created($item) { |
|
68 | + if (empty($item['created'])) { |
|
69 | 69 | echo '—'; |
70 | 70 | } else { |
71 | - echo date_i18n( __( 'F j, Y' ), $item['created'] ); |
|
71 | + echo date_i18n(__('F j, Y'), $item['created']); |
|
72 | 72 | } |
73 | 73 | } |
74 | 74 | |
@@ -79,11 +79,11 @@ discard block |
||
79 | 79 | * |
80 | 80 | * @param array $item The current application password item. |
81 | 81 | */ |
82 | - public function column_last_used( $item ) { |
|
83 | - if ( empty( $item['last_used'] ) ) { |
|
82 | + public function column_last_used($item) { |
|
83 | + if (empty($item['last_used'])) { |
|
84 | 84 | echo '—'; |
85 | 85 | } else { |
86 | - echo date_i18n( __( 'F j, Y' ), $item['last_used'] ); |
|
86 | + echo date_i18n(__('F j, Y'), $item['last_used']); |
|
87 | 87 | } |
88 | 88 | } |
89 | 89 | |
@@ -94,8 +94,8 @@ discard block |
||
94 | 94 | * |
95 | 95 | * @param array $item The current application password item. |
96 | 96 | */ |
97 | - public function column_last_ip( $item ) { |
|
98 | - if ( empty( $item['last_ip'] ) ) { |
|
97 | + public function column_last_ip($item) { |
|
98 | + if (empty($item['last_ip'])) { |
|
99 | 99 | echo '—'; |
100 | 100 | } else { |
101 | 101 | echo $item['last_ip']; |
@@ -109,14 +109,14 @@ discard block |
||
109 | 109 | * |
110 | 110 | * @param array $item The current application password item. |
111 | 111 | */ |
112 | - public function column_revoke( $item ) { |
|
112 | + public function column_revoke($item) { |
|
113 | 113 | $name = 'revoke-application-password-' . $item['uuid']; |
114 | 114 | printf( |
115 | 115 | '<button type="button" name="%1$s" id="%1$s" class="button delete" aria-label="%2$s">%3$s</button>', |
116 | - esc_attr( $name ), |
|
116 | + esc_attr($name), |
|
117 | 117 | /* translators: %s: the application password's given name. */ |
118 | - esc_attr( sprintf( __( 'Revoke "%s"' ), $item['name'] ) ), |
|
119 | - __( 'Revoke' ) |
|
118 | + esc_attr(sprintf(__('Revoke "%s"'), $item['name'])), |
|
119 | + __('Revoke') |
|
120 | 120 | ); |
121 | 121 | } |
122 | 122 | |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | * @param array $item The current item. |
129 | 129 | * @param string $column_name The current column name. |
130 | 130 | */ |
131 | - protected function column_default( $item, $column_name ) { |
|
131 | + protected function column_default($item, $column_name) { |
|
132 | 132 | /** |
133 | 133 | * Fires for each custom column in the Application Passwords list table. |
134 | 134 | * |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | * @param string $column_name Name of the custom column. |
140 | 140 | * @param array $item The application password item. |
141 | 141 | */ |
142 | - do_action( "manage_{$this->screen->id}_custom_column", $column_name, $item ); |
|
142 | + do_action("manage_{$this->screen->id}_custom_column", $column_name, $item); |
|
143 | 143 | } |
144 | 144 | |
145 | 145 | /** |
@@ -149,20 +149,20 @@ discard block |
||
149 | 149 | * |
150 | 150 | * @param string $which The location of the bulk actions: 'top' or 'bottom'. |
151 | 151 | */ |
152 | - protected function display_tablenav( $which ) { |
|
152 | + protected function display_tablenav($which) { |
|
153 | 153 | ?> |
154 | - <div class="tablenav <?php echo esc_attr( $which ); ?>"> |
|
155 | - <?php if ( 'bottom' === $which ) : ?> |
|
154 | + <div class="tablenav <?php echo esc_attr($which); ?>"> |
|
155 | + <?php if ('bottom' === $which) : ?> |
|
156 | 156 | <div class="alignright"> |
157 | - <button type="button" name="revoke-all-application-passwords" id="revoke-all-application-passwords" class="button delete"><?php _e( 'Revoke all application passwords' ); ?></button> |
|
157 | + <button type="button" name="revoke-all-application-passwords" id="revoke-all-application-passwords" class="button delete"><?php _e('Revoke all application passwords'); ?></button> |
|
158 | 158 | </div> |
159 | 159 | <?php endif; ?> |
160 | 160 | <div class="alignleft actions bulkactions"> |
161 | - <?php $this->bulk_actions( $which ); ?> |
|
161 | + <?php $this->bulk_actions($which); ?> |
|
162 | 162 | </div> |
163 | 163 | <?php |
164 | - $this->extra_tablenav( $which ); |
|
165 | - $this->pagination( $which ); |
|
164 | + $this->extra_tablenav($which); |
|
165 | + $this->pagination($which); |
|
166 | 166 | ?> |
167 | 167 | <br class="clear" /> |
168 | 168 | </div> |
@@ -176,9 +176,9 @@ discard block |
||
176 | 176 | * |
177 | 177 | * @param array $item The current item. |
178 | 178 | */ |
179 | - public function single_row( $item ) { |
|
180 | - echo '<tr data-uuid="' . esc_attr( $item['uuid'] ) . '">'; |
|
181 | - $this->single_row_columns( $item ); |
|
179 | + public function single_row($item) { |
|
180 | + echo '<tr data-uuid="' . esc_attr($item['uuid']) . '">'; |
|
181 | + $this->single_row_columns($item); |
|
182 | 182 | echo '</tr>'; |
183 | 183 | } |
184 | 184 | |
@@ -199,34 +199,34 @@ discard block |
||
199 | 199 | * @since 5.6.0 |
200 | 200 | */ |
201 | 201 | public function print_js_template_row() { |
202 | - list( $columns, $hidden, , $primary ) = $this->get_column_info(); |
|
202 | + list($columns, $hidden,, $primary) = $this->get_column_info(); |
|
203 | 203 | |
204 | 204 | echo '<tr data-uuid="{{ data.uuid }}">'; |
205 | 205 | |
206 | - foreach ( $columns as $column_name => $display_name ) { |
|
206 | + foreach ($columns as $column_name => $display_name) { |
|
207 | 207 | $is_primary = $primary === $column_name; |
208 | 208 | $classes = "{$column_name} column-{$column_name}"; |
209 | 209 | |
210 | - if ( $is_primary ) { |
|
210 | + if ($is_primary) { |
|
211 | 211 | $classes .= ' has-row-actions column-primary'; |
212 | 212 | } |
213 | 213 | |
214 | - if ( in_array( $column_name, $hidden, true ) ) { |
|
214 | + if (in_array($column_name, $hidden, true)) { |
|
215 | 215 | $classes .= ' hidden'; |
216 | 216 | } |
217 | 217 | |
218 | - printf( '<td class="%s" data-colname="%s">', esc_attr( $classes ), esc_attr( wp_strip_all_tags( $display_name ) ) ); |
|
218 | + printf('<td class="%s" data-colname="%s">', esc_attr($classes), esc_attr(wp_strip_all_tags($display_name))); |
|
219 | 219 | |
220 | - switch ( $column_name ) { |
|
220 | + switch ($column_name) { |
|
221 | 221 | case 'name': |
222 | 222 | echo '{{ data.name }}'; |
223 | 223 | break; |
224 | 224 | case 'created': |
225 | 225 | // JSON encoding automatically doubles backslashes to ensure they don't get lost when printing the inline JS. |
226 | - echo '<# print( wp.date.dateI18n( ' . wp_json_encode( __( 'F j, Y' ) ) . ', data.created ) ) #>'; |
|
226 | + echo '<# print( wp.date.dateI18n( ' . wp_json_encode(__('F j, Y')) . ', data.created ) ) #>'; |
|
227 | 227 | break; |
228 | 228 | case 'last_used': |
229 | - echo '<# print( data.last_used !== null ? wp.date.dateI18n( ' . wp_json_encode( __( 'F j, Y' ) ) . ", data.last_used ) : '—' ) #>"; |
|
229 | + echo '<# print( data.last_used !== null ? wp.date.dateI18n( ' . wp_json_encode(__('F j, Y')) . ", data.last_used ) : '—' ) #>"; |
|
230 | 230 | break; |
231 | 231 | case 'last_ip': |
232 | 232 | echo "{{ data.last_ip || '—' }}"; |
@@ -235,8 +235,8 @@ discard block |
||
235 | 235 | printf( |
236 | 236 | '<button type="button" class="button delete" aria-label="%1$s">%2$s</button>', |
237 | 237 | /* translators: %s: the application password's given name. */ |
238 | - esc_attr( sprintf( __( 'Revoke "%s"' ), '{{ data.name }}' ) ), |
|
239 | - esc_html__( 'Revoke' ) |
|
238 | + esc_attr(sprintf(__('Revoke "%s"'), '{{ data.name }}')), |
|
239 | + esc_html__('Revoke') |
|
240 | 240 | ); |
241 | 241 | break; |
242 | 242 | default: |
@@ -249,12 +249,12 @@ discard block |
||
249 | 249 | * |
250 | 250 | * @param string $column_name Name of the custom column. |
251 | 251 | */ |
252 | - do_action( "manage_{$this->screen->id}_custom_column_js_template", $column_name ); |
|
252 | + do_action("manage_{$this->screen->id}_custom_column_js_template", $column_name); |
|
253 | 253 | break; |
254 | 254 | } |
255 | 255 | |
256 | - if ( $is_primary ) { |
|
257 | - echo '<button type="button" class="toggle-row"><span class="screen-reader-text">' . __( 'Show more details' ) . '</span></button>'; |
|
256 | + if ($is_primary) { |
|
257 | + echo '<button type="button" class="toggle-row"><span class="screen-reader-text">' . __('Show more details') . '</span></button>'; |
|
258 | 258 | } |
259 | 259 | |
260 | 260 | echo '</td>'; |