Completed
Push — master ( d99bf9...491baf )
by Stephen
13:47
created
src/wp-includes/class-wp-widget-factory.php 1 patch
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
 	 * @access public
32 32
 	 */
33 33
 	public function __construct() {
34
-		add_action( 'widgets_init', array( $this, '_register_widgets' ), 100 );
34
+		add_action('widgets_init', array($this, '_register_widgets'), 100);
35 35
 	}
36 36
 
37 37
 	/**
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
 	 * @access public
42 42
 	 */
43 43
 	public function WP_Widget_Factory() {
44
-		_deprecated_constructor( 'WP_Widget_Factory', '4.2.0' );
44
+		_deprecated_constructor('WP_Widget_Factory', '4.2.0');
45 45
 		self::__construct();
46 46
 	}
47 47
 
@@ -71,20 +71,20 @@  discard block
 block discarded – undo
71 71
 	 * @param WP_Widget $widget Widget.
72 72
 	 * @return string Object hash.
73 73
 	 */
74
-	private function hash_object( $widget ) {
75
-		if ( function_exists( 'spl_object_hash' ) ) {
76
-			return spl_object_hash( $widget );
74
+	private function hash_object($widget) {
75
+		if (function_exists('spl_object_hash')) {
76
+			return spl_object_hash($widget);
77 77
 		} else {
78
-			$class_name = get_class( $widget );
78
+			$class_name = get_class($widget);
79 79
 			$hash = $class_name;
80
-			if ( ! isset( $widget->_wp_widget_factory_hash_id ) ) {
81
-				if ( ! isset( $this->hashed_class_counts[ $class_name ] ) ) {
82
-					$this->hashed_class_counts[ $class_name ] = 0;
80
+			if ( ! isset($widget->_wp_widget_factory_hash_id)) {
81
+				if ( ! isset($this->hashed_class_counts[$class_name])) {
82
+					$this->hashed_class_counts[$class_name] = 0;
83 83
 				}
84
-				$this->hashed_class_counts[ $class_name ] += 1;
85
-				$widget->_wp_widget_factory_hash_id = $this->hashed_class_counts[ $class_name ];
84
+				$this->hashed_class_counts[$class_name] += 1;
85
+				$widget->_wp_widget_factory_hash_id = $this->hashed_class_counts[$class_name];
86 86
 			}
87
-			$hash .= ':' . $widget->_wp_widget_factory_hash_id;
87
+			$hash .= ':'.$widget->_wp_widget_factory_hash_id;
88 88
 			return $hash;
89 89
 		}
90 90
 	}
@@ -98,11 +98,11 @@  discard block
 block discarded – undo
98 98
 	 *
99 99
 	 * @param string|WP_Widget $widget Either the name of a `WP_Widget` subclass or an instance of a `WP_Widget` subclass.
100 100
 	 */
101
-	public function register( $widget ) {
102
-		if ( $widget instanceof WP_Widget ) {
103
-			$this->widgets[ $this->hash_object( $widget ) ] = $widget;
101
+	public function register($widget) {
102
+		if ($widget instanceof WP_Widget) {
103
+			$this->widgets[$this->hash_object($widget)] = $widget;
104 104
 		} else {
105
-			$this->widgets[ $widget ] = new $widget();
105
+			$this->widgets[$widget] = new $widget();
106 106
 		}
107 107
 	}
108 108
 
@@ -115,11 +115,11 @@  discard block
 block discarded – undo
115 115
 	 *
116 116
 	 * @param string|WP_Widget $widget Either the name of a `WP_Widget` subclass or an instance of a `WP_Widget` subclass.
117 117
 	 */
118
-	public function unregister( $widget ) {
119
-		if ( $widget instanceof WP_Widget ) {
120
-			unset( $this->widgets[ $this->hash_object( $widget ) ] );
118
+	public function unregister($widget) {
119
+		if ($widget instanceof WP_Widget) {
120
+			unset($this->widgets[$this->hash_object($widget)]);
121 121
 		} else {
122
-			unset( $this->widgets[ $widget ] );
122
+			unset($this->widgets[$widget]);
123 123
 		}
124 124
 	}
125 125
 
@@ -137,9 +137,9 @@  discard block
 block discarded – undo
137 137
 		$registered = array_keys($wp_registered_widgets);
138 138
 		$registered = array_map('_get_widget_id_base', $registered);
139 139
 
140
-		foreach ( $keys as $key ) {
140
+		foreach ($keys as $key) {
141 141
 			// don't register new widget if old widget with the same id is already registered
142
-			if ( in_array($this->widgets[$key]->id_base, $registered, true) ) {
142
+			if (in_array($this->widgets[$key]->id_base, $registered, true)) {
143 143
 				unset($this->widgets[$key]);
144 144
 				continue;
145 145
 			}
Please login to merge, or discard this patch.
src/wp-includes/ms-load.php 4 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -75,7 +75,7 @@
 block discarded – undo
75 75
 	 * @since 3.0.0
76 76
 	 *
77 77
 	 * @param bool null Whether to skip the blog status check. Default null.
78
-	*/
78
+	 */
79 79
 	$check = apply_filters( 'ms_site_check', null );
80 80
 	if ( null !== $check )
81 81
 		return true;
Please login to merge, or discard this patch.
Spacing   +129 added lines, -129 removed lines patch added patch discarded remove patch
@@ -16,10 +16,10 @@  discard block
 block discarded – undo
16 16
  * @return bool True if subdomain configuration is enabled, false otherwise.
17 17
  */
18 18
 function is_subdomain_install() {
19
-	if ( defined('SUBDOMAIN_INSTALL') )
19
+	if (defined('SUBDOMAIN_INSTALL'))
20 20
 		return SUBDOMAIN_INSTALL;
21 21
 
22
-	return ( defined( 'VHOST' ) && VHOST == 'yes' );
22
+	return (defined('VHOST') && VHOST == 'yes');
23 23
 }
24 24
 
25 25
 /**
@@ -34,20 +34,20 @@  discard block
 block discarded – undo
34 34
  * @return array Files to include.
35 35
  */
36 36
 function wp_get_active_network_plugins() {
37
-	$active_plugins = (array) get_site_option( 'active_sitewide_plugins', array() );
38
-	if ( empty( $active_plugins ) )
37
+	$active_plugins = (array) get_site_option('active_sitewide_plugins', array());
38
+	if (empty($active_plugins))
39 39
 		return array();
40 40
 
41 41
 	$plugins = array();
42
-	$active_plugins = array_keys( $active_plugins );
43
-	sort( $active_plugins );
42
+	$active_plugins = array_keys($active_plugins);
43
+	sort($active_plugins);
44 44
 
45
-	foreach ( $active_plugins as $plugin ) {
46
-		if ( ! validate_file( $plugin ) // $plugin must validate as file
47
-			&& '.php' == substr( $plugin, -4 ) // $plugin must end with '.php'
48
-			&& file_exists( WP_PLUGIN_DIR . '/' . $plugin ) // $plugin must exist
45
+	foreach ($active_plugins as $plugin) {
46
+		if ( ! validate_file($plugin) // $plugin must validate as file
47
+			&& '.php' == substr($plugin, -4) // $plugin must end with '.php'
48
+			&& file_exists(WP_PLUGIN_DIR.'/'.$plugin) // $plugin must exist
49 49
 			)
50
-		$plugins[] = WP_PLUGIN_DIR . '/' . $plugin;
50
+		$plugins[] = WP_PLUGIN_DIR.'/'.$plugin;
51 51
 	}
52 52
 	return $plugins;
53 53
 }
@@ -76,42 +76,42 @@  discard block
 block discarded – undo
76 76
 	 *
77 77
 	 * @param bool null Whether to skip the blog status check. Default null.
78 78
 	*/
79
-	$check = apply_filters( 'ms_site_check', null );
80
-	if ( null !== $check )
79
+	$check = apply_filters('ms_site_check', null);
80
+	if (null !== $check)
81 81
 		return true;
82 82
 
83 83
 	// Allow super admins to see blocked sites
84
-	if ( is_super_admin() )
84
+	if (is_super_admin())
85 85
 		return true;
86 86
 
87 87
 	$blog = get_site();
88 88
 
89
-	if ( '1' == $blog->deleted ) {
90
-		if ( file_exists( WP_CONTENT_DIR . '/blog-deleted.php' ) )
91
-			return WP_CONTENT_DIR . '/blog-deleted.php';
89
+	if ('1' == $blog->deleted) {
90
+		if (file_exists(WP_CONTENT_DIR.'/blog-deleted.php'))
91
+			return WP_CONTENT_DIR.'/blog-deleted.php';
92 92
 		else
93
-			wp_die( __( 'This site is no longer available.' ), '', array( 'response' => 410 ) );
93
+			wp_die(__('This site is no longer available.'), '', array('response' => 410));
94 94
 	}
95 95
 
96
-	if ( '2' == $blog->deleted ) {
97
-		if ( file_exists( WP_CONTENT_DIR . '/blog-inactive.php' ) ) {
98
-			return WP_CONTENT_DIR . '/blog-inactive.php';
96
+	if ('2' == $blog->deleted) {
97
+		if (file_exists(WP_CONTENT_DIR.'/blog-inactive.php')) {
98
+			return WP_CONTENT_DIR.'/blog-inactive.php';
99 99
 		} else {
100
-			$admin_email = str_replace( '@', ' AT ', get_site_option( 'admin_email', 'support@' . get_network()->domain ) );
100
+			$admin_email = str_replace('@', ' AT ', get_site_option('admin_email', 'support@'.get_network()->domain));
101 101
 			wp_die(
102 102
 				/* translators: %s: admin email link */
103
-				sprintf( __( 'This site has not been activated yet. If you are having problems activating your site, please contact %s.' ),
104
-					sprintf( '<a href="mailto:%s">%s</a>', $admin_email )
103
+				sprintf(__('This site has not been activated yet. If you are having problems activating your site, please contact %s.'),
104
+					sprintf('<a href="mailto:%s">%s</a>', $admin_email)
105 105
 				)
106 106
 			);
107 107
 		}
108 108
 	}
109 109
 
110
-	if ( $blog->archived == '1' || $blog->spam == '1' ) {
111
-		if ( file_exists( WP_CONTENT_DIR . '/blog-suspended.php' ) )
112
-			return WP_CONTENT_DIR . '/blog-suspended.php';
110
+	if ($blog->archived == '1' || $blog->spam == '1') {
111
+		if (file_exists(WP_CONTENT_DIR.'/blog-suspended.php'))
112
+			return WP_CONTENT_DIR.'/blog-suspended.php';
113 113
 		else
114
-			wp_die( __( 'This site has been archived or suspended.' ), '', array( 'response' => 410 ) );
114
+			wp_die(__('This site has been archived or suspended.'), '', array('response' => 410));
115 115
 	}
116 116
 
117 117
 	return true;
@@ -129,8 +129,8 @@  discard block
 block discarded – undo
129 129
  * @param int|null $segments Path segments to use. Defaults to null, or the full path.
130 130
  * @return WP_Network|false Network object if successful. False when no network is found.
131 131
  */
132
-function get_network_by_path( $domain, $path, $segments = null ) {
133
-	return WP_Network::get_by_path( $domain, $path, $segments );
132
+function get_network_by_path($domain, $path, $segments = null) {
133
+	return WP_Network::get_by_path($domain, $path, $segments);
134 134
 }
135 135
 
136 136
 /**
@@ -153,8 +153,8 @@  discard block
 block discarded – undo
153 153
  * @param int|null $segments Path segments to use. Defaults to null, or the full path.
154 154
  * @return WP_Site|false Site object if successful. False when no site is found.
155 155
  */
156
-function get_site_by_path( $domain, $path, $segments = null ) {
157
-	$path_segments = array_filter( explode( '/', trim( $path, '/' ) ) );
156
+function get_site_by_path($domain, $path, $segments = null) {
157
+	$path_segments = array_filter(explode('/', trim($path, '/')));
158 158
 
159 159
 	/**
160 160
 	 * Filters the number of path segments to consider when searching for a site.
@@ -167,17 +167,17 @@  discard block
 block discarded – undo
167 167
 	 * @param string   $domain   The requested domain.
168 168
 	 * @param string   $path     The requested path, in full.
169 169
 	 */
170
-	$segments = apply_filters( 'site_by_path_segments_count', $segments, $domain, $path );
170
+	$segments = apply_filters('site_by_path_segments_count', $segments, $domain, $path);
171 171
 
172
-	if ( null !== $segments && count( $path_segments ) > $segments ) {
173
-		$path_segments = array_slice( $path_segments, 0, $segments );
172
+	if (null !== $segments && count($path_segments) > $segments) {
173
+		$path_segments = array_slice($path_segments, 0, $segments);
174 174
 	}
175 175
 
176 176
 	$paths = array();
177 177
 
178
-	while ( count( $path_segments ) ) {
179
-		$paths[] = '/' . implode( '/', $path_segments ) . '/';
180
-		array_pop( $path_segments );
178
+	while (count($path_segments)) {
179
+		$paths[] = '/'.implode('/', $path_segments).'/';
180
+		array_pop($path_segments);
181 181
 	}
182 182
 
183 183
 	$paths[] = '/';
@@ -201,10 +201,10 @@  discard block
 block discarded – undo
201 201
 	 *                                    Default null, meaning the entire path was to be consulted.
202 202
 	 * @param array             $paths    The paths to search for, based on $path and $segments.
203 203
 	 */
204
-	$pre = apply_filters( 'pre_get_site_by_path', null, $domain, $path, $segments, $paths );
205
-	if ( null !== $pre ) {
206
-		if ( false !== $pre && ! $pre instanceof WP_Site ) {
207
-			$pre = new WP_Site( $pre );
204
+	$pre = apply_filters('pre_get_site_by_path', null, $domain, $path, $segments, $paths);
205
+	if (null !== $pre) {
206
+		if (false !== $pre && ! $pre instanceof WP_Site) {
207
+			$pre = new WP_Site($pre);
208 208
 		}
209 209
 		return $pre;
210 210
 	}
@@ -220,9 +220,9 @@  discard block
 block discarded – undo
220 220
 
221 221
 	// Either www or non-www is supported, not both. If a www domain is requested,
222 222
 	// query for both to provide the proper redirect.
223
-	$domains = array( $domain );
224
-	if ( 'www.' === substr( $domain, 0, 4 ) ) {
225
-		$domains[] = substr( $domain, 4 );
223
+	$domains = array($domain);
224
+	if ('www.' === substr($domain, 0, 4)) {
225
+		$domains[] = substr($domain, 4);
226 226
 	}
227 227
 
228 228
 	$args = array(
@@ -231,18 +231,18 @@  discard block
 block discarded – undo
231 231
 		'number' => 1,
232 232
 	);
233 233
 
234
-	if ( count( $domains ) > 1 ) {
234
+	if (count($domains) > 1) {
235 235
 		$args['orderby']['domain_length'] = 'DESC';
236 236
 	}
237 237
 
238
-	if ( count( $paths ) > 1 ) {
238
+	if (count($paths) > 1) {
239 239
 		$args['orderby']['path_length'] = 'DESC';
240 240
 	}
241 241
 
242
-	$result = get_sites( $args );
243
-	$site = array_shift( $result );
242
+	$result = get_sites($args);
243
+	$site = array_shift($result);
244 244
 
245
-	if ( $site ) {
245
+	if ($site) {
246 246
 		return $site;
247 247
 	}
248 248
 
@@ -280,55 +280,55 @@  discard block
 block discarded – undo
280 280
  *                     False if bootstrap could not be properly completed.
281 281
  *                     Redirect URL if parts exist, but the request as a whole can not be fulfilled.
282 282
  */
283
-function ms_load_current_site_and_network( $domain, $path, $subdomain = false ) {
283
+function ms_load_current_site_and_network($domain, $path, $subdomain = false) {
284 284
 	global $wpdb, $current_site, $current_blog;
285 285
 
286 286
 	// If the network is defined in wp-config.php, we can simply use that.
287
-	if ( defined( 'DOMAIN_CURRENT_SITE' ) && defined( 'PATH_CURRENT_SITE' ) ) {
287
+	if (defined('DOMAIN_CURRENT_SITE') && defined('PATH_CURRENT_SITE')) {
288 288
 		$current_site = new stdClass;
289
-		$current_site->id = defined( 'SITE_ID_CURRENT_SITE' ) ? SITE_ID_CURRENT_SITE : 1;
289
+		$current_site->id = defined('SITE_ID_CURRENT_SITE') ? SITE_ID_CURRENT_SITE : 1;
290 290
 		$current_site->domain = DOMAIN_CURRENT_SITE;
291 291
 		$current_site->path = PATH_CURRENT_SITE;
292
-		if ( defined( 'BLOG_ID_CURRENT_SITE' ) ) {
292
+		if (defined('BLOG_ID_CURRENT_SITE')) {
293 293
 			$current_site->blog_id = BLOG_ID_CURRENT_SITE;
294
-		} elseif ( defined( 'BLOGID_CURRENT_SITE' ) ) { // deprecated.
294
+		} elseif (defined('BLOGID_CURRENT_SITE')) { // deprecated.
295 295
 			$current_site->blog_id = BLOGID_CURRENT_SITE;
296 296
 		}
297 297
 
298
-		if ( 0 === strcasecmp( $current_site->domain, $domain ) && 0 === strcasecmp( $current_site->path, $path ) ) {
299
-			$current_blog = get_site_by_path( $domain, $path );
300
-		} elseif ( '/' !== $current_site->path && 0 === strcasecmp( $current_site->domain, $domain ) && 0 === stripos( $path, $current_site->path ) ) {
298
+		if (0 === strcasecmp($current_site->domain, $domain) && 0 === strcasecmp($current_site->path, $path)) {
299
+			$current_blog = get_site_by_path($domain, $path);
300
+		} elseif ('/' !== $current_site->path && 0 === strcasecmp($current_site->domain, $domain) && 0 === stripos($path, $current_site->path)) {
301 301
 			// If the current network has a path and also matches the domain and path of the request,
302 302
 			// we need to look for a site using the first path segment following the network's path.
303
-			$current_blog = get_site_by_path( $domain, $path, 1 + count( explode( '/', trim( $current_site->path, '/' ) ) ) );
303
+			$current_blog = get_site_by_path($domain, $path, 1 + count(explode('/', trim($current_site->path, '/'))));
304 304
 		} else {
305 305
 			// Otherwise, use the first path segment (as usual).
306
-			$current_blog = get_site_by_path( $domain, $path, 1 );
306
+			$current_blog = get_site_by_path($domain, $path, 1);
307 307
 		}
308 308
 
309
-	} elseif ( ! $subdomain ) {
309
+	} elseif ( ! $subdomain) {
310 310
 		/*
311 311
 		 * A "subdomain" install can be re-interpreted to mean "can support any domain".
312 312
 		 * If we're not dealing with one of these installs, then the important part is determining
313 313
 		 * the network first, because we need the network's path to identify any sites.
314 314
 		 */
315
-		if ( ! $current_site = wp_cache_get( 'current_network', 'site-options' ) ) {
315
+		if ( ! $current_site = wp_cache_get('current_network', 'site-options')) {
316 316
 			// Are there even two networks installed?
317
-			$one_network = $wpdb->get_row( "SELECT * FROM $wpdb->site LIMIT 2" ); // [sic]
318
-			if ( 1 === $wpdb->num_rows ) {
319
-				$current_site = new WP_Network( $one_network );
320
-				wp_cache_add( 'current_network', $current_site, 'site-options' );
321
-			} elseif ( 0 === $wpdb->num_rows ) {
317
+			$one_network = $wpdb->get_row("SELECT * FROM $wpdb->site LIMIT 2"); // [sic]
318
+			if (1 === $wpdb->num_rows) {
319
+				$current_site = new WP_Network($one_network);
320
+				wp_cache_add('current_network', $current_site, 'site-options');
321
+			} elseif (0 === $wpdb->num_rows) {
322 322
 				// A network not found hook should fire here.
323 323
 				return false;
324 324
 			}
325 325
 		}
326 326
 
327
-		if ( empty( $current_site ) ) {
328
-			$current_site = WP_Network::get_by_path( $domain, $path, 1 );
327
+		if (empty($current_site)) {
328
+			$current_site = WP_Network::get_by_path($domain, $path, 1);
329 329
 		}
330 330
 
331
-		if ( empty( $current_site ) ) {
331
+		if (empty($current_site)) {
332 332
 			/**
333 333
 			 * Fires when a network cannot be found based on the requested domain and path.
334 334
 			 *
@@ -340,48 +340,48 @@  discard block
 block discarded – undo
340 340
 			 * @param string $domain       The domain used to search for a network.
341 341
 			 * @param string $path         The path used to search for a path.
342 342
 			 */
343
-			do_action( 'ms_network_not_found', $domain, $path );
343
+			do_action('ms_network_not_found', $domain, $path);
344 344
 
345 345
 			return false;
346
-		} elseif ( $path === $current_site->path ) {
347
-			$current_blog = get_site_by_path( $domain, $path );
346
+		} elseif ($path === $current_site->path) {
347
+			$current_blog = get_site_by_path($domain, $path);
348 348
 		} else {
349 349
 			// Search the network path + one more path segment (on top of the network path).
350
-			$current_blog = get_site_by_path( $domain, $path, substr_count( $current_site->path, '/' ) );
350
+			$current_blog = get_site_by_path($domain, $path, substr_count($current_site->path, '/'));
351 351
 		}
352 352
 	} else {
353 353
 		// Find the site by the domain and at most the first path segment.
354
-		$current_blog = get_site_by_path( $domain, $path, 1 );
355
-		if ( $current_blog ) {
356
-			$current_site = WP_Network::get_instance( $current_blog->site_id ? $current_blog->site_id : 1 );
354
+		$current_blog = get_site_by_path($domain, $path, 1);
355
+		if ($current_blog) {
356
+			$current_site = WP_Network::get_instance($current_blog->site_id ? $current_blog->site_id : 1);
357 357
 		} else {
358 358
 			// If you don't have a site with the same domain/path as a network, you're pretty screwed, but:
359
-			$current_site = WP_Network::get_by_path( $domain, $path, 1 );
359
+			$current_site = WP_Network::get_by_path($domain, $path, 1);
360 360
 		}
361 361
 	}
362 362
 
363 363
 	// The network declared by the site trumps any constants.
364
-	if ( $current_blog && $current_blog->site_id != $current_site->id ) {
365
-		$current_site = WP_Network::get_instance( $current_blog->site_id );
364
+	if ($current_blog && $current_blog->site_id != $current_site->id) {
365
+		$current_site = WP_Network::get_instance($current_blog->site_id);
366 366
 	}
367 367
 
368 368
 	// No network has been found, bail.
369
-	if ( empty( $current_site ) ) {
369
+	if (empty($current_site)) {
370 370
 		/** This action is documented in wp-includes/ms-settings.php */
371
-		do_action( 'ms_network_not_found', $domain, $path );
371
+		do_action('ms_network_not_found', $domain, $path);
372 372
 
373 373
 		return false;
374 374
 	}
375 375
 
376 376
 	// During activation of a new subdomain, the requested site does not yet exist.
377
-	if ( empty( $current_blog ) && wp_installing() ) {
377
+	if (empty($current_blog) && wp_installing()) {
378 378
 		$current_blog = new stdClass;
379 379
 		$current_blog->blog_id = $blog_id = 1;
380 380
 		$current_blog->public = 1;
381 381
 	}
382 382
 
383 383
 	// No site has been found, bail.
384
-	if ( empty( $current_blog ) ) {
384
+	if (empty($current_blog)) {
385 385
 		// We're going to redirect to the network URL, with some possible modifications.
386 386
 		$scheme = is_ssl() ? 'https' : 'http';
387 387
 		$destination = "$scheme://{$current_site->domain}{$current_site->path}";
@@ -398,19 +398,19 @@  discard block
 block discarded – undo
398 398
 		 * @param string $domain       The domain used to search for a site.
399 399
 		 * @param string $path         The path used to search for a site.
400 400
 		 */
401
-		do_action( 'ms_site_not_found', $current_site, $domain, $path );
401
+		do_action('ms_site_not_found', $current_site, $domain, $path);
402 402
 
403
-		if ( $subdomain && ! defined( 'NOBLOGREDIRECT' ) ) {
403
+		if ($subdomain && ! defined('NOBLOGREDIRECT')) {
404 404
 			// For a "subdomain" install, redirect to the signup form specifically.
405
-			$destination .= 'wp-signup.php?new=' . str_replace( '.' . $current_site->domain, '', $domain );
406
-		} elseif ( $subdomain ) {
405
+			$destination .= 'wp-signup.php?new='.str_replace('.'.$current_site->domain, '', $domain);
406
+		} elseif ($subdomain) {
407 407
 			// For a "subdomain" install, the NOBLOGREDIRECT constant
408 408
 			// can be used to avoid a redirect to the signup form.
409 409
 			// Using the ms_site_not_found action is preferred to the constant.
410
-			if ( '%siteurl%' !== NOBLOGREDIRECT ) {
410
+			if ('%siteurl%' !== NOBLOGREDIRECT) {
411 411
 				$destination = NOBLOGREDIRECT;
412 412
 			}
413
-		} elseif ( 0 === strcasecmp( $current_site->domain, $domain ) ) {
413
+		} elseif (0 === strcasecmp($current_site->domain, $domain)) {
414 414
 			/*
415 415
 			 * If the domain we were searching for matches the network's domain,
416 416
 			 * it's no use redirecting back to ourselves -- it'll cause a loop.
@@ -423,13 +423,13 @@  discard block
 block discarded – undo
423 423
 	}
424 424
 
425 425
 	// Figure out the current network's main site.
426
-	if ( empty( $current_site->blog_id ) ) {
427
-		if ( $current_blog->domain === $current_site->domain && $current_blog->path === $current_site->path ) {
426
+	if (empty($current_site->blog_id)) {
427
+		if ($current_blog->domain === $current_site->domain && $current_blog->path === $current_site->path) {
428 428
 			$current_site->blog_id = $current_blog->blog_id;
429
-		} elseif ( ! $current_site->blog_id = wp_cache_get( 'network:' . $current_site->id . ':main_site', 'site-options' ) ) {
430
-			$current_site->blog_id = $wpdb->get_var( $wpdb->prepare( "SELECT blog_id FROM $wpdb->blogs WHERE domain = %s AND path = %s",
431
-				$current_site->domain, $current_site->path ) );
432
-			wp_cache_add( 'network:' . $current_site->id . ':main_site', $current_site->blog_id, 'site-options' );
429
+		} elseif ( ! $current_site->blog_id = wp_cache_get('network:'.$current_site->id.':main_site', 'site-options')) {
430
+			$current_site->blog_id = $wpdb->get_var($wpdb->prepare("SELECT blog_id FROM $wpdb->blogs WHERE domain = %s AND path = %s",
431
+				$current_site->domain, $current_site->path));
432
+			wp_cache_add('network:'.$current_site->id.':main_site', $current_site->blog_id, 'site-options');
433 433
 		}
434 434
 	}
435 435
 
@@ -450,50 +450,50 @@  discard block
 block discarded – undo
450 450
  * @param string $domain The requested domain for the error to reference.
451 451
  * @param string $path   The requested path for the error to reference.
452 452
  */
453
-function ms_not_installed( $domain, $path ) {
453
+function ms_not_installed($domain, $path) {
454 454
 	global $wpdb;
455 455
 
456
-	if ( ! is_admin() ) {
456
+	if ( ! is_admin()) {
457 457
 		dead_db();
458 458
 	}
459 459
 
460 460
 	wp_load_translations_early();
461 461
 
462
-	$title = __( 'Error establishing a database connection' );
462
+	$title = __('Error establishing a database connection');
463 463
 
464
-	$msg  = '<h1>' . $title . '</h1>';
465
-	$msg .= '<p>' . __( 'If your site does not display, please contact the owner of this network.' ) . '';
466
-	$msg .= ' ' . __( 'If you are the owner of this network please check that MySQL is running properly and all tables are error free.' ) . '</p>';
467
-	$query = $wpdb->prepare( "SHOW TABLES LIKE %s", $wpdb->esc_like( $wpdb->site ) );
468
-	if ( ! $wpdb->get_var( $query ) ) {
469
-		$msg .= '<p>' . sprintf(
464
+	$msg  = '<h1>'.$title.'</h1>';
465
+	$msg .= '<p>'.__('If your site does not display, please contact the owner of this network.').'';
466
+	$msg .= ' '.__('If you are the owner of this network please check that MySQL is running properly and all tables are error free.').'</p>';
467
+	$query = $wpdb->prepare("SHOW TABLES LIKE %s", $wpdb->esc_like($wpdb->site));
468
+	if ( ! $wpdb->get_var($query)) {
469
+		$msg .= '<p>'.sprintf(
470 470
 			/* translators: %s: table name */
471
-			__( '<strong>Database tables are missing.</strong> This means that MySQL is not running, WordPress was not installed properly, or someone deleted %s. You really should look at your database now.' ),
472
-			'<code>' . $wpdb->site . '</code>'
473
-		) . '</p>';
471
+			__('<strong>Database tables are missing.</strong> This means that MySQL is not running, WordPress was not installed properly, or someone deleted %s. You really should look at your database now.'),
472
+			'<code>'.$wpdb->site.'</code>'
473
+		).'</p>';
474 474
 	} else {
475
-		$msg .= '<p>' . sprintf(
475
+		$msg .= '<p>'.sprintf(
476 476
 			/* translators: 1: site url, 2: table name, 3: database name */
477
-			__( '<strong>Could not find site %1$s.</strong> Searched for table %2$s in database %3$s. Is that right?' ),
478
-			'<code>' . rtrim( $domain . $path, '/' ) . '</code>',
479
-			'<code>' . $wpdb->blogs . '</code>',
480
-			'<code>' . DB_NAME . '</code>'
481
-		) . '</p>';
477
+			__('<strong>Could not find site %1$s.</strong> Searched for table %2$s in database %3$s. Is that right?'),
478
+			'<code>'.rtrim($domain.$path, '/').'</code>',
479
+			'<code>'.$wpdb->blogs.'</code>',
480
+			'<code>'.DB_NAME.'</code>'
481
+		).'</p>';
482 482
 	}
483
-	$msg .= '<p><strong>' . __( 'What do I do now?' ) . '</strong> ';
483
+	$msg .= '<p><strong>'.__('What do I do now?').'</strong> ';
484 484
 	/* translators: %s: Codex URL */
485
-	$msg .= sprintf( __( 'Read the <a href="%s" target="_blank">bug report</a> page. Some of the guidelines there may help you figure out what went wrong.' ),
486
-		__( 'https://codex.wordpress.org/Debugging_a_WordPress_Network' )
485
+	$msg .= sprintf(__('Read the <a href="%s" target="_blank">bug report</a> page. Some of the guidelines there may help you figure out what went wrong.'),
486
+		__('https://codex.wordpress.org/Debugging_a_WordPress_Network')
487 487
 	);
488
-	$msg .= ' ' . __( 'If you&#8217;re still stuck with this message, then check that your database contains the following tables:' ) . '</p><ul>';
489
-	foreach ( $wpdb->tables('global') as $t => $table ) {
490
-		if ( 'sitecategories' == $t )
488
+	$msg .= ' '.__('If you&#8217;re still stuck with this message, then check that your database contains the following tables:').'</p><ul>';
489
+	foreach ($wpdb->tables('global') as $t => $table) {
490
+		if ('sitecategories' == $t)
491 491
 			continue;
492
-		$msg .= '<li>' . $table . '</li>';
492
+		$msg .= '<li>'.$table.'</li>';
493 493
 	}
494 494
 	$msg .= '</ul>';
495 495
 
496
-	wp_die( $msg, $title, array( 'response' => 500 ) );
496
+	wp_die($msg, $title, array('response' => 500));
497 497
 }
498 498
 
499 499
 /**
@@ -509,8 +509,8 @@  discard block
 block discarded – undo
509 509
  * @param object $current_site
510 510
  * @return object
511 511
  */
512
-function get_current_site_name( $current_site ) {
513
-	_deprecated_function( __FUNCTION__, '3.9.0', 'get_current_site()' );
512
+function get_current_site_name($current_site) {
513
+	_deprecated_function(__FUNCTION__, '3.9.0', 'get_current_site()');
514 514
 	return $current_site;
515 515
 }
516 516
 
@@ -530,7 +530,7 @@  discard block
 block discarded – undo
530 530
  */
531 531
 function wpmu_current_site() {
532 532
 	global $current_site;
533
-	_deprecated_function( __FUNCTION__, '3.9.0' );
533
+	_deprecated_function(__FUNCTION__, '3.9.0');
534 534
 	return $current_site;
535 535
 }
536 536
 
@@ -546,11 +546,11 @@  discard block
 block discarded – undo
546 546
  * @param object|int $network The network's database row or ID.
547 547
  * @return WP_Network|false Object containing network information if found, false if not.
548 548
  */
549
-function wp_get_network( $network ) {
550
-	_deprecated_function( __FUNCTION__, '4.7.0', 'get_network()' );
549
+function wp_get_network($network) {
550
+	_deprecated_function(__FUNCTION__, '4.7.0', 'get_network()');
551 551
 
552
-	$network = get_network( $network );
553
-	if ( null === $network ) {
552
+	$network = get_network($network);
553
+	if (null === $network) {
554 554
 		return false;
555 555
 	}
556 556
 
Please login to merge, or discard this patch.
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -65,7 +65,7 @@
 block discarded – undo
65 65
  *
66 66
  * @since 3.0.0
67 67
  *
68
- * @return true|string Returns true on success, or drop-in file to include.
68
+ * @return boolean|string Returns true on success, or drop-in file to include.
69 69
  */
70 70
 function ms_site_check() {
71 71
 
Please login to merge, or discard this patch.
Braces   +28 added lines, -20 removed lines patch added patch discarded remove patch
@@ -16,8 +16,9 @@  discard block
 block discarded – undo
16 16
  * @return bool True if subdomain configuration is enabled, false otherwise.
17 17
  */
18 18
 function is_subdomain_install() {
19
-	if ( defined('SUBDOMAIN_INSTALL') )
20
-		return SUBDOMAIN_INSTALL;
19
+	if ( defined('SUBDOMAIN_INSTALL') ) {
20
+			return SUBDOMAIN_INSTALL;
21
+	}
21 22
 
22 23
 	return ( defined( 'VHOST' ) && VHOST == 'yes' );
23 24
 }
@@ -35,8 +36,9 @@  discard block
 block discarded – undo
35 36
  */
36 37
 function wp_get_active_network_plugins() {
37 38
 	$active_plugins = (array) get_site_option( 'active_sitewide_plugins', array() );
38
-	if ( empty( $active_plugins ) )
39
-		return array();
39
+	if ( empty( $active_plugins ) ) {
40
+			return array();
41
+	}
40 42
 
41 43
 	$plugins = array();
42 44
 	$active_plugins = array_keys( $active_plugins );
@@ -46,8 +48,9 @@  discard block
 block discarded – undo
46 48
 		if ( ! validate_file( $plugin ) // $plugin must validate as file
47 49
 			&& '.php' == substr( $plugin, -4 ) // $plugin must end with '.php'
48 50
 			&& file_exists( WP_PLUGIN_DIR . '/' . $plugin ) // $plugin must exist
49
-			)
50
-		$plugins[] = WP_PLUGIN_DIR . '/' . $plugin;
51
+			) {
52
+				$plugins[] = WP_PLUGIN_DIR . '/' . $plugin;
53
+		}
51 54
 	}
52 55
 	return $plugins;
53 56
 }
@@ -77,20 +80,23 @@  discard block
 block discarded – undo
77 80
 	 * @param bool null Whether to skip the blog status check. Default null.
78 81
 	*/
79 82
 	$check = apply_filters( 'ms_site_check', null );
80
-	if ( null !== $check )
81
-		return true;
83
+	if ( null !== $check ) {
84
+			return true;
85
+	}
82 86
 
83 87
 	// Allow super admins to see blocked sites
84
-	if ( is_super_admin() )
85
-		return true;
88
+	if ( is_super_admin() ) {
89
+			return true;
90
+	}
86 91
 
87 92
 	$blog = get_site();
88 93
 
89 94
 	if ( '1' == $blog->deleted ) {
90
-		if ( file_exists( WP_CONTENT_DIR . '/blog-deleted.php' ) )
91
-			return WP_CONTENT_DIR . '/blog-deleted.php';
92
-		else
93
-			wp_die( __( 'This site is no longer available.' ), '', array( 'response' => 410 ) );
95
+		if ( file_exists( WP_CONTENT_DIR . '/blog-deleted.php' ) ) {
96
+					return WP_CONTENT_DIR . '/blog-deleted.php';
97
+		} else {
98
+					wp_die( __( 'This site is no longer available.' ), '', array( 'response' => 410 ) );
99
+		}
94 100
 	}
95 101
 
96 102
 	if ( '2' == $blog->deleted ) {
@@ -108,10 +114,11 @@  discard block
 block discarded – undo
108 114
 	}
109 115
 
110 116
 	if ( $blog->archived == '1' || $blog->spam == '1' ) {
111
-		if ( file_exists( WP_CONTENT_DIR . '/blog-suspended.php' ) )
112
-			return WP_CONTENT_DIR . '/blog-suspended.php';
113
-		else
114
-			wp_die( __( 'This site has been archived or suspended.' ), '', array( 'response' => 410 ) );
117
+		if ( file_exists( WP_CONTENT_DIR . '/blog-suspended.php' ) ) {
118
+					return WP_CONTENT_DIR . '/blog-suspended.php';
119
+		} else {
120
+					wp_die( __( 'This site has been archived or suspended.' ), '', array( 'response' => 410 ) );
121
+		}
115 122
 	}
116 123
 
117 124
 	return true;
@@ -487,8 +494,9 @@  discard block
 block discarded – undo
487 494
 	);
488 495
 	$msg .= ' ' . __( 'If you&#8217;re still stuck with this message, then check that your database contains the following tables:' ) . '</p><ul>';
489 496
 	foreach ( $wpdb->tables('global') as $t => $table ) {
490
-		if ( 'sitecategories' == $t )
491
-			continue;
497
+		if ( 'sitecategories' == $t ) {
498
+					continue;
499
+		}
492 500
 		$msg .= '<li>' . $table . '</li>';
493 501
 	}
494 502
 	$msg .= '</ul>';
Please login to merge, or discard this patch.
src/wp-includes/class-requests.php 2 patches
Braces   +11 added lines, -22 removed lines patch added patch discarded remove patch
@@ -370,8 +370,7 @@  discard block
 block discarded – undo
370 370
 			if (is_string($options['transport'])) {
371 371
 				$transport = new $transport();
372 372
 			}
373
-		}
374
-		else {
373
+		} else {
375 374
 			$need_ssl = (0 === stripos($url, 'https://'));
376 375
 			$capabilities = array('ssl' => $need_ssl);
377 376
 			$transport = self::get_transport($capabilities);
@@ -447,8 +446,7 @@  discard block
 block discarded – undo
447 446
 			if (!isset($request['options'])) {
448 447
 				$request['options'] = $options;
449 448
 				$request['options']['type'] = $request['type'];
450
-			}
451
-			else {
449
+			} else {
452 450
 				if (empty($request['options']['type'])) {
453 451
 					$request['options']['type'] = $request['type'];
454 452
 				}
@@ -473,8 +471,7 @@  discard block
 block discarded – undo
473 471
 			if (is_string($options['transport'])) {
474 472
 				$transport = new $transport();
475 473
 			}
476
-		}
477
-		else {
474
+		} else {
478 475
 			$transport = self::get_transport();
479 476
 		}
480 477
 		$responses = $transport->request_multiple($requests, $options);
@@ -584,8 +581,7 @@  discard block
 block discarded – undo
584 581
 
585 582
 		if (is_array($options['cookies'])) {
586 583
 			$options['cookies'] = new Requests_Cookie_Jar($options['cookies']);
587
-		}
588
-		elseif (empty($options['cookies'])) {
584
+		} elseif (empty($options['cookies'])) {
589 585
 			$options['cookies'] = new Requests_Cookie_Jar();
590 586
 		}
591 587
 		if ($options['cookies'] !== false) {
@@ -604,8 +600,7 @@  discard block
 block discarded – undo
604 600
 		if (!isset($options['data_format'])) {
605 601
 			if (in_array($type, array(self::HEAD, self::GET, self::DELETE))) {
606 602
 				$options['data_format'] = 'query';
607
-			}
608
-			else {
603
+			} else {
609 604
 				$options['data_format'] = 'body';
610 605
 			}
611 606
 		}
@@ -642,8 +637,7 @@  discard block
 block discarded – undo
642 637
 
643 638
 			$headers = substr($return->raw, 0, $pos);
644 639
 			$return->body = substr($return->raw, $pos + strlen("\n\r\n\r"));
645
-		}
646
-		else {
640
+		} else {
647 641
 			$return->body = '';
648 642
 		}
649 643
 		// Pretend CRLF = LF for compatibility (RFC 2616, section 19.3)
@@ -706,8 +700,7 @@  discard block
 block discarded – undo
706 700
 				$redirected = self::request($location, $req_headers, $req_data, $options['type'], $options);
707 701
 				$redirected->history[] = $return;
708 702
 				return $redirected;
709
-			}
710
-			elseif ($options['redirected'] >= $options['redirects']) {
703
+			} elseif ($options['redirected'] >= $options['redirects']) {
711 704
 				throw new Requests_Exception('Too many redirects', 'toomanyredirects', $return);
712 705
 			}
713 706
 		}
@@ -735,8 +728,7 @@  discard block
 block discarded – undo
735 728
 			$data = $request['data'];
736 729
 			$options = $request['options'];
737 730
 			$response = self::parse_response($response, $url, $headers, $data, $options);
738
-		}
739
-		catch (Requests_Exception $e) {
731
+		} catch (Requests_Exception $e) {
740 732
 			$response = $e;
741 733
 		}
742 734
 	}
@@ -826,14 +818,11 @@  discard block
 block discarded – undo
826 818
 
827 819
 		if (function_exists('gzdecode') && ($decoded = @gzdecode($data)) !== false) {
828 820
 			return $decoded;
829
-		}
830
-		elseif (function_exists('gzinflate') && ($decoded = @gzinflate($data)) !== false) {
821
+		} elseif (function_exists('gzinflate') && ($decoded = @gzinflate($data)) !== false) {
831 822
 			return $decoded;
832
-		}
833
-		elseif (($decoded = self::compatible_gzinflate($data)) !== false) {
823
+		} elseif (($decoded = self::compatible_gzinflate($data)) !== false) {
834 824
 			return $decoded;
835
-		}
836
-		elseif (function_exists('gzuncompress') && ($decoded = @gzuncompress($data)) !== false) {
825
+		} elseif (function_exists('gzuncompress') && ($decoded = @gzuncompress($data)) !== false) {
837 826
 			return $decoded;
838 827
 		}
839 828
 
Please login to merge, or discard this patch.
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -142,8 +142,8 @@  discard block
 block discarded – undo
142 142
 		}
143 143
 
144 144
 		$file = str_replace('_', '/', $class);
145
-		if (file_exists(dirname(__FILE__) . '/' . $file . '.php')) {
146
-			require_once(dirname(__FILE__) . '/' . $file . '.php');
145
+		if (file_exists(dirname(__FILE__).'/'.$file.'.php')) {
146
+			require_once(dirname(__FILE__).'/'.$file.'.php');
147 147
 		}
148 148
 	}
149 149
 
@@ -200,7 +200,7 @@  discard block
 block discarded – undo
200 200
 
201 201
 		// Find us a working transport
202 202
 		foreach (self::$transports as $class) {
203
-			if (!class_exists($class)) {
203
+			if ( ! class_exists($class)) {
204 204
 				continue;
205 205
 			}
206 206
 
@@ -364,7 +364,7 @@  discard block
 block discarded – undo
364 364
 
365 365
 		$options['hooks']->dispatch('requests.before_request', array(&$url, &$headers, &$data, &$type, &$options));
366 366
 
367
-		if (!empty($options['transport'])) {
367
+		if ( ! empty($options['transport'])) {
368 368
 			$transport = $options['transport'];
369 369
 
370 370
 			if (is_string($options['transport'])) {
@@ -427,24 +427,24 @@  discard block
 block discarded – undo
427 427
 	public static function request_multiple($requests, $options = array()) {
428 428
 		$options = array_merge(self::get_default_options(true), $options);
429 429
 
430
-		if (!empty($options['hooks'])) {
430
+		if ( ! empty($options['hooks'])) {
431 431
 			$options['hooks']->register('transport.internal.parse_response', array('Requests', 'parse_multiple'));
432
-			if (!empty($options['complete'])) {
432
+			if ( ! empty($options['complete'])) {
433 433
 				$options['hooks']->register('multiple.request.complete', $options['complete']);
434 434
 			}
435 435
 		}
436 436
 
437 437
 		foreach ($requests as $id => &$request) {
438
-			if (!isset($request['headers'])) {
438
+			if ( ! isset($request['headers'])) {
439 439
 				$request['headers'] = array();
440 440
 			}
441
-			if (!isset($request['data'])) {
441
+			if ( ! isset($request['data'])) {
442 442
 				$request['data'] = array();
443 443
 			}
444
-			if (!isset($request['type'])) {
444
+			if ( ! isset($request['type'])) {
445 445
 				$request['type'] = self::GET;
446 446
 			}
447
-			if (!isset($request['options'])) {
447
+			if ( ! isset($request['options'])) {
448 448
 				$request['options'] = $options;
449 449
 				$request['options']['type'] = $request['type'];
450 450
 			}
@@ -460,14 +460,14 @@  discard block
 block discarded – undo
460 460
 			// Ensure we only hook in once
461 461
 			if ($request['options']['hooks'] !== $options['hooks']) {
462 462
 				$request['options']['hooks']->register('transport.internal.parse_response', array('Requests', 'parse_multiple'));
463
-				if (!empty($request['options']['complete'])) {
463
+				if ( ! empty($request['options']['complete'])) {
464 464
 					$request['options']['hooks']->register('multiple.request.complete', $request['options']['complete']);
465 465
 				}
466 466
 			}
467 467
 		}
468 468
 		unset($request);
469 469
 
470
-		if (!empty($options['transport'])) {
470
+		if ( ! empty($options['transport'])) {
471 471
 			$transport = $options['transport'];
472 472
 
473 473
 			if (is_string($options['transport'])) {
@@ -503,7 +503,7 @@  discard block
 block discarded – undo
503 503
 		$defaults = array(
504 504
 			'timeout' => 10,
505 505
 			'connect_timeout' => 10,
506
-			'useragent' => 'php-requests/' . self::VERSION,
506
+			'useragent' => 'php-requests/'.self::VERSION,
507 507
 			'protocol_version' => 1.1,
508 508
 			'redirected' => 0,
509 509
 			'redirects' => 10,
@@ -533,11 +533,11 @@  discard block
 block discarded – undo
533 533
 	 * @return string Default certificate path.
534 534
 	 */
535 535
 	public static function get_certificate_path() {
536
-		if ( ! empty( Requests::$certificate_path ) ) {
536
+		if ( ! empty(Requests::$certificate_path)) {
537 537
 			return Requests::$certificate_path;
538 538
 		}
539 539
 
540
-		return dirname(__FILE__) . '/Requests/Transport/cacert.pem';
540
+		return dirname(__FILE__).'/Requests/Transport/cacert.pem';
541 541
 	}
542 542
 
543 543
 	/**
@@ -545,7 +545,7 @@  discard block
 block discarded – undo
545 545
 	 *
546 546
 	 * @param string $path Certificate path, pointing to a PEM file.
547 547
 	 */
548
-	public static function set_certificate_path( $path ) {
548
+	public static function set_certificate_path($path) {
549 549
 		Requests::$certificate_path = $path;
550 550
 	}
551 551
 
@@ -560,7 +560,7 @@  discard block
 block discarded – undo
560 560
 	 * @return array $options
561 561
 	 */
562 562
 	protected static function set_defaults(&$url, &$headers, &$data, &$type, &$options) {
563
-		if (!preg_match('/^http(s)?:\/\//i', $url, $matches)) {
563
+		if ( ! preg_match('/^http(s)?:\/\//i', $url, $matches)) {
564 564
 			throw new Requests_Exception('Only HTTP(S) requests are handled.', 'nonhttp', $url);
565 565
 		}
566 566
 
@@ -601,7 +601,7 @@  discard block
 block discarded – undo
601 601
 		// Massage the type to ensure we support it.
602 602
 		$type = strtoupper($type);
603 603
 
604
-		if (!isset($options['data_format'])) {
604
+		if ( ! isset($options['data_format'])) {
605 605
 			if (in_array($type, array(self::HEAD, self::GET, self::DELETE))) {
606 606
 				$options['data_format'] = 'query';
607 607
 			}
@@ -627,14 +627,14 @@  discard block
 block discarded – undo
627 627
 	 */
628 628
 	protected static function parse_response($headers, $url, $req_headers, $req_data, $options) {
629 629
 		$return = new Requests_Response();
630
-		if (!$options['blocking']) {
630
+		if ( ! $options['blocking']) {
631 631
 			return $return;
632 632
 		}
633 633
 
634 634
 		$return->raw = $headers;
635 635
 		$return->url = $url;
636 636
 
637
-		if (!$options['filename']) {
637
+		if ( ! $options['filename']) {
638 638
 			if (($pos = strpos($headers, "\r\n\r\n")) === false) {
639 639
 				// Crap!
640 640
 				throw new Requests_Exception('Missing header/body separator', 'requests.no_crlf_separator');
@@ -749,7 +749,7 @@  discard block
 block discarded – undo
749 749
 	 * @return string Decoded body
750 750
 	 */
751 751
 	protected static function decode_chunked($data) {
752
-		if (!preg_match('/^([0-9a-f]+)(?:;(?:[\w-]*)(?:=(?:(?:[\w-]*)*|"(?:[^\r\n])*"))?)*\r\n/i', trim($data))) {
752
+		if ( ! preg_match('/^([0-9a-f]+)(?:;(?:[\w-]*)(?:=(?:(?:[\w-]*)*|"(?:[^\r\n])*"))?)*\r\n/i', trim($data))) {
753 753
 			return $data;
754 754
 		}
755 755
 
@@ -760,7 +760,7 @@  discard block
 block discarded – undo
760 760
 
761 761
 		while (true) {
762 762
 			$is_chunked = (bool) preg_match('/^([0-9a-f]+)(?:;(?:[\w-]*)(?:=(?:(?:[\w-]*)*|"(?:[^\r\n])*"))?)*\r\n/i', $encoded, $matches);
763
-			if (!$is_chunked) {
763
+			if ( ! $is_chunked) {
764 764
 				// Looks like it's not chunked after all
765 765
 				return $data;
766 766
 			}
@@ -929,7 +929,7 @@  discard block
 block discarded – undo
929 929
 			// between a compressed document, and a ZIP file
930 930
 			$zip_compressed_on_the_fly = (0x08 == (0x08 & $general_purpose_flag));
931 931
 
932
-			if (!$zip_compressed_on_the_fly) {
932
+			if ( ! $zip_compressed_on_the_fly) {
933 933
 				// Don't attempt to decode a compressed zip file
934 934
 				return $gzData;
935 935
 			}
Please login to merge, or discard this patch.
src/wp-includes/l10n.php 3 patches
Braces   +36 added lines, -23 removed lines patch added patch discarded remove patch
@@ -489,14 +489,16 @@  discard block
 block discarded – undo
489 489
  * @return string Either $single or $plural translated text.
490 490
  */
491 491
 function translate_nooped_plural( $nooped_plural, $count, $domain = 'default' ) {
492
-	if ( $nooped_plural['domain'] )
493
-		$domain = $nooped_plural['domain'];
492
+	if ( $nooped_plural['domain'] ) {
493
+			$domain = $nooped_plural['domain'];
494
+	}
494 495
 
495
-	if ( $nooped_plural['context'] )
496
-		return _nx( $nooped_plural['singular'], $nooped_plural['plural'], $count, $nooped_plural['context'], $domain );
497
-	else
498
-		return _n( $nooped_plural['singular'], $nooped_plural['plural'], $count, $domain );
499
-}
496
+	if ( $nooped_plural['context'] ) {
497
+			return _nx( $nooped_plural['singular'], $nooped_plural['plural'], $count, $nooped_plural['context'], $domain );
498
+	} else {
499
+			return _n( $nooped_plural['singular'], $nooped_plural['plural'], $count, $domain );
500
+	}
501
+	}
500 502
 
501 503
 /**
502 504
  * Load a .mo file into the text domain $domain.
@@ -558,13 +560,18 @@  discard block
 block discarded – undo
558 560
 	 */
559 561
 	$mofile = apply_filters( 'load_textdomain_mofile', $mofile, $domain );
560 562
 
561
-	if ( !is_readable( $mofile ) ) return false;
563
+	if ( !is_readable( $mofile ) ) {
564
+		return false;
565
+	}
562 566
 
563 567
 	$mo = new MO();
564
-	if ( !$mo->import_from_file( $mofile ) ) return false;
568
+	if ( !$mo->import_from_file( $mofile ) ) {
569
+		return false;
570
+	}
565 571
 
566
-	if ( isset( $l10n[$domain] ) )
567
-		$mo->merge_with( $l10n[$domain] );
572
+	if ( isset( $l10n[$domain] ) ) {
573
+			$mo->merge_with( $l10n[$domain] );
574
+	}
568 575
 
569 576
 	unset( $l10n_unloaded[ $domain ] );
570 577
 
@@ -657,8 +664,9 @@  discard block
 block discarded – undo
657 664
 		load_textdomain( 'default', WP_LANG_DIR . "/admin-$locale.mo" );
658 665
 	}
659 666
 
660
-	if ( is_network_admin() || ( defined( 'WP_INSTALLING_NETWORK' ) && WP_INSTALLING_NETWORK ) )
661
-		load_textdomain( 'default', WP_LANG_DIR . "/admin-network-$locale.mo" );
667
+	if ( is_network_admin() || ( defined( 'WP_INSTALLING_NETWORK' ) && WP_INSTALLING_NETWORK ) ) {
668
+			load_textdomain( 'default', WP_LANG_DIR . "/admin-network-$locale.mo" );
669
+	}
662 670
 
663 671
 	return $return;
664 672
 }
@@ -793,8 +801,9 @@  discard block
 block discarded – undo
793 801
  * @return bool True when the theme textdomain is successfully loaded, false otherwise.
794 802
  */
795 803
 function load_child_theme_textdomain( $domain, $path = false ) {
796
-	if ( ! $path )
797
-		$path = get_stylesheet_directory();
804
+	if ( ! $path ) {
805
+			$path = get_stylesheet_directory();
806
+	}
798 807
 	return load_theme_textdomain( $domain, $path );
799 808
 }
800 809
 
@@ -957,20 +966,24 @@  discard block
 block discarded – undo
957 966
  * @return array Array of language data.
958 967
  */
959 968
 function wp_get_installed_translations( $type ) {
960
-	if ( $type !== 'themes' && $type !== 'plugins' && $type !== 'core' )
961
-		return array();
969
+	if ( $type !== 'themes' && $type !== 'plugins' && $type !== 'core' ) {
970
+			return array();
971
+	}
962 972
 
963 973
 	$dir = 'core' === $type ? '' : "/$type";
964 974
 
965
-	if ( ! is_dir( WP_LANG_DIR ) )
966
-		return array();
975
+	if ( ! is_dir( WP_LANG_DIR ) ) {
976
+			return array();
977
+	}
967 978
 
968
-	if ( $dir && ! is_dir( WP_LANG_DIR . $dir ) )
969
-		return array();
979
+	if ( $dir && ! is_dir( WP_LANG_DIR . $dir ) ) {
980
+			return array();
981
+	}
970 982
 
971 983
 	$files = scandir( WP_LANG_DIR . $dir );
972
-	if ( ! $files )
973
-		return array();
984
+	if ( ! $files ) {
985
+			return array();
986
+	}
974 987
 
975 988
 	$language_data = array();
976 989
 
Please login to merge, or discard this patch.
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -83,7 +83,7 @@
 block discarded – undo
83 83
  *
84 84
  * @since 4.7.0
85 85
  *
86
- * @param int|WP_User $user_id User's ID or a WP_User object. Defaults to current user.
86
+ * @param integer $user_id User's ID or a WP_User object. Defaults to current user.
87 87
  * @return string The locale of the user.
88 88
  */
89 89
 function get_user_locale( $user_id = 0 ) {
Please login to merge, or discard this patch.
Spacing   +214 added lines, -214 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
 function get_locale() {
31 31
 	global $locale, $wp_local_package;
32 32
 
33
-	if ( isset( $locale ) ) {
33
+	if (isset($locale)) {
34 34
 		/**
35 35
 		 * Filters WordPress install's locale ID.
36 36
 		 *
@@ -38,41 +38,41 @@  discard block
 block discarded – undo
38 38
 		 *
39 39
 		 * @param string $locale The locale ID.
40 40
 		 */
41
-		return apply_filters( 'locale', $locale );
41
+		return apply_filters('locale', $locale);
42 42
 	}
43 43
 
44
-	if ( isset( $wp_local_package ) ) {
44
+	if (isset($wp_local_package)) {
45 45
 		$locale = $wp_local_package;
46 46
 	}
47 47
 
48 48
 	// WPLANG was defined in wp-config.
49
-	if ( defined( 'WPLANG' ) ) {
49
+	if (defined('WPLANG')) {
50 50
 		$locale = WPLANG;
51 51
 	}
52 52
 
53 53
 	// If multisite, check options.
54
-	if ( is_multisite() ) {
54
+	if (is_multisite()) {
55 55
 		// Don't check blog option when installing.
56
-		if ( wp_installing() || ( false === $ms_locale = get_option( 'WPLANG' ) ) ) {
57
-			$ms_locale = get_site_option( 'WPLANG' );
56
+		if (wp_installing() || (false === $ms_locale = get_option('WPLANG'))) {
57
+			$ms_locale = get_site_option('WPLANG');
58 58
 		}
59 59
 
60
-		if ( $ms_locale !== false ) {
60
+		if ($ms_locale !== false) {
61 61
 			$locale = $ms_locale;
62 62
 		}
63 63
 	} else {
64
-		$db_locale = get_option( 'WPLANG' );
65
-		if ( $db_locale !== false ) {
64
+		$db_locale = get_option('WPLANG');
65
+		if ($db_locale !== false) {
66 66
 			$locale = $db_locale;
67 67
 		}
68 68
 	}
69 69
 
70
-	if ( empty( $locale ) ) {
70
+	if (empty($locale)) {
71 71
 		$locale = 'en_US';
72 72
 	}
73 73
 
74 74
 	/** This filter is documented in wp-includes/l10n.php */
75
-	return apply_filters( 'locale', $locale );
75
+	return apply_filters('locale', $locale);
76 76
 }
77 77
 
78 78
 /**
@@ -86,17 +86,17 @@  discard block
 block discarded – undo
86 86
  * @param int|WP_User $user_id User's ID or a WP_User object. Defaults to current user.
87 87
  * @return string The locale of the user.
88 88
  */
89
-function get_user_locale( $user_id = 0 ) {
89
+function get_user_locale($user_id = 0) {
90 90
 	$user = false;
91
-	if ( 0 === $user_id && function_exists( 'wp_get_current_user' ) ) {
91
+	if (0 === $user_id && function_exists('wp_get_current_user')) {
92 92
 		$user = wp_get_current_user();
93
-	} elseif ( $user_id instanceof WP_User ) {
93
+	} elseif ($user_id instanceof WP_User) {
94 94
 		$user = $user_id;
95
-	} elseif ( $user_id && is_numeric( $user_id ) ) {
96
-		$user = get_user_by( 'id', $user_id );
95
+	} elseif ($user_id && is_numeric($user_id)) {
96
+		$user = get_user_by('id', $user_id);
97 97
 	}
98 98
 
99
-	if ( ! $user ) {
99
+	if ( ! $user) {
100 100
 		return get_locale();
101 101
 	}
102 102
 
@@ -118,9 +118,9 @@  discard block
 block discarded – undo
118 118
  *                       Default 'default'.
119 119
  * @return string Translated text
120 120
  */
121
-function translate( $text, $domain = 'default' ) {
122
-	$translations = get_translations_for_domain( $domain );
123
-	$translation  = $translations->translate( $text );
121
+function translate($text, $domain = 'default') {
122
+	$translations = get_translations_for_domain($domain);
123
+	$translation  = $translations->translate($text);
124 124
 
125 125
 	/**
126 126
 	 * Filters text with its translation.
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
 	 * @param string $text         Text to translate.
132 132
 	 * @param string $domain       Text domain. Unique identifier for retrieving translated strings.
133 133
 	 */
134
-	return apply_filters( 'gettext', $translation, $text, $domain );
134
+	return apply_filters('gettext', $translation, $text, $domain);
135 135
 }
136 136
 
137 137
 /**
@@ -145,12 +145,12 @@  discard block
 block discarded – undo
145 145
  * @param string $string A pipe-delimited string.
146 146
  * @return string Either $string or everything before the last pipe.
147 147
  */
148
-function before_last_bar( $string ) {
149
-	$last_bar = strrpos( $string, '|' );
150
-	if ( false === $last_bar ) {
148
+function before_last_bar($string) {
149
+	$last_bar = strrpos($string, '|');
150
+	if (false === $last_bar) {
151 151
 		return $string;
152 152
 	} else {
153
-		return substr( $string, 0, $last_bar );
153
+		return substr($string, 0, $last_bar);
154 154
 	}
155 155
 }
156 156
 
@@ -170,9 +170,9 @@  discard block
 block discarded – undo
170 170
  *                        Default 'default'.
171 171
  * @return string Translated text on success, original text on failure.
172 172
  */
173
-function translate_with_gettext_context( $text, $context, $domain = 'default' ) {
174
-	$translations = get_translations_for_domain( $domain );
175
-	$translation  = $translations->translate( $text, $context );
173
+function translate_with_gettext_context($text, $context, $domain = 'default') {
174
+	$translations = get_translations_for_domain($domain);
175
+	$translation  = $translations->translate($text, $context);
176 176
 	/**
177 177
 	 * Filters text with its translation based on context information.
178 178
 	 *
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
 	 * @param string $context      Context information for the translators.
184 184
 	 * @param string $domain       Text domain. Unique identifier for retrieving translated strings.
185 185
 	 */
186
-	return apply_filters( 'gettext_with_context', $translation, $text, $context, $domain );
186
+	return apply_filters('gettext_with_context', $translation, $text, $context, $domain);
187 187
 }
188 188
 
189 189
 /**
@@ -198,8 +198,8 @@  discard block
 block discarded – undo
198 198
  *                       Default 'default'.
199 199
  * @return string Translated text.
200 200
  */
201
-function __( $text, $domain = 'default' ) {
202
-	return translate( $text, $domain );
201
+function __($text, $domain = 'default') {
202
+	return translate($text, $domain);
203 203
 }
204 204
 
205 205
 /**
@@ -214,8 +214,8 @@  discard block
 block discarded – undo
214 214
  *                       Default 'default'.
215 215
  * @return string Translated text on success, original text on failure.
216 216
  */
217
-function esc_attr__( $text, $domain = 'default' ) {
218
-	return esc_attr( translate( $text, $domain ) );
217
+function esc_attr__($text, $domain = 'default') {
218
+	return esc_attr(translate($text, $domain));
219 219
 }
220 220
 
221 221
 /**
@@ -230,8 +230,8 @@  discard block
 block discarded – undo
230 230
  *                       Default 'default'.
231 231
  * @return string Translated text
232 232
  */
233
-function esc_html__( $text, $domain = 'default' ) {
234
-	return esc_html( translate( $text, $domain ) );
233
+function esc_html__($text, $domain = 'default') {
234
+	return esc_html(translate($text, $domain));
235 235
 }
236 236
 
237 237
 /**
@@ -243,8 +243,8 @@  discard block
 block discarded – undo
243 243
  * @param string $domain Optional. Text domain. Unique identifier for retrieving translated strings.
244 244
  *                       Default 'default'.
245 245
  */
246
-function _e( $text, $domain = 'default' ) {
247
-	echo translate( $text, $domain );
246
+function _e($text, $domain = 'default') {
247
+	echo translate($text, $domain);
248 248
 }
249 249
 
250 250
 /**
@@ -256,8 +256,8 @@  discard block
 block discarded – undo
256 256
  * @param string $domain Optional. Text domain. Unique identifier for retrieving translated strings.
257 257
  *                       Default 'default'.
258 258
  */
259
-function esc_attr_e( $text, $domain = 'default' ) {
260
-	echo esc_attr( translate( $text, $domain ) );
259
+function esc_attr_e($text, $domain = 'default') {
260
+	echo esc_attr(translate($text, $domain));
261 261
 }
262 262
 
263 263
 /**
@@ -269,8 +269,8 @@  discard block
 block discarded – undo
269 269
  * @param string $domain Optional. Text domain. Unique identifier for retrieving translated strings.
270 270
  *                       Default 'default'.
271 271
  */
272
-function esc_html_e( $text, $domain = 'default' ) {
273
-	echo esc_html( translate( $text, $domain ) );
272
+function esc_html_e($text, $domain = 'default') {
273
+	echo esc_html(translate($text, $domain));
274 274
 }
275 275
 
276 276
 /**
@@ -290,8 +290,8 @@  discard block
 block discarded – undo
290 290
  *                        Default 'default'.
291 291
  * @return string Translated context string without pipe.
292 292
  */
293
-function _x( $text, $context, $domain = 'default' ) {
294
-	return translate_with_gettext_context( $text, $context, $domain );
293
+function _x($text, $context, $domain = 'default') {
294
+	return translate_with_gettext_context($text, $context, $domain);
295 295
 }
296 296
 
297 297
 /**
@@ -305,8 +305,8 @@  discard block
 block discarded – undo
305 305
  *                        Default 'default'.
306 306
  * @return string Translated context string without pipe.
307 307
  */
308
-function _ex( $text, $context, $domain = 'default' ) {
309
-	echo _x( $text, $context, $domain );
308
+function _ex($text, $context, $domain = 'default') {
309
+	echo _x($text, $context, $domain);
310 310
 }
311 311
 
312 312
 /**
@@ -320,8 +320,8 @@  discard block
 block discarded – undo
320 320
  *                        Default 'default'.
321 321
  * @return string Translated text
322 322
  */
323
-function esc_attr_x( $text, $context, $domain = 'default' ) {
324
-	return esc_attr( translate_with_gettext_context( $text, $context, $domain ) );
323
+function esc_attr_x($text, $context, $domain = 'default') {
324
+	return esc_attr(translate_with_gettext_context($text, $context, $domain));
325 325
 }
326 326
 
327 327
 /**
@@ -335,8 +335,8 @@  discard block
 block discarded – undo
335 335
  *                        Default 'default'.
336 336
  * @return string Translated text.
337 337
  */
338
-function esc_html_x( $text, $context, $domain = 'default' ) {
339
-	return esc_html( translate_with_gettext_context( $text, $context, $domain ) );
338
+function esc_html_x($text, $context, $domain = 'default') {
339
+	return esc_html(translate_with_gettext_context($text, $context, $domain));
340 340
 }
341 341
 
342 342
 /**
@@ -358,9 +358,9 @@  discard block
 block discarded – undo
358 358
  *                       Default 'default'.
359 359
  * @return string The translated singular or plural form.
360 360
  */
361
-function _n( $single, $plural, $number, $domain = 'default' ) {
362
-	$translations = get_translations_for_domain( $domain );
363
-	$translation  = $translations->translate_plural( $single, $plural, $number );
361
+function _n($single, $plural, $number, $domain = 'default') {
362
+	$translations = get_translations_for_domain($domain);
363
+	$translation  = $translations->translate_plural($single, $plural, $number);
364 364
 
365 365
 	/**
366 366
 	 * Filters the singular or plural form of a string.
@@ -373,7 +373,7 @@  discard block
 block discarded – undo
373 373
 	 * @param string $number      The number to compare against to use either the singular or plural form.
374 374
 	 * @param string $domain      Text domain. Unique identifier for retrieving translated strings.
375 375
 	 */
376
-	return apply_filters( 'ngettext', $translation, $single, $plural, $number, $domain );
376
+	return apply_filters('ngettext', $translation, $single, $plural, $number, $domain);
377 377
 }
378 378
 
379 379
 /**
@@ -400,8 +400,8 @@  discard block
 block discarded – undo
400 400
  * @return string The translated singular or plural form.
401 401
  */
402 402
 function _nx($single, $plural, $number, $context, $domain = 'default') {
403
-	$translations = get_translations_for_domain( $domain );
404
-	$translation  = $translations->translate_plural( $single, $plural, $number, $context );
403
+	$translations = get_translations_for_domain($domain);
404
+	$translation  = $translations->translate_plural($single, $plural, $number, $context);
405 405
 
406 406
 	/**
407 407
 	 * Filters the singular or plural form of a string with gettext context.
@@ -415,7 +415,7 @@  discard block
 block discarded – undo
415 415
 	 * @param string $context     Context information for the translators.
416 416
 	 * @param string $domain      Text domain. Unique identifier for retrieving translated strings.
417 417
 	 */
418
-	return apply_filters( 'ngettext_with_context', $translation, $single, $plural, $number, $context, $domain );
418
+	return apply_filters('ngettext_with_context', $translation, $single, $plural, $number, $context, $domain);
419 419
 }
420 420
 
421 421
 /**
@@ -447,8 +447,8 @@  discard block
 block discarded – undo
447 447
  *     @type string $domain   Text domain.
448 448
  * }
449 449
  */
450
-function _n_noop( $singular, $plural, $domain = null ) {
451
-	return array( 0 => $singular, 1 => $plural, 'singular' => $singular, 'plural' => $plural, 'context' => null, 'domain' => $domain );
450
+function _n_noop($singular, $plural, $domain = null) {
451
+	return array(0 => $singular, 1 => $plural, 'singular' => $singular, 'plural' => $plural, 'context' => null, 'domain' => $domain);
452 452
 }
453 453
 
454 454
 /**
@@ -486,8 +486,8 @@  discard block
 block discarded – undo
486 486
  *     @type string $domain   Text domain.
487 487
  * }
488 488
  */
489
-function _nx_noop( $singular, $plural, $context, $domain = null ) {
490
-	return array( 0 => $singular, 1 => $plural, 2 => $context, 'singular' => $singular, 'plural' => $plural, 'context' => $context, 'domain' => $domain );
489
+function _nx_noop($singular, $plural, $context, $domain = null) {
490
+	return array(0 => $singular, 1 => $plural, 2 => $context, 'singular' => $singular, 'plural' => $plural, 'context' => $context, 'domain' => $domain);
491 491
 }
492 492
 
493 493
 /**
@@ -510,14 +510,14 @@  discard block
 block discarded – undo
510 510
  *                              a text domain passed to _n_noop() or _nx_noop(), it will override this value. Default 'default'.
511 511
  * @return string Either $single or $plural translated text.
512 512
  */
513
-function translate_nooped_plural( $nooped_plural, $count, $domain = 'default' ) {
514
-	if ( $nooped_plural['domain'] )
513
+function translate_nooped_plural($nooped_plural, $count, $domain = 'default') {
514
+	if ($nooped_plural['domain'])
515 515
 		$domain = $nooped_plural['domain'];
516 516
 
517
-	if ( $nooped_plural['context'] )
518
-		return _nx( $nooped_plural['singular'], $nooped_plural['plural'], $count, $nooped_plural['context'], $domain );
517
+	if ($nooped_plural['context'])
518
+		return _nx($nooped_plural['singular'], $nooped_plural['plural'], $count, $nooped_plural['context'], $domain);
519 519
 	else
520
-		return _n( $nooped_plural['singular'], $nooped_plural['plural'], $count, $domain );
520
+		return _n($nooped_plural['singular'], $nooped_plural['plural'], $count, $domain);
521 521
 }
522 522
 
523 523
 /**
@@ -538,7 +538,7 @@  discard block
 block discarded – undo
538 538
  * @param string $mofile Path to the .mo file.
539 539
  * @return bool True on success, false on failure.
540 540
  */
541
-function load_textdomain( $domain, $mofile ) {
541
+function load_textdomain($domain, $mofile) {
542 542
 	global $l10n, $l10n_unloaded;
543 543
 
544 544
 	$l10n_unloaded = (array) $l10n_unloaded;
@@ -552,10 +552,10 @@  discard block
 block discarded – undo
552 552
 	 * @param string $domain   Text domain. Unique identifier for retrieving translated strings.
553 553
 	 * @param string $mofile   Path to the MO file.
554 554
 	 */
555
-	$plugin_override = apply_filters( 'override_load_textdomain', false, $domain, $mofile );
555
+	$plugin_override = apply_filters('override_load_textdomain', false, $domain, $mofile);
556 556
 
557
-	if ( true == $plugin_override ) {
558
-		unset( $l10n_unloaded[ $domain ] );
557
+	if (true == $plugin_override) {
558
+		unset($l10n_unloaded[$domain]);
559 559
 
560 560
 		return true;
561 561
 	}
@@ -568,7 +568,7 @@  discard block
 block discarded – undo
568 568
 	 * @param string $domain Text domain. Unique identifier for retrieving translated strings.
569 569
 	 * @param string $mofile Path to the .mo file.
570 570
 	 */
571
-	do_action( 'load_textdomain', $domain, $mofile );
571
+	do_action('load_textdomain', $domain, $mofile);
572 572
 
573 573
 	/**
574 574
 	 * Filters MO file path for loading translations for a specific text domain.
@@ -578,17 +578,17 @@  discard block
 block discarded – undo
578 578
 	 * @param string $mofile Path to the MO file.
579 579
 	 * @param string $domain Text domain. Unique identifier for retrieving translated strings.
580 580
 	 */
581
-	$mofile = apply_filters( 'load_textdomain_mofile', $mofile, $domain );
581
+	$mofile = apply_filters('load_textdomain_mofile', $mofile, $domain);
582 582
 
583
-	if ( !is_readable( $mofile ) ) return false;
583
+	if ( ! is_readable($mofile)) return false;
584 584
 
585 585
 	$mo = new MO();
586
-	if ( !$mo->import_from_file( $mofile ) ) return false;
586
+	if ( ! $mo->import_from_file($mofile)) return false;
587 587
 
588
-	if ( isset( $l10n[$domain] ) )
589
-		$mo->merge_with( $l10n[$domain] );
588
+	if (isset($l10n[$domain]))
589
+		$mo->merge_with($l10n[$domain]);
590 590
 
591
-	unset( $l10n_unloaded[ $domain ] );
591
+	unset($l10n_unloaded[$domain]);
592 592
 
593 593
 	$l10n[$domain] = &$mo;
594 594
 
@@ -606,7 +606,7 @@  discard block
 block discarded – undo
606 606
  * @param string $domain Text domain. Unique identifier for retrieving translated strings.
607 607
  * @return bool Whether textdomain was unloaded.
608 608
  */
609
-function unload_textdomain( $domain ) {
609
+function unload_textdomain($domain) {
610 610
 	global $l10n, $l10n_unloaded;
611 611
 
612 612
 	$l10n_unloaded = (array) $l10n_unloaded;
@@ -619,10 +619,10 @@  discard block
 block discarded – undo
619 619
 	 * @param bool   $override Whether to override the text domain unloading. Default false.
620 620
 	 * @param string $domain   Text domain. Unique identifier for retrieving translated strings.
621 621
 	 */
622
-	$plugin_override = apply_filters( 'override_unload_textdomain', false, $domain );
622
+	$plugin_override = apply_filters('override_unload_textdomain', false, $domain);
623 623
 
624
-	if ( $plugin_override ) {
625
-		$l10n_unloaded[ $domain ] = true;
624
+	if ($plugin_override) {
625
+		$l10n_unloaded[$domain] = true;
626 626
 
627 627
 		return true;
628 628
 	}
@@ -634,12 +634,12 @@  discard block
 block discarded – undo
634 634
 	 *
635 635
 	 * @param string $domain Text domain. Unique identifier for retrieving translated strings.
636 636
 	 */
637
-	do_action( 'unload_textdomain', $domain );
637
+	do_action('unload_textdomain', $domain);
638 638
 
639
-	if ( isset( $l10n[$domain] ) ) {
640
-		unset( $l10n[$domain] );
639
+	if (isset($l10n[$domain])) {
640
+		unset($l10n[$domain]);
641 641
 
642
-		$l10n_unloaded[ $domain ] = true;
642
+		$l10n_unloaded[$domain] = true;
643 643
 
644 644
 		return true;
645 645
 	}
@@ -660,27 +660,27 @@  discard block
 block discarded – undo
660 660
  * @param string $locale Optional. Locale to load. Default is the value of get_locale().
661 661
  * @return bool Whether the textdomain was loaded.
662 662
  */
663
-function load_default_textdomain( $locale = null ) {
664
-	if ( null === $locale ) {
663
+function load_default_textdomain($locale = null) {
664
+	if (null === $locale) {
665 665
 		$locale = is_admin() ? get_user_locale() : get_locale();
666 666
 	}
667 667
 
668 668
 	// Unload previously loaded strings so we can switch translations.
669
-	unload_textdomain( 'default' );
669
+	unload_textdomain('default');
670 670
 
671
-	$return = load_textdomain( 'default', WP_LANG_DIR . "/$locale.mo" );
671
+	$return = load_textdomain('default', WP_LANG_DIR."/$locale.mo");
672 672
 
673
-	if ( ( is_multisite() || ( defined( 'WP_INSTALLING_NETWORK' ) && WP_INSTALLING_NETWORK ) ) && ! file_exists(  WP_LANG_DIR . "/admin-$locale.mo" ) ) {
674
-		load_textdomain( 'default', WP_LANG_DIR . "/ms-$locale.mo" );
673
+	if ((is_multisite() || (defined('WP_INSTALLING_NETWORK') && WP_INSTALLING_NETWORK)) && ! file_exists(WP_LANG_DIR."/admin-$locale.mo")) {
674
+		load_textdomain('default', WP_LANG_DIR."/ms-$locale.mo");
675 675
 		return $return;
676 676
 	}
677 677
 
678
-	if ( is_admin() || wp_installing() || ( defined( 'WP_REPAIRING' ) && WP_REPAIRING ) ) {
679
-		load_textdomain( 'default', WP_LANG_DIR . "/admin-$locale.mo" );
678
+	if (is_admin() || wp_installing() || (defined('WP_REPAIRING') && WP_REPAIRING)) {
679
+		load_textdomain('default', WP_LANG_DIR."/admin-$locale.mo");
680 680
 	}
681 681
 
682
-	if ( is_network_admin() || ( defined( 'WP_INSTALLING_NETWORK' ) && WP_INSTALLING_NETWORK ) )
683
-		load_textdomain( 'default', WP_LANG_DIR . "/admin-network-$locale.mo" );
682
+	if (is_network_admin() || (defined('WP_INSTALLING_NETWORK') && WP_INSTALLING_NETWORK))
683
+		load_textdomain('default', WP_LANG_DIR."/admin-network-$locale.mo");
684 684
 
685 685
 	return $return;
686 686
 }
@@ -701,7 +701,7 @@  discard block
 block discarded – undo
701 701
  *                                Default false.
702 702
  * @return bool True when textdomain is successfully loaded, false otherwise.
703 703
  */
704
-function load_plugin_textdomain( $domain, $deprecated = false, $plugin_rel_path = false ) {
704
+function load_plugin_textdomain($domain, $deprecated = false, $plugin_rel_path = false) {
705 705
 	/**
706 706
 	 * Filters a plugin's locale.
707 707
 	 *
@@ -710,25 +710,25 @@  discard block
 block discarded – undo
710 710
 	 * @param string $locale The plugin's current locale.
711 711
 	 * @param string $domain Text domain. Unique identifier for retrieving translated strings.
712 712
 	 */
713
-	$locale = apply_filters( 'plugin_locale', is_admin() ? get_user_locale() : get_locale(), $domain );
713
+	$locale = apply_filters('plugin_locale', is_admin() ? get_user_locale() : get_locale(), $domain);
714 714
 
715
-	$mofile = $domain . '-' . $locale . '.mo';
715
+	$mofile = $domain.'-'.$locale.'.mo';
716 716
 
717 717
 	// Try to load from the languages directory first.
718
-	if ( load_textdomain( $domain, WP_LANG_DIR . '/plugins/' . $mofile ) ) {
718
+	if (load_textdomain($domain, WP_LANG_DIR.'/plugins/'.$mofile)) {
719 719
 		return true;
720 720
 	}
721 721
 
722
-	if ( false !== $plugin_rel_path ) {
723
-		$path = WP_PLUGIN_DIR . '/' . trim( $plugin_rel_path, '/' );
724
-	} elseif ( false !== $deprecated ) {
725
-		_deprecated_argument( __FUNCTION__, '2.7.0' );
726
-		$path = ABSPATH . trim( $deprecated, '/' );
722
+	if (false !== $plugin_rel_path) {
723
+		$path = WP_PLUGIN_DIR.'/'.trim($plugin_rel_path, '/');
724
+	} elseif (false !== $deprecated) {
725
+		_deprecated_argument(__FUNCTION__, '2.7.0');
726
+		$path = ABSPATH.trim($deprecated, '/');
727 727
 	} else {
728 728
 		$path = WP_PLUGIN_DIR;
729 729
 	}
730 730
 
731
-	return load_textdomain( $domain, $path . '/' . $mofile );
731
+	return load_textdomain($domain, $path.'/'.$mofile);
732 732
 }
733 733
 
734 734
 /**
@@ -742,20 +742,20 @@  discard block
 block discarded – undo
742 742
  *                                   file resides. Default empty string.
743 743
  * @return bool True when textdomain is successfully loaded, false otherwise.
744 744
  */
745
-function load_muplugin_textdomain( $domain, $mu_plugin_rel_path = '' ) {
745
+function load_muplugin_textdomain($domain, $mu_plugin_rel_path = '') {
746 746
 	/** This filter is documented in wp-includes/l10n.php */
747
-	$locale = apply_filters( 'plugin_locale', is_admin() ? get_user_locale() : get_locale(), $domain );
747
+	$locale = apply_filters('plugin_locale', is_admin() ? get_user_locale() : get_locale(), $domain);
748 748
 
749
-	$mofile = $domain . '-' . $locale . '.mo';
749
+	$mofile = $domain.'-'.$locale.'.mo';
750 750
 
751 751
 	// Try to load from the languages directory first.
752
-	if ( load_textdomain( $domain, WP_LANG_DIR . '/plugins/' . $mofile ) ) {
752
+	if (load_textdomain($domain, WP_LANG_DIR.'/plugins/'.$mofile)) {
753 753
 		return true;
754 754
 	}
755 755
 
756
-	$path = WPMU_PLUGIN_DIR . '/' . ltrim( $mu_plugin_rel_path, '/' );
756
+	$path = WPMU_PLUGIN_DIR.'/'.ltrim($mu_plugin_rel_path, '/');
757 757
 
758
-	return load_textdomain( $domain, $path . '/' . $mofile );
758
+	return load_textdomain($domain, $path.'/'.$mofile);
759 759
 }
760 760
 
761 761
 /**
@@ -774,7 +774,7 @@  discard block
 block discarded – undo
774 774
  *                       Default false.
775 775
  * @return bool True when textdomain is successfully loaded, false otherwise.
776 776
  */
777
-function load_theme_textdomain( $domain, $path = false ) {
777
+function load_theme_textdomain($domain, $path = false) {
778 778
 	/**
779 779
 	 * Filters a theme's locale.
780 780
 	 *
@@ -783,20 +783,20 @@  discard block
 block discarded – undo
783 783
 	 * @param string $locale The theme's current locale.
784 784
 	 * @param string $domain Text domain. Unique identifier for retrieving translated strings.
785 785
 	 */
786
-	$locale = apply_filters( 'theme_locale', is_admin() ? get_user_locale() : get_locale(), $domain );
786
+	$locale = apply_filters('theme_locale', is_admin() ? get_user_locale() : get_locale(), $domain);
787 787
 
788
-	$mofile = $domain . '-' . $locale . '.mo';
788
+	$mofile = $domain.'-'.$locale.'.mo';
789 789
 
790 790
 	// Try to load from the languages directory first.
791
-	if ( load_textdomain( $domain, WP_LANG_DIR . '/themes/' . $mofile ) ) {
791
+	if (load_textdomain($domain, WP_LANG_DIR.'/themes/'.$mofile)) {
792 792
 		return true;
793 793
 	}
794 794
 
795
-	if ( ! $path ) {
795
+	if ( ! $path) {
796 796
 		$path = get_template_directory();
797 797
 	}
798 798
 
799
-	return load_textdomain( $domain, $path . '/' . $locale . '.mo' );
799
+	return load_textdomain($domain, $path.'/'.$locale.'.mo');
800 800
 }
801 801
 
802 802
 /**
@@ -814,10 +814,10 @@  discard block
 block discarded – undo
814 814
  *                       Default false.
815 815
  * @return bool True when the theme textdomain is successfully loaded, false otherwise.
816 816
  */
817
-function load_child_theme_textdomain( $domain, $path = false ) {
818
-	if ( ! $path )
817
+function load_child_theme_textdomain($domain, $path = false) {
818
+	if ( ! $path)
819 819
 		$path = get_stylesheet_directory();
820
-	return load_theme_textdomain( $domain, $path );
820
+	return load_theme_textdomain($domain, $path);
821 821
 }
822 822
 
823 823
 /**
@@ -836,22 +836,22 @@  discard block
 block discarded – undo
836 836
  * @param string $domain Text domain. Unique identifier for retrieving translated strings.
837 837
  * @return bool True when the textdomain is successfully loaded, false otherwise.
838 838
  */
839
-function _load_textdomain_just_in_time( $domain ) {
839
+function _load_textdomain_just_in_time($domain) {
840 840
 	global $l10n_unloaded;
841 841
 
842 842
 	$l10n_unloaded = (array) $l10n_unloaded;
843 843
 
844 844
 	// Short-circuit if domain is 'default' which is reserved for core.
845
-	if ( 'default' === $domain || isset( $l10n_unloaded[ $domain ] ) ) {
845
+	if ('default' === $domain || isset($l10n_unloaded[$domain])) {
846 846
 		return false;
847 847
 	}
848 848
 
849
-	$translation_path = _get_path_to_translation( $domain );
850
-	if ( false === $translation_path ) {
849
+	$translation_path = _get_path_to_translation($domain);
850
+	if (false === $translation_path) {
851 851
 		return false;
852 852
 	}
853 853
 
854
-	return load_textdomain( $domain, $translation_path );
854
+	return load_textdomain($domain, $translation_path);
855 855
 }
856 856
 
857 857
 /**
@@ -868,18 +868,18 @@  discard block
 block discarded – undo
868 868
  * @param bool   $reset  Whether to reset the internal cache. Used by the switch to locale functionality.
869 869
  * @return string|false The path to the translation file or false if no translation file was found.
870 870
  */
871
-function _get_path_to_translation( $domain, $reset = false ) {
871
+function _get_path_to_translation($domain, $reset = false) {
872 872
 	static $available_translations = array();
873 873
 
874
-	if ( true === $reset ) {
874
+	if (true === $reset) {
875 875
 		$available_translations = array();
876 876
 	}
877 877
 
878
-	if ( ! isset( $available_translations[ $domain ] ) ) {
879
-		$available_translations[ $domain ] = _get_path_to_translation_from_lang_dir( $domain );
878
+	if ( ! isset($available_translations[$domain])) {
879
+		$available_translations[$domain] = _get_path_to_translation_from_lang_dir($domain);
880 880
 	}
881 881
 
882
-	return $available_translations[ $domain ];
882
+	return $available_translations[$domain];
883 883
 }
884 884
 
885 885
 /**
@@ -895,21 +895,21 @@  discard block
 block discarded – undo
895 895
  * @param string $domain Text domain. Unique identifier for retrieving translated strings.
896 896
  * @return string|false The path to the translation file or false if no translation file was found.
897 897
  */
898
-function _get_path_to_translation_from_lang_dir( $domain ) {
898
+function _get_path_to_translation_from_lang_dir($domain) {
899 899
 	static $cached_mofiles = null;
900 900
 
901
-	if ( null === $cached_mofiles ) {
901
+	if (null === $cached_mofiles) {
902 902
 		$cached_mofiles = array();
903 903
 
904 904
 		$locations = array(
905
-			WP_LANG_DIR . '/plugins',
906
-			WP_LANG_DIR . '/themes',
905
+			WP_LANG_DIR.'/plugins',
906
+			WP_LANG_DIR.'/themes',
907 907
 		);
908 908
 
909
-		foreach ( $locations as $location ) {
910
-			$mofiles = glob( $location . '/*.mo' );
911
-			if ( $mofiles ) {
912
-				$cached_mofiles = array_merge( $cached_mofiles, $mofiles );
909
+		foreach ($locations as $location) {
910
+			$mofiles = glob($location.'/*.mo');
911
+			if ($mofiles) {
912
+				$cached_mofiles = array_merge($cached_mofiles, $mofiles);
913 913
 			}
914 914
 		}
915 915
 	}
@@ -917,13 +917,13 @@  discard block
 block discarded – undo
917 917
 	$locale = is_admin() ? get_user_locale() : get_locale();
918 918
 	$mofile = "{$domain}-{$locale}.mo";
919 919
 
920
-	$path = WP_LANG_DIR . '/plugins/' . $mofile;
921
-	if ( in_array( $path, $cached_mofiles ) ) {
920
+	$path = WP_LANG_DIR.'/plugins/'.$mofile;
921
+	if (in_array($path, $cached_mofiles)) {
922 922
 		return $path;
923 923
 	}
924 924
 
925
-	$path = WP_LANG_DIR . '/themes/' . $mofile;
926
-	if ( in_array( $path, $cached_mofiles ) ) {
925
+	$path = WP_LANG_DIR.'/themes/'.$mofile;
926
+	if (in_array($path, $cached_mofiles)) {
927 927
 		return $path;
928 928
 	}
929 929
 
@@ -942,14 +942,14 @@  discard block
 block discarded – undo
942 942
  * @param string $domain Text domain. Unique identifier for retrieving translated strings.
943 943
  * @return Translations|NOOP_Translations A Translations instance.
944 944
  */
945
-function get_translations_for_domain( $domain ) {
945
+function get_translations_for_domain($domain) {
946 946
 	global $l10n;
947
-	if ( isset( $l10n[ $domain ] ) || ( _load_textdomain_just_in_time( $domain ) && isset( $l10n[ $domain ] ) ) ) {
948
-		return $l10n[ $domain ];
947
+	if (isset($l10n[$domain]) || (_load_textdomain_just_in_time($domain) && isset($l10n[$domain]))) {
948
+		return $l10n[$domain];
949 949
 	}
950 950
 
951 951
 	static $noop_translations = null;
952
-	if ( null === $noop_translations ) {
952
+	if (null === $noop_translations) {
953 953
 		$noop_translations = new NOOP_Translations;
954 954
 	}
955 955
 
@@ -966,9 +966,9 @@  discard block
 block discarded – undo
966 966
  * @param string $domain Text domain. Unique identifier for retrieving translated strings.
967 967
  * @return bool Whether there are translations.
968 968
  */
969
-function is_textdomain_loaded( $domain ) {
969
+function is_textdomain_loaded($domain) {
970 970
 	global $l10n;
971
-	return isset( $l10n[ $domain ] );
971
+	return isset($l10n[$domain]);
972 972
 }
973 973
 
974 974
 /**
@@ -988,8 +988,8 @@  discard block
 block discarded – undo
988 988
  * @param string $name The role name.
989 989
  * @return string Translated role name on success, original name on failure.
990 990
  */
991
-function translate_user_role( $name ) {
992
-	return translate_with_gettext_context( before_last_bar($name), 'User role' );
991
+function translate_user_role($name) {
992
+	return translate_with_gettext_context(before_last_bar($name), 'User role');
993 993
 }
994 994
 
995 995
 /**
@@ -1004,15 +1004,15 @@  discard block
 block discarded – undo
1004 1004
  *                    Default WP_LANG_DIR.
1005 1005
  * @return array An array of language codes or an empty array if no languages are present. Language codes are formed by stripping the .mo extension from the language file names.
1006 1006
  */
1007
-function get_available_languages( $dir = null ) {
1007
+function get_available_languages($dir = null) {
1008 1008
 	$languages = array();
1009 1009
 
1010
-	$lang_files = glob( ( is_null( $dir ) ? WP_LANG_DIR : $dir ) . '/*.mo' );
1011
-	if ( $lang_files ) {
1012
-		foreach ( $lang_files as $lang_file ) {
1013
-			$lang_file = basename( $lang_file, '.mo' );
1014
-			if ( 0 !== strpos( $lang_file, 'continents-cities' ) && 0 !== strpos( $lang_file, 'ms-' ) &&
1015
-				0 !== strpos( $lang_file, 'admin-' ) ) {
1010
+	$lang_files = glob((is_null($dir) ? WP_LANG_DIR : $dir).'/*.mo');
1011
+	if ($lang_files) {
1012
+		foreach ($lang_files as $lang_file) {
1013
+			$lang_file = basename($lang_file, '.mo');
1014
+			if (0 !== strpos($lang_file, 'continents-cities') && 0 !== strpos($lang_file, 'ms-') &&
1015
+				0 !== strpos($lang_file, 'admin-')) {
1016 1016
 				$languages[] = $lang_file;
1017 1017
 			}
1018 1018
 		}
@@ -1026,7 +1026,7 @@  discard block
 block discarded – undo
1026 1026
 	 * @param array  $languages An array of available language codes.
1027 1027
 	 * @param string $dir       The directory where the language files were found.
1028 1028
 	 */
1029
-	return apply_filters( 'get_available_languages', $languages, $dir );
1029
+	return apply_filters('get_available_languages', $languages, $dir);
1030 1030
 }
1031 1031
 
1032 1032
 /**
@@ -1040,43 +1040,43 @@  discard block
 block discarded – undo
1040 1040
  * @param string $type What to search for. Accepts 'plugins', 'themes', 'core'.
1041 1041
  * @return array Array of language data.
1042 1042
  */
1043
-function wp_get_installed_translations( $type ) {
1044
-	if ( $type !== 'themes' && $type !== 'plugins' && $type !== 'core' )
1043
+function wp_get_installed_translations($type) {
1044
+	if ($type !== 'themes' && $type !== 'plugins' && $type !== 'core')
1045 1045
 		return array();
1046 1046
 
1047 1047
 	$dir = 'core' === $type ? '' : "/$type";
1048 1048
 
1049
-	if ( ! is_dir( WP_LANG_DIR ) )
1049
+	if ( ! is_dir(WP_LANG_DIR))
1050 1050
 		return array();
1051 1051
 
1052
-	if ( $dir && ! is_dir( WP_LANG_DIR . $dir ) )
1052
+	if ($dir && ! is_dir(WP_LANG_DIR.$dir))
1053 1053
 		return array();
1054 1054
 
1055
-	$files = scandir( WP_LANG_DIR . $dir );
1056
-	if ( ! $files )
1055
+	$files = scandir(WP_LANG_DIR.$dir);
1056
+	if ( ! $files)
1057 1057
 		return array();
1058 1058
 
1059 1059
 	$language_data = array();
1060 1060
 
1061
-	foreach ( $files as $file ) {
1062
-		if ( '.' === $file[0] || is_dir( WP_LANG_DIR . "$dir/$file" ) ) {
1061
+	foreach ($files as $file) {
1062
+		if ('.' === $file[0] || is_dir(WP_LANG_DIR."$dir/$file")) {
1063 1063
 			continue;
1064 1064
 		}
1065
-		if ( substr( $file, -3 ) !== '.po' ) {
1065
+		if (substr($file, -3) !== '.po') {
1066 1066
 			continue;
1067 1067
 		}
1068
-		if ( ! preg_match( '/(?:(.+)-)?([a-z]{2,3}(?:_[A-Z]{2})?(?:_[a-z0-9]+)?).po/', $file, $match ) ) {
1068
+		if ( ! preg_match('/(?:(.+)-)?([a-z]{2,3}(?:_[A-Z]{2})?(?:_[a-z0-9]+)?).po/', $file, $match)) {
1069 1069
 			continue;
1070 1070
 		}
1071
-		if ( ! in_array( substr( $file, 0, -3 ) . '.mo', $files ) )  {
1071
+		if ( ! in_array(substr($file, 0, -3).'.mo', $files)) {
1072 1072
 			continue;
1073 1073
 		}
1074 1074
 
1075
-		list( , $textdomain, $language ) = $match;
1076
-		if ( '' === $textdomain ) {
1075
+		list(, $textdomain, $language) = $match;
1076
+		if ('' === $textdomain) {
1077 1077
 			$textdomain = 'default';
1078 1078
 		}
1079
-		$language_data[ $textdomain ][ $language ] = wp_get_pomo_file_data( WP_LANG_DIR . "$dir/$file" );
1079
+		$language_data[$textdomain][$language] = wp_get_pomo_file_data(WP_LANG_DIR."$dir/$file");
1080 1080
 	}
1081 1081
 	return $language_data;
1082 1082
 }
@@ -1089,16 +1089,16 @@  discard block
 block discarded – undo
1089 1089
  * @param string $po_file Path to PO file.
1090 1090
  * @return array PO file headers.
1091 1091
  */
1092
-function wp_get_pomo_file_data( $po_file ) {
1093
-	$headers = get_file_data( $po_file, array(
1092
+function wp_get_pomo_file_data($po_file) {
1093
+	$headers = get_file_data($po_file, array(
1094 1094
 		'POT-Creation-Date'  => '"POT-Creation-Date',
1095 1095
 		'PO-Revision-Date'   => '"PO-Revision-Date',
1096 1096
 		'Project-Id-Version' => '"Project-Id-Version',
1097 1097
 		'X-Generator'        => '"X-Generator',
1098
-	) );
1099
-	foreach ( $headers as $header => $value ) {
1098
+	));
1099
+	foreach ($headers as $header => $value) {
1100 1100
 		// Remove possible contextual '\n' and closing double quote.
1101
-		$headers[ $header ] = preg_replace( '~(\\\n)?"$~', '', $value );
1101
+		$headers[$header] = preg_replace('~(\\\n)?"$~', '', $value);
1102 1102
 	}
1103 1103
 	return $headers;
1104 1104
 }
@@ -1130,9 +1130,9 @@  discard block
 block discarded – undo
1130 1130
  * }
1131 1131
  * @return string HTML content
1132 1132
  */
1133
-function wp_dropdown_languages( $args = array() ) {
1133
+function wp_dropdown_languages($args = array()) {
1134 1134
 
1135
-	$args = wp_parse_args( $args, array(
1135
+	$args = wp_parse_args($args, array(
1136 1136
 		'id'           => '',
1137 1137
 		'name'         => '',
1138 1138
 		'languages'    => array(),
@@ -1141,16 +1141,16 @@  discard block
 block discarded – undo
1141 1141
 		'echo'         => 1,
1142 1142
 		'show_available_translations' => true,
1143 1143
 		'show_option_site_default'    => false,
1144
-	) );
1144
+	));
1145 1145
 
1146 1146
 	// English (United States) uses an empty string for the value attribute.
1147
-	if ( 'en_US' === $args['selected'] ) {
1147
+	if ('en_US' === $args['selected']) {
1148 1148
 		$args['selected'] = '';
1149 1149
 	}
1150 1150
 
1151 1151
 	$translations = $args['translations'];
1152
-	if ( empty( $translations ) ) {
1153
-		require_once( ABSPATH . 'wp-admin/includes/translation-install.php' );
1152
+	if (empty($translations)) {
1153
+		require_once(ABSPATH.'wp-admin/includes/translation-install.php');
1154 1154
 		$translations = wp_get_available_translations();
1155 1155
 	}
1156 1156
 
@@ -1159,17 +1159,17 @@  discard block
 block discarded – undo
1159 1159
 	 * $translations to get the native name. Fall back to locale.
1160 1160
 	 */
1161 1161
 	$languages = array();
1162
-	foreach ( $args['languages'] as $locale ) {
1163
-		if ( isset( $translations[ $locale ] ) ) {
1164
-			$translation = $translations[ $locale ];
1162
+	foreach ($args['languages'] as $locale) {
1163
+		if (isset($translations[$locale])) {
1164
+			$translation = $translations[$locale];
1165 1165
 			$languages[] = array(
1166 1166
 				'language'    => $translation['language'],
1167 1167
 				'native_name' => $translation['native_name'],
1168
-				'lang'        => current( $translation['iso'] ),
1168
+				'lang'        => current($translation['iso']),
1169 1169
 			);
1170 1170
 
1171 1171
 			// Remove installed language from available translations.
1172
-			unset( $translations[ $locale ] );
1172
+			unset($translations[$locale]);
1173 1173
 		} else {
1174 1174
 			$languages[] = array(
1175 1175
 				'language'    => $locale,
@@ -1179,64 +1179,64 @@  discard block
 block discarded – undo
1179 1179
 		}
1180 1180
 	}
1181 1181
 
1182
-	$translations_available = ( ! empty( $translations ) && $args['show_available_translations'] );
1182
+	$translations_available = ( ! empty($translations) && $args['show_available_translations']);
1183 1183
 
1184
-	$output = sprintf( '<select name="%s" id="%s">', esc_attr( $args['name'] ), esc_attr( $args['id'] ) );
1184
+	$output = sprintf('<select name="%s" id="%s">', esc_attr($args['name']), esc_attr($args['id']));
1185 1185
 
1186 1186
 	// Holds the HTML markup.
1187 1187
 	$structure = array();
1188 1188
 
1189 1189
 	// List installed languages.
1190
-	if ( $translations_available ) {
1191
-		$structure[] = '<optgroup label="' . esc_attr_x( 'Installed', 'translations' ) . '">';
1190
+	if ($translations_available) {
1191
+		$structure[] = '<optgroup label="'.esc_attr_x('Installed', 'translations').'">';
1192 1192
 	}
1193 1193
 
1194
-	if ( $args['show_option_site_default'] ) {
1194
+	if ($args['show_option_site_default']) {
1195 1195
 		$structure[] = sprintf(
1196 1196
 			'<option value="site-default" data-installed="1"%s>%s</option>',
1197
-			selected( 'site-default', $args['selected'], false ),
1198
-			_x( 'Site Default', 'default site language' )
1197
+			selected('site-default', $args['selected'], false),
1198
+			_x('Site Default', 'default site language')
1199 1199
 		);
1200 1200
 	}
1201 1201
 
1202 1202
 	$structure[] = sprintf(
1203 1203
 		'<option value="" lang="en" data-installed="1"%s>English (United States)</option>',
1204
-		selected( '', $args['selected'], false )
1204
+		selected('', $args['selected'], false)
1205 1205
 	);
1206 1206
 
1207
-	foreach ( $languages as $language ) {
1207
+	foreach ($languages as $language) {
1208 1208
 		$structure[] = sprintf(
1209 1209
 			'<option value="%s" lang="%s"%s data-installed="1">%s</option>',
1210
-			esc_attr( $language['language'] ),
1211
-			esc_attr( $language['lang'] ),
1212
-			selected( $language['language'], $args['selected'], false ),
1213
-			esc_html( $language['native_name'] )
1210
+			esc_attr($language['language']),
1211
+			esc_attr($language['lang']),
1212
+			selected($language['language'], $args['selected'], false),
1213
+			esc_html($language['native_name'])
1214 1214
 		);
1215 1215
 	}
1216
-	if ( $translations_available ) {
1216
+	if ($translations_available) {
1217 1217
 		$structure[] = '</optgroup>';
1218 1218
 	}
1219 1219
 
1220 1220
 	// List available translations.
1221
-	if ( $translations_available ) {
1222
-		$structure[] = '<optgroup label="' . esc_attr_x( 'Available', 'translations' ) . '">';
1223
-		foreach ( $translations as $translation ) {
1221
+	if ($translations_available) {
1222
+		$structure[] = '<optgroup label="'.esc_attr_x('Available', 'translations').'">';
1223
+		foreach ($translations as $translation) {
1224 1224
 			$structure[] = sprintf(
1225 1225
 				'<option value="%s" lang="%s"%s>%s</option>',
1226
-				esc_attr( $translation['language'] ),
1227
-				esc_attr( current( $translation['iso'] ) ),
1228
-				selected( $translation['language'], $args['selected'], false ),
1229
-				esc_html( $translation['native_name'] )
1226
+				esc_attr($translation['language']),
1227
+				esc_attr(current($translation['iso'])),
1228
+				selected($translation['language'], $args['selected'], false),
1229
+				esc_html($translation['native_name'])
1230 1230
 			);
1231 1231
 		}
1232 1232
 		$structure[] = '</optgroup>';
1233 1233
 	}
1234 1234
 
1235
-	$output .= join( "\n", $structure );
1235
+	$output .= join("\n", $structure);
1236 1236
 
1237 1237
 	$output .= '</select>';
1238 1238
 
1239
-	if ( $args['echo'] ) {
1239
+	if ($args['echo']) {
1240 1240
 		echo $output;
1241 1241
 	}
1242 1242
 
@@ -1254,7 +1254,7 @@  discard block
 block discarded – undo
1254 1254
  */
1255 1255
 function is_rtl() {
1256 1256
 	global $wp_locale;
1257
-	if ( ! ( $wp_locale instanceof WP_Locale ) ) {
1257
+	if ( ! ($wp_locale instanceof WP_Locale)) {
1258 1258
 		return false;
1259 1259
 	}
1260 1260
 	return $wp_locale->is_rtl();
@@ -1270,11 +1270,11 @@  discard block
 block discarded – undo
1270 1270
  * @param string $locale The locale.
1271 1271
  * @return bool True on success, false on failure.
1272 1272
  */
1273
-function switch_to_locale( $locale ) {
1273
+function switch_to_locale($locale) {
1274 1274
 	/* @var WP_Locale_Switcher $wp_locale_switcher */
1275 1275
 	global $wp_locale_switcher;
1276 1276
 
1277
-	return $wp_locale_switcher->switch_to_locale( $locale );
1277
+	return $wp_locale_switcher->switch_to_locale($locale);
1278 1278
 }
1279 1279
 
1280 1280
 /**
Please login to merge, or discard this patch.
src/wp-includes/widgets/class-wp-widget-recent-comments.php 3 patches
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -37,11 +37,11 @@
 block discarded – undo
37 37
 	}
38 38
 
39 39
  	/**
40
-	 * Outputs the default styles for the Recent Comments widget.
41
-	 *
42
-	 * @since 2.8.0
43
-	 * @access public
44
-	 */
40
+ 	 * Outputs the default styles for the Recent Comments widget.
41
+ 	 *
42
+ 	 * @since 2.8.0
43
+ 	 * @access public
44
+ 	 */
45 45
 	public function recent_comments_style() {
46 46
 		/**
47 47
 		 * Filters the Recent Comments default widget styles.
Please login to merge, or discard this patch.
Spacing   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -25,14 +25,14 @@  discard block
 block discarded – undo
25 25
 	public function __construct() {
26 26
 		$widget_ops = array(
27 27
 			'classname' => 'widget_recent_comments',
28
-			'description' => __( 'Your site&#8217;s most recent comments.' ),
28
+			'description' => __('Your site&#8217;s most recent comments.'),
29 29
 			'customize_selective_refresh' => true,
30 30
 		);
31
-		parent::__construct( 'recent-comments', __( 'Recent Comments' ), $widget_ops );
31
+		parent::__construct('recent-comments', __('Recent Comments'), $widget_ops);
32 32
 		$this->alt_option_name = 'widget_recent_comments';
33 33
 
34
-		if ( is_active_widget( false, false, $this->id_base ) || is_customize_preview() ) {
35
-			add_action( 'wp_head', array( $this, 'recent_comments_style' ) );
34
+		if (is_active_widget(false, false, $this->id_base) || is_customize_preview()) {
35
+			add_action('wp_head', array($this, 'recent_comments_style'));
36 36
 		}
37 37
 	}
38 38
 
@@ -51,8 +51,8 @@  discard block
 block discarded – undo
51 51
 		 * @param bool   $active  Whether the widget is active. Default true.
52 52
 		 * @param string $id_base The widget ID.
53 53
 		 */
54
-		if ( ! current_theme_supports( 'widgets' ) // Temp hack #14876
55
-			|| ! apply_filters( 'show_recent_comments_widget_style', true, $this->id_base ) )
54
+		if ( ! current_theme_supports('widgets') // Temp hack #14876
55
+			|| ! apply_filters('show_recent_comments_widget_style', true, $this->id_base))
56 56
 			return;
57 57
 		?>
58 58
 		<style type="text/css">.recentcomments a{display:inline !important;padding:0 !important;margin:0 !important;}</style>
@@ -69,19 +69,19 @@  discard block
 block discarded – undo
69 69
 	 *                        'before_widget', and 'after_widget'.
70 70
 	 * @param array $instance Settings for the current Recent Comments widget instance.
71 71
 	 */
72
-	public function widget( $args, $instance ) {
73
-		if ( ! isset( $args['widget_id'] ) )
72
+	public function widget($args, $instance) {
73
+		if ( ! isset($args['widget_id']))
74 74
 			$args['widget_id'] = $this->id;
75 75
 
76 76
 		$output = '';
77 77
 
78
-		$title = ( ! empty( $instance['title'] ) ) ? $instance['title'] : __( 'Recent Comments' );
78
+		$title = ( ! empty($instance['title'])) ? $instance['title'] : __('Recent Comments');
79 79
 
80 80
 		/** This filter is documented in wp-includes/widgets/class-wp-widget-pages.php */
81
-		$title = apply_filters( 'widget_title', $title, $instance, $this->id_base );
81
+		$title = apply_filters('widget_title', $title, $instance, $this->id_base);
82 82
 
83
-		$number = ( ! empty( $instance['number'] ) ) ? absint( $instance['number'] ) : 5;
84
-		if ( ! $number )
83
+		$number = ( ! empty($instance['number'])) ? absint($instance['number']) : 5;
84
+		if ( ! $number)
85 85
 			$number = 5;
86 86
 
87 87
 		/**
@@ -93,29 +93,29 @@  discard block
 block discarded – undo
93 93
 		 *
94 94
 		 * @param array $comment_args An array of arguments used to retrieve the recent comments.
95 95
 		 */
96
-		$comments = get_comments( apply_filters( 'widget_comments_args', array(
96
+		$comments = get_comments(apply_filters('widget_comments_args', array(
97 97
 			'number'      => $number,
98 98
 			'status'      => 'approve',
99 99
 			'post_status' => 'publish'
100
-		) ) );
100
+		)));
101 101
 
102 102
 		$output .= $args['before_widget'];
103
-		if ( $title ) {
104
-			$output .= $args['before_title'] . $title . $args['after_title'];
103
+		if ($title) {
104
+			$output .= $args['before_title'].$title.$args['after_title'];
105 105
 		}
106 106
 
107 107
 		$output .= '<ul id="recentcomments">';
108
-		if ( is_array( $comments ) && $comments ) {
108
+		if (is_array($comments) && $comments) {
109 109
 			// Prime cache for associated posts. (Prime post term cache if we need it for permalinks.)
110
-			$post_ids = array_unique( wp_list_pluck( $comments, 'comment_post_ID' ) );
111
-			_prime_post_caches( $post_ids, strpos( get_option( 'permalink_structure' ), '%category%' ), false );
110
+			$post_ids = array_unique(wp_list_pluck($comments, 'comment_post_ID'));
111
+			_prime_post_caches($post_ids, strpos(get_option('permalink_structure'), '%category%'), false);
112 112
 
113
-			foreach ( (array) $comments as $comment ) {
113
+			foreach ((array) $comments as $comment) {
114 114
 				$output .= '<li class="recentcomments">';
115 115
 				/* translators: comments widget: 1: comment author, 2: post link */
116
-				$output .= sprintf( _x( '%1$s on %2$s', 'widgets' ),
117
-					'<span class="comment-author-link">' . get_comment_author_link( $comment ) . '</span>',
118
-					'<a href="' . esc_url( get_comment_link( $comment ) ) . '">' . get_the_title( $comment->comment_post_ID ) . '</a>'
116
+				$output .= sprintf(_x('%1$s on %2$s', 'widgets'),
117
+					'<span class="comment-author-link">'.get_comment_author_link($comment).'</span>',
118
+					'<a href="'.esc_url(get_comment_link($comment)).'">'.get_the_title($comment->comment_post_ID).'</a>'
119 119
 				);
120 120
 				$output .= '</li>';
121 121
 			}
@@ -137,10 +137,10 @@  discard block
 block discarded – undo
137 137
 	 * @param array $old_instance Old settings for this instance.
138 138
 	 * @return array Updated settings to save.
139 139
 	 */
140
-	public function update( $new_instance, $old_instance ) {
140
+	public function update($new_instance, $old_instance) {
141 141
 		$instance = $old_instance;
142
-		$instance['title'] = sanitize_text_field( $new_instance['title'] );
143
-		$instance['number'] = absint( $new_instance['number'] );
142
+		$instance['title'] = sanitize_text_field($new_instance['title']);
143
+		$instance['number'] = absint($new_instance['number']);
144 144
 		return $instance;
145 145
 	}
146 146
 
@@ -152,15 +152,15 @@  discard block
 block discarded – undo
152 152
 	 *
153 153
 	 * @param array $instance Current settings.
154 154
 	 */
155
-	public function form( $instance ) {
156
-		$title = isset( $instance['title'] ) ? $instance['title'] : '';
157
-		$number = isset( $instance['number'] ) ? absint( $instance['number'] ) : 5;
155
+	public function form($instance) {
156
+		$title = isset($instance['title']) ? $instance['title'] : '';
157
+		$number = isset($instance['number']) ? absint($instance['number']) : 5;
158 158
 		?>
159
-		<p><label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:' ); ?></label>
160
-		<input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo esc_attr( $title ); ?>" /></p>
159
+		<p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:'); ?></label>
160
+		<input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo esc_attr($title); ?>" /></p>
161 161
 
162
-		<p><label for="<?php echo $this->get_field_id( 'number' ); ?>"><?php _e( 'Number of comments to show:' ); ?></label>
163
-		<input class="tiny-text" id="<?php echo $this->get_field_id( 'number' ); ?>" name="<?php echo $this->get_field_name( 'number' ); ?>" type="number" step="1" min="1" value="<?php echo $number; ?>" size="3" /></p>
162
+		<p><label for="<?php echo $this->get_field_id('number'); ?>"><?php _e('Number of comments to show:'); ?></label>
163
+		<input class="tiny-text" id="<?php echo $this->get_field_id('number'); ?>" name="<?php echo $this->get_field_name('number'); ?>" type="number" step="1" min="1" value="<?php echo $number; ?>" size="3" /></p>
164 164
 		<?php
165 165
 	}
166 166
 
@@ -173,6 +173,6 @@  discard block
 block discarded – undo
173 173
 	 * @deprecated 4.4.0 Fragment caching was removed in favor of split queries.
174 174
 	 */
175 175
 	public function flush_widget_cache() {
176
-		_deprecated_function( __METHOD__, '4.4.0' );
176
+		_deprecated_function(__METHOD__, '4.4.0');
177 177
 	}
178 178
 }
Please login to merge, or discard this patch.
Braces   +9 added lines, -6 removed lines patch added patch discarded remove patch
@@ -52,8 +52,9 @@  discard block
 block discarded – undo
52 52
 		 * @param string $id_base The widget ID.
53 53
 		 */
54 54
 		if ( ! current_theme_supports( 'widgets' ) // Temp hack #14876
55
-			|| ! apply_filters( 'show_recent_comments_widget_style', true, $this->id_base ) )
56
-			return;
55
+			|| ! apply_filters( 'show_recent_comments_widget_style', true, $this->id_base ) ) {
56
+					return;
57
+		}
57 58
 		?>
58 59
 		<style type="text/css">.recentcomments a{display:inline !important;padding:0 !important;margin:0 !important;}</style>
59 60
 		<?php
@@ -70,8 +71,9 @@  discard block
 block discarded – undo
70 71
 	 * @param array $instance Settings for the current Recent Comments widget instance.
71 72
 	 */
72 73
 	public function widget( $args, $instance ) {
73
-		if ( ! isset( $args['widget_id'] ) )
74
-			$args['widget_id'] = $this->id;
74
+		if ( ! isset( $args['widget_id'] ) ) {
75
+					$args['widget_id'] = $this->id;
76
+		}
75 77
 
76 78
 		$output = '';
77 79
 
@@ -81,8 +83,9 @@  discard block
 block discarded – undo
81 83
 		$title = apply_filters( 'widget_title', $title, $instance, $this->id_base );
82 84
 
83 85
 		$number = ( ! empty( $instance['number'] ) ) ? absint( $instance['number'] ) : 5;
84
-		if ( ! $number )
85
-			$number = 5;
86
+		if ( ! $number ) {
87
+					$number = 5;
88
+		}
86 89
 
87 90
 		/**
88 91
 		 * Filters the arguments for the Recent Comments widget.
Please login to merge, or discard this patch.
src/wp-includes/class-wp-customize-setting.php 2 patches
Braces   +35 added lines, -22 removed lines patch added patch discarded remove patch
@@ -738,8 +738,9 @@  discard block
 block discarded – undo
738 738
 		 */
739 739
 		$value = apply_filters( "customize_sanitize_js_{$this->id}", $this->value(), $this );
740 740
 
741
-		if ( is_string( $value ) )
742
-			return html_entity_decode( $value, ENT_QUOTES, 'UTF-8');
741
+		if ( is_string( $value ) ) {
742
+					return html_entity_decode( $value, ENT_QUOTES, 'UTF-8');
743
+		}
743 744
 
744 745
 		return $value;
745 746
 	}
@@ -768,11 +769,13 @@  discard block
 block discarded – undo
768 769
 	 * @return bool False if theme doesn't support the setting or user can't change setting, otherwise true.
769 770
 	 */
770 771
 	final public function check_capabilities() {
771
-		if ( $this->capability && ! call_user_func_array( 'current_user_can', (array) $this->capability ) )
772
-			return false;
772
+		if ( $this->capability && ! call_user_func_array( 'current_user_can', (array) $this->capability ) ) {
773
+					return false;
774
+		}
773 775
 
774
-		if ( $this->theme_supports && ! call_user_func_array( 'current_theme_supports', (array) $this->theme_supports ) )
775
-			return false;
776
+		if ( $this->theme_supports && ! call_user_func_array( 'current_theme_supports', (array) $this->theme_supports ) ) {
777
+					return false;
778
+		}
776 779
 
777 780
 		return true;
778 781
 	}
@@ -788,21 +791,25 @@  discard block
 block discarded – undo
788 791
 	 * @return array|void Keys are 'root', 'node', and 'key'.
789 792
 	 */
790 793
 	final protected function multidimensional( &$root, $keys, $create = false ) {
791
-		if ( $create && empty( $root ) )
792
-			$root = array();
794
+		if ( $create && empty( $root ) ) {
795
+					$root = array();
796
+		}
793 797
 
794
-		if ( ! isset( $root ) || empty( $keys ) )
795
-			return;
798
+		if ( ! isset( $root ) || empty( $keys ) ) {
799
+					return;
800
+		}
796 801
 
797 802
 		$last = array_pop( $keys );
798 803
 		$node = &$root;
799 804
 
800 805
 		foreach ( $keys as $key ) {
801
-			if ( $create && ! isset( $node[ $key ] ) )
802
-				$node[ $key ] = array();
806
+			if ( $create && ! isset( $node[ $key ] ) ) {
807
+							$node[ $key ] = array();
808
+			}
803 809
 
804
-			if ( ! is_array( $node ) || ! isset( $node[ $key ] ) )
805
-				return;
810
+			if ( ! is_array( $node ) || ! isset( $node[ $key ] ) ) {
811
+							return;
812
+			}
806 813
 
807 814
 			$node = &$node[ $key ];
808 815
 		}
@@ -817,8 +824,9 @@  discard block
 block discarded – undo
817 824
 			}
818 825
 		}
819 826
 
820
-		if ( ! isset( $node[ $last ] ) )
821
-			return;
827
+		if ( ! isset( $node[ $last ] ) ) {
828
+					return;
829
+		}
822 830
 
823 831
 		return array(
824 832
 			'root' => &$root,
@@ -838,15 +846,18 @@  discard block
 block discarded – undo
838 846
 	 * @return mixed
839 847
 	 */
840 848
 	final protected function multidimensional_replace( $root, $keys, $value ) {
841
-		if ( ! isset( $value ) )
842
-			return $root;
843
-		elseif ( empty( $keys ) ) // If there are no keys, we're replacing the root.
849
+		if ( ! isset( $value ) ) {
850
+					return $root;
851
+		} elseif ( empty( $keys ) ) {
852
+			// If there are no keys, we're replacing the root.
844 853
 			return $value;
854
+		}
845 855
 
846 856
 		$result = $this->multidimensional( $root, $keys, true );
847 857
 
848
-		if ( isset( $result ) )
849
-			$result['node'][ $result['key'] ] = $value;
858
+		if ( isset( $result ) ) {
859
+					$result['node'][ $result['key'] ] = $value;
860
+		}
850 861
 
851 862
 		return $root;
852 863
 	}
@@ -862,8 +873,10 @@  discard block
 block discarded – undo
862 873
 	 * @return mixed The requested value or the default value.
863 874
 	 */
864 875
 	final protected function multidimensional_get( $root, $keys, $default = null ) {
865
-		if ( empty( $keys ) ) // If there are no keys, test the root.
876
+		if ( empty( $keys ) ) {
877
+			// If there are no keys, test the root.
866 878
 			return isset( $root ) ? $root : $default;
879
+		}
867 880
 
868 881
 		$result = $this->multidimensional( $root, $keys );
869 882
 		return isset( $result ) ? $result['node'][ $result['key'] ] : $default;
Please login to merge, or discard this patch.
Spacing   +159 added lines, -159 removed lines patch added patch discarded remove patch
@@ -175,11 +175,11 @@  discard block
 block discarded – undo
175 175
 	 *                                      theme mod or option name.
176 176
 	 * @param array                $args    Setting arguments.
177 177
 	 */
178
-	public function __construct( $manager, $id, $args = array() ) {
179
-		$keys = array_keys( get_object_vars( $this ) );
180
-		foreach ( $keys as $key ) {
181
-			if ( isset( $args[ $key ] ) ) {
182
-				$this->$key = $args[ $key ];
178
+	public function __construct($manager, $id, $args = array()) {
179
+		$keys = array_keys(get_object_vars($this));
180
+		foreach ($keys as $key) {
181
+			if (isset($args[$key])) {
182
+				$this->$key = $args[$key];
183 183
 			}
184 184
 		}
185 185
 
@@ -187,32 +187,32 @@  discard block
 block discarded – undo
187 187
 		$this->id = $id;
188 188
 
189 189
 		// Parse the ID for array keys.
190
-		$this->id_data['keys'] = preg_split( '/\[/', str_replace( ']', '', $this->id ) );
191
-		$this->id_data['base'] = array_shift( $this->id_data['keys'] );
190
+		$this->id_data['keys'] = preg_split('/\[/', str_replace(']', '', $this->id));
191
+		$this->id_data['base'] = array_shift($this->id_data['keys']);
192 192
 
193 193
 		// Rebuild the ID.
194
-		$this->id = $this->id_data[ 'base' ];
195
-		if ( ! empty( $this->id_data[ 'keys' ] ) ) {
196
-			$this->id .= '[' . implode( '][', $this->id_data['keys'] ) . ']';
194
+		$this->id = $this->id_data['base'];
195
+		if ( ! empty($this->id_data['keys'])) {
196
+			$this->id .= '['.implode('][', $this->id_data['keys']).']';
197 197
 		}
198 198
 
199
-		if ( $this->validate_callback ) {
200
-			add_filter( "customize_validate_{$this->id}", $this->validate_callback, 10, 3 );
199
+		if ($this->validate_callback) {
200
+			add_filter("customize_validate_{$this->id}", $this->validate_callback, 10, 3);
201 201
 		}
202
-		if ( $this->sanitize_callback ) {
203
-			add_filter( "customize_sanitize_{$this->id}", $this->sanitize_callback, 10, 2 );
202
+		if ($this->sanitize_callback) {
203
+			add_filter("customize_sanitize_{$this->id}", $this->sanitize_callback, 10, 2);
204 204
 		}
205
-		if ( $this->sanitize_js_callback ) {
206
-			add_filter( "customize_sanitize_js_{$this->id}", $this->sanitize_js_callback, 10, 2 );
205
+		if ($this->sanitize_js_callback) {
206
+			add_filter("customize_sanitize_js_{$this->id}", $this->sanitize_js_callback, 10, 2);
207 207
 		}
208 208
 
209
-		if ( 'option' === $this->type || 'theme_mod' === $this->type ) {
209
+		if ('option' === $this->type || 'theme_mod' === $this->type) {
210 210
 			// Other setting types can opt-in to aggregate multidimensional explicitly.
211 211
 			$this->aggregate_multidimensional();
212 212
 
213 213
 			// Allow option settings to indicate whether they should be autoloaded.
214
-			if ( 'option' === $this->type && isset( $args['autoload'] ) ) {
215
-				self::$aggregated_multidimensionals[ $this->type ][ $this->id_data['base'] ]['autoload'] = $args['autoload'];
214
+			if ('option' === $this->type && isset($args['autoload'])) {
215
+				self::$aggregated_multidimensionals[$this->type][$this->id_data['base']]['autoload'] = $args['autoload'];
216 216
 			}
217 217
 		}
218 218
 	}
@@ -243,20 +243,20 @@  discard block
 block discarded – undo
243 243
 	 */
244 244
 	protected function aggregate_multidimensional() {
245 245
 		$id_base = $this->id_data['base'];
246
-		if ( ! isset( self::$aggregated_multidimensionals[ $this->type ] ) ) {
247
-			self::$aggregated_multidimensionals[ $this->type ] = array();
246
+		if ( ! isset(self::$aggregated_multidimensionals[$this->type])) {
247
+			self::$aggregated_multidimensionals[$this->type] = array();
248 248
 		}
249
-		if ( ! isset( self::$aggregated_multidimensionals[ $this->type ][ $id_base ] ) ) {
250
-			self::$aggregated_multidimensionals[ $this->type ][ $id_base ] = array(
249
+		if ( ! isset(self::$aggregated_multidimensionals[$this->type][$id_base])) {
250
+			self::$aggregated_multidimensionals[$this->type][$id_base] = array(
251 251
 				'previewed_instances'       => array(), // Calling preview() will add the $setting to the array.
252 252
 				'preview_applied_instances' => array(), // Flags for which settings have had their values applied.
253
-				'root_value'                => $this->get_root_value( array() ), // Root value for initial state, manipulated by preview and update calls.
253
+				'root_value'                => $this->get_root_value(array()), // Root value for initial state, manipulated by preview and update calls.
254 254
 			);
255 255
 		}
256 256
 
257
-		if ( ! empty( $this->id_data['keys'] ) ) {
257
+		if ( ! empty($this->id_data['keys'])) {
258 258
 			// Note the preview-applied flag is cleared at priority 9 to ensure it is cleared before a deferred-preview runs.
259
-			add_action( "customize_post_value_set_{$this->id}", array( $this, '_clear_aggregated_multidimensional_preview_applied_flag' ), 9 );
259
+			add_action("customize_post_value_set_{$this->id}", array($this, '_clear_aggregated_multidimensional_preview_applied_flag'), 9);
260 260
 			$this->is_multidimensional_aggregated = true;
261 261
 		}
262 262
 	}
@@ -290,10 +290,10 @@  discard block
 block discarded – undo
290 290
 	 * @return bool If preview() has been called.
291 291
 	 */
292 292
 	public function is_current_blog_previewed() {
293
-		if ( ! isset( $this->_previewed_blog_id ) ) {
293
+		if ( ! isset($this->_previewed_blog_id)) {
294 294
 			return false;
295 295
 		}
296
-		return ( get_current_blog_id() === $this->_previewed_blog_id );
296
+		return (get_current_blog_id() === $this->_previewed_blog_id);
297 297
 	}
298 298
 
299 299
 	/**
@@ -319,18 +319,18 @@  discard block
 block discarded – undo
319 319
 	 * @return bool False when preview short-circuits due no change needing to be previewed.
320 320
 	 */
321 321
 	public function preview() {
322
-		if ( ! isset( $this->_previewed_blog_id ) ) {
322
+		if ( ! isset($this->_previewed_blog_id)) {
323 323
 			$this->_previewed_blog_id = get_current_blog_id();
324 324
 		}
325 325
 
326 326
 		// Prevent re-previewing an already-previewed setting.
327
-		if ( $this->is_previewed ) {
327
+		if ($this->is_previewed) {
328 328
 			return true;
329 329
 		}
330 330
 
331 331
 		$id_base = $this->id_data['base'];
332
-		$is_multidimensional = ! empty( $this->id_data['keys'] );
333
-		$multidimensional_filter = array( $this, '_multidimensional_preview_filter' );
332
+		$is_multidimensional = ! empty($this->id_data['keys']);
333
+		$multidimensional_filter = array($this, '_multidimensional_preview_filter');
334 334
 
335 335
 		/*
336 336
 		 * Check if the setting has a pre-existing value (an isset check),
@@ -339,53 +339,53 @@  discard block
 block discarded – undo
339 339
 		 * to be previewed.
340 340
 		 */
341 341
 		$undefined = new stdClass();
342
-		$needs_preview = ( $undefined !== $this->post_value( $undefined ) );
342
+		$needs_preview = ($undefined !== $this->post_value($undefined));
343 343
 		$value = null;
344 344
 
345 345
 		// Since no post value was defined, check if we have an initial value set.
346
-		if ( ! $needs_preview ) {
347
-			if ( $this->is_multidimensional_aggregated ) {
348
-				$root = self::$aggregated_multidimensionals[ $this->type ][ $id_base ]['root_value'];
349
-				$value = $this->multidimensional_get( $root, $this->id_data['keys'], $undefined );
346
+		if ( ! $needs_preview) {
347
+			if ($this->is_multidimensional_aggregated) {
348
+				$root = self::$aggregated_multidimensionals[$this->type][$id_base]['root_value'];
349
+				$value = $this->multidimensional_get($root, $this->id_data['keys'], $undefined);
350 350
 			} else {
351 351
 				$default = $this->default;
352 352
 				$this->default = $undefined; // Temporarily set default to undefined so we can detect if existing value is set.
353 353
 				$value = $this->value();
354 354
 				$this->default = $default;
355 355
 			}
356
-			$needs_preview = ( $undefined === $value ); // Because the default needs to be supplied.
356
+			$needs_preview = ($undefined === $value); // Because the default needs to be supplied.
357 357
 		}
358 358
 
359 359
 		// If the setting does not need previewing now, defer to when it has a value to preview.
360
-		if ( ! $needs_preview ) {
361
-			if ( ! has_action( "customize_post_value_set_{$this->id}", array( $this, 'preview' ) ) ) {
362
-				add_action( "customize_post_value_set_{$this->id}", array( $this, 'preview' ) );
360
+		if ( ! $needs_preview) {
361
+			if ( ! has_action("customize_post_value_set_{$this->id}", array($this, 'preview'))) {
362
+				add_action("customize_post_value_set_{$this->id}", array($this, 'preview'));
363 363
 			}
364 364
 			return false;
365 365
 		}
366 366
 
367
-		switch ( $this->type ) {
367
+		switch ($this->type) {
368 368
 			case 'theme_mod' :
369
-				if ( ! $is_multidimensional ) {
370
-					add_filter( "theme_mod_{$id_base}", array( $this, '_preview_filter' ) );
369
+				if ( ! $is_multidimensional) {
370
+					add_filter("theme_mod_{$id_base}", array($this, '_preview_filter'));
371 371
 				} else {
372
-					if ( empty( self::$aggregated_multidimensionals[ $this->type ][ $id_base ]['previewed_instances'] ) ) {
372
+					if (empty(self::$aggregated_multidimensionals[$this->type][$id_base]['previewed_instances'])) {
373 373
 						// Only add this filter once for this ID base.
374
-						add_filter( "theme_mod_{$id_base}", $multidimensional_filter );
374
+						add_filter("theme_mod_{$id_base}", $multidimensional_filter);
375 375
 					}
376
-					self::$aggregated_multidimensionals[ $this->type ][ $id_base ]['previewed_instances'][ $this->id ] = $this;
376
+					self::$aggregated_multidimensionals[$this->type][$id_base]['previewed_instances'][$this->id] = $this;
377 377
 				}
378 378
 				break;
379 379
 			case 'option' :
380
-				if ( ! $is_multidimensional ) {
381
-					add_filter( "pre_option_{$id_base}", array( $this, '_preview_filter' ) );
380
+				if ( ! $is_multidimensional) {
381
+					add_filter("pre_option_{$id_base}", array($this, '_preview_filter'));
382 382
 				} else {
383
-					if ( empty( self::$aggregated_multidimensionals[ $this->type ][ $id_base ]['previewed_instances'] ) ) {
383
+					if (empty(self::$aggregated_multidimensionals[$this->type][$id_base]['previewed_instances'])) {
384 384
 						// Only add these filters once for this ID base.
385
-						add_filter( "option_{$id_base}", $multidimensional_filter );
386
-						add_filter( "default_option_{$id_base}", $multidimensional_filter );
385
+						add_filter("option_{$id_base}", $multidimensional_filter);
386
+						add_filter("default_option_{$id_base}", $multidimensional_filter);
387 387
 					}
388
-					self::$aggregated_multidimensionals[ $this->type ][ $id_base ]['previewed_instances'][ $this->id ] = $this;
388
+					self::$aggregated_multidimensionals[$this->type][$id_base]['previewed_instances'][$this->id] = $this;
389 389
 				}
390 390
 				break;
391 391
 			default :
@@ -400,7 +400,7 @@  discard block
 block discarded – undo
400 400
 				 *
401 401
 				 * @param WP_Customize_Setting $this WP_Customize_Setting instance.
402 402
 				 */
403
-				do_action( "customize_preview_{$this->id}", $this );
403
+				do_action("customize_preview_{$this->id}", $this);
404 404
 
405 405
 				/**
406 406
 				 * Fires when the WP_Customize_Setting::preview() method is called for settings
@@ -412,7 +412,7 @@  discard block
 block discarded – undo
412 412
 				 *
413 413
 				 * @param WP_Customize_Setting $this WP_Customize_Setting instance.
414 414
 				 */
415
-				do_action( "customize_preview_{$this->type}", $this );
415
+				do_action("customize_preview_{$this->type}", $this);
416 416
 		}
417 417
 
418 418
 		$this->is_previewed = true;
@@ -433,7 +433,7 @@  discard block
 block discarded – undo
433 433
 	 * @see WP_Customize_Setting::_multidimensional_preview_filter()
434 434
 	 */
435 435
 	final public function _clear_aggregated_multidimensional_preview_applied_flag() {
436
-		unset( self::$aggregated_multidimensionals[ $this->type ][ $this->id_data['base'] ]['preview_applied_instances'][ $this->id ] );
436
+		unset(self::$aggregated_multidimensionals[$this->type][$this->id_data['base']]['preview_applied_instances'][$this->id]);
437 437
 	}
438 438
 
439 439
 	/**
@@ -448,14 +448,14 @@  discard block
 block discarded – undo
448 448
 	 * @param mixed $original Old value.
449 449
 	 * @return mixed New or old value.
450 450
 	 */
451
-	public function _preview_filter( $original ) {
452
-		if ( ! $this->is_current_blog_previewed() ) {
451
+	public function _preview_filter($original) {
452
+		if ( ! $this->is_current_blog_previewed()) {
453 453
 			return $original;
454 454
 		}
455 455
 
456 456
 		$undefined = new stdClass(); // Symbol hack.
457
-		$post_value = $this->post_value( $undefined );
458
-		if ( $undefined !== $post_value ) {
457
+		$post_value = $this->post_value($undefined);
458
+		if ($undefined !== $post_value) {
459 459
 			$value = $post_value;
460 460
 		} else {
461 461
 			/*
@@ -480,35 +480,35 @@  discard block
 block discarded – undo
480 480
 	 * @param mixed $original Original root value.
481 481
 	 * @return mixed New or old value.
482 482
 	 */
483
-	final public function _multidimensional_preview_filter( $original ) {
484
-		if ( ! $this->is_current_blog_previewed() ) {
483
+	final public function _multidimensional_preview_filter($original) {
484
+		if ( ! $this->is_current_blog_previewed()) {
485 485
 			return $original;
486 486
 		}
487 487
 
488 488
 		$id_base = $this->id_data['base'];
489 489
 
490 490
 		// If no settings have been previewed yet (which should not be the case, since $this is), just pass through the original value.
491
-		if ( empty( self::$aggregated_multidimensionals[ $this->type ][ $id_base ]['previewed_instances'] ) ) {
491
+		if (empty(self::$aggregated_multidimensionals[$this->type][$id_base]['previewed_instances'])) {
492 492
 			return $original;
493 493
 		}
494 494
 
495
-		foreach ( self::$aggregated_multidimensionals[ $this->type ][ $id_base ]['previewed_instances'] as $previewed_setting ) {
495
+		foreach (self::$aggregated_multidimensionals[$this->type][$id_base]['previewed_instances'] as $previewed_setting) {
496 496
 			// Skip applying previewed value for any settings that have already been applied.
497
-			if ( ! empty( self::$aggregated_multidimensionals[ $this->type ][ $id_base ]['preview_applied_instances'][ $previewed_setting->id ] ) ) {
497
+			if ( ! empty(self::$aggregated_multidimensionals[$this->type][$id_base]['preview_applied_instances'][$previewed_setting->id])) {
498 498
 				continue;
499 499
 			}
500 500
 
501 501
 			// Do the replacements of the posted/default sub value into the root value.
502
-			$value = $previewed_setting->post_value( $previewed_setting->default );
503
-			$root = self::$aggregated_multidimensionals[ $previewed_setting->type ][ $id_base ]['root_value'];
504
-			$root = $previewed_setting->multidimensional_replace( $root, $previewed_setting->id_data['keys'], $value );
505
-			self::$aggregated_multidimensionals[ $previewed_setting->type ][ $id_base ]['root_value'] = $root;
502
+			$value = $previewed_setting->post_value($previewed_setting->default);
503
+			$root = self::$aggregated_multidimensionals[$previewed_setting->type][$id_base]['root_value'];
504
+			$root = $previewed_setting->multidimensional_replace($root, $previewed_setting->id_data['keys'], $value);
505
+			self::$aggregated_multidimensionals[$previewed_setting->type][$id_base]['root_value'] = $root;
506 506
 
507 507
 			// Mark this setting having been applied so that it will be skipped when the filter is called again.
508
-			self::$aggregated_multidimensionals[ $previewed_setting->type ][ $id_base ]['preview_applied_instances'][ $previewed_setting->id ] = true;
508
+			self::$aggregated_multidimensionals[$previewed_setting->type][$id_base]['preview_applied_instances'][$previewed_setting->id] = true;
509 509
 		}
510 510
 
511
-		return self::$aggregated_multidimensionals[ $this->type ][ $id_base ]['root_value'];
511
+		return self::$aggregated_multidimensionals[$this->type][$id_base]['root_value'];
512 512
 	}
513 513
 
514 514
 	/**
@@ -522,7 +522,7 @@  discard block
 block discarded – undo
522 522
 	final public function save() {
523 523
 		$value = $this->post_value();
524 524
 
525
-		if ( ! $this->check_capabilities() || ! isset( $value ) ) {
525
+		if ( ! $this->check_capabilities() || ! isset($value)) {
526 526
 			return false;
527 527
 		}
528 528
 
@@ -538,9 +538,9 @@  discard block
 block discarded – undo
538 538
 		 *
539 539
 		 * @param WP_Customize_Setting $this WP_Customize_Setting instance.
540 540
 		 */
541
-		do_action( "customize_save_{$id_base}", $this );
541
+		do_action("customize_save_{$id_base}", $this);
542 542
 
543
-		$this->update( $value );
543
+		$this->update($value);
544 544
 	}
545 545
 
546 546
 	/**
@@ -553,8 +553,8 @@  discard block
 block discarded – undo
553 553
 	 * @param mixed $default A default value which is used as a fallback. Default is null.
554 554
 	 * @return mixed The default value on failure, otherwise the sanitized and validated value.
555 555
 	 */
556
-	final public function post_value( $default = null ) {
557
-		return $this->manager->post_value( $this, $default );
556
+	final public function post_value($default = null) {
557
+		return $this->manager->post_value($this, $default);
558 558
 	}
559 559
 
560 560
 	/**
@@ -565,7 +565,7 @@  discard block
 block discarded – undo
565 565
 	 * @param string|array $value    The value to sanitize.
566 566
 	 * @return string|array|null|WP_Error Sanitized value, or `null`/`WP_Error` if invalid.
567 567
 	 */
568
-	public function sanitize( $value ) {
568
+	public function sanitize($value) {
569 569
 
570 570
 		/**
571 571
 		 * Filters a Customize setting value in un-slashed form.
@@ -575,7 +575,7 @@  discard block
 block discarded – undo
575 575
 		 * @param mixed                $value Value of the setting.
576 576
 		 * @param WP_Customize_Setting $this  WP_Customize_Setting instance.
577 577
 		 */
578
-		return apply_filters( "customize_sanitize_{$this->id}", $value, $this );
578
+		return apply_filters("customize_sanitize_{$this->id}", $value, $this);
579 579
 	}
580 580
 
581 581
 	/**
@@ -588,12 +588,12 @@  discard block
 block discarded – undo
588 588
 	 * @param mixed $value Value to validate.
589 589
 	 * @return true|WP_Error True if the input was validated, otherwise WP_Error.
590 590
 	 */
591
-	public function validate( $value ) {
592
-		if ( is_wp_error( $value ) ) {
591
+	public function validate($value) {
592
+		if (is_wp_error($value)) {
593 593
 			return $value;
594 594
 		}
595
-		if ( is_null( $value ) ) {
596
-			return new WP_Error( 'invalid_value', __( 'Invalid value.' ) );
595
+		if (is_null($value)) {
596
+			return new WP_Error('invalid_value', __('Invalid value.'));
597 597
 		}
598 598
 
599 599
 		$validity = new WP_Error();
@@ -611,9 +611,9 @@  discard block
 block discarded – undo
611 611
 		 * @param mixed                $value    Value of the setting.
612 612
 		 * @param WP_Customize_Setting $this     WP_Customize_Setting instance.
613 613
 		 */
614
-		$validity = apply_filters( "customize_validate_{$this->id}", $validity, $value, $this );
614
+		$validity = apply_filters("customize_validate_{$this->id}", $validity, $value, $this);
615 615
 
616
-		if ( is_wp_error( $validity ) && empty( $validity->errors ) ) {
616
+		if (is_wp_error($validity) && empty($validity->errors)) {
617 617
 			$validity = true;
618 618
 		}
619 619
 		return $validity;
@@ -627,12 +627,12 @@  discard block
 block discarded – undo
627 627
 	 * @param mixed $default Value to return if root does not exist.
628 628
 	 * @return mixed
629 629
 	 */
630
-	protected function get_root_value( $default = null ) {
630
+	protected function get_root_value($default = null) {
631 631
 		$id_base = $this->id_data['base'];
632
-		if ( 'option' === $this->type ) {
633
-			return get_option( $id_base, $default );
634
-		} elseif ( 'theme_mod' === $this->type ) {
635
-			return get_theme_mod( $id_base, $default );
632
+		if ('option' === $this->type) {
633
+			return get_option($id_base, $default);
634
+		} elseif ('theme_mod' === $this->type) {
635
+			return get_theme_mod($id_base, $default);
636 636
 		} else {
637 637
 			/*
638 638
 			 * Any WP_Customize_Setting subclass implementing aggregate multidimensional
@@ -651,16 +651,16 @@  discard block
 block discarded – undo
651 651
 	 * @param mixed $value Value to set as root of multidimensional setting.
652 652
 	 * @return bool Whether the multidimensional root was updated successfully.
653 653
 	 */
654
-	protected function set_root_value( $value ) {
654
+	protected function set_root_value($value) {
655 655
 		$id_base = $this->id_data['base'];
656
-		if ( 'option' === $this->type ) {
656
+		if ('option' === $this->type) {
657 657
 			$autoload = true;
658
-			if ( isset( self::$aggregated_multidimensionals[ $this->type ][ $this->id_data['base'] ]['autoload'] ) ) {
659
-				$autoload = self::$aggregated_multidimensionals[ $this->type ][ $this->id_data['base'] ]['autoload'];
658
+			if (isset(self::$aggregated_multidimensionals[$this->type][$this->id_data['base']]['autoload'])) {
659
+				$autoload = self::$aggregated_multidimensionals[$this->type][$this->id_data['base']]['autoload'];
660 660
 			}
661
-			return update_option( $id_base, $value, $autoload );
662
-		} elseif ( 'theme_mod' === $this->type ) {
663
-			set_theme_mod( $id_base, $value );
661
+			return update_option($id_base, $value, $autoload);
662
+		} elseif ('theme_mod' === $this->type) {
663
+			set_theme_mod($id_base, $value);
664 664
 			return true;
665 665
 		} else {
666 666
 			/*
@@ -680,16 +680,16 @@  discard block
 block discarded – undo
680 680
 	 * @param mixed $value The value to update.
681 681
 	 * @return bool The result of saving the value.
682 682
 	 */
683
-	protected function update( $value ) {
683
+	protected function update($value) {
684 684
 		$id_base = $this->id_data['base'];
685
-		if ( 'option' === $this->type || 'theme_mod' === $this->type ) {
686
-			if ( ! $this->is_multidimensional_aggregated ) {
687
-				return $this->set_root_value( $value );
685
+		if ('option' === $this->type || 'theme_mod' === $this->type) {
686
+			if ( ! $this->is_multidimensional_aggregated) {
687
+				return $this->set_root_value($value);
688 688
 			} else {
689
-				$root = self::$aggregated_multidimensionals[ $this->type ][ $id_base ]['root_value'];
690
-				$root = $this->multidimensional_replace( $root, $this->id_data['keys'], $value );
691
-				self::$aggregated_multidimensionals[ $this->type ][ $id_base ]['root_value'] = $root;
692
-				return $this->set_root_value( $root );
689
+				$root = self::$aggregated_multidimensionals[$this->type][$id_base]['root_value'];
690
+				$root = $this->multidimensional_replace($root, $this->id_data['keys'], $value);
691
+				self::$aggregated_multidimensionals[$this->type][$id_base]['root_value'] = $root;
692
+				return $this->set_root_value($root);
693 693
 			}
694 694
 		} else {
695 695
 			/**
@@ -703,9 +703,9 @@  discard block
 block discarded – undo
703 703
 			 * @param mixed                $value Value of the setting.
704 704
 			 * @param WP_Customize_Setting $this  WP_Customize_Setting instance.
705 705
 			 */
706
-			do_action( "customize_update_{$this->type}", $value, $this );
706
+			do_action("customize_update_{$this->type}", $value, $this);
707 707
 
708
-			return has_action( "customize_update_{$this->type}" );
708
+			return has_action("customize_update_{$this->type}");
709 709
 		}
710 710
 	}
711 711
 
@@ -716,7 +716,7 @@  discard block
 block discarded – undo
716 716
 	 * @deprecated 4.4.0 Deprecated in favor of update() method.
717 717
 	 */
718 718
 	protected function _update_theme_mod() {
719
-		_deprecated_function( __METHOD__, '4.4.0', __CLASS__ . '::update()' );
719
+		_deprecated_function(__METHOD__, '4.4.0', __CLASS__.'::update()');
720 720
 	}
721 721
 
722 722
 	/**
@@ -726,7 +726,7 @@  discard block
 block discarded – undo
726 726
 	 * @deprecated 4.4.0 Deprecated in favor of update() method.
727 727
 	 */
728 728
 	protected function _update_option() {
729
-		_deprecated_function( __METHOD__, '4.4.0', __CLASS__ . '::update()' );
729
+		_deprecated_function(__METHOD__, '4.4.0', __CLASS__.'::update()');
730 730
 	}
731 731
 
732 732
 	/**
@@ -738,19 +738,19 @@  discard block
 block discarded – undo
738 738
 	 */
739 739
 	public function value() {
740 740
 		$id_base = $this->id_data['base'];
741
-		$is_core_type = ( 'option' === $this->type || 'theme_mod' === $this->type );
741
+		$is_core_type = ('option' === $this->type || 'theme_mod' === $this->type);
742 742
 
743
-		if ( ! $is_core_type && ! $this->is_multidimensional_aggregated ) {
743
+		if ( ! $is_core_type && ! $this->is_multidimensional_aggregated) {
744 744
 
745 745
 			// Use post value if previewed and a post value is present.
746
-			if ( $this->is_previewed ) {
747
-				$value = $this->post_value( null );
748
-				if ( null !== $value ) {
746
+			if ($this->is_previewed) {
747
+				$value = $this->post_value(null);
748
+				if (null !== $value) {
749 749
 					return $value;
750 750
 				}
751 751
 			}
752 752
 
753
-			$value = $this->get_root_value( $this->default );
753
+			$value = $this->get_root_value($this->default);
754 754
 
755 755
 			/**
756 756
 			 * Filters a Customize setting value not handled as a theme_mod or option.
@@ -767,17 +767,17 @@  discard block
 block discarded – undo
767 767
 			 * @param mixed                $default The setting default value. Default empty.
768 768
 			 * @param WP_Customize_Setting $this    The setting instance.
769 769
 			 */
770
-			$value = apply_filters( "customize_value_{$id_base}", $value, $this );
771
-		} elseif ( $this->is_multidimensional_aggregated ) {
772
-			$root_value = self::$aggregated_multidimensionals[ $this->type ][ $id_base ]['root_value'];
773
-			$value = $this->multidimensional_get( $root_value, $this->id_data['keys'], $this->default );
770
+			$value = apply_filters("customize_value_{$id_base}", $value, $this);
771
+		} elseif ($this->is_multidimensional_aggregated) {
772
+			$root_value = self::$aggregated_multidimensionals[$this->type][$id_base]['root_value'];
773
+			$value = $this->multidimensional_get($root_value, $this->id_data['keys'], $this->default);
774 774
 
775 775
 			// Ensure that the post value is used if the setting is previewed, since preview filters aren't applying on cached $root_value.
776
-			if ( $this->is_previewed ) {
777
-				$value = $this->post_value( $value );
776
+			if ($this->is_previewed) {
777
+				$value = $this->post_value($value);
778 778
 			}
779 779
 		} else {
780
-			$value = $this->get_root_value( $this->default );
780
+			$value = $this->get_root_value($this->default);
781 781
 		}
782 782
 		return $value;
783 783
 	}
@@ -801,10 +801,10 @@  discard block
 block discarded – undo
801 801
 		 * @param mixed                $value The setting value.
802 802
 		 * @param WP_Customize_Setting $this  WP_Customize_Setting instance.
803 803
 		 */
804
-		$value = apply_filters( "customize_sanitize_js_{$this->id}", $this->value(), $this );
804
+		$value = apply_filters("customize_sanitize_js_{$this->id}", $this->value(), $this);
805 805
 
806
-		if ( is_string( $value ) )
807
-			return html_entity_decode( $value, ENT_QUOTES, 'UTF-8');
806
+		if (is_string($value))
807
+			return html_entity_decode($value, ENT_QUOTES, 'UTF-8');
808 808
 
809 809
 		return $value;
810 810
 	}
@@ -833,10 +833,10 @@  discard block
 block discarded – undo
833 833
 	 * @return bool False if theme doesn't support the setting or user can't change setting, otherwise true.
834 834
 	 */
835 835
 	final public function check_capabilities() {
836
-		if ( $this->capability && ! call_user_func_array( 'current_user_can', (array) $this->capability ) )
836
+		if ($this->capability && ! call_user_func_array('current_user_can', (array) $this->capability))
837 837
 			return false;
838 838
 
839
-		if ( $this->theme_supports && ! call_user_func_array( 'current_theme_supports', (array) $this->theme_supports ) )
839
+		if ($this->theme_supports && ! call_user_func_array('current_theme_supports', (array) $this->theme_supports))
840 840
 			return false;
841 841
 
842 842
 		return true;
@@ -852,37 +852,37 @@  discard block
 block discarded – undo
852 852
 	 * @param bool $create Default is false.
853 853
 	 * @return array|void Keys are 'root', 'node', and 'key'.
854 854
 	 */
855
-	final protected function multidimensional( &$root, $keys, $create = false ) {
856
-		if ( $create && empty( $root ) )
855
+	final protected function multidimensional(&$root, $keys, $create = false) {
856
+		if ($create && empty($root))
857 857
 			$root = array();
858 858
 
859
-		if ( ! isset( $root ) || empty( $keys ) )
859
+		if ( ! isset($root) || empty($keys))
860 860
 			return;
861 861
 
862
-		$last = array_pop( $keys );
862
+		$last = array_pop($keys);
863 863
 		$node = &$root;
864 864
 
865
-		foreach ( $keys as $key ) {
866
-			if ( $create && ! isset( $node[ $key ] ) )
867
-				$node[ $key ] = array();
865
+		foreach ($keys as $key) {
866
+			if ($create && ! isset($node[$key]))
867
+				$node[$key] = array();
868 868
 
869
-			if ( ! is_array( $node ) || ! isset( $node[ $key ] ) )
869
+			if ( ! is_array($node) || ! isset($node[$key]))
870 870
 				return;
871 871
 
872
-			$node = &$node[ $key ];
872
+			$node = &$node[$key];
873 873
 		}
874 874
 
875
-		if ( $create ) {
876
-			if ( ! is_array( $node ) ) {
875
+		if ($create) {
876
+			if ( ! is_array($node)) {
877 877
 				// account for an array overriding a string or object value
878 878
 				$node = array();
879 879
 			}
880
-			if ( ! isset( $node[ $last ] ) ) {
881
-				$node[ $last ] = array();
880
+			if ( ! isset($node[$last])) {
881
+				$node[$last] = array();
882 882
 			}
883 883
 		}
884 884
 
885
-		if ( ! isset( $node[ $last ] ) )
885
+		if ( ! isset($node[$last]))
886 886
 			return;
887 887
 
888 888
 		return array(
@@ -902,16 +902,16 @@  discard block
 block discarded – undo
902 902
 	 * @param mixed $value The value to update.
903 903
 	 * @return mixed
904 904
 	 */
905
-	final protected function multidimensional_replace( $root, $keys, $value ) {
906
-		if ( ! isset( $value ) )
905
+	final protected function multidimensional_replace($root, $keys, $value) {
906
+		if ( ! isset($value))
907 907
 			return $root;
908
-		elseif ( empty( $keys ) ) // If there are no keys, we're replacing the root.
908
+		elseif (empty($keys)) // If there are no keys, we're replacing the root.
909 909
 			return $value;
910 910
 
911
-		$result = $this->multidimensional( $root, $keys, true );
911
+		$result = $this->multidimensional($root, $keys, true);
912 912
 
913
-		if ( isset( $result ) )
914
-			$result['node'][ $result['key'] ] = $value;
913
+		if (isset($result))
914
+			$result['node'][$result['key']] = $value;
915 915
 
916 916
 		return $root;
917 917
 	}
@@ -926,12 +926,12 @@  discard block
 block discarded – undo
926 926
 	 * @param mixed $default A default value which is used as a fallback. Default is null.
927 927
 	 * @return mixed The requested value or the default value.
928 928
 	 */
929
-	final protected function multidimensional_get( $root, $keys, $default = null ) {
930
-		if ( empty( $keys ) ) // If there are no keys, test the root.
931
-			return isset( $root ) ? $root : $default;
929
+	final protected function multidimensional_get($root, $keys, $default = null) {
930
+		if (empty($keys)) // If there are no keys, test the root.
931
+			return isset($root) ? $root : $default;
932 932
 
933
-		$result = $this->multidimensional( $root, $keys );
934
-		return isset( $result ) ? $result['node'][ $result['key'] ] : $default;
933
+		$result = $this->multidimensional($root, $keys);
934
+		return isset($result) ? $result['node'][$result['key']] : $default;
935 935
 	}
936 936
 
937 937
 	/**
@@ -943,33 +943,33 @@  discard block
 block discarded – undo
943 943
 	 * @param $keys
944 944
 	 * @return bool True if value is set, false if not.
945 945
 	 */
946
-	final protected function multidimensional_isset( $root, $keys ) {
947
-		$result = $this->multidimensional_get( $root, $keys );
948
-		return isset( $result );
946
+	final protected function multidimensional_isset($root, $keys) {
947
+		$result = $this->multidimensional_get($root, $keys);
948
+		return isset($result);
949 949
 	}
950 950
 }
951 951
 
952 952
 /**
953 953
  * WP_Customize_Filter_Setting class.
954 954
  */
955
-require_once( ABSPATH . WPINC . '/customize/class-wp-customize-filter-setting.php' );
955
+require_once(ABSPATH.WPINC.'/customize/class-wp-customize-filter-setting.php');
956 956
 
957 957
 /**
958 958
  * WP_Customize_Header_Image_Setting class.
959 959
  */
960
-require_once( ABSPATH . WPINC . '/customize/class-wp-customize-header-image-setting.php' );
960
+require_once(ABSPATH.WPINC.'/customize/class-wp-customize-header-image-setting.php');
961 961
 
962 962
 /**
963 963
  * WP_Customize_Background_Image_Setting class.
964 964
  */
965
-require_once( ABSPATH . WPINC . '/customize/class-wp-customize-background-image-setting.php' );
965
+require_once(ABSPATH.WPINC.'/customize/class-wp-customize-background-image-setting.php');
966 966
 
967 967
 /**
968 968
  * WP_Customize_Nav_Menu_Item_Setting class.
969 969
  */
970
-require_once( ABSPATH . WPINC . '/customize/class-wp-customize-nav-menu-item-setting.php' );
970
+require_once(ABSPATH.WPINC.'/customize/class-wp-customize-nav-menu-item-setting.php');
971 971
 
972 972
 /**
973 973
  * WP_Customize_Nav_Menu_Setting class.
974 974
  */
975
-require_once( ABSPATH . WPINC . '/customize/class-wp-customize-nav-menu-setting.php' );
975
+require_once(ABSPATH.WPINC.'/customize/class-wp-customize-nav-menu-setting.php');
Please login to merge, or discard this patch.
src/wp-includes/post-template.php 4 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1097,7 +1097,7 @@
 block discarded – undo
1097 1097
 	 * @param string $output HTML output for drop down list of pages.
1098 1098
 	 * @param array  $r      The parsed arguments array.
1099 1099
 	 * @param array  $pages  List of WP_Post objects returned by `get_pages()`
1100
- 	 */
1100
+	 */
1101 1101
 	$html = apply_filters( 'wp_dropdown_pages', $output, $r, $pages );
1102 1102
 
1103 1103
 	if ( $r['echo'] ) {
Please login to merge, or discard this patch.
Braces   +205 added lines, -149 removed lines patch added patch discarded remove patch
@@ -42,16 +42,18 @@  discard block
 block discarded – undo
42 42
 function the_title( $before = '', $after = '', $echo = true ) {
43 43
 	$title = get_the_title();
44 44
 
45
-	if ( strlen($title) == 0 )
46
-		return;
45
+	if ( strlen($title) == 0 ) {
46
+			return;
47
+	}
47 48
 
48 49
 	$title = $before . $title . $after;
49 50
 
50
-	if ( $echo )
51
-		echo $title;
52
-	else
53
-		return $title;
54
-}
51
+	if ( $echo ) {
52
+			echo $title;
53
+	} else {
54
+			return $title;
55
+	}
56
+	}
55 57
 
56 58
 /**
57 59
  * Sanitize the current title when retrieving or displaying.
@@ -278,30 +280,37 @@  discard block
 block discarded – undo
278 280
 	$has_teaser = false;
279 281
 
280 282
 	// If post password required and it doesn't match the cookie.
281
-	if ( post_password_required( $post ) )
282
-		return get_the_password_form( $post );
283
+	if ( post_password_required( $post ) ) {
284
+			return get_the_password_form( $post );
285
+	}
283 286
 
284
-	if ( $page > count( $pages ) ) // if the requested page doesn't exist
285
-		$page = count( $pages ); // give them the highest numbered page that DOES exist
287
+	if ( $page > count( $pages ) ) {
288
+		// if the requested page doesn't exist
289
+		$page = count( $pages );
290
+	}
291
+	// give them the highest numbered page that DOES exist
286 292
 
287 293
 	$content = $pages[$page - 1];
288 294
 	if ( preg_match( '/<!--more(.*?)?-->/', $content, $matches ) ) {
289 295
 		$content = explode( $matches[0], $content, 2 );
290
-		if ( ! empty( $matches[1] ) && ! empty( $more_link_text ) )
291
-			$more_link_text = strip_tags( wp_kses_no_null( trim( $matches[1] ) ) );
296
+		if ( ! empty( $matches[1] ) && ! empty( $more_link_text ) ) {
297
+					$more_link_text = strip_tags( wp_kses_no_null( trim( $matches[1] ) ) );
298
+		}
292 299
 
293 300
 		$has_teaser = true;
294 301
 	} else {
295 302
 		$content = array( $content );
296 303
 	}
297 304
 
298
-	if ( false !== strpos( $post->post_content, '<!--noteaser-->' ) && ( ! $multipage || $page == 1 ) )
299
-		$strip_teaser = true;
305
+	if ( false !== strpos( $post->post_content, '<!--noteaser-->' ) && ( ! $multipage || $page == 1 ) ) {
306
+			$strip_teaser = true;
307
+	}
300 308
 
301 309
 	$teaser = $content[0];
302 310
 
303
-	if ( $more && $strip_teaser && $has_teaser )
304
-		$teaser = '';
311
+	if ( $more && $strip_teaser && $has_teaser ) {
312
+			$teaser = '';
313
+	}
305 314
 
306 315
 	$output .= $teaser;
307 316
 
@@ -309,8 +318,8 @@  discard block
 block discarded – undo
309 318
 		if ( $more ) {
310 319
 			$output .= '<span id="more-' . $post->ID . '"></span>' . $content[1];
311 320
 		} else {
312
-			if ( ! empty( $more_link_text ) )
313
-
321
+			if ( ! empty( $more_link_text ) ) {
322
+			
314 323
 				/**
315 324
 				 * Filters the Read More link text.
316 325
 				 *
@@ -320,12 +329,15 @@  discard block
 block discarded – undo
320 329
 				 * @param string $more_link_text    Read More text.
321 330
 				 */
322 331
 				$output .= apply_filters( 'the_content_more_link', ' <a href="' . get_permalink() . "#more-{$post->ID}\" class=\"more-link\">$more_link_text</a>", $more_link_text );
332
+			}
323 333
 			$output = force_balance_tags( $output );
324 334
 		}
325 335
 	}
326 336
 
327
-	if ( $preview ) // Preview fix for JavaScript bug with foreign languages.
337
+	if ( $preview ) {
338
+		// Preview fix for JavaScript bug with foreign languages.
328 339
 		$output =	preg_replace_callback( '/\%u([0-9A-F]{4})/', '_convert_urlencoded_to_entities', $output );
340
+	}
329 341
 
330 342
 	return $output;
331 343
 }
@@ -464,8 +476,9 @@  discard block
 block discarded – undo
464 476
 	}
465 477
 
466 478
 	$classes[] = 'post-' . $post->ID;
467
-	if ( ! is_admin() )
468
-		$classes[] = $post->post_type;
479
+	if ( ! is_admin() ) {
480
+			$classes[] = $post->post_type;
481
+	}
469 482
 	$classes[] = 'type-' . $post->post_type;
470 483
 	$classes[] = 'status-' . $post->post_status;
471 484
 
@@ -473,10 +486,11 @@  discard block
 block discarded – undo
473 486
 	if ( post_type_supports( $post->post_type, 'post-formats' ) ) {
474 487
 		$post_format = get_post_format( $post->ID );
475 488
 
476
-		if ( $post_format && !is_wp_error($post_format) )
477
-			$classes[] = 'format-' . sanitize_html_class( $post_format );
478
-		else
479
-			$classes[] = 'format-standard';
489
+		if ( $post_format && !is_wp_error($post_format) ) {
490
+					$classes[] = 'format-' . sanitize_html_class( $post_format );
491
+		} else {
492
+					$classes[] = 'format-standard';
493
+		}
480 494
 	}
481 495
 
482 496
 	$post_password_required = post_password_required( $post->ID );
@@ -572,27 +586,35 @@  discard block
 block discarded – undo
572 586
 
573 587
 	$classes = array();
574 588
 
575
-	if ( is_rtl() )
576
-		$classes[] = 'rtl';
577
-
578
-	if ( is_front_page() )
579
-		$classes[] = 'home';
580
-	if ( is_home() )
581
-		$classes[] = 'blog';
582
-	if ( is_archive() )
583
-		$classes[] = 'archive';
584
-	if ( is_date() )
585
-		$classes[] = 'date';
589
+	if ( is_rtl() ) {
590
+			$classes[] = 'rtl';
591
+	}
592
+
593
+	if ( is_front_page() ) {
594
+			$classes[] = 'home';
595
+	}
596
+	if ( is_home() ) {
597
+			$classes[] = 'blog';
598
+	}
599
+	if ( is_archive() ) {
600
+			$classes[] = 'archive';
601
+	}
602
+	if ( is_date() ) {
603
+			$classes[] = 'date';
604
+	}
586 605
 	if ( is_search() ) {
587 606
 		$classes[] = 'search';
588 607
 		$classes[] = $wp_query->posts ? 'search-results' : 'search-no-results';
589 608
 	}
590
-	if ( is_paged() )
591
-		$classes[] = 'paged';
592
-	if ( is_attachment() )
593
-		$classes[] = 'attachment';
594
-	if ( is_404() )
595
-		$classes[] = 'error404';
609
+	if ( is_paged() ) {
610
+			$classes[] = 'paged';
611
+	}
612
+	if ( is_attachment() ) {
613
+			$classes[] = 'attachment';
614
+	}
615
+	if ( is_404() ) {
616
+			$classes[] = 'error404';
617
+	}
596 618
 
597 619
 	if ( is_singular() ) {
598 620
 		$post_id = $wp_query->get_queried_object_id();
@@ -623,10 +645,11 @@  discard block
 block discarded – undo
623 645
 				if ( post_type_supports( $post->post_type, 'post-formats' ) ) {
624 646
 					$post_format = get_post_format( $post->ID );
625 647
 
626
-					if ( $post_format && !is_wp_error($post_format) )
627
-						$classes[] = 'single-format-' . sanitize_html_class( $post_format );
628
-					else
629
-						$classes[] = 'single-format-standard';
648
+					if ( $post_format && !is_wp_error($post_format) ) {
649
+											$classes[] = 'single-format-' . sanitize_html_class( $post_format );
650
+					} else {
651
+											$classes[] = 'single-format-standard';
652
+					}
630 653
 				}
631 654
 			}
632 655
 		}
@@ -658,8 +681,9 @@  discard block
 block discarded – undo
658 681
 		if ( is_post_type_archive() ) {
659 682
 			$classes[] = 'post-type-archive';
660 683
 			$post_type = get_query_var( 'post_type' );
661
-			if ( is_array( $post_type ) )
662
-				$post_type = reset( $post_type );
684
+			if ( is_array( $post_type ) ) {
685
+							$post_type = reset( $post_type );
686
+			}
663 687
 			$classes[] = 'post-type-archive-' . sanitize_html_class( $post_type );
664 688
 		} elseif ( is_author() ) {
665 689
 			$author = $wp_query->get_queried_object();
@@ -707,16 +731,18 @@  discard block
 block discarded – undo
707 731
 		}
708 732
 	}
709 733
 
710
-	if ( is_user_logged_in() )
711
-		$classes[] = 'logged-in';
734
+	if ( is_user_logged_in() ) {
735
+			$classes[] = 'logged-in';
736
+	}
712 737
 
713 738
 	if ( is_admin_bar_showing() ) {
714 739
 		$classes[] = 'admin-bar';
715 740
 		$classes[] = 'no-customize-support';
716 741
 	}
717 742
 
718
-	if ( get_background_color() !== get_theme_support( 'custom-background', 'default-color' ) || get_background_image() )
719
-		$classes[] = 'custom-background';
743
+	if ( get_background_color() !== get_theme_support( 'custom-background', 'default-color' ) || get_background_image() ) {
744
+			$classes[] = 'custom-background';
745
+	}
720 746
 
721 747
 	if ( has_custom_logo() ) {
722 748
 		$classes[] = 'wp-custom-logo';
@@ -724,33 +750,36 @@  discard block
 block discarded – undo
724 750
 
725 751
 	$page = $wp_query->get( 'page' );
726 752
 
727
-	if ( ! $page || $page < 2 )
728
-		$page = $wp_query->get( 'paged' );
753
+	if ( ! $page || $page < 2 ) {
754
+			$page = $wp_query->get( 'paged' );
755
+	}
729 756
 
730 757
 	if ( $page && $page > 1 && ! is_404() ) {
731 758
 		$classes[] = 'paged-' . $page;
732 759
 
733
-		if ( is_single() )
734
-			$classes[] = 'single-paged-' . $page;
735
-		elseif ( is_page() )
736
-			$classes[] = 'page-paged-' . $page;
737
-		elseif ( is_category() )
738
-			$classes[] = 'category-paged-' . $page;
739
-		elseif ( is_tag() )
740
-			$classes[] = 'tag-paged-' . $page;
741
-		elseif ( is_date() )
742
-			$classes[] = 'date-paged-' . $page;
743
-		elseif ( is_author() )
744
-			$classes[] = 'author-paged-' . $page;
745
-		elseif ( is_search() )
746
-			$classes[] = 'search-paged-' . $page;
747
-		elseif ( is_post_type_archive() )
748
-			$classes[] = 'post-type-paged-' . $page;
760
+		if ( is_single() ) {
761
+					$classes[] = 'single-paged-' . $page;
762
+		} elseif ( is_page() ) {
763
+					$classes[] = 'page-paged-' . $page;
764
+		} elseif ( is_category() ) {
765
+					$classes[] = 'category-paged-' . $page;
766
+		} elseif ( is_tag() ) {
767
+					$classes[] = 'tag-paged-' . $page;
768
+		} elseif ( is_date() ) {
769
+					$classes[] = 'date-paged-' . $page;
770
+		} elseif ( is_author() ) {
771
+					$classes[] = 'author-paged-' . $page;
772
+		} elseif ( is_search() ) {
773
+					$classes[] = 'search-paged-' . $page;
774
+		} elseif ( is_post_type_archive() ) {
775
+					$classes[] = 'post-type-paged-' . $page;
776
+		}
749 777
 	}
750 778
 
751 779
 	if ( ! empty( $class ) ) {
752
-		if ( !is_array( $class ) )
753
-			$class = preg_split( '#\s+#', $class );
780
+		if ( !is_array( $class ) ) {
781
+					$class = preg_split( '#\s+#', $class );
782
+		}
754 783
 		$classes = array_merge( $classes, $class );
755 784
 	} else {
756 785
 		// Ensure that we always coerce class to being an array.
@@ -961,12 +990,13 @@  discard block
 block discarded – undo
961 990
 	if ( 1 == $i ) {
962 991
 		$url = get_permalink();
963 992
 	} else {
964
-		if ( '' == get_option('permalink_structure') || in_array($post->post_status, array('draft', 'pending')) )
965
-			$url = add_query_arg( 'page', $i, get_permalink() );
966
-		elseif ( 'page' == get_option('show_on_front') && get_option('page_on_front') == $post->ID )
967
-			$url = trailingslashit(get_permalink()) . user_trailingslashit("$wp_rewrite->pagination_base/" . $i, 'single_paged');
968
-		else
969
-			$url = trailingslashit(get_permalink()) . user_trailingslashit($i, 'single_paged');
993
+		if ( '' == get_option('permalink_structure') || in_array($post->post_status, array('draft', 'pending')) ) {
994
+					$url = add_query_arg( 'page', $i, get_permalink() );
995
+		} elseif ( 'page' == get_option('show_on_front') && get_option('page_on_front') == $post->ID ) {
996
+					$url = trailingslashit(get_permalink()) . user_trailingslashit("$wp_rewrite->pagination_base/" . $i, 'single_paged');
997
+		} else {
998
+					$url = trailingslashit(get_permalink()) . user_trailingslashit($i, 'single_paged');
999
+		}
970 1000
 	}
971 1001
 
972 1002
 	if ( is_preview() ) {
@@ -997,13 +1027,14 @@  discard block
 block discarded – undo
997 1027
 function post_custom( $key = '' ) {
998 1028
 	$custom = get_post_custom();
999 1029
 
1000
-	if ( !isset( $custom[$key] ) )
1001
-		return false;
1002
-	elseif ( 1 == count($custom[$key]) )
1003
-		return $custom[$key][0];
1004
-	else
1005
-		return $custom[$key];
1006
-}
1030
+	if ( !isset( $custom[$key] ) ) {
1031
+			return false;
1032
+	} elseif ( 1 == count($custom[$key]) ) {
1033
+			return $custom[$key][0];
1034
+	} else {
1035
+			return $custom[$key];
1036
+	}
1037
+	}
1007 1038
 
1008 1039
 /**
1009 1040
  * Display list of post custom fields.
@@ -1018,8 +1049,9 @@  discard block
 block discarded – undo
1018 1049
 		echo "<ul class='post-meta'>\n";
1019 1050
 		foreach ( (array) $keys as $key ) {
1020 1051
 			$keyt = trim($key);
1021
-			if ( is_protected_meta( $keyt, 'post' ) )
1022
-				continue;
1052
+			if ( is_protected_meta( $keyt, 'post' ) ) {
1053
+							continue;
1054
+			}
1023 1055
 			$values = array_map('trim', get_post_custom_values($key));
1024 1056
 			$value = implode($values,', ');
1025 1057
 
@@ -1330,13 +1362,15 @@  discard block
 block discarded – undo
1330 1362
 
1331 1363
 	// Show Home in the menu
1332 1364
 	if ( ! empty($args['show_home']) ) {
1333
-		if ( true === $args['show_home'] || '1' === $args['show_home'] || 1 === $args['show_home'] )
1334
-			$text = __('Home');
1335
-		else
1336
-			$text = $args['show_home'];
1365
+		if ( true === $args['show_home'] || '1' === $args['show_home'] || 1 === $args['show_home'] ) {
1366
+					$text = __('Home');
1367
+		} else {
1368
+					$text = $args['show_home'];
1369
+		}
1337 1370
 		$class = '';
1338
-		if ( is_front_page() && !is_paged() )
1339
-			$class = 'class="current_page_item"';
1371
+		if ( is_front_page() && !is_paged() ) {
1372
+					$class = 'class="current_page_item"';
1373
+		}
1340 1374
 		$menu .= '<li ' . $class . '><a href="' . home_url( '/' ) . '">' . $args['link_before'] . $text . $args['link_after'] . '</a></li>';
1341 1375
 		// If the front page is a page, add it to the exclude list
1342 1376
 		if (get_option('show_on_front') == 'page') {
@@ -1395,11 +1429,12 @@  discard block
 block discarded – undo
1395 1429
 	 * @param array  $args An array of arguments.
1396 1430
 	 */
1397 1431
 	$menu = apply_filters( 'wp_page_menu', $menu, $args );
1398
-	if ( $args['echo'] )
1399
-		echo $menu;
1400
-	else
1401
-		return $menu;
1402
-}
1432
+	if ( $args['echo'] ) {
1433
+			echo $menu;
1434
+	} else {
1435
+			return $menu;
1436
+	}
1437
+	}
1403 1438
 
1404 1439
 //
1405 1440
 // Page helpers
@@ -1418,14 +1453,16 @@  discard block
 block discarded – undo
1418 1453
  * @return string
1419 1454
  */
1420 1455
 function walk_page_tree( $pages, $depth, $current_page, $r ) {
1421
-	if ( empty($r['walker']) )
1422
-		$walker = new Walker_Page;
1423
-	else
1424
-		$walker = $r['walker'];
1456
+	if ( empty($r['walker']) ) {
1457
+			$walker = new Walker_Page;
1458
+	} else {
1459
+			$walker = $r['walker'];
1460
+	}
1425 1461
 
1426 1462
 	foreach ( (array) $pages as $page ) {
1427
-		if ( $page->post_parent )
1428
-			$r['pages_with_children'][ $page->post_parent ] = true;
1463
+		if ( $page->post_parent ) {
1464
+					$r['pages_with_children'][ $page->post_parent ] = true;
1465
+		}
1429 1466
 	}
1430 1467
 
1431 1468
 	$args = array($pages, $depth, $r, $current_page);
@@ -1443,10 +1480,12 @@  discard block
 block discarded – undo
1443 1480
  */
1444 1481
 function walk_page_dropdown_tree() {
1445 1482
 	$args = func_get_args();
1446
-	if ( empty($args[2]['walker']) ) // the user's options are the third parameter
1483
+	if ( empty($args[2]['walker']) ) {
1484
+		// the user's options are the third parameter
1447 1485
 		$walker = new Walker_PageDropdown;
1448
-	else
1449
-		$walker = $args[2]['walker'];
1486
+	} else {
1487
+			$walker = $args[2]['walker'];
1488
+	}
1450 1489
 
1451 1490
 	return call_user_func_array(array($walker, 'walk'), $args);
1452 1491
 }
@@ -1466,14 +1505,16 @@  discard block
 block discarded – undo
1466 1505
  * @param bool        $permalink    Optional, default is false. Whether to include permalink.
1467 1506
  */
1468 1507
 function the_attachment_link( $id = 0, $fullsize = false, $deprecated = false, $permalink = false ) {
1469
-	if ( !empty( $deprecated ) )
1470
-		_deprecated_argument( __FUNCTION__, '2.5.0' );
1508
+	if ( !empty( $deprecated ) ) {
1509
+			_deprecated_argument( __FUNCTION__, '2.5.0' );
1510
+	}
1471 1511
 
1472
-	if ( $fullsize )
1473
-		echo wp_get_attachment_link($id, 'full', $permalink);
1474
-	else
1475
-		echo wp_get_attachment_link($id, 'thumbnail', $permalink);
1476
-}
1512
+	if ( $fullsize ) {
1513
+			echo wp_get_attachment_link($id, 'full', $permalink);
1514
+	} else {
1515
+			echo wp_get_attachment_link($id, 'thumbnail', $permalink);
1516
+	}
1517
+	}
1477 1518
 
1478 1519
 /**
1479 1520
  * Retrieve an attachment page link using an image or icon, if possible.
@@ -1545,8 +1586,9 @@  discard block
 block discarded – undo
1545 1586
 function prepend_attachment($content) {
1546 1587
 	$post = get_post();
1547 1588
 
1548
-	if ( empty($post->post_type) || $post->post_type != 'attachment' )
1549
-		return $content;
1589
+	if ( empty($post->post_type) || $post->post_type != 'attachment' ) {
1590
+			return $content;
1591
+	}
1550 1592
 
1551 1593
 	if ( wp_attachment_is( 'video', $post ) ) {
1552 1594
 		$meta = wp_get_attachment_metadata( get_the_ID() );
@@ -1637,11 +1679,13 @@  discard block
 block discarded – undo
1637 1679
 
1638 1680
 	$page_template = get_page_template_slug( get_queried_object_id() );
1639 1681
 
1640
-	if ( empty( $template ) )
1641
-		return (bool) $page_template;
1682
+	if ( empty( $template ) ) {
1683
+			return (bool) $page_template;
1684
+	}
1642 1685
 
1643
-	if ( $template == $page_template )
1644
-		return true;
1686
+	if ( $template == $page_template ) {
1687
+			return true;
1688
+	}
1645 1689
 
1646 1690
 	if ( is_array( $template ) ) {
1647 1691
 		if ( ( in_array( 'default', $template, true ) && ! $page_template )
@@ -1690,11 +1734,13 @@  discard block
 block discarded – undo
1690 1734
  * @return string|false i18n formatted datetimestamp or localized 'Current Revision'.
1691 1735
  */
1692 1736
 function wp_post_revision_title( $revision, $link = true ) {
1693
-	if ( !$revision = get_post( $revision ) )
1694
-		return $revision;
1737
+	if ( !$revision = get_post( $revision ) ) {
1738
+			return $revision;
1739
+	}
1695 1740
 
1696
-	if ( !in_array( $revision->post_type, array( 'post', 'page', 'revision' ) ) )
1697
-		return false;
1741
+	if ( !in_array( $revision->post_type, array( 'post', 'page', 'revision' ) ) ) {
1742
+			return false;
1743
+	}
1698 1744
 
1699 1745
 	/* translators: revision date format, see https://secure.php.net/date */
1700 1746
 	$datef = _x( 'F j, Y @ H:i:s', 'revision date format' );
@@ -1704,13 +1750,15 @@  discard block
 block discarded – undo
1704 1750
 	$currentf  = __( '%s [Current Revision]' );
1705 1751
 
1706 1752
 	$date = date_i18n( $datef, strtotime( $revision->post_modified ) );
1707
-	if ( $link && current_user_can( 'edit_post', $revision->ID ) && $link = get_edit_post_link( $revision->ID ) )
1708
-		$date = "<a href='$link'>$date</a>";
1753
+	if ( $link && current_user_can( 'edit_post', $revision->ID ) && $link = get_edit_post_link( $revision->ID ) ) {
1754
+			$date = "<a href='$link'>$date</a>";
1755
+	}
1709 1756
 
1710
-	if ( !wp_is_post_revision( $revision ) )
1711
-		$date = sprintf( $currentf, $date );
1712
-	elseif ( wp_is_post_autosave( $revision ) )
1713
-		$date = sprintf( $autosavef, $date );
1757
+	if ( !wp_is_post_revision( $revision ) ) {
1758
+			$date = sprintf( $currentf, $date );
1759
+	} elseif ( wp_is_post_autosave( $revision ) ) {
1760
+			$date = sprintf( $autosavef, $date );
1761
+	}
1714 1762
 
1715 1763
 	return $date;
1716 1764
 }
@@ -1725,11 +1773,13 @@  discard block
 block discarded – undo
1725 1773
  * @return string|false gravatar, user, i18n formatted datetimestamp or localized 'Current Revision'.
1726 1774
  */
1727 1775
 function wp_post_revision_title_expanded( $revision, $link = true ) {
1728
-	if ( !$revision = get_post( $revision ) )
1729
-		return $revision;
1776
+	if ( !$revision = get_post( $revision ) ) {
1777
+			return $revision;
1778
+	}
1730 1779
 
1731
-	if ( !in_array( $revision->post_type, array( 'post', 'page', 'revision' ) ) )
1732
-		return false;
1780
+	if ( !in_array( $revision->post_type, array( 'post', 'page', 'revision' ) ) ) {
1781
+			return false;
1782
+	}
1733 1783
 
1734 1784
 	$author = get_the_author_meta( 'display_name', $revision->post_author );
1735 1785
 	/* translators: revision date format, see https://secure.php.net/date */
@@ -1738,8 +1788,9 @@  discard block
 block discarded – undo
1738 1788
 	$gravatar = get_avatar( $revision->post_author, 24 );
1739 1789
 
1740 1790
 	$date = date_i18n( $datef, strtotime( $revision->post_modified ) );
1741
-	if ( $link && current_user_can( 'edit_post', $revision->ID ) && $link = get_edit_post_link( $revision->ID ) )
1742
-		$date = "<a href='$link'>$date</a>";
1791
+	if ( $link && current_user_can( 'edit_post', $revision->ID ) && $link = get_edit_post_link( $revision->ID ) ) {
1792
+			$date = "<a href='$link'>$date</a>";
1793
+	}
1743 1794
 
1744 1795
 	$revision_date_author = sprintf(
1745 1796
 		/* translators: post revision title: 1: author avatar, 2: author name, 3: time ago, 4: date */
@@ -1755,10 +1806,11 @@  discard block
 block discarded – undo
1755 1806
 	/* translators: %s: revision date with author avatar */
1756 1807
 	$currentf  = __( '%s [Current Revision]' );
1757 1808
 
1758
-	if ( !wp_is_post_revision( $revision ) )
1759
-		$revision_date_author = sprintf( $currentf, $revision_date_author );
1760
-	elseif ( wp_is_post_autosave( $revision ) )
1761
-		$revision_date_author = sprintf( $autosavef, $revision_date_author );
1809
+	if ( !wp_is_post_revision( $revision ) ) {
1810
+			$revision_date_author = sprintf( $currentf, $revision_date_author );
1811
+	} elseif ( wp_is_post_autosave( $revision ) ) {
1812
+			$revision_date_author = sprintf( $autosavef, $revision_date_author );
1813
+	}
1762 1814
 
1763 1815
 	/**
1764 1816
 	 * Filters the formatted author and date for a revision.
@@ -1785,8 +1837,9 @@  discard block
 block discarded – undo
1785 1837
  * @param string      $type    'all' (default), 'revision' or 'autosave'
1786 1838
  */
1787 1839
 function wp_list_post_revisions( $post_id = 0, $type = 'all' ) {
1788
-	if ( ! $post = get_post( $post_id ) )
1789
-		return;
1840
+	if ( ! $post = get_post( $post_id ) ) {
1841
+			return;
1842
+	}
1790 1843
 
1791 1844
 	// $args array with (parent, format, right, left, type) deprecated since 3.6
1792 1845
 	if ( is_array( $type ) ) {
@@ -1794,17 +1847,20 @@  discard block
 block discarded – undo
1794 1847
 		_deprecated_argument( __FUNCTION__, '3.6.0' );
1795 1848
 	}
1796 1849
 
1797
-	if ( ! $revisions = wp_get_post_revisions( $post->ID ) )
1798
-		return;
1850
+	if ( ! $revisions = wp_get_post_revisions( $post->ID ) ) {
1851
+			return;
1852
+	}
1799 1853
 
1800 1854
 	$rows = '';
1801 1855
 	foreach ( $revisions as $revision ) {
1802
-		if ( ! current_user_can( 'read_post', $revision->ID ) )
1803
-			continue;
1856
+		if ( ! current_user_can( 'read_post', $revision->ID ) ) {
1857
+					continue;
1858
+		}
1804 1859
 
1805 1860
 		$is_autosave = wp_is_post_autosave( $revision );
1806
-		if ( ( 'revision' === $type && $is_autosave ) || ( 'autosave' === $type && ! $is_autosave ) )
1807
-			continue;
1861
+		if ( ( 'revision' === $type && $is_autosave ) || ( 'autosave' === $type && ! $is_autosave ) ) {
1862
+					continue;
1863
+		}
1808 1864
 
1809 1865
 		$rows .= "\t<li>" . wp_post_revision_title_expanded( $revision ) . "</li>\n";
1810 1866
 	}
Please login to merge, or discard this patch.
Doc Comments   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
  *
105 105
  * @since 0.71
106 106
  *
107
- * @param int|WP_Post $post Optional. Post ID or WP_Post object. Default is global $post.
107
+ * @param integer $post Optional. Post ID or WP_Post object. Default is global $post.
108 108
  * @return string
109 109
  */
110 110
 function get_the_title( $post = 0 ) {
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
  *
170 170
  * @since 1.5.0
171 171
  *
172
- * @param int|WP_Post $post Optional. Post ID or post object. Default is global $post.
172
+ * @param integer $post Optional. Post ID or post object. Default is global $post.
173 173
  */
174 174
 function the_guid( $post = 0 ) {
175 175
 	$post = get_post( $post );
@@ -199,7 +199,7 @@  discard block
 block discarded – undo
199 199
  *
200 200
  * @since 1.5.0
201 201
  *
202
- * @param int|WP_Post $post Optional. Post ID or post object. Default is global $post.
202
+ * @param integer $post Optional. Post ID or post object. Default is global $post.
203 203
  * @return string
204 204
  */
205 205
 function get_the_guid( $post = 0 ) {
@@ -402,7 +402,7 @@  discard block
 block discarded – undo
402 402
  *
403 403
  * @since 2.3.0
404 404
  *
405
- * @param int|WP_Post $post Optional. Post ID or WP_Post object. Default is global $post.
405
+ * @param integer $post Optional. Post ID or WP_Post object. Default is global $post.
406 406
  * @return bool True if the post has a custom excerpt, false otherwise.
407 407
  */
408 408
 function has_excerpt( $post = 0 ) {
@@ -1461,7 +1461,7 @@  discard block
 block discarded – undo
1461 1461
  *
1462 1462
  * @since 2.0.0
1463 1463
  *
1464
- * @param int|WP_Post $id Optional. Post ID or post object.
1464
+ * @param integer $id Optional. Post ID or post object.
1465 1465
  * @param bool        $fullsize     Optional, default is false. Whether to use full size.
1466 1466
  * @param bool        $deprecated   Deprecated. Not used.
1467 1467
  * @param bool        $permalink    Optional, default is false. Whether to include permalink.
@@ -1482,7 +1482,7 @@  discard block
 block discarded – undo
1482 1482
  * @since 2.5.0
1483 1483
  * @since 4.4.0 The `$id` parameter can now accept either a post ID or `WP_Post` object.
1484 1484
  *
1485
- * @param int|WP_Post  $id        Optional. Post ID or post object.
1485
+ * @param integer  $id        Optional. Post ID or post object.
1486 1486
  * @param string|array $size      Optional. Image size. Accepts any valid image size, or an array
1487 1487
  *                                of width and height values in pixels (in that order).
1488 1488
  *                                Default 'thumbnail'.
@@ -1592,7 +1592,7 @@  discard block
 block discarded – undo
1592 1592
  *
1593 1593
  * @since 1.0.0
1594 1594
  *
1595
- * @param int|WP_Post $post Optional. Post ID or WP_Post object. Default is global $post.
1595
+ * @param integer $post Optional. Post ID or WP_Post object. Default is global $post.
1596 1596
  * @return string HTML content for password form for password protected post.
1597 1597
  */
1598 1598
 function get_the_password_form( $post = 0 ) {
@@ -1628,7 +1628,7 @@  discard block
 block discarded – undo
1628 1628
  * @since 4.2.0 The `$template` parameter was changed to also accept an array of page templates.
1629 1629
  * @since 4.7.0 Now works with any post type, not just pages.
1630 1630
  *
1631
- * @param string|array $template The specific template name or array of templates to match.
1631
+ * @param string $template The specific template name or array of templates to match.
1632 1632
  * @return bool True on success, false on failure.
1633 1633
  */
1634 1634
 function is_page_template( $template = '' ) {
@@ -1782,7 +1782,7 @@  discard block
 block discarded – undo
1782 1782
  *
1783 1783
  * @since 2.6.0
1784 1784
  *
1785
- * @param int|WP_Post $post_id Optional. Post ID or WP_Post object. Default is global $post.
1785
+ * @param integer $post_id Optional. Post ID or WP_Post object. Default is global $post.
1786 1786
  * @param string      $type    'all' (default), 'revision' or 'autosave'
1787 1787
  */
1788 1788
 function wp_list_post_revisions( $post_id = 0, $type = 'all' ) {
Please login to merge, or discard this patch.
Spacing   +424 added lines, -424 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
  */
27 27
 function get_the_ID() {
28 28
 	$post = get_post();
29
-	return ! empty( $post ) ? $post->ID : false;
29
+	return ! empty($post) ? $post->ID : false;
30 30
 }
31 31
 
32 32
 /**
@@ -39,15 +39,15 @@  discard block
 block discarded – undo
39 39
  * @param bool   $echo   Optional. Whether to echo or return the title. Default true for echo.
40 40
  * @return string|void Current post title if $echo is false.
41 41
  */
42
-function the_title( $before = '', $after = '', $echo = true ) {
42
+function the_title($before = '', $after = '', $echo = true) {
43 43
 	$title = get_the_title();
44 44
 
45
-	if ( strlen($title) == 0 )
45
+	if (strlen($title) == 0)
46 46
 		return;
47 47
 
48
-	$title = $before . $title . $after;
48
+	$title = $before.$title.$after;
49 49
 
50
-	if ( $echo )
50
+	if ($echo)
51 51
 		echo $title;
52 52
 	else
53 53
 		return $title;
@@ -75,20 +75,20 @@  discard block
 block discarded – undo
75 75
  * }
76 76
  * @return string|void String when echo is false.
77 77
  */
78
-function the_title_attribute( $args = '' ) {
79
-	$defaults = array( 'before' => '', 'after' =>  '', 'echo' => true, 'post' => get_post() );
80
-	$r = wp_parse_args( $args, $defaults );
78
+function the_title_attribute($args = '') {
79
+	$defaults = array('before' => '', 'after' =>  '', 'echo' => true, 'post' => get_post());
80
+	$r = wp_parse_args($args, $defaults);
81 81
 
82
-	$title = get_the_title( $r['post'] );
82
+	$title = get_the_title($r['post']);
83 83
 
84
-	if ( strlen( $title ) == 0 ) {
84
+	if (strlen($title) == 0) {
85 85
 		return;
86 86
 	}
87 87
 
88
-	$title = $r['before'] . $title . $r['after'];
89
-	$title = esc_attr( strip_tags( $title ) );
88
+	$title = $r['before'].$title.$r['after'];
89
+	$title = esc_attr(strip_tags($title));
90 90
 
91
-	if ( $r['echo'] ) {
91
+	if ($r['echo']) {
92 92
 		echo $title;
93 93
 	} else {
94 94
 		return $title;
@@ -107,14 +107,14 @@  discard block
 block discarded – undo
107 107
  * @param int|WP_Post $post Optional. Post ID or WP_Post object. Default is global $post.
108 108
  * @return string
109 109
  */
110
-function get_the_title( $post = 0 ) {
111
-	$post = get_post( $post );
110
+function get_the_title($post = 0) {
111
+	$post = get_post($post);
112 112
 
113
-	$title = isset( $post->post_title ) ? $post->post_title : '';
114
-	$id = isset( $post->ID ) ? $post->ID : 0;
113
+	$title = isset($post->post_title) ? $post->post_title : '';
114
+	$id = isset($post->ID) ? $post->ID : 0;
115 115
 
116
-	if ( ! is_admin() ) {
117
-		if ( ! empty( $post->post_password ) ) {
116
+	if ( ! is_admin()) {
117
+		if ( ! empty($post->post_password)) {
118 118
 
119 119
 			/**
120 120
 			 * Filters the text prepended to the post title for protected posts.
@@ -127,9 +127,9 @@  discard block
 block discarded – undo
127 127
 			 *                         Default 'Protected: %s'.
128 128
 			 * @param WP_Post $post    Current post object.
129 129
 			 */
130
-			$protected_title_format = apply_filters( 'protected_title_format', __( 'Protected: %s' ), $post );
131
-			$title = sprintf( $protected_title_format, $title );
132
-		} elseif ( isset( $post->post_status ) && 'private' == $post->post_status ) {
130
+			$protected_title_format = apply_filters('protected_title_format', __('Protected: %s'), $post);
131
+			$title = sprintf($protected_title_format, $title);
132
+		} elseif (isset($post->post_status) && 'private' == $post->post_status) {
133 133
 
134 134
 			/**
135 135
 			 * Filters the text prepended to the post title of private posts.
@@ -142,8 +142,8 @@  discard block
 block discarded – undo
142 142
 			 *                         Default 'Private: %s'.
143 143
 			 * @param WP_Post $post    Current post object.
144 144
 			 */
145
-			$private_title_format = apply_filters( 'private_title_format', __( 'Private: %s' ), $post );
146
-			$title = sprintf( $private_title_format, $title );
145
+			$private_title_format = apply_filters('private_title_format', __('Private: %s'), $post);
146
+			$title = sprintf($private_title_format, $title);
147 147
 		}
148 148
 	}
149 149
 
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
 	 * @param string $title The post title.
156 156
 	 * @param int    $id    The post ID.
157 157
 	 */
158
-	return apply_filters( 'the_title', $title, $id );
158
+	return apply_filters('the_title', $title, $id);
159 159
 }
160 160
 
161 161
 /**
@@ -171,11 +171,11 @@  discard block
 block discarded – undo
171 171
  *
172 172
  * @param int|WP_Post $post Optional. Post ID or post object. Default is global $post.
173 173
  */
174
-function the_guid( $post = 0 ) {
175
-	$post = get_post( $post );
174
+function the_guid($post = 0) {
175
+	$post = get_post($post);
176 176
 
177
-	$guid = isset( $post->guid ) ? get_the_guid( $post ) : '';
178
-	$id   = isset( $post->ID ) ? $post->ID : 0;
177
+	$guid = isset($post->guid) ? get_the_guid($post) : '';
178
+	$id   = isset($post->ID) ? $post->ID : 0;
179 179
 
180 180
 	/**
181 181
 	 * Filters the escaped Global Unique Identifier (guid) of the post.
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
 	 * @param string $guid Escaped Global Unique Identifier (guid) of the post.
188 188
 	 * @param int    $id   The post ID.
189 189
 	 */
190
-	echo apply_filters( 'the_guid', $guid, $id );
190
+	echo apply_filters('the_guid', $guid, $id);
191 191
 }
192 192
 
193 193
 /**
@@ -202,11 +202,11 @@  discard block
 block discarded – undo
202 202
  * @param int|WP_Post $post Optional. Post ID or post object. Default is global $post.
203 203
  * @return string
204 204
  */
205
-function get_the_guid( $post = 0 ) {
206
-	$post = get_post( $post );
205
+function get_the_guid($post = 0) {
206
+	$post = get_post($post);
207 207
 
208
-	$guid = isset( $post->guid ) ? $post->guid : '';
209
-	$id   = isset( $post->ID ) ? $post->ID : 0;
208
+	$guid = isset($post->guid) ? $post->guid : '';
209
+	$id   = isset($post->ID) ? $post->ID : 0;
210 210
 
211 211
 	/**
212 212
 	 * Filters the Global Unique Identifier (guid) of the post.
@@ -216,7 +216,7 @@  discard block
 block discarded – undo
216 216
 	 * @param string $guid Global Unique Identifier (guid) of the post.
217 217
 	 * @param int    $id   The post ID.
218 218
 	 */
219
-	return apply_filters( 'get_the_guid', $guid, $id );
219
+	return apply_filters('get_the_guid', $guid, $id);
220 220
 }
221 221
 
222 222
 /**
@@ -227,8 +227,8 @@  discard block
 block discarded – undo
227 227
  * @param string $more_link_text Optional. Content for when there is more text.
228 228
  * @param bool   $strip_teaser   Optional. Strip teaser content before the more text. Default is false.
229 229
  */
230
-function the_content( $more_link_text = null, $strip_teaser = false) {
231
-	$content = get_the_content( $more_link_text, $strip_teaser );
230
+function the_content($more_link_text = null, $strip_teaser = false) {
231
+	$content = get_the_content($more_link_text, $strip_teaser);
232 232
 
233 233
 	/**
234 234
 	 * Filters the post content.
@@ -237,8 +237,8 @@  discard block
 block discarded – undo
237 237
 	 *
238 238
 	 * @param string $content Content of the current post.
239 239
 	 */
240
-	$content = apply_filters( 'the_content', $content );
241
-	$content = str_replace( ']]>', ']]&gt;', $content );
240
+	$content = apply_filters('the_content', $content);
241
+	$content = str_replace(']]>', ']]&gt;', $content);
242 242
 	echo $content;
243 243
 }
244 244
 
@@ -257,20 +257,20 @@  discard block
 block discarded – undo
257 257
  * @param bool   $strip_teaser   Optional. Strip teaser content before the more text. Default is false.
258 258
  * @return string
259 259
  */
260
-function get_the_content( $more_link_text = null, $strip_teaser = false ) {
260
+function get_the_content($more_link_text = null, $strip_teaser = false) {
261 261
 	global $page, $more, $preview, $pages, $multipage;
262 262
 
263 263
 	$post = get_post();
264 264
 
265
-	if ( null === $more_link_text ) {
265
+	if (null === $more_link_text) {
266 266
 		$more_link_text = sprintf(
267 267
 			'<span aria-label="%1$s">%2$s</span>',
268 268
 			sprintf(
269 269
 				/* translators: %s: Name of current post */
270
-				__( 'Continue reading %s' ),
271
-				the_title_attribute( array( 'echo' => false ) )
270
+				__('Continue reading %s'),
271
+				the_title_attribute(array('echo' => false))
272 272
 			),
273
-			__( '(more&hellip;)' )
273
+			__('(more&hellip;)')
274 274
 		);
275 275
 	}
276 276
 
@@ -278,38 +278,38 @@  discard block
 block discarded – undo
278 278
 	$has_teaser = false;
279 279
 
280 280
 	// If post password required and it doesn't match the cookie.
281
-	if ( post_password_required( $post ) )
282
-		return get_the_password_form( $post );
281
+	if (post_password_required($post))
282
+		return get_the_password_form($post);
283 283
 
284
-	if ( $page > count( $pages ) ) // if the requested page doesn't exist
285
-		$page = count( $pages ); // give them the highest numbered page that DOES exist
284
+	if ($page > count($pages)) // if the requested page doesn't exist
285
+		$page = count($pages); // give them the highest numbered page that DOES exist
286 286
 
287 287
 	$content = $pages[$page - 1];
288
-	if ( preg_match( '/<!--more(.*?)?-->/', $content, $matches ) ) {
289
-		$content = explode( $matches[0], $content, 2 );
290
-		if ( ! empty( $matches[1] ) && ! empty( $more_link_text ) )
291
-			$more_link_text = strip_tags( wp_kses_no_null( trim( $matches[1] ) ) );
288
+	if (preg_match('/<!--more(.*?)?-->/', $content, $matches)) {
289
+		$content = explode($matches[0], $content, 2);
290
+		if ( ! empty($matches[1]) && ! empty($more_link_text))
291
+			$more_link_text = strip_tags(wp_kses_no_null(trim($matches[1])));
292 292
 
293 293
 		$has_teaser = true;
294 294
 	} else {
295
-		$content = array( $content );
295
+		$content = array($content);
296 296
 	}
297 297
 
298
-	if ( false !== strpos( $post->post_content, '<!--noteaser-->' ) && ( ! $multipage || $page == 1 ) )
298
+	if (false !== strpos($post->post_content, '<!--noteaser-->') && ( ! $multipage || $page == 1))
299 299
 		$strip_teaser = true;
300 300
 
301 301
 	$teaser = $content[0];
302 302
 
303
-	if ( $more && $strip_teaser && $has_teaser )
303
+	if ($more && $strip_teaser && $has_teaser)
304 304
 		$teaser = '';
305 305
 
306 306
 	$output .= $teaser;
307 307
 
308
-	if ( count( $content ) > 1 ) {
309
-		if ( $more ) {
310
-			$output .= '<span id="more-' . $post->ID . '"></span>' . $content[1];
308
+	if (count($content) > 1) {
309
+		if ($more) {
310
+			$output .= '<span id="more-'.$post->ID.'"></span>'.$content[1];
311 311
 		} else {
312
-			if ( ! empty( $more_link_text ) )
312
+			if ( ! empty($more_link_text))
313 313
 
314 314
 				/**
315 315
 				 * Filters the Read More link text.
@@ -319,13 +319,13 @@  discard block
 block discarded – undo
319 319
 				 * @param string $more_link_element Read More link element.
320 320
 				 * @param string $more_link_text    Read More text.
321 321
 				 */
322
-				$output .= apply_filters( 'the_content_more_link', ' <a href="' . get_permalink() . "#more-{$post->ID}\" class=\"more-link\">$more_link_text</a>", $more_link_text );
323
-			$output = force_balance_tags( $output );
322
+				$output .= apply_filters('the_content_more_link', ' <a href="'.get_permalink()."#more-{$post->ID}\" class=\"more-link\">$more_link_text</a>", $more_link_text);
323
+			$output = force_balance_tags($output);
324 324
 		}
325 325
 	}
326 326
 
327
-	if ( $preview ) // Preview fix for JavaScript bug with foreign languages.
328
-		$output =	preg_replace_callback( '/\%u([0-9A-F]{4})/', '_convert_urlencoded_to_entities', $output );
327
+	if ($preview) // Preview fix for JavaScript bug with foreign languages.
328
+		$output = preg_replace_callback('/\%u([0-9A-F]{4})/', '_convert_urlencoded_to_entities', $output);
329 329
 
330 330
 	return $output;
331 331
 }
@@ -339,8 +339,8 @@  discard block
 block discarded – undo
339 339
  * @param array $match Match array from preg_replace_callback.
340 340
  * @return string
341 341
  */
342
-function _convert_urlencoded_to_entities( $match ) {
343
-	return '&#' . base_convert( $match[1], 16, 10 ) . ';';
342
+function _convert_urlencoded_to_entities($match) {
343
+	return '&#'.base_convert($match[1], 16, 10).';';
344 344
 }
345 345
 
346 346
 /**
@@ -359,7 +359,7 @@  discard block
 block discarded – undo
359 359
 	 *
360 360
 	 * @param string $post_excerpt The post excerpt.
361 361
 	 */
362
-	echo apply_filters( 'the_excerpt', get_the_excerpt() );
362
+	echo apply_filters('the_excerpt', get_the_excerpt());
363 363
 }
364 364
 
365 365
 /**
@@ -371,18 +371,18 @@  discard block
 block discarded – undo
371 371
  * @param int|WP_Post $post Optional. Post ID or WP_Post object. Default is global $post.
372 372
  * @return string Post excerpt.
373 373
  */
374
-function get_the_excerpt( $post = null ) {
375
-	if ( is_bool( $post ) ) {
376
-		_deprecated_argument( __FUNCTION__, '2.3.0' );
374
+function get_the_excerpt($post = null) {
375
+	if (is_bool($post)) {
376
+		_deprecated_argument(__FUNCTION__, '2.3.0');
377 377
 	}
378 378
 
379
-	$post = get_post( $post );
380
-	if ( empty( $post ) ) {
379
+	$post = get_post($post);
380
+	if (empty($post)) {
381 381
 		return '';
382 382
 	}
383 383
 
384
-	if ( post_password_required( $post ) ) {
385
-		return __( 'There is no excerpt because this is a protected post.' );
384
+	if (post_password_required($post)) {
385
+		return __('There is no excerpt because this is a protected post.');
386 386
 	}
387 387
 
388 388
 	/**
@@ -394,7 +394,7 @@  discard block
 block discarded – undo
394 394
 	 * @param string $post_excerpt The post excerpt.
395 395
 	 * @param WP_Post $post Post object.
396 396
 	 */
397
-	return apply_filters( 'get_the_excerpt', $post->post_excerpt, $post );
397
+	return apply_filters('get_the_excerpt', $post->post_excerpt, $post);
398 398
 }
399 399
 
400 400
 /**
@@ -405,9 +405,9 @@  discard block
 block discarded – undo
405 405
  * @param int|WP_Post $post Optional. Post ID or WP_Post object. Default is global $post.
406 406
  * @return bool True if the post has a custom excerpt, false otherwise.
407 407
  */
408
-function has_excerpt( $post = 0 ) {
409
-	$post = get_post( $post );
410
-	return ( !empty( $post->post_excerpt ) );
408
+function has_excerpt($post = 0) {
409
+	$post = get_post($post);
410
+	return ( ! empty($post->post_excerpt));
411 411
 }
412 412
 
413 413
 /**
@@ -418,9 +418,9 @@  discard block
 block discarded – undo
418 418
  * @param string|array $class   One or more classes to add to the class list.
419 419
  * @param int|WP_Post  $post_id Optional. Post ID or post object. Defaults to the global `$post`.
420 420
  */
421
-function post_class( $class = '', $post_id = null ) {
421
+function post_class($class = '', $post_id = null) {
422 422
 	// Separates classes with a single space, collates classes for post DIV
423
-	echo 'class="' . join( ' ', get_post_class( $class, $post_id ) ) . '"';
423
+	echo 'class="'.join(' ', get_post_class($class, $post_id)).'"';
424 424
 }
425 425
 
426 426
 /**
@@ -444,60 +444,60 @@  discard block
 block discarded – undo
444 444
  * @param int|WP_Post  $post_id Optional. Post ID or post object.
445 445
  * @return array Array of classes.
446 446
  */
447
-function get_post_class( $class = '', $post_id = null ) {
448
-	$post = get_post( $post_id );
447
+function get_post_class($class = '', $post_id = null) {
448
+	$post = get_post($post_id);
449 449
 
450 450
 	$classes = array();
451 451
 
452
-	if ( $class ) {
453
-		if ( ! is_array( $class ) ) {
454
-			$class = preg_split( '#\s+#', $class );
452
+	if ($class) {
453
+		if ( ! is_array($class)) {
454
+			$class = preg_split('#\s+#', $class);
455 455
 		}
456
-		$classes = array_map( 'esc_attr', $class );
456
+		$classes = array_map('esc_attr', $class);
457 457
 	} else {
458 458
 		// Ensure that we always coerce class to being an array.
459 459
 		$class = array();
460 460
 	}
461 461
 
462
-	if ( ! $post ) {
462
+	if ( ! $post) {
463 463
 		return $classes;
464 464
 	}
465 465
 
466
-	$classes[] = 'post-' . $post->ID;
467
-	if ( ! is_admin() )
466
+	$classes[] = 'post-'.$post->ID;
467
+	if ( ! is_admin())
468 468
 		$classes[] = $post->post_type;
469
-	$classes[] = 'type-' . $post->post_type;
470
-	$classes[] = 'status-' . $post->post_status;
469
+	$classes[] = 'type-'.$post->post_type;
470
+	$classes[] = 'status-'.$post->post_status;
471 471
 
472 472
 	// Post Format
473
-	if ( post_type_supports( $post->post_type, 'post-formats' ) ) {
474
-		$post_format = get_post_format( $post->ID );
473
+	if (post_type_supports($post->post_type, 'post-formats')) {
474
+		$post_format = get_post_format($post->ID);
475 475
 
476
-		if ( $post_format && !is_wp_error($post_format) )
477
-			$classes[] = 'format-' . sanitize_html_class( $post_format );
476
+		if ($post_format && ! is_wp_error($post_format))
477
+			$classes[] = 'format-'.sanitize_html_class($post_format);
478 478
 		else
479 479
 			$classes[] = 'format-standard';
480 480
 	}
481 481
 
482
-	$post_password_required = post_password_required( $post->ID );
482
+	$post_password_required = post_password_required($post->ID);
483 483
 
484 484
 	// Post requires password.
485
-	if ( $post_password_required ) {
485
+	if ($post_password_required) {
486 486
 		$classes[] = 'post-password-required';
487
-	} elseif ( ! empty( $post->post_password ) ) {
487
+	} elseif ( ! empty($post->post_password)) {
488 488
 		$classes[] = 'post-password-protected';
489 489
 	}
490 490
 
491 491
 	// Post thumbnails.
492
-	if ( current_theme_supports( 'post-thumbnails' ) && has_post_thumbnail( $post->ID ) && ! is_attachment( $post ) && ! $post_password_required ) {
492
+	if (current_theme_supports('post-thumbnails') && has_post_thumbnail($post->ID) && ! is_attachment($post) && ! $post_password_required) {
493 493
 		$classes[] = 'has-post-thumbnail';
494 494
 	}
495 495
 
496 496
 	// sticky for Sticky Posts
497
-	if ( is_sticky( $post->ID ) ) {
498
-		if ( is_home() && ! is_paged() ) {
497
+	if (is_sticky($post->ID)) {
498
+		if (is_home() && ! is_paged()) {
499 499
 			$classes[] = 'sticky';
500
-		} elseif ( is_admin() ) {
500
+		} elseif (is_admin()) {
501 501
 			$classes[] = 'status-sticky';
502 502
 		}
503 503
 	}
@@ -506,30 +506,30 @@  discard block
 block discarded – undo
506 506
 	$classes[] = 'hentry';
507 507
 
508 508
 	// All public taxonomies
509
-	$taxonomies = get_taxonomies( array( 'public' => true ) );
510
-	foreach ( (array) $taxonomies as $taxonomy ) {
511
-		if ( is_object_in_taxonomy( $post->post_type, $taxonomy ) ) {
512
-			foreach ( (array) get_the_terms( $post->ID, $taxonomy ) as $term ) {
513
-				if ( empty( $term->slug ) ) {
509
+	$taxonomies = get_taxonomies(array('public' => true));
510
+	foreach ((array) $taxonomies as $taxonomy) {
511
+		if (is_object_in_taxonomy($post->post_type, $taxonomy)) {
512
+			foreach ((array) get_the_terms($post->ID, $taxonomy) as $term) {
513
+				if (empty($term->slug)) {
514 514
 					continue;
515 515
 				}
516 516
 
517
-				$term_class = sanitize_html_class( $term->slug, $term->term_id );
518
-				if ( is_numeric( $term_class ) || ! trim( $term_class, '-' ) ) {
517
+				$term_class = sanitize_html_class($term->slug, $term->term_id);
518
+				if (is_numeric($term_class) || ! trim($term_class, '-')) {
519 519
 					$term_class = $term->term_id;
520 520
 				}
521 521
 
522 522
 				// 'post_tag' uses the 'tag' prefix for backward compatibility.
523
-				if ( 'post_tag' == $taxonomy ) {
524
-					$classes[] = 'tag-' . $term_class;
523
+				if ('post_tag' == $taxonomy) {
524
+					$classes[] = 'tag-'.$term_class;
525 525
 				} else {
526
-					$classes[] = sanitize_html_class( $taxonomy . '-' . $term_class, $taxonomy . '-' . $term->term_id );
526
+					$classes[] = sanitize_html_class($taxonomy.'-'.$term_class, $taxonomy.'-'.$term->term_id);
527 527
 				}
528 528
 			}
529 529
 		}
530 530
 	}
531 531
 
532
-	$classes = array_map( 'esc_attr', $classes );
532
+	$classes = array_map('esc_attr', $classes);
533 533
 
534 534
 	/**
535 535
 	 * Filters the list of CSS classes for the current post.
@@ -540,9 +540,9 @@  discard block
 block discarded – undo
540 540
 	 * @param array $class   An array of additional classes added to the post.
541 541
 	 * @param int   $post_id The post ID.
542 542
 	 */
543
-	$classes = apply_filters( 'post_class', $classes, $class, $post->ID );
543
+	$classes = apply_filters('post_class', $classes, $class, $post->ID);
544 544
 
545
-	return array_unique( $classes );
545
+	return array_unique($classes);
546 546
 }
547 547
 
548 548
 /**
@@ -552,9 +552,9 @@  discard block
 block discarded – undo
552 552
  *
553 553
  * @param string|array $class One or more classes to add to the class list.
554 554
  */
555
-function body_class( $class = '' ) {
555
+function body_class($class = '') {
556 556
 	// Separates classes with a single space, collates classes for body element
557
-	echo 'class="' . join( ' ', get_body_class( $class ) ) . '"';
557
+	echo 'class="'.join(' ', get_body_class($class)).'"';
558 558
 }
559 559
 
560 560
 /**
@@ -567,197 +567,197 @@  discard block
 block discarded – undo
567 567
  * @param string|array $class One or more classes to add to the class list.
568 568
  * @return array Array of classes.
569 569
  */
570
-function get_body_class( $class = '' ) {
570
+function get_body_class($class = '') {
571 571
 	global $wp_query;
572 572
 
573 573
 	$classes = array();
574 574
 
575
-	if ( is_rtl() )
575
+	if (is_rtl())
576 576
 		$classes[] = 'rtl';
577 577
 
578
-	if ( is_front_page() )
578
+	if (is_front_page())
579 579
 		$classes[] = 'home';
580
-	if ( is_home() )
580
+	if (is_home())
581 581
 		$classes[] = 'blog';
582
-	if ( is_archive() )
582
+	if (is_archive())
583 583
 		$classes[] = 'archive';
584
-	if ( is_date() )
584
+	if (is_date())
585 585
 		$classes[] = 'date';
586
-	if ( is_search() ) {
586
+	if (is_search()) {
587 587
 		$classes[] = 'search';
588 588
 		$classes[] = $wp_query->posts ? 'search-results' : 'search-no-results';
589 589
 	}
590
-	if ( is_paged() )
590
+	if (is_paged())
591 591
 		$classes[] = 'paged';
592
-	if ( is_attachment() )
592
+	if (is_attachment())
593 593
 		$classes[] = 'attachment';
594
-	if ( is_404() )
594
+	if (is_404())
595 595
 		$classes[] = 'error404';
596 596
 
597
-	if ( is_singular() ) {
597
+	if (is_singular()) {
598 598
 		$post_id = $wp_query->get_queried_object_id();
599 599
 		$post = $wp_query->get_queried_object();
600 600
 		$post_type = $post->post_type;
601 601
 
602
-		if ( is_page_template() ) {
602
+		if (is_page_template()) {
603 603
 			$classes[] = "{$post_type}-template";
604 604
 
605
-			$template_slug  = get_page_template_slug( $post_id );
606
-			$template_parts = explode( '/', $template_slug );
605
+			$template_slug  = get_page_template_slug($post_id);
606
+			$template_parts = explode('/', $template_slug);
607 607
 
608
-			foreach ( $template_parts as $part ) {
609
-				$classes[] = "{$post_type}-template-" . sanitize_html_class( str_replace( array( '.', '/' ), '-', basename( $part, '.php' ) ) );
608
+			foreach ($template_parts as $part) {
609
+				$classes[] = "{$post_type}-template-".sanitize_html_class(str_replace(array('.', '/'), '-', basename($part, '.php')));
610 610
 			}
611
-			$classes[] = "{$post_type}-template-" . sanitize_html_class( str_replace( '.', '-', $template_slug ) );
611
+			$classes[] = "{$post_type}-template-".sanitize_html_class(str_replace('.', '-', $template_slug));
612 612
 		} else {
613 613
 			$classes[] = "{$post_type}-template-default";
614 614
 		}
615 615
 
616
-		if ( is_single() ) {
616
+		if (is_single()) {
617 617
 			$classes[] = 'single';
618
-			if ( isset( $post->post_type ) ) {
619
-				$classes[] = 'single-' . sanitize_html_class( $post->post_type, $post_id );
620
-				$classes[] = 'postid-' . $post_id;
618
+			if (isset($post->post_type)) {
619
+				$classes[] = 'single-'.sanitize_html_class($post->post_type, $post_id);
620
+				$classes[] = 'postid-'.$post_id;
621 621
 
622 622
 				// Post Format
623
-				if ( post_type_supports( $post->post_type, 'post-formats' ) ) {
624
-					$post_format = get_post_format( $post->ID );
623
+				if (post_type_supports($post->post_type, 'post-formats')) {
624
+					$post_format = get_post_format($post->ID);
625 625
 
626
-					if ( $post_format && !is_wp_error($post_format) )
627
-						$classes[] = 'single-format-' . sanitize_html_class( $post_format );
626
+					if ($post_format && ! is_wp_error($post_format))
627
+						$classes[] = 'single-format-'.sanitize_html_class($post_format);
628 628
 					else
629 629
 						$classes[] = 'single-format-standard';
630 630
 				}
631 631
 			}
632 632
 		}
633 633
 
634
-		if ( is_attachment() ) {
634
+		if (is_attachment()) {
635 635
 			$mime_type = get_post_mime_type($post_id);
636
-			$mime_prefix = array( 'application/', 'image/', 'text/', 'audio/', 'video/', 'music/' );
637
-			$classes[] = 'attachmentid-' . $post_id;
638
-			$classes[] = 'attachment-' . str_replace( $mime_prefix, '', $mime_type );
639
-		} elseif ( is_page() ) {
636
+			$mime_prefix = array('application/', 'image/', 'text/', 'audio/', 'video/', 'music/');
637
+			$classes[] = 'attachmentid-'.$post_id;
638
+			$classes[] = 'attachment-'.str_replace($mime_prefix, '', $mime_type);
639
+		} elseif (is_page()) {
640 640
 			$classes[] = 'page';
641 641
 
642 642
 			$page_id = $wp_query->get_queried_object_id();
643 643
 
644 644
 			$post = get_post($page_id);
645 645
 
646
-			$classes[] = 'page-id-' . $page_id;
646
+			$classes[] = 'page-id-'.$page_id;
647 647
 
648
-			if ( get_pages( array( 'parent' => $page_id, 'number' => 1 ) ) ) {
648
+			if (get_pages(array('parent' => $page_id, 'number' => 1))) {
649 649
 				$classes[] = 'page-parent';
650 650
 			}
651 651
 
652
-			if ( $post->post_parent ) {
652
+			if ($post->post_parent) {
653 653
 				$classes[] = 'page-child';
654
-				$classes[] = 'parent-pageid-' . $post->post_parent;
654
+				$classes[] = 'parent-pageid-'.$post->post_parent;
655 655
 			}
656 656
 		}
657
-	} elseif ( is_archive() ) {
658
-		if ( is_post_type_archive() ) {
657
+	} elseif (is_archive()) {
658
+		if (is_post_type_archive()) {
659 659
 			$classes[] = 'post-type-archive';
660
-			$post_type = get_query_var( 'post_type' );
661
-			if ( is_array( $post_type ) )
662
-				$post_type = reset( $post_type );
663
-			$classes[] = 'post-type-archive-' . sanitize_html_class( $post_type );
664
-		} elseif ( is_author() ) {
660
+			$post_type = get_query_var('post_type');
661
+			if (is_array($post_type))
662
+				$post_type = reset($post_type);
663
+			$classes[] = 'post-type-archive-'.sanitize_html_class($post_type);
664
+		} elseif (is_author()) {
665 665
 			$author = $wp_query->get_queried_object();
666 666
 			$classes[] = 'author';
667
-			if ( isset( $author->user_nicename ) ) {
668
-				$classes[] = 'author-' . sanitize_html_class( $author->user_nicename, $author->ID );
669
-				$classes[] = 'author-' . $author->ID;
667
+			if (isset($author->user_nicename)) {
668
+				$classes[] = 'author-'.sanitize_html_class($author->user_nicename, $author->ID);
669
+				$classes[] = 'author-'.$author->ID;
670 670
 			}
671
-		} elseif ( is_category() ) {
671
+		} elseif (is_category()) {
672 672
 			$cat = $wp_query->get_queried_object();
673 673
 			$classes[] = 'category';
674
-			if ( isset( $cat->term_id ) ) {
675
-				$cat_class = sanitize_html_class( $cat->slug, $cat->term_id );
676
-				if ( is_numeric( $cat_class ) || ! trim( $cat_class, '-' ) ) {
674
+			if (isset($cat->term_id)) {
675
+				$cat_class = sanitize_html_class($cat->slug, $cat->term_id);
676
+				if (is_numeric($cat_class) || ! trim($cat_class, '-')) {
677 677
 					$cat_class = $cat->term_id;
678 678
 				}
679 679
 
680
-				$classes[] = 'category-' . $cat_class;
681
-				$classes[] = 'category-' . $cat->term_id;
680
+				$classes[] = 'category-'.$cat_class;
681
+				$classes[] = 'category-'.$cat->term_id;
682 682
 			}
683
-		} elseif ( is_tag() ) {
683
+		} elseif (is_tag()) {
684 684
 			$tag = $wp_query->get_queried_object();
685 685
 			$classes[] = 'tag';
686
-			if ( isset( $tag->term_id ) ) {
687
-				$tag_class = sanitize_html_class( $tag->slug, $tag->term_id );
688
-				if ( is_numeric( $tag_class ) || ! trim( $tag_class, '-' ) ) {
686
+			if (isset($tag->term_id)) {
687
+				$tag_class = sanitize_html_class($tag->slug, $tag->term_id);
688
+				if (is_numeric($tag_class) || ! trim($tag_class, '-')) {
689 689
 					$tag_class = $tag->term_id;
690 690
 				}
691 691
 
692
-				$classes[] = 'tag-' . $tag_class;
693
-				$classes[] = 'tag-' . $tag->term_id;
692
+				$classes[] = 'tag-'.$tag_class;
693
+				$classes[] = 'tag-'.$tag->term_id;
694 694
 			}
695
-		} elseif ( is_tax() ) {
695
+		} elseif (is_tax()) {
696 696
 			$term = $wp_query->get_queried_object();
697
-			if ( isset( $term->term_id ) ) {
698
-				$term_class = sanitize_html_class( $term->slug, $term->term_id );
699
-				if ( is_numeric( $term_class ) || ! trim( $term_class, '-' ) ) {
697
+			if (isset($term->term_id)) {
698
+				$term_class = sanitize_html_class($term->slug, $term->term_id);
699
+				if (is_numeric($term_class) || ! trim($term_class, '-')) {
700 700
 					$term_class = $term->term_id;
701 701
 				}
702 702
 
703
-				$classes[] = 'tax-' . sanitize_html_class( $term->taxonomy );
704
-				$classes[] = 'term-' . $term_class;
705
-				$classes[] = 'term-' . $term->term_id;
703
+				$classes[] = 'tax-'.sanitize_html_class($term->taxonomy);
704
+				$classes[] = 'term-'.$term_class;
705
+				$classes[] = 'term-'.$term->term_id;
706 706
 			}
707 707
 		}
708 708
 	}
709 709
 
710
-	if ( is_user_logged_in() )
710
+	if (is_user_logged_in())
711 711
 		$classes[] = 'logged-in';
712 712
 
713
-	if ( is_admin_bar_showing() ) {
713
+	if (is_admin_bar_showing()) {
714 714
 		$classes[] = 'admin-bar';
715 715
 		$classes[] = 'no-customize-support';
716 716
 	}
717 717
 
718
-	if ( get_background_color() !== get_theme_support( 'custom-background', 'default-color' ) || get_background_image() )
718
+	if (get_background_color() !== get_theme_support('custom-background', 'default-color') || get_background_image())
719 719
 		$classes[] = 'custom-background';
720 720
 
721
-	if ( has_custom_logo() ) {
721
+	if (has_custom_logo()) {
722 722
 		$classes[] = 'wp-custom-logo';
723 723
 	}
724 724
 
725
-	$page = $wp_query->get( 'page' );
726
-
727
-	if ( ! $page || $page < 2 )
728
-		$page = $wp_query->get( 'paged' );
729
-
730
-	if ( $page && $page > 1 && ! is_404() ) {
731
-		$classes[] = 'paged-' . $page;
732
-
733
-		if ( is_single() )
734
-			$classes[] = 'single-paged-' . $page;
735
-		elseif ( is_page() )
736
-			$classes[] = 'page-paged-' . $page;
737
-		elseif ( is_category() )
738
-			$classes[] = 'category-paged-' . $page;
739
-		elseif ( is_tag() )
740
-			$classes[] = 'tag-paged-' . $page;
741
-		elseif ( is_date() )
742
-			$classes[] = 'date-paged-' . $page;
743
-		elseif ( is_author() )
744
-			$classes[] = 'author-paged-' . $page;
745
-		elseif ( is_search() )
746
-			$classes[] = 'search-paged-' . $page;
747
-		elseif ( is_post_type_archive() )
748
-			$classes[] = 'post-type-paged-' . $page;
725
+	$page = $wp_query->get('page');
726
+
727
+	if ( ! $page || $page < 2)
728
+		$page = $wp_query->get('paged');
729
+
730
+	if ($page && $page > 1 && ! is_404()) {
731
+		$classes[] = 'paged-'.$page;
732
+
733
+		if (is_single())
734
+			$classes[] = 'single-paged-'.$page;
735
+		elseif (is_page())
736
+			$classes[] = 'page-paged-'.$page;
737
+		elseif (is_category())
738
+			$classes[] = 'category-paged-'.$page;
739
+		elseif (is_tag())
740
+			$classes[] = 'tag-paged-'.$page;
741
+		elseif (is_date())
742
+			$classes[] = 'date-paged-'.$page;
743
+		elseif (is_author())
744
+			$classes[] = 'author-paged-'.$page;
745
+		elseif (is_search())
746
+			$classes[] = 'search-paged-'.$page;
747
+		elseif (is_post_type_archive())
748
+			$classes[] = 'post-type-paged-'.$page;
749 749
 	}
750 750
 
751
-	if ( ! empty( $class ) ) {
752
-		if ( !is_array( $class ) )
753
-			$class = preg_split( '#\s+#', $class );
754
-		$classes = array_merge( $classes, $class );
751
+	if ( ! empty($class)) {
752
+		if ( ! is_array($class))
753
+			$class = preg_split('#\s+#', $class);
754
+		$classes = array_merge($classes, $class);
755 755
 	} else {
756 756
 		// Ensure that we always coerce class to being an array.
757 757
 		$class = array();
758 758
 	}
759 759
 
760
-	$classes = array_map( 'esc_attr', $classes );
760
+	$classes = array_map('esc_attr', $classes);
761 761
 
762 762
 	/**
763 763
 	 * Filters the list of CSS body classes for the current post or page.
@@ -767,9 +767,9 @@  discard block
 block discarded – undo
767 767
 	 * @param array $classes An array of body classes.
768 768
 	 * @param array $class   An array of additional classes added to the body.
769 769
 	 */
770
-	$classes = apply_filters( 'body_class', $classes, $class );
770
+	$classes = apply_filters('body_class', $classes, $class);
771 771
 
772
-	return array_unique( $classes );
772
+	return array_unique($classes);
773 773
 }
774 774
 
775 775
 /**
@@ -780,27 +780,27 @@  discard block
 block discarded – undo
780 780
  * @param int|WP_Post|null $post An optional post. Global $post used if not provided.
781 781
  * @return bool false if a password is not required or the correct password cookie is present, true otherwise.
782 782
  */
783
-function post_password_required( $post = null ) {
783
+function post_password_required($post = null) {
784 784
 	$post = get_post($post);
785 785
 
786
-	if ( empty( $post->post_password ) ) {
786
+	if (empty($post->post_password)) {
787 787
 		/** This filter is documented in wp-includes/post.php */
788
-		return apply_filters( 'post_password_required', false, $post );
788
+		return apply_filters('post_password_required', false, $post);
789 789
 	}
790 790
 
791
-	if ( ! isset( $_COOKIE[ 'wp-postpass_' . COOKIEHASH ] ) ) {
791
+	if ( ! isset($_COOKIE['wp-postpass_'.COOKIEHASH])) {
792 792
 		/** This filter is documented in wp-includes/post.php */
793
-		return apply_filters( 'post_password_required', true, $post );
793
+		return apply_filters('post_password_required', true, $post);
794 794
 	}
795 795
 
796
-	require_once ABSPATH . WPINC . '/class-phpass.php';
797
-	$hasher = new PasswordHash( 8, true );
796
+	require_once ABSPATH.WPINC.'/class-phpass.php';
797
+	$hasher = new PasswordHash(8, true);
798 798
 
799
-	$hash = wp_unslash( $_COOKIE[ 'wp-postpass_' . COOKIEHASH ] );
800
-	if ( 0 !== strpos( $hash, '$P$B' ) ) {
799
+	$hash = wp_unslash($_COOKIE['wp-postpass_'.COOKIEHASH]);
800
+	if (0 !== strpos($hash, '$P$B')) {
801 801
 		$required = true;
802 802
 	} else {
803
-		$required = ! $hasher->CheckPassword( $post->post_password, $hash );
803
+		$required = ! $hasher->CheckPassword($post->post_password, $hash);
804 804
 	}
805 805
 
806 806
 	/**
@@ -812,7 +812,7 @@  discard block
 block discarded – undo
812 812
 	 *                          provided or is incorrect, false if password has been supplied or is not required.
813 813
 	 * @param WP_Post $post     Post data.
814 814
 	 */
815
-	return apply_filters( 'post_password_required', $required, $post );
815
+	return apply_filters('post_password_required', $required, $post);
816 816
 }
817 817
 
818 818
 //
@@ -853,23 +853,23 @@  discard block
 block discarded – undo
853 853
  * }
854 854
  * @return string Formatted output in HTML.
855 855
  */
856
-function wp_link_pages( $args = '' ) {
856
+function wp_link_pages($args = '') {
857 857
 	global $page, $numpages, $multipage, $more;
858 858
 
859 859
 	$defaults = array(
860
-		'before'           => '<p>' . __( 'Pages:' ),
860
+		'before'           => '<p>'.__('Pages:'),
861 861
 		'after'            => '</p>',
862 862
 		'link_before'      => '',
863 863
 		'link_after'       => '',
864 864
 		'next_or_number'   => 'number',
865 865
 		'separator'        => ' ',
866
-		'nextpagelink'     => __( 'Next page' ),
867
-		'previouspagelink' => __( 'Previous page' ),
866
+		'nextpagelink'     => __('Next page'),
867
+		'previouspagelink' => __('Previous page'),
868 868
 		'pagelink'         => '%',
869 869
 		'echo'             => 1
870 870
 	);
871 871
 
872
-	$params = wp_parse_args( $args, $defaults );
872
+	$params = wp_parse_args($args, $defaults);
873 873
 
874 874
 	/**
875 875
 	 * Filters the arguments used in retrieving page links for paginated posts.
@@ -878,16 +878,16 @@  discard block
 block discarded – undo
878 878
 	 *
879 879
 	 * @param array $params An array of arguments for page links for paginated posts.
880 880
 	 */
881
-	$r = apply_filters( 'wp_link_pages_args', $params );
881
+	$r = apply_filters('wp_link_pages_args', $params);
882 882
 
883 883
 	$output = '';
884
-	if ( $multipage ) {
885
-		if ( 'number' == $r['next_or_number'] ) {
884
+	if ($multipage) {
885
+		if ('number' == $r['next_or_number']) {
886 886
 			$output .= $r['before'];
887
-			for ( $i = 1; $i <= $numpages; $i++ ) {
888
-				$link = $r['link_before'] . str_replace( '%', $i, $r['pagelink'] ) . $r['link_after'];
889
-				if ( $i != $page || ! $more && 1 == $page ) {
890
-					$link = _wp_link_page( $i ) . $link . '</a>';
887
+			for ($i = 1; $i <= $numpages; $i++) {
888
+				$link = $r['link_before'].str_replace('%', $i, $r['pagelink']).$r['link_after'];
889
+				if ($i != $page || ! $more && 1 == $page) {
890
+					$link = _wp_link_page($i).$link.'</a>';
891 891
 				}
892 892
 				/**
893 893
 				 * Filters the HTML output of individual page number links.
@@ -897,31 +897,31 @@  discard block
 block discarded – undo
897 897
 				 * @param string $link The page number HTML output.
898 898
 				 * @param int    $i    Page number for paginated posts' page links.
899 899
 				 */
900
-				$link = apply_filters( 'wp_link_pages_link', $link, $i );
900
+				$link = apply_filters('wp_link_pages_link', $link, $i);
901 901
 
902 902
 				// Use the custom links separator beginning with the second link.
903
-				$output .= ( 1 === $i ) ? ' ' : $r['separator'];
903
+				$output .= (1 === $i) ? ' ' : $r['separator'];
904 904
 				$output .= $link;
905 905
 			}
906 906
 			$output .= $r['after'];
907
-		} elseif ( $more ) {
907
+		} elseif ($more) {
908 908
 			$output .= $r['before'];
909 909
 			$prev = $page - 1;
910
-			if ( $prev > 0 ) {
911
-				$link = _wp_link_page( $prev ) . $r['link_before'] . $r['previouspagelink'] . $r['link_after'] . '</a>';
910
+			if ($prev > 0) {
911
+				$link = _wp_link_page($prev).$r['link_before'].$r['previouspagelink'].$r['link_after'].'</a>';
912 912
 
913 913
 				/** This filter is documented in wp-includes/post-template.php */
914
-				$output .= apply_filters( 'wp_link_pages_link', $link, $prev );
914
+				$output .= apply_filters('wp_link_pages_link', $link, $prev);
915 915
 			}
916 916
 			$next = $page + 1;
917
-			if ( $next <= $numpages ) {
918
-				if ( $prev ) {
917
+			if ($next <= $numpages) {
918
+				if ($prev) {
919 919
 					$output .= $r['separator'];
920 920
 				}
921
-				$link = _wp_link_page( $next ) . $r['link_before'] . $r['nextpagelink'] . $r['link_after'] . '</a>';
921
+				$link = _wp_link_page($next).$r['link_before'].$r['nextpagelink'].$r['link_after'].'</a>';
922 922
 
923 923
 				/** This filter is documented in wp-includes/post-template.php */
924
-				$output .= apply_filters( 'wp_link_pages_link', $link, $next );
924
+				$output .= apply_filters('wp_link_pages_link', $link, $next);
925 925
 			}
926 926
 			$output .= $r['after'];
927 927
 		}
@@ -935,9 +935,9 @@  discard block
 block discarded – undo
935 935
 	 * @param string $output HTML output of paginated posts' page links.
936 936
 	 * @param array  $args   An array of arguments.
937 937
 	 */
938
-	$html = apply_filters( 'wp_link_pages', $output, $args );
938
+	$html = apply_filters('wp_link_pages', $output, $args);
939 939
 
940
-	if ( $r['echo'] ) {
940
+	if ($r['echo']) {
941 941
 		echo $html;
942 942
 	}
943 943
 	return $html;
@@ -954,33 +954,33 @@  discard block
 block discarded – undo
954 954
  * @param int $i Page number.
955 955
  * @return string Link.
956 956
  */
957
-function _wp_link_page( $i ) {
957
+function _wp_link_page($i) {
958 958
 	global $wp_rewrite;
959 959
 	$post = get_post();
960 960
 	$query_args = array();
961 961
 
962
-	if ( 1 == $i ) {
962
+	if (1 == $i) {
963 963
 		$url = get_permalink();
964 964
 	} else {
965
-		if ( '' == get_option('permalink_structure') || in_array($post->post_status, array('draft', 'pending')) )
966
-			$url = add_query_arg( 'page', $i, get_permalink() );
967
-		elseif ( 'page' == get_option('show_on_front') && get_option('page_on_front') == $post->ID )
968
-			$url = trailingslashit(get_permalink()) . user_trailingslashit("$wp_rewrite->pagination_base/" . $i, 'single_paged');
965
+		if ('' == get_option('permalink_structure') || in_array($post->post_status, array('draft', 'pending')))
966
+			$url = add_query_arg('page', $i, get_permalink());
967
+		elseif ('page' == get_option('show_on_front') && get_option('page_on_front') == $post->ID)
968
+			$url = trailingslashit(get_permalink()).user_trailingslashit("$wp_rewrite->pagination_base/".$i, 'single_paged');
969 969
 		else
970
-			$url = trailingslashit(get_permalink()) . user_trailingslashit($i, 'single_paged');
970
+			$url = trailingslashit(get_permalink()).user_trailingslashit($i, 'single_paged');
971 971
 	}
972 972
 
973
-	if ( is_preview() ) {
973
+	if (is_preview()) {
974 974
 
975
-		if ( ( 'draft' !== $post->post_status ) && isset( $_GET['preview_id'], $_GET['preview_nonce'] ) ) {
976
-			$query_args['preview_id'] = wp_unslash( $_GET['preview_id'] );
977
-			$query_args['preview_nonce'] = wp_unslash( $_GET['preview_nonce'] );
975
+		if (('draft' !== $post->post_status) && isset($_GET['preview_id'], $_GET['preview_nonce'])) {
976
+			$query_args['preview_id'] = wp_unslash($_GET['preview_id']);
977
+			$query_args['preview_nonce'] = wp_unslash($_GET['preview_nonce']);
978 978
 		}
979 979
 
980
-		$url = get_preview_post_link( $post, $query_args, $url );
980
+		$url = get_preview_post_link($post, $query_args, $url);
981 981
 	}
982 982
 
983
-	return '<a href="' . esc_url( $url ) . '">';
983
+	return '<a href="'.esc_url($url).'">';
984 984
 }
985 985
 
986 986
 //
@@ -995,12 +995,12 @@  discard block
 block discarded – undo
995 995
  * @param string $key Meta data key name.
996 996
  * @return false|string|array Array of values or single value, if only one element exists. False will be returned if key does not exist.
997 997
  */
998
-function post_custom( $key = '' ) {
998
+function post_custom($key = '') {
999 999
 	$custom = get_post_custom();
1000 1000
 
1001
-	if ( !isset( $custom[$key] ) )
1001
+	if ( ! isset($custom[$key]))
1002 1002
 		return false;
1003
-	elseif ( 1 == count($custom[$key]) )
1003
+	elseif (1 == count($custom[$key]))
1004 1004
 		return $custom[$key][0];
1005 1005
 	else
1006 1006
 		return $custom[$key];
@@ -1015,14 +1015,14 @@  discard block
 block discarded – undo
1015 1015
  *
1016 1016
  */
1017 1017
 function the_meta() {
1018
-	if ( $keys = get_post_custom_keys() ) {
1018
+	if ($keys = get_post_custom_keys()) {
1019 1019
 		echo "<ul class='post-meta'>\n";
1020
-		foreach ( (array) $keys as $key ) {
1020
+		foreach ((array) $keys as $key) {
1021 1021
 			$keyt = trim($key);
1022
-			if ( is_protected_meta( $keyt, 'post' ) )
1022
+			if (is_protected_meta($keyt, 'post'))
1023 1023
 				continue;
1024 1024
 			$values = array_map('trim', get_post_custom_values($key));
1025
-			$value = implode($values,', ');
1025
+			$value = implode($values, ', ');
1026 1026
 
1027 1027
 			/**
1028 1028
 			 * Filters the HTML output of the li element in the post custom fields list.
@@ -1033,7 +1033,7 @@  discard block
 block discarded – undo
1033 1033
 			 * @param string $key   Meta key.
1034 1034
 			 * @param string $value Meta value.
1035 1035
 			 */
1036
-			echo apply_filters( 'the_meta_key', "<li><span class='post-meta-key'>$key:</span> $value</li>\n", $key, $value );
1036
+			echo apply_filters('the_meta_key', "<li><span class='post-meta-key'>$key:</span> $value</li>\n", $key, $value);
1037 1037
 		}
1038 1038
 		echo "</ul>\n";
1039 1039
 	}
@@ -1071,7 +1071,7 @@  discard block
 block discarded – undo
1071 1071
  * }
1072 1072
  * @return string HTML content, if not displaying.
1073 1073
  */
1074
-function wp_dropdown_pages( $args = '' ) {
1074
+function wp_dropdown_pages($args = '') {
1075 1075
 	$defaults = array(
1076 1076
 		'depth' => 0, 'child_of' => 0,
1077 1077
 		'selected' => 0, 'echo' => 1,
@@ -1082,29 +1082,29 @@  discard block
 block discarded – undo
1082 1082
 		'value_field' => 'ID',
1083 1083
 	);
1084 1084
 
1085
-	$r = wp_parse_args( $args, $defaults );
1085
+	$r = wp_parse_args($args, $defaults);
1086 1086
 
1087
-	$pages = get_pages( $r );
1087
+	$pages = get_pages($r);
1088 1088
 	$output = '';
1089 1089
 	// Back-compat with old system where both id and name were based on $name argument
1090
-	if ( empty( $r['id'] ) ) {
1090
+	if (empty($r['id'])) {
1091 1091
 		$r['id'] = $r['name'];
1092 1092
 	}
1093 1093
 
1094
-	if ( ! empty( $pages ) ) {
1094
+	if ( ! empty($pages)) {
1095 1095
 		$class = '';
1096
-		if ( ! empty( $r['class'] ) ) {
1097
-			$class = " class='" . esc_attr( $r['class'] ) . "'";
1096
+		if ( ! empty($r['class'])) {
1097
+			$class = " class='".esc_attr($r['class'])."'";
1098 1098
 		}
1099 1099
 
1100
-		$output = "<select name='" . esc_attr( $r['name'] ) . "'" . $class . " id='" . esc_attr( $r['id'] ) . "'>\n";
1101
-		if ( $r['show_option_no_change'] ) {
1102
-			$output .= "\t<option value=\"-1\">" . $r['show_option_no_change'] . "</option>\n";
1100
+		$output = "<select name='".esc_attr($r['name'])."'".$class." id='".esc_attr($r['id'])."'>\n";
1101
+		if ($r['show_option_no_change']) {
1102
+			$output .= "\t<option value=\"-1\">".$r['show_option_no_change']."</option>\n";
1103 1103
 		}
1104
-		if ( $r['show_option_none'] ) {
1105
-			$output .= "\t<option value=\"" . esc_attr( $r['option_none_value'] ) . '">' . $r['show_option_none'] . "</option>\n";
1104
+		if ($r['show_option_none']) {
1105
+			$output .= "\t<option value=\"".esc_attr($r['option_none_value']).'">'.$r['show_option_none']."</option>\n";
1106 1106
 		}
1107
-		$output .= walk_page_dropdown_tree( $pages, $r['depth'], $r );
1107
+		$output .= walk_page_dropdown_tree($pages, $r['depth'], $r);
1108 1108
 		$output .= "</select>\n";
1109 1109
 	}
1110 1110
 
@@ -1118,9 +1118,9 @@  discard block
 block discarded – undo
1118 1118
 	 * @param array  $r      The parsed arguments array.
1119 1119
 	 * @param array  $pages  List of WP_Post objects returned by `get_pages()`
1120 1120
  	 */
1121
-	$html = apply_filters( 'wp_dropdown_pages', $output, $r, $pages );
1121
+	$html = apply_filters('wp_dropdown_pages', $output, $r, $pages);
1122 1122
 
1123
-	if ( $r['echo'] ) {
1123
+	if ($r['echo']) {
1124 1124
 		echo $html;
1125 1125
 	}
1126 1126
 	return $html;
@@ -1166,14 +1166,14 @@  discard block
 block discarded – undo
1166 1166
  * }
1167 1167
  * @return string|void HTML list of pages.
1168 1168
  */
1169
-function wp_list_pages( $args = '' ) {
1169
+function wp_list_pages($args = '') {
1170 1170
 	$defaults = array(
1171 1171
 		'depth'        => 0,
1172 1172
 		'show_date'    => '',
1173
-		'date_format'  => get_option( 'date_format' ),
1173
+		'date_format'  => get_option('date_format'),
1174 1174
 		'child_of'     => 0,
1175 1175
 		'exclude'      => '',
1176
-		'title_li'     => __( 'Pages' ),
1176
+		'title_li'     => __('Pages'),
1177 1177
 		'echo'         => 1,
1178 1178
 		'authors'      => '',
1179 1179
 		'sort_column'  => 'menu_order, post_title',
@@ -1183,9 +1183,9 @@  discard block
 block discarded – undo
1183 1183
 		'walker'       => '',
1184 1184
 	);
1185 1185
 
1186
-	$r = wp_parse_args( $args, $defaults );
1186
+	$r = wp_parse_args($args, $defaults);
1187 1187
 
1188
-	if ( ! in_array( $r['item_spacing'], array( 'preserve', 'discard' ), true ) ) {
1188
+	if ( ! in_array($r['item_spacing'], array('preserve', 'discard'), true)) {
1189 1189
 		// invalid value, fall back to default.
1190 1190
 		$r['item_spacing'] = $defaults['item_spacing'];
1191 1191
 	}
@@ -1194,10 +1194,10 @@  discard block
 block discarded – undo
1194 1194
 	$current_page = 0;
1195 1195
 
1196 1196
 	// sanitize, mostly to keep spaces out
1197
-	$r['exclude'] = preg_replace( '/[^0-9,]/', '', $r['exclude'] );
1197
+	$r['exclude'] = preg_replace('/[^0-9,]/', '', $r['exclude']);
1198 1198
 
1199 1199
 	// Allow plugins to filter an array of excluded pages (but don't put a nullstring into the array)
1200
-	$exclude_array = ( $r['exclude'] ) ? explode( ',', $r['exclude'] ) : array();
1200
+	$exclude_array = ($r['exclude']) ? explode(',', $r['exclude']) : array();
1201 1201
 
1202 1202
 	/**
1203 1203
 	 * Filters the array of pages to exclude from the pages list.
@@ -1206,29 +1206,29 @@  discard block
 block discarded – undo
1206 1206
 	 *
1207 1207
 	 * @param array $exclude_array An array of page IDs to exclude.
1208 1208
 	 */
1209
-	$r['exclude'] = implode( ',', apply_filters( 'wp_list_pages_excludes', $exclude_array ) );
1209
+	$r['exclude'] = implode(',', apply_filters('wp_list_pages_excludes', $exclude_array));
1210 1210
 
1211 1211
 	// Query pages.
1212 1212
 	$r['hierarchical'] = 0;
1213
-	$pages = get_pages( $r );
1213
+	$pages = get_pages($r);
1214 1214
 
1215
-	if ( ! empty( $pages ) ) {
1216
-		if ( $r['title_li'] ) {
1217
-			$output .= '<li class="pagenav">' . $r['title_li'] . '<ul>';
1215
+	if ( ! empty($pages)) {
1216
+		if ($r['title_li']) {
1217
+			$output .= '<li class="pagenav">'.$r['title_li'].'<ul>';
1218 1218
 		}
1219 1219
 		global $wp_query;
1220
-		if ( is_page() || is_attachment() || $wp_query->is_posts_page ) {
1220
+		if (is_page() || is_attachment() || $wp_query->is_posts_page) {
1221 1221
 			$current_page = get_queried_object_id();
1222
-		} elseif ( is_singular() ) {
1222
+		} elseif (is_singular()) {
1223 1223
 			$queried_object = get_queried_object();
1224
-			if ( is_post_type_hierarchical( $queried_object->post_type ) ) {
1224
+			if (is_post_type_hierarchical($queried_object->post_type)) {
1225 1225
 				$current_page = $queried_object->ID;
1226 1226
 			}
1227 1227
 		}
1228 1228
 
1229
-		$output .= walk_page_tree( $pages, $r['depth'], $current_page, $r );
1229
+		$output .= walk_page_tree($pages, $r['depth'], $current_page, $r);
1230 1230
 
1231
-		if ( $r['title_li'] ) {
1231
+		if ($r['title_li']) {
1232 1232
 			$output .= '</ul></li>';
1233 1233
 		}
1234 1234
 	}
@@ -1245,9 +1245,9 @@  discard block
 block discarded – undo
1245 1245
 	 * @param array  $r      An array of page-listing arguments.
1246 1246
 	 * @param array  $pages  List of WP_Post objects returned by `get_pages()`
1247 1247
 	 */
1248
-	$html = apply_filters( 'wp_list_pages', $output, $r, $pages );
1248
+	$html = apply_filters('wp_list_pages', $output, $r, $pages);
1249 1249
 
1250
-	if ( $r['echo'] ) {
1250
+	if ($r['echo']) {
1251 1251
 		echo $html;
1252 1252
 	} else {
1253 1253
 		return $html;
@@ -1285,7 +1285,7 @@  discard block
 block discarded – undo
1285 1285
  * }
1286 1286
  * @return string|void HTML menu
1287 1287
  */
1288
-function wp_page_menu( $args = array() ) {
1288
+function wp_page_menu($args = array()) {
1289 1289
 	$defaults = array(
1290 1290
 		'sort_column'  => 'menu_order, post_title',
1291 1291
 		'menu_id'      => '',
@@ -1299,14 +1299,14 @@  discard block
 block discarded – undo
1299 1299
 		'item_spacing' => 'discard',
1300 1300
 		'walker'       => '',
1301 1301
 	);
1302
-	$args = wp_parse_args( $args, $defaults );
1302
+	$args = wp_parse_args($args, $defaults);
1303 1303
 
1304
-	if ( ! in_array( $args['item_spacing'], array( 'preserve', 'discard' ) ) ) {
1304
+	if ( ! in_array($args['item_spacing'], array('preserve', 'discard'))) {
1305 1305
 		// invalid value, fall back to default.
1306 1306
 		$args['item_spacing'] = $defaults['item_spacing'];
1307 1307
 	}
1308 1308
 
1309
-	if ( 'preserve' === $args['item_spacing'] ) {
1309
+	if ('preserve' === $args['item_spacing']) {
1310 1310
 		$t = "\t";
1311 1311
 		$n = "\n";
1312 1312
 	} else {
@@ -1323,25 +1323,25 @@  discard block
 block discarded – undo
1323 1323
 	 *
1324 1324
 	 * @param array $args An array of page menu arguments.
1325 1325
 	 */
1326
-	$args = apply_filters( 'wp_page_menu_args', $args );
1326
+	$args = apply_filters('wp_page_menu_args', $args);
1327 1327
 
1328 1328
 	$menu = '';
1329 1329
 
1330 1330
 	$list_args = $args;
1331 1331
 
1332 1332
 	// Show Home in the menu
1333
-	if ( ! empty($args['show_home']) ) {
1334
-		if ( true === $args['show_home'] || '1' === $args['show_home'] || 1 === $args['show_home'] )
1333
+	if ( ! empty($args['show_home'])) {
1334
+		if (true === $args['show_home'] || '1' === $args['show_home'] || 1 === $args['show_home'])
1335 1335
 			$text = __('Home');
1336 1336
 		else
1337 1337
 			$text = $args['show_home'];
1338 1338
 		$class = '';
1339
-		if ( is_front_page() && !is_paged() )
1339
+		if (is_front_page() && ! is_paged())
1340 1340
 			$class = 'class="current_page_item"';
1341
-		$menu .= '<li ' . $class . '><a href="' . home_url( '/' ) . '">' . $args['link_before'] . $text . $args['link_after'] . '</a></li>';
1341
+		$menu .= '<li '.$class.'><a href="'.home_url('/').'">'.$args['link_before'].$text.$args['link_after'].'</a></li>';
1342 1342
 		// If the front page is a page, add it to the exclude list
1343 1343
 		if (get_option('show_on_front') == 'page') {
1344
-			if ( !empty( $list_args['exclude'] ) ) {
1344
+			if ( ! empty($list_args['exclude'])) {
1345 1345
 				$list_args['exclude'] .= ',';
1346 1346
 			} else {
1347 1347
 				$list_args['exclude'] = '';
@@ -1352,38 +1352,38 @@  discard block
 block discarded – undo
1352 1352
 
1353 1353
 	$list_args['echo'] = false;
1354 1354
 	$list_args['title_li'] = '';
1355
-	$menu .= wp_list_pages( $list_args );
1355
+	$menu .= wp_list_pages($list_args);
1356 1356
 
1357
-	$container = sanitize_text_field( $args['container'] );
1357
+	$container = sanitize_text_field($args['container']);
1358 1358
 
1359 1359
 	// Fallback in case `wp_nav_menu()` was called without a container.
1360
-	if ( empty( $container ) ) {
1360
+	if (empty($container)) {
1361 1361
 		$container = 'div';
1362 1362
 	}
1363 1363
 
1364
-	if ( $menu ) {
1364
+	if ($menu) {
1365 1365
 
1366 1366
 		// wp_nav_menu doesn't set before and after
1367
-		if ( isset( $args['fallback_cb'] ) &&
1367
+		if (isset($args['fallback_cb']) &&
1368 1368
 			'wp_page_menu' === $args['fallback_cb'] &&
1369
-			'ul' !== $container ) {
1369
+			'ul' !== $container) {
1370 1370
 			$args['before'] = "<ul>{$n}";
1371 1371
 			$args['after'] = '</ul>';
1372 1372
 		}
1373 1373
 
1374
-		$menu = $args['before'] . $menu . $args['after'];
1374
+		$menu = $args['before'].$menu.$args['after'];
1375 1375
 	}
1376 1376
 
1377 1377
 	$attrs = '';
1378
-	if ( ! empty( $args['menu_id'] ) ) {
1379
-		$attrs .= ' id="' . esc_attr( $args['menu_id'] ) . '"';
1378
+	if ( ! empty($args['menu_id'])) {
1379
+		$attrs .= ' id="'.esc_attr($args['menu_id']).'"';
1380 1380
 	}
1381 1381
 
1382
-	if ( ! empty( $args['menu_class'] ) ) {
1383
-		$attrs .= ' class="' . esc_attr( $args['menu_class'] ) . '"';
1382
+	if ( ! empty($args['menu_class'])) {
1383
+		$attrs .= ' class="'.esc_attr($args['menu_class']).'"';
1384 1384
 	}
1385 1385
 
1386
-	$menu = "<{$container}{$attrs}>" . $menu . "</{$container}>{$n}";
1386
+	$menu = "<{$container}{$attrs}>".$menu."</{$container}>{$n}";
1387 1387
 
1388 1388
 	/**
1389 1389
 	 * Filters the HTML output of a page-based menu.
@@ -1395,8 +1395,8 @@  discard block
 block discarded – undo
1395 1395
 	 * @param string $menu The HTML output.
1396 1396
 	 * @param array  $args An array of arguments.
1397 1397
 	 */
1398
-	$menu = apply_filters( 'wp_page_menu', $menu, $args );
1399
-	if ( $args['echo'] )
1398
+	$menu = apply_filters('wp_page_menu', $menu, $args);
1399
+	if ($args['echo'])
1400 1400
 		echo $menu;
1401 1401
 	else
1402 1402
 		return $menu;
@@ -1418,15 +1418,15 @@  discard block
 block discarded – undo
1418 1418
  * @param array $r
1419 1419
  * @return string
1420 1420
  */
1421
-function walk_page_tree( $pages, $depth, $current_page, $r ) {
1422
-	if ( empty($r['walker']) )
1421
+function walk_page_tree($pages, $depth, $current_page, $r) {
1422
+	if (empty($r['walker']))
1423 1423
 		$walker = new Walker_Page;
1424 1424
 	else
1425 1425
 		$walker = $r['walker'];
1426 1426
 
1427
-	foreach ( (array) $pages as $page ) {
1428
-		if ( $page->post_parent )
1429
-			$r['pages_with_children'][ $page->post_parent ] = true;
1427
+	foreach ((array) $pages as $page) {
1428
+		if ($page->post_parent)
1429
+			$r['pages_with_children'][$page->post_parent] = true;
1430 1430
 	}
1431 1431
 
1432 1432
 	$args = array($pages, $depth, $r, $current_page);
@@ -1444,7 +1444,7 @@  discard block
 block discarded – undo
1444 1444
  */
1445 1445
 function walk_page_dropdown_tree() {
1446 1446
 	$args = func_get_args();
1447
-	if ( empty($args[2]['walker']) ) // the user's options are the third parameter
1447
+	if (empty($args[2]['walker'])) // the user's options are the third parameter
1448 1448
 		$walker = new Walker_PageDropdown;
1449 1449
 	else
1450 1450
 		$walker = $args[2]['walker'];
@@ -1466,11 +1466,11 @@  discard block
 block discarded – undo
1466 1466
  * @param bool        $deprecated   Deprecated. Not used.
1467 1467
  * @param bool        $permalink    Optional, default is false. Whether to include permalink.
1468 1468
  */
1469
-function the_attachment_link( $id = 0, $fullsize = false, $deprecated = false, $permalink = false ) {
1470
-	if ( !empty( $deprecated ) )
1471
-		_deprecated_argument( __FUNCTION__, '2.5.0' );
1469
+function the_attachment_link($id = 0, $fullsize = false, $deprecated = false, $permalink = false) {
1470
+	if ( ! empty($deprecated))
1471
+		_deprecated_argument(__FUNCTION__, '2.5.0');
1472 1472
 
1473
-	if ( $fullsize )
1473
+	if ($fullsize)
1474 1474
 		echo wp_get_attachment_link($id, 'full', $permalink);
1475 1475
 	else
1476 1476
 		echo wp_get_attachment_link($id, 'thumbnail', $permalink);
@@ -1493,31 +1493,31 @@  discard block
 block discarded – undo
1493 1493
  * @param array|string $attr      Optional. Array or string of attributes. Default empty.
1494 1494
  * @return string HTML content.
1495 1495
  */
1496
-function wp_get_attachment_link( $id = 0, $size = 'thumbnail', $permalink = false, $icon = false, $text = false, $attr = '' ) {
1497
-	$_post = get_post( $id );
1496
+function wp_get_attachment_link($id = 0, $size = 'thumbnail', $permalink = false, $icon = false, $text = false, $attr = '') {
1497
+	$_post = get_post($id);
1498 1498
 
1499
-	if ( empty( $_post ) || ( 'attachment' !== $_post->post_type ) || ! $url = wp_get_attachment_url( $_post->ID ) ) {
1500
-		return __( 'Missing Attachment' );
1499
+	if (empty($_post) || ('attachment' !== $_post->post_type) || ! $url = wp_get_attachment_url($_post->ID)) {
1500
+		return __('Missing Attachment');
1501 1501
 	}
1502 1502
 
1503
-	if ( $permalink ) {
1504
-		$url = get_attachment_link( $_post->ID );
1503
+	if ($permalink) {
1504
+		$url = get_attachment_link($_post->ID);
1505 1505
 	}
1506 1506
 
1507
-	if ( $text ) {
1507
+	if ($text) {
1508 1508
 		$link_text = $text;
1509
-	} elseif ( $size && 'none' != $size ) {
1510
-		$link_text = wp_get_attachment_image( $_post->ID, $size, $icon, $attr );
1509
+	} elseif ($size && 'none' != $size) {
1510
+		$link_text = wp_get_attachment_image($_post->ID, $size, $icon, $attr);
1511 1511
 	} else {
1512 1512
 		$link_text = '';
1513 1513
 	}
1514 1514
 
1515
-	if ( '' === trim( $link_text ) ) {
1515
+	if ('' === trim($link_text)) {
1516 1516
 		$link_text = $_post->post_title;
1517 1517
 	}
1518 1518
 
1519
-	if ( '' === trim( $link_text ) ) {
1520
-		$link_text = esc_html( pathinfo( get_attached_file( $_post->ID ), PATHINFO_FILENAME ) );
1519
+	if ('' === trim($link_text)) {
1520
+		$link_text = esc_html(pathinfo(get_attached_file($_post->ID), PATHINFO_FILENAME));
1521 1521
 	}
1522 1522
 	/**
1523 1523
 	 * Filters a retrieved attachment page link.
@@ -1532,7 +1532,7 @@  discard block
 block discarded – undo
1532 1532
 	 * @param bool         $icon      Whether to include an icon. Default false.
1533 1533
 	 * @param string|bool  $text      If string, will be link text. Default false.
1534 1534
 	 */
1535
-	return apply_filters( 'wp_get_attachment_link', "<a href='" . esc_url( $url ) . "'>$link_text</a>", $id, $size, $permalink, $icon, $text );
1535
+	return apply_filters('wp_get_attachment_link', "<a href='".esc_url($url)."'>$link_text</a>", $id, $size, $permalink, $icon, $text);
1536 1536
 }
1537 1537
 
1538 1538
 /**
@@ -1546,22 +1546,22 @@  discard block
 block discarded – undo
1546 1546
 function prepend_attachment($content) {
1547 1547
 	$post = get_post();
1548 1548
 
1549
-	if ( empty($post->post_type) || $post->post_type != 'attachment' )
1549
+	if (empty($post->post_type) || $post->post_type != 'attachment')
1550 1550
 		return $content;
1551 1551
 
1552
-	if ( wp_attachment_is( 'video', $post ) ) {
1553
-		$meta = wp_get_attachment_metadata( get_the_ID() );
1554
-		$atts = array( 'src' => wp_get_attachment_url() );
1555
-		if ( ! empty( $meta['width'] ) && ! empty( $meta['height'] ) ) {
1552
+	if (wp_attachment_is('video', $post)) {
1553
+		$meta = wp_get_attachment_metadata(get_the_ID());
1554
+		$atts = array('src' => wp_get_attachment_url());
1555
+		if ( ! empty($meta['width']) && ! empty($meta['height'])) {
1556 1556
 			$atts['width'] = (int) $meta['width'];
1557 1557
 			$atts['height'] = (int) $meta['height'];
1558 1558
 		}
1559
-		if ( has_post_thumbnail() ) {
1560
-			$atts['poster'] = wp_get_attachment_url( get_post_thumbnail_id() );
1559
+		if (has_post_thumbnail()) {
1560
+			$atts['poster'] = wp_get_attachment_url(get_post_thumbnail_id());
1561 1561
 		}
1562
-		$p = wp_video_shortcode( $atts );
1563
-	} elseif ( wp_attachment_is( 'audio', $post ) ) {
1564
-		$p = wp_audio_shortcode( array( 'src' => wp_get_attachment_url() ) );
1562
+		$p = wp_video_shortcode($atts);
1563
+	} elseif (wp_attachment_is('audio', $post)) {
1564
+		$p = wp_audio_shortcode(array('src' => wp_get_attachment_url()));
1565 1565
 	} else {
1566 1566
 		$p = '<p class="attachment">';
1567 1567
 		// show the medium sized image representation of the attachment if available, and link to the raw file
@@ -1578,7 +1578,7 @@  discard block
 block discarded – undo
1578 1578
 	 *
1579 1579
 	 * @param string $p The attachment HTML output.
1580 1580
 	 */
1581
-	$p = apply_filters( 'prepend_attachment', $p );
1581
+	$p = apply_filters('prepend_attachment', $p);
1582 1582
 
1583 1583
 	return "$p\n$content";
1584 1584
 }
@@ -1595,12 +1595,12 @@  discard block
 block discarded – undo
1595 1595
  * @param int|WP_Post $post Optional. Post ID or WP_Post object. Default is global $post.
1596 1596
  * @return string HTML content for password form for password protected post.
1597 1597
  */
1598
-function get_the_password_form( $post = 0 ) {
1599
-	$post = get_post( $post );
1600
-	$label = 'pwbox-' . ( empty($post->ID) ? rand() : $post->ID );
1601
-	$output = '<form action="' . esc_url( site_url( 'wp-login.php?action=postpass', 'login_post' ) ) . '" class="post-password-form" method="post">
1602
-	<p>' . __( 'This content is password protected. To view it please enter your password below:' ) . '</p>
1603
-	<p><label for="' . $label . '">' . __( 'Password:' ) . ' <input name="post_password" id="' . $label . '" type="password" size="20" /></label> <input type="submit" name="Submit" value="' . esc_attr_x( 'Enter', 'post password form' ) . '" /></p></form>
1598
+function get_the_password_form($post = 0) {
1599
+	$post = get_post($post);
1600
+	$label = 'pwbox-'.(empty($post->ID) ? rand() : $post->ID);
1601
+	$output = '<form action="'.esc_url(site_url('wp-login.php?action=postpass', 'login_post')).'" class="post-password-form" method="post">
1602
+	<p>' . __('This content is password protected. To view it please enter your password below:').'</p>
1603
+	<p><label for="' . $label.'">'.__('Password:').' <input name="post_password" id="'.$label.'" type="password" size="20" /></label> <input type="submit" name="Submit" value="'.esc_attr_x('Enter', 'post password form').'" /></p></form>
1604 1604
 	';
1605 1605
 
1606 1606
 	/**
@@ -1614,7 +1614,7 @@  discard block
 block discarded – undo
1614 1614
 	 *
1615 1615
 	 * @param string $output The password form HTML output.
1616 1616
 	 */
1617
-	return apply_filters( 'the_password_form', $output );
1617
+	return apply_filters('the_password_form', $output);
1618 1618
 }
1619 1619
 
1620 1620
 /**
@@ -1631,28 +1631,28 @@  discard block
 block discarded – undo
1631 1631
  * @param string|array $template The specific template name or array of templates to match.
1632 1632
  * @return bool True on success, false on failure.
1633 1633
  */
1634
-function is_page_template( $template = '' ) {
1635
-	if ( ! is_singular() ) {
1634
+function is_page_template($template = '') {
1635
+	if ( ! is_singular()) {
1636 1636
 		return false;
1637 1637
 	}
1638 1638
 
1639
-	$page_template = get_page_template_slug( get_queried_object_id() );
1639
+	$page_template = get_page_template_slug(get_queried_object_id());
1640 1640
 
1641
-	if ( empty( $template ) )
1641
+	if (empty($template))
1642 1642
 		return (bool) $page_template;
1643 1643
 
1644
-	if ( $template == $page_template )
1644
+	if ($template == $page_template)
1645 1645
 		return true;
1646 1646
 
1647
-	if ( is_array( $template ) ) {
1648
-		if ( ( in_array( 'default', $template, true ) && ! $page_template )
1649
-			|| in_array( $page_template, $template, true )
1647
+	if (is_array($template)) {
1648
+		if ((in_array('default', $template, true) && ! $page_template)
1649
+			|| in_array($page_template, $template, true)
1650 1650
 		) {
1651 1651
 			return true;
1652 1652
 		}
1653 1653
 	}
1654 1654
 
1655
-	return ( 'default' === $template && ! $page_template );
1655
+	return ('default' === $template && ! $page_template);
1656 1656
 }
1657 1657
 
1658 1658
 /**
@@ -1665,16 +1665,16 @@  discard block
 block discarded – undo
1665 1665
  * @return string|false Page template filename. Returns an empty string when the default page template
1666 1666
  * 	is in use. Returns false if the post does not exist.
1667 1667
  */
1668
-function get_page_template_slug( $post = null ) {
1669
-	$post = get_post( $post );
1668
+function get_page_template_slug($post = null) {
1669
+	$post = get_post($post);
1670 1670
 
1671
-	if ( ! $post ) {
1671
+	if ( ! $post) {
1672 1672
 		return false;
1673 1673
 	}
1674 1674
 
1675
-	$template = get_post_meta( $post->ID, '_wp_page_template', true );
1675
+	$template = get_post_meta($post->ID, '_wp_page_template', true);
1676 1676
 
1677
-	if ( ! $template || 'default' == $template ) {
1677
+	if ( ! $template || 'default' == $template) {
1678 1678
 		return '';
1679 1679
 	}
1680 1680
 
@@ -1690,28 +1690,28 @@  discard block
 block discarded – undo
1690 1690
  * @param bool       $link     Optional, default is true. Link to revisions's page?
1691 1691
  * @return string|false i18n formatted datetimestamp or localized 'Current Revision'.
1692 1692
  */
1693
-function wp_post_revision_title( $revision, $link = true ) {
1694
-	if ( !$revision = get_post( $revision ) )
1693
+function wp_post_revision_title($revision, $link = true) {
1694
+	if ( ! $revision = get_post($revision))
1695 1695
 		return $revision;
1696 1696
 
1697
-	if ( !in_array( $revision->post_type, array( 'post', 'page', 'revision' ) ) )
1697
+	if ( ! in_array($revision->post_type, array('post', 'page', 'revision')))
1698 1698
 		return false;
1699 1699
 
1700 1700
 	/* translators: revision date format, see https://secure.php.net/date */
1701
-	$datef = _x( 'F j, Y @ H:i:s', 'revision date format' );
1701
+	$datef = _x('F j, Y @ H:i:s', 'revision date format');
1702 1702
 	/* translators: %s: revision date */
1703
-	$autosavef = __( '%s [Autosave]' );
1703
+	$autosavef = __('%s [Autosave]');
1704 1704
 	/* translators: %s: revision date */
1705
-	$currentf  = __( '%s [Current Revision]' );
1705
+	$currentf  = __('%s [Current Revision]');
1706 1706
 
1707
-	$date = date_i18n( $datef, strtotime( $revision->post_modified ) );
1708
-	if ( $link && current_user_can( 'edit_post', $revision->ID ) && $link = get_edit_post_link( $revision->ID ) )
1707
+	$date = date_i18n($datef, strtotime($revision->post_modified));
1708
+	if ($link && current_user_can('edit_post', $revision->ID) && $link = get_edit_post_link($revision->ID))
1709 1709
 		$date = "<a href='$link'>$date</a>";
1710 1710
 
1711
-	if ( !wp_is_post_revision( $revision ) )
1712
-		$date = sprintf( $currentf, $date );
1713
-	elseif ( wp_is_post_autosave( $revision ) )
1714
-		$date = sprintf( $autosavef, $date );
1711
+	if ( ! wp_is_post_revision($revision))
1712
+		$date = sprintf($currentf, $date);
1713
+	elseif (wp_is_post_autosave($revision))
1714
+		$date = sprintf($autosavef, $date);
1715 1715
 
1716 1716
 	return $date;
1717 1717
 }
@@ -1725,41 +1725,41 @@  discard block
 block discarded – undo
1725 1725
  * @param bool       $link     Optional, default is true. Link to revisions's page?
1726 1726
  * @return string|false gravatar, user, i18n formatted datetimestamp or localized 'Current Revision'.
1727 1727
  */
1728
-function wp_post_revision_title_expanded( $revision, $link = true ) {
1729
-	if ( !$revision = get_post( $revision ) )
1728
+function wp_post_revision_title_expanded($revision, $link = true) {
1729
+	if ( ! $revision = get_post($revision))
1730 1730
 		return $revision;
1731 1731
 
1732
-	if ( !in_array( $revision->post_type, array( 'post', 'page', 'revision' ) ) )
1732
+	if ( ! in_array($revision->post_type, array('post', 'page', 'revision')))
1733 1733
 		return false;
1734 1734
 
1735
-	$author = get_the_author_meta( 'display_name', $revision->post_author );
1735
+	$author = get_the_author_meta('display_name', $revision->post_author);
1736 1736
 	/* translators: revision date format, see https://secure.php.net/date */
1737
-	$datef = _x( 'F j, Y @ H:i:s', 'revision date format' );
1737
+	$datef = _x('F j, Y @ H:i:s', 'revision date format');
1738 1738
 
1739
-	$gravatar = get_avatar( $revision->post_author, 24 );
1739
+	$gravatar = get_avatar($revision->post_author, 24);
1740 1740
 
1741
-	$date = date_i18n( $datef, strtotime( $revision->post_modified ) );
1742
-	if ( $link && current_user_can( 'edit_post', $revision->ID ) && $link = get_edit_post_link( $revision->ID ) )
1741
+	$date = date_i18n($datef, strtotime($revision->post_modified));
1742
+	if ($link && current_user_can('edit_post', $revision->ID) && $link = get_edit_post_link($revision->ID))
1743 1743
 		$date = "<a href='$link'>$date</a>";
1744 1744
 
1745 1745
 	$revision_date_author = sprintf(
1746 1746
 		/* translators: post revision title: 1: author avatar, 2: author name, 3: time ago, 4: date */
1747
-		__( '%1$s %2$s, %3$s ago (%4$s)' ),
1747
+		__('%1$s %2$s, %3$s ago (%4$s)'),
1748 1748
 		$gravatar,
1749 1749
 		$author,
1750
-		human_time_diff( strtotime( $revision->post_modified ), current_time( 'timestamp' ) ),
1750
+		human_time_diff(strtotime($revision->post_modified), current_time('timestamp')),
1751 1751
 		$date
1752 1752
 	);
1753 1753
 
1754 1754
 	/* translators: %s: revision date with author avatar */
1755
-	$autosavef = __( '%s [Autosave]' );
1755
+	$autosavef = __('%s [Autosave]');
1756 1756
 	/* translators: %s: revision date with author avatar */
1757
-	$currentf  = __( '%s [Current Revision]' );
1757
+	$currentf  = __('%s [Current Revision]');
1758 1758
 
1759
-	if ( !wp_is_post_revision( $revision ) )
1760
-		$revision_date_author = sprintf( $currentf, $revision_date_author );
1761
-	elseif ( wp_is_post_autosave( $revision ) )
1762
-		$revision_date_author = sprintf( $autosavef, $revision_date_author );
1759
+	if ( ! wp_is_post_revision($revision))
1760
+		$revision_date_author = sprintf($currentf, $revision_date_author);
1761
+	elseif (wp_is_post_autosave($revision))
1762
+		$revision_date_author = sprintf($autosavef, $revision_date_author);
1763 1763
 
1764 1764
 	/**
1765 1765
 	 * Filters the formatted author and date for a revision.
@@ -1771,7 +1771,7 @@  discard block
 block discarded – undo
1771 1771
 	 * @param bool    $link                 Whether to link to the revisions page, as passed into
1772 1772
 	 *                                      wp_post_revision_title_expanded().
1773 1773
 	 */
1774
-	return apply_filters( 'wp_post_revision_title_expanded', $revision_date_author, $revision, $link );
1774
+	return apply_filters('wp_post_revision_title_expanded', $revision_date_author, $revision, $link);
1775 1775
 }
1776 1776
 
1777 1777
 /**
@@ -1785,32 +1785,32 @@  discard block
 block discarded – undo
1785 1785
  * @param int|WP_Post $post_id Optional. Post ID or WP_Post object. Default is global $post.
1786 1786
  * @param string      $type    'all' (default), 'revision' or 'autosave'
1787 1787
  */
1788
-function wp_list_post_revisions( $post_id = 0, $type = 'all' ) {
1789
-	if ( ! $post = get_post( $post_id ) )
1788
+function wp_list_post_revisions($post_id = 0, $type = 'all') {
1789
+	if ( ! $post = get_post($post_id))
1790 1790
 		return;
1791 1791
 
1792 1792
 	// $args array with (parent, format, right, left, type) deprecated since 3.6
1793
-	if ( is_array( $type ) ) {
1794
-		$type = ! empty( $type['type'] ) ? $type['type']  : $type;
1795
-		_deprecated_argument( __FUNCTION__, '3.6.0' );
1793
+	if (is_array($type)) {
1794
+		$type = ! empty($type['type']) ? $type['type'] : $type;
1795
+		_deprecated_argument(__FUNCTION__, '3.6.0');
1796 1796
 	}
1797 1797
 
1798
-	if ( ! $revisions = wp_get_post_revisions( $post->ID ) )
1798
+	if ( ! $revisions = wp_get_post_revisions($post->ID))
1799 1799
 		return;
1800 1800
 
1801 1801
 	$rows = '';
1802
-	foreach ( $revisions as $revision ) {
1803
-		if ( ! current_user_can( 'read_post', $revision->ID ) )
1802
+	foreach ($revisions as $revision) {
1803
+		if ( ! current_user_can('read_post', $revision->ID))
1804 1804
 			continue;
1805 1805
 
1806
-		$is_autosave = wp_is_post_autosave( $revision );
1807
-		if ( ( 'revision' === $type && $is_autosave ) || ( 'autosave' === $type && ! $is_autosave ) )
1806
+		$is_autosave = wp_is_post_autosave($revision);
1807
+		if (('revision' === $type && $is_autosave) || ('autosave' === $type && ! $is_autosave))
1808 1808
 			continue;
1809 1809
 
1810
-		$rows .= "\t<li>" . wp_post_revision_title_expanded( $revision ) . "</li>\n";
1810
+		$rows .= "\t<li>".wp_post_revision_title_expanded($revision)."</li>\n";
1811 1811
 	}
1812 1812
 
1813
-	echo "<div class='hide-if-js'><p>" . __( 'JavaScript must be enabled to use this feature.' ) . "</p></div>\n";
1813
+	echo "<div class='hide-if-js'><p>".__('JavaScript must be enabled to use this feature.')."</p></div>\n";
1814 1814
 
1815 1815
 	echo "<ul class='post-revisions hide-if-no-js'>\n";
1816 1816
 	echo $rows;
Please login to merge, or discard this patch.
src/wp-includes/formatting.php 4 patches
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -805,7 +805,7 @@  discard block
 block discarded – undo
805 805
 		.     '\\['                          // Opening bracket
806 806
 		.     "($tagregexp)"                 // 2: Shortcode name
807 807
 		.     '(?![\\w-])'                   // Not followed by word character or hyphen
808
-		                                     // Unroll the loop: Inside the opening shortcode tag
808
+											 // Unroll the loop: Inside the opening shortcode tag
809 809
 		.     '[^\\]\\/]*'                   // Not a closing bracket or forward slash
810 810
 		.     '(?:'
811 811
 		.         '\\/(?!\\])'               // A forward slash not followed by a closing bracket
@@ -2613,7 +2613,7 @@  discard block
 block discarded – undo
2613 2613
 				)
2614 2614
 				(\)?)                                                  # 3: Trailing closing parenthesis (for parethesis balancing post processing)
2615 2615
 			~xS'; // The regex is a non-anchored pattern and does not have a single fixed starting character.
2616
-			      // Tell PCRE to spend more time optimizing since, when used on a page load, it will probably be used several times.
2616
+				  // Tell PCRE to spend more time optimizing since, when used on a page load, it will probably be used several times.
2617 2617
 
2618 2618
 			$ret = preg_replace_callback( $url_clickable, '_make_url_clickable_cb', $ret );
2619 2619
 
@@ -2717,7 +2717,7 @@  discard block
 block discarded – undo
2717 2717
 	$rel  = 'nofollow';
2718 2718
 
2719 2719
 	if ( preg_match( '%href=["\'](' . preg_quote( set_url_scheme( home_url(), 'http' ) ) . ')%i', $text ) ||
2720
-	     preg_match( '%href=["\'](' . preg_quote( set_url_scheme( home_url(), 'https' ) ) . ')%i', $text )
2720
+		 preg_match( '%href=["\'](' . preg_quote( set_url_scheme( home_url(), 'https' ) ) . ')%i', $text )
2721 2721
 	) {
2722 2722
 		return "<a $text>";
2723 2723
 	}
@@ -3891,7 +3891,7 @@  discard block
 block discarded – undo
3891 3891
 	 * @since 2.0.6
3892 3892
 	 *
3893 3893
 	 * @param string $safe_text The text after it has been escaped.
3894
- 	 * @param string $text      The text prior to being escaped.
3894
+	 * @param string $text      The text prior to being escaped.
3895 3895
 	 */
3896 3896
 	return apply_filters( 'js_escape', $safe_text, $text );
3897 3897
 }
@@ -3916,7 +3916,7 @@  discard block
 block discarded – undo
3916 3916
 	 * @since 2.8.0
3917 3917
 	 *
3918 3918
 	 * @param string $safe_text The text after it has been escaped.
3919
- 	 * @param string $text      The text prior to being escaped.
3919
+	 * @param string $text      The text prior to being escaped.
3920 3920
 	 */
3921 3921
 	return apply_filters( 'esc_html', $safe_text, $text );
3922 3922
 }
@@ -3941,7 +3941,7 @@  discard block
 block discarded – undo
3941 3941
 	 * @since 2.0.6
3942 3942
 	 *
3943 3943
 	 * @param string $safe_text The text after it has been escaped.
3944
- 	 * @param string $text      The text prior to being escaped.
3944
+	 * @param string $text      The text prior to being escaped.
3945 3945
 	 */
3946 3946
 	return apply_filters( 'attribute_escape', $safe_text, $text );
3947 3947
 }
@@ -3962,7 +3962,7 @@  discard block
 block discarded – undo
3962 3962
 	 * @since 3.1.0
3963 3963
 	 *
3964 3964
 	 * @param string $safe_text The text after it has been escaped.
3965
- 	 * @param string $text      The text prior to being escaped.
3965
+	 * @param string $text      The text prior to being escaped.
3966 3966
 	 */
3967 3967
 	return apply_filters( 'esc_textarea', $safe_text, $text );
3968 3968
 }
@@ -3983,7 +3983,7 @@  discard block
 block discarded – undo
3983 3983
 	 * @since 2.8.0
3984 3984
 	 *
3985 3985
 	 * @param string $safe_tag The tag name after it has been escaped.
3986
- 	 * @param string $tag_name The text before it was escaped.
3986
+	 * @param string $tag_name The text before it was escaped.
3987 3987
 	 */
3988 3988
 	return apply_filters( 'tag_escape', $safe_tag, $tag_name );
3989 3989
 }
Please login to merge, or discard this patch.
Doc Comments   +3 added lines, -4 removed lines patch added patch discarded remove patch
@@ -879,7 +879,7 @@  discard block
 block discarded – undo
879 879
  * @staticvar string $_charset
880 880
  *
881 881
  * @param string     $string         The text which is to be encoded.
882
- * @param int|string $quote_style    Optional. Converts double quotes if set to ENT_COMPAT,
882
+ * @param integer $quote_style    Optional. Converts double quotes if set to ENT_COMPAT,
883 883
  *                                   both single and double if set to ENT_QUOTES or none if set to ENT_NOQUOTES.
884 884
  *                                   Also compatible with old values; converting single quotes if set to 'single',
885 885
  *                                   double if set to 'double' or both if otherwise set.
@@ -952,7 +952,7 @@  discard block
 block discarded – undo
952 952
  * @since 2.8.0
953 953
  *
954 954
  * @param string     $string The text which is to be decoded.
955
- * @param string|int $quote_style Optional. Converts double quotes if set to ENT_COMPAT,
955
+ * @param integer $quote_style Optional. Converts double quotes if set to ENT_COMPAT,
956 956
  *                                both single and double if set to ENT_QUOTES or
957 957
  *                                none if set to ENT_NOQUOTES.
958 958
  *                                Also compatible with old _wp_specialchars() values;
@@ -3692,7 +3692,7 @@  discard block
 block discarded – undo
3692 3692
  * @since 2.8.1
3693 3693
  * @access private
3694 3694
  *
3695
- * @param string|array $search  The value being searched for, otherwise known as the needle.
3695
+ * @param string[] $search  The value being searched for, otherwise known as the needle.
3696 3696
  *                              An array may be used to designate multiple needles.
3697 3697
  * @param string       $subject The string being searched and replaced on, otherwise known as the haystack.
3698 3698
  * @return string The string with the replaced svalues.
@@ -4358,7 +4358,6 @@  discard block
 block discarded – undo
4358 4358
  * @link https://secure.php.net/sprintf
4359 4359
  *
4360 4360
  * @param string $pattern   The string which formatted args are inserted.
4361
- * @param mixed  $args ,... Arguments to be formatted into the $pattern string.
4362 4361
  * @return string The formatted string.
4363 4362
  */
4364 4363
 function wp_sprintf( $pattern ) {
Please login to merge, or discard this patch.
Spacing   +993 added lines, -994 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
  * @param bool   $reset Set to true for unit testing. Translated patterns will reset.
39 39
  * @return string The string replaced with html entities
40 40
  */
41
-function wptexturize( $text, $reset = false ) {
41
+function wptexturize($text, $reset = false) {
42 42
 	global $wp_cockneyreplace, $shortcode_tags;
43 43
 	static $static_characters = null,
44 44
 		$static_replacements = null,
@@ -59,12 +59,12 @@  discard block
 block discarded – undo
59 59
 		$apos_flag = '<!--apos-->';
60 60
 
61 61
 	// If there's nothing to do, just stop.
62
-	if ( empty( $text ) || false === $run_texturize ) {
62
+	if (empty($text) || false === $run_texturize) {
63 63
 		return $text;
64 64
 	}
65 65
 
66 66
 	// Set up static variables. Run once only.
67
-	if ( $reset || ! isset( $static_characters ) ) {
67
+	if ($reset || ! isset($static_characters)) {
68 68
 		/**
69 69
 		 * Filters whether to skip running wptexturize().
70 70
 		 *
@@ -79,118 +79,118 @@  discard block
 block discarded – undo
79 79
 		 *
80 80
 		 * @param bool $run_texturize Whether to short-circuit wptexturize().
81 81
 		 */
82
-		$run_texturize = apply_filters( 'run_wptexturize', $run_texturize );
83
-		if ( false === $run_texturize ) {
82
+		$run_texturize = apply_filters('run_wptexturize', $run_texturize);
83
+		if (false === $run_texturize) {
84 84
 			return $text;
85 85
 		}
86 86
 
87 87
 		/* translators: opening curly double quote */
88
-		$opening_quote = _x( '&#8220;', 'opening curly double quote' );
88
+		$opening_quote = _x('&#8220;', 'opening curly double quote');
89 89
 		/* translators: closing curly double quote */
90
-		$closing_quote = _x( '&#8221;', 'closing curly double quote' );
90
+		$closing_quote = _x('&#8221;', 'closing curly double quote');
91 91
 
92 92
 		/* translators: apostrophe, for example in 'cause or can't */
93
-		$apos = _x( '&#8217;', 'apostrophe' );
93
+		$apos = _x('&#8217;', 'apostrophe');
94 94
 
95 95
 		/* translators: prime, for example in 9' (nine feet) */
96
-		$prime = _x( '&#8242;', 'prime' );
96
+		$prime = _x('&#8242;', 'prime');
97 97
 		/* translators: double prime, for example in 9" (nine inches) */
98
-		$double_prime = _x( '&#8243;', 'double prime' );
98
+		$double_prime = _x('&#8243;', 'double prime');
99 99
 
100 100
 		/* translators: opening curly single quote */
101
-		$opening_single_quote = _x( '&#8216;', 'opening curly single quote' );
101
+		$opening_single_quote = _x('&#8216;', 'opening curly single quote');
102 102
 		/* translators: closing curly single quote */
103
-		$closing_single_quote = _x( '&#8217;', 'closing curly single quote' );
103
+		$closing_single_quote = _x('&#8217;', 'closing curly single quote');
104 104
 
105 105
 		/* translators: en dash */
106
-		$en_dash = _x( '&#8211;', 'en dash' );
106
+		$en_dash = _x('&#8211;', 'en dash');
107 107
 		/* translators: em dash */
108
-		$em_dash = _x( '&#8212;', 'em dash' );
108
+		$em_dash = _x('&#8212;', 'em dash');
109 109
 
110 110
 		$default_no_texturize_tags = array('pre', 'code', 'kbd', 'style', 'script', 'tt');
111 111
 		$default_no_texturize_shortcodes = array('code');
112 112
 
113 113
 		// if a plugin has provided an autocorrect array, use it
114
-		if ( isset($wp_cockneyreplace) ) {
115
-			$cockney = array_keys( $wp_cockneyreplace );
116
-			$cockneyreplace = array_values( $wp_cockneyreplace );
114
+		if (isset($wp_cockneyreplace)) {
115
+			$cockney = array_keys($wp_cockneyreplace);
116
+			$cockneyreplace = array_values($wp_cockneyreplace);
117 117
 		} else {
118 118
 			/* translators: This is a comma-separated list of words that defy the syntax of quotations in normal use,
119 119
 			 * for example...  'We do not have enough words yet' ... is a typical quoted phrase.  But when we write
120 120
 			 * lines of code 'til we have enough of 'em, then we need to insert apostrophes instead of quotes.
121 121
 			 */
122
-			$cockney = explode( ',', _x( "'tain't,'twere,'twas,'tis,'twill,'til,'bout,'nuff,'round,'cause,'em",
123
-				'Comma-separated list of words to texturize in your language' ) );
122
+			$cockney = explode(',', _x("'tain't,'twere,'twas,'tis,'twill,'til,'bout,'nuff,'round,'cause,'em",
123
+				'Comma-separated list of words to texturize in your language'));
124 124
 
125
-			$cockneyreplace = explode( ',', _x( '&#8217;tain&#8217;t,&#8217;twere,&#8217;twas,&#8217;tis,&#8217;twill,&#8217;til,&#8217;bout,&#8217;nuff,&#8217;round,&#8217;cause,&#8217;em',
126
-				'Comma-separated list of replacement words in your language' ) );
125
+			$cockneyreplace = explode(',', _x('&#8217;tain&#8217;t,&#8217;twere,&#8217;twas,&#8217;tis,&#8217;twill,&#8217;til,&#8217;bout,&#8217;nuff,&#8217;round,&#8217;cause,&#8217;em',
126
+				'Comma-separated list of replacement words in your language'));
127 127
 		}
128 128
 
129
-		$static_characters = array_merge( array( '...', '``', '\'\'', ' (tm)' ), $cockney );
130
-		$static_replacements = array_merge( array( '&#8230;', $opening_quote, $closing_quote, ' &#8482;' ), $cockneyreplace );
129
+		$static_characters = array_merge(array('...', '``', '\'\'', ' (tm)'), $cockney);
130
+		$static_replacements = array_merge(array('&#8230;', $opening_quote, $closing_quote, ' &#8482;'), $cockneyreplace);
131 131
 
132 132
 
133 133
 		// Pattern-based replacements of characters.
134 134
 		// Sort the remaining patterns into several arrays for performance tuning.
135
-		$dynamic_characters = array( 'apos' => array(), 'quote' => array(), 'dash' => array() );
136
-		$dynamic_replacements = array( 'apos' => array(), 'quote' => array(), 'dash' => array() );
135
+		$dynamic_characters = array('apos' => array(), 'quote' => array(), 'dash' => array());
136
+		$dynamic_replacements = array('apos' => array(), 'quote' => array(), 'dash' => array());
137 137
 		$dynamic = array();
138 138
 		$spaces = wp_spaces_regexp();
139 139
 
140 140
 		// '99' and '99" are ambiguous among other patterns; assume it's an abbreviated year at the end of a quotation.
141
-		if ( "'" !== $apos || "'" !== $closing_single_quote ) {
142
-			$dynamic[ '/\'(\d\d)\'(?=\Z|[.,:;!?)}\-\]]|&gt;|' . $spaces . ')/' ] = $apos_flag . '$1' . $closing_single_quote;
141
+		if ("'" !== $apos || "'" !== $closing_single_quote) {
142
+			$dynamic['/\'(\d\d)\'(?=\Z|[.,:;!?)}\-\]]|&gt;|'.$spaces.')/'] = $apos_flag.'$1'.$closing_single_quote;
143 143
 		}
144
-		if ( "'" !== $apos || '"' !== $closing_quote ) {
145
-			$dynamic[ '/\'(\d\d)"(?=\Z|[.,:;!?)}\-\]]|&gt;|' . $spaces . ')/' ] = $apos_flag . '$1' . $closing_quote;
144
+		if ("'" !== $apos || '"' !== $closing_quote) {
145
+			$dynamic['/\'(\d\d)"(?=\Z|[.,:;!?)}\-\]]|&gt;|'.$spaces.')/'] = $apos_flag.'$1'.$closing_quote;
146 146
 		}
147 147
 
148 148
 		// '99 '99s '99's (apostrophe)  But never '9 or '99% or '999 or '99.0.
149
-		if ( "'" !== $apos ) {
150
-			$dynamic[ '/\'(?=\d\d(?:\Z|(?![%\d]|[.,]\d)))/' ] = $apos_flag;
149
+		if ("'" !== $apos) {
150
+			$dynamic['/\'(?=\d\d(?:\Z|(?![%\d]|[.,]\d)))/'] = $apos_flag;
151 151
 		}
152 152
 
153 153
 		// Quoted Numbers like '0.42'
154
-		if ( "'" !== $opening_single_quote && "'" !== $closing_single_quote ) {
155
-			$dynamic[ '/(?<=\A|' . $spaces . ')\'(\d[.,\d]*)\'/' ] = $open_sq_flag . '$1' . $closing_single_quote;
154
+		if ("'" !== $opening_single_quote && "'" !== $closing_single_quote) {
155
+			$dynamic['/(?<=\A|'.$spaces.')\'(\d[.,\d]*)\'/'] = $open_sq_flag.'$1'.$closing_single_quote;
156 156
 		}
157 157
 
158 158
 		// Single quote at start, or preceded by (, {, <, [, ", -, or spaces.
159
-		if ( "'" !== $opening_single_quote ) {
160
-			$dynamic[ '/(?<=\A|[([{"\-]|&lt;|' . $spaces . ')\'/' ] = $open_sq_flag;
159
+		if ("'" !== $opening_single_quote) {
160
+			$dynamic['/(?<=\A|[([{"\-]|&lt;|'.$spaces.')\'/'] = $open_sq_flag;
161 161
 		}
162 162
 
163 163
 		// Apostrophe in a word.  No spaces, double apostrophes, or other punctuation.
164
-		if ( "'" !== $apos ) {
165
-			$dynamic[ '/(?<!' . $spaces . ')\'(?!\Z|[.,:;!?"\'(){}[\]\-]|&[lg]t;|' . $spaces . ')/' ] = $apos_flag;
164
+		if ("'" !== $apos) {
165
+			$dynamic['/(?<!'.$spaces.')\'(?!\Z|[.,:;!?"\'(){}[\]\-]|&[lg]t;|'.$spaces.')/'] = $apos_flag;
166 166
 		}
167 167
 
168
-		$dynamic_characters['apos'] = array_keys( $dynamic );
169
-		$dynamic_replacements['apos'] = array_values( $dynamic );
168
+		$dynamic_characters['apos'] = array_keys($dynamic);
169
+		$dynamic_replacements['apos'] = array_values($dynamic);
170 170
 		$dynamic = array();
171 171
 
172 172
 		// Quoted Numbers like "42"
173
-		if ( '"' !== $opening_quote && '"' !== $closing_quote ) {
174
-			$dynamic[ '/(?<=\A|' . $spaces . ')"(\d[.,\d]*)"/' ] = $open_q_flag . '$1' . $closing_quote;
173
+		if ('"' !== $opening_quote && '"' !== $closing_quote) {
174
+			$dynamic['/(?<=\A|'.$spaces.')"(\d[.,\d]*)"/'] = $open_q_flag.'$1'.$closing_quote;
175 175
 		}
176 176
 
177 177
 		// Double quote at start, or preceded by (, {, <, [, -, or spaces, and not followed by spaces.
178
-		if ( '"' !== $opening_quote ) {
179
-			$dynamic[ '/(?<=\A|[([{\-]|&lt;|' . $spaces . ')"(?!' . $spaces . ')/' ] = $open_q_flag;
178
+		if ('"' !== $opening_quote) {
179
+			$dynamic['/(?<=\A|[([{\-]|&lt;|'.$spaces.')"(?!'.$spaces.')/'] = $open_q_flag;
180 180
 		}
181 181
 
182
-		$dynamic_characters['quote'] = array_keys( $dynamic );
183
-		$dynamic_replacements['quote'] = array_values( $dynamic );
182
+		$dynamic_characters['quote'] = array_keys($dynamic);
183
+		$dynamic_replacements['quote'] = array_values($dynamic);
184 184
 		$dynamic = array();
185 185
 
186 186
 		// Dashes and spaces
187
-		$dynamic[ '/---/' ] = $em_dash;
188
-		$dynamic[ '/(?<=^|' . $spaces . ')--(?=$|' . $spaces . ')/' ] = $em_dash;
189
-		$dynamic[ '/(?<!xn)--/' ] = $en_dash;
190
-		$dynamic[ '/(?<=^|' . $spaces . ')-(?=$|' . $spaces . ')/' ] = $en_dash;
187
+		$dynamic['/---/'] = $em_dash;
188
+		$dynamic['/(?<=^|'.$spaces.')--(?=$|'.$spaces.')/'] = $em_dash;
189
+		$dynamic['/(?<!xn)--/'] = $en_dash;
190
+		$dynamic['/(?<=^|'.$spaces.')-(?=$|'.$spaces.')/'] = $en_dash;
191 191
 
192
-		$dynamic_characters['dash'] = array_keys( $dynamic );
193
-		$dynamic_replacements['dash'] = array_values( $dynamic );
192
+		$dynamic_characters['dash'] = array_keys($dynamic);
193
+		$dynamic_replacements['dash'] = array_values($dynamic);
194 194
 	}
195 195
 
196 196
 	// Must do this every time in case plugins use these filters in a context sensitive manner
@@ -201,7 +201,7 @@  discard block
 block discarded – undo
201 201
 	 *
202 202
 	 * @param array $default_no_texturize_tags An array of HTML element names.
203 203
 	 */
204
-	$no_texturize_tags = apply_filters( 'no_texturize_tags', $default_no_texturize_tags );
204
+	$no_texturize_tags = apply_filters('no_texturize_tags', $default_no_texturize_tags);
205 205
 	/**
206 206
 	 * Filters the list of shortcodes not to texturize.
207 207
 	 *
@@ -209,84 +209,84 @@  discard block
 block discarded – undo
209 209
 	 *
210 210
 	 * @param array $default_no_texturize_shortcodes An array of shortcode names.
211 211
 	 */
212
-	$no_texturize_shortcodes = apply_filters( 'no_texturize_shortcodes', $default_no_texturize_shortcodes );
212
+	$no_texturize_shortcodes = apply_filters('no_texturize_shortcodes', $default_no_texturize_shortcodes);
213 213
 
214 214
 	$no_texturize_tags_stack = array();
215 215
 	$no_texturize_shortcodes_stack = array();
216 216
 
217 217
 	// Look for shortcodes and HTML elements.
218 218
 
219
-	preg_match_all( '@\[/?([^<>&/\[\]\x00-\x20=]++)@', $text, $matches );
220
-	$tagnames = array_intersect( array_keys( $shortcode_tags ), $matches[1] );
221
-	$found_shortcodes = ! empty( $tagnames );
222
-	$shortcode_regex = $found_shortcodes ? _get_wptexturize_shortcode_regex( $tagnames ) : '';
223
-	$regex = _get_wptexturize_split_regex( $shortcode_regex );
219
+	preg_match_all('@\[/?([^<>&/\[\]\x00-\x20=]++)@', $text, $matches);
220
+	$tagnames = array_intersect(array_keys($shortcode_tags), $matches[1]);
221
+	$found_shortcodes = ! empty($tagnames);
222
+	$shortcode_regex = $found_shortcodes ? _get_wptexturize_shortcode_regex($tagnames) : '';
223
+	$regex = _get_wptexturize_split_regex($shortcode_regex);
224 224
 
225
-	$textarr = preg_split( $regex, $text, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY );
225
+	$textarr = preg_split($regex, $text, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY);
226 226
 
227
-	foreach ( $textarr as &$curl ) {
227
+	foreach ($textarr as &$curl) {
228 228
 		// Only call _wptexturize_pushpop_element if $curl is a delimiter.
229 229
 		$first = $curl[0];
230
-		if ( '<' === $first ) {
231
-			if ( '<!--' === substr( $curl, 0, 4 ) ) {
230
+		if ('<' === $first) {
231
+			if ('<!--' === substr($curl, 0, 4)) {
232 232
 				// This is an HTML comment delimiter.
233 233
 				continue;
234 234
 			} else {
235 235
 				// This is an HTML element delimiter.
236 236
 
237 237
 				// Replace each & with &#038; unless it already looks like an entity.
238
-				$curl = preg_replace( '/&(?!#(?:\d+|x[a-f0-9]+);|[a-z1-4]{1,8};)/i', '&#038;', $curl );
238
+				$curl = preg_replace('/&(?!#(?:\d+|x[a-f0-9]+);|[a-z1-4]{1,8};)/i', '&#038;', $curl);
239 239
 
240
-				_wptexturize_pushpop_element( $curl, $no_texturize_tags_stack, $no_texturize_tags );
240
+				_wptexturize_pushpop_element($curl, $no_texturize_tags_stack, $no_texturize_tags);
241 241
 			}
242 242
 
243
-		} elseif ( '' === trim( $curl ) ) {
243
+		} elseif ('' === trim($curl)) {
244 244
 			// This is a newline between delimiters.  Performance improves when we check this.
245 245
 			continue;
246 246
 
247
-		} elseif ( '[' === $first && $found_shortcodes && 1 === preg_match( '/^' . $shortcode_regex . '$/', $curl ) ) {
247
+		} elseif ('[' === $first && $found_shortcodes && 1 === preg_match('/^'.$shortcode_regex.'$/', $curl)) {
248 248
 			// This is a shortcode delimiter.
249 249
 
250
-			if ( '[[' !== substr( $curl, 0, 2 ) && ']]' !== substr( $curl, -2 ) ) {
250
+			if ('[[' !== substr($curl, 0, 2) && ']]' !== substr($curl, -2)) {
251 251
 				// Looks like a normal shortcode.
252
-				_wptexturize_pushpop_element( $curl, $no_texturize_shortcodes_stack, $no_texturize_shortcodes );
252
+				_wptexturize_pushpop_element($curl, $no_texturize_shortcodes_stack, $no_texturize_shortcodes);
253 253
 			} else {
254 254
 				// Looks like an escaped shortcode.
255 255
 				continue;
256 256
 			}
257 257
 
258
-		} elseif ( empty( $no_texturize_shortcodes_stack ) && empty( $no_texturize_tags_stack ) ) {
258
+		} elseif (empty($no_texturize_shortcodes_stack) && empty($no_texturize_tags_stack)) {
259 259
 			// This is neither a delimiter, nor is this content inside of no_texturize pairs.  Do texturize.
260 260
 
261
-			$curl = str_replace( $static_characters, $static_replacements, $curl );
261
+			$curl = str_replace($static_characters, $static_replacements, $curl);
262 262
 
263
-			if ( false !== strpos( $curl, "'" ) ) {
264
-				$curl = preg_replace( $dynamic_characters['apos'], $dynamic_replacements['apos'], $curl );
265
-				$curl = wptexturize_primes( $curl, "'", $prime, $open_sq_flag, $closing_single_quote );
266
-				$curl = str_replace( $apos_flag, $apos, $curl );
267
-				$curl = str_replace( $open_sq_flag, $opening_single_quote, $curl );
263
+			if (false !== strpos($curl, "'")) {
264
+				$curl = preg_replace($dynamic_characters['apos'], $dynamic_replacements['apos'], $curl);
265
+				$curl = wptexturize_primes($curl, "'", $prime, $open_sq_flag, $closing_single_quote);
266
+				$curl = str_replace($apos_flag, $apos, $curl);
267
+				$curl = str_replace($open_sq_flag, $opening_single_quote, $curl);
268 268
 			}
269
-			if ( false !== strpos( $curl, '"' ) ) {
270
-				$curl = preg_replace( $dynamic_characters['quote'], $dynamic_replacements['quote'], $curl );
271
-				$curl = wptexturize_primes( $curl, '"', $double_prime, $open_q_flag, $closing_quote );
272
-				$curl = str_replace( $open_q_flag, $opening_quote, $curl );
269
+			if (false !== strpos($curl, '"')) {
270
+				$curl = preg_replace($dynamic_characters['quote'], $dynamic_replacements['quote'], $curl);
271
+				$curl = wptexturize_primes($curl, '"', $double_prime, $open_q_flag, $closing_quote);
272
+				$curl = str_replace($open_q_flag, $opening_quote, $curl);
273 273
 			}
274
-			if ( false !== strpos( $curl, '-' ) ) {
275
-				$curl = preg_replace( $dynamic_characters['dash'], $dynamic_replacements['dash'], $curl );
274
+			if (false !== strpos($curl, '-')) {
275
+				$curl = preg_replace($dynamic_characters['dash'], $dynamic_replacements['dash'], $curl);
276 276
 			}
277 277
 
278 278
 			// 9x9 (times), but never 0x9999
279
-			if ( 1 === preg_match( '/(?<=\d)x\d/', $curl ) ) {
279
+			if (1 === preg_match('/(?<=\d)x\d/', $curl)) {
280 280
 				// Searching for a digit is 10 times more expensive than for the x, so we avoid doing this one!
281
-				$curl = preg_replace( '/\b(\d(?(?<=0)[\d\.,]+|[\d\.,]*))x(\d[\d\.,]*)\b/', '$1&#215;$2', $curl );
281
+				$curl = preg_replace('/\b(\d(?(?<=0)[\d\.,]+|[\d\.,]*))x(\d[\d\.,]*)\b/', '$1&#215;$2', $curl);
282 282
 			}
283 283
 
284 284
 			// Replace each & with &#038; unless it already looks like an entity.
285
-			$curl = preg_replace( '/&(?!#(?:\d+|x[a-f0-9]+);|[a-z1-4]{1,8};)/i', '&#038;', $curl );
285
+			$curl = preg_replace('/&(?!#(?:\d+|x[a-f0-9]+);|[a-z1-4]{1,8};)/i', '&#038;', $curl);
286 286
 		}
287 287
 	}
288 288
 
289
-	return implode( '', $textarr );
289
+	return implode('', $textarr);
290 290
 }
291 291
 
292 292
 /**
@@ -303,59 +303,59 @@  discard block
 block discarded – undo
303 303
  * @param string $close_quote The closing quote char to use for replacement.
304 304
  * @return string The $haystack value after primes and quotes replacements.
305 305
  */
306
-function wptexturize_primes( $haystack, $needle, $prime, $open_quote, $close_quote ) {
306
+function wptexturize_primes($haystack, $needle, $prime, $open_quote, $close_quote) {
307 307
 	$spaces = wp_spaces_regexp();
308 308
 	$flag = '<!--wp-prime-or-quote-->';
309
-	$quote_pattern = "/$needle(?=\\Z|[.,:;!?)}\\-\\]]|&gt;|" . $spaces . ")/";
309
+	$quote_pattern = "/$needle(?=\\Z|[.,:;!?)}\\-\\]]|&gt;|".$spaces.")/";
310 310
 	$prime_pattern    = "/(?<=\\d)$needle/";
311 311
 	$flag_after_digit = "/(?<=\\d)$flag/";
312 312
 	$flag_no_digit    = "/(?<!\\d)$flag/";
313 313
 
314
-	$sentences = explode( $open_quote, $haystack );
314
+	$sentences = explode($open_quote, $haystack);
315 315
 
316
-	foreach ( $sentences as $key => &$sentence ) {
317
-		if ( false === strpos( $sentence, $needle ) ) {
316
+	foreach ($sentences as $key => &$sentence) {
317
+		if (false === strpos($sentence, $needle)) {
318 318
 			continue;
319
-		} elseif ( 0 !== $key && 0 === substr_count( $sentence, $close_quote ) ) {
320
-			$sentence = preg_replace( $quote_pattern, $flag, $sentence, -1, $count );
321
-			if ( $count > 1 ) {
319
+		} elseif (0 !== $key && 0 === substr_count($sentence, $close_quote)) {
320
+			$sentence = preg_replace($quote_pattern, $flag, $sentence, -1, $count);
321
+			if ($count > 1) {
322 322
 				// This sentence appears to have multiple closing quotes.  Attempt Vulcan logic.
323
-				$sentence = preg_replace( $flag_no_digit, $close_quote, $sentence, -1, $count2 );
324
-				if ( 0 === $count2 ) {
323
+				$sentence = preg_replace($flag_no_digit, $close_quote, $sentence, -1, $count2);
324
+				if (0 === $count2) {
325 325
 					// Try looking for a quote followed by a period.
326
-					$count2 = substr_count( $sentence, "$flag." );
327
-					if ( $count2 > 0 ) {
326
+					$count2 = substr_count($sentence, "$flag.");
327
+					if ($count2 > 0) {
328 328
 						// Assume the rightmost quote-period match is the end of quotation.
329
-						$pos = strrpos( $sentence, "$flag." );
329
+						$pos = strrpos($sentence, "$flag.");
330 330
 					} else {
331 331
 						// When all else fails, make the rightmost candidate a closing quote.
332 332
 						// This is most likely to be problematic in the context of bug #18549.
333
-						$pos = strrpos( $sentence, $flag );
333
+						$pos = strrpos($sentence, $flag);
334 334
 					}
335
-					$sentence = substr_replace( $sentence, $close_quote, $pos, strlen( $flag ) );
335
+					$sentence = substr_replace($sentence, $close_quote, $pos, strlen($flag));
336 336
 				}
337 337
 				// Use conventional replacement on any remaining primes and quotes.
338
-				$sentence = preg_replace( $prime_pattern, $prime, $sentence );
339
-				$sentence = preg_replace( $flag_after_digit, $prime, $sentence );
340
-				$sentence = str_replace( $flag, $close_quote, $sentence );
341
-			} elseif ( 1 == $count ) {
338
+				$sentence = preg_replace($prime_pattern, $prime, $sentence);
339
+				$sentence = preg_replace($flag_after_digit, $prime, $sentence);
340
+				$sentence = str_replace($flag, $close_quote, $sentence);
341
+			} elseif (1 == $count) {
342 342
 				// Found only one closing quote candidate, so give it priority over primes.
343
-				$sentence = str_replace( $flag, $close_quote, $sentence );
344
-				$sentence = preg_replace( $prime_pattern, $prime, $sentence );
343
+				$sentence = str_replace($flag, $close_quote, $sentence);
344
+				$sentence = preg_replace($prime_pattern, $prime, $sentence);
345 345
 			} else {
346 346
 				// No closing quotes found.  Just run primes pattern.
347
-				$sentence = preg_replace( $prime_pattern, $prime, $sentence );
347
+				$sentence = preg_replace($prime_pattern, $prime, $sentence);
348 348
 			}
349 349
 		} else {
350
-			$sentence = preg_replace( $prime_pattern, $prime, $sentence );
351
-			$sentence = preg_replace( $quote_pattern, $close_quote, $sentence );
350
+			$sentence = preg_replace($prime_pattern, $prime, $sentence);
351
+			$sentence = preg_replace($quote_pattern, $close_quote, $sentence);
352 352
 		}
353
-		if ( '"' == $needle && false !== strpos( $sentence, '"' ) ) {
354
-			$sentence = str_replace( '"', $close_quote, $sentence );
353
+		if ('"' == $needle && false !== strpos($sentence, '"')) {
354
+			$sentence = str_replace('"', $close_quote, $sentence);
355 355
 		}
356 356
 	}
357 357
 
358
-	return implode( $open_quote, $sentences );
358
+	return implode($open_quote, $sentences);
359 359
 }
360 360
 
361 361
 /**
@@ -372,12 +372,12 @@  discard block
 block discarded – undo
372 372
  * @param array  $stack List of open tag elements.
373 373
  * @param array  $disabled_elements The tag names to match against. Spaces are not allowed in tag names.
374 374
  */
375
-function _wptexturize_pushpop_element( $text, &$stack, $disabled_elements ) {
375
+function _wptexturize_pushpop_element($text, &$stack, $disabled_elements) {
376 376
 	// Is it an opening tag or closing tag?
377
-	if ( isset( $text[1] ) && '/' !== $text[1] ) {
377
+	if (isset($text[1]) && '/' !== $text[1]) {
378 378
 		$opening_tag = true;
379 379
 		$name_offset = 1;
380
-	} elseif ( 0 == count( $stack ) ) {
380
+	} elseif (0 == count($stack)) {
381 381
 		// Stack is empty. Just stop.
382 382
 		return;
383 383
 	} else {
@@ -386,17 +386,17 @@  discard block
 block discarded – undo
386 386
 	}
387 387
 
388 388
 	// Parse out the tag name.
389
-	$space = strpos( $text, ' ' );
390
-	if ( false === $space ) {
389
+	$space = strpos($text, ' ');
390
+	if (false === $space) {
391 391
 		$space = -1;
392 392
 	} else {
393 393
 		$space -= $name_offset;
394 394
 	}
395
-	$tag = substr( $text, $name_offset, $space );
395
+	$tag = substr($text, $name_offset, $space);
396 396
 
397 397
 	// Handle disabled tags.
398
-	if ( in_array( $tag, $disabled_elements ) ) {
399
-		if ( $opening_tag ) {
398
+	if (in_array($tag, $disabled_elements)) {
399
+		if ($opening_tag) {
400 400
 			/*
401 401
 			 * This disables texturize until we find a closing tag of our type
402 402
 			 * (e.g. <pre>) even if there was invalid nesting before that
@@ -405,9 +405,9 @@  discard block
 block discarded – undo
405 405
 			 *          "baba" won't be texturize
406 406
 			 */
407 407
 
408
-			array_push( $stack, $tag );
409
-		} elseif ( end( $stack ) == $tag ) {
410
-			array_pop( $stack );
408
+			array_push($stack, $tag);
409
+		} elseif (end($stack) == $tag) {
410
+			array_pop($stack);
411 411
 		}
412 412
 	}
413 413
 }
@@ -426,38 +426,38 @@  discard block
 block discarded – undo
426 426
  *                    after paragraphing. Default true.
427 427
  * @return string Text which has been converted into correct paragraph tags.
428 428
  */
429
-function wpautop( $pee, $br = true ) {
429
+function wpautop($pee, $br = true) {
430 430
 	$pre_tags = array();
431 431
 
432
-	if ( trim($pee) === '' )
432
+	if (trim($pee) === '')
433 433
 		return '';
434 434
 
435 435
 	// Just to make things a little easier, pad the end.
436
-	$pee = $pee . "\n";
436
+	$pee = $pee."\n";
437 437
 
438 438
 	/*
439 439
 	 * Pre tags shouldn't be touched by autop.
440 440
 	 * Replace pre tags with placeholders and bring them back after autop.
441 441
 	 */
442
-	if ( strpos($pee, '<pre') !== false ) {
443
-		$pee_parts = explode( '</pre>', $pee );
442
+	if (strpos($pee, '<pre') !== false) {
443
+		$pee_parts = explode('</pre>', $pee);
444 444
 		$last_pee = array_pop($pee_parts);
445 445
 		$pee = '';
446 446
 		$i = 0;
447 447
 
448
-		foreach ( $pee_parts as $pee_part ) {
448
+		foreach ($pee_parts as $pee_part) {
449 449
 			$start = strpos($pee_part, '<pre');
450 450
 
451 451
 			// Malformed html?
452
-			if ( $start === false ) {
452
+			if ($start === false) {
453 453
 				$pee .= $pee_part;
454 454
 				continue;
455 455
 			}
456 456
 
457 457
 			$name = "<pre wp-pre-tag-$i></pre>";
458
-			$pre_tags[$name] = substr( $pee_part, $start ) . '</pre>';
458
+			$pre_tags[$name] = substr($pee_part, $start).'</pre>';
459 459
 
460
-			$pee .= substr( $pee_part, 0, $start ) . $name;
460
+			$pee .= substr($pee_part, 0, $start).$name;
461 461
 			$i++;
462 462
 		}
463 463
 
@@ -469,47 +469,47 @@  discard block
 block discarded – undo
469 469
 	$allblocks = '(?:table|thead|tfoot|caption|col|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|form|map|area|blockquote|address|math|style|p|h[1-6]|hr|fieldset|legend|section|article|aside|hgroup|header|footer|nav|figure|figcaption|details|menu|summary)';
470 470
 
471 471
 	// Add a double line break above block-level opening tags.
472
-	$pee = preg_replace('!(<' . $allblocks . '[\s/>])!', "\n\n$1", $pee);
472
+	$pee = preg_replace('!(<'.$allblocks.'[\s/>])!', "\n\n$1", $pee);
473 473
 
474 474
 	// Add a double line break below block-level closing tags.
475
-	$pee = preg_replace('!(</' . $allblocks . '>)!', "$1\n\n", $pee);
475
+	$pee = preg_replace('!(</'.$allblocks.'>)!', "$1\n\n", $pee);
476 476
 
477 477
 	// Standardize newline characters to "\n".
478 478
 	$pee = str_replace(array("\r\n", "\r"), "\n", $pee);
479 479
 
480 480
 	// Find newlines in all elements and add placeholders.
481
-	$pee = wp_replace_in_html_tags( $pee, array( "\n" => " <!-- wpnl --> " ) );
481
+	$pee = wp_replace_in_html_tags($pee, array("\n" => " <!-- wpnl --> "));
482 482
 
483 483
 	// Collapse line breaks before and after <option> elements so they don't get autop'd.
484
-	if ( strpos( $pee, '<option' ) !== false ) {
485
-		$pee = preg_replace( '|\s*<option|', '<option', $pee );
486
-		$pee = preg_replace( '|</option>\s*|', '</option>', $pee );
484
+	if (strpos($pee, '<option') !== false) {
485
+		$pee = preg_replace('|\s*<option|', '<option', $pee);
486
+		$pee = preg_replace('|</option>\s*|', '</option>', $pee);
487 487
 	}
488 488
 
489 489
 	/*
490 490
 	 * Collapse line breaks inside <object> elements, before <param> and <embed> elements
491 491
 	 * so they don't get autop'd.
492 492
 	 */
493
-	if ( strpos( $pee, '</object>' ) !== false ) {
494
-		$pee = preg_replace( '|(<object[^>]*>)\s*|', '$1', $pee );
495
-		$pee = preg_replace( '|\s*</object>|', '</object>', $pee );
496
-		$pee = preg_replace( '%\s*(</?(?:param|embed)[^>]*>)\s*%', '$1', $pee );
493
+	if (strpos($pee, '</object>') !== false) {
494
+		$pee = preg_replace('|(<object[^>]*>)\s*|', '$1', $pee);
495
+		$pee = preg_replace('|\s*</object>|', '</object>', $pee);
496
+		$pee = preg_replace('%\s*(</?(?:param|embed)[^>]*>)\s*%', '$1', $pee);
497 497
 	}
498 498
 
499 499
 	/*
500 500
 	 * Collapse line breaks inside <audio> and <video> elements,
501 501
 	 * before and after <source> and <track> elements.
502 502
 	 */
503
-	if ( strpos( $pee, '<source' ) !== false || strpos( $pee, '<track' ) !== false ) {
504
-		$pee = preg_replace( '%([<\[](?:audio|video)[^>\]]*[>\]])\s*%', '$1', $pee );
505
-		$pee = preg_replace( '%\s*([<\[]/(?:audio|video)[>\]])%', '$1', $pee );
506
-		$pee = preg_replace( '%\s*(<(?:source|track)[^>]*>)\s*%', '$1', $pee );
503
+	if (strpos($pee, '<source') !== false || strpos($pee, '<track') !== false) {
504
+		$pee = preg_replace('%([<\[](?:audio|video)[^>\]]*[>\]])\s*%', '$1', $pee);
505
+		$pee = preg_replace('%\s*([<\[]/(?:audio|video)[>\]])%', '$1', $pee);
506
+		$pee = preg_replace('%\s*(<(?:source|track)[^>]*>)\s*%', '$1', $pee);
507 507
 	}
508 508
 
509 509
 	// Collapse line breaks before and after <figcaption> elements.
510
-	if ( strpos( $pee, '<figcaption' ) !== false ) {
511
-		$pee = preg_replace( '|\s*(<figcaption[^>]*>)|', '$1', $pee );
512
-		$pee = preg_replace( '|</figcaption>\s*|', '</figcaption>', $pee );
510
+	if (strpos($pee, '<figcaption') !== false) {
511
+		$pee = preg_replace('|\s*(<figcaption[^>]*>)|', '$1', $pee);
512
+		$pee = preg_replace('|</figcaption>\s*|', '</figcaption>', $pee);
513 513
 	}
514 514
 
515 515
 	// Remove more than two contiguous line breaks.
@@ -522,8 +522,8 @@  discard block
 block discarded – undo
522 522
 	$pee = '';
523 523
 
524 524
 	// Rebuild the content as a string, wrapping every bit with a <p>.
525
-	foreach ( $pees as $tinkle ) {
526
-		$pee .= '<p>' . trim($tinkle, "\n") . "</p>\n";
525
+	foreach ($pees as $tinkle) {
526
+		$pee .= '<p>'.trim($tinkle, "\n")."</p>\n";
527 527
 	}
528 528
 
529 529
 	// Under certain strange conditions it could create a P of entirely whitespace.
@@ -533,7 +533,7 @@  discard block
 block discarded – undo
533 533
 	$pee = preg_replace('!<p>([^<]+)</(div|address|form)>!', "<p>$1</p></$2>", $pee);
534 534
 
535 535
 	// If an opening or closing block element tag is wrapped in a <p>, unwrap it.
536
-	$pee = preg_replace('!<p>\s*(</?' . $allblocks . '[^>]*>)\s*</p>!', "$1", $pee);
536
+	$pee = preg_replace('!<p>\s*(</?'.$allblocks.'[^>]*>)\s*</p>!', "$1", $pee);
537 537
 
538 538
 	// In some cases <li> may get wrapped in <p>, fix them.
539 539
 	$pee = preg_replace("|<p>(<li.+?)</p>|", "$1", $pee);
@@ -543,18 +543,18 @@  discard block
 block discarded – undo
543 543
 	$pee = str_replace('</blockquote></p>', '</p></blockquote>', $pee);
544 544
 
545 545
 	// If an opening or closing block element tag is preceded by an opening <p> tag, remove it.
546
-	$pee = preg_replace('!<p>\s*(</?' . $allblocks . '[^>]*>)!', "$1", $pee);
546
+	$pee = preg_replace('!<p>\s*(</?'.$allblocks.'[^>]*>)!', "$1", $pee);
547 547
 
548 548
 	// If an opening or closing block element tag is followed by a closing <p> tag, remove it.
549
-	$pee = preg_replace('!(</?' . $allblocks . '[^>]*>)\s*</p>!', "$1", $pee);
549
+	$pee = preg_replace('!(</?'.$allblocks.'[^>]*>)\s*</p>!', "$1", $pee);
550 550
 
551 551
 	// Optionally insert line breaks.
552
-	if ( $br ) {
552
+	if ($br) {
553 553
 		// Replace newlines that shouldn't be touched with a placeholder.
554 554
 		$pee = preg_replace_callback('/<(script|style).*?<\/\\1>/s', '_autop_newline_preservation_helper', $pee);
555 555
 
556 556
 		// Normalize <br>
557
-		$pee = str_replace( array( '<br>', '<br/>' ), '<br />', $pee );
557
+		$pee = str_replace(array('<br>', '<br/>'), '<br />', $pee);
558 558
 
559 559
 		// Replace any new line characters that aren't preceded by a <br /> with a <br />.
560 560
 		$pee = preg_replace('|(?<!<br />)\s*\n|', "<br />\n", $pee);
@@ -564,19 +564,19 @@  discard block
 block discarded – undo
564 564
 	}
565 565
 
566 566
 	// If a <br /> tag is after an opening or closing block tag, remove it.
567
-	$pee = preg_replace('!(</?' . $allblocks . '[^>]*>)\s*<br />!', "$1", $pee);
567
+	$pee = preg_replace('!(</?'.$allblocks.'[^>]*>)\s*<br />!', "$1", $pee);
568 568
 
569 569
 	// If a <br /> tag is before a subset of opening or closing block tags, remove it.
570 570
 	$pee = preg_replace('!<br />(\s*</?(?:p|li|div|dl|dd|dt|th|pre|td|ul|ol)[^>]*>)!', '$1', $pee);
571
-	$pee = preg_replace( "|\n</p>$|", '</p>', $pee );
571
+	$pee = preg_replace("|\n</p>$|", '</p>', $pee);
572 572
 
573 573
 	// Replace placeholder <pre> tags with their original content.
574
-	if ( !empty($pre_tags) )
574
+	if ( ! empty($pre_tags))
575 575
 		$pee = str_replace(array_keys($pre_tags), array_values($pre_tags), $pee);
576 576
 
577 577
 	// Restore newlines in all elements.
578
-	if ( false !== strpos( $pee, '<!-- wpnl -->' ) ) {
579
-		$pee = str_replace( array( ' <!-- wpnl --> ', '<!-- wpnl -->' ), "\n", $pee );
578
+	if (false !== strpos($pee, '<!-- wpnl -->')) {
579
+		$pee = str_replace(array(' <!-- wpnl --> ', '<!-- wpnl -->'), "\n", $pee);
580 580
 	}
581 581
 
582 582
 	return $pee;
@@ -590,8 +590,8 @@  discard block
 block discarded – undo
590 590
  * @param string $input The text which has to be formatted.
591 591
  * @return array The formatted text.
592 592
  */
593
-function wp_html_split( $input ) {
594
-	return preg_split( get_html_split_regex(), $input, -1, PREG_SPLIT_DELIM_CAPTURE );
593
+function wp_html_split($input) {
594
+	return preg_split(get_html_split_regex(), $input, -1, PREG_SPLIT_DELIM_CAPTURE);
595 595
 }
596 596
 
597 597
 /**
@@ -604,14 +604,14 @@  discard block
 block discarded – undo
604 604
 function get_html_split_regex() {
605 605
 	static $regex;
606 606
 
607
-	if ( ! isset( $regex ) ) {
607
+	if ( ! isset($regex)) {
608 608
 		$comments =
609 609
 			  '!'           // Start of comment, after the <.
610 610
 			. '(?:'         // Unroll the loop: Consume everything until --> is found.
611 611
 			.     '-(?!->)' // Dash not followed by end of comment.
612 612
 			.     '[^\-]*+' // Consume non-dashes.
613 613
 			. ')*+'         // Loop possessively.
614
-			. '(?:-->)?';   // End of comment. If not found, match all input.
614
+			. '(?:-->)?'; // End of comment. If not found, match all input.
615 615
 
616 616
 		$cdata =
617 617
 			  '!\[CDATA\['  // Start of comment, after the <.
@@ -620,7 +620,7 @@  discard block
 block discarded – undo
620 620
 			.     '](?!]>)' // One ] not followed by end of comment.
621 621
 			.     '[^\]]*+' // Consume non-].
622 622
 			. ')*+'         // Loop possessively.
623
-			. '(?:]]>)?';   // End of comment. If not found, match all input.
623
+			. '(?:]]>)?'; // End of comment. If not found, match all input.
624 624
 
625 625
 		$escaped =
626 626
 			  '(?='           // Is the element escaped?
@@ -659,19 +659,19 @@  discard block
 block discarded – undo
659 659
  * @param string $shortcode_regex The result from _get_wptexturize_shortcode_regex().  Optional.
660 660
  * @return string The regular expression
661 661
  */
662
-function _get_wptexturize_split_regex( $shortcode_regex = '' ) {
662
+function _get_wptexturize_split_regex($shortcode_regex = '') {
663 663
 	static $html_regex;
664 664
 
665
-	if ( ! isset( $html_regex ) ) {
665
+	if ( ! isset($html_regex)) {
666 666
 		$comment_regex =
667 667
 			  '!'           // Start of comment, after the <.
668 668
 			. '(?:'         // Unroll the loop: Consume everything until --> is found.
669 669
 			.     '-(?!->)' // Dash not followed by end of comment.
670 670
 			.     '[^\-]*+' // Consume non-dashes.
671 671
 			. ')*+'         // Loop possessively.
672
-			. '(?:-->)?';   // End of comment. If not found, match all input.
672
+			. '(?:-->)?'; // End of comment. If not found, match all input.
673 673
 
674
-		$html_regex =			 // Needs replaced with wp_html_split() per Shortcode API Roadmap.
674
+		$html_regex = // Needs replaced with wp_html_split() per Shortcode API Roadmap.
675 675
 			  '<'                // Find start of element.
676 676
 			. '(?(?=!--)'        // Is this a comment?
677 677
 			.     $comment_regex // Find end of comment.
@@ -680,10 +680,10 @@  discard block
 block discarded – undo
680 680
 			. ')';
681 681
 	}
682 682
 
683
-	if ( empty( $shortcode_regex ) ) {
684
-		$regex = '/(' . $html_regex . ')/';
683
+	if (empty($shortcode_regex)) {
684
+		$regex = '/('.$html_regex.')/';
685 685
 	} else {
686
-		$regex = '/(' . $html_regex . '|' . $shortcode_regex . ')/';
686
+		$regex = '/('.$html_regex.'|'.$shortcode_regex.')/';
687 687
 	}
688 688
 
689 689
 	return $regex;
@@ -700,8 +700,8 @@  discard block
 block discarded – undo
700 700
  * @param array $tagnames List of shortcodes to find.
701 701
  * @return string The regular expression
702 702
  */
703
-function _get_wptexturize_shortcode_regex( $tagnames ) {
704
-	$tagregexp = join( '|', array_map( 'preg_quote', $tagnames ) );
703
+function _get_wptexturize_shortcode_regex($tagnames) {
704
+	$tagregexp = join('|', array_map('preg_quote', $tagnames));
705 705
 	$tagregexp = "(?:$tagregexp)(?=[\\s\\]\\/])"; // Excerpt of get_shortcode_regex().
706 706
 	$regex =
707 707
 		  '\['              // Find start of shortcode.
@@ -713,7 +713,7 @@  discard block
 block discarded – undo
713 713
 		.     '<[^\[\]>]*>' // HTML elements permitted. Prevents matching ] before >.
714 714
 		. ')*+'             // Possessive critical.
715 715
 		. '\]'              // Find end of shortcode.
716
-		. '\]?';            // Shortcodes may end with ]]
716
+		. '\]?'; // Shortcodes may end with ]]
717 717
 
718 718
 	return $regex;
719 719
 }
@@ -727,32 +727,32 @@  discard block
 block discarded – undo
727 727
  * @param array $replace_pairs In the form array('from' => 'to', ...).
728 728
  * @return string The formatted text.
729 729
  */
730
-function wp_replace_in_html_tags( $haystack, $replace_pairs ) {
730
+function wp_replace_in_html_tags($haystack, $replace_pairs) {
731 731
 	// Find all elements.
732
-	$textarr = wp_html_split( $haystack );
732
+	$textarr = wp_html_split($haystack);
733 733
 	$changed = false;
734 734
 
735 735
 	// Optimize when searching for one item.
736
-	if ( 1 === count( $replace_pairs ) ) {
736
+	if (1 === count($replace_pairs)) {
737 737
 		// Extract $needle and $replace.
738
-		foreach ( $replace_pairs as $needle => $replace );
738
+		foreach ($replace_pairs as $needle => $replace);
739 739
 
740 740
 		// Loop through delimiters (elements) only.
741
-		for ( $i = 1, $c = count( $textarr ); $i < $c; $i += 2 ) {
742
-			if ( false !== strpos( $textarr[$i], $needle ) ) {
743
-				$textarr[$i] = str_replace( $needle, $replace, $textarr[$i] );
741
+		for ($i = 1, $c = count($textarr); $i < $c; $i += 2) {
742
+			if (false !== strpos($textarr[$i], $needle)) {
743
+				$textarr[$i] = str_replace($needle, $replace, $textarr[$i]);
744 744
 				$changed = true;
745 745
 			}
746 746
 		}
747 747
 	} else {
748 748
 		// Extract all $needles.
749
-		$needles = array_keys( $replace_pairs );
749
+		$needles = array_keys($replace_pairs);
750 750
 
751 751
 		// Loop through delimiters (elements) only.
752
-		for ( $i = 1, $c = count( $textarr ); $i < $c; $i += 2 ) {
753
-			foreach ( $needles as $needle ) {
754
-				if ( false !== strpos( $textarr[$i], $needle ) ) {
755
-					$textarr[$i] = strtr( $textarr[$i], $replace_pairs );
752
+		for ($i = 1, $c = count($textarr); $i < $c; $i += 2) {
753
+			foreach ($needles as $needle) {
754
+				if (false !== strpos($textarr[$i], $needle)) {
755
+					$textarr[$i] = strtr($textarr[$i], $replace_pairs);
756 756
 					$changed = true;
757 757
 					// After one strtr() break out of the foreach loop and look at next element.
758 758
 					break;
@@ -761,8 +761,8 @@  discard block
 block discarded – undo
761 761
 		}
762 762
 	}
763 763
 
764
-	if ( $changed ) {
765
-		$haystack = implode( $textarr );
764
+	if ($changed) {
765
+		$haystack = implode($textarr);
766 766
 	}
767 767
 
768 768
 	return $haystack;
@@ -777,8 +777,8 @@  discard block
 block discarded – undo
777 777
  * @param array $matches preg_replace_callback matches array
778 778
  * @return string
779 779
  */
780
-function _autop_newline_preservation_helper( $matches ) {
781
-	return str_replace( "\n", "<WPPreserveNewline />", $matches[0] );
780
+function _autop_newline_preservation_helper($matches) {
781
+	return str_replace("\n", "<WPPreserveNewline />", $matches[0]);
782 782
 }
783 783
 
784 784
 /**
@@ -793,20 +793,20 @@  discard block
 block discarded – undo
793 793
  * @param string $pee The content.
794 794
  * @return string The filtered content.
795 795
  */
796
-function shortcode_unautop( $pee ) {
796
+function shortcode_unautop($pee) {
797 797
 	global $shortcode_tags;
798 798
 
799
-	if ( empty( $shortcode_tags ) || !is_array( $shortcode_tags ) ) {
799
+	if (empty($shortcode_tags) || ! is_array($shortcode_tags)) {
800 800
 		return $pee;
801 801
 	}
802 802
 
803
-	$tagregexp = join( '|', array_map( 'preg_quote', array_keys( $shortcode_tags ) ) );
803
+	$tagregexp = join('|', array_map('preg_quote', array_keys($shortcode_tags)));
804 804
 	$spaces = wp_spaces_regexp();
805 805
 
806 806
 	$pattern =
807 807
 		  '/'
808 808
 		. '<p>'                              // Opening paragraph
809
-		. '(?:' . $spaces . ')*+'            // Optional leading whitespace
809
+		. '(?:'.$spaces.')*+'            // Optional leading whitespace
810 810
 		. '('                                // 1: The shortcode
811 811
 		.     '\\['                          // Opening bracket
812 812
 		.     "($tagregexp)"                 // 2: Shortcode name
@@ -831,11 +831,11 @@  discard block
 block discarded – undo
831 831
 		.         ')?'
832 832
 		.     ')'
833 833
 		. ')'
834
-		. '(?:' . $spaces . ')*+'            // optional trailing whitespace
834
+		. '(?:'.$spaces.')*+'            // optional trailing whitespace
835 835
 		. '<\\/p>'                           // closing paragraph
836 836
 		. '/';
837 837
 
838
-	return preg_replace( $pattern, '$1', $pee );
838
+	return preg_replace($pattern, '$1', $pee);
839 839
 }
840 840
 
841 841
 /**
@@ -850,20 +850,20 @@  discard block
 block discarded – undo
850 850
  * @param string $str The string to be checked
851 851
  * @return bool True if $str fits a UTF-8 model, false otherwise.
852 852
  */
853
-function seems_utf8( $str ) {
853
+function seems_utf8($str) {
854 854
 	mbstring_binary_safe_encoding();
855 855
 	$length = strlen($str);
856 856
 	reset_mbstring_encoding();
857
-	for ($i=0; $i < $length; $i++) {
857
+	for ($i = 0; $i < $length; $i++) {
858 858
 		$c = ord($str[$i]);
859 859
 		if ($c < 0x80) $n = 0; // 0bbbbbbb
860
-		elseif (($c & 0xE0) == 0xC0) $n=1; // 110bbbbb
861
-		elseif (($c & 0xF0) == 0xE0) $n=2; // 1110bbbb
862
-		elseif (($c & 0xF8) == 0xF0) $n=3; // 11110bbb
863
-		elseif (($c & 0xFC) == 0xF8) $n=4; // 111110bb
864
-		elseif (($c & 0xFE) == 0xFC) $n=5; // 1111110b
860
+		elseif (($c & 0xE0) == 0xC0) $n = 1; // 110bbbbb
861
+		elseif (($c & 0xF0) == 0xE0) $n = 2; // 1110bbbb
862
+		elseif (($c & 0xF8) == 0xF0) $n = 3; // 11110bbb
863
+		elseif (($c & 0xFC) == 0xF8) $n = 4; // 111110bb
864
+		elseif (($c & 0xFE) == 0xFC) $n = 5; // 1111110b
865 865
 		else return false; // Does not match any model
866
-		for ($j=0; $j<$n; $j++) { // n bytes matching 10bbbbbb follow ?
866
+		for ($j = 0; $j < $n; $j++) { // n bytes matching 10bbbbbb follow ?
867 867
 			if ((++$i == $length) || ((ord($str[$i]) & 0xC0) != 0x80))
868 868
 				return false;
869 869
 		}
@@ -894,55 +894,55 @@  discard block
 block discarded – undo
894 894
  * @param bool       $double_encode  Optional. Whether to encode existing html entities. Default is false.
895 895
  * @return string The encoded text with HTML entities.
896 896
  */
897
-function _wp_specialchars( $string, $quote_style = ENT_NOQUOTES, $charset = false, $double_encode = false ) {
897
+function _wp_specialchars($string, $quote_style = ENT_NOQUOTES, $charset = false, $double_encode = false) {
898 898
 	$string = (string) $string;
899 899
 
900
-	if ( 0 === strlen( $string ) )
900
+	if (0 === strlen($string))
901 901
 		return '';
902 902
 
903 903
 	// Don't bother if there are no specialchars - saves some processing
904
-	if ( ! preg_match( '/[&<>"\']/', $string ) )
904
+	if ( ! preg_match('/[&<>"\']/', $string))
905 905
 		return $string;
906 906
 
907 907
 	// Account for the previous behaviour of the function when the $quote_style is not an accepted value
908
-	if ( empty( $quote_style ) )
908
+	if (empty($quote_style))
909 909
 		$quote_style = ENT_NOQUOTES;
910
-	elseif ( ! in_array( $quote_style, array( 0, 2, 3, 'single', 'double' ), true ) )
910
+	elseif ( ! in_array($quote_style, array(0, 2, 3, 'single', 'double'), true))
911 911
 		$quote_style = ENT_QUOTES;
912 912
 
913 913
 	// Store the site charset as a static to avoid multiple calls to wp_load_alloptions()
914
-	if ( ! $charset ) {
914
+	if ( ! $charset) {
915 915
 		static $_charset = null;
916
-		if ( ! isset( $_charset ) ) {
916
+		if ( ! isset($_charset)) {
917 917
 			$alloptions = wp_load_alloptions();
918
-			$_charset = isset( $alloptions['blog_charset'] ) ? $alloptions['blog_charset'] : '';
918
+			$_charset = isset($alloptions['blog_charset']) ? $alloptions['blog_charset'] : '';
919 919
 		}
920 920
 		$charset = $_charset;
921 921
 	}
922 922
 
923
-	if ( in_array( $charset, array( 'utf8', 'utf-8', 'UTF8' ) ) )
923
+	if (in_array($charset, array('utf8', 'utf-8', 'UTF8')))
924 924
 		$charset = 'UTF-8';
925 925
 
926 926
 	$_quote_style = $quote_style;
927 927
 
928
-	if ( $quote_style === 'double' ) {
928
+	if ($quote_style === 'double') {
929 929
 		$quote_style = ENT_COMPAT;
930 930
 		$_quote_style = ENT_COMPAT;
931
-	} elseif ( $quote_style === 'single' ) {
931
+	} elseif ($quote_style === 'single') {
932 932
 		$quote_style = ENT_NOQUOTES;
933 933
 	}
934 934
 
935
-	if ( ! $double_encode ) {
935
+	if ( ! $double_encode) {
936 936
 		// Guarantee every &entity; is valid, convert &garbage; into &amp;garbage;
937 937
 		// This is required for PHP < 5.4.0 because ENT_HTML401 flag is unavailable.
938
-		$string = wp_kses_normalize_entities( $string );
938
+		$string = wp_kses_normalize_entities($string);
939 939
 	}
940 940
 
941
-	$string = @htmlspecialchars( $string, $quote_style, $charset, $double_encode );
941
+	$string = @htmlspecialchars($string, $quote_style, $charset, $double_encode);
942 942
 
943 943
 	// Back-compat.
944
-	if ( 'single' === $_quote_style )
945
-		$string = str_replace( "'", '&#039;', $string );
944
+	if ('single' === $_quote_style)
945
+		$string = str_replace("'", '&#039;', $string);
946 946
 
947 947
 	return $string;
948 948
 }
@@ -967,52 +967,52 @@  discard block
 block discarded – undo
967 967
  *                                Default is ENT_NOQUOTES.
968 968
  * @return string The decoded text without HTML entities.
969 969
  */
970
-function wp_specialchars_decode( $string, $quote_style = ENT_NOQUOTES ) {
970
+function wp_specialchars_decode($string, $quote_style = ENT_NOQUOTES) {
971 971
 	$string = (string) $string;
972 972
 
973
-	if ( 0 === strlen( $string ) ) {
973
+	if (0 === strlen($string)) {
974 974
 		return '';
975 975
 	}
976 976
 
977 977
 	// Don't bother if there are no entities - saves a lot of processing
978
-	if ( strpos( $string, '&' ) === false ) {
978
+	if (strpos($string, '&') === false) {
979 979
 		return $string;
980 980
 	}
981 981
 
982 982
 	// Match the previous behaviour of _wp_specialchars() when the $quote_style is not an accepted value
983
-	if ( empty( $quote_style ) ) {
983
+	if (empty($quote_style)) {
984 984
 		$quote_style = ENT_NOQUOTES;
985
-	} elseif ( !in_array( $quote_style, array( 0, 2, 3, 'single', 'double' ), true ) ) {
985
+	} elseif ( ! in_array($quote_style, array(0, 2, 3, 'single', 'double'), true)) {
986 986
 		$quote_style = ENT_QUOTES;
987 987
 	}
988 988
 
989 989
 	// More complete than get_html_translation_table( HTML_SPECIALCHARS )
990
-	$single = array( '&#039;'  => '\'', '&#x27;' => '\'' );
991
-	$single_preg = array( '/&#0*39;/'  => '&#039;', '/&#x0*27;/i' => '&#x27;' );
992
-	$double = array( '&quot;' => '"', '&#034;'  => '"', '&#x22;' => '"' );
993
-	$double_preg = array( '/&#0*34;/'  => '&#034;', '/&#x0*22;/i' => '&#x22;' );
994
-	$others = array( '&lt;'   => '<', '&#060;'  => '<', '&gt;'   => '>', '&#062;'  => '>', '&amp;'  => '&', '&#038;'  => '&', '&#x26;' => '&' );
995
-	$others_preg = array( '/&#0*60;/'  => '&#060;', '/&#0*62;/'  => '&#062;', '/&#0*38;/'  => '&#038;', '/&#x0*26;/i' => '&#x26;' );
996
-
997
-	if ( $quote_style === ENT_QUOTES ) {
998
-		$translation = array_merge( $single, $double, $others );
999
-		$translation_preg = array_merge( $single_preg, $double_preg, $others_preg );
1000
-	} elseif ( $quote_style === ENT_COMPAT || $quote_style === 'double' ) {
1001
-		$translation = array_merge( $double, $others );
1002
-		$translation_preg = array_merge( $double_preg, $others_preg );
1003
-	} elseif ( $quote_style === 'single' ) {
1004
-		$translation = array_merge( $single, $others );
1005
-		$translation_preg = array_merge( $single_preg, $others_preg );
1006
-	} elseif ( $quote_style === ENT_NOQUOTES ) {
990
+	$single = array('&#039;'  => '\'', '&#x27;' => '\'');
991
+	$single_preg = array('/&#0*39;/'  => '&#039;', '/&#x0*27;/i' => '&#x27;');
992
+	$double = array('&quot;' => '"', '&#034;'  => '"', '&#x22;' => '"');
993
+	$double_preg = array('/&#0*34;/'  => '&#034;', '/&#x0*22;/i' => '&#x22;');
994
+	$others = array('&lt;'   => '<', '&#060;'  => '<', '&gt;'   => '>', '&#062;'  => '>', '&amp;'  => '&', '&#038;'  => '&', '&#x26;' => '&');
995
+	$others_preg = array('/&#0*60;/'  => '&#060;', '/&#0*62;/'  => '&#062;', '/&#0*38;/'  => '&#038;', '/&#x0*26;/i' => '&#x26;');
996
+
997
+	if ($quote_style === ENT_QUOTES) {
998
+		$translation = array_merge($single, $double, $others);
999
+		$translation_preg = array_merge($single_preg, $double_preg, $others_preg);
1000
+	} elseif ($quote_style === ENT_COMPAT || $quote_style === 'double') {
1001
+		$translation = array_merge($double, $others);
1002
+		$translation_preg = array_merge($double_preg, $others_preg);
1003
+	} elseif ($quote_style === 'single') {
1004
+		$translation = array_merge($single, $others);
1005
+		$translation_preg = array_merge($single_preg, $others_preg);
1006
+	} elseif ($quote_style === ENT_NOQUOTES) {
1007 1007
 		$translation = $others;
1008 1008
 		$translation_preg = $others_preg;
1009 1009
 	}
1010 1010
 
1011 1011
 	// Remove zero padding on numeric entities
1012
-	$string = preg_replace( array_keys( $translation_preg ), array_values( $translation_preg ), $string );
1012
+	$string = preg_replace(array_keys($translation_preg), array_values($translation_preg), $string);
1013 1013
 
1014 1014
 	// Replace characters according to translation table
1015
-	return strtr( $string, $translation );
1015
+	return strtr($string, $translation);
1016 1016
 }
1017 1017
 
1018 1018
 /**
@@ -1027,40 +1027,40 @@  discard block
 block discarded – undo
1027 1027
  * @param bool    $strip Optional. Whether to attempt to strip out invalid UTF8. Default is false.
1028 1028
  * @return string The checked text.
1029 1029
  */
1030
-function wp_check_invalid_utf8( $string, $strip = false ) {
1030
+function wp_check_invalid_utf8($string, $strip = false) {
1031 1031
 	$string = (string) $string;
1032 1032
 
1033
-	if ( 0 === strlen( $string ) ) {
1033
+	if (0 === strlen($string)) {
1034 1034
 		return '';
1035 1035
 	}
1036 1036
 
1037 1037
 	// Store the site charset as a static to avoid multiple calls to get_option()
1038 1038
 	static $is_utf8 = null;
1039
-	if ( ! isset( $is_utf8 ) ) {
1040
-		$is_utf8 = in_array( get_option( 'blog_charset' ), array( 'utf8', 'utf-8', 'UTF8', 'UTF-8' ) );
1039
+	if ( ! isset($is_utf8)) {
1040
+		$is_utf8 = in_array(get_option('blog_charset'), array('utf8', 'utf-8', 'UTF8', 'UTF-8'));
1041 1041
 	}
1042
-	if ( ! $is_utf8 ) {
1042
+	if ( ! $is_utf8) {
1043 1043
 		return $string;
1044 1044
 	}
1045 1045
 
1046 1046
 	// Check for support for utf8 in the installed PCRE library once and store the result in a static
1047 1047
 	static $utf8_pcre = null;
1048
-	if ( ! isset( $utf8_pcre ) ) {
1049
-		$utf8_pcre = @preg_match( '/^./u', 'a' );
1048
+	if ( ! isset($utf8_pcre)) {
1049
+		$utf8_pcre = @preg_match('/^./u', 'a');
1050 1050
 	}
1051 1051
 	// We can't demand utf8 in the PCRE installation, so just return the string in those cases
1052
-	if ( !$utf8_pcre ) {
1052
+	if ( ! $utf8_pcre) {
1053 1053
 		return $string;
1054 1054
 	}
1055 1055
 
1056 1056
 	// preg_match fails when it encounters invalid UTF8 in $string
1057
-	if ( 1 === @preg_match( '/^./us', $string ) ) {
1057
+	if (1 === @preg_match('/^./us', $string)) {
1058 1058
 		return $string;
1059 1059
 	}
1060 1060
 
1061 1061
 	// Attempt to strip the bad chars if requested (not recommended)
1062
-	if ( $strip && function_exists( 'iconv' ) ) {
1063
-		return iconv( 'utf-8', 'utf-8', $string );
1062
+	if ($strip && function_exists('iconv')) {
1063
+		return iconv('utf-8', 'utf-8', $string);
1064 1064
 	}
1065 1065
 
1066 1066
 	return '';
@@ -1075,30 +1075,30 @@  discard block
 block discarded – undo
1075 1075
  * @param int    $length Max  length of the string
1076 1076
  * @return string String with Unicode encoded for URI.
1077 1077
  */
1078
-function utf8_uri_encode( $utf8_string, $length = 0 ) {
1078
+function utf8_uri_encode($utf8_string, $length = 0) {
1079 1079
 	$unicode = '';
1080 1080
 	$values = array();
1081 1081
 	$num_octets = 1;
1082 1082
 	$unicode_length = 0;
1083 1083
 
1084 1084
 	mbstring_binary_safe_encoding();
1085
-	$string_length = strlen( $utf8_string );
1085
+	$string_length = strlen($utf8_string);
1086 1086
 	reset_mbstring_encoding();
1087 1087
 
1088
-	for ($i = 0; $i < $string_length; $i++ ) {
1088
+	for ($i = 0; $i < $string_length; $i++) {
1089 1089
 
1090
-		$value = ord( $utf8_string[ $i ] );
1090
+		$value = ord($utf8_string[$i]);
1091 1091
 
1092
-		if ( $value < 128 ) {
1093
-			if ( $length && ( $unicode_length >= $length ) )
1092
+		if ($value < 128) {
1093
+			if ($length && ($unicode_length >= $length))
1094 1094
 				break;
1095 1095
 			$unicode .= chr($value);
1096 1096
 			$unicode_length++;
1097 1097
 		} else {
1098
-			if ( count( $values ) == 0 ) {
1099
-				if ( $value < 224 ) {
1098
+			if (count($values) == 0) {
1099
+				if ($value < 224) {
1100 1100
 					$num_octets = 2;
1101
-				} elseif ( $value < 240 ) {
1101
+				} elseif ($value < 240) {
1102 1102
 					$num_octets = 3;
1103 1103
 				} else {
1104 1104
 					$num_octets = 4;
@@ -1107,11 +1107,11 @@  discard block
 block discarded – undo
1107 1107
 
1108 1108
 			$values[] = $value;
1109 1109
 
1110
-			if ( $length && ( $unicode_length + ($num_octets * 3) ) > $length )
1110
+			if ($length && ($unicode_length + ($num_octets * 3)) > $length)
1111 1111
 				break;
1112
-			if ( count( $values ) == $num_octets ) {
1113
-				for ( $j = 0; $j < $num_octets; $j++ ) {
1114
-					$unicode .= '%' . dechex( $values[ $j ] );
1112
+			if (count($values) == $num_octets) {
1113
+				for ($j = 0; $j < $num_octets; $j++) {
1114
+					$unicode .= '%'.dechex($values[$j]);
1115 1115
 				}
1116 1116
 
1117 1117
 				$unicode_length += $num_octets * 3;
@@ -1511,8 +1511,8 @@  discard block
 block discarded – undo
1511 1511
  * @param string $string Text that might have accent characters
1512 1512
  * @return string Filtered string with replaced "nice" characters.
1513 1513
  */
1514
-function remove_accents( $string ) {
1515
-	if ( !preg_match('/[\x80-\xff]/', $string) )
1514
+function remove_accents($string) {
1515
+	if ( ! preg_match('/[\x80-\xff]/', $string))
1516 1516
 		return $string;
1517 1517
 
1518 1518
 	if (seems_utf8($string)) {
@@ -1522,7 +1522,7 @@  discard block
 block discarded – undo
1522 1522
 		'À' => 'A', 'Á' => 'A',
1523 1523
 		'Â' => 'A', 'Ã' => 'A',
1524 1524
 		'Ä' => 'A', 'Å' => 'A',
1525
-		'Æ' => 'AE','Ç' => 'C',
1525
+		'Æ' => 'AE', 'Ç' => 'C',
1526 1526
 		'È' => 'E', 'É' => 'E',
1527 1527
 		'Ê' => 'E', 'Ë' => 'E',
1528 1528
 		'Ì' => 'I', 'Í' => 'I',
@@ -1533,11 +1533,11 @@  discard block
 block discarded – undo
1533 1533
 		'Ö' => 'O', 'Ù' => 'U',
1534 1534
 		'Ú' => 'U', 'Û' => 'U',
1535 1535
 		'Ü' => 'U', 'Ý' => 'Y',
1536
-		'Þ' => 'TH','ß' => 's',
1536
+		'Þ' => 'TH', 'ß' => 's',
1537 1537
 		'à' => 'a', 'á' => 'a',
1538 1538
 		'â' => 'a', 'ã' => 'a',
1539 1539
 		'ä' => 'a', 'å' => 'a',
1540
-		'æ' => 'ae','ç' => 'c',
1540
+		'æ' => 'ae', 'ç' => 'c',
1541 1541
 		'è' => 'e', 'é' => 'e',
1542 1542
 		'ê' => 'e', 'ë' => 'e',
1543 1543
 		'ì' => 'i', 'í' => 'i',
@@ -1576,7 +1576,7 @@  discard block
 block discarded – undo
1576 1576
 		'Ĭ' => 'I', 'ĭ' => 'i',
1577 1577
 		'Į' => 'I', 'į' => 'i',
1578 1578
 		'İ' => 'I', 'ı' => 'i',
1579
-		'IJ' => 'IJ','ij' => 'ij',
1579
+		'IJ' => 'IJ', 'ij' => 'ij',
1580 1580
 		'Ĵ' => 'J', 'ĵ' => 'j',
1581 1581
 		'Ķ' => 'K', 'ķ' => 'k',
1582 1582
 		'ĸ' => 'k', 'Ĺ' => 'L',
@@ -1592,13 +1592,13 @@  discard block
 block discarded – undo
1592 1592
 		'Ō' => 'O', 'ō' => 'o',
1593 1593
 		'Ŏ' => 'O', 'ŏ' => 'o',
1594 1594
 		'Ő' => 'O', 'ő' => 'o',
1595
-		'Œ' => 'OE','œ' => 'oe',
1596
-		'Ŕ' => 'R','ŕ' => 'r',
1597
-		'Ŗ' => 'R','ŗ' => 'r',
1598
-		'Ř' => 'R','ř' => 'r',
1599
-		'Ś' => 'S','ś' => 's',
1600
-		'Ŝ' => 'S','ŝ' => 's',
1601
-		'Ş' => 'S','ş' => 's',
1595
+		'Œ' => 'OE', 'œ' => 'oe',
1596
+		'Ŕ' => 'R', 'ŕ' => 'r',
1597
+		'Ŗ' => 'R', 'ŗ' => 'r',
1598
+		'Ř' => 'R', 'ř' => 'r',
1599
+		'Ś' => 'S', 'ś' => 's',
1600
+		'Ŝ' => 'S', 'ŝ' => 's',
1601
+		'Ş' => 'S', 'ş' => 's',
1602 1602
 		'Š' => 'S', 'š' => 's',
1603 1603
 		'Ţ' => 'T', 'ţ' => 't',
1604 1604
 		'Ť' => 'T', 'ť' => 't',
@@ -1695,26 +1695,26 @@  discard block
 block discarded – undo
1695 1695
 		// Used for locale-specific rules
1696 1696
 		$locale = get_locale();
1697 1697
 
1698
-		if ( 'de_DE' == $locale || 'de_DE_formal' == $locale || 'de_CH' == $locale || 'de_CH_informal' == $locale ) {
1699
-			$chars[ 'Ä' ] = 'Ae';
1700
-			$chars[ 'ä' ] = 'ae';
1701
-			$chars[ 'Ö' ] = 'Oe';
1702
-			$chars[ 'ö' ] = 'oe';
1703
-			$chars[ 'Ü' ] = 'Ue';
1704
-			$chars[ 'ü' ] = 'ue';
1705
-			$chars[ 'ß' ] = 'ss';
1706
-		} elseif ( 'da_DK' === $locale ) {
1707
-			$chars[ 'Æ' ] = 'Ae';
1708
- 			$chars[ 'æ' ] = 'ae';
1709
-			$chars[ 'Ø' ] = 'Oe';
1710
-			$chars[ 'ø' ] = 'oe';
1711
-			$chars[ 'Å' ] = 'Aa';
1712
-			$chars[ 'å' ] = 'aa';
1713
-		} elseif ( 'ca' === $locale ) {
1714
-			$chars[ 'l·l' ] = 'll';
1715
-		} elseif ( 'sr_RS' === $locale || 'bs_BA' === $locale ) {
1716
-			$chars[ 'Đ' ] = 'DJ';
1717
-			$chars[ 'đ' ] = 'dj';
1698
+		if ('de_DE' == $locale || 'de_DE_formal' == $locale || 'de_CH' == $locale || 'de_CH_informal' == $locale) {
1699
+			$chars['Ä'] = 'Ae';
1700
+			$chars['ä'] = 'ae';
1701
+			$chars['Ö'] = 'Oe';
1702
+			$chars['ö'] = 'oe';
1703
+			$chars['Ü'] = 'Ue';
1704
+			$chars['ü'] = 'ue';
1705
+			$chars['ß'] = 'ss';
1706
+		} elseif ('da_DK' === $locale) {
1707
+			$chars['Æ'] = 'Ae';
1708
+ 			$chars['æ'] = 'ae';
1709
+			$chars['Ø'] = 'Oe';
1710
+			$chars['ø'] = 'oe';
1711
+			$chars['Å'] = 'Aa';
1712
+			$chars['å'] = 'aa';
1713
+		} elseif ('ca' === $locale) {
1714
+			$chars['l·l'] = 'll';
1715
+		} elseif ('sr_RS' === $locale || 'bs_BA' === $locale) {
1716
+			$chars['Đ'] = 'DJ';
1717
+			$chars['đ'] = 'dj';
1718 1718
 		}
1719 1719
 
1720 1720
 		$string = strtr($string, $chars);
@@ -1759,7 +1759,7 @@  discard block
 block discarded – undo
1759 1759
  * @param string $filename The filename to be sanitized
1760 1760
  * @return string The sanitized filename
1761 1761
  */
1762
-function sanitize_file_name( $filename ) {
1762
+function sanitize_file_name($filename) {
1763 1763
 	$filename_raw = $filename;
1764 1764
 	$special_chars = array("?", "[", "]", "/", "\\", "=", "<", ">", ":", ";", ",", "'", "\"", "&", "$", "#", "*", "(", ")", "|", "~", "`", "!", "{", "}", "%", "+", chr(0));
1765 1765
 	/**
@@ -1770,18 +1770,18 @@  discard block
 block discarded – undo
1770 1770
 	 * @param array  $special_chars Characters to remove.
1771 1771
 	 * @param string $filename_raw  Filename as it was passed into sanitize_file_name().
1772 1772
 	 */
1773
-	$special_chars = apply_filters( 'sanitize_file_name_chars', $special_chars, $filename_raw );
1774
-	$filename = preg_replace( "#\x{00a0}#siu", ' ', $filename );
1775
-	$filename = str_replace( $special_chars, '', $filename );
1776
-	$filename = str_replace( array( '%20', '+' ), '-', $filename );
1777
-	$filename = preg_replace( '/[\r\n\t -]+/', '-', $filename );
1778
-	$filename = trim( $filename, '.-_' );
1779
-
1780
-	if ( false === strpos( $filename, '.' ) ) {
1773
+	$special_chars = apply_filters('sanitize_file_name_chars', $special_chars, $filename_raw);
1774
+	$filename = preg_replace("#\x{00a0}#siu", ' ', $filename);
1775
+	$filename = str_replace($special_chars, '', $filename);
1776
+	$filename = str_replace(array('%20', '+'), '-', $filename);
1777
+	$filename = preg_replace('/[\r\n\t -]+/', '-', $filename);
1778
+	$filename = trim($filename, '.-_');
1779
+
1780
+	if (false === strpos($filename, '.')) {
1781 1781
 		$mime_types = wp_get_mime_types();
1782
-		$filetype = wp_check_filetype( 'test.' . $filename, $mime_types );
1783
-		if ( $filetype['ext'] === $filename ) {
1784
-			$filename = 'unnamed-file.' . $filetype['ext'];
1782
+		$filetype = wp_check_filetype('test.'.$filename, $mime_types);
1783
+		if ($filetype['ext'] === $filename) {
1784
+			$filename = 'unnamed-file.'.$filetype['ext'];
1785 1785
 		}
1786 1786
 	}
1787 1787
 
@@ -1789,7 +1789,7 @@  discard block
 block discarded – undo
1789 1789
 	$parts = explode('.', $filename);
1790 1790
 
1791 1791
 	// Return if only one extension
1792
-	if ( count( $parts ) <= 2 ) {
1792
+	if (count($parts) <= 2) {
1793 1793
 		/**
1794 1794
 		 * Filters a sanitized filename string.
1795 1795
 		 *
@@ -1798,7 +1798,7 @@  discard block
 block discarded – undo
1798 1798
 		 * @param string $filename     Sanitized filename.
1799 1799
 		 * @param string $filename_raw The filename prior to sanitization.
1800 1800
 		 */
1801
-		return apply_filters( 'sanitize_file_name', $filename, $filename_raw );
1801
+		return apply_filters('sanitize_file_name', $filename, $filename_raw);
1802 1802
 	}
1803 1803
 
1804 1804
 	// Process multiple extensions
@@ -1810,23 +1810,23 @@  discard block
 block discarded – undo
1810 1810
 	 * Loop over any intermediate extensions. Postfix them with a trailing underscore
1811 1811
 	 * if they are a 2 - 5 character long alpha string not in the extension whitelist.
1812 1812
 	 */
1813
-	foreach ( (array) $parts as $part) {
1814
-		$filename .= '.' . $part;
1813
+	foreach ((array) $parts as $part) {
1814
+		$filename .= '.'.$part;
1815 1815
 
1816
-		if ( preg_match("/^[a-zA-Z]{2,5}\d?$/", $part) ) {
1816
+		if (preg_match("/^[a-zA-Z]{2,5}\d?$/", $part)) {
1817 1817
 			$allowed = false;
1818
-			foreach ( $mimes as $ext_preg => $mime_match ) {
1819
-				$ext_preg = '!^(' . $ext_preg . ')$!i';
1820
-				if ( preg_match( $ext_preg, $part ) ) {
1818
+			foreach ($mimes as $ext_preg => $mime_match) {
1819
+				$ext_preg = '!^('.$ext_preg.')$!i';
1820
+				if (preg_match($ext_preg, $part)) {
1821 1821
 					$allowed = true;
1822 1822
 					break;
1823 1823
 				}
1824 1824
 			}
1825
-			if ( !$allowed )
1825
+			if ( ! $allowed)
1826 1826
 				$filename .= '_';
1827 1827
 		}
1828 1828
 	}
1829
-	$filename .= '.' . $extension;
1829
+	$filename .= '.'.$extension;
1830 1830
 	/** This filter is documented in wp-includes/formatting.php */
1831 1831
 	return apply_filters('sanitize_file_name', $filename, $filename_raw);
1832 1832
 }
@@ -1845,21 +1845,21 @@  discard block
 block discarded – undo
1845 1845
  * @param bool   $strict   If set limits $username to specific characters. Default false.
1846 1846
  * @return string The sanitized username, after passing through filters.
1847 1847
  */
1848
-function sanitize_user( $username, $strict = false ) {
1848
+function sanitize_user($username, $strict = false) {
1849 1849
 	$raw_username = $username;
1850
-	$username = wp_strip_all_tags( $username );
1851
-	$username = remove_accents( $username );
1850
+	$username = wp_strip_all_tags($username);
1851
+	$username = remove_accents($username);
1852 1852
 	// Kill octets
1853
-	$username = preg_replace( '|%([a-fA-F0-9][a-fA-F0-9])|', '', $username );
1854
-	$username = preg_replace( '/&.+?;/', '', $username ); // Kill entities
1853
+	$username = preg_replace('|%([a-fA-F0-9][a-fA-F0-9])|', '', $username);
1854
+	$username = preg_replace('/&.+?;/', '', $username); // Kill entities
1855 1855
 
1856 1856
 	// If strict, reduce to ASCII for max portability.
1857
-	if ( $strict )
1858
-		$username = preg_replace( '|[^a-z0-9 _.\-@]|i', '', $username );
1857
+	if ($strict)
1858
+		$username = preg_replace('|[^a-z0-9 _.\-@]|i', '', $username);
1859 1859
 
1860
-	$username = trim( $username );
1860
+	$username = trim($username);
1861 1861
 	// Consolidate contiguous whitespace
1862
-	$username = preg_replace( '|\s+|', ' ', $username );
1862
+	$username = preg_replace('|\s+|', ' ', $username);
1863 1863
 
1864 1864
 	/**
1865 1865
 	 * Filters a sanitized username string.
@@ -1870,7 +1870,7 @@  discard block
 block discarded – undo
1870 1870
 	 * @param string $raw_username The username prior to sanitization.
1871 1871
 	 * @param bool   $strict       Whether to limit the sanitization to specific characters. Default false.
1872 1872
 	 */
1873
-	return apply_filters( 'sanitize_user', $username, $raw_username, $strict );
1873
+	return apply_filters('sanitize_user', $username, $raw_username, $strict);
1874 1874
 }
1875 1875
 
1876 1876
 /**
@@ -1883,10 +1883,10 @@  discard block
 block discarded – undo
1883 1883
  * @param string $key String key
1884 1884
  * @return string Sanitized key
1885 1885
  */
1886
-function sanitize_key( $key ) {
1886
+function sanitize_key($key) {
1887 1887
 	$raw_key = $key;
1888
-	$key = strtolower( $key );
1889
-	$key = preg_replace( '/[^a-z0-9_\-]/', '', $key );
1888
+	$key = strtolower($key);
1889
+	$key = preg_replace('/[^a-z0-9_\-]/', '', $key);
1890 1890
 
1891 1891
 	/**
1892 1892
 	 * Filters a sanitized key string.
@@ -1896,7 +1896,7 @@  discard block
 block discarded – undo
1896 1896
 	 * @param string $key     Sanitized key.
1897 1897
 	 * @param string $raw_key The key prior to sanitization.
1898 1898
 	 */
1899
-	return apply_filters( 'sanitize_key', $key, $raw_key );
1899
+	return apply_filters('sanitize_key', $key, $raw_key);
1900 1900
 }
1901 1901
 
1902 1902
 /**
@@ -1913,10 +1913,10 @@  discard block
 block discarded – undo
1913 1913
  * @param string $context        Optional. The operation for which the string is sanitized
1914 1914
  * @return string The sanitized string.
1915 1915
  */
1916
-function sanitize_title( $title, $fallback_title = '', $context = 'save' ) {
1916
+function sanitize_title($title, $fallback_title = '', $context = 'save') {
1917 1917
 	$raw_title = $title;
1918 1918
 
1919
-	if ( 'save' == $context )
1919
+	if ('save' == $context)
1920 1920
 		$title = remove_accents($title);
1921 1921
 
1922 1922
 	/**
@@ -1928,9 +1928,9 @@  discard block
 block discarded – undo
1928 1928
 	 * @param string $raw_title The title prior to sanitization.
1929 1929
 	 * @param string $context   The context for which the title is being sanitized.
1930 1930
 	 */
1931
-	$title = apply_filters( 'sanitize_title', $title, $raw_title, $context );
1931
+	$title = apply_filters('sanitize_title', $title, $raw_title, $context);
1932 1932
 
1933
-	if ( '' === $title || false === $title )
1933
+	if ('' === $title || false === $title)
1934 1934
 		$title = $fallback_title;
1935 1935
 
1936 1936
 	return $title;
@@ -1946,8 +1946,8 @@  discard block
 block discarded – undo
1946 1946
  * @param string $title The string to be sanitized.
1947 1947
  * @return string The sanitized string.
1948 1948
  */
1949
-function sanitize_title_for_query( $title ) {
1950
-	return sanitize_title( $title, '', 'query' );
1949
+function sanitize_title_for_query($title) {
1950
+	return sanitize_title($title, '', 'query');
1951 1951
 }
1952 1952
 
1953 1953
 /**
@@ -1963,7 +1963,7 @@  discard block
 block discarded – undo
1963 1963
  * @param string $context   Optional. The operation for which the string is sanitized.
1964 1964
  * @return string The sanitized title.
1965 1965
  */
1966
-function sanitize_title_with_dashes( $title, $raw_title = '', $context = 'display' ) {
1966
+function sanitize_title_with_dashes($title, $raw_title = '', $context = 'display') {
1967 1967
 	$title = strip_tags($title);
1968 1968
 	// Preserve escaped octets.
1969 1969
 	$title = preg_replace('|%([a-fA-F0-9][a-fA-F0-9])|', '---$1---', $title);
@@ -1981,14 +1981,14 @@  discard block
 block discarded – undo
1981 1981
 
1982 1982
 	$title = strtolower($title);
1983 1983
 
1984
-	if ( 'save' == $context ) {
1984
+	if ('save' == $context) {
1985 1985
 		// Convert nbsp, ndash and mdash to hyphens
1986
-		$title = str_replace( array( '%c2%a0', '%e2%80%93', '%e2%80%94' ), '-', $title );
1986
+		$title = str_replace(array('%c2%a0', '%e2%80%93', '%e2%80%94'), '-', $title);
1987 1987
 		// Convert nbsp, ndash and mdash HTML entities to hyphens
1988
-		$title = str_replace( array( '&nbsp;', '&#160;', '&ndash;', '&#8211;', '&mdash;', '&#8212;' ), '-', $title );
1988
+		$title = str_replace(array('&nbsp;', '&#160;', '&ndash;', '&#8211;', '&mdash;', '&#8212;'), '-', $title);
1989 1989
 
1990 1990
 		// Strip these characters entirely
1991
-		$title = str_replace( array(
1991
+		$title = str_replace(array(
1992 1992
 			// iexcl and iquest
1993 1993
 			'%c2%a1', '%c2%bf',
1994 1994
 			// angle quotes
@@ -2002,10 +2002,10 @@  discard block
 block discarded – undo
2002 2002
 			'%c2%b4', '%cb%8a', '%cc%81', '%cd%81',
2003 2003
 			// grave accent, macron, caron
2004 2004
 			'%cc%80', '%cc%84', '%cc%8c',
2005
-		), '', $title );
2005
+		), '', $title);
2006 2006
 
2007 2007
 		// Convert times to x
2008
-		$title = str_replace( '%c3%97', 'x', $title );
2008
+		$title = str_replace('%c3%97', 'x', $title);
2009 2009
 	}
2010 2010
 
2011 2011
 	$title = preg_replace('/&.+?;/', '', $title); // kill entities
@@ -2032,8 +2032,8 @@  discard block
 block discarded – undo
2032 2032
  * @param string $orderby Order by clause to be validated.
2033 2033
  * @return string|false Returns $orderby if valid, false otherwise.
2034 2034
  */
2035
-function sanitize_sql_orderby( $orderby ) {
2036
-	if ( preg_match( '/^\s*(([a-z0-9_]+|`[a-z0-9_]+`)(\s+(ASC|DESC))?\s*(,\s*(?=[a-z0-9_`])|$))+$/i', $orderby ) || preg_match( '/^\s*RAND\(\s*\)\s*$/i', $orderby ) ) {
2035
+function sanitize_sql_orderby($orderby) {
2036
+	if (preg_match('/^\s*(([a-z0-9_]+|`[a-z0-9_]+`)(\s+(ASC|DESC))?\s*(,\s*(?=[a-z0-9_`])|$))+$/i', $orderby) || preg_match('/^\s*RAND\(\s*\)\s*$/i', $orderby)) {
2037 2037
 		return $orderby;
2038 2038
 	}
2039 2039
 	return false;
@@ -2054,15 +2054,15 @@  discard block
 block discarded – undo
2054 2054
  * 	Defaults to an empty string.
2055 2055
  * @return string The sanitized value
2056 2056
  */
2057
-function sanitize_html_class( $class, $fallback = '' ) {
2057
+function sanitize_html_class($class, $fallback = '') {
2058 2058
 	//Strip out any % encoded octets
2059
-	$sanitized = preg_replace( '|%[a-fA-F0-9][a-fA-F0-9]|', '', $class );
2059
+	$sanitized = preg_replace('|%[a-fA-F0-9][a-fA-F0-9]|', '', $class);
2060 2060
 
2061 2061
 	//Limit to A-Z,a-z,0-9,_,-
2062
-	$sanitized = preg_replace( '/[^A-Za-z0-9_-]/', '', $sanitized );
2062
+	$sanitized = preg_replace('/[^A-Za-z0-9_-]/', '', $sanitized);
2063 2063
 
2064
-	if ( '' == $sanitized && $fallback ) {
2065
-		return sanitize_html_class( $fallback );
2064
+	if ('' == $sanitized && $fallback) {
2065
+		return sanitize_html_class($fallback);
2066 2066
 	}
2067 2067
 	/**
2068 2068
 	 * Filters a sanitized HTML class string.
@@ -2073,7 +2073,7 @@  discard block
 block discarded – undo
2073 2073
 	 * @param string $class     HTML class before sanitization.
2074 2074
 	 * @param string $fallback  The fallback string.
2075 2075
 	 */
2076
-	return apply_filters( 'sanitize_html_class', $sanitized, $class, $fallback );
2076
+	return apply_filters('sanitize_html_class', $sanitized, $class, $fallback);
2077 2077
 }
2078 2078
 
2079 2079
 /**
@@ -2085,13 +2085,13 @@  discard block
 block discarded – undo
2085 2085
  * @param string $deprecated Not used.
2086 2086
  * @return string Converted string.
2087 2087
  */
2088
-function convert_chars( $content, $deprecated = '' ) {
2089
-	if ( ! empty( $deprecated ) ) {
2090
-		_deprecated_argument( __FUNCTION__, '0.71' );
2088
+function convert_chars($content, $deprecated = '') {
2089
+	if ( ! empty($deprecated)) {
2090
+		_deprecated_argument(__FUNCTION__, '0.71');
2091 2091
 	}
2092 2092
 
2093
-	if ( strpos( $content, '&' ) !== false ) {
2094
-		$content = preg_replace( '/&([^#])(?![a-z1-4]{1,8};)/i', '&#038;$1', $content );
2093
+	if (strpos($content, '&') !== false) {
2094
+		$content = preg_replace('/&([^#])(?![a-z1-4]{1,8};)/i', '&#038;$1', $content);
2095 2095
 	}
2096 2096
 
2097 2097
 	return $content;
@@ -2105,12 +2105,12 @@  discard block
 block discarded – undo
2105 2105
  * @param string $content String with entities that need converting.
2106 2106
  * @return string Converted string.
2107 2107
  */
2108
-function convert_invalid_entities( $content ) {
2108
+function convert_invalid_entities($content) {
2109 2109
 	$wp_htmltranswinuni = array(
2110 2110
 		'&#128;' => '&#8364;', // the Euro sign
2111 2111
 		'&#129;' => '',
2112 2112
 		'&#130;' => '&#8218;', // these are Windows CP1252 specific characters
2113
-		'&#131;' => '&#402;',  // they would look weird on non-Windows browsers
2113
+		'&#131;' => '&#402;', // they would look weird on non-Windows browsers
2114 2114
 		'&#132;' => '&#8222;',
2115 2115
 		'&#133;' => '&#8230;',
2116 2116
 		'&#134;' => '&#8224;',
@@ -2141,8 +2141,8 @@  discard block
 block discarded – undo
2141 2141
 		'&#159;' => '&#376;'
2142 2142
 	);
2143 2143
 
2144
-	if ( strpos( $content, '&#1' ) !== false ) {
2145
-		$content = strtr( $content, $wp_htmltranswinuni );
2144
+	if (strpos($content, '&#1') !== false) {
2145
+		$content = strtr($content, $wp_htmltranswinuni);
2146 2146
 	}
2147 2147
 
2148 2148
 	return $content;
@@ -2157,9 +2157,9 @@  discard block
 block discarded – undo
2157 2157
  * @param bool   $force If true, forces balancing, ignoring the value of the option. Default false.
2158 2158
  * @return string Balanced text
2159 2159
  */
2160
-function balanceTags( $text, $force = false ) {
2161
-	if ( $force || get_option('use_balanceTags') == 1 ) {
2162
-		return force_balance_tags( $text );
2160
+function balanceTags($text, $force = false) {
2161
+	if ($force || get_option('use_balanceTags') == 1) {
2162
+		return force_balance_tags($text);
2163 2163
 	} else {
2164 2164
 		return $text;
2165 2165
 	}
@@ -2183,22 +2183,22 @@  discard block
 block discarded – undo
2183 2183
  * @param string $text Text to be balanced.
2184 2184
  * @return string Balanced text.
2185 2185
  */
2186
-function force_balance_tags( $text ) {
2186
+function force_balance_tags($text) {
2187 2187
 	$tagstack = array();
2188 2188
 	$stacksize = 0;
2189 2189
 	$tagqueue = '';
2190 2190
 	$newtext = '';
2191 2191
 	// Known single-entity/self-closing tags
2192
-	$single_tags = array( 'area', 'base', 'basefont', 'br', 'col', 'command', 'embed', 'frame', 'hr', 'img', 'input', 'isindex', 'link', 'meta', 'param', 'source' );
2192
+	$single_tags = array('area', 'base', 'basefont', 'br', 'col', 'command', 'embed', 'frame', 'hr', 'img', 'input', 'isindex', 'link', 'meta', 'param', 'source');
2193 2193
 	// Tags that can be immediately nested within themselves
2194
-	$nestable_tags = array( 'blockquote', 'div', 'object', 'q', 'span' );
2194
+	$nestable_tags = array('blockquote', 'div', 'object', 'q', 'span');
2195 2195
 
2196 2196
 	// WP bug fix for comments - in case you REALLY meant to type '< !--'
2197 2197
 	$text = str_replace('< !--', '<    !--', $text);
2198 2198
 	// WP bug fix for LOVE <3 (and other situations with '<' before a number)
2199 2199
 	$text = preg_replace('#<([0-9]{1})#', '&lt;$1', $text);
2200 2200
 
2201
-	while ( preg_match("/<(\/?[\w:]*)\s*([^>]*)>/", $text, $regex) ) {
2201
+	while (preg_match("/<(\/?[\w:]*)\s*([^>]*)>/", $text, $regex)) {
2202 2202
 		$newtext .= $tagqueue;
2203 2203
 
2204 2204
 		$i = strpos($text, $regex[0]);
@@ -2207,25 +2207,25 @@  discard block
 block discarded – undo
2207 2207
 		// clear the shifter
2208 2208
 		$tagqueue = '';
2209 2209
 		// Pop or Push
2210
-		if ( isset($regex[1][0]) && '/' == $regex[1][0] ) { // End Tag
2211
-			$tag = strtolower(substr($regex[1],1));
2210
+		if (isset($regex[1][0]) && '/' == $regex[1][0]) { // End Tag
2211
+			$tag = strtolower(substr($regex[1], 1));
2212 2212
 			// if too many closing tags
2213
-			if ( $stacksize <= 0 ) {
2213
+			if ($stacksize <= 0) {
2214 2214
 				$tag = '';
2215 2215
 				// or close to be safe $tag = '/' . $tag;
2216 2216
 			}
2217 2217
 			// if stacktop value = tag close value then pop
2218
-			elseif ( $tagstack[$stacksize - 1] == $tag ) { // found closing tag
2219
-				$tag = '</' . $tag . '>'; // Close Tag
2218
+			elseif ($tagstack[$stacksize - 1] == $tag) { // found closing tag
2219
+				$tag = '</'.$tag.'>'; // Close Tag
2220 2220
 				// Pop
2221
-				array_pop( $tagstack );
2221
+				array_pop($tagstack);
2222 2222
 				$stacksize--;
2223 2223
 			} else { // closing tag not at top, search for it
2224
-				for ( $j = $stacksize-1; $j >= 0; $j-- ) {
2225
-					if ( $tagstack[$j] == $tag ) {
2224
+				for ($j = $stacksize - 1; $j >= 0; $j--) {
2225
+					if ($tagstack[$j] == $tag) {
2226 2226
 					// add tag to tagqueue
2227
-						for ( $k = $stacksize-1; $k >= $j; $k--) {
2228
-							$tagqueue .= '</' . array_pop( $tagstack ) . '>';
2227
+						for ($k = $stacksize - 1; $k >= $j; $k--) {
2228
+							$tagqueue .= '</'.array_pop($tagstack).'>';
2229 2229
 							$stacksize--;
2230 2230
 						}
2231 2231
 						break;
@@ -2239,43 +2239,43 @@  discard block
 block discarded – undo
2239 2239
 			// Tag Cleaning
2240 2240
 
2241 2241
 			// If it's an empty tag "< >", do nothing
2242
-			if ( '' == $tag ) {
2242
+			if ('' == $tag) {
2243 2243
 				// do nothing
2244 2244
 			}
2245 2245
 			// ElseIf it presents itself as a self-closing tag...
2246
-			elseif ( substr( $regex[2], -1 ) == '/' ) {
2246
+			elseif (substr($regex[2], -1) == '/') {
2247 2247
 				// ...but it isn't a known single-entity self-closing tag, then don't let it be treated as such and
2248 2248
 				// immediately close it with a closing tag (the tag will encapsulate no text as a result)
2249
-				if ( ! in_array( $tag, $single_tags ) )
2250
-					$regex[2] = trim( substr( $regex[2], 0, -1 ) ) . "></$tag";
2249
+				if ( ! in_array($tag, $single_tags))
2250
+					$regex[2] = trim(substr($regex[2], 0, -1))."></$tag";
2251 2251
 			}
2252 2252
 			// ElseIf it's a known single-entity tag but it doesn't close itself, do so
2253
-			elseif ( in_array($tag, $single_tags) ) {
2253
+			elseif (in_array($tag, $single_tags)) {
2254 2254
 				$regex[2] .= '/';
2255 2255
 			}
2256 2256
 			// Else it's not a single-entity tag
2257 2257
 			else {
2258 2258
 				// If the top of the stack is the same as the tag we want to push, close previous tag
2259
-				if ( $stacksize > 0 && !in_array($tag, $nestable_tags) && $tagstack[$stacksize - 1] == $tag ) {
2260
-					$tagqueue = '</' . array_pop( $tagstack ) . '>';
2259
+				if ($stacksize > 0 && ! in_array($tag, $nestable_tags) && $tagstack[$stacksize - 1] == $tag) {
2260
+					$tagqueue = '</'.array_pop($tagstack).'>';
2261 2261
 					$stacksize--;
2262 2262
 				}
2263
-				$stacksize = array_push( $tagstack, $tag );
2263
+				$stacksize = array_push($tagstack, $tag);
2264 2264
 			}
2265 2265
 
2266 2266
 			// Attributes
2267 2267
 			$attributes = $regex[2];
2268
-			if ( ! empty( $attributes ) && $attributes[0] != '>' )
2269
-				$attributes = ' ' . $attributes;
2268
+			if ( ! empty($attributes) && $attributes[0] != '>')
2269
+				$attributes = ' '.$attributes;
2270 2270
 
2271
-			$tag = '<' . $tag . $attributes . '>';
2271
+			$tag = '<'.$tag.$attributes.'>';
2272 2272
 			//If already queuing a close tag, then put this tag on, too
2273
-			if ( !empty($tagqueue) ) {
2273
+			if ( ! empty($tagqueue)) {
2274 2274
 				$tagqueue .= $tag;
2275 2275
 				$tag = '';
2276 2276
 			}
2277 2277
 		}
2278
-		$newtext .= substr($text, 0, $i) . $tag;
2278
+		$newtext .= substr($text, 0, $i).$tag;
2279 2279
 		$text = substr($text, $i + $l);
2280 2280
 	}
2281 2281
 
@@ -2286,12 +2286,12 @@  discard block
 block discarded – undo
2286 2286
 	$newtext .= $text;
2287 2287
 
2288 2288
 	// Empty Stack
2289
-	while( $x = array_pop($tagstack) )
2290
-		$newtext .= '</' . $x . '>'; // Add remaining tags to close
2289
+	while ($x = array_pop($tagstack))
2290
+		$newtext .= '</'.$x.'>'; // Add remaining tags to close
2291 2291
 
2292 2292
 	// WP fix for the bug with HTML comments
2293
-	$newtext = str_replace("< !--","<!--",$newtext);
2294
-	$newtext = str_replace("<    !--","< !--",$newtext);
2293
+	$newtext = str_replace("< !--", "<!--", $newtext);
2294
+	$newtext = str_replace("<    !--", "< !--", $newtext);
2295 2295
 
2296 2296
 	return $newtext;
2297 2297
 }
@@ -2312,7 +2312,7 @@  discard block
 block discarded – undo
2312 2312
  *                          Default false.
2313 2313
  * @return string The text after the filter (and possibly htmlspecialchars()) has been run.
2314 2314
  */
2315
-function format_to_edit( $content, $rich_text = false ) {
2315
+function format_to_edit($content, $rich_text = false) {
2316 2316
 	/**
2317 2317
 	 * Filters the text to be formatted for editing.
2318 2318
 	 *
@@ -2320,9 +2320,9 @@  discard block
 block discarded – undo
2320 2320
 	 *
2321 2321
 	 * @param string $content The text, prior to formatting for editing.
2322 2322
 	 */
2323
-	$content = apply_filters( 'format_to_edit', $content );
2324
-	if ( ! $rich_text )
2325
-		$content = esc_textarea( $content );
2323
+	$content = apply_filters('format_to_edit', $content);
2324
+	if ( ! $rich_text)
2325
+		$content = esc_textarea($content);
2326 2326
 	return $content;
2327 2327
 }
2328 2328
 
@@ -2343,8 +2343,8 @@  discard block
 block discarded – undo
2343 2343
  * @param int $threshold  Digit places number needs to be to not have zeros added.
2344 2344
  * @return string Adds leading zeros to number if needed.
2345 2345
  */
2346
-function zeroise( $number, $threshold ) {
2347
-	return sprintf( '%0' . $threshold . 's', $number );
2346
+function zeroise($number, $threshold) {
2347
+	return sprintf('%0'.$threshold.'s', $number);
2348 2348
 }
2349 2349
 
2350 2350
 /**
@@ -2355,10 +2355,10 @@  discard block
 block discarded – undo
2355 2355
  * @param string $string Value to which backslashes will be added.
2356 2356
  * @return string String with backslashes inserted.
2357 2357
  */
2358
-function backslashit( $string ) {
2359
-	if ( isset( $string[0] ) && $string[0] >= '0' && $string[0] <= '9' )
2360
-		$string = '\\\\' . $string;
2361
-	return addcslashes( $string, 'A..Za..z' );
2358
+function backslashit($string) {
2359
+	if (isset($string[0]) && $string[0] >= '0' && $string[0] <= '9')
2360
+		$string = '\\\\'.$string;
2361
+	return addcslashes($string, 'A..Za..z');
2362 2362
 }
2363 2363
 
2364 2364
 /**
@@ -2375,8 +2375,8 @@  discard block
 block discarded – undo
2375 2375
  * @param string $string What to add the trailing slash to.
2376 2376
  * @return string String with trailing slash added.
2377 2377
  */
2378
-function trailingslashit( $string ) {
2379
-	return untrailingslashit( $string ) . '/';
2378
+function trailingslashit($string) {
2379
+	return untrailingslashit($string).'/';
2380 2380
 }
2381 2381
 
2382 2382
 /**
@@ -2390,8 +2390,8 @@  discard block
 block discarded – undo
2390 2390
  * @param string $string What to remove the trailing slashes from.
2391 2391
  * @return string String without the trailing slashes.
2392 2392
  */
2393
-function untrailingslashit( $string ) {
2394
-	return rtrim( $string, '/\\' );
2393
+function untrailingslashit($string) {
2394
+	return rtrim($string, '/\\');
2395 2395
 }
2396 2396
 
2397 2397
 /**
@@ -2406,7 +2406,7 @@  discard block
 block discarded – undo
2406 2406
  * @return string Returns a string escaped with slashes.
2407 2407
  */
2408 2408
 function addslashes_gpc($gpc) {
2409
-	if ( get_magic_quotes_gpc() )
2409
+	if (get_magic_quotes_gpc())
2410 2410
 		$gpc = stripslashes($gpc);
2411 2411
 
2412 2412
 	return wp_slash($gpc);
@@ -2420,8 +2420,8 @@  discard block
 block discarded – undo
2420 2420
  * @param mixed $value The value to be stripped.
2421 2421
  * @return mixed Stripped value.
2422 2422
  */
2423
-function stripslashes_deep( $value ) {
2424
-	return map_deep( $value, 'stripslashes_from_strings_only' );
2423
+function stripslashes_deep($value) {
2424
+	return map_deep($value, 'stripslashes_from_strings_only');
2425 2425
 }
2426 2426
 
2427 2427
 /**
@@ -2432,8 +2432,8 @@  discard block
 block discarded – undo
2432 2432
  * @param mixed $value The array or string to be stripped.
2433 2433
  * @return mixed $value The stripped value.
2434 2434
  */
2435
-function stripslashes_from_strings_only( $value ) {
2436
-	return is_string( $value ) ? stripslashes( $value ) : $value;
2435
+function stripslashes_from_strings_only($value) {
2436
+	return is_string($value) ? stripslashes($value) : $value;
2437 2437
 }
2438 2438
 
2439 2439
 /**
@@ -2444,8 +2444,8 @@  discard block
 block discarded – undo
2444 2444
  * @param mixed $value The array or string to be encoded.
2445 2445
  * @return mixed $value The encoded value.
2446 2446
  */
2447
-function urlencode_deep( $value ) {
2448
-	return map_deep( $value, 'urlencode' );
2447
+function urlencode_deep($value) {
2448
+	return map_deep($value, 'urlencode');
2449 2449
 }
2450 2450
 
2451 2451
 /**
@@ -2456,8 +2456,8 @@  discard block
 block discarded – undo
2456 2456
  * @param mixed $value The array or string to be encoded.
2457 2457
  * @return mixed $value The encoded value.
2458 2458
  */
2459
-function rawurlencode_deep( $value ) {
2460
-	return map_deep( $value, 'rawurlencode' );
2459
+function rawurlencode_deep($value) {
2460
+	return map_deep($value, 'rawurlencode');
2461 2461
 }
2462 2462
 
2463 2463
 /**
@@ -2468,8 +2468,8 @@  discard block
 block discarded – undo
2468 2468
  * @param mixed $value The array or string to be decoded.
2469 2469
  * @return mixed $value The decoded value.
2470 2470
  */
2471
-function urldecode_deep( $value ) {
2472
-	return map_deep( $value, 'urldecode' );
2471
+function urldecode_deep($value) {
2472
+	return map_deep($value, 'urldecode');
2473 2473
 }
2474 2474
 
2475 2475
 /**
@@ -2481,20 +2481,20 @@  discard block
 block discarded – undo
2481 2481
  * @param int    $hex_encoding  Optional. Set to 1 to enable hex encoding.
2482 2482
  * @return string Converted email address.
2483 2483
  */
2484
-function antispambot( $email_address, $hex_encoding = 0 ) {
2484
+function antispambot($email_address, $hex_encoding = 0) {
2485 2485
 	$email_no_spam_address = '';
2486
-	for ( $i = 0, $len = strlen( $email_address ); $i < $len; $i++ ) {
2487
-		$j = rand( 0, 1 + $hex_encoding );
2488
-		if ( $j == 0 ) {
2489
-			$email_no_spam_address .= '&#' . ord( $email_address[$i] ) . ';';
2490
-		} elseif ( $j == 1 ) {
2486
+	for ($i = 0, $len = strlen($email_address); $i < $len; $i++) {
2487
+		$j = rand(0, 1 + $hex_encoding);
2488
+		if ($j == 0) {
2489
+			$email_no_spam_address .= '&#'.ord($email_address[$i]).';';
2490
+		} elseif ($j == 1) {
2491 2491
 			$email_no_spam_address .= $email_address[$i];
2492
-		} elseif ( $j == 2 ) {
2493
-			$email_no_spam_address .= '%' . zeroise( dechex( ord( $email_address[$i] ) ), 2 );
2492
+		} elseif ($j == 2) {
2493
+			$email_no_spam_address .= '%'.zeroise(dechex(ord($email_address[$i])), 2);
2494 2494
 		}
2495 2495
 	}
2496 2496
 
2497
-	return str_replace( '@', '&#64;', $email_no_spam_address );
2497
+	return str_replace('@', '&#64;', $email_no_spam_address);
2498 2498
 }
2499 2499
 
2500 2500
 /**
@@ -2508,10 +2508,10 @@  discard block
 block discarded – undo
2508 2508
  * @param array $matches Single Regex Match.
2509 2509
  * @return string HTML A element with URI address.
2510 2510
  */
2511
-function _make_url_clickable_cb( $matches ) {
2511
+function _make_url_clickable_cb($matches) {
2512 2512
 	$url = $matches[2];
2513 2513
 
2514
-	if ( ')' == $matches[3] && strpos( $url, '(' ) ) {
2514
+	if (')' == $matches[3] && strpos($url, '(')) {
2515 2515
 		// If the trailing character is a closing parethesis, and the URL has an opening parenthesis in it, add the closing parenthesis to the URL.
2516 2516
 		// Then we can let the parenthesis balancer do its thing below.
2517 2517
 		$url .= $matches[3];
@@ -2521,16 +2521,16 @@  discard block
 block discarded – undo
2521 2521
 	}
2522 2522
 
2523 2523
 	// Include parentheses in the URL only if paired
2524
-	while ( substr_count( $url, '(' ) < substr_count( $url, ')' ) ) {
2525
-		$suffix = strrchr( $url, ')' ) . $suffix;
2526
-		$url = substr( $url, 0, strrpos( $url, ')' ) );
2524
+	while (substr_count($url, '(') < substr_count($url, ')')) {
2525
+		$suffix = strrchr($url, ')').$suffix;
2526
+		$url = substr($url, 0, strrpos($url, ')'));
2527 2527
 	}
2528 2528
 
2529 2529
 	$url = esc_url($url);
2530
-	if ( empty($url) )
2530
+	if (empty($url))
2531 2531
 		return $matches[0];
2532 2532
 
2533
-	return $matches[1] . "<a href=\"$url\" rel=\"nofollow\">$url</a>" . $suffix;
2533
+	return $matches[1]."<a href=\"$url\" rel=\"nofollow\">$url</a>".$suffix;
2534 2534
 }
2535 2535
 
2536 2536
 /**
@@ -2544,22 +2544,22 @@  discard block
 block discarded – undo
2544 2544
  * @param array $matches Single Regex Match.
2545 2545
  * @return string HTML A element with URL address.
2546 2546
  */
2547
-function _make_web_ftp_clickable_cb( $matches ) {
2547
+function _make_web_ftp_clickable_cb($matches) {
2548 2548
 	$ret = '';
2549 2549
 	$dest = $matches[2];
2550
-	$dest = 'http://' . $dest;
2550
+	$dest = 'http://'.$dest;
2551 2551
 
2552 2552
 	// removed trailing [.,;:)] from URL
2553
-	if ( in_array( substr($dest, -1), array('.', ',', ';', ':', ')') ) === true ) {
2553
+	if (in_array(substr($dest, -1), array('.', ',', ';', ':', ')')) === true) {
2554 2554
 		$ret = substr($dest, -1);
2555
-		$dest = substr($dest, 0, strlen($dest)-1);
2555
+		$dest = substr($dest, 0, strlen($dest) - 1);
2556 2556
 	}
2557 2557
 
2558 2558
 	$dest = esc_url($dest);
2559
-	if ( empty($dest) )
2559
+	if (empty($dest))
2560 2560
 		return $matches[0];
2561 2561
 
2562
-	return $matches[1] . "<a href=\"$dest\" rel=\"nofollow\">$dest</a>$ret";
2562
+	return $matches[1]."<a href=\"$dest\" rel=\"nofollow\">$dest</a>$ret";
2563 2563
 }
2564 2564
 
2565 2565
 /**
@@ -2573,9 +2573,9 @@  discard block
 block discarded – undo
2573 2573
  * @param array $matches Single Regex Match.
2574 2574
  * @return string HTML A element with email address.
2575 2575
  */
2576
-function _make_email_clickable_cb( $matches ) {
2577
-	$email = $matches[2] . '@' . $matches[3];
2578
-	return $matches[1] . "<a href=\"mailto:$email\">$email</a>";
2576
+function _make_email_clickable_cb($matches) {
2577
+	$email = $matches[2].'@'.$matches[3];
2578
+	return $matches[1]."<a href=\"mailto:$email\">$email</a>";
2579 2579
 }
2580 2580
 
2581 2581
 /**
@@ -2589,30 +2589,30 @@  discard block
 block discarded – undo
2589 2589
  * @param string $text Content to convert URIs.
2590 2590
  * @return string Content with converted URIs.
2591 2591
  */
2592
-function make_clickable( $text ) {
2592
+function make_clickable($text) {
2593 2593
 	$r = '';
2594
-	$textarr = preg_split( '/(<[^<>]+>)/', $text, -1, PREG_SPLIT_DELIM_CAPTURE ); // split out HTML tags
2594
+	$textarr = preg_split('/(<[^<>]+>)/', $text, -1, PREG_SPLIT_DELIM_CAPTURE); // split out HTML tags
2595 2595
 	$nested_code_pre = 0; // Keep track of how many levels link is nested inside <pre> or <code>
2596
-	foreach ( $textarr as $piece ) {
2596
+	foreach ($textarr as $piece) {
2597 2597
 
2598
-		if ( preg_match( '|^<code[\s>]|i', $piece ) || preg_match( '|^<pre[\s>]|i', $piece ) || preg_match( '|^<script[\s>]|i', $piece ) || preg_match( '|^<style[\s>]|i', $piece ) )
2598
+		if (preg_match('|^<code[\s>]|i', $piece) || preg_match('|^<pre[\s>]|i', $piece) || preg_match('|^<script[\s>]|i', $piece) || preg_match('|^<style[\s>]|i', $piece))
2599 2599
 			$nested_code_pre++;
2600
-		elseif ( $nested_code_pre && ( '</code>' === strtolower( $piece ) || '</pre>' === strtolower( $piece ) || '</script>' === strtolower( $piece ) || '</style>' === strtolower( $piece ) ) )
2600
+		elseif ($nested_code_pre && ('</code>' === strtolower($piece) || '</pre>' === strtolower($piece) || '</script>' === strtolower($piece) || '</style>' === strtolower($piece)))
2601 2601
 			$nested_code_pre--;
2602 2602
 
2603
-		if ( $nested_code_pre || empty( $piece ) || ( $piece[0] === '<' && ! preg_match( '|^<\s*[\w]{1,20}+://|', $piece ) ) ) {
2603
+		if ($nested_code_pre || empty($piece) || ($piece[0] === '<' && ! preg_match('|^<\s*[\w]{1,20}+://|', $piece))) {
2604 2604
 			$r .= $piece;
2605 2605
 			continue;
2606 2606
 		}
2607 2607
 
2608 2608
 		// Long strings might contain expensive edge cases ...
2609
-		if ( 10000 < strlen( $piece ) ) {
2609
+		if (10000 < strlen($piece)) {
2610 2610
 			// ... break it up
2611
-			foreach ( _split_str_by_whitespace( $piece, 2100 ) as $chunk ) { // 2100: Extra room for scheme and leading and trailing paretheses
2612
-				if ( 2101 < strlen( $chunk ) ) {
2611
+			foreach (_split_str_by_whitespace($piece, 2100) as $chunk) { // 2100: Extra room for scheme and leading and trailing paretheses
2612
+				if (2101 < strlen($chunk)) {
2613 2613
 					$r .= $chunk; // Too big, no whitespace: bail.
2614 2614
 				} else {
2615
-					$r .= make_clickable( $chunk );
2615
+					$r .= make_clickable($chunk);
2616 2616
 				}
2617 2617
 			}
2618 2618
 		} else {
@@ -2633,18 +2633,18 @@  discard block
 block discarded – undo
2633 2633
 			~xS'; // The regex is a non-anchored pattern and does not have a single fixed starting character.
2634 2634
 			      // Tell PCRE to spend more time optimizing since, when used on a page load, it will probably be used several times.
2635 2635
 
2636
-			$ret = preg_replace_callback( $url_clickable, '_make_url_clickable_cb', $ret );
2636
+			$ret = preg_replace_callback($url_clickable, '_make_url_clickable_cb', $ret);
2637 2637
 
2638
-			$ret = preg_replace_callback( '#([\s>])((www|ftp)\.[\w\\x80-\\xff\#$%&~/.\-;:=,?@\[\]+]+)#is', '_make_web_ftp_clickable_cb', $ret );
2639
-			$ret = preg_replace_callback( '#([\s>])([.0-9a-z_+-]+)@(([0-9a-z-]+\.)+[0-9a-z]{2,})#i', '_make_email_clickable_cb', $ret );
2638
+			$ret = preg_replace_callback('#([\s>])((www|ftp)\.[\w\\x80-\\xff\#$%&~/.\-;:=,?@\[\]+]+)#is', '_make_web_ftp_clickable_cb', $ret);
2639
+			$ret = preg_replace_callback('#([\s>])([.0-9a-z_+-]+)@(([0-9a-z-]+\.)+[0-9a-z]{2,})#i', '_make_email_clickable_cb', $ret);
2640 2640
 
2641
-			$ret = substr( $ret, 1, -1 ); // Remove our whitespace padding.
2641
+			$ret = substr($ret, 1, -1); // Remove our whitespace padding.
2642 2642
 			$r .= $ret;
2643 2643
 		}
2644 2644
 	}
2645 2645
 
2646 2646
 	// Cleanup of accidental links within links
2647
-	return preg_replace( '#(<a([ \r\n\t]+[^>]+?>|>))<a [^>]+?>([^>]+?)</a></a>#i', "$1$3</a>", $r );
2647
+	return preg_replace('#(<a([ \r\n\t]+[^>]+?>|>))<a [^>]+?>([^>]+?)</a></a>#i', "$1$3</a>", $r);
2648 2648
 }
2649 2649
 
2650 2650
 /**
@@ -2676,27 +2676,27 @@  discard block
 block discarded – undo
2676 2676
  * @param int    $goal   The desired chunk length.
2677 2677
  * @return array Numeric array of chunks.
2678 2678
  */
2679
-function _split_str_by_whitespace( $string, $goal ) {
2679
+function _split_str_by_whitespace($string, $goal) {
2680 2680
 	$chunks = array();
2681 2681
 
2682
-	$string_nullspace = strtr( $string, "\r\n\t\v\f ", "\000\000\000\000\000\000" );
2682
+	$string_nullspace = strtr($string, "\r\n\t\v\f ", "\000\000\000\000\000\000");
2683 2683
 
2684
-	while ( $goal < strlen( $string_nullspace ) ) {
2685
-		$pos = strrpos( substr( $string_nullspace, 0, $goal + 1 ), "\000" );
2684
+	while ($goal < strlen($string_nullspace)) {
2685
+		$pos = strrpos(substr($string_nullspace, 0, $goal + 1), "\000");
2686 2686
 
2687
-		if ( false === $pos ) {
2688
-			$pos = strpos( $string_nullspace, "\000", $goal + 1 );
2689
-			if ( false === $pos ) {
2687
+		if (false === $pos) {
2688
+			$pos = strpos($string_nullspace, "\000", $goal + 1);
2689
+			if (false === $pos) {
2690 2690
 				break;
2691 2691
 			}
2692 2692
 		}
2693 2693
 
2694
-		$chunks[] = substr( $string, 0, $pos + 1 );
2695
-		$string = substr( $string, $pos + 1 );
2696
-		$string_nullspace = substr( $string_nullspace, $pos + 1 );
2694
+		$chunks[] = substr($string, 0, $pos + 1);
2695
+		$string = substr($string, $pos + 1);
2696
+		$string_nullspace = substr($string_nullspace, $pos + 1);
2697 2697
 	}
2698 2698
 
2699
-	if ( $string ) {
2699
+	if ($string) {
2700 2700
 		$chunks[] = $string;
2701 2701
 	}
2702 2702
 
@@ -2711,11 +2711,11 @@  discard block
 block discarded – undo
2711 2711
  * @param string $text Content that may contain HTML A elements.
2712 2712
  * @return string Converted content.
2713 2713
  */
2714
-function wp_rel_nofollow( $text ) {
2714
+function wp_rel_nofollow($text) {
2715 2715
 	// This is a pre save filter, so text is already escaped.
2716 2716
 	$text = stripslashes($text);
2717 2717
 	$text = preg_replace_callback('|<a (.+?)>|i', 'wp_rel_nofollow_callback', $text);
2718
-	return wp_slash( $text );
2718
+	return wp_slash($text);
2719 2719
 }
2720 2720
 
2721 2721
 /**
@@ -2729,30 +2729,30 @@  discard block
 block discarded – undo
2729 2729
  * @param array $matches Single Match
2730 2730
  * @return string HTML A Element with rel nofollow.
2731 2731
  */
2732
-function wp_rel_nofollow_callback( $matches ) {
2732
+function wp_rel_nofollow_callback($matches) {
2733 2733
 	$text = $matches[1];
2734
-	$atts = shortcode_parse_atts( $matches[1] );
2734
+	$atts = shortcode_parse_atts($matches[1]);
2735 2735
 	$rel  = 'nofollow';
2736 2736
 
2737
-	if ( preg_match( '%href=["\'](' . preg_quote( set_url_scheme( home_url(), 'http' ) ) . ')%i', $text ) ||
2738
-	     preg_match( '%href=["\'](' . preg_quote( set_url_scheme( home_url(), 'https' ) ) . ')%i', $text )
2737
+	if (preg_match('%href=["\']('.preg_quote(set_url_scheme(home_url(), 'http')).')%i', $text) ||
2738
+	     preg_match('%href=["\']('.preg_quote(set_url_scheme(home_url(), 'https')).')%i', $text)
2739 2739
 	) {
2740 2740
 		return "<a $text>";
2741 2741
 	}
2742 2742
 
2743
-	if ( ! empty( $atts['rel'] ) ) {
2744
-		$parts = array_map( 'trim', explode( ' ', $atts['rel'] ) );
2745
-		if ( false === array_search( 'nofollow', $parts ) ) {
2743
+	if ( ! empty($atts['rel'])) {
2744
+		$parts = array_map('trim', explode(' ', $atts['rel']));
2745
+		if (false === array_search('nofollow', $parts)) {
2746 2746
 			$parts[] = 'nofollow';
2747 2747
 		}
2748
-		$rel = implode( ' ', $parts );
2749
-		unset( $atts['rel'] );
2748
+		$rel = implode(' ', $parts);
2749
+		unset($atts['rel']);
2750 2750
 
2751 2751
 		$html = '';
2752
-		foreach ( $atts as $name => $value ) {
2752
+		foreach ($atts as $name => $value) {
2753 2753
 			$html .= "{$name}=\"$value\" ";
2754 2754
 		}
2755
-		$text = trim( $html );
2755
+		$text = trim($html);
2756 2756
 	}
2757 2757
 	return "<a $text rel=\"$rel\">";
2758 2758
 }
@@ -2772,21 +2772,21 @@  discard block
 block discarded – undo
2772 2772
  * @param array $matches Single match. Smiley code to convert to image.
2773 2773
  * @return string Image string for smiley.
2774 2774
  */
2775
-function translate_smiley( $matches ) {
2775
+function translate_smiley($matches) {
2776 2776
 	global $wpsmiliestrans;
2777 2777
 
2778
-	if ( count( $matches ) == 0 )
2778
+	if (count($matches) == 0)
2779 2779
 		return '';
2780 2780
 
2781
-	$smiley = trim( reset( $matches ) );
2782
-	$img = $wpsmiliestrans[ $smiley ];
2781
+	$smiley = trim(reset($matches));
2782
+	$img = $wpsmiliestrans[$smiley];
2783 2783
 
2784 2784
 	$matches = array();
2785
-	$ext = preg_match( '/\.([^.]+)$/', $img, $matches ) ? strtolower( $matches[1] ) : false;
2786
-	$image_exts = array( 'jpg', 'jpeg', 'jpe', 'gif', 'png' );
2785
+	$ext = preg_match('/\.([^.]+)$/', $img, $matches) ? strtolower($matches[1]) : false;
2786
+	$image_exts = array('jpg', 'jpeg', 'jpe', 'gif', 'png');
2787 2787
 
2788 2788
 	// Don't convert smilies that aren't images - they're probably emoji.
2789
-	if ( ! in_array( $ext, $image_exts ) ) {
2789
+	if ( ! in_array($ext, $image_exts)) {
2790 2790
 		return $img;
2791 2791
 	}
2792 2792
 
@@ -2799,9 +2799,9 @@  discard block
 block discarded – undo
2799 2799
 	 * @param string $img        Filename for the smiley image.
2800 2800
 	 * @param string $site_url   Site URL, as returned by site_url().
2801 2801
 	 */
2802
-	$src_url = apply_filters( 'smilies_src', includes_url( "images/smilies/$img" ), $img, site_url() );
2802
+	$src_url = apply_filters('smilies_src', includes_url("images/smilies/$img"), $img, site_url());
2803 2803
 
2804
-	return sprintf( '<img src="%s" alt="%s" class="wp-smiley" style="height: 1em; max-height: 1em;" />', esc_url( $src_url ), esc_attr( $smiley ) );
2804
+	return sprintf('<img src="%s" alt="%s" class="wp-smiley" style="height: 1em; max-height: 1em;" />', esc_url($src_url), esc_attr($smiley));
2805 2805
 }
2806 2806
 
2807 2807
 /**
@@ -2817,33 +2817,33 @@  discard block
 block discarded – undo
2817 2817
  * @param string $text Content to convert smilies from text.
2818 2818
  * @return string Converted content with text smilies replaced with images.
2819 2819
  */
2820
-function convert_smilies( $text ) {
2820
+function convert_smilies($text) {
2821 2821
 	global $wp_smiliessearch;
2822 2822
 	$output = '';
2823
-	if ( get_option( 'use_smilies' ) && ! empty( $wp_smiliessearch ) ) {
2823
+	if (get_option('use_smilies') && ! empty($wp_smiliessearch)) {
2824 2824
 		// HTML loop taken from texturize function, could possible be consolidated
2825
-		$textarr = preg_split( '/(<.*>)/U', $text, -1, PREG_SPLIT_DELIM_CAPTURE ); // capture the tags as well as in between
2826
-		$stop = count( $textarr );// loop stuff
2825
+		$textarr = preg_split('/(<.*>)/U', $text, -1, PREG_SPLIT_DELIM_CAPTURE); // capture the tags as well as in between
2826
+		$stop = count($textarr); // loop stuff
2827 2827
 
2828 2828
 		// Ignore proessing of specific tags
2829 2829
 		$tags_to_ignore = 'code|pre|style|script|textarea';
2830 2830
 		$ignore_block_element = '';
2831 2831
 
2832
-		for ( $i = 0; $i < $stop; $i++ ) {
2832
+		for ($i = 0; $i < $stop; $i++) {
2833 2833
 			$content = $textarr[$i];
2834 2834
 
2835 2835
 			// If we're in an ignore block, wait until we find its closing tag
2836
-			if ( '' == $ignore_block_element && preg_match( '/^<(' . $tags_to_ignore . ')>/', $content, $matches ) )  {
2836
+			if ('' == $ignore_block_element && preg_match('/^<('.$tags_to_ignore.')>/', $content, $matches)) {
2837 2837
 				$ignore_block_element = $matches[1];
2838 2838
 			}
2839 2839
 
2840 2840
 			// If it's not a tag and not in ignore block
2841
-			if ( '' ==  $ignore_block_element && strlen( $content ) > 0 && '<' != $content[0] ) {
2842
-				$content = preg_replace_callback( $wp_smiliessearch, 'translate_smiley', $content );
2841
+			if ('' == $ignore_block_element && strlen($content) > 0 && '<' != $content[0]) {
2842
+				$content = preg_replace_callback($wp_smiliessearch, 'translate_smiley', $content);
2843 2843
 			}
2844 2844
 
2845 2845
 			// did we exit ignore block
2846
-			if ( '' != $ignore_block_element && '</' . $ignore_block_element . '>' == $content )  {
2846
+			if ('' != $ignore_block_element && '</'.$ignore_block_element.'>' == $content) {
2847 2847
 				$ignore_block_element = '';
2848 2848
 			}
2849 2849
 
@@ -2867,12 +2867,12 @@  discard block
 block discarded – undo
2867 2867
  * @param bool   $deprecated Deprecated.
2868 2868
  * @return string|bool Either false or the valid email address.
2869 2869
  */
2870
-function is_email( $email, $deprecated = false ) {
2871
-	if ( ! empty( $deprecated ) )
2872
-		_deprecated_argument( __FUNCTION__, '3.0.0' );
2870
+function is_email($email, $deprecated = false) {
2871
+	if ( ! empty($deprecated))
2872
+		_deprecated_argument(__FUNCTION__, '3.0.0');
2873 2873
 
2874 2874
 	// Test for the minimum length the email can be
2875
-	if ( strlen( $email ) < 6 ) {
2875
+	if (strlen($email) < 6) {
2876 2876
 		/**
2877 2877
 		 * Filters whether an email address is valid.
2878 2878
 		 *
@@ -2886,65 +2886,65 @@  discard block
 block discarded – undo
2886 2886
 		 * @param string $email    The email address being checked.
2887 2887
 		 * @param string $context  Context under which the email was tested.
2888 2888
 		 */
2889
-		return apply_filters( 'is_email', false, $email, 'email_too_short' );
2889
+		return apply_filters('is_email', false, $email, 'email_too_short');
2890 2890
 	}
2891 2891
 
2892 2892
 	// Test for an @ character after the first position
2893
-	if ( strpos( $email, '@', 1 ) === false ) {
2893
+	if (strpos($email, '@', 1) === false) {
2894 2894
 		/** This filter is documented in wp-includes/formatting.php */
2895
-		return apply_filters( 'is_email', false, $email, 'email_no_at' );
2895
+		return apply_filters('is_email', false, $email, 'email_no_at');
2896 2896
 	}
2897 2897
 
2898 2898
 	// Split out the local and domain parts
2899
-	list( $local, $domain ) = explode( '@', $email, 2 );
2899
+	list($local, $domain) = explode('@', $email, 2);
2900 2900
 
2901 2901
 	// LOCAL PART
2902 2902
 	// Test for invalid characters
2903
-	if ( !preg_match( '/^[a-zA-Z0-9!#$%&\'*+\/=?^_`{|}~\.-]+$/', $local ) ) {
2903
+	if ( ! preg_match('/^[a-zA-Z0-9!#$%&\'*+\/=?^_`{|}~\.-]+$/', $local)) {
2904 2904
 		/** This filter is documented in wp-includes/formatting.php */
2905
-		return apply_filters( 'is_email', false, $email, 'local_invalid_chars' );
2905
+		return apply_filters('is_email', false, $email, 'local_invalid_chars');
2906 2906
 	}
2907 2907
 
2908 2908
 	// DOMAIN PART
2909 2909
 	// Test for sequences of periods
2910
-	if ( preg_match( '/\.{2,}/', $domain ) ) {
2910
+	if (preg_match('/\.{2,}/', $domain)) {
2911 2911
 		/** This filter is documented in wp-includes/formatting.php */
2912
-		return apply_filters( 'is_email', false, $email, 'domain_period_sequence' );
2912
+		return apply_filters('is_email', false, $email, 'domain_period_sequence');
2913 2913
 	}
2914 2914
 
2915 2915
 	// Test for leading and trailing periods and whitespace
2916
-	if ( trim( $domain, " \t\n\r\0\x0B." ) !== $domain ) {
2916
+	if (trim($domain, " \t\n\r\0\x0B.") !== $domain) {
2917 2917
 		/** This filter is documented in wp-includes/formatting.php */
2918
-		return apply_filters( 'is_email', false, $email, 'domain_period_limits' );
2918
+		return apply_filters('is_email', false, $email, 'domain_period_limits');
2919 2919
 	}
2920 2920
 
2921 2921
 	// Split the domain into subs
2922
-	$subs = explode( '.', $domain );
2922
+	$subs = explode('.', $domain);
2923 2923
 
2924 2924
 	// Assume the domain will have at least two subs
2925
-	if ( 2 > count( $subs ) ) {
2925
+	if (2 > count($subs)) {
2926 2926
 		/** This filter is documented in wp-includes/formatting.php */
2927
-		return apply_filters( 'is_email', false, $email, 'domain_no_periods' );
2927
+		return apply_filters('is_email', false, $email, 'domain_no_periods');
2928 2928
 	}
2929 2929
 
2930 2930
 	// Loop through each sub
2931
-	foreach ( $subs as $sub ) {
2931
+	foreach ($subs as $sub) {
2932 2932
 		// Test for leading and trailing hyphens and whitespace
2933
-		if ( trim( $sub, " \t\n\r\0\x0B-" ) !== $sub ) {
2933
+		if (trim($sub, " \t\n\r\0\x0B-") !== $sub) {
2934 2934
 			/** This filter is documented in wp-includes/formatting.php */
2935
-			return apply_filters( 'is_email', false, $email, 'sub_hyphen_limits' );
2935
+			return apply_filters('is_email', false, $email, 'sub_hyphen_limits');
2936 2936
 		}
2937 2937
 
2938 2938
 		// Test for invalid characters
2939
-		if ( !preg_match('/^[a-z0-9-]+$/i', $sub ) ) {
2939
+		if ( ! preg_match('/^[a-z0-9-]+$/i', $sub)) {
2940 2940
 			/** This filter is documented in wp-includes/formatting.php */
2941
-			return apply_filters( 'is_email', false, $email, 'sub_invalid_chars' );
2941
+			return apply_filters('is_email', false, $email, 'sub_invalid_chars');
2942 2942
 		}
2943 2943
 	}
2944 2944
 
2945 2945
 	// Congratulations your email made it!
2946 2946
 	/** This filter is documented in wp-includes/formatting.php */
2947
-	return apply_filters( 'is_email', $email, $email, null );
2947
+	return apply_filters('is_email', $email, $email, null);
2948 2948
 }
2949 2949
 
2950 2950
 /**
@@ -2955,13 +2955,13 @@  discard block
 block discarded – undo
2955 2955
  * @param string $string Subject line
2956 2956
  * @return string Converted string to ASCII
2957 2957
  */
2958
-function wp_iso_descrambler( $string ) {
2958
+function wp_iso_descrambler($string) {
2959 2959
 	/* this may only work with iso-8859-1, I'm afraid */
2960
-	if (!preg_match('#\=\?(.+)\?Q\?(.+)\?\=#i', $string, $matches)) {
2960
+	if ( ! preg_match('#\=\?(.+)\?Q\?(.+)\?\=#i', $string, $matches)) {
2961 2961
 		return $string;
2962 2962
 	} else {
2963 2963
 		$subject = str_replace('_', ' ', $matches[2]);
2964
-		return preg_replace_callback( '#\=([0-9a-f]{2})#i', '_wp_iso_convert', $subject );
2964
+		return preg_replace_callback('#\=([0-9a-f]{2})#i', '_wp_iso_convert', $subject);
2965 2965
 	}
2966 2966
 }
2967 2967
 
@@ -2974,8 +2974,8 @@  discard block
 block discarded – undo
2974 2974
  * @param array $match The preg_replace_callback matches array
2975 2975
  * @return string Converted chars
2976 2976
  */
2977
-function _wp_iso_convert( $match ) {
2978
-	return chr( hexdec( strtolower( $match[1] ) ) );
2977
+function _wp_iso_convert($match) {
2978
+	return chr(hexdec(strtolower($match[1])));
2979 2979
 }
2980 2980
 
2981 2981
 /**
@@ -2992,25 +2992,25 @@  discard block
 block discarded – undo
2992 2992
  * @param string $format The format string for the returned date (default is Y-m-d H:i:s)
2993 2993
  * @return string GMT version of the date provided.
2994 2994
  */
2995
-function get_gmt_from_date( $string, $format = 'Y-m-d H:i:s' ) {
2996
-	$tz = get_option( 'timezone_string' );
2997
-	if ( $tz ) {
2998
-		$datetime = date_create( $string, new DateTimeZone( $tz ) );
2999
-		if ( ! $datetime ) {
3000
-			return gmdate( $format, 0 );
2995
+function get_gmt_from_date($string, $format = 'Y-m-d H:i:s') {
2996
+	$tz = get_option('timezone_string');
2997
+	if ($tz) {
2998
+		$datetime = date_create($string, new DateTimeZone($tz));
2999
+		if ( ! $datetime) {
3000
+			return gmdate($format, 0);
3001 3001
 		}
3002
-		$datetime->setTimezone( new DateTimeZone( 'UTC' ) );
3003
-		$string_gmt = $datetime->format( $format );
3002
+		$datetime->setTimezone(new DateTimeZone('UTC'));
3003
+		$string_gmt = $datetime->format($format);
3004 3004
 	} else {
3005
-		if ( ! preg_match( '#([0-9]{1,4})-([0-9]{1,2})-([0-9]{1,2}) ([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})#', $string, $matches ) ) {
3006
-			$datetime = strtotime( $string );
3007
-			if ( false === $datetime ) {
3008
-				return gmdate( $format, 0 );
3005
+		if ( ! preg_match('#([0-9]{1,4})-([0-9]{1,2})-([0-9]{1,2}) ([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})#', $string, $matches)) {
3006
+			$datetime = strtotime($string);
3007
+			if (false === $datetime) {
3008
+				return gmdate($format, 0);
3009 3009
 			}
3010
-			return gmdate( $format, $datetime );
3010
+			return gmdate($format, $datetime);
3011 3011
 		}
3012
-		$string_time = gmmktime( $matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1] );
3013
-		$string_gmt = gmdate( $format, $string_time - get_option( 'gmt_offset' ) * HOUR_IN_SECONDS );
3012
+		$string_time = gmmktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
3013
+		$string_gmt = gmdate($format, $string_time - get_option('gmt_offset') * HOUR_IN_SECONDS);
3014 3014
 	}
3015 3015
 	return $string_gmt;
3016 3016
 }
@@ -3029,19 +3029,19 @@  discard block
 block discarded – undo
3029 3029
  * @param string $format The format string for the returned date (default is Y-m-d H:i:s)
3030 3030
  * @return string Formatted date relative to the timezone / GMT offset.
3031 3031
  */
3032
-function get_date_from_gmt( $string, $format = 'Y-m-d H:i:s' ) {
3033
-	$tz = get_option( 'timezone_string' );
3034
-	if ( $tz ) {
3035
-		$datetime = date_create( $string, new DateTimeZone( 'UTC' ) );
3036
-		if ( ! $datetime )
3037
-			return date( $format, 0 );
3038
-		$datetime->setTimezone( new DateTimeZone( $tz ) );
3039
-		$string_localtime = $datetime->format( $format );
3032
+function get_date_from_gmt($string, $format = 'Y-m-d H:i:s') {
3033
+	$tz = get_option('timezone_string');
3034
+	if ($tz) {
3035
+		$datetime = date_create($string, new DateTimeZone('UTC'));
3036
+		if ( ! $datetime)
3037
+			return date($format, 0);
3038
+		$datetime->setTimezone(new DateTimeZone($tz));
3039
+		$string_localtime = $datetime->format($format);
3040 3040
 	} else {
3041
-		if ( ! preg_match('#([0-9]{1,4})-([0-9]{1,2})-([0-9]{1,2}) ([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})#', $string, $matches) )
3042
-			return date( $format, 0 );
3043
-		$string_time = gmmktime( $matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1] );
3044
-		$string_localtime = gmdate( $format, $string_time + get_option( 'gmt_offset' ) * HOUR_IN_SECONDS );
3041
+		if ( ! preg_match('#([0-9]{1,4})-([0-9]{1,2})-([0-9]{1,2}) ([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})#', $string, $matches))
3042
+			return date($format, 0);
3043
+		$string_time = gmmktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
3044
+		$string_localtime = gmdate($format, $string_time + get_option('gmt_offset') * HOUR_IN_SECONDS);
3045 3045
 	}
3046 3046
 	return $string_localtime;
3047 3047
 }
@@ -3054,7 +3054,7 @@  discard block
 block discarded – undo
3054 3054
  * @param string $timezone Either 'Z' for 0 offset or '±hhmm'.
3055 3055
  * @return int|float The offset in seconds.
3056 3056
  */
3057
-function iso8601_timezone_to_offset( $timezone ) {
3057
+function iso8601_timezone_to_offset($timezone) {
3058 3058
 	// $timezone is either 'Z' or '[+|-]hhmm'
3059 3059
 	if ($timezone == 'Z') {
3060 3060
 		$offset = 0;
@@ -3076,14 +3076,14 @@  discard block
 block discarded – undo
3076 3076
  * @param string $timezone    Optional. If set to GMT returns the time minus gmt_offset. Default is 'user'.
3077 3077
  * @return string The date and time in MySQL DateTime format - Y-m-d H:i:s.
3078 3078
  */
3079
-function iso8601_to_datetime( $date_string, $timezone = 'user' ) {
3079
+function iso8601_to_datetime($date_string, $timezone = 'user') {
3080 3080
 	$timezone = strtolower($timezone);
3081 3081
 
3082 3082
 	if ($timezone == 'gmt') {
3083 3083
 
3084 3084
 		preg_match('#([0-9]{4})([0-9]{2})([0-9]{2})T([0-9]{2}):([0-9]{2}):([0-9]{2})(Z|[\+|\-][0-9]{2,4}){0,1}#', $date_string, $date_bits);
3085 3085
 
3086
-		if (!empty($date_bits[7])) { // we have a timezone, so let's compute an offset
3086
+		if ( ! empty($date_bits[7])) { // we have a timezone, so let's compute an offset
3087 3087
 			$offset = iso8601_timezone_to_offset($date_bits[7]);
3088 3088
 		} else { // we don't have a timezone, so we assume user local timezone (not server's!)
3089 3089
 			$offset = HOUR_IN_SECONDS * get_option('gmt_offset');
@@ -3107,9 +3107,9 @@  discard block
 block discarded – undo
3107 3107
  * @param string $email Email address to filter.
3108 3108
  * @return string Filtered email address.
3109 3109
  */
3110
-function sanitize_email( $email ) {
3110
+function sanitize_email($email) {
3111 3111
 	// Test for the minimum length the email can be
3112
-	if ( strlen( $email ) < 6 ) {
3112
+	if (strlen($email) < 6) {
3113 3113
 		/**
3114 3114
 		 * Filters a sanitized email address.
3115 3115
 		 *
@@ -3123,82 +3123,82 @@  discard block
 block discarded – undo
3123 3123
 		 * @param string $email   The email address, as provided to sanitize_email().
3124 3124
 		 * @param string $message A message to pass to the user.
3125 3125
 		 */
3126
-		return apply_filters( 'sanitize_email', '', $email, 'email_too_short' );
3126
+		return apply_filters('sanitize_email', '', $email, 'email_too_short');
3127 3127
 	}
3128 3128
 
3129 3129
 	// Test for an @ character after the first position
3130
-	if ( strpos( $email, '@', 1 ) === false ) {
3130
+	if (strpos($email, '@', 1) === false) {
3131 3131
 		/** This filter is documented in wp-includes/formatting.php */
3132
-		return apply_filters( 'sanitize_email', '', $email, 'email_no_at' );
3132
+		return apply_filters('sanitize_email', '', $email, 'email_no_at');
3133 3133
 	}
3134 3134
 
3135 3135
 	// Split out the local and domain parts
3136
-	list( $local, $domain ) = explode( '@', $email, 2 );
3136
+	list($local, $domain) = explode('@', $email, 2);
3137 3137
 
3138 3138
 	// LOCAL PART
3139 3139
 	// Test for invalid characters
3140
-	$local = preg_replace( '/[^a-zA-Z0-9!#$%&\'*+\/=?^_`{|}~\.-]/', '', $local );
3141
-	if ( '' === $local ) {
3140
+	$local = preg_replace('/[^a-zA-Z0-9!#$%&\'*+\/=?^_`{|}~\.-]/', '', $local);
3141
+	if ('' === $local) {
3142 3142
 		/** This filter is documented in wp-includes/formatting.php */
3143
-		return apply_filters( 'sanitize_email', '', $email, 'local_invalid_chars' );
3143
+		return apply_filters('sanitize_email', '', $email, 'local_invalid_chars');
3144 3144
 	}
3145 3145
 
3146 3146
 	// DOMAIN PART
3147 3147
 	// Test for sequences of periods
3148
-	$domain = preg_replace( '/\.{2,}/', '', $domain );
3149
-	if ( '' === $domain ) {
3148
+	$domain = preg_replace('/\.{2,}/', '', $domain);
3149
+	if ('' === $domain) {
3150 3150
 		/** This filter is documented in wp-includes/formatting.php */
3151
-		return apply_filters( 'sanitize_email', '', $email, 'domain_period_sequence' );
3151
+		return apply_filters('sanitize_email', '', $email, 'domain_period_sequence');
3152 3152
 	}
3153 3153
 
3154 3154
 	// Test for leading and trailing periods and whitespace
3155
-	$domain = trim( $domain, " \t\n\r\0\x0B." );
3156
-	if ( '' === $domain ) {
3155
+	$domain = trim($domain, " \t\n\r\0\x0B.");
3156
+	if ('' === $domain) {
3157 3157
 		/** This filter is documented in wp-includes/formatting.php */
3158
-		return apply_filters( 'sanitize_email', '', $email, 'domain_period_limits' );
3158
+		return apply_filters('sanitize_email', '', $email, 'domain_period_limits');
3159 3159
 	}
3160 3160
 
3161 3161
 	// Split the domain into subs
3162
-	$subs = explode( '.', $domain );
3162
+	$subs = explode('.', $domain);
3163 3163
 
3164 3164
 	// Assume the domain will have at least two subs
3165
-	if ( 2 > count( $subs ) ) {
3165
+	if (2 > count($subs)) {
3166 3166
 		/** This filter is documented in wp-includes/formatting.php */
3167
-		return apply_filters( 'sanitize_email', '', $email, 'domain_no_periods' );
3167
+		return apply_filters('sanitize_email', '', $email, 'domain_no_periods');
3168 3168
 	}
3169 3169
 
3170 3170
 	// Create an array that will contain valid subs
3171 3171
 	$new_subs = array();
3172 3172
 
3173 3173
 	// Loop through each sub
3174
-	foreach ( $subs as $sub ) {
3174
+	foreach ($subs as $sub) {
3175 3175
 		// Test for leading and trailing hyphens
3176
-		$sub = trim( $sub, " \t\n\r\0\x0B-" );
3176
+		$sub = trim($sub, " \t\n\r\0\x0B-");
3177 3177
 
3178 3178
 		// Test for invalid characters
3179
-		$sub = preg_replace( '/[^a-z0-9-]+/i', '', $sub );
3179
+		$sub = preg_replace('/[^a-z0-9-]+/i', '', $sub);
3180 3180
 
3181 3181
 		// If there's anything left, add it to the valid subs
3182
-		if ( '' !== $sub ) {
3182
+		if ('' !== $sub) {
3183 3183
 			$new_subs[] = $sub;
3184 3184
 		}
3185 3185
 	}
3186 3186
 
3187 3187
 	// If there aren't 2 or more valid subs
3188
-	if ( 2 > count( $new_subs ) ) {
3188
+	if (2 > count($new_subs)) {
3189 3189
 		/** This filter is documented in wp-includes/formatting.php */
3190
-		return apply_filters( 'sanitize_email', '', $email, 'domain_no_valid_subs' );
3190
+		return apply_filters('sanitize_email', '', $email, 'domain_no_valid_subs');
3191 3191
 	}
3192 3192
 
3193 3193
 	// Join valid subs into the new domain
3194
-	$domain = join( '.', $new_subs );
3194
+	$domain = join('.', $new_subs);
3195 3195
 
3196 3196
 	// Put the email back together
3197
-	$email = $local . '@' . $domain;
3197
+	$email = $local.'@'.$domain;
3198 3198
 
3199 3199
 	// Congratulations your email made it!
3200 3200
 	/** This filter is documented in wp-includes/formatting.php */
3201
-	return apply_filters( 'sanitize_email', $email, $email, null );
3201
+	return apply_filters('sanitize_email', $email, $email, null);
3202 3202
 }
3203 3203
 
3204 3204
 /**
@@ -3213,49 +3213,49 @@  discard block
 block discarded – undo
3213 3213
  * @param int $to   Optional. Unix timestamp to end the time difference. Default becomes time() if not set.
3214 3214
  * @return string Human readable time difference.
3215 3215
  */
3216
-function human_time_diff( $from, $to = '' ) {
3217
-	if ( empty( $to ) ) {
3216
+function human_time_diff($from, $to = '') {
3217
+	if (empty($to)) {
3218 3218
 		$to = time();
3219 3219
 	}
3220 3220
 
3221
-	$diff = (int) abs( $to - $from );
3221
+	$diff = (int) abs($to - $from);
3222 3222
 
3223
-	if ( $diff < HOUR_IN_SECONDS ) {
3224
-		$mins = round( $diff / MINUTE_IN_SECONDS );
3225
-		if ( $mins <= 1 )
3223
+	if ($diff < HOUR_IN_SECONDS) {
3224
+		$mins = round($diff / MINUTE_IN_SECONDS);
3225
+		if ($mins <= 1)
3226 3226
 			$mins = 1;
3227 3227
 		/* translators: Time difference between two dates, in minutes (min=minute). 1: Number of minutes */
3228
-		$since = sprintf( _n( '%s min', '%s mins', $mins ), $mins );
3229
-	} elseif ( $diff < DAY_IN_SECONDS && $diff >= HOUR_IN_SECONDS ) {
3230
-		$hours = round( $diff / HOUR_IN_SECONDS );
3231
-		if ( $hours <= 1 )
3228
+		$since = sprintf(_n('%s min', '%s mins', $mins), $mins);
3229
+	} elseif ($diff < DAY_IN_SECONDS && $diff >= HOUR_IN_SECONDS) {
3230
+		$hours = round($diff / HOUR_IN_SECONDS);
3231
+		if ($hours <= 1)
3232 3232
 			$hours = 1;
3233 3233
 		/* translators: Time difference between two dates, in hours. 1: Number of hours */
3234
-		$since = sprintf( _n( '%s hour', '%s hours', $hours ), $hours );
3235
-	} elseif ( $diff < WEEK_IN_SECONDS && $diff >= DAY_IN_SECONDS ) {
3236
-		$days = round( $diff / DAY_IN_SECONDS );
3237
-		if ( $days <= 1 )
3234
+		$since = sprintf(_n('%s hour', '%s hours', $hours), $hours);
3235
+	} elseif ($diff < WEEK_IN_SECONDS && $diff >= DAY_IN_SECONDS) {
3236
+		$days = round($diff / DAY_IN_SECONDS);
3237
+		if ($days <= 1)
3238 3238
 			$days = 1;
3239 3239
 		/* translators: Time difference between two dates, in days. 1: Number of days */
3240
-		$since = sprintf( _n( '%s day', '%s days', $days ), $days );
3241
-	} elseif ( $diff < MONTH_IN_SECONDS && $diff >= WEEK_IN_SECONDS ) {
3242
-		$weeks = round( $diff / WEEK_IN_SECONDS );
3243
-		if ( $weeks <= 1 )
3240
+		$since = sprintf(_n('%s day', '%s days', $days), $days);
3241
+	} elseif ($diff < MONTH_IN_SECONDS && $diff >= WEEK_IN_SECONDS) {
3242
+		$weeks = round($diff / WEEK_IN_SECONDS);
3243
+		if ($weeks <= 1)
3244 3244
 			$weeks = 1;
3245 3245
 		/* translators: Time difference between two dates, in weeks. 1: Number of weeks */
3246
-		$since = sprintf( _n( '%s week', '%s weeks', $weeks ), $weeks );
3247
-	} elseif ( $diff < YEAR_IN_SECONDS && $diff >= MONTH_IN_SECONDS ) {
3248
-		$months = round( $diff / MONTH_IN_SECONDS );
3249
-		if ( $months <= 1 )
3246
+		$since = sprintf(_n('%s week', '%s weeks', $weeks), $weeks);
3247
+	} elseif ($diff < YEAR_IN_SECONDS && $diff >= MONTH_IN_SECONDS) {
3248
+		$months = round($diff / MONTH_IN_SECONDS);
3249
+		if ($months <= 1)
3250 3250
 			$months = 1;
3251 3251
 		/* translators: Time difference between two dates, in months. 1: Number of months */
3252
-		$since = sprintf( _n( '%s month', '%s months', $months ), $months );
3253
-	} elseif ( $diff >= YEAR_IN_SECONDS ) {
3254
-		$years = round( $diff / YEAR_IN_SECONDS );
3255
-		if ( $years <= 1 )
3252
+		$since = sprintf(_n('%s month', '%s months', $months), $months);
3253
+	} elseif ($diff >= YEAR_IN_SECONDS) {
3254
+		$years = round($diff / YEAR_IN_SECONDS);
3255
+		if ($years <= 1)
3256 3256
 			$years = 1;
3257 3257
 		/* translators: Time difference between two dates, in years. 1: Number of years */
3258
-		$since = sprintf( _n( '%s year', '%s years', $years ), $years );
3258
+		$since = sprintf(_n('%s year', '%s years', $years), $years);
3259 3259
 	}
3260 3260
 
3261 3261
 	/**
@@ -3268,7 +3268,7 @@  discard block
 block discarded – undo
3268 3268
 	 * @param int    $from  Unix timestamp from which the difference begins.
3269 3269
 	 * @param int    $to    Unix timestamp to end the time difference.
3270 3270
 	 */
3271
-	return apply_filters( 'human_time_diff', $since, $diff, $from, $to );
3271
+	return apply_filters('human_time_diff', $since, $diff, $from, $to);
3272 3272
 }
3273 3273
 
3274 3274
 /**
@@ -3286,15 +3286,15 @@  discard block
 block discarded – undo
3286 3286
  * @param string $text Optional. The excerpt. If set to empty, an excerpt is generated.
3287 3287
  * @return string The excerpt.
3288 3288
  */
3289
-function wp_trim_excerpt( $text = '' ) {
3289
+function wp_trim_excerpt($text = '') {
3290 3290
 	$raw_excerpt = $text;
3291
-	if ( '' == $text ) {
3291
+	if ('' == $text) {
3292 3292
 		$text = get_the_content('');
3293 3293
 
3294
-		$text = strip_shortcodes( $text );
3294
+		$text = strip_shortcodes($text);
3295 3295
 
3296 3296
 		/** This filter is documented in wp-includes/post-template.php */
3297
-		$text = apply_filters( 'the_content', $text );
3297
+		$text = apply_filters('the_content', $text);
3298 3298
 		$text = str_replace(']]>', ']]&gt;', $text);
3299 3299
 
3300 3300
 		/**
@@ -3304,7 +3304,7 @@  discard block
 block discarded – undo
3304 3304
 		 *
3305 3305
 		 * @param int $number The number of words. Default 55.
3306 3306
 		 */
3307
-		$excerpt_length = apply_filters( 'excerpt_length', 55 );
3307
+		$excerpt_length = apply_filters('excerpt_length', 55);
3308 3308
 		/**
3309 3309
 		 * Filters the string in the "more" link displayed after a trimmed excerpt.
3310 3310
 		 *
@@ -3312,8 +3312,8 @@  discard block
 block discarded – undo
3312 3312
 		 *
3313 3313
 		 * @param string $more_string The string shown within the more link.
3314 3314
 		 */
3315
-		$excerpt_more = apply_filters( 'excerpt_more', ' ' . '[&hellip;]' );
3316
-		$text = wp_trim_words( $text, $excerpt_length, $excerpt_more );
3315
+		$excerpt_more = apply_filters('excerpt_more', ' '.'[&hellip;]');
3316
+		$text = wp_trim_words($text, $excerpt_length, $excerpt_more);
3317 3317
 	}
3318 3318
 	/**
3319 3319
 	 * Filters the trimmed excerpt string.
@@ -3323,7 +3323,7 @@  discard block
 block discarded – undo
3323 3323
 	 * @param string $text        The trimmed text.
3324 3324
 	 * @param string $raw_excerpt The text prior to trimming.
3325 3325
 	 */
3326
-	return apply_filters( 'wp_trim_excerpt', $text, $raw_excerpt );
3326
+	return apply_filters('wp_trim_excerpt', $text, $raw_excerpt);
3327 3327
 }
3328 3328
 
3329 3329
 /**
@@ -3340,35 +3340,35 @@  discard block
 block discarded – undo
3340 3340
  * @param string $more      Optional. What to append if $text needs to be trimmed. Default '&hellip;'.
3341 3341
  * @return string Trimmed text.
3342 3342
  */
3343
-function wp_trim_words( $text, $num_words = 55, $more = null ) {
3344
-	if ( null === $more ) {
3345
-		$more = __( '&hellip;' );
3343
+function wp_trim_words($text, $num_words = 55, $more = null) {
3344
+	if (null === $more) {
3345
+		$more = __('&hellip;');
3346 3346
 	}
3347 3347
 
3348 3348
 	$original_text = $text;
3349
-	$text = wp_strip_all_tags( $text );
3349
+	$text = wp_strip_all_tags($text);
3350 3350
 
3351 3351
 	/*
3352 3352
 	 * translators: If your word count is based on single characters (e.g. East Asian characters),
3353 3353
 	 * enter 'characters_excluding_spaces' or 'characters_including_spaces'. Otherwise, enter 'words'.
3354 3354
 	 * Do not translate into your own language.
3355 3355
 	 */
3356
-	if ( strpos( _x( 'words', 'Word count type. Do not translate!' ), 'characters' ) === 0 && preg_match( '/^utf\-?8$/i', get_option( 'blog_charset' ) ) ) {
3357
-		$text = trim( preg_replace( "/[\n\r\t ]+/", ' ', $text ), ' ' );
3358
-		preg_match_all( '/./u', $text, $words_array );
3359
-		$words_array = array_slice( $words_array[0], 0, $num_words + 1 );
3356
+	if (strpos(_x('words', 'Word count type. Do not translate!'), 'characters') === 0 && preg_match('/^utf\-?8$/i', get_option('blog_charset'))) {
3357
+		$text = trim(preg_replace("/[\n\r\t ]+/", ' ', $text), ' ');
3358
+		preg_match_all('/./u', $text, $words_array);
3359
+		$words_array = array_slice($words_array[0], 0, $num_words + 1);
3360 3360
 		$sep = '';
3361 3361
 	} else {
3362
-		$words_array = preg_split( "/[\n\r\t ]+/", $text, $num_words + 1, PREG_SPLIT_NO_EMPTY );
3362
+		$words_array = preg_split("/[\n\r\t ]+/", $text, $num_words + 1, PREG_SPLIT_NO_EMPTY);
3363 3363
 		$sep = ' ';
3364 3364
 	}
3365 3365
 
3366
-	if ( count( $words_array ) > $num_words ) {
3367
-		array_pop( $words_array );
3368
-		$text = implode( $sep, $words_array );
3369
-		$text = $text . $more;
3366
+	if (count($words_array) > $num_words) {
3367
+		array_pop($words_array);
3368
+		$text = implode($sep, $words_array);
3369
+		$text = $text.$more;
3370 3370
 	} else {
3371
-		$text = implode( $sep, $words_array );
3371
+		$text = implode($sep, $words_array);
3372 3372
 	}
3373 3373
 
3374 3374
 	/**
@@ -3381,7 +3381,7 @@  discard block
 block discarded – undo
3381 3381
 	 * @param string $more          An optional string to append to the end of the trimmed text, e.g. &hellip;.
3382 3382
 	 * @param string $original_text The text before it was trimmed.
3383 3383
 	 */
3384
-	return apply_filters( 'wp_trim_words', $text, $num_words, $more, $original_text );
3384
+	return apply_filters('wp_trim_words', $text, $num_words, $more, $original_text);
3385 3385
 }
3386 3386
 
3387 3387
 /**
@@ -3392,7 +3392,7 @@  discard block
 block discarded – undo
3392 3392
  * @param string $text The text within which entities will be converted.
3393 3393
  * @return string Text with converted entities.
3394 3394
  */
3395
-function ent2ncr( $text ) {
3395
+function ent2ncr($text) {
3396 3396
 
3397 3397
 	/**
3398 3398
 	 * Filters text before named entities are converted into numbered entities.
@@ -3404,8 +3404,8 @@  discard block
 block discarded – undo
3404 3404
 	 * @param null   $converted_text The text to be converted. Default null.
3405 3405
 	 * @param string $text           The text prior to entity conversion.
3406 3406
 	 */
3407
-	$filtered = apply_filters( 'pre_ent2ncr', null, $text );
3408
-	if ( null !== $filtered )
3407
+	$filtered = apply_filters('pre_ent2ncr', null, $text);
3408
+	if (null !== $filtered)
3409 3409
 		return $filtered;
3410 3410
 
3411 3411
 	$to_ncr = array(
@@ -3667,7 +3667,7 @@  discard block
 block discarded – undo
3667 3667
 		'&diams;' => '&#9830;'
3668 3668
 	);
3669 3669
 
3670
-	return str_replace( array_keys($to_ncr), array_values($to_ncr), $text );
3670
+	return str_replace(array_keys($to_ncr), array_values($to_ncr), $text);
3671 3671
 }
3672 3672
 
3673 3673
 /**
@@ -3688,9 +3688,9 @@  discard block
 block discarded – undo
3688 3688
  *                               It is usually either 'html' or 'tinymce'.
3689 3689
  * @return string The formatted text after filter is applied.
3690 3690
  */
3691
-function format_for_editor( $text, $default_editor = null ) {
3692
-	if ( $text ) {
3693
-		$text = htmlspecialchars( $text, ENT_NOQUOTES, get_option( 'blog_charset' ) );
3691
+function format_for_editor($text, $default_editor = null) {
3692
+	if ($text) {
3693
+		$text = htmlspecialchars($text, ENT_NOQUOTES, get_option('blog_charset'));
3694 3694
 	}
3695 3695
 
3696 3696
 	/**
@@ -3702,7 +3702,7 @@  discard block
 block discarded – undo
3702 3702
 	 * @param string $default_editor The default editor for the current user.
3703 3703
 	 *                               It is usually either 'html' or 'tinymce'.
3704 3704
 	 */
3705
-	return apply_filters( 'format_for_editor', $text, $default_editor );
3705
+	return apply_filters('format_for_editor', $text, $default_editor);
3706 3706
 }
3707 3707
 
3708 3708
 /**
@@ -3720,12 +3720,12 @@  discard block
 block discarded – undo
3720 3720
  * @param string       $subject The string being searched and replaced on, otherwise known as the haystack.
3721 3721
  * @return string The string with the replaced svalues.
3722 3722
  */
3723
-function _deep_replace( $search, $subject ) {
3723
+function _deep_replace($search, $subject) {
3724 3724
 	$subject = (string) $subject;
3725 3725
 
3726 3726
 	$count = 1;
3727
-	while ( $count ) {
3728
-		$subject = str_replace( $search, '', $subject, $count );
3727
+	while ($count) {
3728
+		$subject = str_replace($search, '', $subject, $count);
3729 3729
 	}
3730 3730
 
3731 3731
 	return $subject;
@@ -3745,9 +3745,9 @@  discard block
 block discarded – undo
3745 3745
  * @param string|array $data Unescaped data
3746 3746
  * @return string|array Escaped data
3747 3747
  */
3748
-function esc_sql( $data ) {
3748
+function esc_sql($data) {
3749 3749
 	global $wpdb;
3750
-	return $wpdb->_escape( $data );
3750
+	return $wpdb->_escape($data);
3751 3751
 }
3752 3752
 
3753 3753
 /**
@@ -3765,20 +3765,20 @@  discard block
 block discarded – undo
3765 3765
  * @param string $_context  Private. Use esc_url_raw() for database usage.
3766 3766
  * @return string The cleaned $url after the {@see 'clean_url'} filter is applied.
3767 3767
  */
3768
-function esc_url( $url, $protocols = null, $_context = 'display' ) {
3768
+function esc_url($url, $protocols = null, $_context = 'display') {
3769 3769
 	$original_url = $url;
3770 3770
 
3771
-	if ( '' == $url )
3771
+	if ('' == $url)
3772 3772
 		return $url;
3773 3773
 
3774
-	$url = str_replace( ' ', '%20', $url );
3774
+	$url = str_replace(' ', '%20', $url);
3775 3775
 	$url = preg_replace('|[^a-z0-9-~+_.?#=!&;,/:%@$\|*\'()\[\]\\x80-\\xff]|i', '', $url);
3776 3776
 
3777
-	if ( '' === $url ) {
3777
+	if ('' === $url) {
3778 3778
 		return $url;
3779 3779
 	}
3780 3780
 
3781
-	if ( 0 !== stripos( $url, 'mailto:' ) ) {
3781
+	if (0 !== stripos($url, 'mailto:')) {
3782 3782
 		$strip = array('%0d', '%0a', '%0D', '%0A');
3783 3783
 		$url = _deep_replace($strip, $url);
3784 3784
 	}
@@ -3788,61 +3788,61 @@  discard block
 block discarded – undo
3788 3788
 	 * presume it needs http:// prepended (unless a relative
3789 3789
 	 * link starting with /, # or ? or a php file).
3790 3790
 	 */
3791
-	if ( strpos($url, ':') === false && ! in_array( $url[0], array( '/', '#', '?' ) ) &&
3792
-		! preg_match('/^[a-z0-9-]+?\.php/i', $url) )
3793
-		$url = 'http://' . $url;
3791
+	if (strpos($url, ':') === false && ! in_array($url[0], array('/', '#', '?')) &&
3792
+		! preg_match('/^[a-z0-9-]+?\.php/i', $url))
3793
+		$url = 'http://'.$url;
3794 3794
 
3795 3795
 	// Replace ampersands and single quotes only when displaying.
3796
-	if ( 'display' == $_context ) {
3797
-		$url = wp_kses_normalize_entities( $url );
3798
-		$url = str_replace( '&amp;', '&#038;', $url );
3799
-		$url = str_replace( "'", '&#039;', $url );
3796
+	if ('display' == $_context) {
3797
+		$url = wp_kses_normalize_entities($url);
3798
+		$url = str_replace('&amp;', '&#038;', $url);
3799
+		$url = str_replace("'", '&#039;', $url);
3800 3800
 	}
3801 3801
 
3802
-	if ( ( false !== strpos( $url, '[' ) ) || ( false !== strpos( $url, ']' ) ) ) {
3802
+	if ((false !== strpos($url, '[')) || (false !== strpos($url, ']'))) {
3803 3803
 
3804
-		$parsed = wp_parse_url( $url );
3804
+		$parsed = wp_parse_url($url);
3805 3805
 		$front  = '';
3806 3806
 
3807
-		if ( isset( $parsed['scheme'] ) ) {
3808
-			$front .= $parsed['scheme'] . '://';
3809
-		} elseif ( '/' === $url[0] ) {
3807
+		if (isset($parsed['scheme'])) {
3808
+			$front .= $parsed['scheme'].'://';
3809
+		} elseif ('/' === $url[0]) {
3810 3810
 			$front .= '//';
3811 3811
 		}
3812 3812
 
3813
-		if ( isset( $parsed['user'] ) ) {
3813
+		if (isset($parsed['user'])) {
3814 3814
 			$front .= $parsed['user'];
3815 3815
 		}
3816 3816
 
3817
-		if ( isset( $parsed['pass'] ) ) {
3818
-			$front .= ':' . $parsed['pass'];
3817
+		if (isset($parsed['pass'])) {
3818
+			$front .= ':'.$parsed['pass'];
3819 3819
 		}
3820 3820
 
3821
-		if ( isset( $parsed['user'] ) || isset( $parsed['pass'] ) ) {
3821
+		if (isset($parsed['user']) || isset($parsed['pass'])) {
3822 3822
 			$front .= '@';
3823 3823
 		}
3824 3824
 
3825
-		if ( isset( $parsed['host'] ) ) {
3825
+		if (isset($parsed['host'])) {
3826 3826
 			$front .= $parsed['host'];
3827 3827
 		}
3828 3828
 
3829
-		if ( isset( $parsed['port'] ) ) {
3830
-			$front .= ':' . $parsed['port'];
3829
+		if (isset($parsed['port'])) {
3830
+			$front .= ':'.$parsed['port'];
3831 3831
 		}
3832 3832
 
3833
-		$end_dirty = str_replace( $front, '', $url );
3834
-		$end_clean = str_replace( array( '[', ']' ), array( '%5B', '%5D' ), $end_dirty );
3835
-		$url       = str_replace( $end_dirty, $end_clean, $url );
3833
+		$end_dirty = str_replace($front, '', $url);
3834
+		$end_clean = str_replace(array('[', ']'), array('%5B', '%5D'), $end_dirty);
3835
+		$url       = str_replace($end_dirty, $end_clean, $url);
3836 3836
 
3837 3837
 	}
3838 3838
 
3839
-	if ( '/' === $url[0] ) {
3839
+	if ('/' === $url[0]) {
3840 3840
 		$good_protocol_url = $url;
3841 3841
 	} else {
3842
-		if ( ! is_array( $protocols ) )
3842
+		if ( ! is_array($protocols))
3843 3843
 			$protocols = wp_allowed_protocols();
3844
-		$good_protocol_url = wp_kses_bad_protocol( $url, $protocols );
3845
-		if ( strtolower( $good_protocol_url ) != strtolower( $url ) )
3844
+		$good_protocol_url = wp_kses_bad_protocol($url, $protocols);
3845
+		if (strtolower($good_protocol_url) != strtolower($url))
3846 3846
 			return '';
3847 3847
 	}
3848 3848
 
@@ -3855,7 +3855,7 @@  discard block
 block discarded – undo
3855 3855
 	 * @param string $original_url      The URL prior to cleaning.
3856 3856
 	 * @param string $_context          If 'display', replace ampersands and single quotes only.
3857 3857
 	 */
3858
-	return apply_filters( 'clean_url', $good_protocol_url, $original_url, $_context );
3858
+	return apply_filters('clean_url', $good_protocol_url, $original_url, $_context);
3859 3859
 }
3860 3860
 
3861 3861
 /**
@@ -3867,8 +3867,8 @@  discard block
 block discarded – undo
3867 3867
  * @param array  $protocols An array of acceptable protocols.
3868 3868
  * @return string The cleaned URL.
3869 3869
  */
3870
-function esc_url_raw( $url, $protocols = null ) {
3871
-	return esc_url( $url, $protocols, 'db' );
3870
+function esc_url_raw($url, $protocols = null) {
3871
+	return esc_url($url, $protocols, 'db');
3872 3872
 }
3873 3873
 
3874 3874
 /**
@@ -3881,10 +3881,10 @@  discard block
 block discarded – undo
3881 3881
  * @param string $myHTML The text to be converted.
3882 3882
  * @return string Converted text.
3883 3883
  */
3884
-function htmlentities2( $myHTML ) {
3885
-	$translation_table = get_html_translation_table( HTML_ENTITIES, ENT_QUOTES );
3884
+function htmlentities2($myHTML) {
3885
+	$translation_table = get_html_translation_table(HTML_ENTITIES, ENT_QUOTES);
3886 3886
 	$translation_table[chr(38)] = '&';
3887
-	return preg_replace( "/&(?![A-Za-z]{0,4}\w{2,3};|#[0-9]{2,3};)/", "&amp;", strtr($myHTML, $translation_table) );
3887
+	return preg_replace("/&(?![A-Za-z]{0,4}\w{2,3};|#[0-9]{2,3};)/", "&amp;", strtr($myHTML, $translation_table));
3888 3888
 }
3889 3889
 
3890 3890
 /**
@@ -3899,12 +3899,12 @@  discard block
 block discarded – undo
3899 3899
  * @param string $text The text to be escaped.
3900 3900
  * @return string Escaped text.
3901 3901
  */
3902
-function esc_js( $text ) {
3903
-	$safe_text = wp_check_invalid_utf8( $text );
3904
-	$safe_text = _wp_specialchars( $safe_text, ENT_COMPAT );
3905
-	$safe_text = preg_replace( '/&#(x)?0*(?(1)27|39);?/i', "'", stripslashes( $safe_text ) );
3906
-	$safe_text = str_replace( "\r", '', $safe_text );
3907
-	$safe_text = str_replace( "\n", '\\n', addslashes( $safe_text ) );
3902
+function esc_js($text) {
3903
+	$safe_text = wp_check_invalid_utf8($text);
3904
+	$safe_text = _wp_specialchars($safe_text, ENT_COMPAT);
3905
+	$safe_text = preg_replace('/&#(x)?0*(?(1)27|39);?/i', "'", stripslashes($safe_text));
3906
+	$safe_text = str_replace("\r", '', $safe_text);
3907
+	$safe_text = str_replace("\n", '\\n', addslashes($safe_text));
3908 3908
 	/**
3909 3909
 	 * Filters a string cleaned and escaped for output in JavaScript.
3910 3910
 	 *
@@ -3916,7 +3916,7 @@  discard block
 block discarded – undo
3916 3916
 	 * @param string $safe_text The text after it has been escaped.
3917 3917
  	 * @param string $text      The text prior to being escaped.
3918 3918
 	 */
3919
-	return apply_filters( 'js_escape', $safe_text, $text );
3919
+	return apply_filters('js_escape', $safe_text, $text);
3920 3920
 }
3921 3921
 
3922 3922
 /**
@@ -3927,9 +3927,9 @@  discard block
 block discarded – undo
3927 3927
  * @param string $text
3928 3928
  * @return string
3929 3929
  */
3930
-function esc_html( $text ) {
3931
-	$safe_text = wp_check_invalid_utf8( $text );
3932
-	$safe_text = _wp_specialchars( $safe_text, ENT_QUOTES );
3930
+function esc_html($text) {
3931
+	$safe_text = wp_check_invalid_utf8($text);
3932
+	$safe_text = _wp_specialchars($safe_text, ENT_QUOTES);
3933 3933
 	/**
3934 3934
 	 * Filters a string cleaned and escaped for output in HTML.
3935 3935
 	 *
@@ -3941,7 +3941,7 @@  discard block
 block discarded – undo
3941 3941
 	 * @param string $safe_text The text after it has been escaped.
3942 3942
  	 * @param string $text      The text prior to being escaped.
3943 3943
 	 */
3944
-	return apply_filters( 'esc_html', $safe_text, $text );
3944
+	return apply_filters('esc_html', $safe_text, $text);
3945 3945
 }
3946 3946
 
3947 3947
 /**
@@ -3952,9 +3952,9 @@  discard block
 block discarded – undo
3952 3952
  * @param string $text
3953 3953
  * @return string
3954 3954
  */
3955
-function esc_attr( $text ) {
3956
-	$safe_text = wp_check_invalid_utf8( $text );
3957
-	$safe_text = _wp_specialchars( $safe_text, ENT_QUOTES );
3955
+function esc_attr($text) {
3956
+	$safe_text = wp_check_invalid_utf8($text);
3957
+	$safe_text = _wp_specialchars($safe_text, ENT_QUOTES);
3958 3958
 	/**
3959 3959
 	 * Filters a string cleaned and escaped for output in an HTML attribute.
3960 3960
 	 *
@@ -3966,7 +3966,7 @@  discard block
 block discarded – undo
3966 3966
 	 * @param string $safe_text The text after it has been escaped.
3967 3967
  	 * @param string $text      The text prior to being escaped.
3968 3968
 	 */
3969
-	return apply_filters( 'attribute_escape', $safe_text, $text );
3969
+	return apply_filters('attribute_escape', $safe_text, $text);
3970 3970
 }
3971 3971
 
3972 3972
 /**
@@ -3977,8 +3977,8 @@  discard block
 block discarded – undo
3977 3977
  * @param string $text
3978 3978
  * @return string
3979 3979
  */
3980
-function esc_textarea( $text ) {
3981
-	$safe_text = htmlspecialchars( $text, ENT_QUOTES, get_option( 'blog_charset' ) );
3980
+function esc_textarea($text) {
3981
+	$safe_text = htmlspecialchars($text, ENT_QUOTES, get_option('blog_charset'));
3982 3982
 	/**
3983 3983
 	 * Filters a string cleaned and escaped for output in a textarea element.
3984 3984
 	 *
@@ -3987,7 +3987,7 @@  discard block
 block discarded – undo
3987 3987
 	 * @param string $safe_text The text after it has been escaped.
3988 3988
  	 * @param string $text      The text prior to being escaped.
3989 3989
 	 */
3990
-	return apply_filters( 'esc_textarea', $safe_text, $text );
3990
+	return apply_filters('esc_textarea', $safe_text, $text);
3991 3991
 }
3992 3992
 
3993 3993
 /**
@@ -3998,8 +3998,8 @@  discard block
 block discarded – undo
3998 3998
  * @param string $tag_name
3999 3999
  * @return string
4000 4000
  */
4001
-function tag_escape( $tag_name ) {
4002
-	$safe_tag = strtolower( preg_replace('/[^a-zA-Z0-9_:]/', '', $tag_name) );
4001
+function tag_escape($tag_name) {
4002
+	$safe_tag = strtolower(preg_replace('/[^a-zA-Z0-9_:]/', '', $tag_name));
4003 4003
 	/**
4004 4004
 	 * Filters a string cleaned and escaped for output as an HTML tag.
4005 4005
 	 *
@@ -4008,7 +4008,7 @@  discard block
 block discarded – undo
4008 4008
 	 * @param string $safe_tag The tag name after it has been escaped.
4009 4009
  	 * @param string $tag_name The text before it was escaped.
4010 4010
 	 */
4011
-	return apply_filters( 'tag_escape', $safe_tag, $tag_name );
4011
+	return apply_filters('tag_escape', $safe_tag, $tag_name);
4012 4012
 }
4013 4013
 
4014 4014
 /**
@@ -4023,8 +4023,8 @@  discard block
 block discarded – undo
4023 4023
  * @param string $link Full URL path.
4024 4024
  * @return string Absolute path.
4025 4025
  */
4026
-function wp_make_link_relative( $link ) {
4027
-	return preg_replace( '|^(https?:)?//[^/]+(/?.*)|i', '$2', $link );
4026
+function wp_make_link_relative($link) {
4027
+	return preg_replace('|^(https?:)?//[^/]+(/?.*)|i', '$2', $link);
4028 4028
 }
4029 4029
 
4030 4030
 /**
@@ -4041,22 +4041,22 @@  discard block
 block discarded – undo
4041 4041
  * @param string $value  The unsanitised value.
4042 4042
  * @return string Sanitized value.
4043 4043
  */
4044
-function sanitize_option( $option, $value ) {
4044
+function sanitize_option($option, $value) {
4045 4045
 	global $wpdb;
4046 4046
 
4047 4047
 	$original_value = $value;
4048 4048
 	$error = '';
4049 4049
 
4050
-	switch ( $option ) {
4050
+	switch ($option) {
4051 4051
 		case 'admin_email' :
4052 4052
 		case 'new_admin_email' :
4053
-			$value = $wpdb->strip_invalid_text_for_column( $wpdb->options, 'option_value', $value );
4054
-			if ( is_wp_error( $value ) ) {
4053
+			$value = $wpdb->strip_invalid_text_for_column($wpdb->options, 'option_value', $value);
4054
+			if (is_wp_error($value)) {
4055 4055
 				$error = $value->get_error_message();
4056 4056
 			} else {
4057
-				$value = sanitize_email( $value );
4058
-				if ( ! is_email( $value ) ) {
4059
-					$error = __( 'The email address entered did not appear to be a valid email address. Please enter a valid email address.' );
4057
+				$value = sanitize_email($value);
4058
+				if ( ! is_email($value)) {
4059
+					$error = __('The email address entered did not appear to be a valid email address. Please enter a valid email address.');
4060 4060
 				}
4061 4061
 			}
4062 4062
 			break;
@@ -4083,36 +4083,36 @@  discard block
 block discarded – undo
4083 4083
 		case 'users_can_register':
4084 4084
 		case 'start_of_week':
4085 4085
 		case 'site_icon':
4086
-			$value = absint( $value );
4086
+			$value = absint($value);
4087 4087
 			break;
4088 4088
 
4089 4089
 		case 'posts_per_page':
4090 4090
 		case 'posts_per_rss':
4091 4091
 			$value = (int) $value;
4092
-			if ( empty($value) )
4092
+			if (empty($value))
4093 4093
 				$value = 1;
4094
-			if ( $value < -1 )
4094
+			if ($value < -1)
4095 4095
 				$value = abs($value);
4096 4096
 			break;
4097 4097
 
4098 4098
 		case 'default_ping_status':
4099 4099
 		case 'default_comment_status':
4100 4100
 			// Options that if not there have 0 value but need to be something like "closed"
4101
-			if ( $value == '0' || $value == '')
4101
+			if ($value == '0' || $value == '')
4102 4102
 				$value = 'closed';
4103 4103
 			break;
4104 4104
 
4105 4105
 		case 'blogdescription':
4106 4106
 		case 'blogname':
4107
-			$value = $wpdb->strip_invalid_text_for_column( $wpdb->options, 'option_value', $value );
4108
-			if ( $value !== $original_value ) {
4109
-				$value = $wpdb->strip_invalid_text_for_column( $wpdb->options, 'option_value', wp_encode_emoji( $original_value ) );
4107
+			$value = $wpdb->strip_invalid_text_for_column($wpdb->options, 'option_value', $value);
4108
+			if ($value !== $original_value) {
4109
+				$value = $wpdb->strip_invalid_text_for_column($wpdb->options, 'option_value', wp_encode_emoji($original_value));
4110 4110
 			}
4111 4111
 
4112
-			if ( is_wp_error( $value ) ) {
4112
+			if (is_wp_error($value)) {
4113 4113
 				$error = $value->get_error_message();
4114 4114
 			} else {
4115
-				$value = esc_html( $value );
4115
+				$value = esc_html($value);
4116 4116
 			}
4117 4117
 			break;
4118 4118
 
@@ -4122,10 +4122,10 @@  discard block
 block discarded – undo
4122 4122
 
4123 4123
 		case 'blog_public':
4124 4124
 			// This is the value if the settings checkbox is not checked on POST. Don't rely on this.
4125
-			if ( null === $value )
4125
+			if (null === $value)
4126 4126
 				$value = 1;
4127 4127
 			else
4128
-				$value = intval( $value );
4128
+				$value = intval($value);
4129 4129
 			break;
4130 4130
 
4131 4131
 		case 'date_format':
@@ -4134,20 +4134,20 @@  discard block
 block discarded – undo
4134 4134
 		case 'mailserver_login':
4135 4135
 		case 'mailserver_pass':
4136 4136
 		case 'upload_path':
4137
-			$value = $wpdb->strip_invalid_text_for_column( $wpdb->options, 'option_value', $value );
4138
-			if ( is_wp_error( $value ) ) {
4137
+			$value = $wpdb->strip_invalid_text_for_column($wpdb->options, 'option_value', $value);
4138
+			if (is_wp_error($value)) {
4139 4139
 				$error = $value->get_error_message();
4140 4140
 			} else {
4141
-				$value = strip_tags( $value );
4142
-				$value = wp_kses_data( $value );
4141
+				$value = strip_tags($value);
4142
+				$value = wp_kses_data($value);
4143 4143
 			}
4144 4144
 			break;
4145 4145
 
4146 4146
 		case 'ping_sites':
4147
-			$value = explode( "\n", $value );
4148
-			$value = array_filter( array_map( 'trim', $value ) );
4149
-			$value = array_filter( array_map( 'esc_url_raw', $value ) );
4150
-			$value = implode( "\n", $value );
4147
+			$value = explode("\n", $value);
4148
+			$value = array_filter(array_map('trim', $value));
4149
+			$value = array_filter(array_map('esc_url_raw', $value));
4150
+			$value = implode("\n", $value);
4151 4151
 			break;
4152 4152
 
4153 4153
 		case 'gmt_offset':
@@ -4155,128 +4155,128 @@  discard block
 block discarded – undo
4155 4155
 			break;
4156 4156
 
4157 4157
 		case 'siteurl':
4158
-			$value = $wpdb->strip_invalid_text_for_column( $wpdb->options, 'option_value', $value );
4159
-			if ( is_wp_error( $value ) ) {
4158
+			$value = $wpdb->strip_invalid_text_for_column($wpdb->options, 'option_value', $value);
4159
+			if (is_wp_error($value)) {
4160 4160
 				$error = $value->get_error_message();
4161 4161
 			} else {
4162
-				if ( preg_match( '#http(s?)://(.+)#i', $value ) ) {
4163
-					$value = esc_url_raw( $value );
4162
+				if (preg_match('#http(s?)://(.+)#i', $value)) {
4163
+					$value = esc_url_raw($value);
4164 4164
 				} else {
4165
-					$error = __( 'The WordPress address you entered did not appear to be a valid URL. Please enter a valid URL.' );
4165
+					$error = __('The WordPress address you entered did not appear to be a valid URL. Please enter a valid URL.');
4166 4166
 				}
4167 4167
 			}
4168 4168
 			break;
4169 4169
 
4170 4170
 		case 'home':
4171
-			$value = $wpdb->strip_invalid_text_for_column( $wpdb->options, 'option_value', $value );
4172
-			if ( is_wp_error( $value ) ) {
4171
+			$value = $wpdb->strip_invalid_text_for_column($wpdb->options, 'option_value', $value);
4172
+			if (is_wp_error($value)) {
4173 4173
 				$error = $value->get_error_message();
4174 4174
 			} else {
4175
-				if ( preg_match( '#http(s?)://(.+)#i', $value ) ) {
4176
-					$value = esc_url_raw( $value );
4175
+				if (preg_match('#http(s?)://(.+)#i', $value)) {
4176
+					$value = esc_url_raw($value);
4177 4177
 				} else {
4178
-					$error = __( 'The Site address you entered did not appear to be a valid URL. Please enter a valid URL.' );
4178
+					$error = __('The Site address you entered did not appear to be a valid URL. Please enter a valid URL.');
4179 4179
 				}
4180 4180
 			}
4181 4181
 			break;
4182 4182
 
4183 4183
 		case 'WPLANG':
4184 4184
 			$allowed = get_available_languages();
4185
-			if ( ! is_multisite() && defined( 'WPLANG' ) && '' !== WPLANG && 'en_US' !== WPLANG ) {
4185
+			if ( ! is_multisite() && defined('WPLANG') && '' !== WPLANG && 'en_US' !== WPLANG) {
4186 4186
 				$allowed[] = WPLANG;
4187 4187
 			}
4188
-			if ( ! in_array( $value, $allowed ) && ! empty( $value ) ) {
4189
-				$value = get_option( $option );
4188
+			if ( ! in_array($value, $allowed) && ! empty($value)) {
4189
+				$value = get_option($option);
4190 4190
 			}
4191 4191
 			break;
4192 4192
 
4193 4193
 		case 'illegal_names':
4194
-			$value = $wpdb->strip_invalid_text_for_column( $wpdb->options, 'option_value', $value );
4195
-			if ( is_wp_error( $value ) ) {
4194
+			$value = $wpdb->strip_invalid_text_for_column($wpdb->options, 'option_value', $value);
4195
+			if (is_wp_error($value)) {
4196 4196
 				$error = $value->get_error_message();
4197 4197
 			} else {
4198
-				if ( ! is_array( $value ) )
4199
-					$value = explode( ' ', $value );
4198
+				if ( ! is_array($value))
4199
+					$value = explode(' ', $value);
4200 4200
 
4201
-				$value = array_values( array_filter( array_map( 'trim', $value ) ) );
4201
+				$value = array_values(array_filter(array_map('trim', $value)));
4202 4202
 
4203
-				if ( ! $value )
4203
+				if ( ! $value)
4204 4204
 					$value = '';
4205 4205
 			}
4206 4206
 			break;
4207 4207
 
4208 4208
 		case 'limited_email_domains':
4209 4209
 		case 'banned_email_domains':
4210
-			$value = $wpdb->strip_invalid_text_for_column( $wpdb->options, 'option_value', $value );
4211
-			if ( is_wp_error( $value ) ) {
4210
+			$value = $wpdb->strip_invalid_text_for_column($wpdb->options, 'option_value', $value);
4211
+			if (is_wp_error($value)) {
4212 4212
 				$error = $value->get_error_message();
4213 4213
 			} else {
4214
-				if ( ! is_array( $value ) )
4215
-					$value = explode( "\n", $value );
4214
+				if ( ! is_array($value))
4215
+					$value = explode("\n", $value);
4216 4216
 
4217
-				$domains = array_values( array_filter( array_map( 'trim', $value ) ) );
4217
+				$domains = array_values(array_filter(array_map('trim', $value)));
4218 4218
 				$value = array();
4219 4219
 
4220
-				foreach ( $domains as $domain ) {
4221
-					if ( ! preg_match( '/(--|\.\.)/', $domain ) && preg_match( '|^([a-zA-Z0-9-\.])+$|', $domain ) ) {
4220
+				foreach ($domains as $domain) {
4221
+					if ( ! preg_match('/(--|\.\.)/', $domain) && preg_match('|^([a-zA-Z0-9-\.])+$|', $domain)) {
4222 4222
 						$value[] = $domain;
4223 4223
 					}
4224 4224
 				}
4225
-				if ( ! $value )
4225
+				if ( ! $value)
4226 4226
 					$value = '';
4227 4227
 			}
4228 4228
 			break;
4229 4229
 
4230 4230
 		case 'timezone_string':
4231 4231
 			$allowed_zones = timezone_identifiers_list();
4232
-			if ( ! in_array( $value, $allowed_zones ) && ! empty( $value ) ) {
4233
-				$error = __( 'The timezone you have entered is not valid. Please select a valid timezone.' );
4232
+			if ( ! in_array($value, $allowed_zones) && ! empty($value)) {
4233
+				$error = __('The timezone you have entered is not valid. Please select a valid timezone.');
4234 4234
 			}
4235 4235
 			break;
4236 4236
 
4237 4237
 		case 'permalink_structure':
4238 4238
 		case 'category_base':
4239 4239
 		case 'tag_base':
4240
-			$value = $wpdb->strip_invalid_text_for_column( $wpdb->options, 'option_value', $value );
4241
-			if ( is_wp_error( $value ) ) {
4240
+			$value = $wpdb->strip_invalid_text_for_column($wpdb->options, 'option_value', $value);
4241
+			if (is_wp_error($value)) {
4242 4242
 				$error = $value->get_error_message();
4243 4243
 			} else {
4244
-				$value = esc_url_raw( $value );
4245
-				$value = str_replace( 'http://', '', $value );
4244
+				$value = esc_url_raw($value);
4245
+				$value = str_replace('http://', '', $value);
4246 4246
 			}
4247 4247
 
4248
-			if ( 'permalink_structure' === $option && '' !== $value && ! preg_match( '/%[^\/%]+%/', $value ) ) {
4248
+			if ('permalink_structure' === $option && '' !== $value && ! preg_match('/%[^\/%]+%/', $value)) {
4249 4249
 				$error = sprintf(
4250 4250
 					/* translators: %s: Codex URL */
4251
-					__( 'A structure tag is required when using custom permalinks. <a href="%s">Learn more</a>' ),
4252
-					__( 'https://codex.wordpress.org/Using_Permalinks#Choosing_your_permalink_structure' )
4251
+					__('A structure tag is required when using custom permalinks. <a href="%s">Learn more</a>'),
4252
+					__('https://codex.wordpress.org/Using_Permalinks#Choosing_your_permalink_structure')
4253 4253
 				);
4254 4254
 			}
4255 4255
 			break;
4256 4256
 
4257 4257
 		case 'default_role' :
4258
-			if ( ! get_role( $value ) && get_role( 'subscriber' ) )
4258
+			if ( ! get_role($value) && get_role('subscriber'))
4259 4259
 				$value = 'subscriber';
4260 4260
 			break;
4261 4261
 
4262 4262
 		case 'moderation_keys':
4263 4263
 		case 'blacklist_keys':
4264
-			$value = $wpdb->strip_invalid_text_for_column( $wpdb->options, 'option_value', $value );
4265
-			if ( is_wp_error( $value ) ) {
4264
+			$value = $wpdb->strip_invalid_text_for_column($wpdb->options, 'option_value', $value);
4265
+			if (is_wp_error($value)) {
4266 4266
 				$error = $value->get_error_message();
4267 4267
 			} else {
4268
-				$value = explode( "\n", $value );
4269
-				$value = array_filter( array_map( 'trim', $value ) );
4270
-				$value = array_unique( $value );
4271
-				$value = implode( "\n", $value );
4268
+				$value = explode("\n", $value);
4269
+				$value = array_filter(array_map('trim', $value));
4270
+				$value = array_unique($value);
4271
+				$value = implode("\n", $value);
4272 4272
 			}
4273 4273
 			break;
4274 4274
 	}
4275 4275
 
4276
-	if ( ! empty( $error ) ) {
4277
-		$value = get_option( $option );
4278
-		if ( function_exists( 'add_settings_error' ) ) {
4279
-			add_settings_error( $option, "invalid_{$option}", $error );
4276
+	if ( ! empty($error)) {
4277
+		$value = get_option($option);
4278
+		if (function_exists('add_settings_error')) {
4279
+			add_settings_error($option, "invalid_{$option}", $error);
4280 4280
 		}
4281 4281
 	}
4282 4282
 
@@ -4290,7 +4290,7 @@  discard block
 block discarded – undo
4290 4290
 	 * @param string $option         The option name.
4291 4291
 	 * @param string $original_value The original value passed to the function.
4292 4292
 	 */
4293
-	return apply_filters( "sanitize_option_{$option}", $value, $option, $original_value );
4293
+	return apply_filters("sanitize_option_{$option}", $value, $option, $original_value);
4294 4294
 }
4295 4295
 
4296 4296
 /**
@@ -4304,18 +4304,18 @@  discard block
 block discarded – undo
4304 4304
  * @param callable $callback The function to map onto $value.
4305 4305
  * @return mixed The value with the callback applied to all non-arrays and non-objects inside it.
4306 4306
  */
4307
-function map_deep( $value, $callback ) {
4308
-	if ( is_array( $value ) ) {
4309
-		foreach ( $value as $index => $item ) {
4310
-			$value[ $index ] = map_deep( $item, $callback );
4307
+function map_deep($value, $callback) {
4308
+	if (is_array($value)) {
4309
+		foreach ($value as $index => $item) {
4310
+			$value[$index] = map_deep($item, $callback);
4311 4311
 		}
4312
-	} elseif ( is_object( $value ) ) {
4313
-		$object_vars = get_object_vars( $value );
4314
-		foreach ( $object_vars as $property_name => $property_value ) {
4315
-			$value->$property_name = map_deep( $property_value, $callback );
4312
+	} elseif (is_object($value)) {
4313
+		$object_vars = get_object_vars($value);
4314
+		foreach ($object_vars as $property_name => $property_value) {
4315
+			$value->$property_name = map_deep($property_value, $callback);
4316 4316
 		}
4317 4317
 	} else {
4318
-		$value = call_user_func( $callback, $value );
4318
+		$value = call_user_func($callback, $value);
4319 4319
 	}
4320 4320
 
4321 4321
 	return $value;
@@ -4332,10 +4332,10 @@  discard block
 block discarded – undo
4332 4332
  * @param string $string The string to be parsed.
4333 4333
  * @param array  $array  Variables will be stored in this array.
4334 4334
  */
4335
-function wp_parse_str( $string, &$array ) {
4336
-	parse_str( $string, $array );
4337
-	if ( get_magic_quotes_gpc() )
4338
-		$array = stripslashes_deep( $array );
4335
+function wp_parse_str($string, &$array) {
4336
+	parse_str($string, $array);
4337
+	if (get_magic_quotes_gpc())
4338
+		$array = stripslashes_deep($array);
4339 4339
 	/**
4340 4340
 	 * Filters the array of variables derived from a parsed string.
4341 4341
 	 *
@@ -4343,7 +4343,7 @@  discard block
 block discarded – undo
4343 4343
 	 *
4344 4344
 	 * @param array $array The array populated with variables.
4345 4345
 	 */
4346
-	$array = apply_filters( 'wp_parse_str', $array );
4346
+	$array = apply_filters('wp_parse_str', $array);
4347 4347
 }
4348 4348
 
4349 4349
 /**
@@ -4356,7 +4356,7 @@  discard block
 block discarded – undo
4356 4356
  * @param string $text Text to be converted.
4357 4357
  * @return string Converted text.
4358 4358
  */
4359
-function wp_pre_kses_less_than( $text ) {
4359
+function wp_pre_kses_less_than($text) {
4360 4360
 	return preg_replace_callback('%<[^>]*?((?=<)|>|$)%', 'wp_pre_kses_less_than_callback', $text);
4361 4361
 }
4362 4362
 
@@ -4368,8 +4368,8 @@  discard block
 block discarded – undo
4368 4368
  * @param array $matches Populated by matches to preg_replace.
4369 4369
  * @return string The text returned after esc_html if needed.
4370 4370
  */
4371
-function wp_pre_kses_less_than_callback( $matches ) {
4372
-	if ( false === strpos($matches[0], '>') )
4371
+function wp_pre_kses_less_than_callback($matches) {
4372
+	if (false === strpos($matches[0], '>'))
4373 4373
 		return esc_html($matches[0]);
4374 4374
 	return $matches[0];
4375 4375
 }
@@ -4384,21 +4384,21 @@  discard block
 block discarded – undo
4384 4384
  * @param mixed  $args ,... Arguments to be formatted into the $pattern string.
4385 4385
  * @return string The formatted string.
4386 4386
  */
4387
-function wp_sprintf( $pattern ) {
4387
+function wp_sprintf($pattern) {
4388 4388
 	$args = func_get_args();
4389 4389
 	$len = strlen($pattern);
4390 4390
 	$start = 0;
4391 4391
 	$result = '';
4392 4392
 	$arg_index = 0;
4393
-	while ( $len > $start ) {
4393
+	while ($len > $start) {
4394 4394
 		// Last character: append and break
4395
-		if ( strlen($pattern) - 1 == $start ) {
4395
+		if (strlen($pattern) - 1 == $start) {
4396 4396
 			$result .= substr($pattern, -1);
4397 4397
 			break;
4398 4398
 		}
4399 4399
 
4400 4400
 		// Literal %: append and continue
4401
-		if ( substr($pattern, $start, 2) == '%%' ) {
4401
+		if (substr($pattern, $start, 2) == '%%') {
4402 4402
 			$start += 2;
4403 4403
 			$result .= '%';
4404 4404
 			continue;
@@ -4406,14 +4406,14 @@  discard block
 block discarded – undo
4406 4406
 
4407 4407
 		// Get fragment before next %
4408 4408
 		$end = strpos($pattern, '%', $start + 1);
4409
-		if ( false === $end )
4409
+		if (false === $end)
4410 4410
 			$end = $len;
4411 4411
 		$fragment = substr($pattern, $start, $end - $start);
4412 4412
 
4413 4413
 		// Fragment has a specifier
4414
-		if ( $pattern[$start] == '%' ) {
4414
+		if ($pattern[$start] == '%') {
4415 4415
 			// Find numbered arguments or take the next one in order
4416
-			if ( preg_match('/^%(\d+)\$/', $fragment, $matches) ) {
4416
+			if (preg_match('/^%(\d+)\$/', $fragment, $matches)) {
4417 4417
 				$arg = isset($args[$matches[1]]) ? $args[$matches[1]] : '';
4418 4418
 				$fragment = str_replace("%{$matches[1]}$", '%', $fragment);
4419 4419
 			} else {
@@ -4431,11 +4431,11 @@  discard block
 block discarded – undo
4431 4431
 			 * @param string $fragment A fragment from the pattern.
4432 4432
 			 * @param string $arg      The argument.
4433 4433
 			 */
4434
-			$_fragment = apply_filters( 'wp_sprintf', $fragment, $arg );
4435
-			if ( $_fragment != $fragment )
4434
+			$_fragment = apply_filters('wp_sprintf', $fragment, $arg);
4435
+			if ($_fragment != $fragment)
4436 4436
 				$fragment = $_fragment;
4437 4437
 			else
4438
-				$fragment = sprintf($fragment, strval($arg) );
4438
+				$fragment = sprintf($fragment, strval($arg));
4439 4439
 		}
4440 4440
 
4441 4441
 		// Append to result and move to next fragment
@@ -4458,13 +4458,13 @@  discard block
 block discarded – undo
4458 4458
  * @param array  $args    List items to prepend to the content and replace '%l'.
4459 4459
  * @return string Localized list items and rest of the content.
4460 4460
  */
4461
-function wp_sprintf_l( $pattern, $args ) {
4461
+function wp_sprintf_l($pattern, $args) {
4462 4462
 	// Not a match
4463
-	if ( substr($pattern, 0, 2) != '%l' )
4463
+	if (substr($pattern, 0, 2) != '%l')
4464 4464
 		return $pattern;
4465 4465
 
4466 4466
 	// Nothing to work with
4467
-	if ( empty($args) )
4467
+	if (empty($args))
4468 4468
 		return '';
4469 4469
 
4470 4470
 	/**
@@ -4478,30 +4478,30 @@  discard block
 block discarded – undo
4478 4478
 	 *
4479 4479
 	 * @param array $delimiters An array of translated delimiters.
4480 4480
 	 */
4481
-	$l = apply_filters( 'wp_sprintf_l', array(
4481
+	$l = apply_filters('wp_sprintf_l', array(
4482 4482
 		/* translators: used to join items in a list with more than 2 items */
4483
-		'between'          => sprintf( __('%s, %s'), '', '' ),
4483
+		'between'          => sprintf(__('%s, %s'), '', ''),
4484 4484
 		/* translators: used to join last two items in a list with more than 2 times */
4485
-		'between_last_two' => sprintf( __('%s, and %s'), '', '' ),
4485
+		'between_last_two' => sprintf(__('%s, and %s'), '', ''),
4486 4486
 		/* translators: used to join items in a list with only 2 items */
4487
-		'between_only_two' => sprintf( __('%s and %s'), '', '' ),
4488
-	) );
4487
+		'between_only_two' => sprintf(__('%s and %s'), '', ''),
4488
+	));
4489 4489
 
4490 4490
 	$args = (array) $args;
4491 4491
 	$result = array_shift($args);
4492
-	if ( count($args) == 1 )
4493
-		$result .= $l['between_only_two'] . array_shift($args);
4492
+	if (count($args) == 1)
4493
+		$result .= $l['between_only_two'].array_shift($args);
4494 4494
 	// Loop when more than two args
4495 4495
 	$i = count($args);
4496
-	while ( $i ) {
4496
+	while ($i) {
4497 4497
 		$arg = array_shift($args);
4498 4498
 		$i--;
4499
-		if ( 0 == $i )
4500
-			$result .= $l['between_last_two'] . $arg;
4499
+		if (0 == $i)
4500
+			$result .= $l['between_last_two'].$arg;
4501 4501
 		else
4502
-			$result .= $l['between'] . $arg;
4502
+			$result .= $l['between'].$arg;
4503 4503
 	}
4504
-	return $result . substr($pattern, 2);
4504
+	return $result.substr($pattern, 2);
4505 4505
 }
4506 4506
 
4507 4507
 /**
@@ -4518,15 +4518,15 @@  discard block
 block discarded – undo
4518 4518
  * @param string $more  Optional. What to append if $str needs to be trimmed. Defaults to empty string.
4519 4519
  * @return string The excerpt.
4520 4520
  */
4521
-function wp_html_excerpt( $str, $count, $more = null ) {
4522
-	if ( null === $more )
4521
+function wp_html_excerpt($str, $count, $more = null) {
4522
+	if (null === $more)
4523 4523
 		$more = '';
4524
-	$str = wp_strip_all_tags( $str, true );
4525
-	$excerpt = mb_substr( $str, 0, $count );
4524
+	$str = wp_strip_all_tags($str, true);
4525
+	$excerpt = mb_substr($str, 0, $count);
4526 4526
 	// remove part of an entity at the end
4527
-	$excerpt = preg_replace( '/&[^;\s]{0,6}$/', '', $excerpt );
4528
-	if ( $str != $excerpt )
4529
-		$excerpt = trim( $excerpt ) . $more;
4527
+	$excerpt = preg_replace('/&[^;\s]{0,6}$/', '', $excerpt);
4528
+	if ($str != $excerpt)
4529
+		$excerpt = trim($excerpt).$more;
4530 4530
 	return $excerpt;
4531 4531
 }
4532 4532
 
@@ -4545,11 +4545,11 @@  discard block
 block discarded – undo
4545 4545
  * @param array  $attrs   The attributes which should be processed.
4546 4546
  * @return string The processed content.
4547 4547
  */
4548
-function links_add_base_url( $content, $base, $attrs = array('src', 'href') ) {
4548
+function links_add_base_url($content, $base, $attrs = array('src', 'href')) {
4549 4549
 	global $_links_add_base;
4550 4550
 	$_links_add_base = $base;
4551
-	$attrs = implode('|', (array)$attrs);
4552
-	return preg_replace_callback( "!($attrs)=(['\"])(.+?)\\2!i", '_links_add_base', $content );
4551
+	$attrs = implode('|', (array) $attrs);
4552
+	return preg_replace_callback("!($attrs)=(['\"])(.+?)\\2!i", '_links_add_base', $content);
4553 4553
 }
4554 4554
 
4555 4555
 /**
@@ -4563,13 +4563,12 @@  discard block
 block discarded – undo
4563 4563
  * @param string $m The matched link.
4564 4564
  * @return string The processed link.
4565 4565
  */
4566
-function _links_add_base( $m ) {
4566
+function _links_add_base($m) {
4567 4567
 	global $_links_add_base;
4568 4568
 	//1 = attribute name  2 = quotation mark  3 = URL
4569
-	return $m[1] . '=' . $m[2] .
4570
-		( preg_match( '#^(\w{1,20}):#', $m[3], $protocol ) && in_array( $protocol[1], wp_allowed_protocols() ) ?
4571
-			$m[3] :
4572
-			WP_Http::make_absolute_url( $m[3], $_links_add_base )
4569
+	return $m[1].'='.$m[2].
4570
+		(preg_match('#^(\w{1,20}):#', $m[3], $protocol) && in_array($protocol[1], wp_allowed_protocols()) ?
4571
+			$m[3] : WP_Http::make_absolute_url($m[3], $_links_add_base)
4573 4572
 		)
4574 4573
 		. $m[2];
4575 4574
 }
@@ -4591,11 +4590,11 @@  discard block
 block discarded – undo
4591 4590
  * @param array  $tags    An array of tags to apply to.
4592 4591
  * @return string The processed content.
4593 4592
  */
4594
-function links_add_target( $content, $target = '_blank', $tags = array('a') ) {
4593
+function links_add_target($content, $target = '_blank', $tags = array('a')) {
4595 4594
 	global $_links_add_target;
4596 4595
 	$_links_add_target = $target;
4597
-	$tags = implode('|', (array)$tags);
4598
-	return preg_replace_callback( "!<($tags)([^>]*)>!i", '_links_add_target', $content );
4596
+	$tags = implode('|', (array) $tags);
4597
+	return preg_replace_callback("!<($tags)([^>]*)>!i", '_links_add_target', $content);
4599 4598
 }
4600 4599
 
4601 4600
 /**
@@ -4609,11 +4608,11 @@  discard block
 block discarded – undo
4609 4608
  * @param string $m The matched link.
4610 4609
  * @return string The processed link.
4611 4610
  */
4612
-function _links_add_target( $m ) {
4611
+function _links_add_target($m) {
4613 4612
 	global $_links_add_target;
4614 4613
 	$tag = $m[1];
4615 4614
 	$link = preg_replace('|( target=([\'"])(.*?)\2)|i', '', $m[2]);
4616
-	return '<' . $tag . $link . ' target="' . esc_attr( $_links_add_target ) . '">';
4615
+	return '<'.$tag.$link.' target="'.esc_attr($_links_add_target).'">';
4617 4616
 }
4618 4617
 
4619 4618
 /**
@@ -4624,10 +4623,10 @@  discard block
 block discarded – undo
4624 4623
  * @param string $str The string to normalize.
4625 4624
  * @return string The normalized string.
4626 4625
  */
4627
-function normalize_whitespace( $str ) {
4628
-	$str  = trim( $str );
4629
-	$str  = str_replace( "\r", "\n", $str );
4630
-	$str  = preg_replace( array( '/\n+/', '/[ \t]+/' ), array( "\n", ' ' ), $str );
4626
+function normalize_whitespace($str) {
4627
+	$str  = trim($str);
4628
+	$str  = str_replace("\r", "\n", $str);
4629
+	$str  = preg_replace(array('/\n+/', '/[ \t]+/'), array("\n", ' '), $str);
4631 4630
 	return $str;
4632 4631
 }
4633 4632
 
@@ -4645,13 +4644,13 @@  discard block
 block discarded – undo
4645 4644
  * @return string The processed string.
4646 4645
  */
4647 4646
 function wp_strip_all_tags($string, $remove_breaks = false) {
4648
-	$string = preg_replace( '@<(script|style)[^>]*?>.*?</\\1>@si', '', $string );
4647
+	$string = preg_replace('@<(script|style)[^>]*?>.*?</\\1>@si', '', $string);
4649 4648
 	$string = strip_tags($string);
4650 4649
 
4651
-	if ( $remove_breaks )
4650
+	if ($remove_breaks)
4652 4651
 		$string = preg_replace('/[\r\n\t ]+/', ' ', $string);
4653 4652
 
4654
-	return trim( $string );
4653
+	return trim($string);
4655 4654
 }
4656 4655
 
4657 4656
 /**
@@ -4672,8 +4671,8 @@  discard block
 block discarded – undo
4672 4671
  * @param string $str String to sanitize.
4673 4672
  * @return string Sanitized string.
4674 4673
  */
4675
-function sanitize_text_field( $str ) {
4676
-	$filtered = _sanitize_text_fields( $str, false );
4674
+function sanitize_text_field($str) {
4675
+	$filtered = _sanitize_text_fields($str, false);
4677 4676
 
4678 4677
 	/**
4679 4678
 	 * Filters a sanitized text field string.
@@ -4683,7 +4682,7 @@  discard block
 block discarded – undo
4683 4682
 	 * @param string $filtered The sanitized string.
4684 4683
 	 * @param string $str      The string prior to being sanitized.
4685 4684
 	 */
4686
-	return apply_filters( 'sanitize_text_field', $filtered, $str );
4685
+	return apply_filters('sanitize_text_field', $filtered, $str);
4687 4686
 }
4688 4687
 
4689 4688
 /**
@@ -4700,8 +4699,8 @@  discard block
 block discarded – undo
4700 4699
  * @param string $str String to sanitize.
4701 4700
  * @return string Sanitized string.
4702 4701
  */
4703
-function sanitize_textarea_field( $str ) {
4704
-	$filtered = _sanitize_text_fields( $str, true );
4702
+function sanitize_textarea_field($str) {
4703
+	$filtered = _sanitize_text_fields($str, true);
4705 4704
 
4706 4705
 	/**
4707 4706
 	 * Filters a sanitized textarea field string.
@@ -4711,7 +4710,7 @@  discard block
 block discarded – undo
4711 4710
 	 * @param string $filtered The sanitized string.
4712 4711
 	 * @param string $str      The string prior to being sanitized.
4713 4712
 	 */
4714
-	return apply_filters( 'sanitize_textarea_field', $filtered, $str );
4713
+	return apply_filters('sanitize_textarea_field', $filtered, $str);
4715 4714
 }
4716 4715
 
4717 4716
 /**
@@ -4724,33 +4723,33 @@  discard block
 block discarded – undo
4724 4723
  * @param bool $keep_newlines optional Whether to keep newlines. Default: false.
4725 4724
  * @return string Sanitized string.
4726 4725
  */
4727
-function _sanitize_text_fields( $str, $keep_newlines = false ) {
4728
-	$filtered = wp_check_invalid_utf8( $str );
4726
+function _sanitize_text_fields($str, $keep_newlines = false) {
4727
+	$filtered = wp_check_invalid_utf8($str);
4729 4728
 
4730
-	if ( strpos($filtered, '<') !== false ) {
4731
-		$filtered = wp_pre_kses_less_than( $filtered );
4729
+	if (strpos($filtered, '<') !== false) {
4730
+		$filtered = wp_pre_kses_less_than($filtered);
4732 4731
 		// This will strip extra whitespace for us.
4733
-		$filtered = wp_strip_all_tags( $filtered, false );
4732
+		$filtered = wp_strip_all_tags($filtered, false);
4734 4733
 
4735 4734
 		// Use html entities in a special case to make sure no later
4736 4735
 		// newline stripping stage could lead to a functional tag
4737 4736
 		$filtered = str_replace("<\n", "&lt;\n", $filtered);
4738 4737
 	}
4739 4738
 
4740
-	if ( ! $keep_newlines ) {
4741
-		$filtered = preg_replace( '/[\r\n\t ]+/', ' ', $filtered );
4739
+	if ( ! $keep_newlines) {
4740
+		$filtered = preg_replace('/[\r\n\t ]+/', ' ', $filtered);
4742 4741
 	}
4743
-	$filtered = trim( $filtered );
4742
+	$filtered = trim($filtered);
4744 4743
 
4745 4744
 	$found = false;
4746
-	while ( preg_match('/%[a-f0-9]{2}/i', $filtered, $match) ) {
4745
+	while (preg_match('/%[a-f0-9]{2}/i', $filtered, $match)) {
4747 4746
 		$filtered = str_replace($match[0], '', $filtered);
4748 4747
 		$found = true;
4749 4748
 	}
4750 4749
 
4751
-	if ( $found ) {
4750
+	if ($found) {
4752 4751
 		// Strip out the whitespace that may now exist after removing the octets.
4753
-		$filtered = trim( preg_replace('/ +/', ' ', $filtered) );
4752
+		$filtered = trim(preg_replace('/ +/', ' ', $filtered));
4754 4753
 	}
4755 4754
 
4756 4755
 	return $filtered;
@@ -4765,8 +4764,8 @@  discard block
 block discarded – undo
4765 4764
  * @param string $suffix If the filename ends in suffix this will also be cut off.
4766 4765
  * @return string
4767 4766
  */
4768
-function wp_basename( $path, $suffix = '' ) {
4769
-	return urldecode( basename( str_replace( array( '%2F', '%5C' ), '/', urlencode( $path ) ), $suffix ) );
4767
+function wp_basename($path, $suffix = '') {
4768
+	return urldecode(basename(str_replace(array('%2F', '%5C'), '/', urlencode($path)), $suffix));
4770 4769
 }
4771 4770
 
4772 4771
 /**
@@ -4781,19 +4780,19 @@  discard block
 block discarded – undo
4781 4780
  * @param string $text The text to be modified.
4782 4781
  * @return string The modified text.
4783 4782
  */
4784
-function capital_P_dangit( $text ) {
4783
+function capital_P_dangit($text) {
4785 4784
 	// Simple replacement for titles
4786 4785
 	$current_filter = current_filter();
4787
-	if ( 'the_title' === $current_filter || 'wp_title' === $current_filter )
4788
-		return str_replace( 'Wordpress', 'WordPress', $text );
4786
+	if ('the_title' === $current_filter || 'wp_title' === $current_filter)
4787
+		return str_replace('Wordpress', 'WordPress', $text);
4789 4788
 	// Still here? Use the more judicious replacement
4790 4789
 	static $dblq = false;
4791
-	if ( false === $dblq ) {
4792
-		$dblq = _x( '&#8220;', 'opening curly double quote' );
4790
+	if (false === $dblq) {
4791
+		$dblq = _x('&#8220;', 'opening curly double quote');
4793 4792
 	}
4794 4793
 	return str_replace(
4795
-		array( ' Wordpress', '&#8216;Wordpress', $dblq . 'Wordpress', '>Wordpress', '(Wordpress' ),
4796
-		array( ' WordPress', '&#8216;WordPress', $dblq . 'WordPress', '>WordPress', '(WordPress' ),
4794
+		array(' Wordpress', '&#8216;Wordpress', $dblq.'Wordpress', '>Wordpress', '(Wordpress'),
4795
+		array(' WordPress', '&#8216;WordPress', $dblq.'WordPress', '>WordPress', '(WordPress'),
4797 4796
 	$text );
4798 4797
 }
4799 4798
 
@@ -4805,8 +4804,8 @@  discard block
 block discarded – undo
4805 4804
  * @param string $mime_type Mime type
4806 4805
  * @return string Sanitized mime type
4807 4806
  */
4808
-function sanitize_mime_type( $mime_type ) {
4809
-	$sani_mime_type = preg_replace( '/[^-+*.a-zA-Z0-9\/]/', '', $mime_type );
4807
+function sanitize_mime_type($mime_type) {
4808
+	$sani_mime_type = preg_replace('/[^-+*.a-zA-Z0-9\/]/', '', $mime_type);
4810 4809
 	/**
4811 4810
 	 * Filters a mime type following sanitization.
4812 4811
 	 *
@@ -4815,7 +4814,7 @@  discard block
 block discarded – undo
4815 4814
 	 * @param string $sani_mime_type The sanitized mime type.
4816 4815
 	 * @param string $mime_type      The mime type prior to sanitization.
4817 4816
 	 */
4818
-	return apply_filters( 'sanitize_mime_type', $sani_mime_type, $mime_type );
4817
+	return apply_filters('sanitize_mime_type', $sani_mime_type, $mime_type);
4819 4818
 }
4820 4819
 
4821 4820
 /**
@@ -4826,14 +4825,14 @@  discard block
 block discarded – undo
4826 4825
  * @param string $to_ping Space or carriage return separated URLs
4827 4826
  * @return string URLs starting with the http or https protocol, separated by a carriage return.
4828 4827
  */
4829
-function sanitize_trackback_urls( $to_ping ) {
4830
-	$urls_to_ping = preg_split( '/[\r\n\t ]/', trim( $to_ping ), -1, PREG_SPLIT_NO_EMPTY );
4831
-	foreach ( $urls_to_ping as $k => $url ) {
4832
-		if ( !preg_match( '#^https?://.#i', $url ) )
4833
-			unset( $urls_to_ping[$k] );
4828
+function sanitize_trackback_urls($to_ping) {
4829
+	$urls_to_ping = preg_split('/[\r\n\t ]/', trim($to_ping), -1, PREG_SPLIT_NO_EMPTY);
4830
+	foreach ($urls_to_ping as $k => $url) {
4831
+		if ( ! preg_match('#^https?://.#i', $url))
4832
+			unset($urls_to_ping[$k]);
4834 4833
 	}
4835
-	$urls_to_ping = array_map( 'esc_url_raw', $urls_to_ping );
4836
-	$urls_to_ping = implode( "\n", $urls_to_ping );
4834
+	$urls_to_ping = array_map('esc_url_raw', $urls_to_ping);
4835
+	$urls_to_ping = implode("\n", $urls_to_ping);
4837 4836
 	/**
4838 4837
 	 * Filters a list of trackback URLs following sanitization.
4839 4838
 	 *
@@ -4845,7 +4844,7 @@  discard block
 block discarded – undo
4845 4844
 	 * @param string $urls_to_ping Sanitized space or carriage return separated URLs.
4846 4845
 	 * @param string $to_ping      Space or carriage return separated URLs before sanitization.
4847 4846
 	 */
4848
-	return apply_filters( 'sanitize_trackback_urls', $urls_to_ping, $to_ping );
4847
+	return apply_filters('sanitize_trackback_urls', $urls_to_ping, $to_ping);
4849 4848
 }
4850 4849
 
4851 4850
 /**
@@ -4859,17 +4858,17 @@  discard block
 block discarded – undo
4859 4858
  * @param string|array $value String or array of strings to slash.
4860 4859
  * @return string|array Slashed $value
4861 4860
  */
4862
-function wp_slash( $value ) {
4863
-	if ( is_array( $value ) ) {
4864
-		foreach ( $value as $k => $v ) {
4865
-			if ( is_array( $v ) ) {
4866
-				$value[$k] = wp_slash( $v );
4861
+function wp_slash($value) {
4862
+	if (is_array($value)) {
4863
+		foreach ($value as $k => $v) {
4864
+			if (is_array($v)) {
4865
+				$value[$k] = wp_slash($v);
4867 4866
 			} else {
4868
-				$value[$k] = addslashes( $v );
4867
+				$value[$k] = addslashes($v);
4869 4868
 			}
4870 4869
 		}
4871 4870
 	} else {
4872
-		$value = addslashes( $value );
4871
+		$value = addslashes($value);
4873 4872
 	}
4874 4873
 
4875 4874
 	return $value;
@@ -4886,8 +4885,8 @@  discard block
 block discarded – undo
4886 4885
  * @param string|array $value String or array of strings to unslash.
4887 4886
  * @return string|array Unslashed $value
4888 4887
  */
4889
-function wp_unslash( $value ) {
4890
-	return stripslashes_deep( $value );
4888
+function wp_unslash($value) {
4889
+	return stripslashes_deep($value);
4891 4890
 }
4892 4891
 
4893 4892
 /**
@@ -4898,13 +4897,13 @@  discard block
 block discarded – undo
4898 4897
  * @param string $content A string which might contain a URL.
4899 4898
  * @return string|false The found URL.
4900 4899
  */
4901
-function get_url_in_content( $content ) {
4902
-	if ( empty( $content ) ) {
4900
+function get_url_in_content($content) {
4901
+	if (empty($content)) {
4903 4902
 		return false;
4904 4903
 	}
4905 4904
 
4906
-	if ( preg_match( '/<a\s[^>]*?href=([\'"])(.+?)\1/is', $content, $matches ) ) {
4907
-		return esc_url_raw( $matches[2] );
4905
+	if (preg_match('/<a\s[^>]*?href=([\'"])(.+?)\1/is', $content, $matches)) {
4906
+		return esc_url_raw($matches[2]);
4908 4907
 	}
4909 4908
 
4910 4909
 	return false;
@@ -4926,7 +4925,7 @@  discard block
 block discarded – undo
4926 4925
 function wp_spaces_regexp() {
4927 4926
 	static $spaces = '';
4928 4927
 
4929
-	if ( empty( $spaces ) ) {
4928
+	if (empty($spaces)) {
4930 4929
 		/**
4931 4930
 		 * Filters the regexp for common whitespace characters.
4932 4931
 		 *
@@ -4939,7 +4938,7 @@  discard block
 block discarded – undo
4939 4938
 		 *
4940 4939
 		 * @param string $spaces Regexp pattern for matching common whitespace characters.
4941 4940
 		 */
4942
-		$spaces = apply_filters( 'wp_spaces_regexp', '[\r\n\t ]|\xC2\xA0|&nbsp;' );
4941
+		$spaces = apply_filters('wp_spaces_regexp', '[\r\n\t ]|\xC2\xA0|&nbsp;');
4943 4942
 	}
4944 4943
 
4945 4944
 	return $spaces;
@@ -4955,7 +4954,7 @@  discard block
 block discarded – undo
4955 4954
 function print_emoji_styles() {
4956 4955
 	static $printed = false;
4957 4956
 
4958
-	if ( $printed ) {
4957
+	if ($printed) {
4959 4958
 		return;
4960 4959
 	}
4961 4960
 
@@ -4987,7 +4986,7 @@  discard block
 block discarded – undo
4987 4986
 function print_emoji_detection_script() {
4988 4987
 	static $printed = false;
4989 4988
 
4990
-	if ( $printed ) {
4989
+	if ($printed) {
4991 4990
 		return;
4992 4991
 	}
4993 4992
 
@@ -5012,7 +5011,7 @@  discard block
 block discarded – undo
5012 5011
 		 *
5013 5012
 		 * @param string The emoji base URL for png images.
5014 5013
 		 */
5015
-		'baseUrl' => apply_filters( 'emoji_url', 'https://s.w.org/images/core/emoji/2.3/72x72/' ),
5014
+		'baseUrl' => apply_filters('emoji_url', 'https://s.w.org/images/core/emoji/2.3/72x72/'),
5016 5015
 
5017 5016
 		/**
5018 5017
 		 * Filters the extension of the emoji png files.
@@ -5021,7 +5020,7 @@  discard block
 block discarded – undo
5021 5020
 		 *
5022 5021
 		 * @param string The emoji extension for png files. Default .png.
5023 5022
 		 */
5024
-		'ext' => apply_filters( 'emoji_ext', '.png' ),
5023
+		'ext' => apply_filters('emoji_ext', '.png'),
5025 5024
 
5026 5025
 		/**
5027 5026
 		 * Filters the URL where emoji SVG images are hosted.
@@ -5030,7 +5029,7 @@  discard block
 block discarded – undo
5030 5029
 		 *
5031 5030
 		 * @param string The emoji base URL for svg images.
5032 5031
 		 */
5033
-		'svgUrl' => apply_filters( 'emoji_svg_url', 'https://s.w.org/images/core/emoji/2.3/svg/' ),
5032
+		'svgUrl' => apply_filters('emoji_svg_url', 'https://s.w.org/images/core/emoji/2.3/svg/'),
5034 5033
 
5035 5034
 		/**
5036 5035
 		 * Filters the extension of the emoji SVG files.
@@ -5039,29 +5038,29 @@  discard block
 block discarded – undo
5039 5038
 		 *
5040 5039
 		 * @param string The emoji extension for svg files. Default .svg.
5041 5040
 		 */
5042
-		'svgExt' => apply_filters( 'emoji_svg_ext', '.svg' ),
5041
+		'svgExt' => apply_filters('emoji_svg_ext', '.svg'),
5043 5042
 	);
5044 5043
 
5045
-	$version = 'ver=' . get_bloginfo( 'version' );
5044
+	$version = 'ver='.get_bloginfo('version');
5046 5045
 
5047
-	if ( SCRIPT_DEBUG ) {
5046
+	if (SCRIPT_DEBUG) {
5048 5047
 		$settings['source'] = array(
5049 5048
 			/** This filter is documented in wp-includes/class.wp-scripts.php */
5050
-			'wpemoji' => apply_filters( 'script_loader_src', includes_url( "js/wp-emoji.js?$version" ), 'wpemoji' ),
5049
+			'wpemoji' => apply_filters('script_loader_src', includes_url("js/wp-emoji.js?$version"), 'wpemoji'),
5051 5050
 			/** This filter is documented in wp-includes/class.wp-scripts.php */
5052
-			'twemoji' => apply_filters( 'script_loader_src', includes_url( "js/twemoji.js?$version" ), 'twemoji' ),
5051
+			'twemoji' => apply_filters('script_loader_src', includes_url("js/twemoji.js?$version"), 'twemoji'),
5053 5052
 		);
5054 5053
 
5055 5054
 		?>
5056 5055
 		<script type="text/javascript">
5057
-			window._wpemojiSettings = <?php echo wp_json_encode( $settings ); ?>;
5058
-			<?php readfile( ABSPATH . WPINC . "/js/wp-emoji-loader.js" ); ?>
5056
+			window._wpemojiSettings = <?php echo wp_json_encode($settings); ?>;
5057
+			<?php readfile(ABSPATH.WPINC."/js/wp-emoji-loader.js"); ?>
5059 5058
 		</script>
5060 5059
 		<?php
5061 5060
 	} else {
5062 5061
 		$settings['source'] = array(
5063 5062
 			/** This filter is documented in wp-includes/class.wp-scripts.php */
5064
-			'concatemoji' => apply_filters( 'script_loader_src', includes_url( "js/wp-emoji-release.min.js?$version" ), 'concatemoji' ),
5063
+			'concatemoji' => apply_filters('script_loader_src', includes_url("js/wp-emoji-release.min.js?$version"), 'concatemoji'),
5065 5064
 		);
5066 5065
 
5067 5066
 		/*
@@ -5076,7 +5075,7 @@  discard block
 block discarded – undo
5076 5075
 		 */
5077 5076
 		?>
5078 5077
 		<script type="text/javascript">
5079
-			window._wpemojiSettings = <?php echo wp_json_encode( $settings ); ?>;
5078
+			window._wpemojiSettings = <?php echo wp_json_encode($settings); ?>;
5080 5079
 			include "js/wp-emoji-loader.min.js"
5081 5080
 		</script>
5082 5081
 		<?php
@@ -5096,8 +5095,8 @@  discard block
 block discarded – undo
5096 5095
  * @param string $content The content to encode.
5097 5096
  * @return string The encoded content.
5098 5097
  */
5099
-function wp_encode_emoji( $content ) {
5100
-	if ( function_exists( 'mb_convert_encoding' ) ) {
5098
+function wp_encode_emoji($content) {
5099
+	if (function_exists('mb_convert_encoding')) {
5101 5100
 		$regex = '/(
5102 5101
 		     \x23\xE2\x83\xA3               # Digits
5103 5102
 		     [\x30-\x39]\xE2\x83\xA3
@@ -5109,18 +5108,18 @@  discard block
 block discarded – undo
5109 5108
 		)/x';
5110 5109
 
5111 5110
 		$matches = array();
5112
-		if ( preg_match_all( $regex, $content, $matches ) ) {
5113
-			if ( ! empty( $matches[1] ) ) {
5114
-				foreach ( $matches[1] as $emoji ) {
5111
+		if (preg_match_all($regex, $content, $matches)) {
5112
+			if ( ! empty($matches[1])) {
5113
+				foreach ($matches[1] as $emoji) {
5115 5114
 					/*
5116 5115
 					 * UTF-32's hex encoding is the same as HTML's hex encoding.
5117 5116
 					 * So, by converting the emoji from UTF-8 to UTF-32, we magically
5118 5117
 					 * get the correct hex encoding.
5119 5118
 					 */
5120
-					$unpacked = unpack( 'H*', mb_convert_encoding( $emoji, 'UTF-32', 'UTF-8' ) );
5121
-					if ( isset( $unpacked[1] ) ) {
5122
-						$entity = '&#x' . ltrim( $unpacked[1], '0' ) . ';';
5123
-						$content = str_replace( $emoji, $entity, $content );
5119
+					$unpacked = unpack('H*', mb_convert_encoding($emoji, 'UTF-32', 'UTF-8'));
5120
+					if (isset($unpacked[1])) {
5121
+						$entity = '&#x'.ltrim($unpacked[1], '0').';';
5122
+						$content = str_replace($emoji, $entity, $content);
5124 5123
 					}
5125 5124
 				}
5126 5125
 			}
@@ -5138,14 +5137,14 @@  discard block
 block discarded – undo
5138 5137
  * @param string $text The content to encode.
5139 5138
  * @return string The encoded content.
5140 5139
  */
5141
-function wp_staticize_emoji( $text ) {
5142
-	$text = wp_encode_emoji( $text );
5140
+function wp_staticize_emoji($text) {
5141
+	$text = wp_encode_emoji($text);
5143 5142
 
5144 5143
 	/** This filter is documented in wp-includes/formatting.php */
5145
-	$cdn_url = apply_filters( 'emoji_url', 'https://s.w.org/images/core/emoji/2.3/72x72/' );
5144
+	$cdn_url = apply_filters('emoji_url', 'https://s.w.org/images/core/emoji/2.3/72x72/');
5146 5145
 
5147 5146
 	/** This filter is documented in wp-includes/formatting.php */
5148
-	$ext = apply_filters( 'emoji_ext', '.png' );
5147
+	$ext = apply_filters('emoji_ext', '.png');
5149 5148
 
5150 5149
 	$output = '';
5151 5150
 	/*
@@ -5154,33 +5153,33 @@  discard block
 block discarded – undo
5154 5153
 	 *
5155 5154
 	 * First, capture the tags as well as in between.
5156 5155
 	 */
5157
-	$textarr = preg_split( '/(<.*>)/U', $text, -1, PREG_SPLIT_DELIM_CAPTURE );
5158
-	$stop = count( $textarr );
5156
+	$textarr = preg_split('/(<.*>)/U', $text, -1, PREG_SPLIT_DELIM_CAPTURE);
5157
+	$stop = count($textarr);
5159 5158
 
5160 5159
 	// Ignore processing of specific tags.
5161 5160
 	$tags_to_ignore = 'code|pre|style|script|textarea';
5162 5161
 	$ignore_block_element = '';
5163 5162
 
5164
-	for ( $i = 0; $i < $stop; $i++ ) {
5163
+	for ($i = 0; $i < $stop; $i++) {
5165 5164
 		$content = $textarr[$i];
5166 5165
 
5167 5166
 		// If we're in an ignore block, wait until we find its closing tag.
5168
-		if ( '' == $ignore_block_element && preg_match( '/^<(' . $tags_to_ignore . ')>/', $content, $matches ) )  {
5167
+		if ('' == $ignore_block_element && preg_match('/^<('.$tags_to_ignore.')>/', $content, $matches)) {
5169 5168
 			$ignore_block_element = $matches[1];
5170 5169
 		}
5171 5170
 
5172 5171
 		// If it's not a tag and not in ignore block.
5173
-		if ( '' ==  $ignore_block_element && strlen( $content ) > 0 && '<' != $content[0] ) {
5172
+		if ('' == $ignore_block_element && strlen($content) > 0 && '<' != $content[0]) {
5174 5173
 			$matches = array();
5175
-			if ( preg_match_all( '/(&#x1f1(e[6-9a-f]|f[0-9a-f]);){2}/', $content, $matches ) ) {
5176
-				if ( ! empty( $matches[0] ) ) {
5177
-					foreach ( $matches[0] as $flag ) {
5178
-						$chars = str_replace( array( '&#x', ';'), '', $flag );
5174
+			if (preg_match_all('/(&#x1f1(e[6-9a-f]|f[0-9a-f]);){2}/', $content, $matches)) {
5175
+				if ( ! empty($matches[0])) {
5176
+					foreach ($matches[0] as $flag) {
5177
+						$chars = str_replace(array('&#x', ';'), '', $flag);
5179 5178
 
5180
-						list( $char1, $char2 ) = str_split( $chars, 5 );
5181
-						$entity = sprintf( '<img src="%s" alt="%s" class="wp-smiley" style="height: 1em; max-height: 1em;" />', $cdn_url . $char1 . '-' . $char2 . $ext, html_entity_decode( $flag ) );
5179
+						list($char1, $char2) = str_split($chars, 5);
5180
+						$entity = sprintf('<img src="%s" alt="%s" class="wp-smiley" style="height: 1em; max-height: 1em;" />', $cdn_url.$char1.'-'.$char2.$ext, html_entity_decode($flag));
5182 5181
 
5183
-						$content = str_replace( $flag, $entity, $content );
5182
+						$content = str_replace($flag, $entity, $content);
5184 5183
 					}
5185 5184
 				}
5186 5185
 			}
@@ -5189,20 +5188,20 @@  discard block
 block discarded – undo
5189 5188
 			$regex = '/(&#x[2-3][0-9a-f]{3};|&#x1f[1-6][0-9a-f]{2};)/';
5190 5189
 
5191 5190
 			$matches = array();
5192
-			if ( preg_match_all( $regex, $content, $matches ) ) {
5193
-				if ( ! empty( $matches[1] ) ) {
5194
-					foreach ( $matches[1] as $emoji ) {
5195
-						$char = str_replace( array( '&#x', ';'), '', $emoji );
5196
-						$entity = sprintf( '<img src="%s" alt="%s" class="wp-smiley" style="height: 1em; max-height: 1em;" />', $cdn_url . $char . $ext, html_entity_decode( $emoji ) );
5191
+			if (preg_match_all($regex, $content, $matches)) {
5192
+				if ( ! empty($matches[1])) {
5193
+					foreach ($matches[1] as $emoji) {
5194
+						$char = str_replace(array('&#x', ';'), '', $emoji);
5195
+						$entity = sprintf('<img src="%s" alt="%s" class="wp-smiley" style="height: 1em; max-height: 1em;" />', $cdn_url.$char.$ext, html_entity_decode($emoji));
5197 5196
 
5198
-						$content = str_replace( $emoji, $entity, $content );
5197
+						$content = str_replace($emoji, $entity, $content);
5199 5198
 					}
5200 5199
 				}
5201 5200
 			}
5202 5201
 		}
5203 5202
 
5204 5203
 		// Did we exit ignore block.
5205
-		if ( '' != $ignore_block_element && '</' . $ignore_block_element . '>' == $content )  {
5204
+		if ('' != $ignore_block_element && '</'.$ignore_block_element.'>' == $content) {
5206 5205
 			$ignore_block_element = '';
5207 5206
 		}
5208 5207
 
@@ -5220,8 +5219,8 @@  discard block
 block discarded – undo
5220 5219
  * @param array $mail The email data array.
5221 5220
  * @return array The email data array, with emoji in the message staticized.
5222 5221
  */
5223
-function wp_staticize_emoji_for_email( $mail ) {
5224
-	if ( ! isset( $mail['message'] ) ) {
5222
+function wp_staticize_emoji_for_email($mail) {
5223
+	if ( ! isset($mail['message'])) {
5225 5224
 		return $mail;
5226 5225
 	}
5227 5226
 
@@ -5233,47 +5232,47 @@  discard block
 block discarded – undo
5233 5232
 	 * is handling changing the Content-Type.
5234 5233
 	 */
5235 5234
 	$headers = array();
5236
-	if ( isset( $mail['headers'] ) ) {
5237
-		if ( is_array( $mail['headers'] ) ) {
5235
+	if (isset($mail['headers'])) {
5236
+		if (is_array($mail['headers'])) {
5238 5237
 			$headers = $mail['headers'];
5239 5238
 		} else {
5240
-			$headers = explode( "\n", str_replace( "\r\n", "\n", $mail['headers'] ) );
5239
+			$headers = explode("\n", str_replace("\r\n", "\n", $mail['headers']));
5241 5240
 		}
5242 5241
 	}
5243 5242
 
5244
-	foreach ( $headers as $header ) {
5245
-		if ( strpos($header, ':') === false ) {
5243
+	foreach ($headers as $header) {
5244
+		if (strpos($header, ':') === false) {
5246 5245
 			continue;
5247 5246
 		}
5248 5247
 
5249 5248
 		// Explode them out.
5250
-		list( $name, $content ) = explode( ':', trim( $header ), 2 );
5249
+		list($name, $content) = explode(':', trim($header), 2);
5251 5250
 
5252 5251
 		// Cleanup crew.
5253
-		$name    = trim( $name    );
5254
-		$content = trim( $content );
5252
+		$name    = trim($name);
5253
+		$content = trim($content);
5255 5254
 
5256
-		if ( 'content-type' === strtolower( $name ) ) {
5257
-			if ( strpos( $content, ';' ) !== false ) {
5258
-				list( $type, $charset ) = explode( ';', $content );
5259
-				$content_type = trim( $type );
5255
+		if ('content-type' === strtolower($name)) {
5256
+			if (strpos($content, ';') !== false) {
5257
+				list($type, $charset) = explode(';', $content);
5258
+				$content_type = trim($type);
5260 5259
 			} else {
5261
-				$content_type = trim( $content );
5260
+				$content_type = trim($content);
5262 5261
 			}
5263 5262
 			break;
5264 5263
 		}
5265 5264
 	}
5266 5265
 
5267 5266
 	// Set Content-Type if we don't have a content-type from the input headers.
5268
-	if ( ! isset( $content_type ) ) {
5267
+	if ( ! isset($content_type)) {
5269 5268
 		$content_type = 'text/plain';
5270 5269
 	}
5271 5270
 
5272 5271
 	/** This filter is documented in wp-includes/pluggable.php */
5273
-	$content_type = apply_filters( 'wp_mail_content_type', $content_type );
5272
+	$content_type = apply_filters('wp_mail_content_type', $content_type);
5274 5273
 
5275
-	if ( 'text/html' === $content_type ) {
5276
-		$mail['message'] = wp_staticize_emoji( $mail['message'] );
5274
+	if ('text/html' === $content_type) {
5275
+		$mail['message'] = wp_staticize_emoji($mail['message']);
5277 5276
 	}
5278 5277
 
5279 5278
 	return $mail;
@@ -5289,12 +5288,12 @@  discard block
 block discarded – undo
5289 5288
  * @param int    $length Optional. Maximum length of the shortened URL. Default 35 characters.
5290 5289
  * @return string Shortened URL.
5291 5290
  */
5292
-function url_shorten( $url, $length = 35 ) {
5293
-	$stripped = str_replace( array( 'https://', 'http://', 'www.' ), '', $url );
5294
-	$short_url = untrailingslashit( $stripped );
5291
+function url_shorten($url, $length = 35) {
5292
+	$stripped = str_replace(array('https://', 'http://', 'www.'), '', $url);
5293
+	$short_url = untrailingslashit($stripped);
5295 5294
 
5296
-	if ( strlen( $short_url ) > $length ) {
5297
-		$short_url = substr( $short_url, 0, $length - 3 ) . '&hellip;';
5295
+	if (strlen($short_url) > $length) {
5296
+		$short_url = substr($short_url, 0, $length - 3).'&hellip;';
5298 5297
 	}
5299 5298
 	return $short_url;
5300 5299
 }
@@ -5310,13 +5309,13 @@  discard block
 block discarded – undo
5310 5309
  * @param string $color
5311 5310
  * @return string|void
5312 5311
  */
5313
-function sanitize_hex_color( $color ) {
5314
-	if ( '' === $color ) {
5312
+function sanitize_hex_color($color) {
5313
+	if ('' === $color) {
5315 5314
 		return '';
5316 5315
 	}
5317 5316
 
5318 5317
 	// 3 or 6 hex digits, or the empty string.
5319
-	if ( preg_match('|^#([A-Fa-f0-9]{3}){1,2}$|', $color ) ) {
5318
+	if (preg_match('|^#([A-Fa-f0-9]{3}){1,2}$|', $color)) {
5320 5319
 		return $color;
5321 5320
 	}
5322 5321
 }
@@ -5335,14 +5334,14 @@  discard block
 block discarded – undo
5335 5334
  * @param string $color
5336 5335
  * @return string|null
5337 5336
  */
5338
-function sanitize_hex_color_no_hash( $color ) {
5339
-	$color = ltrim( $color, '#' );
5337
+function sanitize_hex_color_no_hash($color) {
5338
+	$color = ltrim($color, '#');
5340 5339
 
5341
-	if ( '' === $color ) {
5340
+	if ('' === $color) {
5342 5341
 		return '';
5343 5342
 	}
5344 5343
 
5345
-	return sanitize_hex_color( '#' . $color ) ? $color : null;
5344
+	return sanitize_hex_color('#'.$color) ? $color : null;
5346 5345
 }
5347 5346
 
5348 5347
 /**
@@ -5356,9 +5355,9 @@  discard block
 block discarded – undo
5356 5355
  * @param string $color
5357 5356
  * @return string
5358 5357
  */
5359
-function maybe_hash_hex_color( $color ) {
5360
-	if ( $unhashed = sanitize_hex_color_no_hash( $color ) ) {
5361
-		return '#' . $unhashed;
5358
+function maybe_hash_hex_color($color) {
5359
+	if ($unhashed = sanitize_hex_color_no_hash($color)) {
5360
+		return '#'.$unhashed;
5362 5361
 	}
5363 5362
 
5364 5363
 	return $color;
Please login to merge, or discard this patch.
Braces   +222 added lines, -139 removed lines patch added patch discarded remove patch
@@ -429,8 +429,9 @@  discard block
 block discarded – undo
429 429
 function wpautop( $pee, $br = true ) {
430 430
 	$pre_tags = array();
431 431
 
432
-	if ( trim($pee) === '' )
433
-		return '';
432
+	if ( trim($pee) === '' ) {
433
+			return '';
434
+	}
434 435
 
435 436
 	// Just to make things a little easier, pad the end.
436 437
 	$pee = $pee . "\n";
@@ -571,8 +572,9 @@  discard block
 block discarded – undo
571 572
 	$pee = preg_replace( "|\n</p>$|", '</p>', $pee );
572 573
 
573 574
 	// Replace placeholder <pre> tags with their original content.
574
-	if ( !empty($pre_tags) )
575
-		$pee = str_replace(array_keys($pre_tags), array_values($pre_tags), $pee);
575
+	if ( !empty($pre_tags) ) {
576
+			$pee = str_replace(array_keys($pre_tags), array_values($pre_tags), $pee);
577
+	}
576 578
 
577 579
 	// Restore newlines in all elements.
578 580
 	if ( false !== strpos( $pee, '<!-- wpnl -->' ) ) {
@@ -856,16 +858,38 @@  discard block
 block discarded – undo
856 858
 	reset_mbstring_encoding();
857 859
 	for ($i=0; $i < $length; $i++) {
858 860
 		$c = ord($str[$i]);
859
-		if ($c < 0x80) $n = 0; // 0bbbbbbb
860
-		elseif (($c & 0xE0) == 0xC0) $n=1; // 110bbbbb
861
-		elseif (($c & 0xF0) == 0xE0) $n=2; // 1110bbbb
862
-		elseif (($c & 0xF8) == 0xF0) $n=3; // 11110bbb
863
-		elseif (($c & 0xFC) == 0xF8) $n=4; // 111110bb
864
-		elseif (($c & 0xFE) == 0xFC) $n=5; // 1111110b
865
-		else return false; // Does not match any model
861
+		if ($c < 0x80) {
862
+			$n = 0;
863
+		}
864
+		// 0bbbbbbb
865
+		elseif (($c & 0xE0) == 0xC0) {
866
+			$n=1;
867
+		}
868
+		// 110bbbbb
869
+		elseif (($c & 0xF0) == 0xE0) {
870
+			$n=2;
871
+		}
872
+		// 1110bbbb
873
+		elseif (($c & 0xF8) == 0xF0) {
874
+			$n=3;
875
+		}
876
+		// 11110bbb
877
+		elseif (($c & 0xFC) == 0xF8) {
878
+			$n=4;
879
+		}
880
+		// 111110bb
881
+		elseif (($c & 0xFE) == 0xFC) {
882
+			$n=5;
883
+		}
884
+		// 1111110b
885
+		else {
886
+			return false;
887
+		}
888
+		// Does not match any model
866 889
 		for ($j=0; $j<$n; $j++) { // n bytes matching 10bbbbbb follow ?
867
-			if ((++$i == $length) || ((ord($str[$i]) & 0xC0) != 0x80))
868
-				return false;
890
+			if ((++$i == $length) || ((ord($str[$i]) & 0xC0) != 0x80)) {
891
+							return false;
892
+			}
869 893
 		}
870 894
 	}
871 895
 	return true;
@@ -897,18 +921,21 @@  discard block
 block discarded – undo
897 921
 function _wp_specialchars( $string, $quote_style = ENT_NOQUOTES, $charset = false, $double_encode = false ) {
898 922
 	$string = (string) $string;
899 923
 
900
-	if ( 0 === strlen( $string ) )
901
-		return '';
924
+	if ( 0 === strlen( $string ) ) {
925
+			return '';
926
+	}
902 927
 
903 928
 	// Don't bother if there are no specialchars - saves some processing
904
-	if ( ! preg_match( '/[&<>"\']/', $string ) )
905
-		return $string;
929
+	if ( ! preg_match( '/[&<>"\']/', $string ) ) {
930
+			return $string;
931
+	}
906 932
 
907 933
 	// Account for the previous behaviour of the function when the $quote_style is not an accepted value
908
-	if ( empty( $quote_style ) )
909
-		$quote_style = ENT_NOQUOTES;
910
-	elseif ( ! in_array( $quote_style, array( 0, 2, 3, 'single', 'double' ), true ) )
911
-		$quote_style = ENT_QUOTES;
934
+	if ( empty( $quote_style ) ) {
935
+			$quote_style = ENT_NOQUOTES;
936
+	} elseif ( ! in_array( $quote_style, array( 0, 2, 3, 'single', 'double' ), true ) ) {
937
+			$quote_style = ENT_QUOTES;
938
+	}
912 939
 
913 940
 	// Store the site charset as a static to avoid multiple calls to wp_load_alloptions()
914 941
 	if ( ! $charset ) {
@@ -920,8 +947,9 @@  discard block
 block discarded – undo
920 947
 		$charset = $_charset;
921 948
 	}
922 949
 
923
-	if ( in_array( $charset, array( 'utf8', 'utf-8', 'UTF8' ) ) )
924
-		$charset = 'UTF-8';
950
+	if ( in_array( $charset, array( 'utf8', 'utf-8', 'UTF8' ) ) ) {
951
+			$charset = 'UTF-8';
952
+	}
925 953
 
926 954
 	$_quote_style = $quote_style;
927 955
 
@@ -941,8 +969,9 @@  discard block
 block discarded – undo
941 969
 	$string = @htmlspecialchars( $string, $quote_style, $charset, $double_encode );
942 970
 
943 971
 	// Back-compat.
944
-	if ( 'single' === $_quote_style )
945
-		$string = str_replace( "'", '&#039;', $string );
972
+	if ( 'single' === $_quote_style ) {
973
+			$string = str_replace( "'", '&#039;', $string );
974
+	}
946 975
 
947 976
 	return $string;
948 977
 }
@@ -1090,8 +1119,9 @@  discard block
 block discarded – undo
1090 1119
 		$value = ord( $utf8_string[ $i ] );
1091 1120
 
1092 1121
 		if ( $value < 128 ) {
1093
-			if ( $length && ( $unicode_length >= $length ) )
1094
-				break;
1122
+			if ( $length && ( $unicode_length >= $length ) ) {
1123
+							break;
1124
+			}
1095 1125
 			$unicode .= chr($value);
1096 1126
 			$unicode_length++;
1097 1127
 		} else {
@@ -1107,8 +1137,9 @@  discard block
 block discarded – undo
1107 1137
 
1108 1138
 			$values[] = $value;
1109 1139
 
1110
-			if ( $length && ( $unicode_length + ($num_octets * 3) ) > $length )
1111
-				break;
1140
+			if ( $length && ( $unicode_length + ($num_octets * 3) ) > $length ) {
1141
+							break;
1142
+			}
1112 1143
 			if ( count( $values ) == $num_octets ) {
1113 1144
 				for ( $j = 0; $j < $num_octets; $j++ ) {
1114 1145
 					$unicode .= '%' . dechex( $values[ $j ] );
@@ -1512,8 +1543,9 @@  discard block
 block discarded – undo
1512 1543
  * @return string Filtered string with replaced "nice" characters.
1513 1544
  */
1514 1545
 function remove_accents( $string ) {
1515
-	if ( !preg_match('/[\x80-\xff]/', $string) )
1516
-		return $string;
1546
+	if ( !preg_match('/[\x80-\xff]/', $string) ) {
1547
+			return $string;
1548
+	}
1517 1549
 
1518 1550
 	if (seems_utf8($string)) {
1519 1551
 		$chars = array(
@@ -1822,8 +1854,9 @@  discard block
 block discarded – undo
1822 1854
 					break;
1823 1855
 				}
1824 1856
 			}
1825
-			if ( !$allowed )
1826
-				$filename .= '_';
1857
+			if ( !$allowed ) {
1858
+							$filename .= '_';
1859
+			}
1827 1860
 		}
1828 1861
 	}
1829 1862
 	$filename .= '.' . $extension;
@@ -1854,8 +1887,9 @@  discard block
 block discarded – undo
1854 1887
 	$username = preg_replace( '/&.+?;/', '', $username ); // Kill entities
1855 1888
 
1856 1889
 	// If strict, reduce to ASCII for max portability.
1857
-	if ( $strict )
1858
-		$username = preg_replace( '|[^a-z0-9 _.\-@]|i', '', $username );
1890
+	if ( $strict ) {
1891
+			$username = preg_replace( '|[^a-z0-9 _.\-@]|i', '', $username );
1892
+	}
1859 1893
 
1860 1894
 	$username = trim( $username );
1861 1895
 	// Consolidate contiguous whitespace
@@ -1916,8 +1950,9 @@  discard block
 block discarded – undo
1916 1950
 function sanitize_title( $title, $fallback_title = '', $context = 'save' ) {
1917 1951
 	$raw_title = $title;
1918 1952
 
1919
-	if ( 'save' == $context )
1920
-		$title = remove_accents($title);
1953
+	if ( 'save' == $context ) {
1954
+			$title = remove_accents($title);
1955
+	}
1921 1956
 
1922 1957
 	/**
1923 1958
 	 * Filters a sanitized title string.
@@ -1930,8 +1965,9 @@  discard block
 block discarded – undo
1930 1965
 	 */
1931 1966
 	$title = apply_filters( 'sanitize_title', $title, $raw_title, $context );
1932 1967
 
1933
-	if ( '' === $title || false === $title )
1934
-		$title = $fallback_title;
1968
+	if ( '' === $title || false === $title ) {
1969
+			$title = $fallback_title;
1970
+	}
1935 1971
 
1936 1972
 	return $title;
1937 1973
 }
@@ -2246,8 +2282,9 @@  discard block
 block discarded – undo
2246 2282
 			elseif ( substr( $regex[2], -1 ) == '/' ) {
2247 2283
 				// ...but it isn't a known single-entity self-closing tag, then don't let it be treated as such and
2248 2284
 				// immediately close it with a closing tag (the tag will encapsulate no text as a result)
2249
-				if ( ! in_array( $tag, $single_tags ) )
2250
-					$regex[2] = trim( substr( $regex[2], 0, -1 ) ) . "></$tag";
2285
+				if ( ! in_array( $tag, $single_tags ) ) {
2286
+									$regex[2] = trim( substr( $regex[2], 0, -1 ) ) . "></$tag";
2287
+				}
2251 2288
 			}
2252 2289
 			// ElseIf it's a known single-entity tag but it doesn't close itself, do so
2253 2290
 			elseif ( in_array($tag, $single_tags) ) {
@@ -2265,8 +2302,9 @@  discard block
 block discarded – undo
2265 2302
 
2266 2303
 			// Attributes
2267 2304
 			$attributes = $regex[2];
2268
-			if ( ! empty( $attributes ) && $attributes[0] != '>' )
2269
-				$attributes = ' ' . $attributes;
2305
+			if ( ! empty( $attributes ) && $attributes[0] != '>' ) {
2306
+							$attributes = ' ' . $attributes;
2307
+			}
2270 2308
 
2271 2309
 			$tag = '<' . $tag . $attributes . '>';
2272 2310
 			//If already queuing a close tag, then put this tag on, too
@@ -2286,8 +2324,10 @@  discard block
 block discarded – undo
2286 2324
 	$newtext .= $text;
2287 2325
 
2288 2326
 	// Empty Stack
2289
-	while( $x = array_pop($tagstack) )
2290
-		$newtext .= '</' . $x . '>'; // Add remaining tags to close
2327
+	while( $x = array_pop($tagstack) ) {
2328
+			$newtext .= '</' . $x . '>';
2329
+	}
2330
+	// Add remaining tags to close
2291 2331
 
2292 2332
 	// WP fix for the bug with HTML comments
2293 2333
 	$newtext = str_replace("< !--","<!--",$newtext);
@@ -2321,8 +2361,9 @@  discard block
 block discarded – undo
2321 2361
 	 * @param string $content The text, prior to formatting for editing.
2322 2362
 	 */
2323 2363
 	$content = apply_filters( 'format_to_edit', $content );
2324
-	if ( ! $rich_text )
2325
-		$content = esc_textarea( $content );
2364
+	if ( ! $rich_text ) {
2365
+			$content = esc_textarea( $content );
2366
+	}
2326 2367
 	return $content;
2327 2368
 }
2328 2369
 
@@ -2356,8 +2397,9 @@  discard block
 block discarded – undo
2356 2397
  * @return string String with backslashes inserted.
2357 2398
  */
2358 2399
 function backslashit( $string ) {
2359
-	if ( isset( $string[0] ) && $string[0] >= '0' && $string[0] <= '9' )
2360
-		$string = '\\\\' . $string;
2400
+	if ( isset( $string[0] ) && $string[0] >= '0' && $string[0] <= '9' ) {
2401
+			$string = '\\\\' . $string;
2402
+	}
2361 2403
 	return addcslashes( $string, 'A..Za..z' );
2362 2404
 }
2363 2405
 
@@ -2406,8 +2448,9 @@  discard block
 block discarded – undo
2406 2448
  * @return string Returns a string escaped with slashes.
2407 2449
  */
2408 2450
 function addslashes_gpc($gpc) {
2409
-	if ( get_magic_quotes_gpc() )
2410
-		$gpc = stripslashes($gpc);
2451
+	if ( get_magic_quotes_gpc() ) {
2452
+			$gpc = stripslashes($gpc);
2453
+	}
2411 2454
 
2412 2455
 	return wp_slash($gpc);
2413 2456
 }
@@ -2527,8 +2570,9 @@  discard block
 block discarded – undo
2527 2570
 	}
2528 2571
 
2529 2572
 	$url = esc_url($url);
2530
-	if ( empty($url) )
2531
-		return $matches[0];
2573
+	if ( empty($url) ) {
2574
+			return $matches[0];
2575
+	}
2532 2576
 
2533 2577
 	return $matches[1] . "<a href=\"$url\" rel=\"nofollow\">$url</a>" . $suffix;
2534 2578
 }
@@ -2556,8 +2600,9 @@  discard block
 block discarded – undo
2556 2600
 	}
2557 2601
 
2558 2602
 	$dest = esc_url($dest);
2559
-	if ( empty($dest) )
2560
-		return $matches[0];
2603
+	if ( empty($dest) ) {
2604
+			return $matches[0];
2605
+	}
2561 2606
 
2562 2607
 	return $matches[1] . "<a href=\"$dest\" rel=\"nofollow\">$dest</a>$ret";
2563 2608
 }
@@ -2595,10 +2640,11 @@  discard block
 block discarded – undo
2595 2640
 	$nested_code_pre = 0; // Keep track of how many levels link is nested inside <pre> or <code>
2596 2641
 	foreach ( $textarr as $piece ) {
2597 2642
 
2598
-		if ( preg_match( '|^<code[\s>]|i', $piece ) || preg_match( '|^<pre[\s>]|i', $piece ) || preg_match( '|^<script[\s>]|i', $piece ) || preg_match( '|^<style[\s>]|i', $piece ) )
2599
-			$nested_code_pre++;
2600
-		elseif ( $nested_code_pre && ( '</code>' === strtolower( $piece ) || '</pre>' === strtolower( $piece ) || '</script>' === strtolower( $piece ) || '</style>' === strtolower( $piece ) ) )
2601
-			$nested_code_pre--;
2643
+		if ( preg_match( '|^<code[\s>]|i', $piece ) || preg_match( '|^<pre[\s>]|i', $piece ) || preg_match( '|^<script[\s>]|i', $piece ) || preg_match( '|^<style[\s>]|i', $piece ) ) {
2644
+					$nested_code_pre++;
2645
+		} elseif ( $nested_code_pre && ( '</code>' === strtolower( $piece ) || '</pre>' === strtolower( $piece ) || '</script>' === strtolower( $piece ) || '</style>' === strtolower( $piece ) ) ) {
2646
+					$nested_code_pre--;
2647
+		}
2602 2648
 
2603 2649
 		if ( $nested_code_pre || empty( $piece ) || ( $piece[0] === '<' && ! preg_match( '|^<\s*[\w]{1,20}+://|', $piece ) ) ) {
2604 2650
 			$r .= $piece;
@@ -2775,8 +2821,9 @@  discard block
 block discarded – undo
2775 2821
 function translate_smiley( $matches ) {
2776 2822
 	global $wpsmiliestrans;
2777 2823
 
2778
-	if ( count( $matches ) == 0 )
2779
-		return '';
2824
+	if ( count( $matches ) == 0 ) {
2825
+			return '';
2826
+	}
2780 2827
 
2781 2828
 	$smiley = trim( reset( $matches ) );
2782 2829
 	$img = $wpsmiliestrans[ $smiley ];
@@ -2868,8 +2915,9 @@  discard block
 block discarded – undo
2868 2915
  * @return string|bool Either false or the valid email address.
2869 2916
  */
2870 2917
 function is_email( $email, $deprecated = false ) {
2871
-	if ( ! empty( $deprecated ) )
2872
-		_deprecated_argument( __FUNCTION__, '3.0.0' );
2918
+	if ( ! empty( $deprecated ) ) {
2919
+			_deprecated_argument( __FUNCTION__, '3.0.0' );
2920
+	}
2873 2921
 
2874 2922
 	// Test for the minimum length the email can be
2875 2923
 	if ( strlen( $email ) < 6 ) {
@@ -3033,13 +3081,15 @@  discard block
 block discarded – undo
3033 3081
 	$tz = get_option( 'timezone_string' );
3034 3082
 	if ( $tz ) {
3035 3083
 		$datetime = date_create( $string, new DateTimeZone( 'UTC' ) );
3036
-		if ( ! $datetime )
3037
-			return date( $format, 0 );
3084
+		if ( ! $datetime ) {
3085
+					return date( $format, 0 );
3086
+		}
3038 3087
 		$datetime->setTimezone( new DateTimeZone( $tz ) );
3039 3088
 		$string_localtime = $datetime->format( $format );
3040 3089
 	} else {
3041
-		if ( ! preg_match('#([0-9]{1,4})-([0-9]{1,2})-([0-9]{1,2}) ([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})#', $string, $matches) )
3042
-			return date( $format, 0 );
3090
+		if ( ! preg_match('#([0-9]{1,4})-([0-9]{1,2})-([0-9]{1,2}) ([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})#', $string, $matches) ) {
3091
+					return date( $format, 0 );
3092
+		}
3043 3093
 		$string_time = gmmktime( $matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1] );
3044 3094
 		$string_localtime = gmdate( $format, $string_time + get_option( 'gmt_offset' ) * HOUR_IN_SECONDS );
3045 3095
 	}
@@ -3222,38 +3272,44 @@  discard block
 block discarded – undo
3222 3272
 
3223 3273
 	if ( $diff < HOUR_IN_SECONDS ) {
3224 3274
 		$mins = round( $diff / MINUTE_IN_SECONDS );
3225
-		if ( $mins <= 1 )
3226
-			$mins = 1;
3275
+		if ( $mins <= 1 ) {
3276
+					$mins = 1;
3277
+		}
3227 3278
 		/* translators: Time difference between two dates, in minutes (min=minute). 1: Number of minutes */
3228 3279
 		$since = sprintf( _n( '%s min', '%s mins', $mins ), $mins );
3229 3280
 	} elseif ( $diff < DAY_IN_SECONDS && $diff >= HOUR_IN_SECONDS ) {
3230 3281
 		$hours = round( $diff / HOUR_IN_SECONDS );
3231
-		if ( $hours <= 1 )
3232
-			$hours = 1;
3282
+		if ( $hours <= 1 ) {
3283
+					$hours = 1;
3284
+		}
3233 3285
 		/* translators: Time difference between two dates, in hours. 1: Number of hours */
3234 3286
 		$since = sprintf( _n( '%s hour', '%s hours', $hours ), $hours );
3235 3287
 	} elseif ( $diff < WEEK_IN_SECONDS && $diff >= DAY_IN_SECONDS ) {
3236 3288
 		$days = round( $diff / DAY_IN_SECONDS );
3237
-		if ( $days <= 1 )
3238
-			$days = 1;
3289
+		if ( $days <= 1 ) {
3290
+					$days = 1;
3291
+		}
3239 3292
 		/* translators: Time difference between two dates, in days. 1: Number of days */
3240 3293
 		$since = sprintf( _n( '%s day', '%s days', $days ), $days );
3241 3294
 	} elseif ( $diff < MONTH_IN_SECONDS && $diff >= WEEK_IN_SECONDS ) {
3242 3295
 		$weeks = round( $diff / WEEK_IN_SECONDS );
3243
-		if ( $weeks <= 1 )
3244
-			$weeks = 1;
3296
+		if ( $weeks <= 1 ) {
3297
+					$weeks = 1;
3298
+		}
3245 3299
 		/* translators: Time difference between two dates, in weeks. 1: Number of weeks */
3246 3300
 		$since = sprintf( _n( '%s week', '%s weeks', $weeks ), $weeks );
3247 3301
 	} elseif ( $diff < YEAR_IN_SECONDS && $diff >= MONTH_IN_SECONDS ) {
3248 3302
 		$months = round( $diff / MONTH_IN_SECONDS );
3249
-		if ( $months <= 1 )
3250
-			$months = 1;
3303
+		if ( $months <= 1 ) {
3304
+					$months = 1;
3305
+		}
3251 3306
 		/* translators: Time difference between two dates, in months. 1: Number of months */
3252 3307
 		$since = sprintf( _n( '%s month', '%s months', $months ), $months );
3253 3308
 	} elseif ( $diff >= YEAR_IN_SECONDS ) {
3254 3309
 		$years = round( $diff / YEAR_IN_SECONDS );
3255
-		if ( $years <= 1 )
3256
-			$years = 1;
3310
+		if ( $years <= 1 ) {
3311
+					$years = 1;
3312
+		}
3257 3313
 		/* translators: Time difference between two dates, in years. 1: Number of years */
3258 3314
 		$since = sprintf( _n( '%s year', '%s years', $years ), $years );
3259 3315
 	}
@@ -3405,8 +3461,9 @@  discard block
 block discarded – undo
3405 3461
 	 * @param string $text           The text prior to entity conversion.
3406 3462
 	 */
3407 3463
 	$filtered = apply_filters( 'pre_ent2ncr', null, $text );
3408
-	if ( null !== $filtered )
3409
-		return $filtered;
3464
+	if ( null !== $filtered ) {
3465
+			return $filtered;
3466
+	}
3410 3467
 
3411 3468
 	$to_ncr = array(
3412 3469
 		'&quot;' => '&#34;',
@@ -3768,8 +3825,9 @@  discard block
 block discarded – undo
3768 3825
 function esc_url( $url, $protocols = null, $_context = 'display' ) {
3769 3826
 	$original_url = $url;
3770 3827
 
3771
-	if ( '' == $url )
3772
-		return $url;
3828
+	if ( '' == $url ) {
3829
+			return $url;
3830
+	}
3773 3831
 
3774 3832
 	$url = str_replace( ' ', '%20', $url );
3775 3833
 	$url = preg_replace('|[^a-z0-9-~+_.?#=!&;,/:%@$\|*\'()\[\]\\x80-\\xff]|i', '', $url);
@@ -3789,8 +3847,9 @@  discard block
 block discarded – undo
3789 3847
 	 * link starting with /, # or ? or a php file).
3790 3848
 	 */
3791 3849
 	if ( strpos($url, ':') === false && ! in_array( $url[0], array( '/', '#', '?' ) ) &&
3792
-		! preg_match('/^[a-z0-9-]+?\.php/i', $url) )
3793
-		$url = 'http://' . $url;
3850
+		! preg_match('/^[a-z0-9-]+?\.php/i', $url) ) {
3851
+			$url = 'http://' . $url;
3852
+	}
3794 3853
 
3795 3854
 	// Replace ampersands and single quotes only when displaying.
3796 3855
 	if ( 'display' == $_context ) {
@@ -3839,11 +3898,13 @@  discard block
 block discarded – undo
3839 3898
 	if ( '/' === $url[0] ) {
3840 3899
 		$good_protocol_url = $url;
3841 3900
 	} else {
3842
-		if ( ! is_array( $protocols ) )
3843
-			$protocols = wp_allowed_protocols();
3901
+		if ( ! is_array( $protocols ) ) {
3902
+					$protocols = wp_allowed_protocols();
3903
+		}
3844 3904
 		$good_protocol_url = wp_kses_bad_protocol( $url, $protocols );
3845
-		if ( strtolower( $good_protocol_url ) != strtolower( $url ) )
3846
-			return '';
3905
+		if ( strtolower( $good_protocol_url ) != strtolower( $url ) ) {
3906
+					return '';
3907
+		}
3847 3908
 	}
3848 3909
 
3849 3910
 	/**
@@ -4089,17 +4150,20 @@  discard block
 block discarded – undo
4089 4150
 		case 'posts_per_page':
4090 4151
 		case 'posts_per_rss':
4091 4152
 			$value = (int) $value;
4092
-			if ( empty($value) )
4093
-				$value = 1;
4094
-			if ( $value < -1 )
4095
-				$value = abs($value);
4153
+			if ( empty($value) ) {
4154
+							$value = 1;
4155
+			}
4156
+			if ( $value < -1 ) {
4157
+							$value = abs($value);
4158
+			}
4096 4159
 			break;
4097 4160
 
4098 4161
 		case 'default_ping_status':
4099 4162
 		case 'default_comment_status':
4100 4163
 			// Options that if not there have 0 value but need to be something like "closed"
4101
-			if ( $value == '0' || $value == '')
4102
-				$value = 'closed';
4164
+			if ( $value == '0' || $value == '') {
4165
+							$value = 'closed';
4166
+			}
4103 4167
 			break;
4104 4168
 
4105 4169
 		case 'blogdescription':
@@ -4122,10 +4186,11 @@  discard block
 block discarded – undo
4122 4186
 
4123 4187
 		case 'blog_public':
4124 4188
 			// This is the value if the settings checkbox is not checked on POST. Don't rely on this.
4125
-			if ( null === $value )
4126
-				$value = 1;
4127
-			else
4128
-				$value = intval( $value );
4189
+			if ( null === $value ) {
4190
+							$value = 1;
4191
+			} else {
4192
+							$value = intval( $value );
4193
+			}
4129 4194
 			break;
4130 4195
 
4131 4196
 		case 'date_format':
@@ -4195,13 +4260,15 @@  discard block
 block discarded – undo
4195 4260
 			if ( is_wp_error( $value ) ) {
4196 4261
 				$error = $value->get_error_message();
4197 4262
 			} else {
4198
-				if ( ! is_array( $value ) )
4199
-					$value = explode( ' ', $value );
4263
+				if ( ! is_array( $value ) ) {
4264
+									$value = explode( ' ', $value );
4265
+				}
4200 4266
 
4201 4267
 				$value = array_values( array_filter( array_map( 'trim', $value ) ) );
4202 4268
 
4203
-				if ( ! $value )
4204
-					$value = '';
4269
+				if ( ! $value ) {
4270
+									$value = '';
4271
+				}
4205 4272
 			}
4206 4273
 			break;
4207 4274
 
@@ -4211,8 +4278,9 @@  discard block
 block discarded – undo
4211 4278
 			if ( is_wp_error( $value ) ) {
4212 4279
 				$error = $value->get_error_message();
4213 4280
 			} else {
4214
-				if ( ! is_array( $value ) )
4215
-					$value = explode( "\n", $value );
4281
+				if ( ! is_array( $value ) ) {
4282
+									$value = explode( "\n", $value );
4283
+				}
4216 4284
 
4217 4285
 				$domains = array_values( array_filter( array_map( 'trim', $value ) ) );
4218 4286
 				$value = array();
@@ -4222,8 +4290,9 @@  discard block
 block discarded – undo
4222 4290
 						$value[] = $domain;
4223 4291
 					}
4224 4292
 				}
4225
-				if ( ! $value )
4226
-					$value = '';
4293
+				if ( ! $value ) {
4294
+									$value = '';
4295
+				}
4227 4296
 			}
4228 4297
 			break;
4229 4298
 
@@ -4255,8 +4324,9 @@  discard block
 block discarded – undo
4255 4324
 			break;
4256 4325
 
4257 4326
 		case 'default_role' :
4258
-			if ( ! get_role( $value ) && get_role( 'subscriber' ) )
4259
-				$value = 'subscriber';
4327
+			if ( ! get_role( $value ) && get_role( 'subscriber' ) ) {
4328
+							$value = 'subscriber';
4329
+			}
4260 4330
 			break;
4261 4331
 
4262 4332
 		case 'moderation_keys':
@@ -4334,8 +4404,9 @@  discard block
 block discarded – undo
4334 4404
  */
4335 4405
 function wp_parse_str( $string, &$array ) {
4336 4406
 	parse_str( $string, $array );
4337
-	if ( get_magic_quotes_gpc() )
4338
-		$array = stripslashes_deep( $array );
4407
+	if ( get_magic_quotes_gpc() ) {
4408
+			$array = stripslashes_deep( $array );
4409
+	}
4339 4410
 	/**
4340 4411
 	 * Filters the array of variables derived from a parsed string.
4341 4412
 	 *
@@ -4369,8 +4440,9 @@  discard block
 block discarded – undo
4369 4440
  * @return string The text returned after esc_html if needed.
4370 4441
  */
4371 4442
 function wp_pre_kses_less_than_callback( $matches ) {
4372
-	if ( false === strpos($matches[0], '>') )
4373
-		return esc_html($matches[0]);
4443
+	if ( false === strpos($matches[0], '>') ) {
4444
+			return esc_html($matches[0]);
4445
+	}
4374 4446
 	return $matches[0];
4375 4447
 }
4376 4448
 
@@ -4406,8 +4478,9 @@  discard block
 block discarded – undo
4406 4478
 
4407 4479
 		// Get fragment before next %
4408 4480
 		$end = strpos($pattern, '%', $start + 1);
4409
-		if ( false === $end )
4410
-			$end = $len;
4481
+		if ( false === $end ) {
4482
+					$end = $len;
4483
+		}
4411 4484
 		$fragment = substr($pattern, $start, $end - $start);
4412 4485
 
4413 4486
 		// Fragment has a specifier
@@ -4432,10 +4505,11 @@  discard block
 block discarded – undo
4432 4505
 			 * @param string $arg      The argument.
4433 4506
 			 */
4434 4507
 			$_fragment = apply_filters( 'wp_sprintf', $fragment, $arg );
4435
-			if ( $_fragment != $fragment )
4436
-				$fragment = $_fragment;
4437
-			else
4438
-				$fragment = sprintf($fragment, strval($arg) );
4508
+			if ( $_fragment != $fragment ) {
4509
+							$fragment = $_fragment;
4510
+			} else {
4511
+							$fragment = sprintf($fragment, strval($arg) );
4512
+			}
4439 4513
 		}
4440 4514
 
4441 4515
 		// Append to result and move to next fragment
@@ -4460,12 +4534,14 @@  discard block
 block discarded – undo
4460 4534
  */
4461 4535
 function wp_sprintf_l( $pattern, $args ) {
4462 4536
 	// Not a match
4463
-	if ( substr($pattern, 0, 2) != '%l' )
4464
-		return $pattern;
4537
+	if ( substr($pattern, 0, 2) != '%l' ) {
4538
+			return $pattern;
4539
+	}
4465 4540
 
4466 4541
 	// Nothing to work with
4467
-	if ( empty($args) )
4468
-		return '';
4542
+	if ( empty($args) ) {
4543
+			return '';
4544
+	}
4469 4545
 
4470 4546
 	/**
4471 4547
 	 * Filters the translated delimiters used by wp_sprintf_l().
@@ -4489,17 +4565,19 @@  discard block
 block discarded – undo
4489 4565
 
4490 4566
 	$args = (array) $args;
4491 4567
 	$result = array_shift($args);
4492
-	if ( count($args) == 1 )
4493
-		$result .= $l['between_only_two'] . array_shift($args);
4568
+	if ( count($args) == 1 ) {
4569
+			$result .= $l['between_only_two'] . array_shift($args);
4570
+	}
4494 4571
 	// Loop when more than two args
4495 4572
 	$i = count($args);
4496 4573
 	while ( $i ) {
4497 4574
 		$arg = array_shift($args);
4498 4575
 		$i--;
4499
-		if ( 0 == $i )
4500
-			$result .= $l['between_last_two'] . $arg;
4501
-		else
4502
-			$result .= $l['between'] . $arg;
4576
+		if ( 0 == $i ) {
4577
+					$result .= $l['between_last_two'] . $arg;
4578
+		} else {
4579
+					$result .= $l['between'] . $arg;
4580
+		}
4503 4581
 	}
4504 4582
 	return $result . substr($pattern, 2);
4505 4583
 }
@@ -4519,14 +4597,16 @@  discard block
 block discarded – undo
4519 4597
  * @return string The excerpt.
4520 4598
  */
4521 4599
 function wp_html_excerpt( $str, $count, $more = null ) {
4522
-	if ( null === $more )
4523
-		$more = '';
4600
+	if ( null === $more ) {
4601
+			$more = '';
4602
+	}
4524 4603
 	$str = wp_strip_all_tags( $str, true );
4525 4604
 	$excerpt = mb_substr( $str, 0, $count );
4526 4605
 	// remove part of an entity at the end
4527 4606
 	$excerpt = preg_replace( '/&[^;\s]{0,6}$/', '', $excerpt );
4528
-	if ( $str != $excerpt )
4529
-		$excerpt = trim( $excerpt ) . $more;
4607
+	if ( $str != $excerpt ) {
4608
+			$excerpt = trim( $excerpt ) . $more;
4609
+	}
4530 4610
 	return $excerpt;
4531 4611
 }
4532 4612
 
@@ -4648,8 +4728,9 @@  discard block
 block discarded – undo
4648 4728
 	$string = preg_replace( '@<(script|style)[^>]*?>.*?</\\1>@si', '', $string );
4649 4729
 	$string = strip_tags($string);
4650 4730
 
4651
-	if ( $remove_breaks )
4652
-		$string = preg_replace('/[\r\n\t ]+/', ' ', $string);
4731
+	if ( $remove_breaks ) {
4732
+			$string = preg_replace('/[\r\n\t ]+/', ' ', $string);
4733
+	}
4653 4734
 
4654 4735
 	return trim( $string );
4655 4736
 }
@@ -4784,8 +4865,9 @@  discard block
 block discarded – undo
4784 4865
 function capital_P_dangit( $text ) {
4785 4866
 	// Simple replacement for titles
4786 4867
 	$current_filter = current_filter();
4787
-	if ( 'the_title' === $current_filter || 'wp_title' === $current_filter )
4788
-		return str_replace( 'Wordpress', 'WordPress', $text );
4868
+	if ( 'the_title' === $current_filter || 'wp_title' === $current_filter ) {
4869
+			return str_replace( 'Wordpress', 'WordPress', $text );
4870
+	}
4789 4871
 	// Still here? Use the more judicious replacement
4790 4872
 	static $dblq = false;
4791 4873
 	if ( false === $dblq ) {
@@ -4829,8 +4911,9 @@  discard block
 block discarded – undo
4829 4911
 function sanitize_trackback_urls( $to_ping ) {
4830 4912
 	$urls_to_ping = preg_split( '/[\r\n\t ]/', trim( $to_ping ), -1, PREG_SPLIT_NO_EMPTY );
4831 4913
 	foreach ( $urls_to_ping as $k => $url ) {
4832
-		if ( !preg_match( '#^https?://.#i', $url ) )
4833
-			unset( $urls_to_ping[$k] );
4914
+		if ( !preg_match( '#^https?://.#i', $url ) ) {
4915
+					unset( $urls_to_ping[$k] );
4916
+		}
4834 4917
 	}
4835 4918
 	$urls_to_ping = array_map( 'esc_url_raw', $urls_to_ping );
4836 4919
 	$urls_to_ping = implode( "\n", $urls_to_ping );
Please login to merge, or discard this patch.
src/wp-includes/user.php 4 patches
Indentation   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -67,13 +67,13 @@  discard block
 block discarded – undo
67 67
 	 *
68 68
 	 * @param bool  $secure_cookie Whether to use a secure sign-on cookie.
69 69
 	 * @param array $credentials {
70
- 	 *     Array of entered sign-on data.
71
- 	 *
72
- 	 *     @type string $user_login    Username.
73
- 	 *     @type string $user_password Password entered.
70
+	 *     Array of entered sign-on data.
71
+	 *
72
+	 *     @type string $user_login    Username.
73
+	 *     @type string $user_password Password entered.
74 74
 	 *     @type bool   $remember      Whether to 'remember' the user. Increases the time
75 75
 	 *                                 that the cookie will be kept. Default false.
76
- 	 * }
76
+	 * }
77 77
 	 */
78 78
 	$secure_cookie = apply_filters( 'secure_signon_cookie', $secure_cookie, $credentials );
79 79
 
@@ -1184,7 +1184,7 @@  discard block
 block discarded – undo
1184 1184
 			 *
1185 1185
 			 * The dynamic portion of the hook name, `$field`, refers to the prefixed user
1186 1186
 			 * field being filtered, such as 'user_login', 'user_email', 'first_name', etc.
1187
- 			 *
1187
+			 *
1188 1188
 			 * @since 2.9.0
1189 1189
 			 *
1190 1190
 			 * @param mixed $value Value of the prefixed user field.
@@ -1625,16 +1625,16 @@  discard block
 block discarded – undo
1625 1625
 	$user = new WP_User( $user_id );
1626 1626
 
1627 1627
 	/**
1628
- 	 * Filters a user's meta values and keys before the user is created or updated.
1629
- 	 *
1630
- 	 * Does not include contact methods. These are added using `wp_get_user_contact_methods( $user )`.
1631
- 	 *
1632
- 	 * @since 4.4.0
1633
- 	 *
1634
- 	 * @param array $meta {
1635
- 	 *     Default meta values and keys for the user.
1636
- 	 *
1637
- 	 *     @type string   $nickname             The user's nickname. Default is the user's username.
1628
+	 * Filters a user's meta values and keys before the user is created or updated.
1629
+	 *
1630
+	 * Does not include contact methods. These are added using `wp_get_user_contact_methods( $user )`.
1631
+	 *
1632
+	 * @since 4.4.0
1633
+	 *
1634
+	 * @param array $meta {
1635
+	 *     Default meta values and keys for the user.
1636
+	 *
1637
+	 *     @type string   $nickname             The user's nickname. Default is the user's username.
1638 1638
 	 *     @type string   $first_name           The user's first name.
1639 1639
 	 *     @type string   $last_name            The user's last name.
1640 1640
 	 *     @type string   $description          The user's description.
@@ -1645,10 +1645,10 @@  discard block
 block discarded – undo
1645 1645
 	 *                                          not forced.
1646 1646
 	 *     @type bool     $show_admin_bar_front Whether to show the admin bar on the front end for the user.
1647 1647
 	 *                                          Default true.
1648
- 	 * }
1648
+	 * }
1649 1649
 	 * @param WP_User $user   User object.
1650 1650
 	 * @param bool    $update Whether the user is being updated rather than created.
1651
- 	 */
1651
+	 */
1652 1652
 	$meta = apply_filters( 'insert_user_meta', $meta, $user, $update );
1653 1653
 
1654 1654
 	// Update user meta.
@@ -1983,7 +1983,7 @@  discard block
 block discarded – undo
1983 1983
 	 * @since 2.9.0
1984 1984
 	 *
1985 1985
 	 * @param array   $methods Array of contact methods and their labels.
1986
- 	 * @param WP_User $user    WP_User object.
1986
+	 * @param WP_User $user    WP_User object.
1987 1987
 	 */
1988 1988
 	return apply_filters( 'user_contactmethods', $methods, $user );
1989 1989
 }
Please login to merge, or discard this patch.
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -386,7 +386,7 @@  discard block
 block discarded – undo
386 386
  * @param array        $users       Array of user IDs.
387 387
  * @param string|array $post_type   Optional. Single post type or array of post types to check. Defaults to 'post'.
388 388
  * @param bool         $public_only Optional. Only return counts for public posts.  Defaults to false.
389
- * @return array Amount of posts each user has written.
389
+ * @return WP_User Amount of posts each user has written.
390 390
  */
391 391
 function count_many_users_posts( $users, $post_type = 'post', $public_only = false ) {
392 392
 	global $wpdb;
@@ -758,7 +758,7 @@  discard block
 block discarded – undo
758 758
  *
759 759
  * @param int    $user_id    User ID.
760 760
  * @param string $meta_key   Metadata name.
761
- * @param mixed  $meta_value Metadata value.
761
+ * @param string  $meta_value Metadata value.
762 762
  * @param bool   $unique     Optional, default is false. Whether the same key should not be added.
763 763
  * @return int|false Meta ID on success, false on failure.
764 764
  */
@@ -1254,7 +1254,7 @@  discard block
 block discarded – undo
1254 1254
  * @since 3.0.0
1255 1255
  *
1256 1256
  * @param object|WP_User $user User object to be cached
1257
- * @return bool|null Returns false on failure.
1257
+ * @return false|null Returns false on failure.
1258 1258
  */
1259 1259
 function update_user_caches( $user ) {
1260 1260
 	if ( $user instanceof WP_User ) {
Please login to merge, or discard this patch.
Spacing   +496 added lines, -496 removed lines patch added patch discarded remove patch
@@ -25,19 +25,19 @@  discard block
 block discarded – undo
25 25
  * @param string|bool $secure_cookie Optional. Whether to use secure cookie.
26 26
  * @return WP_User|WP_Error WP_User on success, WP_Error on failure.
27 27
  */
28
-function wp_signon( $credentials = array(), $secure_cookie = '' ) {
29
-	if ( empty($credentials) ) {
28
+function wp_signon($credentials = array(), $secure_cookie = '') {
29
+	if (empty($credentials)) {
30 30
 		$credentials = array(); // Back-compat for plugins passing an empty string.
31 31
 
32
-		if ( ! empty($_POST['log']) )
32
+		if ( ! empty($_POST['log']))
33 33
 			$credentials['user_login'] = $_POST['log'];
34
-		if ( ! empty($_POST['pwd']) )
34
+		if ( ! empty($_POST['pwd']))
35 35
 			$credentials['user_password'] = $_POST['pwd'];
36
-		if ( ! empty($_POST['rememberme']) )
36
+		if ( ! empty($_POST['rememberme']))
37 37
 			$credentials['remember'] = $_POST['rememberme'];
38 38
 	}
39 39
 
40
-	if ( !empty($credentials['remember']) )
40
+	if ( ! empty($credentials['remember']))
41 41
 		$credentials['remember'] = true;
42 42
 	else
43 43
 		$credentials['remember'] = false;
@@ -55,9 +55,9 @@  discard block
 block discarded – undo
55 55
 	 * @param string $user_login    Username, passed by reference.
56 56
 	 * @param string $user_password User password, passed by reference.
57 57
 	 */
58
-	do_action_ref_array( 'wp_authenticate', array( &$credentials['user_login'], &$credentials['user_password'] ) );
58
+	do_action_ref_array('wp_authenticate', array(&$credentials['user_login'], &$credentials['user_password']));
59 59
 
60
-	if ( '' === $secure_cookie )
60
+	if ('' === $secure_cookie)
61 61
 		$secure_cookie = is_ssl();
62 62
 
63 63
 	/**
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
 	 *                                 that the cookie will be kept. Default false.
76 76
  	 * }
77 77
 	 */
78
-	$secure_cookie = apply_filters( 'secure_signon_cookie', $secure_cookie, $credentials );
78
+	$secure_cookie = apply_filters('secure_signon_cookie', $secure_cookie, $credentials);
79 79
 
80 80
 	global $auth_secure_cookie; // XXX ugly hack to pass this to wp_authenticate_cookie
81 81
 	$auth_secure_cookie = $secure_cookie;
@@ -84,8 +84,8 @@  discard block
 block discarded – undo
84 84
 
85 85
 	$user = wp_authenticate($credentials['user_login'], $credentials['user_password']);
86 86
 
87
-	if ( is_wp_error($user) ) {
88
-		if ( $user->get_error_codes() == array('empty_username', 'empty_password') ) {
87
+	if (is_wp_error($user)) {
88
+		if ($user->get_error_codes() == array('empty_username', 'empty_password')) {
89 89
 			$user = new WP_Error('', '');
90 90
 		}
91 91
 
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
 	 * @param string  $user_login Username.
102 102
 	 * @param WP_User $user       WP_User object of the logged-in user.
103 103
 	 */
104
-	do_action( 'wp_login', $user->user_login, $user );
104
+	do_action('wp_login', $user->user_login, $user);
105 105
 	return $user;
106 106
 }
107 107
 
@@ -116,20 +116,20 @@  discard block
 block discarded – undo
116 116
  * @return WP_User|WP_Error WP_User on success, WP_Error on failure.
117 117
  */
118 118
 function wp_authenticate_username_password($user, $username, $password) {
119
-	if ( $user instanceof WP_User ) {
119
+	if ($user instanceof WP_User) {
120 120
 		return $user;
121 121
 	}
122 122
 
123
-	if ( empty($username) || empty($password) ) {
124
-		if ( is_wp_error( $user ) )
123
+	if (empty($username) || empty($password)) {
124
+		if (is_wp_error($user))
125 125
 			return $user;
126 126
 
127 127
 		$error = new WP_Error();
128 128
 
129
-		if ( empty($username) )
129
+		if (empty($username))
130 130
 			$error->add('empty_username', __('<strong>ERROR</strong>: The username field is empty.'));
131 131
 
132
-		if ( empty($password) )
132
+		if (empty($password))
133 133
 			$error->add('empty_password', __('<strong>ERROR</strong>: The password field is empty.'));
134 134
 
135 135
 		return $error;
@@ -137,11 +137,11 @@  discard block
 block discarded – undo
137 137
 
138 138
 	$user = get_user_by('login', $username);
139 139
 
140
-	if ( !$user ) {
141
-		return new WP_Error( 'invalid_username',
142
-			__( '<strong>ERROR</strong>: Invalid username.' ) .
143
-			' <a href="' . wp_lostpassword_url() . '">' .
144
-			__( 'Lost your password?' ) .
140
+	if ( ! $user) {
141
+		return new WP_Error('invalid_username',
142
+			__('<strong>ERROR</strong>: Invalid username.').
143
+			' <a href="'.wp_lostpassword_url().'">'.
144
+			__('Lost your password?').
145 145
 			'</a>'
146 146
 		);
147 147
 	}
@@ -155,19 +155,19 @@  discard block
 block discarded – undo
155 155
 	 *                                   callback failed authentication.
156 156
 	 * @param string           $password Password to check against the user.
157 157
 	 */
158
-	$user = apply_filters( 'wp_authenticate_user', $user, $password );
159
-	if ( is_wp_error($user) )
158
+	$user = apply_filters('wp_authenticate_user', $user, $password);
159
+	if (is_wp_error($user))
160 160
 		return $user;
161 161
 
162
-	if ( ! wp_check_password( $password, $user->user_pass, $user->ID ) ) {
163
-		return new WP_Error( 'incorrect_password',
162
+	if ( ! wp_check_password($password, $user->user_pass, $user->ID)) {
163
+		return new WP_Error('incorrect_password',
164 164
 			sprintf(
165 165
 				/* translators: %s: user name */
166
-				__( '<strong>ERROR</strong>: The password you entered for the username %s is incorrect.' ),
167
-				'<strong>' . $username . '</strong>'
168
-			) .
169
-			' <a href="' . wp_lostpassword_url() . '">' .
170
-			__( 'Lost your password?' ) .
166
+				__('<strong>ERROR</strong>: The password you entered for the username %s is incorrect.'),
167
+				'<strong>'.$username.'</strong>'
168
+			).
169
+			' <a href="'.wp_lostpassword_url().'">'.
170
+			__('Lost your password?').
171 171
 			'</a>'
172 172
 		);
173 173
 	}
@@ -186,60 +186,60 @@  discard block
 block discarded – undo
186 186
  * @param string                $password Password for authentication.
187 187
  * @return WP_User|WP_Error WP_User on success, WP_Error on failure.
188 188
  */
189
-function wp_authenticate_email_password( $user, $email, $password ) {
190
-	if ( $user instanceof WP_User ) {
189
+function wp_authenticate_email_password($user, $email, $password) {
190
+	if ($user instanceof WP_User) {
191 191
 		return $user;
192 192
 	}
193 193
 
194
-	if ( empty( $email ) || empty( $password ) ) {
195
-		if ( is_wp_error( $user ) ) {
194
+	if (empty($email) || empty($password)) {
195
+		if (is_wp_error($user)) {
196 196
 			return $user;
197 197
 		}
198 198
 
199 199
 		$error = new WP_Error();
200 200
 
201
-		if ( empty( $email ) ) {
202
-			$error->add( 'empty_username', __( '<strong>ERROR</strong>: The email field is empty.' ) ); // Uses 'empty_username' for back-compat with wp_signon()
201
+		if (empty($email)) {
202
+			$error->add('empty_username', __('<strong>ERROR</strong>: The email field is empty.')); // Uses 'empty_username' for back-compat with wp_signon()
203 203
 		}
204 204
 
205
-		if ( empty( $password ) ) {
206
-			$error->add( 'empty_password', __( '<strong>ERROR</strong>: The password field is empty.' ) );
205
+		if (empty($password)) {
206
+			$error->add('empty_password', __('<strong>ERROR</strong>: The password field is empty.'));
207 207
 		}
208 208
 
209 209
 		return $error;
210 210
 	}
211 211
 
212
-	if ( ! is_email( $email ) ) {
212
+	if ( ! is_email($email)) {
213 213
 		return $user;
214 214
 	}
215 215
 
216
-	$user = get_user_by( 'email', $email );
216
+	$user = get_user_by('email', $email);
217 217
 
218
-	if ( ! $user ) {
219
-		return new WP_Error( 'invalid_email',
220
-			__( '<strong>ERROR</strong>: Invalid email address.' ) .
221
-			' <a href="' . wp_lostpassword_url() . '">' .
222
-			__( 'Lost your password?' ) .
218
+	if ( ! $user) {
219
+		return new WP_Error('invalid_email',
220
+			__('<strong>ERROR</strong>: Invalid email address.').
221
+			' <a href="'.wp_lostpassword_url().'">'.
222
+			__('Lost your password?').
223 223
 			'</a>'
224 224
 		);
225 225
 	}
226 226
 
227 227
 	/** This filter is documented in wp-includes/user.php */
228
-	$user = apply_filters( 'wp_authenticate_user', $user, $password );
228
+	$user = apply_filters('wp_authenticate_user', $user, $password);
229 229
 
230
-	if ( is_wp_error( $user ) ) {
230
+	if (is_wp_error($user)) {
231 231
 		return $user;
232 232
 	}
233 233
 
234
-	if ( ! wp_check_password( $password, $user->user_pass, $user->ID ) ) {
235
-		return new WP_Error( 'incorrect_password',
234
+	if ( ! wp_check_password($password, $user->user_pass, $user->ID)) {
235
+		return new WP_Error('incorrect_password',
236 236
 			sprintf(
237 237
 				/* translators: %s: email address */
238
-				__( '<strong>ERROR</strong>: The password you entered for the email address %s is incorrect.' ),
239
-				'<strong>' . $email . '</strong>'
240
-			) .
241
-			' <a href="' . wp_lostpassword_url() . '">' .
242
-			__( 'Lost your password?' ) .
238
+				__('<strong>ERROR</strong>: The password you entered for the email address %s is incorrect.'),
239
+				'<strong>'.$email.'</strong>'
240
+			).
241
+			' <a href="'.wp_lostpassword_url().'">'.
242
+			__('Lost your password?').
243 243
 			'</a>'
244 244
 		);
245 245
 	}
@@ -260,23 +260,23 @@  discard block
 block discarded – undo
260 260
  * @return WP_User|WP_Error WP_User on success, WP_Error on failure.
261 261
  */
262 262
 function wp_authenticate_cookie($user, $username, $password) {
263
-	if ( $user instanceof WP_User ) {
263
+	if ($user instanceof WP_User) {
264 264
 		return $user;
265 265
 	}
266 266
 
267
-	if ( empty($username) && empty($password) ) {
267
+	if (empty($username) && empty($password)) {
268 268
 		$user_id = wp_validate_auth_cookie();
269
-		if ( $user_id )
269
+		if ($user_id)
270 270
 			return new WP_User($user_id);
271 271
 
272 272
 		global $auth_secure_cookie;
273 273
 
274
-		if ( $auth_secure_cookie )
274
+		if ($auth_secure_cookie)
275 275
 			$auth_cookie = SECURE_AUTH_COOKIE;
276 276
 		else
277 277
 			$auth_cookie = AUTH_COOKIE;
278 278
 
279
-		if ( !empty($_COOKIE[$auth_cookie]) )
279
+		if ( ! empty($_COOKIE[$auth_cookie]))
280 280
 			return new WP_Error('expired_session', __('Please log in again.'));
281 281
 
282 282
 		// If the cookie is not set, be silent.
@@ -294,8 +294,8 @@  discard block
 block discarded – undo
294 294
  * @param WP_User|WP_Error|null $user WP_User or WP_Error object from a previous callback. Default null.
295 295
  * @return WP_User|WP_Error WP_User on success, WP_Error if the user is considered a spammer.
296 296
  */
297
-function wp_authenticate_spam_check( $user ) {
298
-	if ( $user instanceof WP_User && is_multisite() ) {
297
+function wp_authenticate_spam_check($user) {
298
+	if ($user instanceof WP_User && is_multisite()) {
299 299
 		/**
300 300
 		 * Filters whether the user has been marked as a spammer.
301 301
 		 *
@@ -304,10 +304,10 @@  discard block
 block discarded – undo
304 304
 		 * @param bool    $spammed Whether the user is considered a spammer.
305 305
 		 * @param WP_User $user    User to check against.
306 306
 		 */
307
-		$spammed = apply_filters( 'check_is_user_spammed', is_user_spammy( $user ), $user );
307
+		$spammed = apply_filters('check_is_user_spammed', is_user_spammy($user), $user);
308 308
 
309
-		if ( $spammed )
310
-			return new WP_Error( 'spammer_account', __( '<strong>ERROR</strong>: Your account has been marked as a spammer.' ) );
309
+		if ($spammed)
310
+			return new WP_Error('spammer_account', __('<strong>ERROR</strong>: Your account has been marked as a spammer.'));
311 311
 	}
312 312
 	return $user;
313 313
 }
@@ -327,16 +327,16 @@  discard block
 block discarded – undo
327 327
  * @return int|false User ID if validated, false otherwise. If a user ID from
328 328
  *                   an earlier filter callback is received, that value is returned.
329 329
  */
330
-function wp_validate_logged_in_cookie( $user_id ) {
331
-	if ( $user_id ) {
330
+function wp_validate_logged_in_cookie($user_id) {
331
+	if ($user_id) {
332 332
 		return $user_id;
333 333
 	}
334 334
 
335
-	if ( is_blog_admin() || is_network_admin() || empty( $_COOKIE[LOGGED_IN_COOKIE] ) ) {
335
+	if (is_blog_admin() || is_network_admin() || empty($_COOKIE[LOGGED_IN_COOKIE])) {
336 336
 		return false;
337 337
 	}
338 338
 
339
-	return wp_validate_auth_cookie( $_COOKIE[LOGGED_IN_COOKIE], 'logged_in' );
339
+	return wp_validate_auth_cookie($_COOKIE[LOGGED_IN_COOKIE], 'logged_in');
340 340
 }
341 341
 
342 342
 /**
@@ -354,12 +354,12 @@  discard block
 block discarded – undo
354 354
  * @param bool         $public_only Optional. Whether to only return counts for public posts. Default false.
355 355
  * @return string Number of posts the user has written in this post type.
356 356
  */
357
-function count_user_posts( $userid, $post_type = 'post', $public_only = false ) {
357
+function count_user_posts($userid, $post_type = 'post', $public_only = false) {
358 358
 	global $wpdb;
359 359
 
360
-	$where = get_posts_by_author_sql( $post_type, true, $userid, $public_only );
360
+	$where = get_posts_by_author_sql($post_type, true, $userid, $public_only);
361 361
 
362
-	$count = $wpdb->get_var( "SELECT COUNT(*) FROM $wpdb->posts $where" );
362
+	$count = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->posts $where");
363 363
 
364 364
 	/**
365 365
 	 * Filters the number of posts a user has written.
@@ -373,7 +373,7 @@  discard block
 block discarded – undo
373 373
 	 * @param string|array $post_type   Single post type or array of post types to count the number of posts for.
374 374
 	 * @param bool         $public_only Whether to limit counted posts to public posts.
375 375
 	 */
376
-	return apply_filters( 'get_usernumposts', $count, $userid, $post_type, $public_only );
376
+	return apply_filters('get_usernumposts', $count, $userid, $post_type, $public_only);
377 377
 }
378 378
 
379 379
 /**
@@ -388,24 +388,24 @@  discard block
 block discarded – undo
388 388
  * @param bool         $public_only Optional. Only return counts for public posts.  Defaults to false.
389 389
  * @return array Amount of posts each user has written.
390 390
  */
391
-function count_many_users_posts( $users, $post_type = 'post', $public_only = false ) {
391
+function count_many_users_posts($users, $post_type = 'post', $public_only = false) {
392 392
 	global $wpdb;
393 393
 
394 394
 	$count = array();
395
-	if ( empty( $users ) || ! is_array( $users ) )
395
+	if (empty($users) || ! is_array($users))
396 396
 		return $count;
397 397
 
398
-	$userlist = implode( ',', array_map( 'absint', $users ) );
399
-	$where = get_posts_by_author_sql( $post_type, true, null, $public_only );
398
+	$userlist = implode(',', array_map('absint', $users));
399
+	$where = get_posts_by_author_sql($post_type, true, null, $public_only);
400 400
 
401
-	$result = $wpdb->get_results( "SELECT post_author, COUNT(*) FROM $wpdb->posts $where AND post_author IN ($userlist) GROUP BY post_author", ARRAY_N );
402
-	foreach ( $result as $row ) {
403
-		$count[ $row[0] ] = $row[1];
401
+	$result = $wpdb->get_results("SELECT post_author, COUNT(*) FROM $wpdb->posts $where AND post_author IN ($userlist) GROUP BY post_author", ARRAY_N);
402
+	foreach ($result as $row) {
403
+		$count[$row[0]] = $row[1];
404 404
 	}
405 405
 
406
-	foreach ( $users as $id ) {
407
-		if ( ! isset( $count[ $id ] ) )
408
-			$count[ $id ] = 0;
406
+	foreach ($users as $id) {
407
+		if ( ! isset($count[$id]))
408
+			$count[$id] = 0;
409 409
 	}
410 410
 
411 411
 	return $count;
@@ -423,10 +423,10 @@  discard block
 block discarded – undo
423 423
  * @return int The current user's ID, or 0 if no user is logged in.
424 424
  */
425 425
 function get_current_user_id() {
426
-	if ( ! function_exists( 'wp_get_current_user' ) )
426
+	if ( ! function_exists('wp_get_current_user'))
427 427
 		return 0;
428 428
 	$user = wp_get_current_user();
429
-	return ( isset( $user->ID ) ? (int) $user->ID : 0 );
429
+	return (isset($user->ID) ? (int) $user->ID : 0);
430 430
 }
431 431
 
432 432
 /**
@@ -448,23 +448,23 @@  discard block
 block discarded – undo
448 448
  * @param string $deprecated Use get_option() to check for an option in the options table.
449 449
  * @return mixed User option value on success, false on failure.
450 450
  */
451
-function get_user_option( $option, $user = 0, $deprecated = '' ) {
451
+function get_user_option($option, $user = 0, $deprecated = '') {
452 452
 	global $wpdb;
453 453
 
454
-	if ( !empty( $deprecated ) )
455
-		_deprecated_argument( __FUNCTION__, '3.0.0' );
454
+	if ( ! empty($deprecated))
455
+		_deprecated_argument(__FUNCTION__, '3.0.0');
456 456
 
457
-	if ( empty( $user ) )
457
+	if (empty($user))
458 458
 		$user = get_current_user_id();
459 459
 
460
-	if ( ! $user = get_userdata( $user ) )
460
+	if ( ! $user = get_userdata($user))
461 461
 		return false;
462 462
 
463 463
 	$prefix = $wpdb->get_blog_prefix();
464
-	if ( $user->has_prop( $prefix . $option ) ) // Blog specific
465
-		$result = $user->get( $prefix . $option );
466
-	elseif ( $user->has_prop( $option ) ) // User specific and cross-blog
467
-		$result = $user->get( $option );
464
+	if ($user->has_prop($prefix.$option)) // Blog specific
465
+		$result = $user->get($prefix.$option);
466
+	elseif ($user->has_prop($option)) // User specific and cross-blog
467
+		$result = $user->get($option);
468 468
 	else
469 469
 		$result = false;
470 470
 
@@ -479,7 +479,7 @@  discard block
 block discarded – undo
479 479
 	 * @param string  $option Name of the option being retrieved.
480 480
 	 * @param WP_User $user   WP_User object of the user whose option is being retrieved.
481 481
 	 */
482
-	return apply_filters( "get_user_option_{$option}", $result, $option, $user );
482
+	return apply_filters("get_user_option_{$option}", $result, $option, $user);
483 483
 }
484 484
 
485 485
 /**
@@ -503,13 +503,13 @@  discard block
 block discarded – undo
503 503
  * @return int|bool User meta ID if the option didn't exist, true on successful update,
504 504
  *                  false on failure.
505 505
  */
506
-function update_user_option( $user_id, $option_name, $newvalue, $global = false ) {
506
+function update_user_option($user_id, $option_name, $newvalue, $global = false) {
507 507
 	global $wpdb;
508 508
 
509
-	if ( !$global )
510
-		$option_name = $wpdb->get_blog_prefix() . $option_name;
509
+	if ( ! $global)
510
+		$option_name = $wpdb->get_blog_prefix().$option_name;
511 511
 
512
-	return update_user_meta( $user_id, $option_name, $newvalue );
512
+	return update_user_meta($user_id, $option_name, $newvalue);
513 513
 }
514 514
 
515 515
 /**
@@ -529,12 +529,12 @@  discard block
 block discarded – undo
529 529
  *                            Default false (blog specific).
530 530
  * @return bool True on success, false on failure.
531 531
  */
532
-function delete_user_option( $user_id, $option_name, $global = false ) {
532
+function delete_user_option($user_id, $option_name, $global = false) {
533 533
 	global $wpdb;
534 534
 
535
-	if ( !$global )
536
-		$option_name = $wpdb->get_blog_prefix() . $option_name;
537
-	return delete_user_meta( $user_id, $option_name );
535
+	if ( ! $global)
536
+		$option_name = $wpdb->get_blog_prefix().$option_name;
537
+	return delete_user_meta($user_id, $option_name);
538 538
 }
539 539
 
540 540
 /**
@@ -548,9 +548,9 @@  discard block
 block discarded – undo
548 548
  *                    for more information on accepted arguments.
549 549
  * @return array List of users.
550 550
  */
551
-function get_users( $args = array() ) {
551
+function get_users($args = array()) {
552 552
 
553
-	$args = wp_parse_args( $args );
553
+	$args = wp_parse_args($args);
554 554
 	$args['count_total'] = false;
555 555
 
556 556
 	$user_search = new WP_User_Query($args);
@@ -572,13 +572,13 @@  discard block
 block discarded – undo
572 572
  * @return array A list of the user's sites. An empty array if the user doesn't exist
573 573
  *               or belongs to no sites.
574 574
  */
575
-function get_blogs_of_user( $user_id, $all = false ) {
575
+function get_blogs_of_user($user_id, $all = false) {
576 576
 	global $wpdb;
577 577
 
578 578
 	$user_id = (int) $user_id;
579 579
 
580 580
 	// Logged out users can't have sites
581
-	if ( empty( $user_id ) )
581
+	if (empty($user_id))
582 582
 		return array();
583 583
 
584 584
 	/**
@@ -594,47 +594,47 @@  discard block
 block discarded – undo
594 594
 	 * @param bool       $all     Whether the returned array should contain all sites, including
595 595
 	 *                            those marked 'deleted', 'archived', or 'spam'. Default false.
596 596
 	 */
597
-	$sites = apply_filters( 'pre_get_blogs_of_user', null, $user_id, $all );
597
+	$sites = apply_filters('pre_get_blogs_of_user', null, $user_id, $all);
598 598
 
599
-	if ( null !== $sites ) {
599
+	if (null !== $sites) {
600 600
 		return $sites;
601 601
 	}
602 602
 
603
-	$keys = get_user_meta( $user_id );
604
-	if ( empty( $keys ) )
603
+	$keys = get_user_meta($user_id);
604
+	if (empty($keys))
605 605
 		return array();
606 606
 
607
-	if ( ! is_multisite() ) {
607
+	if ( ! is_multisite()) {
608 608
 		$site_id = get_current_blog_id();
609
-		$sites = array( $site_id => new stdClass );
610
-		$sites[ $site_id ]->userblog_id = $site_id;
611
-		$sites[ $site_id ]->blogname = get_option('blogname');
612
-		$sites[ $site_id ]->domain = '';
613
-		$sites[ $site_id ]->path = '';
614
-		$sites[ $site_id ]->site_id = 1;
615
-		$sites[ $site_id ]->siteurl = get_option('siteurl');
616
-		$sites[ $site_id ]->archived = 0;
617
-		$sites[ $site_id ]->spam = 0;
618
-		$sites[ $site_id ]->deleted = 0;
609
+		$sites = array($site_id => new stdClass);
610
+		$sites[$site_id]->userblog_id = $site_id;
611
+		$sites[$site_id]->blogname = get_option('blogname');
612
+		$sites[$site_id]->domain = '';
613
+		$sites[$site_id]->path = '';
614
+		$sites[$site_id]->site_id = 1;
615
+		$sites[$site_id]->siteurl = get_option('siteurl');
616
+		$sites[$site_id]->archived = 0;
617
+		$sites[$site_id]->spam = 0;
618
+		$sites[$site_id]->deleted = 0;
619 619
 		return $sites;
620 620
 	}
621 621
 
622 622
 	$site_ids = array();
623 623
 
624
-	if ( isset( $keys[ $wpdb->base_prefix . 'capabilities' ] ) && defined( 'MULTISITE' ) ) {
624
+	if (isset($keys[$wpdb->base_prefix.'capabilities']) && defined('MULTISITE')) {
625 625
 		$site_ids[] = 1;
626
-		unset( $keys[ $wpdb->base_prefix . 'capabilities' ] );
626
+		unset($keys[$wpdb->base_prefix.'capabilities']);
627 627
 	}
628 628
 
629
-	$keys = array_keys( $keys );
629
+	$keys = array_keys($keys);
630 630
 
631
-	foreach ( $keys as $key ) {
632
-		if ( 'capabilities' !== substr( $key, -12 ) )
631
+	foreach ($keys as $key) {
632
+		if ('capabilities' !== substr($key, -12))
633 633
 			continue;
634
-		if ( $wpdb->base_prefix && 0 !== strpos( $key, $wpdb->base_prefix ) )
634
+		if ($wpdb->base_prefix && 0 !== strpos($key, $wpdb->base_prefix))
635 635
 			continue;
636
-		$site_id = str_replace( array( $wpdb->base_prefix, '_capabilities' ), '', $key );
637
-		if ( ! is_numeric( $site_id ) )
636
+		$site_id = str_replace(array($wpdb->base_prefix, '_capabilities'), '', $key);
637
+		if ( ! is_numeric($site_id))
638 638
 			continue;
639 639
 
640 640
 		$site_ids[] = (int) $site_id;
@@ -642,21 +642,21 @@  discard block
 block discarded – undo
642 642
 
643 643
 	$sites = array();
644 644
 
645
-	if ( ! empty( $site_ids ) ) {
645
+	if ( ! empty($site_ids)) {
646 646
 		$args = array(
647 647
 			'number'   => '',
648 648
 			'site__in' => $site_ids,
649 649
 		);
650
-		if ( ! $all ) {
650
+		if ( ! $all) {
651 651
 			$args['archived'] = 0;
652 652
 			$args['spam']     = 0;
653 653
 			$args['deleted']  = 0;
654 654
 		}
655 655
 
656
-		$_sites = get_sites( $args );
656
+		$_sites = get_sites($args);
657 657
 
658
-		foreach ( $_sites as $site ) {
659
-			$sites[ $site->id ] = (object) array(
658
+		foreach ($_sites as $site) {
659
+			$sites[$site->id] = (object) array(
660 660
 				'userblog_id' => $site->id,
661 661
 				'blogname'    => $site->blogname,
662 662
 				'domain'      => $site->domain,
@@ -681,7 +681,7 @@  discard block
 block discarded – undo
681 681
 	 * @param bool  $all     Whether the returned sites array should contain all sites, including
682 682
 	 *                       those marked 'deleted', 'archived', or 'spam'. Default false.
683 683
 	 */
684
-	return apply_filters( 'get_blogs_of_user', $sites, $user_id, $all );
684
+	return apply_filters('get_blogs_of_user', $sites, $user_id, $all);
685 685
 }
686 686
 
687 687
 /**
@@ -693,55 +693,55 @@  discard block
 block discarded – undo
693 693
  * @param int $blog_id Optional. ID of the blog to check. Defaults to the current site.
694 694
  * @return bool
695 695
  */
696
-function is_user_member_of_blog( $user_id = 0, $blog_id = 0 ) {
696
+function is_user_member_of_blog($user_id = 0, $blog_id = 0) {
697 697
 	global $wpdb;
698 698
 
699 699
 	$user_id = (int) $user_id;
700 700
 	$blog_id = (int) $blog_id;
701 701
 
702
-	if ( empty( $user_id ) ) {
702
+	if (empty($user_id)) {
703 703
 		$user_id = get_current_user_id();
704 704
 	}
705 705
 
706 706
 	// Technically not needed, but does save calls to get_site and get_user_meta
707 707
 	// in the event that the function is called when a user isn't logged in
708
-	if ( empty( $user_id ) ) {
708
+	if (empty($user_id)) {
709 709
 		return false;
710 710
 	} else {
711
-		$user = get_userdata( $user_id );
712
-		if ( ! $user instanceof WP_User ) {
711
+		$user = get_userdata($user_id);
712
+		if ( ! $user instanceof WP_User) {
713 713
 			return false;
714 714
 		}
715 715
 	}
716 716
 
717
-	if ( ! is_multisite() ) {
717
+	if ( ! is_multisite()) {
718 718
 		return true;
719 719
 	}
720 720
 
721
-	if ( empty( $blog_id ) ) {
721
+	if (empty($blog_id)) {
722 722
 		$blog_id = get_current_blog_id();
723 723
 	}
724 724
 
725
-	$blog = get_site( $blog_id );
725
+	$blog = get_site($blog_id);
726 726
 
727
-	if ( ! $blog || ! isset( $blog->domain ) || $blog->archived || $blog->spam || $blog->deleted ) {
727
+	if ( ! $blog || ! isset($blog->domain) || $blog->archived || $blog->spam || $blog->deleted) {
728 728
 		return false;
729 729
 	}
730 730
 
731
-	$keys = get_user_meta( $user_id );
732
-	if ( empty( $keys ) ) {
731
+	$keys = get_user_meta($user_id);
732
+	if (empty($keys)) {
733 733
 		return false;
734 734
 	}
735 735
 
736 736
 	// no underscore before capabilities in $base_capabilities_key
737
-	$base_capabilities_key = $wpdb->base_prefix . 'capabilities';
738
-	$site_capabilities_key = $wpdb->base_prefix . $blog_id . '_capabilities';
737
+	$base_capabilities_key = $wpdb->base_prefix.'capabilities';
738
+	$site_capabilities_key = $wpdb->base_prefix.$blog_id.'_capabilities';
739 739
 
740
-	if ( isset( $keys[ $base_capabilities_key ] ) && $blog_id == 1 ) {
740
+	if (isset($keys[$base_capabilities_key]) && $blog_id == 1) {
741 741
 		return true;
742 742
 	}
743 743
 
744
-	if ( isset( $keys[ $site_capabilities_key ] ) ) {
744
+	if (isset($keys[$site_capabilities_key])) {
745 745
 		return true;
746 746
 	}
747 747
 
@@ -845,29 +845,29 @@  discard block
 block discarded – undo
845 845
 	$blog_prefix = $wpdb->get_blog_prefix($id);
846 846
 	$result = array();
847 847
 
848
-	if ( 'time' == $strategy ) {
848
+	if ('time' == $strategy) {
849 849
 		$avail_roles = wp_roles()->get_names();
850 850
 
851 851
 		// Build a CPU-intensive query that will return concise information.
852 852
 		$select_count = array();
853
-		foreach ( $avail_roles as $this_role => $name ) {
854
-			$select_count[] = $wpdb->prepare( "COUNT(NULLIF(`meta_value` LIKE %s, false))", '%' . $wpdb->esc_like( '"' . $this_role . '"' ) . '%');
853
+		foreach ($avail_roles as $this_role => $name) {
854
+			$select_count[] = $wpdb->prepare("COUNT(NULLIF(`meta_value` LIKE %s, false))", '%'.$wpdb->esc_like('"'.$this_role.'"').'%');
855 855
 		}
856 856
 		$select_count[] = "COUNT(NULLIF(`meta_value` = 'a:0:{}', false))";
857 857
 		$select_count = implode(', ', $select_count);
858 858
 
859 859
 		// Add the meta_value index to the selection list, then run the query.
860
-		$row = $wpdb->get_row( "
860
+		$row = $wpdb->get_row("
861 861
 			SELECT {$select_count}, COUNT(*)
862 862
 			FROM {$wpdb->usermeta}
863 863
 			INNER JOIN {$wpdb->users} ON user_id = ID
864 864
 			WHERE meta_key = '{$blog_prefix}capabilities'
865
-		", ARRAY_N );
865
+		", ARRAY_N);
866 866
 
867 867
 		// Run the previous loop again to associate results with role names.
868 868
 		$col = 0;
869 869
 		$role_counts = array();
870
-		foreach ( $avail_roles as $this_role => $name ) {
870
+		foreach ($avail_roles as $this_role => $name) {
871 871
 			$count = (int) $row[$col++];
872 872
 			if ($count > 0) {
873 873
 				$role_counts[$this_role] = $count;
@@ -880,28 +880,28 @@  discard block
 block discarded – undo
880 880
 		$total_users = (int) $row[$col];
881 881
 
882 882
 		$result['total_users'] = $total_users;
883
-		$result['avail_roles'] =& $role_counts;
883
+		$result['avail_roles'] = & $role_counts;
884 884
 	} else {
885 885
 		$avail_roles = array(
886 886
 			'none' => 0,
887 887
 		);
888 888
 
889
-		$users_of_blog = $wpdb->get_col( "
889
+		$users_of_blog = $wpdb->get_col("
890 890
 			SELECT meta_value
891 891
 			FROM {$wpdb->usermeta}
892 892
 			INNER JOIN {$wpdb->users} ON user_id = ID
893 893
 			WHERE meta_key = '{$blog_prefix}capabilities'
894
-		" );
894
+		");
895 895
 
896
-		foreach ( $users_of_blog as $caps_meta ) {
896
+		foreach ($users_of_blog as $caps_meta) {
897 897
 			$b_roles = maybe_unserialize($caps_meta);
898
-			if ( ! is_array( $b_roles ) )
898
+			if ( ! is_array($b_roles))
899 899
 				continue;
900
-			if ( empty( $b_roles ) ) {
900
+			if (empty($b_roles)) {
901 901
 				$avail_roles['none']++;
902 902
 			}
903
-			foreach ( $b_roles as $b_role => $val ) {
904
-				if ( isset($avail_roles[$b_role]) ) {
903
+			foreach ($b_roles as $b_role => $val) {
904
+				if (isset($avail_roles[$b_role])) {
905 905
 					$avail_roles[$b_role]++;
906 906
 				} else {
907 907
 					$avail_roles[$b_role] = 1;
@@ -909,11 +909,11 @@  discard block
 block discarded – undo
909 909
 			}
910 910
 		}
911 911
 
912
-		$result['total_users'] = count( $users_of_blog );
913
-		$result['avail_roles'] =& $avail_roles;
912
+		$result['total_users'] = count($users_of_blog);
913
+		$result['avail_roles'] = & $avail_roles;
914 914
 	}
915 915
 
916
-	if ( is_multisite() ) {
916
+	if (is_multisite()) {
917 917
 		$result['avail_roles']['none'] = 0;
918 918
 	}
919 919
 
@@ -944,11 +944,11 @@  discard block
 block discarded – undo
944 944
 function setup_userdata($for_user_id = '') {
945 945
 	global $user_login, $userdata, $user_level, $user_ID, $user_email, $user_url, $user_identity;
946 946
 
947
-	if ( '' == $for_user_id )
947
+	if ('' == $for_user_id)
948 948
 		$for_user_id = get_current_user_id();
949
-	$user = get_userdata( $for_user_id );
949
+	$user = get_userdata($for_user_id);
950 950
 
951
-	if ( ! $user ) {
951
+	if ( ! $user) {
952 952
 		$user_ID = 0;
953 953
 		$user_level = 0;
954 954
 		$userdata = null;
@@ -1028,7 +1028,7 @@  discard block
 block discarded – undo
1028 1028
  * }
1029 1029
  * @return string String of HTML content.
1030 1030
  */
1031
-function wp_dropdown_users( $args = '' ) {
1031
+function wp_dropdown_users($args = '') {
1032 1032
 	$defaults = array(
1033 1033
 		'show_option_all' => '', 'show_option_none' => '', 'hide_if_only_one_author' => '',
1034 1034
 		'orderby' => 'display_name', 'order' => 'ASC',
@@ -1042,16 +1042,16 @@  discard block
 block discarded – undo
1042 1042
 		'role__not_in' => array(),
1043 1043
 	);
1044 1044
 
1045
-	$defaults['selected'] = is_author() ? get_query_var( 'author' ) : 0;
1045
+	$defaults['selected'] = is_author() ? get_query_var('author') : 0;
1046 1046
 
1047
-	$r = wp_parse_args( $args, $defaults );
1047
+	$r = wp_parse_args($args, $defaults);
1048 1048
 
1049
-	$query_args = wp_array_slice_assoc( $r, array( 'blog_id', 'include', 'exclude', 'orderby', 'order', 'who', 'role', 'role__in', 'role__not_in' ) );
1049
+	$query_args = wp_array_slice_assoc($r, array('blog_id', 'include', 'exclude', 'orderby', 'order', 'who', 'role', 'role__in', 'role__not_in'));
1050 1050
 
1051
-	$fields = array( 'ID', 'user_login' );
1051
+	$fields = array('ID', 'user_login');
1052 1052
 
1053
-	$show = ! empty( $r['show'] ) ? $r['show'] : 'display_name';
1054
-	if ( 'display_name_with_login' === $show ) {
1053
+	$show = ! empty($r['show']) ? $r['show'] : 'display_name';
1054
+	if ('display_name_with_login' === $show) {
1055 1055
 		$fields[] = 'display_name';
1056 1056
 	} else {
1057 1057
 		$fields[] = $show;
@@ -1071,56 +1071,56 @@  discard block
 block discarded – undo
1071 1071
 	 * @param array $query_args The query arguments for get_users().
1072 1072
 	 * @param array $r          The arguments passed to wp_dropdown_users() combined with the defaults.
1073 1073
 	 */
1074
-	$query_args = apply_filters( 'wp_dropdown_users_args', $query_args, $r );
1074
+	$query_args = apply_filters('wp_dropdown_users_args', $query_args, $r);
1075 1075
 
1076
-	$users = get_users( $query_args );
1076
+	$users = get_users($query_args);
1077 1077
 
1078 1078
 	$output = '';
1079
-	if ( ! empty( $users ) && ( empty( $r['hide_if_only_one_author'] ) || count( $users ) > 1 ) ) {
1080
-		$name = esc_attr( $r['name'] );
1081
-		if ( $r['multi'] && ! $r['id'] ) {
1079
+	if ( ! empty($users) && (empty($r['hide_if_only_one_author']) || count($users) > 1)) {
1080
+		$name = esc_attr($r['name']);
1081
+		if ($r['multi'] && ! $r['id']) {
1082 1082
 			$id = '';
1083 1083
 		} else {
1084
-			$id = $r['id'] ? " id='" . esc_attr( $r['id'] ) . "'" : " id='$name'";
1084
+			$id = $r['id'] ? " id='".esc_attr($r['id'])."'" : " id='$name'";
1085 1085
 		}
1086
-		$output = "<select name='{$name}'{$id} class='" . $r['class'] . "'>\n";
1086
+		$output = "<select name='{$name}'{$id} class='".$r['class']."'>\n";
1087 1087
 
1088
-		if ( $show_option_all ) {
1088
+		if ($show_option_all) {
1089 1089
 			$output .= "\t<option value='0'>$show_option_all</option>\n";
1090 1090
 		}
1091 1091
 
1092
-		if ( $show_option_none ) {
1093
-			$_selected = selected( $option_none_value, $r['selected'], false );
1094
-			$output .= "\t<option value='" . esc_attr( $option_none_value ) . "'$_selected>$show_option_none</option>\n";
1092
+		if ($show_option_none) {
1093
+			$_selected = selected($option_none_value, $r['selected'], false);
1094
+			$output .= "\t<option value='".esc_attr($option_none_value)."'$_selected>$show_option_none</option>\n";
1095 1095
 		}
1096 1096
 
1097
-		if ( $r['include_selected'] && ( $r['selected'] > 0 ) ) {
1097
+		if ($r['include_selected'] && ($r['selected'] > 0)) {
1098 1098
 			$found_selected = false;
1099 1099
 			$r['selected'] = (int) $r['selected'];
1100
-			foreach ( (array) $users as $user ) {
1100
+			foreach ((array) $users as $user) {
1101 1101
 				$user->ID = (int) $user->ID;
1102
-				if ( $user->ID === $r['selected'] ) {
1102
+				if ($user->ID === $r['selected']) {
1103 1103
 					$found_selected = true;
1104 1104
 				}
1105 1105
 			}
1106 1106
 
1107
-			if ( ! $found_selected ) {
1108
-				$users[] = get_userdata( $r['selected'] );
1107
+			if ( ! $found_selected) {
1108
+				$users[] = get_userdata($r['selected']);
1109 1109
 			}
1110 1110
 		}
1111 1111
 
1112
-		foreach ( (array) $users as $user ) {
1113
-			if ( 'display_name_with_login' === $show ) {
1112
+		foreach ((array) $users as $user) {
1113
+			if ('display_name_with_login' === $show) {
1114 1114
 				/* translators: 1: display name, 2: user_login */
1115
-				$display = sprintf( _x( '%1$s (%2$s)', 'user dropdown' ), $user->display_name, $user->user_login );
1116
-			} elseif ( ! empty( $user->$show ) ) {
1115
+				$display = sprintf(_x('%1$s (%2$s)', 'user dropdown'), $user->display_name, $user->user_login);
1116
+			} elseif ( ! empty($user->$show)) {
1117 1117
 				$display = $user->$show;
1118 1118
 			} else {
1119
-				$display = '(' . $user->user_login . ')';
1119
+				$display = '('.$user->user_login.')';
1120 1120
 			}
1121 1121
 
1122
-			$_selected = selected( $user->ID, $r['selected'], false );
1123
-			$output .= "\t<option value='$user->ID'$_selected>" . esc_html( $display ) . "</option>\n";
1122
+			$_selected = selected($user->ID, $r['selected'], false);
1123
+			$output .= "\t<option value='$user->ID'$_selected>".esc_html($display)."</option>\n";
1124 1124
 		}
1125 1125
 
1126 1126
 		$output .= "</select>";
@@ -1133,9 +1133,9 @@  discard block
 block discarded – undo
1133 1133
 	 *
1134 1134
 	 * @param string $output HTML output generated by wp_dropdown_users().
1135 1135
 	 */
1136
-	$html = apply_filters( 'wp_dropdown_users', $output );
1136
+	$html = apply_filters('wp_dropdown_users', $output);
1137 1137
 
1138
-	if ( $r['echo'] ) {
1138
+	if ($r['echo']) {
1139 1139
 		echo $html;
1140 1140
 	}
1141 1141
 	return $html;
@@ -1159,22 +1159,22 @@  discard block
 block discarded – undo
1159 1159
  */
1160 1160
 function sanitize_user_field($field, $value, $user_id, $context) {
1161 1161
 	$int_fields = array('ID');
1162
-	if ( in_array($field, $int_fields) )
1162
+	if (in_array($field, $int_fields))
1163 1163
 		$value = (int) $value;
1164 1164
 
1165
-	if ( 'raw' == $context )
1165
+	if ('raw' == $context)
1166 1166
 		return $value;
1167 1167
 
1168
-	if ( !is_string($value) && !is_numeric($value) )
1168
+	if ( ! is_string($value) && ! is_numeric($value))
1169 1169
 		return $value;
1170 1170
 
1171
-	$prefixed = false !== strpos( $field, 'user_' );
1171
+	$prefixed = false !== strpos($field, 'user_');
1172 1172
 
1173
-	if ( 'edit' == $context ) {
1174
-		if ( $prefixed ) {
1173
+	if ('edit' == $context) {
1174
+		if ($prefixed) {
1175 1175
 
1176 1176
 			/** This filter is documented in wp-includes/post.php */
1177
-			$value = apply_filters( "edit_{$field}", $value, $user_id );
1177
+			$value = apply_filters("edit_{$field}", $value, $user_id);
1178 1178
 		} else {
1179 1179
 
1180 1180
 			/**
@@ -1188,17 +1188,17 @@  discard block
 block discarded – undo
1188 1188
 			 * @param mixed $value   Value of the prefixed user field.
1189 1189
 			 * @param int   $user_id User ID.
1190 1190
 			 */
1191
-			$value = apply_filters( "edit_user_{$field}", $value, $user_id );
1191
+			$value = apply_filters("edit_user_{$field}", $value, $user_id);
1192 1192
 		}
1193 1193
 
1194
-		if ( 'description' == $field )
1195
-			$value = esc_html( $value ); // textarea_escaped?
1194
+		if ('description' == $field)
1195
+			$value = esc_html($value); // textarea_escaped?
1196 1196
 		else
1197 1197
 			$value = esc_attr($value);
1198
-	} elseif ( 'db' == $context ) {
1199
-		if ( $prefixed ) {
1198
+	} elseif ('db' == $context) {
1199
+		if ($prefixed) {
1200 1200
 			/** This filter is documented in wp-includes/post.php */
1201
-			$value = apply_filters( "pre_{$field}", $value );
1201
+			$value = apply_filters("pre_{$field}", $value);
1202 1202
 		} else {
1203 1203
 
1204 1204
 			/**
@@ -1211,14 +1211,14 @@  discard block
 block discarded – undo
1211 1211
 			 *
1212 1212
 			 * @param mixed $value Value of the prefixed user field.
1213 1213
 			 */
1214
-			$value = apply_filters( "pre_user_{$field}", $value );
1214
+			$value = apply_filters("pre_user_{$field}", $value);
1215 1215
 		}
1216 1216
 	} else {
1217 1217
 		// Use display filters by default.
1218
-		if ( $prefixed ) {
1218
+		if ($prefixed) {
1219 1219
 
1220 1220
 			/** This filter is documented in wp-includes/post.php */
1221
-			$value = apply_filters( "{$field}", $value, $user_id, $context );
1221
+			$value = apply_filters("{$field}", $value, $user_id, $context);
1222 1222
 		} else {
1223 1223
 
1224 1224
 			/**
@@ -1233,17 +1233,17 @@  discard block
 block discarded – undo
1233 1233
 			 * @param int    $user_id User ID.
1234 1234
 			 * @param string $context The context to filter within.
1235 1235
 			 */
1236
-			$value = apply_filters( "user_{$field}", $value, $user_id, $context );
1236
+			$value = apply_filters("user_{$field}", $value, $user_id, $context);
1237 1237
 		}
1238 1238
 	}
1239 1239
 
1240
-	if ( 'user_url' == $field )
1240
+	if ('user_url' == $field)
1241 1241
 		$value = esc_url($value);
1242 1242
 
1243
-	if ( 'attribute' == $context ) {
1244
-		$value = esc_attr( $value );
1245
-	} elseif ( 'js' == $context ) {
1246
-		$value = esc_js( $value );
1243
+	if ('attribute' == $context) {
1244
+		$value = esc_attr($value);
1245
+	} elseif ('js' == $context) {
1246
+		$value = esc_js($value);
1247 1247
 	}
1248 1248
 	return $value;
1249 1249
 }
@@ -1256,9 +1256,9 @@  discard block
 block discarded – undo
1256 1256
  * @param object|WP_User $user User object to be cached
1257 1257
  * @return bool|null Returns false on failure.
1258 1258
  */
1259
-function update_user_caches( $user ) {
1260
-	if ( $user instanceof WP_User ) {
1261
-		if ( ! $user->exists() ) {
1259
+function update_user_caches($user) {
1260
+	if ($user instanceof WP_User) {
1261
+		if ( ! $user->exists()) {
1262 1262
 			return false;
1263 1263
 		}
1264 1264
 
@@ -1279,17 +1279,17 @@  discard block
 block discarded – undo
1279 1279
  *
1280 1280
  * @param WP_User|int $user User object or ID to be cleaned from the cache
1281 1281
  */
1282
-function clean_user_cache( $user ) {
1283
-	if ( is_numeric( $user ) )
1284
-		$user = new WP_User( $user );
1282
+function clean_user_cache($user) {
1283
+	if (is_numeric($user))
1284
+		$user = new WP_User($user);
1285 1285
 
1286
-	if ( ! $user->exists() )
1286
+	if ( ! $user->exists())
1287 1287
 		return;
1288 1288
 
1289
-	wp_cache_delete( $user->ID, 'users' );
1290
-	wp_cache_delete( $user->user_login, 'userlogins' );
1291
-	wp_cache_delete( $user->user_email, 'useremail' );
1292
-	wp_cache_delete( $user->user_nicename, 'userslugs' );
1289
+	wp_cache_delete($user->ID, 'users');
1290
+	wp_cache_delete($user->user_login, 'userlogins');
1291
+	wp_cache_delete($user->user_email, 'useremail');
1292
+	wp_cache_delete($user->user_nicename, 'userslugs');
1293 1293
 
1294 1294
 	/**
1295 1295
 	 * Fires immediately after the given user's cache is cleaned.
@@ -1299,7 +1299,7 @@  discard block
 block discarded – undo
1299 1299
 	 * @param int     $user_id User ID.
1300 1300
 	 * @param WP_User $user    User object.
1301 1301
 	 */
1302
-	do_action( 'clean_user_cache', $user->ID, $user );
1302
+	do_action('clean_user_cache', $user->ID, $user);
1303 1303
 }
1304 1304
 
1305 1305
 /**
@@ -1310,8 +1310,8 @@  discard block
 block discarded – undo
1310 1310
  * @param string $username Username.
1311 1311
  * @return int|false The user's ID on success, and false on failure.
1312 1312
  */
1313
-function username_exists( $username ) {
1314
-	if ( $user = get_user_by( 'login', $username ) ) {
1313
+function username_exists($username) {
1314
+	if ($user = get_user_by('login', $username)) {
1315 1315
 		return $user->ID;
1316 1316
 	}
1317 1317
 	return false;
@@ -1325,8 +1325,8 @@  discard block
 block discarded – undo
1325 1325
  * @param string $email Email.
1326 1326
  * @return int|false The user's ID on success, and false on failure.
1327 1327
  */
1328
-function email_exists( $email ) {
1329
-	if ( $user = get_user_by( 'email', $email) ) {
1328
+function email_exists($email) {
1329
+	if ($user = get_user_by('email', $email)) {
1330 1330
 		return $user->ID;
1331 1331
 	}
1332 1332
 	return false;
@@ -1341,9 +1341,9 @@  discard block
 block discarded – undo
1341 1341
  * @param string $username Username.
1342 1342
  * @return bool Whether username given is valid
1343 1343
  */
1344
-function validate_username( $username ) {
1345
-	$sanitized = sanitize_user( $username, true );
1346
-	$valid = ( $sanitized == $username && ! empty( $sanitized ) );
1344
+function validate_username($username) {
1345
+	$sanitized = sanitize_user($username, true);
1346
+	$valid = ($sanitized == $username && ! empty($sanitized));
1347 1347
 
1348 1348
 	/**
1349 1349
 	 * Filters whether the provided username is valid or not.
@@ -1353,7 +1353,7 @@  discard block
 block discarded – undo
1353 1353
 	 * @param bool   $valid    Whether given username is valid.
1354 1354
 	 * @param string $username Username to check.
1355 1355
 	 */
1356
-	return apply_filters( 'validate_username', $valid, $username );
1356
+	return apply_filters('validate_username', $valid, $username);
1357 1357
 }
1358 1358
 
1359 1359
 /**
@@ -1408,34 +1408,34 @@  discard block
 block discarded – undo
1408 1408
  * @return int|WP_Error The newly created user's ID or a WP_Error object if the user could not
1409 1409
  *                      be created.
1410 1410
  */
1411
-function wp_insert_user( $userdata ) {
1411
+function wp_insert_user($userdata) {
1412 1412
 	global $wpdb;
1413 1413
 
1414
-	if ( $userdata instanceof stdClass ) {
1415
-		$userdata = get_object_vars( $userdata );
1416
-	} elseif ( $userdata instanceof WP_User ) {
1414
+	if ($userdata instanceof stdClass) {
1415
+		$userdata = get_object_vars($userdata);
1416
+	} elseif ($userdata instanceof WP_User) {
1417 1417
 		$userdata = $userdata->to_array();
1418 1418
 	}
1419 1419
 
1420 1420
 	// Are we updating or creating?
1421
-	if ( ! empty( $userdata['ID'] ) ) {
1421
+	if ( ! empty($userdata['ID'])) {
1422 1422
 		$ID = (int) $userdata['ID'];
1423 1423
 		$update = true;
1424
-		$old_user_data = get_userdata( $ID );
1424
+		$old_user_data = get_userdata($ID);
1425 1425
 
1426
-		if ( ! $old_user_data ) {
1427
-			return new WP_Error( 'invalid_user_id', __( 'Invalid user ID.' ) );
1426
+		if ( ! $old_user_data) {
1427
+			return new WP_Error('invalid_user_id', __('Invalid user ID.'));
1428 1428
 		}
1429 1429
 
1430 1430
 		// hashed in wp_update_user(), plaintext if called directly
1431
-		$user_pass = ! empty( $userdata['user_pass'] ) ? $userdata['user_pass'] : $old_user_data->user_pass;
1431
+		$user_pass = ! empty($userdata['user_pass']) ? $userdata['user_pass'] : $old_user_data->user_pass;
1432 1432
 	} else {
1433 1433
 		$update = false;
1434 1434
 		// Hash the password
1435
-		$user_pass = wp_hash_password( $userdata['user_pass'] );
1435
+		$user_pass = wp_hash_password($userdata['user_pass']);
1436 1436
 	}
1437 1437
 
1438
-	$sanitized_user_login = sanitize_user( $userdata['user_login'], true );
1438
+	$sanitized_user_login = sanitize_user($userdata['user_login'], true);
1439 1439
 
1440 1440
 	/**
1441 1441
 	 * Filters a username after it has been sanitized.
@@ -1446,20 +1446,20 @@  discard block
 block discarded – undo
1446 1446
 	 *
1447 1447
 	 * @param string $sanitized_user_login Username after it has been sanitized.
1448 1448
 	 */
1449
-	$pre_user_login = apply_filters( 'pre_user_login', $sanitized_user_login );
1449
+	$pre_user_login = apply_filters('pre_user_login', $sanitized_user_login);
1450 1450
 
1451 1451
 	//Remove any non-printable chars from the login string to see if we have ended up with an empty username
1452
-	$user_login = trim( $pre_user_login );
1452
+	$user_login = trim($pre_user_login);
1453 1453
 
1454 1454
 	// user_login must be between 0 and 60 characters.
1455
-	if ( empty( $user_login ) ) {
1456
-		return new WP_Error('empty_user_login', __('Cannot create a user with an empty login name.') );
1457
-	} elseif ( mb_strlen( $user_login ) > 60 ) {
1458
-		return new WP_Error( 'user_login_too_long', __( 'Username may not be longer than 60 characters.' ) );
1455
+	if (empty($user_login)) {
1456
+		return new WP_Error('empty_user_login', __('Cannot create a user with an empty login name.'));
1457
+	} elseif (mb_strlen($user_login) > 60) {
1458
+		return new WP_Error('user_login_too_long', __('Username may not be longer than 60 characters.'));
1459 1459
 	}
1460 1460
 
1461
-	if ( ! $update && username_exists( $user_login ) ) {
1462
-		return new WP_Error( 'existing_user_login', __( 'Sorry, that username already exists!' ) );
1461
+	if ( ! $update && username_exists($user_login)) {
1462
+		return new WP_Error('existing_user_login', __('Sorry, that username already exists!'));
1463 1463
 	}
1464 1464
 
1465 1465
 	/**
@@ -1469,26 +1469,26 @@  discard block
 block discarded – undo
1469 1469
 	 *
1470 1470
 	 * @param array $usernames Array of blacklisted usernames.
1471 1471
 	 */
1472
-	$illegal_logins = (array) apply_filters( 'illegal_user_logins', array() );
1472
+	$illegal_logins = (array) apply_filters('illegal_user_logins', array());
1473 1473
 
1474
-	if ( in_array( strtolower( $user_login ), array_map( 'strtolower', $illegal_logins ) ) ) {
1475
-		return new WP_Error( 'invalid_username', __( 'Sorry, that username is not allowed.' ) );
1474
+	if (in_array(strtolower($user_login), array_map('strtolower', $illegal_logins))) {
1475
+		return new WP_Error('invalid_username', __('Sorry, that username is not allowed.'));
1476 1476
 	}
1477 1477
 
1478 1478
 	/*
1479 1479
 	 * If a nicename is provided, remove unsafe user characters before using it.
1480 1480
 	 * Otherwise build a nicename from the user_login.
1481 1481
 	 */
1482
-	if ( ! empty( $userdata['user_nicename'] ) ) {
1483
-		$user_nicename = sanitize_user( $userdata['user_nicename'], true );
1484
-		if ( mb_strlen( $user_nicename ) > 50 ) {
1485
-			return new WP_Error( 'user_nicename_too_long', __( 'Nicename may not be longer than 50 characters.' ) );
1482
+	if ( ! empty($userdata['user_nicename'])) {
1483
+		$user_nicename = sanitize_user($userdata['user_nicename'], true);
1484
+		if (mb_strlen($user_nicename) > 50) {
1485
+			return new WP_Error('user_nicename_too_long', __('Nicename may not be longer than 50 characters.'));
1486 1486
 		}
1487 1487
 	} else {
1488
-		$user_nicename = mb_substr( $user_login, 0, 50 );
1488
+		$user_nicename = mb_substr($user_login, 0, 50);
1489 1489
 	}
1490 1490
 
1491
-	$user_nicename = sanitize_title( $user_nicename );
1491
+	$user_nicename = sanitize_title($user_nicename);
1492 1492
 
1493 1493
 	// Store values to save in user meta.
1494 1494
 	$meta = array();
@@ -1500,9 +1500,9 @@  discard block
 block discarded – undo
1500 1500
 	 *
1501 1501
 	 * @param string $user_nicename The user's nicename.
1502 1502
 	 */
1503
-	$user_nicename = apply_filters( 'pre_user_nicename', $user_nicename );
1503
+	$user_nicename = apply_filters('pre_user_nicename', $user_nicename);
1504 1504
 
1505
-	$raw_user_url = empty( $userdata['user_url'] ) ? '' : $userdata['user_url'];
1505
+	$raw_user_url = empty($userdata['user_url']) ? '' : $userdata['user_url'];
1506 1506
 
1507 1507
 	/**
1508 1508
 	 * Filters a user's URL before the user is created or updated.
@@ -1511,9 +1511,9 @@  discard block
 block discarded – undo
1511 1511
 	 *
1512 1512
 	 * @param string $raw_user_url The user's URL.
1513 1513
 	 */
1514
-	$user_url = apply_filters( 'pre_user_url', $raw_user_url );
1514
+	$user_url = apply_filters('pre_user_url', $raw_user_url);
1515 1515
 
1516
-	$raw_user_email = empty( $userdata['user_email'] ) ? '' : $userdata['user_email'];
1516
+	$raw_user_email = empty($userdata['user_email']) ? '' : $userdata['user_email'];
1517 1517
 
1518 1518
 	/**
1519 1519
 	 * Filters a user's email before the user is created or updated.
@@ -1522,20 +1522,20 @@  discard block
 block discarded – undo
1522 1522
 	 *
1523 1523
 	 * @param string $raw_user_email The user's email.
1524 1524
 	 */
1525
-	$user_email = apply_filters( 'pre_user_email', $raw_user_email );
1525
+	$user_email = apply_filters('pre_user_email', $raw_user_email);
1526 1526
 
1527 1527
 	/*
1528 1528
 	 * If there is no update, just check for `email_exists`. If there is an update,
1529 1529
 	 * check if current email and new email are the same, or not, and check `email_exists`
1530 1530
 	 * accordingly.
1531 1531
 	 */
1532
-	if ( ( ! $update || ( ! empty( $old_user_data ) && 0 !== strcasecmp( $user_email, $old_user_data->user_email ) ) )
1533
-		&& ! defined( 'WP_IMPORTING' )
1534
-		&& email_exists( $user_email )
1532
+	if (( ! $update || ( ! empty($old_user_data) && 0 !== strcasecmp($user_email, $old_user_data->user_email)))
1533
+		&& ! defined('WP_IMPORTING')
1534
+		&& email_exists($user_email)
1535 1535
 	) {
1536
-		return new WP_Error( 'existing_user_email', __( 'Sorry, that email address is already used!' ) );
1536
+		return new WP_Error('existing_user_email', __('Sorry, that email address is already used!'));
1537 1537
 	}
1538
-	$nickname = empty( $userdata['nickname'] ) ? $user_login : $userdata['nickname'];
1538
+	$nickname = empty($userdata['nickname']) ? $user_login : $userdata['nickname'];
1539 1539
 
1540 1540
 	/**
1541 1541
 	 * Filters a user's nickname before the user is created or updated.
@@ -1544,9 +1544,9 @@  discard block
 block discarded – undo
1544 1544
 	 *
1545 1545
 	 * @param string $nickname The user's nickname.
1546 1546
 	 */
1547
-	$meta['nickname'] = apply_filters( 'pre_user_nickname', $nickname );
1547
+	$meta['nickname'] = apply_filters('pre_user_nickname', $nickname);
1548 1548
 
1549
-	$first_name = empty( $userdata['first_name'] ) ? '' : $userdata['first_name'];
1549
+	$first_name = empty($userdata['first_name']) ? '' : $userdata['first_name'];
1550 1550
 
1551 1551
 	/**
1552 1552
 	 * Filters a user's first name before the user is created or updated.
@@ -1555,9 +1555,9 @@  discard block
 block discarded – undo
1555 1555
 	 *
1556 1556
 	 * @param string $first_name The user's first name.
1557 1557
 	 */
1558
-	$meta['first_name'] = apply_filters( 'pre_user_first_name', $first_name );
1558
+	$meta['first_name'] = apply_filters('pre_user_first_name', $first_name);
1559 1559
 
1560
-	$last_name = empty( $userdata['last_name'] ) ? '' : $userdata['last_name'];
1560
+	$last_name = empty($userdata['last_name']) ? '' : $userdata['last_name'];
1561 1561
 
1562 1562
 	/**
1563 1563
 	 * Filters a user's last name before the user is created or updated.
@@ -1566,17 +1566,17 @@  discard block
 block discarded – undo
1566 1566
 	 *
1567 1567
 	 * @param string $last_name The user's last name.
1568 1568
 	 */
1569
-	$meta['last_name'] = apply_filters( 'pre_user_last_name', $last_name );
1569
+	$meta['last_name'] = apply_filters('pre_user_last_name', $last_name);
1570 1570
 
1571
-	if ( empty( $userdata['display_name'] ) ) {
1572
-		if ( $update ) {
1571
+	if (empty($userdata['display_name'])) {
1572
+		if ($update) {
1573 1573
 			$display_name = $user_login;
1574
-		} elseif ( $meta['first_name'] && $meta['last_name'] ) {
1574
+		} elseif ($meta['first_name'] && $meta['last_name']) {
1575 1575
 			/* translators: 1: first name, 2: last name */
1576
-			$display_name = sprintf( _x( '%1$s %2$s', 'Display name based on first name and last name' ), $meta['first_name'], $meta['last_name'] );
1577
-		} elseif ( $meta['first_name'] ) {
1576
+			$display_name = sprintf(_x('%1$s %2$s', 'Display name based on first name and last name'), $meta['first_name'], $meta['last_name']);
1577
+		} elseif ($meta['first_name']) {
1578 1578
 			$display_name = $meta['first_name'];
1579
-		} elseif ( $meta['last_name'] ) {
1579
+		} elseif ($meta['last_name']) {
1580 1580
 			$display_name = $meta['last_name'];
1581 1581
 		} else {
1582 1582
 			$display_name = $user_login;
@@ -1592,9 +1592,9 @@  discard block
 block discarded – undo
1592 1592
 	 *
1593 1593
 	 * @param string $display_name The user's display name.
1594 1594
 	 */
1595
-	$display_name = apply_filters( 'pre_user_display_name', $display_name );
1595
+	$display_name = apply_filters('pre_user_display_name', $display_name);
1596 1596
 
1597
-	$description = empty( $userdata['description'] ) ? '' : $userdata['description'];
1597
+	$description = empty($userdata['description']) ? '' : $userdata['description'];
1598 1598
 
1599 1599
 	/**
1600 1600
 	 * Filters a user's description before the user is created or updated.
@@ -1603,52 +1603,52 @@  discard block
 block discarded – undo
1603 1603
 	 *
1604 1604
 	 * @param string $description The user's description.
1605 1605
 	 */
1606
-	$meta['description'] = apply_filters( 'pre_user_description', $description );
1606
+	$meta['description'] = apply_filters('pre_user_description', $description);
1607 1607
 
1608
-	$meta['rich_editing'] = empty( $userdata['rich_editing'] ) ? 'true' : $userdata['rich_editing'];
1608
+	$meta['rich_editing'] = empty($userdata['rich_editing']) ? 'true' : $userdata['rich_editing'];
1609 1609
 
1610
-	$meta['comment_shortcuts'] = empty( $userdata['comment_shortcuts'] ) || 'false' === $userdata['comment_shortcuts'] ? 'false' : 'true';
1610
+	$meta['comment_shortcuts'] = empty($userdata['comment_shortcuts']) || 'false' === $userdata['comment_shortcuts'] ? 'false' : 'true';
1611 1611
 
1612
-	$admin_color = empty( $userdata['admin_color'] ) ? 'fresh' : $userdata['admin_color'];
1613
-	$meta['admin_color'] = preg_replace( '|[^a-z0-9 _.\-@]|i', '', $admin_color );
1612
+	$admin_color = empty($userdata['admin_color']) ? 'fresh' : $userdata['admin_color'];
1613
+	$meta['admin_color'] = preg_replace('|[^a-z0-9 _.\-@]|i', '', $admin_color);
1614 1614
 
1615
-	$meta['use_ssl'] = empty( $userdata['use_ssl'] ) ? 0 : $userdata['use_ssl'];
1615
+	$meta['use_ssl'] = empty($userdata['use_ssl']) ? 0 : $userdata['use_ssl'];
1616 1616
 
1617
-	$user_registered = empty( $userdata['user_registered'] ) ? gmdate( 'Y-m-d H:i:s' ) : $userdata['user_registered'];
1617
+	$user_registered = empty($userdata['user_registered']) ? gmdate('Y-m-d H:i:s') : $userdata['user_registered'];
1618 1618
 
1619
-	$meta['show_admin_bar_front'] = empty( $userdata['show_admin_bar_front'] ) ? 'true' : $userdata['show_admin_bar_front'];
1619
+	$meta['show_admin_bar_front'] = empty($userdata['show_admin_bar_front']) ? 'true' : $userdata['show_admin_bar_front'];
1620 1620
 
1621
-	$meta['locale'] = isset( $userdata['locale'] ) ? $userdata['locale'] : '';
1621
+	$meta['locale'] = isset($userdata['locale']) ? $userdata['locale'] : '';
1622 1622
 
1623
-	$user_nicename_check = $wpdb->get_var( $wpdb->prepare("SELECT ID FROM $wpdb->users WHERE user_nicename = %s AND user_login != %s LIMIT 1" , $user_nicename, $user_login));
1623
+	$user_nicename_check = $wpdb->get_var($wpdb->prepare("SELECT ID FROM $wpdb->users WHERE user_nicename = %s AND user_login != %s LIMIT 1", $user_nicename, $user_login));
1624 1624
 
1625
-	if ( $user_nicename_check ) {
1625
+	if ($user_nicename_check) {
1626 1626
 		$suffix = 2;
1627 1627
 		while ($user_nicename_check) {
1628 1628
 			// user_nicename allows 50 chars. Subtract one for a hyphen, plus the length of the suffix.
1629
-			$base_length = 49 - mb_strlen( $suffix );
1630
-			$alt_user_nicename = mb_substr( $user_nicename, 0, $base_length ) . "-$suffix";
1631
-			$user_nicename_check = $wpdb->get_var( $wpdb->prepare("SELECT ID FROM $wpdb->users WHERE user_nicename = %s AND user_login != %s LIMIT 1" , $alt_user_nicename, $user_login));
1629
+			$base_length = 49 - mb_strlen($suffix);
1630
+			$alt_user_nicename = mb_substr($user_nicename, 0, $base_length)."-$suffix";
1631
+			$user_nicename_check = $wpdb->get_var($wpdb->prepare("SELECT ID FROM $wpdb->users WHERE user_nicename = %s AND user_login != %s LIMIT 1", $alt_user_nicename, $user_login));
1632 1632
 			$suffix++;
1633 1633
 		}
1634 1634
 		$user_nicename = $alt_user_nicename;
1635 1635
 	}
1636 1636
 
1637
-	$compacted = compact( 'user_pass', 'user_email', 'user_url', 'user_nicename', 'display_name', 'user_registered' );
1638
-	$data = wp_unslash( $compacted );
1637
+	$compacted = compact('user_pass', 'user_email', 'user_url', 'user_nicename', 'display_name', 'user_registered');
1638
+	$data = wp_unslash($compacted);
1639 1639
 
1640
-	if ( $update ) {
1641
-		if ( $user_email !== $old_user_data->user_email ) {
1640
+	if ($update) {
1641
+		if ($user_email !== $old_user_data->user_email) {
1642 1642
 			$data['user_activation_key'] = '';
1643 1643
 		}
1644
-		$wpdb->update( $wpdb->users, $data, compact( 'ID' ) );
1644
+		$wpdb->update($wpdb->users, $data, compact('ID'));
1645 1645
 		$user_id = (int) $ID;
1646 1646
 	} else {
1647
-		$wpdb->insert( $wpdb->users, $data + compact( 'user_login' ) );
1647
+		$wpdb->insert($wpdb->users, $data + compact('user_login'));
1648 1648
 		$user_id = (int) $wpdb->insert_id;
1649 1649
 	}
1650 1650
 
1651
-	$user = new WP_User( $user_id );
1651
+	$user = new WP_User($user_id);
1652 1652
 
1653 1653
 	/**
1654 1654
  	 * Filters a user's meta values and keys before the user is created or updated.
@@ -1675,28 +1675,28 @@  discard block
 block discarded – undo
1675 1675
 	 * @param WP_User $user   User object.
1676 1676
 	 * @param bool    $update Whether the user is being updated rather than created.
1677 1677
  	 */
1678
-	$meta = apply_filters( 'insert_user_meta', $meta, $user, $update );
1678
+	$meta = apply_filters('insert_user_meta', $meta, $user, $update);
1679 1679
 
1680 1680
 	// Update user meta.
1681
-	foreach ( $meta as $key => $value ) {
1682
-		update_user_meta( $user_id, $key, $value );
1681
+	foreach ($meta as $key => $value) {
1682
+		update_user_meta($user_id, $key, $value);
1683 1683
 	}
1684 1684
 
1685
-	foreach ( wp_get_user_contact_methods( $user ) as $key => $value ) {
1686
-		if ( isset( $userdata[ $key ] ) ) {
1687
-			update_user_meta( $user_id, $key, $userdata[ $key ] );
1685
+	foreach (wp_get_user_contact_methods($user) as $key => $value) {
1686
+		if (isset($userdata[$key])) {
1687
+			update_user_meta($user_id, $key, $userdata[$key]);
1688 1688
 		}
1689 1689
 	}
1690 1690
 
1691
-	if ( isset( $userdata['role'] ) ) {
1692
-		$user->set_role( $userdata['role'] );
1693
-	} elseif ( ! $update ) {
1691
+	if (isset($userdata['role'])) {
1692
+		$user->set_role($userdata['role']);
1693
+	} elseif ( ! $update) {
1694 1694
 		$user->set_role(get_option('default_role'));
1695 1695
 	}
1696
-	wp_cache_delete( $user_id, 'users' );
1697
-	wp_cache_delete( $user_login, 'userlogins' );
1696
+	wp_cache_delete($user_id, 'users');
1697
+	wp_cache_delete($user_login, 'userlogins');
1698 1698
 
1699
-	if ( $update ) {
1699
+	if ($update) {
1700 1700
 		/**
1701 1701
 		 * Fires immediately after an existing user is updated.
1702 1702
 		 *
@@ -1705,7 +1705,7 @@  discard block
 block discarded – undo
1705 1705
 		 * @param int    $user_id       User ID.
1706 1706
 		 * @param object $old_user_data Object containing user's data prior to update.
1707 1707
 		 */
1708
-		do_action( 'profile_update', $user_id, $old_user_data );
1708
+		do_action('profile_update', $user_id, $old_user_data);
1709 1709
 	} else {
1710 1710
 		/**
1711 1711
 		 * Fires immediately after a new user is registered.
@@ -1714,7 +1714,7 @@  discard block
 block discarded – undo
1714 1714
 		 *
1715 1715
 		 * @param int $user_id User ID.
1716 1716
 		 */
1717
-		do_action( 'user_register', $user_id );
1717
+		do_action('user_register', $user_id);
1718 1718
 	}
1719 1719
 
1720 1720
 	return $user_id;
@@ -1737,37 +1737,37 @@  discard block
 block discarded – undo
1737 1737
  * @return int|WP_Error The updated user's ID or a WP_Error object if the user could not be updated.
1738 1738
  */
1739 1739
 function wp_update_user($userdata) {
1740
-	if ( $userdata instanceof stdClass ) {
1741
-		$userdata = get_object_vars( $userdata );
1742
-	} elseif ( $userdata instanceof WP_User ) {
1740
+	if ($userdata instanceof stdClass) {
1741
+		$userdata = get_object_vars($userdata);
1742
+	} elseif ($userdata instanceof WP_User) {
1743 1743
 		$userdata = $userdata->to_array();
1744 1744
 	}
1745 1745
 
1746
-	$ID = isset( $userdata['ID'] ) ? (int) $userdata['ID'] : 0;
1747
-	if ( ! $ID ) {
1748
-		return new WP_Error( 'invalid_user_id', __( 'Invalid user ID.' ) );
1746
+	$ID = isset($userdata['ID']) ? (int) $userdata['ID'] : 0;
1747
+	if ( ! $ID) {
1748
+		return new WP_Error('invalid_user_id', __('Invalid user ID.'));
1749 1749
 	}
1750 1750
 
1751 1751
 	// First, get all of the original fields
1752
-	$user_obj = get_userdata( $ID );
1753
-	if ( ! $user_obj ) {
1754
-		return new WP_Error( 'invalid_user_id', __( 'Invalid user ID.' ) );
1752
+	$user_obj = get_userdata($ID);
1753
+	if ( ! $user_obj) {
1754
+		return new WP_Error('invalid_user_id', __('Invalid user ID.'));
1755 1755
 	}
1756 1756
 
1757 1757
 	$user = $user_obj->to_array();
1758 1758
 
1759 1759
 	// Add additional custom fields
1760
-	foreach ( _get_additional_user_keys( $user_obj ) as $key ) {
1761
-		$user[ $key ] = get_user_meta( $ID, $key, true );
1760
+	foreach (_get_additional_user_keys($user_obj) as $key) {
1761
+		$user[$key] = get_user_meta($ID, $key, true);
1762 1762
 	}
1763 1763
 
1764 1764
 	// Escape data pulled from DB.
1765
-	$user = add_magic_quotes( $user );
1765
+	$user = add_magic_quotes($user);
1766 1766
 
1767
-	if ( ! empty( $userdata['user_pass'] ) && $userdata['user_pass'] !== $user_obj->user_pass ) {
1767
+	if ( ! empty($userdata['user_pass']) && $userdata['user_pass'] !== $user_obj->user_pass) {
1768 1768
 		// If password is changing, hash it now
1769 1769
 		$plaintext_pass = $userdata['user_pass'];
1770
-		$userdata['user_pass'] = wp_hash_password( $userdata['user_pass'] );
1770
+		$userdata['user_pass'] = wp_hash_password($userdata['user_pass']);
1771 1771
 
1772 1772
 		/**
1773 1773
 		 * Filters whether to send the password change email.
@@ -1781,10 +1781,10 @@  discard block
 block discarded – undo
1781 1781
 		 * @param array $userdata The updated user array.
1782 1782
 		 *
1783 1783
 		 */
1784
-		$send_password_change_email = apply_filters( 'send_password_change_email', true, $user, $userdata );
1784
+		$send_password_change_email = apply_filters('send_password_change_email', true, $user, $userdata);
1785 1785
 	}
1786 1786
 
1787
-	if ( isset( $userdata['user_email'] ) && $user['user_email'] !== $userdata['user_email'] ) {
1787
+	if (isset($userdata['user_email']) && $user['user_email'] !== $userdata['user_email']) {
1788 1788
 		/**
1789 1789
 		 * Filters whether to send the email change email.
1790 1790
 		 *
@@ -1797,28 +1797,28 @@  discard block
 block discarded – undo
1797 1797
 		 * @param array $userdata The updated user array.
1798 1798
 		 *
1799 1799
 		 */
1800
-		$send_email_change_email = apply_filters( 'send_email_change_email', true, $user, $userdata );
1800
+		$send_email_change_email = apply_filters('send_email_change_email', true, $user, $userdata);
1801 1801
 	}
1802 1802
 
1803
-	wp_cache_delete( $user['user_email'], 'useremail' );
1804
-	wp_cache_delete( $user['user_nicename'], 'userslugs' );
1803
+	wp_cache_delete($user['user_email'], 'useremail');
1804
+	wp_cache_delete($user['user_nicename'], 'userslugs');
1805 1805
 
1806 1806
 	// Merge old and new fields with new fields overwriting old ones.
1807
-	$userdata = array_merge( $user, $userdata );
1808
-	$user_id = wp_insert_user( $userdata );
1807
+	$userdata = array_merge($user, $userdata);
1808
+	$user_id = wp_insert_user($userdata);
1809 1809
 
1810
-	if ( ! is_wp_error( $user_id ) ) {
1810
+	if ( ! is_wp_error($user_id)) {
1811 1811
 
1812
-		$blog_name = wp_specialchars_decode( get_option( 'blogname' ), ENT_QUOTES );
1812
+		$blog_name = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);
1813 1813
 
1814 1814
 		$switched_locale = false;
1815
-		if ( ! empty( $send_password_change_email ) || ! empty( $send_email_change_email ) ) {
1816
-			$switched_locale = switch_to_locale( get_user_locale( $user_id ) );
1815
+		if ( ! empty($send_password_change_email) || ! empty($send_email_change_email)) {
1816
+			$switched_locale = switch_to_locale(get_user_locale($user_id));
1817 1817
 		}
1818 1818
 
1819
-		if ( ! empty( $send_password_change_email ) ) {
1819
+		if ( ! empty($send_password_change_email)) {
1820 1820
 			/* translators: Do not translate USERNAME, ADMIN_EMAIL, EMAIL, SITENAME, SITEURL: those are placeholders. */
1821
-			$pass_change_text = __( 'Hi ###USERNAME###,
1821
+			$pass_change_text = __('Hi ###USERNAME###,
1822 1822
 
1823 1823
 This notice confirms that your password was changed on ###SITENAME###.
1824 1824
 
@@ -1834,7 +1834,7 @@  discard block
 block discarded – undo
1834 1834
 			$pass_change_email = array(
1835 1835
 				'to'      => $user['user_email'],
1836 1836
 				/* translators: User password change notification email subject. 1: Site name */
1837
-				'subject' => __( '[%s] Notice of Password Change' ),
1837
+				'subject' => __('[%s] Notice of Password Change'),
1838 1838
 				'message' => $pass_change_text,
1839 1839
 				'headers' => '',
1840 1840
 			);
@@ -1861,20 +1861,20 @@  discard block
 block discarded – undo
1861 1861
 			 * @param array $userdata The updated user array.
1862 1862
 			 *
1863 1863
 			 */
1864
-			$pass_change_email = apply_filters( 'password_change_email', $pass_change_email, $user, $userdata );
1864
+			$pass_change_email = apply_filters('password_change_email', $pass_change_email, $user, $userdata);
1865 1865
 
1866
-			$pass_change_email['message'] = str_replace( '###USERNAME###', $user['user_login'], $pass_change_email['message'] );
1867
-			$pass_change_email['message'] = str_replace( '###ADMIN_EMAIL###', get_option( 'admin_email' ), $pass_change_email['message'] );
1868
-			$pass_change_email['message'] = str_replace( '###EMAIL###', $user['user_email'], $pass_change_email['message'] );
1869
-			$pass_change_email['message'] = str_replace( '###SITENAME###', $blog_name, $pass_change_email['message'] );
1870
-			$pass_change_email['message'] = str_replace( '###SITEURL###', home_url(), $pass_change_email['message'] );
1866
+			$pass_change_email['message'] = str_replace('###USERNAME###', $user['user_login'], $pass_change_email['message']);
1867
+			$pass_change_email['message'] = str_replace('###ADMIN_EMAIL###', get_option('admin_email'), $pass_change_email['message']);
1868
+			$pass_change_email['message'] = str_replace('###EMAIL###', $user['user_email'], $pass_change_email['message']);
1869
+			$pass_change_email['message'] = str_replace('###SITENAME###', $blog_name, $pass_change_email['message']);
1870
+			$pass_change_email['message'] = str_replace('###SITEURL###', home_url(), $pass_change_email['message']);
1871 1871
 
1872
-			wp_mail( $pass_change_email['to'], sprintf( $pass_change_email['subject'], $blog_name ), $pass_change_email['message'], $pass_change_email['headers'] );
1872
+			wp_mail($pass_change_email['to'], sprintf($pass_change_email['subject'], $blog_name), $pass_change_email['message'], $pass_change_email['headers']);
1873 1873
 		}
1874 1874
 
1875
-		if ( ! empty( $send_email_change_email ) ) {
1875
+		if ( ! empty($send_email_change_email)) {
1876 1876
 			/* translators: Do not translate USERNAME, ADMIN_EMAIL, EMAIL, SITENAME, SITEURL: those are placeholders. */
1877
-			$email_change_text = __( 'Hi ###USERNAME###,
1877
+			$email_change_text = __('Hi ###USERNAME###,
1878 1878
 
1879 1879
 This notice confirms that your email was changed on ###SITENAME###.
1880 1880
 
@@ -1890,7 +1890,7 @@  discard block
 block discarded – undo
1890 1890
 			$email_change_email = array(
1891 1891
 				'to'      => $user['user_email'],
1892 1892
 				/* translators: User email change notification email subject. 1: Site name */
1893
-				'subject' => __( '[%s] Notice of Email Change' ),
1893
+				'subject' => __('[%s] Notice of Email Change'),
1894 1894
 				'message' => $email_change_text,
1895 1895
 				'headers' => '',
1896 1896
 			);
@@ -1916,36 +1916,36 @@  discard block
 block discarded – undo
1916 1916
 			 * @param array $user The original user array.
1917 1917
 			 * @param array $userdata The updated user array.
1918 1918
 			 */
1919
-			$email_change_email = apply_filters( 'email_change_email', $email_change_email, $user, $userdata );
1919
+			$email_change_email = apply_filters('email_change_email', $email_change_email, $user, $userdata);
1920 1920
 
1921
-			$email_change_email['message'] = str_replace( '###USERNAME###', $user['user_login'], $email_change_email['message'] );
1922
-			$email_change_email['message'] = str_replace( '###ADMIN_EMAIL###', get_option( 'admin_email' ), $email_change_email['message'] );
1923
-			$email_change_email['message'] = str_replace( '###EMAIL###', $user['user_email'], $email_change_email['message'] );
1924
-			$email_change_email['message'] = str_replace( '###SITENAME###', $blog_name, $email_change_email['message'] );
1925
-			$email_change_email['message'] = str_replace( '###SITEURL###', home_url(), $email_change_email['message'] );
1921
+			$email_change_email['message'] = str_replace('###USERNAME###', $user['user_login'], $email_change_email['message']);
1922
+			$email_change_email['message'] = str_replace('###ADMIN_EMAIL###', get_option('admin_email'), $email_change_email['message']);
1923
+			$email_change_email['message'] = str_replace('###EMAIL###', $user['user_email'], $email_change_email['message']);
1924
+			$email_change_email['message'] = str_replace('###SITENAME###', $blog_name, $email_change_email['message']);
1925
+			$email_change_email['message'] = str_replace('###SITEURL###', home_url(), $email_change_email['message']);
1926 1926
 
1927
-			wp_mail( $email_change_email['to'], sprintf( $email_change_email['subject'], $blog_name ), $email_change_email['message'], $email_change_email['headers'] );
1927
+			wp_mail($email_change_email['to'], sprintf($email_change_email['subject'], $blog_name), $email_change_email['message'], $email_change_email['headers']);
1928 1928
 		}
1929 1929
 
1930
-		if ( $switched_locale ) {
1930
+		if ($switched_locale) {
1931 1931
 			restore_previous_locale();
1932 1932
 		}
1933 1933
 	}
1934 1934
 
1935 1935
 	// Update the cookies if the password changed.
1936 1936
 	$current_user = wp_get_current_user();
1937
-	if ( $current_user->ID == $ID ) {
1938
-		if ( isset($plaintext_pass) ) {
1937
+	if ($current_user->ID == $ID) {
1938
+		if (isset($plaintext_pass)) {
1939 1939
 			wp_clear_auth_cookie();
1940 1940
 
1941 1941
 			// Here we calculate the expiration length of the current auth cookie and compare it to the default expiration.
1942 1942
 			// If it's greater than this, then we know the user checked 'Remember Me' when they logged in.
1943
-			$logged_in_cookie    = wp_parse_auth_cookie( '', 'logged_in' );
1943
+			$logged_in_cookie    = wp_parse_auth_cookie('', 'logged_in');
1944 1944
 			/** This filter is documented in wp-includes/pluggable.php */
1945
-			$default_cookie_life = apply_filters( 'auth_cookie_expiration', ( 2 * DAY_IN_SECONDS ), $ID, false );
1946
-			$remember            = ( ( $logged_in_cookie['expiration'] - time() ) > $default_cookie_life );
1945
+			$default_cookie_life = apply_filters('auth_cookie_expiration', (2 * DAY_IN_SECONDS), $ID, false);
1946
+			$remember            = (($logged_in_cookie['expiration'] - time()) > $default_cookie_life);
1947 1947
 
1948
-			wp_set_auth_cookie( $ID, $remember );
1948
+			wp_set_auth_cookie($ID, $remember);
1949 1949
 		}
1950 1950
 	}
1951 1951
 
@@ -1968,8 +1968,8 @@  discard block
 block discarded – undo
1968 1968
  *                      be created.
1969 1969
  */
1970 1970
 function wp_create_user($username, $password, $email = '') {
1971
-	$user_login = wp_slash( $username );
1972
-	$user_email = wp_slash( $email    );
1971
+	$user_login = wp_slash($username);
1972
+	$user_email = wp_slash($email);
1973 1973
 	$user_pass = $password;
1974 1974
 
1975 1975
 	$userdata = compact('user_login', 'user_email', 'user_pass');
@@ -1988,9 +1988,9 @@  discard block
 block discarded – undo
1988 1988
  * @param WP_User $user WP_User instance.
1989 1989
  * @return array List of user keys to be populated in wp_update_user().
1990 1990
  */
1991
-function _get_additional_user_keys( $user ) {
1992
-	$keys = array( 'first_name', 'last_name', 'nickname', 'description', 'rich_editing', 'comment_shortcuts', 'admin_color', 'use_ssl', 'show_admin_bar_front', 'locale' );
1993
-	return array_merge( $keys, array_keys( wp_get_user_contact_methods( $user ) ) );
1991
+function _get_additional_user_keys($user) {
1992
+	$keys = array('first_name', 'last_name', 'nickname', 'description', 'rich_editing', 'comment_shortcuts', 'admin_color', 'use_ssl', 'show_admin_bar_front', 'locale');
1993
+	return array_merge($keys, array_keys(wp_get_user_contact_methods($user)));
1994 1994
 }
1995 1995
 
1996 1996
 /**
@@ -2003,13 +2003,13 @@  discard block
 block discarded – undo
2003 2003
  * @param WP_User $user Optional. WP_User object.
2004 2004
  * @return array Array of contact methods and their labels.
2005 2005
  */
2006
-function wp_get_user_contact_methods( $user = null ) {
2006
+function wp_get_user_contact_methods($user = null) {
2007 2007
 	$methods = array();
2008
-	if ( get_site_option( 'initial_db_version' ) < 23588 ) {
2008
+	if (get_site_option('initial_db_version') < 23588) {
2009 2009
 		$methods = array(
2010
-			'aim'    => __( 'AIM' ),
2011
-			'yim'    => __( 'Yahoo IM' ),
2012
-			'jabber' => __( 'Jabber / Google Talk' )
2010
+			'aim'    => __('AIM'),
2011
+			'yim'    => __('Yahoo IM'),
2012
+			'jabber' => __('Jabber / Google Talk')
2013 2013
 		);
2014 2014
 	}
2015 2015
 
@@ -2021,7 +2021,7 @@  discard block
 block discarded – undo
2021 2021
 	 * @param array   $methods Array of contact methods and their labels.
2022 2022
  	 * @param WP_User $user    WP_User object.
2023 2023
 	 */
2024
-	return apply_filters( 'user_contactmethods', $methods, $user );
2024
+	return apply_filters('user_contactmethods', $methods, $user);
2025 2025
 }
2026 2026
 
2027 2027
 /**
@@ -2035,8 +2035,8 @@  discard block
 block discarded – undo
2035 2035
  * @param WP_User $user Optional. WP_User object. Default null.
2036 2036
  * @return array Array of contact methods and their labels.
2037 2037
  */
2038
-function _wp_get_user_contactmethods( $user = null ) {
2039
-	return wp_get_user_contact_methods( $user );
2038
+function _wp_get_user_contactmethods($user = null) {
2039
+	return wp_get_user_contact_methods($user);
2040 2040
 }
2041 2041
 
2042 2042
 /**
@@ -2047,7 +2047,7 @@  discard block
 block discarded – undo
2047 2047
  * @return string The password hint text.
2048 2048
  */
2049 2049
 function wp_get_password_hint() {
2050
-	$hint = __( 'Hint: The password should be at least twelve characters long. To make it stronger, use upper and lower case letters, numbers, and symbols like ! " ? $ % ^ &amp; ).' );
2050
+	$hint = __('Hint: The password should be at least twelve characters long. To make it stronger, use upper and lower case letters, numbers, and symbols like ! " ? $ % ^ &amp; ).');
2051 2051
 
2052 2052
 	/**
2053 2053
 	 * Filters the text describing the site's password complexity policy.
@@ -2056,7 +2056,7 @@  discard block
 block discarded – undo
2056 2056
 	 *
2057 2057
 	 * @param string $hint The password hint text.
2058 2058
 	 */
2059
-	return apply_filters( 'password_hint', $hint );
2059
+	return apply_filters('password_hint', $hint);
2060 2060
 }
2061 2061
 
2062 2062
 /**
@@ -2071,7 +2071,7 @@  discard block
 block discarded – undo
2071 2071
  *
2072 2072
  * @return string|WP_Error Password reset key on success. WP_Error on error.
2073 2073
  */
2074
-function get_password_reset_key( $user ) {
2074
+function get_password_reset_key($user) {
2075 2075
 	global $wpdb, $wp_hasher;
2076 2076
 
2077 2077
 	/**
@@ -2084,7 +2084,7 @@  discard block
 block discarded – undo
2084 2084
 	 *
2085 2085
 	 * @param string $user_login The user login name.
2086 2086
 	 */
2087
-	do_action( 'retreive_password', $user->user_login );
2087
+	do_action('retreive_password', $user->user_login);
2088 2088
 
2089 2089
 	/**
2090 2090
 	 * Fires before a new password is retrieved.
@@ -2093,10 +2093,10 @@  discard block
 block discarded – undo
2093 2093
 	 *
2094 2094
 	 * @param string $user_login The user login name.
2095 2095
 	 */
2096
-	do_action( 'retrieve_password', $user->user_login );
2096
+	do_action('retrieve_password', $user->user_login);
2097 2097
 
2098 2098
 	$allow = true;
2099
-	if ( is_multisite() && is_user_spammy( $user ) ) {
2099
+	if (is_multisite() && is_user_spammy($user)) {
2100 2100
 		$allow = false;
2101 2101
 	}
2102 2102
 
@@ -2108,16 +2108,16 @@  discard block
 block discarded – undo
2108 2108
 	 * @param bool $allow         Whether to allow the password to be reset. Default true.
2109 2109
 	 * @param int  $user_data->ID The ID of the user attempting to reset a password.
2110 2110
 	 */
2111
-	$allow = apply_filters( 'allow_password_reset', $allow, $user->ID );
2111
+	$allow = apply_filters('allow_password_reset', $allow, $user->ID);
2112 2112
 
2113
-	if ( ! $allow ) {
2114
-		return new WP_Error( 'no_password_reset', __( 'Password reset is not allowed for this user' ) );
2115
-	} elseif ( is_wp_error( $allow ) ) {
2113
+	if ( ! $allow) {
2114
+		return new WP_Error('no_password_reset', __('Password reset is not allowed for this user'));
2115
+	} elseif (is_wp_error($allow)) {
2116 2116
 		return $allow;
2117 2117
 	}
2118 2118
 
2119 2119
 	// Generate something random for a password reset key.
2120
-	$key = wp_generate_password( 20, false );
2120
+	$key = wp_generate_password(20, false);
2121 2121
 
2122 2122
 	/**
2123 2123
 	 * Fires when a password reset key is generated.
@@ -2127,17 +2127,17 @@  discard block
 block discarded – undo
2127 2127
 	 * @param string $user_login The username for the user.
2128 2128
 	 * @param string $key        The generated password reset key.
2129 2129
 	 */
2130
-	do_action( 'retrieve_password_key', $user->user_login, $key );
2130
+	do_action('retrieve_password_key', $user->user_login, $key);
2131 2131
 
2132 2132
 	// Now insert the key, hashed, into the DB.
2133
-	if ( empty( $wp_hasher ) ) {
2134
-		require_once ABSPATH . WPINC . '/class-phpass.php';
2135
-		$wp_hasher = new PasswordHash( 8, true );
2133
+	if (empty($wp_hasher)) {
2134
+		require_once ABSPATH.WPINC.'/class-phpass.php';
2135
+		$wp_hasher = new PasswordHash(8, true);
2136 2136
 	}
2137
-	$hashed = time() . ':' . $wp_hasher->HashPassword( $key );
2138
-	$key_saved = $wpdb->update( $wpdb->users, array( 'user_activation_key' => $hashed ), array( 'user_login' => $user->user_login ) );
2139
-	if ( false === $key_saved ) {
2140
-		return new WP_Error( 'no_password_key_update', __( 'Could not save password reset key to database.' ) );
2137
+	$hashed = time().':'.$wp_hasher->HashPassword($key);
2138
+	$key_saved = $wpdb->update($wpdb->users, array('user_activation_key' => $hashed), array('user_login' => $user->user_login));
2139
+	if (false === $key_saved) {
2140
+		return new WP_Error('no_password_key_update', __('Could not save password reset key to database.'));
2141 2141
 	}
2142 2142
 
2143 2143
 	return $key;
@@ -2165,19 +2165,19 @@  discard block
 block discarded – undo
2165 2165
 
2166 2166
 	$key = preg_replace('/[^a-z0-9]/i', '', $key);
2167 2167
 
2168
-	if ( empty( $key ) || !is_string( $key ) )
2168
+	if (empty($key) || ! is_string($key))
2169 2169
 		return new WP_Error('invalid_key', __('Invalid key'));
2170 2170
 
2171
-	if ( empty($login) || !is_string($login) )
2171
+	if (empty($login) || ! is_string($login))
2172 2172
 		return new WP_Error('invalid_key', __('Invalid key'));
2173 2173
 
2174
-	$row = $wpdb->get_row( $wpdb->prepare( "SELECT ID, user_activation_key FROM $wpdb->users WHERE user_login = %s", $login ) );
2175
-	if ( ! $row )
2174
+	$row = $wpdb->get_row($wpdb->prepare("SELECT ID, user_activation_key FROM $wpdb->users WHERE user_login = %s", $login));
2175
+	if ( ! $row)
2176 2176
 		return new WP_Error('invalid_key', __('Invalid key'));
2177 2177
 
2178
-	if ( empty( $wp_hasher ) ) {
2179
-		require_once ABSPATH . WPINC . '/class-phpass.php';
2180
-		$wp_hasher = new PasswordHash( 8, true );
2178
+	if (empty($wp_hasher)) {
2179
+		require_once ABSPATH.WPINC.'/class-phpass.php';
2180
+		$wp_hasher = new PasswordHash(8, true);
2181 2181
 	}
2182 2182
 
2183 2183
 	/**
@@ -2187,31 +2187,31 @@  discard block
 block discarded – undo
2187 2187
 	 *
2188 2188
 	 * @param int $expiration The expiration time in seconds.
2189 2189
 	 */
2190
-	$expiration_duration = apply_filters( 'password_reset_expiration', DAY_IN_SECONDS );
2190
+	$expiration_duration = apply_filters('password_reset_expiration', DAY_IN_SECONDS);
2191 2191
 
2192
-	if ( false !== strpos( $row->user_activation_key, ':' ) ) {
2193
-		list( $pass_request_time, $pass_key ) = explode( ':', $row->user_activation_key, 2 );
2192
+	if (false !== strpos($row->user_activation_key, ':')) {
2193
+		list($pass_request_time, $pass_key) = explode(':', $row->user_activation_key, 2);
2194 2194
 		$expiration_time = $pass_request_time + $expiration_duration;
2195 2195
 	} else {
2196 2196
 		$pass_key = $row->user_activation_key;
2197 2197
 		$expiration_time = false;
2198 2198
 	}
2199 2199
 
2200
-	if ( ! $pass_key ) {
2201
-		return new WP_Error( 'invalid_key', __( 'Invalid key' ) );
2200
+	if ( ! $pass_key) {
2201
+		return new WP_Error('invalid_key', __('Invalid key'));
2202 2202
 	}
2203 2203
 
2204
-	$hash_is_correct = $wp_hasher->CheckPassword( $key, $pass_key );
2204
+	$hash_is_correct = $wp_hasher->CheckPassword($key, $pass_key);
2205 2205
 
2206
-	if ( $hash_is_correct && $expiration_time && time() < $expiration_time ) {
2207
-		return get_userdata( $row->ID );
2208
-	} elseif ( $hash_is_correct && $expiration_time ) {
2206
+	if ($hash_is_correct && $expiration_time && time() < $expiration_time) {
2207
+		return get_userdata($row->ID);
2208
+	} elseif ($hash_is_correct && $expiration_time) {
2209 2209
 		// Key has an expiration time that's passed
2210
-		return new WP_Error( 'expired_key', __( 'Invalid key' ) );
2210
+		return new WP_Error('expired_key', __('Invalid key'));
2211 2211
 	}
2212 2212
 
2213
-	if ( hash_equals( $row->user_activation_key, $key ) || ( $hash_is_correct && ! $expiration_time ) ) {
2214
-		$return = new WP_Error( 'expired_key', __( 'Invalid key' ) );
2213
+	if (hash_equals($row->user_activation_key, $key) || ($hash_is_correct && ! $expiration_time)) {
2214
+		$return = new WP_Error('expired_key', __('Invalid key'));
2215 2215
 		$user_id = $row->ID;
2216 2216
 
2217 2217
 		/**
@@ -2225,10 +2225,10 @@  discard block
 block discarded – undo
2225 2225
 		 *                          Return a WP_User object to validate the key.
2226 2226
 		 * @param int      $user_id The matched user ID.
2227 2227
 		 */
2228
-		return apply_filters( 'password_reset_key_expired', $return, $user_id );
2228
+		return apply_filters('password_reset_key_expired', $return, $user_id);
2229 2229
 	}
2230 2230
 
2231
-	return new WP_Error( 'invalid_key', __( 'Invalid key' ) );
2231
+	return new WP_Error('invalid_key', __('Invalid key'));
2232 2232
 }
2233 2233
 
2234 2234
 /**
@@ -2239,7 +2239,7 @@  discard block
 block discarded – undo
2239 2239
  * @param object $user     The user
2240 2240
  * @param string $new_pass New password for the user in plaintext
2241 2241
  */
2242
-function reset_password( $user, $new_pass ) {
2242
+function reset_password($user, $new_pass) {
2243 2243
 	/**
2244 2244
 	 * Fires before the user's password is reset.
2245 2245
 	 *
@@ -2248,10 +2248,10 @@  discard block
 block discarded – undo
2248 2248
 	 * @param object $user     The user.
2249 2249
 	 * @param string $new_pass New user password.
2250 2250
 	 */
2251
-	do_action( 'password_reset', $user, $new_pass );
2251
+	do_action('password_reset', $user, $new_pass);
2252 2252
 
2253
-	wp_set_password( $new_pass, $user->ID );
2254
-	update_user_option( $user->ID, 'default_password_nag', false, true );
2253
+	wp_set_password($new_pass, $user->ID);
2254
+	update_user_option($user->ID, 'default_password_nag', false, true);
2255 2255
 
2256 2256
 	/**
2257 2257
 	 * Fires after the user's password is reset.
@@ -2261,7 +2261,7 @@  discard block
 block discarded – undo
2261 2261
 	 * @param object $user     The user.
2262 2262
 	 * @param string $new_pass New user password.
2263 2263
 	 */
2264
-	do_action( 'after_password_reset', $user, $new_pass );
2264
+	do_action('after_password_reset', $user, $new_pass);
2265 2265
 }
2266 2266
 
2267 2267
 /**
@@ -2273,10 +2273,10 @@  discard block
 block discarded – undo
2273 2273
  * @param string $user_email User's email address to send password and add
2274 2274
  * @return int|WP_Error Either user's ID or error on failure.
2275 2275
  */
2276
-function register_new_user( $user_login, $user_email ) {
2276
+function register_new_user($user_login, $user_email) {
2277 2277
 	$errors = new WP_Error();
2278 2278
 
2279
-	$sanitized_user_login = sanitize_user( $user_login );
2279
+	$sanitized_user_login = sanitize_user($user_login);
2280 2280
 	/**
2281 2281
 	 * Filters the email address of a user being registered.
2282 2282
 	 *
@@ -2284,33 +2284,33 @@  discard block
 block discarded – undo
2284 2284
 	 *
2285 2285
 	 * @param string $user_email The email address of the new user.
2286 2286
 	 */
2287
-	$user_email = apply_filters( 'user_registration_email', $user_email );
2287
+	$user_email = apply_filters('user_registration_email', $user_email);
2288 2288
 
2289 2289
 	// Check the username
2290
-	if ( $sanitized_user_login == '' ) {
2291
-		$errors->add( 'empty_username', __( '<strong>ERROR</strong>: Please enter a username.' ) );
2292
-	} elseif ( ! validate_username( $user_login ) ) {
2293
-		$errors->add( 'invalid_username', __( '<strong>ERROR</strong>: This username is invalid because it uses illegal characters. Please enter a valid username.' ) );
2290
+	if ($sanitized_user_login == '') {
2291
+		$errors->add('empty_username', __('<strong>ERROR</strong>: Please enter a username.'));
2292
+	} elseif ( ! validate_username($user_login)) {
2293
+		$errors->add('invalid_username', __('<strong>ERROR</strong>: This username is invalid because it uses illegal characters. Please enter a valid username.'));
2294 2294
 		$sanitized_user_login = '';
2295
-	} elseif ( username_exists( $sanitized_user_login ) ) {
2296
-		$errors->add( 'username_exists', __( '<strong>ERROR</strong>: This username is already registered. Please choose another one.' ) );
2295
+	} elseif (username_exists($sanitized_user_login)) {
2296
+		$errors->add('username_exists', __('<strong>ERROR</strong>: This username is already registered. Please choose another one.'));
2297 2297
 
2298 2298
 	} else {
2299 2299
 		/** This filter is documented in wp-includes/user.php */
2300
-		$illegal_user_logins = array_map( 'strtolower', (array) apply_filters( 'illegal_user_logins', array() ) );
2301
-		if ( in_array( strtolower( $sanitized_user_login ), $illegal_user_logins ) ) {
2302
-			$errors->add( 'invalid_username', __( '<strong>ERROR</strong>: Sorry, that username is not allowed.' ) );
2300
+		$illegal_user_logins = array_map('strtolower', (array) apply_filters('illegal_user_logins', array()));
2301
+		if (in_array(strtolower($sanitized_user_login), $illegal_user_logins)) {
2302
+			$errors->add('invalid_username', __('<strong>ERROR</strong>: Sorry, that username is not allowed.'));
2303 2303
 		}
2304 2304
 	}
2305 2305
 
2306 2306
 	// Check the email address
2307
-	if ( $user_email == '' ) {
2308
-		$errors->add( 'empty_email', __( '<strong>ERROR</strong>: Please type your email address.' ) );
2309
-	} elseif ( ! is_email( $user_email ) ) {
2310
-		$errors->add( 'invalid_email', __( '<strong>ERROR</strong>: The email address isn&#8217;t correct.' ) );
2307
+	if ($user_email == '') {
2308
+		$errors->add('empty_email', __('<strong>ERROR</strong>: Please type your email address.'));
2309
+	} elseif ( ! is_email($user_email)) {
2310
+		$errors->add('invalid_email', __('<strong>ERROR</strong>: The email address isn&#8217;t correct.'));
2311 2311
 		$user_email = '';
2312
-	} elseif ( email_exists( $user_email ) ) {
2313
-		$errors->add( 'email_exists', __( '<strong>ERROR</strong>: This email is already registered, please choose another one.' ) );
2312
+	} elseif (email_exists($user_email)) {
2313
+		$errors->add('email_exists', __('<strong>ERROR</strong>: This email is already registered, please choose another one.'));
2314 2314
 	}
2315 2315
 
2316 2316
 	/**
@@ -2324,7 +2324,7 @@  discard block
 block discarded – undo
2324 2324
 	 *                                       e.g., an empty field, an invalid username or email,
2325 2325
 	 *                                       or an existing username or email.
2326 2326
 	 */
2327
-	do_action( 'register_post', $sanitized_user_login, $user_email, $errors );
2327
+	do_action('register_post', $sanitized_user_login, $user_email, $errors);
2328 2328
 
2329 2329
 	/**
2330 2330
 	 * Filters the errors encountered when a new user is being registered.
@@ -2342,19 +2342,19 @@  discard block
 block discarded – undo
2342 2342
 	 * @param string   $sanitized_user_login User's username after it has been sanitized.
2343 2343
 	 * @param string   $user_email           User's email.
2344 2344
 	 */
2345
-	$errors = apply_filters( 'registration_errors', $errors, $sanitized_user_login, $user_email );
2345
+	$errors = apply_filters('registration_errors', $errors, $sanitized_user_login, $user_email);
2346 2346
 
2347
-	if ( $errors->get_error_code() )
2347
+	if ($errors->get_error_code())
2348 2348
 		return $errors;
2349 2349
 
2350
-	$user_pass = wp_generate_password( 12, false );
2351
-	$user_id = wp_create_user( $sanitized_user_login, $user_pass, $user_email );
2352
-	if ( ! $user_id || is_wp_error( $user_id ) ) {
2353
-		$errors->add( 'registerfail', sprintf( __( '<strong>ERROR</strong>: Couldn&#8217;t register you&hellip; please contact the <a href="mailto:%s">webmaster</a> !' ), get_option( 'admin_email' ) ) );
2350
+	$user_pass = wp_generate_password(12, false);
2351
+	$user_id = wp_create_user($sanitized_user_login, $user_pass, $user_email);
2352
+	if ( ! $user_id || is_wp_error($user_id)) {
2353
+		$errors->add('registerfail', sprintf(__('<strong>ERROR</strong>: Couldn&#8217;t register you&hellip; please contact the <a href="mailto:%s">webmaster</a> !'), get_option('admin_email')));
2354 2354
 		return $errors;
2355 2355
 	}
2356 2356
 
2357
-	update_user_option( $user_id, 'default_password_nag', true, true ); //Set up the Password change nag.
2357
+	update_user_option($user_id, 'default_password_nag', true, true); //Set up the Password change nag.
2358 2358
 
2359 2359
 	/**
2360 2360
 	 * Fires after a new user registration has been recorded.
@@ -2363,7 +2363,7 @@  discard block
 block discarded – undo
2363 2363
 	 *
2364 2364
 	 * @param int $user_id ID of the newly registered user.
2365 2365
 	 */
2366
-	do_action( 'register_new_user', $user_id );
2366
+	do_action('register_new_user', $user_id);
2367 2367
 
2368 2368
 	return $user_id;
2369 2369
 }
@@ -2382,8 +2382,8 @@  discard block
 block discarded – undo
2382 2382
  *                        or an empty string (admin only), 'user', or 'both' (admin and user).
2383 2383
  *                        Default 'both'.
2384 2384
  */
2385
-function wp_send_new_user_notifications( $user_id, $notify = 'both' ) {
2386
-	wp_new_user_notification( $user_id, null, $notify );
2385
+function wp_send_new_user_notifications($user_id, $notify = 'both') {
2386
+	wp_new_user_notification($user_id, null, $notify);
2387 2387
 }
2388 2388
 
2389 2389
 /**
@@ -2394,8 +2394,8 @@  discard block
 block discarded – undo
2394 2394
  * @return string Token.
2395 2395
  */
2396 2396
 function wp_get_session_token() {
2397
-	$cookie = wp_parse_auth_cookie( '', 'logged_in' );
2398
-	return ! empty( $cookie['token'] ) ? $cookie['token'] : '';
2397
+	$cookie = wp_parse_auth_cookie('', 'logged_in');
2398
+	return ! empty($cookie['token']) ? $cookie['token'] : '';
2399 2399
 }
2400 2400
 
2401 2401
 /**
@@ -2405,7 +2405,7 @@  discard block
 block discarded – undo
2405 2405
  * @return array Array of sessions.
2406 2406
  */
2407 2407
 function wp_get_all_sessions() {
2408
-	$manager = WP_Session_Tokens::get_instance( get_current_user_id() );
2408
+	$manager = WP_Session_Tokens::get_instance(get_current_user_id());
2409 2409
 	return $manager->get_all();
2410 2410
 }
2411 2411
 
@@ -2416,9 +2416,9 @@  discard block
 block discarded – undo
2416 2416
  */
2417 2417
 function wp_destroy_current_session() {
2418 2418
 	$token = wp_get_session_token();
2419
-	if ( $token ) {
2420
-		$manager = WP_Session_Tokens::get_instance( get_current_user_id() );
2421
-		$manager->destroy( $token );
2419
+	if ($token) {
2420
+		$manager = WP_Session_Tokens::get_instance(get_current_user_id());
2421
+		$manager->destroy($token);
2422 2422
 	}
2423 2423
 }
2424 2424
 
@@ -2429,9 +2429,9 @@  discard block
 block discarded – undo
2429 2429
  */
2430 2430
 function wp_destroy_other_sessions() {
2431 2431
 	$token = wp_get_session_token();
2432
-	if ( $token ) {
2433
-		$manager = WP_Session_Tokens::get_instance( get_current_user_id() );
2434
-		$manager->destroy_others( $token );
2432
+	if ($token) {
2433
+		$manager = WP_Session_Tokens::get_instance(get_current_user_id());
2434
+		$manager->destroy_others($token);
2435 2435
 	}
2436 2436
 }
2437 2437
 
@@ -2441,7 +2441,7 @@  discard block
 block discarded – undo
2441 2441
  * @since 4.0.0
2442 2442
  */
2443 2443
 function wp_destroy_all_sessions() {
2444
-	$manager = WP_Session_Tokens::get_instance( get_current_user_id() );
2444
+	$manager = WP_Session_Tokens::get_instance(get_current_user_id());
2445 2445
 	$manager->destroy_all();
2446 2446
 }
2447 2447
 
@@ -2457,19 +2457,19 @@  discard block
 block discarded – undo
2457 2457
 function wp_get_users_with_no_role() {
2458 2458
 	global $wpdb;
2459 2459
 
2460
-	if ( is_multisite() ) {
2460
+	if (is_multisite()) {
2461 2461
 		return array();
2462 2462
 	}
2463 2463
 
2464 2464
 	$prefix = $wpdb->get_blog_prefix();
2465
-	$regex  = implode( '|', array_keys( wp_roles()->get_names() ) );
2466
-	$regex  = preg_replace( '/[^a-zA-Z_\|-]/', '', $regex );
2467
-	$users  = $wpdb->get_col( $wpdb->prepare( "
2465
+	$regex  = implode('|', array_keys(wp_roles()->get_names()));
2466
+	$regex  = preg_replace('/[^a-zA-Z_\|-]/', '', $regex);
2467
+	$users  = $wpdb->get_col($wpdb->prepare("
2468 2468
 		SELECT user_id
2469 2469
 		FROM $wpdb->usermeta
2470 2470
 		WHERE meta_key = '{$prefix}capabilities'
2471 2471
 		AND meta_value NOT REGEXP %s
2472
-	", $regex ) );
2472
+	", $regex));
2473 2473
 
2474 2474
 	return $users;
2475 2475
 }
@@ -2496,27 +2496,27 @@  discard block
 block discarded – undo
2496 2496
 function _wp_get_current_user() {
2497 2497
 	global $current_user;
2498 2498
 
2499
-	if ( ! empty( $current_user ) ) {
2500
-		if ( $current_user instanceof WP_User ) {
2499
+	if ( ! empty($current_user)) {
2500
+		if ($current_user instanceof WP_User) {
2501 2501
 			return $current_user;
2502 2502
 		}
2503 2503
 
2504 2504
 		// Upgrade stdClass to WP_User
2505
-		if ( is_object( $current_user ) && isset( $current_user->ID ) ) {
2505
+		if (is_object($current_user) && isset($current_user->ID)) {
2506 2506
 			$cur_id = $current_user->ID;
2507 2507
 			$current_user = null;
2508
-			wp_set_current_user( $cur_id );
2508
+			wp_set_current_user($cur_id);
2509 2509
 			return $current_user;
2510 2510
 		}
2511 2511
 
2512 2512
 		// $current_user has a junk value. Force to WP_User with ID 0.
2513 2513
 		$current_user = null;
2514
-		wp_set_current_user( 0 );
2514
+		wp_set_current_user(0);
2515 2515
 		return $current_user;
2516 2516
 	}
2517 2517
 
2518
-	if ( defined('XMLRPC_REQUEST') && XMLRPC_REQUEST ) {
2519
-		wp_set_current_user( 0 );
2518
+	if (defined('XMLRPC_REQUEST') && XMLRPC_REQUEST) {
2519
+		wp_set_current_user(0);
2520 2520
 		return $current_user;
2521 2521
 	}
2522 2522
 
@@ -2533,13 +2533,13 @@  discard block
 block discarded – undo
2533 2533
 	 *
2534 2534
 	 * @param int|bool $user_id User ID if one has been determined, false otherwise.
2535 2535
 	 */
2536
-	$user_id = apply_filters( 'determine_current_user', false );
2537
-	if ( ! $user_id ) {
2538
-		wp_set_current_user( 0 );
2536
+	$user_id = apply_filters('determine_current_user', false);
2537
+	if ( ! $user_id) {
2538
+		wp_set_current_user(0);
2539 2539
 		return $current_user;
2540 2540
 	}
2541 2541
 
2542
-	wp_set_current_user( $user_id );
2542
+	wp_set_current_user($user_id);
2543 2543
 
2544 2544
 	return $current_user;
2545 2545
 }
Please login to merge, or discard this patch.
Braces   +132 added lines, -88 removed lines patch added patch discarded remove patch
@@ -29,18 +29,22 @@  discard block
 block discarded – undo
29 29
 	if ( empty($credentials) ) {
30 30
 		$credentials = array(); // Back-compat for plugins passing an empty string.
31 31
 
32
-		if ( ! empty($_POST['log']) )
33
-			$credentials['user_login'] = $_POST['log'];
34
-		if ( ! empty($_POST['pwd']) )
35
-			$credentials['user_password'] = $_POST['pwd'];
36
-		if ( ! empty($_POST['rememberme']) )
37
-			$credentials['remember'] = $_POST['rememberme'];
32
+		if ( ! empty($_POST['log']) ) {
33
+					$credentials['user_login'] = $_POST['log'];
34
+		}
35
+		if ( ! empty($_POST['pwd']) ) {
36
+					$credentials['user_password'] = $_POST['pwd'];
37
+		}
38
+		if ( ! empty($_POST['rememberme']) ) {
39
+					$credentials['remember'] = $_POST['rememberme'];
40
+		}
38 41
 	}
39 42
 
40
-	if ( !empty($credentials['remember']) )
41
-		$credentials['remember'] = true;
42
-	else
43
-		$credentials['remember'] = false;
43
+	if ( !empty($credentials['remember']) ) {
44
+			$credentials['remember'] = true;
45
+	} else {
46
+			$credentials['remember'] = false;
47
+	}
44 48
 
45 49
 	/**
46 50
 	 * Fires before the user is authenticated.
@@ -57,8 +61,9 @@  discard block
 block discarded – undo
57 61
 	 */
58 62
 	do_action_ref_array( 'wp_authenticate', array( &$credentials['user_login'], &$credentials['user_password'] ) );
59 63
 
60
-	if ( '' === $secure_cookie )
61
-		$secure_cookie = is_ssl();
64
+	if ( '' === $secure_cookie ) {
65
+			$secure_cookie = is_ssl();
66
+	}
62 67
 
63 68
 	/**
64 69
 	 * Filters whether to use a secure sign-on cookie.
@@ -121,16 +126,19 @@  discard block
 block discarded – undo
121 126
 	}
122 127
 
123 128
 	if ( empty($username) || empty($password) ) {
124
-		if ( is_wp_error( $user ) )
125
-			return $user;
129
+		if ( is_wp_error( $user ) ) {
130
+					return $user;
131
+		}
126 132
 
127 133
 		$error = new WP_Error();
128 134
 
129
-		if ( empty($username) )
130
-			$error->add('empty_username', __('<strong>ERROR</strong>: The username field is empty.'));
135
+		if ( empty($username) ) {
136
+					$error->add('empty_username', __('<strong>ERROR</strong>: The username field is empty.'));
137
+		}
131 138
 
132
-		if ( empty($password) )
133
-			$error->add('empty_password', __('<strong>ERROR</strong>: The password field is empty.'));
139
+		if ( empty($password) ) {
140
+					$error->add('empty_password', __('<strong>ERROR</strong>: The password field is empty.'));
141
+		}
134 142
 
135 143
 		return $error;
136 144
 	}
@@ -156,8 +164,9 @@  discard block
 block discarded – undo
156 164
 	 * @param string           $password Password to check against the user.
157 165
 	 */
158 166
 	$user = apply_filters( 'wp_authenticate_user', $user, $password );
159
-	if ( is_wp_error($user) )
160
-		return $user;
167
+	if ( is_wp_error($user) ) {
168
+			return $user;
169
+	}
161 170
 
162 171
 	if ( ! wp_check_password( $password, $user->user_pass, $user->ID ) ) {
163 172
 		return new WP_Error( 'incorrect_password',
@@ -266,18 +275,21 @@  discard block
 block discarded – undo
266 275
 
267 276
 	if ( empty($username) && empty($password) ) {
268 277
 		$user_id = wp_validate_auth_cookie();
269
-		if ( $user_id )
270
-			return new WP_User($user_id);
278
+		if ( $user_id ) {
279
+					return new WP_User($user_id);
280
+		}
271 281
 
272 282
 		global $auth_secure_cookie;
273 283
 
274
-		if ( $auth_secure_cookie )
275
-			$auth_cookie = SECURE_AUTH_COOKIE;
276
-		else
277
-			$auth_cookie = AUTH_COOKIE;
284
+		if ( $auth_secure_cookie ) {
285
+					$auth_cookie = SECURE_AUTH_COOKIE;
286
+		} else {
287
+					$auth_cookie = AUTH_COOKIE;
288
+		}
278 289
 
279
-		if ( !empty($_COOKIE[$auth_cookie]) )
280
-			return new WP_Error('expired_session', __('Please log in again.'));
290
+		if ( !empty($_COOKIE[$auth_cookie]) ) {
291
+					return new WP_Error('expired_session', __('Please log in again.'));
292
+		}
281 293
 
282 294
 		// If the cookie is not set, be silent.
283 295
 	}
@@ -306,8 +318,9 @@  discard block
 block discarded – undo
306 318
 		 */
307 319
 		$spammed = apply_filters( 'check_is_user_spammed', is_user_spammy( $user ), $user );
308 320
 
309
-		if ( $spammed )
310
-			return new WP_Error( 'spammer_account', __( '<strong>ERROR</strong>: Your account has been marked as a spammer.' ) );
321
+		if ( $spammed ) {
322
+					return new WP_Error( 'spammer_account', __( '<strong>ERROR</strong>: Your account has been marked as a spammer.' ) );
323
+		}
311 324
 	}
312 325
 	return $user;
313 326
 }
@@ -392,8 +405,9 @@  discard block
 block discarded – undo
392 405
 	global $wpdb;
393 406
 
394 407
 	$count = array();
395
-	if ( empty( $users ) || ! is_array( $users ) )
396
-		return $count;
408
+	if ( empty( $users ) || ! is_array( $users ) ) {
409
+			return $count;
410
+	}
397 411
 
398 412
 	$userlist = implode( ',', array_map( 'absint', $users ) );
399 413
 	$where = get_posts_by_author_sql( $post_type, true, null, $public_only );
@@ -404,8 +418,9 @@  discard block
 block discarded – undo
404 418
 	}
405 419
 
406 420
 	foreach ( $users as $id ) {
407
-		if ( ! isset( $count[ $id ] ) )
408
-			$count[ $id ] = 0;
421
+		if ( ! isset( $count[ $id ] ) ) {
422
+					$count[ $id ] = 0;
423
+		}
409 424
 	}
410 425
 
411 426
 	return $count;
@@ -423,8 +438,9 @@  discard block
 block discarded – undo
423 438
  * @return int The current user's ID, or 0 if no user is logged in.
424 439
  */
425 440
 function get_current_user_id() {
426
-	if ( ! function_exists( 'wp_get_current_user' ) )
427
-		return 0;
441
+	if ( ! function_exists( 'wp_get_current_user' ) ) {
442
+			return 0;
443
+	}
428 444
 	$user = wp_get_current_user();
429 445
 	return ( isset( $user->ID ) ? (int) $user->ID : 0 );
430 446
 }
@@ -451,22 +467,28 @@  discard block
 block discarded – undo
451 467
 function get_user_option( $option, $user = 0, $deprecated = '' ) {
452 468
 	global $wpdb;
453 469
 
454
-	if ( !empty( $deprecated ) )
455
-		_deprecated_argument( __FUNCTION__, '3.0.0' );
470
+	if ( !empty( $deprecated ) ) {
471
+			_deprecated_argument( __FUNCTION__, '3.0.0' );
472
+	}
456 473
 
457
-	if ( empty( $user ) )
458
-		$user = get_current_user_id();
474
+	if ( empty( $user ) ) {
475
+			$user = get_current_user_id();
476
+	}
459 477
 
460
-	if ( ! $user = get_userdata( $user ) )
461
-		return false;
478
+	if ( ! $user = get_userdata( $user ) ) {
479
+			return false;
480
+	}
462 481
 
463 482
 	$prefix = $wpdb->get_blog_prefix();
464
-	if ( $user->has_prop( $prefix . $option ) ) // Blog specific
483
+	if ( $user->has_prop( $prefix . $option ) ) {
484
+		// Blog specific
465 485
 		$result = $user->get( $prefix . $option );
466
-	elseif ( $user->has_prop( $option ) ) // User specific and cross-blog
486
+	} elseif ( $user->has_prop( $option ) ) {
487
+		// User specific and cross-blog
467 488
 		$result = $user->get( $option );
468
-	else
469
-		$result = false;
489
+	} else {
490
+			$result = false;
491
+	}
470 492
 
471 493
 	/**
472 494
 	 * Filters a specific user option value.
@@ -506,8 +528,9 @@  discard block
 block discarded – undo
506 528
 function update_user_option( $user_id, $option_name, $newvalue, $global = false ) {
507 529
 	global $wpdb;
508 530
 
509
-	if ( !$global )
510
-		$option_name = $wpdb->get_blog_prefix() . $option_name;
531
+	if ( !$global ) {
532
+			$option_name = $wpdb->get_blog_prefix() . $option_name;
533
+	}
511 534
 
512 535
 	return update_user_meta( $user_id, $option_name, $newvalue );
513 536
 }
@@ -532,8 +555,9 @@  discard block
 block discarded – undo
532 555
 function delete_user_option( $user_id, $option_name, $global = false ) {
533 556
 	global $wpdb;
534 557
 
535
-	if ( !$global )
536
-		$option_name = $wpdb->get_blog_prefix() . $option_name;
558
+	if ( !$global ) {
559
+			$option_name = $wpdb->get_blog_prefix() . $option_name;
560
+	}
537 561
 	return delete_user_meta( $user_id, $option_name );
538 562
 }
539 563
 
@@ -578,8 +602,9 @@  discard block
 block discarded – undo
578 602
 	$user_id = (int) $user_id;
579 603
 
580 604
 	// Logged out users can't have sites
581
-	if ( empty( $user_id ) )
582
-		return array();
605
+	if ( empty( $user_id ) ) {
606
+			return array();
607
+	}
583 608
 
584 609
 	/**
585 610
 	 * Filters the list of a user's sites before it is populated.
@@ -601,8 +626,9 @@  discard block
 block discarded – undo
601 626
 	}
602 627
 
603 628
 	$keys = get_user_meta( $user_id );
604
-	if ( empty( $keys ) )
605
-		return array();
629
+	if ( empty( $keys ) ) {
630
+			return array();
631
+	}
606 632
 
607 633
 	if ( ! is_multisite() ) {
608 634
 		$site_id = get_current_blog_id();
@@ -629,13 +655,16 @@  discard block
 block discarded – undo
629 655
 	$keys = array_keys( $keys );
630 656
 
631 657
 	foreach ( $keys as $key ) {
632
-		if ( 'capabilities' !== substr( $key, -12 ) )
633
-			continue;
634
-		if ( $wpdb->base_prefix && 0 !== strpos( $key, $wpdb->base_prefix ) )
635
-			continue;
658
+		if ( 'capabilities' !== substr( $key, -12 ) ) {
659
+					continue;
660
+		}
661
+		if ( $wpdb->base_prefix && 0 !== strpos( $key, $wpdb->base_prefix ) ) {
662
+					continue;
663
+		}
636 664
 		$site_id = str_replace( array( $wpdb->base_prefix, '_capabilities' ), '', $key );
637
-		if ( ! is_numeric( $site_id ) )
638
-			continue;
665
+		if ( ! is_numeric( $site_id ) ) {
666
+					continue;
667
+		}
639 668
 
640 669
 		$site_ids[] = (int) $site_id;
641 670
 	}
@@ -895,8 +924,9 @@  discard block
 block discarded – undo
895 924
 
896 925
 		foreach ( $users_of_blog as $caps_meta ) {
897 926
 			$b_roles = maybe_unserialize($caps_meta);
898
-			if ( ! is_array( $b_roles ) )
899
-				continue;
927
+			if ( ! is_array( $b_roles ) ) {
928
+							continue;
929
+			}
900 930
 			if ( empty( $b_roles ) ) {
901 931
 				$avail_roles['none']++;
902 932
 			}
@@ -944,8 +974,9 @@  discard block
 block discarded – undo
944 974
 function setup_userdata($for_user_id = '') {
945 975
 	global $user_login, $userdata, $user_level, $user_ID, $user_email, $user_url, $user_identity;
946 976
 
947
-	if ( '' == $for_user_id )
948
-		$for_user_id = get_current_user_id();
977
+	if ( '' == $for_user_id ) {
978
+			$for_user_id = get_current_user_id();
979
+	}
949 980
 	$user = get_userdata( $for_user_id );
950 981
 
951 982
 	if ( ! $user ) {
@@ -1159,14 +1190,17 @@  discard block
 block discarded – undo
1159 1190
  */
1160 1191
 function sanitize_user_field($field, $value, $user_id, $context) {
1161 1192
 	$int_fields = array('ID');
1162
-	if ( in_array($field, $int_fields) )
1163
-		$value = (int) $value;
1193
+	if ( in_array($field, $int_fields) ) {
1194
+			$value = (int) $value;
1195
+	}
1164 1196
 
1165
-	if ( 'raw' == $context )
1166
-		return $value;
1197
+	if ( 'raw' == $context ) {
1198
+			return $value;
1199
+	}
1167 1200
 
1168
-	if ( !is_string($value) && !is_numeric($value) )
1169
-		return $value;
1201
+	if ( !is_string($value) && !is_numeric($value) ) {
1202
+			return $value;
1203
+	}
1170 1204
 
1171 1205
 	$prefixed = false !== strpos( $field, 'user_' );
1172 1206
 
@@ -1191,10 +1225,13 @@  discard block
 block discarded – undo
1191 1225
 			$value = apply_filters( "edit_user_{$field}", $value, $user_id );
1192 1226
 		}
1193 1227
 
1194
-		if ( 'description' == $field )
1195
-			$value = esc_html( $value ); // textarea_escaped?
1196
-		else
1197
-			$value = esc_attr($value);
1228
+		if ( 'description' == $field ) {
1229
+					$value = esc_html( $value );
1230
+		}
1231
+		// textarea_escaped?
1232
+		else {
1233
+					$value = esc_attr($value);
1234
+		}
1198 1235
 	} elseif ( 'db' == $context ) {
1199 1236
 		if ( $prefixed ) {
1200 1237
 			/** This filter is documented in wp-includes/post.php */
@@ -1237,8 +1274,9 @@  discard block
 block discarded – undo
1237 1274
 		}
1238 1275
 	}
1239 1276
 
1240
-	if ( 'user_url' == $field )
1241
-		$value = esc_url($value);
1277
+	if ( 'user_url' == $field ) {
1278
+			$value = esc_url($value);
1279
+	}
1242 1280
 
1243 1281
 	if ( 'attribute' == $context ) {
1244 1282
 		$value = esc_attr( $value );
@@ -1280,11 +1318,13 @@  discard block
 block discarded – undo
1280 1318
  * @param WP_User|int $user User object or ID to be cleaned from the cache
1281 1319
  */
1282 1320
 function clean_user_cache( $user ) {
1283
-	if ( is_numeric( $user ) )
1284
-		$user = new WP_User( $user );
1321
+	if ( is_numeric( $user ) ) {
1322
+			$user = new WP_User( $user );
1323
+	}
1285 1324
 
1286
-	if ( ! $user->exists() )
1287
-		return;
1325
+	if ( ! $user->exists() ) {
1326
+			return;
1327
+	}
1288 1328
 
1289 1329
 	wp_cache_delete( $user->ID, 'users' );
1290 1330
 	wp_cache_delete( $user->user_login, 'userlogins' );
@@ -2165,15 +2205,18 @@  discard block
 block discarded – undo
2165 2205
 
2166 2206
 	$key = preg_replace('/[^a-z0-9]/i', '', $key);
2167 2207
 
2168
-	if ( empty( $key ) || !is_string( $key ) )
2169
-		return new WP_Error('invalid_key', __('Invalid key'));
2208
+	if ( empty( $key ) || !is_string( $key ) ) {
2209
+			return new WP_Error('invalid_key', __('Invalid key'));
2210
+	}
2170 2211
 
2171
-	if ( empty($login) || !is_string($login) )
2172
-		return new WP_Error('invalid_key', __('Invalid key'));
2212
+	if ( empty($login) || !is_string($login) ) {
2213
+			return new WP_Error('invalid_key', __('Invalid key'));
2214
+	}
2173 2215
 
2174 2216
 	$row = $wpdb->get_row( $wpdb->prepare( "SELECT ID, user_activation_key FROM $wpdb->users WHERE user_login = %s", $login ) );
2175
-	if ( ! $row )
2176
-		return new WP_Error('invalid_key', __('Invalid key'));
2217
+	if ( ! $row ) {
2218
+			return new WP_Error('invalid_key', __('Invalid key'));
2219
+	}
2177 2220
 
2178 2221
 	if ( empty( $wp_hasher ) ) {
2179 2222
 		require_once ABSPATH . WPINC . '/class-phpass.php';
@@ -2344,8 +2387,9 @@  discard block
 block discarded – undo
2344 2387
 	 */
2345 2388
 	$errors = apply_filters( 'registration_errors', $errors, $sanitized_user_login, $user_email );
2346 2389
 
2347
-	if ( $errors->get_error_code() )
2348
-		return $errors;
2390
+	if ( $errors->get_error_code() ) {
2391
+			return $errors;
2392
+	}
2349 2393
 
2350 2394
 	$user_pass = wp_generate_password( 12, false );
2351 2395
 	$user_id = wp_create_user( $sanitized_user_login, $user_pass, $user_email );
Please login to merge, or discard this patch.