Completed
Push — master ( d99bf9...491baf )
by Stephen
13:47
created
src/wp-includes/ID3/module.tag.apetag.php 2 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -331,6 +331,9 @@
 block discarded – undo
331 331
 		return true;
332 332
 	}
333 333
 
334
+	/**
335
+	 * @param string $APEheaderFooterData
336
+	 */
334 337
 	public function parseAPEheaderFooter($APEheaderFooterData) {
335 338
 		// http://www.uni-jena.de/~pfk/mpp/sv8/apeheader.html
336 339
 
Please login to merge, or discard this patch.
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
 	public function Analyze() {
23 23
 		$info = &$this->getid3->info;
24 24
 
25
-		if (!getid3_lib::intValueSupported($info['filesize'])) {
25
+		if ( ! getid3_lib::intValueSupported($info['filesize'])) {
26 26
 			$info['warning'][] = 'Unable to check for APEtags because file is larger than '.round(PHP_INT_MAX / 1073741824).'GB';
27 27
 			return false;
28 28
 		}
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
 			}
59 59
 
60 60
 		}
61
-		if (!isset($info['ape']['tag_offset_end'])) {
61
+		if ( ! isset($info['ape']['tag_offset_end'])) {
62 62
 
63 63
 			// APE tag not found
64 64
 			unset($info['ape']);
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
 
72 72
 		$this->fseek($thisfile_ape['tag_offset_end'] - $apetagheadersize);
73 73
 		$APEfooterData = $this->fread(32);
74
-		if (!($thisfile_ape['footer'] = $this->parseAPEheaderFooter($APEfooterData))) {
74
+		if ( ! ($thisfile_ape['footer'] = $this->parseAPEheaderFooter($APEfooterData))) {
75 75
 			$info['error'][] = 'Error parsing APE footer at offset '.$thisfile_ape['tag_offset_end'];
76 76
 			return false;
77 77
 		}
@@ -282,7 +282,7 @@  discard block
 block discarded – undo
282 282
 							}
283 283
 						} elseif (is_string($this->inline_attachments)) {
284 284
 							$this->inline_attachments = rtrim(str_replace(array('/', '\\'), DIRECTORY_SEPARATOR, $this->inline_attachments), DIRECTORY_SEPARATOR);
285
-							if (!is_dir($this->inline_attachments) || !is_writable($this->inline_attachments)) {
285
+							if ( ! is_dir($this->inline_attachments) || ! is_writable($this->inline_attachments)) {
286 286
 								// cannot write, skip
287 287
 								$info['warning'][] = 'attachment at '.$thisfile_ape_items_current['offset'].' cannot be saved to "'.$this->inline_attachments.'" (not writable)';
288 288
 								unset($thisfile_ape_items_current['data']);
@@ -292,7 +292,7 @@  discard block
 block discarded – undo
292 292
 						// if we get this far, must be OK
293 293
 						if (is_string($this->inline_attachments)) {
294 294
 							$destination_filename = $this->inline_attachments.DIRECTORY_SEPARATOR.md5($info['filenamepath']).'_'.$thisfile_ape_items_current['data_offset'];
295
-							if (!file_exists($destination_filename) || is_writable($destination_filename)) {
295
+							if ( ! file_exists($destination_filename) || is_writable($destination_filename)) {
296 296
 								file_put_contents($destination_filename, $thisfile_ape_items_current['data']);
297 297
 							} else {
298 298
 								$info['warning'][] = 'attachment at '.$thisfile_ape_items_current['offset'].' cannot be saved to "'.$destination_filename.'" (not writable)';
@@ -300,7 +300,7 @@  discard block
 block discarded – undo
300 300
 							$thisfile_ape_items_current['data_filename'] = $destination_filename;
301 301
 							unset($thisfile_ape_items_current['data']);
302 302
 						} else {
303
-							if (!isset($info['ape']['comments']['picture'])) {
303
+							if ( ! isset($info['ape']['comments']['picture'])) {
304 304
 								$info['ape']['comments']['picture'] = array();
305 305
 							}
306 306
 							$comments_picture_data = array();
@@ -338,17 +338,17 @@  discard block
 block discarded – undo
338 338
 		$headerfooterinfo['raw'] = array();
339 339
 		$headerfooterinfo_raw = &$headerfooterinfo['raw'];
340 340
 
341
-		$headerfooterinfo_raw['footer_tag']   =                  substr($APEheaderFooterData,  0, 8);
341
+		$headerfooterinfo_raw['footer_tag'] = substr($APEheaderFooterData, 0, 8);
342 342
 		if ($headerfooterinfo_raw['footer_tag'] != 'APETAGEX') {
343 343
 			return false;
344 344
 		}
345
-		$headerfooterinfo_raw['version']      = getid3_lib::LittleEndian2Int(substr($APEheaderFooterData,  8, 4));
345
+		$headerfooterinfo_raw['version']      = getid3_lib::LittleEndian2Int(substr($APEheaderFooterData, 8, 4));
346 346
 		$headerfooterinfo_raw['tagsize']      = getid3_lib::LittleEndian2Int(substr($APEheaderFooterData, 12, 4));
347 347
 		$headerfooterinfo_raw['tag_items']    = getid3_lib::LittleEndian2Int(substr($APEheaderFooterData, 16, 4));
348 348
 		$headerfooterinfo_raw['global_flags'] = getid3_lib::LittleEndian2Int(substr($APEheaderFooterData, 20, 4));
349
-		$headerfooterinfo_raw['reserved']     =                              substr($APEheaderFooterData, 24, 8);
349
+		$headerfooterinfo_raw['reserved']     = substr($APEheaderFooterData, 24, 8);
350 350
 
351
-		$headerfooterinfo['tag_version']         = $headerfooterinfo_raw['version'] / 1000;
351
+		$headerfooterinfo['tag_version'] = $headerfooterinfo_raw['version'] / 1000;
352 352
 		if ($headerfooterinfo['tag_version'] >= 2) {
353 353
 			$headerfooterinfo['flags'] = $this->parseAPEtagFlags($headerfooterinfo_raw['global_flags']);
354 354
 		}
@@ -362,7 +362,7 @@  discard block
 block discarded – undo
362 362
 		$flags['header']            = (bool) ($rawflagint & 0x80000000);
363 363
 		$flags['footer']            = (bool) ($rawflagint & 0x40000000);
364 364
 		$flags['this_is_header']    = (bool) ($rawflagint & 0x20000000);
365
-		$flags['item_contents_raw'] =        ($rawflagint & 0x00000006) >> 1;
365
+		$flags['item_contents_raw'] = ($rawflagint & 0x00000006) >> 1;
366 366
 		$flags['read_only']         = (bool) ($rawflagint & 0x00000001);
367 367
 
368 368
 		$flags['item_contents']     = $this->APEcontentTypeFlagLookup($flags['item_contents_raw']);
Please login to merge, or discard this patch.
src/wp-includes/ID3/module.tag.id3v2.php 3 patches
Doc Comments   +27 added lines patch added patch discarded remove patch
@@ -2596,6 +2596,9 @@  discard block
 block discarded – undo
2596 2596
 
2597 2597
 
2598 2598
 
2599
+	/**
2600
+	 * @param string $languagecode
2601
+	 */
2599 2602
 	public static function LanguageLookup($languagecode, $casesensitive=false) {
2600 2603
 
2601 2604
 		if (!$casesensitive) {
@@ -3052,6 +3055,9 @@  discard block
 block discarded – undo
3052 3055
 	}
3053 3056
 
3054 3057
 
3058
+	/**
3059
+	 * @param string $index
3060
+	 */
3055 3061
 	public static function ETCOEventLookup($index) {
3056 3062
 		if (($index >= 0x17) && ($index <= 0xDF)) {
3057 3063
 			return 'reserved for future use';
@@ -3095,6 +3101,9 @@  discard block
 block discarded – undo
3095 3101
 		return (isset($EventLookup[$index]) ? $EventLookup[$index] : '');
3096 3102
 	}
3097 3103
 
3104
+	/**
3105
+	 * @param integer $index
3106
+	 */
3098 3107
 	public static function SYTLContentTypeLookup($index) {
3099 3108
 		static $SYTLContentTypeLookup = array(
3100 3109
 			0x00 => 'other',
@@ -3111,6 +3120,9 @@  discard block
 block discarded – undo
3111 3120
 		return (isset($SYTLContentTypeLookup[$index]) ? $SYTLContentTypeLookup[$index] : '');
3112 3121
 	}
3113 3122
 
3123
+	/**
3124
+	 * @param integer $index
3125
+	 */
3114 3126
 	public static function APICPictureTypeLookup($index, $returnarray=false) {
3115 3127
 		static $APICPictureTypeLookup = array(
3116 3128
 			0x00 => 'Other',
@@ -3141,6 +3153,9 @@  discard block
 block discarded – undo
3141 3153
 		return (isset($APICPictureTypeLookup[$index]) ? $APICPictureTypeLookup[$index] : '');
3142 3154
 	}
3143 3155
 
3156
+	/**
3157
+	 * @param integer $index
3158
+	 */
3144 3159
 	public static function COMRReceivedAsLookup($index) {
3145 3160
 		static $COMRReceivedAsLookup = array(
3146 3161
 			0x00 => 'Other',
@@ -3157,6 +3172,9 @@  discard block
 block discarded – undo
3157 3172
 		return (isset($COMRReceivedAsLookup[$index]) ? $COMRReceivedAsLookup[$index] : '');
3158 3173
 	}
3159 3174
 
3175
+	/**
3176
+	 * @param integer $index
3177
+	 */
3160 3178
 	public static function RVA2ChannelTypeLookup($index) {
3161 3179
 		static $RVA2ChannelTypeLookup = array(
3162 3180
 			0x00 => 'Other',
@@ -3536,6 +3554,9 @@  discard block
 block discarded – undo
3536 3554
 		return getid3_lib::EmbeddedLookup($framename, $begin, __LINE__, __FILE__, 'id3v2-framename_short');
3537 3555
 	}
3538 3556
 
3557
+	/**
3558
+	 * @param integer $encoding
3559
+	 */
3539 3560
 	public static function TextEncodingTerminatorLookup($encoding) {
3540 3561
 		// http://www.id3.org/id3v2.4.0-structure.txt
3541 3562
 		// Frames that allow different types of text encoding contains a text encoding description byte. Possible encodings:
@@ -3562,6 +3583,9 @@  discard block
 block discarded – undo
3562 3583
 		return (isset($TextEncodingNameLookup[$encoding]) ? $TextEncodingNameLookup[$encoding] : 'ISO-8859-1');
3563 3584
 	}
3564 3585
 
3586
+	/**
3587
+	 * @param string $framename
3588
+	 */
3565 3589
 	public static function IsValidID3v2FrameName($framename, $id3v2majorversion) {
3566 3590
 		switch ($id3v2majorversion) {
3567 3591
 			case 2:
@@ -3591,6 +3615,9 @@  discard block
 block discarded – undo
3591 3615
 		return true;
3592 3616
 	}
3593 3617
 
3618
+	/**
3619
+	 * @param string $datestamp
3620
+	 */
3594 3621
 	public static function IsValidDateStampString($datestamp) {
3595 3622
 		if (strlen($datestamp) != 8) {
3596 3623
 			return false;
Please login to merge, or discard this patch.
Indentation   +9 added lines, -14 removed lines patch added patch discarded remove patch
@@ -1972,9 +1972,9 @@  discard block
 block discarded – undo
1972 1972
 			// Element ID      <text string> $00
1973 1973
 			// Start time      $xx xx xx xx
1974 1974
 			// End time        $xx xx xx xx
1975
-            // Start offset    $xx xx xx xx
1976
-            // End offset      $xx xx xx xx
1977
-            // <Optional embedded sub-frames>
1975
+			// Start offset    $xx xx xx xx
1976
+			// End offset      $xx xx xx xx
1977
+			// <Optional embedded sub-frames>
1978 1978
 
1979 1979
 			$frame_offset = 0;
1980 1980
 			@list($parsedFrame['element_id']) = explode("\x00", $parsedFrame['data'], 2);
@@ -2069,7 +2069,7 @@  discard block
 block discarded – undo
2069 2069
 			// CTOC flags        %xx
2070 2070
 			// Entry count       $xx
2071 2071
 			// Child Element ID  <string>$00   /* zero or more child CHAP or CTOC entries */
2072
-            // <Optional embedded sub-frames>
2072
+			// <Optional embedded sub-frames>
2073 2073
 
2074 2074
 			$frame_offset = 0;
2075 2075
 			@list($parsedFrame['element_id']) = explode("\x00", $parsedFrame['data'], 2);
@@ -2392,8 +2392,7 @@  discard block
 block discarded – undo
2392 2392
 			ZAR	Rand
2393 2393
 			ZMK	Kwacha
2394 2394
 			ZWD	Zimbabwe Dollars
2395
-
2396
-		*/
2395
+		 */
2397 2396
 
2398 2397
 		return getid3_lib::EmbeddedLookup($currencyid, $begin, __LINE__, __FILE__, 'id3v2-currency-units');
2399 2398
 	}
@@ -2588,8 +2587,7 @@  discard block
 block discarded – undo
2588 2587
 			ZAR	South Africa
2589 2588
 			ZMK	Zambia
2590 2589
 			ZWD	Zimbabwe
2591
-
2592
-		*/
2590
+		 */
2593 2591
 
2594 2592
 		return getid3_lib::EmbeddedLookup($currencyid, $begin, __LINE__, __FILE__, 'id3v2-currency-country');
2595 2593
 	}
@@ -3045,8 +3043,7 @@  discard block
 block discarded – undo
3045 3043
 			zho	Chinese
3046 3044
 			zul	Zulu
3047 3045
 			zun	Zuni
3048
-
3049
-		*/
3046
+		 */
3050 3047
 
3051 3048
 		return getid3_lib::EmbeddedLookup($languagecode, $begin, __LINE__, __FILE__, 'id3v2-languagecode');
3052 3049
 	}
@@ -3346,8 +3343,7 @@  discard block
 block discarded – undo
3346 3343
 			TFEA	Featured Artist
3347 3344
 			TSTU	Recording Studio
3348 3345
 			rgad	Replay Gain Adjustment
3349
-
3350
-		*/
3346
+		 */
3351 3347
 
3352 3348
 		return getid3_lib::EmbeddedLookup($framename, $begin, __LINE__, __FILE__, 'id3v2-framename_long');
3353 3349
 
@@ -3530,8 +3526,7 @@  discard block
 block discarded – undo
3530 3526
 			TFEA	featured_artist
3531 3527
 			TSTU	recording_studio
3532 3528
 			rgad	replay_gain_adjustment
3533
-
3534
-		*/
3529
+		 */
3535 3530
 
3536 3531
 		return getid3_lib::EmbeddedLookup($framename, $begin, __LINE__, __FILE__, 'id3v2-framename_short');
3537 3532
 	}
Please login to merge, or discard this patch.
Spacing   +63 added lines, -63 removed lines patch added patch discarded remove patch
@@ -48,13 +48,13 @@  discard block
 block discarded – undo
48 48
 		// shortcuts
49 49
 		$info['id3v2']['header'] = true;
50 50
 		$thisfile_id3v2                  = &$info['id3v2'];
51
-		$thisfile_id3v2['flags']         =  array();
51
+		$thisfile_id3v2['flags']         = array();
52 52
 		$thisfile_id3v2_flags            = &$thisfile_id3v2['flags'];
53 53
 
54 54
 
55 55
 		$this->fseek($this->StartingOffset);
56 56
 		$header = $this->fread(10);
57
-		if (substr($header, 0, 3) == 'ID3'  &&  strlen($header) == 10) {
57
+		if (substr($header, 0, 3) == 'ID3' && strlen($header) == 10) {
58 58
 
59 59
 			$thisfile_id3v2['majorversion'] = ord($header{3});
60 60
 			$thisfile_id3v2['minorversion'] = ord($header{4});
@@ -124,10 +124,10 @@  discard block
 block discarded – undo
124 124
 	//        Flags         $xx xx
125 125
 
126 126
 		$sizeofframes = $thisfile_id3v2['headerlength'] - 10; // not including 10-byte initial header
127
-		if (!empty($thisfile_id3v2['exthead']['length'])) {
127
+		if ( ! empty($thisfile_id3v2['exthead']['length'])) {
128 128
 			$sizeofframes -= ($thisfile_id3v2['exthead']['length'] + 4);
129 129
 		}
130
-		if (!empty($thisfile_id3v2_flags['isfooter'])) {
130
+		if ( ! empty($thisfile_id3v2_flags['isfooter'])) {
131 131
 			$sizeofframes -= 10; // footer takes last 10 bytes of ID3v2 header, after frame data, before audio
132 132
 		}
133 133
 		if ($sizeofframes > 0) {
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
 			$framedata = $this->fread($sizeofframes); // read all frames from file into $framedata variable
136 136
 
137 137
 			//    if entire frame data is unsynched, de-unsynch it now (ID3v2.3.x)
138
-			if (!empty($thisfile_id3v2_flags['unsynch']) && ($id3v2_majorversion <= 3)) {
138
+			if ( ! empty($thisfile_id3v2_flags['unsynch']) && ($id3v2_majorversion <= 3)) {
139 139
 				$framedata = $this->DeUnsynchronise($framedata);
140 140
 			}
141 141
 			//        [in ID3v2.4.0] Unsynchronisation [S:6.1] is done on frame level, instead
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
 
151 151
 
152 152
 			//    Extended Header
153
-			if (!empty($thisfile_id3v2_flags['exthead'])) {
153
+			if ( ! empty($thisfile_id3v2_flags['exthead'])) {
154 154
 				$extended_header_offset = 0;
155 155
 
156 156
 				if ($id3v2_majorversion == 3) {
@@ -272,7 +272,7 @@  discard block
 block discarded – undo
272 272
 					// Flags     $xx xx
273 273
 
274 274
 					$frame_header = substr($framedata, 0, 6); // take next 6 bytes for header
275
-					$framedata    = substr($framedata, 6);    // and leave the rest in $framedata
275
+					$framedata    = substr($framedata, 6); // and leave the rest in $framedata
276 276
 					$frame_name   = substr($frame_header, 0, 3);
277 277
 					$frame_size   = getid3_lib::BigEndian2Int(substr($frame_header, 3, 3), 0);
278 278
 					$frame_flags  = 0; // not used for anything in ID3v2.2, just set to avoid E_NOTICEs
@@ -284,7 +284,7 @@  discard block
 block discarded – undo
284 284
 					// Flags     $xx xx
285 285
 
286 286
 					$frame_header = substr($framedata, 0, 10); // take next 10 bytes for header
287
-					$framedata    = substr($framedata, 10);    // and leave the rest in $framedata
287
+					$framedata    = substr($framedata, 10); // and leave the rest in $framedata
288 288
 
289 289
 					$frame_name = substr($frame_header, 0, 4);
290 290
 					if ($id3v2_majorversion == 3) {
@@ -379,7 +379,7 @@  discard block
 block discarded – undo
379 379
 						$info['warning'][] = 'Invalid ID3v2 frame size, aborting.';
380 380
 
381 381
 					}
382
-					if (!$this->IsValidID3v2FrameName($frame_name, $id3v2_majorversion)) {
382
+					if ( ! $this->IsValidID3v2FrameName($frame_name, $id3v2_majorversion)) {
383 383
 
384 384
 						switch ($frame_name) {
385 385
 							case "\x00\x00".'MP':
@@ -397,7 +397,7 @@  discard block
 block discarded – undo
397 397
 								break;
398 398
 						}
399 399
 
400
-					} elseif (!isset($framedata) || ($frame_size > strlen($framedata))) {
400
+					} elseif ( ! isset($framedata) || ($frame_size > strlen($framedata))) {
401 401
 
402 402
 						$info['error'][] = 'error parsing "'.$frame_name.'" ('.$framedataoffset.' bytes into the ID3v2.'.$id3v2_majorversion.' tag). (ERROR: $frame_size ('.$frame_size.') > strlen($framedata) ('.(isset($framedata) ? strlen($framedata) : 'null').')).';
403 403
 
@@ -456,27 +456,27 @@  discard block
 block discarded – undo
456 456
 			}
457 457
 		}
458 458
 
459
-		if (!isset($thisfile_id3v2['comments']['year']) && !empty($thisfile_id3v2['comments']['recording_time'][0]) && preg_match('#^([0-9]{4})#', trim($thisfile_id3v2['comments']['recording_time'][0]), $matches)) {
459
+		if ( ! isset($thisfile_id3v2['comments']['year']) && ! empty($thisfile_id3v2['comments']['recording_time'][0]) && preg_match('#^([0-9]{4})#', trim($thisfile_id3v2['comments']['recording_time'][0]), $matches)) {
460 460
 			$thisfile_id3v2['comments']['year'] = array($matches[1]);
461 461
 		}
462 462
 
463 463
 
464
-		if (!empty($thisfile_id3v2['TXXX'])) {
464
+		if ( ! empty($thisfile_id3v2['TXXX'])) {
465 465
 			// MediaMonkey does this, maybe others: write a blank RGAD frame, but put replay-gain adjustment values in TXXX frames
466 466
 			foreach ($thisfile_id3v2['TXXX'] as $txxx_array) {
467 467
 				switch ($txxx_array['description']) {
468 468
 					case 'replaygain_track_gain':
469
-						if (empty($info['replay_gain']['track']['adjustment']) && !empty($txxx_array['data'])) {
469
+						if (empty($info['replay_gain']['track']['adjustment']) && ! empty($txxx_array['data'])) {
470 470
 							$info['replay_gain']['track']['adjustment'] = floatval(trim(str_replace('dB', '', $txxx_array['data'])));
471 471
 						}
472 472
 						break;
473 473
 					case 'replaygain_track_peak':
474
-						if (empty($info['replay_gain']['track']['peak']) && !empty($txxx_array['data'])) {
474
+						if (empty($info['replay_gain']['track']['peak']) && ! empty($txxx_array['data'])) {
475 475
 							$info['replay_gain']['track']['peak'] = floatval($txxx_array['data']);
476 476
 						}
477 477
 						break;
478 478
 					case 'replaygain_album_gain':
479
-						if (empty($info['replay_gain']['album']['adjustment']) && !empty($txxx_array['data'])) {
479
+						if (empty($info['replay_gain']['album']['adjustment']) && ! empty($txxx_array['data'])) {
480 480
 							$info['replay_gain']['album']['adjustment'] = floatval(trim(str_replace('dB', '', $txxx_array['data'])));
481 481
 						}
482 482
 						break;
@@ -524,7 +524,7 @@  discard block
 block discarded – undo
524 524
 		$info = &$this->getid3->info;
525 525
 		$id3v2_majorversion = $info['id3v2']['majorversion'];
526 526
 
527
-		$parsedFrame['framenamelong']  = $this->FrameNameLongLookup($parsedFrame['frame_name']);
527
+		$parsedFrame['framenamelong'] = $this->FrameNameLongLookup($parsedFrame['frame_name']);
528 528
 		if (empty($parsedFrame['framenamelong'])) {
529 529
 			unset($parsedFrame['framenamelong']);
530 530
 		}
@@ -563,14 +563,14 @@  discard block
 block discarded – undo
563 563
 
564 564
 				if ($parsedFrame['flags']['DataLengthIndicator']) {
565 565
 					$parsedFrame['data_length_indicator'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], 0, 4), 1);
566
-					$parsedFrame['data']                  =                           substr($parsedFrame['data'], 4);
566
+					$parsedFrame['data']                  = substr($parsedFrame['data'], 4);
567 567
 				}
568 568
 			}
569 569
 
570 570
 			//    Frame-level de-compression
571 571
 			if ($parsedFrame['flags']['compression']) {
572 572
 				$parsedFrame['decompressed_size'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], 0, 4));
573
-				if (!function_exists('gzuncompress')) {
573
+				if ( ! function_exists('gzuncompress')) {
574 574
 					$info['warning'][] = 'gzuncompress() support required to decompress ID3v2 frame "'.$parsedFrame['frame_name'].'"';
575 575
 				} else {
576 576
 					if ($decompresseddata = @gzuncompress(substr($parsedFrame['data'], 4))) {
@@ -584,7 +584,7 @@  discard block
 block discarded – undo
584 584
 			}
585 585
 		}
586 586
 
587
-		if (!empty($parsedFrame['flags']['DataLengthIndicator'])) {
587
+		if ( ! empty($parsedFrame['flags']['DataLengthIndicator'])) {
588 588
 			if ($parsedFrame['data_length_indicator'] != strlen($parsedFrame['data'])) {
589 589
 				$info['warning'][] = 'ID3v2 frame "'.$parsedFrame['frame_name'].'" should be '.$parsedFrame['data_length_indicator'].' bytes long according to DataLengthIndicator, but found '.strlen($parsedFrame['data']).' bytes of data';
590 590
 			}
@@ -643,9 +643,9 @@  discard block
 block discarded – undo
643 643
 
644 644
 			$parsedFrame['description'] = trim(getid3_lib::iconv_fallback($parsedFrame['encoding'], $info['id3v2']['encoding'], $frame_description));
645 645
 			$parsedFrame['data'] = substr($parsedFrame['data'], $frame_terminatorpos + strlen($frame_textencoding_terminator));
646
-			if (!empty($parsedFrame['framenameshort']) && !empty($parsedFrame['data'])) {
646
+			if ( ! empty($parsedFrame['framenameshort']) && ! empty($parsedFrame['data'])) {
647 647
 				$commentkey = ($parsedFrame['description'] ? $parsedFrame['description'] : (isset($info['id3v2']['comments'][$parsedFrame['framenameshort']]) ? count($info['id3v2']['comments'][$parsedFrame['framenameshort']]) : 0));
648
-				if (!isset($info['id3v2']['comments'][$parsedFrame['framenameshort']]) || !array_key_exists($commentkey, $info['id3v2']['comments'][$parsedFrame['framenameshort']])) {
648
+				if ( ! isset($info['id3v2']['comments'][$parsedFrame['framenameshort']]) || ! array_key_exists($commentkey, $info['id3v2']['comments'][$parsedFrame['framenameshort']])) {
649 649
 					$info['id3v2']['comments'][$parsedFrame['framenameshort']][$commentkey] = trim(getid3_lib::iconv_fallback($parsedFrame['encoding'], $info['id3v2']['encoding'], $parsedFrame['data']));
650 650
 				} else {
651 651
 					$info['id3v2']['comments'][$parsedFrame['framenameshort']][]            = trim(getid3_lib::iconv_fallback($parsedFrame['encoding'], $info['id3v2']['encoding'], $parsedFrame['data']));
@@ -672,7 +672,7 @@  discard block
 block discarded – undo
672 672
 			$parsedFrame['encodingid'] = $frame_textencoding;
673 673
 			$parsedFrame['encoding']   = $this->TextEncodingNameLookup($frame_textencoding);
674 674
 
675
-			if (!empty($parsedFrame['framenameshort']) && !empty($parsedFrame['data'])) {
675
+			if ( ! empty($parsedFrame['framenameshort']) && ! empty($parsedFrame['data'])) {
676 676
 				// ID3v2.3 specs say that TPE1 (and others) can contain multiple artist values separated with /
677 677
 				// This of course breaks when an artist name contains slash character, e.g. "AC/DC"
678 678
 				// MP3tag (maybe others) implement alternative system where multiple artists are null-separated, which makes more sense
@@ -700,7 +700,7 @@  discard block
 block discarded – undo
700 700
 				$Txxx_elements[] = substr($parsedFrame['data'], $Txxx_elements_start_offset, $i - $Txxx_elements_start_offset);
701 701
 				foreach ($Txxx_elements as $Txxx_element) {
702 702
 					$string = getid3_lib::iconv_fallback($parsedFrame['encoding'], $info['id3v2']['encoding'], $Txxx_element);
703
-					if (!empty($string)) {
703
+					if ( ! empty($string)) {
704 704
 						$info['id3v2']['comments'][$parsedFrame['framenameshort']][] = $string;
705 705
 					}
706 706
 				}
@@ -752,7 +752,7 @@  discard block
 block discarded – undo
752 752
 
753 753
 			$parsedFrame['url']         = $frame_urldata;
754 754
 			$parsedFrame['description'] = $frame_description;
755
-			if (!empty($parsedFrame['framenameshort']) && $parsedFrame['url']) {
755
+			if ( ! empty($parsedFrame['framenameshort']) && $parsedFrame['url']) {
756 756
 				$info['id3v2']['comments'][$parsedFrame['framenameshort']][] = getid3_lib::iconv_fallback($parsedFrame['encoding'], $info['id3v2']['encoding'], $parsedFrame['url']);
757 757
 			}
758 758
 			unset($parsedFrame['data']);
@@ -766,7 +766,7 @@  discard block
 block discarded – undo
766 766
 			// URL              <text string>
767 767
 
768 768
 			$parsedFrame['url'] = trim($parsedFrame['data']);
769
-			if (!empty($parsedFrame['framenameshort']) && $parsedFrame['url']) {
769
+			if ( ! empty($parsedFrame['framenameshort']) && $parsedFrame['url']) {
770 770
 				$info['id3v2']['comments'][$parsedFrame['framenameshort']][] = $parsedFrame['url'];
771 771
 			}
772 772
 			unset($parsedFrame['data']);
@@ -847,7 +847,7 @@  discard block
 block discarded – undo
847 847
 			}
848 848
 			$parsedFrame['data'] = $IPLS_parts;
849 849
 
850
-			if (!empty($parsedFrame['framenameshort']) && !empty($parsedFrame['data'])) {
850
+			if ( ! empty($parsedFrame['framenameshort']) && ! empty($parsedFrame['data'])) {
851 851
 				$info['id3v2']['comments'][$parsedFrame['framenameshort']][] = $parsedFrame['data'];
852 852
 			}
853 853
 
@@ -858,7 +858,7 @@  discard block
 block discarded – undo
858 858
 			// <Header for 'Music CD identifier', ID: 'MCDI'>
859 859
 			// CD TOC                <binary data>
860 860
 
861
-			if (!empty($parsedFrame['framenameshort']) && !empty($parsedFrame['data'])) {
861
+			if ( ! empty($parsedFrame['framenameshort']) && ! empty($parsedFrame['data'])) {
862 862
 				$info['id3v2']['comments'][$parsedFrame['framenameshort']][] = $parsedFrame['data'];
863 863
 			}
864 864
 
@@ -983,7 +983,7 @@  discard block
 block discarded – undo
983 983
 			$parsedFrame['language']     = $frame_language;
984 984
 			$parsedFrame['languagename'] = $this->LanguageLookup($frame_language, false);
985 985
 			$parsedFrame['description']  = $frame_description;
986
-			if (!empty($parsedFrame['framenameshort']) && !empty($parsedFrame['data'])) {
986
+			if ( ! empty($parsedFrame['framenameshort']) && ! empty($parsedFrame['data'])) {
987 987
 				$info['id3v2']['comments'][$parsedFrame['framenameshort']][] = getid3_lib::iconv_fallback($parsedFrame['encoding'], $info['id3v2']['encoding'], $parsedFrame['data']);
988 988
 			}
989 989
 			unset($parsedFrame['data']);
@@ -1091,9 +1091,9 @@  discard block
 block discarded – undo
1091 1091
 				$parsedFrame['languagename'] = $this->LanguageLookup($frame_language, false);
1092 1092
 				$parsedFrame['description']  = $frame_description;
1093 1093
 				$parsedFrame['data']         = $frame_text;
1094
-				if (!empty($parsedFrame['framenameshort']) && !empty($parsedFrame['data'])) {
1095
-					$commentkey = ($parsedFrame['description'] ? $parsedFrame['description'] : (!empty($info['id3v2']['comments'][$parsedFrame['framenameshort']]) ? count($info['id3v2']['comments'][$parsedFrame['framenameshort']]) : 0));
1096
-					if (!isset($info['id3v2']['comments'][$parsedFrame['framenameshort']]) || !array_key_exists($commentkey, $info['id3v2']['comments'][$parsedFrame['framenameshort']])) {
1094
+				if ( ! empty($parsedFrame['framenameshort']) && ! empty($parsedFrame['data'])) {
1095
+					$commentkey = ($parsedFrame['description'] ? $parsedFrame['description'] : ( ! empty($info['id3v2']['comments'][$parsedFrame['framenameshort']]) ? count($info['id3v2']['comments'][$parsedFrame['framenameshort']]) : 0));
1096
+					if ( ! isset($info['id3v2']['comments'][$parsedFrame['framenameshort']]) || ! array_key_exists($commentkey, $info['id3v2']['comments'][$parsedFrame['framenameshort']])) {
1097 1097
 						$info['id3v2']['comments'][$parsedFrame['framenameshort']][$commentkey] = getid3_lib::iconv_fallback($parsedFrame['encoding'], $info['id3v2']['encoding'], $parsedFrame['data']);
1098 1098
 					} else {
1099 1099
 						$info['id3v2']['comments'][$parsedFrame['framenameshort']][]            = getid3_lib::iconv_fallback($parsedFrame['encoding'], $info['id3v2']['encoding'], $parsedFrame['data']);
@@ -1136,7 +1136,7 @@  discard block
 block discarded – undo
1136 1136
 					break;
1137 1137
 				}
1138 1138
 				$frame_bytespeakvolume = ceil($parsedFrame[$RVA2channelcounter]['bitspeakvolume'] / 8);
1139
-				$parsedFrame[$RVA2channelcounter]['peakvolume']     = getid3_lib::BigEndian2Int(substr($frame_remainingdata, $frame_offset, $frame_bytespeakvolume));
1139
+				$parsedFrame[$RVA2channelcounter]['peakvolume'] = getid3_lib::BigEndian2Int(substr($frame_remainingdata, $frame_offset, $frame_bytespeakvolume));
1140 1140
 				$frame_remainingdata = substr($frame_remainingdata, $frame_offset + $frame_bytespeakvolume);
1141 1141
 				$RVA2channelcounter++;
1142 1142
 			}
@@ -1404,7 +1404,7 @@  discard block
 block discarded – undo
1404 1404
 				$imageinfo = array();
1405 1405
 				$imagechunkcheck = getid3_lib::GetDataImageSize($parsedFrame['data'], $imageinfo);
1406 1406
 				if (($imagechunkcheck[2] >= 1) && ($imagechunkcheck[2] <= 3)) {
1407
-					$parsedFrame['image_mime']       = 'image/'.getid3_lib::ImageTypesLookup($imagechunkcheck[2]);
1407
+					$parsedFrame['image_mime'] = 'image/'.getid3_lib::ImageTypesLookup($imagechunkcheck[2]);
1408 1408
 					if ($imagechunkcheck[0]) {
1409 1409
 						$parsedFrame['image_width']  = $imagechunkcheck[0];
1410 1410
 					}
@@ -1432,7 +1432,7 @@  discard block
 block discarded – undo
1432 1432
 */
1433 1433
 					} elseif (is_string($this->getid3->option_save_attachments)) {
1434 1434
 						$dir = rtrim(str_replace(array('/', '\\'), DIRECTORY_SEPARATOR, $this->getid3->option_save_attachments), DIRECTORY_SEPARATOR);
1435
-						if (!is_dir($dir) || !is_writable($dir)) {
1435
+						if ( ! is_dir($dir) || ! is_writable($dir)) {
1436 1436
 							// cannot write, skip
1437 1437
 							$info['warning'][] = 'attachment at '.$frame_offset.' cannot be saved to "'.$dir.'" (not writable)';
1438 1438
 							unset($parsedFrame['data']);
@@ -1442,7 +1442,7 @@  discard block
 block discarded – undo
1442 1442
 					// if we get this far, must be OK
1443 1443
 					if (is_string($this->getid3->option_save_attachments)) {
1444 1444
 						$destination_filename = $dir.DIRECTORY_SEPARATOR.md5($info['filenamepath']).'_'.$frame_offset;
1445
-						if (!file_exists($destination_filename) || is_writable($destination_filename)) {
1445
+						if ( ! file_exists($destination_filename) || is_writable($destination_filename)) {
1446 1446
 							file_put_contents($destination_filename, $parsedFrame['data']);
1447 1447
 						} else {
1448 1448
 							$info['warning'][] = 'attachment at '.$frame_offset.' cannot be saved to "'.$destination_filename.'" (not writable)';
@@ -1450,8 +1450,8 @@  discard block
 block discarded – undo
1450 1450
 						$parsedFrame['data_filename'] = $destination_filename;
1451 1451
 						unset($parsedFrame['data']);
1452 1452
 					} else {
1453
-						if (!empty($parsedFrame['framenameshort']) && !empty($parsedFrame['data'])) {
1454
-							if (!isset($info['id3v2']['comments']['picture'])) {
1453
+						if ( ! empty($parsedFrame['framenameshort']) && ! empty($parsedFrame['data'])) {
1454
+							if ( ! isset($info['id3v2']['comments']['picture'])) {
1455 1455
 								$info['id3v2']['comments']['picture'] = array();
1456 1456
 							}
1457 1457
 							$comments_picture_data = array();
@@ -1530,7 +1530,7 @@  discard block
 block discarded – undo
1530 1530
 			// <Header for 'Play counter', ID: 'PCNT'>
1531 1531
 			// Counter        $xx xx xx xx (xx ...)
1532 1532
 
1533
-			$parsedFrame['data']          = getid3_lib::BigEndian2Int($parsedFrame['data']);
1533
+			$parsedFrame['data'] = getid3_lib::BigEndian2Int($parsedFrame['data']);
1534 1534
 
1535 1535
 
1536 1536
 		} elseif ((($id3v2_majorversion >= 3) && ($parsedFrame['frame_name'] == 'POPM')) || // 4.17  POPM Popularimeter
@@ -1654,7 +1654,7 @@  discard block
 block discarded – undo
1654 1654
 			$parsedFrame['url'] = $frame_url;
1655 1655
 
1656 1656
 			$parsedFrame['additionaldata'] = (string) substr($parsedFrame['data'], $frame_offset);
1657
-			if (!empty($parsedFrame['framenameshort']) && $parsedFrame['url']) {
1657
+			if ( ! empty($parsedFrame['framenameshort']) && $parsedFrame['url']) {
1658 1658
 				$info['id3v2']['comments'][$parsedFrame['framenameshort']][] = getid3_lib::iconv_fallback_iso88591_utf8($parsedFrame['url']);
1659 1659
 			}
1660 1660
 			unset($parsedFrame['data']);
@@ -1693,7 +1693,7 @@  discard block
 block discarded – undo
1693 1693
 			$parsedFrame['encoding']     = $this->TextEncodingNameLookup($frame_textencoding);
1694 1694
 
1695 1695
 			$parsedFrame['data']         = (string) substr($parsedFrame['data'], $frame_offset);
1696
-			if (!empty($parsedFrame['framenameshort']) && !empty($parsedFrame['data'])) {
1696
+			if ( ! empty($parsedFrame['framenameshort']) && ! empty($parsedFrame['data'])) {
1697 1697
 				$info['id3v2']['comments'][$parsedFrame['framenameshort']][] = getid3_lib::iconv_fallback($parsedFrame['encoding'], $info['id3v2']['encoding'], $parsedFrame['data']);
1698 1698
 			}
1699 1699
 			unset($parsedFrame['data']);
@@ -1724,8 +1724,8 @@  discard block
 block discarded – undo
1724 1724
 			$parsedFrame['pricepaid']['value']      = substr($frame_pricepaid, 3);
1725 1725
 
1726 1726
 			$parsedFrame['purchasedate'] = substr($parsedFrame['data'], $frame_offset, 8);
1727
-			if (!$this->IsValidDateStampString($parsedFrame['purchasedate'])) {
1728
-				$parsedFrame['purchasedateunix'] = mktime (0, 0, 0, substr($parsedFrame['purchasedate'], 4, 2), substr($parsedFrame['purchasedate'], 6, 2), substr($parsedFrame['purchasedate'], 0, 4));
1727
+			if ( ! $this->IsValidDateStampString($parsedFrame['purchasedate'])) {
1728
+				$parsedFrame['purchasedateunix'] = mktime(0, 0, 0, substr($parsedFrame['purchasedate'], 4, 2), substr($parsedFrame['purchasedate'], 6, 2), substr($parsedFrame['purchasedate'], 0, 4));
1729 1729
 			}
1730 1730
 			$frame_offset += 8;
1731 1731
 
@@ -1896,7 +1896,7 @@  discard block
 block discarded – undo
1896 1896
 			// Minimum offset to next tag       $xx xx xx xx
1897 1897
 
1898 1898
 			$frame_offset = 0;
1899
-			$parsedFrame['data']          = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, 4));
1899
+			$parsedFrame['data'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, 4));
1900 1900
 
1901 1901
 
1902 1902
 		} elseif (($id3v2_majorversion >= 4) && ($parsedFrame['frame_name'] == 'ASPI')) { // 4.30  ASPI Audio seek point index (ID3v2.4+ only)
@@ -1990,7 +1990,7 @@  discard block
 block discarded – undo
1990 1990
 			$frame_offset += 4;
1991 1991
 			if (substr($parsedFrame['data'], $frame_offset, 4) != "\xFF\xFF\xFF\xFF") {
1992 1992
 				// "If these bytes are all set to 0xFF then the value should be ignored and the start time value should be utilized."
1993
-				$parsedFrame['offset_end']   = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, 4));
1993
+				$parsedFrame['offset_end'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, 4));
1994 1994
 			}
1995 1995
 			$frame_offset += 4;
1996 1996
 
@@ -1999,7 +1999,7 @@  discard block
 block discarded – undo
1999 1999
 				while ($frame_offset < strlen($parsedFrame['data'])) {
2000 2000
 					// <Optional embedded sub-frames>
2001 2001
 					$subframe = array();
2002
-					$subframe['name']      =                           substr($parsedFrame['data'], $frame_offset, 4);
2002
+					$subframe['name']      = substr($parsedFrame['data'], $frame_offset, 4);
2003 2003
 					$frame_offset += 4;
2004 2004
 					$subframe['size']      = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, 4));
2005 2005
 					$frame_offset += 4;
@@ -2013,9 +2013,9 @@  discard block
 block discarded – undo
2013 2013
 					$frame_offset += $subframe['size'];
2014 2014
 
2015 2015
 					$subframe['encodingid'] = ord(substr($subframe_rawdata, 0, 1));
2016
-					$subframe['text']       =     substr($subframe_rawdata, 1);
2016
+					$subframe['text']       = substr($subframe_rawdata, 1);
2017 2017
 					$subframe['encoding']   = $this->TextEncodingNameLookup($subframe['encodingid']);
2018
-					$encoding_converted_text = trim(getid3_lib::iconv_fallback($subframe['encoding'], $info['encoding'], $subframe['text']));;
2018
+					$encoding_converted_text = trim(getid3_lib::iconv_fallback($subframe['encoding'], $info['encoding'], $subframe['text'])); ;
2019 2019
 					switch (substr($encoding_converted_text, 0, 2)) {
2020 2020
 						case "\xFF\xFE":
2021 2021
 						case "\xFE\xFF":
@@ -2055,7 +2055,7 @@  discard block
 block discarded – undo
2055 2055
 					$id3v2_chapter_entry[$id3v2_chapter_key] = $parsedFrame[$id3v2_chapter_key];
2056 2056
 				}
2057 2057
 			}
2058
-			if (!isset($info['id3v2']['chapters'])) {
2058
+			if ( ! isset($info['id3v2']['chapters'])) {
2059 2059
 				$info['id3v2']['chapters'] = array();
2060 2060
 			}
2061 2061
 			$info['id3v2']['chapters'][] = $id3v2_chapter_entry;
@@ -2096,7 +2096,7 @@  discard block
 block discarded – undo
2096 2096
 				while ($frame_offset < strlen($parsedFrame['data'])) {
2097 2097
 					// <Optional embedded sub-frames>
2098 2098
 					$subframe = array();
2099
-					$subframe['name']      =                           substr($parsedFrame['data'], $frame_offset, 4);
2099
+					$subframe['name']      = substr($parsedFrame['data'], $frame_offset, 4);
2100 2100
 					$frame_offset += 4;
2101 2101
 					$subframe['size']      = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, 4));
2102 2102
 					$frame_offset += 4;
@@ -2110,9 +2110,9 @@  discard block
 block discarded – undo
2110 2110
 					$frame_offset += $subframe['size'];
2111 2111
 
2112 2112
 					$subframe['encodingid'] = ord(substr($subframe_rawdata, 0, 1));
2113
-					$subframe['text']       =     substr($subframe_rawdata, 1);
2113
+					$subframe['text']       = substr($subframe_rawdata, 1);
2114 2114
 					$subframe['encoding']   = $this->TextEncodingNameLookup($subframe['encodingid']);
2115
-					$encoding_converted_text = trim(getid3_lib::iconv_fallback($subframe['encoding'], $info['encoding'], $subframe['text']));;
2115
+					$encoding_converted_text = trim(getid3_lib::iconv_fallback($subframe['encoding'], $info['encoding'], $subframe['text'])); ;
2116 2116
 					switch (substr($encoding_converted_text, 0, 2)) {
2117 2117
 						case "\xFF\xFE":
2118 2118
 						case "\xFE\xFF":
@@ -2596,9 +2596,9 @@  discard block
 block discarded – undo
2596 2596
 
2597 2597
 
2598 2598
 
2599
-	public static function LanguageLookup($languagecode, $casesensitive=false) {
2599
+	public static function LanguageLookup($languagecode, $casesensitive = false) {
2600 2600
 
2601
-		if (!$casesensitive) {
2601
+		if ( ! $casesensitive) {
2602 2602
 			$languagecode = strtolower($languagecode);
2603 2603
 		}
2604 2604
 
@@ -3101,8 +3101,8 @@  discard block
 block discarded – undo
3101 3101
 			0x01 => 'lyrics',
3102 3102
 			0x02 => 'text transcription',
3103 3103
 			0x03 => 'movement/part name', // (e.g. 'Adagio')
3104
-			0x04 => 'events',             // (e.g. 'Don Quijote enters the stage')
3105
-			0x05 => 'chord',              // (e.g. 'Bb F Fsus')
3104
+			0x04 => 'events', // (e.g. 'Don Quijote enters the stage')
3105
+			0x05 => 'chord', // (e.g. 'Bb F Fsus')
3106 3106
 			0x06 => 'trivia/\'pop up\' information',
3107 3107
 			0x07 => 'URLs to webpages',
3108 3108
 			0x08 => 'URLs to images'
@@ -3111,7 +3111,7 @@  discard block
 block discarded – undo
3111 3111
 		return (isset($SYTLContentTypeLookup[$index]) ? $SYTLContentTypeLookup[$index] : '');
3112 3112
 	}
3113 3113
 
3114
-	public static function APICPictureTypeLookup($index, $returnarray=false) {
3114
+	public static function APICPictureTypeLookup($index, $returnarray = false) {
3115 3115
 		static $APICPictureTypeLookup = array(
3116 3116
 			0x00 => 'Other',
3117 3117
 			0x01 => '32x32 pixels \'file icon\' (PNG only)',
@@ -3540,10 +3540,10 @@  discard block
 block discarded – undo
3540 3540
 		// http://www.id3.org/id3v2.4.0-structure.txt
3541 3541
 		// Frames that allow different types of text encoding contains a text encoding description byte. Possible encodings:
3542 3542
 		static $TextEncodingTerminatorLookup = array(
3543
-			0   => "\x00",     // $00  ISO-8859-1. Terminated with $00.
3543
+			0   => "\x00", // $00  ISO-8859-1. Terminated with $00.
3544 3544
 			1   => "\x00\x00", // $01  UTF-16 encoded Unicode with BOM. All strings in the same frame SHALL have the same byteorder. Terminated with $00 00.
3545 3545
 			2   => "\x00\x00", // $02  UTF-16BE encoded Unicode without BOM. Terminated with $00 00.
3546
-			3   => "\x00",     // $03  UTF-8 encoded Unicode. Terminated with $00.
3546
+			3   => "\x00", // $03  UTF-8 encoded Unicode. Terminated with $00.
3547 3547
 			255 => "\x00\x00"
3548 3548
 		);
3549 3549
 		return (isset($TextEncodingTerminatorLookup[$encoding]) ? $TextEncodingTerminatorLookup[$encoding] : "\x00");
@@ -3554,9 +3554,9 @@  discard block
 block discarded – undo
3554 3554
 		// Frames that allow different types of text encoding contains a text encoding description byte. Possible encodings:
3555 3555
 		static $TextEncodingNameLookup = array(
3556 3556
 			0   => 'ISO-8859-1', // $00  ISO-8859-1. Terminated with $00.
3557
-			1   => 'UTF-16',     // $01  UTF-16 encoded Unicode with BOM. All strings in the same frame SHALL have the same byteorder. Terminated with $00 00.
3558
-			2   => 'UTF-16BE',   // $02  UTF-16BE encoded Unicode without BOM. Terminated with $00 00.
3559
-			3   => 'UTF-8',      // $03  UTF-8 encoded Unicode. Terminated with $00.
3557
+			1   => 'UTF-16', // $01  UTF-16 encoded Unicode with BOM. All strings in the same frame SHALL have the same byteorder. Terminated with $00 00.
3558
+			2   => 'UTF-16BE', // $02  UTF-16BE encoded Unicode without BOM. Terminated with $00 00.
3559
+			3   => 'UTF-8', // $03  UTF-8 encoded Unicode. Terminated with $00.
3560 3560
 			255 => 'UTF-16BE'
3561 3561
 		);
3562 3562
 		return (isset($TextEncodingNameLookup[$encoding]) ? $TextEncodingNameLookup[$encoding] : 'ISO-8859-1');
@@ -3576,7 +3576,7 @@  discard block
 block discarded – undo
3576 3576
 		return false;
3577 3577
 	}
3578 3578
 
3579
-	public static function IsANumber($numberstring, $allowdecimal=false, $allownegative=false) {
3579
+	public static function IsANumber($numberstring, $allowdecimal = false, $allownegative = false) {
3580 3580
 		for ($i = 0; $i < strlen($numberstring); $i++) {
3581 3581
 			if ((chr($numberstring{$i}) < chr('0')) || (chr($numberstring{$i}) > chr('9'))) {
3582 3582
 				if (($numberstring{$i} == '.') && $allowdecimal) {
@@ -3595,7 +3595,7 @@  discard block
 block discarded – undo
3595 3595
 		if (strlen($datestamp) != 8) {
3596 3596
 			return false;
3597 3597
 		}
3598
-		if (!self::IsANumber($datestamp, false)) {
3598
+		if ( ! self::IsANumber($datestamp, false)) {
3599 3599
 			return false;
3600 3600
 		}
3601 3601
 		$year  = substr($datestamp, 0, 4);
Please login to merge, or discard this patch.
src/wp-includes/ID3/module.tag.lyrics3.php 2 patches
Doc Comments   +6 added lines patch added patch discarded remove patch
@@ -126,6 +126,9 @@  discard block
 block discarded – undo
126 126
 		return true;
127 127
 	}
128 128
 
129
+	/**
130
+	 * @param integer $version
131
+	 */
129 132
 	public function getLyrics3Data($endoffset, $version, $length) {
130 133
 		// http://www.volweb.cz/str/tags.htm
131 134
 
@@ -287,6 +290,9 @@  discard block
 block discarded – undo
287 290
 		return true;
288 291
 	}
289 292
 
293
+	/**
294
+	 * @param string $char
295
+	 */
290 296
 	public function IntString2Bool($char) {
291 297
 		if ($char == '1') {
292 298
 			return true;
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -23,15 +23,15 @@  discard block
 block discarded – undo
23 23
 
24 24
 		// http://www.volweb.cz/str/tags.htm
25 25
 
26
-		if (!getid3_lib::intValueSupported($info['filesize'])) {
26
+		if ( ! getid3_lib::intValueSupported($info['filesize'])) {
27 27
 			$info['warning'][] = 'Unable to check for Lyrics3 because file is larger than '.round(PHP_INT_MAX / 1073741824).'GB';
28 28
 			return false;
29 29
 		}
30 30
 
31
-		$this->fseek((0 - 128 - 9 - 6), SEEK_END);          // end - ID3v1 - "LYRICSEND" - [Lyrics3size]
31
+		$this->fseek((0 - 128 - 9 - 6), SEEK_END); // end - ID3v1 - "LYRICSEND" - [Lyrics3size]
32 32
 		$lyrics3_id3v1 = $this->fread(128 + 9 + 6);
33
-		$lyrics3lsz    = substr($lyrics3_id3v1,  0,   6); // Lyrics3size
34
-		$lyrics3end    = substr($lyrics3_id3v1,  6,   9); // LYRICSEND or LYRICS200
33
+		$lyrics3lsz    = substr($lyrics3_id3v1, 0, 6); // Lyrics3size
34
+		$lyrics3end    = substr($lyrics3_id3v1, 6, 9); // LYRICSEND or LYRICS200
35 35
 		$id3v1tag      = substr($lyrics3_id3v1, 15, 128); // ID3v1
36 36
 
37 37
 		if ($lyrics3end == 'LYRICSEND') {
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
 			$info['avdataend'] = $lyrics3offset;
101 101
 			$this->getLyrics3Data($lyrics3offset, $lyrics3version, $lyrics3size);
102 102
 
103
-			if (!isset($info['ape'])) {
103
+			if ( ! isset($info['ape'])) {
104 104
 				if (isset($info['lyrics3']['tag_offset_start'])) {
105 105
 					$GETID3_ERRORARRAY = &$info['warning'];
106 106
 					getid3_lib::IncludeDependency(GETID3_INCLUDEPATH.'module.tag.apetag.php', __FILE__, true);
@@ -109,10 +109,10 @@  discard block
 block discarded – undo
109 109
 					$getid3_apetag = new getid3_apetag($getid3_temp);
110 110
 					$getid3_apetag->overrideendoffset = $info['lyrics3']['tag_offset_start'];
111 111
 					$getid3_apetag->Analyze();
112
-					if (!empty($getid3_temp->info['ape'])) {
112
+					if ( ! empty($getid3_temp->info['ape'])) {
113 113
 						$info['ape'] = $getid3_temp->info['ape'];
114 114
 					}
115
-					if (!empty($getid3_temp->info['replay_gain'])) {
115
+					if ( ! empty($getid3_temp->info['replay_gain'])) {
116 116
 						$info['replay_gain'] = $getid3_temp->info['replay_gain'];
117 117
 					}
118 118
 					unset($getid3_temp, $getid3_apetag);
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
 
132 132
 		$info = &$this->getid3->info;
133 133
 
134
-		if (!getid3_lib::intValueSupported($endoffset)) {
134
+		if ( ! getid3_lib::intValueSupported($endoffset)) {
135 135
 			$info['warning'][] = 'Unable to check for Lyrics3 because file is larger than '.round(PHP_INT_MAX / 1073741824).'GB';
136 136
 			return false;
137 137
 		}
@@ -211,8 +211,8 @@  discard block
 block discarded – undo
211 211
 						foreach ($imagestrings as $key => $imagestring) {
212 212
 							if (strpos($imagestring, '||') !== false) {
213 213
 								$imagearray = explode('||', $imagestring);
214
-								$ParsedLyrics3['images'][$key]['filename']     =                                (isset($imagearray[0]) ? $imagearray[0] : '');
215
-								$ParsedLyrics3['images'][$key]['description']  =                                (isset($imagearray[1]) ? $imagearray[1] : '');
214
+								$ParsedLyrics3['images'][$key]['filename']     = (isset($imagearray[0]) ? $imagearray[0] : '');
215
+								$ParsedLyrics3['images'][$key]['description']  = (isset($imagearray[1]) ? $imagearray[1] : '');
216 216
 								$ParsedLyrics3['images'][$key]['timestamp']    = $this->Lyrics3Timestamp2Seconds(isset($imagearray[2]) ? $imagearray[2] : '');
217 217
 							}
218 218
 						}
Please login to merge, or discard this patch.
src/wp-includes/load.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -218,7 +218,7 @@
 block discarded – undo
218 218
  * @global float   $timestart Seconds from when timer_start() is called.
219 219
  * @global float   $timeend   Seconds from when function is called.
220 220
  *
221
- * @param int|bool $display   Whether to echo or return the results. Accepts 0|false for return,
221
+ * @param integer $display   Whether to echo or return the results. Accepts 0|false for return,
222 222
  *                            1|true for echo. Default 0|false.
223 223
  * @param int      $precision The number of digits from the right of the decimal to display.
224 224
  *                            Default 3.
Please login to merge, or discard this patch.
Braces   +131 added lines, -90 removed lines patch added patch discarded remove patch
@@ -27,19 +27,22 @@  discard block
 block discarded – undo
27 27
  * @access private
28 28
  */
29 29
 function wp_unregister_GLOBALS() {
30
-	if ( !ini_get( 'register_globals' ) )
31
-		return;
30
+	if ( !ini_get( 'register_globals' ) ) {
31
+			return;
32
+	}
32 33
 
33
-	if ( isset( $_REQUEST['GLOBALS'] ) )
34
-		die( 'GLOBALS overwrite attempt detected' );
34
+	if ( isset( $_REQUEST['GLOBALS'] ) ) {
35
+			die( 'GLOBALS overwrite attempt detected' );
36
+	}
35 37
 
36 38
 	// Variables that shouldn't be unset
37 39
 	$no_unset = array( 'GLOBALS', '_GET', '_POST', '_COOKIE', '_REQUEST', '_SERVER', '_ENV', '_FILES', 'table_prefix' );
38 40
 
39 41
 	$input = array_merge( $_GET, $_POST, $_COOKIE, $_SERVER, $_ENV, $_FILES, isset( $_SESSION ) && is_array( $_SESSION ) ? $_SESSION : array() );
40
-	foreach ( $input as $k => $v )
41
-		if ( !in_array( $k, $no_unset ) && isset( $GLOBALS[$k] ) ) {
42
+	foreach ( $input as $k => $v ) {
43
+			if ( !in_array( $k, $no_unset ) && isset( $GLOBALS[$k] ) ) {
42 44
 			unset( $GLOBALS[$k] );
45
+	}
43 46
 		}
44 47
 }
45 48
 
@@ -74,15 +77,17 @@  discard block
 block discarded – undo
74 77
 			$_SERVER['REQUEST_URI'] = $_SERVER['HTTP_X_REWRITE_URL'];
75 78
 		} else {
76 79
 			// Use ORIG_PATH_INFO if there is no PATH_INFO
77
-			if ( !isset( $_SERVER['PATH_INFO'] ) && isset( $_SERVER['ORIG_PATH_INFO'] ) )
78
-				$_SERVER['PATH_INFO'] = $_SERVER['ORIG_PATH_INFO'];
80
+			if ( !isset( $_SERVER['PATH_INFO'] ) && isset( $_SERVER['ORIG_PATH_INFO'] ) ) {
81
+							$_SERVER['PATH_INFO'] = $_SERVER['ORIG_PATH_INFO'];
82
+			}
79 83
 
80 84
 			// Some IIS + PHP configurations puts the script-name in the path-info (No need to append it twice)
81 85
 			if ( isset( $_SERVER['PATH_INFO'] ) ) {
82
-				if ( $_SERVER['PATH_INFO'] == $_SERVER['SCRIPT_NAME'] )
83
-					$_SERVER['REQUEST_URI'] = $_SERVER['PATH_INFO'];
84
-				else
85
-					$_SERVER['REQUEST_URI'] = $_SERVER['SCRIPT_NAME'] . $_SERVER['PATH_INFO'];
86
+				if ( $_SERVER['PATH_INFO'] == $_SERVER['SCRIPT_NAME'] ) {
87
+									$_SERVER['REQUEST_URI'] = $_SERVER['PATH_INFO'];
88
+				} else {
89
+									$_SERVER['REQUEST_URI'] = $_SERVER['SCRIPT_NAME'] . $_SERVER['PATH_INFO'];
90
+				}
86 91
 			}
87 92
 
88 93
 			// Append the query string if it exists and isn't null
@@ -93,18 +98,21 @@  discard block
 block discarded – undo
93 98
 	}
94 99
 
95 100
 	// Fix for PHP as CGI hosts that set SCRIPT_FILENAME to something ending in php.cgi for all requests
96
-	if ( isset( $_SERVER['SCRIPT_FILENAME'] ) && ( strpos( $_SERVER['SCRIPT_FILENAME'], 'php.cgi' ) == strlen( $_SERVER['SCRIPT_FILENAME'] ) - 7 ) )
97
-		$_SERVER['SCRIPT_FILENAME'] = $_SERVER['PATH_TRANSLATED'];
101
+	if ( isset( $_SERVER['SCRIPT_FILENAME'] ) && ( strpos( $_SERVER['SCRIPT_FILENAME'], 'php.cgi' ) == strlen( $_SERVER['SCRIPT_FILENAME'] ) - 7 ) ) {
102
+			$_SERVER['SCRIPT_FILENAME'] = $_SERVER['PATH_TRANSLATED'];
103
+	}
98 104
 
99 105
 	// Fix for Dreamhost and other PHP as CGI hosts
100
-	if ( strpos( $_SERVER['SCRIPT_NAME'], 'php.cgi' ) !== false )
101
-		unset( $_SERVER['PATH_INFO'] );
106
+	if ( strpos( $_SERVER['SCRIPT_NAME'], 'php.cgi' ) !== false ) {
107
+			unset( $_SERVER['PATH_INFO'] );
108
+	}
102 109
 
103 110
 	// Fix empty PHP_SELF
104 111
 	$PHP_SELF = $_SERVER['PHP_SELF'];
105
-	if ( empty( $PHP_SELF ) )
106
-		$_SERVER['PHP_SELF'] = $PHP_SELF = preg_replace( '/(\?.*)?$/', '', $_SERVER["REQUEST_URI"] );
107
-}
112
+	if ( empty( $PHP_SELF ) ) {
113
+			$_SERVER['PHP_SELF'] = $PHP_SELF = preg_replace( '/(\?.*)?$/', '', $_SERVER["REQUEST_URI"] );
114
+	}
115
+	}
108 116
 
109 117
 /**
110 118
  * Check for the required PHP version, and the MySQL extension or
@@ -173,15 +181,17 @@  discard block
 block discarded – undo
173 181
  * @global int $upgrading the unix timestamp marking when upgrading WordPress began.
174 182
  */
175 183
 function wp_maintenance() {
176
-	if ( ! file_exists( ABSPATH . '.maintenance' ) || wp_installing() )
177
-		return;
184
+	if ( ! file_exists( ABSPATH . '.maintenance' ) || wp_installing() ) {
185
+			return;
186
+	}
178 187
 
179 188
 	global $upgrading;
180 189
 
181 190
 	include( ABSPATH . '.maintenance' );
182 191
 	// If the $upgrading timestamp is older than 10 minutes, don't die.
183
-	if ( ( time() - $upgrading ) >= 600 )
184
-		return;
192
+	if ( ( time() - $upgrading ) >= 600 ) {
193
+			return;
194
+	}
185 195
 
186 196
 	/**
187 197
 	 * Filters whether to enable maintenance mode.
@@ -213,7 +223,10 @@  discard block
 block discarded – undo
213 223
 	header( 'Retry-After: 600' );
214 224
 ?>
215 225
 	<!DOCTYPE html>
216
-	<html xmlns="http://www.w3.org/1999/xhtml"<?php if ( is_rtl() ) echo ' dir="rtl"'; ?>>
226
+	<html xmlns="http://www.w3.org/1999/xhtml"<?php if ( is_rtl() ) {
227
+	echo ' dir="rtl"';
228
+}
229
+?>>
217 230
 	<head>
218 231
 	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
219 232
 		<title><?php _e( 'Maintenance' ); ?></title>
@@ -264,8 +277,9 @@  discard block
 block discarded – undo
264 277
 	$timeend = microtime( true );
265 278
 	$timetotal = $timeend - $timestart;
266 279
 	$r = ( function_exists( 'number_format_i18n' ) ) ? number_format_i18n( $timetotal, $precision ) : number_format( $timetotal, $precision );
267
-	if ( $display )
268
-		echo $r;
280
+	if ( $display ) {
281
+			echo $r;
282
+	}
269 283
 	return $r;
270 284
 }
271 285
 
@@ -320,10 +334,11 @@  discard block
 block discarded – undo
320 334
 	if ( WP_DEBUG ) {
321 335
 		error_reporting( E_ALL );
322 336
 
323
-		if ( WP_DEBUG_DISPLAY )
324
-			ini_set( 'display_errors', 1 );
325
-		elseif ( null !== WP_DEBUG_DISPLAY )
326
-			ini_set( 'display_errors', 0 );
337
+		if ( WP_DEBUG_DISPLAY ) {
338
+					ini_set( 'display_errors', 1 );
339
+		} elseif ( null !== WP_DEBUG_DISPLAY ) {
340
+					ini_set( 'display_errors', 0 );
341
+		}
327 342
 
328 343
 		if ( WP_DEBUG_LOG ) {
329 344
 			ini_set( 'log_errors', 1 );
@@ -394,8 +409,9 @@  discard block
 block discarded – undo
394 409
 	global $wpdb;
395 410
 
396 411
 	require_once( ABSPATH . WPINC . '/wp-db.php' );
397
-	if ( file_exists( WP_CONTENT_DIR . '/db.php' ) )
398
-		require_once( WP_CONTENT_DIR . '/db.php' );
412
+	if ( file_exists( WP_CONTENT_DIR . '/db.php' ) ) {
413
+			require_once( WP_CONTENT_DIR . '/db.php' );
414
+	}
399 415
 
400 416
 	if ( isset( $wpdb ) ) {
401 417
 		return;
@@ -418,8 +434,9 @@  discard block
 block discarded – undo
418 434
  */
419 435
 function wp_set_wpdb_vars() {
420 436
 	global $wpdb, $table_prefix;
421
-	if ( !empty( $wpdb->error ) )
422
-		dead_db();
437
+	if ( !empty( $wpdb->error ) ) {
438
+			dead_db();
439
+	}
423 440
 
424 441
 	$wpdb->field_types = array( 'post_author' => '%d', 'post_parent' => '%d', 'menu_order' => '%d', 'term_id' => '%d', 'term_group' => '%d', 'term_taxonomy_id' => '%d',
425 442
 		'parent' => '%d', 'count' => '%d','object_id' => '%d', 'term_order' => '%d', 'ID' => '%d', 'comment_ID' => '%d', 'comment_post_ID' => '%d', 'comment_parent' => '%d',
@@ -457,8 +474,9 @@  discard block
 block discarded – undo
457 474
 function wp_using_ext_object_cache( $using = null ) {
458 475
 	global $_wp_using_ext_object_cache;
459 476
 	$current_using = $_wp_using_ext_object_cache;
460
-	if ( null !== $using )
461
-		$_wp_using_ext_object_cache = $using;
477
+	if ( null !== $using ) {
478
+			$_wp_using_ext_object_cache = $using;
479
+	}
462 480
 	return $current_using;
463 481
 }
464 482
 
@@ -563,13 +581,16 @@  discard block
 block discarded – undo
563 581
  */
564 582
 function wp_get_mu_plugins() {
565 583
 	$mu_plugins = array();
566
-	if ( !is_dir( WPMU_PLUGIN_DIR ) )
567
-		return $mu_plugins;
568
-	if ( ! $dh = opendir( WPMU_PLUGIN_DIR ) )
569
-		return $mu_plugins;
584
+	if ( !is_dir( WPMU_PLUGIN_DIR ) ) {
585
+			return $mu_plugins;
586
+	}
587
+	if ( ! $dh = opendir( WPMU_PLUGIN_DIR ) ) {
588
+			return $mu_plugins;
589
+	}
570 590
 	while ( ( $plugin = readdir( $dh ) ) !== false ) {
571
-		if ( substr( $plugin, -4 ) == '.php' )
572
-			$mu_plugins[] = WPMU_PLUGIN_DIR . '/' . $plugin;
591
+		if ( substr( $plugin, -4 ) == '.php' ) {
592
+					$mu_plugins[] = WPMU_PLUGIN_DIR . '/' . $plugin;
593
+		}
573 594
 	}
574 595
 	closedir( $dh );
575 596
 	sort( $mu_plugins );
@@ -601,8 +622,9 @@  discard block
 block discarded – undo
601 622
 		array_unshift( $plugins, ABSPATH . 'my-hacks.php' );
602 623
 	}
603 624
 
604
-	if ( empty( $active_plugins ) || wp_installing() )
605
-		return $plugins;
625
+	if ( empty( $active_plugins ) || wp_installing() ) {
626
+			return $plugins;
627
+	}
606 628
 
607 629
 	$network_plugins = is_multisite() ? wp_get_active_network_plugins() : false;
608 630
 
@@ -612,8 +634,9 @@  discard block
 block discarded – undo
612 634
 			&& file_exists( WP_PLUGIN_DIR . '/' . $plugin ) // $plugin must exist
613 635
 			// not already included as a network plugin
614 636
 			&& ( ! $network_plugins || ! in_array( WP_PLUGIN_DIR . '/' . $plugin, $network_plugins ) )
615
-			)
616
-		$plugins[] = WP_PLUGIN_DIR . '/' . $plugin;
637
+			) {
638
+				$plugins[] = WP_PLUGIN_DIR . '/' . $plugin;
639
+		}
617 640
 	}
618 641
 	return $plugins;
619 642
 }
@@ -630,8 +653,9 @@  discard block
 block discarded – undo
630 653
 function wp_set_internal_encoding() {
631 654
 	if ( function_exists( 'mb_internal_encoding' ) ) {
632 655
 		$charset = get_option( 'blog_charset' );
633
-		if ( ! $charset || ! @mb_internal_encoding( $charset ) )
634
-			mb_internal_encoding( 'UTF-8' );
656
+		if ( ! $charset || ! @mb_internal_encoding( $charset ) ) {
657
+					mb_internal_encoding( 'UTF-8' );
658
+		}
635 659
 	}
636 660
 }
637 661
 
@@ -706,10 +730,11 @@  discard block
 block discarded – undo
706 730
  * @return bool True if inside WordPress administration interface, false otherwise.
707 731
  */
708 732
 function is_admin() {
709
-	if ( isset( $GLOBALS['current_screen'] ) )
710
-		return $GLOBALS['current_screen']->in_admin();
711
-	elseif ( defined( 'WP_ADMIN' ) )
712
-		return WP_ADMIN;
733
+	if ( isset( $GLOBALS['current_screen'] ) ) {
734
+			return $GLOBALS['current_screen']->in_admin();
735
+	} elseif ( defined( 'WP_ADMIN' ) ) {
736
+			return WP_ADMIN;
737
+	}
713 738
 
714 739
 	return false;
715 740
 }
@@ -729,10 +754,11 @@  discard block
 block discarded – undo
729 754
  * @return bool True if inside WordPress blog administration pages.
730 755
  */
731 756
 function is_blog_admin() {
732
-	if ( isset( $GLOBALS['current_screen'] ) )
733
-		return $GLOBALS['current_screen']->in_admin( 'site' );
734
-	elseif ( defined( 'WP_BLOG_ADMIN' ) )
735
-		return WP_BLOG_ADMIN;
757
+	if ( isset( $GLOBALS['current_screen'] ) ) {
758
+			return $GLOBALS['current_screen']->in_admin( 'site' );
759
+	} elseif ( defined( 'WP_BLOG_ADMIN' ) ) {
760
+			return WP_BLOG_ADMIN;
761
+	}
736 762
 
737 763
 	return false;
738 764
 }
@@ -752,10 +778,11 @@  discard block
 block discarded – undo
752 778
  * @return bool True if inside WordPress network administration pages.
753 779
  */
754 780
 function is_network_admin() {
755
-	if ( isset( $GLOBALS['current_screen'] ) )
756
-		return $GLOBALS['current_screen']->in_admin( 'network' );
757
-	elseif ( defined( 'WP_NETWORK_ADMIN' ) )
758
-		return WP_NETWORK_ADMIN;
781
+	if ( isset( $GLOBALS['current_screen'] ) ) {
782
+			return $GLOBALS['current_screen']->in_admin( 'network' );
783
+	} elseif ( defined( 'WP_NETWORK_ADMIN' ) ) {
784
+			return WP_NETWORK_ADMIN;
785
+	}
759 786
 
760 787
 	return false;
761 788
 }
@@ -776,10 +803,11 @@  discard block
 block discarded – undo
776 803
  * @return bool True if inside WordPress user administration pages.
777 804
  */
778 805
 function is_user_admin() {
779
-	if ( isset( $GLOBALS['current_screen'] ) )
780
-		return $GLOBALS['current_screen']->in_admin( 'user' );
781
-	elseif ( defined( 'WP_USER_ADMIN' ) )
782
-		return WP_USER_ADMIN;
806
+	if ( isset( $GLOBALS['current_screen'] ) ) {
807
+			return $GLOBALS['current_screen']->in_admin( 'user' );
808
+	} elseif ( defined( 'WP_USER_ADMIN' ) ) {
809
+			return WP_USER_ADMIN;
810
+	}
783 811
 
784 812
 	return false;
785 813
 }
@@ -792,11 +820,13 @@  discard block
 block discarded – undo
792 820
  * @return bool True if Multisite is enabled, false otherwise.
793 821
  */
794 822
 function is_multisite() {
795
-	if ( defined( 'MULTISITE' ) )
796
-		return MULTISITE;
823
+	if ( defined( 'MULTISITE' ) ) {
824
+			return MULTISITE;
825
+	}
797 826
 
798
-	if ( defined( 'SUBDOMAIN_INSTALL' ) || defined( 'VHOST' ) || defined( 'SUNRISE' ) )
799
-		return true;
827
+	if ( defined( 'SUBDOMAIN_INSTALL' ) || defined( 'VHOST' ) || defined( 'SUNRISE' ) ) {
828
+			return true;
829
+	}
800 830
 
801 831
 	return false;
802 832
 }
@@ -857,12 +887,14 @@  discard block
 block discarded – undo
857 887
 	global $wp_locale;
858 888
 
859 889
 	static $loaded = false;
860
-	if ( $loaded )
861
-		return;
890
+	if ( $loaded ) {
891
+			return;
892
+	}
862 893
 	$loaded = true;
863 894
 
864
-	if ( function_exists( 'did_action' ) && did_action( 'init' ) )
865
-		return;
895
+	if ( function_exists( 'did_action' ) && did_action( 'init' ) ) {
896
+			return;
897
+	}
866 898
 
867 899
 	// We need $wp_local_package
868 900
 	require ABSPATH . WPINC . '/version.php';
@@ -880,31 +912,39 @@  discard block
 block discarded – undo
880 912
 
881 913
 	while ( true ) {
882 914
 		if ( defined( 'WPLANG' ) ) {
883
-			if ( '' == WPLANG )
884
-				break;
915
+			if ( '' == WPLANG ) {
916
+							break;
917
+			}
885 918
 			$locales[] = WPLANG;
886 919
 		}
887 920
 
888
-		if ( isset( $wp_local_package ) )
889
-			$locales[] = $wp_local_package;
921
+		if ( isset( $wp_local_package ) ) {
922
+					$locales[] = $wp_local_package;
923
+		}
890 924
 
891
-		if ( ! $locales )
892
-			break;
925
+		if ( ! $locales ) {
926
+					break;
927
+		}
893 928
 
894
-		if ( defined( 'WP_LANG_DIR' ) && @is_dir( WP_LANG_DIR ) )
895
-			$locations[] = WP_LANG_DIR;
929
+		if ( defined( 'WP_LANG_DIR' ) && @is_dir( WP_LANG_DIR ) ) {
930
+					$locations[] = WP_LANG_DIR;
931
+		}
896 932
 
897
-		if ( defined( 'WP_CONTENT_DIR' ) && @is_dir( WP_CONTENT_DIR . '/languages' ) )
898
-			$locations[] = WP_CONTENT_DIR . '/languages';
933
+		if ( defined( 'WP_CONTENT_DIR' ) && @is_dir( WP_CONTENT_DIR . '/languages' ) ) {
934
+					$locations[] = WP_CONTENT_DIR . '/languages';
935
+		}
899 936
 
900
-		if ( @is_dir( ABSPATH . 'wp-content/languages' ) )
901
-			$locations[] = ABSPATH . 'wp-content/languages';
937
+		if ( @is_dir( ABSPATH . 'wp-content/languages' ) ) {
938
+					$locations[] = ABSPATH . 'wp-content/languages';
939
+		}
902 940
 
903
-		if ( @is_dir( ABSPATH . WPINC . '/languages' ) )
904
-			$locations[] = ABSPATH . WPINC . '/languages';
941
+		if ( @is_dir( ABSPATH . WPINC . '/languages' ) ) {
942
+					$locations[] = ABSPATH . WPINC . '/languages';
943
+		}
905 944
 
906
-		if ( ! $locations )
907
-			break;
945
+		if ( ! $locations ) {
946
+					break;
947
+		}
908 948
 
909 949
 		$locations = array_unique( $locations );
910 950
 
@@ -912,8 +952,9 @@  discard block
 block discarded – undo
912 952
 			foreach ( $locations as $location ) {
913 953
 				if ( file_exists( $location . '/' . $locale . '.mo' ) ) {
914 954
 					load_textdomain( 'default', $location . '/' . $locale . '.mo' );
915
-					if ( defined( 'WP_SETUP_CONFIG' ) && file_exists( $location . '/admin-' . $locale . '.mo' ) )
916
-						load_textdomain( 'default', $location . '/admin-' . $locale . '.mo' );
955
+					if ( defined( 'WP_SETUP_CONFIG' ) && file_exists( $location . '/admin-' . $locale . '.mo' ) ) {
956
+											load_textdomain( 'default', $location . '/admin-' . $locale . '.mo' );
957
+					}
917 958
 					break 2;
918 959
 				}
919 960
 			}
Please login to merge, or discard this patch.
Spacing   +213 added lines, -213 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
  */
15 15
 function wp_get_server_protocol() {
16 16
 	$protocol = $_SERVER['SERVER_PROTOCOL'];
17
-	if ( ! in_array( $protocol, array( 'HTTP/1.1', 'HTTP/2', 'HTTP/2.0' ) ) ) {
17
+	if ( ! in_array($protocol, array('HTTP/1.1', 'HTTP/2', 'HTTP/2.0'))) {
18 18
 		$protocol = 'HTTP/1.0';
19 19
 	}
20 20
 	return $protocol;
@@ -27,19 +27,19 @@  discard block
 block discarded – undo
27 27
  * @access private
28 28
  */
29 29
 function wp_unregister_GLOBALS() {
30
-	if ( !ini_get( 'register_globals' ) )
30
+	if ( ! ini_get('register_globals'))
31 31
 		return;
32 32
 
33
-	if ( isset( $_REQUEST['GLOBALS'] ) )
34
-		die( 'GLOBALS overwrite attempt detected' );
33
+	if (isset($_REQUEST['GLOBALS']))
34
+		die('GLOBALS overwrite attempt detected');
35 35
 
36 36
 	// Variables that shouldn't be unset
37
-	$no_unset = array( 'GLOBALS', '_GET', '_POST', '_COOKIE', '_REQUEST', '_SERVER', '_ENV', '_FILES', 'table_prefix' );
37
+	$no_unset = array('GLOBALS', '_GET', '_POST', '_COOKIE', '_REQUEST', '_SERVER', '_ENV', '_FILES', 'table_prefix');
38 38
 
39
-	$input = array_merge( $_GET, $_POST, $_COOKIE, $_SERVER, $_ENV, $_FILES, isset( $_SESSION ) && is_array( $_SESSION ) ? $_SESSION : array() );
40
-	foreach ( $input as $k => $v )
41
-		if ( !in_array( $k, $no_unset ) && isset( $GLOBALS[$k] ) ) {
42
-			unset( $GLOBALS[$k] );
39
+	$input = array_merge($_GET, $_POST, $_COOKIE, $_SERVER, $_ENV, $_FILES, isset($_SESSION) && is_array($_SESSION) ? $_SESSION : array());
40
+	foreach ($input as $k => $v)
41
+		if ( ! in_array($k, $no_unset) && isset($GLOBALS[$k])) {
42
+			unset($GLOBALS[$k]);
43 43
 		}
44 44
 }
45 45
 
@@ -60,50 +60,50 @@  discard block
 block discarded – undo
60 60
 		'REQUEST_URI' => '',
61 61
 	);
62 62
 
63
-	$_SERVER = array_merge( $default_server_values, $_SERVER );
63
+	$_SERVER = array_merge($default_server_values, $_SERVER);
64 64
 
65 65
 	// Fix for IIS when running with PHP ISAPI
66
-	if ( empty( $_SERVER['REQUEST_URI'] ) || ( PHP_SAPI != 'cgi-fcgi' && preg_match( '/^Microsoft-IIS\//', $_SERVER['SERVER_SOFTWARE'] ) ) ) {
66
+	if (empty($_SERVER['REQUEST_URI']) || (PHP_SAPI != 'cgi-fcgi' && preg_match('/^Microsoft-IIS\//', $_SERVER['SERVER_SOFTWARE']))) {
67 67
 
68 68
 		// IIS Mod-Rewrite
69
-		if ( isset( $_SERVER['HTTP_X_ORIGINAL_URL'] ) ) {
69
+		if (isset($_SERVER['HTTP_X_ORIGINAL_URL'])) {
70 70
 			$_SERVER['REQUEST_URI'] = $_SERVER['HTTP_X_ORIGINAL_URL'];
71 71
 		}
72 72
 		// IIS Isapi_Rewrite
73
-		elseif ( isset( $_SERVER['HTTP_X_REWRITE_URL'] ) ) {
73
+		elseif (isset($_SERVER['HTTP_X_REWRITE_URL'])) {
74 74
 			$_SERVER['REQUEST_URI'] = $_SERVER['HTTP_X_REWRITE_URL'];
75 75
 		} else {
76 76
 			// Use ORIG_PATH_INFO if there is no PATH_INFO
77
-			if ( !isset( $_SERVER['PATH_INFO'] ) && isset( $_SERVER['ORIG_PATH_INFO'] ) )
77
+			if ( ! isset($_SERVER['PATH_INFO']) && isset($_SERVER['ORIG_PATH_INFO']))
78 78
 				$_SERVER['PATH_INFO'] = $_SERVER['ORIG_PATH_INFO'];
79 79
 
80 80
 			// Some IIS + PHP configurations puts the script-name in the path-info (No need to append it twice)
81
-			if ( isset( $_SERVER['PATH_INFO'] ) ) {
82
-				if ( $_SERVER['PATH_INFO'] == $_SERVER['SCRIPT_NAME'] )
81
+			if (isset($_SERVER['PATH_INFO'])) {
82
+				if ($_SERVER['PATH_INFO'] == $_SERVER['SCRIPT_NAME'])
83 83
 					$_SERVER['REQUEST_URI'] = $_SERVER['PATH_INFO'];
84 84
 				else
85
-					$_SERVER['REQUEST_URI'] = $_SERVER['SCRIPT_NAME'] . $_SERVER['PATH_INFO'];
85
+					$_SERVER['REQUEST_URI'] = $_SERVER['SCRIPT_NAME'].$_SERVER['PATH_INFO'];
86 86
 			}
87 87
 
88 88
 			// Append the query string if it exists and isn't null
89
-			if ( ! empty( $_SERVER['QUERY_STRING'] ) ) {
90
-				$_SERVER['REQUEST_URI'] .= '?' . $_SERVER['QUERY_STRING'];
89
+			if ( ! empty($_SERVER['QUERY_STRING'])) {
90
+				$_SERVER['REQUEST_URI'] .= '?'.$_SERVER['QUERY_STRING'];
91 91
 			}
92 92
 		}
93 93
 	}
94 94
 
95 95
 	// Fix for PHP as CGI hosts that set SCRIPT_FILENAME to something ending in php.cgi for all requests
96
-	if ( isset( $_SERVER['SCRIPT_FILENAME'] ) && ( strpos( $_SERVER['SCRIPT_FILENAME'], 'php.cgi' ) == strlen( $_SERVER['SCRIPT_FILENAME'] ) - 7 ) )
96
+	if (isset($_SERVER['SCRIPT_FILENAME']) && (strpos($_SERVER['SCRIPT_FILENAME'], 'php.cgi') == strlen($_SERVER['SCRIPT_FILENAME']) - 7))
97 97
 		$_SERVER['SCRIPT_FILENAME'] = $_SERVER['PATH_TRANSLATED'];
98 98
 
99 99
 	// Fix for Dreamhost and other PHP as CGI hosts
100
-	if ( strpos( $_SERVER['SCRIPT_NAME'], 'php.cgi' ) !== false )
101
-		unset( $_SERVER['PATH_INFO'] );
100
+	if (strpos($_SERVER['SCRIPT_NAME'], 'php.cgi') !== false)
101
+		unset($_SERVER['PATH_INFO']);
102 102
 
103 103
 	// Fix empty PHP_SELF
104 104
 	$PHP_SELF = $_SERVER['PHP_SELF'];
105
-	if ( empty( $PHP_SELF ) )
106
-		$_SERVER['PHP_SELF'] = $PHP_SELF = preg_replace( '/(\?.*)?$/', '', $_SERVER["REQUEST_URI"] );
105
+	if (empty($PHP_SELF))
106
+		$_SERVER['PHP_SELF'] = $PHP_SELF = preg_replace('/(\?.*)?$/', '', $_SERVER["REQUEST_URI"]);
107 107
 }
108 108
 
109 109
 /**
@@ -122,23 +122,23 @@  discard block
 block discarded – undo
122 122
 	global $required_php_version, $wp_version;
123 123
 	$php_version = phpversion();
124 124
 
125
-	if ( version_compare( $required_php_version, $php_version, '>' ) ) {
125
+	if (version_compare($required_php_version, $php_version, '>')) {
126 126
 		wp_load_translations_early();
127 127
 
128 128
 		$protocol = wp_get_server_protocol();
129
-		header( sprintf( '%s 500 Internal Server Error', $protocol ), true, 500 );
130
-		header( 'Content-Type: text/html; charset=utf-8' );
129
+		header(sprintf('%s 500 Internal Server Error', $protocol), true, 500);
130
+		header('Content-Type: text/html; charset=utf-8');
131 131
 		/* translators: 1: Current PHP version number, 2: WordPress version number, 3: Minimum required PHP version number */
132
-		die( sprintf( __( 'Your server is running PHP version %1$s but WordPress %2$s requires at least %3$s.' ), $php_version, $wp_version, $required_php_version ) );
132
+		die(sprintf(__('Your server is running PHP version %1$s but WordPress %2$s requires at least %3$s.'), $php_version, $wp_version, $required_php_version));
133 133
 	}
134 134
 
135
-	if ( ! extension_loaded( 'mysql' ) && ! extension_loaded( 'mysqli' ) && ! extension_loaded( 'mysqlnd' ) && ! file_exists( WP_CONTENT_DIR . '/db.php' ) ) {
135
+	if ( ! extension_loaded('mysql') && ! extension_loaded('mysqli') && ! extension_loaded('mysqlnd') && ! file_exists(WP_CONTENT_DIR.'/db.php')) {
136 136
 		wp_load_translations_early();
137 137
 
138 138
 		$protocol = wp_get_server_protocol();
139
-		header( sprintf( '%s 500 Internal Server Error', $protocol ), true, 500 );
140
-		header( 'Content-Type: text/html; charset=utf-8' );
141
-		die( __( 'Your PHP installation appears to be missing the MySQL extension which is required by WordPress.' ) );
139
+		header(sprintf('%s 500 Internal Server Error', $protocol), true, 500);
140
+		header('Content-Type: text/html; charset=utf-8');
141
+		die(__('Your PHP installation appears to be missing the MySQL extension which is required by WordPress.'));
142 142
 	}
143 143
 }
144 144
 
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
  * @since 3.0.0
151 151
  */
152 152
 function wp_favicon_request() {
153
-	if ( '/favicon.ico' == $_SERVER['REQUEST_URI'] ) {
153
+	if ('/favicon.ico' == $_SERVER['REQUEST_URI']) {
154 154
 		header('Content-Type: image/vnd.microsoft.icon');
155 155
 		exit;
156 156
 	}
@@ -173,14 +173,14 @@  discard block
 block discarded – undo
173 173
  * @global int $upgrading the unix timestamp marking when upgrading WordPress began.
174 174
  */
175 175
 function wp_maintenance() {
176
-	if ( ! file_exists( ABSPATH . '.maintenance' ) || wp_installing() )
176
+	if ( ! file_exists(ABSPATH.'.maintenance') || wp_installing())
177 177
 		return;
178 178
 
179 179
 	global $upgrading;
180 180
 
181
-	include( ABSPATH . '.maintenance' );
181
+	include(ABSPATH.'.maintenance');
182 182
 	// If the $upgrading timestamp is older than 10 minutes, don't die.
183
-	if ( ( time() - $upgrading ) >= 600 )
183
+	if ((time() - $upgrading) >= 600)
184 184
 		return;
185 185
 
186 186
 	/**
@@ -196,31 +196,31 @@  discard block
 block discarded – undo
196 196
 	 * @param bool $enable_checks Whether to enable maintenance mode. Default true.
197 197
 	 * @param int  $upgrading     The timestamp set in the .maintenance file.
198 198
 	 */
199
-	if ( ! apply_filters( 'enable_maintenance_mode', true, $upgrading ) ) {
199
+	if ( ! apply_filters('enable_maintenance_mode', true, $upgrading)) {
200 200
 		return;
201 201
 	}
202 202
 
203
-	if ( file_exists( WP_CONTENT_DIR . '/maintenance.php' ) ) {
204
-		require_once( WP_CONTENT_DIR . '/maintenance.php' );
203
+	if (file_exists(WP_CONTENT_DIR.'/maintenance.php')) {
204
+		require_once(WP_CONTENT_DIR.'/maintenance.php');
205 205
 		die();
206 206
 	}
207 207
 
208 208
 	wp_load_translations_early();
209 209
 
210 210
 	$protocol = wp_get_server_protocol();
211
-	header( "$protocol 503 Service Unavailable", true, 503 );
212
-	header( 'Content-Type: text/html; charset=utf-8' );
213
-	header( 'Retry-After: 600' );
211
+	header("$protocol 503 Service Unavailable", true, 503);
212
+	header('Content-Type: text/html; charset=utf-8');
213
+	header('Retry-After: 600');
214 214
 ?>
215 215
 	<!DOCTYPE html>
216
-	<html xmlns="http://www.w3.org/1999/xhtml"<?php if ( is_rtl() ) echo ' dir="rtl"'; ?>>
216
+	<html xmlns="http://www.w3.org/1999/xhtml"<?php if (is_rtl()) echo ' dir="rtl"'; ?>>
217 217
 	<head>
218 218
 	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
219
-		<title><?php _e( 'Maintenance' ); ?></title>
219
+		<title><?php _e('Maintenance'); ?></title>
220 220
 
221 221
 	</head>
222 222
 	<body>
223
-		<h1><?php _e( 'Briefly unavailable for scheduled maintenance. Check back in a minute.' ); ?></h1>
223
+		<h1><?php _e('Briefly unavailable for scheduled maintenance. Check back in a minute.'); ?></h1>
224 224
 	</body>
225 225
 	</html>
226 226
 <?php
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
  */
241 241
 function timer_start() {
242 242
 	global $timestart;
243
-	$timestart = microtime( true );
243
+	$timestart = microtime(true);
244 244
 	return true;
245 245
 }
246 246
 
@@ -259,12 +259,12 @@  discard block
 block discarded – undo
259 259
  * @return string The "second.microsecond" finished time calculation. The number is formatted
260 260
  *                for human consumption, both localized and rounded.
261 261
  */
262
-function timer_stop( $display = 0, $precision = 3 ) {
262
+function timer_stop($display = 0, $precision = 3) {
263 263
 	global $timestart, $timeend;
264
-	$timeend = microtime( true );
264
+	$timeend = microtime(true);
265 265
 	$timetotal = $timeend - $timestart;
266
-	$r = ( function_exists( 'number_format_i18n' ) ) ? number_format_i18n( $timetotal, $precision ) : number_format( $timetotal, $precision );
267
-	if ( $display )
266
+	$r = (function_exists('number_format_i18n')) ? number_format_i18n($timetotal, $precision) : number_format($timetotal, $precision);
267
+	if ($display)
268 268
 		echo $r;
269 269
 	return $r;
270 270
 }
@@ -313,28 +313,28 @@  discard block
 block discarded – undo
313 313
 	 *
314 314
 	 * @param bool $enable_debug_mode Whether to enable debug mode checks to occur. Default true.
315 315
 	 */
316
-	if ( ! apply_filters( 'enable_wp_debug_mode_checks', true ) ){
316
+	if ( ! apply_filters('enable_wp_debug_mode_checks', true)) {
317 317
 		return;
318 318
 	}
319 319
 
320
-	if ( WP_DEBUG ) {
321
-		error_reporting( E_ALL );
320
+	if (WP_DEBUG) {
321
+		error_reporting(E_ALL);
322 322
 
323
-		if ( WP_DEBUG_DISPLAY )
324
-			ini_set( 'display_errors', 1 );
325
-		elseif ( null !== WP_DEBUG_DISPLAY )
326
-			ini_set( 'display_errors', 0 );
323
+		if (WP_DEBUG_DISPLAY)
324
+			ini_set('display_errors', 1);
325
+		elseif (null !== WP_DEBUG_DISPLAY)
326
+			ini_set('display_errors', 0);
327 327
 
328
-		if ( WP_DEBUG_LOG ) {
329
-			ini_set( 'log_errors', 1 );
330
-			ini_set( 'error_log', WP_CONTENT_DIR . '/debug.log' );
328
+		if (WP_DEBUG_LOG) {
329
+			ini_set('log_errors', 1);
330
+			ini_set('error_log', WP_CONTENT_DIR.'/debug.log');
331 331
 		}
332 332
 	} else {
333
-		error_reporting( E_CORE_ERROR | E_CORE_WARNING | E_COMPILE_ERROR | E_ERROR | E_WARNING | E_PARSE | E_USER_ERROR | E_USER_WARNING | E_RECOVERABLE_ERROR );
333
+		error_reporting(E_CORE_ERROR | E_CORE_WARNING | E_COMPILE_ERROR | E_ERROR | E_WARNING | E_PARSE | E_USER_ERROR | E_USER_WARNING | E_RECOVERABLE_ERROR);
334 334
 	}
335 335
 
336
-	if ( defined( 'XMLRPC_REQUEST' ) || defined( 'REST_REQUEST' ) || ( defined( 'WP_INSTALLING' ) && WP_INSTALLING ) || wp_doing_ajax() ) {
337
-		@ini_set( 'display_errors', 0 );
336
+	if (defined('XMLRPC_REQUEST') || defined('REST_REQUEST') || (defined('WP_INSTALLING') && WP_INSTALLING) || wp_doing_ajax()) {
337
+		@ini_set('display_errors', 0);
338 338
 	}
339 339
 }
340 340
 
@@ -352,8 +352,8 @@  discard block
 block discarded – undo
352 352
  * @access private
353 353
  */
354 354
 function wp_set_lang_dir() {
355
-	if ( !defined( 'WP_LANG_DIR' ) ) {
356
-		if ( file_exists( WP_CONTENT_DIR . '/languages' ) && @is_dir( WP_CONTENT_DIR . '/languages' ) || !@is_dir(ABSPATH . WPINC . '/languages') ) {
355
+	if ( ! defined('WP_LANG_DIR')) {
356
+		if (file_exists(WP_CONTENT_DIR.'/languages') && @is_dir(WP_CONTENT_DIR.'/languages') || ! @is_dir(ABSPATH.WPINC.'/languages')) {
357 357
 			/**
358 358
 			 * Server path of the language directory.
359 359
 			 *
@@ -361,10 +361,10 @@  discard block
 block discarded – undo
361 361
 			 *
362 362
 			 * @since 2.1.0
363 363
 			 */
364
-			define( 'WP_LANG_DIR', WP_CONTENT_DIR . '/languages' );
365
-			if ( !defined( 'LANGDIR' ) ) {
364
+			define('WP_LANG_DIR', WP_CONTENT_DIR.'/languages');
365
+			if ( ! defined('LANGDIR')) {
366 366
 				// Old static relative path maintained for limited backward compatibility - won't work in some cases.
367
-				define( 'LANGDIR', 'wp-content/languages' );
367
+				define('LANGDIR', 'wp-content/languages');
368 368
 			}
369 369
 		} else {
370 370
 			/**
@@ -374,10 +374,10 @@  discard block
 block discarded – undo
374 374
 			 *
375 375
 			 * @since 2.1.0
376 376
 			 */
377
-			define( 'WP_LANG_DIR', ABSPATH . WPINC . '/languages' );
378
-			if ( !defined( 'LANGDIR' ) ) {
377
+			define('WP_LANG_DIR', ABSPATH.WPINC.'/languages');
378
+			if ( ! defined('LANGDIR')) {
379 379
 				// Old relative path maintained for backward compatibility.
380
-				define( 'LANGDIR', WPINC . '/languages' );
380
+				define('LANGDIR', WPINC.'/languages');
381 381
 			}
382 382
 		}
383 383
 	}
@@ -393,15 +393,15 @@  discard block
 block discarded – undo
393 393
 function require_wp_db() {
394 394
 	global $wpdb;
395 395
 
396
-	require_once( ABSPATH . WPINC . '/wp-db.php' );
397
-	if ( file_exists( WP_CONTENT_DIR . '/db.php' ) )
398
-		require_once( WP_CONTENT_DIR . '/db.php' );
396
+	require_once(ABSPATH.WPINC.'/wp-db.php');
397
+	if (file_exists(WP_CONTENT_DIR.'/db.php'))
398
+		require_once(WP_CONTENT_DIR.'/db.php');
399 399
 
400
-	if ( isset( $wpdb ) ) {
400
+	if (isset($wpdb)) {
401 401
 		return;
402 402
 	}
403 403
 
404
-	$wpdb = new wpdb( DB_USER, DB_PASSWORD, DB_NAME, DB_HOST );
404
+	$wpdb = new wpdb(DB_USER, DB_PASSWORD, DB_NAME, DB_HOST);
405 405
 }
406 406
 
407 407
 /**
@@ -418,24 +418,24 @@  discard block
 block discarded – undo
418 418
  */
419 419
 function wp_set_wpdb_vars() {
420 420
 	global $wpdb, $table_prefix;
421
-	if ( !empty( $wpdb->error ) )
421
+	if ( ! empty($wpdb->error))
422 422
 		dead_db();
423 423
 
424
-	$wpdb->field_types = array( 'post_author' => '%d', 'post_parent' => '%d', 'menu_order' => '%d', 'term_id' => '%d', 'term_group' => '%d', 'term_taxonomy_id' => '%d',
425
-		'parent' => '%d', 'count' => '%d','object_id' => '%d', 'term_order' => '%d', 'ID' => '%d', 'comment_ID' => '%d', 'comment_post_ID' => '%d', 'comment_parent' => '%d',
424
+	$wpdb->field_types = array('post_author' => '%d', 'post_parent' => '%d', 'menu_order' => '%d', 'term_id' => '%d', 'term_group' => '%d', 'term_taxonomy_id' => '%d',
425
+		'parent' => '%d', 'count' => '%d', 'object_id' => '%d', 'term_order' => '%d', 'ID' => '%d', 'comment_ID' => '%d', 'comment_post_ID' => '%d', 'comment_parent' => '%d',
426 426
 		'user_id' => '%d', 'link_id' => '%d', 'link_owner' => '%d', 'link_rating' => '%d', 'option_id' => '%d', 'blog_id' => '%d', 'meta_id' => '%d', 'post_id' => '%d',
427 427
 		'user_status' => '%d', 'umeta_id' => '%d', 'comment_karma' => '%d', 'comment_count' => '%d',
428 428
 		// multisite:
429 429
 		'active' => '%d', 'cat_id' => '%d', 'deleted' => '%d', 'lang_id' => '%d', 'mature' => '%d', 'public' => '%d', 'site_id' => '%d', 'spam' => '%d',
430 430
 	);
431 431
 
432
-	$prefix = $wpdb->set_prefix( $table_prefix );
432
+	$prefix = $wpdb->set_prefix($table_prefix);
433 433
 
434
-	if ( is_wp_error( $prefix ) ) {
434
+	if (is_wp_error($prefix)) {
435 435
 		wp_load_translations_early();
436 436
 		wp_die(
437 437
 			/* translators: 1: $table_prefix 2: wp-config.php */
438
-			sprintf( __( '<strong>ERROR</strong>: %1$s in %2$s can only contain numbers, letters, and underscores.' ),
438
+			sprintf(__('<strong>ERROR</strong>: %1$s in %2$s can only contain numbers, letters, and underscores.'),
439 439
 				'<code>$table_prefix</code>',
440 440
 				'<code>wp-config.php</code>'
441 441
 			)
@@ -454,10 +454,10 @@  discard block
 block discarded – undo
454 454
  * @param bool $using Whether external object cache is being used.
455 455
  * @return bool The current 'using' setting.
456 456
  */
457
-function wp_using_ext_object_cache( $using = null ) {
457
+function wp_using_ext_object_cache($using = null) {
458 458
 	global $_wp_using_ext_object_cache;
459 459
 	$current_using = $_wp_using_ext_object_cache;
460
-	if ( null !== $using )
460
+	if (null !== $using)
461 461
 		$_wp_using_ext_object_cache = $using;
462 462
 	return $current_using;
463 463
 }
@@ -475,32 +475,32 @@  discard block
 block discarded – undo
475 475
 	global $wp_filter;
476 476
 
477 477
 	$first_init = false;
478
- 	if ( ! function_exists( 'wp_cache_init' ) ) {
479
-		if ( file_exists( WP_CONTENT_DIR . '/object-cache.php' ) ) {
480
-			require_once ( WP_CONTENT_DIR . '/object-cache.php' );
481
-			if ( function_exists( 'wp_cache_init' ) ) {
482
-				wp_using_ext_object_cache( true );
478
+ 	if ( ! function_exists('wp_cache_init')) {
479
+		if (file_exists(WP_CONTENT_DIR.'/object-cache.php')) {
480
+			require_once (WP_CONTENT_DIR.'/object-cache.php');
481
+			if (function_exists('wp_cache_init')) {
482
+				wp_using_ext_object_cache(true);
483 483
 			}
484 484
 
485 485
 			// Re-initialize any hooks added manually by object-cache.php
486
-			if ( $wp_filter ) {
487
-				$wp_filter = WP_Hook::build_preinitialized_hooks( $wp_filter );
486
+			if ($wp_filter) {
487
+				$wp_filter = WP_Hook::build_preinitialized_hooks($wp_filter);
488 488
 			}
489 489
 		}
490 490
 
491 491
 		$first_init = true;
492
-	} elseif ( ! wp_using_ext_object_cache() && file_exists( WP_CONTENT_DIR . '/object-cache.php' ) ) {
492
+	} elseif ( ! wp_using_ext_object_cache() && file_exists(WP_CONTENT_DIR.'/object-cache.php')) {
493 493
 		/*
494 494
 		 * Sometimes advanced-cache.php can load object-cache.php before
495 495
 		 * it is loaded here. This breaks the function_exists check above
496 496
 		 * and can result in `$_wp_using_ext_object_cache` being set
497 497
 		 * incorrectly. Double check if an external cache exists.
498 498
 		 */
499
-		wp_using_ext_object_cache( true );
499
+		wp_using_ext_object_cache(true);
500 500
 	}
501 501
 
502
-	if ( ! wp_using_ext_object_cache() ) {
503
-		require_once ( ABSPATH . WPINC . '/cache.php' );
502
+	if ( ! wp_using_ext_object_cache()) {
503
+		require_once (ABSPATH.WPINC.'/cache.php');
504 504
 	}
505 505
 
506 506
 	/*
@@ -508,15 +508,15 @@  discard block
 block discarded – undo
508 508
 	 * initialized. Reset signals to the cache that global IDs
509 509
 	 * have changed and it may need to update keys and cleanup caches.
510 510
 	 */
511
-	if ( ! $first_init && function_exists( 'wp_cache_switch_to_blog' ) ) {
512
-		wp_cache_switch_to_blog( get_current_blog_id() );
513
-	} elseif ( function_exists( 'wp_cache_init' ) ) {
511
+	if ( ! $first_init && function_exists('wp_cache_switch_to_blog')) {
512
+		wp_cache_switch_to_blog(get_current_blog_id());
513
+	} elseif (function_exists('wp_cache_init')) {
514 514
 		wp_cache_init();
515 515
 	}
516 516
 
517
-	if ( function_exists( 'wp_cache_add_global_groups' ) ) {
518
-		wp_cache_add_global_groups( array( 'users', 'userlogins', 'usermeta', 'user_meta', 'useremail', 'userslugs', 'site-transient', 'site-options', 'blog-lookup', 'blog-details', 'site-details', 'rss', 'global-posts', 'blog-id-cache', 'networks', 'sites' ) );
519
-		wp_cache_add_non_persistent_groups( array( 'counts', 'plugins' ) );
517
+	if (function_exists('wp_cache_add_global_groups')) {
518
+		wp_cache_add_global_groups(array('users', 'userlogins', 'usermeta', 'user_meta', 'useremail', 'userslugs', 'site-transient', 'site-options', 'blog-lookup', 'blog-details', 'site-details', 'rss', 'global-posts', 'blog-id-cache', 'networks', 'sites'));
519
+		wp_cache_add_non_persistent_groups(array('counts', 'plugins'));
520 520
 	}
521 521
 }
522 522
 
@@ -529,22 +529,22 @@  discard block
 block discarded – undo
529 529
  * @access private
530 530
  */
531 531
 function wp_not_installed() {
532
-	if ( is_multisite() ) {
533
-		if ( ! is_blog_installed() && ! wp_installing() ) {
532
+	if (is_multisite()) {
533
+		if ( ! is_blog_installed() && ! wp_installing()) {
534 534
 			nocache_headers();
535 535
 
536
-			wp_die( __( 'The site you have requested is not installed properly. Please contact the system administrator.' ) );
536
+			wp_die(__('The site you have requested is not installed properly. Please contact the system administrator.'));
537 537
 		}
538
-	} elseif ( ! is_blog_installed() && ! wp_installing() ) {
538
+	} elseif ( ! is_blog_installed() && ! wp_installing()) {
539 539
 		nocache_headers();
540 540
 
541
-		require( ABSPATH . WPINC . '/kses.php' );
542
-		require( ABSPATH . WPINC . '/pluggable.php' );
543
-		require( ABSPATH . WPINC . '/formatting.php' );
541
+		require(ABSPATH.WPINC.'/kses.php');
542
+		require(ABSPATH.WPINC.'/pluggable.php');
543
+		require(ABSPATH.WPINC.'/formatting.php');
544 544
 
545
-		$link = wp_guess_url() . '/wp-admin/install.php';
545
+		$link = wp_guess_url().'/wp-admin/install.php';
546 546
 
547
-		wp_redirect( $link );
547
+		wp_redirect($link);
548 548
 		die();
549 549
 	}
550 550
 }
@@ -563,16 +563,16 @@  discard block
 block discarded – undo
563 563
  */
564 564
 function wp_get_mu_plugins() {
565 565
 	$mu_plugins = array();
566
-	if ( !is_dir( WPMU_PLUGIN_DIR ) )
566
+	if ( ! is_dir(WPMU_PLUGIN_DIR))
567 567
 		return $mu_plugins;
568
-	if ( ! $dh = opendir( WPMU_PLUGIN_DIR ) )
568
+	if ( ! $dh = opendir(WPMU_PLUGIN_DIR))
569 569
 		return $mu_plugins;
570
-	while ( ( $plugin = readdir( $dh ) ) !== false ) {
571
-		if ( substr( $plugin, -4 ) == '.php' )
572
-			$mu_plugins[] = WPMU_PLUGIN_DIR . '/' . $plugin;
570
+	while (($plugin = readdir($dh)) !== false) {
571
+		if (substr($plugin, -4) == '.php')
572
+			$mu_plugins[] = WPMU_PLUGIN_DIR.'/'.$plugin;
573 573
 	}
574
-	closedir( $dh );
575
-	sort( $mu_plugins );
574
+	closedir($dh);
575
+	sort($mu_plugins);
576 576
 
577 577
 	return $mu_plugins;
578 578
 }
@@ -593,27 +593,27 @@  discard block
 block discarded – undo
593 593
  */
594 594
 function wp_get_active_and_valid_plugins() {
595 595
 	$plugins = array();
596
-	$active_plugins = (array) get_option( 'active_plugins', array() );
596
+	$active_plugins = (array) get_option('active_plugins', array());
597 597
 
598 598
 	// Check for hacks file if the option is enabled
599
-	if ( get_option( 'hack_file' ) && file_exists( ABSPATH . 'my-hacks.php' ) ) {
600
-		_deprecated_file( 'my-hacks.php', '1.5.0' );
601
-		array_unshift( $plugins, ABSPATH . 'my-hacks.php' );
599
+	if (get_option('hack_file') && file_exists(ABSPATH.'my-hacks.php')) {
600
+		_deprecated_file('my-hacks.php', '1.5.0');
601
+		array_unshift($plugins, ABSPATH.'my-hacks.php');
602 602
 	}
603 603
 
604
-	if ( empty( $active_plugins ) || wp_installing() )
604
+	if (empty($active_plugins) || wp_installing())
605 605
 		return $plugins;
606 606
 
607 607
 	$network_plugins = is_multisite() ? wp_get_active_network_plugins() : false;
608 608
 
609
-	foreach ( $active_plugins as $plugin ) {
610
-		if ( ! validate_file( $plugin ) // $plugin must validate as file
611
-			&& '.php' == substr( $plugin, -4 ) // $plugin must end with '.php'
612
-			&& file_exists( WP_PLUGIN_DIR . '/' . $plugin ) // $plugin must exist
609
+	foreach ($active_plugins as $plugin) {
610
+		if ( ! validate_file($plugin) // $plugin must validate as file
611
+			&& '.php' == substr($plugin, -4) // $plugin must end with '.php'
612
+			&& file_exists(WP_PLUGIN_DIR.'/'.$plugin) // $plugin must exist
613 613
 			// not already included as a network plugin
614
-			&& ( ! $network_plugins || ! in_array( WP_PLUGIN_DIR . '/' . $plugin, $network_plugins ) )
614
+			&& ( ! $network_plugins || ! in_array(WP_PLUGIN_DIR.'/'.$plugin, $network_plugins))
615 615
 			)
616
-		$plugins[] = WP_PLUGIN_DIR . '/' . $plugin;
616
+		$plugins[] = WP_PLUGIN_DIR.'/'.$plugin;
617 617
 	}
618 618
 	return $plugins;
619 619
 }
@@ -628,10 +628,10 @@  discard block
 block discarded – undo
628 628
  * @access private
629 629
  */
630 630
 function wp_set_internal_encoding() {
631
-	if ( function_exists( 'mb_internal_encoding' ) ) {
632
-		$charset = get_option( 'blog_charset' );
633
-		if ( ! $charset || ! @mb_internal_encoding( $charset ) )
634
-			mb_internal_encoding( 'UTF-8' );
631
+	if (function_exists('mb_internal_encoding')) {
632
+		$charset = get_option('blog_charset');
633
+		if ( ! $charset || ! @mb_internal_encoding($charset))
634
+			mb_internal_encoding('UTF-8');
635 635
 	}
636 636
 }
637 637
 
@@ -646,20 +646,20 @@  discard block
 block discarded – undo
646 646
  */
647 647
 function wp_magic_quotes() {
648 648
 	// If already slashed, strip.
649
-	if ( get_magic_quotes_gpc() ) {
650
-		$_GET    = stripslashes_deep( $_GET    );
651
-		$_POST   = stripslashes_deep( $_POST   );
652
-		$_COOKIE = stripslashes_deep( $_COOKIE );
649
+	if (get_magic_quotes_gpc()) {
650
+		$_GET    = stripslashes_deep($_GET);
651
+		$_POST   = stripslashes_deep($_POST);
652
+		$_COOKIE = stripslashes_deep($_COOKIE);
653 653
 	}
654 654
 
655 655
 	// Escape with wpdb.
656
-	$_GET    = add_magic_quotes( $_GET    );
657
-	$_POST   = add_magic_quotes( $_POST   );
658
-	$_COOKIE = add_magic_quotes( $_COOKIE );
659
-	$_SERVER = add_magic_quotes( $_SERVER );
656
+	$_GET    = add_magic_quotes($_GET);
657
+	$_POST   = add_magic_quotes($_POST);
658
+	$_COOKIE = add_magic_quotes($_COOKIE);
659
+	$_SERVER = add_magic_quotes($_SERVER);
660 660
 
661 661
 	// Force REQUEST to be GET + POST.
662
-	$_REQUEST = array_merge( $_GET, $_POST );
662
+	$_REQUEST = array_merge($_GET, $_POST);
663 663
 }
664 664
 
665 665
 /**
@@ -674,7 +674,7 @@  discard block
 block discarded – undo
674 674
 	 *
675 675
 	 * @since 1.2.0
676 676
 	 */
677
-	do_action( 'shutdown' );
677
+	do_action('shutdown');
678 678
 
679 679
 	wp_cache_close();
680 680
 }
@@ -688,9 +688,9 @@  discard block
 block discarded – undo
688 688
  * @param object $object The object to clone.
689 689
  * @return object The cloned object.
690 690
  */
691
-function wp_clone( $object ) {
691
+function wp_clone($object) {
692 692
 	// Use parens for clone to accommodate PHP 4. See #17880
693
-	return clone( $object );
693
+	return clone($object);
694 694
 }
695 695
 
696 696
 /**
@@ -706,9 +706,9 @@  discard block
 block discarded – undo
706 706
  * @return bool True if inside WordPress administration interface, false otherwise.
707 707
  */
708 708
 function is_admin() {
709
-	if ( isset( $GLOBALS['current_screen'] ) )
709
+	if (isset($GLOBALS['current_screen']))
710 710
 		return $GLOBALS['current_screen']->in_admin();
711
-	elseif ( defined( 'WP_ADMIN' ) )
711
+	elseif (defined('WP_ADMIN'))
712 712
 		return WP_ADMIN;
713 713
 
714 714
 	return false;
@@ -729,9 +729,9 @@  discard block
 block discarded – undo
729 729
  * @return bool True if inside WordPress blog administration pages.
730 730
  */
731 731
 function is_blog_admin() {
732
-	if ( isset( $GLOBALS['current_screen'] ) )
733
-		return $GLOBALS['current_screen']->in_admin( 'site' );
734
-	elseif ( defined( 'WP_BLOG_ADMIN' ) )
732
+	if (isset($GLOBALS['current_screen']))
733
+		return $GLOBALS['current_screen']->in_admin('site');
734
+	elseif (defined('WP_BLOG_ADMIN'))
735 735
 		return WP_BLOG_ADMIN;
736 736
 
737 737
 	return false;
@@ -752,9 +752,9 @@  discard block
 block discarded – undo
752 752
  * @return bool True if inside WordPress network administration pages.
753 753
  */
754 754
 function is_network_admin() {
755
-	if ( isset( $GLOBALS['current_screen'] ) )
756
-		return $GLOBALS['current_screen']->in_admin( 'network' );
757
-	elseif ( defined( 'WP_NETWORK_ADMIN' ) )
755
+	if (isset($GLOBALS['current_screen']))
756
+		return $GLOBALS['current_screen']->in_admin('network');
757
+	elseif (defined('WP_NETWORK_ADMIN'))
758 758
 		return WP_NETWORK_ADMIN;
759 759
 
760 760
 	return false;
@@ -776,9 +776,9 @@  discard block
 block discarded – undo
776 776
  * @return bool True if inside WordPress user administration pages.
777 777
  */
778 778
 function is_user_admin() {
779
-	if ( isset( $GLOBALS['current_screen'] ) )
780
-		return $GLOBALS['current_screen']->in_admin( 'user' );
781
-	elseif ( defined( 'WP_USER_ADMIN' ) )
779
+	if (isset($GLOBALS['current_screen']))
780
+		return $GLOBALS['current_screen']->in_admin('user');
781
+	elseif (defined('WP_USER_ADMIN'))
782 782
 		return WP_USER_ADMIN;
783 783
 
784 784
 	return false;
@@ -792,10 +792,10 @@  discard block
 block discarded – undo
792 792
  * @return bool True if Multisite is enabled, false otherwise.
793 793
  */
794 794
 function is_multisite() {
795
-	if ( defined( 'MULTISITE' ) )
795
+	if (defined('MULTISITE'))
796 796
 		return MULTISITE;
797 797
 
798
-	if ( defined( 'SUBDOMAIN_INSTALL' ) || defined( 'VHOST' ) || defined( 'SUNRISE' ) )
798
+	if (defined('SUBDOMAIN_INSTALL') || defined('VHOST') || defined('SUNRISE'))
799 799
 		return true;
800 800
 
801 801
 	return false;
@@ -823,17 +823,17 @@  discard block
 block discarded – undo
823 823
  * @return int The ID of the current network.
824 824
  */
825 825
 function get_current_network_id() {
826
-	if ( ! is_multisite() ) {
826
+	if ( ! is_multisite()) {
827 827
 		return 1;
828 828
 	}
829 829
 
830 830
 	$current_network = get_network();
831 831
 
832
-	if ( ! isset( $current_network->id ) ) {
832
+	if ( ! isset($current_network->id)) {
833 833
 		return get_main_network_id();
834 834
 	}
835 835
 
836
-	return absint( $current_network->id );
836
+	return absint($current_network->id);
837 837
 }
838 838
 
839 839
 /**
@@ -857,63 +857,63 @@  discard block
 block discarded – undo
857 857
 	global $wp_locale;
858 858
 
859 859
 	static $loaded = false;
860
-	if ( $loaded )
860
+	if ($loaded)
861 861
 		return;
862 862
 	$loaded = true;
863 863
 
864
-	if ( function_exists( 'did_action' ) && did_action( 'init' ) )
864
+	if (function_exists('did_action') && did_action('init'))
865 865
 		return;
866 866
 
867 867
 	// We need $wp_local_package
868
-	require ABSPATH . WPINC . '/version.php';
868
+	require ABSPATH.WPINC.'/version.php';
869 869
 
870 870
 	// Translation and localization
871
-	require_once ABSPATH . WPINC . '/pomo/mo.php';
872
-	require_once ABSPATH . WPINC . '/l10n.php';
873
-	require_once ABSPATH . WPINC . '/class-wp-locale.php';
874
-	require_once ABSPATH . WPINC . '/class-wp-locale-switcher.php';
871
+	require_once ABSPATH.WPINC.'/pomo/mo.php';
872
+	require_once ABSPATH.WPINC.'/l10n.php';
873
+	require_once ABSPATH.WPINC.'/class-wp-locale.php';
874
+	require_once ABSPATH.WPINC.'/class-wp-locale-switcher.php';
875 875
 
876 876
 	// General libraries
877
-	require_once ABSPATH . WPINC . '/plugin.php';
877
+	require_once ABSPATH.WPINC.'/plugin.php';
878 878
 
879 879
 	$locales = $locations = array();
880 880
 
881
-	while ( true ) {
882
-		if ( defined( 'WPLANG' ) ) {
883
-			if ( '' == WPLANG )
881
+	while (true) {
882
+		if (defined('WPLANG')) {
883
+			if ('' == WPLANG)
884 884
 				break;
885 885
 			$locales[] = WPLANG;
886 886
 		}
887 887
 
888
-		if ( isset( $wp_local_package ) )
888
+		if (isset($wp_local_package))
889 889
 			$locales[] = $wp_local_package;
890 890
 
891
-		if ( ! $locales )
891
+		if ( ! $locales)
892 892
 			break;
893 893
 
894
-		if ( defined( 'WP_LANG_DIR' ) && @is_dir( WP_LANG_DIR ) )
894
+		if (defined('WP_LANG_DIR') && @is_dir(WP_LANG_DIR))
895 895
 			$locations[] = WP_LANG_DIR;
896 896
 
897
-		if ( defined( 'WP_CONTENT_DIR' ) && @is_dir( WP_CONTENT_DIR . '/languages' ) )
898
-			$locations[] = WP_CONTENT_DIR . '/languages';
897
+		if (defined('WP_CONTENT_DIR') && @is_dir(WP_CONTENT_DIR.'/languages'))
898
+			$locations[] = WP_CONTENT_DIR.'/languages';
899 899
 
900
-		if ( @is_dir( ABSPATH . 'wp-content/languages' ) )
901
-			$locations[] = ABSPATH . 'wp-content/languages';
900
+		if (@is_dir(ABSPATH.'wp-content/languages'))
901
+			$locations[] = ABSPATH.'wp-content/languages';
902 902
 
903
-		if ( @is_dir( ABSPATH . WPINC . '/languages' ) )
904
-			$locations[] = ABSPATH . WPINC . '/languages';
903
+		if (@is_dir(ABSPATH.WPINC.'/languages'))
904
+			$locations[] = ABSPATH.WPINC.'/languages';
905 905
 
906
-		if ( ! $locations )
906
+		if ( ! $locations)
907 907
 			break;
908 908
 
909
-		$locations = array_unique( $locations );
909
+		$locations = array_unique($locations);
910 910
 
911
-		foreach ( $locales as $locale ) {
912
-			foreach ( $locations as $location ) {
913
-				if ( file_exists( $location . '/' . $locale . '.mo' ) ) {
914
-					load_textdomain( 'default', $location . '/' . $locale . '.mo' );
915
-					if ( defined( 'WP_SETUP_CONFIG' ) && file_exists( $location . '/admin-' . $locale . '.mo' ) )
916
-						load_textdomain( 'default', $location . '/admin-' . $locale . '.mo' );
911
+		foreach ($locales as $locale) {
912
+			foreach ($locations as $location) {
913
+				if (file_exists($location.'/'.$locale.'.mo')) {
914
+					load_textdomain('default', $location.'/'.$locale.'.mo');
915
+					if (defined('WP_SETUP_CONFIG') && file_exists($location.'/admin-'.$locale.'.mo'))
916
+						load_textdomain('default', $location.'/admin-'.$locale.'.mo');
917 917
 					break 2;
918 918
 				}
919 919
 			}
@@ -939,15 +939,15 @@  discard block
 block discarded – undo
939 939
  * @return bool True if WP is installing, otherwise false. When a `$is_installing` is passed, the function will
940 940
  *              report whether WP was in installing mode prior to the change to `$is_installing`.
941 941
  */
942
-function wp_installing( $is_installing = null ) {
942
+function wp_installing($is_installing = null) {
943 943
 	static $installing = null;
944 944
 
945 945
 	// Support for the `WP_INSTALLING` constant, defined before WP is loaded.
946
-	if ( is_null( $installing ) ) {
947
-		$installing = defined( 'WP_INSTALLING' ) && WP_INSTALLING;
946
+	if (is_null($installing)) {
947
+		$installing = defined('WP_INSTALLING') && WP_INSTALLING;
948 948
 	}
949 949
 
950
-	if ( ! is_null( $is_installing ) ) {
950
+	if ( ! is_null($is_installing)) {
951 951
 		$old_installing = $installing;
952 952
 		$installing = $is_installing;
953 953
 		return (bool) $old_installing;
@@ -965,15 +965,15 @@  discard block
 block discarded – undo
965 965
  * @return bool True if SSL, otherwise false.
966 966
  */
967 967
 function is_ssl() {
968
-	if ( isset( $_SERVER['HTTPS'] ) ) {
969
-		if ( 'on' == strtolower( $_SERVER['HTTPS'] ) ) {
968
+	if (isset($_SERVER['HTTPS'])) {
969
+		if ('on' == strtolower($_SERVER['HTTPS'])) {
970 970
 			return true;
971 971
 		}
972 972
 
973
-		if ( '1' == $_SERVER['HTTPS'] ) {
973
+		if ('1' == $_SERVER['HTTPS']) {
974 974
 			return true;
975 975
 		}
976
-	} elseif ( isset($_SERVER['SERVER_PORT'] ) && ( '443' == $_SERVER['SERVER_PORT'] ) ) {
976
+	} elseif (isset($_SERVER['SERVER_PORT']) && ('443' == $_SERVER['SERVER_PORT'])) {
977 977
 		return true;
978 978
 	}
979 979
 	return false;
@@ -991,20 +991,20 @@  discard block
 block discarded – undo
991 991
  * @param string $value A (PHP ini) byte value, either shorthand or ordinary.
992 992
  * @return int An integer byte value.
993 993
  */
994
-function wp_convert_hr_to_bytes( $value ) {
995
-	$value = strtolower( trim( $value ) );
994
+function wp_convert_hr_to_bytes($value) {
995
+	$value = strtolower(trim($value));
996 996
 	$bytes = (int) $value;
997 997
 
998
-	if ( false !== strpos( $value, 'g' ) ) {
998
+	if (false !== strpos($value, 'g')) {
999 999
 		$bytes *= GB_IN_BYTES;
1000
-	} elseif ( false !== strpos( $value, 'm' ) ) {
1000
+	} elseif (false !== strpos($value, 'm')) {
1001 1001
 		$bytes *= MB_IN_BYTES;
1002
-	} elseif ( false !== strpos( $value, 'k' ) ) {
1002
+	} elseif (false !== strpos($value, 'k')) {
1003 1003
 		$bytes *= KB_IN_BYTES;
1004 1004
 	}
1005 1005
 
1006 1006
 	// Deal with large (float) values which run into the maximum integer size.
1007
-	return min( $bytes, PHP_INT_MAX );
1007
+	return min($bytes, PHP_INT_MAX);
1008 1008
 }
1009 1009
 
1010 1010
 /**
@@ -1017,24 +1017,24 @@  discard block
 block discarded – undo
1017 1017
  * @param string $setting The name of the ini setting to check.
1018 1018
  * @return bool True if the value is changeable at runtime. False otherwise.
1019 1019
  */
1020
-function wp_is_ini_value_changeable( $setting ) {
1020
+function wp_is_ini_value_changeable($setting) {
1021 1021
 	static $ini_all;
1022 1022
 
1023
-	if ( ! isset( $ini_all ) ) {
1023
+	if ( ! isset($ini_all)) {
1024 1024
 		$ini_all = false;
1025 1025
 		// Sometimes `ini_get_all()` is disabled via the `disable_functions` option for "security purposes".
1026
-		if ( function_exists( 'ini_get_all' ) ) {
1026
+		if (function_exists('ini_get_all')) {
1027 1027
 			$ini_all = ini_get_all();
1028 1028
 		}
1029 1029
  	}
1030 1030
 
1031 1031
 	// Bit operator to workaround https://bugs.php.net/bug.php?id=44936 which changes access level to 63 in PHP 5.2.6 - 5.2.17.
1032
-	if ( isset( $ini_all[ $setting ]['access'] ) && ( INI_ALL === ( $ini_all[ $setting ]['access'] & 7 ) || INI_USER === ( $ini_all[ $setting ]['access'] & 7 ) ) ) {
1032
+	if (isset($ini_all[$setting]['access']) && (INI_ALL === ($ini_all[$setting]['access'] & 7) || INI_USER === ($ini_all[$setting]['access'] & 7))) {
1033 1033
 		return true;
1034 1034
 	}
1035 1035
 
1036 1036
 	// If we were unable to retrieve the details, fail gracefully to assume it's changeable.
1037
-	if ( ! is_array( $ini_all ) ) {
1037
+	if ( ! is_array($ini_all)) {
1038 1038
 		return true;
1039 1039
 	}
1040 1040
 
@@ -1056,7 +1056,7 @@  discard block
 block discarded – undo
1056 1056
 	 *
1057 1057
 	 * @param bool $wp_doing_ajax Whether the current request is a WordPress Ajax request.
1058 1058
 	 */
1059
-	return apply_filters( 'wp_doing_ajax', defined( 'DOING_AJAX' ) && DOING_AJAX );
1059
+	return apply_filters('wp_doing_ajax', defined('DOING_AJAX') && DOING_AJAX);
1060 1060
 }
1061 1061
 
1062 1062
 /**
@@ -1074,7 +1074,7 @@  discard block
 block discarded – undo
1074 1074
 	 *
1075 1075
 	 * @param bool $wp_doing_cron Whether the current request is a WordPress cron request.
1076 1076
 	 */
1077
-	return apply_filters( 'wp_doing_cron', defined( 'DOING_CRON' ) && DOING_CRON );
1077
+	return apply_filters('wp_doing_cron', defined('DOING_CRON') && DOING_CRON);
1078 1078
 }
1079 1079
 
1080 1080
 /**
@@ -1087,8 +1087,8 @@  discard block
 block discarded – undo
1087 1087
  * @param mixed $thing Check if unknown variable is a WP_Error object.
1088 1088
  * @return bool True, if WP_Error. False, if not WP_Error.
1089 1089
  */
1090
-function is_wp_error( $thing ) {
1091
-	return ( $thing instanceof WP_Error );
1090
+function is_wp_error($thing) {
1091
+	return ($thing instanceof WP_Error);
1092 1092
 }
1093 1093
 
1094 1094
 /**
@@ -1099,7 +1099,7 @@  discard block
 block discarded – undo
1099 1099
  * @param string $context The usage context.
1100 1100
  * @return bool True if file modification is allowed, false otherwise.
1101 1101
  */
1102
-function wp_is_file_mod_allowed( $context ) {
1102
+function wp_is_file_mod_allowed($context) {
1103 1103
 	/**
1104 1104
 	 * Filters whether file modifications are allowed.
1105 1105
 	 *
@@ -1108,5 +1108,5 @@  discard block
 block discarded – undo
1108 1108
 	 * @param bool   $file_mod_allowed Whether file modifications are allowed.
1109 1109
 	 * @param string $context          The usage context.
1110 1110
 	 */
1111
-	return apply_filters( 'file_mod_allowed', ! defined( 'DISALLOW_FILE_MODS' ) || ! DISALLOW_FILE_MODS, $context );
1111
+	return apply_filters('file_mod_allowed', ! defined('DISALLOW_FILE_MODS') || ! DISALLOW_FILE_MODS, $context);
1112 1112
 }
Please login to merge, or discard this patch.
src/wp-includes/pomo/mo.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -68,7 +68,7 @@
 block discarded – undo
68 68
 
69 69
 	/**
70 70
 	 * @param resource $fh
71
-	 * @return true
71
+	 * @return boolean
72 72
 	 */
73 73
 	function export_to_file_handle($fh) {
74 74
 		$entries = array_filter( $this->entries, array( $this, 'is_entry_good_for_export' ) );
Please login to merge, or discard this patch.
Spacing   +42 added lines, -42 removed lines patch added patch discarded remove patch
@@ -7,10 +7,10 @@  discard block
 block discarded – undo
7 7
  * @subpackage mo
8 8
  */
9 9
 
10
-require_once dirname(__FILE__) . '/translations.php';
11
-require_once dirname(__FILE__) . '/streams.php';
10
+require_once dirname(__FILE__).'/translations.php';
11
+require_once dirname(__FILE__).'/streams.php';
12 12
 
13
-if ( ! class_exists( 'MO', false ) ):
13
+if ( ! class_exists('MO', false)):
14 14
 class MO extends Gettext_Translations {
15 15
 
16 16
 	var $_nplurals = 2;
@@ -37,15 +37,15 @@  discard block
 block discarded – undo
37 37
 	 * @param string $filename MO file to load
38 38
 	 */
39 39
 	function import_from_file($filename) {
40
-		$reader = new POMO_FileReader( $filename );
40
+		$reader = new POMO_FileReader($filename);
41 41
 
42
-		if ( ! $reader->is_resource() ) {
42
+		if ( ! $reader->is_resource()) {
43 43
 			return false;
44 44
 		}
45 45
 
46 46
 		$this->filename = (string) $filename;
47 47
 
48
-		return $this->import_from_reader( $reader );
48
+		return $this->import_from_reader($reader);
49 49
 	}
50 50
 
51 51
 	/**
@@ -54,8 +54,8 @@  discard block
 block discarded – undo
54 54
 	 */
55 55
 	function export_to_file($filename) {
56 56
 		$fh = fopen($filename, 'wb');
57
-		if ( !$fh ) return false;
58
-		$res = $this->export_to_file_handle( $fh );
57
+		if ( ! $fh) return false;
58
+		$res = $this->export_to_file_handle($fh);
59 59
 		fclose($fh);
60 60
 		return $res;
61 61
 	}
@@ -65,22 +65,22 @@  discard block
 block discarded – undo
65 65
 	 */
66 66
 	function export() {
67 67
 		$tmp_fh = fopen("php://temp", 'r+');
68
-		if ( !$tmp_fh ) return false;
69
-		$this->export_to_file_handle( $tmp_fh );
70
-		rewind( $tmp_fh );
71
-		return stream_get_contents( $tmp_fh );
68
+		if ( ! $tmp_fh) return false;
69
+		$this->export_to_file_handle($tmp_fh);
70
+		rewind($tmp_fh);
71
+		return stream_get_contents($tmp_fh);
72 72
 	}
73 73
 
74 74
 	/**
75 75
 	 * @param Translation_Entry $entry
76 76
 	 * @return bool
77 77
 	 */
78
-	function is_entry_good_for_export( $entry ) {
79
-		if ( empty( $entry->translations ) ) {
78
+	function is_entry_good_for_export($entry) {
79
+		if (empty($entry->translations)) {
80 80
 			return false;
81 81
 		}
82 82
 
83
-		if ( !array_filter( $entry->translations ) ) {
83
+		if ( ! array_filter($entry->translations)) {
84 84
 			return false;
85 85
 		}
86 86
 
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
 	 * @return true
93 93
 	 */
94 94
 	function export_to_file_handle($fh) {
95
-		$entries = array_filter( $this->entries, array( $this, 'is_entry_good_for_export' ) );
95
+		$entries = array_filter($this->entries, array($this, 'is_entry_good_for_export'));
96 96
 		ksort($entries);
97 97
 		$magic = 0x950412de;
98 98
 		$revision = 0;
@@ -113,8 +113,8 @@  discard block
 block discarded – undo
113 113
 
114 114
 		$reader = new POMO_Reader();
115 115
 
116
-		foreach($entries as $entry) {
117
-			$originals_table .= $this->export_original($entry) . chr(0);
116
+		foreach ($entries as $entry) {
117
+			$originals_table .= $this->export_original($entry).chr(0);
118 118
 			$length = $reader->strlen($this->export_original($entry));
119 119
 			fwrite($fh, pack('VV', $length, $current_addr));
120 120
 			$current_addr += $length + 1; // account for the NULL byte after
@@ -123,10 +123,10 @@  discard block
 block discarded – undo
123 123
 		$exported_headers = $this->export_headers();
124 124
 		fwrite($fh, pack('VV', $reader->strlen($exported_headers), $current_addr));
125 125
 		$current_addr += strlen($exported_headers) + 1;
126
-		$translations_table = $exported_headers . chr(0);
126
+		$translations_table = $exported_headers.chr(0);
127 127
 
128
-		foreach($entries as $entry) {
129
-			$translations_table .= $this->export_translations($entry) . chr(0);
128
+		foreach ($entries as $entry) {
129
+			$translations_table .= $this->export_translations($entry).chr(0);
130 130
 			$length = $reader->strlen($this->export_translations($entry));
131 131
 			fwrite($fh, pack('VV', $length, $current_addr));
132 132
 			$current_addr += $length + 1;
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
 		//TODO: warnings for control characters
146 146
 		$exported = $entry->singular;
147 147
 		if ($entry->is_plural) $exported .= chr(0).$entry->plural;
148
-		if ($entry->context) $exported = $entry->context . chr(4) . $exported;
148
+		if ($entry->context) $exported = $entry->context.chr(4).$exported;
149 149
 		return $exported;
150 150
 	}
151 151
 
@@ -163,8 +163,8 @@  discard block
 block discarded – undo
163 163
 	 */
164 164
 	function export_headers() {
165 165
 		$exported = '';
166
-		foreach($this->headers as $header => $value) {
167
-			$exported.= "$header: $value\n";
166
+		foreach ($this->headers as $header => $value) {
167
+			$exported .= "$header: $value\n";
168 168
 		}
169 169
 		return $exported;
170 170
 	}
@@ -177,10 +177,10 @@  discard block
 block discarded – undo
177 177
 		// The magic is 0x950412de
178 178
 
179 179
 		// bug in PHP 5.0.2, see https://savannah.nongnu.org/bugs/?func=detailitem&item_id=10565
180
-		$magic_little = (int) - 1794895138;
180
+		$magic_little = (int) -1794895138;
181 181
 		$magic_little_64 = (int) 2500072158;
182 182
 		// 0xde120495
183
-		$magic_big = ((int) - 569244523) & 0xFFFFFFFF;
183
+		$magic_big = ((int) -569244523) & 0xFFFFFFFF;
184 184
 		if ($magic_little == $magic || $magic_little_64 == $magic) {
185 185
 			return 'little';
186 186
 		} else if ($magic_big == $magic) {
@@ -200,7 +200,7 @@  discard block
 block discarded – undo
200 200
 		}
201 201
 		$reader->setEndian($endian_string);
202 202
 
203
-		$endian = ('big' == $endian_string)? 'N' : 'V';
203
+		$endian = ('big' == $endian_string) ? 'N' : 'V';
204 204
 
205 205
 		$header = $reader->read(24);
206 206
 		if ($reader->strlen($header) != 24)
@@ -208,42 +208,42 @@  discard block
 block discarded – undo
208 208
 
209 209
 		// parse header
210 210
 		$header = unpack("{$endian}revision/{$endian}total/{$endian}originals_lenghts_addr/{$endian}translations_lenghts_addr/{$endian}hash_length/{$endian}hash_addr", $header);
211
-		if (!is_array($header))
211
+		if ( ! is_array($header))
212 212
 			return false;
213 213
 
214 214
 		// support revision 0 of MO format specs, only
215
-		if ( $header['revision'] != 0 ) {
215
+		if ($header['revision'] != 0) {
216 216
 			return false;
217 217
 		}
218 218
 
219 219
 		// seek to data blocks
220
-		$reader->seekto( $header['originals_lenghts_addr'] );
220
+		$reader->seekto($header['originals_lenghts_addr']);
221 221
 
222 222
 		// read originals' indices
223 223
 		$originals_lengths_length = $header['translations_lenghts_addr'] - $header['originals_lenghts_addr'];
224
-		if ( $originals_lengths_length != $header['total'] * 8 ) {
224
+		if ($originals_lengths_length != $header['total'] * 8) {
225 225
 			return false;
226 226
 		}
227 227
 
228 228
 		$originals = $reader->read($originals_lengths_length);
229
-		if ( $reader->strlen( $originals ) != $originals_lengths_length ) {
229
+		if ($reader->strlen($originals) != $originals_lengths_length) {
230 230
 			return false;
231 231
 		}
232 232
 
233 233
 		// read translations' indices
234 234
 		$translations_lenghts_length = $header['hash_addr'] - $header['translations_lenghts_addr'];
235
-		if ( $translations_lenghts_length != $header['total'] * 8 ) {
235
+		if ($translations_lenghts_length != $header['total'] * 8) {
236 236
 			return false;
237 237
 		}
238 238
 
239 239
 		$translations = $reader->read($translations_lenghts_length);
240
-		if ( $reader->strlen( $translations ) != $translations_lenghts_length ) {
240
+		if ($reader->strlen($translations) != $translations_lenghts_length) {
241 241
 			return false;
242 242
 		}
243 243
 
244 244
 		// transform raw data into set of indices
245
-		$originals    = $reader->str_split( $originals, 8 );
246
-		$translations = $reader->str_split( $translations, 8 );
245
+		$originals    = $reader->str_split($originals, 8);
246
+		$translations = $reader->str_split($translations, 8);
247 247
 
248 248
 		// skip hash table
249 249
 		$strings_addr = $header['hash_addr'] + $header['hash_length'] * 4;
@@ -253,17 +253,17 @@  discard block
 block discarded – undo
253 253
 		$strings = $reader->read_all();
254 254
 		$reader->close();
255 255
 
256
-		for ( $i = 0; $i < $header['total']; $i++ ) {
257
-			$o = unpack( "{$endian}length/{$endian}pos", $originals[$i] );
258
-			$t = unpack( "{$endian}length/{$endian}pos", $translations[$i] );
259
-			if ( !$o || !$t ) return false;
256
+		for ($i = 0; $i < $header['total']; $i++) {
257
+			$o = unpack("{$endian}length/{$endian}pos", $originals[$i]);
258
+			$t = unpack("{$endian}length/{$endian}pos", $translations[$i]);
259
+			if ( ! $o || ! $t) return false;
260 260
 
261 261
 			// adjust offset due to reading strings to separate space before
262 262
 			$o['pos'] -= $strings_addr;
263 263
 			$t['pos'] -= $strings_addr;
264 264
 
265
-			$original    = $reader->substr( $strings, $o['pos'], $o['length'] );
266
-			$translation = $reader->substr( $strings, $t['pos'], $t['length'] );
265
+			$original    = $reader->substr($strings, $o['pos'], $o['length']);
266
+			$translation = $reader->substr($strings, $t['pos'], $t['length']);
267 267
 
268 268
 			if ('' === $original) {
269 269
 				$this->set_headers($this->make_headers($translation));
Please login to merge, or discard this patch.
Braces   +21 added lines, -9 removed lines patch added patch discarded remove patch
@@ -54,7 +54,9 @@  discard block
 block discarded – undo
54 54
 	 */
55 55
 	function export_to_file($filename) {
56 56
 		$fh = fopen($filename, 'wb');
57
-		if ( !$fh ) return false;
57
+		if ( !$fh ) {
58
+			return false;
59
+		}
58 60
 		$res = $this->export_to_file_handle( $fh );
59 61
 		fclose($fh);
60 62
 		return $res;
@@ -65,7 +67,9 @@  discard block
 block discarded – undo
65 67
 	 */
66 68
 	function export() {
67 69
 		$tmp_fh = fopen("php://temp", 'r+');
68
-		if ( !$tmp_fh ) return false;
70
+		if ( !$tmp_fh ) {
71
+			return false;
72
+		}
69 73
 		$this->export_to_file_handle( $tmp_fh );
70 74
 		rewind( $tmp_fh );
71 75
 		return stream_get_contents( $tmp_fh );
@@ -144,8 +148,12 @@  discard block
 block discarded – undo
144 148
 	function export_original($entry) {
145 149
 		//TODO: warnings for control characters
146 150
 		$exported = $entry->singular;
147
-		if ($entry->is_plural) $exported .= chr(0).$entry->plural;
148
-		if ($entry->context) $exported = $entry->context . chr(4) . $exported;
151
+		if ($entry->is_plural) {
152
+			$exported .= chr(0).$entry->plural;
153
+		}
154
+		if ($entry->context) {
155
+			$exported = $entry->context . chr(4) . $exported;
156
+		}
149 157
 		return $exported;
150 158
 	}
151 159
 
@@ -203,13 +211,15 @@  discard block
 block discarded – undo
203 211
 		$endian = ('big' == $endian_string)? 'N' : 'V';
204 212
 
205 213
 		$header = $reader->read(24);
206
-		if ($reader->strlen($header) != 24)
207
-			return false;
214
+		if ($reader->strlen($header) != 24) {
215
+					return false;
216
+		}
208 217
 
209 218
 		// parse header
210 219
 		$header = unpack("{$endian}revision/{$endian}total/{$endian}originals_lenghts_addr/{$endian}translations_lenghts_addr/{$endian}hash_length/{$endian}hash_addr", $header);
211
-		if (!is_array($header))
212
-			return false;
220
+		if (!is_array($header)) {
221
+					return false;
222
+		}
213 223
 
214 224
 		// support revision 0 of MO format specs, only
215 225
 		if ( $header['revision'] != 0 ) {
@@ -256,7 +266,9 @@  discard block
 block discarded – undo
256 266
 		for ( $i = 0; $i < $header['total']; $i++ ) {
257 267
 			$o = unpack( "{$endian}length/{$endian}pos", $originals[$i] );
258 268
 			$t = unpack( "{$endian}length/{$endian}pos", $translations[$i] );
259
-			if ( !$o || !$t ) return false;
269
+			if ( !$o || !$t ) {
270
+				return false;
271
+			}
260 272
 
261 273
 			// adjust offset due to reading strings to separate space before
262 274
 			$o['pos'] -= $strings_addr;
Please login to merge, or discard this patch.
src/wp-includes/pomo/streams.php 3 patches
Doc Comments   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
 	/**
33 33
 	 * Sets the endianness of the file.
34 34
 	 *
35
-	 * @param $endian string 'big' or 'little'
35
+	 * @param string $endian string 'big' or 'little'
36 36
 	 */
37 37
 	function setEndian($endian) {
38 38
 		$this->endian = $endian;
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
 	/**
42 42
 	 * Reads a 32bit Integer from the Stream
43 43
 	 *
44
-	 * @return mixed The integer, corresponding to the next 32 bits from
44
+	 * @return integer The integer, corresponding to the next 32 bits from
45 45
 	 * 	the stream of false if there are not enough bytes or on error
46 46
 	 */
47 47
 	function readint32() {
@@ -119,14 +119,14 @@  discard block
 block discarded – undo
119 119
 	}
120 120
 
121 121
 	/**
122
-	 * @return true
122
+	 * @return boolean
123 123
 	 */
124 124
 	function is_resource() {
125 125
 		return true;
126 126
 	}
127 127
 
128 128
 	/**
129
-	 * @return true
129
+	 * @return boolean
130 130
 	 */
131 131
 	function close() {
132 132
 		return true;
Please login to merge, or discard this patch.
Braces   +21 added lines, -12 removed lines patch added patch discarded remove patch
@@ -46,8 +46,9 @@  discard block
 block discarded – undo
46 46
 	 */
47 47
 	function readint32() {
48 48
 		$bytes = $this->read(4);
49
-		if (4 != $this->strlen($bytes))
50
-			return false;
49
+		if (4 != $this->strlen($bytes)) {
50
+					return false;
51
+		}
51 52
 		$endian_letter = ('big' == $this->endian)? 'N' : 'V';
52 53
 		$int = unpack($endian_letter, $bytes);
53 54
 		return reset( $int );
@@ -62,8 +63,9 @@  discard block
 block discarded – undo
62 63
 	 */
63 64
 	function readint32array($count) {
64 65
 		$bytes = $this->read(4 * $count);
65
-		if (4*$count != $this->strlen($bytes))
66
-			return false;
66
+		if (4*$count != $this->strlen($bytes)) {
67
+					return false;
68
+		}
67 69
 		$endian_letter = ('big' == $this->endian)? 'N' : 'V';
68 70
 		return unpack($endian_letter.$count, $bytes);
69 71
 	}
@@ -103,8 +105,9 @@  discard block
 block discarded – undo
103 105
 		if (!function_exists('str_split')) {
104 106
 			$length = $this->strlen($string);
105 107
 			$out = array();
106
-			for ($i = 0; $i < $length; $i += $chunk_size)
107
-				$out[] = $this->substr($string, $i, $chunk_size);
108
+			for ($i = 0; $i < $length; $i += $chunk_size) {
109
+							$out[] = $this->substr($string, $i, $chunk_size);
110
+			}
108 111
 			return $out;
109 112
 		} else {
110 113
 			return str_split( $string, $chunk_size );
@@ -197,8 +200,9 @@  discard block
 block discarded – undo
197 200
 	 */
198 201
 	function read_all() {
199 202
 		$all = '';
200
-		while ( !$this->feof() )
201
-			$all .= $this->read(4096);
203
+		while ( !$this->feof() ) {
204
+					$all .= $this->read(4096);
205
+		}
202 206
 		return $all;
203 207
 	}
204 208
 }
@@ -236,7 +240,9 @@  discard block
 block discarded – undo
236 240
 	function read($bytes) {
237 241
 		$data = $this->substr($this->_str, $this->_pos, $bytes);
238 242
 		$this->_pos += $bytes;
239
-		if ($this->strlen($this->_str) < $this->_pos) $this->_pos = $this->strlen($this->_str);
243
+		if ($this->strlen($this->_str) < $this->_pos) {
244
+			$this->_pos = $this->strlen($this->_str);
245
+		}
240 246
 		return $data;
241 247
 	}
242 248
 
@@ -246,7 +252,9 @@  discard block
 block discarded – undo
246 252
 	 */
247 253
 	function seekto($pos) {
248 254
 		$this->_pos = $pos;
249
-		if ($this->strlen($this->_str) < $this->_pos) $this->_pos = $this->strlen($this->_str);
255
+		if ($this->strlen($this->_str) < $this->_pos) {
256
+			$this->_pos = $this->strlen($this->_str);
257
+		}
250 258
 		return $this->_pos;
251 259
 	}
252 260
 
@@ -278,8 +286,9 @@  discard block
 block discarded – undo
278 286
 	function __construct( $filename ) {
279 287
 		parent::POMO_StringReader();
280 288
 		$this->_str = file_get_contents($filename);
281
-		if (false === $this->_str)
282
-			return false;
289
+		if (false === $this->_str) {
290
+					return false;
291
+		}
283 292
 		$this->_pos = 0;
284 293
 	}
285 294
 
Please login to merge, or discard this patch.
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
  * @subpackage streams
9 9
  */
10 10
 
11
-if ( ! class_exists( 'POMO_Reader', false ) ):
11
+if ( ! class_exists('POMO_Reader', false)):
12 12
 class POMO_Reader {
13 13
 
14 14
 	var $endian = 'little';
@@ -48,9 +48,9 @@  discard block
 block discarded – undo
48 48
 		$bytes = $this->read(4);
49 49
 		if (4 != $this->strlen($bytes))
50 50
 			return false;
51
-		$endian_letter = ('big' == $this->endian)? 'N' : 'V';
51
+		$endian_letter = ('big' == $this->endian) ? 'N' : 'V';
52 52
 		$int = unpack($endian_letter, $bytes);
53
-		return reset( $int );
53
+		return reset($int);
54 54
 	}
55 55
 
56 56
 	/**
@@ -62,9 +62,9 @@  discard block
 block discarded – undo
62 62
 	 */
63 63
 	function readint32array($count) {
64 64
 		$bytes = $this->read(4 * $count);
65
-		if (4*$count != $this->strlen($bytes))
65
+		if (4 * $count != $this->strlen($bytes))
66 66
 			return false;
67
-		$endian_letter = ('big' == $this->endian)? 'N' : 'V';
67
+		$endian_letter = ('big' == $this->endian) ? 'N' : 'V';
68 68
 		return unpack($endian_letter.$count, $bytes);
69 69
 	}
70 70
 
@@ -100,14 +100,14 @@  discard block
 block discarded – undo
100 100
 	 * @return array
101 101
 	 */
102 102
 	function str_split($string, $chunk_size) {
103
-		if (!function_exists('str_split')) {
103
+		if ( ! function_exists('str_split')) {
104 104
 			$length = $this->strlen($string);
105 105
 			$out = array();
106 106
 			for ($i = 0; $i < $length; $i += $chunk_size)
107 107
 				$out[] = $this->substr($string, $i, $chunk_size);
108 108
 			return $out;
109 109
 		} else {
110
-			return str_split( $string, $chunk_size );
110
+			return str_split($string, $chunk_size);
111 111
 		}
112 112
 	}
113 113
 
@@ -134,13 +134,13 @@  discard block
 block discarded – undo
134 134
 }
135 135
 endif;
136 136
 
137
-if ( ! class_exists( 'POMO_FileReader', false ) ):
137
+if ( ! class_exists('POMO_FileReader', false)):
138 138
 class POMO_FileReader extends POMO_Reader {
139 139
 
140 140
 	/**
141 141
 	 * @param string $filename
142 142
 	 */
143
-	function __construct( $filename ) {
143
+	function __construct($filename) {
144 144
 		parent::POMO_Reader();
145 145
 		$this->_f = fopen($filename, 'rb');
146 146
 	}
@@ -148,8 +148,8 @@  discard block
 block discarded – undo
148 148
 	/**
149 149
 	 * PHP4 constructor.
150 150
 	 */
151
-	public function POMO_FileReader( $filename ) {
152
-		self::__construct( $filename );
151
+	public function POMO_FileReader($filename) {
152
+		self::__construct($filename);
153 153
 	}
154 154
 
155 155
 	/**
@@ -197,14 +197,14 @@  discard block
 block discarded – undo
197 197
 	 */
198 198
 	function read_all() {
199 199
 		$all = '';
200
-		while ( !$this->feof() )
200
+		while ( ! $this->feof())
201 201
 			$all .= $this->read(4096);
202 202
 		return $all;
203 203
 	}
204 204
 }
205 205
 endif;
206 206
 
207
-if ( ! class_exists( 'POMO_StringReader', false ) ):
207
+if ( ! class_exists('POMO_StringReader', false)):
208 208
 /**
209 209
  * Provides file-like methods for manipulating a string instead
210 210
  * of a physical file.
@@ -216,7 +216,7 @@  discard block
 block discarded – undo
216 216
 	/**
217 217
 	 * PHP5 constructor.
218 218
 	 */
219
-	function __construct( $str = '' ) {
219
+	function __construct($str = '') {
220 220
 		parent::POMO_Reader();
221 221
 		$this->_str = $str;
222 222
 		$this->_pos = 0;
@@ -225,8 +225,8 @@  discard block
 block discarded – undo
225 225
 	/**
226 226
 	 * PHP4 constructor.
227 227
 	 */
228
-	public function POMO_StringReader( $str = '' ) {
229
-		self::__construct( $str );
228
+	public function POMO_StringReader($str = '') {
229
+		self::__construct($str);
230 230
 	}
231 231
 
232 232
 	/**
@@ -267,7 +267,7 @@  discard block
 block discarded – undo
267 267
 }
268 268
 endif;
269 269
 
270
-if ( ! class_exists( 'POMO_CachedFileReader', false ) ):
270
+if ( ! class_exists('POMO_CachedFileReader', false)):
271 271
 /**
272 272
  * Reads the contents of the file in the beginning.
273 273
  */
@@ -275,7 +275,7 @@  discard block
 block discarded – undo
275 275
 	/**
276 276
 	 * PHP5 constructor.
277 277
 	 */
278
-	function __construct( $filename ) {
278
+	function __construct($filename) {
279 279
 		parent::POMO_StringReader();
280 280
 		$this->_str = file_get_contents($filename);
281 281
 		if (false === $this->_str)
@@ -286,13 +286,13 @@  discard block
 block discarded – undo
286 286
 	/**
287 287
 	 * PHP4 constructor.
288 288
 	 */
289
-	public function POMO_CachedFileReader( $filename ) {
290
-		self::__construct( $filename );
289
+	public function POMO_CachedFileReader($filename) {
290
+		self::__construct($filename);
291 291
 	}
292 292
 }
293 293
 endif;
294 294
 
295
-if ( ! class_exists( 'POMO_CachedIntFileReader', false ) ):
295
+if ( ! class_exists('POMO_CachedIntFileReader', false)):
296 296
 /**
297 297
  * Reads the contents of the file in the beginning.
298 298
  */
@@ -300,15 +300,15 @@  discard block
 block discarded – undo
300 300
 	/**
301 301
 	 * PHP5 constructor.
302 302
 	 */
303
-	public function __construct( $filename ) {
303
+	public function __construct($filename) {
304 304
 		parent::POMO_CachedFileReader($filename);
305 305
 	}
306 306
 
307 307
 	/**
308 308
 	 * PHP4 constructor.
309 309
 	 */
310
-	function POMO_CachedIntFileReader( $filename ) {
311
-		self::__construct( $filename );
310
+	function POMO_CachedIntFileReader($filename) {
311
+		self::__construct($filename);
312 312
 	}
313 313
 }
314 314
 endif;
Please login to merge, or discard this patch.
src/wp-includes/pomo/translations.php 3 patches
Doc Comments   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -18,6 +18,7 @@  discard block
 block discarded – undo
18 18
 	 * Add entry to the PO structure
19 19
 	 *
20 20
 	 * @param array|Translation_Entry &$entry
21
+	 * @param Translation_Entry $entry
21 22
 	 * @return bool true on success, false if the entry doesn't have a key
22 23
 	 */
23 24
 	function add_entry($entry) {
@@ -72,6 +73,7 @@  discard block
 block discarded – undo
72 73
 
73 74
 	/**
74 75
 	 * @param string $header
76
+	 * @return string
75 77
 	 */
76 78
 	function get_header($header) {
77 79
 		return isset($this->headers[$header])? $this->headers[$header] : false;
@@ -150,7 +152,7 @@  discard block
 block discarded – undo
150 152
 	}
151 153
 
152 154
 	/**
153
-	 * @param object $other
155
+	 * @param Translations $other
154 156
 	 */
155 157
 	function merge_originals_with(&$other) {
156 158
 		foreach( $other->entries as $entry ) {
@@ -326,7 +328,7 @@  discard block
 block discarded – undo
326 328
 	/**
327 329
 	 *
328 330
 	 * @param int $count
329
-	 * @return bool
331
+	 * @return integer
330 332
 	 */
331 333
 	function select_plural_form($count) {
332 334
 		return 1 == $count? 0 : 1;
Please login to merge, or discard this patch.
Braces   +24 added lines, -15 removed lines patch added patch discarded remove patch
@@ -25,7 +25,9 @@  discard block
 block discarded – undo
25 25
 			$entry = new Translation_Entry($entry);
26 26
 		}
27 27
 		$key = $entry->key();
28
-		if (false === $key) return false;
28
+		if (false === $key) {
29
+			return false;
30
+		}
29 31
 		$this->entries[$key] = &$entry;
30 32
 		return true;
31 33
 	}
@@ -39,11 +41,14 @@  discard block
 block discarded – undo
39 41
 			$entry = new Translation_Entry($entry);
40 42
 		}
41 43
 		$key = $entry->key();
42
-		if (false === $key) return false;
43
-		if (isset($this->entries[$key]))
44
-			$this->entries[$key]->merge_with($entry);
45
-		else
46
-			$this->entries[$key] = &$entry;
44
+		if (false === $key) {
45
+			return false;
46
+		}
47
+		if (isset($this->entries[$key])) {
48
+					$this->entries[$key]->merge_with($entry);
49
+		} else {
50
+					$this->entries[$key] = &$entry;
51
+		}
47 52
 		return true;
48 53
 	}
49 54
 
@@ -131,10 +136,11 @@  discard block
 block discarded – undo
131 136
 		$total_plural_forms = $this->get_plural_forms_count();
132 137
 		if ($translated && 0 <= $index && $index < $total_plural_forms &&
133 138
 				is_array($translated->translations) &&
134
-				isset($translated->translations[$index]))
135
-			return $translated->translations[$index];
136
-		else
137
-			return 1 == $count? $singular : $plural;
139
+				isset($translated->translations[$index])) {
140
+					return $translated->translations[$index];
141
+		} else {
142
+					return 1 == $count? $singular : $plural;
143
+		}
138 144
 	}
139 145
 
140 146
 	/**
@@ -154,10 +160,11 @@  discard block
 block discarded – undo
154 160
 	 */
155 161
 	function merge_originals_with(&$other) {
156 162
 		foreach( $other->entries as $entry ) {
157
-			if ( !isset( $this->entries[$entry->key()] ) )
158
-				$this->entries[$entry->key()] = $entry;
159
-			else
160
-				$this->entries[$entry->key()]->merge_with($entry);
163
+			if ( !isset( $this->entries[$entry->key()] ) ) {
164
+							$this->entries[$entry->key()] = $entry;
165
+			} else {
166
+							$this->entries[$entry->key()]->merge_with($entry);
167
+			}
161 168
 		}
162 169
 	}
163 170
 }
@@ -251,7 +258,9 @@  discard block
 block discarded – undo
251 258
 		$lines = explode("\n", $translation);
252 259
 		foreach($lines as $line) {
253 260
 			$parts = explode(':', $line, 2);
254
-			if (!isset($parts[1])) continue;
261
+			if (!isset($parts[1])) {
262
+				continue;
263
+			}
255 264
 			$headers[trim($parts[0])] = trim($parts[1]);
256 265
 		}
257 266
 		return $headers;
Please login to merge, or discard this patch.
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -7,9 +7,9 @@  discard block
 block discarded – undo
7 7
  * @subpackage translations
8 8
  */
9 9
 
10
-require_once dirname(__FILE__) . '/entry.php';
10
+require_once dirname(__FILE__).'/entry.php';
11 11
 
12
-if ( ! class_exists( 'Translations', false ) ):
12
+if ( ! class_exists('Translations', false)):
13 13
 class Translations {
14 14
 	var $entries = array();
15 15
 	var $headers = array();
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
 	 * @param array $headers
66 66
 	 */
67 67
 	function set_headers($headers) {
68
-		foreach($headers as $header => $value) {
68
+		foreach ($headers as $header => $value) {
69 69
 			$this->set_header($header, $value);
70 70
 		}
71 71
 	}
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
 	 * @param string $header
75 75
 	 */
76 76
 	function get_header($header) {
77
-		return isset($this->headers[$header])? $this->headers[$header] : false;
77
+		return isset($this->headers[$header]) ? $this->headers[$header] : false;
78 78
 	}
79 79
 
80 80
 	/**
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
 	 */
83 83
 	function translate_entry(&$entry) {
84 84
 		$key = $entry->key();
85
-		return isset($this->entries[$key])? $this->entries[$key] : false;
85
+		return isset($this->entries[$key]) ? $this->entries[$key] : false;
86 86
 	}
87 87
 
88 88
 	/**
@@ -90,10 +90,10 @@  discard block
 block discarded – undo
90 90
 	 * @param string $context
91 91
 	 * @return string
92 92
 	 */
93
-	function translate($singular, $context=null) {
93
+	function translate($singular, $context = null) {
94 94
 		$entry = new Translation_Entry(array('singular' => $singular, 'context' => $context));
95 95
 		$translated = $this->translate_entry($entry);
96
-		return ($translated && !empty($translated->translations))? $translated->translations[0] : $singular;
96
+		return ($translated && ! empty($translated->translations)) ? $translated->translations[0] : $singular;
97 97
 	}
98 98
 
99 99
 	/**
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
 	 * @param integer $count number of items
109 109
 	 */
110 110
 	function select_plural_form($count) {
111
-		return 1 == $count? 0 : 1;
111
+		return 1 == $count ? 0 : 1;
112 112
 	}
113 113
 
114 114
 	/**
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
 				isset($translated->translations[$index]))
135 135
 			return $translated->translations[$index];
136 136
 		else
137
-			return 1 == $count? $singular : $plural;
137
+			return 1 == $count ? $singular : $plural;
138 138
 	}
139 139
 
140 140
 	/**
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
 	 * @return void
145 145
 	 **/
146 146
 	function merge_with(&$other) {
147
-		foreach( $other->entries as $entry ) {
147
+		foreach ($other->entries as $entry) {
148 148
 			$this->entries[$entry->key()] = $entry;
149 149
 		}
150 150
 	}
@@ -153,8 +153,8 @@  discard block
 block discarded – undo
153 153
 	 * @param object $other
154 154
 	 */
155 155
 	function merge_originals_with(&$other) {
156
-		foreach( $other->entries as $entry ) {
157
-			if ( !isset( $this->entries[$entry->key()] ) )
156
+		foreach ($other->entries as $entry) {
157
+			if ( ! isset($this->entries[$entry->key()]))
158 158
 				$this->entries[$entry->key()] = $entry;
159 159
 			else
160 160
 				$this->entries[$entry->key()]->merge_with($entry);
@@ -172,8 +172,8 @@  discard block
 block discarded – undo
172 172
 	 * @param int $count
173 173
 	 */
174 174
 	function gettext_select_plural_form($count) {
175
-		if (!isset($this->_gettext_select_plural_form) || is_null($this->_gettext_select_plural_form)) {
176
-			list( $nplurals, $expression ) = $this->nplurals_and_expression_from_header($this->get_header('Plural-Forms'));
175
+		if ( ! isset($this->_gettext_select_plural_form) || is_null($this->_gettext_select_plural_form)) {
176
+			list($nplurals, $expression) = $this->nplurals_and_expression_from_header($this->get_header('Plural-Forms'));
177 177
 			$this->_nplurals = $nplurals;
178 178
 			$this->_gettext_select_plural_form = $this->make_plural_form_function($nplurals, $expression);
179 179
 		}
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
 	 */
187 187
 	function nplurals_and_expression_from_header($header) {
188 188
 		if (preg_match('/^\s*nplurals\s*=\s*(\d+)\s*;\s+plural\s*=\s*(.+)$/', $header, $matches)) {
189
-			$nplurals = (int)$matches[1];
189
+			$nplurals = (int) $matches[1];
190 190
 			$expression = trim($this->parenthesize_plural_exression($matches[2]));
191 191
 			return array($nplurals, $expression);
192 192
 		} else {
@@ -230,8 +230,8 @@  discard block
 block discarded – undo
230 230
 					$res .= ') : (';
231 231
 					break;
232 232
 				case ';':
233
-					$res .= str_repeat(')', $depth) . ';';
234
-					$depth= 0;
233
+					$res .= str_repeat(')', $depth).';';
234
+					$depth = 0;
235 235
 					break;
236 236
 				default:
237 237
 					$res .= $char;
@@ -249,9 +249,9 @@  discard block
 block discarded – undo
249 249
 		// sometimes \ns are used instead of real new lines
250 250
 		$translation = str_replace('\n', "\n", $translation);
251 251
 		$lines = explode("\n", $translation);
252
-		foreach($lines as $line) {
252
+		foreach ($lines as $line) {
253 253
 			$parts = explode(':', $line, 2);
254
-			if (!isset($parts[1])) continue;
254
+			if ( ! isset($parts[1])) continue;
255 255
 			$headers[trim($parts[0])] = trim($parts[1]);
256 256
 		}
257 257
 		return $headers;
@@ -264,7 +264,7 @@  discard block
 block discarded – undo
264 264
 	function set_header($header, $value) {
265 265
 		parent::set_header($header, $value);
266 266
 		if ('Plural-Forms' == $header) {
267
-			list( $nplurals, $expression ) = $this->nplurals_and_expression_from_header($this->get_header('Plural-Forms'));
267
+			list($nplurals, $expression) = $this->nplurals_and_expression_from_header($this->get_header('Plural-Forms'));
268 268
 			$this->_nplurals = $nplurals;
269 269
 			$this->_gettext_select_plural_form = $this->make_plural_form_function($nplurals, $expression);
270 270
 		}
@@ -272,7 +272,7 @@  discard block
 block discarded – undo
272 272
 }
273 273
 endif;
274 274
 
275
-if ( ! class_exists( 'NOOP_Translations', false ) ):
275
+if ( ! class_exists('NOOP_Translations', false)):
276 276
 /**
277 277
  * Provides the same interface as Translations, but doesn't do anything
278 278
  */
@@ -319,7 +319,7 @@  discard block
 block discarded – undo
319 319
 	 * @param string $singular
320 320
 	 * @param string $context
321 321
 	 */
322
-	function translate($singular, $context=null) {
322
+	function translate($singular, $context = null) {
323 323
 		return $singular;
324 324
 	}
325 325
 
@@ -329,7 +329,7 @@  discard block
 block discarded – undo
329 329
 	 * @return bool
330 330
 	 */
331 331
 	function select_plural_form($count) {
332
-		return 1 == $count? 0 : 1;
332
+		return 1 == $count ? 0 : 1;
333 333
 	}
334 334
 
335 335
 	/**
@@ -346,7 +346,7 @@  discard block
 block discarded – undo
346 346
 	 * @param string $context
347 347
 	 */
348 348
 	function translate_plural($singular, $plural, $count, $context = null) {
349
-			return 1 == $count? $singular : $plural;
349
+			return 1 == $count ? $singular : $plural;
350 350
 	}
351 351
 
352 352
 	/**
Please login to merge, or discard this patch.
src/wp-includes/post-formats.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -135,7 +135,7 @@
 block discarded – undo
135 135
  * @since 3.1.0
136 136
  *
137 137
  * @param string $format The post format slug.
138
- * @return string|WP_Error|false The post format term link.
138
+ * @return string The post format term link.
139 139
  */
140 140
 function get_post_format_link( $format ) {
141 141
 	$term = get_term_by('slug', 'post-format-' . $format, 'post_format' );
Please login to merge, or discard this patch.
Braces   +35 added lines, -25 removed lines patch added patch discarded remove patch
@@ -15,16 +15,19 @@  discard block
 block discarded – undo
15 15
  * @return string|false The format if successful. False otherwise.
16 16
  */
17 17
 function get_post_format( $post = null ) {
18
-	if ( ! $post = get_post( $post ) )
19
-		return false;
18
+	if ( ! $post = get_post( $post ) ) {
19
+			return false;
20
+	}
20 21
 
21
-	if ( ! post_type_supports( $post->post_type, 'post-formats' ) )
22
-		return false;
22
+	if ( ! post_type_supports( $post->post_type, 'post-formats' ) ) {
23
+			return false;
24
+	}
23 25
 
24 26
 	$_format = get_the_terms( $post->ID, 'post_format' );
25 27
 
26
-	if ( empty( $_format ) )
27
-		return false;
28
+	if ( empty( $_format ) ) {
29
+			return false;
30
+	}
28 31
 
29 32
 	$format = reset( $_format );
30 33
 
@@ -64,15 +67,17 @@  discard block
 block discarded – undo
64 67
 function set_post_format( $post, $format ) {
65 68
 	$post = get_post( $post );
66 69
 
67
-	if ( empty( $post ) )
68
-		return new WP_Error( 'invalid_post', __( 'Invalid post.' ) );
70
+	if ( empty( $post ) ) {
71
+			return new WP_Error( 'invalid_post', __( 'Invalid post.' ) );
72
+	}
69 73
 
70 74
 	if ( ! empty( $format ) ) {
71 75
 		$format = sanitize_key( $format );
72
-		if ( 'standard' === $format || ! in_array( $format, get_post_format_slugs() ) )
73
-			$format = '';
74
-		else
75
-			$format = 'post-format-' . $format;
76
+		if ( 'standard' === $format || ! in_array( $format, get_post_format_slugs() ) ) {
77
+					$format = '';
78
+		} else {
79
+					$format = 'post-format-' . $format;
80
+		}
76 81
 	}
77 82
 
78 83
 	return wp_set_post_terms( $post->ID, $format, 'post_format' );
@@ -123,11 +128,12 @@  discard block
 block discarded – undo
123 128
  */
124 129
 function get_post_format_string( $slug ) {
125 130
 	$strings = get_post_format_strings();
126
-	if ( !$slug )
127
-		return $strings['standard'];
128
-	else
129
-		return ( isset( $strings[$slug] ) ) ? $strings[$slug] : '';
130
-}
131
+	if ( !$slug ) {
132
+			return $strings['standard'];
133
+	} else {
134
+			return ( isset( $strings[$slug] ) ) ? $strings[$slug] : '';
135
+	}
136
+	}
131 137
 
132 138
 /**
133 139
  * Returns a link to a post format index.
@@ -139,8 +145,9 @@  discard block
 block discarded – undo
139 145
  */
140 146
 function get_post_format_link( $format ) {
141 147
 	$term = get_term_by('slug', 'post-format-' . $format, 'post_format' );
142
-	if ( ! $term || is_wp_error( $term ) )
143
-		return false;
148
+	if ( ! $term || is_wp_error( $term ) ) {
149
+			return false;
150
+	}
144 151
 	return get_term_link( $term );
145 152
 }
146 153
 
@@ -154,14 +161,17 @@  discard block
 block discarded – undo
154 161
  * @return array
155 162
  */
156 163
 function _post_format_request( $qvs ) {
157
-	if ( ! isset( $qvs['post_format'] ) )
158
-		return $qvs;
164
+	if ( ! isset( $qvs['post_format'] ) ) {
165
+			return $qvs;
166
+	}
159 167
 	$slugs = get_post_format_slugs();
160
-	if ( isset( $slugs[ $qvs['post_format'] ] ) )
161
-		$qvs['post_format'] = 'post-format-' . $slugs[ $qvs['post_format'] ];
168
+	if ( isset( $slugs[ $qvs['post_format'] ] ) ) {
169
+			$qvs['post_format'] = 'post-format-' . $slugs[ $qvs['post_format'] ];
170
+	}
162 171
 	$tax = get_taxonomy( 'post_format' );
163
-	if ( ! is_admin() )
164
-		$qvs['post_type'] = $tax->object_type;
172
+	if ( ! is_admin() ) {
173
+			$qvs['post_type'] = $tax->object_type;
174
+	}
165 175
 	return $qvs;
166 176
 }
167 177
 
Please login to merge, or discard this patch.
Spacing   +67 added lines, -67 removed lines patch added patch discarded remove patch
@@ -14,21 +14,21 @@  discard block
 block discarded – undo
14 14
  * @param int|object|null $post Post ID or post object. Optional, default is the current post from the loop.
15 15
  * @return string|false The format if successful. False otherwise.
16 16
  */
17
-function get_post_format( $post = null ) {
18
-	if ( ! $post = get_post( $post ) )
17
+function get_post_format($post = null) {
18
+	if ( ! $post = get_post($post))
19 19
 		return false;
20 20
 
21
-	if ( ! post_type_supports( $post->post_type, 'post-formats' ) )
21
+	if ( ! post_type_supports($post->post_type, 'post-formats'))
22 22
 		return false;
23 23
 
24
-	$_format = get_the_terms( $post->ID, 'post_format' );
24
+	$_format = get_the_terms($post->ID, 'post_format');
25 25
 
26
-	if ( empty( $_format ) )
26
+	if (empty($_format))
27 27
 		return false;
28 28
 
29
-	$format = reset( $_format );
29
+	$format = reset($_format);
30 30
 
31
-	return str_replace('post-format-', '', $format->slug );
31
+	return str_replace('post-format-', '', $format->slug);
32 32
 }
33 33
 
34 34
 /**
@@ -40,16 +40,16 @@  discard block
 block discarded – undo
40 40
  * @param object|int|null $post   Optional. The post to check. If not supplied, defaults to the current post if used in the loop.
41 41
  * @return bool True if the post has any of the given formats (or any format, if no format specified), false otherwise.
42 42
  */
43
-function has_post_format( $format = array(), $post = null ) {
43
+function has_post_format($format = array(), $post = null) {
44 44
 	$prefixed = array();
45 45
 
46
-	if ( $format ) {
47
-		foreach ( (array) $format as $single ) {
48
-			$prefixed[] = 'post-format-' . sanitize_key( $single );
46
+	if ($format) {
47
+		foreach ((array) $format as $single) {
48
+			$prefixed[] = 'post-format-'.sanitize_key($single);
49 49
 		}
50 50
 	}
51 51
 
52
-	return has_term( $prefixed, 'post_format', $post );
52
+	return has_term($prefixed, 'post_format', $post);
53 53
 }
54 54
 
55 55
 /**
@@ -61,21 +61,21 @@  discard block
 block discarded – undo
61 61
  * @param string     $format A format to assign. Use an empty string or array to remove all formats from the post.
62 62
  * @return array|WP_Error|false WP_Error on error. Array of affected term IDs on success.
63 63
  */
64
-function set_post_format( $post, $format ) {
65
-	$post = get_post( $post );
64
+function set_post_format($post, $format) {
65
+	$post = get_post($post);
66 66
 
67
-	if ( empty( $post ) )
68
-		return new WP_Error( 'invalid_post', __( 'Invalid post.' ) );
67
+	if (empty($post))
68
+		return new WP_Error('invalid_post', __('Invalid post.'));
69 69
 
70
-	if ( ! empty( $format ) ) {
71
-		$format = sanitize_key( $format );
72
-		if ( 'standard' === $format || ! in_array( $format, get_post_format_slugs() ) )
70
+	if ( ! empty($format)) {
71
+		$format = sanitize_key($format);
72
+		if ('standard' === $format || ! in_array($format, get_post_format_slugs()))
73 73
 			$format = '';
74 74
 		else
75
-			$format = 'post-format-' . $format;
75
+			$format = 'post-format-'.$format;
76 76
 	}
77 77
 
78
-	return wp_set_post_terms( $post->ID, $format, 'post_format' );
78
+	return wp_set_post_terms($post->ID, $format, 'post_format');
79 79
 }
80 80
 
81 81
 /**
@@ -87,16 +87,16 @@  discard block
 block discarded – undo
87 87
  */
88 88
 function get_post_format_strings() {
89 89
 	$strings = array(
90
-		'standard' => _x( 'Standard', 'Post format' ), // Special case. any value that evals to false will be considered standard
91
-		'aside'    => _x( 'Aside',    'Post format' ),
92
-		'chat'     => _x( 'Chat',     'Post format' ),
93
-		'gallery'  => _x( 'Gallery',  'Post format' ),
94
-		'link'     => _x( 'Link',     'Post format' ),
95
-		'image'    => _x( 'Image',    'Post format' ),
96
-		'quote'    => _x( 'Quote',    'Post format' ),
97
-		'status'   => _x( 'Status',   'Post format' ),
98
-		'video'    => _x( 'Video',    'Post format' ),
99
-		'audio'    => _x( 'Audio',    'Post format' ),
90
+		'standard' => _x('Standard', 'Post format'), // Special case. any value that evals to false will be considered standard
91
+		'aside'    => _x('Aside', 'Post format'),
92
+		'chat'     => _x('Chat', 'Post format'),
93
+		'gallery'  => _x('Gallery', 'Post format'),
94
+		'link'     => _x('Link', 'Post format'),
95
+		'image'    => _x('Image', 'Post format'),
96
+		'quote'    => _x('Quote', 'Post format'),
97
+		'status'   => _x('Status', 'Post format'),
98
+		'video'    => _x('Video', 'Post format'),
99
+		'audio'    => _x('Audio', 'Post format'),
100 100
 	);
101 101
 	return $strings;
102 102
 }
@@ -109,8 +109,8 @@  discard block
 block discarded – undo
109 109
  * @return array The array of post format slugs.
110 110
  */
111 111
 function get_post_format_slugs() {
112
-	$slugs = array_keys( get_post_format_strings() );
113
-	return array_combine( $slugs, $slugs );
112
+	$slugs = array_keys(get_post_format_strings());
113
+	return array_combine($slugs, $slugs);
114 114
 }
115 115
 
116 116
 /**
@@ -121,12 +121,12 @@  discard block
 block discarded – undo
121 121
  * @param string $slug A post format slug.
122 122
  * @return string The translated post format name.
123 123
  */
124
-function get_post_format_string( $slug ) {
124
+function get_post_format_string($slug) {
125 125
 	$strings = get_post_format_strings();
126
-	if ( !$slug )
126
+	if ( ! $slug)
127 127
 		return $strings['standard'];
128 128
 	else
129
-		return ( isset( $strings[$slug] ) ) ? $strings[$slug] : '';
129
+		return (isset($strings[$slug])) ? $strings[$slug] : '';
130 130
 }
131 131
 
132 132
 /**
@@ -137,11 +137,11 @@  discard block
 block discarded – undo
137 137
  * @param string $format The post format slug.
138 138
  * @return string|WP_Error|false The post format term link.
139 139
  */
140
-function get_post_format_link( $format ) {
141
-	$term = get_term_by('slug', 'post-format-' . $format, 'post_format' );
142
-	if ( ! $term || is_wp_error( $term ) )
140
+function get_post_format_link($format) {
141
+	$term = get_term_by('slug', 'post-format-'.$format, 'post_format');
142
+	if ( ! $term || is_wp_error($term))
143 143
 		return false;
144
-	return get_term_link( $term );
144
+	return get_term_link($term);
145 145
 }
146 146
 
147 147
 /**
@@ -153,14 +153,14 @@  discard block
 block discarded – undo
153 153
  * @param array $qvs
154 154
  * @return array
155 155
  */
156
-function _post_format_request( $qvs ) {
157
-	if ( ! isset( $qvs['post_format'] ) )
156
+function _post_format_request($qvs) {
157
+	if ( ! isset($qvs['post_format']))
158 158
 		return $qvs;
159 159
 	$slugs = get_post_format_slugs();
160
-	if ( isset( $slugs[ $qvs['post_format'] ] ) )
161
-		$qvs['post_format'] = 'post-format-' . $slugs[ $qvs['post_format'] ];
162
-	$tax = get_taxonomy( 'post_format' );
163
-	if ( ! is_admin() )
160
+	if (isset($slugs[$qvs['post_format']]))
161
+		$qvs['post_format'] = 'post-format-'.$slugs[$qvs['post_format']];
162
+	$tax = get_taxonomy('post_format');
163
+	if ( ! is_admin())
164 164
 		$qvs['post_type'] = $tax->object_type;
165 165
 	return $qvs;
166 166
 }
@@ -178,16 +178,16 @@  discard block
 block discarded – undo
178 178
  * @param string $taxonomy
179 179
  * @return string
180 180
  */
181
-function _post_format_link( $link, $term, $taxonomy ) {
181
+function _post_format_link($link, $term, $taxonomy) {
182 182
 	global $wp_rewrite;
183
-	if ( 'post_format' != $taxonomy ) {
183
+	if ('post_format' != $taxonomy) {
184 184
 		return $link;
185 185
 	}
186
-	if ( $wp_rewrite->get_extra_permastruct( $taxonomy ) ) {
187
-		return str_replace( "/{$term->slug}", '/' . str_replace( 'post-format-', '', $term->slug ), $link );
186
+	if ($wp_rewrite->get_extra_permastruct($taxonomy)) {
187
+		return str_replace("/{$term->slug}", '/'.str_replace('post-format-', '', $term->slug), $link);
188 188
 	} else {
189
-		$link = remove_query_arg( 'post_format', $link );
190
-		return add_query_arg( 'post_format', str_replace( 'post-format-', '', $term->slug ), $link );
189
+		$link = remove_query_arg('post_format', $link);
190
+		return add_query_arg('post_format', str_replace('post-format-', '', $term->slug), $link);
191 191
 	}
192 192
 }
193 193
 
@@ -200,9 +200,9 @@  discard block
 block discarded – undo
200 200
  * @param object $term
201 201
  * @return object
202 202
  */
203
-function _post_format_get_term( $term ) {
204
-	if ( isset( $term->slug ) ) {
205
-		$term->name = get_post_format_string( str_replace( 'post-format-', '', $term->slug ) );
203
+function _post_format_get_term($term) {
204
+	if (isset($term->slug)) {
205
+		$term->name = get_post_format_string(str_replace('post-format-', '', $term->slug));
206 206
 	}
207 207
 	return $term;
208 208
 }
@@ -218,16 +218,16 @@  discard block
 block discarded – undo
218 218
  * @param array        $args
219 219
  * @return array
220 220
  */
221
-function _post_format_get_terms( $terms, $taxonomies, $args ) {
222
-	if ( in_array( 'post_format', (array) $taxonomies ) ) {
223
-		if ( isset( $args['fields'] ) && 'names' == $args['fields'] ) {
224
-			foreach ( $terms as $order => $name ) {
225
-				$terms[$order] = get_post_format_string( str_replace( 'post-format-', '', $name ) );
221
+function _post_format_get_terms($terms, $taxonomies, $args) {
222
+	if (in_array('post_format', (array) $taxonomies)) {
223
+		if (isset($args['fields']) && 'names' == $args['fields']) {
224
+			foreach ($terms as $order => $name) {
225
+				$terms[$order] = get_post_format_string(str_replace('post-format-', '', $name));
226 226
 			}
227 227
 		} else {
228
-			foreach ( (array) $terms as $order => $term ) {
229
-				if ( isset( $term->taxonomy ) && 'post_format' == $term->taxonomy ) {
230
-					$terms[$order]->name = get_post_format_string( str_replace( 'post-format-', '', $term->slug ) );
228
+			foreach ((array) $terms as $order => $term) {
229
+				if (isset($term->taxonomy) && 'post_format' == $term->taxonomy) {
230
+					$terms[$order]->name = get_post_format_string(str_replace('post-format-', '', $term->slug));
231 231
 				}
232 232
 			}
233 233
 		}
@@ -244,10 +244,10 @@  discard block
 block discarded – undo
244 244
  * @param array $terms
245 245
  * @return array
246 246
  */
247
-function _post_format_wp_get_object_terms( $terms ) {
248
-	foreach ( (array) $terms as $order => $term ) {
249
-		if ( isset( $term->taxonomy ) && 'post_format' == $term->taxonomy ) {
250
-			$terms[$order]->name = get_post_format_string( str_replace( 'post-format-', '', $term->slug ) );
247
+function _post_format_wp_get_object_terms($terms) {
248
+	foreach ((array) $terms as $order => $term) {
249
+		if (isset($term->taxonomy) && 'post_format' == $term->taxonomy) {
250
+			$terms[$order]->name = get_post_format_string(str_replace('post-format-', '', $term->slug));
251 251
 		}
252 252
 	}
253 253
 	return $terms;
Please login to merge, or discard this patch.
src/wp-includes/SimplePie/Decode/HTML/Entities.php 3 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
 	 * Consume the next byte
110 110
 	 *
111 111
 	 * @access private
112
-	 * @return mixed The next byte, or false, if there is no more data
112
+	 * @return string|false The next byte, or false, if there is no more data
113 113
 	 */
114 114
 	public function consume()
115 115
 	{
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
 	 *
130 130
 	 * @access private
131 131
 	 * @param string $chars Characters to consume
132
-	 * @return mixed A series of characters that match the range, or false
132
+	 * @return string|false A series of characters that match the range, or false
133 133
 	 */
134 134
 	public function consume_range($chars)
135 135
 	{
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -215,7 +215,7 @@
 block discarded – undo
215 215
 						$replacement = SimplePie_Misc::codepoint_to_utf8($codepoint);
216 216
 					}
217 217
 
218
-					if (!in_array($this->consume(), array(';', false), true))
218
+					if ( ! in_array($this->consume(), array(';', false), true))
219 219
 					{
220 220
 						$this->unconsume();
221 221
 					}
Please login to merge, or discard this patch.
Braces   +4 added lines, -8 removed lines patch added patch discarded remove patch
@@ -117,8 +117,7 @@  discard block
 block discarded – undo
117 117
 		{
118 118
 			$this->consumed .= $this->data[$this->position];
119 119
 			return $this->data[$this->position++];
120
-		}
121
-		else
120
+		} else
122 121
 		{
123 122
 			return false;
124 123
 		}
@@ -139,8 +138,7 @@  discard block
 block discarded – undo
139 138
 			$this->consumed .= $data;
140 139
 			$this->position += $len;
141 140
 			return $data;
142
-		}
143
-		else
141
+		} else
144 142
 		{
145 143
 			return false;
146 144
 		}
@@ -200,8 +198,7 @@  discard block
 block discarded – undo
200 198
 					if ($hex)
201 199
 					{
202 200
 						$codepoint = hexdec($codepoint);
203
-					}
204
-					else
201
+					} else
205 202
 					{
206 203
 						$codepoint = intval($codepoint);
207 204
 					}
@@ -209,8 +206,7 @@  discard block
 block discarded – undo
209 206
 					if (isset($windows_1252_specials[$codepoint]))
210 207
 					{
211 208
 						$replacement = $windows_1252_specials[$codepoint];
212
-					}
213
-					else
209
+					} else
214 210
 					{
215 211
 						$replacement = SimplePie_Misc::codepoint_to_utf8($codepoint);
216 212
 					}
Please login to merge, or discard this patch.