Completed
Push — master ( fdb3a7...cde0c6 )
by Stephen
20:18
created
src/wp-admin/includes/class-wp-filesystem-base.php 2 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -391,7 +391,7 @@  discard block
 block discarded – undo
391 391
 	 * @since 2.5.0
392 392
 	 *
393 393
 	 * @param string $mode string The *nix-style file permission.
394
-	 * @return int octal representation
394
+	 * @return string octal representation
395 395
 	 */
396 396
 	public function getnumchmodfromh( $mode ) {
397 397
 		$realmode = '';
@@ -466,7 +466,7 @@  discard block
 block discarded – undo
466 466
 	 * @abstract
467 467
 	 *
468 468
 	 * @param string $file Name of the file to read.
469
-	 * @return mixed|bool Returns the read data or false on failure.
469
+	 * @return boolean Returns the read data or false on failure.
470 470
 	 */
471 471
 	public function get_contents( $file ) {
472 472
 		return false;
Please login to merge, or discard this patch.
Spacing   +89 added lines, -92 removed lines patch added patch discarded remove patch
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
 	public function abspath() {
62 62
 		$folder = $this->find_folder(ABSPATH);
63 63
 		// Perhaps the FTP folder is rooted at the WordPress install, Check for wp-includes folder in root, Could have some false positives, but rare.
64
-		if ( ! $folder && $this->is_dir( '/' . WPINC ) )
64
+		if ( ! $folder && $this->is_dir('/'.WPINC))
65 65
 			$folder = '/';
66 66
 		return $folder;
67 67
 	}
@@ -99,14 +99,14 @@  discard block
 block discarded – undo
99 99
 	 * @param string $theme The Theme stylesheet or template for the directory.
100 100
 	 * @return string The location of the remote path.
101 101
 	 */
102
-	public function wp_themes_dir( $theme = false ) {
103
-		$theme_root = get_theme_root( $theme );
102
+	public function wp_themes_dir($theme = false) {
103
+		$theme_root = get_theme_root($theme);
104 104
 
105 105
 		// Account for relative theme roots
106
-		if ( '/themes' == $theme_root || ! is_dir( $theme_root ) )
107
-			$theme_root = WP_CONTENT_DIR . $theme_root;
106
+		if ('/themes' == $theme_root || ! is_dir($theme_root))
107
+			$theme_root = WP_CONTENT_DIR.$theme_root;
108 108
 
109
-		return $this->find_folder( $theme_root );
109
+		return $this->find_folder($theme_root);
110 110
 	}
111 111
 
112 112
 	/**
@@ -138,8 +138,8 @@  discard block
 block discarded – undo
138 138
 	 *                     Default false.
139 139
 	 * @return string The location of the remote path.
140 140
 	 */
141
-	public function find_base_dir( $base = '.', $echo = false ) {
142
-		_deprecated_function(__FUNCTION__, '2.7.0', 'WP_Filesystem::abspath() or WP_Filesystem::wp_*_dir()' );
141
+	public function find_base_dir($base = '.', $echo = false) {
142
+		_deprecated_function(__FUNCTION__, '2.7.0', 'WP_Filesystem::abspath() or WP_Filesystem::wp_*_dir()');
143 143
 		$this->verbose = $echo;
144 144
 		return $this->abspath();
145 145
 	}
@@ -160,8 +160,8 @@  discard block
 block discarded – undo
160 160
 	 * @param bool   $echo True to display debug information.
161 161
 	 * @return string The location of the remote path.
162 162
 	 */
163
-	public function get_base_dir( $base = '.', $echo = false ) {
164
-		_deprecated_function(__FUNCTION__, '2.7.0', 'WP_Filesystem::abspath() or WP_Filesystem::wp_*_dir()' );
163
+	public function get_base_dir($base = '.', $echo = false) {
164
+		_deprecated_function(__FUNCTION__, '2.7.0', 'WP_Filesystem::abspath() or WP_Filesystem::wp_*_dir()');
165 165
 		$this->verbose = $echo;
166 166
 		return $this->abspath();
167 167
 	}
@@ -178,11 +178,11 @@  discard block
 block discarded – undo
178 178
 	 * @param string $folder the folder to locate.
179 179
 	 * @return string|false The location of the remote path, false on failure.
180 180
 	 */
181
-	public function find_folder( $folder ) {
182
-		if ( isset( $this->cache[ $folder ] ) )
183
-			return $this->cache[ $folder ];
181
+	public function find_folder($folder) {
182
+		if (isset($this->cache[$folder]))
183
+			return $this->cache[$folder];
184 184
 
185
-		if ( stripos($this->method, 'ftp') !== false ) {
185
+		if (stripos($this->method, 'ftp') !== false) {
186 186
 			$constant_overrides = array(
187 187
 				'FTP_BASE' => ABSPATH,
188 188
 				'FTP_CONTENT_DIR' => WP_CONTENT_DIR,
@@ -191,28 +191,28 @@  discard block
 block discarded – undo
191 191
 			);
192 192
 
193 193
 			// Direct matches ( folder = CONSTANT/ )
194
-			foreach ( $constant_overrides as $constant => $dir ) {
195
-				if ( ! defined( $constant ) )
194
+			foreach ($constant_overrides as $constant => $dir) {
195
+				if ( ! defined($constant))
196 196
 					continue;
197
-				if ( $folder === $dir )
198
-					return trailingslashit( constant( $constant ) );
197
+				if ($folder === $dir)
198
+					return trailingslashit(constant($constant));
199 199
 			}
200 200
 
201 201
 			// Prefix Matches ( folder = CONSTANT/subdir )
202
-			foreach ( $constant_overrides as $constant => $dir ) {
203
-				if ( ! defined( $constant ) )
202
+			foreach ($constant_overrides as $constant => $dir) {
203
+				if ( ! defined($constant))
204 204
 					continue;
205
-				if ( 0 === stripos( $folder, $dir ) ) { // $folder starts with $dir
206
-					$potential_folder = preg_replace( '#^' . preg_quote( $dir, '#' ) . '/#i', trailingslashit( constant( $constant ) ), $folder );
207
-					$potential_folder = trailingslashit( $potential_folder );
205
+				if (0 === stripos($folder, $dir)) { // $folder starts with $dir
206
+					$potential_folder = preg_replace('#^'.preg_quote($dir, '#').'/#i', trailingslashit(constant($constant)), $folder);
207
+					$potential_folder = trailingslashit($potential_folder);
208 208
 
209
-					if ( $this->is_dir( $potential_folder ) ) {
210
-						$this->cache[ $folder ] = $potential_folder;
209
+					if ($this->is_dir($potential_folder)) {
210
+						$this->cache[$folder] = $potential_folder;
211 211
 						return $potential_folder;
212 212
 					}
213 213
 				}
214 214
 			}
215
-		} elseif ( 'direct' == $this->method ) {
215
+		} elseif ('direct' == $this->method) {
216 216
 			$folder = str_replace('\\', '/', $folder); // Windows path sanitisation
217 217
 			return trailingslashit($folder);
218 218
 		}
@@ -220,16 +220,16 @@  discard block
 block discarded – undo
220 220
 		$folder = preg_replace('|^([a-z]{1}):|i', '', $folder); // Strip out windows drive letter if it's there.
221 221
 		$folder = str_replace('\\', '/', $folder); // Windows path sanitisation
222 222
 
223
-		if ( isset($this->cache[ $folder ] ) )
224
-			return $this->cache[ $folder ];
223
+		if (isset($this->cache[$folder]))
224
+			return $this->cache[$folder];
225 225
 
226
-		if ( $this->exists($folder) ) { // Folder exists at that absolute path.
226
+		if ($this->exists($folder)) { // Folder exists at that absolute path.
227 227
 			$folder = trailingslashit($folder);
228
-			$this->cache[ $folder ] = $folder;
228
+			$this->cache[$folder] = $folder;
229 229
 			return $folder;
230 230
 		}
231
-		if ( $return = $this->search_for_folder($folder) )
232
-			$this->cache[ $folder ] = $return;
231
+		if ($return = $this->search_for_folder($folder))
232
+			$this->cache[$folder] = $return;
233 233
 		return $return;
234 234
 	}
235 235
 
@@ -246,26 +246,26 @@  discard block
 block discarded – undo
246 246
 	 * @param bool   $loop   If the function has recursed, Internal use only.
247 247
 	 * @return string|false The location of the remote path, false to cease looping.
248 248
 	 */
249
-	public function search_for_folder( $folder, $base = '.', $loop = false ) {
250
-		if ( empty( $base ) || '.' == $base )
249
+	public function search_for_folder($folder, $base = '.', $loop = false) {
250
+		if (empty($base) || '.' == $base)
251 251
 			$base = trailingslashit($this->cwd());
252 252
 
253 253
 		$folder = untrailingslashit($folder);
254 254
 
255
-		if ( $this->verbose ) {
255
+		if ($this->verbose) {
256 256
 			/* translators: 1: folder to locate, 2: folder to start searching from */
257
-			printf( "\n" . __( 'Looking for %1$s in %2$s' ) . "<br/>\n", $folder, $base );
257
+			printf("\n".__('Looking for %1$s in %2$s')."<br/>\n", $folder, $base);
258 258
 		}
259 259
 
260 260
 		$folder_parts = explode('/', $folder);
261
-		$folder_part_keys = array_keys( $folder_parts );
262
-		$last_index = array_pop( $folder_part_keys );
263
-		$last_path = $folder_parts[ $last_index ];
261
+		$folder_part_keys = array_keys($folder_parts);
262
+		$last_index = array_pop($folder_part_keys);
263
+		$last_path = $folder_parts[$last_index];
264 264
 
265
-		$files = $this->dirlist( $base );
265
+		$files = $this->dirlist($base);
266 266
 
267
-		foreach ( $folder_parts as $index => $key ) {
268
-			if ( $index == $last_index )
267
+		foreach ($folder_parts as $index => $key) {
268
+			if ($index == $last_index)
269 269
 				continue; // We want this to be caught by the next code block.
270 270
 
271 271
 			/*
@@ -275,40 +275,40 @@  discard block
 block discarded – undo
275 275
 			 * folder level, and see if that matches, and so on. If it reaches the end, and still
276 276
 			 * cant find it, it'll return false for the entire function.
277 277
 			 */
278
-			if ( isset($files[ $key ]) ){
278
+			if (isset($files[$key])) {
279 279
 
280 280
 				// Let's try that folder:
281 281
 				$newdir = trailingslashit(path_join($base, $key));
282
-				if ( $this->verbose ) {
282
+				if ($this->verbose) {
283 283
 					/* translators: %s: directory name */
284
-					printf( "\n" . __( 'Changing to %s' ) . "<br/>\n", $newdir );
284
+					printf("\n".__('Changing to %s')."<br/>\n", $newdir);
285 285
 				}
286 286
 
287 287
 				// Only search for the remaining path tokens in the directory, not the full path again.
288
-				$newfolder = implode( '/', array_slice( $folder_parts, $index + 1 ) );
289
-				if ( $ret = $this->search_for_folder( $newfolder, $newdir, $loop) )
288
+				$newfolder = implode('/', array_slice($folder_parts, $index + 1));
289
+				if ($ret = $this->search_for_folder($newfolder, $newdir, $loop))
290 290
 					return $ret;
291 291
 			}
292 292
 		}
293 293
 
294 294
 		// Only check this as a last resort, to prevent locating the incorrect install.
295 295
 		// All above procedures will fail quickly if this is the right branch to take.
296
-		if (isset( $files[ $last_path ] ) ) {
297
-			if ( $this->verbose ) {
296
+		if (isset($files[$last_path])) {
297
+			if ($this->verbose) {
298 298
 				/* translators: %s: directory name */
299
-				printf( "\n" . __( 'Found %s' ) . "<br/>\n",  $base . $last_path );
299
+				printf("\n".__('Found %s')."<br/>\n", $base.$last_path);
300 300
 			}
301
-			return trailingslashit($base . $last_path);
301
+			return trailingslashit($base.$last_path);
302 302
 		}
303 303
 
304 304
 		// Prevent this function from looping again.
305 305
 		// No need to proceed if we've just searched in /
306
-		if ( $loop || '/' == $base )
306
+		if ($loop || '/' == $base)
307 307
 			return false;
308 308
 
309 309
 		// As an extra last resort, Change back to / if the folder wasn't found.
310 310
 		// This comes into effect when the CWD is /home/user/ but WP is at /var/www/....
311
-		return $this->search_for_folder( $folder, '/', true );
311
+		return $this->search_for_folder($folder, '/', true);
312 312
 
313 313
 	}
314 314
 
@@ -325,8 +325,8 @@  discard block
 block discarded – undo
325 325
 	 * @param string $file String filename.
326 326
 	 * @return string The *nix-style representation of permissions.
327 327
 	 */
328
-	public function gethchmod( $file ){
329
-		$perms = intval( $this->getchmod( $file ), 8 );
328
+	public function gethchmod($file) {
329
+		$perms = intval($this->getchmod($file), 8);
330 330
 		if (($perms & 0xC000) == 0xC000) // Socket
331 331
 			$info = 's';
332 332
 		elseif (($perms & 0xA000) == 0xA000) // Symbolic Link
@@ -348,22 +348,19 @@  discard block
 block discarded – undo
348 348
 		$info .= (($perms & 0x0100) ? 'r' : '-');
349 349
 		$info .= (($perms & 0x0080) ? 'w' : '-');
350 350
 		$info .= (($perms & 0x0040) ?
351
-					(($perms & 0x0800) ? 's' : 'x' ) :
352
-					(($perms & 0x0800) ? 'S' : '-'));
351
+					(($perms & 0x0800) ? 's' : 'x') : (($perms & 0x0800) ? 'S' : '-'));
353 352
 
354 353
 		// Group
355 354
 		$info .= (($perms & 0x0020) ? 'r' : '-');
356 355
 		$info .= (($perms & 0x0010) ? 'w' : '-');
357 356
 		$info .= (($perms & 0x0008) ?
358
-					(($perms & 0x0400) ? 's' : 'x' ) :
359
-					(($perms & 0x0400) ? 'S' : '-'));
357
+					(($perms & 0x0400) ? 's' : 'x') : (($perms & 0x0400) ? 'S' : '-'));
360 358
 
361 359
 		// World
362 360
 		$info .= (($perms & 0x0004) ? 'r' : '-');
363 361
 		$info .= (($perms & 0x0002) ? 'w' : '-');
364 362
 		$info .= (($perms & 0x0001) ?
365
-					(($perms & 0x0200) ? 't' : 'x' ) :
366
-					(($perms & 0x0200) ? 'T' : '-'));
363
+					(($perms & 0x0200) ? 't' : 'x') : (($perms & 0x0200) ? 'T' : '-'));
367 364
 		return $info;
368 365
 	}
369 366
 
@@ -375,7 +372,7 @@  discard block
 block discarded – undo
375 372
 	 * @param string $file
376 373
 	 * @return string the last 3 characters of the octal number
377 374
 	 */
378
-	public function getchmod( $file ) {
375
+	public function getchmod($file) {
379 376
 		return '777';
380 377
 	}
381 378
 
@@ -393,12 +390,12 @@  discard block
 block discarded – undo
393 390
 	 * @param string $mode string The *nix-style file permission.
394 391
 	 * @return int octal representation
395 392
 	 */
396
-	public function getnumchmodfromh( $mode ) {
393
+	public function getnumchmodfromh($mode) {
397 394
 		$realmode = '';
398
-		$legal =  array('', 'w', 'r', 'x', '-');
395
+		$legal = array('', 'w', 'r', 'x', '-');
399 396
 		$attarray = preg_split('//', $mode);
400 397
 
401
-		for ( $i = 0, $c = count( $attarray ); $i < $c; $i++ ) {
398
+		for ($i = 0, $c = count($attarray); $i < $c; $i++) {
402 399
 		   if ($key = array_search($attarray[$i], $legal)) {
403 400
 			   $realmode .= $legal[$key];
404 401
 		   }
@@ -406,7 +403,7 @@  discard block
 block discarded – undo
406 403
 
407 404
 		$mode = str_pad($realmode, 10, '-', STR_PAD_LEFT);
408 405
 		$trans = array('-'=>'0', 'r'=>'4', 'w'=>'2', 'x'=>'1');
409
-		$mode = strtr($mode,$trans);
406
+		$mode = strtr($mode, $trans);
410 407
 
411 408
 		$newmode = $mode[0];
412 409
 		$newmode .= $mode[1] + $mode[2] + $mode[3];
@@ -424,8 +421,8 @@  discard block
 block discarded – undo
424 421
 	 * @param string $text String to test against.
425 422
 	 * @return bool true if string is binary, false otherwise.
426 423
 	 */
427
-	public function is_binary( $text ) {
428
-		return (bool) preg_match( '|[^\x20-\x7E]|', $text ); // chr(32)..chr(127)
424
+	public function is_binary($text) {
425
+		return (bool) preg_match('|[^\x20-\x7E]|', $text); // chr(32)..chr(127)
429 426
 	}
430 427
 
431 428
 	/**
@@ -441,7 +438,7 @@  discard block
 block discarded – undo
441 438
 	 * @param bool   $recursive Optional. If set True changes file owner recursivly. Defaults to False.
442 439
 	 * @return bool Returns true on success or false on failure.
443 440
 	 */
444
-	public function chown( $file, $owner, $recursive = false ) {
441
+	public function chown($file, $owner, $recursive = false) {
445 442
 		return false;
446 443
 	}
447 444
 
@@ -468,7 +465,7 @@  discard block
 block discarded – undo
468 465
 	 * @param string $file Name of the file to read.
469 466
 	 * @return mixed|bool Returns the read data or false on failure.
470 467
 	 */
471
-	public function get_contents( $file ) {
468
+	public function get_contents($file) {
472 469
 		return false;
473 470
 	}
474 471
 
@@ -482,7 +479,7 @@  discard block
 block discarded – undo
482 479
 	 * @param string $file Path to the file.
483 480
 	 * @return array|bool the file contents in an array or false on failure.
484 481
 	 */
485
-	public function get_contents_array( $file ) {
482
+	public function get_contents_array($file) {
486 483
 		return false;
487 484
 	}
488 485
 
@@ -498,7 +495,7 @@  discard block
 block discarded – undo
498 495
 	 * @param int    $mode     Optional. The file permissions as octal number, usually 0644.
499 496
 	 * @return bool False on failure.
500 497
 	 */
501
-	public function put_contents( $file, $contents, $mode = false ) {
498
+	public function put_contents($file, $contents, $mode = false) {
502 499
 		return false;
503 500
 	}
504 501
 
@@ -525,7 +522,7 @@  discard block
 block discarded – undo
525 522
 	 * @param string $dir The new current directory.
526 523
 	 * @return bool|string
527 524
 	 */
528
-	public function chdir( $dir ) {
525
+	public function chdir($dir) {
529 526
 		return false;
530 527
 	}
531 528
 
@@ -541,7 +538,7 @@  discard block
 block discarded – undo
541 538
 	 * @param bool   $recursive Optional. If set True changes file group recursively. Defaults to False.
542 539
 	 * @return bool|string
543 540
 	 */
544
-	public function chgrp( $file, $group, $recursive = false ) {
541
+	public function chgrp($file, $group, $recursive = false) {
545 542
 		return false;
546 543
 	}
547 544
 
@@ -557,7 +554,7 @@  discard block
 block discarded – undo
557 554
 	 * @param bool   $recursive Optional. If set True changes file group recursively. Defaults to False.
558 555
 	 * @return bool|string
559 556
 	 */
560
-	public function chmod( $file, $mode = false, $recursive = false ) {
557
+	public function chmod($file, $mode = false, $recursive = false) {
561 558
 		return false;
562 559
 	}
563 560
 
@@ -571,7 +568,7 @@  discard block
 block discarded – undo
571 568
 	 * @param string $file Path to the file.
572 569
 	 * @return string|bool Username of the user or false on error.
573 570
 	 */
574
-	public function owner( $file ) {
571
+	public function owner($file) {
575 572
 		return false;
576 573
 	}
577 574
 
@@ -585,7 +582,7 @@  discard block
 block discarded – undo
585 582
 	 * @param string $file Path to the file.
586 583
 	 * @return string|bool The group or false on error.
587 584
 	 */
588
-	public function group( $file ) {
585
+	public function group($file) {
589 586
 		return false;
590 587
 	}
591 588
 
@@ -604,7 +601,7 @@  discard block
 block discarded – undo
604 601
 	 *                            Default false.
605 602
 	 * @return bool True if file copied successfully, False otherwise.
606 603
 	 */
607
-	public function copy( $source, $destination, $overwrite = false, $mode = false ) {
604
+	public function copy($source, $destination, $overwrite = false, $mode = false) {
608 605
 		return false;
609 606
 	}
610 607
 
@@ -621,7 +618,7 @@  discard block
 block discarded – undo
621 618
 	 *                            Default false.
622 619
 	 * @return bool True if file copied successfully, False otherwise.
623 620
 	 */
624
-	public function move( $source, $destination, $overwrite = false ) {
621
+	public function move($source, $destination, $overwrite = false) {
625 622
 		return false;
626 623
 	}
627 624
 
@@ -639,7 +636,7 @@  discard block
 block discarded – undo
639 636
 	 *                          Default false.
640 637
 	 * @return bool True if the file or directory was deleted, false on failure.
641 638
 	 */
642
-	public function delete( $file, $recursive = false, $type = false ) {
639
+	public function delete($file, $recursive = false, $type = false) {
643 640
 		return false;
644 641
 	}
645 642
 
@@ -653,7 +650,7 @@  discard block
 block discarded – undo
653 650
 	 * @param string $file Path to file/directory.
654 651
 	 * @return bool Whether $file exists or not.
655 652
 	 */
656
-	public function exists( $file ) {
653
+	public function exists($file) {
657 654
 		return false;
658 655
 	}
659 656
 
@@ -667,7 +664,7 @@  discard block
 block discarded – undo
667 664
 	 * @param string $file File path.
668 665
 	 * @return bool Whether $file is a file.
669 666
 	 */
670
-	public function is_file( $file ) {
667
+	public function is_file($file) {
671 668
 		return false;
672 669
 	}
673 670
 
@@ -681,7 +678,7 @@  discard block
 block discarded – undo
681 678
 	 * @param string $path Directory path.
682 679
 	 * @return bool Whether $path is a directory.
683 680
 	 */
684
-	public function is_dir( $path ) {
681
+	public function is_dir($path) {
685 682
 		return false;
686 683
 	}
687 684
 
@@ -695,7 +692,7 @@  discard block
 block discarded – undo
695 692
 	 * @param string $file Path to file.
696 693
 	 * @return bool Whether $file is readable.
697 694
 	 */
698
-	public function is_readable( $file ) {
695
+	public function is_readable($file) {
699 696
 		return false;
700 697
 	}
701 698
 
@@ -709,7 +706,7 @@  discard block
 block discarded – undo
709 706
 	 * @param string $file Path to file.
710 707
 	 * @return bool Whether $file is writable.
711 708
 	 */
712
-	public function is_writable( $file ) {
709
+	public function is_writable($file) {
713 710
 		return false;
714 711
 	}
715 712
 
@@ -723,7 +720,7 @@  discard block
 block discarded – undo
723 720
 	 * @param string $file Path to file.
724 721
 	 * @return int|bool Unix timestamp representing last access time.
725 722
 	 */
726
-	public function atime( $file ) {
723
+	public function atime($file) {
727 724
 		return false;
728 725
 	}
729 726
 
@@ -737,7 +734,7 @@  discard block
 block discarded – undo
737 734
 	 * @param string $file Path to file.
738 735
 	 * @return int|bool Unix timestamp representing modification time.
739 736
 	 */
740
-	public function mtime( $file ) {
737
+	public function mtime($file) {
741 738
 		return false;
742 739
 	}
743 740
 
@@ -751,7 +748,7 @@  discard block
 block discarded – undo
751 748
 	 * @param string $file Path to file.
752 749
 	 * @return int|bool Size of the file in bytes.
753 750
 	 */
754
-	public function size( $file ) {
751
+	public function size($file) {
755 752
 		return false;
756 753
 	}
757 754
 
@@ -771,7 +768,7 @@  discard block
 block discarded – undo
771 768
 	 *                      Default 0.
772 769
 	 * @return bool Whether operation was successful or not.
773 770
 	 */
774
-	public function touch( $file, $time = 0, $atime = 0 ) {
771
+	public function touch($file, $time = 0, $atime = 0) {
775 772
 		return false;
776 773
 	}
777 774
 
@@ -791,7 +788,7 @@  discard block
 block discarded – undo
791 788
 	 *                      Default false.
792 789
 	 * @return bool False if directory cannot be created, true otherwise.
793 790
 	 */
794
-	public function mkdir( $path, $chmod = false, $chown = false, $chgrp = false ) {
791
+	public function mkdir($path, $chmod = false, $chown = false, $chgrp = false) {
795 792
 		return false;
796 793
 	}
797 794
 
@@ -807,7 +804,7 @@  discard block
 block discarded – undo
807 804
 	 *                          Default false.
808 805
 	 * @return bool Whether directory is deleted successfully or not.
809 806
 	 */
810
-	public function rmdir( $path, $recursive = false ) {
807
+	public function rmdir($path, $recursive = false) {
811 808
 		return false;
812 809
 	}
813 810
 
@@ -838,7 +835,7 @@  discard block
 block discarded – undo
838 835
 	 *     @type mixed  $files       If a directory and $recursive is true, contains another array of files.
839 836
 	 * }
840 837
 	 */
841
-	public function dirlist( $path, $include_hidden = true, $recursive = false ) {
838
+	public function dirlist($path, $include_hidden = true, $recursive = false) {
842 839
 		return false;
843 840
 	}
844 841
 
Please login to merge, or discard this patch.
src/wp-admin/includes/image-edit.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -384,7 +384,7 @@
 block discarded – undo
384 384
  * @ignore
385 385
  * @param resource  $img   Image resource.
386 386
  * @param float|int $angle Image rotation angle, in degrees.
387
- * @return resource|false GD image resource, false otherwise.
387
+ * @return resource GD image resource, false otherwise.
388 388
  */
389 389
 function _rotate_image_resource($img, $angle) {
390 390
 	_deprecated_function( __FUNCTION__, '3.5.0', __( 'Use WP_Image_Editor::rotate' ) );
Please login to merge, or discard this patch.
Spacing   +225 added lines, -225 removed lines patch added patch discarded remove patch
@@ -20,22 +20,22 @@  discard block
 block discarded – undo
20 20
 	$sub_sizes = isset($meta['sizes']) && is_array($meta['sizes']);
21 21
 	$note = '';
22 22
 
23
-	if ( isset( $meta['width'], $meta['height'] ) )
24
-		$big = max( $meta['width'], $meta['height'] );
23
+	if (isset($meta['width'], $meta['height']))
24
+		$big = max($meta['width'], $meta['height']);
25 25
 	else
26
-		die( __('Image data does not exist. Please re-upload the image.') );
26
+		die(__('Image data does not exist. Please re-upload the image.'));
27 27
 
28 28
 	$sizer = $big > 400 ? 400 / $big : 1;
29 29
 
30
-	$backup_sizes = get_post_meta( $post_id, '_wp_attachment_backup_sizes', true );
30
+	$backup_sizes = get_post_meta($post_id, '_wp_attachment_backup_sizes', true);
31 31
 	$can_restore = false;
32
-	if ( ! empty( $backup_sizes ) && isset( $backup_sizes['full-orig'], $meta['file'] ) )
33
-		$can_restore = $backup_sizes['full-orig']['file'] != basename( $meta['file'] );
32
+	if ( ! empty($backup_sizes) && isset($backup_sizes['full-orig'], $meta['file']))
33
+		$can_restore = $backup_sizes['full-orig']['file'] != basename($meta['file']);
34 34
 
35
-	if ( $msg ) {
36
-		if ( isset($msg->error) )
35
+	if ($msg) {
36
+		if (isset($msg->error))
37 37
 			$note = "<div class='error'><p>$msg->error</p></div>";
38
-		elseif ( isset($msg->msg) )
38
+		elseif (isset($msg->msg))
39 39
 			$note = "<div class='updated'><p>$msg->msg</p></div>";
40 40
 	}
41 41
 
@@ -46,28 +46,28 @@  discard block
 block discarded – undo
46 46
 	<div class="imgedit-settings">
47 47
 	<div class="imgedit-group">
48 48
 	<div class="imgedit-group-top">
49
-		<h2><?php _e( 'Scale Image' ); ?></h2>
50
-		<button type="button" class="dashicons dashicons-editor-help imgedit-help-toggle" onclick="imageEdit.toggleHelp(this);return false;" aria-expanded="false"><span class="screen-reader-text"><?php esc_html_e( 'Scale Image Help' ); ?></span></button>
49
+		<h2><?php _e('Scale Image'); ?></h2>
50
+		<button type="button" class="dashicons dashicons-editor-help imgedit-help-toggle" onclick="imageEdit.toggleHelp(this);return false;" aria-expanded="false"><span class="screen-reader-text"><?php esc_html_e('Scale Image Help'); ?></span></button>
51 51
 		<div class="imgedit-help">
52 52
 		<p><?php _e('You can proportionally scale the original image. For best results, scaling should be done before you crop, flip, or rotate. Images can only be scaled down, not up.'); ?></p>
53 53
 		</div>
54
-		<?php if ( isset( $meta['width'], $meta['height'] ) ): ?>
55
-		<p><?php printf( __('Original dimensions %s'), $meta['width'] . ' &times; ' . $meta['height'] ); ?></p>
54
+		<?php if (isset($meta['width'], $meta['height'])): ?>
55
+		<p><?php printf(__('Original dimensions %s'), $meta['width'].' &times; '.$meta['height']); ?></p>
56 56
 		<?php endif ?>
57 57
 		<div class="imgedit-submit">
58 58
 
59 59
 		<fieldset class="imgedit-scale">
60
-		<legend><?php _e( 'New dimensions:' ); ?></legend>
60
+		<legend><?php _e('New dimensions:'); ?></legend>
61 61
 		<div class="nowrap">
62
-		<label><span class="screen-reader-text"><?php _e( 'scale width' ); ?></span>
63
-		<input type="text" id="imgedit-scale-width-<?php echo $post_id; ?>" onkeyup="imageEdit.scaleChanged(<?php echo $post_id; ?>, 1, this)" onblur="imageEdit.scaleChanged(<?php echo $post_id; ?>, 1, this)" value="<?php echo isset( $meta['width'] ) ? $meta['width'] : 0; ?>" />
62
+		<label><span class="screen-reader-text"><?php _e('scale width'); ?></span>
63
+		<input type="text" id="imgedit-scale-width-<?php echo $post_id; ?>" onkeyup="imageEdit.scaleChanged(<?php echo $post_id; ?>, 1, this)" onblur="imageEdit.scaleChanged(<?php echo $post_id; ?>, 1, this)" value="<?php echo isset($meta['width']) ? $meta['width'] : 0; ?>" />
64 64
 		</label>
65 65
 		<span class="imgedit-separator">&times;</span>
66
-		<label><span class="screen-reader-text"><?php _e( 'scale height' ); ?></span>
67
-		<input type="text" id="imgedit-scale-height-<?php echo $post_id; ?>" onkeyup="imageEdit.scaleChanged(<?php echo $post_id; ?>, 0, this)" onblur="imageEdit.scaleChanged(<?php echo $post_id; ?>, 0, this)" value="<?php echo isset( $meta['height'] ) ? $meta['height'] : 0; ?>" />
66
+		<label><span class="screen-reader-text"><?php _e('scale height'); ?></span>
67
+		<input type="text" id="imgedit-scale-height-<?php echo $post_id; ?>" onkeyup="imageEdit.scaleChanged(<?php echo $post_id; ?>, 0, this)" onblur="imageEdit.scaleChanged(<?php echo $post_id; ?>, 0, this)" value="<?php echo isset($meta['height']) ? $meta['height'] : 0; ?>" />
68 68
 		</label>
69 69
 		<span class="imgedit-scale-warn" id="imgedit-scale-warn-<?php echo $post_id; ?>">!</span>
70
-		<input id="imgedit-scale-button" type="button" onclick="imageEdit.action(<?php echo "$post_id, '$nonce'"; ?>, 'scale')" class="button button-primary" value="<?php esc_attr_e( 'Scale' ); ?>" />
70
+		<input id="imgedit-scale-button" type="button" onclick="imageEdit.action(<?php echo "$post_id, '$nonce'"; ?>, 'scale')" class="button button-primary" value="<?php esc_attr_e('Scale'); ?>" />
71 71
  		</div>
72 72
 		</fieldset>
73 73
 
@@ -75,20 +75,20 @@  discard block
 block discarded – undo
75 75
 	</div>
76 76
 	</div>
77 77
 
78
-<?php if ( $can_restore ) { ?>
78
+<?php if ($can_restore) { ?>
79 79
 
80 80
 	<div class="imgedit-group">
81 81
 	<div class="imgedit-group-top">
82
-		<h2><button type="button" onclick="imageEdit.toggleHelp(this);" class="button-link"><?php _e( 'Restore Original Image' ); ?> <span class="dashicons dashicons-arrow-down imgedit-help-toggle"></span></button></h2>
82
+		<h2><button type="button" onclick="imageEdit.toggleHelp(this);" class="button-link"><?php _e('Restore Original Image'); ?> <span class="dashicons dashicons-arrow-down imgedit-help-toggle"></span></button></h2>
83 83
 		<div class="imgedit-help">
84 84
 		<p><?php _e('Discard any changes and restore the original image.');
85 85
 
86
-		if ( !defined('IMAGE_EDIT_OVERWRITE') || !IMAGE_EDIT_OVERWRITE )
86
+		if ( ! defined('IMAGE_EDIT_OVERWRITE') || ! IMAGE_EDIT_OVERWRITE)
87 87
 			echo ' '.__('Previously edited copies of the image will not be deleted.');
88 88
 
89 89
 		?></p>
90 90
 		<div class="imgedit-submit">
91
-		<input type="button" onclick="imageEdit.action(<?php echo "$post_id, '$nonce'"; ?>, 'restore')" class="button button-primary" value="<?php esc_attr_e( 'Restore image' ); ?>" <?php echo $can_restore; ?> />
91
+		<input type="button" onclick="imageEdit.action(<?php echo "$post_id, '$nonce'"; ?>, 'restore')" class="button button-primary" value="<?php esc_attr_e('Restore image'); ?>" <?php echo $can_restore; ?> />
92 92
 		</div>
93 93
 		</div>
94 94
 	</div>
@@ -98,8 +98,8 @@  discard block
 block discarded – undo
98 98
 
99 99
 	<div class="imgedit-group">
100 100
 	<div class="imgedit-group-top">
101
-		<h2><?php _e( 'Image Crop' ); ?></h2>
102
-		<button type="button" class="dashicons dashicons-editor-help imgedit-help-toggle" onclick="imageEdit.toggleHelp(this);return false;" aria-expanded="false"><span class="screen-reader-text"><?php esc_html_e( 'Image Crop Help' ); ?></span></button>
101
+		<h2><?php _e('Image Crop'); ?></h2>
102
+		<button type="button" class="dashicons dashicons-editor-help imgedit-help-toggle" onclick="imageEdit.toggleHelp(this);return false;" aria-expanded="false"><span class="screen-reader-text"><?php esc_html_e('Image Crop Help'); ?></span></button>
103 103
 
104 104
 		<div class="imgedit-help">
105 105
 		<p><?php _e('To crop the image, click on it and drag to make your selection.'); ?></p>
@@ -113,26 +113,26 @@  discard block
 block discarded – undo
113 113
 	</div>
114 114
 
115 115
 	<fieldset class="imgedit-crop-ratio">
116
-		<legend><?php _e( 'Aspect ratio:' ); ?></legend>
116
+		<legend><?php _e('Aspect ratio:'); ?></legend>
117 117
 		<div class="nowrap">
118
-		<label><span class="screen-reader-text"><?php _e( 'crop ratio width' ); ?></span>
118
+		<label><span class="screen-reader-text"><?php _e('crop ratio width'); ?></span>
119 119
 		<input type="text" id="imgedit-crop-width-<?php echo $post_id; ?>" onkeyup="imageEdit.setRatioSelection(<?php echo $post_id; ?>, 0, this)" onblur="imageEdit.setRatioSelection(<?php echo $post_id; ?>, 0, this)" />
120 120
 		</label>
121 121
 		<span class="imgedit-separator">:</span>
122
-		<label><span class="screen-reader-text"><?php _e( 'crop ratio height' ); ?></span>
122
+		<label><span class="screen-reader-text"><?php _e('crop ratio height'); ?></span>
123 123
 		<input type="text" id="imgedit-crop-height-<?php echo $post_id; ?>" onkeyup="imageEdit.setRatioSelection(<?php echo $post_id; ?>, 1, this)" onblur="imageEdit.setRatioSelection(<?php echo $post_id; ?>, 1, this)" />
124 124
 		</label>
125 125
 		</div>
126 126
 	</fieldset>
127 127
 
128 128
 	<fieldset id="imgedit-crop-sel-<?php echo $post_id; ?>" class="imgedit-crop-sel">
129
-		<legend><?php _e( 'Selection:' ); ?></legend>
129
+		<legend><?php _e('Selection:'); ?></legend>
130 130
 		<div class="nowrap">
131
-		<label><span class="screen-reader-text"><?php _e( 'selection width' ); ?></span>
131
+		<label><span class="screen-reader-text"><?php _e('selection width'); ?></span>
132 132
 		<input type="text" id="imgedit-sel-width-<?php echo $post_id; ?>" onkeyup="imageEdit.setNumSelection(<?php echo $post_id; ?>, this)" onblur="imageEdit.setNumSelection(<?php echo $post_id; ?>, this)" />
133 133
 		</label>
134 134
 		<span class="imgedit-separator">&times;</span>
135
-		<label><span class="screen-reader-text"><?php _e( 'selection height' ); ?></span>
135
+		<label><span class="screen-reader-text"><?php _e('selection height'); ?></span>
136 136
 		<input type="text" id="imgedit-sel-height-<?php echo $post_id; ?>" onkeyup="imageEdit.setNumSelection(<?php echo $post_id; ?>, this)" onblur="imageEdit.setNumSelection(<?php echo $post_id; ?>, this)" />
137 137
 		</label>
138 138
 		</div>
@@ -140,25 +140,25 @@  discard block
 block discarded – undo
140 140
 
141 141
 	</div>
142 142
 
143
-	<?php if ( $thumb && $sub_sizes ) {
144
-		$thumb_img = wp_constrain_dimensions( $thumb['width'], $thumb['height'], 160, 120 );
143
+	<?php if ($thumb && $sub_sizes) {
144
+		$thumb_img = wp_constrain_dimensions($thumb['width'], $thumb['height'], 160, 120);
145 145
 	?>
146 146
 
147 147
 	<div class="imgedit-group imgedit-applyto">
148 148
 	<div class="imgedit-group-top">
149
-		<h2><?php _e( 'Thumbnail Settings' ); ?></h2>
150
-		<button type="button" class="dashicons dashicons-editor-help imgedit-help-toggle" onclick="imageEdit.toggleHelp(this);return false;" aria-expanded="false"><span class="screen-reader-text"><?php esc_html_e( 'Thumbnail Settings Help' ); ?></span></button>
149
+		<h2><?php _e('Thumbnail Settings'); ?></h2>
150
+		<button type="button" class="dashicons dashicons-editor-help imgedit-help-toggle" onclick="imageEdit.toggleHelp(this);return false;" aria-expanded="false"><span class="screen-reader-text"><?php esc_html_e('Thumbnail Settings Help'); ?></span></button>
151 151
 		<p class="imgedit-help"><?php _e('You can edit the image while preserving the thumbnail. For example, you may wish to have a square thumbnail that displays just a section of the image.'); ?></p>
152 152
 	</div>
153 153
 
154 154
 	<figure class="imgedit-thumbnail-preview">
155 155
 		<img src="<?php echo $thumb['url']; ?>" width="<?php echo $thumb_img[0]; ?>" height="<?php echo $thumb_img[1]; ?>" class="imgedit-size-preview" alt="" draggable="false" />
156
-		<figcaption class="imgedit-thumbnail-preview-caption"><?php _e( 'Current thumbnail' ); ?></figcaption>
156
+		<figcaption class="imgedit-thumbnail-preview-caption"><?php _e('Current thumbnail'); ?></figcaption>
157 157
 	</figure>
158 158
 
159 159
 	<div id="imgedit-save-target-<?php echo $post_id; ?>" class="imgedit-save-target">
160 160
 	<fieldset>
161
-		<legend><strong><?php _e( 'Apply changes to:' ); ?></strong></legend>
161
+		<legend><strong><?php _e('Apply changes to:'); ?></strong></legend>
162 162
 
163 163
 		<label class="imgedit-label">
164 164
 		<input type="radio" name="imgedit-target-<?php echo $post_id; ?>" value="all" checked="checked" />
@@ -182,26 +182,26 @@  discard block
 block discarded – undo
182 182
 	<div class="imgedit-panel-content wp-clearfix">
183 183
 		<?php echo $note; ?>
184 184
 		<div class="imgedit-menu wp-clearfix">
185
-			<button type="button" onclick="imageEdit.crop(<?php echo "$post_id, '$nonce'"; ?>, this)" class="imgedit-crop button disabled" disabled><span class="screen-reader-text"><?php esc_html_e( 'Crop' ); ?></span></button><?php
185
+			<button type="button" onclick="imageEdit.crop(<?php echo "$post_id, '$nonce'"; ?>, this)" class="imgedit-crop button disabled" disabled><span class="screen-reader-text"><?php esc_html_e('Crop'); ?></span></button><?php
186 186
 
187 187
 		// On some setups GD library does not provide imagerotate() - Ticket #11536
188
-		if ( wp_image_editor_supports( array( 'mime_type' => get_post_mime_type( $post_id ), 'methods' => array( 'rotate' ) ) ) ) {
188
+		if (wp_image_editor_supports(array('mime_type' => get_post_mime_type($post_id), 'methods' => array('rotate')))) {
189 189
 			$note_no_rotate = '';
190 190
 	?>
191
-			<button type="button" class="imgedit-rleft button" onclick="imageEdit.rotate( 90, <?php echo "$post_id, '$nonce'"; ?>, this)"><span class="screen-reader-text"><?php esc_html_e( 'Rotate counter-clockwise' ); ?></span></button>
192
-			<button type="button" class="imgedit-rright button" onclick="imageEdit.rotate(-90, <?php echo "$post_id, '$nonce'"; ?>, this)"><span class="screen-reader-text"><?php esc_html_e( 'Rotate clockwise' ); ?></span></button>
191
+			<button type="button" class="imgedit-rleft button" onclick="imageEdit.rotate( 90, <?php echo "$post_id, '$nonce'"; ?>, this)"><span class="screen-reader-text"><?php esc_html_e('Rotate counter-clockwise'); ?></span></button>
192
+			<button type="button" class="imgedit-rright button" onclick="imageEdit.rotate(-90, <?php echo "$post_id, '$nonce'"; ?>, this)"><span class="screen-reader-text"><?php esc_html_e('Rotate clockwise'); ?></span></button>
193 193
 	<?php } else {
194
-			$note_no_rotate = '<p class="note-no-rotate"><em>' . __( 'Image rotation is not supported by your web host.' ) . '</em></p>';
194
+			$note_no_rotate = '<p class="note-no-rotate"><em>'.__('Image rotation is not supported by your web host.').'</em></p>';
195 195
 	?>
196 196
 			<button type="button" class="imgedit-rleft button disabled" disabled></button>
197 197
 			<button type="button" class="imgedit-rright button disabled" disabled></button>
198 198
 	<?php } ?>
199 199
 
200
-			<button type="button" onclick="imageEdit.flip(1, <?php echo "$post_id, '$nonce'"; ?>, this)" class="imgedit-flipv button"><span class="screen-reader-text"><?php esc_html_e( 'Flip vertically' ); ?></span></button>
201
-			<button type="button" onclick="imageEdit.flip(2, <?php echo "$post_id, '$nonce'"; ?>, this)" class="imgedit-fliph button"><span class="screen-reader-text"><?php esc_html_e( 'Flip horizontally' ); ?></span></button>
200
+			<button type="button" onclick="imageEdit.flip(1, <?php echo "$post_id, '$nonce'"; ?>, this)" class="imgedit-flipv button"><span class="screen-reader-text"><?php esc_html_e('Flip vertically'); ?></span></button>
201
+			<button type="button" onclick="imageEdit.flip(2, <?php echo "$post_id, '$nonce'"; ?>, this)" class="imgedit-fliph button"><span class="screen-reader-text"><?php esc_html_e('Flip horizontally'); ?></span></button>
202 202
 
203
-			<button type="button" id="image-undo-<?php echo $post_id; ?>" onclick="imageEdit.undo(<?php echo "$post_id, '$nonce'"; ?>, this)" class="imgedit-undo button disabled" disabled><span class="screen-reader-text"><?php esc_html_e( 'Undo' ); ?></span></button>
204
-			<button type="button" id="image-redo-<?php echo $post_id; ?>" onclick="imageEdit.redo(<?php echo "$post_id, '$nonce'"; ?>, this)" class="imgedit-redo button disabled" disabled><span class="screen-reader-text"><?php esc_html_e( 'Redo' ); ?></span></button>
203
+			<button type="button" id="image-undo-<?php echo $post_id; ?>" onclick="imageEdit.undo(<?php echo "$post_id, '$nonce'"; ?>, this)" class="imgedit-undo button disabled" disabled><span class="screen-reader-text"><?php esc_html_e('Undo'); ?></span></button>
204
+			<button type="button" id="image-redo-<?php echo $post_id; ?>" onclick="imageEdit.redo(<?php echo "$post_id, '$nonce'"; ?>, this)" class="imgedit-redo button disabled" disabled><span class="screen-reader-text"><?php esc_html_e('Redo'); ?></span></button>
205 205
 			<?php echo $note_no_rotate; ?>
206 206
 		</div>
207 207
 
@@ -209,16 +209,16 @@  discard block
 block discarded – undo
209 209
 		<input type="hidden" id="imgedit-history-<?php echo $post_id; ?>" value="" />
210 210
 		<input type="hidden" id="imgedit-undone-<?php echo $post_id; ?>" value="0" />
211 211
 		<input type="hidden" id="imgedit-selection-<?php echo $post_id; ?>" value="" />
212
-		<input type="hidden" id="imgedit-x-<?php echo $post_id; ?>" value="<?php echo isset( $meta['width'] ) ? $meta['width'] : 0; ?>" />
213
-		<input type="hidden" id="imgedit-y-<?php echo $post_id; ?>" value="<?php echo isset( $meta['height'] ) ? $meta['height'] : 0; ?>" />
212
+		<input type="hidden" id="imgedit-x-<?php echo $post_id; ?>" value="<?php echo isset($meta['width']) ? $meta['width'] : 0; ?>" />
213
+		<input type="hidden" id="imgedit-y-<?php echo $post_id; ?>" value="<?php echo isset($meta['height']) ? $meta['height'] : 0; ?>" />
214 214
 
215 215
 		<div id="imgedit-crop-<?php echo $post_id; ?>" class="imgedit-crop-wrap">
216
-		<img id="image-preview-<?php echo $post_id; ?>" onload="imageEdit.imgLoaded('<?php echo $post_id; ?>')" src="<?php echo admin_url( 'admin-ajax.php', 'relative' ); ?>?action=imgedit-preview&amp;_ajax_nonce=<?php echo $nonce; ?>&amp;postid=<?php echo $post_id; ?>&amp;rand=<?php echo rand(1, 99999); ?>" alt="" />
216
+		<img id="image-preview-<?php echo $post_id; ?>" onload="imageEdit.imgLoaded('<?php echo $post_id; ?>')" src="<?php echo admin_url('admin-ajax.php', 'relative'); ?>?action=imgedit-preview&amp;_ajax_nonce=<?php echo $nonce; ?>&amp;postid=<?php echo $post_id; ?>&amp;rand=<?php echo rand(1, 99999); ?>" alt="" />
217 217
 		</div>
218 218
 
219 219
 		<div class="imgedit-submit">
220
-			<input type="button" onclick="imageEdit.close(<?php echo $post_id; ?>, 1)" class="button imgedit-cancel-btn" value="<?php esc_attr_e( 'Cancel' ); ?>" />
221
-			<input type="button" onclick="imageEdit.save(<?php echo "$post_id, '$nonce'"; ?>)" disabled="disabled" class="button button-primary imgedit-submit-btn" value="<?php esc_attr_e( 'Save' ); ?>" />
220
+			<input type="button" onclick="imageEdit.close(<?php echo $post_id; ?>, 1)" class="button imgedit-cancel-btn" value="<?php esc_attr_e('Cancel'); ?>" />
221
+			<input type="button" onclick="imageEdit.save(<?php echo "$post_id, '$nonce'"; ?>)" disabled="disabled" class="button button-primary imgedit-submit-btn" value="<?php esc_attr_e('Save'); ?>" />
222 222
 		</div>
223 223
 	</div>
224 224
 
@@ -238,8 +238,8 @@  discard block
 block discarded – undo
238 238
  * @param int $post_id
239 239
  * @return bool
240 240
  */
241
-function wp_stream_image( $image, $mime_type, $post_id ) {
242
-	if ( $image instanceof WP_Image_Editor ) {
241
+function wp_stream_image($image, $mime_type, $post_id) {
242
+	if ($image instanceof WP_Image_Editor) {
243 243
 
244 244
 		/**
245 245
 		 * Filters the WP_Image_Editor instance for the image to be streamed to the browser.
@@ -249,14 +249,14 @@  discard block
 block discarded – undo
249 249
 		 * @param WP_Image_Editor $image   WP_Image_Editor instance.
250 250
 		 * @param int             $post_id Post ID.
251 251
 		 */
252
-		$image = apply_filters( 'image_editor_save_pre', $image, $post_id );
252
+		$image = apply_filters('image_editor_save_pre', $image, $post_id);
253 253
 
254
-		if ( is_wp_error( $image->stream( $mime_type ) ) )
254
+		if (is_wp_error($image->stream($mime_type)))
255 255
 			return false;
256 256
 
257 257
 		return true;
258 258
 	} else {
259
-		_deprecated_argument( __FUNCTION__, '3.5.0', __( '$image needs to be an WP_Image_Editor object' ) );
259
+		_deprecated_argument(__FUNCTION__, '3.5.0', __('$image needs to be an WP_Image_Editor object'));
260 260
 
261 261
 		/**
262 262
 		 * Filters the GD image resource to be streamed to the browser.
@@ -267,18 +267,18 @@  discard block
 block discarded – undo
267 267
 		 * @param resource $image   Image resource to be streamed.
268 268
 		 * @param int      $post_id Post ID.
269 269
 		 */
270
-		$image = apply_filters( 'image_save_pre', $image, $post_id );
270
+		$image = apply_filters('image_save_pre', $image, $post_id);
271 271
 
272
-		switch ( $mime_type ) {
272
+		switch ($mime_type) {
273 273
 			case 'image/jpeg':
274
-				header( 'Content-Type: image/jpeg' );
275
-				return imagejpeg( $image, null, 90 );
274
+				header('Content-Type: image/jpeg');
275
+				return imagejpeg($image, null, 90);
276 276
 			case 'image/png':
277
-				header( 'Content-Type: image/png' );
278
-				return imagepng( $image );
277
+				header('Content-Type: image/png');
278
+				return imagepng($image);
279 279
 			case 'image/gif':
280
-				header( 'Content-Type: image/gif' );
281
-				return imagegif( $image );
280
+				header('Content-Type: image/gif');
281
+				return imagegif($image);
282 282
 			default:
283 283
 				return false;
284 284
 		}
@@ -294,11 +294,11 @@  discard block
 block discarded – undo
294 294
  * @param int $post_id
295 295
  * @return bool
296 296
  */
297
-function wp_save_image_file( $filename, $image, $mime_type, $post_id ) {
298
-	if ( $image instanceof WP_Image_Editor ) {
297
+function wp_save_image_file($filename, $image, $mime_type, $post_id) {
298
+	if ($image instanceof WP_Image_Editor) {
299 299
 
300 300
 		/** This filter is documented in wp-admin/includes/image-edit.php */
301
-		$image = apply_filters( 'image_editor_save_pre', $image, $post_id );
301
+		$image = apply_filters('image_editor_save_pre', $image, $post_id);
302 302
 
303 303
 		/**
304 304
 		 * Filters whether to skip saving the image file.
@@ -314,17 +314,17 @@  discard block
 block discarded – undo
314 314
 		 * @param string          $mime_type Image mime type.
315 315
 		 * @param int             $post_id   Post ID.
316 316
 		 */
317
-		$saved = apply_filters( 'wp_save_image_editor_file', null, $filename, $image, $mime_type, $post_id );
317
+		$saved = apply_filters('wp_save_image_editor_file', null, $filename, $image, $mime_type, $post_id);
318 318
 
319
-		if ( null !== $saved )
319
+		if (null !== $saved)
320 320
 			return $saved;
321 321
 
322
-		return $image->save( $filename, $mime_type );
322
+		return $image->save($filename, $mime_type);
323 323
 	} else {
324
-		_deprecated_argument( __FUNCTION__, '3.5.0', __( '$image needs to be an WP_Image_Editor object' ) );
324
+		_deprecated_argument(__FUNCTION__, '3.5.0', __('$image needs to be an WP_Image_Editor object'));
325 325
 
326 326
 		/** This filter is documented in wp-admin/includes/image-edit.php */
327
-		$image = apply_filters( 'image_save_pre', $image, $post_id );
327
+		$image = apply_filters('image_save_pre', $image, $post_id);
328 328
 
329 329
 		/**
330 330
 		 * Filters whether to skip saving the image file.
@@ -341,20 +341,20 @@  discard block
 block discarded – undo
341 341
 		 * @param string          $mime_type Image mime type.
342 342
 		 * @param int             $post_id   Post ID.
343 343
 		 */
344
-		$saved = apply_filters( 'wp_save_image_file', null, $filename, $image, $mime_type, $post_id );
344
+		$saved = apply_filters('wp_save_image_file', null, $filename, $image, $mime_type, $post_id);
345 345
 
346
-		if ( null !== $saved )
346
+		if (null !== $saved)
347 347
 			return $saved;
348 348
 
349
-		switch ( $mime_type ) {
349
+		switch ($mime_type) {
350 350
 			case 'image/jpeg':
351 351
 
352 352
 				/** This filter is documented in wp-includes/class-wp-image-editor.php */
353
-				return imagejpeg( $image, $filename, apply_filters( 'jpeg_quality', 90, 'edit_image' ) );
353
+				return imagejpeg($image, $filename, apply_filters('jpeg_quality', 90, 'edit_image'));
354 354
 			case 'image/png':
355
-				return imagepng( $image, $filename );
355
+				return imagepng($image, $filename);
356 356
 			case 'image/gif':
357
-				return imagegif( $image, $filename );
357
+				return imagegif($image, $filename);
358 358
 			default:
359 359
 				return false;
360 360
 		}
@@ -387,10 +387,10 @@  discard block
 block discarded – undo
387 387
  * @return resource|false GD image resource, false otherwise.
388 388
  */
389 389
 function _rotate_image_resource($img, $angle) {
390
-	_deprecated_function( __FUNCTION__, '3.5.0', __( 'Use WP_Image_Editor::rotate' ) );
391
-	if ( function_exists('imagerotate') ) {
390
+	_deprecated_function(__FUNCTION__, '3.5.0', __('Use WP_Image_Editor::rotate'));
391
+	if (function_exists('imagerotate')) {
392 392
 		$rotated = imagerotate($img, $angle, 0);
393
-		if ( is_resource($rotated) ) {
393
+		if (is_resource($rotated)) {
394 394
 			imagedestroy($img);
395 395
 			$img = $rotated;
396 396
 		}
@@ -410,17 +410,17 @@  discard block
 block discarded – undo
410 410
  * @return resource (maybe) flipped image resource.
411 411
  */
412 412
 function _flip_image_resource($img, $horz, $vert) {
413
-	_deprecated_function( __FUNCTION__, '3.5.0', __( 'Use WP_Image_Editor::flip' ) );
413
+	_deprecated_function(__FUNCTION__, '3.5.0', __('Use WP_Image_Editor::flip'));
414 414
 	$w = imagesx($img);
415 415
 	$h = imagesy($img);
416 416
 	$dst = wp_imagecreatetruecolor($w, $h);
417
-	if ( is_resource($dst) ) {
417
+	if (is_resource($dst)) {
418 418
 		$sx = $vert ? ($w - 1) : 0;
419 419
 		$sy = $horz ? ($h - 1) : 0;
420 420
 		$sw = $vert ? -$w : $w;
421 421
 		$sh = $horz ? -$h : $h;
422 422
 
423
-		if ( imagecopyresampled($dst, $img, 0, 0, $sx, $sy, $w, $h, $sw, $sh) ) {
423
+		if (imagecopyresampled($dst, $img, 0, 0, $sx, $sy, $w, $h, $sw, $sh)) {
424 424
 			imagedestroy($img);
425 425
 			$img = $dst;
426 426
 		}
@@ -443,8 +443,8 @@  discard block
 block discarded – undo
443 443
  */
444 444
 function _crop_image_resource($img, $x, $y, $w, $h) {
445 445
 	$dst = wp_imagecreatetruecolor($w, $h);
446
-	if ( is_resource($dst) ) {
447
-		if ( imagecopy($dst, $img, 0, 0, $x, $y, $w, $h) ) {
446
+	if (is_resource($dst)) {
447
+		if (imagecopy($dst, $img, 0, 0, $x, $y, $w, $h)) {
448 448
 			imagedestroy($img);
449 449
 			$img = $dst;
450 450
 		}
@@ -461,24 +461,24 @@  discard block
 block discarded – undo
461 461
  * @param array           $changes Array of change operations.
462 462
  * @return WP_Image_Editor WP_Image_Editor instance with changes applied.
463 463
  */
464
-function image_edit_apply_changes( $image, $changes ) {
465
-	if ( is_resource( $image ) )
466
-		_deprecated_argument( __FUNCTION__, '3.5.0', __( '$image needs to be an WP_Image_Editor object' ) );
464
+function image_edit_apply_changes($image, $changes) {
465
+	if (is_resource($image))
466
+		_deprecated_argument(__FUNCTION__, '3.5.0', __('$image needs to be an WP_Image_Editor object'));
467 467
 
468
-	if ( !is_array($changes) )
468
+	if ( ! is_array($changes))
469 469
 		return $image;
470 470
 
471 471
 	// Expand change operations.
472
-	foreach ( $changes as $key => $obj ) {
473
-		if ( isset($obj->r) ) {
472
+	foreach ($changes as $key => $obj) {
473
+		if (isset($obj->r)) {
474 474
 			$obj->type = 'rotate';
475 475
 			$obj->angle = $obj->r;
476 476
 			unset($obj->r);
477
-		} elseif ( isset($obj->f) ) {
477
+		} elseif (isset($obj->f)) {
478 478
 			$obj->type = 'flip';
479 479
 			$obj->axis = $obj->f;
480 480
 			unset($obj->f);
481
-		} elseif ( isset($obj->c) ) {
481
+		} elseif (isset($obj->c)) {
482 482
 			$obj->type = 'crop';
483 483
 			$obj->sel = $obj->c;
484 484
 			unset($obj->c);
@@ -487,12 +487,12 @@  discard block
 block discarded – undo
487 487
 	}
488 488
 
489 489
 	// Combine operations.
490
-	if ( count($changes) > 1 ) {
490
+	if (count($changes) > 1) {
491 491
 		$filtered = array($changes[0]);
492
-		for ( $i = 0, $j = 1, $c = count( $changes ); $j < $c; $j++ ) {
492
+		for ($i = 0, $j = 1, $c = count($changes); $j < $c; $j++) {
493 493
 			$combined = false;
494
-			if ( $filtered[$i]->type == $changes[$j]->type ) {
495
-				switch ( $filtered[$i]->type ) {
494
+			if ($filtered[$i]->type == $changes[$j]->type) {
495
+				switch ($filtered[$i]->type) {
496 496
 					case 'rotate':
497 497
 						$filtered[$i]->angle += $changes[$j]->angle;
498 498
 						$combined = true;
@@ -503,7 +503,7 @@  discard block
 block discarded – undo
503 503
 						break;
504 504
 				}
505 505
 			}
506
-			if ( !$combined )
506
+			if ( ! $combined)
507 507
 				$filtered[++$i] = $changes[$j];
508 508
 		}
509 509
 		$changes = $filtered;
@@ -511,7 +511,7 @@  discard block
 block discarded – undo
511 511
 	}
512 512
 
513 513
 	// Image resource before applying the changes.
514
-	if ( $image instanceof WP_Image_Editor ) {
514
+	if ($image instanceof WP_Image_Editor) {
515 515
 
516 516
 		/**
517 517
 		 * Filters the WP_Image_Editor instance before applying changes to the image.
@@ -521,8 +521,8 @@  discard block
 block discarded – undo
521 521
 		 * @param WP_Image_Editor $image   WP_Image_Editor instance.
522 522
  		 * @param array           $changes Array of change operations.
523 523
 		 */
524
-		$image = apply_filters( 'wp_image_editor_before_change', $image, $changes );
525
-	} elseif ( is_resource( $image ) ) {
524
+		$image = apply_filters('wp_image_editor_before_change', $image, $changes);
525
+	} elseif (is_resource($image)) {
526 526
 
527 527
 		/**
528 528
 		 * Filters the GD image resource before applying changes to the image.
@@ -533,39 +533,39 @@  discard block
 block discarded – undo
533 533
 		 * @param resource $image   GD image resource.
534 534
  		 * @param array    $changes Array of change operations.
535 535
 		 */
536
-		$image = apply_filters( 'image_edit_before_change', $image, $changes );
536
+		$image = apply_filters('image_edit_before_change', $image, $changes);
537 537
 	}
538 538
 
539
-	foreach ( $changes as $operation ) {
540
-		switch ( $operation->type ) {
539
+	foreach ($changes as $operation) {
540
+		switch ($operation->type) {
541 541
 			case 'rotate':
542
-				if ( $operation->angle != 0 ) {
543
-					if ( $image instanceof WP_Image_Editor )
544
-						$image->rotate( $operation->angle );
542
+				if ($operation->angle != 0) {
543
+					if ($image instanceof WP_Image_Editor)
544
+						$image->rotate($operation->angle);
545 545
 					else
546
-						$image = _rotate_image_resource( $image, $operation->angle );
546
+						$image = _rotate_image_resource($image, $operation->angle);
547 547
 				}
548 548
 				break;
549 549
 			case 'flip':
550
-				if ( $operation->axis != 0 )
551
-					if ( $image instanceof WP_Image_Editor )
552
-						$image->flip( ($operation->axis & 1) != 0, ($operation->axis & 2) != 0 );
550
+				if ($operation->axis != 0)
551
+					if ($image instanceof WP_Image_Editor)
552
+						$image->flip(($operation->axis & 1) != 0, ($operation->axis & 2) != 0);
553 553
 					else
554
-						$image = _flip_image_resource( $image, ( $operation->axis & 1 ) != 0, ( $operation->axis & 2 ) != 0 );
554
+						$image = _flip_image_resource($image, ($operation->axis & 1) != 0, ($operation->axis & 2) != 0);
555 555
 				break;
556 556
 			case 'crop':
557 557
 				$sel = $operation->sel;
558 558
 
559
-				if ( $image instanceof WP_Image_Editor ) {
559
+				if ($image instanceof WP_Image_Editor) {
560 560
 					$size = $image->get_size();
561 561
 					$w = $size['width'];
562 562
 					$h = $size['height'];
563 563
 
564
-					$scale = 1 / _image_get_preview_ratio( $w, $h ); // discard preview scaling
565
-					$image->crop( $sel->x * $scale, $sel->y * $scale, $sel->w * $scale, $sel->h * $scale );
564
+					$scale = 1 / _image_get_preview_ratio($w, $h); // discard preview scaling
565
+					$image->crop($sel->x * $scale, $sel->y * $scale, $sel->w * $scale, $sel->h * $scale);
566 566
 				} else {
567
-					$scale = 1 / _image_get_preview_ratio( imagesx( $image ), imagesy( $image ) ); // discard preview scaling
568
-					$image = _crop_image_resource( $image, $sel->x * $scale, $sel->y * $scale, $sel->w * $scale, $sel->h * $scale );
567
+					$scale = 1 / _image_get_preview_ratio(imagesx($image), imagesy($image)); // discard preview scaling
568
+					$image = _crop_image_resource($image, $sel->x * $scale, $sel->y * $scale, $sel->w * $scale, $sel->h * $scale);
569 569
 				}
570 570
 				break;
571 571
 		}
@@ -582,34 +582,34 @@  discard block
 block discarded – undo
582 582
  * @param int $post_id
583 583
  * @return bool
584 584
  */
585
-function stream_preview_image( $post_id ) {
586
-	$post = get_post( $post_id );
585
+function stream_preview_image($post_id) {
586
+	$post = get_post($post_id);
587 587
 
588
-	wp_raise_memory_limit( 'admin' );
588
+	wp_raise_memory_limit('admin');
589 589
 
590
-	$img = wp_get_image_editor( _load_image_to_edit_path( $post_id ) );
590
+	$img = wp_get_image_editor(_load_image_to_edit_path($post_id));
591 591
 
592
-	if ( is_wp_error( $img ) ) {
592
+	if (is_wp_error($img)) {
593 593
 		return false;
594 594
 	}
595 595
 
596
-	$changes = !empty($_REQUEST['history']) ? json_decode( wp_unslash($_REQUEST['history']) ) : null;
597
-	if ( $changes )
598
-		$img = image_edit_apply_changes( $img, $changes );
596
+	$changes = ! empty($_REQUEST['history']) ? json_decode(wp_unslash($_REQUEST['history'])) : null;
597
+	if ($changes)
598
+		$img = image_edit_apply_changes($img, $changes);
599 599
 
600 600
 	// Scale the image.
601 601
 	$size = $img->get_size();
602 602
 	$w = $size['width'];
603 603
 	$h = $size['height'];
604 604
 
605
-	$ratio = _image_get_preview_ratio( $w, $h );
606
-	$w2 = max ( 1, $w * $ratio );
607
-	$h2 = max ( 1, $h * $ratio );
605
+	$ratio = _image_get_preview_ratio($w, $h);
606
+	$w2 = max(1, $w * $ratio);
607
+	$h2 = max(1, $h * $ratio);
608 608
 
609
-	if ( is_wp_error( $img->resize( $w2, $h2 ) ) )
609
+	if (is_wp_error($img->resize($w2, $h2)))
610 610
 		return false;
611 611
 
612
-	return wp_stream_image( $img, $post->post_mime_type, $post_id );
612
+	return wp_stream_image($img, $post->post_mime_type, $post_id);
613 613
 }
614 614
 
615 615
 /**
@@ -623,30 +623,30 @@  discard block
 block discarded – undo
623 623
 function wp_restore_image($post_id) {
624 624
 	$meta = wp_get_attachment_metadata($post_id);
625 625
 	$file = get_attached_file($post_id);
626
-	$backup_sizes = $old_backup_sizes = get_post_meta( $post_id, '_wp_attachment_backup_sizes', true );
626
+	$backup_sizes = $old_backup_sizes = get_post_meta($post_id, '_wp_attachment_backup_sizes', true);
627 627
 	$restored = false;
628 628
 	$msg = new stdClass;
629 629
 
630
-	if ( !is_array($backup_sizes) ) {
630
+	if ( ! is_array($backup_sizes)) {
631 631
 		$msg->error = __('Cannot load image metadata.');
632 632
 		return $msg;
633 633
 	}
634 634
 
635 635
 	$parts = pathinfo($file);
636
-	$suffix = time() . rand(100, 999);
636
+	$suffix = time().rand(100, 999);
637 637
 	$default_sizes = get_intermediate_image_sizes();
638 638
 
639
-	if ( isset($backup_sizes['full-orig']) && is_array($backup_sizes['full-orig']) ) {
639
+	if (isset($backup_sizes['full-orig']) && is_array($backup_sizes['full-orig'])) {
640 640
 		$data = $backup_sizes['full-orig'];
641 641
 
642
-		if ( $parts['basename'] != $data['file'] ) {
643
-			if ( defined('IMAGE_EDIT_OVERWRITE') && IMAGE_EDIT_OVERWRITE ) {
642
+		if ($parts['basename'] != $data['file']) {
643
+			if (defined('IMAGE_EDIT_OVERWRITE') && IMAGE_EDIT_OVERWRITE) {
644 644
 
645 645
 				// Delete only if it's an edited image.
646
-				if ( preg_match('/-e[0-9]{13}\./', $parts['basename']) ) {
647
-					wp_delete_file( $file );
646
+				if (preg_match('/-e[0-9]{13}\./', $parts['basename'])) {
647
+					wp_delete_file($file);
648 648
 				}
649
-			} elseif ( isset( $meta['width'], $meta['height'] ) ) {
649
+			} elseif (isset($meta['width'], $meta['height'])) {
650 650
 				$backup_sizes["full-$suffix"] = array('width' => $meta['width'], 'height' => $meta['height'], 'file' => $parts['basename']);
651 651
 			}
652 652
 		}
@@ -654,21 +654,21 @@  discard block
 block discarded – undo
654 654
 		$restored_file = path_join($parts['dirname'], $data['file']);
655 655
 		$restored = update_attached_file($post_id, $restored_file);
656 656
 
657
-		$meta['file'] = _wp_relative_upload_path( $restored_file );
657
+		$meta['file'] = _wp_relative_upload_path($restored_file);
658 658
 		$meta['width'] = $data['width'];
659 659
 		$meta['height'] = $data['height'];
660 660
 	}
661 661
 
662
-	foreach ( $default_sizes as $default_size ) {
663
-		if ( isset($backup_sizes["$default_size-orig"]) ) {
662
+	foreach ($default_sizes as $default_size) {
663
+		if (isset($backup_sizes["$default_size-orig"])) {
664 664
 			$data = $backup_sizes["$default_size-orig"];
665
-			if ( isset($meta['sizes'][$default_size]) && $meta['sizes'][$default_size]['file'] != $data['file'] ) {
666
-				if ( defined('IMAGE_EDIT_OVERWRITE') && IMAGE_EDIT_OVERWRITE ) {
665
+			if (isset($meta['sizes'][$default_size]) && $meta['sizes'][$default_size]['file'] != $data['file']) {
666
+				if (defined('IMAGE_EDIT_OVERWRITE') && IMAGE_EDIT_OVERWRITE) {
667 667
 
668 668
 					// Delete only if it's an edited image.
669
-					if ( preg_match('/-e[0-9]{13}-/', $meta['sizes'][$default_size]['file']) ) {
670
-						$delete_file = path_join( $parts['dirname'], $meta['sizes'][$default_size]['file'] );
671
-						wp_delete_file( $delete_file );
669
+					if (preg_match('/-e[0-9]{13}-/', $meta['sizes'][$default_size]['file'])) {
670
+						$delete_file = path_join($parts['dirname'], $meta['sizes'][$default_size]['file']);
671
+						wp_delete_file($delete_file);
672 672
 					}
673 673
 				} else {
674 674
 					$backup_sizes["$default_size-{$suffix}"] = $meta['sizes'][$default_size];
@@ -681,14 +681,14 @@  discard block
 block discarded – undo
681 681
 		}
682 682
 	}
683 683
 
684
-	if ( ! wp_update_attachment_metadata( $post_id, $meta ) ||
685
-		( $old_backup_sizes !== $backup_sizes && ! update_post_meta( $post_id, '_wp_attachment_backup_sizes', $backup_sizes ) ) ) {
684
+	if ( ! wp_update_attachment_metadata($post_id, $meta) ||
685
+		($old_backup_sizes !== $backup_sizes && ! update_post_meta($post_id, '_wp_attachment_backup_sizes', $backup_sizes))) {
686 686
 
687 687
 		$msg->error = __('Cannot save image metadata.');
688 688
 		return $msg;
689 689
 	}
690 690
 
691
-	if ( !$restored )
691
+	if ( ! $restored)
692 692
 		$msg->error = __('Image metadata is inconsistent.');
693 693
 	else
694 694
 		$msg->msg = __('Image restored successfully.');
@@ -705,25 +705,25 @@  discard block
 block discarded – undo
705 705
  * @param int $post_id
706 706
  * @return \stdClass
707 707
  */
708
-function wp_save_image( $post_id ) {
708
+function wp_save_image($post_id) {
709 709
 	global $_wp_additional_image_sizes;
710 710
 
711 711
 	$return = new stdClass;
712 712
 	$success = $delete = $scaled = $nocrop = false;
713
-	$post = get_post( $post_id );
713
+	$post = get_post($post_id);
714 714
 
715
-	$img = wp_get_image_editor( _load_image_to_edit_path( $post_id, 'full' ) );
716
-	if ( is_wp_error( $img ) ) {
717
-		$return->error = esc_js( __('Unable to create new image.') );
715
+	$img = wp_get_image_editor(_load_image_to_edit_path($post_id, 'full'));
716
+	if (is_wp_error($img)) {
717
+		$return->error = esc_js(__('Unable to create new image.'));
718 718
 		return $return;
719 719
 	}
720 720
 
721
-	$fwidth = !empty($_REQUEST['fwidth']) ? intval($_REQUEST['fwidth']) : 0;
722
-	$fheight = !empty($_REQUEST['fheight']) ? intval($_REQUEST['fheight']) : 0;
723
-	$target = !empty($_REQUEST['target']) ? preg_replace('/[^a-z0-9_-]+/i', '', $_REQUEST['target']) : '';
724
-	$scale = !empty($_REQUEST['do']) && 'scale' == $_REQUEST['do'];
721
+	$fwidth = ! empty($_REQUEST['fwidth']) ? intval($_REQUEST['fwidth']) : 0;
722
+	$fheight = ! empty($_REQUEST['fheight']) ? intval($_REQUEST['fheight']) : 0;
723
+	$target = ! empty($_REQUEST['target']) ? preg_replace('/[^a-z0-9_-]+/i', '', $_REQUEST['target']) : '';
724
+	$scale = ! empty($_REQUEST['do']) && 'scale' == $_REQUEST['do'];
725 725
 
726
-	if ( $scale && $fwidth > 0 && $fheight > 0 ) {
726
+	if ($scale && $fwidth > 0 && $fheight > 0) {
727 727
 		$size = $img->get_size();
728 728
 		$sX = $size['width'];
729 729
 		$sY = $size['height'];
@@ -732,54 +732,54 @@  discard block
 block discarded – undo
732 732
 		$diff = round($sX / $sY, 2) - round($fwidth / $fheight, 2);
733 733
 		if ( -0.1 < $diff && $diff < 0.1 ) {
734 734
 			// Scale the full size image.
735
-			if ( $img->resize( $fwidth, $fheight ) )
735
+			if ($img->resize($fwidth, $fheight))
736 736
 				$scaled = true;
737 737
 		}
738 738
 
739
-		if ( !$scaled ) {
740
-			$return->error = esc_js( __('Error while saving the scaled image. Please reload the page and try again.') );
739
+		if ( ! $scaled) {
740
+			$return->error = esc_js(__('Error while saving the scaled image. Please reload the page and try again.'));
741 741
 			return $return;
742 742
 		}
743
-	} elseif ( !empty($_REQUEST['history']) ) {
744
-		$changes = json_decode( wp_unslash($_REQUEST['history']) );
745
-		if ( $changes )
743
+	} elseif ( ! empty($_REQUEST['history'])) {
744
+		$changes = json_decode(wp_unslash($_REQUEST['history']));
745
+		if ($changes)
746 746
 			$img = image_edit_apply_changes($img, $changes);
747 747
 	} else {
748
-		$return->error = esc_js( __('Nothing to save, the image has not changed.') );
748
+		$return->error = esc_js(__('Nothing to save, the image has not changed.'));
749 749
 		return $return;
750 750
 	}
751 751
 
752 752
 	$meta = wp_get_attachment_metadata($post_id);
753
-	$backup_sizes = get_post_meta( $post->ID, '_wp_attachment_backup_sizes', true );
753
+	$backup_sizes = get_post_meta($post->ID, '_wp_attachment_backup_sizes', true);
754 754
 
755
-	if ( !is_array($meta) ) {
756
-		$return->error = esc_js( __('Image data does not exist. Please re-upload the image.') );
755
+	if ( ! is_array($meta)) {
756
+		$return->error = esc_js(__('Image data does not exist. Please re-upload the image.'));
757 757
 		return $return;
758 758
 	}
759 759
 
760
-	if ( !is_array($backup_sizes) )
760
+	if ( ! is_array($backup_sizes))
761 761
 		$backup_sizes = array();
762 762
 
763 763
 	// Generate new filename.
764 764
 	$path = get_attached_file($post_id);
765
-	$path_parts = pathinfo( $path );
765
+	$path_parts = pathinfo($path);
766 766
 	$filename = $path_parts['filename'];
767
-	$suffix = time() . rand(100, 999);
767
+	$suffix = time().rand(100, 999);
768 768
 
769
-	if ( defined('IMAGE_EDIT_OVERWRITE') && IMAGE_EDIT_OVERWRITE &&
770
-		isset($backup_sizes['full-orig']) && $backup_sizes['full-orig']['file'] != $path_parts['basename'] ) {
769
+	if (defined('IMAGE_EDIT_OVERWRITE') && IMAGE_EDIT_OVERWRITE &&
770
+		isset($backup_sizes['full-orig']) && $backup_sizes['full-orig']['file'] != $path_parts['basename']) {
771 771
 
772
-		if ( 'thumbnail' == $target )
772
+		if ('thumbnail' == $target)
773 773
 			$new_path = "{$path_parts['dirname']}/{$filename}-temp.{$path_parts['extension']}";
774 774
 		else
775 775
 			$new_path = $path;
776 776
 	} else {
777
-		while( true ) {
778
-			$filename = preg_replace( '/-e([0-9]+)$/', '', $filename );
777
+		while (true) {
778
+			$filename = preg_replace('/-e([0-9]+)$/', '', $filename);
779 779
 			$filename .= "-e{$suffix}";
780 780
 			$new_filename = "{$filename}.{$path_parts['extension']}";
781 781
 			$new_path = "{$path_parts['dirname']}/$new_filename";
782
-			if ( file_exists($new_path) )
782
+			if (file_exists($new_path))
783 783
 				$suffix++;
784 784
 			else
785 785
 				break;
@@ -787,41 +787,41 @@  discard block
 block discarded – undo
787 787
 	}
788 788
 
789 789
 	// Save the full-size file, also needed to create sub-sizes.
790
-	if ( !wp_save_image_file($new_path, $img, $post->post_mime_type, $post_id) ) {
791
-		$return->error = esc_js( __('Unable to save the image.') );
790
+	if ( ! wp_save_image_file($new_path, $img, $post->post_mime_type, $post_id)) {
791
+		$return->error = esc_js(__('Unable to save the image.'));
792 792
 		return $return;
793 793
 	}
794 794
 
795
-	if ( 'nothumb' == $target || 'all' == $target || 'full' == $target || $scaled ) {
795
+	if ('nothumb' == $target || 'all' == $target || 'full' == $target || $scaled) {
796 796
 		$tag = false;
797
-		if ( isset($backup_sizes['full-orig']) ) {
798
-			if ( ( !defined('IMAGE_EDIT_OVERWRITE') || !IMAGE_EDIT_OVERWRITE ) && $backup_sizes['full-orig']['file'] != $path_parts['basename'] )
797
+		if (isset($backup_sizes['full-orig'])) {
798
+			if (( ! defined('IMAGE_EDIT_OVERWRITE') || ! IMAGE_EDIT_OVERWRITE) && $backup_sizes['full-orig']['file'] != $path_parts['basename'])
799 799
 				$tag = "full-$suffix";
800 800
 		} else {
801 801
 			$tag = 'full-orig';
802 802
 		}
803 803
 
804
-		if ( $tag )
804
+		if ($tag)
805 805
 			$backup_sizes[$tag] = array('width' => $meta['width'], 'height' => $meta['height'], 'file' => $path_parts['basename']);
806 806
 
807
-		$success = ( $path === $new_path ) || update_attached_file( $post_id, $new_path );
807
+		$success = ($path === $new_path) || update_attached_file($post_id, $new_path);
808 808
 
809
-		$meta['file'] = _wp_relative_upload_path( $new_path );
809
+		$meta['file'] = _wp_relative_upload_path($new_path);
810 810
 
811 811
 		$size = $img->get_size();
812 812
 		$meta['width'] = $size['width'];
813 813
 		$meta['height'] = $size['height'];
814 814
 
815
-		if ( $success && ('nothumb' == $target || 'all' == $target) ) {
815
+		if ($success && ('nothumb' == $target || 'all' == $target)) {
816 816
 			$sizes = get_intermediate_image_sizes();
817
-			if ( 'nothumb' == $target )
818
-				$sizes = array_diff( $sizes, array('thumbnail') );
817
+			if ('nothumb' == $target)
818
+				$sizes = array_diff($sizes, array('thumbnail'));
819 819
 		}
820 820
 
821 821
 		$return->fw = $meta['width'];
822 822
 		$return->fh = $meta['height'];
823
-	} elseif ( 'thumbnail' == $target ) {
824
-		$sizes = array( 'thumbnail' );
823
+	} elseif ('thumbnail' == $target) {
824
+		$sizes = array('thumbnail');
825 825
 		$success = $delete = $nocrop = true;
826 826
 	}
827 827
 
@@ -831,63 +831,63 @@  discard block
 block discarded – undo
831 831
 	 * keeping the new resized images from overwriting the existing image files.
832 832
 	 * https://core.trac.wordpress.org/ticket/32171
833 833
 	 */
834
-	if ( defined( 'IMAGE_EDIT_OVERWRITE' ) && IMAGE_EDIT_OVERWRITE && ! empty( $meta['sizes'] ) ) {
835
-		foreach ( $meta['sizes'] as $size ) {
836
-			if ( ! empty( $size['file'] ) && preg_match( '/-e[0-9]{13}-/', $size['file'] ) ) {
837
-				$delete_file = path_join( $path_parts['dirname'], $size['file'] );
838
-				wp_delete_file( $delete_file );
834
+	if (defined('IMAGE_EDIT_OVERWRITE') && IMAGE_EDIT_OVERWRITE && ! empty($meta['sizes'])) {
835
+		foreach ($meta['sizes'] as $size) {
836
+			if ( ! empty($size['file']) && preg_match('/-e[0-9]{13}-/', $size['file'])) {
837
+				$delete_file = path_join($path_parts['dirname'], $size['file']);
838
+				wp_delete_file($delete_file);
839 839
 			}
840 840
 		}
841 841
 	}
842 842
 
843
-	if ( isset( $sizes ) ) {
843
+	if (isset($sizes)) {
844 844
 		$_sizes = array();
845 845
 
846
-		foreach ( $sizes as $size ) {
846
+		foreach ($sizes as $size) {
847 847
 			$tag = false;
848
-			if ( isset( $meta['sizes'][$size] ) ) {
849
-				if ( isset($backup_sizes["$size-orig"]) ) {
850
-					if ( ( !defined('IMAGE_EDIT_OVERWRITE') || !IMAGE_EDIT_OVERWRITE ) && $backup_sizes["$size-orig"]['file'] != $meta['sizes'][$size]['file'] )
848
+			if (isset($meta['sizes'][$size])) {
849
+				if (isset($backup_sizes["$size-orig"])) {
850
+					if (( ! defined('IMAGE_EDIT_OVERWRITE') || ! IMAGE_EDIT_OVERWRITE) && $backup_sizes["$size-orig"]['file'] != $meta['sizes'][$size]['file'])
851 851
 						$tag = "$size-$suffix";
852 852
 				} else {
853 853
 					$tag = "$size-orig";
854 854
 				}
855 855
 
856
-				if ( $tag )
856
+				if ($tag)
857 857
 					$backup_sizes[$tag] = $meta['sizes'][$size];
858 858
 			}
859 859
 
860
-			if ( isset( $_wp_additional_image_sizes[ $size ] ) ) {
861
-				$width  = intval( $_wp_additional_image_sizes[ $size ]['width'] );
862
-				$height = intval( $_wp_additional_image_sizes[ $size ]['height'] );
863
-				$crop   = ( $nocrop ) ? false : $_wp_additional_image_sizes[ $size ]['crop'];
860
+			if (isset($_wp_additional_image_sizes[$size])) {
861
+				$width  = intval($_wp_additional_image_sizes[$size]['width']);
862
+				$height = intval($_wp_additional_image_sizes[$size]['height']);
863
+				$crop   = ($nocrop) ? false : $_wp_additional_image_sizes[$size]['crop'];
864 864
 			} else {
865
-				$height = get_option( "{$size}_size_h" );
866
-				$width  = get_option( "{$size}_size_w" );
867
-				$crop   = ( $nocrop ) ? false : get_option( "{$size}_crop" );
865
+				$height = get_option("{$size}_size_h");
866
+				$width  = get_option("{$size}_size_w");
867
+				$crop   = ($nocrop) ? false : get_option("{$size}_crop");
868 868
 			}
869 869
 
870
-			$_sizes[ $size ] = array( 'width' => $width, 'height' => $height, 'crop' => $crop );
870
+			$_sizes[$size] = array('width' => $width, 'height' => $height, 'crop' => $crop);
871 871
 		}
872 872
 
873
-		$meta['sizes'] = array_merge( $meta['sizes'], $img->multi_resize( $_sizes ) );
873
+		$meta['sizes'] = array_merge($meta['sizes'], $img->multi_resize($_sizes));
874 874
 	}
875 875
 
876
-	unset( $img );
876
+	unset($img);
877 877
 
878
-	if ( $success ) {
879
-		wp_update_attachment_metadata( $post_id, $meta );
880
-		update_post_meta( $post_id, '_wp_attachment_backup_sizes', $backup_sizes);
878
+	if ($success) {
879
+		wp_update_attachment_metadata($post_id, $meta);
880
+		update_post_meta($post_id, '_wp_attachment_backup_sizes', $backup_sizes);
881 881
 
882
-		if ( $target == 'thumbnail' || $target == 'all' || $target == 'full' ) {
882
+		if ($target == 'thumbnail' || $target == 'all' || $target == 'full') {
883 883
 			// Check if it's an image edit from attachment edit screen
884
-			if ( ! empty( $_REQUEST['context'] ) && 'edit-attachment' == $_REQUEST['context'] ) {
885
-				$thumb_url = wp_get_attachment_image_src( $post_id, array( 900, 600 ), true );
884
+			if ( ! empty($_REQUEST['context']) && 'edit-attachment' == $_REQUEST['context']) {
885
+				$thumb_url = wp_get_attachment_image_src($post_id, array(900, 600), true);
886 886
 				$return->thumbnail = $thumb_url[0];
887 887
 			} else {
888 888
 				$file_url = wp_get_attachment_url($post_id);
889
-				if ( ! empty( $meta['sizes']['thumbnail'] ) && $thumb = $meta['sizes']['thumbnail'] ) {
890
-					$return->thumbnail = path_join( dirname($file_url), $thumb['file'] );
889
+				if ( ! empty($meta['sizes']['thumbnail']) && $thumb = $meta['sizes']['thumbnail']) {
890
+					$return->thumbnail = path_join(dirname($file_url), $thumb['file']);
891 891
 				} else {
892 892
 					$return->thumbnail = "$file_url?w=128&h=128";
893 893
 				}
@@ -897,10 +897,10 @@  discard block
 block discarded – undo
897 897
 		$delete = true;
898 898
 	}
899 899
 
900
-	if ( $delete ) {
901
-		wp_delete_file( $new_path );
900
+	if ($delete) {
901
+		wp_delete_file($new_path);
902 902
 	}
903 903
 
904
-	$return->msg = esc_js( __('Image saved') );
904
+	$return->msg = esc_js(__('Image saved'));
905 905
 	return $return;
906 906
 }
Please login to merge, or discard this patch.
Braces   +89 added lines, -64 removed lines patch added patch discarded remove patch
@@ -20,23 +20,26 @@  discard block
 block discarded – undo
20 20
 	$sub_sizes = isset($meta['sizes']) && is_array($meta['sizes']);
21 21
 	$note = '';
22 22
 
23
-	if ( isset( $meta['width'], $meta['height'] ) )
24
-		$big = max( $meta['width'], $meta['height'] );
25
-	else
26
-		die( __('Image data does not exist. Please re-upload the image.') );
23
+	if ( isset( $meta['width'], $meta['height'] ) ) {
24
+			$big = max( $meta['width'], $meta['height'] );
25
+	} else {
26
+			die( __('Image data does not exist. Please re-upload the image.') );
27
+	}
27 28
 
28 29
 	$sizer = $big > 400 ? 400 / $big : 1;
29 30
 
30 31
 	$backup_sizes = get_post_meta( $post_id, '_wp_attachment_backup_sizes', true );
31 32
 	$can_restore = false;
32
-	if ( ! empty( $backup_sizes ) && isset( $backup_sizes['full-orig'], $meta['file'] ) )
33
-		$can_restore = $backup_sizes['full-orig']['file'] != basename( $meta['file'] );
33
+	if ( ! empty( $backup_sizes ) && isset( $backup_sizes['full-orig'], $meta['file'] ) ) {
34
+			$can_restore = $backup_sizes['full-orig']['file'] != basename( $meta['file'] );
35
+	}
34 36
 
35 37
 	if ( $msg ) {
36
-		if ( isset($msg->error) )
37
-			$note = "<div class='error'><p>$msg->error</p></div>";
38
-		elseif ( isset($msg->msg) )
39
-			$note = "<div class='updated'><p>$msg->msg</p></div>";
38
+		if ( isset($msg->error) ) {
39
+					$note = "<div class='error'><p>$msg->error</p></div>";
40
+		} elseif ( isset($msg->msg) ) {
41
+					$note = "<div class='updated'><p>$msg->msg</p></div>";
42
+		}
40 43
 	}
41 44
 
42 45
 	?>
@@ -83,8 +86,9 @@  discard block
 block discarded – undo
83 86
 		<div class="imgedit-help">
84 87
 		<p><?php _e('Discard any changes and restore the original image.');
85 88
 
86
-		if ( !defined('IMAGE_EDIT_OVERWRITE') || !IMAGE_EDIT_OVERWRITE )
87
-			echo ' '.__('Previously edited copies of the image will not be deleted.');
89
+		if ( !defined('IMAGE_EDIT_OVERWRITE') || !IMAGE_EDIT_OVERWRITE ) {
90
+					echo ' '.__('Previously edited copies of the image will not be deleted.');
91
+		}
88 92
 
89 93
 		?></p>
90 94
 		<div class="imgedit-submit">
@@ -251,8 +255,9 @@  discard block
 block discarded – undo
251 255
 		 */
252 256
 		$image = apply_filters( 'image_editor_save_pre', $image, $post_id );
253 257
 
254
-		if ( is_wp_error( $image->stream( $mime_type ) ) )
255
-			return false;
258
+		if ( is_wp_error( $image->stream( $mime_type ) ) ) {
259
+					return false;
260
+		}
256 261
 
257 262
 		return true;
258 263
 	} else {
@@ -316,8 +321,9 @@  discard block
 block discarded – undo
316 321
 		 */
317 322
 		$saved = apply_filters( 'wp_save_image_editor_file', null, $filename, $image, $mime_type, $post_id );
318 323
 
319
-		if ( null !== $saved )
320
-			return $saved;
324
+		if ( null !== $saved ) {
325
+					return $saved;
326
+		}
321 327
 
322 328
 		return $image->save( $filename, $mime_type );
323 329
 	} else {
@@ -343,8 +349,9 @@  discard block
 block discarded – undo
343 349
 		 */
344 350
 		$saved = apply_filters( 'wp_save_image_file', null, $filename, $image, $mime_type, $post_id );
345 351
 
346
-		if ( null !== $saved )
347
-			return $saved;
352
+		if ( null !== $saved ) {
353
+					return $saved;
354
+		}
348 355
 
349 356
 		switch ( $mime_type ) {
350 357
 			case 'image/jpeg':
@@ -462,11 +469,13 @@  discard block
 block discarded – undo
462 469
  * @return WP_Image_Editor WP_Image_Editor instance with changes applied.
463 470
  */
464 471
 function image_edit_apply_changes( $image, $changes ) {
465
-	if ( is_resource( $image ) )
466
-		_deprecated_argument( __FUNCTION__, '3.5.0', __( '$image needs to be an WP_Image_Editor object' ) );
472
+	if ( is_resource( $image ) ) {
473
+			_deprecated_argument( __FUNCTION__, '3.5.0', __( '$image needs to be an WP_Image_Editor object' ) );
474
+	}
467 475
 
468
-	if ( !is_array($changes) )
469
-		return $image;
476
+	if ( !is_array($changes) ) {
477
+			return $image;
478
+	}
470 479
 
471 480
 	// Expand change operations.
472 481
 	foreach ( $changes as $key => $obj ) {
@@ -503,8 +512,9 @@  discard block
 block discarded – undo
503 512
 						break;
504 513
 				}
505 514
 			}
506
-			if ( !$combined )
507
-				$filtered[++$i] = $changes[$j];
515
+			if ( !$combined ) {
516
+							$filtered[++$i] = $changes[$j];
517
+			}
508 518
 		}
509 519
 		$changes = $filtered;
510 520
 		unset($filtered);
@@ -540,18 +550,20 @@  discard block
 block discarded – undo
540 550
 		switch ( $operation->type ) {
541 551
 			case 'rotate':
542 552
 				if ( $operation->angle != 0 ) {
543
-					if ( $image instanceof WP_Image_Editor )
544
-						$image->rotate( $operation->angle );
545
-					else
546
-						$image = _rotate_image_resource( $image, $operation->angle );
553
+					if ( $image instanceof WP_Image_Editor ) {
554
+											$image->rotate( $operation->angle );
555
+					} else {
556
+											$image = _rotate_image_resource( $image, $operation->angle );
557
+					}
547 558
 				}
548 559
 				break;
549 560
 			case 'flip':
550
-				if ( $operation->axis != 0 )
551
-					if ( $image instanceof WP_Image_Editor )
561
+				if ( $operation->axis != 0 ) {
562
+									if ( $image instanceof WP_Image_Editor )
552 563
 						$image->flip( ($operation->axis & 1) != 0, ($operation->axis & 2) != 0 );
553
-					else
554
-						$image = _flip_image_resource( $image, ( $operation->axis & 1 ) != 0, ( $operation->axis & 2 ) != 0 );
564
+				} else {
565
+											$image = _flip_image_resource( $image, ( $operation->axis & 1 ) != 0, ( $operation->axis & 2 ) != 0 );
566
+					}
555 567
 				break;
556 568
 			case 'crop':
557 569
 				$sel = $operation->sel;
@@ -594,8 +606,9 @@  discard block
 block discarded – undo
594 606
 	}
595 607
 
596 608
 	$changes = !empty($_REQUEST['history']) ? json_decode( wp_unslash($_REQUEST['history']) ) : null;
597
-	if ( $changes )
598
-		$img = image_edit_apply_changes( $img, $changes );
609
+	if ( $changes ) {
610
+			$img = image_edit_apply_changes( $img, $changes );
611
+	}
599 612
 
600 613
 	// Scale the image.
601 614
 	$size = $img->get_size();
@@ -606,8 +619,9 @@  discard block
 block discarded – undo
606 619
 	$w2 = max ( 1, $w * $ratio );
607 620
 	$h2 = max ( 1, $h * $ratio );
608 621
 
609
-	if ( is_wp_error( $img->resize( $w2, $h2 ) ) )
610
-		return false;
622
+	if ( is_wp_error( $img->resize( $w2, $h2 ) ) ) {
623
+			return false;
624
+	}
611 625
 
612 626
 	return wp_stream_image( $img, $post->post_mime_type, $post_id );
613 627
 }
@@ -688,10 +702,11 @@  discard block
 block discarded – undo
688 702
 		return $msg;
689 703
 	}
690 704
 
691
-	if ( !$restored )
692
-		$msg->error = __('Image metadata is inconsistent.');
693
-	else
694
-		$msg->msg = __('Image restored successfully.');
705
+	if ( !$restored ) {
706
+			$msg->error = __('Image metadata is inconsistent.');
707
+	} else {
708
+			$msg->msg = __('Image restored successfully.');
709
+	}
695 710
 
696 711
 	return $msg;
697 712
 }
@@ -732,8 +747,9 @@  discard block
 block discarded – undo
732 747
 		$diff = round($sX / $sY, 2) - round($fwidth / $fheight, 2);
733 748
 		if ( -0.1 < $diff && $diff < 0.1 ) {
734 749
 			// Scale the full size image.
735
-			if ( $img->resize( $fwidth, $fheight ) )
736
-				$scaled = true;
750
+			if ( $img->resize( $fwidth, $fheight ) ) {
751
+							$scaled = true;
752
+			}
737 753
 		}
738 754
 
739 755
 		if ( !$scaled ) {
@@ -742,8 +758,9 @@  discard block
 block discarded – undo
742 758
 		}
743 759
 	} elseif ( !empty($_REQUEST['history']) ) {
744 760
 		$changes = json_decode( wp_unslash($_REQUEST['history']) );
745
-		if ( $changes )
746
-			$img = image_edit_apply_changes($img, $changes);
761
+		if ( $changes ) {
762
+					$img = image_edit_apply_changes($img, $changes);
763
+		}
747 764
 	} else {
748 765
 		$return->error = esc_js( __('Nothing to save, the image has not changed.') );
749 766
 		return $return;
@@ -757,8 +774,9 @@  discard block
 block discarded – undo
757 774
 		return $return;
758 775
 	}
759 776
 
760
-	if ( !is_array($backup_sizes) )
761
-		$backup_sizes = array();
777
+	if ( !is_array($backup_sizes) ) {
778
+			$backup_sizes = array();
779
+	}
762 780
 
763 781
 	// Generate new filename.
764 782
 	$path = get_attached_file($post_id);
@@ -769,20 +787,22 @@  discard block
 block discarded – undo
769 787
 	if ( defined('IMAGE_EDIT_OVERWRITE') && IMAGE_EDIT_OVERWRITE &&
770 788
 		isset($backup_sizes['full-orig']) && $backup_sizes['full-orig']['file'] != $path_parts['basename'] ) {
771 789
 
772
-		if ( 'thumbnail' == $target )
773
-			$new_path = "{$path_parts['dirname']}/{$filename}-temp.{$path_parts['extension']}";
774
-		else
775
-			$new_path = $path;
790
+		if ( 'thumbnail' == $target ) {
791
+					$new_path = "{$path_parts['dirname']}/{$filename}-temp.{$path_parts['extension']}";
792
+		} else {
793
+					$new_path = $path;
794
+		}
776 795
 	} else {
777 796
 		while( true ) {
778 797
 			$filename = preg_replace( '/-e([0-9]+)$/', '', $filename );
779 798
 			$filename .= "-e{$suffix}";
780 799
 			$new_filename = "{$filename}.{$path_parts['extension']}";
781 800
 			$new_path = "{$path_parts['dirname']}/$new_filename";
782
-			if ( file_exists($new_path) )
783
-				$suffix++;
784
-			else
785
-				break;
801
+			if ( file_exists($new_path) ) {
802
+							$suffix++;
803
+			} else {
804
+							break;
805
+			}
786 806
 		}
787 807
 	}
788 808
 
@@ -795,14 +815,16 @@  discard block
 block discarded – undo
795 815
 	if ( 'nothumb' == $target || 'all' == $target || 'full' == $target || $scaled ) {
796 816
 		$tag = false;
797 817
 		if ( isset($backup_sizes['full-orig']) ) {
798
-			if ( ( !defined('IMAGE_EDIT_OVERWRITE') || !IMAGE_EDIT_OVERWRITE ) && $backup_sizes['full-orig']['file'] != $path_parts['basename'] )
799
-				$tag = "full-$suffix";
818
+			if ( ( !defined('IMAGE_EDIT_OVERWRITE') || !IMAGE_EDIT_OVERWRITE ) && $backup_sizes['full-orig']['file'] != $path_parts['basename'] ) {
819
+							$tag = "full-$suffix";
820
+			}
800 821
 		} else {
801 822
 			$tag = 'full-orig';
802 823
 		}
803 824
 
804
-		if ( $tag )
805
-			$backup_sizes[$tag] = array('width' => $meta['width'], 'height' => $meta['height'], 'file' => $path_parts['basename']);
825
+		if ( $tag ) {
826
+					$backup_sizes[$tag] = array('width' => $meta['width'], 'height' => $meta['height'], 'file' => $path_parts['basename']);
827
+		}
806 828
 
807 829
 		$success = ( $path === $new_path ) || update_attached_file( $post_id, $new_path );
808 830
 
@@ -814,8 +836,9 @@  discard block
 block discarded – undo
814 836
 
815 837
 		if ( $success && ('nothumb' == $target || 'all' == $target) ) {
816 838
 			$sizes = get_intermediate_image_sizes();
817
-			if ( 'nothumb' == $target )
818
-				$sizes = array_diff( $sizes, array('thumbnail') );
839
+			if ( 'nothumb' == $target ) {
840
+							$sizes = array_diff( $sizes, array('thumbnail') );
841
+			}
819 842
 		}
820 843
 
821 844
 		$return->fw = $meta['width'];
@@ -847,14 +870,16 @@  discard block
 block discarded – undo
847 870
 			$tag = false;
848 871
 			if ( isset( $meta['sizes'][$size] ) ) {
849 872
 				if ( isset($backup_sizes["$size-orig"]) ) {
850
-					if ( ( !defined('IMAGE_EDIT_OVERWRITE') || !IMAGE_EDIT_OVERWRITE ) && $backup_sizes["$size-orig"]['file'] != $meta['sizes'][$size]['file'] )
851
-						$tag = "$size-$suffix";
873
+					if ( ( !defined('IMAGE_EDIT_OVERWRITE') || !IMAGE_EDIT_OVERWRITE ) && $backup_sizes["$size-orig"]['file'] != $meta['sizes'][$size]['file'] ) {
874
+											$tag = "$size-$suffix";
875
+					}
852 876
 				} else {
853 877
 					$tag = "$size-orig";
854 878
 				}
855 879
 
856
-				if ( $tag )
857
-					$backup_sizes[$tag] = $meta['sizes'][$size];
880
+				if ( $tag ) {
881
+									$backup_sizes[$tag] = $meta['sizes'][$size];
882
+				}
858 883
 			}
859 884
 
860 885
 			if ( isset( $_wp_additional_image_sizes[ $size ] ) ) {
Please login to merge, or discard this patch.
src/wp-includes/class-feed.php 1 patch
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
 	 * @access public
99 99
 	 *
100 100
 	 * @param SimplePie $data Data to save.
101
-	 * @return true Always true.
101
+	 * @return boolean Always true.
102 102
 	 */
103 103
 	public function save($data) {
104 104
 		if ( $data instanceof SimplePie ) {
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
 	 * @since 2.8.0
153 153
 	 * @access public
154 154
 	 *
155
-	 * @return true Always true.
155
+	 * @return boolean Always true.
156 156
 	 */
157 157
 	public function unlink() {
158 158
 		delete_transient($this->name);
Please login to merge, or discard this patch.
src/wp-includes/class-wp-customize-manager.php 2 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -337,8 +337,8 @@
 block discarded – undo
337 337
 	 *
338 338
 	 * @since 3.4.0
339 339
 	 *
340
-	 * @param mixed $ajax_message Ajax return
341
-	 * @param mixed $message UI message
340
+	 * @param integer $ajax_message Ajax return
341
+	 * @param string $message UI message
342 342
 	 */
343 343
 	protected function wp_die( $ajax_message, $message = null ) {
344 344
 		if ( $this->doing_ajax() || isset( $_POST['customized'] ) ) {
Please login to merge, or discard this patch.
Spacing   +526 added lines, -526 removed lines patch added patch discarded remove patch
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
 	 * @access protected
110 110
 	 * @var array
111 111
 	 */
112
-	protected $components = array( 'widgets', 'nav_menus' );
112
+	protected $components = array('widgets', 'nav_menus');
113 113
 
114 114
 	/**
115 115
 	 * Registered instances of WP_Customize_Section.
@@ -205,41 +205,41 @@  discard block
 block discarded – undo
205 205
 	 * @since 3.4.0
206 206
 	 */
207 207
 	public function __construct() {
208
-		require_once( ABSPATH . WPINC . '/class-wp-customize-setting.php' );
209
-		require_once( ABSPATH . WPINC . '/class-wp-customize-panel.php' );
210
-		require_once( ABSPATH . WPINC . '/class-wp-customize-section.php' );
211
-		require_once( ABSPATH . WPINC . '/class-wp-customize-control.php' );
212
-
213
-		require_once( ABSPATH . WPINC . '/customize/class-wp-customize-color-control.php' );
214
-		require_once( ABSPATH . WPINC . '/customize/class-wp-customize-media-control.php' );
215
-		require_once( ABSPATH . WPINC . '/customize/class-wp-customize-upload-control.php' );
216
-		require_once( ABSPATH . WPINC . '/customize/class-wp-customize-image-control.php' );
217
-		require_once( ABSPATH . WPINC . '/customize/class-wp-customize-background-image-control.php' );
218
-		require_once( ABSPATH . WPINC . '/customize/class-wp-customize-cropped-image-control.php' );
219
-		require_once( ABSPATH . WPINC . '/customize/class-wp-customize-site-icon-control.php' );
220
-		require_once( ABSPATH . WPINC . '/customize/class-wp-customize-header-image-control.php' );
221
-		require_once( ABSPATH . WPINC . '/customize/class-wp-customize-theme-control.php' );
222
-		require_once( ABSPATH . WPINC . '/customize/class-wp-widget-area-customize-control.php' );
223
-		require_once( ABSPATH . WPINC . '/customize/class-wp-widget-form-customize-control.php' );
224
-		require_once( ABSPATH . WPINC . '/customize/class-wp-customize-nav-menu-control.php' );
225
-		require_once( ABSPATH . WPINC . '/customize/class-wp-customize-nav-menu-item-control.php' );
226
-		require_once( ABSPATH . WPINC . '/customize/class-wp-customize-nav-menu-location-control.php' );
227
-		require_once( ABSPATH . WPINC . '/customize/class-wp-customize-nav-menu-name-control.php' );
228
-		require_once( ABSPATH . WPINC . '/customize/class-wp-customize-nav-menu-auto-add-control.php' );
229
-		require_once( ABSPATH . WPINC . '/customize/class-wp-customize-new-menu-control.php' );
230
-
231
-		require_once( ABSPATH . WPINC . '/customize/class-wp-customize-nav-menus-panel.php' );
232
-
233
-		require_once( ABSPATH . WPINC . '/customize/class-wp-customize-themes-section.php' );
234
-		require_once( ABSPATH . WPINC . '/customize/class-wp-customize-sidebar-section.php' );
235
-		require_once( ABSPATH . WPINC . '/customize/class-wp-customize-nav-menu-section.php' );
236
-		require_once( ABSPATH . WPINC . '/customize/class-wp-customize-new-menu-section.php' );
237
-
238
-		require_once( ABSPATH . WPINC . '/customize/class-wp-customize-filter-setting.php' );
239
-		require_once( ABSPATH . WPINC . '/customize/class-wp-customize-header-image-setting.php' );
240
-		require_once( ABSPATH . WPINC . '/customize/class-wp-customize-background-image-setting.php' );
241
-		require_once( ABSPATH . WPINC . '/customize/class-wp-customize-nav-menu-item-setting.php' );
242
-		require_once( ABSPATH . WPINC . '/customize/class-wp-customize-nav-menu-setting.php' );
208
+		require_once(ABSPATH.WPINC.'/class-wp-customize-setting.php');
209
+		require_once(ABSPATH.WPINC.'/class-wp-customize-panel.php');
210
+		require_once(ABSPATH.WPINC.'/class-wp-customize-section.php');
211
+		require_once(ABSPATH.WPINC.'/class-wp-customize-control.php');
212
+
213
+		require_once(ABSPATH.WPINC.'/customize/class-wp-customize-color-control.php');
214
+		require_once(ABSPATH.WPINC.'/customize/class-wp-customize-media-control.php');
215
+		require_once(ABSPATH.WPINC.'/customize/class-wp-customize-upload-control.php');
216
+		require_once(ABSPATH.WPINC.'/customize/class-wp-customize-image-control.php');
217
+		require_once(ABSPATH.WPINC.'/customize/class-wp-customize-background-image-control.php');
218
+		require_once(ABSPATH.WPINC.'/customize/class-wp-customize-cropped-image-control.php');
219
+		require_once(ABSPATH.WPINC.'/customize/class-wp-customize-site-icon-control.php');
220
+		require_once(ABSPATH.WPINC.'/customize/class-wp-customize-header-image-control.php');
221
+		require_once(ABSPATH.WPINC.'/customize/class-wp-customize-theme-control.php');
222
+		require_once(ABSPATH.WPINC.'/customize/class-wp-widget-area-customize-control.php');
223
+		require_once(ABSPATH.WPINC.'/customize/class-wp-widget-form-customize-control.php');
224
+		require_once(ABSPATH.WPINC.'/customize/class-wp-customize-nav-menu-control.php');
225
+		require_once(ABSPATH.WPINC.'/customize/class-wp-customize-nav-menu-item-control.php');
226
+		require_once(ABSPATH.WPINC.'/customize/class-wp-customize-nav-menu-location-control.php');
227
+		require_once(ABSPATH.WPINC.'/customize/class-wp-customize-nav-menu-name-control.php');
228
+		require_once(ABSPATH.WPINC.'/customize/class-wp-customize-nav-menu-auto-add-control.php');
229
+		require_once(ABSPATH.WPINC.'/customize/class-wp-customize-new-menu-control.php');
230
+
231
+		require_once(ABSPATH.WPINC.'/customize/class-wp-customize-nav-menus-panel.php');
232
+
233
+		require_once(ABSPATH.WPINC.'/customize/class-wp-customize-themes-section.php');
234
+		require_once(ABSPATH.WPINC.'/customize/class-wp-customize-sidebar-section.php');
235
+		require_once(ABSPATH.WPINC.'/customize/class-wp-customize-nav-menu-section.php');
236
+		require_once(ABSPATH.WPINC.'/customize/class-wp-customize-new-menu-section.php');
237
+
238
+		require_once(ABSPATH.WPINC.'/customize/class-wp-customize-filter-setting.php');
239
+		require_once(ABSPATH.WPINC.'/customize/class-wp-customize-header-image-setting.php');
240
+		require_once(ABSPATH.WPINC.'/customize/class-wp-customize-background-image-setting.php');
241
+		require_once(ABSPATH.WPINC.'/customize/class-wp-customize-nav-menu-item-setting.php');
242
+		require_once(ABSPATH.WPINC.'/customize/class-wp-customize-nav-menu-setting.php');
243 243
 
244 244
 		/**
245 245
 		 * Filters the core Customizer components to load.
@@ -256,52 +256,52 @@  discard block
 block discarded – undo
256 256
 		 * @param array                $components List of core components to load.
257 257
 		 * @param WP_Customize_Manager $this       WP_Customize_Manager instance.
258 258
 		 */
259
-		$components = apply_filters( 'customize_loaded_components', $this->components, $this );
259
+		$components = apply_filters('customize_loaded_components', $this->components, $this);
260 260
 
261
-		require_once( ABSPATH . WPINC . '/customize/class-wp-customize-selective-refresh.php' );
262
-		$this->selective_refresh = new WP_Customize_Selective_Refresh( $this );
261
+		require_once(ABSPATH.WPINC.'/customize/class-wp-customize-selective-refresh.php');
262
+		$this->selective_refresh = new WP_Customize_Selective_Refresh($this);
263 263
 
264
-		if ( in_array( 'widgets', $components, true ) ) {
265
-			require_once( ABSPATH . WPINC . '/class-wp-customize-widgets.php' );
266
-			$this->widgets = new WP_Customize_Widgets( $this );
264
+		if (in_array('widgets', $components, true)) {
265
+			require_once(ABSPATH.WPINC.'/class-wp-customize-widgets.php');
266
+			$this->widgets = new WP_Customize_Widgets($this);
267 267
 		}
268 268
 
269
-		if ( in_array( 'nav_menus', $components, true ) ) {
270
-			require_once( ABSPATH . WPINC . '/class-wp-customize-nav-menus.php' );
271
-			$this->nav_menus = new WP_Customize_Nav_Menus( $this );
269
+		if (in_array('nav_menus', $components, true)) {
270
+			require_once(ABSPATH.WPINC.'/class-wp-customize-nav-menus.php');
271
+			$this->nav_menus = new WP_Customize_Nav_Menus($this);
272 272
 		}
273 273
 
274
-		add_filter( 'wp_die_handler', array( $this, 'wp_die_handler' ) );
274
+		add_filter('wp_die_handler', array($this, 'wp_die_handler'));
275 275
 
276
-		add_action( 'setup_theme', array( $this, 'setup_theme' ) );
277
-		add_action( 'wp_loaded',   array( $this, 'wp_loaded' ) );
276
+		add_action('setup_theme', array($this, 'setup_theme'));
277
+		add_action('wp_loaded', array($this, 'wp_loaded'));
278 278
 
279 279
 		// Run wp_redirect_status late to make sure we override the status last.
280
-		add_action( 'wp_redirect_status', array( $this, 'wp_redirect_status' ), 1000 );
280
+		add_action('wp_redirect_status', array($this, 'wp_redirect_status'), 1000);
281 281
 
282 282
 		// Do not spawn cron (especially the alternate cron) while running the Customizer.
283
-		remove_action( 'init', 'wp_cron' );
283
+		remove_action('init', 'wp_cron');
284 284
 
285 285
 		// Do not run update checks when rendering the controls.
286
-		remove_action( 'admin_init', '_maybe_update_core' );
287
-		remove_action( 'admin_init', '_maybe_update_plugins' );
288
-		remove_action( 'admin_init', '_maybe_update_themes' );
286
+		remove_action('admin_init', '_maybe_update_core');
287
+		remove_action('admin_init', '_maybe_update_plugins');
288
+		remove_action('admin_init', '_maybe_update_themes');
289 289
 
290
-		add_action( 'wp_ajax_customize_save',           array( $this, 'save' ) );
291
-		add_action( 'wp_ajax_customize_refresh_nonces', array( $this, 'refresh_nonces' ) );
290
+		add_action('wp_ajax_customize_save', array($this, 'save'));
291
+		add_action('wp_ajax_customize_refresh_nonces', array($this, 'refresh_nonces'));
292 292
 
293
-		add_action( 'customize_register',                 array( $this, 'register_controls' ) );
294
-		add_action( 'customize_register',                 array( $this, 'register_dynamic_settings' ), 11 ); // allow code to create settings first
295
-		add_action( 'customize_controls_init',            array( $this, 'prepare_controls' ) );
296
-		add_action( 'customize_controls_enqueue_scripts', array( $this, 'enqueue_control_scripts' ) );
293
+		add_action('customize_register', array($this, 'register_controls'));
294
+		add_action('customize_register', array($this, 'register_dynamic_settings'), 11); // allow code to create settings first
295
+		add_action('customize_controls_init', array($this, 'prepare_controls'));
296
+		add_action('customize_controls_enqueue_scripts', array($this, 'enqueue_control_scripts'));
297 297
 
298 298
 		// Render Panel, Section, and Control templates.
299
-		add_action( 'customize_controls_print_footer_scripts', array( $this, 'render_panel_templates' ), 1 );
300
-		add_action( 'customize_controls_print_footer_scripts', array( $this, 'render_section_templates' ), 1 );
301
-		add_action( 'customize_controls_print_footer_scripts', array( $this, 'render_control_templates' ), 1 );
299
+		add_action('customize_controls_print_footer_scripts', array($this, 'render_panel_templates'), 1);
300
+		add_action('customize_controls_print_footer_scripts', array($this, 'render_section_templates'), 1);
301
+		add_action('customize_controls_print_footer_scripts', array($this, 'render_control_templates'), 1);
302 302
 
303 303
 		// Export the settings to JS via the _wpCustomizeSettings variable.
304
-		add_action( 'customize_controls_print_footer_scripts', array( $this, 'customize_pane_settings' ), 1000 );
304
+		add_action('customize_controls_print_footer_scripts', array($this, 'customize_pane_settings'), 1000);
305 305
 	}
306 306
 
307 307
 	/**
@@ -314,20 +314,20 @@  discard block
 block discarded – undo
314 314
 	 * @param string|null $action Whether the supplied Ajax action is being run.
315 315
 	 * @return bool True if it's an Ajax request, false otherwise.
316 316
 	 */
317
-	public function doing_ajax( $action = null ) {
318
-		$doing_ajax = ( defined( 'DOING_AJAX' ) && DOING_AJAX );
319
-		if ( ! $doing_ajax ) {
317
+	public function doing_ajax($action = null) {
318
+		$doing_ajax = (defined('DOING_AJAX') && DOING_AJAX);
319
+		if ( ! $doing_ajax) {
320 320
 			return false;
321 321
 		}
322 322
 
323
-		if ( ! $action ) {
323
+		if ( ! $action) {
324 324
 			return true;
325 325
 		} else {
326 326
 			/*
327 327
 			 * Note: we can't just use doing_action( "wp_ajax_{$action}" ) because we need
328 328
 			 * to check before admin-ajax.php gets to that point.
329 329
 			 */
330
-			return isset( $_REQUEST['action'] ) && wp_unslash( $_REQUEST['action'] ) === $action;
330
+			return isset($_REQUEST['action']) && wp_unslash($_REQUEST['action']) === $action;
331 331
 		}
332 332
 	}
333 333
 
@@ -340,16 +340,16 @@  discard block
 block discarded – undo
340 340
 	 * @param mixed $ajax_message Ajax return
341 341
 	 * @param mixed $message UI message
342 342
 	 */
343
-	protected function wp_die( $ajax_message, $message = null ) {
344
-		if ( $this->doing_ajax() || isset( $_POST['customized'] ) ) {
345
-			wp_die( $ajax_message );
343
+	protected function wp_die($ajax_message, $message = null) {
344
+		if ($this->doing_ajax() || isset($_POST['customized'])) {
345
+			wp_die($ajax_message);
346 346
 		}
347 347
 
348
-		if ( ! $message ) {
349
-			$message = __( 'Cheatin&#8217; uh?' );
348
+		if ( ! $message) {
349
+			$message = __('Cheatin&#8217; uh?');
350 350
 		}
351 351
 
352
-		wp_die( $message );
352
+		wp_die($message);
353 353
 	}
354 354
 
355 355
 	/**
@@ -360,7 +360,7 @@  discard block
 block discarded – undo
360 360
 	 * @return string
361 361
 	 */
362 362
 	public function wp_die_handler() {
363
-		if ( $this->doing_ajax() || isset( $_POST['customized'] ) ) {
363
+		if ($this->doing_ajax() || isset($_POST['customized'])) {
364 364
 			return '_ajax_wp_die_handler';
365 365
 		}
366 366
 
@@ -377,41 +377,41 @@  discard block
 block discarded – undo
377 377
 	public function setup_theme() {
378 378
 		send_origin_headers();
379 379
 
380
-		$doing_ajax_or_is_customized = ( $this->doing_ajax() || isset( $_POST['customized'] ) );
381
-		if ( is_admin() && ! $doing_ajax_or_is_customized ) {
380
+		$doing_ajax_or_is_customized = ($this->doing_ajax() || isset($_POST['customized']));
381
+		if (is_admin() && ! $doing_ajax_or_is_customized) {
382 382
 			auth_redirect();
383
-		} elseif ( $doing_ajax_or_is_customized && ! is_user_logged_in() ) {
384
-			$this->wp_die( 0, __( 'You must be logged in to complete this action.' ) );
383
+		} elseif ($doing_ajax_or_is_customized && ! is_user_logged_in()) {
384
+			$this->wp_die(0, __('You must be logged in to complete this action.'));
385 385
 		}
386 386
 
387
-		show_admin_bar( false );
387
+		show_admin_bar(false);
388 388
 
389
-		if ( ! current_user_can( 'customize' ) ) {
390
-			$this->wp_die( -1, __( 'Sorry, you are not allowed to customize this site.' ) );
389
+		if ( ! current_user_can('customize')) {
390
+			$this->wp_die( -1, __('Sorry, you are not allowed to customize this site.') );
391 391
 		}
392 392
 
393 393
 		$this->original_stylesheet = get_stylesheet();
394 394
 
395
-		$this->theme = wp_get_theme( isset( $_REQUEST['theme'] ) ? $_REQUEST['theme'] : null );
395
+		$this->theme = wp_get_theme(isset($_REQUEST['theme']) ? $_REQUEST['theme'] : null);
396 396
 
397
-		if ( $this->is_theme_active() ) {
397
+		if ($this->is_theme_active()) {
398 398
 			// Once the theme is loaded, we'll validate it.
399
-			add_action( 'after_setup_theme', array( $this, 'after_setup_theme' ) );
399
+			add_action('after_setup_theme', array($this, 'after_setup_theme'));
400 400
 		} else {
401 401
 			// If the requested theme is not the active theme and the user doesn't have the
402 402
 			// switch_themes cap, bail.
403
-			if ( ! current_user_can( 'switch_themes' ) ) {
404
-				$this->wp_die( -1, __( 'Sorry, you are not allowed to edit theme options on this site.' ) );
403
+			if ( ! current_user_can('switch_themes')) {
404
+				$this->wp_die( -1, __('Sorry, you are not allowed to edit theme options on this site.') );
405 405
 			}
406 406
 
407 407
 			// If the theme has errors while loading, bail.
408
-			if ( $this->theme()->errors() ) {
408
+			if ($this->theme()->errors()) {
409 409
 				$this->wp_die( -1, $this->theme()->errors()->get_error_message() );
410 410
 			}
411 411
 
412 412
 			// If the theme isn't allowed per multisite settings, bail.
413
-			if ( ! $this->theme()->is_allowed() ) {
414
-				$this->wp_die( -1, __( 'The requested theme does not exist.' ) );
413
+			if ( ! $this->theme()->is_allowed()) {
414
+				$this->wp_die( -1, __('The requested theme does not exist.') );
415 415
 			}
416 416
 		}
417 417
 
@@ -424,9 +424,9 @@  discard block
 block discarded – undo
424 424
 	 * @since 3.4.0
425 425
 	 */
426 426
 	public function after_setup_theme() {
427
-		$doing_ajax_or_is_customized = ( $this->doing_ajax() || isset( $_POST['customized'] ) );
428
-		if ( ! $doing_ajax_or_is_customized && ! validate_current_theme() ) {
429
-			wp_redirect( 'themes.php?broken=true' );
427
+		$doing_ajax_or_is_customized = ($this->doing_ajax() || isset($_POST['customized']));
428
+		if ( ! $doing_ajax_or_is_customized && ! validate_current_theme()) {
429
+			wp_redirect('themes.php?broken=true');
430 430
 			exit;
431 431
 		}
432 432
 	}
@@ -439,24 +439,24 @@  discard block
 block discarded – undo
439 439
 	 */
440 440
 	public function start_previewing_theme() {
441 441
 		// Bail if we're already previewing.
442
-		if ( $this->is_preview() ) {
442
+		if ($this->is_preview()) {
443 443
 			return;
444 444
 		}
445 445
 
446 446
 		$this->previewing = true;
447 447
 
448
-		if ( ! $this->is_theme_active() ) {
449
-			add_filter( 'template', array( $this, 'get_template' ) );
450
-			add_filter( 'stylesheet', array( $this, 'get_stylesheet' ) );
451
-			add_filter( 'pre_option_current_theme', array( $this, 'current_theme' ) );
448
+		if ( ! $this->is_theme_active()) {
449
+			add_filter('template', array($this, 'get_template'));
450
+			add_filter('stylesheet', array($this, 'get_stylesheet'));
451
+			add_filter('pre_option_current_theme', array($this, 'current_theme'));
452 452
 
453 453
 			// @link: https://core.trac.wordpress.org/ticket/20027
454
-			add_filter( 'pre_option_stylesheet', array( $this, 'get_stylesheet' ) );
455
-			add_filter( 'pre_option_template', array( $this, 'get_template' ) );
454
+			add_filter('pre_option_stylesheet', array($this, 'get_stylesheet'));
455
+			add_filter('pre_option_template', array($this, 'get_template'));
456 456
 
457 457
 			// Handle custom theme roots.
458
-			add_filter( 'pre_option_stylesheet_root', array( $this, 'get_stylesheet_root' ) );
459
-			add_filter( 'pre_option_template_root', array( $this, 'get_template_root' ) );
458
+			add_filter('pre_option_stylesheet_root', array($this, 'get_stylesheet_root'));
459
+			add_filter('pre_option_template_root', array($this, 'get_template_root'));
460 460
 		}
461 461
 
462 462
 		/**
@@ -466,7 +466,7 @@  discard block
 block discarded – undo
466 466
 		 *
467 467
 		 * @param WP_Customize_Manager $this WP_Customize_Manager instance.
468 468
 		 */
469
-		do_action( 'start_previewing_theme', $this );
469
+		do_action('start_previewing_theme', $this);
470 470
 	}
471 471
 
472 472
 	/**
@@ -477,24 +477,24 @@  discard block
 block discarded – undo
477 477
 	 * @since 3.4.0
478 478
 	 */
479 479
 	public function stop_previewing_theme() {
480
-		if ( ! $this->is_preview() ) {
480
+		if ( ! $this->is_preview()) {
481 481
 			return;
482 482
 		}
483 483
 
484 484
 		$this->previewing = false;
485 485
 
486
-		if ( ! $this->is_theme_active() ) {
487
-			remove_filter( 'template', array( $this, 'get_template' ) );
488
-			remove_filter( 'stylesheet', array( $this, 'get_stylesheet' ) );
489
-			remove_filter( 'pre_option_current_theme', array( $this, 'current_theme' ) );
486
+		if ( ! $this->is_theme_active()) {
487
+			remove_filter('template', array($this, 'get_template'));
488
+			remove_filter('stylesheet', array($this, 'get_stylesheet'));
489
+			remove_filter('pre_option_current_theme', array($this, 'current_theme'));
490 490
 
491 491
 			// @link: https://core.trac.wordpress.org/ticket/20027
492
-			remove_filter( 'pre_option_stylesheet', array( $this, 'get_stylesheet' ) );
493
-			remove_filter( 'pre_option_template', array( $this, 'get_template' ) );
492
+			remove_filter('pre_option_stylesheet', array($this, 'get_stylesheet'));
493
+			remove_filter('pre_option_template', array($this, 'get_template'));
494 494
 
495 495
 			// Handle custom theme roots.
496
-			remove_filter( 'pre_option_stylesheet_root', array( $this, 'get_stylesheet_root' ) );
497
-			remove_filter( 'pre_option_template_root', array( $this, 'get_template_root' ) );
496
+			remove_filter('pre_option_stylesheet_root', array($this, 'get_stylesheet_root'));
497
+			remove_filter('pre_option_template_root', array($this, 'get_template_root'));
498 498
 		}
499 499
 
500 500
 		/**
@@ -504,7 +504,7 @@  discard block
 block discarded – undo
504 504
 		 *
505 505
 		 * @param WP_Customize_Manager $this WP_Customize_Manager instance.
506 506
 		 */
507
-		do_action( 'stop_previewing_theme', $this );
507
+		do_action('stop_previewing_theme', $this);
508 508
 	}
509 509
 
510 510
 	/**
@@ -515,7 +515,7 @@  discard block
 block discarded – undo
515 515
 	 * @return WP_Theme
516 516
 	 */
517 517
 	public function theme() {
518
-		if ( ! $this->theme ) {
518
+		if ( ! $this->theme) {
519 519
 			$this->theme = wp_get_theme();
520 520
 		}
521 521
 		return $this->theme;
@@ -602,9 +602,9 @@  discard block
 block discarded – undo
602 602
 		 *
603 603
 		 * @param WP_Customize_Manager $this WP_Customize_Manager instance.
604 604
 		 */
605
-		do_action( 'customize_register', $this );
605
+		do_action('customize_register', $this);
606 606
 
607
-		if ( $this->is_preview() && ! is_admin() )
607
+		if ($this->is_preview() && ! is_admin())
608 608
 			$this->customize_preview_init();
609 609
 	}
610 610
 
@@ -619,8 +619,8 @@  discard block
 block discarded – undo
619 619
 	 * @param $status
620 620
 	 * @return int
621 621
 	 */
622
-	public function wp_redirect_status( $status ) {
623
-		if ( $this->is_preview() && ! is_admin() )
622
+	public function wp_redirect_status($status) {
623
+		if ($this->is_preview() && ! is_admin())
624 624
 			return 200;
625 625
 
626 626
 		return $status;
@@ -635,15 +635,15 @@  discard block
 block discarded – undo
635 635
 	 * @return array
636 636
 	 */
637 637
 	public function unsanitized_post_values() {
638
-		if ( ! isset( $this->_post_values ) ) {
639
-			if ( isset( $_POST['customized'] ) ) {
640
-				$this->_post_values = json_decode( wp_unslash( $_POST['customized'] ), true );
638
+		if ( ! isset($this->_post_values)) {
639
+			if (isset($_POST['customized'])) {
640
+				$this->_post_values = json_decode(wp_unslash($_POST['customized']), true);
641 641
 			}
642
-			if ( empty( $this->_post_values ) ) { // if not isset or if JSON error
642
+			if (empty($this->_post_values)) { // if not isset or if JSON error
643 643
 				$this->_post_values = array();
644 644
 			}
645 645
 		}
646
-		if ( empty( $this->_post_values ) ) {
646
+		if (empty($this->_post_values)) {
647 647
 			return array();
648 648
 		} else {
649 649
 			return $this->_post_values;
@@ -667,18 +667,18 @@  discard block
 block discarded – undo
667 667
 	 *                                      or the post value is invalid (added in 4.6.0).
668 668
 	 * @return string|mixed $post_value Sanitized value or the $default provided.
669 669
 	 */
670
-	public function post_value( $setting, $default = null ) {
670
+	public function post_value($setting, $default = null) {
671 671
 		$post_values = $this->unsanitized_post_values();
672
-		if ( ! array_key_exists( $setting->id, $post_values ) ) {
672
+		if ( ! array_key_exists($setting->id, $post_values)) {
673 673
 			return $default;
674 674
 		}
675
-		$value = $post_values[ $setting->id ];
676
-		$valid = $setting->validate( $value );
677
-		if ( is_wp_error( $valid ) ) {
675
+		$value = $post_values[$setting->id];
676
+		$valid = $setting->validate($value);
677
+		if (is_wp_error($valid)) {
678 678
 			return $default;
679 679
 		}
680
-		$value = $setting->sanitize( $value );
681
-		if ( is_null( $value ) || is_wp_error( $value ) ) {
680
+		$value = $setting->sanitize($value);
681
+		if (is_null($value) || is_wp_error($value)) {
682 682
 			return $default;
683 683
 		}
684 684
 		return $value;
@@ -693,9 +693,9 @@  discard block
 block discarded – undo
693 693
 	 * @param string $setting_id ID for the WP_Customize_Setting instance.
694 694
 	 * @param mixed  $value      Post value.
695 695
 	 */
696
-	public function set_post_value( $setting_id, $value ) {
696
+	public function set_post_value($setting_id, $value) {
697 697
 		$this->unsanitized_post_values();
698
-		$this->_post_values[ $setting_id ] = $value;
698
+		$this->_post_values[$setting_id] = $value;
699 699
 
700 700
 		/**
701 701
 		 * Announce when a specific setting's unsanitized post value has been set.
@@ -709,7 +709,7 @@  discard block
 block discarded – undo
709 709
 		 * @param mixed                $value Unsanitized setting post value.
710 710
 		 * @param WP_Customize_Manager $this  WP_Customize_Manager instance.
711 711
 		 */
712
-		do_action( "customize_post_value_set_{$setting_id}", $value, $this );
712
+		do_action("customize_post_value_set_{$setting_id}", $value, $this);
713 713
 
714 714
 		/**
715 715
 		 * Announce when any setting's unsanitized post value has been set.
@@ -725,7 +725,7 @@  discard block
 block discarded – undo
725 725
 		 * @param mixed                $value      Unsanitized setting post value.
726 726
 		 * @param WP_Customize_Manager $this       WP_Customize_Manager instance.
727 727
 		 */
728
-		do_action( 'customize_post_value_set', $setting_id, $value, $this );
728
+		do_action('customize_post_value_set', $setting_id, $value, $this);
729 729
 	}
730 730
 
731 731
 	/**
@@ -734,20 +734,20 @@  discard block
 block discarded – undo
734 734
 	 * @since 3.4.0
735 735
 	 */
736 736
 	public function customize_preview_init() {
737
-		$this->nonce_tick = check_ajax_referer( 'preview-customize_' . $this->get_stylesheet(), 'nonce' );
737
+		$this->nonce_tick = check_ajax_referer('preview-customize_'.$this->get_stylesheet(), 'nonce');
738 738
 
739 739
 		$this->prepare_controls();
740 740
 
741
-		wp_enqueue_script( 'customize-preview' );
742
-		add_action( 'wp', array( $this, 'customize_preview_override_404_status' ) );
743
-		add_action( 'wp_head', array( $this, 'customize_preview_base' ) );
744
-		add_action( 'wp_head', array( $this, 'customize_preview_html5' ) );
745
-		add_action( 'wp_head', array( $this, 'customize_preview_loading_style' ) );
746
-		add_action( 'wp_footer', array( $this, 'customize_preview_settings' ), 20 );
747
-		add_action( 'shutdown', array( $this, 'customize_preview_signature' ), 1000 );
748
-		add_filter( 'wp_die_handler', array( $this, 'remove_preview_signature' ) );
741
+		wp_enqueue_script('customize-preview');
742
+		add_action('wp', array($this, 'customize_preview_override_404_status'));
743
+		add_action('wp_head', array($this, 'customize_preview_base'));
744
+		add_action('wp_head', array($this, 'customize_preview_html5'));
745
+		add_action('wp_head', array($this, 'customize_preview_loading_style'));
746
+		add_action('wp_footer', array($this, 'customize_preview_settings'), 20);
747
+		add_action('shutdown', array($this, 'customize_preview_signature'), 1000);
748
+		add_filter('wp_die_handler', array($this, 'remove_preview_signature'));
749 749
 
750
-		foreach ( $this->settings as $setting ) {
750
+		foreach ($this->settings as $setting) {
751 751
 			$setting->preview();
752 752
 		}
753 753
 
@@ -759,7 +759,7 @@  discard block
 block discarded – undo
759 759
 		 *
760 760
 		 * @param WP_Customize_Manager $this WP_Customize_Manager instance.
761 761
 		 */
762
-		do_action( 'customize_preview_init', $this );
762
+		do_action('customize_preview_init', $this);
763 763
 	}
764 764
 
765 765
 	/**
@@ -770,8 +770,8 @@  discard block
 block discarded – undo
770 770
 	 * @access public
771 771
 	 */
772 772
 	public function customize_preview_override_404_status() {
773
-		if ( is_404() ) {
774
-			status_header( 200 );
773
+		if (is_404()) {
774
+			status_header(200);
775 775
 		}
776 776
 	}
777 777
 
@@ -781,7 +781,7 @@  discard block
 block discarded – undo
781 781
 	 * @since 3.4.0
782 782
 	 */
783 783
 	public function customize_preview_base() {
784
-		?><base href="<?php echo home_url( '/' ); ?>" /><?php
784
+		?><base href="<?php echo home_url('/'); ?>" /><?php
785 785
 	}
786 786
 
787 787
 	/**
@@ -828,8 +828,8 @@  discard block
 block discarded – undo
828 828
 	 * @since 3.4.0
829 829
 	 */
830 830
 	public function customize_preview_settings() {
831
-		$setting_validities = $this->validate_setting_values( $this->unsanitized_post_values() );
832
-		$exported_setting_validities = array_map( array( $this, 'prepare_setting_validity_for_js' ), $setting_validities );
831
+		$setting_validities = $this->validate_setting_values($this->unsanitized_post_values());
832
+		$exported_setting_validities = array_map(array($this, 'prepare_setting_validity_for_js'), $setting_validities);
833 833
 
834 834
 		$settings = array(
835 835
 			'theme' => array(
@@ -837,44 +837,44 @@  discard block
 block discarded – undo
837 837
 				'active'     => $this->is_theme_active(),
838 838
 			),
839 839
 			'url' => array(
840
-				'self' => empty( $_SERVER['REQUEST_URI'] ) ? home_url( '/' ) : esc_url_raw( wp_unslash( $_SERVER['REQUEST_URI'] ) ),
840
+				'self' => empty($_SERVER['REQUEST_URI']) ? home_url('/') : esc_url_raw(wp_unslash($_SERVER['REQUEST_URI'])),
841 841
 			),
842
-			'channel' => wp_unslash( $_POST['customize_messenger_channel'] ),
842
+			'channel' => wp_unslash($_POST['customize_messenger_channel']),
843 843
 			'activePanels' => array(),
844 844
 			'activeSections' => array(),
845 845
 			'activeControls' => array(),
846 846
 			'settingValidities' => $exported_setting_validities,
847 847
 			'nonce' => $this->get_nonces(),
848 848
 			'l10n' => array(
849
-				'shiftClickToEdit' => __( 'Shift-click to edit this element.' ),
849
+				'shiftClickToEdit' => __('Shift-click to edit this element.'),
850 850
 			),
851
-			'_dirty' => array_keys( $this->unsanitized_post_values() ),
851
+			'_dirty' => array_keys($this->unsanitized_post_values()),
852 852
 		);
853 853
 
854
-		foreach ( $this->panels as $panel_id => $panel ) {
855
-			if ( $panel->check_capabilities() ) {
856
-				$settings['activePanels'][ $panel_id ] = $panel->active();
857
-				foreach ( $panel->sections as $section_id => $section ) {
858
-					if ( $section->check_capabilities() ) {
859
-						$settings['activeSections'][ $section_id ] = $section->active();
854
+		foreach ($this->panels as $panel_id => $panel) {
855
+			if ($panel->check_capabilities()) {
856
+				$settings['activePanels'][$panel_id] = $panel->active();
857
+				foreach ($panel->sections as $section_id => $section) {
858
+					if ($section->check_capabilities()) {
859
+						$settings['activeSections'][$section_id] = $section->active();
860 860
 					}
861 861
 				}
862 862
 			}
863 863
 		}
864
-		foreach ( $this->sections as $id => $section ) {
865
-			if ( $section->check_capabilities() ) {
866
-				$settings['activeSections'][ $id ] = $section->active();
864
+		foreach ($this->sections as $id => $section) {
865
+			if ($section->check_capabilities()) {
866
+				$settings['activeSections'][$id] = $section->active();
867 867
 			}
868 868
 		}
869
-		foreach ( $this->controls as $id => $control ) {
870
-			if ( $control->check_capabilities() ) {
871
-				$settings['activeControls'][ $id ] = $control->active();
869
+		foreach ($this->controls as $id => $control) {
870
+			if ($control->check_capabilities()) {
871
+				$settings['activeControls'][$id] = $control->active();
872 872
 			}
873 873
 		}
874 874
 
875 875
 		?>
876 876
 		<script type="text/javascript">
877
-			var _wpCustomizeSettings = <?php echo wp_json_encode( $settings ); ?>;
877
+			var _wpCustomizeSettings = <?php echo wp_json_encode($settings); ?>;
878 878
 			_wpCustomizeSettings.values = {};
879 879
 			(function( v ) {
880 880
 				<?php
@@ -883,12 +883,12 @@  discard block
 block discarded – undo
883 883
 				 * serialization in order to avoid a peak memory usage spike.
884 884
 				 * @todo We may not even need to export the values at all since the pane syncs them anyway.
885 885
 				 */
886
-				foreach ( $this->settings as $id => $setting ) {
887
-					if ( $setting->check_capabilities() ) {
886
+				foreach ($this->settings as $id => $setting) {
887
+					if ($setting->check_capabilities()) {
888 888
 						printf(
889 889
 							"v[%s] = %s;\n",
890
-							wp_json_encode( $id ),
891
-							wp_json_encode( $setting->js_value() )
890
+							wp_json_encode($id),
891
+							wp_json_encode($setting->js_value())
892 892
 						);
893 893
 					}
894 894
 				}
@@ -915,8 +915,8 @@  discard block
 block discarded – undo
915 915
 	 * @param mixed $return Value passed through for {@see 'wp_die_handler'} filter.
916 916
 	 * @return mixed Value passed through for {@see 'wp_die_handler'} filter.
917 917
 	 */
918
-	public function remove_preview_signature( $return = null ) {
919
-		remove_action( 'shutdown', array( $this, 'customize_preview_signature' ), 1000 );
918
+	public function remove_preview_signature($return = null) {
919
+		remove_action('shutdown', array($this, 'customize_preview_signature'), 1000);
920 920
 
921 921
 		return $return;
922 922
 	}
@@ -962,7 +962,7 @@  discard block
 block discarded – undo
962 962
 	 * @return string Theme root.
963 963
 	 */
964 964
 	public function get_template_root() {
965
-		return get_raw_theme_root( $this->get_template(), true );
965
+		return get_raw_theme_root($this->get_template(), true);
966 966
 	}
967 967
 
968 968
 	/**
@@ -973,7 +973,7 @@  discard block
 block discarded – undo
973 973
 	 * @return string Theme root.
974 974
 	 */
975 975
 	public function get_stylesheet_root() {
976
-		return get_raw_theme_root( $this->get_stylesheet(), true );
976
+		return get_raw_theme_root($this->get_stylesheet(), true);
977 977
 	}
978 978
 
979 979
 	/**
@@ -984,7 +984,7 @@  discard block
 block discarded – undo
984 984
 	 * @param $current_theme {@internal Parameter is not used}
985 985
 	 * @return string Theme name.
986 986
 	 */
987
-	public function current_theme( $current_theme ) {
987
+	public function current_theme($current_theme) {
988 988
 		return $this->theme()->display('Name');
989 989
 	}
990 990
 
@@ -1004,26 +1004,26 @@  discard block
 block discarded – undo
1004 1004
 	 * @param array $setting_values Mapping of setting IDs to values to sanitize and validate.
1005 1005
 	 * @return array Mapping of setting IDs to return value of validate method calls, either `true` or `WP_Error`.
1006 1006
 	 */
1007
-	public function validate_setting_values( $setting_values ) {
1007
+	public function validate_setting_values($setting_values) {
1008 1008
 		$validities = array();
1009
-		foreach ( $setting_values as $setting_id => $unsanitized_value ) {
1010
-			$setting = $this->get_setting( $setting_id );
1011
-			if ( ! $setting || is_null( $unsanitized_value ) ) {
1009
+		foreach ($setting_values as $setting_id => $unsanitized_value) {
1010
+			$setting = $this->get_setting($setting_id);
1011
+			if ( ! $setting || is_null($unsanitized_value)) {
1012 1012
 				continue;
1013 1013
 			}
1014
-			$validity = $setting->validate( $unsanitized_value );
1015
-			if ( ! is_wp_error( $validity ) ) {
1016
-				$value = $setting->sanitize( $unsanitized_value );
1017
-				if ( is_null( $value ) ) {
1014
+			$validity = $setting->validate($unsanitized_value);
1015
+			if ( ! is_wp_error($validity)) {
1016
+				$value = $setting->sanitize($unsanitized_value);
1017
+				if (is_null($value)) {
1018 1018
 					$validity = false;
1019
-				} elseif ( is_wp_error( $value ) ) {
1019
+				} elseif (is_wp_error($value)) {
1020 1020
 					$validity = $value;
1021 1021
 				}
1022 1022
 			}
1023
-			if ( false === $validity ) {
1024
-				$validity = new WP_Error( 'invalid_value', __( 'Invalid value.' ) );
1023
+			if (false === $validity) {
1024
+				$validity = new WP_Error('invalid_value', __('Invalid value.'));
1025 1025
 			}
1026
-			$validities[ $setting_id ] = $validity;
1026
+			$validities[$setting_id] = $validity;
1027 1027
 		}
1028 1028
 		return $validities;
1029 1029
 	}
@@ -1042,20 +1042,20 @@  discard block
 block discarded – undo
1042 1042
 	 *                    to their respective `message` and `data` to pass into the
1043 1043
 	 *                    `wp.customize.Notification` JS model.
1044 1044
 	 */
1045
-	public function prepare_setting_validity_for_js( $validity ) {
1046
-		if ( is_wp_error( $validity ) ) {
1045
+	public function prepare_setting_validity_for_js($validity) {
1046
+		if (is_wp_error($validity)) {
1047 1047
 			$notification = array();
1048
-			foreach ( $validity->errors as $error_code => $error_messages ) {
1049
-				$error_data = $validity->get_error_data( $error_code );
1050
-				if ( is_null( $error_data ) ) {
1048
+			foreach ($validity->errors as $error_code => $error_messages) {
1049
+				$error_data = $validity->get_error_data($error_code);
1050
+				if (is_null($error_data)) {
1051 1051
 					$error_data = array();
1052 1052
 				}
1053 1053
 				$error_data = array_merge(
1054 1054
 					$error_data,
1055
-					array( 'from_server' => true )
1055
+					array('from_server' => true)
1056 1056
 				);
1057
-				$notification[ $error_code ] = array(
1058
-					'message' => join( ' ', $error_messages ),
1057
+				$notification[$error_code] = array(
1058
+					'message' => join(' ', $error_messages),
1059 1059
 					'data' => $error_data,
1060 1060
 				);
1061 1061
 			}
@@ -1071,13 +1071,13 @@  discard block
 block discarded – undo
1071 1071
 	 * @since 3.4.0
1072 1072
 	 */
1073 1073
 	public function save() {
1074
-		if ( ! $this->is_preview() ) {
1075
-			wp_send_json_error( 'not_preview' );
1074
+		if ( ! $this->is_preview()) {
1075
+			wp_send_json_error('not_preview');
1076 1076
 		}
1077 1077
 
1078
-		$action = 'save-customize_' . $this->get_stylesheet();
1079
-		if ( ! check_ajax_referer( $action, 'nonce', false ) ) {
1080
-			wp_send_json_error( 'invalid_nonce' );
1078
+		$action = 'save-customize_'.$this->get_stylesheet();
1079
+		if ( ! check_ajax_referer($action, 'nonce', false)) {
1080
+			wp_send_json_error('invalid_nonce');
1081 1081
 		}
1082 1082
 
1083 1083
 		/**
@@ -1091,30 +1091,30 @@  discard block
 block discarded – undo
1091 1091
 		 *
1092 1092
 		 * @param WP_Customize_Manager $this WP_Customize_Manager instance.
1093 1093
 		 */
1094
-		do_action( 'customize_save_validation_before', $this );
1094
+		do_action('customize_save_validation_before', $this);
1095 1095
 
1096 1096
 		// Validate settings.
1097
-		$setting_validities = $this->validate_setting_values( $this->unsanitized_post_values() );
1098
-		$invalid_setting_count = count( array_filter( $setting_validities, 'is_wp_error' ) );
1099
-		$exported_setting_validities = array_map( array( $this, 'prepare_setting_validity_for_js' ), $setting_validities );
1100
-		if ( $invalid_setting_count > 0 ) {
1097
+		$setting_validities = $this->validate_setting_values($this->unsanitized_post_values());
1098
+		$invalid_setting_count = count(array_filter($setting_validities, 'is_wp_error'));
1099
+		$exported_setting_validities = array_map(array($this, 'prepare_setting_validity_for_js'), $setting_validities);
1100
+		if ($invalid_setting_count > 0) {
1101 1101
 			$response = array(
1102 1102
 				'setting_validities' => $exported_setting_validities,
1103
-				'message' => sprintf( _n( 'There is %s invalid setting.', 'There are %s invalid settings.', $invalid_setting_count ), number_format_i18n( $invalid_setting_count ) ),
1103
+				'message' => sprintf(_n('There is %s invalid setting.', 'There are %s invalid settings.', $invalid_setting_count), number_format_i18n($invalid_setting_count)),
1104 1104
 			);
1105 1105
 
1106 1106
 			/** This filter is documented in wp-includes/class-wp-customize-manager.php */
1107
-			$response = apply_filters( 'customize_save_response', $response, $this );
1108
-			wp_send_json_error( $response );
1107
+			$response = apply_filters('customize_save_response', $response, $this);
1108
+			wp_send_json_error($response);
1109 1109
 		}
1110 1110
 
1111 1111
 		// Do we have to switch themes?
1112
-		if ( ! $this->is_theme_active() ) {
1112
+		if ( ! $this->is_theme_active()) {
1113 1113
 			// Temporarily stop previewing the theme to allow switch_themes()
1114 1114
 			// to operate properly.
1115 1115
 			$this->stop_previewing_theme();
1116
-			switch_theme( $this->get_stylesheet() );
1117
-			update_option( 'theme_switched_via_customizer', true );
1116
+			switch_theme($this->get_stylesheet());
1117
+			update_option('theme_switched_via_customizer', true);
1118 1118
 			$this->start_previewing_theme();
1119 1119
 		}
1120 1120
 
@@ -1126,9 +1126,9 @@  discard block
 block discarded – undo
1126 1126
 		 *
1127 1127
 		 * @param WP_Customize_Manager $this WP_Customize_Manager instance.
1128 1128
 		 */
1129
-		do_action( 'customize_save', $this );
1129
+		do_action('customize_save', $this);
1130 1130
 
1131
-		foreach ( $this->settings as $setting ) {
1131
+		foreach ($this->settings as $setting) {
1132 1132
 			$setting->save();
1133 1133
 		}
1134 1134
 
@@ -1139,7 +1139,7 @@  discard block
 block discarded – undo
1139 1139
 		 *
1140 1140
 		 * @param WP_Customize_Manager $this WP_Customize_Manager instance.
1141 1141
 		 */
1142
-		do_action( 'customize_save_after', $this );
1142
+		do_action('customize_save_after', $this);
1143 1143
 
1144 1144
 		$data = array(
1145 1145
 			'setting_validities' => $exported_setting_validities,
@@ -1156,8 +1156,8 @@  discard block
 block discarded – undo
1156 1156
 		 *                                   event on `wp.customize`.
1157 1157
 		 * @param WP_Customize_Manager $this WP_Customize_Manager instance.
1158 1158
 		 */
1159
-		$response = apply_filters( 'customize_save_response', $data, $this );
1160
-		wp_send_json_success( $response );
1159
+		$response = apply_filters('customize_save_response', $data, $this);
1160
+		wp_send_json_success($response);
1161 1161
 	}
1162 1162
 
1163 1163
 	/**
@@ -1166,11 +1166,11 @@  discard block
 block discarded – undo
1166 1166
 	 * @since 4.2.0
1167 1167
 	 */
1168 1168
 	public function refresh_nonces() {
1169
-		if ( ! $this->is_preview() ) {
1170
-			wp_send_json_error( 'not_preview' );
1169
+		if ( ! $this->is_preview()) {
1170
+			wp_send_json_error('not_preview');
1171 1171
 		}
1172 1172
 
1173
-		wp_send_json_success( $this->get_nonces() );
1173
+		wp_send_json_success($this->get_nonces());
1174 1174
 	}
1175 1175
 
1176 1176
 	/**
@@ -1185,22 +1185,22 @@  discard block
 block discarded – undo
1185 1185
 	 *                                          constructor.
1186 1186
 	 * @return WP_Customize_Setting             The instance of the setting that was added.
1187 1187
 	 */
1188
-	public function add_setting( $id, $args = array() ) {
1189
-		if ( $id instanceof WP_Customize_Setting ) {
1188
+	public function add_setting($id, $args = array()) {
1189
+		if ($id instanceof WP_Customize_Setting) {
1190 1190
 			$setting = $id;
1191 1191
 		} else {
1192 1192
 			$class = 'WP_Customize_Setting';
1193 1193
 
1194 1194
 			/** This filter is documented in wp-includes/class-wp-customize-manager.php */
1195
-			$args = apply_filters( 'customize_dynamic_setting_args', $args, $id );
1195
+			$args = apply_filters('customize_dynamic_setting_args', $args, $id);
1196 1196
 
1197 1197
 			/** This filter is documented in wp-includes/class-wp-customize-manager.php */
1198
-			$class = apply_filters( 'customize_dynamic_setting_class', $class, $id, $args );
1198
+			$class = apply_filters('customize_dynamic_setting_class', $class, $id, $args);
1199 1199
 
1200
-			$setting = new $class( $this, $id, $args );
1200
+			$setting = new $class($this, $id, $args);
1201 1201
 		}
1202 1202
 
1203
-		$this->settings[ $setting->id ] = $setting;
1203
+		$this->settings[$setting->id] = $setting;
1204 1204
 		return $setting;
1205 1205
 	}
1206 1206
 
@@ -1219,11 +1219,11 @@  discard block
 block discarded – undo
1219 1219
 	 * @param array $setting_ids The setting IDs to add.
1220 1220
 	 * @return array The WP_Customize_Setting objects added.
1221 1221
 	 */
1222
-	public function add_dynamic_settings( $setting_ids ) {
1222
+	public function add_dynamic_settings($setting_ids) {
1223 1223
 		$new_settings = array();
1224
-		foreach ( $setting_ids as $setting_id ) {
1224
+		foreach ($setting_ids as $setting_id) {
1225 1225
 			// Skip settings already created
1226
-			if ( $this->get_setting( $setting_id ) ) {
1226
+			if ($this->get_setting($setting_id)) {
1227 1227
 				continue;
1228 1228
 			}
1229 1229
 
@@ -1242,8 +1242,8 @@  discard block
 block discarded – undo
1242 1242
 			 * @param false|array $setting_args The arguments to the WP_Customize_Setting constructor.
1243 1243
 			 * @param string      $setting_id   ID for dynamic setting, usually coming from `$_POST['customized']`.
1244 1244
 			 */
1245
-			$setting_args = apply_filters( 'customize_dynamic_setting_args', $setting_args, $setting_id );
1246
-			if ( false === $setting_args ) {
1245
+			$setting_args = apply_filters('customize_dynamic_setting_args', $setting_args, $setting_id);
1246
+			if (false === $setting_args) {
1247 1247
 				continue;
1248 1248
 			}
1249 1249
 
@@ -1256,11 +1256,11 @@  discard block
 block discarded – undo
1256 1256
 			 * @param string $setting_id    ID for dynamic setting, usually coming from `$_POST['customized']`.
1257 1257
 			 * @param array  $setting_args  WP_Customize_Setting or a subclass.
1258 1258
 			 */
1259
-			$setting_class = apply_filters( 'customize_dynamic_setting_class', $setting_class, $setting_id, $setting_args );
1259
+			$setting_class = apply_filters('customize_dynamic_setting_class', $setting_class, $setting_id, $setting_args);
1260 1260
 
1261
-			$setting = new $setting_class( $this, $setting_id, $setting_args );
1261
+			$setting = new $setting_class($this, $setting_id, $setting_args);
1262 1262
 
1263
-			$this->add_setting( $setting );
1263
+			$this->add_setting($setting);
1264 1264
 			$new_settings[] = $setting;
1265 1265
 		}
1266 1266
 		return $new_settings;
@@ -1274,9 +1274,9 @@  discard block
 block discarded – undo
1274 1274
 	 * @param string $id Customize Setting ID.
1275 1275
 	 * @return WP_Customize_Setting|void The setting, if set.
1276 1276
 	 */
1277
-	public function get_setting( $id ) {
1278
-		if ( isset( $this->settings[ $id ] ) ) {
1279
-			return $this->settings[ $id ];
1277
+	public function get_setting($id) {
1278
+		if (isset($this->settings[$id])) {
1279
+			return $this->settings[$id];
1280 1280
 		}
1281 1281
 	}
1282 1282
 
@@ -1287,8 +1287,8 @@  discard block
 block discarded – undo
1287 1287
 	 *
1288 1288
 	 * @param string $id Customize Setting ID.
1289 1289
 	 */
1290
-	public function remove_setting( $id ) {
1291
-		unset( $this->settings[ $id ] );
1290
+	public function remove_setting($id) {
1291
+		unset($this->settings[$id]);
1292 1292
 	}
1293 1293
 
1294 1294
 	/**
@@ -1303,14 +1303,14 @@  discard block
 block discarded – undo
1303 1303
 	 *
1304 1304
 	 * @return WP_Customize_Panel             The instance of the panel that was added.
1305 1305
 	 */
1306
-	public function add_panel( $id, $args = array() ) {
1307
-		if ( $id instanceof WP_Customize_Panel ) {
1306
+	public function add_panel($id, $args = array()) {
1307
+		if ($id instanceof WP_Customize_Panel) {
1308 1308
 			$panel = $id;
1309 1309
 		} else {
1310
-			$panel = new WP_Customize_Panel( $this, $id, $args );
1310
+			$panel = new WP_Customize_Panel($this, $id, $args);
1311 1311
 		}
1312 1312
 
1313
-		$this->panels[ $panel->id ] = $panel;
1313
+		$this->panels[$panel->id] = $panel;
1314 1314
 		return $panel;
1315 1315
 	}
1316 1316
 
@@ -1323,9 +1323,9 @@  discard block
 block discarded – undo
1323 1323
 	 * @param string $id Panel ID to get.
1324 1324
 	 * @return WP_Customize_Panel|void Requested panel instance, if set.
1325 1325
 	 */
1326
-	public function get_panel( $id ) {
1327
-		if ( isset( $this->panels[ $id ] ) ) {
1328
-			return $this->panels[ $id ];
1326
+	public function get_panel($id) {
1327
+		if (isset($this->panels[$id])) {
1328
+			return $this->panels[$id];
1329 1329
 		}
1330 1330
 	}
1331 1331
 
@@ -1337,18 +1337,18 @@  discard block
 block discarded – undo
1337 1337
 	 *
1338 1338
 	 * @param string $id Panel ID to remove.
1339 1339
 	 */
1340
-	public function remove_panel( $id ) {
1340
+	public function remove_panel($id) {
1341 1341
 		// Removing core components this way is _doing_it_wrong().
1342
-		if ( in_array( $id, $this->components, true ) ) {
1342
+		if (in_array($id, $this->components, true)) {
1343 1343
 			/* translators: 1: panel id, 2: link to 'customize_loaded_components' filter reference */
1344
-			$message = sprintf( __( 'Removing %1$s manually will cause PHP warnings. Use the %2$s filter instead.' ),
1344
+			$message = sprintf(__('Removing %1$s manually will cause PHP warnings. Use the %2$s filter instead.'),
1345 1345
 				$id,
1346
-				'<a href="' . esc_url( 'https://developer.wordpress.org/reference/hooks/customize_loaded_components/' ) . '"><code>customize_loaded_components</code></a>'
1346
+				'<a href="'.esc_url('https://developer.wordpress.org/reference/hooks/customize_loaded_components/').'"><code>customize_loaded_components</code></a>'
1347 1347
 			);
1348 1348
 
1349
-			_doing_it_wrong( __METHOD__, $message, '4.5.0' );
1349
+			_doing_it_wrong(__METHOD__, $message, '4.5.0');
1350 1350
 		}
1351
-		unset( $this->panels[ $id ] );
1351
+		unset($this->panels[$id]);
1352 1352
 	}
1353 1353
 
1354 1354
 	/**
@@ -1363,7 +1363,7 @@  discard block
 block discarded – undo
1363 1363
 	 *
1364 1364
 	 * @param string $panel Name of a custom panel which is a subclass of WP_Customize_Panel.
1365 1365
 	 */
1366
-	public function register_panel_type( $panel ) {
1366
+	public function register_panel_type($panel) {
1367 1367
 		$this->registered_panel_types[] = $panel;
1368 1368
 	}
1369 1369
 
@@ -1374,8 +1374,8 @@  discard block
 block discarded – undo
1374 1374
 	 * @access public
1375 1375
 	 */
1376 1376
 	public function render_panel_templates() {
1377
-		foreach ( $this->registered_panel_types as $panel_type ) {
1378
-			$panel = new $panel_type( $this, 'temp', array() );
1377
+		foreach ($this->registered_panel_types as $panel_type) {
1378
+			$panel = new $panel_type($this, 'temp', array());
1379 1379
 			$panel->print_template();
1380 1380
 		}
1381 1381
 	}
@@ -1392,14 +1392,14 @@  discard block
 block discarded – undo
1392 1392
 	 *
1393 1393
 	 * @return WP_Customize_Section             The instance of the section that was added.
1394 1394
 	 */
1395
-	public function add_section( $id, $args = array() ) {
1396
-		if ( $id instanceof WP_Customize_Section ) {
1395
+	public function add_section($id, $args = array()) {
1396
+		if ($id instanceof WP_Customize_Section) {
1397 1397
 			$section = $id;
1398 1398
 		} else {
1399
-			$section = new WP_Customize_Section( $this, $id, $args );
1399
+			$section = new WP_Customize_Section($this, $id, $args);
1400 1400
 		}
1401 1401
 
1402
-		$this->sections[ $section->id ] = $section;
1402
+		$this->sections[$section->id] = $section;
1403 1403
 		return $section;
1404 1404
 	}
1405 1405
 
@@ -1411,9 +1411,9 @@  discard block
 block discarded – undo
1411 1411
 	 * @param string $id Section ID.
1412 1412
 	 * @return WP_Customize_Section|void The section, if set.
1413 1413
 	 */
1414
-	public function get_section( $id ) {
1415
-		if ( isset( $this->sections[ $id ] ) )
1416
-			return $this->sections[ $id ];
1414
+	public function get_section($id) {
1415
+		if (isset($this->sections[$id]))
1416
+			return $this->sections[$id];
1417 1417
 	}
1418 1418
 
1419 1419
 	/**
@@ -1423,8 +1423,8 @@  discard block
 block discarded – undo
1423 1423
 	 *
1424 1424
 	 * @param string $id Section ID.
1425 1425
 	 */
1426
-	public function remove_section( $id ) {
1427
-		unset( $this->sections[ $id ] );
1426
+	public function remove_section($id) {
1427
+		unset($this->sections[$id]);
1428 1428
 	}
1429 1429
 
1430 1430
 	/**
@@ -1439,7 +1439,7 @@  discard block
 block discarded – undo
1439 1439
 	 *
1440 1440
 	 * @param string $section Name of a custom section which is a subclass of WP_Customize_Section.
1441 1441
 	 */
1442
-	public function register_section_type( $section ) {
1442
+	public function register_section_type($section) {
1443 1443
 		$this->registered_section_types[] = $section;
1444 1444
 	}
1445 1445
 
@@ -1450,8 +1450,8 @@  discard block
 block discarded – undo
1450 1450
 	 * @access public
1451 1451
 	 */
1452 1452
 	public function render_section_templates() {
1453
-		foreach ( $this->registered_section_types as $section_type ) {
1454
-			$section = new $section_type( $this, 'temp', array() );
1453
+		foreach ($this->registered_section_types as $section_type) {
1454
+			$section = new $section_type($this, 'temp', array());
1455 1455
 			$section->print_template();
1456 1456
 		}
1457 1457
 	}
@@ -1468,14 +1468,14 @@  discard block
 block discarded – undo
1468 1468
 	 *                                          constructor.
1469 1469
 	 * @return WP_Customize_Control             The instance of the control that was added.
1470 1470
 	 */
1471
-	public function add_control( $id, $args = array() ) {
1472
-		if ( $id instanceof WP_Customize_Control ) {
1471
+	public function add_control($id, $args = array()) {
1472
+		if ($id instanceof WP_Customize_Control) {
1473 1473
 			$control = $id;
1474 1474
 		} else {
1475
-			$control = new WP_Customize_Control( $this, $id, $args );
1475
+			$control = new WP_Customize_Control($this, $id, $args);
1476 1476
 		}
1477 1477
 
1478
-		$this->controls[ $control->id ] = $control;
1478
+		$this->controls[$control->id] = $control;
1479 1479
 		return $control;
1480 1480
 	}
1481 1481
 
@@ -1487,9 +1487,9 @@  discard block
 block discarded – undo
1487 1487
 	 * @param string $id ID of the control.
1488 1488
 	 * @return WP_Customize_Control|void The control object, if set.
1489 1489
 	 */
1490
-	public function get_control( $id ) {
1491
-		if ( isset( $this->controls[ $id ] ) )
1492
-			return $this->controls[ $id ];
1490
+	public function get_control($id) {
1491
+		if (isset($this->controls[$id]))
1492
+			return $this->controls[$id];
1493 1493
 	}
1494 1494
 
1495 1495
 	/**
@@ -1499,8 +1499,8 @@  discard block
 block discarded – undo
1499 1499
 	 *
1500 1500
 	 * @param string $id ID of the control.
1501 1501
 	 */
1502
-	public function remove_control( $id ) {
1503
-		unset( $this->controls[ $id ] );
1502
+	public function remove_control($id) {
1503
+		unset($this->controls[$id]);
1504 1504
 	}
1505 1505
 
1506 1506
 	/**
@@ -1514,7 +1514,7 @@  discard block
 block discarded – undo
1514 1514
 	 * @param string $control Name of a custom control which is a subclass of
1515 1515
 	 *                        WP_Customize_Control.
1516 1516
 	 */
1517
-	public function register_control_type( $control ) {
1517
+	public function register_control_type($control) {
1518 1518
 		$this->registered_control_types[] = $control;
1519 1519
 	}
1520 1520
 
@@ -1525,10 +1525,10 @@  discard block
 block discarded – undo
1525 1525
 	 * @access public
1526 1526
 	 */
1527 1527
 	public function render_control_templates() {
1528
-		foreach ( $this->registered_control_types as $control_type ) {
1529
-			$control = new $control_type( $this, 'temp', array(
1528
+		foreach ($this->registered_control_types as $control_type) {
1529
+			$control = new $control_type($this, 'temp', array(
1530 1530
 				'settings' => array(),
1531
-			) );
1531
+			));
1532 1532
 			$control->print_template();
1533 1533
 		}
1534 1534
 		?>
@@ -1551,8 +1551,8 @@  discard block
 block discarded – undo
1551 1551
 	 * @param WP_Customize_Panel|WP_Customize_Section|WP_Customize_Control $b Object B.
1552 1552
 	 * @return int
1553 1553
 	 */
1554
-	protected function _cmp_priority( $a, $b ) {
1555
-		if ( $a->priority === $b->priority ) {
1554
+	protected function _cmp_priority($a, $b) {
1555
+		if ($a->priority === $b->priority) {
1556 1556
 			return $a->instance_number - $b->instance_number;
1557 1557
 		} else {
1558 1558
 			return $a->priority - $b->priority;
@@ -1571,58 +1571,58 @@  discard block
 block discarded – undo
1571 1571
 	public function prepare_controls() {
1572 1572
 
1573 1573
 		$controls = array();
1574
-		uasort( $this->controls, array( $this, '_cmp_priority' ) );
1574
+		uasort($this->controls, array($this, '_cmp_priority'));
1575 1575
 
1576
-		foreach ( $this->controls as $id => $control ) {
1577
-			if ( ! isset( $this->sections[ $control->section ] ) || ! $control->check_capabilities() ) {
1576
+		foreach ($this->controls as $id => $control) {
1577
+			if ( ! isset($this->sections[$control->section]) || ! $control->check_capabilities()) {
1578 1578
 				continue;
1579 1579
 			}
1580 1580
 
1581
-			$this->sections[ $control->section ]->controls[] = $control;
1582
-			$controls[ $id ] = $control;
1581
+			$this->sections[$control->section]->controls[] = $control;
1582
+			$controls[$id] = $control;
1583 1583
 		}
1584 1584
 		$this->controls = $controls;
1585 1585
 
1586 1586
 		// Prepare sections.
1587
-		uasort( $this->sections, array( $this, '_cmp_priority' ) );
1587
+		uasort($this->sections, array($this, '_cmp_priority'));
1588 1588
 		$sections = array();
1589 1589
 
1590
-		foreach ( $this->sections as $section ) {
1591
-			if ( ! $section->check_capabilities() ) {
1590
+		foreach ($this->sections as $section) {
1591
+			if ( ! $section->check_capabilities()) {
1592 1592
 				continue;
1593 1593
 			}
1594 1594
 
1595
-			usort( $section->controls, array( $this, '_cmp_priority' ) );
1595
+			usort($section->controls, array($this, '_cmp_priority'));
1596 1596
 
1597
-			if ( ! $section->panel ) {
1597
+			if ( ! $section->panel) {
1598 1598
 				// Top-level section.
1599
-				$sections[ $section->id ] = $section;
1599
+				$sections[$section->id] = $section;
1600 1600
 			} else {
1601 1601
 				// This section belongs to a panel.
1602
-				if ( isset( $this->panels [ $section->panel ] ) ) {
1603
-					$this->panels[ $section->panel ]->sections[ $section->id ] = $section;
1602
+				if (isset($this->panels [$section->panel])) {
1603
+					$this->panels[$section->panel]->sections[$section->id] = $section;
1604 1604
 				}
1605 1605
 			}
1606 1606
 		}
1607 1607
 		$this->sections = $sections;
1608 1608
 
1609 1609
 		// Prepare panels.
1610
-		uasort( $this->panels, array( $this, '_cmp_priority' ) );
1610
+		uasort($this->panels, array($this, '_cmp_priority'));
1611 1611
 		$panels = array();
1612 1612
 
1613
-		foreach ( $this->panels as $panel ) {
1614
-			if ( ! $panel->check_capabilities() ) {
1613
+		foreach ($this->panels as $panel) {
1614
+			if ( ! $panel->check_capabilities()) {
1615 1615
 				continue;
1616 1616
 			}
1617 1617
 
1618
-			uasort( $panel->sections, array( $this, '_cmp_priority' ) );
1619
-			$panels[ $panel->id ] = $panel;
1618
+			uasort($panel->sections, array($this, '_cmp_priority'));
1619
+			$panels[$panel->id] = $panel;
1620 1620
 		}
1621 1621
 		$this->panels = $panels;
1622 1622
 
1623 1623
 		// Sort panels and top-level sections together.
1624
-		$this->containers = array_merge( $this->panels, $this->sections );
1625
-		uasort( $this->containers, array( $this, '_cmp_priority' ) );
1624
+		$this->containers = array_merge($this->panels, $this->sections);
1625
+		uasort($this->containers, array($this, '_cmp_priority'));
1626 1626
 	}
1627 1627
 
1628 1628
 	/**
@@ -1631,7 +1631,7 @@  discard block
 block discarded – undo
1631 1631
 	 * @since 3.4.0
1632 1632
 	 */
1633 1633
 	public function enqueue_control_scripts() {
1634
-		foreach ( $this->controls as $control ) {
1634
+		foreach ($this->controls as $control) {
1635 1635
 			$control->enqueue();
1636 1636
 		}
1637 1637
 	}
@@ -1645,7 +1645,7 @@  discard block
 block discarded – undo
1645 1645
 	 * @return bool Whether the user agent is iOS.
1646 1646
 	 */
1647 1647
 	public function is_ios() {
1648
-		return wp_is_mobile() && preg_match( '/iPad|iPod|iPhone/', $_SERVER['HTTP_USER_AGENT'] );
1648
+		return wp_is_mobile() && preg_match('/iPad|iPod|iPhone/', $_SERVER['HTTP_USER_AGENT']);
1649 1649
 	}
1650 1650
 
1651 1651
 	/**
@@ -1657,14 +1657,14 @@  discard block
 block discarded – undo
1657 1657
 	 * @return string The template string for the document title.
1658 1658
 	 */
1659 1659
 	public function get_document_title_template() {
1660
-		if ( $this->is_theme_active() ) {
1660
+		if ($this->is_theme_active()) {
1661 1661
 			/* translators: %s: document title from the preview */
1662
-			$document_title_tmpl = __( 'Customize: %s' );
1662
+			$document_title_tmpl = __('Customize: %s');
1663 1663
 		} else {
1664 1664
 			/* translators: %s: document title from the preview */
1665
-			$document_title_tmpl = __( 'Live Preview: %s' );
1665
+			$document_title_tmpl = __('Live Preview: %s');
1666 1666
 		}
1667
-		$document_title_tmpl = html_entity_decode( $document_title_tmpl, ENT_QUOTES, 'UTF-8' ); // Because exported to JS and assigned to document.title.
1667
+		$document_title_tmpl = html_entity_decode($document_title_tmpl, ENT_QUOTES, 'UTF-8'); // Because exported to JS and assigned to document.title.
1668 1668
 		return $document_title_tmpl;
1669 1669
 	}
1670 1670
 
@@ -1678,9 +1678,9 @@  discard block
 block discarded – undo
1678 1678
 	 *
1679 1679
 	 * @param string $preview_url URL to be previewed.
1680 1680
 	 */
1681
-	public function set_preview_url( $preview_url ) {
1682
-		$preview_url = esc_url_raw( $preview_url );
1683
-		$this->preview_url = wp_validate_redirect( $preview_url, home_url( '/' ) );
1681
+	public function set_preview_url($preview_url) {
1682
+		$preview_url = esc_url_raw($preview_url);
1683
+		$this->preview_url = wp_validate_redirect($preview_url, home_url('/'));
1684 1684
 	}
1685 1685
 
1686 1686
 	/**
@@ -1692,8 +1692,8 @@  discard block
 block discarded – undo
1692 1692
 	 * @return string URL being previewed.
1693 1693
 	 */
1694 1694
 	public function get_preview_url() {
1695
-		if ( empty( $this->preview_url ) ) {
1696
-			$preview_url = home_url( '/' );
1695
+		if (empty($this->preview_url)) {
1696
+			$preview_url = home_url('/');
1697 1697
 		} else {
1698 1698
 			$preview_url = $this->preview_url;
1699 1699
 		}
@@ -1710,10 +1710,10 @@  discard block
 block discarded – undo
1710 1710
 	 *
1711 1711
 	 * @param string $return_url URL for return link.
1712 1712
 	 */
1713
-	public function set_return_url( $return_url ) {
1714
-		$return_url = esc_url_raw( $return_url );
1715
-		$return_url = remove_query_arg( wp_removable_query_args(), $return_url );
1716
-		$return_url = wp_validate_redirect( $return_url );
1713
+	public function set_return_url($return_url) {
1714
+		$return_url = esc_url_raw($return_url);
1715
+		$return_url = remove_query_arg(wp_removable_query_args(), $return_url);
1716
+		$return_url = wp_validate_redirect($return_url);
1717 1717
 		$this->return_url = $return_url;
1718 1718
 	}
1719 1719
 
@@ -1727,16 +1727,16 @@  discard block
 block discarded – undo
1727 1727
 	 */
1728 1728
 	public function get_return_url() {
1729 1729
 		$referer = wp_get_referer();
1730
-		$excluded_referer_basenames = array( 'customize.php', 'wp-login.php' );
1730
+		$excluded_referer_basenames = array('customize.php', 'wp-login.php');
1731 1731
 
1732
-		if ( $this->return_url ) {
1732
+		if ($this->return_url) {
1733 1733
 			$return_url = $this->return_url;
1734
-		} else if ( $referer && ! in_array( basename( parse_url( $referer, PHP_URL_PATH ) ), $excluded_referer_basenames, true ) ) {
1734
+		} else if ($referer && ! in_array(basename(parse_url($referer, PHP_URL_PATH)), $excluded_referer_basenames, true)) {
1735 1735
 			$return_url = $referer;
1736
-		} else if ( $this->preview_url ) {
1736
+		} else if ($this->preview_url) {
1737 1737
 			$return_url = $this->preview_url;
1738 1738
 		} else {
1739
-			$return_url = home_url( '/' );
1739
+			$return_url = home_url('/');
1740 1740
 		}
1741 1741
 		return $return_url;
1742 1742
 	}
@@ -1755,8 +1755,8 @@  discard block
 block discarded – undo
1755 1755
 	 *     @type string [$panel]    ID for panel to be autofocused.
1756 1756
 	 * }
1757 1757
 	 */
1758
-	public function set_autofocus( $autofocus ) {
1759
-		$this->autofocus = array_filter( wp_array_slice_assoc( $autofocus, array( 'panel', 'section', 'control' ) ), 'is_string' );
1758
+	public function set_autofocus($autofocus) {
1759
+		$this->autofocus = array_filter(wp_array_slice_assoc($autofocus, array('panel', 'section', 'control')), 'is_string');
1760 1760
 	}
1761 1761
 
1762 1762
 	/**
@@ -1785,8 +1785,8 @@  discard block
 block discarded – undo
1785 1785
 	 */
1786 1786
 	public function get_nonces() {
1787 1787
 		$nonces = array(
1788
-			'save' => wp_create_nonce( 'save-customize_' . $this->get_stylesheet() ),
1789
-			'preview' => wp_create_nonce( 'preview-customize_' . $this->get_stylesheet() ),
1788
+			'save' => wp_create_nonce('save-customize_'.$this->get_stylesheet()),
1789
+			'preview' => wp_create_nonce('preview-customize_'.$this->get_stylesheet()),
1790 1790
 		);
1791 1791
 
1792 1792
 		/**
@@ -1798,7 +1798,7 @@  discard block
 block discarded – undo
1798 1798
 		 *                                     preview actions.
1799 1799
 		 * @param WP_Customize_Manager $this   WP_Customize_Manager instance.
1800 1800
 		 */
1801
-		$nonces = apply_filters( 'customize_refresh_nonces', $nonces, $this );
1801
+		$nonces = apply_filters('customize_refresh_nonces', $nonces, $this);
1802 1802
 
1803 1803
 		return $nonces;
1804 1804
 	}
@@ -1818,13 +1818,13 @@  discard block
 block discarded – undo
1818 1818
 		 * using the customize_allowed_urls filter.
1819 1819
 		 */
1820 1820
 
1821
-		$allowed_urls = array( home_url( '/' ) );
1822
-		$admin_origin = parse_url( admin_url() );
1823
-		$home_origin  = parse_url( home_url() );
1824
-		$cross_domain = ( strtolower( $admin_origin['host'] ) !== strtolower( $home_origin['host'] ) );
1821
+		$allowed_urls = array(home_url('/'));
1822
+		$admin_origin = parse_url(admin_url());
1823
+		$home_origin  = parse_url(home_url());
1824
+		$cross_domain = (strtolower($admin_origin['host']) !== strtolower($home_origin['host']));
1825 1825
 
1826
-		if ( is_ssl() && ! $cross_domain ) {
1827
-			$allowed_urls[] = home_url( '/', 'https' );
1826
+		if (is_ssl() && ! $cross_domain) {
1827
+			$allowed_urls[] = home_url('/', 'https');
1828 1828
 		}
1829 1829
 
1830 1830
 		/**
@@ -1834,12 +1834,12 @@  discard block
 block discarded – undo
1834 1834
 		 *
1835 1835
 		 * @param array $allowed_urls An array of allowed URLs.
1836 1836
 		 */
1837
-		$allowed_urls = array_unique( apply_filters( 'customize_allowed_urls', $allowed_urls ) );
1837
+		$allowed_urls = array_unique(apply_filters('customize_allowed_urls', $allowed_urls));
1838 1838
 
1839
-		$login_url = add_query_arg( array(
1839
+		$login_url = add_query_arg(array(
1840 1840
 			'interim-login' => 1,
1841 1841
 			'customize-login' => 1,
1842
-		), wp_login_url() );
1842
+		), wp_login_url());
1843 1843
 
1844 1844
 		// Prepare Customizer settings to pass to JavaScript.
1845 1845
 		$settings = array(
@@ -1848,14 +1848,14 @@  discard block
 block discarded – undo
1848 1848
 				'active'     => $this->is_theme_active(),
1849 1849
 			),
1850 1850
 			'url'      => array(
1851
-				'preview'       => esc_url_raw( $this->get_preview_url() ),
1852
-				'parent'        => esc_url_raw( admin_url() ),
1853
-				'activated'     => esc_url_raw( home_url( '/' ) ),
1854
-				'ajax'          => esc_url_raw( admin_url( 'admin-ajax.php', 'relative' ) ),
1855
-				'allowed'       => array_map( 'esc_url_raw', $allowed_urls ),
1851
+				'preview'       => esc_url_raw($this->get_preview_url()),
1852
+				'parent'        => esc_url_raw(admin_url()),
1853
+				'activated'     => esc_url_raw(home_url('/')),
1854
+				'ajax'          => esc_url_raw(admin_url('admin-ajax.php', 'relative')),
1855
+				'allowed'       => array_map('esc_url_raw', $allowed_urls),
1856 1856
 				'isCrossDomain' => $cross_domain,
1857
-				'home'          => esc_url_raw( home_url( '/' ) ),
1858
-				'login'         => esc_url_raw( $login_url ),
1857
+				'home'          => esc_url_raw(home_url('/')),
1858
+				'login'         => esc_url_raw($login_url),
1859 1859
 			),
1860 1860
 			'browser'  => array(
1861 1861
 				'mobile' => wp_is_mobile(),
@@ -1870,19 +1870,19 @@  discard block
 block discarded – undo
1870 1870
 		);
1871 1871
 
1872 1872
 		// Prepare Customize Section objects to pass to JavaScript.
1873
-		foreach ( $this->sections() as $id => $section ) {
1874
-			if ( $section->check_capabilities() ) {
1875
-				$settings['sections'][ $id ] = $section->json();
1873
+		foreach ($this->sections() as $id => $section) {
1874
+			if ($section->check_capabilities()) {
1875
+				$settings['sections'][$id] = $section->json();
1876 1876
 			}
1877 1877
 		}
1878 1878
 
1879 1879
 		// Prepare Customize Panel objects to pass to JavaScript.
1880
-		foreach ( $this->panels() as $panel_id => $panel ) {
1881
-			if ( $panel->check_capabilities() ) {
1882
-				$settings['panels'][ $panel_id ] = $panel->json();
1883
-				foreach ( $panel->sections as $section_id => $section ) {
1884
-					if ( $section->check_capabilities() ) {
1885
-						$settings['sections'][ $section_id ] = $section->json();
1880
+		foreach ($this->panels() as $panel_id => $panel) {
1881
+			if ($panel->check_capabilities()) {
1882
+				$settings['panels'][$panel_id] = $panel->json();
1883
+				foreach ($panel->sections as $section_id => $section) {
1884
+					if ($section->check_capabilities()) {
1885
+						$settings['sections'][$section_id] = $section->json();
1886 1886
 					}
1887 1887
 				}
1888 1888
 			}
@@ -1890,19 +1890,19 @@  discard block
 block discarded – undo
1890 1890
 
1891 1891
 		?>
1892 1892
 		<script type="text/javascript">
1893
-			var _wpCustomizeSettings = <?php echo wp_json_encode( $settings ); ?>;
1893
+			var _wpCustomizeSettings = <?php echo wp_json_encode($settings); ?>;
1894 1894
 			_wpCustomizeSettings.controls = {};
1895 1895
 			_wpCustomizeSettings.settings = {};
1896 1896
 			<?php
1897 1897
 
1898 1898
 			// Serialize settings one by one to improve memory usage.
1899 1899
 			echo "(function ( s ){\n";
1900
-			foreach ( $this->settings() as $setting ) {
1901
-				if ( $setting->check_capabilities() ) {
1900
+			foreach ($this->settings() as $setting) {
1901
+				if ($setting->check_capabilities()) {
1902 1902
 					printf(
1903 1903
 						"s[%s] = %s;\n",
1904
-						wp_json_encode( $setting->id ),
1905
-						wp_json_encode( $setting->json() )
1904
+						wp_json_encode($setting->id),
1905
+						wp_json_encode($setting->json())
1906 1906
 					);
1907 1907
 				}
1908 1908
 			}
@@ -1910,12 +1910,12 @@  discard block
 block discarded – undo
1910 1910
 
1911 1911
 			// Serialize controls one by one to improve memory usage.
1912 1912
 			echo "(function ( c ){\n";
1913
-			foreach ( $this->controls() as $control ) {
1914
-				if ( $control->check_capabilities() ) {
1913
+			foreach ($this->controls() as $control) {
1914
+				if ($control->check_capabilities()) {
1915 1915
 					printf(
1916 1916
 						"c[%s] = %s;\n",
1917
-						wp_json_encode( $control->id ),
1918
-						wp_json_encode( $control->json() )
1917
+						wp_json_encode($control->id),
1918
+						wp_json_encode($control->json())
1919 1919
 					);
1920 1920
 				}
1921 1921
 			}
@@ -1936,14 +1936,14 @@  discard block
 block discarded – undo
1936 1936
 	public function get_previewable_devices() {
1937 1937
 		$devices = array(
1938 1938
 			'desktop' => array(
1939
-				'label' => __( 'Enter desktop preview mode' ),
1939
+				'label' => __('Enter desktop preview mode'),
1940 1940
 				'default' => true,
1941 1941
 			),
1942 1942
 			'tablet' => array(
1943
-				'label' => __( 'Enter tablet preview mode' ),
1943
+				'label' => __('Enter tablet preview mode'),
1944 1944
 			),
1945 1945
 			'mobile' => array(
1946
-				'label' => __( 'Enter mobile preview mode' ),
1946
+				'label' => __('Enter mobile preview mode'),
1947 1947
 			),
1948 1948
 		);
1949 1949
 
@@ -1956,7 +1956,7 @@  discard block
 block discarded – undo
1956 1956
 		 *
1957 1957
 		 * @param array $devices List of devices with labels and default setting.
1958 1958
 		 */
1959
-		$devices = apply_filters( 'customize_previewable_devices', $devices );
1959
+		$devices = apply_filters('customize_previewable_devices', $devices);
1960 1960
 
1961 1961
 		return $devices;
1962 1962
 	}
@@ -1969,134 +1969,134 @@  discard block
 block discarded – undo
1969 1969
 	public function register_controls() {
1970 1970
 
1971 1971
 		/* Panel, Section, and Control Types */
1972
-		$this->register_panel_type( 'WP_Customize_Panel' );
1973
-		$this->register_section_type( 'WP_Customize_Section' );
1974
-		$this->register_section_type( 'WP_Customize_Sidebar_Section' );
1975
-		$this->register_control_type( 'WP_Customize_Color_Control' );
1976
-		$this->register_control_type( 'WP_Customize_Media_Control' );
1977
-		$this->register_control_type( 'WP_Customize_Upload_Control' );
1978
-		$this->register_control_type( 'WP_Customize_Image_Control' );
1979
-		$this->register_control_type( 'WP_Customize_Background_Image_Control' );
1980
-		$this->register_control_type( 'WP_Customize_Cropped_Image_Control' );
1981
-		$this->register_control_type( 'WP_Customize_Site_Icon_Control' );
1982
-		$this->register_control_type( 'WP_Customize_Theme_Control' );
1972
+		$this->register_panel_type('WP_Customize_Panel');
1973
+		$this->register_section_type('WP_Customize_Section');
1974
+		$this->register_section_type('WP_Customize_Sidebar_Section');
1975
+		$this->register_control_type('WP_Customize_Color_Control');
1976
+		$this->register_control_type('WP_Customize_Media_Control');
1977
+		$this->register_control_type('WP_Customize_Upload_Control');
1978
+		$this->register_control_type('WP_Customize_Image_Control');
1979
+		$this->register_control_type('WP_Customize_Background_Image_Control');
1980
+		$this->register_control_type('WP_Customize_Cropped_Image_Control');
1981
+		$this->register_control_type('WP_Customize_Site_Icon_Control');
1982
+		$this->register_control_type('WP_Customize_Theme_Control');
1983 1983
 
1984 1984
 		/* Themes */
1985 1985
 
1986
-		$this->add_section( new WP_Customize_Themes_Section( $this, 'themes', array(
1987
-			'title'      => $this->theme()->display( 'Name' ),
1986
+		$this->add_section(new WP_Customize_Themes_Section($this, 'themes', array(
1987
+			'title'      => $this->theme()->display('Name'),
1988 1988
 			'capability' => 'switch_themes',
1989 1989
 			'priority'   => 0,
1990
-		) ) );
1990
+		)));
1991 1991
 
1992 1992
 		// Themes Setting (unused - the theme is considerably more fundamental to the Customizer experience).
1993
-		$this->add_setting( new WP_Customize_Filter_Setting( $this, 'active_theme', array(
1993
+		$this->add_setting(new WP_Customize_Filter_Setting($this, 'active_theme', array(
1994 1994
 			'capability' => 'switch_themes',
1995
-		) ) );
1995
+		)));
1996 1996
 
1997
-		require_once( ABSPATH . 'wp-admin/includes/theme.php' );
1997
+		require_once(ABSPATH.'wp-admin/includes/theme.php');
1998 1998
 
1999 1999
 		// Theme Controls.
2000 2000
 
2001 2001
 		// Add a control for the active/original theme.
2002
-		if ( ! $this->is_theme_active() ) {
2003
-			$themes = wp_prepare_themes_for_js( array( wp_get_theme( $this->original_stylesheet ) ) );
2004
-			$active_theme = current( $themes );
2002
+		if ( ! $this->is_theme_active()) {
2003
+			$themes = wp_prepare_themes_for_js(array(wp_get_theme($this->original_stylesheet)));
2004
+			$active_theme = current($themes);
2005 2005
 			$active_theme['isActiveTheme'] = true;
2006
-			$this->add_control( new WP_Customize_Theme_Control( $this, $active_theme['id'], array(
2006
+			$this->add_control(new WP_Customize_Theme_Control($this, $active_theme['id'], array(
2007 2007
 				'theme'    => $active_theme,
2008 2008
 				'section'  => 'themes',
2009 2009
 				'settings' => 'active_theme',
2010
-			) ) );
2010
+			)));
2011 2011
 		}
2012 2012
 
2013 2013
 		$themes = wp_prepare_themes_for_js();
2014
-		foreach ( $themes as $theme ) {
2015
-			if ( $theme['active'] || $theme['id'] === $this->original_stylesheet ) {
2014
+		foreach ($themes as $theme) {
2015
+			if ($theme['active'] || $theme['id'] === $this->original_stylesheet) {
2016 2016
 				continue;
2017 2017
 			}
2018 2018
 
2019
-			$theme_id = 'theme_' . $theme['id'];
2019
+			$theme_id = 'theme_'.$theme['id'];
2020 2020
 			$theme['isActiveTheme'] = false;
2021
-			$this->add_control( new WP_Customize_Theme_Control( $this, $theme_id, array(
2021
+			$this->add_control(new WP_Customize_Theme_Control($this, $theme_id, array(
2022 2022
 				'theme'    => $theme,
2023 2023
 				'section'  => 'themes',
2024 2024
 				'settings' => 'active_theme',
2025
-			) ) );
2025
+			)));
2026 2026
 		}
2027 2027
 
2028 2028
 		/* Site Identity */
2029 2029
 
2030
-		$this->add_section( 'title_tagline', array(
2031
-			'title'    => __( 'Site Identity' ),
2030
+		$this->add_section('title_tagline', array(
2031
+			'title'    => __('Site Identity'),
2032 2032
 			'priority' => 20,
2033
-		) );
2033
+		));
2034 2034
 
2035
-		$this->add_setting( 'blogname', array(
2036
-			'default'    => get_option( 'blogname' ),
2035
+		$this->add_setting('blogname', array(
2036
+			'default'    => get_option('blogname'),
2037 2037
 			'type'       => 'option',
2038 2038
 			'capability' => 'manage_options',
2039
-		) );
2039
+		));
2040 2040
 
2041
-		$this->add_control( 'blogname', array(
2042
-			'label'      => __( 'Site Title' ),
2041
+		$this->add_control('blogname', array(
2042
+			'label'      => __('Site Title'),
2043 2043
 			'section'    => 'title_tagline',
2044
-		) );
2044
+		));
2045 2045
 
2046
-		$this->add_setting( 'blogdescription', array(
2047
-			'default'    => get_option( 'blogdescription' ),
2046
+		$this->add_setting('blogdescription', array(
2047
+			'default'    => get_option('blogdescription'),
2048 2048
 			'type'       => 'option',
2049 2049
 			'capability' => 'manage_options',
2050
-		) );
2050
+		));
2051 2051
 
2052
-		$this->add_control( 'blogdescription', array(
2053
-			'label'      => __( 'Tagline' ),
2052
+		$this->add_control('blogdescription', array(
2053
+			'label'      => __('Tagline'),
2054 2054
 			'section'    => 'title_tagline',
2055
-		) );
2055
+		));
2056 2056
 
2057 2057
 		// Add a setting to hide header text if the theme doesn't support custom headers.
2058
-		if ( ! current_theme_supports( 'custom-header', 'header-text' ) ) {
2059
-			$this->add_setting( 'header_text', array(
2060
-				'theme_supports'    => array( 'custom-logo', 'header-text' ),
2058
+		if ( ! current_theme_supports('custom-header', 'header-text')) {
2059
+			$this->add_setting('header_text', array(
2060
+				'theme_supports'    => array('custom-logo', 'header-text'),
2061 2061
 				'default'           => 1,
2062 2062
 				'sanitize_callback' => 'absint',
2063
-			) );
2063
+			));
2064 2064
 
2065
-			$this->add_control( 'header_text', array(
2066
-				'label'    => __( 'Display Site Title and Tagline' ),
2065
+			$this->add_control('header_text', array(
2066
+				'label'    => __('Display Site Title and Tagline'),
2067 2067
 				'section'  => 'title_tagline',
2068 2068
 				'settings' => 'header_text',
2069 2069
 				'type'     => 'checkbox',
2070
-			) );
2070
+			));
2071 2071
 		}
2072 2072
 
2073
-		$this->add_setting( 'site_icon', array(
2073
+		$this->add_setting('site_icon', array(
2074 2074
 			'type'       => 'option',
2075 2075
 			'capability' => 'manage_options',
2076 2076
 			'transport'  => 'postMessage', // Previewed with JS in the Customizer controls window.
2077
-		) );
2077
+		));
2078 2078
 
2079
-		$this->add_control( new WP_Customize_Site_Icon_Control( $this, 'site_icon', array(
2080
-			'label'       => __( 'Site Icon' ),
2079
+		$this->add_control(new WP_Customize_Site_Icon_Control($this, 'site_icon', array(
2080
+			'label'       => __('Site Icon'),
2081 2081
 			'description' => sprintf(
2082 2082
 				/* translators: %s: site icon size in pixels */
2083
-				__( 'The Site Icon is used as a browser and app icon for your site. Icons must be square, and at least %s pixels wide and tall.' ),
2083
+				__('The Site Icon is used as a browser and app icon for your site. Icons must be square, and at least %s pixels wide and tall.'),
2084 2084
 				'<strong>512</strong>'
2085 2085
 			),
2086 2086
 			'section'     => 'title_tagline',
2087 2087
 			'priority'    => 60,
2088 2088
 			'height'      => 512,
2089 2089
 			'width'       => 512,
2090
-		) ) );
2090
+		)));
2091 2091
 
2092
-		$this->add_setting( 'custom_logo', array(
2093
-			'theme_supports' => array( 'custom-logo' ),
2092
+		$this->add_setting('custom_logo', array(
2093
+			'theme_supports' => array('custom-logo'),
2094 2094
 			'transport'      => 'postMessage',
2095
-		) );
2095
+		));
2096 2096
 
2097
-		$custom_logo_args = get_theme_support( 'custom-logo' );
2098
-		$this->add_control( new WP_Customize_Cropped_Image_Control( $this, 'custom_logo', array(
2099
-			'label'         => __( 'Logo' ),
2097
+		$custom_logo_args = get_theme_support('custom-logo');
2098
+		$this->add_control(new WP_Customize_Cropped_Image_Control($this, 'custom_logo', array(
2099
+			'label'         => __('Logo'),
2100 2100
 			'section'       => 'title_tagline',
2101 2101
 			'priority'      => 8,
2102 2102
 			'height'        => $custom_logo_args[0]['height'],
@@ -2104,115 +2104,115 @@  discard block
 block discarded – undo
2104 2104
 			'flex_height'   => $custom_logo_args[0]['flex-height'],
2105 2105
 			'flex_width'    => $custom_logo_args[0]['flex-width'],
2106 2106
 			'button_labels' => array(
2107
-				'select'       => __( 'Select logo' ),
2108
-				'change'       => __( 'Change logo' ),
2109
-				'remove'       => __( 'Remove' ),
2110
-				'default'      => __( 'Default' ),
2111
-				'placeholder'  => __( 'No logo selected' ),
2112
-				'frame_title'  => __( 'Select logo' ),
2113
-				'frame_button' => __( 'Choose logo' ),
2107
+				'select'       => __('Select logo'),
2108
+				'change'       => __('Change logo'),
2109
+				'remove'       => __('Remove'),
2110
+				'default'      => __('Default'),
2111
+				'placeholder'  => __('No logo selected'),
2112
+				'frame_title'  => __('Select logo'),
2113
+				'frame_button' => __('Choose logo'),
2114 2114
 			),
2115
-		) ) );
2115
+		)));
2116 2116
 
2117
-		$this->selective_refresh->add_partial( 'custom_logo', array(
2118
-			'settings'            => array( 'custom_logo' ),
2117
+		$this->selective_refresh->add_partial('custom_logo', array(
2118
+			'settings'            => array('custom_logo'),
2119 2119
 			'selector'            => '.custom-logo-link',
2120
-			'render_callback'     => array( $this, '_render_custom_logo_partial' ),
2120
+			'render_callback'     => array($this, '_render_custom_logo_partial'),
2121 2121
 			'container_inclusive' => true,
2122
-		) );
2122
+		));
2123 2123
 
2124 2124
 		/* Colors */
2125 2125
 
2126
-		$this->add_section( 'colors', array(
2127
-			'title'          => __( 'Colors' ),
2126
+		$this->add_section('colors', array(
2127
+			'title'          => __('Colors'),
2128 2128
 			'priority'       => 40,
2129
-		) );
2129
+		));
2130 2130
 
2131
-		$this->add_setting( 'header_textcolor', array(
2132
-			'theme_supports' => array( 'custom-header', 'header-text' ),
2133
-			'default'        => get_theme_support( 'custom-header', 'default-text-color' ),
2131
+		$this->add_setting('header_textcolor', array(
2132
+			'theme_supports' => array('custom-header', 'header-text'),
2133
+			'default'        => get_theme_support('custom-header', 'default-text-color'),
2134 2134
 
2135
-			'sanitize_callback'    => array( $this, '_sanitize_header_textcolor' ),
2135
+			'sanitize_callback'    => array($this, '_sanitize_header_textcolor'),
2136 2136
 			'sanitize_js_callback' => 'maybe_hash_hex_color',
2137
-		) );
2137
+		));
2138 2138
 
2139 2139
 		// Input type: checkbox
2140 2140
 		// With custom value
2141
-		$this->add_control( 'display_header_text', array(
2141
+		$this->add_control('display_header_text', array(
2142 2142
 			'settings' => 'header_textcolor',
2143
-			'label'    => __( 'Display Site Title and Tagline' ),
2143
+			'label'    => __('Display Site Title and Tagline'),
2144 2144
 			'section'  => 'title_tagline',
2145 2145
 			'type'     => 'checkbox',
2146 2146
 			'priority' => 40,
2147
-		) );
2147
+		));
2148 2148
 
2149
-		$this->add_control( new WP_Customize_Color_Control( $this, 'header_textcolor', array(
2150
-			'label'   => __( 'Header Text Color' ),
2149
+		$this->add_control(new WP_Customize_Color_Control($this, 'header_textcolor', array(
2150
+			'label'   => __('Header Text Color'),
2151 2151
 			'section' => 'colors',
2152
-		) ) );
2152
+		)));
2153 2153
 
2154 2154
 		// Input type: Color
2155 2155
 		// With sanitize_callback
2156
-		$this->add_setting( 'background_color', array(
2157
-			'default'        => get_theme_support( 'custom-background', 'default-color' ),
2156
+		$this->add_setting('background_color', array(
2157
+			'default'        => get_theme_support('custom-background', 'default-color'),
2158 2158
 			'theme_supports' => 'custom-background',
2159 2159
 
2160 2160
 			'sanitize_callback'    => 'sanitize_hex_color_no_hash',
2161 2161
 			'sanitize_js_callback' => 'maybe_hash_hex_color',
2162
-		) );
2162
+		));
2163 2163
 
2164
-		$this->add_control( new WP_Customize_Color_Control( $this, 'background_color', array(
2165
-			'label'   => __( 'Background Color' ),
2164
+		$this->add_control(new WP_Customize_Color_Control($this, 'background_color', array(
2165
+			'label'   => __('Background Color'),
2166 2166
 			'section' => 'colors',
2167
-		) ) );
2167
+		)));
2168 2168
 
2169 2169
 
2170 2170
 		/* Custom Header */
2171 2171
 
2172
-		$this->add_section( 'header_image', array(
2173
-			'title'          => __( 'Header Image' ),
2172
+		$this->add_section('header_image', array(
2173
+			'title'          => __('Header Image'),
2174 2174
 			'theme_supports' => 'custom-header',
2175 2175
 			'priority'       => 60,
2176
-		) );
2176
+		));
2177 2177
 
2178
-		$this->add_setting( new WP_Customize_Filter_Setting( $this, 'header_image', array(
2179
-			'default'        => get_theme_support( 'custom-header', 'default-image' ),
2178
+		$this->add_setting(new WP_Customize_Filter_Setting($this, 'header_image', array(
2179
+			'default'        => get_theme_support('custom-header', 'default-image'),
2180 2180
 			'theme_supports' => 'custom-header',
2181
-		) ) );
2181
+		)));
2182 2182
 
2183
-		$this->add_setting( new WP_Customize_Header_Image_Setting( $this, 'header_image_data', array(
2183
+		$this->add_setting(new WP_Customize_Header_Image_Setting($this, 'header_image_data', array(
2184 2184
 			// 'default'        => get_theme_support( 'custom-header', 'default-image' ),
2185 2185
 			'theme_supports' => 'custom-header',
2186
-		) ) );
2186
+		)));
2187 2187
 
2188
-		$this->add_control( new WP_Customize_Header_Image_Control( $this ) );
2188
+		$this->add_control(new WP_Customize_Header_Image_Control($this));
2189 2189
 
2190 2190
 		/* Custom Background */
2191 2191
 
2192
-		$this->add_section( 'background_image', array(
2193
-			'title'          => __( 'Background Image' ),
2192
+		$this->add_section('background_image', array(
2193
+			'title'          => __('Background Image'),
2194 2194
 			'theme_supports' => 'custom-background',
2195 2195
 			'priority'       => 80,
2196
-		) );
2196
+		));
2197 2197
 
2198
-		$this->add_setting( 'background_image', array(
2199
-			'default'        => get_theme_support( 'custom-background', 'default-image' ),
2198
+		$this->add_setting('background_image', array(
2199
+			'default'        => get_theme_support('custom-background', 'default-image'),
2200 2200
 			'theme_supports' => 'custom-background',
2201
-		) );
2201
+		));
2202 2202
 
2203
-		$this->add_setting( new WP_Customize_Background_Image_Setting( $this, 'background_image_thumb', array(
2203
+		$this->add_setting(new WP_Customize_Background_Image_Setting($this, 'background_image_thumb', array(
2204 2204
 			'theme_supports' => 'custom-background',
2205
-		) ) );
2205
+		)));
2206 2206
 
2207
-		$this->add_control( new WP_Customize_Background_Image_Control( $this ) );
2207
+		$this->add_control(new WP_Customize_Background_Image_Control($this));
2208 2208
 
2209
-		$this->add_setting( 'background_repeat', array(
2210
-			'default'        => get_theme_support( 'custom-background', 'default-repeat' ),
2209
+		$this->add_setting('background_repeat', array(
2210
+			'default'        => get_theme_support('custom-background', 'default-repeat'),
2211 2211
 			'theme_supports' => 'custom-background',
2212
-		) );
2212
+		));
2213 2213
 
2214
-		$this->add_control( 'background_repeat', array(
2215
-			'label'      => __( 'Background Repeat' ),
2214
+		$this->add_control('background_repeat', array(
2215
+			'label'      => __('Background Repeat'),
2216 2216
 			'section'    => 'background_image',
2217 2217
 			'type'       => 'radio',
2218 2218
 			'choices'    => array(
@@ -2221,15 +2221,15 @@  discard block
 block discarded – undo
2221 2221
 				'repeat-x'   => __('Tile Horizontally'),
2222 2222
 				'repeat-y'   => __('Tile Vertically'),
2223 2223
 			),
2224
-		) );
2224
+		));
2225 2225
 
2226
-		$this->add_setting( 'background_position_x', array(
2227
-			'default'        => get_theme_support( 'custom-background', 'default-position-x' ),
2226
+		$this->add_setting('background_position_x', array(
2227
+			'default'        => get_theme_support('custom-background', 'default-position-x'),
2228 2228
 			'theme_supports' => 'custom-background',
2229
-		) );
2229
+		));
2230 2230
 
2231
-		$this->add_control( 'background_position_x', array(
2232
-			'label'      => __( 'Background Position' ),
2231
+		$this->add_control('background_position_x', array(
2232
+			'label'      => __('Background Position'),
2233 2233
 			'section'    => 'background_image',
2234 2234
 			'type'       => 'radio',
2235 2235
 			'choices'    => array(
@@ -2237,28 +2237,28 @@  discard block
 block discarded – undo
2237 2237
 				'center'     => __('Center'),
2238 2238
 				'right'      => __('Right'),
2239 2239
 			),
2240
-		) );
2240
+		));
2241 2241
 
2242
-		$this->add_setting( 'background_attachment', array(
2243
-			'default'        => get_theme_support( 'custom-background', 'default-attachment' ),
2242
+		$this->add_setting('background_attachment', array(
2243
+			'default'        => get_theme_support('custom-background', 'default-attachment'),
2244 2244
 			'theme_supports' => 'custom-background',
2245
-		) );
2245
+		));
2246 2246
 
2247
-		$this->add_control( 'background_attachment', array(
2248
-			'label'      => __( 'Background Attachment' ),
2247
+		$this->add_control('background_attachment', array(
2248
+			'label'      => __('Background Attachment'),
2249 2249
 			'section'    => 'background_image',
2250 2250
 			'type'       => 'radio',
2251 2251
 			'choices'    => array(
2252 2252
 				'scroll'     => __('Scroll'),
2253 2253
 				'fixed'      => __('Fixed'),
2254 2254
 			),
2255
-		) );
2255
+		));
2256 2256
 
2257 2257
 		// If the theme is using the default background callback, we can update
2258 2258
 		// the background CSS using postMessage.
2259
-		if ( get_theme_support( 'custom-background', 'wp-head-callback' ) === '_custom_background_cb' ) {
2260
-			foreach ( array( 'color', 'image', 'position_x', 'repeat', 'attachment' ) as $prop ) {
2261
-				$this->get_setting( 'background_' . $prop )->transport = 'postMessage';
2259
+		if (get_theme_support('custom-background', 'wp-head-callback') === '_custom_background_cb') {
2260
+			foreach (array('color', 'image', 'position_x', 'repeat', 'attachment') as $prop) {
2261
+				$this->get_setting('background_'.$prop)->transport = 'postMessage';
2262 2262
 			}
2263 2263
 		}
2264 2264
 
@@ -2266,54 +2266,54 @@  discard block
 block discarded – undo
2266 2266
 		// #WP19627
2267 2267
 
2268 2268
 		// Replicate behavior from options-reading.php and hide front page options if there are no pages
2269
-		if ( get_pages() ) {
2270
-			$this->add_section( 'static_front_page', array(
2271
-				'title'          => __( 'Static Front Page' ),
2269
+		if (get_pages()) {
2270
+			$this->add_section('static_front_page', array(
2271
+				'title'          => __('Static Front Page'),
2272 2272
 			//	'theme_supports' => 'static-front-page',
2273 2273
 				'priority'       => 120,
2274
-				'description'    => __( 'Your theme supports a static front page.' ),
2275
-			) );
2274
+				'description'    => __('Your theme supports a static front page.'),
2275
+			));
2276 2276
 
2277
-			$this->add_setting( 'show_on_front', array(
2278
-				'default'        => get_option( 'show_on_front' ),
2277
+			$this->add_setting('show_on_front', array(
2278
+				'default'        => get_option('show_on_front'),
2279 2279
 				'capability'     => 'manage_options',
2280 2280
 				'type'           => 'option',
2281 2281
 			//	'theme_supports' => 'static-front-page',
2282
-			) );
2282
+			));
2283 2283
 
2284
-			$this->add_control( 'show_on_front', array(
2285
-				'label'   => __( 'Front page displays' ),
2284
+			$this->add_control('show_on_front', array(
2285
+				'label'   => __('Front page displays'),
2286 2286
 				'section' => 'static_front_page',
2287 2287
 				'type'    => 'radio',
2288 2288
 				'choices' => array(
2289
-					'posts' => __( 'Your latest posts' ),
2290
-					'page'  => __( 'A static page' ),
2289
+					'posts' => __('Your latest posts'),
2290
+					'page'  => __('A static page'),
2291 2291
 				),
2292
-			) );
2292
+			));
2293 2293
 
2294
-			$this->add_setting( 'page_on_front', array(
2294
+			$this->add_setting('page_on_front', array(
2295 2295
 				'type'       => 'option',
2296 2296
 				'capability' => 'manage_options',
2297 2297
 			//	'theme_supports' => 'static-front-page',
2298
-			) );
2298
+			));
2299 2299
 
2300
-			$this->add_control( 'page_on_front', array(
2301
-				'label'      => __( 'Front page' ),
2300
+			$this->add_control('page_on_front', array(
2301
+				'label'      => __('Front page'),
2302 2302
 				'section'    => 'static_front_page',
2303 2303
 				'type'       => 'dropdown-pages',
2304
-			) );
2304
+			));
2305 2305
 
2306
-			$this->add_setting( 'page_for_posts', array(
2306
+			$this->add_setting('page_for_posts', array(
2307 2307
 				'type'           => 'option',
2308 2308
 				'capability'     => 'manage_options',
2309 2309
 			//	'theme_supports' => 'static-front-page',
2310
-			) );
2310
+			));
2311 2311
 
2312
-			$this->add_control( 'page_for_posts', array(
2313
-				'label'      => __( 'Posts page' ),
2312
+			$this->add_control('page_for_posts', array(
2313
+				'label'      => __('Posts page'),
2314 2314
 				'section'    => 'static_front_page',
2315 2315
 				'type'       => 'dropdown-pages',
2316
-			) );
2316
+			));
2317 2317
 		}
2318 2318
 	}
2319 2319
 
@@ -2326,7 +2326,7 @@  discard block
 block discarded – undo
2326 2326
 	 * @see add_dynamic_settings()
2327 2327
 	 */
2328 2328
 	public function register_dynamic_settings() {
2329
-		$this->add_dynamic_settings( array_keys( $this->unsanitized_post_values() ) );
2329
+		$this->add_dynamic_settings(array_keys($this->unsanitized_post_values()));
2330 2330
 	}
2331 2331
 
2332 2332
 	/**
@@ -2340,13 +2340,13 @@  discard block
 block discarded – undo
2340 2340
 	 * @param string $color
2341 2341
 	 * @return mixed
2342 2342
 	 */
2343
-	public function _sanitize_header_textcolor( $color ) {
2344
-		if ( 'blank' === $color )
2343
+	public function _sanitize_header_textcolor($color) {
2344
+		if ('blank' === $color)
2345 2345
 			return 'blank';
2346 2346
 
2347
-		$color = sanitize_hex_color_no_hash( $color );
2348
-		if ( empty( $color ) )
2349
-			$color = get_theme_support( 'custom-header', 'default-text-color' );
2347
+		$color = sanitize_hex_color_no_hash($color);
2348
+		if (empty($color))
2349
+			$color = get_theme_support('custom-header', 'default-text-color');
2350 2350
 
2351 2351
 		return $color;
2352 2352
 	}
Please login to merge, or discard this patch.
src/wp-includes/deprecated.php 3 patches
Doc Comments   +4 added lines, -5 removed lines patch added patch discarded remove patch
@@ -610,7 +610,7 @@  discard block
 block discarded – undo
610 610
  * @param string $feed_image
611 611
  * @param string $exclude
612 612
  * @param bool $hierarchical
613
- * @return false|null
613
+ * @return false|string
614 614
  */
615 615
 function list_cats($optionall = 1, $all = 'All', $sort_column = 'ID', $sort_order = 'asc', $file = '', $list = true, $optiondates = 0,
616 616
 				   $optioncount = 0, $hide_empty = 1, $use_desc_for_title = 1, $children=false, $child_of=0, $categories=0,
@@ -630,7 +630,7 @@  discard block
 block discarded – undo
630 630
  * @see wp_list_categories()
631 631
  *
632 632
  * @param string|array $args
633
- * @return false|null|string
633
+ * @return false|string
634 634
  */
635 635
 function wp_list_cats($args = '') {
636 636
 	_deprecated_function( __FUNCTION__, '2.1.0', 'wp_list_categories()' );
@@ -2101,7 +2101,6 @@  discard block
 block discarded – undo
2101 2101
  * @param string|int $name            Widget ID.
2102 2102
  * @param callable   $output_callback Run when widget is called.
2103 2103
  * @param string     $classname       Optional. Classname widget option. Default empty.
2104
- * @param mixed      $params ,...     Widget parameters.
2105 2104
  */
2106 2105
 function register_sidebar_widget($name, $output_callback, $classname = '') {
2107 2106
 	_deprecated_function( __FUNCTION__, '2.8.0', 'wp_register_sidebar_widget()' );
@@ -2419,7 +2418,7 @@  discard block
 block discarded – undo
2419 2418
  * @see count_user_posts()
2420 2419
  *
2421 2420
  * @param int $userid User to count posts for.
2422
- * @return int Number of posts the given user has written.
2421
+ * @return string Number of posts the given user has written.
2423 2422
  */
2424 2423
 function get_usernumposts( $userid ) {
2425 2424
 	_deprecated_function( __FUNCTION__, '3.0.0', 'count_user_posts()' );
@@ -3601,7 +3600,7 @@  discard block
 block discarded – undo
3601 3600
  * @deprecated 4.4.0 Use get_permalink()
3602 3601
  * @see get_permalink()
3603 3602
  *
3604
- * @param int|WP_Post $post_id Optional. Post ID or WP_Post object. Default is global $post.
3603
+ * @param integer $post_id Optional. Post ID or WP_Post object. Default is global $post.
3605 3604
  * @return string|false
3606 3605
  */
3607 3606
 function post_permalink( $post_id = 0 ) {
Please login to merge, or discard this patch.
Spacing   +527 added lines, -527 removed lines patch added patch discarded remove patch
@@ -23,11 +23,11 @@  discard block
 block discarded – undo
23 23
  * @return array Post data.
24 24
  */
25 25
 function get_postdata($postid) {
26
-	_deprecated_function( __FUNCTION__, '1.5.1', 'get_post()' );
26
+	_deprecated_function(__FUNCTION__, '1.5.1', 'get_post()');
27 27
 
28 28
 	$post = get_post($postid);
29 29
 
30
-	$postdata = array (
30
+	$postdata = array(
31 31
 		'ID' => $post->ID,
32 32
 		'Author_ID' => $post->post_author,
33 33
 		'Date' => $post->post_date,
@@ -61,12 +61,12 @@  discard block
 block discarded – undo
61 61
 function start_wp() {
62 62
 	global $wp_query;
63 63
 
64
-	_deprecated_function( __FUNCTION__, '1.5.0', __('new WordPress Loop') );
64
+	_deprecated_function(__FUNCTION__, '1.5.0', __('new WordPress Loop'));
65 65
 
66 66
 	// Since the old style loop is being used, advance the query iterator here.
67 67
 	$wp_query->next_post();
68 68
 
69
-	setup_postdata( get_post() );
69
+	setup_postdata(get_post());
70 70
 }
71 71
 
72 72
 /**
@@ -80,13 +80,13 @@  discard block
 block discarded – undo
80 80
  * @return int Category ID.
81 81
  */
82 82
 function the_category_ID($echo = true) {
83
-	_deprecated_function( __FUNCTION__, '0.71', 'get_the_category()' );
83
+	_deprecated_function(__FUNCTION__, '0.71', 'get_the_category()');
84 84
 
85 85
 	// Grab the first cat in the list.
86 86
 	$categories = get_the_category();
87 87
 	$cat = $categories[0]->term_id;
88 88
 
89
-	if ( $echo )
89
+	if ($echo)
90 90
 		echo $cat;
91 91
 
92 92
 	return $cat;
@@ -102,15 +102,15 @@  discard block
 block discarded – undo
102 102
  * @param string $before Optional. Text to display before the category. Default empty.
103 103
  * @param string $after  Optional. Text to display after the category. Default empty.
104 104
  */
105
-function the_category_head( $before = '', $after = '' ) {
105
+function the_category_head($before = '', $after = '') {
106 106
 	global $currentcat, $previouscat;
107 107
 
108
-	_deprecated_function( __FUNCTION__, '0.71', 'get_the_category_by_ID()' );
108
+	_deprecated_function(__FUNCTION__, '0.71', 'get_the_category_by_ID()');
109 109
 
110 110
 	// Grab the first cat in the list.
111 111
 	$categories = get_the_category();
112 112
 	$currentcat = $categories[0]->category_id;
113
-	if ( $currentcat != $previouscat ) {
113
+	if ($currentcat != $previouscat) {
114 114
 		echo $before;
115 115
 		echo get_the_category_by_ID($currentcat);
116 116
 		echo $after;
@@ -132,22 +132,22 @@  discard block
 block discarded – undo
132 132
  * @param int    $limitprev
133 133
  * @param string $excluded_categories
134 134
  */
135
-function previous_post($format='%', $previous='previous post: ', $title='yes', $in_same_cat='no', $limitprev=1, $excluded_categories='') {
135
+function previous_post($format = '%', $previous = 'previous post: ', $title = 'yes', $in_same_cat = 'no', $limitprev = 1, $excluded_categories = '') {
136 136
 
137
-	_deprecated_function( __FUNCTION__, '2.0.0', 'previous_post_link()' );
137
+	_deprecated_function(__FUNCTION__, '2.0.0', 'previous_post_link()');
138 138
 
139
-	if ( empty($in_same_cat) || 'no' == $in_same_cat )
139
+	if (empty($in_same_cat) || 'no' == $in_same_cat)
140 140
 		$in_same_cat = false;
141 141
 	else
142 142
 		$in_same_cat = true;
143 143
 
144 144
 	$post = get_previous_post($in_same_cat, $excluded_categories);
145 145
 
146
-	if ( !$post )
146
+	if ( ! $post)
147 147
 		return;
148 148
 
149 149
 	$string = '<a href="'.get_permalink($post->ID).'">'.$previous;
150
-	if ( 'yes' == $title )
150
+	if ('yes' == $title)
151 151
 		$string .= apply_filters('the_title', $post->post_title, $post->ID);
152 152
 	$string .= '</a>';
153 153
 	$format = str_replace('%', $string, $format);
@@ -168,21 +168,21 @@  discard block
 block discarded – undo
168 168
  * @param int $limitnext
169 169
  * @param string $excluded_categories
170 170
  */
171
-function next_post($format='%', $next='next post: ', $title='yes', $in_same_cat='no', $limitnext=1, $excluded_categories='') {
172
-	_deprecated_function( __FUNCTION__, '2.0.0', 'next_post_link()' );
171
+function next_post($format = '%', $next = 'next post: ', $title = 'yes', $in_same_cat = 'no', $limitnext = 1, $excluded_categories = '') {
172
+	_deprecated_function(__FUNCTION__, '2.0.0', 'next_post_link()');
173 173
 
174
-	if ( empty($in_same_cat) || 'no' == $in_same_cat )
174
+	if (empty($in_same_cat) || 'no' == $in_same_cat)
175 175
 		$in_same_cat = false;
176 176
 	else
177 177
 		$in_same_cat = true;
178 178
 
179 179
 	$post = get_next_post($in_same_cat, $excluded_categories);
180 180
 
181
-	if ( !$post	)
181
+	if ( ! $post)
182 182
 		return;
183 183
 
184 184
 	$string = '<a href="'.get_permalink($post->ID).'">'.$next;
185
-	if ( 'yes' == $title )
185
+	if ('yes' == $title)
186 186
 		$string .= apply_filters('the_title', $post->post_title, $post->ID);
187 187
 	$string .= '</a>';
188 188
 	$format = str_replace('%', $string, $format);
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
  * @return bool
203 203
  */
204 204
 function user_can_create_post($user_id, $blog_id = 1, $category_id = 'None') {
205
-	_deprecated_function( __FUNCTION__, '2.0.0', 'current_user_can()' );
205
+	_deprecated_function(__FUNCTION__, '2.0.0', 'current_user_can()');
206 206
 
207 207
 	$author_data = get_userdata($user_id);
208 208
 	return ($author_data->user_level > 1);
@@ -221,7 +221,7 @@  discard block
 block discarded – undo
221 221
  * @return bool
222 222
  */
223 223
 function user_can_create_draft($user_id, $blog_id = 1, $category_id = 'None') {
224
-	_deprecated_function( __FUNCTION__, '2.0.0', 'current_user_can()' );
224
+	_deprecated_function(__FUNCTION__, '2.0.0', 'current_user_can()');
225 225
 
226 226
 	$author_data = get_userdata($user_id);
227 227
 	return ($author_data->user_level >= 1);
@@ -240,15 +240,15 @@  discard block
 block discarded – undo
240 240
  * @return bool
241 241
  */
242 242
 function user_can_edit_post($user_id, $post_id, $blog_id = 1) {
243
-	_deprecated_function( __FUNCTION__, '2.0.0', 'current_user_can()' );
243
+	_deprecated_function(__FUNCTION__, '2.0.0', 'current_user_can()');
244 244
 
245 245
 	$author_data = get_userdata($user_id);
246 246
 	$post = get_post($post_id);
247 247
 	$post_author_data = get_userdata($post->post_author);
248 248
 
249
-	if ( (($user_id == $post_author_data->ID) && !($post->post_status == 'publish' && $author_data->user_level < 2))
249
+	if ((($user_id == $post_author_data->ID) && ! ($post->post_status == 'publish' && $author_data->user_level < 2))
250 250
 			 || ($author_data->user_level > $post_author_data->user_level)
251
-			 || ($author_data->user_level >= 10) ) {
251
+			 || ($author_data->user_level >= 10)) {
252 252
 		return true;
253 253
 	} else {
254 254
 		return false;
@@ -268,7 +268,7 @@  discard block
 block discarded – undo
268 268
  * @return bool
269 269
  */
270 270
 function user_can_delete_post($user_id, $post_id, $blog_id = 1) {
271
-	_deprecated_function( __FUNCTION__, '2.0.0', 'current_user_can()' );
271
+	_deprecated_function(__FUNCTION__, '2.0.0', 'current_user_can()');
272 272
 
273 273
 	// right now if one can edit, one can delete
274 274
 	return user_can_edit_post($user_id, $post_id, $blog_id);
@@ -287,7 +287,7 @@  discard block
 block discarded – undo
287 287
  * @return bool
288 288
  */
289 289
 function user_can_set_post_date($user_id, $blog_id = 1, $category_id = 'None') {
290
-	_deprecated_function( __FUNCTION__, '2.0.0', 'current_user_can()' );
290
+	_deprecated_function(__FUNCTION__, '2.0.0', 'current_user_can()');
291 291
 
292 292
 	$author_data = get_userdata($user_id);
293 293
 	return (($author_data->user_level > 4) && user_can_create_post($user_id, $blog_id, $category_id));
@@ -306,7 +306,7 @@  discard block
 block discarded – undo
306 306
  * @return bool returns true if $user_id can edit $post_id's date
307 307
  */
308 308
 function user_can_edit_post_date($user_id, $post_id, $blog_id = 1) {
309
-	_deprecated_function( __FUNCTION__, '2.0.0', 'current_user_can()' );
309
+	_deprecated_function(__FUNCTION__, '2.0.0', 'current_user_can()');
310 310
 
311 311
 	$author_data = get_userdata($user_id);
312 312
 	return (($author_data->user_level > 4) && user_can_edit_post($user_id, $post_id, $blog_id));
@@ -325,7 +325,7 @@  discard block
 block discarded – undo
325 325
  * @return bool returns true if $user_id can edit $post_id's comments
326 326
  */
327 327
 function user_can_edit_post_comments($user_id, $post_id, $blog_id = 1) {
328
-	_deprecated_function( __FUNCTION__, '2.0.0', 'current_user_can()' );
328
+	_deprecated_function(__FUNCTION__, '2.0.0', 'current_user_can()');
329 329
 
330 330
 	// right now if one can edit a post, one can edit comments made on it
331 331
 	return user_can_edit_post($user_id, $post_id, $blog_id);
@@ -344,7 +344,7 @@  discard block
 block discarded – undo
344 344
  * @return bool returns true if $user_id can delete $post_id's comments
345 345
  */
346 346
 function user_can_delete_post_comments($user_id, $post_id, $blog_id = 1) {
347
-	_deprecated_function( __FUNCTION__, '2.0.0', 'current_user_can()' );
347
+	_deprecated_function(__FUNCTION__, '2.0.0', 'current_user_can()');
348 348
 
349 349
 	// right now if one can edit comments, one can delete comments
350 350
 	return user_can_edit_post_comments($user_id, $post_id, $blog_id);
@@ -362,11 +362,11 @@  discard block
 block discarded – undo
362 362
  * @return bool
363 363
  */
364 364
 function user_can_edit_user($user_id, $other_user) {
365
-	_deprecated_function( __FUNCTION__, '2.0.0', 'current_user_can()' );
365
+	_deprecated_function(__FUNCTION__, '2.0.0', 'current_user_can()');
366 366
 
367 367
 	$user  = get_userdata($user_id);
368 368
 	$other = get_userdata($other_user);
369
-	if ( $user->user_level > $other->user_level || $user->user_level > 8 || $user->ID == $other->ID )
369
+	if ($user->user_level > $other->user_level || $user->user_level > 8 || $user->ID == $other->ID)
370 370
 		return true;
371 371
 	else
372 372
 		return false;
@@ -395,11 +395,11 @@  discard block
 block discarded – undo
395 395
 function get_linksbyname($cat_name = "noname", $before = '', $after = '<br />', $between = " ", $show_images = true, $orderby = 'id',
396 396
 						 $show_description = true, $show_rating = false,
397 397
 						 $limit = -1, $show_updated = 0) {
398
-	_deprecated_function( __FUNCTION__, '2.1.0', 'get_bookmarks()' );
398
+	_deprecated_function(__FUNCTION__, '2.1.0', 'get_bookmarks()');
399 399
 
400 400
 	$cat_id = -1;
401 401
 	$cat = get_term_by('name', $cat_name, 'link_category');
402
-	if ( $cat )
402
+	if ($cat)
403 403
 		$cat_id = $cat->term_id;
404 404
 
405 405
 	get_links($cat_id, $before, $after, $between, $show_images, $orderby, $show_description, $show_rating, $limit, $show_updated);
@@ -430,7 +430,7 @@  discard block
 block discarded – undo
430 430
 		'title_li' => '',
431 431
 	);
432 432
 
433
-	$r = wp_parse_args( $args, $defaults );
433
+	$r = wp_parse_args($args, $defaults);
434 434
 
435 435
 	return wp_list_bookmarks($r);
436 436
 }
@@ -454,12 +454,12 @@  discard block
 block discarded – undo
454 454
  * @param int $limit Limit to X entries. If not specified, all entries are shown.
455 455
  * @return array
456 456
  */
457
-function get_linkobjectsbyname($cat_name = "noname" , $orderby = 'name', $limit = -1) {
458
-	_deprecated_function( __FUNCTION__, '2.1.0', 'get_bookmarks()' );
457
+function get_linkobjectsbyname($cat_name = "noname", $orderby = 'name', $limit = -1) {
458
+	_deprecated_function(__FUNCTION__, '2.1.0', 'get_bookmarks()');
459 459
 
460 460
 	$cat_id = -1;
461 461
 	$cat = get_term_by('name', $cat_name, 'link_category');
462
-	if ( $cat )
462
+	if ($cat)
463 463
 		$cat_id = $cat->term_id;
464 464
 
465 465
 	return get_linkobjects($cat_id, $orderby, $limit);
@@ -506,9 +506,9 @@  discard block
 block discarded – undo
506 506
  * @return array
507 507
  */
508 508
 function get_linkobjects($category = 0, $orderby = 'name', $limit = 0) {
509
-	_deprecated_function( __FUNCTION__, '2.1.0', 'get_bookmarks()' );
509
+	_deprecated_function(__FUNCTION__, '2.1.0', 'get_bookmarks()');
510 510
 
511
-	$links = get_bookmarks( array( 'category' => $category, 'orderby' => $orderby, 'limit' => $limit ) ) ;
511
+	$links = get_bookmarks(array('category' => $category, 'orderby' => $orderby, 'limit' => $limit));
512 512
 
513 513
 	$links_array = array();
514 514
 	foreach ($links as $link)
@@ -539,7 +539,7 @@  discard block
 block discarded – undo
539 539
  */
540 540
 function get_linksbyname_withrating($cat_name = "noname", $before = '', $after = '<br />', $between = " ",
541 541
 									$show_images = true, $orderby = 'id', $show_description = true, $limit = -1, $show_updated = 0) {
542
-	_deprecated_function( __FUNCTION__, '2.1.0', 'get_bookmarks()' );
542
+	_deprecated_function(__FUNCTION__, '2.1.0', 'get_bookmarks()');
543 543
 
544 544
 	get_linksbyname($cat_name, $before, $after, $between, $show_images, $orderby, $show_description, true, $limit, $show_updated);
545 545
 }
@@ -566,7 +566,7 @@  discard block
 block discarded – undo
566 566
  */
567 567
 function get_links_withrating($category = -1, $before = '', $after = '<br />', $between = " ", $show_images = true,
568 568
 							  $orderby = 'id', $show_description = true, $limit = -1, $show_updated = 0) {
569
-	_deprecated_function( __FUNCTION__, '2.1.0', 'get_bookmarks()' );
569
+	_deprecated_function(__FUNCTION__, '2.1.0', 'get_bookmarks()');
570 570
 
571 571
 	get_links($category, $before, $after, $between, $show_images, $orderby, $show_description, true, $limit, $show_updated);
572 572
 }
@@ -581,7 +581,7 @@  discard block
 block discarded – undo
581 581
  * @return int Only returns 0.
582 582
  */
583 583
 function get_autotoggle($id = 0) {
584
-	_deprecated_function( __FUNCTION__, '2.1.0' );
584
+	_deprecated_function(__FUNCTION__, '2.1.0');
585 585
 	return 0;
586 586
 }
587 587
 
@@ -613,9 +613,9 @@  discard block
 block discarded – undo
613 613
  * @return false|null
614 614
  */
615 615
 function list_cats($optionall = 1, $all = 'All', $sort_column = 'ID', $sort_order = 'asc', $file = '', $list = true, $optiondates = 0,
616
-				   $optioncount = 0, $hide_empty = 1, $use_desc_for_title = 1, $children=false, $child_of=0, $categories=0,
617
-				   $recurse=0, $feed = '', $feed_image = '', $exclude = '', $hierarchical=false) {
618
-	_deprecated_function( __FUNCTION__, '2.1.0', 'wp_list_categories()' );
616
+				   $optioncount = 0, $hide_empty = 1, $use_desc_for_title = 1, $children = false, $child_of = 0, $categories = 0,
617
+				   $recurse = 0, $feed = '', $feed_image = '', $exclude = '', $hierarchical = false) {
618
+	_deprecated_function(__FUNCTION__, '2.1.0', 'wp_list_categories()');
619 619
 
620 620
 	$query = compact('optionall', 'all', 'sort_column', 'sort_order', 'file', 'list', 'optiondates', 'optioncount', 'hide_empty', 'use_desc_for_title', 'children',
621 621
 		'child_of', 'categories', 'recurse', 'feed', 'feed_image', 'exclude', 'hierarchical');
@@ -633,22 +633,22 @@  discard block
 block discarded – undo
633 633
  * @return false|null|string
634 634
  */
635 635
 function wp_list_cats($args = '') {
636
-	_deprecated_function( __FUNCTION__, '2.1.0', 'wp_list_categories()' );
636
+	_deprecated_function(__FUNCTION__, '2.1.0', 'wp_list_categories()');
637 637
 
638
-	$r = wp_parse_args( $args );
638
+	$r = wp_parse_args($args);
639 639
 
640 640
 	// Map to new names.
641
-	if ( isset($r['optionall']) && isset($r['all']))
641
+	if (isset($r['optionall']) && isset($r['all']))
642 642
 		$r['show_option_all'] = $r['all'];
643
-	if ( isset($r['sort_column']) )
643
+	if (isset($r['sort_column']))
644 644
 		$r['orderby'] = $r['sort_column'];
645
-	if ( isset($r['sort_order']) )
645
+	if (isset($r['sort_order']))
646 646
 		$r['order'] = $r['sort_order'];
647
-	if ( isset($r['optiondates']) )
647
+	if (isset($r['optiondates']))
648 648
 		$r['show_last_update'] = $r['optiondates'];
649
-	if ( isset($r['optioncount']) )
649
+	if (isset($r['optioncount']))
650 650
 		$r['show_count'] = $r['optioncount'];
651
-	if ( isset($r['list']) )
651
+	if (isset($r['list']))
652 652
 		$r['style'] = $r['list'] ? 'list' : 'break';
653 653
 	$r['title_li'] = '';
654 654
 
@@ -677,14 +677,14 @@  discard block
 block discarded – undo
677 677
 function dropdown_cats($optionall = 1, $all = 'All', $orderby = 'ID', $order = 'asc',
678 678
 		$show_last_update = 0, $show_count = 0, $hide_empty = 1, $optionnone = false,
679 679
 		$selected = 0, $exclude = 0) {
680
-	_deprecated_function( __FUNCTION__, '2.1.0', 'wp_dropdown_categories()' );
680
+	_deprecated_function(__FUNCTION__, '2.1.0', 'wp_dropdown_categories()');
681 681
 
682 682
 	$show_option_all = '';
683
-	if ( $optionall )
683
+	if ($optionall)
684 684
 		$show_option_all = $all;
685 685
 
686 686
 	$show_option_none = '';
687
-	if ( $optionnone )
687
+	if ($optionnone)
688 688
 		$show_option_none = __('None');
689 689
 
690 690
 	$vars = compact('show_option_all', 'show_option_none', 'orderby', 'order',
@@ -709,7 +709,7 @@  discard block
 block discarded – undo
709 709
  * @return null|string
710 710
  */
711 711
 function list_authors($optioncount = false, $exclude_admin = true, $show_fullname = false, $hide_empty = true, $feed = '', $feed_image = '') {
712
-	_deprecated_function( __FUNCTION__, '2.1.0', 'wp_list_authors()' );
712
+	_deprecated_function(__FUNCTION__, '2.1.0', 'wp_list_authors()');
713 713
 
714 714
 	$args = compact('optioncount', 'exclude_admin', 'show_fullname', 'hide_empty', 'feed', 'feed_image');
715 715
 	return wp_list_authors($args);
@@ -727,7 +727,7 @@  discard block
 block discarded – undo
727 727
  * @return array
728 728
  */
729 729
 function wp_get_post_cats($blogid = '1', $post_ID = 0) {
730
-	_deprecated_function( __FUNCTION__, '2.1.0', 'wp_get_post_categories()' );
730
+	_deprecated_function(__FUNCTION__, '2.1.0', 'wp_get_post_categories()');
731 731
 	return wp_get_post_categories($post_ID);
732 732
 }
733 733
 
@@ -745,7 +745,7 @@  discard block
 block discarded – undo
745 745
  * @return bool|mixed
746 746
  */
747 747
 function wp_set_post_cats($blogid = '1', $post_ID = 0, $post_categories = array()) {
748
-	_deprecated_function( __FUNCTION__, '2.1.0', 'wp_set_post_categories()' );
748
+	_deprecated_function(__FUNCTION__, '2.1.0', 'wp_set_post_categories()');
749 749
 	return wp_set_post_categories($post_ID, $post_categories);
750 750
 }
751 751
 
@@ -764,8 +764,8 @@  discard block
 block discarded – undo
764 764
  * @param bool $show_post_count
765 765
  * @return string|null
766 766
  */
767
-function get_archives($type='', $limit='', $format='html', $before = '', $after = '', $show_post_count = false) {
768
-	_deprecated_function( __FUNCTION__, '2.1.0', 'wp_get_archives()' );
767
+function get_archives($type = '', $limit = '', $format = 'html', $before = '', $after = '', $show_post_count = false) {
768
+	_deprecated_function(__FUNCTION__, '2.1.0', 'wp_get_archives()');
769 769
 	$args = compact('type', 'limit', 'format', 'before', 'after', 'show_post_count');
770 770
 	return wp_get_archives($args);
771 771
 }
@@ -783,11 +783,11 @@  discard block
 block discarded – undo
783 783
  * @return string|null
784 784
  */
785 785
 function get_author_link($echo, $author_id, $author_nicename = '') {
786
-	_deprecated_function( __FUNCTION__, '2.1.0', 'get_author_posts_url()' );
786
+	_deprecated_function(__FUNCTION__, '2.1.0', 'get_author_posts_url()');
787 787
 
788 788
 	$link = get_author_posts_url($author_id, $author_nicename);
789 789
 
790
-	if ( $echo )
790
+	if ($echo)
791 791
 		echo $link;
792 792
 	return $link;
793 793
 }
@@ -808,9 +808,9 @@  discard block
 block discarded – undo
808 808
  * @param string $more_file
809 809
  * @return string
810 810
  */
811
-function link_pages($before='<br />', $after='<br />', $next_or_number='number', $nextpagelink='next page', $previouspagelink='previous page',
812
-					$pagelink='%', $more_file='') {
813
-	_deprecated_function( __FUNCTION__, '2.1.0', 'wp_link_pages()' );
811
+function link_pages($before = '<br />', $after = '<br />', $next_or_number = 'number', $nextpagelink = 'next page', $previouspagelink = 'previous page',
812
+					$pagelink = '%', $more_file = '') {
813
+	_deprecated_function(__FUNCTION__, '2.1.0', 'wp_link_pages()');
814 814
 
815 815
 	$args = compact('before', 'after', 'next_or_number', 'nextpagelink', 'previouspagelink', 'pagelink', 'more_file');
816 816
 	return wp_link_pages($args);
@@ -827,7 +827,7 @@  discard block
 block discarded – undo
827 827
  * @return string
828 828
  */
829 829
 function get_settings($option) {
830
-	_deprecated_function( __FUNCTION__, '2.1.0', 'get_option()' );
830
+	_deprecated_function(__FUNCTION__, '2.1.0', 'get_option()');
831 831
 
832 832
 	return get_option($option);
833 833
 }
@@ -840,7 +840,7 @@  discard block
 block discarded – undo
840 840
  * @see the_permalink()
841 841
  */
842 842
 function permalink_link() {
843
-	_deprecated_function( __FUNCTION__, '1.2.0', 'the_permalink()' );
843
+	_deprecated_function(__FUNCTION__, '1.2.0', 'the_permalink()');
844 844
 	the_permalink();
845 845
 }
846 846
 
@@ -854,7 +854,7 @@  discard block
 block discarded – undo
854 854
  * @param string $deprecated
855 855
  */
856 856
 function permalink_single_rss($deprecated = '') {
857
-	_deprecated_function( __FUNCTION__, '2.3.0', 'the_permalink_rss()' );
857
+	_deprecated_function(__FUNCTION__, '2.3.0', 'the_permalink_rss()');
858 858
 	the_permalink_rss();
859 859
 }
860 860
 
@@ -869,11 +869,11 @@  discard block
 block discarded – undo
869 869
  * @return null|string
870 870
  */
871 871
 function wp_get_links($args = '') {
872
-	_deprecated_function( __FUNCTION__, '2.1.0', 'wp_list_bookmarks()' );
872
+	_deprecated_function(__FUNCTION__, '2.1.0', 'wp_list_bookmarks()');
873 873
 
874
-	if ( strpos( $args, '=' ) === false ) {
874
+	if (strpos($args, '=') === false) {
875 875
 		$cat_id = $args;
876
-		$args = add_query_arg( 'category', $cat_id, $args );
876
+		$args = add_query_arg('category', $cat_id, $args);
877 877
 	}
878 878
 
879 879
 	$defaults = array(
@@ -892,7 +892,7 @@  discard block
 block discarded – undo
892 892
 		'title_li' => '',
893 893
 	);
894 894
 
895
-	$r = wp_parse_args( $args, $defaults );
895
+	$r = wp_parse_args($args, $defaults);
896 896
 
897 897
 	return wp_list_bookmarks($r);
898 898
 }
@@ -923,81 +923,81 @@  discard block
 block discarded – undo
923 923
  */
924 924
 function get_links($category = -1, $before = '', $after = '<br />', $between = ' ', $show_images = true, $orderby = 'name',
925 925
 			$show_description = true, $show_rating = false, $limit = -1, $show_updated = 1, $echo = true) {
926
-	_deprecated_function( __FUNCTION__, '2.1.0', 'get_bookmarks()' );
926
+	_deprecated_function(__FUNCTION__, '2.1.0', 'get_bookmarks()');
927 927
 
928 928
 	$order = 'ASC';
929
-	if ( substr($orderby, 0, 1) == '_' ) {
929
+	if (substr($orderby, 0, 1) == '_') {
930 930
 		$order = 'DESC';
931 931
 		$orderby = substr($orderby, 1);
932 932
 	}
933 933
 
934
-	if ( $category == -1 ) //get_bookmarks uses '' to signify all categories
934
+	if ($category == -1) //get_bookmarks uses '' to signify all categories
935 935
 		$category = '';
936 936
 
937 937
 	$results = get_bookmarks(array('category' => $category, 'orderby' => $orderby, 'order' => $order, 'show_updated' => $show_updated, 'limit' => $limit));
938 938
 
939
-	if ( !$results )
939
+	if ( ! $results)
940 940
 		return;
941 941
 
942 942
 	$output = '';
943 943
 
944
-	foreach ( (array) $results as $row ) {
945
-		if ( !isset($row->recently_updated) )
944
+	foreach ((array) $results as $row) {
945
+		if ( ! isset($row->recently_updated))
946 946
 			$row->recently_updated = false;
947 947
 		$output .= $before;
948
-		if ( $show_updated && $row->recently_updated )
948
+		if ($show_updated && $row->recently_updated)
949 949
 			$output .= get_option('links_recently_updated_prepend');
950 950
 		$the_link = '#';
951
-		if ( !empty($row->link_url) )
951
+		if ( ! empty($row->link_url))
952 952
 			$the_link = esc_url($row->link_url);
953 953
 		$rel = $row->link_rel;
954
-		if ( '' != $rel )
955
-			$rel = ' rel="' . $rel . '"';
954
+		if ('' != $rel)
955
+			$rel = ' rel="'.$rel.'"';
956 956
 
957 957
 		$desc = esc_attr(sanitize_bookmark_field('link_description', $row->link_description, $row->link_id, 'display'));
958 958
 		$name = esc_attr(sanitize_bookmark_field('link_name', $row->link_name, $row->link_id, 'display'));
959 959
 		$title = $desc;
960 960
 
961
-		if ( $show_updated )
961
+		if ($show_updated)
962 962
 			if (substr($row->link_updated_f, 0, 2) != '00')
963
-				$title .= ' ('.__('Last updated') . ' ' . date(get_option('links_updated_date_format'), $row->link_updated_f + (get_option('gmt_offset') * HOUR_IN_SECONDS)) . ')';
963
+				$title .= ' ('.__('Last updated').' '.date(get_option('links_updated_date_format'), $row->link_updated_f + (get_option('gmt_offset') * HOUR_IN_SECONDS)).')';
964 964
 
965
-		if ( '' != $title )
966
-			$title = ' title="' . $title . '"';
965
+		if ('' != $title)
966
+			$title = ' title="'.$title.'"';
967 967
 
968
-		$alt = ' alt="' . $name . '"';
968
+		$alt = ' alt="'.$name.'"';
969 969
 
970 970
 		$target = $row->link_target;
971
-		if ( '' != $target )
972
-			$target = ' target="' . $target . '"';
971
+		if ('' != $target)
972
+			$target = ' target="'.$target.'"';
973 973
 
974
-		$output .= '<a href="' . $the_link . '"' . $rel . $title . $target. '>';
974
+		$output .= '<a href="'.$the_link.'"'.$rel.$title.$target.'>';
975 975
 
976
-		if ( $row->link_image != null && $show_images ) {
977
-			if ( strpos($row->link_image, 'http') !== false )
976
+		if ($row->link_image != null && $show_images) {
977
+			if (strpos($row->link_image, 'http') !== false)
978 978
 				$output .= "<img src=\"$row->link_image\" $alt $title />";
979 979
 			else // If it's a relative path
980
-				$output .= "<img src=\"" . get_option('siteurl') . "$row->link_image\" $alt $title />";
980
+				$output .= "<img src=\"".get_option('siteurl')."$row->link_image\" $alt $title />";
981 981
 		} else {
982 982
 			$output .= $name;
983 983
 		}
984 984
 
985 985
 		$output .= '</a>';
986 986
 
987
-		if ( $show_updated && $row->recently_updated )
987
+		if ($show_updated && $row->recently_updated)
988 988
 			$output .= get_option('links_recently_updated_append');
989 989
 
990
-		if ( $show_description && '' != $desc )
991
-			$output .= $between . $desc;
990
+		if ($show_description && '' != $desc)
991
+			$output .= $between.$desc;
992 992
 
993 993
 		if ($show_rating) {
994
-			$output .= $between . get_linkrating($row);
994
+			$output .= $between.get_linkrating($row);
995 995
 		}
996 996
 
997 997
 		$output .= "$after\n";
998 998
 	} // end while
999 999
 
1000
-	if ( !$echo )
1000
+	if ( ! $echo)
1001 1001
 		return $output;
1002 1002
 	echo $output;
1003 1003
 }
@@ -1015,29 +1015,29 @@  discard block
 block discarded – undo
1015 1015
  * @param string $order Sort link categories by 'name' or 'id'
1016 1016
  */
1017 1017
 function get_links_list($order = 'name') {
1018
-	_deprecated_function( __FUNCTION__, '2.1.0', 'wp_list_bookmarks()' );
1018
+	_deprecated_function(__FUNCTION__, '2.1.0', 'wp_list_bookmarks()');
1019 1019
 
1020 1020
 	$order = strtolower($order);
1021 1021
 
1022 1022
 	// Handle link category sorting
1023 1023
 	$direction = 'ASC';
1024
-	if ( '_' == substr($order,0,1) ) {
1024
+	if ('_' == substr($order, 0, 1)) {
1025 1025
 		$direction = 'DESC';
1026
-		$order = substr($order,1);
1026
+		$order = substr($order, 1);
1027 1027
 	}
1028 1028
 
1029
-	if ( !isset($direction) )
1029
+	if ( ! isset($direction))
1030 1030
 		$direction = '';
1031 1031
 
1032 1032
 	$cats = get_categories(array('type' => 'link', 'orderby' => $order, 'order' => $direction, 'hierarchical' => 0));
1033 1033
 
1034 1034
 	// Display each category
1035
-	if ( $cats ) {
1036
-		foreach ( (array) $cats as $cat ) {
1035
+	if ($cats) {
1036
+		foreach ((array) $cats as $cat) {
1037 1037
 			// Handle each category.
1038 1038
 
1039 1039
 			// Display the category name
1040
-			echo '  <li id="linkcat-' . $cat->term_id . '" class="linkcat"><h2>' . apply_filters('link_category', $cat->name ) . "</h2>\n\t<ul>\n";
1040
+			echo '  <li id="linkcat-'.$cat->term_id.'" class="linkcat"><h2>'.apply_filters('link_category', $cat->name)."</h2>\n\t<ul>\n";
1041 1041
 			// Call get_links() with all the appropriate params
1042 1042
 			get_links($cat->term_id, '<li>', "</li>", "\n", true, 'name', false);
1043 1043
 
@@ -1059,8 +1059,8 @@  discard block
 block discarded – undo
1059 1059
  * @param string $file the page to open in the popup window
1060 1060
  * @param bool $count the number of links in the db
1061 1061
  */
1062
-function links_popup_script($text = 'Links', $width=400, $height=400, $file='links.all.php', $count = true) {
1063
-	_deprecated_function( __FUNCTION__, '2.1.0' );
1062
+function links_popup_script($text = 'Links', $width = 400, $height = 400, $file = 'links.all.php', $count = true) {
1063
+	_deprecated_function(__FUNCTION__, '2.1.0');
1064 1064
 }
1065 1065
 
1066 1066
 /**
@@ -1073,8 +1073,8 @@  discard block
 block discarded – undo
1073 1073
  * @param object $link Link object.
1074 1074
  * @return mixed Value of the 'link_rating' field, false otherwise.
1075 1075
  */
1076
-function get_linkrating( $link ) {
1077
-	_deprecated_function( __FUNCTION__, '2.1.0', 'sanitize_bookmark_field()' );
1076
+function get_linkrating($link) {
1077
+	_deprecated_function(__FUNCTION__, '2.1.0', 'sanitize_bookmark_field()');
1078 1078
 	return sanitize_bookmark_field('link_rating', $link->link_rating, $link->link_id, 'display');
1079 1079
 }
1080 1080
 
@@ -1089,16 +1089,16 @@  discard block
 block discarded – undo
1089 1089
  * @return string
1090 1090
  */
1091 1091
 function get_linkcatname($id = 0) {
1092
-	_deprecated_function( __FUNCTION__, '2.1.0', 'get_category()' );
1092
+	_deprecated_function(__FUNCTION__, '2.1.0', 'get_category()');
1093 1093
 
1094 1094
 	$id = (int) $id;
1095 1095
 
1096
-	if ( empty($id) )
1096
+	if (empty($id))
1097 1097
 		return '';
1098 1098
 
1099 1099
 	$cats = wp_get_link_cats($id);
1100 1100
 
1101
-	if ( empty($cats) || ! is_array($cats) )
1101
+	if (empty($cats) || ! is_array($cats))
1102 1102
 		return '';
1103 1103
 
1104 1104
 	$cat_id = (int) $cats[0]; // Take the first cat.
@@ -1117,7 +1117,7 @@  discard block
 block discarded – undo
1117 1117
  * @param string $link_text
1118 1118
  */
1119 1119
 function comments_rss_link($link_text = 'Comments RSS') {
1120
-	_deprecated_function( __FUNCTION__, '2.5.0', 'post_comments_feed_link()' );
1120
+	_deprecated_function(__FUNCTION__, '2.5.0', 'post_comments_feed_link()');
1121 1121
 	post_comments_feed_link($link_text);
1122 1122
 }
1123 1123
 
@@ -1133,11 +1133,11 @@  discard block
 block discarded – undo
1133 1133
  * @return string
1134 1134
  */
1135 1135
 function get_category_rss_link($echo = false, $cat_ID = 1) {
1136
-	_deprecated_function( __FUNCTION__, '2.5.0', 'get_category_feed_link()' );
1136
+	_deprecated_function(__FUNCTION__, '2.5.0', 'get_category_feed_link()');
1137 1137
 
1138 1138
 	$link = get_category_feed_link($cat_ID, 'rss2');
1139 1139
 
1140
-	if ( $echo )
1140
+	if ($echo)
1141 1141
 		echo $link;
1142 1142
 	return $link;
1143 1143
 }
@@ -1154,10 +1154,10 @@  discard block
 block discarded – undo
1154 1154
  * @return string
1155 1155
  */
1156 1156
 function get_author_rss_link($echo = false, $author_id = 1) {
1157
-	_deprecated_function( __FUNCTION__, '2.5.0', 'get_author_feed_link()' );
1157
+	_deprecated_function(__FUNCTION__, '2.5.0', 'get_author_feed_link()');
1158 1158
 
1159 1159
 	$link = get_author_feed_link($author_id);
1160
-	if ( $echo )
1160
+	if ($echo)
1161 1161
 		echo $link;
1162 1162
 	return $link;
1163 1163
 }
@@ -1172,8 +1172,8 @@  discard block
 block discarded – undo
1172 1172
  * @return string
1173 1173
  */
1174 1174
 function comments_rss() {
1175
-	_deprecated_function( __FUNCTION__, '2.2.0', 'get_post_comments_feed_link()' );
1176
-	return esc_url( get_post_comments_feed_link() );
1175
+	_deprecated_function(__FUNCTION__, '2.2.0', 'get_post_comments_feed_link()');
1176
+	return esc_url(get_post_comments_feed_link());
1177 1177
 }
1178 1178
 
1179 1179
 /**
@@ -1189,7 +1189,7 @@  discard block
 block discarded – undo
1189 1189
  * @return int The new user's ID.
1190 1190
  */
1191 1191
 function create_user($username, $password, $email) {
1192
-	_deprecated_function( __FUNCTION__, '2.0.0', 'wp_create_user()' );
1192
+	_deprecated_function(__FUNCTION__, '2.0.0', 'wp_create_user()');
1193 1193
 	return wp_create_user($username, $password, $email);
1194 1194
 }
1195 1195
 
@@ -1199,7 +1199,7 @@  discard block
 block discarded – undo
1199 1199
  * @deprecated 2.5.0
1200 1200
  */
1201 1201
 function gzip_compression() {
1202
-	_deprecated_function( __FUNCTION__, '2.5.0' );
1202
+	_deprecated_function(__FUNCTION__, '2.5.0');
1203 1203
 	return false;
1204 1204
 }
1205 1205
 
@@ -1215,8 +1215,8 @@  discard block
 block discarded – undo
1215 1215
  * @param bool $include_unapproved Whether to include unapproved comments
1216 1216
  * @return array The comment data
1217 1217
  */
1218
-function get_commentdata( $comment_ID, $no_cache = 0, $include_unapproved = false ) {
1219
-	_deprecated_function( __FUNCTION__, '2.7.0', 'get_comment()' );
1218
+function get_commentdata($comment_ID, $no_cache = 0, $include_unapproved = false) {
1219
+	_deprecated_function(__FUNCTION__, '2.7.0', 'get_comment()');
1220 1220
 	return get_comment($comment_ID, ARRAY_A);
1221 1221
 }
1222 1222
 
@@ -1230,9 +1230,9 @@  discard block
 block discarded – undo
1230 1230
  * @param int $cat_ID Category ID
1231 1231
  * @return string category name
1232 1232
  */
1233
-function get_catname( $cat_ID ) {
1234
-	_deprecated_function( __FUNCTION__, '2.8.0', 'get_cat_name()' );
1235
-	return get_cat_name( $cat_ID );
1233
+function get_catname($cat_ID) {
1234
+	_deprecated_function(__FUNCTION__, '2.8.0', 'get_cat_name()');
1235
+	return get_cat_name($cat_ID);
1236 1236
 }
1237 1237
 
1238 1238
 /**
@@ -1248,25 +1248,25 @@  discard block
 block discarded – undo
1248 1248
  * @param array $visited Optional. Category Term IDs that have already been added.
1249 1249
  * @return string
1250 1250
  */
1251
-function get_category_children( $id, $before = '/', $after = '', $visited = array() ) {
1252
-	_deprecated_function( __FUNCTION__, '2.8.0', 'get_term_children()' );
1253
-	if ( 0 == $id )
1251
+function get_category_children($id, $before = '/', $after = '', $visited = array()) {
1252
+	_deprecated_function(__FUNCTION__, '2.8.0', 'get_term_children()');
1253
+	if (0 == $id)
1254 1254
 		return '';
1255 1255
 
1256 1256
 	$chain = '';
1257 1257
 	/** TODO: consult hierarchy */
1258 1258
 	$cat_ids = get_all_category_ids();
1259
-	foreach ( (array) $cat_ids as $cat_id ) {
1260
-		if ( $cat_id == $id )
1259
+	foreach ((array) $cat_ids as $cat_id) {
1260
+		if ($cat_id == $id)
1261 1261
 			continue;
1262 1262
 
1263
-		$category = get_category( $cat_id );
1264
-		if ( is_wp_error( $category ) )
1263
+		$category = get_category($cat_id);
1264
+		if (is_wp_error($category))
1265 1265
 			return $category;
1266
-		if ( $category->parent == $id && !in_array( $category->term_id, $visited ) ) {
1266
+		if ($category->parent == $id && ! in_array($category->term_id, $visited)) {
1267 1267
 			$visited[] = $category->term_id;
1268 1268
 			$chain .= $before.$category->term_id.$after;
1269
-			$chain .= get_category_children( $category->term_id, $before, $after );
1269
+			$chain .= get_category_children($category->term_id, $before, $after);
1270 1270
 		}
1271 1271
 	}
1272 1272
 	return $chain;
@@ -1284,11 +1284,11 @@  discard block
 block discarded – undo
1284 1284
  * @return object List of all of the category IDs.
1285 1285
  */
1286 1286
 function get_all_category_ids() {
1287
-	_deprecated_function( __FUNCTION__, '4.0.0', 'get_terms()' );
1287
+	_deprecated_function(__FUNCTION__, '4.0.0', 'get_terms()');
1288 1288
 
1289
-	if ( ! $cat_ids = wp_cache_get( 'all_category_ids', 'category' ) ) {
1290
-		$cat_ids = get_terms( 'category', array('fields' => 'ids', 'get' => 'all') );
1291
-		wp_cache_add( 'all_category_ids', $cat_ids, 'category' );
1289
+	if ( ! $cat_ids = wp_cache_get('all_category_ids', 'category')) {
1290
+		$cat_ids = get_terms('category', array('fields' => 'ids', 'get' => 'all'));
1291
+		wp_cache_add('all_category_ids', $cat_ids, 'category');
1292 1292
 	}
1293 1293
 
1294 1294
 	return $cat_ids;
@@ -1304,7 +1304,7 @@  discard block
 block discarded – undo
1304 1304
  * @return string The author's description.
1305 1305
  */
1306 1306
 function get_the_author_description() {
1307
-	_deprecated_function( __FUNCTION__, '2.8.0', 'get_the_author_meta(\'description\')' );
1307
+	_deprecated_function(__FUNCTION__, '2.8.0', 'get_the_author_meta(\'description\')');
1308 1308
 	return get_the_author_meta('description');
1309 1309
 }
1310 1310
 
@@ -1316,7 +1316,7 @@  discard block
 block discarded – undo
1316 1316
  * @see the_author_meta()
1317 1317
  */
1318 1318
 function the_author_description() {
1319
-	_deprecated_function( __FUNCTION__, '2.8.0', 'the_author_meta(\'description\')' );
1319
+	_deprecated_function(__FUNCTION__, '2.8.0', 'the_author_meta(\'description\')');
1320 1320
 	the_author_meta('description');
1321 1321
 }
1322 1322
 
@@ -1330,7 +1330,7 @@  discard block
 block discarded – undo
1330 1330
  * @return string The author's login name (username).
1331 1331
  */
1332 1332
 function get_the_author_login() {
1333
-	_deprecated_function( __FUNCTION__, '2.8.0', 'get_the_author_meta(\'login\')' );
1333
+	_deprecated_function(__FUNCTION__, '2.8.0', 'get_the_author_meta(\'login\')');
1334 1334
 	return get_the_author_meta('login');
1335 1335
 }
1336 1336
 
@@ -1342,7 +1342,7 @@  discard block
 block discarded – undo
1342 1342
  * @see the_author_meta()
1343 1343
  */
1344 1344
 function the_author_login() {
1345
-	_deprecated_function( __FUNCTION__, '2.8.0', 'the_author_meta(\'login\')' );
1345
+	_deprecated_function(__FUNCTION__, '2.8.0', 'the_author_meta(\'login\')');
1346 1346
 	the_author_meta('login');
1347 1347
 }
1348 1348
 
@@ -1356,7 +1356,7 @@  discard block
 block discarded – undo
1356 1356
  * @return string The author's first name.
1357 1357
  */
1358 1358
 function get_the_author_firstname() {
1359
-	_deprecated_function( __FUNCTION__, '2.8.0', 'get_the_author_meta(\'first_name\')' );
1359
+	_deprecated_function(__FUNCTION__, '2.8.0', 'get_the_author_meta(\'first_name\')');
1360 1360
 	return get_the_author_meta('first_name');
1361 1361
 }
1362 1362
 
@@ -1368,7 +1368,7 @@  discard block
 block discarded – undo
1368 1368
  * @see the_author_meta()
1369 1369
  */
1370 1370
 function the_author_firstname() {
1371
-	_deprecated_function( __FUNCTION__, '2.8.0', 'the_author_meta(\'first_name\')' );
1371
+	_deprecated_function(__FUNCTION__, '2.8.0', 'the_author_meta(\'first_name\')');
1372 1372
 	the_author_meta('first_name');
1373 1373
 }
1374 1374
 
@@ -1382,7 +1382,7 @@  discard block
 block discarded – undo
1382 1382
  * @return string The author's last name.
1383 1383
  */
1384 1384
 function get_the_author_lastname() {
1385
-	_deprecated_function( __FUNCTION__, '2.8.0', 'get_the_author_meta(\'last_name\')' );
1385
+	_deprecated_function(__FUNCTION__, '2.8.0', 'get_the_author_meta(\'last_name\')');
1386 1386
 	return get_the_author_meta('last_name');
1387 1387
 }
1388 1388
 
@@ -1394,7 +1394,7 @@  discard block
 block discarded – undo
1394 1394
  * @see the_author_meta()
1395 1395
  */
1396 1396
 function the_author_lastname() {
1397
-	_deprecated_function( __FUNCTION__, '2.8.0', 'the_author_meta(\'last_name\')' );
1397
+	_deprecated_function(__FUNCTION__, '2.8.0', 'the_author_meta(\'last_name\')');
1398 1398
 	the_author_meta('last_name');
1399 1399
 }
1400 1400
 
@@ -1408,7 +1408,7 @@  discard block
 block discarded – undo
1408 1408
  * @return string The author's nickname.
1409 1409
  */
1410 1410
 function get_the_author_nickname() {
1411
-	_deprecated_function( __FUNCTION__, '2.8.0', 'get_the_author_meta(\'nickname\')' );
1411
+	_deprecated_function(__FUNCTION__, '2.8.0', 'get_the_author_meta(\'nickname\')');
1412 1412
 	return get_the_author_meta('nickname');
1413 1413
 }
1414 1414
 
@@ -1420,7 +1420,7 @@  discard block
 block discarded – undo
1420 1420
  * @see the_author_meta()
1421 1421
  */
1422 1422
 function the_author_nickname() {
1423
-	_deprecated_function( __FUNCTION__, '2.8.0', 'the_author_meta(\'nickname\')' );
1423
+	_deprecated_function(__FUNCTION__, '2.8.0', 'the_author_meta(\'nickname\')');
1424 1424
 	the_author_meta('nickname');
1425 1425
 }
1426 1426
 
@@ -1434,7 +1434,7 @@  discard block
 block discarded – undo
1434 1434
  * @return string The author's username.
1435 1435
  */
1436 1436
 function get_the_author_email() {
1437
-	_deprecated_function( __FUNCTION__, '2.8.0', 'get_the_author_meta(\'email\')' );
1437
+	_deprecated_function(__FUNCTION__, '2.8.0', 'get_the_author_meta(\'email\')');
1438 1438
 	return get_the_author_meta('email');
1439 1439
 }
1440 1440
 
@@ -1446,7 +1446,7 @@  discard block
 block discarded – undo
1446 1446
  * @see the_author_meta()
1447 1447
  */
1448 1448
 function the_author_email() {
1449
-	_deprecated_function( __FUNCTION__, '2.8.0', 'the_author_meta(\'email\')' );
1449
+	_deprecated_function(__FUNCTION__, '2.8.0', 'the_author_meta(\'email\')');
1450 1450
 	the_author_meta('email');
1451 1451
 }
1452 1452
 
@@ -1460,7 +1460,7 @@  discard block
 block discarded – undo
1460 1460
  * @return string The author's ICQ number.
1461 1461
  */
1462 1462
 function get_the_author_icq() {
1463
-	_deprecated_function( __FUNCTION__, '2.8.0', 'get_the_author_meta(\'icq\')' );
1463
+	_deprecated_function(__FUNCTION__, '2.8.0', 'get_the_author_meta(\'icq\')');
1464 1464
 	return get_the_author_meta('icq');
1465 1465
 }
1466 1466
 
@@ -1472,7 +1472,7 @@  discard block
 block discarded – undo
1472 1472
  * @see the_author_meta()
1473 1473
  */
1474 1474
 function the_author_icq() {
1475
-	_deprecated_function( __FUNCTION__, '2.8.0', 'the_author_meta(\'icq\')' );
1475
+	_deprecated_function(__FUNCTION__, '2.8.0', 'the_author_meta(\'icq\')');
1476 1476
 	the_author_meta('icq');
1477 1477
 }
1478 1478
 
@@ -1486,7 +1486,7 @@  discard block
 block discarded – undo
1486 1486
  * @return string The author's Yahoo! IM name.
1487 1487
  */
1488 1488
 function get_the_author_yim() {
1489
-	_deprecated_function( __FUNCTION__, '2.8.0', 'get_the_author_meta(\'yim\')' );
1489
+	_deprecated_function(__FUNCTION__, '2.8.0', 'get_the_author_meta(\'yim\')');
1490 1490
 	return get_the_author_meta('yim');
1491 1491
 }
1492 1492
 
@@ -1498,7 +1498,7 @@  discard block
 block discarded – undo
1498 1498
  * @see the_author_meta()
1499 1499
  */
1500 1500
 function the_author_yim() {
1501
-	_deprecated_function( __FUNCTION__, '2.8.0', 'the_author_meta(\'yim\')' );
1501
+	_deprecated_function(__FUNCTION__, '2.8.0', 'the_author_meta(\'yim\')');
1502 1502
 	the_author_meta('yim');
1503 1503
 }
1504 1504
 
@@ -1512,7 +1512,7 @@  discard block
 block discarded – undo
1512 1512
  * @return string The author's MSN address.
1513 1513
  */
1514 1514
 function get_the_author_msn() {
1515
-	_deprecated_function( __FUNCTION__, '2.8.0', 'get_the_author_meta(\'msn\')' );
1515
+	_deprecated_function(__FUNCTION__, '2.8.0', 'get_the_author_meta(\'msn\')');
1516 1516
 	return get_the_author_meta('msn');
1517 1517
 }
1518 1518
 
@@ -1524,7 +1524,7 @@  discard block
 block discarded – undo
1524 1524
  * @see the_author_meta()
1525 1525
  */
1526 1526
 function the_author_msn() {
1527
-	_deprecated_function( __FUNCTION__, '2.8.0', 'the_author_meta(\'msn\')' );
1527
+	_deprecated_function(__FUNCTION__, '2.8.0', 'the_author_meta(\'msn\')');
1528 1528
 	the_author_meta('msn');
1529 1529
 }
1530 1530
 
@@ -1538,7 +1538,7 @@  discard block
 block discarded – undo
1538 1538
  * @return string The author's AIM address.
1539 1539
  */
1540 1540
 function get_the_author_aim() {
1541
-	_deprecated_function( __FUNCTION__, '2.8.0', 'get_the_author_meta(\'aim\')' );
1541
+	_deprecated_function(__FUNCTION__, '2.8.0', 'get_the_author_meta(\'aim\')');
1542 1542
 	return get_the_author_meta('aim');
1543 1543
 }
1544 1544
 
@@ -1550,7 +1550,7 @@  discard block
 block discarded – undo
1550 1550
  * @see the_author_meta()
1551 1551
  */
1552 1552
 function the_author_aim() {
1553
-	_deprecated_function( __FUNCTION__, '2.8.0', 'the_author_meta(\'aim\')' );
1553
+	_deprecated_function(__FUNCTION__, '2.8.0', 'the_author_meta(\'aim\')');
1554 1554
 	the_author_meta('aim');
1555 1555
 }
1556 1556
 
@@ -1564,8 +1564,8 @@  discard block
 block discarded – undo
1564 1564
  * @param int $auth_id The ID of the author.
1565 1565
  * @return string The author's display name.
1566 1566
  */
1567
-function get_author_name( $auth_id = false ) {
1568
-	_deprecated_function( __FUNCTION__, '2.8.0', 'get_the_author_meta(\'display_name\')' );
1567
+function get_author_name($auth_id = false) {
1568
+	_deprecated_function(__FUNCTION__, '2.8.0', 'get_the_author_meta(\'display_name\')');
1569 1569
 	return get_the_author_meta('display_name', $auth_id);
1570 1570
 }
1571 1571
 
@@ -1579,7 +1579,7 @@  discard block
 block discarded – undo
1579 1579
  * @return string The URL to the author's page.
1580 1580
  */
1581 1581
 function get_the_author_url() {
1582
-	_deprecated_function( __FUNCTION__, '2.8.0', 'get_the_author_meta(\'url\')' );
1582
+	_deprecated_function(__FUNCTION__, '2.8.0', 'get_the_author_meta(\'url\')');
1583 1583
 	return get_the_author_meta('url');
1584 1584
 }
1585 1585
 
@@ -1591,7 +1591,7 @@  discard block
 block discarded – undo
1591 1591
  * @see the_author_meta()
1592 1592
  */
1593 1593
 function the_author_url() {
1594
-	_deprecated_function( __FUNCTION__, '2.8.0', 'the_author_meta(\'url\')' );
1594
+	_deprecated_function(__FUNCTION__, '2.8.0', 'the_author_meta(\'url\')');
1595 1595
 	the_author_meta('url');
1596 1596
 }
1597 1597
 
@@ -1605,7 +1605,7 @@  discard block
 block discarded – undo
1605 1605
  * @return string|int The author's ID.
1606 1606
  */
1607 1607
 function get_the_author_ID() {
1608
-	_deprecated_function( __FUNCTION__, '2.8.0', 'get_the_author_meta(\'ID\')' );
1608
+	_deprecated_function(__FUNCTION__, '2.8.0', 'get_the_author_meta(\'ID\')');
1609 1609
 	return get_the_author_meta('ID');
1610 1610
 }
1611 1611
 
@@ -1617,7 +1617,7 @@  discard block
 block discarded – undo
1617 1617
  * @see the_author_meta()
1618 1618
  */
1619 1619
 function the_author_ID() {
1620
-	_deprecated_function( __FUNCTION__, '2.8.0', 'the_author_meta(\'ID\')' );
1620
+	_deprecated_function(__FUNCTION__, '2.8.0', 'the_author_meta(\'ID\')');
1621 1621
 	the_author_meta('ID');
1622 1622
 }
1623 1623
 
@@ -1649,23 +1649,23 @@  discard block
 block discarded – undo
1649 1649
  * @param int $cut Optional. Amount of words to keep for the content.
1650 1650
  * @param int $encode_html Optional. How to encode the content.
1651 1651
  */
1652
-function the_content_rss($more_link_text='(more...)', $stripteaser=0, $more_file='', $cut = 0, $encode_html = 0) {
1653
-	_deprecated_function( __FUNCTION__, '2.9.0', 'the_content_feed' );
1652
+function the_content_rss($more_link_text = '(more...)', $stripteaser = 0, $more_file = '', $cut = 0, $encode_html = 0) {
1653
+	_deprecated_function(__FUNCTION__, '2.9.0', 'the_content_feed');
1654 1654
 	$content = get_the_content($more_link_text, $stripteaser);
1655 1655
 	$content = apply_filters('the_content_rss', $content);
1656
-	if ( $cut && !$encode_html )
1656
+	if ($cut && ! $encode_html)
1657 1657
 		$encode_html = 2;
1658
-	if ( 1== $encode_html ) {
1658
+	if (1 == $encode_html) {
1659 1659
 		$content = esc_html($content);
1660 1660
 		$cut = 0;
1661
-	} elseif ( 0 == $encode_html ) {
1661
+	} elseif (0 == $encode_html) {
1662 1662
 		$content = make_url_footnote($content);
1663
-	} elseif ( 2 == $encode_html ) {
1663
+	} elseif (2 == $encode_html) {
1664 1664
 		$content = strip_tags($content);
1665 1665
 	}
1666
-	if ( $cut ) {
1666
+	if ($cut) {
1667 1667
 		$blah = explode(' ', $content);
1668
-		if ( count($blah) > $cut ) {
1668
+		if (count($blah) > $cut) {
1669 1669
 			$k = $cut;
1670 1670
 			$use_dotdotdot = 1;
1671 1671
 		} else {
@@ -1674,7 +1674,7 @@  discard block
 block discarded – undo
1674 1674
 		}
1675 1675
 
1676 1676
 		/** @todo Check performance, might be faster to use array slice instead. */
1677
-		for ( $i=0; $i<$k; $i++ )
1677
+		for ($i = 0; $i < $k; $i++)
1678 1678
 			$excerpt .= $blah[$i].' ';
1679 1679
 		$excerpt .= ($use_dotdotdot) ? '...' : '';
1680 1680
 		$content = $excerpt;
@@ -1695,20 +1695,20 @@  discard block
 block discarded – undo
1695 1695
  * @param string $content Content to get links
1696 1696
  * @return string HTML stripped out of content with links at the bottom.
1697 1697
  */
1698
-function make_url_footnote( $content ) {
1699
-	_deprecated_function( __FUNCTION__, '2.9.0', '' );
1700
-	preg_match_all( '/<a(.+?)href=\"(.+?)\"(.*?)>(.+?)<\/a>/', $content, $matches );
1698
+function make_url_footnote($content) {
1699
+	_deprecated_function(__FUNCTION__, '2.9.0', '');
1700
+	preg_match_all('/<a(.+?)href=\"(.+?)\"(.*?)>(.+?)<\/a>/', $content, $matches);
1701 1701
 	$links_summary = "\n";
1702
-	for ( $i = 0, $c = count( $matches[0] ); $i < $c; $i++ ) {
1702
+	for ($i = 0, $c = count($matches[0]); $i < $c; $i++) {
1703 1703
 		$link_match = $matches[0][$i];
1704
-		$link_number = '['.($i+1).']';
1704
+		$link_number = '['.($i + 1).']';
1705 1705
 		$link_url = $matches[2][$i];
1706 1706
 		$link_text = $matches[4][$i];
1707
-		$content = str_replace( $link_match, $link_text . ' ' . $link_number, $content );
1708
-		$link_url = ( ( strtolower( substr( $link_url, 0, 7 ) ) != 'http://' ) && ( strtolower( substr( $link_url, 0, 8 ) ) != 'https://' ) ) ? get_option( 'home' ) . $link_url : $link_url;
1709
-		$links_summary .= "\n" . $link_number . ' ' . $link_url;
1707
+		$content = str_replace($link_match, $link_text.' '.$link_number, $content);
1708
+		$link_url = ((strtolower(substr($link_url, 0, 7)) != 'http://') && (strtolower(substr($link_url, 0, 8)) != 'https://')) ? get_option('home').$link_url : $link_url;
1709
+		$links_summary .= "\n".$link_number.' '.$link_url;
1710 1710
 	}
1711
-	$content  = strip_tags( $content );
1711
+	$content  = strip_tags($content);
1712 1712
 	$content .= $links_summary;
1713 1713
 	return $content;
1714 1714
 }
@@ -1734,9 +1734,9 @@  discard block
 block discarded – undo
1734 1734
  * @param string $domain Optional. Domain to retrieve the translated text
1735 1735
  * @return string Translated context string without pipe
1736 1736
  */
1737
-function _c( $text, $domain = 'default' ) {
1738
-	_deprecated_function( __FUNCTION__, '2.9.0', '_x()' );
1739
-	return before_last_bar( translate( $text, $domain ) );
1737
+function _c($text, $domain = 'default') {
1738
+	_deprecated_function(__FUNCTION__, '2.9.0', '_x()');
1739
+	return before_last_bar(translate($text, $domain));
1740 1740
 }
1741 1741
 
1742 1742
 /**
@@ -1751,9 +1751,9 @@  discard block
 block discarded – undo
1751 1751
  * @param string $domain Domain to retrieve the translated text
1752 1752
  * @return string Translated text
1753 1753
  */
1754
-function translate_with_context( $text, $domain = 'default' ) {
1755
-	_deprecated_function( __FUNCTION__, '2.9.0', '_x()' );
1756
-	return before_last_bar( translate( $text, $domain ) );
1754
+function translate_with_context($text, $domain = 'default') {
1755
+	_deprecated_function(__FUNCTION__, '2.9.0', '_x()');
1756
+	return before_last_bar(translate($text, $domain));
1757 1757
 }
1758 1758
 
1759 1759
 /**
@@ -1772,9 +1772,9 @@  discard block
 block discarded – undo
1772 1772
  *                       Default 'default'.
1773 1773
  * @return string The translated singular or plural form.
1774 1774
  */
1775
-function _nc( $single, $plural, $number, $domain = 'default' ) {
1776
-	_deprecated_function( __FUNCTION__, '2.9.0', '_nx()' );
1777
-	return before_last_bar( _n( $single, $plural, $number, $domain ) );
1775
+function _nc($single, $plural, $number, $domain = 'default') {
1776
+	_deprecated_function(__FUNCTION__, '2.9.0', '_nx()');
1777
+	return before_last_bar(_n($single, $plural, $number, $domain));
1778 1778
 }
1779 1779
 
1780 1780
 /**
@@ -1785,7 +1785,7 @@  discard block
 block discarded – undo
1785 1785
  * @see _n()
1786 1786
  */
1787 1787
 function __ngettext() {
1788
-	_deprecated_function( __FUNCTION__, '2.8.0', '_n()' );
1788
+	_deprecated_function(__FUNCTION__, '2.8.0', '_n()');
1789 1789
 	$args = func_get_args();
1790 1790
 	return call_user_func_array('_n', $args);
1791 1791
 }
@@ -1798,7 +1798,7 @@  discard block
 block discarded – undo
1798 1798
  * @see _n_noop()
1799 1799
  */
1800 1800
 function __ngettext_noop() {
1801
-	_deprecated_function( __FUNCTION__, '2.8.0', '_n_noop()' );
1801
+	_deprecated_function(__FUNCTION__, '2.8.0', '_n_noop()');
1802 1802
 	$args = func_get_args();
1803 1803
 	return call_user_func_array('_n_noop', $args);
1804 1804
 
@@ -1814,7 +1814,7 @@  discard block
 block discarded – undo
1814 1814
  * @return array List of all options.
1815 1815
  */
1816 1816
 function get_alloptions() {
1817
-	_deprecated_function( __FUNCTION__, '3.0.0', 'wp_load_alloptions()' );
1817
+	_deprecated_function(__FUNCTION__, '3.0.0', 'wp_load_alloptions()');
1818 1818
 	return wp_load_alloptions();
1819 1819
 }
1820 1820
 
@@ -1832,14 +1832,14 @@  discard block
 block discarded – undo
1832 1832
  * @return string
1833 1833
  */
1834 1834
 function get_the_attachment_link($id = 0, $fullsize = false, $max_dims = false, $permalink = false) {
1835
-	_deprecated_function( __FUNCTION__, '2.5.0', 'wp_get_attachment_link()' );
1835
+	_deprecated_function(__FUNCTION__, '2.5.0', 'wp_get_attachment_link()');
1836 1836
 	$id = (int) $id;
1837 1837
 	$_post = get_post($id);
1838 1838
 
1839
-	if ( ('attachment' != $_post->post_type) || !$url = wp_get_attachment_url($_post->ID) )
1839
+	if (('attachment' != $_post->post_type) || ! $url = wp_get_attachment_url($_post->ID))
1840 1840
 		return __('Missing Attachment');
1841 1841
 
1842
-	if ( $permalink )
1842
+	if ($permalink)
1843 1843
 		$url = get_attachment_link($_post->ID);
1844 1844
 
1845 1845
 	$post_title = esc_attr($_post->post_title);
@@ -1859,31 +1859,31 @@  discard block
 block discarded – undo
1859 1859
  * @param bool $fullsize Optional, default to false. Whether to have full image.
1860 1860
  * @return array Icon URL and full path to file, respectively.
1861 1861
  */
1862
-function get_attachment_icon_src( $id = 0, $fullsize = false ) {
1863
-	_deprecated_function( __FUNCTION__, '2.5.0', 'wp_get_attachment_image_src()' );
1862
+function get_attachment_icon_src($id = 0, $fullsize = false) {
1863
+	_deprecated_function(__FUNCTION__, '2.5.0', 'wp_get_attachment_image_src()');
1864 1864
 	$id = (int) $id;
1865
-	if ( !$post = get_post($id) )
1865
+	if ( ! $post = get_post($id))
1866 1866
 		return false;
1867 1867
 
1868
-	$file = get_attached_file( $post->ID );
1868
+	$file = get_attached_file($post->ID);
1869 1869
 
1870
-	if ( !$fullsize && $src = wp_get_attachment_thumb_url( $post->ID ) ) {
1870
+	if ( ! $fullsize && $src = wp_get_attachment_thumb_url($post->ID)) {
1871 1871
 		// We have a thumbnail desired, specified and existing
1872 1872
 
1873 1873
 		$src_file = basename($src);
1874
-	} elseif ( wp_attachment_is_image( $post->ID ) ) {
1874
+	} elseif (wp_attachment_is_image($post->ID)) {
1875 1875
 		// We have an image without a thumbnail
1876 1876
 
1877
-		$src = wp_get_attachment_url( $post->ID );
1877
+		$src = wp_get_attachment_url($post->ID);
1878 1878
 		$src_file = & $file;
1879
-	} elseif ( $src = wp_mime_type_icon( $post->ID ) ) {
1879
+	} elseif ($src = wp_mime_type_icon($post->ID)) {
1880 1880
 		// No thumb, no image. We'll look for a mime-related icon instead.
1881 1881
 
1882
-		$icon_dir = apply_filters( 'icon_dir', get_template_directory() . '/images' );
1883
-		$src_file = $icon_dir . '/' . basename($src);
1882
+		$icon_dir = apply_filters('icon_dir', get_template_directory().'/images');
1883
+		$src_file = $icon_dir.'/'.basename($src);
1884 1884
 	}
1885 1885
 
1886
-	if ( !isset($src) || !$src )
1886
+	if ( ! isset($src) || ! $src)
1887 1887
 		return false;
1888 1888
 
1889 1889
 	return array($src, $src_file);
@@ -1901,27 +1901,27 @@  discard block
 block discarded – undo
1901 1901
  * @param array $max_dims Optional. Dimensions of image.
1902 1902
  * @return false|string HTML content.
1903 1903
  */
1904
-function get_attachment_icon( $id = 0, $fullsize = false, $max_dims = false ) {
1905
-	_deprecated_function( __FUNCTION__, '2.5.0', 'wp_get_attachment_image()' );
1904
+function get_attachment_icon($id = 0, $fullsize = false, $max_dims = false) {
1905
+	_deprecated_function(__FUNCTION__, '2.5.0', 'wp_get_attachment_image()');
1906 1906
 	$id = (int) $id;
1907
-	if ( !$post = get_post($id) )
1907
+	if ( ! $post = get_post($id))
1908 1908
 		return false;
1909 1909
 
1910
-	if ( !$src = get_attachment_icon_src( $post->ID, $fullsize ) )
1910
+	if ( ! $src = get_attachment_icon_src($post->ID, $fullsize))
1911 1911
 		return false;
1912 1912
 
1913 1913
 	list($src, $src_file) = $src;
1914 1914
 
1915 1915
 	// Do we need to constrain the image?
1916
-	if ( ($max_dims = apply_filters('attachment_max_dims', $max_dims)) && file_exists($src_file) ) {
1916
+	if (($max_dims = apply_filters('attachment_max_dims', $max_dims)) && file_exists($src_file)) {
1917 1917
 
1918 1918
 		$imagesize = getimagesize($src_file);
1919 1919
 
1920
-		if (($imagesize[0] > $max_dims[0]) || $imagesize[1] > $max_dims[1] ) {
1920
+		if (($imagesize[0] > $max_dims[0]) || $imagesize[1] > $max_dims[1]) {
1921 1921
 			$actual_aspect = $imagesize[0] / $imagesize[1];
1922 1922
 			$desired_aspect = $max_dims[0] / $max_dims[1];
1923 1923
 
1924
-			if ( $actual_aspect >= $desired_aspect ) {
1924
+			if ($actual_aspect >= $desired_aspect) {
1925 1925
 				$height = $actual_aspect * $max_dims[0];
1926 1926
 				$constraint = "width='{$max_dims[0]}' ";
1927 1927
 				$post->iconsize = array($max_dims[0], $height);
@@ -1942,7 +1942,7 @@  discard block
 block discarded – undo
1942 1942
 
1943 1943
 	$icon = "<img src='$src' title='$post_title' alt='$post_title' $constraint/>";
1944 1944
 
1945
-	return apply_filters( 'attachment_icon', $icon, $post->ID );
1945
+	return apply_filters('attachment_icon', $icon, $post->ID);
1946 1946
 }
1947 1947
 
1948 1948
 /**
@@ -1958,12 +1958,12 @@  discard block
 block discarded – undo
1958 1958
  * @return false|string
1959 1959
  */
1960 1960
 function get_attachment_innerHTML($id = 0, $fullsize = false, $max_dims = false) {
1961
-	_deprecated_function( __FUNCTION__, '2.5.0', 'wp_get_attachment_image()' );
1961
+	_deprecated_function(__FUNCTION__, '2.5.0', 'wp_get_attachment_image()');
1962 1962
 	$id = (int) $id;
1963
-	if ( !$post = get_post($id) )
1963
+	if ( ! $post = get_post($id))
1964 1964
 		return false;
1965 1965
 
1966
-	if ( $innerHTML = get_attachment_icon($post->ID, $fullsize, $max_dims))
1966
+	if ($innerHTML = get_attachment_icon($post->ID, $fullsize, $max_dims))
1967 1967
 		return $innerHTML;
1968 1968
 
1969 1969
 	$innerHTML = esc_attr($post->post_title);
@@ -1985,8 +1985,8 @@  discard block
 block discarded – undo
1985 1985
  *                            'attribute', 'js', 'db', or 'display'. Default 'raw'.
1986 1986
  * @return object|array Bookmark object or array, depending on the type specified by `$output`.
1987 1987
  */
1988
-function get_link( $bookmark_id, $output = OBJECT, $filter = 'raw' ) {
1989
-	_deprecated_function( __FUNCTION__, '2.1.0', 'get_bookmark()' );
1988
+function get_link($bookmark_id, $output = OBJECT, $filter = 'raw') {
1989
+	_deprecated_function(__FUNCTION__, '2.1.0', 'get_bookmark()');
1990 1990
 	return get_bookmark($bookmark_id, $output, $filter);
1991 1991
 }
1992 1992
 
@@ -2001,9 +2001,9 @@  discard block
 block discarded – undo
2001 2001
  * @param array $protocols An array of acceptable protocols.
2002 2002
  * @return string The cleaned URL.
2003 2003
  */
2004
-function sanitize_url( $url, $protocols = null ) {
2005
-	_deprecated_function( __FUNCTION__, '2.8.0', 'esc_url_raw()' );
2006
-	return esc_url_raw( $url, $protocols );
2004
+function sanitize_url($url, $protocols = null) {
2005
+	_deprecated_function(__FUNCTION__, '2.8.0', 'esc_url_raw()');
2006
+	return esc_url_raw($url, $protocols);
2007 2007
 }
2008 2008
 
2009 2009
 /**
@@ -2022,12 +2022,12 @@  discard block
 block discarded – undo
2022 2022
  * @param string $context Optional. How the URL will be used. Default is 'display'.
2023 2023
  * @return string The cleaned $url after the {@see 'clean_url'} filter is applied.
2024 2024
  */
2025
-function clean_url( $url, $protocols = null, $context = 'display' ) {
2026
-	if ( $context == 'db' )
2027
-		_deprecated_function( 'clean_url( $context = \'db\' )', '3.0.0', 'esc_url_raw()' );
2025
+function clean_url($url, $protocols = null, $context = 'display') {
2026
+	if ($context == 'db')
2027
+		_deprecated_function('clean_url( $context = \'db\' )', '3.0.0', 'esc_url_raw()');
2028 2028
 	else
2029
-		_deprecated_function( __FUNCTION__, '3.0.0', 'esc_url()' );
2030
-	return esc_url( $url, $protocols, $context );
2029
+		_deprecated_function(__FUNCTION__, '3.0.0', 'esc_url()');
2030
+	return esc_url($url, $protocols, $context);
2031 2031
 }
2032 2032
 
2033 2033
 /**
@@ -2042,9 +2042,9 @@  discard block
 block discarded – undo
2042 2042
  * @param string $text The text to be escaped.
2043 2043
  * @return string Escaped text.
2044 2044
  */
2045
-function js_escape( $text ) {
2046
-	_deprecated_function( __FUNCTION__, '2.8.0', 'esc_js()' );
2047
-	return esc_js( $text );
2045
+function js_escape($text) {
2046
+	_deprecated_function(__FUNCTION__, '2.8.0', 'esc_js()');
2047
+	return esc_js($text);
2048 2048
 }
2049 2049
 
2050 2050
 /**
@@ -2059,13 +2059,13 @@  discard block
 block discarded – undo
2059 2059
  * @param false        $double_encode Whether to double encode. Unused.
2060 2060
  * @return string Escaped `$string`.
2061 2061
  */
2062
-function wp_specialchars( $string, $quote_style = ENT_NOQUOTES, $charset = false, $double_encode = false ) {
2063
-	_deprecated_function( __FUNCTION__, '2.8.0', 'esc_html()' );
2064
-	if ( func_num_args() > 1 ) { // Maintain back-compat for people passing additional arguments.
2062
+function wp_specialchars($string, $quote_style = ENT_NOQUOTES, $charset = false, $double_encode = false) {
2063
+	_deprecated_function(__FUNCTION__, '2.8.0', 'esc_html()');
2064
+	if (func_num_args() > 1) { // Maintain back-compat for people passing additional arguments.
2065 2065
 		$args = func_get_args();
2066
-		return call_user_func_array( '_wp_specialchars', $args );
2066
+		return call_user_func_array('_wp_specialchars', $args);
2067 2067
 	} else {
2068
-		return esc_html( $string );
2068
+		return esc_html($string);
2069 2069
 	}
2070 2070
 }
2071 2071
 
@@ -2079,9 +2079,9 @@  discard block
 block discarded – undo
2079 2079
  * @param string $text
2080 2080
  * @return string
2081 2081
  */
2082
-function attribute_escape( $text ) {
2083
-	_deprecated_function( __FUNCTION__, '2.8.0', 'esc_attr()' );
2084
-	return esc_attr( $text );
2082
+function attribute_escape($text) {
2083
+	_deprecated_function(__FUNCTION__, '2.8.0', 'esc_attr()');
2084
+	return esc_attr($text);
2085 2085
 }
2086 2086
 
2087 2087
 /**
@@ -2104,10 +2104,10 @@  discard block
 block discarded – undo
2104 2104
  * @param mixed      $params ,...     Widget parameters.
2105 2105
  */
2106 2106
 function register_sidebar_widget($name, $output_callback, $classname = '') {
2107
-	_deprecated_function( __FUNCTION__, '2.8.0', 'wp_register_sidebar_widget()' );
2107
+	_deprecated_function(__FUNCTION__, '2.8.0', 'wp_register_sidebar_widget()');
2108 2108
 	// Compat
2109
-	if ( is_array($name) ) {
2110
-		if ( count($name) == 3 )
2109
+	if (is_array($name)) {
2110
+		if (count($name) == 3)
2111 2111
 			$name = sprintf($name[0], $name[2]);
2112 2112
 		else
2113 2113
 			$name = $name[0];
@@ -2115,11 +2115,11 @@  discard block
 block discarded – undo
2115 2115
 
2116 2116
 	$id = sanitize_title($name);
2117 2117
 	$options = array();
2118
-	if ( !empty($classname) && is_string($classname) )
2118
+	if ( ! empty($classname) && is_string($classname))
2119 2119
 		$options['classname'] = $classname;
2120 2120
 	$params = array_slice(func_get_args(), 2);
2121 2121
 	$args = array($id, $name, $output_callback, $options);
2122
-	if ( !empty($params) )
2122
+	if ( ! empty($params))
2123 2123
 		$args = array_merge($args, $params);
2124 2124
 
2125 2125
 	call_user_func_array('wp_register_sidebar_widget', $args);
@@ -2135,7 +2135,7 @@  discard block
 block discarded – undo
2135 2135
  * @param int|string $id Widget ID.
2136 2136
  */
2137 2137
 function unregister_sidebar_widget($id) {
2138
-	_deprecated_function( __FUNCTION__, '2.8.0', 'wp_unregister_sidebar_widget()' );
2138
+	_deprecated_function(__FUNCTION__, '2.8.0', 'wp_unregister_sidebar_widget()');
2139 2139
 	return wp_unregister_sidebar_widget($id);
2140 2140
 }
2141 2141
 
@@ -2159,10 +2159,10 @@  discard block
 block discarded – undo
2159 2159
  * @param int $height Widget height.
2160 2160
  */
2161 2161
 function register_widget_control($name, $control_callback, $width = '', $height = '') {
2162
-	_deprecated_function( __FUNCTION__, '2.8.0', 'wp_register_widget_control()' );
2162
+	_deprecated_function(__FUNCTION__, '2.8.0', 'wp_register_widget_control()');
2163 2163
 	// Compat
2164
-	if ( is_array($name) ) {
2165
-		if ( count($name) == 3 )
2164
+	if (is_array($name)) {
2165
+		if (count($name) == 3)
2166 2166
 			$name = sprintf($name[0], $name[2]);
2167 2167
 		else
2168 2168
 			$name = $name[0];
@@ -2170,13 +2170,13 @@  discard block
 block discarded – undo
2170 2170
 
2171 2171
 	$id = sanitize_title($name);
2172 2172
 	$options = array();
2173
-	if ( !empty($width) )
2173
+	if ( ! empty($width))
2174 2174
 		$options['width'] = $width;
2175
-	if ( !empty($height) )
2175
+	if ( ! empty($height))
2176 2176
 		$options['height'] = $height;
2177 2177
 	$params = array_slice(func_get_args(), 4);
2178 2178
 	$args = array($id, $name, $control_callback, $options);
2179
-	if ( !empty($params) )
2179
+	if ( ! empty($params))
2180 2180
 		$args = array_merge($args, $params);
2181 2181
 
2182 2182
 	call_user_func_array('wp_register_widget_control', $args);
@@ -2192,7 +2192,7 @@  discard block
 block discarded – undo
2192 2192
  * @param int|string $id Widget ID.
2193 2193
  */
2194 2194
 function unregister_widget_control($id) {
2195
-	_deprecated_function( __FUNCTION__, '2.8.0', 'wp_unregister_widget_control()' );
2195
+	_deprecated_function(__FUNCTION__, '2.8.0', 'wp_unregister_widget_control()');
2196 2196
 	return wp_unregister_widget_control($id);
2197 2197
 }
2198 2198
 
@@ -2208,32 +2208,32 @@  discard block
 block discarded – undo
2208 2208
  * @param mixed $meta_value Metadata value.
2209 2209
  * @return bool True deletion completed and false if user_id is not a number.
2210 2210
  */
2211
-function delete_usermeta( $user_id, $meta_key, $meta_value = '' ) {
2212
-	_deprecated_function( __FUNCTION__, '3.0.0', 'delete_user_meta()' );
2211
+function delete_usermeta($user_id, $meta_key, $meta_value = '') {
2212
+	_deprecated_function(__FUNCTION__, '3.0.0', 'delete_user_meta()');
2213 2213
 	global $wpdb;
2214
-	if ( !is_numeric( $user_id ) )
2214
+	if ( ! is_numeric($user_id))
2215 2215
 		return false;
2216 2216
 	$meta_key = preg_replace('|[^a-z0-9_]|i', '', $meta_key);
2217 2217
 
2218
-	if ( is_array($meta_value) || is_object($meta_value) )
2218
+	if (is_array($meta_value) || is_object($meta_value))
2219 2219
 		$meta_value = serialize($meta_value);
2220
-	$meta_value = trim( $meta_value );
2220
+	$meta_value = trim($meta_value);
2221 2221
 
2222
-	$cur = $wpdb->get_row( $wpdb->prepare("SELECT * FROM $wpdb->usermeta WHERE user_id = %d AND meta_key = %s", $user_id, $meta_key) );
2222
+	$cur = $wpdb->get_row($wpdb->prepare("SELECT * FROM $wpdb->usermeta WHERE user_id = %d AND meta_key = %s", $user_id, $meta_key));
2223 2223
 
2224
-	if ( $cur && $cur->umeta_id )
2225
-		do_action( 'delete_usermeta', $cur->umeta_id, $user_id, $meta_key, $meta_value );
2224
+	if ($cur && $cur->umeta_id)
2225
+		do_action('delete_usermeta', $cur->umeta_id, $user_id, $meta_key, $meta_value);
2226 2226
 
2227
-	if ( ! empty($meta_value) )
2228
-		$wpdb->query( $wpdb->prepare("DELETE FROM $wpdb->usermeta WHERE user_id = %d AND meta_key = %s AND meta_value = %s", $user_id, $meta_key, $meta_value) );
2227
+	if ( ! empty($meta_value))
2228
+		$wpdb->query($wpdb->prepare("DELETE FROM $wpdb->usermeta WHERE user_id = %d AND meta_key = %s AND meta_value = %s", $user_id, $meta_key, $meta_value));
2229 2229
 	else
2230
-		$wpdb->query( $wpdb->prepare("DELETE FROM $wpdb->usermeta WHERE user_id = %d AND meta_key = %s", $user_id, $meta_key) );
2230
+		$wpdb->query($wpdb->prepare("DELETE FROM $wpdb->usermeta WHERE user_id = %d AND meta_key = %s", $user_id, $meta_key));
2231 2231
 
2232
-	clean_user_cache( $user_id );
2233
-	wp_cache_delete( $user_id, 'user_meta' );
2232
+	clean_user_cache($user_id);
2233
+	wp_cache_delete($user_id, 'user_meta');
2234 2234
 
2235
-	if ( $cur && $cur->umeta_id )
2236
-		do_action( 'deleted_usermeta', $cur->umeta_id, $user_id, $meta_key, $meta_value );
2235
+	if ($cur && $cur->umeta_id)
2236
+		do_action('deleted_usermeta', $cur->umeta_id, $user_id, $meta_key, $meta_value);
2237 2237
 
2238 2238
 	return true;
2239 2239
 }
@@ -2254,28 +2254,28 @@  discard block
 block discarded – undo
2254 2254
  * @param string $meta_key Optional. Metadata key.
2255 2255
  * @return mixed
2256 2256
  */
2257
-function get_usermeta( $user_id, $meta_key = '' ) {
2258
-	_deprecated_function( __FUNCTION__, '3.0.0', 'get_user_meta()' );
2257
+function get_usermeta($user_id, $meta_key = '') {
2258
+	_deprecated_function(__FUNCTION__, '3.0.0', 'get_user_meta()');
2259 2259
 	global $wpdb;
2260 2260
 	$user_id = (int) $user_id;
2261 2261
 
2262
-	if ( !$user_id )
2262
+	if ( ! $user_id)
2263 2263
 		return false;
2264 2264
 
2265
-	if ( !empty($meta_key) ) {
2265
+	if ( ! empty($meta_key)) {
2266 2266
 		$meta_key = preg_replace('|[^a-z0-9_]|i', '', $meta_key);
2267 2267
 		$user = wp_cache_get($user_id, 'users');
2268 2268
 		// Check the cached user object
2269
-		if ( false !== $user && isset($user->$meta_key) )
2269
+		if (false !== $user && isset($user->$meta_key))
2270 2270
 			$metas = array($user->$meta_key);
2271 2271
 		else
2272
-			$metas = $wpdb->get_col( $wpdb->prepare("SELECT meta_value FROM $wpdb->usermeta WHERE user_id = %d AND meta_key = %s", $user_id, $meta_key) );
2272
+			$metas = $wpdb->get_col($wpdb->prepare("SELECT meta_value FROM $wpdb->usermeta WHERE user_id = %d AND meta_key = %s", $user_id, $meta_key));
2273 2273
 	} else {
2274
-		$metas = $wpdb->get_col( $wpdb->prepare("SELECT meta_value FROM $wpdb->usermeta WHERE user_id = %d", $user_id) );
2274
+		$metas = $wpdb->get_col($wpdb->prepare("SELECT meta_value FROM $wpdb->usermeta WHERE user_id = %d", $user_id));
2275 2275
 	}
2276 2276
 
2277
-	if ( empty($metas) ) {
2278
-		if ( empty($meta_key) )
2277
+	if (empty($metas)) {
2278
+		if (empty($meta_key))
2279 2279
 			return array();
2280 2280
 		else
2281 2281
 			return '';
@@ -2283,7 +2283,7 @@  discard block
 block discarded – undo
2283 2283
 
2284 2284
 	$metas = array_map('maybe_unserialize', $metas);
2285 2285
 
2286
-	if ( count($metas) == 1 )
2286
+	if (count($metas) == 1)
2287 2287
 		return $metas[0];
2288 2288
 	else
2289 2289
 		return $metas;
@@ -2307,15 +2307,15 @@  discard block
 block discarded – undo
2307 2307
  * @param mixed $meta_value Metadata value.
2308 2308
  * @return bool True on successful update, false on failure.
2309 2309
  */
2310
-function update_usermeta( $user_id, $meta_key, $meta_value ) {
2311
-	_deprecated_function( __FUNCTION__, '3.0.0', 'update_user_meta()' );
2310
+function update_usermeta($user_id, $meta_key, $meta_value) {
2311
+	_deprecated_function(__FUNCTION__, '3.0.0', 'update_user_meta()');
2312 2312
 	global $wpdb;
2313
-	if ( !is_numeric( $user_id ) )
2313
+	if ( ! is_numeric($user_id))
2314 2314
 		return false;
2315 2315
 	$meta_key = preg_replace('|[^a-z0-9_]|i', '', $meta_key);
2316 2316
 
2317 2317
 	/** @todo Might need fix because usermeta data is assumed to be already escaped */
2318
-	if ( is_string($meta_value) )
2318
+	if (is_string($meta_value))
2319 2319
 		$meta_value = stripslashes($meta_value);
2320 2320
 	$meta_value = maybe_serialize($meta_value);
2321 2321
 
@@ -2323,25 +2323,25 @@  discard block
 block discarded – undo
2323 2323
 		return delete_usermeta($user_id, $meta_key);
2324 2324
 	}
2325 2325
 
2326
-	$cur = $wpdb->get_row( $wpdb->prepare("SELECT * FROM $wpdb->usermeta WHERE user_id = %d AND meta_key = %s", $user_id, $meta_key) );
2326
+	$cur = $wpdb->get_row($wpdb->prepare("SELECT * FROM $wpdb->usermeta WHERE user_id = %d AND meta_key = %s", $user_id, $meta_key));
2327 2327
 
2328
-	if ( $cur )
2329
-		do_action( 'update_usermeta', $cur->umeta_id, $user_id, $meta_key, $meta_value );
2328
+	if ($cur)
2329
+		do_action('update_usermeta', $cur->umeta_id, $user_id, $meta_key, $meta_value);
2330 2330
 
2331
-	if ( !$cur )
2332
-		$wpdb->insert($wpdb->usermeta, compact('user_id', 'meta_key', 'meta_value') );
2333
-	elseif ( $cur->meta_value != $meta_value )
2334
-		$wpdb->update($wpdb->usermeta, compact('meta_value'), compact('user_id', 'meta_key') );
2331
+	if ( ! $cur)
2332
+		$wpdb->insert($wpdb->usermeta, compact('user_id', 'meta_key', 'meta_value'));
2333
+	elseif ($cur->meta_value != $meta_value)
2334
+		$wpdb->update($wpdb->usermeta, compact('meta_value'), compact('user_id', 'meta_key'));
2335 2335
 	else
2336 2336
 		return false;
2337 2337
 
2338
-	clean_user_cache( $user_id );
2339
-	wp_cache_delete( $user_id, 'user_meta' );
2338
+	clean_user_cache($user_id);
2339
+	wp_cache_delete($user_id, 'user_meta');
2340 2340
 
2341
-	if ( !$cur )
2342
-		do_action( 'added_usermeta', $wpdb->insert_id, $user_id, $meta_key, $meta_value );
2341
+	if ( ! $cur)
2342
+		do_action('added_usermeta', $wpdb->insert_id, $user_id, $meta_key, $meta_value);
2343 2343
 	else
2344
-		do_action( 'updated_usermeta', $cur->umeta_id, $user_id, $meta_key, $meta_value );
2344
+		do_action('updated_usermeta', $cur->umeta_id, $user_id, $meta_key, $meta_value);
2345 2345
 
2346 2346
 	return true;
2347 2347
 }
@@ -2362,14 +2362,14 @@  discard block
 block discarded – undo
2362 2362
  * @param int $id Site ID.
2363 2363
  * @return array List of users that are part of that site ID
2364 2364
  */
2365
-function get_users_of_blog( $id = '' ) {
2366
-	_deprecated_function( __FUNCTION__, '3.1.0', 'get_users()' );
2365
+function get_users_of_blog($id = '') {
2366
+	_deprecated_function(__FUNCTION__, '3.1.0', 'get_users()');
2367 2367
 
2368 2368
 	global $wpdb, $blog_id;
2369
-	if ( empty($id) )
2369
+	if (empty($id))
2370 2370
 		$id = (int) $blog_id;
2371 2371
 	$blog_prefix = $wpdb->get_blog_prefix($id);
2372
-	$users = $wpdb->get_results( "SELECT user_id, user_id AS ID, user_login, display_name, user_email, meta_value FROM $wpdb->users, $wpdb->usermeta WHERE {$wpdb->users}.ID = {$wpdb->usermeta}.user_id AND meta_key = '{$blog_prefix}capabilities' ORDER BY {$wpdb->usermeta}.user_id" );
2372
+	$users = $wpdb->get_results("SELECT user_id, user_id AS ID, user_login, display_name, user_email, meta_value FROM $wpdb->users, $wpdb->usermeta WHERE {$wpdb->users}.ID = {$wpdb->usermeta}.user_id AND meta_key = '{$blog_prefix}capabilities' ORDER BY {$wpdb->usermeta}.user_id");
2373 2373
 	return $users;
2374 2374
 }
2375 2375
 
@@ -2382,13 +2382,13 @@  discard block
 block discarded – undo
2382 2382
  *
2383 2383
  * @param bool $add Optional, default is true. Add or remove links. Defaults to true.
2384 2384
  */
2385
-function automatic_feed_links( $add = true ) {
2386
-	_deprecated_function( __FUNCTION__, '3.0.0', "add_theme_support( 'automatic-feed-links' )" );
2385
+function automatic_feed_links($add = true) {
2386
+	_deprecated_function(__FUNCTION__, '3.0.0', "add_theme_support( 'automatic-feed-links' )");
2387 2387
 
2388
-	if ( $add )
2389
-		add_theme_support( 'automatic-feed-links' );
2388
+	if ($add)
2389
+		add_theme_support('automatic-feed-links');
2390 2390
 	else
2391
-		remove_action( 'wp_head', 'feed_links_extra', 3 ); // Just do this yourself in 3.0+
2391
+		remove_action('wp_head', 'feed_links_extra', 3); // Just do this yourself in 3.0+
2392 2392
 }
2393 2393
 
2394 2394
 /**
@@ -2402,13 +2402,13 @@  discard block
 block discarded – undo
2402 2402
  * @param false|int $user Optional. User ID to retrieve the field for. Default false (current user).
2403 2403
  * @return string The author's field from the current author's DB object.
2404 2404
  */
2405
-function get_profile( $field, $user = false ) {
2406
-	_deprecated_function( __FUNCTION__, '3.0.0', 'get_the_author_meta()' );
2407
-	if ( $user ) {
2408
-		$user = get_user_by( 'login', $user );
2405
+function get_profile($field, $user = false) {
2406
+	_deprecated_function(__FUNCTION__, '3.0.0', 'get_the_author_meta()');
2407
+	if ($user) {
2408
+		$user = get_user_by('login', $user);
2409 2409
 		$user = $user->ID;
2410 2410
 	}
2411
-	return get_the_author_meta( $field, $user );
2411
+	return get_the_author_meta($field, $user);
2412 2412
 }
2413 2413
 
2414 2414
 /**
@@ -2421,9 +2421,9 @@  discard block
 block discarded – undo
2421 2421
  * @param int $userid User to count posts for.
2422 2422
  * @return int Number of posts the given user has written.
2423 2423
  */
2424
-function get_usernumposts( $userid ) {
2425
-	_deprecated_function( __FUNCTION__, '3.0.0', 'count_user_posts()' );
2426
-	return count_user_posts( $userid );
2424
+function get_usernumposts($userid) {
2425
+	_deprecated_function(__FUNCTION__, '3.0.0', 'count_user_posts()');
2426
+	return count_user_posts($userid);
2427 2427
 }
2428 2428
 
2429 2429
 /**
@@ -2437,7 +2437,7 @@  discard block
 block discarded – undo
2437 2437
  * @return string An HTML entity
2438 2438
  */
2439 2439
 function funky_javascript_callback($matches) {
2440
-	return "&#".base_convert($matches[1],16,10).";";
2440
+	return "&#".base_convert($matches[1], 16, 10).";";
2441 2441
 }
2442 2442
 
2443 2443
 /**
@@ -2455,12 +2455,12 @@  discard block
 block discarded – undo
2455 2455
  * @return string Fixed text.
2456 2456
  */
2457 2457
 function funky_javascript_fix($text) {
2458
-	_deprecated_function( __FUNCTION__, '3.0.0' );
2458
+	_deprecated_function(__FUNCTION__, '3.0.0');
2459 2459
 	// Fixes for browsers' JavaScript bugs.
2460 2460
 	global $is_macIE, $is_winIE;
2461 2461
 
2462
-	if ( $is_winIE || $is_macIE )
2463
-		$text =  preg_replace_callback("/\%u([0-9A-F]{4,4})/",
2462
+	if ($is_winIE || $is_macIE)
2463
+		$text = preg_replace_callback("/\%u([0-9A-F]{4,4})/",
2464 2464
 					"funky_javascript_callback",
2465 2465
 					$text);
2466 2466
 
@@ -2477,9 +2477,9 @@  discard block
 block discarded – undo
2477 2477
  * @param string $taxonomy Name of taxonomy object
2478 2478
  * @return bool Whether the taxonomy exists.
2479 2479
  */
2480
-function is_taxonomy( $taxonomy ) {
2481
-	_deprecated_function( __FUNCTION__, '3.0.0', 'taxonomy_exists()' );
2482
-	return taxonomy_exists( $taxonomy );
2480
+function is_taxonomy($taxonomy) {
2481
+	_deprecated_function(__FUNCTION__, '3.0.0', 'taxonomy_exists()');
2482
+	return taxonomy_exists($taxonomy);
2483 2483
 }
2484 2484
 
2485 2485
 /**
@@ -2494,9 +2494,9 @@  discard block
 block discarded – undo
2494 2494
  * @param int $parent ID of parent term under which to confine the exists search.
2495 2495
  * @return mixed Get the term id or Term Object, if exists.
2496 2496
  */
2497
-function is_term( $term, $taxonomy = '', $parent = 0 ) {
2498
-	_deprecated_function( __FUNCTION__, '3.0.0', 'term_exists()' );
2499
-	return term_exists( $term, $taxonomy, $parent );
2497
+function is_term($term, $taxonomy = '', $parent = 0) {
2498
+	_deprecated_function(__FUNCTION__, '3.0.0', 'term_exists()');
2499
+	return term_exists($term, $taxonomy, $parent);
2500 2500
 }
2501 2501
 
2502 2502
 /**
@@ -2512,11 +2512,11 @@  discard block
 block discarded – undo
2512 2512
  * @return bool
2513 2513
  */
2514 2514
 function is_plugin_page() {
2515
-	_deprecated_function( __FUNCTION__, '3.1.0'  );
2515
+	_deprecated_function(__FUNCTION__, '3.1.0');
2516 2516
 
2517 2517
 	global $plugin_page;
2518 2518
 
2519
-	if ( isset($plugin_page) )
2519
+	if (isset($plugin_page))
2520 2520
 		return true;
2521 2521
 
2522 2522
 	return false;
@@ -2535,7 +2535,7 @@  discard block
 block discarded – undo
2535 2535
  * @return bool Always return True
2536 2536
  */
2537 2537
 function update_category_cache() {
2538
-	_deprecated_function( __FUNCTION__, '3.1.0'  );
2538
+	_deprecated_function(__FUNCTION__, '3.1.0');
2539 2539
 
2540 2540
 	return true;
2541 2541
 }
@@ -2549,7 +2549,7 @@  discard block
 block discarded – undo
2549 2549
  * @return bool
2550 2550
  */
2551 2551
 function wp_timezone_supported() {
2552
-	_deprecated_function( __FUNCTION__, '3.2.0' );
2552
+	_deprecated_function(__FUNCTION__, '3.2.0');
2553 2553
 
2554 2554
 	return true;
2555 2555
 }
@@ -2569,9 +2569,9 @@  discard block
 block discarded – undo
2569 2569
  * @param bool   $extended      Optional. Unused.
2570 2570
  */
2571 2571
 function the_editor($content, $id = 'content', $prev_id = 'title', $media_buttons = true, $tab_index = 2, $extended = true) {
2572
-	_deprecated_function( __FUNCTION__, '3.3.0', 'wp_editor()' );
2572
+	_deprecated_function(__FUNCTION__, '3.3.0', 'wp_editor()');
2573 2573
 
2574
-	wp_editor( $content, $id, array( 'media_buttons' => $media_buttons ) );
2574
+	wp_editor($content, $id, array('media_buttons' => $media_buttons));
2575 2575
 }
2576 2576
 
2577 2577
 /**
@@ -2584,20 +2584,20 @@  discard block
 block discarded – undo
2584 2584
  * @return array of arrays. The array is indexed by user_id, containing $metavalues object arrays.
2585 2585
  */
2586 2586
 function get_user_metavalues($ids) {
2587
-	_deprecated_function( __FUNCTION__, '3.3.0' );
2587
+	_deprecated_function(__FUNCTION__, '3.3.0');
2588 2588
 
2589 2589
 	$objects = array();
2590 2590
 
2591 2591
 	$ids = array_map('intval', $ids);
2592
-	foreach ( $ids as $id )
2592
+	foreach ($ids as $id)
2593 2593
 		$objects[$id] = array();
2594 2594
 
2595 2595
 	$metas = update_meta_cache('user', $ids);
2596 2596
 
2597
-	foreach ( $metas as $id => $meta ) {
2598
-		foreach ( $meta as $key => $metavalues ) {
2599
-			foreach ( $metavalues as $value ) {
2600
-				$objects[$id][] = (object)array( 'user_id' => $id, 'meta_key' => $key, 'meta_value' => $value);
2597
+	foreach ($metas as $id => $meta) {
2598
+		foreach ($meta as $key => $metavalues) {
2599
+			foreach ($metavalues as $value) {
2600
+				$objects[$id][] = (object) array('user_id' => $id, 'meta_key' => $key, 'meta_value' => $value);
2601 2601
 			}
2602 2602
 		}
2603 2603
 	}
@@ -2618,23 +2618,23 @@  discard block
 block discarded – undo
2618 2618
  * @return object|array The now sanitized User Object or Array (will be the same type as $user)
2619 2619
  */
2620 2620
 function sanitize_user_object($user, $context = 'display') {
2621
-	_deprecated_function( __FUNCTION__, '3.3.0' );
2621
+	_deprecated_function(__FUNCTION__, '3.3.0');
2622 2622
 
2623
-	if ( is_object($user) ) {
2624
-		if ( !isset($user->ID) )
2623
+	if (is_object($user)) {
2624
+		if ( ! isset($user->ID))
2625 2625
 			$user->ID = 0;
2626
-		if ( ! ( $user instanceof WP_User ) ) {
2626
+		if ( ! ($user instanceof WP_User)) {
2627 2627
 			$vars = get_object_vars($user);
2628
-			foreach ( array_keys($vars) as $field ) {
2629
-				if ( is_string($user->$field) || is_numeric($user->$field) )
2628
+			foreach (array_keys($vars) as $field) {
2629
+				if (is_string($user->$field) || is_numeric($user->$field))
2630 2630
 					$user->$field = sanitize_user_field($field, $user->$field, $user->ID, $context);
2631 2631
 			}
2632 2632
 		}
2633 2633
 		$user->filter = $context;
2634 2634
 	} else {
2635
-		if ( !isset($user['ID']) )
2635
+		if ( ! isset($user['ID']))
2636 2636
 			$user['ID'] = 0;
2637
-		foreach ( array_keys($user) as $field )
2637
+		foreach (array_keys($user) as $field)
2638 2638
 			$user[$field] = sanitize_user_field($field, $user[$field], $user['ID'], $context);
2639 2639
 		$user['filter'] = $context;
2640 2640
 	}
@@ -2657,17 +2657,17 @@  discard block
 block discarded – undo
2657 2657
  * @return string
2658 2658
  */
2659 2659
 function get_boundary_post_rel_link($title = '%title', $in_same_cat = false, $excluded_categories = '', $start = true) {
2660
-	_deprecated_function( __FUNCTION__, '3.3.0' );
2660
+	_deprecated_function(__FUNCTION__, '3.3.0');
2661 2661
 
2662 2662
 	$posts = get_boundary_post($in_same_cat, $excluded_categories, $start);
2663 2663
 	// If there is no post stop.
2664
-	if ( empty($posts) )
2664
+	if (empty($posts))
2665 2665
 		return;
2666 2666
 
2667 2667
 	// Even though we limited get_posts to return only 1 item it still returns an array of objects.
2668 2668
 	$post = $posts[0];
2669 2669
 
2670
-	if ( empty($post->post_title) )
2670
+	if (empty($post->post_title))
2671 2671
 		$post->post_title = $start ? __('First Post') : __('Last Post');
2672 2672
 
2673 2673
 	$date = mysql2date(get_option('date_format'), $post->post_date);
@@ -2678,10 +2678,10 @@  discard block
 block discarded – undo
2678 2678
 
2679 2679
 	$link = $start ? "<link rel='start' title='" : "<link rel='end' title='";
2680 2680
 	$link .= esc_attr($title);
2681
-	$link .= "' href='" . get_permalink($post) . "' />\n";
2681
+	$link .= "' href='".get_permalink($post)."' />\n";
2682 2682
 
2683 2683
 	$boundary = $start ? 'start' : 'end';
2684
-	return apply_filters( "{$boundary}_post_rel_link", $link );
2684
+	return apply_filters("{$boundary}_post_rel_link", $link);
2685 2685
 }
2686 2686
 
2687 2687
 /**
@@ -2695,7 +2695,7 @@  discard block
 block discarded – undo
2695 2695
  * @param string $excluded_categories Optional. Excluded categories IDs.
2696 2696
  */
2697 2697
 function start_post_rel_link($title = '%title', $in_same_cat = false, $excluded_categories = '') {
2698
-	_deprecated_function( __FUNCTION__, '3.3.0' );
2698
+	_deprecated_function(__FUNCTION__, '3.3.0');
2699 2699
 
2700 2700
 	echo get_boundary_post_rel_link($title, $in_same_cat, $excluded_categories, true);
2701 2701
 }
@@ -2709,10 +2709,10 @@  discard block
 block discarded – undo
2709 2709
  * @return string
2710 2710
  */
2711 2711
 function get_index_rel_link() {
2712
-	_deprecated_function( __FUNCTION__, '3.3.0' );
2712
+	_deprecated_function(__FUNCTION__, '3.3.0');
2713 2713
 
2714
-	$link = "<link rel='index' title='" . esc_attr( get_bloginfo( 'name', 'display' ) ) . "' href='" . esc_url( user_trailingslashit( get_bloginfo( 'url', 'display' ) ) ) . "' />\n";
2715
-	return apply_filters( "index_rel_link", $link );
2714
+	$link = "<link rel='index' title='".esc_attr(get_bloginfo('name', 'display'))."' href='".esc_url(user_trailingslashit(get_bloginfo('url', 'display')))."' />\n";
2715
+	return apply_filters("index_rel_link", $link);
2716 2716
 }
2717 2717
 
2718 2718
 /**
@@ -2722,7 +2722,7 @@  discard block
 block discarded – undo
2722 2722
  * @deprecated 3.3.0
2723 2723
  */
2724 2724
 function index_rel_link() {
2725
-	_deprecated_function( __FUNCTION__, '3.3.0' );
2725
+	_deprecated_function(__FUNCTION__, '3.3.0');
2726 2726
 
2727 2727
 	echo get_index_rel_link();
2728 2728
 }
@@ -2736,13 +2736,13 @@  discard block
 block discarded – undo
2736 2736
  * @param string $title Optional. Link title format. Default '%title'.
2737 2737
  * @return string
2738 2738
  */
2739
-function get_parent_post_rel_link( $title = '%title' ) {
2740
-	_deprecated_function( __FUNCTION__, '3.3.0' );
2739
+function get_parent_post_rel_link($title = '%title') {
2740
+	_deprecated_function(__FUNCTION__, '3.3.0');
2741 2741
 
2742
-	if ( ! empty( $GLOBALS['post'] ) && ! empty( $GLOBALS['post']->post_parent ) )
2742
+	if ( ! empty($GLOBALS['post']) && ! empty($GLOBALS['post']->post_parent))
2743 2743
 		$post = get_post($GLOBALS['post']->post_parent);
2744 2744
 
2745
-	if ( empty($post) )
2745
+	if (empty($post))
2746 2746
 		return;
2747 2747
 
2748 2748
 	$date = mysql2date(get_option('date_format'), $post->post_date);
@@ -2752,10 +2752,10 @@  discard block
 block discarded – undo
2752 2752
 	$title = apply_filters('the_title', $title, $post->ID);
2753 2753
 
2754 2754
 	$link = "<link rel='up' title='";
2755
-	$link .= esc_attr( $title );
2756
-	$link .= "' href='" . get_permalink($post) . "' />\n";
2755
+	$link .= esc_attr($title);
2756
+	$link .= "' href='".get_permalink($post)."' />\n";
2757 2757
 
2758
-	return apply_filters( "parent_post_rel_link", $link );
2758
+	return apply_filters("parent_post_rel_link", $link);
2759 2759
 }
2760 2760
 
2761 2761
 /**
@@ -2766,8 +2766,8 @@  discard block
 block discarded – undo
2766 2766
  *
2767 2767
  * @param string $title Optional. Link title format. Default '%title'.
2768 2768
  */
2769
-function parent_post_rel_link( $title = '%title' ) {
2770
-	_deprecated_function( __FUNCTION__, '3.3.0' );
2769
+function parent_post_rel_link($title = '%title') {
2770
+	_deprecated_function(__FUNCTION__, '3.3.0');
2771 2771
 
2772 2772
 	echo get_parent_post_rel_link($title);
2773 2773
 }
@@ -2780,18 +2780,18 @@  discard block
 block discarded – undo
2780 2780
  *
2781 2781
  * @param WP_Admin_Bar $wp_admin_bar WP_Admin_Bar instance.
2782 2782
  */
2783
-function wp_admin_bar_dashboard_view_site_menu( $wp_admin_bar ) {
2784
-	_deprecated_function( __FUNCTION__, '3.3.0' );
2783
+function wp_admin_bar_dashboard_view_site_menu($wp_admin_bar) {
2784
+	_deprecated_function(__FUNCTION__, '3.3.0');
2785 2785
 
2786 2786
 	$user_id = get_current_user_id();
2787 2787
 
2788
-	if ( 0 != $user_id ) {
2789
-		if ( is_admin() )
2790
-			$wp_admin_bar->add_menu( array( 'id' => 'view-site', 'title' => __( 'Visit Site' ), 'href' => home_url() ) );
2791
-		elseif ( is_multisite() )
2792
-			$wp_admin_bar->add_menu( array( 'id' => 'dashboard', 'title' => __( 'Dashboard' ), 'href' => get_dashboard_url( $user_id ) ) );
2788
+	if (0 != $user_id) {
2789
+		if (is_admin())
2790
+			$wp_admin_bar->add_menu(array('id' => 'view-site', 'title' => __('Visit Site'), 'href' => home_url()));
2791
+		elseif (is_multisite())
2792
+			$wp_admin_bar->add_menu(array('id' => 'dashboard', 'title' => __('Dashboard'), 'href' => get_dashboard_url($user_id)));
2793 2793
 		else
2794
-			$wp_admin_bar->add_menu( array( 'id' => 'dashboard', 'title' => __( 'Dashboard' ), 'href' => admin_url() ) );
2794
+			$wp_admin_bar->add_menu(array('id' => 'dashboard', 'title' => __('Dashboard'), 'href' => admin_url()));
2795 2795
 	}
2796 2796
 }
2797 2797
 
@@ -2805,10 +2805,10 @@  discard block
 block discarded – undo
2805 2805
  * @param int $blog_id Site ID
2806 2806
  * @return bool True if the current users belong to $blog_id, false if not.
2807 2807
  */
2808
-function is_blog_user( $blog_id = 0 ) {
2809
-	_deprecated_function( __FUNCTION__, '3.3.0', 'is_user_member_of_blog()' );
2808
+function is_blog_user($blog_id = 0) {
2809
+	_deprecated_function(__FUNCTION__, '3.3.0', 'is_user_member_of_blog()');
2810 2810
 
2811
-	return is_user_member_of_blog( get_current_user_id(), $blog_id );
2811
+	return is_user_member_of_blog(get_current_user_id(), $blog_id);
2812 2812
 }
2813 2813
 
2814 2814
 /**
@@ -2824,8 +2824,8 @@  discard block
 block discarded – undo
2824 2824
  * @param string $mode     Type of access you required to the stream.
2825 2825
  * @return false Always false.
2826 2826
  */
2827
-function debug_fopen( $filename, $mode ) {
2828
-	_deprecated_function( __FUNCTION__, 'error_log()' );
2827
+function debug_fopen($filename, $mode) {
2828
+	_deprecated_function(__FUNCTION__, 'error_log()');
2829 2829
 	return false;
2830 2830
 }
2831 2831
 
@@ -2841,10 +2841,10 @@  discard block
 block discarded – undo
2841 2841
  * @param mixed  $fp     Unused.
2842 2842
  * @param string $string Message to log.
2843 2843
  */
2844
-function debug_fwrite( $fp, $string ) {
2845
-	_deprecated_function( __FUNCTION__, 'error_log()' );
2846
-	if ( ! empty( $GLOBALS['debug'] ) )
2847
-		error_log( $string );
2844
+function debug_fwrite($fp, $string) {
2845
+	_deprecated_function(__FUNCTION__, 'error_log()');
2846
+	if ( ! empty($GLOBALS['debug']))
2847
+		error_log($string);
2848 2848
 }
2849 2849
 
2850 2850
 /**
@@ -2858,8 +2858,8 @@  discard block
 block discarded – undo
2858 2858
  *
2859 2859
  * @param mixed $fp Unused.
2860 2860
  */
2861
-function debug_fclose( $fp ) {
2862
-	_deprecated_function( __FUNCTION__, 'error_log()' );
2861
+function debug_fclose($fp) {
2862
+	_deprecated_function(__FUNCTION__, 'error_log()');
2863 2863
 }
2864 2864
 
2865 2865
 /**
@@ -2876,21 +2876,21 @@  discard block
 block discarded – undo
2876 2876
  * @return array Theme list with theme data.
2877 2877
  */
2878 2878
 function get_themes() {
2879
-	_deprecated_function( __FUNCTION__, '3.4.0', 'wp_get_themes()' );
2879
+	_deprecated_function(__FUNCTION__, '3.4.0', 'wp_get_themes()');
2880 2880
 
2881 2881
 	global $wp_themes;
2882
-	if ( isset( $wp_themes ) )
2882
+	if (isset($wp_themes))
2883 2883
 		return $wp_themes;
2884 2884
 
2885 2885
 	$themes = wp_get_themes();
2886 2886
 	$wp_themes = array();
2887 2887
 
2888
-	foreach ( $themes as $theme ) {
2888
+	foreach ($themes as $theme) {
2889 2889
 		$name = $theme->get('Name');
2890
-		if ( isset( $wp_themes[ $name ] ) )
2891
-			$wp_themes[ $name . '/' . $theme->get_stylesheet() ] = $theme;
2890
+		if (isset($wp_themes[$name]))
2891
+			$wp_themes[$name.'/'.$theme->get_stylesheet()] = $theme;
2892 2892
 		else
2893
-			$wp_themes[ $name ] = $theme;
2893
+			$wp_themes[$name] = $theme;
2894 2894
 	}
2895 2895
 
2896 2896
 	return $wp_themes;
@@ -2906,12 +2906,12 @@  discard block
 block discarded – undo
2906 2906
  * @param string $theme Theme name.
2907 2907
  * @return array|null Null, if theme name does not exist. Theme data, if exists.
2908 2908
  */
2909
-function get_theme( $theme ) {
2910
-	_deprecated_function( __FUNCTION__, '3.4.0', 'wp_get_theme( $stylesheet )' );
2909
+function get_theme($theme) {
2910
+	_deprecated_function(__FUNCTION__, '3.4.0', 'wp_get_theme( $stylesheet )');
2911 2911
 
2912 2912
 	$themes = get_themes();
2913
-	if ( is_array( $themes ) && array_key_exists( $theme, $themes ) )
2914
-		return $themes[ $theme ];
2913
+	if (is_array($themes) && array_key_exists($theme, $themes))
2914
+		return $themes[$theme];
2915 2915
 	return null;
2916 2916
 }
2917 2917
 
@@ -2925,9 +2925,9 @@  discard block
 block discarded – undo
2925 2925
  * @return string
2926 2926
  */
2927 2927
 function get_current_theme() {
2928
-	_deprecated_function( __FUNCTION__, '3.4.0', 'wp_get_theme()' );
2928
+	_deprecated_function(__FUNCTION__, '3.4.0', 'wp_get_theme()');
2929 2929
 
2930
-	if ( $theme = get_option( 'current_theme' ) )
2930
+	if ($theme = get_option('current_theme'))
2931 2931
 		return $theme;
2932 2932
 
2933 2933
 	return wp_get_theme()->get('Name');
@@ -2946,10 +2946,10 @@  discard block
 block discarded – undo
2946 2946
  * @return string The pre block without paragraph/line-break conversion.
2947 2947
  */
2948 2948
 function clean_pre($matches) {
2949
-	_deprecated_function( __FUNCTION__, '3.4.0' );
2949
+	_deprecated_function(__FUNCTION__, '3.4.0');
2950 2950
 
2951
-	if ( is_array($matches) )
2952
-		$text = $matches[1] . $matches[2] . "</pre>";
2951
+	if (is_array($matches))
2952
+		$text = $matches[1].$matches[2]."</pre>";
2953 2953
 	else
2954 2954
 		$text = $matches;
2955 2955
 
@@ -2972,15 +2972,15 @@  discard block
 block discarded – undo
2972 2972
  * @param callable $admin_head_callback Call on custom header administration screen.
2973 2973
  * @param callable $admin_preview_callback Output a custom header image div on the custom header administration screen. Optional.
2974 2974
  */
2975
-function add_custom_image_header( $wp_head_callback, $admin_head_callback, $admin_preview_callback = '' ) {
2976
-	_deprecated_function( __FUNCTION__, '3.4.0', 'add_theme_support( \'custom-header\', $args )' );
2975
+function add_custom_image_header($wp_head_callback, $admin_head_callback, $admin_preview_callback = '') {
2976
+	_deprecated_function(__FUNCTION__, '3.4.0', 'add_theme_support( \'custom-header\', $args )');
2977 2977
 	$args = array(
2978 2978
 		'wp-head-callback'    => $wp_head_callback,
2979 2979
 		'admin-head-callback' => $admin_head_callback,
2980 2980
 	);
2981
-	if ( $admin_preview_callback )
2981
+	if ($admin_preview_callback)
2982 2982
 		$args['admin-preview-callback'] = $admin_preview_callback;
2983
-	return add_theme_support( 'custom-header', $args );
2983
+	return add_theme_support('custom-header', $args);
2984 2984
 }
2985 2985
 
2986 2986
 /**
@@ -2993,8 +2993,8 @@  discard block
 block discarded – undo
2993 2993
  * @return null|bool Whether support was removed.
2994 2994
  */
2995 2995
 function remove_custom_image_header() {
2996
-	_deprecated_function( __FUNCTION__, '3.4.0', 'remove_theme_support( \'custom-header\' )' );
2997
-	return remove_theme_support( 'custom-header' );
2996
+	_deprecated_function(__FUNCTION__, '3.4.0', 'remove_theme_support( \'custom-header\' )');
2997
+	return remove_theme_support('custom-header');
2998 2998
 }
2999 2999
 
3000 3000
 /**
@@ -3008,16 +3008,16 @@  discard block
 block discarded – undo
3008 3008
  * @param callable $admin_head_callback Call on custom background administration screen.
3009 3009
  * @param callable $admin_preview_callback Output a custom background image div on the custom background administration screen. Optional.
3010 3010
  */
3011
-function add_custom_background( $wp_head_callback = '', $admin_head_callback = '', $admin_preview_callback = '' ) {
3012
-	_deprecated_function( __FUNCTION__, '3.4.0', 'add_theme_support( \'custom-background\', $args )' );
3011
+function add_custom_background($wp_head_callback = '', $admin_head_callback = '', $admin_preview_callback = '') {
3012
+	_deprecated_function(__FUNCTION__, '3.4.0', 'add_theme_support( \'custom-background\', $args )');
3013 3013
 	$args = array();
3014
-	if ( $wp_head_callback )
3014
+	if ($wp_head_callback)
3015 3015
 		$args['wp-head-callback'] = $wp_head_callback;
3016
-	if ( $admin_head_callback )
3016
+	if ($admin_head_callback)
3017 3017
 		$args['admin-head-callback'] = $admin_head_callback;
3018
-	if ( $admin_preview_callback )
3018
+	if ($admin_preview_callback)
3019 3019
 		$args['admin-preview-callback'] = $admin_preview_callback;
3020
-	return add_theme_support( 'custom-background', $args );
3020
+	return add_theme_support('custom-background', $args);
3021 3021
 }
3022 3022
 
3023 3023
 /**
@@ -3030,8 +3030,8 @@  discard block
 block discarded – undo
3030 3030
  * @return null|bool Whether support was removed.
3031 3031
  */
3032 3032
 function remove_custom_background() {
3033
-	_deprecated_function( __FUNCTION__, '3.4.0', 'remove_theme_support( \'custom-background\' )' );
3034
-	return remove_theme_support( 'custom-background' );
3033
+	_deprecated_function(__FUNCTION__, '3.4.0', 'remove_theme_support( \'custom-background\' )');
3034
+	return remove_theme_support('custom-background');
3035 3035
 }
3036 3036
 
3037 3037
 /**
@@ -3044,9 +3044,9 @@  discard block
 block discarded – undo
3044 3044
  * @param string $theme_file Theme file path.
3045 3045
  * @return array Theme data.
3046 3046
  */
3047
-function get_theme_data( $theme_file ) {
3048
-	_deprecated_function( __FUNCTION__, '3.4.0', 'wp_get_theme()' );
3049
-	$theme = new WP_Theme( basename( dirname( $theme_file ) ), dirname( dirname( $theme_file ) ) );
3047
+function get_theme_data($theme_file) {
3048
+	_deprecated_function(__FUNCTION__, '3.4.0', 'wp_get_theme()');
3049
+	$theme = new WP_Theme(basename(dirname($theme_file)), dirname(dirname($theme_file)));
3050 3050
 
3051 3051
 	$theme_data = array(
3052 3052
 		'Name' => $theme->get('Name'),
@@ -3062,9 +3062,9 @@  discard block
 block discarded – undo
3062 3062
 		'AuthorName' => $theme->get('Author'),
3063 3063
 	);
3064 3064
 
3065
-	foreach ( apply_filters( 'extra_theme_headers', array() ) as $extra_header ) {
3066
-		if ( ! isset( $theme_data[ $extra_header ] ) )
3067
-			$theme_data[ $extra_header ] = $theme->get( $extra_header );
3065
+	foreach (apply_filters('extra_theme_headers', array()) as $extra_header) {
3066
+		if ( ! isset($theme_data[$extra_header]))
3067
+			$theme_data[$extra_header] = $theme->get($extra_header);
3068 3068
 	}
3069 3069
 
3070 3070
 	return $theme_data;
@@ -3081,10 +3081,10 @@  discard block
 block discarded – undo
3081 3081
  *
3082 3082
  * @param array $pages list of page objects
3083 3083
  */
3084
-function update_page_cache( &$pages ) {
3085
-	_deprecated_function( __FUNCTION__, '3.4.0', 'update_post_cache()' );
3084
+function update_page_cache(&$pages) {
3085
+	_deprecated_function(__FUNCTION__, '3.4.0', 'update_post_cache()');
3086 3086
 
3087
-	update_post_cache( $pages );
3087
+	update_post_cache($pages);
3088 3088
 }
3089 3089
 
3090 3090
 /**
@@ -3099,10 +3099,10 @@  discard block
 block discarded – undo
3099 3099
  *
3100 3100
  * @param int $id Page ID to clean
3101 3101
  */
3102
-function clean_page_cache( $id ) {
3103
-	_deprecated_function( __FUNCTION__, '3.4.0', 'clean_post_cache()' );
3102
+function clean_page_cache($id) {
3103
+	_deprecated_function(__FUNCTION__, '3.4.0', 'clean_post_cache()');
3104 3104
 
3105
-	clean_post_cache( $id );
3105
+	clean_post_cache($id);
3106 3106
 }
3107 3107
 
3108 3108
 /**
@@ -3117,9 +3117,9 @@  discard block
 block discarded – undo
3117 3117
  * @param string $action Nonce action.
3118 3118
  * @return string Are you sure message.
3119 3119
  */
3120
-function wp_explain_nonce( $action ) {
3121
-	_deprecated_function( __FUNCTION__, '3.4.1', 'wp_nonce_ays()' );
3122
-	return __( 'Are you sure you want to do this?' );
3120
+function wp_explain_nonce($action) {
3121
+	_deprecated_function(__FUNCTION__, '3.4.1', 'wp_nonce_ays()');
3122
+	return __('Are you sure you want to do this?');
3123 3123
 }
3124 3124
 
3125 3125
 /**
@@ -3131,9 +3131,9 @@  discard block
 block discarded – undo
3131 3131
  *
3132 3132
  * @param int $post_id An optional post ID.
3133 3133
  */
3134
-function sticky_class( $post_id = null ) {
3135
-	_deprecated_function( __FUNCTION__, '3.5.0', 'post_class()' );
3136
-	if ( is_sticky( $post_id ) )
3134
+function sticky_class($post_id = null) {
3135
+	_deprecated_function(__FUNCTION__, '3.5.0', 'post_class()');
3136
+	if (is_sticky($post_id))
3137 3137
 		echo ' sticky';
3138 3138
 }
3139 3139
 
@@ -3149,8 +3149,8 @@  discard block
 block discarded – undo
3149 3149
  *
3150 3150
  * @param WP_Post &$post Post object, passed by reference (unused).
3151 3151
  */
3152
-function _get_post_ancestors( &$post ) {
3153
-	_deprecated_function( __FUNCTION__, '3.5.0' );
3152
+function _get_post_ancestors(&$post) {
3153
+	_deprecated_function(__FUNCTION__, '3.5.0');
3154 3154
 }
3155 3155
 
3156 3156
 /**
@@ -3163,24 +3163,24 @@  discard block
 block discarded – undo
3163 3163
  * @param string $file Filename of the image to load.
3164 3164
  * @return resource The resulting image resource on success, Error string on failure.
3165 3165
  */
3166
-function wp_load_image( $file ) {
3167
-	_deprecated_function( __FUNCTION__, '3.5.0', 'wp_get_image_editor()' );
3166
+function wp_load_image($file) {
3167
+	_deprecated_function(__FUNCTION__, '3.5.0', 'wp_get_image_editor()');
3168 3168
 
3169
-	if ( is_numeric( $file ) )
3170
-		$file = get_attached_file( $file );
3169
+	if (is_numeric($file))
3170
+		$file = get_attached_file($file);
3171 3171
 
3172
-	if ( ! is_file( $file ) )
3172
+	if ( ! is_file($file))
3173 3173
 		return sprintf(__('File &#8220;%s&#8221; doesn&#8217;t exist?'), $file);
3174 3174
 
3175
-	if ( ! function_exists('imagecreatefromstring') )
3175
+	if ( ! function_exists('imagecreatefromstring'))
3176 3176
 		return __('The GD image library is not installed.');
3177 3177
 
3178 3178
 	// Set artificially high because GD uses uncompressed images in memory.
3179
-	wp_raise_memory_limit( 'image' );
3179
+	wp_raise_memory_limit('image');
3180 3180
 
3181
-	$image = imagecreatefromstring( file_get_contents( $file ) );
3181
+	$image = imagecreatefromstring(file_get_contents($file));
3182 3182
 
3183
-	if ( !is_resource( $image ) )
3183
+	if ( ! is_resource($image))
3184 3184
 		return sprintf(__('File &#8220;%s&#8221; is not an image.'), $file);
3185 3185
 
3186 3186
 	return $image;
@@ -3210,22 +3210,22 @@  discard block
 block discarded – undo
3210 3210
  * @param int $jpeg_quality Optional, default is 90. Image quality percentage.
3211 3211
  * @return mixed WP_Error on failure. String with new destination path.
3212 3212
  */
3213
-function image_resize( $file, $max_w, $max_h, $crop = false, $suffix = null, $dest_path = null, $jpeg_quality = 90 ) {
3214
-	_deprecated_function( __FUNCTION__, '3.5.0', 'wp_get_image_editor()' );
3213
+function image_resize($file, $max_w, $max_h, $crop = false, $suffix = null, $dest_path = null, $jpeg_quality = 90) {
3214
+	_deprecated_function(__FUNCTION__, '3.5.0', 'wp_get_image_editor()');
3215 3215
 
3216
-	$editor = wp_get_image_editor( $file );
3217
-	if ( is_wp_error( $editor ) )
3216
+	$editor = wp_get_image_editor($file);
3217
+	if (is_wp_error($editor))
3218 3218
 		return $editor;
3219
-	$editor->set_quality( $jpeg_quality );
3219
+	$editor->set_quality($jpeg_quality);
3220 3220
 
3221
-	$resized = $editor->resize( $max_w, $max_h, $crop );
3222
-	if ( is_wp_error( $resized ) )
3221
+	$resized = $editor->resize($max_w, $max_h, $crop);
3222
+	if (is_wp_error($resized))
3223 3223
 		return $resized;
3224 3224
 
3225
-	$dest_file = $editor->generate_filename( $suffix, $dest_path );
3226
-	$saved = $editor->save( $dest_file );
3225
+	$dest_file = $editor->generate_filename($suffix, $dest_path);
3226
+	$saved = $editor->save($dest_file);
3227 3227
 
3228
-	if ( is_wp_error( $saved ) )
3228
+	if (is_wp_error($saved))
3229 3229
 		return $saved;
3230 3230
 
3231 3231
 	return $dest_file;
@@ -3245,9 +3245,9 @@  discard block
 block discarded – undo
3245 3245
  * @param string $mode How to return result, either OBJECT, ARRAY_N, or ARRAY_A.
3246 3246
  * @return WP_Post|null Post object or array holding post contents and information
3247 3247
  */
3248
-function wp_get_single_post( $postid = 0, $mode = OBJECT ) {
3249
-	_deprecated_function( __FUNCTION__, '3.5.0', 'get_post()' );
3250
-	return get_post( $postid, $mode );
3248
+function wp_get_single_post($postid = 0, $mode = OBJECT) {
3249
+	_deprecated_function(__FUNCTION__, '3.5.0', 'get_post()');
3250
+	return get_post($postid, $mode);
3251 3251
 }
3252 3252
 
3253 3253
 /**
@@ -3262,9 +3262,9 @@  discard block
 block discarded – undo
3262 3262
  * @return bool False if does not authenticate, true if username and password authenticates.
3263 3263
  */
3264 3264
 function user_pass_ok($user_login, $user_pass) {
3265
-	_deprecated_function( __FUNCTION__, '3.5.0', 'wp_authenticate()' );
3266
-	$user = wp_authenticate( $user_login, $user_pass );
3267
-	if ( is_wp_error( $user ) )
3265
+	_deprecated_function(__FUNCTION__, '3.5.0', 'wp_authenticate()');
3266
+	$user = wp_authenticate($user_login, $user_pass);
3267
+	if (is_wp_error($user))
3268 3268
 		return false;
3269 3269
 
3270 3270
 	return true;
@@ -3289,10 +3289,10 @@  discard block
 block discarded – undo
3289 3289
  * @return bool
3290 3290
  */
3291 3291
 function gd_edit_image_support($mime_type) {
3292
-	_deprecated_function( __FUNCTION__, '3.5.0', 'wp_image_editor_supports()' );
3292
+	_deprecated_function(__FUNCTION__, '3.5.0', 'wp_image_editor_supports()');
3293 3293
 
3294
-	if ( function_exists('imagetypes') ) {
3295
-		switch( $mime_type ) {
3294
+	if (function_exists('imagetypes')) {
3295
+		switch ($mime_type) {
3296 3296
 			case 'image/jpeg':
3297 3297
 				return (imagetypes() & IMG_JPG) != 0;
3298 3298
 			case 'image/png':
@@ -3301,7 +3301,7 @@  discard block
 block discarded – undo
3301 3301
 				return (imagetypes() & IMG_GIF) != 0;
3302 3302
 		}
3303 3303
 	} else {
3304
-		switch( $mime_type ) {
3304
+		switch ($mime_type) {
3305 3305
 			case 'image/jpeg':
3306 3306
 				return function_exists('imagecreatefromjpeg');
3307 3307
 			case 'image/png':
@@ -3323,22 +3323,22 @@  discard block
 block discarded – undo
3323 3323
  * @param int $bytes An integer byte value.
3324 3324
  * @return string A shorthand byte value.
3325 3325
  */
3326
-function wp_convert_bytes_to_hr( $bytes ) {
3327
-	_deprecated_function( __FUNCTION__, '3.6.0', 'size_format()' );
3326
+function wp_convert_bytes_to_hr($bytes) {
3327
+	_deprecated_function(__FUNCTION__, '3.6.0', 'size_format()');
3328 3328
 
3329
-	$units = array( 0 => 'B', 1 => 'KB', 2 => 'MB', 3 => 'GB', 4 => 'TB' );
3330
-	$log   = log( $bytes, KB_IN_BYTES );
3329
+	$units = array(0 => 'B', 1 => 'KB', 2 => 'MB', 3 => 'GB', 4 => 'TB');
3330
+	$log   = log($bytes, KB_IN_BYTES);
3331 3331
 	$power = (int) $log;
3332
-	$size  = pow( KB_IN_BYTES, $log - $power );
3332
+	$size  = pow(KB_IN_BYTES, $log - $power);
3333 3333
 
3334
-	if ( ! is_nan( $size ) && array_key_exists( $power, $units ) ) {
3335
-		$unit = $units[ $power ];
3334
+	if ( ! is_nan($size) && array_key_exists($power, $units)) {
3335
+		$unit = $units[$power];
3336 3336
 	} else {
3337 3337
 		$size = $bytes;
3338 3338
 		$unit = $units[0];
3339 3339
 	}
3340 3340
 
3341
-	return $size . $unit;
3341
+	return $size.$unit;
3342 3342
 }
3343 3343
 
3344 3344
 /**
@@ -3351,9 +3351,9 @@  discard block
 block discarded – undo
3351 3351
  * @param string $t Search terms to "tidy", e.g. trim.
3352 3352
  * @return string Trimmed search terms.
3353 3353
  */
3354
-function _search_terms_tidy( $t ) {
3355
-	_deprecated_function( __FUNCTION__, '3.7.0' );
3356
-	return trim( $t, "\"'\n\r " );
3354
+function _search_terms_tidy($t) {
3355
+	_deprecated_function(__FUNCTION__, '3.7.0');
3356
+	return trim($t, "\"'\n\r ");
3357 3357
 }
3358 3358
 
3359 3359
 /**
@@ -3369,10 +3369,10 @@  discard block
 block discarded – undo
3369 3369
  */
3370 3370
 function rich_edit_exists() {
3371 3371
 	global $wp_rich_edit_exists;
3372
-	_deprecated_function( __FUNCTION__, '3.9.0' );
3372
+	_deprecated_function(__FUNCTION__, '3.9.0');
3373 3373
 
3374
-	if ( ! isset( $wp_rich_edit_exists ) )
3375
-		$wp_rich_edit_exists = file_exists( ABSPATH . WPINC . '/js/tinymce/tinymce.js' );
3374
+	if ( ! isset($wp_rich_edit_exists))
3375
+		$wp_rich_edit_exists = file_exists(ABSPATH.WPINC.'/js/tinymce/tinymce.js');
3376 3376
 
3377 3377
 	return $wp_rich_edit_exists;
3378 3378
 }
@@ -3387,7 +3387,7 @@  discard block
 block discarded – undo
3387 3387
  * @param int $count Number of topics.
3388 3388
  * @return int Number of topics.
3389 3389
  */
3390
-function default_topic_count_text( $count ) {
3390
+function default_topic_count_text($count) {
3391 3391
 	return $count;
3392 3392
 }
3393 3393
 
@@ -3402,8 +3402,8 @@  discard block
 block discarded – undo
3402 3402
  * @param string $content The text to format.
3403 3403
  * @return string The very same text.
3404 3404
  */
3405
-function format_to_post( $content ) {
3406
-	_deprecated_function( __FUNCTION__, '3.9.0' );
3405
+function format_to_post($content) {
3406
+	_deprecated_function(__FUNCTION__, '3.9.0');
3407 3407
 	return $content;
3408 3408
 }
3409 3409
 
@@ -3418,8 +3418,8 @@  discard block
 block discarded – undo
3418 3418
  * @return string text, safe for inclusion in LIKE query.
3419 3419
  */
3420 3420
 function like_escape($text) {
3421
-	_deprecated_function( __FUNCTION__, '4.0.0', 'wpdb::esc_like()' );
3422
-	return str_replace( array( "%", "_" ), array( "\\%", "\\_" ), $text );
3421
+	_deprecated_function(__FUNCTION__, '4.0.0', 'wpdb::esc_like()');
3422
+	return str_replace(array("%", "_"), array("\\%", "\\_"), $text);
3423 3423
 }
3424 3424
 
3425 3425
 /**
@@ -3434,14 +3434,14 @@  discard block
 block discarded – undo
3434 3434
  * @param string $url The URL to test.
3435 3435
  * @return bool Whether SSL access is available.
3436 3436
  */
3437
-function url_is_accessable_via_ssl( $url ) {
3438
-	_deprecated_function( __FUNCTION__, '4.0.0' );
3437
+function url_is_accessable_via_ssl($url) {
3438
+	_deprecated_function(__FUNCTION__, '4.0.0');
3439 3439
 
3440
-	$response = wp_remote_get( set_url_scheme( $url, 'https' ) );
3440
+	$response = wp_remote_get(set_url_scheme($url, 'https'));
3441 3441
 
3442
-	if ( !is_wp_error( $response ) ) {
3443
-		$status = wp_remote_retrieve_response_code( $response );
3444
-		if ( 200 == $status || 401 == $status ) {
3442
+	if ( ! is_wp_error($response)) {
3443
+		$status = wp_remote_retrieve_response_code($response);
3444
+		if (200 == $status || 401 == $status) {
3445 3445
 			return true;
3446 3446
 		}
3447 3447
 	}
@@ -3459,7 +3459,7 @@  discard block
 block discarded – undo
3459 3459
  * @deprecated 4.3.0
3460 3460
  */
3461 3461
 function preview_theme() {
3462
-	_deprecated_function( __FUNCTION__, '4.3.0' );
3462
+	_deprecated_function(__FUNCTION__, '4.3.0');
3463 3463
 }
3464 3464
 
3465 3465
 /**
@@ -3472,7 +3472,7 @@  discard block
 block discarded – undo
3472 3472
  * @return string
3473 3473
  */
3474 3474
 function _preview_theme_template_filter() {
3475
-	_deprecated_function( __FUNCTION__, '4.3.0' );
3475
+	_deprecated_function(__FUNCTION__, '4.3.0');
3476 3476
 	return '';
3477 3477
 }
3478 3478
 
@@ -3486,7 +3486,7 @@  discard block
 block discarded – undo
3486 3486
  * @return string
3487 3487
  */
3488 3488
 function _preview_theme_stylesheet_filter() {
3489
-	_deprecated_function( __FUNCTION__, '4.3.0' );
3489
+	_deprecated_function(__FUNCTION__, '4.3.0');
3490 3490
 	return '';
3491 3491
 }
3492 3492
 
@@ -3500,8 +3500,8 @@  discard block
 block discarded – undo
3500 3500
  * @param string $content
3501 3501
  * @return string
3502 3502
  */
3503
-function preview_theme_ob_filter( $content ) {
3504
-	_deprecated_function( __FUNCTION__, '4.3.0' );
3503
+function preview_theme_ob_filter($content) {
3504
+	_deprecated_function(__FUNCTION__, '4.3.0');
3505 3505
 	return $content;
3506 3506
 }
3507 3507
 
@@ -3517,8 +3517,8 @@  discard block
 block discarded – undo
3517 3517
  * @param array $matches
3518 3518
  * @return string
3519 3519
  */
3520
-function preview_theme_ob_filter_callback( $matches ) {
3521
-	_deprecated_function( __FUNCTION__, '4.3.0' );
3520
+function preview_theme_ob_filter_callback($matches) {
3521
+	_deprecated_function(__FUNCTION__, '4.3.0');
3522 3522
 	return '';
3523 3523
 }
3524 3524
 
@@ -3535,9 +3535,9 @@  discard block
 block discarded – undo
3535 3535
  * @return string The formatted text after filter is applied.
3536 3536
  */
3537 3537
 function wp_richedit_pre($text) {
3538
-	_deprecated_function( __FUNCTION__, '4.3.0', 'format_for_editor()' );
3538
+	_deprecated_function(__FUNCTION__, '4.3.0', 'format_for_editor()');
3539 3539
 
3540
-	if ( empty( $text ) ) {
3540
+	if (empty($text)) {
3541 3541
 		/**
3542 3542
 		 * Filters text returned for the rich text editor.
3543 3543
 		 *
@@ -3553,15 +3553,15 @@  discard block
 block discarded – undo
3553 3553
 		 *
3554 3554
 		 * @param string $output Text for the rich text editor.
3555 3555
 		 */
3556
-		return apply_filters( 'richedit_pre', '' );
3556
+		return apply_filters('richedit_pre', '');
3557 3557
 	}
3558 3558
 
3559 3559
 	$output = convert_chars($text);
3560 3560
 	$output = wpautop($output);
3561
-	$output = htmlspecialchars($output, ENT_NOQUOTES, get_option( 'blog_charset' ) );
3561
+	$output = htmlspecialchars($output, ENT_NOQUOTES, get_option('blog_charset'));
3562 3562
 
3563 3563
 	/** This filter is documented in wp-includes/deprecated.php */
3564
-	return apply_filters( 'richedit_pre', $output );
3564
+	return apply_filters('richedit_pre', $output);
3565 3565
 }
3566 3566
 
3567 3567
 /**
@@ -3578,10 +3578,10 @@  discard block
 block discarded – undo
3578 3578
  * @return string Formatted text after filter applied.
3579 3579
  */
3580 3580
 function wp_htmledit_pre($output) {
3581
-	_deprecated_function( __FUNCTION__, '4.3.0', 'format_for_editor()' );
3581
+	_deprecated_function(__FUNCTION__, '4.3.0', 'format_for_editor()');
3582 3582
 
3583
-	if ( !empty($output) )
3584
-		$output = htmlspecialchars($output, ENT_NOQUOTES, get_option( 'blog_charset' ) ); // convert only < > &
3583
+	if ( ! empty($output))
3584
+		$output = htmlspecialchars($output, ENT_NOQUOTES, get_option('blog_charset')); // convert only < > &
3585 3585
 
3586 3586
 	/**
3587 3587
 	 * Filters the text before it is formatted for the HTML editor.
@@ -3591,7 +3591,7 @@  discard block
 block discarded – undo
3591 3591
 	 *
3592 3592
 	 * @param string $output The HTML-formatted text.
3593 3593
 	 */
3594
-	return apply_filters( 'htmledit_pre', $output );
3594
+	return apply_filters('htmledit_pre', $output);
3595 3595
 }
3596 3596
 
3597 3597
 /**
@@ -3604,10 +3604,10 @@  discard block
 block discarded – undo
3604 3604
  * @param int|WP_Post $post_id Optional. Post ID or WP_Post object. Default is global $post.
3605 3605
  * @return string|false
3606 3606
  */
3607
-function post_permalink( $post_id = 0 ) {
3608
-	_deprecated_function( __FUNCTION__, '4.4.0', 'get_permalink()' );
3607
+function post_permalink($post_id = 0) {
3608
+	_deprecated_function(__FUNCTION__, '4.4.0', 'get_permalink()');
3609 3609
 
3610
-	return get_permalink( $post_id );
3610
+	return get_permalink($post_id);
3611 3611
 }
3612 3612
 
3613 3613
 /**
@@ -3626,44 +3626,44 @@  discard block
 block discarded – undo
3626 3626
  *                               returns false. Default 1.
3627 3627
  * @return bool|string False on failure and string of headers if HEAD request.
3628 3628
  */
3629
-function wp_get_http( $url, $file_path = false, $red = 1 ) {
3630
-	_deprecated_function( __FUNCTION__, '4.4.0', 'WP_Http' );
3629
+function wp_get_http($url, $file_path = false, $red = 1) {
3630
+	_deprecated_function(__FUNCTION__, '4.4.0', 'WP_Http');
3631 3631
 
3632
-	@set_time_limit( 60 );
3632
+	@set_time_limit(60);
3633 3633
 
3634
-	if ( $red > 5 )
3634
+	if ($red > 5)
3635 3635
 		return false;
3636 3636
 
3637 3637
 	$options = array();
3638 3638
 	$options['redirection'] = 5;
3639 3639
 
3640
-	if ( false == $file_path )
3640
+	if (false == $file_path)
3641 3641
 		$options['method'] = 'HEAD';
3642 3642
 	else
3643 3643
 		$options['method'] = 'GET';
3644 3644
 
3645
-	$response = wp_safe_remote_request( $url, $options );
3645
+	$response = wp_safe_remote_request($url, $options);
3646 3646
 
3647
-	if ( is_wp_error( $response ) )
3647
+	if (is_wp_error($response))
3648 3648
 		return false;
3649 3649
 
3650
-	$headers = wp_remote_retrieve_headers( $response );
3651
-	$headers['response'] = wp_remote_retrieve_response_code( $response );
3650
+	$headers = wp_remote_retrieve_headers($response);
3651
+	$headers['response'] = wp_remote_retrieve_response_code($response);
3652 3652
 
3653 3653
 	// WP_HTTP no longer follows redirects for HEAD requests.
3654
-	if ( 'HEAD' == $options['method'] && in_array($headers['response'], array(301, 302)) && isset( $headers['location'] ) ) {
3655
-		return wp_get_http( $headers['location'], $file_path, ++$red );
3654
+	if ('HEAD' == $options['method'] && in_array($headers['response'], array(301, 302)) && isset($headers['location'])) {
3655
+		return wp_get_http($headers['location'], $file_path, ++$red);
3656 3656
 	}
3657 3657
 
3658
-	if ( false == $file_path )
3658
+	if (false == $file_path)
3659 3659
 		return $headers;
3660 3660
 
3661 3661
 	// GET request - write it to the supplied filename
3662 3662
 	$out_fp = fopen($file_path, 'w');
3663
-	if ( !$out_fp )
3663
+	if ( ! $out_fp)
3664 3664
 		return $headers;
3665 3665
 
3666
-	fwrite( $out_fp,  wp_remote_retrieve_body( $response ) );
3666
+	fwrite($out_fp, wp_remote_retrieve_body($response));
3667 3667
 	fclose($out_fp);
3668 3668
 	clearstatcache();
3669 3669
 
@@ -3680,9 +3680,9 @@  discard block
 block discarded – undo
3680 3680
  * @param string|bool $force Optional Whether to force SSL login. Default null.
3681 3681
  * @return bool True if forced, false if not forced.
3682 3682
  */
3683
-function force_ssl_login( $force = null ) {
3684
-	_deprecated_function( __FUNCTION__, '4.4.0', 'force_ssl_admin()' );
3685
-	return force_ssl_admin( $force );
3683
+function force_ssl_login($force = null) {
3684
+	_deprecated_function(__FUNCTION__, '4.4.0', 'force_ssl_admin()');
3685
+	return force_ssl_admin($force);
3686 3686
 }
3687 3687
 
3688 3688
 /**
@@ -3694,7 +3694,7 @@  discard block
 block discarded – undo
3694 3694
  * @return string Full path to comments popup template file.
3695 3695
  */
3696 3696
 function get_comments_popup_template() {
3697
-	_deprecated_function( __FUNCTION__, '4.5.0' );
3697
+	_deprecated_function(__FUNCTION__, '4.5.0');
3698 3698
 
3699 3699
 	return '';
3700 3700
 }
@@ -3708,7 +3708,7 @@  discard block
 block discarded – undo
3708 3708
  * @return bool
3709 3709
  */
3710 3710
 function is_comments_popup() {
3711
-	_deprecated_function( __FUNCTION__, '4.5.0' );
3711
+	_deprecated_function(__FUNCTION__, '4.5.0');
3712 3712
 
3713 3713
 	return false;
3714 3714
 }
@@ -3720,7 +3720,7 @@  discard block
 block discarded – undo
3720 3720
  * @deprecated 4.5.0
3721 3721
  */
3722 3722
 function comments_popup_script() {
3723
-	_deprecated_function( __FUNCTION__, '4.5.0' );
3723
+	_deprecated_function(__FUNCTION__, '4.5.0');
3724 3724
 }
3725 3725
 
3726 3726
 /**
@@ -3732,8 +3732,8 @@  discard block
 block discarded – undo
3732 3732
  * @param string $text Content to replace links to open in a new window.
3733 3733
  * @return string Content that has filtered links.
3734 3734
  */
3735
-function popuplinks( $text ) {
3736
-	_deprecated_function( __FUNCTION__, '4.5.0' );
3735
+function popuplinks($text) {
3736
+	_deprecated_function(__FUNCTION__, '4.5.0');
3737 3737
 	$text = preg_replace('/<a (.+?)>/i', "<a $1 target='_blank' rel='external'>", $text);
3738 3738
 	return $text;
3739 3739
 }
@@ -3749,8 +3749,8 @@  discard block
 block discarded – undo
3749 3749
  *
3750 3750
  * @return string An empty string.
3751 3751
  */
3752
-function wp_embed_handler_googlevideo( $matches, $attr, $url, $rawattr ) {
3753
-	_deprecated_function( __FUNCTION__, '4.6.0' );
3752
+function wp_embed_handler_googlevideo($matches, $attr, $url, $rawattr) {
3753
+	_deprecated_function(__FUNCTION__, '4.6.0');
3754 3754
 
3755 3755
 	return '';
3756 3756
 }
Please login to merge, or discard this patch.
Braces   +388 added lines, -270 removed lines patch added patch discarded remove patch
@@ -86,8 +86,9 @@  discard block
 block discarded – undo
86 86
 	$categories = get_the_category();
87 87
 	$cat = $categories[0]->term_id;
88 88
 
89
-	if ( $echo )
90
-		echo $cat;
89
+	if ( $echo ) {
90
+			echo $cat;
91
+	}
91 92
 
92 93
 	return $cat;
93 94
 }
@@ -136,19 +137,22 @@  discard block
 block discarded – undo
136 137
 
137 138
 	_deprecated_function( __FUNCTION__, '2.0.0', 'previous_post_link()' );
138 139
 
139
-	if ( empty($in_same_cat) || 'no' == $in_same_cat )
140
-		$in_same_cat = false;
141
-	else
142
-		$in_same_cat = true;
140
+	if ( empty($in_same_cat) || 'no' == $in_same_cat ) {
141
+			$in_same_cat = false;
142
+	} else {
143
+			$in_same_cat = true;
144
+	}
143 145
 
144 146
 	$post = get_previous_post($in_same_cat, $excluded_categories);
145 147
 
146
-	if ( !$post )
147
-		return;
148
+	if ( !$post ) {
149
+			return;
150
+	}
148 151
 
149 152
 	$string = '<a href="'.get_permalink($post->ID).'">'.$previous;
150
-	if ( 'yes' == $title )
151
-		$string .= apply_filters('the_title', $post->post_title, $post->ID);
153
+	if ( 'yes' == $title ) {
154
+			$string .= apply_filters('the_title', $post->post_title, $post->ID);
155
+	}
152 156
 	$string .= '</a>';
153 157
 	$format = str_replace('%', $string, $format);
154 158
 	echo $format;
@@ -171,19 +175,22 @@  discard block
 block discarded – undo
171 175
 function next_post($format='%', $next='next post: ', $title='yes', $in_same_cat='no', $limitnext=1, $excluded_categories='') {
172 176
 	_deprecated_function( __FUNCTION__, '2.0.0', 'next_post_link()' );
173 177
 
174
-	if ( empty($in_same_cat) || 'no' == $in_same_cat )
175
-		$in_same_cat = false;
176
-	else
177
-		$in_same_cat = true;
178
+	if ( empty($in_same_cat) || 'no' == $in_same_cat ) {
179
+			$in_same_cat = false;
180
+	} else {
181
+			$in_same_cat = true;
182
+	}
178 183
 
179 184
 	$post = get_next_post($in_same_cat, $excluded_categories);
180 185
 
181
-	if ( !$post	)
182
-		return;
186
+	if ( !$post	) {
187
+			return;
188
+	}
183 189
 
184 190
 	$string = '<a href="'.get_permalink($post->ID).'">'.$next;
185
-	if ( 'yes' == $title )
186
-		$string .= apply_filters('the_title', $post->post_title, $post->ID);
191
+	if ( 'yes' == $title ) {
192
+			$string .= apply_filters('the_title', $post->post_title, $post->ID);
193
+	}
187 194
 	$string .= '</a>';
188 195
 	$format = str_replace('%', $string, $format);
189 196
 	echo $format;
@@ -366,11 +373,12 @@  discard block
 block discarded – undo
366 373
 
367 374
 	$user  = get_userdata($user_id);
368 375
 	$other = get_userdata($other_user);
369
-	if ( $user->user_level > $other->user_level || $user->user_level > 8 || $user->ID == $other->ID )
370
-		return true;
371
-	else
372
-		return false;
373
-}
376
+	if ( $user->user_level > $other->user_level || $user->user_level > 8 || $user->ID == $other->ID ) {
377
+			return true;
378
+	} else {
379
+			return false;
380
+	}
381
+	}
374 382
 
375 383
 /**
376 384
  * Gets the links associated with category $cat_name.
@@ -399,8 +407,9 @@  discard block
 block discarded – undo
399 407
 
400 408
 	$cat_id = -1;
401 409
 	$cat = get_term_by('name', $cat_name, 'link_category');
402
-	if ( $cat )
403
-		$cat_id = $cat->term_id;
410
+	if ( $cat ) {
411
+			$cat_id = $cat->term_id;
412
+	}
404 413
 
405 414
 	get_links($cat_id, $before, $after, $between, $show_images, $orderby, $show_description, $show_rating, $limit, $show_updated);
406 415
 }
@@ -459,8 +468,9 @@  discard block
 block discarded – undo
459 468
 
460 469
 	$cat_id = -1;
461 470
 	$cat = get_term_by('name', $cat_name, 'link_category');
462
-	if ( $cat )
463
-		$cat_id = $cat->term_id;
471
+	if ( $cat ) {
472
+			$cat_id = $cat->term_id;
473
+	}
464 474
 
465 475
 	return get_linkobjects($cat_id, $orderby, $limit);
466 476
 }
@@ -511,8 +521,9 @@  discard block
 block discarded – undo
511 521
 	$links = get_bookmarks( array( 'category' => $category, 'orderby' => $orderby, 'limit' => $limit ) ) ;
512 522
 
513 523
 	$links_array = array();
514
-	foreach ($links as $link)
515
-		$links_array[] = $link;
524
+	foreach ($links as $link) {
525
+			$links_array[] = $link;
526
+	}
516 527
 
517 528
 	return $links_array;
518 529
 }
@@ -638,18 +649,24 @@  discard block
 block discarded – undo
638 649
 	$r = wp_parse_args( $args );
639 650
 
640 651
 	// Map to new names.
641
-	if ( isset($r['optionall']) && isset($r['all']))
642
-		$r['show_option_all'] = $r['all'];
643
-	if ( isset($r['sort_column']) )
644
-		$r['orderby'] = $r['sort_column'];
645
-	if ( isset($r['sort_order']) )
646
-		$r['order'] = $r['sort_order'];
647
-	if ( isset($r['optiondates']) )
648
-		$r['show_last_update'] = $r['optiondates'];
649
-	if ( isset($r['optioncount']) )
650
-		$r['show_count'] = $r['optioncount'];
651
-	if ( isset($r['list']) )
652
-		$r['style'] = $r['list'] ? 'list' : 'break';
652
+	if ( isset($r['optionall']) && isset($r['all'])) {
653
+			$r['show_option_all'] = $r['all'];
654
+	}
655
+	if ( isset($r['sort_column']) ) {
656
+			$r['orderby'] = $r['sort_column'];
657
+	}
658
+	if ( isset($r['sort_order']) ) {
659
+			$r['order'] = $r['sort_order'];
660
+	}
661
+	if ( isset($r['optiondates']) ) {
662
+			$r['show_last_update'] = $r['optiondates'];
663
+	}
664
+	if ( isset($r['optioncount']) ) {
665
+			$r['show_count'] = $r['optioncount'];
666
+	}
667
+	if ( isset($r['list']) ) {
668
+			$r['style'] = $r['list'] ? 'list' : 'break';
669
+	}
653 670
 	$r['title_li'] = '';
654 671
 
655 672
 	return wp_list_categories($r);
@@ -680,12 +697,14 @@  discard block
 block discarded – undo
680 697
 	_deprecated_function( __FUNCTION__, '2.1.0', 'wp_dropdown_categories()' );
681 698
 
682 699
 	$show_option_all = '';
683
-	if ( $optionall )
684
-		$show_option_all = $all;
700
+	if ( $optionall ) {
701
+			$show_option_all = $all;
702
+	}
685 703
 
686 704
 	$show_option_none = '';
687
-	if ( $optionnone )
688
-		$show_option_none = __('None');
705
+	if ( $optionnone ) {
706
+			$show_option_none = __('None');
707
+	}
689 708
 
690 709
 	$vars = compact('show_option_all', 'show_option_none', 'orderby', 'order',
691 710
 					'show_last_update', 'show_count', 'hide_empty', 'selected', 'exclude');
@@ -787,8 +806,9 @@  discard block
 block discarded – undo
787 806
 
788 807
 	$link = get_author_posts_url($author_id, $author_nicename);
789 808
 
790
-	if ( $echo )
791
-		echo $link;
809
+	if ( $echo ) {
810
+			echo $link;
811
+	}
792 812
 	return $link;
793 813
 }
794 814
 
@@ -931,64 +951,78 @@  discard block
 block discarded – undo
931 951
 		$orderby = substr($orderby, 1);
932 952
 	}
933 953
 
934
-	if ( $category == -1 ) //get_bookmarks uses '' to signify all categories
954
+	if ( $category == -1 ) {
955
+		//get_bookmarks uses '' to signify all categories
935 956
 		$category = '';
957
+	}
936 958
 
937 959
 	$results = get_bookmarks(array('category' => $category, 'orderby' => $orderby, 'order' => $order, 'show_updated' => $show_updated, 'limit' => $limit));
938 960
 
939
-	if ( !$results )
940
-		return;
961
+	if ( !$results ) {
962
+			return;
963
+	}
941 964
 
942 965
 	$output = '';
943 966
 
944 967
 	foreach ( (array) $results as $row ) {
945
-		if ( !isset($row->recently_updated) )
946
-			$row->recently_updated = false;
968
+		if ( !isset($row->recently_updated) ) {
969
+					$row->recently_updated = false;
970
+		}
947 971
 		$output .= $before;
948
-		if ( $show_updated && $row->recently_updated )
949
-			$output .= get_option('links_recently_updated_prepend');
972
+		if ( $show_updated && $row->recently_updated ) {
973
+					$output .= get_option('links_recently_updated_prepend');
974
+		}
950 975
 		$the_link = '#';
951
-		if ( !empty($row->link_url) )
952
-			$the_link = esc_url($row->link_url);
976
+		if ( !empty($row->link_url) ) {
977
+					$the_link = esc_url($row->link_url);
978
+		}
953 979
 		$rel = $row->link_rel;
954
-		if ( '' != $rel )
955
-			$rel = ' rel="' . $rel . '"';
980
+		if ( '' != $rel ) {
981
+					$rel = ' rel="' . $rel . '"';
982
+		}
956 983
 
957 984
 		$desc = esc_attr(sanitize_bookmark_field('link_description', $row->link_description, $row->link_id, 'display'));
958 985
 		$name = esc_attr(sanitize_bookmark_field('link_name', $row->link_name, $row->link_id, 'display'));
959 986
 		$title = $desc;
960 987
 
961
-		if ( $show_updated )
962
-			if (substr($row->link_updated_f, 0, 2) != '00')
988
+		if ( $show_updated ) {
989
+					if (substr($row->link_updated_f, 0, 2) != '00')
963 990
 				$title .= ' ('.__('Last updated') . ' ' . date(get_option('links_updated_date_format'), $row->link_updated_f + (get_option('gmt_offset') * HOUR_IN_SECONDS)) . ')';
991
+		}
964 992
 
965
-		if ( '' != $title )
966
-			$title = ' title="' . $title . '"';
993
+		if ( '' != $title ) {
994
+					$title = ' title="' . $title . '"';
995
+		}
967 996
 
968 997
 		$alt = ' alt="' . $name . '"';
969 998
 
970 999
 		$target = $row->link_target;
971
-		if ( '' != $target )
972
-			$target = ' target="' . $target . '"';
1000
+		if ( '' != $target ) {
1001
+					$target = ' target="' . $target . '"';
1002
+		}
973 1003
 
974 1004
 		$output .= '<a href="' . $the_link . '"' . $rel . $title . $target. '>';
975 1005
 
976 1006
 		if ( $row->link_image != null && $show_images ) {
977
-			if ( strpos($row->link_image, 'http') !== false )
978
-				$output .= "<img src=\"$row->link_image\" $alt $title />";
979
-			else // If it's a relative path
1007
+			if ( strpos($row->link_image, 'http') !== false ) {
1008
+							$output .= "<img src=\"$row->link_image\" $alt $title />";
1009
+			} else {
1010
+				// If it's a relative path
980 1011
 				$output .= "<img src=\"" . get_option('siteurl') . "$row->link_image\" $alt $title />";
1012
+			}
981 1013
 		} else {
982 1014
 			$output .= $name;
983 1015
 		}
984 1016
 
985 1017
 		$output .= '</a>';
986 1018
 
987
-		if ( $show_updated && $row->recently_updated )
988
-			$output .= get_option('links_recently_updated_append');
1019
+		if ( $show_updated && $row->recently_updated ) {
1020
+					$output .= get_option('links_recently_updated_append');
1021
+		}
989 1022
 
990
-		if ( $show_description && '' != $desc )
991
-			$output .= $between . $desc;
1023
+		if ( $show_description && '' != $desc ) {
1024
+					$output .= $between . $desc;
1025
+		}
992 1026
 
993 1027
 		if ($show_rating) {
994 1028
 			$output .= $between . get_linkrating($row);
@@ -997,8 +1031,9 @@  discard block
 block discarded – undo
997 1031
 		$output .= "$after\n";
998 1032
 	} // end while
999 1033
 
1000
-	if ( !$echo )
1001
-		return $output;
1034
+	if ( !$echo ) {
1035
+			return $output;
1036
+	}
1002 1037
 	echo $output;
1003 1038
 }
1004 1039
 
@@ -1026,8 +1061,9 @@  discard block
 block discarded – undo
1026 1061
 		$order = substr($order,1);
1027 1062
 	}
1028 1063
 
1029
-	if ( !isset($direction) )
1030
-		$direction = '';
1064
+	if ( !isset($direction) ) {
1065
+			$direction = '';
1066
+	}
1031 1067
 
1032 1068
 	$cats = get_categories(array('type' => 'link', 'orderby' => $order, 'order' => $direction, 'hierarchical' => 0));
1033 1069
 
@@ -1093,13 +1129,15 @@  discard block
 block discarded – undo
1093 1129
 
1094 1130
 	$id = (int) $id;
1095 1131
 
1096
-	if ( empty($id) )
1097
-		return '';
1132
+	if ( empty($id) ) {
1133
+			return '';
1134
+	}
1098 1135
 
1099 1136
 	$cats = wp_get_link_cats($id);
1100 1137
 
1101
-	if ( empty($cats) || ! is_array($cats) )
1102
-		return '';
1138
+	if ( empty($cats) || ! is_array($cats) ) {
1139
+			return '';
1140
+	}
1103 1141
 
1104 1142
 	$cat_id = (int) $cats[0]; // Take the first cat.
1105 1143
 
@@ -1137,8 +1175,9 @@  discard block
 block discarded – undo
1137 1175
 
1138 1176
 	$link = get_category_feed_link($cat_ID, 'rss2');
1139 1177
 
1140
-	if ( $echo )
1141
-		echo $link;
1178
+	if ( $echo ) {
1179
+			echo $link;
1180
+	}
1142 1181
 	return $link;
1143 1182
 }
1144 1183
 
@@ -1157,8 +1196,9 @@  discard block
 block discarded – undo
1157 1196
 	_deprecated_function( __FUNCTION__, '2.5.0', 'get_author_feed_link()' );
1158 1197
 
1159 1198
 	$link = get_author_feed_link($author_id);
1160
-	if ( $echo )
1161
-		echo $link;
1199
+	if ( $echo ) {
1200
+			echo $link;
1201
+	}
1162 1202
 	return $link;
1163 1203
 }
1164 1204
 
@@ -1250,19 +1290,22 @@  discard block
 block discarded – undo
1250 1290
  */
1251 1291
 function get_category_children( $id, $before = '/', $after = '', $visited = array() ) {
1252 1292
 	_deprecated_function( __FUNCTION__, '2.8.0', 'get_term_children()' );
1253
-	if ( 0 == $id )
1254
-		return '';
1293
+	if ( 0 == $id ) {
1294
+			return '';
1295
+	}
1255 1296
 
1256 1297
 	$chain = '';
1257 1298
 	/** TODO: consult hierarchy */
1258 1299
 	$cat_ids = get_all_category_ids();
1259 1300
 	foreach ( (array) $cat_ids as $cat_id ) {
1260
-		if ( $cat_id == $id )
1261
-			continue;
1301
+		if ( $cat_id == $id ) {
1302
+					continue;
1303
+		}
1262 1304
 
1263 1305
 		$category = get_category( $cat_id );
1264
-		if ( is_wp_error( $category ) )
1265
-			return $category;
1306
+		if ( is_wp_error( $category ) ) {
1307
+					return $category;
1308
+		}
1266 1309
 		if ( $category->parent == $id && !in_array( $category->term_id, $visited ) ) {
1267 1310
 			$visited[] = $category->term_id;
1268 1311
 			$chain .= $before.$category->term_id.$after;
@@ -1653,8 +1696,9 @@  discard block
 block discarded – undo
1653 1696
 	_deprecated_function( __FUNCTION__, '2.9.0', 'the_content_feed' );
1654 1697
 	$content = get_the_content($more_link_text, $stripteaser);
1655 1698
 	$content = apply_filters('the_content_rss', $content);
1656
-	if ( $cut && !$encode_html )
1657
-		$encode_html = 2;
1699
+	if ( $cut && !$encode_html ) {
1700
+			$encode_html = 2;
1701
+	}
1658 1702
 	if ( 1== $encode_html ) {
1659 1703
 		$content = esc_html($content);
1660 1704
 		$cut = 0;
@@ -1674,8 +1718,9 @@  discard block
 block discarded – undo
1674 1718
 		}
1675 1719
 
1676 1720
 		/** @todo Check performance, might be faster to use array slice instead. */
1677
-		for ( $i=0; $i<$k; $i++ )
1678
-			$excerpt .= $blah[$i].' ';
1721
+		for ( $i=0; $i<$k; $i++ ) {
1722
+					$excerpt .= $blah[$i].' ';
1723
+		}
1679 1724
 		$excerpt .= ($use_dotdotdot) ? '...' : '';
1680 1725
 		$content = $excerpt;
1681 1726
 	}
@@ -1836,11 +1881,13 @@  discard block
 block discarded – undo
1836 1881
 	$id = (int) $id;
1837 1882
 	$_post = get_post($id);
1838 1883
 
1839
-	if ( ('attachment' != $_post->post_type) || !$url = wp_get_attachment_url($_post->ID) )
1840
-		return __('Missing Attachment');
1884
+	if ( ('attachment' != $_post->post_type) || !$url = wp_get_attachment_url($_post->ID) ) {
1885
+			return __('Missing Attachment');
1886
+	}
1841 1887
 
1842
-	if ( $permalink )
1843
-		$url = get_attachment_link($_post->ID);
1888
+	if ( $permalink ) {
1889
+			$url = get_attachment_link($_post->ID);
1890
+	}
1844 1891
 
1845 1892
 	$post_title = esc_attr($_post->post_title);
1846 1893
 
@@ -1862,8 +1909,9 @@  discard block
 block discarded – undo
1862 1909
 function get_attachment_icon_src( $id = 0, $fullsize = false ) {
1863 1910
 	_deprecated_function( __FUNCTION__, '2.5.0', 'wp_get_attachment_image_src()' );
1864 1911
 	$id = (int) $id;
1865
-	if ( !$post = get_post($id) )
1866
-		return false;
1912
+	if ( !$post = get_post($id) ) {
1913
+			return false;
1914
+	}
1867 1915
 
1868 1916
 	$file = get_attached_file( $post->ID );
1869 1917
 
@@ -1883,8 +1931,9 @@  discard block
 block discarded – undo
1883 1931
 		$src_file = $icon_dir . '/' . basename($src);
1884 1932
 	}
1885 1933
 
1886
-	if ( !isset($src) || !$src )
1887
-		return false;
1934
+	if ( !isset($src) || !$src ) {
1935
+			return false;
1936
+	}
1888 1937
 
1889 1938
 	return array($src, $src_file);
1890 1939
 }
@@ -1904,11 +1953,13 @@  discard block
 block discarded – undo
1904 1953
 function get_attachment_icon( $id = 0, $fullsize = false, $max_dims = false ) {
1905 1954
 	_deprecated_function( __FUNCTION__, '2.5.0', 'wp_get_attachment_image()' );
1906 1955
 	$id = (int) $id;
1907
-	if ( !$post = get_post($id) )
1908
-		return false;
1956
+	if ( !$post = get_post($id) ) {
1957
+			return false;
1958
+	}
1909 1959
 
1910
-	if ( !$src = get_attachment_icon_src( $post->ID, $fullsize ) )
1911
-		return false;
1960
+	if ( !$src = get_attachment_icon_src( $post->ID, $fullsize ) ) {
1961
+			return false;
1962
+	}
1912 1963
 
1913 1964
 	list($src, $src_file) = $src;
1914 1965
 
@@ -1960,11 +2011,13 @@  discard block
 block discarded – undo
1960 2011
 function get_attachment_innerHTML($id = 0, $fullsize = false, $max_dims = false) {
1961 2012
 	_deprecated_function( __FUNCTION__, '2.5.0', 'wp_get_attachment_image()' );
1962 2013
 	$id = (int) $id;
1963
-	if ( !$post = get_post($id) )
1964
-		return false;
2014
+	if ( !$post = get_post($id) ) {
2015
+			return false;
2016
+	}
1965 2017
 
1966
-	if ( $innerHTML = get_attachment_icon($post->ID, $fullsize, $max_dims))
1967
-		return $innerHTML;
2018
+	if ( $innerHTML = get_attachment_icon($post->ID, $fullsize, $max_dims)) {
2019
+			return $innerHTML;
2020
+	}
1968 2021
 
1969 2022
 	$innerHTML = esc_attr($post->post_title);
1970 2023
 
@@ -2023,10 +2076,11 @@  discard block
 block discarded – undo
2023 2076
  * @return string The cleaned $url after the {@see 'clean_url'} filter is applied.
2024 2077
  */
2025 2078
 function clean_url( $url, $protocols = null, $context = 'display' ) {
2026
-	if ( $context == 'db' )
2027
-		_deprecated_function( 'clean_url( $context = \'db\' )', '3.0.0', 'esc_url_raw()' );
2028
-	else
2029
-		_deprecated_function( __FUNCTION__, '3.0.0', 'esc_url()' );
2079
+	if ( $context == 'db' ) {
2080
+			_deprecated_function( 'clean_url( $context = \'db\' )', '3.0.0', 'esc_url_raw()' );
2081
+	} else {
2082
+			_deprecated_function( __FUNCTION__, '3.0.0', 'esc_url()' );
2083
+	}
2030 2084
 	return esc_url( $url, $protocols, $context );
2031 2085
 }
2032 2086
 
@@ -2107,20 +2161,23 @@  discard block
 block discarded – undo
2107 2161
 	_deprecated_function( __FUNCTION__, '2.8.0', 'wp_register_sidebar_widget()' );
2108 2162
 	// Compat
2109 2163
 	if ( is_array($name) ) {
2110
-		if ( count($name) == 3 )
2111
-			$name = sprintf($name[0], $name[2]);
2112
-		else
2113
-			$name = $name[0];
2164
+		if ( count($name) == 3 ) {
2165
+					$name = sprintf($name[0], $name[2]);
2166
+		} else {
2167
+					$name = $name[0];
2168
+		}
2114 2169
 	}
2115 2170
 
2116 2171
 	$id = sanitize_title($name);
2117 2172
 	$options = array();
2118
-	if ( !empty($classname) && is_string($classname) )
2119
-		$options['classname'] = $classname;
2173
+	if ( !empty($classname) && is_string($classname) ) {
2174
+			$options['classname'] = $classname;
2175
+	}
2120 2176
 	$params = array_slice(func_get_args(), 2);
2121 2177
 	$args = array($id, $name, $output_callback, $options);
2122
-	if ( !empty($params) )
2123
-		$args = array_merge($args, $params);
2178
+	if ( !empty($params) ) {
2179
+			$args = array_merge($args, $params);
2180
+	}
2124 2181
 
2125 2182
 	call_user_func_array('wp_register_sidebar_widget', $args);
2126 2183
 }
@@ -2162,22 +2219,26 @@  discard block
 block discarded – undo
2162 2219
 	_deprecated_function( __FUNCTION__, '2.8.0', 'wp_register_widget_control()' );
2163 2220
 	// Compat
2164 2221
 	if ( is_array($name) ) {
2165
-		if ( count($name) == 3 )
2166
-			$name = sprintf($name[0], $name[2]);
2167
-		else
2168
-			$name = $name[0];
2222
+		if ( count($name) == 3 ) {
2223
+					$name = sprintf($name[0], $name[2]);
2224
+		} else {
2225
+					$name = $name[0];
2226
+		}
2169 2227
 	}
2170 2228
 
2171 2229
 	$id = sanitize_title($name);
2172 2230
 	$options = array();
2173
-	if ( !empty($width) )
2174
-		$options['width'] = $width;
2175
-	if ( !empty($height) )
2176
-		$options['height'] = $height;
2231
+	if ( !empty($width) ) {
2232
+			$options['width'] = $width;
2233
+	}
2234
+	if ( !empty($height) ) {
2235
+			$options['height'] = $height;
2236
+	}
2177 2237
 	$params = array_slice(func_get_args(), 4);
2178 2238
 	$args = array($id, $name, $control_callback, $options);
2179
-	if ( !empty($params) )
2180
-		$args = array_merge($args, $params);
2239
+	if ( !empty($params) ) {
2240
+			$args = array_merge($args, $params);
2241
+	}
2181 2242
 
2182 2243
 	call_user_func_array('wp_register_widget_control', $args);
2183 2244
 }
@@ -2211,29 +2272,34 @@  discard block
 block discarded – undo
2211 2272
 function delete_usermeta( $user_id, $meta_key, $meta_value = '' ) {
2212 2273
 	_deprecated_function( __FUNCTION__, '3.0.0', 'delete_user_meta()' );
2213 2274
 	global $wpdb;
2214
-	if ( !is_numeric( $user_id ) )
2215
-		return false;
2275
+	if ( !is_numeric( $user_id ) ) {
2276
+			return false;
2277
+	}
2216 2278
 	$meta_key = preg_replace('|[^a-z0-9_]|i', '', $meta_key);
2217 2279
 
2218
-	if ( is_array($meta_value) || is_object($meta_value) )
2219
-		$meta_value = serialize($meta_value);
2280
+	if ( is_array($meta_value) || is_object($meta_value) ) {
2281
+			$meta_value = serialize($meta_value);
2282
+	}
2220 2283
 	$meta_value = trim( $meta_value );
2221 2284
 
2222 2285
 	$cur = $wpdb->get_row( $wpdb->prepare("SELECT * FROM $wpdb->usermeta WHERE user_id = %d AND meta_key = %s", $user_id, $meta_key) );
2223 2286
 
2224
-	if ( $cur && $cur->umeta_id )
2225
-		do_action( 'delete_usermeta', $cur->umeta_id, $user_id, $meta_key, $meta_value );
2287
+	if ( $cur && $cur->umeta_id ) {
2288
+			do_action( 'delete_usermeta', $cur->umeta_id, $user_id, $meta_key, $meta_value );
2289
+	}
2226 2290
 
2227
-	if ( ! empty($meta_value) )
2228
-		$wpdb->query( $wpdb->prepare("DELETE FROM $wpdb->usermeta WHERE user_id = %d AND meta_key = %s AND meta_value = %s", $user_id, $meta_key, $meta_value) );
2229
-	else
2230
-		$wpdb->query( $wpdb->prepare("DELETE FROM $wpdb->usermeta WHERE user_id = %d AND meta_key = %s", $user_id, $meta_key) );
2291
+	if ( ! empty($meta_value) ) {
2292
+			$wpdb->query( $wpdb->prepare("DELETE FROM $wpdb->usermeta WHERE user_id = %d AND meta_key = %s AND meta_value = %s", $user_id, $meta_key, $meta_value) );
2293
+	} else {
2294
+			$wpdb->query( $wpdb->prepare("DELETE FROM $wpdb->usermeta WHERE user_id = %d AND meta_key = %s", $user_id, $meta_key) );
2295
+	}
2231 2296
 
2232 2297
 	clean_user_cache( $user_id );
2233 2298
 	wp_cache_delete( $user_id, 'user_meta' );
2234 2299
 
2235
-	if ( $cur && $cur->umeta_id )
2236
-		do_action( 'deleted_usermeta', $cur->umeta_id, $user_id, $meta_key, $meta_value );
2300
+	if ( $cur && $cur->umeta_id ) {
2301
+			do_action( 'deleted_usermeta', $cur->umeta_id, $user_id, $meta_key, $meta_value );
2302
+	}
2237 2303
 
2238 2304
 	return true;
2239 2305
 }
@@ -2259,35 +2325,39 @@  discard block
 block discarded – undo
2259 2325
 	global $wpdb;
2260 2326
 	$user_id = (int) $user_id;
2261 2327
 
2262
-	if ( !$user_id )
2263
-		return false;
2328
+	if ( !$user_id ) {
2329
+			return false;
2330
+	}
2264 2331
 
2265 2332
 	if ( !empty($meta_key) ) {
2266 2333
 		$meta_key = preg_replace('|[^a-z0-9_]|i', '', $meta_key);
2267 2334
 		$user = wp_cache_get($user_id, 'users');
2268 2335
 		// Check the cached user object
2269
-		if ( false !== $user && isset($user->$meta_key) )
2270
-			$metas = array($user->$meta_key);
2271
-		else
2272
-			$metas = $wpdb->get_col( $wpdb->prepare("SELECT meta_value FROM $wpdb->usermeta WHERE user_id = %d AND meta_key = %s", $user_id, $meta_key) );
2336
+		if ( false !== $user && isset($user->$meta_key) ) {
2337
+					$metas = array($user->$meta_key);
2338
+		} else {
2339
+					$metas = $wpdb->get_col( $wpdb->prepare("SELECT meta_value FROM $wpdb->usermeta WHERE user_id = %d AND meta_key = %s", $user_id, $meta_key) );
2340
+		}
2273 2341
 	} else {
2274 2342
 		$metas = $wpdb->get_col( $wpdb->prepare("SELECT meta_value FROM $wpdb->usermeta WHERE user_id = %d", $user_id) );
2275 2343
 	}
2276 2344
 
2277 2345
 	if ( empty($metas) ) {
2278
-		if ( empty($meta_key) )
2279
-			return array();
2280
-		else
2281
-			return '';
2346
+		if ( empty($meta_key) ) {
2347
+					return array();
2348
+		} else {
2349
+					return '';
2350
+		}
2282 2351
 	}
2283 2352
 
2284 2353
 	$metas = array_map('maybe_unserialize', $metas);
2285 2354
 
2286
-	if ( count($metas) == 1 )
2287
-		return $metas[0];
2288
-	else
2289
-		return $metas;
2290
-}
2355
+	if ( count($metas) == 1 ) {
2356
+			return $metas[0];
2357
+	} else {
2358
+			return $metas;
2359
+	}
2360
+	}
2291 2361
 
2292 2362
 /**
2293 2363
  * Update metadata of user.
@@ -2310,13 +2380,15 @@  discard block
 block discarded – undo
2310 2380
 function update_usermeta( $user_id, $meta_key, $meta_value ) {
2311 2381
 	_deprecated_function( __FUNCTION__, '3.0.0', 'update_user_meta()' );
2312 2382
 	global $wpdb;
2313
-	if ( !is_numeric( $user_id ) )
2314
-		return false;
2383
+	if ( !is_numeric( $user_id ) ) {
2384
+			return false;
2385
+	}
2315 2386
 	$meta_key = preg_replace('|[^a-z0-9_]|i', '', $meta_key);
2316 2387
 
2317 2388
 	/** @todo Might need fix because usermeta data is assumed to be already escaped */
2318
-	if ( is_string($meta_value) )
2319
-		$meta_value = stripslashes($meta_value);
2389
+	if ( is_string($meta_value) ) {
2390
+			$meta_value = stripslashes($meta_value);
2391
+	}
2320 2392
 	$meta_value = maybe_serialize($meta_value);
2321 2393
 
2322 2394
 	if (empty($meta_value)) {
@@ -2325,23 +2397,26 @@  discard block
 block discarded – undo
2325 2397
 
2326 2398
 	$cur = $wpdb->get_row( $wpdb->prepare("SELECT * FROM $wpdb->usermeta WHERE user_id = %d AND meta_key = %s", $user_id, $meta_key) );
2327 2399
 
2328
-	if ( $cur )
2329
-		do_action( 'update_usermeta', $cur->umeta_id, $user_id, $meta_key, $meta_value );
2400
+	if ( $cur ) {
2401
+			do_action( 'update_usermeta', $cur->umeta_id, $user_id, $meta_key, $meta_value );
2402
+	}
2330 2403
 
2331
-	if ( !$cur )
2332
-		$wpdb->insert($wpdb->usermeta, compact('user_id', 'meta_key', 'meta_value') );
2333
-	elseif ( $cur->meta_value != $meta_value )
2334
-		$wpdb->update($wpdb->usermeta, compact('meta_value'), compact('user_id', 'meta_key') );
2335
-	else
2336
-		return false;
2404
+	if ( !$cur ) {
2405
+			$wpdb->insert($wpdb->usermeta, compact('user_id', 'meta_key', 'meta_value') );
2406
+	} elseif ( $cur->meta_value != $meta_value ) {
2407
+			$wpdb->update($wpdb->usermeta, compact('meta_value'), compact('user_id', 'meta_key') );
2408
+	} else {
2409
+			return false;
2410
+	}
2337 2411
 
2338 2412
 	clean_user_cache( $user_id );
2339 2413
 	wp_cache_delete( $user_id, 'user_meta' );
2340 2414
 
2341
-	if ( !$cur )
2342
-		do_action( 'added_usermeta', $wpdb->insert_id, $user_id, $meta_key, $meta_value );
2343
-	else
2344
-		do_action( 'updated_usermeta', $cur->umeta_id, $user_id, $meta_key, $meta_value );
2415
+	if ( !$cur ) {
2416
+			do_action( 'added_usermeta', $wpdb->insert_id, $user_id, $meta_key, $meta_value );
2417
+	} else {
2418
+			do_action( 'updated_usermeta', $cur->umeta_id, $user_id, $meta_key, $meta_value );
2419
+	}
2345 2420
 
2346 2421
 	return true;
2347 2422
 }
@@ -2366,8 +2441,9 @@  discard block
 block discarded – undo
2366 2441
 	_deprecated_function( __FUNCTION__, '3.1.0', 'get_users()' );
2367 2442
 
2368 2443
 	global $wpdb, $blog_id;
2369
-	if ( empty($id) )
2370
-		$id = (int) $blog_id;
2444
+	if ( empty($id) ) {
2445
+			$id = (int) $blog_id;
2446
+	}
2371 2447
 	$blog_prefix = $wpdb->get_blog_prefix($id);
2372 2448
 	$users = $wpdb->get_results( "SELECT user_id, user_id AS ID, user_login, display_name, user_email, meta_value FROM $wpdb->users, $wpdb->usermeta WHERE {$wpdb->users}.ID = {$wpdb->usermeta}.user_id AND meta_key = '{$blog_prefix}capabilities' ORDER BY {$wpdb->usermeta}.user_id" );
2373 2449
 	return $users;
@@ -2385,10 +2461,12 @@  discard block
 block discarded – undo
2385 2461
 function automatic_feed_links( $add = true ) {
2386 2462
 	_deprecated_function( __FUNCTION__, '3.0.0', "add_theme_support( 'automatic-feed-links' )" );
2387 2463
 
2388
-	if ( $add )
2389
-		add_theme_support( 'automatic-feed-links' );
2390
-	else
2391
-		remove_action( 'wp_head', 'feed_links_extra', 3 ); // Just do this yourself in 3.0+
2464
+	if ( $add ) {
2465
+			add_theme_support( 'automatic-feed-links' );
2466
+	} else {
2467
+			remove_action( 'wp_head', 'feed_links_extra', 3 );
2468
+	}
2469
+	// Just do this yourself in 3.0+
2392 2470
 }
2393 2471
 
2394 2472
 /**
@@ -2459,10 +2537,11 @@  discard block
 block discarded – undo
2459 2537
 	// Fixes for browsers' JavaScript bugs.
2460 2538
 	global $is_macIE, $is_winIE;
2461 2539
 
2462
-	if ( $is_winIE || $is_macIE )
2463
-		$text =  preg_replace_callback("/\%u([0-9A-F]{4,4})/",
2540
+	if ( $is_winIE || $is_macIE ) {
2541
+			$text =  preg_replace_callback("/\%u([0-9A-F]{4,4})/",
2464 2542
 					"funky_javascript_callback",
2465 2543
 					$text);
2544
+	}
2466 2545
 
2467 2546
 	return $text;
2468 2547
 }
@@ -2516,8 +2595,9 @@  discard block
 block discarded – undo
2516 2595
 
2517 2596
 	global $plugin_page;
2518 2597
 
2519
-	if ( isset($plugin_page) )
2520
-		return true;
2598
+	if ( isset($plugin_page) ) {
2599
+			return true;
2600
+	}
2521 2601
 
2522 2602
 	return false;
2523 2603
 }
@@ -2589,8 +2669,9 @@  discard block
 block discarded – undo
2589 2669
 	$objects = array();
2590 2670
 
2591 2671
 	$ids = array_map('intval', $ids);
2592
-	foreach ( $ids as $id )
2593
-		$objects[$id] = array();
2672
+	foreach ( $ids as $id ) {
2673
+			$objects[$id] = array();
2674
+	}
2594 2675
 
2595 2676
 	$metas = update_meta_cache('user', $ids);
2596 2677
 
@@ -2621,21 +2702,25 @@  discard block
 block discarded – undo
2621 2702
 	_deprecated_function( __FUNCTION__, '3.3.0' );
2622 2703
 
2623 2704
 	if ( is_object($user) ) {
2624
-		if ( !isset($user->ID) )
2625
-			$user->ID = 0;
2705
+		if ( !isset($user->ID) ) {
2706
+					$user->ID = 0;
2707
+		}
2626 2708
 		if ( ! ( $user instanceof WP_User ) ) {
2627 2709
 			$vars = get_object_vars($user);
2628 2710
 			foreach ( array_keys($vars) as $field ) {
2629
-				if ( is_string($user->$field) || is_numeric($user->$field) )
2630
-					$user->$field = sanitize_user_field($field, $user->$field, $user->ID, $context);
2711
+				if ( is_string($user->$field) || is_numeric($user->$field) ) {
2712
+									$user->$field = sanitize_user_field($field, $user->$field, $user->ID, $context);
2713
+				}
2631 2714
 			}
2632 2715
 		}
2633 2716
 		$user->filter = $context;
2634 2717
 	} else {
2635
-		if ( !isset($user['ID']) )
2636
-			$user['ID'] = 0;
2637
-		foreach ( array_keys($user) as $field )
2638
-			$user[$field] = sanitize_user_field($field, $user[$field], $user['ID'], $context);
2718
+		if ( !isset($user['ID']) ) {
2719
+					$user['ID'] = 0;
2720
+		}
2721
+		foreach ( array_keys($user) as $field ) {
2722
+					$user[$field] = sanitize_user_field($field, $user[$field], $user['ID'], $context);
2723
+		}
2639 2724
 		$user['filter'] = $context;
2640 2725
 	}
2641 2726
 
@@ -2661,14 +2746,16 @@  discard block
 block discarded – undo
2661 2746
 
2662 2747
 	$posts = get_boundary_post($in_same_cat, $excluded_categories, $start);
2663 2748
 	// If there is no post stop.
2664
-	if ( empty($posts) )
2665
-		return;
2749
+	if ( empty($posts) ) {
2750
+			return;
2751
+	}
2666 2752
 
2667 2753
 	// Even though we limited get_posts to return only 1 item it still returns an array of objects.
2668 2754
 	$post = $posts[0];
2669 2755
 
2670
-	if ( empty($post->post_title) )
2671
-		$post->post_title = $start ? __('First Post') : __('Last Post');
2756
+	if ( empty($post->post_title) ) {
2757
+			$post->post_title = $start ? __('First Post') : __('Last Post');
2758
+	}
2672 2759
 
2673 2760
 	$date = mysql2date(get_option('date_format'), $post->post_date);
2674 2761
 
@@ -2739,11 +2826,13 @@  discard block
 block discarded – undo
2739 2826
 function get_parent_post_rel_link( $title = '%title' ) {
2740 2827
 	_deprecated_function( __FUNCTION__, '3.3.0' );
2741 2828
 
2742
-	if ( ! empty( $GLOBALS['post'] ) && ! empty( $GLOBALS['post']->post_parent ) )
2743
-		$post = get_post($GLOBALS['post']->post_parent);
2829
+	if ( ! empty( $GLOBALS['post'] ) && ! empty( $GLOBALS['post']->post_parent ) ) {
2830
+			$post = get_post($GLOBALS['post']->post_parent);
2831
+	}
2744 2832
 
2745
-	if ( empty($post) )
2746
-		return;
2833
+	if ( empty($post) ) {
2834
+			return;
2835
+	}
2747 2836
 
2748 2837
 	$date = mysql2date(get_option('date_format'), $post->post_date);
2749 2838
 
@@ -2786,12 +2875,13 @@  discard block
 block discarded – undo
2786 2875
 	$user_id = get_current_user_id();
2787 2876
 
2788 2877
 	if ( 0 != $user_id ) {
2789
-		if ( is_admin() )
2790
-			$wp_admin_bar->add_menu( array( 'id' => 'view-site', 'title' => __( 'Visit Site' ), 'href' => home_url() ) );
2791
-		elseif ( is_multisite() )
2792
-			$wp_admin_bar->add_menu( array( 'id' => 'dashboard', 'title' => __( 'Dashboard' ), 'href' => get_dashboard_url( $user_id ) ) );
2793
-		else
2794
-			$wp_admin_bar->add_menu( array( 'id' => 'dashboard', 'title' => __( 'Dashboard' ), 'href' => admin_url() ) );
2878
+		if ( is_admin() ) {
2879
+					$wp_admin_bar->add_menu( array( 'id' => 'view-site', 'title' => __( 'Visit Site' ), 'href' => home_url() ) );
2880
+		} elseif ( is_multisite() ) {
2881
+					$wp_admin_bar->add_menu( array( 'id' => 'dashboard', 'title' => __( 'Dashboard' ), 'href' => get_dashboard_url( $user_id ) ) );
2882
+		} else {
2883
+					$wp_admin_bar->add_menu( array( 'id' => 'dashboard', 'title' => __( 'Dashboard' ), 'href' => admin_url() ) );
2884
+		}
2795 2885
 	}
2796 2886
 }
2797 2887
 
@@ -2843,9 +2933,10 @@  discard block
 block discarded – undo
2843 2933
  */
2844 2934
 function debug_fwrite( $fp, $string ) {
2845 2935
 	_deprecated_function( __FUNCTION__, 'error_log()' );
2846
-	if ( ! empty( $GLOBALS['debug'] ) )
2847
-		error_log( $string );
2848
-}
2936
+	if ( ! empty( $GLOBALS['debug'] ) ) {
2937
+			error_log( $string );
2938
+	}
2939
+	}
2849 2940
 
2850 2941
 /**
2851 2942
  * Close the debugging file handle.
@@ -2879,18 +2970,20 @@  discard block
 block discarded – undo
2879 2970
 	_deprecated_function( __FUNCTION__, '3.4.0', 'wp_get_themes()' );
2880 2971
 
2881 2972
 	global $wp_themes;
2882
-	if ( isset( $wp_themes ) )
2883
-		return $wp_themes;
2973
+	if ( isset( $wp_themes ) ) {
2974
+			return $wp_themes;
2975
+	}
2884 2976
 
2885 2977
 	$themes = wp_get_themes();
2886 2978
 	$wp_themes = array();
2887 2979
 
2888 2980
 	foreach ( $themes as $theme ) {
2889 2981
 		$name = $theme->get('Name');
2890
-		if ( isset( $wp_themes[ $name ] ) )
2891
-			$wp_themes[ $name . '/' . $theme->get_stylesheet() ] = $theme;
2892
-		else
2893
-			$wp_themes[ $name ] = $theme;
2982
+		if ( isset( $wp_themes[ $name ] ) ) {
2983
+					$wp_themes[ $name . '/' . $theme->get_stylesheet() ] = $theme;
2984
+		} else {
2985
+					$wp_themes[ $name ] = $theme;
2986
+		}
2894 2987
 	}
2895 2988
 
2896 2989
 	return $wp_themes;
@@ -2910,8 +3003,9 @@  discard block
 block discarded – undo
2910 3003
 	_deprecated_function( __FUNCTION__, '3.4.0', 'wp_get_theme( $stylesheet )' );
2911 3004
 
2912 3005
 	$themes = get_themes();
2913
-	if ( is_array( $themes ) && array_key_exists( $theme, $themes ) )
2914
-		return $themes[ $theme ];
3006
+	if ( is_array( $themes ) && array_key_exists( $theme, $themes ) ) {
3007
+			return $themes[ $theme ];
3008
+	}
2915 3009
 	return null;
2916 3010
 }
2917 3011
 
@@ -2927,8 +3021,9 @@  discard block
 block discarded – undo
2927 3021
 function get_current_theme() {
2928 3022
 	_deprecated_function( __FUNCTION__, '3.4.0', 'wp_get_theme()' );
2929 3023
 
2930
-	if ( $theme = get_option( 'current_theme' ) )
2931
-		return $theme;
3024
+	if ( $theme = get_option( 'current_theme' ) ) {
3025
+			return $theme;
3026
+	}
2932 3027
 
2933 3028
 	return wp_get_theme()->get('Name');
2934 3029
 }
@@ -2948,10 +3043,11 @@  discard block
 block discarded – undo
2948 3043
 function clean_pre($matches) {
2949 3044
 	_deprecated_function( __FUNCTION__, '3.4.0' );
2950 3045
 
2951
-	if ( is_array($matches) )
2952
-		$text = $matches[1] . $matches[2] . "</pre>";
2953
-	else
2954
-		$text = $matches;
3046
+	if ( is_array($matches) ) {
3047
+			$text = $matches[1] . $matches[2] . "</pre>";
3048
+	} else {
3049
+			$text = $matches;
3050
+	}
2955 3051
 
2956 3052
 	$text = str_replace(array('<br />', '<br/>', '<br>'), array('', '', ''), $text);
2957 3053
 	$text = str_replace('<p>', "\n", $text);
@@ -2978,8 +3074,9 @@  discard block
 block discarded – undo
2978 3074
 		'wp-head-callback'    => $wp_head_callback,
2979 3075
 		'admin-head-callback' => $admin_head_callback,
2980 3076
 	);
2981
-	if ( $admin_preview_callback )
2982
-		$args['admin-preview-callback'] = $admin_preview_callback;
3077
+	if ( $admin_preview_callback ) {
3078
+			$args['admin-preview-callback'] = $admin_preview_callback;
3079
+	}
2983 3080
 	return add_theme_support( 'custom-header', $args );
2984 3081
 }
2985 3082
 
@@ -3011,12 +3108,15 @@  discard block
 block discarded – undo
3011 3108
 function add_custom_background( $wp_head_callback = '', $admin_head_callback = '', $admin_preview_callback = '' ) {
3012 3109
 	_deprecated_function( __FUNCTION__, '3.4.0', 'add_theme_support( \'custom-background\', $args )' );
3013 3110
 	$args = array();
3014
-	if ( $wp_head_callback )
3015
-		$args['wp-head-callback'] = $wp_head_callback;
3016
-	if ( $admin_head_callback )
3017
-		$args['admin-head-callback'] = $admin_head_callback;
3018
-	if ( $admin_preview_callback )
3019
-		$args['admin-preview-callback'] = $admin_preview_callback;
3111
+	if ( $wp_head_callback ) {
3112
+			$args['wp-head-callback'] = $wp_head_callback;
3113
+	}
3114
+	if ( $admin_head_callback ) {
3115
+			$args['admin-head-callback'] = $admin_head_callback;
3116
+	}
3117
+	if ( $admin_preview_callback ) {
3118
+			$args['admin-preview-callback'] = $admin_preview_callback;
3119
+	}
3020 3120
 	return add_theme_support( 'custom-background', $args );
3021 3121
 }
3022 3122
 
@@ -3063,8 +3163,9 @@  discard block
 block discarded – undo
3063 3163
 	);
3064 3164
 
3065 3165
 	foreach ( apply_filters( 'extra_theme_headers', array() ) as $extra_header ) {
3066
-		if ( ! isset( $theme_data[ $extra_header ] ) )
3067
-			$theme_data[ $extra_header ] = $theme->get( $extra_header );
3166
+		if ( ! isset( $theme_data[ $extra_header ] ) ) {
3167
+					$theme_data[ $extra_header ] = $theme->get( $extra_header );
3168
+		}
3068 3169
 	}
3069 3170
 
3070 3171
 	return $theme_data;
@@ -3133,9 +3234,10 @@  discard block
 block discarded – undo
3133 3234
  */
3134 3235
 function sticky_class( $post_id = null ) {
3135 3236
 	_deprecated_function( __FUNCTION__, '3.5.0', 'post_class()' );
3136
-	if ( is_sticky( $post_id ) )
3137
-		echo ' sticky';
3138
-}
3237
+	if ( is_sticky( $post_id ) ) {
3238
+			echo ' sticky';
3239
+	}
3240
+	}
3139 3241
 
3140 3242
 /**
3141 3243
  * Retrieve post ancestors.
@@ -3166,22 +3268,26 @@  discard block
 block discarded – undo
3166 3268
 function wp_load_image( $file ) {
3167 3269
 	_deprecated_function( __FUNCTION__, '3.5.0', 'wp_get_image_editor()' );
3168 3270
 
3169
-	if ( is_numeric( $file ) )
3170
-		$file = get_attached_file( $file );
3271
+	if ( is_numeric( $file ) ) {
3272
+			$file = get_attached_file( $file );
3273
+	}
3171 3274
 
3172
-	if ( ! is_file( $file ) )
3173
-		return sprintf(__('File &#8220;%s&#8221; doesn&#8217;t exist?'), $file);
3275
+	if ( ! is_file( $file ) ) {
3276
+			return sprintf(__('File &#8220;%s&#8221; doesn&#8217;t exist?'), $file);
3277
+	}
3174 3278
 
3175
-	if ( ! function_exists('imagecreatefromstring') )
3176
-		return __('The GD image library is not installed.');
3279
+	if ( ! function_exists('imagecreatefromstring') ) {
3280
+			return __('The GD image library is not installed.');
3281
+	}
3177 3282
 
3178 3283
 	// Set artificially high because GD uses uncompressed images in memory.
3179 3284
 	wp_raise_memory_limit( 'image' );
3180 3285
 
3181 3286
 	$image = imagecreatefromstring( file_get_contents( $file ) );
3182 3287
 
3183
-	if ( !is_resource( $image ) )
3184
-		return sprintf(__('File &#8220;%s&#8221; is not an image.'), $file);
3288
+	if ( !is_resource( $image ) ) {
3289
+			return sprintf(__('File &#8220;%s&#8221; is not an image.'), $file);
3290
+	}
3185 3291
 
3186 3292
 	return $image;
3187 3293
 }
@@ -3214,19 +3320,22 @@  discard block
 block discarded – undo
3214 3320
 	_deprecated_function( __FUNCTION__, '3.5.0', 'wp_get_image_editor()' );
3215 3321
 
3216 3322
 	$editor = wp_get_image_editor( $file );
3217
-	if ( is_wp_error( $editor ) )
3218
-		return $editor;
3323
+	if ( is_wp_error( $editor ) ) {
3324
+			return $editor;
3325
+	}
3219 3326
 	$editor->set_quality( $jpeg_quality );
3220 3327
 
3221 3328
 	$resized = $editor->resize( $max_w, $max_h, $crop );
3222
-	if ( is_wp_error( $resized ) )
3223
-		return $resized;
3329
+	if ( is_wp_error( $resized ) ) {
3330
+			return $resized;
3331
+	}
3224 3332
 
3225 3333
 	$dest_file = $editor->generate_filename( $suffix, $dest_path );
3226 3334
 	$saved = $editor->save( $dest_file );
3227 3335
 
3228
-	if ( is_wp_error( $saved ) )
3229
-		return $saved;
3336
+	if ( is_wp_error( $saved ) ) {
3337
+			return $saved;
3338
+	}
3230 3339
 
3231 3340
 	return $dest_file;
3232 3341
 }
@@ -3264,8 +3373,9 @@  discard block
 block discarded – undo
3264 3373
 function user_pass_ok($user_login, $user_pass) {
3265 3374
 	_deprecated_function( __FUNCTION__, '3.5.0', 'wp_authenticate()' );
3266 3375
 	$user = wp_authenticate( $user_login, $user_pass );
3267
-	if ( is_wp_error( $user ) )
3268
-		return false;
3376
+	if ( is_wp_error( $user ) ) {
3377
+			return false;
3378
+	}
3269 3379
 
3270 3380
 	return true;
3271 3381
 }
@@ -3371,8 +3481,9 @@  discard block
 block discarded – undo
3371 3481
 	global $wp_rich_edit_exists;
3372 3482
 	_deprecated_function( __FUNCTION__, '3.9.0' );
3373 3483
 
3374
-	if ( ! isset( $wp_rich_edit_exists ) )
3375
-		$wp_rich_edit_exists = file_exists( ABSPATH . WPINC . '/js/tinymce/tinymce.js' );
3484
+	if ( ! isset( $wp_rich_edit_exists ) ) {
3485
+			$wp_rich_edit_exists = file_exists( ABSPATH . WPINC . '/js/tinymce/tinymce.js' );
3486
+	}
3376 3487
 
3377 3488
 	return $wp_rich_edit_exists;
3378 3489
 }
@@ -3580,8 +3691,10 @@  discard block
 block discarded – undo
3580 3691
 function wp_htmledit_pre($output) {
3581 3692
 	_deprecated_function( __FUNCTION__, '4.3.0', 'format_for_editor()' );
3582 3693
 
3583
-	if ( !empty($output) )
3584
-		$output = htmlspecialchars($output, ENT_NOQUOTES, get_option( 'blog_charset' ) ); // convert only < > &
3694
+	if ( !empty($output) ) {
3695
+			$output = htmlspecialchars($output, ENT_NOQUOTES, get_option( 'blog_charset' ) );
3696
+	}
3697
+	// convert only < > &
3585 3698
 
3586 3699
 	/**
3587 3700
 	 * Filters the text before it is formatted for the HTML editor.
@@ -3631,21 +3744,24 @@  discard block
 block discarded – undo
3631 3744
 
3632 3745
 	@set_time_limit( 60 );
3633 3746
 
3634
-	if ( $red > 5 )
3635
-		return false;
3747
+	if ( $red > 5 ) {
3748
+			return false;
3749
+	}
3636 3750
 
3637 3751
 	$options = array();
3638 3752
 	$options['redirection'] = 5;
3639 3753
 
3640
-	if ( false == $file_path )
3641
-		$options['method'] = 'HEAD';
3642
-	else
3643
-		$options['method'] = 'GET';
3754
+	if ( false == $file_path ) {
3755
+			$options['method'] = 'HEAD';
3756
+	} else {
3757
+			$options['method'] = 'GET';
3758
+	}
3644 3759
 
3645 3760
 	$response = wp_safe_remote_request( $url, $options );
3646 3761
 
3647
-	if ( is_wp_error( $response ) )
3648
-		return false;
3762
+	if ( is_wp_error( $response ) ) {
3763
+			return false;
3764
+	}
3649 3765
 
3650 3766
 	$headers = wp_remote_retrieve_headers( $response );
3651 3767
 	$headers['response'] = wp_remote_retrieve_response_code( $response );
@@ -3655,13 +3771,15 @@  discard block
 block discarded – undo
3655 3771
 		return wp_get_http( $headers['location'], $file_path, ++$red );
3656 3772
 	}
3657 3773
 
3658
-	if ( false == $file_path )
3659
-		return $headers;
3774
+	if ( false == $file_path ) {
3775
+			return $headers;
3776
+	}
3660 3777
 
3661 3778
 	// GET request - write it to the supplied filename
3662 3779
 	$out_fp = fopen($file_path, 'w');
3663
-	if ( !$out_fp )
3664
-		return $headers;
3780
+	if ( !$out_fp ) {
3781
+			return $headers;
3782
+	}
3665 3783
 
3666 3784
 	fwrite( $out_fp,  wp_remote_retrieve_body( $response ) );
3667 3785
 	fclose($out_fp);
Please login to merge, or discard this patch.
src/wp-includes/formatting.php 3 patches
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   +980 added lines, -981 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,41 +469,41 @@  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 single line break above block-level opening tags.
472
-	$pee = preg_replace('!(<' . $allblocks . '[\s/>])!', "\n$1", $pee);
472
+	$pee = preg_replace('!(<'.$allblocks.'[\s/>])!', "\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
 	// Remove more than two contiguous line breaks.
@@ -516,8 +516,8 @@  discard block
 block discarded – undo
516 516
 	$pee = '';
517 517
 
518 518
 	// Rebuild the content as a string, wrapping every bit with a <p>.
519
-	foreach ( $pees as $tinkle ) {
520
-		$pee .= '<p>' . trim($tinkle, "\n") . "</p>\n";
519
+	foreach ($pees as $tinkle) {
520
+		$pee .= '<p>'.trim($tinkle, "\n")."</p>\n";
521 521
 	}
522 522
 
523 523
 	// Under certain strange conditions it could create a P of entirely whitespace.
@@ -527,7 +527,7 @@  discard block
 block discarded – undo
527 527
 	$pee = preg_replace('!<p>([^<]+)</(div|address|form)>!', "<p>$1</p></$2>", $pee);
528 528
 
529 529
 	// If an opening or closing block element tag is wrapped in a <p>, unwrap it.
530
-	$pee = preg_replace('!<p>\s*(</?' . $allblocks . '[^>]*>)\s*</p>!', "$1", $pee);
530
+	$pee = preg_replace('!<p>\s*(</?'.$allblocks.'[^>]*>)\s*</p>!', "$1", $pee);
531 531
 
532 532
 	// In some cases <li> may get wrapped in <p>, fix them.
533 533
 	$pee = preg_replace("|<p>(<li.+?)</p>|", "$1", $pee);
@@ -537,18 +537,18 @@  discard block
 block discarded – undo
537 537
 	$pee = str_replace('</blockquote></p>', '</p></blockquote>', $pee);
538 538
 
539 539
 	// If an opening or closing block element tag is preceded by an opening <p> tag, remove it.
540
-	$pee = preg_replace('!<p>\s*(</?' . $allblocks . '[^>]*>)!', "$1", $pee);
540
+	$pee = preg_replace('!<p>\s*(</?'.$allblocks.'[^>]*>)!', "$1", $pee);
541 541
 
542 542
 	// If an opening or closing block element tag is followed by a closing <p> tag, remove it.
543
-	$pee = preg_replace('!(</?' . $allblocks . '[^>]*>)\s*</p>!', "$1", $pee);
543
+	$pee = preg_replace('!(</?'.$allblocks.'[^>]*>)\s*</p>!', "$1", $pee);
544 544
 
545 545
 	// Optionally insert line breaks.
546
-	if ( $br ) {
546
+	if ($br) {
547 547
 		// Replace newlines that shouldn't be touched with a placeholder.
548 548
 		$pee = preg_replace_callback('/<(script|style).*?<\/\\1>/s', '_autop_newline_preservation_helper', $pee);
549 549
 
550 550
 		// Normalize <br>
551
-		$pee = str_replace( array( '<br>', '<br/>' ), '<br />', $pee );
551
+		$pee = str_replace(array('<br>', '<br/>'), '<br />', $pee);
552 552
 
553 553
 		// Replace any new line characters that aren't preceded by a <br /> with a <br />.
554 554
 		$pee = preg_replace('|(?<!<br />)\s*\n|', "<br />\n", $pee);
@@ -558,19 +558,19 @@  discard block
 block discarded – undo
558 558
 	}
559 559
 
560 560
 	// If a <br /> tag is after an opening or closing block tag, remove it.
561
-	$pee = preg_replace('!(</?' . $allblocks . '[^>]*>)\s*<br />!', "$1", $pee);
561
+	$pee = preg_replace('!(</?'.$allblocks.'[^>]*>)\s*<br />!', "$1", $pee);
562 562
 
563 563
 	// If a <br /> tag is before a subset of opening or closing block tags, remove it.
564 564
 	$pee = preg_replace('!<br />(\s*</?(?:p|li|div|dl|dd|dt|th|pre|td|ul|ol)[^>]*>)!', '$1', $pee);
565
-	$pee = preg_replace( "|\n</p>$|", '</p>', $pee );
565
+	$pee = preg_replace("|\n</p>$|", '</p>', $pee);
566 566
 
567 567
 	// Replace placeholder <pre> tags with their original content.
568
-	if ( !empty($pre_tags) )
568
+	if ( ! empty($pre_tags))
569 569
 		$pee = str_replace(array_keys($pre_tags), array_values($pre_tags), $pee);
570 570
 
571 571
 	// Restore newlines in all elements.
572
-	if ( false !== strpos( $pee, '<!-- wpnl -->' ) ) {
573
-		$pee = str_replace( array( ' <!-- wpnl --> ', '<!-- wpnl -->' ), "\n", $pee );
572
+	if (false !== strpos($pee, '<!-- wpnl -->')) {
573
+		$pee = str_replace(array(' <!-- wpnl --> ', '<!-- wpnl -->'), "\n", $pee);
574 574
 	}
575 575
 
576 576
 	return $pee;
@@ -584,8 +584,8 @@  discard block
 block discarded – undo
584 584
  * @param string $input The text which has to be formatted.
585 585
  * @return array The formatted text.
586 586
  */
587
-function wp_html_split( $input ) {
588
-	return preg_split( get_html_split_regex(), $input, -1, PREG_SPLIT_DELIM_CAPTURE );
587
+function wp_html_split($input) {
588
+	return preg_split(get_html_split_regex(), $input, -1, PREG_SPLIT_DELIM_CAPTURE);
589 589
 }
590 590
 
591 591
 /**
@@ -598,14 +598,14 @@  discard block
 block discarded – undo
598 598
 function get_html_split_regex() {
599 599
 	static $regex;
600 600
 
601
-	if ( ! isset( $regex ) ) {
601
+	if ( ! isset($regex)) {
602 602
 		$comments =
603 603
 			  '!'           // Start of comment, after the <.
604 604
 			. '(?:'         // Unroll the loop: Consume everything until --> is found.
605 605
 			.     '-(?!->)' // Dash not followed by end of comment.
606 606
 			.     '[^\-]*+' // Consume non-dashes.
607 607
 			. ')*+'         // Loop possessively.
608
-			. '(?:-->)?';   // End of comment. If not found, match all input.
608
+			. '(?:-->)?'; // End of comment. If not found, match all input.
609 609
 
610 610
 		$cdata =
611 611
 			  '!\[CDATA\['  // Start of comment, after the <.
@@ -614,7 +614,7 @@  discard block
 block discarded – undo
614 614
 			.     '](?!]>)' // One ] not followed by end of comment.
615 615
 			.     '[^\]]*+' // Consume non-].
616 616
 			. ')*+'         // Loop possessively.
617
-			. '(?:]]>)?';   // End of comment. If not found, match all input.
617
+			. '(?:]]>)?'; // End of comment. If not found, match all input.
618 618
 
619 619
 		$escaped =
620 620
 			  '(?='           // Is the element escaped?
@@ -653,19 +653,19 @@  discard block
 block discarded – undo
653 653
  * @param string $shortcode_regex The result from _get_wptexturize_shortcode_regex().  Optional.
654 654
  * @return string The regular expression
655 655
  */
656
-function _get_wptexturize_split_regex( $shortcode_regex = '' ) {
656
+function _get_wptexturize_split_regex($shortcode_regex = '') {
657 657
 	static $html_regex;
658 658
 
659
-	if ( ! isset( $html_regex ) ) {
659
+	if ( ! isset($html_regex)) {
660 660
 		$comment_regex =
661 661
 			  '!'           // Start of comment, after the <.
662 662
 			. '(?:'         // Unroll the loop: Consume everything until --> is found.
663 663
 			.     '-(?!->)' // Dash not followed by end of comment.
664 664
 			.     '[^\-]*+' // Consume non-dashes.
665 665
 			. ')*+'         // Loop possessively.
666
-			. '(?:-->)?';   // End of comment. If not found, match all input.
666
+			. '(?:-->)?'; // End of comment. If not found, match all input.
667 667
 
668
-		$html_regex =			 // Needs replaced with wp_html_split() per Shortcode API Roadmap.
668
+		$html_regex = // Needs replaced with wp_html_split() per Shortcode API Roadmap.
669 669
 			  '<'                // Find start of element.
670 670
 			. '(?(?=!--)'        // Is this a comment?
671 671
 			.     $comment_regex // Find end of comment.
@@ -674,10 +674,10 @@  discard block
 block discarded – undo
674 674
 			. ')';
675 675
 	}
676 676
 
677
-	if ( empty( $shortcode_regex ) ) {
678
-		$regex = '/(' . $html_regex . ')/';
677
+	if (empty($shortcode_regex)) {
678
+		$regex = '/('.$html_regex.')/';
679 679
 	} else {
680
-		$regex = '/(' . $html_regex . '|' . $shortcode_regex . ')/';
680
+		$regex = '/('.$html_regex.'|'.$shortcode_regex.')/';
681 681
 	}
682 682
 
683 683
 	return $regex;
@@ -694,8 +694,8 @@  discard block
 block discarded – undo
694 694
  * @param array $tagnames List of shortcodes to find.
695 695
  * @return string The regular expression
696 696
  */
697
-function _get_wptexturize_shortcode_regex( $tagnames ) {
698
-	$tagregexp = join( '|', array_map( 'preg_quote', $tagnames ) );
697
+function _get_wptexturize_shortcode_regex($tagnames) {
698
+	$tagregexp = join('|', array_map('preg_quote', $tagnames));
699 699
 	$tagregexp = "(?:$tagregexp)(?=[\\s\\]\\/])"; // Excerpt of get_shortcode_regex().
700 700
 	$regex =
701 701
 		  '\['              // Find start of shortcode.
@@ -707,7 +707,7 @@  discard block
 block discarded – undo
707 707
 		.     '<[^\[\]>]*>' // HTML elements permitted. Prevents matching ] before >.
708 708
 		. ')*+'             // Possessive critical.
709 709
 		. '\]'              // Find end of shortcode.
710
-		. '\]?';            // Shortcodes may end with ]]
710
+		. '\]?'; // Shortcodes may end with ]]
711 711
 
712 712
 	return $regex;
713 713
 }
@@ -721,32 +721,32 @@  discard block
 block discarded – undo
721 721
  * @param array $replace_pairs In the form array('from' => 'to', ...).
722 722
  * @return string The formatted text.
723 723
  */
724
-function wp_replace_in_html_tags( $haystack, $replace_pairs ) {
724
+function wp_replace_in_html_tags($haystack, $replace_pairs) {
725 725
 	// Find all elements.
726
-	$textarr = wp_html_split( $haystack );
726
+	$textarr = wp_html_split($haystack);
727 727
 	$changed = false;
728 728
 
729 729
 	// Optimize when searching for one item.
730
-	if ( 1 === count( $replace_pairs ) ) {
730
+	if (1 === count($replace_pairs)) {
731 731
 		// Extract $needle and $replace.
732
-		foreach ( $replace_pairs as $needle => $replace );
732
+		foreach ($replace_pairs as $needle => $replace);
733 733
 
734 734
 		// Loop through delimiters (elements) only.
735
-		for ( $i = 1, $c = count( $textarr ); $i < $c; $i += 2 ) {
736
-			if ( false !== strpos( $textarr[$i], $needle ) ) {
737
-				$textarr[$i] = str_replace( $needle, $replace, $textarr[$i] );
735
+		for ($i = 1, $c = count($textarr); $i < $c; $i += 2) {
736
+			if (false !== strpos($textarr[$i], $needle)) {
737
+				$textarr[$i] = str_replace($needle, $replace, $textarr[$i]);
738 738
 				$changed = true;
739 739
 			}
740 740
 		}
741 741
 	} else {
742 742
 		// Extract all $needles.
743
-		$needles = array_keys( $replace_pairs );
743
+		$needles = array_keys($replace_pairs);
744 744
 
745 745
 		// Loop through delimiters (elements) only.
746
-		for ( $i = 1, $c = count( $textarr ); $i < $c; $i += 2 ) {
747
-			foreach ( $needles as $needle ) {
748
-				if ( false !== strpos( $textarr[$i], $needle ) ) {
749
-					$textarr[$i] = strtr( $textarr[$i], $replace_pairs );
746
+		for ($i = 1, $c = count($textarr); $i < $c; $i += 2) {
747
+			foreach ($needles as $needle) {
748
+				if (false !== strpos($textarr[$i], $needle)) {
749
+					$textarr[$i] = strtr($textarr[$i], $replace_pairs);
750 750
 					$changed = true;
751 751
 					// After one strtr() break out of the foreach loop and look at next element.
752 752
 					break;
@@ -755,8 +755,8 @@  discard block
 block discarded – undo
755 755
 		}
756 756
 	}
757 757
 
758
-	if ( $changed ) {
759
-		$haystack = implode( $textarr );
758
+	if ($changed) {
759
+		$haystack = implode($textarr);
760 760
 	}
761 761
 
762 762
 	return $haystack;
@@ -771,8 +771,8 @@  discard block
 block discarded – undo
771 771
  * @param array $matches preg_replace_callback matches array
772 772
  * @return string
773 773
  */
774
-function _autop_newline_preservation_helper( $matches ) {
775
-	return str_replace( "\n", "<WPPreserveNewline />", $matches[0] );
774
+function _autop_newline_preservation_helper($matches) {
775
+	return str_replace("\n", "<WPPreserveNewline />", $matches[0]);
776 776
 }
777 777
 
778 778
 /**
@@ -787,20 +787,20 @@  discard block
 block discarded – undo
787 787
  * @param string $pee The content.
788 788
  * @return string The filtered content.
789 789
  */
790
-function shortcode_unautop( $pee ) {
790
+function shortcode_unautop($pee) {
791 791
 	global $shortcode_tags;
792 792
 
793
-	if ( empty( $shortcode_tags ) || !is_array( $shortcode_tags ) ) {
793
+	if (empty($shortcode_tags) || ! is_array($shortcode_tags)) {
794 794
 		return $pee;
795 795
 	}
796 796
 
797
-	$tagregexp = join( '|', array_map( 'preg_quote', array_keys( $shortcode_tags ) ) );
797
+	$tagregexp = join('|', array_map('preg_quote', array_keys($shortcode_tags)));
798 798
 	$spaces = wp_spaces_regexp();
799 799
 
800 800
 	$pattern =
801 801
 		  '/'
802 802
 		. '<p>'                              // Opening paragraph
803
-		. '(?:' . $spaces . ')*+'            // Optional leading whitespace
803
+		. '(?:'.$spaces.')*+'            // Optional leading whitespace
804 804
 		. '('                                // 1: The shortcode
805 805
 		.     '\\['                          // Opening bracket
806 806
 		.     "($tagregexp)"                 // 2: Shortcode name
@@ -825,11 +825,11 @@  discard block
 block discarded – undo
825 825
 		.         ')?'
826 826
 		.     ')'
827 827
 		. ')'
828
-		. '(?:' . $spaces . ')*+'            // optional trailing whitespace
828
+		. '(?:'.$spaces.')*+'            // optional trailing whitespace
829 829
 		. '<\\/p>'                           // closing paragraph
830 830
 		. '/';
831 831
 
832
-	return preg_replace( $pattern, '$1', $pee );
832
+	return preg_replace($pattern, '$1', $pee);
833 833
 }
834 834
 
835 835
 /**
@@ -844,20 +844,20 @@  discard block
 block discarded – undo
844 844
  * @param string $str The string to be checked
845 845
  * @return bool True if $str fits a UTF-8 model, false otherwise.
846 846
  */
847
-function seems_utf8( $str ) {
847
+function seems_utf8($str) {
848 848
 	mbstring_binary_safe_encoding();
849 849
 	$length = strlen($str);
850 850
 	reset_mbstring_encoding();
851
-	for ($i=0; $i < $length; $i++) {
851
+	for ($i = 0; $i < $length; $i++) {
852 852
 		$c = ord($str[$i]);
853 853
 		if ($c < 0x80) $n = 0; // 0bbbbbbb
854
-		elseif (($c & 0xE0) == 0xC0) $n=1; // 110bbbbb
855
-		elseif (($c & 0xF0) == 0xE0) $n=2; // 1110bbbb
856
-		elseif (($c & 0xF8) == 0xF0) $n=3; // 11110bbb
857
-		elseif (($c & 0xFC) == 0xF8) $n=4; // 111110bb
858
-		elseif (($c & 0xFE) == 0xFC) $n=5; // 1111110b
854
+		elseif (($c & 0xE0) == 0xC0) $n = 1; // 110bbbbb
855
+		elseif (($c & 0xF0) == 0xE0) $n = 2; // 1110bbbb
856
+		elseif (($c & 0xF8) == 0xF0) $n = 3; // 11110bbb
857
+		elseif (($c & 0xFC) == 0xF8) $n = 4; // 111110bb
858
+		elseif (($c & 0xFE) == 0xFC) $n = 5; // 1111110b
859 859
 		else return false; // Does not match any model
860
-		for ($j=0; $j<$n; $j++) { // n bytes matching 10bbbbbb follow ?
860
+		for ($j = 0; $j < $n; $j++) { // n bytes matching 10bbbbbb follow ?
861 861
 			if ((++$i == $length) || ((ord($str[$i]) & 0xC0) != 0x80))
862 862
 				return false;
863 863
 		}
@@ -888,55 +888,55 @@  discard block
 block discarded – undo
888 888
  * @param bool       $double_encode  Optional. Whether to encode existing html entities. Default is false.
889 889
  * @return string The encoded text with HTML entities.
890 890
  */
891
-function _wp_specialchars( $string, $quote_style = ENT_NOQUOTES, $charset = false, $double_encode = false ) {
891
+function _wp_specialchars($string, $quote_style = ENT_NOQUOTES, $charset = false, $double_encode = false) {
892 892
 	$string = (string) $string;
893 893
 
894
-	if ( 0 === strlen( $string ) )
894
+	if (0 === strlen($string))
895 895
 		return '';
896 896
 
897 897
 	// Don't bother if there are no specialchars - saves some processing
898
-	if ( ! preg_match( '/[&<>"\']/', $string ) )
898
+	if ( ! preg_match('/[&<>"\']/', $string))
899 899
 		return $string;
900 900
 
901 901
 	// Account for the previous behaviour of the function when the $quote_style is not an accepted value
902
-	if ( empty( $quote_style ) )
902
+	if (empty($quote_style))
903 903
 		$quote_style = ENT_NOQUOTES;
904
-	elseif ( ! in_array( $quote_style, array( 0, 2, 3, 'single', 'double' ), true ) )
904
+	elseif ( ! in_array($quote_style, array(0, 2, 3, 'single', 'double'), true))
905 905
 		$quote_style = ENT_QUOTES;
906 906
 
907 907
 	// Store the site charset as a static to avoid multiple calls to wp_load_alloptions()
908
-	if ( ! $charset ) {
908
+	if ( ! $charset) {
909 909
 		static $_charset = null;
910
-		if ( ! isset( $_charset ) ) {
910
+		if ( ! isset($_charset)) {
911 911
 			$alloptions = wp_load_alloptions();
912
-			$_charset = isset( $alloptions['blog_charset'] ) ? $alloptions['blog_charset'] : '';
912
+			$_charset = isset($alloptions['blog_charset']) ? $alloptions['blog_charset'] : '';
913 913
 		}
914 914
 		$charset = $_charset;
915 915
 	}
916 916
 
917
-	if ( in_array( $charset, array( 'utf8', 'utf-8', 'UTF8' ) ) )
917
+	if (in_array($charset, array('utf8', 'utf-8', 'UTF8')))
918 918
 		$charset = 'UTF-8';
919 919
 
920 920
 	$_quote_style = $quote_style;
921 921
 
922
-	if ( $quote_style === 'double' ) {
922
+	if ($quote_style === 'double') {
923 923
 		$quote_style = ENT_COMPAT;
924 924
 		$_quote_style = ENT_COMPAT;
925
-	} elseif ( $quote_style === 'single' ) {
925
+	} elseif ($quote_style === 'single') {
926 926
 		$quote_style = ENT_NOQUOTES;
927 927
 	}
928 928
 
929
-	if ( ! $double_encode ) {
929
+	if ( ! $double_encode) {
930 930
 		// Guarantee every &entity; is valid, convert &garbage; into &amp;garbage;
931 931
 		// This is required for PHP < 5.4.0 because ENT_HTML401 flag is unavailable.
932
-		$string = wp_kses_normalize_entities( $string );
932
+		$string = wp_kses_normalize_entities($string);
933 933
 	}
934 934
 
935
-	$string = @htmlspecialchars( $string, $quote_style, $charset, $double_encode );
935
+	$string = @htmlspecialchars($string, $quote_style, $charset, $double_encode);
936 936
 
937 937
 	// Back-compat.
938
-	if ( 'single' === $_quote_style )
939
-		$string = str_replace( "'", '&#039;', $string );
938
+	if ('single' === $_quote_style)
939
+		$string = str_replace("'", '&#039;', $string);
940 940
 
941 941
 	return $string;
942 942
 }
@@ -961,52 +961,52 @@  discard block
 block discarded – undo
961 961
  *                                Default is ENT_NOQUOTES.
962 962
  * @return string The decoded text without HTML entities.
963 963
  */
964
-function wp_specialchars_decode( $string, $quote_style = ENT_NOQUOTES ) {
964
+function wp_specialchars_decode($string, $quote_style = ENT_NOQUOTES) {
965 965
 	$string = (string) $string;
966 966
 
967
-	if ( 0 === strlen( $string ) ) {
967
+	if (0 === strlen($string)) {
968 968
 		return '';
969 969
 	}
970 970
 
971 971
 	// Don't bother if there are no entities - saves a lot of processing
972
-	if ( strpos( $string, '&' ) === false ) {
972
+	if (strpos($string, '&') === false) {
973 973
 		return $string;
974 974
 	}
975 975
 
976 976
 	// Match the previous behaviour of _wp_specialchars() when the $quote_style is not an accepted value
977
-	if ( empty( $quote_style ) ) {
977
+	if (empty($quote_style)) {
978 978
 		$quote_style = ENT_NOQUOTES;
979
-	} elseif ( !in_array( $quote_style, array( 0, 2, 3, 'single', 'double' ), true ) ) {
979
+	} elseif ( ! in_array($quote_style, array(0, 2, 3, 'single', 'double'), true)) {
980 980
 		$quote_style = ENT_QUOTES;
981 981
 	}
982 982
 
983 983
 	// More complete than get_html_translation_table( HTML_SPECIALCHARS )
984
-	$single = array( '&#039;'  => '\'', '&#x27;' => '\'' );
985
-	$single_preg = array( '/&#0*39;/'  => '&#039;', '/&#x0*27;/i' => '&#x27;' );
986
-	$double = array( '&quot;' => '"', '&#034;'  => '"', '&#x22;' => '"' );
987
-	$double_preg = array( '/&#0*34;/'  => '&#034;', '/&#x0*22;/i' => '&#x22;' );
988
-	$others = array( '&lt;'   => '<', '&#060;'  => '<', '&gt;'   => '>', '&#062;'  => '>', '&amp;'  => '&', '&#038;'  => '&', '&#x26;' => '&' );
989
-	$others_preg = array( '/&#0*60;/'  => '&#060;', '/&#0*62;/'  => '&#062;', '/&#0*38;/'  => '&#038;', '/&#x0*26;/i' => '&#x26;' );
990
-
991
-	if ( $quote_style === ENT_QUOTES ) {
992
-		$translation = array_merge( $single, $double, $others );
993
-		$translation_preg = array_merge( $single_preg, $double_preg, $others_preg );
994
-	} elseif ( $quote_style === ENT_COMPAT || $quote_style === 'double' ) {
995
-		$translation = array_merge( $double, $others );
996
-		$translation_preg = array_merge( $double_preg, $others_preg );
997
-	} elseif ( $quote_style === 'single' ) {
998
-		$translation = array_merge( $single, $others );
999
-		$translation_preg = array_merge( $single_preg, $others_preg );
1000
-	} elseif ( $quote_style === ENT_NOQUOTES ) {
984
+	$single = array('&#039;'  => '\'', '&#x27;' => '\'');
985
+	$single_preg = array('/&#0*39;/'  => '&#039;', '/&#x0*27;/i' => '&#x27;');
986
+	$double = array('&quot;' => '"', '&#034;'  => '"', '&#x22;' => '"');
987
+	$double_preg = array('/&#0*34;/'  => '&#034;', '/&#x0*22;/i' => '&#x22;');
988
+	$others = array('&lt;'   => '<', '&#060;'  => '<', '&gt;'   => '>', '&#062;'  => '>', '&amp;'  => '&', '&#038;'  => '&', '&#x26;' => '&');
989
+	$others_preg = array('/&#0*60;/'  => '&#060;', '/&#0*62;/'  => '&#062;', '/&#0*38;/'  => '&#038;', '/&#x0*26;/i' => '&#x26;');
990
+
991
+	if ($quote_style === ENT_QUOTES) {
992
+		$translation = array_merge($single, $double, $others);
993
+		$translation_preg = array_merge($single_preg, $double_preg, $others_preg);
994
+	} elseif ($quote_style === ENT_COMPAT || $quote_style === 'double') {
995
+		$translation = array_merge($double, $others);
996
+		$translation_preg = array_merge($double_preg, $others_preg);
997
+	} elseif ($quote_style === 'single') {
998
+		$translation = array_merge($single, $others);
999
+		$translation_preg = array_merge($single_preg, $others_preg);
1000
+	} elseif ($quote_style === ENT_NOQUOTES) {
1001 1001
 		$translation = $others;
1002 1002
 		$translation_preg = $others_preg;
1003 1003
 	}
1004 1004
 
1005 1005
 	// Remove zero padding on numeric entities
1006
-	$string = preg_replace( array_keys( $translation_preg ), array_values( $translation_preg ), $string );
1006
+	$string = preg_replace(array_keys($translation_preg), array_values($translation_preg), $string);
1007 1007
 
1008 1008
 	// Replace characters according to translation table
1009
-	return strtr( $string, $translation );
1009
+	return strtr($string, $translation);
1010 1010
 }
1011 1011
 
1012 1012
 /**
@@ -1021,40 +1021,40 @@  discard block
 block discarded – undo
1021 1021
  * @param bool    $strip Optional. Whether to attempt to strip out invalid UTF8. Default is false.
1022 1022
  * @return string The checked text.
1023 1023
  */
1024
-function wp_check_invalid_utf8( $string, $strip = false ) {
1024
+function wp_check_invalid_utf8($string, $strip = false) {
1025 1025
 	$string = (string) $string;
1026 1026
 
1027
-	if ( 0 === strlen( $string ) ) {
1027
+	if (0 === strlen($string)) {
1028 1028
 		return '';
1029 1029
 	}
1030 1030
 
1031 1031
 	// Store the site charset as a static to avoid multiple calls to get_option()
1032 1032
 	static $is_utf8 = null;
1033
-	if ( ! isset( $is_utf8 ) ) {
1034
-		$is_utf8 = in_array( get_option( 'blog_charset' ), array( 'utf8', 'utf-8', 'UTF8', 'UTF-8' ) );
1033
+	if ( ! isset($is_utf8)) {
1034
+		$is_utf8 = in_array(get_option('blog_charset'), array('utf8', 'utf-8', 'UTF8', 'UTF-8'));
1035 1035
 	}
1036
-	if ( ! $is_utf8 ) {
1036
+	if ( ! $is_utf8) {
1037 1037
 		return $string;
1038 1038
 	}
1039 1039
 
1040 1040
 	// Check for support for utf8 in the installed PCRE library once and store the result in a static
1041 1041
 	static $utf8_pcre = null;
1042
-	if ( ! isset( $utf8_pcre ) ) {
1043
-		$utf8_pcre = @preg_match( '/^./u', 'a' );
1042
+	if ( ! isset($utf8_pcre)) {
1043
+		$utf8_pcre = @preg_match('/^./u', 'a');
1044 1044
 	}
1045 1045
 	// We can't demand utf8 in the PCRE installation, so just return the string in those cases
1046
-	if ( !$utf8_pcre ) {
1046
+	if ( ! $utf8_pcre) {
1047 1047
 		return $string;
1048 1048
 	}
1049 1049
 
1050 1050
 	// preg_match fails when it encounters invalid UTF8 in $string
1051
-	if ( 1 === @preg_match( '/^./us', $string ) ) {
1051
+	if (1 === @preg_match('/^./us', $string)) {
1052 1052
 		return $string;
1053 1053
 	}
1054 1054
 
1055 1055
 	// Attempt to strip the bad chars if requested (not recommended)
1056
-	if ( $strip && function_exists( 'iconv' ) ) {
1057
-		return iconv( 'utf-8', 'utf-8', $string );
1056
+	if ($strip && function_exists('iconv')) {
1057
+		return iconv('utf-8', 'utf-8', $string);
1058 1058
 	}
1059 1059
 
1060 1060
 	return '';
@@ -1069,30 +1069,30 @@  discard block
 block discarded – undo
1069 1069
  * @param int    $length Max  length of the string
1070 1070
  * @return string String with Unicode encoded for URI.
1071 1071
  */
1072
-function utf8_uri_encode( $utf8_string, $length = 0 ) {
1072
+function utf8_uri_encode($utf8_string, $length = 0) {
1073 1073
 	$unicode = '';
1074 1074
 	$values = array();
1075 1075
 	$num_octets = 1;
1076 1076
 	$unicode_length = 0;
1077 1077
 
1078 1078
 	mbstring_binary_safe_encoding();
1079
-	$string_length = strlen( $utf8_string );
1079
+	$string_length = strlen($utf8_string);
1080 1080
 	reset_mbstring_encoding();
1081 1081
 
1082
-	for ($i = 0; $i < $string_length; $i++ ) {
1082
+	for ($i = 0; $i < $string_length; $i++) {
1083 1083
 
1084
-		$value = ord( $utf8_string[ $i ] );
1084
+		$value = ord($utf8_string[$i]);
1085 1085
 
1086
-		if ( $value < 128 ) {
1087
-			if ( $length && ( $unicode_length >= $length ) )
1086
+		if ($value < 128) {
1087
+			if ($length && ($unicode_length >= $length))
1088 1088
 				break;
1089 1089
 			$unicode .= chr($value);
1090 1090
 			$unicode_length++;
1091 1091
 		} else {
1092
-			if ( count( $values ) == 0 ) {
1093
-				if ( $value < 224 ) {
1092
+			if (count($values) == 0) {
1093
+				if ($value < 224) {
1094 1094
 					$num_octets = 2;
1095
-				} elseif ( $value < 240 ) {
1095
+				} elseif ($value < 240) {
1096 1096
 					$num_octets = 3;
1097 1097
 				} else {
1098 1098
 					$num_octets = 4;
@@ -1101,11 +1101,11 @@  discard block
 block discarded – undo
1101 1101
 
1102 1102
 			$values[] = $value;
1103 1103
 
1104
-			if ( $length && ( $unicode_length + ($num_octets * 3) ) > $length )
1104
+			if ($length && ($unicode_length + ($num_octets * 3)) > $length)
1105 1105
 				break;
1106
-			if ( count( $values ) == $num_octets ) {
1107
-				for ( $j = 0; $j < $num_octets; $j++ ) {
1108
-					$unicode .= '%' . dechex( $values[ $j ] );
1106
+			if (count($values) == $num_octets) {
1107
+				for ($j = 0; $j < $num_octets; $j++) {
1108
+					$unicode .= '%'.dechex($values[$j]);
1109 1109
 				}
1110 1110
 
1111 1111
 				$unicode_length += $num_octets * 3;
@@ -1496,8 +1496,8 @@  discard block
 block discarded – undo
1496 1496
  * @param string $string Text that might have accent characters
1497 1497
  * @return string Filtered string with replaced "nice" characters.
1498 1498
  */
1499
-function remove_accents( $string ) {
1500
-	if ( !preg_match('/[\x80-\xff]/', $string) )
1499
+function remove_accents($string) {
1500
+	if ( ! preg_match('/[\x80-\xff]/', $string))
1501 1501
 		return $string;
1502 1502
 
1503 1503
 	if (seems_utf8($string)) {
@@ -1507,7 +1507,7 @@  discard block
 block discarded – undo
1507 1507
 		chr(195).chr(128) => 'A', chr(195).chr(129) => 'A',
1508 1508
 		chr(195).chr(130) => 'A', chr(195).chr(131) => 'A',
1509 1509
 		chr(195).chr(132) => 'A', chr(195).chr(133) => 'A',
1510
-		chr(195).chr(134) => 'AE',chr(195).chr(135) => 'C',
1510
+		chr(195).chr(134) => 'AE', chr(195).chr(135) => 'C',
1511 1511
 		chr(195).chr(136) => 'E', chr(195).chr(137) => 'E',
1512 1512
 		chr(195).chr(138) => 'E', chr(195).chr(139) => 'E',
1513 1513
 		chr(195).chr(140) => 'I', chr(195).chr(141) => 'I',
@@ -1518,11 +1518,11 @@  discard block
 block discarded – undo
1518 1518
 		chr(195).chr(150) => 'O', chr(195).chr(153) => 'U',
1519 1519
 		chr(195).chr(154) => 'U', chr(195).chr(155) => 'U',
1520 1520
 		chr(195).chr(156) => 'U', chr(195).chr(157) => 'Y',
1521
-		chr(195).chr(158) => 'TH',chr(195).chr(159) => 's',
1521
+		chr(195).chr(158) => 'TH', chr(195).chr(159) => 's',
1522 1522
 		chr(195).chr(160) => 'a', chr(195).chr(161) => 'a',
1523 1523
 		chr(195).chr(162) => 'a', chr(195).chr(163) => 'a',
1524 1524
 		chr(195).chr(164) => 'a', chr(195).chr(165) => 'a',
1525
-		chr(195).chr(166) => 'ae',chr(195).chr(167) => 'c',
1525
+		chr(195).chr(166) => 'ae', chr(195).chr(167) => 'c',
1526 1526
 		chr(195).chr(168) => 'e', chr(195).chr(169) => 'e',
1527 1527
 		chr(195).chr(170) => 'e', chr(195).chr(171) => 'e',
1528 1528
 		chr(195).chr(172) => 'i', chr(195).chr(173) => 'i',
@@ -1561,7 +1561,7 @@  discard block
 block discarded – undo
1561 1561
 		chr(196).chr(172) => 'I', chr(196).chr(173) => 'i',
1562 1562
 		chr(196).chr(174) => 'I', chr(196).chr(175) => 'i',
1563 1563
 		chr(196).chr(176) => 'I', chr(196).chr(177) => 'i',
1564
-		chr(196).chr(178) => 'IJ',chr(196).chr(179) => 'ij',
1564
+		chr(196).chr(178) => 'IJ', chr(196).chr(179) => 'ij',
1565 1565
 		chr(196).chr(180) => 'J', chr(196).chr(181) => 'j',
1566 1566
 		chr(196).chr(182) => 'K', chr(196).chr(183) => 'k',
1567 1567
 		chr(196).chr(184) => 'k', chr(196).chr(185) => 'L',
@@ -1577,13 +1577,13 @@  discard block
 block discarded – undo
1577 1577
 		chr(197).chr(140) => 'O', chr(197).chr(141) => 'o',
1578 1578
 		chr(197).chr(142) => 'O', chr(197).chr(143) => 'o',
1579 1579
 		chr(197).chr(144) => 'O', chr(197).chr(145) => 'o',
1580
-		chr(197).chr(146) => 'OE',chr(197).chr(147) => 'oe',
1581
-		chr(197).chr(148) => 'R',chr(197).chr(149) => 'r',
1582
-		chr(197).chr(150) => 'R',chr(197).chr(151) => 'r',
1583
-		chr(197).chr(152) => 'R',chr(197).chr(153) => 'r',
1584
-		chr(197).chr(154) => 'S',chr(197).chr(155) => 's',
1585
-		chr(197).chr(156) => 'S',chr(197).chr(157) => 's',
1586
-		chr(197).chr(158) => 'S',chr(197).chr(159) => 's',
1580
+		chr(197).chr(146) => 'OE', chr(197).chr(147) => 'oe',
1581
+		chr(197).chr(148) => 'R', chr(197).chr(149) => 'r',
1582
+		chr(197).chr(150) => 'R', chr(197).chr(151) => 'r',
1583
+		chr(197).chr(152) => 'R', chr(197).chr(153) => 'r',
1584
+		chr(197).chr(154) => 'S', chr(197).chr(155) => 's',
1585
+		chr(197).chr(156) => 'S', chr(197).chr(157) => 's',
1586
+		chr(197).chr(158) => 'S', chr(197).chr(159) => 's',
1587 1587
 		chr(197).chr(160) => 'S', chr(197).chr(161) => 's',
1588 1588
 		chr(197).chr(162) => 'T', chr(197).chr(163) => 't',
1589 1589
 		chr(197).chr(164) => 'T', chr(197).chr(165) => 't',
@@ -1680,23 +1680,23 @@  discard block
 block discarded – undo
1680 1680
 		// Used for locale-specific rules
1681 1681
 		$locale = get_locale();
1682 1682
 
1683
-		if ( 'de_DE' == $locale || 'de_DE_formal' == $locale || 'de_CH' == $locale || 'de_CH_informal' == $locale ) {
1684
-			$chars[ chr(195).chr(132) ] = 'Ae';
1685
-			$chars[ chr(195).chr(164) ] = 'ae';
1686
-			$chars[ chr(195).chr(150) ] = 'Oe';
1687
-			$chars[ chr(195).chr(182) ] = 'oe';
1688
-			$chars[ chr(195).chr(156) ] = 'Ue';
1689
-			$chars[ chr(195).chr(188) ] = 'ue';
1690
-			$chars[ chr(195).chr(159) ] = 'ss';
1691
-		} elseif ( 'da_DK' === $locale ) {
1692
-			$chars[ chr(195).chr(134) ] = 'Ae';
1693
- 			$chars[ chr(195).chr(166) ] = 'ae';
1694
-			$chars[ chr(195).chr(152) ] = 'Oe';
1695
-			$chars[ chr(195).chr(184) ] = 'oe';
1696
-			$chars[ chr(195).chr(133) ] = 'Aa';
1697
-			$chars[ chr(195).chr(165) ] = 'aa';
1698
-		} elseif ( 'ca' === $locale ) {
1699
-			$chars[ chr(108).chr(194).chr(183).chr(108) ] = 'll';
1683
+		if ('de_DE' == $locale || 'de_DE_formal' == $locale || 'de_CH' == $locale || 'de_CH_informal' == $locale) {
1684
+			$chars[chr(195).chr(132)] = 'Ae';
1685
+			$chars[chr(195).chr(164)] = 'ae';
1686
+			$chars[chr(195).chr(150)] = 'Oe';
1687
+			$chars[chr(195).chr(182)] = 'oe';
1688
+			$chars[chr(195).chr(156)] = 'Ue';
1689
+			$chars[chr(195).chr(188)] = 'ue';
1690
+			$chars[chr(195).chr(159)] = 'ss';
1691
+		} elseif ('da_DK' === $locale) {
1692
+			$chars[chr(195).chr(134)] = 'Ae';
1693
+ 			$chars[chr(195).chr(166)] = 'ae';
1694
+			$chars[chr(195).chr(152)] = 'Oe';
1695
+			$chars[chr(195).chr(184)] = 'oe';
1696
+			$chars[chr(195).chr(133)] = 'Aa';
1697
+			$chars[chr(195).chr(165)] = 'aa';
1698
+		} elseif ('ca' === $locale) {
1699
+			$chars[chr(108).chr(194).chr(183).chr(108)] = 'll';
1700 1700
 		}
1701 1701
 
1702 1702
 		$string = strtr($string, $chars);
@@ -1741,7 +1741,7 @@  discard block
 block discarded – undo
1741 1741
  * @param string $filename The filename to be sanitized
1742 1742
  * @return string The sanitized filename
1743 1743
  */
1744
-function sanitize_file_name( $filename ) {
1744
+function sanitize_file_name($filename) {
1745 1745
 	$filename_raw = $filename;
1746 1746
 	$special_chars = array("?", "[", "]", "/", "\\", "=", "<", ">", ":", ";", ",", "'", "\"", "&", "$", "#", "*", "(", ")", "|", "~", "`", "!", "{", "}", "%", "+", chr(0));
1747 1747
 	/**
@@ -1752,18 +1752,18 @@  discard block
 block discarded – undo
1752 1752
 	 * @param array  $special_chars Characters to remove.
1753 1753
 	 * @param string $filename_raw  Filename as it was passed into sanitize_file_name().
1754 1754
 	 */
1755
-	$special_chars = apply_filters( 'sanitize_file_name_chars', $special_chars, $filename_raw );
1756
-	$filename = preg_replace( "#\x{00a0}#siu", ' ', $filename );
1757
-	$filename = str_replace( $special_chars, '', $filename );
1758
-	$filename = str_replace( array( '%20', '+' ), '-', $filename );
1759
-	$filename = preg_replace( '/[\r\n\t -]+/', '-', $filename );
1760
-	$filename = trim( $filename, '.-_' );
1761
-
1762
-	if ( false === strpos( $filename, '.' ) ) {
1755
+	$special_chars = apply_filters('sanitize_file_name_chars', $special_chars, $filename_raw);
1756
+	$filename = preg_replace("#\x{00a0}#siu", ' ', $filename);
1757
+	$filename = str_replace($special_chars, '', $filename);
1758
+	$filename = str_replace(array('%20', '+'), '-', $filename);
1759
+	$filename = preg_replace('/[\r\n\t -]+/', '-', $filename);
1760
+	$filename = trim($filename, '.-_');
1761
+
1762
+	if (false === strpos($filename, '.')) {
1763 1763
 		$mime_types = wp_get_mime_types();
1764
-		$filetype = wp_check_filetype( 'test.' . $filename, $mime_types );
1765
-		if ( $filetype['ext'] === $filename ) {
1766
-			$filename = 'unnamed-file.' . $filetype['ext'];
1764
+		$filetype = wp_check_filetype('test.'.$filename, $mime_types);
1765
+		if ($filetype['ext'] === $filename) {
1766
+			$filename = 'unnamed-file.'.$filetype['ext'];
1767 1767
 		}
1768 1768
 	}
1769 1769
 
@@ -1771,7 +1771,7 @@  discard block
 block discarded – undo
1771 1771
 	$parts = explode('.', $filename);
1772 1772
 
1773 1773
 	// Return if only one extension
1774
-	if ( count( $parts ) <= 2 ) {
1774
+	if (count($parts) <= 2) {
1775 1775
 		/**
1776 1776
 		 * Filters a sanitized filename string.
1777 1777
 		 *
@@ -1780,7 +1780,7 @@  discard block
 block discarded – undo
1780 1780
 		 * @param string $filename     Sanitized filename.
1781 1781
 		 * @param string $filename_raw The filename prior to sanitization.
1782 1782
 		 */
1783
-		return apply_filters( 'sanitize_file_name', $filename, $filename_raw );
1783
+		return apply_filters('sanitize_file_name', $filename, $filename_raw);
1784 1784
 	}
1785 1785
 
1786 1786
 	// Process multiple extensions
@@ -1792,23 +1792,23 @@  discard block
 block discarded – undo
1792 1792
 	 * Loop over any intermediate extensions. Postfix them with a trailing underscore
1793 1793
 	 * if they are a 2 - 5 character long alpha string not in the extension whitelist.
1794 1794
 	 */
1795
-	foreach ( (array) $parts as $part) {
1796
-		$filename .= '.' . $part;
1795
+	foreach ((array) $parts as $part) {
1796
+		$filename .= '.'.$part;
1797 1797
 
1798
-		if ( preg_match("/^[a-zA-Z]{2,5}\d?$/", $part) ) {
1798
+		if (preg_match("/^[a-zA-Z]{2,5}\d?$/", $part)) {
1799 1799
 			$allowed = false;
1800
-			foreach ( $mimes as $ext_preg => $mime_match ) {
1801
-				$ext_preg = '!^(' . $ext_preg . ')$!i';
1802
-				if ( preg_match( $ext_preg, $part ) ) {
1800
+			foreach ($mimes as $ext_preg => $mime_match) {
1801
+				$ext_preg = '!^('.$ext_preg.')$!i';
1802
+				if (preg_match($ext_preg, $part)) {
1803 1803
 					$allowed = true;
1804 1804
 					break;
1805 1805
 				}
1806 1806
 			}
1807
-			if ( !$allowed )
1807
+			if ( ! $allowed)
1808 1808
 				$filename .= '_';
1809 1809
 		}
1810 1810
 	}
1811
-	$filename .= '.' . $extension;
1811
+	$filename .= '.'.$extension;
1812 1812
 	/** This filter is documented in wp-includes/formatting.php */
1813 1813
 	return apply_filters('sanitize_file_name', $filename, $filename_raw);
1814 1814
 }
@@ -1827,21 +1827,21 @@  discard block
 block discarded – undo
1827 1827
  * @param bool   $strict   If set limits $username to specific characters. Default false.
1828 1828
  * @return string The sanitized username, after passing through filters.
1829 1829
  */
1830
-function sanitize_user( $username, $strict = false ) {
1830
+function sanitize_user($username, $strict = false) {
1831 1831
 	$raw_username = $username;
1832
-	$username = wp_strip_all_tags( $username );
1833
-	$username = remove_accents( $username );
1832
+	$username = wp_strip_all_tags($username);
1833
+	$username = remove_accents($username);
1834 1834
 	// Kill octets
1835
-	$username = preg_replace( '|%([a-fA-F0-9][a-fA-F0-9])|', '', $username );
1836
-	$username = preg_replace( '/&.+?;/', '', $username ); // Kill entities
1835
+	$username = preg_replace('|%([a-fA-F0-9][a-fA-F0-9])|', '', $username);
1836
+	$username = preg_replace('/&.+?;/', '', $username); // Kill entities
1837 1837
 
1838 1838
 	// If strict, reduce to ASCII for max portability.
1839
-	if ( $strict )
1840
-		$username = preg_replace( '|[^a-z0-9 _.\-@]|i', '', $username );
1839
+	if ($strict)
1840
+		$username = preg_replace('|[^a-z0-9 _.\-@]|i', '', $username);
1841 1841
 
1842
-	$username = trim( $username );
1842
+	$username = trim($username);
1843 1843
 	// Consolidate contiguous whitespace
1844
-	$username = preg_replace( '|\s+|', ' ', $username );
1844
+	$username = preg_replace('|\s+|', ' ', $username);
1845 1845
 
1846 1846
 	/**
1847 1847
 	 * Filters a sanitized username string.
@@ -1852,7 +1852,7 @@  discard block
 block discarded – undo
1852 1852
 	 * @param string $raw_username The username prior to sanitization.
1853 1853
 	 * @param bool   $strict       Whether to limit the sanitization to specific characters. Default false.
1854 1854
 	 */
1855
-	return apply_filters( 'sanitize_user', $username, $raw_username, $strict );
1855
+	return apply_filters('sanitize_user', $username, $raw_username, $strict);
1856 1856
 }
1857 1857
 
1858 1858
 /**
@@ -1865,10 +1865,10 @@  discard block
 block discarded – undo
1865 1865
  * @param string $key String key
1866 1866
  * @return string Sanitized key
1867 1867
  */
1868
-function sanitize_key( $key ) {
1868
+function sanitize_key($key) {
1869 1869
 	$raw_key = $key;
1870
-	$key = strtolower( $key );
1871
-	$key = preg_replace( '/[^a-z0-9_\-]/', '', $key );
1870
+	$key = strtolower($key);
1871
+	$key = preg_replace('/[^a-z0-9_\-]/', '', $key);
1872 1872
 
1873 1873
 	/**
1874 1874
 	 * Filters a sanitized key string.
@@ -1878,7 +1878,7 @@  discard block
 block discarded – undo
1878 1878
 	 * @param string $key     Sanitized key.
1879 1879
 	 * @param string $raw_key The key prior to sanitization.
1880 1880
 	 */
1881
-	return apply_filters( 'sanitize_key', $key, $raw_key );
1881
+	return apply_filters('sanitize_key', $key, $raw_key);
1882 1882
 }
1883 1883
 
1884 1884
 /**
@@ -1895,10 +1895,10 @@  discard block
 block discarded – undo
1895 1895
  * @param string $context        Optional. The operation for which the string is sanitized
1896 1896
  * @return string The sanitized string.
1897 1897
  */
1898
-function sanitize_title( $title, $fallback_title = '', $context = 'save' ) {
1898
+function sanitize_title($title, $fallback_title = '', $context = 'save') {
1899 1899
 	$raw_title = $title;
1900 1900
 
1901
-	if ( 'save' == $context )
1901
+	if ('save' == $context)
1902 1902
 		$title = remove_accents($title);
1903 1903
 
1904 1904
 	/**
@@ -1910,9 +1910,9 @@  discard block
 block discarded – undo
1910 1910
 	 * @param string $raw_title The title prior to sanitization.
1911 1911
 	 * @param string $context   The context for which the title is being sanitized.
1912 1912
 	 */
1913
-	$title = apply_filters( 'sanitize_title', $title, $raw_title, $context );
1913
+	$title = apply_filters('sanitize_title', $title, $raw_title, $context);
1914 1914
 
1915
-	if ( '' === $title || false === $title )
1915
+	if ('' === $title || false === $title)
1916 1916
 		$title = $fallback_title;
1917 1917
 
1918 1918
 	return $title;
@@ -1928,8 +1928,8 @@  discard block
 block discarded – undo
1928 1928
  * @param string $title The string to be sanitized.
1929 1929
  * @return string The sanitized string.
1930 1930
  */
1931
-function sanitize_title_for_query( $title ) {
1932
-	return sanitize_title( $title, '', 'query' );
1931
+function sanitize_title_for_query($title) {
1932
+	return sanitize_title($title, '', 'query');
1933 1933
 }
1934 1934
 
1935 1935
 /**
@@ -1945,7 +1945,7 @@  discard block
 block discarded – undo
1945 1945
  * @param string $context   Optional. The operation for which the string is sanitized.
1946 1946
  * @return string The sanitized title.
1947 1947
  */
1948
-function sanitize_title_with_dashes( $title, $raw_title = '', $context = 'display' ) {
1948
+function sanitize_title_with_dashes($title, $raw_title = '', $context = 'display') {
1949 1949
 	$title = strip_tags($title);
1950 1950
 	// Preserve escaped octets.
1951 1951
 	$title = preg_replace('|%([a-fA-F0-9][a-fA-F0-9])|', '---$1---', $title);
@@ -1963,14 +1963,14 @@  discard block
 block discarded – undo
1963 1963
 
1964 1964
 	$title = strtolower($title);
1965 1965
 
1966
-	if ( 'save' == $context ) {
1966
+	if ('save' == $context) {
1967 1967
 		// Convert nbsp, ndash and mdash to hyphens
1968
-		$title = str_replace( array( '%c2%a0', '%e2%80%93', '%e2%80%94' ), '-', $title );
1968
+		$title = str_replace(array('%c2%a0', '%e2%80%93', '%e2%80%94'), '-', $title);
1969 1969
 		// Convert nbsp, ndash and mdash HTML entities to hyphens
1970
-		$title = str_replace( array( '&nbsp;', '&#160;', '&ndash;', '&#8211;', '&mdash;', '&#8212;' ), '-', $title );
1970
+		$title = str_replace(array('&nbsp;', '&#160;', '&ndash;', '&#8211;', '&mdash;', '&#8212;'), '-', $title);
1971 1971
 
1972 1972
 		// Strip these characters entirely
1973
-		$title = str_replace( array(
1973
+		$title = str_replace(array(
1974 1974
 			// iexcl and iquest
1975 1975
 			'%c2%a1', '%c2%bf',
1976 1976
 			// angle quotes
@@ -1984,10 +1984,10 @@  discard block
 block discarded – undo
1984 1984
 			'%c2%b4', '%cb%8a', '%cc%81', '%cd%81',
1985 1985
 			// grave accent, macron, caron
1986 1986
 			'%cc%80', '%cc%84', '%cc%8c',
1987
-		), '', $title );
1987
+		), '', $title);
1988 1988
 
1989 1989
 		// Convert times to x
1990
-		$title = str_replace( '%c3%97', 'x', $title );
1990
+		$title = str_replace('%c3%97', 'x', $title);
1991 1991
 	}
1992 1992
 
1993 1993
 	$title = preg_replace('/&.+?;/', '', $title); // kill entities
@@ -2014,8 +2014,8 @@  discard block
 block discarded – undo
2014 2014
  * @param string $orderby Order by clause to be validated.
2015 2015
  * @return string|false Returns $orderby if valid, false otherwise.
2016 2016
  */
2017
-function sanitize_sql_orderby( $orderby ) {
2018
-	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 ) ) {
2017
+function sanitize_sql_orderby($orderby) {
2018
+	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)) {
2019 2019
 		return $orderby;
2020 2020
 	}
2021 2021
 	return false;
@@ -2036,15 +2036,15 @@  discard block
 block discarded – undo
2036 2036
  * 	Defaults to an empty string.
2037 2037
  * @return string The sanitized value
2038 2038
  */
2039
-function sanitize_html_class( $class, $fallback = '' ) {
2039
+function sanitize_html_class($class, $fallback = '') {
2040 2040
 	//Strip out any % encoded octets
2041
-	$sanitized = preg_replace( '|%[a-fA-F0-9][a-fA-F0-9]|', '', $class );
2041
+	$sanitized = preg_replace('|%[a-fA-F0-9][a-fA-F0-9]|', '', $class);
2042 2042
 
2043 2043
 	//Limit to A-Z,a-z,0-9,_,-
2044
-	$sanitized = preg_replace( '/[^A-Za-z0-9_-]/', '', $sanitized );
2044
+	$sanitized = preg_replace('/[^A-Za-z0-9_-]/', '', $sanitized);
2045 2045
 
2046
-	if ( '' == $sanitized && $fallback ) {
2047
-		return sanitize_html_class( $fallback );
2046
+	if ('' == $sanitized && $fallback) {
2047
+		return sanitize_html_class($fallback);
2048 2048
 	}
2049 2049
 	/**
2050 2050
 	 * Filters a sanitized HTML class string.
@@ -2055,7 +2055,7 @@  discard block
 block discarded – undo
2055 2055
 	 * @param string $class     HTML class before sanitization.
2056 2056
 	 * @param string $fallback  The fallback string.
2057 2057
 	 */
2058
-	return apply_filters( 'sanitize_html_class', $sanitized, $class, $fallback );
2058
+	return apply_filters('sanitize_html_class', $sanitized, $class, $fallback);
2059 2059
 }
2060 2060
 
2061 2061
 /**
@@ -2067,13 +2067,13 @@  discard block
 block discarded – undo
2067 2067
  * @param string $deprecated Not used.
2068 2068
  * @return string Converted string.
2069 2069
  */
2070
-function convert_chars( $content, $deprecated = '' ) {
2071
-	if ( ! empty( $deprecated ) ) {
2072
-		_deprecated_argument( __FUNCTION__, '0.71' );
2070
+function convert_chars($content, $deprecated = '') {
2071
+	if ( ! empty($deprecated)) {
2072
+		_deprecated_argument(__FUNCTION__, '0.71');
2073 2073
 	}
2074 2074
 
2075
-	if ( strpos( $content, '&' ) !== false ) {
2076
-		$content = preg_replace( '/&([^#])(?![a-z1-4]{1,8};)/i', '&#038;$1', $content );
2075
+	if (strpos($content, '&') !== false) {
2076
+		$content = preg_replace('/&([^#])(?![a-z1-4]{1,8};)/i', '&#038;$1', $content);
2077 2077
 	}
2078 2078
 
2079 2079
 	return $content;
@@ -2087,12 +2087,12 @@  discard block
 block discarded – undo
2087 2087
  * @param string $content String with entities that need converting.
2088 2088
  * @return string Converted string.
2089 2089
  */
2090
-function convert_invalid_entities( $content ) {
2090
+function convert_invalid_entities($content) {
2091 2091
 	$wp_htmltranswinuni = array(
2092 2092
 		'&#128;' => '&#8364;', // the Euro sign
2093 2093
 		'&#129;' => '',
2094 2094
 		'&#130;' => '&#8218;', // these are Windows CP1252 specific characters
2095
-		'&#131;' => '&#402;',  // they would look weird on non-Windows browsers
2095
+		'&#131;' => '&#402;', // they would look weird on non-Windows browsers
2096 2096
 		'&#132;' => '&#8222;',
2097 2097
 		'&#133;' => '&#8230;',
2098 2098
 		'&#134;' => '&#8224;',
@@ -2123,8 +2123,8 @@  discard block
 block discarded – undo
2123 2123
 		'&#159;' => '&#376;'
2124 2124
 	);
2125 2125
 
2126
-	if ( strpos( $content, '&#1' ) !== false ) {
2127
-		$content = strtr( $content, $wp_htmltranswinuni );
2126
+	if (strpos($content, '&#1') !== false) {
2127
+		$content = strtr($content, $wp_htmltranswinuni);
2128 2128
 	}
2129 2129
 
2130 2130
 	return $content;
@@ -2139,9 +2139,9 @@  discard block
 block discarded – undo
2139 2139
  * @param bool   $force If true, forces balancing, ignoring the value of the option. Default false.
2140 2140
  * @return string Balanced text
2141 2141
  */
2142
-function balanceTags( $text, $force = false ) {
2143
-	if ( $force || get_option('use_balanceTags') == 1 ) {
2144
-		return force_balance_tags( $text );
2142
+function balanceTags($text, $force = false) {
2143
+	if ($force || get_option('use_balanceTags') == 1) {
2144
+		return force_balance_tags($text);
2145 2145
 	} else {
2146 2146
 		return $text;
2147 2147
 	}
@@ -2165,22 +2165,22 @@  discard block
 block discarded – undo
2165 2165
  * @param string $text Text to be balanced.
2166 2166
  * @return string Balanced text.
2167 2167
  */
2168
-function force_balance_tags( $text ) {
2168
+function force_balance_tags($text) {
2169 2169
 	$tagstack = array();
2170 2170
 	$stacksize = 0;
2171 2171
 	$tagqueue = '';
2172 2172
 	$newtext = '';
2173 2173
 	// Known single-entity/self-closing tags
2174
-	$single_tags = array( 'area', 'base', 'basefont', 'br', 'col', 'command', 'embed', 'frame', 'hr', 'img', 'input', 'isindex', 'link', 'meta', 'param', 'source' );
2174
+	$single_tags = array('area', 'base', 'basefont', 'br', 'col', 'command', 'embed', 'frame', 'hr', 'img', 'input', 'isindex', 'link', 'meta', 'param', 'source');
2175 2175
 	// Tags that can be immediately nested within themselves
2176
-	$nestable_tags = array( 'blockquote', 'div', 'object', 'q', 'span' );
2176
+	$nestable_tags = array('blockquote', 'div', 'object', 'q', 'span');
2177 2177
 
2178 2178
 	// WP bug fix for comments - in case you REALLY meant to type '< !--'
2179 2179
 	$text = str_replace('< !--', '<    !--', $text);
2180 2180
 	// WP bug fix for LOVE <3 (and other situations with '<' before a number)
2181 2181
 	$text = preg_replace('#<([0-9]{1})#', '&lt;$1', $text);
2182 2182
 
2183
-	while ( preg_match("/<(\/?[\w:]*)\s*([^>]*)>/", $text, $regex) ) {
2183
+	while (preg_match("/<(\/?[\w:]*)\s*([^>]*)>/", $text, $regex)) {
2184 2184
 		$newtext .= $tagqueue;
2185 2185
 
2186 2186
 		$i = strpos($text, $regex[0]);
@@ -2189,25 +2189,25 @@  discard block
 block discarded – undo
2189 2189
 		// clear the shifter
2190 2190
 		$tagqueue = '';
2191 2191
 		// Pop or Push
2192
-		if ( isset($regex[1][0]) && '/' == $regex[1][0] ) { // End Tag
2193
-			$tag = strtolower(substr($regex[1],1));
2192
+		if (isset($regex[1][0]) && '/' == $regex[1][0]) { // End Tag
2193
+			$tag = strtolower(substr($regex[1], 1));
2194 2194
 			// if too many closing tags
2195
-			if ( $stacksize <= 0 ) {
2195
+			if ($stacksize <= 0) {
2196 2196
 				$tag = '';
2197 2197
 				// or close to be safe $tag = '/' . $tag;
2198 2198
 			}
2199 2199
 			// if stacktop value = tag close value then pop
2200
-			elseif ( $tagstack[$stacksize - 1] == $tag ) { // found closing tag
2201
-				$tag = '</' . $tag . '>'; // Close Tag
2200
+			elseif ($tagstack[$stacksize - 1] == $tag) { // found closing tag
2201
+				$tag = '</'.$tag.'>'; // Close Tag
2202 2202
 				// Pop
2203
-				array_pop( $tagstack );
2203
+				array_pop($tagstack);
2204 2204
 				$stacksize--;
2205 2205
 			} else { // closing tag not at top, search for it
2206
-				for ( $j = $stacksize-1; $j >= 0; $j-- ) {
2207
-					if ( $tagstack[$j] == $tag ) {
2206
+				for ($j = $stacksize - 1; $j >= 0; $j--) {
2207
+					if ($tagstack[$j] == $tag) {
2208 2208
 					// add tag to tagqueue
2209
-						for ( $k = $stacksize-1; $k >= $j; $k--) {
2210
-							$tagqueue .= '</' . array_pop( $tagstack ) . '>';
2209
+						for ($k = $stacksize - 1; $k >= $j; $k--) {
2210
+							$tagqueue .= '</'.array_pop($tagstack).'>';
2211 2211
 							$stacksize--;
2212 2212
 						}
2213 2213
 						break;
@@ -2221,43 +2221,43 @@  discard block
 block discarded – undo
2221 2221
 			// Tag Cleaning
2222 2222
 
2223 2223
 			// If it's an empty tag "< >", do nothing
2224
-			if ( '' == $tag ) {
2224
+			if ('' == $tag) {
2225 2225
 				// do nothing
2226 2226
 			}
2227 2227
 			// ElseIf it presents itself as a self-closing tag...
2228
-			elseif ( substr( $regex[2], -1 ) == '/' ) {
2228
+			elseif (substr($regex[2], -1) == '/') {
2229 2229
 				// ...but it isn't a known single-entity self-closing tag, then don't let it be treated as such and
2230 2230
 				// immediately close it with a closing tag (the tag will encapsulate no text as a result)
2231
-				if ( ! in_array( $tag, $single_tags ) )
2232
-					$regex[2] = trim( substr( $regex[2], 0, -1 ) ) . "></$tag";
2231
+				if ( ! in_array($tag, $single_tags))
2232
+					$regex[2] = trim(substr($regex[2], 0, -1))."></$tag";
2233 2233
 			}
2234 2234
 			// ElseIf it's a known single-entity tag but it doesn't close itself, do so
2235
-			elseif ( in_array($tag, $single_tags) ) {
2235
+			elseif (in_array($tag, $single_tags)) {
2236 2236
 				$regex[2] .= '/';
2237 2237
 			}
2238 2238
 			// Else it's not a single-entity tag
2239 2239
 			else {
2240 2240
 				// If the top of the stack is the same as the tag we want to push, close previous tag
2241
-				if ( $stacksize > 0 && !in_array($tag, $nestable_tags) && $tagstack[$stacksize - 1] == $tag ) {
2242
-					$tagqueue = '</' . array_pop( $tagstack ) . '>';
2241
+				if ($stacksize > 0 && ! in_array($tag, $nestable_tags) && $tagstack[$stacksize - 1] == $tag) {
2242
+					$tagqueue = '</'.array_pop($tagstack).'>';
2243 2243
 					$stacksize--;
2244 2244
 				}
2245
-				$stacksize = array_push( $tagstack, $tag );
2245
+				$stacksize = array_push($tagstack, $tag);
2246 2246
 			}
2247 2247
 
2248 2248
 			// Attributes
2249 2249
 			$attributes = $regex[2];
2250
-			if ( ! empty( $attributes ) && $attributes[0] != '>' )
2251
-				$attributes = ' ' . $attributes;
2250
+			if ( ! empty($attributes) && $attributes[0] != '>')
2251
+				$attributes = ' '.$attributes;
2252 2252
 
2253
-			$tag = '<' . $tag . $attributes . '>';
2253
+			$tag = '<'.$tag.$attributes.'>';
2254 2254
 			//If already queuing a close tag, then put this tag on, too
2255
-			if ( !empty($tagqueue) ) {
2255
+			if ( ! empty($tagqueue)) {
2256 2256
 				$tagqueue .= $tag;
2257 2257
 				$tag = '';
2258 2258
 			}
2259 2259
 		}
2260
-		$newtext .= substr($text, 0, $i) . $tag;
2260
+		$newtext .= substr($text, 0, $i).$tag;
2261 2261
 		$text = substr($text, $i + $l);
2262 2262
 	}
2263 2263
 
@@ -2268,12 +2268,12 @@  discard block
 block discarded – undo
2268 2268
 	$newtext .= $text;
2269 2269
 
2270 2270
 	// Empty Stack
2271
-	while( $x = array_pop($tagstack) )
2272
-		$newtext .= '</' . $x . '>'; // Add remaining tags to close
2271
+	while ($x = array_pop($tagstack))
2272
+		$newtext .= '</'.$x.'>'; // Add remaining tags to close
2273 2273
 
2274 2274
 	// WP fix for the bug with HTML comments
2275
-	$newtext = str_replace("< !--","<!--",$newtext);
2276
-	$newtext = str_replace("<    !--","< !--",$newtext);
2275
+	$newtext = str_replace("< !--", "<!--", $newtext);
2276
+	$newtext = str_replace("<    !--", "< !--", $newtext);
2277 2277
 
2278 2278
 	return $newtext;
2279 2279
 }
@@ -2294,7 +2294,7 @@  discard block
 block discarded – undo
2294 2294
  *                          Default false.
2295 2295
  * @return string The text after the filter (and possibly htmlspecialchars()) has been run.
2296 2296
  */
2297
-function format_to_edit( $content, $rich_text = false ) {
2297
+function format_to_edit($content, $rich_text = false) {
2298 2298
 	/**
2299 2299
 	 * Filters the text to be formatted for editing.
2300 2300
 	 *
@@ -2302,9 +2302,9 @@  discard block
 block discarded – undo
2302 2302
 	 *
2303 2303
 	 * @param string $content The text, prior to formatting for editing.
2304 2304
 	 */
2305
-	$content = apply_filters( 'format_to_edit', $content );
2306
-	if ( ! $rich_text )
2307
-		$content = esc_textarea( $content );
2305
+	$content = apply_filters('format_to_edit', $content);
2306
+	if ( ! $rich_text)
2307
+		$content = esc_textarea($content);
2308 2308
 	return $content;
2309 2309
 }
2310 2310
 
@@ -2325,8 +2325,8 @@  discard block
 block discarded – undo
2325 2325
  * @param int $threshold  Digit places number needs to be to not have zeros added.
2326 2326
  * @return string Adds leading zeros to number if needed.
2327 2327
  */
2328
-function zeroise( $number, $threshold ) {
2329
-	return sprintf( '%0' . $threshold . 's', $number );
2328
+function zeroise($number, $threshold) {
2329
+	return sprintf('%0'.$threshold.'s', $number);
2330 2330
 }
2331 2331
 
2332 2332
 /**
@@ -2337,10 +2337,10 @@  discard block
 block discarded – undo
2337 2337
  * @param string $string Value to which backslashes will be added.
2338 2338
  * @return string String with backslashes inserted.
2339 2339
  */
2340
-function backslashit( $string ) {
2341
-	if ( isset( $string[0] ) && $string[0] >= '0' && $string[0] <= '9' )
2342
-		$string = '\\\\' . $string;
2343
-	return addcslashes( $string, 'A..Za..z' );
2340
+function backslashit($string) {
2341
+	if (isset($string[0]) && $string[0] >= '0' && $string[0] <= '9')
2342
+		$string = '\\\\'.$string;
2343
+	return addcslashes($string, 'A..Za..z');
2344 2344
 }
2345 2345
 
2346 2346
 /**
@@ -2357,8 +2357,8 @@  discard block
 block discarded – undo
2357 2357
  * @param string $string What to add the trailing slash to.
2358 2358
  * @return string String with trailing slash added.
2359 2359
  */
2360
-function trailingslashit( $string ) {
2361
-	return untrailingslashit( $string ) . '/';
2360
+function trailingslashit($string) {
2361
+	return untrailingslashit($string).'/';
2362 2362
 }
2363 2363
 
2364 2364
 /**
@@ -2372,8 +2372,8 @@  discard block
 block discarded – undo
2372 2372
  * @param string $string What to remove the trailing slashes from.
2373 2373
  * @return string String without the trailing slashes.
2374 2374
  */
2375
-function untrailingslashit( $string ) {
2376
-	return rtrim( $string, '/\\' );
2375
+function untrailingslashit($string) {
2376
+	return rtrim($string, '/\\');
2377 2377
 }
2378 2378
 
2379 2379
 /**
@@ -2388,7 +2388,7 @@  discard block
 block discarded – undo
2388 2388
  * @return string Returns a string escaped with slashes.
2389 2389
  */
2390 2390
 function addslashes_gpc($gpc) {
2391
-	if ( get_magic_quotes_gpc() )
2391
+	if (get_magic_quotes_gpc())
2392 2392
 		$gpc = stripslashes($gpc);
2393 2393
 
2394 2394
 	return wp_slash($gpc);
@@ -2402,8 +2402,8 @@  discard block
 block discarded – undo
2402 2402
  * @param mixed $value The value to be stripped.
2403 2403
  * @return mixed Stripped value.
2404 2404
  */
2405
-function stripslashes_deep( $value ) {
2406
-	return map_deep( $value, 'stripslashes_from_strings_only' );
2405
+function stripslashes_deep($value) {
2406
+	return map_deep($value, 'stripslashes_from_strings_only');
2407 2407
 }
2408 2408
 
2409 2409
 /**
@@ -2414,8 +2414,8 @@  discard block
 block discarded – undo
2414 2414
  * @param mixed $value The array or string to be stripped.
2415 2415
  * @return mixed $value The stripped value.
2416 2416
  */
2417
-function stripslashes_from_strings_only( $value ) {
2418
-	return is_string( $value ) ? stripslashes( $value ) : $value;
2417
+function stripslashes_from_strings_only($value) {
2418
+	return is_string($value) ? stripslashes($value) : $value;
2419 2419
 }
2420 2420
 
2421 2421
 /**
@@ -2426,8 +2426,8 @@  discard block
 block discarded – undo
2426 2426
  * @param mixed $value The array or string to be encoded.
2427 2427
  * @return mixed $value The encoded value.
2428 2428
  */
2429
-function urlencode_deep( $value ) {
2430
-	return map_deep( $value, 'urlencode' );
2429
+function urlencode_deep($value) {
2430
+	return map_deep($value, 'urlencode');
2431 2431
 }
2432 2432
 
2433 2433
 /**
@@ -2438,8 +2438,8 @@  discard block
 block discarded – undo
2438 2438
  * @param mixed $value The array or string to be encoded.
2439 2439
  * @return mixed $value The encoded value.
2440 2440
  */
2441
-function rawurlencode_deep( $value ) {
2442
-	return map_deep( $value, 'rawurlencode' );
2441
+function rawurlencode_deep($value) {
2442
+	return map_deep($value, 'rawurlencode');
2443 2443
 }
2444 2444
 
2445 2445
 /**
@@ -2450,8 +2450,8 @@  discard block
 block discarded – undo
2450 2450
  * @param mixed $value The array or string to be decoded.
2451 2451
  * @return mixed $value The decoded value.
2452 2452
  */
2453
-function urldecode_deep( $value ) {
2454
-	return map_deep( $value, 'urldecode' );
2453
+function urldecode_deep($value) {
2454
+	return map_deep($value, 'urldecode');
2455 2455
 }
2456 2456
 
2457 2457
 /**
@@ -2463,20 +2463,20 @@  discard block
 block discarded – undo
2463 2463
  * @param int    $hex_encoding  Optional. Set to 1 to enable hex encoding.
2464 2464
  * @return string Converted email address.
2465 2465
  */
2466
-function antispambot( $email_address, $hex_encoding = 0 ) {
2466
+function antispambot($email_address, $hex_encoding = 0) {
2467 2467
 	$email_no_spam_address = '';
2468
-	for ( $i = 0, $len = strlen( $email_address ); $i < $len; $i++ ) {
2469
-		$j = rand( 0, 1 + $hex_encoding );
2470
-		if ( $j == 0 ) {
2471
-			$email_no_spam_address .= '&#' . ord( $email_address[$i] ) . ';';
2472
-		} elseif ( $j == 1 ) {
2468
+	for ($i = 0, $len = strlen($email_address); $i < $len; $i++) {
2469
+		$j = rand(0, 1 + $hex_encoding);
2470
+		if ($j == 0) {
2471
+			$email_no_spam_address .= '&#'.ord($email_address[$i]).';';
2472
+		} elseif ($j == 1) {
2473 2473
 			$email_no_spam_address .= $email_address[$i];
2474
-		} elseif ( $j == 2 ) {
2475
-			$email_no_spam_address .= '%' . zeroise( dechex( ord( $email_address[$i] ) ), 2 );
2474
+		} elseif ($j == 2) {
2475
+			$email_no_spam_address .= '%'.zeroise(dechex(ord($email_address[$i])), 2);
2476 2476
 		}
2477 2477
 	}
2478 2478
 
2479
-	return str_replace( '@', '&#64;', $email_no_spam_address );
2479
+	return str_replace('@', '&#64;', $email_no_spam_address);
2480 2480
 }
2481 2481
 
2482 2482
 /**
@@ -2490,10 +2490,10 @@  discard block
 block discarded – undo
2490 2490
  * @param array $matches Single Regex Match.
2491 2491
  * @return string HTML A element with URI address.
2492 2492
  */
2493
-function _make_url_clickable_cb( $matches ) {
2493
+function _make_url_clickable_cb($matches) {
2494 2494
 	$url = $matches[2];
2495 2495
 
2496
-	if ( ')' == $matches[3] && strpos( $url, '(' ) ) {
2496
+	if (')' == $matches[3] && strpos($url, '(')) {
2497 2497
 		// If the trailing character is a closing parethesis, and the URL has an opening parenthesis in it, add the closing parenthesis to the URL.
2498 2498
 		// Then we can let the parenthesis balancer do its thing below.
2499 2499
 		$url .= $matches[3];
@@ -2503,16 +2503,16 @@  discard block
 block discarded – undo
2503 2503
 	}
2504 2504
 
2505 2505
 	// Include parentheses in the URL only if paired
2506
-	while ( substr_count( $url, '(' ) < substr_count( $url, ')' ) ) {
2507
-		$suffix = strrchr( $url, ')' ) . $suffix;
2508
-		$url = substr( $url, 0, strrpos( $url, ')' ) );
2506
+	while (substr_count($url, '(') < substr_count($url, ')')) {
2507
+		$suffix = strrchr($url, ')').$suffix;
2508
+		$url = substr($url, 0, strrpos($url, ')'));
2509 2509
 	}
2510 2510
 
2511 2511
 	$url = esc_url($url);
2512
-	if ( empty($url) )
2512
+	if (empty($url))
2513 2513
 		return $matches[0];
2514 2514
 
2515
-	return $matches[1] . "<a href=\"$url\" rel=\"nofollow\">$url</a>" . $suffix;
2515
+	return $matches[1]."<a href=\"$url\" rel=\"nofollow\">$url</a>".$suffix;
2516 2516
 }
2517 2517
 
2518 2518
 /**
@@ -2526,22 +2526,22 @@  discard block
 block discarded – undo
2526 2526
  * @param array $matches Single Regex Match.
2527 2527
  * @return string HTML A element with URL address.
2528 2528
  */
2529
-function _make_web_ftp_clickable_cb( $matches ) {
2529
+function _make_web_ftp_clickable_cb($matches) {
2530 2530
 	$ret = '';
2531 2531
 	$dest = $matches[2];
2532
-	$dest = 'http://' . $dest;
2532
+	$dest = 'http://'.$dest;
2533 2533
 
2534 2534
 	// removed trailing [.,;:)] from URL
2535
-	if ( in_array( substr($dest, -1), array('.', ',', ';', ':', ')') ) === true ) {
2535
+	if (in_array(substr($dest, -1), array('.', ',', ';', ':', ')')) === true) {
2536 2536
 		$ret = substr($dest, -1);
2537
-		$dest = substr($dest, 0, strlen($dest)-1);
2537
+		$dest = substr($dest, 0, strlen($dest) - 1);
2538 2538
 	}
2539 2539
 
2540 2540
 	$dest = esc_url($dest);
2541
-	if ( empty($dest) )
2541
+	if (empty($dest))
2542 2542
 		return $matches[0];
2543 2543
 
2544
-	return $matches[1] . "<a href=\"$dest\" rel=\"nofollow\">$dest</a>$ret";
2544
+	return $matches[1]."<a href=\"$dest\" rel=\"nofollow\">$dest</a>$ret";
2545 2545
 }
2546 2546
 
2547 2547
 /**
@@ -2555,9 +2555,9 @@  discard block
 block discarded – undo
2555 2555
  * @param array $matches Single Regex Match.
2556 2556
  * @return string HTML A element with email address.
2557 2557
  */
2558
-function _make_email_clickable_cb( $matches ) {
2559
-	$email = $matches[2] . '@' . $matches[3];
2560
-	return $matches[1] . "<a href=\"mailto:$email\">$email</a>";
2558
+function _make_email_clickable_cb($matches) {
2559
+	$email = $matches[2].'@'.$matches[3];
2560
+	return $matches[1]."<a href=\"mailto:$email\">$email</a>";
2561 2561
 }
2562 2562
 
2563 2563
 /**
@@ -2571,30 +2571,30 @@  discard block
 block discarded – undo
2571 2571
  * @param string $text Content to convert URIs.
2572 2572
  * @return string Content with converted URIs.
2573 2573
  */
2574
-function make_clickable( $text ) {
2574
+function make_clickable($text) {
2575 2575
 	$r = '';
2576
-	$textarr = preg_split( '/(<[^<>]+>)/', $text, -1, PREG_SPLIT_DELIM_CAPTURE ); // split out HTML tags
2576
+	$textarr = preg_split('/(<[^<>]+>)/', $text, -1, PREG_SPLIT_DELIM_CAPTURE); // split out HTML tags
2577 2577
 	$nested_code_pre = 0; // Keep track of how many levels link is nested inside <pre> or <code>
2578
-	foreach ( $textarr as $piece ) {
2578
+	foreach ($textarr as $piece) {
2579 2579
 
2580
-		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 ) )
2580
+		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))
2581 2581
 			$nested_code_pre++;
2582
-		elseif ( $nested_code_pre && ( '</code>' === strtolower( $piece ) || '</pre>' === strtolower( $piece ) || '</script>' === strtolower( $piece ) || '</style>' === strtolower( $piece ) ) )
2582
+		elseif ($nested_code_pre && ('</code>' === strtolower($piece) || '</pre>' === strtolower($piece) || '</script>' === strtolower($piece) || '</style>' === strtolower($piece)))
2583 2583
 			$nested_code_pre--;
2584 2584
 
2585
-		if ( $nested_code_pre || empty( $piece ) || ( $piece[0] === '<' && ! preg_match( '|^<\s*[\w]{1,20}+://|', $piece ) ) ) {
2585
+		if ($nested_code_pre || empty($piece) || ($piece[0] === '<' && ! preg_match('|^<\s*[\w]{1,20}+://|', $piece))) {
2586 2586
 			$r .= $piece;
2587 2587
 			continue;
2588 2588
 		}
2589 2589
 
2590 2590
 		// Long strings might contain expensive edge cases ...
2591
-		if ( 10000 < strlen( $piece ) ) {
2591
+		if (10000 < strlen($piece)) {
2592 2592
 			// ... break it up
2593
-			foreach ( _split_str_by_whitespace( $piece, 2100 ) as $chunk ) { // 2100: Extra room for scheme and leading and trailing paretheses
2594
-				if ( 2101 < strlen( $chunk ) ) {
2593
+			foreach (_split_str_by_whitespace($piece, 2100) as $chunk) { // 2100: Extra room for scheme and leading and trailing paretheses
2594
+				if (2101 < strlen($chunk)) {
2595 2595
 					$r .= $chunk; // Too big, no whitespace: bail.
2596 2596
 				} else {
2597
-					$r .= make_clickable( $chunk );
2597
+					$r .= make_clickable($chunk);
2598 2598
 				}
2599 2599
 			}
2600 2600
 		} else {
@@ -2615,18 +2615,18 @@  discard block
 block discarded – undo
2615 2615
 			~xS'; // The regex is a non-anchored pattern and does not have a single fixed starting character.
2616 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
-			$ret = preg_replace_callback( $url_clickable, '_make_url_clickable_cb', $ret );
2618
+			$ret = preg_replace_callback($url_clickable, '_make_url_clickable_cb', $ret);
2619 2619
 
2620
-			$ret = preg_replace_callback( '#([\s>])((www|ftp)\.[\w\\x80-\\xff\#$%&~/.\-;:=,?@\[\]+]+)#is', '_make_web_ftp_clickable_cb', $ret );
2621
-			$ret = preg_replace_callback( '#([\s>])([.0-9a-z_+-]+)@(([0-9a-z-]+\.)+[0-9a-z]{2,})#i', '_make_email_clickable_cb', $ret );
2620
+			$ret = preg_replace_callback('#([\s>])((www|ftp)\.[\w\\x80-\\xff\#$%&~/.\-;:=,?@\[\]+]+)#is', '_make_web_ftp_clickable_cb', $ret);
2621
+			$ret = preg_replace_callback('#([\s>])([.0-9a-z_+-]+)@(([0-9a-z-]+\.)+[0-9a-z]{2,})#i', '_make_email_clickable_cb', $ret);
2622 2622
 
2623
-			$ret = substr( $ret, 1, -1 ); // Remove our whitespace padding.
2623
+			$ret = substr($ret, 1, -1); // Remove our whitespace padding.
2624 2624
 			$r .= $ret;
2625 2625
 		}
2626 2626
 	}
2627 2627
 
2628 2628
 	// Cleanup of accidental links within links
2629
-	return preg_replace( '#(<a([ \r\n\t]+[^>]+?>|>))<a [^>]+?>([^>]+?)</a></a>#i', "$1$3</a>", $r );
2629
+	return preg_replace('#(<a([ \r\n\t]+[^>]+?>|>))<a [^>]+?>([^>]+?)</a></a>#i', "$1$3</a>", $r);
2630 2630
 }
2631 2631
 
2632 2632
 /**
@@ -2658,27 +2658,27 @@  discard block
 block discarded – undo
2658 2658
  * @param int    $goal   The desired chunk length.
2659 2659
  * @return array Numeric array of chunks.
2660 2660
  */
2661
-function _split_str_by_whitespace( $string, $goal ) {
2661
+function _split_str_by_whitespace($string, $goal) {
2662 2662
 	$chunks = array();
2663 2663
 
2664
-	$string_nullspace = strtr( $string, "\r\n\t\v\f ", "\000\000\000\000\000\000" );
2664
+	$string_nullspace = strtr($string, "\r\n\t\v\f ", "\000\000\000\000\000\000");
2665 2665
 
2666
-	while ( $goal < strlen( $string_nullspace ) ) {
2667
-		$pos = strrpos( substr( $string_nullspace, 0, $goal + 1 ), "\000" );
2666
+	while ($goal < strlen($string_nullspace)) {
2667
+		$pos = strrpos(substr($string_nullspace, 0, $goal + 1), "\000");
2668 2668
 
2669
-		if ( false === $pos ) {
2670
-			$pos = strpos( $string_nullspace, "\000", $goal + 1 );
2671
-			if ( false === $pos ) {
2669
+		if (false === $pos) {
2670
+			$pos = strpos($string_nullspace, "\000", $goal + 1);
2671
+			if (false === $pos) {
2672 2672
 				break;
2673 2673
 			}
2674 2674
 		}
2675 2675
 
2676
-		$chunks[] = substr( $string, 0, $pos + 1 );
2677
-		$string = substr( $string, $pos + 1 );
2678
-		$string_nullspace = substr( $string_nullspace, $pos + 1 );
2676
+		$chunks[] = substr($string, 0, $pos + 1);
2677
+		$string = substr($string, $pos + 1);
2678
+		$string_nullspace = substr($string_nullspace, $pos + 1);
2679 2679
 	}
2680 2680
 
2681
-	if ( $string ) {
2681
+	if ($string) {
2682 2682
 		$chunks[] = $string;
2683 2683
 	}
2684 2684
 
@@ -2693,11 +2693,11 @@  discard block
 block discarded – undo
2693 2693
  * @param string $text Content that may contain HTML A elements.
2694 2694
  * @return string Converted content.
2695 2695
  */
2696
-function wp_rel_nofollow( $text ) {
2696
+function wp_rel_nofollow($text) {
2697 2697
 	// This is a pre save filter, so text is already escaped.
2698 2698
 	$text = stripslashes($text);
2699 2699
 	$text = preg_replace_callback('|<a (.+?)>|i', 'wp_rel_nofollow_callback', $text);
2700
-	return wp_slash( $text );
2700
+	return wp_slash($text);
2701 2701
 }
2702 2702
 
2703 2703
 /**
@@ -2711,30 +2711,30 @@  discard block
 block discarded – undo
2711 2711
  * @param array $matches Single Match
2712 2712
  * @return string HTML A Element with rel nofollow.
2713 2713
  */
2714
-function wp_rel_nofollow_callback( $matches ) {
2714
+function wp_rel_nofollow_callback($matches) {
2715 2715
 	$text = $matches[1];
2716
-	$atts = shortcode_parse_atts( $matches[1] );
2716
+	$atts = shortcode_parse_atts($matches[1]);
2717 2717
 	$rel  = 'nofollow';
2718 2718
 
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 )
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)
2721 2721
 	) {
2722 2722
 		return "<a $text>";
2723 2723
 	}
2724 2724
 
2725
-	if ( ! empty( $atts['rel'] ) ) {
2726
-		$parts = array_map( 'trim', explode( ' ', $atts['rel'] ) );
2727
-		if ( false === array_search( 'nofollow', $parts ) ) {
2725
+	if ( ! empty($atts['rel'])) {
2726
+		$parts = array_map('trim', explode(' ', $atts['rel']));
2727
+		if (false === array_search('nofollow', $parts)) {
2728 2728
 			$parts[] = 'nofollow';
2729 2729
 		}
2730
-		$rel = implode( ' ', $parts );
2731
-		unset( $atts['rel'] );
2730
+		$rel = implode(' ', $parts);
2731
+		unset($atts['rel']);
2732 2732
 
2733 2733
 		$html = '';
2734
-		foreach ( $atts as $name => $value ) {
2734
+		foreach ($atts as $name => $value) {
2735 2735
 			$html .= "{$name}=\"$value\" ";
2736 2736
 		}
2737
-		$text = trim( $html );
2737
+		$text = trim($html);
2738 2738
 	}
2739 2739
 	return "<a $text rel=\"$rel\">";
2740 2740
 }
@@ -2754,21 +2754,21 @@  discard block
 block discarded – undo
2754 2754
  * @param array $matches Single match. Smiley code to convert to image.
2755 2755
  * @return string Image string for smiley.
2756 2756
  */
2757
-function translate_smiley( $matches ) {
2757
+function translate_smiley($matches) {
2758 2758
 	global $wpsmiliestrans;
2759 2759
 
2760
-	if ( count( $matches ) == 0 )
2760
+	if (count($matches) == 0)
2761 2761
 		return '';
2762 2762
 
2763
-	$smiley = trim( reset( $matches ) );
2764
-	$img = $wpsmiliestrans[ $smiley ];
2763
+	$smiley = trim(reset($matches));
2764
+	$img = $wpsmiliestrans[$smiley];
2765 2765
 
2766 2766
 	$matches = array();
2767
-	$ext = preg_match( '/\.([^.]+)$/', $img, $matches ) ? strtolower( $matches[1] ) : false;
2768
-	$image_exts = array( 'jpg', 'jpeg', 'jpe', 'gif', 'png' );
2767
+	$ext = preg_match('/\.([^.]+)$/', $img, $matches) ? strtolower($matches[1]) : false;
2768
+	$image_exts = array('jpg', 'jpeg', 'jpe', 'gif', 'png');
2769 2769
 
2770 2770
 	// Don't convert smilies that aren't images - they're probably emoji.
2771
-	if ( ! in_array( $ext, $image_exts ) ) {
2771
+	if ( ! in_array($ext, $image_exts)) {
2772 2772
 		return $img;
2773 2773
 	}
2774 2774
 
@@ -2781,9 +2781,9 @@  discard block
 block discarded – undo
2781 2781
 	 * @param string $img        Filename for the smiley image.
2782 2782
 	 * @param string $site_url   Site URL, as returned by site_url().
2783 2783
 	 */
2784
-	$src_url = apply_filters( 'smilies_src', includes_url( "images/smilies/$img" ), $img, site_url() );
2784
+	$src_url = apply_filters('smilies_src', includes_url("images/smilies/$img"), $img, site_url());
2785 2785
 
2786
-	return sprintf( '<img src="%s" alt="%s" class="wp-smiley" style="height: 1em; max-height: 1em;" />', esc_url( $src_url ), esc_attr( $smiley ) );
2786
+	return sprintf('<img src="%s" alt="%s" class="wp-smiley" style="height: 1em; max-height: 1em;" />', esc_url($src_url), esc_attr($smiley));
2787 2787
 }
2788 2788
 
2789 2789
 /**
@@ -2799,33 +2799,33 @@  discard block
 block discarded – undo
2799 2799
  * @param string $text Content to convert smilies from text.
2800 2800
  * @return string Converted content with text smilies replaced with images.
2801 2801
  */
2802
-function convert_smilies( $text ) {
2802
+function convert_smilies($text) {
2803 2803
 	global $wp_smiliessearch;
2804 2804
 	$output = '';
2805
-	if ( get_option( 'use_smilies' ) && ! empty( $wp_smiliessearch ) ) {
2805
+	if (get_option('use_smilies') && ! empty($wp_smiliessearch)) {
2806 2806
 		// HTML loop taken from texturize function, could possible be consolidated
2807
-		$textarr = preg_split( '/(<.*>)/U', $text, -1, PREG_SPLIT_DELIM_CAPTURE ); // capture the tags as well as in between
2808
-		$stop = count( $textarr );// loop stuff
2807
+		$textarr = preg_split('/(<.*>)/U', $text, -1, PREG_SPLIT_DELIM_CAPTURE); // capture the tags as well as in between
2808
+		$stop = count($textarr); // loop stuff
2809 2809
 
2810 2810
 		// Ignore proessing of specific tags
2811 2811
 		$tags_to_ignore = 'code|pre|style|script|textarea';
2812 2812
 		$ignore_block_element = '';
2813 2813
 
2814
-		for ( $i = 0; $i < $stop; $i++ ) {
2814
+		for ($i = 0; $i < $stop; $i++) {
2815 2815
 			$content = $textarr[$i];
2816 2816
 
2817 2817
 			// If we're in an ignore block, wait until we find its closing tag
2818
-			if ( '' == $ignore_block_element && preg_match( '/^<(' . $tags_to_ignore . ')>/', $content, $matches ) )  {
2818
+			if ('' == $ignore_block_element && preg_match('/^<('.$tags_to_ignore.')>/', $content, $matches)) {
2819 2819
 				$ignore_block_element = $matches[1];
2820 2820
 			}
2821 2821
 
2822 2822
 			// If it's not a tag and not in ignore block
2823
-			if ( '' ==  $ignore_block_element && strlen( $content ) > 0 && '<' != $content[0] ) {
2824
-				$content = preg_replace_callback( $wp_smiliessearch, 'translate_smiley', $content );
2823
+			if ('' == $ignore_block_element && strlen($content) > 0 && '<' != $content[0]) {
2824
+				$content = preg_replace_callback($wp_smiliessearch, 'translate_smiley', $content);
2825 2825
 			}
2826 2826
 
2827 2827
 			// did we exit ignore block
2828
-			if ( '' != $ignore_block_element && '</' . $ignore_block_element . '>' == $content )  {
2828
+			if ('' != $ignore_block_element && '</'.$ignore_block_element.'>' == $content) {
2829 2829
 				$ignore_block_element = '';
2830 2830
 			}
2831 2831
 
@@ -2849,12 +2849,12 @@  discard block
 block discarded – undo
2849 2849
  * @param bool   $deprecated Deprecated.
2850 2850
  * @return string|bool Either false or the valid email address.
2851 2851
  */
2852
-function is_email( $email, $deprecated = false ) {
2853
-	if ( ! empty( $deprecated ) )
2854
-		_deprecated_argument( __FUNCTION__, '3.0.0' );
2852
+function is_email($email, $deprecated = false) {
2853
+	if ( ! empty($deprecated))
2854
+		_deprecated_argument(__FUNCTION__, '3.0.0');
2855 2855
 
2856 2856
 	// Test for the minimum length the email can be
2857
-	if ( strlen( $email ) < 3 ) {
2857
+	if (strlen($email) < 3) {
2858 2858
 		/**
2859 2859
 		 * Filters whether an email address is valid.
2860 2860
 		 *
@@ -2868,65 +2868,65 @@  discard block
 block discarded – undo
2868 2868
 		 * @param string $email    The email address being checked.
2869 2869
 		 * @param string $context  Context under which the email was tested.
2870 2870
 		 */
2871
-		return apply_filters( 'is_email', false, $email, 'email_too_short' );
2871
+		return apply_filters('is_email', false, $email, 'email_too_short');
2872 2872
 	}
2873 2873
 
2874 2874
 	// Test for an @ character after the first position
2875
-	if ( strpos( $email, '@', 1 ) === false ) {
2875
+	if (strpos($email, '@', 1) === false) {
2876 2876
 		/** This filter is documented in wp-includes/formatting.php */
2877
-		return apply_filters( 'is_email', false, $email, 'email_no_at' );
2877
+		return apply_filters('is_email', false, $email, 'email_no_at');
2878 2878
 	}
2879 2879
 
2880 2880
 	// Split out the local and domain parts
2881
-	list( $local, $domain ) = explode( '@', $email, 2 );
2881
+	list($local, $domain) = explode('@', $email, 2);
2882 2882
 
2883 2883
 	// LOCAL PART
2884 2884
 	// Test for invalid characters
2885
-	if ( !preg_match( '/^[a-zA-Z0-9!#$%&\'*+\/=?^_`{|}~\.-]+$/', $local ) ) {
2885
+	if ( ! preg_match('/^[a-zA-Z0-9!#$%&\'*+\/=?^_`{|}~\.-]+$/', $local)) {
2886 2886
 		/** This filter is documented in wp-includes/formatting.php */
2887
-		return apply_filters( 'is_email', false, $email, 'local_invalid_chars' );
2887
+		return apply_filters('is_email', false, $email, 'local_invalid_chars');
2888 2888
 	}
2889 2889
 
2890 2890
 	// DOMAIN PART
2891 2891
 	// Test for sequences of periods
2892
-	if ( preg_match( '/\.{2,}/', $domain ) ) {
2892
+	if (preg_match('/\.{2,}/', $domain)) {
2893 2893
 		/** This filter is documented in wp-includes/formatting.php */
2894
-		return apply_filters( 'is_email', false, $email, 'domain_period_sequence' );
2894
+		return apply_filters('is_email', false, $email, 'domain_period_sequence');
2895 2895
 	}
2896 2896
 
2897 2897
 	// Test for leading and trailing periods and whitespace
2898
-	if ( trim( $domain, " \t\n\r\0\x0B." ) !== $domain ) {
2898
+	if (trim($domain, " \t\n\r\0\x0B.") !== $domain) {
2899 2899
 		/** This filter is documented in wp-includes/formatting.php */
2900
-		return apply_filters( 'is_email', false, $email, 'domain_period_limits' );
2900
+		return apply_filters('is_email', false, $email, 'domain_period_limits');
2901 2901
 	}
2902 2902
 
2903 2903
 	// Split the domain into subs
2904
-	$subs = explode( '.', $domain );
2904
+	$subs = explode('.', $domain);
2905 2905
 
2906 2906
 	// Assume the domain will have at least two subs
2907
-	if ( 2 > count( $subs ) ) {
2907
+	if (2 > count($subs)) {
2908 2908
 		/** This filter is documented in wp-includes/formatting.php */
2909
-		return apply_filters( 'is_email', false, $email, 'domain_no_periods' );
2909
+		return apply_filters('is_email', false, $email, 'domain_no_periods');
2910 2910
 	}
2911 2911
 
2912 2912
 	// Loop through each sub
2913
-	foreach ( $subs as $sub ) {
2913
+	foreach ($subs as $sub) {
2914 2914
 		// Test for leading and trailing hyphens and whitespace
2915
-		if ( trim( $sub, " \t\n\r\0\x0B-" ) !== $sub ) {
2915
+		if (trim($sub, " \t\n\r\0\x0B-") !== $sub) {
2916 2916
 			/** This filter is documented in wp-includes/formatting.php */
2917
-			return apply_filters( 'is_email', false, $email, 'sub_hyphen_limits' );
2917
+			return apply_filters('is_email', false, $email, 'sub_hyphen_limits');
2918 2918
 		}
2919 2919
 
2920 2920
 		// Test for invalid characters
2921
-		if ( !preg_match('/^[a-z0-9-]+$/i', $sub ) ) {
2921
+		if ( ! preg_match('/^[a-z0-9-]+$/i', $sub)) {
2922 2922
 			/** This filter is documented in wp-includes/formatting.php */
2923
-			return apply_filters( 'is_email', false, $email, 'sub_invalid_chars' );
2923
+			return apply_filters('is_email', false, $email, 'sub_invalid_chars');
2924 2924
 		}
2925 2925
 	}
2926 2926
 
2927 2927
 	// Congratulations your email made it!
2928 2928
 	/** This filter is documented in wp-includes/formatting.php */
2929
-	return apply_filters( 'is_email', $email, $email, null );
2929
+	return apply_filters('is_email', $email, $email, null);
2930 2930
 }
2931 2931
 
2932 2932
 /**
@@ -2937,13 +2937,13 @@  discard block
 block discarded – undo
2937 2937
  * @param string $string Subject line
2938 2938
  * @return string Converted string to ASCII
2939 2939
  */
2940
-function wp_iso_descrambler( $string ) {
2940
+function wp_iso_descrambler($string) {
2941 2941
 	/* this may only work with iso-8859-1, I'm afraid */
2942
-	if (!preg_match('#\=\?(.+)\?Q\?(.+)\?\=#i', $string, $matches)) {
2942
+	if ( ! preg_match('#\=\?(.+)\?Q\?(.+)\?\=#i', $string, $matches)) {
2943 2943
 		return $string;
2944 2944
 	} else {
2945 2945
 		$subject = str_replace('_', ' ', $matches[2]);
2946
-		return preg_replace_callback( '#\=([0-9a-f]{2})#i', '_wp_iso_convert', $subject );
2946
+		return preg_replace_callback('#\=([0-9a-f]{2})#i', '_wp_iso_convert', $subject);
2947 2947
 	}
2948 2948
 }
2949 2949
 
@@ -2956,8 +2956,8 @@  discard block
 block discarded – undo
2956 2956
  * @param array $match The preg_replace_callback matches array
2957 2957
  * @return string Converted chars
2958 2958
  */
2959
-function _wp_iso_convert( $match ) {
2960
-	return chr( hexdec( strtolower( $match[1] ) ) );
2959
+function _wp_iso_convert($match) {
2960
+	return chr(hexdec(strtolower($match[1])));
2961 2961
 }
2962 2962
 
2963 2963
 /**
@@ -2974,25 +2974,25 @@  discard block
 block discarded – undo
2974 2974
  * @param string $format The format string for the returned date (default is Y-m-d H:i:s)
2975 2975
  * @return string GMT version of the date provided.
2976 2976
  */
2977
-function get_gmt_from_date( $string, $format = 'Y-m-d H:i:s' ) {
2978
-	$tz = get_option( 'timezone_string' );
2979
-	if ( $tz ) {
2980
-		$datetime = date_create( $string, new DateTimeZone( $tz ) );
2981
-		if ( ! $datetime ) {
2982
-			return gmdate( $format, 0 );
2977
+function get_gmt_from_date($string, $format = 'Y-m-d H:i:s') {
2978
+	$tz = get_option('timezone_string');
2979
+	if ($tz) {
2980
+		$datetime = date_create($string, new DateTimeZone($tz));
2981
+		if ( ! $datetime) {
2982
+			return gmdate($format, 0);
2983 2983
 		}
2984
-		$datetime->setTimezone( new DateTimeZone( 'UTC' ) );
2985
-		$string_gmt = $datetime->format( $format );
2984
+		$datetime->setTimezone(new DateTimeZone('UTC'));
2985
+		$string_gmt = $datetime->format($format);
2986 2986
 	} else {
2987
-		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 ) ) {
2988
-			$datetime = strtotime( $string );
2989
-			if ( false === $datetime ) {
2990
-				return gmdate( $format, 0 );
2987
+		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)) {
2988
+			$datetime = strtotime($string);
2989
+			if (false === $datetime) {
2990
+				return gmdate($format, 0);
2991 2991
 			}
2992
-			return gmdate( $format, $datetime );
2992
+			return gmdate($format, $datetime);
2993 2993
 		}
2994
-		$string_time = gmmktime( $matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1] );
2995
-		$string_gmt = gmdate( $format, $string_time - get_option( 'gmt_offset' ) * HOUR_IN_SECONDS );
2994
+		$string_time = gmmktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
2995
+		$string_gmt = gmdate($format, $string_time - get_option('gmt_offset') * HOUR_IN_SECONDS);
2996 2996
 	}
2997 2997
 	return $string_gmt;
2998 2998
 }
@@ -3011,19 +3011,19 @@  discard block
 block discarded – undo
3011 3011
  * @param string $format The format string for the returned date (default is Y-m-d H:i:s)
3012 3012
  * @return string Formatted date relative to the timezone / GMT offset.
3013 3013
  */
3014
-function get_date_from_gmt( $string, $format = 'Y-m-d H:i:s' ) {
3015
-	$tz = get_option( 'timezone_string' );
3016
-	if ( $tz ) {
3017
-		$datetime = date_create( $string, new DateTimeZone( 'UTC' ) );
3018
-		if ( ! $datetime )
3019
-			return date( $format, 0 );
3020
-		$datetime->setTimezone( new DateTimeZone( $tz ) );
3021
-		$string_localtime = $datetime->format( $format );
3014
+function get_date_from_gmt($string, $format = 'Y-m-d H:i:s') {
3015
+	$tz = get_option('timezone_string');
3016
+	if ($tz) {
3017
+		$datetime = date_create($string, new DateTimeZone('UTC'));
3018
+		if ( ! $datetime)
3019
+			return date($format, 0);
3020
+		$datetime->setTimezone(new DateTimeZone($tz));
3021
+		$string_localtime = $datetime->format($format);
3022 3022
 	} else {
3023
-		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) )
3024
-			return date( $format, 0 );
3025
-		$string_time = gmmktime( $matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1] );
3026
-		$string_localtime = gmdate( $format, $string_time + get_option( 'gmt_offset' ) * HOUR_IN_SECONDS );
3023
+		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))
3024
+			return date($format, 0);
3025
+		$string_time = gmmktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
3026
+		$string_localtime = gmdate($format, $string_time + get_option('gmt_offset') * HOUR_IN_SECONDS);
3027 3027
 	}
3028 3028
 	return $string_localtime;
3029 3029
 }
@@ -3036,7 +3036,7 @@  discard block
 block discarded – undo
3036 3036
  * @param string $timezone Either 'Z' for 0 offset or '±hhmm'.
3037 3037
  * @return int|float The offset in seconds.
3038 3038
  */
3039
-function iso8601_timezone_to_offset( $timezone ) {
3039
+function iso8601_timezone_to_offset($timezone) {
3040 3040
 	// $timezone is either 'Z' or '[+|-]hhmm'
3041 3041
 	if ($timezone == 'Z') {
3042 3042
 		$offset = 0;
@@ -3058,14 +3058,14 @@  discard block
 block discarded – undo
3058 3058
  * @param string $timezone    Optional. If set to GMT returns the time minus gmt_offset. Default is 'user'.
3059 3059
  * @return string The date and time in MySQL DateTime format - Y-m-d H:i:s.
3060 3060
  */
3061
-function iso8601_to_datetime( $date_string, $timezone = 'user' ) {
3061
+function iso8601_to_datetime($date_string, $timezone = 'user') {
3062 3062
 	$timezone = strtolower($timezone);
3063 3063
 
3064 3064
 	if ($timezone == 'gmt') {
3065 3065
 
3066 3066
 		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);
3067 3067
 
3068
-		if (!empty($date_bits[7])) { // we have a timezone, so let's compute an offset
3068
+		if ( ! empty($date_bits[7])) { // we have a timezone, so let's compute an offset
3069 3069
 			$offset = iso8601_timezone_to_offset($date_bits[7]);
3070 3070
 		} else { // we don't have a timezone, so we assume user local timezone (not server's!)
3071 3071
 			$offset = HOUR_IN_SECONDS * get_option('gmt_offset');
@@ -3089,9 +3089,9 @@  discard block
 block discarded – undo
3089 3089
  * @param string $email Email address to filter.
3090 3090
  * @return string Filtered email address.
3091 3091
  */
3092
-function sanitize_email( $email ) {
3092
+function sanitize_email($email) {
3093 3093
 	// Test for the minimum length the email can be
3094
-	if ( strlen( $email ) < 3 ) {
3094
+	if (strlen($email) < 3) {
3095 3095
 		/**
3096 3096
 		 * Filters a sanitized email address.
3097 3097
 		 *
@@ -3105,82 +3105,82 @@  discard block
 block discarded – undo
3105 3105
 		 * @param string $email   The email address, as provided to sanitize_email().
3106 3106
 		 * @param string $message A message to pass to the user.
3107 3107
 		 */
3108
-		return apply_filters( 'sanitize_email', '', $email, 'email_too_short' );
3108
+		return apply_filters('sanitize_email', '', $email, 'email_too_short');
3109 3109
 	}
3110 3110
 
3111 3111
 	// Test for an @ character after the first position
3112
-	if ( strpos( $email, '@', 1 ) === false ) {
3112
+	if (strpos($email, '@', 1) === false) {
3113 3113
 		/** This filter is documented in wp-includes/formatting.php */
3114
-		return apply_filters( 'sanitize_email', '', $email, 'email_no_at' );
3114
+		return apply_filters('sanitize_email', '', $email, 'email_no_at');
3115 3115
 	}
3116 3116
 
3117 3117
 	// Split out the local and domain parts
3118
-	list( $local, $domain ) = explode( '@', $email, 2 );
3118
+	list($local, $domain) = explode('@', $email, 2);
3119 3119
 
3120 3120
 	// LOCAL PART
3121 3121
 	// Test for invalid characters
3122
-	$local = preg_replace( '/[^a-zA-Z0-9!#$%&\'*+\/=?^_`{|}~\.-]/', '', $local );
3123
-	if ( '' === $local ) {
3122
+	$local = preg_replace('/[^a-zA-Z0-9!#$%&\'*+\/=?^_`{|}~\.-]/', '', $local);
3123
+	if ('' === $local) {
3124 3124
 		/** This filter is documented in wp-includes/formatting.php */
3125
-		return apply_filters( 'sanitize_email', '', $email, 'local_invalid_chars' );
3125
+		return apply_filters('sanitize_email', '', $email, 'local_invalid_chars');
3126 3126
 	}
3127 3127
 
3128 3128
 	// DOMAIN PART
3129 3129
 	// Test for sequences of periods
3130
-	$domain = preg_replace( '/\.{2,}/', '', $domain );
3131
-	if ( '' === $domain ) {
3130
+	$domain = preg_replace('/\.{2,}/', '', $domain);
3131
+	if ('' === $domain) {
3132 3132
 		/** This filter is documented in wp-includes/formatting.php */
3133
-		return apply_filters( 'sanitize_email', '', $email, 'domain_period_sequence' );
3133
+		return apply_filters('sanitize_email', '', $email, 'domain_period_sequence');
3134 3134
 	}
3135 3135
 
3136 3136
 	// Test for leading and trailing periods and whitespace
3137
-	$domain = trim( $domain, " \t\n\r\0\x0B." );
3138
-	if ( '' === $domain ) {
3137
+	$domain = trim($domain, " \t\n\r\0\x0B.");
3138
+	if ('' === $domain) {
3139 3139
 		/** This filter is documented in wp-includes/formatting.php */
3140
-		return apply_filters( 'sanitize_email', '', $email, 'domain_period_limits' );
3140
+		return apply_filters('sanitize_email', '', $email, 'domain_period_limits');
3141 3141
 	}
3142 3142
 
3143 3143
 	// Split the domain into subs
3144
-	$subs = explode( '.', $domain );
3144
+	$subs = explode('.', $domain);
3145 3145
 
3146 3146
 	// Assume the domain will have at least two subs
3147
-	if ( 2 > count( $subs ) ) {
3147
+	if (2 > count($subs)) {
3148 3148
 		/** This filter is documented in wp-includes/formatting.php */
3149
-		return apply_filters( 'sanitize_email', '', $email, 'domain_no_periods' );
3149
+		return apply_filters('sanitize_email', '', $email, 'domain_no_periods');
3150 3150
 	}
3151 3151
 
3152 3152
 	// Create an array that will contain valid subs
3153 3153
 	$new_subs = array();
3154 3154
 
3155 3155
 	// Loop through each sub
3156
-	foreach ( $subs as $sub ) {
3156
+	foreach ($subs as $sub) {
3157 3157
 		// Test for leading and trailing hyphens
3158
-		$sub = trim( $sub, " \t\n\r\0\x0B-" );
3158
+		$sub = trim($sub, " \t\n\r\0\x0B-");
3159 3159
 
3160 3160
 		// Test for invalid characters
3161
-		$sub = preg_replace( '/[^a-z0-9-]+/i', '', $sub );
3161
+		$sub = preg_replace('/[^a-z0-9-]+/i', '', $sub);
3162 3162
 
3163 3163
 		// If there's anything left, add it to the valid subs
3164
-		if ( '' !== $sub ) {
3164
+		if ('' !== $sub) {
3165 3165
 			$new_subs[] = $sub;
3166 3166
 		}
3167 3167
 	}
3168 3168
 
3169 3169
 	// If there aren't 2 or more valid subs
3170
-	if ( 2 > count( $new_subs ) ) {
3170
+	if (2 > count($new_subs)) {
3171 3171
 		/** This filter is documented in wp-includes/formatting.php */
3172
-		return apply_filters( 'sanitize_email', '', $email, 'domain_no_valid_subs' );
3172
+		return apply_filters('sanitize_email', '', $email, 'domain_no_valid_subs');
3173 3173
 	}
3174 3174
 
3175 3175
 	// Join valid subs into the new domain
3176
-	$domain = join( '.', $new_subs );
3176
+	$domain = join('.', $new_subs);
3177 3177
 
3178 3178
 	// Put the email back together
3179
-	$email = $local . '@' . $domain;
3179
+	$email = $local.'@'.$domain;
3180 3180
 
3181 3181
 	// Congratulations your email made it!
3182 3182
 	/** This filter is documented in wp-includes/formatting.php */
3183
-	return apply_filters( 'sanitize_email', $email, $email, null );
3183
+	return apply_filters('sanitize_email', $email, $email, null);
3184 3184
 }
3185 3185
 
3186 3186
 /**
@@ -3195,44 +3195,44 @@  discard block
 block discarded – undo
3195 3195
  * @param int $to   Optional. Unix timestamp to end the time difference. Default becomes time() if not set.
3196 3196
  * @return string Human readable time difference.
3197 3197
  */
3198
-function human_time_diff( $from, $to = '' ) {
3199
-	if ( empty( $to ) ) {
3198
+function human_time_diff($from, $to = '') {
3199
+	if (empty($to)) {
3200 3200
 		$to = time();
3201 3201
 	}
3202 3202
 
3203
-	$diff = (int) abs( $to - $from );
3203
+	$diff = (int) abs($to - $from);
3204 3204
 
3205
-	if ( $diff < HOUR_IN_SECONDS ) {
3206
-		$mins = round( $diff / MINUTE_IN_SECONDS );
3207
-		if ( $mins <= 1 )
3205
+	if ($diff < HOUR_IN_SECONDS) {
3206
+		$mins = round($diff / MINUTE_IN_SECONDS);
3207
+		if ($mins <= 1)
3208 3208
 			$mins = 1;
3209 3209
 		/* translators: min=minute */
3210
-		$since = sprintf( _n( '%s min', '%s mins', $mins ), $mins );
3211
-	} elseif ( $diff < DAY_IN_SECONDS && $diff >= HOUR_IN_SECONDS ) {
3212
-		$hours = round( $diff / HOUR_IN_SECONDS );
3213
-		if ( $hours <= 1 )
3210
+		$since = sprintf(_n('%s min', '%s mins', $mins), $mins);
3211
+	} elseif ($diff < DAY_IN_SECONDS && $diff >= HOUR_IN_SECONDS) {
3212
+		$hours = round($diff / HOUR_IN_SECONDS);
3213
+		if ($hours <= 1)
3214 3214
 			$hours = 1;
3215
-		$since = sprintf( _n( '%s hour', '%s hours', $hours ), $hours );
3216
-	} elseif ( $diff < WEEK_IN_SECONDS && $diff >= DAY_IN_SECONDS ) {
3217
-		$days = round( $diff / DAY_IN_SECONDS );
3218
-		if ( $days <= 1 )
3215
+		$since = sprintf(_n('%s hour', '%s hours', $hours), $hours);
3216
+	} elseif ($diff < WEEK_IN_SECONDS && $diff >= DAY_IN_SECONDS) {
3217
+		$days = round($diff / DAY_IN_SECONDS);
3218
+		if ($days <= 1)
3219 3219
 			$days = 1;
3220
-		$since = sprintf( _n( '%s day', '%s days', $days ), $days );
3221
-	} elseif ( $diff < MONTH_IN_SECONDS && $diff >= WEEK_IN_SECONDS ) {
3222
-		$weeks = round( $diff / WEEK_IN_SECONDS );
3223
-		if ( $weeks <= 1 )
3220
+		$since = sprintf(_n('%s day', '%s days', $days), $days);
3221
+	} elseif ($diff < MONTH_IN_SECONDS && $diff >= WEEK_IN_SECONDS) {
3222
+		$weeks = round($diff / WEEK_IN_SECONDS);
3223
+		if ($weeks <= 1)
3224 3224
 			$weeks = 1;
3225
-		$since = sprintf( _n( '%s week', '%s weeks', $weeks ), $weeks );
3226
-	} elseif ( $diff < YEAR_IN_SECONDS && $diff >= MONTH_IN_SECONDS ) {
3227
-		$months = round( $diff / MONTH_IN_SECONDS );
3228
-		if ( $months <= 1 )
3225
+		$since = sprintf(_n('%s week', '%s weeks', $weeks), $weeks);
3226
+	} elseif ($diff < YEAR_IN_SECONDS && $diff >= MONTH_IN_SECONDS) {
3227
+		$months = round($diff / MONTH_IN_SECONDS);
3228
+		if ($months <= 1)
3229 3229
 			$months = 1;
3230
-		$since = sprintf( _n( '%s month', '%s months', $months ), $months );
3231
-	} elseif ( $diff >= YEAR_IN_SECONDS ) {
3232
-		$years = round( $diff / YEAR_IN_SECONDS );
3233
-		if ( $years <= 1 )
3230
+		$since = sprintf(_n('%s month', '%s months', $months), $months);
3231
+	} elseif ($diff >= YEAR_IN_SECONDS) {
3232
+		$years = round($diff / YEAR_IN_SECONDS);
3233
+		if ($years <= 1)
3234 3234
 			$years = 1;
3235
-		$since = sprintf( _n( '%s year', '%s years', $years ), $years );
3235
+		$since = sprintf(_n('%s year', '%s years', $years), $years);
3236 3236
 	}
3237 3237
 
3238 3238
 	/**
@@ -3245,7 +3245,7 @@  discard block
 block discarded – undo
3245 3245
 	 * @param int    $from  Unix timestamp from which the difference begins.
3246 3246
 	 * @param int    $to    Unix timestamp to end the time difference.
3247 3247
 	 */
3248
-	return apply_filters( 'human_time_diff', $since, $diff, $from, $to );
3248
+	return apply_filters('human_time_diff', $since, $diff, $from, $to);
3249 3249
 }
3250 3250
 
3251 3251
 /**
@@ -3263,15 +3263,15 @@  discard block
 block discarded – undo
3263 3263
  * @param string $text Optional. The excerpt. If set to empty, an excerpt is generated.
3264 3264
  * @return string The excerpt.
3265 3265
  */
3266
-function wp_trim_excerpt( $text = '' ) {
3266
+function wp_trim_excerpt($text = '') {
3267 3267
 	$raw_excerpt = $text;
3268
-	if ( '' == $text ) {
3268
+	if ('' == $text) {
3269 3269
 		$text = get_the_content('');
3270 3270
 
3271
-		$text = strip_shortcodes( $text );
3271
+		$text = strip_shortcodes($text);
3272 3272
 
3273 3273
 		/** This filter is documented in wp-includes/post-template.php */
3274
-		$text = apply_filters( 'the_content', $text );
3274
+		$text = apply_filters('the_content', $text);
3275 3275
 		$text = str_replace(']]>', ']]&gt;', $text);
3276 3276
 
3277 3277
 		/**
@@ -3281,7 +3281,7 @@  discard block
 block discarded – undo
3281 3281
 		 *
3282 3282
 		 * @param int $number The number of words. Default 55.
3283 3283
 		 */
3284
-		$excerpt_length = apply_filters( 'excerpt_length', 55 );
3284
+		$excerpt_length = apply_filters('excerpt_length', 55);
3285 3285
 		/**
3286 3286
 		 * Filters the string in the "more" link displayed after a trimmed excerpt.
3287 3287
 		 *
@@ -3289,8 +3289,8 @@  discard block
 block discarded – undo
3289 3289
 		 *
3290 3290
 		 * @param string $more_string The string shown within the more link.
3291 3291
 		 */
3292
-		$excerpt_more = apply_filters( 'excerpt_more', ' ' . '[&hellip;]' );
3293
-		$text = wp_trim_words( $text, $excerpt_length, $excerpt_more );
3292
+		$excerpt_more = apply_filters('excerpt_more', ' '.'[&hellip;]');
3293
+		$text = wp_trim_words($text, $excerpt_length, $excerpt_more);
3294 3294
 	}
3295 3295
 	/**
3296 3296
 	 * Filters the trimmed excerpt string.
@@ -3300,7 +3300,7 @@  discard block
 block discarded – undo
3300 3300
 	 * @param string $text        The trimmed text.
3301 3301
 	 * @param string $raw_excerpt The text prior to trimming.
3302 3302
 	 */
3303
-	return apply_filters( 'wp_trim_excerpt', $text, $raw_excerpt );
3303
+	return apply_filters('wp_trim_excerpt', $text, $raw_excerpt);
3304 3304
 }
3305 3305
 
3306 3306
 /**
@@ -3317,35 +3317,35 @@  discard block
 block discarded – undo
3317 3317
  * @param string $more      Optional. What to append if $text needs to be trimmed. Default '&hellip;'.
3318 3318
  * @return string Trimmed text.
3319 3319
  */
3320
-function wp_trim_words( $text, $num_words = 55, $more = null ) {
3321
-	if ( null === $more ) {
3322
-		$more = __( '&hellip;' );
3320
+function wp_trim_words($text, $num_words = 55, $more = null) {
3321
+	if (null === $more) {
3322
+		$more = __('&hellip;');
3323 3323
 	}
3324 3324
 
3325 3325
 	$original_text = $text;
3326
-	$text = wp_strip_all_tags( $text );
3326
+	$text = wp_strip_all_tags($text);
3327 3327
 
3328 3328
 	/*
3329 3329
 	 * translators: If your word count is based on single characters (e.g. East Asian characters),
3330 3330
 	 * enter 'characters_excluding_spaces' or 'characters_including_spaces'. Otherwise, enter 'words'.
3331 3331
 	 * Do not translate into your own language.
3332 3332
 	 */
3333
-	if ( strpos( _x( 'words', 'Word count type. Do not translate!' ), 'characters' ) === 0 && preg_match( '/^utf\-?8$/i', get_option( 'blog_charset' ) ) ) {
3334
-		$text = trim( preg_replace( "/[\n\r\t ]+/", ' ', $text ), ' ' );
3335
-		preg_match_all( '/./u', $text, $words_array );
3336
-		$words_array = array_slice( $words_array[0], 0, $num_words + 1 );
3333
+	if (strpos(_x('words', 'Word count type. Do not translate!'), 'characters') === 0 && preg_match('/^utf\-?8$/i', get_option('blog_charset'))) {
3334
+		$text = trim(preg_replace("/[\n\r\t ]+/", ' ', $text), ' ');
3335
+		preg_match_all('/./u', $text, $words_array);
3336
+		$words_array = array_slice($words_array[0], 0, $num_words + 1);
3337 3337
 		$sep = '';
3338 3338
 	} else {
3339
-		$words_array = preg_split( "/[\n\r\t ]+/", $text, $num_words + 1, PREG_SPLIT_NO_EMPTY );
3339
+		$words_array = preg_split("/[\n\r\t ]+/", $text, $num_words + 1, PREG_SPLIT_NO_EMPTY);
3340 3340
 		$sep = ' ';
3341 3341
 	}
3342 3342
 
3343
-	if ( count( $words_array ) > $num_words ) {
3344
-		array_pop( $words_array );
3345
-		$text = implode( $sep, $words_array );
3346
-		$text = $text . $more;
3343
+	if (count($words_array) > $num_words) {
3344
+		array_pop($words_array);
3345
+		$text = implode($sep, $words_array);
3346
+		$text = $text.$more;
3347 3347
 	} else {
3348
-		$text = implode( $sep, $words_array );
3348
+		$text = implode($sep, $words_array);
3349 3349
 	}
3350 3350
 
3351 3351
 	/**
@@ -3358,7 +3358,7 @@  discard block
 block discarded – undo
3358 3358
 	 * @param string $more          An optional string to append to the end of the trimmed text, e.g. &hellip;.
3359 3359
 	 * @param string $original_text The text before it was trimmed.
3360 3360
 	 */
3361
-	return apply_filters( 'wp_trim_words', $text, $num_words, $more, $original_text );
3361
+	return apply_filters('wp_trim_words', $text, $num_words, $more, $original_text);
3362 3362
 }
3363 3363
 
3364 3364
 /**
@@ -3369,7 +3369,7 @@  discard block
 block discarded – undo
3369 3369
  * @param string $text The text within which entities will be converted.
3370 3370
  * @return string Text with converted entities.
3371 3371
  */
3372
-function ent2ncr( $text ) {
3372
+function ent2ncr($text) {
3373 3373
 
3374 3374
 	/**
3375 3375
 	 * Filters text before named entities are converted into numbered entities.
@@ -3381,8 +3381,8 @@  discard block
 block discarded – undo
3381 3381
 	 * @param null   $converted_text The text to be converted. Default null.
3382 3382
 	 * @param string $text           The text prior to entity conversion.
3383 3383
 	 */
3384
-	$filtered = apply_filters( 'pre_ent2ncr', null, $text );
3385
-	if ( null !== $filtered )
3384
+	$filtered = apply_filters('pre_ent2ncr', null, $text);
3385
+	if (null !== $filtered)
3386 3386
 		return $filtered;
3387 3387
 
3388 3388
 	$to_ncr = array(
@@ -3644,7 +3644,7 @@  discard block
 block discarded – undo
3644 3644
 		'&diams;' => '&#9830;'
3645 3645
 	);
3646 3646
 
3647
-	return str_replace( array_keys($to_ncr), array_values($to_ncr), $text );
3647
+	return str_replace(array_keys($to_ncr), array_values($to_ncr), $text);
3648 3648
 }
3649 3649
 
3650 3650
 /**
@@ -3665,9 +3665,9 @@  discard block
 block discarded – undo
3665 3665
  *                               It is usually either 'html' or 'tinymce'.
3666 3666
  * @return string The formatted text after filter is applied.
3667 3667
  */
3668
-function format_for_editor( $text, $default_editor = null ) {
3669
-	if ( $text ) {
3670
-		$text = htmlspecialchars( $text, ENT_NOQUOTES, get_option( 'blog_charset' ) );
3668
+function format_for_editor($text, $default_editor = null) {
3669
+	if ($text) {
3670
+		$text = htmlspecialchars($text, ENT_NOQUOTES, get_option('blog_charset'));
3671 3671
 	}
3672 3672
 
3673 3673
 	/**
@@ -3679,7 +3679,7 @@  discard block
 block discarded – undo
3679 3679
 	 * @param string $default_editor The default editor for the current user.
3680 3680
 	 *                               It is usually either 'html' or 'tinymce'.
3681 3681
 	 */
3682
-	return apply_filters( 'format_for_editor', $text, $default_editor );
3682
+	return apply_filters('format_for_editor', $text, $default_editor);
3683 3683
 }
3684 3684
 
3685 3685
 /**
@@ -3697,12 +3697,12 @@  discard block
 block discarded – undo
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.
3699 3699
  */
3700
-function _deep_replace( $search, $subject ) {
3700
+function _deep_replace($search, $subject) {
3701 3701
 	$subject = (string) $subject;
3702 3702
 
3703 3703
 	$count = 1;
3704
-	while ( $count ) {
3705
-		$subject = str_replace( $search, '', $subject, $count );
3704
+	while ($count) {
3705
+		$subject = str_replace($search, '', $subject, $count);
3706 3706
 	}
3707 3707
 
3708 3708
 	return $subject;
@@ -3722,9 +3722,9 @@  discard block
 block discarded – undo
3722 3722
  * @param string|array $data Unescaped data
3723 3723
  * @return string|array Escaped data
3724 3724
  */
3725
-function esc_sql( $data ) {
3725
+function esc_sql($data) {
3726 3726
 	global $wpdb;
3727
-	return $wpdb->_escape( $data );
3727
+	return $wpdb->_escape($data);
3728 3728
 }
3729 3729
 
3730 3730
 /**
@@ -3742,20 +3742,20 @@  discard block
 block discarded – undo
3742 3742
  * @param string $_context  Private. Use esc_url_raw() for database usage.
3743 3743
  * @return string The cleaned $url after the {@see 'clean_url'} filter is applied.
3744 3744
  */
3745
-function esc_url( $url, $protocols = null, $_context = 'display' ) {
3745
+function esc_url($url, $protocols = null, $_context = 'display') {
3746 3746
 	$original_url = $url;
3747 3747
 
3748
-	if ( '' == $url )
3748
+	if ('' == $url)
3749 3749
 		return $url;
3750 3750
 
3751
-	$url = str_replace( ' ', '%20', $url );
3751
+	$url = str_replace(' ', '%20', $url);
3752 3752
 	$url = preg_replace('|[^a-z0-9-~+_.?#=!&;,/:%@$\|*\'()\[\]\\x80-\\xff]|i', '', $url);
3753 3753
 
3754
-	if ( '' === $url ) {
3754
+	if ('' === $url) {
3755 3755
 		return $url;
3756 3756
 	}
3757 3757
 
3758
-	if ( 0 !== stripos( $url, 'mailto:' ) ) {
3758
+	if (0 !== stripos($url, 'mailto:')) {
3759 3759
 		$strip = array('%0d', '%0a', '%0D', '%0A');
3760 3760
 		$url = _deep_replace($strip, $url);
3761 3761
 	}
@@ -3765,61 +3765,61 @@  discard block
 block discarded – undo
3765 3765
 	 * presume it needs http:// prepended (unless a relative
3766 3766
 	 * link starting with /, # or ? or a php file).
3767 3767
 	 */
3768
-	if ( strpos($url, ':') === false && ! in_array( $url[0], array( '/', '#', '?' ) ) &&
3769
-		! preg_match('/^[a-z0-9-]+?\.php/i', $url) )
3770
-		$url = 'http://' . $url;
3768
+	if (strpos($url, ':') === false && ! in_array($url[0], array('/', '#', '?')) &&
3769
+		! preg_match('/^[a-z0-9-]+?\.php/i', $url))
3770
+		$url = 'http://'.$url;
3771 3771
 
3772 3772
 	// Replace ampersands and single quotes only when displaying.
3773
-	if ( 'display' == $_context ) {
3774
-		$url = wp_kses_normalize_entities( $url );
3775
-		$url = str_replace( '&amp;', '&#038;', $url );
3776
-		$url = str_replace( "'", '&#039;', $url );
3773
+	if ('display' == $_context) {
3774
+		$url = wp_kses_normalize_entities($url);
3775
+		$url = str_replace('&amp;', '&#038;', $url);
3776
+		$url = str_replace("'", '&#039;', $url);
3777 3777
 	}
3778 3778
 
3779
-	if ( ( false !== strpos( $url, '[' ) ) || ( false !== strpos( $url, ']' ) ) ) {
3779
+	if ((false !== strpos($url, '[')) || (false !== strpos($url, ']'))) {
3780 3780
 
3781
-		$parsed = wp_parse_url( $url );
3781
+		$parsed = wp_parse_url($url);
3782 3782
 		$front  = '';
3783 3783
 
3784
-		if ( isset( $parsed['scheme'] ) ) {
3785
-			$front .= $parsed['scheme'] . '://';
3786
-		} elseif ( '/' === $url[0] ) {
3784
+		if (isset($parsed['scheme'])) {
3785
+			$front .= $parsed['scheme'].'://';
3786
+		} elseif ('/' === $url[0]) {
3787 3787
 			$front .= '//';
3788 3788
 		}
3789 3789
 
3790
-		if ( isset( $parsed['user'] ) ) {
3790
+		if (isset($parsed['user'])) {
3791 3791
 			$front .= $parsed['user'];
3792 3792
 		}
3793 3793
 
3794
-		if ( isset( $parsed['pass'] ) ) {
3795
-			$front .= ':' . $parsed['pass'];
3794
+		if (isset($parsed['pass'])) {
3795
+			$front .= ':'.$parsed['pass'];
3796 3796
 		}
3797 3797
 
3798
-		if ( isset( $parsed['user'] ) || isset( $parsed['pass'] ) ) {
3798
+		if (isset($parsed['user']) || isset($parsed['pass'])) {
3799 3799
 			$front .= '@';
3800 3800
 		}
3801 3801
 
3802
-		if ( isset( $parsed['host'] ) ) {
3802
+		if (isset($parsed['host'])) {
3803 3803
 			$front .= $parsed['host'];
3804 3804
 		}
3805 3805
 
3806
-		if ( isset( $parsed['port'] ) ) {
3807
-			$front .= ':' . $parsed['port'];
3806
+		if (isset($parsed['port'])) {
3807
+			$front .= ':'.$parsed['port'];
3808 3808
 		}
3809 3809
 
3810
-		$end_dirty = str_replace( $front, '', $url );
3811
-		$end_clean = str_replace( array( '[', ']' ), array( '%5B', '%5D' ), $end_dirty );
3812
-		$url       = str_replace( $end_dirty, $end_clean, $url );
3810
+		$end_dirty = str_replace($front, '', $url);
3811
+		$end_clean = str_replace(array('[', ']'), array('%5B', '%5D'), $end_dirty);
3812
+		$url       = str_replace($end_dirty, $end_clean, $url);
3813 3813
 
3814 3814
 	}
3815 3815
 
3816
-	if ( '/' === $url[0] ) {
3816
+	if ('/' === $url[0]) {
3817 3817
 		$good_protocol_url = $url;
3818 3818
 	} else {
3819
-		if ( ! is_array( $protocols ) )
3819
+		if ( ! is_array($protocols))
3820 3820
 			$protocols = wp_allowed_protocols();
3821
-		$good_protocol_url = wp_kses_bad_protocol( $url, $protocols );
3822
-		if ( strtolower( $good_protocol_url ) != strtolower( $url ) )
3821
+		$good_protocol_url = wp_kses_bad_protocol($url, $protocols);
3822
+		if (strtolower($good_protocol_url) != strtolower($url))
3823 3823
 			return '';
3824 3824
 	}
3825 3825
 
@@ -3832,7 +3832,7 @@  discard block
 block discarded – undo
3832 3832
 	 * @param string $original_url      The URL prior to cleaning.
3833 3833
 	 * @param string $_context          If 'display', replace ampersands and single quotes only.
3834 3834
 	 */
3835
-	return apply_filters( 'clean_url', $good_protocol_url, $original_url, $_context );
3835
+	return apply_filters('clean_url', $good_protocol_url, $original_url, $_context);
3836 3836
 }
3837 3837
 
3838 3838
 /**
@@ -3844,8 +3844,8 @@  discard block
 block discarded – undo
3844 3844
  * @param array  $protocols An array of acceptable protocols.
3845 3845
  * @return string The cleaned URL.
3846 3846
  */
3847
-function esc_url_raw( $url, $protocols = null ) {
3848
-	return esc_url( $url, $protocols, 'db' );
3847
+function esc_url_raw($url, $protocols = null) {
3848
+	return esc_url($url, $protocols, 'db');
3849 3849
 }
3850 3850
 
3851 3851
 /**
@@ -3858,10 +3858,10 @@  discard block
 block discarded – undo
3858 3858
  * @param string $myHTML The text to be converted.
3859 3859
  * @return string Converted text.
3860 3860
  */
3861
-function htmlentities2( $myHTML ) {
3862
-	$translation_table = get_html_translation_table( HTML_ENTITIES, ENT_QUOTES );
3861
+function htmlentities2($myHTML) {
3862
+	$translation_table = get_html_translation_table(HTML_ENTITIES, ENT_QUOTES);
3863 3863
 	$translation_table[chr(38)] = '&';
3864
-	return preg_replace( "/&(?![A-Za-z]{0,4}\w{2,3};|#[0-9]{2,3};)/", "&amp;", strtr($myHTML, $translation_table) );
3864
+	return preg_replace("/&(?![A-Za-z]{0,4}\w{2,3};|#[0-9]{2,3};)/", "&amp;", strtr($myHTML, $translation_table));
3865 3865
 }
3866 3866
 
3867 3867
 /**
@@ -3876,12 +3876,12 @@  discard block
 block discarded – undo
3876 3876
  * @param string $text The text to be escaped.
3877 3877
  * @return string Escaped text.
3878 3878
  */
3879
-function esc_js( $text ) {
3880
-	$safe_text = wp_check_invalid_utf8( $text );
3881
-	$safe_text = _wp_specialchars( $safe_text, ENT_COMPAT );
3882
-	$safe_text = preg_replace( '/&#(x)?0*(?(1)27|39);?/i', "'", stripslashes( $safe_text ) );
3883
-	$safe_text = str_replace( "\r", '', $safe_text );
3884
-	$safe_text = str_replace( "\n", '\\n', addslashes( $safe_text ) );
3879
+function esc_js($text) {
3880
+	$safe_text = wp_check_invalid_utf8($text);
3881
+	$safe_text = _wp_specialchars($safe_text, ENT_COMPAT);
3882
+	$safe_text = preg_replace('/&#(x)?0*(?(1)27|39);?/i', "'", stripslashes($safe_text));
3883
+	$safe_text = str_replace("\r", '', $safe_text);
3884
+	$safe_text = str_replace("\n", '\\n', addslashes($safe_text));
3885 3885
 	/**
3886 3886
 	 * Filters a string cleaned and escaped for output in JavaScript.
3887 3887
 	 *
@@ -3893,7 +3893,7 @@  discard block
 block discarded – undo
3893 3893
 	 * @param string $safe_text The text after it has been escaped.
3894 3894
  	 * @param string $text      The text prior to being escaped.
3895 3895
 	 */
3896
-	return apply_filters( 'js_escape', $safe_text, $text );
3896
+	return apply_filters('js_escape', $safe_text, $text);
3897 3897
 }
3898 3898
 
3899 3899
 /**
@@ -3904,9 +3904,9 @@  discard block
 block discarded – undo
3904 3904
  * @param string $text
3905 3905
  * @return string
3906 3906
  */
3907
-function esc_html( $text ) {
3908
-	$safe_text = wp_check_invalid_utf8( $text );
3909
-	$safe_text = _wp_specialchars( $safe_text, ENT_QUOTES );
3907
+function esc_html($text) {
3908
+	$safe_text = wp_check_invalid_utf8($text);
3909
+	$safe_text = _wp_specialchars($safe_text, ENT_QUOTES);
3910 3910
 	/**
3911 3911
 	 * Filters a string cleaned and escaped for output in HTML.
3912 3912
 	 *
@@ -3918,7 +3918,7 @@  discard block
 block discarded – undo
3918 3918
 	 * @param string $safe_text The text after it has been escaped.
3919 3919
  	 * @param string $text      The text prior to being escaped.
3920 3920
 	 */
3921
-	return apply_filters( 'esc_html', $safe_text, $text );
3921
+	return apply_filters('esc_html', $safe_text, $text);
3922 3922
 }
3923 3923
 
3924 3924
 /**
@@ -3929,9 +3929,9 @@  discard block
 block discarded – undo
3929 3929
  * @param string $text
3930 3930
  * @return string
3931 3931
  */
3932
-function esc_attr( $text ) {
3933
-	$safe_text = wp_check_invalid_utf8( $text );
3934
-	$safe_text = _wp_specialchars( $safe_text, ENT_QUOTES );
3932
+function esc_attr($text) {
3933
+	$safe_text = wp_check_invalid_utf8($text);
3934
+	$safe_text = _wp_specialchars($safe_text, ENT_QUOTES);
3935 3935
 	/**
3936 3936
 	 * Filters a string cleaned and escaped for output in an HTML attribute.
3937 3937
 	 *
@@ -3943,7 +3943,7 @@  discard block
 block discarded – undo
3943 3943
 	 * @param string $safe_text The text after it has been escaped.
3944 3944
  	 * @param string $text      The text prior to being escaped.
3945 3945
 	 */
3946
-	return apply_filters( 'attribute_escape', $safe_text, $text );
3946
+	return apply_filters('attribute_escape', $safe_text, $text);
3947 3947
 }
3948 3948
 
3949 3949
 /**
@@ -3954,8 +3954,8 @@  discard block
 block discarded – undo
3954 3954
  * @param string $text
3955 3955
  * @return string
3956 3956
  */
3957
-function esc_textarea( $text ) {
3958
-	$safe_text = htmlspecialchars( $text, ENT_QUOTES, get_option( 'blog_charset' ) );
3957
+function esc_textarea($text) {
3958
+	$safe_text = htmlspecialchars($text, ENT_QUOTES, get_option('blog_charset'));
3959 3959
 	/**
3960 3960
 	 * Filters a string cleaned and escaped for output in a textarea element.
3961 3961
 	 *
@@ -3964,7 +3964,7 @@  discard block
 block discarded – undo
3964 3964
 	 * @param string $safe_text The text after it has been escaped.
3965 3965
  	 * @param string $text      The text prior to being escaped.
3966 3966
 	 */
3967
-	return apply_filters( 'esc_textarea', $safe_text, $text );
3967
+	return apply_filters('esc_textarea', $safe_text, $text);
3968 3968
 }
3969 3969
 
3970 3970
 /**
@@ -3975,8 +3975,8 @@  discard block
 block discarded – undo
3975 3975
  * @param string $tag_name
3976 3976
  * @return string
3977 3977
  */
3978
-function tag_escape( $tag_name ) {
3979
-	$safe_tag = strtolower( preg_replace('/[^a-zA-Z0-9_:]/', '', $tag_name) );
3978
+function tag_escape($tag_name) {
3979
+	$safe_tag = strtolower(preg_replace('/[^a-zA-Z0-9_:]/', '', $tag_name));
3980 3980
 	/**
3981 3981
 	 * Filters a string cleaned and escaped for output as an HTML tag.
3982 3982
 	 *
@@ -3985,7 +3985,7 @@  discard block
 block discarded – undo
3985 3985
 	 * @param string $safe_tag The tag name after it has been escaped.
3986 3986
  	 * @param string $tag_name The text before it was escaped.
3987 3987
 	 */
3988
-	return apply_filters( 'tag_escape', $safe_tag, $tag_name );
3988
+	return apply_filters('tag_escape', $safe_tag, $tag_name);
3989 3989
 }
3990 3990
 
3991 3991
 /**
@@ -4000,8 +4000,8 @@  discard block
 block discarded – undo
4000 4000
  * @param string $link Full URL path.
4001 4001
  * @return string Absolute path.
4002 4002
  */
4003
-function wp_make_link_relative( $link ) {
4004
-	return preg_replace( '|^(https?:)?//[^/]+(/?.*)|i', '$2', $link );
4003
+function wp_make_link_relative($link) {
4004
+	return preg_replace('|^(https?:)?//[^/]+(/?.*)|i', '$2', $link);
4005 4005
 }
4006 4006
 
4007 4007
 /**
@@ -4018,22 +4018,22 @@  discard block
 block discarded – undo
4018 4018
  * @param string $value  The unsanitised value.
4019 4019
  * @return string Sanitized value.
4020 4020
  */
4021
-function sanitize_option( $option, $value ) {
4021
+function sanitize_option($option, $value) {
4022 4022
 	global $wpdb;
4023 4023
 
4024 4024
 	$original_value = $value;
4025 4025
 	$error = '';
4026 4026
 
4027
-	switch ( $option ) {
4027
+	switch ($option) {
4028 4028
 		case 'admin_email' :
4029 4029
 		case 'new_admin_email' :
4030
-			$value = $wpdb->strip_invalid_text_for_column( $wpdb->options, 'option_value', $value );
4031
-			if ( is_wp_error( $value ) ) {
4030
+			$value = $wpdb->strip_invalid_text_for_column($wpdb->options, 'option_value', $value);
4031
+			if (is_wp_error($value)) {
4032 4032
 				$error = $value->get_error_message();
4033 4033
 			} else {
4034
-				$value = sanitize_email( $value );
4035
-				if ( ! is_email( $value ) ) {
4036
-					$error = __( 'The email address entered did not appear to be a valid email address. Please enter a valid email address.' );
4034
+				$value = sanitize_email($value);
4035
+				if ( ! is_email($value)) {
4036
+					$error = __('The email address entered did not appear to be a valid email address. Please enter a valid email address.');
4037 4037
 				}
4038 4038
 			}
4039 4039
 			break;
@@ -4060,36 +4060,36 @@  discard block
 block discarded – undo
4060 4060
 		case 'users_can_register':
4061 4061
 		case 'start_of_week':
4062 4062
 		case 'site_icon':
4063
-			$value = absint( $value );
4063
+			$value = absint($value);
4064 4064
 			break;
4065 4065
 
4066 4066
 		case 'posts_per_page':
4067 4067
 		case 'posts_per_rss':
4068 4068
 			$value = (int) $value;
4069
-			if ( empty($value) )
4069
+			if (empty($value))
4070 4070
 				$value = 1;
4071
-			if ( $value < -1 )
4071
+			if ($value < -1)
4072 4072
 				$value = abs($value);
4073 4073
 			break;
4074 4074
 
4075 4075
 		case 'default_ping_status':
4076 4076
 		case 'default_comment_status':
4077 4077
 			// Options that if not there have 0 value but need to be something like "closed"
4078
-			if ( $value == '0' || $value == '')
4078
+			if ($value == '0' || $value == '')
4079 4079
 				$value = 'closed';
4080 4080
 			break;
4081 4081
 
4082 4082
 		case 'blogdescription':
4083 4083
 		case 'blogname':
4084
-			$value = $wpdb->strip_invalid_text_for_column( $wpdb->options, 'option_value', $value );
4085
-			if ( $value !== $original_value ) {
4086
-				$value = $wpdb->strip_invalid_text_for_column( $wpdb->options, 'option_value', wp_encode_emoji( $original_value ) );
4084
+			$value = $wpdb->strip_invalid_text_for_column($wpdb->options, 'option_value', $value);
4085
+			if ($value !== $original_value) {
4086
+				$value = $wpdb->strip_invalid_text_for_column($wpdb->options, 'option_value', wp_encode_emoji($original_value));
4087 4087
 			}
4088 4088
 
4089
-			if ( is_wp_error( $value ) ) {
4089
+			if (is_wp_error($value)) {
4090 4090
 				$error = $value->get_error_message();
4091 4091
 			} else {
4092
-				$value = esc_html( $value );
4092
+				$value = esc_html($value);
4093 4093
 			}
4094 4094
 			break;
4095 4095
 
@@ -4099,10 +4099,10 @@  discard block
 block discarded – undo
4099 4099
 
4100 4100
 		case 'blog_public':
4101 4101
 			// This is the value if the settings checkbox is not checked on POST. Don't rely on this.
4102
-			if ( null === $value )
4102
+			if (null === $value)
4103 4103
 				$value = 1;
4104 4104
 			else
4105
-				$value = intval( $value );
4105
+				$value = intval($value);
4106 4106
 			break;
4107 4107
 
4108 4108
 		case 'date_format':
@@ -4111,20 +4111,20 @@  discard block
 block discarded – undo
4111 4111
 		case 'mailserver_login':
4112 4112
 		case 'mailserver_pass':
4113 4113
 		case 'upload_path':
4114
-			$value = $wpdb->strip_invalid_text_for_column( $wpdb->options, 'option_value', $value );
4115
-			if ( is_wp_error( $value ) ) {
4114
+			$value = $wpdb->strip_invalid_text_for_column($wpdb->options, 'option_value', $value);
4115
+			if (is_wp_error($value)) {
4116 4116
 				$error = $value->get_error_message();
4117 4117
 			} else {
4118
-				$value = strip_tags( $value );
4119
-				$value = wp_kses_data( $value );
4118
+				$value = strip_tags($value);
4119
+				$value = wp_kses_data($value);
4120 4120
 			}
4121 4121
 			break;
4122 4122
 
4123 4123
 		case 'ping_sites':
4124
-			$value = explode( "\n", $value );
4125
-			$value = array_filter( array_map( 'trim', $value ) );
4126
-			$value = array_filter( array_map( 'esc_url_raw', $value ) );
4127
-			$value = implode( "\n", $value );
4124
+			$value = explode("\n", $value);
4125
+			$value = array_filter(array_map('trim', $value));
4126
+			$value = array_filter(array_map('esc_url_raw', $value));
4127
+			$value = implode("\n", $value);
4128 4128
 			break;
4129 4129
 
4130 4130
 		case 'gmt_offset':
@@ -4132,128 +4132,128 @@  discard block
 block discarded – undo
4132 4132
 			break;
4133 4133
 
4134 4134
 		case 'siteurl':
4135
-			$value = $wpdb->strip_invalid_text_for_column( $wpdb->options, 'option_value', $value );
4136
-			if ( is_wp_error( $value ) ) {
4135
+			$value = $wpdb->strip_invalid_text_for_column($wpdb->options, 'option_value', $value);
4136
+			if (is_wp_error($value)) {
4137 4137
 				$error = $value->get_error_message();
4138 4138
 			} else {
4139
-				if ( preg_match( '#http(s?)://(.+)#i', $value ) ) {
4140
-					$value = esc_url_raw( $value );
4139
+				if (preg_match('#http(s?)://(.+)#i', $value)) {
4140
+					$value = esc_url_raw($value);
4141 4141
 				} else {
4142
-					$error = __( 'The WordPress address you entered did not appear to be a valid URL. Please enter a valid URL.' );
4142
+					$error = __('The WordPress address you entered did not appear to be a valid URL. Please enter a valid URL.');
4143 4143
 				}
4144 4144
 			}
4145 4145
 			break;
4146 4146
 
4147 4147
 		case 'home':
4148
-			$value = $wpdb->strip_invalid_text_for_column( $wpdb->options, 'option_value', $value );
4149
-			if ( is_wp_error( $value ) ) {
4148
+			$value = $wpdb->strip_invalid_text_for_column($wpdb->options, 'option_value', $value);
4149
+			if (is_wp_error($value)) {
4150 4150
 				$error = $value->get_error_message();
4151 4151
 			} else {
4152
-				if ( preg_match( '#http(s?)://(.+)#i', $value ) ) {
4153
-					$value = esc_url_raw( $value );
4152
+				if (preg_match('#http(s?)://(.+)#i', $value)) {
4153
+					$value = esc_url_raw($value);
4154 4154
 				} else {
4155
-					$error = __( 'The Site address you entered did not appear to be a valid URL. Please enter a valid URL.' );
4155
+					$error = __('The Site address you entered did not appear to be a valid URL. Please enter a valid URL.');
4156 4156
 				}
4157 4157
 			}
4158 4158
 			break;
4159 4159
 
4160 4160
 		case 'WPLANG':
4161 4161
 			$allowed = get_available_languages();
4162
-			if ( ! is_multisite() && defined( 'WPLANG' ) && '' !== WPLANG && 'en_US' !== WPLANG ) {
4162
+			if ( ! is_multisite() && defined('WPLANG') && '' !== WPLANG && 'en_US' !== WPLANG) {
4163 4163
 				$allowed[] = WPLANG;
4164 4164
 			}
4165
-			if ( ! in_array( $value, $allowed ) && ! empty( $value ) ) {
4166
-				$value = get_option( $option );
4165
+			if ( ! in_array($value, $allowed) && ! empty($value)) {
4166
+				$value = get_option($option);
4167 4167
 			}
4168 4168
 			break;
4169 4169
 
4170 4170
 		case 'illegal_names':
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 ( ! is_array( $value ) )
4176
-					$value = explode( ' ', $value );
4175
+				if ( ! is_array($value))
4176
+					$value = explode(' ', $value);
4177 4177
 
4178
-				$value = array_values( array_filter( array_map( 'trim', $value ) ) );
4178
+				$value = array_values(array_filter(array_map('trim', $value)));
4179 4179
 
4180
-				if ( ! $value )
4180
+				if ( ! $value)
4181 4181
 					$value = '';
4182 4182
 			}
4183 4183
 			break;
4184 4184
 
4185 4185
 		case 'limited_email_domains':
4186 4186
 		case 'banned_email_domains':
4187
-			$value = $wpdb->strip_invalid_text_for_column( $wpdb->options, 'option_value', $value );
4188
-			if ( is_wp_error( $value ) ) {
4187
+			$value = $wpdb->strip_invalid_text_for_column($wpdb->options, 'option_value', $value);
4188
+			if (is_wp_error($value)) {
4189 4189
 				$error = $value->get_error_message();
4190 4190
 			} else {
4191
-				if ( ! is_array( $value ) )
4192
-					$value = explode( "\n", $value );
4191
+				if ( ! is_array($value))
4192
+					$value = explode("\n", $value);
4193 4193
 
4194
-				$domains = array_values( array_filter( array_map( 'trim', $value ) ) );
4194
+				$domains = array_values(array_filter(array_map('trim', $value)));
4195 4195
 				$value = array();
4196 4196
 
4197
-				foreach ( $domains as $domain ) {
4198
-					if ( ! preg_match( '/(--|\.\.)/', $domain ) && preg_match( '|^([a-zA-Z0-9-\.])+$|', $domain ) ) {
4197
+				foreach ($domains as $domain) {
4198
+					if ( ! preg_match('/(--|\.\.)/', $domain) && preg_match('|^([a-zA-Z0-9-\.])+$|', $domain)) {
4199 4199
 						$value[] = $domain;
4200 4200
 					}
4201 4201
 				}
4202
-				if ( ! $value )
4202
+				if ( ! $value)
4203 4203
 					$value = '';
4204 4204
 			}
4205 4205
 			break;
4206 4206
 
4207 4207
 		case 'timezone_string':
4208 4208
 			$allowed_zones = timezone_identifiers_list();
4209
-			if ( ! in_array( $value, $allowed_zones ) && ! empty( $value ) ) {
4210
-				$error = __( 'The timezone you have entered is not valid. Please select a valid timezone.' );
4209
+			if ( ! in_array($value, $allowed_zones) && ! empty($value)) {
4210
+				$error = __('The timezone you have entered is not valid. Please select a valid timezone.');
4211 4211
 			}
4212 4212
 			break;
4213 4213
 
4214 4214
 		case 'permalink_structure':
4215 4215
 		case 'category_base':
4216 4216
 		case 'tag_base':
4217
-			$value = $wpdb->strip_invalid_text_for_column( $wpdb->options, 'option_value', $value );
4218
-			if ( is_wp_error( $value ) ) {
4217
+			$value = $wpdb->strip_invalid_text_for_column($wpdb->options, 'option_value', $value);
4218
+			if (is_wp_error($value)) {
4219 4219
 				$error = $value->get_error_message();
4220 4220
 			} else {
4221
-				$value = esc_url_raw( $value );
4222
-				$value = str_replace( 'http://', '', $value );
4221
+				$value = esc_url_raw($value);
4222
+				$value = str_replace('http://', '', $value);
4223 4223
 			}
4224 4224
 
4225
-			if ( 'permalink_structure' === $option && '' !== $value && ! preg_match( '/%[^\/%]+%/', $value ) ) {
4225
+			if ('permalink_structure' === $option && '' !== $value && ! preg_match('/%[^\/%]+%/', $value)) {
4226 4226
 				$error = sprintf(
4227 4227
 					/* translators: %s: Codex URL */
4228
-					__( 'A structure tag is required when using custom permalinks. <a href="%s">Learn more</a>' ),
4229
-					__( 'https://codex.wordpress.org/Using_Permalinks#Choosing_your_permalink_structure' )
4228
+					__('A structure tag is required when using custom permalinks. <a href="%s">Learn more</a>'),
4229
+					__('https://codex.wordpress.org/Using_Permalinks#Choosing_your_permalink_structure')
4230 4230
 				);
4231 4231
 			}
4232 4232
 			break;
4233 4233
 
4234 4234
 		case 'default_role' :
4235
-			if ( ! get_role( $value ) && get_role( 'subscriber' ) )
4235
+			if ( ! get_role($value) && get_role('subscriber'))
4236 4236
 				$value = 'subscriber';
4237 4237
 			break;
4238 4238
 
4239 4239
 		case 'moderation_keys':
4240 4240
 		case 'blacklist_keys':
4241
-			$value = $wpdb->strip_invalid_text_for_column( $wpdb->options, 'option_value', $value );
4242
-			if ( is_wp_error( $value ) ) {
4241
+			$value = $wpdb->strip_invalid_text_for_column($wpdb->options, 'option_value', $value);
4242
+			if (is_wp_error($value)) {
4243 4243
 				$error = $value->get_error_message();
4244 4244
 			} else {
4245
-				$value = explode( "\n", $value );
4246
-				$value = array_filter( array_map( 'trim', $value ) );
4247
-				$value = array_unique( $value );
4248
-				$value = implode( "\n", $value );
4245
+				$value = explode("\n", $value);
4246
+				$value = array_filter(array_map('trim', $value));
4247
+				$value = array_unique($value);
4248
+				$value = implode("\n", $value);
4249 4249
 			}
4250 4250
 			break;
4251 4251
 	}
4252 4252
 
4253
-	if ( ! empty( $error ) ) {
4254
-		$value = get_option( $option );
4255
-		if ( function_exists( 'add_settings_error' ) ) {
4256
-			add_settings_error( $option, "invalid_{$option}", $error );
4253
+	if ( ! empty($error)) {
4254
+		$value = get_option($option);
4255
+		if (function_exists('add_settings_error')) {
4256
+			add_settings_error($option, "invalid_{$option}", $error);
4257 4257
 		}
4258 4258
 	}
4259 4259
 
@@ -4267,7 +4267,7 @@  discard block
 block discarded – undo
4267 4267
 	 * @param string $option         The option name.
4268 4268
 	 * @param string $original_value The original value passed to the function.
4269 4269
 	 */
4270
-	return apply_filters( "sanitize_option_{$option}", $value, $option, $original_value );
4270
+	return apply_filters("sanitize_option_{$option}", $value, $option, $original_value);
4271 4271
 }
4272 4272
 
4273 4273
 /**
@@ -4281,18 +4281,18 @@  discard block
 block discarded – undo
4281 4281
  * @param callable $callback The function to map onto $value.
4282 4282
  * @return mixed The value with the callback applied to all non-arrays and non-objects inside it.
4283 4283
  */
4284
-function map_deep( $value, $callback ) {
4285
-	if ( is_array( $value ) ) {
4286
-		foreach ( $value as $index => $item ) {
4287
-			$value[ $index ] = map_deep( $item, $callback );
4284
+function map_deep($value, $callback) {
4285
+	if (is_array($value)) {
4286
+		foreach ($value as $index => $item) {
4287
+			$value[$index] = map_deep($item, $callback);
4288 4288
 		}
4289
-	} elseif ( is_object( $value ) ) {
4290
-		$object_vars = get_object_vars( $value );
4291
-		foreach ( $object_vars as $property_name => $property_value ) {
4292
-			$value->$property_name = map_deep( $property_value, $callback );
4289
+	} elseif (is_object($value)) {
4290
+		$object_vars = get_object_vars($value);
4291
+		foreach ($object_vars as $property_name => $property_value) {
4292
+			$value->$property_name = map_deep($property_value, $callback);
4293 4293
 		}
4294 4294
 	} else {
4295
-		$value = call_user_func( $callback, $value );
4295
+		$value = call_user_func($callback, $value);
4296 4296
 	}
4297 4297
 
4298 4298
 	return $value;
@@ -4309,10 +4309,10 @@  discard block
 block discarded – undo
4309 4309
  * @param string $string The string to be parsed.
4310 4310
  * @param array  $array  Variables will be stored in this array.
4311 4311
  */
4312
-function wp_parse_str( $string, &$array ) {
4313
-	parse_str( $string, $array );
4314
-	if ( get_magic_quotes_gpc() )
4315
-		$array = stripslashes_deep( $array );
4312
+function wp_parse_str($string, &$array) {
4313
+	parse_str($string, $array);
4314
+	if (get_magic_quotes_gpc())
4315
+		$array = stripslashes_deep($array);
4316 4316
 	/**
4317 4317
 	 * Filters the array of variables derived from a parsed string.
4318 4318
 	 *
@@ -4320,7 +4320,7 @@  discard block
 block discarded – undo
4320 4320
 	 *
4321 4321
 	 * @param array $array The array populated with variables.
4322 4322
 	 */
4323
-	$array = apply_filters( 'wp_parse_str', $array );
4323
+	$array = apply_filters('wp_parse_str', $array);
4324 4324
 }
4325 4325
 
4326 4326
 /**
@@ -4333,7 +4333,7 @@  discard block
 block discarded – undo
4333 4333
  * @param string $text Text to be converted.
4334 4334
  * @return string Converted text.
4335 4335
  */
4336
-function wp_pre_kses_less_than( $text ) {
4336
+function wp_pre_kses_less_than($text) {
4337 4337
 	return preg_replace_callback('%<[^>]*?((?=<)|>|$)%', 'wp_pre_kses_less_than_callback', $text);
4338 4338
 }
4339 4339
 
@@ -4345,8 +4345,8 @@  discard block
 block discarded – undo
4345 4345
  * @param array $matches Populated by matches to preg_replace.
4346 4346
  * @return string The text returned after esc_html if needed.
4347 4347
  */
4348
-function wp_pre_kses_less_than_callback( $matches ) {
4349
-	if ( false === strpos($matches[0], '>') )
4348
+function wp_pre_kses_less_than_callback($matches) {
4349
+	if (false === strpos($matches[0], '>'))
4350 4350
 		return esc_html($matches[0]);
4351 4351
 	return $matches[0];
4352 4352
 }
@@ -4361,21 +4361,21 @@  discard block
 block discarded – undo
4361 4361
  * @param mixed  $args ,... Arguments to be formatted into the $pattern string.
4362 4362
  * @return string The formatted string.
4363 4363
  */
4364
-function wp_sprintf( $pattern ) {
4364
+function wp_sprintf($pattern) {
4365 4365
 	$args = func_get_args();
4366 4366
 	$len = strlen($pattern);
4367 4367
 	$start = 0;
4368 4368
 	$result = '';
4369 4369
 	$arg_index = 0;
4370
-	while ( $len > $start ) {
4370
+	while ($len > $start) {
4371 4371
 		// Last character: append and break
4372
-		if ( strlen($pattern) - 1 == $start ) {
4372
+		if (strlen($pattern) - 1 == $start) {
4373 4373
 			$result .= substr($pattern, -1);
4374 4374
 			break;
4375 4375
 		}
4376 4376
 
4377 4377
 		// Literal %: append and continue
4378
-		if ( substr($pattern, $start, 2) == '%%' ) {
4378
+		if (substr($pattern, $start, 2) == '%%') {
4379 4379
 			$start += 2;
4380 4380
 			$result .= '%';
4381 4381
 			continue;
@@ -4383,14 +4383,14 @@  discard block
 block discarded – undo
4383 4383
 
4384 4384
 		// Get fragment before next %
4385 4385
 		$end = strpos($pattern, '%', $start + 1);
4386
-		if ( false === $end )
4386
+		if (false === $end)
4387 4387
 			$end = $len;
4388 4388
 		$fragment = substr($pattern, $start, $end - $start);
4389 4389
 
4390 4390
 		// Fragment has a specifier
4391
-		if ( $pattern[$start] == '%' ) {
4391
+		if ($pattern[$start] == '%') {
4392 4392
 			// Find numbered arguments or take the next one in order
4393
-			if ( preg_match('/^%(\d+)\$/', $fragment, $matches) ) {
4393
+			if (preg_match('/^%(\d+)\$/', $fragment, $matches)) {
4394 4394
 				$arg = isset($args[$matches[1]]) ? $args[$matches[1]] : '';
4395 4395
 				$fragment = str_replace("%{$matches[1]}$", '%', $fragment);
4396 4396
 			} else {
@@ -4408,11 +4408,11 @@  discard block
 block discarded – undo
4408 4408
 			 * @param string $fragment A fragment from the pattern.
4409 4409
 			 * @param string $arg      The argument.
4410 4410
 			 */
4411
-			$_fragment = apply_filters( 'wp_sprintf', $fragment, $arg );
4412
-			if ( $_fragment != $fragment )
4411
+			$_fragment = apply_filters('wp_sprintf', $fragment, $arg);
4412
+			if ($_fragment != $fragment)
4413 4413
 				$fragment = $_fragment;
4414 4414
 			else
4415
-				$fragment = sprintf($fragment, strval($arg) );
4415
+				$fragment = sprintf($fragment, strval($arg));
4416 4416
 		}
4417 4417
 
4418 4418
 		// Append to result and move to next fragment
@@ -4435,13 +4435,13 @@  discard block
 block discarded – undo
4435 4435
  * @param array  $args    List items to prepend to the content and replace '%l'.
4436 4436
  * @return string Localized list items and rest of the content.
4437 4437
  */
4438
-function wp_sprintf_l( $pattern, $args ) {
4438
+function wp_sprintf_l($pattern, $args) {
4439 4439
 	// Not a match
4440
-	if ( substr($pattern, 0, 2) != '%l' )
4440
+	if (substr($pattern, 0, 2) != '%l')
4441 4441
 		return $pattern;
4442 4442
 
4443 4443
 	// Nothing to work with
4444
-	if ( empty($args) )
4444
+	if (empty($args))
4445 4445
 		return '';
4446 4446
 
4447 4447
 	/**
@@ -4455,30 +4455,30 @@  discard block
 block discarded – undo
4455 4455
 	 *
4456 4456
 	 * @param array $delimiters An array of translated delimiters.
4457 4457
 	 */
4458
-	$l = apply_filters( 'wp_sprintf_l', array(
4458
+	$l = apply_filters('wp_sprintf_l', array(
4459 4459
 		/* translators: used to join items in a list with more than 2 items */
4460
-		'between'          => sprintf( __('%s, %s'), '', '' ),
4460
+		'between'          => sprintf(__('%s, %s'), '', ''),
4461 4461
 		/* translators: used to join last two items in a list with more than 2 times */
4462
-		'between_last_two' => sprintf( __('%s, and %s'), '', '' ),
4462
+		'between_last_two' => sprintf(__('%s, and %s'), '', ''),
4463 4463
 		/* translators: used to join items in a list with only 2 items */
4464
-		'between_only_two' => sprintf( __('%s and %s'), '', '' ),
4465
-	) );
4464
+		'between_only_two' => sprintf(__('%s and %s'), '', ''),
4465
+	));
4466 4466
 
4467 4467
 	$args = (array) $args;
4468 4468
 	$result = array_shift($args);
4469
-	if ( count($args) == 1 )
4470
-		$result .= $l['between_only_two'] . array_shift($args);
4469
+	if (count($args) == 1)
4470
+		$result .= $l['between_only_two'].array_shift($args);
4471 4471
 	// Loop when more than two args
4472 4472
 	$i = count($args);
4473
-	while ( $i ) {
4473
+	while ($i) {
4474 4474
 		$arg = array_shift($args);
4475 4475
 		$i--;
4476
-		if ( 0 == $i )
4477
-			$result .= $l['between_last_two'] . $arg;
4476
+		if (0 == $i)
4477
+			$result .= $l['between_last_two'].$arg;
4478 4478
 		else
4479
-			$result .= $l['between'] . $arg;
4479
+			$result .= $l['between'].$arg;
4480 4480
 	}
4481
-	return $result . substr($pattern, 2);
4481
+	return $result.substr($pattern, 2);
4482 4482
 }
4483 4483
 
4484 4484
 /**
@@ -4495,15 +4495,15 @@  discard block
 block discarded – undo
4495 4495
  * @param string $more  Optional. What to append if $str needs to be trimmed. Defaults to empty string.
4496 4496
  * @return string The excerpt.
4497 4497
  */
4498
-function wp_html_excerpt( $str, $count, $more = null ) {
4499
-	if ( null === $more )
4498
+function wp_html_excerpt($str, $count, $more = null) {
4499
+	if (null === $more)
4500 4500
 		$more = '';
4501
-	$str = wp_strip_all_tags( $str, true );
4502
-	$excerpt = mb_substr( $str, 0, $count );
4501
+	$str = wp_strip_all_tags($str, true);
4502
+	$excerpt = mb_substr($str, 0, $count);
4503 4503
 	// remove part of an entity at the end
4504
-	$excerpt = preg_replace( '/&[^;\s]{0,6}$/', '', $excerpt );
4505
-	if ( $str != $excerpt )
4506
-		$excerpt = trim( $excerpt ) . $more;
4504
+	$excerpt = preg_replace('/&[^;\s]{0,6}$/', '', $excerpt);
4505
+	if ($str != $excerpt)
4506
+		$excerpt = trim($excerpt).$more;
4507 4507
 	return $excerpt;
4508 4508
 }
4509 4509
 
@@ -4522,11 +4522,11 @@  discard block
 block discarded – undo
4522 4522
  * @param array  $attrs   The attributes which should be processed.
4523 4523
  * @return string The processed content.
4524 4524
  */
4525
-function links_add_base_url( $content, $base, $attrs = array('src', 'href') ) {
4525
+function links_add_base_url($content, $base, $attrs = array('src', 'href')) {
4526 4526
 	global $_links_add_base;
4527 4527
 	$_links_add_base = $base;
4528
-	$attrs = implode('|', (array)$attrs);
4529
-	return preg_replace_callback( "!($attrs)=(['\"])(.+?)\\2!i", '_links_add_base', $content );
4528
+	$attrs = implode('|', (array) $attrs);
4529
+	return preg_replace_callback("!($attrs)=(['\"])(.+?)\\2!i", '_links_add_base', $content);
4530 4530
 }
4531 4531
 
4532 4532
 /**
@@ -4540,13 +4540,12 @@  discard block
 block discarded – undo
4540 4540
  * @param string $m The matched link.
4541 4541
  * @return string The processed link.
4542 4542
  */
4543
-function _links_add_base( $m ) {
4543
+function _links_add_base($m) {
4544 4544
 	global $_links_add_base;
4545 4545
 	//1 = attribute name  2 = quotation mark  3 = URL
4546
-	return $m[1] . '=' . $m[2] .
4547
-		( preg_match( '#^(\w{1,20}):#', $m[3], $protocol ) && in_array( $protocol[1], wp_allowed_protocols() ) ?
4548
-			$m[3] :
4549
-			WP_Http::make_absolute_url( $m[3], $_links_add_base )
4546
+	return $m[1].'='.$m[2].
4547
+		(preg_match('#^(\w{1,20}):#', $m[3], $protocol) && in_array($protocol[1], wp_allowed_protocols()) ?
4548
+			$m[3] : WP_Http::make_absolute_url($m[3], $_links_add_base)
4550 4549
 		)
4551 4550
 		. $m[2];
4552 4551
 }
@@ -4568,11 +4567,11 @@  discard block
 block discarded – undo
4568 4567
  * @param array  $tags    An array of tags to apply to.
4569 4568
  * @return string The processed content.
4570 4569
  */
4571
-function links_add_target( $content, $target = '_blank', $tags = array('a') ) {
4570
+function links_add_target($content, $target = '_blank', $tags = array('a')) {
4572 4571
 	global $_links_add_target;
4573 4572
 	$_links_add_target = $target;
4574
-	$tags = implode('|', (array)$tags);
4575
-	return preg_replace_callback( "!<($tags)([^>]*)>!i", '_links_add_target', $content );
4573
+	$tags = implode('|', (array) $tags);
4574
+	return preg_replace_callback("!<($tags)([^>]*)>!i", '_links_add_target', $content);
4576 4575
 }
4577 4576
 
4578 4577
 /**
@@ -4586,11 +4585,11 @@  discard block
 block discarded – undo
4586 4585
  * @param string $m The matched link.
4587 4586
  * @return string The processed link.
4588 4587
  */
4589
-function _links_add_target( $m ) {
4588
+function _links_add_target($m) {
4590 4589
 	global $_links_add_target;
4591 4590
 	$tag = $m[1];
4592 4591
 	$link = preg_replace('|( target=([\'"])(.*?)\2)|i', '', $m[2]);
4593
-	return '<' . $tag . $link . ' target="' . esc_attr( $_links_add_target ) . '">';
4592
+	return '<'.$tag.$link.' target="'.esc_attr($_links_add_target).'">';
4594 4593
 }
4595 4594
 
4596 4595
 /**
@@ -4601,10 +4600,10 @@  discard block
 block discarded – undo
4601 4600
  * @param string $str The string to normalize.
4602 4601
  * @return string The normalized string.
4603 4602
  */
4604
-function normalize_whitespace( $str ) {
4605
-	$str  = trim( $str );
4606
-	$str  = str_replace( "\r", "\n", $str );
4607
-	$str  = preg_replace( array( '/\n+/', '/[ \t]+/' ), array( "\n", ' ' ), $str );
4603
+function normalize_whitespace($str) {
4604
+	$str  = trim($str);
4605
+	$str  = str_replace("\r", "\n", $str);
4606
+	$str  = preg_replace(array('/\n+/', '/[ \t]+/'), array("\n", ' '), $str);
4608 4607
 	return $str;
4609 4608
 }
4610 4609
 
@@ -4622,13 +4621,13 @@  discard block
 block discarded – undo
4622 4621
  * @return string The processed string.
4623 4622
  */
4624 4623
 function wp_strip_all_tags($string, $remove_breaks = false) {
4625
-	$string = preg_replace( '@<(script|style)[^>]*?>.*?</\\1>@si', '', $string );
4624
+	$string = preg_replace('@<(script|style)[^>]*?>.*?</\\1>@si', '', $string);
4626 4625
 	$string = strip_tags($string);
4627 4626
 
4628
-	if ( $remove_breaks )
4627
+	if ($remove_breaks)
4629 4628
 		$string = preg_replace('/[\r\n\t ]+/', ' ', $string);
4630 4629
 
4631
-	return trim( $string );
4630
+	return trim($string);
4632 4631
 }
4633 4632
 
4634 4633
 /**
@@ -4648,26 +4647,26 @@  discard block
 block discarded – undo
4648 4647
  * @param string $str String to sanitize.
4649 4648
  * @return string Sanitized string.
4650 4649
  */
4651
-function sanitize_text_field( $str ) {
4652
-	$filtered = wp_check_invalid_utf8( $str );
4650
+function sanitize_text_field($str) {
4651
+	$filtered = wp_check_invalid_utf8($str);
4653 4652
 
4654
-	if ( strpos($filtered, '<') !== false ) {
4655
-		$filtered = wp_pre_kses_less_than( $filtered );
4653
+	if (strpos($filtered, '<') !== false) {
4654
+		$filtered = wp_pre_kses_less_than($filtered);
4656 4655
 		// This will strip extra whitespace for us.
4657
-		$filtered = wp_strip_all_tags( $filtered, true );
4656
+		$filtered = wp_strip_all_tags($filtered, true);
4658 4657
 	} else {
4659
-		$filtered = trim( preg_replace('/[\r\n\t ]+/', ' ', $filtered) );
4658
+		$filtered = trim(preg_replace('/[\r\n\t ]+/', ' ', $filtered));
4660 4659
 	}
4661 4660
 
4662 4661
 	$found = false;
4663
-	while ( preg_match('/%[a-f0-9]{2}/i', $filtered, $match) ) {
4662
+	while (preg_match('/%[a-f0-9]{2}/i', $filtered, $match)) {
4664 4663
 		$filtered = str_replace($match[0], '', $filtered);
4665 4664
 		$found = true;
4666 4665
 	}
4667 4666
 
4668
-	if ( $found ) {
4667
+	if ($found) {
4669 4668
 		// Strip out the whitespace that may now exist after removing the octets.
4670
-		$filtered = trim( preg_replace('/ +/', ' ', $filtered) );
4669
+		$filtered = trim(preg_replace('/ +/', ' ', $filtered));
4671 4670
 	}
4672 4671
 
4673 4672
 	/**
@@ -4678,7 +4677,7 @@  discard block
 block discarded – undo
4678 4677
 	 * @param string $filtered The sanitized string.
4679 4678
 	 * @param string $str      The string prior to being sanitized.
4680 4679
 	 */
4681
-	return apply_filters( 'sanitize_text_field', $filtered, $str );
4680
+	return apply_filters('sanitize_text_field', $filtered, $str);
4682 4681
 }
4683 4682
 
4684 4683
 /**
@@ -4690,8 +4689,8 @@  discard block
 block discarded – undo
4690 4689
  * @param string $suffix If the filename ends in suffix this will also be cut off.
4691 4690
  * @return string
4692 4691
  */
4693
-function wp_basename( $path, $suffix = '' ) {
4694
-	return urldecode( basename( str_replace( array( '%2F', '%5C' ), '/', urlencode( $path ) ), $suffix ) );
4692
+function wp_basename($path, $suffix = '') {
4693
+	return urldecode(basename(str_replace(array('%2F', '%5C'), '/', urlencode($path)), $suffix));
4695 4694
 }
4696 4695
 
4697 4696
 /**
@@ -4706,19 +4705,19 @@  discard block
 block discarded – undo
4706 4705
  * @param string $text The text to be modified.
4707 4706
  * @return string The modified text.
4708 4707
  */
4709
-function capital_P_dangit( $text ) {
4708
+function capital_P_dangit($text) {
4710 4709
 	// Simple replacement for titles
4711 4710
 	$current_filter = current_filter();
4712
-	if ( 'the_title' === $current_filter || 'wp_title' === $current_filter )
4713
-		return str_replace( 'Wordpress', 'WordPress', $text );
4711
+	if ('the_title' === $current_filter || 'wp_title' === $current_filter)
4712
+		return str_replace('Wordpress', 'WordPress', $text);
4714 4713
 	// Still here? Use the more judicious replacement
4715 4714
 	static $dblq = false;
4716
-	if ( false === $dblq ) {
4717
-		$dblq = _x( '&#8220;', 'opening curly double quote' );
4715
+	if (false === $dblq) {
4716
+		$dblq = _x('&#8220;', 'opening curly double quote');
4718 4717
 	}
4719 4718
 	return str_replace(
4720
-		array( ' Wordpress', '&#8216;Wordpress', $dblq . 'Wordpress', '>Wordpress', '(Wordpress' ),
4721
-		array( ' WordPress', '&#8216;WordPress', $dblq . 'WordPress', '>WordPress', '(WordPress' ),
4719
+		array(' Wordpress', '&#8216;Wordpress', $dblq.'Wordpress', '>Wordpress', '(Wordpress'),
4720
+		array(' WordPress', '&#8216;WordPress', $dblq.'WordPress', '>WordPress', '(WordPress'),
4722 4721
 	$text );
4723 4722
 }
4724 4723
 
@@ -4730,8 +4729,8 @@  discard block
 block discarded – undo
4730 4729
  * @param string $mime_type Mime type
4731 4730
  * @return string Sanitized mime type
4732 4731
  */
4733
-function sanitize_mime_type( $mime_type ) {
4734
-	$sani_mime_type = preg_replace( '/[^-+*.a-zA-Z0-9\/]/', '', $mime_type );
4732
+function sanitize_mime_type($mime_type) {
4733
+	$sani_mime_type = preg_replace('/[^-+*.a-zA-Z0-9\/]/', '', $mime_type);
4735 4734
 	/**
4736 4735
 	 * Filters a mime type following sanitization.
4737 4736
 	 *
@@ -4740,7 +4739,7 @@  discard block
 block discarded – undo
4740 4739
 	 * @param string $sani_mime_type The sanitized mime type.
4741 4740
 	 * @param string $mime_type      The mime type prior to sanitization.
4742 4741
 	 */
4743
-	return apply_filters( 'sanitize_mime_type', $sani_mime_type, $mime_type );
4742
+	return apply_filters('sanitize_mime_type', $sani_mime_type, $mime_type);
4744 4743
 }
4745 4744
 
4746 4745
 /**
@@ -4751,14 +4750,14 @@  discard block
 block discarded – undo
4751 4750
  * @param string $to_ping Space or carriage return separated URLs
4752 4751
  * @return string URLs starting with the http or https protocol, separated by a carriage return.
4753 4752
  */
4754
-function sanitize_trackback_urls( $to_ping ) {
4755
-	$urls_to_ping = preg_split( '/[\r\n\t ]/', trim( $to_ping ), -1, PREG_SPLIT_NO_EMPTY );
4756
-	foreach ( $urls_to_ping as $k => $url ) {
4757
-		if ( !preg_match( '#^https?://.#i', $url ) )
4758
-			unset( $urls_to_ping[$k] );
4753
+function sanitize_trackback_urls($to_ping) {
4754
+	$urls_to_ping = preg_split('/[\r\n\t ]/', trim($to_ping), -1, PREG_SPLIT_NO_EMPTY);
4755
+	foreach ($urls_to_ping as $k => $url) {
4756
+		if ( ! preg_match('#^https?://.#i', $url))
4757
+			unset($urls_to_ping[$k]);
4759 4758
 	}
4760
-	$urls_to_ping = array_map( 'esc_url_raw', $urls_to_ping );
4761
-	$urls_to_ping = implode( "\n", $urls_to_ping );
4759
+	$urls_to_ping = array_map('esc_url_raw', $urls_to_ping);
4760
+	$urls_to_ping = implode("\n", $urls_to_ping);
4762 4761
 	/**
4763 4762
 	 * Filters a list of trackback URLs following sanitization.
4764 4763
 	 *
@@ -4770,7 +4769,7 @@  discard block
 block discarded – undo
4770 4769
 	 * @param string $urls_to_ping Sanitized space or carriage return separated URLs.
4771 4770
 	 * @param string $to_ping      Space or carriage return separated URLs before sanitization.
4772 4771
 	 */
4773
-	return apply_filters( 'sanitize_trackback_urls', $urls_to_ping, $to_ping );
4772
+	return apply_filters('sanitize_trackback_urls', $urls_to_ping, $to_ping);
4774 4773
 }
4775 4774
 
4776 4775
 /**
@@ -4784,17 +4783,17 @@  discard block
 block discarded – undo
4784 4783
  * @param string|array $value String or array of strings to slash.
4785 4784
  * @return string|array Slashed $value
4786 4785
  */
4787
-function wp_slash( $value ) {
4788
-	if ( is_array( $value ) ) {
4789
-		foreach ( $value as $k => $v ) {
4790
-			if ( is_array( $v ) ) {
4791
-				$value[$k] = wp_slash( $v );
4786
+function wp_slash($value) {
4787
+	if (is_array($value)) {
4788
+		foreach ($value as $k => $v) {
4789
+			if (is_array($v)) {
4790
+				$value[$k] = wp_slash($v);
4792 4791
 			} else {
4793
-				$value[$k] = addslashes( $v );
4792
+				$value[$k] = addslashes($v);
4794 4793
 			}
4795 4794
 		}
4796 4795
 	} else {
4797
-		$value = addslashes( $value );
4796
+		$value = addslashes($value);
4798 4797
 	}
4799 4798
 
4800 4799
 	return $value;
@@ -4811,8 +4810,8 @@  discard block
 block discarded – undo
4811 4810
  * @param string|array $value String or array of strings to unslash.
4812 4811
  * @return string|array Unslashed $value
4813 4812
  */
4814
-function wp_unslash( $value ) {
4815
-	return stripslashes_deep( $value );
4813
+function wp_unslash($value) {
4814
+	return stripslashes_deep($value);
4816 4815
 }
4817 4816
 
4818 4817
 /**
@@ -4823,13 +4822,13 @@  discard block
 block discarded – undo
4823 4822
  * @param string $content A string which might contain a URL.
4824 4823
  * @return string|false The found URL.
4825 4824
  */
4826
-function get_url_in_content( $content ) {
4827
-	if ( empty( $content ) ) {
4825
+function get_url_in_content($content) {
4826
+	if (empty($content)) {
4828 4827
 		return false;
4829 4828
 	}
4830 4829
 
4831
-	if ( preg_match( '/<a\s[^>]*?href=([\'"])(.+?)\1/is', $content, $matches ) ) {
4832
-		return esc_url_raw( $matches[2] );
4830
+	if (preg_match('/<a\s[^>]*?href=([\'"])(.+?)\1/is', $content, $matches)) {
4831
+		return esc_url_raw($matches[2]);
4833 4832
 	}
4834 4833
 
4835 4834
 	return false;
@@ -4851,7 +4850,7 @@  discard block
 block discarded – undo
4851 4850
 function wp_spaces_regexp() {
4852 4851
 	static $spaces = '';
4853 4852
 
4854
-	if ( empty( $spaces ) ) {
4853
+	if (empty($spaces)) {
4855 4854
 		/**
4856 4855
 		 * Filters the regexp for common whitespace characters.
4857 4856
 		 *
@@ -4864,7 +4863,7 @@  discard block
 block discarded – undo
4864 4863
 		 *
4865 4864
 		 * @param string $spaces Regexp pattern for matching common whitespace characters.
4866 4865
 		 */
4867
-		$spaces = apply_filters( 'wp_spaces_regexp', '[\r\n\t ]|\xC2\xA0|&nbsp;' );
4866
+		$spaces = apply_filters('wp_spaces_regexp', '[\r\n\t ]|\xC2\xA0|&nbsp;');
4868 4867
 	}
4869 4868
 
4870 4869
 	return $spaces;
@@ -4880,7 +4879,7 @@  discard block
 block discarded – undo
4880 4879
 function print_emoji_styles() {
4881 4880
 	static $printed = false;
4882 4881
 
4883
-	if ( $printed ) {
4882
+	if ($printed) {
4884 4883
 		return;
4885 4884
 	}
4886 4885
 
@@ -4912,7 +4911,7 @@  discard block
 block discarded – undo
4912 4911
 function print_emoji_detection_script() {
4913 4912
 	static $printed = false;
4914 4913
 
4915
-	if ( $printed ) {
4914
+	if ($printed) {
4916 4915
 		return;
4917 4916
 	}
4918 4917
 
@@ -4941,7 +4940,7 @@  discard block
 block discarded – undo
4941 4940
 		 *
4942 4941
 		 * @param string The emoji base URL for png images.
4943 4942
 		 */
4944
-		'baseUrl' => apply_filters( 'emoji_url', 'https://s.w.org/images/core/emoji/2/72x72/' ),
4943
+		'baseUrl' => apply_filters('emoji_url', 'https://s.w.org/images/core/emoji/2/72x72/'),
4945 4944
 
4946 4945
 		/**
4947 4946
 		 * Filters the extension of the emoji png files.
@@ -4950,7 +4949,7 @@  discard block
 block discarded – undo
4950 4949
 		 *
4951 4950
 		 * @param string The emoji extension for png files. Default .png.
4952 4951
 		 */
4953
-		'ext' => apply_filters( 'emoji_ext', '.png' ),
4952
+		'ext' => apply_filters('emoji_ext', '.png'),
4954 4953
 
4955 4954
 		/**
4956 4955
 		 * Filters the URL where emoji SVG images are hosted.
@@ -4959,7 +4958,7 @@  discard block
 block discarded – undo
4959 4958
 		 *
4960 4959
 		 * @param string The emoji base URL for svg images.
4961 4960
 		 */
4962
-		'svgUrl' => apply_filters( 'emoji_svg_url', 'https://s.w.org/images/core/emoji/2/svg/' ),
4961
+		'svgUrl' => apply_filters('emoji_svg_url', 'https://s.w.org/images/core/emoji/2/svg/'),
4963 4962
 
4964 4963
 		/**
4965 4964
 		 * Filters the extension of the emoji SVG files.
@@ -4968,29 +4967,29 @@  discard block
 block discarded – undo
4968 4967
 		 *
4969 4968
 		 * @param string The emoji extension for svg files. Default .svg.
4970 4969
 		 */
4971
-		'svgExt' => apply_filters( 'emoji_svg_ext', '.svg' ),
4970
+		'svgExt' => apply_filters('emoji_svg_ext', '.svg'),
4972 4971
 	);
4973 4972
 
4974
-	$version = 'ver=' . $wp_version;
4973
+	$version = 'ver='.$wp_version;
4975 4974
 
4976
-	if ( SCRIPT_DEBUG ) {
4975
+	if (SCRIPT_DEBUG) {
4977 4976
 		$settings['source'] = array(
4978 4977
 			/** This filter is documented in wp-includes/class.wp-scripts.php */
4979
-			'wpemoji' => apply_filters( 'script_loader_src', includes_url( "js/wp-emoji.js?$version" ), 'wpemoji' ),
4978
+			'wpemoji' => apply_filters('script_loader_src', includes_url("js/wp-emoji.js?$version"), 'wpemoji'),
4980 4979
 			/** This filter is documented in wp-includes/class.wp-scripts.php */
4981
-			'twemoji' => apply_filters( 'script_loader_src', includes_url( "js/twemoji.js?$version" ), 'twemoji' ),
4980
+			'twemoji' => apply_filters('script_loader_src', includes_url("js/twemoji.js?$version"), 'twemoji'),
4982 4981
 		);
4983 4982
 
4984 4983
 		?>
4985 4984
 		<script type="text/javascript">
4986
-			window._wpemojiSettings = <?php echo wp_json_encode( $settings ); ?>;
4987
-			<?php readfile( ABSPATH . WPINC . "/js/wp-emoji-loader.js" ); ?>
4985
+			window._wpemojiSettings = <?php echo wp_json_encode($settings); ?>;
4986
+			<?php readfile(ABSPATH.WPINC."/js/wp-emoji-loader.js"); ?>
4988 4987
 		</script>
4989 4988
 		<?php
4990 4989
 	} else {
4991 4990
 		$settings['source'] = array(
4992 4991
 			/** This filter is documented in wp-includes/class.wp-scripts.php */
4993
-			'concatemoji' => apply_filters( 'script_loader_src', includes_url( "js/wp-emoji-release.min.js?$version" ), 'concatemoji' ),
4992
+			'concatemoji' => apply_filters('script_loader_src', includes_url("js/wp-emoji-release.min.js?$version"), 'concatemoji'),
4994 4993
 		);
4995 4994
 
4996 4995
 		/*
@@ -5005,7 +5004,7 @@  discard block
 block discarded – undo
5005 5004
 		 */
5006 5005
 		?>
5007 5006
 		<script type="text/javascript">
5008
-			window._wpemojiSettings = <?php echo wp_json_encode( $settings ); ?>;
5007
+			window._wpemojiSettings = <?php echo wp_json_encode($settings); ?>;
5009 5008
 			include "js/wp-emoji-loader.min.js"
5010 5009
 		</script>
5011 5010
 		<?php
@@ -5025,8 +5024,8 @@  discard block
 block discarded – undo
5025 5024
  * @param string $content The content to encode.
5026 5025
  * @return string The encoded content.
5027 5026
  */
5028
-function wp_encode_emoji( $content ) {
5029
-	if ( function_exists( 'mb_convert_encoding' ) ) {
5027
+function wp_encode_emoji($content) {
5028
+	if (function_exists('mb_convert_encoding')) {
5030 5029
 		$regex = '/(
5031 5030
 		     \x23\xE2\x83\xA3               # Digits
5032 5031
 		     [\x30-\x39]\xE2\x83\xA3
@@ -5038,18 +5037,18 @@  discard block
 block discarded – undo
5038 5037
 		)/x';
5039 5038
 
5040 5039
 		$matches = array();
5041
-		if ( preg_match_all( $regex, $content, $matches ) ) {
5042
-			if ( ! empty( $matches[1] ) ) {
5043
-				foreach ( $matches[1] as $emoji ) {
5040
+		if (preg_match_all($regex, $content, $matches)) {
5041
+			if ( ! empty($matches[1])) {
5042
+				foreach ($matches[1] as $emoji) {
5044 5043
 					/*
5045 5044
 					 * UTF-32's hex encoding is the same as HTML's hex encoding.
5046 5045
 					 * So, by converting the emoji from UTF-8 to UTF-32, we magically
5047 5046
 					 * get the correct hex encoding.
5048 5047
 					 */
5049
-					$unpacked = unpack( 'H*', mb_convert_encoding( $emoji, 'UTF-32', 'UTF-8' ) );
5050
-					if ( isset( $unpacked[1] ) ) {
5051
-						$entity = '&#x' . ltrim( $unpacked[1], '0' ) . ';';
5052
-						$content = str_replace( $emoji, $entity, $content );
5048
+					$unpacked = unpack('H*', mb_convert_encoding($emoji, 'UTF-32', 'UTF-8'));
5049
+					if (isset($unpacked[1])) {
5050
+						$entity = '&#x'.ltrim($unpacked[1], '0').';';
5051
+						$content = str_replace($emoji, $entity, $content);
5053 5052
 					}
5054 5053
 				}
5055 5054
 			}
@@ -5067,14 +5066,14 @@  discard block
 block discarded – undo
5067 5066
  * @param string $text The content to encode.
5068 5067
  * @return string The encoded content.
5069 5068
  */
5070
-function wp_staticize_emoji( $text ) {
5071
-	$text = wp_encode_emoji( $text );
5069
+function wp_staticize_emoji($text) {
5070
+	$text = wp_encode_emoji($text);
5072 5071
 
5073 5072
 	/** This filter is documented in wp-includes/formatting.php */
5074
-	$cdn_url = apply_filters( 'emoji_url', 'https://s.w.org/images/core/emoji/2/72x72/' );
5073
+	$cdn_url = apply_filters('emoji_url', 'https://s.w.org/images/core/emoji/2/72x72/');
5075 5074
 
5076 5075
 	/** This filter is documented in wp-includes/formatting.php */
5077
-	$ext = apply_filters( 'emoji_ext', '.png' );
5076
+	$ext = apply_filters('emoji_ext', '.png');
5078 5077
 
5079 5078
 	$output = '';
5080 5079
 	/*
@@ -5083,33 +5082,33 @@  discard block
 block discarded – undo
5083 5082
 	 *
5084 5083
 	 * First, capture the tags as well as in between.
5085 5084
 	 */
5086
-	$textarr = preg_split( '/(<.*>)/U', $text, -1, PREG_SPLIT_DELIM_CAPTURE );
5087
-	$stop = count( $textarr );
5085
+	$textarr = preg_split('/(<.*>)/U', $text, -1, PREG_SPLIT_DELIM_CAPTURE);
5086
+	$stop = count($textarr);
5088 5087
 
5089 5088
 	// Ignore processing of specific tags.
5090 5089
 	$tags_to_ignore = 'code|pre|style|script|textarea';
5091 5090
 	$ignore_block_element = '';
5092 5091
 
5093
-	for ( $i = 0; $i < $stop; $i++ ) {
5092
+	for ($i = 0; $i < $stop; $i++) {
5094 5093
 		$content = $textarr[$i];
5095 5094
 
5096 5095
 		// If we're in an ignore block, wait until we find its closing tag.
5097
-		if ( '' == $ignore_block_element && preg_match( '/^<(' . $tags_to_ignore . ')>/', $content, $matches ) )  {
5096
+		if ('' == $ignore_block_element && preg_match('/^<('.$tags_to_ignore.')>/', $content, $matches)) {
5098 5097
 			$ignore_block_element = $matches[1];
5099 5098
 		}
5100 5099
 
5101 5100
 		// If it's not a tag and not in ignore block.
5102
-		if ( '' ==  $ignore_block_element && strlen( $content ) > 0 && '<' != $content[0] ) {
5101
+		if ('' == $ignore_block_element && strlen($content) > 0 && '<' != $content[0]) {
5103 5102
 			$matches = array();
5104
-			if ( preg_match_all( '/(&#x1f1(e[6-9a-f]|f[0-9a-f]);){2}/', $content, $matches ) ) {
5105
-				if ( ! empty( $matches[0] ) ) {
5106
-					foreach ( $matches[0] as $flag ) {
5107
-						$chars = str_replace( array( '&#x', ';'), '', $flag );
5103
+			if (preg_match_all('/(&#x1f1(e[6-9a-f]|f[0-9a-f]);){2}/', $content, $matches)) {
5104
+				if ( ! empty($matches[0])) {
5105
+					foreach ($matches[0] as $flag) {
5106
+						$chars = str_replace(array('&#x', ';'), '', $flag);
5108 5107
 
5109
-						list( $char1, $char2 ) = str_split( $chars, 5 );
5110
-						$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 ) );
5108
+						list($char1, $char2) = str_split($chars, 5);
5109
+						$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));
5111 5110
 
5112
-						$content = str_replace( $flag, $entity, $content );
5111
+						$content = str_replace($flag, $entity, $content);
5113 5112
 					}
5114 5113
 				}
5115 5114
 			}
@@ -5118,20 +5117,20 @@  discard block
 block discarded – undo
5118 5117
 			$regex = '/(&#x[2-3][0-9a-f]{3};|&#x1f[1-6][0-9a-f]{2};)/';
5119 5118
 
5120 5119
 			$matches = array();
5121
-			if ( preg_match_all( $regex, $content, $matches ) ) {
5122
-				if ( ! empty( $matches[1] ) ) {
5123
-					foreach ( $matches[1] as $emoji ) {
5124
-						$char = str_replace( array( '&#x', ';'), '', $emoji );
5125
-						$entity = sprintf( '<img src="%s" alt="%s" class="wp-smiley" style="height: 1em; max-height: 1em;" />', $cdn_url . $char . $ext, html_entity_decode( $emoji ) );
5120
+			if (preg_match_all($regex, $content, $matches)) {
5121
+				if ( ! empty($matches[1])) {
5122
+					foreach ($matches[1] as $emoji) {
5123
+						$char = str_replace(array('&#x', ';'), '', $emoji);
5124
+						$entity = sprintf('<img src="%s" alt="%s" class="wp-smiley" style="height: 1em; max-height: 1em;" />', $cdn_url.$char.$ext, html_entity_decode($emoji));
5126 5125
 
5127
-						$content = str_replace( $emoji, $entity, $content );
5126
+						$content = str_replace($emoji, $entity, $content);
5128 5127
 					}
5129 5128
 				}
5130 5129
 			}
5131 5130
 		}
5132 5131
 
5133 5132
 		// Did we exit ignore block.
5134
-		if ( '' != $ignore_block_element && '</' . $ignore_block_element . '>' == $content )  {
5133
+		if ('' != $ignore_block_element && '</'.$ignore_block_element.'>' == $content) {
5135 5134
 			$ignore_block_element = '';
5136 5135
 		}
5137 5136
 
@@ -5149,8 +5148,8 @@  discard block
 block discarded – undo
5149 5148
  * @param array $mail The email data array.
5150 5149
  * @return array The email data array, with emoji in the message staticized.
5151 5150
  */
5152
-function wp_staticize_emoji_for_email( $mail ) {
5153
-	if ( ! isset( $mail['message'] ) ) {
5151
+function wp_staticize_emoji_for_email($mail) {
5152
+	if ( ! isset($mail['message'])) {
5154 5153
 		return $mail;
5155 5154
 	}
5156 5155
 
@@ -5162,47 +5161,47 @@  discard block
 block discarded – undo
5162 5161
 	 * is handling changing the Content-Type.
5163 5162
 	 */
5164 5163
 	$headers = array();
5165
-	if ( isset( $mail['headers'] ) ) {
5166
-		if ( is_array( $mail['headers'] ) ) {
5164
+	if (isset($mail['headers'])) {
5165
+		if (is_array($mail['headers'])) {
5167 5166
 			$headers = $mail['headers'];
5168 5167
 		} else {
5169
-			$headers = explode( "\n", str_replace( "\r\n", "\n", $mail['headers'] ) );
5168
+			$headers = explode("\n", str_replace("\r\n", "\n", $mail['headers']));
5170 5169
 		}
5171 5170
 	}
5172 5171
 
5173
-	foreach ( $headers as $header ) {
5174
-		if ( strpos($header, ':') === false ) {
5172
+	foreach ($headers as $header) {
5173
+		if (strpos($header, ':') === false) {
5175 5174
 			continue;
5176 5175
 		}
5177 5176
 
5178 5177
 		// Explode them out.
5179
-		list( $name, $content ) = explode( ':', trim( $header ), 2 );
5178
+		list($name, $content) = explode(':', trim($header), 2);
5180 5179
 
5181 5180
 		// Cleanup crew.
5182
-		$name    = trim( $name    );
5183
-		$content = trim( $content );
5181
+		$name    = trim($name);
5182
+		$content = trim($content);
5184 5183
 
5185
-		if ( 'content-type' === strtolower( $name ) ) {
5186
-			if ( strpos( $content, ';' ) !== false ) {
5187
-				list( $type, $charset ) = explode( ';', $content );
5188
-				$content_type = trim( $type );
5184
+		if ('content-type' === strtolower($name)) {
5185
+			if (strpos($content, ';') !== false) {
5186
+				list($type, $charset) = explode(';', $content);
5187
+				$content_type = trim($type);
5189 5188
 			} else {
5190
-				$content_type = trim( $content );
5189
+				$content_type = trim($content);
5191 5190
 			}
5192 5191
 			break;
5193 5192
 		}
5194 5193
 	}
5195 5194
 
5196 5195
 	// Set Content-Type if we don't have a content-type from the input headers.
5197
-	if ( ! isset( $content_type ) ) {
5196
+	if ( ! isset($content_type)) {
5198 5197
 		$content_type = 'text/plain';
5199 5198
 	}
5200 5199
 
5201 5200
 	/** This filter is documented in wp-includes/pluggable.php */
5202
-	$content_type = apply_filters( 'wp_mail_content_type', $content_type );
5201
+	$content_type = apply_filters('wp_mail_content_type', $content_type);
5203 5202
 
5204
-	if ( 'text/html' === $content_type ) {
5205
-		$mail['message'] = wp_staticize_emoji( $mail['message'] );
5203
+	if ('text/html' === $content_type) {
5204
+		$mail['message'] = wp_staticize_emoji($mail['message']);
5206 5205
 	}
5207 5206
 
5208 5207
 	return $mail;
@@ -5218,12 +5217,12 @@  discard block
 block discarded – undo
5218 5217
  * @param int    $length Optional. Maximum length of the shortened URL. Default 35 characters.
5219 5218
  * @return string Shortened URL.
5220 5219
  */
5221
-function url_shorten( $url, $length = 35 ) {
5222
-	$stripped = str_replace( array( 'https://', 'http://', 'www.' ), '', $url );
5223
-	$short_url = untrailingslashit( $stripped );
5220
+function url_shorten($url, $length = 35) {
5221
+	$stripped = str_replace(array('https://', 'http://', 'www.'), '', $url);
5222
+	$short_url = untrailingslashit($stripped);
5224 5223
 
5225
-	if ( strlen( $short_url ) > $length ) {
5226
-		$short_url = substr( $short_url, 0, $length - 3 ) . '&hellip;';
5224
+	if (strlen($short_url) > $length) {
5225
+		$short_url = substr($short_url, 0, $length - 3).'&hellip;';
5227 5226
 	}
5228 5227
 	return $short_url;
5229 5228
 }
@@ -5239,13 +5238,13 @@  discard block
 block discarded – undo
5239 5238
  * @param string $color
5240 5239
  * @return string|void
5241 5240
  */
5242
-function sanitize_hex_color( $color ) {
5243
-	if ( '' === $color ) {
5241
+function sanitize_hex_color($color) {
5242
+	if ('' === $color) {
5244 5243
 		return '';
5245 5244
 	}
5246 5245
 
5247 5246
 	// 3 or 6 hex digits, or the empty string.
5248
-	if ( preg_match('|^#([A-Fa-f0-9]{3}){1,2}$|', $color ) ) {
5247
+	if (preg_match('|^#([A-Fa-f0-9]{3}){1,2}$|', $color)) {
5249 5248
 		return $color;
5250 5249
 	}
5251 5250
 }
@@ -5264,14 +5263,14 @@  discard block
 block discarded – undo
5264 5263
  * @param string $color
5265 5264
  * @return string|null
5266 5265
  */
5267
-function sanitize_hex_color_no_hash( $color ) {
5268
-	$color = ltrim( $color, '#' );
5266
+function sanitize_hex_color_no_hash($color) {
5267
+	$color = ltrim($color, '#');
5269 5268
 
5270
-	if ( '' === $color ) {
5269
+	if ('' === $color) {
5271 5270
 		return '';
5272 5271
 	}
5273 5272
 
5274
-	return sanitize_hex_color( '#' . $color ) ? $color : null;
5273
+	return sanitize_hex_color('#'.$color) ? $color : null;
5275 5274
 }
5276 5275
 
5277 5276
 /**
@@ -5285,9 +5284,9 @@  discard block
 block discarded – undo
5285 5284
  * @param string $color
5286 5285
  * @return string
5287 5286
  */
5288
-function maybe_hash_hex_color( $color ) {
5289
-	if ( $unhashed = sanitize_hex_color_no_hash( $color ) ) {
5290
-		return '#' . $unhashed;
5287
+function maybe_hash_hex_color($color) {
5288
+	if ($unhashed = sanitize_hex_color_no_hash($color)) {
5289
+		return '#'.$unhashed;
5291 5290
 	}
5292 5291
 
5293 5292
 	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";
@@ -565,8 +566,9 @@  discard block
 block discarded – undo
565 566
 	$pee = preg_replace( "|\n</p>$|", '</p>', $pee );
566 567
 
567 568
 	// Replace placeholder <pre> tags with their original content.
568
-	if ( !empty($pre_tags) )
569
-		$pee = str_replace(array_keys($pre_tags), array_values($pre_tags), $pee);
569
+	if ( !empty($pre_tags) ) {
570
+			$pee = str_replace(array_keys($pre_tags), array_values($pre_tags), $pee);
571
+	}
570 572
 
571 573
 	// Restore newlines in all elements.
572 574
 	if ( false !== strpos( $pee, '<!-- wpnl -->' ) ) {
@@ -850,16 +852,38 @@  discard block
 block discarded – undo
850 852
 	reset_mbstring_encoding();
851 853
 	for ($i=0; $i < $length; $i++) {
852 854
 		$c = ord($str[$i]);
853
-		if ($c < 0x80) $n = 0; // 0bbbbbbb
854
-		elseif (($c & 0xE0) == 0xC0) $n=1; // 110bbbbb
855
-		elseif (($c & 0xF0) == 0xE0) $n=2; // 1110bbbb
856
-		elseif (($c & 0xF8) == 0xF0) $n=3; // 11110bbb
857
-		elseif (($c & 0xFC) == 0xF8) $n=4; // 111110bb
858
-		elseif (($c & 0xFE) == 0xFC) $n=5; // 1111110b
859
-		else return false; // Does not match any model
855
+		if ($c < 0x80) {
856
+			$n = 0;
857
+		}
858
+		// 0bbbbbbb
859
+		elseif (($c & 0xE0) == 0xC0) {
860
+			$n=1;
861
+		}
862
+		// 110bbbbb
863
+		elseif (($c & 0xF0) == 0xE0) {
864
+			$n=2;
865
+		}
866
+		// 1110bbbb
867
+		elseif (($c & 0xF8) == 0xF0) {
868
+			$n=3;
869
+		}
870
+		// 11110bbb
871
+		elseif (($c & 0xFC) == 0xF8) {
872
+			$n=4;
873
+		}
874
+		// 111110bb
875
+		elseif (($c & 0xFE) == 0xFC) {
876
+			$n=5;
877
+		}
878
+		// 1111110b
879
+		else {
880
+			return false;
881
+		}
882
+		// Does not match any model
860 883
 		for ($j=0; $j<$n; $j++) { // n bytes matching 10bbbbbb follow ?
861
-			if ((++$i == $length) || ((ord($str[$i]) & 0xC0) != 0x80))
862
-				return false;
884
+			if ((++$i == $length) || ((ord($str[$i]) & 0xC0) != 0x80)) {
885
+							return false;
886
+			}
863 887
 		}
864 888
 	}
865 889
 	return true;
@@ -891,18 +915,21 @@  discard block
 block discarded – undo
891 915
 function _wp_specialchars( $string, $quote_style = ENT_NOQUOTES, $charset = false, $double_encode = false ) {
892 916
 	$string = (string) $string;
893 917
 
894
-	if ( 0 === strlen( $string ) )
895
-		return '';
918
+	if ( 0 === strlen( $string ) ) {
919
+			return '';
920
+	}
896 921
 
897 922
 	// Don't bother if there are no specialchars - saves some processing
898
-	if ( ! preg_match( '/[&<>"\']/', $string ) )
899
-		return $string;
923
+	if ( ! preg_match( '/[&<>"\']/', $string ) ) {
924
+			return $string;
925
+	}
900 926
 
901 927
 	// Account for the previous behaviour of the function when the $quote_style is not an accepted value
902
-	if ( empty( $quote_style ) )
903
-		$quote_style = ENT_NOQUOTES;
904
-	elseif ( ! in_array( $quote_style, array( 0, 2, 3, 'single', 'double' ), true ) )
905
-		$quote_style = ENT_QUOTES;
928
+	if ( empty( $quote_style ) ) {
929
+			$quote_style = ENT_NOQUOTES;
930
+	} elseif ( ! in_array( $quote_style, array( 0, 2, 3, 'single', 'double' ), true ) ) {
931
+			$quote_style = ENT_QUOTES;
932
+	}
906 933
 
907 934
 	// Store the site charset as a static to avoid multiple calls to wp_load_alloptions()
908 935
 	if ( ! $charset ) {
@@ -914,8 +941,9 @@  discard block
 block discarded – undo
914 941
 		$charset = $_charset;
915 942
 	}
916 943
 
917
-	if ( in_array( $charset, array( 'utf8', 'utf-8', 'UTF8' ) ) )
918
-		$charset = 'UTF-8';
944
+	if ( in_array( $charset, array( 'utf8', 'utf-8', 'UTF8' ) ) ) {
945
+			$charset = 'UTF-8';
946
+	}
919 947
 
920 948
 	$_quote_style = $quote_style;
921 949
 
@@ -935,8 +963,9 @@  discard block
 block discarded – undo
935 963
 	$string = @htmlspecialchars( $string, $quote_style, $charset, $double_encode );
936 964
 
937 965
 	// Back-compat.
938
-	if ( 'single' === $_quote_style )
939
-		$string = str_replace( "'", '&#039;', $string );
966
+	if ( 'single' === $_quote_style ) {
967
+			$string = str_replace( "'", '&#039;', $string );
968
+	}
940 969
 
941 970
 	return $string;
942 971
 }
@@ -1084,8 +1113,9 @@  discard block
 block discarded – undo
1084 1113
 		$value = ord( $utf8_string[ $i ] );
1085 1114
 
1086 1115
 		if ( $value < 128 ) {
1087
-			if ( $length && ( $unicode_length >= $length ) )
1088
-				break;
1116
+			if ( $length && ( $unicode_length >= $length ) ) {
1117
+							break;
1118
+			}
1089 1119
 			$unicode .= chr($value);
1090 1120
 			$unicode_length++;
1091 1121
 		} else {
@@ -1101,8 +1131,9 @@  discard block
 block discarded – undo
1101 1131
 
1102 1132
 			$values[] = $value;
1103 1133
 
1104
-			if ( $length && ( $unicode_length + ($num_octets * 3) ) > $length )
1105
-				break;
1134
+			if ( $length && ( $unicode_length + ($num_octets * 3) ) > $length ) {
1135
+							break;
1136
+			}
1106 1137
 			if ( count( $values ) == $num_octets ) {
1107 1138
 				for ( $j = 0; $j < $num_octets; $j++ ) {
1108 1139
 					$unicode .= '%' . dechex( $values[ $j ] );
@@ -1497,8 +1528,9 @@  discard block
 block discarded – undo
1497 1528
  * @return string Filtered string with replaced "nice" characters.
1498 1529
  */
1499 1530
 function remove_accents( $string ) {
1500
-	if ( !preg_match('/[\x80-\xff]/', $string) )
1501
-		return $string;
1531
+	if ( !preg_match('/[\x80-\xff]/', $string) ) {
1532
+			return $string;
1533
+	}
1502 1534
 
1503 1535
 	if (seems_utf8($string)) {
1504 1536
 		$chars = array(
@@ -1804,8 +1836,9 @@  discard block
 block discarded – undo
1804 1836
 					break;
1805 1837
 				}
1806 1838
 			}
1807
-			if ( !$allowed )
1808
-				$filename .= '_';
1839
+			if ( !$allowed ) {
1840
+							$filename .= '_';
1841
+			}
1809 1842
 		}
1810 1843
 	}
1811 1844
 	$filename .= '.' . $extension;
@@ -1836,8 +1869,9 @@  discard block
 block discarded – undo
1836 1869
 	$username = preg_replace( '/&.+?;/', '', $username ); // Kill entities
1837 1870
 
1838 1871
 	// If strict, reduce to ASCII for max portability.
1839
-	if ( $strict )
1840
-		$username = preg_replace( '|[^a-z0-9 _.\-@]|i', '', $username );
1872
+	if ( $strict ) {
1873
+			$username = preg_replace( '|[^a-z0-9 _.\-@]|i', '', $username );
1874
+	}
1841 1875
 
1842 1876
 	$username = trim( $username );
1843 1877
 	// Consolidate contiguous whitespace
@@ -1898,8 +1932,9 @@  discard block
 block discarded – undo
1898 1932
 function sanitize_title( $title, $fallback_title = '', $context = 'save' ) {
1899 1933
 	$raw_title = $title;
1900 1934
 
1901
-	if ( 'save' == $context )
1902
-		$title = remove_accents($title);
1935
+	if ( 'save' == $context ) {
1936
+			$title = remove_accents($title);
1937
+	}
1903 1938
 
1904 1939
 	/**
1905 1940
 	 * Filters a sanitized title string.
@@ -1912,8 +1947,9 @@  discard block
 block discarded – undo
1912 1947
 	 */
1913 1948
 	$title = apply_filters( 'sanitize_title', $title, $raw_title, $context );
1914 1949
 
1915
-	if ( '' === $title || false === $title )
1916
-		$title = $fallback_title;
1950
+	if ( '' === $title || false === $title ) {
1951
+			$title = $fallback_title;
1952
+	}
1917 1953
 
1918 1954
 	return $title;
1919 1955
 }
@@ -2228,8 +2264,9 @@  discard block
 block discarded – undo
2228 2264
 			elseif ( substr( $regex[2], -1 ) == '/' ) {
2229 2265
 				// ...but it isn't a known single-entity self-closing tag, then don't let it be treated as such and
2230 2266
 				// immediately close it with a closing tag (the tag will encapsulate no text as a result)
2231
-				if ( ! in_array( $tag, $single_tags ) )
2232
-					$regex[2] = trim( substr( $regex[2], 0, -1 ) ) . "></$tag";
2267
+				if ( ! in_array( $tag, $single_tags ) ) {
2268
+									$regex[2] = trim( substr( $regex[2], 0, -1 ) ) . "></$tag";
2269
+				}
2233 2270
 			}
2234 2271
 			// ElseIf it's a known single-entity tag but it doesn't close itself, do so
2235 2272
 			elseif ( in_array($tag, $single_tags) ) {
@@ -2247,8 +2284,9 @@  discard block
 block discarded – undo
2247 2284
 
2248 2285
 			// Attributes
2249 2286
 			$attributes = $regex[2];
2250
-			if ( ! empty( $attributes ) && $attributes[0] != '>' )
2251
-				$attributes = ' ' . $attributes;
2287
+			if ( ! empty( $attributes ) && $attributes[0] != '>' ) {
2288
+							$attributes = ' ' . $attributes;
2289
+			}
2252 2290
 
2253 2291
 			$tag = '<' . $tag . $attributes . '>';
2254 2292
 			//If already queuing a close tag, then put this tag on, too
@@ -2268,8 +2306,10 @@  discard block
 block discarded – undo
2268 2306
 	$newtext .= $text;
2269 2307
 
2270 2308
 	// Empty Stack
2271
-	while( $x = array_pop($tagstack) )
2272
-		$newtext .= '</' . $x . '>'; // Add remaining tags to close
2309
+	while( $x = array_pop($tagstack) ) {
2310
+			$newtext .= '</' . $x . '>';
2311
+	}
2312
+	// Add remaining tags to close
2273 2313
 
2274 2314
 	// WP fix for the bug with HTML comments
2275 2315
 	$newtext = str_replace("< !--","<!--",$newtext);
@@ -2303,8 +2343,9 @@  discard block
 block discarded – undo
2303 2343
 	 * @param string $content The text, prior to formatting for editing.
2304 2344
 	 */
2305 2345
 	$content = apply_filters( 'format_to_edit', $content );
2306
-	if ( ! $rich_text )
2307
-		$content = esc_textarea( $content );
2346
+	if ( ! $rich_text ) {
2347
+			$content = esc_textarea( $content );
2348
+	}
2308 2349
 	return $content;
2309 2350
 }
2310 2351
 
@@ -2338,8 +2379,9 @@  discard block
 block discarded – undo
2338 2379
  * @return string String with backslashes inserted.
2339 2380
  */
2340 2381
 function backslashit( $string ) {
2341
-	if ( isset( $string[0] ) && $string[0] >= '0' && $string[0] <= '9' )
2342
-		$string = '\\\\' . $string;
2382
+	if ( isset( $string[0] ) && $string[0] >= '0' && $string[0] <= '9' ) {
2383
+			$string = '\\\\' . $string;
2384
+	}
2343 2385
 	return addcslashes( $string, 'A..Za..z' );
2344 2386
 }
2345 2387
 
@@ -2388,8 +2430,9 @@  discard block
 block discarded – undo
2388 2430
  * @return string Returns a string escaped with slashes.
2389 2431
  */
2390 2432
 function addslashes_gpc($gpc) {
2391
-	if ( get_magic_quotes_gpc() )
2392
-		$gpc = stripslashes($gpc);
2433
+	if ( get_magic_quotes_gpc() ) {
2434
+			$gpc = stripslashes($gpc);
2435
+	}
2393 2436
 
2394 2437
 	return wp_slash($gpc);
2395 2438
 }
@@ -2509,8 +2552,9 @@  discard block
 block discarded – undo
2509 2552
 	}
2510 2553
 
2511 2554
 	$url = esc_url($url);
2512
-	if ( empty($url) )
2513
-		return $matches[0];
2555
+	if ( empty($url) ) {
2556
+			return $matches[0];
2557
+	}
2514 2558
 
2515 2559
 	return $matches[1] . "<a href=\"$url\" rel=\"nofollow\">$url</a>" . $suffix;
2516 2560
 }
@@ -2538,8 +2582,9 @@  discard block
 block discarded – undo
2538 2582
 	}
2539 2583
 
2540 2584
 	$dest = esc_url($dest);
2541
-	if ( empty($dest) )
2542
-		return $matches[0];
2585
+	if ( empty($dest) ) {
2586
+			return $matches[0];
2587
+	}
2543 2588
 
2544 2589
 	return $matches[1] . "<a href=\"$dest\" rel=\"nofollow\">$dest</a>$ret";
2545 2590
 }
@@ -2577,10 +2622,11 @@  discard block
 block discarded – undo
2577 2622
 	$nested_code_pre = 0; // Keep track of how many levels link is nested inside <pre> or <code>
2578 2623
 	foreach ( $textarr as $piece ) {
2579 2624
 
2580
-		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 ) )
2581
-			$nested_code_pre++;
2582
-		elseif ( $nested_code_pre && ( '</code>' === strtolower( $piece ) || '</pre>' === strtolower( $piece ) || '</script>' === strtolower( $piece ) || '</style>' === strtolower( $piece ) ) )
2583
-			$nested_code_pre--;
2625
+		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 ) ) {
2626
+					$nested_code_pre++;
2627
+		} elseif ( $nested_code_pre && ( '</code>' === strtolower( $piece ) || '</pre>' === strtolower( $piece ) || '</script>' === strtolower( $piece ) || '</style>' === strtolower( $piece ) ) ) {
2628
+					$nested_code_pre--;
2629
+		}
2584 2630
 
2585 2631
 		if ( $nested_code_pre || empty( $piece ) || ( $piece[0] === '<' && ! preg_match( '|^<\s*[\w]{1,20}+://|', $piece ) ) ) {
2586 2632
 			$r .= $piece;
@@ -2757,8 +2803,9 @@  discard block
 block discarded – undo
2757 2803
 function translate_smiley( $matches ) {
2758 2804
 	global $wpsmiliestrans;
2759 2805
 
2760
-	if ( count( $matches ) == 0 )
2761
-		return '';
2806
+	if ( count( $matches ) == 0 ) {
2807
+			return '';
2808
+	}
2762 2809
 
2763 2810
 	$smiley = trim( reset( $matches ) );
2764 2811
 	$img = $wpsmiliestrans[ $smiley ];
@@ -2850,8 +2897,9 @@  discard block
 block discarded – undo
2850 2897
  * @return string|bool Either false or the valid email address.
2851 2898
  */
2852 2899
 function is_email( $email, $deprecated = false ) {
2853
-	if ( ! empty( $deprecated ) )
2854
-		_deprecated_argument( __FUNCTION__, '3.0.0' );
2900
+	if ( ! empty( $deprecated ) ) {
2901
+			_deprecated_argument( __FUNCTION__, '3.0.0' );
2902
+	}
2855 2903
 
2856 2904
 	// Test for the minimum length the email can be
2857 2905
 	if ( strlen( $email ) < 3 ) {
@@ -3015,13 +3063,15 @@  discard block
 block discarded – undo
3015 3063
 	$tz = get_option( 'timezone_string' );
3016 3064
 	if ( $tz ) {
3017 3065
 		$datetime = date_create( $string, new DateTimeZone( 'UTC' ) );
3018
-		if ( ! $datetime )
3019
-			return date( $format, 0 );
3066
+		if ( ! $datetime ) {
3067
+					return date( $format, 0 );
3068
+		}
3020 3069
 		$datetime->setTimezone( new DateTimeZone( $tz ) );
3021 3070
 		$string_localtime = $datetime->format( $format );
3022 3071
 	} else {
3023
-		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) )
3024
-			return date( $format, 0 );
3072
+		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) ) {
3073
+					return date( $format, 0 );
3074
+		}
3025 3075
 		$string_time = gmmktime( $matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1] );
3026 3076
 		$string_localtime = gmdate( $format, $string_time + get_option( 'gmt_offset' ) * HOUR_IN_SECONDS );
3027 3077
 	}
@@ -3204,34 +3254,40 @@  discard block
 block discarded – undo
3204 3254
 
3205 3255
 	if ( $diff < HOUR_IN_SECONDS ) {
3206 3256
 		$mins = round( $diff / MINUTE_IN_SECONDS );
3207
-		if ( $mins <= 1 )
3208
-			$mins = 1;
3257
+		if ( $mins <= 1 ) {
3258
+					$mins = 1;
3259
+		}
3209 3260
 		/* translators: min=minute */
3210 3261
 		$since = sprintf( _n( '%s min', '%s mins', $mins ), $mins );
3211 3262
 	} elseif ( $diff < DAY_IN_SECONDS && $diff >= HOUR_IN_SECONDS ) {
3212 3263
 		$hours = round( $diff / HOUR_IN_SECONDS );
3213
-		if ( $hours <= 1 )
3214
-			$hours = 1;
3264
+		if ( $hours <= 1 ) {
3265
+					$hours = 1;
3266
+		}
3215 3267
 		$since = sprintf( _n( '%s hour', '%s hours', $hours ), $hours );
3216 3268
 	} elseif ( $diff < WEEK_IN_SECONDS && $diff >= DAY_IN_SECONDS ) {
3217 3269
 		$days = round( $diff / DAY_IN_SECONDS );
3218
-		if ( $days <= 1 )
3219
-			$days = 1;
3270
+		if ( $days <= 1 ) {
3271
+					$days = 1;
3272
+		}
3220 3273
 		$since = sprintf( _n( '%s day', '%s days', $days ), $days );
3221 3274
 	} elseif ( $diff < MONTH_IN_SECONDS && $diff >= WEEK_IN_SECONDS ) {
3222 3275
 		$weeks = round( $diff / WEEK_IN_SECONDS );
3223
-		if ( $weeks <= 1 )
3224
-			$weeks = 1;
3276
+		if ( $weeks <= 1 ) {
3277
+					$weeks = 1;
3278
+		}
3225 3279
 		$since = sprintf( _n( '%s week', '%s weeks', $weeks ), $weeks );
3226 3280
 	} elseif ( $diff < YEAR_IN_SECONDS && $diff >= MONTH_IN_SECONDS ) {
3227 3281
 		$months = round( $diff / MONTH_IN_SECONDS );
3228
-		if ( $months <= 1 )
3229
-			$months = 1;
3282
+		if ( $months <= 1 ) {
3283
+					$months = 1;
3284
+		}
3230 3285
 		$since = sprintf( _n( '%s month', '%s months', $months ), $months );
3231 3286
 	} elseif ( $diff >= YEAR_IN_SECONDS ) {
3232 3287
 		$years = round( $diff / YEAR_IN_SECONDS );
3233
-		if ( $years <= 1 )
3234
-			$years = 1;
3288
+		if ( $years <= 1 ) {
3289
+					$years = 1;
3290
+		}
3235 3291
 		$since = sprintf( _n( '%s year', '%s years', $years ), $years );
3236 3292
 	}
3237 3293
 
@@ -3382,8 +3438,9 @@  discard block
 block discarded – undo
3382 3438
 	 * @param string $text           The text prior to entity conversion.
3383 3439
 	 */
3384 3440
 	$filtered = apply_filters( 'pre_ent2ncr', null, $text );
3385
-	if ( null !== $filtered )
3386
-		return $filtered;
3441
+	if ( null !== $filtered ) {
3442
+			return $filtered;
3443
+	}
3387 3444
 
3388 3445
 	$to_ncr = array(
3389 3446
 		'&quot;' => '&#34;',
@@ -3745,8 +3802,9 @@  discard block
 block discarded – undo
3745 3802
 function esc_url( $url, $protocols = null, $_context = 'display' ) {
3746 3803
 	$original_url = $url;
3747 3804
 
3748
-	if ( '' == $url )
3749
-		return $url;
3805
+	if ( '' == $url ) {
3806
+			return $url;
3807
+	}
3750 3808
 
3751 3809
 	$url = str_replace( ' ', '%20', $url );
3752 3810
 	$url = preg_replace('|[^a-z0-9-~+_.?#=!&;,/:%@$\|*\'()\[\]\\x80-\\xff]|i', '', $url);
@@ -3766,8 +3824,9 @@  discard block
 block discarded – undo
3766 3824
 	 * link starting with /, # or ? or a php file).
3767 3825
 	 */
3768 3826
 	if ( strpos($url, ':') === false && ! in_array( $url[0], array( '/', '#', '?' ) ) &&
3769
-		! preg_match('/^[a-z0-9-]+?\.php/i', $url) )
3770
-		$url = 'http://' . $url;
3827
+		! preg_match('/^[a-z0-9-]+?\.php/i', $url) ) {
3828
+			$url = 'http://' . $url;
3829
+	}
3771 3830
 
3772 3831
 	// Replace ampersands and single quotes only when displaying.
3773 3832
 	if ( 'display' == $_context ) {
@@ -3816,11 +3875,13 @@  discard block
 block discarded – undo
3816 3875
 	if ( '/' === $url[0] ) {
3817 3876
 		$good_protocol_url = $url;
3818 3877
 	} else {
3819
-		if ( ! is_array( $protocols ) )
3820
-			$protocols = wp_allowed_protocols();
3878
+		if ( ! is_array( $protocols ) ) {
3879
+					$protocols = wp_allowed_protocols();
3880
+		}
3821 3881
 		$good_protocol_url = wp_kses_bad_protocol( $url, $protocols );
3822
-		if ( strtolower( $good_protocol_url ) != strtolower( $url ) )
3823
-			return '';
3882
+		if ( strtolower( $good_protocol_url ) != strtolower( $url ) ) {
3883
+					return '';
3884
+		}
3824 3885
 	}
3825 3886
 
3826 3887
 	/**
@@ -4066,17 +4127,20 @@  discard block
 block discarded – undo
4066 4127
 		case 'posts_per_page':
4067 4128
 		case 'posts_per_rss':
4068 4129
 			$value = (int) $value;
4069
-			if ( empty($value) )
4070
-				$value = 1;
4071
-			if ( $value < -1 )
4072
-				$value = abs($value);
4130
+			if ( empty($value) ) {
4131
+							$value = 1;
4132
+			}
4133
+			if ( $value < -1 ) {
4134
+							$value = abs($value);
4135
+			}
4073 4136
 			break;
4074 4137
 
4075 4138
 		case 'default_ping_status':
4076 4139
 		case 'default_comment_status':
4077 4140
 			// Options that if not there have 0 value but need to be something like "closed"
4078
-			if ( $value == '0' || $value == '')
4079
-				$value = 'closed';
4141
+			if ( $value == '0' || $value == '') {
4142
+							$value = 'closed';
4143
+			}
4080 4144
 			break;
4081 4145
 
4082 4146
 		case 'blogdescription':
@@ -4099,10 +4163,11 @@  discard block
 block discarded – undo
4099 4163
 
4100 4164
 		case 'blog_public':
4101 4165
 			// This is the value if the settings checkbox is not checked on POST. Don't rely on this.
4102
-			if ( null === $value )
4103
-				$value = 1;
4104
-			else
4105
-				$value = intval( $value );
4166
+			if ( null === $value ) {
4167
+							$value = 1;
4168
+			} else {
4169
+							$value = intval( $value );
4170
+			}
4106 4171
 			break;
4107 4172
 
4108 4173
 		case 'date_format':
@@ -4172,13 +4237,15 @@  discard block
 block discarded – undo
4172 4237
 			if ( is_wp_error( $value ) ) {
4173 4238
 				$error = $value->get_error_message();
4174 4239
 			} else {
4175
-				if ( ! is_array( $value ) )
4176
-					$value = explode( ' ', $value );
4240
+				if ( ! is_array( $value ) ) {
4241
+									$value = explode( ' ', $value );
4242
+				}
4177 4243
 
4178 4244
 				$value = array_values( array_filter( array_map( 'trim', $value ) ) );
4179 4245
 
4180
-				if ( ! $value )
4181
-					$value = '';
4246
+				if ( ! $value ) {
4247
+									$value = '';
4248
+				}
4182 4249
 			}
4183 4250
 			break;
4184 4251
 
@@ -4188,8 +4255,9 @@  discard block
 block discarded – undo
4188 4255
 			if ( is_wp_error( $value ) ) {
4189 4256
 				$error = $value->get_error_message();
4190 4257
 			} else {
4191
-				if ( ! is_array( $value ) )
4192
-					$value = explode( "\n", $value );
4258
+				if ( ! is_array( $value ) ) {
4259
+									$value = explode( "\n", $value );
4260
+				}
4193 4261
 
4194 4262
 				$domains = array_values( array_filter( array_map( 'trim', $value ) ) );
4195 4263
 				$value = array();
@@ -4199,8 +4267,9 @@  discard block
 block discarded – undo
4199 4267
 						$value[] = $domain;
4200 4268
 					}
4201 4269
 				}
4202
-				if ( ! $value )
4203
-					$value = '';
4270
+				if ( ! $value ) {
4271
+									$value = '';
4272
+				}
4204 4273
 			}
4205 4274
 			break;
4206 4275
 
@@ -4232,8 +4301,9 @@  discard block
 block discarded – undo
4232 4301
 			break;
4233 4302
 
4234 4303
 		case 'default_role' :
4235
-			if ( ! get_role( $value ) && get_role( 'subscriber' ) )
4236
-				$value = 'subscriber';
4304
+			if ( ! get_role( $value ) && get_role( 'subscriber' ) ) {
4305
+							$value = 'subscriber';
4306
+			}
4237 4307
 			break;
4238 4308
 
4239 4309
 		case 'moderation_keys':
@@ -4311,8 +4381,9 @@  discard block
 block discarded – undo
4311 4381
  */
4312 4382
 function wp_parse_str( $string, &$array ) {
4313 4383
 	parse_str( $string, $array );
4314
-	if ( get_magic_quotes_gpc() )
4315
-		$array = stripslashes_deep( $array );
4384
+	if ( get_magic_quotes_gpc() ) {
4385
+			$array = stripslashes_deep( $array );
4386
+	}
4316 4387
 	/**
4317 4388
 	 * Filters the array of variables derived from a parsed string.
4318 4389
 	 *
@@ -4346,8 +4417,9 @@  discard block
 block discarded – undo
4346 4417
  * @return string The text returned after esc_html if needed.
4347 4418
  */
4348 4419
 function wp_pre_kses_less_than_callback( $matches ) {
4349
-	if ( false === strpos($matches[0], '>') )
4350
-		return esc_html($matches[0]);
4420
+	if ( false === strpos($matches[0], '>') ) {
4421
+			return esc_html($matches[0]);
4422
+	}
4351 4423
 	return $matches[0];
4352 4424
 }
4353 4425
 
@@ -4383,8 +4455,9 @@  discard block
 block discarded – undo
4383 4455
 
4384 4456
 		// Get fragment before next %
4385 4457
 		$end = strpos($pattern, '%', $start + 1);
4386
-		if ( false === $end )
4387
-			$end = $len;
4458
+		if ( false === $end ) {
4459
+					$end = $len;
4460
+		}
4388 4461
 		$fragment = substr($pattern, $start, $end - $start);
4389 4462
 
4390 4463
 		// Fragment has a specifier
@@ -4409,10 +4482,11 @@  discard block
 block discarded – undo
4409 4482
 			 * @param string $arg      The argument.
4410 4483
 			 */
4411 4484
 			$_fragment = apply_filters( 'wp_sprintf', $fragment, $arg );
4412
-			if ( $_fragment != $fragment )
4413
-				$fragment = $_fragment;
4414
-			else
4415
-				$fragment = sprintf($fragment, strval($arg) );
4485
+			if ( $_fragment != $fragment ) {
4486
+							$fragment = $_fragment;
4487
+			} else {
4488
+							$fragment = sprintf($fragment, strval($arg) );
4489
+			}
4416 4490
 		}
4417 4491
 
4418 4492
 		// Append to result and move to next fragment
@@ -4437,12 +4511,14 @@  discard block
 block discarded – undo
4437 4511
  */
4438 4512
 function wp_sprintf_l( $pattern, $args ) {
4439 4513
 	// Not a match
4440
-	if ( substr($pattern, 0, 2) != '%l' )
4441
-		return $pattern;
4514
+	if ( substr($pattern, 0, 2) != '%l' ) {
4515
+			return $pattern;
4516
+	}
4442 4517
 
4443 4518
 	// Nothing to work with
4444
-	if ( empty($args) )
4445
-		return '';
4519
+	if ( empty($args) ) {
4520
+			return '';
4521
+	}
4446 4522
 
4447 4523
 	/**
4448 4524
 	 * Filters the translated delimiters used by wp_sprintf_l().
@@ -4466,17 +4542,19 @@  discard block
 block discarded – undo
4466 4542
 
4467 4543
 	$args = (array) $args;
4468 4544
 	$result = array_shift($args);
4469
-	if ( count($args) == 1 )
4470
-		$result .= $l['between_only_two'] . array_shift($args);
4545
+	if ( count($args) == 1 ) {
4546
+			$result .= $l['between_only_two'] . array_shift($args);
4547
+	}
4471 4548
 	// Loop when more than two args
4472 4549
 	$i = count($args);
4473 4550
 	while ( $i ) {
4474 4551
 		$arg = array_shift($args);
4475 4552
 		$i--;
4476
-		if ( 0 == $i )
4477
-			$result .= $l['between_last_two'] . $arg;
4478
-		else
4479
-			$result .= $l['between'] . $arg;
4553
+		if ( 0 == $i ) {
4554
+					$result .= $l['between_last_two'] . $arg;
4555
+		} else {
4556
+					$result .= $l['between'] . $arg;
4557
+		}
4480 4558
 	}
4481 4559
 	return $result . substr($pattern, 2);
4482 4560
 }
@@ -4496,14 +4574,16 @@  discard block
 block discarded – undo
4496 4574
  * @return string The excerpt.
4497 4575
  */
4498 4576
 function wp_html_excerpt( $str, $count, $more = null ) {
4499
-	if ( null === $more )
4500
-		$more = '';
4577
+	if ( null === $more ) {
4578
+			$more = '';
4579
+	}
4501 4580
 	$str = wp_strip_all_tags( $str, true );
4502 4581
 	$excerpt = mb_substr( $str, 0, $count );
4503 4582
 	// remove part of an entity at the end
4504 4583
 	$excerpt = preg_replace( '/&[^;\s]{0,6}$/', '', $excerpt );
4505
-	if ( $str != $excerpt )
4506
-		$excerpt = trim( $excerpt ) . $more;
4584
+	if ( $str != $excerpt ) {
4585
+			$excerpt = trim( $excerpt ) . $more;
4586
+	}
4507 4587
 	return $excerpt;
4508 4588
 }
4509 4589
 
@@ -4625,8 +4705,9 @@  discard block
 block discarded – undo
4625 4705
 	$string = preg_replace( '@<(script|style)[^>]*?>.*?</\\1>@si', '', $string );
4626 4706
 	$string = strip_tags($string);
4627 4707
 
4628
-	if ( $remove_breaks )
4629
-		$string = preg_replace('/[\r\n\t ]+/', ' ', $string);
4708
+	if ( $remove_breaks ) {
4709
+			$string = preg_replace('/[\r\n\t ]+/', ' ', $string);
4710
+	}
4630 4711
 
4631 4712
 	return trim( $string );
4632 4713
 }
@@ -4709,8 +4790,9 @@  discard block
 block discarded – undo
4709 4790
 function capital_P_dangit( $text ) {
4710 4791
 	// Simple replacement for titles
4711 4792
 	$current_filter = current_filter();
4712
-	if ( 'the_title' === $current_filter || 'wp_title' === $current_filter )
4713
-		return str_replace( 'Wordpress', 'WordPress', $text );
4793
+	if ( 'the_title' === $current_filter || 'wp_title' === $current_filter ) {
4794
+			return str_replace( 'Wordpress', 'WordPress', $text );
4795
+	}
4714 4796
 	// Still here? Use the more judicious replacement
4715 4797
 	static $dblq = false;
4716 4798
 	if ( false === $dblq ) {
@@ -4754,8 +4836,9 @@  discard block
 block discarded – undo
4754 4836
 function sanitize_trackback_urls( $to_ping ) {
4755 4837
 	$urls_to_ping = preg_split( '/[\r\n\t ]/', trim( $to_ping ), -1, PREG_SPLIT_NO_EMPTY );
4756 4838
 	foreach ( $urls_to_ping as $k => $url ) {
4757
-		if ( !preg_match( '#^https?://.#i', $url ) )
4758
-			unset( $urls_to_ping[$k] );
4839
+		if ( !preg_match( '#^https?://.#i', $url ) ) {
4840
+					unset( $urls_to_ping[$k] );
4841
+		}
4759 4842
 	}
4760 4843
 	$urls_to_ping = array_map( 'esc_url_raw', $urls_to_ping );
4761 4844
 	$urls_to_ping = implode( "\n", $urls_to_ping );
Please login to merge, or discard this patch.
src/wp-includes/functions.php 3 patches
Doc Comments   +8 added lines, -11 removed lines patch added patch discarded remove patch
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
  *
56 56
  * @param string   $type Type of time to retrieve. Accepts 'mysql', 'timestamp', or PHP date
57 57
  *                       format string (e.g. 'Y-m-d').
58
- * @param int|bool $gmt  Optional. Whether to use GMT timezone. Default false.
58
+ * @param integer $gmt  Optional. Whether to use GMT timezone. Default false.
59 59
  * @return int|string Integer if $type is 'timestamp', string otherwise.
60 60
  */
61 61
 function current_time( $type, $gmt = 0 ) {
@@ -436,7 +436,7 @@  discard block
 block discarded – undo
436 436
  * @since 2.0.5
437 437
  *
438 438
  * @param string|array|object $data Data that might be serialized.
439
- * @return mixed A scalar data
439
+ * @return string A scalar data
440 440
  */
441 441
 function maybe_serialize( $data ) {
442 442
 	if ( is_array( $data ) || is_object( $data ) )
@@ -771,9 +771,6 @@  discard block
 block discarded – undo
771 771
  *
772 772
  * @since 1.5.0
773 773
  *
774
- * @param string|array $key   Either a query variable key, or an associative array of query variables.
775
- * @param string       $value Optional. Either a query variable value, or a URL to act upon.
776
- * @param string       $url   Optional. A URL to act upon.
777 774
  * @return string New URL query string (unescaped).
778 775
  */
779 776
 function add_query_arg() {
@@ -1428,7 +1425,7 @@  discard block
 block discarded – undo
1428 1425
  * @since 2.0.4
1429 1426
  *
1430 1427
  * @param string     $actionurl URL to add nonce action.
1431
- * @param int|string $action    Optional. Nonce action name. Default -1.
1428
+ * @param integer $action    Optional. Nonce action name. Default -1.
1432 1429
  * @param string     $name      Optional. Nonce name. Default '_wpnonce'.
1433 1430
  * @return string Escaped URL with nonce action added.
1434 1431
  */
@@ -1457,7 +1454,7 @@  discard block
 block discarded – undo
1457 1454
  *
1458 1455
  * @since 2.0.4
1459 1456
  *
1460
- * @param int|string $action  Optional. Action name. Default -1.
1457
+ * @param integer $action  Optional. Action name. Default -1.
1461 1458
  * @param string     $name    Optional. Nonce name. Default '_wpnonce'.
1462 1459
  * @param bool       $referer Optional. Whether to set the referer field for validation. Default true.
1463 1460
  * @param bool       $echo    Optional. Whether to display or return hidden form field. Default true.
@@ -1549,7 +1546,7 @@  discard block
 block discarded – undo
1549 1546
  *
1550 1547
  * @since 4.5.0
1551 1548
  *
1552
- * @return string|false Referer URL on success, false on failure.
1549
+ * @return string Referer URL on success, false on failure.
1553 1550
  */
1554 1551
 function wp_get_raw_referer() {
1555 1552
 	if ( ! empty( $_REQUEST['_wp_http_referer'] ) ) {
@@ -1861,7 +1858,7 @@  discard block
 block discarded – undo
1861 1858
  * @param bool   $create_dir Optional. Whether to check and create the uploads directory.
1862 1859
  *                           Default true for backward compatibility.
1863 1860
  * @param bool   $refresh_cache Optional. Whether to refresh the cache. Default false.
1864
- * @return array See above for description.
1861
+ * @return callable|null See above for description.
1865 1862
  */
1866 1863
 function wp_upload_dir( $time = null, $create_dir = true, $refresh_cache = false ) {
1867 1864
 	static $cache = array(), $tested_paths = array();
@@ -4692,7 +4689,7 @@  discard block
 block discarded – undo
4692 4689
  *
4693 4690
  * @see __return_false()
4694 4691
  *
4695
- * @return true True.
4692
+ * @return boolean True.
4696 4693
  */
4697 4694
 function __return_true() {
4698 4695
 	return true;
@@ -4814,7 +4811,7 @@  discard block
 block discarded – undo
4814 4811
  * @param int      $start         The ID to start the loop check at.
4815 4812
  * @param int      $start_parent  The parent_ID of $start to use instead of calling $callback( $start ).
4816 4813
  *                                Use null to always use $callback
4817
- * @param array    $callback_args Optional. Additional arguments to send to $callback.
4814
+ * @param string[]    $callback_args Optional. Additional arguments to send to $callback.
4818 4815
  * @return array IDs of all members of loop.
4819 4816
  */
4820 4817
 function wp_find_hierarchy_loop( $callback, $start, $start_parent, $callback_args = array() ) {
Please login to merge, or discard this patch.
Spacing   +1027 added lines, -1027 removed lines patch added patch discarded remove patch
@@ -5,7 +5,7 @@  discard block
 block discarded – undo
5 5
  * @package WordPress
6 6
  */
7 7
 
8
-require( ABSPATH . WPINC . '/option.php' );
8
+require(ABSPATH.WPINC.'/option.php');
9 9
 
10 10
 /**
11 11
  * Convert given date string into a different format.
@@ -23,22 +23,22 @@  discard block
 block discarded – undo
23 23
  * @param bool   $translate Whether the return date should be translated. Default true.
24 24
  * @return string|int|bool Formatted date string or Unix timestamp. False if $date is empty.
25 25
  */
26
-function mysql2date( $format, $date, $translate = true ) {
27
-	if ( empty( $date ) )
26
+function mysql2date($format, $date, $translate = true) {
27
+	if (empty($date))
28 28
 		return false;
29 29
 
30
-	if ( 'G' == $format )
31
-		return strtotime( $date . ' +0000' );
30
+	if ('G' == $format)
31
+		return strtotime($date.' +0000');
32 32
 
33
-	$i = strtotime( $date );
33
+	$i = strtotime($date);
34 34
 
35
-	if ( 'U' == $format )
35
+	if ('U' == $format)
36 36
 		return $i;
37 37
 
38
-	if ( $translate )
39
-		return date_i18n( $format, $i );
38
+	if ($translate)
39
+		return date_i18n($format, $i);
40 40
 	else
41
-		return date( $format, $i );
41
+		return date($format, $i);
42 42
 }
43 43
 
44 44
 /**
@@ -58,14 +58,14 @@  discard block
 block discarded – undo
58 58
  * @param int|bool $gmt  Optional. Whether to use GMT timezone. Default false.
59 59
  * @return int|string Integer if $type is 'timestamp', string otherwise.
60 60
  */
61
-function current_time( $type, $gmt = 0 ) {
62
-	switch ( $type ) {
61
+function current_time($type, $gmt = 0) {
62
+	switch ($type) {
63 63
 		case 'mysql':
64
-			return ( $gmt ) ? gmdate( 'Y-m-d H:i:s' ) : gmdate( 'Y-m-d H:i:s', ( time() + ( get_option( 'gmt_offset' ) * HOUR_IN_SECONDS ) ) );
64
+			return ($gmt) ? gmdate('Y-m-d H:i:s') : gmdate('Y-m-d H:i:s', (time() + (get_option('gmt_offset') * HOUR_IN_SECONDS)));
65 65
 		case 'timestamp':
66
-			return ( $gmt ) ? time() : time() + ( get_option( 'gmt_offset' ) * HOUR_IN_SECONDS );
66
+			return ($gmt) ? time() : time() + (get_option('gmt_offset') * HOUR_IN_SECONDS);
67 67
 		default:
68
-			return ( $gmt ) ? date( $type ) : date( $type, time() + ( get_option( 'gmt_offset' ) * HOUR_IN_SECONDS ) );
68
+			return ($gmt) ? date($type) : date($type, time() + (get_option('gmt_offset') * HOUR_IN_SECONDS));
69 69
 	}
70 70
 }
71 71
 
@@ -86,13 +86,13 @@  discard block
 block discarded – undo
86 86
  *
87 87
  * @return string The date, translated if locale specifies it.
88 88
  */
89
-function date_i18n( $dateformatstring, $unixtimestamp = false, $gmt = false ) {
89
+function date_i18n($dateformatstring, $unixtimestamp = false, $gmt = false) {
90 90
 	global $wp_locale;
91 91
 	$i = $unixtimestamp;
92 92
 
93
-	if ( false === $i ) {
94
-		if ( ! $gmt )
95
-			$i = current_time( 'timestamp' );
93
+	if (false === $i) {
94
+		if ( ! $gmt)
95
+			$i = current_time('timestamp');
96 96
 		else
97 97
 			$i = time();
98 98
 		// we should not let date() interfere with our
@@ -106,43 +106,43 @@  discard block
 block discarded – undo
106 106
 	 */
107 107
 	$req_format = $dateformatstring;
108 108
 
109
-	$datefunc = $gmt? 'gmdate' : 'date';
109
+	$datefunc = $gmt ? 'gmdate' : 'date';
110 110
 
111
-	if ( ( !empty( $wp_locale->month ) ) && ( !empty( $wp_locale->weekday ) ) ) {
112
-		$datemonth = $wp_locale->get_month( $datefunc( 'm', $i ) );
113
-		$datemonth_abbrev = $wp_locale->get_month_abbrev( $datemonth );
114
-		$dateweekday = $wp_locale->get_weekday( $datefunc( 'w', $i ) );
115
-		$dateweekday_abbrev = $wp_locale->get_weekday_abbrev( $dateweekday );
116
-		$datemeridiem = $wp_locale->get_meridiem( $datefunc( 'a', $i ) );
117
-		$datemeridiem_capital = $wp_locale->get_meridiem( $datefunc( 'A', $i ) );
111
+	if (( ! empty($wp_locale->month)) && ( ! empty($wp_locale->weekday))) {
112
+		$datemonth = $wp_locale->get_month($datefunc('m', $i));
113
+		$datemonth_abbrev = $wp_locale->get_month_abbrev($datemonth);
114
+		$dateweekday = $wp_locale->get_weekday($datefunc('w', $i));
115
+		$dateweekday_abbrev = $wp_locale->get_weekday_abbrev($dateweekday);
116
+		$datemeridiem = $wp_locale->get_meridiem($datefunc('a', $i));
117
+		$datemeridiem_capital = $wp_locale->get_meridiem($datefunc('A', $i));
118 118
 		$dateformatstring = ' '.$dateformatstring;
119
-		$dateformatstring = preg_replace( "/([^\\\])D/", "\\1" . backslashit( $dateweekday_abbrev ), $dateformatstring );
120
-		$dateformatstring = preg_replace( "/([^\\\])F/", "\\1" . backslashit( $datemonth ), $dateformatstring );
121
-		$dateformatstring = preg_replace( "/([^\\\])l/", "\\1" . backslashit( $dateweekday ), $dateformatstring );
122
-		$dateformatstring = preg_replace( "/([^\\\])M/", "\\1" . backslashit( $datemonth_abbrev ), $dateformatstring );
123
-		$dateformatstring = preg_replace( "/([^\\\])a/", "\\1" . backslashit( $datemeridiem ), $dateformatstring );
124
-		$dateformatstring = preg_replace( "/([^\\\])A/", "\\1" . backslashit( $datemeridiem_capital ), $dateformatstring );
125
-
126
-		$dateformatstring = substr( $dateformatstring, 1, strlen( $dateformatstring ) -1 );
127
-	}
128
-	$timezone_formats = array( 'P', 'I', 'O', 'T', 'Z', 'e' );
129
-	$timezone_formats_re = implode( '|', $timezone_formats );
130
-	if ( preg_match( "/$timezone_formats_re/", $dateformatstring ) ) {
131
-		$timezone_string = get_option( 'timezone_string' );
132
-		if ( $timezone_string ) {
133
-			$timezone_object = timezone_open( $timezone_string );
134
-			$date_object = date_create( null, $timezone_object );
135
-			foreach ( $timezone_formats as $timezone_format ) {
136
-				if ( false !== strpos( $dateformatstring, $timezone_format ) ) {
137
-					$formatted = date_format( $date_object, $timezone_format );
119
+		$dateformatstring = preg_replace("/([^\\\])D/", "\\1".backslashit($dateweekday_abbrev), $dateformatstring);
120
+		$dateformatstring = preg_replace("/([^\\\])F/", "\\1".backslashit($datemonth), $dateformatstring);
121
+		$dateformatstring = preg_replace("/([^\\\])l/", "\\1".backslashit($dateweekday), $dateformatstring);
122
+		$dateformatstring = preg_replace("/([^\\\])M/", "\\1".backslashit($datemonth_abbrev), $dateformatstring);
123
+		$dateformatstring = preg_replace("/([^\\\])a/", "\\1".backslashit($datemeridiem), $dateformatstring);
124
+		$dateformatstring = preg_replace("/([^\\\])A/", "\\1".backslashit($datemeridiem_capital), $dateformatstring);
125
+
126
+		$dateformatstring = substr($dateformatstring, 1, strlen($dateformatstring) - 1);
127
+	}
128
+	$timezone_formats = array('P', 'I', 'O', 'T', 'Z', 'e');
129
+	$timezone_formats_re = implode('|', $timezone_formats);
130
+	if (preg_match("/$timezone_formats_re/", $dateformatstring)) {
131
+		$timezone_string = get_option('timezone_string');
132
+		if ($timezone_string) {
133
+			$timezone_object = timezone_open($timezone_string);
134
+			$date_object = date_create(null, $timezone_object);
135
+			foreach ($timezone_formats as $timezone_format) {
136
+				if (false !== strpos($dateformatstring, $timezone_format)) {
137
+					$formatted = date_format($date_object, $timezone_format);
138 138
 					$dateformatstring = ' '.$dateformatstring;
139
-					$dateformatstring = preg_replace( "/([^\\\])$timezone_format/", "\\1" . backslashit( $formatted ), $dateformatstring );
140
-					$dateformatstring = substr( $dateformatstring, 1, strlen( $dateformatstring ) -1 );
139
+					$dateformatstring = preg_replace("/([^\\\])$timezone_format/", "\\1".backslashit($formatted), $dateformatstring);
140
+					$dateformatstring = substr($dateformatstring, 1, strlen($dateformatstring) - 1);
141 141
 				}
142 142
 			}
143 143
 		}
144 144
 	}
145
-	$j = @$datefunc( $dateformatstring, $i );
145
+	$j = @$datefunc($dateformatstring, $i);
146 146
 
147 147
 	/**
148 148
 	 * Filters the date formatted based on the locale.
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
 	 * @param int    $i          Unix timestamp.
155 155
 	 * @param bool   $gmt        Whether to convert to GMT for time. Default false.
156 156
 	 */
157
-	$j = apply_filters( 'date_i18n', $j, $req_format, $i, $gmt );
157
+	$j = apply_filters('date_i18n', $j, $req_format, $i, $gmt);
158 158
 	return $j;
159 159
 }
160 160
 
@@ -169,41 +169,41 @@  discard block
 block discarded – undo
169 169
  * @param string $date Formatted date string.
170 170
  * @return string The date, declined if locale specifies it.
171 171
  */
172
-function wp_maybe_decline_date( $date ) {
172
+function wp_maybe_decline_date($date) {
173 173
 	global $wp_locale;
174 174
 
175 175
 	// i18n functions are not available in SHORTINIT mode
176
-	if ( ! function_exists( '_x' ) ) {
176
+	if ( ! function_exists('_x')) {
177 177
 		return $date;
178 178
 	}
179 179
 
180 180
 	/* translators: If months in your language require a genitive case,
181 181
 	 * translate this to 'on'. Do not translate into your own language.
182 182
 	 */
183
-	if ( 'on' === _x( 'off', 'decline months names: on or off' ) ) {
183
+	if ('on' === _x('off', 'decline months names: on or off')) {
184 184
 		// Match a format like 'j F Y' or 'j. F'
185
-		if ( @preg_match( '#^\d{1,2}\.? [^\d ]+#u', $date ) ) {
185
+		if (@preg_match('#^\d{1,2}\.? [^\d ]+#u', $date)) {
186 186
 			$months          = $wp_locale->month;
187 187
 			$months_genitive = $wp_locale->month_genitive;
188 188
 
189
-			foreach ( $months as $key => $month ) {
190
-				$months[ $key ] = '# ' . $month . '( |$)#u';
189
+			foreach ($months as $key => $month) {
190
+				$months[$key] = '# '.$month.'( |$)#u';
191 191
 			}
192 192
 
193
-			foreach ( $months_genitive as $key => $month ) {
194
-				$months_genitive[ $key ] = ' ' . $month . '$1';
193
+			foreach ($months_genitive as $key => $month) {
194
+				$months_genitive[$key] = ' '.$month.'$1';
195 195
 			}
196 196
 
197
-			$date = preg_replace( $months, $months_genitive, $date );
197
+			$date = preg_replace($months, $months_genitive, $date);
198 198
 		}
199 199
 	}
200 200
 
201 201
 	// Used for locale-specific rules
202 202
 	$locale = get_locale();
203 203
 
204
-	if ( 'ca' === $locale ) {
204
+	if ('ca' === $locale) {
205 205
 		// " de abril| de agost| de octubre..." -> " d'abril| d'agost| d'octubre..."
206
-		$date = preg_replace( '# de ([ao])#i', " d'\\1", $date );
206
+		$date = preg_replace('# de ([ao])#i', " d'\\1", $date);
207 207
 	}
208 208
 
209 209
 	return $date;
@@ -220,13 +220,13 @@  discard block
 block discarded – undo
220 220
  * @param int   $decimals Optional. Precision of the number of decimal places. Default 0.
221 221
  * @return string Converted number in string format.
222 222
  */
223
-function number_format_i18n( $number, $decimals = 0 ) {
223
+function number_format_i18n($number, $decimals = 0) {
224 224
 	global $wp_locale;
225 225
 
226
-	if ( isset( $wp_locale ) ) {
227
-		$formatted = number_format( $number, absint( $decimals ), $wp_locale->number_format['decimal_point'], $wp_locale->number_format['thousands_sep'] );
226
+	if (isset($wp_locale)) {
227
+		$formatted = number_format($number, absint($decimals), $wp_locale->number_format['decimal_point'], $wp_locale->number_format['thousands_sep']);
228 228
 	} else {
229
-		$formatted = number_format( $number, absint( $decimals ) );
229
+		$formatted = number_format($number, absint($decimals));
230 230
 	}
231 231
 
232 232
 	/**
@@ -236,7 +236,7 @@  discard block
 block discarded – undo
236 236
 	 *
237 237
 	 * @param string $formatted Converted number in string format.
238 238
 	 */
239
-	return apply_filters( 'number_format_i18n', $formatted );
239
+	return apply_filters('number_format_i18n', $formatted);
240 240
 }
241 241
 
242 242
 /**
@@ -259,7 +259,7 @@  discard block
 block discarded – undo
259 259
  * @param int        $decimals Optional. Precision of number of decimal places. Default 0.
260 260
  * @return string|false False on failure. Number string on success.
261 261
  */
262
-function size_format( $bytes, $decimals = 0 ) {
262
+function size_format($bytes, $decimals = 0) {
263 263
 	$quant = array(
264 264
 		'TB' => TB_IN_BYTES,
265 265
 		'GB' => GB_IN_BYTES,
@@ -268,13 +268,13 @@  discard block
 block discarded – undo
268 268
 		'B'  => 1,
269 269
 	);
270 270
 
271
-	if ( 0 === $bytes ) {
272
-		return number_format_i18n( 0, $decimals ) . ' B';
271
+	if (0 === $bytes) {
272
+		return number_format_i18n(0, $decimals).' B';
273 273
 	}
274 274
 
275
-	foreach ( $quant as $unit => $mag ) {
276
-		if ( doubleval( $bytes ) >= $mag ) {
277
-			return number_format_i18n( $bytes / $mag, $decimals ) . ' ' . $unit;
275
+	foreach ($quant as $unit => $mag) {
276
+		if (doubleval($bytes) >= $mag) {
277
+			return number_format_i18n($bytes / $mag, $decimals).' '.$unit;
278 278
 		}
279 279
 	}
280 280
 
@@ -290,34 +290,34 @@  discard block
 block discarded – undo
290 290
  * @param int|string $start_of_week Optional. Start of the week as an integer. Default empty string.
291 291
  * @return array Keys are 'start' and 'end'.
292 292
  */
293
-function get_weekstartend( $mysqlstring, $start_of_week = '' ) {
293
+function get_weekstartend($mysqlstring, $start_of_week = '') {
294 294
 	// MySQL string year.
295
-	$my = substr( $mysqlstring, 0, 4 );
295
+	$my = substr($mysqlstring, 0, 4);
296 296
 
297 297
 	// MySQL string month.
298
-	$mm = substr( $mysqlstring, 8, 2 );
298
+	$mm = substr($mysqlstring, 8, 2);
299 299
 
300 300
 	// MySQL string day.
301
-	$md = substr( $mysqlstring, 5, 2 );
301
+	$md = substr($mysqlstring, 5, 2);
302 302
 
303 303
 	// The timestamp for MySQL string day.
304
-	$day = mktime( 0, 0, 0, $md, $mm, $my );
304
+	$day = mktime(0, 0, 0, $md, $mm, $my);
305 305
 
306 306
 	// The day of the week from the timestamp.
307
-	$weekday = date( 'w', $day );
307
+	$weekday = date('w', $day);
308 308
 
309
-	if ( !is_numeric($start_of_week) )
310
-		$start_of_week = get_option( 'start_of_week' );
309
+	if ( ! is_numeric($start_of_week))
310
+		$start_of_week = get_option('start_of_week');
311 311
 
312
-	if ( $weekday < $start_of_week )
312
+	if ($weekday < $start_of_week)
313 313
 		$weekday += 7;
314 314
 
315 315
 	// The most recent week start day on or before $day.
316
-	$start = $day - DAY_IN_SECONDS * ( $weekday - $start_of_week );
316
+	$start = $day - DAY_IN_SECONDS * ($weekday - $start_of_week);
317 317
 
318 318
 	// $start + 1 week - 1 second.
319 319
 	$end = $start + WEEK_IN_SECONDS - 1;
320
-	return compact( 'start', 'end' );
320
+	return compact('start', 'end');
321 321
 }
322 322
 
323 323
 /**
@@ -328,9 +328,9 @@  discard block
 block discarded – undo
328 328
  * @param string $original Maybe unserialized original, if is needed.
329 329
  * @return mixed Unserialized data can be any type.
330 330
  */
331
-function maybe_unserialize( $original ) {
332
-	if ( is_serialized( $original ) ) // don't attempt to unserialize data that wasn't serialized going in
333
-		return @unserialize( $original );
331
+function maybe_unserialize($original) {
332
+	if (is_serialized($original)) // don't attempt to unserialize data that wasn't serialized going in
333
+		return @unserialize($original);
334 334
 	return $original;
335 335
 }
336 336
 
@@ -346,57 +346,57 @@  discard block
 block discarded – undo
346 346
  * @param bool   $strict Optional. Whether to be strict about the end of the string. Default true.
347 347
  * @return bool False if not serialized and true if it was.
348 348
  */
349
-function is_serialized( $data, $strict = true ) {
349
+function is_serialized($data, $strict = true) {
350 350
 	// if it isn't a string, it isn't serialized.
351
-	if ( ! is_string( $data ) ) {
351
+	if ( ! is_string($data)) {
352 352
 		return false;
353 353
 	}
354
-	$data = trim( $data );
355
- 	if ( 'N;' == $data ) {
354
+	$data = trim($data);
355
+ 	if ('N;' == $data) {
356 356
 		return true;
357 357
 	}
358
-	if ( strlen( $data ) < 4 ) {
358
+	if (strlen($data) < 4) {
359 359
 		return false;
360 360
 	}
361
-	if ( ':' !== $data[1] ) {
361
+	if (':' !== $data[1]) {
362 362
 		return false;
363 363
 	}
364
-	if ( $strict ) {
365
-		$lastc = substr( $data, -1 );
366
-		if ( ';' !== $lastc && '}' !== $lastc ) {
364
+	if ($strict) {
365
+		$lastc = substr($data, -1);
366
+		if (';' !== $lastc && '}' !== $lastc) {
367 367
 			return false;
368 368
 		}
369 369
 	} else {
370
-		$semicolon = strpos( $data, ';' );
371
-		$brace     = strpos( $data, '}' );
370
+		$semicolon = strpos($data, ';');
371
+		$brace     = strpos($data, '}');
372 372
 		// Either ; or } must exist.
373
-		if ( false === $semicolon && false === $brace )
373
+		if (false === $semicolon && false === $brace)
374 374
 			return false;
375 375
 		// But neither must be in the first X characters.
376
-		if ( false !== $semicolon && $semicolon < 3 )
376
+		if (false !== $semicolon && $semicolon < 3)
377 377
 			return false;
378
-		if ( false !== $brace && $brace < 4 )
378
+		if (false !== $brace && $brace < 4)
379 379
 			return false;
380 380
 	}
381 381
 	$token = $data[0];
382
-	switch ( $token ) {
382
+	switch ($token) {
383 383
 		case 's' :
384
-			if ( $strict ) {
385
-				if ( '"' !== substr( $data, -2, 1 ) ) {
384
+			if ($strict) {
385
+				if ('"' !== substr($data, -2, 1)) {
386 386
 					return false;
387 387
 				}
388
-			} elseif ( false === strpos( $data, '"' ) ) {
388
+			} elseif (false === strpos($data, '"')) {
389 389
 				return false;
390 390
 			}
391 391
 			// or else fall through
392 392
 		case 'a' :
393 393
 		case 'O' :
394
-			return (bool) preg_match( "/^{$token}:[0-9]+:/s", $data );
394
+			return (bool) preg_match("/^{$token}:[0-9]+:/s", $data);
395 395
 		case 'b' :
396 396
 		case 'i' :
397 397
 		case 'd' :
398 398
 			$end = $strict ? '$' : '';
399
-			return (bool) preg_match( "/^{$token}:[0-9.E-]+;$end/", $data );
399
+			return (bool) preg_match("/^{$token}:[0-9.E-]+;$end/", $data);
400 400
 	}
401 401
 	return false;
402 402
 }
@@ -409,21 +409,21 @@  discard block
 block discarded – undo
409 409
  * @param string $data Serialized data.
410 410
  * @return bool False if not a serialized string, true if it is.
411 411
  */
412
-function is_serialized_string( $data ) {
412
+function is_serialized_string($data) {
413 413
 	// if it isn't a string, it isn't a serialized string.
414
-	if ( ! is_string( $data ) ) {
414
+	if ( ! is_string($data)) {
415 415
 		return false;
416 416
 	}
417
-	$data = trim( $data );
418
-	if ( strlen( $data ) < 4 ) {
417
+	$data = trim($data);
418
+	if (strlen($data) < 4) {
419 419
 		return false;
420
-	} elseif ( ':' !== $data[1] ) {
420
+	} elseif (':' !== $data[1]) {
421 421
 		return false;
422
-	} elseif ( ';' !== substr( $data, -1 ) ) {
422
+	} elseif (';' !== substr($data, -1)) {
423 423
 		return false;
424
-	} elseif ( $data[0] !== 's' ) {
424
+	} elseif ($data[0] !== 's') {
425 425
 		return false;
426
-	} elseif ( '"' !== substr( $data, -2, 1 ) ) {
426
+	} elseif ('"' !== substr($data, -2, 1)) {
427 427
 		return false;
428 428
 	} else {
429 429
 		return true;
@@ -438,15 +438,15 @@  discard block
 block discarded – undo
438 438
  * @param string|array|object $data Data that might be serialized.
439 439
  * @return mixed A scalar data
440 440
  */
441
-function maybe_serialize( $data ) {
442
-	if ( is_array( $data ) || is_object( $data ) )
443
-		return serialize( $data );
441
+function maybe_serialize($data) {
442
+	if (is_array($data) || is_object($data))
443
+		return serialize($data);
444 444
 
445 445
 	// Double serialization is required for backward compatibility.
446 446
 	// See https://core.trac.wordpress.org/ticket/12930
447 447
 	// Also the world will end. See WP 3.6.1.
448
-	if ( is_serialized( $data, false ) )
449
-		return serialize( $data );
448
+	if (is_serialized($data, false))
449
+		return serialize($data);
450 450
 
451 451
 	return $data;
452 452
 }
@@ -464,9 +464,9 @@  discard block
 block discarded – undo
464 464
  * @param string $content XMLRPC XML Request content
465 465
  * @return string Post title
466 466
  */
467
-function xmlrpc_getposttitle( $content ) {
467
+function xmlrpc_getposttitle($content) {
468 468
 	global $post_default_title;
469
-	if ( preg_match( '/<title>(.+?)<\/title>/is', $content, $matchtitle ) ) {
469
+	if (preg_match('/<title>(.+?)<\/title>/is', $content, $matchtitle)) {
470 470
 		$post_title = $matchtitle[1];
471 471
 	} else {
472 472
 		$post_title = $post_default_title;
@@ -488,11 +488,11 @@  discard block
 block discarded – undo
488 488
  * @param string $content XMLRPC XML Request content
489 489
  * @return string|array List of categories or category name.
490 490
  */
491
-function xmlrpc_getpostcategory( $content ) {
491
+function xmlrpc_getpostcategory($content) {
492 492
 	global $post_default_category;
493
-	if ( preg_match( '/<category>(.+?)<\/category>/is', $content, $matchcat ) ) {
494
-		$post_category = trim( $matchcat[1], ',' );
495
-		$post_category = explode( ',', $post_category );
493
+	if (preg_match('/<category>(.+?)<\/category>/is', $content, $matchcat)) {
494
+		$post_category = trim($matchcat[1], ',');
495
+		$post_category = explode(',', $post_category);
496 496
 	} else {
497 497
 		$post_category = $post_default_category;
498 498
 	}
@@ -507,10 +507,10 @@  discard block
 block discarded – undo
507 507
  * @param string $content XML-RPC XML Request content.
508 508
  * @return string XMLRPC XML Request content without title and category elements.
509 509
  */
510
-function xmlrpc_removepostdata( $content ) {
511
-	$content = preg_replace( '/<title>(.+?)<\/title>/si', '', $content );
512
-	$content = preg_replace( '/<category>(.+?)<\/category>/si', '', $content );
513
-	$content = trim( $content );
510
+function xmlrpc_removepostdata($content) {
511
+	$content = preg_replace('/<title>(.+?)<\/title>/si', '', $content);
512
+	$content = preg_replace('/<category>(.+?)<\/category>/si', '', $content);
513
+	$content = trim($content);
514 514
 	return $content;
515 515
 }
516 516
 
@@ -522,7 +522,7 @@  discard block
 block discarded – undo
522 522
  * @param string $content Content to extract URLs from.
523 523
  * @return array URLs found in passed string.
524 524
  */
525
-function wp_extract_urls( $content ) {
525
+function wp_extract_urls($content) {
526 526
 	preg_match_all(
527 527
 		"#([\"']?)("
528 528
 			. "(?:([\w-]+:)?//?)"
@@ -540,9 +540,9 @@  discard block
 block discarded – undo
540 540
 		$post_links
541 541
 	);
542 542
 
543
-	$post_links = array_unique( array_map( 'html_entity_decode', $post_links[2] ) );
543
+	$post_links = array_unique(array_map('html_entity_decode', $post_links[2]));
544 544
 
545
-	return array_values( $post_links );
545
+	return array_values($post_links);
546 546
 }
547 547
 
548 548
 /**
@@ -559,34 +559,34 @@  discard block
 block discarded – undo
559 559
  * @param string $content Post Content.
560 560
  * @param int    $post_ID Post ID.
561 561
  */
562
-function do_enclose( $content, $post_ID ) {
562
+function do_enclose($content, $post_ID) {
563 563
 	global $wpdb;
564 564
 
565 565
 	//TODO: Tidy this ghetto code up and make the debug code optional
566
-	include_once( ABSPATH . WPINC . '/class-IXR.php' );
566
+	include_once(ABSPATH.WPINC.'/class-IXR.php');
567 567
 
568 568
 	$post_links = array();
569 569
 
570
-	$pung = get_enclosed( $post_ID );
570
+	$pung = get_enclosed($post_ID);
571 571
 
572
-	$post_links_temp = wp_extract_urls( $content );
572
+	$post_links_temp = wp_extract_urls($content);
573 573
 
574
-	foreach ( $pung as $link_test ) {
575
-		if ( ! in_array( $link_test, $post_links_temp ) ) { // link no longer in post
576
-			$mids = $wpdb->get_col( $wpdb->prepare("SELECT meta_id FROM $wpdb->postmeta WHERE post_id = %d AND meta_key = 'enclosure' AND meta_value LIKE %s", $post_ID, $wpdb->esc_like( $link_test ) . '%') );
577
-			foreach ( $mids as $mid )
578
-				delete_metadata_by_mid( 'post', $mid );
574
+	foreach ($pung as $link_test) {
575
+		if ( ! in_array($link_test, $post_links_temp)) { // link no longer in post
576
+			$mids = $wpdb->get_col($wpdb->prepare("SELECT meta_id FROM $wpdb->postmeta WHERE post_id = %d AND meta_key = 'enclosure' AND meta_value LIKE %s", $post_ID, $wpdb->esc_like($link_test).'%'));
577
+			foreach ($mids as $mid)
578
+				delete_metadata_by_mid('post', $mid);
579 579
 		}
580 580
 	}
581 581
 
582
-	foreach ( (array) $post_links_temp as $link_test ) {
583
-		if ( !in_array( $link_test, $pung ) ) { // If we haven't pung it already
584
-			$test = @parse_url( $link_test );
585
-			if ( false === $test )
582
+	foreach ((array) $post_links_temp as $link_test) {
583
+		if ( ! in_array($link_test, $pung)) { // If we haven't pung it already
584
+			$test = @parse_url($link_test);
585
+			if (false === $test)
586 586
 				continue;
587
-			if ( isset( $test['query'] ) )
587
+			if (isset($test['query']))
588 588
 				$post_links[] = $link_test;
589
-			elseif ( isset($test['path']) && ( $test['path'] != '/' ) &&  ($test['path'] != '' ) )
589
+			elseif (isset($test['path']) && ($test['path'] != '/') && ($test['path'] != ''))
590 590
 				$post_links[] = $link_test;
591 591
 		}
592 592
 	}
@@ -602,24 +602,24 @@  discard block
 block discarded – undo
602 602
 	 * @param array $post_links An array of enclosure links.
603 603
 	 * @param int   $post_ID    Post ID.
604 604
 	 */
605
-	$post_links = apply_filters( 'enclosure_links', $post_links, $post_ID );
605
+	$post_links = apply_filters('enclosure_links', $post_links, $post_ID);
606 606
 
607
-	foreach ( (array) $post_links as $url ) {
608
-		if ( $url != '' && !$wpdb->get_var( $wpdb->prepare( "SELECT post_id FROM $wpdb->postmeta WHERE post_id = %d AND meta_key = 'enclosure' AND meta_value LIKE %s", $post_ID, $wpdb->esc_like( $url ) . '%' ) ) ) {
607
+	foreach ((array) $post_links as $url) {
608
+		if ($url != '' && ! $wpdb->get_var($wpdb->prepare("SELECT post_id FROM $wpdb->postmeta WHERE post_id = %d AND meta_key = 'enclosure' AND meta_value LIKE %s", $post_ID, $wpdb->esc_like($url).'%'))) {
609 609
 
610
-			if ( $headers = wp_get_http_headers( $url) ) {
611
-				$len = isset( $headers['content-length'] ) ? (int) $headers['content-length'] : 0;
612
-				$type = isset( $headers['content-type'] ) ? $headers['content-type'] : '';
613
-				$allowed_types = array( 'video', 'audio' );
610
+			if ($headers = wp_get_http_headers($url)) {
611
+				$len = isset($headers['content-length']) ? (int) $headers['content-length'] : 0;
612
+				$type = isset($headers['content-type']) ? $headers['content-type'] : '';
613
+				$allowed_types = array('video', 'audio');
614 614
 
615 615
 				// Check to see if we can figure out the mime type from
616 616
 				// the extension
617
-				$url_parts = @parse_url( $url );
618
-				if ( false !== $url_parts ) {
619
-					$extension = pathinfo( $url_parts['path'], PATHINFO_EXTENSION );
620
-					if ( !empty( $extension ) ) {
621
-						foreach ( wp_get_mime_types() as $exts => $mime ) {
622
-							if ( preg_match( '!^(' . $exts . ')$!i', $extension ) ) {
617
+				$url_parts = @parse_url($url);
618
+				if (false !== $url_parts) {
619
+					$extension = pathinfo($url_parts['path'], PATHINFO_EXTENSION);
620
+					if ( ! empty($extension)) {
621
+						foreach (wp_get_mime_types() as $exts => $mime) {
622
+							if (preg_match('!^('.$exts.')$!i', $extension)) {
623 623
 								$type = $mime;
624 624
 								break;
625 625
 							}
@@ -627,8 +627,8 @@  discard block
 block discarded – undo
627 627
 					}
628 628
 				}
629 629
 
630
-				if ( in_array( substr( $type, 0, strpos( $type, "/" ) ), $allowed_types ) ) {
631
-					add_post_meta( $post_ID, 'enclosure', "$url\n$len\n$mime\n" );
630
+				if (in_array(substr($type, 0, strpos($type, "/")), $allowed_types)) {
631
+					add_post_meta($post_ID, 'enclosure', "$url\n$len\n$mime\n");
632 632
 				}
633 633
 			}
634 634
 		}
@@ -644,16 +644,16 @@  discard block
 block discarded – undo
644 644
  * @param bool   $deprecated Not Used.
645 645
  * @return bool|string False on failure, headers on success.
646 646
  */
647
-function wp_get_http_headers( $url, $deprecated = false ) {
648
-	if ( !empty( $deprecated ) )
649
-		_deprecated_argument( __FUNCTION__, '2.7.0' );
647
+function wp_get_http_headers($url, $deprecated = false) {
648
+	if ( ! empty($deprecated))
649
+		_deprecated_argument(__FUNCTION__, '2.7.0');
650 650
 
651
-	$response = wp_safe_remote_head( $url );
651
+	$response = wp_safe_remote_head($url);
652 652
 
653
-	if ( is_wp_error( $response ) )
653
+	if (is_wp_error($response))
654 654
 		return false;
655 655
 
656
-	return wp_remote_retrieve_headers( $response );
656
+	return wp_remote_retrieve_headers($response);
657 657
 }
658 658
 
659 659
 /**
@@ -669,7 +669,7 @@  discard block
 block discarded – undo
669 669
  */
670 670
 function is_new_day() {
671 671
 	global $currentday, $previousday;
672
-	if ( $currentday != $previousday )
672
+	if ($currentday != $previousday)
673 673
 		return 1;
674 674
 	else
675 675
 		return 0;
@@ -690,8 +690,8 @@  discard block
 block discarded – undo
690 690
  * @param array $data URL-encode key/value pairs.
691 691
  * @return string URL-encoded string.
692 692
  */
693
-function build_query( $data ) {
694
-	return _http_build_query( $data, null, '&', '', false );
693
+function build_query($data) {
694
+	return _http_build_query($data, null, '&', '', false);
695 695
 }
696 696
 
697 697
 /**
@@ -712,30 +712,30 @@  discard block
 block discarded – undo
712 712
  *
713 713
  * @return string The query string.
714 714
  */
715
-function _http_build_query( $data, $prefix = null, $sep = null, $key = '', $urlencode = true ) {
715
+function _http_build_query($data, $prefix = null, $sep = null, $key = '', $urlencode = true) {
716 716
 	$ret = array();
717 717
 
718
-	foreach ( (array) $data as $k => $v ) {
719
-		if ( $urlencode)
718
+	foreach ((array) $data as $k => $v) {
719
+		if ($urlencode)
720 720
 			$k = urlencode($k);
721
-		if ( is_int($k) && $prefix != null )
721
+		if (is_int($k) && $prefix != null)
722 722
 			$k = $prefix.$k;
723
-		if ( !empty($key) )
724
-			$k = $key . '%5B' . $k . '%5D';
725
-		if ( $v === null )
723
+		if ( ! empty($key))
724
+			$k = $key.'%5B'.$k.'%5D';
725
+		if ($v === null)
726 726
 			continue;
727
-		elseif ( $v === false )
727
+		elseif ($v === false)
728 728
 			$v = '0';
729 729
 
730
-		if ( is_array($v) || is_object($v) )
731
-			array_push($ret,_http_build_query($v, '', $sep, $k, $urlencode));
732
-		elseif ( $urlencode )
730
+		if (is_array($v) || is_object($v))
731
+			array_push($ret, _http_build_query($v, '', $sep, $k, $urlencode));
732
+		elseif ($urlencode)
733 733
 			array_push($ret, $k.'='.urlencode($v));
734 734
 		else
735 735
 			array_push($ret, $k.'='.$v);
736 736
 	}
737 737
 
738
-	if ( null === $sep )
738
+	if (null === $sep)
739 739
 		$sep = ini_get('arg_separator.output');
740 740
 
741 741
 	return implode($sep, $ret);
@@ -778,64 +778,64 @@  discard block
 block discarded – undo
778 778
  */
779 779
 function add_query_arg() {
780 780
 	$args = func_get_args();
781
-	if ( is_array( $args[0] ) ) {
782
-		if ( count( $args ) < 2 || false === $args[1] )
781
+	if (is_array($args[0])) {
782
+		if (count($args) < 2 || false === $args[1])
783 783
 			$uri = $_SERVER['REQUEST_URI'];
784 784
 		else
785 785
 			$uri = $args[1];
786 786
 	} else {
787
-		if ( count( $args ) < 3 || false === $args[2] )
787
+		if (count($args) < 3 || false === $args[2])
788 788
 			$uri = $_SERVER['REQUEST_URI'];
789 789
 		else
790 790
 			$uri = $args[2];
791 791
 	}
792 792
 
793
-	if ( $frag = strstr( $uri, '#' ) )
794
-		$uri = substr( $uri, 0, -strlen( $frag ) );
793
+	if ($frag = strstr($uri, '#'))
794
+		$uri = substr($uri, 0, -strlen($frag));
795 795
 	else
796 796
 		$frag = '';
797 797
 
798
-	if ( 0 === stripos( $uri, 'http://' ) ) {
798
+	if (0 === stripos($uri, 'http://')) {
799 799
 		$protocol = 'http://';
800
-		$uri = substr( $uri, 7 );
801
-	} elseif ( 0 === stripos( $uri, 'https://' ) ) {
800
+		$uri = substr($uri, 7);
801
+	} elseif (0 === stripos($uri, 'https://')) {
802 802
 		$protocol = 'https://';
803
-		$uri = substr( $uri, 8 );
803
+		$uri = substr($uri, 8);
804 804
 	} else {
805 805
 		$protocol = '';
806 806
 	}
807 807
 
808
-	if ( strpos( $uri, '?' ) !== false ) {
809
-		list( $base, $query ) = explode( '?', $uri, 2 );
808
+	if (strpos($uri, '?') !== false) {
809
+		list($base, $query) = explode('?', $uri, 2);
810 810
 		$base .= '?';
811
-	} elseif ( $protocol || strpos( $uri, '=' ) === false ) {
812
-		$base = $uri . '?';
811
+	} elseif ($protocol || strpos($uri, '=') === false) {
812
+		$base = $uri.'?';
813 813
 		$query = '';
814 814
 	} else {
815 815
 		$base = '';
816 816
 		$query = $uri;
817 817
 	}
818 818
 
819
-	wp_parse_str( $query, $qs );
820
-	$qs = urlencode_deep( $qs ); // this re-URL-encodes things that were already in the query string
821
-	if ( is_array( $args[0] ) ) {
822
-		foreach ( $args[0] as $k => $v ) {
823
-			$qs[ $k ] = $v;
819
+	wp_parse_str($query, $qs);
820
+	$qs = urlencode_deep($qs); // this re-URL-encodes things that were already in the query string
821
+	if (is_array($args[0])) {
822
+		foreach ($args[0] as $k => $v) {
823
+			$qs[$k] = $v;
824 824
 		}
825 825
 	} else {
826
-		$qs[ $args[0] ] = $args[1];
826
+		$qs[$args[0]] = $args[1];
827 827
 	}
828 828
 
829
-	foreach ( $qs as $k => $v ) {
830
-		if ( $v === false )
831
-			unset( $qs[$k] );
829
+	foreach ($qs as $k => $v) {
830
+		if ($v === false)
831
+			unset($qs[$k]);
832 832
 	}
833 833
 
834
-	$ret = build_query( $qs );
835
-	$ret = trim( $ret, '?' );
836
-	$ret = preg_replace( '#=(&|$)#', '$1', $ret );
837
-	$ret = $protocol . $base . $ret . $frag;
838
-	$ret = rtrim( $ret, '?' );
834
+	$ret = build_query($qs);
835
+	$ret = trim($ret, '?');
836
+	$ret = preg_replace('#=(&|$)#', '$1', $ret);
837
+	$ret = $protocol.$base.$ret.$frag;
838
+	$ret = rtrim($ret, '?');
839 839
 	return $ret;
840 840
 }
841 841
 
@@ -848,13 +848,13 @@  discard block
 block discarded – undo
848 848
  * @param bool|string  $query Optional. When false uses the current URL. Default false.
849 849
  * @return string New URL query string.
850 850
  */
851
-function remove_query_arg( $key, $query = false ) {
852
-	if ( is_array( $key ) ) { // removing multiple keys
853
-		foreach ( $key as $k )
854
-			$query = add_query_arg( $k, false, $query );
851
+function remove_query_arg($key, $query = false) {
852
+	if (is_array($key)) { // removing multiple keys
853
+		foreach ($key as $k)
854
+			$query = add_query_arg($k, false, $query);
855 855
 		return $query;
856 856
 	}
857
-	return add_query_arg( $key, false, $query );
857
+	return add_query_arg($key, false, $query);
858 858
 }
859 859
 
860 860
 /**
@@ -898,7 +898,7 @@  discard block
 block discarded – undo
898 898
 	 *
899 899
 	 * @param array $removable_query_args An array of query variables to remove from a URL.
900 900
 	 */
901
-	return apply_filters( 'removable_query_args', $removable_query_args );
901
+	return apply_filters('removable_query_args', $removable_query_args);
902 902
 }
903 903
 
904 904
 /**
@@ -909,12 +909,12 @@  discard block
 block discarded – undo
909 909
  * @param array $array Array to walk while sanitizing contents.
910 910
  * @return array Sanitized $array.
911 911
  */
912
-function add_magic_quotes( $array ) {
913
-	foreach ( (array) $array as $k => $v ) {
914
-		if ( is_array( $v ) ) {
915
-			$array[$k] = add_magic_quotes( $v );
912
+function add_magic_quotes($array) {
913
+	foreach ((array) $array as $k => $v) {
914
+		if (is_array($v)) {
915
+			$array[$k] = add_magic_quotes($v);
916 916
 		} else {
917
-			$array[$k] = addslashes( $v );
917
+			$array[$k] = addslashes($v);
918 918
 		}
919 919
 	}
920 920
 	return $array;
@@ -930,21 +930,21 @@  discard block
 block discarded – undo
930 930
  * @param string $uri URI/URL of web page to retrieve.
931 931
  * @return false|string HTTP content. False on failure.
932 932
  */
933
-function wp_remote_fopen( $uri ) {
934
-	$parsed_url = @parse_url( $uri );
933
+function wp_remote_fopen($uri) {
934
+	$parsed_url = @parse_url($uri);
935 935
 
936
-	if ( !$parsed_url || !is_array( $parsed_url ) )
936
+	if ( ! $parsed_url || ! is_array($parsed_url))
937 937
 		return false;
938 938
 
939 939
 	$options = array();
940 940
 	$options['timeout'] = 10;
941 941
 
942
-	$response = wp_safe_remote_get( $uri, $options );
942
+	$response = wp_safe_remote_get($uri, $options);
943 943
 
944
-	if ( is_wp_error( $response ) )
944
+	if (is_wp_error($response))
945 945
 		return false;
946 946
 
947
-	return wp_remote_retrieve_body( $response );
947
+	return wp_remote_retrieve_body($response);
948 948
 }
949 949
 
950 950
 /**
@@ -958,11 +958,11 @@  discard block
 block discarded – undo
958 958
  *
959 959
  * @param string|array $query_vars Default WP_Query arguments.
960 960
  */
961
-function wp( $query_vars = '' ) {
961
+function wp($query_vars = '') {
962 962
 	global $wp, $wp_query, $wp_the_query;
963
-	$wp->main( $query_vars );
963
+	$wp->main($query_vars);
964 964
 
965
-	if ( !isset($wp_the_query) )
965
+	if ( ! isset($wp_the_query))
966 966
 		$wp_the_query = $wp_query;
967 967
 }
968 968
 
@@ -976,12 +976,12 @@  discard block
 block discarded – undo
976 976
  * @param int $code HTTP status code.
977 977
  * @return string Empty string if not found, or description if found.
978 978
  */
979
-function get_status_header_desc( $code ) {
979
+function get_status_header_desc($code) {
980 980
 	global $wp_header_to_desc;
981 981
 
982
-	$code = absint( $code );
982
+	$code = absint($code);
983 983
 
984
-	if ( !isset( $wp_header_to_desc ) ) {
984
+	if ( ! isset($wp_header_to_desc)) {
985 985
 		$wp_header_to_desc = array(
986 986
 			100 => 'Continue',
987 987
 			101 => 'Switching Protocols',
@@ -1049,7 +1049,7 @@  discard block
 block discarded – undo
1049 1049
 		);
1050 1050
 	}
1051 1051
 
1052
-	if ( isset( $wp_header_to_desc[$code] ) )
1052
+	if (isset($wp_header_to_desc[$code]))
1053 1053
 		return $wp_header_to_desc[$code];
1054 1054
 	else
1055 1055
 		return '';
@@ -1066,18 +1066,18 @@  discard block
 block discarded – undo
1066 1066
  * @param int    $code        HTTP status code.
1067 1067
  * @param string $description Optional. A custom description for the HTTP status.
1068 1068
  */
1069
-function status_header( $code, $description = '' ) {
1070
-	if ( ! $description ) {
1071
-		$description = get_status_header_desc( $code );
1069
+function status_header($code, $description = '') {
1070
+	if ( ! $description) {
1071
+		$description = get_status_header_desc($code);
1072 1072
 	}
1073 1073
 
1074
-	if ( empty( $description ) ) {
1074
+	if (empty($description)) {
1075 1075
 		return;
1076 1076
 	}
1077 1077
 
1078 1078
 	$protocol = wp_get_server_protocol();
1079 1079
 	$status_header = "$protocol $code $description";
1080
-	if ( function_exists( 'apply_filters' ) )
1080
+	if (function_exists('apply_filters'))
1081 1081
 
1082 1082
 		/**
1083 1083
 		 * Filters an HTTP status header.
@@ -1089,9 +1089,9 @@  discard block
 block discarded – undo
1089 1089
 		 * @param string $description   Description for the status code.
1090 1090
 		 * @param string $protocol      Server protocol.
1091 1091
 		 */
1092
-		$status_header = apply_filters( 'status_header', $status_header, $code, $description, $protocol );
1092
+		$status_header = apply_filters('status_header', $status_header, $code, $description, $protocol);
1093 1093
 
1094
-	@header( $status_header, true, $code );
1094
+	@header($status_header, true, $code);
1095 1095
 }
1096 1096
 
1097 1097
 /**
@@ -1110,7 +1110,7 @@  discard block
 block discarded – undo
1110 1110
 		'Cache-Control' => 'no-cache, must-revalidate, max-age=0',
1111 1111
 	);
1112 1112
 
1113
-	if ( function_exists('apply_filters') ) {
1113
+	if (function_exists('apply_filters')) {
1114 1114
 		/**
1115 1115
 		 * Filters the cache-controlling headers.
1116 1116
 		 *
@@ -1125,7 +1125,7 @@  discard block
 block discarded – undo
1125 1125
 		 *     @type string $Cache-Control Cache-Control header.
1126 1126
 		 * }
1127 1127
 		 */
1128
-		$headers = (array) apply_filters( 'nocache_headers', $headers );
1128
+		$headers = (array) apply_filters('nocache_headers', $headers);
1129 1129
 	}
1130 1130
 	$headers['Last-Modified'] = false;
1131 1131
 	return $headers;
@@ -1145,23 +1145,23 @@  discard block
 block discarded – undo
1145 1145
 function nocache_headers() {
1146 1146
 	$headers = wp_get_nocache_headers();
1147 1147
 
1148
-	unset( $headers['Last-Modified'] );
1148
+	unset($headers['Last-Modified']);
1149 1149
 
1150 1150
 	// In PHP 5.3+, make sure we are not sending a Last-Modified header.
1151
-	if ( function_exists( 'header_remove' ) ) {
1152
-		@header_remove( 'Last-Modified' );
1151
+	if (function_exists('header_remove')) {
1152
+		@header_remove('Last-Modified');
1153 1153
 	} else {
1154 1154
 		// In PHP 5.2, send an empty Last-Modified header, but only as a
1155 1155
 		// last resort to override a header already sent. #WP23021
1156
-		foreach ( headers_list() as $header ) {
1157
-			if ( 0 === stripos( $header, 'Last-Modified' ) ) {
1156
+		foreach (headers_list() as $header) {
1157
+			if (0 === stripos($header, 'Last-Modified')) {
1158 1158
 				$headers['Last-Modified'] = '';
1159 1159
 				break;
1160 1160
 			}
1161 1161
 		}
1162 1162
 	}
1163 1163
 
1164
-	foreach ( $headers as $name => $field_value )
1164
+	foreach ($headers as $name => $field_value)
1165 1165
 		@header("{$name}: {$field_value}");
1166 1166
 }
1167 1167
 
@@ -1173,9 +1173,9 @@  discard block
 block discarded – undo
1173 1173
 function cache_javascript_headers() {
1174 1174
 	$expiresOffset = 10 * DAY_IN_SECONDS;
1175 1175
 
1176
-	header( "Content-Type: text/javascript; charset=" . get_bloginfo( 'charset' ) );
1177
-	header( "Vary: Accept-Encoding" ); // Handle proxies
1178
-	header( "Expires: " . gmdate( "D, d M Y H:i:s", time() + $expiresOffset ) . " GMT" );
1176
+	header("Content-Type: text/javascript; charset=".get_bloginfo('charset'));
1177
+	header("Vary: Accept-Encoding"); // Handle proxies
1178
+	header("Expires: ".gmdate("D, d M Y H:i:s", time() + $expiresOffset)." GMT");
1179 1179
 }
1180 1180
 
1181 1181
 /**
@@ -1202,8 +1202,8 @@  discard block
 block discarded – undo
1202 1202
  * @param string $yn Character string containing either 'y' (yes) or 'n' (no).
1203 1203
  * @return bool True if yes, false on anything else.
1204 1204
  */
1205
-function bool_from_yn( $yn ) {
1206
-	return ( strtolower( $yn ) == 'y' );
1205
+function bool_from_yn($yn) {
1206
+	return (strtolower($yn) == 'y');
1207 1207
 }
1208 1208
 
1209 1209
 /**
@@ -1221,16 +1221,16 @@  discard block
 block discarded – undo
1221 1221
 function do_feed() {
1222 1222
 	global $wp_query;
1223 1223
 
1224
-	$feed = get_query_var( 'feed' );
1224
+	$feed = get_query_var('feed');
1225 1225
 
1226 1226
 	// Remove the pad, if present.
1227
-	$feed = preg_replace( '/^_+/', '', $feed );
1227
+	$feed = preg_replace('/^_+/', '', $feed);
1228 1228
 
1229
-	if ( $feed == '' || $feed == 'feed' )
1229
+	if ($feed == '' || $feed == 'feed')
1230 1230
 		$feed = get_default_feed();
1231 1231
 
1232
-	if ( ! has_action( "do_feed_{$feed}" ) ) {
1233
-		wp_die( __( 'ERROR: This is not a valid feed template.' ), '', array( 'response' => 404 ) );
1232
+	if ( ! has_action("do_feed_{$feed}")) {
1233
+		wp_die(__('ERROR: This is not a valid feed template.'), '', array('response' => 404));
1234 1234
 	}
1235 1235
 
1236 1236
 	/**
@@ -1245,7 +1245,7 @@  discard block
 block discarded – undo
1245 1245
 	 * @param bool   $is_comment_feed Whether the feed is a comment feed.
1246 1246
 	 * @param string $feed            The feed name.
1247 1247
 	 */
1248
-	do_action( "do_feed_{$feed}", $wp_query->is_comment_feed, $feed );
1248
+	do_action("do_feed_{$feed}", $wp_query->is_comment_feed, $feed);
1249 1249
 }
1250 1250
 
1251 1251
 /**
@@ -1256,7 +1256,7 @@  discard block
 block discarded – undo
1256 1256
  * @see load_template()
1257 1257
  */
1258 1258
 function do_feed_rdf() {
1259
-	load_template( ABSPATH . WPINC . '/feed-rdf.php' );
1259
+	load_template(ABSPATH.WPINC.'/feed-rdf.php');
1260 1260
 }
1261 1261
 
1262 1262
 /**
@@ -1267,7 +1267,7 @@  discard block
 block discarded – undo
1267 1267
  * @see load_template()
1268 1268
  */
1269 1269
 function do_feed_rss() {
1270
-	load_template( ABSPATH . WPINC . '/feed-rss.php' );
1270
+	load_template(ABSPATH.WPINC.'/feed-rss.php');
1271 1271
 }
1272 1272
 
1273 1273
 /**
@@ -1279,11 +1279,11 @@  discard block
 block discarded – undo
1279 1279
  *
1280 1280
  * @param bool $for_comments True for the comment feed, false for normal feed.
1281 1281
  */
1282
-function do_feed_rss2( $for_comments ) {
1283
-	if ( $for_comments )
1284
-		load_template( ABSPATH . WPINC . '/feed-rss2-comments.php' );
1282
+function do_feed_rss2($for_comments) {
1283
+	if ($for_comments)
1284
+		load_template(ABSPATH.WPINC.'/feed-rss2-comments.php');
1285 1285
 	else
1286
-		load_template( ABSPATH . WPINC . '/feed-rss2.php' );
1286
+		load_template(ABSPATH.WPINC.'/feed-rss2.php');
1287 1287
 }
1288 1288
 
1289 1289
 /**
@@ -1295,11 +1295,11 @@  discard block
 block discarded – undo
1295 1295
  *
1296 1296
  * @param bool $for_comments True for the comment feed, false for normal feed.
1297 1297
  */
1298
-function do_feed_atom( $for_comments ) {
1298
+function do_feed_atom($for_comments) {
1299 1299
 	if ($for_comments)
1300
-		load_template( ABSPATH . WPINC . '/feed-atom-comments.php');
1300
+		load_template(ABSPATH.WPINC.'/feed-atom-comments.php');
1301 1301
 	else
1302
-		load_template( ABSPATH . WPINC . '/feed-atom.php' );
1302
+		load_template(ABSPATH.WPINC.'/feed-atom.php');
1303 1303
 }
1304 1304
 
1305 1305
 /**
@@ -1311,22 +1311,22 @@  discard block
 block discarded – undo
1311 1311
  * @since 2.1.0
1312 1312
  */
1313 1313
 function do_robots() {
1314
-	header( 'Content-Type: text/plain; charset=utf-8' );
1314
+	header('Content-Type: text/plain; charset=utf-8');
1315 1315
 
1316 1316
 	/**
1317 1317
 	 * Fires when displaying the robots.txt file.
1318 1318
 	 *
1319 1319
 	 * @since 2.1.0
1320 1320
 	 */
1321
-	do_action( 'do_robotstxt' );
1321
+	do_action('do_robotstxt');
1322 1322
 
1323 1323
 	$output = "User-agent: *\n";
1324
-	$public = get_option( 'blog_public' );
1325
-	if ( '0' == $public ) {
1324
+	$public = get_option('blog_public');
1325
+	if ('0' == $public) {
1326 1326
 		$output .= "Disallow: /\n";
1327 1327
 	} else {
1328
-		$site_url = parse_url( site_url() );
1329
-		$path = ( !empty( $site_url['path'] ) ) ? $site_url['path'] : '';
1328
+		$site_url = parse_url(site_url());
1329
+		$path = ( ! empty($site_url['path'])) ? $site_url['path'] : '';
1330 1330
 		$output .= "Disallow: $path/wp-admin/\n";
1331 1331
 		$output .= "Allow: $path/wp-admin/admin-ajax.php\n";
1332 1332
 	}
@@ -1339,7 +1339,7 @@  discard block
 block discarded – undo
1339 1339
 	 * @param string $output Robots.txt output.
1340 1340
 	 * @param bool   $public Whether the site is considered "public".
1341 1341
 	 */
1342
-	echo apply_filters( 'robots_txt', $output, $public );
1342
+	echo apply_filters('robots_txt', $output, $public);
1343 1343
 }
1344 1344
 
1345 1345
 /**
@@ -1364,28 +1364,28 @@  discard block
 block discarded – undo
1364 1364
 	 * Check cache first. If options table goes away and we have true
1365 1365
 	 * cached, oh well.
1366 1366
 	 */
1367
-	if ( wp_cache_get( 'is_blog_installed' ) )
1367
+	if (wp_cache_get('is_blog_installed'))
1368 1368
 		return true;
1369 1369
 
1370 1370
 	$suppress = $wpdb->suppress_errors();
1371
-	if ( ! wp_installing() ) {
1371
+	if ( ! wp_installing()) {
1372 1372
 		$alloptions = wp_load_alloptions();
1373 1373
 	}
1374 1374
 	// If siteurl is not set to autoload, check it specifically
1375
-	if ( !isset( $alloptions['siteurl'] ) )
1376
-		$installed = $wpdb->get_var( "SELECT option_value FROM $wpdb->options WHERE option_name = 'siteurl'" );
1375
+	if ( ! isset($alloptions['siteurl']))
1376
+		$installed = $wpdb->get_var("SELECT option_value FROM $wpdb->options WHERE option_name = 'siteurl'");
1377 1377
 	else
1378 1378
 		$installed = $alloptions['siteurl'];
1379
-	$wpdb->suppress_errors( $suppress );
1379
+	$wpdb->suppress_errors($suppress);
1380 1380
 
1381
-	$installed = !empty( $installed );
1382
-	wp_cache_set( 'is_blog_installed', $installed );
1381
+	$installed = ! empty($installed);
1382
+	wp_cache_set('is_blog_installed', $installed);
1383 1383
 
1384
-	if ( $installed )
1384
+	if ($installed)
1385 1385
 		return true;
1386 1386
 
1387 1387
 	// If visiting repair.php, return true and let it take over.
1388
-	if ( defined( 'WP_REPAIRING' ) )
1388
+	if (defined('WP_REPAIRING'))
1389 1389
 		return true;
1390 1390
 
1391 1391
 	$suppress = $wpdb->suppress_errors();
@@ -1396,14 +1396,14 @@  discard block
 block discarded – undo
1396 1396
 	 * options table could not be accessed.
1397 1397
 	 */
1398 1398
 	$wp_tables = $wpdb->tables();
1399
-	foreach ( $wp_tables as $table ) {
1399
+	foreach ($wp_tables as $table) {
1400 1400
 		// The existence of custom user tables shouldn't suggest an insane state or prevent a clean install.
1401
-		if ( defined( 'CUSTOM_USER_TABLE' ) && CUSTOM_USER_TABLE == $table )
1401
+		if (defined('CUSTOM_USER_TABLE') && CUSTOM_USER_TABLE == $table)
1402 1402
 			continue;
1403
-		if ( defined( 'CUSTOM_USER_META_TABLE' ) && CUSTOM_USER_META_TABLE == $table )
1403
+		if (defined('CUSTOM_USER_META_TABLE') && CUSTOM_USER_META_TABLE == $table)
1404 1404
 			continue;
1405 1405
 
1406
-		if ( ! $wpdb->get_results( "DESCRIBE $table;" ) )
1406
+		if ( ! $wpdb->get_results("DESCRIBE $table;"))
1407 1407
 			continue;
1408 1408
 
1409 1409
 		// One or more tables exist. We are insane.
@@ -1411,13 +1411,13 @@  discard block
 block discarded – undo
1411 1411
 		wp_load_translations_early();
1412 1412
 
1413 1413
 		// Die with a DB error.
1414
-		$wpdb->error = sprintf( __( 'One or more database tables are unavailable. The database may need to be <a href="%s">repaired</a>.' ), 'maint/repair.php?referrer=is_blog_installed' );
1414
+		$wpdb->error = sprintf(__('One or more database tables are unavailable. The database may need to be <a href="%s">repaired</a>.'), 'maint/repair.php?referrer=is_blog_installed');
1415 1415
 		dead_db();
1416 1416
 	}
1417 1417
 
1418
-	$wpdb->suppress_errors( $suppress );
1418
+	$wpdb->suppress_errors($suppress);
1419 1419
 
1420
-	wp_cache_set( 'is_blog_installed', false );
1420
+	wp_cache_set('is_blog_installed', false);
1421 1421
 
1422 1422
 	return false;
1423 1423
 }
@@ -1432,9 +1432,9 @@  discard block
 block discarded – undo
1432 1432
  * @param string     $name      Optional. Nonce name. Default '_wpnonce'.
1433 1433
  * @return string Escaped URL with nonce action added.
1434 1434
  */
1435
-function wp_nonce_url( $actionurl, $action = -1, $name = '_wpnonce' ) {
1436
-	$actionurl = str_replace( '&amp;', '&', $actionurl );
1437
-	return esc_html( add_query_arg( $name, wp_create_nonce( $action ), $actionurl ) );
1435
+function wp_nonce_url($actionurl, $action = -1, $name = '_wpnonce') {
1436
+	$actionurl = str_replace('&amp;', '&', $actionurl);
1437
+	return esc_html(add_query_arg($name, wp_create_nonce($action), $actionurl));
1438 1438
 }
1439 1439
 
1440 1440
 /**
@@ -1463,14 +1463,14 @@  discard block
 block discarded – undo
1463 1463
  * @param bool       $echo    Optional. Whether to display or return hidden form field. Default true.
1464 1464
  * @return string Nonce field HTML markup.
1465 1465
  */
1466
-function wp_nonce_field( $action = -1, $name = "_wpnonce", $referer = true , $echo = true ) {
1467
-	$name = esc_attr( $name );
1468
-	$nonce_field = '<input type="hidden" id="' . $name . '" name="' . $name . '" value="' . wp_create_nonce( $action ) . '" />';
1466
+function wp_nonce_field($action = -1, $name = "_wpnonce", $referer = true, $echo = true) {
1467
+	$name = esc_attr($name);
1468
+	$nonce_field = '<input type="hidden" id="'.$name.'" name="'.$name.'" value="'.wp_create_nonce($action).'" />';
1469 1469
 
1470
-	if ( $referer )
1471
-		$nonce_field .= wp_referer_field( false );
1470
+	if ($referer)
1471
+		$nonce_field .= wp_referer_field(false);
1472 1472
 
1473
-	if ( $echo )
1473
+	if ($echo)
1474 1474
 		echo $nonce_field;
1475 1475
 
1476 1476
 	return $nonce_field;
@@ -1487,10 +1487,10 @@  discard block
 block discarded – undo
1487 1487
  * @param bool $echo Optional. Whether to echo or return the referer field. Default true.
1488 1488
  * @return string Referer field HTML markup.
1489 1489
  */
1490
-function wp_referer_field( $echo = true ) {
1491
-	$referer_field = '<input type="hidden" name="_wp_http_referer" value="'. esc_attr( wp_unslash( $_SERVER['REQUEST_URI'] ) ) . '" />';
1490
+function wp_referer_field($echo = true) {
1491
+	$referer_field = '<input type="hidden" name="_wp_http_referer" value="'.esc_attr(wp_unslash($_SERVER['REQUEST_URI'])).'" />';
1492 1492
 
1493
-	if ( $echo )
1493
+	if ($echo)
1494 1494
 		echo $referer_field;
1495 1495
 	return $referer_field;
1496 1496
 }
@@ -1509,12 +1509,12 @@  discard block
 block discarded – undo
1509 1509
  *                             Default 'current'.
1510 1510
  * @return string Original referer field.
1511 1511
  */
1512
-function wp_original_referer_field( $echo = true, $jump_back_to = 'current' ) {
1513
-	if ( ! $ref = wp_get_original_referer() ) {
1514
-		$ref = 'previous' == $jump_back_to ? wp_get_referer() : wp_unslash( $_SERVER['REQUEST_URI'] );
1512
+function wp_original_referer_field($echo = true, $jump_back_to = 'current') {
1513
+	if ( ! $ref = wp_get_original_referer()) {
1514
+		$ref = 'previous' == $jump_back_to ? wp_get_referer() : wp_unslash($_SERVER['REQUEST_URI']);
1515 1515
 	}
1516
-	$orig_referer_field = '<input type="hidden" name="_wp_original_http_referer" value="' . esc_attr( $ref ) . '" />';
1517
-	if ( $echo )
1516
+	$orig_referer_field = '<input type="hidden" name="_wp_original_http_referer" value="'.esc_attr($ref).'" />';
1517
+	if ($echo)
1518 1518
 		echo $orig_referer_field;
1519 1519
 	return $orig_referer_field;
1520 1520
 }
@@ -1529,14 +1529,14 @@  discard block
 block discarded – undo
1529 1529
  * @return false|string False on failure. Referer URL on success.
1530 1530
  */
1531 1531
 function wp_get_referer() {
1532
-	if ( ! function_exists( 'wp_validate_redirect' ) ) {
1532
+	if ( ! function_exists('wp_validate_redirect')) {
1533 1533
 		return false;
1534 1534
 	}
1535 1535
 
1536 1536
 	$ref = wp_get_raw_referer();
1537 1537
 
1538
-	if ( $ref && $ref !== wp_unslash( $_SERVER['REQUEST_URI'] ) && $ref !== home_url() . wp_unslash( $_SERVER['REQUEST_URI'] ) ) {
1539
-		return wp_validate_redirect( $ref, false );
1538
+	if ($ref && $ref !== wp_unslash($_SERVER['REQUEST_URI']) && $ref !== home_url().wp_unslash($_SERVER['REQUEST_URI'])) {
1539
+		return wp_validate_redirect($ref, false);
1540 1540
 	}
1541 1541
 
1542 1542
 	return false;
@@ -1552,10 +1552,10 @@  discard block
 block discarded – undo
1552 1552
  * @return string|false Referer URL on success, false on failure.
1553 1553
  */
1554 1554
 function wp_get_raw_referer() {
1555
-	if ( ! empty( $_REQUEST['_wp_http_referer'] ) ) {
1556
-		return wp_unslash( $_REQUEST['_wp_http_referer'] );
1557
-	} else if ( ! empty( $_SERVER['HTTP_REFERER'] ) ) {
1558
-		return wp_unslash( $_SERVER['HTTP_REFERER'] );
1555
+	if ( ! empty($_REQUEST['_wp_http_referer'])) {
1556
+		return wp_unslash($_REQUEST['_wp_http_referer']);
1557
+	} else if ( ! empty($_SERVER['HTTP_REFERER'])) {
1558
+		return wp_unslash($_SERVER['HTTP_REFERER']);
1559 1559
 	}
1560 1560
 
1561 1561
 	return false;
@@ -1569,8 +1569,8 @@  discard block
 block discarded – undo
1569 1569
  * @return string|false False if no original referer or original referer if set.
1570 1570
  */
1571 1571
 function wp_get_original_referer() {
1572
-	if ( ! empty( $_REQUEST['_wp_original_http_referer'] ) && function_exists( 'wp_validate_redirect' ) )
1573
-		return wp_validate_redirect( wp_unslash( $_REQUEST['_wp_original_http_referer'] ), false );
1572
+	if ( ! empty($_REQUEST['_wp_original_http_referer']) && function_exists('wp_validate_redirect'))
1573
+		return wp_validate_redirect(wp_unslash($_REQUEST['_wp_original_http_referer']), false);
1574 1574
 	return false;
1575 1575
 }
1576 1576
 
@@ -1584,20 +1584,20 @@  discard block
 block discarded – undo
1584 1584
  * @param string $target Full path to attempt to create.
1585 1585
  * @return bool Whether the path was created. True if path already exists.
1586 1586
  */
1587
-function wp_mkdir_p( $target ) {
1587
+function wp_mkdir_p($target) {
1588 1588
 	$wrapper = null;
1589 1589
 
1590 1590
 	// Strip the protocol.
1591
-	if ( wp_is_stream( $target ) ) {
1592
-		list( $wrapper, $target ) = explode( '://', $target, 2 );
1591
+	if (wp_is_stream($target)) {
1592
+		list($wrapper, $target) = explode('://', $target, 2);
1593 1593
 	}
1594 1594
 
1595 1595
 	// From php.net/mkdir user contributed notes.
1596
-	$target = str_replace( '//', '/', $target );
1596
+	$target = str_replace('//', '/', $target);
1597 1597
 
1598 1598
 	// Put the wrapper back on the target.
1599
-	if ( $wrapper !== null ) {
1600
-		$target = $wrapper . '://' . $target;
1599
+	if ($wrapper !== null) {
1600
+		$target = $wrapper.'://'.$target;
1601 1601
 	}
1602 1602
 
1603 1603
 	/*
@@ -1605,35 +1605,35 @@  discard block
 block discarded – undo
1605 1605
 	 * Use rtrim() instead of untrailingslashit to avoid formatting.php dependency.
1606 1606
 	 */
1607 1607
 	$target = rtrim($target, '/');
1608
-	if ( empty($target) )
1608
+	if (empty($target))
1609 1609
 		$target = '/';
1610 1610
 
1611
-	if ( file_exists( $target ) )
1612
-		return @is_dir( $target );
1611
+	if (file_exists($target))
1612
+		return @is_dir($target);
1613 1613
 
1614 1614
 	// We need to find the permissions of the parent folder that exists and inherit that.
1615
-	$target_parent = dirname( $target );
1616
-	while ( '.' != $target_parent && ! is_dir( $target_parent ) ) {
1617
-		$target_parent = dirname( $target_parent );
1615
+	$target_parent = dirname($target);
1616
+	while ('.' != $target_parent && ! is_dir($target_parent)) {
1617
+		$target_parent = dirname($target_parent);
1618 1618
 	}
1619 1619
 
1620 1620
 	// Get the permission bits.
1621
-	if ( $stat = @stat( $target_parent ) ) {
1621
+	if ($stat = @stat($target_parent)) {
1622 1622
 		$dir_perms = $stat['mode'] & 0007777;
1623 1623
 	} else {
1624 1624
 		$dir_perms = 0777;
1625 1625
 	}
1626 1626
 
1627
-	if ( @mkdir( $target, $dir_perms, true ) ) {
1627
+	if (@mkdir($target, $dir_perms, true)) {
1628 1628
 
1629 1629
 		/*
1630 1630
 		 * If a umask is set that modifies $dir_perms, we'll have to re-set
1631 1631
 		 * the $dir_perms correctly with chmod()
1632 1632
 		 */
1633
-		if ( $dir_perms != ( $dir_perms & ~umask() ) ) {
1634
-			$folder_parts = explode( '/', substr( $target, strlen( $target_parent ) + 1 ) );
1635
-			for ( $i = 1, $c = count( $folder_parts ); $i <= $c; $i++ ) {
1636
-				@chmod( $target_parent . '/' . implode( '/', array_slice( $folder_parts, 0, $i ) ), $dir_perms );
1633
+		if ($dir_perms != ($dir_perms & ~umask())) {
1634
+			$folder_parts = explode('/', substr($target, strlen($target_parent) + 1));
1635
+			for ($i = 1, $c = count($folder_parts); $i <= $c; $i++) {
1636
+				@chmod($target_parent.'/'.implode('/', array_slice($folder_parts, 0, $i)), $dir_perms);
1637 1637
 			}
1638 1638
 		}
1639 1639
 
@@ -1653,23 +1653,23 @@  discard block
 block discarded – undo
1653 1653
  * @param string $path File path.
1654 1654
  * @return bool True if path is absolute, false is not absolute.
1655 1655
  */
1656
-function path_is_absolute( $path ) {
1656
+function path_is_absolute($path) {
1657 1657
 	/*
1658 1658
 	 * This is definitive if true but fails if $path does not exist or contains
1659 1659
 	 * a symbolic link.
1660 1660
 	 */
1661
-	if ( realpath($path) == $path )
1661
+	if (realpath($path) == $path)
1662 1662
 		return true;
1663 1663
 
1664
-	if ( strlen($path) == 0 || $path[0] == '.' )
1664
+	if (strlen($path) == 0 || $path[0] == '.')
1665 1665
 		return false;
1666 1666
 
1667 1667
 	// Windows allows absolute paths like this.
1668
-	if ( preg_match('#^[a-zA-Z]:\\\\#', $path) )
1668
+	if (preg_match('#^[a-zA-Z]:\\\\#', $path))
1669 1669
 		return true;
1670 1670
 
1671 1671
 	// A path starting with / or \ is absolute; anything else is relative.
1672
-	return ( $path[0] == '/' || $path[0] == '\\' );
1672
+	return ($path[0] == '/' || $path[0] == '\\');
1673 1673
 }
1674 1674
 
1675 1675
 /**
@@ -1684,11 +1684,11 @@  discard block
 block discarded – undo
1684 1684
  * @param string $path Path relative to $base.
1685 1685
  * @return string The path with the base or absolute path.
1686 1686
  */
1687
-function path_join( $base, $path ) {
1688
-	if ( path_is_absolute($path) )
1687
+function path_join($base, $path) {
1688
+	if (path_is_absolute($path))
1689 1689
 		return $path;
1690 1690
 
1691
-	return rtrim($base, '/') . '/' . ltrim($path, '/');
1691
+	return rtrim($base, '/').'/'.ltrim($path, '/');
1692 1692
 }
1693 1693
 
1694 1694
 /**
@@ -1706,11 +1706,11 @@  discard block
 block discarded – undo
1706 1706
  * @param string $path Path to normalize.
1707 1707
  * @return string Normalized path.
1708 1708
  */
1709
-function wp_normalize_path( $path ) {
1710
-	$path = str_replace( '\\', '/', $path );
1711
-	$path = preg_replace( '|(?<=.)/+|', '/', $path );
1712
-	if ( ':' === substr( $path, 1, 1 ) ) {
1713
-		$path = ucfirst( $path );
1709
+function wp_normalize_path($path) {
1710
+	$path = str_replace('\\', '/', $path);
1711
+	$path = preg_replace('|(?<=.)/+|', '/', $path);
1712
+	if (':' === substr($path, 1, 1)) {
1713
+		$path = ucfirst($path);
1714 1714
 	}
1715 1715
 	return $path;
1716 1716
 }
@@ -1733,24 +1733,24 @@  discard block
 block discarded – undo
1733 1733
  */
1734 1734
 function get_temp_dir() {
1735 1735
 	static $temp = '';
1736
-	if ( defined('WP_TEMP_DIR') )
1736
+	if (defined('WP_TEMP_DIR'))
1737 1737
 		return trailingslashit(WP_TEMP_DIR);
1738 1738
 
1739
-	if ( $temp )
1740
-		return trailingslashit( $temp );
1739
+	if ($temp)
1740
+		return trailingslashit($temp);
1741 1741
 
1742
-	if ( function_exists('sys_get_temp_dir') ) {
1742
+	if (function_exists('sys_get_temp_dir')) {
1743 1743
 		$temp = sys_get_temp_dir();
1744
-		if ( @is_dir( $temp ) && wp_is_writable( $temp ) )
1745
-			return trailingslashit( $temp );
1744
+		if (@is_dir($temp) && wp_is_writable($temp))
1745
+			return trailingslashit($temp);
1746 1746
 	}
1747 1747
 
1748 1748
 	$temp = ini_get('upload_tmp_dir');
1749
-	if ( @is_dir( $temp ) && wp_is_writable( $temp ) )
1750
-		return trailingslashit( $temp );
1749
+	if (@is_dir($temp) && wp_is_writable($temp))
1750
+		return trailingslashit($temp);
1751 1751
 
1752
-	$temp = WP_CONTENT_DIR . '/';
1753
-	if ( is_dir( $temp ) && wp_is_writable( $temp ) )
1752
+	$temp = WP_CONTENT_DIR.'/';
1753
+	if (is_dir($temp) && wp_is_writable($temp))
1754 1754
 		return $temp;
1755 1755
 
1756 1756
 	return '/tmp/';
@@ -1769,11 +1769,11 @@  discard block
 block discarded – undo
1769 1769
  * @param string $path Path to check for write-ability.
1770 1770
  * @return bool Whether the path is writable.
1771 1771
  */
1772
-function wp_is_writable( $path ) {
1773
-	if ( 'WIN' === strtoupper( substr( PHP_OS, 0, 3 ) ) )
1774
-		return win_is_writable( $path );
1772
+function wp_is_writable($path) {
1773
+	if ('WIN' === strtoupper(substr(PHP_OS, 0, 3)))
1774
+		return win_is_writable($path);
1775 1775
 	else
1776
-		return @is_writable( $path );
1776
+		return @is_writable($path);
1777 1777
 }
1778 1778
 
1779 1779
 /**
@@ -1792,21 +1792,21 @@  discard block
 block discarded – undo
1792 1792
  * @param string $path Windows path to check for write-ability.
1793 1793
  * @return bool Whether the path is writable.
1794 1794
  */
1795
-function win_is_writable( $path ) {
1795
+function win_is_writable($path) {
1796 1796
 
1797
-	if ( $path[strlen( $path ) - 1] == '/' ) { // if it looks like a directory, check a random file within the directory
1798
-		return win_is_writable( $path . uniqid( mt_rand() ) . '.tmp');
1799
-	} elseif ( is_dir( $path ) ) { // If it's a directory (and not a file) check a random file within the directory
1800
-		return win_is_writable( $path . '/' . uniqid( mt_rand() ) . '.tmp' );
1797
+	if ($path[strlen($path) - 1] == '/') { // if it looks like a directory, check a random file within the directory
1798
+		return win_is_writable($path.uniqid(mt_rand()).'.tmp');
1799
+	} elseif (is_dir($path)) { // If it's a directory (and not a file) check a random file within the directory
1800
+		return win_is_writable($path.'/'.uniqid(mt_rand()).'.tmp');
1801 1801
 	}
1802 1802
 	// check tmp file for read/write capabilities
1803
-	$should_delete_tmp_file = !file_exists( $path );
1804
-	$f = @fopen( $path, 'a' );
1805
-	if ( $f === false )
1803
+	$should_delete_tmp_file = ! file_exists($path);
1804
+	$f = @fopen($path, 'a');
1805
+	if ($f === false)
1806 1806
 		return false;
1807
-	fclose( $f );
1808
-	if ( $should_delete_tmp_file )
1809
-		unlink( $path );
1807
+	fclose($f);
1808
+	if ($should_delete_tmp_file)
1809
+		unlink($path);
1810 1810
 	return true;
1811 1811
 }
1812 1812
 
@@ -1824,7 +1824,7 @@  discard block
 block discarded – undo
1824 1824
  * @return array See wp_upload_dir() for description.
1825 1825
  */
1826 1826
 function wp_get_upload_dir() {
1827
-	return wp_upload_dir( null, false );
1827
+	return wp_upload_dir(null, false);
1828 1828
 }
1829 1829
 
1830 1830
 /**
@@ -1863,13 +1863,13 @@  discard block
 block discarded – undo
1863 1863
  * @param bool   $refresh_cache Optional. Whether to refresh the cache. Default false.
1864 1864
  * @return array See above for description.
1865 1865
  */
1866
-function wp_upload_dir( $time = null, $create_dir = true, $refresh_cache = false ) {
1866
+function wp_upload_dir($time = null, $create_dir = true, $refresh_cache = false) {
1867 1867
 	static $cache = array(), $tested_paths = array();
1868 1868
 
1869
-	$key = sprintf( '%d-%s', get_current_blog_id(), (string) $time );
1869
+	$key = sprintf('%d-%s', get_current_blog_id(), (string) $time);
1870 1870
 
1871
-	if ( $refresh_cache || empty( $cache[ $key ] ) ) {
1872
-		$cache[ $key ] = _wp_upload_dir( $time );
1871
+	if ($refresh_cache || empty($cache[$key])) {
1872
+		$cache[$key] = _wp_upload_dir($time);
1873 1873
 	}
1874 1874
 
1875 1875
 	/**
@@ -1880,25 +1880,25 @@  discard block
 block discarded – undo
1880 1880
 	 * @param array $uploads Array of upload directory data with keys of 'path',
1881 1881
 	 *                       'url', 'subdir, 'basedir', and 'error'.
1882 1882
 	 */
1883
-	$uploads = apply_filters( 'upload_dir', $cache[ $key ] );
1883
+	$uploads = apply_filters('upload_dir', $cache[$key]);
1884 1884
 
1885
-	if ( $create_dir ) {
1885
+	if ($create_dir) {
1886 1886
 		$path = $uploads['path'];
1887 1887
 
1888
-		if ( array_key_exists( $path, $tested_paths ) ) {
1889
-			$uploads['error'] = $tested_paths[ $path ];
1888
+		if (array_key_exists($path, $tested_paths)) {
1889
+			$uploads['error'] = $tested_paths[$path];
1890 1890
 		} else {
1891
-			if ( ! wp_mkdir_p( $path ) ) {
1892
-				if ( 0 === strpos( $uploads['basedir'], ABSPATH ) ) {
1893
-					$error_path = str_replace( ABSPATH, '', $uploads['basedir'] ) . $uploads['subdir'];
1891
+			if ( ! wp_mkdir_p($path)) {
1892
+				if (0 === strpos($uploads['basedir'], ABSPATH)) {
1893
+					$error_path = str_replace(ABSPATH, '', $uploads['basedir']).$uploads['subdir'];
1894 1894
 				} else {
1895
-					$error_path = basename( $uploads['basedir'] ) . $uploads['subdir'];
1895
+					$error_path = basename($uploads['basedir']).$uploads['subdir'];
1896 1896
 				}
1897 1897
 
1898
-				$uploads['error'] = sprintf( __( 'Unable to create directory %s. Is its parent directory writable by the server?' ), esc_html( $error_path ) );
1898
+				$uploads['error'] = sprintf(__('Unable to create directory %s. Is its parent directory writable by the server?'), esc_html($error_path));
1899 1899
 			}
1900 1900
 
1901
-			$tested_paths[ $path ] = $uploads['error'];
1901
+			$tested_paths[$path] = $uploads['error'];
1902 1902
 		}
1903 1903
 	}
1904 1904
 
@@ -1913,39 +1913,39 @@  discard block
 block discarded – undo
1913 1913
  * @param string $time Optional. Time formatted in 'yyyy/mm'. Default null.
1914 1914
  * @return array See wp_upload_dir()
1915 1915
  */
1916
-function _wp_upload_dir( $time = null ) {
1917
-	$siteurl = get_option( 'siteurl' );
1918
-	$upload_path = trim( get_option( 'upload_path' ) );
1916
+function _wp_upload_dir($time = null) {
1917
+	$siteurl = get_option('siteurl');
1918
+	$upload_path = trim(get_option('upload_path'));
1919 1919
 
1920
-	if ( empty( $upload_path ) || 'wp-content/uploads' == $upload_path ) {
1921
-		$dir = WP_CONTENT_DIR . '/uploads';
1922
-	} elseif ( 0 !== strpos( $upload_path, ABSPATH ) ) {
1920
+	if (empty($upload_path) || 'wp-content/uploads' == $upload_path) {
1921
+		$dir = WP_CONTENT_DIR.'/uploads';
1922
+	} elseif (0 !== strpos($upload_path, ABSPATH)) {
1923 1923
 		// $dir is absolute, $upload_path is (maybe) relative to ABSPATH
1924
-		$dir = path_join( ABSPATH, $upload_path );
1924
+		$dir = path_join(ABSPATH, $upload_path);
1925 1925
 	} else {
1926 1926
 		$dir = $upload_path;
1927 1927
 	}
1928 1928
 
1929
-	if ( !$url = get_option( 'upload_url_path' ) ) {
1930
-		if ( empty($upload_path) || ( 'wp-content/uploads' == $upload_path ) || ( $upload_path == $dir ) )
1931
-			$url = WP_CONTENT_URL . '/uploads';
1929
+	if ( ! $url = get_option('upload_url_path')) {
1930
+		if (empty($upload_path) || ('wp-content/uploads' == $upload_path) || ($upload_path == $dir))
1931
+			$url = WP_CONTENT_URL.'/uploads';
1932 1932
 		else
1933
-			$url = trailingslashit( $siteurl ) . $upload_path;
1933
+			$url = trailingslashit($siteurl).$upload_path;
1934 1934
 	}
1935 1935
 
1936 1936
 	/*
1937 1937
 	 * Honor the value of UPLOADS. This happens as long as ms-files rewriting is disabled.
1938 1938
 	 * We also sometimes obey UPLOADS when rewriting is enabled -- see the next block.
1939 1939
 	 */
1940
-	if ( defined( 'UPLOADS' ) && ! ( is_multisite() && get_site_option( 'ms_files_rewriting' ) ) ) {
1941
-		$dir = ABSPATH . UPLOADS;
1942
-		$url = trailingslashit( $siteurl ) . UPLOADS;
1940
+	if (defined('UPLOADS') && ! (is_multisite() && get_site_option('ms_files_rewriting'))) {
1941
+		$dir = ABSPATH.UPLOADS;
1942
+		$url = trailingslashit($siteurl).UPLOADS;
1943 1943
 	}
1944 1944
 
1945 1945
 	// If multisite (and if not the main site in a post-MU network)
1946
-	if ( is_multisite() && ! ( is_main_network() && is_main_site() && defined( 'MULTISITE' ) ) ) {
1946
+	if (is_multisite() && ! (is_main_network() && is_main_site() && defined('MULTISITE'))) {
1947 1947
 
1948
-		if ( ! get_site_option( 'ms_files_rewriting' ) ) {
1948
+		if ( ! get_site_option('ms_files_rewriting')) {
1949 1949
 			/*
1950 1950
 			 * If ms-files rewriting is disabled (networks created post-3.5), it is fairly
1951 1951
 			 * straightforward: Append sites/%d if we're not on the main site (for post-MU
@@ -1955,15 +1955,15 @@  discard block
 block discarded – undo
1955 1955
 			 * had wp-content/uploads for the main site.)
1956 1956
 			 */
1957 1957
 
1958
-			if ( defined( 'MULTISITE' ) )
1959
-				$ms_dir = '/sites/' . get_current_blog_id();
1958
+			if (defined('MULTISITE'))
1959
+				$ms_dir = '/sites/'.get_current_blog_id();
1960 1960
 			else
1961
-				$ms_dir = '/' . get_current_blog_id();
1961
+				$ms_dir = '/'.get_current_blog_id();
1962 1962
 
1963 1963
 			$dir .= $ms_dir;
1964 1964
 			$url .= $ms_dir;
1965 1965
 
1966
-		} elseif ( defined( 'UPLOADS' ) && ! ms_is_switched() ) {
1966
+		} elseif (defined('UPLOADS') && ! ms_is_switched()) {
1967 1967
 			/*
1968 1968
 			 * Handle the old-form ms-files.php rewriting if the network still has that enabled.
1969 1969
 			 * When ms-files rewriting is enabled, then we only listen to UPLOADS when:
@@ -1978,11 +1978,11 @@  discard block
 block discarded – undo
1978 1978
 			 * rewriting in multisite, the resulting URL is /files. (#WP22702 for background.)
1979 1979
 			 */
1980 1980
 
1981
-			if ( defined( 'BLOGUPLOADDIR' ) )
1982
-				$dir = untrailingslashit( BLOGUPLOADDIR );
1981
+			if (defined('BLOGUPLOADDIR'))
1982
+				$dir = untrailingslashit(BLOGUPLOADDIR);
1983 1983
 			else
1984
-				$dir = ABSPATH . UPLOADS;
1985
-			$url = trailingslashit( $siteurl ) . 'files';
1984
+				$dir = ABSPATH.UPLOADS;
1985
+			$url = trailingslashit($siteurl).'files';
1986 1986
 		}
1987 1987
 	}
1988 1988
 
@@ -1990,12 +1990,12 @@  discard block
 block discarded – undo
1990 1990
 	$baseurl = $url;
1991 1991
 
1992 1992
 	$subdir = '';
1993
-	if ( get_option( 'uploads_use_yearmonth_folders' ) ) {
1993
+	if (get_option('uploads_use_yearmonth_folders')) {
1994 1994
 		// Generate the yearly and monthly dirs
1995
-		if ( !$time )
1996
-			$time = current_time( 'mysql' );
1997
-		$y = substr( $time, 0, 4 );
1998
-		$m = substr( $time, 5, 2 );
1995
+		if ( ! $time)
1996
+			$time = current_time('mysql');
1997
+		$y = substr($time, 0, 4);
1998
+		$m = substr($time, 5, 2);
1999 1999
 		$subdir = "/$y/$m";
2000 2000
 	}
2001 2001
 
@@ -2029,38 +2029,38 @@  discard block
 block discarded – undo
2029 2029
  * @param callable $unique_filename_callback Callback. Default null.
2030 2030
  * @return string New filename, if given wasn't unique.
2031 2031
  */
2032
-function wp_unique_filename( $dir, $filename, $unique_filename_callback = null ) {
2032
+function wp_unique_filename($dir, $filename, $unique_filename_callback = null) {
2033 2033
 	// Sanitize the file name before we begin processing.
2034 2034
 	$filename = sanitize_file_name($filename);
2035 2035
 
2036 2036
 	// Separate the filename into a name and extension.
2037 2037
 	$info = pathinfo($filename);
2038
-	$ext = !empty($info['extension']) ? '.' . $info['extension'] : '';
2038
+	$ext = ! empty($info['extension']) ? '.'.$info['extension'] : '';
2039 2039
 	$name = basename($filename, $ext);
2040 2040
 
2041 2041
 	// Edge case: if file is named '.ext', treat as an empty name.
2042
-	if ( $name === $ext )
2042
+	if ($name === $ext)
2043 2043
 		$name = '';
2044 2044
 
2045 2045
 	/*
2046 2046
 	 * Increment the file number until we have a unique file to save in $dir.
2047 2047
 	 * Use callback if supplied.
2048 2048
 	 */
2049
-	if ( $unique_filename_callback && is_callable( $unique_filename_callback ) ) {
2050
-		$filename = call_user_func( $unique_filename_callback, $dir, $name, $ext );
2049
+	if ($unique_filename_callback && is_callable($unique_filename_callback)) {
2050
+		$filename = call_user_func($unique_filename_callback, $dir, $name, $ext);
2051 2051
 	} else {
2052 2052
 		$number = '';
2053 2053
 
2054 2054
 		// Change '.ext' to lower case.
2055
-		if ( $ext && strtolower($ext) != $ext ) {
2055
+		if ($ext && strtolower($ext) != $ext) {
2056 2056
 			$ext2 = strtolower($ext);
2057
-			$filename2 = preg_replace( '|' . preg_quote($ext) . '$|', $ext2, $filename );
2057
+			$filename2 = preg_replace('|'.preg_quote($ext).'$|', $ext2, $filename);
2058 2058
 
2059 2059
 			// Check for both lower and upper case extension or image sub-sizes may be overwritten.
2060
-			while ( file_exists($dir . "/$filename") || file_exists($dir . "/$filename2") ) {
2060
+			while (file_exists($dir."/$filename") || file_exists($dir."/$filename2")) {
2061 2061
 				$new_number = $number + 1;
2062
-				$filename = str_replace( array( "-$number$ext", "$number$ext" ), "-$new_number$ext", $filename );
2063
-				$filename2 = str_replace( array( "-$number$ext2", "$number$ext2" ), "-$new_number$ext2", $filename2 );
2062
+				$filename = str_replace(array("-$number$ext", "$number$ext"), "-$new_number$ext", $filename);
2063
+				$filename2 = str_replace(array("-$number$ext2", "$number$ext2"), "-$new_number$ext2", $filename2);
2064 2064
 				$number = $new_number;
2065 2065
 			}
2066 2066
 
@@ -2074,20 +2074,20 @@  discard block
 block discarded – undo
2074 2074
 			 * @param string        $dir                      Directory path.
2075 2075
 			 * @param callable|null $unique_filename_callback Callback function that generates the unique file name.
2076 2076
 			 */
2077
-			return apply_filters( 'wp_unique_filename', $filename2, $ext, $dir, $unique_filename_callback );
2077
+			return apply_filters('wp_unique_filename', $filename2, $ext, $dir, $unique_filename_callback);
2078 2078
 		}
2079 2079
 
2080
-		while ( file_exists( $dir . "/$filename" ) ) {
2081
-			if ( '' == "$number$ext" ) {
2082
-				$filename = "$filename-" . ++$number;
2080
+		while (file_exists($dir."/$filename")) {
2081
+			if ('' == "$number$ext") {
2082
+				$filename = "$filename-".++$number;
2083 2083
 			} else {
2084
-				$filename = str_replace( array( "-$number$ext", "$number$ext" ), "-" . ++$number . $ext, $filename );
2084
+				$filename = str_replace(array("-$number$ext", "$number$ext"), "-".++$number.$ext, $filename);
2085 2085
 			}
2086 2086
 		}
2087 2087
 	}
2088 2088
 
2089 2089
 	/** This filter is documented in wp-includes/functions.php */
2090
-	return apply_filters( 'wp_unique_filename', $filename, $ext, $dir, $unique_filename_callback );
2090
+	return apply_filters('wp_unique_filename', $filename, $ext, $dir, $unique_filename_callback);
2091 2091
 }
2092 2092
 
2093 2093
 /**
@@ -2113,20 +2113,20 @@  discard block
 block discarded – undo
2113 2113
  * @param string       $time       Optional. Time formatted in 'yyyy/mm'. Default null.
2114 2114
  * @return array
2115 2115
  */
2116
-function wp_upload_bits( $name, $deprecated, $bits, $time = null ) {
2117
-	if ( !empty( $deprecated ) )
2118
-		_deprecated_argument( __FUNCTION__, '2.0.0' );
2116
+function wp_upload_bits($name, $deprecated, $bits, $time = null) {
2117
+	if ( ! empty($deprecated))
2118
+		_deprecated_argument(__FUNCTION__, '2.0.0');
2119 2119
 
2120
-	if ( empty( $name ) )
2121
-		return array( 'error' => __( 'Empty filename' ) );
2120
+	if (empty($name))
2121
+		return array('error' => __('Empty filename'));
2122 2122
 
2123
-	$wp_filetype = wp_check_filetype( $name );
2124
-	if ( ! $wp_filetype['ext'] && ! current_user_can( 'unfiltered_upload' ) )
2125
-		return array( 'error' => __( 'Invalid file type' ) );
2123
+	$wp_filetype = wp_check_filetype($name);
2124
+	if ( ! $wp_filetype['ext'] && ! current_user_can('unfiltered_upload'))
2125
+		return array('error' => __('Invalid file type'));
2126 2126
 
2127
-	$upload = wp_upload_dir( $time );
2127
+	$upload = wp_upload_dir($time);
2128 2128
 
2129
-	if ( $upload['error'] !== false )
2129
+	if ($upload['error'] !== false)
2130 2130
 		return $upload;
2131 2131
 
2132 2132
 	/**
@@ -2139,45 +2139,45 @@  discard block
 block discarded – undo
2139 2139
 	 *
2140 2140
 	 * @param mixed $upload_bits_error An array of upload bits data, or a non-array error to return.
2141 2141
 	 */
2142
-	$upload_bits_error = apply_filters( 'wp_upload_bits', array( 'name' => $name, 'bits' => $bits, 'time' => $time ) );
2143
-	if ( !is_array( $upload_bits_error ) ) {
2144
-		$upload[ 'error' ] = $upload_bits_error;
2142
+	$upload_bits_error = apply_filters('wp_upload_bits', array('name' => $name, 'bits' => $bits, 'time' => $time));
2143
+	if ( ! is_array($upload_bits_error)) {
2144
+		$upload['error'] = $upload_bits_error;
2145 2145
 		return $upload;
2146 2146
 	}
2147 2147
 
2148
-	$filename = wp_unique_filename( $upload['path'], $name );
2148
+	$filename = wp_unique_filename($upload['path'], $name);
2149 2149
 
2150
-	$new_file = $upload['path'] . "/$filename";
2151
-	if ( ! wp_mkdir_p( dirname( $new_file ) ) ) {
2152
-		if ( 0 === strpos( $upload['basedir'], ABSPATH ) )
2153
-			$error_path = str_replace( ABSPATH, '', $upload['basedir'] ) . $upload['subdir'];
2150
+	$new_file = $upload['path']."/$filename";
2151
+	if ( ! wp_mkdir_p(dirname($new_file))) {
2152
+		if (0 === strpos($upload['basedir'], ABSPATH))
2153
+			$error_path = str_replace(ABSPATH, '', $upload['basedir']).$upload['subdir'];
2154 2154
 		else
2155
-			$error_path = basename( $upload['basedir'] ) . $upload['subdir'];
2155
+			$error_path = basename($upload['basedir']).$upload['subdir'];
2156 2156
 
2157
-		$message = sprintf( __( 'Unable to create directory %s. Is its parent directory writable by the server?' ), $error_path );
2158
-		return array( 'error' => $message );
2157
+		$message = sprintf(__('Unable to create directory %s. Is its parent directory writable by the server?'), $error_path);
2158
+		return array('error' => $message);
2159 2159
 	}
2160 2160
 
2161
-	$ifp = @ fopen( $new_file, 'wb' );
2162
-	if ( ! $ifp )
2163
-		return array( 'error' => sprintf( __( 'Could not write file %s' ), $new_file ) );
2161
+	$ifp = @ fopen($new_file, 'wb');
2162
+	if ( ! $ifp)
2163
+		return array('error' => sprintf(__('Could not write file %s'), $new_file));
2164 2164
 
2165
-	@fwrite( $ifp, $bits );
2166
-	fclose( $ifp );
2165
+	@fwrite($ifp, $bits);
2166
+	fclose($ifp);
2167 2167
 	clearstatcache();
2168 2168
 
2169 2169
 	// Set correct file permissions
2170
-	$stat = @ stat( dirname( $new_file ) );
2170
+	$stat = @ stat(dirname($new_file));
2171 2171
 	$perms = $stat['mode'] & 0007777;
2172 2172
 	$perms = $perms & 0000666;
2173
-	@ chmod( $new_file, $perms );
2173
+	@ chmod($new_file, $perms);
2174 2174
 	clearstatcache();
2175 2175
 
2176 2176
 	// Compute the URL
2177
-	$url = $upload['url'] . "/$filename";
2177
+	$url = $upload['url']."/$filename";
2178 2178
 
2179 2179
 	/** This filter is documented in wp-admin/includes/file.php */
2180
-	return apply_filters( 'wp_handle_upload', array( 'file' => $new_file, 'url' => $url, 'type' => $wp_filetype['type'], 'error' => false ), 'sideload' );
2180
+	return apply_filters('wp_handle_upload', array('file' => $new_file, 'url' => $url, 'type' => $wp_filetype['type'], 'error' => false), 'sideload');
2181 2181
 }
2182 2182
 
2183 2183
 /**
@@ -2188,12 +2188,12 @@  discard block
 block discarded – undo
2188 2188
  * @param string $ext The extension to search.
2189 2189
  * @return string|void The file type, example: audio, video, document, spreadsheet, etc.
2190 2190
  */
2191
-function wp_ext2type( $ext ) {
2192
-	$ext = strtolower( $ext );
2191
+function wp_ext2type($ext) {
2192
+	$ext = strtolower($ext);
2193 2193
 
2194 2194
 	$ext2type = wp_get_ext_types();
2195
-	foreach ( $ext2type as $type => $exts )
2196
-		if ( in_array( $ext, $exts ) )
2195
+	foreach ($ext2type as $type => $exts)
2196
+		if (in_array($ext, $exts))
2197 2197
 			return $type;
2198 2198
 }
2199 2199
 
@@ -2208,22 +2208,22 @@  discard block
 block discarded – undo
2208 2208
  * @param array  $mimes    Optional. Key is the file extension with value as the mime type.
2209 2209
  * @return array Values with extension first and mime type.
2210 2210
  */
2211
-function wp_check_filetype( $filename, $mimes = null ) {
2212
-	if ( empty($mimes) )
2211
+function wp_check_filetype($filename, $mimes = null) {
2212
+	if (empty($mimes))
2213 2213
 		$mimes = get_allowed_mime_types();
2214 2214
 	$type = false;
2215 2215
 	$ext = false;
2216 2216
 
2217
-	foreach ( $mimes as $ext_preg => $mime_match ) {
2218
-		$ext_preg = '!\.(' . $ext_preg . ')$!i';
2219
-		if ( preg_match( $ext_preg, $filename, $ext_matches ) ) {
2217
+	foreach ($mimes as $ext_preg => $mime_match) {
2218
+		$ext_preg = '!\.('.$ext_preg.')$!i';
2219
+		if (preg_match($ext_preg, $filename, $ext_matches)) {
2220 2220
 			$type = $mime_match;
2221 2221
 			$ext = $ext_matches[1];
2222 2222
 			break;
2223 2223
 		}
2224 2224
 	}
2225 2225
 
2226
-	return compact( 'ext', 'type' );
2226
+	return compact('ext', 'type');
2227 2227
 }
2228 2228
 
2229 2229
 /**
@@ -2245,27 +2245,27 @@  discard block
 block discarded – undo
2245 2245
  * @return array Values for the extension, MIME, and either a corrected filename or false
2246 2246
  *               if original $filename is valid.
2247 2247
  */
2248
-function wp_check_filetype_and_ext( $file, $filename, $mimes = null ) {
2248
+function wp_check_filetype_and_ext($file, $filename, $mimes = null) {
2249 2249
 	$proper_filename = false;
2250 2250
 
2251 2251
 	// Do basic extension validation and MIME mapping
2252
-	$wp_filetype = wp_check_filetype( $filename, $mimes );
2252
+	$wp_filetype = wp_check_filetype($filename, $mimes);
2253 2253
 	$ext = $wp_filetype['ext'];
2254 2254
 	$type = $wp_filetype['type'];
2255 2255
 
2256 2256
 	// We can't do any further validation without a file to work with
2257
-	if ( ! file_exists( $file ) ) {
2258
-		return compact( 'ext', 'type', 'proper_filename' );
2257
+	if ( ! file_exists($file)) {
2258
+		return compact('ext', 'type', 'proper_filename');
2259 2259
 	}
2260 2260
 
2261 2261
 	// We're able to validate images using GD
2262
-	if ( $type && 0 === strpos( $type, 'image/' ) && function_exists('getimagesize') ) {
2262
+	if ($type && 0 === strpos($type, 'image/') && function_exists('getimagesize')) {
2263 2263
 
2264 2264
 		// Attempt to figure out what type of image it actually is
2265
-		$imgstats = @getimagesize( $file );
2265
+		$imgstats = @getimagesize($file);
2266 2266
 
2267 2267
 		// If getimagesize() knows what kind of image it really is and if the real MIME doesn't match the claimed MIME
2268
-		if ( !empty($imgstats['mime']) && $imgstats['mime'] != $type ) {
2268
+		if ( ! empty($imgstats['mime']) && $imgstats['mime'] != $type) {
2269 2269
 			/**
2270 2270
 			 * Filters the list mapping image mime types to their respective extensions.
2271 2271
 			 *
@@ -2273,26 +2273,26 @@  discard block
 block discarded – undo
2273 2273
 			 *
2274 2274
 			 * @param  array $mime_to_ext Array of image mime types and their matching extensions.
2275 2275
 			 */
2276
-			$mime_to_ext = apply_filters( 'getimagesize_mimes_to_exts', array(
2276
+			$mime_to_ext = apply_filters('getimagesize_mimes_to_exts', array(
2277 2277
 				'image/jpeg' => 'jpg',
2278 2278
 				'image/png'  => 'png',
2279 2279
 				'image/gif'  => 'gif',
2280 2280
 				'image/bmp'  => 'bmp',
2281 2281
 				'image/tiff' => 'tif',
2282
-			) );
2282
+			));
2283 2283
 
2284 2284
 			// Replace whatever is after the last period in the filename with the correct extension
2285
-			if ( ! empty( $mime_to_ext[ $imgstats['mime'] ] ) ) {
2286
-				$filename_parts = explode( '.', $filename );
2287
-				array_pop( $filename_parts );
2288
-				$filename_parts[] = $mime_to_ext[ $imgstats['mime'] ];
2289
-				$new_filename = implode( '.', $filename_parts );
2285
+			if ( ! empty($mime_to_ext[$imgstats['mime']])) {
2286
+				$filename_parts = explode('.', $filename);
2287
+				array_pop($filename_parts);
2288
+				$filename_parts[] = $mime_to_ext[$imgstats['mime']];
2289
+				$new_filename = implode('.', $filename_parts);
2290 2290
 
2291
-				if ( $new_filename != $filename ) {
2291
+				if ($new_filename != $filename) {
2292 2292
 					$proper_filename = $new_filename; // Mark that it changed
2293 2293
 				}
2294 2294
 				// Redefine the extension / MIME
2295
-				$wp_filetype = wp_check_filetype( $new_filename, $mimes );
2295
+				$wp_filetype = wp_check_filetype($new_filename, $mimes);
2296 2296
 				$ext = $wp_filetype['ext'];
2297 2297
 				$type = $wp_filetype['type'];
2298 2298
 			}
@@ -2311,7 +2311,7 @@  discard block
 block discarded – undo
2311 2311
 	 *                                          $file being in a tmp directory).
2312 2312
 	 * @param array  $mimes                     Key is the file extension with value as the mime type.
2313 2313
 	 */
2314
-	return apply_filters( 'wp_check_filetype_and_ext', compact( 'ext', 'type', 'proper_filename' ), $file, $filename, $mimes );
2314
+	return apply_filters('wp_check_filetype_and_ext', compact('ext', 'type', 'proper_filename'), $file, $filename, $mimes);
2315 2315
 }
2316 2316
 
2317 2317
 /**
@@ -2334,7 +2334,7 @@  discard block
 block discarded – undo
2334 2334
 	 * @param array $wp_get_mime_types Mime types keyed by the file extension regex
2335 2335
 	 *                                 corresponding to those types.
2336 2336
 	 */
2337
-	return apply_filters( 'mime_types', array(
2337
+	return apply_filters('mime_types', array(
2338 2338
 	// Image formats.
2339 2339
 	'jpg|jpeg|jpe' => 'image/jpeg',
2340 2340
 	'gif' => 'image/gif',
@@ -2434,7 +2434,7 @@  discard block
 block discarded – undo
2434 2434
 	'key' => 'application/vnd.apple.keynote',
2435 2435
 	'numbers' => 'application/vnd.apple.numbers',
2436 2436
 	'pages' => 'application/vnd.apple.pages',
2437
-	) );
2437
+	));
2438 2438
 }
2439 2439
 
2440 2440
 /**
@@ -2456,17 +2456,17 @@  discard block
 block discarded – undo
2456 2456
 	 * @param array $ext2type Multi-dimensional array with extensions for a default set
2457 2457
 	 *                        of file types.
2458 2458
 	 */
2459
-	return apply_filters( 'ext2type', array(
2460
-		'image'       => array( 'jpg', 'jpeg', 'jpe',  'gif',  'png',  'bmp',   'tif',  'tiff', 'ico' ),
2461
-		'audio'       => array( 'aac', 'ac3',  'aif',  'aiff', 'm3a',  'm4a',   'm4b',  'mka',  'mp1',  'mp2',  'mp3', 'ogg', 'oga', 'ram', 'wav', 'wma' ),
2462
-		'video'       => array( '3g2',  '3gp', '3gpp', 'asf', 'avi',  'divx', 'dv',   'flv',  'm4v',   'mkv',  'mov',  'mp4',  'mpeg', 'mpg', 'mpv', 'ogm', 'ogv', 'qt',  'rm', 'vob', 'wmv' ),
2463
-		'document'    => array( 'doc', 'docx', 'docm', 'dotm', 'odt',  'pages', 'pdf',  'xps',  'oxps', 'rtf',  'wp', 'wpd', 'psd', 'xcf' ),
2464
-		'spreadsheet' => array( 'numbers',     'ods',  'xls',  'xlsx', 'xlsm',  'xlsb' ),
2465
-		'interactive' => array( 'swf', 'key',  'ppt',  'pptx', 'pptm', 'pps',   'ppsx', 'ppsm', 'sldx', 'sldm', 'odp' ),
2466
-		'text'        => array( 'asc', 'csv',  'tsv',  'txt' ),
2467
-		'archive'     => array( 'bz2', 'cab',  'dmg',  'gz',   'rar',  'sea',   'sit',  'sqx',  'tar',  'tgz',  'zip', '7z' ),
2468
-		'code'        => array( 'css', 'htm',  'html', 'php',  'js' ),
2469
-	) );
2459
+	return apply_filters('ext2type', array(
2460
+		'image'       => array('jpg', 'jpeg', 'jpe', 'gif', 'png', 'bmp', 'tif', 'tiff', 'ico'),
2461
+		'audio'       => array('aac', 'ac3', 'aif', 'aiff', 'm3a', 'm4a', 'm4b', 'mka', 'mp1', 'mp2', 'mp3', 'ogg', 'oga', 'ram', 'wav', 'wma'),
2462
+		'video'       => array('3g2', '3gp', '3gpp', 'asf', 'avi', 'divx', 'dv', 'flv', 'm4v', 'mkv', 'mov', 'mp4', 'mpeg', 'mpg', 'mpv', 'ogm', 'ogv', 'qt', 'rm', 'vob', 'wmv'),
2463
+		'document'    => array('doc', 'docx', 'docm', 'dotm', 'odt', 'pages', 'pdf', 'xps', 'oxps', 'rtf', 'wp', 'wpd', 'psd', 'xcf'),
2464
+		'spreadsheet' => array('numbers', 'ods', 'xls', 'xlsx', 'xlsm', 'xlsb'),
2465
+		'interactive' => array('swf', 'key', 'ppt', 'pptx', 'pptm', 'pps', 'ppsx', 'ppsm', 'sldx', 'sldm', 'odp'),
2466
+		'text'        => array('asc', 'csv', 'tsv', 'txt'),
2467
+		'archive'     => array('bz2', 'cab', 'dmg', 'gz', 'rar', 'sea', 'sit', 'sqx', 'tar', 'tgz', 'zip', '7z'),
2468
+		'code'        => array('css', 'htm', 'html', 'php', 'js'),
2469
+	));
2470 2470
 }
2471 2471
 
2472 2472
 /**
@@ -2478,15 +2478,15 @@  discard block
 block discarded – undo
2478 2478
  * @return array Array of mime types keyed by the file extension regex corresponding
2479 2479
  *               to those types.
2480 2480
  */
2481
-function get_allowed_mime_types( $user = null ) {
2481
+function get_allowed_mime_types($user = null) {
2482 2482
 	$t = wp_get_mime_types();
2483 2483
 
2484
-	unset( $t['swf'], $t['exe'] );
2485
-	if ( function_exists( 'current_user_can' ) )
2486
-		$unfiltered = $user ? user_can( $user, 'unfiltered_html' ) : current_user_can( 'unfiltered_html' );
2484
+	unset($t['swf'], $t['exe']);
2485
+	if (function_exists('current_user_can'))
2486
+		$unfiltered = $user ? user_can($user, 'unfiltered_html') : current_user_can('unfiltered_html');
2487 2487
 
2488
-	if ( empty( $unfiltered ) )
2489
-		unset( $t['htm|html'] );
2488
+	if (empty($unfiltered))
2489
+		unset($t['htm|html']);
2490 2490
 
2491 2491
 	/**
2492 2492
 	 * Filters list of allowed mime types and file extensions.
@@ -2498,7 +2498,7 @@  discard block
 block discarded – undo
2498 2498
 	 *                               removed depending on '$user' capabilities.
2499 2499
 	 * @param int|WP_User|null $user User ID, User object or null if not provided (indicates current user).
2500 2500
 	 */
2501
-	return apply_filters( 'upload_mimes', $t, $user );
2501
+	return apply_filters('upload_mimes', $t, $user);
2502 2502
 }
2503 2503
 
2504 2504
 /**
@@ -2511,18 +2511,18 @@  discard block
 block discarded – undo
2511 2511
  *
2512 2512
  * @param string $action The nonce action.
2513 2513
  */
2514
-function wp_nonce_ays( $action ) {
2515
-	if ( 'log-out' == $action ) {
2516
-		$html = sprintf( __( 'You are attempting to log out of %s' ), get_bloginfo( 'name' ) ) . '</p><p>';
2517
-		$redirect_to = isset( $_REQUEST['redirect_to'] ) ? $_REQUEST['redirect_to'] : '';
2518
-		$html .= sprintf( __( "Do you really want to <a href='%s'>log out</a>?"), wp_logout_url( $redirect_to ) );
2514
+function wp_nonce_ays($action) {
2515
+	if ('log-out' == $action) {
2516
+		$html = sprintf(__('You are attempting to log out of %s'), get_bloginfo('name')).'</p><p>';
2517
+		$redirect_to = isset($_REQUEST['redirect_to']) ? $_REQUEST['redirect_to'] : '';
2518
+		$html .= sprintf(__("Do you really want to <a href='%s'>log out</a>?"), wp_logout_url($redirect_to));
2519 2519
 	} else {
2520
-		$html = __( 'Are you sure you want to do this?' );
2521
-		if ( wp_get_referer() )
2522
-			$html .= "</p><p><a href='" . esc_url( remove_query_arg( 'updated', wp_get_referer() ) ) . "'>" . __( 'Please try again.' ) . "</a>";
2520
+		$html = __('Are you sure you want to do this?');
2521
+		if (wp_get_referer())
2522
+			$html .= "</p><p><a href='".esc_url(remove_query_arg('updated', wp_get_referer()))."'>".__('Please try again.')."</a>";
2523 2523
 	}
2524 2524
 
2525
-	wp_die( $html, __( 'WordPress Failure Notice' ), 403 );
2525
+	wp_die($html, __('WordPress Failure Notice'), 403);
2526 2526
 }
2527 2527
 
2528 2528
 /**
@@ -2558,16 +2558,16 @@  discard block
 block discarded – undo
2558 2558
  *                                  Default is the value of is_rtl().
2559 2559
  * }
2560 2560
  */
2561
-function wp_die( $message = '', $title = '', $args = array() ) {
2561
+function wp_die($message = '', $title = '', $args = array()) {
2562 2562
 
2563
-	if ( is_int( $args ) ) {
2564
-		$args = array( 'response' => $args );
2565
-	} elseif ( is_int( $title ) ) {
2566
-		$args  = array( 'response' => $title );
2563
+	if (is_int($args)) {
2564
+		$args = array('response' => $args);
2565
+	} elseif (is_int($title)) {
2566
+		$args  = array('response' => $title);
2567 2567
 		$title = '';
2568 2568
 	}
2569 2569
 
2570
-	if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
2570
+	if (defined('DOING_AJAX') && DOING_AJAX) {
2571 2571
 		/**
2572 2572
 		 * Filters the callback for killing WordPress execution for Ajax requests.
2573 2573
 		 *
@@ -2575,8 +2575,8 @@  discard block
 block discarded – undo
2575 2575
 		 *
2576 2576
 		 * @param callable $function Callback function name.
2577 2577
 		 */
2578
-		$function = apply_filters( 'wp_die_ajax_handler', '_ajax_wp_die_handler' );
2579
-	} elseif ( defined( 'XMLRPC_REQUEST' ) && XMLRPC_REQUEST ) {
2578
+		$function = apply_filters('wp_die_ajax_handler', '_ajax_wp_die_handler');
2579
+	} elseif (defined('XMLRPC_REQUEST') && XMLRPC_REQUEST) {
2580 2580
 		/**
2581 2581
 		 * Filters the callback for killing WordPress execution for XML-RPC requests.
2582 2582
 		 *
@@ -2584,7 +2584,7 @@  discard block
 block discarded – undo
2584 2584
 		 *
2585 2585
 		 * @param callable $function Callback function name.
2586 2586
 		 */
2587
-		$function = apply_filters( 'wp_die_xmlrpc_handler', '_xmlrpc_wp_die_handler' );
2587
+		$function = apply_filters('wp_die_xmlrpc_handler', '_xmlrpc_wp_die_handler');
2588 2588
 	} else {
2589 2589
 		/**
2590 2590
 		 * Filters the callback for killing WordPress execution for all non-Ajax, non-XML-RPC requests.
@@ -2593,10 +2593,10 @@  discard block
 block discarded – undo
2593 2593
 		 *
2594 2594
 		 * @param callable $function Callback function name.
2595 2595
 		 */
2596
-		$function = apply_filters( 'wp_die_handler', '_default_wp_die_handler' );
2596
+		$function = apply_filters('wp_die_handler', '_default_wp_die_handler');
2597 2597
 	}
2598 2598
 
2599
-	call_user_func( $function, $message, $title, $args );
2599
+	call_user_func($function, $message, $title, $args);
2600 2600
 }
2601 2601
 
2602 2602
 /**
@@ -2612,20 +2612,20 @@  discard block
 block discarded – undo
2612 2612
  * @param string       $title   Optional. Error title. Default empty.
2613 2613
  * @param string|array $args    Optional. Arguments to control behavior. Default empty array.
2614 2614
  */
2615
-function _default_wp_die_handler( $message, $title = '', $args = array() ) {
2616
-	$defaults = array( 'response' => 500 );
2615
+function _default_wp_die_handler($message, $title = '', $args = array()) {
2616
+	$defaults = array('response' => 500);
2617 2617
 	$r = wp_parse_args($args, $defaults);
2618 2618
 
2619 2619
 	$have_gettext = function_exists('__');
2620 2620
 
2621
-	if ( function_exists( 'is_wp_error' ) && is_wp_error( $message ) ) {
2622
-		if ( empty( $title ) ) {
2621
+	if (function_exists('is_wp_error') && is_wp_error($message)) {
2622
+		if (empty($title)) {
2623 2623
 			$error_data = $message->get_error_data();
2624
-			if ( is_array( $error_data ) && isset( $error_data['title'] ) )
2624
+			if (is_array($error_data) && isset($error_data['title']))
2625 2625
 				$title = $error_data['title'];
2626 2626
 		}
2627 2627
 		$errors = $message->get_error_messages();
2628
-		switch ( count( $errors ) ) {
2628
+		switch (count($errors)) {
2629 2629
 		case 0 :
2630 2630
 			$message = '';
2631 2631
 			break;
@@ -2633,43 +2633,43 @@  discard block
 block discarded – undo
2633 2633
 			$message = "<p>{$errors[0]}</p>";
2634 2634
 			break;
2635 2635
 		default :
2636
-			$message = "<ul>\n\t\t<li>" . join( "</li>\n\t\t<li>", $errors ) . "</li>\n\t</ul>";
2636
+			$message = "<ul>\n\t\t<li>".join("</li>\n\t\t<li>", $errors)."</li>\n\t</ul>";
2637 2637
 			break;
2638 2638
 		}
2639
-	} elseif ( is_string( $message ) ) {
2639
+	} elseif (is_string($message)) {
2640 2640
 		$message = "<p>$message</p>";
2641 2641
 	}
2642 2642
 
2643
-	if ( isset( $r['back_link'] ) && $r['back_link'] ) {
2644
-		$back_text = $have_gettext? __('&laquo; Back') : '&laquo; Back';
2643
+	if (isset($r['back_link']) && $r['back_link']) {
2644
+		$back_text = $have_gettext ? __('&laquo; Back') : '&laquo; Back';
2645 2645
 		$message .= "\n<p><a href='javascript:history.back()'>$back_text</a></p>";
2646 2646
 	}
2647 2647
 
2648
-	if ( ! did_action( 'admin_head' ) ) :
2649
-		if ( !headers_sent() ) {
2650
-			status_header( $r['response'] );
2648
+	if ( ! did_action('admin_head')) :
2649
+		if ( ! headers_sent()) {
2650
+			status_header($r['response']);
2651 2651
 			nocache_headers();
2652
-			header( 'Content-Type: text/html; charset=utf-8' );
2652
+			header('Content-Type: text/html; charset=utf-8');
2653 2653
 		}
2654 2654
 
2655
-		if ( empty($title) )
2655
+		if (empty($title))
2656 2656
 			$title = $have_gettext ? __('WordPress &rsaquo; Error') : 'WordPress &rsaquo; Error';
2657 2657
 
2658 2658
 		$text_direction = 'ltr';
2659
-		if ( isset($r['text_direction']) && 'rtl' == $r['text_direction'] )
2659
+		if (isset($r['text_direction']) && 'rtl' == $r['text_direction'])
2660 2660
 			$text_direction = 'rtl';
2661
-		elseif ( function_exists( 'is_rtl' ) && is_rtl() )
2661
+		elseif (function_exists('is_rtl') && is_rtl())
2662 2662
 			$text_direction = 'rtl';
2663 2663
 ?>
2664 2664
 <!DOCTYPE html>
2665 2665
 <!-- Ticket #11289, IE bug fix: always pad the error page with enough characters such that it is greater than 512 bytes, even after gzip compression abcdefghijklmnopqrstuvwxyz1234567890aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz11223344556677889900abacbcbdcdcededfefegfgfhghgihihjijikjkjlklkmlmlnmnmononpopoqpqprqrqsrsrtstsubcbcdcdedefefgfabcadefbghicjkldmnoepqrfstugvwxhyz1i234j567k890laabmbccnddeoeffpgghqhiirjjksklltmmnunoovppqwqrrxsstytuuzvvw0wxx1yyz2z113223434455666777889890091abc2def3ghi4jkl5mno6pqr7stu8vwx9yz11aab2bcc3dd4ee5ff6gg7hh8ii9j0jk1kl2lmm3nnoo4p5pq6qrr7ss8tt9uuvv0wwx1x2yyzz13aba4cbcb5dcdc6dedfef8egf9gfh0ghg1ihi2hji3jik4jkj5lkl6kml7mln8mnm9ono
2666 2666
 -->
2667
-<html xmlns="http://www.w3.org/1999/xhtml" <?php if ( function_exists( 'language_attributes' ) && function_exists( 'is_rtl' ) ) language_attributes(); else echo "dir='$text_direction'"; ?>>
2667
+<html xmlns="http://www.w3.org/1999/xhtml" <?php if (function_exists('language_attributes') && function_exists('is_rtl')) language_attributes(); else echo "dir='$text_direction'"; ?>>
2668 2668
 <head>
2669 2669
 	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
2670 2670
 	<meta name="viewport" content="width=device-width">
2671 2671
 	<?php
2672
-	if ( function_exists( 'wp_no_robots' ) ) {
2672
+	if (function_exists('wp_no_robots')) {
2673 2673
 		wp_no_robots();
2674 2674
 	}
2675 2675
 	?>
@@ -2785,7 +2785,7 @@  discard block
 block discarded – undo
2785 2785
 		}
2786 2786
 
2787 2787
 		<?php
2788
-		if ( 'rtl' == $text_direction ) {
2788
+		if ('rtl' == $text_direction) {
2789 2789
 			echo 'body { font-family: Tahoma, Arial; }';
2790 2790
 		}
2791 2791
 		?>
@@ -2814,15 +2814,15 @@  discard block
 block discarded – undo
2814 2814
  * @param string       $title   Optional. Error title. Default empty.
2815 2815
  * @param string|array $args    Optional. Arguments to control behavior. Default empty array.
2816 2816
  */
2817
-function _xmlrpc_wp_die_handler( $message, $title = '', $args = array() ) {
2817
+function _xmlrpc_wp_die_handler($message, $title = '', $args = array()) {
2818 2818
 	global $wp_xmlrpc_server;
2819
-	$defaults = array( 'response' => 500 );
2819
+	$defaults = array('response' => 500);
2820 2820
 
2821 2821
 	$r = wp_parse_args($args, $defaults);
2822 2822
 
2823
-	if ( $wp_xmlrpc_server ) {
2824
-		$error = new IXR_Error( $r['response'] , $message);
2825
-		$wp_xmlrpc_server->output( $error->getXml() );
2823
+	if ($wp_xmlrpc_server) {
2824
+		$error = new IXR_Error($r['response'], $message);
2825
+		$wp_xmlrpc_server->output($error->getXml());
2826 2826
 	}
2827 2827
 	die();
2828 2828
 }
@@ -2837,10 +2837,10 @@  discard block
 block discarded – undo
2837 2837
  *
2838 2838
  * @param string $message Optional. Response to print. Default empty.
2839 2839
  */
2840
-function _ajax_wp_die_handler( $message = '' ) {
2841
-	if ( is_scalar( $message ) )
2842
-		die( (string) $message );
2843
-	die( '0' );
2840
+function _ajax_wp_die_handler($message = '') {
2841
+	if (is_scalar($message))
2842
+		die((string) $message);
2843
+	die('0');
2844 2844
 }
2845 2845
 
2846 2846
 /**
@@ -2853,9 +2853,9 @@  discard block
 block discarded – undo
2853 2853
  *
2854 2854
  * @param string $message Optional. Response to print. Default empty.
2855 2855
  */
2856
-function _scalar_wp_die_handler( $message = '' ) {
2857
-	if ( is_scalar( $message ) )
2858
-		die( (string) $message );
2856
+function _scalar_wp_die_handler($message = '') {
2857
+	if (is_scalar($message))
2858
+		die((string) $message);
2859 2859
 	die();
2860 2860
 }
2861 2861
 
@@ -2870,39 +2870,39 @@  discard block
 block discarded – undo
2870 2870
  *                       greater than 0. Default 512.
2871 2871
  * @return string|false The JSON encoded string, or false if it cannot be encoded.
2872 2872
  */
2873
-function wp_json_encode( $data, $options = 0, $depth = 512 ) {
2873
+function wp_json_encode($data, $options = 0, $depth = 512) {
2874 2874
 	/*
2875 2875
 	 * json_encode() has had extra params added over the years.
2876 2876
 	 * $options was added in 5.3, and $depth in 5.5.
2877 2877
 	 * We need to make sure we call it with the correct arguments.
2878 2878
 	 */
2879
-	if ( version_compare( PHP_VERSION, '5.5', '>=' ) ) {
2880
-		$args = array( $data, $options, $depth );
2881
-	} elseif ( version_compare( PHP_VERSION, '5.3', '>=' ) ) {
2882
-		$args = array( $data, $options );
2879
+	if (version_compare(PHP_VERSION, '5.5', '>=')) {
2880
+		$args = array($data, $options, $depth);
2881
+	} elseif (version_compare(PHP_VERSION, '5.3', '>=')) {
2882
+		$args = array($data, $options);
2883 2883
 	} else {
2884
-		$args = array( $data );
2884
+		$args = array($data);
2885 2885
 	}
2886 2886
 
2887 2887
 	// Prepare the data for JSON serialization.
2888
-	$args[0] = _wp_json_prepare_data( $data );
2888
+	$args[0] = _wp_json_prepare_data($data);
2889 2889
 
2890
-	$json = @call_user_func_array( 'json_encode', $args );
2890
+	$json = @call_user_func_array('json_encode', $args);
2891 2891
 
2892 2892
 	// If json_encode() was successful, no need to do more sanity checking.
2893 2893
 	// ... unless we're in an old version of PHP, and json_encode() returned
2894 2894
 	// a string containing 'null'. Then we need to do more sanity checking.
2895
-	if ( false !== $json && ( version_compare( PHP_VERSION, '5.5', '>=' ) || false === strpos( $json, 'null' ) ) )  {
2895
+	if (false !== $json && (version_compare(PHP_VERSION, '5.5', '>=') || false === strpos($json, 'null'))) {
2896 2896
 		return $json;
2897 2897
 	}
2898 2898
 
2899 2899
 	try {
2900
-		$args[0] = _wp_json_sanity_check( $data, $depth );
2901
-	} catch ( Exception $e ) {
2900
+		$args[0] = _wp_json_sanity_check($data, $depth);
2901
+	} catch (Exception $e) {
2902 2902
 		return false;
2903 2903
 	}
2904 2904
 
2905
-	return call_user_func_array( 'json_encode', $args );
2905
+	return call_user_func_array('json_encode', $args);
2906 2906
 }
2907 2907
 
2908 2908
 /**
@@ -2918,49 +2918,49 @@  discard block
 block discarded – undo
2918 2918
  * @param int   $depth Maximum depth to walk through $data. Must be greater than 0.
2919 2919
  * @return mixed The sanitized data that shall be encoded to JSON.
2920 2920
  */
2921
-function _wp_json_sanity_check( $data, $depth ) {
2922
-	if ( $depth < 0 ) {
2923
-		throw new Exception( 'Reached depth limit' );
2921
+function _wp_json_sanity_check($data, $depth) {
2922
+	if ($depth < 0) {
2923
+		throw new Exception('Reached depth limit');
2924 2924
 	}
2925 2925
 
2926
-	if ( is_array( $data ) ) {
2926
+	if (is_array($data)) {
2927 2927
 		$output = array();
2928
-		foreach ( $data as $id => $el ) {
2928
+		foreach ($data as $id => $el) {
2929 2929
 			// Don't forget to sanitize the ID!
2930
-			if ( is_string( $id ) ) {
2931
-				$clean_id = _wp_json_convert_string( $id );
2930
+			if (is_string($id)) {
2931
+				$clean_id = _wp_json_convert_string($id);
2932 2932
 			} else {
2933 2933
 				$clean_id = $id;
2934 2934
 			}
2935 2935
 
2936 2936
 			// Check the element type, so that we're only recursing if we really have to.
2937
-			if ( is_array( $el ) || is_object( $el ) ) {
2938
-				$output[ $clean_id ] = _wp_json_sanity_check( $el, $depth - 1 );
2939
-			} elseif ( is_string( $el ) ) {
2940
-				$output[ $clean_id ] = _wp_json_convert_string( $el );
2937
+			if (is_array($el) || is_object($el)) {
2938
+				$output[$clean_id] = _wp_json_sanity_check($el, $depth - 1);
2939
+			} elseif (is_string($el)) {
2940
+				$output[$clean_id] = _wp_json_convert_string($el);
2941 2941
 			} else {
2942
-				$output[ $clean_id ] = $el;
2942
+				$output[$clean_id] = $el;
2943 2943
 			}
2944 2944
 		}
2945
-	} elseif ( is_object( $data ) ) {
2945
+	} elseif (is_object($data)) {
2946 2946
 		$output = new stdClass;
2947
-		foreach ( $data as $id => $el ) {
2948
-			if ( is_string( $id ) ) {
2949
-				$clean_id = _wp_json_convert_string( $id );
2947
+		foreach ($data as $id => $el) {
2948
+			if (is_string($id)) {
2949
+				$clean_id = _wp_json_convert_string($id);
2950 2950
 			} else {
2951 2951
 				$clean_id = $id;
2952 2952
 			}
2953 2953
 
2954
-			if ( is_array( $el ) || is_object( $el ) ) {
2955
-				$output->$clean_id = _wp_json_sanity_check( $el, $depth - 1 );
2956
-			} elseif ( is_string( $el ) ) {
2957
-				$output->$clean_id = _wp_json_convert_string( $el );
2954
+			if (is_array($el) || is_object($el)) {
2955
+				$output->$clean_id = _wp_json_sanity_check($el, $depth - 1);
2956
+			} elseif (is_string($el)) {
2957
+				$output->$clean_id = _wp_json_convert_string($el);
2958 2958
 			} else {
2959 2959
 				$output->$clean_id = $el;
2960 2960
 			}
2961 2961
 		}
2962
-	} elseif ( is_string( $data ) ) {
2963
-		return _wp_json_convert_string( $data );
2962
+	} elseif (is_string($data)) {
2963
+		return _wp_json_convert_string($data);
2964 2964
 	} else {
2965 2965
 		return $data;
2966 2966
 	}
@@ -2982,21 +2982,21 @@  discard block
 block discarded – undo
2982 2982
  * @param string $string The string which is to be converted.
2983 2983
  * @return string The checked string.
2984 2984
  */
2985
-function _wp_json_convert_string( $string ) {
2985
+function _wp_json_convert_string($string) {
2986 2986
 	static $use_mb = null;
2987
-	if ( is_null( $use_mb ) ) {
2988
-		$use_mb = function_exists( 'mb_convert_encoding' );
2987
+	if (is_null($use_mb)) {
2988
+		$use_mb = function_exists('mb_convert_encoding');
2989 2989
 	}
2990 2990
 
2991
-	if ( $use_mb ) {
2992
-		$encoding = mb_detect_encoding( $string, mb_detect_order(), true );
2993
-		if ( $encoding ) {
2994
-			return mb_convert_encoding( $string, 'UTF-8', $encoding );
2991
+	if ($use_mb) {
2992
+		$encoding = mb_detect_encoding($string, mb_detect_order(), true);
2993
+		if ($encoding) {
2994
+			return mb_convert_encoding($string, 'UTF-8', $encoding);
2995 2995
 		} else {
2996
-			return mb_convert_encoding( $string, 'UTF-8', 'UTF-8' );
2996
+			return mb_convert_encoding($string, 'UTF-8', 'UTF-8');
2997 2997
 		}
2998 2998
 	} else {
2999
-		return wp_check_invalid_utf8( $string, true );
2999
+		return wp_check_invalid_utf8($string, true);
3000 3000
 	}
3001 3001
 }
3002 3002
 
@@ -3012,12 +3012,12 @@  discard block
 block discarded – undo
3012 3012
  * @param mixed $data Native representation.
3013 3013
  * @return bool|int|float|null|string|array Data ready for `json_encode()`.
3014 3014
  */
3015
-function _wp_json_prepare_data( $data ) {
3016
-	if ( ! defined( 'WP_JSON_SERIALIZE_COMPATIBLE' ) || WP_JSON_SERIALIZE_COMPATIBLE === false ) {
3015
+function _wp_json_prepare_data($data) {
3016
+	if ( ! defined('WP_JSON_SERIALIZE_COMPATIBLE') || WP_JSON_SERIALIZE_COMPATIBLE === false) {
3017 3017
 		return $data;
3018 3018
 	}
3019 3019
 
3020
-	switch ( gettype( $data ) ) {
3020
+	switch (gettype($data)) {
3021 3021
 		case 'boolean':
3022 3022
 		case 'integer':
3023 3023
 		case 'double':
@@ -3028,22 +3028,22 @@  discard block
 block discarded – undo
3028 3028
 
3029 3029
 		case 'array':
3030 3030
 			// Arrays must be mapped in case they also return objects.
3031
-			return array_map( '_wp_json_prepare_data', $data );
3031
+			return array_map('_wp_json_prepare_data', $data);
3032 3032
 
3033 3033
 		case 'object':
3034 3034
 			// If this is an incomplete object (__PHP_Incomplete_Class), bail.
3035
-			if ( ! is_object( $data ) ) {
3035
+			if ( ! is_object($data)) {
3036 3036
 				return null;
3037 3037
 			}
3038 3038
 
3039
-			if ( $data instanceof JsonSerializable ) {
3039
+			if ($data instanceof JsonSerializable) {
3040 3040
 				$data = $data->jsonSerialize();
3041 3041
 			} else {
3042
-				$data = get_object_vars( $data );
3042
+				$data = get_object_vars($data);
3043 3043
 			}
3044 3044
 
3045 3045
 			// Now, pass the array (or whatever was returned from jsonSerialize through).
3046
-			return _wp_json_prepare_data( $data );
3046
+			return _wp_json_prepare_data($data);
3047 3047
 
3048 3048
 		default:
3049 3049
 			return null;
@@ -3058,10 +3058,10 @@  discard block
 block discarded – undo
3058 3058
  * @param mixed $response Variable (usually an array or object) to encode as JSON,
3059 3059
  *                        then print and die.
3060 3060
  */
3061
-function wp_send_json( $response ) {
3062
-	@header( 'Content-Type: application/json; charset=' . get_option( 'blog_charset' ) );
3063
-	echo wp_json_encode( $response );
3064
-	if ( defined( 'DOING_AJAX' ) && DOING_AJAX )
3061
+function wp_send_json($response) {
3062
+	@header('Content-Type: application/json; charset='.get_option('blog_charset'));
3063
+	echo wp_json_encode($response);
3064
+	if (defined('DOING_AJAX') && DOING_AJAX)
3065 3065
 		wp_die();
3066 3066
 	else
3067 3067
 		die;
@@ -3074,13 +3074,13 @@  discard block
 block discarded – undo
3074 3074
  *
3075 3075
  * @param mixed $data Data to encode as JSON, then print and die.
3076 3076
  */
3077
-function wp_send_json_success( $data = null ) {
3078
-	$response = array( 'success' => true );
3077
+function wp_send_json_success($data = null) {
3078
+	$response = array('success' => true);
3079 3079
 
3080
-	if ( isset( $data ) )
3080
+	if (isset($data))
3081 3081
 		$response['data'] = $data;
3082 3082
 
3083
-	wp_send_json( $response );
3083
+	wp_send_json($response);
3084 3084
 }
3085 3085
 
3086 3086
 /**
@@ -3096,15 +3096,15 @@  discard block
 block discarded – undo
3096 3096
  *
3097 3097
  * @param mixed $data Data to encode as JSON, then print and die.
3098 3098
  */
3099
-function wp_send_json_error( $data = null ) {
3100
-	$response = array( 'success' => false );
3099
+function wp_send_json_error($data = null) {
3100
+	$response = array('success' => false);
3101 3101
 
3102
-	if ( isset( $data ) ) {
3103
-		if ( is_wp_error( $data ) ) {
3102
+	if (isset($data)) {
3103
+		if (is_wp_error($data)) {
3104 3104
 			$result = array();
3105
-			foreach ( $data->errors as $code => $messages ) {
3106
-				foreach ( $messages as $message ) {
3107
-					$result[] = array( 'code' => $code, 'message' => $message );
3105
+			foreach ($data->errors as $code => $messages) {
3106
+				foreach ($messages as $message) {
3107
+					$result[] = array('code' => $code, 'message' => $message);
3108 3108
 				}
3109 3109
 			}
3110 3110
 
@@ -3114,7 +3114,7 @@  discard block
 block discarded – undo
3114 3114
 		}
3115 3115
 	}
3116 3116
 
3117
-	wp_send_json( $response );
3117
+	wp_send_json($response);
3118 3118
 }
3119 3119
 
3120 3120
 /**
@@ -3129,12 +3129,12 @@  discard block
 block discarded – undo
3129 3129
  * @param string $callback Supplied JSONP callback function.
3130 3130
  * @return bool True if valid callback, otherwise false.
3131 3131
  */
3132
-function wp_check_jsonp_callback( $callback ) {
3133
-	if ( ! is_string( $callback ) ) {
3132
+function wp_check_jsonp_callback($callback) {
3133
+	if ( ! is_string($callback)) {
3134 3134
 		return false;
3135 3135
 	}
3136 3136
 
3137
-	$jsonp_callback = preg_replace( '/[^\w\.]/', '', $callback, -1, $illegal_char_count );
3137
+	$jsonp_callback = preg_replace('/[^\w\.]/', '', $callback, -1, $illegal_char_count);
3138 3138
 
3139 3139
 	return 0 === $illegal_char_count;
3140 3140
 }
@@ -3154,9 +3154,9 @@  discard block
 block discarded – undo
3154 3154
  * @param string $url URL for the home location.
3155 3155
  * @return string Homepage location.
3156 3156
  */
3157
-function _config_wp_home( $url = '' ) {
3158
-	if ( defined( 'WP_HOME' ) )
3159
-		return untrailingslashit( WP_HOME );
3157
+function _config_wp_home($url = '') {
3158
+	if (defined('WP_HOME'))
3159
+		return untrailingslashit(WP_HOME);
3160 3160
 	return $url;
3161 3161
 }
3162 3162
 
@@ -3175,9 +3175,9 @@  discard block
 block discarded – undo
3175 3175
  * @param string $url URL to set the WordPress site location.
3176 3176
  * @return string The WordPress Site URL.
3177 3177
  */
3178
-function _config_wp_siteurl( $url = '' ) {
3179
-	if ( defined( 'WP_SITEURL' ) )
3180
-		return untrailingslashit( WP_SITEURL );
3178
+function _config_wp_siteurl($url = '') {
3179
+	if (defined('WP_SITEURL'))
3180
+		return untrailingslashit(WP_SITEURL);
3181 3181
 	return $url;
3182 3182
 }
3183 3183
 
@@ -3198,15 +3198,15 @@  discard block
 block discarded – undo
3198 3198
  * @param array $input MCE settings array.
3199 3199
  * @return array Direction set for 'rtl', if needed by locale.
3200 3200
  */
3201
-function _mce_set_direction( $input ) {
3202
-	if ( is_rtl() ) {
3201
+function _mce_set_direction($input) {
3202
+	if (is_rtl()) {
3203 3203
 		$input['directionality'] = 'rtl';
3204 3204
 
3205
-		if ( ! empty( $input['plugins'] ) && strpos( $input['plugins'], 'directionality' ) === false ) {
3205
+		if ( ! empty($input['plugins']) && strpos($input['plugins'], 'directionality') === false) {
3206 3206
 			$input['plugins'] .= ',directionality';
3207 3207
 		}
3208 3208
 
3209
-		if ( ! empty( $input['toolbar1'] ) && ! preg_match( '/\bltr\b/', $input['toolbar1'] ) ) {
3209
+		if ( ! empty($input['toolbar1']) && ! preg_match('/\bltr\b/', $input['toolbar1'])) {
3210 3210
 			$input['toolbar1'] .= ',ltr';
3211 3211
 		}
3212 3212
 	}
@@ -3241,10 +3241,10 @@  discard block
 block discarded – undo
3241 3241
 	global $wpsmiliestrans, $wp_smiliessearch;
3242 3242
 
3243 3243
 	// don't bother setting up smilies if they are disabled
3244
-	if ( !get_option( 'use_smilies' ) )
3244
+	if ( ! get_option('use_smilies'))
3245 3245
 		return;
3246 3246
 
3247
-	if ( !isset( $wpsmiliestrans ) ) {
3247
+	if ( ! isset($wpsmiliestrans)) {
3248 3248
 		$wpsmiliestrans = array(
3249 3249
 		':mrgreen:' => 'mrgreen.png',
3250 3250
 		':neutral:' => "\xf0\x9f\x98\x90",
@@ -3308,28 +3308,28 @@  discard block
 block discarded – undo
3308 3308
 	$spaces = wp_spaces_regexp();
3309 3309
 
3310 3310
 	// Begin first "subpattern"
3311
-	$wp_smiliessearch = '/(?<=' . $spaces . '|^)';
3311
+	$wp_smiliessearch = '/(?<='.$spaces.'|^)';
3312 3312
 
3313 3313
 	$subchar = '';
3314
-	foreach ( (array) $wpsmiliestrans as $smiley => $img ) {
3314
+	foreach ((array) $wpsmiliestrans as $smiley => $img) {
3315 3315
 		$firstchar = substr($smiley, 0, 1);
3316 3316
 		$rest = substr($smiley, 1);
3317 3317
 
3318 3318
 		// new subpattern?
3319 3319
 		if ($firstchar != $subchar) {
3320 3320
 			if ($subchar != '') {
3321
-				$wp_smiliessearch .= ')(?=' . $spaces . '|$)';  // End previous "subpattern"
3322
-				$wp_smiliessearch .= '|(?<=' . $spaces . '|^)'; // Begin another "subpattern"
3321
+				$wp_smiliessearch .= ')(?='.$spaces.'|$)'; // End previous "subpattern"
3322
+				$wp_smiliessearch .= '|(?<='.$spaces.'|^)'; // Begin another "subpattern"
3323 3323
 			}
3324 3324
 			$subchar = $firstchar;
3325
-			$wp_smiliessearch .= preg_quote($firstchar, '/') . '(?:';
3325
+			$wp_smiliessearch .= preg_quote($firstchar, '/').'(?:';
3326 3326
 		} else {
3327 3327
 			$wp_smiliessearch .= '|';
3328 3328
 		}
3329 3329
 		$wp_smiliessearch .= preg_quote($rest, '/');
3330 3330
 	}
3331 3331
 
3332
-	$wp_smiliessearch .= ')(?=' . $spaces . '|$)/m';
3332
+	$wp_smiliessearch .= ')(?='.$spaces.'|$)/m';
3333 3333
 
3334 3334
 }
3335 3335
 
@@ -3345,16 +3345,16 @@  discard block
 block discarded – undo
3345 3345
  * @param array        $defaults Optional. Array that serves as the defaults. Default empty.
3346 3346
  * @return array Merged user defined values with defaults.
3347 3347
  */
3348
-function wp_parse_args( $args, $defaults = '' ) {
3349
-	if ( is_object( $args ) )
3350
-		$r = get_object_vars( $args );
3351
-	elseif ( is_array( $args ) )
3352
-		$r =& $args;
3348
+function wp_parse_args($args, $defaults = '') {
3349
+	if (is_object($args))
3350
+		$r = get_object_vars($args);
3351
+	elseif (is_array($args))
3352
+		$r = & $args;
3353 3353
 	else
3354
-		wp_parse_str( $args, $r );
3354
+		wp_parse_str($args, $r);
3355 3355
 
3356
-	if ( is_array( $defaults ) )
3357
-		return array_merge( $defaults, $r );
3356
+	if (is_array($defaults))
3357
+		return array_merge($defaults, $r);
3358 3358
 	return $r;
3359 3359
 }
3360 3360
 
@@ -3366,8 +3366,8 @@  discard block
 block discarded – undo
3366 3366
  * @param array|string $list List of ids.
3367 3367
  * @return array Sanitized array of IDs.
3368 3368
  */
3369
-function wp_parse_id_list( $list ) {
3370
-	if ( !is_array($list) )
3369
+function wp_parse_id_list($list) {
3370
+	if ( ! is_array($list))
3371 3371
 		$list = preg_split('/[\s,]+/', $list);
3372 3372
 
3373 3373
 	return array_unique(array_map('absint', $list));
@@ -3382,11 +3382,11 @@  discard block
 block discarded – undo
3382 3382
  * @param array $keys  The list of keys.
3383 3383
  * @return array The array slice.
3384 3384
  */
3385
-function wp_array_slice_assoc( $array, $keys ) {
3385
+function wp_array_slice_assoc($array, $keys) {
3386 3386
 	$slice = array();
3387
-	foreach ( $keys as $key )
3388
-		if ( isset( $array[ $key ] ) )
3389
-			$slice[ $key ] = $array[ $key ];
3387
+	foreach ($keys as $key)
3388
+		if (isset($array[$key]))
3389
+			$slice[$key] = $array[$key];
3390 3390
 
3391 3391
 	return $slice;
3392 3392
 }
@@ -3399,14 +3399,14 @@  discard block
 block discarded – undo
3399 3399
  * @param mixed $data Variable to check.
3400 3400
  * @return bool Whether the variable is a list.
3401 3401
  */
3402
-function wp_is_numeric_array( $data ) {
3403
-	if ( ! is_array( $data ) ) {
3402
+function wp_is_numeric_array($data) {
3403
+	if ( ! is_array($data)) {
3404 3404
 		return false;
3405 3405
 	}
3406 3406
 
3407
-	$keys = array_keys( $data );
3408
-	$string_keys = array_filter( $keys, 'is_string' );
3409
-	return count( $string_keys ) === 0;
3407
+	$keys = array_keys($data);
3408
+	$string_keys = array_filter($keys, 'is_string');
3409
+	return count($string_keys) === 0;
3410 3410
 }
3411 3411
 
3412 3412
 /**
@@ -3425,14 +3425,14 @@  discard block
 block discarded – undo
3425 3425
  *                              Default false.
3426 3426
  * @return array A list of objects or object fields.
3427 3427
  */
3428
-function wp_filter_object_list( $list, $args = array(), $operator = 'and', $field = false ) {
3429
-	if ( ! is_array( $list ) )
3428
+function wp_filter_object_list($list, $args = array(), $operator = 'and', $field = false) {
3429
+	if ( ! is_array($list))
3430 3430
 		return array();
3431 3431
 
3432
-	$list = wp_list_filter( $list, $args, $operator );
3432
+	$list = wp_list_filter($list, $args, $operator);
3433 3433
 
3434
-	if ( $field )
3435
-		$list = wp_list_pluck( $list, $field );
3434
+	if ($field)
3435
+		$list = wp_list_pluck($list, $field);
3436 3436
 
3437 3437
 	return $list;
3438 3438
 }
@@ -3451,29 +3451,29 @@  discard block
 block discarded – undo
3451 3451
  *                         match. Default 'AND'.
3452 3452
  * @return array Array of found values.
3453 3453
  */
3454
-function wp_list_filter( $list, $args = array(), $operator = 'AND' ) {
3455
-	if ( ! is_array( $list ) )
3454
+function wp_list_filter($list, $args = array(), $operator = 'AND') {
3455
+	if ( ! is_array($list))
3456 3456
 		return array();
3457 3457
 
3458
-	if ( empty( $args ) )
3458
+	if (empty($args))
3459 3459
 		return $list;
3460 3460
 
3461
-	$operator = strtoupper( $operator );
3462
-	$count = count( $args );
3461
+	$operator = strtoupper($operator);
3462
+	$count = count($args);
3463 3463
 	$filtered = array();
3464 3464
 
3465
-	foreach ( $list as $key => $obj ) {
3465
+	foreach ($list as $key => $obj) {
3466 3466
 		$to_match = (array) $obj;
3467 3467
 
3468 3468
 		$matched = 0;
3469
-		foreach ( $args as $m_key => $m_value ) {
3470
-			if ( array_key_exists( $m_key, $to_match ) && $m_value == $to_match[ $m_key ] )
3469
+		foreach ($args as $m_key => $m_value) {
3470
+			if (array_key_exists($m_key, $to_match) && $m_value == $to_match[$m_key])
3471 3471
 				$matched++;
3472 3472
 		}
3473 3473
 
3474
-		if ( ( 'AND' == $operator && $matched == $count )
3475
-		  || ( 'OR' == $operator && $matched > 0 )
3476
-		  || ( 'NOT' == $operator && 0 == $matched ) ) {
3474
+		if (('AND' == $operator && $matched == $count)
3475
+		  || ('OR' == $operator && $matched > 0)
3476
+		  || ('NOT' == $operator && 0 == $matched)) {
3477 3477
 			$filtered[$key] = $obj;
3478 3478
 		}
3479 3479
 	}
@@ -3498,17 +3498,17 @@  discard block
 block discarded – undo
3498 3498
  *               corresponding to `$index_key`. If `$index_key` is null, array keys from the original
3499 3499
  *               `$list` will be preserved in the results.
3500 3500
  */
3501
-function wp_list_pluck( $list, $field, $index_key = null ) {
3502
-	if ( ! $index_key ) {
3501
+function wp_list_pluck($list, $field, $index_key = null) {
3502
+	if ( ! $index_key) {
3503 3503
 		/*
3504 3504
 		 * This is simple. Could at some point wrap array_column()
3505 3505
 		 * if we knew we had an array of arrays.
3506 3506
 		 */
3507
-		foreach ( $list as $key => $value ) {
3508
-			if ( is_object( $value ) ) {
3509
-				$list[ $key ] = $value->$field;
3507
+		foreach ($list as $key => $value) {
3508
+			if (is_object($value)) {
3509
+				$list[$key] = $value->$field;
3510 3510
 			} else {
3511
-				$list[ $key ] = $value[ $field ];
3511
+				$list[$key] = $value[$field];
3512 3512
 			}
3513 3513
 		}
3514 3514
 		return $list;
@@ -3519,18 +3519,18 @@  discard block
 block discarded – undo
3519 3519
 	 * to the end of the stack. This is how array_column() behaves.
3520 3520
 	 */
3521 3521
 	$newlist = array();
3522
-	foreach ( $list as $value ) {
3523
-		if ( is_object( $value ) ) {
3524
-			if ( isset( $value->$index_key ) ) {
3525
-				$newlist[ $value->$index_key ] = $value->$field;
3522
+	foreach ($list as $value) {
3523
+		if (is_object($value)) {
3524
+			if (isset($value->$index_key)) {
3525
+				$newlist[$value->$index_key] = $value->$field;
3526 3526
 			} else {
3527 3527
 				$newlist[] = $value->$field;
3528 3528
 			}
3529 3529
 		} else {
3530
-			if ( isset( $value[ $index_key ] ) ) {
3531
-				$newlist[ $value[ $index_key ] ] = $value[ $field ];
3530
+			if (isset($value[$index_key])) {
3531
+				$newlist[$value[$index_key]] = $value[$field];
3532 3532
 			} else {
3533
-				$newlist[] = $value[ $field ];
3533
+				$newlist[] = $value[$field];
3534 3534
 			}
3535 3535
 		}
3536 3536
 	}
@@ -3558,13 +3558,13 @@  discard block
 block discarded – undo
3558 3558
 	 * @param bool $wp_maybe_load_widgets Whether to load the Widgets library.
3559 3559
 	 *                                    Default true.
3560 3560
 	 */
3561
-	if ( ! apply_filters( 'load_default_widgets', true ) ) {
3561
+	if ( ! apply_filters('load_default_widgets', true)) {
3562 3562
 		return;
3563 3563
 	}
3564 3564
 
3565
-	require_once( ABSPATH . WPINC . '/default-widgets.php' );
3565
+	require_once(ABSPATH.WPINC.'/default-widgets.php');
3566 3566
 
3567
-	add_action( '_admin_menu', 'wp_widgets_add_menu' );
3567
+	add_action('_admin_menu', 'wp_widgets_add_menu');
3568 3568
 }
3569 3569
 
3570 3570
 /**
@@ -3577,11 +3577,11 @@  discard block
 block discarded – undo
3577 3577
 function wp_widgets_add_menu() {
3578 3578
 	global $submenu;
3579 3579
 
3580
-	if ( ! current_theme_supports( 'widgets' ) )
3580
+	if ( ! current_theme_supports('widgets'))
3581 3581
 		return;
3582 3582
 
3583
-	$submenu['themes.php'][7] = array( __( 'Widgets' ), 'edit_theme_options', 'widgets.php' );
3584
-	ksort( $submenu['themes.php'], SORT_NUMERIC );
3583
+	$submenu['themes.php'][7] = array(__('Widgets'), 'edit_theme_options', 'widgets.php');
3584
+	ksort($submenu['themes.php'], SORT_NUMERIC);
3585 3585
 }
3586 3586
 
3587 3587
 /**
@@ -3593,7 +3593,7 @@  discard block
 block discarded – undo
3593 3593
  */
3594 3594
 function wp_ob_end_flush_all() {
3595 3595
 	$levels = ob_get_level();
3596
-	for ($i=0; $i<$levels; $i++)
3596
+	for ($i = 0; $i < $levels; $i++)
3597 3597
 		ob_end_flush();
3598 3598
 }
3599 3599
 
@@ -3621,29 +3621,29 @@  discard block
 block discarded – undo
3621 3621
 	wp_load_translations_early();
3622 3622
 
3623 3623
 	// Load custom DB error template, if present.
3624
-	if ( file_exists( WP_CONTENT_DIR . '/db-error.php' ) ) {
3625
-		require_once( WP_CONTENT_DIR . '/db-error.php' );
3624
+	if (file_exists(WP_CONTENT_DIR.'/db-error.php')) {
3625
+		require_once(WP_CONTENT_DIR.'/db-error.php');
3626 3626
 		die();
3627 3627
 	}
3628 3628
 
3629 3629
 	// If installing or in the admin, provide the verbose message.
3630
-	if ( wp_installing() || defined( 'WP_ADMIN' ) )
3630
+	if (wp_installing() || defined('WP_ADMIN'))
3631 3631
 		wp_die($wpdb->error);
3632 3632
 
3633 3633
 	// Otherwise, be terse.
3634
-	status_header( 500 );
3634
+	status_header(500);
3635 3635
 	nocache_headers();
3636
-	header( 'Content-Type: text/html; charset=utf-8' );
3636
+	header('Content-Type: text/html; charset=utf-8');
3637 3637
 ?>
3638 3638
 <!DOCTYPE html>
3639
-<html xmlns="http://www.w3.org/1999/xhtml"<?php if ( is_rtl() ) echo ' dir="rtl"'; ?>>
3639
+<html xmlns="http://www.w3.org/1999/xhtml"<?php if (is_rtl()) echo ' dir="rtl"'; ?>>
3640 3640
 <head>
3641 3641
 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
3642
-	<title><?php _e( 'Database Error' ); ?></title>
3642
+	<title><?php _e('Database Error'); ?></title>
3643 3643
 
3644 3644
 </head>
3645 3645
 <body>
3646
-	<h1><?php _e( 'Error establishing a database connection' ); ?></h1>
3646
+	<h1><?php _e('Error establishing a database connection'); ?></h1>
3647 3647
 </body>
3648 3648
 </html>
3649 3649
 <?php
@@ -3658,8 +3658,8 @@  discard block
 block discarded – undo
3658 3658
  * @param mixed $maybeint Data you wish to have converted to a non-negative integer.
3659 3659
  * @return int A non-negative integer.
3660 3660
  */
3661
-function absint( $maybeint ) {
3662
-	return abs( intval( $maybeint ) );
3661
+function absint($maybeint) {
3662
+	return abs(intval($maybeint));
3663 3663
 }
3664 3664
 
3665 3665
 /**
@@ -3680,7 +3680,7 @@  discard block
 block discarded – undo
3680 3680
  * @param string $version     The version of WordPress that deprecated the function.
3681 3681
  * @param string $replacement Optional. The function that should have been called. Default null.
3682 3682
  */
3683
-function _deprecated_function( $function, $version, $replacement = null ) {
3683
+function _deprecated_function($function, $version, $replacement = null) {
3684 3684
 
3685 3685
 	/**
3686 3686
 	 * Fires when a deprecated function is called.
@@ -3691,7 +3691,7 @@  discard block
 block discarded – undo
3691 3691
 	 * @param string $replacement The function that should have been called.
3692 3692
 	 * @param string $version     The version of WordPress that deprecated the function.
3693 3693
 	 */
3694
-	do_action( 'deprecated_function_run', $function, $replacement, $version );
3694
+	do_action('deprecated_function_run', $function, $replacement, $version);
3695 3695
 
3696 3696
 	/**
3697 3697
 	 * Filters whether to trigger an error for deprecated functions.
@@ -3700,17 +3700,17 @@  discard block
 block discarded – undo
3700 3700
 	 *
3701 3701
 	 * @param bool $trigger Whether to trigger the error for deprecated functions. Default true.
3702 3702
 	 */
3703
-	if ( WP_DEBUG && apply_filters( 'deprecated_function_trigger_error', true ) ) {
3704
-		if ( function_exists( '__' ) ) {
3705
-			if ( ! is_null( $replacement ) )
3706
-				trigger_error( sprintf( __('%1$s is <strong>deprecated</strong> since version %2$s! Use %3$s instead.'), $function, $version, $replacement ) );
3703
+	if (WP_DEBUG && apply_filters('deprecated_function_trigger_error', true)) {
3704
+		if (function_exists('__')) {
3705
+			if ( ! is_null($replacement))
3706
+				trigger_error(sprintf(__('%1$s is <strong>deprecated</strong> since version %2$s! Use %3$s instead.'), $function, $version, $replacement));
3707 3707
 			else
3708
-				trigger_error( sprintf( __('%1$s is <strong>deprecated</strong> since version %2$s with no alternative available.'), $function, $version ) );
3708
+				trigger_error(sprintf(__('%1$s is <strong>deprecated</strong> since version %2$s with no alternative available.'), $function, $version));
3709 3709
 		} else {
3710
-			if ( ! is_null( $replacement ) )
3711
-				trigger_error( sprintf( '%1$s is <strong>deprecated</strong> since version %2$s! Use %3$s instead.', $function, $version, $replacement ) );
3710
+			if ( ! is_null($replacement))
3711
+				trigger_error(sprintf('%1$s is <strong>deprecated</strong> since version %2$s! Use %3$s instead.', $function, $version, $replacement));
3712 3712
 			else
3713
-				trigger_error( sprintf( '%1$s is <strong>deprecated</strong> since version %2$s with no alternative available.', $function, $version ) );
3713
+				trigger_error(sprintf('%1$s is <strong>deprecated</strong> since version %2$s with no alternative available.', $function, $version));
3714 3714
 		}
3715 3715
 	}
3716 3716
 }
@@ -3735,7 +3735,7 @@  discard block
 block discarded – undo
3735 3735
  * @param string $parent_class Optional. The parent class calling the deprecated constructor.
3736 3736
  *                             Default empty string.
3737 3737
  */
3738
-function _deprecated_constructor( $class, $version, $parent_class = '' ) {
3738
+function _deprecated_constructor($class, $version, $parent_class = '') {
3739 3739
 
3740 3740
 	/**
3741 3741
 	 * Fires when a deprecated constructor is called.
@@ -3747,7 +3747,7 @@  discard block
 block discarded – undo
3747 3747
 	 * @param string $version      The version of WordPress that deprecated the function.
3748 3748
 	 * @param string $parent_class The parent class calling the deprecated constructor.
3749 3749
 	 */
3750
-	do_action( 'deprecated_constructor_run', $class, $version, $parent_class );
3750
+	do_action('deprecated_constructor_run', $class, $version, $parent_class);
3751 3751
 
3752 3752
 	/**
3753 3753
 	 * Filters whether to trigger an error for deprecated functions.
@@ -3758,24 +3758,24 @@  discard block
 block discarded – undo
3758 3758
 	 *
3759 3759
 	 * @param bool $trigger Whether to trigger the error for deprecated functions. Default true.
3760 3760
 	 */
3761
-	if ( WP_DEBUG && apply_filters( 'deprecated_constructor_trigger_error', true ) ) {
3762
-		if ( function_exists( '__' ) ) {
3763
-			if ( ! empty( $parent_class ) ) {
3761
+	if (WP_DEBUG && apply_filters('deprecated_constructor_trigger_error', true)) {
3762
+		if (function_exists('__')) {
3763
+			if ( ! empty($parent_class)) {
3764 3764
 				/* translators: 1: PHP class name, 2: PHP parent class name, 3: version number, 4: __construct() method */
3765
-				trigger_error( sprintf( __( 'The called constructor method for %1$s in %2$s is <strong>deprecated</strong> since version %3$s! Use %4$s instead.' ),
3766
-					$class, $parent_class, $version, '<pre>__construct()</pre>' ) );
3765
+				trigger_error(sprintf(__('The called constructor method for %1$s in %2$s is <strong>deprecated</strong> since version %3$s! Use %4$s instead.'),
3766
+					$class, $parent_class, $version, '<pre>__construct()</pre>'));
3767 3767
 			} else {
3768 3768
 				/* translators: 1: PHP class name, 2: version number, 3: __construct() method */
3769
-				trigger_error( sprintf( __( 'The called constructor method for %1$s is <strong>deprecated</strong> since version %2$s! Use %3$s instead.' ),
3770
-					$class, $version, '<pre>__construct()</pre>' ) );
3769
+				trigger_error(sprintf(__('The called constructor method for %1$s is <strong>deprecated</strong> since version %2$s! Use %3$s instead.'),
3770
+					$class, $version, '<pre>__construct()</pre>'));
3771 3771
 			}
3772 3772
 		} else {
3773
-			if ( ! empty( $parent_class ) ) {
3774
-				trigger_error( sprintf( 'The called constructor method for %1$s in %2$s is <strong>deprecated</strong> since version %3$s! Use %4$s instead.',
3775
-					$class, $parent_class, $version, '<pre>__construct()</pre>' ) );
3773
+			if ( ! empty($parent_class)) {
3774
+				trigger_error(sprintf('The called constructor method for %1$s in %2$s is <strong>deprecated</strong> since version %3$s! Use %4$s instead.',
3775
+					$class, $parent_class, $version, '<pre>__construct()</pre>'));
3776 3776
 			} else {
3777
-				trigger_error( sprintf( 'The called constructor method for %1$s is <strong>deprecated</strong> since version %2$s! Use %3$s instead.',
3778
-					$class, $version, '<pre>__construct()</pre>' ) );
3777
+				trigger_error(sprintf('The called constructor method for %1$s is <strong>deprecated</strong> since version %2$s! Use %3$s instead.',
3778
+					$class, $version, '<pre>__construct()</pre>'));
3779 3779
 			}
3780 3780
 		}
3781 3781
 	}
@@ -3802,7 +3802,7 @@  discard block
 block discarded – undo
3802 3802
  *                            Default null.
3803 3803
  * @param string $message     Optional. A message regarding the change. Default empty.
3804 3804
  */
3805
-function _deprecated_file( $file, $version, $replacement = null, $message = '' ) {
3805
+function _deprecated_file($file, $version, $replacement = null, $message = '') {
3806 3806
 
3807 3807
 	/**
3808 3808
 	 * Fires when a deprecated file is called.
@@ -3814,7 +3814,7 @@  discard block
 block discarded – undo
3814 3814
 	 * @param string $version     The version of WordPress that deprecated the file.
3815 3815
 	 * @param string $message     A message regarding the change.
3816 3816
 	 */
3817
-	do_action( 'deprecated_file_included', $file, $replacement, $version, $message );
3817
+	do_action('deprecated_file_included', $file, $replacement, $version, $message);
3818 3818
 
3819 3819
 	/**
3820 3820
 	 * Filters whether to trigger an error for deprecated files.
@@ -3823,18 +3823,18 @@  discard block
 block discarded – undo
3823 3823
 	 *
3824 3824
 	 * @param bool $trigger Whether to trigger the error for deprecated files. Default true.
3825 3825
 	 */
3826
-	if ( WP_DEBUG && apply_filters( 'deprecated_file_trigger_error', true ) ) {
3827
-		$message = empty( $message ) ? '' : ' ' . $message;
3828
-		if ( function_exists( '__' ) ) {
3829
-			if ( ! is_null( $replacement ) )
3830
-				trigger_error( sprintf( __('%1$s is <strong>deprecated</strong> since version %2$s! Use %3$s instead.'), $file, $version, $replacement ) . $message );
3826
+	if (WP_DEBUG && apply_filters('deprecated_file_trigger_error', true)) {
3827
+		$message = empty($message) ? '' : ' '.$message;
3828
+		if (function_exists('__')) {
3829
+			if ( ! is_null($replacement))
3830
+				trigger_error(sprintf(__('%1$s is <strong>deprecated</strong> since version %2$s! Use %3$s instead.'), $file, $version, $replacement).$message);
3831 3831
 			else
3832
-				trigger_error( sprintf( __('%1$s is <strong>deprecated</strong> since version %2$s with no alternative available.'), $file, $version ) . $message );
3832
+				trigger_error(sprintf(__('%1$s is <strong>deprecated</strong> since version %2$s with no alternative available.'), $file, $version).$message);
3833 3833
 		} else {
3834
-			if ( ! is_null( $replacement ) )
3835
-				trigger_error( sprintf( '%1$s is <strong>deprecated</strong> since version %2$s! Use %3$s instead.', $file, $version, $replacement ) . $message );
3834
+			if ( ! is_null($replacement))
3835
+				trigger_error(sprintf('%1$s is <strong>deprecated</strong> since version %2$s! Use %3$s instead.', $file, $version, $replacement).$message);
3836 3836
 			else
3837
-				trigger_error( sprintf( '%1$s is <strong>deprecated</strong> since version %2$s with no alternative available.', $file, $version ) . $message );
3837
+				trigger_error(sprintf('%1$s is <strong>deprecated</strong> since version %2$s with no alternative available.', $file, $version).$message);
3838 3838
 		}
3839 3839
 	}
3840 3840
 }
@@ -3864,7 +3864,7 @@  discard block
 block discarded – undo
3864 3864
  * @param string $version  The version of WordPress that deprecated the argument used.
3865 3865
  * @param string $message  Optional. A message regarding the change. Default null.
3866 3866
  */
3867
-function _deprecated_argument( $function, $version, $message = null ) {
3867
+function _deprecated_argument($function, $version, $message = null) {
3868 3868
 
3869 3869
 	/**
3870 3870
 	 * Fires when a deprecated argument is called.
@@ -3875,7 +3875,7 @@  discard block
 block discarded – undo
3875 3875
 	 * @param string $message  A message regarding the change.
3876 3876
 	 * @param string $version  The version of WordPress that deprecated the argument used.
3877 3877
 	 */
3878
-	do_action( 'deprecated_argument_run', $function, $message, $version );
3878
+	do_action('deprecated_argument_run', $function, $message, $version);
3879 3879
 
3880 3880
 	/**
3881 3881
 	 * Filters whether to trigger an error for deprecated arguments.
@@ -3884,17 +3884,17 @@  discard block
 block discarded – undo
3884 3884
 	 *
3885 3885
 	 * @param bool $trigger Whether to trigger the error for deprecated arguments. Default true.
3886 3886
 	 */
3887
-	if ( WP_DEBUG && apply_filters( 'deprecated_argument_trigger_error', true ) ) {
3888
-		if ( function_exists( '__' ) ) {
3889
-			if ( ! is_null( $message ) )
3890
-				trigger_error( sprintf( __('%1$s was called with an argument that is <strong>deprecated</strong> since version %2$s! %3$s'), $function, $version, $message ) );
3887
+	if (WP_DEBUG && apply_filters('deprecated_argument_trigger_error', true)) {
3888
+		if (function_exists('__')) {
3889
+			if ( ! is_null($message))
3890
+				trigger_error(sprintf(__('%1$s was called with an argument that is <strong>deprecated</strong> since version %2$s! %3$s'), $function, $version, $message));
3891 3891
 			else
3892
-				trigger_error( sprintf( __('%1$s was called with an argument that is <strong>deprecated</strong> since version %2$s with no alternative available.'), $function, $version ) );
3892
+				trigger_error(sprintf(__('%1$s was called with an argument that is <strong>deprecated</strong> since version %2$s with no alternative available.'), $function, $version));
3893 3893
 		} else {
3894
-			if ( ! is_null( $message ) )
3895
-				trigger_error( sprintf( '%1$s was called with an argument that is <strong>deprecated</strong> since version %2$s! %3$s', $function, $version, $message ) );
3894
+			if ( ! is_null($message))
3895
+				trigger_error(sprintf('%1$s was called with an argument that is <strong>deprecated</strong> since version %2$s! %3$s', $function, $version, $message));
3896 3896
 			else
3897
-				trigger_error( sprintf( '%1$s was called with an argument that is <strong>deprecated</strong> since version %2$s with no alternative available.', $function, $version ) );
3897
+				trigger_error(sprintf('%1$s was called with an argument that is <strong>deprecated</strong> since version %2$s with no alternative available.', $function, $version));
3898 3898
 		}
3899 3899
 	}
3900 3900
 }
@@ -3918,7 +3918,7 @@  discard block
 block discarded – undo
3918 3918
  * @param string $replacement Optional. The hook that should have been used.
3919 3919
  * @param string $message     Optional. A message regarding the change.
3920 3920
  */
3921
-function _deprecated_hook( $hook, $version, $replacement = null, $message = null ) {
3921
+function _deprecated_hook($hook, $version, $replacement = null, $message = null) {
3922 3922
 	/**
3923 3923
 	 * Fires when a deprecated hook is called.
3924 3924
 	 *
@@ -3929,7 +3929,7 @@  discard block
 block discarded – undo
3929 3929
 	 * @param string $version     The version of WordPress that deprecated the argument used.
3930 3930
 	 * @param string $message     A message regarding the change.
3931 3931
 	 */
3932
-	do_action( 'deprecated_hook_run', $hook, $replacement, $version, $message );
3932
+	do_action('deprecated_hook_run', $hook, $replacement, $version, $message);
3933 3933
 
3934 3934
 	/**
3935 3935
 	 * Filters whether to trigger deprecated hook errors.
@@ -3939,12 +3939,12 @@  discard block
 block discarded – undo
3939 3939
 	 * @param bool $trigger Whether to trigger deprecated hook errors. Requires
3940 3940
 	 *                      `WP_DEBUG` to be defined true.
3941 3941
 	 */
3942
-	if ( WP_DEBUG && apply_filters( 'deprecated_hook_trigger_error', true ) ) {
3943
-		$message = empty( $message ) ? '' : ' ' . $message;
3944
-		if ( ! is_null( $replacement ) ) {
3945
-			trigger_error( sprintf( __( '%1$s is <strong>deprecated</strong> since version %2$s! Use %3$s instead.' ), $hook, $version, $replacement ) . $message );
3942
+	if (WP_DEBUG && apply_filters('deprecated_hook_trigger_error', true)) {
3943
+		$message = empty($message) ? '' : ' '.$message;
3944
+		if ( ! is_null($replacement)) {
3945
+			trigger_error(sprintf(__('%1$s is <strong>deprecated</strong> since version %2$s! Use %3$s instead.'), $hook, $version, $replacement).$message);
3946 3946
 		} else {
3947
-			trigger_error( sprintf( __( '%1$s is <strong>deprecated</strong> since version %2$s with no alternative available.' ), $hook, $version ) . $message );
3947
+			trigger_error(sprintf(__('%1$s is <strong>deprecated</strong> since version %2$s with no alternative available.'), $hook, $version).$message);
3948 3948
 		}
3949 3949
 	}
3950 3950
 }
@@ -3965,7 +3965,7 @@  discard block
 block discarded – undo
3965 3965
  * @param string $message  A message explaining what has been done incorrectly.
3966 3966
  * @param string $version  The version of WordPress where the message was added.
3967 3967
  */
3968
-function _doing_it_wrong( $function, $message, $version ) {
3968
+function _doing_it_wrong($function, $message, $version) {
3969 3969
 
3970 3970
 	/**
3971 3971
 	 * Fires when the given function is being used incorrectly.
@@ -3976,7 +3976,7 @@  discard block
 block discarded – undo
3976 3976
 	 * @param string $message  A message explaining what has been done incorrectly.
3977 3977
 	 * @param string $version  The version of WordPress where the message was added.
3978 3978
 	 */
3979
-	do_action( 'doing_it_wrong_run', $function, $message, $version );
3979
+	do_action('doing_it_wrong_run', $function, $message, $version);
3980 3980
 
3981 3981
 	/**
3982 3982
 	 * Filters whether to trigger an error for _doing_it_wrong() calls.
@@ -3985,20 +3985,20 @@  discard block
 block discarded – undo
3985 3985
 	 *
3986 3986
 	 * @param bool $trigger Whether to trigger the error for _doing_it_wrong() calls. Default true.
3987 3987
 	 */
3988
-	if ( WP_DEBUG && apply_filters( 'doing_it_wrong_trigger_error', true ) ) {
3989
-		if ( function_exists( '__' ) ) {
3990
-			$version = is_null( $version ) ? '' : sprintf( __( '(This message was added in version %s.)' ), $version );
3988
+	if (WP_DEBUG && apply_filters('doing_it_wrong_trigger_error', true)) {
3989
+		if (function_exists('__')) {
3990
+			$version = is_null($version) ? '' : sprintf(__('(This message was added in version %s.)'), $version);
3991 3991
 			/* translators: %s: Codex URL */
3992
-			$message .= ' ' . sprintf( __( 'Please see <a href="%s">Debugging in WordPress</a> for more information.' ),
3993
-				__( 'https://codex.wordpress.org/Debugging_in_WordPress' )
3992
+			$message .= ' '.sprintf(__('Please see <a href="%s">Debugging in WordPress</a> for more information.'),
3993
+				__('https://codex.wordpress.org/Debugging_in_WordPress')
3994 3994
 			);
3995
-			trigger_error( sprintf( __( '%1$s was called <strong>incorrectly</strong>. %2$s %3$s' ), $function, $message, $version ) );
3995
+			trigger_error(sprintf(__('%1$s was called <strong>incorrectly</strong>. %2$s %3$s'), $function, $message, $version));
3996 3996
 		} else {
3997
-			$version = is_null( $version ) ? '' : sprintf( '(This message was added in version %s.)', $version );
3998
-			$message .= sprintf( ' Please see <a href="%s">Debugging in WordPress</a> for more information.',
3997
+			$version = is_null($version) ? '' : sprintf('(This message was added in version %s.)', $version);
3998
+			$message .= sprintf(' Please see <a href="%s">Debugging in WordPress</a> for more information.',
3999 3999
 				'https://codex.wordpress.org/Debugging_in_WordPress'
4000 4000
 			);
4001
-			trigger_error( sprintf( '%1$s was called <strong>incorrectly</strong>. %2$s %3$s', $function, $message, $version ) );
4001
+			trigger_error(sprintf('%1$s was called <strong>incorrectly</strong>. %2$s %3$s', $function, $message, $version));
4002 4002
 		}
4003 4003
 	}
4004 4004
 }
@@ -4011,9 +4011,9 @@  discard block
 block discarded – undo
4011 4011
  * @return bool Whether the server is running lighttpd < 1.5.0.
4012 4012
  */
4013 4013
 function is_lighttpd_before_150() {
4014
-	$server_parts = explode( '/', isset( $_SERVER['SERVER_SOFTWARE'] )? $_SERVER['SERVER_SOFTWARE'] : '' );
4015
-	$server_parts[1] = isset( $server_parts[1] )? $server_parts[1] : '';
4016
-	return  'lighttpd' == $server_parts[0] && -1 == version_compare( $server_parts[1], '1.5.0' );
4014
+	$server_parts = explode('/', isset($_SERVER['SERVER_SOFTWARE']) ? $_SERVER['SERVER_SOFTWARE'] : '');
4015
+	$server_parts[1] = isset($server_parts[1]) ? $server_parts[1] : '';
4016
+	return  'lighttpd' == $server_parts[0] && -1 == version_compare($server_parts[1], '1.5.0');
4017 4017
 }
4018 4018
 
4019 4019
 /**
@@ -4030,18 +4030,18 @@  discard block
 block discarded – undo
4030 4030
 function apache_mod_loaded($mod, $default = false) {
4031 4031
 	global $is_apache;
4032 4032
 
4033
-	if ( !$is_apache )
4033
+	if ( ! $is_apache)
4034 4034
 		return false;
4035 4035
 
4036
-	if ( function_exists( 'apache_get_modules' ) ) {
4036
+	if (function_exists('apache_get_modules')) {
4037 4037
 		$mods = apache_get_modules();
4038
-		if ( in_array($mod, $mods) )
4038
+		if (in_array($mod, $mods))
4039 4039
 			return true;
4040
-	} elseif ( function_exists( 'phpinfo' ) && false === strpos( ini_get( 'disable_functions' ), 'phpinfo' ) ) {
4040
+	} elseif (function_exists('phpinfo') && false === strpos(ini_get('disable_functions'), 'phpinfo')) {
4041 4041
 			ob_start();
4042 4042
 			phpinfo(8);
4043 4043
 			$phpinfo = ob_get_clean();
4044
-			if ( false !== strpos($phpinfo, $mod) )
4044
+			if (false !== strpos($phpinfo, $mod))
4045 4045
 				return true;
4046 4046
 	}
4047 4047
 	return $default;
@@ -4060,7 +4060,7 @@  discard block
 block discarded – undo
4060 4060
 	global $is_iis7;
4061 4061
 
4062 4062
 	$supports_permalinks = false;
4063
-	if ( $is_iis7 ) {
4063
+	if ($is_iis7) {
4064 4064
 		/* First we check if the DOMDocument class exists. If it does not exist, then we cannot
4065 4065
 		 * easily update the xml configuration file, hence we just bail out and tell user that
4066 4066
 		 * pretty permalinks cannot be used.
@@ -4070,7 +4070,7 @@  discard block
 block discarded – undo
4070 4070
 		 * Lastly we make sure that PHP is running via FastCGI. This is important because if it runs
4071 4071
 		 * via ISAPI then pretty permalinks will not work.
4072 4072
 		 */
4073
-		$supports_permalinks = class_exists( 'DOMDocument', false ) && isset($_SERVER['IIS_UrlRewriteModule']) && ( PHP_SAPI == 'cgi-fcgi' );
4073
+		$supports_permalinks = class_exists('DOMDocument', false) && isset($_SERVER['IIS_UrlRewriteModule']) && (PHP_SAPI == 'cgi-fcgi');
4074 4074
 	}
4075 4075
 
4076 4076
 	/**
@@ -4080,7 +4080,7 @@  discard block
 block discarded – undo
4080 4080
 	 *
4081 4081
 	 * @param bool $supports_permalinks Whether IIS7 supports permalinks. Default false.
4082 4082
 	 */
4083
-	return apply_filters( 'iis7_supports_permalinks', $supports_permalinks );
4083
+	return apply_filters('iis7_supports_permalinks', $supports_permalinks);
4084 4084
 }
4085 4085
 
4086 4086
 /**
@@ -4097,17 +4097,17 @@  discard block
 block discarded – undo
4097 4097
  * @param array  $allowed_files List of allowed files.
4098 4098
  * @return int 0 means nothing is wrong, greater than 0 means something was wrong.
4099 4099
  */
4100
-function validate_file( $file, $allowed_files = '' ) {
4101
-	if ( false !== strpos( $file, '..' ) )
4100
+function validate_file($file, $allowed_files = '') {
4101
+	if (false !== strpos($file, '..'))
4102 4102
 		return 1;
4103 4103
 
4104
-	if ( false !== strpos( $file, './' ) )
4104
+	if (false !== strpos($file, './'))
4105 4105
 		return 1;
4106 4106
 
4107
-	if ( ! empty( $allowed_files ) && ! in_array( $file, $allowed_files ) )
4107
+	if ( ! empty($allowed_files) && ! in_array($file, $allowed_files))
4108 4108
 		return 3;
4109 4109
 
4110
-	if (':' == substr( $file, 1, 1 ) )
4110
+	if (':' == substr($file, 1, 1))
4111 4111
 		return 2;
4112 4112
 
4113 4113
 	return 0;
@@ -4123,10 +4123,10 @@  discard block
 block discarded – undo
4123 4123
  * @param string|bool $force Optional. Whether to force SSL in admin screens. Default null.
4124 4124
  * @return bool True if forced, false if not forced.
4125 4125
  */
4126
-function force_ssl_admin( $force = null ) {
4126
+function force_ssl_admin($force = null) {
4127 4127
 	static $forced = false;
4128 4128
 
4129
-	if ( !is_null( $force ) ) {
4129
+	if ( ! is_null($force)) {
4130 4130
 		$old_forced = $forced;
4131 4131
 		$forced = $force;
4132 4132
 		return $old_forced;
@@ -4146,39 +4146,39 @@  discard block
 block discarded – undo
4146 4146
  * @return string The guessed URL.
4147 4147
  */
4148 4148
 function wp_guess_url() {
4149
-	if ( defined('WP_SITEURL') && '' != WP_SITEURL ) {
4149
+	if (defined('WP_SITEURL') && '' != WP_SITEURL) {
4150 4150
 		$url = WP_SITEURL;
4151 4151
 	} else {
4152
-		$abspath_fix = str_replace( '\\', '/', ABSPATH );
4153
-		$script_filename_dir = dirname( $_SERVER['SCRIPT_FILENAME'] );
4152
+		$abspath_fix = str_replace('\\', '/', ABSPATH);
4153
+		$script_filename_dir = dirname($_SERVER['SCRIPT_FILENAME']);
4154 4154
 
4155 4155
 		// The request is for the admin
4156
-		if ( strpos( $_SERVER['REQUEST_URI'], 'wp-admin' ) !== false || strpos( $_SERVER['REQUEST_URI'], 'wp-login.php' ) !== false ) {
4157
-			$path = preg_replace( '#/(wp-admin/.*|wp-login.php)#i', '', $_SERVER['REQUEST_URI'] );
4156
+		if (strpos($_SERVER['REQUEST_URI'], 'wp-admin') !== false || strpos($_SERVER['REQUEST_URI'], 'wp-login.php') !== false) {
4157
+			$path = preg_replace('#/(wp-admin/.*|wp-login.php)#i', '', $_SERVER['REQUEST_URI']);
4158 4158
 
4159 4159
 		// The request is for a file in ABSPATH
4160
-		} elseif ( $script_filename_dir . '/' == $abspath_fix ) {
4160
+		} elseif ($script_filename_dir.'/' == $abspath_fix) {
4161 4161
 			// Strip off any file/query params in the path
4162
-			$path = preg_replace( '#/[^/]*$#i', '', $_SERVER['PHP_SELF'] );
4162
+			$path = preg_replace('#/[^/]*$#i', '', $_SERVER['PHP_SELF']);
4163 4163
 
4164 4164
 		} else {
4165
-			if ( false !== strpos( $_SERVER['SCRIPT_FILENAME'], $abspath_fix ) ) {
4165
+			if (false !== strpos($_SERVER['SCRIPT_FILENAME'], $abspath_fix)) {
4166 4166
 				// Request is hitting a file inside ABSPATH
4167
-				$directory = str_replace( ABSPATH, '', $script_filename_dir );
4167
+				$directory = str_replace(ABSPATH, '', $script_filename_dir);
4168 4168
 				// Strip off the sub directory, and any file/query params
4169
-				$path = preg_replace( '#/' . preg_quote( $directory, '#' ) . '/[^/]*$#i', '' , $_SERVER['REQUEST_URI'] );
4170
-			} elseif ( false !== strpos( $abspath_fix, $script_filename_dir ) ) {
4169
+				$path = preg_replace('#/'.preg_quote($directory, '#').'/[^/]*$#i', '', $_SERVER['REQUEST_URI']);
4170
+			} elseif (false !== strpos($abspath_fix, $script_filename_dir)) {
4171 4171
 				// Request is hitting a file above ABSPATH
4172
-				$subdirectory = substr( $abspath_fix, strpos( $abspath_fix, $script_filename_dir ) + strlen( $script_filename_dir ) );
4172
+				$subdirectory = substr($abspath_fix, strpos($abspath_fix, $script_filename_dir) + strlen($script_filename_dir));
4173 4173
 				// Strip off any file/query params from the path, appending the sub directory to the install
4174
-				$path = preg_replace( '#/[^/]*$#i', '' , $_SERVER['REQUEST_URI'] ) . $subdirectory;
4174
+				$path = preg_replace('#/[^/]*$#i', '', $_SERVER['REQUEST_URI']).$subdirectory;
4175 4175
 			} else {
4176 4176
 				$path = $_SERVER['REQUEST_URI'];
4177 4177
 			}
4178 4178
 		}
4179 4179
 
4180 4180
 		$schema = is_ssl() ? 'https://' : 'http://'; // set_url_scheme() is not defined yet
4181
-		$url = $schema . $_SERVER['HTTP_HOST'] . $path;
4181
+		$url = $schema.$_SERVER['HTTP_HOST'].$path;
4182 4182
 	}
4183 4183
 
4184 4184
 	return rtrim($url, '/');
@@ -4201,10 +4201,10 @@  discard block
 block discarded – undo
4201 4201
  * @param bool $suspend Optional. Suspends additions if true, re-enables them if false.
4202 4202
  * @return bool The current suspend setting
4203 4203
  */
4204
-function wp_suspend_cache_addition( $suspend = null ) {
4204
+function wp_suspend_cache_addition($suspend = null) {
4205 4205
 	static $_suspend = false;
4206 4206
 
4207
-	if ( is_bool( $suspend ) )
4207
+	if (is_bool($suspend))
4208 4208
 		$_suspend = $suspend;
4209 4209
 
4210 4210
 	return $_suspend;
@@ -4224,7 +4224,7 @@  discard block
 block discarded – undo
4224 4224
  * @param bool $suspend Optional. Whether to suspend or enable cache invalidation. Default true.
4225 4225
  * @return bool The current suspend setting.
4226 4226
  */
4227
-function wp_suspend_cache_invalidation( $suspend = true ) {
4227
+function wp_suspend_cache_invalidation($suspend = true) {
4228 4228
 	global $_wp_suspend_cache_invalidation;
4229 4229
 
4230 4230
 	$current_suspend = $_wp_suspend_cache_invalidation;
@@ -4243,14 +4243,14 @@  discard block
 block discarded – undo
4243 4243
  * @return bool True if $site_id is the main site of the network, or if not
4244 4244
  *              running Multisite.
4245 4245
  */
4246
-function is_main_site( $site_id = null ) {
4246
+function is_main_site($site_id = null) {
4247 4247
 	// This is the current network's information; 'site' is old terminology.
4248 4248
 	global $current_site;
4249 4249
 
4250
-	if ( ! is_multisite() )
4250
+	if ( ! is_multisite())
4251 4251
 		return true;
4252 4252
 
4253
-	if ( ! $site_id )
4253
+	if ( ! $site_id)
4254 4254
 		$site_id = get_current_blog_id();
4255 4255
 
4256 4256
 	return (int) $site_id === (int) $current_site->blog_id;
@@ -4264,20 +4264,20 @@  discard block
 block discarded – undo
4264 4264
  * @param int $network_id Optional. Network ID to test. Defaults to current network.
4265 4265
  * @return bool True if $network_id is the main network, or if not running Multisite.
4266 4266
  */
4267
-function is_main_network( $network_id = null ) {
4268
-	if ( ! is_multisite() ) {
4267
+function is_main_network($network_id = null) {
4268
+	if ( ! is_multisite()) {
4269 4269
 		return true;
4270 4270
 	}
4271 4271
 
4272 4272
 	$current_network_id = (int) get_current_site()->id;
4273 4273
 
4274
-	if ( null === $network_id ) {
4274
+	if (null === $network_id) {
4275 4275
 		$network_id = $current_network_id;
4276 4276
 	}
4277 4277
 
4278 4278
 	$network_id = (int) $network_id;
4279 4279
 
4280
-	return ( $network_id === get_main_network_id() );
4280
+	return ($network_id === get_main_network_id());
4281 4281
 }
4282 4282
 
4283 4283
 /**
@@ -4292,23 +4292,23 @@  discard block
 block discarded – undo
4292 4292
 function get_main_network_id() {
4293 4293
 	global $wpdb;
4294 4294
 
4295
-	if ( ! is_multisite() ) {
4295
+	if ( ! is_multisite()) {
4296 4296
 		return 1;
4297 4297
 	}
4298 4298
 
4299 4299
 	$current_site = get_current_site();
4300 4300
 
4301
-	if ( defined( 'PRIMARY_NETWORK_ID' ) ) {
4301
+	if (defined('PRIMARY_NETWORK_ID')) {
4302 4302
 		$main_network_id = PRIMARY_NETWORK_ID;
4303
-	} elseif ( isset( $current_site->id ) && 1 === (int) $current_site->id ) {
4303
+	} elseif (isset($current_site->id) && 1 === (int) $current_site->id) {
4304 4304
 		// If the current network has an ID of 1, assume it is the main network.
4305 4305
 		$main_network_id = 1;
4306 4306
 	} else {
4307
-		$main_network_id = wp_cache_get( 'primary_network_id', 'site-options' );
4307
+		$main_network_id = wp_cache_get('primary_network_id', 'site-options');
4308 4308
 
4309
-		if ( false === $main_network_id ) {
4310
-			$main_network_id = (int) $wpdb->get_var( "SELECT id FROM {$wpdb->site} ORDER BY id LIMIT 1" );
4311
-			wp_cache_add( 'primary_network_id', $main_network_id, 'site-options' );
4309
+		if (false === $main_network_id) {
4310
+			$main_network_id = (int) $wpdb->get_var("SELECT id FROM {$wpdb->site} ORDER BY id LIMIT 1");
4311
+			wp_cache_add('primary_network_id', $main_network_id, 'site-options');
4312 4312
 		}
4313 4313
 	}
4314 4314
 
@@ -4319,7 +4319,7 @@  discard block
 block discarded – undo
4319 4319
 	 *
4320 4320
 	 * @param int $main_network_id The ID of the main network.
4321 4321
 	 */
4322
-	return (int) apply_filters( 'get_main_network_id', $main_network_id );
4322
+	return (int) apply_filters('get_main_network_id', $main_network_id);
4323 4323
 }
4324 4324
 
4325 4325
 /**
@@ -4332,11 +4332,11 @@  discard block
 block discarded – undo
4332 4332
  * @return bool True if multisite and global terms enabled.
4333 4333
  */
4334 4334
 function global_terms_enabled() {
4335
-	if ( ! is_multisite() )
4335
+	if ( ! is_multisite())
4336 4336
 		return false;
4337 4337
 
4338 4338
 	static $global_terms = null;
4339
-	if ( is_null( $global_terms ) ) {
4339
+	if (is_null($global_terms)) {
4340 4340
 
4341 4341
 		/**
4342 4342
 		 * Filters whether global terms are enabled.
@@ -4348,11 +4348,11 @@  discard block
 block discarded – undo
4348 4348
 		 *
4349 4349
 		 * @param null $enabled Whether global terms are enabled.
4350 4350
 		 */
4351
-		$filter = apply_filters( 'global_terms_enabled', null );
4352
-		if ( ! is_null( $filter ) )
4351
+		$filter = apply_filters('global_terms_enabled', null);
4352
+		if ( ! is_null($filter))
4353 4353
 			$global_terms = (bool) $filter;
4354 4354
 		else
4355
-			$global_terms = (bool) get_site_option( 'global_terms_enabled', false );
4355
+			$global_terms = (bool) get_site_option('global_terms_enabled', false);
4356 4356
 	}
4357 4357
 	return $global_terms;
4358 4358
 }
@@ -4367,16 +4367,16 @@  discard block
 block discarded – undo
4367 4367
  * @return float|false Timezone GMT offset, false otherwise.
4368 4368
  */
4369 4369
 function wp_timezone_override_offset() {
4370
-	if ( !$timezone_string = get_option( 'timezone_string' ) ) {
4370
+	if ( ! $timezone_string = get_option('timezone_string')) {
4371 4371
 		return false;
4372 4372
 	}
4373 4373
 
4374
-	$timezone_object = timezone_open( $timezone_string );
4374
+	$timezone_object = timezone_open($timezone_string);
4375 4375
 	$datetime_object = date_create();
4376
-	if ( false === $timezone_object || false === $datetime_object ) {
4376
+	if (false === $timezone_object || false === $datetime_object) {
4377 4377
 		return false;
4378 4378
 	}
4379
-	return round( timezone_offset_get( $timezone_object, $datetime_object ) / HOUR_IN_SECONDS, 2 );
4379
+	return round(timezone_offset_get($timezone_object, $datetime_object) / HOUR_IN_SECONDS, 2);
4380 4380
 }
4381 4381
 
4382 4382
 /**
@@ -4389,41 +4389,41 @@  discard block
 block discarded – undo
4389 4389
  * @param array $b
4390 4390
  * @return int
4391 4391
  */
4392
-function _wp_timezone_choice_usort_callback( $a, $b ) {
4392
+function _wp_timezone_choice_usort_callback($a, $b) {
4393 4393
 	// Don't use translated versions of Etc
4394
-	if ( 'Etc' === $a['continent'] && 'Etc' === $b['continent'] ) {
4394
+	if ('Etc' === $a['continent'] && 'Etc' === $b['continent']) {
4395 4395
 		// Make the order of these more like the old dropdown
4396
-		if ( 'GMT+' === substr( $a['city'], 0, 4 ) && 'GMT+' === substr( $b['city'], 0, 4 ) ) {
4397
-			return -1 * ( strnatcasecmp( $a['city'], $b['city'] ) );
4396
+		if ('GMT+' === substr($a['city'], 0, 4) && 'GMT+' === substr($b['city'], 0, 4)) {
4397
+			return -1 * (strnatcasecmp($a['city'], $b['city']));
4398 4398
 		}
4399
-		if ( 'UTC' === $a['city'] ) {
4400
-			if ( 'GMT+' === substr( $b['city'], 0, 4 ) ) {
4399
+		if ('UTC' === $a['city']) {
4400
+			if ('GMT+' === substr($b['city'], 0, 4)) {
4401 4401
 				return 1;
4402 4402
 			}
4403 4403
 			return -1;
4404 4404
 		}
4405
-		if ( 'UTC' === $b['city'] ) {
4406
-			if ( 'GMT+' === substr( $a['city'], 0, 4 ) ) {
4405
+		if ('UTC' === $b['city']) {
4406
+			if ('GMT+' === substr($a['city'], 0, 4)) {
4407 4407
 				return -1;
4408 4408
 			}
4409 4409
 			return 1;
4410 4410
 		}
4411
-		return strnatcasecmp( $a['city'], $b['city'] );
4411
+		return strnatcasecmp($a['city'], $b['city']);
4412 4412
 	}
4413
-	if ( $a['t_continent'] == $b['t_continent'] ) {
4414
-		if ( $a['t_city'] == $b['t_city'] ) {
4415
-			return strnatcasecmp( $a['t_subcity'], $b['t_subcity'] );
4413
+	if ($a['t_continent'] == $b['t_continent']) {
4414
+		if ($a['t_city'] == $b['t_city']) {
4415
+			return strnatcasecmp($a['t_subcity'], $b['t_subcity']);
4416 4416
 		}
4417
-		return strnatcasecmp( $a['t_city'], $b['t_city'] );
4417
+		return strnatcasecmp($a['t_city'], $b['t_city']);
4418 4418
 	} else {
4419 4419
 		// Force Etc to the bottom of the list
4420
-		if ( 'Etc' === $a['continent'] ) {
4420
+		if ('Etc' === $a['continent']) {
4421 4421
 			return 1;
4422 4422
 		}
4423
-		if ( 'Etc' === $b['continent'] ) {
4423
+		if ('Etc' === $b['continent']) {
4424 4424
 			return -1;
4425 4425
 		}
4426
-		return strnatcasecmp( $a['t_continent'], $b['t_continent'] );
4426
+		return strnatcasecmp($a['t_continent'], $b['t_continent']);
4427 4427
 	}
4428 4428
 }
4429 4429
 
@@ -4437,125 +4437,125 @@  discard block
 block discarded – undo
4437 4437
  * @param string $selected_zone Selected timezone.
4438 4438
  * @return string
4439 4439
  */
4440
-function wp_timezone_choice( $selected_zone ) {
4440
+function wp_timezone_choice($selected_zone) {
4441 4441
 	static $mo_loaded = false;
4442 4442
 
4443
-	$continents = array( 'Africa', 'America', 'Antarctica', 'Arctic', 'Asia', 'Atlantic', 'Australia', 'Europe', 'Indian', 'Pacific');
4443
+	$continents = array('Africa', 'America', 'Antarctica', 'Arctic', 'Asia', 'Atlantic', 'Australia', 'Europe', 'Indian', 'Pacific');
4444 4444
 
4445 4445
 	// Load translations for continents and cities
4446
-	if ( !$mo_loaded ) {
4446
+	if ( ! $mo_loaded) {
4447 4447
 		$locale = get_locale();
4448
-		$mofile = WP_LANG_DIR . '/continents-cities-' . $locale . '.mo';
4449
-		load_textdomain( 'continents-cities', $mofile );
4448
+		$mofile = WP_LANG_DIR.'/continents-cities-'.$locale.'.mo';
4449
+		load_textdomain('continents-cities', $mofile);
4450 4450
 		$mo_loaded = true;
4451 4451
 	}
4452 4452
 
4453 4453
 	$zonen = array();
4454
-	foreach ( timezone_identifiers_list() as $zone ) {
4455
-		$zone = explode( '/', $zone );
4456
-		if ( !in_array( $zone[0], $continents ) ) {
4454
+	foreach (timezone_identifiers_list() as $zone) {
4455
+		$zone = explode('/', $zone);
4456
+		if ( ! in_array($zone[0], $continents)) {
4457 4457
 			continue;
4458 4458
 		}
4459 4459
 
4460 4460
 		// This determines what gets set and translated - we don't translate Etc/* strings here, they are done later
4461 4461
 		$exists = array(
4462
-			0 => ( isset( $zone[0] ) && $zone[0] ),
4463
-			1 => ( isset( $zone[1] ) && $zone[1] ),
4464
-			2 => ( isset( $zone[2] ) && $zone[2] ),
4462
+			0 => (isset($zone[0]) && $zone[0]),
4463
+			1 => (isset($zone[1]) && $zone[1]),
4464
+			2 => (isset($zone[2]) && $zone[2]),
4465 4465
 		);
4466
-		$exists[3] = ( $exists[0] && 'Etc' !== $zone[0] );
4467
-		$exists[4] = ( $exists[1] && $exists[3] );
4468
-		$exists[5] = ( $exists[2] && $exists[3] );
4466
+		$exists[3] = ($exists[0] && 'Etc' !== $zone[0]);
4467
+		$exists[4] = ($exists[1] && $exists[3]);
4468
+		$exists[5] = ($exists[2] && $exists[3]);
4469 4469
 
4470 4470
 		$zonen[] = array(
4471
-			'continent'   => ( $exists[0] ? $zone[0] : '' ),
4472
-			'city'        => ( $exists[1] ? $zone[1] : '' ),
4473
-			'subcity'     => ( $exists[2] ? $zone[2] : '' ),
4474
-			't_continent' => ( $exists[3] ? translate( str_replace( '_', ' ', $zone[0] ), 'continents-cities' ) : '' ),
4475
-			't_city'      => ( $exists[4] ? translate( str_replace( '_', ' ', $zone[1] ), 'continents-cities' ) : '' ),
4476
-			't_subcity'   => ( $exists[5] ? translate( str_replace( '_', ' ', $zone[2] ), 'continents-cities' ) : '' )
4471
+			'continent'   => ($exists[0] ? $zone[0] : ''),
4472
+			'city'        => ($exists[1] ? $zone[1] : ''),
4473
+			'subcity'     => ($exists[2] ? $zone[2] : ''),
4474
+			't_continent' => ($exists[3] ? translate(str_replace('_', ' ', $zone[0]), 'continents-cities') : ''),
4475
+			't_city'      => ($exists[4] ? translate(str_replace('_', ' ', $zone[1]), 'continents-cities') : ''),
4476
+			't_subcity'   => ($exists[5] ? translate(str_replace('_', ' ', $zone[2]), 'continents-cities') : '')
4477 4477
 		);
4478 4478
 	}
4479
-	usort( $zonen, '_wp_timezone_choice_usort_callback' );
4479
+	usort($zonen, '_wp_timezone_choice_usort_callback');
4480 4480
 
4481 4481
 	$structure = array();
4482 4482
 
4483
-	if ( empty( $selected_zone ) ) {
4484
-		$structure[] = '<option selected="selected" value="">' . __( 'Select a city' ) . '</option>';
4483
+	if (empty($selected_zone)) {
4484
+		$structure[] = '<option selected="selected" value="">'.__('Select a city').'</option>';
4485 4485
 	}
4486 4486
 
4487
-	foreach ( $zonen as $key => $zone ) {
4487
+	foreach ($zonen as $key => $zone) {
4488 4488
 		// Build value in an array to join later
4489
-		$value = array( $zone['continent'] );
4489
+		$value = array($zone['continent']);
4490 4490
 
4491
-		if ( empty( $zone['city'] ) ) {
4491
+		if (empty($zone['city'])) {
4492 4492
 			// It's at the continent level (generally won't happen)
4493 4493
 			$display = $zone['t_continent'];
4494 4494
 		} else {
4495 4495
 			// It's inside a continent group
4496 4496
 
4497 4497
 			// Continent optgroup
4498
-			if ( !isset( $zonen[$key - 1] ) || $zonen[$key - 1]['continent'] !== $zone['continent'] ) {
4498
+			if ( ! isset($zonen[$key - 1]) || $zonen[$key - 1]['continent'] !== $zone['continent']) {
4499 4499
 				$label = $zone['t_continent'];
4500
-				$structure[] = '<optgroup label="'. esc_attr( $label ) .'">';
4500
+				$structure[] = '<optgroup label="'.esc_attr($label).'">';
4501 4501
 			}
4502 4502
 
4503 4503
 			// Add the city to the value
4504 4504
 			$value[] = $zone['city'];
4505 4505
 
4506 4506
 			$display = $zone['t_city'];
4507
-			if ( !empty( $zone['subcity'] ) ) {
4507
+			if ( ! empty($zone['subcity'])) {
4508 4508
 				// Add the subcity to the value
4509 4509
 				$value[] = $zone['subcity'];
4510
-				$display .= ' - ' . $zone['t_subcity'];
4510
+				$display .= ' - '.$zone['t_subcity'];
4511 4511
 			}
4512 4512
 		}
4513 4513
 
4514 4514
 		// Build the value
4515
-		$value = join( '/', $value );
4515
+		$value = join('/', $value);
4516 4516
 		$selected = '';
4517
-		if ( $value === $selected_zone ) {
4517
+		if ($value === $selected_zone) {
4518 4518
 			$selected = 'selected="selected" ';
4519 4519
 		}
4520
-		$structure[] = '<option ' . $selected . 'value="' . esc_attr( $value ) . '">' . esc_html( $display ) . "</option>";
4520
+		$structure[] = '<option '.$selected.'value="'.esc_attr($value).'">'.esc_html($display)."</option>";
4521 4521
 
4522 4522
 		// Close continent optgroup
4523
-		if ( !empty( $zone['city'] ) && ( !isset($zonen[$key + 1]) || (isset( $zonen[$key + 1] ) && $zonen[$key + 1]['continent'] !== $zone['continent']) ) ) {
4523
+		if ( ! empty($zone['city']) && ( ! isset($zonen[$key + 1]) || (isset($zonen[$key + 1]) && $zonen[$key + 1]['continent'] !== $zone['continent']))) {
4524 4524
 			$structure[] = '</optgroup>';
4525 4525
 		}
4526 4526
 	}
4527 4527
 
4528 4528
 	// Do UTC
4529
-	$structure[] = '<optgroup label="'. esc_attr__( 'UTC' ) .'">';
4529
+	$structure[] = '<optgroup label="'.esc_attr__('UTC').'">';
4530 4530
 	$selected = '';
4531
-	if ( 'UTC' === $selected_zone )
4531
+	if ('UTC' === $selected_zone)
4532 4532
 		$selected = 'selected="selected" ';
4533
-	$structure[] = '<option ' . $selected . 'value="' . esc_attr( 'UTC' ) . '">' . __('UTC') . '</option>';
4533
+	$structure[] = '<option '.$selected.'value="'.esc_attr('UTC').'">'.__('UTC').'</option>';
4534 4534
 	$structure[] = '</optgroup>';
4535 4535
 
4536 4536
 	// Do manual UTC offsets
4537
-	$structure[] = '<optgroup label="'. esc_attr__( 'Manual Offsets' ) .'">';
4538
-	$offset_range = array (-12, -11.5, -11, -10.5, -10, -9.5, -9, -8.5, -8, -7.5, -7, -6.5, -6, -5.5, -5, -4.5, -4, -3.5, -3, -2.5, -2, -1.5, -1, -0.5,
4537
+	$structure[] = '<optgroup label="'.esc_attr__('Manual Offsets').'">';
4538
+	$offset_range = array(-12, -11.5, -11, -10.5, -10, -9.5, -9, -8.5, -8, -7.5, -7, -6.5, -6, -5.5, -5, -4.5, -4, -3.5, -3, -2.5, -2, -1.5, -1, -0.5,
4539 4539
 		0, 0.5, 1, 1.5, 2, 2.5, 3, 3.5, 4, 4.5, 5, 5.5, 5.75, 6, 6.5, 7, 7.5, 8, 8.5, 8.75, 9, 9.5, 10, 10.5, 11, 11.5, 12, 12.75, 13, 13.75, 14);
4540
-	foreach ( $offset_range as $offset ) {
4541
-		if ( 0 <= $offset )
4542
-			$offset_name = '+' . $offset;
4540
+	foreach ($offset_range as $offset) {
4541
+		if (0 <= $offset)
4542
+			$offset_name = '+'.$offset;
4543 4543
 		else
4544 4544
 			$offset_name = (string) $offset;
4545 4545
 
4546 4546
 		$offset_value = $offset_name;
4547
-		$offset_name = str_replace(array('.25','.5','.75'), array(':15',':30',':45'), $offset_name);
4548
-		$offset_name = 'UTC' . $offset_name;
4549
-		$offset_value = 'UTC' . $offset_value;
4547
+		$offset_name = str_replace(array('.25', '.5', '.75'), array(':15', ':30', ':45'), $offset_name);
4548
+		$offset_name = 'UTC'.$offset_name;
4549
+		$offset_value = 'UTC'.$offset_value;
4550 4550
 		$selected = '';
4551
-		if ( $offset_value === $selected_zone )
4551
+		if ($offset_value === $selected_zone)
4552 4552
 			$selected = 'selected="selected" ';
4553
-		$structure[] = '<option ' . $selected . 'value="' . esc_attr( $offset_value ) . '">' . esc_html( $offset_name ) . "</option>";
4553
+		$structure[] = '<option '.$selected.'value="'.esc_attr($offset_value).'">'.esc_html($offset_name)."</option>";
4554 4554
 
4555 4555
 	}
4556 4556
 	$structure[] = '</optgroup>';
4557 4557
 
4558
-	return join( "\n", $structure );
4558
+	return join("\n", $structure);
4559 4559
 }
4560 4560
 
4561 4561
 /**
@@ -4569,7 +4569,7 @@  discard block
 block discarded – undo
4569 4569
  * @param string $str Header comment to clean up.
4570 4570
  * @return string
4571 4571
  */
4572
-function _cleanup_header_comment( $str ) {
4572
+function _cleanup_header_comment($str) {
4573 4573
 	return trim(preg_replace("/\s*(?:\*\/|\?>).*/", '', $str));
4574 4574
 }
4575 4575
 
@@ -4586,18 +4586,18 @@  discard block
 block discarded – undo
4586 4586
 function wp_scheduled_delete() {
4587 4587
 	global $wpdb;
4588 4588
 
4589
-	$delete_timestamp = time() - ( DAY_IN_SECONDS * EMPTY_TRASH_DAYS );
4589
+	$delete_timestamp = time() - (DAY_IN_SECONDS * EMPTY_TRASH_DAYS);
4590 4590
 
4591 4591
 	$posts_to_delete = $wpdb->get_results($wpdb->prepare("SELECT post_id FROM $wpdb->postmeta WHERE meta_key = '_wp_trash_meta_time' AND meta_value < '%d'", $delete_timestamp), ARRAY_A);
4592 4592
 
4593
-	foreach ( (array) $posts_to_delete as $post ) {
4593
+	foreach ((array) $posts_to_delete as $post) {
4594 4594
 		$post_id = (int) $post['post_id'];
4595
-		if ( !$post_id )
4595
+		if ( ! $post_id)
4596 4596
 			continue;
4597 4597
 
4598 4598
 		$del_post = get_post($post_id);
4599 4599
 
4600
-		if ( !$del_post || 'trash' != $del_post->post_status ) {
4600
+		if ( ! $del_post || 'trash' != $del_post->post_status) {
4601 4601
 			delete_post_meta($post_id, '_wp_trash_meta_status');
4602 4602
 			delete_post_meta($post_id, '_wp_trash_meta_time');
4603 4603
 		} else {
@@ -4607,18 +4607,18 @@  discard block
 block discarded – undo
4607 4607
 
4608 4608
 	$comments_to_delete = $wpdb->get_results($wpdb->prepare("SELECT comment_id FROM $wpdb->commentmeta WHERE meta_key = '_wp_trash_meta_time' AND meta_value < '%d'", $delete_timestamp), ARRAY_A);
4609 4609
 
4610
-	foreach ( (array) $comments_to_delete as $comment ) {
4610
+	foreach ((array) $comments_to_delete as $comment) {
4611 4611
 		$comment_id = (int) $comment['comment_id'];
4612
-		if ( !$comment_id )
4612
+		if ( ! $comment_id)
4613 4613
 			continue;
4614 4614
 
4615 4615
 		$del_comment = get_comment($comment_id);
4616 4616
 
4617
-		if ( !$del_comment || 'trash' != $del_comment->comment_approved ) {
4617
+		if ( ! $del_comment || 'trash' != $del_comment->comment_approved) {
4618 4618
 			delete_comment_meta($comment_id, '_wp_trash_meta_time');
4619 4619
 			delete_comment_meta($comment_id, '_wp_trash_meta_status');
4620 4620
 		} else {
4621
-			wp_delete_comment( $del_comment );
4621
+			wp_delete_comment($del_comment);
4622 4622
 		}
4623 4623
 	}
4624 4624
 }
@@ -4643,18 +4643,18 @@  discard block
 block discarded – undo
4643 4643
  *                                Default empty.
4644 4644
  * @return array Array of file headers in `HeaderKey => Header Value` format.
4645 4645
  */
4646
-function get_file_data( $file, $default_headers, $context = '' ) {
4646
+function get_file_data($file, $default_headers, $context = '') {
4647 4647
 	// We don't need to write to the file, so just open for reading.
4648
-	$fp = fopen( $file, 'r' );
4648
+	$fp = fopen($file, 'r');
4649 4649
 
4650 4650
 	// Pull only the first 8kiB of the file in.
4651
-	$file_data = fread( $fp, 8192 );
4651
+	$file_data = fread($fp, 8192);
4652 4652
 
4653 4653
 	// PHP will close file handle, but we are good citizens.
4654
-	fclose( $fp );
4654
+	fclose($fp);
4655 4655
 
4656 4656
 	// Make sure we catch CR-only line endings.
4657
-	$file_data = str_replace( "\r", "\n", $file_data );
4657
+	$file_data = str_replace("\r", "\n", $file_data);
4658 4658
 
4659 4659
 	/**
4660 4660
 	 * Filters extra file headers by context.
@@ -4666,18 +4666,18 @@  discard block
 block discarded – undo
4666 4666
 	 *
4667 4667
 	 * @param array $extra_context_headers Empty array by default.
4668 4668
 	 */
4669
-	if ( $context && $extra_headers = apply_filters( "extra_{$context}_headers", array() ) ) {
4670
-		$extra_headers = array_combine( $extra_headers, $extra_headers ); // keys equal values
4671
-		$all_headers = array_merge( $extra_headers, (array) $default_headers );
4669
+	if ($context && $extra_headers = apply_filters("extra_{$context}_headers", array())) {
4670
+		$extra_headers = array_combine($extra_headers, $extra_headers); // keys equal values
4671
+		$all_headers = array_merge($extra_headers, (array) $default_headers);
4672 4672
 	} else {
4673 4673
 		$all_headers = $default_headers;
4674 4674
 	}
4675 4675
 
4676
-	foreach ( $all_headers as $field => $regex ) {
4677
-		if ( preg_match( '/^[ \t\/*#@]*' . preg_quote( $regex, '/' ) . ':(.*)$/mi', $file_data, $match ) && $match[1] )
4678
-			$all_headers[ $field ] = _cleanup_header_comment( $match[1] );
4676
+	foreach ($all_headers as $field => $regex) {
4677
+		if (preg_match('/^[ \t\/*#@]*'.preg_quote($regex, '/').':(.*)$/mi', $file_data, $match) && $match[1])
4678
+			$all_headers[$field] = _cleanup_header_comment($match[1]);
4679 4679
 		else
4680
-			$all_headers[ $field ] = '';
4680
+			$all_headers[$field] = '';
4681 4681
 	}
4682 4682
 
4683 4683
 	return $all_headers;
@@ -4776,7 +4776,7 @@  discard block
 block discarded – undo
4776 4776
  * @see https://src.chromium.org/viewvc/chrome?view=rev&revision=6985
4777 4777
  */
4778 4778
 function send_nosniff_header() {
4779
-	@header( 'X-Content-Type-Options: nosniff' );
4779
+	@header('X-Content-Type-Options: nosniff');
4780 4780
 }
4781 4781
 
4782 4782
 /**
@@ -4788,8 +4788,8 @@  discard block
 block discarded – undo
4788 4788
  * @param string $column Database column.
4789 4789
  * @return string SQL clause.
4790 4790
  */
4791
-function _wp_mysql_week( $column ) {
4792
-	switch ( $start_of_week = (int) get_option( 'start_of_week' ) ) {
4791
+function _wp_mysql_week($column) {
4792
+	switch ($start_of_week = (int) get_option('start_of_week')) {
4793 4793
 	case 1 :
4794 4794
 		return "WEEK( $column, 1 )";
4795 4795
 	case 2 :
@@ -4817,13 +4817,13 @@  discard block
 block discarded – undo
4817 4817
  * @param array    $callback_args Optional. Additional arguments to send to $callback.
4818 4818
  * @return array IDs of all members of loop.
4819 4819
  */
4820
-function wp_find_hierarchy_loop( $callback, $start, $start_parent, $callback_args = array() ) {
4821
-	$override = is_null( $start_parent ) ? array() : array( $start => $start_parent );
4820
+function wp_find_hierarchy_loop($callback, $start, $start_parent, $callback_args = array()) {
4821
+	$override = is_null($start_parent) ? array() : array($start => $start_parent);
4822 4822
 
4823
-	if ( !$arbitrary_loop_member = wp_find_hierarchy_loop_tortoise_hare( $callback, $start, $override, $callback_args ) )
4823
+	if ( ! $arbitrary_loop_member = wp_find_hierarchy_loop_tortoise_hare($callback, $start, $override, $callback_args))
4824 4824
 		return array();
4825 4825
 
4826
-	return wp_find_hierarchy_loop_tortoise_hare( $callback, $arbitrary_loop_member, $override, $callback_args, true );
4826
+	return wp_find_hierarchy_loop_tortoise_hare($callback, $arbitrary_loop_member, $override, $callback_args, true);
4827 4827
 }
4828 4828
 
4829 4829
 /**
@@ -4846,7 +4846,7 @@  discard block
 block discarded – undo
4846 4846
  * @return mixed Scalar ID of some arbitrary member of the loop, or array of IDs of all members of loop if
4847 4847
  *               $_return_loop
4848 4848
  */
4849
-function wp_find_hierarchy_loop_tortoise_hare( $callback, $start, $override = array(), $callback_args = array(), $_return_loop = false ) {
4849
+function wp_find_hierarchy_loop_tortoise_hare($callback, $start, $override = array(), $callback_args = array(), $_return_loop = false) {
4850 4850
 	$tortoise = $hare = $evanescent_hare = $start;
4851 4851
 	$return = array();
4852 4852
 
@@ -4855,19 +4855,19 @@  discard block
 block discarded – undo
4855 4855
 	while (
4856 4856
 		$tortoise
4857 4857
 	&&
4858
-		( $evanescent_hare = isset( $override[$hare] ) ? $override[$hare] : call_user_func_array( $callback, array_merge( array( $hare ), $callback_args ) ) )
4858
+		($evanescent_hare = isset($override[$hare]) ? $override[$hare] : call_user_func_array($callback, array_merge(array($hare), $callback_args)))
4859 4859
 	&&
4860
-		( $hare = isset( $override[$evanescent_hare] ) ? $override[$evanescent_hare] : call_user_func_array( $callback, array_merge( array( $evanescent_hare ), $callback_args ) ) )
4860
+		($hare = isset($override[$evanescent_hare]) ? $override[$evanescent_hare] : call_user_func_array($callback, array_merge(array($evanescent_hare), $callback_args)))
4861 4861
 	) {
4862
-		if ( $_return_loop )
4862
+		if ($_return_loop)
4863 4863
 			$return[$tortoise] = $return[$evanescent_hare] = $return[$hare] = true;
4864 4864
 
4865 4865
 		// tortoise got lapped - must be a loop
4866
-		if ( $tortoise == $evanescent_hare || $tortoise == $hare )
4866
+		if ($tortoise == $evanescent_hare || $tortoise == $hare)
4867 4867
 			return $_return_loop ? $return : $tortoise;
4868 4868
 
4869 4869
 		// Increment tortoise by one step
4870
-		$tortoise = isset( $override[$tortoise] ) ? $override[$tortoise] : call_user_func_array( $callback, array_merge( array( $tortoise ), $callback_args ) );
4870
+		$tortoise = isset($override[$tortoise]) ? $override[$tortoise] : call_user_func_array($callback, array_merge(array($tortoise), $callback_args));
4871 4871
 	}
4872 4872
 
4873 4873
 	return false;
@@ -4881,7 +4881,7 @@  discard block
 block discarded – undo
4881 4881
  * @see https://developer.mozilla.org/en/the_x-frame-options_response_header
4882 4882
  */
4883 4883
 function send_frame_options_header() {
4884
-	@header( 'X-Frame-Options: SAMEORIGIN' );
4884
+	@header('X-Frame-Options: SAMEORIGIN');
4885 4885
 }
4886 4886
 
4887 4887
 /**
@@ -4902,8 +4902,8 @@  discard block
 block discarded – undo
4902 4902
 function wp_allowed_protocols() {
4903 4903
 	static $protocols = array();
4904 4904
 
4905
-	if ( empty( $protocols ) ) {
4906
-		$protocols = array( 'http', 'https', 'ftp', 'ftps', 'mailto', 'news', 'irc', 'gopher', 'nntp', 'feed', 'telnet', 'mms', 'rtsp', 'svn', 'tel', 'fax', 'xmpp', 'webcal' );
4905
+	if (empty($protocols)) {
4906
+		$protocols = array('http', 'https', 'ftp', 'ftps', 'mailto', 'news', 'irc', 'gopher', 'nntp', 'feed', 'telnet', 'mms', 'rtsp', 'svn', 'tel', 'fax', 'xmpp', 'webcal');
4907 4907
 
4908 4908
 		/**
4909 4909
 		 * Filters the list of protocols allowed in HTML attributes.
@@ -4912,7 +4912,7 @@  discard block
 block discarded – undo
4912 4912
 		 *
4913 4913
 		 * @param array $protocols Array of allowed protocols e.g. 'http', 'ftp', 'tel', and more.
4914 4914
 		 */
4915
-		$protocols = apply_filters( 'kses_allowed_protocols', $protocols );
4915
+		$protocols = apply_filters('kses_allowed_protocols', $protocols);
4916 4916
 	}
4917 4917
 
4918 4918
 	return $protocols;
@@ -4935,36 +4935,36 @@  discard block
 block discarded – undo
4935 4935
  * @return string|array Either a string containing a reversed comma separated trace or an array
4936 4936
  *                      of individual calls.
4937 4937
  */
4938
-function wp_debug_backtrace_summary( $ignore_class = null, $skip_frames = 0, $pretty = true ) {
4939
-	if ( version_compare( PHP_VERSION, '5.2.5', '>=' ) )
4940
-		$trace = debug_backtrace( false );
4938
+function wp_debug_backtrace_summary($ignore_class = null, $skip_frames = 0, $pretty = true) {
4939
+	if (version_compare(PHP_VERSION, '5.2.5', '>='))
4940
+		$trace = debug_backtrace(false);
4941 4941
 	else
4942 4942
 		$trace = debug_backtrace();
4943 4943
 
4944 4944
 	$caller = array();
4945
-	$check_class = ! is_null( $ignore_class );
4945
+	$check_class = ! is_null($ignore_class);
4946 4946
 	$skip_frames++; // skip this function
4947 4947
 
4948
-	foreach ( $trace as $call ) {
4949
-		if ( $skip_frames > 0 ) {
4948
+	foreach ($trace as $call) {
4949
+		if ($skip_frames > 0) {
4950 4950
 			$skip_frames--;
4951
-		} elseif ( isset( $call['class'] ) ) {
4952
-			if ( $check_class && $ignore_class == $call['class'] )
4951
+		} elseif (isset($call['class'])) {
4952
+			if ($check_class && $ignore_class == $call['class'])
4953 4953
 				continue; // Filter out calls
4954 4954
 
4955 4955
 			$caller[] = "{$call['class']}{$call['type']}{$call['function']}";
4956 4956
 		} else {
4957
-			if ( in_array( $call['function'], array( 'do_action', 'apply_filters' ) ) ) {
4957
+			if (in_array($call['function'], array('do_action', 'apply_filters'))) {
4958 4958
 				$caller[] = "{$call['function']}('{$call['args'][0]}')";
4959
-			} elseif ( in_array( $call['function'], array( 'include', 'include_once', 'require', 'require_once' ) ) ) {
4960
-				$caller[] = $call['function'] . "('" . str_replace( array( WP_CONTENT_DIR, ABSPATH ) , '', $call['args'][0] ) . "')";
4959
+			} elseif (in_array($call['function'], array('include', 'include_once', 'require', 'require_once'))) {
4960
+				$caller[] = $call['function']."('".str_replace(array(WP_CONTENT_DIR, ABSPATH), '', $call['args'][0])."')";
4961 4961
 			} else {
4962 4962
 				$caller[] = $call['function'];
4963 4963
 			}
4964 4964
 		}
4965 4965
 	}
4966
-	if ( $pretty )
4967
-		return join( ', ', array_reverse( $caller ) );
4966
+	if ($pretty)
4967
+		return join(', ', array_reverse($caller));
4968 4968
 	else
4969 4969
 		return $caller;
4970 4970
 }
@@ -4980,11 +4980,11 @@  discard block
 block discarded – undo
4980 4980
  *
4981 4981
  * @return array List of ids not present in the cache.
4982 4982
  */
4983
-function _get_non_cached_ids( $object_ids, $cache_key ) {
4983
+function _get_non_cached_ids($object_ids, $cache_key) {
4984 4984
 	$clean = array();
4985
-	foreach ( $object_ids as $id ) {
4985
+	foreach ($object_ids as $id) {
4986 4986
 		$id = (int) $id;
4987
-		if ( !wp_cache_get( $id, $cache_key ) ) {
4987
+		if ( ! wp_cache_get($id, $cache_key)) {
4988 4988
 			$clean[] = $id;
4989 4989
 		}
4990 4990
 	}
@@ -5001,15 +5001,15 @@  discard block
 block discarded – undo
5001 5001
  * @return bool Whether the device is able to upload files.
5002 5002
  */
5003 5003
 function _device_can_upload() {
5004
-	if ( ! wp_is_mobile() )
5004
+	if ( ! wp_is_mobile())
5005 5005
 		return true;
5006 5006
 
5007 5007
 	$ua = $_SERVER['HTTP_USER_AGENT'];
5008 5008
 
5009
-	if ( strpos($ua, 'iPhone') !== false
5009
+	if (strpos($ua, 'iPhone') !== false
5010 5010
 		|| strpos($ua, 'iPad') !== false
5011
-		|| strpos($ua, 'iPod') !== false ) {
5012
-			return preg_match( '#OS ([\d_]+) like Mac OS X#', $ua, $version ) && version_compare( $version[1], '6', '>=' );
5011
+		|| strpos($ua, 'iPod') !== false) {
5012
+			return preg_match('#OS ([\d_]+) like Mac OS X#', $ua, $version) && version_compare($version[1], '6', '>=');
5013 5013
 	}
5014 5014
 
5015 5015
 	return true;
@@ -5021,11 +5021,11 @@  discard block
 block discarded – undo
5021 5021
  * @param string $path The resource path or URL.
5022 5022
  * @return bool True if the path is a stream URL.
5023 5023
  */
5024
-function wp_is_stream( $path ) {
5024
+function wp_is_stream($path) {
5025 5025
 	$wrappers = stream_get_wrappers();
5026
-	$wrappers_re = '(' . join('|', $wrappers) . ')';
5026
+	$wrappers_re = '('.join('|', $wrappers).')';
5027 5027
 
5028
-	return preg_match( "!^$wrappers_re://!", $path ) === 1;
5028
+	return preg_match("!^$wrappers_re://!", $path) === 1;
5029 5029
 }
5030 5030
 
5031 5031
 /**
@@ -5041,7 +5041,7 @@  discard block
 block discarded – undo
5041 5041
  * @param  string $source_date The date to filter.
5042 5042
  * @return bool True if valid date, false if not valid date.
5043 5043
  */
5044
-function wp_checkdate( $month, $day, $year, $source_date ) {
5044
+function wp_checkdate($month, $day, $year, $source_date) {
5045 5045
 	/**
5046 5046
 	 * Filters whether the given date is valid for the Gregorian calendar.
5047 5047
 	 *
@@ -5050,7 +5050,7 @@  discard block
 block discarded – undo
5050 5050
 	 * @param bool   $checkdate   Whether the given date is valid.
5051 5051
 	 * @param string $source_date Date to check.
5052 5052
 	 */
5053
-	return apply_filters( 'wp_checkdate', checkdate( $month, $day, $year ), $source_date );
5053
+	return apply_filters('wp_checkdate', checkdate($month, $day, $year), $source_date);
5054 5054
 }
5055 5055
 
5056 5056
 /**
@@ -5065,15 +5065,15 @@  discard block
 block discarded – undo
5065 5065
  * @since 3.6.0
5066 5066
  */
5067 5067
 function wp_auth_check_load() {
5068
-	if ( ! is_admin() && ! is_user_logged_in() )
5068
+	if ( ! is_admin() && ! is_user_logged_in())
5069 5069
 		return;
5070 5070
 
5071
-	if ( defined( 'IFRAME_REQUEST' ) )
5071
+	if (defined('IFRAME_REQUEST'))
5072 5072
 		return;
5073 5073
 
5074 5074
 	$screen = get_current_screen();
5075
-	$hidden = array( 'update', 'update-network', 'update-core', 'update-core-network', 'upgrade', 'upgrade-network', 'network' );
5076
-	$show = ! in_array( $screen->id, $hidden );
5075
+	$hidden = array('update', 'update-network', 'update-core', 'update-core-network', 'upgrade', 'upgrade-network', 'network');
5076
+	$show = ! in_array($screen->id, $hidden);
5077 5077
 
5078 5078
 	/**
5079 5079
 	 * Filters whether to load the authentication check.
@@ -5086,12 +5086,12 @@  discard block
 block discarded – undo
5086 5086
 	 * @param bool      $show   Whether to load the authentication check.
5087 5087
 	 * @param WP_Screen $screen The current screen object.
5088 5088
 	 */
5089
-	if ( apply_filters( 'wp_auth_check_load', $show, $screen ) ) {
5090
-		wp_enqueue_style( 'wp-auth-check' );
5091
-		wp_enqueue_script( 'wp-auth-check' );
5089
+	if (apply_filters('wp_auth_check_load', $show, $screen)) {
5090
+		wp_enqueue_style('wp-auth-check');
5091
+		wp_enqueue_script('wp-auth-check');
5092 5092
 
5093
-		add_action( 'admin_print_footer_scripts', 'wp_auth_check_html', 5 );
5094
-		add_action( 'wp_print_footer_scripts', 'wp_auth_check_html', 5 );
5093
+		add_action('admin_print_footer_scripts', 'wp_auth_check_html', 5);
5094
+		add_action('wp_print_footer_scripts', 'wp_auth_check_html', 5);
5095 5095
 	}
5096 5096
 }
5097 5097
 
@@ -5102,8 +5102,8 @@  discard block
 block discarded – undo
5102 5102
  */
5103 5103
 function wp_auth_check_html() {
5104 5104
 	$login_url = wp_login_url();
5105
-	$current_domain = ( is_ssl() ? 'https://' : 'http://' ) . $_SERVER['HTTP_HOST'];
5106
-	$same_domain = ( strpos( $login_url, $current_domain ) === 0 );
5105
+	$current_domain = (is_ssl() ? 'https://' : 'http://').$_SERVER['HTTP_HOST'];
5106
+	$same_domain = (strpos($login_url, $current_domain) === 0);
5107 5107
 
5108 5108
 	/**
5109 5109
 	 * Filters whether the authentication check originated at the same domain.
@@ -5112,26 +5112,26 @@  discard block
 block discarded – undo
5112 5112
 	 *
5113 5113
 	 * @param bool $same_domain Whether the authentication check originated at the same domain.
5114 5114
 	 */
5115
-	$same_domain = apply_filters( 'wp_auth_check_same_domain', $same_domain );
5115
+	$same_domain = apply_filters('wp_auth_check_same_domain', $same_domain);
5116 5116
 	$wrap_class = $same_domain ? 'hidden' : 'hidden fallback';
5117 5117
 
5118 5118
 	?>
5119 5119
 	<div id="wp-auth-check-wrap" class="<?php echo $wrap_class; ?>">
5120 5120
 	<div id="wp-auth-check-bg"></div>
5121 5121
 	<div id="wp-auth-check">
5122
-	<button type="button" class="wp-auth-check-close button-link"><span class="screen-reader-text"><?php _e( 'Close dialog' ); ?></span></button>
5122
+	<button type="button" class="wp-auth-check-close button-link"><span class="screen-reader-text"><?php _e('Close dialog'); ?></span></button>
5123 5123
 	<?php
5124 5124
 
5125
-	if ( $same_domain ) {
5125
+	if ($same_domain) {
5126 5126
 		?>
5127
-		<div id="wp-auth-check-form" class="loading" data-src="<?php echo esc_url( add_query_arg( array( 'interim-login' => 1 ), $login_url ) ); ?>"></div>
5127
+		<div id="wp-auth-check-form" class="loading" data-src="<?php echo esc_url(add_query_arg(array('interim-login' => 1), $login_url)); ?>"></div>
5128 5128
 		<?php
5129 5129
 	}
5130 5130
 
5131 5131
 	?>
5132 5132
 	<div class="wp-auth-fallback">
5133 5133
 		<p><b class="wp-auth-fallback-expired" tabindex="0"><?php _e('Session expired'); ?></b></p>
5134
-		<p><a href="<?php echo esc_url( $login_url ); ?>" target="_blank"><?php _e('Please log in again.'); ?></a>
5134
+		<p><a href="<?php echo esc_url($login_url); ?>" target="_blank"><?php _e('Please log in again.'); ?></a>
5135 5135
 		<?php _e('The login page will open in a new window. After logging in you can close it and return to this page.'); ?></p>
5136 5136
 	</div>
5137 5137
 	</div>
@@ -5152,8 +5152,8 @@  discard block
 block discarded – undo
5152 5152
  * @param array $response  The Heartbeat response.
5153 5153
  * @return array $response The Heartbeat response with 'wp-auth-check' value set.
5154 5154
  */
5155
-function wp_auth_check( $response ) {
5156
-	$response['wp-auth-check'] = is_user_logged_in() && empty( $GLOBALS['login_grace_period'] );
5155
+function wp_auth_check($response) {
5156
+	$response['wp-auth-check'] = is_user_logged_in() && empty($GLOBALS['login_grace_period']);
5157 5157
 	return $response;
5158 5158
 }
5159 5159
 
@@ -5173,10 +5173,10 @@  discard block
 block discarded – undo
5173 5173
  * @param string $tag An HTML tag name. Example: 'video'.
5174 5174
  * @return string Tag RegEx.
5175 5175
  */
5176
-function get_tag_regex( $tag ) {
5177
-	if ( empty( $tag ) )
5176
+function get_tag_regex($tag) {
5177
+	if (empty($tag))
5178 5178
 		return;
5179
-	return sprintf( '<%1$s[^<]*(?:>[\s\S]*<\/%1$s>|\s*\/>)', tag_escape( $tag ) );
5179
+	return sprintf('<%1$s[^<]*(?:>[\s\S]*<\/%1$s>|\s*\/>)', tag_escape($tag));
5180 5180
 }
5181 5181
 
5182 5182
 /**
@@ -5191,13 +5191,13 @@  discard block
 block discarded – undo
5191 5191
  * @param string $charset A charset name.
5192 5192
  * @return string The canonical form of the charset.
5193 5193
  */
5194
-function _canonical_charset( $charset ) {
5195
-	if ( 'UTF-8' === $charset || 'utf-8' === $charset || 'utf8' === $charset ||
5196
-		'UTF8' === $charset )
5194
+function _canonical_charset($charset) {
5195
+	if ('UTF-8' === $charset || 'utf-8' === $charset || 'utf8' === $charset ||
5196
+		'UTF8' === $charset)
5197 5197
 		return 'UTF-8';
5198 5198
 
5199
-	if ( 'ISO-8859-1' === $charset || 'iso-8859-1' === $charset ||
5200
-		'iso8859-1' === $charset || 'ISO8859-1' === $charset )
5199
+	if ('ISO-8859-1' === $charset || 'iso-8859-1' === $charset ||
5200
+		'iso8859-1' === $charset || 'ISO8859-1' === $charset)
5201 5201
 		return 'ISO-8859-1';
5202 5202
 
5203 5203
 	return $charset;
@@ -5229,25 +5229,25 @@  discard block
 block discarded – undo
5229 5229
  * @param bool $reset Optional. Whether to reset the encoding back to a previously-set encoding.
5230 5230
  *                    Default false.
5231 5231
  */
5232
-function mbstring_binary_safe_encoding( $reset = false ) {
5232
+function mbstring_binary_safe_encoding($reset = false) {
5233 5233
 	static $encodings = array();
5234 5234
 	static $overloaded = null;
5235 5235
 
5236
-	if ( is_null( $overloaded ) )
5237
-		$overloaded = function_exists( 'mb_internal_encoding' ) && ( ini_get( 'mbstring.func_overload' ) & 2 );
5236
+	if (is_null($overloaded))
5237
+		$overloaded = function_exists('mb_internal_encoding') && (ini_get('mbstring.func_overload') & 2);
5238 5238
 
5239
-	if ( false === $overloaded )
5239
+	if (false === $overloaded)
5240 5240
 		return;
5241 5241
 
5242
-	if ( ! $reset ) {
5242
+	if ( ! $reset) {
5243 5243
 		$encoding = mb_internal_encoding();
5244
-		array_push( $encodings, $encoding );
5245
-		mb_internal_encoding( 'ISO-8859-1' );
5244
+		array_push($encodings, $encoding);
5245
+		mb_internal_encoding('ISO-8859-1');
5246 5246
 	}
5247 5247
 
5248
-	if ( $reset && $encodings ) {
5249
-		$encoding = array_pop( $encodings );
5250
-		mb_internal_encoding( $encoding );
5248
+	if ($reset && $encodings) {
5249
+		$encoding = array_pop($encodings);
5250
+		mb_internal_encoding($encoding);
5251 5251
 	}
5252 5252
 }
5253 5253
 
@@ -5259,7 +5259,7 @@  discard block
 block discarded – undo
5259 5259
  * @since 3.7.0
5260 5260
  */
5261 5261
 function reset_mbstring_encoding() {
5262
-	mbstring_binary_safe_encoding( true );
5262
+	mbstring_binary_safe_encoding(true);
5263 5263
 }
5264 5264
 
5265 5265
 /**
@@ -5272,12 +5272,12 @@  discard block
 block discarded – undo
5272 5272
  * @param mixed $var Boolean value to validate.
5273 5273
  * @return bool Whether the value is validated.
5274 5274
  */
5275
-function wp_validate_boolean( $var ) {
5276
-	if ( is_bool( $var ) ) {
5275
+function wp_validate_boolean($var) {
5276
+	if (is_bool($var)) {
5277 5277
 		return $var;
5278 5278
 	}
5279 5279
 
5280
-	if ( is_string( $var ) && 'false' === strtolower( $var ) ) {
5280
+	if (is_string($var) && 'false' === strtolower($var)) {
5281 5281
 		return false;
5282 5282
 	}
5283 5283
 
@@ -5291,7 +5291,7 @@  discard block
 block discarded – undo
5291 5291
  *
5292 5292
  * @param string $file The path to the file to delete.
5293 5293
  */
5294
-function wp_delete_file( $file ) {
5294
+function wp_delete_file($file) {
5295 5295
 	/**
5296 5296
 	 * Filters the path of the file to delete.
5297 5297
 	 *
@@ -5299,9 +5299,9 @@  discard block
 block discarded – undo
5299 5299
 	 *
5300 5300
 	 * @param string $medium Path to the file to delete.
5301 5301
 	 */
5302
-	$delete = apply_filters( 'wp_delete_file', $file );
5303
-	if ( ! empty( $delete ) ) {
5304
-		@unlink( $delete );
5302
+	$delete = apply_filters('wp_delete_file', $file);
5303
+	if ( ! empty($delete)) {
5304
+		@unlink($delete);
5305 5305
 	}
5306 5306
 }
5307 5307
 
@@ -5315,12 +5315,12 @@  discard block
 block discarded – undo
5315 5315
 function wp_post_preview_js() {
5316 5316
 	global $post;
5317 5317
 
5318
-	if ( ! is_preview() || empty( $post ) ) {
5318
+	if ( ! is_preview() || empty($post)) {
5319 5319
 		return;
5320 5320
 	}
5321 5321
 
5322 5322
 	// Has to match the window name used in post_submit_meta_box()
5323
-	$name = 'wp-preview-' . (int) $post->ID;
5323
+	$name = 'wp-preview-'.(int) $post->ID;
5324 5324
 
5325 5325
 	?>
5326 5326
 	<script>
@@ -5350,11 +5350,11 @@  discard block
 block discarded – undo
5350 5350
  * @param string $date_string Date string to parse and format.
5351 5351
  * @return string Date formatted for ISO8601/RFC3339.
5352 5352
  */
5353
-function mysql_to_rfc3339( $date_string ) {
5354
-	$formatted = mysql2date( 'c', $date_string, false );
5353
+function mysql_to_rfc3339($date_string) {
5354
+	$formatted = mysql2date('c', $date_string, false);
5355 5355
 
5356 5356
 	// Strip timezone information
5357
-	return preg_replace( '/(?:Z|[+-]\d{2}(?::\d{2})?)$/', '', $formatted );
5357
+	return preg_replace('/(?:Z|[+-]\d{2}(?::\d{2})?)$/', '', $formatted);
5358 5358
 }
5359 5359
 
5360 5360
 /**
@@ -5370,24 +5370,24 @@  discard block
 block discarded – undo
5370 5370
  *                        invoked. Default 'admin'.
5371 5371
  * @return bool|int|string The limit that was set or false on failure.
5372 5372
  */
5373
-function wp_raise_memory_limit( $context = 'admin' ) {
5373
+function wp_raise_memory_limit($context = 'admin') {
5374 5374
 	// Exit early if the limit cannot be changed.
5375
-	if ( false === wp_is_ini_value_changeable( 'memory_limit' ) ) {
5375
+	if (false === wp_is_ini_value_changeable('memory_limit')) {
5376 5376
 		return false;
5377 5377
 	}
5378 5378
 
5379
-	$current_limit     = @ini_get( 'memory_limit' );
5380
-	$current_limit_int = wp_convert_hr_to_bytes( $current_limit );
5379
+	$current_limit     = @ini_get('memory_limit');
5380
+	$current_limit_int = wp_convert_hr_to_bytes($current_limit);
5381 5381
 
5382 5382
 	if ( -1 === $current_limit_int ) {
5383 5383
 		return false;
5384 5384
 	}
5385 5385
 
5386 5386
 	$wp_max_limit     = WP_MAX_MEMORY_LIMIT;
5387
-	$wp_max_limit_int = wp_convert_hr_to_bytes( $wp_max_limit );
5387
+	$wp_max_limit_int = wp_convert_hr_to_bytes($wp_max_limit);
5388 5388
 	$filtered_limit   = $wp_max_limit;
5389 5389
 
5390
-	switch ( $context ) {
5390
+	switch ($context) {
5391 5391
 		case 'admin':
5392 5392
 			/**
5393 5393
 			 * Filters the maximum memory limit available for administration screens.
@@ -5407,7 +5407,7 @@  discard block
 block discarded – undo
5407 5407
 			 * @param int|string $filtered_limit The maximum WordPress memory limit. Accepts an integer
5408 5408
 			 *                                   (bytes), or a shorthand string notation, such as '256M'.
5409 5409
 			 */
5410
-			$filtered_limit = apply_filters( 'admin_memory_limit', $filtered_limit );
5410
+			$filtered_limit = apply_filters('admin_memory_limit', $filtered_limit);
5411 5411
 			break;
5412 5412
 
5413 5413
 		case 'image':
@@ -5423,7 +5423,7 @@  discard block
 block discarded – undo
5423 5423
 			 *                                   Accepts an integer (bytes), or a shorthand string
5424 5424
 			 *                                   notation, such as '256M'.
5425 5425
 			 */
5426
-			$filtered_limit = apply_filters( 'image_memory_limit', $filtered_limit );
5426
+			$filtered_limit = apply_filters('image_memory_limit', $filtered_limit);
5427 5427
 			break;
5428 5428
 
5429 5429
 		default:
@@ -5441,20 +5441,20 @@  discard block
 block discarded – undo
5441 5441
 			 *                                   whichever is higher. Accepts an integer (bytes), or a
5442 5442
 			 *                                   shorthand string notation, such as '256M'.
5443 5443
 			 */
5444
-			$filtered_limit = apply_filters( "{$context}_memory_limit", $filtered_limit );
5444
+			$filtered_limit = apply_filters("{$context}_memory_limit", $filtered_limit);
5445 5445
 			break;
5446 5446
 	}
5447 5447
 
5448
-	$filtered_limit_int = wp_convert_hr_to_bytes( $filtered_limit );
5448
+	$filtered_limit_int = wp_convert_hr_to_bytes($filtered_limit);
5449 5449
 
5450
-	if ( -1 === $filtered_limit_int || ( $filtered_limit_int > $wp_max_limit_int && $filtered_limit_int > $current_limit_int ) ) {
5451
-		if ( false !== @ini_set( 'memory_limit', $filtered_limit ) ) {
5450
+	if ( -1 === $filtered_limit_int || ($filtered_limit_int > $wp_max_limit_int && $filtered_limit_int > $current_limit_int) ) {
5451
+		if (false !== @ini_set('memory_limit', $filtered_limit)) {
5452 5452
 			return $filtered_limit;
5453 5453
 		} else {
5454 5454
 			return false;
5455 5455
 		}
5456 5456
 	} elseif ( -1 === $wp_max_limit_int || $wp_max_limit_int > $current_limit_int ) {
5457
-		if ( false !== @ini_set( 'memory_limit', $wp_max_limit ) ) {
5457
+		if (false !== @ini_set('memory_limit', $wp_max_limit)) {
5458 5458
 			return $wp_max_limit;
5459 5459
 		} else {
5460 5460
 			return false;
Please login to merge, or discard this patch.
Braces   +516 added lines, -365 removed lines patch added patch discarded remove patch
@@ -24,22 +24,26 @@  discard block
 block discarded – undo
24 24
  * @return string|int|bool Formatted date string or Unix timestamp. False if $date is empty.
25 25
  */
26 26
 function mysql2date( $format, $date, $translate = true ) {
27
-	if ( empty( $date ) )
28
-		return false;
27
+	if ( empty( $date ) ) {
28
+			return false;
29
+	}
29 30
 
30
-	if ( 'G' == $format )
31
-		return strtotime( $date . ' +0000' );
31
+	if ( 'G' == $format ) {
32
+			return strtotime( $date . ' +0000' );
33
+	}
32 34
 
33 35
 	$i = strtotime( $date );
34 36
 
35
-	if ( 'U' == $format )
36
-		return $i;
37
+	if ( 'U' == $format ) {
38
+			return $i;
39
+	}
37 40
 
38
-	if ( $translate )
39
-		return date_i18n( $format, $i );
40
-	else
41
-		return date( $format, $i );
42
-}
41
+	if ( $translate ) {
42
+			return date_i18n( $format, $i );
43
+	} else {
44
+			return date( $format, $i );
45
+	}
46
+	}
43 47
 
44 48
 /**
45 49
  * Retrieve the current time based on specified type.
@@ -91,10 +95,11 @@  discard block
 block discarded – undo
91 95
 	$i = $unixtimestamp;
92 96
 
93 97
 	if ( false === $i ) {
94
-		if ( ! $gmt )
95
-			$i = current_time( 'timestamp' );
96
-		else
97
-			$i = time();
98
+		if ( ! $gmt ) {
99
+					$i = current_time( 'timestamp' );
100
+		} else {
101
+					$i = time();
102
+		}
98 103
 		// we should not let date() interfere with our
99 104
 		// specially computed timestamp
100 105
 		$gmt = true;
@@ -306,11 +311,13 @@  discard block
 block discarded – undo
306 311
 	// The day of the week from the timestamp.
307 312
 	$weekday = date( 'w', $day );
308 313
 
309
-	if ( !is_numeric($start_of_week) )
310
-		$start_of_week = get_option( 'start_of_week' );
314
+	if ( !is_numeric($start_of_week) ) {
315
+			$start_of_week = get_option( 'start_of_week' );
316
+	}
311 317
 
312
-	if ( $weekday < $start_of_week )
313
-		$weekday += 7;
318
+	if ( $weekday < $start_of_week ) {
319
+			$weekday += 7;
320
+	}
314 321
 
315 322
 	// The most recent week start day on or before $day.
316 323
 	$start = $day - DAY_IN_SECONDS * ( $weekday - $start_of_week );
@@ -329,8 +336,10 @@  discard block
 block discarded – undo
329 336
  * @return mixed Unserialized data can be any type.
330 337
  */
331 338
 function maybe_unserialize( $original ) {
332
-	if ( is_serialized( $original ) ) // don't attempt to unserialize data that wasn't serialized going in
339
+	if ( is_serialized( $original ) ) {
340
+		// don't attempt to unserialize data that wasn't serialized going in
333 341
 		return @unserialize( $original );
342
+	}
334 343
 	return $original;
335 344
 }
336 345
 
@@ -370,13 +379,16 @@  discard block
 block discarded – undo
370 379
 		$semicolon = strpos( $data, ';' );
371 380
 		$brace     = strpos( $data, '}' );
372 381
 		// Either ; or } must exist.
373
-		if ( false === $semicolon && false === $brace )
374
-			return false;
382
+		if ( false === $semicolon && false === $brace ) {
383
+					return false;
384
+		}
375 385
 		// But neither must be in the first X characters.
376
-		if ( false !== $semicolon && $semicolon < 3 )
377
-			return false;
378
-		if ( false !== $brace && $brace < 4 )
379
-			return false;
386
+		if ( false !== $semicolon && $semicolon < 3 ) {
387
+					return false;
388
+		}
389
+		if ( false !== $brace && $brace < 4 ) {
390
+					return false;
391
+		}
380 392
 	}
381 393
 	$token = $data[0];
382 394
 	switch ( $token ) {
@@ -439,14 +451,16 @@  discard block
 block discarded – undo
439 451
  * @return mixed A scalar data
440 452
  */
441 453
 function maybe_serialize( $data ) {
442
-	if ( is_array( $data ) || is_object( $data ) )
443
-		return serialize( $data );
454
+	if ( is_array( $data ) || is_object( $data ) ) {
455
+			return serialize( $data );
456
+	}
444 457
 
445 458
 	// Double serialization is required for backward compatibility.
446 459
 	// See https://core.trac.wordpress.org/ticket/12930
447 460
 	// Also the world will end. See WP 3.6.1.
448
-	if ( is_serialized( $data, false ) )
449
-		return serialize( $data );
461
+	if ( is_serialized( $data, false ) ) {
462
+			return serialize( $data );
463
+	}
450 464
 
451 465
 	return $data;
452 466
 }
@@ -574,20 +588,23 @@  discard block
 block discarded – undo
574 588
 	foreach ( $pung as $link_test ) {
575 589
 		if ( ! in_array( $link_test, $post_links_temp ) ) { // link no longer in post
576 590
 			$mids = $wpdb->get_col( $wpdb->prepare("SELECT meta_id FROM $wpdb->postmeta WHERE post_id = %d AND meta_key = 'enclosure' AND meta_value LIKE %s", $post_ID, $wpdb->esc_like( $link_test ) . '%') );
577
-			foreach ( $mids as $mid )
578
-				delete_metadata_by_mid( 'post', $mid );
591
+			foreach ( $mids as $mid ) {
592
+							delete_metadata_by_mid( 'post', $mid );
593
+			}
579 594
 		}
580 595
 	}
581 596
 
582 597
 	foreach ( (array) $post_links_temp as $link_test ) {
583 598
 		if ( !in_array( $link_test, $pung ) ) { // If we haven't pung it already
584 599
 			$test = @parse_url( $link_test );
585
-			if ( false === $test )
586
-				continue;
587
-			if ( isset( $test['query'] ) )
588
-				$post_links[] = $link_test;
589
-			elseif ( isset($test['path']) && ( $test['path'] != '/' ) &&  ($test['path'] != '' ) )
590
-				$post_links[] = $link_test;
600
+			if ( false === $test ) {
601
+							continue;
602
+			}
603
+			if ( isset( $test['query'] ) ) {
604
+							$post_links[] = $link_test;
605
+			} elseif ( isset($test['path']) && ( $test['path'] != '/' ) &&  ($test['path'] != '' ) ) {
606
+							$post_links[] = $link_test;
607
+			}
591 608
 		}
592 609
 	}
593 610
 
@@ -645,13 +662,15 @@  discard block
 block discarded – undo
645 662
  * @return bool|string False on failure, headers on success.
646 663
  */
647 664
 function wp_get_http_headers( $url, $deprecated = false ) {
648
-	if ( !empty( $deprecated ) )
649
-		_deprecated_argument( __FUNCTION__, '2.7.0' );
665
+	if ( !empty( $deprecated ) ) {
666
+			_deprecated_argument( __FUNCTION__, '2.7.0' );
667
+	}
650 668
 
651 669
 	$response = wp_safe_remote_head( $url );
652 670
 
653
-	if ( is_wp_error( $response ) )
654
-		return false;
671
+	if ( is_wp_error( $response ) ) {
672
+			return false;
673
+	}
655 674
 
656 675
 	return wp_remote_retrieve_headers( $response );
657 676
 }
@@ -669,11 +688,12 @@  discard block
 block discarded – undo
669 688
  */
670 689
 function is_new_day() {
671 690
 	global $currentday, $previousday;
672
-	if ( $currentday != $previousday )
673
-		return 1;
674
-	else
675
-		return 0;
676
-}
691
+	if ( $currentday != $previousday ) {
692
+			return 1;
693
+	} else {
694
+			return 0;
695
+	}
696
+	}
677 697
 
678 698
 /**
679 699
  * Build URL query based on an associative and, or indexed array.
@@ -716,27 +736,33 @@  discard block
 block discarded – undo
716 736
 	$ret = array();
717 737
 
718 738
 	foreach ( (array) $data as $k => $v ) {
719
-		if ( $urlencode)
720
-			$k = urlencode($k);
721
-		if ( is_int($k) && $prefix != null )
722
-			$k = $prefix.$k;
723
-		if ( !empty($key) )
724
-			$k = $key . '%5B' . $k . '%5D';
725
-		if ( $v === null )
726
-			continue;
727
-		elseif ( $v === false )
728
-			$v = '0';
739
+		if ( $urlencode) {
740
+					$k = urlencode($k);
741
+		}
742
+		if ( is_int($k) && $prefix != null ) {
743
+					$k = $prefix.$k;
744
+		}
745
+		if ( !empty($key) ) {
746
+					$k = $key . '%5B' . $k . '%5D';
747
+		}
748
+		if ( $v === null ) {
749
+					continue;
750
+		} elseif ( $v === false ) {
751
+					$v = '0';
752
+		}
729 753
 
730
-		if ( is_array($v) || is_object($v) )
731
-			array_push($ret,_http_build_query($v, '', $sep, $k, $urlencode));
732
-		elseif ( $urlencode )
733
-			array_push($ret, $k.'='.urlencode($v));
734
-		else
735
-			array_push($ret, $k.'='.$v);
754
+		if ( is_array($v) || is_object($v) ) {
755
+					array_push($ret,_http_build_query($v, '', $sep, $k, $urlencode));
756
+		} elseif ( $urlencode ) {
757
+					array_push($ret, $k.'='.urlencode($v));
758
+		} else {
759
+					array_push($ret, $k.'='.$v);
760
+		}
736 761
 	}
737 762
 
738
-	if ( null === $sep )
739
-		$sep = ini_get('arg_separator.output');
763
+	if ( null === $sep ) {
764
+			$sep = ini_get('arg_separator.output');
765
+	}
740 766
 
741 767
 	return implode($sep, $ret);
742 768
 }
@@ -779,21 +805,24 @@  discard block
 block discarded – undo
779 805
 function add_query_arg() {
780 806
 	$args = func_get_args();
781 807
 	if ( is_array( $args[0] ) ) {
782
-		if ( count( $args ) < 2 || false === $args[1] )
783
-			$uri = $_SERVER['REQUEST_URI'];
784
-		else
785
-			$uri = $args[1];
808
+		if ( count( $args ) < 2 || false === $args[1] ) {
809
+					$uri = $_SERVER['REQUEST_URI'];
810
+		} else {
811
+					$uri = $args[1];
812
+		}
786 813
 	} else {
787
-		if ( count( $args ) < 3 || false === $args[2] )
788
-			$uri = $_SERVER['REQUEST_URI'];
789
-		else
790
-			$uri = $args[2];
814
+		if ( count( $args ) < 3 || false === $args[2] ) {
815
+					$uri = $_SERVER['REQUEST_URI'];
816
+		} else {
817
+					$uri = $args[2];
818
+		}
791 819
 	}
792 820
 
793
-	if ( $frag = strstr( $uri, '#' ) )
794
-		$uri = substr( $uri, 0, -strlen( $frag ) );
795
-	else
796
-		$frag = '';
821
+	if ( $frag = strstr( $uri, '#' ) ) {
822
+			$uri = substr( $uri, 0, -strlen( $frag ) );
823
+	} else {
824
+			$frag = '';
825
+	}
797 826
 
798 827
 	if ( 0 === stripos( $uri, 'http://' ) ) {
799 828
 		$protocol = 'http://';
@@ -827,8 +856,9 @@  discard block
 block discarded – undo
827 856
 	}
828 857
 
829 858
 	foreach ( $qs as $k => $v ) {
830
-		if ( $v === false )
831
-			unset( $qs[$k] );
859
+		if ( $v === false ) {
860
+					unset( $qs[$k] );
861
+		}
832 862
 	}
833 863
 
834 864
 	$ret = build_query( $qs );
@@ -850,8 +880,9 @@  discard block
 block discarded – undo
850 880
  */
851 881
 function remove_query_arg( $key, $query = false ) {
852 882
 	if ( is_array( $key ) ) { // removing multiple keys
853
-		foreach ( $key as $k )
854
-			$query = add_query_arg( $k, false, $query );
883
+		foreach ( $key as $k ) {
884
+					$query = add_query_arg( $k, false, $query );
885
+		}
855 886
 		return $query;
856 887
 	}
857 888
 	return add_query_arg( $key, false, $query );
@@ -933,16 +964,18 @@  discard block
 block discarded – undo
933 964
 function wp_remote_fopen( $uri ) {
934 965
 	$parsed_url = @parse_url( $uri );
935 966
 
936
-	if ( !$parsed_url || !is_array( $parsed_url ) )
937
-		return false;
967
+	if ( !$parsed_url || !is_array( $parsed_url ) ) {
968
+			return false;
969
+	}
938 970
 
939 971
 	$options = array();
940 972
 	$options['timeout'] = 10;
941 973
 
942 974
 	$response = wp_safe_remote_get( $uri, $options );
943 975
 
944
-	if ( is_wp_error( $response ) )
945
-		return false;
976
+	if ( is_wp_error( $response ) ) {
977
+			return false;
978
+	}
946 979
 
947 980
 	return wp_remote_retrieve_body( $response );
948 981
 }
@@ -962,9 +995,10 @@  discard block
 block discarded – undo
962 995
 	global $wp, $wp_query, $wp_the_query;
963 996
 	$wp->main( $query_vars );
964 997
 
965
-	if ( !isset($wp_the_query) )
966
-		$wp_the_query = $wp_query;
967
-}
998
+	if ( !isset($wp_the_query) ) {
999
+			$wp_the_query = $wp_query;
1000
+	}
1001
+	}
968 1002
 
969 1003
 /**
970 1004
  * Retrieve the description for the HTTP status.
@@ -1049,11 +1083,12 @@  discard block
 block discarded – undo
1049 1083
 		);
1050 1084
 	}
1051 1085
 
1052
-	if ( isset( $wp_header_to_desc[$code] ) )
1053
-		return $wp_header_to_desc[$code];
1054
-	else
1055
-		return '';
1056
-}
1086
+	if ( isset( $wp_header_to_desc[$code] ) ) {
1087
+			return $wp_header_to_desc[$code];
1088
+	} else {
1089
+			return '';
1090
+	}
1091
+	}
1057 1092
 
1058 1093
 /**
1059 1094
  * Set HTTP status header.
@@ -1077,8 +1112,8 @@  discard block
 block discarded – undo
1077 1112
 
1078 1113
 	$protocol = wp_get_server_protocol();
1079 1114
 	$status_header = "$protocol $code $description";
1080
-	if ( function_exists( 'apply_filters' ) )
1081
-
1115
+	if ( function_exists( 'apply_filters' ) ) {
1116
+	
1082 1117
 		/**
1083 1118
 		 * Filters an HTTP status header.
1084 1119
 		 *
@@ -1090,6 +1125,7 @@  discard block
 block discarded – undo
1090 1125
 		 * @param string $protocol      Server protocol.
1091 1126
 		 */
1092 1127
 		$status_header = apply_filters( 'status_header', $status_header, $code, $description, $protocol );
1128
+	}
1093 1129
 
1094 1130
 	@header( $status_header, true, $code );
1095 1131
 }
@@ -1161,9 +1197,10 @@  discard block
 block discarded – undo
1161 1197
 		}
1162 1198
 	}
1163 1199
 
1164
-	foreach ( $headers as $name => $field_value )
1165
-		@header("{$name}: {$field_value}");
1166
-}
1200
+	foreach ( $headers as $name => $field_value ) {
1201
+			@header("{$name}: {$field_value}");
1202
+	}
1203
+	}
1167 1204
 
1168 1205
 /**
1169 1206
  * Set the headers for caching for 10 days with JavaScript content type.
@@ -1226,8 +1263,9 @@  discard block
 block discarded – undo
1226 1263
 	// Remove the pad, if present.
1227 1264
 	$feed = preg_replace( '/^_+/', '', $feed );
1228 1265
 
1229
-	if ( $feed == '' || $feed == 'feed' )
1230
-		$feed = get_default_feed();
1266
+	if ( $feed == '' || $feed == 'feed' ) {
1267
+			$feed = get_default_feed();
1268
+	}
1231 1269
 
1232 1270
 	if ( ! has_action( "do_feed_{$feed}" ) ) {
1233 1271
 		wp_die( __( 'ERROR: This is not a valid feed template.' ), '', array( 'response' => 404 ) );
@@ -1280,11 +1318,12 @@  discard block
 block discarded – undo
1280 1318
  * @param bool $for_comments True for the comment feed, false for normal feed.
1281 1319
  */
1282 1320
 function do_feed_rss2( $for_comments ) {
1283
-	if ( $for_comments )
1284
-		load_template( ABSPATH . WPINC . '/feed-rss2-comments.php' );
1285
-	else
1286
-		load_template( ABSPATH . WPINC . '/feed-rss2.php' );
1287
-}
1321
+	if ( $for_comments ) {
1322
+			load_template( ABSPATH . WPINC . '/feed-rss2-comments.php' );
1323
+	} else {
1324
+			load_template( ABSPATH . WPINC . '/feed-rss2.php' );
1325
+	}
1326
+	}
1288 1327
 
1289 1328
 /**
1290 1329
  * Load either Atom comment feed or Atom posts feed.
@@ -1296,11 +1335,12 @@  discard block
 block discarded – undo
1296 1335
  * @param bool $for_comments True for the comment feed, false for normal feed.
1297 1336
  */
1298 1337
 function do_feed_atom( $for_comments ) {
1299
-	if ($for_comments)
1300
-		load_template( ABSPATH . WPINC . '/feed-atom-comments.php');
1301
-	else
1302
-		load_template( ABSPATH . WPINC . '/feed-atom.php' );
1303
-}
1338
+	if ($for_comments) {
1339
+			load_template( ABSPATH . WPINC . '/feed-atom-comments.php');
1340
+	} else {
1341
+			load_template( ABSPATH . WPINC . '/feed-atom.php' );
1342
+	}
1343
+	}
1304 1344
 
1305 1345
 /**
1306 1346
  * Display the robots.txt file content.
@@ -1364,29 +1404,33 @@  discard block
 block discarded – undo
1364 1404
 	 * Check cache first. If options table goes away and we have true
1365 1405
 	 * cached, oh well.
1366 1406
 	 */
1367
-	if ( wp_cache_get( 'is_blog_installed' ) )
1368
-		return true;
1407
+	if ( wp_cache_get( 'is_blog_installed' ) ) {
1408
+			return true;
1409
+	}
1369 1410
 
1370 1411
 	$suppress = $wpdb->suppress_errors();
1371 1412
 	if ( ! wp_installing() ) {
1372 1413
 		$alloptions = wp_load_alloptions();
1373 1414
 	}
1374 1415
 	// If siteurl is not set to autoload, check it specifically
1375
-	if ( !isset( $alloptions['siteurl'] ) )
1376
-		$installed = $wpdb->get_var( "SELECT option_value FROM $wpdb->options WHERE option_name = 'siteurl'" );
1377
-	else
1378
-		$installed = $alloptions['siteurl'];
1416
+	if ( !isset( $alloptions['siteurl'] ) ) {
1417
+			$installed = $wpdb->get_var( "SELECT option_value FROM $wpdb->options WHERE option_name = 'siteurl'" );
1418
+	} else {
1419
+			$installed = $alloptions['siteurl'];
1420
+	}
1379 1421
 	$wpdb->suppress_errors( $suppress );
1380 1422
 
1381 1423
 	$installed = !empty( $installed );
1382 1424
 	wp_cache_set( 'is_blog_installed', $installed );
1383 1425
 
1384
-	if ( $installed )
1385
-		return true;
1426
+	if ( $installed ) {
1427
+			return true;
1428
+	}
1386 1429
 
1387 1430
 	// If visiting repair.php, return true and let it take over.
1388
-	if ( defined( 'WP_REPAIRING' ) )
1389
-		return true;
1431
+	if ( defined( 'WP_REPAIRING' ) ) {
1432
+			return true;
1433
+	}
1390 1434
 
1391 1435
 	$suppress = $wpdb->suppress_errors();
1392 1436
 
@@ -1398,13 +1442,16 @@  discard block
 block discarded – undo
1398 1442
 	$wp_tables = $wpdb->tables();
1399 1443
 	foreach ( $wp_tables as $table ) {
1400 1444
 		// The existence of custom user tables shouldn't suggest an insane state or prevent a clean install.
1401
-		if ( defined( 'CUSTOM_USER_TABLE' ) && CUSTOM_USER_TABLE == $table )
1402
-			continue;
1403
-		if ( defined( 'CUSTOM_USER_META_TABLE' ) && CUSTOM_USER_META_TABLE == $table )
1404
-			continue;
1445
+		if ( defined( 'CUSTOM_USER_TABLE' ) && CUSTOM_USER_TABLE == $table ) {
1446
+					continue;
1447
+		}
1448
+		if ( defined( 'CUSTOM_USER_META_TABLE' ) && CUSTOM_USER_META_TABLE == $table ) {
1449
+					continue;
1450
+		}
1405 1451
 
1406
-		if ( ! $wpdb->get_results( "DESCRIBE $table;" ) )
1407
-			continue;
1452
+		if ( ! $wpdb->get_results( "DESCRIBE $table;" ) ) {
1453
+					continue;
1454
+		}
1408 1455
 
1409 1456
 		// One or more tables exist. We are insane.
1410 1457
 
@@ -1467,11 +1514,13 @@  discard block
 block discarded – undo
1467 1514
 	$name = esc_attr( $name );
1468 1515
 	$nonce_field = '<input type="hidden" id="' . $name . '" name="' . $name . '" value="' . wp_create_nonce( $action ) . '" />';
1469 1516
 
1470
-	if ( $referer )
1471
-		$nonce_field .= wp_referer_field( false );
1517
+	if ( $referer ) {
1518
+			$nonce_field .= wp_referer_field( false );
1519
+	}
1472 1520
 
1473
-	if ( $echo )
1474
-		echo $nonce_field;
1521
+	if ( $echo ) {
1522
+			echo $nonce_field;
1523
+	}
1475 1524
 
1476 1525
 	return $nonce_field;
1477 1526
 }
@@ -1490,8 +1539,9 @@  discard block
 block discarded – undo
1490 1539
 function wp_referer_field( $echo = true ) {
1491 1540
 	$referer_field = '<input type="hidden" name="_wp_http_referer" value="'. esc_attr( wp_unslash( $_SERVER['REQUEST_URI'] ) ) . '" />';
1492 1541
 
1493
-	if ( $echo )
1494
-		echo $referer_field;
1542
+	if ( $echo ) {
1543
+			echo $referer_field;
1544
+	}
1495 1545
 	return $referer_field;
1496 1546
 }
1497 1547
 
@@ -1514,8 +1564,9 @@  discard block
 block discarded – undo
1514 1564
 		$ref = 'previous' == $jump_back_to ? wp_get_referer() : wp_unslash( $_SERVER['REQUEST_URI'] );
1515 1565
 	}
1516 1566
 	$orig_referer_field = '<input type="hidden" name="_wp_original_http_referer" value="' . esc_attr( $ref ) . '" />';
1517
-	if ( $echo )
1518
-		echo $orig_referer_field;
1567
+	if ( $echo ) {
1568
+			echo $orig_referer_field;
1569
+	}
1519 1570
 	return $orig_referer_field;
1520 1571
 }
1521 1572
 
@@ -1569,8 +1620,9 @@  discard block
 block discarded – undo
1569 1620
  * @return string|false False if no original referer or original referer if set.
1570 1621
  */
1571 1622
 function wp_get_original_referer() {
1572
-	if ( ! empty( $_REQUEST['_wp_original_http_referer'] ) && function_exists( 'wp_validate_redirect' ) )
1573
-		return wp_validate_redirect( wp_unslash( $_REQUEST['_wp_original_http_referer'] ), false );
1623
+	if ( ! empty( $_REQUEST['_wp_original_http_referer'] ) && function_exists( 'wp_validate_redirect' ) ) {
1624
+			return wp_validate_redirect( wp_unslash( $_REQUEST['_wp_original_http_referer'] ), false );
1625
+	}
1574 1626
 	return false;
1575 1627
 }
1576 1628
 
@@ -1605,11 +1657,13 @@  discard block
 block discarded – undo
1605 1657
 	 * Use rtrim() instead of untrailingslashit to avoid formatting.php dependency.
1606 1658
 	 */
1607 1659
 	$target = rtrim($target, '/');
1608
-	if ( empty($target) )
1609
-		$target = '/';
1660
+	if ( empty($target) ) {
1661
+			$target = '/';
1662
+	}
1610 1663
 
1611
-	if ( file_exists( $target ) )
1612
-		return @is_dir( $target );
1664
+	if ( file_exists( $target ) ) {
1665
+			return @is_dir( $target );
1666
+	}
1613 1667
 
1614 1668
 	// We need to find the permissions of the parent folder that exists and inherit that.
1615 1669
 	$target_parent = dirname( $target );
@@ -1658,15 +1712,18 @@  discard block
 block discarded – undo
1658 1712
 	 * This is definitive if true but fails if $path does not exist or contains
1659 1713
 	 * a symbolic link.
1660 1714
 	 */
1661
-	if ( realpath($path) == $path )
1662
-		return true;
1715
+	if ( realpath($path) == $path ) {
1716
+			return true;
1717
+	}
1663 1718
 
1664
-	if ( strlen($path) == 0 || $path[0] == '.' )
1665
-		return false;
1719
+	if ( strlen($path) == 0 || $path[0] == '.' ) {
1720
+			return false;
1721
+	}
1666 1722
 
1667 1723
 	// Windows allows absolute paths like this.
1668
-	if ( preg_match('#^[a-zA-Z]:\\\\#', $path) )
1669
-		return true;
1724
+	if ( preg_match('#^[a-zA-Z]:\\\\#', $path) ) {
1725
+			return true;
1726
+	}
1670 1727
 
1671 1728
 	// A path starting with / or \ is absolute; anything else is relative.
1672 1729
 	return ( $path[0] == '/' || $path[0] == '\\' );
@@ -1685,8 +1742,9 @@  discard block
 block discarded – undo
1685 1742
  * @return string The path with the base or absolute path.
1686 1743
  */
1687 1744
 function path_join( $base, $path ) {
1688
-	if ( path_is_absolute($path) )
1689
-		return $path;
1745
+	if ( path_is_absolute($path) ) {
1746
+			return $path;
1747
+	}
1690 1748
 
1691 1749
 	return rtrim($base, '/') . '/' . ltrim($path, '/');
1692 1750
 }
@@ -1733,25 +1791,30 @@  discard block
 block discarded – undo
1733 1791
  */
1734 1792
 function get_temp_dir() {
1735 1793
 	static $temp = '';
1736
-	if ( defined('WP_TEMP_DIR') )
1737
-		return trailingslashit(WP_TEMP_DIR);
1794
+	if ( defined('WP_TEMP_DIR') ) {
1795
+			return trailingslashit(WP_TEMP_DIR);
1796
+	}
1738 1797
 
1739
-	if ( $temp )
1740
-		return trailingslashit( $temp );
1798
+	if ( $temp ) {
1799
+			return trailingslashit( $temp );
1800
+	}
1741 1801
 
1742 1802
 	if ( function_exists('sys_get_temp_dir') ) {
1743 1803
 		$temp = sys_get_temp_dir();
1744
-		if ( @is_dir( $temp ) && wp_is_writable( $temp ) )
1745
-			return trailingslashit( $temp );
1804
+		if ( @is_dir( $temp ) && wp_is_writable( $temp ) ) {
1805
+					return trailingslashit( $temp );
1806
+		}
1746 1807
 	}
1747 1808
 
1748 1809
 	$temp = ini_get('upload_tmp_dir');
1749
-	if ( @is_dir( $temp ) && wp_is_writable( $temp ) )
1750
-		return trailingslashit( $temp );
1810
+	if ( @is_dir( $temp ) && wp_is_writable( $temp ) ) {
1811
+			return trailingslashit( $temp );
1812
+	}
1751 1813
 
1752 1814
 	$temp = WP_CONTENT_DIR . '/';
1753
-	if ( is_dir( $temp ) && wp_is_writable( $temp ) )
1754
-		return $temp;
1815
+	if ( is_dir( $temp ) && wp_is_writable( $temp ) ) {
1816
+			return $temp;
1817
+	}
1755 1818
 
1756 1819
 	return '/tmp/';
1757 1820
 }
@@ -1770,11 +1833,12 @@  discard block
 block discarded – undo
1770 1833
  * @return bool Whether the path is writable.
1771 1834
  */
1772 1835
 function wp_is_writable( $path ) {
1773
-	if ( 'WIN' === strtoupper( substr( PHP_OS, 0, 3 ) ) )
1774
-		return win_is_writable( $path );
1775
-	else
1776
-		return @is_writable( $path );
1777
-}
1836
+	if ( 'WIN' === strtoupper( substr( PHP_OS, 0, 3 ) ) ) {
1837
+			return win_is_writable( $path );
1838
+	} else {
1839
+			return @is_writable( $path );
1840
+	}
1841
+	}
1778 1842
 
1779 1843
 /**
1780 1844
  * Workaround for Windows bug in is_writable() function
@@ -1802,11 +1866,13 @@  discard block
 block discarded – undo
1802 1866
 	// check tmp file for read/write capabilities
1803 1867
 	$should_delete_tmp_file = !file_exists( $path );
1804 1868
 	$f = @fopen( $path, 'a' );
1805
-	if ( $f === false )
1806
-		return false;
1869
+	if ( $f === false ) {
1870
+			return false;
1871
+	}
1807 1872
 	fclose( $f );
1808
-	if ( $should_delete_tmp_file )
1809
-		unlink( $path );
1873
+	if ( $should_delete_tmp_file ) {
1874
+			unlink( $path );
1875
+	}
1810 1876
 	return true;
1811 1877
 }
1812 1878
 
@@ -1927,10 +1993,11 @@  discard block
 block discarded – undo
1927 1993
 	}
1928 1994
 
1929 1995
 	if ( !$url = get_option( 'upload_url_path' ) ) {
1930
-		if ( empty($upload_path) || ( 'wp-content/uploads' == $upload_path ) || ( $upload_path == $dir ) )
1931
-			$url = WP_CONTENT_URL . '/uploads';
1932
-		else
1933
-			$url = trailingslashit( $siteurl ) . $upload_path;
1996
+		if ( empty($upload_path) || ( 'wp-content/uploads' == $upload_path ) || ( $upload_path == $dir ) ) {
1997
+					$url = WP_CONTENT_URL . '/uploads';
1998
+		} else {
1999
+					$url = trailingslashit( $siteurl ) . $upload_path;
2000
+		}
1934 2001
 	}
1935 2002
 
1936 2003
 	/*
@@ -1955,10 +2022,11 @@  discard block
 block discarded – undo
1955 2022
 			 * had wp-content/uploads for the main site.)
1956 2023
 			 */
1957 2024
 
1958
-			if ( defined( 'MULTISITE' ) )
1959
-				$ms_dir = '/sites/' . get_current_blog_id();
1960
-			else
1961
-				$ms_dir = '/' . get_current_blog_id();
2025
+			if ( defined( 'MULTISITE' ) ) {
2026
+							$ms_dir = '/sites/' . get_current_blog_id();
2027
+			} else {
2028
+							$ms_dir = '/' . get_current_blog_id();
2029
+			}
1962 2030
 
1963 2031
 			$dir .= $ms_dir;
1964 2032
 			$url .= $ms_dir;
@@ -1978,10 +2046,11 @@  discard block
 block discarded – undo
1978 2046
 			 * rewriting in multisite, the resulting URL is /files. (#WP22702 for background.)
1979 2047
 			 */
1980 2048
 
1981
-			if ( defined( 'BLOGUPLOADDIR' ) )
1982
-				$dir = untrailingslashit( BLOGUPLOADDIR );
1983
-			else
1984
-				$dir = ABSPATH . UPLOADS;
2049
+			if ( defined( 'BLOGUPLOADDIR' ) ) {
2050
+							$dir = untrailingslashit( BLOGUPLOADDIR );
2051
+			} else {
2052
+							$dir = ABSPATH . UPLOADS;
2053
+			}
1985 2054
 			$url = trailingslashit( $siteurl ) . 'files';
1986 2055
 		}
1987 2056
 	}
@@ -1992,8 +2061,9 @@  discard block
 block discarded – undo
1992 2061
 	$subdir = '';
1993 2062
 	if ( get_option( 'uploads_use_yearmonth_folders' ) ) {
1994 2063
 		// Generate the yearly and monthly dirs
1995
-		if ( !$time )
1996
-			$time = current_time( 'mysql' );
2064
+		if ( !$time ) {
2065
+					$time = current_time( 'mysql' );
2066
+		}
1997 2067
 		$y = substr( $time, 0, 4 );
1998 2068
 		$m = substr( $time, 5, 2 );
1999 2069
 		$subdir = "/$y/$m";
@@ -2039,8 +2109,9 @@  discard block
 block discarded – undo
2039 2109
 	$name = basename($filename, $ext);
2040 2110
 
2041 2111
 	// Edge case: if file is named '.ext', treat as an empty name.
2042
-	if ( $name === $ext )
2043
-		$name = '';
2112
+	if ( $name === $ext ) {
2113
+			$name = '';
2114
+	}
2044 2115
 
2045 2116
 	/*
2046 2117
 	 * Increment the file number until we have a unique file to save in $dir.
@@ -2114,20 +2185,24 @@  discard block
 block discarded – undo
2114 2185
  * @return array
2115 2186
  */
2116 2187
 function wp_upload_bits( $name, $deprecated, $bits, $time = null ) {
2117
-	if ( !empty( $deprecated ) )
2118
-		_deprecated_argument( __FUNCTION__, '2.0.0' );
2188
+	if ( !empty( $deprecated ) ) {
2189
+			_deprecated_argument( __FUNCTION__, '2.0.0' );
2190
+	}
2119 2191
 
2120
-	if ( empty( $name ) )
2121
-		return array( 'error' => __( 'Empty filename' ) );
2192
+	if ( empty( $name ) ) {
2193
+			return array( 'error' => __( 'Empty filename' ) );
2194
+	}
2122 2195
 
2123 2196
 	$wp_filetype = wp_check_filetype( $name );
2124
-	if ( ! $wp_filetype['ext'] && ! current_user_can( 'unfiltered_upload' ) )
2125
-		return array( 'error' => __( 'Invalid file type' ) );
2197
+	if ( ! $wp_filetype['ext'] && ! current_user_can( 'unfiltered_upload' ) ) {
2198
+			return array( 'error' => __( 'Invalid file type' ) );
2199
+	}
2126 2200
 
2127 2201
 	$upload = wp_upload_dir( $time );
2128 2202
 
2129
-	if ( $upload['error'] !== false )
2130
-		return $upload;
2203
+	if ( $upload['error'] !== false ) {
2204
+			return $upload;
2205
+	}
2131 2206
 
2132 2207
 	/**
2133 2208
 	 * Filters whether to treat the upload bits as an error.
@@ -2149,18 +2224,20 @@  discard block
 block discarded – undo
2149 2224
 
2150 2225
 	$new_file = $upload['path'] . "/$filename";
2151 2226
 	if ( ! wp_mkdir_p( dirname( $new_file ) ) ) {
2152
-		if ( 0 === strpos( $upload['basedir'], ABSPATH ) )
2153
-			$error_path = str_replace( ABSPATH, '', $upload['basedir'] ) . $upload['subdir'];
2154
-		else
2155
-			$error_path = basename( $upload['basedir'] ) . $upload['subdir'];
2227
+		if ( 0 === strpos( $upload['basedir'], ABSPATH ) ) {
2228
+					$error_path = str_replace( ABSPATH, '', $upload['basedir'] ) . $upload['subdir'];
2229
+		} else {
2230
+					$error_path = basename( $upload['basedir'] ) . $upload['subdir'];
2231
+		}
2156 2232
 
2157 2233
 		$message = sprintf( __( 'Unable to create directory %s. Is its parent directory writable by the server?' ), $error_path );
2158 2234
 		return array( 'error' => $message );
2159 2235
 	}
2160 2236
 
2161 2237
 	$ifp = @ fopen( $new_file, 'wb' );
2162
-	if ( ! $ifp )
2163
-		return array( 'error' => sprintf( __( 'Could not write file %s' ), $new_file ) );
2238
+	if ( ! $ifp ) {
2239
+			return array( 'error' => sprintf( __( 'Could not write file %s' ), $new_file ) );
2240
+	}
2164 2241
 
2165 2242
 	@fwrite( $ifp, $bits );
2166 2243
 	fclose( $ifp );
@@ -2192,10 +2269,11 @@  discard block
 block discarded – undo
2192 2269
 	$ext = strtolower( $ext );
2193 2270
 
2194 2271
 	$ext2type = wp_get_ext_types();
2195
-	foreach ( $ext2type as $type => $exts )
2196
-		if ( in_array( $ext, $exts ) )
2272
+	foreach ( $ext2type as $type => $exts ) {
2273
+			if ( in_array( $ext, $exts ) )
2197 2274
 			return $type;
2198
-}
2275
+	}
2276
+	}
2199 2277
 
2200 2278
 /**
2201 2279
  * Retrieve the file type from the file name.
@@ -2209,8 +2287,9 @@  discard block
 block discarded – undo
2209 2287
  * @return array Values with extension first and mime type.
2210 2288
  */
2211 2289
 function wp_check_filetype( $filename, $mimes = null ) {
2212
-	if ( empty($mimes) )
2213
-		$mimes = get_allowed_mime_types();
2290
+	if ( empty($mimes) ) {
2291
+			$mimes = get_allowed_mime_types();
2292
+	}
2214 2293
 	$type = false;
2215 2294
 	$ext = false;
2216 2295
 
@@ -2482,11 +2561,13 @@  discard block
 block discarded – undo
2482 2561
 	$t = wp_get_mime_types();
2483 2562
 
2484 2563
 	unset( $t['swf'], $t['exe'] );
2485
-	if ( function_exists( 'current_user_can' ) )
2486
-		$unfiltered = $user ? user_can( $user, 'unfiltered_html' ) : current_user_can( 'unfiltered_html' );
2564
+	if ( function_exists( 'current_user_can' ) ) {
2565
+			$unfiltered = $user ? user_can( $user, 'unfiltered_html' ) : current_user_can( 'unfiltered_html' );
2566
+	}
2487 2567
 
2488
-	if ( empty( $unfiltered ) )
2489
-		unset( $t['htm|html'] );
2568
+	if ( empty( $unfiltered ) ) {
2569
+			unset( $t['htm|html'] );
2570
+	}
2490 2571
 
2491 2572
 	/**
2492 2573
 	 * Filters list of allowed mime types and file extensions.
@@ -2518,8 +2599,9 @@  discard block
 block discarded – undo
2518 2599
 		$html .= sprintf( __( "Do you really want to <a href='%s'>log out</a>?"), wp_logout_url( $redirect_to ) );
2519 2600
 	} else {
2520 2601
 		$html = __( 'Are you sure you want to do this?' );
2521
-		if ( wp_get_referer() )
2522
-			$html .= "</p><p><a href='" . esc_url( remove_query_arg( 'updated', wp_get_referer() ) ) . "'>" . __( 'Please try again.' ) . "</a>";
2602
+		if ( wp_get_referer() ) {
2603
+					$html .= "</p><p><a href='" . esc_url( remove_query_arg( 'updated', wp_get_referer() ) ) . "'>" . __( 'Please try again.' ) . "</a>";
2604
+		}
2523 2605
 	}
2524 2606
 
2525 2607
 	wp_die( $html, __( 'WordPress Failure Notice' ), 403 );
@@ -2621,8 +2703,9 @@  discard block
 block discarded – undo
2621 2703
 	if ( function_exists( 'is_wp_error' ) && is_wp_error( $message ) ) {
2622 2704
 		if ( empty( $title ) ) {
2623 2705
 			$error_data = $message->get_error_data();
2624
-			if ( is_array( $error_data ) && isset( $error_data['title'] ) )
2625
-				$title = $error_data['title'];
2706
+			if ( is_array( $error_data ) && isset( $error_data['title'] ) ) {
2707
+							$title = $error_data['title'];
2708
+			}
2626 2709
 		}
2627 2710
 		$errors = $message->get_error_messages();
2628 2711
 		switch ( count( $errors ) ) {
@@ -2652,19 +2735,26 @@  discard block
 block discarded – undo
2652 2735
 			header( 'Content-Type: text/html; charset=utf-8' );
2653 2736
 		}
2654 2737
 
2655
-		if ( empty($title) )
2656
-			$title = $have_gettext ? __('WordPress &rsaquo; Error') : 'WordPress &rsaquo; Error';
2738
+		if ( empty($title) ) {
2739
+					$title = $have_gettext ? __('WordPress &rsaquo; Error') : 'WordPress &rsaquo; Error';
2740
+		}
2657 2741
 
2658 2742
 		$text_direction = 'ltr';
2659
-		if ( isset($r['text_direction']) && 'rtl' == $r['text_direction'] )
2660
-			$text_direction = 'rtl';
2661
-		elseif ( function_exists( 'is_rtl' ) && is_rtl() )
2662
-			$text_direction = 'rtl';
2663
-?>
2743
+		if ( isset($r['text_direction']) && 'rtl' == $r['text_direction'] ) {
2744
+					$text_direction = 'rtl';
2745
+		} elseif ( function_exists( 'is_rtl' ) && is_rtl() ) {
2746
+					$text_direction = 'rtl';
2747
+		}
2748
+		?>
2664 2749
 <!DOCTYPE html>
2665 2750
 <!-- Ticket #11289, IE bug fix: always pad the error page with enough characters such that it is greater than 512 bytes, even after gzip compression abcdefghijklmnopqrstuvwxyz1234567890aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz11223344556677889900abacbcbdcdcededfefegfgfhghgihihjijikjkjlklkmlmlnmnmononpopoqpqprqrqsrsrtstsubcbcdcdedefefgfabcadefbghicjkldmnoepqrfstugvwxhyz1i234j567k890laabmbccnddeoeffpgghqhiirjjksklltmmnunoovppqwqrrxsstytuuzvvw0wxx1yyz2z113223434455666777889890091abc2def3ghi4jkl5mno6pqr7stu8vwx9yz11aab2bcc3dd4ee5ff6gg7hh8ii9j0jk1kl2lmm3nnoo4p5pq6qrr7ss8tt9uuvv0wwx1x2yyzz13aba4cbcb5dcdc6dedfef8egf9gfh0ghg1ihi2hji3jik4jkj5lkl6kml7mln8mnm9ono
2666 2751
 -->
2667
-<html xmlns="http://www.w3.org/1999/xhtml" <?php if ( function_exists( 'language_attributes' ) && function_exists( 'is_rtl' ) ) language_attributes(); else echo "dir='$text_direction'"; ?>>
2752
+<html xmlns="http://www.w3.org/1999/xhtml" <?php if ( function_exists( 'language_attributes' ) && function_exists( 'is_rtl' ) ) {
2753
+	language_attributes();
2754
+} else {
2755
+	echo "dir='$text_direction'";
2756
+}
2757
+?>>
2668 2758
 <head>
2669 2759
 	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
2670 2760
 	<meta name="viewport" content="width=device-width">
@@ -2838,8 +2928,9 @@  discard block
 block discarded – undo
2838 2928
  * @param string $message Optional. Response to print. Default empty.
2839 2929
  */
2840 2930
 function _ajax_wp_die_handler( $message = '' ) {
2841
-	if ( is_scalar( $message ) )
2842
-		die( (string) $message );
2931
+	if ( is_scalar( $message ) ) {
2932
+			die( (string) $message );
2933
+	}
2843 2934
 	die( '0' );
2844 2935
 }
2845 2936
 
@@ -2854,8 +2945,9 @@  discard block
 block discarded – undo
2854 2945
  * @param string $message Optional. Response to print. Default empty.
2855 2946
  */
2856 2947
 function _scalar_wp_die_handler( $message = '' ) {
2857
-	if ( is_scalar( $message ) )
2858
-		die( (string) $message );
2948
+	if ( is_scalar( $message ) ) {
2949
+			die( (string) $message );
2950
+	}
2859 2951
 	die();
2860 2952
 }
2861 2953
 
@@ -3061,11 +3153,12 @@  discard block
 block discarded – undo
3061 3153
 function wp_send_json( $response ) {
3062 3154
 	@header( 'Content-Type: application/json; charset=' . get_option( 'blog_charset' ) );
3063 3155
 	echo wp_json_encode( $response );
3064
-	if ( defined( 'DOING_AJAX' ) && DOING_AJAX )
3065
-		wp_die();
3066
-	else
3067
-		die;
3068
-}
3156
+	if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
3157
+			wp_die();
3158
+	} else {
3159
+			die;
3160
+	}
3161
+	}
3069 3162
 
3070 3163
 /**
3071 3164
  * Send a JSON response back to an Ajax request, indicating success.
@@ -3077,8 +3170,9 @@  discard block
 block discarded – undo
3077 3170
 function wp_send_json_success( $data = null ) {
3078 3171
 	$response = array( 'success' => true );
3079 3172
 
3080
-	if ( isset( $data ) )
3081
-		$response['data'] = $data;
3173
+	if ( isset( $data ) ) {
3174
+			$response['data'] = $data;
3175
+	}
3082 3176
 
3083 3177
 	wp_send_json( $response );
3084 3178
 }
@@ -3155,8 +3249,9 @@  discard block
 block discarded – undo
3155 3249
  * @return string Homepage location.
3156 3250
  */
3157 3251
 function _config_wp_home( $url = '' ) {
3158
-	if ( defined( 'WP_HOME' ) )
3159
-		return untrailingslashit( WP_HOME );
3252
+	if ( defined( 'WP_HOME' ) ) {
3253
+			return untrailingslashit( WP_HOME );
3254
+	}
3160 3255
 	return $url;
3161 3256
 }
3162 3257
 
@@ -3176,8 +3271,9 @@  discard block
 block discarded – undo
3176 3271
  * @return string The WordPress Site URL.
3177 3272
  */
3178 3273
 function _config_wp_siteurl( $url = '' ) {
3179
-	if ( defined( 'WP_SITEURL' ) )
3180
-		return untrailingslashit( WP_SITEURL );
3274
+	if ( defined( 'WP_SITEURL' ) ) {
3275
+			return untrailingslashit( WP_SITEURL );
3276
+	}
3181 3277
 	return $url;
3182 3278
 }
3183 3279
 
@@ -3241,8 +3337,9 @@  discard block
 block discarded – undo
3241 3337
 	global $wpsmiliestrans, $wp_smiliessearch;
3242 3338
 
3243 3339
 	// don't bother setting up smilies if they are disabled
3244
-	if ( !get_option( 'use_smilies' ) )
3245
-		return;
3340
+	if ( !get_option( 'use_smilies' ) ) {
3341
+			return;
3342
+	}
3246 3343
 
3247 3344
 	if ( !isset( $wpsmiliestrans ) ) {
3248 3345
 		$wpsmiliestrans = array(
@@ -3346,15 +3443,17 @@  discard block
 block discarded – undo
3346 3443
  * @return array Merged user defined values with defaults.
3347 3444
  */
3348 3445
 function wp_parse_args( $args, $defaults = '' ) {
3349
-	if ( is_object( $args ) )
3350
-		$r = get_object_vars( $args );
3351
-	elseif ( is_array( $args ) )
3352
-		$r =& $args;
3353
-	else
3354
-		wp_parse_str( $args, $r );
3355
-
3356
-	if ( is_array( $defaults ) )
3357
-		return array_merge( $defaults, $r );
3446
+	if ( is_object( $args ) ) {
3447
+			$r = get_object_vars( $args );
3448
+	} elseif ( is_array( $args ) ) {
3449
+			$r =& $args;
3450
+	} else {
3451
+			wp_parse_str( $args, $r );
3452
+	}
3453
+
3454
+	if ( is_array( $defaults ) ) {
3455
+			return array_merge( $defaults, $r );
3456
+	}
3358 3457
 	return $r;
3359 3458
 }
3360 3459
 
@@ -3367,8 +3466,9 @@  discard block
 block discarded – undo
3367 3466
  * @return array Sanitized array of IDs.
3368 3467
  */
3369 3468
 function wp_parse_id_list( $list ) {
3370
-	if ( !is_array($list) )
3371
-		$list = preg_split('/[\s,]+/', $list);
3469
+	if ( !is_array($list) ) {
3470
+			$list = preg_split('/[\s,]+/', $list);
3471
+	}
3372 3472
 
3373 3473
 	return array_unique(array_map('absint', $list));
3374 3474
 }
@@ -3384,9 +3484,10 @@  discard block
 block discarded – undo
3384 3484
  */
3385 3485
 function wp_array_slice_assoc( $array, $keys ) {
3386 3486
 	$slice = array();
3387
-	foreach ( $keys as $key )
3388
-		if ( isset( $array[ $key ] ) )
3487
+	foreach ( $keys as $key ) {
3488
+			if ( isset( $array[ $key ] ) )
3389 3489
 			$slice[ $key ] = $array[ $key ];
3490
+	}
3390 3491
 
3391 3492
 	return $slice;
3392 3493
 }
@@ -3426,13 +3527,15 @@  discard block
 block discarded – undo
3426 3527
  * @return array A list of objects or object fields.
3427 3528
  */
3428 3529
 function wp_filter_object_list( $list, $args = array(), $operator = 'and', $field = false ) {
3429
-	if ( ! is_array( $list ) )
3430
-		return array();
3530
+	if ( ! is_array( $list ) ) {
3531
+			return array();
3532
+	}
3431 3533
 
3432 3534
 	$list = wp_list_filter( $list, $args, $operator );
3433 3535
 
3434
-	if ( $field )
3435
-		$list = wp_list_pluck( $list, $field );
3536
+	if ( $field ) {
3537
+			$list = wp_list_pluck( $list, $field );
3538
+	}
3436 3539
 
3437 3540
 	return $list;
3438 3541
 }
@@ -3452,11 +3555,13 @@  discard block
 block discarded – undo
3452 3555
  * @return array Array of found values.
3453 3556
  */
3454 3557
 function wp_list_filter( $list, $args = array(), $operator = 'AND' ) {
3455
-	if ( ! is_array( $list ) )
3456
-		return array();
3558
+	if ( ! is_array( $list ) ) {
3559
+			return array();
3560
+	}
3457 3561
 
3458
-	if ( empty( $args ) )
3459
-		return $list;
3562
+	if ( empty( $args ) ) {
3563
+			return $list;
3564
+	}
3460 3565
 
3461 3566
 	$operator = strtoupper( $operator );
3462 3567
 	$count = count( $args );
@@ -3467,8 +3572,9 @@  discard block
 block discarded – undo
3467 3572
 
3468 3573
 		$matched = 0;
3469 3574
 		foreach ( $args as $m_key => $m_value ) {
3470
-			if ( array_key_exists( $m_key, $to_match ) && $m_value == $to_match[ $m_key ] )
3471
-				$matched++;
3575
+			if ( array_key_exists( $m_key, $to_match ) && $m_value == $to_match[ $m_key ] ) {
3576
+							$matched++;
3577
+			}
3472 3578
 		}
3473 3579
 
3474 3580
 		if ( ( 'AND' == $operator && $matched == $count )
@@ -3577,8 +3683,9 @@  discard block
 block discarded – undo
3577 3683
 function wp_widgets_add_menu() {
3578 3684
 	global $submenu;
3579 3685
 
3580
-	if ( ! current_theme_supports( 'widgets' ) )
3581
-		return;
3686
+	if ( ! current_theme_supports( 'widgets' ) ) {
3687
+			return;
3688
+	}
3582 3689
 
3583 3690
 	$submenu['themes.php'][7] = array( __( 'Widgets' ), 'edit_theme_options', 'widgets.php' );
3584 3691
 	ksort( $submenu['themes.php'], SORT_NUMERIC );
@@ -3593,9 +3700,10 @@  discard block
 block discarded – undo
3593 3700
  */
3594 3701
 function wp_ob_end_flush_all() {
3595 3702
 	$levels = ob_get_level();
3596
-	for ($i=0; $i<$levels; $i++)
3597
-		ob_end_flush();
3598
-}
3703
+	for ($i=0; $i<$levels; $i++) {
3704
+			ob_end_flush();
3705
+	}
3706
+	}
3599 3707
 
3600 3708
 /**
3601 3709
  * Load custom DB error or display WordPress DB error.
@@ -3627,8 +3735,9 @@  discard block
 block discarded – undo
3627 3735
 	}
3628 3736
 
3629 3737
 	// If installing or in the admin, provide the verbose message.
3630
-	if ( wp_installing() || defined( 'WP_ADMIN' ) )
3631
-		wp_die($wpdb->error);
3738
+	if ( wp_installing() || defined( 'WP_ADMIN' ) ) {
3739
+			wp_die($wpdb->error);
3740
+	}
3632 3741
 
3633 3742
 	// Otherwise, be terse.
3634 3743
 	status_header( 500 );
@@ -3636,7 +3745,10 @@  discard block
 block discarded – undo
3636 3745
 	header( 'Content-Type: text/html; charset=utf-8' );
3637 3746
 ?>
3638 3747
 <!DOCTYPE html>
3639
-<html xmlns="http://www.w3.org/1999/xhtml"<?php if ( is_rtl() ) echo ' dir="rtl"'; ?>>
3748
+<html xmlns="http://www.w3.org/1999/xhtml"<?php if ( is_rtl() ) {
3749
+	echo ' dir="rtl"';
3750
+}
3751
+?>>
3640 3752
 <head>
3641 3753
 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
3642 3754
 	<title><?php _e( 'Database Error' ); ?></title>
@@ -3702,15 +3814,17 @@  discard block
 block discarded – undo
3702 3814
 	 */
3703 3815
 	if ( WP_DEBUG && apply_filters( 'deprecated_function_trigger_error', true ) ) {
3704 3816
 		if ( function_exists( '__' ) ) {
3705
-			if ( ! is_null( $replacement ) )
3706
-				trigger_error( sprintf( __('%1$s is <strong>deprecated</strong> since version %2$s! Use %3$s instead.'), $function, $version, $replacement ) );
3707
-			else
3708
-				trigger_error( sprintf( __('%1$s is <strong>deprecated</strong> since version %2$s with no alternative available.'), $function, $version ) );
3817
+			if ( ! is_null( $replacement ) ) {
3818
+							trigger_error( sprintf( __('%1$s is <strong>deprecated</strong> since version %2$s! Use %3$s instead.'), $function, $version, $replacement ) );
3819
+			} else {
3820
+							trigger_error( sprintf( __('%1$s is <strong>deprecated</strong> since version %2$s with no alternative available.'), $function, $version ) );
3821
+			}
3709 3822
 		} else {
3710
-			if ( ! is_null( $replacement ) )
3711
-				trigger_error( sprintf( '%1$s is <strong>deprecated</strong> since version %2$s! Use %3$s instead.', $function, $version, $replacement ) );
3712
-			else
3713
-				trigger_error( sprintf( '%1$s is <strong>deprecated</strong> since version %2$s with no alternative available.', $function, $version ) );
3823
+			if ( ! is_null( $replacement ) ) {
3824
+							trigger_error( sprintf( '%1$s is <strong>deprecated</strong> since version %2$s! Use %3$s instead.', $function, $version, $replacement ) );
3825
+			} else {
3826
+							trigger_error( sprintf( '%1$s is <strong>deprecated</strong> since version %2$s with no alternative available.', $function, $version ) );
3827
+			}
3714 3828
 		}
3715 3829
 	}
3716 3830
 }
@@ -3826,15 +3940,17 @@  discard block
 block discarded – undo
3826 3940
 	if ( WP_DEBUG && apply_filters( 'deprecated_file_trigger_error', true ) ) {
3827 3941
 		$message = empty( $message ) ? '' : ' ' . $message;
3828 3942
 		if ( function_exists( '__' ) ) {
3829
-			if ( ! is_null( $replacement ) )
3830
-				trigger_error( sprintf( __('%1$s is <strong>deprecated</strong> since version %2$s! Use %3$s instead.'), $file, $version, $replacement ) . $message );
3831
-			else
3832
-				trigger_error( sprintf( __('%1$s is <strong>deprecated</strong> since version %2$s with no alternative available.'), $file, $version ) . $message );
3943
+			if ( ! is_null( $replacement ) ) {
3944
+							trigger_error( sprintf( __('%1$s is <strong>deprecated</strong> since version %2$s! Use %3$s instead.'), $file, $version, $replacement ) . $message );
3945
+			} else {
3946
+							trigger_error( sprintf( __('%1$s is <strong>deprecated</strong> since version %2$s with no alternative available.'), $file, $version ) . $message );
3947
+			}
3833 3948
 		} else {
3834
-			if ( ! is_null( $replacement ) )
3835
-				trigger_error( sprintf( '%1$s is <strong>deprecated</strong> since version %2$s! Use %3$s instead.', $file, $version, $replacement ) . $message );
3836
-			else
3837
-				trigger_error( sprintf( '%1$s is <strong>deprecated</strong> since version %2$s with no alternative available.', $file, $version ) . $message );
3949
+			if ( ! is_null( $replacement ) ) {
3950
+							trigger_error( sprintf( '%1$s is <strong>deprecated</strong> since version %2$s! Use %3$s instead.', $file, $version, $replacement ) . $message );
3951
+			} else {
3952
+							trigger_error( sprintf( '%1$s is <strong>deprecated</strong> since version %2$s with no alternative available.', $file, $version ) . $message );
3953
+			}
3838 3954
 		}
3839 3955
 	}
3840 3956
 }
@@ -3886,15 +4002,17 @@  discard block
 block discarded – undo
3886 4002
 	 */
3887 4003
 	if ( WP_DEBUG && apply_filters( 'deprecated_argument_trigger_error', true ) ) {
3888 4004
 		if ( function_exists( '__' ) ) {
3889
-			if ( ! is_null( $message ) )
3890
-				trigger_error( sprintf( __('%1$s was called with an argument that is <strong>deprecated</strong> since version %2$s! %3$s'), $function, $version, $message ) );
3891
-			else
3892
-				trigger_error( sprintf( __('%1$s was called with an argument that is <strong>deprecated</strong> since version %2$s with no alternative available.'), $function, $version ) );
4005
+			if ( ! is_null( $message ) ) {
4006
+							trigger_error( sprintf( __('%1$s was called with an argument that is <strong>deprecated</strong> since version %2$s! %3$s'), $function, $version, $message ) );
4007
+			} else {
4008
+							trigger_error( sprintf( __('%1$s was called with an argument that is <strong>deprecated</strong> since version %2$s with no alternative available.'), $function, $version ) );
4009
+			}
3893 4010
 		} else {
3894
-			if ( ! is_null( $message ) )
3895
-				trigger_error( sprintf( '%1$s was called with an argument that is <strong>deprecated</strong> since version %2$s! %3$s', $function, $version, $message ) );
3896
-			else
3897
-				trigger_error( sprintf( '%1$s was called with an argument that is <strong>deprecated</strong> since version %2$s with no alternative available.', $function, $version ) );
4011
+			if ( ! is_null( $message ) ) {
4012
+							trigger_error( sprintf( '%1$s was called with an argument that is <strong>deprecated</strong> since version %2$s! %3$s', $function, $version, $message ) );
4013
+			} else {
4014
+							trigger_error( sprintf( '%1$s was called with an argument that is <strong>deprecated</strong> since version %2$s with no alternative available.', $function, $version ) );
4015
+			}
3898 4016
 		}
3899 4017
 	}
3900 4018
 }
@@ -4030,19 +4148,22 @@  discard block
 block discarded – undo
4030 4148
 function apache_mod_loaded($mod, $default = false) {
4031 4149
 	global $is_apache;
4032 4150
 
4033
-	if ( !$is_apache )
4034
-		return false;
4151
+	if ( !$is_apache ) {
4152
+			return false;
4153
+	}
4035 4154
 
4036 4155
 	if ( function_exists( 'apache_get_modules' ) ) {
4037 4156
 		$mods = apache_get_modules();
4038
-		if ( in_array($mod, $mods) )
4039
-			return true;
4157
+		if ( in_array($mod, $mods) ) {
4158
+					return true;
4159
+		}
4040 4160
 	} elseif ( function_exists( 'phpinfo' ) && false === strpos( ini_get( 'disable_functions' ), 'phpinfo' ) ) {
4041 4161
 			ob_start();
4042 4162
 			phpinfo(8);
4043 4163
 			$phpinfo = ob_get_clean();
4044
-			if ( false !== strpos($phpinfo, $mod) )
4045
-				return true;
4164
+			if ( false !== strpos($phpinfo, $mod) ) {
4165
+							return true;
4166
+			}
4046 4167
 	}
4047 4168
 	return $default;
4048 4169
 }
@@ -4098,17 +4219,21 @@  discard block
 block discarded – undo
4098 4219
  * @return int 0 means nothing is wrong, greater than 0 means something was wrong.
4099 4220
  */
4100 4221
 function validate_file( $file, $allowed_files = '' ) {
4101
-	if ( false !== strpos( $file, '..' ) )
4102
-		return 1;
4222
+	if ( false !== strpos( $file, '..' ) ) {
4223
+			return 1;
4224
+	}
4103 4225
 
4104
-	if ( false !== strpos( $file, './' ) )
4105
-		return 1;
4226
+	if ( false !== strpos( $file, './' ) ) {
4227
+			return 1;
4228
+	}
4106 4229
 
4107
-	if ( ! empty( $allowed_files ) && ! in_array( $file, $allowed_files ) )
4108
-		return 3;
4230
+	if ( ! empty( $allowed_files ) && ! in_array( $file, $allowed_files ) ) {
4231
+			return 3;
4232
+	}
4109 4233
 
4110
-	if (':' == substr( $file, 1, 1 ) )
4111
-		return 2;
4234
+	if (':' == substr( $file, 1, 1 ) ) {
4235
+			return 2;
4236
+	}
4112 4237
 
4113 4238
 	return 0;
4114 4239
 }
@@ -4204,8 +4329,9 @@  discard block
 block discarded – undo
4204 4329
 function wp_suspend_cache_addition( $suspend = null ) {
4205 4330
 	static $_suspend = false;
4206 4331
 
4207
-	if ( is_bool( $suspend ) )
4208
-		$_suspend = $suspend;
4332
+	if ( is_bool( $suspend ) ) {
4333
+			$_suspend = $suspend;
4334
+	}
4209 4335
 
4210 4336
 	return $_suspend;
4211 4337
 }
@@ -4247,11 +4373,13 @@  discard block
 block discarded – undo
4247 4373
 	// This is the current network's information; 'site' is old terminology.
4248 4374
 	global $current_site;
4249 4375
 
4250
-	if ( ! is_multisite() )
4251
-		return true;
4376
+	if ( ! is_multisite() ) {
4377
+			return true;
4378
+	}
4252 4379
 
4253
-	if ( ! $site_id )
4254
-		$site_id = get_current_blog_id();
4380
+	if ( ! $site_id ) {
4381
+			$site_id = get_current_blog_id();
4382
+	}
4255 4383
 
4256 4384
 	return (int) $site_id === (int) $current_site->blog_id;
4257 4385
 }
@@ -4332,8 +4460,9 @@  discard block
 block discarded – undo
4332 4460
  * @return bool True if multisite and global terms enabled.
4333 4461
  */
4334 4462
 function global_terms_enabled() {
4335
-	if ( ! is_multisite() )
4336
-		return false;
4463
+	if ( ! is_multisite() ) {
4464
+			return false;
4465
+	}
4337 4466
 
4338 4467
 	static $global_terms = null;
4339 4468
 	if ( is_null( $global_terms ) ) {
@@ -4349,10 +4478,11 @@  discard block
 block discarded – undo
4349 4478
 		 * @param null $enabled Whether global terms are enabled.
4350 4479
 		 */
4351 4480
 		$filter = apply_filters( 'global_terms_enabled', null );
4352
-		if ( ! is_null( $filter ) )
4353
-			$global_terms = (bool) $filter;
4354
-		else
4355
-			$global_terms = (bool) get_site_option( 'global_terms_enabled', false );
4481
+		if ( ! is_null( $filter ) ) {
4482
+					$global_terms = (bool) $filter;
4483
+		} else {
4484
+					$global_terms = (bool) get_site_option( 'global_terms_enabled', false );
4485
+		}
4356 4486
 	}
4357 4487
 	return $global_terms;
4358 4488
 }
@@ -4528,8 +4658,9 @@  discard block
 block discarded – undo
4528 4658
 	// Do UTC
4529 4659
 	$structure[] = '<optgroup label="'. esc_attr__( 'UTC' ) .'">';
4530 4660
 	$selected = '';
4531
-	if ( 'UTC' === $selected_zone )
4532
-		$selected = 'selected="selected" ';
4661
+	if ( 'UTC' === $selected_zone ) {
4662
+			$selected = 'selected="selected" ';
4663
+	}
4533 4664
 	$structure[] = '<option ' . $selected . 'value="' . esc_attr( 'UTC' ) . '">' . __('UTC') . '</option>';
4534 4665
 	$structure[] = '</optgroup>';
4535 4666
 
@@ -4538,18 +4669,20 @@  discard block
 block discarded – undo
4538 4669
 	$offset_range = array (-12, -11.5, -11, -10.5, -10, -9.5, -9, -8.5, -8, -7.5, -7, -6.5, -6, -5.5, -5, -4.5, -4, -3.5, -3, -2.5, -2, -1.5, -1, -0.5,
4539 4670
 		0, 0.5, 1, 1.5, 2, 2.5, 3, 3.5, 4, 4.5, 5, 5.5, 5.75, 6, 6.5, 7, 7.5, 8, 8.5, 8.75, 9, 9.5, 10, 10.5, 11, 11.5, 12, 12.75, 13, 13.75, 14);
4540 4671
 	foreach ( $offset_range as $offset ) {
4541
-		if ( 0 <= $offset )
4542
-			$offset_name = '+' . $offset;
4543
-		else
4544
-			$offset_name = (string) $offset;
4672
+		if ( 0 <= $offset ) {
4673
+					$offset_name = '+' . $offset;
4674
+		} else {
4675
+					$offset_name = (string) $offset;
4676
+		}
4545 4677
 
4546 4678
 		$offset_value = $offset_name;
4547 4679
 		$offset_name = str_replace(array('.25','.5','.75'), array(':15',':30',':45'), $offset_name);
4548 4680
 		$offset_name = 'UTC' . $offset_name;
4549 4681
 		$offset_value = 'UTC' . $offset_value;
4550 4682
 		$selected = '';
4551
-		if ( $offset_value === $selected_zone )
4552
-			$selected = 'selected="selected" ';
4683
+		if ( $offset_value === $selected_zone ) {
4684
+					$selected = 'selected="selected" ';
4685
+		}
4553 4686
 		$structure[] = '<option ' . $selected . 'value="' . esc_attr( $offset_value ) . '">' . esc_html( $offset_name ) . "</option>";
4554 4687
 
4555 4688
 	}
@@ -4592,8 +4725,9 @@  discard block
 block discarded – undo
4592 4725
 
4593 4726
 	foreach ( (array) $posts_to_delete as $post ) {
4594 4727
 		$post_id = (int) $post['post_id'];
4595
-		if ( !$post_id )
4596
-			continue;
4728
+		if ( !$post_id ) {
4729
+					continue;
4730
+		}
4597 4731
 
4598 4732
 		$del_post = get_post($post_id);
4599 4733
 
@@ -4609,8 +4743,9 @@  discard block
 block discarded – undo
4609 4743
 
4610 4744
 	foreach ( (array) $comments_to_delete as $comment ) {
4611 4745
 		$comment_id = (int) $comment['comment_id'];
4612
-		if ( !$comment_id )
4613
-			continue;
4746
+		if ( !$comment_id ) {
4747
+					continue;
4748
+		}
4614 4749
 
4615 4750
 		$del_comment = get_comment($comment_id);
4616 4751
 
@@ -4674,10 +4809,11 @@  discard block
 block discarded – undo
4674 4809
 	}
4675 4810
 
4676 4811
 	foreach ( $all_headers as $field => $regex ) {
4677
-		if ( preg_match( '/^[ \t\/*#@]*' . preg_quote( $regex, '/' ) . ':(.*)$/mi', $file_data, $match ) && $match[1] )
4678
-			$all_headers[ $field ] = _cleanup_header_comment( $match[1] );
4679
-		else
4680
-			$all_headers[ $field ] = '';
4812
+		if ( preg_match( '/^[ \t\/*#@]*' . preg_quote( $regex, '/' ) . ':(.*)$/mi', $file_data, $match ) && $match[1] ) {
4813
+					$all_headers[ $field ] = _cleanup_header_comment( $match[1] );
4814
+		} else {
4815
+					$all_headers[ $field ] = '';
4816
+		}
4681 4817
 	}
4682 4818
 
4683 4819
 	return $all_headers;
@@ -4820,8 +4956,9 @@  discard block
 block discarded – undo
4820 4956
 function wp_find_hierarchy_loop( $callback, $start, $start_parent, $callback_args = array() ) {
4821 4957
 	$override = is_null( $start_parent ) ? array() : array( $start => $start_parent );
4822 4958
 
4823
-	if ( !$arbitrary_loop_member = wp_find_hierarchy_loop_tortoise_hare( $callback, $start, $override, $callback_args ) )
4824
-		return array();
4959
+	if ( !$arbitrary_loop_member = wp_find_hierarchy_loop_tortoise_hare( $callback, $start, $override, $callback_args ) ) {
4960
+			return array();
4961
+	}
4825 4962
 
4826 4963
 	return wp_find_hierarchy_loop_tortoise_hare( $callback, $arbitrary_loop_member, $override, $callback_args, true );
4827 4964
 }
@@ -4859,12 +4996,14 @@  discard block
 block discarded – undo
4859 4996
 	&&
4860 4997
 		( $hare = isset( $override[$evanescent_hare] ) ? $override[$evanescent_hare] : call_user_func_array( $callback, array_merge( array( $evanescent_hare ), $callback_args ) ) )
4861 4998
 	) {
4862
-		if ( $_return_loop )
4863
-			$return[$tortoise] = $return[$evanescent_hare] = $return[$hare] = true;
4999
+		if ( $_return_loop ) {
5000
+					$return[$tortoise] = $return[$evanescent_hare] = $return[$hare] = true;
5001
+		}
4864 5002
 
4865 5003
 		// tortoise got lapped - must be a loop
4866
-		if ( $tortoise == $evanescent_hare || $tortoise == $hare )
4867
-			return $_return_loop ? $return : $tortoise;
5004
+		if ( $tortoise == $evanescent_hare || $tortoise == $hare ) {
5005
+					return $_return_loop ? $return : $tortoise;
5006
+		}
4868 5007
 
4869 5008
 		// Increment tortoise by one step
4870 5009
 		$tortoise = isset( $override[$tortoise] ) ? $override[$tortoise] : call_user_func_array( $callback, array_merge( array( $tortoise ), $callback_args ) );
@@ -4936,10 +5075,11 @@  discard block
 block discarded – undo
4936 5075
  *                      of individual calls.
4937 5076
  */
4938 5077
 function wp_debug_backtrace_summary( $ignore_class = null, $skip_frames = 0, $pretty = true ) {
4939
-	if ( version_compare( PHP_VERSION, '5.2.5', '>=' ) )
4940
-		$trace = debug_backtrace( false );
4941
-	else
4942
-		$trace = debug_backtrace();
5078
+	if ( version_compare( PHP_VERSION, '5.2.5', '>=' ) ) {
5079
+			$trace = debug_backtrace( false );
5080
+	} else {
5081
+			$trace = debug_backtrace();
5082
+	}
4943 5083
 
4944 5084
 	$caller = array();
4945 5085
 	$check_class = ! is_null( $ignore_class );
@@ -4949,8 +5089,10 @@  discard block
 block discarded – undo
4949 5089
 		if ( $skip_frames > 0 ) {
4950 5090
 			$skip_frames--;
4951 5091
 		} elseif ( isset( $call['class'] ) ) {
4952
-			if ( $check_class && $ignore_class == $call['class'] )
4953
-				continue; // Filter out calls
5092
+			if ( $check_class && $ignore_class == $call['class'] ) {
5093
+							continue;
5094
+			}
5095
+			// Filter out calls
4954 5096
 
4955 5097
 			$caller[] = "{$call['class']}{$call['type']}{$call['function']}";
4956 5098
 		} else {
@@ -4963,11 +5105,12 @@  discard block
 block discarded – undo
4963 5105
 			}
4964 5106
 		}
4965 5107
 	}
4966
-	if ( $pretty )
4967
-		return join( ', ', array_reverse( $caller ) );
4968
-	else
4969
-		return $caller;
4970
-}
5108
+	if ( $pretty ) {
5109
+			return join( ', ', array_reverse( $caller ) );
5110
+	} else {
5111
+			return $caller;
5112
+	}
5113
+	}
4971 5114
 
4972 5115
 /**
4973 5116
  * Retrieve ids that are not already present in the cache.
@@ -5001,8 +5144,9 @@  discard block
 block discarded – undo
5001 5144
  * @return bool Whether the device is able to upload files.
5002 5145
  */
5003 5146
 function _device_can_upload() {
5004
-	if ( ! wp_is_mobile() )
5005
-		return true;
5147
+	if ( ! wp_is_mobile() ) {
5148
+			return true;
5149
+	}
5006 5150
 
5007 5151
 	$ua = $_SERVER['HTTP_USER_AGENT'];
5008 5152
 
@@ -5065,11 +5209,13 @@  discard block
 block discarded – undo
5065 5209
  * @since 3.6.0
5066 5210
  */
5067 5211
 function wp_auth_check_load() {
5068
-	if ( ! is_admin() && ! is_user_logged_in() )
5069
-		return;
5212
+	if ( ! is_admin() && ! is_user_logged_in() ) {
5213
+			return;
5214
+	}
5070 5215
 
5071
-	if ( defined( 'IFRAME_REQUEST' ) )
5072
-		return;
5216
+	if ( defined( 'IFRAME_REQUEST' ) ) {
5217
+			return;
5218
+	}
5073 5219
 
5074 5220
 	$screen = get_current_screen();
5075 5221
 	$hidden = array( 'update', 'update-network', 'update-core', 'update-core-network', 'upgrade', 'upgrade-network', 'network' );
@@ -5174,8 +5320,9 @@  discard block
 block discarded – undo
5174 5320
  * @return string Tag RegEx.
5175 5321
  */
5176 5322
 function get_tag_regex( $tag ) {
5177
-	if ( empty( $tag ) )
5178
-		return;
5323
+	if ( empty( $tag ) ) {
5324
+			return;
5325
+	}
5179 5326
 	return sprintf( '<%1$s[^<]*(?:>[\s\S]*<\/%1$s>|\s*\/>)', tag_escape( $tag ) );
5180 5327
 }
5181 5328
 
@@ -5193,12 +5340,14 @@  discard block
 block discarded – undo
5193 5340
  */
5194 5341
 function _canonical_charset( $charset ) {
5195 5342
 	if ( 'UTF-8' === $charset || 'utf-8' === $charset || 'utf8' === $charset ||
5196
-		'UTF8' === $charset )
5197
-		return 'UTF-8';
5343
+		'UTF8' === $charset ) {
5344
+			return 'UTF-8';
5345
+	}
5198 5346
 
5199 5347
 	if ( 'ISO-8859-1' === $charset || 'iso-8859-1' === $charset ||
5200
-		'iso8859-1' === $charset || 'ISO8859-1' === $charset )
5201
-		return 'ISO-8859-1';
5348
+		'iso8859-1' === $charset || 'ISO8859-1' === $charset ) {
5349
+			return 'ISO-8859-1';
5350
+	}
5202 5351
 
5203 5352
 	return $charset;
5204 5353
 }
@@ -5233,11 +5382,13 @@  discard block
 block discarded – undo
5233 5382
 	static $encodings = array();
5234 5383
 	static $overloaded = null;
5235 5384
 
5236
-	if ( is_null( $overloaded ) )
5237
-		$overloaded = function_exists( 'mb_internal_encoding' ) && ( ini_get( 'mbstring.func_overload' ) & 2 );
5385
+	if ( is_null( $overloaded ) ) {
5386
+			$overloaded = function_exists( 'mb_internal_encoding' ) && ( ini_get( 'mbstring.func_overload' ) & 2 );
5387
+	}
5238 5388
 
5239
-	if ( false === $overloaded )
5240
-		return;
5389
+	if ( false === $overloaded ) {
5390
+			return;
5391
+	}
5241 5392
 
5242 5393
 	if ( ! $reset ) {
5243 5394
 		$encoding = mb_internal_encoding();
Please login to merge, or discard this patch.
src/wp-includes/post.php 2 patches
Doc Comments   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -389,7 +389,7 @@  discard block
 block discarded – undo
389 389
  * @since 1.0.0
390 390
  *
391 391
  * @param string $post Post content.
392
- * @return array Post before ('main'), after ('extended'), and custom read more ('more_text').
392
+ * @return integer Post before ('main'), after ('extended'), and custom read more ('more_text').
393 393
  */
394 394
 function get_extended( $post ) {
395 395
 	//Match the new style more links.
@@ -1270,7 +1270,7 @@  discard block
 block discarded – undo
1270 1270
  *
1271 1271
  * @access private
1272 1272
  *
1273
- * @param object|WP_Post_Type $post_type_object Post type object.
1273
+ * @param WP_Post_Type $post_type_object Post type object.
1274 1274
  * @return object Object with all the labels as member variables.
1275 1275
  */
1276 1276
 function get_post_type_labels( $post_type_object ) {
@@ -1633,7 +1633,7 @@  discard block
 block discarded – undo
1633 1633
  *
1634 1634
  * @param int    $post_id    Post ID.
1635 1635
  * @param string $meta_key   Metadata name.
1636
- * @param mixed  $meta_value Optional. Metadata value. Must be serializable if
1636
+ * @param string  $meta_value Optional. Metadata value. Must be serializable if
1637 1637
  *                           non-scalar. Default empty.
1638 1638
  * @return bool True on success, false on failure.
1639 1639
  */
@@ -2584,7 +2584,7 @@  discard block
 block discarded – undo
2584 2584
  *
2585 2585
  * @global wpdb $wpdb WordPress database abstraction object.
2586 2586
  *
2587
- * @param int|WP_Post|null $post Optional. Post ID or post object. Defaults to global $post.
2587
+ * @param integer $post Optional. Post ID or post object. Defaults to global $post.
2588 2588
  * @return mixed|void False on failure.
2589 2589
  */
2590 2590
 function wp_trash_post_comments( $post = null ) {
@@ -2640,8 +2640,8 @@  discard block
 block discarded – undo
2640 2640
  *
2641 2641
  * @global wpdb $wpdb WordPress database abstraction object.
2642 2642
  *
2643
- * @param int|WP_Post|null $post Optional. Post ID or post object. Defaults to global $post.
2644
- * @return true|void
2643
+ * @param integer $post Optional. Post ID or post object. Defaults to global $post.
2644
+ * @return null|boolean
2645 2645
  */
2646 2646
 function wp_untrash_post_comments( $post = null ) {
2647 2647
 	global $wpdb;
@@ -4317,7 +4317,7 @@  discard block
 block discarded – undo
4317 4317
  * @since 1.5.0
4318 4318
  * @since 4.6.0 Converted the `$page` parameter to optional.
4319 4319
  *
4320
- * @param WP_Post|object|int $page Optional. Page ID or WP_Post object. Default is global $post.
4320
+ * @param integer $page Optional. Page ID or WP_Post object. Default is global $post.
4321 4321
  * @return string|false Page URI, false on error.
4322 4322
  */
4323 4323
 function get_page_uri( $page = 0 ) {
@@ -5114,7 +5114,7 @@  discard block
 block discarded – undo
5114 5114
  *
5115 5115
  * @since 2.1.0
5116 5116
  *
5117
- * @param string|int $mime MIME type or attachment ID.
5117
+ * @param integer $mime MIME type or attachment ID.
5118 5118
  * @return string|false Icon, false otherwise.
5119 5119
  */
5120 5120
 function wp_mime_type_icon( $mime = 0 ) {
@@ -6011,7 +6011,7 @@  discard block
 block discarded – undo
6011 6011
  * @access private
6012 6012
  *
6013 6013
  * @param string $post_name Slug.
6014
- * @param string $post_ID   Optional. Post ID that should be ignored. Default 0.
6014
+ * @param integer $post_ID   Optional. Post ID that should be ignored. Default 0.
6015 6015
  */
6016 6016
 function wp_add_trashed_suffix_to_post_name_for_trashed_posts( $post_name, $post_ID = 0 ) {
6017 6017
 	$trashed_posts_with_desired_slug = get_posts( array(
Please login to merge, or discard this patch.
Spacing   +1223 added lines, -1223 removed lines patch added patch discarded remove patch
@@ -18,9 +18,9 @@  discard block
 block discarded – undo
18 18
  * @since 2.9.0
19 19
  */
20 20
 function create_initial_post_types() {
21
-	register_post_type( 'post', array(
21
+	register_post_type('post', array(
22 22
 		'labels' => array(
23
-			'name_admin_bar' => _x( 'Post', 'add new on admin bar' ),
23
+			'name_admin_bar' => _x('Post', 'add new on admin bar'),
24 24
 		),
25 25
 		'public'  => true,
26 26
 		'_builtin' => true, /* internal use only. don't use this when registering your own post type. */
@@ -32,12 +32,12 @@  discard block
 block discarded – undo
32 32
 		'rewrite' => false,
33 33
 		'query_var' => false,
34 34
 		'delete_with_user' => true,
35
-		'supports' => array( 'title', 'editor', 'author', 'thumbnail', 'excerpt', 'trackbacks', 'custom-fields', 'comments', 'revisions', 'post-formats' ),
36
-	) );
35
+		'supports' => array('title', 'editor', 'author', 'thumbnail', 'excerpt', 'trackbacks', 'custom-fields', 'comments', 'revisions', 'post-formats'),
36
+	));
37 37
 
38
-	register_post_type( 'page', array(
38
+	register_post_type('page', array(
39 39
 		'labels' => array(
40
-			'name_admin_bar' => _x( 'Page', 'add new on admin bar' ),
40
+			'name_admin_bar' => _x('Page', 'add new on admin bar'),
41 41
 		),
42 42
 		'public' => true,
43 43
 		'publicly_queryable' => false,
@@ -50,16 +50,16 @@  discard block
 block discarded – undo
50 50
 		'rewrite' => false,
51 51
 		'query_var' => false,
52 52
 		'delete_with_user' => true,
53
-		'supports' => array( 'title', 'editor', 'author', 'thumbnail', 'page-attributes', 'custom-fields', 'comments', 'revisions' ),
54
-	) );
53
+		'supports' => array('title', 'editor', 'author', 'thumbnail', 'page-attributes', 'custom-fields', 'comments', 'revisions'),
54
+	));
55 55
 
56
-	register_post_type( 'attachment', array(
56
+	register_post_type('attachment', array(
57 57
 		'labels' => array(
58 58
 			'name' => _x('Media', 'post type general name'),
59
-			'name_admin_bar' => _x( 'Media', 'add new from admin bar' ),
60
-			'add_new' => _x( 'Add New', 'add new media' ),
61
- 			'edit_item' => __( 'Edit Media' ),
62
- 			'view_item' => __( 'View Attachment Page' ),
59
+			'name_admin_bar' => _x('Media', 'add new from admin bar'),
60
+			'add_new' => _x('Add New', 'add new media'),
61
+ 			'edit_item' => __('Edit Media'),
62
+ 			'view_item' => __('View Attachment Page'),
63 63
 		),
64 64
 		'public' => true,
65 65
 		'show_ui' => true,
@@ -75,15 +75,15 @@  discard block
 block discarded – undo
75 75
 		'query_var' => false,
76 76
 		'show_in_nav_menus' => false,
77 77
 		'delete_with_user' => true,
78
-		'supports' => array( 'title', 'author', 'comments' ),
79
-	) );
80
-	add_post_type_support( 'attachment:audio', 'thumbnail' );
81
-	add_post_type_support( 'attachment:video', 'thumbnail' );
78
+		'supports' => array('title', 'author', 'comments'),
79
+	));
80
+	add_post_type_support('attachment:audio', 'thumbnail');
81
+	add_post_type_support('attachment:video', 'thumbnail');
82 82
 
83
-	register_post_type( 'revision', array(
83
+	register_post_type('revision', array(
84 84
 		'labels' => array(
85
-			'name' => __( 'Revisions' ),
86
-			'singular_name' => __( 'Revision' ),
85
+			'name' => __('Revisions'),
86
+			'singular_name' => __('Revision'),
87 87
 		),
88 88
 		'public' => false,
89 89
 		'_builtin' => true, /* internal use only. don't use this when registering your own post type. */
@@ -95,13 +95,13 @@  discard block
 block discarded – undo
95 95
 		'query_var' => false,
96 96
 		'can_export' => false,
97 97
 		'delete_with_user' => true,
98
-		'supports' => array( 'author' ),
99
-	) );
98
+		'supports' => array('author'),
99
+	));
100 100
 
101
-	register_post_type( 'nav_menu_item', array(
101
+	register_post_type('nav_menu_item', array(
102 102
 		'labels' => array(
103
-			'name' => __( 'Navigation Menu Items' ),
104
-			'singular_name' => __( 'Navigation Menu Item' ),
103
+			'name' => __('Navigation Menu Items'),
104
+			'singular_name' => __('Navigation Menu Item'),
105 105
 		),
106 106
 		'public' => false,
107 107
 		'_builtin' => true, /* internal use only. don't use this when registering your own post type. */
@@ -109,63 +109,63 @@  discard block
 block discarded – undo
109 109
 		'rewrite' => false,
110 110
 		'delete_with_user' => false,
111 111
 		'query_var' => false,
112
-	) );
112
+	));
113 113
 
114
-	register_post_status( 'publish', array(
115
-		'label'       => _x( 'Published', 'post status' ),
114
+	register_post_status('publish', array(
115
+		'label'       => _x('Published', 'post status'),
116 116
 		'public'      => true,
117 117
 		'_builtin'    => true, /* internal use only. */
118
-		'label_count' => _n_noop( 'Published <span class="count">(%s)</span>', 'Published <span class="count">(%s)</span>' ),
119
-	) );
118
+		'label_count' => _n_noop('Published <span class="count">(%s)</span>', 'Published <span class="count">(%s)</span>'),
119
+	));
120 120
 
121
-	register_post_status( 'future', array(
122
-		'label'       => _x( 'Scheduled', 'post status' ),
121
+	register_post_status('future', array(
122
+		'label'       => _x('Scheduled', 'post status'),
123 123
 		'protected'   => true,
124 124
 		'_builtin'    => true, /* internal use only. */
125
-		'label_count' => _n_noop('Scheduled <span class="count">(%s)</span>', 'Scheduled <span class="count">(%s)</span>' ),
126
-	) );
125
+		'label_count' => _n_noop('Scheduled <span class="count">(%s)</span>', 'Scheduled <span class="count">(%s)</span>'),
126
+	));
127 127
 
128
-	register_post_status( 'draft', array(
129
-		'label'       => _x( 'Draft', 'post status' ),
128
+	register_post_status('draft', array(
129
+		'label'       => _x('Draft', 'post status'),
130 130
 		'protected'   => true,
131 131
 		'_builtin'    => true, /* internal use only. */
132
-		'label_count' => _n_noop( 'Draft <span class="count">(%s)</span>', 'Drafts <span class="count">(%s)</span>' ),
133
-	) );
132
+		'label_count' => _n_noop('Draft <span class="count">(%s)</span>', 'Drafts <span class="count">(%s)</span>'),
133
+	));
134 134
 
135
-	register_post_status( 'pending', array(
136
-		'label'       => _x( 'Pending', 'post status' ),
135
+	register_post_status('pending', array(
136
+		'label'       => _x('Pending', 'post status'),
137 137
 		'protected'   => true,
138 138
 		'_builtin'    => true, /* internal use only. */
139
-		'label_count' => _n_noop( 'Pending <span class="count">(%s)</span>', 'Pending <span class="count">(%s)</span>' ),
140
-	) );
139
+		'label_count' => _n_noop('Pending <span class="count">(%s)</span>', 'Pending <span class="count">(%s)</span>'),
140
+	));
141 141
 
142
-	register_post_status( 'private', array(
143
-		'label'       => _x( 'Private', 'post status' ),
142
+	register_post_status('private', array(
143
+		'label'       => _x('Private', 'post status'),
144 144
 		'private'     => true,
145 145
 		'_builtin'    => true, /* internal use only. */
146
-		'label_count' => _n_noop( 'Private <span class="count">(%s)</span>', 'Private <span class="count">(%s)</span>' ),
147
-	) );
146
+		'label_count' => _n_noop('Private <span class="count">(%s)</span>', 'Private <span class="count">(%s)</span>'),
147
+	));
148 148
 
149
-	register_post_status( 'trash', array(
150
-		'label'       => _x( 'Trash', 'post status' ),
149
+	register_post_status('trash', array(
150
+		'label'       => _x('Trash', 'post status'),
151 151
 		'internal'    => true,
152 152
 		'_builtin'    => true, /* internal use only. */
153
-		'label_count' => _n_noop( 'Trash <span class="count">(%s)</span>', 'Trash <span class="count">(%s)</span>' ),
153
+		'label_count' => _n_noop('Trash <span class="count">(%s)</span>', 'Trash <span class="count">(%s)</span>'),
154 154
 		'show_in_admin_status_list' => true,
155
-	) );
155
+	));
156 156
 
157
-	register_post_status( 'auto-draft', array(
157
+	register_post_status('auto-draft', array(
158 158
 		'label'    => 'auto-draft',
159 159
 		'internal' => true,
160 160
 		'_builtin' => true, /* internal use only. */
161
-	) );
161
+	));
162 162
 
163
-	register_post_status( 'inherit', array(
163
+	register_post_status('inherit', array(
164 164
 		'label'    => 'inherit',
165 165
 		'internal' => true,
166 166
 		'_builtin' => true, /* internal use only. */
167 167
 		'exclude_from_search' => false,
168
-	) );
168
+	));
169 169
 }
170 170
 
171 171
 /**
@@ -186,15 +186,15 @@  discard block
 block discarded – undo
186 186
  * @param bool $unfiltered    Optional. Whether to apply filters. Default false.
187 187
  * @return string|false The file path to where the attached file should be, false otherwise.
188 188
  */
189
-function get_attached_file( $attachment_id, $unfiltered = false ) {
190
-	$file = get_post_meta( $attachment_id, '_wp_attached_file', true );
189
+function get_attached_file($attachment_id, $unfiltered = false) {
190
+	$file = get_post_meta($attachment_id, '_wp_attached_file', true);
191 191
 
192 192
 	// If the file is relative, prepend upload dir.
193
-	if ( $file && 0 !== strpos( $file, '/' ) && ! preg_match( '|^.:\\\|', $file ) && ( ( $uploads = wp_get_upload_dir() ) && false === $uploads['error'] ) ) {
194
-		$file = $uploads['basedir'] . "/$file";
193
+	if ($file && 0 !== strpos($file, '/') && ! preg_match('|^.:\\\|', $file) && (($uploads = wp_get_upload_dir()) && false === $uploads['error'])) {
194
+		$file = $uploads['basedir']."/$file";
195 195
 	}
196 196
 
197
-	if ( $unfiltered ) {
197
+	if ($unfiltered) {
198 198
 		return $file;
199 199
 	}
200 200
 
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
 	 * @param string $file          Path to attached file.
207 207
 	 * @param int    $attachment_id Attachment ID.
208 208
 	 */
209
-	return apply_filters( 'get_attached_file', $file, $attachment_id );
209
+	return apply_filters('get_attached_file', $file, $attachment_id);
210 210
 }
211 211
 
212 212
 /**
@@ -221,8 +221,8 @@  discard block
 block discarded – undo
221 221
  * @param string $file          File path for the attachment.
222 222
  * @return bool True on success, false on failure.
223 223
  */
224
-function update_attached_file( $attachment_id, $file ) {
225
-	if ( !get_post( $attachment_id ) )
224
+function update_attached_file($attachment_id, $file) {
225
+	if ( ! get_post($attachment_id))
226 226
 		return false;
227 227
 
228 228
 	/**
@@ -233,12 +233,12 @@  discard block
 block discarded – undo
233 233
 	 * @param string $file          Path to the attached file to update.
234 234
 	 * @param int    $attachment_id Attachment ID.
235 235
 	 */
236
-	$file = apply_filters( 'update_attached_file', $file, $attachment_id );
236
+	$file = apply_filters('update_attached_file', $file, $attachment_id);
237 237
 
238
-	if ( $file = _wp_relative_upload_path( $file ) )
239
-		return update_post_meta( $attachment_id, '_wp_attached_file', $file );
238
+	if ($file = _wp_relative_upload_path($file))
239
+		return update_post_meta($attachment_id, '_wp_attached_file', $file);
240 240
 	else
241
-		return delete_post_meta( $attachment_id, '_wp_attached_file' );
241
+		return delete_post_meta($attachment_id, '_wp_attached_file');
242 242
 }
243 243
 
244 244
 /**
@@ -251,13 +251,13 @@  discard block
 block discarded – undo
251 251
  * @param string $path Full path to the file.
252 252
  * @return string Relative path on success, unchanged path on failure.
253 253
  */
254
-function _wp_relative_upload_path( $path ) {
254
+function _wp_relative_upload_path($path) {
255 255
 	$new_path = $path;
256 256
 
257 257
 	$uploads = wp_get_upload_dir();
258
-	if ( 0 === strpos( $new_path, $uploads['basedir'] ) ) {
259
-			$new_path = str_replace( $uploads['basedir'], '', $new_path );
260
-			$new_path = ltrim( $new_path, '/' );
258
+	if (0 === strpos($new_path, $uploads['basedir'])) {
259
+			$new_path = str_replace($uploads['basedir'], '', $new_path);
260
+			$new_path = ltrim($new_path, '/');
261 261
 	}
262 262
 
263 263
 	/**
@@ -268,7 +268,7 @@  discard block
 block discarded – undo
268 268
 	 * @param string $new_path Relative path to the file.
269 269
 	 * @param string $path     Full path to the file.
270 270
 	 */
271
-	return apply_filters( '_wp_relative_upload_path', $new_path, $path );
271
+	return apply_filters('_wp_relative_upload_path', $new_path, $path);
272 272
 }
273 273
 
274 274
 /**
@@ -322,17 +322,17 @@  discard block
 block discarded – undo
322 322
  * @return array Array of children, where the type of each element is determined by $output parameter.
323 323
  *               Empty array on failure.
324 324
  */
325
-function get_children( $args = '', $output = OBJECT ) {
325
+function get_children($args = '', $output = OBJECT) {
326 326
 	$kids = array();
327
-	if ( empty( $args ) ) {
328
-		if ( isset( $GLOBALS['post'] ) ) {
329
-			$args = array('post_parent' => (int) $GLOBALS['post']->post_parent );
327
+	if (empty($args)) {
328
+		if (isset($GLOBALS['post'])) {
329
+			$args = array('post_parent' => (int) $GLOBALS['post']->post_parent);
330 330
 		} else {
331 331
 			return $kids;
332 332
 		}
333
-	} elseif ( is_object( $args ) ) {
334
-		$args = array('post_parent' => (int) $args->post_parent );
335
-	} elseif ( is_numeric( $args ) ) {
333
+	} elseif (is_object($args)) {
334
+		$args = array('post_parent' => (int) $args->post_parent);
335
+	} elseif (is_numeric($args)) {
336 336
 		$args = array('post_parent' => (int) $args);
337 337
 	}
338 338
 
@@ -341,32 +341,32 @@  discard block
 block discarded – undo
341 341
 		'post_status' => 'any', 'post_parent' => 0,
342 342
 	);
343 343
 
344
-	$r = wp_parse_args( $args, $defaults );
344
+	$r = wp_parse_args($args, $defaults);
345 345
 
346
-	$children = get_posts( $r );
346
+	$children = get_posts($r);
347 347
 
348
-	if ( ! $children )
348
+	if ( ! $children)
349 349
 		return $kids;
350 350
 
351
-	if ( ! empty( $r['fields'] ) )
351
+	if ( ! empty($r['fields']))
352 352
 		return $children;
353 353
 
354 354
 	update_post_cache($children);
355 355
 
356
-	foreach ( $children as $key => $child )
356
+	foreach ($children as $key => $child)
357 357
 		$kids[$child->ID] = $children[$key];
358 358
 
359
-	if ( $output == OBJECT ) {
359
+	if ($output == OBJECT) {
360 360
 		return $kids;
361
-	} elseif ( $output == ARRAY_A ) {
361
+	} elseif ($output == ARRAY_A) {
362 362
 		$weeuns = array();
363
-		foreach ( (array) $kids as $kid ) {
363
+		foreach ((array) $kids as $kid) {
364 364
 			$weeuns[$kid->ID] = get_object_vars($kids[$kid->ID]);
365 365
 		}
366 366
 		return $weeuns;
367
-	} elseif ( $output == ARRAY_N ) {
367
+	} elseif ($output == ARRAY_N) {
368 368
 		$babes = array();
369
-		foreach ( (array) $kids as $kid ) {
369
+		foreach ((array) $kids as $kid) {
370 370
 			$babes[$kid->ID] = array_values(get_object_vars($kids[$kid->ID]));
371 371
 		}
372 372
 		return $babes;
@@ -391,9 +391,9 @@  discard block
 block discarded – undo
391 391
  * @param string $post Post content.
392 392
  * @return array Post before ('main'), after ('extended'), and custom read more ('more_text').
393 393
  */
394
-function get_extended( $post ) {
394
+function get_extended($post) {
395 395
 	//Match the new style more links.
396
-	if ( preg_match('/<!--more(.*?)?-->/', $post, $matches) ) {
396
+	if (preg_match('/<!--more(.*?)?-->/', $post, $matches)) {
397 397
 		list($main, $extended) = explode($matches[0], $post, 2);
398 398
 		$more_text = $matches[1];
399 399
 	} else {
@@ -407,7 +407,7 @@  discard block
 block discarded – undo
407 407
 	$extended = preg_replace('/^[\s]*(.*)[\s]*$/', '\\1', $extended);
408 408
 	$more_text = preg_replace('/^[\s]*(.*)[\s]*$/', '\\1', $more_text);
409 409
 
410
-	return array( 'main' => $main, 'extended' => $extended, 'more_text' => $more_text );
410
+	return array('main' => $main, 'extended' => $extended, 'more_text' => $more_text);
411 411
 }
412 412
 
413 413
 /**
@@ -428,34 +428,34 @@  discard block
 block discarded – undo
428 428
  * @return WP_Post|array|null Type corresponding to $output on success or null on failure.
429 429
  *                            When $output is OBJECT, a `WP_Post` instance is returned.
430 430
  */
431
-function get_post( $post = null, $output = OBJECT, $filter = 'raw' ) {
432
-	if ( empty( $post ) && isset( $GLOBALS['post'] ) )
431
+function get_post($post = null, $output = OBJECT, $filter = 'raw') {
432
+	if (empty($post) && isset($GLOBALS['post']))
433 433
 		$post = $GLOBALS['post'];
434 434
 
435
-	if ( $post instanceof WP_Post ) {
435
+	if ($post instanceof WP_Post) {
436 436
 		$_post = $post;
437
-	} elseif ( is_object( $post ) ) {
438
-		if ( empty( $post->filter ) ) {
439
-			$_post = sanitize_post( $post, 'raw' );
440
-			$_post = new WP_Post( $_post );
441
-		} elseif ( 'raw' == $post->filter ) {
442
-			$_post = new WP_Post( $post );
437
+	} elseif (is_object($post)) {
438
+		if (empty($post->filter)) {
439
+			$_post = sanitize_post($post, 'raw');
440
+			$_post = new WP_Post($_post);
441
+		} elseif ('raw' == $post->filter) {
442
+			$_post = new WP_Post($post);
443 443
 		} else {
444
-			$_post = WP_Post::get_instance( $post->ID );
444
+			$_post = WP_Post::get_instance($post->ID);
445 445
 		}
446 446
 	} else {
447
-		$_post = WP_Post::get_instance( $post );
447
+		$_post = WP_Post::get_instance($post);
448 448
 	}
449 449
 
450
-	if ( ! $_post )
450
+	if ( ! $_post)
451 451
 		return null;
452 452
 
453
-	$_post = $_post->filter( $filter );
453
+	$_post = $_post->filter($filter);
454 454
 
455
-	if ( $output == ARRAY_A )
455
+	if ($output == ARRAY_A)
456 456
 		return $_post->to_array();
457
-	elseif ( $output == ARRAY_N )
458
-		return array_values( $_post->to_array() );
457
+	elseif ($output == ARRAY_N)
458
+		return array_values($_post->to_array());
459 459
 
460 460
 	return $_post;
461 461
 }
@@ -468,19 +468,19 @@  discard block
 block discarded – undo
468 468
  * @param int|WP_Post $post Post ID or post object.
469 469
  * @return array Ancestor IDs or empty array if none are found.
470 470
  */
471
-function get_post_ancestors( $post ) {
472
-	$post = get_post( $post );
471
+function get_post_ancestors($post) {
472
+	$post = get_post($post);
473 473
 
474
-	if ( ! $post || empty( $post->post_parent ) || $post->post_parent == $post->ID )
474
+	if ( ! $post || empty($post->post_parent) || $post->post_parent == $post->ID)
475 475
 		return array();
476 476
 
477 477
 	$ancestors = array();
478 478
 
479 479
 	$id = $ancestors[] = $post->post_parent;
480 480
 
481
-	while ( $ancestor = get_post( $id ) ) {
481
+	while ($ancestor = get_post($id)) {
482 482
 		// Loop detection: If the ancestor has been seen before, break.
483
-		if ( empty( $ancestor->post_parent ) || ( $ancestor->post_parent == $post->ID ) || in_array( $ancestor->post_parent, $ancestors ) )
483
+		if (empty($ancestor->post_parent) || ($ancestor->post_parent == $post->ID) || in_array($ancestor->post_parent, $ancestors))
484 484
 			break;
485 485
 
486 486
 		$id = $ancestors[] = $ancestor->post_parent;
@@ -509,13 +509,13 @@  discard block
 block discarded – undo
509 509
  *                             or 'display'. Default 'display'.
510 510
  * @return string The value of the post field on success, empty string on failure.
511 511
  */
512
-function get_post_field( $field, $post = null, $context = 'display' ) {
513
-	$post = get_post( $post );
512
+function get_post_field($field, $post = null, $context = 'display') {
513
+	$post = get_post($post);
514 514
 
515
-	if ( !$post )
515
+	if ( ! $post)
516 516
 		return '';
517 517
 
518
-	if ( !isset($post->$field) )
518
+	if ( ! isset($post->$field))
519 519
 		return '';
520 520
 
521 521
 	return sanitize_post_field($field, $post->$field, $post->ID, $context);
@@ -532,10 +532,10 @@  discard block
 block discarded – undo
532 532
  * @param int|WP_Post $ID Optional. Post ID or post object. Default empty.
533 533
  * @return string|false The mime type on success, false on failure.
534 534
  */
535
-function get_post_mime_type( $ID = '' ) {
535
+function get_post_mime_type($ID = '') {
536 536
 	$post = get_post($ID);
537 537
 
538
-	if ( is_object($post) )
538
+	if (is_object($post))
539 539
 		return $post->post_mime_type;
540 540
 
541 541
 	return false;
@@ -552,25 +552,25 @@  discard block
 block discarded – undo
552 552
  * @param int|WP_Post $ID Optional. Post ID or post object. Default empty.
553 553
  * @return string|false Post status on success, false on failure.
554 554
  */
555
-function get_post_status( $ID = '' ) {
555
+function get_post_status($ID = '') {
556 556
 	$post = get_post($ID);
557 557
 
558
-	if ( !is_object($post) )
558
+	if ( ! is_object($post))
559 559
 		return false;
560 560
 
561
-	if ( 'attachment' == $post->post_type ) {
562
-		if ( 'private' == $post->post_status )
561
+	if ('attachment' == $post->post_type) {
562
+		if ('private' == $post->post_status)
563 563
 			return 'private';
564 564
 
565 565
 		// Unattached attachments are assumed to be published.
566
-		if ( ( 'inherit' == $post->post_status ) && ( 0 == $post->post_parent) )
566
+		if (('inherit' == $post->post_status) && (0 == $post->post_parent))
567 567
 			return 'publish';
568 568
 
569 569
 		// Inherit status from the parent.
570
-		if ( $post->post_parent && ( $post->ID != $post->post_parent ) ) {
571
-			$parent_post_status = get_post_status( $post->post_parent );
572
-			if ( 'trash' == $parent_post_status ) {
573
-				return get_post_meta( $post->post_parent, '_wp_trash_meta_status', true );
570
+		if ($post->post_parent && ($post->ID != $post->post_parent)) {
571
+			$parent_post_status = get_post_status($post->post_parent);
572
+			if ('trash' == $parent_post_status) {
573
+				return get_post_meta($post->post_parent, '_wp_trash_meta_status', true);
574 574
 			} else {
575 575
 				return $parent_post_status;
576 576
 			}
@@ -586,7 +586,7 @@  discard block
 block discarded – undo
586 586
 	 * @param string  $post_status The post status.
587 587
 	 * @param WP_Post $post        The post object.
588 588
 	 */
589
-	return apply_filters( 'get_post_status', $post->post_status, $post );
589
+	return apply_filters('get_post_status', $post->post_status, $post);
590 590
 }
591 591
 
592 592
 /**
@@ -601,10 +601,10 @@  discard block
 block discarded – undo
601 601
  */
602 602
 function get_post_statuses() {
603 603
 	$status = array(
604
-		'draft'   => __( 'Draft' ),
605
-		'pending' => __( 'Pending Review' ),
606
-		'private' => __( 'Private' ),
607
-		'publish' => __( 'Published' )
604
+		'draft'   => __('Draft'),
605
+		'pending' => __('Pending Review'),
606
+		'private' => __('Private'),
607
+		'publish' => __('Published')
608 608
 	);
609 609
 
610 610
 	return $status;
@@ -622,9 +622,9 @@  discard block
 block discarded – undo
622 622
  */
623 623
 function get_page_statuses() {
624 624
 	$status = array(
625
-		'draft'   => __( 'Draft' ),
626
-		'private' => __( 'Private' ),
627
-		'publish' => __( 'Published' )
625
+		'draft'   => __('Draft'),
626
+		'private' => __('Private'),
627
+		'publish' => __('Published')
628 628
 	);
629 629
 
630 630
 	return $status;
@@ -673,10 +673,10 @@  discard block
 block discarded – undo
673 673
  * }
674 674
  * @return object
675 675
  */
676
-function register_post_status( $post_status, $args = array() ) {
676
+function register_post_status($post_status, $args = array()) {
677 677
 	global $wp_post_statuses;
678 678
 
679
-	if (!is_array($wp_post_statuses))
679
+	if ( ! is_array($wp_post_statuses))
680 680
 		$wp_post_statuses = array();
681 681
 
682 682
 	// Args prefixed with an underscore are reserved for internal use.
@@ -700,38 +700,38 @@  discard block
 block discarded – undo
700 700
 	$args->name = $post_status;
701 701
 
702 702
 	// Set various defaults.
703
-	if ( null === $args->public && null === $args->internal && null === $args->protected && null === $args->private )
703
+	if (null === $args->public && null === $args->internal && null === $args->protected && null === $args->private)
704 704
 		$args->internal = true;
705 705
 
706
-	if ( null === $args->public  )
706
+	if (null === $args->public)
707 707
 		$args->public = false;
708 708
 
709
-	if ( null === $args->private  )
709
+	if (null === $args->private)
710 710
 		$args->private = false;
711 711
 
712
-	if ( null === $args->protected  )
712
+	if (null === $args->protected)
713 713
 		$args->protected = false;
714 714
 
715
-	if ( null === $args->internal  )
715
+	if (null === $args->internal)
716 716
 		$args->internal = false;
717 717
 
718
-	if ( null === $args->publicly_queryable )
718
+	if (null === $args->publicly_queryable)
719 719
 		$args->publicly_queryable = $args->public;
720 720
 
721
-	if ( null === $args->exclude_from_search )
721
+	if (null === $args->exclude_from_search)
722 722
 		$args->exclude_from_search = $args->internal;
723 723
 
724
-	if ( null === $args->show_in_admin_all_list )
725
-		$args->show_in_admin_all_list = !$args->internal;
724
+	if (null === $args->show_in_admin_all_list)
725
+		$args->show_in_admin_all_list = ! $args->internal;
726 726
 
727
-	if ( null === $args->show_in_admin_status_list )
728
-		$args->show_in_admin_status_list = !$args->internal;
727
+	if (null === $args->show_in_admin_status_list)
728
+		$args->show_in_admin_status_list = ! $args->internal;
729 729
 
730
-	if ( false === $args->label )
730
+	if (false === $args->label)
731 731
 		$args->label = $post_status;
732 732
 
733
-	if ( false === $args->label_count )
734
-		$args->label_count = array( $args->label, $args->label );
733
+	if (false === $args->label_count)
734
+		$args->label_count = array($args->label, $args->label);
735 735
 
736 736
 	$wp_post_statuses[$post_status] = $args;
737 737
 
@@ -750,10 +750,10 @@  discard block
 block discarded – undo
750 750
  * @param string $post_status The name of a registered post status.
751 751
  * @return object|null A post status object.
752 752
  */
753
-function get_post_status_object( $post_status ) {
753
+function get_post_status_object($post_status) {
754 754
 	global $wp_post_statuses;
755 755
 
756
-	if ( empty($wp_post_statuses[$post_status]) )
756
+	if (empty($wp_post_statuses[$post_status]))
757 757
 		return null;
758 758
 
759 759
 	return $wp_post_statuses[$post_status];
@@ -776,7 +776,7 @@  discard block
 block discarded – undo
776 776
  *                               Default 'and'.
777 777
  * @return array A list of post status names or objects.
778 778
  */
779
-function get_post_stati( $args = array(), $output = 'names', $operator = 'and' ) {
779
+function get_post_stati($args = array(), $output = 'names', $operator = 'and') {
780 780
 	global $wp_post_statuses;
781 781
 
782 782
 	$field = ('names' == $output) ? 'name' : false;
@@ -796,11 +796,11 @@  discard block
 block discarded – undo
796 796
  * @param string $post_type Post type name
797 797
  * @return bool Whether post type is hierarchical.
798 798
  */
799
-function is_post_type_hierarchical( $post_type ) {
800
-	if ( ! post_type_exists( $post_type ) )
799
+function is_post_type_hierarchical($post_type) {
800
+	if ( ! post_type_exists($post_type))
801 801
 		return false;
802 802
 
803
-	$post_type = get_post_type_object( $post_type );
803
+	$post_type = get_post_type_object($post_type);
804 804
 	return $post_type->hierarchical;
805 805
 }
806 806
 
@@ -814,8 +814,8 @@  discard block
 block discarded – undo
814 814
  * @param string $post_type Post type name.
815 815
  * @return bool Whether post type is registered.
816 816
  */
817
-function post_type_exists( $post_type ) {
818
-	return (bool) get_post_type_object( $post_type );
817
+function post_type_exists($post_type) {
818
+	return (bool) get_post_type_object($post_type);
819 819
 }
820 820
 
821 821
 /**
@@ -826,8 +826,8 @@  discard block
 block discarded – undo
826 826
  * @param int|WP_Post|null $post Optional. Post ID or post object. Default is global $post.
827 827
  * @return string|false          Post type on success, false on failure.
828 828
  */
829
-function get_post_type( $post = null ) {
830
-	if ( $post = get_post( $post ) )
829
+function get_post_type($post = null) {
830
+	if ($post = get_post($post))
831 831
 		return $post->post_type;
832 832
 
833 833
 	return false;
@@ -846,14 +846,14 @@  discard block
 block discarded – undo
846 846
  * @param string $post_type The name of a registered post type.
847 847
  * @return WP_Post_Type|null WP_Post_Type object if it exists, null otherwise.
848 848
  */
849
-function get_post_type_object( $post_type ) {
849
+function get_post_type_object($post_type) {
850 850
 	global $wp_post_types;
851 851
 
852
-	if ( ! is_scalar( $post_type ) || empty( $wp_post_types[ $post_type ] ) ) {
852
+	if ( ! is_scalar($post_type) || empty($wp_post_types[$post_type])) {
853 853
 		return null;
854 854
 	}
855 855
 
856
-	return $wp_post_types[ $post_type ];
856
+	return $wp_post_types[$post_type];
857 857
 }
858 858
 
859 859
 /**
@@ -874,7 +874,7 @@  discard block
 block discarded – undo
874 874
  *                               must match; 'not' means no elements may match. Default 'and'.
875 875
  * @return array A list of post type names or objects.
876 876
  */
877
-function get_post_types( $args = array(), $output = 'names', $operator = 'and' ) {
877
+function get_post_types($args = array(), $output = 'names', $operator = 'and') {
878 878
 	global $wp_post_types;
879 879
 
880 880
 	$field = ('names' == $output) ? 'name' : false;
@@ -1013,27 +1013,27 @@  discard block
 block discarded – undo
1013 1013
  * }
1014 1014
  * @return WP_Post_Type|WP_Error The registered post type object, or an error object.
1015 1015
  */
1016
-function register_post_type( $post_type, $args = array() ) {
1016
+function register_post_type($post_type, $args = array()) {
1017 1017
 	global $wp_post_types;
1018 1018
 
1019
-	if ( ! is_array( $wp_post_types ) ) {
1019
+	if ( ! is_array($wp_post_types)) {
1020 1020
 		$wp_post_types = array();
1021 1021
 	}
1022 1022
 
1023 1023
 	// Sanitize post type name
1024
-	$post_type = sanitize_key( $post_type );
1024
+	$post_type = sanitize_key($post_type);
1025 1025
 
1026
-	if ( empty( $post_type ) || strlen( $post_type ) > 20 ) {
1027
-		_doing_it_wrong( __FUNCTION__, __( 'Post type names must be between 1 and 20 characters in length.' ), '4.2.0' );
1028
-		return new WP_Error( 'post_type_length_invalid', __( 'Post type names must be between 1 and 20 characters in length.' ) );
1026
+	if (empty($post_type) || strlen($post_type) > 20) {
1027
+		_doing_it_wrong(__FUNCTION__, __('Post type names must be between 1 and 20 characters in length.'), '4.2.0');
1028
+		return new WP_Error('post_type_length_invalid', __('Post type names must be between 1 and 20 characters in length.'));
1029 1029
 	}
1030 1030
 
1031
-	$post_type_object = new WP_Post_Type( $post_type, $args );
1031
+	$post_type_object = new WP_Post_Type($post_type, $args);
1032 1032
 	$post_type_object->add_supports();
1033 1033
 	$post_type_object->add_rewrite_rules();
1034 1034
 	$post_type_object->register_meta_boxes();
1035 1035
 
1036
-	$wp_post_types[ $post_type ] = $post_type_object;
1036
+	$wp_post_types[$post_type] = $post_type_object;
1037 1037
 
1038 1038
 	$post_type_object->add_hooks();
1039 1039
 	$post_type_object->register_taxonomies();
@@ -1047,7 +1047,7 @@  discard block
 block discarded – undo
1047 1047
 	 * @param string       $post_type        Post type.
1048 1048
 	 * @param WP_Post_Type $post_type_object Arguments used to register the post type.
1049 1049
 	 */
1050
-	do_action( 'registered_post_type', $post_type, $post_type_object );
1050
+	do_action('registered_post_type', $post_type, $post_type_object);
1051 1051
 
1052 1052
 	return $post_type_object;
1053 1053
 }
@@ -1064,18 +1064,18 @@  discard block
 block discarded – undo
1064 1064
  * @param string $post_type Post type to unregister.
1065 1065
  * @return bool|WP_Error True on success, WP_Error on failure or if the post type doesn't exist.
1066 1066
  */
1067
-function unregister_post_type( $post_type ) {
1067
+function unregister_post_type($post_type) {
1068 1068
 	global $wp_post_types;
1069 1069
 
1070
-	if ( ! post_type_exists( $post_type ) ) {
1071
-		return new WP_Error( 'invalid_post_type', __( 'Invalid post type.' ) );
1070
+	if ( ! post_type_exists($post_type)) {
1071
+		return new WP_Error('invalid_post_type', __('Invalid post type.'));
1072 1072
 	}
1073 1073
 
1074
-	$post_type_object = get_post_type_object( $post_type );
1074
+	$post_type_object = get_post_type_object($post_type);
1075 1075
 
1076 1076
 	// Do not allow unregistering internal post types.
1077
-	if ( $post_type_object->_builtin ) {
1078
-		return new WP_Error( 'invalid_post_type', __( 'Unregistering a built-in post type is not allowed' ) );
1077
+	if ($post_type_object->_builtin) {
1078
+		return new WP_Error('invalid_post_type', __('Unregistering a built-in post type is not allowed'));
1079 1079
 	}
1080 1080
 
1081 1081
 	$post_type_object->remove_supports();
@@ -1084,7 +1084,7 @@  discard block
 block discarded – undo
1084 1084
 	$post_type_object->remove_hooks();
1085 1085
 	$post_type_object->unregister_taxonomies();
1086 1086
 
1087
-	unset( $wp_post_types[ $post_type ] );
1087
+	unset($wp_post_types[$post_type]);
1088 1088
 
1089 1089
 	/**
1090 1090
 	 * Fires after a post type was unregistered.
@@ -1093,7 +1093,7 @@  discard block
 block discarded – undo
1093 1093
 	 *
1094 1094
 	 * @param string $post_type Post type key.
1095 1095
 	 */
1096
-	do_action( 'unregistered_post_type', $post_type );
1096
+	do_action('unregistered_post_type', $post_type);
1097 1097
 
1098 1098
 	return true;
1099 1099
 }
@@ -1153,48 +1153,48 @@  discard block
 block discarded – undo
1153 1153
  * @param object $args Post type registration arguments.
1154 1154
  * @return object object with all the capabilities as member variables.
1155 1155
  */
1156
-function get_post_type_capabilities( $args ) {
1157
-	if ( ! is_array( $args->capability_type ) )
1158
-		$args->capability_type = array( $args->capability_type, $args->capability_type . 's' );
1156
+function get_post_type_capabilities($args) {
1157
+	if ( ! is_array($args->capability_type))
1158
+		$args->capability_type = array($args->capability_type, $args->capability_type.'s');
1159 1159
 
1160 1160
 	// Singular base for meta capabilities, plural base for primitive capabilities.
1161
-	list( $singular_base, $plural_base ) = $args->capability_type;
1161
+	list($singular_base, $plural_base) = $args->capability_type;
1162 1162
 
1163 1163
 	$default_capabilities = array(
1164 1164
 		// Meta capabilities
1165
-		'edit_post'          => 'edit_'         . $singular_base,
1166
-		'read_post'          => 'read_'         . $singular_base,
1167
-		'delete_post'        => 'delete_'       . $singular_base,
1165
+		'edit_post'          => 'edit_'.$singular_base,
1166
+		'read_post'          => 'read_'.$singular_base,
1167
+		'delete_post'        => 'delete_'.$singular_base,
1168 1168
 		// Primitive capabilities used outside of map_meta_cap():
1169
-		'edit_posts'         => 'edit_'         . $plural_base,
1170
-		'edit_others_posts'  => 'edit_others_'  . $plural_base,
1171
-		'publish_posts'      => 'publish_'      . $plural_base,
1172
-		'read_private_posts' => 'read_private_' . $plural_base,
1169
+		'edit_posts'         => 'edit_'.$plural_base,
1170
+		'edit_others_posts'  => 'edit_others_'.$plural_base,
1171
+		'publish_posts'      => 'publish_'.$plural_base,
1172
+		'read_private_posts' => 'read_private_'.$plural_base,
1173 1173
 	);
1174 1174
 
1175 1175
 	// Primitive capabilities used within map_meta_cap():
1176
-	if ( $args->map_meta_cap ) {
1176
+	if ($args->map_meta_cap) {
1177 1177
 		$default_capabilities_for_mapping = array(
1178 1178
 			'read'                   => 'read',
1179
-			'delete_posts'           => 'delete_'           . $plural_base,
1180
-			'delete_private_posts'   => 'delete_private_'   . $plural_base,
1181
-			'delete_published_posts' => 'delete_published_' . $plural_base,
1182
-			'delete_others_posts'    => 'delete_others_'    . $plural_base,
1183
-			'edit_private_posts'     => 'edit_private_'     . $plural_base,
1184
-			'edit_published_posts'   => 'edit_published_'   . $plural_base,
1179
+			'delete_posts'           => 'delete_'.$plural_base,
1180
+			'delete_private_posts'   => 'delete_private_'.$plural_base,
1181
+			'delete_published_posts' => 'delete_published_'.$plural_base,
1182
+			'delete_others_posts'    => 'delete_others_'.$plural_base,
1183
+			'edit_private_posts'     => 'edit_private_'.$plural_base,
1184
+			'edit_published_posts'   => 'edit_published_'.$plural_base,
1185 1185
 		);
1186
-		$default_capabilities = array_merge( $default_capabilities, $default_capabilities_for_mapping );
1186
+		$default_capabilities = array_merge($default_capabilities, $default_capabilities_for_mapping);
1187 1187
 	}
1188 1188
 
1189
-	$capabilities = array_merge( $default_capabilities, $args->capabilities );
1189
+	$capabilities = array_merge($default_capabilities, $args->capabilities);
1190 1190
 
1191 1191
 	// Post creation capability simply maps to edit_posts by default:
1192
-	if ( ! isset( $capabilities['create_posts'] ) )
1192
+	if ( ! isset($capabilities['create_posts']))
1193 1193
 		$capabilities['create_posts'] = $capabilities['edit_posts'];
1194 1194
 
1195 1195
 	// Remember meta capabilities for future reference.
1196
-	if ( $args->map_meta_cap )
1197
-		_post_type_meta_capabilities( $capabilities );
1196
+	if ($args->map_meta_cap)
1197
+		_post_type_meta_capabilities($capabilities);
1198 1198
 
1199 1199
 	return (object) $capabilities;
1200 1200
 }
@@ -1209,12 +1209,12 @@  discard block
 block discarded – undo
1209 1209
  *
1210 1210
  * @param array $capabilities Post type meta capabilities.
1211 1211
  */
1212
-function _post_type_meta_capabilities( $capabilities = null ) {
1212
+function _post_type_meta_capabilities($capabilities = null) {
1213 1213
 	global $post_type_meta_caps;
1214 1214
 
1215
-	foreach ( $capabilities as $core => $custom ) {
1216
-		if ( in_array( $core, array( 'read_post', 'delete_post', 'edit_post' ) ) ) {
1217
-			$post_type_meta_caps[ $custom ] = $core;
1215
+	foreach ($capabilities as $core => $custom) {
1216
+		if (in_array($core, array('read_post', 'delete_post', 'edit_post'))) {
1217
+			$post_type_meta_caps[$custom] = $core;
1218 1218
 		}
1219 1219
 	}
1220 1220
 }
@@ -1273,34 +1273,34 @@  discard block
 block discarded – undo
1273 1273
  * @param object|WP_Post_Type $post_type_object Post type object.
1274 1274
  * @return object Object with all the labels as member variables.
1275 1275
  */
1276
-function get_post_type_labels( $post_type_object ) {
1276
+function get_post_type_labels($post_type_object) {
1277 1277
 	$nohier_vs_hier_defaults = array(
1278
-		'name' => array( _x('Posts', 'post type general name'), _x('Pages', 'post type general name') ),
1279
-		'singular_name' => array( _x('Post', 'post type singular name'), _x('Page', 'post type singular name') ),
1280
-		'add_new' => array( _x('Add New', 'post'), _x('Add New', 'page') ),
1281
-		'add_new_item' => array( __('Add New Post'), __('Add New Page') ),
1282
-		'edit_item' => array( __('Edit Post'), __('Edit Page') ),
1283
-		'new_item' => array( __('New Post'), __('New Page') ),
1284
-		'view_item' => array( __('View Post'), __('View Page') ),
1285
-		'search_items' => array( __('Search Posts'), __('Search Pages') ),
1286
-		'not_found' => array( __('No posts found.'), __('No pages found.') ),
1287
-		'not_found_in_trash' => array( __('No posts found in Trash.'), __('No pages found in Trash.') ),
1288
-		'parent_item_colon' => array( null, __('Parent Page:') ),
1289
-		'all_items' => array( __( 'All Posts' ), __( 'All Pages' ) ),
1290
-		'archives' => array( __( 'Post Archives' ), __( 'Page Archives' ) ),
1291
-		'insert_into_item' => array( __( 'Insert into post' ), __( 'Insert into page' ) ),
1292
-		'uploaded_to_this_item' => array( __( 'Uploaded to this post' ), __( 'Uploaded to this page' ) ),
1293
-		'featured_image' => array( __( 'Featured Image' ), __( 'Featured Image' ) ),
1294
-		'set_featured_image' => array( __( 'Set featured image' ), __( 'Set featured image' ) ),
1295
-		'remove_featured_image' => array( __( 'Remove featured image' ), __( 'Remove featured image' ) ),
1296
-		'use_featured_image' => array( __( 'Use as featured image' ), __( 'Use as featured image' ) ),
1297
-		'filter_items_list' => array( __( 'Filter posts list' ), __( 'Filter pages list' ) ),
1298
-		'items_list_navigation' => array( __( 'Posts list navigation' ), __( 'Pages list navigation' ) ),
1299
-		'items_list' => array( __( 'Posts list' ), __( 'Pages list' ) ),
1278
+		'name' => array(_x('Posts', 'post type general name'), _x('Pages', 'post type general name')),
1279
+		'singular_name' => array(_x('Post', 'post type singular name'), _x('Page', 'post type singular name')),
1280
+		'add_new' => array(_x('Add New', 'post'), _x('Add New', 'page')),
1281
+		'add_new_item' => array(__('Add New Post'), __('Add New Page')),
1282
+		'edit_item' => array(__('Edit Post'), __('Edit Page')),
1283
+		'new_item' => array(__('New Post'), __('New Page')),
1284
+		'view_item' => array(__('View Post'), __('View Page')),
1285
+		'search_items' => array(__('Search Posts'), __('Search Pages')),
1286
+		'not_found' => array(__('No posts found.'), __('No pages found.')),
1287
+		'not_found_in_trash' => array(__('No posts found in Trash.'), __('No pages found in Trash.')),
1288
+		'parent_item_colon' => array(null, __('Parent Page:')),
1289
+		'all_items' => array(__('All Posts'), __('All Pages')),
1290
+		'archives' => array(__('Post Archives'), __('Page Archives')),
1291
+		'insert_into_item' => array(__('Insert into post'), __('Insert into page')),
1292
+		'uploaded_to_this_item' => array(__('Uploaded to this post'), __('Uploaded to this page')),
1293
+		'featured_image' => array(__('Featured Image'), __('Featured Image')),
1294
+		'set_featured_image' => array(__('Set featured image'), __('Set featured image')),
1295
+		'remove_featured_image' => array(__('Remove featured image'), __('Remove featured image')),
1296
+		'use_featured_image' => array(__('Use as featured image'), __('Use as featured image')),
1297
+		'filter_items_list' => array(__('Filter posts list'), __('Filter pages list')),
1298
+		'items_list_navigation' => array(__('Posts list navigation'), __('Pages list navigation')),
1299
+		'items_list' => array(__('Posts list'), __('Pages list')),
1300 1300
 	);
1301 1301
 	$nohier_vs_hier_defaults['menu_name'] = $nohier_vs_hier_defaults['name'];
1302 1302
 
1303
-	$labels = _get_custom_object_labels( $post_type_object, $nohier_vs_hier_defaults );
1303
+	$labels = _get_custom_object_labels($post_type_object, $nohier_vs_hier_defaults);
1304 1304
 
1305 1305
 	$post_type = $post_type_object->name;
1306 1306
 
@@ -1318,10 +1318,10 @@  discard block
 block discarded – undo
1318 1318
 	 *
1319 1319
 	 * @param object $labels Object with labels for the post type as member variables.
1320 1320
 	 */
1321
-	$labels = apply_filters( "post_type_labels_{$post_type}", $labels );
1321
+	$labels = apply_filters("post_type_labels_{$post_type}", $labels);
1322 1322
 
1323 1323
 	// Ensure that the filtered labels contain all required default values.
1324
-	$labels = (object) array_merge( (array) $default_labels, (array) $labels );
1324
+	$labels = (object) array_merge((array) $default_labels, (array) $labels);
1325 1325
 
1326 1326
 	return $labels;
1327 1327
 }
@@ -1337,33 +1337,33 @@  discard block
 block discarded – undo
1337 1337
  * @param array  $nohier_vs_hier_defaults Hierarchical vs non-hierarchical default labels.
1338 1338
  * @return object Object containing labels for the given custom-something object.
1339 1339
  */
1340
-function _get_custom_object_labels( $object, $nohier_vs_hier_defaults ) {
1340
+function _get_custom_object_labels($object, $nohier_vs_hier_defaults) {
1341 1341
 	$object->labels = (array) $object->labels;
1342 1342
 
1343
-	if ( isset( $object->label ) && empty( $object->labels['name'] ) )
1343
+	if (isset($object->label) && empty($object->labels['name']))
1344 1344
 		$object->labels['name'] = $object->label;
1345 1345
 
1346
-	if ( !isset( $object->labels['singular_name'] ) && isset( $object->labels['name'] ) )
1346
+	if ( ! isset($object->labels['singular_name']) && isset($object->labels['name']))
1347 1347
 		$object->labels['singular_name'] = $object->labels['name'];
1348 1348
 
1349
-	if ( ! isset( $object->labels['name_admin_bar'] ) )
1350
-		$object->labels['name_admin_bar'] = isset( $object->labels['singular_name'] ) ? $object->labels['singular_name'] : $object->name;
1349
+	if ( ! isset($object->labels['name_admin_bar']))
1350
+		$object->labels['name_admin_bar'] = isset($object->labels['singular_name']) ? $object->labels['singular_name'] : $object->name;
1351 1351
 
1352
-	if ( !isset( $object->labels['menu_name'] ) && isset( $object->labels['name'] ) )
1352
+	if ( ! isset($object->labels['menu_name']) && isset($object->labels['name']))
1353 1353
 		$object->labels['menu_name'] = $object->labels['name'];
1354 1354
 
1355
-	if ( !isset( $object->labels['all_items'] ) && isset( $object->labels['menu_name'] ) )
1355
+	if ( ! isset($object->labels['all_items']) && isset($object->labels['menu_name']))
1356 1356
 		$object->labels['all_items'] = $object->labels['menu_name'];
1357 1357
 
1358
-	if ( !isset( $object->labels['archives'] ) && isset( $object->labels['all_items'] ) ) {
1358
+	if ( ! isset($object->labels['archives']) && isset($object->labels['all_items'])) {
1359 1359
 		$object->labels['archives'] = $object->labels['all_items'];
1360 1360
 	}
1361 1361
 
1362 1362
 	$defaults = array();
1363
-	foreach ( $nohier_vs_hier_defaults as $key => $value ) {
1363
+	foreach ($nohier_vs_hier_defaults as $key => $value) {
1364 1364
 		$defaults[$key] = $object->hierarchical ? $value[1] : $value[0];
1365 1365
 	}
1366
-	$labels = array_merge( $defaults, $object->labels );
1366
+	$labels = array_merge($defaults, $object->labels);
1367 1367
 	$object->labels = (object) $object->labels;
1368 1368
 
1369 1369
 	return (object) $labels;
@@ -1376,12 +1376,12 @@  discard block
 block discarded – undo
1376 1376
  * @since 3.1.0
1377 1377
  */
1378 1378
 function _add_post_type_submenus() {
1379
-	foreach ( get_post_types( array( 'show_ui' => true ) ) as $ptype ) {
1380
-		$ptype_obj = get_post_type_object( $ptype );
1379
+	foreach (get_post_types(array('show_ui' => true)) as $ptype) {
1380
+		$ptype_obj = get_post_type_object($ptype);
1381 1381
 		// Sub-menus only.
1382
-		if ( ! $ptype_obj->show_in_menu || $ptype_obj->show_in_menu === true )
1382
+		if ( ! $ptype_obj->show_in_menu || $ptype_obj->show_in_menu === true)
1383 1383
 			continue;
1384
-		add_submenu_page( $ptype_obj->show_in_menu, $ptype_obj->labels->name, $ptype_obj->labels->all_items, $ptype_obj->cap->edit_posts, "edit.php?post_type=$ptype" );
1384
+		add_submenu_page($ptype_obj->show_in_menu, $ptype_obj->labels->name, $ptype_obj->labels->all_items, $ptype_obj->cap->edit_posts, "edit.php?post_type=$ptype");
1385 1385
 	}
1386 1386
 }
1387 1387
 
@@ -1405,15 +1405,15 @@  discard block
 block discarded – undo
1405 1405
  * @param string|array $feature   The feature being added, accepts an array of
1406 1406
  *                                feature strings or a single string.
1407 1407
  */
1408
-function add_post_type_support( $post_type, $feature ) {
1408
+function add_post_type_support($post_type, $feature) {
1409 1409
 	global $_wp_post_type_features;
1410 1410
 
1411 1411
 	$features = (array) $feature;
1412 1412
 	foreach ($features as $feature) {
1413
-		if ( func_num_args() == 2 )
1413
+		if (func_num_args() == 2)
1414 1414
 			$_wp_post_type_features[$post_type][$feature] = true;
1415 1415
 		else
1416
-			$_wp_post_type_features[$post_type][$feature] = array_slice( func_get_args(), 2 );
1416
+			$_wp_post_type_features[$post_type][$feature] = array_slice(func_get_args(), 2);
1417 1417
 	}
1418 1418
 }
1419 1419
 
@@ -1427,10 +1427,10 @@  discard block
 block discarded – undo
1427 1427
  * @param string $post_type The post type for which to remove the feature.
1428 1428
  * @param string $feature   The feature being removed.
1429 1429
  */
1430
-function remove_post_type_support( $post_type, $feature ) {
1430
+function remove_post_type_support($post_type, $feature) {
1431 1431
 	global $_wp_post_type_features;
1432 1432
 
1433
-	unset( $_wp_post_type_features[ $post_type ][ $feature ] );
1433
+	unset($_wp_post_type_features[$post_type][$feature]);
1434 1434
 }
1435 1435
 
1436 1436
 /**
@@ -1443,10 +1443,10 @@  discard block
 block discarded – undo
1443 1443
  * @param string $post_type The post type.
1444 1444
  * @return array Post type supports list.
1445 1445
  */
1446
-function get_all_post_type_supports( $post_type ) {
1446
+function get_all_post_type_supports($post_type) {
1447 1447
 	global $_wp_post_type_features;
1448 1448
 
1449
-	if ( isset( $_wp_post_type_features[$post_type] ) )
1449
+	if (isset($_wp_post_type_features[$post_type]))
1450 1450
 		return $_wp_post_type_features[$post_type];
1451 1451
 
1452 1452
 	return array();
@@ -1463,10 +1463,10 @@  discard block
 block discarded – undo
1463 1463
  * @param string $feature   The feature being checked.
1464 1464
  * @return bool Whether the post type supports the given feature.
1465 1465
  */
1466
-function post_type_supports( $post_type, $feature ) {
1466
+function post_type_supports($post_type, $feature) {
1467 1467
 	global $_wp_post_type_features;
1468 1468
 
1469
-	return ( isset( $_wp_post_type_features[$post_type][$feature] ) );
1469
+	return (isset($_wp_post_type_features[$post_type][$feature]));
1470 1470
 }
1471 1471
 
1472 1472
 /**
@@ -1483,12 +1483,12 @@  discard block
 block discarded – undo
1483 1483
  *                               match. Default 'and'.
1484 1484
  * @return array A list of post type names.
1485 1485
  */
1486
-function get_post_types_by_support( $feature, $operator = 'and' ) {
1486
+function get_post_types_by_support($feature, $operator = 'and') {
1487 1487
 	global $_wp_post_type_features;
1488 1488
 
1489
-	$features = array_fill_keys( (array) $feature, true );
1489
+	$features = array_fill_keys((array) $feature, true);
1490 1490
 
1491
-	return array_keys( wp_filter_object_list( $_wp_post_type_features, $features, $operator ) );
1491
+	return array_keys(wp_filter_object_list($_wp_post_type_features, $features, $operator));
1492 1492
 }
1493 1493
 
1494 1494
 /**
@@ -1505,13 +1505,13 @@  discard block
 block discarded – undo
1505 1505
  *                          name a few. Default 'post'.
1506 1506
  * @return int|false Amount of rows changed. Should be 1 for success and 0 for failure.
1507 1507
  */
1508
-function set_post_type( $post_id = 0, $post_type = 'post' ) {
1508
+function set_post_type($post_id = 0, $post_type = 'post') {
1509 1509
 	global $wpdb;
1510 1510
 
1511 1511
 	$post_type = sanitize_post_field('post_type', $post_type, $post_id, 'db');
1512
-	$return = $wpdb->update( $wpdb->posts, array('post_type' => $post_type), array('ID' => $post_id) );
1512
+	$return = $wpdb->update($wpdb->posts, array('post_type' => $post_type), array('ID' => $post_id));
1513 1513
 
1514
-	clean_post_cache( $post_id );
1514
+	clean_post_cache($post_id);
1515 1515
 
1516 1516
 	return $return;
1517 1517
 }
@@ -1529,15 +1529,15 @@  discard block
 block discarded – undo
1529 1529
  * @param string|WP_Post_Type $post_type Post type name or object.
1530 1530
  * @return bool Whether the post type should be considered viewable.
1531 1531
  */
1532
-function is_post_type_viewable( $post_type ) {
1533
-	if ( is_scalar( $post_type ) ) {
1534
-		$post_type = get_post_type_object( $post_type );
1535
-		if ( ! $post_type ) {
1532
+function is_post_type_viewable($post_type) {
1533
+	if (is_scalar($post_type)) {
1534
+		$post_type = get_post_type_object($post_type);
1535
+		if ( ! $post_type) {
1536 1536
 			return false;
1537 1537
 		}
1538 1538
 	}
1539 1539
 
1540
-	return $post_type->publicly_queryable || ( $post_type->_builtin && $post_type->public );
1540
+	return $post_type->publicly_queryable || ($post_type->_builtin && $post_type->public);
1541 1541
 }
1542 1542
 
1543 1543
 /**
@@ -1564,7 +1564,7 @@  discard block
 block discarded – undo
1564 1564
  * }
1565 1565
  * @return array List of posts.
1566 1566
  */
1567
-function get_posts( $args = null ) {
1567
+function get_posts($args = null) {
1568 1568
 	$defaults = array(
1569 1569
 		'numberposts' => 5,
1570 1570
 		'category' => 0, 'orderby' => 'date',
@@ -1574,19 +1574,19 @@  discard block
 block discarded – undo
1574 1574
 		'suppress_filters' => true
1575 1575
 	);
1576 1576
 
1577
-	$r = wp_parse_args( $args, $defaults );
1578
-	if ( empty( $r['post_status'] ) )
1579
-		$r['post_status'] = ( 'attachment' == $r['post_type'] ) ? 'inherit' : 'publish';
1580
-	if ( ! empty($r['numberposts']) && empty($r['posts_per_page']) )
1577
+	$r = wp_parse_args($args, $defaults);
1578
+	if (empty($r['post_status']))
1579
+		$r['post_status'] = ('attachment' == $r['post_type']) ? 'inherit' : 'publish';
1580
+	if ( ! empty($r['numberposts']) && empty($r['posts_per_page']))
1581 1581
 		$r['posts_per_page'] = $r['numberposts'];
1582
-	if ( ! empty($r['category']) )
1582
+	if ( ! empty($r['category']))
1583 1583
 		$r['cat'] = $r['category'];
1584
-	if ( ! empty($r['include']) ) {
1585
-		$incposts = wp_parse_id_list( $r['include'] );
1586
-		$r['posts_per_page'] = count($incposts);  // only the number of posts included
1584
+	if ( ! empty($r['include'])) {
1585
+		$incposts = wp_parse_id_list($r['include']);
1586
+		$r['posts_per_page'] = count($incposts); // only the number of posts included
1587 1587
 		$r['post__in'] = $incposts;
1588
-	} elseif ( ! empty($r['exclude']) )
1589
-		$r['post__not_in'] = wp_parse_id_list( $r['exclude'] );
1588
+	} elseif ( ! empty($r['exclude']))
1589
+		$r['post__not_in'] = wp_parse_id_list($r['exclude']);
1590 1590
 
1591 1591
 	$r['ignore_sticky_posts'] = true;
1592 1592
 	$r['no_found_rows'] = true;
@@ -1614,9 +1614,9 @@  discard block
 block discarded – undo
1614 1614
  *                           Default false.
1615 1615
  * @return int|false Meta ID on success, false on failure.
1616 1616
  */
1617
-function add_post_meta( $post_id, $meta_key, $meta_value, $unique = false ) {
1617
+function add_post_meta($post_id, $meta_key, $meta_value, $unique = false) {
1618 1618
 	// Make sure meta is added to the post, not a revision.
1619
-	if ( $the_post = wp_is_post_revision($post_id) )
1619
+	if ($the_post = wp_is_post_revision($post_id))
1620 1620
 		$post_id = $the_post;
1621 1621
 
1622 1622
 	return add_metadata('post', $post_id, $meta_key, $meta_value, $unique);
@@ -1637,9 +1637,9 @@  discard block
 block discarded – undo
1637 1637
  *                           non-scalar. Default empty.
1638 1638
  * @return bool True on success, false on failure.
1639 1639
  */
1640
-function delete_post_meta( $post_id, $meta_key, $meta_value = '' ) {
1640
+function delete_post_meta($post_id, $meta_key, $meta_value = '') {
1641 1641
 	// Make sure meta is added to the post, not a revision.
1642
-	if ( $the_post = wp_is_post_revision($post_id) )
1642
+	if ($the_post = wp_is_post_revision($post_id))
1643 1643
 		$post_id = $the_post;
1644 1644
 
1645 1645
 	return delete_metadata('post', $post_id, $meta_key, $meta_value);
@@ -1657,7 +1657,7 @@  discard block
 block discarded – undo
1657 1657
  * @return mixed Will be an array if $single is false. Will be value of meta data
1658 1658
  *               field if $single is true.
1659 1659
  */
1660
-function get_post_meta( $post_id, $key = '', $single = false ) {
1660
+function get_post_meta($post_id, $key = '', $single = false) {
1661 1661
 	return get_metadata('post', $post_id, $key, $single);
1662 1662
 }
1663 1663
 
@@ -1679,9 +1679,9 @@  discard block
 block discarded – undo
1679 1679
  * @return int|bool Meta ID if the key didn't exist, true on successful update,
1680 1680
  *                  false on failure.
1681 1681
  */
1682
-function update_post_meta( $post_id, $meta_key, $meta_value, $prev_value = '' ) {
1682
+function update_post_meta($post_id, $meta_key, $meta_value, $prev_value = '') {
1683 1683
 	// Make sure meta is added to the post, not a revision.
1684
-	if ( $the_post = wp_is_post_revision($post_id) )
1684
+	if ($the_post = wp_is_post_revision($post_id))
1685 1685
 		$post_id = $the_post;
1686 1686
 
1687 1687
 	return update_metadata('post', $post_id, $meta_key, $meta_value, $prev_value);
@@ -1695,8 +1695,8 @@  discard block
 block discarded – undo
1695 1695
  * @param string $post_meta_key Key to search for when deleting.
1696 1696
  * @return bool Whether the post meta key was deleted from the database.
1697 1697
  */
1698
-function delete_post_meta_by_key( $post_meta_key ) {
1699
-	return delete_metadata( 'post', null, $post_meta_key, '', true );
1698
+function delete_post_meta_by_key($post_meta_key) {
1699
+	return delete_metadata('post', null, $post_meta_key, '', true);
1700 1700
 }
1701 1701
 
1702 1702
 /**
@@ -1710,12 +1710,12 @@  discard block
 block discarded – undo
1710 1710
  * @param int $post_id Optional. Post ID. Default is ID of the global $post.
1711 1711
  * @return array Post meta for the given post.
1712 1712
  */
1713
-function get_post_custom( $post_id = 0 ) {
1714
-	$post_id = absint( $post_id );
1715
-	if ( ! $post_id )
1713
+function get_post_custom($post_id = 0) {
1714
+	$post_id = absint($post_id);
1715
+	if ( ! $post_id)
1716 1716
 		$post_id = get_the_ID();
1717 1717
 
1718
-	return get_post_meta( $post_id );
1718
+	return get_post_meta($post_id);
1719 1719
 }
1720 1720
 
1721 1721
 /**
@@ -1728,13 +1728,13 @@  discard block
 block discarded – undo
1728 1728
  * @param int $post_id Optional. Post ID. Default is ID of the global $post.
1729 1729
  * @return array|void Array of the keys, if retrieved.
1730 1730
  */
1731
-function get_post_custom_keys( $post_id = 0 ) {
1732
-	$custom = get_post_custom( $post_id );
1731
+function get_post_custom_keys($post_id = 0) {
1732
+	$custom = get_post_custom($post_id);
1733 1733
 
1734
-	if ( !is_array($custom) )
1734
+	if ( ! is_array($custom))
1735 1735
 		return;
1736 1736
 
1737
-	if ( $keys = array_keys($custom) )
1737
+	if ($keys = array_keys($custom))
1738 1738
 		return $keys;
1739 1739
 }
1740 1740
 
@@ -1750,8 +1750,8 @@  discard block
 block discarded – undo
1750 1750
  * @param int    $post_id Optional. Post ID. Default is ID of the global $post.
1751 1751
  * @return array|null Meta field values.
1752 1752
  */
1753
-function get_post_custom_values( $key = '', $post_id = 0 ) {
1754
-	if ( !$key )
1753
+function get_post_custom_values($key = '', $post_id = 0) {
1754
+	if ( ! $key)
1755 1755
 		return null;
1756 1756
 
1757 1757
 	$custom = get_post_custom($post_id);
@@ -1770,18 +1770,18 @@  discard block
 block discarded – undo
1770 1770
  * @param int $post_id Optional. Post ID. Default is ID of the global $post.
1771 1771
  * @return bool Whether post is sticky.
1772 1772
  */
1773
-function is_sticky( $post_id = 0 ) {
1774
-	$post_id = absint( $post_id );
1773
+function is_sticky($post_id = 0) {
1774
+	$post_id = absint($post_id);
1775 1775
 
1776
-	if ( ! $post_id )
1776
+	if ( ! $post_id)
1777 1777
 		$post_id = get_the_ID();
1778 1778
 
1779
-	$stickies = get_option( 'sticky_posts' );
1779
+	$stickies = get_option('sticky_posts');
1780 1780
 
1781
-	if ( ! is_array( $stickies ) )
1781
+	if ( ! is_array($stickies))
1782 1782
 		return false;
1783 1783
 
1784
-	if ( in_array( $post_id, $stickies ) )
1784
+	if (in_array($post_id, $stickies))
1785 1785
 		return true;
1786 1786
 
1787 1787
 	return false;
@@ -1804,23 +1804,23 @@  discard block
 block discarded – undo
1804 1804
  * @return object|WP_Post|array The now sanitized Post Object or Array (will be the
1805 1805
  *                              same type as $post).
1806 1806
  */
1807
-function sanitize_post( $post, $context = 'display' ) {
1808
-	if ( is_object($post) ) {
1807
+function sanitize_post($post, $context = 'display') {
1808
+	if (is_object($post)) {
1809 1809
 		// Check if post already filtered for this context.
1810
-		if ( isset($post->filter) && $context == $post->filter )
1810
+		if (isset($post->filter) && $context == $post->filter)
1811 1811
 			return $post;
1812
-		if ( !isset($post->ID) )
1812
+		if ( ! isset($post->ID))
1813 1813
 			$post->ID = 0;
1814
-		foreach ( array_keys(get_object_vars($post)) as $field )
1814
+		foreach (array_keys(get_object_vars($post)) as $field)
1815 1815
 			$post->$field = sanitize_post_field($field, $post->$field, $post->ID, $context);
1816 1816
 		$post->filter = $context;
1817
-	} elseif ( is_array( $post ) ) {
1817
+	} elseif (is_array($post)) {
1818 1818
 		// Check if post already filtered for this context.
1819
-		if ( isset($post['filter']) && $context == $post['filter'] )
1819
+		if (isset($post['filter']) && $context == $post['filter'])
1820 1820
 			return $post;
1821
-		if ( !isset($post['ID']) )
1821
+		if ( ! isset($post['ID']))
1822 1822
 			$post['ID'] = 0;
1823
-		foreach ( array_keys($post) as $field )
1823
+		foreach (array_keys($post) as $field)
1824 1824
 			$post[$field] = sanitize_post_field($field, $post[$field], $post['ID'], $context);
1825 1825
 		$post['filter'] = $context;
1826 1826
 	}
@@ -1844,31 +1844,31 @@  discard block
 block discarded – undo
1844 1844
  *                        'db', 'display', 'attribute' and 'js'. Default 'display'.
1845 1845
  * @return mixed Sanitized value.
1846 1846
  */
1847
-function sanitize_post_field( $field, $value, $post_id, $context = 'display' ) {
1847
+function sanitize_post_field($field, $value, $post_id, $context = 'display') {
1848 1848
 	$int_fields = array('ID', 'post_parent', 'menu_order');
1849
-	if ( in_array($field, $int_fields) )
1849
+	if (in_array($field, $int_fields))
1850 1850
 		$value = (int) $value;
1851 1851
 
1852 1852
 	// Fields which contain arrays of integers.
1853
-	$array_int_fields = array( 'ancestors' );
1854
-	if ( in_array($field, $array_int_fields) ) {
1855
-		$value = array_map( 'absint', $value);
1853
+	$array_int_fields = array('ancestors');
1854
+	if (in_array($field, $array_int_fields)) {
1855
+		$value = array_map('absint', $value);
1856 1856
 		return $value;
1857 1857
 	}
1858 1858
 
1859
-	if ( 'raw' == $context )
1859
+	if ('raw' == $context)
1860 1860
 		return $value;
1861 1861
 
1862 1862
 	$prefixed = false;
1863
-	if ( false !== strpos($field, 'post_') ) {
1863
+	if (false !== strpos($field, 'post_')) {
1864 1864
 		$prefixed = true;
1865 1865
 		$field_no_prefix = str_replace('post_', '', $field);
1866 1866
 	}
1867 1867
 
1868
-	if ( 'edit' == $context ) {
1868
+	if ('edit' == $context) {
1869 1869
 		$format_to_edit = array('post_content', 'post_excerpt', 'post_title', 'post_password');
1870 1870
 
1871
-		if ( $prefixed ) {
1871
+		if ($prefixed) {
1872 1872
 
1873 1873
 			/**
1874 1874
 			 * Filters the value of a specific post field to edit.
@@ -1881,7 +1881,7 @@  discard block
 block discarded – undo
1881 1881
 			 * @param mixed $value   Value of the post field.
1882 1882
 			 * @param int   $post_id Post ID.
1883 1883
 			 */
1884
-			$value = apply_filters( "edit_{$field}", $value, $post_id );
1884
+			$value = apply_filters("edit_{$field}", $value, $post_id);
1885 1885
 
1886 1886
 			/**
1887 1887
 			 * Filters the value of a specific post field to edit.
@@ -1894,21 +1894,21 @@  discard block
 block discarded – undo
1894 1894
 			 * @param mixed $value   Value of the post field.
1895 1895
 			 * @param int   $post_id Post ID.
1896 1896
 			 */
1897
-			$value = apply_filters( "{$field_no_prefix}_edit_pre", $value, $post_id );
1897
+			$value = apply_filters("{$field_no_prefix}_edit_pre", $value, $post_id);
1898 1898
 		} else {
1899
-			$value = apply_filters( "edit_post_{$field}", $value, $post_id );
1899
+			$value = apply_filters("edit_post_{$field}", $value, $post_id);
1900 1900
 		}
1901 1901
 
1902
-		if ( in_array($field, $format_to_edit) ) {
1903
-			if ( 'post_content' == $field )
1902
+		if (in_array($field, $format_to_edit)) {
1903
+			if ('post_content' == $field)
1904 1904
 				$value = format_to_edit($value, user_can_richedit());
1905 1905
 			else
1906 1906
 				$value = format_to_edit($value);
1907 1907
 		} else {
1908 1908
 			$value = esc_attr($value);
1909 1909
 		}
1910
-	} elseif ( 'db' == $context ) {
1911
-		if ( $prefixed ) {
1910
+	} elseif ('db' == $context) {
1911
+		if ($prefixed) {
1912 1912
 
1913 1913
 			/**
1914 1914
 			 * Filters the value of a specific post field before saving.
@@ -1920,7 +1920,7 @@  discard block
 block discarded – undo
1920 1920
 			 *
1921 1921
 			 * @param mixed $value Value of the post field.
1922 1922
 			 */
1923
-			$value = apply_filters( "pre_{$field}", $value );
1923
+			$value = apply_filters("pre_{$field}", $value);
1924 1924
 
1925 1925
 			/**
1926 1926
 			 * Filters the value of a specific field before saving.
@@ -1932,9 +1932,9 @@  discard block
 block discarded – undo
1932 1932
 			 *
1933 1933
 			 * @param mixed $value Value of the post field.
1934 1934
 			 */
1935
-			$value = apply_filters( "{$field_no_prefix}_save_pre", $value );
1935
+			$value = apply_filters("{$field_no_prefix}_save_pre", $value);
1936 1936
 		} else {
1937
-			$value = apply_filters( "pre_post_{$field}", $value );
1937
+			$value = apply_filters("pre_post_{$field}", $value);
1938 1938
 
1939 1939
 			/**
1940 1940
 			 * Filters the value of a specific post field before saving.
@@ -1946,12 +1946,12 @@  discard block
 block discarded – undo
1946 1946
 			 *
1947 1947
 			 * @param mixed $value Value of the post field.
1948 1948
 			 */
1949
-			$value = apply_filters( "{$field}_pre", $value );
1949
+			$value = apply_filters("{$field}_pre", $value);
1950 1950
 		}
1951 1951
 	} else {
1952 1952
 
1953 1953
 		// Use display filters by default.
1954
-		if ( $prefixed ) {
1954
+		if ($prefixed) {
1955 1955
 
1956 1956
 			/**
1957 1957
 			 * Filters the value of a specific post field for display.
@@ -1967,15 +1967,15 @@  discard block
 block discarded – undo
1967 1967
 			 *                        values include 'raw', 'edit', 'db', 'display',
1968 1968
 			 *                        'attribute' and 'js'.
1969 1969
 			 */
1970
-			$value = apply_filters( $field, $value, $post_id, $context );
1970
+			$value = apply_filters($field, $value, $post_id, $context);
1971 1971
 		} else {
1972
-			$value = apply_filters( "post_{$field}", $value, $post_id, $context );
1972
+			$value = apply_filters("post_{$field}", $value, $post_id, $context);
1973 1973
 		}
1974 1974
 
1975
-		if ( 'attribute' == $context ) {
1976
-			$value = esc_attr( $value );
1977
-		} elseif ( 'js' == $context ) {
1978
-			$value = esc_js( $value );
1975
+		if ('attribute' == $context) {
1976
+			$value = esc_attr($value);
1977
+		} elseif ('js' == $context) {
1978
+			$value = esc_js($value);
1979 1979
 		}
1980 1980
 	}
1981 1981
 
@@ -1991,18 +1991,18 @@  discard block
 block discarded – undo
1991 1991
  *
1992 1992
  * @param int $post_id Post ID.
1993 1993
  */
1994
-function stick_post( $post_id ) {
1994
+function stick_post($post_id) {
1995 1995
 	$stickies = get_option('sticky_posts');
1996 1996
 
1997
-	if ( !is_array($stickies) )
1997
+	if ( ! is_array($stickies))
1998 1998
 		$stickies = array($post_id);
1999 1999
 
2000
-	if ( ! in_array($post_id, $stickies) )
2000
+	if ( ! in_array($post_id, $stickies))
2001 2001
 		$stickies[] = $post_id;
2002 2002
 
2003
-	$updated = update_option( 'sticky_posts', $stickies );
2003
+	$updated = update_option('sticky_posts', $stickies);
2004 2004
 
2005
-	if ( $updated ) {
2005
+	if ($updated) {
2006 2006
 		/**
2007 2007
 		 * Fires once a post has been added to the sticky list.
2008 2008
 		 *
@@ -2010,7 +2010,7 @@  discard block
 block discarded – undo
2010 2010
 		 *
2011 2011
 		 * @param int $post_id ID of the post that was stuck.
2012 2012
 		 */
2013
-		do_action( 'post_stuck', $post_id );
2013
+		do_action('post_stuck', $post_id);
2014 2014
 	}
2015 2015
 }
2016 2016
 
@@ -2023,24 +2023,24 @@  discard block
 block discarded – undo
2023 2023
  *
2024 2024
  * @param int $post_id Post ID.
2025 2025
  */
2026
-function unstick_post( $post_id ) {
2026
+function unstick_post($post_id) {
2027 2027
 	$stickies = get_option('sticky_posts');
2028 2028
 
2029
-	if ( !is_array($stickies) )
2029
+	if ( ! is_array($stickies))
2030 2030
 		return;
2031 2031
 
2032
-	if ( ! in_array($post_id, $stickies) )
2032
+	if ( ! in_array($post_id, $stickies))
2033 2033
 		return;
2034 2034
 
2035 2035
 	$offset = array_search($post_id, $stickies);
2036
-	if ( false === $offset )
2036
+	if (false === $offset)
2037 2037
 		return;
2038 2038
 
2039 2039
 	array_splice($stickies, $offset, 1);
2040 2040
 
2041
-	$updated = update_option( 'sticky_posts', $stickies );
2041
+	$updated = update_option('sticky_posts', $stickies);
2042 2042
 
2043
-	if ( $updated ) {
2043
+	if ($updated) {
2044 2044
 		/**
2045 2045
 		 * Fires once a post has been removed from the sticky list.
2046 2046
 		 *
@@ -2048,7 +2048,7 @@  discard block
 block discarded – undo
2048 2048
 		 *
2049 2049
 		 * @param int $post_id ID of the post that was unstuck.
2050 2050
 		 */
2051
-		do_action( 'post_unstuck', $post_id );
2051
+		do_action('post_unstuck', $post_id);
2052 2052
 	}
2053 2053
 }
2054 2054
 
@@ -2061,12 +2061,12 @@  discard block
 block discarded – undo
2061 2061
  * @param string $perm Optional. 'readable' or empty. Default empty.
2062 2062
  * @return string The cache key.
2063 2063
  */
2064
-function _count_posts_cache_key( $type = 'post', $perm = '' ) {
2065
-	$cache_key = 'posts-' . $type;
2066
-	if ( 'readable' == $perm && is_user_logged_in() ) {
2067
-		$post_type_object = get_post_type_object( $type );
2068
-		if ( $post_type_object && ! current_user_can( $post_type_object->cap->read_private_posts ) ) {
2069
-			$cache_key .= '_' . $perm . '_' . get_current_user_id();
2064
+function _count_posts_cache_key($type = 'post', $perm = '') {
2065
+	$cache_key = 'posts-'.$type;
2066
+	if ('readable' == $perm && is_user_logged_in()) {
2067
+		$post_type_object = get_post_type_object($type);
2068
+		if ($post_type_object && ! current_user_can($post_type_object->cap->read_private_posts)) {
2069
+			$cache_key .= '_'.$perm.'_'.get_current_user_id();
2070 2070
 		}
2071 2071
 	}
2072 2072
 	return $cache_key;
@@ -2091,40 +2091,40 @@  discard block
 block discarded – undo
2091 2091
  * @param string $perm Optional. 'readable' or empty. Default empty.
2092 2092
  * @return object Number of posts for each status.
2093 2093
  */
2094
-function wp_count_posts( $type = 'post', $perm = '' ) {
2094
+function wp_count_posts($type = 'post', $perm = '') {
2095 2095
 	global $wpdb;
2096 2096
 
2097
-	if ( ! post_type_exists( $type ) )
2097
+	if ( ! post_type_exists($type))
2098 2098
 		return new stdClass;
2099 2099
 
2100
-	$cache_key = _count_posts_cache_key( $type, $perm );
2100
+	$cache_key = _count_posts_cache_key($type, $perm);
2101 2101
 
2102
-	$counts = wp_cache_get( $cache_key, 'counts' );
2103
-	if ( false !== $counts ) {
2102
+	$counts = wp_cache_get($cache_key, 'counts');
2103
+	if (false !== $counts) {
2104 2104
 		/** This filter is documented in wp-includes/post.php */
2105
-		return apply_filters( 'wp_count_posts', $counts, $type, $perm );
2105
+		return apply_filters('wp_count_posts', $counts, $type, $perm);
2106 2106
 	}
2107 2107
 
2108 2108
 	$query = "SELECT post_status, COUNT( * ) AS num_posts FROM {$wpdb->posts} WHERE post_type = %s";
2109
-	if ( 'readable' == $perm && is_user_logged_in() ) {
2109
+	if ('readable' == $perm && is_user_logged_in()) {
2110 2110
 		$post_type_object = get_post_type_object($type);
2111
-		if ( ! current_user_can( $post_type_object->cap->read_private_posts ) ) {
2112
-			$query .= $wpdb->prepare( " AND (post_status != 'private' OR ( post_author = %d AND post_status = 'private' ))",
2111
+		if ( ! current_user_can($post_type_object->cap->read_private_posts)) {
2112
+			$query .= $wpdb->prepare(" AND (post_status != 'private' OR ( post_author = %d AND post_status = 'private' ))",
2113 2113
 				get_current_user_id()
2114 2114
 			);
2115 2115
 		}
2116 2116
 	}
2117 2117
 	$query .= ' GROUP BY post_status';
2118 2118
 
2119
-	$results = (array) $wpdb->get_results( $wpdb->prepare( $query, $type ), ARRAY_A );
2120
-	$counts = array_fill_keys( get_post_stati(), 0 );
2119
+	$results = (array) $wpdb->get_results($wpdb->prepare($query, $type), ARRAY_A);
2120
+	$counts = array_fill_keys(get_post_stati(), 0);
2121 2121
 
2122
-	foreach ( $results as $row ) {
2123
-		$counts[ $row['post_status'] ] = $row['num_posts'];
2122
+	foreach ($results as $row) {
2123
+		$counts[$row['post_status']] = $row['num_posts'];
2124 2124
 	}
2125 2125
 
2126 2126
 	$counts = (object) $counts;
2127
-	wp_cache_set( $cache_key, $counts, 'counts' );
2127
+	wp_cache_set($cache_key, $counts, 'counts');
2128 2128
 
2129 2129
 	/**
2130 2130
 	 * Modify returned post counts by status for the current post type.
@@ -2137,7 +2137,7 @@  discard block
 block discarded – undo
2137 2137
 	 * @param string $perm   The permission to determine if the posts are 'readable'
2138 2138
 	 *                       by the current user.
2139 2139
 	 */
2140
-	return apply_filters( 'wp_count_posts', $counts, $type, $perm );
2140
+	return apply_filters('wp_count_posts', $counts, $type, $perm);
2141 2141
 }
2142 2142
 
2143 2143
 /**
@@ -2156,17 +2156,17 @@  discard block
 block discarded – undo
2156 2156
  *                                MIME patterns. Default empty.
2157 2157
  * @return object An object containing the attachment counts by mime type.
2158 2158
  */
2159
-function wp_count_attachments( $mime_type = '' ) {
2159
+function wp_count_attachments($mime_type = '') {
2160 2160
 	global $wpdb;
2161 2161
 
2162
-	$and = wp_post_mime_type_where( $mime_type );
2163
-	$count = $wpdb->get_results( "SELECT post_mime_type, COUNT( * ) AS num_posts FROM $wpdb->posts WHERE post_type = 'attachment' AND post_status != 'trash' $and GROUP BY post_mime_type", ARRAY_A );
2162
+	$and = wp_post_mime_type_where($mime_type);
2163
+	$count = $wpdb->get_results("SELECT post_mime_type, COUNT( * ) AS num_posts FROM $wpdb->posts WHERE post_type = 'attachment' AND post_status != 'trash' $and GROUP BY post_mime_type", ARRAY_A);
2164 2164
 
2165 2165
 	$counts = array();
2166
-	foreach ( (array) $count as $row ) {
2167
-		$counts[ $row['post_mime_type'] ] = $row['num_posts'];
2166
+	foreach ((array) $count as $row) {
2167
+		$counts[$row['post_mime_type']] = $row['num_posts'];
2168 2168
 	}
2169
-	$counts['trash'] = $wpdb->get_var( "SELECT COUNT( * ) FROM $wpdb->posts WHERE post_type = 'attachment' AND post_status = 'trash' $and");
2169
+	$counts['trash'] = $wpdb->get_var("SELECT COUNT( * ) FROM $wpdb->posts WHERE post_type = 'attachment' AND post_status = 'trash' $and");
2170 2170
 
2171 2171
 	/**
2172 2172
 	 * Modify returned attachment counts by mime type.
@@ -2178,7 +2178,7 @@  discard block
 block discarded – undo
2178 2178
 	 * @param string $mime_type The mime type pattern used to filter the attachments
2179 2179
 	 *                          counted.
2180 2180
 	 */
2181
-	return apply_filters( 'wp_count_attachments', (object) $counts, $mime_type );
2181
+	return apply_filters('wp_count_attachments', (object) $counts, $mime_type);
2182 2182
 }
2183 2183
 
2184 2184
 /**
@@ -2202,7 +2202,7 @@  discard block
 block discarded – undo
2202 2202
 	 *
2203 2203
 	 * @param array $post_mime_types Default list of post mime types.
2204 2204
 	 */
2205
-	return apply_filters( 'post_mime_types', $post_mime_types );
2205
+	return apply_filters('post_mime_types', $post_mime_types);
2206 2206
 }
2207 2207
 
2208 2208
 /**
@@ -2219,35 +2219,35 @@  discard block
 block discarded – undo
2219 2219
  * @param string|array $real_mime_types     Real post mime type values.
2220 2220
  * @return array array(wildcard=>array(real types)).
2221 2221
  */
2222
-function wp_match_mime_types( $wildcard_mime_types, $real_mime_types ) {
2222
+function wp_match_mime_types($wildcard_mime_types, $real_mime_types) {
2223 2223
 	$matches = array();
2224
-	if ( is_string( $wildcard_mime_types ) ) {
2225
-		$wildcard_mime_types = array_map( 'trim', explode( ',', $wildcard_mime_types ) );
2224
+	if (is_string($wildcard_mime_types)) {
2225
+		$wildcard_mime_types = array_map('trim', explode(',', $wildcard_mime_types));
2226 2226
 	}
2227
-	if ( is_string( $real_mime_types ) ) {
2228
-		$real_mime_types = array_map( 'trim', explode( ',', $real_mime_types ) );
2227
+	if (is_string($real_mime_types)) {
2228
+		$real_mime_types = array_map('trim', explode(',', $real_mime_types));
2229 2229
 	}
2230 2230
 
2231 2231
 	$patternses = array();
2232 2232
 	$wild = '[-._a-z0-9]*';
2233 2233
 
2234
-	foreach ( (array) $wildcard_mime_types as $type ) {
2235
-		$mimes = array_map( 'trim', explode( ',', $type ) );
2236
-		foreach ( $mimes as $mime ) {
2237
-			$regex = str_replace( '__wildcard__', $wild, preg_quote( str_replace( '*', '__wildcard__', $mime ) ) );
2234
+	foreach ((array) $wildcard_mime_types as $type) {
2235
+		$mimes = array_map('trim', explode(',', $type));
2236
+		foreach ($mimes as $mime) {
2237
+			$regex = str_replace('__wildcard__', $wild, preg_quote(str_replace('*', '__wildcard__', $mime)));
2238 2238
 			$patternses[][$type] = "^$regex$";
2239
-			if ( false === strpos( $mime, '/' ) ) {
2239
+			if (false === strpos($mime, '/')) {
2240 2240
 				$patternses[][$type] = "^$regex/";
2241 2241
 				$patternses[][$type] = $regex;
2242 2242
 			}
2243 2243
 		}
2244 2244
 	}
2245
-	asort( $patternses );
2245
+	asort($patternses);
2246 2246
 
2247
-	foreach ( $patternses as $patterns ) {
2248
-		foreach ( $patterns as $type => $pattern ) {
2249
-			foreach ( (array) $real_mime_types as $real ) {
2250
-				if ( preg_match( "#$pattern#", $real ) && ( empty( $matches[$type] ) || false === array_search( $real, $matches[$type] ) ) ) {
2247
+	foreach ($patternses as $patterns) {
2248
+		foreach ($patterns as $type => $pattern) {
2249
+			foreach ((array) $real_mime_types as $real) {
2250
+				if (preg_match("#$pattern#", $real) && (empty($matches[$type]) || false === array_search($real, $matches[$type]))) {
2251 2251
 					$matches[$type][] = $real;
2252 2252
 				}
2253 2253
 			}
@@ -2267,43 +2267,43 @@  discard block
 block discarded – undo
2267 2267
  *                                      Default empty.
2268 2268
  * @return string The SQL AND clause for mime searching.
2269 2269
  */
2270
-function wp_post_mime_type_where( $post_mime_types, $table_alias = '' ) {
2270
+function wp_post_mime_type_where($post_mime_types, $table_alias = '') {
2271 2271
 	$where = '';
2272 2272
 	$wildcards = array('', '%', '%/%');
2273
-	if ( is_string($post_mime_types) )
2273
+	if (is_string($post_mime_types))
2274 2274
 		$post_mime_types = array_map('trim', explode(',', $post_mime_types));
2275 2275
 
2276 2276
 	$wheres = array();
2277 2277
 
2278
-	foreach ( (array) $post_mime_types as $mime_type ) {
2278
+	foreach ((array) $post_mime_types as $mime_type) {
2279 2279
 		$mime_type = preg_replace('/\s/', '', $mime_type);
2280 2280
 		$slashpos = strpos($mime_type, '/');
2281
-		if ( false !== $slashpos ) {
2281
+		if (false !== $slashpos) {
2282 2282
 			$mime_group = preg_replace('/[^-*.a-zA-Z0-9]/', '', substr($mime_type, 0, $slashpos));
2283 2283
 			$mime_subgroup = preg_replace('/[^-*.+a-zA-Z0-9]/', '', substr($mime_type, $slashpos + 1));
2284
-			if ( empty($mime_subgroup) )
2284
+			if (empty($mime_subgroup))
2285 2285
 				$mime_subgroup = '*';
2286 2286
 			else
2287 2287
 				$mime_subgroup = str_replace('/', '', $mime_subgroup);
2288 2288
 			$mime_pattern = "$mime_group/$mime_subgroup";
2289 2289
 		} else {
2290 2290
 			$mime_pattern = preg_replace('/[^-*.a-zA-Z0-9]/', '', $mime_type);
2291
-			if ( false === strpos($mime_pattern, '*') )
2291
+			if (false === strpos($mime_pattern, '*'))
2292 2292
 				$mime_pattern .= '/*';
2293 2293
 		}
2294 2294
 
2295 2295
 		$mime_pattern = preg_replace('/\*+/', '%', $mime_pattern);
2296 2296
 
2297
-		if ( in_array( $mime_type, $wildcards ) )
2297
+		if (in_array($mime_type, $wildcards))
2298 2298
 			return '';
2299 2299
 
2300
-		if ( false !== strpos($mime_pattern, '%') )
2300
+		if (false !== strpos($mime_pattern, '%'))
2301 2301
 			$wheres[] = empty($table_alias) ? "post_mime_type LIKE '$mime_pattern'" : "$table_alias.post_mime_type LIKE '$mime_pattern'";
2302 2302
 		else
2303 2303
 			$wheres[] = empty($table_alias) ? "post_mime_type = '$mime_pattern'" : "$table_alias.post_mime_type = '$mime_pattern'";
2304 2304
 	}
2305
-	if ( !empty($wheres) )
2306
-		$where = ' AND (' . join(' OR ', $wheres) . ') ';
2305
+	if ( ! empty($wheres))
2306
+		$where = ' AND ('.join(' OR ', $wheres).') ';
2307 2307
 	return $where;
2308 2308
 }
2309 2309
 
@@ -2328,17 +2328,17 @@  discard block
 block discarded – undo
2328 2328
  *                           Default false.
2329 2329
  * @return array|false|WP_Post False on failure.
2330 2330
  */
2331
-function wp_delete_post( $postid = 0, $force_delete = false ) {
2331
+function wp_delete_post($postid = 0, $force_delete = false) {
2332 2332
 	global $wpdb;
2333 2333
 
2334
-	if ( !$post = $wpdb->get_row($wpdb->prepare("SELECT * FROM $wpdb->posts WHERE ID = %d", $postid)) )
2334
+	if ( ! $post = $wpdb->get_row($wpdb->prepare("SELECT * FROM $wpdb->posts WHERE ID = %d", $postid)))
2335 2335
 		return $post;
2336 2336
 
2337
-	if ( !$force_delete && ( $post->post_type == 'post' || $post->post_type == 'page') && get_post_status( $postid ) != 'trash' && EMPTY_TRASH_DAYS )
2338
-		return wp_trash_post( $postid );
2337
+	if ( ! $force_delete && ($post->post_type == 'post' || $post->post_type == 'page') && get_post_status($postid) != 'trash' && EMPTY_TRASH_DAYS)
2338
+		return wp_trash_post($postid);
2339 2339
 
2340
-	if ( $post->post_type == 'attachment' )
2341
-		return wp_delete_attachment( $postid, $force_delete );
2340
+	if ($post->post_type == 'attachment')
2341
+		return wp_delete_attachment($postid, $force_delete);
2342 2342
 
2343 2343
 	/**
2344 2344
 	 * Filters whether a post deletion should take place.
@@ -2349,8 +2349,8 @@  discard block
 block discarded – undo
2349 2349
 	 * @param WP_Post $post         Post object.
2350 2350
 	 * @param bool    $force_delete Whether to bypass the trash.
2351 2351
 	 */
2352
-	$check = apply_filters( 'pre_delete_post', null, $post, $force_delete );
2353
-	if ( null !== $check ) {
2352
+	$check = apply_filters('pre_delete_post', null, $post, $force_delete);
2353
+	if (null !== $check) {
2354 2354
 		return $check;
2355 2355
 	}
2356 2356
 
@@ -2363,46 +2363,46 @@  discard block
 block discarded – undo
2363 2363
 	 *
2364 2364
 	 * @param int $postid Post ID.
2365 2365
 	 */
2366
-	do_action( 'before_delete_post', $postid );
2366
+	do_action('before_delete_post', $postid);
2367 2367
 
2368
-	delete_post_meta($postid,'_wp_trash_meta_status');
2369
-	delete_post_meta($postid,'_wp_trash_meta_time');
2368
+	delete_post_meta($postid, '_wp_trash_meta_status');
2369
+	delete_post_meta($postid, '_wp_trash_meta_time');
2370 2370
 
2371 2371
 	wp_delete_object_term_relationships($postid, get_object_taxonomies($post->post_type));
2372 2372
 
2373
-	$parent_data = array( 'post_parent' => $post->post_parent );
2374
-	$parent_where = array( 'post_parent' => $postid );
2373
+	$parent_data = array('post_parent' => $post->post_parent);
2374
+	$parent_where = array('post_parent' => $postid);
2375 2375
 
2376
-	if ( is_post_type_hierarchical( $post->post_type ) ) {
2376
+	if (is_post_type_hierarchical($post->post_type)) {
2377 2377
 		// Point children of this page to its parent, also clean the cache of affected children.
2378
-		$children_query = $wpdb->prepare( "SELECT * FROM $wpdb->posts WHERE post_parent = %d AND post_type = %s", $postid, $post->post_type );
2379
-		$children = $wpdb->get_results( $children_query );
2380
-		if ( $children ) {
2381
-			$wpdb->update( $wpdb->posts, $parent_data, $parent_where + array( 'post_type' => $post->post_type ) );
2378
+		$children_query = $wpdb->prepare("SELECT * FROM $wpdb->posts WHERE post_parent = %d AND post_type = %s", $postid, $post->post_type);
2379
+		$children = $wpdb->get_results($children_query);
2380
+		if ($children) {
2381
+			$wpdb->update($wpdb->posts, $parent_data, $parent_where + array('post_type' => $post->post_type));
2382 2382
 		}
2383 2383
 	}
2384 2384
 
2385 2385
 	// Do raw query. wp_get_post_revisions() is filtered.
2386
-	$revision_ids = $wpdb->get_col( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_parent = %d AND post_type = 'revision'", $postid ) );
2386
+	$revision_ids = $wpdb->get_col($wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE post_parent = %d AND post_type = 'revision'", $postid));
2387 2387
 	// Use wp_delete_post (via wp_delete_post_revision) again. Ensures any meta/misplaced data gets cleaned up.
2388
-	foreach ( $revision_ids as $revision_id )
2389
-		wp_delete_post_revision( $revision_id );
2388
+	foreach ($revision_ids as $revision_id)
2389
+		wp_delete_post_revision($revision_id);
2390 2390
 
2391 2391
 	// Point all attachments to this post up one level.
2392
-	$wpdb->update( $wpdb->posts, $parent_data, $parent_where + array( 'post_type' => 'attachment' ) );
2392
+	$wpdb->update($wpdb->posts, $parent_data, $parent_where + array('post_type' => 'attachment'));
2393 2393
 
2394
-	wp_defer_comment_counting( true );
2394
+	wp_defer_comment_counting(true);
2395 2395
 
2396
-	$comment_ids = $wpdb->get_col( $wpdb->prepare( "SELECT comment_ID FROM $wpdb->comments WHERE comment_post_ID = %d", $postid ));
2397
-	foreach ( $comment_ids as $comment_id ) {
2398
-		wp_delete_comment( $comment_id, true );
2396
+	$comment_ids = $wpdb->get_col($wpdb->prepare("SELECT comment_ID FROM $wpdb->comments WHERE comment_post_ID = %d", $postid));
2397
+	foreach ($comment_ids as $comment_id) {
2398
+		wp_delete_comment($comment_id, true);
2399 2399
 	}
2400 2400
 
2401
-	wp_defer_comment_counting( false );
2401
+	wp_defer_comment_counting(false);
2402 2402
 
2403
-	$post_meta_ids = $wpdb->get_col( $wpdb->prepare( "SELECT meta_id FROM $wpdb->postmeta WHERE post_id = %d ", $postid ));
2404
-	foreach ( $post_meta_ids as $mid )
2405
-		delete_metadata_by_mid( 'post', $mid );
2403
+	$post_meta_ids = $wpdb->get_col($wpdb->prepare("SELECT meta_id FROM $wpdb->postmeta WHERE post_id = %d ", $postid));
2404
+	foreach ($post_meta_ids as $mid)
2405
+		delete_metadata_by_mid('post', $mid);
2406 2406
 
2407 2407
 	/**
2408 2408
 	 * Fires immediately before a post is deleted from the database.
@@ -2411,9 +2411,9 @@  discard block
 block discarded – undo
2411 2411
 	 *
2412 2412
 	 * @param int $postid Post ID.
2413 2413
 	 */
2414
-	do_action( 'delete_post', $postid );
2415
-	$result = $wpdb->delete( $wpdb->posts, array( 'ID' => $postid ) );
2416
-	if ( ! $result ) {
2414
+	do_action('delete_post', $postid);
2415
+	$result = $wpdb->delete($wpdb->posts, array('ID' => $postid));
2416
+	if ( ! $result) {
2417 2417
 		return false;
2418 2418
 	}
2419 2419
 
@@ -2424,16 +2424,16 @@  discard block
 block discarded – undo
2424 2424
 	 *
2425 2425
 	 * @param int $postid Post ID.
2426 2426
 	 */
2427
-	do_action( 'deleted_post', $postid );
2427
+	do_action('deleted_post', $postid);
2428 2428
 
2429
-	clean_post_cache( $post );
2429
+	clean_post_cache($post);
2430 2430
 
2431
-	if ( is_post_type_hierarchical( $post->post_type ) && $children ) {
2432
-		foreach ( $children as $child )
2433
-			clean_post_cache( $child );
2431
+	if (is_post_type_hierarchical($post->post_type) && $children) {
2432
+		foreach ($children as $child)
2433
+			clean_post_cache($child);
2434 2434
 	}
2435 2435
 
2436
-	wp_clear_scheduled_hook('publish_future_post', array( $postid ) );
2436
+	wp_clear_scheduled_hook('publish_future_post', array($postid));
2437 2437
 
2438 2438
 	/**
2439 2439
 	 * Fires after a post is deleted, at the conclusion of wp_delete_post().
@@ -2444,7 +2444,7 @@  discard block
 block discarded – undo
2444 2444
 	 *
2445 2445
 	 * @param int $postid Post ID.
2446 2446
 	 */
2447
-	do_action( 'after_delete_post', $postid );
2447
+	do_action('after_delete_post', $postid);
2448 2448
 
2449 2449
 	return $post;
2450 2450
 }
@@ -2460,22 +2460,22 @@  discard block
 block discarded – undo
2460 2460
  *
2461 2461
  * @param int $post_id Post ID.
2462 2462
  */
2463
-function _reset_front_page_settings_for_post( $post_id ) {
2464
-	$post = get_post( $post_id );
2465
-	if ( 'page' == $post->post_type ) {
2463
+function _reset_front_page_settings_for_post($post_id) {
2464
+	$post = get_post($post_id);
2465
+	if ('page' == $post->post_type) {
2466 2466
 	 	/*
2467 2467
 	 	 * If the page is defined in option page_on_front or post_for_posts,
2468 2468
 	 	 * adjust the corresponding options.
2469 2469
 	 	 */
2470
-		if ( get_option( 'page_on_front' ) == $post->ID ) {
2471
-			update_option( 'show_on_front', 'posts' );
2472
-			update_option( 'page_on_front', 0 );
2470
+		if (get_option('page_on_front') == $post->ID) {
2471
+			update_option('show_on_front', 'posts');
2472
+			update_option('page_on_front', 0);
2473 2473
 		}
2474
-		if ( get_option( 'page_for_posts' ) == $post->ID ) {
2475
-			delete_option( 'page_for_posts', 0 );
2474
+		if (get_option('page_for_posts') == $post->ID) {
2475
+			delete_option('page_for_posts', 0);
2476 2476
 		}
2477 2477
 	}
2478
-	unstick_post( $post->ID );
2478
+	unstick_post($post->ID);
2479 2479
 }
2480 2480
 
2481 2481
 /**
@@ -2491,14 +2491,14 @@  discard block
 block discarded – undo
2491 2491
  *                     if EMPTY_TRASH_DAYS equals true.
2492 2492
  * @return false|array|WP_Post|null Post data array, otherwise false.
2493 2493
  */
2494
-function wp_trash_post( $post_id = 0 ) {
2495
-	if ( !EMPTY_TRASH_DAYS )
2494
+function wp_trash_post($post_id = 0) {
2495
+	if ( ! EMPTY_TRASH_DAYS)
2496 2496
 		return wp_delete_post($post_id, true);
2497 2497
 
2498
-	if ( !$post = get_post($post_id, ARRAY_A) )
2498
+	if ( ! $post = get_post($post_id, ARRAY_A))
2499 2499
 		return $post;
2500 2500
 
2501
-	if ( $post['post_status'] == 'trash' )
2501
+	if ($post['post_status'] == 'trash')
2502 2502
 		return false;
2503 2503
 
2504 2504
 	/**
@@ -2508,13 +2508,13 @@  discard block
 block discarded – undo
2508 2508
 	 *
2509 2509
 	 * @param int $post_id Post ID.
2510 2510
 	 */
2511
-	do_action( 'wp_trash_post', $post_id );
2511
+	do_action('wp_trash_post', $post_id);
2512 2512
 
2513
-	add_post_meta($post_id,'_wp_trash_meta_status', $post['post_status']);
2514
-	add_post_meta($post_id,'_wp_trash_meta_time', time());
2513
+	add_post_meta($post_id, '_wp_trash_meta_status', $post['post_status']);
2514
+	add_post_meta($post_id, '_wp_trash_meta_time', time());
2515 2515
 
2516 2516
 	$post['post_status'] = 'trash';
2517
-	wp_insert_post( wp_slash( $post ) );
2517
+	wp_insert_post(wp_slash($post));
2518 2518
 
2519 2519
 	wp_trash_post_comments($post_id);
2520 2520
 
@@ -2525,7 +2525,7 @@  discard block
 block discarded – undo
2525 2525
 	 *
2526 2526
 	 * @param int $post_id Post ID.
2527 2527
 	 */
2528
-	do_action( 'trashed_post', $post_id );
2528
+	do_action('trashed_post', $post_id);
2529 2529
 
2530 2530
 	return $post;
2531 2531
 }
@@ -2538,11 +2538,11 @@  discard block
 block discarded – undo
2538 2538
  * @param int $post_id Optional. Post ID. Default is ID of the global $post.
2539 2539
  * @return WP_Post|false WP_Post object. False on failure.
2540 2540
  */
2541
-function wp_untrash_post( $post_id = 0 ) {
2542
-	if ( !$post = get_post($post_id, ARRAY_A) )
2541
+function wp_untrash_post($post_id = 0) {
2542
+	if ( ! $post = get_post($post_id, ARRAY_A))
2543 2543
 		return $post;
2544 2544
 
2545
-	if ( $post['post_status'] != 'trash' )
2545
+	if ($post['post_status'] != 'trash')
2546 2546
 		return false;
2547 2547
 
2548 2548
 	/**
@@ -2552,7 +2552,7 @@  discard block
 block discarded – undo
2552 2552
 	 *
2553 2553
 	 * @param int $post_id Post ID.
2554 2554
 	 */
2555
-	do_action( 'untrash_post', $post_id );
2555
+	do_action('untrash_post', $post_id);
2556 2556
 
2557 2557
 	$post_status = get_post_meta($post_id, '_wp_trash_meta_status', true);
2558 2558
 
@@ -2561,7 +2561,7 @@  discard block
 block discarded – undo
2561 2561
 	delete_post_meta($post_id, '_wp_trash_meta_status');
2562 2562
 	delete_post_meta($post_id, '_wp_trash_meta_time');
2563 2563
 
2564
-	wp_insert_post( wp_slash( $post ) );
2564
+	wp_insert_post(wp_slash($post));
2565 2565
 
2566 2566
 	wp_untrash_post_comments($post_id);
2567 2567
 
@@ -2572,7 +2572,7 @@  discard block
 block discarded – undo
2572 2572
 	 *
2573 2573
 	 * @param int $post_id Post ID.
2574 2574
 	 */
2575
-	do_action( 'untrashed_post', $post_id );
2575
+	do_action('untrashed_post', $post_id);
2576 2576
 
2577 2577
 	return $post;
2578 2578
 }
@@ -2587,11 +2587,11 @@  discard block
 block discarded – undo
2587 2587
  * @param int|WP_Post|null $post Optional. Post ID or post object. Defaults to global $post.
2588 2588
  * @return mixed|void False on failure.
2589 2589
  */
2590
-function wp_trash_post_comments( $post = null ) {
2590
+function wp_trash_post_comments($post = null) {
2591 2591
 	global $wpdb;
2592 2592
 
2593 2593
 	$post = get_post($post);
2594
-	if ( empty($post) )
2594
+	if (empty($post))
2595 2595
 		return;
2596 2596
 
2597 2597
 	$post_id = $post->ID;
@@ -2603,22 +2603,22 @@  discard block
 block discarded – undo
2603 2603
 	 *
2604 2604
 	 * @param int $post_id Post ID.
2605 2605
 	 */
2606
-	do_action( 'trash_post_comments', $post_id );
2606
+	do_action('trash_post_comments', $post_id);
2607 2607
 
2608
-	$comments = $wpdb->get_results( $wpdb->prepare("SELECT comment_ID, comment_approved FROM $wpdb->comments WHERE comment_post_ID = %d", $post_id) );
2609
-	if ( empty($comments) )
2608
+	$comments = $wpdb->get_results($wpdb->prepare("SELECT comment_ID, comment_approved FROM $wpdb->comments WHERE comment_post_ID = %d", $post_id));
2609
+	if (empty($comments))
2610 2610
 		return;
2611 2611
 
2612 2612
 	// Cache current status for each comment.
2613 2613
 	$statuses = array();
2614
-	foreach ( $comments as $comment )
2614
+	foreach ($comments as $comment)
2615 2615
 		$statuses[$comment->comment_ID] = $comment->comment_approved;
2616 2616
 	add_post_meta($post_id, '_wp_trash_meta_comments_status', $statuses);
2617 2617
 
2618 2618
 	// Set status for all comments to post-trashed.
2619 2619
 	$result = $wpdb->update($wpdb->comments, array('comment_approved' => 'post-trashed'), array('comment_post_ID' => $post_id));
2620 2620
 
2621
-	clean_comment_cache( array_keys($statuses) );
2621
+	clean_comment_cache(array_keys($statuses));
2622 2622
 
2623 2623
 	/**
2624 2624
 	 * Fires after comments are sent to the trash.
@@ -2628,7 +2628,7 @@  discard block
 block discarded – undo
2628 2628
 	 * @param int   $post_id  Post ID.
2629 2629
 	 * @param array $statuses Array of comment statuses.
2630 2630
 	 */
2631
-	do_action( 'trashed_post_comments', $post_id, $statuses );
2631
+	do_action('trashed_post_comments', $post_id, $statuses);
2632 2632
 
2633 2633
 	return $result;
2634 2634
 }
@@ -2643,18 +2643,18 @@  discard block
 block discarded – undo
2643 2643
  * @param int|WP_Post|null $post Optional. Post ID or post object. Defaults to global $post.
2644 2644
  * @return true|void
2645 2645
  */
2646
-function wp_untrash_post_comments( $post = null ) {
2646
+function wp_untrash_post_comments($post = null) {
2647 2647
 	global $wpdb;
2648 2648
 
2649 2649
 	$post = get_post($post);
2650
-	if ( empty($post) )
2650
+	if (empty($post))
2651 2651
 		return;
2652 2652
 
2653 2653
 	$post_id = $post->ID;
2654 2654
 
2655 2655
 	$statuses = get_post_meta($post_id, '_wp_trash_meta_comments_status', true);
2656 2656
 
2657
-	if ( empty($statuses) )
2657
+	if (empty($statuses))
2658 2658
 		return true;
2659 2659
 
2660 2660
 	/**
@@ -2664,23 +2664,23 @@  discard block
 block discarded – undo
2664 2664
 	 *
2665 2665
 	 * @param int $post_id Post ID.
2666 2666
 	 */
2667
-	do_action( 'untrash_post_comments', $post_id );
2667
+	do_action('untrash_post_comments', $post_id);
2668 2668
 
2669 2669
 	// Restore each comment to its original status.
2670 2670
 	$group_by_status = array();
2671
-	foreach ( $statuses as $comment_id => $comment_status )
2671
+	foreach ($statuses as $comment_id => $comment_status)
2672 2672
 		$group_by_status[$comment_status][] = $comment_id;
2673 2673
 
2674
-	foreach ( $group_by_status as $status => $comments ) {
2674
+	foreach ($group_by_status as $status => $comments) {
2675 2675
 		// Sanity check. This shouldn't happen.
2676
-		if ( 'post-trashed' == $status ) {
2676
+		if ('post-trashed' == $status) {
2677 2677
 			$status = '0';
2678 2678
 		}
2679
-		$comments_in = implode( ', ', array_map( 'intval', $comments ) );
2680
-		$wpdb->query( $wpdb->prepare( "UPDATE $wpdb->comments SET comment_approved = %s WHERE comment_ID IN ($comments_in)", $status ) );
2679
+		$comments_in = implode(', ', array_map('intval', $comments));
2680
+		$wpdb->query($wpdb->prepare("UPDATE $wpdb->comments SET comment_approved = %s WHERE comment_ID IN ($comments_in)", $status));
2681 2681
 	}
2682 2682
 
2683
-	clean_comment_cache( array_keys($statuses) );
2683
+	clean_comment_cache(array_keys($statuses));
2684 2684
 
2685 2685
 	delete_post_meta($post_id, '_wp_trash_meta_comments_status');
2686 2686
 
@@ -2691,7 +2691,7 @@  discard block
 block discarded – undo
2691 2691
 	 *
2692 2692
 	 * @param int $post_id Post ID.
2693 2693
 	 */
2694
-	do_action( 'untrashed_post_comments', $post_id );
2694
+	do_action('untrashed_post_comments', $post_id);
2695 2695
 }
2696 2696
 
2697 2697
 /**
@@ -2711,11 +2711,11 @@  discard block
 block discarded – undo
2711 2711
  *               'all_with_object_id', an array of WP_Term objects will be returned. If `$fields`
2712 2712
  *               is 'ids', an array of category ids. If `$fields` is 'names', an array of category names.
2713 2713
  */
2714
-function wp_get_post_categories( $post_id = 0, $args = array() ) {
2714
+function wp_get_post_categories($post_id = 0, $args = array()) {
2715 2715
 	$post_id = (int) $post_id;
2716 2716
 
2717 2717
 	$defaults = array('fields' => 'ids');
2718
-	$args = wp_parse_args( $args, $defaults );
2718
+	$args = wp_parse_args($args, $defaults);
2719 2719
 
2720 2720
 	$cats = wp_get_object_terms($post_id, 'category', $args);
2721 2721
 	return $cats;
@@ -2735,8 +2735,8 @@  discard block
 block discarded – undo
2735 2735
  * @param array $args Optional. Overwrite the defaults
2736 2736
  * @return array List of post tags.
2737 2737
  */
2738
-function wp_get_post_tags( $post_id = 0, $args = array() ) {
2739
-	return wp_get_post_terms( $post_id, 'post_tag', $args);
2738
+function wp_get_post_tags($post_id = 0, $args = array()) {
2739
+	return wp_get_post_terms($post_id, 'post_tag', $args);
2740 2740
 }
2741 2741
 
2742 2742
 /**
@@ -2755,11 +2755,11 @@  discard block
 block discarded – undo
2755 2755
  * @return array|WP_Error  List of post terms or empty array if no terms were found. WP_Error object
2756 2756
  *                         if `$taxonomy` doesn't exist.
2757 2757
  */
2758
-function wp_get_post_terms( $post_id = 0, $taxonomy = 'post_tag', $args = array() ) {
2758
+function wp_get_post_terms($post_id = 0, $taxonomy = 'post_tag', $args = array()) {
2759 2759
 	$post_id = (int) $post_id;
2760 2760
 
2761 2761
 	$defaults = array('fields' => 'all');
2762
-	$args = wp_parse_args( $args, $defaults );
2762
+	$args = wp_parse_args($args, $defaults);
2763 2763
 
2764 2764
 	$tags = wp_get_object_terms($post_id, $taxonomy, $args);
2765 2765
 
@@ -2777,11 +2777,11 @@  discard block
 block discarded – undo
2777 2777
  * @param string $output     Optional. Type of output. Accepts ARRAY_A or ''. Default ARRAY_A.
2778 2778
  * @return array|false Associative array if $output equals ARRAY_A, array or false if no results.
2779 2779
  */
2780
-function wp_get_recent_posts( $args = array(), $output = ARRAY_A ) {
2780
+function wp_get_recent_posts($args = array(), $output = ARRAY_A) {
2781 2781
 
2782
-	if ( is_numeric( $args ) ) {
2783
-		_deprecated_argument( __FUNCTION__, '3.1.0', __( 'Passing an integer number of posts is deprecated. Pass an array of arguments instead.' ) );
2784
-		$args = array( 'numberposts' => absint( $args ) );
2782
+	if (is_numeric($args)) {
2783
+		_deprecated_argument(__FUNCTION__, '3.1.0', __('Passing an integer number of posts is deprecated. Pass an array of arguments instead.'));
2784
+		$args = array('numberposts' => absint($args));
2785 2785
 	}
2786 2786
 
2787 2787
 	// Set default arguments.
@@ -2794,14 +2794,14 @@  discard block
 block discarded – undo
2794 2794
 		'suppress_filters' => true
2795 2795
 	);
2796 2796
 
2797
-	$r = wp_parse_args( $args, $defaults );
2797
+	$r = wp_parse_args($args, $defaults);
2798 2798
 
2799
-	$results = get_posts( $r );
2799
+	$results = get_posts($r);
2800 2800
 
2801 2801
 	// Backward compatibility. Prior to 3.1 expected posts to be returned in array.
2802
-	if ( ARRAY_A == $output ){
2803
-		foreach ( $results as $key => $result ) {
2804
-			$results[$key] = get_object_vars( $result );
2802
+	if (ARRAY_A == $output) {
2803
+		foreach ($results as $key => $result) {
2804
+			$results[$key] = get_object_vars($result);
2805 2805
 		}
2806 2806
 		return $results ? $results : array();
2807 2807
 	}
@@ -2869,7 +2869,7 @@  discard block
 block discarded – undo
2869 2869
  * @param bool  $wp_error Optional. Whether to allow return of WP_Error on failure. Default false.
2870 2870
  * @return int|WP_Error The post ID on success. The value 0 or WP_Error on failure.
2871 2871
  */
2872
-function wp_insert_post( $postarr, $wp_error = false ) {
2872
+function wp_insert_post($postarr, $wp_error = false) {
2873 2873
 	global $wpdb;
2874 2874
 
2875 2875
 	$user_id = get_current_user_id();
@@ -2896,7 +2896,7 @@  discard block
 block discarded – undo
2896 2896
 
2897 2897
 	$postarr = wp_parse_args($postarr, $defaults);
2898 2898
 
2899
-	unset( $postarr[ 'filter' ] );
2899
+	unset($postarr['filter']);
2900 2900
 
2901 2901
 	$postarr = sanitize_post($postarr, 'db');
2902 2902
 
@@ -2905,42 +2905,42 @@  discard block
 block discarded – undo
2905 2905
 	$update = false;
2906 2906
 	$guid = $postarr['guid'];
2907 2907
 
2908
-	if ( ! empty( $postarr['ID'] ) ) {
2908
+	if ( ! empty($postarr['ID'])) {
2909 2909
 		$update = true;
2910 2910
 
2911 2911
 		// Get the post ID and GUID.
2912 2912
 		$post_ID = $postarr['ID'];
2913
-		$post_before = get_post( $post_ID );
2914
-		if ( is_null( $post_before ) ) {
2915
-			if ( $wp_error ) {
2916
-				return new WP_Error( 'invalid_post', __( 'Invalid post ID.' ) );
2913
+		$post_before = get_post($post_ID);
2914
+		if (is_null($post_before)) {
2915
+			if ($wp_error) {
2916
+				return new WP_Error('invalid_post', __('Invalid post ID.'));
2917 2917
 			}
2918 2918
 			return 0;
2919 2919
 		}
2920 2920
 
2921
-		$guid = get_post_field( 'guid', $post_ID );
2922
-		$previous_status = get_post_field('post_status', $post_ID );
2921
+		$guid = get_post_field('guid', $post_ID);
2922
+		$previous_status = get_post_field('post_status', $post_ID);
2923 2923
 	} else {
2924 2924
 		$previous_status = 'new';
2925 2925
 	}
2926 2926
 
2927
-	$post_type = empty( $postarr['post_type'] ) ? 'post' : $postarr['post_type'];
2927
+	$post_type = empty($postarr['post_type']) ? 'post' : $postarr['post_type'];
2928 2928
 
2929 2929
 	$post_title = $postarr['post_title'];
2930 2930
 	$post_content = $postarr['post_content'];
2931 2931
 	$post_excerpt = $postarr['post_excerpt'];
2932
-	if ( isset( $postarr['post_name'] ) ) {
2932
+	if (isset($postarr['post_name'])) {
2933 2933
 		$post_name = $postarr['post_name'];
2934
-	} elseif ( $update ) {
2934
+	} elseif ($update) {
2935 2935
 		// For an update, don't modify the post_name if it wasn't supplied as an argument.
2936 2936
 		$post_name = $post_before->post_name;
2937 2937
 	}
2938 2938
 
2939 2939
 	$maybe_empty = 'attachment' !== $post_type
2940 2940
 		&& ! $post_content && ! $post_title && ! $post_excerpt
2941
-		&& post_type_supports( $post_type, 'editor' )
2942
-		&& post_type_supports( $post_type, 'title' )
2943
-		&& post_type_supports( $post_type, 'excerpt' );
2941
+		&& post_type_supports($post_type, 'editor')
2942
+		&& post_type_supports($post_type, 'title')
2943
+		&& post_type_supports($post_type, 'excerpt');
2944 2944
 
2945 2945
 	/**
2946 2946
 	 * Filters whether the post should be considered "empty".
@@ -2958,36 +2958,36 @@  discard block
 block discarded – undo
2958 2958
 	 * @param bool  $maybe_empty Whether the post should be considered "empty".
2959 2959
 	 * @param array $postarr     Array of post data.
2960 2960
 	 */
2961
-	if ( apply_filters( 'wp_insert_post_empty_content', $maybe_empty, $postarr ) ) {
2962
-		if ( $wp_error ) {
2963
-			return new WP_Error( 'empty_content', __( 'Content, title, and excerpt are empty.' ) );
2961
+	if (apply_filters('wp_insert_post_empty_content', $maybe_empty, $postarr)) {
2962
+		if ($wp_error) {
2963
+			return new WP_Error('empty_content', __('Content, title, and excerpt are empty.'));
2964 2964
 		} else {
2965 2965
 			return 0;
2966 2966
 		}
2967 2967
 	}
2968 2968
 
2969
-	$post_status = empty( $postarr['post_status'] ) ? 'draft' : $postarr['post_status'];
2970
-	if ( 'attachment' === $post_type && ! in_array( $post_status, array( 'inherit', 'private', 'trash' ) ) ) {
2969
+	$post_status = empty($postarr['post_status']) ? 'draft' : $postarr['post_status'];
2970
+	if ('attachment' === $post_type && ! in_array($post_status, array('inherit', 'private', 'trash'))) {
2971 2971
 		$post_status = 'inherit';
2972 2972
 	}
2973 2973
 
2974
-	if ( ! empty( $postarr['post_category'] ) ) {
2974
+	if ( ! empty($postarr['post_category'])) {
2975 2975
 		// Filter out empty terms.
2976
-		$post_category = array_filter( $postarr['post_category'] );
2976
+		$post_category = array_filter($postarr['post_category']);
2977 2977
 	}
2978 2978
 
2979 2979
 	// Make sure we set a valid category.
2980
-	if ( empty( $post_category ) || 0 == count( $post_category ) || ! is_array( $post_category ) ) {
2980
+	if (empty($post_category) || 0 == count($post_category) || ! is_array($post_category)) {
2981 2981
 		// 'post' requires at least one category.
2982
-		if ( 'post' == $post_type && 'auto-draft' != $post_status ) {
2983
-			$post_category = array( get_option('default_category') );
2982
+		if ('post' == $post_type && 'auto-draft' != $post_status) {
2983
+			$post_category = array(get_option('default_category'));
2984 2984
 		} else {
2985 2985
 			$post_category = array();
2986 2986
 		}
2987 2987
 	}
2988 2988
 
2989 2989
 	// Don't allow contributors to set the post slug for pending review posts.
2990
-	if ( 'pending' == $post_status && !current_user_can( 'publish_posts' ) ) {
2990
+	if ('pending' == $post_status && ! current_user_can('publish_posts')) {
2991 2991
 		$post_name = '';
2992 2992
 	}
2993 2993
 
@@ -2995,16 +2995,16 @@  discard block
 block discarded – undo
2995 2995
 	 * Create a valid post name. Drafts and pending posts are allowed to have
2996 2996
 	 * an empty post name.
2997 2997
 	 */
2998
-	if ( empty($post_name) ) {
2999
-		if ( !in_array( $post_status, array( 'draft', 'pending', 'auto-draft' ) ) ) {
2998
+	if (empty($post_name)) {
2999
+		if ( ! in_array($post_status, array('draft', 'pending', 'auto-draft'))) {
3000 3000
 			$post_name = sanitize_title($post_title);
3001 3001
 		} else {
3002 3002
 			$post_name = '';
3003 3003
 		}
3004 3004
 	} else {
3005 3005
 		// On updates, we need to check to see if it's using the old, fixed sanitization context.
3006
-		$check_name = sanitize_title( $post_name, '', 'old-save' );
3007
-		if ( $update && strtolower( urlencode( $post_name ) ) == $check_name && get_post_field( 'post_name', $post_ID ) == $check_name ) {
3006
+		$check_name = sanitize_title($post_name, '', 'old-save');
3007
+		if ($update && strtolower(urlencode($post_name)) == $check_name && get_post_field('post_name', $post_ID) == $check_name) {
3008 3008
 			$post_name = $check_name;
3009 3009
 		} else { // new post, or slug has changed.
3010 3010
 			$post_name = sanitize_title($post_name);
@@ -3015,32 +3015,32 @@  discard block
 block discarded – undo
3015 3015
 	 * If the post date is empty (due to having been new or a draft) and status
3016 3016
 	 * is not 'draft' or 'pending', set date to now.
3017 3017
 	 */
3018
-	if ( empty( $postarr['post_date'] ) || '0000-00-00 00:00:00' == $postarr['post_date'] ) {
3019
-		if ( empty( $postarr['post_date_gmt'] ) || '0000-00-00 00:00:00' == $postarr['post_date_gmt'] ) {
3020
-			$post_date = current_time( 'mysql' );
3018
+	if (empty($postarr['post_date']) || '0000-00-00 00:00:00' == $postarr['post_date']) {
3019
+		if (empty($postarr['post_date_gmt']) || '0000-00-00 00:00:00' == $postarr['post_date_gmt']) {
3020
+			$post_date = current_time('mysql');
3021 3021
 		} else {
3022
-			$post_date = get_date_from_gmt( $postarr['post_date_gmt'] );
3022
+			$post_date = get_date_from_gmt($postarr['post_date_gmt']);
3023 3023
 		}
3024 3024
 	} else {
3025 3025
 		$post_date = $postarr['post_date'];
3026 3026
 	}
3027 3027
 
3028 3028
 	// Validate the date.
3029
-	$mm = substr( $post_date, 5, 2 );
3030
-	$jj = substr( $post_date, 8, 2 );
3031
-	$aa = substr( $post_date, 0, 4 );
3032
-	$valid_date = wp_checkdate( $mm, $jj, $aa, $post_date );
3033
-	if ( ! $valid_date ) {
3034
-		if ( $wp_error ) {
3035
-			return new WP_Error( 'invalid_date', __( 'Whoops, the provided date is invalid.' ) );
3029
+	$mm = substr($post_date, 5, 2);
3030
+	$jj = substr($post_date, 8, 2);
3031
+	$aa = substr($post_date, 0, 4);
3032
+	$valid_date = wp_checkdate($mm, $jj, $aa, $post_date);
3033
+	if ( ! $valid_date) {
3034
+		if ($wp_error) {
3035
+			return new WP_Error('invalid_date', __('Whoops, the provided date is invalid.'));
3036 3036
 		} else {
3037 3037
 			return 0;
3038 3038
 		}
3039 3039
 	}
3040 3040
 
3041
-	if ( empty( $postarr['post_date_gmt'] ) || '0000-00-00 00:00:00' == $postarr['post_date_gmt'] ) {
3042
-		if ( ! in_array( $post_status, array( 'draft', 'pending', 'auto-draft' ) ) ) {
3043
-			$post_date_gmt = get_gmt_from_date( $post_date );
3041
+	if (empty($postarr['post_date_gmt']) || '0000-00-00 00:00:00' == $postarr['post_date_gmt']) {
3042
+		if ( ! in_array($post_status, array('draft', 'pending', 'auto-draft'))) {
3043
+			$post_date_gmt = get_gmt_from_date($post_date);
3044 3044
 		} else {
3045 3045
 			$post_date_gmt = '0000-00-00 00:00:00';
3046 3046
 		}
@@ -3048,34 +3048,34 @@  discard block
 block discarded – undo
3048 3048
 		$post_date_gmt = $postarr['post_date_gmt'];
3049 3049
 	}
3050 3050
 
3051
-	if ( $update || '0000-00-00 00:00:00' == $post_date ) {
3052
-		$post_modified     = current_time( 'mysql' );
3053
-		$post_modified_gmt = current_time( 'mysql', 1 );
3051
+	if ($update || '0000-00-00 00:00:00' == $post_date) {
3052
+		$post_modified     = current_time('mysql');
3053
+		$post_modified_gmt = current_time('mysql', 1);
3054 3054
 	} else {
3055 3055
 		$post_modified     = $post_date;
3056 3056
 		$post_modified_gmt = $post_date_gmt;
3057 3057
 	}
3058 3058
 
3059
-	if ( 'attachment' !== $post_type ) {
3060
-		if ( 'publish' == $post_status ) {
3059
+	if ('attachment' !== $post_type) {
3060
+		if ('publish' == $post_status) {
3061 3061
 			$now = gmdate('Y-m-d H:i:59');
3062
-			if ( mysql2date('U', $post_date_gmt, false) > mysql2date('U', $now, false) ) {
3062
+			if (mysql2date('U', $post_date_gmt, false) > mysql2date('U', $now, false)) {
3063 3063
 				$post_status = 'future';
3064 3064
 			}
3065
-		} elseif ( 'future' == $post_status ) {
3065
+		} elseif ('future' == $post_status) {
3066 3066
 			$now = gmdate('Y-m-d H:i:59');
3067
-			if ( mysql2date('U', $post_date_gmt, false) <= mysql2date('U', $now, false) ) {
3067
+			if (mysql2date('U', $post_date_gmt, false) <= mysql2date('U', $now, false)) {
3068 3068
 				$post_status = 'publish';
3069 3069
 			}
3070 3070
 		}
3071 3071
 	}
3072 3072
 
3073 3073
 	// Comment status.
3074
-	if ( empty( $postarr['comment_status'] ) ) {
3075
-		if ( $update ) {
3074
+	if (empty($postarr['comment_status'])) {
3075
+		if ($update) {
3076 3076
 			$comment_status = 'closed';
3077 3077
 		} else {
3078
-			$comment_status = get_default_comment_status( $post_type );
3078
+			$comment_status = get_default_comment_status($post_type);
3079 3079
 		}
3080 3080
 	} else {
3081 3081
 		$comment_status = $postarr['comment_status'];
@@ -3083,28 +3083,28 @@  discard block
 block discarded – undo
3083 3083
 
3084 3084
 	// These variables are needed by compact() later.
3085 3085
 	$post_content_filtered = $postarr['post_content_filtered'];
3086
-	$post_author = isset( $postarr['post_author'] ) ? $postarr['post_author'] : $user_id;
3087
-	$ping_status = empty( $postarr['ping_status'] ) ? get_default_comment_status( $post_type, 'pingback' ) : $postarr['ping_status'];
3088
-	$to_ping = isset( $postarr['to_ping'] ) ? sanitize_trackback_urls( $postarr['to_ping'] ) : '';
3089
-	$pinged = isset( $postarr['pinged'] ) ? $postarr['pinged'] : '';
3090
-	$import_id = isset( $postarr['import_id'] ) ? $postarr['import_id'] : 0;
3086
+	$post_author = isset($postarr['post_author']) ? $postarr['post_author'] : $user_id;
3087
+	$ping_status = empty($postarr['ping_status']) ? get_default_comment_status($post_type, 'pingback') : $postarr['ping_status'];
3088
+	$to_ping = isset($postarr['to_ping']) ? sanitize_trackback_urls($postarr['to_ping']) : '';
3089
+	$pinged = isset($postarr['pinged']) ? $postarr['pinged'] : '';
3090
+	$import_id = isset($postarr['import_id']) ? $postarr['import_id'] : 0;
3091 3091
 
3092 3092
 	/*
3093 3093
 	 * The 'wp_insert_post_parent' filter expects all variables to be present.
3094 3094
 	 * Previously, these variables would have already been extracted
3095 3095
 	 */
3096
-	if ( isset( $postarr['menu_order'] ) ) {
3096
+	if (isset($postarr['menu_order'])) {
3097 3097
 		$menu_order = (int) $postarr['menu_order'];
3098 3098
 	} else {
3099 3099
 		$menu_order = 0;
3100 3100
 	}
3101 3101
 
3102
-	$post_password = isset( $postarr['post_password'] ) ? $postarr['post_password'] : '';
3103
-	if ( 'private' == $post_status ) {
3102
+	$post_password = isset($postarr['post_password']) ? $postarr['post_password'] : '';
3103
+	if ('private' == $post_status) {
3104 3104
 		$post_password = '';
3105 3105
 	}
3106 3106
 
3107
-	if ( isset( $postarr['post_parent'] ) ) {
3107
+	if (isset($postarr['post_parent'])) {
3108 3108
 		$post_parent = (int) $postarr['post_parent'];
3109 3109
 	} else {
3110 3110
 		$post_parent = 0;
@@ -3120,50 +3120,50 @@  discard block
 block discarded – undo
3120 3120
 	 * @param array $new_postarr Array of parsed post data.
3121 3121
 	 * @param array $postarr     Array of sanitized, but otherwise unmodified post data.
3122 3122
 	 */
3123
-	$post_parent = apply_filters( 'wp_insert_post_parent', $post_parent, $post_ID, compact( array_keys( $postarr ) ), $postarr );
3123
+	$post_parent = apply_filters('wp_insert_post_parent', $post_parent, $post_ID, compact(array_keys($postarr)), $postarr);
3124 3124
 
3125 3125
 	/*
3126 3126
 	 * If the post is being untrashed and it has a desired slug stored in post meta,
3127 3127
 	 * reassign it.
3128 3128
 	 */
3129
-	if ( 'trash' === $previous_status && 'trash' !== $post_status ) {
3130
-		$desired_post_slug = get_post_meta( $post_ID, '_wp_desired_post_slug', true );
3131
-		if ( $desired_post_slug ) {
3132
-			delete_post_meta( $post_ID, '_wp_desired_post_slug' );
3129
+	if ('trash' === $previous_status && 'trash' !== $post_status) {
3130
+		$desired_post_slug = get_post_meta($post_ID, '_wp_desired_post_slug', true);
3131
+		if ($desired_post_slug) {
3132
+			delete_post_meta($post_ID, '_wp_desired_post_slug');
3133 3133
 			$post_name = $desired_post_slug;
3134 3134
 		}
3135 3135
 	}
3136 3136
 
3137 3137
 	// If a trashed post has the desired slug, change it and let this post have it.
3138
-	if ( 'trash' !== $post_status && $post_name ) {
3139
-		wp_add_trashed_suffix_to_post_name_for_trashed_posts( $post_name, $post_ID );
3138
+	if ('trash' !== $post_status && $post_name) {
3139
+		wp_add_trashed_suffix_to_post_name_for_trashed_posts($post_name, $post_ID);
3140 3140
 	}
3141 3141
 
3142 3142
 	// When trashing an existing post, change its slug to allow non-trashed posts to use it.
3143
-	if ( 'trash' === $post_status && 'trash' !== $previous_status && 'new' !== $previous_status ) {
3144
-		$post_name = wp_add_trashed_suffix_to_post_name_for_post( $post_ID );
3143
+	if ('trash' === $post_status && 'trash' !== $previous_status && 'new' !== $previous_status) {
3144
+		$post_name = wp_add_trashed_suffix_to_post_name_for_post($post_ID);
3145 3145
 	}
3146 3146
 
3147
-	$post_name = wp_unique_post_slug( $post_name, $post_ID, $post_status, $post_type, $post_parent );
3147
+	$post_name = wp_unique_post_slug($post_name, $post_ID, $post_status, $post_type, $post_parent);
3148 3148
 
3149 3149
 	// Don't unslash.
3150
-	$post_mime_type = isset( $postarr['post_mime_type'] ) ? $postarr['post_mime_type'] : '';
3150
+	$post_mime_type = isset($postarr['post_mime_type']) ? $postarr['post_mime_type'] : '';
3151 3151
 
3152 3152
 	// Expected_slashed (everything!).
3153
-	$data = compact( 'post_author', 'post_date', 'post_date_gmt', 'post_content', 'post_content_filtered', 'post_title', 'post_excerpt', 'post_status', 'post_type', 'comment_status', 'ping_status', 'post_password', 'post_name', 'to_ping', 'pinged', 'post_modified', 'post_modified_gmt', 'post_parent', 'menu_order', 'post_mime_type', 'guid' );
3153
+	$data = compact('post_author', 'post_date', 'post_date_gmt', 'post_content', 'post_content_filtered', 'post_title', 'post_excerpt', 'post_status', 'post_type', 'comment_status', 'ping_status', 'post_password', 'post_name', 'to_ping', 'pinged', 'post_modified', 'post_modified_gmt', 'post_parent', 'menu_order', 'post_mime_type', 'guid');
3154 3154
 
3155
-	$emoji_fields = array( 'post_title', 'post_content', 'post_excerpt' );
3155
+	$emoji_fields = array('post_title', 'post_content', 'post_excerpt');
3156 3156
 
3157
-	foreach ( $emoji_fields as $emoji_field ) {
3158
-		if ( isset( $data[ $emoji_field ] ) ) {
3159
-			$charset = $wpdb->get_col_charset( $wpdb->posts, $emoji_field );
3160
-			if ( 'utf8' === $charset ) {
3161
-				$data[ $emoji_field ] = wp_encode_emoji( $data[ $emoji_field ] );
3157
+	foreach ($emoji_fields as $emoji_field) {
3158
+		if (isset($data[$emoji_field])) {
3159
+			$charset = $wpdb->get_col_charset($wpdb->posts, $emoji_field);
3160
+			if ('utf8' === $charset) {
3161
+				$data[$emoji_field] = wp_encode_emoji($data[$emoji_field]);
3162 3162
 			}
3163 3163
 		}
3164 3164
 	}
3165 3165
 
3166
-	if ( 'attachment' === $post_type ) {
3166
+	if ('attachment' === $post_type) {
3167 3167
 		/**
3168 3168
 		 * Filters attachment post data before it is updated in or added to the database.
3169 3169
 		 *
@@ -3172,7 +3172,7 @@  discard block
 block discarded – undo
3172 3172
 		 * @param array $data    An array of sanitized attachment post data.
3173 3173
 		 * @param array $postarr An array of unsanitized attachment post data.
3174 3174
 		 */
3175
-		$data = apply_filters( 'wp_insert_attachment_data', $data, $postarr );
3175
+		$data = apply_filters('wp_insert_attachment_data', $data, $postarr);
3176 3176
 	} else {
3177 3177
 		/**
3178 3178
 		 * Filters slashed post data just before it is inserted into the database.
@@ -3182,12 +3182,12 @@  discard block
 block discarded – undo
3182 3182
 		 * @param array $data    An array of slashed post data.
3183 3183
 		 * @param array $postarr An array of sanitized, but otherwise unmodified post data.
3184 3184
 		 */
3185
-		$data = apply_filters( 'wp_insert_post_data', $data, $postarr );
3185
+		$data = apply_filters('wp_insert_post_data', $data, $postarr);
3186 3186
 	}
3187
-	$data = wp_unslash( $data );
3188
-	$where = array( 'ID' => $post_ID );
3187
+	$data = wp_unslash($data);
3188
+	$where = array('ID' => $post_ID);
3189 3189
 
3190
-	if ( $update ) {
3190
+	if ($update) {
3191 3191
 		/**
3192 3192
 		 * Fires immediately before an existing post is updated in the database.
3193 3193
 		 *
@@ -3196,9 +3196,9 @@  discard block
 block discarded – undo
3196 3196
 		 * @param int   $post_ID Post ID.
3197 3197
 		 * @param array $data    Array of unslashed post data.
3198 3198
 		 */
3199
-		do_action( 'pre_post_update', $post_ID, $data );
3200
-		if ( false === $wpdb->update( $wpdb->posts, $data, $where ) ) {
3201
-			if ( $wp_error ) {
3199
+		do_action('pre_post_update', $post_ID, $data);
3200
+		if (false === $wpdb->update($wpdb->posts, $data, $where)) {
3201
+			if ($wp_error) {
3202 3202
 				return new WP_Error('db_update_error', __('Could not update post in the database'), $wpdb->last_error);
3203 3203
 			} else {
3204 3204
 				return 0;
@@ -3206,14 +3206,14 @@  discard block
 block discarded – undo
3206 3206
 		}
3207 3207
 	} else {
3208 3208
 		// If there is a suggested ID, use it if not already present.
3209
-		if ( ! empty( $import_id ) ) {
3209
+		if ( ! empty($import_id)) {
3210 3210
 			$import_id = (int) $import_id;
3211
-			if ( ! $wpdb->get_var( $wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE ID = %d", $import_id) ) ) {
3211
+			if ( ! $wpdb->get_var($wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE ID = %d", $import_id))) {
3212 3212
 				$data['ID'] = $import_id;
3213 3213
 			}
3214 3214
 		}
3215
-		if ( false === $wpdb->insert( $wpdb->posts, $data ) ) {
3216
-			if ( $wp_error ) {
3215
+		if (false === $wpdb->insert($wpdb->posts, $data)) {
3216
+			if ($wp_error) {
3217 3217
 				return new WP_Error('db_insert_error', __('Could not insert post into the database'), $wpdb->last_error);
3218 3218
 			} else {
3219 3219
 				return 0;
@@ -3222,97 +3222,97 @@  discard block
 block discarded – undo
3222 3222
 		$post_ID = (int) $wpdb->insert_id;
3223 3223
 
3224 3224
 		// Use the newly generated $post_ID.
3225
-		$where = array( 'ID' => $post_ID );
3225
+		$where = array('ID' => $post_ID);
3226 3226
 	}
3227 3227
 
3228
-	if ( empty( $data['post_name'] ) && ! in_array( $data['post_status'], array( 'draft', 'pending', 'auto-draft' ) ) ) {
3229
-		$data['post_name'] = wp_unique_post_slug( sanitize_title( $data['post_title'], $post_ID ), $post_ID, $data['post_status'], $post_type, $post_parent );
3230
-		$wpdb->update( $wpdb->posts, array( 'post_name' => $data['post_name'] ), $where );
3231
-		clean_post_cache( $post_ID );
3228
+	if (empty($data['post_name']) && ! in_array($data['post_status'], array('draft', 'pending', 'auto-draft'))) {
3229
+		$data['post_name'] = wp_unique_post_slug(sanitize_title($data['post_title'], $post_ID), $post_ID, $data['post_status'], $post_type, $post_parent);
3230
+		$wpdb->update($wpdb->posts, array('post_name' => $data['post_name']), $where);
3231
+		clean_post_cache($post_ID);
3232 3232
 	}
3233 3233
 
3234
-	if ( is_object_in_taxonomy( $post_type, 'category' ) ) {
3235
-		wp_set_post_categories( $post_ID, $post_category );
3234
+	if (is_object_in_taxonomy($post_type, 'category')) {
3235
+		wp_set_post_categories($post_ID, $post_category);
3236 3236
 	}
3237 3237
 
3238
-	if ( isset( $postarr['tags_input'] ) && is_object_in_taxonomy( $post_type, 'post_tag' ) ) {
3239
-		wp_set_post_tags( $post_ID, $postarr['tags_input'] );
3238
+	if (isset($postarr['tags_input']) && is_object_in_taxonomy($post_type, 'post_tag')) {
3239
+		wp_set_post_tags($post_ID, $postarr['tags_input']);
3240 3240
 	}
3241 3241
 
3242 3242
 	// New-style support for all custom taxonomies.
3243
-	if ( ! empty( $postarr['tax_input'] ) ) {
3244
-		foreach ( $postarr['tax_input'] as $taxonomy => $tags ) {
3243
+	if ( ! empty($postarr['tax_input'])) {
3244
+		foreach ($postarr['tax_input'] as $taxonomy => $tags) {
3245 3245
 			$taxonomy_obj = get_taxonomy($taxonomy);
3246
-			if ( ! $taxonomy_obj ) {
3246
+			if ( ! $taxonomy_obj) {
3247 3247
 				/* translators: %s: taxonomy name */
3248
-				_doing_it_wrong( __FUNCTION__, sprintf( __( 'Invalid taxonomy: %s.' ), $taxonomy ), '4.4.0' );
3248
+				_doing_it_wrong(__FUNCTION__, sprintf(__('Invalid taxonomy: %s.'), $taxonomy), '4.4.0');
3249 3249
 				continue;
3250 3250
 			}
3251 3251
 
3252 3252
 			// array = hierarchical, string = non-hierarchical.
3253
-			if ( is_array( $tags ) ) {
3253
+			if (is_array($tags)) {
3254 3254
 				$tags = array_filter($tags);
3255 3255
 			}
3256
-			if ( current_user_can( $taxonomy_obj->cap->assign_terms ) ) {
3257
-				wp_set_post_terms( $post_ID, $tags, $taxonomy );
3256
+			if (current_user_can($taxonomy_obj->cap->assign_terms)) {
3257
+				wp_set_post_terms($post_ID, $tags, $taxonomy);
3258 3258
 			}
3259 3259
 		}
3260 3260
 	}
3261 3261
 
3262 3262
 	// Set or remove featured image.
3263
-	if ( isset( $postarr['_thumbnail_id'] ) && ( post_type_supports( $post_type, 'thumbnail' ) || 'revision' === $post_type ) ) {
3264
-		$thumbnail_id = intval( $postarr['_thumbnail_id'] );
3263
+	if (isset($postarr['_thumbnail_id']) && (post_type_supports($post_type, 'thumbnail') || 'revision' === $post_type)) {
3264
+		$thumbnail_id = intval($postarr['_thumbnail_id']);
3265 3265
 		if ( -1 === $thumbnail_id ) {
3266
-			delete_post_thumbnail( $post_ID );
3266
+			delete_post_thumbnail($post_ID);
3267 3267
 		} else {
3268
-			set_post_thumbnail( $post_ID, $thumbnail_id );
3268
+			set_post_thumbnail($post_ID, $thumbnail_id);
3269 3269
 		}
3270 3270
 	}
3271 3271
 
3272
-	if ( ! empty( $postarr['meta_input'] ) ) {
3273
-		foreach ( $postarr['meta_input'] as $field => $value ) {
3274
-			update_post_meta( $post_ID, $field, $value );
3272
+	if ( ! empty($postarr['meta_input'])) {
3273
+		foreach ($postarr['meta_input'] as $field => $value) {
3274
+			update_post_meta($post_ID, $field, $value);
3275 3275
 		}
3276 3276
 	}
3277 3277
 
3278
-	$current_guid = get_post_field( 'guid', $post_ID );
3278
+	$current_guid = get_post_field('guid', $post_ID);
3279 3279
 
3280 3280
 	// Set GUID.
3281
-	if ( ! $update && '' == $current_guid ) {
3282
-		$wpdb->update( $wpdb->posts, array( 'guid' => get_permalink( $post_ID ) ), $where );
3281
+	if ( ! $update && '' == $current_guid) {
3282
+		$wpdb->update($wpdb->posts, array('guid' => get_permalink($post_ID)), $where);
3283 3283
 	}
3284 3284
 
3285
-	if ( 'attachment' === $postarr['post_type'] ) {
3286
-		if ( ! empty( $postarr['file'] ) ) {
3287
-			update_attached_file( $post_ID, $postarr['file'] );
3285
+	if ('attachment' === $postarr['post_type']) {
3286
+		if ( ! empty($postarr['file'])) {
3287
+			update_attached_file($post_ID, $postarr['file']);
3288 3288
 		}
3289 3289
 
3290
-		if ( ! empty( $postarr['context'] ) ) {
3291
-			add_post_meta( $post_ID, '_wp_attachment_context', $postarr['context'], true );
3290
+		if ( ! empty($postarr['context'])) {
3291
+			add_post_meta($post_ID, '_wp_attachment_context', $postarr['context'], true);
3292 3292
 		}
3293 3293
 	}
3294 3294
 
3295
-	clean_post_cache( $post_ID );
3295
+	clean_post_cache($post_ID);
3296 3296
 
3297
-	$post = get_post( $post_ID );
3297
+	$post = get_post($post_ID);
3298 3298
 
3299
-	if ( ! empty( $postarr['page_template'] ) && 'page' == $data['post_type'] ) {
3299
+	if ( ! empty($postarr['page_template']) && 'page' == $data['post_type']) {
3300 3300
 		$post->page_template = $postarr['page_template'];
3301
-		$page_templates = wp_get_theme()->get_page_templates( $post );
3302
-		if ( 'default' != $postarr['page_template'] && ! isset( $page_templates[ $postarr['page_template'] ] ) ) {
3303
-			if ( $wp_error ) {
3301
+		$page_templates = wp_get_theme()->get_page_templates($post);
3302
+		if ('default' != $postarr['page_template'] && ! isset($page_templates[$postarr['page_template']])) {
3303
+			if ($wp_error) {
3304 3304
 				return new WP_Error('invalid_page_template', __('The page template is invalid.'));
3305 3305
 			}
3306
-			update_post_meta( $post_ID, '_wp_page_template', 'default' );
3306
+			update_post_meta($post_ID, '_wp_page_template', 'default');
3307 3307
 		} else {
3308
-			update_post_meta( $post_ID, '_wp_page_template', $postarr['page_template'] );
3308
+			update_post_meta($post_ID, '_wp_page_template', $postarr['page_template']);
3309 3309
 		}
3310 3310
 	}
3311 3311
 
3312
-	if ( 'attachment' !== $postarr['post_type'] ) {
3313
-		wp_transition_post_status( $data['post_status'], $previous_status, $post );
3312
+	if ('attachment' !== $postarr['post_type']) {
3313
+		wp_transition_post_status($data['post_status'], $previous_status, $post);
3314 3314
 	} else {
3315
-		if ( $update ) {
3315
+		if ($update) {
3316 3316
 			/**
3317 3317
 			 * Fires once an existing attachment has been updated.
3318 3318
 			 *
@@ -3320,8 +3320,8 @@  discard block
 block discarded – undo
3320 3320
 			 *
3321 3321
 			 * @param int $post_ID Attachment ID.
3322 3322
 			 */
3323
-			do_action( 'edit_attachment', $post_ID );
3324
-			$post_after = get_post( $post_ID );
3323
+			do_action('edit_attachment', $post_ID);
3324
+			$post_after = get_post($post_ID);
3325 3325
 
3326 3326
 			/**
3327 3327
 			 * Fires once an existing attachment has been updated.
@@ -3332,7 +3332,7 @@  discard block
 block discarded – undo
3332 3332
 			 * @param WP_Post $post_after   Post object following the update.
3333 3333
 			 * @param WP_Post $post_before  Post object before the update.
3334 3334
 			 */
3335
-			do_action( 'attachment_updated', $post_ID, $post_after, $post_before );
3335
+			do_action('attachment_updated', $post_ID, $post_after, $post_before);
3336 3336
 		} else {
3337 3337
 
3338 3338
 			/**
@@ -3342,13 +3342,13 @@  discard block
 block discarded – undo
3342 3342
 			 *
3343 3343
 			 * @param int $post_ID Attachment ID.
3344 3344
 			 */
3345
-			do_action( 'add_attachment', $post_ID );
3345
+			do_action('add_attachment', $post_ID);
3346 3346
 		}
3347 3347
 
3348 3348
 		return $post_ID;
3349 3349
 	}
3350 3350
 
3351
-	if ( $update ) {
3351
+	if ($update) {
3352 3352
 		/**
3353 3353
 		 * Fires once an existing post has been updated.
3354 3354
 		 *
@@ -3357,7 +3357,7 @@  discard block
 block discarded – undo
3357 3357
 		 * @param int     $post_ID Post ID.
3358 3358
 		 * @param WP_Post $post    Post object.
3359 3359
 		 */
3360
-		do_action( 'edit_post', $post_ID, $post );
3360
+		do_action('edit_post', $post_ID, $post);
3361 3361
 		$post_after = get_post($post_ID);
3362 3362
 
3363 3363
 		/**
@@ -3369,7 +3369,7 @@  discard block
 block discarded – undo
3369 3369
 		 * @param WP_Post $post_after   Post object following the update.
3370 3370
 		 * @param WP_Post $post_before  Post object before the update.
3371 3371
 		 */
3372
-		do_action( 'post_updated', $post_ID, $post_after, $post_before);
3372
+		do_action('post_updated', $post_ID, $post_after, $post_before);
3373 3373
 	}
3374 3374
 
3375 3375
 	/**
@@ -3384,7 +3384,7 @@  discard block
 block discarded – undo
3384 3384
 	 * @param WP_Post $post    Post object.
3385 3385
 	 * @param bool    $update  Whether this is an existing post being updated or not.
3386 3386
 	 */
3387
-	do_action( "save_post_{$post->post_type}", $post_ID, $post, $update );
3387
+	do_action("save_post_{$post->post_type}", $post_ID, $post, $update);
3388 3388
 
3389 3389
 	/**
3390 3390
 	 * Fires once a post has been saved.
@@ -3395,7 +3395,7 @@  discard block
 block discarded – undo
3395 3395
 	 * @param WP_Post $post    Post object.
3396 3396
 	 * @param bool    $update  Whether this is an existing post being updated or not.
3397 3397
 	 */
3398
-	do_action( 'save_post', $post_ID, $post, $update );
3398
+	do_action('save_post', $post_ID, $post, $update);
3399 3399
 
3400 3400
 	/**
3401 3401
 	 * Fires once a post has been saved.
@@ -3406,7 +3406,7 @@  discard block
 block discarded – undo
3406 3406
 	 * @param WP_Post $post    Post object.
3407 3407
 	 * @param bool    $update  Whether this is an existing post being updated or not.
3408 3408
 	 */
3409
-	do_action( 'wp_insert_post', $post_ID, $post, $update );
3409
+	do_action('wp_insert_post', $post_ID, $post, $update);
3410 3410
 
3411 3411
 	return $post_ID;
3412 3412
 }
@@ -3424,8 +3424,8 @@  discard block
 block discarded – undo
3424 3424
  * @param bool         $wp_error Optional. Allow return of WP_Error on failure. Default false.
3425 3425
  * @return int|WP_Error The value 0 or WP_Error on failure. The post ID on success.
3426 3426
  */
3427
-function wp_update_post( $postarr = array(), $wp_error = false ) {
3428
-	if ( is_object($postarr) ) {
3427
+function wp_update_post($postarr = array(), $wp_error = false) {
3428
+	if (is_object($postarr)) {
3429 3429
 		// Non-escaped post was passed.
3430 3430
 		$postarr = get_object_vars($postarr);
3431 3431
 		$postarr = wp_slash($postarr);
@@ -3434,9 +3434,9 @@  discard block
 block discarded – undo
3434 3434
 	// First, get all of the original fields.
3435 3435
 	$post = get_post($postarr['ID'], ARRAY_A);
3436 3436
 
3437
-	if ( is_null( $post ) ) {
3438
-		if ( $wp_error )
3439
-			return new WP_Error( 'invalid_post', __( 'Invalid post ID.' ) );
3437
+	if (is_null($post)) {
3438
+		if ($wp_error)
3439
+			return new WP_Error('invalid_post', __('Invalid post ID.'));
3440 3440
 		return 0;
3441 3441
 	}
3442 3442
 
@@ -3444,15 +3444,15 @@  discard block
 block discarded – undo
3444 3444
 	$post = wp_slash($post);
3445 3445
 
3446 3446
 	// Passed post category list overwrites existing category list if not empty.
3447
-	if ( isset($postarr['post_category']) && is_array($postarr['post_category'])
3448
-			 && 0 != count($postarr['post_category']) )
3447
+	if (isset($postarr['post_category']) && is_array($postarr['post_category'])
3448
+			 && 0 != count($postarr['post_category']))
3449 3449
 		$post_cats = $postarr['post_category'];
3450 3450
 	else
3451 3451
 		$post_cats = $post['post_category'];
3452 3452
 
3453 3453
 	// Drafts shouldn't be assigned a date unless explicitly done so by the user.
3454
-	if ( isset( $post['post_status'] ) && in_array($post['post_status'], array('draft', 'pending', 'auto-draft')) && empty($postarr['edit_date']) &&
3455
-			 ('0000-00-00 00:00:00' == $post['post_date_gmt']) )
3454
+	if (isset($post['post_status']) && in_array($post['post_status'], array('draft', 'pending', 'auto-draft')) && empty($postarr['edit_date']) &&
3455
+			 ('0000-00-00 00:00:00' == $post['post_date_gmt']))
3456 3456
 		$clear_date = true;
3457 3457
 	else
3458 3458
 		$clear_date = false;
@@ -3460,7 +3460,7 @@  discard block
 block discarded – undo
3460 3460
 	// Merge old and new fields with new fields overwriting old ones.
3461 3461
 	$postarr = array_merge($post, $postarr);
3462 3462
 	$postarr['post_category'] = $post_cats;
3463
-	if ( $clear_date ) {
3463
+	if ($clear_date) {
3464 3464
 		$postarr['post_date'] = current_time('mysql');
3465 3465
 		$postarr['post_date_gmt'] = '';
3466 3466
 	}
@@ -3468,7 +3468,7 @@  discard block
 block discarded – undo
3468 3468
 	if ($postarr['post_type'] == 'attachment')
3469 3469
 		return wp_insert_attachment($postarr);
3470 3470
 
3471
-	return wp_insert_post( $postarr, $wp_error );
3471
+	return wp_insert_post($postarr, $wp_error);
3472 3472
 }
3473 3473
 
3474 3474
 /**
@@ -3480,34 +3480,34 @@  discard block
 block discarded – undo
3480 3480
  *
3481 3481
  * @param int|WP_Post $post Post ID or post object.
3482 3482
  */
3483
-function wp_publish_post( $post ) {
3483
+function wp_publish_post($post) {
3484 3484
 	global $wpdb;
3485 3485
 
3486
-	if ( ! $post = get_post( $post ) )
3486
+	if ( ! $post = get_post($post))
3487 3487
 		return;
3488 3488
 
3489
-	if ( 'publish' == $post->post_status )
3489
+	if ('publish' == $post->post_status)
3490 3490
 		return;
3491 3491
 
3492
-	$wpdb->update( $wpdb->posts, array( 'post_status' => 'publish' ), array( 'ID' => $post->ID ) );
3492
+	$wpdb->update($wpdb->posts, array('post_status' => 'publish'), array('ID' => $post->ID));
3493 3493
 
3494
-	clean_post_cache( $post->ID );
3494
+	clean_post_cache($post->ID);
3495 3495
 
3496 3496
 	$old_status = $post->post_status;
3497 3497
 	$post->post_status = 'publish';
3498
-	wp_transition_post_status( 'publish', $old_status, $post );
3498
+	wp_transition_post_status('publish', $old_status, $post);
3499 3499
 
3500 3500
 	/** This action is documented in wp-includes/post.php */
3501
-	do_action( 'edit_post', $post->ID, $post );
3501
+	do_action('edit_post', $post->ID, $post);
3502 3502
 
3503 3503
 	/** This action is documented in wp-includes/post.php */
3504
-	do_action( "save_post_{$post->post_type}", $post->ID, $post, true );
3504
+	do_action("save_post_{$post->post_type}", $post->ID, $post, true);
3505 3505
 
3506 3506
 	/** This action is documented in wp-includes/post.php */
3507
-	do_action( 'save_post', $post->ID, $post, true );
3507
+	do_action('save_post', $post->ID, $post, true);
3508 3508
 
3509 3509
 	/** This action is documented in wp-includes/post.php */
3510
-	do_action( 'wp_insert_post', $post->ID, $post, true );
3510
+	do_action('wp_insert_post', $post->ID, $post, true);
3511 3511
 }
3512 3512
 
3513 3513
 /**
@@ -3520,26 +3520,26 @@  discard block
 block discarded – undo
3520 3520
  *
3521 3521
  * @param int|WP_Post $post_id Post ID or post object.
3522 3522
  */
3523
-function check_and_publish_future_post( $post_id ) {
3523
+function check_and_publish_future_post($post_id) {
3524 3524
 	$post = get_post($post_id);
3525 3525
 
3526
-	if ( empty($post) )
3526
+	if (empty($post))
3527 3527
 		return;
3528 3528
 
3529
-	if ( 'future' != $post->post_status )
3529
+	if ('future' != $post->post_status)
3530 3530
 		return;
3531 3531
 
3532
-	$time = strtotime( $post->post_date_gmt . ' GMT' );
3532
+	$time = strtotime($post->post_date_gmt.' GMT');
3533 3533
 
3534 3534
 	// Uh oh, someone jumped the gun!
3535
-	if ( $time > time() ) {
3536
-		wp_clear_scheduled_hook( 'publish_future_post', array( $post_id ) ); // clear anything else in the system
3537
-		wp_schedule_single_event( $time, 'publish_future_post', array( $post_id ) );
3535
+	if ($time > time()) {
3536
+		wp_clear_scheduled_hook('publish_future_post', array($post_id)); // clear anything else in the system
3537
+		wp_schedule_single_event($time, 'publish_future_post', array($post_id));
3538 3538
 		return;
3539 3539
 	}
3540 3540
 
3541 3541
 	// wp_publish_post() returns no meaningful value.
3542
-	wp_publish_post( $post_id );
3542
+	wp_publish_post($post_id);
3543 3543
 }
3544 3544
 
3545 3545
 /**
@@ -3557,8 +3557,8 @@  discard block
 block discarded – undo
3557 3557
  * @param int    $post_parent Post parent ID.
3558 3558
  * @return string Unique slug for the post, based on $post_name (with a -1, -2, etc. suffix)
3559 3559
  */
3560
-function wp_unique_post_slug( $slug, $post_ID, $post_status, $post_type, $post_parent ) {
3561
-	if ( in_array( $post_status, array( 'draft', 'pending', 'auto-draft' ) ) || ( 'inherit' == $post_status && 'revision' == $post_type ) )
3560
+function wp_unique_post_slug($slug, $post_ID, $post_status, $post_type, $post_parent) {
3561
+	if (in_array($post_status, array('draft', 'pending', 'auto-draft')) || ('inherit' == $post_status && 'revision' == $post_type))
3562 3562
 		return $slug;
3563 3563
 
3564 3564
 	global $wpdb, $wp_rewrite;
@@ -3566,13 +3566,13 @@  discard block
 block discarded – undo
3566 3566
 	$original_slug = $slug;
3567 3567
 
3568 3568
 	$feeds = $wp_rewrite->feeds;
3569
-	if ( ! is_array( $feeds ) )
3569
+	if ( ! is_array($feeds))
3570 3570
 		$feeds = array();
3571 3571
 
3572
-	if ( 'attachment' == $post_type ) {
3572
+	if ('attachment' == $post_type) {
3573 3573
 		// Attachment slugs must be unique across all types.
3574 3574
 		$check_sql = "SELECT post_name FROM $wpdb->posts WHERE post_name = %s AND ID != %d LIMIT 1";
3575
-		$post_name_check = $wpdb->get_var( $wpdb->prepare( $check_sql, $slug, $post_ID ) );
3575
+		$post_name_check = $wpdb->get_var($wpdb->prepare($check_sql, $slug, $post_ID));
3576 3576
 
3577 3577
 		/**
3578 3578
 		 * Filters whether the post slug would make a bad attachment slug.
@@ -3582,17 +3582,17 @@  discard block
 block discarded – undo
3582 3582
 		 * @param bool   $bad_slug Whether the slug would be bad as an attachment slug.
3583 3583
 		 * @param string $slug     The post slug.
3584 3584
 		 */
3585
-		if ( $post_name_check || in_array( $slug, $feeds ) || 'embed' === $slug || apply_filters( 'wp_unique_post_slug_is_bad_attachment_slug', false, $slug ) ) {
3585
+		if ($post_name_check || in_array($slug, $feeds) || 'embed' === $slug || apply_filters('wp_unique_post_slug_is_bad_attachment_slug', false, $slug)) {
3586 3586
 			$suffix = 2;
3587 3587
 			do {
3588
-				$alt_post_name = _truncate_post_slug( $slug, 200 - ( strlen( $suffix ) + 1 ) ) . "-$suffix";
3589
-				$post_name_check = $wpdb->get_var( $wpdb->prepare( $check_sql, $alt_post_name, $post_ID ) );
3588
+				$alt_post_name = _truncate_post_slug($slug, 200 - (strlen($suffix) + 1))."-$suffix";
3589
+				$post_name_check = $wpdb->get_var($wpdb->prepare($check_sql, $alt_post_name, $post_ID));
3590 3590
 				$suffix++;
3591
-			} while ( $post_name_check );
3591
+			} while ($post_name_check);
3592 3592
 			$slug = $alt_post_name;
3593 3593
 		}
3594
-	} elseif ( is_post_type_hierarchical( $post_type ) ) {
3595
-		if ( 'nav_menu_item' == $post_type )
3594
+	} elseif (is_post_type_hierarchical($post_type)) {
3595
+		if ('nav_menu_item' == $post_type)
3596 3596
 			return $slug;
3597 3597
 
3598 3598
 		/*
@@ -3600,7 +3600,7 @@  discard block
 block discarded – undo
3600 3600
 		 * namespace than posts so page slugs are allowed to overlap post slugs.
3601 3601
 		 */
3602 3602
 		$check_sql = "SELECT post_name FROM $wpdb->posts WHERE post_name = %s AND post_type IN ( %s, 'attachment' ) AND ID != %d AND post_parent = %d LIMIT 1";
3603
-		$post_name_check = $wpdb->get_var( $wpdb->prepare( $check_sql, $slug, $post_type, $post_ID, $post_parent ) );
3603
+		$post_name_check = $wpdb->get_var($wpdb->prepare($check_sql, $slug, $post_type, $post_ID, $post_parent));
3604 3604
 
3605 3605
 		/**
3606 3606
 		 * Filters whether the post slug would make a bad hierarchical post slug.
@@ -3612,26 +3612,26 @@  discard block
 block discarded – undo
3612 3612
 		 * @param string $post_type   Post type.
3613 3613
 		 * @param int    $post_parent Post parent ID.
3614 3614
 		 */
3615
-		if ( $post_name_check || in_array( $slug, $feeds ) || 'embed' === $slug || preg_match( "@^($wp_rewrite->pagination_base)?\d+$@", $slug )  || apply_filters( 'wp_unique_post_slug_is_bad_hierarchical_slug', false, $slug, $post_type, $post_parent ) ) {
3615
+		if ($post_name_check || in_array($slug, $feeds) || 'embed' === $slug || preg_match("@^($wp_rewrite->pagination_base)?\d+$@", $slug) || apply_filters('wp_unique_post_slug_is_bad_hierarchical_slug', false, $slug, $post_type, $post_parent)) {
3616 3616
 			$suffix = 2;
3617 3617
 			do {
3618
-				$alt_post_name = _truncate_post_slug( $slug, 200 - ( strlen( $suffix ) + 1 ) ) . "-$suffix";
3619
-				$post_name_check = $wpdb->get_var( $wpdb->prepare( $check_sql, $alt_post_name, $post_type, $post_ID, $post_parent ) );
3618
+				$alt_post_name = _truncate_post_slug($slug, 200 - (strlen($suffix) + 1))."-$suffix";
3619
+				$post_name_check = $wpdb->get_var($wpdb->prepare($check_sql, $alt_post_name, $post_type, $post_ID, $post_parent));
3620 3620
 				$suffix++;
3621
-			} while ( $post_name_check );
3621
+			} while ($post_name_check);
3622 3622
 			$slug = $alt_post_name;
3623 3623
 		}
3624 3624
 	} else {
3625 3625
 		// Post slugs must be unique across all posts.
3626 3626
 		$check_sql = "SELECT post_name FROM $wpdb->posts WHERE post_name = %s AND post_type = %s AND ID != %d LIMIT 1";
3627
-		$post_name_check = $wpdb->get_var( $wpdb->prepare( $check_sql, $slug, $post_type, $post_ID ) );
3627
+		$post_name_check = $wpdb->get_var($wpdb->prepare($check_sql, $slug, $post_type, $post_ID));
3628 3628
 
3629 3629
 		// Prevent new post slugs that could result in URLs that conflict with date archives.
3630
-		$post = get_post( $post_ID );
3630
+		$post = get_post($post_ID);
3631 3631
 		$conflicts_with_date_archive = false;
3632
-		if ( 'post' === $post_type && ( ! $post || $post->post_name !== $slug ) && preg_match( '/^[0-9]+$/', $slug ) && $slug_num = intval( $slug ) ) {
3633
-			$permastructs   = array_values( array_filter( explode( '/', get_option( 'permalink_structure' ) ) ) );
3634
-			$postname_index = array_search( '%postname%', $permastructs );
3632
+		if ('post' === $post_type && ( ! $post || $post->post_name !== $slug) && preg_match('/^[0-9]+$/', $slug) && $slug_num = intval($slug)) {
3633
+			$permastructs   = array_values(array_filter(explode('/', get_option('permalink_structure'))));
3634
+			$postname_index = array_search('%postname%', $permastructs);
3635 3635
 
3636 3636
 			/*
3637 3637
 			 * Potential date clashes are as follows:
@@ -3640,9 +3640,9 @@  discard block
 block discarded – undo
3640 3640
 			 * - An integer between 1 and 12 that follows 'year' conflicts with 'monthnum'.
3641 3641
 			 * - An integer between 1 and 31 that follows 'monthnum' conflicts with 'day'.
3642 3642
 			 */
3643
-			if ( 0 === $postname_index ||
3644
-				( $postname_index && '%year%' === $permastructs[ $postname_index - 1 ] && 13 > $slug_num ) ||
3645
-				( $postname_index && '%monthnum%' === $permastructs[ $postname_index - 1 ] && 32 > $slug_num )
3643
+			if (0 === $postname_index ||
3644
+				($postname_index && '%year%' === $permastructs[$postname_index - 1] && 13 > $slug_num) ||
3645
+				($postname_index && '%monthnum%' === $permastructs[$postname_index - 1] && 32 > $slug_num)
3646 3646
 			) {
3647 3647
 				$conflicts_with_date_archive = true;
3648 3648
 			}
@@ -3657,13 +3657,13 @@  discard block
 block discarded – undo
3657 3657
 		 * @param string $slug      The post slug.
3658 3658
 		 * @param string $post_type Post type.
3659 3659
 		 */
3660
-		if ( $post_name_check || in_array( $slug, $feeds ) || 'embed' === $slug || $conflicts_with_date_archive || apply_filters( 'wp_unique_post_slug_is_bad_flat_slug', false, $slug, $post_type ) ) {
3660
+		if ($post_name_check || in_array($slug, $feeds) || 'embed' === $slug || $conflicts_with_date_archive || apply_filters('wp_unique_post_slug_is_bad_flat_slug', false, $slug, $post_type)) {
3661 3661
 			$suffix = 2;
3662 3662
 			do {
3663
-				$alt_post_name = _truncate_post_slug( $slug, 200 - ( strlen( $suffix ) + 1 ) ) . "-$suffix";
3664
-				$post_name_check = $wpdb->get_var( $wpdb->prepare( $check_sql, $alt_post_name, $post_type, $post_ID ) );
3663
+				$alt_post_name = _truncate_post_slug($slug, 200 - (strlen($suffix) + 1))."-$suffix";
3664
+				$post_name_check = $wpdb->get_var($wpdb->prepare($check_sql, $alt_post_name, $post_type, $post_ID));
3665 3665
 				$suffix++;
3666
-			} while ( $post_name_check );
3666
+			} while ($post_name_check);
3667 3667
 			$slug = $alt_post_name;
3668 3668
 		}
3669 3669
 	}
@@ -3680,7 +3680,7 @@  discard block
 block discarded – undo
3680 3680
 	 * @param int    $post_parent   Post parent ID
3681 3681
 	 * @param string $original_slug The original post slug.
3682 3682
 	 */
3683
-	return apply_filters( 'wp_unique_post_slug', $slug, $post_ID, $post_status, $post_type, $post_parent, $original_slug );
3683
+	return apply_filters('wp_unique_post_slug', $slug, $post_ID, $post_status, $post_type, $post_parent, $original_slug);
3684 3684
 }
3685 3685
 
3686 3686
 /**
@@ -3695,16 +3695,16 @@  discard block
 block discarded – undo
3695 3695
  * @param int    $length Optional. Max length of the slug. Default 200 (characters).
3696 3696
  * @return string The truncated slug.
3697 3697
  */
3698
-function _truncate_post_slug( $slug, $length = 200 ) {
3699
-	if ( strlen( $slug ) > $length ) {
3700
-		$decoded_slug = urldecode( $slug );
3701
-		if ( $decoded_slug === $slug )
3702
-			$slug = substr( $slug, 0, $length );
3698
+function _truncate_post_slug($slug, $length = 200) {
3699
+	if (strlen($slug) > $length) {
3700
+		$decoded_slug = urldecode($slug);
3701
+		if ($decoded_slug === $slug)
3702
+			$slug = substr($slug, 0, $length);
3703 3703
 		else
3704
-			$slug = utf8_uri_encode( $decoded_slug, $length );
3704
+			$slug = utf8_uri_encode($decoded_slug, $length);
3705 3705
 	}
3706 3706
 
3707
-	return rtrim( $slug, '-' );
3707
+	return rtrim($slug, '-');
3708 3708
 }
3709 3709
 
3710 3710
 /**
@@ -3719,7 +3719,7 @@  discard block
 block discarded – undo
3719 3719
  *                              separated by commas. Default empty.
3720 3720
  * @return array|false|WP_Error Array of affected term IDs. WP_Error or false on failure.
3721 3721
  */
3722
-function wp_add_post_tags( $post_id = 0, $tags = '' ) {
3722
+function wp_add_post_tags($post_id = 0, $tags = '') {
3723 3723
 	return wp_set_post_tags($post_id, $tags, true);
3724 3724
 }
3725 3725
 
@@ -3737,8 +3737,8 @@  discard block
 block discarded – undo
3737 3737
  *                              replace the tags with the new tags. Default false.
3738 3738
  * @return array|false|WP_Error Array of term taxonomy IDs of affected terms. WP_Error or false on failure.
3739 3739
  */
3740
-function wp_set_post_tags( $post_id = 0, $tags = '', $append = false ) {
3741
-	return wp_set_post_terms( $post_id, $tags, 'post_tag', $append);
3740
+function wp_set_post_tags($post_id = 0, $tags = '', $append = false) {
3741
+	return wp_set_post_terms($post_id, $tags, 'post_tag', $append);
3742 3742
 }
3743 3743
 
3744 3744
 /**
@@ -3756,31 +3756,31 @@  discard block
 block discarded – undo
3756 3756
  *                               replace the terms with the new terms. Default false.
3757 3757
  * @return array|false|WP_Error Array of term taxonomy IDs of affected terms. WP_Error or false on failure.
3758 3758
  */
3759
-function wp_set_post_terms( $post_id = 0, $tags = '', $taxonomy = 'post_tag', $append = false ) {
3759
+function wp_set_post_terms($post_id = 0, $tags = '', $taxonomy = 'post_tag', $append = false) {
3760 3760
 	$post_id = (int) $post_id;
3761 3761
 
3762
-	if ( !$post_id )
3762
+	if ( ! $post_id)
3763 3763
 		return false;
3764 3764
 
3765
-	if ( empty($tags) )
3765
+	if (empty($tags))
3766 3766
 		$tags = array();
3767 3767
 
3768
-	if ( ! is_array( $tags ) ) {
3769
-		$comma = _x( ',', 'tag delimiter' );
3770
-		if ( ',' !== $comma )
3771
-			$tags = str_replace( $comma, ',', $tags );
3772
-		$tags = explode( ',', trim( $tags, " \n\t\r\0\x0B," ) );
3768
+	if ( ! is_array($tags)) {
3769
+		$comma = _x(',', 'tag delimiter');
3770
+		if (',' !== $comma)
3771
+			$tags = str_replace($comma, ',', $tags);
3772
+		$tags = explode(',', trim($tags, " \n\t\r\0\x0B,"));
3773 3773
 	}
3774 3774
 
3775 3775
 	/*
3776 3776
 	 * Hierarchical taxonomies must always pass IDs rather than names so that
3777 3777
 	 * children with the same names but different parents aren't confused.
3778 3778
 	 */
3779
-	if ( is_taxonomy_hierarchical( $taxonomy ) ) {
3780
-		$tags = array_unique( array_map( 'intval', $tags ) );
3779
+	if (is_taxonomy_hierarchical($taxonomy)) {
3780
+		$tags = array_unique(array_map('intval', $tags));
3781 3781
 	}
3782 3782
 
3783
-	return wp_set_object_terms( $post_id, $tags, $taxonomy, $append );
3783
+	return wp_set_object_terms($post_id, $tags, $taxonomy, $append);
3784 3784
 }
3785 3785
 
3786 3786
 /**
@@ -3799,24 +3799,24 @@  discard block
 block discarded – undo
3799 3799
  *                                  If false, replace the categories with the new categories.
3800 3800
  * @return array|false|WP_Error Array of term taxonomy IDs of affected categories. WP_Error or false on failure.
3801 3801
  */
3802
-function wp_set_post_categories( $post_ID = 0, $post_categories = array(), $append = false ) {
3802
+function wp_set_post_categories($post_ID = 0, $post_categories = array(), $append = false) {
3803 3803
 	$post_ID = (int) $post_ID;
3804
-	$post_type = get_post_type( $post_ID );
3805
-	$post_status = get_post_status( $post_ID );
3804
+	$post_type = get_post_type($post_ID);
3805
+	$post_status = get_post_status($post_ID);
3806 3806
 	// If $post_categories isn't already an array, make it one:
3807 3807
 	$post_categories = (array) $post_categories;
3808
-	if ( empty( $post_categories ) ) {
3809
-		if ( 'post' == $post_type && 'auto-draft' != $post_status ) {
3810
-			$post_categories = array( get_option('default_category') );
3808
+	if (empty($post_categories)) {
3809
+		if ('post' == $post_type && 'auto-draft' != $post_status) {
3810
+			$post_categories = array(get_option('default_category'));
3811 3811
 			$append = false;
3812 3812
 		} else {
3813 3813
 			$post_categories = array();
3814 3814
 		}
3815
-	} elseif ( 1 == count( $post_categories ) && '' == reset( $post_categories ) ) {
3815
+	} elseif (1 == count($post_categories) && '' == reset($post_categories)) {
3816 3816
 		return true;
3817 3817
 	}
3818 3818
 
3819
-	return wp_set_post_terms( $post_ID, $post_categories, 'category', $append );
3819
+	return wp_set_post_terms($post_ID, $post_categories, 'category', $append);
3820 3820
 }
3821 3821
 
3822 3822
 /**
@@ -3840,7 +3840,7 @@  discard block
 block discarded – undo
3840 3840
  * @param string  $old_status Previous post status.
3841 3841
  * @param WP_Post $post Post data.
3842 3842
  */
3843
-function wp_transition_post_status( $new_status, $old_status, $post ) {
3843
+function wp_transition_post_status($new_status, $old_status, $post) {
3844 3844
 	/**
3845 3845
 	 * Fires when a post is transitioned from one status to another.
3846 3846
 	 *
@@ -3850,7 +3850,7 @@  discard block
 block discarded – undo
3850 3850
 	 * @param string  $old_status Old post status.
3851 3851
 	 * @param WP_Post $post       Post object.
3852 3852
 	 */
3853
-	do_action( 'transition_post_status', $new_status, $old_status, $post );
3853
+	do_action('transition_post_status', $new_status, $old_status, $post);
3854 3854
 
3855 3855
 	/**
3856 3856
 	 * Fires when a post is transitioned from one status to another.
@@ -3862,7 +3862,7 @@  discard block
 block discarded – undo
3862 3862
 	 *
3863 3863
 	 * @param WP_Post $post Post object.
3864 3864
 	 */
3865
-	do_action( "{$old_status}_to_{$new_status}", $post );
3865
+	do_action("{$old_status}_to_{$new_status}", $post);
3866 3866
 
3867 3867
 	/**
3868 3868
 	 * Fires when a post is transitioned from one status to another.
@@ -3883,7 +3883,7 @@  discard block
 block discarded – undo
3883 3883
 	 * @param int     $post_id Post ID.
3884 3884
 	 * @param WP_Post $post    Post object.
3885 3885
 	 */
3886
-	do_action( "{$new_status}_{$post->post_type}", $post->ID, $post );
3886
+	do_action("{$new_status}_{$post->post_type}", $post->ID, $post);
3887 3887
 }
3888 3888
 
3889 3889
 //
@@ -3901,9 +3901,9 @@  discard block
 block discarded – undo
3901 3901
  * @param string $uri     Ping URI.
3902 3902
  * @return int|false How many rows were updated.
3903 3903
  */
3904
-function add_ping( $post_id, $uri ) {
3904
+function add_ping($post_id, $uri) {
3905 3905
 	global $wpdb;
3906
-	$pung = $wpdb->get_var( $wpdb->prepare( "SELECT pinged FROM $wpdb->posts WHERE ID = %d", $post_id ));
3906
+	$pung = $wpdb->get_var($wpdb->prepare("SELECT pinged FROM $wpdb->posts WHERE ID = %d", $post_id));
3907 3907
 	$pung = trim($pung);
3908 3908
 	$pung = preg_split('/\s/', $pung);
3909 3909
 	$pung[] = $uri;
@@ -3916,11 +3916,11 @@  discard block
 block discarded – undo
3916 3916
 	 *
3917 3917
 	 * @param string $new New ping URL to add.
3918 3918
 	 */
3919
-	$new = apply_filters( 'add_ping', $new );
3919
+	$new = apply_filters('add_ping', $new);
3920 3920
 
3921 3921
 	// expected_slashed ($new).
3922 3922
 	$new = wp_unslash($new);
3923
-	return $wpdb->update( $wpdb->posts, array( 'pinged' => $new ), array( 'ID' => $post_id ) );
3923
+	return $wpdb->update($wpdb->posts, array('pinged' => $new), array('ID' => $post_id));
3924 3924
 }
3925 3925
 
3926 3926
 /**
@@ -3931,18 +3931,18 @@  discard block
 block discarded – undo
3931 3931
  * @param int $post_id Post ID.
3932 3932
  * @return array List of enclosures.
3933 3933
  */
3934
-function get_enclosed( $post_id ) {
3935
-	$custom_fields = get_post_custom( $post_id );
3934
+function get_enclosed($post_id) {
3935
+	$custom_fields = get_post_custom($post_id);
3936 3936
 	$pung = array();
3937
-	if ( !is_array( $custom_fields ) )
3937
+	if ( ! is_array($custom_fields))
3938 3938
 		return $pung;
3939 3939
 
3940
-	foreach ( $custom_fields as $key => $val ) {
3941
-		if ( 'enclosure' != $key || !is_array( $val ) )
3940
+	foreach ($custom_fields as $key => $val) {
3941
+		if ('enclosure' != $key || ! is_array($val))
3942 3942
 			continue;
3943
-		foreach ( $val as $enc ) {
3944
-			$enclosure = explode( "\n", $enc );
3945
-			$pung[] = trim( $enclosure[ 0 ] );
3943
+		foreach ($val as $enc) {
3944
+			$enclosure = explode("\n", $enc);
3945
+			$pung[] = trim($enclosure[0]);
3946 3946
 		}
3947 3947
 	}
3948 3948
 
@@ -3954,7 +3954,7 @@  discard block
 block discarded – undo
3954 3954
 	 * @param array $pung    Array of enclosures for the given post.
3955 3955
 	 * @param int   $post_id Post ID.
3956 3956
 	 */
3957
-	return apply_filters( 'get_enclosed', $pung, $post_id );
3957
+	return apply_filters('get_enclosed', $pung, $post_id);
3958 3958
 }
3959 3959
 
3960 3960
 /**
@@ -3967,9 +3967,9 @@  discard block
 block discarded – undo
3967 3967
  * @param int $post_id Post ID.
3968 3968
  * @return array
3969 3969
  */
3970
-function get_pung( $post_id ) {
3970
+function get_pung($post_id) {
3971 3971
 	global $wpdb;
3972
-	$pung = $wpdb->get_var( $wpdb->prepare( "SELECT pinged FROM $wpdb->posts WHERE ID = %d", $post_id ));
3972
+	$pung = $wpdb->get_var($wpdb->prepare("SELECT pinged FROM $wpdb->posts WHERE ID = %d", $post_id));
3973 3973
 	$pung = trim($pung);
3974 3974
 	$pung = preg_split('/\s/', $pung);
3975 3975
 
@@ -3980,7 +3980,7 @@  discard block
 block discarded – undo
3980 3980
 	 *
3981 3981
 	 * @param array $pung Array of URLs already pinged for the given post.
3982 3982
 	 */
3983
-	return apply_filters( 'get_pung', $pung );
3983
+	return apply_filters('get_pung', $pung);
3984 3984
 }
3985 3985
 
3986 3986
 /**
@@ -3993,10 +3993,10 @@  discard block
 block discarded – undo
3993 3993
  * @param int $post_id Post ID
3994 3994
  * @return array
3995 3995
  */
3996
-function get_to_ping( $post_id ) {
3996
+function get_to_ping($post_id) {
3997 3997
 	global $wpdb;
3998
-	$to_ping = $wpdb->get_var( $wpdb->prepare( "SELECT to_ping FROM $wpdb->posts WHERE ID = %d", $post_id ));
3999
-	$to_ping = sanitize_trackback_urls( $to_ping );
3998
+	$to_ping = $wpdb->get_var($wpdb->prepare("SELECT to_ping FROM $wpdb->posts WHERE ID = %d", $post_id));
3999
+	$to_ping = sanitize_trackback_urls($to_ping);
4000 4000
 	$to_ping = preg_split('/\s/', $to_ping, -1, PREG_SPLIT_NO_EMPTY);
4001 4001
 
4002 4002
 	/**
@@ -4006,7 +4006,7 @@  discard block
 block discarded – undo
4006 4006
 	 *
4007 4007
 	 * @param array $to_ping List of URLs yet to ping.
4008 4008
 	 */
4009
-	return apply_filters( 'get_to_ping', $to_ping );
4009
+	return apply_filters('get_to_ping', $to_ping);
4010 4010
 }
4011 4011
 
4012 4012
 /**
@@ -4017,22 +4017,22 @@  discard block
 block discarded – undo
4017 4017
  * @param string $tb_list Comma separated list of URLs.
4018 4018
  * @param int    $post_id Post ID.
4019 4019
  */
4020
-function trackback_url_list( $tb_list, $post_id ) {
4021
-	if ( ! empty( $tb_list ) ) {
4020
+function trackback_url_list($tb_list, $post_id) {
4021
+	if ( ! empty($tb_list)) {
4022 4022
 		// Get post data.
4023
-		$postdata = get_post( $post_id, ARRAY_A );
4023
+		$postdata = get_post($post_id, ARRAY_A);
4024 4024
 
4025 4025
 		// Form an excerpt.
4026
-		$excerpt = strip_tags( $postdata['post_excerpt'] ? $postdata['post_excerpt'] : $postdata['post_content'] );
4026
+		$excerpt = strip_tags($postdata['post_excerpt'] ? $postdata['post_excerpt'] : $postdata['post_content']);
4027 4027
 
4028
-		if ( strlen( $excerpt ) > 255 ) {
4029
-			$excerpt = substr( $excerpt, 0, 252 ) . '&hellip;';
4028
+		if (strlen($excerpt) > 255) {
4029
+			$excerpt = substr($excerpt, 0, 252).'&hellip;';
4030 4030
 		}
4031 4031
 
4032
-		$trackback_urls = explode( ',', $tb_list );
4033
-		foreach ( (array) $trackback_urls as $tb_url ) {
4034
-			$tb_url = trim( $tb_url );
4035
-			trackback( $tb_url, wp_unslash( $postdata['post_title'] ), $excerpt, $post_id );
4032
+		$trackback_urls = explode(',', $tb_list);
4033
+		foreach ((array) $trackback_urls as $tb_url) {
4034
+			$tb_url = trim($tb_url);
4035
+			trackback($tb_url, wp_unslash($postdata['post_title']), $excerpt, $post_id);
4036 4036
 		}
4037 4037
 	}
4038 4038
 }
@@ -4054,7 +4054,7 @@  discard block
 block discarded – undo
4054 4054
 	global $wpdb;
4055 4055
 
4056 4056
 	$page_ids = wp_cache_get('all_page_ids', 'posts');
4057
-	if ( ! is_array( $page_ids ) ) {
4057
+	if ( ! is_array($page_ids)) {
4058 4058
 		$page_ids = $wpdb->get_col("SELECT ID FROM $wpdb->posts WHERE post_type = 'page'");
4059 4059
 		wp_cache_add('all_page_ids', $page_ids, 'posts');
4060 4060
 	}
@@ -4077,8 +4077,8 @@  discard block
 block discarded – undo
4077 4077
  *                       'edit', 'db', 'display'. Default 'raw'.
4078 4078
  * @return WP_Post|array|null WP_Post on success or null on failure.
4079 4079
  */
4080
-function get_page( $page, $output = OBJECT, $filter = 'raw') {
4081
-	return get_post( $page, $output, $filter );
4080
+function get_page($page, $output = OBJECT, $filter = 'raw') {
4081
+	return get_post($page, $output, $filter);
4082 4082
 }
4083 4083
 
4084 4084
 /**
@@ -4094,44 +4094,44 @@  discard block
 block discarded – undo
4094 4094
  * @param string|array $post_type Optional. Post type or array of post types. Default 'page'.
4095 4095
  * @return WP_Post|array|void WP_Post on success.
4096 4096
  */
4097
-function get_page_by_path( $page_path, $output = OBJECT, $post_type = 'page' ) {
4097
+function get_page_by_path($page_path, $output = OBJECT, $post_type = 'page') {
4098 4098
 	global $wpdb;
4099 4099
 
4100
-	$last_changed = wp_cache_get( 'last_changed', 'posts' );
4101
-	if ( false === $last_changed ) {
4100
+	$last_changed = wp_cache_get('last_changed', 'posts');
4101
+	if (false === $last_changed) {
4102 4102
 		$last_changed = microtime();
4103
-		wp_cache_set( 'last_changed', $last_changed, 'posts' );
4103
+		wp_cache_set('last_changed', $last_changed, 'posts');
4104 4104
 	}
4105 4105
 
4106
-	$hash = md5( $page_path . serialize( $post_type ) );
4106
+	$hash = md5($page_path.serialize($post_type));
4107 4107
 	$cache_key = "get_page_by_path:$hash:$last_changed";
4108
-	$cached = wp_cache_get( $cache_key, 'posts' );
4109
-	if ( false !== $cached ) {
4108
+	$cached = wp_cache_get($cache_key, 'posts');
4109
+	if (false !== $cached) {
4110 4110
 		// Special case: '0' is a bad `$page_path`.
4111
-		if ( '0' === $cached || 0 === $cached ) {
4111
+		if ('0' === $cached || 0 === $cached) {
4112 4112
 			return;
4113 4113
 		} else {
4114
-			return get_post( $cached, $output );
4114
+			return get_post($cached, $output);
4115 4115
 		}
4116 4116
 	}
4117 4117
 
4118 4118
 	$page_path = rawurlencode(urldecode($page_path));
4119 4119
 	$page_path = str_replace('%2F', '/', $page_path);
4120 4120
 	$page_path = str_replace('%20', ' ', $page_path);
4121
-	$parts = explode( '/', trim( $page_path, '/' ) );
4122
-	$parts = esc_sql( $parts );
4123
-	$parts = array_map( 'sanitize_title_for_query', $parts );
4121
+	$parts = explode('/', trim($page_path, '/'));
4122
+	$parts = esc_sql($parts);
4123
+	$parts = array_map('sanitize_title_for_query', $parts);
4124 4124
 
4125
-	$in_string = "'" . implode( "','", $parts ) . "'";
4125
+	$in_string = "'".implode("','", $parts)."'";
4126 4126
 
4127
-	if ( is_array( $post_type ) ) {
4127
+	if (is_array($post_type)) {
4128 4128
 		$post_types = $post_type;
4129 4129
 	} else {
4130
-		$post_types = array( $post_type, 'attachment' );
4130
+		$post_types = array($post_type, 'attachment');
4131 4131
 	}
4132 4132
 
4133
-	$post_types = esc_sql( $post_types );
4134
-	$post_type_in_string = "'" . implode( "','", $post_types ) . "'";
4133
+	$post_types = esc_sql($post_types);
4134
+	$post_type_in_string = "'".implode("','", $post_types)."'";
4135 4135
 	$sql = "
4136 4136
 		SELECT ID, post_name, post_parent, post_type
4137 4137
 		FROM $wpdb->posts
@@ -4139,13 +4139,13 @@  discard block
 block discarded – undo
4139 4139
 		AND post_type IN ($post_type_in_string)
4140 4140
 	";
4141 4141
 
4142
-	$pages = $wpdb->get_results( $sql, OBJECT_K );
4142
+	$pages = $wpdb->get_results($sql, OBJECT_K);
4143 4143
 
4144
-	$revparts = array_reverse( $parts );
4144
+	$revparts = array_reverse($parts);
4145 4145
 
4146 4146
 	$foundid = 0;
4147
-	foreach ( (array) $pages as $page ) {
4148
-		if ( $page->post_name == $revparts[0] ) {
4147
+	foreach ((array) $pages as $page) {
4148
+		if ($page->post_name == $revparts[0]) {
4149 4149
 			$count = 0;
4150 4150
 			$p = $page;
4151 4151
 
@@ -4153,27 +4153,27 @@  discard block
 block discarded – undo
4153 4153
 			 * Loop through the given path parts from right to left,
4154 4154
 			 * ensuring each matches the post ancestry.
4155 4155
 			 */
4156
-			while ( $p->post_parent != 0 && isset( $pages[ $p->post_parent ] ) ) {
4156
+			while ($p->post_parent != 0 && isset($pages[$p->post_parent])) {
4157 4157
 				$count++;
4158
-				$parent = $pages[ $p->post_parent ];
4159
-				if ( ! isset( $revparts[ $count ] ) || $parent->post_name != $revparts[ $count ] )
4158
+				$parent = $pages[$p->post_parent];
4159
+				if ( ! isset($revparts[$count]) || $parent->post_name != $revparts[$count])
4160 4160
 					break;
4161 4161
 				$p = $parent;
4162 4162
 			}
4163 4163
 
4164
-			if ( $p->post_parent == 0 && $count+1 == count( $revparts ) && $p->post_name == $revparts[ $count ] ) {
4164
+			if ($p->post_parent == 0 && $count + 1 == count($revparts) && $p->post_name == $revparts[$count]) {
4165 4165
 				$foundid = $page->ID;
4166
-				if ( $page->post_type == $post_type )
4166
+				if ($page->post_type == $post_type)
4167 4167
 					break;
4168 4168
 			}
4169 4169
 		}
4170 4170
 	}
4171 4171
 
4172 4172
 	// We cache misses as well as hits.
4173
-	wp_cache_set( $cache_key, $foundid, 'posts' );
4173
+	wp_cache_set($cache_key, $foundid, 'posts');
4174 4174
 
4175
-	if ( $foundid ) {
4176
-		return get_post( $foundid, $output );
4175
+	if ($foundid) {
4176
+		return get_post($foundid, $output);
4177 4177
 	}
4178 4178
 }
4179 4179
 
@@ -4190,31 +4190,31 @@  discard block
 block discarded – undo
4190 4190
  * @param string|array $post_type  Optional. Post type or array of post types. Default 'page'.
4191 4191
  * @return WP_Post|array|void WP_Post on success or null on failure
4192 4192
  */
4193
-function get_page_by_title( $page_title, $output = OBJECT, $post_type = 'page' ) {
4193
+function get_page_by_title($page_title, $output = OBJECT, $post_type = 'page') {
4194 4194
 	global $wpdb;
4195 4195
 
4196
-	if ( is_array( $post_type ) ) {
4197
-		$post_type = esc_sql( $post_type );
4198
-		$post_type_in_string = "'" . implode( "','", $post_type ) . "'";
4199
-		$sql = $wpdb->prepare( "
4196
+	if (is_array($post_type)) {
4197
+		$post_type = esc_sql($post_type);
4198
+		$post_type_in_string = "'".implode("','", $post_type)."'";
4199
+		$sql = $wpdb->prepare("
4200 4200
 			SELECT ID
4201 4201
 			FROM $wpdb->posts
4202 4202
 			WHERE post_title = %s
4203 4203
 			AND post_type IN ($post_type_in_string)
4204
-		", $page_title );
4204
+		", $page_title);
4205 4205
 	} else {
4206
-		$sql = $wpdb->prepare( "
4206
+		$sql = $wpdb->prepare("
4207 4207
 			SELECT ID
4208 4208
 			FROM $wpdb->posts
4209 4209
 			WHERE post_title = %s
4210 4210
 			AND post_type = %s
4211
-		", $page_title, $post_type );
4211
+		", $page_title, $post_type);
4212 4212
 	}
4213 4213
 
4214
-	$page = $wpdb->get_var( $sql );
4214
+	$page = $wpdb->get_var($sql);
4215 4215
 
4216
-	if ( $page ) {
4217
-		return get_post( $page, $output );
4216
+	if ($page) {
4217
+		return get_post($page, $output);
4218 4218
 	}
4219 4219
 }
4220 4220
 
@@ -4229,25 +4229,25 @@  discard block
 block discarded – undo
4229 4229
  * @param array $pages   List of page objects from which descendants should be identified.
4230 4230
  * @return array List of page children.
4231 4231
  */
4232
-function get_page_children( $page_id, $pages ) {
4232
+function get_page_children($page_id, $pages) {
4233 4233
 	// Build a hash of ID -> children.
4234 4234
 	$children = array();
4235
-	foreach ( (array) $pages as $page ) {
4236
-		$children[ intval( $page->post_parent ) ][] = $page;
4235
+	foreach ((array) $pages as $page) {
4236
+		$children[intval($page->post_parent)][] = $page;
4237 4237
 	}
4238 4238
 
4239 4239
 	$page_list = array();
4240 4240
 
4241 4241
 	// Start the search by looking at immediate children.
4242
-	if ( isset( $children[ $page_id ] ) ) {
4242
+	if (isset($children[$page_id])) {
4243 4243
 		// Always start at the end of the stack in order to preserve original `$pages` order.
4244
-		$to_look = array_reverse( $children[ $page_id ] );
4244
+		$to_look = array_reverse($children[$page_id]);
4245 4245
 
4246
-		while ( $to_look ) {
4247
-			$p = array_pop( $to_look );
4246
+		while ($to_look) {
4247
+			$p = array_pop($to_look);
4248 4248
 			$page_list[] = $p;
4249
-			if ( isset( $children[ $p->ID ] ) ) {
4250
-				foreach ( array_reverse( $children[ $p->ID ] ) as $child ) {
4249
+			if (isset($children[$p->ID])) {
4250
+				foreach (array_reverse($children[$p->ID]) as $child) {
4251 4251
 					// Append to the `$to_look` stack to descend the tree.
4252 4252
 					$to_look[] = $child;
4253 4253
 				}
@@ -4270,19 +4270,19 @@  discard block
 block discarded – undo
4270 4270
  * @param int   $page_id Optional. Parent page ID. Default 0.
4271 4271
  * @return array A list arranged by hierarchy. Children immediately follow their parents.
4272 4272
  */
4273
-function get_page_hierarchy( &$pages, $page_id = 0 ) {
4274
-	if ( empty( $pages ) ) {
4273
+function get_page_hierarchy(&$pages, $page_id = 0) {
4274
+	if (empty($pages)) {
4275 4275
 		return array();
4276 4276
 	}
4277 4277
 
4278 4278
 	$children = array();
4279
-	foreach ( (array) $pages as $p ) {
4280
-		$parent_id = intval( $p->post_parent );
4281
-		$children[ $parent_id ][] = $p;
4279
+	foreach ((array) $pages as $p) {
4280
+		$parent_id = intval($p->post_parent);
4281
+		$children[$parent_id][] = $p;
4282 4282
 	}
4283 4283
 
4284 4284
 	$result = array();
4285
-	_page_traverse_name( $page_id, $children, $result );
4285
+	_page_traverse_name($page_id, $children, $result);
4286 4286
 
4287 4287
 	return $result;
4288 4288
 }
@@ -4300,11 +4300,11 @@  discard block
 block discarded – undo
4300 4300
  * @param array $children  Parent-children relations, passed by reference.
4301 4301
  * @param array $result    Result, passed by reference.
4302 4302
  */
4303
-function _page_traverse_name( $page_id, &$children, &$result ){
4304
-	if ( isset( $children[ $page_id ] ) ){
4305
-		foreach ( (array)$children[ $page_id ] as $child ) {
4306
-			$result[ $child->ID ] = $child->post_name;
4307
-			_page_traverse_name( $child->ID, $children, $result );
4303
+function _page_traverse_name($page_id, &$children, &$result) {
4304
+	if (isset($children[$page_id])) {
4305
+		foreach ((array) $children[$page_id] as $child) {
4306
+			$result[$child->ID] = $child->post_name;
4307
+			_page_traverse_name($child->ID, $children, $result);
4308 4308
 		}
4309 4309
 	}
4310 4310
 }
@@ -4320,20 +4320,20 @@  discard block
 block discarded – undo
4320 4320
  * @param WP_Post|object|int $page Optional. Page ID or WP_Post object. Default is global $post.
4321 4321
  * @return string|false Page URI, false on error.
4322 4322
  */
4323
-function get_page_uri( $page = 0 ) {
4324
-	if ( ! $page instanceof WP_Post ) {
4325
-		$page = get_post( $page );
4323
+function get_page_uri($page = 0) {
4324
+	if ( ! $page instanceof WP_Post) {
4325
+		$page = get_post($page);
4326 4326
 	}
4327 4327
 
4328
-	if ( ! $page )
4328
+	if ( ! $page)
4329 4329
 		return false;
4330 4330
 
4331 4331
 	$uri = $page->post_name;
4332 4332
 
4333
-	foreach ( $page->ancestors as $parent ) {
4334
-		$parent = get_post( $parent );
4335
-		if ( $parent && $parent->post_name ) {
4336
-			$uri = $parent->post_name . '/' . $uri;
4333
+	foreach ($page->ancestors as $parent) {
4334
+		$parent = get_post($parent);
4335
+		if ($parent && $parent->post_name) {
4336
+			$uri = $parent->post_name.'/'.$uri;
4337 4337
 		}
4338 4338
 	}
4339 4339
 
@@ -4345,7 +4345,7 @@  discard block
 block discarded – undo
4345 4345
 	 * @param string  $uri  Page URI.
4346 4346
 	 * @param WP_Post $page Page object.
4347 4347
 	 */
4348
-	return apply_filters( 'get_page_uri', $uri, $page );
4348
+	return apply_filters('get_page_uri', $uri, $page);
4349 4349
 }
4350 4350
 
4351 4351
 /**
@@ -4390,7 +4390,7 @@  discard block
 block discarded – undo
4390 4390
  * }
4391 4391
  * @return array|false List of pages matching defaults or `$args`.
4392 4392
  */
4393
-function get_pages( $args = array() ) {
4393
+function get_pages($args = array()) {
4394 4394
 	global $wpdb;
4395 4395
 
4396 4396
 	$defaults = array(
@@ -4403,7 +4403,7 @@  discard block
 block discarded – undo
4403 4403
 		'post_type' => 'page', 'post_status' => 'publish',
4404 4404
 	);
4405 4405
 
4406
-	$r = wp_parse_args( $args, $defaults );
4406
+	$r = wp_parse_args($args, $defaults);
4407 4407
 
4408 4408
 	$number = (int) $r['number'];
4409 4409
 	$offset = (int) $r['offset'];
@@ -4416,87 +4416,87 @@  discard block
 block discarded – undo
4416 4416
 	$post_status = $r['post_status'];
4417 4417
 
4418 4418
 	// Make sure the post type is hierarchical.
4419
-	$hierarchical_post_types = get_post_types( array( 'hierarchical' => true ) );
4420
-	if ( ! in_array( $r['post_type'], $hierarchical_post_types ) ) {
4419
+	$hierarchical_post_types = get_post_types(array('hierarchical' => true));
4420
+	if ( ! in_array($r['post_type'], $hierarchical_post_types)) {
4421 4421
 		return false;
4422 4422
 	}
4423 4423
 
4424
-	if ( $parent > 0 && ! $child_of ) {
4424
+	if ($parent > 0 && ! $child_of) {
4425 4425
 		$hierarchical = false;
4426 4426
 	}
4427 4427
 
4428 4428
 	// Make sure we have a valid post status.
4429
-	if ( ! is_array( $post_status ) ) {
4430
-		$post_status = explode( ',', $post_status );
4429
+	if ( ! is_array($post_status)) {
4430
+		$post_status = explode(',', $post_status);
4431 4431
 	}
4432
-	if ( array_diff( $post_status, get_post_stati() ) ) {
4432
+	if (array_diff($post_status, get_post_stati())) {
4433 4433
 		return false;
4434 4434
 	}
4435 4435
 
4436 4436
 	// $args can be whatever, only use the args defined in defaults to compute the key.
4437
-	$key = md5( serialize( wp_array_slice_assoc( $r, array_keys( $defaults ) ) ) );
4438
-	$last_changed = wp_cache_get( 'last_changed', 'posts' );
4439
-	if ( ! $last_changed ) {
4437
+	$key = md5(serialize(wp_array_slice_assoc($r, array_keys($defaults))));
4438
+	$last_changed = wp_cache_get('last_changed', 'posts');
4439
+	if ( ! $last_changed) {
4440 4440
 		$last_changed = microtime();
4441
-		wp_cache_set( 'last_changed', $last_changed, 'posts' );
4441
+		wp_cache_set('last_changed', $last_changed, 'posts');
4442 4442
 	}
4443 4443
 
4444 4444
 	$cache_key = "get_pages:$key:$last_changed";
4445
-	if ( $cache = wp_cache_get( $cache_key, 'posts' ) ) {
4445
+	if ($cache = wp_cache_get($cache_key, 'posts')) {
4446 4446
 		// Convert to WP_Post instances.
4447
-		$pages = array_map( 'get_post', $cache );
4447
+		$pages = array_map('get_post', $cache);
4448 4448
 		/** This filter is documented in wp-includes/post.php */
4449
-		$pages = apply_filters( 'get_pages', $pages, $r );
4449
+		$pages = apply_filters('get_pages', $pages, $r);
4450 4450
 		return $pages;
4451 4451
 	}
4452 4452
 
4453 4453
 	$inclusions = '';
4454
-	if ( ! empty( $r['include'] ) ) {
4454
+	if ( ! empty($r['include'])) {
4455 4455
 		$child_of = 0; //ignore child_of, parent, exclude, meta_key, and meta_value params if using include
4456 4456
 		$parent = -1;
4457 4457
 		$exclude = '';
4458 4458
 		$meta_key = '';
4459 4459
 		$meta_value = '';
4460 4460
 		$hierarchical = false;
4461
-		$incpages = wp_parse_id_list( $r['include'] );
4462
-		if ( ! empty( $incpages ) ) {
4463
-			$inclusions = ' AND ID IN (' . implode( ',', $incpages ) .  ')';
4461
+		$incpages = wp_parse_id_list($r['include']);
4462
+		if ( ! empty($incpages)) {
4463
+			$inclusions = ' AND ID IN ('.implode(',', $incpages).')';
4464 4464
 		}
4465 4465
 	}
4466 4466
 
4467 4467
 	$exclusions = '';
4468
-	if ( ! empty( $exclude ) ) {
4469
-		$expages = wp_parse_id_list( $exclude );
4470
-		if ( ! empty( $expages ) ) {
4471
-			$exclusions = ' AND ID NOT IN (' . implode( ',', $expages ) .  ')';
4468
+	if ( ! empty($exclude)) {
4469
+		$expages = wp_parse_id_list($exclude);
4470
+		if ( ! empty($expages)) {
4471
+			$exclusions = ' AND ID NOT IN ('.implode(',', $expages).')';
4472 4472
 		}
4473 4473
 	}
4474 4474
 
4475 4475
 	$author_query = '';
4476
-	if ( ! empty( $r['authors'] ) ) {
4477
-		$post_authors = preg_split( '/[\s,]+/', $r['authors'] );
4476
+	if ( ! empty($r['authors'])) {
4477
+		$post_authors = preg_split('/[\s,]+/', $r['authors']);
4478 4478
 
4479
-		if ( ! empty( $post_authors ) ) {
4480
-			foreach ( $post_authors as $post_author ) {
4479
+		if ( ! empty($post_authors)) {
4480
+			foreach ($post_authors as $post_author) {
4481 4481
 				//Do we have an author id or an author login?
4482
-				if ( 0 == intval($post_author) ) {
4482
+				if (0 == intval($post_author)) {
4483 4483
 					$post_author = get_user_by('login', $post_author);
4484
-					if ( empty( $post_author ) ) {
4484
+					if (empty($post_author)) {
4485 4485
 						continue;
4486 4486
 					}
4487
-					if ( empty( $post_author->ID ) ) {
4487
+					if (empty($post_author->ID)) {
4488 4488
 						continue;
4489 4489
 					}
4490 4490
 					$post_author = $post_author->ID;
4491 4491
 				}
4492 4492
 
4493
-				if ( '' == $author_query ) {
4493
+				if ('' == $author_query) {
4494 4494
 					$author_query = $wpdb->prepare(' post_author = %d ', $post_author);
4495 4495
 				} else {
4496 4496
 					$author_query .= $wpdb->prepare(' OR post_author = %d ', $post_author);
4497 4497
 				}
4498 4498
 			}
4499
-			if ( '' != $author_query ) {
4499
+			if ('' != $author_query) {
4500 4500
 				$author_query = " AND ($author_query)";
4501 4501
 			}
4502 4502
 		}
@@ -4504,49 +4504,49 @@  discard block
 block discarded – undo
4504 4504
 
4505 4505
 	$join = '';
4506 4506
 	$where = "$exclusions $inclusions ";
4507
-	if ( '' !== $meta_key || '' !== $meta_value ) {
4507
+	if ('' !== $meta_key || '' !== $meta_value) {
4508 4508
 		$join = " LEFT JOIN $wpdb->postmeta ON ( $wpdb->posts.ID = $wpdb->postmeta.post_id )";
4509 4509
 
4510 4510
 		// meta_key and meta_value might be slashed
4511 4511
 		$meta_key = wp_unslash($meta_key);
4512 4512
 		$meta_value = wp_unslash($meta_value);
4513
-		if ( '' !== $meta_key ) {
4513
+		if ('' !== $meta_key) {
4514 4514
 			$where .= $wpdb->prepare(" AND $wpdb->postmeta.meta_key = %s", $meta_key);
4515 4515
 		}
4516
-		if ( '' !== $meta_value ) {
4516
+		if ('' !== $meta_value) {
4517 4517
 			$where .= $wpdb->prepare(" AND $wpdb->postmeta.meta_value = %s", $meta_value);
4518 4518
 		}
4519 4519
 
4520 4520
 	}
4521 4521
 
4522
-	if ( is_array( $parent ) ) {
4523
-		$post_parent__in = implode( ',', array_map( 'absint', (array) $parent ) );
4524
-		if ( ! empty( $post_parent__in ) ) {
4522
+	if (is_array($parent)) {
4523
+		$post_parent__in = implode(',', array_map('absint', (array) $parent));
4524
+		if ( ! empty($post_parent__in)) {
4525 4525
 			$where .= " AND post_parent IN ($post_parent__in)";
4526 4526
 		}
4527
-	} elseif ( $parent >= 0 ) {
4527
+	} elseif ($parent >= 0) {
4528 4528
 		$where .= $wpdb->prepare(' AND post_parent = %d ', $parent);
4529 4529
 	}
4530 4530
 
4531
-	if ( 1 == count( $post_status ) ) {
4532
-		$where_post_type = $wpdb->prepare( "post_type = %s AND post_status = %s", $r['post_type'], reset( $post_status ) );
4531
+	if (1 == count($post_status)) {
4532
+		$where_post_type = $wpdb->prepare("post_type = %s AND post_status = %s", $r['post_type'], reset($post_status));
4533 4533
 	} else {
4534
-		$post_status = implode( "', '", $post_status );
4535
-		$where_post_type = $wpdb->prepare( "post_type = %s AND post_status IN ('$post_status')", $r['post_type'] );
4534
+		$post_status = implode("', '", $post_status);
4535
+		$where_post_type = $wpdb->prepare("post_type = %s AND post_status IN ('$post_status')", $r['post_type']);
4536 4536
 	}
4537 4537
 
4538 4538
 	$orderby_array = array();
4539
-	$allowed_keys = array( 'author', 'post_author', 'date', 'post_date', 'title', 'post_title', 'name', 'post_name', 'modified',
4539
+	$allowed_keys = array('author', 'post_author', 'date', 'post_date', 'title', 'post_title', 'name', 'post_name', 'modified',
4540 4540
 		'post_modified', 'modified_gmt', 'post_modified_gmt', 'menu_order', 'parent', 'post_parent',
4541
-		'ID', 'rand', 'comment_count' );
4541
+		'ID', 'rand', 'comment_count');
4542 4542
 
4543
-	foreach ( explode( ',', $r['sort_column'] ) as $orderby ) {
4544
-		$orderby = trim( $orderby );
4545
-		if ( ! in_array( $orderby, $allowed_keys ) ) {
4543
+	foreach (explode(',', $r['sort_column']) as $orderby) {
4544
+		$orderby = trim($orderby);
4545
+		if ( ! in_array($orderby, $allowed_keys)) {
4546 4546
 			continue;
4547 4547
 		}
4548 4548
 
4549
-		switch ( $orderby ) {
4549
+		switch ($orderby) {
4550 4550
 			case 'menu_order':
4551 4551
 				break;
4552 4552
 			case 'ID':
@@ -4559,36 +4559,36 @@  discard block
 block discarded – undo
4559 4559
 				$orderby = "$wpdb->posts.comment_count";
4560 4560
 				break;
4561 4561
 			default:
4562
-				if ( 0 === strpos( $orderby, 'post_' ) ) {
4563
-					$orderby = "$wpdb->posts." . $orderby;
4562
+				if (0 === strpos($orderby, 'post_')) {
4563
+					$orderby = "$wpdb->posts.".$orderby;
4564 4564
 				} else {
4565
-					$orderby = "$wpdb->posts.post_" . $orderby;
4565
+					$orderby = "$wpdb->posts.post_".$orderby;
4566 4566
 				}
4567 4567
 		}
4568 4568
 
4569 4569
 		$orderby_array[] = $orderby;
4570 4570
 
4571 4571
 	}
4572
-	$sort_column = ! empty( $orderby_array ) ? implode( ',', $orderby_array ) : "$wpdb->posts.post_title";
4572
+	$sort_column = ! empty($orderby_array) ? implode(',', $orderby_array) : "$wpdb->posts.post_title";
4573 4573
 
4574
-	$sort_order = strtoupper( $r['sort_order'] );
4575
-	if ( '' !== $sort_order && ! in_array( $sort_order, array( 'ASC', 'DESC' ) ) ) {
4574
+	$sort_order = strtoupper($r['sort_order']);
4575
+	if ('' !== $sort_order && ! in_array($sort_order, array('ASC', 'DESC'))) {
4576 4576
 		$sort_order = 'ASC';
4577 4577
 	}
4578 4578
 
4579 4579
 	$query = "SELECT * FROM $wpdb->posts $join WHERE ($where_post_type) $where ";
4580 4580
 	$query .= $author_query;
4581
-	$query .= " ORDER BY " . $sort_column . " " . $sort_order ;
4581
+	$query .= " ORDER BY ".$sort_column." ".$sort_order;
4582 4582
 
4583
-	if ( ! empty( $number ) ) {
4584
-		$query .= ' LIMIT ' . $offset . ',' . $number;
4583
+	if ( ! empty($number)) {
4584
+		$query .= ' LIMIT '.$offset.','.$number;
4585 4585
 	}
4586 4586
 
4587 4587
 	$pages = $wpdb->get_results($query);
4588 4588
 
4589
-	if ( empty($pages) ) {
4589
+	if (empty($pages)) {
4590 4590
 		/** This filter is documented in wp-includes/post.php */
4591
-		$pages = apply_filters( 'get_pages', array(), $r );
4591
+		$pages = apply_filters('get_pages', array(), $r);
4592 4592
 		return $pages;
4593 4593
 	}
4594 4594
 
@@ -4599,38 +4599,38 @@  discard block
 block discarded – undo
4599 4599
 	}
4600 4600
 
4601 4601
 	// Update cache.
4602
-	update_post_cache( $pages );
4602
+	update_post_cache($pages);
4603 4603
 
4604
-	if ( $child_of || $hierarchical ) {
4604
+	if ($child_of || $hierarchical) {
4605 4605
 		$pages = get_page_children($child_of, $pages);
4606 4606
 	}
4607 4607
 
4608
-	if ( ! empty( $r['exclude_tree'] ) ) {
4609
-		$exclude = wp_parse_id_list( $r['exclude_tree'] );
4610
-		foreach ( $exclude as $id ) {
4611
-			$children = get_page_children( $id, $pages );
4612
-			foreach ( $children as $child ) {
4608
+	if ( ! empty($r['exclude_tree'])) {
4609
+		$exclude = wp_parse_id_list($r['exclude_tree']);
4610
+		foreach ($exclude as $id) {
4611
+			$children = get_page_children($id, $pages);
4612
+			foreach ($children as $child) {
4613 4613
 				$exclude[] = $child->ID;
4614 4614
 			}
4615 4615
 		}
4616 4616
 
4617
-		$num_pages = count( $pages );
4618
-		for ( $i = 0; $i < $num_pages; $i++ ) {
4619
-			if ( in_array( $pages[$i]->ID, $exclude ) ) {
4620
-				unset( $pages[$i] );
4617
+		$num_pages = count($pages);
4618
+		for ($i = 0; $i < $num_pages; $i++) {
4619
+			if (in_array($pages[$i]->ID, $exclude)) {
4620
+				unset($pages[$i]);
4621 4621
 			}
4622 4622
 		}
4623 4623
 	}
4624 4624
 
4625 4625
 	$page_structure = array();
4626
-	foreach ( $pages as $page ) {
4626
+	foreach ($pages as $page) {
4627 4627
 		$page_structure[] = $page->ID;
4628 4628
 	}
4629 4629
 
4630
-	wp_cache_set( $cache_key, $page_structure, 'posts' );
4630
+	wp_cache_set($cache_key, $page_structure, 'posts');
4631 4631
 
4632 4632
 	// Convert to WP_Post instances
4633
-	$pages = array_map( 'get_post', $pages );
4633
+	$pages = array_map('get_post', $pages);
4634 4634
 
4635 4635
 	/**
4636 4636
 	 * Filters the retrieved list of pages.
@@ -4640,7 +4640,7 @@  discard block
 block discarded – undo
4640 4640
 	 * @param array $pages List of pages to retrieve.
4641 4641
 	 * @param array $r     Array of get_pages() arguments.
4642 4642
 	 */
4643
-	return apply_filters( 'get_pages', $pages, $r );
4643
+	return apply_filters('get_pages', $pages, $r);
4644 4644
 }
4645 4645
 
4646 4646
 //
@@ -4660,9 +4660,9 @@  discard block
 block discarded – undo
4660 4660
 		return false;
4661 4661
 	if (strpos($url, home_url('/?attachment_id=')) !== false)
4662 4662
 		return true;
4663
-	if ( $id = url_to_postid($url) ) {
4663
+	if ($id = url_to_postid($url)) {
4664 4664
 		$post = get_post($id);
4665
-		if ( 'attachment' == $post->post_type )
4665
+		if ('attachment' == $post->post_type)
4666 4666
 			return true;
4667 4667
 	}
4668 4668
 	return false;
@@ -4691,21 +4691,21 @@  discard block
 block discarded – undo
4691 4691
  * @param int          $parent Optional. Parent post ID.
4692 4692
  * @return int Attachment ID.
4693 4693
  */
4694
-function wp_insert_attachment( $args, $file = false, $parent = 0 ) {
4694
+function wp_insert_attachment($args, $file = false, $parent = 0) {
4695 4695
 	$defaults = array(
4696 4696
 		'file'        => $file,
4697 4697
 		'post_parent' => 0
4698 4698
 	);
4699 4699
 
4700
-	$data = wp_parse_args( $args, $defaults );
4700
+	$data = wp_parse_args($args, $defaults);
4701 4701
 
4702
-	if ( ! empty( $parent ) ) {
4702
+	if ( ! empty($parent)) {
4703 4703
 		$data['post_parent'] = $parent;
4704 4704
 	}
4705 4705
 
4706 4706
 	$data['post_type'] = 'attachment';
4707 4707
 
4708
-	return wp_insert_post( $data );
4708
+	return wp_insert_post($data);
4709 4709
 }
4710 4710
 
4711 4711
 /**
@@ -4727,27 +4727,27 @@  discard block
 block discarded – undo
4727 4727
  *                           Default false.
4728 4728
  * @return mixed False on failure. Post data on success.
4729 4729
  */
4730
-function wp_delete_attachment( $post_id, $force_delete = false ) {
4730
+function wp_delete_attachment($post_id, $force_delete = false) {
4731 4731
 	global $wpdb;
4732 4732
 
4733
-	if ( !$post = $wpdb->get_row( $wpdb->prepare("SELECT * FROM $wpdb->posts WHERE ID = %d", $post_id) ) )
4733
+	if ( ! $post = $wpdb->get_row($wpdb->prepare("SELECT * FROM $wpdb->posts WHERE ID = %d", $post_id)))
4734 4734
 		return $post;
4735 4735
 
4736
-	if ( 'attachment' != $post->post_type )
4736
+	if ('attachment' != $post->post_type)
4737 4737
 		return false;
4738 4738
 
4739
-	if ( !$force_delete && EMPTY_TRASH_DAYS && MEDIA_TRASH && 'trash' != $post->post_status )
4740
-		return wp_trash_post( $post_id );
4739
+	if ( ! $force_delete && EMPTY_TRASH_DAYS && MEDIA_TRASH && 'trash' != $post->post_status)
4740
+		return wp_trash_post($post_id);
4741 4741
 
4742 4742
 	delete_post_meta($post_id, '_wp_trash_meta_status');
4743 4743
 	delete_post_meta($post_id, '_wp_trash_meta_time');
4744 4744
 
4745
-	$meta = wp_get_attachment_metadata( $post_id );
4746
-	$backup_sizes = get_post_meta( $post->ID, '_wp_attachment_backup_sizes', true );
4747
-	$file = get_attached_file( $post_id );
4745
+	$meta = wp_get_attachment_metadata($post_id);
4746
+	$backup_sizes = get_post_meta($post->ID, '_wp_attachment_backup_sizes', true);
4747
+	$file = get_attached_file($post_id);
4748 4748
 
4749
-	if ( is_multisite() )
4750
-		delete_transient( 'dirsize_cache' );
4749
+	if (is_multisite())
4750
+		delete_transient('dirsize_cache');
4751 4751
 
4752 4752
 	/**
4753 4753
 	 * Fires before an attachment is deleted, at the start of wp_delete_attachment().
@@ -4756,70 +4756,70 @@  discard block
 block discarded – undo
4756 4756
 	 *
4757 4757
 	 * @param int $post_id Attachment ID.
4758 4758
 	 */
4759
-	do_action( 'delete_attachment', $post_id );
4759
+	do_action('delete_attachment', $post_id);
4760 4760
 
4761 4761
 	wp_delete_object_term_relationships($post_id, array('category', 'post_tag'));
4762 4762
 	wp_delete_object_term_relationships($post_id, get_object_taxonomies($post->post_type));
4763 4763
 
4764 4764
 	// Delete all for any posts.
4765
-	delete_metadata( 'post', null, '_thumbnail_id', $post_id, true );
4765
+	delete_metadata('post', null, '_thumbnail_id', $post_id, true);
4766 4766
 
4767
-	wp_defer_comment_counting( true );
4767
+	wp_defer_comment_counting(true);
4768 4768
 
4769
-	$comment_ids = $wpdb->get_col( $wpdb->prepare( "SELECT comment_ID FROM $wpdb->comments WHERE comment_post_ID = %d", $post_id ));
4770
-	foreach ( $comment_ids as $comment_id ) {
4771
-		wp_delete_comment( $comment_id, true );
4769
+	$comment_ids = $wpdb->get_col($wpdb->prepare("SELECT comment_ID FROM $wpdb->comments WHERE comment_post_ID = %d", $post_id));
4770
+	foreach ($comment_ids as $comment_id) {
4771
+		wp_delete_comment($comment_id, true);
4772 4772
 	}
4773 4773
 
4774
-	wp_defer_comment_counting( false );
4774
+	wp_defer_comment_counting(false);
4775 4775
 
4776
-	$post_meta_ids = $wpdb->get_col( $wpdb->prepare( "SELECT meta_id FROM $wpdb->postmeta WHERE post_id = %d ", $post_id ));
4777
-	foreach ( $post_meta_ids as $mid )
4778
-		delete_metadata_by_mid( 'post', $mid );
4776
+	$post_meta_ids = $wpdb->get_col($wpdb->prepare("SELECT meta_id FROM $wpdb->postmeta WHERE post_id = %d ", $post_id));
4777
+	foreach ($post_meta_ids as $mid)
4778
+		delete_metadata_by_mid('post', $mid);
4779 4779
 
4780 4780
 	/** This action is documented in wp-includes/post.php */
4781
-	do_action( 'delete_post', $post_id );
4782
-	$result = $wpdb->delete( $wpdb->posts, array( 'ID' => $post_id ) );
4783
-	if ( ! $result ) {
4781
+	do_action('delete_post', $post_id);
4782
+	$result = $wpdb->delete($wpdb->posts, array('ID' => $post_id));
4783
+	if ( ! $result) {
4784 4784
 		return false;
4785 4785
 	}
4786 4786
 	/** This action is documented in wp-includes/post.php */
4787
-	do_action( 'deleted_post', $post_id );
4787
+	do_action('deleted_post', $post_id);
4788 4788
 
4789 4789
 	$uploadpath = wp_get_upload_dir();
4790 4790
 
4791
-	if ( ! empty($meta['thumb']) ) {
4791
+	if ( ! empty($meta['thumb'])) {
4792 4792
 		// Don't delete the thumb if another attachment uses it.
4793
-		if (! $wpdb->get_row( $wpdb->prepare( "SELECT meta_id FROM $wpdb->postmeta WHERE meta_key = '_wp_attachment_metadata' AND meta_value LIKE %s AND post_id <> %d", '%' . $wpdb->esc_like( $meta['thumb'] ) . '%', $post_id)) ) {
4793
+		if ( ! $wpdb->get_row($wpdb->prepare("SELECT meta_id FROM $wpdb->postmeta WHERE meta_key = '_wp_attachment_metadata' AND meta_value LIKE %s AND post_id <> %d", '%'.$wpdb->esc_like($meta['thumb']).'%', $post_id))) {
4794 4794
 			$thumbfile = str_replace(basename($file), $meta['thumb'], $file);
4795 4795
 			/** This filter is documented in wp-includes/functions.php */
4796
-			$thumbfile = apply_filters( 'wp_delete_file', $thumbfile );
4797
-			@ unlink( path_join($uploadpath['basedir'], $thumbfile) );
4796
+			$thumbfile = apply_filters('wp_delete_file', $thumbfile);
4797
+			@ unlink(path_join($uploadpath['basedir'], $thumbfile));
4798 4798
 		}
4799 4799
 	}
4800 4800
 
4801 4801
 	// Remove intermediate and backup images if there are any.
4802
-	if ( isset( $meta['sizes'] ) && is_array( $meta['sizes'] ) ) {
4803
-		foreach ( $meta['sizes'] as $size => $sizeinfo ) {
4804
-			$intermediate_file = str_replace( basename( $file ), $sizeinfo['file'], $file );
4802
+	if (isset($meta['sizes']) && is_array($meta['sizes'])) {
4803
+		foreach ($meta['sizes'] as $size => $sizeinfo) {
4804
+			$intermediate_file = str_replace(basename($file), $sizeinfo['file'], $file);
4805 4805
 			/** This filter is documented in wp-includes/functions.php */
4806
-			$intermediate_file = apply_filters( 'wp_delete_file', $intermediate_file );
4807
-			@ unlink( path_join( $uploadpath['basedir'], $intermediate_file ) );
4806
+			$intermediate_file = apply_filters('wp_delete_file', $intermediate_file);
4807
+			@ unlink(path_join($uploadpath['basedir'], $intermediate_file));
4808 4808
 		}
4809 4809
 	}
4810 4810
 
4811
-	if ( is_array($backup_sizes) ) {
4812
-		foreach ( $backup_sizes as $size ) {
4813
-			$del_file = path_join( dirname($meta['file']), $size['file'] );
4811
+	if (is_array($backup_sizes)) {
4812
+		foreach ($backup_sizes as $size) {
4813
+			$del_file = path_join(dirname($meta['file']), $size['file']);
4814 4814
 			/** This filter is documented in wp-includes/functions.php */
4815
-			$del_file = apply_filters( 'wp_delete_file', $del_file );
4816
-			@ unlink( path_join($uploadpath['basedir'], $del_file) );
4815
+			$del_file = apply_filters('wp_delete_file', $del_file);
4816
+			@ unlink(path_join($uploadpath['basedir'], $del_file));
4817 4817
 		}
4818 4818
 	}
4819 4819
 
4820
-	wp_delete_file( $file );
4820
+	wp_delete_file($file);
4821 4821
 
4822
-	clean_post_cache( $post );
4822
+	clean_post_cache($post);
4823 4823
 
4824 4824
 	return $post;
4825 4825
 }
@@ -4833,14 +4833,14 @@  discard block
 block discarded – undo
4833 4833
  * @param bool $unfiltered Optional. If true, filters are not run. Default false.
4834 4834
  * @return mixed Attachment meta field. False on failure.
4835 4835
  */
4836
-function wp_get_attachment_metadata( $post_id = 0, $unfiltered = false ) {
4836
+function wp_get_attachment_metadata($post_id = 0, $unfiltered = false) {
4837 4837
 	$post_id = (int) $post_id;
4838
-	if ( !$post = get_post( $post_id ) )
4838
+	if ( ! $post = get_post($post_id))
4839 4839
 		return false;
4840 4840
 
4841
-	$data = get_post_meta( $post->ID, '_wp_attachment_metadata', true );
4841
+	$data = get_post_meta($post->ID, '_wp_attachment_metadata', true);
4842 4842
 
4843
-	if ( $unfiltered )
4843
+	if ($unfiltered)
4844 4844
 		return $data;
4845 4845
 
4846 4846
 	/**
@@ -4852,7 +4852,7 @@  discard block
 block discarded – undo
4852 4852
 	 *                            if the object does not exist.
4853 4853
 	 * @param int        $post_id Attachment ID.
4854 4854
 	 */
4855
-	return apply_filters( 'wp_get_attachment_metadata', $data, $post->ID );
4855
+	return apply_filters('wp_get_attachment_metadata', $data, $post->ID);
4856 4856
 }
4857 4857
 
4858 4858
 /**
@@ -4864,9 +4864,9 @@  discard block
 block discarded – undo
4864 4864
  * @param array $data    Attachment data.
4865 4865
  * @return int|bool False if $post is invalid.
4866 4866
  */
4867
-function wp_update_attachment_metadata( $post_id, $data ) {
4867
+function wp_update_attachment_metadata($post_id, $data) {
4868 4868
 	$post_id = (int) $post_id;
4869
-	if ( !$post = get_post( $post_id ) )
4869
+	if ( ! $post = get_post($post_id))
4870 4870
 		return false;
4871 4871
 
4872 4872
 	/**
@@ -4877,10 +4877,10 @@  discard block
 block discarded – undo
4877 4877
 	 * @param array $data    Array of updated attachment meta data.
4878 4878
 	 * @param int   $post_id Attachment ID.
4879 4879
 	 */
4880
-	if ( $data = apply_filters( 'wp_update_attachment_metadata', $data, $post->ID ) )
4881
-		return update_post_meta( $post->ID, '_wp_attachment_metadata', $data );
4880
+	if ($data = apply_filters('wp_update_attachment_metadata', $data, $post->ID))
4881
+		return update_post_meta($post->ID, '_wp_attachment_metadata', $data);
4882 4882
 	else
4883
-		return delete_post_meta( $post->ID, '_wp_attachment_metadata' );
4883
+		return delete_post_meta($post->ID, '_wp_attachment_metadata');
4884 4884
 }
4885 4885
 
4886 4886
 /**
@@ -4893,29 +4893,29 @@  discard block
 block discarded – undo
4893 4893
  * @param int $post_id Optional. Attachment ID. Default 0.
4894 4894
  * @return string|false Attachment URL, otherwise false.
4895 4895
  */
4896
-function wp_get_attachment_url( $post_id = 0 ) {
4896
+function wp_get_attachment_url($post_id = 0) {
4897 4897
 	$post_id = (int) $post_id;
4898
-	if ( !$post = get_post( $post_id ) )
4898
+	if ( ! $post = get_post($post_id))
4899 4899
 		return false;
4900 4900
 
4901
-	if ( 'attachment' != $post->post_type )
4901
+	if ('attachment' != $post->post_type)
4902 4902
 		return false;
4903 4903
 
4904 4904
 	$url = '';
4905 4905
 	// Get attached file.
4906
-	if ( $file = get_post_meta( $post->ID, '_wp_attached_file', true ) ) {
4906
+	if ($file = get_post_meta($post->ID, '_wp_attached_file', true)) {
4907 4907
 		// Get upload directory.
4908
-		if ( ( $uploads = wp_get_upload_dir() ) && false === $uploads['error'] ) {
4908
+		if (($uploads = wp_get_upload_dir()) && false === $uploads['error']) {
4909 4909
 			// Check that the upload base exists in the file location.
4910
-			if ( 0 === strpos( $file, $uploads['basedir'] ) ) {
4910
+			if (0 === strpos($file, $uploads['basedir'])) {
4911 4911
 				// Replace file location with url location.
4912 4912
 				$url = str_replace($uploads['basedir'], $uploads['baseurl'], $file);
4913
-			} elseif ( false !== strpos($file, 'wp-content/uploads') ) {
4913
+			} elseif (false !== strpos($file, 'wp-content/uploads')) {
4914 4914
 				// Get the directory name relative to the basedir (back compat for pre-2.7 uploads)
4915
-				$url = trailingslashit( $uploads['baseurl'] . '/' . _wp_get_attachment_relative_path( $file ) ) . basename( $file );
4915
+				$url = trailingslashit($uploads['baseurl'].'/'._wp_get_attachment_relative_path($file)).basename($file);
4916 4916
 			} else {
4917 4917
 				// It's a newly-uploaded file, therefore $file is relative to the basedir.
4918
-				$url = $uploads['baseurl'] . "/$file";
4918
+				$url = $uploads['baseurl']."/$file";
4919 4919
 			}
4920 4920
 		}
4921 4921
 	}
@@ -4924,13 +4924,13 @@  discard block
 block discarded – undo
4924 4924
 	 * If any of the above options failed, Fallback on the GUID as used pre-2.7,
4925 4925
 	 * not recommended to rely upon this.
4926 4926
 	 */
4927
-	if ( empty($url) ) {
4928
-		$url = get_the_guid( $post->ID );
4927
+	if (empty($url)) {
4928
+		$url = get_the_guid($post->ID);
4929 4929
 	}
4930 4930
 
4931 4931
 	// On SSL front end, URLs should be HTTPS.
4932
-	if ( is_ssl() && ! is_admin() && 'wp-login.php' !== $GLOBALS['pagenow'] ) {
4933
-		$url = set_url_scheme( $url );
4932
+	if (is_ssl() && ! is_admin() && 'wp-login.php' !== $GLOBALS['pagenow']) {
4933
+		$url = set_url_scheme($url);
4934 4934
 	}
4935 4935
 
4936 4936
 	/**
@@ -4941,9 +4941,9 @@  discard block
 block discarded – undo
4941 4941
 	 * @param string $url     URL for the given attachment.
4942 4942
 	 * @param int    $post_id Attachment ID.
4943 4943
 	 */
4944
-	$url = apply_filters( 'wp_get_attachment_url', $url, $post->ID );
4944
+	$url = apply_filters('wp_get_attachment_url', $url, $post->ID);
4945 4945
 
4946
-	if ( empty( $url ) )
4946
+	if (empty($url))
4947 4947
 		return false;
4948 4948
 
4949 4949
 	return $url;
@@ -4957,13 +4957,13 @@  discard block
 block discarded – undo
4957 4957
  * @param int $post_id Optional. Attachment ID. Default is the ID of the global `$post`.
4958 4958
  * @return string|false False on failure. Attachment caption on success.
4959 4959
  */
4960
-function wp_get_attachment_caption( $post_id = 0 ) {
4960
+function wp_get_attachment_caption($post_id = 0) {
4961 4961
 	$post_id = (int) $post_id;
4962
-	if ( ! $post = get_post( $post_id ) ) {
4962
+	if ( ! $post = get_post($post_id)) {
4963 4963
 		return false;
4964 4964
 	}
4965 4965
 
4966
-	if ( 'attachment' !== $post->post_type ) {
4966
+	if ('attachment' !== $post->post_type) {
4967 4967
 		return false;
4968 4968
 	}
4969 4969
 
@@ -4977,7 +4977,7 @@  discard block
 block discarded – undo
4977 4977
 	 * @param string $caption Caption for the given attachment.
4978 4978
 	 * @param int    $post_id Attachment ID.
4979 4979
 	 */
4980
-	return apply_filters( 'wp_get_attachment_caption', $caption, $post->ID );
4980
+	return apply_filters('wp_get_attachment_caption', $caption, $post->ID);
4981 4981
 }
4982 4982
 
4983 4983
 /**
@@ -4988,16 +4988,16 @@  discard block
 block discarded – undo
4988 4988
  * @param int $post_id Optional. Attachment ID. Default 0.
4989 4989
  * @return string|false False on failure. Thumbnail file path on success.
4990 4990
  */
4991
-function wp_get_attachment_thumb_file( $post_id = 0 ) {
4991
+function wp_get_attachment_thumb_file($post_id = 0) {
4992 4992
 	$post_id = (int) $post_id;
4993
-	if ( !$post = get_post( $post_id ) )
4993
+	if ( ! $post = get_post($post_id))
4994 4994
 		return false;
4995
-	if ( !is_array( $imagedata = wp_get_attachment_metadata( $post->ID ) ) )
4995
+	if ( ! is_array($imagedata = wp_get_attachment_metadata($post->ID)))
4996 4996
 		return false;
4997 4997
 
4998
-	$file = get_attached_file( $post->ID );
4998
+	$file = get_attached_file($post->ID);
4999 4999
 
5000
-	if ( !empty($imagedata['thumb']) && ($thumbfile = str_replace(basename($file), $imagedata['thumb'], $file)) && file_exists($thumbfile) ) {
5000
+	if ( ! empty($imagedata['thumb']) && ($thumbfile = str_replace(basename($file), $imagedata['thumb'], $file)) && file_exists($thumbfile)) {
5001 5001
 		/**
5002 5002
 		 * Filters the attachment thumbnail file path.
5003 5003
 		 *
@@ -5006,7 +5006,7 @@  discard block
 block discarded – undo
5006 5006
 		 * @param string $thumbfile File path to the attachment thumbnail.
5007 5007
 		 * @param int    $post_id   Attachment ID.
5008 5008
 		 */
5009
-		return apply_filters( 'wp_get_attachment_thumb_file', $thumbfile, $post->ID );
5009
+		return apply_filters('wp_get_attachment_thumb_file', $thumbfile, $post->ID);
5010 5010
 	}
5011 5011
 	return false;
5012 5012
 }
@@ -5019,18 +5019,18 @@  discard block
 block discarded – undo
5019 5019
  * @param int $post_id Optional. Attachment ID. Default 0.
5020 5020
  * @return string|false False on failure. Thumbnail URL on success.
5021 5021
  */
5022
-function wp_get_attachment_thumb_url( $post_id = 0 ) {
5022
+function wp_get_attachment_thumb_url($post_id = 0) {
5023 5023
 	$post_id = (int) $post_id;
5024
-	if ( !$post = get_post( $post_id ) )
5024
+	if ( ! $post = get_post($post_id))
5025 5025
 		return false;
5026
-	if ( !$url = wp_get_attachment_url( $post->ID ) )
5026
+	if ( ! $url = wp_get_attachment_url($post->ID))
5027 5027
 		return false;
5028 5028
 
5029
-	$sized = image_downsize( $post_id, 'thumbnail' );
5030
-	if ( $sized )
5029
+	$sized = image_downsize($post_id, 'thumbnail');
5030
+	if ($sized)
5031 5031
 		return $sized[0];
5032 5032
 
5033
-	if ( !$thumb = wp_get_attachment_thumb_file( $post->ID ) )
5033
+	if ( ! $thumb = wp_get_attachment_thumb_file($post->ID))
5034 5034
 		return false;
5035 5035
 
5036 5036
 	$url = str_replace(basename($url), basename($thumb), $url);
@@ -5043,7 +5043,7 @@  discard block
 block discarded – undo
5043 5043
 	 * @param string $url     URL for the attachment thumbnail.
5044 5044
 	 * @param int    $post_id Attachment ID.
5045 5045
 	 */
5046
-	return apply_filters( 'wp_get_attachment_thumb_url', $url, $post->ID );
5046
+	return apply_filters('wp_get_attachment_thumb_url', $url, $post->ID);
5047 5047
 }
5048 5048
 
5049 5049
 /**
@@ -5055,40 +5055,40 @@  discard block
 block discarded – undo
5055 5055
  * @param int|WP_Post $post Optional. Attachment ID or object. Default is global $post.
5056 5056
  * @return bool True if one of the accepted types, false otherwise.
5057 5057
  */
5058
-function wp_attachment_is( $type, $post = null ) {
5059
-	if ( ! $post = get_post( $post ) ) {
5058
+function wp_attachment_is($type, $post = null) {
5059
+	if ( ! $post = get_post($post)) {
5060 5060
 		return false;
5061 5061
 	}
5062 5062
 
5063
-	if ( ! $file = get_attached_file( $post->ID ) ) {
5063
+	if ( ! $file = get_attached_file($post->ID)) {
5064 5064
 		return false;
5065 5065
 	}
5066 5066
 
5067
-	if ( 0 === strpos( $post->post_mime_type, $type . '/' ) ) {
5067
+	if (0 === strpos($post->post_mime_type, $type.'/')) {
5068 5068
 		return true;
5069 5069
 	}
5070 5070
 
5071
-	$check = wp_check_filetype( $file );
5072
-	if ( empty( $check['ext'] ) ) {
5071
+	$check = wp_check_filetype($file);
5072
+	if (empty($check['ext'])) {
5073 5073
 		return false;
5074 5074
 	}
5075 5075
 
5076 5076
 	$ext = $check['ext'];
5077 5077
 
5078
-	if ( 'import' !== $post->post_mime_type ) {
5078
+	if ('import' !== $post->post_mime_type) {
5079 5079
 		return $type === $ext;
5080 5080
 	}
5081 5081
 
5082
-	switch ( $type ) {
5082
+	switch ($type) {
5083 5083
 	case 'image':
5084
-		$image_exts = array( 'jpg', 'jpeg', 'jpe', 'gif', 'png' );
5085
-		return in_array( $ext, $image_exts );
5084
+		$image_exts = array('jpg', 'jpeg', 'jpe', 'gif', 'png');
5085
+		return in_array($ext, $image_exts);
5086 5086
 
5087 5087
 	case 'audio':
5088
-		return in_array( $ext, wp_get_audio_extensions() );
5088
+		return in_array($ext, wp_get_audio_extensions());
5089 5089
 
5090 5090
 	case 'video':
5091
-		return in_array( $ext, wp_get_video_extensions() );
5091
+		return in_array($ext, wp_get_video_extensions());
5092 5092
 
5093 5093
 	default:
5094 5094
 		return $type === $ext;
@@ -5105,8 +5105,8 @@  discard block
 block discarded – undo
5105 5105
  * @param int|WP_Post $post Optional. Attachment ID or object. Default is global $post.
5106 5106
  * @return bool Whether the attachment is an image.
5107 5107
  */
5108
-function wp_attachment_is_image( $post = null ) {
5109
-	return wp_attachment_is( 'image', $post );
5108
+function wp_attachment_is_image($post = null) {
5109
+	return wp_attachment_is('image', $post);
5110 5110
 }
5111 5111
 
5112 5112
 /**
@@ -5117,22 +5117,22 @@  discard block
 block discarded – undo
5117 5117
  * @param string|int $mime MIME type or attachment ID.
5118 5118
  * @return string|false Icon, false otherwise.
5119 5119
  */
5120
-function wp_mime_type_icon( $mime = 0 ) {
5121
-	if ( !is_numeric($mime) )
5120
+function wp_mime_type_icon($mime = 0) {
5121
+	if ( ! is_numeric($mime))
5122 5122
 		$icon = wp_cache_get("mime_type_icon_$mime");
5123 5123
 
5124 5124
 	$post_id = 0;
5125
-	if ( empty($icon) ) {
5125
+	if (empty($icon)) {
5126 5126
 		$post_mimes = array();
5127
-		if ( is_numeric($mime) ) {
5127
+		if (is_numeric($mime)) {
5128 5128
 			$mime = (int) $mime;
5129
-			if ( $post = get_post( $mime ) ) {
5129
+			if ($post = get_post($mime)) {
5130 5130
 				$post_id = (int) $post->ID;
5131
-				$file = get_attached_file( $post_id );
5131
+				$file = get_attached_file($post_id);
5132 5132
 				$ext = preg_replace('/^.+?\.([^.]+)$/', '$1', $file);
5133
-				if ( !empty($ext) ) {
5133
+				if ( ! empty($ext)) {
5134 5134
 					$post_mimes[] = $ext;
5135
-					if ( $ext_type = wp_ext2type( $ext ) )
5135
+					if ($ext_type = wp_ext2type($ext))
5136 5136
 						$post_mimes[] = $ext_type;
5137 5137
 				}
5138 5138
 				$mime = $post->post_mime_type;
@@ -5145,7 +5145,7 @@  discard block
 block discarded – undo
5145 5145
 
5146 5146
 		$icon_files = wp_cache_get('icon_files');
5147 5147
 
5148
-		if ( !is_array($icon_files) ) {
5148
+		if ( ! is_array($icon_files)) {
5149 5149
 			/**
5150 5150
 			 * Filters the icon directory path.
5151 5151
 			 *
@@ -5153,7 +5153,7 @@  discard block
 block discarded – undo
5153 5153
 			 *
5154 5154
 			 * @param string $path Icon directory absolute path.
5155 5155
 			 */
5156
-			$icon_dir = apply_filters( 'icon_dir', ABSPATH . WPINC . '/images/media' );
5156
+			$icon_dir = apply_filters('icon_dir', ABSPATH.WPINC.'/images/media');
5157 5157
 
5158 5158
 			/**
5159 5159
 			 * Filters the icon directory URI.
@@ -5162,7 +5162,7 @@  discard block
 block discarded – undo
5162 5162
 			 *
5163 5163
 			 * @param string $uri Icon directory URI.
5164 5164
 			 */
5165
-			$icon_dir_uri = apply_filters( 'icon_dir_uri', includes_url( 'images/media' ) );
5165
+			$icon_dir_uri = apply_filters('icon_dir_uri', includes_url('images/media'));
5166 5166
 
5167 5167
 			/**
5168 5168
 			 * Filters the list of icon directory URIs.
@@ -5171,19 +5171,19 @@  discard block
 block discarded – undo
5171 5171
 			 *
5172 5172
 			 * @param array $uris List of icon directory URIs.
5173 5173
 			 */
5174
-			$dirs = apply_filters( 'icon_dirs', array( $icon_dir => $icon_dir_uri ) );
5174
+			$dirs = apply_filters('icon_dirs', array($icon_dir => $icon_dir_uri));
5175 5175
 			$icon_files = array();
5176
-			while ( $dirs ) {
5177
-				$keys = array_keys( $dirs );
5178
-				$dir = array_shift( $keys );
5176
+			while ($dirs) {
5177
+				$keys = array_keys($dirs);
5178
+				$dir = array_shift($keys);
5179 5179
 				$uri = array_shift($dirs);
5180
-				if ( $dh = opendir($dir) ) {
5181
-					while ( false !== $file = readdir($dh) ) {
5180
+				if ($dh = opendir($dir)) {
5181
+					while (false !== $file = readdir($dh)) {
5182 5182
 						$file = basename($file);
5183
-						if ( substr($file, 0, 1) == '.' )
5183
+						if (substr($file, 0, 1) == '.')
5184 5184
 							continue;
5185
-						if ( !in_array(strtolower(substr($file, -4)), array('.png', '.gif', '.jpg') ) ) {
5186
-							if ( is_dir("$dir/$file") )
5185
+						if ( ! in_array(strtolower(substr($file, -4)), array('.png', '.gif', '.jpg'))) {
5186
+							if (is_dir("$dir/$file"))
5187 5187
 								$dirs["$dir/$file"] = "$uri/$file";
5188 5188
 							continue;
5189 5189
 						}
@@ -5192,15 +5192,15 @@  discard block
 block discarded – undo
5192 5192
 					closedir($dh);
5193 5193
 				}
5194 5194
 			}
5195
-			wp_cache_add( 'icon_files', $icon_files, 'default', 600 );
5195
+			wp_cache_add('icon_files', $icon_files, 'default', 600);
5196 5196
 		}
5197 5197
 
5198 5198
 		$types = array();
5199 5199
 		// Icon basename - extension = MIME wildcard.
5200
-		foreach ( $icon_files as $file => $uri )
5201
-			$types[ preg_replace('/^([^.]*).*$/', '$1', basename($file)) ] =& $icon_files[$file];
5200
+		foreach ($icon_files as $file => $uri)
5201
+			$types[preg_replace('/^([^.]*).*$/', '$1', basename($file))] = & $icon_files[$file];
5202 5202
 
5203
-		if ( ! empty($mime) ) {
5203
+		if ( ! empty($mime)) {
5204 5204
 			$post_mimes[] = substr($mime, 0, strpos($mime, '/'));
5205 5205
 			$post_mimes[] = substr($mime, strpos($mime, '/') + 1);
5206 5206
 			$post_mimes[] = str_replace('/', '_', $mime);
@@ -5209,15 +5209,15 @@  discard block
 block discarded – undo
5209 5209
 		$matches = wp_match_mime_types(array_keys($types), $post_mimes);
5210 5210
 		$matches['default'] = array('default');
5211 5211
 
5212
-		foreach ( $matches as $match => $wilds ) {
5213
-			foreach ( $wilds as $wild ) {
5214
-				if ( ! isset( $types[ $wild ] ) ) {
5212
+		foreach ($matches as $match => $wilds) {
5213
+			foreach ($wilds as $wild) {
5214
+				if ( ! isset($types[$wild])) {
5215 5215
 					continue;
5216 5216
 				}
5217 5217
 
5218
-				$icon = $types[ $wild ];
5219
-				if ( ! is_numeric( $mime ) ) {
5220
-					wp_cache_add( "mime_type_icon_$mime", $icon );
5218
+				$icon = $types[$wild];
5219
+				if ( ! is_numeric($mime)) {
5220
+					wp_cache_add("mime_type_icon_$mime", $icon);
5221 5221
 				}
5222 5222
 				break 2;
5223 5223
 			}
@@ -5234,7 +5234,7 @@  discard block
 block discarded – undo
5234 5234
 	 * @param int    $post_id Attachment ID. Will equal 0 if the function passed
5235 5235
 	 *                        the mime type.
5236 5236
 	 */
5237
-	return apply_filters( 'wp_mime_type_icon', $icon, $mime, $post_id );
5237
+	return apply_filters('wp_mime_type_icon', $icon, $mime, $post_id);
5238 5238
 }
5239 5239
 
5240 5240
 /**
@@ -5256,27 +5256,27 @@  discard block
 block discarded – undo
5256 5256
  * @param WP_Post $post        The Post Object
5257 5257
  * @param WP_Post $post_before The Previous Post Object
5258 5258
  */
5259
-function wp_check_for_changed_slugs( $post_id, $post, $post_before ) {
5259
+function wp_check_for_changed_slugs($post_id, $post, $post_before) {
5260 5260
 	// Don't bother if it hasn't changed.
5261
-	if ( $post->post_name == $post_before->post_name ) {
5261
+	if ($post->post_name == $post_before->post_name) {
5262 5262
 		return;
5263 5263
 	}
5264 5264
 
5265 5265
 	// We're only concerned with published, non-hierarchical objects.
5266
-	if ( ! ( 'publish' === $post->post_status || ( 'attachment' === get_post_type( $post ) && 'inherit' === $post->post_status ) ) || is_post_type_hierarchical( $post->post_type ) ) {
5266
+	if ( ! ('publish' === $post->post_status || ('attachment' === get_post_type($post) && 'inherit' === $post->post_status)) || is_post_type_hierarchical($post->post_type)) {
5267 5267
 		return;
5268 5268
 	}
5269 5269
 
5270
-	$old_slugs = (array) get_post_meta( $post_id, '_wp_old_slug' );
5270
+	$old_slugs = (array) get_post_meta($post_id, '_wp_old_slug');
5271 5271
 
5272 5272
 	// If we haven't added this old slug before, add it now.
5273
-	if ( ! empty( $post_before->post_name ) && ! in_array( $post_before->post_name, $old_slugs ) ) {
5274
-		add_post_meta( $post_id, '_wp_old_slug', $post_before->post_name );
5273
+	if ( ! empty($post_before->post_name) && ! in_array($post_before->post_name, $old_slugs)) {
5274
+		add_post_meta($post_id, '_wp_old_slug', $post_before->post_name);
5275 5275
 	}
5276 5276
 
5277 5277
 	// If the new slug was used previously, delete it from the list.
5278
-	if ( in_array( $post->post_name, $old_slugs ) ) {
5279
-		delete_post_meta( $post_id, '_wp_old_slug', $post->post_name );
5278
+	if (in_array($post->post_name, $old_slugs)) {
5279
+		delete_post_meta($post_id, '_wp_old_slug', $post->post_name);
5280 5280
 	}
5281 5281
 }
5282 5282
 
@@ -5294,8 +5294,8 @@  discard block
 block discarded – undo
5294 5294
  * @param string|array $post_type Single post type or an array of post types. Currently only supports 'post' or 'page'.
5295 5295
  * @return string SQL code that can be added to a where clause.
5296 5296
  */
5297
-function get_private_posts_cap_sql( $post_type ) {
5298
-	return get_posts_by_author_sql( $post_type, false );
5297
+function get_private_posts_cap_sql($post_type) {
5298
+	return get_posts_by_author_sql($post_type, false);
5299 5299
 }
5300 5300
 
5301 5301
 /**
@@ -5315,19 +5315,19 @@  discard block
 block discarded – undo
5315 5315
  *                                    $current_user.  Default false.
5316 5316
  * @return string SQL WHERE code that can be added to a query.
5317 5317
  */
5318
-function get_posts_by_author_sql( $post_type, $full = true, $post_author = null, $public_only = false ) {
5318
+function get_posts_by_author_sql($post_type, $full = true, $post_author = null, $public_only = false) {
5319 5319
 	global $wpdb;
5320 5320
 
5321
-	if ( is_array( $post_type ) ) {
5321
+	if (is_array($post_type)) {
5322 5322
 		$post_types = $post_type;
5323 5323
 	} else {
5324
-		$post_types = array( $post_type );
5324
+		$post_types = array($post_type);
5325 5325
 	}
5326 5326
 
5327 5327
 	$post_type_clauses = array();
5328
-	foreach ( $post_types as $post_type ) {
5329
-		$post_type_obj = get_post_type_object( $post_type );
5330
-		if ( ! $post_type_obj ) {
5328
+	foreach ($post_types as $post_type) {
5329
+		$post_type_obj = get_post_type_object($post_type);
5330
+		if ( ! $post_type_obj) {
5331 5331
 			continue;
5332 5332
 		}
5333 5333
 
@@ -5340,42 +5340,42 @@  discard block
 block discarded – undo
5340 5340
 		 *
5341 5341
 		 * @param string $cap Capability.
5342 5342
 		 */
5343
-		if ( ! $cap = apply_filters( 'pub_priv_sql_capability', '' ) ) {
5344
-			$cap = current_user_can( $post_type_obj->cap->read_private_posts );
5343
+		if ( ! $cap = apply_filters('pub_priv_sql_capability', '')) {
5344
+			$cap = current_user_can($post_type_obj->cap->read_private_posts);
5345 5345
 		}
5346 5346
 
5347 5347
 		// Only need to check the cap if $public_only is false.
5348 5348
 		$post_status_sql = "post_status = 'publish'";
5349
-		if ( false === $public_only ) {
5350
-			if ( $cap ) {
5349
+		if (false === $public_only) {
5350
+			if ($cap) {
5351 5351
 				// Does the user have the capability to view private posts? Guess so.
5352 5352
 				$post_status_sql .= " OR post_status = 'private'";
5353
-			} elseif ( is_user_logged_in() ) {
5353
+			} elseif (is_user_logged_in()) {
5354 5354
 				// Users can view their own private posts.
5355 5355
 				$id = get_current_user_id();
5356
-				if ( null === $post_author || ! $full ) {
5356
+				if (null === $post_author || ! $full) {
5357 5357
 					$post_status_sql .= " OR post_status = 'private' AND post_author = $id";
5358
-				} elseif ( $id == (int) $post_author ) {
5358
+				} elseif ($id == (int) $post_author) {
5359 5359
 					$post_status_sql .= " OR post_status = 'private'";
5360 5360
 				} // else none
5361 5361
 			} // else none
5362 5362
 		}
5363 5363
 
5364
-		$post_type_clauses[] = "( post_type = '" . $post_type . "' AND ( $post_status_sql ) )";
5364
+		$post_type_clauses[] = "( post_type = '".$post_type."' AND ( $post_status_sql ) )";
5365 5365
 	}
5366 5366
 
5367
-	if ( empty( $post_type_clauses ) ) {
5367
+	if (empty($post_type_clauses)) {
5368 5368
 		return $full ? 'WHERE 1 = 0' : '1 = 0';
5369 5369
 	}
5370 5370
 
5371
-	$sql = '( '. implode( ' OR ', $post_type_clauses ) . ' )';
5371
+	$sql = '( '.implode(' OR ', $post_type_clauses).' )';
5372 5372
 
5373
-	if ( null !== $post_author ) {
5374
-		$sql .= $wpdb->prepare( ' AND post_author = %d', $post_author );
5373
+	if (null !== $post_author) {
5374
+		$sql .= $wpdb->prepare(' AND post_author = %d', $post_author);
5375 5375
 	}
5376 5376
 
5377
-	if ( $full ) {
5378
-		$sql = 'WHERE ' . $sql;
5377
+	if ($full) {
5378
+		$sql = 'WHERE '.$sql;
5379 5379
 	}
5380 5380
 
5381 5381
 	return $sql;
@@ -5399,7 +5399,7 @@  discard block
 block discarded – undo
5399 5399
  * @param string $post_type Optional. The post type to check. Default 'any'.
5400 5400
  * @return string The date of the last post.
5401 5401
  */
5402
-function get_lastpostdate( $timezone = 'server', $post_type = 'any' ) {
5402
+function get_lastpostdate($timezone = 'server', $post_type = 'any') {
5403 5403
 	/**
5404 5404
 	 * Filters the date the last post was published.
5405 5405
 	 *
@@ -5409,7 +5409,7 @@  discard block
 block discarded – undo
5409 5409
 	 * @param string $timezone Location to use for getting the post published date.
5410 5410
 	 *                         See get_lastpostdate() for accepted `$timezone` values.
5411 5411
 	 */
5412
-	return apply_filters( 'get_lastpostdate', _get_last_post_time( $timezone, 'date', $post_type ), $timezone );
5412
+	return apply_filters('get_lastpostdate', _get_last_post_time($timezone, 'date', $post_type), $timezone);
5413 5413
 }
5414 5414
 
5415 5415
 /**
@@ -5428,7 +5428,7 @@  discard block
 block discarded – undo
5428 5428
  * @param string $post_type Optional. The post type to check. Default 'any'.
5429 5429
  * @return string The timestamp.
5430 5430
  */
5431
-function get_lastpostmodified( $timezone = 'server', $post_type = 'any' ) {
5431
+function get_lastpostmodified($timezone = 'server', $post_type = 'any') {
5432 5432
 	/**
5433 5433
 	 * Pre-filter the return value of get_lastpostmodified() before the query is run.
5434 5434
 	 *
@@ -5440,15 +5440,15 @@  discard block
 block discarded – undo
5440 5440
 	 *                                 See get_lastpostdate() for accepted `$timezone` values.
5441 5441
 	 * @param string $post_type        The post type to check.
5442 5442
 	 */
5443
-	$lastpostmodified = apply_filters( 'pre_get_lastpostmodified', false, $timezone, $post_type );
5444
-	if ( false !== $lastpostmodified ) {
5443
+	$lastpostmodified = apply_filters('pre_get_lastpostmodified', false, $timezone, $post_type);
5444
+	if (false !== $lastpostmodified) {
5445 5445
 		return $lastpostmodified;
5446 5446
 	}
5447 5447
 
5448
-	$lastpostmodified = _get_last_post_time( $timezone, 'modified', $post_type );
5448
+	$lastpostmodified = _get_last_post_time($timezone, 'modified', $post_type);
5449 5449
 
5450 5450
 	$lastpostdate = get_lastpostdate($timezone);
5451
-	if ( $lastpostdate > $lastpostmodified ) {
5451
+	if ($lastpostdate > $lastpostmodified) {
5452 5452
 		$lastpostmodified = $lastpostdate;
5453 5453
 	}
5454 5454
 
@@ -5461,7 +5461,7 @@  discard block
 block discarded – undo
5461 5461
 	 * @param string $timezone         Location to use for getting the post modified date.
5462 5462
 	 *                                 See get_lastpostdate() for accepted `$timezone` values.
5463 5463
 	 */
5464
-	return apply_filters( 'get_lastpostmodified', $lastpostmodified, $timezone );
5464
+	return apply_filters('get_lastpostmodified', $lastpostmodified, $timezone);
5465 5465
 }
5466 5466
 
5467 5467
 /**
@@ -5479,32 +5479,32 @@  discard block
 block discarded – undo
5479 5479
  * @param string $post_type Optional. The post type to check. Default 'any'.
5480 5480
  * @return string|false The timestamp.
5481 5481
  */
5482
-function _get_last_post_time( $timezone, $field, $post_type = 'any' ) {
5482
+function _get_last_post_time($timezone, $field, $post_type = 'any') {
5483 5483
 	global $wpdb;
5484 5484
 
5485
-	if ( ! in_array( $field, array( 'date', 'modified' ) ) ) {
5485
+	if ( ! in_array($field, array('date', 'modified'))) {
5486 5486
 		return false;
5487 5487
 	}
5488 5488
 
5489
-	$timezone = strtolower( $timezone );
5489
+	$timezone = strtolower($timezone);
5490 5490
 
5491 5491
 	$key = "lastpost{$field}:$timezone";
5492
-	if ( 'any' !== $post_type ) {
5493
-		$key .= ':' . sanitize_key( $post_type );
5492
+	if ('any' !== $post_type) {
5493
+		$key .= ':'.sanitize_key($post_type);
5494 5494
 	}
5495 5495
 
5496
-	$date = wp_cache_get( $key, 'timeinfo' );
5496
+	$date = wp_cache_get($key, 'timeinfo');
5497 5497
 
5498
-	if ( ! $date ) {
5499
-		if ( 'any' === $post_type ) {
5500
-			$post_types = get_post_types( array( 'public' => true ) );
5501
-			array_walk( $post_types, array( $wpdb, 'escape_by_ref' ) );
5502
-			$post_types = "'" . implode( "', '", $post_types ) . "'";
5498
+	if ( ! $date) {
5499
+		if ('any' === $post_type) {
5500
+			$post_types = get_post_types(array('public' => true));
5501
+			array_walk($post_types, array($wpdb, 'escape_by_ref'));
5502
+			$post_types = "'".implode("', '", $post_types)."'";
5503 5503
 		} else {
5504
-			$post_types = "'" . sanitize_key( $post_type ) . "'";
5504
+			$post_types = "'".sanitize_key($post_type)."'";
5505 5505
 		}
5506 5506
 
5507
-		switch ( $timezone ) {
5507
+		switch ($timezone) {
5508 5508
 			case 'gmt':
5509 5509
 				$date = $wpdb->get_var("SELECT post_{$field}_gmt FROM $wpdb->posts WHERE post_status = 'publish' AND post_type IN ({$post_types}) ORDER BY post_{$field}_gmt DESC LIMIT 1");
5510 5510
 				break;
@@ -5512,13 +5512,13 @@  discard block
 block discarded – undo
5512 5512
 				$date = $wpdb->get_var("SELECT post_{$field} FROM $wpdb->posts WHERE post_status = 'publish' AND post_type IN ({$post_types}) ORDER BY post_{$field}_gmt DESC LIMIT 1");
5513 5513
 				break;
5514 5514
 			case 'server':
5515
-				$add_seconds_server = date( 'Z' );
5515
+				$add_seconds_server = date('Z');
5516 5516
 				$date = $wpdb->get_var("SELECT DATE_ADD(post_{$field}_gmt, INTERVAL '$add_seconds_server' SECOND) FROM $wpdb->posts WHERE post_status = 'publish' AND post_type IN ({$post_types}) ORDER BY post_{$field}_gmt DESC LIMIT 1");
5517 5517
 				break;
5518 5518
 		}
5519 5519
 
5520
-		if ( $date ) {
5521
-			wp_cache_set( $key, $date, 'timeinfo' );
5520
+		if ($date) {
5521
+			wp_cache_set($key, $date, 'timeinfo');
5522 5522
 		}
5523 5523
 	}
5524 5524
 
@@ -5532,12 +5532,12 @@  discard block
 block discarded – undo
5532 5532
  *
5533 5533
  * @param array $posts Array of post objects, passed by reference.
5534 5534
  */
5535
-function update_post_cache( &$posts ) {
5536
-	if ( ! $posts )
5535
+function update_post_cache(&$posts) {
5536
+	if ( ! $posts)
5537 5537
 		return;
5538 5538
 
5539
-	foreach ( $posts as $post )
5540
-		wp_cache_add( $post->ID, $post, 'posts' );
5539
+	foreach ($posts as $post)
5540
+		wp_cache_add($post->ID, $post, 'posts');
5541 5541
 }
5542 5542
 
5543 5543
 /**
@@ -5555,22 +5555,22 @@  discard block
 block discarded – undo
5555 5555
  *
5556 5556
  * @param int|WP_Post $post Post ID or post object to remove from the cache.
5557 5557
  */
5558
-function clean_post_cache( $post ) {
5558
+function clean_post_cache($post) {
5559 5559
 	global $_wp_suspend_cache_invalidation;
5560 5560
 
5561
-	if ( ! empty( $_wp_suspend_cache_invalidation ) )
5561
+	if ( ! empty($_wp_suspend_cache_invalidation))
5562 5562
 		return;
5563 5563
 
5564
-	$post = get_post( $post );
5565
-	if ( empty( $post ) )
5564
+	$post = get_post($post);
5565
+	if (empty($post))
5566 5566
 		return;
5567 5567
 
5568
-	wp_cache_delete( $post->ID, 'posts' );
5569
-	wp_cache_delete( $post->ID, 'post_meta' );
5568
+	wp_cache_delete($post->ID, 'posts');
5569
+	wp_cache_delete($post->ID, 'post_meta');
5570 5570
 
5571
-	clean_object_term_cache( $post->ID, $post->post_type );
5571
+	clean_object_term_cache($post->ID, $post->post_type);
5572 5572
 
5573
-	wp_cache_delete( 'wp_get_archives', 'general' );
5573
+	wp_cache_delete('wp_get_archives', 'general');
5574 5574
 
5575 5575
 	/**
5576 5576
 	 * Fires immediately after the given post's cache is cleaned.
@@ -5580,10 +5580,10 @@  discard block
 block discarded – undo
5580 5580
 	 * @param int     $post_id Post ID.
5581 5581
 	 * @param WP_Post $post    Post object.
5582 5582
 	 */
5583
-	do_action( 'clean_post_cache', $post->ID, $post );
5583
+	do_action('clean_post_cache', $post->ID, $post);
5584 5584
 
5585
-	if ( 'page' == $post->post_type ) {
5586
-		wp_cache_delete( 'all_page_ids', 'posts' );
5585
+	if ('page' == $post->post_type) {
5586
+		wp_cache_delete('all_page_ids', 'posts');
5587 5587
 
5588 5588
 		/**
5589 5589
 		 * Fires immediately after the given page's cache is cleaned.
@@ -5592,10 +5592,10 @@  discard block
 block discarded – undo
5592 5592
 		 *
5593 5593
 		 * @param int $post_id Post ID.
5594 5594
 		 */
5595
-		do_action( 'clean_page_cache', $post->ID );
5595
+		do_action('clean_page_cache', $post->ID);
5596 5596
 	}
5597 5597
 
5598
-	wp_cache_set( 'last_changed', microtime(), 'posts' );
5598
+	wp_cache_set('last_changed', microtime(), 'posts');
5599 5599
 }
5600 5600
 
5601 5601
 /**
@@ -5608,27 +5608,27 @@  discard block
 block discarded – undo
5608 5608
  * @param bool   $update_term_cache Optional. Whether to update the term cache. Default true.
5609 5609
  * @param bool   $update_meta_cache Optional. Whether to update the meta cache. Default true.
5610 5610
  */
5611
-function update_post_caches( &$posts, $post_type = 'post', $update_term_cache = true, $update_meta_cache = true ) {
5611
+function update_post_caches(&$posts, $post_type = 'post', $update_term_cache = true, $update_meta_cache = true) {
5612 5612
 	// No point in doing all this work if we didn't match any posts.
5613
-	if ( !$posts )
5613
+	if ( ! $posts)
5614 5614
 		return;
5615 5615
 
5616 5616
 	update_post_cache($posts);
5617 5617
 
5618 5618
 	$post_ids = array();
5619
-	foreach ( $posts as $post )
5619
+	foreach ($posts as $post)
5620 5620
 		$post_ids[] = $post->ID;
5621 5621
 
5622
-	if ( ! $post_type )
5622
+	if ( ! $post_type)
5623 5623
 		$post_type = 'any';
5624 5624
 
5625
-	if ( $update_term_cache ) {
5626
-		if ( is_array($post_type) ) {
5625
+	if ($update_term_cache) {
5626
+		if (is_array($post_type)) {
5627 5627
 			$ptypes = $post_type;
5628
-		} elseif ( 'any' == $post_type ) {
5628
+		} elseif ('any' == $post_type) {
5629 5629
 			$ptypes = array();
5630 5630
 			// Just use the post_types in the supplied posts.
5631
-			foreach ( $posts as $post ) {
5631
+			foreach ($posts as $post) {
5632 5632
 				$ptypes[] = $post->post_type;
5633 5633
 			}
5634 5634
 			$ptypes = array_unique($ptypes);
@@ -5636,11 +5636,11 @@  discard block
 block discarded – undo
5636 5636
 			$ptypes = array($post_type);
5637 5637
 		}
5638 5638
 
5639
-		if ( ! empty($ptypes) )
5639
+		if ( ! empty($ptypes))
5640 5640
 			update_object_term_cache($post_ids, $ptypes);
5641 5641
 	}
5642 5642
 
5643
-	if ( $update_meta_cache )
5643
+	if ($update_meta_cache)
5644 5644
 		update_postmeta_cache($post_ids);
5645 5645
 }
5646 5646
 
@@ -5657,7 +5657,7 @@  discard block
 block discarded – undo
5657 5657
  * @return array|false Returns false if there is nothing to update or an array
5658 5658
  *                     of metadata.
5659 5659
  */
5660
-function update_postmeta_cache( $post_ids ) {
5660
+function update_postmeta_cache($post_ids) {
5661 5661
 	return update_meta_cache('post', $post_ids);
5662 5662
 }
5663 5663
 
@@ -5676,10 +5676,10 @@  discard block
 block discarded – undo
5676 5676
  * @param int  $id          The attachment ID in the cache to clean.
5677 5677
  * @param bool $clean_terms Optional. Whether to clean terms cache. Default false.
5678 5678
  */
5679
-function clean_attachment_cache( $id, $clean_terms = false ) {
5679
+function clean_attachment_cache($id, $clean_terms = false) {
5680 5680
 	global $_wp_suspend_cache_invalidation;
5681 5681
 
5682
-	if ( !empty($_wp_suspend_cache_invalidation) )
5682
+	if ( ! empty($_wp_suspend_cache_invalidation))
5683 5683
 		return;
5684 5684
 
5685 5685
 	$id = (int) $id;
@@ -5687,7 +5687,7 @@  discard block
 block discarded – undo
5687 5687
 	wp_cache_delete($id, 'posts');
5688 5688
 	wp_cache_delete($id, 'post_meta');
5689 5689
 
5690
-	if ( $clean_terms )
5690
+	if ($clean_terms)
5691 5691
 		clean_object_term_cache($id, 'attachment');
5692 5692
 
5693 5693
 	/**
@@ -5697,7 +5697,7 @@  discard block
 block discarded – undo
5697 5697
 	 *
5698 5698
 	 * @param int $id Attachment ID.
5699 5699
 	 */
5700
-	do_action( 'clean_attachment_cache', $id );
5700
+	do_action('clean_attachment_cache', $id);
5701 5701
 }
5702 5702
 
5703 5703
 //
@@ -5717,13 +5717,13 @@  discard block
 block discarded – undo
5717 5717
  * @param string  $old_status Previous post status.
5718 5718
  * @param WP_Post $post       Post object.
5719 5719
  */
5720
-function _transition_post_status( $new_status, $old_status, $post ) {
5720
+function _transition_post_status($new_status, $old_status, $post) {
5721 5721
 	global $wpdb;
5722 5722
 
5723
-	if ( $old_status != 'publish' && $new_status == 'publish' ) {
5723
+	if ($old_status != 'publish' && $new_status == 'publish') {
5724 5724
 		// Reset GUID if transitioning to publish and it is empty.
5725
-		if ( '' == get_the_guid($post->ID) )
5726
-			$wpdb->update( $wpdb->posts, array( 'guid' => get_permalink( $post->ID ) ), array( 'ID' => $post->ID ) );
5725
+		if ('' == get_the_guid($post->ID))
5726
+			$wpdb->update($wpdb->posts, array('guid' => get_permalink($post->ID)), array('ID' => $post->ID));
5727 5727
 
5728 5728
 		/**
5729 5729
 		 * Fires when a post's status is transitioned from private to published.
@@ -5737,21 +5737,21 @@  discard block
 block discarded – undo
5737 5737
 	}
5738 5738
 
5739 5739
 	// If published posts changed clear the lastpostmodified cache.
5740
-	if ( 'publish' == $new_status || 'publish' == $old_status) {
5741
-		foreach ( array( 'server', 'gmt', 'blog' ) as $timezone ) {
5742
-			wp_cache_delete( "lastpostmodified:$timezone", 'timeinfo' );
5743
-			wp_cache_delete( "lastpostdate:$timezone", 'timeinfo' );
5744
-			wp_cache_delete( "lastpostdate:$timezone:{$post->post_type}", 'timeinfo' );
5740
+	if ('publish' == $new_status || 'publish' == $old_status) {
5741
+		foreach (array('server', 'gmt', 'blog') as $timezone) {
5742
+			wp_cache_delete("lastpostmodified:$timezone", 'timeinfo');
5743
+			wp_cache_delete("lastpostdate:$timezone", 'timeinfo');
5744
+			wp_cache_delete("lastpostdate:$timezone:{$post->post_type}", 'timeinfo');
5745 5745
 		}
5746 5746
 	}
5747 5747
 
5748
-	if ( $new_status !== $old_status ) {
5749
-		wp_cache_delete( _count_posts_cache_key( $post->post_type ), 'counts' );
5750
-		wp_cache_delete( _count_posts_cache_key( $post->post_type, 'readable' ), 'counts' );
5748
+	if ($new_status !== $old_status) {
5749
+		wp_cache_delete(_count_posts_cache_key($post->post_type), 'counts');
5750
+		wp_cache_delete(_count_posts_cache_key($post->post_type, 'readable'), 'counts');
5751 5751
 	}
5752 5752
 
5753 5753
 	// Always clears the hook in case the post status bounced from future to draft.
5754
-	wp_clear_scheduled_hook('publish_future_post', array( $post->ID ) );
5754
+	wp_clear_scheduled_hook('publish_future_post', array($post->ID));
5755 5755
 }
5756 5756
 
5757 5757
 /**
@@ -5767,9 +5767,9 @@  discard block
 block discarded – undo
5767 5767
  *                            wp_transition_post_status() and the default filter for _future_post_hook().
5768 5768
  * @param WP_Post $post       Post object.
5769 5769
  */
5770
-function _future_post_hook( $deprecated, $post ) {
5771
-	wp_clear_scheduled_hook( 'publish_future_post', array( $post->ID ) );
5772
-	wp_schedule_single_event( strtotime( get_gmt_from_date( $post->post_date ) . ' GMT') , 'publish_future_post', array( $post->ID ) );
5770
+function _future_post_hook($deprecated, $post) {
5771
+	wp_clear_scheduled_hook('publish_future_post', array($post->ID));
5772
+	wp_schedule_single_event(strtotime(get_gmt_from_date($post->post_date).' GMT'), 'publish_future_post', array($post->ID));
5773 5773
 }
5774 5774
 
5775 5775
 /**
@@ -5782,8 +5782,8 @@  discard block
 block discarded – undo
5782 5782
  *
5783 5783
  * @param int $post_id The ID in the database table of the post being published.
5784 5784
  */
5785
-function _publish_post_hook( $post_id ) {
5786
-	if ( defined( 'XMLRPC_REQUEST' ) ) {
5785
+function _publish_post_hook($post_id) {
5786
+	if (defined('XMLRPC_REQUEST')) {
5787 5787
 		/**
5788 5788
 		 * Fires when _publish_post_hook() is called during an XML-RPC request.
5789 5789
 		 *
@@ -5791,15 +5791,15 @@  discard block
 block discarded – undo
5791 5791
 		 *
5792 5792
 		 * @param int $post_id Post ID.
5793 5793
 		 */
5794
-		do_action( 'xmlrpc_publish_post', $post_id );
5794
+		do_action('xmlrpc_publish_post', $post_id);
5795 5795
 	}
5796 5796
 
5797
-	if ( defined('WP_IMPORTING') )
5797
+	if (defined('WP_IMPORTING'))
5798 5798
 		return;
5799 5799
 
5800
-	if ( get_option('default_pingback_flag') )
5801
-		add_post_meta( $post_id, '_pingme', '1' );
5802
-	add_post_meta( $post_id, '_encloseme', '1' );
5800
+	if (get_option('default_pingback_flag'))
5801
+		add_post_meta($post_id, '_pingme', '1');
5802
+	add_post_meta($post_id, '_encloseme', '1');
5803 5803
 
5804 5804
 	wp_schedule_single_event(time(), 'do_pings');
5805 5805
 }
@@ -5813,9 +5813,9 @@  discard block
 block discarded – undo
5813 5813
  *
5814 5814
  * @return int|false Post parent ID, otherwise false.
5815 5815
  */
5816
-function wp_get_post_parent_id( $post_ID ) {
5817
-	$post = get_post( $post_ID );
5818
-	if ( !$post || is_wp_error( $post ) )
5816
+function wp_get_post_parent_id($post_ID) {
5817
+	$post = get_post($post_ID);
5818
+	if ( ! $post || is_wp_error($post))
5819 5819
 		return false;
5820 5820
 	return (int) $post->post_parent;
5821 5821
 }
@@ -5834,30 +5834,30 @@  discard block
 block discarded – undo
5834 5834
  * @param int $post_ID     ID of the post we're checking.
5835 5835
  * @return int The new post_parent for the post, 0 otherwise.
5836 5836
  */
5837
-function wp_check_post_hierarchy_for_loops( $post_parent, $post_ID ) {
5837
+function wp_check_post_hierarchy_for_loops($post_parent, $post_ID) {
5838 5838
 	// Nothing fancy here - bail.
5839
-	if ( !$post_parent )
5839
+	if ( ! $post_parent)
5840 5840
 		return 0;
5841 5841
 
5842 5842
 	// New post can't cause a loop.
5843
-	if ( empty( $post_ID ) )
5843
+	if (empty($post_ID))
5844 5844
 		return $post_parent;
5845 5845
 
5846 5846
 	// Can't be its own parent.
5847
-	if ( $post_parent == $post_ID )
5847
+	if ($post_parent == $post_ID)
5848 5848
 		return 0;
5849 5849
 
5850 5850
 	// Now look for larger loops.
5851
-	if ( !$loop = wp_find_hierarchy_loop( 'wp_get_post_parent_id', $post_ID, $post_parent ) )
5851
+	if ( ! $loop = wp_find_hierarchy_loop('wp_get_post_parent_id', $post_ID, $post_parent))
5852 5852
 		return $post_parent; // No loop
5853 5853
 
5854 5854
 	// Setting $post_parent to the given value causes a loop.
5855
-	if ( isset( $loop[$post_ID] ) )
5855
+	if (isset($loop[$post_ID]))
5856 5856
 		return 0;
5857 5857
 
5858 5858
 	// There's a loop, but it doesn't contain $post_ID. Break the loop.
5859
-	foreach ( array_keys( $loop ) as $loop_member )
5860
-		wp_update_post( array( 'ID' => $loop_member, 'post_parent' => 0 ) );
5859
+	foreach (array_keys($loop) as $loop_member)
5860
+		wp_update_post(array('ID' => $loop_member, 'post_parent' => 0));
5861 5861
 
5862 5862
 	return $post_parent;
5863 5863
 }
@@ -5871,14 +5871,14 @@  discard block
 block discarded – undo
5871 5871
  * @param int         $thumbnail_id Thumbnail to attach.
5872 5872
  * @return int|bool True on success, false on failure.
5873 5873
  */
5874
-function set_post_thumbnail( $post, $thumbnail_id ) {
5875
-	$post = get_post( $post );
5876
-	$thumbnail_id = absint( $thumbnail_id );
5877
-	if ( $post && $thumbnail_id && get_post( $thumbnail_id ) ) {
5878
-		if ( wp_get_attachment_image( $thumbnail_id, 'thumbnail' ) )
5879
-			return update_post_meta( $post->ID, '_thumbnail_id', $thumbnail_id );
5874
+function set_post_thumbnail($post, $thumbnail_id) {
5875
+	$post = get_post($post);
5876
+	$thumbnail_id = absint($thumbnail_id);
5877
+	if ($post && $thumbnail_id && get_post($thumbnail_id)) {
5878
+		if (wp_get_attachment_image($thumbnail_id, 'thumbnail'))
5879
+			return update_post_meta($post->ID, '_thumbnail_id', $thumbnail_id);
5880 5880
 		else
5881
-			return delete_post_meta( $post->ID, '_thumbnail_id' );
5881
+			return delete_post_meta($post->ID, '_thumbnail_id');
5882 5882
 	}
5883 5883
 	return false;
5884 5884
 }
@@ -5891,10 +5891,10 @@  discard block
 block discarded – undo
5891 5891
  * @param int|WP_Post $post Post ID or post object where thumbnail should be removed from.
5892 5892
  * @return bool True on success, false on failure.
5893 5893
  */
5894
-function delete_post_thumbnail( $post ) {
5895
-	$post = get_post( $post );
5896
-	if ( $post )
5897
-		return delete_post_meta( $post->ID, '_thumbnail_id' );
5894
+function delete_post_thumbnail($post) {
5895
+	$post = get_post($post);
5896
+	if ($post)
5897
+		return delete_post_meta($post->ID, '_thumbnail_id');
5898 5898
 	return false;
5899 5899
 }
5900 5900
 
@@ -5909,10 +5909,10 @@  discard block
 block discarded – undo
5909 5909
 	global $wpdb;
5910 5910
 
5911 5911
 	// Cleanup old auto-drafts more than 7 days old.
5912
-	$old_posts = $wpdb->get_col( "SELECT ID FROM $wpdb->posts WHERE post_status = 'auto-draft' AND DATE_SUB( NOW(), INTERVAL 7 DAY ) > post_date" );
5913
-	foreach ( (array) $old_posts as $delete ) {
5912
+	$old_posts = $wpdb->get_col("SELECT ID FROM $wpdb->posts WHERE post_status = 'auto-draft' AND DATE_SUB( NOW(), INTERVAL 7 DAY ) > post_date");
5913
+	foreach ((array) $old_posts as $delete) {
5914 5914
 		// Force delete.
5915
-		wp_delete_post( $delete, true );
5915
+		wp_delete_post($delete, true);
5916 5916
 	}
5917 5917
 }
5918 5918
 
@@ -5923,23 +5923,23 @@  discard block
 block discarded – undo
5923 5923
  *
5924 5924
  * @param array $posts Array of WP_Post objects.
5925 5925
  */
5926
-function wp_queue_posts_for_term_meta_lazyload( $posts ) {
5926
+function wp_queue_posts_for_term_meta_lazyload($posts) {
5927 5927
 	$post_type_taxonomies = $term_ids = array();
5928
-	foreach ( $posts as $post ) {
5929
-		if ( ! ( $post instanceof WP_Post ) ) {
5928
+	foreach ($posts as $post) {
5929
+		if ( ! ($post instanceof WP_Post)) {
5930 5930
 			continue;
5931 5931
 		}
5932 5932
 
5933
-		if ( ! isset( $post_type_taxonomies[ $post->post_type ] ) ) {
5934
-			$post_type_taxonomies[ $post->post_type ] = get_object_taxonomies( $post->post_type );
5933
+		if ( ! isset($post_type_taxonomies[$post->post_type])) {
5934
+			$post_type_taxonomies[$post->post_type] = get_object_taxonomies($post->post_type);
5935 5935
 		}
5936 5936
 
5937
-		foreach ( $post_type_taxonomies[ $post->post_type ] as $taxonomy ) {
5937
+		foreach ($post_type_taxonomies[$post->post_type] as $taxonomy) {
5938 5938
 			// Term cache should already be primed by `update_post_term_cache()`.
5939
-			$terms = get_object_term_cache( $post->ID, $taxonomy );
5940
-			if ( false !== $terms ) {
5941
-				foreach ( $terms as $term ) {
5942
-					if ( ! isset( $term_ids[ $term->term_id ] ) ) {
5939
+			$terms = get_object_term_cache($post->ID, $taxonomy);
5940
+			if (false !== $terms) {
5941
+				foreach ($terms as $term) {
5942
+					if ( ! isset($term_ids[$term->term_id])) {
5943 5943
 						$term_ids[] = $term->term_id;
5944 5944
 					}
5945 5945
 				}
@@ -5947,9 +5947,9 @@  discard block
 block discarded – undo
5947 5947
 		}
5948 5948
 	}
5949 5949
 
5950
-	if ( $term_ids ) {
5950
+	if ($term_ids) {
5951 5951
 		$lazyloader = wp_metadata_lazyloader();
5952
-		$lazyloader->queue_objects( 'term', $term_ids );
5952
+		$lazyloader->queue_objects('term', $term_ids);
5953 5953
 	}
5954 5954
 }
5955 5955
 
@@ -5966,11 +5966,11 @@  discard block
 block discarded – undo
5966 5966
  * @param string  $old_status Old post status.
5967 5967
  * @param WP_Post $post       Post object.
5968 5968
  */
5969
-function _update_term_count_on_transition_post_status( $new_status, $old_status, $post ) {
5969
+function _update_term_count_on_transition_post_status($new_status, $old_status, $post) {
5970 5970
 	// Update counts for the post's terms.
5971
-	foreach ( (array) get_object_taxonomies( $post->post_type ) as $taxonomy ) {
5972
-		$tt_ids = wp_get_object_terms( $post->ID, $taxonomy, array( 'fields' => 'tt_ids' ) );
5973
-		wp_update_term_count( $tt_ids, $taxonomy );
5971
+	foreach ((array) get_object_taxonomies($post->post_type) as $taxonomy) {
5972
+		$tt_ids = wp_get_object_terms($post->ID, $taxonomy, array('fields' => 'tt_ids'));
5973
+		wp_update_term_count($tt_ids, $taxonomy);
5974 5974
 	}
5975 5975
 }
5976 5976
 
@@ -5988,14 +5988,14 @@  discard block
 block discarded – undo
5988 5988
  * @param bool  $update_term_cache Optional. Whether to update the term cache. Default true.
5989 5989
  * @param bool  $update_meta_cache Optional. Whether to update the meta cache. Default true.
5990 5990
  */
5991
-function _prime_post_caches( $ids, $update_term_cache = true, $update_meta_cache = true ) {
5991
+function _prime_post_caches($ids, $update_term_cache = true, $update_meta_cache = true) {
5992 5992
 	global $wpdb;
5993 5993
 
5994
-	$non_cached_ids = _get_non_cached_ids( $ids, 'posts' );
5995
-	if ( !empty( $non_cached_ids ) ) {
5996
-		$fresh_posts = $wpdb->get_results( sprintf( "SELECT $wpdb->posts.* FROM $wpdb->posts WHERE ID IN (%s)", join( ",", $non_cached_ids ) ) );
5994
+	$non_cached_ids = _get_non_cached_ids($ids, 'posts');
5995
+	if ( ! empty($non_cached_ids)) {
5996
+		$fresh_posts = $wpdb->get_results(sprintf("SELECT $wpdb->posts.* FROM $wpdb->posts WHERE ID IN (%s)", join(",", $non_cached_ids)));
5997 5997
 
5998
-		update_post_caches( $fresh_posts, 'any', $update_term_cache, $update_meta_cache );
5998
+		update_post_caches($fresh_posts, 'any', $update_term_cache, $update_meta_cache);
5999 5999
 	}
6000 6000
 }
6001 6001
 
@@ -6013,18 +6013,18 @@  discard block
 block discarded – undo
6013 6013
  * @param string $post_name Slug.
6014 6014
  * @param string $post_ID   Optional. Post ID that should be ignored. Default 0.
6015 6015
  */
6016
-function wp_add_trashed_suffix_to_post_name_for_trashed_posts( $post_name, $post_ID = 0 ) {
6017
-	$trashed_posts_with_desired_slug = get_posts( array(
6016
+function wp_add_trashed_suffix_to_post_name_for_trashed_posts($post_name, $post_ID = 0) {
6017
+	$trashed_posts_with_desired_slug = get_posts(array(
6018 6018
 		'name' => $post_name,
6019 6019
 		'post_status' => 'trash',
6020 6020
 		'post_type' => 'any',
6021 6021
 		'nopaging' => true,
6022
-		'post__not_in' => array( $post_ID )
6023
-	) );
6022
+		'post__not_in' => array($post_ID)
6023
+	));
6024 6024
 
6025
-	if ( ! empty( $trashed_posts_with_desired_slug ) ) {
6026
-		foreach ( $trashed_posts_with_desired_slug as $_post ) {
6027
-			wp_add_trashed_suffix_to_post_name_for_post( $_post );
6025
+	if ( ! empty($trashed_posts_with_desired_slug)) {
6026
+		foreach ($trashed_posts_with_desired_slug as $_post) {
6027
+			wp_add_trashed_suffix_to_post_name_for_post($_post);
6028 6028
 		}
6029 6029
 	}
6030 6030
 }
@@ -6043,17 +6043,17 @@  discard block
 block discarded – undo
6043 6043
  * @param WP_Post $post The post.
6044 6044
  * @return string New slug for the post.
6045 6045
  */
6046
-function wp_add_trashed_suffix_to_post_name_for_post( $post ) {
6046
+function wp_add_trashed_suffix_to_post_name_for_post($post) {
6047 6047
 	global $wpdb;
6048 6048
 
6049
-	$post = get_post( $post );
6049
+	$post = get_post($post);
6050 6050
 
6051
-	if ( '__trashed' === substr( $post->post_name, -9 ) ) {
6051
+	if ('__trashed' === substr($post->post_name, -9)) {
6052 6052
 		return $post->post_name;
6053 6053
 	}
6054
-	add_post_meta( $post->ID, '_wp_desired_post_slug', $post->post_name );
6055
-	$post_name = _truncate_post_slug( $post->post_name, 191 ) . '__trashed';
6056
-	$wpdb->update( $wpdb->posts, array( 'post_name' => $post_name ), array( 'ID' => $post->ID ) );
6057
-	clean_post_cache( $post->ID );
6054
+	add_post_meta($post->ID, '_wp_desired_post_slug', $post->post_name);
6055
+	$post_name = _truncate_post_slug($post->post_name, 191).'__trashed';
6056
+	$wpdb->update($wpdb->posts, array('post_name' => $post_name), array('ID' => $post->ID));
6057
+	clean_post_cache($post->ID);
6058 6058
 	return $post_name;
6059 6059
 }
Please login to merge, or discard this patch.
src/wp-includes/revision.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -432,7 +432,7 @@
 block discarded – undo
432 432
  *
433 433
  * @see get_children()
434 434
  *
435
- * @param int|WP_Post $post_id Optional. Post ID or WP_Post object. Default is global `$post`.
435
+ * @param integer $post_id Optional. Post ID or WP_Post object. Default is global `$post`.
436 436
  * @param array|null  $args    Optional. Arguments for retrieving post revisions. Default null.
437 437
  * @return array An array of revisions, or an empty array if none.
438 438
  */
Please login to merge, or discard this patch.
Spacing   +151 added lines, -151 removed lines patch added patch discarded remove patch
@@ -21,19 +21,19 @@  discard block
 block discarded – undo
21 21
  * @param bool          $deprecated Not used.
22 22
  * @return array Array of fields that can be versioned.
23 23
  */
24
-function _wp_post_revision_fields( $post = array(), $deprecated = false ) {
24
+function _wp_post_revision_fields($post = array(), $deprecated = false) {
25 25
 	static $fields = null;
26 26
 
27
-	if ( ! is_array( $post ) ) {
28
-		$post = get_post( $post, ARRAY_A );
27
+	if ( ! is_array($post)) {
28
+		$post = get_post($post, ARRAY_A);
29 29
 	}
30 30
 
31
-	if ( is_null( $fields ) ) {
31
+	if (is_null($fields)) {
32 32
 		// Allow these to be versioned
33 33
 		$fields = array(
34
-			'post_title' => __( 'Title' ),
35
-			'post_content' => __( 'Content' ),
36
-			'post_excerpt' => __( 'Excerpt' ),
34
+			'post_title' => __('Title'),
35
+			'post_content' => __('Content'),
36
+			'post_excerpt' => __('Excerpt'),
37 37
 		);
38 38
 	}
39 39
 
@@ -53,11 +53,11 @@  discard block
 block discarded – undo
53 53
 	 *                      'post_content', and 'post_excerpt' by default.
54 54
 	 * @param array $post   A post array being processed for insertion as a post revision.
55 55
 	 */
56
-	$fields = apply_filters( '_wp_post_revision_fields', $fields, $post );
56
+	$fields = apply_filters('_wp_post_revision_fields', $fields, $post);
57 57
 
58 58
 	// WP uses these internally either in versioning or elsewhere - they cannot be versioned
59
-	foreach ( array( 'ID', 'post_name', 'post_parent', 'post_date', 'post_date_gmt', 'post_status', 'post_type', 'comment_count', 'post_author' ) as $protect ) {
60
-		unset( $fields[ $protect ] );
59
+	foreach (array('ID', 'post_name', 'post_parent', 'post_date', 'post_date_gmt', 'post_status', 'post_type', 'comment_count', 'post_author') as $protect) {
60
+		unset($fields[$protect]);
61 61
 	}
62 62
 
63 63
 
@@ -75,25 +75,25 @@  discard block
 block discarded – undo
75 75
  * @param bool          $autosave Optional. Is the revision an autosave? Default false.
76 76
  * @return array Post array ready to be inserted as a post revision.
77 77
  */
78
-function _wp_post_revision_data( $post = array(), $autosave = false ) {
79
-	if ( ! is_array( $post ) ) {
80
-		$post = get_post( $post, ARRAY_A );
78
+function _wp_post_revision_data($post = array(), $autosave = false) {
79
+	if ( ! is_array($post)) {
80
+		$post = get_post($post, ARRAY_A);
81 81
 	}
82 82
 
83
-	$fields = _wp_post_revision_fields( $post );
83
+	$fields = _wp_post_revision_fields($post);
84 84
 
85 85
 	$revision_data = array();
86 86
 
87
-	foreach ( array_intersect( array_keys( $post ), array_keys( $fields ) ) as $field ) {
88
-		$revision_data[ $field ] = $post[ $field ];
87
+	foreach (array_intersect(array_keys($post), array_keys($fields)) as $field) {
88
+		$revision_data[$field] = $post[$field];
89 89
 	}
90 90
 
91 91
 	$revision_data['post_parent']   = $post['ID'];
92 92
 	$revision_data['post_status']   = 'inherit';
93 93
 	$revision_data['post_type']     = 'revision';
94 94
 	$revision_data['post_name']     = $autosave ? "$post[ID]-autosave-v1" : "$post[ID]-revision-v1"; // "1" is the revisioning system version
95
-	$revision_data['post_date']     = isset( $post['post_modified'] ) ? $post['post_modified'] : '';
96
-	$revision_data['post_date_gmt'] = isset( $post['post_modified_gmt'] ) ? $post['post_modified_gmt'] : '';
95
+	$revision_data['post_date']     = isset($post['post_modified']) ? $post['post_modified'] : '';
96
+	$revision_data['post_date_gmt'] = isset($post['post_modified_gmt']) ? $post['post_modified_gmt'] : '';
97 97
 
98 98
 	return $revision_data;
99 99
 }
@@ -109,29 +109,29 @@  discard block
 block discarded – undo
109 109
  * @param int $post_id The ID of the post to save as a revision.
110 110
  * @return int|WP_Error|void Void or 0 if error, new revision ID, if success.
111 111
  */
112
-function wp_save_post_revision( $post_id ) {
113
-	if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE )
112
+function wp_save_post_revision($post_id) {
113
+	if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE)
114 114
 		return;
115 115
 
116
-	if ( ! $post = get_post( $post_id ) )
116
+	if ( ! $post = get_post($post_id))
117 117
 		return;
118 118
 
119
-	if ( ! post_type_supports( $post->post_type, 'revisions' ) )
119
+	if ( ! post_type_supports($post->post_type, 'revisions'))
120 120
 		return;
121 121
 
122
-	if ( 'auto-draft' == $post->post_status )
122
+	if ('auto-draft' == $post->post_status)
123 123
 		return;
124 124
 
125
-	if ( ! wp_revisions_enabled( $post ) )
125
+	if ( ! wp_revisions_enabled($post))
126 126
 		return;
127 127
 
128 128
 	// Compare the proposed update with the last stored revision verifying that
129 129
 	// they are different, unless a plugin tells us to always save regardless.
130 130
 	// If no previous revisions, save one
131
-	if ( $revisions = wp_get_post_revisions( $post_id ) ) {
131
+	if ($revisions = wp_get_post_revisions($post_id)) {
132 132
 		// grab the last revision, but not an autosave
133
-		foreach ( $revisions as $revision ) {
134
-			if ( false !== strpos( $revision->post_name, "{$revision->post_parent}-revision" ) ) {
133
+		foreach ($revisions as $revision) {
134
+			if (false !== strpos($revision->post_name, "{$revision->post_parent}-revision")) {
135 135
 				$last_revision = $revision;
136 136
 				break;
137 137
 			}
@@ -151,11 +151,11 @@  discard block
 block discarded – undo
151 151
 		 * @param WP_Post $post              The post object.
152 152
 		 *
153 153
 		 */
154
-		if ( isset( $last_revision ) && apply_filters( 'wp_save_post_revision_check_for_changes', $check_for_changes = true, $last_revision, $post ) ) {
154
+		if (isset($last_revision) && apply_filters('wp_save_post_revision_check_for_changes', $check_for_changes = true, $last_revision, $post)) {
155 155
 			$post_has_changed = false;
156 156
 
157
-			foreach ( array_keys( _wp_post_revision_fields( $post ) ) as $field ) {
158
-				if ( normalize_whitespace( $post->$field ) != normalize_whitespace( $last_revision->$field ) ) {
157
+			foreach (array_keys(_wp_post_revision_fields($post)) as $field) {
158
+				if (normalize_whitespace($post->$field) != normalize_whitespace($last_revision->$field)) {
159 159
 					$post_has_changed = true;
160 160
 					break;
161 161
 				}
@@ -174,38 +174,38 @@  discard block
 block discarded – undo
174 174
 			 * @param WP_Post $post             The post object.
175 175
 			 *
176 176
 			 */
177
-			$post_has_changed = (bool) apply_filters( 'wp_save_post_revision_post_has_changed', $post_has_changed, $last_revision, $post );
177
+			$post_has_changed = (bool) apply_filters('wp_save_post_revision_post_has_changed', $post_has_changed, $last_revision, $post);
178 178
 
179 179
 			//don't save revision if post unchanged
180
-			if ( ! $post_has_changed ) {
180
+			if ( ! $post_has_changed) {
181 181
 				return;
182 182
 			}
183 183
 		}
184 184
 	}
185 185
 
186
-	$return = _wp_put_post_revision( $post );
186
+	$return = _wp_put_post_revision($post);
187 187
 
188 188
 	// If a limit for the number of revisions to keep has been set,
189 189
 	// delete the oldest ones.
190
-	$revisions_to_keep = wp_revisions_to_keep( $post );
190
+	$revisions_to_keep = wp_revisions_to_keep($post);
191 191
 
192
-	if ( $revisions_to_keep < 0 )
192
+	if ($revisions_to_keep < 0)
193 193
 		return $return;
194 194
 
195
-	$revisions = wp_get_post_revisions( $post_id, array( 'order' => 'ASC' ) );
195
+	$revisions = wp_get_post_revisions($post_id, array('order' => 'ASC'));
196 196
 
197 197
 	$delete = count($revisions) - $revisions_to_keep;
198 198
 
199
-	if ( $delete < 1 )
199
+	if ($delete < 1)
200 200
 		return $return;
201 201
 
202
-	$revisions = array_slice( $revisions, 0, $delete );
202
+	$revisions = array_slice($revisions, 0, $delete);
203 203
 
204
-	for ( $i = 0; isset( $revisions[$i] ); $i++ ) {
205
-		if ( false !== strpos( $revisions[ $i ]->post_name, 'autosave' ) )
204
+	for ($i = 0; isset($revisions[$i]); $i++) {
205
+		if (false !== strpos($revisions[$i]->post_name, 'autosave'))
206 206
 			continue;
207 207
 
208
-		wp_delete_post_revision( $revisions[ $i ]->ID );
208
+		wp_delete_post_revision($revisions[$i]->ID);
209 209
 	}
210 210
 
211 211
 	return $return;
@@ -224,12 +224,12 @@  discard block
 block discarded – undo
224 224
  * @param int $user_id Optional The post author ID.
225 225
  * @return WP_Post|false The autosaved data or false on failure or when no autosave exists.
226 226
  */
227
-function wp_get_post_autosave( $post_id, $user_id = 0 ) {
228
-	$revisions = wp_get_post_revisions( $post_id, array( 'check_enabled' => false ) );
227
+function wp_get_post_autosave($post_id, $user_id = 0) {
228
+	$revisions = wp_get_post_revisions($post_id, array('check_enabled' => false));
229 229
 
230
-	foreach ( $revisions as $revision ) {
231
-		if ( false !== strpos( $revision->post_name, "{$post_id}-autosave" ) ) {
232
-			if ( $user_id && $user_id != $revision->post_author )
230
+	foreach ($revisions as $revision) {
231
+		if (false !== strpos($revision->post_name, "{$post_id}-autosave")) {
232
+			if ($user_id && $user_id != $revision->post_author)
233 233
 				continue;
234 234
 
235 235
 			return $revision;
@@ -247,8 +247,8 @@  discard block
 block discarded – undo
247 247
  * @param int|WP_Post $post Post ID or post object.
248 248
  * @return false|int False if not a revision, ID of revision's parent otherwise.
249 249
  */
250
-function wp_is_post_revision( $post ) {
251
-	if ( !$post = wp_get_post_revision( $post ) )
250
+function wp_is_post_revision($post) {
251
+	if ( ! $post = wp_get_post_revision($post))
252 252
 		return false;
253 253
 
254 254
 	return (int) $post->post_parent;
@@ -262,11 +262,11 @@  discard block
 block discarded – undo
262 262
  * @param int|WP_Post $post Post ID or post object.
263 263
  * @return false|int False if not a revision, ID of autosave's parent otherwise
264 264
  */
265
-function wp_is_post_autosave( $post ) {
266
-	if ( !$post = wp_get_post_revision( $post ) )
265
+function wp_is_post_autosave($post) {
266
+	if ( ! $post = wp_get_post_revision($post))
267 267
 		return false;
268 268
 
269
-	if ( false !== strpos( $post->post_name, "{$post->post_parent}-autosave" ) )
269
+	if (false !== strpos($post->post_name, "{$post->post_parent}-autosave"))
270 270
 		return (int) $post->post_parent;
271 271
 
272 272
 	return false;
@@ -282,26 +282,26 @@  discard block
 block discarded – undo
282 282
  * @param bool                   $autosave Optional. Is the revision an autosave?
283 283
  * @return int|WP_Error WP_Error or 0 if error, new revision ID if success.
284 284
  */
285
-function _wp_put_post_revision( $post = null, $autosave = false ) {
286
-	if ( is_object($post) )
287
-		$post = get_object_vars( $post );
288
-	elseif ( !is_array($post) )
285
+function _wp_put_post_revision($post = null, $autosave = false) {
286
+	if (is_object($post))
287
+		$post = get_object_vars($post);
288
+	elseif ( ! is_array($post))
289 289
 		$post = get_post($post, ARRAY_A);
290 290
 
291
-	if ( ! $post || empty($post['ID']) )
292
-		return new WP_Error( 'invalid_post', __( 'Invalid post ID.' ) );
291
+	if ( ! $post || empty($post['ID']))
292
+		return new WP_Error('invalid_post', __('Invalid post ID.'));
293 293
 
294
-	if ( isset($post['post_type']) && 'revision' == $post['post_type'] )
295
-		return new WP_Error( 'post_type', __( 'Cannot create a revision of a revision' ) );
294
+	if (isset($post['post_type']) && 'revision' == $post['post_type'])
295
+		return new WP_Error('post_type', __('Cannot create a revision of a revision'));
296 296
 
297
-	$post = _wp_post_revision_data( $post, $autosave );
297
+	$post = _wp_post_revision_data($post, $autosave);
298 298
 	$post = wp_slash($post); //since data is from db
299 299
 
300
-	$revision_id = wp_insert_post( $post );
301
-	if ( is_wp_error($revision_id) )
300
+	$revision_id = wp_insert_post($post);
301
+	if (is_wp_error($revision_id))
302 302
 		return $revision_id;
303 303
 
304
-	if ( $revision_id ) {
304
+	if ($revision_id) {
305 305
 		/**
306 306
 		 * Fires once a revision has been saved.
307 307
 		 *
@@ -309,7 +309,7 @@  discard block
 block discarded – undo
309 309
 		 *
310 310
 		 * @param int $revision_id Post revision ID.
311 311
 		 */
312
-		do_action( '_wp_put_post_revision', $revision_id );
312
+		do_action('_wp_put_post_revision', $revision_id);
313 313
 	}
314 314
 
315 315
 	return $revision_id;
@@ -326,17 +326,17 @@  discard block
 block discarded – undo
326 326
  * @return WP_Post|array|null Null if error or post object if success.
327 327
  */
328 328
 function wp_get_post_revision(&$post, $output = OBJECT, $filter = 'raw') {
329
-	if ( !$revision = get_post( $post, OBJECT, $filter ) )
329
+	if ( ! $revision = get_post($post, OBJECT, $filter))
330 330
 		return $revision;
331
-	if ( 'revision' !== $revision->post_type )
331
+	if ('revision' !== $revision->post_type)
332 332
 		return null;
333 333
 
334
-	if ( $output == OBJECT ) {
334
+	if ($output == OBJECT) {
335 335
 		return $revision;
336
-	} elseif ( $output == ARRAY_A ) {
336
+	} elseif ($output == ARRAY_A) {
337 337
 		$_revision = get_object_vars($revision);
338 338
 		return $_revision;
339
-	} elseif ( $output == ARRAY_N ) {
339
+	} elseif ($output == ARRAY_N) {
340 340
 		$_revision = array_values(get_object_vars($revision));
341 341
 		return $_revision;
342 342
 	}
@@ -355,31 +355,31 @@  discard block
 block discarded – undo
355 355
  * @param array       $fields      Optional. What fields to restore from. Defaults to all.
356 356
  * @return int|false|null Null if error, false if no fields to restore, (int) post ID if success.
357 357
  */
358
-function wp_restore_post_revision( $revision_id, $fields = null ) {
359
-	if ( !$revision = wp_get_post_revision( $revision_id, ARRAY_A ) )
358
+function wp_restore_post_revision($revision_id, $fields = null) {
359
+	if ( ! $revision = wp_get_post_revision($revision_id, ARRAY_A))
360 360
 		return $revision;
361 361
 
362
-	if ( !is_array( $fields ) )
363
-		$fields = array_keys( _wp_post_revision_fields( $revision ) );
362
+	if ( ! is_array($fields))
363
+		$fields = array_keys(_wp_post_revision_fields($revision));
364 364
 
365 365
 	$update = array();
366
-	foreach ( array_intersect( array_keys( $revision ), $fields ) as $field ) {
366
+	foreach (array_intersect(array_keys($revision), $fields) as $field) {
367 367
 		$update[$field] = $revision[$field];
368 368
 	}
369 369
 
370
-	if ( !$update )
370
+	if ( ! $update)
371 371
 		return false;
372 372
 
373 373
 	$update['ID'] = $revision['post_parent'];
374 374
 
375
-	$update = wp_slash( $update ); //since data is from db
375
+	$update = wp_slash($update); //since data is from db
376 376
 
377
-	$post_id = wp_update_post( $update );
378
-	if ( ! $post_id || is_wp_error( $post_id ) )
377
+	$post_id = wp_update_post($update);
378
+	if ( ! $post_id || is_wp_error($post_id))
379 379
 		return $post_id;
380 380
 
381 381
 	// Update last edit user
382
-	update_post_meta( $post_id, '_edit_last', get_current_user_id() );
382
+	update_post_meta($post_id, '_edit_last', get_current_user_id());
383 383
 
384 384
 	/**
385 385
 	 * Fires after a post revision has been restored.
@@ -389,7 +389,7 @@  discard block
 block discarded – undo
389 389
 	 * @param int $post_id     Post ID.
390 390
 	 * @param int $revision_id Post revision ID.
391 391
 	 */
392
-	do_action( 'wp_restore_post_revision', $post_id, $revision['ID'] );
392
+	do_action('wp_restore_post_revision', $post_id, $revision['ID']);
393 393
 
394 394
 	return $post_id;
395 395
 }
@@ -404,13 +404,13 @@  discard block
 block discarded – undo
404 404
  * @param int|WP_Post $revision_id Revision ID or revision object.
405 405
  * @return array|false|WP_Post|WP_Error|null Null or WP_Error if error, deleted post if success.
406 406
  */
407
-function wp_delete_post_revision( $revision_id ) {
408
-	if ( ! $revision = wp_get_post_revision( $revision_id ) ) {
407
+function wp_delete_post_revision($revision_id) {
408
+	if ( ! $revision = wp_get_post_revision($revision_id)) {
409 409
 		return $revision;
410 410
 	}
411 411
 
412
-	$delete = wp_delete_post( $revision->ID );
413
-	if ( $delete ) {
412
+	$delete = wp_delete_post($revision->ID);
413
+	if ($delete) {
414 414
 		/**
415 415
 		 * Fires once a post revision has been deleted.
416 416
 		 *
@@ -419,7 +419,7 @@  discard block
 block discarded – undo
419 419
 		 * @param int          $revision_id Post revision ID.
420 420
 		 * @param object|array $revision    Post revision object or array.
421 421
 		 */
422
-		do_action( 'wp_delete_post_revision', $revision->ID, $revision );
422
+		do_action('wp_delete_post_revision', $revision->ID, $revision);
423 423
 	}
424 424
 
425 425
 	return $delete;
@@ -436,20 +436,20 @@  discard block
 block discarded – undo
436 436
  * @param array|null  $args    Optional. Arguments for retrieving post revisions. Default null.
437 437
  * @return array An array of revisions, or an empty array if none.
438 438
  */
439
-function wp_get_post_revisions( $post_id = 0, $args = null ) {
440
-	$post = get_post( $post_id );
441
-	if ( ! $post || empty( $post->ID ) )
439
+function wp_get_post_revisions($post_id = 0, $args = null) {
440
+	$post = get_post($post_id);
441
+	if ( ! $post || empty($post->ID))
442 442
 		return array();
443 443
 
444
-	$defaults = array( 'order' => 'DESC', 'orderby' => 'date ID', 'check_enabled' => true );
445
-	$args = wp_parse_args( $args, $defaults );
444
+	$defaults = array('order' => 'DESC', 'orderby' => 'date ID', 'check_enabled' => true);
445
+	$args = wp_parse_args($args, $defaults);
446 446
 
447
-	if ( $args['check_enabled'] && ! wp_revisions_enabled( $post ) )
447
+	if ($args['check_enabled'] && ! wp_revisions_enabled($post))
448 448
 		return array();
449 449
 
450
-	$args = array_merge( $args, array( 'post_parent' => $post->ID, 'post_type' => 'revision', 'post_status' => 'inherit' ) );
450
+	$args = array_merge($args, array('post_parent' => $post->ID, 'post_type' => 'revision', 'post_status' => 'inherit'));
451 451
 
452
-	if ( ! $revisions = get_children( $args ) )
452
+	if ( ! $revisions = get_children($args))
453 453
 		return array();
454 454
 
455 455
 	return $revisions;
@@ -463,8 +463,8 @@  discard block
 block discarded – undo
463 463
  * @param WP_Post $post The post object.
464 464
  * @return bool True if number of revisions to keep isn't zero, false otherwise.
465 465
  */
466
-function wp_revisions_enabled( $post ) {
467
-	return wp_revisions_to_keep( $post ) !== 0;
466
+function wp_revisions_enabled($post) {
467
+	return wp_revisions_to_keep($post) !== 0;
468 468
 }
469 469
 
470 470
 /**
@@ -480,15 +480,15 @@  discard block
 block discarded – undo
480 480
  * @param WP_Post $post The post object.
481 481
  * @return int The number of revisions to keep.
482 482
  */
483
-function wp_revisions_to_keep( $post ) {
483
+function wp_revisions_to_keep($post) {
484 484
 	$num = WP_POST_REVISIONS;
485 485
 
486
-	if ( true === $num )
486
+	if (true === $num)
487 487
 		$num = -1;
488 488
 	else
489
-		$num = intval( $num );
489
+		$num = intval($num);
490 490
 
491
-	if ( ! post_type_supports( $post->post_type, 'revisions' ) )
491
+	if ( ! post_type_supports($post->post_type, 'revisions'))
492 492
 		$num = 0;
493 493
 
494 494
 	/**
@@ -501,7 +501,7 @@  discard block
 block discarded – undo
501 501
 	 * @param int     $num  Number of revisions to store.
502 502
 	 * @param WP_Post $post Post object.
503 503
 	 */
504
-	return (int) apply_filters( 'wp_revisions_to_keep', $num, $post );
504
+	return (int) apply_filters('wp_revisions_to_keep', $num, $post);
505 505
 }
506 506
 
507 507
 /**
@@ -513,24 +513,24 @@  discard block
 block discarded – undo
513 513
  * @param WP_Post $post
514 514
  * @return WP_Post|false
515 515
  */
516
-function _set_preview( $post ) {
517
-	if ( ! is_object( $post ) ) {
516
+function _set_preview($post) {
517
+	if ( ! is_object($post)) {
518 518
 		return $post;
519 519
 	}
520 520
 
521
-	$preview = wp_get_post_autosave( $post->ID );
522
-	if ( ! is_object( $preview ) ) {
521
+	$preview = wp_get_post_autosave($post->ID);
522
+	if ( ! is_object($preview)) {
523 523
 		return $post;
524 524
 	}
525 525
 
526
-	$preview = sanitize_post( $preview );
526
+	$preview = sanitize_post($preview);
527 527
 
528 528
 	$post->post_content = $preview->post_content;
529 529
 	$post->post_title = $preview->post_title;
530 530
 	$post->post_excerpt = $preview->post_excerpt;
531 531
 
532
-	add_filter( 'get_the_terms', '_wp_preview_terms_filter', 10, 3 );
533
-	add_filter( 'get_post_metadata', '_wp_preview_post_thumbnail_filter', 10, 3 );
532
+	add_filter('get_the_terms', '_wp_preview_terms_filter', 10, 3);
533
+	add_filter('get_post_metadata', '_wp_preview_post_thumbnail_filter', 10, 3);
534 534
 
535 535
 	return $post;
536 536
 }
@@ -542,11 +542,11 @@  discard block
 block discarded – undo
542 542
  * @access private
543 543
  */
544 544
 function _show_post_preview() {
545
-	if ( isset($_GET['preview_id']) && isset($_GET['preview_nonce']) ) {
545
+	if (isset($_GET['preview_id']) && isset($_GET['preview_nonce'])) {
546 546
 		$id = (int) $_GET['preview_id'];
547 547
 
548
-		if ( false === wp_verify_nonce( $_GET['preview_nonce'], 'post_preview_' . $id ) )
549
-			wp_die( __('Sorry, you are not allowed to preview drafts.') );
548
+		if (false === wp_verify_nonce($_GET['preview_nonce'], 'post_preview_'.$id))
549
+			wp_die(__('Sorry, you are not allowed to preview drafts.'));
550 550
 
551 551
 		add_filter('the_preview', '_set_preview');
552 552
 	}
@@ -563,17 +563,17 @@  discard block
 block discarded – undo
563 563
  * @param string $taxonomy
564 564
  * @return array
565 565
  */
566
-function _wp_preview_terms_filter( $terms, $post_id, $taxonomy ) {
567
-	if ( ! $post = get_post() )
566
+function _wp_preview_terms_filter($terms, $post_id, $taxonomy) {
567
+	if ( ! $post = get_post())
568 568
 		return $terms;
569 569
 
570
-	if ( empty( $_REQUEST['post_format'] ) || $post->ID != $post_id || 'post_format' != $taxonomy || 'revision' == $post->post_type )
570
+	if (empty($_REQUEST['post_format']) || $post->ID != $post_id || 'post_format' != $taxonomy || 'revision' == $post->post_type)
571 571
 		return $terms;
572 572
 
573
-	if ( 'standard' == $_REQUEST['post_format'] )
573
+	if ('standard' == $_REQUEST['post_format'])
574 574
 		$terms = array();
575
-	elseif ( $term = get_term_by( 'slug', 'post-format-' . sanitize_key( $_REQUEST['post_format'] ), 'post_format' ) )
576
-		$terms = array( $term ); // Can only have one post format
575
+	elseif ($term = get_term_by('slug', 'post-format-'.sanitize_key($_REQUEST['post_format']), 'post_format'))
576
+		$terms = array($term); // Can only have one post format
577 577
 
578 578
 	return $terms;
579 579
 }
@@ -589,21 +589,21 @@  discard block
 block discarded – undo
589 589
  * @param string            $meta_key Meta key.
590 590
  * @return null|array The default return value or the post thumbnail meta array.
591 591
  */
592
-function _wp_preview_post_thumbnail_filter( $value, $post_id, $meta_key ) {
593
-	if ( ! $post = get_post() ) {
592
+function _wp_preview_post_thumbnail_filter($value, $post_id, $meta_key) {
593
+	if ( ! $post = get_post()) {
594 594
 		return $value;
595 595
 	}
596 596
 
597
-	if ( empty( $_REQUEST['_thumbnail_id'] ) || $post->ID != $post_id || '_thumbnail_id' != $meta_key || 'revision' == $post->post_type ) {
597
+	if (empty($_REQUEST['_thumbnail_id']) || $post->ID != $post_id || '_thumbnail_id' != $meta_key || 'revision' == $post->post_type) {
598 598
 		return $value;
599 599
 	}
600 600
 
601
-	$thumbnail_id = intval( $_REQUEST['_thumbnail_id'] );
602
-	if ( $thumbnail_id <= 0 ) {
601
+	$thumbnail_id = intval($_REQUEST['_thumbnail_id']);
602
+	if ($thumbnail_id <= 0) {
603 603
 		return '';
604 604
 	}
605 605
 
606
-	return strval( $thumbnail_id );
606
+	return strval($thumbnail_id);
607 607
 }
608 608
 
609 609
 /**
@@ -615,13 +615,13 @@  discard block
 block discarded – undo
615 615
  * @param WP_Post $revision
616 616
  * @return int|false
617 617
  */
618
-function _wp_get_post_revision_version( $revision ) {
619
-	if ( is_object( $revision ) )
620
-		$revision = get_object_vars( $revision );
621
-	elseif ( !is_array( $revision ) )
618
+function _wp_get_post_revision_version($revision) {
619
+	if (is_object($revision))
620
+		$revision = get_object_vars($revision);
621
+	elseif ( ! is_array($revision))
622 622
 		return false;
623 623
 
624
-	if ( preg_match( '/^\d+-(?:autosave|revision)-v(\d+)$/', $revision['post_name'], $matches ) )
624
+	if (preg_match('/^\d+-(?:autosave|revision)-v(\d+)$/', $revision['post_name'], $matches))
625 625
 		return (int) $matches[1];
626 626
 
627 627
 	return 0;
@@ -639,23 +639,23 @@  discard block
 block discarded – undo
639 639
  * @param array   $revisions Current revisions of the post
640 640
  * @return bool true if the revisions were upgraded, false if problems
641 641
  */
642
-function _wp_upgrade_revisions_of_post( $post, $revisions ) {
642
+function _wp_upgrade_revisions_of_post($post, $revisions) {
643 643
 	global $wpdb;
644 644
 
645 645
 	// Add post option exclusively
646 646
 	$lock = "revision-upgrade-{$post->ID}";
647 647
 	$now = time();
648
-	$result = $wpdb->query( $wpdb->prepare( "INSERT IGNORE INTO `$wpdb->options` (`option_name`, `option_value`, `autoload`) VALUES (%s, %s, 'no') /* LOCK */", $lock, $now ) );
649
-	if ( ! $result ) {
648
+	$result = $wpdb->query($wpdb->prepare("INSERT IGNORE INTO `$wpdb->options` (`option_name`, `option_value`, `autoload`) VALUES (%s, %s, 'no') /* LOCK */", $lock, $now));
649
+	if ( ! $result) {
650 650
 		// If we couldn't get a lock, see how old the previous lock is
651
-		$locked = get_option( $lock );
652
-		if ( ! $locked ) {
651
+		$locked = get_option($lock);
652
+		if ( ! $locked) {
653 653
 			// Can't write to the lock, and can't read the lock.
654 654
 			// Something broken has happened
655 655
 			return false;
656 656
 		}
657 657
 
658
-		if ( $locked > $now - 3600 ) {
658
+		if ($locked > $now - 3600) {
659 659
 			// Lock is not too old: some other process may be upgrading this post.  Bail.
660 660
 			return false;
661 661
 		}
@@ -664,57 +664,57 @@  discard block
 block discarded – undo
664 664
 	}
665 665
 
666 666
 	// If we could get a lock, re-"add" the option to fire all the correct filters.
667
-	update_option( $lock, $now );
667
+	update_option($lock, $now);
668 668
 
669
-	reset( $revisions );
669
+	reset($revisions);
670 670
 	$add_last = true;
671 671
 
672 672
 	do {
673
-		$this_revision = current( $revisions );
674
-		$prev_revision = next( $revisions );
673
+		$this_revision = current($revisions);
674
+		$prev_revision = next($revisions);
675 675
 
676
-		$this_revision_version = _wp_get_post_revision_version( $this_revision );
676
+		$this_revision_version = _wp_get_post_revision_version($this_revision);
677 677
 
678 678
 		// Something terrible happened
679
-		if ( false === $this_revision_version )
679
+		if (false === $this_revision_version)
680 680
 			continue;
681 681
 
682 682
 		// 1 is the latest revision version, so we're already up to date.
683 683
 		// No need to add a copy of the post as latest revision.
684
-		if ( 0 < $this_revision_version ) {
684
+		if (0 < $this_revision_version) {
685 685
 			$add_last = false;
686 686
 			continue;
687 687
 		}
688 688
 
689 689
 		// Always update the revision version
690 690
 		$update = array(
691
-			'post_name' => preg_replace( '/^(\d+-(?:autosave|revision))[\d-]*$/', '$1-v1', $this_revision->post_name ),
691
+			'post_name' => preg_replace('/^(\d+-(?:autosave|revision))[\d-]*$/', '$1-v1', $this_revision->post_name),
692 692
 		);
693 693
 
694 694
 		// If this revision is the oldest revision of the post, i.e. no $prev_revision,
695 695
 		// the correct post_author is probably $post->post_author, but that's only a good guess.
696 696
 		// Update the revision version only and Leave the author as-is.
697
-		if ( $prev_revision ) {
698
-			$prev_revision_version = _wp_get_post_revision_version( $prev_revision );
697
+		if ($prev_revision) {
698
+			$prev_revision_version = _wp_get_post_revision_version($prev_revision);
699 699
 
700 700
 			// If the previous revision is already up to date, it no longer has the information we need :(
701
-			if ( $prev_revision_version < 1 )
701
+			if ($prev_revision_version < 1)
702 702
 				$update['post_author'] = $prev_revision->post_author;
703 703
 		}
704 704
 
705 705
 		// Upgrade this revision
706
-		$result = $wpdb->update( $wpdb->posts, $update, array( 'ID' => $this_revision->ID ) );
706
+		$result = $wpdb->update($wpdb->posts, $update, array('ID' => $this_revision->ID));
707 707
 
708
-		if ( $result )
709
-			wp_cache_delete( $this_revision->ID, 'posts' );
708
+		if ($result)
709
+			wp_cache_delete($this_revision->ID, 'posts');
710 710
 
711
-	} while ( $prev_revision );
711
+	} while ($prev_revision);
712 712
 
713
-	delete_option( $lock );
713
+	delete_option($lock);
714 714
 
715 715
 	// Add a copy of the post as latest revision.
716
-	if ( $add_last )
717
-		wp_save_post_revision( $post->ID );
716
+	if ($add_last)
717
+		wp_save_post_revision($post->ID);
718 718
 
719 719
 	return true;
720 720
 }
Please login to merge, or discard this patch.
Braces   +120 added lines, -82 removed lines patch added patch discarded remove patch
@@ -110,20 +110,25 @@  discard block
 block discarded – undo
110 110
  * @return int|WP_Error|void Void or 0 if error, new revision ID, if success.
111 111
  */
112 112
 function wp_save_post_revision( $post_id ) {
113
-	if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE )
114
-		return;
113
+	if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {
114
+			return;
115
+	}
115 116
 
116
-	if ( ! $post = get_post( $post_id ) )
117
-		return;
117
+	if ( ! $post = get_post( $post_id ) ) {
118
+			return;
119
+	}
118 120
 
119
-	if ( ! post_type_supports( $post->post_type, 'revisions' ) )
120
-		return;
121
+	if ( ! post_type_supports( $post->post_type, 'revisions' ) ) {
122
+			return;
123
+	}
121 124
 
122
-	if ( 'auto-draft' == $post->post_status )
123
-		return;
125
+	if ( 'auto-draft' == $post->post_status ) {
126
+			return;
127
+	}
124 128
 
125
-	if ( ! wp_revisions_enabled( $post ) )
126
-		return;
129
+	if ( ! wp_revisions_enabled( $post ) ) {
130
+			return;
131
+	}
127 132
 
128 133
 	// Compare the proposed update with the last stored revision verifying that
129 134
 	// they are different, unless a plugin tells us to always save regardless.
@@ -189,21 +194,24 @@  discard block
 block discarded – undo
189 194
 	// delete the oldest ones.
190 195
 	$revisions_to_keep = wp_revisions_to_keep( $post );
191 196
 
192
-	if ( $revisions_to_keep < 0 )
193
-		return $return;
197
+	if ( $revisions_to_keep < 0 ) {
198
+			return $return;
199
+	}
194 200
 
195 201
 	$revisions = wp_get_post_revisions( $post_id, array( 'order' => 'ASC' ) );
196 202
 
197 203
 	$delete = count($revisions) - $revisions_to_keep;
198 204
 
199
-	if ( $delete < 1 )
200
-		return $return;
205
+	if ( $delete < 1 ) {
206
+			return $return;
207
+	}
201 208
 
202 209
 	$revisions = array_slice( $revisions, 0, $delete );
203 210
 
204 211
 	for ( $i = 0; isset( $revisions[$i] ); $i++ ) {
205
-		if ( false !== strpos( $revisions[ $i ]->post_name, 'autosave' ) )
206
-			continue;
212
+		if ( false !== strpos( $revisions[ $i ]->post_name, 'autosave' ) ) {
213
+					continue;
214
+		}
207 215
 
208 216
 		wp_delete_post_revision( $revisions[ $i ]->ID );
209 217
 	}
@@ -229,8 +237,9 @@  discard block
 block discarded – undo
229 237
 
230 238
 	foreach ( $revisions as $revision ) {
231 239
 		if ( false !== strpos( $revision->post_name, "{$post_id}-autosave" ) ) {
232
-			if ( $user_id && $user_id != $revision->post_author )
233
-				continue;
240
+			if ( $user_id && $user_id != $revision->post_author ) {
241
+							continue;
242
+			}
234 243
 
235 244
 			return $revision;
236 245
 		}
@@ -248,8 +257,9 @@  discard block
 block discarded – undo
248 257
  * @return false|int False if not a revision, ID of revision's parent otherwise.
249 258
  */
250 259
 function wp_is_post_revision( $post ) {
251
-	if ( !$post = wp_get_post_revision( $post ) )
252
-		return false;
260
+	if ( !$post = wp_get_post_revision( $post ) ) {
261
+			return false;
262
+	}
253 263
 
254 264
 	return (int) $post->post_parent;
255 265
 }
@@ -263,11 +273,13 @@  discard block
 block discarded – undo
263 273
  * @return false|int False if not a revision, ID of autosave's parent otherwise
264 274
  */
265 275
 function wp_is_post_autosave( $post ) {
266
-	if ( !$post = wp_get_post_revision( $post ) )
267
-		return false;
276
+	if ( !$post = wp_get_post_revision( $post ) ) {
277
+			return false;
278
+	}
268 279
 
269
-	if ( false !== strpos( $post->post_name, "{$post->post_parent}-autosave" ) )
270
-		return (int) $post->post_parent;
280
+	if ( false !== strpos( $post->post_name, "{$post->post_parent}-autosave" ) ) {
281
+			return (int) $post->post_parent;
282
+	}
271 283
 
272 284
 	return false;
273 285
 }
@@ -283,23 +295,27 @@  discard block
 block discarded – undo
283 295
  * @return int|WP_Error WP_Error or 0 if error, new revision ID if success.
284 296
  */
285 297
 function _wp_put_post_revision( $post = null, $autosave = false ) {
286
-	if ( is_object($post) )
287
-		$post = get_object_vars( $post );
288
-	elseif ( !is_array($post) )
289
-		$post = get_post($post, ARRAY_A);
298
+	if ( is_object($post) ) {
299
+			$post = get_object_vars( $post );
300
+	} elseif ( !is_array($post) ) {
301
+			$post = get_post($post, ARRAY_A);
302
+	}
290 303
 
291
-	if ( ! $post || empty($post['ID']) )
292
-		return new WP_Error( 'invalid_post', __( 'Invalid post ID.' ) );
304
+	if ( ! $post || empty($post['ID']) ) {
305
+			return new WP_Error( 'invalid_post', __( 'Invalid post ID.' ) );
306
+	}
293 307
 
294
-	if ( isset($post['post_type']) && 'revision' == $post['post_type'] )
295
-		return new WP_Error( 'post_type', __( 'Cannot create a revision of a revision' ) );
308
+	if ( isset($post['post_type']) && 'revision' == $post['post_type'] ) {
309
+			return new WP_Error( 'post_type', __( 'Cannot create a revision of a revision' ) );
310
+	}
296 311
 
297 312
 	$post = _wp_post_revision_data( $post, $autosave );
298 313
 	$post = wp_slash($post); //since data is from db
299 314
 
300 315
 	$revision_id = wp_insert_post( $post );
301
-	if ( is_wp_error($revision_id) )
302
-		return $revision_id;
316
+	if ( is_wp_error($revision_id) ) {
317
+			return $revision_id;
318
+	}
303 319
 
304 320
 	if ( $revision_id ) {
305 321
 		/**
@@ -326,10 +342,12 @@  discard block
 block discarded – undo
326 342
  * @return WP_Post|array|null Null if error or post object if success.
327 343
  */
328 344
 function wp_get_post_revision(&$post, $output = OBJECT, $filter = 'raw') {
329
-	if ( !$revision = get_post( $post, OBJECT, $filter ) )
330
-		return $revision;
331
-	if ( 'revision' !== $revision->post_type )
332
-		return null;
345
+	if ( !$revision = get_post( $post, OBJECT, $filter ) ) {
346
+			return $revision;
347
+	}
348
+	if ( 'revision' !== $revision->post_type ) {
349
+			return null;
350
+	}
333 351
 
334 352
 	if ( $output == OBJECT ) {
335 353
 		return $revision;
@@ -356,27 +374,31 @@  discard block
 block discarded – undo
356 374
  * @return int|false|null Null if error, false if no fields to restore, (int) post ID if success.
357 375
  */
358 376
 function wp_restore_post_revision( $revision_id, $fields = null ) {
359
-	if ( !$revision = wp_get_post_revision( $revision_id, ARRAY_A ) )
360
-		return $revision;
377
+	if ( !$revision = wp_get_post_revision( $revision_id, ARRAY_A ) ) {
378
+			return $revision;
379
+	}
361 380
 
362
-	if ( !is_array( $fields ) )
363
-		$fields = array_keys( _wp_post_revision_fields( $revision ) );
381
+	if ( !is_array( $fields ) ) {
382
+			$fields = array_keys( _wp_post_revision_fields( $revision ) );
383
+	}
364 384
 
365 385
 	$update = array();
366 386
 	foreach ( array_intersect( array_keys( $revision ), $fields ) as $field ) {
367 387
 		$update[$field] = $revision[$field];
368 388
 	}
369 389
 
370
-	if ( !$update )
371
-		return false;
390
+	if ( !$update ) {
391
+			return false;
392
+	}
372 393
 
373 394
 	$update['ID'] = $revision['post_parent'];
374 395
 
375 396
 	$update = wp_slash( $update ); //since data is from db
376 397
 
377 398
 	$post_id = wp_update_post( $update );
378
-	if ( ! $post_id || is_wp_error( $post_id ) )
379
-		return $post_id;
399
+	if ( ! $post_id || is_wp_error( $post_id ) ) {
400
+			return $post_id;
401
+	}
380 402
 
381 403
 	// Update last edit user
382 404
 	update_post_meta( $post_id, '_edit_last', get_current_user_id() );
@@ -438,19 +460,22 @@  discard block
 block discarded – undo
438 460
  */
439 461
 function wp_get_post_revisions( $post_id = 0, $args = null ) {
440 462
 	$post = get_post( $post_id );
441
-	if ( ! $post || empty( $post->ID ) )
442
-		return array();
463
+	if ( ! $post || empty( $post->ID ) ) {
464
+			return array();
465
+	}
443 466
 
444 467
 	$defaults = array( 'order' => 'DESC', 'orderby' => 'date ID', 'check_enabled' => true );
445 468
 	$args = wp_parse_args( $args, $defaults );
446 469
 
447
-	if ( $args['check_enabled'] && ! wp_revisions_enabled( $post ) )
448
-		return array();
470
+	if ( $args['check_enabled'] && ! wp_revisions_enabled( $post ) ) {
471
+			return array();
472
+	}
449 473
 
450 474
 	$args = array_merge( $args, array( 'post_parent' => $post->ID, 'post_type' => 'revision', 'post_status' => 'inherit' ) );
451 475
 
452
-	if ( ! $revisions = get_children( $args ) )
453
-		return array();
476
+	if ( ! $revisions = get_children( $args ) ) {
477
+			return array();
478
+	}
454 479
 
455 480
 	return $revisions;
456 481
 }
@@ -483,13 +508,15 @@  discard block
 block discarded – undo
483 508
 function wp_revisions_to_keep( $post ) {
484 509
 	$num = WP_POST_REVISIONS;
485 510
 
486
-	if ( true === $num )
487
-		$num = -1;
488
-	else
489
-		$num = intval( $num );
511
+	if ( true === $num ) {
512
+			$num = -1;
513
+	} else {
514
+			$num = intval( $num );
515
+	}
490 516
 
491
-	if ( ! post_type_supports( $post->post_type, 'revisions' ) )
492
-		$num = 0;
517
+	if ( ! post_type_supports( $post->post_type, 'revisions' ) ) {
518
+			$num = 0;
519
+	}
493 520
 
494 521
 	/**
495 522
 	 * Filters the number of revisions to save for the given post.
@@ -545,8 +572,9 @@  discard block
 block discarded – undo
545 572
 	if ( isset($_GET['preview_id']) && isset($_GET['preview_nonce']) ) {
546 573
 		$id = (int) $_GET['preview_id'];
547 574
 
548
-		if ( false === wp_verify_nonce( $_GET['preview_nonce'], 'post_preview_' . $id ) )
549
-			wp_die( __('Sorry, you are not allowed to preview drafts.') );
575
+		if ( false === wp_verify_nonce( $_GET['preview_nonce'], 'post_preview_' . $id ) ) {
576
+					wp_die( __('Sorry, you are not allowed to preview drafts.') );
577
+		}
550 578
 
551 579
 		add_filter('the_preview', '_set_preview');
552 580
 	}
@@ -564,16 +592,20 @@  discard block
 block discarded – undo
564 592
  * @return array
565 593
  */
566 594
 function _wp_preview_terms_filter( $terms, $post_id, $taxonomy ) {
567
-	if ( ! $post = get_post() )
568
-		return $terms;
595
+	if ( ! $post = get_post() ) {
596
+			return $terms;
597
+	}
569 598
 
570
-	if ( empty( $_REQUEST['post_format'] ) || $post->ID != $post_id || 'post_format' != $taxonomy || 'revision' == $post->post_type )
571
-		return $terms;
599
+	if ( empty( $_REQUEST['post_format'] ) || $post->ID != $post_id || 'post_format' != $taxonomy || 'revision' == $post->post_type ) {
600
+			return $terms;
601
+	}
572 602
 
573
-	if ( 'standard' == $_REQUEST['post_format'] )
574
-		$terms = array();
575
-	elseif ( $term = get_term_by( 'slug', 'post-format-' . sanitize_key( $_REQUEST['post_format'] ), 'post_format' ) )
576
-		$terms = array( $term ); // Can only have one post format
603
+	if ( 'standard' == $_REQUEST['post_format'] ) {
604
+			$terms = array();
605
+	} elseif ( $term = get_term_by( 'slug', 'post-format-' . sanitize_key( $_REQUEST['post_format'] ), 'post_format' ) ) {
606
+			$terms = array( $term );
607
+	}
608
+	// Can only have one post format
577 609
 
578 610
 	return $terms;
579 611
 }
@@ -616,13 +648,15 @@  discard block
 block discarded – undo
616 648
  * @return int|false
617 649
  */
618 650
 function _wp_get_post_revision_version( $revision ) {
619
-	if ( is_object( $revision ) )
620
-		$revision = get_object_vars( $revision );
621
-	elseif ( !is_array( $revision ) )
622
-		return false;
651
+	if ( is_object( $revision ) ) {
652
+			$revision = get_object_vars( $revision );
653
+	} elseif ( !is_array( $revision ) ) {
654
+			return false;
655
+	}
623 656
 
624
-	if ( preg_match( '/^\d+-(?:autosave|revision)-v(\d+)$/', $revision['post_name'], $matches ) )
625
-		return (int) $matches[1];
657
+	if ( preg_match( '/^\d+-(?:autosave|revision)-v(\d+)$/', $revision['post_name'], $matches ) ) {
658
+			return (int) $matches[1];
659
+	}
626 660
 
627 661
 	return 0;
628 662
 }
@@ -676,8 +710,9 @@  discard block
 block discarded – undo
676 710
 		$this_revision_version = _wp_get_post_revision_version( $this_revision );
677 711
 
678 712
 		// Something terrible happened
679
-		if ( false === $this_revision_version )
680
-			continue;
713
+		if ( false === $this_revision_version ) {
714
+					continue;
715
+		}
681 716
 
682 717
 		// 1 is the latest revision version, so we're already up to date.
683 718
 		// No need to add a copy of the post as latest revision.
@@ -698,23 +733,26 @@  discard block
 block discarded – undo
698 733
 			$prev_revision_version = _wp_get_post_revision_version( $prev_revision );
699 734
 
700 735
 			// If the previous revision is already up to date, it no longer has the information we need :(
701
-			if ( $prev_revision_version < 1 )
702
-				$update['post_author'] = $prev_revision->post_author;
736
+			if ( $prev_revision_version < 1 ) {
737
+							$update['post_author'] = $prev_revision->post_author;
738
+			}
703 739
 		}
704 740
 
705 741
 		// Upgrade this revision
706 742
 		$result = $wpdb->update( $wpdb->posts, $update, array( 'ID' => $this_revision->ID ) );
707 743
 
708
-		if ( $result )
709
-			wp_cache_delete( $this_revision->ID, 'posts' );
744
+		if ( $result ) {
745
+					wp_cache_delete( $this_revision->ID, 'posts' );
746
+		}
710 747
 
711 748
 	} while ( $prev_revision );
712 749
 
713 750
 	delete_option( $lock );
714 751
 
715 752
 	// Add a copy of the post as latest revision.
716
-	if ( $add_last )
717
-		wp_save_post_revision( $post->ID );
753
+	if ( $add_last ) {
754
+			wp_save_post_revision( $post->ID );
755
+	}
718 756
 
719 757
 	return true;
720 758
 }
Please login to merge, or discard this patch.