Passed
Push — main ( 3c103b...7fe1f6 )
by TARIQ
44:23
created
brighty/wp-admin/includes/class-wp-plugin-install-list-table.php 2 patches
Indentation   +717 added lines, -717 removed lines patch added patch discarded remove patch
@@ -17,391 +17,391 @@  discard block
 block discarded – undo
17 17
  */
18 18
 class WP_Plugin_Install_List_Table extends WP_List_Table {
19 19
 
20
-	public $order   = 'ASC';
21
-	public $orderby = null;
22
-	public $groups  = array();
23
-
24
-	private $error;
25
-
26
-	/**
27
-	 * @return bool
28
-	 */
29
-	public function ajax_user_can() {
30
-		return current_user_can( 'install_plugins' );
31
-	}
32
-
33
-	/**
34
-	 * Return the list of known plugins.
35
-	 *
36
-	 * Uses the transient data from the updates API to determine the known
37
-	 * installed plugins.
38
-	 *
39
-	 * @since 4.9.0
40
-	 * @access protected
41
-	 *
42
-	 * @return array
43
-	 */
44
-	protected function get_installed_plugins() {
45
-		$plugins = array();
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 ) ) {
51
-					$plugin->upgrade          = false;
52
-					$plugins[ $plugin->slug ] = $plugin;
53
-				}
54
-			}
55
-		}
56
-
57
-		if ( isset( $plugin_info->response ) ) {
58
-			foreach ( $plugin_info->response as $plugin ) {
59
-				if ( isset( $plugin->slug ) ) {
60
-					$plugin->upgrade          = true;
61
-					$plugins[ $plugin->slug ] = $plugin;
62
-				}
63
-			}
64
-		}
65
-
66
-		return $plugins;
67
-	}
68
-
69
-	/**
70
-	 * Return a list of slugs of installed plugins, if known.
71
-	 *
72
-	 * Uses the transient data from the updates API to determine the slugs of
73
-	 * known installed plugins. This might be better elsewhere, perhaps even
74
-	 * within get_plugins().
75
-	 *
76
-	 * @since 4.0.0
77
-	 *
78
-	 * @return array
79
-	 */
80
-	protected function get_installed_plugin_slugs() {
81
-		return array_keys( $this->get_installed_plugins() );
82
-	}
83
-
84
-	/**
85
-	 * @global array  $tabs
86
-	 * @global string $tab
87
-	 * @global int    $paged
88
-	 * @global string $type
89
-	 * @global string $term
90
-	 */
91
-	public function prepare_items() {
92
-		include_once ABSPATH . 'wp-admin/includes/plugin-install.php';
93
-
94
-		global $tabs, $tab, $paged, $type, $term;
95
-
96
-		wp_reset_vars( array( 'tab' ) );
97
-
98
-		$paged = $this->get_pagenum();
99
-
100
-		$per_page = 36;
101
-
102
-		// These are the tabs which are shown on the page.
103
-		$tabs = array();
104
-
105
-		if ( 'search' === $tab ) {
106
-			$tabs['search'] = __( 'Search Results' );
107
-		}
108
-
109
-		if ( 'beta' === $tab || false !== strpos( get_bloginfo( 'version' ), '-' ) ) {
110
-			$tabs['beta'] = _x( 'Beta Testing', 'Plugin Installer' );
111
-		}
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' );
117
-
118
-		if ( current_user_can( 'upload_plugins' ) ) {
119
-			// No longer a real tab. Here for filter compatibility.
120
-			// Gets skipped in get_views().
121
-			$tabs['upload'] = __( 'Upload Plugin' );
122
-		}
123
-
124
-		$nonmenu_tabs = array( 'plugin-information' ); // Valid actions to perform which do not have a Menu item.
125
-
126
-		/**
127
-		 * Filters the tabs shown on the Add Plugins screen.
128
-		 *
129
-		 * @since 2.7.0
130
-		 *
131
-		 * @param string[] $tabs The tabs shown on the Add Plugins screen. Defaults include
132
-		 *                       'featured', 'popular', 'recommended', 'favorites', and 'upload'.
133
-		 */
134
-		$tabs = apply_filters( 'install_plugins_tabs', $tabs );
135
-
136
-		/**
137
-		 * Filters tabs not associated with a menu item on the Add Plugins screen.
138
-		 *
139
-		 * @since 2.7.0
140
-		 *
141
-		 * @param string[] $nonmenu_tabs The tabs that don't have a menu item on the Add Plugins screen.
142
-		 */
143
-		$nonmenu_tabs = apply_filters( 'install_plugins_nonmenu_tabs', $nonmenu_tabs );
144
-
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 );
148
-		}
149
-
150
-		$installed_plugins = $this->get_installed_plugins();
151
-
152
-		$args = array(
153
-			'page'     => $paged,
154
-			'per_page' => $per_page,
155
-			// Send the locale to the API so it can provide context-sensitive results.
156
-			'locale'   => get_user_locale(),
157
-		);
158
-
159
-		switch ( $tab ) {
160
-			case 'search':
161
-				$type = isset( $_REQUEST['type'] ) ? wp_unslash( $_REQUEST['type'] ) : 'term';
162
-				$term = isset( $_REQUEST['s'] ) ? wp_unslash( $_REQUEST['s'] ) : '';
163
-
164
-				switch ( $type ) {
165
-					case 'tag':
166
-						$args['tag'] = sanitize_title_with_dashes( $term );
167
-						break;
168
-					case 'term':
169
-						$args['search'] = $term;
170
-						break;
171
-					case 'author':
172
-						$args['author'] = $term;
173
-						break;
174
-				}
175
-
176
-				break;
177
-
178
-			case 'featured':
179
-			case 'popular':
180
-			case 'new':
181
-			case 'beta':
182
-				$args['browse'] = $tab;
183
-				break;
184
-			case 'recommended':
185
-				$args['browse'] = $tab;
186
-				// Include the list of installed plugins so we can get relevant results.
187
-				$args['installed_plugins'] = array_keys( $installed_plugins );
188
-				break;
189
-
190
-			case 'favorites':
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' );
194
-
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 );
198
-					}
199
-				} else {
200
-					$user = get_user_option( 'wporg_favorites' );
201
-				}
202
-				if ( $user ) {
203
-					$args['user'] = $user;
204
-				} else {
205
-					$args = false;
206
-				}
207
-
208
-				add_action( 'install_plugins_favorites', 'install_plugins_favorites_form', 9, 0 );
209
-				break;
210
-
211
-			default:
212
-				$args = false;
213
-				break;
214
-		}
215
-
216
-		/**
217
-		 * Filters API request arguments for each Add Plugins screen tab.
218
-		 *
219
-		 * The dynamic portion of the hook name, `$tab`, refers to the plugin install tabs.
220
-		 *
221
-		 * Possible hook names include:
222
-		 *
223
-		 *  - `install_plugins_table_api_args_favorites`
224
-		 *  - `install_plugins_table_api_args_featured`
225
-		 *  - `install_plugins_table_api_args_popular`
226
-		 *  - `install_plugins_table_api_args_recommended`
227
-		 *  - `install_plugins_table_api_args_upload`
228
-		 *  - `install_plugins_table_api_args_search`
229
-		 *  - `install_plugins_table_api_args_beta`
230
-		 *
231
-		 * @since 3.7.0
232
-		 *
233
-		 * @param array|false $args Plugin install API arguments.
234
-		 */
235
-		$args = apply_filters( "install_plugins_table_api_args_{$tab}", $args );
236
-
237
-		if ( ! $args ) {
238
-			return;
239
-		}
240
-
241
-		$api = plugins_api( 'query_plugins', $args );
242
-
243
-		if ( is_wp_error( $api ) ) {
244
-			$this->error = $api;
245
-			return;
246
-		}
247
-
248
-		$this->items = $api->plugins;
249
-
250
-		if ( $this->orderby ) {
251
-			uasort( $this->items, array( $this, 'order_callback' ) );
252
-		}
253
-
254
-		$this->set_pagination_args(
255
-			array(
256
-				'total_items' => $api->info['results'],
257
-				'per_page'    => $args['per_page'],
258
-			)
259
-		);
260
-
261
-		if ( isset( $api->info['groups'] ) ) {
262
-			$this->groups = $api->info['groups'];
263
-		}
264
-
265
-		if ( $installed_plugins ) {
266
-			$js_plugins = array_fill_keys(
267
-				array( 'all', 'search', 'active', 'inactive', 'recently_activated', 'mustuse', 'dropins' ),
268
-				array()
269
-			);
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' );
273
-
274
-			if ( $upgrade_plugins ) {
275
-				$js_plugins['upgrade'] = array_values( $upgrade_plugins );
276
-			}
277
-
278
-			wp_localize_script(
279
-				'updates',
280
-				'_wpUpdatesItemCounts',
281
-				array(
282
-					'plugins' => $js_plugins,
283
-					'totals'  => wp_get_update_data(),
284
-				)
285
-			);
286
-		}
287
-	}
288
-
289
-	/**
290
-	 */
291
-	public function no_items() {
292
-		if ( isset( $this->error ) ) { ?>
20
+    public $order   = 'ASC';
21
+    public $orderby = null;
22
+    public $groups  = array();
23
+
24
+    private $error;
25
+
26
+    /**
27
+     * @return bool
28
+     */
29
+    public function ajax_user_can() {
30
+        return current_user_can( 'install_plugins' );
31
+    }
32
+
33
+    /**
34
+     * Return the list of known plugins.
35
+     *
36
+     * Uses the transient data from the updates API to determine the known
37
+     * installed plugins.
38
+     *
39
+     * @since 4.9.0
40
+     * @access protected
41
+     *
42
+     * @return array
43
+     */
44
+    protected function get_installed_plugins() {
45
+        $plugins = array();
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 ) ) {
51
+                    $plugin->upgrade          = false;
52
+                    $plugins[ $plugin->slug ] = $plugin;
53
+                }
54
+            }
55
+        }
56
+
57
+        if ( isset( $plugin_info->response ) ) {
58
+            foreach ( $plugin_info->response as $plugin ) {
59
+                if ( isset( $plugin->slug ) ) {
60
+                    $plugin->upgrade          = true;
61
+                    $plugins[ $plugin->slug ] = $plugin;
62
+                }
63
+            }
64
+        }
65
+
66
+        return $plugins;
67
+    }
68
+
69
+    /**
70
+     * Return a list of slugs of installed plugins, if known.
71
+     *
72
+     * Uses the transient data from the updates API to determine the slugs of
73
+     * known installed plugins. This might be better elsewhere, perhaps even
74
+     * within get_plugins().
75
+     *
76
+     * @since 4.0.0
77
+     *
78
+     * @return array
79
+     */
80
+    protected function get_installed_plugin_slugs() {
81
+        return array_keys( $this->get_installed_plugins() );
82
+    }
83
+
84
+    /**
85
+     * @global array  $tabs
86
+     * @global string $tab
87
+     * @global int    $paged
88
+     * @global string $type
89
+     * @global string $term
90
+     */
91
+    public function prepare_items() {
92
+        include_once ABSPATH . 'wp-admin/includes/plugin-install.php';
93
+
94
+        global $tabs, $tab, $paged, $type, $term;
95
+
96
+        wp_reset_vars( array( 'tab' ) );
97
+
98
+        $paged = $this->get_pagenum();
99
+
100
+        $per_page = 36;
101
+
102
+        // These are the tabs which are shown on the page.
103
+        $tabs = array();
104
+
105
+        if ( 'search' === $tab ) {
106
+            $tabs['search'] = __( 'Search Results' );
107
+        }
108
+
109
+        if ( 'beta' === $tab || false !== strpos( get_bloginfo( 'version' ), '-' ) ) {
110
+            $tabs['beta'] = _x( 'Beta Testing', 'Plugin Installer' );
111
+        }
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' );
117
+
118
+        if ( current_user_can( 'upload_plugins' ) ) {
119
+            // No longer a real tab. Here for filter compatibility.
120
+            // Gets skipped in get_views().
121
+            $tabs['upload'] = __( 'Upload Plugin' );
122
+        }
123
+
124
+        $nonmenu_tabs = array( 'plugin-information' ); // Valid actions to perform which do not have a Menu item.
125
+
126
+        /**
127
+         * Filters the tabs shown on the Add Plugins screen.
128
+         *
129
+         * @since 2.7.0
130
+         *
131
+         * @param string[] $tabs The tabs shown on the Add Plugins screen. Defaults include
132
+         *                       'featured', 'popular', 'recommended', 'favorites', and 'upload'.
133
+         */
134
+        $tabs = apply_filters( 'install_plugins_tabs', $tabs );
135
+
136
+        /**
137
+         * Filters tabs not associated with a menu item on the Add Plugins screen.
138
+         *
139
+         * @since 2.7.0
140
+         *
141
+         * @param string[] $nonmenu_tabs The tabs that don't have a menu item on the Add Plugins screen.
142
+         */
143
+        $nonmenu_tabs = apply_filters( 'install_plugins_nonmenu_tabs', $nonmenu_tabs );
144
+
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 );
148
+        }
149
+
150
+        $installed_plugins = $this->get_installed_plugins();
151
+
152
+        $args = array(
153
+            'page'     => $paged,
154
+            'per_page' => $per_page,
155
+            // Send the locale to the API so it can provide context-sensitive results.
156
+            'locale'   => get_user_locale(),
157
+        );
158
+
159
+        switch ( $tab ) {
160
+            case 'search':
161
+                $type = isset( $_REQUEST['type'] ) ? wp_unslash( $_REQUEST['type'] ) : 'term';
162
+                $term = isset( $_REQUEST['s'] ) ? wp_unslash( $_REQUEST['s'] ) : '';
163
+
164
+                switch ( $type ) {
165
+                    case 'tag':
166
+                        $args['tag'] = sanitize_title_with_dashes( $term );
167
+                        break;
168
+                    case 'term':
169
+                        $args['search'] = $term;
170
+                        break;
171
+                    case 'author':
172
+                        $args['author'] = $term;
173
+                        break;
174
+                }
175
+
176
+                break;
177
+
178
+            case 'featured':
179
+            case 'popular':
180
+            case 'new':
181
+            case 'beta':
182
+                $args['browse'] = $tab;
183
+                break;
184
+            case 'recommended':
185
+                $args['browse'] = $tab;
186
+                // Include the list of installed plugins so we can get relevant results.
187
+                $args['installed_plugins'] = array_keys( $installed_plugins );
188
+                break;
189
+
190
+            case 'favorites':
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' );
194
+
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 );
198
+                    }
199
+                } else {
200
+                    $user = get_user_option( 'wporg_favorites' );
201
+                }
202
+                if ( $user ) {
203
+                    $args['user'] = $user;
204
+                } else {
205
+                    $args = false;
206
+                }
207
+
208
+                add_action( 'install_plugins_favorites', 'install_plugins_favorites_form', 9, 0 );
209
+                break;
210
+
211
+            default:
212
+                $args = false;
213
+                break;
214
+        }
215
+
216
+        /**
217
+         * Filters API request arguments for each Add Plugins screen tab.
218
+         *
219
+         * The dynamic portion of the hook name, `$tab`, refers to the plugin install tabs.
220
+         *
221
+         * Possible hook names include:
222
+         *
223
+         *  - `install_plugins_table_api_args_favorites`
224
+         *  - `install_plugins_table_api_args_featured`
225
+         *  - `install_plugins_table_api_args_popular`
226
+         *  - `install_plugins_table_api_args_recommended`
227
+         *  - `install_plugins_table_api_args_upload`
228
+         *  - `install_plugins_table_api_args_search`
229
+         *  - `install_plugins_table_api_args_beta`
230
+         *
231
+         * @since 3.7.0
232
+         *
233
+         * @param array|false $args Plugin install API arguments.
234
+         */
235
+        $args = apply_filters( "install_plugins_table_api_args_{$tab}", $args );
236
+
237
+        if ( ! $args ) {
238
+            return;
239
+        }
240
+
241
+        $api = plugins_api( 'query_plugins', $args );
242
+
243
+        if ( is_wp_error( $api ) ) {
244
+            $this->error = $api;
245
+            return;
246
+        }
247
+
248
+        $this->items = $api->plugins;
249
+
250
+        if ( $this->orderby ) {
251
+            uasort( $this->items, array( $this, 'order_callback' ) );
252
+        }
253
+
254
+        $this->set_pagination_args(
255
+            array(
256
+                'total_items' => $api->info['results'],
257
+                'per_page'    => $args['per_page'],
258
+            )
259
+        );
260
+
261
+        if ( isset( $api->info['groups'] ) ) {
262
+            $this->groups = $api->info['groups'];
263
+        }
264
+
265
+        if ( $installed_plugins ) {
266
+            $js_plugins = array_fill_keys(
267
+                array( 'all', 'search', 'active', 'inactive', 'recently_activated', 'mustuse', 'dropins' ),
268
+                array()
269
+            );
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' );
273
+
274
+            if ( $upgrade_plugins ) {
275
+                $js_plugins['upgrade'] = array_values( $upgrade_plugins );
276
+            }
277
+
278
+            wp_localize_script(
279
+                'updates',
280
+                '_wpUpdatesItemCounts',
281
+                array(
282
+                    'plugins' => $js_plugins,
283
+                    'totals'  => wp_get_update_data(),
284
+                )
285
+            );
286
+        }
287
+    }
288
+
289
+    /**
290
+     */
291
+    public function no_items() {
292
+        if ( isset( $this->error ) ) { ?>
293 293
 			<div class="inline error"><p><?php echo $this->error->get_error_message(); ?></p>
294 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 297
 			<div class="no-plugin-results"><?php _e( 'No plugins found. Try a different search.' ); ?></div>
298 298
 			<?php
299
-		}
300
-	}
301
-
302
-	/**
303
-	 * @global array $tabs
304
-	 * @global string $tab
305
-	 *
306
-	 * @return array
307
-	 */
308
-	protected function get_views() {
309
-		global $tabs, $tab;
310
-
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>";
316
-		}
317
-		// No longer a real tab.
318
-		unset( $display_tabs['plugin-install-upload'] );
319
-
320
-		return $display_tabs;
321
-	}
322
-
323
-	/**
324
-	 * Override parent views so we can use the filter bar display.
325
-	 */
326
-	public function views() {
327
-		$views = $this->get_views();
328
-
329
-		/** This filter is documented in wp-admin/inclues/class-wp-list-table.php */
330
-		$views = apply_filters( "views_{$this->screen->id}", $views );
331
-
332
-		$this->screen->render_screen_reader_content( 'heading_views' );
333
-		?>
299
+        }
300
+    }
301
+
302
+    /**
303
+     * @global array $tabs
304
+     * @global string $tab
305
+     *
306
+     * @return array
307
+     */
308
+    protected function get_views() {
309
+        global $tabs, $tab;
310
+
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>";
316
+        }
317
+        // No longer a real tab.
318
+        unset( $display_tabs['plugin-install-upload'] );
319
+
320
+        return $display_tabs;
321
+    }
322
+
323
+    /**
324
+     * Override parent views so we can use the filter bar display.
325
+     */
326
+    public function views() {
327
+        $views = $this->get_views();
328
+
329
+        /** This filter is documented in wp-admin/inclues/class-wp-list-table.php */
330
+        $views = apply_filters( "views_{$this->screen->id}", $views );
331
+
332
+        $this->screen->render_screen_reader_content( 'heading_views' );
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";
340
-			}
341
-			echo implode( " </li>\n", $views ) . "</li>\n";
342
-		}
343
-		?>
337
+        if ( ! empty( $views ) ) {
338
+            foreach ( $views as $class => $view ) {
339
+                $views[ $class ] = "\t<li class='$class'>$view";
340
+            }
341
+            echo implode( " </li>\n", $views ) . "</li>\n";
342
+        }
343
+        ?>
344 344
 	</ul>
345 345
 
346 346
 		<?php install_search_form(); ?>
347 347
 </div>
348 348
 		<?php
349
-	}
349
+    }
350 350
 
351
-	/**
352
-	 * Displays the plugin install table.
353
-	 *
354
-	 * Overrides the parent display() method to provide a different container.
355
-	 *
356
-	 * @since 4.0.0
357
-	 */
358
-	public function display() {
359
-		$singular = $this->_args['singular'];
351
+    /**
352
+     * Displays the plugin install table.
353
+     *
354
+     * Overrides the parent display() method to provide a different container.
355
+     *
356
+     * @since 4.0.0
357
+     */
358
+    public function display() {
359
+        $singular = $this->_args['singular'];
360 360
 
361
-		$data_attr = '';
361
+        $data_attr = '';
362 362
 
363
-		if ( $singular ) {
364
-			$data_attr = " data-wp-lists='list:$singular'";
365
-		}
363
+        if ( $singular ) {
364
+            $data_attr = " data-wp-lists='list:$singular'";
365
+        }
366 366
 
367
-		$this->display_tablenav( 'top' );
367
+        $this->display_tablenav( 'top' );
368 368
 
369
-		?>
369
+        ?>
370 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' );
373
-		?>
372
+        $this->screen->render_screen_reader_content( 'heading_list' );
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' );
380
-	}
381
-
382
-	/**
383
-	 * @global string $tab
384
-	 *
385
-	 * @param string $which
386
-	 */
387
-	protected function display_tablenav( $which ) {
388
-		if ( 'featured' === $GLOBALS['tab'] ) {
389
-			return;
390
-		}
391
-
392
-		if ( 'top' === $which ) {
393
-			wp_referer_field();
394
-			?>
379
+        $this->display_tablenav( 'bottom' );
380
+    }
381
+
382
+    /**
383
+     * @global string $tab
384
+     *
385
+     * @param string $which
386
+     */
387
+    protected function display_tablenav( $which ) {
388
+        if ( 'featured' === $GLOBALS['tab'] ) {
389
+            return;
390
+        }
391
+
392
+        if ( 'top' === $which ) {
393
+            wp_referer_field();
394
+            ?>
395 395
 			<div class="tablenav top">
396 396
 				<div class="alignleft actions">
397 397
 					<?php
398
-					/**
399
-					 * Fires before the Plugin Install table header pagination is displayed.
400
-					 *
401
-					 * @since 2.7.0
402
-					 */
403
-					do_action( 'install_plugins_table_header' );
404
-					?>
398
+                    /**
399
+                     * Fires before the Plugin Install table header pagination is displayed.
400
+                     *
401
+                     * @since 2.7.0
402
+                     */
403
+                    do_action( 'install_plugins_table_header' );
404
+                    ?>
405 405
 				</div>
406 406
 				<?php $this->pagination( $which ); ?>
407 407
 				<br class="clear" />
@@ -412,325 +412,325 @@  discard block
 block discarded – undo
412 412
 				<br class="clear" />
413 413
 			</div>
414 414
 			<?php
415
-		}
416
-	}
417
-
418
-	/**
419
-	 * @return array
420
-	 */
421
-	protected function get_table_classes() {
422
-		return array( 'widefat', $this->_args['plural'] );
423
-	}
424
-
425
-	/**
426
-	 * @return array
427
-	 */
428
-	public function get_columns() {
429
-		return array();
430
-	}
431
-
432
-	/**
433
-	 * @param object $plugin_a
434
-	 * @param object $plugin_b
435
-	 * @return int
436
-	 */
437
-	private function order_callback( $plugin_a, $plugin_b ) {
438
-		$orderby = $this->orderby;
439
-		if ( ! isset( $plugin_a->$orderby, $plugin_b->$orderby ) ) {
440
-			return 0;
441
-		}
442
-
443
-		$a = $plugin_a->$orderby;
444
-		$b = $plugin_b->$orderby;
445
-
446
-		if ( $a === $b ) {
447
-			return 0;
448
-		}
449
-
450
-		if ( 'DESC' === $this->order ) {
451
-			return ( $a < $b ) ? 1 : -1;
452
-		} else {
453
-			return ( $a < $b ) ? -1 : 1;
454
-		}
455
-	}
456
-
457
-	public function display_rows() {
458
-		$plugins_allowedtags = array(
459
-			'a'       => array(
460
-				'href'   => array(),
461
-				'title'  => array(),
462
-				'target' => array(),
463
-			),
464
-			'abbr'    => array( 'title' => array() ),
465
-			'acronym' => array( 'title' => array() ),
466
-			'code'    => array(),
467
-			'pre'     => array(),
468
-			'em'      => array(),
469
-			'strong'  => array(),
470
-			'ul'      => array(),
471
-			'ol'      => array(),
472
-			'li'      => array(),
473
-			'p'       => array(),
474
-			'br'      => array(),
475
-		);
476
-
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' ),
481
-		);
482
-
483
-		$group = null;
484
-
485
-		foreach ( (array) $this->items as $plugin ) {
486
-			if ( is_object( $plugin ) ) {
487
-				$plugin = (array) $plugin;
488
-			}
489
-
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 ];
496
-					}
497
-				} else {
498
-					$group_name = $plugin['group'];
499
-				}
500
-
501
-				// Starting a new group, close off the divs of the last one.
502
-				if ( ! empty( $group ) ) {
503
-					echo '</div></div>';
504
-				}
505
-
506
-				echo '<div class="plugin-group"><h3>' . esc_html( $group_name ) . '</h3>';
507
-				// Needs an extra wrapping div for nth-child selectors to work.
508
-				echo '<div class="plugin-items">';
509
-
510
-				$group = $plugin['group'];
511
-			}
512
-
513
-			$title = wp_kses( $plugin['name'], $plugins_allowedtags );
514
-
515
-			// Remove any HTML from the description.
516
-			$description = strip_tags( $plugin['short_description'] );
517
-
518
-			/**
519
-			 * Filters the plugin card description on the Add Plugins screen.
520
-			 *
521
-			 * @since 6.0.0
522
-			 *
523
-			 * @param string $description Plugin card description.
524
-			 * @param array  $plugin      An array of plugin data. See {@see plugins_api()}
525
-			 *                            for the list of possible values.
526
-			 */
527
-			$description = apply_filters( 'plugin_install_description', $description, $plugin );
528
-
529
-			$version = wp_kses( $plugin['version'], $plugins_allowedtags );
530
-
531
-			$name = strip_tags( $title . ' ' . $version );
532
-
533
-			$author = wp_kses( $plugin['author'], $plugins_allowedtags );
534
-			if ( ! empty( $author ) ) {
535
-				/* translators: %s: Plugin author. */
536
-				$author = ' <cite>' . sprintf( __( 'By %s' ), $author ) . '</cite>';
537
-			}
538
-
539
-			$requires_php = isset( $plugin['requires_php'] ) ? $plugin['requires_php'] : null;
540
-			$requires_wp  = isset( $plugin['requires'] ) ? $plugin['requires'] : null;
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'], '<=' ) );
545
-
546
-			$action_links = array();
547
-
548
-			if ( current_user_can( 'install_plugins' ) || current_user_can( 'update_plugins' ) ) {
549
-				$status = install_plugin_install_status( $plugin );
550
-
551
-				switch ( $status['status'] ) {
552
-					case 'install':
553
-						if ( $status['url'] ) {
554
-							if ( $compatible_php && $compatible_wp ) {
555
-								$action_links[] = sprintf(
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'] ),
559
-									/* translators: %s: Plugin name and version. */
560
-									esc_attr( sprintf( _x( 'Install %s now', 'plugin' ), $name ) ),
561
-									esc_attr( $name ),
562
-									__( 'Install Now' )
563
-								);
564
-							} else {
565
-								$action_links[] = sprintf(
566
-									'<button type="button" class="button button-disabled" disabled="disabled">%s</button>',
567
-									_x( 'Cannot Install', 'plugin' )
568
-								);
569
-							}
570
-						}
571
-						break;
572
-
573
-					case 'update_available':
574
-						if ( $status['url'] ) {
575
-							if ( $compatible_php && $compatible_wp ) {
576
-								$action_links[] = sprintf(
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'] ),
581
-									/* translators: %s: Plugin name and version. */
582
-									esc_attr( sprintf( _x( 'Update %s now', 'plugin' ), $name ) ),
583
-									esc_attr( $name ),
584
-									__( 'Update Now' )
585
-								);
586
-							} else {
587
-								$action_links[] = sprintf(
588
-									'<button type="button" class="button button-disabled" disabled="disabled">%s</button>',
589
-									_x( 'Cannot Update', 'plugin' )
590
-								);
591
-							}
592
-						}
593
-						break;
594
-
595
-					case 'latest_installed':
596
-					case 'newer_installed':
597
-						if ( is_plugin_active( $status['file'] ) ) {
598
-							$action_links[] = sprintf(
599
-								'<button type="button" class="button button-disabled" disabled="disabled">%s</button>',
600
-								_x( 'Active', 'plugin' )
601
-							);
602
-						} elseif ( current_user_can( 'activate_plugin', $status['file'] ) ) {
603
-							if ( $compatible_php && $compatible_wp ) {
604
-								$button_text = __( 'Activate' );
605
-								/* translators: %s: Plugin name. */
606
-								$button_label = _x( 'Activate %s', 'plugin' );
607
-								$activate_url = add_query_arg(
608
-									array(
609
-										'_wpnonce' => wp_create_nonce( 'activate-plugin_' . $status['file'] ),
610
-										'action'   => 'activate',
611
-										'plugin'   => $status['file'],
612
-									),
613
-									network_admin_url( 'plugins.php' )
614
-								);
615
-
616
-								if ( is_network_admin() ) {
617
-									$button_text = __( 'Network Activate' );
618
-									/* translators: %s: Plugin name. */
619
-									$button_label = _x( 'Network Activate %s', 'plugin' );
620
-									$activate_url = add_query_arg( array( 'networkwide' => 1 ), $activate_url );
621
-								}
622
-
623
-								$action_links[] = sprintf(
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'] ) ),
627
-									$button_text
628
-								);
629
-							} else {
630
-								$action_links[] = sprintf(
631
-									'<button type="button" class="button button-disabled" disabled="disabled">%s</button>',
632
-									_x( 'Cannot Activate', 'plugin' )
633
-								);
634
-							}
635
-						} else {
636
-							$action_links[] = sprintf(
637
-								'<button type="button" class="button button-disabled" disabled="disabled">%s</button>',
638
-								_x( 'Installed', 'plugin' )
639
-							);
640
-						}
641
-						break;
642
-				}
643
-			}
644
-
645
-			$details_link = self_admin_url(
646
-				'plugin-install.php?tab=plugin-information&amp;plugin=' . $plugin['slug'] .
647
-				'&amp;TB_iframe=true&amp;width=600&amp;height=550'
648
-			);
649
-
650
-			$action_links[] = sprintf(
651
-				'<a href="%s" class="thickbox open-plugin-details-modal" aria-label="%s" data-title="%s">%s</a>',
652
-				esc_url( $details_link ),
653
-				/* translators: %s: Plugin name and version. */
654
-				esc_attr( sprintf( __( 'More information about %s' ), $name ) ),
655
-				esc_attr( $name ),
656
-				__( 'More Details' )
657
-			);
658
-
659
-			if ( ! empty( $plugin['icons']['svg'] ) ) {
660
-				$plugin_icon_url = $plugin['icons']['svg'];
661
-			} elseif ( ! empty( $plugin['icons']['2x'] ) ) {
662
-				$plugin_icon_url = $plugin['icons']['2x'];
663
-			} elseif ( ! empty( $plugin['icons']['1x'] ) ) {
664
-				$plugin_icon_url = $plugin['icons']['1x'];
665
-			} else {
666
-				$plugin_icon_url = $plugin['icons']['default'];
667
-			}
668
-
669
-			/**
670
-			 * Filters the install action links for a plugin.
671
-			 *
672
-			 * @since 2.7.0
673
-			 *
674
-			 * @param string[] $action_links An array of plugin action links.
675
-			 *                               Defaults are links to Details and Install Now.
676
-			 * @param array    $plugin       An array of plugin data. See {@see plugins_api()}
677
-			 *                               for the list of possible values.
678
-			 */
679
-			$action_links = apply_filters( 'plugin_install_action_links', $action_links, $plugin );
680
-
681
-			$last_updated_timestamp = strtotime( $plugin['last_updated'] );
682
-			?>
415
+        }
416
+    }
417
+
418
+    /**
419
+     * @return array
420
+     */
421
+    protected function get_table_classes() {
422
+        return array( 'widefat', $this->_args['plural'] );
423
+    }
424
+
425
+    /**
426
+     * @return array
427
+     */
428
+    public function get_columns() {
429
+        return array();
430
+    }
431
+
432
+    /**
433
+     * @param object $plugin_a
434
+     * @param object $plugin_b
435
+     * @return int
436
+     */
437
+    private function order_callback( $plugin_a, $plugin_b ) {
438
+        $orderby = $this->orderby;
439
+        if ( ! isset( $plugin_a->$orderby, $plugin_b->$orderby ) ) {
440
+            return 0;
441
+        }
442
+
443
+        $a = $plugin_a->$orderby;
444
+        $b = $plugin_b->$orderby;
445
+
446
+        if ( $a === $b ) {
447
+            return 0;
448
+        }
449
+
450
+        if ( 'DESC' === $this->order ) {
451
+            return ( $a < $b ) ? 1 : -1;
452
+        } else {
453
+            return ( $a < $b ) ? -1 : 1;
454
+        }
455
+    }
456
+
457
+    public function display_rows() {
458
+        $plugins_allowedtags = array(
459
+            'a'       => array(
460
+                'href'   => array(),
461
+                'title'  => array(),
462
+                'target' => array(),
463
+            ),
464
+            'abbr'    => array( 'title' => array() ),
465
+            'acronym' => array( 'title' => array() ),
466
+            'code'    => array(),
467
+            'pre'     => array(),
468
+            'em'      => array(),
469
+            'strong'  => array(),
470
+            'ul'      => array(),
471
+            'ol'      => array(),
472
+            'li'      => array(),
473
+            'p'       => array(),
474
+            'br'      => array(),
475
+        );
476
+
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' ),
481
+        );
482
+
483
+        $group = null;
484
+
485
+        foreach ( (array) $this->items as $plugin ) {
486
+            if ( is_object( $plugin ) ) {
487
+                $plugin = (array) $plugin;
488
+            }
489
+
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 ];
496
+                    }
497
+                } else {
498
+                    $group_name = $plugin['group'];
499
+                }
500
+
501
+                // Starting a new group, close off the divs of the last one.
502
+                if ( ! empty( $group ) ) {
503
+                    echo '</div></div>';
504
+                }
505
+
506
+                echo '<div class="plugin-group"><h3>' . esc_html( $group_name ) . '</h3>';
507
+                // Needs an extra wrapping div for nth-child selectors to work.
508
+                echo '<div class="plugin-items">';
509
+
510
+                $group = $plugin['group'];
511
+            }
512
+
513
+            $title = wp_kses( $plugin['name'], $plugins_allowedtags );
514
+
515
+            // Remove any HTML from the description.
516
+            $description = strip_tags( $plugin['short_description'] );
517
+
518
+            /**
519
+             * Filters the plugin card description on the Add Plugins screen.
520
+             *
521
+             * @since 6.0.0
522
+             *
523
+             * @param string $description Plugin card description.
524
+             * @param array  $plugin      An array of plugin data. See {@see plugins_api()}
525
+             *                            for the list of possible values.
526
+             */
527
+            $description = apply_filters( 'plugin_install_description', $description, $plugin );
528
+
529
+            $version = wp_kses( $plugin['version'], $plugins_allowedtags );
530
+
531
+            $name = strip_tags( $title . ' ' . $version );
532
+
533
+            $author = wp_kses( $plugin['author'], $plugins_allowedtags );
534
+            if ( ! empty( $author ) ) {
535
+                /* translators: %s: Plugin author. */
536
+                $author = ' <cite>' . sprintf( __( 'By %s' ), $author ) . '</cite>';
537
+            }
538
+
539
+            $requires_php = isset( $plugin['requires_php'] ) ? $plugin['requires_php'] : null;
540
+            $requires_wp  = isset( $plugin['requires'] ) ? $plugin['requires'] : null;
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'], '<=' ) );
545
+
546
+            $action_links = array();
547
+
548
+            if ( current_user_can( 'install_plugins' ) || current_user_can( 'update_plugins' ) ) {
549
+                $status = install_plugin_install_status( $plugin );
550
+
551
+                switch ( $status['status'] ) {
552
+                    case 'install':
553
+                        if ( $status['url'] ) {
554
+                            if ( $compatible_php && $compatible_wp ) {
555
+                                $action_links[] = sprintf(
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'] ),
559
+                                    /* translators: %s: Plugin name and version. */
560
+                                    esc_attr( sprintf( _x( 'Install %s now', 'plugin' ), $name ) ),
561
+                                    esc_attr( $name ),
562
+                                    __( 'Install Now' )
563
+                                );
564
+                            } else {
565
+                                $action_links[] = sprintf(
566
+                                    '<button type="button" class="button button-disabled" disabled="disabled">%s</button>',
567
+                                    _x( 'Cannot Install', 'plugin' )
568
+                                );
569
+                            }
570
+                        }
571
+                        break;
572
+
573
+                    case 'update_available':
574
+                        if ( $status['url'] ) {
575
+                            if ( $compatible_php && $compatible_wp ) {
576
+                                $action_links[] = sprintf(
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'] ),
581
+                                    /* translators: %s: Plugin name and version. */
582
+                                    esc_attr( sprintf( _x( 'Update %s now', 'plugin' ), $name ) ),
583
+                                    esc_attr( $name ),
584
+                                    __( 'Update Now' )
585
+                                );
586
+                            } else {
587
+                                $action_links[] = sprintf(
588
+                                    '<button type="button" class="button button-disabled" disabled="disabled">%s</button>',
589
+                                    _x( 'Cannot Update', 'plugin' )
590
+                                );
591
+                            }
592
+                        }
593
+                        break;
594
+
595
+                    case 'latest_installed':
596
+                    case 'newer_installed':
597
+                        if ( is_plugin_active( $status['file'] ) ) {
598
+                            $action_links[] = sprintf(
599
+                                '<button type="button" class="button button-disabled" disabled="disabled">%s</button>',
600
+                                _x( 'Active', 'plugin' )
601
+                            );
602
+                        } elseif ( current_user_can( 'activate_plugin', $status['file'] ) ) {
603
+                            if ( $compatible_php && $compatible_wp ) {
604
+                                $button_text = __( 'Activate' );
605
+                                /* translators: %s: Plugin name. */
606
+                                $button_label = _x( 'Activate %s', 'plugin' );
607
+                                $activate_url = add_query_arg(
608
+                                    array(
609
+                                        '_wpnonce' => wp_create_nonce( 'activate-plugin_' . $status['file'] ),
610
+                                        'action'   => 'activate',
611
+                                        'plugin'   => $status['file'],
612
+                                    ),
613
+                                    network_admin_url( 'plugins.php' )
614
+                                );
615
+
616
+                                if ( is_network_admin() ) {
617
+                                    $button_text = __( 'Network Activate' );
618
+                                    /* translators: %s: Plugin name. */
619
+                                    $button_label = _x( 'Network Activate %s', 'plugin' );
620
+                                    $activate_url = add_query_arg( array( 'networkwide' => 1 ), $activate_url );
621
+                                }
622
+
623
+                                $action_links[] = sprintf(
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'] ) ),
627
+                                    $button_text
628
+                                );
629
+                            } else {
630
+                                $action_links[] = sprintf(
631
+                                    '<button type="button" class="button button-disabled" disabled="disabled">%s</button>',
632
+                                    _x( 'Cannot Activate', 'plugin' )
633
+                                );
634
+                            }
635
+                        } else {
636
+                            $action_links[] = sprintf(
637
+                                '<button type="button" class="button button-disabled" disabled="disabled">%s</button>',
638
+                                _x( 'Installed', 'plugin' )
639
+                            );
640
+                        }
641
+                        break;
642
+                }
643
+            }
644
+
645
+            $details_link = self_admin_url(
646
+                'plugin-install.php?tab=plugin-information&amp;plugin=' . $plugin['slug'] .
647
+                '&amp;TB_iframe=true&amp;width=600&amp;height=550'
648
+            );
649
+
650
+            $action_links[] = sprintf(
651
+                '<a href="%s" class="thickbox open-plugin-details-modal" aria-label="%s" data-title="%s">%s</a>',
652
+                esc_url( $details_link ),
653
+                /* translators: %s: Plugin name and version. */
654
+                esc_attr( sprintf( __( 'More information about %s' ), $name ) ),
655
+                esc_attr( $name ),
656
+                __( 'More Details' )
657
+            );
658
+
659
+            if ( ! empty( $plugin['icons']['svg'] ) ) {
660
+                $plugin_icon_url = $plugin['icons']['svg'];
661
+            } elseif ( ! empty( $plugin['icons']['2x'] ) ) {
662
+                $plugin_icon_url = $plugin['icons']['2x'];
663
+            } elseif ( ! empty( $plugin['icons']['1x'] ) ) {
664
+                $plugin_icon_url = $plugin['icons']['1x'];
665
+            } else {
666
+                $plugin_icon_url = $plugin['icons']['default'];
667
+            }
668
+
669
+            /**
670
+             * Filters the install action links for a plugin.
671
+             *
672
+             * @since 2.7.0
673
+             *
674
+             * @param string[] $action_links An array of plugin action links.
675
+             *                               Defaults are links to Details and Install Now.
676
+             * @param array    $plugin       An array of plugin data. See {@see plugins_api()}
677
+             *                               for the list of possible values.
678
+             */
679
+            $action_links = apply_filters( 'plugin_install_action_links', $action_links, $plugin );
680
+
681
+            $last_updated_timestamp = strtotime( $plugin['last_updated'] );
682
+            ?>
683 683
 		<div class="plugin-card plugin-card-<?php echo sanitize_html_class( $plugin['slug'] ); ?>">
684 684
 			<?php
685
-			if ( ! $compatible_php || ! $compatible_wp ) {
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' ) ) {
690
-						printf(
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() )
695
-						);
696
-						wp_update_php_annotation( '</p><p><em>', '</em>' );
697
-					} elseif ( current_user_can( 'update_core' ) ) {
698
-						printf(
699
-							/* translators: %s: URL to WordPress Updates screen. */
700
-							' ' . __( '<a href="%s">Please update WordPress</a>.' ),
701
-							self_admin_url( 'update-core.php' )
702
-						);
703
-					} elseif ( current_user_can( 'update_php' ) ) {
704
-						printf(
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() )
708
-						);
709
-						wp_update_php_annotation( '</p><p><em>', '</em>' );
710
-					}
711
-				} elseif ( ! $compatible_wp ) {
712
-					_e( 'This plugin does not work with your version of WordPress.' );
713
-					if ( current_user_can( 'update_core' ) ) {
714
-						printf(
715
-							/* translators: %s: URL to WordPress Updates screen. */
716
-							' ' . __( '<a href="%s">Please update WordPress</a>.' ),
717
-							self_admin_url( 'update-core.php' )
718
-						);
719
-					}
720
-				} elseif ( ! $compatible_php ) {
721
-					_e( 'This plugin does not work with your version of PHP.' );
722
-					if ( current_user_can( 'update_php' ) ) {
723
-						printf(
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() )
727
-						);
728
-						wp_update_php_annotation( '</p><p><em>', '</em>' );
729
-					}
730
-				}
731
-				echo '</p></div>';
732
-			}
733
-			?>
685
+            if ( ! $compatible_php || ! $compatible_wp ) {
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' ) ) {
690
+                        printf(
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() )
695
+                        );
696
+                        wp_update_php_annotation( '</p><p><em>', '</em>' );
697
+                    } elseif ( current_user_can( 'update_core' ) ) {
698
+                        printf(
699
+                            /* translators: %s: URL to WordPress Updates screen. */
700
+                            ' ' . __( '<a href="%s">Please update WordPress</a>.' ),
701
+                            self_admin_url( 'update-core.php' )
702
+                        );
703
+                    } elseif ( current_user_can( 'update_php' ) ) {
704
+                        printf(
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() )
708
+                        );
709
+                        wp_update_php_annotation( '</p><p><em>', '</em>' );
710
+                    }
711
+                } elseif ( ! $compatible_wp ) {
712
+                    _e( 'This plugin does not work with your version of WordPress.' );
713
+                    if ( current_user_can( 'update_core' ) ) {
714
+                        printf(
715
+                            /* translators: %s: URL to WordPress Updates screen. */
716
+                            ' ' . __( '<a href="%s">Please update WordPress</a>.' ),
717
+                            self_admin_url( 'update-core.php' )
718
+                        );
719
+                    }
720
+                } elseif ( ! $compatible_php ) {
721
+                    _e( 'This plugin does not work with your version of PHP.' );
722
+                    if ( current_user_can( 'update_php' ) ) {
723
+                        printf(
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() )
727
+                        );
728
+                        wp_update_php_annotation( '</p><p><em>', '</em>' );
729
+                    }
730
+                }
731
+                echo '</p></div>';
732
+            }
733
+            ?>
734 734
 			<div class="plugin-card-top">
735 735
 				<div class="name column-name">
736 736
 					<h3>
@@ -742,10 +742,10 @@  discard block
 block discarded – undo
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>';
747
-					}
748
-					?>
745
+                    if ( $action_links ) {
746
+                        echo '<ul class="plugin-action-buttons"><li>' . implode( '</li><li>', $action_links ) . '</li></ul>';
747
+                    }
748
+                    ?>
749 749
 				</div>
750 750
 				<div class="desc column-description">
751 751
 					<p><?php echo $description; ?></p>
@@ -755,60 +755,60 @@  discard block
 block discarded – undo
755 755
 			<div class="plugin-card-bottom">
756 756
 				<div class="vers column-rating">
757 757
 					<?php
758
-					wp_star_rating(
759
-						array(
760
-							'rating' => $plugin['rating'],
761
-							'type'   => 'percent',
762
-							'number' => $plugin['num_ratings'],
763
-						)
764
-					);
765
-					?>
758
+                    wp_star_rating(
759
+                        array(
760
+                            'rating' => $plugin['rating'],
761
+                            'type'   => 'percent',
762
+                            'number' => $plugin['num_ratings'],
763
+                        )
764
+                    );
765
+                    ?>
766 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 769
 					<strong><?php _e( 'Last Updated:' ); ?></strong>
770 770
 					<?php
771
-						/* translators: %s: Human-readable time difference. */
772
-						printf( __( '%s ago' ), human_time_diff( $last_updated_timestamp ) );
773
-					?>
771
+                        /* translators: %s: Human-readable time difference. */
772
+                        printf( __( '%s ago' ), human_time_diff( $last_updated_timestamp ) );
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 );
779
-						$active_installs_text     = sprintf(
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 )
783
-						);
784
-					} elseif ( 0 === $plugin['active_installs'] ) {
785
-						$active_installs_text = _x( 'Less Than 10', 'Active plugin installations' );
786
-					} else {
787
-						$active_installs_text = number_format_i18n( $plugin['active_installs'] ) . '+';
788
-					}
789
-					/* translators: %s: Number of installations. */
790
-					printf( __( '%s Active Installations' ), $active_installs_text );
791
-					?>
777
+                    if ( $plugin['active_installs'] >= 1000000 ) {
778
+                        $active_installs_millions = floor( $plugin['active_installs'] / 1000000 );
779
+                        $active_installs_text     = sprintf(
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 )
783
+                        );
784
+                    } elseif ( 0 === $plugin['active_installs'] ) {
785
+                        $active_installs_text = _x( 'Less Than 10', 'Active plugin installations' );
786
+                    } else {
787
+                        $active_installs_text = number_format_i18n( $plugin['active_installs'] ) . '+';
788
+                    }
789
+                    /* translators: %s: Number of installations. */
790
+                    printf( __( '%s Active Installations' ), $active_installs_text );
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>';
799
-					} else {
800
-						echo '<span class="compatibility-compatible">' . __( '<strong>Compatible</strong> with your version of WordPress' ) . '</span>';
801
-					}
802
-					?>
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
+                    } else {
800
+                        echo '<span class="compatibility-compatible">' . __( '<strong>Compatible</strong> with your version of WordPress' ) . '</span>';
801
+                    }
802
+                    ?>
803 803
 				</div>
804 804
 			</div>
805 805
 		</div>
806 806
 			<?php
807
-		}
807
+        }
808 808
 
809
-		// Close off the group divs of the last one.
810
-		if ( ! empty( $group ) ) {
811
-			echo '</div></div>';
812
-		}
813
-	}
809
+        // Close off the group divs of the last one.
810
+        if ( ! empty( $group ) ) {
811
+            echo '</div></div>';
812
+        }
813
+    }
814 814
 }
Please login to merge, or discard this patch.
Spacing   +205 added lines, -205 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 	}
Please login to merge, or discard this patch.
brighty/wp-admin/includes/class-wp-debug-data.php 2 patches
Indentation   +1691 added lines, -1691 removed lines patch added patch discarded remove patch
@@ -8,1699 +8,1699 @@
 block discarded – undo
8 8
  */
9 9
 
10 10
 class WP_Debug_Data {
11
-	/**
12
-	 * Calls all core functions to check for updates.
13
-	 *
14
-	 * @since 5.2.0
15
-	 */
16
-	public static function check_for_updates() {
17
-		wp_version_check();
18
-		wp_update_plugins();
19
-		wp_update_themes();
20
-	}
21
-
22
-	/**
23
-	 * Static function for generating site debug data when required.
24
-	 *
25
-	 * @since 5.2.0
26
-	 * @since 5.3.0 Added database charset, database collation,
27
-	 *              and timezone information.
28
-	 * @since 5.5.0 Added pretty permalinks support information.
29
-	 *
30
-	 * @throws ImagickException
31
-	 * @global wpdb $wpdb WordPress database abstraction object.
32
-	 *
33
-	 * @return array The debug data for the site.
34
-	 */
35
-	public static function debug_data() {
36
-		global $wpdb;
37
-
38
-		// Save few function calls.
39
-		$upload_dir             = wp_upload_dir();
40
-		$permalink_structure    = get_option( 'permalink_structure' );
41
-		$is_ssl                 = is_ssl();
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' );
46
-		$environment_type       = wp_get_environment_type();
47
-		$core_version           = get_bloginfo( 'version' );
48
-		$core_updates           = get_core_updates();
49
-		$core_update_needed     = '';
50
-
51
-		if ( is_array( $core_updates ) ) {
52
-			foreach ( $core_updates as $core => $update ) {
53
-				if ( 'upgrade' === $update->response ) {
54
-					/* translators: %s: Latest WordPress version number. */
55
-					$core_update_needed = ' ' . sprintf( __( '(Latest version: %s)' ), $update->version );
56
-				} else {
57
-					$core_update_needed = '';
58
-				}
59
-			}
60
-		}
61
-
62
-		// Set up the array that holds all debug information.
63
-		$info = array();
64
-
65
-		$info['wp-core'] = array(
66
-			'label'  => __( 'WordPress' ),
67
-			'fields' => array(
68
-				'version'                => array(
69
-					'label' => __( 'Version' ),
70
-					'value' => $core_version . $core_update_needed,
71
-					'debug' => $core_version,
72
-				),
73
-				'site_language'          => array(
74
-					'label' => __( 'Site Language' ),
75
-					'value' => get_locale(),
76
-				),
77
-				'user_language'          => array(
78
-					'label' => __( 'User Language' ),
79
-					'value' => get_user_locale(),
80
-				),
81
-				'timezone'               => array(
82
-					'label' => __( 'Timezone' ),
83
-					'value' => wp_timezone_string(),
84
-				),
85
-				'home_url'               => array(
86
-					'label'   => __( 'Home URL' ),
87
-					'value'   => get_bloginfo( 'url' ),
88
-					'private' => true,
89
-				),
90
-				'site_url'               => array(
91
-					'label'   => __( 'Site URL' ),
92
-					'value'   => get_bloginfo( 'wpurl' ),
93
-					'private' => true,
94
-				),
95
-				'permalink'              => array(
96
-					'label' => __( 'Permalink structure' ),
97
-					'value' => $permalink_structure ? $permalink_structure : __( 'No permalink structure set' ),
98
-					'debug' => $permalink_structure,
99
-				),
100
-				'https_status'           => array(
101
-					'label' => __( 'Is this site using HTTPS?' ),
102
-					'value' => $is_ssl ? __( 'Yes' ) : __( 'No' ),
103
-					'debug' => $is_ssl,
104
-				),
105
-				'multisite'              => array(
106
-					'label' => __( 'Is this a multisite?' ),
107
-					'value' => $is_multisite ? __( 'Yes' ) : __( 'No' ),
108
-					'debug' => $is_multisite,
109
-				),
110
-				'user_registration'      => array(
111
-					'label' => __( 'Can anyone register on this site?' ),
112
-					'value' => $users_can_register ? __( 'Yes' ) : __( 'No' ),
113
-					'debug' => $users_can_register,
114
-				),
115
-				'blog_public'            => array(
116
-					'label' => __( 'Is this site discouraging search engines?' ),
117
-					'value' => $blog_public ? __( 'No' ) : __( 'Yes' ),
118
-					'debug' => $blog_public,
119
-				),
120
-				'default_comment_status' => array(
121
-					'label' => __( 'Default comment status' ),
122
-					'value' => 'open' === $default_comment_status ? _x( 'Open', 'comment status' ) : _x( 'Closed', 'comment status' ),
123
-					'debug' => $default_comment_status,
124
-				),
125
-				'environment_type'       => array(
126
-					'label' => __( 'Environment type' ),
127
-					'value' => $environment_type,
128
-					'debug' => $environment_type,
129
-				),
130
-			),
131
-		);
132
-
133
-		if ( ! $is_multisite ) {
134
-			$info['wp-paths-sizes'] = array(
135
-				'label'  => __( 'Directories and Sizes' ),
136
-				'fields' => array(),
137
-			);
138
-		}
139
-
140
-		$info['wp-dropins'] = array(
141
-			'label'       => __( 'Drop-ins' ),
142
-			'show_count'  => true,
143
-			'description' => sprintf(
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>'
147
-			),
148
-			'fields'      => array(),
149
-		);
150
-
151
-		$info['wp-active-theme'] = array(
152
-			'label'  => __( 'Active Theme' ),
153
-			'fields' => array(),
154
-		);
155
-
156
-		$info['wp-parent-theme'] = array(
157
-			'label'  => __( 'Parent Theme' ),
158
-			'fields' => array(),
159
-		);
160
-
161
-		$info['wp-themes-inactive'] = array(
162
-			'label'      => __( 'Inactive Themes' ),
163
-			'show_count' => true,
164
-			'fields'     => array(),
165
-		);
166
-
167
-		$info['wp-mu-plugins'] = array(
168
-			'label'      => __( 'Must Use Plugins' ),
169
-			'show_count' => true,
170
-			'fields'     => array(),
171
-		);
172
-
173
-		$info['wp-plugins-active'] = array(
174
-			'label'      => __( 'Active Plugins' ),
175
-			'show_count' => true,
176
-			'fields'     => array(),
177
-		);
178
-
179
-		$info['wp-plugins-inactive'] = array(
180
-			'label'      => __( 'Inactive Plugins' ),
181
-			'show_count' => true,
182
-			'fields'     => array(),
183
-		);
184
-
185
-		$info['wp-media'] = array(
186
-			'label'  => __( 'Media Handling' ),
187
-			'fields' => array(),
188
-		);
189
-
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&#8217;s assistance.' ),
193
-			'fields'      => array(),
194
-		);
195
-
196
-		$info['wp-database'] = array(
197
-			'label'  => __( 'Database' ),
198
-			'fields' => array(),
199
-		);
200
-
201
-		// Check if WP_DEBUG_LOG is set.
202
-		$wp_debug_log_value = __( 'Disabled' );
203
-
204
-		if ( is_string( WP_DEBUG_LOG ) ) {
205
-			$wp_debug_log_value = WP_DEBUG_LOG;
206
-		} elseif ( WP_DEBUG_LOG ) {
207
-			$wp_debug_log_value = __( 'Enabled' );
208
-		}
209
-
210
-		// Check CONCATENATE_SCRIPTS.
211
-		if ( defined( 'CONCATENATE_SCRIPTS' ) ) {
212
-			$concatenate_scripts       = CONCATENATE_SCRIPTS ? __( 'Enabled' ) : __( 'Disabled' );
213
-			$concatenate_scripts_debug = CONCATENATE_SCRIPTS ? 'true' : 'false';
214
-		} else {
215
-			$concatenate_scripts       = __( 'Undefined' );
216
-			$concatenate_scripts_debug = 'undefined';
217
-		}
218
-
219
-		// Check COMPRESS_SCRIPTS.
220
-		if ( defined( 'COMPRESS_SCRIPTS' ) ) {
221
-			$compress_scripts       = COMPRESS_SCRIPTS ? __( 'Enabled' ) : __( 'Disabled' );
222
-			$compress_scripts_debug = COMPRESS_SCRIPTS ? 'true' : 'false';
223
-		} else {
224
-			$compress_scripts       = __( 'Undefined' );
225
-			$compress_scripts_debug = 'undefined';
226
-		}
227
-
228
-		// Check COMPRESS_CSS.
229
-		if ( defined( 'COMPRESS_CSS' ) ) {
230
-			$compress_css       = COMPRESS_CSS ? __( 'Enabled' ) : __( 'Disabled' );
231
-			$compress_css_debug = COMPRESS_CSS ? 'true' : 'false';
232
-		} else {
233
-			$compress_css       = __( 'Undefined' );
234
-			$compress_css_debug = 'undefined';
235
-		}
236
-
237
-		// Check WP_ENVIRONMENT_TYPE.
238
-		if ( defined( 'WP_ENVIRONMENT_TYPE' ) ) {
239
-			$wp_environment_type = WP_ENVIRONMENT_TYPE;
240
-		} else {
241
-			$wp_environment_type = __( 'Undefined' );
242
-		}
243
-
244
-		$info['wp-constants'] = array(
245
-			'label'       => __( 'WordPress Constants' ),
246
-			'description' => __( 'These settings alter where and how parts of WordPress are loaded.' ),
247
-			'fields'      => array(
248
-				'ABSPATH'             => array(
249
-					'label'   => 'ABSPATH',
250
-					'value'   => ABSPATH,
251
-					'private' => true,
252
-				),
253
-				'WP_HOME'             => array(
254
-					'label' => 'WP_HOME',
255
-					'value' => ( defined( 'WP_HOME' ) ? WP_HOME : __( 'Undefined' ) ),
256
-					'debug' => ( defined( 'WP_HOME' ) ? WP_HOME : 'undefined' ),
257
-				),
258
-				'WP_SITEURL'          => array(
259
-					'label' => 'WP_SITEURL',
260
-					'value' => ( defined( 'WP_SITEURL' ) ? WP_SITEURL : __( 'Undefined' ) ),
261
-					'debug' => ( defined( 'WP_SITEURL' ) ? WP_SITEURL : 'undefined' ),
262
-				),
263
-				'WP_CONTENT_DIR'      => array(
264
-					'label' => 'WP_CONTENT_DIR',
265
-					'value' => WP_CONTENT_DIR,
266
-				),
267
-				'WP_PLUGIN_DIR'       => array(
268
-					'label' => 'WP_PLUGIN_DIR',
269
-					'value' => WP_PLUGIN_DIR,
270
-				),
271
-				'WP_MEMORY_LIMIT'     => array(
272
-					'label' => 'WP_MEMORY_LIMIT',
273
-					'value' => WP_MEMORY_LIMIT,
274
-				),
275
-				'WP_MAX_MEMORY_LIMIT' => array(
276
-					'label' => 'WP_MAX_MEMORY_LIMIT',
277
-					'value' => WP_MAX_MEMORY_LIMIT,
278
-				),
279
-				'WP_DEBUG'            => array(
280
-					'label' => 'WP_DEBUG',
281
-					'value' => WP_DEBUG ? __( 'Enabled' ) : __( 'Disabled' ),
282
-					'debug' => WP_DEBUG,
283
-				),
284
-				'WP_DEBUG_DISPLAY'    => array(
285
-					'label' => 'WP_DEBUG_DISPLAY',
286
-					'value' => WP_DEBUG_DISPLAY ? __( 'Enabled' ) : __( 'Disabled' ),
287
-					'debug' => WP_DEBUG_DISPLAY,
288
-				),
289
-				'WP_DEBUG_LOG'        => array(
290
-					'label' => 'WP_DEBUG_LOG',
291
-					'value' => $wp_debug_log_value,
292
-					'debug' => WP_DEBUG_LOG,
293
-				),
294
-				'SCRIPT_DEBUG'        => array(
295
-					'label' => 'SCRIPT_DEBUG',
296
-					'value' => SCRIPT_DEBUG ? __( 'Enabled' ) : __( 'Disabled' ),
297
-					'debug' => SCRIPT_DEBUG,
298
-				),
299
-				'WP_CACHE'            => array(
300
-					'label' => 'WP_CACHE',
301
-					'value' => WP_CACHE ? __( 'Enabled' ) : __( 'Disabled' ),
302
-					'debug' => WP_CACHE,
303
-				),
304
-				'CONCATENATE_SCRIPTS' => array(
305
-					'label' => 'CONCATENATE_SCRIPTS',
306
-					'value' => $concatenate_scripts,
307
-					'debug' => $concatenate_scripts_debug,
308
-				),
309
-				'COMPRESS_SCRIPTS'    => array(
310
-					'label' => 'COMPRESS_SCRIPTS',
311
-					'value' => $compress_scripts,
312
-					'debug' => $compress_scripts_debug,
313
-				),
314
-				'COMPRESS_CSS'        => array(
315
-					'label' => 'COMPRESS_CSS',
316
-					'value' => $compress_css,
317
-					'debug' => $compress_css_debug,
318
-				),
319
-				'WP_ENVIRONMENT_TYPE' => array(
320
-					'label' => 'WP_ENVIRONMENT_TYPE',
321
-					'value' => $wp_environment_type,
322
-					'debug' => $wp_environment_type,
323
-				),
324
-				'DB_CHARSET'          => array(
325
-					'label' => 'DB_CHARSET',
326
-					'value' => ( defined( 'DB_CHARSET' ) ? DB_CHARSET : __( 'Undefined' ) ),
327
-					'debug' => ( defined( 'DB_CHARSET' ) ? DB_CHARSET : 'undefined' ),
328
-				),
329
-				'DB_COLLATE'          => array(
330
-					'label' => 'DB_COLLATE',
331
-					'value' => ( defined( 'DB_COLLATE' ) ? DB_COLLATE : __( 'Undefined' ) ),
332
-					'debug' => ( defined( 'DB_COLLATE' ) ? DB_COLLATE : 'undefined' ),
333
-				),
334
-			),
335
-		);
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() ) );
342
-
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.' ),
346
-			'fields'      => array(
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' ),
351
-				),
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' ),
356
-				),
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' ),
361
-				),
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' ),
366
-				),
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' ),
371
-				),
372
-			),
373
-		);
374
-
375
-		// Conditionally add debug information for multisite setups.
376
-		if ( is_multisite() ) {
377
-			$network_query = new WP_Network_Query();
378
-			$network_ids   = $network_query->query(
379
-				array(
380
-					'fields'        => 'ids',
381
-					'number'        => 100,
382
-					'no_found_rows' => false,
383
-				)
384
-			);
385
-
386
-			$site_count = 0;
387
-			foreach ( $network_ids as $network_id ) {
388
-				$site_count += get_blog_count( $network_id );
389
-			}
390
-
391
-			$info['wp-core']['fields']['site_count'] = array(
392
-				'label' => __( 'Site count' ),
393
-				'value' => $site_count,
394
-			);
395
-
396
-			$info['wp-core']['fields']['network_count'] = array(
397
-				'label' => __( 'Network count' ),
398
-				'value' => $network_query->found_networks,
399
-			);
400
-		}
401
-
402
-		$info['wp-core']['fields']['user_count'] = array(
403
-			'label' => __( 'User count' ),
404
-			'value' => get_user_count(),
405
-		);
406
-
407
-		// WordPress features requiring processing.
408
-		$wp_dotorg = wp_remote_get( 'https://wordpress.org', array( 'timeout' => 10 ) );
409
-
410
-		if ( ! is_wp_error( $wp_dotorg ) ) {
411
-			$info['wp-core']['fields']['dotorg_communication'] = array(
412
-				'label' => __( 'Communication with WordPress.org' ),
413
-				'value' => __( 'WordPress.org is reachable' ),
414
-				'debug' => 'true',
415
-			);
416
-		} else {
417
-			$info['wp-core']['fields']['dotorg_communication'] = array(
418
-				'label' => __( 'Communication with WordPress.org' ),
419
-				'value' => sprintf(
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' ),
423
-					$wp_dotorg->get_error_message()
424
-				),
425
-				'debug' => $wp_dotorg->get_error_message(),
426
-			);
427
-		}
428
-
429
-		// Remove accordion for Directories and Sizes if in Multisite.
430
-		if ( ! $is_multisite ) {
431
-			$loading = __( 'Loading&hellip;' );
432
-
433
-			$info['wp-paths-sizes']['fields'] = array(
434
-				'wordpress_path' => array(
435
-					'label' => __( 'WordPress directory location' ),
436
-					'value' => untrailingslashit( ABSPATH ),
437
-				),
438
-				'wordpress_size' => array(
439
-					'label' => __( 'WordPress directory size' ),
440
-					'value' => $loading,
441
-					'debug' => 'loading...',
442
-				),
443
-				'uploads_path'   => array(
444
-					'label' => __( 'Uploads directory location' ),
445
-					'value' => $upload_dir['basedir'],
446
-				),
447
-				'uploads_size'   => array(
448
-					'label' => __( 'Uploads directory size' ),
449
-					'value' => $loading,
450
-					'debug' => 'loading...',
451
-				),
452
-				'themes_path'    => array(
453
-					'label' => __( 'Themes directory location' ),
454
-					'value' => get_theme_root(),
455
-				),
456
-				'themes_size'    => array(
457
-					'label' => __( 'Themes directory size' ),
458
-					'value' => $loading,
459
-					'debug' => 'loading...',
460
-				),
461
-				'plugins_path'   => array(
462
-					'label' => __( 'Plugins directory location' ),
463
-					'value' => WP_PLUGIN_DIR,
464
-				),
465
-				'plugins_size'   => array(
466
-					'label' => __( 'Plugins directory size' ),
467
-					'value' => $loading,
468
-					'debug' => 'loading...',
469
-				),
470
-				'database_size'  => array(
471
-					'label' => __( 'Database size' ),
472
-					'value' => $loading,
473
-					'debug' => 'loading...',
474
-				),
475
-				'total_size'     => array(
476
-					'label' => __( 'Total installation size' ),
477
-					'value' => $loading,
478
-					'debug' => 'loading...',
479
-				),
480
-			);
481
-		}
482
-
483
-		// Get a list of all drop-in replacements.
484
-		$dropins = get_dropins();
485
-
486
-		// Get dropins descriptions.
487
-		$dropin_descriptions = _get_dropins();
488
-
489
-		// Spare few function calls.
490
-		$not_available = __( 'Not available' );
491
-
492
-		foreach ( $dropins as $dropin_key => $dropin ) {
493
-			$info['wp-dropins']['fields'][ sanitize_text_field( $dropin_key ) ] = array(
494
-				'label' => $dropin_key,
495
-				'value' => $dropin_descriptions[ $dropin_key ][0],
496
-				'debug' => 'true',
497
-			);
498
-		}
499
-
500
-		// Populate the media fields.
501
-		$info['wp-media']['fields']['image_editor'] = array(
502
-			'label' => __( 'Active editor' ),
503
-			'value' => _wp_image_editor_choose(),
504
-		);
505
-
506
-		// Get ImageMagic information, if available.
507
-		if ( class_exists( 'Imagick' ) ) {
508
-			// Save the Imagick instance for later use.
509
-			$imagick             = new Imagick();
510
-			$imagemagick_version = $imagick->getVersion();
511
-		} else {
512
-			$imagemagick_version = __( 'Not available' );
513
-		}
514
-
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 ),
518
-		);
519
-
520
-		$info['wp-media']['fields']['imagemagick_version'] = array(
521
-			'label' => __( 'ImageMagick version string' ),
522
-			'value' => ( is_array( $imagemagick_version ) ? $imagemagick_version['versionString'] : $imagemagick_version ),
523
-		);
524
-
525
-		$imagick_version = phpversion( 'imagick' );
526
-
527
-		$info['wp-media']['fields']['imagick_version'] = array(
528
-			'label' => __( 'Imagick version' ),
529
-			'value' => ( $imagick_version ) ? $imagick_version : __( 'Not available' ),
530
-		);
531
-
532
-		if ( ! function_exists( 'ini_get' ) ) {
533
-			$info['wp-media']['fields']['ini_get'] = array(
534
-				'label' => __( 'File upload settings' ),
535
-				'value' => sprintf(
536
-					/* translators: %s: ini_get() */
537
-					__( 'Unable to determine some settings, as the %s function has been disabled.' ),
538
-					'ini_get()'
539
-				),
540
-				'debug' => 'ini_get() is disabled',
541
-			);
542
-		} else {
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 ) );
548
-
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' ),
553
-				'debug' => 'File uploads is turned off',
554
-			);
555
-			$info['wp-media']['fields']['post_max_size']       = array(
556
-				'label' => __( 'Max size of post data allowed' ),
557
-				'value' => $post_max_size,
558
-			);
559
-			$info['wp-media']['fields']['upload_max_filesize'] = array(
560
-				'label' => __( 'Max size of an uploaded file' ),
561
-				'value' => $upload_max_filesize,
562
-			);
563
-			$info['wp-media']['fields']['max_effective_size']  = array(
564
-				'label' => __( 'Max effective file size' ),
565
-				'value' => size_format( $effective ),
566
-			);
567
-			$info['wp-media']['fields']['max_file_uploads']    = array(
568
-				'label' => __( 'Max number of files allowed' ),
569
-				'value' => number_format( $max_file_uploads ),
570
-			);
571
-		}
572
-
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 ) {
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 ),
582
-			);
583
-
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' ),
591
-			);
592
-
593
-			$info['wp-media']['fields']['imagick_limits'] = array(
594
-				'label' => __( 'Imagick Resource Limits' ),
595
-				'value' => $limits,
596
-				'debug' => $limits_debug,
597
-			);
598
-
599
-			try {
600
-				$formats = Imagick::queryFormats( '*' );
601
-			} catch ( Exception $e ) {
602
-				$formats = array();
603
-			}
604
-
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 ),
609
-			);
610
-		}
611
-
612
-		// Get GD information, if available.
613
-		if ( function_exists( 'gd_info' ) ) {
614
-			$gd = gd_info();
615
-		} else {
616
-			$gd = false;
617
-		}
618
-
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' ),
623
-		);
624
-
625
-		$gd_image_formats     = array();
626
-		$gd_supported_formats = array(
627
-			'GIF Create' => 'GIF',
628
-			'JPEG'       => 'JPEG',
629
-			'PNG'        => 'PNG',
630
-			'WebP'       => 'WebP',
631
-			'BMP'        => 'BMP',
632
-			'AVIF'       => 'AVIF',
633
-			'HEIF'       => 'HEIF',
634
-			'TIFF'       => 'TIFF',
635
-			'XPM'        => 'XPM',
636
-		);
637
-
638
-		foreach ( $gd_supported_formats as $format_key => $format ) {
639
-			$index = $format_key . ' Support';
640
-			if ( isset( $gd[ $index ] ) && $gd[ $index ] ) {
641
-				array_push( $gd_image_formats, $format );
642
-			}
643
-		}
644
-
645
-		if ( ! empty( $gd_image_formats ) ) {
646
-			$info['wp-media']['fields']['gd_formats'] = array(
647
-				'label' => __( 'GD supported file formats' ),
648
-				'value' => implode( ', ', $gd_image_formats ),
649
-			);
650
-		}
651
-
652
-		// Get Ghostscript information, if available.
653
-		if ( function_exists( 'exec' ) ) {
654
-			$gs = exec( 'gs --version' );
655
-
656
-			if ( empty( $gs ) ) {
657
-				$gs       = $not_available;
658
-				$gs_debug = 'not available';
659
-			} else {
660
-				$gs_debug = $gs;
661
-			}
662
-		} else {
663
-			$gs       = __( 'Unable to determine if Ghostscript is installed' );
664
-			$gs_debug = 'unknown';
665
-		}
666
-
667
-		$info['wp-media']['fields']['ghostscript_version'] = array(
668
-			'label' => __( 'Ghostscript version' ),
669
-			'value' => $gs,
670
-			'debug' => $gs_debug,
671
-		);
672
-
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' ) );
676
-		} else {
677
-			$server_architecture = 'unknown';
678
-		}
679
-
680
-		if ( function_exists( 'phpversion' ) ) {
681
-			$php_version_debug = phpversion();
682
-			// Whether PHP supports 64-bit.
683
-			$php64bit = ( PHP_INT_SIZE * 8 === 64 );
684
-
685
-			$php_version = sprintf(
686
-				'%s %s',
687
-				$php_version_debug,
688
-				( $php64bit ? __( '(Supports 64bit values)' ) : __( '(Does not support 64bit values)' ) )
689
-			);
690
-
691
-			if ( $php64bit ) {
692
-				$php_version_debug .= ' 64bit';
693
-			}
694
-		} else {
695
-			$php_version       = __( 'Unable to determine PHP version' );
696
-			$php_version_debug = 'unknown';
697
-		}
698
-
699
-		if ( function_exists( 'php_sapi_name' ) ) {
700
-			$php_sapi = php_sapi_name();
701
-		} else {
702
-			$php_sapi = 'unknown';
703
-		}
704
-
705
-		$info['wp-server']['fields']['server_architecture'] = array(
706
-			'label' => __( 'Server architecture' ),
707
-			'value' => ( 'unknown' !== $server_architecture ? $server_architecture : __( 'Unable to determine server architecture' ) ),
708
-			'debug' => $server_architecture,
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' ),
714
-		);
715
-		$info['wp-server']['fields']['php_version']         = array(
716
-			'label' => __( 'PHP version' ),
717
-			'value' => $php_version,
718
-			'debug' => $php_version_debug,
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' ) ),
723
-			'debug' => $php_sapi,
724
-		);
725
-
726
-		// Some servers disable `ini_set()` and `ini_get()`, we check this before trying to get configuration values.
727
-		if ( ! function_exists( 'ini_get' ) ) {
728
-			$info['wp-server']['fields']['ini_get'] = array(
729
-				'label' => __( 'Server settings' ),
730
-				'value' => sprintf(
731
-					/* translators: %s: ini_get() */
732
-					__( 'Unable to determine some settings, as the %s function has been disabled.' ),
733
-					'ini_get()'
734
-				),
735
-				'debug' => 'ini_get() is disabled',
736
-			);
737
-		} else {
738
-			$info['wp-server']['fields']['max_input_variables'] = array(
739
-				'label' => __( 'PHP max input variables' ),
740
-				'value' => ini_get( 'max_input_vars' ),
741
-			);
742
-			$info['wp-server']['fields']['time_limit']          = array(
743
-				'label' => __( 'PHP time limit' ),
744
-				'value' => ini_get( 'max_execution_time' ),
745
-			);
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' ),
750
-					'value' => WP_Site_Health::get_instance()->php_memory_limit,
751
-				);
752
-				$info['wp-server']['fields']['admin_memory_limit'] = array(
753
-					'label' => __( 'PHP memory limit (only for admin screens)' ),
754
-					'value' => ini_get( 'memory_limit' ),
755
-				);
756
-			} else {
757
-				$info['wp-server']['fields']['memory_limit'] = array(
758
-					'label' => __( 'PHP memory limit' ),
759
-					'value' => ini_get( 'memory_limit' ),
760
-				);
761
-			}
762
-
763
-			$info['wp-server']['fields']['max_input_time']      = array(
764
-				'label' => __( 'Max input time' ),
765
-				'value' => ini_get( 'max_input_time' ),
766
-			);
767
-			$info['wp-server']['fields']['upload_max_filesize'] = array(
768
-				'label' => __( 'Upload max filesize' ),
769
-				'value' => ini_get( 'upload_max_filesize' ),
770
-			);
771
-			$info['wp-server']['fields']['php_post_max_size']   = array(
772
-				'label' => __( 'PHP post max size' ),
773
-				'value' => ini_get( 'post_max_size' ),
774
-			);
775
-		}
776
-
777
-		if ( function_exists( 'curl_version' ) ) {
778
-			$curl = curl_version();
779
-
780
-			$info['wp-server']['fields']['curl_version'] = array(
781
-				'label' => __( 'cURL version' ),
782
-				'value' => sprintf( '%s %s', $curl['version'], $curl['ssl_version'] ),
783
-			);
784
-		} else {
785
-			$info['wp-server']['fields']['curl_version'] = array(
786
-				'label' => __( 'cURL version' ),
787
-				'value' => $not_available,
788
-				'debug' => 'not available',
789
-			);
790
-		}
791
-
792
-		// SUHOSIN.
793
-		$suhosin_loaded = ( extension_loaded( 'suhosin' ) || ( defined( 'SUHOSIN_PATCH' ) && constant( 'SUHOSIN_PATCH' ) ) );
794
-
795
-		$info['wp-server']['fields']['suhosin'] = array(
796
-			'label' => __( 'Is SUHOSIN installed?' ),
797
-			'value' => ( $suhosin_loaded ? __( 'Yes' ) : __( 'No' ) ),
798
-			'debug' => $suhosin_loaded,
799
-		);
800
-
801
-		// Imagick.
802
-		$imagick_loaded = extension_loaded( 'imagick' );
803
-
804
-		$info['wp-server']['fields']['imagick_availability'] = array(
805
-			'label' => __( 'Is the Imagick library available?' ),
806
-			'value' => ( $imagick_loaded ? __( 'Yes' ) : __( 'No' ) ),
807
-			'debug' => $imagick_loaded,
808
-		);
809
-
810
-		// Pretty permalinks.
811
-		$pretty_permalinks_supported = got_url_rewrite();
812
-
813
-		$info['wp-server']['fields']['pretty_permalinks'] = array(
814
-			'label' => __( 'Are pretty permalinks supported?' ),
815
-			'value' => ( $pretty_permalinks_supported ? __( 'Yes' ) : __( 'No' ) ),
816
-			'debug' => $pretty_permalinks_supported,
817
-		);
818
-
819
-		// Check if a .htaccess file exists.
820
-		if ( is_file( ABSPATH . '.htaccess' ) ) {
821
-			// If the file exists, grab the content of it.
822
-			$htaccess_content = file_get_contents( ABSPATH . '.htaccess' );
823
-
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 );
827
-
828
-			if ( $filtered_htaccess_content ) {
829
-				/* translators: %s: .htaccess */
830
-				$htaccess_rules_string = sprintf( __( 'Custom rules have been added to your %s file.' ), '.htaccess' );
831
-			} else {
832
-				/* translators: %s: .htaccess */
833
-				$htaccess_rules_string = sprintf( __( 'Your %s file contains only core WordPress features.' ), '.htaccess' );
834
-			}
835
-
836
-			$info['wp-server']['fields']['htaccess_extra_rules'] = array(
837
-				'label' => __( '.htaccess rules' ),
838
-				'value' => $htaccess_rules_string,
839
-				'debug' => $filtered_htaccess_content,
840
-			);
841
-		}
842
-
843
-		// Populate the database debug fields.
844
-		if ( is_resource( $wpdb->dbh ) ) {
845
-			// Old mysql extension.
846
-			$extension = 'mysql';
847
-		} elseif ( is_object( $wpdb->dbh ) ) {
848
-			// mysqli or PDO.
849
-			$extension = get_class( $wpdb->dbh );
850
-		} else {
851
-			// Unknown sql extension.
852
-			$extension = null;
853
-		}
854
-
855
-		$server = $wpdb->get_var( 'SELECT VERSION()' );
856
-
857
-		if ( isset( $wpdb->use_mysqli ) && $wpdb->use_mysqli ) {
858
-			$client_version = $wpdb->dbh->client_info;
859
-		} else {
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 ) ) {
862
-				$client_version = $matches[0];
863
-			} else {
864
-				$client_version = null;
865
-			}
866
-		}
867
-
868
-		$info['wp-database']['fields']['extension'] = array(
869
-			'label' => __( 'Extension' ),
870
-			'value' => $extension,
871
-		);
872
-
873
-		$info['wp-database']['fields']['server_version'] = array(
874
-			'label' => __( 'Server version' ),
875
-			'value' => $server,
876
-		);
877
-
878
-		$info['wp-database']['fields']['client_version'] = array(
879
-			'label' => __( 'Client version' ),
880
-			'value' => $client_version,
881
-		);
882
-
883
-		$info['wp-database']['fields']['database_user'] = array(
884
-			'label'   => __( 'Database username' ),
885
-			'value'   => $wpdb->dbuser,
886
-			'private' => true,
887
-		);
888
-
889
-		$info['wp-database']['fields']['database_host'] = array(
890
-			'label'   => __( 'Database host' ),
891
-			'value'   => $wpdb->dbhost,
892
-			'private' => true,
893
-		);
894
-
895
-		$info['wp-database']['fields']['database_name'] = array(
896
-			'label'   => __( 'Database name' ),
897
-			'value'   => $wpdb->dbname,
898
-			'private' => true,
899
-		);
900
-
901
-		$info['wp-database']['fields']['database_prefix'] = array(
902
-			'label'   => __( 'Table prefix' ),
903
-			'value'   => $wpdb->prefix,
904
-			'private' => true,
905
-		);
906
-
907
-		$info['wp-database']['fields']['database_charset'] = array(
908
-			'label'   => __( 'Database charset' ),
909
-			'value'   => $wpdb->charset,
910
-			'private' => true,
911
-		);
912
-
913
-		$info['wp-database']['fields']['database_collate'] = array(
914
-			'label'   => __( 'Database collation' ),
915
-			'value'   => $wpdb->collate,
916
-			'private' => true,
917
-		);
918
-
919
-		$info['wp-database']['fields']['max_allowed_packet'] = array(
920
-			'label' => __( 'Max allowed packet size' ),
921
-			'value' => self::get_mysql_var( 'max_allowed_packet' ),
922
-		);
923
-
924
-		$info['wp-database']['fields']['max_connections'] = array(
925
-			'label' => __( 'Max connections number' ),
926
-			'value' => self::get_mysql_var( 'max_connections' ),
927
-		);
928
-
929
-		// List must use plugins if there are any.
930
-		$mu_plugins = get_mu_plugins();
931
-
932
-		foreach ( $mu_plugins as $plugin_path => $plugin ) {
933
-			$plugin_version = $plugin['Version'];
934
-			$plugin_author  = $plugin['Author'];
935
-
936
-			$plugin_version_string       = __( 'No version or author information is available.' );
937
-			$plugin_version_string_debug = 'author: (undefined), version: (undefined)';
938
-
939
-			if ( ! empty( $plugin_version ) && ! empty( $plugin_author ) ) {
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 );
943
-			} else {
944
-				if ( ! empty( $plugin_author ) ) {
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 );
948
-				}
949
-
950
-				if ( ! empty( $plugin_version ) ) {
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 );
954
-				}
955
-			}
956
-
957
-			$info['wp-mu-plugins']['fields'][ sanitize_text_field( $plugin['Name'] ) ] = array(
958
-				'label' => $plugin['Name'],
959
-				'value' => $plugin_version_string,
960
-				'debug' => $plugin_version_string_debug,
961
-			);
962
-		}
963
-
964
-		// List all available plugins.
965
-		$plugins        = get_plugins();
966
-		$plugin_updates = get_plugin_updates();
967
-		$transient      = get_site_transient( 'update_plugins' );
968
-
969
-		$auto_updates = array();
970
-
971
-		$auto_updates_enabled = wp_is_auto_update_enabled_for_type( 'plugin' );
972
-
973
-		if ( $auto_updates_enabled ) {
974
-			$auto_updates = (array) get_site_option( 'auto_update_plugins', array() );
975
-		}
976
-
977
-		foreach ( $plugins as $plugin_path => $plugin ) {
978
-			$plugin_part = ( is_plugin_active( $plugin_path ) ) ? 'wp-plugins-active' : 'wp-plugins-inactive';
979
-
980
-			$plugin_version = $plugin['Version'];
981
-			$plugin_author  = $plugin['Author'];
982
-
983
-			$plugin_version_string       = __( 'No version or author information is available.' );
984
-			$plugin_version_string_debug = 'author: (undefined), version: (undefined)';
985
-
986
-			if ( ! empty( $plugin_version ) && ! empty( $plugin_author ) ) {
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 );
990
-			} else {
991
-				if ( ! empty( $plugin_author ) ) {
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 );
995
-				}
996
-
997
-				if ( ! empty( $plugin_version ) ) {
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 );
1001
-				}
1002
-			}
1003
-
1004
-			if ( array_key_exists( $plugin_path, $plugin_updates ) ) {
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 );
1008
-			}
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 ];
1015
-				} else {
1016
-					$item = array(
1017
-						'id'            => $plugin_path,
1018
-						'slug'          => '',
1019
-						'plugin'        => $plugin_path,
1020
-						'new_version'   => '',
1021
-						'url'           => '',
1022
-						'package'       => '',
1023
-						'icons'         => array(),
1024
-						'banners'       => array(),
1025
-						'banners_rtl'   => array(),
1026
-						'tested'        => '',
1027
-						'requires_php'  => '',
1028
-						'compatibility' => new stdClass(),
1029
-					);
1030
-					$item = wp_parse_args( $plugin, $item );
1031
-				}
1032
-
1033
-				$auto_update_forced = wp_is_auto_update_forced_for_item( 'plugin', null, (object) $item );
1034
-
1035
-				if ( ! is_null( $auto_update_forced ) ) {
1036
-					$enabled = $auto_update_forced;
1037
-				} else {
1038
-					$enabled = in_array( $plugin_path, $auto_updates, true );
1039
-				}
1040
-
1041
-				if ( $enabled ) {
1042
-					$auto_updates_string = __( 'Auto-updates enabled' );
1043
-				} else {
1044
-					$auto_updates_string = __( 'Auto-updates disabled' );
1045
-				}
1046
-
1047
-				/**
1048
-				 * Filters the text string of the auto-updates setting for each plugin in the Site Health debug data.
1049
-				 *
1050
-				 * @since 5.5.0
1051
-				 *
1052
-				 * @param string $auto_updates_string The string output for the auto-updates column.
1053
-				 * @param string $plugin_path         The path to the plugin file.
1054
-				 * @param array  $plugin              An array of plugin data.
1055
-				 * @param bool   $enabled             Whether auto-updates are enabled for this item.
1056
-				 */
1057
-				$auto_updates_string = apply_filters( 'plugin_auto_update_debug_string', $auto_updates_string, $plugin_path, $plugin, $enabled );
1058
-
1059
-				$plugin_version_string       .= ' | ' . $auto_updates_string;
1060
-				$plugin_version_string_debug .= ', ' . $auto_updates_string;
1061
-			}
1062
-
1063
-			$info[ $plugin_part ]['fields'][ sanitize_text_field( $plugin['Name'] ) ] = array(
1064
-				'label' => $plugin['Name'],
1065
-				'value' => $plugin_version_string,
1066
-				'debug' => $plugin_version_string_debug,
1067
-			);
1068
-		}
1069
-
1070
-		// Populate the section for the currently active theme.
1071
-		global $_wp_theme_features;
1072
-		$theme_features = array();
1073
-
1074
-		if ( ! empty( $_wp_theme_features ) ) {
1075
-			foreach ( $_wp_theme_features as $feature => $options ) {
1076
-				$theme_features[] = $feature;
1077
-			}
1078
-		}
1079
-
1080
-		$active_theme  = wp_get_theme();
1081
-		$theme_updates = get_theme_updates();
1082
-		$transient     = get_site_transient( 'update_themes' );
1083
-
1084
-		$active_theme_version       = $active_theme->version;
1085
-		$active_theme_version_debug = $active_theme_version;
1086
-
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() );
1091
-		}
1092
-
1093
-		if ( array_key_exists( $active_theme->stylesheet, $theme_updates ) ) {
1094
-			$theme_update_new_version = $theme_updates[ $active_theme->stylesheet ]->update['new_version'];
1095
-
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 );
1099
-		}
1100
-
1101
-		$active_theme_author_uri = $active_theme->display( 'AuthorURI' );
1102
-
1103
-		if ( $active_theme->parent_theme ) {
1104
-			$active_theme_parent_theme = sprintf(
1105
-				/* translators: 1: Theme name. 2: Theme slug. */
1106
-				__( '%1$s (%2$s)' ),
1107
-				$active_theme->parent_theme,
1108
-				$active_theme->template
1109
-			);
1110
-			$active_theme_parent_theme_debug = sprintf(
1111
-				'%s (%s)',
1112
-				$active_theme->parent_theme,
1113
-				$active_theme->template
1114
-			);
1115
-		} else {
1116
-			$active_theme_parent_theme       = __( 'None' );
1117
-			$active_theme_parent_theme_debug = 'none';
1118
-		}
1119
-
1120
-		$info['wp-active-theme']['fields'] = array(
1121
-			'name'           => array(
1122
-				'label' => __( 'Name' ),
1123
-				'value' => sprintf(
1124
-					/* translators: 1: Theme name. 2: Theme slug. */
1125
-					__( '%1$s (%2$s)' ),
1126
-					$active_theme->name,
1127
-					$active_theme->stylesheet
1128
-				),
1129
-			),
1130
-			'version'        => array(
1131
-				'label' => __( 'Version' ),
1132
-				'value' => $active_theme_version,
1133
-				'debug' => $active_theme_version_debug,
1134
-			),
1135
-			'author'         => array(
1136
-				'label' => __( 'Author' ),
1137
-				'value' => wp_kses( $active_theme->author, array() ),
1138
-			),
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)' ),
1143
-			),
1144
-			'parent_theme'   => array(
1145
-				'label' => __( 'Parent theme' ),
1146
-				'value' => $active_theme_parent_theme,
1147
-				'debug' => $active_theme_parent_theme_debug,
1148
-			),
1149
-			'theme_features' => array(
1150
-				'label' => __( 'Theme features' ),
1151
-				'value' => implode( ', ', $theme_features ),
1152
-			),
1153
-			'theme_path'     => array(
1154
-				'label' => __( 'Theme directory location' ),
1155
-				'value' => get_stylesheet_directory(),
1156
-			),
1157
-		);
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 ];
1164
-			} else {
1165
-				$item = array(
1166
-					'theme'        => $active_theme->stylesheet,
1167
-					'new_version'  => $active_theme->version,
1168
-					'url'          => '',
1169
-					'package'      => '',
1170
-					'requires'     => '',
1171
-					'requires_php' => '',
1172
-				);
1173
-			}
1174
-
1175
-			$auto_update_forced = wp_is_auto_update_forced_for_item( 'theme', null, (object) $item );
1176
-
1177
-			if ( ! is_null( $auto_update_forced ) ) {
1178
-				$enabled = $auto_update_forced;
1179
-			} else {
1180
-				$enabled = in_array( $active_theme->stylesheet, $auto_updates, true );
1181
-			}
1182
-
1183
-			if ( $enabled ) {
1184
-				$auto_updates_string = __( 'Enabled' );
1185
-			} else {
1186
-				$auto_updates_string = __( 'Disabled' );
1187
-			}
1188
-
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 );
1191
-
1192
-			$info['wp-active-theme']['fields']['auto_update'] = array(
1193
-				'label' => __( 'Auto-updates' ),
1194
-				'value' => $auto_updates_string,
1195
-				'debug' => $auto_updates_string,
1196
-			);
1197
-		}
1198
-
1199
-		$parent_theme = $active_theme->parent();
1200
-
1201
-		if ( $parent_theme ) {
1202
-			$parent_theme_version       = $parent_theme->version;
1203
-			$parent_theme_version_debug = $parent_theme_version;
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'];
1207
-
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 );
1211
-			}
1212
-
1213
-			$parent_theme_author_uri = $parent_theme->display( 'AuthorURI' );
1214
-
1215
-			$info['wp-parent-theme']['fields'] = array(
1216
-				'name'           => array(
1217
-					'label' => __( 'Name' ),
1218
-					'value' => sprintf(
1219
-						/* translators: 1: Theme name. 2: Theme slug. */
1220
-						__( '%1$s (%2$s)' ),
1221
-						$parent_theme->name,
1222
-						$parent_theme->stylesheet
1223
-					),
1224
-				),
1225
-				'version'        => array(
1226
-					'label' => __( 'Version' ),
1227
-					'value' => $parent_theme_version,
1228
-					'debug' => $parent_theme_version_debug,
1229
-				),
1230
-				'author'         => array(
1231
-					'label' => __( 'Author' ),
1232
-					'value' => wp_kses( $parent_theme->author, array() ),
1233
-				),
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)' ),
1238
-				),
1239
-				'theme_path'     => array(
1240
-					'label' => __( 'Theme directory location' ),
1241
-					'value' => get_template_directory(),
1242
-				),
1243
-			);
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 ];
1250
-				} else {
1251
-					$item = array(
1252
-						'theme'        => $parent_theme->stylesheet,
1253
-						'new_version'  => $parent_theme->version,
1254
-						'url'          => '',
1255
-						'package'      => '',
1256
-						'requires'     => '',
1257
-						'requires_php' => '',
1258
-					);
1259
-				}
1260
-
1261
-				$auto_update_forced = wp_is_auto_update_forced_for_item( 'theme', null, (object) $item );
1262
-
1263
-				if ( ! is_null( $auto_update_forced ) ) {
1264
-					$enabled = $auto_update_forced;
1265
-				} else {
1266
-					$enabled = in_array( $parent_theme->stylesheet, $auto_updates, true );
1267
-				}
1268
-
1269
-				if ( $enabled ) {
1270
-					$parent_theme_auto_update_string = __( 'Enabled' );
1271
-				} else {
1272
-					$parent_theme_auto_update_string = __( 'Disabled' );
1273
-				}
1274
-
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 );
1277
-
1278
-				$info['wp-parent-theme']['fields']['auto_update'] = array(
1279
-					'label' => __( 'Auto-update' ),
1280
-					'value' => $parent_theme_auto_update_string,
1281
-					'debug' => $parent_theme_auto_update_string,
1282
-				);
1283
-			}
1284
-		}
1285
-
1286
-		// Populate a list of all themes available in the install.
1287
-		$all_themes = wp_get_themes();
1288
-
1289
-		foreach ( $all_themes as $theme_slug => $theme ) {
1290
-			// Exclude the currently active theme from the list of all themes.
1291
-			if ( $active_theme->stylesheet === $theme_slug ) {
1292
-				continue;
1293
-			}
1294
-
1295
-			// Exclude the currently active parent theme from the list of all themes.
1296
-			if ( ! empty( $parent_theme ) && $parent_theme->stylesheet === $theme_slug ) {
1297
-				continue;
1298
-			}
1299
-
1300
-			$theme_version = $theme->version;
1301
-			$theme_author  = $theme->author;
1302
-
1303
-			// Sanitize.
1304
-			$theme_author = wp_kses( $theme_author, array() );
1305
-
1306
-			$theme_version_string       = __( 'No version or author information is available.' );
1307
-			$theme_version_string_debug = 'undefined';
1308
-
1309
-			if ( ! empty( $theme_version ) && ! empty( $theme_author ) ) {
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 );
1313
-			} else {
1314
-				if ( ! empty( $theme_author ) ) {
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 );
1318
-				}
1319
-
1320
-				if ( ! empty( $theme_version ) ) {
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 );
1324
-				}
1325
-			}
1326
-
1327
-			if ( array_key_exists( $theme_slug, $theme_updates ) ) {
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'] );
1331
-			}
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 ];
1338
-				} else {
1339
-					$item = array(
1340
-						'theme'        => $theme_slug,
1341
-						'new_version'  => $theme->version,
1342
-						'url'          => '',
1343
-						'package'      => '',
1344
-						'requires'     => '',
1345
-						'requires_php' => '',
1346
-					);
1347
-				}
1348
-
1349
-				$auto_update_forced = wp_is_auto_update_forced_for_item( 'theme', null, (object) $item );
1350
-
1351
-				if ( ! is_null( $auto_update_forced ) ) {
1352
-					$enabled = $auto_update_forced;
1353
-				} else {
1354
-					$enabled = in_array( $theme_slug, $auto_updates, true );
1355
-				}
1356
-
1357
-				if ( $enabled ) {
1358
-					$auto_updates_string = __( 'Auto-updates enabled' );
1359
-				} else {
1360
-					$auto_updates_string = __( 'Auto-updates disabled' );
1361
-				}
1362
-
1363
-				/**
1364
-				 * Filters the text string of the auto-updates setting for each theme in the Site Health debug data.
1365
-				 *
1366
-				 * @since 5.5.0
1367
-				 *
1368
-				 * @param string   $auto_updates_string The string output for the auto-updates column.
1369
-				 * @param WP_Theme $theme               An object of theme data.
1370
-				 * @param bool     $enabled             Whether auto-updates are enabled for this item.
1371
-				 */
1372
-				$auto_updates_string = apply_filters( 'theme_auto_update_debug_string', $auto_updates_string, $theme, $enabled );
1373
-
1374
-				$theme_version_string       .= ' | ' . $auto_updates_string;
1375
-				$theme_version_string_debug .= ', ' . $auto_updates_string;
1376
-			}
1377
-
1378
-			$info['wp-themes-inactive']['fields'][ sanitize_text_field( $theme->name ) ] = array(
1379
-				'label' => sprintf(
1380
-					/* translators: 1: Theme name. 2: Theme slug. */
1381
-					__( '%1$s (%2$s)' ),
1382
-					$theme->name,
1383
-					$theme_slug
1384
-				),
1385
-				'value' => $theme_version_string,
1386
-				'debug' => $theme_version_string_debug,
1387
-			);
1388
-		}
1389
-
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 );
1393
-
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' ),
1398
-			);
1399
-		}
1400
-
1401
-		/**
1402
-		 * Add to or modify the debug information shown on the Tools -> Site Health -> Info screen.
1403
-		 *
1404
-		 * Plugin or themes may wish to introduce their own debug information without creating
1405
-		 * additional admin pages. They can utilize this filter to introduce their own sections
1406
-		 * or add more data to existing sections.
1407
-		 *
1408
-		 * Array keys for sections added by core are all prefixed with `wp-`. Plugins and themes
1409
-		 * should use their own slug as a prefix, both for consistency as well as avoiding
1410
-		 * key collisions. Note that the array keys are used as labels for the copied data.
1411
-		 *
1412
-		 * All strings are expected to be plain text except `$description` that can contain
1413
-		 * inline HTML tags (see below).
1414
-		 *
1415
-		 * @since 5.2.0
1416
-		 *
1417
-		 * @param array $args {
1418
-		 *     The debug information to be added to the core information page.
1419
-		 *
1420
-		 *     This is an associative multi-dimensional array, up to three levels deep.
1421
-		 *     The topmost array holds the sections, keyed by section ID.
1422
-		 *
1423
-		 *     @type array ...$0 {
1424
-		 *         Each section has a `$fields` associative array (see below), and each `$value` in `$fields`
1425
-		 *         can be another associative array of name/value pairs when there is more structured data
1426
-		 *         to display.
1427
-		 *
1428
-		 *         @type string $label       Required. The title for this section of the debug output.
1429
-		 *         @type string $description Optional. A description for your information section which
1430
-		 *                                   may contain basic HTML markup, inline tags only as it is
1431
-		 *                                   outputted in a paragraph.
1432
-		 *         @type bool   $show_count  Optional. If set to `true`, the amount of fields will be included
1433
-		 *                                   in the title for this section. Default false.
1434
-		 *         @type bool   $private     Optional. If set to `true`, the section and all associated fields
1435
-		 *                                   will be excluded from the copied data. Default false.
1436
-		 *         @type array  $fields {
1437
-		 *             Required. An associative array containing the fields to be displayed in the section,
1438
-		 *             keyed by field ID.
1439
-		 *
1440
-		 *             @type array ...$0 {
1441
-		 *                 An associative array containing the data to be displayed for the field.
1442
-		 *
1443
-		 *                 @type string $label    Required. The label for this piece of information.
1444
-		 *                 @type mixed  $value    Required. The output that is displayed for this field.
1445
-		 *                                        Text should be translated. Can be an associative array
1446
-		 *                                        that is displayed as name/value pairs.
1447
-		 *                                        Accepted types: `string|int|float|(string|int|float)[]`.
1448
-		 *                 @type string $debug    Optional. The output that is used for this field when
1449
-		 *                                        the user copies the data. It should be more concise and
1450
-		 *                                        not translated. If not set, the content of `$value`
1451
-		 *                                        is used. Note that the array keys are used as labels
1452
-		 *                                        for the copied data.
1453
-		 *                 @type bool   $private  Optional. If set to `true`, the field will be excluded
1454
-		 *                                        from the copied data, allowing you to show, for example,
1455
-		 *                                        API keys here. Default false.
1456
-		 *             }
1457
-		 *         }
1458
-		 *     }
1459
-		 * }
1460
-		 */
1461
-		$info = apply_filters( 'debug_information', $info );
1462
-
1463
-		return $info;
1464
-	}
1465
-
1466
-	/**
1467
-	 * Returns the value of a MySQL system variable.
1468
-	 *
1469
-	 * @since 5.9.0
1470
-	 *
1471
-	 * @global wpdb $wpdb WordPress database abstraction object.
1472
-	 *
1473
-	 * @param string $mysql_var Name of the MySQL system variable.
1474
-	 * @return string|null The variable value on success. Null if the variable does not exist.
1475
-	 */
1476
-	public static function get_mysql_var( $mysql_var ) {
1477
-		global $wpdb;
1478
-
1479
-		$result = $wpdb->get_row(
1480
-			$wpdb->prepare( 'SHOW VARIABLES LIKE %s', $mysql_var ),
1481
-			ARRAY_A
1482
-		);
1483
-
1484
-		if ( ! empty( $result ) && array_key_exists( 'Value', $result ) ) {
1485
-			return $result['Value'];
1486
-		}
1487
-
1488
-		return null;
1489
-	}
1490
-
1491
-	/**
1492
-	 * Format the information gathered for debugging, in a manner suitable for copying to a forum or support ticket.
1493
-	 *
1494
-	 * @since 5.2.0
1495
-	 *
1496
-	 * @param array  $info_array Information gathered from the `WP_Debug_Data::debug_data()` function.
1497
-	 * @param string $data_type  The data type to return, either 'info' or 'debug'.
1498
-	 * @return string The formatted data.
1499
-	 */
1500
-	public static function format( $info_array, $data_type ) {
1501
-		$return = "`\n";
1502
-
1503
-		foreach ( $info_array as $section => $details ) {
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'] ) ) {
1506
-				continue;
1507
-			}
1508
-
1509
-			$section_label = 'debug' === $data_type ? $section : $details['label'];
1510
-
1511
-			$return .= sprintf(
1512
-				"### %s%s ###\n\n",
1513
-				$section_label,
1514
-				( isset( $details['show_count'] ) && $details['show_count'] ? sprintf( ' (%d)', count( $details['fields'] ) ) : '' )
1515
-			);
1516
-
1517
-			foreach ( $details['fields'] as $field_name => $field ) {
1518
-				if ( isset( $field['private'] ) && true === $field['private'] ) {
1519
-					continue;
1520
-				}
1521
-
1522
-				if ( 'debug' === $data_type && isset( $field['debug'] ) ) {
1523
-					$debug_data = $field['debug'];
1524
-				} else {
1525
-					$debug_data = $field['value'];
1526
-				}
1527
-
1528
-				// Can be array, one level deep only.
1529
-				if ( is_array( $debug_data ) ) {
1530
-					$value = '';
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 );
1534
-					}
1535
-				} elseif ( is_bool( $debug_data ) ) {
1536
-					$value = $debug_data ? 'true' : 'false';
1537
-				} elseif ( empty( $debug_data ) && '0' !== $debug_data ) {
1538
-					$value = 'undefined';
1539
-				} else {
1540
-					$value = $debug_data;
1541
-				}
1542
-
1543
-				if ( 'debug' === $data_type ) {
1544
-					$label = $field_name;
1545
-				} else {
1546
-					$label = $field['label'];
1547
-				}
1548
-
1549
-				$return .= sprintf( "%s: %s\n", $label, $value );
1550
-			}
1551
-
1552
-			$return .= "\n";
1553
-		}
1554
-
1555
-		$return .= '`';
1556
-
1557
-		return $return;
1558
-	}
1559
-
1560
-	/**
1561
-	 * Fetch the total size of all the database tables for the active database user.
1562
-	 *
1563
-	 * @since 5.2.0
1564
-	 *
1565
-	 * @return int The size of the database, in bytes.
1566
-	 */
1567
-	public static function get_database_size() {
1568
-		global $wpdb;
1569
-		$size = 0;
1570
-		$rows = $wpdb->get_results( 'SHOW TABLE STATUS', ARRAY_A );
1571
-
1572
-		if ( $wpdb->num_rows > 0 ) {
1573
-			foreach ( $rows as $row ) {
1574
-				$size += $row['Data_length'] + $row['Index_length'];
1575
-			}
1576
-		}
1577
-
1578
-		return (int) $size;
1579
-	}
1580
-
1581
-	/**
1582
-	 * Fetch the sizes of the WordPress directories: `wordpress` (ABSPATH), `plugins`, `themes`, and `uploads`.
1583
-	 * Intended to supplement the array returned by `WP_Debug_Data::debug_data()`.
1584
-	 *
1585
-	 * @since 5.2.0
1586
-	 *
1587
-	 * @return array The sizes of the directories, also the database size and total installation size.
1588
-	 */
1589
-	public static function get_sizes() {
1590
-		$size_db    = self::get_database_size();
1591
-		$upload_dir = wp_get_upload_dir();
1592
-
1593
-		/*
11
+    /**
12
+     * Calls all core functions to check for updates.
13
+     *
14
+     * @since 5.2.0
15
+     */
16
+    public static function check_for_updates() {
17
+        wp_version_check();
18
+        wp_update_plugins();
19
+        wp_update_themes();
20
+    }
21
+
22
+    /**
23
+     * Static function for generating site debug data when required.
24
+     *
25
+     * @since 5.2.0
26
+     * @since 5.3.0 Added database charset, database collation,
27
+     *              and timezone information.
28
+     * @since 5.5.0 Added pretty permalinks support information.
29
+     *
30
+     * @throws ImagickException
31
+     * @global wpdb $wpdb WordPress database abstraction object.
32
+     *
33
+     * @return array The debug data for the site.
34
+     */
35
+    public static function debug_data() {
36
+        global $wpdb;
37
+
38
+        // Save few function calls.
39
+        $upload_dir             = wp_upload_dir();
40
+        $permalink_structure    = get_option( 'permalink_structure' );
41
+        $is_ssl                 = is_ssl();
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' );
46
+        $environment_type       = wp_get_environment_type();
47
+        $core_version           = get_bloginfo( 'version' );
48
+        $core_updates           = get_core_updates();
49
+        $core_update_needed     = '';
50
+
51
+        if ( is_array( $core_updates ) ) {
52
+            foreach ( $core_updates as $core => $update ) {
53
+                if ( 'upgrade' === $update->response ) {
54
+                    /* translators: %s: Latest WordPress version number. */
55
+                    $core_update_needed = ' ' . sprintf( __( '(Latest version: %s)' ), $update->version );
56
+                } else {
57
+                    $core_update_needed = '';
58
+                }
59
+            }
60
+        }
61
+
62
+        // Set up the array that holds all debug information.
63
+        $info = array();
64
+
65
+        $info['wp-core'] = array(
66
+            'label'  => __( 'WordPress' ),
67
+            'fields' => array(
68
+                'version'                => array(
69
+                    'label' => __( 'Version' ),
70
+                    'value' => $core_version . $core_update_needed,
71
+                    'debug' => $core_version,
72
+                ),
73
+                'site_language'          => array(
74
+                    'label' => __( 'Site Language' ),
75
+                    'value' => get_locale(),
76
+                ),
77
+                'user_language'          => array(
78
+                    'label' => __( 'User Language' ),
79
+                    'value' => get_user_locale(),
80
+                ),
81
+                'timezone'               => array(
82
+                    'label' => __( 'Timezone' ),
83
+                    'value' => wp_timezone_string(),
84
+                ),
85
+                'home_url'               => array(
86
+                    'label'   => __( 'Home URL' ),
87
+                    'value'   => get_bloginfo( 'url' ),
88
+                    'private' => true,
89
+                ),
90
+                'site_url'               => array(
91
+                    'label'   => __( 'Site URL' ),
92
+                    'value'   => get_bloginfo( 'wpurl' ),
93
+                    'private' => true,
94
+                ),
95
+                'permalink'              => array(
96
+                    'label' => __( 'Permalink structure' ),
97
+                    'value' => $permalink_structure ? $permalink_structure : __( 'No permalink structure set' ),
98
+                    'debug' => $permalink_structure,
99
+                ),
100
+                'https_status'           => array(
101
+                    'label' => __( 'Is this site using HTTPS?' ),
102
+                    'value' => $is_ssl ? __( 'Yes' ) : __( 'No' ),
103
+                    'debug' => $is_ssl,
104
+                ),
105
+                'multisite'              => array(
106
+                    'label' => __( 'Is this a multisite?' ),
107
+                    'value' => $is_multisite ? __( 'Yes' ) : __( 'No' ),
108
+                    'debug' => $is_multisite,
109
+                ),
110
+                'user_registration'      => array(
111
+                    'label' => __( 'Can anyone register on this site?' ),
112
+                    'value' => $users_can_register ? __( 'Yes' ) : __( 'No' ),
113
+                    'debug' => $users_can_register,
114
+                ),
115
+                'blog_public'            => array(
116
+                    'label' => __( 'Is this site discouraging search engines?' ),
117
+                    'value' => $blog_public ? __( 'No' ) : __( 'Yes' ),
118
+                    'debug' => $blog_public,
119
+                ),
120
+                'default_comment_status' => array(
121
+                    'label' => __( 'Default comment status' ),
122
+                    'value' => 'open' === $default_comment_status ? _x( 'Open', 'comment status' ) : _x( 'Closed', 'comment status' ),
123
+                    'debug' => $default_comment_status,
124
+                ),
125
+                'environment_type'       => array(
126
+                    'label' => __( 'Environment type' ),
127
+                    'value' => $environment_type,
128
+                    'debug' => $environment_type,
129
+                ),
130
+            ),
131
+        );
132
+
133
+        if ( ! $is_multisite ) {
134
+            $info['wp-paths-sizes'] = array(
135
+                'label'  => __( 'Directories and Sizes' ),
136
+                'fields' => array(),
137
+            );
138
+        }
139
+
140
+        $info['wp-dropins'] = array(
141
+            'label'       => __( 'Drop-ins' ),
142
+            'show_count'  => true,
143
+            'description' => sprintf(
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>'
147
+            ),
148
+            'fields'      => array(),
149
+        );
150
+
151
+        $info['wp-active-theme'] = array(
152
+            'label'  => __( 'Active Theme' ),
153
+            'fields' => array(),
154
+        );
155
+
156
+        $info['wp-parent-theme'] = array(
157
+            'label'  => __( 'Parent Theme' ),
158
+            'fields' => array(),
159
+        );
160
+
161
+        $info['wp-themes-inactive'] = array(
162
+            'label'      => __( 'Inactive Themes' ),
163
+            'show_count' => true,
164
+            'fields'     => array(),
165
+        );
166
+
167
+        $info['wp-mu-plugins'] = array(
168
+            'label'      => __( 'Must Use Plugins' ),
169
+            'show_count' => true,
170
+            'fields'     => array(),
171
+        );
172
+
173
+        $info['wp-plugins-active'] = array(
174
+            'label'      => __( 'Active Plugins' ),
175
+            'show_count' => true,
176
+            'fields'     => array(),
177
+        );
178
+
179
+        $info['wp-plugins-inactive'] = array(
180
+            'label'      => __( 'Inactive Plugins' ),
181
+            'show_count' => true,
182
+            'fields'     => array(),
183
+        );
184
+
185
+        $info['wp-media'] = array(
186
+            'label'  => __( 'Media Handling' ),
187
+            'fields' => array(),
188
+        );
189
+
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&#8217;s assistance.' ),
193
+            'fields'      => array(),
194
+        );
195
+
196
+        $info['wp-database'] = array(
197
+            'label'  => __( 'Database' ),
198
+            'fields' => array(),
199
+        );
200
+
201
+        // Check if WP_DEBUG_LOG is set.
202
+        $wp_debug_log_value = __( 'Disabled' );
203
+
204
+        if ( is_string( WP_DEBUG_LOG ) ) {
205
+            $wp_debug_log_value = WP_DEBUG_LOG;
206
+        } elseif ( WP_DEBUG_LOG ) {
207
+            $wp_debug_log_value = __( 'Enabled' );
208
+        }
209
+
210
+        // Check CONCATENATE_SCRIPTS.
211
+        if ( defined( 'CONCATENATE_SCRIPTS' ) ) {
212
+            $concatenate_scripts       = CONCATENATE_SCRIPTS ? __( 'Enabled' ) : __( 'Disabled' );
213
+            $concatenate_scripts_debug = CONCATENATE_SCRIPTS ? 'true' : 'false';
214
+        } else {
215
+            $concatenate_scripts       = __( 'Undefined' );
216
+            $concatenate_scripts_debug = 'undefined';
217
+        }
218
+
219
+        // Check COMPRESS_SCRIPTS.
220
+        if ( defined( 'COMPRESS_SCRIPTS' ) ) {
221
+            $compress_scripts       = COMPRESS_SCRIPTS ? __( 'Enabled' ) : __( 'Disabled' );
222
+            $compress_scripts_debug = COMPRESS_SCRIPTS ? 'true' : 'false';
223
+        } else {
224
+            $compress_scripts       = __( 'Undefined' );
225
+            $compress_scripts_debug = 'undefined';
226
+        }
227
+
228
+        // Check COMPRESS_CSS.
229
+        if ( defined( 'COMPRESS_CSS' ) ) {
230
+            $compress_css       = COMPRESS_CSS ? __( 'Enabled' ) : __( 'Disabled' );
231
+            $compress_css_debug = COMPRESS_CSS ? 'true' : 'false';
232
+        } else {
233
+            $compress_css       = __( 'Undefined' );
234
+            $compress_css_debug = 'undefined';
235
+        }
236
+
237
+        // Check WP_ENVIRONMENT_TYPE.
238
+        if ( defined( 'WP_ENVIRONMENT_TYPE' ) ) {
239
+            $wp_environment_type = WP_ENVIRONMENT_TYPE;
240
+        } else {
241
+            $wp_environment_type = __( 'Undefined' );
242
+        }
243
+
244
+        $info['wp-constants'] = array(
245
+            'label'       => __( 'WordPress Constants' ),
246
+            'description' => __( 'These settings alter where and how parts of WordPress are loaded.' ),
247
+            'fields'      => array(
248
+                'ABSPATH'             => array(
249
+                    'label'   => 'ABSPATH',
250
+                    'value'   => ABSPATH,
251
+                    'private' => true,
252
+                ),
253
+                'WP_HOME'             => array(
254
+                    'label' => 'WP_HOME',
255
+                    'value' => ( defined( 'WP_HOME' ) ? WP_HOME : __( 'Undefined' ) ),
256
+                    'debug' => ( defined( 'WP_HOME' ) ? WP_HOME : 'undefined' ),
257
+                ),
258
+                'WP_SITEURL'          => array(
259
+                    'label' => 'WP_SITEURL',
260
+                    'value' => ( defined( 'WP_SITEURL' ) ? WP_SITEURL : __( 'Undefined' ) ),
261
+                    'debug' => ( defined( 'WP_SITEURL' ) ? WP_SITEURL : 'undefined' ),
262
+                ),
263
+                'WP_CONTENT_DIR'      => array(
264
+                    'label' => 'WP_CONTENT_DIR',
265
+                    'value' => WP_CONTENT_DIR,
266
+                ),
267
+                'WP_PLUGIN_DIR'       => array(
268
+                    'label' => 'WP_PLUGIN_DIR',
269
+                    'value' => WP_PLUGIN_DIR,
270
+                ),
271
+                'WP_MEMORY_LIMIT'     => array(
272
+                    'label' => 'WP_MEMORY_LIMIT',
273
+                    'value' => WP_MEMORY_LIMIT,
274
+                ),
275
+                'WP_MAX_MEMORY_LIMIT' => array(
276
+                    'label' => 'WP_MAX_MEMORY_LIMIT',
277
+                    'value' => WP_MAX_MEMORY_LIMIT,
278
+                ),
279
+                'WP_DEBUG'            => array(
280
+                    'label' => 'WP_DEBUG',
281
+                    'value' => WP_DEBUG ? __( 'Enabled' ) : __( 'Disabled' ),
282
+                    'debug' => WP_DEBUG,
283
+                ),
284
+                'WP_DEBUG_DISPLAY'    => array(
285
+                    'label' => 'WP_DEBUG_DISPLAY',
286
+                    'value' => WP_DEBUG_DISPLAY ? __( 'Enabled' ) : __( 'Disabled' ),
287
+                    'debug' => WP_DEBUG_DISPLAY,
288
+                ),
289
+                'WP_DEBUG_LOG'        => array(
290
+                    'label' => 'WP_DEBUG_LOG',
291
+                    'value' => $wp_debug_log_value,
292
+                    'debug' => WP_DEBUG_LOG,
293
+                ),
294
+                'SCRIPT_DEBUG'        => array(
295
+                    'label' => 'SCRIPT_DEBUG',
296
+                    'value' => SCRIPT_DEBUG ? __( 'Enabled' ) : __( 'Disabled' ),
297
+                    'debug' => SCRIPT_DEBUG,
298
+                ),
299
+                'WP_CACHE'            => array(
300
+                    'label' => 'WP_CACHE',
301
+                    'value' => WP_CACHE ? __( 'Enabled' ) : __( 'Disabled' ),
302
+                    'debug' => WP_CACHE,
303
+                ),
304
+                'CONCATENATE_SCRIPTS' => array(
305
+                    'label' => 'CONCATENATE_SCRIPTS',
306
+                    'value' => $concatenate_scripts,
307
+                    'debug' => $concatenate_scripts_debug,
308
+                ),
309
+                'COMPRESS_SCRIPTS'    => array(
310
+                    'label' => 'COMPRESS_SCRIPTS',
311
+                    'value' => $compress_scripts,
312
+                    'debug' => $compress_scripts_debug,
313
+                ),
314
+                'COMPRESS_CSS'        => array(
315
+                    'label' => 'COMPRESS_CSS',
316
+                    'value' => $compress_css,
317
+                    'debug' => $compress_css_debug,
318
+                ),
319
+                'WP_ENVIRONMENT_TYPE' => array(
320
+                    'label' => 'WP_ENVIRONMENT_TYPE',
321
+                    'value' => $wp_environment_type,
322
+                    'debug' => $wp_environment_type,
323
+                ),
324
+                'DB_CHARSET'          => array(
325
+                    'label' => 'DB_CHARSET',
326
+                    'value' => ( defined( 'DB_CHARSET' ) ? DB_CHARSET : __( 'Undefined' ) ),
327
+                    'debug' => ( defined( 'DB_CHARSET' ) ? DB_CHARSET : 'undefined' ),
328
+                ),
329
+                'DB_COLLATE'          => array(
330
+                    'label' => 'DB_COLLATE',
331
+                    'value' => ( defined( 'DB_COLLATE' ) ? DB_COLLATE : __( 'Undefined' ) ),
332
+                    'debug' => ( defined( 'DB_COLLATE' ) ? DB_COLLATE : 'undefined' ),
333
+                ),
334
+            ),
335
+        );
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() ) );
342
+
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.' ),
346
+            'fields'      => array(
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' ),
351
+                ),
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' ),
356
+                ),
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' ),
361
+                ),
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' ),
366
+                ),
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' ),
371
+                ),
372
+            ),
373
+        );
374
+
375
+        // Conditionally add debug information for multisite setups.
376
+        if ( is_multisite() ) {
377
+            $network_query = new WP_Network_Query();
378
+            $network_ids   = $network_query->query(
379
+                array(
380
+                    'fields'        => 'ids',
381
+                    'number'        => 100,
382
+                    'no_found_rows' => false,
383
+                )
384
+            );
385
+
386
+            $site_count = 0;
387
+            foreach ( $network_ids as $network_id ) {
388
+                $site_count += get_blog_count( $network_id );
389
+            }
390
+
391
+            $info['wp-core']['fields']['site_count'] = array(
392
+                'label' => __( 'Site count' ),
393
+                'value' => $site_count,
394
+            );
395
+
396
+            $info['wp-core']['fields']['network_count'] = array(
397
+                'label' => __( 'Network count' ),
398
+                'value' => $network_query->found_networks,
399
+            );
400
+        }
401
+
402
+        $info['wp-core']['fields']['user_count'] = array(
403
+            'label' => __( 'User count' ),
404
+            'value' => get_user_count(),
405
+        );
406
+
407
+        // WordPress features requiring processing.
408
+        $wp_dotorg = wp_remote_get( 'https://wordpress.org', array( 'timeout' => 10 ) );
409
+
410
+        if ( ! is_wp_error( $wp_dotorg ) ) {
411
+            $info['wp-core']['fields']['dotorg_communication'] = array(
412
+                'label' => __( 'Communication with WordPress.org' ),
413
+                'value' => __( 'WordPress.org is reachable' ),
414
+                'debug' => 'true',
415
+            );
416
+        } else {
417
+            $info['wp-core']['fields']['dotorg_communication'] = array(
418
+                'label' => __( 'Communication with WordPress.org' ),
419
+                'value' => sprintf(
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' ),
423
+                    $wp_dotorg->get_error_message()
424
+                ),
425
+                'debug' => $wp_dotorg->get_error_message(),
426
+            );
427
+        }
428
+
429
+        // Remove accordion for Directories and Sizes if in Multisite.
430
+        if ( ! $is_multisite ) {
431
+            $loading = __( 'Loading&hellip;' );
432
+
433
+            $info['wp-paths-sizes']['fields'] = array(
434
+                'wordpress_path' => array(
435
+                    'label' => __( 'WordPress directory location' ),
436
+                    'value' => untrailingslashit( ABSPATH ),
437
+                ),
438
+                'wordpress_size' => array(
439
+                    'label' => __( 'WordPress directory size' ),
440
+                    'value' => $loading,
441
+                    'debug' => 'loading...',
442
+                ),
443
+                'uploads_path'   => array(
444
+                    'label' => __( 'Uploads directory location' ),
445
+                    'value' => $upload_dir['basedir'],
446
+                ),
447
+                'uploads_size'   => array(
448
+                    'label' => __( 'Uploads directory size' ),
449
+                    'value' => $loading,
450
+                    'debug' => 'loading...',
451
+                ),
452
+                'themes_path'    => array(
453
+                    'label' => __( 'Themes directory location' ),
454
+                    'value' => get_theme_root(),
455
+                ),
456
+                'themes_size'    => array(
457
+                    'label' => __( 'Themes directory size' ),
458
+                    'value' => $loading,
459
+                    'debug' => 'loading...',
460
+                ),
461
+                'plugins_path'   => array(
462
+                    'label' => __( 'Plugins directory location' ),
463
+                    'value' => WP_PLUGIN_DIR,
464
+                ),
465
+                'plugins_size'   => array(
466
+                    'label' => __( 'Plugins directory size' ),
467
+                    'value' => $loading,
468
+                    'debug' => 'loading...',
469
+                ),
470
+                'database_size'  => array(
471
+                    'label' => __( 'Database size' ),
472
+                    'value' => $loading,
473
+                    'debug' => 'loading...',
474
+                ),
475
+                'total_size'     => array(
476
+                    'label' => __( 'Total installation size' ),
477
+                    'value' => $loading,
478
+                    'debug' => 'loading...',
479
+                ),
480
+            );
481
+        }
482
+
483
+        // Get a list of all drop-in replacements.
484
+        $dropins = get_dropins();
485
+
486
+        // Get dropins descriptions.
487
+        $dropin_descriptions = _get_dropins();
488
+
489
+        // Spare few function calls.
490
+        $not_available = __( 'Not available' );
491
+
492
+        foreach ( $dropins as $dropin_key => $dropin ) {
493
+            $info['wp-dropins']['fields'][ sanitize_text_field( $dropin_key ) ] = array(
494
+                'label' => $dropin_key,
495
+                'value' => $dropin_descriptions[ $dropin_key ][0],
496
+                'debug' => 'true',
497
+            );
498
+        }
499
+
500
+        // Populate the media fields.
501
+        $info['wp-media']['fields']['image_editor'] = array(
502
+            'label' => __( 'Active editor' ),
503
+            'value' => _wp_image_editor_choose(),
504
+        );
505
+
506
+        // Get ImageMagic information, if available.
507
+        if ( class_exists( 'Imagick' ) ) {
508
+            // Save the Imagick instance for later use.
509
+            $imagick             = new Imagick();
510
+            $imagemagick_version = $imagick->getVersion();
511
+        } else {
512
+            $imagemagick_version = __( 'Not available' );
513
+        }
514
+
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 ),
518
+        );
519
+
520
+        $info['wp-media']['fields']['imagemagick_version'] = array(
521
+            'label' => __( 'ImageMagick version string' ),
522
+            'value' => ( is_array( $imagemagick_version ) ? $imagemagick_version['versionString'] : $imagemagick_version ),
523
+        );
524
+
525
+        $imagick_version = phpversion( 'imagick' );
526
+
527
+        $info['wp-media']['fields']['imagick_version'] = array(
528
+            'label' => __( 'Imagick version' ),
529
+            'value' => ( $imagick_version ) ? $imagick_version : __( 'Not available' ),
530
+        );
531
+
532
+        if ( ! function_exists( 'ini_get' ) ) {
533
+            $info['wp-media']['fields']['ini_get'] = array(
534
+                'label' => __( 'File upload settings' ),
535
+                'value' => sprintf(
536
+                    /* translators: %s: ini_get() */
537
+                    __( 'Unable to determine some settings, as the %s function has been disabled.' ),
538
+                    'ini_get()'
539
+                ),
540
+                'debug' => 'ini_get() is disabled',
541
+            );
542
+        } else {
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 ) );
548
+
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' ),
553
+                'debug' => 'File uploads is turned off',
554
+            );
555
+            $info['wp-media']['fields']['post_max_size']       = array(
556
+                'label' => __( 'Max size of post data allowed' ),
557
+                'value' => $post_max_size,
558
+            );
559
+            $info['wp-media']['fields']['upload_max_filesize'] = array(
560
+                'label' => __( 'Max size of an uploaded file' ),
561
+                'value' => $upload_max_filesize,
562
+            );
563
+            $info['wp-media']['fields']['max_effective_size']  = array(
564
+                'label' => __( 'Max effective file size' ),
565
+                'value' => size_format( $effective ),
566
+            );
567
+            $info['wp-media']['fields']['max_file_uploads']    = array(
568
+                'label' => __( 'Max number of files allowed' ),
569
+                'value' => number_format( $max_file_uploads ),
570
+            );
571
+        }
572
+
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 ) {
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 ),
582
+            );
583
+
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' ),
591
+            );
592
+
593
+            $info['wp-media']['fields']['imagick_limits'] = array(
594
+                'label' => __( 'Imagick Resource Limits' ),
595
+                'value' => $limits,
596
+                'debug' => $limits_debug,
597
+            );
598
+
599
+            try {
600
+                $formats = Imagick::queryFormats( '*' );
601
+            } catch ( Exception $e ) {
602
+                $formats = array();
603
+            }
604
+
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 ),
609
+            );
610
+        }
611
+
612
+        // Get GD information, if available.
613
+        if ( function_exists( 'gd_info' ) ) {
614
+            $gd = gd_info();
615
+        } else {
616
+            $gd = false;
617
+        }
618
+
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' ),
623
+        );
624
+
625
+        $gd_image_formats     = array();
626
+        $gd_supported_formats = array(
627
+            'GIF Create' => 'GIF',
628
+            'JPEG'       => 'JPEG',
629
+            'PNG'        => 'PNG',
630
+            'WebP'       => 'WebP',
631
+            'BMP'        => 'BMP',
632
+            'AVIF'       => 'AVIF',
633
+            'HEIF'       => 'HEIF',
634
+            'TIFF'       => 'TIFF',
635
+            'XPM'        => 'XPM',
636
+        );
637
+
638
+        foreach ( $gd_supported_formats as $format_key => $format ) {
639
+            $index = $format_key . ' Support';
640
+            if ( isset( $gd[ $index ] ) && $gd[ $index ] ) {
641
+                array_push( $gd_image_formats, $format );
642
+            }
643
+        }
644
+
645
+        if ( ! empty( $gd_image_formats ) ) {
646
+            $info['wp-media']['fields']['gd_formats'] = array(
647
+                'label' => __( 'GD supported file formats' ),
648
+                'value' => implode( ', ', $gd_image_formats ),
649
+            );
650
+        }
651
+
652
+        // Get Ghostscript information, if available.
653
+        if ( function_exists( 'exec' ) ) {
654
+            $gs = exec( 'gs --version' );
655
+
656
+            if ( empty( $gs ) ) {
657
+                $gs       = $not_available;
658
+                $gs_debug = 'not available';
659
+            } else {
660
+                $gs_debug = $gs;
661
+            }
662
+        } else {
663
+            $gs       = __( 'Unable to determine if Ghostscript is installed' );
664
+            $gs_debug = 'unknown';
665
+        }
666
+
667
+        $info['wp-media']['fields']['ghostscript_version'] = array(
668
+            'label' => __( 'Ghostscript version' ),
669
+            'value' => $gs,
670
+            'debug' => $gs_debug,
671
+        );
672
+
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' ) );
676
+        } else {
677
+            $server_architecture = 'unknown';
678
+        }
679
+
680
+        if ( function_exists( 'phpversion' ) ) {
681
+            $php_version_debug = phpversion();
682
+            // Whether PHP supports 64-bit.
683
+            $php64bit = ( PHP_INT_SIZE * 8 === 64 );
684
+
685
+            $php_version = sprintf(
686
+                '%s %s',
687
+                $php_version_debug,
688
+                ( $php64bit ? __( '(Supports 64bit values)' ) : __( '(Does not support 64bit values)' ) )
689
+            );
690
+
691
+            if ( $php64bit ) {
692
+                $php_version_debug .= ' 64bit';
693
+            }
694
+        } else {
695
+            $php_version       = __( 'Unable to determine PHP version' );
696
+            $php_version_debug = 'unknown';
697
+        }
698
+
699
+        if ( function_exists( 'php_sapi_name' ) ) {
700
+            $php_sapi = php_sapi_name();
701
+        } else {
702
+            $php_sapi = 'unknown';
703
+        }
704
+
705
+        $info['wp-server']['fields']['server_architecture'] = array(
706
+            'label' => __( 'Server architecture' ),
707
+            'value' => ( 'unknown' !== $server_architecture ? $server_architecture : __( 'Unable to determine server architecture' ) ),
708
+            'debug' => $server_architecture,
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' ),
714
+        );
715
+        $info['wp-server']['fields']['php_version']         = array(
716
+            'label' => __( 'PHP version' ),
717
+            'value' => $php_version,
718
+            'debug' => $php_version_debug,
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' ) ),
723
+            'debug' => $php_sapi,
724
+        );
725
+
726
+        // Some servers disable `ini_set()` and `ini_get()`, we check this before trying to get configuration values.
727
+        if ( ! function_exists( 'ini_get' ) ) {
728
+            $info['wp-server']['fields']['ini_get'] = array(
729
+                'label' => __( 'Server settings' ),
730
+                'value' => sprintf(
731
+                    /* translators: %s: ini_get() */
732
+                    __( 'Unable to determine some settings, as the %s function has been disabled.' ),
733
+                    'ini_get()'
734
+                ),
735
+                'debug' => 'ini_get() is disabled',
736
+            );
737
+        } else {
738
+            $info['wp-server']['fields']['max_input_variables'] = array(
739
+                'label' => __( 'PHP max input variables' ),
740
+                'value' => ini_get( 'max_input_vars' ),
741
+            );
742
+            $info['wp-server']['fields']['time_limit']          = array(
743
+                'label' => __( 'PHP time limit' ),
744
+                'value' => ini_get( 'max_execution_time' ),
745
+            );
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' ),
750
+                    'value' => WP_Site_Health::get_instance()->php_memory_limit,
751
+                );
752
+                $info['wp-server']['fields']['admin_memory_limit'] = array(
753
+                    'label' => __( 'PHP memory limit (only for admin screens)' ),
754
+                    'value' => ini_get( 'memory_limit' ),
755
+                );
756
+            } else {
757
+                $info['wp-server']['fields']['memory_limit'] = array(
758
+                    'label' => __( 'PHP memory limit' ),
759
+                    'value' => ini_get( 'memory_limit' ),
760
+                );
761
+            }
762
+
763
+            $info['wp-server']['fields']['max_input_time']      = array(
764
+                'label' => __( 'Max input time' ),
765
+                'value' => ini_get( 'max_input_time' ),
766
+            );
767
+            $info['wp-server']['fields']['upload_max_filesize'] = array(
768
+                'label' => __( 'Upload max filesize' ),
769
+                'value' => ini_get( 'upload_max_filesize' ),
770
+            );
771
+            $info['wp-server']['fields']['php_post_max_size']   = array(
772
+                'label' => __( 'PHP post max size' ),
773
+                'value' => ini_get( 'post_max_size' ),
774
+            );
775
+        }
776
+
777
+        if ( function_exists( 'curl_version' ) ) {
778
+            $curl = curl_version();
779
+
780
+            $info['wp-server']['fields']['curl_version'] = array(
781
+                'label' => __( 'cURL version' ),
782
+                'value' => sprintf( '%s %s', $curl['version'], $curl['ssl_version'] ),
783
+            );
784
+        } else {
785
+            $info['wp-server']['fields']['curl_version'] = array(
786
+                'label' => __( 'cURL version' ),
787
+                'value' => $not_available,
788
+                'debug' => 'not available',
789
+            );
790
+        }
791
+
792
+        // SUHOSIN.
793
+        $suhosin_loaded = ( extension_loaded( 'suhosin' ) || ( defined( 'SUHOSIN_PATCH' ) && constant( 'SUHOSIN_PATCH' ) ) );
794
+
795
+        $info['wp-server']['fields']['suhosin'] = array(
796
+            'label' => __( 'Is SUHOSIN installed?' ),
797
+            'value' => ( $suhosin_loaded ? __( 'Yes' ) : __( 'No' ) ),
798
+            'debug' => $suhosin_loaded,
799
+        );
800
+
801
+        // Imagick.
802
+        $imagick_loaded = extension_loaded( 'imagick' );
803
+
804
+        $info['wp-server']['fields']['imagick_availability'] = array(
805
+            'label' => __( 'Is the Imagick library available?' ),
806
+            'value' => ( $imagick_loaded ? __( 'Yes' ) : __( 'No' ) ),
807
+            'debug' => $imagick_loaded,
808
+        );
809
+
810
+        // Pretty permalinks.
811
+        $pretty_permalinks_supported = got_url_rewrite();
812
+
813
+        $info['wp-server']['fields']['pretty_permalinks'] = array(
814
+            'label' => __( 'Are pretty permalinks supported?' ),
815
+            'value' => ( $pretty_permalinks_supported ? __( 'Yes' ) : __( 'No' ) ),
816
+            'debug' => $pretty_permalinks_supported,
817
+        );
818
+
819
+        // Check if a .htaccess file exists.
820
+        if ( is_file( ABSPATH . '.htaccess' ) ) {
821
+            // If the file exists, grab the content of it.
822
+            $htaccess_content = file_get_contents( ABSPATH . '.htaccess' );
823
+
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 );
827
+
828
+            if ( $filtered_htaccess_content ) {
829
+                /* translators: %s: .htaccess */
830
+                $htaccess_rules_string = sprintf( __( 'Custom rules have been added to your %s file.' ), '.htaccess' );
831
+            } else {
832
+                /* translators: %s: .htaccess */
833
+                $htaccess_rules_string = sprintf( __( 'Your %s file contains only core WordPress features.' ), '.htaccess' );
834
+            }
835
+
836
+            $info['wp-server']['fields']['htaccess_extra_rules'] = array(
837
+                'label' => __( '.htaccess rules' ),
838
+                'value' => $htaccess_rules_string,
839
+                'debug' => $filtered_htaccess_content,
840
+            );
841
+        }
842
+
843
+        // Populate the database debug fields.
844
+        if ( is_resource( $wpdb->dbh ) ) {
845
+            // Old mysql extension.
846
+            $extension = 'mysql';
847
+        } elseif ( is_object( $wpdb->dbh ) ) {
848
+            // mysqli or PDO.
849
+            $extension = get_class( $wpdb->dbh );
850
+        } else {
851
+            // Unknown sql extension.
852
+            $extension = null;
853
+        }
854
+
855
+        $server = $wpdb->get_var( 'SELECT VERSION()' );
856
+
857
+        if ( isset( $wpdb->use_mysqli ) && $wpdb->use_mysqli ) {
858
+            $client_version = $wpdb->dbh->client_info;
859
+        } else {
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 ) ) {
862
+                $client_version = $matches[0];
863
+            } else {
864
+                $client_version = null;
865
+            }
866
+        }
867
+
868
+        $info['wp-database']['fields']['extension'] = array(
869
+            'label' => __( 'Extension' ),
870
+            'value' => $extension,
871
+        );
872
+
873
+        $info['wp-database']['fields']['server_version'] = array(
874
+            'label' => __( 'Server version' ),
875
+            'value' => $server,
876
+        );
877
+
878
+        $info['wp-database']['fields']['client_version'] = array(
879
+            'label' => __( 'Client version' ),
880
+            'value' => $client_version,
881
+        );
882
+
883
+        $info['wp-database']['fields']['database_user'] = array(
884
+            'label'   => __( 'Database username' ),
885
+            'value'   => $wpdb->dbuser,
886
+            'private' => true,
887
+        );
888
+
889
+        $info['wp-database']['fields']['database_host'] = array(
890
+            'label'   => __( 'Database host' ),
891
+            'value'   => $wpdb->dbhost,
892
+            'private' => true,
893
+        );
894
+
895
+        $info['wp-database']['fields']['database_name'] = array(
896
+            'label'   => __( 'Database name' ),
897
+            'value'   => $wpdb->dbname,
898
+            'private' => true,
899
+        );
900
+
901
+        $info['wp-database']['fields']['database_prefix'] = array(
902
+            'label'   => __( 'Table prefix' ),
903
+            'value'   => $wpdb->prefix,
904
+            'private' => true,
905
+        );
906
+
907
+        $info['wp-database']['fields']['database_charset'] = array(
908
+            'label'   => __( 'Database charset' ),
909
+            'value'   => $wpdb->charset,
910
+            'private' => true,
911
+        );
912
+
913
+        $info['wp-database']['fields']['database_collate'] = array(
914
+            'label'   => __( 'Database collation' ),
915
+            'value'   => $wpdb->collate,
916
+            'private' => true,
917
+        );
918
+
919
+        $info['wp-database']['fields']['max_allowed_packet'] = array(
920
+            'label' => __( 'Max allowed packet size' ),
921
+            'value' => self::get_mysql_var( 'max_allowed_packet' ),
922
+        );
923
+
924
+        $info['wp-database']['fields']['max_connections'] = array(
925
+            'label' => __( 'Max connections number' ),
926
+            'value' => self::get_mysql_var( 'max_connections' ),
927
+        );
928
+
929
+        // List must use plugins if there are any.
930
+        $mu_plugins = get_mu_plugins();
931
+
932
+        foreach ( $mu_plugins as $plugin_path => $plugin ) {
933
+            $plugin_version = $plugin['Version'];
934
+            $plugin_author  = $plugin['Author'];
935
+
936
+            $plugin_version_string       = __( 'No version or author information is available.' );
937
+            $plugin_version_string_debug = 'author: (undefined), version: (undefined)';
938
+
939
+            if ( ! empty( $plugin_version ) && ! empty( $plugin_author ) ) {
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 );
943
+            } else {
944
+                if ( ! empty( $plugin_author ) ) {
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 );
948
+                }
949
+
950
+                if ( ! empty( $plugin_version ) ) {
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 );
954
+                }
955
+            }
956
+
957
+            $info['wp-mu-plugins']['fields'][ sanitize_text_field( $plugin['Name'] ) ] = array(
958
+                'label' => $plugin['Name'],
959
+                'value' => $plugin_version_string,
960
+                'debug' => $plugin_version_string_debug,
961
+            );
962
+        }
963
+
964
+        // List all available plugins.
965
+        $plugins        = get_plugins();
966
+        $plugin_updates = get_plugin_updates();
967
+        $transient      = get_site_transient( 'update_plugins' );
968
+
969
+        $auto_updates = array();
970
+
971
+        $auto_updates_enabled = wp_is_auto_update_enabled_for_type( 'plugin' );
972
+
973
+        if ( $auto_updates_enabled ) {
974
+            $auto_updates = (array) get_site_option( 'auto_update_plugins', array() );
975
+        }
976
+
977
+        foreach ( $plugins as $plugin_path => $plugin ) {
978
+            $plugin_part = ( is_plugin_active( $plugin_path ) ) ? 'wp-plugins-active' : 'wp-plugins-inactive';
979
+
980
+            $plugin_version = $plugin['Version'];
981
+            $plugin_author  = $plugin['Author'];
982
+
983
+            $plugin_version_string       = __( 'No version or author information is available.' );
984
+            $plugin_version_string_debug = 'author: (undefined), version: (undefined)';
985
+
986
+            if ( ! empty( $plugin_version ) && ! empty( $plugin_author ) ) {
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 );
990
+            } else {
991
+                if ( ! empty( $plugin_author ) ) {
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 );
995
+                }
996
+
997
+                if ( ! empty( $plugin_version ) ) {
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 );
1001
+                }
1002
+            }
1003
+
1004
+            if ( array_key_exists( $plugin_path, $plugin_updates ) ) {
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 );
1008
+            }
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 ];
1015
+                } else {
1016
+                    $item = array(
1017
+                        'id'            => $plugin_path,
1018
+                        'slug'          => '',
1019
+                        'plugin'        => $plugin_path,
1020
+                        'new_version'   => '',
1021
+                        'url'           => '',
1022
+                        'package'       => '',
1023
+                        'icons'         => array(),
1024
+                        'banners'       => array(),
1025
+                        'banners_rtl'   => array(),
1026
+                        'tested'        => '',
1027
+                        'requires_php'  => '',
1028
+                        'compatibility' => new stdClass(),
1029
+                    );
1030
+                    $item = wp_parse_args( $plugin, $item );
1031
+                }
1032
+
1033
+                $auto_update_forced = wp_is_auto_update_forced_for_item( 'plugin', null, (object) $item );
1034
+
1035
+                if ( ! is_null( $auto_update_forced ) ) {
1036
+                    $enabled = $auto_update_forced;
1037
+                } else {
1038
+                    $enabled = in_array( $plugin_path, $auto_updates, true );
1039
+                }
1040
+
1041
+                if ( $enabled ) {
1042
+                    $auto_updates_string = __( 'Auto-updates enabled' );
1043
+                } else {
1044
+                    $auto_updates_string = __( 'Auto-updates disabled' );
1045
+                }
1046
+
1047
+                /**
1048
+                 * Filters the text string of the auto-updates setting for each plugin in the Site Health debug data.
1049
+                 *
1050
+                 * @since 5.5.0
1051
+                 *
1052
+                 * @param string $auto_updates_string The string output for the auto-updates column.
1053
+                 * @param string $plugin_path         The path to the plugin file.
1054
+                 * @param array  $plugin              An array of plugin data.
1055
+                 * @param bool   $enabled             Whether auto-updates are enabled for this item.
1056
+                 */
1057
+                $auto_updates_string = apply_filters( 'plugin_auto_update_debug_string', $auto_updates_string, $plugin_path, $plugin, $enabled );
1058
+
1059
+                $plugin_version_string       .= ' | ' . $auto_updates_string;
1060
+                $plugin_version_string_debug .= ', ' . $auto_updates_string;
1061
+            }
1062
+
1063
+            $info[ $plugin_part ]['fields'][ sanitize_text_field( $plugin['Name'] ) ] = array(
1064
+                'label' => $plugin['Name'],
1065
+                'value' => $plugin_version_string,
1066
+                'debug' => $plugin_version_string_debug,
1067
+            );
1068
+        }
1069
+
1070
+        // Populate the section for the currently active theme.
1071
+        global $_wp_theme_features;
1072
+        $theme_features = array();
1073
+
1074
+        if ( ! empty( $_wp_theme_features ) ) {
1075
+            foreach ( $_wp_theme_features as $feature => $options ) {
1076
+                $theme_features[] = $feature;
1077
+            }
1078
+        }
1079
+
1080
+        $active_theme  = wp_get_theme();
1081
+        $theme_updates = get_theme_updates();
1082
+        $transient     = get_site_transient( 'update_themes' );
1083
+
1084
+        $active_theme_version       = $active_theme->version;
1085
+        $active_theme_version_debug = $active_theme_version;
1086
+
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() );
1091
+        }
1092
+
1093
+        if ( array_key_exists( $active_theme->stylesheet, $theme_updates ) ) {
1094
+            $theme_update_new_version = $theme_updates[ $active_theme->stylesheet ]->update['new_version'];
1095
+
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 );
1099
+        }
1100
+
1101
+        $active_theme_author_uri = $active_theme->display( 'AuthorURI' );
1102
+
1103
+        if ( $active_theme->parent_theme ) {
1104
+            $active_theme_parent_theme = sprintf(
1105
+                /* translators: 1: Theme name. 2: Theme slug. */
1106
+                __( '%1$s (%2$s)' ),
1107
+                $active_theme->parent_theme,
1108
+                $active_theme->template
1109
+            );
1110
+            $active_theme_parent_theme_debug = sprintf(
1111
+                '%s (%s)',
1112
+                $active_theme->parent_theme,
1113
+                $active_theme->template
1114
+            );
1115
+        } else {
1116
+            $active_theme_parent_theme       = __( 'None' );
1117
+            $active_theme_parent_theme_debug = 'none';
1118
+        }
1119
+
1120
+        $info['wp-active-theme']['fields'] = array(
1121
+            'name'           => array(
1122
+                'label' => __( 'Name' ),
1123
+                'value' => sprintf(
1124
+                    /* translators: 1: Theme name. 2: Theme slug. */
1125
+                    __( '%1$s (%2$s)' ),
1126
+                    $active_theme->name,
1127
+                    $active_theme->stylesheet
1128
+                ),
1129
+            ),
1130
+            'version'        => array(
1131
+                'label' => __( 'Version' ),
1132
+                'value' => $active_theme_version,
1133
+                'debug' => $active_theme_version_debug,
1134
+            ),
1135
+            'author'         => array(
1136
+                'label' => __( 'Author' ),
1137
+                'value' => wp_kses( $active_theme->author, array() ),
1138
+            ),
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)' ),
1143
+            ),
1144
+            'parent_theme'   => array(
1145
+                'label' => __( 'Parent theme' ),
1146
+                'value' => $active_theme_parent_theme,
1147
+                'debug' => $active_theme_parent_theme_debug,
1148
+            ),
1149
+            'theme_features' => array(
1150
+                'label' => __( 'Theme features' ),
1151
+                'value' => implode( ', ', $theme_features ),
1152
+            ),
1153
+            'theme_path'     => array(
1154
+                'label' => __( 'Theme directory location' ),
1155
+                'value' => get_stylesheet_directory(),
1156
+            ),
1157
+        );
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 ];
1164
+            } else {
1165
+                $item = array(
1166
+                    'theme'        => $active_theme->stylesheet,
1167
+                    'new_version'  => $active_theme->version,
1168
+                    'url'          => '',
1169
+                    'package'      => '',
1170
+                    'requires'     => '',
1171
+                    'requires_php' => '',
1172
+                );
1173
+            }
1174
+
1175
+            $auto_update_forced = wp_is_auto_update_forced_for_item( 'theme', null, (object) $item );
1176
+
1177
+            if ( ! is_null( $auto_update_forced ) ) {
1178
+                $enabled = $auto_update_forced;
1179
+            } else {
1180
+                $enabled = in_array( $active_theme->stylesheet, $auto_updates, true );
1181
+            }
1182
+
1183
+            if ( $enabled ) {
1184
+                $auto_updates_string = __( 'Enabled' );
1185
+            } else {
1186
+                $auto_updates_string = __( 'Disabled' );
1187
+            }
1188
+
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 );
1191
+
1192
+            $info['wp-active-theme']['fields']['auto_update'] = array(
1193
+                'label' => __( 'Auto-updates' ),
1194
+                'value' => $auto_updates_string,
1195
+                'debug' => $auto_updates_string,
1196
+            );
1197
+        }
1198
+
1199
+        $parent_theme = $active_theme->parent();
1200
+
1201
+        if ( $parent_theme ) {
1202
+            $parent_theme_version       = $parent_theme->version;
1203
+            $parent_theme_version_debug = $parent_theme_version;
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'];
1207
+
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 );
1211
+            }
1212
+
1213
+            $parent_theme_author_uri = $parent_theme->display( 'AuthorURI' );
1214
+
1215
+            $info['wp-parent-theme']['fields'] = array(
1216
+                'name'           => array(
1217
+                    'label' => __( 'Name' ),
1218
+                    'value' => sprintf(
1219
+                        /* translators: 1: Theme name. 2: Theme slug. */
1220
+                        __( '%1$s (%2$s)' ),
1221
+                        $parent_theme->name,
1222
+                        $parent_theme->stylesheet
1223
+                    ),
1224
+                ),
1225
+                'version'        => array(
1226
+                    'label' => __( 'Version' ),
1227
+                    'value' => $parent_theme_version,
1228
+                    'debug' => $parent_theme_version_debug,
1229
+                ),
1230
+                'author'         => array(
1231
+                    'label' => __( 'Author' ),
1232
+                    'value' => wp_kses( $parent_theme->author, array() ),
1233
+                ),
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)' ),
1238
+                ),
1239
+                'theme_path'     => array(
1240
+                    'label' => __( 'Theme directory location' ),
1241
+                    'value' => get_template_directory(),
1242
+                ),
1243
+            );
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 ];
1250
+                } else {
1251
+                    $item = array(
1252
+                        'theme'        => $parent_theme->stylesheet,
1253
+                        'new_version'  => $parent_theme->version,
1254
+                        'url'          => '',
1255
+                        'package'      => '',
1256
+                        'requires'     => '',
1257
+                        'requires_php' => '',
1258
+                    );
1259
+                }
1260
+
1261
+                $auto_update_forced = wp_is_auto_update_forced_for_item( 'theme', null, (object) $item );
1262
+
1263
+                if ( ! is_null( $auto_update_forced ) ) {
1264
+                    $enabled = $auto_update_forced;
1265
+                } else {
1266
+                    $enabled = in_array( $parent_theme->stylesheet, $auto_updates, true );
1267
+                }
1268
+
1269
+                if ( $enabled ) {
1270
+                    $parent_theme_auto_update_string = __( 'Enabled' );
1271
+                } else {
1272
+                    $parent_theme_auto_update_string = __( 'Disabled' );
1273
+                }
1274
+
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 );
1277
+
1278
+                $info['wp-parent-theme']['fields']['auto_update'] = array(
1279
+                    'label' => __( 'Auto-update' ),
1280
+                    'value' => $parent_theme_auto_update_string,
1281
+                    'debug' => $parent_theme_auto_update_string,
1282
+                );
1283
+            }
1284
+        }
1285
+
1286
+        // Populate a list of all themes available in the install.
1287
+        $all_themes = wp_get_themes();
1288
+
1289
+        foreach ( $all_themes as $theme_slug => $theme ) {
1290
+            // Exclude the currently active theme from the list of all themes.
1291
+            if ( $active_theme->stylesheet === $theme_slug ) {
1292
+                continue;
1293
+            }
1294
+
1295
+            // Exclude the currently active parent theme from the list of all themes.
1296
+            if ( ! empty( $parent_theme ) && $parent_theme->stylesheet === $theme_slug ) {
1297
+                continue;
1298
+            }
1299
+
1300
+            $theme_version = $theme->version;
1301
+            $theme_author  = $theme->author;
1302
+
1303
+            // Sanitize.
1304
+            $theme_author = wp_kses( $theme_author, array() );
1305
+
1306
+            $theme_version_string       = __( 'No version or author information is available.' );
1307
+            $theme_version_string_debug = 'undefined';
1308
+
1309
+            if ( ! empty( $theme_version ) && ! empty( $theme_author ) ) {
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 );
1313
+            } else {
1314
+                if ( ! empty( $theme_author ) ) {
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 );
1318
+                }
1319
+
1320
+                if ( ! empty( $theme_version ) ) {
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 );
1324
+                }
1325
+            }
1326
+
1327
+            if ( array_key_exists( $theme_slug, $theme_updates ) ) {
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'] );
1331
+            }
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 ];
1338
+                } else {
1339
+                    $item = array(
1340
+                        'theme'        => $theme_slug,
1341
+                        'new_version'  => $theme->version,
1342
+                        'url'          => '',
1343
+                        'package'      => '',
1344
+                        'requires'     => '',
1345
+                        'requires_php' => '',
1346
+                    );
1347
+                }
1348
+
1349
+                $auto_update_forced = wp_is_auto_update_forced_for_item( 'theme', null, (object) $item );
1350
+
1351
+                if ( ! is_null( $auto_update_forced ) ) {
1352
+                    $enabled = $auto_update_forced;
1353
+                } else {
1354
+                    $enabled = in_array( $theme_slug, $auto_updates, true );
1355
+                }
1356
+
1357
+                if ( $enabled ) {
1358
+                    $auto_updates_string = __( 'Auto-updates enabled' );
1359
+                } else {
1360
+                    $auto_updates_string = __( 'Auto-updates disabled' );
1361
+                }
1362
+
1363
+                /**
1364
+                 * Filters the text string of the auto-updates setting for each theme in the Site Health debug data.
1365
+                 *
1366
+                 * @since 5.5.0
1367
+                 *
1368
+                 * @param string   $auto_updates_string The string output for the auto-updates column.
1369
+                 * @param WP_Theme $theme               An object of theme data.
1370
+                 * @param bool     $enabled             Whether auto-updates are enabled for this item.
1371
+                 */
1372
+                $auto_updates_string = apply_filters( 'theme_auto_update_debug_string', $auto_updates_string, $theme, $enabled );
1373
+
1374
+                $theme_version_string       .= ' | ' . $auto_updates_string;
1375
+                $theme_version_string_debug .= ', ' . $auto_updates_string;
1376
+            }
1377
+
1378
+            $info['wp-themes-inactive']['fields'][ sanitize_text_field( $theme->name ) ] = array(
1379
+                'label' => sprintf(
1380
+                    /* translators: 1: Theme name. 2: Theme slug. */
1381
+                    __( '%1$s (%2$s)' ),
1382
+                    $theme->name,
1383
+                    $theme_slug
1384
+                ),
1385
+                'value' => $theme_version_string,
1386
+                'debug' => $theme_version_string_debug,
1387
+            );
1388
+        }
1389
+
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 );
1393
+
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' ),
1398
+            );
1399
+        }
1400
+
1401
+        /**
1402
+         * Add to or modify the debug information shown on the Tools -> Site Health -> Info screen.
1403
+         *
1404
+         * Plugin or themes may wish to introduce their own debug information without creating
1405
+         * additional admin pages. They can utilize this filter to introduce their own sections
1406
+         * or add more data to existing sections.
1407
+         *
1408
+         * Array keys for sections added by core are all prefixed with `wp-`. Plugins and themes
1409
+         * should use their own slug as a prefix, both for consistency as well as avoiding
1410
+         * key collisions. Note that the array keys are used as labels for the copied data.
1411
+         *
1412
+         * All strings are expected to be plain text except `$description` that can contain
1413
+         * inline HTML tags (see below).
1414
+         *
1415
+         * @since 5.2.0
1416
+         *
1417
+         * @param array $args {
1418
+         *     The debug information to be added to the core information page.
1419
+         *
1420
+         *     This is an associative multi-dimensional array, up to three levels deep.
1421
+         *     The topmost array holds the sections, keyed by section ID.
1422
+         *
1423
+         *     @type array ...$0 {
1424
+         *         Each section has a `$fields` associative array (see below), and each `$value` in `$fields`
1425
+         *         can be another associative array of name/value pairs when there is more structured data
1426
+         *         to display.
1427
+         *
1428
+         *         @type string $label       Required. The title for this section of the debug output.
1429
+         *         @type string $description Optional. A description for your information section which
1430
+         *                                   may contain basic HTML markup, inline tags only as it is
1431
+         *                                   outputted in a paragraph.
1432
+         *         @type bool   $show_count  Optional. If set to `true`, the amount of fields will be included
1433
+         *                                   in the title for this section. Default false.
1434
+         *         @type bool   $private     Optional. If set to `true`, the section and all associated fields
1435
+         *                                   will be excluded from the copied data. Default false.
1436
+         *         @type array  $fields {
1437
+         *             Required. An associative array containing the fields to be displayed in the section,
1438
+         *             keyed by field ID.
1439
+         *
1440
+         *             @type array ...$0 {
1441
+         *                 An associative array containing the data to be displayed for the field.
1442
+         *
1443
+         *                 @type string $label    Required. The label for this piece of information.
1444
+         *                 @type mixed  $value    Required. The output that is displayed for this field.
1445
+         *                                        Text should be translated. Can be an associative array
1446
+         *                                        that is displayed as name/value pairs.
1447
+         *                                        Accepted types: `string|int|float|(string|int|float)[]`.
1448
+         *                 @type string $debug    Optional. The output that is used for this field when
1449
+         *                                        the user copies the data. It should be more concise and
1450
+         *                                        not translated. If not set, the content of `$value`
1451
+         *                                        is used. Note that the array keys are used as labels
1452
+         *                                        for the copied data.
1453
+         *                 @type bool   $private  Optional. If set to `true`, the field will be excluded
1454
+         *                                        from the copied data, allowing you to show, for example,
1455
+         *                                        API keys here. Default false.
1456
+         *             }
1457
+         *         }
1458
+         *     }
1459
+         * }
1460
+         */
1461
+        $info = apply_filters( 'debug_information', $info );
1462
+
1463
+        return $info;
1464
+    }
1465
+
1466
+    /**
1467
+     * Returns the value of a MySQL system variable.
1468
+     *
1469
+     * @since 5.9.0
1470
+     *
1471
+     * @global wpdb $wpdb WordPress database abstraction object.
1472
+     *
1473
+     * @param string $mysql_var Name of the MySQL system variable.
1474
+     * @return string|null The variable value on success. Null if the variable does not exist.
1475
+     */
1476
+    public static function get_mysql_var( $mysql_var ) {
1477
+        global $wpdb;
1478
+
1479
+        $result = $wpdb->get_row(
1480
+            $wpdb->prepare( 'SHOW VARIABLES LIKE %s', $mysql_var ),
1481
+            ARRAY_A
1482
+        );
1483
+
1484
+        if ( ! empty( $result ) && array_key_exists( 'Value', $result ) ) {
1485
+            return $result['Value'];
1486
+        }
1487
+
1488
+        return null;
1489
+    }
1490
+
1491
+    /**
1492
+     * Format the information gathered for debugging, in a manner suitable for copying to a forum or support ticket.
1493
+     *
1494
+     * @since 5.2.0
1495
+     *
1496
+     * @param array  $info_array Information gathered from the `WP_Debug_Data::debug_data()` function.
1497
+     * @param string $data_type  The data type to return, either 'info' or 'debug'.
1498
+     * @return string The formatted data.
1499
+     */
1500
+    public static function format( $info_array, $data_type ) {
1501
+        $return = "`\n";
1502
+
1503
+        foreach ( $info_array as $section => $details ) {
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'] ) ) {
1506
+                continue;
1507
+            }
1508
+
1509
+            $section_label = 'debug' === $data_type ? $section : $details['label'];
1510
+
1511
+            $return .= sprintf(
1512
+                "### %s%s ###\n\n",
1513
+                $section_label,
1514
+                ( isset( $details['show_count'] ) && $details['show_count'] ? sprintf( ' (%d)', count( $details['fields'] ) ) : '' )
1515
+            );
1516
+
1517
+            foreach ( $details['fields'] as $field_name => $field ) {
1518
+                if ( isset( $field['private'] ) && true === $field['private'] ) {
1519
+                    continue;
1520
+                }
1521
+
1522
+                if ( 'debug' === $data_type && isset( $field['debug'] ) ) {
1523
+                    $debug_data = $field['debug'];
1524
+                } else {
1525
+                    $debug_data = $field['value'];
1526
+                }
1527
+
1528
+                // Can be array, one level deep only.
1529
+                if ( is_array( $debug_data ) ) {
1530
+                    $value = '';
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 );
1534
+                    }
1535
+                } elseif ( is_bool( $debug_data ) ) {
1536
+                    $value = $debug_data ? 'true' : 'false';
1537
+                } elseif ( empty( $debug_data ) && '0' !== $debug_data ) {
1538
+                    $value = 'undefined';
1539
+                } else {
1540
+                    $value = $debug_data;
1541
+                }
1542
+
1543
+                if ( 'debug' === $data_type ) {
1544
+                    $label = $field_name;
1545
+                } else {
1546
+                    $label = $field['label'];
1547
+                }
1548
+
1549
+                $return .= sprintf( "%s: %s\n", $label, $value );
1550
+            }
1551
+
1552
+            $return .= "\n";
1553
+        }
1554
+
1555
+        $return .= '`';
1556
+
1557
+        return $return;
1558
+    }
1559
+
1560
+    /**
1561
+     * Fetch the total size of all the database tables for the active database user.
1562
+     *
1563
+     * @since 5.2.0
1564
+     *
1565
+     * @return int The size of the database, in bytes.
1566
+     */
1567
+    public static function get_database_size() {
1568
+        global $wpdb;
1569
+        $size = 0;
1570
+        $rows = $wpdb->get_results( 'SHOW TABLE STATUS', ARRAY_A );
1571
+
1572
+        if ( $wpdb->num_rows > 0 ) {
1573
+            foreach ( $rows as $row ) {
1574
+                $size += $row['Data_length'] + $row['Index_length'];
1575
+            }
1576
+        }
1577
+
1578
+        return (int) $size;
1579
+    }
1580
+
1581
+    /**
1582
+     * Fetch the sizes of the WordPress directories: `wordpress` (ABSPATH), `plugins`, `themes`, and `uploads`.
1583
+     * Intended to supplement the array returned by `WP_Debug_Data::debug_data()`.
1584
+     *
1585
+     * @since 5.2.0
1586
+     *
1587
+     * @return array The sizes of the directories, also the database size and total installation size.
1588
+     */
1589
+    public static function get_sizes() {
1590
+        $size_db    = self::get_database_size();
1591
+        $upload_dir = wp_get_upload_dir();
1592
+
1593
+        /*
1594 1594
 		 * We will be using the PHP max execution time to prevent the size calculations
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' );
1600
-		}
1601
-
1602
-		// The max_execution_time defaults to 0 when PHP runs from cli.
1603
-		// We still want to limit it below.
1604
-		if ( empty( $max_execution_time ) ) {
1605
-			$max_execution_time = 30;
1606
-		}
1607
-
1608
-		if ( $max_execution_time > 20 ) {
1609
-			// If the max_execution_time is set to lower than 20 seconds, reduce it a bit to prevent
1610
-			// edge-case timeouts that may happen after the size loop has finished running.
1611
-			$max_execution_time -= 2;
1612
-		}
1613
-
1614
-		// Go through the various installation directories and calculate their sizes.
1615
-		// No trailing slashes.
1616
-		$paths = array(
1617
-			'wordpress_size' => untrailingslashit( ABSPATH ),
1618
-			'themes_size'    => get_theme_root(),
1619
-			'plugins_size'   => WP_PLUGIN_DIR,
1620
-			'uploads_size'   => $upload_dir['basedir'],
1621
-		);
1622
-
1623
-		$exclude = $paths;
1624
-		unset( $exclude['wordpress_size'] );
1625
-		$exclude = array_values( $exclude );
1626
-
1627
-		$size_total = 0;
1628
-		$all_sizes  = array();
1629
-
1630
-		// Loop over all the directories we want to gather the sizes for.
1631
-		foreach ( $paths as $name => $path ) {
1632
-			$dir_size = null; // Default to timeout.
1633
-			$results  = array(
1634
-				'path' => $path,
1635
-				'raw'  => 0,
1636
-			);
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 );
1641
-				} else {
1642
-					$dir_size = recurse_dirsize( $path, null, $max_execution_time );
1643
-				}
1644
-			}
1645
-
1646
-			if ( false === $dir_size ) {
1647
-				// Error reading.
1648
-				$results['size']  = __( 'The size cannot be calculated. The directory is not accessible. Usually caused by invalid permissions.' );
1649
-				$results['debug'] = 'not accessible';
1650
-
1651
-				// Stop total size calculation.
1652
-				$size_total = null;
1653
-			} elseif ( null === $dir_size ) {
1654
-				// Timeout.
1655
-				$results['size']  = __( 'The directory size calculation has timed out. Usually caused by a very large number of sub-directories and files.' );
1656
-				$results['debug'] = 'timeout while calculating size';
1657
-
1658
-				// Stop total size calculation.
1659
-				$size_total = null;
1660
-			} else {
1661
-				if ( null !== $size_total ) {
1662
-					$size_total += $dir_size;
1663
-				}
1664
-
1665
-				$results['raw']   = $dir_size;
1666
-				$results['size']  = size_format( $dir_size, 2 );
1667
-				$results['debug'] = $results['size'] . " ({$dir_size} bytes)";
1668
-			}
1669
-
1670
-			$all_sizes[ $name ] = $results;
1671
-		}
1672
-
1673
-		if ( $size_db > 0 ) {
1674
-			$database_size = size_format( $size_db, 2 );
1675
-
1676
-			$all_sizes['database_size'] = array(
1677
-				'raw'   => $size_db,
1678
-				'size'  => $database_size,
1679
-				'debug' => $database_size . " ({$size_db} bytes)",
1680
-			);
1681
-		} else {
1682
-			$all_sizes['database_size'] = array(
1683
-				'size'  => __( 'Not available' ),
1684
-				'debug' => 'not available',
1685
-			);
1686
-		}
1687
-
1688
-		if ( null !== $size_total && $size_db > 0 ) {
1689
-			$total_size    = $size_total + $size_db;
1690
-			$total_size_mb = size_format( $total_size, 2 );
1691
-
1692
-			$all_sizes['total_size'] = array(
1693
-				'raw'   => $total_size,
1694
-				'size'  => $total_size_mb,
1695
-				'debug' => $total_size_mb . " ({$total_size} bytes)",
1696
-			);
1697
-		} else {
1698
-			$all_sizes['total_size'] = array(
1699
-				'size'  => __( 'Total size is not available. Some errors were encountered when determining the size of your installation.' ),
1700
-				'debug' => 'not available',
1701
-			);
1702
-		}
1703
-
1704
-		return $all_sizes;
1705
-	}
1598
+        if ( function_exists( 'ini_get' ) ) {
1599
+            $max_execution_time = ini_get( 'max_execution_time' );
1600
+        }
1601
+
1602
+        // The max_execution_time defaults to 0 when PHP runs from cli.
1603
+        // We still want to limit it below.
1604
+        if ( empty( $max_execution_time ) ) {
1605
+            $max_execution_time = 30;
1606
+        }
1607
+
1608
+        if ( $max_execution_time > 20 ) {
1609
+            // If the max_execution_time is set to lower than 20 seconds, reduce it a bit to prevent
1610
+            // edge-case timeouts that may happen after the size loop has finished running.
1611
+            $max_execution_time -= 2;
1612
+        }
1613
+
1614
+        // Go through the various installation directories and calculate their sizes.
1615
+        // No trailing slashes.
1616
+        $paths = array(
1617
+            'wordpress_size' => untrailingslashit( ABSPATH ),
1618
+            'themes_size'    => get_theme_root(),
1619
+            'plugins_size'   => WP_PLUGIN_DIR,
1620
+            'uploads_size'   => $upload_dir['basedir'],
1621
+        );
1622
+
1623
+        $exclude = $paths;
1624
+        unset( $exclude['wordpress_size'] );
1625
+        $exclude = array_values( $exclude );
1626
+
1627
+        $size_total = 0;
1628
+        $all_sizes  = array();
1629
+
1630
+        // Loop over all the directories we want to gather the sizes for.
1631
+        foreach ( $paths as $name => $path ) {
1632
+            $dir_size = null; // Default to timeout.
1633
+            $results  = array(
1634
+                'path' => $path,
1635
+                'raw'  => 0,
1636
+            );
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 );
1641
+                } else {
1642
+                    $dir_size = recurse_dirsize( $path, null, $max_execution_time );
1643
+                }
1644
+            }
1645
+
1646
+            if ( false === $dir_size ) {
1647
+                // Error reading.
1648
+                $results['size']  = __( 'The size cannot be calculated. The directory is not accessible. Usually caused by invalid permissions.' );
1649
+                $results['debug'] = 'not accessible';
1650
+
1651
+                // Stop total size calculation.
1652
+                $size_total = null;
1653
+            } elseif ( null === $dir_size ) {
1654
+                // Timeout.
1655
+                $results['size']  = __( 'The directory size calculation has timed out. Usually caused by a very large number of sub-directories and files.' );
1656
+                $results['debug'] = 'timeout while calculating size';
1657
+
1658
+                // Stop total size calculation.
1659
+                $size_total = null;
1660
+            } else {
1661
+                if ( null !== $size_total ) {
1662
+                    $size_total += $dir_size;
1663
+                }
1664
+
1665
+                $results['raw']   = $dir_size;
1666
+                $results['size']  = size_format( $dir_size, 2 );
1667
+                $results['debug'] = $results['size'] . " ({$dir_size} bytes)";
1668
+            }
1669
+
1670
+            $all_sizes[ $name ] = $results;
1671
+        }
1672
+
1673
+        if ( $size_db > 0 ) {
1674
+            $database_size = size_format( $size_db, 2 );
1675
+
1676
+            $all_sizes['database_size'] = array(
1677
+                'raw'   => $size_db,
1678
+                'size'  => $database_size,
1679
+                'debug' => $database_size . " ({$size_db} bytes)",
1680
+            );
1681
+        } else {
1682
+            $all_sizes['database_size'] = array(
1683
+                'size'  => __( 'Not available' ),
1684
+                'debug' => 'not available',
1685
+            );
1686
+        }
1687
+
1688
+        if ( null !== $size_total && $size_db > 0 ) {
1689
+            $total_size    = $size_total + $size_db;
1690
+            $total_size_mb = size_format( $total_size, 2 );
1691
+
1692
+            $all_sizes['total_size'] = array(
1693
+                'raw'   => $total_size,
1694
+                'size'  => $total_size_mb,
1695
+                'debug' => $total_size_mb . " ({$total_size} bytes)",
1696
+            );
1697
+        } else {
1698
+            $all_sizes['total_size'] = array(
1699
+                'size'  => __( 'Total size is not available. Some errors were encountered when determining the size of your installation.' ),
1700
+                'debug' => 'not available',
1701
+            );
1702
+        }
1703
+
1704
+        return $all_sizes;
1705
+    }
1706 1706
 }
Please login to merge, or discard this patch.
Spacing   +465 added lines, -465 removed lines patch added patch discarded remove patch
@@ -37,22 +37,22 @@  discard block
 block discarded – undo
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
 block discarded – undo
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&#8217;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&#8217;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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
427 427
 		}
428 428
 
429 429
 		// Remove accordion for Directories and Sizes if in Multisite.
430
-		if ( ! $is_multisite ) {
431
-			$loading = __( 'Loading&hellip;' );
430
+		if (!$is_multisite) {
431
+			$loading = __('Loading&hellip;');
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 		}
Please login to merge, or discard this patch.
brighty/wp-admin/includes/class-language-pack-upgrader-skin.php 2 patches
Indentation   +68 added lines, -68 removed lines patch added patch discarded remove patch
@@ -16,82 +16,82 @@
 block discarded – undo
16 16
  * @see WP_Upgrader_Skin
17 17
  */
18 18
 class Language_Pack_Upgrader_Skin extends WP_Upgrader_Skin {
19
-	public $language_update        = null;
20
-	public $done_header            = false;
21
-	public $done_footer            = false;
22
-	public $display_footer_actions = true;
19
+    public $language_update        = null;
20
+    public $done_header            = false;
21
+    public $done_footer            = false;
22
+    public $display_footer_actions = true;
23 23
 
24
-	/**
25
-	 * @param array $args
26
-	 */
27
-	public function __construct( $args = array() ) {
28
-		$defaults = array(
29
-			'url'                => '',
30
-			'nonce'              => '',
31
-			'title'              => __( 'Update Translations' ),
32
-			'skip_header_footer' => false,
33
-		);
34
-		$args     = wp_parse_args( $args, $defaults );
35
-		if ( $args['skip_header_footer'] ) {
36
-			$this->done_header            = true;
37
-			$this->done_footer            = true;
38
-			$this->display_footer_actions = false;
39
-		}
40
-		parent::__construct( $args );
41
-	}
24
+    /**
25
+     * @param array $args
26
+     */
27
+    public function __construct( $args = array() ) {
28
+        $defaults = array(
29
+            'url'                => '',
30
+            'nonce'              => '',
31
+            'title'              => __( 'Update Translations' ),
32
+            'skip_header_footer' => false,
33
+        );
34
+        $args     = wp_parse_args( $args, $defaults );
35
+        if ( $args['skip_header_footer'] ) {
36
+            $this->done_header            = true;
37
+            $this->done_footer            = true;
38
+            $this->display_footer_actions = false;
39
+        }
40
+        parent::__construct( $args );
41
+    }
42 42
 
43
-	/**
44
-	 */
45
-	public function before() {
46
-		$name = $this->upgrader->get_name_for_update( $this->language_update );
43
+    /**
44
+     */
45
+    public function before() {
46
+        $name = $this->upgrader->get_name_for_update( $this->language_update );
47 47
 
48
-		echo '<div class="update-messages lp-show-latest">';
48
+        echo '<div class="update-messages lp-show-latest">';
49 49
 
50
-		/* translators: 1: Project name (plugin, theme, or WordPress), 2: Language. */
51
-		printf( '<h2>' . __( 'Updating translations for %1$s (%2$s)&#8230;' ) . '</h2>', $name, $this->language_update->language );
52
-	}
50
+        /* translators: 1: Project name (plugin, theme, or WordPress), 2: Language. */
51
+        printf( '<h2>' . __( 'Updating translations for %1$s (%2$s)&#8230;' ) . '</h2>', $name, $this->language_update->language );
52
+    }
53 53
 
54
-	/**
55
-	 * @since 5.9.0 Renamed `$error` to `$errors` for PHP 8 named parameter support.
56
-	 *
57
-	 * @param string|WP_Error $errors Errors.
58
-	 */
59
-	public function error( $errors ) {
60
-		echo '<div class="lp-error">';
61
-		parent::error( $errors );
62
-		echo '</div>';
63
-	}
54
+    /**
55
+     * @since 5.9.0 Renamed `$error` to `$errors` for PHP 8 named parameter support.
56
+     *
57
+     * @param string|WP_Error $errors Errors.
58
+     */
59
+    public function error( $errors ) {
60
+        echo '<div class="lp-error">';
61
+        parent::error( $errors );
62
+        echo '</div>';
63
+    }
64 64
 
65
-	/**
66
-	 */
67
-	public function after() {
68
-		echo '</div>';
69
-	}
65
+    /**
66
+     */
67
+    public function after() {
68
+        echo '</div>';
69
+    }
70 70
 
71
-	/**
72
-	 */
73
-	public function bulk_footer() {
74
-		$this->decrement_update_count( 'translation' );
71
+    /**
72
+     */
73
+    public function bulk_footer() {
74
+        $this->decrement_update_count( 'translation' );
75 75
 
76
-		$update_actions = array(
77
-			'updates_page' => sprintf(
78
-				'<a href="%s" target="_parent">%s</a>',
79
-				self_admin_url( 'update-core.php' ),
80
-				__( 'Go to WordPress Updates page' )
81
-			),
82
-		);
76
+        $update_actions = array(
77
+            'updates_page' => sprintf(
78
+                '<a href="%s" target="_parent">%s</a>',
79
+                self_admin_url( 'update-core.php' ),
80
+                __( 'Go to WordPress Updates page' )
81
+            ),
82
+        );
83 83
 
84
-		/**
85
-		 * Filters the list of action links available following a translations update.
86
-		 *
87
-		 * @since 3.7.0
88
-		 *
89
-		 * @param string[] $update_actions Array of translations update links.
90
-		 */
91
-		$update_actions = apply_filters( 'update_translations_complete_actions', $update_actions );
84
+        /**
85
+         * Filters the list of action links available following a translations update.
86
+         *
87
+         * @since 3.7.0
88
+         *
89
+         * @param string[] $update_actions Array of translations update links.
90
+         */
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 ) );
95
-		}
96
-	}
93
+        if ( $update_actions && $this->display_footer_actions ) {
94
+            $this->feedback( implode( ' | ', $update_actions ) );
95
+        }
96
+    }
97 97
 }
Please login to merge, or discard this patch.
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -24,31 +24,31 @@  discard block
 block discarded – undo
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)&#8230;' ) . '</h2>', $name, $this->language_update->language );
51
+		printf('<h2>' . __('Updating translations for %1$s (%2$s)&#8230;') . '</h2>', $name, $this->language_update->language);
52 52
 	}
53 53
 
54 54
 	/**
@@ -56,9 +56,9 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
brighty/wp-admin/includes/noop.php 2 patches
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
  * @ignore
67 67
  */
68 68
 function is_admin() {
69
-	return true;}
69
+    return true;}
70 70
 
71 71
 /**
72 72
  * @ignore
@@ -95,11 +95,11 @@  discard block
 block discarded – undo
95 95
 
96 96
 function get_file( $path ) {
97 97
 
98
-	$path = realpath( $path );
98
+    $path = realpath( $path );
99 99
 
100
-	if ( ! $path || ! @is_file( $path ) ) {
101
-		return '';
102
-	}
100
+    if ( ! $path || ! @is_file( $path ) ) {
101
+        return '';
102
+    }
103 103
 
104
-	return @file_get_contents( $path );
104
+    return @file_get_contents( $path );
105 105
 }
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
brighty/wp-admin/includes/class-wp-plugins-list-table.php 2 patches
Indentation   +1340 added lines, -1340 removed lines patch added patch discarded remove patch
@@ -16,1357 +16,1357 @@
 block discarded – undo
16 16
  * @see WP_List_Table
17 17
  */
18 18
 class WP_Plugins_List_Table extends WP_List_Table {
19
-	/**
20
-	 * Whether to show the auto-updates UI.
21
-	 *
22
-	 * @since 5.5.0
23
-	 *
24
-	 * @var bool True if auto-updates UI is to be shown, false otherwise.
25
-	 */
26
-	protected $show_autoupdates = true;
27
-
28
-	/**
29
-	 * Constructor.
30
-	 *
31
-	 * @since 3.1.0
32
-	 *
33
-	 * @see WP_List_Table::__construct() for more information on default arguments.
34
-	 *
35
-	 * @global string $status
36
-	 * @global int    $page
37
-	 *
38
-	 * @param array $args An associative array of arguments.
39
-	 */
40
-	public function __construct( $args = array() ) {
41
-		global $status, $page;
42
-
43
-		parent::__construct(
44
-			array(
45
-				'plural' => 'plugins',
46
-				'screen' => isset( $args['screen'] ) ? $args['screen'] : null,
47
-			)
48
-		);
49
-
50
-		$allowed_statuses = array( 'active', 'inactive', 'recently_activated', 'upgrade', 'mustuse', 'dropins', 'search', 'paused', 'auto-update-enabled', 'auto-update-disabled' );
51
-
52
-		$status = 'all';
53
-		if ( isset( $_REQUEST['plugin_status'] ) && in_array( $_REQUEST['plugin_status'], $allowed_statuses, true ) ) {
54
-			$status = $_REQUEST['plugin_status'];
55
-		}
56
-
57
-		if ( isset( $_REQUEST['s'] ) ) {
58
-			$_SERVER['REQUEST_URI'] = add_query_arg( 's', wp_unslash( $_REQUEST['s'] ) );
59
-		}
60
-
61
-		$page = $this->get_pagenum();
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 );
67
-	}
68
-
69
-	/**
70
-	 * @return array
71
-	 */
72
-	protected function get_table_classes() {
73
-		return array( 'widefat', $this->_args['plural'] );
74
-	}
75
-
76
-	/**
77
-	 * @return bool
78
-	 */
79
-	public function ajax_user_can() {
80
-		return current_user_can( 'activate_plugins' );
81
-	}
82
-
83
-	/**
84
-	 * @global string $status
85
-	 * @global array  $plugins
86
-	 * @global array  $totals
87
-	 * @global int    $page
88
-	 * @global string $orderby
89
-	 * @global string $order
90
-	 * @global string $s
91
-	 */
92
-	public function prepare_items() {
93
-		global $status, $plugins, $totals, $page, $orderby, $order, $s;
94
-
95
-		wp_reset_vars( array( 'orderby', 'order' ) );
96
-
97
-		/**
98
-		 * Filters the full array of plugins to list in the Plugins list table.
99
-		 *
100
-		 * @since 3.0.0
101
-		 *
102
-		 * @see get_plugins()
103
-		 *
104
-		 * @param array $all_plugins An array of plugins to display in the list table.
105
-		 */
106
-		$all_plugins = apply_filters( 'all_plugins', get_plugins() );
107
-
108
-		$plugins = array(
109
-			'all'                => $all_plugins,
110
-			'search'             => array(),
111
-			'active'             => array(),
112
-			'inactive'           => array(),
113
-			'recently_activated' => array(),
114
-			'upgrade'            => array(),
115
-			'mustuse'            => array(),
116
-			'dropins'            => array(),
117
-			'paused'             => array(),
118
-		);
119
-		if ( $this->show_autoupdates ) {
120
-			$auto_updates = (array) get_site_option( 'auto_update_plugins', array() );
121
-
122
-			$plugins['auto-update-enabled']  = array();
123
-			$plugins['auto-update-disabled'] = array();
124
-		}
125
-
126
-		$screen = $this->screen;
127
-
128
-		if ( ! is_multisite() || ( $screen->in_admin( 'network' ) && current_user_can( 'manage_network_plugins' ) ) ) {
129
-
130
-			/**
131
-			 * Filters whether to display the advanced plugins list table.
132
-			 *
133
-			 * There are two types of advanced plugins - must-use and drop-ins -
134
-			 * which can be used in a single site or Multisite network.
135
-			 *
136
-			 * The $type parameter allows you to differentiate between the type of advanced
137
-			 * plugins to filter the display of. Contexts include 'mustuse' and 'dropins'.
138
-			 *
139
-			 * @since 3.0.0
140
-			 *
141
-			 * @param bool   $show Whether to show the advanced plugins for the specified
142
-			 *                     plugin type. Default true.
143
-			 * @param string $type The plugin type. Accepts 'mustuse', 'dropins'.
144
-			 */
145
-			if ( apply_filters( 'show_advanced_plugins', true, 'mustuse' ) ) {
146
-				$plugins['mustuse'] = get_mu_plugins();
147
-			}
148
-
149
-			/** This action is documented in wp-admin/includes/class-wp-plugins-list-table.php */
150
-			if ( apply_filters( 'show_advanced_plugins', true, 'dropins' ) ) {
151
-				$plugins['dropins'] = get_dropins();
152
-			}
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 ];
160
-					}
161
-				}
162
-			}
163
-		}
164
-
165
-		if ( ! $screen->in_admin( 'network' ) ) {
166
-			$show = current_user_can( 'manage_network_plugins' );
167
-			/**
168
-			 * Filters whether to display network-active plugins alongside plugins active for the current site.
169
-			 *
170
-			 * This also controls the display of inactive network-only plugins (plugins with
171
-			 * "Network: true" in the plugin header).
172
-			 *
173
-			 * Plugins cannot be network-activated or network-deactivated from this screen.
174
-			 *
175
-			 * @since 4.4.0
176
-			 *
177
-			 * @param bool $show Whether to show network-active plugins. Default is whether the current
178
-			 *                   user can manage network plugins (ie. a Super Admin).
179
-			 */
180
-			$show_network_active = apply_filters( 'show_network_active_plugins', $show );
181
-		}
182
-
183
-		if ( $screen->in_admin( 'network' ) ) {
184
-			$recently_activated = get_site_option( 'recently_activated', array() );
185
-		} else {
186
-			$recently_activated = get_option( 'recently_activated', array() );
187
-		}
188
-
189
-		foreach ( $recently_activated as $key => $time ) {
190
-			if ( $time + WEEK_IN_SECONDS < time() ) {
191
-				unset( $recently_activated[ $key ] );
192
-			}
193
-		}
194
-
195
-		if ( $screen->in_admin( 'network' ) ) {
196
-			update_site_option( 'recently_activated', $recently_activated );
197
-		} else {
198
-			update_option( 'recently_activated', $recently_activated );
199
-		}
200
-
201
-		$plugin_info = get_site_transient( 'update_plugins' );
202
-
203
-		foreach ( (array) $plugins['all'] as $plugin_file => $plugin_data ) {
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'] ) ) {
210
-				$plugin_data['update-supported'] = false;
211
-			}
212
-
213
-			/*
19
+    /**
20
+     * Whether to show the auto-updates UI.
21
+     *
22
+     * @since 5.5.0
23
+     *
24
+     * @var bool True if auto-updates UI is to be shown, false otherwise.
25
+     */
26
+    protected $show_autoupdates = true;
27
+
28
+    /**
29
+     * Constructor.
30
+     *
31
+     * @since 3.1.0
32
+     *
33
+     * @see WP_List_Table::__construct() for more information on default arguments.
34
+     *
35
+     * @global string $status
36
+     * @global int    $page
37
+     *
38
+     * @param array $args An associative array of arguments.
39
+     */
40
+    public function __construct( $args = array() ) {
41
+        global $status, $page;
42
+
43
+        parent::__construct(
44
+            array(
45
+                'plural' => 'plugins',
46
+                'screen' => isset( $args['screen'] ) ? $args['screen'] : null,
47
+            )
48
+        );
49
+
50
+        $allowed_statuses = array( 'active', 'inactive', 'recently_activated', 'upgrade', 'mustuse', 'dropins', 'search', 'paused', 'auto-update-enabled', 'auto-update-disabled' );
51
+
52
+        $status = 'all';
53
+        if ( isset( $_REQUEST['plugin_status'] ) && in_array( $_REQUEST['plugin_status'], $allowed_statuses, true ) ) {
54
+            $status = $_REQUEST['plugin_status'];
55
+        }
56
+
57
+        if ( isset( $_REQUEST['s'] ) ) {
58
+            $_SERVER['REQUEST_URI'] = add_query_arg( 's', wp_unslash( $_REQUEST['s'] ) );
59
+        }
60
+
61
+        $page = $this->get_pagenum();
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 );
67
+    }
68
+
69
+    /**
70
+     * @return array
71
+     */
72
+    protected function get_table_classes() {
73
+        return array( 'widefat', $this->_args['plural'] );
74
+    }
75
+
76
+    /**
77
+     * @return bool
78
+     */
79
+    public function ajax_user_can() {
80
+        return current_user_can( 'activate_plugins' );
81
+    }
82
+
83
+    /**
84
+     * @global string $status
85
+     * @global array  $plugins
86
+     * @global array  $totals
87
+     * @global int    $page
88
+     * @global string $orderby
89
+     * @global string $order
90
+     * @global string $s
91
+     */
92
+    public function prepare_items() {
93
+        global $status, $plugins, $totals, $page, $orderby, $order, $s;
94
+
95
+        wp_reset_vars( array( 'orderby', 'order' ) );
96
+
97
+        /**
98
+         * Filters the full array of plugins to list in the Plugins list table.
99
+         *
100
+         * @since 3.0.0
101
+         *
102
+         * @see get_plugins()
103
+         *
104
+         * @param array $all_plugins An array of plugins to display in the list table.
105
+         */
106
+        $all_plugins = apply_filters( 'all_plugins', get_plugins() );
107
+
108
+        $plugins = array(
109
+            'all'                => $all_plugins,
110
+            'search'             => array(),
111
+            'active'             => array(),
112
+            'inactive'           => array(),
113
+            'recently_activated' => array(),
114
+            'upgrade'            => array(),
115
+            'mustuse'            => array(),
116
+            'dropins'            => array(),
117
+            'paused'             => array(),
118
+        );
119
+        if ( $this->show_autoupdates ) {
120
+            $auto_updates = (array) get_site_option( 'auto_update_plugins', array() );
121
+
122
+            $plugins['auto-update-enabled']  = array();
123
+            $plugins['auto-update-disabled'] = array();
124
+        }
125
+
126
+        $screen = $this->screen;
127
+
128
+        if ( ! is_multisite() || ( $screen->in_admin( 'network' ) && current_user_can( 'manage_network_plugins' ) ) ) {
129
+
130
+            /**
131
+             * Filters whether to display the advanced plugins list table.
132
+             *
133
+             * There are two types of advanced plugins - must-use and drop-ins -
134
+             * which can be used in a single site or Multisite network.
135
+             *
136
+             * The $type parameter allows you to differentiate between the type of advanced
137
+             * plugins to filter the display of. Contexts include 'mustuse' and 'dropins'.
138
+             *
139
+             * @since 3.0.0
140
+             *
141
+             * @param bool   $show Whether to show the advanced plugins for the specified
142
+             *                     plugin type. Default true.
143
+             * @param string $type The plugin type. Accepts 'mustuse', 'dropins'.
144
+             */
145
+            if ( apply_filters( 'show_advanced_plugins', true, 'mustuse' ) ) {
146
+                $plugins['mustuse'] = get_mu_plugins();
147
+            }
148
+
149
+            /** This action is documented in wp-admin/includes/class-wp-plugins-list-table.php */
150
+            if ( apply_filters( 'show_advanced_plugins', true, 'dropins' ) ) {
151
+                $plugins['dropins'] = get_dropins();
152
+            }
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 ];
160
+                    }
161
+                }
162
+            }
163
+        }
164
+
165
+        if ( ! $screen->in_admin( 'network' ) ) {
166
+            $show = current_user_can( 'manage_network_plugins' );
167
+            /**
168
+             * Filters whether to display network-active plugins alongside plugins active for the current site.
169
+             *
170
+             * This also controls the display of inactive network-only plugins (plugins with
171
+             * "Network: true" in the plugin header).
172
+             *
173
+             * Plugins cannot be network-activated or network-deactivated from this screen.
174
+             *
175
+             * @since 4.4.0
176
+             *
177
+             * @param bool $show Whether to show network-active plugins. Default is whether the current
178
+             *                   user can manage network plugins (ie. a Super Admin).
179
+             */
180
+            $show_network_active = apply_filters( 'show_network_active_plugins', $show );
181
+        }
182
+
183
+        if ( $screen->in_admin( 'network' ) ) {
184
+            $recently_activated = get_site_option( 'recently_activated', array() );
185
+        } else {
186
+            $recently_activated = get_option( 'recently_activated', array() );
187
+        }
188
+
189
+        foreach ( $recently_activated as $key => $time ) {
190
+            if ( $time + WEEK_IN_SECONDS < time() ) {
191
+                unset( $recently_activated[ $key ] );
192
+            }
193
+        }
194
+
195
+        if ( $screen->in_admin( 'network' ) ) {
196
+            update_site_option( 'recently_activated', $recently_activated );
197
+        } else {
198
+            update_option( 'recently_activated', $recently_activated );
199
+        }
200
+
201
+        $plugin_info = get_site_transient( 'update_plugins' );
202
+
203
+        foreach ( (array) $plugins['all'] as $plugin_file => $plugin_data ) {
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'] ) ) {
210
+                $plugin_data['update-supported'] = false;
211
+            }
212
+
213
+            /*
214 214
 			 * Create the payload that's used for the auto_update_plugin filter.
215 215
 			 * This is the same data contained within $plugin_info->(response|no_update) however
216 216
 			 * not all plugins will be contained in those keys, this avoids unexpected warnings.
217 217
 			 */
218
-			$filter_payload = array(
219
-				'id'            => $plugin_file,
220
-				'slug'          => '',
221
-				'plugin'        => $plugin_file,
222
-				'new_version'   => '',
223
-				'url'           => '',
224
-				'package'       => '',
225
-				'icons'         => array(),
226
-				'banners'       => array(),
227
-				'banners_rtl'   => array(),
228
-				'tested'        => '',
229
-				'requires_php'  => '',
230
-				'compatibility' => new stdClass(),
231
-			);
232
-
233
-			$filter_payload = (object) wp_parse_args( $plugin_data, $filter_payload );
234
-
235
-			$auto_update_forced = wp_is_auto_update_forced_for_item( 'plugin', null, $filter_payload );
236
-
237
-			if ( ! is_null( $auto_update_forced ) ) {
238
-				$plugin_data['auto-update-forced'] = $auto_update_forced;
239
-			}
240
-
241
-			$plugins['all'][ $plugin_file ] = $plugin_data;
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;
245
-			}
246
-
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 ) {
250
-					// On the non-network screen, show inactive network-only plugins if allowed.
251
-					$plugins['inactive'][ $plugin_file ] = $plugin_data;
252
-				} else {
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 ] );
255
-				}
256
-			} elseif ( ! $screen->in_admin( 'network' ) && is_plugin_active_for_network( $plugin_file ) ) {
257
-				if ( $show_network_active ) {
258
-					// On the non-network screen, show network-active plugins if allowed.
259
-					$plugins['active'][ $plugin_file ] = $plugin_data;
260
-				} else {
261
-					// On the non-network screen, filter out network-active plugins.
262
-					unset( $plugins['all'][ $plugin_file ] );
263
-				}
264
-			} elseif ( ( ! $screen->in_admin( 'network' ) && is_plugin_active( $plugin_file ) )
265
-				|| ( $screen->in_admin( 'network' ) && is_plugin_active_for_network( $plugin_file ) ) ) {
266
-				// On the non-network screen, populate the active list with plugins that are individually activated.
267
-				// On the network admin screen, populate the active list with plugins that are network-activated.
268
-				$plugins['active'][ $plugin_file ] = $plugin_data;
269
-
270
-				if ( ! $screen->in_admin( 'network' ) && is_plugin_paused( $plugin_file ) ) {
271
-					$plugins['paused'][ $plugin_file ] = $plugin_data;
272
-				}
273
-			} else {
274
-				if ( isset( $recently_activated[ $plugin_file ] ) ) {
275
-					// Populate the recently activated list with plugins that have been recently activated.
276
-					$plugins['recently_activated'][ $plugin_file ] = $plugin_data;
277
-				}
278
-				// Populate the inactive list with plugins that aren't activated.
279
-				$plugins['inactive'][ $plugin_file ] = $plugin_data;
280
-			}
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'] ) ) {
285
-					$enabled = (bool) $plugin_data['auto-update-forced'];
286
-				}
287
-
288
-				if ( $enabled ) {
289
-					$plugins['auto-update-enabled'][ $plugin_file ] = $plugin_data;
290
-				} else {
291
-					$plugins['auto-update-disabled'][ $plugin_file ] = $plugin_data;
292
-				}
293
-			}
294
-		}
295
-
296
-		if ( strlen( $s ) ) {
297
-			$status            = 'search';
298
-			$plugins['search'] = array_filter( $plugins['all'], array( $this, '_search_callback' ) );
299
-		}
300
-
301
-		$totals = array();
302
-		foreach ( $plugins as $type => $list ) {
303
-			$totals[ $type ] = count( $list );
304
-		}
305
-
306
-		if ( empty( $plugins[ $status ] ) && ! in_array( $status, array( 'all', 'search' ), true ) ) {
307
-			$status = 'all';
308
-		}
309
-
310
-		$this->items = array();
311
-		foreach ( $plugins[ $status ] as $plugin_file => $plugin_data ) {
312
-			// Translate, don't apply markup, sanitize HTML.
313
-			$this->items[ $plugin_file ] = _get_plugin_data_markup_translate( $plugin_file, $plugin_data, false, true );
314
-		}
315
-
316
-		$total_this_page = $totals[ $status ];
317
-
318
-		$js_plugins = array();
319
-		foreach ( $plugins as $key => $list ) {
320
-			$js_plugins[ $key ] = array_keys( $list );
321
-		}
322
-
323
-		wp_localize_script(
324
-			'updates',
325
-			'_wpUpdatesItemCounts',
326
-			array(
327
-				'plugins' => $js_plugins,
328
-				'totals'  => wp_get_update_data(),
329
-			)
330
-		);
331
-
332
-		if ( ! $orderby ) {
333
-			$orderby = 'Name';
334
-		} else {
335
-			$orderby = ucfirst( $orderby );
336
-		}
337
-
338
-		$order = strtoupper( $order );
339
-
340
-		uasort( $this->items, array( $this, '_order_callback' ) );
341
-
342
-		$plugins_per_page = $this->get_items_per_page( str_replace( '-', '_', $screen->id . '_per_page' ), 999 );
343
-
344
-		$start = ( $page - 1 ) * $plugins_per_page;
345
-
346
-		if ( $total_this_page > $plugins_per_page ) {
347
-			$this->items = array_slice( $this->items, $start, $plugins_per_page );
348
-		}
349
-
350
-		$this->set_pagination_args(
351
-			array(
352
-				'total_items' => $total_this_page,
353
-				'per_page'    => $plugins_per_page,
354
-			)
355
-		);
356
-	}
357
-
358
-	/**
359
-	 * @global string $s URL encoded search term.
360
-	 *
361
-	 * @param array $plugin
362
-	 * @return bool
363
-	 */
364
-	public function _search_callback( $plugin ) {
365
-		global $s;
366
-
367
-		foreach ( $plugin as $value ) {
368
-			if ( is_string( $value ) && false !== stripos( strip_tags( $value ), urldecode( $s ) ) ) {
369
-				return true;
370
-			}
371
-		}
372
-
373
-		return false;
374
-	}
375
-
376
-	/**
377
-	 * @global string $orderby
378
-	 * @global string $order
379
-	 * @param array $plugin_a
380
-	 * @param array $plugin_b
381
-	 * @return int
382
-	 */
383
-	public function _order_callback( $plugin_a, $plugin_b ) {
384
-		global $orderby, $order;
385
-
386
-		$a = $plugin_a[ $orderby ];
387
-		$b = $plugin_b[ $orderby ];
388
-
389
-		if ( $a === $b ) {
390
-			return 0;
391
-		}
392
-
393
-		if ( 'DESC' === $order ) {
394
-			return strcasecmp( $b, $a );
395
-		} else {
396
-			return strcasecmp( $a, $b );
397
-		}
398
-	}
399
-
400
-	/**
401
-	 * @global array $plugins
402
-	 */
403
-	public function no_items() {
404
-		global $plugins;
405
-
406
-		if ( ! empty( $_REQUEST['s'] ) ) {
407
-			$s = esc_html( wp_unslash( $_REQUEST['s'] ) );
408
-
409
-			/* translators: %s: Plugin search term. */
410
-			printf( __( 'No plugins found for: %s.' ), '<strong>' . $s . '</strong>' );
411
-
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>';
415
-			}
416
-		} elseif ( ! empty( $plugins['all'] ) ) {
417
-			_e( 'No plugins found.' );
418
-		} else {
419
-			_e( 'No plugins are currently available.' );
420
-		}
421
-	}
422
-
423
-	/**
424
-	 * Displays the search box.
425
-	 *
426
-	 * @since 4.6.0
427
-	 *
428
-	 * @param string $text     The 'submit' button label.
429
-	 * @param string $input_id ID attribute value for the search input field.
430
-	 */
431
-	public function search_box( $text, $input_id ) {
432
-		if ( empty( $_REQUEST['s'] ) && ! $this->has_items() ) {
433
-			return;
434
-		}
435
-
436
-		$input_id = $input_id . '-search-input';
437
-
438
-		if ( ! empty( $_REQUEST['orderby'] ) ) {
439
-			echo '<input type="hidden" name="orderby" value="' . esc_attr( $_REQUEST['orderby'] ) . '" />';
440
-		}
441
-		if ( ! empty( $_REQUEST['order'] ) ) {
442
-			echo '<input type="hidden" name="order" value="' . esc_attr( $_REQUEST['order'] ) . '" />';
443
-		}
444
-		?>
218
+            $filter_payload = array(
219
+                'id'            => $plugin_file,
220
+                'slug'          => '',
221
+                'plugin'        => $plugin_file,
222
+                'new_version'   => '',
223
+                'url'           => '',
224
+                'package'       => '',
225
+                'icons'         => array(),
226
+                'banners'       => array(),
227
+                'banners_rtl'   => array(),
228
+                'tested'        => '',
229
+                'requires_php'  => '',
230
+                'compatibility' => new stdClass(),
231
+            );
232
+
233
+            $filter_payload = (object) wp_parse_args( $plugin_data, $filter_payload );
234
+
235
+            $auto_update_forced = wp_is_auto_update_forced_for_item( 'plugin', null, $filter_payload );
236
+
237
+            if ( ! is_null( $auto_update_forced ) ) {
238
+                $plugin_data['auto-update-forced'] = $auto_update_forced;
239
+            }
240
+
241
+            $plugins['all'][ $plugin_file ] = $plugin_data;
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;
245
+            }
246
+
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 ) {
250
+                    // On the non-network screen, show inactive network-only plugins if allowed.
251
+                    $plugins['inactive'][ $plugin_file ] = $plugin_data;
252
+                } else {
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 ] );
255
+                }
256
+            } elseif ( ! $screen->in_admin( 'network' ) && is_plugin_active_for_network( $plugin_file ) ) {
257
+                if ( $show_network_active ) {
258
+                    // On the non-network screen, show network-active plugins if allowed.
259
+                    $plugins['active'][ $plugin_file ] = $plugin_data;
260
+                } else {
261
+                    // On the non-network screen, filter out network-active plugins.
262
+                    unset( $plugins['all'][ $plugin_file ] );
263
+                }
264
+            } elseif ( ( ! $screen->in_admin( 'network' ) && is_plugin_active( $plugin_file ) )
265
+                || ( $screen->in_admin( 'network' ) && is_plugin_active_for_network( $plugin_file ) ) ) {
266
+                // On the non-network screen, populate the active list with plugins that are individually activated.
267
+                // On the network admin screen, populate the active list with plugins that are network-activated.
268
+                $plugins['active'][ $plugin_file ] = $plugin_data;
269
+
270
+                if ( ! $screen->in_admin( 'network' ) && is_plugin_paused( $plugin_file ) ) {
271
+                    $plugins['paused'][ $plugin_file ] = $plugin_data;
272
+                }
273
+            } else {
274
+                if ( isset( $recently_activated[ $plugin_file ] ) ) {
275
+                    // Populate the recently activated list with plugins that have been recently activated.
276
+                    $plugins['recently_activated'][ $plugin_file ] = $plugin_data;
277
+                }
278
+                // Populate the inactive list with plugins that aren't activated.
279
+                $plugins['inactive'][ $plugin_file ] = $plugin_data;
280
+            }
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'] ) ) {
285
+                    $enabled = (bool) $plugin_data['auto-update-forced'];
286
+                }
287
+
288
+                if ( $enabled ) {
289
+                    $plugins['auto-update-enabled'][ $plugin_file ] = $plugin_data;
290
+                } else {
291
+                    $plugins['auto-update-disabled'][ $plugin_file ] = $plugin_data;
292
+                }
293
+            }
294
+        }
295
+
296
+        if ( strlen( $s ) ) {
297
+            $status            = 'search';
298
+            $plugins['search'] = array_filter( $plugins['all'], array( $this, '_search_callback' ) );
299
+        }
300
+
301
+        $totals = array();
302
+        foreach ( $plugins as $type => $list ) {
303
+            $totals[ $type ] = count( $list );
304
+        }
305
+
306
+        if ( empty( $plugins[ $status ] ) && ! in_array( $status, array( 'all', 'search' ), true ) ) {
307
+            $status = 'all';
308
+        }
309
+
310
+        $this->items = array();
311
+        foreach ( $plugins[ $status ] as $plugin_file => $plugin_data ) {
312
+            // Translate, don't apply markup, sanitize HTML.
313
+            $this->items[ $plugin_file ] = _get_plugin_data_markup_translate( $plugin_file, $plugin_data, false, true );
314
+        }
315
+
316
+        $total_this_page = $totals[ $status ];
317
+
318
+        $js_plugins = array();
319
+        foreach ( $plugins as $key => $list ) {
320
+            $js_plugins[ $key ] = array_keys( $list );
321
+        }
322
+
323
+        wp_localize_script(
324
+            'updates',
325
+            '_wpUpdatesItemCounts',
326
+            array(
327
+                'plugins' => $js_plugins,
328
+                'totals'  => wp_get_update_data(),
329
+            )
330
+        );
331
+
332
+        if ( ! $orderby ) {
333
+            $orderby = 'Name';
334
+        } else {
335
+            $orderby = ucfirst( $orderby );
336
+        }
337
+
338
+        $order = strtoupper( $order );
339
+
340
+        uasort( $this->items, array( $this, '_order_callback' ) );
341
+
342
+        $plugins_per_page = $this->get_items_per_page( str_replace( '-', '_', $screen->id . '_per_page' ), 999 );
343
+
344
+        $start = ( $page - 1 ) * $plugins_per_page;
345
+
346
+        if ( $total_this_page > $plugins_per_page ) {
347
+            $this->items = array_slice( $this->items, $start, $plugins_per_page );
348
+        }
349
+
350
+        $this->set_pagination_args(
351
+            array(
352
+                'total_items' => $total_this_page,
353
+                'per_page'    => $plugins_per_page,
354
+            )
355
+        );
356
+    }
357
+
358
+    /**
359
+     * @global string $s URL encoded search term.
360
+     *
361
+     * @param array $plugin
362
+     * @return bool
363
+     */
364
+    public function _search_callback( $plugin ) {
365
+        global $s;
366
+
367
+        foreach ( $plugin as $value ) {
368
+            if ( is_string( $value ) && false !== stripos( strip_tags( $value ), urldecode( $s ) ) ) {
369
+                return true;
370
+            }
371
+        }
372
+
373
+        return false;
374
+    }
375
+
376
+    /**
377
+     * @global string $orderby
378
+     * @global string $order
379
+     * @param array $plugin_a
380
+     * @param array $plugin_b
381
+     * @return int
382
+     */
383
+    public function _order_callback( $plugin_a, $plugin_b ) {
384
+        global $orderby, $order;
385
+
386
+        $a = $plugin_a[ $orderby ];
387
+        $b = $plugin_b[ $orderby ];
388
+
389
+        if ( $a === $b ) {
390
+            return 0;
391
+        }
392
+
393
+        if ( 'DESC' === $order ) {
394
+            return strcasecmp( $b, $a );
395
+        } else {
396
+            return strcasecmp( $a, $b );
397
+        }
398
+    }
399
+
400
+    /**
401
+     * @global array $plugins
402
+     */
403
+    public function no_items() {
404
+        global $plugins;
405
+
406
+        if ( ! empty( $_REQUEST['s'] ) ) {
407
+            $s = esc_html( wp_unslash( $_REQUEST['s'] ) );
408
+
409
+            /* translators: %s: Plugin search term. */
410
+            printf( __( 'No plugins found for: %s.' ), '<strong>' . $s . '</strong>' );
411
+
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>';
415
+            }
416
+        } elseif ( ! empty( $plugins['all'] ) ) {
417
+            _e( 'No plugins found.' );
418
+        } else {
419
+            _e( 'No plugins are currently available.' );
420
+        }
421
+    }
422
+
423
+    /**
424
+     * Displays the search box.
425
+     *
426
+     * @since 4.6.0
427
+     *
428
+     * @param string $text     The 'submit' button label.
429
+     * @param string $input_id ID attribute value for the search input field.
430
+     */
431
+    public function search_box( $text, $input_id ) {
432
+        if ( empty( $_REQUEST['s'] ) && ! $this->has_items() ) {
433
+            return;
434
+        }
435
+
436
+        $input_id = $input_id . '-search-input';
437
+
438
+        if ( ! empty( $_REQUEST['orderby'] ) ) {
439
+            echo '<input type="hidden" name="orderby" value="' . esc_attr( $_REQUEST['orderby'] ) . '" />';
440
+        }
441
+        if ( ! empty( $_REQUEST['order'] ) ) {
442
+            echo '<input type="hidden" name="order" value="' . esc_attr( $_REQUEST['order'] ) . '" />';
443
+        }
444
+        ?>
445 445
 		<p class="search-box">
446 446
 			<label class="screen-reader-text" for="<?php echo esc_attr( $input_id ); ?>"><?php echo $text; ?>:</label>
447 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 448
 			<?php submit_button( $text, 'hide-if-js', '', false, array( 'id' => 'search-submit' ) ); ?>
449 449
 		</p>
450 450
 		<?php
451
-	}
452
-
453
-	/**
454
-	 * @global string $status
455
-	 * @return array
456
-	 */
457
-	public function get_columns() {
458
-		global $status;
459
-
460
-		$columns = array(
461
-			'cb'          => ! in_array( $status, array( 'mustuse', 'dropins' ), true ) ? '<input type="checkbox" />' : '',
462
-			'name'        => __( 'Plugin' ),
463
-			'description' => __( 'Description' ),
464
-		);
465
-
466
-		if ( $this->show_autoupdates ) {
467
-			$columns['auto-updates'] = __( 'Automatic Updates' );
468
-		}
469
-
470
-		return $columns;
471
-	}
472
-
473
-	/**
474
-	 * @return array
475
-	 */
476
-	protected function get_sortable_columns() {
477
-		return array();
478
-	}
479
-
480
-	/**
481
-	 * @global array $totals
482
-	 * @global string $status
483
-	 * @return array
484
-	 */
485
-	protected function get_views() {
486
-		global $totals, $status;
487
-
488
-		$status_links = array();
489
-		foreach ( $totals as $type => $count ) {
490
-			if ( ! $count ) {
491
-				continue;
492
-			}
493
-
494
-			switch ( $type ) {
495
-				case 'all':
496
-					/* translators: %s: Number of plugins. */
497
-					$text = _nx(
498
-						'All <span class="count">(%s)</span>',
499
-						'All <span class="count">(%s)</span>',
500
-						$count,
501
-						'plugins'
502
-					);
503
-					break;
504
-				case 'active':
505
-					/* translators: %s: Number of plugins. */
506
-					$text = _n(
507
-						'Active <span class="count">(%s)</span>',
508
-						'Active <span class="count">(%s)</span>',
509
-						$count
510
-					);
511
-					break;
512
-				case 'recently_activated':
513
-					/* translators: %s: Number of plugins. */
514
-					$text = _n(
515
-						'Recently Active <span class="count">(%s)</span>',
516
-						'Recently Active <span class="count">(%s)</span>',
517
-						$count
518
-					);
519
-					break;
520
-				case 'inactive':
521
-					/* translators: %s: Number of plugins. */
522
-					$text = _n(
523
-						'Inactive <span class="count">(%s)</span>',
524
-						'Inactive <span class="count">(%s)</span>',
525
-						$count
526
-					);
527
-					break;
528
-				case 'mustuse':
529
-					/* translators: %s: Number of plugins. */
530
-					$text = _n(
531
-						'Must-Use <span class="count">(%s)</span>',
532
-						'Must-Use <span class="count">(%s)</span>',
533
-						$count
534
-					);
535
-					break;
536
-				case 'dropins':
537
-					/* translators: %s: Number of plugins. */
538
-					$text = _n(
539
-						'Drop-in <span class="count">(%s)</span>',
540
-						'Drop-ins <span class="count">(%s)</span>',
541
-						$count
542
-					);
543
-					break;
544
-				case 'paused':
545
-					/* translators: %s: Number of plugins. */
546
-					$text = _n(
547
-						'Paused <span class="count">(%s)</span>',
548
-						'Paused <span class="count">(%s)</span>',
549
-						$count
550
-					);
551
-					break;
552
-				case 'upgrade':
553
-					/* translators: %s: Number of plugins. */
554
-					$text = _n(
555
-						'Update Available <span class="count">(%s)</span>',
556
-						'Update Available <span class="count">(%s)</span>',
557
-						$count
558
-					);
559
-					break;
560
-				case 'auto-update-enabled':
561
-					/* translators: %s: Number of plugins. */
562
-					$text = _n(
563
-						'Auto-updates Enabled <span class="count">(%s)</span>',
564
-						'Auto-updates Enabled <span class="count">(%s)</span>',
565
-						$count
566
-					);
567
-					break;
568
-				case 'auto-update-disabled':
569
-					/* translators: %s: Number of plugins. */
570
-					$text = _n(
571
-						'Auto-updates Disabled <span class="count">(%s)</span>',
572
-						'Auto-updates Disabled <span class="count">(%s)</span>',
573
-						$count
574
-					);
575
-					break;
576
-			}
577
-
578
-			if ( 'search' !== $type ) {
579
-				$status_links[ $type ] = sprintf(
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 ) )
584
-				);
585
-			}
586
-		}
587
-
588
-		return $status_links;
589
-	}
590
-
591
-	/**
592
-	 * @global string $status
593
-	 * @return array
594
-	 */
595
-	protected function get_bulk_actions() {
596
-		global $status;
597
-
598
-		$actions = array();
599
-
600
-		if ( 'active' !== $status ) {
601
-			$actions['activate-selected'] = $this->screen->in_admin( 'network' ) ? __( 'Network Activate' ) : __( 'Activate' );
602
-		}
603
-
604
-		if ( 'inactive' !== $status && 'recent' !== $status ) {
605
-			$actions['deactivate-selected'] = $this->screen->in_admin( 'network' ) ? __( 'Network Deactivate' ) : __( 'Deactivate' );
606
-		}
607
-
608
-		if ( ! is_multisite() || $this->screen->in_admin( 'network' ) ) {
609
-			if ( current_user_can( 'update_plugins' ) ) {
610
-				$actions['update-selected'] = __( 'Update' );
611
-			}
612
-
613
-			if ( current_user_can( 'delete_plugins' ) && ( 'active' !== $status ) ) {
614
-				$actions['delete-selected'] = __( 'Delete' );
615
-			}
616
-
617
-			if ( $this->show_autoupdates ) {
618
-				if ( 'auto-update-enabled' !== $status ) {
619
-					$actions['enable-auto-update-selected'] = __( 'Enable Auto-updates' );
620
-				}
621
-				if ( 'auto-update-disabled' !== $status ) {
622
-					$actions['disable-auto-update-selected'] = __( 'Disable Auto-updates' );
623
-				}
624
-			}
625
-		}
626
-
627
-		return $actions;
628
-	}
629
-
630
-	/**
631
-	 * @global string $status
632
-	 * @param string $which
633
-	 */
634
-	public function bulk_actions( $which = '' ) {
635
-		global $status;
636
-
637
-		if ( in_array( $status, array( 'mustuse', 'dropins' ), true ) ) {
638
-			return;
639
-		}
640
-
641
-		parent::bulk_actions( $which );
642
-	}
643
-
644
-	/**
645
-	 * @global string $status
646
-	 * @param string $which
647
-	 */
648
-	protected function extra_tablenav( $which ) {
649
-		global $status;
650
-
651
-		if ( ! in_array( $status, array( 'recently_activated', 'mustuse', 'dropins' ), true ) ) {
652
-			return;
653
-		}
654
-
655
-		echo '<div class="alignleft actions">';
656
-
657
-		if ( 'recently_activated' === $status ) {
658
-			submit_button( __( 'Clear List' ), '', 'clear-recent-list', false );
659
-		} elseif ( 'top' === $which && 'mustuse' === $status ) {
660
-			echo '<p>' . sprintf(
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>'
664
-			) . '</p>';
665
-		} elseif ( 'top' === $which && 'dropins' === $status ) {
666
-			echo '<p>' . sprintf(
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>'
670
-			) . '</p>';
671
-		}
672
-		echo '</div>';
673
-	}
674
-
675
-	/**
676
-	 * @return string
677
-	 */
678
-	public function current_action() {
679
-		if ( isset( $_POST['clear-recent-list'] ) ) {
680
-			return 'clear-recent-list';
681
-		}
682
-
683
-		return parent::current_action();
684
-	}
685
-
686
-	/**
687
-	 * @global string $status
688
-	 */
689
-	public function display_rows() {
690
-		global $status;
691
-
692
-		if ( is_multisite() && ! $this->screen->in_admin( 'network' ) && in_array( $status, array( 'mustuse', 'dropins' ), true ) ) {
693
-			return;
694
-		}
695
-
696
-		foreach ( $this->items as $plugin_file => $plugin_data ) {
697
-			$this->single_row( array( $plugin_file, $plugin_data ) );
698
-		}
699
-	}
700
-
701
-	/**
702
-	 * @global string $status
703
-	 * @global int $page
704
-	 * @global string $s
705
-	 * @global array $totals
706
-	 *
707
-	 * @param array $item
708
-	 */
709
-	public function single_row( $item ) {
710
-		global $status, $page, $s, $totals;
711
-		static $plugin_id_attrs = array();
712
-
713
-		list( $plugin_file, $plugin_data ) = $item;
714
-
715
-		$plugin_slug    = isset( $plugin_data['slug'] ) ? $plugin_data['slug'] : sanitize_title( $plugin_data['Name'] );
716
-		$plugin_id_attr = $plugin_slug;
717
-
718
-		// Ensure the ID attribute is unique.
719
-		$suffix = 2;
720
-		while ( in_array( $plugin_id_attr, $plugin_id_attrs, true ) ) {
721
-			$plugin_id_attr = "$plugin_slug-$suffix";
722
-			$suffix++;
723
-		}
724
-
725
-		$plugin_id_attrs[] = $plugin_id_attr;
726
-
727
-		$context = $status;
728
-		$screen  = $this->screen;
729
-
730
-		// Pre-order.
731
-		$actions = array(
732
-			'deactivate' => '',
733
-			'activate'   => '',
734
-			'details'    => '',
735
-			'delete'     => '',
736
-		);
737
-
738
-		// Do not restrict by default.
739
-		$restrict_network_active = false;
740
-		$restrict_network_only   = false;
741
-
742
-		$requires_php = isset( $plugin_data['RequiresPHP'] ) ? $plugin_data['RequiresPHP'] : null;
743
-		$requires_wp  = isset( $plugin_data['RequiresWP'] ) ? $plugin_data['RequiresWP'] : null;
744
-
745
-		$compatible_php = is_php_version_compatible( $requires_php );
746
-		$compatible_wp  = is_wp_version_compatible( $requires_wp );
747
-
748
-		if ( 'mustuse' === $context ) {
749
-			$is_active = true;
750
-		} elseif ( 'dropins' === $context ) {
751
-			$dropins     = _get_dropins();
752
-			$plugin_name = $plugin_file;
753
-
754
-			if ( $plugin_file !== $plugin_data['Name'] ) {
755
-				$plugin_name .= '<br/>' . $plugin_data['Name'];
756
-			}
757
-
758
-			if ( true === ( $dropins[ $plugin_file ][1] ) ) { // Doesn't require a constant.
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.
762
-				$is_active   = true;
763
-				$description = '<p><strong>' . $dropins[ $plugin_file ][0] . '</strong></p>';
764
-			} else {
765
-				$is_active   = false;
766
-				$description = '<p><strong>' . $dropins[ $plugin_file ][0] . ' <span class="error-message">' . __( 'Inactive:' ) . '</span></strong> ' .
767
-					sprintf(
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>",
771
-						'<code>wp-config.php</code>'
772
-					) . '</p>';
773
-			}
774
-
775
-			if ( $plugin_data['Description'] ) {
776
-				$description .= '<p>' . $plugin_data['Description'] . '</p>';
777
-			}
778
-		} else {
779
-			if ( $screen->in_admin( 'network' ) ) {
780
-				$is_active = is_plugin_active_for_network( $plugin_file );
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 );
785
-			}
786
-
787
-			if ( $screen->in_admin( 'network' ) ) {
788
-				if ( $is_active ) {
789
-					if ( current_user_can( 'manage_network_plugins' ) ) {
790
-						$actions['deactivate'] = sprintf(
791
-							'<a href="%s" id="deactivate-%s" aria-label="%s">%s</a>',
792
-							wp_nonce_url( 'plugins.php?action=deactivate&amp;plugin=' . urlencode( $plugin_file ) . '&amp;plugin_status=' . $context . '&amp;paged=' . $page . '&amp;s=' . $s, 'deactivate-plugin_' . $plugin_file ),
793
-							esc_attr( $plugin_id_attr ),
794
-							/* translators: %s: Plugin name. */
795
-							esc_attr( sprintf( _x( 'Network Deactivate %s', 'plugin' ), $plugin_data['Name'] ) ),
796
-							__( 'Network Deactivate' )
797
-						);
798
-					}
799
-				} else {
800
-					if ( current_user_can( 'manage_network_plugins' ) ) {
801
-						if ( $compatible_php && $compatible_wp ) {
802
-							$actions['activate'] = sprintf(
803
-								'<a href="%s" id="activate-%s" class="edit" aria-label="%s">%s</a>',
804
-								wp_nonce_url( 'plugins.php?action=activate&amp;plugin=' . urlencode( $plugin_file ) . '&amp;plugin_status=' . $context . '&amp;paged=' . $page . '&amp;s=' . $s, 'activate-plugin_' . $plugin_file ),
805
-								esc_attr( $plugin_id_attr ),
806
-								/* translators: %s: Plugin name. */
807
-								esc_attr( sprintf( _x( 'Network Activate %s', 'plugin' ), $plugin_data['Name'] ) ),
808
-								__( 'Network Activate' )
809
-							);
810
-						} else {
811
-							$actions['activate'] = sprintf(
812
-								'<span>%s</span>',
813
-								_x( 'Cannot Activate', 'plugin' )
814
-							);
815
-						}
816
-					}
817
-
818
-					if ( current_user_can( 'delete_plugins' ) && ! is_plugin_active( $plugin_file ) ) {
819
-						$actions['delete'] = sprintf(
820
-							'<a href="%s" id="delete-%s" class="delete" aria-label="%s">%s</a>',
821
-							wp_nonce_url( 'plugins.php?action=delete-selected&amp;checked[]=' . urlencode( $plugin_file ) . '&amp;plugin_status=' . $context . '&amp;paged=' . $page . '&amp;s=' . $s, 'bulk-plugins' ),
822
-							esc_attr( $plugin_id_attr ),
823
-							/* translators: %s: Plugin name. */
824
-							esc_attr( sprintf( _x( 'Delete %s', 'plugin' ), $plugin_data['Name'] ) ),
825
-							__( 'Delete' )
826
-						);
827
-					}
828
-				}
829
-			} else {
830
-				if ( $restrict_network_active ) {
831
-					$actions = array(
832
-						'network_active' => __( 'Network Active' ),
833
-					);
834
-				} elseif ( $restrict_network_only ) {
835
-					$actions = array(
836
-						'network_only' => __( 'Network Only' ),
837
-					);
838
-				} elseif ( $is_active ) {
839
-					if ( current_user_can( 'deactivate_plugin', $plugin_file ) ) {
840
-						$actions['deactivate'] = sprintf(
841
-							'<a href="%s" id="deactivate-%s" aria-label="%s">%s</a>',
842
-							wp_nonce_url( 'plugins.php?action=deactivate&amp;plugin=' . urlencode( $plugin_file ) . '&amp;plugin_status=' . $context . '&amp;paged=' . $page . '&amp;s=' . $s, 'deactivate-plugin_' . $plugin_file ),
843
-							esc_attr( $plugin_id_attr ),
844
-							/* translators: %s: Plugin name. */
845
-							esc_attr( sprintf( _x( 'Deactivate %s', 'plugin' ), $plugin_data['Name'] ) ),
846
-							__( 'Deactivate' )
847
-						);
848
-					}
849
-
850
-					if ( current_user_can( 'resume_plugin', $plugin_file ) && is_plugin_paused( $plugin_file ) ) {
851
-						$actions['resume'] = sprintf(
852
-							'<a href="%s" id="resume-%s" class="resume-link" aria-label="%s">%s</a>',
853
-							wp_nonce_url( 'plugins.php?action=resume&amp;plugin=' . urlencode( $plugin_file ) . '&amp;plugin_status=' . $context . '&amp;paged=' . $page . '&amp;s=' . $s, 'resume-plugin_' . $plugin_file ),
854
-							esc_attr( $plugin_id_attr ),
855
-							/* translators: %s: Plugin name. */
856
-							esc_attr( sprintf( _x( 'Resume %s', 'plugin' ), $plugin_data['Name'] ) ),
857
-							__( 'Resume' )
858
-						);
859
-					}
860
-				} else {
861
-					if ( current_user_can( 'activate_plugin', $plugin_file ) ) {
862
-						if ( $compatible_php && $compatible_wp ) {
863
-							$actions['activate'] = sprintf(
864
-								'<a href="%s" id="activate-%s" class="edit" aria-label="%s">%s</a>',
865
-								wp_nonce_url( 'plugins.php?action=activate&amp;plugin=' . urlencode( $plugin_file ) . '&amp;plugin_status=' . $context . '&amp;paged=' . $page . '&amp;s=' . $s, 'activate-plugin_' . $plugin_file ),
866
-								esc_attr( $plugin_id_attr ),
867
-								/* translators: %s: Plugin name. */
868
-								esc_attr( sprintf( _x( 'Activate %s', 'plugin' ), $plugin_data['Name'] ) ),
869
-								__( 'Activate' )
870
-							);
871
-						} else {
872
-							$actions['activate'] = sprintf(
873
-								'<span>%s</span>',
874
-								_x( 'Cannot Activate', 'plugin' )
875
-							);
876
-						}
877
-					}
878
-
879
-					if ( ! is_multisite() && current_user_can( 'delete_plugins' ) ) {
880
-						$actions['delete'] = sprintf(
881
-							'<a href="%s" id="delete-%s" class="delete" aria-label="%s">%s</a>',
882
-							wp_nonce_url( 'plugins.php?action=delete-selected&amp;checked[]=' . urlencode( $plugin_file ) . '&amp;plugin_status=' . $context . '&amp;paged=' . $page . '&amp;s=' . $s, 'bulk-plugins' ),
883
-							esc_attr( $plugin_id_attr ),
884
-							/* translators: %s: Plugin name. */
885
-							esc_attr( sprintf( _x( 'Delete %s', 'plugin' ), $plugin_data['Name'] ) ),
886
-							__( 'Delete' )
887
-						);
888
-					}
889
-				} // End if $is_active.
890
-			} // End if $screen->in_admin( 'network' ).
891
-		} // End if $context.
892
-
893
-		$actions = array_filter( $actions );
894
-
895
-		if ( $screen->in_admin( 'network' ) ) {
896
-
897
-			/**
898
-			 * Filters the action links displayed for each plugin in the Network Admin Plugins list table.
899
-			 *
900
-			 * @since 3.1.0
901
-			 *
902
-			 * @param string[] $actions     An array of plugin action links. By default this can include
903
-			 *                              'activate', 'deactivate', and 'delete'.
904
-			 * @param string   $plugin_file Path to the plugin file relative to the plugins directory.
905
-			 * @param array    $plugin_data An array of plugin data. See `get_plugin_data()`
906
-			 *                              and the {@see 'plugin_row_meta'} filter for the list
907
-			 *                              of possible values.
908
-			 * @param string   $context     The plugin context. By default this can include 'all',
909
-			 *                              'active', 'inactive', 'recently_activated', 'upgrade',
910
-			 *                              'mustuse', 'dropins', and 'search'.
911
-			 */
912
-			$actions = apply_filters( 'network_admin_plugin_action_links', $actions, $plugin_file, $plugin_data, $context );
913
-
914
-			/**
915
-			 * Filters the list of action links displayed for a specific plugin in the Network Admin Plugins list table.
916
-			 *
917
-			 * The dynamic portion of the hook name, `$plugin_file`, refers to the path
918
-			 * to the plugin file, relative to the plugins directory.
919
-			 *
920
-			 * @since 3.1.0
921
-			 *
922
-			 * @param string[] $actions     An array of plugin action links. By default this can include
923
-			 *                              'activate', 'deactivate', and 'delete'.
924
-			 * @param string   $plugin_file Path to the plugin file relative to the plugins directory.
925
-			 * @param array    $plugin_data An array of plugin data. See `get_plugin_data()`
926
-			 *                              and the {@see 'plugin_row_meta'} filter for the list
927
-			 *                              of possible values.
928
-			 * @param string   $context     The plugin context. By default this can include 'all',
929
-			 *                              'active', 'inactive', 'recently_activated', 'upgrade',
930
-			 *                              'mustuse', 'dropins', and 'search'.
931
-			 */
932
-			$actions = apply_filters( "network_admin_plugin_action_links_{$plugin_file}", $actions, $plugin_file, $plugin_data, $context );
933
-
934
-		} else {
935
-
936
-			/**
937
-			 * Filters the action links displayed for each plugin in the Plugins list table.
938
-			 *
939
-			 * @since 2.5.0
940
-			 * @since 2.6.0 The `$context` parameter was added.
941
-			 * @since 4.9.0 The 'Edit' link was removed from the list of action links.
942
-			 *
943
-			 * @param string[] $actions     An array of plugin action links. By default this can include
944
-			 *                              'activate', 'deactivate', and 'delete'. With Multisite active
945
-			 *                              this can also include 'network_active' and 'network_only' items.
946
-			 * @param string   $plugin_file Path to the plugin file relative to the plugins directory.
947
-			 * @param array    $plugin_data An array of plugin data. See `get_plugin_data()`
948
-			 *                              and the {@see 'plugin_row_meta'} filter for the list
949
-			 *                              of possible values.
950
-			 * @param string   $context     The plugin context. By default this can include 'all',
951
-			 *                              'active', 'inactive', 'recently_activated', 'upgrade',
952
-			 *                              'mustuse', 'dropins', and 'search'.
953
-			 */
954
-			$actions = apply_filters( 'plugin_action_links', $actions, $plugin_file, $plugin_data, $context );
955
-
956
-			/**
957
-			 * Filters the list of action links displayed for a specific plugin in the Plugins list table.
958
-			 *
959
-			 * The dynamic portion of the hook name, `$plugin_file`, refers to the path
960
-			 * to the plugin file, relative to the plugins directory.
961
-			 *
962
-			 * @since 2.7.0
963
-			 * @since 4.9.0 The 'Edit' link was removed from the list of action links.
964
-			 *
965
-			 * @param string[] $actions     An array of plugin action links. By default this can include
966
-			 *                              'activate', 'deactivate', and 'delete'. With Multisite active
967
-			 *                              this can also include 'network_active' and 'network_only' items.
968
-			 * @param string   $plugin_file Path to the plugin file relative to the plugins directory.
969
-			 * @param array    $plugin_data An array of plugin data. See `get_plugin_data()`
970
-			 *                              and the {@see 'plugin_row_meta'} filter for the list
971
-			 *                              of possible values.
972
-			 * @param string   $context     The plugin context. By default this can include 'all',
973
-			 *                              'active', 'inactive', 'recently_activated', 'upgrade',
974
-			 *                              'mustuse', 'dropins', and 'search'.
975
-			 */
976
-			$actions = apply_filters( "plugin_action_links_{$plugin_file}", $actions, $plugin_file, $plugin_data, $context );
977
-
978
-		}
979
-
980
-		$class       = $is_active ? 'active' : 'inactive';
981
-		$checkbox_id = 'checkbox_' . md5( $plugin_file );
982
-
983
-		if ( $restrict_network_active || $restrict_network_only || in_array( $status, array( 'mustuse', 'dropins' ), true ) || ! $compatible_php ) {
984
-			$checkbox = '';
985
-		} else {
986
-			$checkbox = sprintf(
987
-				'<label class="screen-reader-text" for="%1$s">%2$s</label>' .
988
-				'<input type="checkbox" name="checked[]" value="%3$s" id="%1$s" />',
989
-				$checkbox_id,
990
-				/* translators: %s: Plugin name. */
991
-				sprintf( __( 'Select %s' ), $plugin_data['Name'] ),
992
-				esc_attr( $plugin_file )
993
-			);
994
-		}
995
-
996
-		if ( 'dropins' !== $context ) {
997
-			$description = '<p>' . ( $plugin_data['Description'] ? $plugin_data['Description'] : '&nbsp;' ) . '</p>';
998
-			$plugin_name = $plugin_data['Name'];
999
-		}
1000
-
1001
-		if ( ! empty( $totals['upgrade'] ) && ! empty( $plugin_data['update'] )
1002
-			|| ! $compatible_php || ! $compatible_wp
1003
-		) {
1004
-			$class .= ' update';
1005
-		}
1006
-
1007
-		$paused = ! $screen->in_admin( 'network' ) && is_plugin_paused( $plugin_file );
1008
-
1009
-		if ( $paused ) {
1010
-			$class .= ' paused';
1011
-		}
1012
-
1013
-		if ( is_uninstallable_plugin( $plugin_file ) ) {
1014
-			$class .= ' is-uninstallable';
1015
-		}
1016
-
1017
-		printf(
1018
-			'<tr class="%s" data-slug="%s" data-plugin="%s">',
1019
-			esc_attr( $class ),
1020
-			esc_attr( $plugin_slug ),
1021
-			esc_attr( $plugin_file )
1022
-		);
1023
-
1024
-		list( $columns, $hidden, $sortable, $primary ) = $this->get_column_info();
1025
-
1026
-		$auto_updates      = (array) get_site_option( 'auto_update_plugins', array() );
1027
-		$available_updates = get_site_transient( 'update_plugins' );
1028
-
1029
-		foreach ( $columns as $column_name => $column_display_name ) {
1030
-			$extra_classes = '';
1031
-			if ( in_array( $column_name, $hidden, true ) ) {
1032
-				$extra_classes = ' hidden';
1033
-			}
1034
-
1035
-			switch ( $column_name ) {
1036
-				case 'cb':
1037
-					echo "<th scope='row' class='check-column'>$checkbox</th>";
1038
-					break;
1039
-				case 'name':
1040
-					echo "<td class='plugin-title column-primary'><strong>$plugin_name</strong>";
1041
-					echo $this->row_actions( $actions, true );
1042
-					echo '</td>';
1043
-					break;
1044
-				case 'description':
1045
-					$classes = 'column-description desc';
1046
-
1047
-					echo "<td class='$classes{$extra_classes}'>
451
+    }
452
+
453
+    /**
454
+     * @global string $status
455
+     * @return array
456
+     */
457
+    public function get_columns() {
458
+        global $status;
459
+
460
+        $columns = array(
461
+            'cb'          => ! in_array( $status, array( 'mustuse', 'dropins' ), true ) ? '<input type="checkbox" />' : '',
462
+            'name'        => __( 'Plugin' ),
463
+            'description' => __( 'Description' ),
464
+        );
465
+
466
+        if ( $this->show_autoupdates ) {
467
+            $columns['auto-updates'] = __( 'Automatic Updates' );
468
+        }
469
+
470
+        return $columns;
471
+    }
472
+
473
+    /**
474
+     * @return array
475
+     */
476
+    protected function get_sortable_columns() {
477
+        return array();
478
+    }
479
+
480
+    /**
481
+     * @global array $totals
482
+     * @global string $status
483
+     * @return array
484
+     */
485
+    protected function get_views() {
486
+        global $totals, $status;
487
+
488
+        $status_links = array();
489
+        foreach ( $totals as $type => $count ) {
490
+            if ( ! $count ) {
491
+                continue;
492
+            }
493
+
494
+            switch ( $type ) {
495
+                case 'all':
496
+                    /* translators: %s: Number of plugins. */
497
+                    $text = _nx(
498
+                        'All <span class="count">(%s)</span>',
499
+                        'All <span class="count">(%s)</span>',
500
+                        $count,
501
+                        'plugins'
502
+                    );
503
+                    break;
504
+                case 'active':
505
+                    /* translators: %s: Number of plugins. */
506
+                    $text = _n(
507
+                        'Active <span class="count">(%s)</span>',
508
+                        'Active <span class="count">(%s)</span>',
509
+                        $count
510
+                    );
511
+                    break;
512
+                case 'recently_activated':
513
+                    /* translators: %s: Number of plugins. */
514
+                    $text = _n(
515
+                        'Recently Active <span class="count">(%s)</span>',
516
+                        'Recently Active <span class="count">(%s)</span>',
517
+                        $count
518
+                    );
519
+                    break;
520
+                case 'inactive':
521
+                    /* translators: %s: Number of plugins. */
522
+                    $text = _n(
523
+                        'Inactive <span class="count">(%s)</span>',
524
+                        'Inactive <span class="count">(%s)</span>',
525
+                        $count
526
+                    );
527
+                    break;
528
+                case 'mustuse':
529
+                    /* translators: %s: Number of plugins. */
530
+                    $text = _n(
531
+                        'Must-Use <span class="count">(%s)</span>',
532
+                        'Must-Use <span class="count">(%s)</span>',
533
+                        $count
534
+                    );
535
+                    break;
536
+                case 'dropins':
537
+                    /* translators: %s: Number of plugins. */
538
+                    $text = _n(
539
+                        'Drop-in <span class="count">(%s)</span>',
540
+                        'Drop-ins <span class="count">(%s)</span>',
541
+                        $count
542
+                    );
543
+                    break;
544
+                case 'paused':
545
+                    /* translators: %s: Number of plugins. */
546
+                    $text = _n(
547
+                        'Paused <span class="count">(%s)</span>',
548
+                        'Paused <span class="count">(%s)</span>',
549
+                        $count
550
+                    );
551
+                    break;
552
+                case 'upgrade':
553
+                    /* translators: %s: Number of plugins. */
554
+                    $text = _n(
555
+                        'Update Available <span class="count">(%s)</span>',
556
+                        'Update Available <span class="count">(%s)</span>',
557
+                        $count
558
+                    );
559
+                    break;
560
+                case 'auto-update-enabled':
561
+                    /* translators: %s: Number of plugins. */
562
+                    $text = _n(
563
+                        'Auto-updates Enabled <span class="count">(%s)</span>',
564
+                        'Auto-updates Enabled <span class="count">(%s)</span>',
565
+                        $count
566
+                    );
567
+                    break;
568
+                case 'auto-update-disabled':
569
+                    /* translators: %s: Number of plugins. */
570
+                    $text = _n(
571
+                        'Auto-updates Disabled <span class="count">(%s)</span>',
572
+                        'Auto-updates Disabled <span class="count">(%s)</span>',
573
+                        $count
574
+                    );
575
+                    break;
576
+            }
577
+
578
+            if ( 'search' !== $type ) {
579
+                $status_links[ $type ] = sprintf(
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 ) )
584
+                );
585
+            }
586
+        }
587
+
588
+        return $status_links;
589
+    }
590
+
591
+    /**
592
+     * @global string $status
593
+     * @return array
594
+     */
595
+    protected function get_bulk_actions() {
596
+        global $status;
597
+
598
+        $actions = array();
599
+
600
+        if ( 'active' !== $status ) {
601
+            $actions['activate-selected'] = $this->screen->in_admin( 'network' ) ? __( 'Network Activate' ) : __( 'Activate' );
602
+        }
603
+
604
+        if ( 'inactive' !== $status && 'recent' !== $status ) {
605
+            $actions['deactivate-selected'] = $this->screen->in_admin( 'network' ) ? __( 'Network Deactivate' ) : __( 'Deactivate' );
606
+        }
607
+
608
+        if ( ! is_multisite() || $this->screen->in_admin( 'network' ) ) {
609
+            if ( current_user_can( 'update_plugins' ) ) {
610
+                $actions['update-selected'] = __( 'Update' );
611
+            }
612
+
613
+            if ( current_user_can( 'delete_plugins' ) && ( 'active' !== $status ) ) {
614
+                $actions['delete-selected'] = __( 'Delete' );
615
+            }
616
+
617
+            if ( $this->show_autoupdates ) {
618
+                if ( 'auto-update-enabled' !== $status ) {
619
+                    $actions['enable-auto-update-selected'] = __( 'Enable Auto-updates' );
620
+                }
621
+                if ( 'auto-update-disabled' !== $status ) {
622
+                    $actions['disable-auto-update-selected'] = __( 'Disable Auto-updates' );
623
+                }
624
+            }
625
+        }
626
+
627
+        return $actions;
628
+    }
629
+
630
+    /**
631
+     * @global string $status
632
+     * @param string $which
633
+     */
634
+    public function bulk_actions( $which = '' ) {
635
+        global $status;
636
+
637
+        if ( in_array( $status, array( 'mustuse', 'dropins' ), true ) ) {
638
+            return;
639
+        }
640
+
641
+        parent::bulk_actions( $which );
642
+    }
643
+
644
+    /**
645
+     * @global string $status
646
+     * @param string $which
647
+     */
648
+    protected function extra_tablenav( $which ) {
649
+        global $status;
650
+
651
+        if ( ! in_array( $status, array( 'recently_activated', 'mustuse', 'dropins' ), true ) ) {
652
+            return;
653
+        }
654
+
655
+        echo '<div class="alignleft actions">';
656
+
657
+        if ( 'recently_activated' === $status ) {
658
+            submit_button( __( 'Clear List' ), '', 'clear-recent-list', false );
659
+        } elseif ( 'top' === $which && 'mustuse' === $status ) {
660
+            echo '<p>' . sprintf(
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>'
664
+            ) . '</p>';
665
+        } elseif ( 'top' === $which && 'dropins' === $status ) {
666
+            echo '<p>' . sprintf(
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>'
670
+            ) . '</p>';
671
+        }
672
+        echo '</div>';
673
+    }
674
+
675
+    /**
676
+     * @return string
677
+     */
678
+    public function current_action() {
679
+        if ( isset( $_POST['clear-recent-list'] ) ) {
680
+            return 'clear-recent-list';
681
+        }
682
+
683
+        return parent::current_action();
684
+    }
685
+
686
+    /**
687
+     * @global string $status
688
+     */
689
+    public function display_rows() {
690
+        global $status;
691
+
692
+        if ( is_multisite() && ! $this->screen->in_admin( 'network' ) && in_array( $status, array( 'mustuse', 'dropins' ), true ) ) {
693
+            return;
694
+        }
695
+
696
+        foreach ( $this->items as $plugin_file => $plugin_data ) {
697
+            $this->single_row( array( $plugin_file, $plugin_data ) );
698
+        }
699
+    }
700
+
701
+    /**
702
+     * @global string $status
703
+     * @global int $page
704
+     * @global string $s
705
+     * @global array $totals
706
+     *
707
+     * @param array $item
708
+     */
709
+    public function single_row( $item ) {
710
+        global $status, $page, $s, $totals;
711
+        static $plugin_id_attrs = array();
712
+
713
+        list( $plugin_file, $plugin_data ) = $item;
714
+
715
+        $plugin_slug    = isset( $plugin_data['slug'] ) ? $plugin_data['slug'] : sanitize_title( $plugin_data['Name'] );
716
+        $plugin_id_attr = $plugin_slug;
717
+
718
+        // Ensure the ID attribute is unique.
719
+        $suffix = 2;
720
+        while ( in_array( $plugin_id_attr, $plugin_id_attrs, true ) ) {
721
+            $plugin_id_attr = "$plugin_slug-$suffix";
722
+            $suffix++;
723
+        }
724
+
725
+        $plugin_id_attrs[] = $plugin_id_attr;
726
+
727
+        $context = $status;
728
+        $screen  = $this->screen;
729
+
730
+        // Pre-order.
731
+        $actions = array(
732
+            'deactivate' => '',
733
+            'activate'   => '',
734
+            'details'    => '',
735
+            'delete'     => '',
736
+        );
737
+
738
+        // Do not restrict by default.
739
+        $restrict_network_active = false;
740
+        $restrict_network_only   = false;
741
+
742
+        $requires_php = isset( $plugin_data['RequiresPHP'] ) ? $plugin_data['RequiresPHP'] : null;
743
+        $requires_wp  = isset( $plugin_data['RequiresWP'] ) ? $plugin_data['RequiresWP'] : null;
744
+
745
+        $compatible_php = is_php_version_compatible( $requires_php );
746
+        $compatible_wp  = is_wp_version_compatible( $requires_wp );
747
+
748
+        if ( 'mustuse' === $context ) {
749
+            $is_active = true;
750
+        } elseif ( 'dropins' === $context ) {
751
+            $dropins     = _get_dropins();
752
+            $plugin_name = $plugin_file;
753
+
754
+            if ( $plugin_file !== $plugin_data['Name'] ) {
755
+                $plugin_name .= '<br/>' . $plugin_data['Name'];
756
+            }
757
+
758
+            if ( true === ( $dropins[ $plugin_file ][1] ) ) { // Doesn't require a constant.
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.
762
+                $is_active   = true;
763
+                $description = '<p><strong>' . $dropins[ $plugin_file ][0] . '</strong></p>';
764
+            } else {
765
+                $is_active   = false;
766
+                $description = '<p><strong>' . $dropins[ $plugin_file ][0] . ' <span class="error-message">' . __( 'Inactive:' ) . '</span></strong> ' .
767
+                    sprintf(
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>",
771
+                        '<code>wp-config.php</code>'
772
+                    ) . '</p>';
773
+            }
774
+
775
+            if ( $plugin_data['Description'] ) {
776
+                $description .= '<p>' . $plugin_data['Description'] . '</p>';
777
+            }
778
+        } else {
779
+            if ( $screen->in_admin( 'network' ) ) {
780
+                $is_active = is_plugin_active_for_network( $plugin_file );
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 );
785
+            }
786
+
787
+            if ( $screen->in_admin( 'network' ) ) {
788
+                if ( $is_active ) {
789
+                    if ( current_user_can( 'manage_network_plugins' ) ) {
790
+                        $actions['deactivate'] = sprintf(
791
+                            '<a href="%s" id="deactivate-%s" aria-label="%s">%s</a>',
792
+                            wp_nonce_url( 'plugins.php?action=deactivate&amp;plugin=' . urlencode( $plugin_file ) . '&amp;plugin_status=' . $context . '&amp;paged=' . $page . '&amp;s=' . $s, 'deactivate-plugin_' . $plugin_file ),
793
+                            esc_attr( $plugin_id_attr ),
794
+                            /* translators: %s: Plugin name. */
795
+                            esc_attr( sprintf( _x( 'Network Deactivate %s', 'plugin' ), $plugin_data['Name'] ) ),
796
+                            __( 'Network Deactivate' )
797
+                        );
798
+                    }
799
+                } else {
800
+                    if ( current_user_can( 'manage_network_plugins' ) ) {
801
+                        if ( $compatible_php && $compatible_wp ) {
802
+                            $actions['activate'] = sprintf(
803
+                                '<a href="%s" id="activate-%s" class="edit" aria-label="%s">%s</a>',
804
+                                wp_nonce_url( 'plugins.php?action=activate&amp;plugin=' . urlencode( $plugin_file ) . '&amp;plugin_status=' . $context . '&amp;paged=' . $page . '&amp;s=' . $s, 'activate-plugin_' . $plugin_file ),
805
+                                esc_attr( $plugin_id_attr ),
806
+                                /* translators: %s: Plugin name. */
807
+                                esc_attr( sprintf( _x( 'Network Activate %s', 'plugin' ), $plugin_data['Name'] ) ),
808
+                                __( 'Network Activate' )
809
+                            );
810
+                        } else {
811
+                            $actions['activate'] = sprintf(
812
+                                '<span>%s</span>',
813
+                                _x( 'Cannot Activate', 'plugin' )
814
+                            );
815
+                        }
816
+                    }
817
+
818
+                    if ( current_user_can( 'delete_plugins' ) && ! is_plugin_active( $plugin_file ) ) {
819
+                        $actions['delete'] = sprintf(
820
+                            '<a href="%s" id="delete-%s" class="delete" aria-label="%s">%s</a>',
821
+                            wp_nonce_url( 'plugins.php?action=delete-selected&amp;checked[]=' . urlencode( $plugin_file ) . '&amp;plugin_status=' . $context . '&amp;paged=' . $page . '&amp;s=' . $s, 'bulk-plugins' ),
822
+                            esc_attr( $plugin_id_attr ),
823
+                            /* translators: %s: Plugin name. */
824
+                            esc_attr( sprintf( _x( 'Delete %s', 'plugin' ), $plugin_data['Name'] ) ),
825
+                            __( 'Delete' )
826
+                        );
827
+                    }
828
+                }
829
+            } else {
830
+                if ( $restrict_network_active ) {
831
+                    $actions = array(
832
+                        'network_active' => __( 'Network Active' ),
833
+                    );
834
+                } elseif ( $restrict_network_only ) {
835
+                    $actions = array(
836
+                        'network_only' => __( 'Network Only' ),
837
+                    );
838
+                } elseif ( $is_active ) {
839
+                    if ( current_user_can( 'deactivate_plugin', $plugin_file ) ) {
840
+                        $actions['deactivate'] = sprintf(
841
+                            '<a href="%s" id="deactivate-%s" aria-label="%s">%s</a>',
842
+                            wp_nonce_url( 'plugins.php?action=deactivate&amp;plugin=' . urlencode( $plugin_file ) . '&amp;plugin_status=' . $context . '&amp;paged=' . $page . '&amp;s=' . $s, 'deactivate-plugin_' . $plugin_file ),
843
+                            esc_attr( $plugin_id_attr ),
844
+                            /* translators: %s: Plugin name. */
845
+                            esc_attr( sprintf( _x( 'Deactivate %s', 'plugin' ), $plugin_data['Name'] ) ),
846
+                            __( 'Deactivate' )
847
+                        );
848
+                    }
849
+
850
+                    if ( current_user_can( 'resume_plugin', $plugin_file ) && is_plugin_paused( $plugin_file ) ) {
851
+                        $actions['resume'] = sprintf(
852
+                            '<a href="%s" id="resume-%s" class="resume-link" aria-label="%s">%s</a>',
853
+                            wp_nonce_url( 'plugins.php?action=resume&amp;plugin=' . urlencode( $plugin_file ) . '&amp;plugin_status=' . $context . '&amp;paged=' . $page . '&amp;s=' . $s, 'resume-plugin_' . $plugin_file ),
854
+                            esc_attr( $plugin_id_attr ),
855
+                            /* translators: %s: Plugin name. */
856
+                            esc_attr( sprintf( _x( 'Resume %s', 'plugin' ), $plugin_data['Name'] ) ),
857
+                            __( 'Resume' )
858
+                        );
859
+                    }
860
+                } else {
861
+                    if ( current_user_can( 'activate_plugin', $plugin_file ) ) {
862
+                        if ( $compatible_php && $compatible_wp ) {
863
+                            $actions['activate'] = sprintf(
864
+                                '<a href="%s" id="activate-%s" class="edit" aria-label="%s">%s</a>',
865
+                                wp_nonce_url( 'plugins.php?action=activate&amp;plugin=' . urlencode( $plugin_file ) . '&amp;plugin_status=' . $context . '&amp;paged=' . $page . '&amp;s=' . $s, 'activate-plugin_' . $plugin_file ),
866
+                                esc_attr( $plugin_id_attr ),
867
+                                /* translators: %s: Plugin name. */
868
+                                esc_attr( sprintf( _x( 'Activate %s', 'plugin' ), $plugin_data['Name'] ) ),
869
+                                __( 'Activate' )
870
+                            );
871
+                        } else {
872
+                            $actions['activate'] = sprintf(
873
+                                '<span>%s</span>',
874
+                                _x( 'Cannot Activate', 'plugin' )
875
+                            );
876
+                        }
877
+                    }
878
+
879
+                    if ( ! is_multisite() && current_user_can( 'delete_plugins' ) ) {
880
+                        $actions['delete'] = sprintf(
881
+                            '<a href="%s" id="delete-%s" class="delete" aria-label="%s">%s</a>',
882
+                            wp_nonce_url( 'plugins.php?action=delete-selected&amp;checked[]=' . urlencode( $plugin_file ) . '&amp;plugin_status=' . $context . '&amp;paged=' . $page . '&amp;s=' . $s, 'bulk-plugins' ),
883
+                            esc_attr( $plugin_id_attr ),
884
+                            /* translators: %s: Plugin name. */
885
+                            esc_attr( sprintf( _x( 'Delete %s', 'plugin' ), $plugin_data['Name'] ) ),
886
+                            __( 'Delete' )
887
+                        );
888
+                    }
889
+                } // End if $is_active.
890
+            } // End if $screen->in_admin( 'network' ).
891
+        } // End if $context.
892
+
893
+        $actions = array_filter( $actions );
894
+
895
+        if ( $screen->in_admin( 'network' ) ) {
896
+
897
+            /**
898
+             * Filters the action links displayed for each plugin in the Network Admin Plugins list table.
899
+             *
900
+             * @since 3.1.0
901
+             *
902
+             * @param string[] $actions     An array of plugin action links. By default this can include
903
+             *                              'activate', 'deactivate', and 'delete'.
904
+             * @param string   $plugin_file Path to the plugin file relative to the plugins directory.
905
+             * @param array    $plugin_data An array of plugin data. See `get_plugin_data()`
906
+             *                              and the {@see 'plugin_row_meta'} filter for the list
907
+             *                              of possible values.
908
+             * @param string   $context     The plugin context. By default this can include 'all',
909
+             *                              'active', 'inactive', 'recently_activated', 'upgrade',
910
+             *                              'mustuse', 'dropins', and 'search'.
911
+             */
912
+            $actions = apply_filters( 'network_admin_plugin_action_links', $actions, $plugin_file, $plugin_data, $context );
913
+
914
+            /**
915
+             * Filters the list of action links displayed for a specific plugin in the Network Admin Plugins list table.
916
+             *
917
+             * The dynamic portion of the hook name, `$plugin_file`, refers to the path
918
+             * to the plugin file, relative to the plugins directory.
919
+             *
920
+             * @since 3.1.0
921
+             *
922
+             * @param string[] $actions     An array of plugin action links. By default this can include
923
+             *                              'activate', 'deactivate', and 'delete'.
924
+             * @param string   $plugin_file Path to the plugin file relative to the plugins directory.
925
+             * @param array    $plugin_data An array of plugin data. See `get_plugin_data()`
926
+             *                              and the {@see 'plugin_row_meta'} filter for the list
927
+             *                              of possible values.
928
+             * @param string   $context     The plugin context. By default this can include 'all',
929
+             *                              'active', 'inactive', 'recently_activated', 'upgrade',
930
+             *                              'mustuse', 'dropins', and 'search'.
931
+             */
932
+            $actions = apply_filters( "network_admin_plugin_action_links_{$plugin_file}", $actions, $plugin_file, $plugin_data, $context );
933
+
934
+        } else {
935
+
936
+            /**
937
+             * Filters the action links displayed for each plugin in the Plugins list table.
938
+             *
939
+             * @since 2.5.0
940
+             * @since 2.6.0 The `$context` parameter was added.
941
+             * @since 4.9.0 The 'Edit' link was removed from the list of action links.
942
+             *
943
+             * @param string[] $actions     An array of plugin action links. By default this can include
944
+             *                              'activate', 'deactivate', and 'delete'. With Multisite active
945
+             *                              this can also include 'network_active' and 'network_only' items.
946
+             * @param string   $plugin_file Path to the plugin file relative to the plugins directory.
947
+             * @param array    $plugin_data An array of plugin data. See `get_plugin_data()`
948
+             *                              and the {@see 'plugin_row_meta'} filter for the list
949
+             *                              of possible values.
950
+             * @param string   $context     The plugin context. By default this can include 'all',
951
+             *                              'active', 'inactive', 'recently_activated', 'upgrade',
952
+             *                              'mustuse', 'dropins', and 'search'.
953
+             */
954
+            $actions = apply_filters( 'plugin_action_links', $actions, $plugin_file, $plugin_data, $context );
955
+
956
+            /**
957
+             * Filters the list of action links displayed for a specific plugin in the Plugins list table.
958
+             *
959
+             * The dynamic portion of the hook name, `$plugin_file`, refers to the path
960
+             * to the plugin file, relative to the plugins directory.
961
+             *
962
+             * @since 2.7.0
963
+             * @since 4.9.0 The 'Edit' link was removed from the list of action links.
964
+             *
965
+             * @param string[] $actions     An array of plugin action links. By default this can include
966
+             *                              'activate', 'deactivate', and 'delete'. With Multisite active
967
+             *                              this can also include 'network_active' and 'network_only' items.
968
+             * @param string   $plugin_file Path to the plugin file relative to the plugins directory.
969
+             * @param array    $plugin_data An array of plugin data. See `get_plugin_data()`
970
+             *                              and the {@see 'plugin_row_meta'} filter for the list
971
+             *                              of possible values.
972
+             * @param string   $context     The plugin context. By default this can include 'all',
973
+             *                              'active', 'inactive', 'recently_activated', 'upgrade',
974
+             *                              'mustuse', 'dropins', and 'search'.
975
+             */
976
+            $actions = apply_filters( "plugin_action_links_{$plugin_file}", $actions, $plugin_file, $plugin_data, $context );
977
+
978
+        }
979
+
980
+        $class       = $is_active ? 'active' : 'inactive';
981
+        $checkbox_id = 'checkbox_' . md5( $plugin_file );
982
+
983
+        if ( $restrict_network_active || $restrict_network_only || in_array( $status, array( 'mustuse', 'dropins' ), true ) || ! $compatible_php ) {
984
+            $checkbox = '';
985
+        } else {
986
+            $checkbox = sprintf(
987
+                '<label class="screen-reader-text" for="%1$s">%2$s</label>' .
988
+                '<input type="checkbox" name="checked[]" value="%3$s" id="%1$s" />',
989
+                $checkbox_id,
990
+                /* translators: %s: Plugin name. */
991
+                sprintf( __( 'Select %s' ), $plugin_data['Name'] ),
992
+                esc_attr( $plugin_file )
993
+            );
994
+        }
995
+
996
+        if ( 'dropins' !== $context ) {
997
+            $description = '<p>' . ( $plugin_data['Description'] ? $plugin_data['Description'] : '&nbsp;' ) . '</p>';
998
+            $plugin_name = $plugin_data['Name'];
999
+        }
1000
+
1001
+        if ( ! empty( $totals['upgrade'] ) && ! empty( $plugin_data['update'] )
1002
+            || ! $compatible_php || ! $compatible_wp
1003
+        ) {
1004
+            $class .= ' update';
1005
+        }
1006
+
1007
+        $paused = ! $screen->in_admin( 'network' ) && is_plugin_paused( $plugin_file );
1008
+
1009
+        if ( $paused ) {
1010
+            $class .= ' paused';
1011
+        }
1012
+
1013
+        if ( is_uninstallable_plugin( $plugin_file ) ) {
1014
+            $class .= ' is-uninstallable';
1015
+        }
1016
+
1017
+        printf(
1018
+            '<tr class="%s" data-slug="%s" data-plugin="%s">',
1019
+            esc_attr( $class ),
1020
+            esc_attr( $plugin_slug ),
1021
+            esc_attr( $plugin_file )
1022
+        );
1023
+
1024
+        list( $columns, $hidden, $sortable, $primary ) = $this->get_column_info();
1025
+
1026
+        $auto_updates      = (array) get_site_option( 'auto_update_plugins', array() );
1027
+        $available_updates = get_site_transient( 'update_plugins' );
1028
+
1029
+        foreach ( $columns as $column_name => $column_display_name ) {
1030
+            $extra_classes = '';
1031
+            if ( in_array( $column_name, $hidden, true ) ) {
1032
+                $extra_classes = ' hidden';
1033
+            }
1034
+
1035
+            switch ( $column_name ) {
1036
+                case 'cb':
1037
+                    echo "<th scope='row' class='check-column'>$checkbox</th>";
1038
+                    break;
1039
+                case 'name':
1040
+                    echo "<td class='plugin-title column-primary'><strong>$plugin_name</strong>";
1041
+                    echo $this->row_actions( $actions, true );
1042
+                    echo '</td>';
1043
+                    break;
1044
+                case 'description':
1045
+                    $classes = 'column-description desc';
1046
+
1047
+                    echo "<td class='$classes{$extra_classes}'>
1048 1048
 						<div class='plugin-description'>$description</div>
1049 1049
 						<div class='$class second plugin-version-author-uri'>";
1050 1050
 
1051
-					$plugin_meta = array();
1052
-					if ( ! empty( $plugin_data['Version'] ) ) {
1053
-						/* translators: %s: Plugin version number. */
1054
-						$plugin_meta[] = sprintf( __( 'Version %s' ), $plugin_data['Version'] );
1055
-					}
1056
-					if ( ! empty( $plugin_data['Author'] ) ) {
1057
-						$author = $plugin_data['Author'];
1058
-						if ( ! empty( $plugin_data['AuthorURI'] ) ) {
1059
-							$author = '<a href="' . $plugin_data['AuthorURI'] . '">' . $plugin_data['Author'] . '</a>';
1060
-						}
1061
-						/* translators: %s: Plugin author name. */
1062
-						$plugin_meta[] = sprintf( __( 'By %s' ), $author );
1063
-					}
1064
-
1065
-					// Details link using API info, if available.
1066
-					if ( isset( $plugin_data['slug'] ) && current_user_can( 'install_plugins' ) ) {
1067
-						$plugin_meta[] = sprintf(
1068
-							'<a href="%s" class="thickbox open-plugin-details-modal" aria-label="%s" data-title="%s">%s</a>',
1069
-							esc_url(
1070
-								network_admin_url(
1071
-									'plugin-install.php?tab=plugin-information&plugin=' . $plugin_data['slug'] .
1072
-									'&TB_iframe=true&width=600&height=550'
1073
-								)
1074
-							),
1075
-							/* translators: %s: Plugin name. */
1076
-							esc_attr( sprintf( __( 'More information about %s' ), $plugin_name ) ),
1077
-							esc_attr( $plugin_name ),
1078
-							__( 'View details' )
1079
-						);
1080
-					} elseif ( ! empty( $plugin_data['PluginURI'] ) ) {
1081
-						/* translators: %s: Plugin name. */
1082
-						$aria_label = sprintf( __( 'Visit plugin site for %s' ), $plugin_name );
1083
-
1084
-						$plugin_meta[] = sprintf(
1085
-							'<a href="%s" aria-label="%s">%s</a>',
1086
-							esc_url( $plugin_data['PluginURI'] ),
1087
-							esc_attr( $aria_label ),
1088
-							__( 'Visit plugin site' )
1089
-						);
1090
-					}
1091
-
1092
-					/**
1093
-					 * Filters the array of row meta for each plugin in the Plugins list table.
1094
-					 *
1095
-					 * @since 2.8.0
1096
-					 *
1097
-					 * @param string[] $plugin_meta An array of the plugin's metadata, including
1098
-					 *                              the version, author, author URI, and plugin URI.
1099
-					 * @param string   $plugin_file Path to the plugin file relative to the plugins directory.
1100
-					 * @param array    $plugin_data {
1101
-					 *     An array of plugin data.
1102
-					 *
1103
-					 *     @type string   $id               Plugin ID, e.g. `w.org/plugins/[plugin-name]`.
1104
-					 *     @type string   $slug             Plugin slug.
1105
-					 *     @type string   $plugin           Plugin basename.
1106
-					 *     @type string   $new_version      New plugin version.
1107
-					 *     @type string   $url              Plugin URL.
1108
-					 *     @type string   $package          Plugin update package URL.
1109
-					 *     @type string[] $icons            An array of plugin icon URLs.
1110
-					 *     @type string[] $banners          An array of plugin banner URLs.
1111
-					 *     @type string[] $banners_rtl      An array of plugin RTL banner URLs.
1112
-					 *     @type string   $requires         The version of WordPress which the plugin requires.
1113
-					 *     @type string   $tested           The version of WordPress the plugin is tested against.
1114
-					 *     @type string   $requires_php     The version of PHP which the plugin requires.
1115
-					 *     @type string   $upgrade_notice   The upgrade notice for the new plugin version.
1116
-					 *     @type bool     $update-supported Whether the plugin supports updates.
1117
-					 *     @type string   $Name             The human-readable name of the plugin.
1118
-					 *     @type string   $PluginURI        Plugin URI.
1119
-					 *     @type string   $Version          Plugin version.
1120
-					 *     @type string   $Description      Plugin description.
1121
-					 *     @type string   $Author           Plugin author.
1122
-					 *     @type string   $AuthorURI        Plugin author URI.
1123
-					 *     @type string   $TextDomain       Plugin textdomain.
1124
-					 *     @type string   $DomainPath       Relative path to the plugin's .mo file(s).
1125
-					 *     @type bool     $Network          Whether the plugin can only be activated network-wide.
1126
-					 *     @type string   $RequiresWP       The version of WordPress which the plugin requires.
1127
-					 *     @type string   $RequiresPHP      The version of PHP which the plugin requires.
1128
-					 *     @type string   $UpdateURI        ID of the plugin for update purposes, should be a URI.
1129
-					 *     @type string   $Title            The human-readable title of the plugin.
1130
-					 *     @type string   $AuthorName       Plugin author's name.
1131
-					 *     @type bool     $update           Whether there's an available update. Default null.
1132
-					 * }
1133
-					 * @param string   $status      Status filter currently applied to the plugin list. Possible
1134
-					 *                              values are: 'all', 'active', 'inactive', 'recently_activated',
1135
-					 *                              'upgrade', 'mustuse', 'dropins', 'search', 'paused',
1136
-					 *                              'auto-update-enabled', 'auto-update-disabled'.
1137
-					 */
1138
-					$plugin_meta = apply_filters( 'plugin_row_meta', $plugin_meta, $plugin_file, $plugin_data, $status );
1139
-
1140
-					echo implode( ' | ', $plugin_meta );
1141
-
1142
-					echo '</div>';
1143
-
1144
-					if ( $paused ) {
1145
-						$notice_text = __( 'This plugin failed to load properly and is paused during recovery mode.' );
1146
-
1147
-						printf( '<p><span class="dashicons dashicons-warning"></span> <strong>%s</strong></p>', $notice_text );
1148
-
1149
-						$error = wp_get_plugin_error( $plugin_file );
1150
-
1151
-						if ( false !== $error ) {
1152
-							printf( '<div class="error-display"><p>%s</p></div>', wp_get_extension_error_description( $error ) );
1153
-						}
1154
-					}
1155
-
1156
-					echo '</td>';
1157
-					break;
1158
-				case 'auto-updates':
1159
-					if ( ! $this->show_autoupdates ) {
1160
-						break;
1161
-					}
1162
-
1163
-					echo "<td class='column-auto-updates{$extra_classes}'>";
1164
-
1165
-					$html = array();
1166
-
1167
-					if ( isset( $plugin_data['auto-update-forced'] ) ) {
1168
-						if ( $plugin_data['auto-update-forced'] ) {
1169
-							// Forced on.
1170
-							$text = __( 'Auto-updates enabled' );
1171
-						} else {
1172
-							$text = __( 'Auto-updates disabled' );
1173
-						}
1174
-						$action     = 'unavailable';
1175
-						$time_class = ' hidden';
1176
-					} elseif ( empty( $plugin_data['update-supported'] ) ) {
1177
-						$text       = '';
1178
-						$action     = 'unavailable';
1179
-						$time_class = ' hidden';
1180
-					} elseif ( in_array( $plugin_file, $auto_updates, true ) ) {
1181
-						$text       = __( 'Disable auto-updates' );
1182
-						$action     = 'disable';
1183
-						$time_class = '';
1184
-					} else {
1185
-						$text       = __( 'Enable auto-updates' );
1186
-						$action     = 'enable';
1187
-						$time_class = ' hidden';
1188
-					}
1189
-
1190
-					$query_args = array(
1191
-						'action'        => "{$action}-auto-update",
1192
-						'plugin'        => $plugin_file,
1193
-						'paged'         => $page,
1194
-						'plugin_status' => $status,
1195
-					);
1196
-
1197
-					$url = add_query_arg( $query_args, 'plugins.php' );
1198
-
1199
-					if ( 'unavailable' === $action ) {
1200
-						$html[] = '<span class="label">' . $text . '</span>';
1201
-					} else {
1202
-						$html[] = sprintf(
1203
-							'<a href="%s" class="toggle-auto-update aria-button-if-js" data-wp-action="%s">',
1204
-							wp_nonce_url( $url, 'updates' ),
1205
-							$action
1206
-						);
1207
-
1208
-						$html[] = '<span class="dashicons dashicons-update spin hidden" aria-hidden="true"></span>';
1209
-						$html[] = '<span class="label">' . $text . '</span>';
1210
-						$html[] = '</a>';
1211
-					}
1212
-
1213
-					if ( ! empty( $plugin_data['update'] ) ) {
1214
-						$html[] = sprintf(
1215
-							'<div class="auto-update-time%s">%s</div>',
1216
-							$time_class,
1217
-							wp_get_auto_update_message()
1218
-						);
1219
-					}
1220
-
1221
-					$html = implode( '', $html );
1222
-
1223
-					/**
1224
-					 * Filters the HTML of the auto-updates setting for each plugin in the Plugins list table.
1225
-					 *
1226
-					 * @since 5.5.0
1227
-					 *
1228
-					 * @param string $html        The HTML of the plugin's auto-update column content,
1229
-					 *                            including toggle auto-update action links and
1230
-					 *                            time to next update.
1231
-					 * @param string $plugin_file Path to the plugin file relative to the plugins directory.
1232
-					 * @param array  $plugin_data An array of plugin data. See `get_plugin_data()`
1233
-					 *                            and the {@see 'plugin_row_meta'} filter for the list
1234
-					 *                            of possible values.
1235
-					 */
1236
-					echo apply_filters( 'plugin_auto_update_setting_html', $html, $plugin_file, $plugin_data );
1237
-
1238
-					echo '<div class="notice notice-error notice-alt inline hidden"><p></p></div>';
1239
-					echo '</td>';
1240
-
1241
-					break;
1242
-				default:
1243
-					$classes = "$column_name column-$column_name $class";
1244
-
1245
-					echo "<td class='$classes{$extra_classes}'>";
1246
-
1247
-					/**
1248
-					 * Fires inside each custom column of the Plugins list table.
1249
-					 *
1250
-					 * @since 3.1.0
1251
-					 *
1252
-					 * @param string $column_name Name of the column.
1253
-					 * @param string $plugin_file Path to the plugin file relative to the plugins directory.
1254
-					 * @param array  $plugin_data An array of plugin data. See `get_plugin_data()`
1255
-					 *                            and the {@see 'plugin_row_meta'} filter for the list
1256
-					 *                            of possible values.
1257
-					 */
1258
-					do_action( 'manage_plugins_custom_column', $column_name, $plugin_file, $plugin_data );
1259
-
1260
-					echo '</td>';
1261
-			}
1262
-		}
1263
-
1264
-		echo '</tr>';
1265
-
1266
-		if ( ! $compatible_php || ! $compatible_wp ) {
1267
-			printf(
1268
-				'<tr class="plugin-update-tr">' .
1269
-				'<td colspan="%s" class="plugin-update colspanchange">' .
1270
-				'<div class="update-message notice inline notice-error notice-alt"><p>',
1271
-				esc_attr( $this->get_column_count() )
1272
-			);
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' ) ) {
1277
-					printf(
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() )
1282
-					);
1283
-					wp_update_php_annotation( '</p><p><em>', '</em>' );
1284
-				} elseif ( current_user_can( 'update_core' ) ) {
1285
-					printf(
1286
-						/* translators: %s: URL to WordPress Updates screen. */
1287
-						' ' . __( '<a href="%s">Please update WordPress</a>.' ),
1288
-						self_admin_url( 'update-core.php' )
1289
-					);
1290
-				} elseif ( current_user_can( 'update_php' ) ) {
1291
-					printf(
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() )
1295
-					);
1296
-					wp_update_php_annotation( '</p><p><em>', '</em>' );
1297
-				}
1298
-			} elseif ( ! $compatible_wp ) {
1299
-				_e( 'This plugin does not work with your version of WordPress.' );
1300
-				if ( current_user_can( 'update_core' ) ) {
1301
-					printf(
1302
-						/* translators: %s: URL to WordPress Updates screen. */
1303
-						' ' . __( '<a href="%s">Please update WordPress</a>.' ),
1304
-						self_admin_url( 'update-core.php' )
1305
-					);
1306
-				}
1307
-			} elseif ( ! $compatible_php ) {
1308
-				_e( 'This plugin does not work with your version of PHP.' );
1309
-				if ( current_user_can( 'update_php' ) ) {
1310
-					printf(
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() )
1314
-					);
1315
-					wp_update_php_annotation( '</p><p><em>', '</em>' );
1316
-				}
1317
-			}
1318
-
1319
-			echo '</p></div></td></tr>';
1320
-		}
1321
-
1322
-		/**
1323
-		 * Fires after each row in the Plugins list table.
1324
-		 *
1325
-		 * @since 2.3.0
1326
-		 * @since 5.5.0 Added 'auto-update-enabled' and 'auto-update-disabled'
1327
-		 *              to possible values for `$status`.
1328
-		 *
1329
-		 * @param string $plugin_file Path to the plugin file relative to the plugins directory.
1330
-		 * @param array  $plugin_data An array of plugin data. See `get_plugin_data()`
1331
-		 *                            and the {@see 'plugin_row_meta'} filter for the list
1332
-		 *                            of possible values.
1333
-		 * @param string $status      Status filter currently applied to the plugin list.
1334
-		 *                            Possible values are: 'all', 'active', 'inactive',
1335
-		 *                            'recently_activated', 'upgrade', 'mustuse', 'dropins',
1336
-		 *                            'search', 'paused', 'auto-update-enabled', 'auto-update-disabled'.
1337
-		 */
1338
-		do_action( 'after_plugin_row', $plugin_file, $plugin_data, $status );
1339
-
1340
-		/**
1341
-		 * Fires after each specific row in the Plugins list table.
1342
-		 *
1343
-		 * The dynamic portion of the hook name, `$plugin_file`, refers to the path
1344
-		 * to the plugin file, relative to the plugins directory.
1345
-		 *
1346
-		 * @since 2.7.0
1347
-		 * @since 5.5.0 Added 'auto-update-enabled' and 'auto-update-disabled'
1348
-		 *              to possible values for `$status`.
1349
-		 *
1350
-		 * @param string $plugin_file Path to the plugin file relative to the plugins directory.
1351
-		 * @param array  $plugin_data An array of plugin data. See `get_plugin_data()`
1352
-		 *                            and the {@see 'plugin_row_meta'} filter for the list
1353
-		 *                            of possible values.
1354
-		 * @param string $status      Status filter currently applied to the plugin list.
1355
-		 *                            Possible values are: 'all', 'active', 'inactive',
1356
-		 *                            'recently_activated', 'upgrade', 'mustuse', 'dropins',
1357
-		 *                            'search', 'paused', 'auto-update-enabled', 'auto-update-disabled'.
1358
-		 */
1359
-		do_action( "after_plugin_row_{$plugin_file}", $plugin_file, $plugin_data, $status );
1360
-	}
1361
-
1362
-	/**
1363
-	 * Gets the name of the primary column for this specific list table.
1364
-	 *
1365
-	 * @since 4.3.0
1366
-	 *
1367
-	 * @return string Unalterable name for the primary column, in this case, 'name'.
1368
-	 */
1369
-	protected function get_primary_column_name() {
1370
-		return 'name';
1371
-	}
1051
+                    $plugin_meta = array();
1052
+                    if ( ! empty( $plugin_data['Version'] ) ) {
1053
+                        /* translators: %s: Plugin version number. */
1054
+                        $plugin_meta[] = sprintf( __( 'Version %s' ), $plugin_data['Version'] );
1055
+                    }
1056
+                    if ( ! empty( $plugin_data['Author'] ) ) {
1057
+                        $author = $plugin_data['Author'];
1058
+                        if ( ! empty( $plugin_data['AuthorURI'] ) ) {
1059
+                            $author = '<a href="' . $plugin_data['AuthorURI'] . '">' . $plugin_data['Author'] . '</a>';
1060
+                        }
1061
+                        /* translators: %s: Plugin author name. */
1062
+                        $plugin_meta[] = sprintf( __( 'By %s' ), $author );
1063
+                    }
1064
+
1065
+                    // Details link using API info, if available.
1066
+                    if ( isset( $plugin_data['slug'] ) && current_user_can( 'install_plugins' ) ) {
1067
+                        $plugin_meta[] = sprintf(
1068
+                            '<a href="%s" class="thickbox open-plugin-details-modal" aria-label="%s" data-title="%s">%s</a>',
1069
+                            esc_url(
1070
+                                network_admin_url(
1071
+                                    'plugin-install.php?tab=plugin-information&plugin=' . $plugin_data['slug'] .
1072
+                                    '&TB_iframe=true&width=600&height=550'
1073
+                                )
1074
+                            ),
1075
+                            /* translators: %s: Plugin name. */
1076
+                            esc_attr( sprintf( __( 'More information about %s' ), $plugin_name ) ),
1077
+                            esc_attr( $plugin_name ),
1078
+                            __( 'View details' )
1079
+                        );
1080
+                    } elseif ( ! empty( $plugin_data['PluginURI'] ) ) {
1081
+                        /* translators: %s: Plugin name. */
1082
+                        $aria_label = sprintf( __( 'Visit plugin site for %s' ), $plugin_name );
1083
+
1084
+                        $plugin_meta[] = sprintf(
1085
+                            '<a href="%s" aria-label="%s">%s</a>',
1086
+                            esc_url( $plugin_data['PluginURI'] ),
1087
+                            esc_attr( $aria_label ),
1088
+                            __( 'Visit plugin site' )
1089
+                        );
1090
+                    }
1091
+
1092
+                    /**
1093
+                     * Filters the array of row meta for each plugin in the Plugins list table.
1094
+                     *
1095
+                     * @since 2.8.0
1096
+                     *
1097
+                     * @param string[] $plugin_meta An array of the plugin's metadata, including
1098
+                     *                              the version, author, author URI, and plugin URI.
1099
+                     * @param string   $plugin_file Path to the plugin file relative to the plugins directory.
1100
+                     * @param array    $plugin_data {
1101
+                     *     An array of plugin data.
1102
+                     *
1103
+                     *     @type string   $id               Plugin ID, e.g. `w.org/plugins/[plugin-name]`.
1104
+                     *     @type string   $slug             Plugin slug.
1105
+                     *     @type string   $plugin           Plugin basename.
1106
+                     *     @type string   $new_version      New plugin version.
1107
+                     *     @type string   $url              Plugin URL.
1108
+                     *     @type string   $package          Plugin update package URL.
1109
+                     *     @type string[] $icons            An array of plugin icon URLs.
1110
+                     *     @type string[] $banners          An array of plugin banner URLs.
1111
+                     *     @type string[] $banners_rtl      An array of plugin RTL banner URLs.
1112
+                     *     @type string   $requires         The version of WordPress which the plugin requires.
1113
+                     *     @type string   $tested           The version of WordPress the plugin is tested against.
1114
+                     *     @type string   $requires_php     The version of PHP which the plugin requires.
1115
+                     *     @type string   $upgrade_notice   The upgrade notice for the new plugin version.
1116
+                     *     @type bool     $update-supported Whether the plugin supports updates.
1117
+                     *     @type string   $Name             The human-readable name of the plugin.
1118
+                     *     @type string   $PluginURI        Plugin URI.
1119
+                     *     @type string   $Version          Plugin version.
1120
+                     *     @type string   $Description      Plugin description.
1121
+                     *     @type string   $Author           Plugin author.
1122
+                     *     @type string   $AuthorURI        Plugin author URI.
1123
+                     *     @type string   $TextDomain       Plugin textdomain.
1124
+                     *     @type string   $DomainPath       Relative path to the plugin's .mo file(s).
1125
+                     *     @type bool     $Network          Whether the plugin can only be activated network-wide.
1126
+                     *     @type string   $RequiresWP       The version of WordPress which the plugin requires.
1127
+                     *     @type string   $RequiresPHP      The version of PHP which the plugin requires.
1128
+                     *     @type string   $UpdateURI        ID of the plugin for update purposes, should be a URI.
1129
+                     *     @type string   $Title            The human-readable title of the plugin.
1130
+                     *     @type string   $AuthorName       Plugin author's name.
1131
+                     *     @type bool     $update           Whether there's an available update. Default null.
1132
+                     * }
1133
+                     * @param string   $status      Status filter currently applied to the plugin list. Possible
1134
+                     *                              values are: 'all', 'active', 'inactive', 'recently_activated',
1135
+                     *                              'upgrade', 'mustuse', 'dropins', 'search', 'paused',
1136
+                     *                              'auto-update-enabled', 'auto-update-disabled'.
1137
+                     */
1138
+                    $plugin_meta = apply_filters( 'plugin_row_meta', $plugin_meta, $plugin_file, $plugin_data, $status );
1139
+
1140
+                    echo implode( ' | ', $plugin_meta );
1141
+
1142
+                    echo '</div>';
1143
+
1144
+                    if ( $paused ) {
1145
+                        $notice_text = __( 'This plugin failed to load properly and is paused during recovery mode.' );
1146
+
1147
+                        printf( '<p><span class="dashicons dashicons-warning"></span> <strong>%s</strong></p>', $notice_text );
1148
+
1149
+                        $error = wp_get_plugin_error( $plugin_file );
1150
+
1151
+                        if ( false !== $error ) {
1152
+                            printf( '<div class="error-display"><p>%s</p></div>', wp_get_extension_error_description( $error ) );
1153
+                        }
1154
+                    }
1155
+
1156
+                    echo '</td>';
1157
+                    break;
1158
+                case 'auto-updates':
1159
+                    if ( ! $this->show_autoupdates ) {
1160
+                        break;
1161
+                    }
1162
+
1163
+                    echo "<td class='column-auto-updates{$extra_classes}'>";
1164
+
1165
+                    $html = array();
1166
+
1167
+                    if ( isset( $plugin_data['auto-update-forced'] ) ) {
1168
+                        if ( $plugin_data['auto-update-forced'] ) {
1169
+                            // Forced on.
1170
+                            $text = __( 'Auto-updates enabled' );
1171
+                        } else {
1172
+                            $text = __( 'Auto-updates disabled' );
1173
+                        }
1174
+                        $action     = 'unavailable';
1175
+                        $time_class = ' hidden';
1176
+                    } elseif ( empty( $plugin_data['update-supported'] ) ) {
1177
+                        $text       = '';
1178
+                        $action     = 'unavailable';
1179
+                        $time_class = ' hidden';
1180
+                    } elseif ( in_array( $plugin_file, $auto_updates, true ) ) {
1181
+                        $text       = __( 'Disable auto-updates' );
1182
+                        $action     = 'disable';
1183
+                        $time_class = '';
1184
+                    } else {
1185
+                        $text       = __( 'Enable auto-updates' );
1186
+                        $action     = 'enable';
1187
+                        $time_class = ' hidden';
1188
+                    }
1189
+
1190
+                    $query_args = array(
1191
+                        'action'        => "{$action}-auto-update",
1192
+                        'plugin'        => $plugin_file,
1193
+                        'paged'         => $page,
1194
+                        'plugin_status' => $status,
1195
+                    );
1196
+
1197
+                    $url = add_query_arg( $query_args, 'plugins.php' );
1198
+
1199
+                    if ( 'unavailable' === $action ) {
1200
+                        $html[] = '<span class="label">' . $text . '</span>';
1201
+                    } else {
1202
+                        $html[] = sprintf(
1203
+                            '<a href="%s" class="toggle-auto-update aria-button-if-js" data-wp-action="%s">',
1204
+                            wp_nonce_url( $url, 'updates' ),
1205
+                            $action
1206
+                        );
1207
+
1208
+                        $html[] = '<span class="dashicons dashicons-update spin hidden" aria-hidden="true"></span>';
1209
+                        $html[] = '<span class="label">' . $text . '</span>';
1210
+                        $html[] = '</a>';
1211
+                    }
1212
+
1213
+                    if ( ! empty( $plugin_data['update'] ) ) {
1214
+                        $html[] = sprintf(
1215
+                            '<div class="auto-update-time%s">%s</div>',
1216
+                            $time_class,
1217
+                            wp_get_auto_update_message()
1218
+                        );
1219
+                    }
1220
+
1221
+                    $html = implode( '', $html );
1222
+
1223
+                    /**
1224
+                     * Filters the HTML of the auto-updates setting for each plugin in the Plugins list table.
1225
+                     *
1226
+                     * @since 5.5.0
1227
+                     *
1228
+                     * @param string $html        The HTML of the plugin's auto-update column content,
1229
+                     *                            including toggle auto-update action links and
1230
+                     *                            time to next update.
1231
+                     * @param string $plugin_file Path to the plugin file relative to the plugins directory.
1232
+                     * @param array  $plugin_data An array of plugin data. See `get_plugin_data()`
1233
+                     *                            and the {@see 'plugin_row_meta'} filter for the list
1234
+                     *                            of possible values.
1235
+                     */
1236
+                    echo apply_filters( 'plugin_auto_update_setting_html', $html, $plugin_file, $plugin_data );
1237
+
1238
+                    echo '<div class="notice notice-error notice-alt inline hidden"><p></p></div>';
1239
+                    echo '</td>';
1240
+
1241
+                    break;
1242
+                default:
1243
+                    $classes = "$column_name column-$column_name $class";
1244
+
1245
+                    echo "<td class='$classes{$extra_classes}'>";
1246
+
1247
+                    /**
1248
+                     * Fires inside each custom column of the Plugins list table.
1249
+                     *
1250
+                     * @since 3.1.0
1251
+                     *
1252
+                     * @param string $column_name Name of the column.
1253
+                     * @param string $plugin_file Path to the plugin file relative to the plugins directory.
1254
+                     * @param array  $plugin_data An array of plugin data. See `get_plugin_data()`
1255
+                     *                            and the {@see 'plugin_row_meta'} filter for the list
1256
+                     *                            of possible values.
1257
+                     */
1258
+                    do_action( 'manage_plugins_custom_column', $column_name, $plugin_file, $plugin_data );
1259
+
1260
+                    echo '</td>';
1261
+            }
1262
+        }
1263
+
1264
+        echo '</tr>';
1265
+
1266
+        if ( ! $compatible_php || ! $compatible_wp ) {
1267
+            printf(
1268
+                '<tr class="plugin-update-tr">' .
1269
+                '<td colspan="%s" class="plugin-update colspanchange">' .
1270
+                '<div class="update-message notice inline notice-error notice-alt"><p>',
1271
+                esc_attr( $this->get_column_count() )
1272
+            );
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' ) ) {
1277
+                    printf(
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() )
1282
+                    );
1283
+                    wp_update_php_annotation( '</p><p><em>', '</em>' );
1284
+                } elseif ( current_user_can( 'update_core' ) ) {
1285
+                    printf(
1286
+                        /* translators: %s: URL to WordPress Updates screen. */
1287
+                        ' ' . __( '<a href="%s">Please update WordPress</a>.' ),
1288
+                        self_admin_url( 'update-core.php' )
1289
+                    );
1290
+                } elseif ( current_user_can( 'update_php' ) ) {
1291
+                    printf(
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() )
1295
+                    );
1296
+                    wp_update_php_annotation( '</p><p><em>', '</em>' );
1297
+                }
1298
+            } elseif ( ! $compatible_wp ) {
1299
+                _e( 'This plugin does not work with your version of WordPress.' );
1300
+                if ( current_user_can( 'update_core' ) ) {
1301
+                    printf(
1302
+                        /* translators: %s: URL to WordPress Updates screen. */
1303
+                        ' ' . __( '<a href="%s">Please update WordPress</a>.' ),
1304
+                        self_admin_url( 'update-core.php' )
1305
+                    );
1306
+                }
1307
+            } elseif ( ! $compatible_php ) {
1308
+                _e( 'This plugin does not work with your version of PHP.' );
1309
+                if ( current_user_can( 'update_php' ) ) {
1310
+                    printf(
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() )
1314
+                    );
1315
+                    wp_update_php_annotation( '</p><p><em>', '</em>' );
1316
+                }
1317
+            }
1318
+
1319
+            echo '</p></div></td></tr>';
1320
+        }
1321
+
1322
+        /**
1323
+         * Fires after each row in the Plugins list table.
1324
+         *
1325
+         * @since 2.3.0
1326
+         * @since 5.5.0 Added 'auto-update-enabled' and 'auto-update-disabled'
1327
+         *              to possible values for `$status`.
1328
+         *
1329
+         * @param string $plugin_file Path to the plugin file relative to the plugins directory.
1330
+         * @param array  $plugin_data An array of plugin data. See `get_plugin_data()`
1331
+         *                            and the {@see 'plugin_row_meta'} filter for the list
1332
+         *                            of possible values.
1333
+         * @param string $status      Status filter currently applied to the plugin list.
1334
+         *                            Possible values are: 'all', 'active', 'inactive',
1335
+         *                            'recently_activated', 'upgrade', 'mustuse', 'dropins',
1336
+         *                            'search', 'paused', 'auto-update-enabled', 'auto-update-disabled'.
1337
+         */
1338
+        do_action( 'after_plugin_row', $plugin_file, $plugin_data, $status );
1339
+
1340
+        /**
1341
+         * Fires after each specific row in the Plugins list table.
1342
+         *
1343
+         * The dynamic portion of the hook name, `$plugin_file`, refers to the path
1344
+         * to the plugin file, relative to the plugins directory.
1345
+         *
1346
+         * @since 2.7.0
1347
+         * @since 5.5.0 Added 'auto-update-enabled' and 'auto-update-disabled'
1348
+         *              to possible values for `$status`.
1349
+         *
1350
+         * @param string $plugin_file Path to the plugin file relative to the plugins directory.
1351
+         * @param array  $plugin_data An array of plugin data. See `get_plugin_data()`
1352
+         *                            and the {@see 'plugin_row_meta'} filter for the list
1353
+         *                            of possible values.
1354
+         * @param string $status      Status filter currently applied to the plugin list.
1355
+         *                            Possible values are: 'all', 'active', 'inactive',
1356
+         *                            'recently_activated', 'upgrade', 'mustuse', 'dropins',
1357
+         *                            'search', 'paused', 'auto-update-enabled', 'auto-update-disabled'.
1358
+         */
1359
+        do_action( "after_plugin_row_{$plugin_file}", $plugin_file, $plugin_data, $status );
1360
+    }
1361
+
1362
+    /**
1363
+     * Gets the name of the primary column for this specific list table.
1364
+     *
1365
+     * @since 4.3.0
1366
+     *
1367
+     * @return string Unalterable name for the primary column, in this case, 'name'.
1368
+     */
1369
+    protected function get_primary_column_name() {
1370
+        return 'name';
1371
+    }
1372 1372
 }
Please login to merge, or discard this patch.
Spacing   +325 added lines, -325 removed lines patch added patch discarded remove patch
@@ -37,47 +37,47 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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&amp;plugin=' . urlencode( $plugin_file ) . '&amp;plugin_status=' . $context . '&amp;paged=' . $page . '&amp;s=' . $s, 'deactivate-plugin_' . $plugin_file ),
793
-							esc_attr( $plugin_id_attr ),
792
+							wp_nonce_url('plugins.php?action=deactivate&amp;plugin=' . urlencode($plugin_file) . '&amp;plugin_status=' . $context . '&amp;paged=' . $page . '&amp;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&amp;plugin=' . urlencode( $plugin_file ) . '&amp;plugin_status=' . $context . '&amp;paged=' . $page . '&amp;s=' . $s, 'activate-plugin_' . $plugin_file ),
805
-								esc_attr( $plugin_id_attr ),
804
+								wp_nonce_url('plugins.php?action=activate&amp;plugin=' . urlencode($plugin_file) . '&amp;plugin_status=' . $context . '&amp;paged=' . $page . '&amp;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&amp;checked[]=' . urlencode( $plugin_file ) . '&amp;plugin_status=' . $context . '&amp;paged=' . $page . '&amp;s=' . $s, 'bulk-plugins' ),
822
-							esc_attr( $plugin_id_attr ),
821
+							wp_nonce_url('plugins.php?action=delete-selected&amp;checked[]=' . urlencode($plugin_file) . '&amp;plugin_status=' . $context . '&amp;paged=' . $page . '&amp;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&amp;plugin=' . urlencode( $plugin_file ) . '&amp;plugin_status=' . $context . '&amp;paged=' . $page . '&amp;s=' . $s, 'deactivate-plugin_' . $plugin_file ),
843
-							esc_attr( $plugin_id_attr ),
842
+							wp_nonce_url('plugins.php?action=deactivate&amp;plugin=' . urlencode($plugin_file) . '&amp;plugin_status=' . $context . '&amp;paged=' . $page . '&amp;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&amp;plugin=' . urlencode( $plugin_file ) . '&amp;plugin_status=' . $context . '&amp;paged=' . $page . '&amp;s=' . $s, 'resume-plugin_' . $plugin_file ),
854
-							esc_attr( $plugin_id_attr ),
853
+							wp_nonce_url('plugins.php?action=resume&amp;plugin=' . urlencode($plugin_file) . '&amp;plugin_status=' . $context . '&amp;paged=' . $page . '&amp;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&amp;plugin=' . urlencode( $plugin_file ) . '&amp;plugin_status=' . $context . '&amp;paged=' . $page . '&amp;s=' . $s, 'activate-plugin_' . $plugin_file ),
866
-								esc_attr( $plugin_id_attr ),
865
+								wp_nonce_url('plugins.php?action=activate&amp;plugin=' . urlencode($plugin_file) . '&amp;plugin_status=' . $context . '&amp;paged=' . $page . '&amp;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&amp;checked[]=' . urlencode( $plugin_file ) . '&amp;plugin_status=' . $context . '&amp;paged=' . $page . '&amp;s=' . $s, 'bulk-plugins' ),
883
-							esc_attr( $plugin_id_attr ),
882
+							wp_nonce_url('plugins.php?action=delete-selected&amp;checked[]=' . urlencode($plugin_file) . '&amp;plugin_status=' . $context . '&amp;paged=' . $page . '&amp;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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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'] : '&nbsp;' ) . '</p>';
996
+		if ('dropins' !== $context) {
997
+			$description = '<p>' . ($plugin_data['Description'] ? $plugin_data['Description'] : '&nbsp;') . '</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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 	/**
Please login to merge, or discard this patch.
brighty/wp-admin/includes/list-table.php 2 patches
Indentation   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -20,48 +20,48 @@  discard block
 block discarded – undo
20 20
  * @return WP_List_Table|false List table object on success, false if the class does not exist.
21 21
  */
22 22
 function _get_list_table( $class_name, $args = array() ) {
23
-	$core_classes = array(
24
-		// Site Admin.
25
-		'WP_Posts_List_Table'                         => 'posts',
26
-		'WP_Media_List_Table'                         => 'media',
27
-		'WP_Terms_List_Table'                         => 'terms',
28
-		'WP_Users_List_Table'                         => 'users',
29
-		'WP_Comments_List_Table'                      => 'comments',
30
-		'WP_Post_Comments_List_Table'                 => array( 'comments', 'post-comments' ),
31
-		'WP_Links_List_Table'                         => 'links',
32
-		'WP_Plugin_Install_List_Table'                => 'plugin-install',
33
-		'WP_Themes_List_Table'                        => 'themes',
34
-		'WP_Theme_Install_List_Table'                 => array( 'themes', 'theme-install' ),
35
-		'WP_Plugins_List_Table'                       => 'plugins',
36
-		'WP_Application_Passwords_List_Table'         => 'application-passwords',
23
+    $core_classes = array(
24
+        // Site Admin.
25
+        'WP_Posts_List_Table'                         => 'posts',
26
+        'WP_Media_List_Table'                         => 'media',
27
+        'WP_Terms_List_Table'                         => 'terms',
28
+        'WP_Users_List_Table'                         => 'users',
29
+        'WP_Comments_List_Table'                      => 'comments',
30
+        'WP_Post_Comments_List_Table'                 => array( 'comments', 'post-comments' ),
31
+        'WP_Links_List_Table'                         => 'links',
32
+        'WP_Plugin_Install_List_Table'                => 'plugin-install',
33
+        'WP_Themes_List_Table'                        => 'themes',
34
+        'WP_Theme_Install_List_Table'                 => array( 'themes', 'theme-install' ),
35
+        'WP_Plugins_List_Table'                       => 'plugins',
36
+        'WP_Application_Passwords_List_Table'         => 'application-passwords',
37 37
 
38
-		// Network Admin.
39
-		'WP_MS_Sites_List_Table'                      => 'ms-sites',
40
-		'WP_MS_Users_List_Table'                      => 'ms-users',
41
-		'WP_MS_Themes_List_Table'                     => 'ms-themes',
38
+        // Network Admin.
39
+        'WP_MS_Sites_List_Table'                      => 'ms-sites',
40
+        'WP_MS_Users_List_Table'                      => 'ms-users',
41
+        'WP_MS_Themes_List_Table'                     => 'ms-themes',
42 42
 
43
-		// Privacy requests tables.
44
-		'WP_Privacy_Data_Export_Requests_List_Table'  => 'privacy-data-export-requests',
45
-		'WP_Privacy_Data_Removal_Requests_List_Table' => 'privacy-data-removal-requests',
46
-	);
43
+        // Privacy requests tables.
44
+        'WP_Privacy_Data_Export_Requests_List_Table'  => 'privacy-data-export-requests',
45
+        'WP_Privacy_Data_Removal_Requests_List_Table' => 'privacy-data-removal-requests',
46
+    );
47 47
 
48
-	if ( isset( $core_classes[ $class_name ] ) ) {
49
-		foreach ( (array) $core_classes[ $class_name ] as $required ) {
50
-			require_once ABSPATH . 'wp-admin/includes/class-wp-' . $required . '-list-table.php';
51
-		}
48
+    if ( isset( $core_classes[ $class_name ] ) ) {
49
+        foreach ( (array) $core_classes[ $class_name ] as $required ) {
50
+            require_once ABSPATH . 'wp-admin/includes/class-wp-' . $required . '-list-table.php';
51
+        }
52 52
 
53
-		if ( isset( $args['screen'] ) ) {
54
-			$args['screen'] = convert_to_screen( $args['screen'] );
55
-		} elseif ( isset( $GLOBALS['hook_suffix'] ) ) {
56
-			$args['screen'] = get_current_screen();
57
-		} else {
58
-			$args['screen'] = null;
59
-		}
53
+        if ( isset( $args['screen'] ) ) {
54
+            $args['screen'] = convert_to_screen( $args['screen'] );
55
+        } elseif ( isset( $GLOBALS['hook_suffix'] ) ) {
56
+            $args['screen'] = get_current_screen();
57
+        } else {
58
+            $args['screen'] = null;
59
+        }
60 60
 
61
-		return new $class_name( $args );
62
-	}
61
+        return new $class_name( $args );
62
+    }
63 63
 
64
-	return false;
64
+    return false;
65 65
 }
66 66
 
67 67
 /**
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
  *                          column names as the values.
78 78
  */
79 79
 function register_column_headers( $screen, $columns ) {
80
-	new _WP_List_Table_Compat( $screen, $columns );
80
+    new _WP_List_Table_Compat( $screen, $columns );
81 81
 }
82 82
 
83 83
 /**
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
  * @param bool             $with_id Whether to set the ID attribute or not.
90 90
  */
91 91
 function print_column_headers( $screen, $with_id = true ) {
92
-	$wp_list_table = new _WP_List_Table_Compat( $screen );
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
 }
Please login to merge, or discard this patch.
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
brighty/wp-admin/includes/class-language-pack-upgrader.php 2 patches
Indentation   +447 added lines, -447 removed lines patch added patch discarded remove patch
@@ -18,457 +18,457 @@
 block discarded – undo
18 18
  */
19 19
 class Language_Pack_Upgrader extends WP_Upgrader {
20 20
 
21
-	/**
22
-	 * Result of the language pack upgrade.
23
-	 *
24
-	 * @since 3.7.0
25
-	 * @var array|WP_Error $result
26
-	 * @see WP_Upgrader::$result
27
-	 */
28
-	public $result;
29
-
30
-	/**
31
-	 * Whether a bulk upgrade/installation is being performed.
32
-	 *
33
-	 * @since 3.7.0
34
-	 * @var bool $bulk
35
-	 */
36
-	public $bulk = true;
37
-
38
-	/**
39
-	 * Asynchronously upgrades language packs after other upgrades have been made.
40
-	 *
41
-	 * Hooked to the {@see 'upgrader_process_complete'} action by default.
42
-	 *
43
-	 * @since 3.7.0
44
-	 *
45
-	 * @param false|WP_Upgrader $upgrader Optional. WP_Upgrader instance or false. If `$upgrader` is
46
-	 *                                    a Language_Pack_Upgrader instance, the method will bail to
47
-	 *                                    avoid recursion. Otherwise unused. Default false.
48
-	 */
49
-	public static function async_upgrade( $upgrader = false ) {
50
-		// Avoid recursion.
51
-		if ( $upgrader && $upgrader instanceof Language_Pack_Upgrader ) {
52
-			return;
53
-		}
54
-
55
-		// Nothing to do?
56
-		$language_updates = wp_get_translation_updates();
57
-		if ( ! $language_updates ) {
58
-			return;
59
-		}
60
-
61
-		/*
21
+    /**
22
+     * Result of the language pack upgrade.
23
+     *
24
+     * @since 3.7.0
25
+     * @var array|WP_Error $result
26
+     * @see WP_Upgrader::$result
27
+     */
28
+    public $result;
29
+
30
+    /**
31
+     * Whether a bulk upgrade/installation is being performed.
32
+     *
33
+     * @since 3.7.0
34
+     * @var bool $bulk
35
+     */
36
+    public $bulk = true;
37
+
38
+    /**
39
+     * Asynchronously upgrades language packs after other upgrades have been made.
40
+     *
41
+     * Hooked to the {@see 'upgrader_process_complete'} action by default.
42
+     *
43
+     * @since 3.7.0
44
+     *
45
+     * @param false|WP_Upgrader $upgrader Optional. WP_Upgrader instance or false. If `$upgrader` is
46
+     *                                    a Language_Pack_Upgrader instance, the method will bail to
47
+     *                                    avoid recursion. Otherwise unused. Default false.
48
+     */
49
+    public static function async_upgrade( $upgrader = false ) {
50
+        // Avoid recursion.
51
+        if ( $upgrader && $upgrader instanceof Language_Pack_Upgrader ) {
52
+            return;
53
+        }
54
+
55
+        // Nothing to do?
56
+        $language_updates = wp_get_translation_updates();
57
+        if ( ! $language_updates ) {
58
+            return;
59
+        }
60
+
61
+        /*
62 62
 		 * Avoid messing with VCS installations, at least for now.
63 63
 		 * Noted: this is not the ideal way to accomplish this.
64 64
 		 */
65
-		$check_vcs = new WP_Automatic_Updater;
66
-		if ( $check_vcs->is_vcs_checkout( WP_CONTENT_DIR ) ) {
67
-			return;
68
-		}
69
-
70
-		foreach ( $language_updates as $key => $language_update ) {
71
-			$update = ! empty( $language_update->autoupdate );
72
-
73
-			/**
74
-			 * Filters whether to asynchronously update translation for core, a plugin, or a theme.
75
-			 *
76
-			 * @since 4.0.0
77
-			 *
78
-			 * @param bool   $update          Whether to update.
79
-			 * @param object $language_update The update offer.
80
-			 */
81
-			$update = apply_filters( 'async_update_translation', $update, $language_update );
82
-
83
-			if ( ! $update ) {
84
-				unset( $language_updates[ $key ] );
85
-			}
86
-		}
87
-
88
-		if ( empty( $language_updates ) ) {
89
-			return;
90
-		}
91
-
92
-		// Re-use the automatic upgrader skin if the parent upgrader is using it.
93
-		if ( $upgrader && $upgrader->skin instanceof Automatic_Upgrader_Skin ) {
94
-			$skin = $upgrader->skin;
95
-		} else {
96
-			$skin = new Language_Pack_Upgrader_Skin(
97
-				array(
98
-					'skip_header_footer' => true,
99
-				)
100
-			);
101
-		}
102
-
103
-		$lp_upgrader = new Language_Pack_Upgrader( $skin );
104
-		$lp_upgrader->bulk_upgrade( $language_updates );
105
-	}
106
-
107
-	/**
108
-	 * Initialize the upgrade strings.
109
-	 *
110
-	 * @since 3.7.0
111
-	 */
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.' );
116
-		/* translators: %s: Package URL. */
117
-		$this->strings['downloading_package'] = sprintf( __( 'Downloading translation from %s&#8230;' ), '<span class="code">%s</span>' );
118
-		$this->strings['unpack_package']      = __( 'Unpacking the update&#8230;' );
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&#8230;' );
122
-		$this->strings['remove_old_failed']   = __( 'Could not remove the old translation.' );
123
-	}
124
-
125
-	/**
126
-	 * Upgrade a language pack.
127
-	 *
128
-	 * @since 3.7.0
129
-	 *
130
-	 * @param string|false $update Optional. Whether an update offer is available. Default false.
131
-	 * @param array        $args   Optional. Other optional arguments, see
132
-	 *                             Language_Pack_Upgrader::bulk_upgrade(). Default empty array.
133
-	 * @return array|bool|WP_Error The result of the upgrade, or a WP_Error object instead.
134
-	 */
135
-	public function upgrade( $update = false, $args = array() ) {
136
-		if ( $update ) {
137
-			$update = array( $update );
138
-		}
139
-
140
-		$results = $this->bulk_upgrade( $update, $args );
141
-
142
-		if ( ! is_array( $results ) ) {
143
-			return $results;
144
-		}
145
-
146
-		return $results[0];
147
-	}
148
-
149
-	/**
150
-	 * Bulk upgrade language packs.
151
-	 *
152
-	 * @since 3.7.0
153
-	 *
154
-	 * @global WP_Filesystem_Base $wp_filesystem WordPress filesystem subclass.
155
-	 *
156
-	 * @param object[] $language_updates Optional. Array of language packs to update. @see wp_get_translation_updates().
157
-	 *                                   Default empty array.
158
-	 * @param array    $args {
159
-	 *     Other arguments for upgrading multiple language packs. Default empty array.
160
-	 *
161
-	 *     @type bool $clear_update_cache Whether to clear the update cache when done.
162
-	 *                                    Default true.
163
-	 * }
164
-	 * @return array|bool|WP_Error Will return an array of results, or true if there are no updates,
165
-	 *                             false or WP_Error for initial errors.
166
-	 */
167
-	public function bulk_upgrade( $language_updates = array(), $args = array() ) {
168
-		global $wp_filesystem;
169
-
170
-		$defaults    = array(
171
-			'clear_update_cache' => true,
172
-		);
173
-		$parsed_args = wp_parse_args( $args, $defaults );
174
-
175
-		$this->init();
176
-		$this->upgrade_strings();
177
-
178
-		if ( ! $language_updates ) {
179
-			$language_updates = wp_get_translation_updates();
180
-		}
181
-
182
-		if ( empty( $language_updates ) ) {
183
-			$this->skin->header();
184
-			$this->skin->set_result( true );
185
-			$this->skin->feedback( 'up_to_date' );
186
-			$this->skin->bulk_footer();
187
-			$this->skin->footer();
188
-			return true;
189
-		}
190
-
191
-		if ( 'upgrader_process_complete' === current_filter() ) {
192
-			$this->skin->feedback( 'starting_upgrade' );
193
-		}
194
-
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' );
200
-
201
-		add_filter( 'upgrader_source_selection', array( $this, 'check_package' ), 10, 2 );
202
-
203
-		$this->skin->header();
204
-
205
-		// Connect to the filesystem first.
206
-		$res = $this->fs_connect( array( WP_CONTENT_DIR, WP_LANG_DIR ) );
207
-		if ( ! $res ) {
208
-			$this->skin->footer();
209
-			return false;
210
-		}
211
-
212
-		$results = array();
213
-
214
-		$this->update_count   = count( $language_updates );
215
-		$this->update_current = 0;
216
-
217
-		/*
65
+        $check_vcs = new WP_Automatic_Updater;
66
+        if ( $check_vcs->is_vcs_checkout( WP_CONTENT_DIR ) ) {
67
+            return;
68
+        }
69
+
70
+        foreach ( $language_updates as $key => $language_update ) {
71
+            $update = ! empty( $language_update->autoupdate );
72
+
73
+            /**
74
+             * Filters whether to asynchronously update translation for core, a plugin, or a theme.
75
+             *
76
+             * @since 4.0.0
77
+             *
78
+             * @param bool   $update          Whether to update.
79
+             * @param object $language_update The update offer.
80
+             */
81
+            $update = apply_filters( 'async_update_translation', $update, $language_update );
82
+
83
+            if ( ! $update ) {
84
+                unset( $language_updates[ $key ] );
85
+            }
86
+        }
87
+
88
+        if ( empty( $language_updates ) ) {
89
+            return;
90
+        }
91
+
92
+        // Re-use the automatic upgrader skin if the parent upgrader is using it.
93
+        if ( $upgrader && $upgrader->skin instanceof Automatic_Upgrader_Skin ) {
94
+            $skin = $upgrader->skin;
95
+        } else {
96
+            $skin = new Language_Pack_Upgrader_Skin(
97
+                array(
98
+                    'skip_header_footer' => true,
99
+                )
100
+            );
101
+        }
102
+
103
+        $lp_upgrader = new Language_Pack_Upgrader( $skin );
104
+        $lp_upgrader->bulk_upgrade( $language_updates );
105
+    }
106
+
107
+    /**
108
+     * Initialize the upgrade strings.
109
+     *
110
+     * @since 3.7.0
111
+     */
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.' );
116
+        /* translators: %s: Package URL. */
117
+        $this->strings['downloading_package'] = sprintf( __( 'Downloading translation from %s&#8230;' ), '<span class="code">%s</span>' );
118
+        $this->strings['unpack_package']      = __( 'Unpacking the update&#8230;' );
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&#8230;' );
122
+        $this->strings['remove_old_failed']   = __( 'Could not remove the old translation.' );
123
+    }
124
+
125
+    /**
126
+     * Upgrade a language pack.
127
+     *
128
+     * @since 3.7.0
129
+     *
130
+     * @param string|false $update Optional. Whether an update offer is available. Default false.
131
+     * @param array        $args   Optional. Other optional arguments, see
132
+     *                             Language_Pack_Upgrader::bulk_upgrade(). Default empty array.
133
+     * @return array|bool|WP_Error The result of the upgrade, or a WP_Error object instead.
134
+     */
135
+    public function upgrade( $update = false, $args = array() ) {
136
+        if ( $update ) {
137
+            $update = array( $update );
138
+        }
139
+
140
+        $results = $this->bulk_upgrade( $update, $args );
141
+
142
+        if ( ! is_array( $results ) ) {
143
+            return $results;
144
+        }
145
+
146
+        return $results[0];
147
+    }
148
+
149
+    /**
150
+     * Bulk upgrade language packs.
151
+     *
152
+     * @since 3.7.0
153
+     *
154
+     * @global WP_Filesystem_Base $wp_filesystem WordPress filesystem subclass.
155
+     *
156
+     * @param object[] $language_updates Optional. Array of language packs to update. @see wp_get_translation_updates().
157
+     *                                   Default empty array.
158
+     * @param array    $args {
159
+     *     Other arguments for upgrading multiple language packs. Default empty array.
160
+     *
161
+     *     @type bool $clear_update_cache Whether to clear the update cache when done.
162
+     *                                    Default true.
163
+     * }
164
+     * @return array|bool|WP_Error Will return an array of results, or true if there are no updates,
165
+     *                             false or WP_Error for initial errors.
166
+     */
167
+    public function bulk_upgrade( $language_updates = array(), $args = array() ) {
168
+        global $wp_filesystem;
169
+
170
+        $defaults    = array(
171
+            'clear_update_cache' => true,
172
+        );
173
+        $parsed_args = wp_parse_args( $args, $defaults );
174
+
175
+        $this->init();
176
+        $this->upgrade_strings();
177
+
178
+        if ( ! $language_updates ) {
179
+            $language_updates = wp_get_translation_updates();
180
+        }
181
+
182
+        if ( empty( $language_updates ) ) {
183
+            $this->skin->header();
184
+            $this->skin->set_result( true );
185
+            $this->skin->feedback( 'up_to_date' );
186
+            $this->skin->bulk_footer();
187
+            $this->skin->footer();
188
+            return true;
189
+        }
190
+
191
+        if ( 'upgrader_process_complete' === current_filter() ) {
192
+            $this->skin->feedback( 'starting_upgrade' );
193
+        }
194
+
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' );
200
+
201
+        add_filter( 'upgrader_source_selection', array( $this, 'check_package' ), 10, 2 );
202
+
203
+        $this->skin->header();
204
+
205
+        // Connect to the filesystem first.
206
+        $res = $this->fs_connect( array( WP_CONTENT_DIR, WP_LANG_DIR ) );
207
+        if ( ! $res ) {
208
+            $this->skin->footer();
209
+            return false;
210
+        }
211
+
212
+        $results = array();
213
+
214
+        $this->update_count   = count( $language_updates );
215
+        $this->update_current = 0;
216
+
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 );
225
-			}
226
-		}
227
-
228
-		$language_updates_results = array();
229
-
230
-		foreach ( $language_updates as $language_update ) {
231
-
232
-			$this->skin->language_update = $language_update;
233
-
234
-			$destination = WP_LANG_DIR;
235
-			if ( 'plugin' === $language_update->type ) {
236
-				$destination .= '/plugins';
237
-			} elseif ( 'theme' === $language_update->type ) {
238
-				$destination .= '/themes';
239
-			}
240
-
241
-			$this->update_current++;
242
-
243
-			$options = array(
244
-				'package'                     => $language_update->package,
245
-				'destination'                 => $destination,
246
-				'clear_destination'           => true,
247
-				'abort_if_destination_exists' => false, // We expect the destination to exist.
248
-				'clear_working'               => true,
249
-				'is_multi'                    => true,
250
-				'hook_extra'                  => array(
251
-					'language_update_type' => $language_update->type,
252
-					'language_update'      => $language_update,
253
-				),
254
-			);
255
-
256
-			$result = $this->run( $options );
257
-
258
-			$results[] = $this->result;
259
-
260
-			// Prevent credentials auth screen from displaying multiple times.
261
-			if ( false === $result ) {
262
-				break;
263
-			}
264
-
265
-			$language_updates_results[] = array(
266
-				'language' => $language_update->language,
267
-				'type'     => $language_update->type,
268
-				'slug'     => isset( $language_update->slug ) ? $language_update->slug : 'default',
269
-				'version'  => $language_update->version,
270
-			);
271
-		}
272
-
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' );
278
-
279
-		/** This action is documented in wp-admin/includes/class-wp-upgrader.php */
280
-		do_action(
281
-			'upgrader_process_complete',
282
-			$this,
283
-			array(
284
-				'action'       => 'update',
285
-				'type'         => 'translation',
286
-				'bulk'         => true,
287
-				'translations' => $language_updates_results,
288
-			)
289
-		);
290
-
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 );
296
-
297
-		$this->skin->bulk_footer();
298
-
299
-		$this->skin->footer();
300
-
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' ) );
303
-
304
-		if ( $parsed_args['clear_update_cache'] ) {
305
-			wp_clean_update_cache();
306
-		}
307
-
308
-		return $results;
309
-	}
310
-
311
-	/**
312
-	 * Checks that the package source contains .mo and .po files.
313
-	 *
314
-	 * Hooked to the {@see 'upgrader_source_selection'} filter by
315
-	 * Language_Pack_Upgrader::bulk_upgrade().
316
-	 *
317
-	 * @since 3.7.0
318
-	 *
319
-	 * @global WP_Filesystem_Base $wp_filesystem WordPress filesystem subclass.
320
-	 *
321
-	 * @param string|WP_Error $source        The path to the downloaded package source.
322
-	 * @param string          $remote_source Remote file source location.
323
-	 * @return string|WP_Error The source as passed, or a WP_Error object on failure.
324
-	 */
325
-	public function check_package( $source, $remote_source ) {
326
-		global $wp_filesystem;
327
-
328
-		if ( is_wp_error( $source ) ) {
329
-			return $source;
330
-		}
331
-
332
-		// Check that the folder contains a valid language.
333
-		$files = $wp_filesystem->dirlist( $remote_source );
334
-
335
-		// Check to see if a .po and .mo exist in the folder.
336
-		$po = false;
337
-		$mo = false;
338
-		foreach ( (array) $files as $file => $filedata ) {
339
-			if ( '.po' === substr( $file, -3 ) ) {
340
-				$po = true;
341
-			} elseif ( '.mo' === substr( $file, -3 ) ) {
342
-				$mo = true;
343
-			}
344
-		}
345
-
346
-		if ( ! $mo || ! $po ) {
347
-			return new WP_Error(
348
-				'incompatible_archive_pomo',
349
-				$this->strings['incompatible_archive'],
350
-				sprintf(
351
-					/* translators: 1: .po, 2: .mo */
352
-					__( 'The language pack is missing either the %1$s or %2$s files.' ),
353
-					'<code>.po</code>',
354
-					'<code>.mo</code>'
355
-				)
356
-			);
357
-		}
358
-
359
-		return $source;
360
-	}
361
-
362
-	/**
363
-	 * Get the name of an item being updated.
364
-	 *
365
-	 * @since 3.7.0
366
-	 *
367
-	 * @param object $update The data for an update.
368
-	 * @return string The name of the item being updated.
369
-	 */
370
-	public function get_name_for_update( $update ) {
371
-		switch ( $update->type ) {
372
-			case 'core':
373
-				return 'WordPress'; // Not translated.
374
-
375
-			case 'theme':
376
-				$theme = wp_get_theme( $update->slug );
377
-				if ( $theme->exists() ) {
378
-					return $theme->Get( 'Name' );
379
-				}
380
-				break;
381
-			case 'plugin':
382
-				$plugin_data = get_plugins( '/' . $update->slug );
383
-				$plugin_data = reset( $plugin_data );
384
-				if ( $plugin_data ) {
385
-					return $plugin_data['Name'];
386
-				}
387
-				break;
388
-		}
389
-		return '';
390
-	}
391
-
392
-	/**
393
-	 * Clears existing translations where this item is going to be installed into.
394
-	 *
395
-	 * @since 5.1.0
396
-	 *
397
-	 * @global WP_Filesystem_Base $wp_filesystem WordPress filesystem subclass.
398
-	 *
399
-	 * @param string $remote_destination The location on the remote filesystem to be cleared.
400
-	 * @return bool|WP_Error True upon success, WP_Error on failure.
401
-	 */
402
-	public function clear_destination( $remote_destination ) {
403
-		global $wp_filesystem;
404
-
405
-		$language_update    = $this->skin->language_update;
406
-		$language_directory = WP_LANG_DIR . '/'; // Local path for use with glob().
407
-
408
-		if ( 'core' === $language_update->type ) {
409
-			$files = array(
410
-				$remote_destination . $language_update->language . '.po',
411
-				$remote_destination . $language_update->language . '.mo',
412
-				$remote_destination . 'admin-' . $language_update->language . '.po',
413
-				$remote_destination . 'admin-' . $language_update->language . '.mo',
414
-				$remote_destination . 'admin-network-' . $language_update->language . '.po',
415
-				$remote_destination . 'admin-network-' . $language_update->language . '.mo',
416
-				$remote_destination . 'continents-cities-' . $language_update->language . '.po',
417
-				$remote_destination . 'continents-cities-' . $language_update->language . '.mo',
418
-			);
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 );
424
-				}
425
-			}
426
-		} else {
427
-			$files = array(
428
-				$remote_destination . $language_update->slug . '-' . $language_update->language . '.po',
429
-				$remote_destination . $language_update->slug . '-' . $language_update->language . '.mo',
430
-			);
431
-
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 );
437
-				}
438
-			}
439
-		}
440
-
441
-		$files = array_filter( $files, array( $wp_filesystem, 'exists' ) );
442
-
443
-		// No files to delete.
444
-		if ( ! $files ) {
445
-			return true;
446
-		}
447
-
448
-		// Check all files are writable before attempting to clear the destination.
449
-		$unwritable_files = array();
450
-
451
-		// Check writability.
452
-		foreach ( $files as $file ) {
453
-			if ( ! $wp_filesystem->is_writable( $file ) ) {
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 ) ) {
457
-					$unwritable_files[] = $file;
458
-				}
459
-			}
460
-		}
461
-
462
-		if ( ! empty( $unwritable_files ) ) {
463
-			return new WP_Error( 'files_not_writable', $this->strings['files_not_writable'], implode( ', ', $unwritable_files ) );
464
-		}
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'] );
469
-			}
470
-		}
471
-
472
-		return true;
473
-	}
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
+            }
226
+        }
227
+
228
+        $language_updates_results = array();
229
+
230
+        foreach ( $language_updates as $language_update ) {
231
+
232
+            $this->skin->language_update = $language_update;
233
+
234
+            $destination = WP_LANG_DIR;
235
+            if ( 'plugin' === $language_update->type ) {
236
+                $destination .= '/plugins';
237
+            } elseif ( 'theme' === $language_update->type ) {
238
+                $destination .= '/themes';
239
+            }
240
+
241
+            $this->update_current++;
242
+
243
+            $options = array(
244
+                'package'                     => $language_update->package,
245
+                'destination'                 => $destination,
246
+                'clear_destination'           => true,
247
+                'abort_if_destination_exists' => false, // We expect the destination to exist.
248
+                'clear_working'               => true,
249
+                'is_multi'                    => true,
250
+                'hook_extra'                  => array(
251
+                    'language_update_type' => $language_update->type,
252
+                    'language_update'      => $language_update,
253
+                ),
254
+            );
255
+
256
+            $result = $this->run( $options );
257
+
258
+            $results[] = $this->result;
259
+
260
+            // Prevent credentials auth screen from displaying multiple times.
261
+            if ( false === $result ) {
262
+                break;
263
+            }
264
+
265
+            $language_updates_results[] = array(
266
+                'language' => $language_update->language,
267
+                'type'     => $language_update->type,
268
+                'slug'     => isset( $language_update->slug ) ? $language_update->slug : 'default',
269
+                'version'  => $language_update->version,
270
+            );
271
+        }
272
+
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' );
278
+
279
+        /** This action is documented in wp-admin/includes/class-wp-upgrader.php */
280
+        do_action(
281
+            'upgrader_process_complete',
282
+            $this,
283
+            array(
284
+                'action'       => 'update',
285
+                'type'         => 'translation',
286
+                'bulk'         => true,
287
+                'translations' => $language_updates_results,
288
+            )
289
+        );
290
+
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 );
296
+
297
+        $this->skin->bulk_footer();
298
+
299
+        $this->skin->footer();
300
+
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' ) );
303
+
304
+        if ( $parsed_args['clear_update_cache'] ) {
305
+            wp_clean_update_cache();
306
+        }
307
+
308
+        return $results;
309
+    }
310
+
311
+    /**
312
+     * Checks that the package source contains .mo and .po files.
313
+     *
314
+     * Hooked to the {@see 'upgrader_source_selection'} filter by
315
+     * Language_Pack_Upgrader::bulk_upgrade().
316
+     *
317
+     * @since 3.7.0
318
+     *
319
+     * @global WP_Filesystem_Base $wp_filesystem WordPress filesystem subclass.
320
+     *
321
+     * @param string|WP_Error $source        The path to the downloaded package source.
322
+     * @param string          $remote_source Remote file source location.
323
+     * @return string|WP_Error The source as passed, or a WP_Error object on failure.
324
+     */
325
+    public function check_package( $source, $remote_source ) {
326
+        global $wp_filesystem;
327
+
328
+        if ( is_wp_error( $source ) ) {
329
+            return $source;
330
+        }
331
+
332
+        // Check that the folder contains a valid language.
333
+        $files = $wp_filesystem->dirlist( $remote_source );
334
+
335
+        // Check to see if a .po and .mo exist in the folder.
336
+        $po = false;
337
+        $mo = false;
338
+        foreach ( (array) $files as $file => $filedata ) {
339
+            if ( '.po' === substr( $file, -3 ) ) {
340
+                $po = true;
341
+            } elseif ( '.mo' === substr( $file, -3 ) ) {
342
+                $mo = true;
343
+            }
344
+        }
345
+
346
+        if ( ! $mo || ! $po ) {
347
+            return new WP_Error(
348
+                'incompatible_archive_pomo',
349
+                $this->strings['incompatible_archive'],
350
+                sprintf(
351
+                    /* translators: 1: .po, 2: .mo */
352
+                    __( 'The language pack is missing either the %1$s or %2$s files.' ),
353
+                    '<code>.po</code>',
354
+                    '<code>.mo</code>'
355
+                )
356
+            );
357
+        }
358
+
359
+        return $source;
360
+    }
361
+
362
+    /**
363
+     * Get the name of an item being updated.
364
+     *
365
+     * @since 3.7.0
366
+     *
367
+     * @param object $update The data for an update.
368
+     * @return string The name of the item being updated.
369
+     */
370
+    public function get_name_for_update( $update ) {
371
+        switch ( $update->type ) {
372
+            case 'core':
373
+                return 'WordPress'; // Not translated.
374
+
375
+            case 'theme':
376
+                $theme = wp_get_theme( $update->slug );
377
+                if ( $theme->exists() ) {
378
+                    return $theme->Get( 'Name' );
379
+                }
380
+                break;
381
+            case 'plugin':
382
+                $plugin_data = get_plugins( '/' . $update->slug );
383
+                $plugin_data = reset( $plugin_data );
384
+                if ( $plugin_data ) {
385
+                    return $plugin_data['Name'];
386
+                }
387
+                break;
388
+        }
389
+        return '';
390
+    }
391
+
392
+    /**
393
+     * Clears existing translations where this item is going to be installed into.
394
+     *
395
+     * @since 5.1.0
396
+     *
397
+     * @global WP_Filesystem_Base $wp_filesystem WordPress filesystem subclass.
398
+     *
399
+     * @param string $remote_destination The location on the remote filesystem to be cleared.
400
+     * @return bool|WP_Error True upon success, WP_Error on failure.
401
+     */
402
+    public function clear_destination( $remote_destination ) {
403
+        global $wp_filesystem;
404
+
405
+        $language_update    = $this->skin->language_update;
406
+        $language_directory = WP_LANG_DIR . '/'; // Local path for use with glob().
407
+
408
+        if ( 'core' === $language_update->type ) {
409
+            $files = array(
410
+                $remote_destination . $language_update->language . '.po',
411
+                $remote_destination . $language_update->language . '.mo',
412
+                $remote_destination . 'admin-' . $language_update->language . '.po',
413
+                $remote_destination . 'admin-' . $language_update->language . '.mo',
414
+                $remote_destination . 'admin-network-' . $language_update->language . '.po',
415
+                $remote_destination . 'admin-network-' . $language_update->language . '.mo',
416
+                $remote_destination . 'continents-cities-' . $language_update->language . '.po',
417
+                $remote_destination . 'continents-cities-' . $language_update->language . '.mo',
418
+            );
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 );
424
+                }
425
+            }
426
+        } else {
427
+            $files = array(
428
+                $remote_destination . $language_update->slug . '-' . $language_update->language . '.po',
429
+                $remote_destination . $language_update->slug . '-' . $language_update->language . '.mo',
430
+            );
431
+
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 );
437
+                }
438
+            }
439
+        }
440
+
441
+        $files = array_filter( $files, array( $wp_filesystem, 'exists' ) );
442
+
443
+        // No files to delete.
444
+        if ( ! $files ) {
445
+            return true;
446
+        }
447
+
448
+        // Check all files are writable before attempting to clear the destination.
449
+        $unwritable_files = array();
450
+
451
+        // Check writability.
452
+        foreach ( $files as $file ) {
453
+            if ( ! $wp_filesystem->is_writable( $file ) ) {
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 ) ) {
457
+                    $unwritable_files[] = $file;
458
+                }
459
+            }
460
+        }
461
+
462
+        if ( ! empty( $unwritable_files ) ) {
463
+            return new WP_Error( 'files_not_writable', $this->strings['files_not_writable'], implode( ', ', $unwritable_files ) );
464
+        }
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'] );
469
+            }
470
+        }
471
+
472
+        return true;
473
+    }
474 474
 }
Please login to merge, or discard this patch.
Spacing   +100 added lines, -100 removed lines patch added patch discarded remove patch
@@ -46,15 +46,15 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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&#8230;' ), '<span class="code">%s</span>' );
118
-		$this->strings['unpack_package']      = __( 'Unpacking the update&#8230;' );
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&#8230;' );
122
-		$this->strings['remove_old_failed']   = __( 'Could not remove the old translation.' );
117
+		$this->strings['downloading_package'] = sprintf(__('Downloading translation from %s&#8230;'), '<span class="code">%s</span>');
118
+		$this->strings['unpack_package']      = __('Unpacking the update&#8230;');
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&#8230;');
122
+		$this->strings['remove_old_failed']   = __('Could not remove the old translation.');
123 123
 	}
124 124
 
125 125
 	/**
@@ -132,14 +132,14 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.
brighty/wp-admin/includes/class-theme-upgrader.php 2 patches
Indentation   +725 added lines, -725 removed lines patch added patch discarded remove patch
@@ -20,739 +20,739 @@
 block discarded – undo
20 20
  */
21 21
 class Theme_Upgrader extends WP_Upgrader {
22 22
 
23
-	/**
24
-	 * Result of the theme upgrade offer.
25
-	 *
26
-	 * @since 2.8.0
27
-	 * @var array|WP_Error $result
28
-	 * @see WP_Upgrader::$result
29
-	 */
30
-	public $result;
31
-
32
-	/**
33
-	 * Whether multiple themes are being upgraded/installed in bulk.
34
-	 *
35
-	 * @since 2.9.0
36
-	 * @var bool $bulk
37
-	 */
38
-	public $bulk = false;
39
-
40
-	/**
41
-	 * New theme info.
42
-	 *
43
-	 * @since 5.5.0
44
-	 * @var array $new_theme_data
45
-	 *
46
-	 * @see check_package()
47
-	 */
48
-	public $new_theme_data = array();
49
-
50
-	/**
51
-	 * Initialize the upgrade strings.
52
-	 *
53
-	 * @since 2.8.0
54
-	 */
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.' );
58
-		/* translators: %s: Package URL. */
59
-		$this->strings['downloading_package'] = sprintf( __( 'Downloading update from %s&#8230;' ), '<span class="code">%s</span>' );
60
-		$this->strings['unpack_package']      = __( 'Unpacking the update&#8230;' );
61
-		$this->strings['remove_old']          = __( 'Removing the old version of the theme&#8230;' );
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
-	}
66
-
67
-	/**
68
-	 * Initialize the installation strings.
69
-	 *
70
-	 * @since 2.8.0
71
-	 */
72
-	public function install_strings() {
73
-		$this->strings['no_package'] = __( 'Installation package not available.' );
74
-		/* translators: %s: Package URL. */
75
-		$this->strings['downloading_package'] = sprintf( __( 'Downloading installation package from %s&#8230;' ), '<span class="code">%s</span>' );
76
-		$this->strings['unpack_package']      = __( 'Unpacking the package&#8230;' );
77
-		$this->strings['installing_package']  = __( 'Installing the theme&#8230;' );
78
-		$this->strings['remove_old']          = __( 'Removing the old version of the theme&#8230;' );
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
-		/* 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&#8230;' );
86
-		/* translators: 1: Theme name, 2: Theme version. */
87
-		$this->strings['parent_theme_prepare_install'] = __( 'Preparing to install <strong>%1$s %2$s</strong>&#8230;' );
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.' );
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>.' );
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>' );
94
-		/* translators: %s: Theme error. */
95
-		$this->strings['current_theme_has_errors'] = __( 'The active theme has the following error: "%s".' );
96
-
97
-		if ( ! empty( $this->skin->overwrite ) ) {
98
-			if ( 'update-theme' === $this->skin->overwrite ) {
99
-				$this->strings['installing_package'] = __( 'Updating the theme&#8230;' );
100
-				$this->strings['process_failed']     = __( 'Theme update failed.' );
101
-				$this->strings['process_success']    = __( 'Theme updated successfully.' );
102
-			}
103
-
104
-			if ( 'downgrade-theme' === $this->skin->overwrite ) {
105
-				$this->strings['installing_package'] = __( 'Downgrading the theme&#8230;' );
106
-				$this->strings['process_failed']     = __( 'Theme downgrade failed.' );
107
-				$this->strings['process_success']    = __( 'Theme downgraded successfully.' );
108
-			}
109
-		}
110
-	}
111
-
112
-	/**
113
-	 * Check if a child theme is being installed and we need to install its parent.
114
-	 *
115
-	 * Hooked to the {@see 'upgrader_post_install'} filter by Theme_Upgrader::install().
116
-	 *
117
-	 * @since 3.4.0
118
-	 *
119
-	 * @param bool  $install_result
120
-	 * @param array $hook_extra
121
-	 * @param array $child_result
122
-	 * @return bool
123
-	 */
124
-	public function check_parent_theme_filter( $install_result, $hook_extra, $child_result ) {
125
-		// Check to see if we need to install a parent theme.
126
-		$theme_info = $this->theme_info();
127
-
128
-		if ( ! $theme_info->parent() ) {
129
-			return $install_result;
130
-		}
131
-
132
-		$this->skin->feedback( 'parent_theme_search' );
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' ) );
136
-			// We already have the theme, fall through.
137
-			return $install_result;
138
-		}
139
-
140
-		// We don't have the parent theme, let's install it.
141
-		$api = themes_api(
142
-			'theme_information',
143
-			array(
144
-				'slug'   => $theme_info->get( 'Template' ),
145
-				'fields' => array(
146
-					'sections' => false,
147
-					'tags'     => false,
148
-				),
149
-			)
150
-		); // Save on a bit of bandwidth.
151
-
152
-		if ( ! $api || is_wp_error( $api ) ) {
153
-			$this->skin->feedback( 'parent_theme_not_found', $theme_info->get( 'Template' ) );
154
-			// Don't show activate or preview actions after installation.
155
-			add_filter( 'install_theme_complete_actions', array( $this, 'hide_activate_preview_actions' ) );
156
-			return $install_result;
157
-		}
158
-
159
-		// Backup required data we're going to override:
160
-		$child_api             = $this->skin->api;
161
-		$child_success_message = $this->strings['process_success'];
162
-
163
-		// Override them.
164
-		$this->skin->api = $api;
165
-
166
-		$this->strings['process_success_specific'] = $this->strings['parent_theme_install_success'];
167
-
168
-		$this->skin->feedback( 'parent_theme_prepare_install', $api->name, $api->version );
169
-
170
-		add_filter( 'install_theme_complete_actions', '__return_false', 999 ); // Don't show any actions after installing the theme.
171
-
172
-		// Install the parent theme.
173
-		$parent_result = $this->run(
174
-			array(
175
-				'package'           => $api->download_link,
176
-				'destination'       => get_theme_root(),
177
-				'clear_destination' => false, // Do not overwrite files.
178
-				'clear_working'     => true,
179
-			)
180
-		);
181
-
182
-		if ( is_wp_error( $parent_result ) ) {
183
-			add_filter( 'install_theme_complete_actions', array( $this, 'hide_activate_preview_actions' ) );
184
-		}
185
-
186
-		// Start cleaning up after the parent's installation.
187
-		remove_filter( 'install_theme_complete_actions', '__return_false', 999 );
188
-
189
-		// Reset child's result and data.
190
-		$this->result                     = $child_result;
191
-		$this->skin->api                  = $child_api;
192
-		$this->strings['process_success'] = $child_success_message;
193
-
194
-		return $install_result;
195
-	}
196
-
197
-	/**
198
-	 * Don't display the activate and preview actions to the user.
199
-	 *
200
-	 * Hooked to the {@see 'install_theme_complete_actions'} filter by
201
-	 * Theme_Upgrader::check_parent_theme_filter() when installing
202
-	 * a child theme and installing the parent theme fails.
203
-	 *
204
-	 * @since 3.4.0
205
-	 *
206
-	 * @param array $actions Preview actions.
207
-	 * @return array
208
-	 */
209
-	public function hide_activate_preview_actions( $actions ) {
210
-		unset( $actions['activate'], $actions['preview'] );
211
-		return $actions;
212
-	}
213
-
214
-	/**
215
-	 * Install a theme package.
216
-	 *
217
-	 * @since 2.8.0
218
-	 * @since 3.7.0 The `$args` parameter was added, making clearing the update cache optional.
219
-	 *
220
-	 * @param string $package The full local path or URI of the package.
221
-	 * @param array  $args {
222
-	 *     Optional. Other arguments for installing a theme package. Default empty array.
223
-	 *
224
-	 *     @type bool $clear_update_cache Whether to clear the updates cache if successful.
225
-	 *                                    Default true.
226
-	 * }
227
-	 *
228
-	 * @return bool|WP_Error True if the installation was successful, false or a WP_Error object otherwise.
229
-	 */
230
-	public function install( $package, $args = array() ) {
231
-		$defaults    = array(
232
-			'clear_update_cache' => true,
233
-			'overwrite_package'  => false, // Do not overwrite files.
234
-		);
235
-		$parsed_args = wp_parse_args( $args, $defaults );
236
-
237
-		$this->init();
238
-		$this->install_strings();
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 );
242
-
243
-		if ( $parsed_args['clear_update_cache'] ) {
244
-			// Clear cache so wp_update_themes() knows about the new theme.
245
-			add_action( 'upgrader_process_complete', 'wp_clean_themes_cache', 9, 0 );
246
-		}
247
-
248
-		$this->run(
249
-			array(
250
-				'package'           => $package,
251
-				'destination'       => get_theme_root(),
252
-				'clear_destination' => $parsed_args['overwrite_package'],
253
-				'clear_working'     => true,
254
-				'hook_extra'        => array(
255
-					'type'   => 'theme',
256
-					'action' => 'install',
257
-				),
258
-			)
259
-		);
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' ) );
264
-
265
-		if ( ! $this->result || is_wp_error( $this->result ) ) {
266
-			return $this->result;
267
-		}
268
-
269
-		// Refresh the Theme Update information.
270
-		wp_clean_themes_cache( $parsed_args['clear_update_cache'] );
271
-
272
-		if ( $parsed_args['overwrite_package'] ) {
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' );
275
-		}
276
-
277
-		return true;
278
-	}
279
-
280
-	/**
281
-	 * Upgrade a theme.
282
-	 *
283
-	 * @since 2.8.0
284
-	 * @since 3.7.0 The `$args` parameter was added, making clearing the update cache optional.
285
-	 *
286
-	 * @param string $theme The theme slug.
287
-	 * @param array  $args {
288
-	 *     Optional. Other arguments for upgrading a theme. Default empty array.
289
-	 *
290
-	 *     @type bool $clear_update_cache Whether to clear the update cache if successful.
291
-	 *                                    Default true.
292
-	 * }
293
-	 * @return bool|WP_Error True if the upgrade was successful, false or a WP_Error object otherwise.
294
-	 */
295
-	public function upgrade( $theme, $args = array() ) {
296
-		$defaults    = array(
297
-			'clear_update_cache' => true,
298
-		);
299
-		$parsed_args = wp_parse_args( $args, $defaults );
300
-
301
-		$this->init();
302
-		$this->upgrade_strings();
303
-
304
-		// Is an update available?
305
-		$current = get_site_transient( 'update_themes' );
306
-		if ( ! isset( $current->response[ $theme ] ) ) {
307
-			$this->skin->before();
308
-			$this->skin->set_result( false );
309
-			$this->skin->error( 'up_to_date' );
310
-			$this->skin->after();
311
-			return false;
312
-		}
313
-
314
-		$r = $current->response[ $theme ];
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'] ) {
320
-			// Clear cache so wp_update_themes() knows about the new theme.
321
-			add_action( 'upgrader_process_complete', 'wp_clean_themes_cache', 9, 0 );
322
-		}
323
-
324
-		$this->run(
325
-			array(
326
-				'package'           => $r['package'],
327
-				'destination'       => get_theme_root( $theme ),
328
-				'clear_destination' => true,
329
-				'clear_working'     => true,
330
-				'hook_extra'        => array(
331
-					'theme'  => $theme,
332
-					'type'   => 'theme',
333
-					'action' => 'update',
334
-				),
335
-			)
336
-		);
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' ) );
342
-
343
-		if ( ! $this->result || is_wp_error( $this->result ) ) {
344
-			return $this->result;
345
-		}
346
-
347
-		wp_clean_themes_cache( $parsed_args['clear_update_cache'] );
348
-
349
-		// Ensure any future auto-update failures trigger a failure email by removing
350
-		// the last failure notification from the list when themes update successfully.
351
-		$past_failure_emails = get_option( 'auto_plugin_theme_update_emails', array() );
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 );
356
-		}
357
-
358
-		return true;
359
-	}
360
-
361
-	/**
362
-	 * Upgrade several themes at once.
363
-	 *
364
-	 * @since 3.0.0
365
-	 * @since 3.7.0 The `$args` parameter was added, making clearing the update cache optional.
366
-	 *
367
-	 * @param string[] $themes Array of the theme slugs.
368
-	 * @param array    $args {
369
-	 *     Optional. Other arguments for upgrading several themes at once. Default empty array.
370
-	 *
371
-	 *     @type bool $clear_update_cache Whether to clear the update cache if successful.
372
-	 *                                    Default true.
373
-	 * }
374
-	 * @return array[]|false An array of results, or false if unable to connect to the filesystem.
375
-	 */
376
-	public function bulk_upgrade( $themes, $args = array() ) {
377
-		$defaults    = array(
378
-			'clear_update_cache' => true,
379
-		);
380
-		$parsed_args = wp_parse_args( $args, $defaults );
381
-
382
-		$this->init();
383
-		$this->bulk = true;
384
-		$this->upgrade_strings();
385
-
386
-		$current = get_site_transient( 'update_themes' );
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 );
391
-
392
-		$this->skin->header();
393
-
394
-		// Connect to the filesystem first.
395
-		$res = $this->fs_connect( array( WP_CONTENT_DIR ) );
396
-		if ( ! $res ) {
397
-			$this->skin->footer();
398
-			return false;
399
-		}
400
-
401
-		$this->skin->bulk_header();
402
-
403
-		/*
23
+    /**
24
+     * Result of the theme upgrade offer.
25
+     *
26
+     * @since 2.8.0
27
+     * @var array|WP_Error $result
28
+     * @see WP_Upgrader::$result
29
+     */
30
+    public $result;
31
+
32
+    /**
33
+     * Whether multiple themes are being upgraded/installed in bulk.
34
+     *
35
+     * @since 2.9.0
36
+     * @var bool $bulk
37
+     */
38
+    public $bulk = false;
39
+
40
+    /**
41
+     * New theme info.
42
+     *
43
+     * @since 5.5.0
44
+     * @var array $new_theme_data
45
+     *
46
+     * @see check_package()
47
+     */
48
+    public $new_theme_data = array();
49
+
50
+    /**
51
+     * Initialize the upgrade strings.
52
+     *
53
+     * @since 2.8.0
54
+     */
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.' );
58
+        /* translators: %s: Package URL. */
59
+        $this->strings['downloading_package'] = sprintf( __( 'Downloading update from %s&#8230;' ), '<span class="code">%s</span>' );
60
+        $this->strings['unpack_package']      = __( 'Unpacking the update&#8230;' );
61
+        $this->strings['remove_old']          = __( 'Removing the old version of the theme&#8230;' );
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
+    }
66
+
67
+    /**
68
+     * Initialize the installation strings.
69
+     *
70
+     * @since 2.8.0
71
+     */
72
+    public function install_strings() {
73
+        $this->strings['no_package'] = __( 'Installation package not available.' );
74
+        /* translators: %s: Package URL. */
75
+        $this->strings['downloading_package'] = sprintf( __( 'Downloading installation package from %s&#8230;' ), '<span class="code">%s</span>' );
76
+        $this->strings['unpack_package']      = __( 'Unpacking the package&#8230;' );
77
+        $this->strings['installing_package']  = __( 'Installing the theme&#8230;' );
78
+        $this->strings['remove_old']          = __( 'Removing the old version of the theme&#8230;' );
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
+        /* 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&#8230;' );
86
+        /* translators: 1: Theme name, 2: Theme version. */
87
+        $this->strings['parent_theme_prepare_install'] = __( 'Preparing to install <strong>%1$s %2$s</strong>&#8230;' );
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.' );
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>.' );
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>' );
94
+        /* translators: %s: Theme error. */
95
+        $this->strings['current_theme_has_errors'] = __( 'The active theme has the following error: "%s".' );
96
+
97
+        if ( ! empty( $this->skin->overwrite ) ) {
98
+            if ( 'update-theme' === $this->skin->overwrite ) {
99
+                $this->strings['installing_package'] = __( 'Updating the theme&#8230;' );
100
+                $this->strings['process_failed']     = __( 'Theme update failed.' );
101
+                $this->strings['process_success']    = __( 'Theme updated successfully.' );
102
+            }
103
+
104
+            if ( 'downgrade-theme' === $this->skin->overwrite ) {
105
+                $this->strings['installing_package'] = __( 'Downgrading the theme&#8230;' );
106
+                $this->strings['process_failed']     = __( 'Theme downgrade failed.' );
107
+                $this->strings['process_success']    = __( 'Theme downgraded successfully.' );
108
+            }
109
+        }
110
+    }
111
+
112
+    /**
113
+     * Check if a child theme is being installed and we need to install its parent.
114
+     *
115
+     * Hooked to the {@see 'upgrader_post_install'} filter by Theme_Upgrader::install().
116
+     *
117
+     * @since 3.4.0
118
+     *
119
+     * @param bool  $install_result
120
+     * @param array $hook_extra
121
+     * @param array $child_result
122
+     * @return bool
123
+     */
124
+    public function check_parent_theme_filter( $install_result, $hook_extra, $child_result ) {
125
+        // Check to see if we need to install a parent theme.
126
+        $theme_info = $this->theme_info();
127
+
128
+        if ( ! $theme_info->parent() ) {
129
+            return $install_result;
130
+        }
131
+
132
+        $this->skin->feedback( 'parent_theme_search' );
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' ) );
136
+            // We already have the theme, fall through.
137
+            return $install_result;
138
+        }
139
+
140
+        // We don't have the parent theme, let's install it.
141
+        $api = themes_api(
142
+            'theme_information',
143
+            array(
144
+                'slug'   => $theme_info->get( 'Template' ),
145
+                'fields' => array(
146
+                    'sections' => false,
147
+                    'tags'     => false,
148
+                ),
149
+            )
150
+        ); // Save on a bit of bandwidth.
151
+
152
+        if ( ! $api || is_wp_error( $api ) ) {
153
+            $this->skin->feedback( 'parent_theme_not_found', $theme_info->get( 'Template' ) );
154
+            // Don't show activate or preview actions after installation.
155
+            add_filter( 'install_theme_complete_actions', array( $this, 'hide_activate_preview_actions' ) );
156
+            return $install_result;
157
+        }
158
+
159
+        // Backup required data we're going to override:
160
+        $child_api             = $this->skin->api;
161
+        $child_success_message = $this->strings['process_success'];
162
+
163
+        // Override them.
164
+        $this->skin->api = $api;
165
+
166
+        $this->strings['process_success_specific'] = $this->strings['parent_theme_install_success'];
167
+
168
+        $this->skin->feedback( 'parent_theme_prepare_install', $api->name, $api->version );
169
+
170
+        add_filter( 'install_theme_complete_actions', '__return_false', 999 ); // Don't show any actions after installing the theme.
171
+
172
+        // Install the parent theme.
173
+        $parent_result = $this->run(
174
+            array(
175
+                'package'           => $api->download_link,
176
+                'destination'       => get_theme_root(),
177
+                'clear_destination' => false, // Do not overwrite files.
178
+                'clear_working'     => true,
179
+            )
180
+        );
181
+
182
+        if ( is_wp_error( $parent_result ) ) {
183
+            add_filter( 'install_theme_complete_actions', array( $this, 'hide_activate_preview_actions' ) );
184
+        }
185
+
186
+        // Start cleaning up after the parent's installation.
187
+        remove_filter( 'install_theme_complete_actions', '__return_false', 999 );
188
+
189
+        // Reset child's result and data.
190
+        $this->result                     = $child_result;
191
+        $this->skin->api                  = $child_api;
192
+        $this->strings['process_success'] = $child_success_message;
193
+
194
+        return $install_result;
195
+    }
196
+
197
+    /**
198
+     * Don't display the activate and preview actions to the user.
199
+     *
200
+     * Hooked to the {@see 'install_theme_complete_actions'} filter by
201
+     * Theme_Upgrader::check_parent_theme_filter() when installing
202
+     * a child theme and installing the parent theme fails.
203
+     *
204
+     * @since 3.4.0
205
+     *
206
+     * @param array $actions Preview actions.
207
+     * @return array
208
+     */
209
+    public function hide_activate_preview_actions( $actions ) {
210
+        unset( $actions['activate'], $actions['preview'] );
211
+        return $actions;
212
+    }
213
+
214
+    /**
215
+     * Install a theme package.
216
+     *
217
+     * @since 2.8.0
218
+     * @since 3.7.0 The `$args` parameter was added, making clearing the update cache optional.
219
+     *
220
+     * @param string $package The full local path or URI of the package.
221
+     * @param array  $args {
222
+     *     Optional. Other arguments for installing a theme package. Default empty array.
223
+     *
224
+     *     @type bool $clear_update_cache Whether to clear the updates cache if successful.
225
+     *                                    Default true.
226
+     * }
227
+     *
228
+     * @return bool|WP_Error True if the installation was successful, false or a WP_Error object otherwise.
229
+     */
230
+    public function install( $package, $args = array() ) {
231
+        $defaults    = array(
232
+            'clear_update_cache' => true,
233
+            'overwrite_package'  => false, // Do not overwrite files.
234
+        );
235
+        $parsed_args = wp_parse_args( $args, $defaults );
236
+
237
+        $this->init();
238
+        $this->install_strings();
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 );
242
+
243
+        if ( $parsed_args['clear_update_cache'] ) {
244
+            // Clear cache so wp_update_themes() knows about the new theme.
245
+            add_action( 'upgrader_process_complete', 'wp_clean_themes_cache', 9, 0 );
246
+        }
247
+
248
+        $this->run(
249
+            array(
250
+                'package'           => $package,
251
+                'destination'       => get_theme_root(),
252
+                'clear_destination' => $parsed_args['overwrite_package'],
253
+                'clear_working'     => true,
254
+                'hook_extra'        => array(
255
+                    'type'   => 'theme',
256
+                    'action' => 'install',
257
+                ),
258
+            )
259
+        );
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' ) );
264
+
265
+        if ( ! $this->result || is_wp_error( $this->result ) ) {
266
+            return $this->result;
267
+        }
268
+
269
+        // Refresh the Theme Update information.
270
+        wp_clean_themes_cache( $parsed_args['clear_update_cache'] );
271
+
272
+        if ( $parsed_args['overwrite_package'] ) {
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' );
275
+        }
276
+
277
+        return true;
278
+    }
279
+
280
+    /**
281
+     * Upgrade a theme.
282
+     *
283
+     * @since 2.8.0
284
+     * @since 3.7.0 The `$args` parameter was added, making clearing the update cache optional.
285
+     *
286
+     * @param string $theme The theme slug.
287
+     * @param array  $args {
288
+     *     Optional. Other arguments for upgrading a theme. Default empty array.
289
+     *
290
+     *     @type bool $clear_update_cache Whether to clear the update cache if successful.
291
+     *                                    Default true.
292
+     * }
293
+     * @return bool|WP_Error True if the upgrade was successful, false or a WP_Error object otherwise.
294
+     */
295
+    public function upgrade( $theme, $args = array() ) {
296
+        $defaults    = array(
297
+            'clear_update_cache' => true,
298
+        );
299
+        $parsed_args = wp_parse_args( $args, $defaults );
300
+
301
+        $this->init();
302
+        $this->upgrade_strings();
303
+
304
+        // Is an update available?
305
+        $current = get_site_transient( 'update_themes' );
306
+        if ( ! isset( $current->response[ $theme ] ) ) {
307
+            $this->skin->before();
308
+            $this->skin->set_result( false );
309
+            $this->skin->error( 'up_to_date' );
310
+            $this->skin->after();
311
+            return false;
312
+        }
313
+
314
+        $r = $current->response[ $theme ];
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'] ) {
320
+            // Clear cache so wp_update_themes() knows about the new theme.
321
+            add_action( 'upgrader_process_complete', 'wp_clean_themes_cache', 9, 0 );
322
+        }
323
+
324
+        $this->run(
325
+            array(
326
+                'package'           => $r['package'],
327
+                'destination'       => get_theme_root( $theme ),
328
+                'clear_destination' => true,
329
+                'clear_working'     => true,
330
+                'hook_extra'        => array(
331
+                    'theme'  => $theme,
332
+                    'type'   => 'theme',
333
+                    'action' => 'update',
334
+                ),
335
+            )
336
+        );
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' ) );
342
+
343
+        if ( ! $this->result || is_wp_error( $this->result ) ) {
344
+            return $this->result;
345
+        }
346
+
347
+        wp_clean_themes_cache( $parsed_args['clear_update_cache'] );
348
+
349
+        // Ensure any future auto-update failures trigger a failure email by removing
350
+        // the last failure notification from the list when themes update successfully.
351
+        $past_failure_emails = get_option( 'auto_plugin_theme_update_emails', array() );
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 );
356
+        }
357
+
358
+        return true;
359
+    }
360
+
361
+    /**
362
+     * Upgrade several themes at once.
363
+     *
364
+     * @since 3.0.0
365
+     * @since 3.7.0 The `$args` parameter was added, making clearing the update cache optional.
366
+     *
367
+     * @param string[] $themes Array of the theme slugs.
368
+     * @param array    $args {
369
+     *     Optional. Other arguments for upgrading several themes at once. Default empty array.
370
+     *
371
+     *     @type bool $clear_update_cache Whether to clear the update cache if successful.
372
+     *                                    Default true.
373
+     * }
374
+     * @return array[]|false An array of results, or false if unable to connect to the filesystem.
375
+     */
376
+    public function bulk_upgrade( $themes, $args = array() ) {
377
+        $defaults    = array(
378
+            'clear_update_cache' => true,
379
+        );
380
+        $parsed_args = wp_parse_args( $args, $defaults );
381
+
382
+        $this->init();
383
+        $this->bulk = true;
384
+        $this->upgrade_strings();
385
+
386
+        $current = get_site_transient( 'update_themes' );
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 );
391
+
392
+        $this->skin->header();
393
+
394
+        // Connect to the filesystem first.
395
+        $res = $this->fs_connect( array( WP_CONTENT_DIR ) );
396
+        if ( ! $res ) {
397
+            $this->skin->footer();
398
+            return false;
399
+        }
400
+
401
+        $this->skin->bulk_header();
402
+
403
+        /*
404 404
 		 * Only start maintenance mode if:
405 405
 		 * - running Multisite and there are one or more themes specified, OR
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 ) {
411
-			$maintenance = $maintenance || get_stylesheet() === $theme || get_template() === $theme;
412
-		}
413
-		if ( $maintenance ) {
414
-			$this->maintenance_mode( true );
415
-		}
416
-
417
-		$results = array();
418
-
419
-		$this->update_count   = count( $themes );
420
-		$this->update_current = 0;
421
-		foreach ( $themes as $theme ) {
422
-			$this->update_current++;
423
-
424
-			$this->skin->theme_info = $this->theme_info( $theme );
425
-
426
-			if ( ! isset( $current->response[ $theme ] ) ) {
427
-				$this->skin->set_result( true );
428
-				$this->skin->before();
429
-				$this->skin->feedback( 'up_to_date' );
430
-				$this->skin->after();
431
-				$results[ $theme ] = true;
432
-				continue;
433
-			}
434
-
435
-			// Get the URL to the zip file.
436
-			$r = $current->response[ $theme ];
437
-
438
-			$result = $this->run(
439
-				array(
440
-					'package'           => $r['package'],
441
-					'destination'       => get_theme_root( $theme ),
442
-					'clear_destination' => true,
443
-					'clear_working'     => true,
444
-					'is_multi'          => true,
445
-					'hook_extra'        => array(
446
-						'theme' => $theme,
447
-					),
448
-				)
449
-			);
450
-
451
-			$results[ $theme ] = $result;
452
-
453
-			// Prevent credentials auth screen from displaying multiple times.
454
-			if ( false === $result ) {
455
-				break;
456
-			}
457
-		} // End foreach $themes.
458
-
459
-		$this->maintenance_mode( false );
460
-
461
-		// Refresh the Theme Update information.
462
-		wp_clean_themes_cache( $parsed_args['clear_update_cache'] );
463
-
464
-		/** This action is documented in wp-admin/includes/class-wp-upgrader.php */
465
-		do_action(
466
-			'upgrader_process_complete',
467
-			$this,
468
-			array(
469
-				'action' => 'update',
470
-				'type'   => 'theme',
471
-				'bulk'   => true,
472
-				'themes' => $themes,
473
-			)
474
-		);
475
-
476
-		$this->skin->bulk_footer();
477
-
478
-		$this->skin->footer();
479
-
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' ) );
484
-
485
-		// Ensure any future auto-update failures trigger a failure email by removing
486
-		// the last failure notification from the list when themes update successfully.
487
-		$past_failure_emails = get_option( 'auto_plugin_theme_update_emails', array() );
488
-
489
-		foreach ( $results as $theme => $result ) {
490
-			// Maintain last failure notification when themes failed to update manually.
491
-			if ( ! $result || is_wp_error( $result ) || ! isset( $past_failure_emails[ $theme ] ) ) {
492
-				continue;
493
-			}
494
-
495
-			unset( $past_failure_emails[ $theme ] );
496
-		}
497
-
498
-		update_option( 'auto_plugin_theme_update_emails', $past_failure_emails );
499
-
500
-		return $results;
501
-	}
502
-
503
-	/**
504
-	 * Checks that the package source contains a valid theme.
505
-	 *
506
-	 * Hooked to the {@see 'upgrader_source_selection'} filter by Theme_Upgrader::install().
507
-	 *
508
-	 * @since 3.3.0
509
-	 *
510
-	 * @global WP_Filesystem_Base $wp_filesystem WordPress filesystem subclass.
511
-	 * @global string             $wp_version    The WordPress version string.
512
-	 *
513
-	 * @param string $source The path to the downloaded package source.
514
-	 * @return string|WP_Error The source as passed, or a WP_Error object on failure.
515
-	 */
516
-	public function check_package( $source ) {
517
-		global $wp_filesystem, $wp_version;
518
-
519
-		$this->new_theme_data = array();
520
-
521
-		if ( is_wp_error( $source ) ) {
522
-			return $source;
523
-		}
524
-
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.
528
-			return $source;
529
-		}
530
-
531
-		// A proper archive should have a style.css file in the single subdirectory.
532
-		if ( ! file_exists( $working_directory . 'style.css' ) ) {
533
-			return new WP_Error(
534
-				'incompatible_archive_theme_no_style',
535
-				$this->strings['incompatible_archive'],
536
-				sprintf(
537
-					/* translators: %s: style.css */
538
-					__( 'The theme is missing the %s stylesheet.' ),
539
-					'<code>style.css</code>'
540
-				)
541
-			);
542
-		}
543
-
544
-		// All these headers are needed on Theme_Installer_Skin::do_overwrite().
545
-		$info = get_file_data(
546
-			$working_directory . 'style.css',
547
-			array(
548
-				'Name'        => 'Theme Name',
549
-				'Version'     => 'Version',
550
-				'Author'      => 'Author',
551
-				'Template'    => 'Template',
552
-				'RequiresWP'  => 'Requires at least',
553
-				'RequiresPHP' => 'Requires PHP',
554
-			)
555
-		);
556
-
557
-		if ( empty( $info['Name'] ) ) {
558
-			return new WP_Error(
559
-				'incompatible_archive_theme_no_name',
560
-				$this->strings['incompatible_archive'],
561
-				sprintf(
562
-					/* translators: %s: style.css */
563
-					__( 'The %s stylesheet does not contain a valid theme header.' ),
564
-					'<code>style.css</code>'
565
-				)
566
-			);
567
-		}
568
-
569
-		/*
409
+        $maintenance = ( is_multisite() && ! empty( $themes ) );
410
+        foreach ( $themes as $theme ) {
411
+            $maintenance = $maintenance || get_stylesheet() === $theme || get_template() === $theme;
412
+        }
413
+        if ( $maintenance ) {
414
+            $this->maintenance_mode( true );
415
+        }
416
+
417
+        $results = array();
418
+
419
+        $this->update_count   = count( $themes );
420
+        $this->update_current = 0;
421
+        foreach ( $themes as $theme ) {
422
+            $this->update_current++;
423
+
424
+            $this->skin->theme_info = $this->theme_info( $theme );
425
+
426
+            if ( ! isset( $current->response[ $theme ] ) ) {
427
+                $this->skin->set_result( true );
428
+                $this->skin->before();
429
+                $this->skin->feedback( 'up_to_date' );
430
+                $this->skin->after();
431
+                $results[ $theme ] = true;
432
+                continue;
433
+            }
434
+
435
+            // Get the URL to the zip file.
436
+            $r = $current->response[ $theme ];
437
+
438
+            $result = $this->run(
439
+                array(
440
+                    'package'           => $r['package'],
441
+                    'destination'       => get_theme_root( $theme ),
442
+                    'clear_destination' => true,
443
+                    'clear_working'     => true,
444
+                    'is_multi'          => true,
445
+                    'hook_extra'        => array(
446
+                        'theme' => $theme,
447
+                    ),
448
+                )
449
+            );
450
+
451
+            $results[ $theme ] = $result;
452
+
453
+            // Prevent credentials auth screen from displaying multiple times.
454
+            if ( false === $result ) {
455
+                break;
456
+            }
457
+        } // End foreach $themes.
458
+
459
+        $this->maintenance_mode( false );
460
+
461
+        // Refresh the Theme Update information.
462
+        wp_clean_themes_cache( $parsed_args['clear_update_cache'] );
463
+
464
+        /** This action is documented in wp-admin/includes/class-wp-upgrader.php */
465
+        do_action(
466
+            'upgrader_process_complete',
467
+            $this,
468
+            array(
469
+                'action' => 'update',
470
+                'type'   => 'theme',
471
+                'bulk'   => true,
472
+                'themes' => $themes,
473
+            )
474
+        );
475
+
476
+        $this->skin->bulk_footer();
477
+
478
+        $this->skin->footer();
479
+
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' ) );
484
+
485
+        // Ensure any future auto-update failures trigger a failure email by removing
486
+        // the last failure notification from the list when themes update successfully.
487
+        $past_failure_emails = get_option( 'auto_plugin_theme_update_emails', array() );
488
+
489
+        foreach ( $results as $theme => $result ) {
490
+            // Maintain last failure notification when themes failed to update manually.
491
+            if ( ! $result || is_wp_error( $result ) || ! isset( $past_failure_emails[ $theme ] ) ) {
492
+                continue;
493
+            }
494
+
495
+            unset( $past_failure_emails[ $theme ] );
496
+        }
497
+
498
+        update_option( 'auto_plugin_theme_update_emails', $past_failure_emails );
499
+
500
+        return $results;
501
+    }
502
+
503
+    /**
504
+     * Checks that the package source contains a valid theme.
505
+     *
506
+     * Hooked to the {@see 'upgrader_source_selection'} filter by Theme_Upgrader::install().
507
+     *
508
+     * @since 3.3.0
509
+     *
510
+     * @global WP_Filesystem_Base $wp_filesystem WordPress filesystem subclass.
511
+     * @global string             $wp_version    The WordPress version string.
512
+     *
513
+     * @param string $source The path to the downloaded package source.
514
+     * @return string|WP_Error The source as passed, or a WP_Error object on failure.
515
+     */
516
+    public function check_package( $source ) {
517
+        global $wp_filesystem, $wp_version;
518
+
519
+        $this->new_theme_data = array();
520
+
521
+        if ( is_wp_error( $source ) ) {
522
+            return $source;
523
+        }
524
+
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.
528
+            return $source;
529
+        }
530
+
531
+        // A proper archive should have a style.css file in the single subdirectory.
532
+        if ( ! file_exists( $working_directory . 'style.css' ) ) {
533
+            return new WP_Error(
534
+                'incompatible_archive_theme_no_style',
535
+                $this->strings['incompatible_archive'],
536
+                sprintf(
537
+                    /* translators: %s: style.css */
538
+                    __( 'The theme is missing the %s stylesheet.' ),
539
+                    '<code>style.css</code>'
540
+                )
541
+            );
542
+        }
543
+
544
+        // All these headers are needed on Theme_Installer_Skin::do_overwrite().
545
+        $info = get_file_data(
546
+            $working_directory . 'style.css',
547
+            array(
548
+                'Name'        => 'Theme Name',
549
+                'Version'     => 'Version',
550
+                'Author'      => 'Author',
551
+                'Template'    => 'Template',
552
+                'RequiresWP'  => 'Requires at least',
553
+                'RequiresPHP' => 'Requires PHP',
554
+            )
555
+        );
556
+
557
+        if ( empty( $info['Name'] ) ) {
558
+            return new WP_Error(
559
+                'incompatible_archive_theme_no_name',
560
+                $this->strings['incompatible_archive'],
561
+                sprintf(
562
+                    /* translators: %s: style.css */
563
+                    __( 'The %s stylesheet does not contain a valid theme header.' ),
564
+                    '<code>style.css</code>'
565
+                )
566
+            );
567
+        }
568
+
569
+        /*
570 570
 		 * Parent themes must contain an index file:
571 571
 		 * - classic themes require /index.php
572 572
 		 * - block themes require /templates/index.html or block-templates/index.html (deprecated 5.9.0).
573 573
 		 */
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' )
579
-		) {
580
-			return new WP_Error(
581
-				'incompatible_archive_theme_no_index',
582
-				$this->strings['incompatible_archive'],
583
-				sprintf(
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.' ),
586
-					'<code>templates/index.html</code>',
587
-					'<code>index.php</code>',
588
-					__( 'https://developer.wordpress.org/themes/advanced-topics/child-themes/' ),
589
-					'<code>Template</code>',
590
-					'<code>style.css</code>'
591
-				)
592
-			);
593
-		}
594
-
595
-		$requires_php = isset( $info['RequiresPHP'] ) ? $info['RequiresPHP'] : null;
596
-		$requires_wp  = isset( $info['RequiresWP'] ) ? $info['RequiresWP'] : null;
597
-
598
-		if ( ! is_php_version_compatible( $requires_php ) ) {
599
-			$error = sprintf(
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.' ),
602
-				phpversion(),
603
-				$requires_php
604
-			);
605
-
606
-			return new WP_Error( 'incompatible_php_required_version', $this->strings['incompatible_archive'], $error );
607
-		}
608
-		if ( ! is_wp_version_compatible( $requires_wp ) ) {
609
-			$error = sprintf(
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.' ),
612
-				$wp_version,
613
-				$requires_wp
614
-			);
615
-
616
-			return new WP_Error( 'incompatible_wp_required_version', $this->strings['incompatible_archive'], $error );
617
-		}
618
-
619
-		$this->new_theme_data = $info;
620
-
621
-		return $source;
622
-	}
623
-
624
-	/**
625
-	 * Turn on maintenance mode before attempting to upgrade the active theme.
626
-	 *
627
-	 * Hooked to the {@see 'upgrader_pre_install'} filter by Theme_Upgrader::upgrade() and
628
-	 * Theme_Upgrader::bulk_upgrade().
629
-	 *
630
-	 * @since 2.8.0
631
-	 *
632
-	 * @param bool|WP_Error $response The installation response before the installation has started.
633
-	 * @param array         $theme    Theme arguments.
634
-	 * @return bool|WP_Error The original `$response` parameter or WP_Error.
635
-	 */
636
-	public function current_before( $response, $theme ) {
637
-		if ( is_wp_error( $response ) ) {
638
-			return $response;
639
-		}
640
-
641
-		$theme = isset( $theme['theme'] ) ? $theme['theme'] : '';
642
-
643
-		// Only run if active theme.
644
-		if ( get_stylesheet() !== $theme ) {
645
-			return $response;
646
-		}
647
-
648
-		// Change to maintenance mode. Bulk edit handles this separately.
649
-		if ( ! $this->bulk ) {
650
-			$this->maintenance_mode( true );
651
-		}
652
-
653
-		return $response;
654
-	}
655
-
656
-	/**
657
-	 * Turn off maintenance mode after upgrading the active theme.
658
-	 *
659
-	 * Hooked to the {@see 'upgrader_post_install'} filter by Theme_Upgrader::upgrade()
660
-	 * and Theme_Upgrader::bulk_upgrade().
661
-	 *
662
-	 * @since 2.8.0
663
-	 *
664
-	 * @param bool|WP_Error $response The installation response after the installation has finished.
665
-	 * @param array         $theme    Theme arguments.
666
-	 * @return bool|WP_Error The original `$response` parameter or WP_Error.
667
-	 */
668
-	public function current_after( $response, $theme ) {
669
-		if ( is_wp_error( $response ) ) {
670
-			return $response;
671
-		}
672
-
673
-		$theme = isset( $theme['theme'] ) ? $theme['theme'] : '';
674
-
675
-		// Only run if active theme.
676
-		if ( get_stylesheet() !== $theme ) {
677
-			return $response;
678
-		}
679
-
680
-		// Ensure stylesheet name hasn't changed after the upgrade:
681
-		if ( get_stylesheet() === $theme && $theme !== $this->result['destination_name'] ) {
682
-			wp_clean_themes_cache();
683
-			$stylesheet = $this->result['destination_name'];
684
-			switch_theme( $stylesheet );
685
-		}
686
-
687
-		// Time to remove maintenance mode. Bulk edit handles this separately.
688
-		if ( ! $this->bulk ) {
689
-			$this->maintenance_mode( false );
690
-		}
691
-		return $response;
692
-	}
693
-
694
-	/**
695
-	 * Delete the old theme during an upgrade.
696
-	 *
697
-	 * Hooked to the {@see 'upgrader_clear_destination'} filter by Theme_Upgrader::upgrade()
698
-	 * and Theme_Upgrader::bulk_upgrade().
699
-	 *
700
-	 * @since 2.8.0
701
-	 *
702
-	 * @global WP_Filesystem_Base $wp_filesystem Subclass
703
-	 *
704
-	 * @param bool   $removed
705
-	 * @param string $local_destination
706
-	 * @param string $remote_destination
707
-	 * @param array  $theme
708
-	 * @return bool
709
-	 */
710
-	public function delete_old_theme( $removed, $local_destination, $remote_destination, $theme ) {
711
-		global $wp_filesystem;
712
-
713
-		if ( is_wp_error( $removed ) ) {
714
-			return $removed; // Pass errors through.
715
-		}
716
-
717
-		if ( ! isset( $theme['theme'] ) ) {
718
-			return $removed;
719
-		}
720
-
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 ) ) {
725
-				return false;
726
-			}
727
-		}
728
-
729
-		return true;
730
-	}
731
-
732
-	/**
733
-	 * Get the WP_Theme object for a theme.
734
-	 *
735
-	 * @since 2.8.0
736
-	 * @since 3.0.0 The `$theme` argument was added.
737
-	 *
738
-	 * @param string $theme The directory name of the theme. This is optional, and if not supplied,
739
-	 *                      the directory name from the last result will be used.
740
-	 * @return WP_Theme|false The theme's info object, or false `$theme` is not supplied
741
-	 *                        and the last result isn't set.
742
-	 */
743
-	public function theme_info( $theme = null ) {
744
-		if ( empty( $theme ) ) {
745
-			if ( ! empty( $this->result['destination_name'] ) ) {
746
-				$theme = $this->result['destination_name'];
747
-			} else {
748
-				return false;
749
-			}
750
-		}
751
-
752
-		$theme = wp_get_theme( $theme );
753
-		$theme->cache_delete();
754
-
755
-		return $theme;
756
-	}
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' )
579
+        ) {
580
+            return new WP_Error(
581
+                'incompatible_archive_theme_no_index',
582
+                $this->strings['incompatible_archive'],
583
+                sprintf(
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.' ),
586
+                    '<code>templates/index.html</code>',
587
+                    '<code>index.php</code>',
588
+                    __( 'https://developer.wordpress.org/themes/advanced-topics/child-themes/' ),
589
+                    '<code>Template</code>',
590
+                    '<code>style.css</code>'
591
+                )
592
+            );
593
+        }
594
+
595
+        $requires_php = isset( $info['RequiresPHP'] ) ? $info['RequiresPHP'] : null;
596
+        $requires_wp  = isset( $info['RequiresWP'] ) ? $info['RequiresWP'] : null;
597
+
598
+        if ( ! is_php_version_compatible( $requires_php ) ) {
599
+            $error = sprintf(
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.' ),
602
+                phpversion(),
603
+                $requires_php
604
+            );
605
+
606
+            return new WP_Error( 'incompatible_php_required_version', $this->strings['incompatible_archive'], $error );
607
+        }
608
+        if ( ! is_wp_version_compatible( $requires_wp ) ) {
609
+            $error = sprintf(
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.' ),
612
+                $wp_version,
613
+                $requires_wp
614
+            );
615
+
616
+            return new WP_Error( 'incompatible_wp_required_version', $this->strings['incompatible_archive'], $error );
617
+        }
618
+
619
+        $this->new_theme_data = $info;
620
+
621
+        return $source;
622
+    }
623
+
624
+    /**
625
+     * Turn on maintenance mode before attempting to upgrade the active theme.
626
+     *
627
+     * Hooked to the {@see 'upgrader_pre_install'} filter by Theme_Upgrader::upgrade() and
628
+     * Theme_Upgrader::bulk_upgrade().
629
+     *
630
+     * @since 2.8.0
631
+     *
632
+     * @param bool|WP_Error $response The installation response before the installation has started.
633
+     * @param array         $theme    Theme arguments.
634
+     * @return bool|WP_Error The original `$response` parameter or WP_Error.
635
+     */
636
+    public function current_before( $response, $theme ) {
637
+        if ( is_wp_error( $response ) ) {
638
+            return $response;
639
+        }
640
+
641
+        $theme = isset( $theme['theme'] ) ? $theme['theme'] : '';
642
+
643
+        // Only run if active theme.
644
+        if ( get_stylesheet() !== $theme ) {
645
+            return $response;
646
+        }
647
+
648
+        // Change to maintenance mode. Bulk edit handles this separately.
649
+        if ( ! $this->bulk ) {
650
+            $this->maintenance_mode( true );
651
+        }
652
+
653
+        return $response;
654
+    }
655
+
656
+    /**
657
+     * Turn off maintenance mode after upgrading the active theme.
658
+     *
659
+     * Hooked to the {@see 'upgrader_post_install'} filter by Theme_Upgrader::upgrade()
660
+     * and Theme_Upgrader::bulk_upgrade().
661
+     *
662
+     * @since 2.8.0
663
+     *
664
+     * @param bool|WP_Error $response The installation response after the installation has finished.
665
+     * @param array         $theme    Theme arguments.
666
+     * @return bool|WP_Error The original `$response` parameter or WP_Error.
667
+     */
668
+    public function current_after( $response, $theme ) {
669
+        if ( is_wp_error( $response ) ) {
670
+            return $response;
671
+        }
672
+
673
+        $theme = isset( $theme['theme'] ) ? $theme['theme'] : '';
674
+
675
+        // Only run if active theme.
676
+        if ( get_stylesheet() !== $theme ) {
677
+            return $response;
678
+        }
679
+
680
+        // Ensure stylesheet name hasn't changed after the upgrade:
681
+        if ( get_stylesheet() === $theme && $theme !== $this->result['destination_name'] ) {
682
+            wp_clean_themes_cache();
683
+            $stylesheet = $this->result['destination_name'];
684
+            switch_theme( $stylesheet );
685
+        }
686
+
687
+        // Time to remove maintenance mode. Bulk edit handles this separately.
688
+        if ( ! $this->bulk ) {
689
+            $this->maintenance_mode( false );
690
+        }
691
+        return $response;
692
+    }
693
+
694
+    /**
695
+     * Delete the old theme during an upgrade.
696
+     *
697
+     * Hooked to the {@see 'upgrader_clear_destination'} filter by Theme_Upgrader::upgrade()
698
+     * and Theme_Upgrader::bulk_upgrade().
699
+     *
700
+     * @since 2.8.0
701
+     *
702
+     * @global WP_Filesystem_Base $wp_filesystem Subclass
703
+     *
704
+     * @param bool   $removed
705
+     * @param string $local_destination
706
+     * @param string $remote_destination
707
+     * @param array  $theme
708
+     * @return bool
709
+     */
710
+    public function delete_old_theme( $removed, $local_destination, $remote_destination, $theme ) {
711
+        global $wp_filesystem;
712
+
713
+        if ( is_wp_error( $removed ) ) {
714
+            return $removed; // Pass errors through.
715
+        }
716
+
717
+        if ( ! isset( $theme['theme'] ) ) {
718
+            return $removed;
719
+        }
720
+
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 ) ) {
725
+                return false;
726
+            }
727
+        }
728
+
729
+        return true;
730
+    }
731
+
732
+    /**
733
+     * Get the WP_Theme object for a theme.
734
+     *
735
+     * @since 2.8.0
736
+     * @since 3.0.0 The `$theme` argument was added.
737
+     *
738
+     * @param string $theme The directory name of the theme. This is optional, and if not supplied,
739
+     *                      the directory name from the last result will be used.
740
+     * @return WP_Theme|false The theme's info object, or false `$theme` is not supplied
741
+     *                        and the last result isn't set.
742
+     */
743
+    public function theme_info( $theme = null ) {
744
+        if ( empty( $theme ) ) {
745
+            if ( ! empty( $this->result['destination_name'] ) ) {
746
+                $theme = $this->result['destination_name'];
747
+            } else {
748
+                return false;
749
+            }
750
+        }
751
+
752
+        $theme = wp_get_theme( $theme );
753
+        $theme->cache_delete();
754
+
755
+        return $theme;
756
+    }
757 757
 
758 758
 }
Please login to merge, or discard this patch.
Spacing   +165 added lines, -165 removed lines patch added patch discarded remove patch
@@ -53,15 +53,15 @@  discard block
 block discarded – undo
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&#8230;' ), '<span class="code">%s</span>' );
60
-		$this->strings['unpack_package']      = __( 'Unpacking the update&#8230;' );
61
-		$this->strings['remove_old']          = __( 'Removing the old version of the theme&#8230;' );
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&#8230;'), '<span class="code">%s</span>');
60
+		$this->strings['unpack_package']      = __('Unpacking the update&#8230;');
61
+		$this->strings['remove_old']          = __('Removing the old version of the theme&#8230;');
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
 block discarded – undo
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&#8230;' ), '<span class="code">%s</span>' );
76
-		$this->strings['unpack_package']      = __( 'Unpacking the package&#8230;' );
77
-		$this->strings['installing_package']  = __( 'Installing the theme&#8230;' );
78
-		$this->strings['remove_old']          = __( 'Removing the old version of the theme&#8230;' );
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&#8230;'), '<span class="code">%s</span>');
76
+		$this->strings['unpack_package']      = __('Unpacking the package&#8230;');
77
+		$this->strings['installing_package']  = __('Installing the theme&#8230;');
78
+		$this->strings['remove_old']          = __('Removing the old version of the theme&#8230;');
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&#8230;' );
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&#8230;');
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>&#8230;' );
87
+		$this->strings['parent_theme_prepare_install'] = __('Preparing to install <strong>%1$s %2$s</strong>&#8230;');
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&#8230;' );
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&#8230;');
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&#8230;' );
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&#8230;');
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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;
Please login to merge, or discard this patch.
brighty/wp-admin/includes/class-wp-application-passwords-list-table.php 2 patches
Indentation   +212 added lines, -212 removed lines patch added patch discarded remove patch
@@ -17,140 +17,140 @@  discard block
 block discarded – undo
17 17
  */
18 18
 class WP_Application_Passwords_List_Table extends WP_List_Table {
19 19
 
20
-	/**
21
-	 * Gets the list of columns.
22
-	 *
23
-	 * @since 5.6.0
24
-	 *
25
-	 * @return array
26
-	 */
27
-	public function get_columns() {
28
-		return array(
29
-			'name'      => __( 'Name' ),
30
-			'created'   => __( 'Created' ),
31
-			'last_used' => __( 'Last Used' ),
32
-			'last_ip'   => __( 'Last IP' ),
33
-			'revoke'    => __( 'Revoke' ),
34
-		);
35
-	}
20
+    /**
21
+     * Gets the list of columns.
22
+     *
23
+     * @since 5.6.0
24
+     *
25
+     * @return array
26
+     */
27
+    public function get_columns() {
28
+        return array(
29
+            'name'      => __( 'Name' ),
30
+            'created'   => __( 'Created' ),
31
+            'last_used' => __( 'Last Used' ),
32
+            'last_ip'   => __( 'Last IP' ),
33
+            'revoke'    => __( 'Revoke' ),
34
+        );
35
+    }
36 36
 
37
-	/**
38
-	 * Prepares the list of items for displaying.
39
-	 *
40
-	 * @since 5.6.0
41
-	 *
42
-	 * @global int $user_id User ID.
43
-	 */
44
-	public function prepare_items() {
45
-		global $user_id;
46
-		$this->items = array_reverse( WP_Application_Passwords::get_user_application_passwords( $user_id ) );
47
-	}
37
+    /**
38
+     * Prepares the list of items for displaying.
39
+     *
40
+     * @since 5.6.0
41
+     *
42
+     * @global int $user_id User ID.
43
+     */
44
+    public function prepare_items() {
45
+        global $user_id;
46
+        $this->items = array_reverse( WP_Application_Passwords::get_user_application_passwords( $user_id ) );
47
+    }
48 48
 
49
-	/**
50
-	 * Handles the name column output.
51
-	 *
52
-	 * @since 5.6.0
53
-	 *
54
-	 * @param array $item The current application password item.
55
-	 */
56
-	public function column_name( $item ) {
57
-		echo esc_html( $item['name'] );
58
-	}
49
+    /**
50
+     * Handles the name column output.
51
+     *
52
+     * @since 5.6.0
53
+     *
54
+     * @param array $item The current application password item.
55
+     */
56
+    public function column_name( $item ) {
57
+        echo esc_html( $item['name'] );
58
+    }
59 59
 
60
-	/**
61
-	 * Handles the created column output.
62
-	 *
63
-	 * @since 5.6.0
64
-	 *
65
-	 * @param array $item The current application password item.
66
-	 */
67
-	public function column_created( $item ) {
68
-		if ( empty( $item['created'] ) ) {
69
-			echo '&mdash;';
70
-		} else {
71
-			echo date_i18n( __( 'F j, Y' ), $item['created'] );
72
-		}
73
-	}
60
+    /**
61
+     * Handles the created column output.
62
+     *
63
+     * @since 5.6.0
64
+     *
65
+     * @param array $item The current application password item.
66
+     */
67
+    public function column_created( $item ) {
68
+        if ( empty( $item['created'] ) ) {
69
+            echo '&mdash;';
70
+        } else {
71
+            echo date_i18n( __( 'F j, Y' ), $item['created'] );
72
+        }
73
+    }
74 74
 
75
-	/**
76
-	 * Handles the last used column output.
77
-	 *
78
-	 * @since 5.6.0
79
-	 *
80
-	 * @param array $item The current application password item.
81
-	 */
82
-	public function column_last_used( $item ) {
83
-		if ( empty( $item['last_used'] ) ) {
84
-			echo '&mdash;';
85
-		} else {
86
-			echo date_i18n( __( 'F j, Y' ), $item['last_used'] );
87
-		}
88
-	}
75
+    /**
76
+     * Handles the last used column output.
77
+     *
78
+     * @since 5.6.0
79
+     *
80
+     * @param array $item The current application password item.
81
+     */
82
+    public function column_last_used( $item ) {
83
+        if ( empty( $item['last_used'] ) ) {
84
+            echo '&mdash;';
85
+        } else {
86
+            echo date_i18n( __( 'F j, Y' ), $item['last_used'] );
87
+        }
88
+    }
89 89
 
90
-	/**
91
-	 * Handles the last ip column output.
92
-	 *
93
-	 * @since 5.6.0
94
-	 *
95
-	 * @param array $item The current application password item.
96
-	 */
97
-	public function column_last_ip( $item ) {
98
-		if ( empty( $item['last_ip'] ) ) {
99
-			echo '&mdash;';
100
-		} else {
101
-			echo $item['last_ip'];
102
-		}
103
-	}
90
+    /**
91
+     * Handles the last ip column output.
92
+     *
93
+     * @since 5.6.0
94
+     *
95
+     * @param array $item The current application password item.
96
+     */
97
+    public function column_last_ip( $item ) {
98
+        if ( empty( $item['last_ip'] ) ) {
99
+            echo '&mdash;';
100
+        } else {
101
+            echo $item['last_ip'];
102
+        }
103
+    }
104 104
 
105
-	/**
106
-	 * Handles the revoke column output.
107
-	 *
108
-	 * @since 5.6.0
109
-	 *
110
-	 * @param array $item The current application password item.
111
-	 */
112
-	public function column_revoke( $item ) {
113
-		$name = 'revoke-application-password-' . $item['uuid'];
114
-		printf(
115
-			'<button type="button" name="%1$s" id="%1$s" class="button delete" aria-label="%2$s">%3$s</button>',
116
-			esc_attr( $name ),
117
-			/* translators: %s: the application password's given name. */
118
-			esc_attr( sprintf( __( 'Revoke "%s"' ), $item['name'] ) ),
119
-			__( 'Revoke' )
120
-		);
121
-	}
105
+    /**
106
+     * Handles the revoke column output.
107
+     *
108
+     * @since 5.6.0
109
+     *
110
+     * @param array $item The current application password item.
111
+     */
112
+    public function column_revoke( $item ) {
113
+        $name = 'revoke-application-password-' . $item['uuid'];
114
+        printf(
115
+            '<button type="button" name="%1$s" id="%1$s" class="button delete" aria-label="%2$s">%3$s</button>',
116
+            esc_attr( $name ),
117
+            /* translators: %s: the application password's given name. */
118
+            esc_attr( sprintf( __( 'Revoke "%s"' ), $item['name'] ) ),
119
+            __( 'Revoke' )
120
+        );
121
+    }
122 122
 
123
-	/**
124
-	 * Generates content for a single row of the table
125
-	 *
126
-	 * @since 5.6.0
127
-	 *
128
-	 * @param array  $item        The current item.
129
-	 * @param string $column_name The current column name.
130
-	 */
131
-	protected function column_default( $item, $column_name ) {
132
-		/**
133
-		 * Fires for each custom column in the Application Passwords list table.
134
-		 *
135
-		 * Custom columns are registered using the {@see 'manage_application-passwords-user_columns'} filter.
136
-		 *
137
-		 * @since 5.6.0
138
-		 *
139
-		 * @param string $column_name Name of the custom column.
140
-		 * @param array  $item        The application password item.
141
-		 */
142
-		do_action( "manage_{$this->screen->id}_custom_column", $column_name, $item );
143
-	}
123
+    /**
124
+     * Generates content for a single row of the table
125
+     *
126
+     * @since 5.6.0
127
+     *
128
+     * @param array  $item        The current item.
129
+     * @param string $column_name The current column name.
130
+     */
131
+    protected function column_default( $item, $column_name ) {
132
+        /**
133
+         * Fires for each custom column in the Application Passwords list table.
134
+         *
135
+         * Custom columns are registered using the {@see 'manage_application-passwords-user_columns'} filter.
136
+         *
137
+         * @since 5.6.0
138
+         *
139
+         * @param string $column_name Name of the custom column.
140
+         * @param array  $item        The application password item.
141
+         */
142
+        do_action( "manage_{$this->screen->id}_custom_column", $column_name, $item );
143
+    }
144 144
 
145
-	/**
146
-	 * Generates custom table navigation to prevent conflicting nonces.
147
-	 *
148
-	 * @since 5.6.0
149
-	 *
150
-	 * @param string $which The location of the bulk actions: 'top' or 'bottom'.
151
-	 */
152
-	protected function display_tablenav( $which ) {
153
-		?>
145
+    /**
146
+     * Generates custom table navigation to prevent conflicting nonces.
147
+     *
148
+     * @since 5.6.0
149
+     *
150
+     * @param string $which The location of the bulk actions: 'top' or 'bottom'.
151
+     */
152
+    protected function display_tablenav( $which ) {
153
+        ?>
154 154
 		<div class="tablenav <?php echo esc_attr( $which ); ?>">
155 155
 			<?php if ( 'bottom' === $which ) : ?>
156 156
 				<div class="alignright">
@@ -161,105 +161,105 @@  discard block
 block discarded – undo
161 161
 				<?php $this->bulk_actions( $which ); ?>
162 162
 			</div>
163 163
 			<?php
164
-			$this->extra_tablenav( $which );
165
-			$this->pagination( $which );
166
-			?>
164
+            $this->extra_tablenav( $which );
165
+            $this->pagination( $which );
166
+            ?>
167 167
 			<br class="clear" />
168 168
 		</div>
169 169
 		<?php
170
-	}
170
+    }
171 171
 
172
-	/**
173
-	 * Generates content for a single row of the table.
174
-	 *
175
-	 * @since 5.6.0
176
-	 *
177
-	 * @param array $item The current item.
178
-	 */
179
-	public function single_row( $item ) {
180
-		echo '<tr data-uuid="' . esc_attr( $item['uuid'] ) . '">';
181
-		$this->single_row_columns( $item );
182
-		echo '</tr>';
183
-	}
172
+    /**
173
+     * Generates content for a single row of the table.
174
+     *
175
+     * @since 5.6.0
176
+     *
177
+     * @param array $item The current item.
178
+     */
179
+    public function single_row( $item ) {
180
+        echo '<tr data-uuid="' . esc_attr( $item['uuid'] ) . '">';
181
+        $this->single_row_columns( $item );
182
+        echo '</tr>';
183
+    }
184 184
 
185
-	/**
186
-	 * Gets the name of the default primary column.
187
-	 *
188
-	 * @since 5.6.0
189
-	 *
190
-	 * @return string Name of the default primary column, in this case, 'name'.
191
-	 */
192
-	protected function get_default_primary_column_name() {
193
-		return 'name';
194
-	}
185
+    /**
186
+     * Gets the name of the default primary column.
187
+     *
188
+     * @since 5.6.0
189
+     *
190
+     * @return string Name of the default primary column, in this case, 'name'.
191
+     */
192
+    protected function get_default_primary_column_name() {
193
+        return 'name';
194
+    }
195 195
 
196
-	/**
197
-	 * Prints the JavaScript template for the new row item.
198
-	 *
199
-	 * @since 5.6.0
200
-	 */
201
-	public function print_js_template_row() {
202
-		list( $columns, $hidden, , $primary ) = $this->get_column_info();
196
+    /**
197
+     * Prints the JavaScript template for the new row item.
198
+     *
199
+     * @since 5.6.0
200
+     */
201
+    public function print_js_template_row() {
202
+        list( $columns, $hidden, , $primary ) = $this->get_column_info();
203 203
 
204
-		echo '<tr data-uuid="{{ data.uuid }}">';
204
+        echo '<tr data-uuid="{{ data.uuid }}">';
205 205
 
206
-		foreach ( $columns as $column_name => $display_name ) {
207
-			$is_primary = $primary === $column_name;
208
-			$classes    = "{$column_name} column-{$column_name}";
206
+        foreach ( $columns as $column_name => $display_name ) {
207
+            $is_primary = $primary === $column_name;
208
+            $classes    = "{$column_name} column-{$column_name}";
209 209
 
210
-			if ( $is_primary ) {
211
-				$classes .= ' has-row-actions column-primary';
212
-			}
210
+            if ( $is_primary ) {
211
+                $classes .= ' has-row-actions column-primary';
212
+            }
213 213
 
214
-			if ( in_array( $column_name, $hidden, true ) ) {
215
-				$classes .= ' hidden';
216
-			}
214
+            if ( in_array( $column_name, $hidden, true ) ) {
215
+                $classes .= ' hidden';
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 ) {
221
-				case 'name':
222
-					echo '{{ data.name }}';
223
-					break;
224
-				case 'created':
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 ) ) #>';
227
-					break;
228
-				case 'last_used':
229
-					echo '<# print( data.last_used !== null ? wp.date.dateI18n( ' . wp_json_encode( __( 'F j, Y' ) ) . ", data.last_used ) : '—' ) #>";
230
-					break;
231
-				case 'last_ip':
232
-					echo "{{ data.last_ip || '—' }}";
233
-					break;
234
-				case 'revoke':
235
-					printf(
236
-						'<button type="button" class="button delete" aria-label="%1$s">%2$s</button>',
237
-						/* translators: %s: the application password's given name. */
238
-						esc_attr( sprintf( __( 'Revoke "%s"' ), '{{ data.name }}' ) ),
239
-						esc_html__( 'Revoke' )
240
-					);
241
-					break;
242
-				default:
243
-					/**
244
-					 * Fires in the JavaScript row template for each custom column in the Application Passwords list table.
245
-					 *
246
-					 * Custom columns are registered using the {@see 'manage_application-passwords-user_columns'} filter.
247
-					 *
248
-					 * @since 5.6.0
249
-					 *
250
-					 * @param string $column_name Name of the custom column.
251
-					 */
252
-					do_action( "manage_{$this->screen->id}_custom_column_js_template", $column_name );
253
-					break;
254
-			}
220
+            switch ( $column_name ) {
221
+                case 'name':
222
+                    echo '{{ data.name }}';
223
+                    break;
224
+                case 'created':
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 ) ) #>';
227
+                    break;
228
+                case 'last_used':
229
+                    echo '<# print( data.last_used !== null ? wp.date.dateI18n( ' . wp_json_encode( __( 'F j, Y' ) ) . ", data.last_used ) : '—' ) #>";
230
+                    break;
231
+                case 'last_ip':
232
+                    echo "{{ data.last_ip || '—' }}";
233
+                    break;
234
+                case 'revoke':
235
+                    printf(
236
+                        '<button type="button" class="button delete" aria-label="%1$s">%2$s</button>',
237
+                        /* translators: %s: the application password's given name. */
238
+                        esc_attr( sprintf( __( 'Revoke "%s"' ), '{{ data.name }}' ) ),
239
+                        esc_html__( 'Revoke' )
240
+                    );
241
+                    break;
242
+                default:
243
+                    /**
244
+                     * Fires in the JavaScript row template for each custom column in the Application Passwords list table.
245
+                     *
246
+                     * Custom columns are registered using the {@see 'manage_application-passwords-user_columns'} filter.
247
+                     *
248
+                     * @since 5.6.0
249
+                     *
250
+                     * @param string $column_name Name of the custom column.
251
+                     */
252
+                    do_action( "manage_{$this->screen->id}_custom_column_js_template", $column_name );
253
+                    break;
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>';
258
-			}
256
+            if ( $is_primary ) {
257
+                echo '<button type="button" class="toggle-row"><span class="screen-reader-text">' . __( 'Show more details' ) . '</span></button>';
258
+            }
259 259
 
260
-			echo '</td>';
261
-		}
260
+            echo '</td>';
261
+        }
262 262
 
263
-		echo '</tr>';
264
-	}
263
+        echo '</tr>';
264
+    }
265 265
 }
Please login to merge, or discard this patch.
Spacing   +45 added lines, -45 removed lines patch added patch discarded remove patch
@@ -26,11 +26,11 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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 '&mdash;';
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
 block discarded – undo
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 '&mdash;';
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
 block discarded – undo
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 '&mdash;';
100 100
 		} else {
101 101
 			echo $item['last_ip'];
@@ -109,14 +109,14 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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>';
Please login to merge, or discard this patch.