Completed
Push — master ( fdb3a7...cde0c6 )
by Stephen
20:18
created
src/wp-admin/update.php 1 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 1 patch
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.
src/wp-admin/import.php 1 patch
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.
src/wp-admin/options.php 1 patch
Braces   +38 added lines, -24 removed lines patch added patch discarded remove patch
@@ -93,8 +93,9 @@  discard block
 block discarded – undo
93 93
 
94 94
 $mail_options = array('mailserver_url', 'mailserver_port', 'mailserver_login', 'mailserver_pass');
95 95
 
96
-if ( ! in_array( get_option( 'blog_charset' ), array( 'utf8', 'utf-8', 'UTF8', 'UTF-8' ) ) )
96
+if ( ! in_array( get_option( 'blog_charset' ), array( 'utf8', 'utf-8', 'UTF8', 'UTF-8' ) ) ) {
97 97
 	$whitelist_options['reading'][] = 'blog_charset';
98
+}
98 99
 
99 100
 if ( get_site_option( 'initial_db_version' ) < 32453 ) {
100 101
 	$whitelist_options['writing'][] = 'use_smilies';
@@ -102,10 +103,12 @@  discard block
 block discarded – undo
102 103
 }
103 104
 
104 105
 if ( !is_multisite() ) {
105
-	if ( !defined( 'WP_SITEURL' ) )
106
-		$whitelist_options['general'][] = 'siteurl';
107
-	if ( !defined( 'WP_HOME' ) )
108
-		$whitelist_options['general'][] = 'home';
106
+	if ( !defined( 'WP_SITEURL' ) ) {
107
+			$whitelist_options['general'][] = 'siteurl';
108
+	}
109
+	if ( !defined( 'WP_HOME' ) ) {
110
+			$whitelist_options['general'][] = 'home';
111
+	}
109 112
 
110 113
 	$whitelist_options['general'][] = 'admin_email';
111 114
 	$whitelist_options['general'][] = 'users_can_register';
@@ -131,9 +134,10 @@  discard block
 block discarded – undo
131 134
 	 *
132 135
 	 * @param bool $enabled Whether post-by-email configuration is enabled. Default true.
133 136
 	 */
134
-	if ( apply_filters( 'enable_post_by_email_configuration', true ) )
135
-		$whitelist_options['writing'] = array_merge($whitelist_options['writing'], $mail_options);
136
-}
137
+	if ( apply_filters( 'enable_post_by_email_configuration', true ) ) {
138
+			$whitelist_options['writing'] = array_merge($whitelist_options['writing'], $mail_options);
139
+	}
140
+	}
137 141
 
138 142
 /**
139 143
  * Filters the options white list.
@@ -156,12 +160,14 @@  discard block
 block discarded – undo
156 160
 		check_admin_referer( $option_page . '-options' );
157 161
 	}
158 162
 
159
-	if ( !isset( $whitelist_options[ $option_page ] ) )
160
-		wp_die( __( '<strong>ERROR</strong>: options page not found.' ) );
163
+	if ( !isset( $whitelist_options[ $option_page ] ) ) {
164
+			wp_die( __( '<strong>ERROR</strong>: options page not found.' ) );
165
+	}
161 166
 
162 167
 	if ( 'options' == $option_page ) {
163
-		if ( is_multisite() && ! is_super_admin() )
164
-			wp_die( __( 'Sorry, you are not allowed to modify unregistered settings for this site.' ) );
168
+		if ( is_multisite() && ! is_super_admin() ) {
169
+					wp_die( __( 'Sorry, you are not allowed to modify unregistered settings for this site.' ) );
170
+		}
165 171
 		$options = explode( ',', wp_unslash( $_POST[ 'page_options' ] ) );
166 172
 	} else {
167 173
 		$options = $whitelist_options[ $option_page ];
@@ -169,10 +175,12 @@  discard block
 block discarded – undo
169 175
 
170 176
 	if ( 'general' == $option_page ) {
171 177
 		// Handle custom date/time formats.
172
-		if ( !empty($_POST['date_format']) && isset($_POST['date_format_custom']) && '\c\u\s\t\o\m' == wp_unslash( $_POST['date_format'] ) )
173
-			$_POST['date_format'] = $_POST['date_format_custom'];
174
-		if ( !empty($_POST['time_format']) && isset($_POST['time_format_custom']) && '\c\u\s\t\o\m' == wp_unslash( $_POST['time_format'] ) )
175
-			$_POST['time_format'] = $_POST['time_format_custom'];
178
+		if ( !empty($_POST['date_format']) && isset($_POST['date_format_custom']) && '\c\u\s\t\o\m' == wp_unslash( $_POST['date_format'] ) ) {
179
+					$_POST['date_format'] = $_POST['date_format_custom'];
180
+		}
181
+		if ( !empty($_POST['time_format']) && isset($_POST['time_format_custom']) && '\c\u\s\t\o\m' == wp_unslash( $_POST['time_format'] ) ) {
182
+					$_POST['time_format'] = $_POST['time_format_custom'];
183
+		}
176 184
 		// Map UTC+- timezones to gmt_offsets and set timezone_string to empty.
177 185
 		if ( !empty($_POST['timezone_string']) && preg_match('/^UTC[+-]/', $_POST['timezone_string']) ) {
178 186
 			$_POST['gmt_offset'] = $_POST['timezone_string'];
@@ -209,8 +217,9 @@  discard block
 block discarded – undo
209 217
 			$value = null;
210 218
 			if ( isset( $_POST[ $option ] ) ) {
211 219
 				$value = $_POST[ $option ];
212
-				if ( ! is_array( $value ) )
213
-					$value = trim( $value );
220
+				if ( ! is_array( $value ) ) {
221
+									$value = trim( $value );
222
+				}
214 223
 				$value = wp_unslash( $value );
215 224
 			}
216 225
 			update_option( $option, $value );
@@ -229,8 +238,9 @@  discard block
 block discarded – undo
229 238
 	 * Handle settings errors and return to options page
230 239
 	 */
