Completed
Push — master ( cde0c6...d99bf9 )
by Stephen
15:46
created
src/wp-admin/update.php 2 patches
Spacing   +112 added lines, -112 removed lines patch added patch discarded remove patch
@@ -6,99 +6,99 @@  discard block
 block discarded – undo
6 6
  * @subpackage Administration
7 7
  */
8 8
 
9
-if ( ! defined( 'IFRAME_REQUEST' ) && isset( $_GET['action'] ) && in_array( $_GET['action'], array( 'update-selected', 'activate-plugin', 'update-selected-themes' ) ) )
10
-	define( 'IFRAME_REQUEST', true );
9
+if ( ! defined('IFRAME_REQUEST') && isset($_GET['action']) && in_array($_GET['action'], array('update-selected', 'activate-plugin', 'update-selected-themes')))
10
+	define('IFRAME_REQUEST', true);
11 11
 
12 12
 /** WordPress Administration Bootstrap */
13
-require_once( dirname( __FILE__ ) . '/admin.php' );
13
+require_once(dirname(__FILE__).'/admin.php');
14 14
 
15
-include_once( ABSPATH . 'wp-admin/includes/class-wp-upgrader.php' );
15
+include_once(ABSPATH.'wp-admin/includes/class-wp-upgrader.php');
16 16
 