231 240
 	// If no settings errors were registered add a general 'updated' message.
232
-	if ( !count( get_settings_errors() ) )
233
-		add_settings_error('general', 'settings_updated', __('Settings saved.'), 'updated');
241
+	if ( !count( get_settings_errors() ) ) {
242
+			add_settings_error('general', 'settings_updated', __('Settings saved.'), 'updated');
243
+	}
234 244
 	set_transient('settings_errors', get_settings_errors(), 30);
235 245
 
236 246
 	/**
@@ -255,8 +265,9 @@  discard block
 block discarded – undo
255 265
 
256 266
 foreach ( (array) $options as $option ) :
257 267
 	$disabled = false;
258
-	if ( $option->option_name == '' )
259
-		continue;
268
+	if ( $option->option_name == '' ) {
269
+			continue;
270
+	}
260 271
 	if ( is_serialized( $option->option_value ) ) {
261 272
 		if ( is_serialized_string( $option->option_value ) ) {
262 273
 			// This is a serialized string, so we should display it.
@@ -282,11 +293,14 @@  discard block
 block discarded – undo
282 293
 	<textarea class="<?php echo $class ?>" name="<?php echo $name ?>" id="<?php echo $name ?>" cols="30" rows="5"><?php
283 294
 		echo esc_textarea( $value );
284 295
 	?></textarea>
285
-	<?php else: ?>
296
+	<?php else {
297
+	: ?>
286 298
 		<input class="regular-text <?php echo $class ?>" type="text" name="<?php echo $name ?>" id="<?php echo $name ?>" value="<?php echo esc_attr( $value ) ?>"<?php disabled( $disabled, true ) ?> />
287 299
 	<?php endif ?></td>
288 300
 </tr>
289
-<?php endforeach; ?>
301
+<?php endforeach;
302
+}
303
+?>
290 304
   </table>
291 305
 
292 306
 <input type="hidden" name="page_options" value="<?php echo esc_attr( implode( ',', $options_to_update ) ); ?>" />
Please login to merge, or discard this patch.
src/wp-admin/network/user-new.php 1 patch
Braces   +17 added lines, -11 removed lines patch added patch discarded remove patch
@@ -10,11 +10,13 @@  discard block
 block discarded – undo
10 10
 /** Load WordPress Administration Bootstrap */
11 11
 require_once( dirname( __FILE__ ) . '/admin.php' );
12 12
 
13
-if ( ! is_multisite() )
13
+if ( ! is_multisite() ) {
14 14
 	wp_die( __( 'Multisite support is not enabled.' ) );
15
+}
15 16
 
16
-if ( ! current_user_can('create_users') )
17
+if ( ! current_user_can('create_users') ) {
17 18
 	wp_die(__('Sorry, you are not allowed to add users to this network.'));
19
+}
18 20
 