17
-if ( isset($_GET['action']) ) {
17
+if (isset($_GET['action'])) {
18 18
 	$plugin = isset($_REQUEST['plugin']) ? trim($_REQUEST['plugin']) : '';
19 19
 	$theme = isset($_REQUEST['theme']) ? urldecode($_REQUEST['theme']) : '';
20 20
 	$action = isset($_REQUEST['action']) ? $_REQUEST['action'] : '';
21 21
 
22
-	if ( 'update-selected' == $action ) {
23
-		if ( ! current_user_can( 'update_plugins' ) )
24
-			wp_die( __( 'Sorry, you are not allowed to update plugins for this site.' ) );
22
+	if ('update-selected' == $action) {
23
+		if ( ! current_user_can('update_plugins'))
24
+			wp_die(__('Sorry, you are not allowed to update plugins for this site.'));
25 25
 
26
-		check_admin_referer( 'bulk-update-plugins' );
26
+		check_admin_referer('bulk-update-plugins');
27 27
 
28
-		if ( isset( $_GET['plugins'] ) )
29
-			$plugins = explode( ',', stripslashes($_GET['plugins']) );
30
-		elseif ( isset( $_POST['checked'] ) )
28
+		if (isset($_GET['plugins']))
29
+			$plugins = explode(',', stripslashes($_GET['plugins']));
30
+		elseif (isset($_POST['checked']))
31 31
 			$plugins = (array) $_POST['checked'];
32 32
 		else
33 33
 			$plugins = array();
34 34
 
35 35
 		$plugins = array_map('urldecode', $plugins);
36 36
 
37
-		$url = 'update.php?action=update-selected&plugins=' . urlencode(implode(',', $plugins));
37
+		$url = 'update.php?action=update-selected&plugins='.urlencode(implode(',', $plugins));
38 38
 		$nonce = 'bulk-update-plugins';
39 39
 
40
-		wp_enqueue_script( 'updates' );
40
+		wp_enqueue_script('updates');
41 41
 		iframe_header();
42 42
 
43
-		$upgrader = new Plugin_Upgrader( new Bulk_Plugin_Upgrader_Skin( compact( 'nonce', 'url' ) ) );
44
-		$upgrader->bulk_upgrade( $plugins );
43
+		$upgrader = new Plugin_Upgrader(new Bulk_Plugin_Upgrader_Skin(compact('nonce', 'url')));
44
+		$upgrader->bulk_upgrade($plugins);
45 45
 
46 46
 		iframe_footer();
47 47
 
48
-	} elseif ( 'upgrade-plugin' == $action ) {
49
-		if ( ! current_user_can('update_plugins') )
48
+	} elseif ('upgrade-plugin' == $action) {
49
+		if ( ! current_user_can('update_plugins'))
50 50
 			wp_die(__('Sorry, you are not allowed to update plugins for this site.'));
51 51
 
52
-		check_admin_referer('upgrade-plugin_' . $plugin);
52
+		check_admin_referer('upgrade-plugin_'.$plugin);
53 53
 
54 54
 		$title = __('Update Plugin');
55 55
 		$parent_file = 'plugins.php';
56 56
 		$submenu_file = 'plugins.php';
57 57
 
58
-		wp_enqueue_script( 'updates' );
59
-		require_once(ABSPATH . 'wp-admin/admin-header.php');
58
+		wp_enqueue_script('updates');
59
+		require_once(ABSPATH.'wp-admin/admin-header.php');
60 60
 
61
-		$nonce = 'upgrade-plugin_' . $plugin;
62
-		$url = 'update.php?action=upgrade-plugin&plugin=' . urlencode( $plugin );
61
+		$nonce = 'upgrade-plugin_'.$plugin;
62
+		$url = 'update.php?action=upgrade-plugin&plugin='.urlencode($plugin);
63 63
 
64
-		$upgrader = new Plugin_Upgrader( new Plugin_Upgrader_Skin( compact('title', 'nonce', 'url', 'plugin') ) );
64
+		$upgrader = new Plugin_Upgrader(new Plugin_Upgrader_Skin(compact('title', 'nonce', 'url', 'plugin')));
65 65
 		$upgrader->upgrade($plugin);
66 66
 
67
-		include(ABSPATH . 'wp-admin/admin-footer.php');
67
+		include(ABSPATH.'wp-admin/admin-footer.php');
68 68
 
69
-	} elseif ('activate-plugin' == $action ) {
70
-		if ( ! current_user_can('update_plugins') )
69
+	} elseif ('activate-plugin' == $action) {
70
+		if ( ! current_user_can('update_plugins'))
71 71
 			wp_die(__('Sorry, you are not allowed to update plugins for this site.'));
72 72
 
73
-		check_admin_referer('activate-plugin_' . $plugin);
74
-		if ( ! isset($_GET['failure']) && ! isset($_GET['success']) ) {
75
-			wp_redirect( admin_url('update.php?action=activate-plugin&failure=true&plugin=' . urlencode( $plugin ) . '&_wpnonce=' . $_GET['_wpnonce']) );
76
-			activate_plugin( $plugin, '', ! empty( $_GET['networkwide'] ), true );
77
-			wp_redirect( admin_url('update.php?action=activate-plugin&success=true&plugin=' . urlencode( $plugin ) . '&_wpnonce=' . $_GET['_wpnonce']) );
73
+		check_admin_referer('activate-plugin_'.$plugin);
74
+		if ( ! isset($_GET['failure']) && ! isset($_GET['success'])) {
75
+			wp_redirect(admin_url('update.php?action=activate-plugin&failure=true&plugin='.urlencode($plugin).'&_wpnonce='.$_GET['_wpnonce']));
76
+			activate_plugin($plugin, '', ! empty($_GET['networkwide']), true);
77
+			wp_redirect(admin_url('update.php?action=activate-plugin&success=true&plugin='.urlencode($plugin).'&_wpnonce='.$_GET['_wpnonce']));
78 78
 			die();
79 79
 		}
80
-		iframe_header( __('Plugin Reactivation'), true );
81
-		if ( isset($_GET['success']) )
82
-			echo '<p>' . __('Plugin reactivated successfully.') . '</p>';
80
+		iframe_header(__('Plugin Reactivation'), true);
81
+		if (isset($_GET['success']))
82
+			echo '<p>'.__('Plugin reactivated successfully.').'</p>';
83 83
 
84
-		if ( isset($_GET['failure']) ){
85
-			echo '<p>' . __('Plugin failed to reactivate due to a fatal error.') . '</p>';
84
+		if (isset($_GET['failure'])) {
85
+			echo '<p>'.__('Plugin failed to reactivate due to a fatal error.').'</p>';
86 86
 
87
-			error_reporting( E_CORE_ERROR | E_CORE_WARNING | E_COMPILE_ERROR | E_ERROR | E_WARNING | E_PARSE | E_USER_ERROR | E_USER_WARNING | E_RECOVERABLE_ERROR );
87
+			error_reporting(E_CORE_ERROR | E_CORE_WARNING | E_COMPILE_ERROR | E_ERROR | E_WARNING | E_PARSE | E_USER_ERROR | E_USER_WARNING | E_RECOVERABLE_ERROR);
88 88
 			@ini_set('display_errors', true); //Ensure that Fatal errors are displayed.
89
-			wp_register_plugin_realpath( WP_PLUGIN_DIR . '/' . $plugin );
90
-			include( WP_PLUGIN_DIR . '/' . $plugin );
89
+			wp_register_plugin_realpath(WP_PLUGIN_DIR.'/'.$plugin);
90
+			include(WP_PLUGIN_DIR.'/'.$plugin);
91 91
 		}
92 92
 		iframe_footer();
93
-	} elseif ( 'install-plugin' == $action ) {
93
+	} elseif ('install-plugin' == $action) {
94 94
 
95
-		if ( ! current_user_can('install_plugins') )
96
-			wp_die( __( 'Sorry, you are not allowed to install plugins on this site.' ) );
95
+		if ( ! current_user_can('install_plugins'))
96
+			wp_die(__('Sorry, you are not allowed to install plugins on this site.'));
97 97
 
98
-		include_once( ABSPATH . 'wp-admin/includes/plugin-install.php' ); //for plugins_api..
98
+		include_once(ABSPATH.'wp-admin/includes/plugin-install.php'); //for plugins_api..
99 99
 
100
-		check_admin_referer( 'install-plugin_' . $plugin );
101
-		$api = plugins_api( 'plugin_information', array(
100
+		check_admin_referer('install-plugin_'.$plugin);
101
+		$api = plugins_api('plugin_information', array(
102 102
 			'slug' => $plugin,
103 103
 			'fields' => array(
104 104
 				'short_description' => false,
@@ -114,34 +114,34 @@  discard block
 block discarded – undo
114 114
 				'homepage' => false,
115 115
 				'donate_link' => false,
116 116
 			),
117
-		) );
117
+		));
118 118
 
119
-		if ( is_wp_error( $api ) ) {
120
-	 		wp_die( $api );
119
+		if (is_wp_error($api)) {
120
+	 		wp_die($api);
121 121
 		}
122 122
 
123 123
 		$title = __('Plugin Install');
124 124
 		$parent_file = 'plugins.php';
125 125
 		$submenu_file = 'plugin-install.php';
126
-		require_once(ABSPATH . 'wp-admin/admin-header.php');
126
+		require_once(ABSPATH.'wp-admin/admin-header.php');
127 127
 
128
-		$title = sprintf( __('Installing Plugin: %s'), $api->name . ' ' . $api->version );
129
-		$nonce = 'install-plugin_' . $plugin;
130
-		$url = 'update.php?action=install-plugin&plugin=' . urlencode( $plugin );
131
-		if ( isset($_GET['from']) )
132
-			$url .= '&from=' . urlencode(stripslashes($_GET['from']));
128
+		$title = sprintf(__('Installing Plugin: %s'), $api->name.' '.$api->version);
129
+		$nonce = 'install-plugin_'.$plugin;
130
+		$url = 'update.php?action=install-plugin&plugin='.urlencode($plugin);
131
+		if (isset($_GET['from']))
132
+			$url .= '&from='.urlencode(stripslashes($_GET['from']));
133 133
 
134 134
 		$type = 'web'; //Install plugin type, From Web or an Upload.
135 135
 
136
-		$upgrader = new Plugin_Upgrader( new Plugin_Installer_Skin( compact('title', 'url', 'nonce', 'plugin', 'api') ) );
136
+		$upgrader = new Plugin_Upgrader(new Plugin_Installer_Skin(compact('title', 'url', 'nonce', 'plugin', 'api')));
137 137
 		$upgrader->install($api->download_link);
138 138
 
139
-		include(ABSPATH . 'wp-admin/admin-footer.php');
139
+		include(ABSPATH.'wp-admin/admin-footer.php');
140 140
 
141
-	} elseif ( 'upload-plugin' == $action ) {
141
+	} elseif ('upload-plugin' == $action) {
142 142
 
143
-		if ( ! current_user_can( 'upload_plugins' ) ) {
144
-			wp_die( __( 'Sorry, you are not allowed to install plugins on this site.' ) );
143
+		if ( ! current_user_can('upload_plugins')) {
144
+			wp_die(__('Sorry, you are not allowed to install plugins on this site.'));
145 145
 		}
146 146
 
147 147
 		check_admin_referer('plugin-upload');
@@ -151,128 +151,128 @@  discard block
 block discarded – undo
151 151
 		$title = __('Upload Plugin');
152 152
 		$parent_file = 'plugins.php';
153 153
 		$submenu_file = 'plugin-install.php';
154
-		require_once(ABSPATH . 'wp-admin/admin-header.php');
154
+		require_once(ABSPATH.'wp-admin/admin-header.php');
155 155
 
156
-		$title = sprintf( __('Installing Plugin from uploaded file: %s'), esc_html( basename( $file_upload->filename ) ) );
156
+		$title = sprintf(__('Installing Plugin from uploaded file: %s'), esc_html(basename($file_upload->filename)));
157 157
 		$nonce = 'plugin-upload';
158 158
 		$url = add_query_arg(array('package' => $file_upload->id), 'update.php?action=upload-plugin');
159 159
 		$type = 'upload'; //Install plugin type, From Web or an Upload.
160 160
 
161
-		$upgrader = new Plugin_Upgrader( new Plugin_Installer_Skin( compact('type', 'title', 'nonce', 'url') ) );
162
-		$result = $upgrader->install( $file_upload->package );
161
+		$upgrader = new Plugin_Upgrader(new Plugin_Installer_Skin(compact('type', 'title', 'nonce', 'url')));
162
+		$result = $upgrader->install($file_upload->package);
163 163
 
164
-		if ( $result || is_wp_error($result) )
164
+		if ($result || is_wp_error($result))
165 165
 			$file_upload->cleanup();
166 166
 
167
-		include(ABSPATH . 'wp-admin/admin-footer.php');
167
+		include(ABSPATH.'wp-admin/admin-footer.php');
168 168
 
169
-	} elseif ( 'upgrade-theme' == $action ) {
169
+	} elseif ('upgrade-theme' == $action) {
170 170
 
171
-		if ( ! current_user_can('update_themes') )
171
+		if ( ! current_user_can('update_themes'))
172 172
 			wp_die(__('Sorry, you are not allowed to update themes for this site.'));
173 173
 
174
-		check_admin_referer('upgrade-theme_' . $theme);
174
+		check_admin_referer('upgrade-theme_'.$theme);
175 175
 
176
-		wp_enqueue_script( 'customize-loader' );
177
-		wp_enqueue_script( 'updates' );
176
+		wp_enqueue_script('customize-loader');
177
+		wp_enqueue_script('updates');
178 178
 
179 179
 		$title = __('Update Theme');
180 180
 		$parent_file = 'themes.php';
181 181
 		$submenu_file = 'themes.php';
182
-		require_once(ABSPATH . 'wp-admin/admin-header.php');
182
+		require_once(ABSPATH.'wp-admin/admin-header.php');
183 183
 
184
-		$nonce = 'upgrade-theme_' . $theme;
185
-		$url = 'update.php?action=upgrade-theme&theme=' . urlencode( $theme );
184
+		$nonce = 'upgrade-theme_'.$theme;
185
+		$url = 'update.php?action=upgrade-theme&theme='.urlencode($theme);
186 186
 
187
-		$upgrader = new Theme_Upgrader( new Theme_Upgrader_Skin( compact('title', 'nonce', 'url', 'theme') ) );
187
+		$upgrader = new Theme_Upgrader(new Theme_Upgrader_Skin(compact('title', 'nonce', 'url', 'theme')));
188 188
 		$upgrader->upgrade($theme);
189 189
 
190
-		include(ABSPATH . 'wp-admin/admin-footer.php');
191
-	} elseif ( 'update-selected-themes' == $action ) {
192
-		if ( ! current_user_can( 'update_themes' ) )
193
-			wp_die( __( 'Sorry, you are not allowed to update themes for this site.' ) );
190
+		include(ABSPATH.'wp-admin/admin-footer.php');
191
+	} elseif ('update-selected-themes' == $action) {
192
+		if ( ! current_user_can('update_themes'))
193
+			wp_die(__('Sorry, you are not allowed to update themes for this site.'));
194 194
 
195
-		check_admin_referer( 'bulk-update-themes' );
195
+		check_admin_referer('bulk-update-themes');
196 196
 
197
-		if ( isset( $_GET['themes'] ) )
198
-			$themes = explode( ',', stripslashes($_GET['themes']) );
199
-		elseif ( isset( $_POST['checked'] ) )
197
+		if (isset($_GET['themes']))
198
+			$themes = explode(',', stripslashes($_GET['themes']));
199
+		elseif (isset($_POST['checked']))
200 200
 			$themes = (array) $_POST['checked'];
201 201
 		else
202 202
 			$themes = array();
203 203
 
204 204
 		$themes = array_map('urldecode', $themes);
205 205
 
206
-		$url = 'update.php?action=update-selected-themes&amp;themes=' . urlencode(implode(',', $themes));
206
+		$url = 'update.php?action=update-selected-themes&amp;themes='.urlencode(implode(',', $themes));
207 207
 		$nonce = 'bulk-update-themes';
208 208
 
209
-		wp_enqueue_script( 'updates' );
209
+		wp_enqueue_script('updates');
210 210
 		iframe_header();
211 211
 
212
-		$upgrader = new Theme_Upgrader( new Bulk_Theme_Upgrader_Skin( compact( 'nonce', 'url' ) ) );
213
-		$upgrader->bulk_upgrade( $themes );
212
+		$upgrader = new Theme_Upgrader(new Bulk_Theme_Upgrader_Skin(compact('nonce', 'url')));
213
+		$upgrader->bulk_upgrade($themes);
214 214
 
215 215
 		iframe_footer();
216
-	} elseif ( 'install-theme' == $action ) {
216
+	} elseif ('install-theme' == $action) {
217 217
 
218
-		if ( ! current_user_can('install_themes') )
219
-			wp_die( __( 'Sorry, you are not allowed to install themes on this site.' ) );
218
+		if ( ! current_user_can('install_themes'))
219
+			wp_die(__('Sorry, you are not allowed to install themes on this site.'));
220 220
 
221
-		include_once( ABSPATH . 'wp-admin/includes/class-wp-upgrader.php' ); //for themes_api..
221
+		include_once(ABSPATH.'wp-admin/includes/class-wp-upgrader.php'); //for themes_api..
222 222
 
223
-		check_admin_referer( 'install-theme_' . $theme );
224
-		$api = themes_api('theme_information', array('slug' => $theme, 'fields' => array('sections' => false, 'tags' => false) ) ); //Save on a bit of bandwidth.
223
+		check_admin_referer('install-theme_'.$theme);
224
+		$api = themes_api('theme_information', array('slug' => $theme, 'fields' => array('sections' => false, 'tags' => false))); //Save on a bit of bandwidth.
225 225
 
226
-		if ( is_wp_error($api) )
226
+		if (is_wp_error($api))
227 227
 	 		wp_die($api);
228 228
 
229
-		wp_enqueue_script( 'customize-loader' );
229
+		wp_enqueue_script('customize-loader');
230 230
 
231 231
 		$title = __('Install Themes');
232 232
 		$parent_file = 'themes.php';
233 233
 		$submenu_file = 'themes.php';
234
-		require_once(ABSPATH . 'wp-admin/admin-header.php');
234
+		require_once(ABSPATH.'wp-admin/admin-header.php');
235 235
 
236
-		$title = sprintf( __('Installing Theme: %s'), $api->name . ' ' . $api->version );
237
-		$nonce = 'install-theme_' . $theme;
238
-		$url = 'update.php?action=install-theme&theme=' . urlencode( $theme );
236
+		$title = sprintf(__('Installing Theme: %s'), $api->name.' '.$api->version);
237
+		$nonce = 'install-theme_'.$theme;
238
+		$url = 'update.php?action=install-theme&theme='.urlencode($theme);
239 239
 		$type = 'web'; //Install theme type, From Web or an Upload.
240 240
 
241
-		$upgrader = new Theme_Upgrader( new Theme_Installer_Skin( compact('title', 'url', 'nonce', 'plugin', 'api') ) );
241
+		$upgrader = new Theme_Upgrader(new Theme_Installer_Skin(compact('title', 'url', 'nonce', 'plugin', 'api')));
242 242
 		$upgrader->install($api->download_link);
243 243
 
244
-		include(ABSPATH . 'wp-admin/admin-footer.php');
244
+		include(ABSPATH.'wp-admin/admin-footer.php');
245 245
 
246
-	} elseif ( 'upload-theme' == $action ) {
246
+	} elseif ('upload-theme' == $action) {
247 247
 
248
-		if ( ! current_user_can( 'upload_themes' ) ) {
249
-			wp_die( __( 'Sorry, you are not allowed to install themes on this site.' ) );
248
+		if ( ! current_user_can('upload_themes')) {
249
+			wp_die(__('Sorry, you are not allowed to install themes on this site.'));
250 250
 		}
251 251
 
252 252
 		check_admin_referer('theme-upload');
253 253
 
254 254
 		$file_upload = new File_Upload_Upgrader('themezip', 'package');
255 255
 
256
-		wp_enqueue_script( 'customize-loader' );
256
+		wp_enqueue_script('customize-loader');
257 257
 
258 258
 		$title = __('Upload Theme');
259 259
 		$parent_file = 'themes.php';
260 260
 		$submenu_file = 'theme-install.php';
261 261
 
262
-		require_once(ABSPATH . 'wp-admin/admin-header.php');
262
+		require_once(ABSPATH.'wp-admin/admin-header.php');
263 263
 
264
-		$title = sprintf( __('Installing Theme from uploaded file: %s'), esc_html( basename( $file_upload->filename ) ) );
264
+		$title = sprintf(__('Installing Theme from uploaded file: %s'), esc_html(basename($file_upload->filename)));
265 265
 		$nonce = 'theme-upload';
266 266
 		$url = add_query_arg(array('package' => $file_upload->id), 'update.php?action=upload-theme');
267 267
 		$type = 'upload'; //Install plugin type, From Web or an Upload.
268 268
 
269
-		$upgrader = new Theme_Upgrader( new Theme_Installer_Skin( compact('type', 'title', 'nonce', 'url') ) );
270
-		$result = $upgrader->install( $file_upload->package );
269
+		$upgrader = new Theme_Upgrader(new Theme_Installer_Skin(compact('type', 'title', 'nonce', 'url')));
270
+		$result = $upgrader->install($file_upload->package);
271 271
 
272
-		if ( $result || is_wp_error($result) )
272
+		if ($result || is_wp_error($result))
273 273
 			$file_upload->cleanup();
274 274
 
275
-		include(ABSPATH . 'wp-admin/admin-footer.php');
275
+		include(ABSPATH.'wp-admin/admin-footer.php');
276 276
 
277 277
 	} else {
278 278
 		/**
@@ -284,6 +284,6 @@  discard block
 block discarded – undo
284 284
 		 *
285 285
 		 * @since 2.8.0
286 286
 		 */
287
-		do_action( "update-custom_{$action}" );
287
+		do_action("update-custom_{$action}");
288 288
 	}
289 289
 }
Please login to merge, or discard this patch.
Braces   +52 added lines, -37 removed lines patch added patch discarded remove patch
@@ -6,8 +6,9 @@  discard block
 block discarded – undo
6 6
  * @subpackage Administration
7 7
  */
8 8
 
9
-if ( ! defined( 'IFRAME_REQUEST' ) && isset( $_GET['action'] ) && in_array( $_GET['action'], array( 'update-selected', 'activate-plugin', 'update-selected-themes' ) ) )
9
+if ( ! defined( 'IFRAME_REQUEST' ) && isset( $_GET['action'] ) && in_array( $_GET['action'], array( 'update-selected', 'activate-plugin', 'update-selected-themes' ) ) ) {
10 10
 	define( 'IFRAME_REQUEST', true );
11
+}
11 12
 
12 13
 /** WordPress Administration Bootstrap */
13 14
 require_once( dirname( __FILE__ ) . '/admin.php' );
@@ -20,17 +21,19 @@  discard block
 block discarded – undo
20 21
 	$action = isset($_REQUEST['action']) ? $_REQUEST['action'] : '';
21 22
 
22 23
 	if ( 'update-selected' == $action ) {
23
-		if ( ! current_user_can( 'update_plugins' ) )
24
-			wp_die( __( 'Sorry, you are not allowed to update plugins for this site.' ) );
24
+		if ( ! current_user_can( 'update_plugins' ) ) {
25
+					wp_die( __( 'Sorry, you are not allowed to update plugins for this site.' ) );
26
+		}
25 27
 
26 28
 		check_admin_referer( 'bulk-update-plugins' );
27 29
 
28
-		if ( isset( $_GET['plugins'] ) )
29
-			$plugins = explode( ',', stripslashes($_GET['plugins']) );
30
-		elseif ( isset( $_POST['checked'] ) )
31
-			$plugins = (array) $_POST['checked'];
32
-		else
33
-			$plugins = array();
30
+		if ( isset( $_GET['plugins'] ) ) {
31
+					$plugins = explode( ',', stripslashes($_GET['plugins']) );
32
+		} elseif ( isset( $_POST['checked'] ) ) {
33
+					$plugins = (array) $_POST['checked'];
34
+		} else {
35
+					$plugins = array();
36
+		}
34 37
 
35 38
 		$plugins = array_map('urldecode', $plugins);
36 39
 
@@ -46,8 +49,9 @@  discard block
 block discarded – undo
46 49
 		iframe_footer();
47 50
 
48 51
 	} elseif ( 'upgrade-plugin' == $action ) {
49
-		if ( ! current_user_can('update_plugins') )
50
-			wp_die(__('Sorry, you are not allowed to update plugins for this site.'));
52
+		if ( ! current_user_can('update_plugins') ) {
53
+					wp_die(__('Sorry, you are not allowed to update plugins for this site.'));
54
+		}
51 55
 
52 56
 		check_admin_referer('upgrade-plugin_' . $plugin);
53 57
 
@@ -67,8 +71,9 @@  discard block
 block discarded – undo
67 71
 		include(ABSPATH . 'wp-admin/admin-footer.php');
68 72
 
69 73
 	} elseif ('activate-plugin' == $action ) {
70
-		if ( ! current_user_can('update_plugins') )
71
-			wp_die(__('Sorry, you are not allowed to update plugins for this site.'));
74
+		if ( ! current_user_can('update_plugins') ) {
75
+					wp_die(__('Sorry, you are not allowed to update plugins for this site.'));
76
+		}
72 77
 
73 78
 		check_admin_referer('activate-plugin_' . $plugin);
74 79
 		if ( ! isset($_GET['failure']) && ! isset($_GET['success']) ) {
@@ -78,8 +83,9 @@  discard block
 block discarded – undo
78 83
 			die();
79 84
 		}
80 85
 		iframe_header( __('Plugin Reactivation'), true );
81
-		if ( isset($_GET['success']) )
82
-			echo '<p>' . __('Plugin reactivated successfully.') . '</p>';
86
+		if ( isset($_GET['success']) ) {
87
+					echo '<p>' . __('Plugin reactivated successfully.') . '</p>';
88
+		}
83 89
 
84 90
 		if ( isset($_GET['failure']) ){
85 91
 			echo '<p>' . __('Plugin failed to reactivate due to a fatal error.') . '</p>';
@@ -92,8 +98,9 @@  discard block
 block discarded – undo
92 98
 		iframe_footer();
93 99
 	} elseif ( 'install-plugin' == $action ) {
94 100
 
95
-		if ( ! current_user_can('install_plugins') )
96
-			wp_die( __( 'Sorry, you are not allowed to install plugins on this site.' ) );
101
+		if ( ! current_user_can('install_plugins') ) {
102
+					wp_die( __( 'Sorry, you are not allowed to install plugins on this site.' ) );
103
+		}
97 104
 
98 105
 		include_once( ABSPATH . 'wp-admin/includes/plugin-install.php' ); //for plugins_api..
99 106
 
@@ -128,8 +135,9 @@  discard block
 block discarded – undo
128 135
 		$title = sprintf( __('Installing Plugin: %s'), $api->name . ' ' . $api->version );
129 136
 		$nonce = 'install-plugin_' . $plugin;
130 137
 		$url = 'update.php?action=install-plugin&plugin=' . urlencode( $plugin );
131
-		if ( isset($_GET['from']) )
132
-			$url .= '&from=' . urlencode(stripslashes($_GET['from']));
138
+		if ( isset($_GET['from']) ) {
139
+					$url .= '&from=' . urlencode(stripslashes($_GET['from']));
140
+		}
133 141
 
134 142
 		$type = 'web'; //Install plugin type, From Web or an Upload.
135 143
 
@@ -161,15 +169,17 @@  discard block
 block discarded – undo
161 169
 		$upgrader = new Plugin_Upgrader( new Plugin_Installer_Skin( compact('type', 'title', 'nonce', 'url') ) );
162 170
 		$result = $upgrader->install( $file_upload->package );
163 171
 
164
-		if ( $result || is_wp_error($result) )
165
-			$file_upload->cleanup();
172
+		if ( $result || is_wp_error($result) ) {
173
+					$file_upload->cleanup();
174
+		}
166 175
 
167 176
 		include(ABSPATH . 'wp-admin/admin-footer.php');
168 177
 
169 178
 	} elseif ( 'upgrade-theme' == $action ) {
170 179
 
171
-		if ( ! current_user_can('update_themes') )
172
-			wp_die(__('Sorry, you are not allowed to update themes for this site.'));
180
+		if ( ! current_user_can('update_themes') ) {
181
+					wp_die(__('Sorry, you are not allowed to update themes for this site.'));
182
+		}
173 183
 
174 184
 		check_admin_referer('upgrade-theme_' . $theme);
175 185
 
@@ -189,17 +199,19 @@  discard block
 block discarded – undo
189 199
 
190 200
 		include(ABSPATH . 'wp-admin/admin-footer.php');
191 201
 	} elseif ( 'update-selected-themes' == $action ) {
192
-		if ( ! current_user_can( 'update_themes' ) )
193
-			wp_die( __( 'Sorry, you are not allowed to update themes for this site.' ) );
202
+		if ( ! current_user_can( 'update_themes' ) ) {
203
+					wp_die( __( 'Sorry, you are not allowed to update themes for this site.' ) );
204
+		}
194 205
 
195 206
 		check_admin_referer( 'bulk-update-themes' );
196 207
 
197
-		if ( isset( $_GET['themes'] ) )
198
-			$themes = explode( ',', stripslashes($_GET['themes']) );
199
-		elseif ( isset( $_POST['checked'] ) )
200
-			$themes = (array) $_POST['checked'];
201
-		else
202
-			$themes = array();
208
+		if ( isset( $_GET['themes'] ) ) {
209
+					$themes = explode( ',', stripslashes($_GET['themes']) );
210
+		} elseif ( isset( $_POST['checked'] ) ) {
211
+					$themes = (array) $_POST['checked'];
212
+		} else {
213
+					$themes = array();
214
+		}
203 215
 
204 216
 		$themes = array_map('urldecode', $themes);
205 217
 
@@ -215,16 +227,18 @@  discard block
 block discarded – undo
215 227
 		iframe_footer();
216 228
 	} elseif ( 'install-theme' == $action ) {
217 229
 
218
-		if ( ! current_user_can('install_themes') )
219
-			wp_die( __( 'Sorry, you are not allowed to install themes on this site.' ) );
230
+		if ( ! current_user_can('install_themes') ) {
231
+					wp_die( __( 'Sorry, you are not allowed to install themes on this site.' ) );
232
+		}
220 233
 
221 234
 		include_once( ABSPATH . 'wp-admin/includes/class-wp-upgrader.php' ); //for themes_api..
222 235
 
223 236
 		check_admin_referer( 'install-theme_' . $theme );
224 237
 		$api = themes_api('theme_information', array('slug' => $theme, 'fields' => array('sections' => false, 'tags' => false) ) ); //Save on a bit of bandwidth.
225 238
 
226
-		if ( is_wp_error($api) )
227
-	 		wp_die($api);
239
+		if ( is_wp_error($api) ) {
240
+			 		wp_die($api);
241
+		}
228 242
 
229 243
 		wp_enqueue_script( 'customize-loader' );
230 244
 
@@ -269,8 +283,9 @@  discard block
 block discarded – undo
269 283
 		$upgrader = new Theme_Upgrader( new Theme_Installer_Skin( compact('type', 'title', 'nonce', 'url') ) );
270 284
 		$result = $upgrader->install( $file_upload->package );
271 285
 
272
-		if ( $result || is_wp_error($result) )
273
-			$file_upload->cleanup();
286
+		if ( $result || is_wp_error($result) ) {
287
+					$file_upload->cleanup();
288
+		}
274 289
 
275 290
 		include(ABSPATH . 'wp-admin/admin-footer.php');
276 291
 
Please login to merge, or discard this patch.
src/wp-admin/plugins.php 2 patches
Braces   +52 added lines, -36 removed lines patch added patch discarded remove patch
@@ -9,8 +9,9 @@  discard block
 block discarded – undo
9 9
 /** WordPress Administration Bootstrap */
10 10
 require_once( dirname( __FILE__ ) . '/admin.php' );
11 11
 
12
-if ( ! current_user_can('activate_plugins') )
12
+if ( ! current_user_can('activate_plugins') ) {
13 13
 	wp_die( __( 'Sorry, you are not allowed to manage plugins for this site.' ) );
14
+}
14 15
 
15 16
 $wp_list_table = _get_list_table('WP_Plugins_List_Table');
16 17
 $pagenum = $wp_list_table->get_pagenum();
@@ -29,8 +30,9 @@  discard block
 block discarded – undo
29 30
 
30 31
 	switch ( $action ) {
31 32
 		case 'activate':
32
-			if ( ! current_user_can('activate_plugins') )
33
-				wp_die(__('Sorry, you are not allowed to activate plugins for this site.'));
33
+			if ( ! current_user_can('activate_plugins') ) {
34
+							wp_die(__('Sorry, you are not allowed to activate plugins for this site.'));
35
+			}
34 36
 
35 37
 			if ( is_multisite() && ! is_network_admin() && is_network_only_plugin( $plugin ) ) {
36 38
 				wp_redirect( self_admin_url("plugins.php?plugin_status=$status&paged=$page&s=$s") );
@@ -68,8 +70,9 @@  discard block
 block discarded – undo
68 70
 			exit;
69 71
 
70 72
 		case 'activate-selected':
71
-			if ( ! current_user_can('activate_plugins') )
72
-				wp_die(__('Sorry, you are not allowed to activate plugins for this site.'));
73
+			if ( ! current_user_can('activate_plugins') ) {
74
+							wp_die(__('Sorry, you are not allowed to activate plugins for this site.'));
75
+			}
73 76
 
74 77
 			check_admin_referer('bulk-plugins');
75 78
 
@@ -121,12 +124,13 @@  discard block
 block discarded – undo
121 124
 
122 125
 			check_admin_referer( 'bulk-plugins' );
123 126
 
124
-			if ( isset( $_GET['plugins'] ) )
125
-				$plugins = explode( ',', $_GET['plugins'] );
126
-			elseif ( isset( $_POST['checked'] ) )
127
-				$plugins = (array) $_POST['checked'];
128
-			else
129
-				$plugins = array();
127
+			if ( isset( $_GET['plugins'] ) ) {
128
+							$plugins = explode( ',', $_GET['plugins'] );
129
+			} elseif ( isset( $_POST['checked'] ) ) {
130
+							$plugins = (array) $_POST['checked'];
131
+			} else {
132
+							$plugins = array();
133
+			}
130 134
 
131 135
 			$title = __( 'Update Plugins' );
132 136
 			$parent_file = 'plugins.php';
@@ -146,14 +150,16 @@  discard block
 block discarded – undo
146 150
 			exit;
147 151
 
148 152
 		case 'error_scrape':
149
-			if ( ! current_user_can('activate_plugins') )
150
-				wp_die(__('Sorry, you are not allowed to activate plugins for this site.'));
153
+			if ( ! current_user_can('activate_plugins') ) {
154
+							wp_die(__('Sorry, you are not allowed to activate plugins for this site.'));
155
+			}
151 156
 
152 157
 			check_admin_referer('plugin-activation-error_' . $plugin);
153 158
 
154 159
 			$valid = validate_plugin($plugin);
155
-			if ( is_wp_error($valid) )
156
-				wp_die($valid);
160
+			if ( is_wp_error($valid) ) {
161
+							wp_die($valid);
162
+			}
157 163
 
158 164
 			if ( ! WP_DEBUG ) {
159 165
 				error_reporting( E_CORE_ERROR | E_CORE_WARNING | E_COMPILE_ERROR | E_ERROR | E_WARNING | E_PARSE | E_USER_ERROR | E_USER_WARNING | E_RECOVERABLE_ERROR );
@@ -167,8 +173,9 @@  discard block
 block discarded – undo
167 173
 			exit;
168 174
 
169 175
 		case 'deactivate':
170
-			if ( ! current_user_can('activate_plugins') )
171
-				wp_die(__('Sorry, you are not allowed to deactivate plugins for this site.'));
176
+			if ( ! current_user_can('activate_plugins') ) {
177
+							wp_die(__('Sorry, you are not allowed to deactivate plugins for this site.'));
178
+			}
172 179
 
173 180
 			check_admin_referer('deactivate-plugin_' . $plugin);
174 181
 
@@ -185,15 +192,17 @@  discard block
 block discarded – undo
185 192
 				update_site_option( 'recently_activated', array( $plugin => time() ) + (array) get_site_option( 'recently_activated' ) );
186 193
 			}
187 194
 
188
-			if ( headers_sent() )
189
-				echo "<meta http-equiv='refresh' content='" . esc_attr( "0;url=plugins.php?deactivate=true&plugin_status=$status&paged=$page&s=$s" ) . "' />";
190
-			else
191
-				wp_redirect( self_admin_url("plugins.php?deactivate=true&plugin_status=$status&paged=$page&s=$s") );
195
+			if ( headers_sent() ) {
196
+							echo "<meta http-equiv='refresh' content='" . esc_attr( "0;url=plugins.php?deactivate=true&plugin_status=$status&paged=$page&s=$s" ) . "' />";
197
+			} else {
198
+							wp_redirect( self_admin_url("plugins.php?deactivate=true&plugin_status=$status&paged=$page&s=$s") );
199
+			}
192 200
 			exit;
193 201
 
194 202
 		case 'deactivate-selected':
195
-			if ( ! current_user_can('activate_plugins') )
196
-				wp_die(__('Sorry, you are not allowed to deactivate plugins for this site.'));
203
+			if ( ! current_user_can('activate_plugins') ) {
204
+							wp_die(__('Sorry, you are not allowed to deactivate plugins for this site.'));
205
+			}
197 206
 
198 207
 			check_admin_referer('bulk-plugins');
199 208
 
@@ -290,8 +299,11 @@  discard block
 block discarded – undo
290 299
 						<div class="error"><p><strong><?php _e( 'Caution:' ); ?></strong> <?php _e( 'This plugin may be active on other sites in the network.' ); ?></p></div>
291 300
 					<?php endif; ?>
292 301
 					<p><?php _e( 'You are about to remove the following plugin:' ); ?></p>
293
-				<?php else: ?>
294
-					<h1><?php _e( 'Delete Plugins' ); ?></h1>
302
+				<?php else {
303
+	: ?>
304
+					<h1><?php _e( 'Delete Plugins' );
305
+}
306
+?></h1>
295 307
 					<?php if ( $have_non_network_plugins && is_network_admin() ) : ?>
296 308
 						<div class="error"><p><strong><?php _e( 'Caution:' ); ?></strong> <?php _e( 'These plugins may be active on other sites in the network.' ); ?></p></div>
297 309
 					<?php endif; ?>
@@ -313,10 +325,11 @@  discard block
 block discarded – undo
313 325
 						?>
314 326
 					</ul>
315 327
 				<p><?php
316
-				if ( $data_to_delete )
317
-					_e('Are you sure you wish to delete these files and data?');
318
-				else
319
-					_e('Are you sure you wish to delete these files?');
328
+				if ( $data_to_delete ) {
329
+									_e('Are you sure you wish to delete these files and data?');
330
+				} else {
331
+									_e('Are you sure you wish to delete these files?');
332
+				}
320 333
 				?></p>
321 334
 				<form method="post" action="<?php echo esc_url($_SERVER['REQUEST_URI']); ?>" style="display:inline;">
322 335
 					<input type="hidden" name="verify-delete" value="1" />
@@ -423,12 +436,13 @@  discard block
 block discarded – undo
423 436
 
424 437
 <?php if ( isset($_GET['error']) ) :
425 438
 
426
-	if ( isset( $_GET['main'] ) )
427
-		$errmsg = __( 'You cannot delete a plugin while it is active on the main site.' );
428
-	elseif ( isset($_GET['charsout']) )
429
-		$errmsg = sprintf(__('The plugin generated %d characters of <strong>unexpected output</strong> during activation. If you notice &#8220;headers already sent&#8221; messages, problems with syndication feeds or other issues, try deactivating or removing this plugin.'), $_GET['charsout']);
430
-	else
431
-		$errmsg = __('Plugin could not be activated because it triggered a <strong>fatal error</strong>.');
439
+	if ( isset( $_GET['main'] ) ) {
440
+			$errmsg = __( 'You cannot delete a plugin while it is active on the main site.' );
441
+	} elseif ( isset($_GET['charsout']) ) {
442
+			$errmsg = sprintf(__('The plugin generated %d characters of <strong>unexpected output</strong> during activation. If you notice &#8220;headers already sent&#8221; messages, problems with syndication feeds or other issues, try deactivating or removing this plugin.'), $_GET['charsout']);
443
+	} else {
444
+			$errmsg = __('Plugin could not be activated because it triggered a <strong>fatal error</strong>.');
445
+	}
432 446
 	?>
433 447
 	<div id="message" class="error"><p><?php echo $errmsg; ?></p>
434 448
 	<?php
@@ -451,12 +465,14 @@  discard block
 block discarded – undo
451 465
 
452 466
 		if ( is_wp_error($delete_result) ) : ?>
453 467
 		<div id="message" class="error notice is-dismissible"><p><?php printf( __('Plugin could not be deleted due to an error: %s'), $delete_result->get_error_message() ); ?></p></div>
454
-		<?php else : ?>
468
+		<?php else {
469
+	: ?>
455 470
 		<div id="message" class="updated notice is-dismissible">
456 471
 			<p>
457 472
 				<?php
458 473
 				if ( 1 == (int) $_GET['deleted'] ) {
459 474
 					_e( 'The selected plugin has been <strong>deleted</strong>.' );
475
+}
460 476
 				} else {
461 477
 					_e( 'The selected plugins have been <strong>deleted</strong>.' );
462 478
 				}
Please login to merge, or discard this patch.
Spacing   +202 added lines, -202 removed lines patch added patch discarded remove patch
@@ -7,10 +7,10 @@  discard block
 block discarded – undo
7 7
  */
8 8
 
9 9
 /** WordPress Administration Bootstrap */
10
-require_once( dirname( __FILE__ ) . '/admin.php' );
10
+require_once(dirname(__FILE__).'/admin.php');
11 11
 
12
-if ( ! current_user_can('activate_plugins') )
13
-	wp_die( __( 'Sorry, you are not allowed to manage plugins for this site.' ) );
12
+if ( ! current_user_can('activate_plugins'))
13
+	wp_die(__('Sorry, you are not allowed to manage plugins for this site.'));
14 14
 
15 15
 $wp_list_table = _get_list_table('WP_Plugins_List_Table');
16 16
 $pagenum = $wp_list_table->get_pagenum();
@@ -18,302 +18,302 @@  discard block
 block discarded – undo
18 18
 $action = $wp_list_table->current_action();
19 19
 
20 20
 $plugin = isset($_REQUEST['plugin']) ? $_REQUEST['plugin'] : '';
21
-$s = isset($_REQUEST['s']) ? urlencode( wp_unslash( $_REQUEST['s'] ) ) : '';
21
+$s = isset($_REQUEST['s']) ? urlencode(wp_unslash($_REQUEST['s'])) : '';
22 22
 
23 23
 // Clean up request URI from temporary args for screen options/paging uri's to work as expected.
24 24
 $_SERVER['REQUEST_URI'] = remove_query_arg(array('error', 'deleted', 'activate', 'activate-multi', 'deactivate', 'deactivate-multi', '_error_nonce'), $_SERVER['REQUEST_URI']);
25 25
 
26
-wp_enqueue_script( 'updates' );
26
+wp_enqueue_script('updates');
27 27
 
28
-if ( $action ) {
28
+if ($action) {
29 29
 
30
-	switch ( $action ) {
30
+	switch ($action) {
31 31
 		case 'activate':
32
-			if ( ! current_user_can('activate_plugins') )
32
+			if ( ! current_user_can('activate_plugins'))
33 33
 				wp_die(__('Sorry, you are not allowed to activate plugins for this site.'));
34 34
 
35
-			if ( is_multisite() && ! is_network_admin() && is_network_only_plugin( $plugin ) ) {
36
-				wp_redirect( self_admin_url("plugins.php?plugin_status=$status&paged=$page&s=$s") );
35
+			if (is_multisite() && ! is_network_admin() && is_network_only_plugin($plugin)) {
36
+				wp_redirect(self_admin_url("plugins.php?plugin_status=$status&paged=$page&s=$s"));
37 37
 				exit;
38 38
 			}
39 39
 
40
-			check_admin_referer('activate-plugin_' . $plugin);
40
+			check_admin_referer('activate-plugin_'.$plugin);
41 41
 
42
-			$result = activate_plugin($plugin, self_admin_url('plugins.php?error=true&plugin=' . $plugin), is_network_admin() );
43
-			if ( is_wp_error( $result ) ) {
44
-				if ( 'unexpected_output' == $result->get_error_code() ) {
45
-					$redirect = self_admin_url('plugins.php?error=true&charsout=' . strlen($result->get_error_data()) . '&plugin=' . $plugin . "&plugin_status=$status&paged=$page&s=$s");
46
-					wp_redirect(add_query_arg('_error_nonce', wp_create_nonce('plugin-activation-error_' . $plugin), $redirect));
42
+			$result = activate_plugin($plugin, self_admin_url('plugins.php?error=true&plugin='.$plugin), is_network_admin());
43
+			if (is_wp_error($result)) {
44
+				if ('unexpected_output' == $result->get_error_code()) {
45
+					$redirect = self_admin_url('plugins.php?error=true&charsout='.strlen($result->get_error_data()).'&plugin='.$plugin."&plugin_status=$status&paged=$page&s=$s");
46
+					wp_redirect(add_query_arg('_error_nonce', wp_create_nonce('plugin-activation-error_'.$plugin), $redirect));
47 47
 					exit;
48 48
 				} else {
49 49
 					wp_die($result);
50 50
 				}
51 51
 			}
52 52
 
53
-			if ( ! is_network_admin() ) {
54
-				$recent = (array) get_option( 'recently_activated' );
55
-				unset( $recent[ $plugin ] );
56
-				update_option( 'recently_activated', $recent );
53
+			if ( ! is_network_admin()) {
54
+				$recent = (array) get_option('recently_activated');
55
+				unset($recent[$plugin]);
56
+				update_option('recently_activated', $recent);
57 57
 			} else {
58
-				$recent = (array) get_site_option( 'recently_activated' );
59
-				unset( $recent[ $plugin ] );
60
-				update_site_option( 'recently_activated', $recent );
58
+				$recent = (array) get_site_option('recently_activated');
59
+				unset($recent[$plugin]);
60
+				update_site_option('recently_activated', $recent);
61 61
 			}
62 62
 
63
-			if ( isset($_GET['from']) && 'import' == $_GET['from'] ) {
64
-				wp_redirect( self_admin_url("import.php?import=" . str_replace('-importer', '', dirname($plugin))) ); // overrides the ?error=true one above and redirects to the Imports page, stripping the -importer suffix
63
+			if (isset($_GET['from']) && 'import' == $_GET['from']) {
64
+				wp_redirect(self_admin_url("import.php?import=".str_replace('-importer', '', dirname($plugin)))); // overrides the ?error=true one above and redirects to the Imports page, stripping the -importer suffix
65 65
 			} else {
66
-				wp_redirect( self_admin_url("plugins.php?activate=true&plugin_status=$status&paged=$page&s=$s") ); // overrides the ?error=true one above
66
+				wp_redirect(self_admin_url("plugins.php?activate=true&plugin_status=$status&paged=$page&s=$s")); // overrides the ?error=true one above
67 67
 			}
68 68
 			exit;
69 69
 
70 70
 		case 'activate-selected':
71
-			if ( ! current_user_can('activate_plugins') )
71
+			if ( ! current_user_can('activate_plugins'))
72 72
 				wp_die(__('Sorry, you are not allowed to activate plugins for this site.'));
73 73
 
74 74
 			check_admin_referer('bulk-plugins');
75 75
 
76
-			$plugins = isset( $_POST['checked'] ) ? (array) $_POST['checked'] : array();
76
+			$plugins = isset($_POST['checked']) ? (array) $_POST['checked'] : array();
77 77
 
78
-			if ( is_network_admin() ) {
79
-				foreach ( $plugins as $i => $plugin ) {
78
+			if (is_network_admin()) {
79
+				foreach ($plugins as $i => $plugin) {
80 80
 					// Only activate plugins which are not already network activated.
81
-					if ( is_plugin_active_for_network( $plugin ) ) {
82
-						unset( $plugins[ $i ] );
81
+					if (is_plugin_active_for_network($plugin)) {
82
+						unset($plugins[$i]);
83 83
 					}
84 84
 				}
85 85
 			} else {
86
-				foreach ( $plugins as $i => $plugin ) {
86
+				foreach ($plugins as $i => $plugin) {
87 87
 					// Only activate plugins which are not already active and are not network-only when on Multisite.
88
-					if ( is_plugin_active( $plugin ) || ( is_multisite() && is_network_only_plugin( $plugin ) ) ) {
89
-						unset( $plugins[ $i ] );
88
+					if (is_plugin_active($plugin) || (is_multisite() && is_network_only_plugin($plugin))) {
89
+						unset($plugins[$i]);
90 90
 					}
91 91
 				}
92 92
 			}
93 93
 
94
-			if ( empty($plugins) ) {
95
-				wp_redirect( self_admin_url("plugins.php?plugin_status=$status&paged=$page&s=$s") );
94
+			if (empty($plugins)) {
95
+				wp_redirect(self_admin_url("plugins.php?plugin_status=$status&paged=$page&s=$s"));
96 96
 				exit;
97 97
 			}
98 98
 
99
-			activate_plugins($plugins, self_admin_url('plugins.php?error=true'), is_network_admin() );
99
+			activate_plugins($plugins, self_admin_url('plugins.php?error=true'), is_network_admin());
100 100
 
101
-			if ( ! is_network_admin() ) {
102
-				$recent = (array) get_option('recently_activated' );
101
+			if ( ! is_network_admin()) {
102
+				$recent = (array) get_option('recently_activated');
103 103
 			} else {
104
-				$recent = (array) get_site_option('recently_activated' );
104
+				$recent = (array) get_site_option('recently_activated');
105 105
 			}
106 106
 
107
-			foreach ( $plugins as $plugin ) {
108
-				unset( $recent[ $plugin ] );
107
+			foreach ($plugins as $plugin) {
108
+				unset($recent[$plugin]);
109 109
 			}
110 110
 
111
-			if ( ! is_network_admin() ) {
112
-				update_option( 'recently_activated', $recent );
111
+			if ( ! is_network_admin()) {
112
+				update_option('recently_activated', $recent);
113 113
 			} else {
114
-				update_site_option( 'recently_activated', $recent );
114
+				update_site_option('recently_activated', $recent);
115 115
 			}
116 116
 
117
-			wp_redirect( self_admin_url("plugins.php?activate-multi=true&plugin_status=$status&paged=$page&s=$s") );
117
+			wp_redirect(self_admin_url("plugins.php?activate-multi=true&plugin_status=$status&paged=$page&s=$s"));
118 118
 			exit;
119 119
 
120 120
 		case 'update-selected' :
121 121
 
122
-			check_admin_referer( 'bulk-plugins' );
122
+			check_admin_referer('bulk-plugins');
123 123
 
124
-			if ( isset( $_GET['plugins'] ) )
125
-				$plugins = explode( ',', $_GET['plugins'] );
126
-			elseif ( isset( $_POST['checked'] ) )
124
+			if (isset($_GET['plugins']))
125
+				$plugins = explode(',', $_GET['plugins']);
126
+			elseif (isset($_POST['checked']))
127 127
 				$plugins = (array) $_POST['checked'];
128 128
 			else
129 129
 				$plugins = array();
130 130
 
131
-			$title = __( 'Update Plugins' );
131
+			$title = __('Update Plugins');
132 132
 			$parent_file = 'plugins.php';
133 133
 
134
-			wp_enqueue_script( 'updates' );
135
-			require_once(ABSPATH . 'wp-admin/admin-header.php');
134
+			wp_enqueue_script('updates');
135
+			require_once(ABSPATH.'wp-admin/admin-header.php');
136 136
 
137 137
 			echo '<div class="wrap">';
138
-			echo '<h1>' . esc_html( $title ) . '</h1>';
138
+			echo '<h1>'.esc_html($title).'</h1>';
139 139
 
140
-			$url = self_admin_url('update.php?action=update-selected&amp;plugins=' . urlencode( join(',', $plugins) ));
140
+			$url = self_admin_url('update.php?action=update-selected&amp;plugins='.urlencode(join(',', $plugins)));
141 141
 			$url = wp_nonce_url($url, 'bulk-update-plugins');
142 142
 
143 143
 			echo "<iframe src='$url' style='width: 100%; height:100%; min-height:850px;'></iframe>";
144 144
 			echo '</div>';
145
-			require_once(ABSPATH . 'wp-admin/admin-footer.php');
145
+			require_once(ABSPATH.'wp-admin/admin-footer.php');
146 146
 			exit;
147 147
 
148 148
 		case 'error_scrape':
149
-			if ( ! current_user_can('activate_plugins') )
149
+			if ( ! current_user_can('activate_plugins'))
150 150
 				wp_die(__('Sorry, you are not allowed to activate plugins for this site.'));
151 151
 
152
-			check_admin_referer('plugin-activation-error_' . $plugin);
152
+			check_admin_referer('plugin-activation-error_'.$plugin);
153 153
 
154 154
 			$valid = validate_plugin($plugin);
155
-			if ( is_wp_error($valid) )
155
+			if (is_wp_error($valid))
156 156
 				wp_die($valid);
157 157
 
158
-			if ( ! WP_DEBUG ) {
159
-				error_reporting( E_CORE_ERROR | E_CORE_WARNING | E_COMPILE_ERROR | E_ERROR | E_WARNING | E_PARSE | E_USER_ERROR | E_USER_WARNING | E_RECOVERABLE_ERROR );
158
+			if ( ! WP_DEBUG) {
159
+				error_reporting(E_CORE_ERROR | E_CORE_WARNING | E_COMPILE_ERROR | E_ERROR | E_WARNING | E_PARSE | E_USER_ERROR | E_USER_WARNING | E_RECOVERABLE_ERROR);
160 160
 			}
161 161
 
162 162
 			@ini_set('display_errors', true); //Ensure that Fatal errors are displayed.
163 163
 			// Go back to "sandbox" scope so we get the same errors as before
164
-			plugin_sandbox_scrape( $plugin );
164
+			plugin_sandbox_scrape($plugin);
165 165
 			/** This action is documented in wp-admin/includes/plugin.php */
166
-			do_action( "activate_{$plugin}" );
166
+			do_action("activate_{$plugin}");
167 167
 			exit;
168 168
 
169 169
 		case 'deactivate':
170
-			if ( ! current_user_can('activate_plugins') )
170
+			if ( ! current_user_can('activate_plugins'))
171 171
 				wp_die(__('Sorry, you are not allowed to deactivate plugins for this site.'));
172 172
 
173
-			check_admin_referer('deactivate-plugin_' . $plugin);
173
+			check_admin_referer('deactivate-plugin_'.$plugin);
174 174
 
175
-			if ( ! is_network_admin() && is_plugin_active_for_network( $plugin ) ) {
176
-				wp_redirect( self_admin_url("plugins.php?plugin_status=$status&paged=$page&s=$s") );
175
+			if ( ! is_network_admin() && is_plugin_active_for_network($plugin)) {
176
+				wp_redirect(self_admin_url("plugins.php?plugin_status=$status&paged=$page&s=$s"));
177 177
 				exit;
178 178
 			}
179 179
 
180
-			deactivate_plugins( $plugin, false, is_network_admin() );
180
+			deactivate_plugins($plugin, false, is_network_admin());
181 181
 
182
-			if ( ! is_network_admin() ) {
183
-				update_option( 'recently_activated', array( $plugin => time() ) + (array) get_option( 'recently_activated' ) );
182
+			if ( ! is_network_admin()) {
183
+				update_option('recently_activated', array($plugin => time()) + (array) get_option('recently_activated'));
184 184
 			} else {
185
-				update_site_option( 'recently_activated', array( $plugin => time() ) + (array) get_site_option( 'recently_activated' ) );
185
+				update_site_option('recently_activated', array($plugin => time()) + (array) get_site_option('recently_activated'));
186 186
 			}
187 187
 
188
-			if ( headers_sent() )
189
-				echo "<meta http-equiv='refresh' content='" . esc_attr( "0;url=plugins.php?deactivate=true&plugin_status=$status&paged=$page&s=$s" ) . "' />";
188
+			if (headers_sent())
189
+				echo "<meta http-equiv='refresh' content='".esc_attr("0;url=plugins.php?deactivate=true&plugin_status=$status&paged=$page&s=$s")."' />";
190 190
 			else
191
-				wp_redirect( self_admin_url("plugins.php?deactivate=true&plugin_status=$status&paged=$page&s=$s") );
191
+				wp_redirect(self_admin_url("plugins.php?deactivate=true&plugin_status=$status&paged=$page&s=$s"));
192 192
 			exit;
193 193
 
194 194
 		case 'deactivate-selected':
195
-			if ( ! current_user_can('activate_plugins') )
195
+			if ( ! current_user_can('activate_plugins'))
196 196
 				wp_die(__('Sorry, you are not allowed to deactivate plugins for this site.'));
197 197
 
198 198
 			check_admin_referer('bulk-plugins');
199 199
 
200
-			$plugins = isset( $_POST['checked'] ) ? (array) $_POST['checked'] : array();
200
+			$plugins = isset($_POST['checked']) ? (array) $_POST['checked'] : array();
201 201
 			// Do not deactivate plugins which are already deactivated.
202
-			if ( is_network_admin() ) {
203
-				$plugins = array_filter( $plugins, 'is_plugin_active_for_network' );
202
+			if (is_network_admin()) {
203
+				$plugins = array_filter($plugins, 'is_plugin_active_for_network');
204 204
 			} else {
205
-				$plugins = array_filter( $plugins, 'is_plugin_active' );
206
-				$plugins = array_diff( $plugins, array_filter( $plugins, 'is_plugin_active_for_network' ) );
205
+				$plugins = array_filter($plugins, 'is_plugin_active');
206
+				$plugins = array_diff($plugins, array_filter($plugins, 'is_plugin_active_for_network'));
207 207
 			}
208
-			if ( empty($plugins) ) {
209
-				wp_redirect( self_admin_url("plugins.php?plugin_status=$status&paged=$page&s=$s") );
208
+			if (empty($plugins)) {
209
+				wp_redirect(self_admin_url("plugins.php?plugin_status=$status&paged=$page&s=$s"));
210 210
 				exit;
211 211
 			}
212 212
 
213
-			deactivate_plugins( $plugins, false, is_network_admin() );
213
+			deactivate_plugins($plugins, false, is_network_admin());
214 214
 
215 215
 			$deactivated = array();
216
-			foreach ( $plugins as $plugin ) {
217
-				$deactivated[ $plugin ] = time();
216
+			foreach ($plugins as $plugin) {
217
+				$deactivated[$plugin] = time();
218 218
 			}
219 219
 
220
-			if ( ! is_network_admin() ) {
221
-				update_option( 'recently_activated', $deactivated + (array) get_option( 'recently_activated' ) );
220
+			if ( ! is_network_admin()) {
221
+				update_option('recently_activated', $deactivated + (array) get_option('recently_activated'));
222 222
 			} else {
223
-				update_site_option( 'recently_activated', $deactivated + (array) get_site_option( 'recently_activated' ) );
223
+				update_site_option('recently_activated', $deactivated + (array) get_site_option('recently_activated'));
224 224
 			}
225 225
 
226
-			wp_redirect( self_admin_url("plugins.php?deactivate-multi=true&plugin_status=$status&paged=$page&s=$s") );
226
+			wp_redirect(self_admin_url("plugins.php?deactivate-multi=true&plugin_status=$status&paged=$page&s=$s"));
227 227
 			exit;
228 228
 
229 229
 		case 'delete-selected':
230
-			if ( ! current_user_can('delete_plugins') ) {
230
+			if ( ! current_user_can('delete_plugins')) {
231 231
 				wp_die(__('Sorry, you are not allowed to delete plugins for this site.'));
232 232
 			}
233 233
 
234 234
 			check_admin_referer('bulk-plugins');
235 235
 
236 236
 			//$_POST = from the plugin form; $_GET = from the FTP details screen.
237
-			$plugins = isset( $_REQUEST['checked'] ) ? (array) $_REQUEST['checked'] : array();
238
-			if ( empty( $plugins ) ) {
239
-				wp_redirect( self_admin_url("plugins.php?plugin_status=$status&paged=$page&s=$s") );
237
+			$plugins = isset($_REQUEST['checked']) ? (array) $_REQUEST['checked'] : array();
238
+			if (empty($plugins)) {
239
+				wp_redirect(self_admin_url("plugins.php?plugin_status=$status&paged=$page&s=$s"));
240 240
 				exit;
241 241
 			}
242 242
 
243 243
 			$plugins = array_filter($plugins, 'is_plugin_inactive'); // Do not allow to delete Activated plugins.
244
-			if ( empty( $plugins ) ) {
245
-				wp_redirect( self_admin_url( "plugins.php?error=true&main=true&plugin_status=$status&paged=$page&s=$s" ) );
244
+			if (empty($plugins)) {
245
+				wp_redirect(self_admin_url("plugins.php?error=true&main=true&plugin_status=$status&paged=$page&s=$s"));
246 246
 				exit;
247 247
 			}
248 248
 
249
-			include(ABSPATH . 'wp-admin/update.php');
249
+			include(ABSPATH.'wp-admin/update.php');
250 250
 
251 251
 			$parent_file = 'plugins.php';
252 252
 
253
-			if ( ! isset($_REQUEST['verify-delete']) ) {
253
+			if ( ! isset($_REQUEST['verify-delete'])) {
254 254
 				wp_enqueue_script('jquery');
255
-				require_once(ABSPATH . 'wp-admin/admin-header.php');
255
+				require_once(ABSPATH.'wp-admin/admin-header.php');
256 256
 				?>
257 257
 			<div class="wrap">
258 258
 				<?php
259 259
 					$plugin_info = array();
260 260
 					$have_non_network_plugins = false;
261
-					foreach ( (array) $plugins as $plugin ) {
262
-						$plugin_slug = dirname( $plugin );
263
-
264
-						if ( '.' == $plugin_slug ) {
265
-							if ( $data = get_plugin_data( WP_PLUGIN_DIR . '/' . $plugin ) ) {
266
-								$plugin_info[ $plugin ] = $data;
267
-								$plugin_info[ $plugin ]['is_uninstallable'] = is_uninstallable_plugin( $plugin );
268
-								if ( ! $plugin_info[ $plugin ]['Network'] ) {
261
+					foreach ((array) $plugins as $plugin) {
262
+						$plugin_slug = dirname($plugin);
263
+
264
+						if ('.' == $plugin_slug) {
265
+							if ($data = get_plugin_data(WP_PLUGIN_DIR.'/'.$plugin)) {
266
+								$plugin_info[$plugin] = $data;
267
+								$plugin_info[$plugin]['is_uninstallable'] = is_uninstallable_plugin($plugin);
268
+								if ( ! $plugin_info[$plugin]['Network']) {
269 269
 									$have_non_network_plugins = true;
270 270
 								}
271 271
 							}
272 272
 						} else {
273 273
 							// Get plugins list from that folder.
274
-							if ( $folder_plugins = get_plugins( '/' . $plugin_slug ) ) {
275
-								foreach ( $folder_plugins as $plugin_file => $data ) {
276
-									$plugin_info[ $plugin_file ] = _get_plugin_data_markup_translate( $plugin_file, $data );
277
-									$plugin_info[ $plugin_file ]['is_uninstallable'] = is_uninstallable_plugin( $plugin );
278
-									if ( ! $plugin_info[ $plugin_file ]['Network'] ) {
274
+							if ($folder_plugins = get_plugins('/'.$plugin_slug)) {
275
+								foreach ($folder_plugins as $plugin_file => $data) {
276
+									$plugin_info[$plugin_file] = _get_plugin_data_markup_translate($plugin_file, $data);
277
+									$plugin_info[$plugin_file]['is_uninstallable'] = is_uninstallable_plugin($plugin);
278
+									if ( ! $plugin_info[$plugin_file]['Network']) {
279 279
 										$have_non_network_plugins = true;
280 280
 									}
281 281
 								}
282 282
 							}
283 283
 						}
284 284
 					}
285
-					$plugins_to_delete = count( $plugin_info );
285
+					$plugins_to_delete = count($plugin_info);
286 286
 				?>
287
-				<?php if ( 1 == $plugins_to_delete ) : ?>
288
-					<h1><?php _e( 'Delete Plugin' ); ?></h1>
289
-					<?php if ( $have_non_network_plugins && is_network_admin() ) : ?>
290
-						<div class="error"><p><strong><?php _e( 'Caution:' ); ?></strong> <?php _e( 'This plugin may be active on other sites in the network.' ); ?></p></div>
287
+				<?php if (1 == $plugins_to_delete) : ?>
288
+					<h1><?php _e('Delete Plugin'); ?></h1>
289
+					<?php if ($have_non_network_plugins && is_network_admin()) : ?>
290
+						<div class="error"><p><strong><?php _e('Caution:'); ?></strong> <?php _e('This plugin may be active on other sites in the network.'); ?></p></div>
291 291
 					<?php endif; ?>
292
-					<p><?php _e( 'You are about to remove the following plugin:' ); ?></p>
292
+					<p><?php _e('You are about to remove the following plugin:'); ?></p>
293 293
 				<?php else: ?>
294
-					<h1><?php _e( 'Delete Plugins' ); ?></h1>
295
-					<?php if ( $have_non_network_plugins && is_network_admin() ) : ?>
296
-						<div class="error"><p><strong><?php _e( 'Caution:' ); ?></strong> <?php _e( 'These plugins may be active on other sites in the network.' ); ?></p></div>
294
+					<h1><?php _e('Delete Plugins'); ?></h1>
295
+					<?php if ($have_non_network_plugins && is_network_admin()) : ?>
296
+						<div class="error"><p><strong><?php _e('Caution:'); ?></strong> <?php _e('These plugins may be active on other sites in the network.'); ?></p></div>
297 297
 					<?php endif; ?>
298
-					<p><?php _e( 'You are about to remove the following plugins:' ); ?></p>
298
+					<p><?php _e('You are about to remove the following plugins:'); ?></p>
299 299
 				<?php endif; ?>
300 300
 					<ul class="ul-disc">
301 301
 						<?php
302 302
 						$data_to_delete = false;
303
-						foreach ( $plugin_info as $plugin ) {
304
-							if ( $plugin['is_uninstallable'] ) {
303
+						foreach ($plugin_info as $plugin) {
304
+							if ($plugin['is_uninstallable']) {
305 305
 								/* translators: 1: plugin name, 2: plugin author */
306
-								echo '<li>', sprintf( __( '%1$s by %2$s (will also <strong>delete its data</strong>)' ), '<strong>' . $plugin['Name'] . '</strong>', '<em>' . $plugin['AuthorName'] . '</em>' ), '</li>';
306
+								echo '<li>', sprintf(__('%1$s by %2$s (will also <strong>delete its data</strong>)'), '<strong>'.$plugin['Name'].'</strong>', '<em>'.$plugin['AuthorName'].'</em>'), '</li>';
307 307
 								$data_to_delete = true;
308 308
 							} else {
309 309
 								/* translators: 1: plugin name, 2: plugin author */
310
-								echo '<li>', sprintf( _x('%1$s by %2$s', 'plugin' ), '<strong>' . $plugin['Name'] . '</strong>', '<em>' . $plugin['AuthorName'] ) . '</em>', '</li>';
310
+								echo '<li>', sprintf(_x('%1$s by %2$s', 'plugin'), '<strong>'.$plugin['Name'].'</strong>', '<em>'.$plugin['AuthorName']).'</em>', '</li>';
311 311
 							}
312 312
 						}
313 313
 						?>
314 314
 					</ul>
315 315
 				<p><?php
316
-				if ( $data_to_delete )
316
+				if ($data_to_delete)
317 317
 					_e('Are you sure you wish to delete these files and data?');
318 318
 				else
319 319
 					_e('Are you sure you wish to delete these files?');
@@ -322,50 +322,50 @@  discard block
 block discarded – undo
322 322
 					<input type="hidden" name="verify-delete" value="1" />
323 323
 					<input type="hidden" name="action" value="delete-selected" />
324 324
 					<?php
325
-						foreach ( (array) $plugins as $plugin ) {
326
-							echo '<input type="hidden" name="checked[]" value="' . esc_attr( $plugin ) . '" />';
325
+						foreach ((array) $plugins as $plugin) {
326
+							echo '<input type="hidden" name="checked[]" value="'.esc_attr($plugin).'" />';
327 327
 						}
328 328
 					?>
329 329
 					<?php wp_nonce_field('bulk-plugins') ?>
330
-					<?php submit_button( $data_to_delete ? __( 'Yes, delete these files and data' ) : __( 'Yes, delete these files' ), '', 'submit', false ); ?>
330
+					<?php submit_button($data_to_delete ? __('Yes, delete these files and data') : __('Yes, delete these files'), '', 'submit', false); ?>
331 331
 				</form>
332 332
 				<?php
333 333
 				$referer = wp_get_referer();
334 334
 				?>
335
-				<form method="post" action="<?php echo $referer ? esc_url( $referer ) : ''; ?>" style="display:inline;">
336
-					<?php submit_button( __( 'No, return me to the plugin list' ), '', 'submit', false ); ?>
335
+				<form method="post" action="<?php echo $referer ? esc_url($referer) : ''; ?>" style="display:inline;">
336
+					<?php submit_button(__('No, return me to the plugin list'), '', 'submit', false); ?>
337 337
 				</form>
338 338
 			</div>
339 339
 				<?php
340
-				require_once(ABSPATH . 'wp-admin/admin-footer.php');
340
+				require_once(ABSPATH.'wp-admin/admin-footer.php');
341 341
 				exit;
342 342
 			} else {
343
-				$plugins_to_delete = count( $plugins );
343
+				$plugins_to_delete = count($plugins);
344 344
 			} // endif verify-delete
345 345
 
346
-			$delete_result = delete_plugins( $plugins );
346
+			$delete_result = delete_plugins($plugins);
347 347
 
348
-			set_transient('plugins_delete_result_' . $user_ID, $delete_result); //Store the result in a cache rather than a URL param due to object type & length
349
-			wp_redirect( self_admin_url("plugins.php?deleted=$plugins_to_delete&plugin_status=$status&paged=$page&s=$s") );
348
+			set_transient('plugins_delete_result_'.$user_ID, $delete_result); //Store the result in a cache rather than a URL param due to object type & length
349
+			wp_redirect(self_admin_url("plugins.php?deleted=$plugins_to_delete&plugin_status=$status&paged=$page&s=$s"));
350 350
 			exit;
351 351
 
352 352
 		case 'clear-recent-list':
353
-			if ( ! is_network_admin() ) {
354
-				update_option( 'recently_activated', array() );
353
+			if ( ! is_network_admin()) {
354
+				update_option('recently_activated', array());
355 355
 			} else {
356
-				update_site_option( 'recently_activated', array() );
356
+				update_site_option('recently_activated', array());
357 357
 			}
358 358
 			break;
359 359
 
360 360
 		default:
361
-			if ( isset( $_POST['checked'] ) ) {
361
+			if (isset($_POST['checked'])) {
362 362
 				check_admin_referer('bulk-plugins');
363
-				$plugins = isset( $_POST['checked'] ) ? (array) $_POST['checked'] : array();
363
+				$plugins = isset($_POST['checked']) ? (array) $_POST['checked'] : array();
364 364
 				$sendback = wp_get_referer();
365 365
 
366 366
 				/** This action is documented in wp-admin/edit-comments.php */
367
-				$sendback = apply_filters( 'handle_bulk_actions-' . get_current_screen()->id, $sendback, $action, $plugins );
368
-				wp_safe_redirect( $sendback );
367
+				$sendback = apply_filters('handle_bulk_actions-'.get_current_screen()->id, $sendback, $action, $plugins);
368
+				wp_safe_redirect($sendback);
369 369
 				exit;
370 370
 			}
371 371
 			break;
@@ -378,132 +378,132 @@  discard block
 block discarded – undo
378 378
 wp_enqueue_script('plugin-install');
379 379
 add_thickbox();
380 380
 
381
-add_screen_option( 'per_page', array( 'default' => 999 ) );
381
+add_screen_option('per_page', array('default' => 999));
382 382
 
383
-get_current_screen()->add_help_tab( array(
383
+get_current_screen()->add_help_tab(array(
384 384
 'id'		=> 'overview',
385 385
 'title'		=> __('Overview'),
386 386
 'content'	=>
387
-	'<p>' . __('Plugins extend and expand the functionality of WordPress. Once a plugin is installed, you may activate it or deactivate it here.') . '</p>' .
388
-	'<p>' . __( 'The search for installed plugins will search for terms in their name, description, or author.' ) . ' <span id="live-search-desc" class="hide-if-no-js">' . __( 'The search results will be updated as you type.' ) . '</span></p>' .
389
-	'<p>' . sprintf(
387
+	'<p>'.__('Plugins extend and expand the functionality of WordPress. Once a plugin is installed, you may activate it or deactivate it here.').'</p>'.
388
+	'<p>'.__('The search for installed plugins will search for terms in their name, description, or author.').' <span id="live-search-desc" class="hide-if-no-js">'.__('The search results will be updated as you type.').'</span></p>'.
389
+	'<p>'.sprintf(
390 390
 		/* translators: %s: WordPress Plugin Directory URL */
391
-		__( 'If you would like to see more plugins to choose from, click on the &#8220;Add New&#8221; button and you will be able to browse or search for additional plugins from the <a href="%s">WordPress Plugin Directory</a>. Plugins in the WordPress Plugin Directory are designed and developed by third parties, and are compatible with the license WordPress uses. Oh, and they&#8217;re free!' ),
392
-		__( 'https://wordpress.org/plugins/' )
393
-	) . '</p>'
394
-) );
395
-get_current_screen()->add_help_tab( array(
391
+		__('If you would like to see more plugins to choose from, click on the &#8220;Add New&#8221; button and you will be able to browse or search for additional plugins from the <a href="%s">WordPress Plugin Directory</a>. Plugins in the WordPress Plugin Directory are designed and developed by third parties, and are compatible with the license WordPress uses. Oh, and they&#8217;re free!'),
392
+		__('https://wordpress.org/plugins/')
393
+	).'</p>'
394
+));
395
+get_current_screen()->add_help_tab(array(
396 396
 'id'		=> 'compatibility-problems',
397 397
 'title'		=> __('Troubleshooting'),
398 398
 'content'	=>
399
-	'<p>' . __('Most of the time, plugins play nicely with the core of WordPress and with other plugins. Sometimes, though, a plugin&#8217;s code will get in the way of another plugin, causing compatibility issues. If your site starts doing strange things, this may be the problem. Try deactivating all your plugins and re-activating them in various combinations until you isolate which one(s) caused the issue.') . '</p>' .
400
-	'<p>' . sprintf(
399
+	'<p>'.__('Most of the time, plugins play nicely with the core of WordPress and with other plugins. Sometimes, though, a plugin&#8217;s code will get in the way of another plugin, causing compatibility issues. If your site starts doing strange things, this may be the problem. Try deactivating all your plugins and re-activating them in various combinations until you isolate which one(s) caused the issue.').'</p>'.
400
+	'<p>'.sprintf(
401 401
 		/* translators: WP_PLUGIN_DIR constant value */
402
-		__( 'If something goes wrong with a plugin and you can&#8217;t use WordPress, delete or rename that file in the %s directory and it will be automatically deactivated.' ),
403
-		'<code>' . WP_PLUGIN_DIR . '</code>'
404
-	) . '</p>'
405
-) );
402
+		__('If something goes wrong with a plugin and you can&#8217;t use WordPress, delete or rename that file in the %s directory and it will be automatically deactivated.'),
403
+		'<code>'.WP_PLUGIN_DIR.'</code>'
404
+	).'</p>'
405
+));
406 406
 
407 407
 get_current_screen()->set_help_sidebar(
408
-	'<p><strong>' . __('For more information:') . '</strong></p>' .
409
-	'<p>' . __('<a href="https://codex.wordpress.org/Managing_Plugins#Plugin_Management">Documentation on Managing Plugins</a>') . '</p>' .
410
-	'<p>' . __('<a href="https://wordpress.org/support/">Support Forums</a>') . '</p>'
408
+	'<p><strong>'.__('For more information:').'</strong></p>'.
409
+	'<p>'.__('<a href="https://codex.wordpress.org/Managing_Plugins#Plugin_Management">Documentation on Managing Plugins</a>').'</p>'.
410
+	'<p>'.__('<a href="https://wordpress.org/support/">Support Forums</a>').'</p>'
411 411
 );
412 412
 
413
-get_current_screen()->set_screen_reader_content( array(
414
-	'heading_views'      => __( 'Filter plugins list' ),
415
-	'heading_pagination' => __( 'Plugins list navigation' ),
416
-	'heading_list'       => __( 'Plugins list' ),
417
-) );
413
+get_current_screen()->set_screen_reader_content(array(
414
+	'heading_views'      => __('Filter plugins list'),
415
+	'heading_pagination' => __('Plugins list navigation'),
416
+	'heading_list'       => __('Plugins list'),
417
+));
418 418
 
419 419
 $title = __('Plugins');
420 420
 $parent_file = 'plugins.php';
421 421
 
422
-require_once(ABSPATH . 'wp-admin/admin-header.php');
422
+require_once(ABSPATH.'wp-admin/admin-header.php');
423 423
 
424 424
 $invalid = validate_active_plugins();
425
-if ( ! empty( $invalid ) ) {
426
-	foreach ( $invalid as $plugin_file => $error ) {
425
+if ( ! empty($invalid)) {
426
+	foreach ($invalid as $plugin_file => $error) {
427 427
 		echo '<div id="message" class="error"><p>';
428 428
 		printf(
429 429
 			/* translators: 1: plugin file 2: error message */
430
-			__( 'The plugin %1$s has been <strong>deactivated</strong> due to an error: %2$s' ),
431
-			'<code>' . esc_html( $plugin_file ) . '</code>',
430
+			__('The plugin %1$s has been <strong>deactivated</strong> due to an error: %2$s'),
431
+			'<code>'.esc_html($plugin_file).'</code>',
432 432
 			$error->get_error_message() );
433 433
 		echo '</p></div>';
434 434
 	}
435 435
 }
436 436
 ?>
437 437
 
438
-<?php if ( isset($_GET['error']) ) :
438
+<?php if (isset($_GET['error'])) :
439 439
 
440
-	if ( isset( $_GET['main'] ) )
441
-		$errmsg = __( 'You cannot delete a plugin while it is active on the main site.' );
442
-	elseif ( isset($_GET['charsout']) )
440
+	if (isset($_GET['main']))
441
+		$errmsg = __('You cannot delete a plugin while it is active on the main site.');
442
+	elseif (isset($_GET['charsout']))
443 443
 		$errmsg = sprintf(__('The plugin generated %d characters of <strong>unexpected output</strong> during activation. If you notice &#8220;headers already sent&#8221; messages, problems with syndication feeds or other issues, try deactivating or removing this plugin.'), $_GET['charsout']);
444 444
 	else
445 445
 		$errmsg = __('Plugin could not be activated because it triggered a <strong>fatal error</strong>.');
446 446
 	?>
447 447
 	<div id="message" class="error"><p><?php echo $errmsg; ?></p>
448 448
 	<?php
449
-		if ( ! isset( $_GET['main'] ) && ! isset( $_GET['charsout'] ) && wp_verify_nonce( $_GET['_error_nonce'], 'plugin-activation-error_' . $plugin ) ) {
450
-			$iframe_url = add_query_arg( array(
449
+		if ( ! isset($_GET['main']) && ! isset($_GET['charsout']) && wp_verify_nonce($_GET['_error_nonce'], 'plugin-activation-error_'.$plugin)) {
450
+			$iframe_url = add_query_arg(array(
451 451
 				'action'   => 'error_scrape',
452
-				'plugin'   => urlencode( $plugin ),
453
-				'_wpnonce' => urlencode( $_GET['_error_nonce'] ),
454
-			), admin_url( 'plugins.php' ) );
452
+				'plugin'   => urlencode($plugin),
453
+				'_wpnonce' => urlencode($_GET['_error_nonce']),
454
+			), admin_url('plugins.php'));
455 455
 		?>
456
-		<iframe style="border:0" width="100%" height="70px" src="<?php echo esc_url( $iframe_url ); ?>"></iframe>
456
+		<iframe style="border:0" width="100%" height="70px" src="<?php echo esc_url($iframe_url); ?>"></iframe>
457 457
 	<?php
458 458
 		}
459 459
 	?>
460 460
 	</div>
461
-<?php elseif ( isset($_GET['deleted']) ) :
462
-		$delete_result = get_transient( 'plugins_delete_result_' . $user_ID );
461
+<?php elseif (isset($_GET['deleted'])) :
462
+		$delete_result = get_transient('plugins_delete_result_'.$user_ID);
463 463
 		// Delete it once we're done.
464
-		delete_transient( 'plugins_delete_result_' . $user_ID );
464
+		delete_transient('plugins_delete_result_'.$user_ID);
465 465
 
466
-		if ( is_wp_error($delete_result) ) : ?>
467
-		<div id="message" class="error notice is-dismissible"><p><?php printf( __('Plugin could not be deleted due to an error: %s'), $delete_result->get_error_message() ); ?></p></div>
466
+		if (is_wp_error($delete_result)) : ?>
467
+		<div id="message" class="error notice is-dismissible"><p><?php printf(__('Plugin could not be deleted due to an error: %s'), $delete_result->get_error_message()); ?></p></div>
468 468
 		<?php else : ?>
469 469
 		<div id="message" class="updated notice is-dismissible">
470 470
 			<p>
471 471
 				<?php
472
-				if ( 1 == (int) $_GET['deleted'] ) {
473
-					_e( 'The selected plugin has been <strong>deleted</strong>.' );
472
+				if (1 == (int) $_GET['deleted']) {
473
+					_e('The selected plugin has been <strong>deleted</strong>.');
474 474
 				} else {
475
-					_e( 'The selected plugins have been <strong>deleted</strong>.' );
475
+					_e('The selected plugins have been <strong>deleted</strong>.');
476 476
 				}
477 477
 				?>
478 478
 			</p>
479 479
 		</div>
480 480
 		<?php endif; ?>
481
-<?php elseif ( isset($_GET['activate']) ) : ?>
481
+<?php elseif (isset($_GET['activate'])) : ?>
482 482
 	<div id="message" class="updated notice is-dismissible"><p><?php _e('Plugin <strong>activated</strong>.') ?></p></div>
483 483
 <?php elseif (isset($_GET['activate-multi'])) : ?>
484 484
 	<div id="message" class="updated notice is-dismissible"><p><?php _e('Selected plugins <strong>activated</strong>.'); ?></p></div>
485
-<?php elseif ( isset($_GET['deactivate']) ) : ?>
485
+<?php elseif (isset($_GET['deactivate'])) : ?>
486 486
 	<div id="message" class="updated notice is-dismissible"><p><?php _e('Plugin <strong>deactivated</strong>.') ?></p></div>
487 487
 <?php elseif (isset($_GET['deactivate-multi'])) : ?>
488 488
 	<div id="message" class="updated notice is-dismissible"><p><?php _e('Selected plugins <strong>deactivated</strong>.'); ?></p></div>
489
-<?php elseif ( 'update-selected' == $action ) : ?>
489
+<?php elseif ('update-selected' == $action) : ?>
490 490
 	<div id="message" class="updated notice is-dismissible"><p><?php _e('All selected plugins are up to date.'); ?></p></div>
491 491
 <?php endif; ?>
492 492
 
493 493
 <div class="wrap">
494 494
 <h1 class="wp-heading-inline"><?php
495
-echo esc_html( $title );
495
+echo esc_html($title);
496 496
 ?></h1>
497 497
 
498 498
 <?php
499
-if ( ( ! is_multisite() || is_network_admin() ) && current_user_can('install_plugins') ) { ?>
500
-	<a href="<?php echo self_admin_url( 'plugin-install.php' ); ?>" class="page-title-action"><?php echo esc_html_x( 'Add New', 'plugin' ); ?></a>
499
+if (( ! is_multisite() || is_network_admin()) && current_user_can('install_plugins')) { ?>
500
+	<a href="<?php echo self_admin_url('plugin-install.php'); ?>" class="page-title-action"><?php echo esc_html_x('Add New', 'plugin'); ?></a>
501 501
 <?php
502 502
 }
503 503
 
504
-if ( strlen( $s ) ) {
504
+if (strlen($s)) {
505 505
 	/* translators: %s: search keywords */
506
-	printf( '<span class="subtitle">' . __( 'Search results for &#8220;%s&#8221;' ) . '</span>', esc_html( urldecode( $s ) ) );
506
+	printf('<span class="subtitle">'.__('Search results for &#8220;%s&#8221;').'</span>', esc_html(urldecode($s)));
507 507
 }
508 508
 ?>
509 509
 
@@ -522,13 +522,13 @@  discard block
 block discarded – undo
522 522
  *
523 523
  * @param array $plugins_all An array containing all installed plugins.
524 524
  */
525
-do_action( 'pre_current_active_plugins', $plugins['all'] );
525
+do_action('pre_current_active_plugins', $plugins['all']);
526 526
 ?>
527 527
 
528 528
 <?php $wp_list_table->views(); ?>
529 529
 
530 530
 <form class="search-form search-plugins" method="get">
531
-<?php $wp_list_table->search_box( __( 'Search Installed Plugins' ), 'plugin' ); ?>
531
+<?php $wp_list_table->search_box(__('Search Installed Plugins'), 'plugin'); ?>
532 532
 </form>
533 533
 
534 534
 <form method="post" id="bulk-action-form">
@@ -547,4 +547,4 @@  discard block
 block discarded – undo
547 547
 wp_print_admin_notice_templates();
548 548
 wp_print_update_row_templates();
549 549
 
550
-include(ABSPATH . 'wp-admin/admin-footer.php');
550
+include(ABSPATH.'wp-admin/admin-footer.php');
Please login to merge, or discard this patch.
src/wp-admin/import.php 2 patches
Braces   +8 added lines, -5 removed lines patch added patch discarded remove patch
@@ -73,10 +73,12 @@  discard block
 block discarded – undo
73 73
 
74 74
 // If a popular importer is not registered, create a dummy registration that links to the plugin installer.
75 75
 foreach ( $popular_importers as $pop_importer => $pop_data ) {
76
-	if ( isset( $importers[ $pop_importer ] ) )
77
-		continue;
78
-	if ( isset( $importers[ $pop_data['importer-id'] ] ) )
79
-		continue;
76
+	if ( isset( $importers[ $pop_importer ] ) ) {
77
+			continue;
78
+	}
79
+	if ( isset( $importers[ $pop_data['importer-id'] ] ) ) {
80
+			continue;
81
+	}
80 82
 
81 83
 	// Fill the array of registered (already installed) importers with data of the popular importers from the WordPress.org API.
82 84
 	$importers[ $pop_data['importer-id'] ] = array( $pop_data['name'], $pop_data['description'], 'install' => $pop_data['plugin-slug'] );
@@ -193,8 +195,9 @@  discard block
 block discarded – undo
193 195
 <?php
194 196
 }
195 197
 
196
-if ( current_user_can('install_plugins') )
198
+if ( current_user_can('install_plugins') ) {
197 199
 	echo '<p>' . sprintf( __('If the importer you need is not listed, <a href="%s">search the plugin directory</a> to see if an importer is available.'), esc_url( network_admin_url( 'plugin-install.php?tab=search&type=tag&s=importer' ) ) ) . '</p>';
200
+}
198 201
 ?>
199 202
 
200 203
 </div>
Please login to merge, or discard this patch.
Spacing   +67 added lines, -67 removed lines patch added patch discarded remove patch
@@ -9,28 +9,28 @@  discard block
 block discarded – undo
9 9
 define('WP_LOAD_IMPORTERS', true);
10 10
 
11 11
 /** Load WordPress Bootstrap */
12
-require_once( dirname( __FILE__ ) . '/admin.php' );
12
+require_once(dirname(__FILE__).'/admin.php');
13 13
 
14
-if ( ! current_user_can( 'import' ) ) {
15
-	wp_die( __( 'Sorry, you are not allowed to import content.' ) );
14
+if ( ! current_user_can('import')) {
15
+	wp_die(__('Sorry, you are not allowed to import content.'));
16 16
 }
17 17
 
18 18
 $title = __('Import');
19 19
 
20
-get_current_screen()->add_help_tab( array(
20
+get_current_screen()->add_help_tab(array(
21 21
 	'id'      => 'overview',
22 22
 	'title'   => __('Overview'),
23
-	'content' => '<p>' . __('This screen lists links to plugins to import data from blogging/content management platforms. Choose the platform you want to import from, and click Install Now when you are prompted in the popup window. If your platform is not listed, click the link to search the plugin directory for other importer plugins to see if there is one for your platform.') . '</p>' .
24
-		'<p>' . __('In previous versions of WordPress, all importers were built-in. They have been turned into plugins since most people only use them once or infrequently.') . '</p>',
25
-) );
23
+	'content' => '<p>'.__('This screen lists links to plugins to import data from blogging/content management platforms. Choose the platform you want to import from, and click Install Now when you are prompted in the popup window. If your platform is not listed, click the link to search the plugin directory for other importer plugins to see if there is one for your platform.').'</p>'.
24
+		'<p>'.__('In previous versions of WordPress, all importers were built-in. They have been turned into plugins since most people only use them once or infrequently.').'</p>',
25
+));
26 26
 
27 27
 get_current_screen()->set_help_sidebar(
28
-	'<p><strong>' . __('For more information:') . '</strong></p>' .
29
-	'<p>' . __('<a href="https://codex.wordpress.org/Tools_Import_Screen">Documentation on Import</a>') . '</p>' .
30
-	'<p>' . __('<a href="https://wordpress.org/support/">Support Forums</a>') . '</p>'
28
+	'<p><strong>'.__('For more information:').'</strong></p>'.
29
+	'<p>'.__('<a href="https://codex.wordpress.org/Tools_Import_Screen">Documentation on Import</a>').'</p>'.
30
+	'<p>'.__('<a href="https://wordpress.org/support/">Support Forums</a>').'</p>'
31 31
 );
32 32
 
33
-if ( current_user_can( 'install_plugins' ) ) {
33
+if (current_user_can('install_plugins')) {
34 34
 	// List of popular importer plugins from the WordPress.org API.
35 35
 	$popular_importers = wp_get_popular_importers();
36 36
 } else {
@@ -38,30 +38,30 @@  discard block
 block discarded – undo
38 38
 }
39 39
 
40 40
 // Detect and redirect invalid importers like 'movabletype', which is registered as 'mt'
41
-if ( ! empty( $_GET['invalid'] ) && isset( $popular_importers[ $_GET['invalid'] ] ) ) {
42
-	$importer_id = $popular_importers[ $_GET['invalid'] ]['importer-id'];
43
-	if ( $importer_id != $_GET['invalid'] ) { // Prevent redirect loops.
44
-		wp_redirect( admin_url( 'admin.php?import=' . $importer_id ) );
41
+if ( ! empty($_GET['invalid']) && isset($popular_importers[$_GET['invalid']])) {
42
+	$importer_id = $popular_importers[$_GET['invalid']]['importer-id'];
43
+	if ($importer_id != $_GET['invalid']) { // Prevent redirect loops.
44
+		wp_redirect(admin_url('admin.php?import='.$importer_id));
45 45
 		exit;
46 46
 	}
47
-	unset( $importer_id );
47
+	unset($importer_id);
48 48
 }
49 49
 
50 50
 add_thickbox();
51
-wp_enqueue_script( 'plugin-install' );
52
-wp_enqueue_script( 'updates' );
51
+wp_enqueue_script('plugin-install');
52
+wp_enqueue_script('updates');
53 53
 
54
-require_once( ABSPATH . 'wp-admin/admin-header.php' );
54
+require_once(ABSPATH.'wp-admin/admin-header.php');
55 55
 $parent_file = 'tools.php';
56 56
 ?>
57 57
 
58 58
 <div class="wrap">
59
-<h1><?php echo esc_html( $title ); ?></h1>
60
-<?php if ( ! empty( $_GET['invalid'] ) ) : ?>
59
+<h1><?php echo esc_html($title); ?></h1>
60
+<?php if ( ! empty($_GET['invalid'])) : ?>
61 61
 	<div class="error">
62
-		<p><strong><?php _e( 'ERROR:' ); ?></strong> <?php
62
+		<p><strong><?php _e('ERROR:'); ?></strong> <?php
63 63
 			/* translators: %s: importer slug */
64
-			printf( __( 'The %s importer is invalid or is not installed.' ), '<strong>' . esc_html( $_GET['invalid'] ) . '</strong>' );
64
+			printf(__('The %s importer is invalid or is not installed.'), '<strong>'.esc_html($_GET['invalid']).'</strong>');
65 65
 		?></p>
66 66
 	</div>
67 67
 <?php endif; ?>
@@ -72,108 +72,108 @@  discard block
 block discarded – undo
72 72
 $importers = get_importers();
73 73
 
74 74
 // If a popular importer is not registered, create a dummy registration that links to the plugin installer.
75
-foreach ( $popular_importers as $pop_importer => $pop_data ) {
76
-	if ( isset( $importers[ $pop_importer ] ) )
75
+foreach ($popular_importers as $pop_importer => $pop_data) {
76
+	if (isset($importers[$pop_importer]))
77 77
 		continue;
78
-	if ( isset( $importers[ $pop_data['importer-id'] ] ) )
78
+	if (isset($importers[$pop_data['importer-id']]))
79 79
 		continue;
80 80
 
81 81
 	// Fill the array of registered (already installed) importers with data of the popular importers from the WordPress.org API.
82
-	$importers[ $pop_data['importer-id'] ] = array( $pop_data['name'], $pop_data['description'], 'install' => $pop_data['plugin-slug'] );
82
+	$importers[$pop_data['importer-id']] = array($pop_data['name'], $pop_data['description'], 'install' => $pop_data['plugin-slug']);
83 83
 }
84 84
 
85
-if ( empty( $importers ) ) {
86
-	echo '<p>' . __('No importers are available.') . '</p>'; // TODO: make more helpful
85
+if (empty($importers)) {
86
+	echo '<p>'.__('No importers are available.').'</p>'; // TODO: make more helpful
87 87
 } else {
88
-	uasort( $importers, '_usort_by_first_member' );
88
+	uasort($importers, '_usort_by_first_member');
89 89
 ?>
90 90
 <table class="widefat importers striped">
91 91
 
92 92
 	<?php
93
-	foreach ( $importers as $importer_id => $data ) {
93
+	foreach ($importers as $importer_id => $data) {
94 94
 		$plugin_slug = $action = '';
95 95
 		$is_plugin_installed = false;
96 96
 
97
-		if ( isset( $data['install'] ) ) {
97
+		if (isset($data['install'])) {
98 98
 			$plugin_slug = $data['install'];
99 99
 
100
-			if ( file_exists( WP_PLUGIN_DIR . '/' . $plugin_slug ) ) {
100
+			if (file_exists(WP_PLUGIN_DIR.'/'.$plugin_slug)) {
101 101
 				// Looks like an importer is installed, but not active.
102
-				$plugins = get_plugins( '/' . $plugin_slug );
103
-				if ( ! empty( $plugins ) ) {
104
-					$keys = array_keys( $plugins );
105
-					$plugin_file = $plugin_slug . '/' . $keys[0];
106
-					$url = wp_nonce_url( add_query_arg( array(
102
+				$plugins = get_plugins('/'.$plugin_slug);
103
+				if ( ! empty($plugins)) {
104
+					$keys = array_keys($plugins);
105
+					$plugin_file = $plugin_slug.'/'.$keys[0];
106
+					$url = wp_nonce_url(add_query_arg(array(
107 107
 						'action' => 'activate',
108 108
 						'plugin' => $plugin_file,
109 109
 						'from'   => 'import',
110
-					), admin_url( 'plugins.php' ) ), 'activate-plugin_' . $plugin_file );
110
+					), admin_url('plugins.php')), 'activate-plugin_'.$plugin_file);
111 111
 					$action = sprintf(
112 112
 						'<a href="%s" aria-label="%s">%s</a>',
113
-						esc_url( $url ),
113
+						esc_url($url),
114 114
 						/* translators: %s: Importer name */
115
-						esc_attr( sprintf( __( 'Run %s' ), $data[0] ) ),
116
-						__( 'Run Importer' )
115
+						esc_attr(sprintf(__('Run %s'), $data[0])),
116
+						__('Run Importer')
117 117
 					);
118 118
 
119 119
 					$is_plugin_installed = true;
120 120
 				}
121 121
 			}
122 122
 
123
-			if ( empty( $action ) ) {
124
-				if ( is_main_site() ) {
125
-					$url = wp_nonce_url( add_query_arg( array(
123
+			if (empty($action)) {
124
+				if (is_main_site()) {
125
+					$url = wp_nonce_url(add_query_arg(array(
126 126
 						'action' => 'install-plugin',
127 127
 						'plugin' => $plugin_slug,
128 128
 						'from'   => 'import',
129
-					), self_admin_url( 'update.php' ) ), 'install-plugin_' . $plugin_slug );
129
+					), self_admin_url('update.php')), 'install-plugin_'.$plugin_slug);
130 130
 					$action = sprintf(
131 131
 						'<a href="%1$s" class="install-now" data-slug="%2$s" data-name="%3$s" aria-label="%4$s">%5$s</a>',
132
-						esc_url( $url ),
133
-						esc_attr( $plugin_slug ),
134
-						esc_attr( $data[0] ),
132
+						esc_url($url),
133
+						esc_attr($plugin_slug),
134
+						esc_attr($data[0]),
135 135
 						/* translators: %s: Importer name */
136
-						esc_attr( sprintf( __( 'Install %s' ), $data[0] ) ),
137
-						__( 'Install Now' )
136
+						esc_attr(sprintf(__('Install %s'), $data[0])),
137
+						__('Install Now')
138 138
 					);
139 139
 				} else {
140 140
 					$action = sprintf(
141 141
 						/* translators: URL to wp-admin/import.php */
142
-						__( 'This importer is not installed. Please install importers from <a href="%s">the main site</a>.' ),
143
-						get_admin_url( get_current_network_id(), 'import.php' )
142
+						__('This importer is not installed. Please install importers from <a href="%s">the main site</a>.'),
143
+						get_admin_url(get_current_network_id(), 'import.php')
144 144
 					);
145 145
 				}
146 146
 			}
147 147
 		} else {
148
-			$url = add_query_arg( array(
148
+			$url = add_query_arg(array(
149 149
 				'import' => $importer_id,
150
-			), self_admin_url( 'admin.php' ) );
150
+			), self_admin_url('admin.php'));
151 151
 			$action = sprintf(
152 152
 				'<a href="%1$s" aria-label="%2$s">%3$s</a>',
153
-				esc_url( $url ),
153
+				esc_url($url),
154 154
 				/* translators: %s: Importer name */
155
-				esc_attr( sprintf( __( 'Run %s' ), $data[0] ) ),
156
-				__( 'Run Importer' )
155
+				esc_attr(sprintf(__('Run %s'), $data[0])),
156
+				__('Run Importer')
157 157
 			);
158 158
 
159 159
 			$is_plugin_installed = true;
160 160
 		}
161 161
 
162
-		if ( ! $is_plugin_installed && is_main_site() ) {
163
-			$url = add_query_arg( array(
162
+		if ( ! $is_plugin_installed && is_main_site()) {
163
+			$url = add_query_arg(array(
164 164
 				'tab'       => 'plugin-information',
165 165
 				'plugin'    => $plugin_slug,
166 166
 				'from'      => 'import',
167 167
 				'TB_iframe' => 'true',
168 168
 				'width'     => 600,
169 169
 				'height'    => 550,
170
-			), network_admin_url( 'plugin-install.php' ) );
170
+			), network_admin_url('plugin-install.php'));
171 171
 			$action .= sprintf(
172 172
 				' | <a href="%1$s" class="thickbox open-plugin-details-modal" aria-label="%2$s">%3$s</a>',
173
-				esc_url( $url ),
173
+				esc_url($url),
174 174
 				/* translators: %s: Importer name */
175
-				esc_attr( sprintf( __( 'More information about %s' ), $data[0] ) ),
176
-				__( 'Details' )
175
+				esc_attr(sprintf(__('More information about %s'), $data[0])),
176
+				__('Details')
177 177
 			);
178 178
 		}
179 179
 
@@ -193,8 +193,8 @@  discard block
 block discarded – undo
193 193
 <?php
194 194
 }
195 195
 
196
-if ( current_user_can('install_plugins') )
197
-	echo '<p>' . sprintf( __('If the importer you need is not listed, <a href="%s">search the plugin directory</a> to see if an importer is available.'), esc_url( network_admin_url( 'plugin-install.php?tab=search&type=tag&s=importer' ) ) ) . '</p>';
196
+if (current_user_can('install_plugins'))
197
+	echo '<p>'.sprintf(__('If the importer you need is not listed, <a href="%s">search the plugin directory</a> to see if an importer is available.'), esc_url(network_admin_url('plugin-install.php?tab=search&type=tag&s=importer'))).'</p>';
198 198
 ?>
199 199
 
200 200
 </div>
@@ -203,4 +203,4 @@  discard block
 block discarded – undo
203 203
 wp_print_request_filesystem_credentials_modal();
204 204
 wp_print_admin_notice_templates();
205 205
 
206
-include( ABSPATH . 'wp-admin/admin-footer.php' );
206
+include(ABSPATH.'wp-admin/admin-footer.php');
Please login to merge, or discard this patch.
src/wp-admin/media.php 3 patches
Braces   +24 added lines, -13 removed lines patch added patch discarded remove patch
@@ -19,16 +19,18 @@  discard block
 block discarded – undo
19 19
 	$attachment_id = (int) $_POST['attachment_id'];
20 20
 	check_admin_referer('media-form');
21 21
 
22
-	if ( !current_user_can('edit_post', $attachment_id) )
23
-		wp_die ( __('Sorry, you are not allowed to edit this attachment.') );
22
+	if ( !current_user_can('edit_post', $attachment_id) ) {
23
+			wp_die ( __('Sorry, you are not allowed to edit this attachment.') );
24
+	}
24 25
 
25 26
 	$errors = media_upload_form_handler();
26 27
 
27 28
 	if ( empty($errors) ) {
28 29
 		$location = 'media.php';
29 30
 		if ( $referer = wp_get_original_referer() ) {
30
-			if ( false !== strpos($referer, 'upload.php') || ( url_to_postid($referer) == $attachment_id )  )
31
-				$location = $referer;
31
+			if ( false !== strpos($referer, 'upload.php') || ( url_to_postid($referer) == $attachment_id )  ) {
32
+							$location = $referer;
33
+			}
32 34
 		}
33 35
 		if ( false !== strpos($location, 'upload.php') ) {
34 36
 			$location = remove_query_arg('message', $location);
@@ -44,8 +46,9 @@  discard block
 block discarded – undo
44 46
 case 'edit' :
45 47
 	$title = __('Edit Media');
46 48
 
47
-	if ( empty($errors) )
48
-		$errors = null;
49
+	if ( empty($errors) ) {
50
+			$errors = null;
51
+	}
49 52
 
50 53
 	if ( empty( $_GET['attachment_id'] ) ) {
51 54
 		wp_redirect( admin_url('upload.php') );
@@ -53,14 +56,21 @@  discard block
 block discarded – undo
53 56
 	}
54 57
 	$att_id = (int) $_GET['attachment_id'];
55 58
 
56
-	if ( !current_user_can('edit_post', $att_id) )
57
-		wp_die ( __('Sorry, you are not allowed to edit this attachment.') );
59
+	if ( !current_user_can('edit_post', $att_id) ) {
60
+			wp_die ( __('Sorry, you are not allowed to edit this attachment.') );
61
+	}
58 62
 
59 63
 	$att = get_post($att_id);
60 64
 
61
-	if ( empty($att->ID) ) wp_die( __('You attempted to edit an attachment that doesn&#8217;t exist. Perhaps it was deleted?') );
62
-	if ( 'attachment' !== $att->post_type ) wp_die( __('You attempted to edit an item that isn&#8217;t an attachment. Please go back and try again.') );
63
-	if ( $att->post_status == 'trash' ) wp_die( __('You can&#8217;t edit this attachment because it is in the Trash. Please move it out of the Trash and try again.') );
65
+	if ( empty($att->ID) ) {
66
+		wp_die( __('You attempted to edit an attachment that doesn&#8217;t exist. Perhaps it was deleted?') );
67
+	}
68
+	if ( 'attachment' !== $att->post_type ) {
69
+		wp_die( __('You attempted to edit an item that isn&#8217;t an attachment. Please go back and try again.') );
70
+	}
71
+	if ( $att->post_status == 'trash' ) {
72
+		wp_die( __('You can&#8217;t edit this attachment because it is in the Trash. Please move it out of the Trash and try again.') );
73
+	}
64 74
 
65 75
 	add_filter('attachment_fields_to_edit', 'media_single_attachment_fields_to_edit', 10, 2);
66 76
 
@@ -97,8 +107,9 @@  discard block
 block discarded – undo
97 107
 				break;
98 108
 		}
99 109
 	}
100
-	if ( $message )
101
-		echo "<div id='message' class='$class'><p>$message</p></div>\n";
110
+	if ( $message ) {
111
+			echo "<div id='message' class='$class'><p>$message</p></div>\n";
112
+	}
102 113
 
103 114
 ?>
104 115
 
Please login to merge, or discard this patch.
Switch Indentation   +76 added lines, -76 removed lines patch added patch discarded remove patch
@@ -15,87 +15,87 @@  discard block
 block discarded – undo
15 15
 wp_reset_vars(array('action'));
16 16
 
17 17
 switch ( $action ) {
18
-case 'editattachment' :
19
-	$attachment_id = (int) $_POST['attachment_id'];
20
-	check_admin_referer('media-form');
21
-
22
-	if ( !current_user_can('edit_post', $attachment_id) )
23
-		wp_die ( __('Sorry, you are not allowed to edit this attachment.') );
24
-
25
-	$errors = media_upload_form_handler();
26
-
27
-	if ( empty($errors) ) {
28
-		$location = 'media.php';
29
-		if ( $referer = wp_get_original_referer() ) {
30
-			if ( false !== strpos($referer, 'upload.php') || ( url_to_postid($referer) == $attachment_id )  )
31
-				$location = $referer;
32
-		}
33
-		if ( false !== strpos($location, 'upload.php') ) {
34
-			$location = remove_query_arg('message', $location);
35
-			$location = add_query_arg('posted',	$attachment_id, $location);
36
-		} elseif ( false !== strpos($location, 'media.php') ) {
37
-			$location = add_query_arg('message', 'updated', $location);
18
+	case 'editattachment' :
19
+		$attachment_id = (int) $_POST['attachment_id'];
20
+		check_admin_referer('media-form');
21
+
22
+		if ( !current_user_can('edit_post', $attachment_id) )
23
+			wp_die ( __('Sorry, you are not allowed to edit this attachment.') );
24
+
25
+		$errors = media_upload_form_handler();
26
+
27
+		if ( empty($errors) ) {
28
+			$location = 'media.php';
29
+			if ( $referer = wp_get_original_referer() ) {
30
+				if ( false !== strpos($referer, 'upload.php') || ( url_to_postid($referer) == $attachment_id )  )
31
+					$location = $referer;
32
+			}
33
+			if ( false !== strpos($location, 'upload.php') ) {
34
+				$location = remove_query_arg('message', $location);
35
+				$location = add_query_arg('posted',	$attachment_id, $location);
36
+			} elseif ( false !== strpos($location, 'media.php') ) {
37
+				$location = add_query_arg('message', 'updated', $location);
38
+			}
39
+			wp_redirect($location);
40
+			exit;
38 41
 		}
39
-		wp_redirect($location);
40
-		exit;
41
-	}
42 42
 
43
-	// No break.
44
-case 'edit' :
45
-	$title = __('Edit Media');
43
+		// No break.
44
+	case 'edit' :
45
+		$title = __('Edit Media');
46 46
 
47
-	if ( empty($errors) )
48
-		$errors = null;
47
+		if ( empty($errors) )
48
+			$errors = null;
49 49
 
50
-	if ( empty( $_GET['attachment_id'] ) ) {
51
-		wp_redirect( admin_url('upload.php') );
52
-		exit();
53
-	}
54
-	$att_id = (int) $_GET['attachment_id'];
55
-
56
-	if ( !current_user_can('edit_post', $att_id) )
57
-		wp_die ( __('Sorry, you are not allowed to edit this attachment.') );
58
-
59
-	$att = get_post($att_id);
60
-
61
-	if ( empty($att->ID) ) wp_die( __('You attempted to edit an attachment that doesn&#8217;t exist. Perhaps it was deleted?') );
62
-	if ( 'attachment' !== $att->post_type ) wp_die( __('You attempted to edit an item that isn&#8217;t an attachment. Please go back and try again.') );
63
-	if ( $att->post_status == 'trash' ) wp_die( __('You can&#8217;t edit this attachment because it is in the Trash. Please move it out of the Trash and try again.') );
64
-
65
-	add_filter('attachment_fields_to_edit', 'media_single_attachment_fields_to_edit', 10, 2);
66
-
67
-	wp_enqueue_script( 'wp-ajax-response' );
68
-	wp_enqueue_script('image-edit');
69
-	wp_enqueue_style('imgareaselect');
70
-
71
-	get_current_screen()->add_help_tab( array(
72
-		'id'      => 'overview',
73
-		'title'   => __('Overview'),
74
-		'content' =>
75
-			'<p>' . __('This screen allows you to edit five fields for metadata in a file within the media library.') . '</p>' .
76
-			'<p>' . __('For images only, you can click on Edit Image under the thumbnail to expand out an inline image editor with icons for cropping, rotating, or flipping the image as well as for undoing and redoing. The boxes on the right give you more options for scaling the image, for cropping it, and for cropping the thumbnail in a different way than you crop the original image. You can click on Help in those boxes to get more information.') . '</p>' .
77
-			'<p>' . __('Note that you crop the image by clicking on it (the Crop icon is already selected) and dragging the cropping frame to select the desired part. Then click Save to retain the cropping.') . '</p>' .
78
-			'<p>' . __('Remember to click Update Media to save metadata entered or changed.') . '</p>'
79
-	) );
80
-
81
-	get_current_screen()->set_help_sidebar(
82
-	'<p><strong>' . __('For more information:') . '</strong></p>' .
83
-	'<p>' . __('<a href="https://codex.wordpress.org/Media_Add_New_Screen#Edit_Media">Documentation on Edit Media</a>') . '</p>' .
84
-	'<p>' . __('<a href="https://wordpress.org/support/">Support Forums</a>') . '</p>'
85
-	);
86
-
87
-	require( ABSPATH . 'wp-admin/admin-header.php' );
88
-
89
-	$parent_file = 'upload.php';
90
-	$message = '';
91
-	$class = '';
92
-	if ( isset($_GET['message']) ) {
93
-		switch ( $_GET['message'] ) {
50
+		if ( empty( $_GET['attachment_id'] ) ) {
51
+			wp_redirect( admin_url('upload.php') );
52
+			exit();
53
+		}
54
+		$att_id = (int) $_GET['attachment_id'];
55
+
56
+		if ( !current_user_can('edit_post', $att_id) )
57
+			wp_die ( __('Sorry, you are not allowed to edit this attachment.') );
58
+
59
+		$att = get_post($att_id);
60
+
61
+		if ( empty($att->ID) ) wp_die( __('You attempted to edit an attachment that doesn&#8217;t exist. Perhaps it was deleted?') );
62
+		if ( 'attachment' !== $att->post_type ) wp_die( __('You attempted to edit an item that isn&#8217;t an attachment. Please go back and try again.') );
63
+		if ( $att->post_status == 'trash' ) wp_die( __('You can&#8217;t edit this attachment because it is in the Trash. Please move it out of the Trash and try again.') );
64
+
65
+		add_filter('attachment_fields_to_edit', 'media_single_attachment_fields_to_edit', 10, 2);
66
+
67
+		wp_enqueue_script( 'wp-ajax-response' );
68
+		wp_enqueue_script('image-edit');
69
+		wp_enqueue_style('imgareaselect');
70
+
71
+		get_current_screen()->add_help_tab( array(
72
+			'id'      => 'overview',
73
+			'title'   => __('Overview'),
74
+			'content' =>
75
+				'<p>' . __('This screen allows you to edit five fields for metadata in a file within the media library.') . '</p>' .
76
+				'<p>' . __('For images only, you can click on Edit Image under the thumbnail to expand out an inline image editor with icons for cropping, rotating, or flipping the image as well as for undoing and redoing. The boxes on the right give you more options for scaling the image, for cropping it, and for cropping the thumbnail in a different way than you crop the original image. You can click on Help in those boxes to get more information.') . '</p>' .
77
+				'<p>' . __('Note that you crop the image by clicking on it (the Crop icon is already selected) and dragging the cropping frame to select the desired part. Then click Save to retain the cropping.') . '</p>' .
78
+				'<p>' . __('Remember to click Update Media to save metadata entered or changed.') . '</p>'
79
+		) );
80
+
81
+		get_current_screen()->set_help_sidebar(
82
+		'<p><strong>' . __('For more information:') . '</strong></p>' .
83
+		'<p>' . __('<a href="https://codex.wordpress.org/Media_Add_New_Screen#Edit_Media">Documentation on Edit Media</a>') . '</p>' .
84
+		'<p>' . __('<a href="https://wordpress.org/support/">Support Forums</a>') . '</p>'
85
+		);
86
+
87
+		require( ABSPATH . 'wp-admin/admin-header.php' );
88
+
89
+		$parent_file = 'upload.php';
90
+		$message = '';
91
+		$class = '';
92
+		if ( isset($_GET['message']) ) {
93
+			switch ( $_GET['message'] ) {
94 94
 			case 'updated' :
95 95
 				$message = __('Media file updated.');
96 96
 				$class = 'updated';
97 97
 				break;
98
-		}
98
+			}
99 99
 	}
100 100
 	if ( $message )
101 101
 		echo "<div id='message' class='$class'><p>$message</p></div>\n";
@@ -142,8 +142,8 @@  discard block
 block discarded – undo
142 142
 
143 143
 	exit;
144 144
 
145
-default:
146
-	wp_redirect( admin_url('upload.php') );
147
-	exit;
145
+	default:
146
+		wp_redirect( admin_url('upload.php') );
147
+		exit;
148 148
 
149 149
 }
Please login to merge, or discard this patch.
Spacing   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -7,33 +7,33 @@  discard block
 block discarded – undo
7 7
  */
8 8
 
9 9
 /** Load WordPress Administration Bootstrap */
10
-require_once( dirname( __FILE__ ) . '/admin.php' );
10
+require_once(dirname(__FILE__).'/admin.php');
11 11
 
12 12
 $parent_file = 'upload.php';
13 13
 $submenu_file = 'upload.php';
14 14
 
15 15
 wp_reset_vars(array('action'));
16 16
 
17
-switch ( $action ) {
17
+switch ($action) {
18 18
 case 'editattachment' :
19 19
 	$attachment_id = (int) $_POST['attachment_id'];
20 20
 	check_admin_referer('media-form');
21 21
 
22
-	if ( !current_user_can('edit_post', $attachment_id) )
23
-		wp_die ( __('Sorry, you are not allowed to edit this attachment.') );
22
+	if ( ! current_user_can('edit_post', $attachment_id))
23
+		wp_die(__('Sorry, you are not allowed to edit this attachment.'));
24 24
 
25 25
 	$errors = media_upload_form_handler();
26 26
 
27
-	if ( empty($errors) ) {
27
+	if (empty($errors)) {
28 28
 		$location = 'media.php';
29
-		if ( $referer = wp_get_original_referer() ) {
30
-			if ( false !== strpos($referer, 'upload.php') || ( url_to_postid($referer) == $attachment_id )  )
29
+		if ($referer = wp_get_original_referer()) {
30
+			if (false !== strpos($referer, 'upload.php') || (url_to_postid($referer) == $attachment_id))
31 31
 				$location = $referer;
32 32
 		}
33
-		if ( false !== strpos($location, 'upload.php') ) {
33
+		if (false !== strpos($location, 'upload.php')) {
34 34
 			$location = remove_query_arg('message', $location);
35
-			$location = add_query_arg('posted',	$attachment_id, $location);
36
-		} elseif ( false !== strpos($location, 'media.php') ) {
35
+			$location = add_query_arg('posted', $attachment_id, $location);
36
+		} elseif (false !== strpos($location, 'media.php')) {
37 37
 			$location = add_query_arg('message', 'updated', $location);
38 38
 		}
39 39
 		wp_redirect($location);
@@ -44,71 +44,71 @@  discard block
 block discarded – undo
44 44
 case 'edit' :
45 45
 	$title = __('Edit Media');
46 46
 
47
-	if ( empty($errors) )
47
+	if (empty($errors))
48 48
 		$errors = null;
49 49
 
50
-	if ( empty( $_GET['attachment_id'] ) ) {
51
-		wp_redirect( admin_url('upload.php') );
50
+	if (empty($_GET['attachment_id'])) {
51
+		wp_redirect(admin_url('upload.php'));
52 52
 		exit();
53 53
 	}
54 54
 	$att_id = (int) $_GET['attachment_id'];
55 55
 
56
-	if ( !current_user_can('edit_post', $att_id) )
57
-		wp_die ( __('Sorry, you are not allowed to edit this attachment.') );
56
+	if ( ! current_user_can('edit_post', $att_id))
57
+		wp_die(__('Sorry, you are not allowed to edit this attachment.'));
58 58
 
59 59
 	$att = get_post($att_id);
60 60
 
61
-	if ( empty($att->ID) ) wp_die( __('You attempted to edit an attachment that doesn&#8217;t exist. Perhaps it was deleted?') );
62
-	if ( 'attachment' !== $att->post_type ) wp_die( __('You attempted to edit an item that isn&#8217;t an attachment. Please go back and try again.') );
63
-	if ( $att->post_status == 'trash' ) wp_die( __('You can&#8217;t edit this attachment because it is in the Trash. Please move it out of the Trash and try again.') );
61
+	if (empty($att->ID)) wp_die(__('You attempted to edit an attachment that doesn&#8217;t exist. Perhaps it was deleted?'));
62
+	if ('attachment' !== $att->post_type) wp_die(__('You attempted to edit an item that isn&#8217;t an attachment. Please go back and try again.'));
63
+	if ($att->post_status == 'trash') wp_die(__('You can&#8217;t edit this attachment because it is in the Trash. Please move it out of the Trash and try again.'));
64 64
 
65 65
 	add_filter('attachment_fields_to_edit', 'media_single_attachment_fields_to_edit', 10, 2);
66 66
 
67
-	wp_enqueue_script( 'wp-ajax-response' );
67
+	wp_enqueue_script('wp-ajax-response');
68 68
 	wp_enqueue_script('image-edit');
69 69
 	wp_enqueue_style('imgareaselect');
70 70
 
71
-	get_current_screen()->add_help_tab( array(
71
+	get_current_screen()->add_help_tab(array(
72 72
 		'id'      => 'overview',
73 73
 		'title'   => __('Overview'),
74 74
 		'content' =>
75
-			'<p>' . __('This screen allows you to edit five fields for metadata in a file within the media library.') . '</p>' .
76
-			'<p>' . __('For images only, you can click on Edit Image under the thumbnail to expand out an inline image editor with icons for cropping, rotating, or flipping the image as well as for undoing and redoing. The boxes on the right give you more options for scaling the image, for cropping it, and for cropping the thumbnail in a different way than you crop the original image. You can click on Help in those boxes to get more information.') . '</p>' .
77
-			'<p>' . __('Note that you crop the image by clicking on it (the Crop icon is already selected) and dragging the cropping frame to select the desired part. Then click Save to retain the cropping.') . '</p>' .
78
-			'<p>' . __('Remember to click Update Media to save metadata entered or changed.') . '</p>'
79
-	) );
75
+			'<p>'.__('This screen allows you to edit five fields for metadata in a file within the media library.').'</p>'.
76
+			'<p>'.__('For images only, you can click on Edit Image under the thumbnail to expand out an inline image editor with icons for cropping, rotating, or flipping the image as well as for undoing and redoing. The boxes on the right give you more options for scaling the image, for cropping it, and for cropping the thumbnail in a different way than you crop the original image. You can click on Help in those boxes to get more information.').'</p>'.
77
+			'<p>'.__('Note that you crop the image by clicking on it (the Crop icon is already selected) and dragging the cropping frame to select the desired part. Then click Save to retain the cropping.').'</p>'.
78
+			'<p>'.__('Remember to click Update Media to save metadata entered or changed.').'</p>'
79
+	));
80 80
 
81 81
 	get_current_screen()->set_help_sidebar(
82
-	'<p><strong>' . __('For more information:') . '</strong></p>' .
83
-	'<p>' . __('<a href="https://codex.wordpress.org/Media_Add_New_Screen#Edit_Media">Documentation on Edit Media</a>') . '</p>' .
84
-	'<p>' . __('<a href="https://wordpress.org/support/">Support Forums</a>') . '</p>'
82
+	'<p><strong>'.__('For more information:').'</strong></p>'.
83
+	'<p>'.__('<a href="https://codex.wordpress.org/Media_Add_New_Screen#Edit_Media">Documentation on Edit Media</a>').'</p>'.
84
+	'<p>'.__('<a href="https://wordpress.org/support/">Support Forums</a>').'</p>'
85 85
 	);
86 86
 
87
-	require( ABSPATH . 'wp-admin/admin-header.php' );
87
+	require(ABSPATH.'wp-admin/admin-header.php');
88 88
 
89 89
 	$parent_file = 'upload.php';
90 90
 	$message = '';
91 91
 	$class = '';
92
-	if ( isset($_GET['message']) ) {
93
-		switch ( $_GET['message'] ) {
92
+	if (isset($_GET['message'])) {
93
+		switch ($_GET['message']) {
94 94
 			case 'updated' :
95 95
 				$message = __('Media file updated.');
96 96
 				$class = 'updated';
97 97
 				break;
98 98
 		}
99 99
 	}
100
-	if ( $message )
100
+	if ($message)
101 101
 		echo "<div id='message' class='$class'><p>$message</p></div>\n";
102 102
 
103 103
 ?>
104 104
 
105 105
 <div class="wrap">
106 106
 <h1 class="wp-heading-inline"><?php
107
-echo esc_html( $title );
107
+echo esc_html($title);
108 108
 ?></h1>
109 109
 
110 110
 <?php
111
-if ( current_user_can( 'upload_files' ) ) { ?>
111
+if (current_user_can('upload_files')) { ?>
112 112
 	<a href="media-new.php" class="page-title-action"><?php echo esc_html_x('Add New', 'file'); ?></a>
113 113
 <?php } ?>
114 114
 
@@ -116,16 +116,16 @@  discard block
 block discarded – undo
116 116
 
117 117
 <form method="post" class="media-upload-form" id="media-single-form">
118 118
 <p class="submit" style="padding-bottom: 0;">
119
-<?php submit_button( __( 'Update Media' ), 'primary', 'save', false ); ?>
119
+<?php submit_button(__('Update Media'), 'primary', 'save', false); ?>
120 120
 </p>
121 121
 
122 122
 <div class="media-single">
123 123
 <div id="media-item-<?php echo $att_id; ?>" class="media-item">
124
-<?php echo get_media_item( $att_id, array( 'toggle' => false, 'send' => false, 'delete' => false, 'show_title' => false, 'errors' => !empty($errors[$att_id]) ? $errors[$att_id] : null ) ); ?>
124
+<?php echo get_media_item($att_id, array('toggle' => false, 'send' => false, 'delete' => false, 'show_title' => false, 'errors' => ! empty($errors[$att_id]) ? $errors[$att_id] : null)); ?>
125 125
 </div>
126 126
 </div>
127 127
 
128
-<?php submit_button( __( 'Update Media' ), 'primary', 'save' ); ?>
128
+<?php submit_button(__('Update Media'), 'primary', 'save'); ?>
129 129
 <input type="hidden" name="post_id" id="post_id" value="<?php echo isset($post_id) ? esc_attr($post_id) : ''; ?>" />
130 130
 <input type="hidden" name="attachment_id" id="attachment_id" value="<?php echo esc_attr($att_id); ?>" />
131 131
 <input type="hidden" name="action" value="editattachment" />
@@ -138,12 +138,12 @@  discard block
 block discarded – undo
138 138
 
139 139
 <?php
140 140
 
141
-	require( ABSPATH . 'wp-admin/admin-footer.php' );
141
+	require(ABSPATH.'wp-admin/admin-footer.php');
142 142
 
143 143
 	exit;
144 144
 
145 145
 default:
146
-	wp_redirect( admin_url('upload.php') );
146
+	wp_redirect(admin_url('upload.php'));
147 147
 	exit;
148 148
 
149 149
 }
Please login to merge, or discard this patch.
src/wp-admin/upgrade-functions.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -8,5 +8,5 @@
 block discarded – undo
8 8
  * @subpackage Administration
9 9
  */
10 10
 
11
-_deprecated_file( basename(__FILE__), '2.5.0', 'wp-admin/includes/upgrade.php' );
12
-require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
11
+_deprecated_file(basename(__FILE__), '2.5.0', 'wp-admin/includes/upgrade.php');
12
+require_once(ABSPATH.'wp-admin/includes/upgrade.php');
Please login to merge, or discard this patch.
src/wp-admin/includes/import.php 2 patches
Spacing   +50 added lines, -50 removed lines patch added patch discarded remove patch
@@ -16,8 +16,8 @@  discard block
 block discarded – undo
16 16
  */
17 17
 function get_importers() {
18 18
 	global $wp_importers;
19
-	if ( is_array( $wp_importers ) ) {
20
-		uasort( $wp_importers, '_usort_by_first_member' );
19
+	if (is_array($wp_importers)) {
20
+		uasort($wp_importers, '_usort_by_first_member');
21 21
 	}
22 22
 	return $wp_importers;
23 23
 }
@@ -34,8 +34,8 @@  discard block
 block discarded – undo
34 34
  * @param array $b
35 35
  * @return int
36 36
  */
37
-function _usort_by_first_member( $a, $b ) {
38
-	return strnatcasecmp( $a[0], $b[0] );
37
+function _usort_by_first_member($a, $b) {
38
+	return strnatcasecmp($a[0], $b[0]);
39 39
 }
40 40
 
41 41
 /**
@@ -51,11 +51,11 @@  discard block
 block discarded – undo
51 51
  * @param callable $callback    Callback to run.
52 52
  * @return WP_Error Returns WP_Error when $callback is WP_Error.
53 53
  */
54
-function register_importer( $id, $name, $description, $callback ) {
54
+function register_importer($id, $name, $description, $callback) {
55 55
 	global $wp_importers;
56
-	if ( is_wp_error( $callback ) )
56
+	if (is_wp_error($callback))
57 57
 		return $callback;
58
-	$wp_importers[$id] = array ( $name, $description, $callback );
58
+	$wp_importers[$id] = array($name, $description, $callback);
59 59
 }
60 60
 
61 61
 /**
@@ -67,8 +67,8 @@  discard block
 block discarded – undo
67 67
  *
68 68
  * @param string $id Importer ID.
69 69
  */
70
-function wp_import_cleanup( $id ) {
71
-	wp_delete_attachment( $id );
70
+function wp_import_cleanup($id) {
71
+	wp_delete_attachment($id);
72 72
 }
73 73
 
74 74
 /**
@@ -79,23 +79,23 @@  discard block
 block discarded – undo
79 79
  * @return array Uploaded file's details on success, error message on failure
80 80
  */
81 81
 function wp_import_handle_upload() {
82
-	if ( ! isset( $_FILES['import'] ) ) {
82
+	if ( ! isset($_FILES['import'])) {
83 83
 		return array(
84
-			'error' => __( 'File is empty. Please upload something more substantial. This error could also be caused by uploads being disabled in your php.ini or by post_max_size being defined as smaller than upload_max_filesize in php.ini.' )
84
+			'error' => __('File is empty. Please upload something more substantial. This error could also be caused by uploads being disabled in your php.ini or by post_max_size being defined as smaller than upload_max_filesize in php.ini.')
85 85
 		);
86 86
 	}
87 87
 
88
-	$overrides = array( 'test_form' => false, 'test_type' => false );
88
+	$overrides = array('test_form' => false, 'test_type' => false);
89 89
 	$_FILES['import']['name'] .= '.txt';
90
-	$upload = wp_handle_upload( $_FILES['import'], $overrides );
90
+	$upload = wp_handle_upload($_FILES['import'], $overrides);
91 91
 
92
-	if ( isset( $upload['error'] ) ) {
92
+	if (isset($upload['error'])) {
93 93
 		return $upload;
94 94
 	}
95 95
 
96 96
 	// Construct the object array
97 97
 	$object = array(
98
-		'post_title' => basename( $upload['file'] ),
98
+		'post_title' => basename($upload['file']),
99 99
 		'post_content' => $upload['url'],
100 100
 		'post_mime_type' => $upload['type'],
101 101
 		'guid' => $upload['url'],
@@ -104,15 +104,15 @@  discard block
 block discarded – undo
104 104
 	);
105 105
 
106 106
 	// Save the data
107
-	$id = wp_insert_attachment( $object, $upload['file'] );
107
+	$id = wp_insert_attachment($object, $upload['file']);
108 108
 
109 109
 	/*
110 110
 	 * Schedule a cleanup for one day from now in case of failed
111 111
 	 * import or missing wp_import_cleanup() call.
112 112
 	 */
113
-	wp_schedule_single_event( time() + DAY_IN_SECONDS, 'importer_scheduled_cleanup', array( $id ) );
113
+	wp_schedule_single_event(time() + DAY_IN_SECONDS, 'importer_scheduled_cleanup', array($id));
114 114
 
115
-	return array( 'file' => $upload['file'], 'id' => $id );
115
+	return array('file' => $upload['file'], 'id' => $id);
116 116
 }
117 117
 
118 118
 /**
@@ -123,37 +123,37 @@  discard block
 block discarded – undo
123 123
  * @return array Importers with metadata for each.
124 124
  */
125 125
 function wp_get_popular_importers() {
126
-	include( ABSPATH . WPINC . '/version.php' ); // include an unmodified $wp_version
126
+	include(ABSPATH.WPINC.'/version.php'); // include an unmodified $wp_version
127 127
 
128 128
 	$locale = get_locale();
129
-	$cache_key = 'popular_importers_' . md5( $locale . $wp_version );
130
-	$popular_importers = get_site_transient( $cache_key );
129
+	$cache_key = 'popular_importers_'.md5($locale.$wp_version);
130
+	$popular_importers = get_site_transient($cache_key);
131 131
 
132
-	if ( ! $popular_importers ) {
133
-		$url = add_query_arg( array(
132
+	if ( ! $popular_importers) {
133
+		$url = add_query_arg(array(
134 134
 			'locale'  => get_locale(),
135 135
 			'version' => $wp_version,
136
-		), 'http://api.wordpress.org/core/importers/1.1/' );
137
-		$options = array( 'user-agent' => 'WordPress/' . $wp_version . '; ' . home_url() );
138
-		$response = wp_remote_get( $url, $options );
139
-		$popular_importers = json_decode( wp_remote_retrieve_body( $response ), true );
136
+		), 'http://api.wordpress.org/core/importers/1.1/');
137
+		$options = array('user-agent' => 'WordPress/'.$wp_version.'; '.home_url());
138
+		$response = wp_remote_get($url, $options);
139
+		$popular_importers = json_decode(wp_remote_retrieve_body($response), true);
140 140
 
141
-		if ( is_array( $popular_importers ) ) {
142
-			set_site_transient( $cache_key, $popular_importers, 2 * DAY_IN_SECONDS );
141
+		if (is_array($popular_importers)) {
142
+			set_site_transient($cache_key, $popular_importers, 2 * DAY_IN_SECONDS);
143 143
 		} else {
144 144
 			$popular_importers = false;
145 145
 		}
146 146
 	}
147 147
 
148
-	if ( is_array( $popular_importers ) ) {
148
+	if (is_array($popular_importers)) {
149 149
 		// If the data was received as translated, return it as-is.
150
-		if ( $popular_importers['translated'] )
150
+		if ($popular_importers['translated'])
151 151
 			return $popular_importers['importers'];
152 152
 
153
-		foreach ( $popular_importers['importers'] as &$importer ) {
154
-			$importer['description'] = translate( $importer['description'] );
155
-			if ( $importer['name'] != 'WordPress' )
156
-				$importer['name'] = translate( $importer['name'] );
153
+		foreach ($popular_importers['importers'] as &$importer) {
154
+			$importer['description'] = translate($importer['description']);
155
+			if ($importer['name'] != 'WordPress')
156
+				$importer['name'] = translate($importer['name']);
157 157
 		}
158 158
 		return $popular_importers['importers'];
159 159
 	}
@@ -161,50 +161,50 @@  discard block
 block discarded – undo
161 161
 	return array(
162 162
 		// slug => name, description, plugin slug, and register_importer() slug
163 163
 		'blogger' => array(
164
-			'name' => __( 'Blogger' ),
165
-			'description' => __( 'Import posts, comments, and users from a Blogger blog.' ),
164
+			'name' => __('Blogger'),
165
+			'description' => __('Import posts, comments, and users from a Blogger blog.'),
166 166
 			'plugin-slug' => 'blogger-importer',
167 167
 			'importer-id' => 'blogger',
168 168
 		),
169 169
 		'wpcat2tag' => array(
170
-			'name' => __( 'Categories and Tags Converter' ),
171
-			'description' => __( 'Convert existing categories to tags or tags to categories, selectively.' ),
170
+			'name' => __('Categories and Tags Converter'),
171
+			'description' => __('Convert existing categories to tags or tags to categories, selectively.'),
172 172
 			'plugin-slug' => 'wpcat2tag-importer',
173 173
 			'importer-id' => 'wp-cat2tag',
174 174
 		),
175 175
 		'livejournal' => array(
176
-			'name' => __( 'LiveJournal' ),
177
-			'description' => __( 'Import posts from LiveJournal using their API.' ),
176
+			'name' => __('LiveJournal'),
177
+			'description' => __('Import posts from LiveJournal using their API.'),
178 178
 			'plugin-slug' => 'livejournal-importer',
179 179
 			'importer-id' => 'livejournal',
180 180
 		),
181 181
 		'movabletype' => array(
182
-			'name' => __( 'Movable Type and TypePad' ),
183
-			'description' => __( 'Import posts and comments from a Movable Type or TypePad blog.' ),
182
+			'name' => __('Movable Type and TypePad'),
183
+			'description' => __('Import posts and comments from a Movable Type or TypePad blog.'),
184 184
 			'plugin-slug' => 'movabletype-importer',
185 185
 			'importer-id' => 'mt',
186 186
 		),
187 187
 		'opml' => array(
188
-			'name' => __( 'Blogroll' ),
189
-			'description' => __( 'Import links in OPML format.' ),
188
+			'name' => __('Blogroll'),
189
+			'description' => __('Import links in OPML format.'),
190 190
 			'plugin-slug' => 'opml-importer',
191 191
 			'importer-id' => 'opml',
192 192
 		),
193 193
 		'rss' => array(
194
-			'name' => __( 'RSS' ),
195
-			'description' => __( 'Import posts from an RSS feed.' ),
194
+			'name' => __('RSS'),
195
+			'description' => __('Import posts from an RSS feed.'),
196 196
 			'plugin-slug' => 'rss-importer',
197 197
 			'importer-id' => 'rss',
198 198
 		),
199 199
 		'tumblr' => array(
200
-			'name' => __( 'Tumblr' ),
201
-			'description' => __( 'Import posts &amp; media from Tumblr using their API.' ),
200
+			'name' => __('Tumblr'),
201
+			'description' => __('Import posts &amp; media from Tumblr using their API.'),
202 202
 			'plugin-slug' => 'tumblr-importer',
203 203
 			'importer-id' => 'tumblr',
204 204
 		),
205 205
 		'wordpress' => array(
206 206
 			'name' => 'WordPress',
207
-			'description' => __( 'Import posts, pages, comments, custom fields, categories, and tags from a WordPress export file.' ),
207
+			'description' => __('Import posts, pages, comments, custom fields, categories, and tags from a WordPress export file.'),
208 208
 			'plugin-slug' => 'wordpress-importer',
209 209
 			'importer-id' => 'wordpress',
210 210
 		),
Please login to merge, or discard this patch.
Braces   +9 added lines, -6 removed lines patch added patch discarded remove patch
@@ -53,8 +53,9 @@  discard block
 block discarded – undo
53 53
  */
54 54
 function register_importer( $id, $name, $description, $callback ) {
55 55
 	global $wp_importers;
56
-	if ( is_wp_error( $callback ) )
57
-		return $callback;
56
+	if ( is_wp_error( $callback ) ) {
57
+			return $callback;
58
+	}
58 59
 	$wp_importers[$id] = array ( $name, $description, $callback );
59 60
 }
60 61
 
@@ -147,13 +148,15 @@  discard block
 block discarded – undo
147 148
 
148 149
 	if ( is_array( $popular_importers ) ) {
149 150
 		// If the data was received as translated, return it as-is.
150
-		if ( $popular_importers['translated'] )
151
-			return $popular_importers['importers'];
151
+		if ( $popular_importers['translated'] ) {
152
+					return $popular_importers['importers'];
153
+		}
152 154
 
153 155
 		foreach ( $popular_importers['importers'] as &$importer ) {
154 156
 			$importer['description'] = translate( $importer['description'] );
155
-			if ( $importer['name'] != 'WordPress' )
156
-				$importer['name'] = translate( $importer['name'] );
157
+			if ( $importer['name'] != 'WordPress' ) {
158
+							$importer['name'] = translate( $importer['name'] );
159
+			}
157 160
 		}
158 161
 		return $popular_importers['importers'];
159 162
 	}
Please login to merge, or discard this patch.
src/wp-admin/includes/class-wp-ajax-upgrader-skin.php 1 patch
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -35,8 +35,8 @@  discard block
 block discarded – undo
35 35
 	 *
36 36
 	 * @param array $args Options for the upgrader, see WP_Upgrader_Skin::__construct().
37 37
 	 */
38
-	public function __construct( $args = array() ) {
39
-		parent::__construct( $args );
38
+	public function __construct($args = array()) {
39
+		parent::__construct($args);
40 40
 
41 41
 		$this->errors = new WP_Error();
42 42
 	}
@@ -64,15 +64,15 @@  discard block
 block discarded – undo
64 64
 	public function get_error_messages() {
65 65
 		$messages = array();
66 66
 
67
-		foreach ( $this->errors->get_error_codes() as $error_code ) {
68
-			if ( $this->errors->get_error_data( $error_code ) && is_string( $this->errors->get_error_data( $error_code ) ) ) {
69
-				$messages[] = $this->errors->get_error_message( $error_code ) . ' ' . esc_html( strip_tags( $this->errors->get_error_data( $error_code ) ) );
67
+		foreach ($this->errors->get_error_codes() as $error_code) {
68
+			if ($this->errors->get_error_data($error_code) && is_string($this->errors->get_error_data($error_code))) {
69
+				$messages[] = $this->errors->get_error_message($error_code).' '.esc_html(strip_tags($this->errors->get_error_data($error_code)));
70 70
 			} else {
71
-				$messages[] = $this->errors->get_error_message( $error_code );
71
+				$messages[] = $this->errors->get_error_message($error_code);
72 72
 			}
73 73
 		}
74 74
 
75
-		return implode( ', ', $messages );
75
+		return implode(', ', $messages);
76 76
 	}
77 77
 
78 78
 	/**
@@ -83,32 +83,32 @@  discard block
 block discarded – undo
83 83
 	 *
84 84
 	 * @param string|WP_Error $errors Errors.
85 85
 	 */
86
-	public function error( $errors ) {
87
-		if ( is_string( $errors ) ) {
86
+	public function error($errors) {
87
+		if (is_string($errors)) {
88 88
 			$string = $errors;
89
-			if ( ! empty( $this->upgrader->strings[ $string ] ) ) {
90
-				$string = $this->upgrader->strings[ $string ];
89
+			if ( ! empty($this->upgrader->strings[$string])) {
90
+				$string = $this->upgrader->strings[$string];
91 91
 			}
92 92
 
93
-			if ( false !== strpos( $string, '%' ) ) {
93
+			if (false !== strpos($string, '%')) {
94 94
 				$args = func_get_args();
95
-				$args = array_splice( $args, 1 );
96
-				if ( ! empty( $args ) ) {
97
-					$string = vsprintf( $string, $args );
95
+				$args = array_splice($args, 1);
96
+				if ( ! empty($args)) {
97
+					$string = vsprintf($string, $args);
98 98
 				}
99 99
 			}
100 100
 
101 101
 			// Count existing errors to generate an unique error code.
102
-			$errors_count = count( $errors->get_error_codes() );
103
-			$this->errors->add( 'unknown_upgrade_error_' . $errors_count + 1 , $string );
104
-		} elseif ( is_wp_error( $errors ) ) {
105
-			foreach ( $errors->get_error_codes() as $error_code ) {
106
-				$this->errors->add( $error_code, $errors->get_error_message( $error_code ), $errors->get_error_data( $error_code ) );
102
+			$errors_count = count($errors->get_error_codes());
103
+			$this->errors->add('unknown_upgrade_error_'.$errors_count + 1, $string);
104
+		} elseif (is_wp_error($errors)) {
105
+			foreach ($errors->get_error_codes() as $error_code) {
106
+				$this->errors->add($error_code, $errors->get_error_message($error_code), $errors->get_error_data($error_code));
107 107
 			}
108 108
 		}
109 109
 
110 110
 		$args = func_get_args();
111
-		call_user_func_array( array( $this, 'parent::error' ), $args );
111
+		call_user_func_array(array($this, 'parent::error'), $args);
112 112
 	}
113 113
 
114 114
 	/**
@@ -119,14 +119,14 @@  discard block
 block discarded – undo
119 119
 	 *
120 120
 	 * @param string|array|WP_Error $data Log entry data.
121 121
 	 */
122
-	public function feedback( $data ) {
123
-		if ( is_wp_error( $data ) ) {
124
-			foreach ( $data->get_error_codes() as $error_code ) {
125
-				$this->errors->add( $error_code, $data->get_error_message( $error_code ), $data->get_error_data( $error_code ) );
122
+	public function feedback($data) {
123
+		if (is_wp_error($data)) {
124
+			foreach ($data->get_error_codes() as $error_code) {
125
+				$this->errors->add($error_code, $data->get_error_message($error_code), $data->get_error_data($error_code));
126 126
 			}
127 127
 		}
128 128
 
129 129
 		$args = func_get_args();
130
-		call_user_func_array( array( $this, 'parent::feedback' ), $args );
130
+		call_user_func_array(array($this, 'parent::feedback'), $args);
131 131
 	}
132 132
 }
Please login to merge, or discard this patch.
src/wp-admin/includes/class-wp-automatic-updater.php 2 patches
Braces   +125 added lines, -86 removed lines patch added patch discarded remove patch
@@ -31,11 +31,13 @@  discard block
 block discarded – undo
31 31
 	 */
32 32
 	public function is_disabled() {
33 33
 		// Background updates are disabled if you don't want file changes.
34
-		if ( defined( 'DISALLOW_FILE_MODS' ) && DISALLOW_FILE_MODS )
35
-			return true;
34
+		if ( defined( 'DISALLOW_FILE_MODS' ) && DISALLOW_FILE_MODS ) {
35
+					return true;
36
+		}
36 37
 
37
-		if ( wp_installing() )
38
-			return true;
38
+		if ( wp_installing() ) {
39
+					return true;
40
+		}
39 41
 
40 42
 		// More fine grained control can be done through the WP_AUTO_UPDATE_CORE constant and filters.
41 43
 		$disabled = defined( 'AUTOMATIC_UPDATER_DISABLED' ) && AUTOMATIC_UPDATER_DISABLED;
@@ -74,8 +76,9 @@  discard block
 block discarded – undo
74 76
 	 */
75 77
 	public function is_vcs_checkout( $context ) {
76 78
 		$context_dirs = array( untrailingslashit( $context ) );
77
-		if ( $context !== ABSPATH )
78
-			$context_dirs[] = untrailingslashit( ABSPATH );
79
+		if ( $context !== ABSPATH ) {
80
+					$context_dirs[] = untrailingslashit( ABSPATH );
81
+		}
79 82
 
80 83
 		$vcs_dirs = array( '.svn', '.git', '.hg', '.bzr' );
81 84
 		$check_dirs = array();
@@ -86,8 +89,9 @@  discard block
 block discarded – undo
86 89
 				$check_dirs[] = $context_dir;
87 90
 
88 91
 				// Once we've hit '/' or 'C:\', we need to stop. dirname will keep returning the input here.
89
-				if ( $context_dir == dirname( $context_dir ) )
90
-					break;
92
+				if ( $context_dir == dirname( $context_dir ) ) {
93
+									break;
94
+				}
91 95
 
92 96
 			// Continue one level at a time.
93 97
 			} while ( $context_dir = dirname( $context_dir ) );
@@ -98,8 +102,9 @@  discard block
 block discarded – undo
98 102
 		// Search all directories we've found for evidence of version control.
99 103
 		foreach ( $vcs_dirs as $vcs_dir ) {
100 104
 			foreach ( $check_dirs as $check_dir ) {
101
-				if ( $checkout = @is_dir( rtrim( $check_dir, '\\/' ) . "/$vcs_dir" ) )
102
-					break 2;
105
+				if ( $checkout = @is_dir( rtrim( $check_dir, '\\/' ) . "/$vcs_dir" ) ) {
106
+									break 2;
107
+				}
103 108
 			}
104 109
 		}
105 110
 
@@ -135,8 +140,9 @@  discard block
 block discarded – undo
135 140
 		// Used to see if WP_Filesystem is set up to allow unattended updates.
136 141
 		$skin = new Automatic_Upgrader_Skin;
137 142
 
138
-		if ( $this->is_disabled() )
139
-			return false;
143
+		if ( $this->is_disabled() ) {
144
+					return false;
145
+		}
140 146
 
141 147
 		// Only relax the filesystem checks when the update doesn't include new files
142 148
 		$allow_relaxed_file_ownership = false;
@@ -146,16 +152,18 @@  discard block
 block discarded – undo
146 152
 
147 153
 		// If we can't do an auto core update, we may still be able to email the user.
148 154
 		if ( ! $skin->request_filesystem_credentials( false, $context, $allow_relaxed_file_ownership ) || $this->is_vcs_checkout( $context ) ) {
149
-			if ( 'core' == $type )
150
-				$this->send_core_update_notification_email( $item );
155
+			if ( 'core' == $type ) {
156
+							$this->send_core_update_notification_email( $item );
157
+			}
151 158
 			return false;
152 159
 		}
153 160
 
154 161
 		// Next up, is this an item we can update?
155
-		if ( 'core' == $type )
156
-			$update = Core_Upgrader::should_update_to_version( $item->current );
157
-		else
158
-			$update = ! empty( $item->autoupdate );
162
+		if ( 'core' == $type ) {
163
+					$update = Core_Upgrader::should_update_to_version( $item->current );
164
+		} else {
165
+					$update = ! empty( $item->autoupdate );
166
+		}
159 167
 
160 168
 		/**
161 169
 		 * Filters whether to automatically update core, a plugin, a theme, or a language.
@@ -179,8 +187,9 @@  discard block
 block discarded – undo
179 187
 		$update = apply_filters( 'auto_update_' . $type, $update, $item );
180 188
 
181 189
 		if ( ! $update ) {
182
-			if ( 'core' == $type )
183
-				$this->send_core_update_notification_email( $item );
190
+			if ( 'core' == $type ) {
191
+							$this->send_core_update_notification_email( $item );
192
+			}
184 193
 			return false;
185 194
 		}
186 195
 
@@ -189,13 +198,15 @@  discard block
 block discarded – undo
189 198
 			global $wpdb;
190 199
 
191 200
 			$php_compat = version_compare( phpversion(), $item->php_version, '>=' );
192
-			if ( file_exists( WP_CONTENT_DIR . '/db.php' ) && empty( $wpdb->is_mysql ) )
193
-				$mysql_compat = true;
194
-			else
195
-				$mysql_compat = version_compare( $wpdb->db_version(), $item->mysql_version, '>=' );
201
+			if ( file_exists( WP_CONTENT_DIR . '/db.php' ) && empty( $wpdb->is_mysql ) ) {
202
+							$mysql_compat = true;
203
+			} else {
204
+							$mysql_compat = version_compare( $wpdb->db_version(), $item->mysql_version, '>=' );
205
+			}
196 206
 
197
-			if ( ! $php_compat || ! $mysql_compat )
198
-				return false;
207
+			if ( ! $php_compat || ! $mysql_compat ) {
208
+							return false;
209
+			}
199 210
 		}
200 211
 
201 212
 		return true;
@@ -213,8 +224,9 @@  discard block
 block discarded – undo
213 224
 		$notified = get_site_option( 'auto_core_update_notified' );
214 225
 
215 226
 		// Don't notify if we've already notified the same email address of the same version.
216
-		if ( $notified && $notified['email'] == get_site_option( 'admin_email' ) && $notified['version'] == $item->current )
217
-			return false;
227
+		if ( $notified && $notified['email'] == get_site_option( 'admin_email' ) && $notified['version'] == $item->current ) {
228
+					return false;
229
+		}
218 230
 
219 231
 		// See if we need to notify users of a core update.
220 232
 		$notify = ! empty( $item->notify_email );
@@ -238,8 +250,9 @@  discard block
 block discarded – undo
238 250
 		 * @param bool   $notify Whether the site administrator is notified.
239 251
 		 * @param object $item   The update offer.
240 252
 		 */
241
-		if ( ! apply_filters( 'send_core_update_notification_email', $notify, $item ) )
242
-			return false;
253
+		if ( ! apply_filters( 'send_core_update_notification_email', $notify, $item ) ) {
254
+					return false;
255
+		}
243 256
 
244 257
 		$this->send_email( 'manual', $item );
245 258
 		return true;
@@ -281,8 +294,9 @@  discard block
 block discarded – undo
281 294
 		}
282 295
 
283 296
 		// Determine whether we can and should perform this update.
284
-		if ( ! $this->should_update( $type, $item, $context ) )
285
-			return false;
297
+		if ( ! $this->should_update( $type, $item, $context ) ) {
298
+					return false;
299
+		}
286 300
 
287 301
 		/**
288 302
 		 * Fires immediately prior to an auto-update.
@@ -378,14 +392,17 @@  discard block
 block discarded – undo
378 392
 	public function run() {
379 393
 		global $wpdb, $wp_version;
380 394
 
381
-		if ( $this->is_disabled() )
382
-			return;
395
+		if ( $this->is_disabled() ) {
396
+					return;
397
+		}
383 398
 
384
-		if ( ! is_main_network() || ! is_main_site() )
385
-			return;
399
+		if ( ! is_main_network() || ! is_main_site() ) {
400
+					return;
401
+		}
386 402
 
387
-		if ( ! WP_Upgrader::create_lock( 'auto_updater' ) )
388
-			return;
403
+		if ( ! WP_Upgrader::create_lock( 'auto_updater' ) ) {
404
+					return;
405
+		}
389 406
 
390 407
 		// Don't automatically run these thins, as we'll handle it ourselves
391 408
 		remove_action( 'upgrader_process_complete', array( 'Language_Pack_Upgrader', 'async_upgrade' ), 20 );
@@ -419,8 +436,9 @@  discard block
 block discarded – undo
419 436
 		wp_version_check(); // Check for Core updates
420 437
 		$core_update = find_core_auto_update();
421 438
 
422
-		if ( $core_update )
423
-			$this->update( 'core', $core_update );
439
+		if ( $core_update ) {
440
+					$this->update( 'core', $core_update );
441
+		}
424 442
 
425 443
 		// Clean up, and check for any pending translations
426 444
 		// (Core_Upgrader checks for core updates)
@@ -468,11 +486,13 @@  discard block
 block discarded – undo
468 486
 			 *                                  install is a development version.
469 487
 			 *                                  Return false to avoid the email.
470 488
 			 */
471
-			if ( apply_filters( 'automatic_updates_send_debug_email', $development_version ) )
472
-				$this->send_debug_email();
489
+			if ( apply_filters( 'automatic_updates_send_debug_email', $development_version ) ) {
490
+							$this->send_debug_email();
491
+			}
473 492
 
474
-			if ( ! empty( $this->update_results['core'] ) )
475
-				$this->after_core_update( $this->update_results['core'][0] );
493
+			if ( ! empty( $this->update_results['core'] ) ) {
494
+							$this->after_core_update( $this->update_results['core'][0] );
495
+			}
476 496
 
477 497
 			/**
478 498
 			 * Fires after all automatic updates have run.
@@ -562,8 +582,9 @@  discard block
 block discarded – undo
562 582
 
563 583
   		$n = get_site_option( 'auto_core_update_notified' );
564 584
 		// Don't notify if we've already notified the same email address of the same version of the same notification type.
565
-		if ( $n && 'fail' == $n['type'] && $n['email'] == get_site_option( 'admin_email' ) && $n['version'] == $core_update->current )
566
-			$send = false;
585
+		if ( $n && 'fail' == $n['type'] && $n['email'] == get_site_option( 'admin_email' ) && $n['version'] == $core_update->current ) {
586
+					$send = false;
587
+		}
567 588
 
568 589
 		update_site_option( 'auto_core_update_failed', array(
569 590
 			'attempted'  => $core_update->current,
@@ -574,8 +595,9 @@  discard block
 block discarded – undo
574 595
 			'retry'      => in_array( $error_code, $transient_failures ),
575 596
 		) );
576 597
 
577
-		if ( $send )
578
-			$this->send_email( 'fail', $core_update, $result );
598
+		if ( $send ) {
599
+					$this->send_email( 'fail', $core_update, $result );
600
+		}
579 601
 	}
580 602
 
581 603
 	/**
@@ -600,8 +622,9 @@  discard block
 block discarded – undo
600 622
 
601 623
 		$next_user_core_update = get_preferred_from_update_core();
602 624
 		// If the update transient is empty, use the update we just performed
603
-		if ( ! $next_user_core_update )
604
-			$next_user_core_update = $core_update;
625
+		if ( ! $next_user_core_update ) {
626
+					$next_user_core_update = $core_update;
627
+		}
605 628
 		$newer_version_available = ( 'upgrade' == $next_user_core_update->response && version_compare( $next_user_core_update->version, $core_update->version, '>' ) );
606 629
 
607 630
 		/**
@@ -615,8 +638,9 @@  discard block
 block discarded – undo
615 638
 		 * @param object $core_update The update offer that was attempted.
616 639
 		 * @param mixed  $result      The result for the core update. Can be WP_Error.
617 640
 		 */
618
-		if ( 'manual' !== $type && ! apply_filters( 'auto_core_update_send_email', true, $type, $core_update, $result ) )
619
-			return;
641
+		if ( 'manual' !== $type && ! apply_filters( 'auto_core_update_send_email', true, $type, $core_update, $result ) ) {
642
+					return;
643
+		}
620 644
 
621 645
 		switch ( $type ) {
622 646
 			case 'success' : // We updated.
@@ -649,8 +673,9 @@  discard block
 block discarded – undo
649 673
 			case 'success' :
650 674
 				$body .= sprintf( __( 'Howdy! Your site at %1$s has been updated automatically to WordPress %2$s.' ), home_url(), $core_update->current );
651 675
 				$body .= "\n\n";
652
-				if ( ! $newer_version_available )
653
-					$body .= __( 'No further action is needed on your part.' ) . ' ';
676
+				if ( ! $newer_version_available ) {
677
+									$body .= __( 'No further action is needed on your part.' ) . ' ';
678
+				}
654 679
 
655 680
 				// Can only reference the About screen if their update was successful.
656 681
 				list( $about_version ) = explode( '-', $core_update->current, 2 );
@@ -673,18 +698,20 @@  discard block
 block discarded – undo
673 698
 
674 699
 				// Don't show this message if there is a newer version available.
675 700
 				// Potential for confusion, and also not useful for them to know at this point.
676
-				if ( 'fail' == $type && ! $newer_version_available )
677
-					$body .= __( 'We tried but were unable to update your site automatically.' ) . ' ';
701
+				if ( 'fail' == $type && ! $newer_version_available ) {
702
+									$body .= __( 'We tried but were unable to update your site automatically.' ) . ' ';
703
+				}
678 704
 
679 705
 				$body .= __( 'Updating is easy and only takes a few moments:' );
680 706
 				$body .= "\n" . network_admin_url( 'update-core.php' );
681 707
 				break;
682 708
 
683 709
 			case 'critical' :
684
-				if ( $newer_version_available )
685
-					$body .= sprintf( __( 'Your site at %1$s experienced a critical failure while trying to update WordPress to version %2$s.' ), home_url(), $core_update->current );
686
-				else
687
-					$body .= sprintf( __( 'Your site at %1$s experienced a critical failure while trying to update to the latest version of WordPress, %2$s.' ), home_url(), $core_update->current );
710
+				if ( $newer_version_available ) {
711
+									$body .= sprintf( __( 'Your site at %1$s experienced a critical failure while trying to update WordPress to version %2$s.' ), home_url(), $core_update->current );
712
+				} else {
713
+									$body .= sprintf( __( 'Your site at %1$s experienced a critical failure while trying to update to the latest version of WordPress, %2$s.' ), home_url(), $core_update->current );
714
+				}
688 715
 
689 716
 				$body .= "\n\n" . __( "This means your site may be offline or broken. Don't panic; this can be fixed." );
690 717
 
@@ -728,23 +755,28 @@  discard block
 block discarded – undo
728 755
 
729 756
 			// If we had a rollback and we're still critical, then the rollback failed too.
730 757
 			// Loop through all errors (the main WP_Error, the update result, the rollback result) for code, data, etc.
731
-			if ( 'rollback_was_required' == $result->get_error_code() )
732
-				$errors = array( $result, $result->get_error_data()->update, $result->get_error_data()->rollback );
733
-			else
734
-				$errors = array( $result );
758
+			if ( 'rollback_was_required' == $result->get_error_code() ) {
759
+							$errors = array( $result, $result->get_error_data()->update, $result->get_error_data()->rollback );
760
+			} else {
761
+							$errors = array( $result );
762
+			}
735 763
 
736 764
 			foreach ( $errors as $error ) {
737
-				if ( ! is_wp_error( $error ) )
738
-					continue;
765
+				if ( ! is_wp_error( $error ) ) {
766
+									continue;
767
+				}
739 768
 				$error_code = $error->get_error_code();
740 769
 				$body .= "\n\n" . sprintf( __( "Error code: %s" ), $error_code );
741
-				if ( 'rollback_was_required' == $error_code )
742
-					continue;
743
-				if ( $error->get_error_message() )
744
-					$body .= "\n" . $error->get_error_message();
770
+				if ( 'rollback_was_required' == $error_code ) {
771
+									continue;
772
+				}
773
+				if ( $error->get_error_message() ) {
774
+									$body .= "\n" . $error->get_error_message();
775
+				}
745 776
 				$error_data = $error->get_error_data();
746
-				if ( $error_data )
747
-					$body .= "\n" . implode( ', ', (array) $error_data );
777
+				if ( $error_data ) {
778
+									$body .= "\n" . implode( ', ', (array) $error_data );
779
+				}
748 780
 			}
749 781
 			$body .= "\n";
750 782
 		}
@@ -786,8 +818,9 @@  discard block
 block discarded – undo
786 818
 	 */
787 819
 	protected function send_debug_email() {
788 820
 		$update_count = 0;
789
-		foreach ( $this->update_results as $type => $updates )
790
-			$update_count += count( $updates );
821
+		foreach ( $this->update_results as $type => $updates ) {
822
+					$update_count += count( $updates );
823
+		}
791 824
 
792 825
 		$body = array();
793 826
 		$failures = 0;
@@ -808,8 +841,9 @@  discard block
 block discarded – undo
808 841
 
809 842
 		// Plugins, Themes, Translations
810 843
 		foreach ( array( 'plugin', 'theme', 'translation' ) as $type ) {
811
-			if ( ! isset( $this->update_results[ $type ] ) )
812
-				continue;
844
+			if ( ! isset( $this->update_results[ $type ] ) ) {
845
+							continue;
846
+			}
813 847
 			$success_items = wp_list_filter( $this->update_results[ $type ], array( 'result' => true ) );
814 848
 			if ( $success_items ) {
815 849
 				$messages = array(
@@ -868,21 +902,25 @@  discard block
 block discarded – undo
868 902
 		$body[] = '';
869 903
 
870 904
 		foreach ( array( 'core', 'plugin', 'theme', 'translation' ) as $type ) {
871
-			if ( ! isset( $this->update_results[ $type ] ) )
872
-				continue;
905
+			if ( ! isset( $this->update_results[ $type ] ) ) {
906
+							continue;
907
+			}
873 908
 			foreach ( $this->update_results[ $type ] as $update ) {
874 909
 				$body[] = $update->name;
875 910
 				$body[] = str_repeat( '-', strlen( $update->name ) );
876
-				foreach ( $update->messages as $message )
877
-					$body[] = "  " . html_entity_decode( str_replace( '&#8230;', '...', $message ) );
911
+				foreach ( $update->messages as $message ) {
912
+									$body[] = "  " . html_entity_decode( str_replace( '&#8230;', '...', $message ) );
913
+				}
878 914
 				if ( is_wp_error( $update->result ) ) {
879 915
 					$results = array( 'update' => $update->result );
880 916
 					// If we rolled back, we want to know an error that occurred then too.
881
-					if ( 'rollback_was_required' === $update->result->get_error_code() )
882
-						$results = (array) $update->result->get_error_data();
917
+					if ( 'rollback_was_required' === $update->result->get_error_code() ) {
918
+											$results = (array) $update->result->get_error_data();
919
+					}
883 920
 					foreach ( $results as $result_type => $result ) {
884
-						if ( ! is_wp_error( $result ) )
885
-							continue;
921
+						if ( ! is_wp_error( $result ) ) {
922
+													continue;
923
+						}
886 924
 
887 925
 						if ( 'rollback' === $result_type ) {
888 926
 							/* translators: 1: Error code, 2: Error message. */
@@ -892,8 +930,9 @@  discard block
 block discarded – undo
892 930
 							$body[] = '  ' . sprintf( __( 'Error: [%1$s] %2$s' ), $result->get_error_code(), $result->get_error_message() );
893 931
 						}
894 932
 
895
-						if ( $result->get_error_data() )
896
-							$body[] = '         ' . implode( ', ', (array) $result->get_error_data() );
933
+						if ( $result->get_error_data() ) {
934
+													$body[] = '         ' . implode( ', ', (array) $result->get_error_data() );
935
+						}
897 936
 					}
898 937
 				}
899 938
 				$body[] = '';
Please login to merge, or discard this patch.
Spacing   +252 added lines, -252 removed lines patch added patch discarded remove patch
@@ -31,14 +31,14 @@  discard block
 block discarded – undo
31 31
 	 */
32 32
 	public function is_disabled() {
33 33
 		// Background updates are disabled if you don't want file changes.
34
-		if ( defined( 'DISALLOW_FILE_MODS' ) && DISALLOW_FILE_MODS )
34
+		if (defined('DISALLOW_FILE_MODS') && DISALLOW_FILE_MODS)
35 35
 			return true;
36 36
 
37
-		if ( wp_installing() )
37
+		if (wp_installing())
38 38
 			return true;
39 39
 
40 40
 		// More fine grained control can be done through the WP_AUTO_UPDATE_CORE constant and filters.
41
-		$disabled = defined( 'AUTOMATIC_UPDATER_DISABLED' ) && AUTOMATIC_UPDATER_DISABLED;
41
+		$disabled = defined('AUTOMATIC_UPDATER_DISABLED') && AUTOMATIC_UPDATER_DISABLED;
42 42
 
43 43
 		/**
44 44
 		 * Filters whether to entirely disable background updates.
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
 		 *
53 53
 		 * @param bool $disabled Whether the updater should be disabled.
54 54
 		 */
55
-		return apply_filters( 'automatic_updater_disabled', $disabled );
55
+		return apply_filters('automatic_updater_disabled', $disabled);
56 56
 	}
57 57
 
58 58
 	/**
@@ -72,33 +72,33 @@  discard block
 block discarded – undo
72 72
 	 *
73 73
 	 * @param string $context The filesystem path to check, in addition to ABSPATH.
74 74
 	 */
75
-	public function is_vcs_checkout( $context ) {
76
-		$context_dirs = array( untrailingslashit( $context ) );
77
-		if ( $context !== ABSPATH )
78
-			$context_dirs[] = untrailingslashit( ABSPATH );
75
+	public function is_vcs_checkout($context) {
76
+		$context_dirs = array(untrailingslashit($context));
77
+		if ($context !== ABSPATH)
78
+			$context_dirs[] = untrailingslashit(ABSPATH);
79 79
 
80
-		$vcs_dirs = array( '.svn', '.git', '.hg', '.bzr' );
80
+		$vcs_dirs = array('.svn', '.git', '.hg', '.bzr');
81 81
 		$check_dirs = array();
82 82
 
83
-		foreach ( $context_dirs as $context_dir ) {
83
+		foreach ($context_dirs as $context_dir) {
84 84
 			// Walk up from $context_dir to the root.
85 85
 			do {
86 86
 				$check_dirs[] = $context_dir;
87 87
 
88 88
 				// Once we've hit '/' or 'C:\', we need to stop. dirname will keep returning the input here.
89
-				if ( $context_dir == dirname( $context_dir ) )
89
+				if ($context_dir == dirname($context_dir))
90 90
 					break;
91 91
 
92 92
 			// Continue one level at a time.
93
-			} while ( $context_dir = dirname( $context_dir ) );
93
+			} while ($context_dir = dirname($context_dir));
94 94
 		}
95 95
 
96
-		$check_dirs = array_unique( $check_dirs );
96
+		$check_dirs = array_unique($check_dirs);
97 97
 
98 98
 		// Search all directories we've found for evidence of version control.
99
-		foreach ( $vcs_dirs as $vcs_dir ) {
100
-			foreach ( $check_dirs as $check_dir ) {
101
-				if ( $checkout = @is_dir( rtrim( $check_dir, '\\/' ) . "/$vcs_dir" ) )
99
+		foreach ($vcs_dirs as $vcs_dir) {
100
+			foreach ($check_dirs as $check_dir) {
101
+				if ($checkout = @is_dir(rtrim($check_dir, '\\/')."/$vcs_dir"))
102 102
 					break 2;
103 103
 			}
104 104
 		}
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
 		 * @param string $context The filesystem context (a path) against which
115 115
 		 *                        filesystem status should be checked.
116 116
 		 */
117
-		return apply_filters( 'automatic_updates_is_vcs_checkout', $checkout, $context );
117
+		return apply_filters('automatic_updates_is_vcs_checkout', $checkout, $context);
118 118
 	}
119 119
 
120 120
 	/**
@@ -131,31 +131,31 @@  discard block
 block discarded – undo
131 131
 	 * @param string $context The filesystem context (a path) against which filesystem
132 132
 	 *                        access and status should be checked.
133 133
 	 */
134
-	public function should_update( $type, $item, $context ) {
134
+	public function should_update($type, $item, $context) {
135 135
 		// Used to see if WP_Filesystem is set up to allow unattended updates.
136 136
 		$skin = new Automatic_Upgrader_Skin;
137 137
 
138
-		if ( $this->is_disabled() )
138
+		if ($this->is_disabled())
139 139
 			return false;
140 140
 
141 141
 		// Only relax the filesystem checks when the update doesn't include new files
142 142
 		$allow_relaxed_file_ownership = false;
143
-		if ( 'core' == $type && isset( $item->new_files ) && ! $item->new_files ) {
143
+		if ('core' == $type && isset($item->new_files) && ! $item->new_files) {
144 144
 			$allow_relaxed_file_ownership = true;
145 145
 		}
146 146
 
147 147
 		// If we can't do an auto core update, we may still be able to email the user.
148
-		if ( ! $skin->request_filesystem_credentials( false, $context, $allow_relaxed_file_ownership ) || $this->is_vcs_checkout( $context ) ) {
149
-			if ( 'core' == $type )
150
-				$this->send_core_update_notification_email( $item );
148
+		if ( ! $skin->request_filesystem_credentials(false, $context, $allow_relaxed_file_ownership) || $this->is_vcs_checkout($context)) {
149
+			if ('core' == $type)
150
+				$this->send_core_update_notification_email($item);
151 151
 			return false;
152 152
 		}
153 153
 
154 154
 		// Next up, is this an item we can update?
155
-		if ( 'core' == $type )
156
-			$update = Core_Upgrader::should_update_to_version( $item->current );
155
+		if ('core' == $type)
156
+			$update = Core_Upgrader::should_update_to_version($item->current);
157 157
 		else
158
-			$update = ! empty( $item->autoupdate );
158
+			$update = ! empty($item->autoupdate);
159 159
 
160 160
 		/**
161 161
 		 * Filters whether to automatically update core, a plugin, a theme, or a language.
@@ -176,25 +176,25 @@  discard block
 block discarded – undo
176 176
 		 * @param bool   $update Whether to update.
177 177
 		 * @param object $item   The update offer.
178 178
 		 */
179
-		$update = apply_filters( "auto_update_{$type}", $update, $item );
179
+		$update = apply_filters("auto_update_{$type}", $update, $item);
180 180
 
181
-		if ( ! $update ) {
182
-			if ( 'core' == $type )
183
-				$this->send_core_update_notification_email( $item );
181
+		if ( ! $update) {
182
+			if ('core' == $type)
183
+				$this->send_core_update_notification_email($item);
184 184
 			return false;
185 185
 		}
186 186
 
187 187
 		// If it's a core update, are we actually compatible with its requirements?
188
-		if ( 'core' == $type ) {
188
+		if ('core' == $type) {
189 189
 			global $wpdb;
190 190
 
191
-			$php_compat = version_compare( phpversion(), $item->php_version, '>=' );
192
-			if ( file_exists( WP_CONTENT_DIR . '/db.php' ) && empty( $wpdb->is_mysql ) )
191
+			$php_compat = version_compare(phpversion(), $item->php_version, '>=');
192
+			if (file_exists(WP_CONTENT_DIR.'/db.php') && empty($wpdb->is_mysql))
193 193
 				$mysql_compat = true;
194 194
 			else
195
-				$mysql_compat = version_compare( $wpdb->db_version(), $item->mysql_version, '>=' );
195
+				$mysql_compat = version_compare($wpdb->db_version(), $item->mysql_version, '>=');
196 196
 
197
-			if ( ! $php_compat || ! $mysql_compat )
197
+			if ( ! $php_compat || ! $mysql_compat)
198 198
 				return false;
199 199
 		}
200 200
 
@@ -209,15 +209,15 @@  discard block
 block discarded – undo
209 209
 	 *
210 210
 	 * @param object $item The update offer.
211 211
 	 */
212
-	protected function send_core_update_notification_email( $item ) {
213
-		$notified = get_site_option( 'auto_core_update_notified' );
212
+	protected function send_core_update_notification_email($item) {
213
+		$notified = get_site_option('auto_core_update_notified');
214 214
 
215 215
 		// Don't notify if we've already notified the same email address of the same version.
216
-		if ( $notified && $notified['email'] == get_site_option( 'admin_email' ) && $notified['version'] == $item->current )
216
+		if ($notified && $notified['email'] == get_site_option('admin_email') && $notified['version'] == $item->current)
217 217
 			return false;
218 218
 
219 219
 		// See if we need to notify users of a core update.
220
-		$notify = ! empty( $item->notify_email );
220
+		$notify = ! empty($item->notify_email);
221 221
 
222 222
 		/**
223 223
 		 * Filters whether to notify the site administrator of a new core update.
@@ -238,10 +238,10 @@  discard block
 block discarded – undo
238 238
 		 * @param bool   $notify Whether the site administrator is notified.
239 239
 		 * @param object $item   The update offer.
240 240
 		 */
241
-		if ( ! apply_filters( 'send_core_update_notification_email', $notify, $item ) )
241
+		if ( ! apply_filters('send_core_update_notification_email', $notify, $item))
242 242
 			return false;
243 243
 
244
-		$this->send_email( 'manual', $item );
244
+		$this->send_email('manual', $item);
245 245
 		return true;
246 246
 	}
247 247
 
@@ -256,32 +256,32 @@  discard block
 block discarded – undo
256 256
 	 *
257 257
 	 * @return null|WP_Error
258 258
 	 */
259
-	public function update( $type, $item ) {
259
+	public function update($type, $item) {
260 260
 		$skin = new Automatic_Upgrader_Skin;
261 261
 
262
-		switch ( $type ) {
262
+		switch ($type) {
263 263
 			case 'core':
264 264
 				// The Core upgrader doesn't use the Upgrader's skin during the actual main part of the upgrade, instead, firing a filter.
265
-				add_filter( 'update_feedback', array( $skin, 'feedback' ) );
266
-				$upgrader = new Core_Upgrader( $skin );
265
+				add_filter('update_feedback', array($skin, 'feedback'));
266
+				$upgrader = new Core_Upgrader($skin);
267 267
 				$context  = ABSPATH;
268 268
 				break;
269 269
 			case 'plugin':
270
-				$upgrader = new Plugin_Upgrader( $skin );
270
+				$upgrader = new Plugin_Upgrader($skin);
271 271
 				$context  = WP_PLUGIN_DIR; // We don't support custom Plugin directories, or updates for WPMU_PLUGIN_DIR
272 272
 				break;
273 273
 			case 'theme':
274
-				$upgrader = new Theme_Upgrader( $skin );
275
-				$context  = get_theme_root( $item->theme );
274
+				$upgrader = new Theme_Upgrader($skin);
275
+				$context  = get_theme_root($item->theme);
276 276
 				break;
277 277
 			case 'translation':
278
-				$upgrader = new Language_Pack_Upgrader( $skin );
278
+				$upgrader = new Language_Pack_Upgrader($skin);
279 279
 				$context  = WP_CONTENT_DIR; // WP_LANG_DIR;
280 280
 				break;
281 281
 		}
282 282
 
283 283
 		// Determine whether we can and should perform this update.
284
-		if ( ! $this->should_update( $type, $item, $context ) )
284
+		if ( ! $this->should_update($type, $item, $context))
285 285
 			return false;
286 286
 
287 287
 		/**
@@ -294,40 +294,40 @@  discard block
 block discarded – undo
294 294
 		 * @param string $context The filesystem context (a path) against which filesystem access and status
295 295
 		 *                        should be checked.
296 296
 		 */
297
-		do_action( 'pre_auto_update', $type, $item, $context );
297
+		do_action('pre_auto_update', $type, $item, $context);
298 298
 
299 299
 		$upgrader_item = $item;
300
-		switch ( $type ) {
300
+		switch ($type) {
301 301
 			case 'core':
302
-				$skin->feedback( __( 'Updating to WordPress %s' ), $item->version );
303
-				$item_name = sprintf( __( 'WordPress %s' ), $item->version );
302
+				$skin->feedback(__('Updating to WordPress %s'), $item->version);
303
+				$item_name = sprintf(__('WordPress %s'), $item->version);
304 304
 				break;
305 305
 			case 'theme':
306 306
 				$upgrader_item = $item->theme;
307
-				$theme = wp_get_theme( $upgrader_item );
308
-				$item_name = $theme->Get( 'Name' );
309
-				$skin->feedback( __( 'Updating theme: %s' ), $item_name );
307
+				$theme = wp_get_theme($upgrader_item);
308
+				$item_name = $theme->Get('Name');
309
+				$skin->feedback(__('Updating theme: %s'), $item_name);
310 310
 				break;
311 311
 			case 'plugin':
312 312
 				$upgrader_item = $item->plugin;
313
-				$plugin_data = get_plugin_data( $context . '/' . $upgrader_item );
313
+				$plugin_data = get_plugin_data($context.'/'.$upgrader_item);
314 314
 				$item_name = $plugin_data['Name'];
315
-				$skin->feedback( __( 'Updating plugin: %s' ), $item_name );
315
+				$skin->feedback(__('Updating plugin: %s'), $item_name);
316 316
 				break;
317 317
 			case 'translation':
318
-				$language_item_name = $upgrader->get_name_for_update( $item );
319
-				$item_name = sprintf( __( 'Translations for %s' ), $language_item_name );
320
-				$skin->feedback( sprintf( __( 'Updating translations for %1$s (%2$s)&#8230;' ), $language_item_name, $item->language ) );
318
+				$language_item_name = $upgrader->get_name_for_update($item);
319
+				$item_name = sprintf(__('Translations for %s'), $language_item_name);
320
+				$skin->feedback(sprintf(__('Updating translations for %1$s (%2$s)&#8230;'), $language_item_name, $item->language));
321 321
 				break;
322 322
 		}
323 323
 
324 324
 		$allow_relaxed_file_ownership = false;
325
-		if ( 'core' == $type && isset( $item->new_files ) && ! $item->new_files ) {
325
+		if ('core' == $type && isset($item->new_files) && ! $item->new_files) {
326 326
 			$allow_relaxed_file_ownership = true;
327 327
 		}
328 328
 
329 329
 		// Boom, This sites about to get a whole new splash of paint!
330
-		$upgrade_result = $upgrader->upgrade( $upgrader_item, array(
330
+		$upgrade_result = $upgrader->upgrade($upgrader_item, array(
331 331
 			'clear_update_cache' => false,
332 332
 			// Always use partial builds if possible for core updates.
333 333
 			'pre_check_md5'      => false,
@@ -335,28 +335,28 @@  discard block
 block discarded – undo
335 335
 			'attempt_rollback'   => true,
336 336
 			// Allow relaxed file ownership in some scenarios
337 337
 			'allow_relaxed_file_ownership' => $allow_relaxed_file_ownership,
338
-		) );
338
+		));
339 339
 
340 340
 		// If the filesystem is unavailable, false is returned.
341
-		if ( false === $upgrade_result ) {
342
-			$upgrade_result = new WP_Error( 'fs_unavailable', __( 'Could not access filesystem.' ) );
341
+		if (false === $upgrade_result) {
342
+			$upgrade_result = new WP_Error('fs_unavailable', __('Could not access filesystem.'));
343 343
 		}
344 344
 
345
-		if ( 'core' == $type ) {
346
-			if ( is_wp_error( $upgrade_result ) && ( 'up_to_date' == $upgrade_result->get_error_code() || 'locked' == $upgrade_result->get_error_code() ) ) {
345
+		if ('core' == $type) {
346
+			if (is_wp_error($upgrade_result) && ('up_to_date' == $upgrade_result->get_error_code() || 'locked' == $upgrade_result->get_error_code())) {
347 347
 				// These aren't actual errors, treat it as a skipped-update instead to avoid triggering the post-core update failure routines.
348 348
 				return false;
349 349
 			}
350 350
 
351 351
 			// Core doesn't output this, so let's append it so we don't get confused.
352
-			if ( is_wp_error( $upgrade_result ) ) {
353
-				$skin->error( __( 'Installation Failed' ), $upgrade_result );
352
+			if (is_wp_error($upgrade_result)) {
353
+				$skin->error(__('Installation Failed'), $upgrade_result);
354 354
 			} else {
355
-				$skin->feedback( __( 'WordPress updated successfully' ) );
355
+				$skin->feedback(__('WordPress updated successfully'));
356 356
 			}
357 357
 		}
358 358
 
359
-		$this->update_results[ $type ][] = (object) array(
359
+		$this->update_results[$type][] = (object) array(
360 360
 			'item'     => $item,
361 361
 			'result'   => $upgrade_result,
362 362
 			'name'     => $item_name,
@@ -373,38 +373,38 @@  discard block
 block discarded – undo
373 373
 	 * @access public
374 374
 	 */
375 375
 	public function run() {
376
-		if ( $this->is_disabled() )
376
+		if ($this->is_disabled())
377 377
 			return;
378 378
 
379
-		if ( ! is_main_network() || ! is_main_site() )
379
+		if ( ! is_main_network() || ! is_main_site())
380 380
 			return;
381 381
 
382
-		if ( ! WP_Upgrader::create_lock( 'auto_updater' ) )
382
+		if ( ! WP_Upgrader::create_lock('auto_updater'))
383 383
 			return;
384 384
 
385 385
 		// Don't automatically run these thins, as we'll handle it ourselves
386
-		remove_action( 'upgrader_process_complete', array( 'Language_Pack_Upgrader', 'async_upgrade' ), 20 );
387
-		remove_action( 'upgrader_process_complete', 'wp_version_check' );
388
-		remove_action( 'upgrader_process_complete', 'wp_update_plugins' );
389
-		remove_action( 'upgrader_process_complete', 'wp_update_themes' );
386
+		remove_action('upgrader_process_complete', array('Language_Pack_Upgrader', 'async_upgrade'), 20);
387
+		remove_action('upgrader_process_complete', 'wp_version_check');
388
+		remove_action('upgrader_process_complete', 'wp_update_plugins');
389
+		remove_action('upgrader_process_complete', 'wp_update_themes');
390 390
 
391 391
 		// Next, Plugins
392 392
 		wp_update_plugins(); // Check for Plugin updates
393
-		$plugin_updates = get_site_transient( 'update_plugins' );
394
-		if ( $plugin_updates && !empty( $plugin_updates->response ) ) {
395
-			foreach ( $plugin_updates->response as $plugin ) {
396
-				$this->update( 'plugin', $plugin );
393
+		$plugin_updates = get_site_transient('update_plugins');
394
+		if ($plugin_updates && ! empty($plugin_updates->response)) {
395
+			foreach ($plugin_updates->response as $plugin) {
396
+				$this->update('plugin', $plugin);
397 397
 			}
398 398
 			// Force refresh of plugin update information
399 399
 			wp_clean_plugins_cache();
400 400
 		}
401 401
 
402 402
 		// Next, those themes we all love
403
-		wp_update_themes();  // Check for Theme updates
404
-		$theme_updates = get_site_transient( 'update_themes' );
405
-		if ( $theme_updates && !empty( $theme_updates->response ) ) {
406
-			foreach ( $theme_updates->response as $theme ) {
407
-				$this->update( 'theme', (object) $theme );
403
+		wp_update_themes(); // Check for Theme updates
404
+		$theme_updates = get_site_transient('update_themes');
405
+		if ($theme_updates && ! empty($theme_updates->response)) {
406
+			foreach ($theme_updates->response as $theme) {
407
+				$this->update('theme', (object) $theme);
408 408
 			}
409 409
 			// Force refresh of theme update information
410 410
 			wp_clean_themes_cache();
@@ -414,45 +414,45 @@  discard block
 block discarded – undo
414 414
 		wp_version_check(); // Check for Core updates
415 415
 		$core_update = find_core_auto_update();
416 416
 
417
-		if ( $core_update )
418
-			$this->update( 'core', $core_update );
417
+		if ($core_update)
418
+			$this->update('core', $core_update);
419 419
 
420 420
 		// Clean up, and check for any pending translations
421 421
 		// (Core_Upgrader checks for core updates)
422 422
 		$theme_stats = array();
423
-		if ( isset( $this->update_results['theme'] ) ) {
424
-			foreach ( $this->update_results['theme'] as $upgrade ) {
425
-				$theme_stats[ $upgrade->item->theme ] = ( true === $upgrade->result );
423
+		if (isset($this->update_results['theme'])) {
424
+			foreach ($this->update_results['theme'] as $upgrade) {
425
+				$theme_stats[$upgrade->item->theme] = (true === $upgrade->result);
426 426
 			}
427 427
 		}
428
-		wp_update_themes( $theme_stats );  // Check for Theme updates
428
+		wp_update_themes($theme_stats); // Check for Theme updates
429 429
 
430 430
 		$plugin_stats = array();
431
-		if ( isset( $this->update_results['plugin'] ) ) {
432
-			foreach ( $this->update_results['plugin'] as $upgrade ) {
433
-				$plugin_stats[ $upgrade->item->plugin ] = ( true === $upgrade->result );
431
+		if (isset($this->update_results['plugin'])) {
432
+			foreach ($this->update_results['plugin'] as $upgrade) {
433
+				$plugin_stats[$upgrade->item->plugin] = (true === $upgrade->result);
434 434
 			}
435 435
 		}
436
-		wp_update_plugins( $plugin_stats ); // Check for Plugin updates
436
+		wp_update_plugins($plugin_stats); // Check for Plugin updates
437 437
 
438 438
 		// Finally, Process any new translations
439 439
 		$language_updates = wp_get_translation_updates();
440
-		if ( $language_updates ) {
441
-			foreach ( $language_updates as $update ) {
442
-				$this->update( 'translation', $update );
440
+		if ($language_updates) {
441
+			foreach ($language_updates as $update) {
442
+				$this->update('translation', $update);
443 443
 			}
444 444
 
445 445
 			// Clear existing caches
446 446
 			wp_clean_update_cache();
447 447
 
448
-			wp_version_check();  // check for Core updates
449
-			wp_update_themes();  // Check for Theme updates
448
+			wp_version_check(); // check for Core updates
449
+			wp_update_themes(); // Check for Theme updates
450 450
 			wp_update_plugins(); // Check for Plugin updates
451 451
 		}
452 452
 
453 453
 		// Send debugging email to all development installs.
454
-		if ( ! empty( $this->update_results ) ) {
455
-			$development_version = false !== strpos( get_bloginfo( 'version' ), '-' );
454
+		if ( ! empty($this->update_results)) {
455
+			$development_version = false !== strpos(get_bloginfo('version'), '-');
456 456
 
457 457
 			/**
458 458
 			 * Filters whether to send a debugging email for each automatic background update.
@@ -463,11 +463,11 @@  discard block
 block discarded – undo
463 463
 			 *                                  install is a development version.
464 464
 			 *                                  Return false to avoid the email.
465 465
 			 */
466
-			if ( apply_filters( 'automatic_updates_send_debug_email', $development_version ) )
466
+			if (apply_filters('automatic_updates_send_debug_email', $development_version))
467 467
 				$this->send_debug_email();
468 468
 
469
-			if ( ! empty( $this->update_results['core'] ) )
470
-				$this->after_core_update( $this->update_results['core'][0] );
469
+			if ( ! empty($this->update_results['core']))
470
+				$this->after_core_update($this->update_results['core'][0]);
471 471
 
472 472
 			/**
473 473
 			 * Fires after all automatic updates have run.
@@ -476,10 +476,10 @@  discard block
 block discarded – undo
476 476
 			 *
477 477
 			 * @param array $update_results The results of all attempted updates.
478 478
 			 */
479
-			do_action( 'automatic_updates_complete', $this->update_results );
479
+			do_action('automatic_updates_complete', $this->update_results);
480 480
 		}
481 481
 
482
-		WP_Upgrader::release_lock( 'auto_updater' );
482
+		WP_Upgrader::release_lock('auto_updater');
483 483
 	}
484 484
 
485 485
 	/**
@@ -491,14 +491,14 @@  discard block
 block discarded – undo
491 491
 	 *
492 492
 	 * @param object $update_result The result of the core update. Includes the update offer and result.
493 493
 	 */
494
-	protected function after_core_update( $update_result ) {
495
-		$wp_version = get_bloginfo( 'version' );
494
+	protected function after_core_update($update_result) {
495
+		$wp_version = get_bloginfo('version');
496 496
 
497 497
 		$core_update = $update_result->item;
498 498
 		$result      = $update_result->result;
499 499
 
500
-		if ( ! is_wp_error( $result ) ) {
501
-			$this->send_email( 'success', $core_update );
500
+		if ( ! is_wp_error($result)) {
501
+			$this->send_email('success', $core_update);
502 502
 			return;
503 503
 		}
504 504
 
@@ -507,17 +507,17 @@  discard block
 block discarded – undo
507 507
 		// Any of these WP_Error codes are critical failures, as in they occurred after we started to copy core files.
508 508
 		// We should not try to perform a background update again until there is a successful one-click update performed by the user.
509 509
 		$critical = false;
510
-		if ( $error_code === 'disk_full' || false !== strpos( $error_code, '__copy_dir' ) ) {
510
+		if ($error_code === 'disk_full' || false !== strpos($error_code, '__copy_dir')) {
511 511
 			$critical = true;
512
-		} elseif ( $error_code === 'rollback_was_required' && is_wp_error( $result->get_error_data()->rollback ) ) {
512
+		} elseif ($error_code === 'rollback_was_required' && is_wp_error($result->get_error_data()->rollback)) {
513 513
 			// A rollback is only critical if it failed too.
514 514
 			$critical = true;
515 515
 			$rollback_result = $result->get_error_data()->rollback;
516
-		} elseif ( false !== strpos( $error_code, 'do_rollback' ) ) {
516
+		} elseif (false !== strpos($error_code, 'do_rollback')) {
517 517
 			$critical = true;
518 518
 		}
519 519
 
520
-		if ( $critical ) {
520
+		if ($critical) {
521 521
 			$critical_data = array(
522 522
 				'attempted'  => $core_update->current,
523 523
 				'current'    => $wp_version,
@@ -526,12 +526,12 @@  discard block
 block discarded – undo
526 526
 				'timestamp'  => time(),
527 527
 				'critical'   => true,
528 528
 			);
529
-			if ( isset( $rollback_result ) ) {
529
+			if (isset($rollback_result)) {
530 530
 				$critical_data['rollback_code'] = $rollback_result->get_error_code();
531 531
 				$critical_data['rollback_data'] = $rollback_result->get_error_data();
532 532
 			}
533
-			update_site_option( 'auto_core_update_failed', $critical_data );
534
-			$this->send_email( 'critical', $core_update, $result );
533
+			update_site_option('auto_core_update_failed', $critical_data);
534
+			$this->send_email('critical', $core_update, $result);
535 535
 			return;
536 536
 		}
537 537
 
@@ -547,28 +547,28 @@  discard block
 block discarded – undo
547 547
 		 * the issue could actually be on WordPress.org's side.) If that one fails, then email.
548 548
 		 */
549 549
 		$send = true;
550
-  		$transient_failures = array( 'incompatible_archive', 'download_failed', 'insane_distro', 'locked' );
551
-  		if ( in_array( $error_code, $transient_failures ) && ! get_site_option( 'auto_core_update_failed' ) ) {
552
-  			wp_schedule_single_event( time() + HOUR_IN_SECONDS, 'wp_maybe_auto_update' );
550
+  		$transient_failures = array('incompatible_archive', 'download_failed', 'insane_distro', 'locked');
551
+  		if (in_array($error_code, $transient_failures) && ! get_site_option('auto_core_update_failed')) {
552
+  			wp_schedule_single_event(time() + HOUR_IN_SECONDS, 'wp_maybe_auto_update');
553 553
   			$send = false;
554 554
   		}
555 555
 
556
-  		$n = get_site_option( 'auto_core_update_notified' );
556
+  		$n = get_site_option('auto_core_update_notified');
557 557
 		// Don't notify if we've already notified the same email address of the same version of the same notification type.
558
-		if ( $n && 'fail' == $n['type'] && $n['email'] == get_site_option( 'admin_email' ) && $n['version'] == $core_update->current )
558
+		if ($n && 'fail' == $n['type'] && $n['email'] == get_site_option('admin_email') && $n['version'] == $core_update->current)
559 559
 			$send = false;
560 560
 
561
-		update_site_option( 'auto_core_update_failed', array(
561
+		update_site_option('auto_core_update_failed', array(
562 562
 			'attempted'  => $core_update->current,
563 563
 			'current'    => $wp_version,
564 564
 			'error_code' => $error_code,
565 565
 			'error_data' => $result->get_error_data(),
566 566
 			'timestamp'  => time(),
567
-			'retry'      => in_array( $error_code, $transient_failures ),
568
-		) );
567
+			'retry'      => in_array($error_code, $transient_failures),
568
+		));
569 569
 
570
-		if ( $send )
571
-			$this->send_email( 'fail', $core_update, $result );
570
+		if ($send)
571
+			$this->send_email('fail', $core_update, $result);
572 572
 	}
573 573
 
574 574
 	/**
@@ -581,19 +581,19 @@  discard block
 block discarded – undo
581 581
 	 * @param object $core_update The update offer that was attempted.
582 582
 	 * @param mixed  $result      Optional. The result for the core update. Can be WP_Error.
583 583
 	 */
584
-	protected function send_email( $type, $core_update, $result = null ) {
585
-		update_site_option( 'auto_core_update_notified', array(
584
+	protected function send_email($type, $core_update, $result = null) {
585
+		update_site_option('auto_core_update_notified', array(
586 586
 			'type'      => $type,
587
-			'email'     => get_site_option( 'admin_email' ),
587
+			'email'     => get_site_option('admin_email'),
588 588
 			'version'   => $core_update->current,
589 589
 			'timestamp' => time(),
590
-		) );
590
+		));
591 591
 
592 592
 		$next_user_core_update = get_preferred_from_update_core();
593 593
 		// If the update transient is empty, use the update we just performed
594
-		if ( ! $next_user_core_update )
594
+		if ( ! $next_user_core_update)
595 595
 			$next_user_core_update = $core_update;
596
-		$newer_version_available = ( 'upgrade' == $next_user_core_update->response && version_compare( $next_user_core_update->version, $core_update->version, '>' ) );
596
+		$newer_version_available = ('upgrade' == $next_user_core_update->response && version_compare($next_user_core_update->version, $core_update->version, '>'));
597 597
 
598 598
 		/**
599 599
 		 * Filters whether to send an email following an automatic background core update.
@@ -606,24 +606,24 @@  discard block
 block discarded – undo
606 606
 		 * @param object $core_update The update offer that was attempted.
607 607
 		 * @param mixed  $result      The result for the core update. Can be WP_Error.
608 608
 		 */
609
-		if ( 'manual' !== $type && ! apply_filters( 'auto_core_update_send_email', true, $type, $core_update, $result ) )
609
+		if ('manual' !== $type && ! apply_filters('auto_core_update_send_email', true, $type, $core_update, $result))
610 610
 			return;
611 611
 
612
-		switch ( $type ) {
612
+		switch ($type) {
613 613
 			case 'success' : // We updated.
614 614
 				/* translators: 1: Site name, 2: WordPress version number. */
615
-				$subject = __( '[%1$s] Your site has updated to WordPress %2$s' );
615
+				$subject = __('[%1$s] Your site has updated to WordPress %2$s');
616 616
 				break;
617 617
 
618 618
 			case 'fail' :   // We tried to update but couldn't.
619 619
 			case 'manual' : // We can't update (and made no attempt).
620 620
 				/* translators: 1: Site name, 2: WordPress version number. */
621
-				$subject = __( '[%1$s] WordPress %2$s is available. Please update!' );
621
+				$subject = __('[%1$s] WordPress %2$s is available. Please update!');
622 622
 				break;
623 623
 
624 624
 			case 'critical' : // We tried to update, started to copy files, then things went wrong.
625 625
 				/* translators: 1: Site name. */
626
-				$subject = __( '[%1$s] URGENT: Your site may be down due to a failed update' );
626
+				$subject = __('[%1$s] URGENT: Your site may be down due to a failed update');
627 627
 				break;
628 628
 
629 629
 			default :
@@ -632,118 +632,118 @@  discard block
 block discarded – undo
632 632
 
633 633
 		// If the auto update is not to the latest version, say that the current version of WP is available instead.
634 634
 		$version = 'success' === $type ? $core_update->current : $next_user_core_update->current;
635
-		$subject = sprintf( $subject, wp_specialchars_decode( get_option( 'blogname' ), ENT_QUOTES ), $version );
635
+		$subject = sprintf($subject, wp_specialchars_decode(get_option('blogname'), ENT_QUOTES), $version);
636 636
 
637 637
 		$body = '';
638 638
 
639
-		switch ( $type ) {
639
+		switch ($type) {
640 640
 			case 'success' :
641
-				$body .= sprintf( __( 'Howdy! Your site at %1$s has been updated automatically to WordPress %2$s.' ), home_url(), $core_update->current );
641
+				$body .= sprintf(__('Howdy! Your site at %1$s has been updated automatically to WordPress %2$s.'), home_url(), $core_update->current);
642 642
 				$body .= "\n\n";
643
-				if ( ! $newer_version_available )
644
-					$body .= __( 'No further action is needed on your part.' ) . ' ';
643
+				if ( ! $newer_version_available)
644
+					$body .= __('No further action is needed on your part.').' ';
645 645
 
646 646
 				// Can only reference the About screen if their update was successful.
647
-				list( $about_version ) = explode( '-', $core_update->current, 2 );
648
-				$body .= sprintf( __( "For more on version %s, see the About WordPress screen:" ), $about_version );
649
-				$body .= "\n" . admin_url( 'about.php' );
650
-
651
-				if ( $newer_version_available ) {
652
-					$body .= "\n\n" . sprintf( __( 'WordPress %s is also now available.' ), $next_user_core_update->current ) . ' ';
653
-					$body .= __( 'Updating is easy and only takes a few moments:' );
654
-					$body .= "\n" . network_admin_url( 'update-core.php' );
647
+				list($about_version) = explode('-', $core_update->current, 2);
648
+				$body .= sprintf(__("For more on version %s, see the About WordPress screen:"), $about_version);
649
+				$body .= "\n".admin_url('about.php');
650
+
651
+				if ($newer_version_available) {
652
+					$body .= "\n\n".sprintf(__('WordPress %s is also now available.'), $next_user_core_update->current).' ';
653
+					$body .= __('Updating is easy and only takes a few moments:');
654
+					$body .= "\n".network_admin_url('update-core.php');
655 655
 				}
656 656
 
657 657
 				break;
658 658
 
659 659
 			case 'fail' :
660 660
 			case 'manual' :
661
-				$body .= sprintf( __( 'Please update your site at %1$s to WordPress %2$s.' ), home_url(), $next_user_core_update->current );
661
+				$body .= sprintf(__('Please update your site at %1$s to WordPress %2$s.'), home_url(), $next_user_core_update->current);
662 662
 
663 663
 				$body .= "\n\n";
664 664
 
665 665
 				// Don't show this message if there is a newer version available.
666 666
 				// Potential for confusion, and also not useful for them to know at this point.
667
-				if ( 'fail' == $type && ! $newer_version_available )
668
-					$body .= __( 'We tried but were unable to update your site automatically.' ) . ' ';
667
+				if ('fail' == $type && ! $newer_version_available)
668
+					$body .= __('We tried but were unable to update your site automatically.').' ';
669 669
 
670
-				$body .= __( 'Updating is easy and only takes a few moments:' );
671
-				$body .= "\n" . network_admin_url( 'update-core.php' );
670
+				$body .= __('Updating is easy and only takes a few moments:');
671
+				$body .= "\n".network_admin_url('update-core.php');
672 672
 				break;
673 673
 
674 674
 			case 'critical' :
675
-				if ( $newer_version_available )
676
-					$body .= sprintf( __( 'Your site at %1$s experienced a critical failure while trying to update WordPress to version %2$s.' ), home_url(), $core_update->current );
675
+				if ($newer_version_available)
676
+					$body .= sprintf(__('Your site at %1$s experienced a critical failure while trying to update WordPress to version %2$s.'), home_url(), $core_update->current);
677 677
 				else
678
-					$body .= sprintf( __( 'Your site at %1$s experienced a critical failure while trying to update to the latest version of WordPress, %2$s.' ), home_url(), $core_update->current );
678
+					$body .= sprintf(__('Your site at %1$s experienced a critical failure while trying to update to the latest version of WordPress, %2$s.'), home_url(), $core_update->current);
679 679
 
680
-				$body .= "\n\n" . __( "This means your site may be offline or broken. Don't panic; this can be fixed." );
680
+				$body .= "\n\n".__("This means your site may be offline or broken. Don't panic; this can be fixed.");
681 681
 
682
-				$body .= "\n\n" . __( "Please check out your site now. It's possible that everything is working. If it says you need to update, you should do so:" );
683
-				$body .= "\n" . network_admin_url( 'update-core.php' );
682
+				$body .= "\n\n".__("Please check out your site now. It's possible that everything is working. If it says you need to update, you should do so:");
683
+				$body .= "\n".network_admin_url('update-core.php');
684 684
 				break;
685 685
 		}
686 686
 
687
-		$critical_support = 'critical' === $type && ! empty( $core_update->support_email );
688
-		if ( $critical_support ) {
687
+		$critical_support = 'critical' === $type && ! empty($core_update->support_email);
688
+		if ($critical_support) {
689 689
 			// Support offer if available.
690
-			$body .= "\n\n" . sprintf( __( "The WordPress team is willing to help you. Forward this email to %s and the team will work with you to make sure your site is working." ), $core_update->support_email );
690
+			$body .= "\n\n".sprintf(__("The WordPress team is willing to help you. Forward this email to %s and the team will work with you to make sure your site is working."), $core_update->support_email);
691 691
 		} else {
692 692
 			// Add a note about the support forums.
693
-			$body .= "\n\n" . __( 'If you experience any issues or need support, the volunteers in the WordPress.org support forums may be able to help.' );
694
-			$body .= "\n" . __( 'https://wordpress.org/support/' );
693
+			$body .= "\n\n".__('If you experience any issues or need support, the volunteers in the WordPress.org support forums may be able to help.');
694
+			$body .= "\n".__('https://wordpress.org/support/');
695 695
 		}
696 696
 
697 697
 		// Updates are important!
698
-		if ( $type != 'success' || $newer_version_available ) {
699
-			$body .= "\n\n" . __( 'Keeping your site updated is important for security. It also makes the internet a safer place for you and your readers.' );
698
+		if ($type != 'success' || $newer_version_available) {
699
+			$body .= "\n\n".__('Keeping your site updated is important for security. It also makes the internet a safer place for you and your readers.');
700 700
 		}
701 701
 
702
-		if ( $critical_support ) {
703
-			$body .= " " . __( "If you reach out to us, we'll also ensure you'll never have this problem again." );
702
+		if ($critical_support) {
703
+			$body .= " ".__("If you reach out to us, we'll also ensure you'll never have this problem again.");
704 704
 		}
705 705
 
706 706
 		// If things are successful and we're now on the latest, mention plugins and themes if any are out of date.
707
-		if ( $type == 'success' && ! $newer_version_available && ( get_plugin_updates() || get_theme_updates() ) ) {
708
-			$body .= "\n\n" . __( 'You also have some plugins or themes with updates available. Update them now:' );
709
-			$body .= "\n" . network_admin_url();
707
+		if ($type == 'success' && ! $newer_version_available && (get_plugin_updates() || get_theme_updates())) {
708
+			$body .= "\n\n".__('You also have some plugins or themes with updates available. Update them now:');
709
+			$body .= "\n".network_admin_url();
710 710
 		}
711 711
 
712
-		$body .= "\n\n" . __( 'The WordPress Team' ) . "\n";
712
+		$body .= "\n\n".__('The WordPress Team')."\n";
713 713
 
714
-		if ( 'critical' == $type && is_wp_error( $result ) ) {
714
+		if ('critical' == $type && is_wp_error($result)) {
715 715
 			$body .= "\n***\n\n";
716
-			$body .= sprintf( __( 'Your site was running version %s.' ), get_bloginfo( 'version' ) );
717
-			$body .= ' ' . __( 'We have some data that describes the error your site encountered.' );
718
-			$body .= ' ' . __( 'Your hosting company, support forum volunteers, or a friendly developer may be able to use this information to help you:' );
716
+			$body .= sprintf(__('Your site was running version %s.'), get_bloginfo('version'));
717
+			$body .= ' '.__('We have some data that describes the error your site encountered.');
718
+			$body .= ' '.__('Your hosting company, support forum volunteers, or a friendly developer may be able to use this information to help you:');
719 719
 
720 720
 			// If we had a rollback and we're still critical, then the rollback failed too.
721 721
 			// Loop through all errors (the main WP_Error, the update result, the rollback result) for code, data, etc.
722
-			if ( 'rollback_was_required' == $result->get_error_code() )
723
-				$errors = array( $result, $result->get_error_data()->update, $result->get_error_data()->rollback );
722
+			if ('rollback_was_required' == $result->get_error_code())
723
+				$errors = array($result, $result->get_error_data()->update, $result->get_error_data()->rollback);
724 724
 			else
725
-				$errors = array( $result );
725
+				$errors = array($result);
726 726
 
727
-			foreach ( $errors as $error ) {
728
-				if ( ! is_wp_error( $error ) )
727
+			foreach ($errors as $error) {
728
+				if ( ! is_wp_error($error))
729 729
 					continue;
730 730
 				$error_code = $error->get_error_code();
731
-				$body .= "\n\n" . sprintf( __( "Error code: %s" ), $error_code );
732
-				if ( 'rollback_was_required' == $error_code )
731
+				$body .= "\n\n".sprintf(__("Error code: %s"), $error_code);
732
+				if ('rollback_was_required' == $error_code)
733 733
 					continue;
734
-				if ( $error->get_error_message() )
735
-					$body .= "\n" . $error->get_error_message();
734
+				if ($error->get_error_message())
735
+					$body .= "\n".$error->get_error_message();
736 736
 				$error_data = $error->get_error_data();
737
-				if ( $error_data )
738
-					$body .= "\n" . implode( ', ', (array) $error_data );
737
+				if ($error_data)
738
+					$body .= "\n".implode(', ', (array) $error_data);
739 739
 			}
740 740
 			$body .= "\n";
741 741
 		}
742 742
 
743
-		$to  = get_site_option( 'admin_email' );
743
+		$to = get_site_option('admin_email');
744 744
 		$headers = '';
745 745
 
746
-		$email = compact( 'to', 'subject', 'body', 'headers' );
746
+		$email = compact('to', 'subject', 'body', 'headers');
747 747
 
748 748
 		/**
749 749
 		 * Filters the email sent following an automatic background core update.
@@ -764,9 +764,9 @@  discard block
 block discarded – undo
764 764
 		 * @param object $core_update The update offer that was attempted.
765 765
 		 * @param mixed  $result      The result for the core update. Can be WP_Error.
766 766
 		 */
767
-		$email = apply_filters( 'auto_core_update_email', $email, $type, $core_update, $result );
767
+		$email = apply_filters('auto_core_update_email', $email, $type, $core_update, $result);
768 768
 
769
-		wp_mail( $email['to'], wp_specialchars_decode( $email['subject'] ), $email['body'], $email['headers'] );
769
+		wp_mail($email['to'], wp_specialchars_decode($email['subject']), $email['body'], $email['headers']);
770 770
 	}
771 771
 
772 772
 	/**
@@ -777,55 +777,55 @@  discard block
 block discarded – undo
777 777
 	 */
778 778
 	protected function send_debug_email() {
779 779
 		$update_count = 0;
780
-		foreach ( $this->update_results as $type => $updates )
781
-			$update_count += count( $updates );
780
+		foreach ($this->update_results as $type => $updates)
781
+			$update_count += count($updates);
782 782
 
783 783
 		$body = array();
784 784
 		$failures = 0;
785 785
 
786
-		$body[] = sprintf( __( 'WordPress site: %s' ), network_home_url( '/' ) );
786
+		$body[] = sprintf(__('WordPress site: %s'), network_home_url('/'));
787 787
 
788 788
 		// Core
789
-		if ( isset( $this->update_results['core'] ) ) {
789
+		if (isset($this->update_results['core'])) {
790 790
 			$result = $this->update_results['core'][0];
791
-			if ( $result->result && ! is_wp_error( $result->result ) ) {
792
-				$body[] = sprintf( __( 'SUCCESS: WordPress was successfully updated to %s' ), $result->name );
791
+			if ($result->result && ! is_wp_error($result->result)) {
792
+				$body[] = sprintf(__('SUCCESS: WordPress was successfully updated to %s'), $result->name);
793 793
 			} else {
794
-				$body[] = sprintf( __( 'FAILED: WordPress failed to update to %s' ), $result->name );
794
+				$body[] = sprintf(__('FAILED: WordPress failed to update to %s'), $result->name);
795 795
 				$failures++;
796 796
 			}
797 797
 			$body[] = '';
798 798
 		}
799 799
 
800 800
 		// Plugins, Themes, Translations
801
-		foreach ( array( 'plugin', 'theme', 'translation' ) as $type ) {
802
-			if ( ! isset( $this->update_results[ $type ] ) )
801
+		foreach (array('plugin', 'theme', 'translation') as $type) {
802
+			if ( ! isset($this->update_results[$type]))
803 803
 				continue;
804
-			$success_items = wp_list_filter( $this->update_results[ $type ], array( 'result' => true ) );
805
-			if ( $success_items ) {
804
+			$success_items = wp_list_filter($this->update_results[$type], array('result' => true));
805
+			if ($success_items) {
806 806
 				$messages = array(
807
-					'plugin'      => __( 'The following plugins were successfully updated:' ),
808
-					'theme'       => __( 'The following themes were successfully updated:' ),
809
-					'translation' => __( 'The following translations were successfully updated:' ),
807
+					'plugin'      => __('The following plugins were successfully updated:'),
808
+					'theme'       => __('The following themes were successfully updated:'),
809
+					'translation' => __('The following translations were successfully updated:'),
810 810
 				);
811 811
 
812
-				$body[] = $messages[ $type ];
813
-				foreach ( wp_list_pluck( $success_items, 'name' ) as $name ) {
814
-					$body[] = ' * ' . sprintf( __( 'SUCCESS: %s' ), $name );
812
+				$body[] = $messages[$type];
813
+				foreach (wp_list_pluck($success_items, 'name') as $name) {
814
+					$body[] = ' * '.sprintf(__('SUCCESS: %s'), $name);
815 815
 				}
816 816
 			}
817
-			if ( $success_items != $this->update_results[ $type ] ) {
817
+			if ($success_items != $this->update_results[$type]) {
818 818
 				// Failed updates
819 819
 				$messages = array(
820
-					'plugin'      => __( 'The following plugins failed to update:' ),
821
-					'theme'       => __( 'The following themes failed to update:' ),
822
-					'translation' => __( 'The following translations failed to update:' ),
820
+					'plugin'      => __('The following plugins failed to update:'),
821
+					'theme'       => __('The following themes failed to update:'),
822
+					'translation' => __('The following translations failed to update:'),
823 823
 				);
824 824
 
825
-				$body[] = $messages[ $type ];
826
-				foreach ( $this->update_results[ $type ] as $item ) {
827
-					if ( ! $item->result || is_wp_error( $item->result ) ) {
828
-						$body[] = ' * ' . sprintf( __( 'FAILED: %s' ), $item->name );
825
+				$body[] = $messages[$type];
826
+				foreach ($this->update_results[$type] as $item) {
827
+					if ( ! $item->result || is_wp_error($item->result)) {
828
+						$body[] = ' * '.sprintf(__('FAILED: %s'), $item->name);
829 829
 						$failures++;
830 830
 					}
831 831
 				}
@@ -833,9 +833,9 @@  discard block
 block discarded – undo
833 833
 			$body[] = '';
834 834
 		}
835 835
 
836
-		$site_title = wp_specialchars_decode( get_bloginfo( 'name' ), ENT_QUOTES );
837
-		if ( $failures ) {
838
-			$body[] = trim( __(
836
+		$site_title = wp_specialchars_decode(get_bloginfo('name'), ENT_QUOTES);
837
+		if ($failures) {
838
+			$body[] = trim(__(
839 839
 "BETA TESTING?
840 840
 =============
841 841
 
@@ -845,46 +845,46 @@  discard block
 block discarded – undo
845 845
  * Open a thread in the support forums: https://wordpress.org/support/forum/alphabeta
846 846
  * Or, if you're comfortable writing a bug report: https://core.trac.wordpress.org/
847 847
 
848
-Thanks! -- The WordPress Team" ) );
848
+Thanks! -- The WordPress Team" ));
849 849
 			$body[] = '';
850 850
 
851
-			$subject = sprintf( __( '[%s] There were failures during background updates' ), $site_title );
851
+			$subject = sprintf(__('[%s] There were failures during background updates'), $site_title);
852 852
 		} else {
853
-			$subject = sprintf( __( '[%s] Background updates have finished' ), $site_title );
853
+			$subject = sprintf(__('[%s] Background updates have finished'), $site_title);
854 854
 		}
855 855
 
856
-		$body[] = trim( __(
856
+		$body[] = trim(__(
857 857
 'UPDATE LOG
858
-==========' ) );
858
+==========' ));
859 859
 		$body[] = '';
860 860
 
861
-		foreach ( array( 'core', 'plugin', 'theme', 'translation' ) as $type ) {
862
-			if ( ! isset( $this->update_results[ $type ] ) )
861
+		foreach (array('core', 'plugin', 'theme', 'translation') as $type) {
862
+			if ( ! isset($this->update_results[$type]))
863 863
 				continue;
864
-			foreach ( $this->update_results[ $type ] as $update ) {
864
+			foreach ($this->update_results[$type] as $update) {
865 865
 				$body[] = $update->name;
866
-				$body[] = str_repeat( '-', strlen( $update->name ) );
867
-				foreach ( $update->messages as $message )
868
-					$body[] = "  " . html_entity_decode( str_replace( '&#8230;', '...', $message ) );
869
-				if ( is_wp_error( $update->result ) ) {
870
-					$results = array( 'update' => $update->result );
866
+				$body[] = str_repeat('-', strlen($update->name));
867
+				foreach ($update->messages as $message)
868
+					$body[] = "  ".html_entity_decode(str_replace('&#8230;', '...', $message));
869
+				if (is_wp_error($update->result)) {
870
+					$results = array('update' => $update->result);
871 871
 					// If we rolled back, we want to know an error that occurred then too.
872
-					if ( 'rollback_was_required' === $update->result->get_error_code() )
872
+					if ('rollback_was_required' === $update->result->get_error_code())
873 873
 						$results = (array) $update->result->get_error_data();
874
-					foreach ( $results as $result_type => $result ) {
875
-						if ( ! is_wp_error( $result ) )
874
+					foreach ($results as $result_type => $result) {
875
+						if ( ! is_wp_error($result))
876 876
 							continue;
877 877
 
878
-						if ( 'rollback' === $result_type ) {
878
+						if ('rollback' === $result_type) {
879 879
 							/* translators: 1: Error code, 2: Error message. */
880
-							$body[] = '  ' . sprintf( __( 'Rollback Error: [%1$s] %2$s' ), $result->get_error_code(), $result->get_error_message() );
880
+							$body[] = '  '.sprintf(__('Rollback Error: [%1$s] %2$s'), $result->get_error_code(), $result->get_error_message());
881 881
 						} else {
882 882
 							/* translators: 1: Error code, 2: Error message. */
883
-							$body[] = '  ' . sprintf( __( 'Error: [%1$s] %2$s' ), $result->get_error_code(), $result->get_error_message() );
883
+							$body[] = '  '.sprintf(__('Error: [%1$s] %2$s'), $result->get_error_code(), $result->get_error_message());
884 884
 						}
885 885
 
886
-						if ( $result->get_error_data() )
887
-							$body[] = '         ' . implode( ', ', (array) $result->get_error_data() );
886
+						if ($result->get_error_data())
887
+							$body[] = '         '.implode(', ', (array) $result->get_error_data());
888 888
 					}
889 889
 				}
890 890
 				$body[] = '';
@@ -892,9 +892,9 @@  discard block
 block discarded – undo
892 892
 		}
893 893
 
894 894
 		$email = array(
895
-			'to'      => get_site_option( 'admin_email' ),
895
+			'to'      => get_site_option('admin_email'),
896 896
 			'subject' => $subject,
897
-			'body'    => implode( "\n", $body ),
897
+			'body'    => implode("\n", $body),
898 898
 			'headers' => ''
899 899
 		);
900 900
 
@@ -916,8 +916,8 @@  discard block
 block discarded – undo
916 916
 		 * @param int   $failures The number of failures encountered while upgrading.
917 917
 		 * @param mixed $results  The results of all attempted updates.
918 918
 		 */
919
-		$email = apply_filters( 'automatic_updates_debug_email', $email, $failures, $this->update_results );
919
+		$email = apply_filters('automatic_updates_debug_email', $email, $failures, $this->update_results);
920 920
 
921
-		wp_mail( $email['to'], wp_specialchars_decode( $email['subject'] ), $email['body'], $email['headers'] );
921
+		wp_mail($email['to'], wp_specialchars_decode($email['subject']), $email['body'], $email['headers']);
922 922
 	}
923 923
 }
Please login to merge, or discard this patch.
src/wp-admin/includes/admin-filters.php 1 patch
Spacing   +61 added lines, -61 removed lines patch added patch discarded remove patch
@@ -8,83 +8,83 @@  discard block
 block discarded – undo
8 8
  */
9 9
 
10 10
 // Bookmark hooks.
11
-add_action( 'admin_page_access_denied', 'wp_link_manager_disabled_message' );
11
+add_action('admin_page_access_denied', 'wp_link_manager_disabled_message');
12 12
 
13 13
 // Dashboard hooks.
14
-add_action( 'activity_box_end', 'wp_dashboard_quota' );
14
+add_action('activity_box_end', 'wp_dashboard_quota');
15 15
 
16 16
 // Media hooks.
17
-add_action( 'attachment_submitbox_misc_actions', 'attachment_submitbox_metadata' );
17
+add_action('attachment_submitbox_misc_actions', 'attachment_submitbox_metadata');
18 18
 
19
-add_action( 'media_upload_image', 'wp_media_upload_handler' );
20
-add_action( 'media_upload_audio', 'wp_media_upload_handler' );
21
-add_action( 'media_upload_video', 'wp_media_upload_handler' );
22
-add_action( 'media_upload_file',  'wp_media_upload_handler' );
19
+add_action('media_upload_image', 'wp_media_upload_handler');
20
+add_action('media_upload_audio', 'wp_media_upload_handler');
21
+add_action('media_upload_video', 'wp_media_upload_handler');
22
+add_action('media_upload_file', 'wp_media_upload_handler');
23 23
 
24
-add_action( 'post-plupload-upload-ui', 'media_upload_flash_bypass' );
24
+add_action('post-plupload-upload-ui', 'media_upload_flash_bypass');
25 25
 
26
-add_action( 'post-html-upload-ui', 'media_upload_html_bypass'  );
26
+add_action('post-html-upload-ui', 'media_upload_html_bypass');
27 27
 
28
-add_filter( 'async_upload_image', 'get_media_item', 10, 2 );
29
-add_filter( 'async_upload_audio', 'get_media_item', 10, 2 );
30
-add_filter( 'async_upload_video', 'get_media_item', 10, 2 );
31
-add_filter( 'async_upload_file',  'get_media_item', 10, 2 );
28
+add_filter('async_upload_image', 'get_media_item', 10, 2);
29
+add_filter('async_upload_audio', 'get_media_item', 10, 2);
30
+add_filter('async_upload_video', 'get_media_item', 10, 2);
31
+add_filter('async_upload_file', 'get_media_item', 10, 2);
32 32
 
33
-add_filter( 'attachment_fields_to_save', 'image_attachment_fields_to_save', 10, 2 );
33
+add_filter('attachment_fields_to_save', 'image_attachment_fields_to_save', 10, 2);
34 34
 
35
-add_filter( 'media_upload_gallery', 'media_upload_gallery' );
36
-add_filter( 'media_upload_library', 'media_upload_library' );
35
+add_filter('media_upload_gallery', 'media_upload_gallery');
36
+add_filter('media_upload_library', 'media_upload_library');
37 37
 
38
-add_filter( 'media_upload_tabs', 'update_gallery_tab' );
38
+add_filter('media_upload_tabs', 'update_gallery_tab');
39 39
 
40 40
 // Misc hooks.
41
-add_action( 'admin_head', 'wp_admin_canonical_url'   );
42
-add_action( 'admin_head', 'wp_color_scheme_settings' );
43
-add_action( 'admin_head', 'wp_site_icon'             );
44
-add_action( 'admin_head', '_ipad_meta'               );
41
+add_action('admin_head', 'wp_admin_canonical_url');
42
+add_action('admin_head', 'wp_color_scheme_settings');
43
+add_action('admin_head', 'wp_site_icon');
44
+add_action('admin_head', '_ipad_meta');
45 45
 
46 46
 // Prerendering.
47
-if ( ! is_customize_preview() ) {
48
-	add_filter( 'admin_print_styles', 'wp_resource_hints', 1 );
47
+if ( ! is_customize_preview()) {
48
+	add_filter('admin_print_styles', 'wp_resource_hints', 1);
49 49
 }
50 50
 
51
-add_action( 'admin_print_scripts-post.php',     'wp_page_reload_on_back_button_js' );
52
-add_action( 'admin_print_scripts-post-new.php', 'wp_page_reload_on_back_button_js' );
51
+add_action('admin_print_scripts-post.php', 'wp_page_reload_on_back_button_js');
52
+add_action('admin_print_scripts-post-new.php', 'wp_page_reload_on_back_button_js');
53 53
 
54
-add_action( 'update_option_home',          'update_home_siteurl', 10, 2 );
55
-add_action( 'update_option_siteurl',       'update_home_siteurl', 10, 2 );
56
-add_action( 'update_option_page_on_front', 'update_home_siteurl', 10, 2 );
54
+add_action('update_option_home', 'update_home_siteurl', 10, 2);
55
+add_action('update_option_siteurl', 'update_home_siteurl', 10, 2);
56
+add_action('update_option_page_on_front', 'update_home_siteurl', 10, 2);
57 57
 
58
-add_filter( 'heartbeat_received', 'wp_check_locked_posts',  10,  3 );
59
-add_filter( 'heartbeat_received', 'wp_refresh_post_lock',   10,  3 );
60
-add_filter( 'wp_refresh_nonces', 'wp_refresh_post_nonces', 10,  3 );
61
-add_filter( 'heartbeat_received', 'heartbeat_autosave',     500, 2 );
58
+add_filter('heartbeat_received', 'wp_check_locked_posts', 10, 3);
59
+add_filter('heartbeat_received', 'wp_refresh_post_lock', 10, 3);
60
+add_filter('wp_refresh_nonces', 'wp_refresh_post_nonces', 10, 3);
61
+add_filter('heartbeat_received', 'heartbeat_autosave', 500, 2);
62 62
 
63
-add_filter( 'heartbeat_settings', 'wp_heartbeat_set_suspension' );
63
+add_filter('heartbeat_settings', 'wp_heartbeat_set_suspension');
64 64
 
65 65
 // Nav Menu hooks.
66
-add_action( 'admin_head-nav-menus.php', '_wp_delete_orphaned_draft_menu_items' );
66
+add_action('admin_head-nav-menus.php', '_wp_delete_orphaned_draft_menu_items');
67 67
 
68 68
 // Plugin hooks.
69
-add_filter( 'whitelist_options', 'option_update_filter' );
69
+add_filter('whitelist_options', 'option_update_filter');
70 70
 
71 71
 // Plugin Install hooks.
72
-add_action( 'install_plugins_featured',               'install_dashboard' );
73
-add_action( 'install_plugins_upload',                 'install_plugins_upload' );
74
-add_action( 'install_plugins_search',                 'display_plugins_table' );
75
-add_action( 'install_plugins_popular',                'display_plugins_table' );
76
-add_action( 'install_plugins_recommended',            'display_plugins_table' );
77
-add_action( 'install_plugins_new',                    'display_plugins_table' );
78
-add_action( 'install_plugins_beta',                   'display_plugins_table' );
79
-add_action( 'install_plugins_favorites',              'display_plugins_table' );
80
-add_action( 'install_plugins_pre_plugin-information', 'install_plugin_information' );
72
+add_action('install_plugins_featured', 'install_dashboard');
73
+add_action('install_plugins_upload', 'install_plugins_upload');
74
+add_action('install_plugins_search', 'display_plugins_table');
75
+add_action('install_plugins_popular', 'display_plugins_table');
76
+add_action('install_plugins_recommended', 'display_plugins_table');
77
+add_action('install_plugins_new', 'display_plugins_table');
78
+add_action('install_plugins_beta', 'display_plugins_table');
79
+add_action('install_plugins_favorites', 'display_plugins_table');
80
+add_action('install_plugins_pre_plugin-information', 'install_plugin_information');
81 81
 
82 82
 // Template hooks.
83
-add_action( 'admin_enqueue_scripts', array( 'WP_Internal_Pointers', 'enqueue_scripts'                ) );
84
-add_action( 'user_register',         array( 'WP_Internal_Pointers', 'dismiss_pointers_for_new_users' ) );
83
+add_action('admin_enqueue_scripts', array('WP_Internal_Pointers', 'enqueue_scripts'));
84
+add_action('user_register', array('WP_Internal_Pointers', 'dismiss_pointers_for_new_users'));
85 85
 
86 86
 // Theme hooks.
87
-add_action( 'customize_controls_print_footer_scripts', 'customize_themes_print_templates' );
87
+add_action('customize_controls_print_footer_scripts', 'customize_themes_print_templates');
88 88
 
89 89
 // Theme Install hooks.
90 90
 // add_action('install_themes_dashboard', 'install_themes_dashboard');
@@ -93,29 +93,29 @@  discard block
 block discarded – undo
93 93
 // add_action('install_themes_featured', 'display_themes');
94 94
 // add_action('install_themes_new', 'display_themes');
95 95
 // add_action('install_themes_updated', 'display_themes');
96
-add_action( 'install_themes_pre_theme-information', 'install_theme_information' );
96
+add_action('install_themes_pre_theme-information', 'install_theme_information');
97 97
 
98 98
 // User hooks.
99
-add_action( 'admin_init', 'default_password_nag_handler' );
99
+add_action('admin_init', 'default_password_nag_handler');
100 100
 
101
-add_action( 'admin_notices', 'default_password_nag' );
101
+add_action('admin_notices', 'default_password_nag');
102 102
 
103
-add_action( 'profile_update', 'default_password_nag_edit_user', 10, 2 );
103
+add_action('profile_update', 'default_password_nag_edit_user', 10, 2);
104 104
 
105 105
 // Update hooks.
106
-add_action( 'load-plugins.php', 'wp_plugin_update_rows', 20 ); // After wp_update_plugins() is called.
107
-add_action( 'load-themes.php', 'wp_theme_update_rows', 20 ); // After wp_update_themes() is called.
106
+add_action('load-plugins.php', 'wp_plugin_update_rows', 20); // After wp_update_plugins() is called.
107
+add_action('load-themes.php', 'wp_theme_update_rows', 20); // After wp_update_themes() is called.
108 108
 
109
-add_action( 'admin_notices', 'update_nag',      3  );
110
-add_action( 'admin_notices', 'maintenance_nag', 10 );
109
+add_action('admin_notices', 'update_nag', 3);
110
+add_action('admin_notices', 'maintenance_nag', 10);
111 111
 
112
-add_filter( 'update_footer', 'core_update_footer' );
112
+add_filter('update_footer', 'core_update_footer');
113 113
 
114 114
 // Update Core hooks.
115
-add_action( '_core_updated_successfully', '_redirect_to_about_wordpress' );
115
+add_action('_core_updated_successfully', '_redirect_to_about_wordpress');
116 116
 
117 117
 // Upgrade hooks.
118
-add_action( 'upgrader_process_complete', array( 'Language_Pack_Upgrader', 'async_upgrade' ), 20 );
119
-add_action( 'upgrader_process_complete', 'wp_version_check', 10, 0 );
120
-add_action( 'upgrader_process_complete', 'wp_update_plugins', 10, 0 );
121
-add_action( 'upgrader_process_complete', 'wp_update_themes', 10, 0 );
118
+add_action('upgrader_process_complete', array('Language_Pack_Upgrader', 'async_upgrade'), 20);
119
+add_action('upgrader_process_complete', 'wp_version_check', 10, 0);
120
+add_action('upgrader_process_complete', 'wp_update_plugins', 10, 0);
121
+add_action('upgrader_process_complete', 'wp_update_themes', 10, 0);
Please login to merge, or discard this patch.