19 21
 get_current_screen()->add_help_tab( array(
20 22
 	'id'      => 'overview',
@@ -33,11 +35,13 @@  discard block
 block discarded – undo
33 35
 if ( isset($_REQUEST['action']) && 'add-user' == $_REQUEST['action'] ) {
34 36
 	check_admin_referer( 'add-user', '_wpnonce_add-user' );
35 37
 
36
-	if ( ! current_user_can( 'manage_network_users' ) )
37
-		wp_die( __( 'Sorry, you are not allowed to access this page.' ), 403 );
38
+	if ( ! current_user_can( 'manage_network_users' ) ) {
39
+			wp_die( __( 'Sorry, you are not allowed to access this page.' ), 403 );
40
+	}
38 41
 
39
-	if ( ! is_array( $_POST['user'] ) )
40
-		wp_die( __( 'Cannot create an empty user.' ) );
42
+	if ( ! is_array( $_POST['user'] ) ) {
43
+			wp_die( __( 'Cannot create an empty user.' ) );
44
+	}
41 45
 
42 46
 	$user = wp_unslash( $_POST['user'] );
43 47
 
@@ -94,15 +98,17 @@  discard block
 block discarded – undo
94 98
 <h1 id="add-new-user"><?php _e( 'Add New User' ); ?></h1>
95 99
 <?php
96 100
 if ( ! empty( $messages ) ) {
97
-	foreach ( $messages as $msg )
98
-		echo '<div id="message" class="updated notice is-dismissible"><p>' . $msg . '</p></div>';
99
-}
101
+	foreach ( $messages as $msg ) {
102
+			echo '<div id="message" class="updated notice is-dismissible"><p>' . $msg . '</p></div>';
103
+	}
104
+	}
100 105
 
101 106
 if ( isset( $add_user_errors ) && is_wp_error( $add_user_errors ) ) { ?>
102 107
 	<div class="error">
103 108
 		<?php
104
-			foreach ( $add_user_errors->get_error_messages() as $message )
105
-				echo "<p>$message</p>";
109
+			foreach ( $add_user_errors->get_error_messages() as $message ) {
110
+							echo "<p>$message</p>";
111
+			}
106 112
 		?>
107 113
 	</div>
108 114
 <?php } ?>
Please login to merge, or discard this patch.
src/wp-admin/network/sites.php 1 patch
Braces   +14 added lines, -9 removed lines patch added patch discarded remove patch
@@ -10,11 +10,13 @@  discard block
 block discarded – undo
10 10
 /** Load WordPress Administration Bootstrap */
11 11
 require_once( dirname( __FILE__ ) . '/admin.php' );
12 12
 
13
-if ( ! is_multisite() )
13
+if ( ! is_multisite() ) {
14 14
 	wp_die( __( 'Multisite support is not enabled.' ) );
15
+}
15 16
 
16
-if ( ! current_user_can( 'manage_sites' ) )
17
+if ( ! current_user_can( 'manage_sites' ) ) {
17 18
 	wp_die( __( 'Sorry, you are not allowed to access this page.' ), 403 );
19
+}
18 20
 
19 21
 $wp_list_table = _get_list_table( 'WP_MS_Sites_List_Table' );
20 22
 $pagenum = $wp_list_table->get_pagenum();
@@ -125,8 +127,9 @@  discard block
 block discarded – undo
125 127
 	switch ( $_GET['action'] ) {
126 128
 
127 129
 		case 'deleteblog':
128
-			if ( ! current_user_can( 'delete_sites' ) )
129
-				wp_die( __( 'Sorry, you are not allowed to access this page.' ), '', array( 'response' => 403 ) );
130
+			if ( ! current_user_can( 'delete_sites' ) ) {
131
+							wp_die( __( 'Sorry, you are not allowed to access this page.' ), '', array( 'response' => 403 ) );
132
+			}
130 133
 
131 134
 			$updated_action = 'not_deleted';
132 135
 			if ( $id != '0' && $id != $current_site->blog_id && current_user_can( 'delete_site', $id ) ) {
@@ -143,8 +146,9 @@  discard block
 block discarded – undo
143 146
 					if ( $val != '0' && $val != $current_site->blog_id ) {
144 147
 						switch ( $doaction ) {
145 148
 							case 'delete':
146
-								if ( ! current_user_can( 'delete_site', $val ) )
147
-									wp_die( __( 'Sorry, you are not allowed to delete the site.' ) );
149
+								if ( ! current_user_can( 'delete_site', $val ) ) {
150
+																	wp_die( __( 'Sorry, you are not allowed to delete the site.' ) );
151
+								}
148 152
 
149 153
 								$updated_action = 'all_delete';
150 154
 								wpmu_delete_blog( $val, true );
@@ -272,9 +276,10 @@  discard block
 block discarded – undo
272 276
 		break;
273 277
 	}
274 278
 
275
-	if ( ! empty( $msg ) )
276
-		$msg = '<div class="updated" id="message notice is-dismissible"><p>' . $msg . '</p></div>';
277
-}
279
+	if ( ! empty( $msg ) ) {
280
+			$msg = '<div class="updated" id="message notice is-dismissible"><p>' . $msg . '</p></div>';
281
+	}
282
+	}
278 283
 
279 284
 $wp_list_table->prepare_items();
280 285
 
Please login to merge, or discard this patch.
src/wp-admin/network/users.php 1 patch
Braces   +44 added lines, -29 removed lines patch added patch discarded remove patch
@@ -10,11 +10,13 @@  discard block
 block discarded – undo
10 10
 /** Load WordPress Administration Bootstrap */
11 11
 require_once( dirname( __FILE__ ) . '/admin.php' );
12 12
 
13
-if ( ! is_multisite() )
13
+if ( ! is_multisite() ) {
14 14
 	wp_die( __( 'Multisite support is not enabled.' ) );
15
+}
15 16
 
16
-if ( ! current_user_can( 'manage_network_users' ) )
17
+if ( ! current_user_can( 'manage_network_users' ) ) {
17 18
 	wp_die( __( 'Sorry, you are not allowed to access this page.' ), 403 );
19
+}
18 20
 
19 21
 if ( isset( $_GET['action'] ) ) {
20 22
 	/** This action is documented in wp-admin/network/edit.php */
@@ -22,8 +24,9 @@  discard block
 block discarded – undo
22 24
 
23 25
 	switch ( $_GET['action'] ) {
24 26
 		case 'deleteuser':
25
-			if ( ! current_user_can( 'manage_network_users' ) )
26
-				wp_die( __( 'Sorry, you are not allowed to access this page.' ), 403 );
27
+			if ( ! current_user_can( 'manage_network_users' ) ) {
28
+							wp_die( __( 'Sorry, you are not allowed to access this page.' ), 403 );
29
+			}
27 30
 
28 31
 			check_admin_referer( 'deleteuser' );
29 32
 
@@ -43,8 +46,9 @@  discard block
 block discarded – undo
43 46
 			exit();
44 47
 
45 48
 		case 'allusers':
46
-			if ( !current_user_can( 'manage_network_users' ) )
47
-				wp_die( __( 'Sorry, you are not allowed to access this page.' ), 403 );
49
+			if ( !current_user_can( 'manage_network_users' ) ) {
50
+							wp_die( __( 'Sorry, you are not allowed to access this page.' ), 403 );
51
+			}
48 52
 
49 53
 			if ( ( isset( $_POST['action']) || isset($_POST['action2'] ) ) && isset( $_POST['allusers'] ) ) {
50 54
 				check_admin_referer( 'bulk-users-network' );
@@ -56,8 +60,9 @@  discard block
 block discarded – undo
56 60
 					if ( !empty( $user_id ) ) {
57 61
 						switch ( $doaction ) {
58 62
 							case 'delete':
59
-								if ( ! current_user_can( 'delete_users' ) )
60
-									wp_die( __( 'Sorry, you are not allowed to access this page.' ), 403 );
63
+								if ( ! current_user_can( 'delete_users' ) ) {
64
+																	wp_die( __( 'Sorry, you are not allowed to access this page.' ), 403 );
65
+								}
61 66
 								$title = __( 'Users' );
62 67
 								$parent_file = 'users.php';
63 68
 								require_once( ABSPATH . 'wp-admin/admin-header.php' );
@@ -69,14 +74,17 @@  discard block
 block discarded – undo
69 74
 
70 75
 							case 'spam':
71 76
 								$user = get_userdata( $user_id );
72
-								if ( is_super_admin( $user->ID ) )
73
-									wp_die( sprintf( __( 'Warning! User cannot be modified. The user %s is a network administrator.' ), esc_html( $user->user_login ) ) );
77
+								if ( is_super_admin( $user->ID ) ) {
78
+																	wp_die( sprintf( __( 'Warning! User cannot be modified. The user %s is a network administrator.' ), esc_html( $user->user_login ) ) );
79
+								}
74 80
 
75 81
 								$userfunction = 'all_spam';
76 82
 								$blogs = get_blogs_of_user( $user_id, true );
77 83
 								foreach ( (array) $blogs as $details ) {
78
-									if ( $details->userblog_id != $current_site->blog_id ) // main blog not a spam !
84
+									if ( $details->userblog_id != $current_site->blog_id ) {
85
+										// main blog not a spam !
79 86
 										update_blog_status( $details->userblog_id, 'spam', '1' );
87
+									}
80 88
 								}
81 89
 								update_user_status( $user_id, 'spam', '1' );
82 90
 							break;
@@ -84,8 +92,9 @@  discard block
 block discarded – undo
84 92
 							case 'notspam':
85 93
 								$userfunction = 'all_notspam';
86 94
 								$blogs = get_blogs_of_user( $user_id, true );
87
-								foreach ( (array) $blogs as $details )
88
-									update_blog_status( $details->userblog_id, 'spam', '0' );
95
+								foreach ( (array) $blogs as $details ) {
96
+																	update_blog_status( $details->userblog_id, 'spam', '0' );
97
+								}
89 98
 
90 99
 								update_user_status( $user_id, 'spam', '0' );
91 100
 							break;
@@ -97,43 +106,49 @@  discard block
 block discarded – undo
97 106
 			} else {
98 107
 				$location = network_admin_url( 'users.php' );
99 108
 
100
-				if ( ! empty( $_REQUEST['paged'] ) )
101
-					$location = add_query_arg( 'paged', (int) $_REQUEST['paged'], $location );
109
+				if ( ! empty( $_REQUEST['paged'] ) ) {
110
+									$location = add_query_arg( 'paged', (int) $_REQUEST['paged'], $location );
111
+				}
102 112
 				wp_redirect( $location );
103 113
 			}
104 114
 			exit();
105 115
 
106 116
 		case 'dodelete':
107 117
 			check_admin_referer( 'ms-users-delete' );
108
-			if ( ! ( current_user_can( 'manage_network_users' ) && current_user_can( 'delete_users' ) ) )
109
-				wp_die( __( 'Sorry, you are not allowed to access this page.' ), 403 );
118
+			if ( ! ( current_user_can( 'manage_network_users' ) && current_user_can( 'delete_users' ) ) ) {
119
+							wp_die( __( 'Sorry, you are not allowed to access this page.' ), 403 );
120
+			}
110 121
 
111 122
 			if ( ! empty( $_POST['blog'] ) && is_array( $_POST['blog'] ) ) {
112 123
 				foreach ( $_POST['blog'] as $id => $users ) {
113 124
 					foreach ( $users as $blogid => $user_id ) {
114
-						if ( ! current_user_can( 'delete_user', $id ) )
115
-							continue;
125
+						if ( ! current_user_can( 'delete_user', $id ) ) {
126
+													continue;
127
+						}
116 128
 
117
-						if ( ! empty( $_POST['delete'] ) && 'reassign' == $_POST['delete'][$blogid][$id] )
118
-							remove_user_from_blog( $id, $blogid, $user_id );
119
-						else
120
-							remove_user_from_blog( $id, $blogid );
129
+						if ( ! empty( $_POST['delete'] ) && 'reassign' == $_POST['delete'][$blogid][$id] ) {
130
+													remove_user_from_blog( $id, $blogid, $user_id );
131
+						} else {
132
+													remove_user_from_blog( $id, $blogid );
133
+						}
121 134
 					}
122 135
 				}
123 136
 			}
124 137
 			$i = 0;
125
-			if ( is_array( $_POST['user'] ) && ! empty( $_POST['user'] ) )
126
-				foreach ( $_POST['user'] as $id ) {
138
+			if ( is_array( $_POST['user'] ) && ! empty( $_POST['user'] ) ) {
139
+							foreach ( $_POST['user'] as $id ) {
127 140
 					if ( ! current_user_can( 'delete_user', $id ) )
128 141
 						continue;
142
+			}
129 143
 					wpmu_delete_user( $id );
130 144
 					$i++;
131 145
 				}
132 146
 
133
-			if ( $i == 1 )
134
-				$deletefunction = 'delete';
135
-			else
136
-				$deletefunction = 'all_delete';
147
+			if ( $i == 1 ) {
148
+							$deletefunction = 'delete';
149
+			} else {
150
+							$deletefunction = 'all_delete';
151
+			}
137 152
 
138 153
 			wp_redirect( add_query_arg( array( 'updated' => 'true', 'action' => $deletefunction ), network_admin_url( 'users.php' ) ) );
139 154
 			exit();
Please login to merge, or discard this patch.
src/wp-admin/media.php 1 patch
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.
src/wp-admin/custom-header.php 1 patch
Braces   +121 added lines, -91 removed lines patch added patch discarded remove patch
@@ -137,15 +137,17 @@  discard block
 block discarded – undo
137 137
 	 * @return int Current step
138 138
 	 */
139 139
 	public function step() {
140
-		if ( ! isset( $_GET['step'] ) )
141
-			return 1;
140
+		if ( ! isset( $_GET['step'] ) ) {
141
+					return 1;
142
+		}
142 143
 
143 144
 		$step = (int) $_GET['step'];
144 145
 		if ( $step < 1 || 3 < $step ||
145 146
 			( 2 == $step && ! wp_verify_nonce( $_REQUEST['_wpnonce-custom-header-upload'], 'custom-header-upload' ) ) ||
146 147
 			( 3 == $step && ! wp_verify_nonce( $_REQUEST['_wpnonce'], 'custom-header-crop-image' ) )
147
-		)
148
-			return 1;
148
+		) {
149
+					return 1;
150
+		}
149 151
 
150 152
 		return $step;
151 153
 	}
@@ -161,8 +163,9 @@  discard block
 block discarded – undo
161 163
 		if ( ( 1 == $step || 3 == $step ) ) {
162 164
 			wp_enqueue_media();
163 165
 			wp_enqueue_script( 'custom-header' );
164
-			if ( current_theme_supports( 'custom-header', 'header-text' ) )
165
-				wp_enqueue_script( 'wp-color-picker' );
166
+			if ( current_theme_supports( 'custom-header', 'header-text' ) ) {
167
+							wp_enqueue_script( 'wp-color-picker' );
168
+			}
166 169
 		} elseif ( 2 == $step ) {
167 170
 			wp_enqueue_script('imgareaselect');
168 171
 		}
@@ -176,10 +179,11 @@  discard block
 block discarded – undo
176 179
 	public function css_includes() {
177 180
 		$step = $this->step();
178 181
 
179
-		if ( ( 1 == $step || 3 == $step ) && current_theme_supports( 'custom-header', 'header-text' ) )
180
-			wp_enqueue_style( 'wp-color-picker' );
181
-		elseif ( 2 == $step )
182
-			wp_enqueue_style('imgareaselect');
182
+		if ( ( 1 == $step || 3 == $step ) && current_theme_supports( 'custom-header', 'header-text' ) ) {
183
+					wp_enqueue_style( 'wp-color-picker' );
184
+		} elseif ( 2 == $step ) {
185
+					wp_enqueue_style('imgareaselect');
186
+		}
183 187
 	}
184 188
 
185 189
 	/**
@@ -188,11 +192,13 @@  discard block
 block discarded – undo
188 192
 	 * @since 2.6.0
189 193
 	 */
190 194
 	public function take_action() {
191
-		if ( ! current_user_can('edit_theme_options') )
192
-			return;
195
+		if ( ! current_user_can('edit_theme_options') ) {
196
+					return;
197
+		}
193 198
 
194
-		if ( empty( $_POST ) )
195
-			return;
199
+		if ( empty( $_POST ) ) {
200
+					return;
201
+		}
196 202
 
197 203
 		$this->updated = true;
198 204
 
@@ -215,10 +221,11 @@  discard block
 block discarded – undo
215 221
 			check_admin_referer( 'custom-header-options', '_wpnonce-custom-header-options' );
216 222
 			$_POST['text-color'] = str_replace( '#', '', $_POST['text-color'] );
217 223
 			$color = preg_replace('/[^0-9a-fA-F]/', '', $_POST['text-color']);
218
-			if ( strlen($color) == 6 || strlen($color) == 3 )
219
-				set_theme_mod('header_textcolor', $color);
220
-			elseif ( ! $color )
221
-				set_theme_mod( 'header_textcolor', 'blank' );
224
+			if ( strlen($color) == 6 || strlen($color) == 3 ) {
225
+							set_theme_mod('header_textcolor', $color);
226
+			} elseif ( ! $color ) {
227
+							set_theme_mod( 'header_textcolor', 'blank' );
228
+			}
222 229
 		}
223 230
 
224 231
 		if ( isset( $_POST['default-header'] ) ) {
@@ -238,8 +245,9 @@  discard block
 block discarded – undo
238 245
 	public function process_default_headers() {
239 246
 		global $_wp_default_headers;
240 247
 
241
-		if ( !isset($_wp_default_headers) )
242
-			return;
248
+		if ( !isset($_wp_default_headers) ) {
249
+					return;
250
+		}
243 251
 
244 252
 		if ( ! empty( $this->default_headers ) ) {
245 253
 			return;
@@ -289,8 +297,9 @@  discard block
 block discarded – undo
289 297
 			echo '<div class="default-header">';
290 298
 			echo '<label><input name="default-header" type="radio" value="' . esc_attr( $header_key ) . '" ' . checked( $header_url, get_theme_mod( 'header_image' ), false ) . ' />';
291 299
 			$width = '';
292
-			if ( !empty( $header['attachment_id'] ) )
293
-				$width = ' width="230"';
300
+			if ( !empty( $header['attachment_id'] ) ) {
301
+							$width = ' width="230"';
302
+			}
294 303
 			echo '<img src="' . set_url_scheme( $header_thumbnail ) . '" alt="' . esc_attr( $header_alt_text ) .'"' . $width . ' /></label>';
295 304
 			echo '</div>';
296 305
 		}
@@ -304,10 +313,11 @@  discard block
 block discarded – undo
304 313
 	 */
305 314
 	public function js() {
306 315
 		$step = $this->step();
307
-		if ( ( 1 == $step || 3 == $step ) && current_theme_supports( 'custom-header', 'header-text' ) )
308
-			$this->js_1();
309
-		elseif ( 2 == $step )
310
-			$this->js_2();
316
+		if ( ( 1 == $step || 3 == $step ) && current_theme_supports( 'custom-header', 'header-text' ) ) {
317
+					$this->js_1();
318
+		} elseif ( 2 == $step ) {
319
+					$this->js_2();
320
+		}
311 321
 	}
312 322
 
313 323
 	/**
@@ -492,21 +502,24 @@  discard block
 block discarded – undo
492 502
 
493 503
 		if ( $header_image ) {
494 504
 			$header_image_style = 'background-image:url(' . esc_url( $header_image ) . ');';
495
-		}  else {
505
+		} else {
496 506
 			$header_image_style = '';
497 507
 		}
498 508
 
499
-		if ( $custom_header->width )
500
-			$header_image_style .= 'max-width:' . $custom_header->width . 'px;';
501
-		if ( $custom_header->height )
502
-			$header_image_style .= 'height:' . $custom_header->height . 'px;';
509
+		if ( $custom_header->width ) {
510
+					$header_image_style .= 'max-width:' . $custom_header->width . 'px;';
511
+		}
512
+		if ( $custom_header->height ) {
513
+					$header_image_style .= 'height:' . $custom_header->height . 'px;';
514
+		}
503 515
 	?>
504 516
 	<div id="headimg" style="<?php echo $header_image_style; ?>">
505 517
 		<?php
506
-		if ( display_header_text() )
507
-			$style = ' style="color:#' . get_header_textcolor() . ';"';
508
-		else
509
-			$style = ' style="display:none;"';
518
+		if ( display_header_text() ) {
519
+					$style = ' style="color:#' . get_header_textcolor() . ';"';
520
+		} else {
521
+					$style = ' style="display:none;"';
522
+		}
510 523
 		?>
511 524
 		<h1><a id="name" class="displaying-header-text" <?php echo $style; ?> onclick="return false;" href="<?php bloginfo('url'); ?>" tabindex="-1"><?php bloginfo( 'name' ); ?></a></h1>
512 525
 		<div id="desc" class="displaying-header-text" <?php echo $style; ?>><?php bloginfo( 'description' ); ?></div>
@@ -525,8 +538,8 @@  discard block
 block discarded – undo
525 538
 	if ( ! current_theme_supports( 'custom-header', 'flex-height' ) && ! current_theme_supports( 'custom-header', 'flex-width' ) ) {
526 539
 		printf( __( 'Images of exactly <strong>%1$d &times; %2$d pixels</strong> will be used as-is.' ) . '<br />', get_theme_support( 'custom-header', 'width' ), get_theme_support( 'custom-header', 'height' ) );
527 540
 	} elseif ( current_theme_supports( 'custom-header', 'flex-height' ) ) {
528
-		if ( ! current_theme_supports( 'custom-header', 'flex-width' ) )
529
-			printf(
541
+		if ( ! current_theme_supports( 'custom-header', 'flex-width' ) ) {
542
+					printf(
530 543
 				/* translators: %s: size in pixels */
531 544
 				__( 'Images should be at least %s wide.' ) . ' ',
532 545
 				sprintf(
@@ -535,9 +548,10 @@  discard block
 block discarded – undo
535 548
 					get_theme_support( 'custom-header', 'width' )
536 549
 				)
537 550
 			);
551
+		}
538 552
 	} elseif ( current_theme_supports( 'custom-header', 'flex-width' ) ) {
539
-		if ( ! current_theme_supports( 'custom-header', 'flex-height' ) )
540
-			printf(
553
+		if ( ! current_theme_supports( 'custom-header', 'flex-height' ) ) {
554
+					printf(
541 555
 				/* translators: %s: size in pixels */
542 556
 				__( 'Images should be at least %s tall.' ) . ' ',
543 557
 				sprintf(
@@ -546,10 +560,11 @@  discard block
 block discarded – undo
546 560
 					get_theme_support( 'custom-header', 'height' )
547 561
 				)
548 562
 			);
563
+		}
549 564
 	}
550 565
 	if ( current_theme_supports( 'custom-header', 'flex-height' ) || current_theme_supports( 'custom-header', 'flex-width' ) ) {
551
-		if ( current_theme_supports( 'custom-header', 'width' ) )
552
-			printf(
566
+		if ( current_theme_supports( 'custom-header', 'width' ) ) {
567
+					printf(
553 568
 				/* translators: %s: size in pixels */
554 569
 				__( 'Suggested width is %s.' ) . ' ',
555 570
 				sprintf(
@@ -558,8 +573,9 @@  discard block
 block discarded – undo
558 573
 					get_theme_support( 'custom-header', 'width' )
559 574
 				)
560 575
 			);
561
-		if ( current_theme_supports( 'custom-header', 'height' ) )
562
-			printf(
576
+		}
577
+		if ( current_theme_supports( 'custom-header', 'height' ) ) {
578
+					printf(
563 579
 				/* translators: %s: size in pixels */
564 580
 				__( 'Suggested height is %s.' ) . ' ',
565 581
 				sprintf(
@@ -568,6 +584,7 @@  discard block
 block discarded – undo
568 584
 					get_theme_support( 'custom-header', 'height' )
569 585
 				)
570 586
 			);
587
+		}
571 588
 	}
572 589
 	?></p>
573 590
 	<form enctype="multipart/form-data" id="upload-form" class="wp-upload-form" method="post" action="<?php echo esc_url( add_query_arg( 'step', 2 ) ) ?>">
@@ -620,9 +637,12 @@  discard block
 block discarded – undo
620 637
 <td>
621 638
 <?php if ( current_theme_supports( 'custom-header', 'uploads' ) ) : ?>
622 639
 	<p><?php _e( 'If you don&lsquo;t want to upload your own image, you can use one of these cool headers, or show a random one.' ) ?></p>
623
-<?php else: ?>
640
+<?php else {
641
+	: ?>
624 642
 	<p><?php _e( 'You can use one of these cool headers or show a random one on each page.' ) ?></p>
625
-<?php endif; ?>
643
+<?php endif;
644
+}
645
+?>
626 646
 	<?php
627 647
 		$this->show_header_selector( 'default' );
628 648
 	?>
@@ -752,11 +772,13 @@  discard block
 block discarded – undo
752 772
 
753 773
 		$max_width = 0;
754 774
 		// For flex, limit size of image displayed to 1500px unless theme says otherwise
755
-		if ( current_theme_supports( 'custom-header', 'flex-width' ) )
756
-			$max_width = 1500;
775
+		if ( current_theme_supports( 'custom-header', 'flex-width' ) ) {
776
+					$max_width = 1500;
777
+		}
757 778
 
758
-		if ( current_theme_supports( 'custom-header', 'max-width' ) )
759
-			$max_width = max( $max_width, get_theme_support( 'custom-header', 'max-width' ) );
779
+		if ( current_theme_supports( 'custom-header', 'max-width' ) ) {
780
+					$max_width = max( $max_width, get_theme_support( 'custom-header', 'max-width' ) );
781
+		}
760 782
 		$max_width = max( $max_width, get_theme_support( 'custom-header', 'width' ) );
761 783
 
762 784
 		// If flexible height isn't supported and the image is the exact right size
@@ -764,8 +786,9 @@  discard block
 block discarded – undo
764 786
 			&& $width == get_theme_support( 'custom-header', 'width' ) && $height == get_theme_support( 'custom-header', 'height' ) )
765 787
 		{
766 788
 			// Add the meta-data
767
-			if ( file_exists( $file ) )
768
-				wp_update_attachment_metadata( $attachment_id, wp_generate_attachment_metadata( $attachment_id, $file ) );
789
+			if ( file_exists( $file ) ) {
790
+							wp_update_attachment_metadata( $attachment_id, wp_generate_attachment_metadata( $attachment_id, $file ) );
791
+			}
769 792
 
770 793
 			$this->set_header_image( compact( 'url', 'attachment_id', 'width', 'height' ) );
771 794
 
@@ -783,8 +806,9 @@  discard block
 block discarded – undo
783 806
 		} elseif ( $width > $max_width ) {
784 807
 			$oitar = $width / $max_width;
785 808
 			$image = wp_crop_image($attachment_id, 0, 0, $width, $height, $max_width, $height / $oitar, false, str_replace(basename($file), 'midsize-'.basename($file), $file));
786
-			if ( ! $image || is_wp_error( $image ) )
787
-				wp_die( __( 'Image could not be processed. Please go back and try again.' ), __( 'Image Processing Error' ) );
809
+			if ( ! $image || is_wp_error( $image ) ) {
810
+							wp_die( __( 'Image could not be processed. Please go back and try again.' ), __( 'Image Processing Error' ) );
811
+			}
788 812
 
789 813
 			/** This filter is documented in wp-admin/custom-header.php */
790 814
 			$image = apply_filters( 'wp_create_file_in_uploads', $image, $attachment_id ); // For replication
@@ -822,8 +846,9 @@  discard block
 block discarded – undo
822 846
 	<p class="submit">
823 847
 	<?php submit_button( __( 'Crop and Publish' ), 'primary', 'submit', false ); ?>
824 848
 	<?php
825
-	if ( isset( $oitar ) && 1 == $oitar && ( current_theme_supports( 'custom-header', 'flex-height' ) || current_theme_supports( 'custom-header', 'flex-width' ) ) )
826
-		submit_button( __( 'Skip Cropping, Publish Image as Is' ), 'secondary', 'skip-cropping', false );
849
+	if ( isset( $oitar ) && 1 == $oitar && ( current_theme_supports( 'custom-header', 'flex-height' ) || current_theme_supports( 'custom-header', 'flex-width' ) ) ) {
850
+			submit_button( __( 'Skip Cropping, Publish Image as Is' ), 'secondary', 'skip-cropping', false );
851
+	}
827 852
 	?>
828 853
 	</p>
829 854
 </form>
@@ -842,13 +867,15 @@  discard block
 block discarded – undo
842 867
 
843 868
 		$uploaded_file = $_FILES['import'];
844 869
 		$wp_filetype = wp_check_filetype_and_ext( $uploaded_file['tmp_name'], $uploaded_file['name'] );
845
-		if ( ! wp_match_mime_types( 'image', $wp_filetype['type'] ) )
846
-			wp_die( __( 'The uploaded file is not a valid image. Please try again.' ) );
870
+		if ( ! wp_match_mime_types( 'image', $wp_filetype['type'] ) ) {
871
+					wp_die( __( 'The uploaded file is not a valid image. Please try again.' ) );
872
+		}
847 873
 
848 874
 		$file = wp_handle_upload($uploaded_file, $overrides);
849 875
 
850
-		if ( isset($file['error']) )
851
-			wp_die( $file['error'],  __( 'Image Upload Error' ) );
876
+		if ( isset($file['error']) ) {
877
+					wp_die( $file['error'],  __( 'Image Upload Error' ) );
878
+		}
852 879
 
853 880
 		$url = $file['url'];
854 881
 		$type = $file['type'];
@@ -912,23 +939,26 @@  discard block
 block discarded – undo
912 939
 		$height = $dimensions['dst_height'];
913 940
 		$width = $dimensions['dst_width'];
914 941
 
915
-		if ( empty( $_POST['skip-cropping'] ) )
916
-			$cropped = wp_crop_image( $attachment_id, (int) $_POST['x1'], (int) $_POST['y1'], (int) $_POST['width'], (int) $_POST['height'], $width, $height );
917
-		elseif ( ! empty( $_POST['create-new-attachment'] ) )
918
-			$cropped = _copy_image_file( $attachment_id );
919
-		else
920
-			$cropped = get_attached_file( $attachment_id );
942
+		if ( empty( $_POST['skip-cropping'] ) ) {
943
+					$cropped = wp_crop_image( $attachment_id, (int) $_POST['x1'], (int) $_POST['y1'], (int) $_POST['width'], (int) $_POST['height'], $width, $height );
944
+		} elseif ( ! empty( $_POST['create-new-attachment'] ) ) {
945
+					$cropped = _copy_image_file( $attachment_id );
946
+		} else {
947
+					$cropped = get_attached_file( $attachment_id );
948
+		}
921 949
 
922
-		if ( ! $cropped || is_wp_error( $cropped ) )
923
-			wp_die( __( 'Image could not be processed. Please go back and try again.' ), __( 'Image Processing Error' ) );
950
+		if ( ! $cropped || is_wp_error( $cropped ) ) {
951
+					wp_die( __( 'Image could not be processed. Please go back and try again.' ), __( 'Image Processing Error' ) );
952
+		}
924 953
 
925 954
 		/** This filter is documented in wp-admin/custom-header.php */
926 955
 		$cropped = apply_filters( 'wp_create_file_in_uploads', $cropped, $attachment_id ); // For replication
927 956
 
928 957
 		$object = $this->create_attachment_object( $cropped, $attachment_id );
929 958
 
930
-		if ( ! empty( $_POST['create-new-attachment'] ) )
931
-			unset( $object['ID'] );
959
+		if ( ! empty( $_POST['create-new-attachment'] ) ) {
960
+					unset( $object['ID'] );
961
+		}
932 962
 
933 963
 		// Update the attachment
934 964
 		$attachment_id = $this->insert_attachment( $object, $cropped );
@@ -965,15 +995,17 @@  discard block
 block discarded – undo
965 995
 	 * @since 2.1.0
966 996
 	 */
967 997
 	public function admin_page() {
968
-		if ( ! current_user_can('edit_theme_options') )
969
-			wp_die(__('Sorry, you are not allowed to customize headers.'));
998
+		if ( ! current_user_can('edit_theme_options') ) {
999
+					wp_die(__('Sorry, you are not allowed to customize headers.'));
1000
+		}
970 1001
 		$step = $this->step();
971
-		if ( 2 == $step )
972
-			$this->step_2();
973
-		elseif ( 3 == $step )
974
-			$this->step_3();
975
-		else
976
-			$this->step_1();
1002
+		if ( 2 == $step ) {
1003
+					$this->step_2();
1004
+		} elseif ( 3 == $step ) {
1005
+					$this->step_3();
1006
+		} else {
1007
+					$this->step_1();
1008
+		}
977 1009
 	}
978 1010
 
979 1011
 	/**
@@ -1015,8 +1047,9 @@  discard block
 block discarded – undo
1015 1047
 	final public function set_header_image( $choice ) {
1016 1048
 		if ( is_array( $choice ) || is_object( $choice ) ) {
1017 1049
 			$choice = (array) $choice;
1018
-			if ( ! isset( $choice['attachment_id'] ) || ! isset( $choice['url'] ) )
1019
-				return;
1050
+			if ( ! isset( $choice['attachment_id'] ) || ! isset( $choice['url'] ) ) {
1051
+							return;
1052
+			}
1020 1053
 
1021 1054
 			$choice['url'] = esc_url_raw( $choice['url'] );
1022 1055
 
@@ -1046,10 +1079,11 @@  discard block
 block discarded – undo
1046 1079
 
1047 1080
 		} else {
1048 1081
 			$this->process_default_headers();
1049
-			if ( isset( $this->default_headers[ $choice ] ) )
1050
-				$header_image_data = $this->default_headers[ $choice ];
1051
-			else
1052
-				return;
1082
+			if ( isset( $this->default_headers[ $choice ] ) ) {
1083
+							$header_image_data = $this->default_headers[ $choice ];
1084
+			} else {
1085
+							return;
1086
+			}
1053 1087
 		}
1054 1088
 
1055 1089
 		set_theme_mod( 'header_image', esc_url_raw( $header_image_data['url'] ) );
@@ -1123,21 +1157,17 @@  discard block
 block discarded – undo
1123 1157
 
1124 1158
 		if ( $has_flex_height && ( ! $has_flex_width || $width > $max_width ) ) {
1125 1159
 			$dst['dst_height'] = absint( $height * ( $max_width / $width ) );
1126
-		}
1127
-		elseif ( $has_flex_height && $has_flex_width ) {
1160
+		} elseif ( $has_flex_height && $has_flex_width ) {
1128 1161
 			$dst['dst_height'] = $height;
1129
-		}
1130
-		else {
1162
+		} else {
1131 1163
 			$dst['dst_height'] = $theme_height;
1132 1164
 		}
1133 1165
 
1134 1166
 		if ( $has_flex_width && ( ! $has_flex_height || $width > $max_width ) ) {
1135 1167
 			$dst['dst_width'] = absint( $width * ( $max_width / $width ) );
1136
-		}
1137
-		elseif ( $has_flex_width && $has_flex_height ) {
1168
+		} elseif ( $has_flex_width && $has_flex_height ) {
1138 1169
 			$dst['dst_width'] = $width;
1139
-		}
1140
-		else {
1170
+		} else {
1141 1171
 			$dst['dst_width'] = $theme_width;
1142 1172
 		}
1143 1173
 
Please login to merge, or discard this patch.