Completed
Push — master ( cde0c6...d99bf9 )
by Stephen
15:46
created
src/wp-includes/ID3/module.audio.dts.php 3 patches
Doc Comments   +4 added lines patch added patch discarded remove patch
@@ -139,6 +139,10 @@
 block discarded – undo
139 139
 		return true;
140 140
 	}
141 141
 
142
+	/**
143
+	 * @param string $bin
144
+	 * @param integer $length
145
+	 */
142 146
 	private function readBinData($bin, $length) {
143 147
 		$data = substr($bin, $this->readBinDataOffset, $length);
144 148
 		$this->readBinDataOffset += $length;
Please login to merge, or discard this patch.
Indentation   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -21,20 +21,20 @@  discard block
 block discarded – undo
21 21
 class getid3_dts extends getid3_handler
22 22
 {
23 23
 	/**
24
-	* Default DTS syncword used in native .cpt or .dts formats
25
-	*/
26
-    const syncword = "\x7F\xFE\x80\x01";
24
+	 * Default DTS syncword used in native .cpt or .dts formats
25
+	 */
26
+	const syncword = "\x7F\xFE\x80\x01";
27 27
 
28 28
 	private $readBinDataOffset = 0;
29 29
 
30
-    /**
31
-    * Possible syncwords indicating bitstream encoding
32
-    */
33
-    public static $syncwords = array(
34
-    	0 => "\x7F\xFE\x80\x01",  // raw big-endian
35
-    	1 => "\xFE\x7F\x01\x80",  // raw little-endian
36
-    	2 => "\x1F\xFF\xE8\x00",  // 14-bit big-endian
37
-    	3 => "\xFF\x1F\x00\xE8"); // 14-bit little-endian
30
+	/**
31
+	 * Possible syncwords indicating bitstream encoding
32
+	 */
33
+	public static $syncwords = array(
34
+		0 => "\x7F\xFE\x80\x01",  // raw big-endian
35
+		1 => "\xFE\x7F\x01\x80",  // raw little-endian
36
+		2 => "\x1F\xFF\xE8\x00",  // 14-bit big-endian
37
+		3 => "\xFF\x1F\x00\xE8"); // 14-bit little-endian
38 38
 
39 39
 	public function Analyze() {
40 40
 		$info = &$this->getid3->info;
@@ -45,18 +45,18 @@  discard block
 block discarded – undo
45 45
 
46 46
 		// check syncword
47 47
 		$sync = substr($DTSheader, 0, 4);
48
-        if (($encoding = array_search($sync, self::$syncwords)) !== false) {
48
+		if (($encoding = array_search($sync, self::$syncwords)) !== false) {
49 49
 
50
-        	$info['dts']['raw']['magic'] = $sync;
50
+			$info['dts']['raw']['magic'] = $sync;
51 51
 			$this->readBinDataOffset = 32;
52 52
 
53
-        } elseif ($this->isDependencyFor('matroska')) {
53
+		} elseif ($this->isDependencyFor('matroska')) {
54 54
 
55 55
 			// Matroska contains DTS without syncword encoded as raw big-endian format
56 56
 			$encoding = 0;
57 57
 			$this->readBinDataOffset = 0;
58 58
 
59
-        } else {
59
+		} else {
60 60
 
61 61
 			unset($info['fileformat']);
62 62
 			return $this->error('Expecting "'.implode('| ', array_map('getid3_lib::PrintHexBytes', self::$syncwords)).'" at offset '.$info['avdataoffset'].', found "'.getid3_lib::PrintHexBytes($sync).'"');
Please login to merge, or discard this patch.
Spacing   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -31,9 +31,9 @@  discard block
 block discarded – undo
31 31
     * Possible syncwords indicating bitstream encoding
32 32
     */
33 33
     public static $syncwords = array(
34
-    	0 => "\x7F\xFE\x80\x01",  // raw big-endian
35
-    	1 => "\xFE\x7F\x01\x80",  // raw little-endian
36
-    	2 => "\x1F\xFF\xE8\x00",  // 14-bit big-endian
34
+    	0 => "\x7F\xFE\x80\x01", // raw big-endian
35
+    	1 => "\xFE\x7F\x01\x80", // raw little-endian
36
+    	2 => "\x1F\xFF\xE8\x00", // 14-bit big-endian
37 37
     	3 => "\xFF\x1F\x00\xE8"); // 14-bit little-endian
38 38
 
39 39
 	public function Analyze() {
@@ -68,13 +68,13 @@  discard block
 block discarded – undo
68 68
 		for ($word_offset = 0; $word_offset <= strlen($DTSheader); $word_offset += 2) {
69 69
 			switch ($encoding) {
70 70
 				case 0: // raw big-endian
71
-					$fhBS .=        getid3_lib::BigEndian2Bin(       substr($DTSheader, $word_offset, 2) );
71
+					$fhBS .= getid3_lib::BigEndian2Bin(substr($DTSheader, $word_offset, 2));
72 72
 					break;
73 73
 				case 1: // raw little-endian
74
-					$fhBS .=        getid3_lib::BigEndian2Bin(strrev(substr($DTSheader, $word_offset, 2)));
74
+					$fhBS .= getid3_lib::BigEndian2Bin(strrev(substr($DTSheader, $word_offset, 2)));
75 75
 					break;
76 76
 				case 2: // 14-bit big-endian
77
-					$fhBS .= substr(getid3_lib::BigEndian2Bin(       substr($DTSheader, $word_offset, 2) ), 2, 14);
77
+					$fhBS .= substr(getid3_lib::BigEndian2Bin(substr($DTSheader, $word_offset, 2)), 2, 14);
78 78
 					break;
79 79
 				case 3: // 14-bit little-endian
80 80
 					$fhBS .= substr(getid3_lib::BigEndian2Bin(strrev(substr($DTSheader, $word_offset, 2))), 2, 14);
@@ -82,42 +82,42 @@  discard block
 block discarded – undo
82 82
 			}
83 83
 		}
84 84
 
85
-		$info['dts']['raw']['frame_type']             =        $this->readBinData($fhBS,  1);
86
-		$info['dts']['raw']['deficit_samples']        =        $this->readBinData($fhBS,  5);
87
-		$info['dts']['flags']['crc_present']          = (bool) $this->readBinData($fhBS,  1);
88
-		$info['dts']['raw']['pcm_sample_blocks']      =        $this->readBinData($fhBS,  7);
89
-		$info['dts']['raw']['frame_byte_size']        =        $this->readBinData($fhBS, 14);
90
-		$info['dts']['raw']['channel_arrangement']    =        $this->readBinData($fhBS,  6);
91
-		$info['dts']['raw']['sample_frequency']       =        $this->readBinData($fhBS,  4);
92
-		$info['dts']['raw']['bitrate']                =        $this->readBinData($fhBS,  5);
93
-		$info['dts']['flags']['embedded_downmix']     = (bool) $this->readBinData($fhBS,  1);
94
-		$info['dts']['flags']['dynamicrange']         = (bool) $this->readBinData($fhBS,  1);
95
-		$info['dts']['flags']['timestamp']            = (bool) $this->readBinData($fhBS,  1);
96
-		$info['dts']['flags']['auxdata']              = (bool) $this->readBinData($fhBS,  1);
97
-		$info['dts']['flags']['hdcd']                 = (bool) $this->readBinData($fhBS,  1);
98
-		$info['dts']['raw']['extension_audio']        =        $this->readBinData($fhBS,  3);
99
-		$info['dts']['flags']['extended_coding']      = (bool) $this->readBinData($fhBS,  1);
100
-		$info['dts']['flags']['audio_sync_insertion'] = (bool) $this->readBinData($fhBS,  1);
101
-		$info['dts']['raw']['lfe_effects']            =        $this->readBinData($fhBS,  2);
102
-		$info['dts']['flags']['predictor_history']    = (bool) $this->readBinData($fhBS,  1);
85
+		$info['dts']['raw']['frame_type']             = $this->readBinData($fhBS, 1);
86
+		$info['dts']['raw']['deficit_samples']        = $this->readBinData($fhBS, 5);
87
+		$info['dts']['flags']['crc_present']          = (bool) $this->readBinData($fhBS, 1);
88
+		$info['dts']['raw']['pcm_sample_blocks']      = $this->readBinData($fhBS, 7);
89
+		$info['dts']['raw']['frame_byte_size']        = $this->readBinData($fhBS, 14);
90
+		$info['dts']['raw']['channel_arrangement']    = $this->readBinData($fhBS, 6);
91
+		$info['dts']['raw']['sample_frequency']       = $this->readBinData($fhBS, 4);
92
+		$info['dts']['raw']['bitrate']                = $this->readBinData($fhBS, 5);
93
+		$info['dts']['flags']['embedded_downmix']     = (bool) $this->readBinData($fhBS, 1);
94
+		$info['dts']['flags']['dynamicrange']         = (bool) $this->readBinData($fhBS, 1);
95
+		$info['dts']['flags']['timestamp']            = (bool) $this->readBinData($fhBS, 1);
96
+		$info['dts']['flags']['auxdata']              = (bool) $this->readBinData($fhBS, 1);
97
+		$info['dts']['flags']['hdcd']                 = (bool) $this->readBinData($fhBS, 1);
98
+		$info['dts']['raw']['extension_audio']        = $this->readBinData($fhBS, 3);
99
+		$info['dts']['flags']['extended_coding']      = (bool) $this->readBinData($fhBS, 1);
100
+		$info['dts']['flags']['audio_sync_insertion'] = (bool) $this->readBinData($fhBS, 1);
101
+		$info['dts']['raw']['lfe_effects']            = $this->readBinData($fhBS, 2);
102
+		$info['dts']['flags']['predictor_history']    = (bool) $this->readBinData($fhBS, 1);
103 103
 		if ($info['dts']['flags']['crc_present']) {
104
-			$info['dts']['raw']['crc16']              =        $this->readBinData($fhBS, 16);
104
+			$info['dts']['raw']['crc16'] = $this->readBinData($fhBS, 16);
105 105
 		}
106
-		$info['dts']['flags']['mri_perfect_reconst']  = (bool) $this->readBinData($fhBS,  1);
107
-		$info['dts']['raw']['encoder_soft_version']   =        $this->readBinData($fhBS,  4);
108
-		$info['dts']['raw']['copy_history']           =        $this->readBinData($fhBS,  2);
109
-		$info['dts']['raw']['bits_per_sample']        =        $this->readBinData($fhBS,  2);
110
-		$info['dts']['flags']['surround_es']          = (bool) $this->readBinData($fhBS,  1);
111
-		$info['dts']['flags']['front_sum_diff']       = (bool) $this->readBinData($fhBS,  1);
112
-		$info['dts']['flags']['surround_sum_diff']    = (bool) $this->readBinData($fhBS,  1);
113
-		$info['dts']['raw']['dialog_normalization']   =        $this->readBinData($fhBS,  4);
106
+		$info['dts']['flags']['mri_perfect_reconst']  = (bool) $this->readBinData($fhBS, 1);
107
+		$info['dts']['raw']['encoder_soft_version']   = $this->readBinData($fhBS, 4);
108
+		$info['dts']['raw']['copy_history']           = $this->readBinData($fhBS, 2);
109
+		$info['dts']['raw']['bits_per_sample']        = $this->readBinData($fhBS, 2);
110
+		$info['dts']['flags']['surround_es']          = (bool) $this->readBinData($fhBS, 1);
111
+		$info['dts']['flags']['front_sum_diff']       = (bool) $this->readBinData($fhBS, 1);
112
+		$info['dts']['flags']['surround_sum_diff']    = (bool) $this->readBinData($fhBS, 1);
113
+		$info['dts']['raw']['dialog_normalization']   = $this->readBinData($fhBS, 4);
114 114
 
115 115
 
116 116
 		$info['dts']['bitrate']              = self::bitrateLookup($info['dts']['raw']['bitrate']);
117 117
 		$info['dts']['bits_per_sample']      = self::bitPerSampleLookup($info['dts']['raw']['bits_per_sample']);
118 118
 		$info['dts']['sample_rate']          = self::sampleRateLookup($info['dts']['raw']['sample_frequency']);
119 119
 		$info['dts']['dialog_normalization'] = self::dialogNormalization($info['dts']['raw']['dialog_normalization'], $info['dts']['raw']['encoder_soft_version']);
120
-		$info['dts']['flags']['lossless']    = (($info['dts']['raw']['bitrate'] == 31) ? true  : false);
120
+		$info['dts']['flags']['lossless']    = (($info['dts']['raw']['bitrate'] == 31) ? true : false);
121 121
 		$info['dts']['bitrate_mode']         = (($info['dts']['raw']['bitrate'] == 30) ? 'vbr' : 'cbr');
122 122
 		$info['dts']['channels']             = self::numChannelsLookup($info['dts']['raw']['channel_arrangement']);
123 123
 		$info['dts']['channel_arrangement']  = self::channelArrangementLookup($info['dts']['raw']['channel_arrangement']);
@@ -129,8 +129,8 @@  discard block
 block discarded – undo
129 129
 		$info['audio']['sample_rate']         = $info['dts']['sample_rate'];
130 130
 		$info['audio']['channels']            = $info['dts']['channels'];
131 131
 		$info['audio']['bitrate']             = $info['dts']['bitrate'];
132
-		if (isset($info['avdataend']) && !empty($info['dts']['bitrate']) && is_numeric($info['dts']['bitrate'])) {
133
-			$info['playtime_seconds']         = ($info['avdataend'] - $info['avdataoffset']) / ($info['dts']['bitrate'] / 8);
132
+		if (isset($info['avdataend']) && ! empty($info['dts']['bitrate']) && is_numeric($info['dts']['bitrate'])) {
133
+			$info['playtime_seconds'] = ($info['avdataend'] - $info['avdataoffset']) / ($info['dts']['bitrate'] / 8);
134 134
 			if (($encoding == 2) || ($encoding == 3)) {
135 135
 				// 14-bit data packed into 16-bit words, so the playtime is wrong because only (14/16) of the bytes in the data portion of the file are used at the specified bitrate
136 136
 				$info['playtime_seconds'] *= (14 / 16);
Please login to merge, or discard this patch.
src/wp-includes/ID3/module.audio.mp3.php 3 patches
Doc Comments   +9 added lines patch added patch discarded remove patch
@@ -1072,6 +1072,9 @@  discard block
 block discarded – undo
1072 1072
 		return true;
1073 1073
 	}
1074 1074
 
1075
+	/**
1076
+	 * @param boolean $ScanAsCBR
1077
+	 */
1075 1078
 	public function RecursiveFrameScanning(&$offset, &$nextframetestoffset, $ScanAsCBR) {
1076 1079
 		$info = &$this->getid3->info;
1077 1080
 		$firstframetestarray = array('error'=>'', 'warning'=>'', 'avdataend'=>$info['avdataend'], 'avdataoffset'=>$info['avdataoffset']);
@@ -1686,6 +1689,9 @@  discard block
 block discarded – undo
1686 1689
 		return $MPEGaudioEmphasis;
1687 1690
 	}
1688 1691
 
1692
+	/**
1693
+	 * @param string $head4
1694
+	 */
1689 1695
 	public static function MPEGaudioHeaderBytesValid($head4, $allowBitrate15=false) {
1690 1696
 		return self::MPEGaudioHeaderValid(self::MPEGaudioHeaderDecode($head4), false, $allowBitrate15);
1691 1697
 	}
@@ -1936,6 +1942,9 @@  discard block
 block discarded – undo
1936 1942
 		return (isset($LAMEmiscStereoModeLookup[$StereoModeID]) ? $LAMEmiscStereoModeLookup[$StereoModeID] : '');
1937 1943
 	}
1938 1944
 
1945
+	/**
1946
+	 * @param integer $SourceSampleFrequencyID
1947
+	 */
1939 1948
 	public static function LAMEmiscSourceSampleFrequencyLookup($SourceSampleFrequencyID) {
1940 1949
 		static $LAMEmiscSourceSampleFrequencyLookup = array(
1941 1950
 			0 => '<= 32 kHz',
Please login to merge, or discard this patch.
Spacing   +161 added lines, -167 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
 
33 33
 		$initialOffset = $info['avdataoffset'];
34 34
 
35
-		if (!$this->getOnlyMPEGaudioInfo($info['avdataoffset'])) {
35
+		if ( ! $this->getOnlyMPEGaudioInfo($info['avdataoffset'])) {
36 36
 			if ($this->allow_bruteforce) {
37 37
 				$info['error'][] = 'Rescanning file in BruteForce mode';
38 38
 				$this->getOnlyMPEGaudioInfoBruteForce($this->getid3->fp, $info);
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
 			$info['audio']['bitrate_mode'] = strtolower($info['mpeg']['audio']['bitrate_mode']);
45 45
 		}
46 46
 
47
-		if (((isset($info['id3v2']['headerlength']) && ($info['avdataoffset'] > $info['id3v2']['headerlength'])) || (!isset($info['id3v2']) && ($info['avdataoffset'] > 0) && ($info['avdataoffset'] != $initialOffset)))) {
47
+		if (((isset($info['id3v2']['headerlength']) && ($info['avdataoffset'] > $info['id3v2']['headerlength'])) || ( ! isset($info['id3v2']) && ($info['avdataoffset'] > 0) && ($info['avdataoffset'] != $initialOffset)))) {
48 48
 
49 49
 			$synchoffsetwarning = 'Unknown data before synch ';
50 50
 			if (isset($info['id3v2']['headerlength'])) {
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
 			$synchoffsetwarning .= 'synch detected at '.$info['avdataoffset'].')';
58 58
 			if (isset($info['audio']['bitrate_mode']) && ($info['audio']['bitrate_mode'] == 'cbr')) {
59 59
 
60
-				if (!empty($info['id3v2']['headerlength']) && (($info['avdataoffset'] - $info['id3v2']['headerlength']) == $info['mpeg']['audio']['framelength'])) {
60
+				if ( ! empty($info['id3v2']['headerlength']) && (($info['avdataoffset'] - $info['id3v2']['headerlength']) == $info['mpeg']['audio']['framelength'])) {
61 61
 
62 62
 					$synchoffsetwarning .= '. This is a known problem with some versions of LAME (3.90-3.92) DLL in CBR mode.';
63 63
 					$info['audio']['codec'] = 'LAME';
@@ -78,15 +78,15 @@  discard block
 block discarded – undo
78 78
 
79 79
 		if (isset($info['mpeg']['audio']['LAME'])) {
80 80
 			$info['audio']['codec'] = 'LAME';
81
-			if (!empty($info['mpeg']['audio']['LAME']['long_version'])) {
81
+			if ( ! empty($info['mpeg']['audio']['LAME']['long_version'])) {
82 82
 				$info['audio']['encoder'] = rtrim($info['mpeg']['audio']['LAME']['long_version'], "\x00");
83
-			} elseif (!empty($info['mpeg']['audio']['LAME']['short_version'])) {
83
+			} elseif ( ! empty($info['mpeg']['audio']['LAME']['short_version'])) {
84 84
 				$info['audio']['encoder'] = rtrim($info['mpeg']['audio']['LAME']['short_version'], "\x00");
85 85
 			}
86 86
 		}
87 87
 
88
-		$CurrentDataLAMEversionString = (!empty($CurrentDataLAMEversionString) ? $CurrentDataLAMEversionString : (isset($info['audio']['encoder']) ? $info['audio']['encoder'] : ''));
89
-		if (!empty($CurrentDataLAMEversionString) && (substr($CurrentDataLAMEversionString, 0, 6) == 'LAME3.') && !preg_match('[0-9\)]', substr($CurrentDataLAMEversionString, -1))) {
88
+		$CurrentDataLAMEversionString = ( ! empty($CurrentDataLAMEversionString) ? $CurrentDataLAMEversionString : (isset($info['audio']['encoder']) ? $info['audio']['encoder'] : ''));
89
+		if ( ! empty($CurrentDataLAMEversionString) && (substr($CurrentDataLAMEversionString, 0, 6) == 'LAME3.') && ! preg_match('[0-9\)]', substr($CurrentDataLAMEversionString, -1))) {
90 90
 			// a version number of LAME that does not end with a number like "LAME3.92"
91 91
 			// or with a closing parenthesis like "LAME3.88 (alpha)"
92 92
 			// or a version of LAME with the LAMEtag-not-filled-in-DLL-mode bug (3.90-3.92)
@@ -115,14 +115,12 @@  discard block
 block discarded – undo
115 115
 				}
116 116
 			}
117 117
 		}
118
-		if (!empty($info['audio']['encoder'])) {
118
+		if ( ! empty($info['audio']['encoder'])) {
119 119
 			$info['audio']['encoder'] = rtrim($info['audio']['encoder'], "\x00 ");
120 120
 		}
121 121
 
122 122
 		switch (isset($info['mpeg']['audio']['layer']) ? $info['mpeg']['audio']['layer'] : '') {
123
-			case 1:
124
-			case 2:
125
-				$info['audio']['dataformat'] = 'mp'.$info['mpeg']['audio']['layer'];
123
+			case 1 : case 2 : $info['audio']['dataformat'] = 'mp'.$info['mpeg']['audio']['layer'];
126 124
 				break;
127 125
 		}
128 126
 		if (isset($info['fileformat']) && ($info['fileformat'] == 'mp3')) {
@@ -151,7 +149,7 @@  discard block
 block discarded – undo
151 149
 		$info['audio']['lossless'] = false;
152 150
 
153 151
 		// Calculate playtime
154
-		if (!isset($info['playtime_seconds']) && isset($info['audio']['bitrate']) && ($info['audio']['bitrate'] > 0)) {
152
+		if ( ! isset($info['playtime_seconds']) && isset($info['audio']['bitrate']) && ($info['audio']['bitrate'] > 0)) {
155 153
 			$info['playtime_seconds'] = ($info['avdataend'] - $info['avdataoffset']) * 8 / $info['audio']['bitrate'];
156 154
 		}
157 155
 
@@ -164,9 +162,9 @@  discard block
 block discarded – undo
164 162
 	public function GuessEncoderOptions() {
165 163
 		// shortcuts
166 164
 		$info = &$this->getid3->info;
167
-		if (!empty($info['mpeg']['audio'])) {
165
+		if ( ! empty($info['mpeg']['audio'])) {
168 166
 			$thisfile_mpeg_audio = &$info['mpeg']['audio'];
169
-			if (!empty($thisfile_mpeg_audio['LAME'])) {
167
+			if ( ! empty($thisfile_mpeg_audio['LAME'])) {
170 168
 				$thisfile_mpeg_audio_lame = &$thisfile_mpeg_audio['LAME'];
171 169
 			}
172 170
 		}
@@ -174,71 +172,71 @@  discard block
 block discarded – undo
174 172
 		$encoder_options = '';
175 173
 		static $NamedPresetBitrates = array(16, 24, 40, 56, 112, 128, 160, 192, 256);
176 174
 
177
-		if (isset($thisfile_mpeg_audio['VBR_method']) && ($thisfile_mpeg_audio['VBR_method'] == 'Fraunhofer') && !empty($thisfile_mpeg_audio['VBR_quality'])) {
175
+		if (isset($thisfile_mpeg_audio['VBR_method']) && ($thisfile_mpeg_audio['VBR_method'] == 'Fraunhofer') && ! empty($thisfile_mpeg_audio['VBR_quality'])) {
178 176
 
179 177
 			$encoder_options = 'VBR q'.$thisfile_mpeg_audio['VBR_quality'];
180 178
 
181
-		} elseif (!empty($thisfile_mpeg_audio_lame['preset_used']) && (!in_array($thisfile_mpeg_audio_lame['preset_used_id'], $NamedPresetBitrates))) {
179
+		} elseif ( ! empty($thisfile_mpeg_audio_lame['preset_used']) && ( ! in_array($thisfile_mpeg_audio_lame['preset_used_id'], $NamedPresetBitrates))) {
182 180
 
183 181
 			$encoder_options = $thisfile_mpeg_audio_lame['preset_used'];
184 182
 
185
-		} elseif (!empty($thisfile_mpeg_audio_lame['vbr_quality'])) {
183
+		} elseif ( ! empty($thisfile_mpeg_audio_lame['vbr_quality'])) {
186 184
 
187 185
 			static $KnownEncoderValues = array();
188 186
 			if (empty($KnownEncoderValues)) {
189 187
 
190 188
 				//$KnownEncoderValues[abrbitrate_minbitrate][vbr_quality][raw_vbr_method][raw_noise_shaping][raw_stereo_mode][ath_type][lowpass_frequency] = 'preset name';
191
-				$KnownEncoderValues[0xFF][58][1][1][3][2][20500] = '--alt-preset insane';        // 3.90,   3.90.1, 3.92
192
-				$KnownEncoderValues[0xFF][58][1][1][3][2][20600] = '--alt-preset insane';        // 3.90.2, 3.90.3, 3.91
193
-				$KnownEncoderValues[0xFF][57][1][1][3][4][20500] = '--alt-preset insane';        // 3.94,   3.95
194
-				$KnownEncoderValues['**'][78][3][2][3][2][19500] = '--alt-preset extreme';       // 3.90,   3.90.1, 3.92
195
-				$KnownEncoderValues['**'][78][3][2][3][2][19600] = '--alt-preset extreme';       // 3.90.2, 3.91
196
-				$KnownEncoderValues['**'][78][3][1][3][2][19600] = '--alt-preset extreme';       // 3.90.3
197
-				$KnownEncoderValues['**'][78][4][2][3][2][19500] = '--alt-preset fast extreme';  // 3.90,   3.90.1, 3.92
198
-				$KnownEncoderValues['**'][78][4][2][3][2][19600] = '--alt-preset fast extreme';  // 3.90.2, 3.90.3, 3.91
199
-				$KnownEncoderValues['**'][78][3][2][3][4][19000] = '--alt-preset standard';      // 3.90,   3.90.1, 3.90.2, 3.91, 3.92
200
-				$KnownEncoderValues['**'][78][3][1][3][4][19000] = '--alt-preset standard';      // 3.90.3
189
+				$KnownEncoderValues[0xFF][58][1][1][3][2][20500] = '--alt-preset insane'; // 3.90,   3.90.1, 3.92
190
+				$KnownEncoderValues[0xFF][58][1][1][3][2][20600] = '--alt-preset insane'; // 3.90.2, 3.90.3, 3.91
191
+				$KnownEncoderValues[0xFF][57][1][1][3][4][20500] = '--alt-preset insane'; // 3.94,   3.95
192
+				$KnownEncoderValues['**'][78][3][2][3][2][19500] = '--alt-preset extreme'; // 3.90,   3.90.1, 3.92
193
+				$KnownEncoderValues['**'][78][3][2][3][2][19600] = '--alt-preset extreme'; // 3.90.2, 3.91
194
+				$KnownEncoderValues['**'][78][3][1][3][2][19600] = '--alt-preset extreme'; // 3.90.3
195
+				$KnownEncoderValues['**'][78][4][2][3][2][19500] = '--alt-preset fast extreme'; // 3.90,   3.90.1, 3.92
196
+				$KnownEncoderValues['**'][78][4][2][3][2][19600] = '--alt-preset fast extreme'; // 3.90.2, 3.90.3, 3.91
197
+				$KnownEncoderValues['**'][78][3][2][3][4][19000] = '--alt-preset standard'; // 3.90,   3.90.1, 3.90.2, 3.91, 3.92
198
+				$KnownEncoderValues['**'][78][3][1][3][4][19000] = '--alt-preset standard'; // 3.90.3
201 199
 				$KnownEncoderValues['**'][78][4][2][3][4][19000] = '--alt-preset fast standard'; // 3.90,   3.90.1, 3.90.2, 3.91, 3.92
202 200
 				$KnownEncoderValues['**'][78][4][1][3][4][19000] = '--alt-preset fast standard'; // 3.90.3
203
-				$KnownEncoderValues['**'][88][4][1][3][3][19500] = '--r3mix';                    // 3.90,   3.90.1, 3.92
204
-				$KnownEncoderValues['**'][88][4][1][3][3][19600] = '--r3mix';                    // 3.90.2, 3.90.3, 3.91
205
-				$KnownEncoderValues['**'][67][4][1][3][4][18000] = '--r3mix';                    // 3.94,   3.95
206
-				$KnownEncoderValues['**'][68][3][2][3][4][18000] = '--alt-preset medium';        // 3.90.3
207
-				$KnownEncoderValues['**'][68][4][2][3][4][18000] = '--alt-preset fast medium';   // 3.90.3
208
-
209
-				$KnownEncoderValues[0xFF][99][1][1][1][2][0]     = '--preset studio';            // 3.90,   3.90.1, 3.90.2, 3.91, 3.92
210
-				$KnownEncoderValues[0xFF][58][2][1][3][2][20600] = '--preset studio';            // 3.90.3, 3.93.1
211
-				$KnownEncoderValues[0xFF][58][2][1][3][2][20500] = '--preset studio';            // 3.93
212
-				$KnownEncoderValues[0xFF][57][2][1][3][4][20500] = '--preset studio';            // 3.94,   3.95
213
-				$KnownEncoderValues[0xC0][88][1][1][1][2][0]     = '--preset cd';                // 3.90,   3.90.1, 3.90.2,   3.91, 3.92
214
-				$KnownEncoderValues[0xC0][58][2][2][3][2][19600] = '--preset cd';                // 3.90.3, 3.93.1
215
-				$KnownEncoderValues[0xC0][58][2][2][3][2][19500] = '--preset cd';                // 3.93
216
-				$KnownEncoderValues[0xC0][57][2][1][3][4][19500] = '--preset cd';                // 3.94,   3.95
217
-				$KnownEncoderValues[0xA0][78][1][1][3][2][18000] = '--preset hifi';              // 3.90,   3.90.1, 3.90.2,   3.91, 3.92
218
-				$KnownEncoderValues[0xA0][58][2][2][3][2][18000] = '--preset hifi';              // 3.90.3, 3.93,   3.93.1
219
-				$KnownEncoderValues[0xA0][57][2][1][3][4][18000] = '--preset hifi';              // 3.94,   3.95
220
-				$KnownEncoderValues[0x80][67][1][1][3][2][18000] = '--preset tape';              // 3.90,   3.90.1, 3.90.2,   3.91, 3.92
221
-				$KnownEncoderValues[0x80][67][1][1][3][2][15000] = '--preset radio';             // 3.90,   3.90.1, 3.90.2,   3.91, 3.92
222
-				$KnownEncoderValues[0x70][67][1][1][3][2][15000] = '--preset fm';                // 3.90,   3.90.1, 3.90.2,   3.91, 3.92
223
-				$KnownEncoderValues[0x70][58][2][2][3][2][16000] = '--preset tape/radio/fm';     // 3.90.3, 3.93,   3.93.1
224
-				$KnownEncoderValues[0x70][57][2][1][3][4][16000] = '--preset tape/radio/fm';     // 3.94,   3.95
225
-				$KnownEncoderValues[0x38][58][2][2][0][2][10000] = '--preset voice';             // 3.90.3, 3.93,   3.93.1
226
-				$KnownEncoderValues[0x38][57][2][1][0][4][15000] = '--preset voice';             // 3.94,   3.95
227
-				$KnownEncoderValues[0x38][57][2][1][0][4][16000] = '--preset voice';             // 3.94a14
228
-				$KnownEncoderValues[0x28][65][1][1][0][2][7500]  = '--preset mw-us';             // 3.90,   3.90.1, 3.92
229
-				$KnownEncoderValues[0x28][65][1][1][0][2][7600]  = '--preset mw-us';             // 3.90.2, 3.91
230
-				$KnownEncoderValues[0x28][58][2][2][0][2][7000]  = '--preset mw-us';             // 3.90.3, 3.93,   3.93.1
231
-				$KnownEncoderValues[0x28][57][2][1][0][4][10500] = '--preset mw-us';             // 3.94,   3.95
232
-				$KnownEncoderValues[0x28][57][2][1][0][4][11200] = '--preset mw-us';             // 3.94a14
233
-				$KnownEncoderValues[0x28][57][2][1][0][4][8800]  = '--preset mw-us';             // 3.94a15
201
+				$KnownEncoderValues['**'][88][4][1][3][3][19500] = '--r3mix'; // 3.90,   3.90.1, 3.92
202
+				$KnownEncoderValues['**'][88][4][1][3][3][19600] = '--r3mix'; // 3.90.2, 3.90.3, 3.91
203
+				$KnownEncoderValues['**'][67][4][1][3][4][18000] = '--r3mix'; // 3.94,   3.95
204
+				$KnownEncoderValues['**'][68][3][2][3][4][18000] = '--alt-preset medium'; // 3.90.3
205
+				$KnownEncoderValues['**'][68][4][2][3][4][18000] = '--alt-preset fast medium'; // 3.90.3
206
+
207
+				$KnownEncoderValues[0xFF][99][1][1][1][2][0]     = '--preset studio'; // 3.90,   3.90.1, 3.90.2, 3.91, 3.92
208
+				$KnownEncoderValues[0xFF][58][2][1][3][2][20600] = '--preset studio'; // 3.90.3, 3.93.1
209
+				$KnownEncoderValues[0xFF][58][2][1][3][2][20500] = '--preset studio'; // 3.93
210
+				$KnownEncoderValues[0xFF][57][2][1][3][4][20500] = '--preset studio'; // 3.94,   3.95
211
+				$KnownEncoderValues[0xC0][88][1][1][1][2][0]     = '--preset cd'; // 3.90,   3.90.1, 3.90.2,   3.91, 3.92
212
+				$KnownEncoderValues[0xC0][58][2][2][3][2][19600] = '--preset cd'; // 3.90.3, 3.93.1
213
+				$KnownEncoderValues[0xC0][58][2][2][3][2][19500] = '--preset cd'; // 3.93
214
+				$KnownEncoderValues[0xC0][57][2][1][3][4][19500] = '--preset cd'; // 3.94,   3.95
215
+				$KnownEncoderValues[0xA0][78][1][1][3][2][18000] = '--preset hifi'; // 3.90,   3.90.1, 3.90.2,   3.91, 3.92
216
+				$KnownEncoderValues[0xA0][58][2][2][3][2][18000] = '--preset hifi'; // 3.90.3, 3.93,   3.93.1
217
+				$KnownEncoderValues[0xA0][57][2][1][3][4][18000] = '--preset hifi'; // 3.94,   3.95
218
+				$KnownEncoderValues[0x80][67][1][1][3][2][18000] = '--preset tape'; // 3.90,   3.90.1, 3.90.2,   3.91, 3.92
219
+				$KnownEncoderValues[0x80][67][1][1][3][2][15000] = '--preset radio'; // 3.90,   3.90.1, 3.90.2,   3.91, 3.92
220
+				$KnownEncoderValues[0x70][67][1][1][3][2][15000] = '--preset fm'; // 3.90,   3.90.1, 3.90.2,   3.91, 3.92
221
+				$KnownEncoderValues[0x70][58][2][2][3][2][16000] = '--preset tape/radio/fm'; // 3.90.3, 3.93,   3.93.1
222
+				$KnownEncoderValues[0x70][57][2][1][3][4][16000] = '--preset tape/radio/fm'; // 3.94,   3.95
223
+				$KnownEncoderValues[0x38][58][2][2][0][2][10000] = '--preset voice'; // 3.90.3, 3.93,   3.93.1
224
+				$KnownEncoderValues[0x38][57][2][1][0][4][15000] = '--preset voice'; // 3.94,   3.95
225
+				$KnownEncoderValues[0x38][57][2][1][0][4][16000] = '--preset voice'; // 3.94a14
226
+				$KnownEncoderValues[0x28][65][1][1][0][2][7500]  = '--preset mw-us'; // 3.90,   3.90.1, 3.92
227
+				$KnownEncoderValues[0x28][65][1][1][0][2][7600]  = '--preset mw-us'; // 3.90.2, 3.91
228
+				$KnownEncoderValues[0x28][58][2][2][0][2][7000]  = '--preset mw-us'; // 3.90.3, 3.93,   3.93.1
229
+				$KnownEncoderValues[0x28][57][2][1][0][4][10500] = '--preset mw-us'; // 3.94,   3.95
230
+				$KnownEncoderValues[0x28][57][2][1][0][4][11200] = '--preset mw-us'; // 3.94a14
231
+				$KnownEncoderValues[0x28][57][2][1][0][4][8800]  = '--preset mw-us'; // 3.94a15
234 232
 				$KnownEncoderValues[0x18][58][2][2][0][2][4000]  = '--preset phon+/lw/mw-eu/sw'; // 3.90.3, 3.93.1
235 233
 				$KnownEncoderValues[0x18][58][2][2][0][2][3900]  = '--preset phon+/lw/mw-eu/sw'; // 3.93
236 234
 				$KnownEncoderValues[0x18][57][2][1][0][4][5900]  = '--preset phon+/lw/mw-eu/sw'; // 3.94,   3.95
237 235
 				$KnownEncoderValues[0x18][57][2][1][0][4][6200]  = '--preset phon+/lw/mw-eu/sw'; // 3.94a14
238 236
 				$KnownEncoderValues[0x18][57][2][1][0][4][3200]  = '--preset phon+/lw/mw-eu/sw'; // 3.94a15
239
-				$KnownEncoderValues[0x10][58][2][2][0][2][3800]  = '--preset phone';             // 3.90.3, 3.93.1
240
-				$KnownEncoderValues[0x10][58][2][2][0][2][3700]  = '--preset phone';             // 3.93
241
-				$KnownEncoderValues[0x10][57][2][1][0][4][5600]  = '--preset phone';             // 3.94,   3.95
237
+				$KnownEncoderValues[0x10][58][2][2][0][2][3800]  = '--preset phone'; // 3.90.3, 3.93.1
238
+				$KnownEncoderValues[0x10][58][2][2][0][2][3700]  = '--preset phone'; // 3.93
239
+				$KnownEncoderValues[0x10][57][2][1][0][4][5600]  = '--preset phone'; // 3.94,   3.95
242 240
 			}
243 241
 
244 242
 			if (isset($KnownEncoderValues[$thisfile_mpeg_audio_lame['raw']['abrbitrate_minbitrate']][$thisfile_mpeg_audio_lame['vbr_quality']][$thisfile_mpeg_audio_lame['raw']['vbr_method']][$thisfile_mpeg_audio_lame['raw']['noise_shaping']][$thisfile_mpeg_audio_lame['raw']['stereo_mode']][$thisfile_mpeg_audio_lame['ath_type']][$thisfile_mpeg_audio_lame['lowpass_frequency']])) {
@@ -269,11 +267,11 @@  discard block
 block discarded – undo
269 267
 
270 268
 			}
271 269
 
272
-		} elseif (!empty($thisfile_mpeg_audio_lame['bitrate_abr'])) {
270
+		} elseif ( ! empty($thisfile_mpeg_audio_lame['bitrate_abr'])) {
273 271
 
274 272
 			$encoder_options = 'ABR'.$thisfile_mpeg_audio_lame['bitrate_abr'];
275 273
 
276
-		} elseif (!empty($info['audio']['bitrate'])) {
274
+		} elseif ( ! empty($info['audio']['bitrate'])) {
277 275
 
278 276
 			if ($info['audio']['bitrate_mode'] == 'cbr') {
279 277
 				$encoder_options = strtoupper($info['audio']['bitrate_mode']).ceil($info['audio']['bitrate'] / 1000);
@@ -282,15 +280,15 @@  discard block
 block discarded – undo
282 280
 			}
283 281
 
284 282
 		}
285
-		if (!empty($thisfile_mpeg_audio_lame['bitrate_min'])) {
283
+		if ( ! empty($thisfile_mpeg_audio_lame['bitrate_min'])) {
286 284
 			$encoder_options .= ' -b'.$thisfile_mpeg_audio_lame['bitrate_min'];
287 285
 		}
288 286
 
289
-		if (!empty($thisfile_mpeg_audio_lame['encoding_flags']['nogap_prev']) || !empty($thisfile_mpeg_audio_lame['encoding_flags']['nogap_next'])) {
287
+		if ( ! empty($thisfile_mpeg_audio_lame['encoding_flags']['nogap_prev']) || ! empty($thisfile_mpeg_audio_lame['encoding_flags']['nogap_next'])) {
290 288
 			$encoder_options .= ' --nogap';
291 289
 		}
292 290
 
293
-		if (!empty($thisfile_mpeg_audio_lame['lowpass_frequency'])) {
291
+		if ( ! empty($thisfile_mpeg_audio_lame['lowpass_frequency'])) {
294 292
 			$ExplodedOptions = explode(' ', $encoder_options, 4);
295 293
 			if ($ExplodedOptions[0] == '--r3mix') {
296 294
 				$ExplodedOptions[1] = 'r3mix';
@@ -316,20 +314,20 @@  discard block
 block discarded – undo
316 314
 						case 'r3mix':
317 315
 							static $ExpectedLowpass = array(
318 316
 									'insane|20500'        => 20500,
319
-									'insane|20600'        => 20600,  // 3.90.2, 3.90.3, 3.91
317
+									'insane|20600'        => 20600, // 3.90.2, 3.90.3, 3.91
320 318
 									'medium|18000'        => 18000,
321 319
 									'fast medium|18000'   => 18000,
322
-									'extreme|19500'       => 19500,  // 3.90,   3.90.1, 3.92, 3.95
323
-									'extreme|19600'       => 19600,  // 3.90.2, 3.90.3, 3.91, 3.93.1
324
-									'fast extreme|19500'  => 19500,  // 3.90,   3.90.1, 3.92, 3.95
325
-									'fast extreme|19600'  => 19600,  // 3.90.2, 3.90.3, 3.91, 3.93.1
320
+									'extreme|19500'       => 19500, // 3.90,   3.90.1, 3.92, 3.95
321
+									'extreme|19600'       => 19600, // 3.90.2, 3.90.3, 3.91, 3.93.1
322
+									'fast extreme|19500'  => 19500, // 3.90,   3.90.1, 3.92, 3.95
323
+									'fast extreme|19600'  => 19600, // 3.90.2, 3.90.3, 3.91, 3.93.1
326 324
 									'standard|19000'      => 19000,
327 325
 									'fast standard|19000' => 19000,
328
-									'r3mix|19500'         => 19500,  // 3.90,   3.90.1, 3.92
329
-									'r3mix|19600'         => 19600,  // 3.90.2, 3.90.3, 3.91
330
-									'r3mix|18000'         => 18000,  // 3.94,   3.95
326
+									'r3mix|19500'         => 19500, // 3.90,   3.90.1, 3.92
327
+									'r3mix|19600'         => 19600, // 3.90.2, 3.90.3, 3.91
328
+									'r3mix|18000'         => 18000, // 3.94,   3.95
331 329
 								);
332
-							if (!isset($ExpectedLowpass[$ExplodedOptions[1].'|'.$thisfile_mpeg_audio_lame['lowpass_frequency']]) && ($thisfile_mpeg_audio_lame['lowpass_frequency'] < 22050) && (round($thisfile_mpeg_audio_lame['lowpass_frequency'] / 1000) < round($thisfile_mpeg_audio['sample_rate'] / 2000))) {
330
+							if ( ! isset($ExpectedLowpass[$ExplodedOptions[1].'|'.$thisfile_mpeg_audio_lame['lowpass_frequency']]) && ($thisfile_mpeg_audio_lame['lowpass_frequency'] < 22050) && (round($thisfile_mpeg_audio_lame['lowpass_frequency'] / 1000) < round($thisfile_mpeg_audio['sample_rate'] / 2000))) {
333 331
 								$encoder_options .= ' --lowpass '.$thisfile_mpeg_audio_lame['lowpass_frequency'];
334 332
 							}
335 333
 							break;
@@ -380,7 +378,7 @@  discard block
 block discarded – undo
380 378
 												'fm/radio|32000'          => 32000, // 3.92
381 379
 												'fm|32000'                => 32000, // 3.90
382 380
 												'voice|32000'             => 32000);
383
-										if (!isset($ExpectedResampledRate[$ExplodedOptions[1].'|'.$thisfile_mpeg_audio['sample_rate']])) {
381
+										if ( ! isset($ExpectedResampledRate[$ExplodedOptions[1].'|'.$thisfile_mpeg_audio['sample_rate']])) {
384 382
 											$encoder_options .= ' --resample '.$thisfile_mpeg_audio['sample_rate'];
385 383
 										}
386 384
 										break;
@@ -396,7 +394,7 @@  discard block
 block discarded – undo
396 394
 				}
397 395
 			}
398 396
 		}
399
-		if (empty($encoder_options) && !empty($info['audio']['bitrate']) && !empty($info['audio']['bitrate_mode'])) {
397
+		if (empty($encoder_options) && ! empty($info['audio']['bitrate']) && ! empty($info['audio']['bitrate_mode'])) {
400 398
 			//$encoder_options = strtoupper($info['audio']['bitrate_mode']).ceil($info['audio']['bitrate'] / 1000);
401 399
 			$encoder_options = strtoupper($info['audio']['bitrate_mode']);
402 400
 		}
@@ -405,7 +403,7 @@  discard block
 block discarded – undo
405 403
 	}
406 404
 
407 405
 
408
-	public function decodeMPEGaudioHeader($offset, &$info, $recursivesearch=true, $ScanAsCBR=false, $FastMPEGheaderScan=false) {
406
+	public function decodeMPEGaudioHeader($offset, &$info, $recursivesearch = true, $ScanAsCBR = false, $FastMPEGheaderScan = false) {
409 407
 		static $MPEGaudioVersionLookup;
410 408
 		static $MPEGaudioLayerLookup;
411 409
 		static $MPEGaudioBitrateLookup;
@@ -447,13 +445,13 @@  discard block
 block discarded – undo
447 445
 		}
448 446
 
449 447
 		static $MPEGaudioHeaderValidCache = array();
450
-		if (!isset($MPEGaudioHeaderValidCache[$head4])) { // Not in cache
448
+		if ( ! isset($MPEGaudioHeaderValidCache[$head4])) { // Not in cache
451 449
 			//$MPEGaudioHeaderValidCache[$head4] = self::MPEGaudioHeaderValid($MPEGheaderRawArray, false, true);  // allow badly-formatted freeformat (from LAME 3.90 - 3.93.1)
452 450
 			$MPEGaudioHeaderValidCache[$head4] = self::MPEGaudioHeaderValid($MPEGheaderRawArray, false, false);
453 451
 		}
454 452
 
455 453
 		// shortcut
456
-		if (!isset($info['mpeg']['audio'])) {
454
+		if ( ! isset($info['mpeg']['audio'])) {
457 455
 			$info['mpeg']['audio'] = array();
458 456
 		}
459 457
 		$thisfile_mpeg_audio = &$info['mpeg']['audio'];
@@ -466,14 +464,14 @@  discard block
 block discarded – undo
466 464
 			return false;
467 465
 		}
468 466
 
469
-		if (!$FastMPEGheaderScan) {
467
+		if ( ! $FastMPEGheaderScan) {
470 468
 			$thisfile_mpeg_audio['version']       = $MPEGaudioVersionLookup[$thisfile_mpeg_audio['raw']['version']];
471 469
 			$thisfile_mpeg_audio['layer']         = $MPEGaudioLayerLookup[$thisfile_mpeg_audio['raw']['layer']];
472 470
 
473 471
 			$thisfile_mpeg_audio['channelmode']   = $MPEGaudioChannelModeLookup[$thisfile_mpeg_audio['raw']['channelmode']];
474 472
 			$thisfile_mpeg_audio['channels']      = (($thisfile_mpeg_audio['channelmode'] == 'mono') ? 1 : 2);
475 473
 			$thisfile_mpeg_audio['sample_rate']   = $MPEGaudioFrequencyLookup[$thisfile_mpeg_audio['version']][$thisfile_mpeg_audio['raw']['sample_rate']];
476
-			$thisfile_mpeg_audio['protection']    = !$thisfile_mpeg_audio['raw']['protection'];
474
+			$thisfile_mpeg_audio['protection']    = ! $thisfile_mpeg_audio['raw']['protection'];
477 475
 			$thisfile_mpeg_audio['private']       = (bool) $thisfile_mpeg_audio['raw']['private'];
478 476
 			$thisfile_mpeg_audio['modeextension'] = $MPEGaudioModeExtensionLookup[$thisfile_mpeg_audio['layer']][$thisfile_mpeg_audio['raw']['modeextension']];
479 477
 			$thisfile_mpeg_audio['copyright']     = (bool) $thisfile_mpeg_audio['raw']['copyright'];
@@ -503,7 +501,7 @@  discard block
 block discarded – undo
503 501
 		}
504 502
 
505 503
 		// For Layer 2 there are some combinations of bitrate and mode which are not allowed.
506
-		if (!$FastMPEGheaderScan && ($thisfile_mpeg_audio['layer'] == '2')) {
504
+		if ( ! $FastMPEGheaderScan && ($thisfile_mpeg_audio['layer'] == '2')) {
507 505
 
508 506
 			$info['audio']['dataformat'] = 'mp2';
509 507
 			switch ($thisfile_mpeg_audio['channelmode']) {
@@ -562,15 +560,15 @@  discard block
 block discarded – undo
562 560
 
563 561
 			$thisfile_mpeg_audio['bitrate_mode'] = 'vbr';
564 562
 			$thisfile_mpeg_audio['VBR_method']   = 'Fraunhofer';
565
-			$info['audio']['codec']                = 'Fraunhofer';
563
+			$info['audio']['codec'] = 'Fraunhofer';
566 564
 
567 565
 			$SideInfoData = substr($headerstring, 4 + 2, 32);
568 566
 
569 567
 			$FraunhoferVBROffset = 36;
570 568
 
571
-			$thisfile_mpeg_audio['VBR_encoder_version']     = getid3_lib::BigEndian2Int(substr($headerstring, $FraunhoferVBROffset +  4, 2)); // VbriVersion
572
-			$thisfile_mpeg_audio['VBR_encoder_delay']       = getid3_lib::BigEndian2Int(substr($headerstring, $FraunhoferVBROffset +  6, 2)); // VbriDelay
573
-			$thisfile_mpeg_audio['VBR_quality']             = getid3_lib::BigEndian2Int(substr($headerstring, $FraunhoferVBROffset +  8, 2)); // VbriQuality
569
+			$thisfile_mpeg_audio['VBR_encoder_version']     = getid3_lib::BigEndian2Int(substr($headerstring, $FraunhoferVBROffset + 4, 2)); // VbriVersion
570
+			$thisfile_mpeg_audio['VBR_encoder_delay']       = getid3_lib::BigEndian2Int(substr($headerstring, $FraunhoferVBROffset + 6, 2)); // VbriDelay
571
+			$thisfile_mpeg_audio['VBR_quality']             = getid3_lib::BigEndian2Int(substr($headerstring, $FraunhoferVBROffset + 8, 2)); // VbriQuality
574 572
 			$thisfile_mpeg_audio['VBR_bytes']               = getid3_lib::BigEndian2Int(substr($headerstring, $FraunhoferVBROffset + 10, 4)); // VbriStreamBytes
575 573
 			$thisfile_mpeg_audio['VBR_frames']              = getid3_lib::BigEndian2Int(substr($headerstring, $FraunhoferVBROffset + 14, 4)); // VbriStreamFrames
576 574
 			$thisfile_mpeg_audio['VBR_seek_offsets']        = getid3_lib::BigEndian2Int(substr($headerstring, $FraunhoferVBROffset + 18, 2)); // VbriTableSize
@@ -640,15 +638,15 @@  discard block
 block discarded – undo
640 638
 				$thisfile_mpeg_audio['xing_flags']['vbr_scale'] = (bool) ($thisfile_mpeg_audio['xing_flags_raw'] & 0x00000008);
641 639
 
642 640
 				if ($thisfile_mpeg_audio['xing_flags']['frames']) {
643
-					$thisfile_mpeg_audio['VBR_frames'] = getid3_lib::BigEndian2Int(substr($headerstring, $VBRidOffset +  8, 4));
641
+					$thisfile_mpeg_audio['VBR_frames'] = getid3_lib::BigEndian2Int(substr($headerstring, $VBRidOffset + 8, 4));
644 642
 					//$thisfile_mpeg_audio['VBR_frames']--; // don't count header Xing/Info frame
645 643
 				}
646 644
 				if ($thisfile_mpeg_audio['xing_flags']['bytes']) {
647
-					$thisfile_mpeg_audio['VBR_bytes']  = getid3_lib::BigEndian2Int(substr($headerstring, $VBRidOffset + 12, 4));
645
+					$thisfile_mpeg_audio['VBR_bytes'] = getid3_lib::BigEndian2Int(substr($headerstring, $VBRidOffset + 12, 4));
648 646
 				}
649 647
 
650 648
 				//if (($thisfile_mpeg_audio['bitrate'] == 'free') && !empty($thisfile_mpeg_audio['VBR_frames']) && !empty($thisfile_mpeg_audio['VBR_bytes'])) {
651
-				if (!empty($thisfile_mpeg_audio['VBR_frames']) && !empty($thisfile_mpeg_audio['VBR_bytes'])) {
649
+				if ( ! empty($thisfile_mpeg_audio['VBR_frames']) && ! empty($thisfile_mpeg_audio['VBR_bytes'])) {
652 650
 
653 651
 					$framelengthfloat = $thisfile_mpeg_audio['VBR_bytes'] / $thisfile_mpeg_audio['VBR_frames'];
654 652
 
@@ -720,7 +718,7 @@  discard block
 block discarded – undo
720 718
 						$LAMEtagRevisionVBRmethod = getid3_lib::BigEndian2Int(substr($headerstring, $LAMEtagOffsetContant + 0xA5, 1));
721 719
 
722 720
 						$thisfile_mpeg_audio_lame['tag_revision']   = ($LAMEtagRevisionVBRmethod & 0xF0) >> 4;
723
-						$thisfile_mpeg_audio_lame_raw['vbr_method'] =  $LAMEtagRevisionVBRmethod & 0x0F;
721
+						$thisfile_mpeg_audio_lame_raw['vbr_method'] = $LAMEtagRevisionVBRmethod & 0x0F;
724 722
 						$thisfile_mpeg_audio_lame['vbr_method']     = self::LAMEvbrMethodLookup($thisfile_mpeg_audio_lame_raw['vbr_method']);
725 723
 						$thisfile_mpeg_audio['bitrate_mode']        = substr($thisfile_mpeg_audio_lame['vbr_method'], 0, 3); // usually either 'cbr' or 'vbr', but truncates 'vbr-old / vbr-rh' to 'vbr'
726 724
 
@@ -745,8 +743,8 @@  discard block
 block discarded – undo
745 743
 							$thisfile_mpeg_audio_lame_RGAD['peak_db'] = getid3_lib::RGADamplitude2dB($thisfile_mpeg_audio_lame_RGAD['peak_amplitude']);
746 744
 						}
747 745
 
748
-						$thisfile_mpeg_audio_lame_raw['RGAD_track']      =   getid3_lib::BigEndian2Int(substr($headerstring, $LAMEtagOffsetContant + 0xAB, 2));
749
-						$thisfile_mpeg_audio_lame_raw['RGAD_album']      =   getid3_lib::BigEndian2Int(substr($headerstring, $LAMEtagOffsetContant + 0xAD, 2));
746
+						$thisfile_mpeg_audio_lame_raw['RGAD_track']      = getid3_lib::BigEndian2Int(substr($headerstring, $LAMEtagOffsetContant + 0xAB, 2));
747
+						$thisfile_mpeg_audio_lame_raw['RGAD_album']      = getid3_lib::BigEndian2Int(substr($headerstring, $LAMEtagOffsetContant + 0xAD, 2));
750 748
 
751 749
 
752 750
 						if ($thisfile_mpeg_audio_lame_raw['RGAD_track'] != 0) {
@@ -754,13 +752,13 @@  discard block
 block discarded – undo
754 752
 							$thisfile_mpeg_audio_lame_RGAD_track['raw']['name']        = ($thisfile_mpeg_audio_lame_raw['RGAD_track'] & 0xE000) >> 13;
755 753
 							$thisfile_mpeg_audio_lame_RGAD_track['raw']['originator']  = ($thisfile_mpeg_audio_lame_raw['RGAD_track'] & 0x1C00) >> 10;
756 754
 							$thisfile_mpeg_audio_lame_RGAD_track['raw']['sign_bit']    = ($thisfile_mpeg_audio_lame_raw['RGAD_track'] & 0x0200) >> 9;
757
-							$thisfile_mpeg_audio_lame_RGAD_track['raw']['gain_adjust'] =  $thisfile_mpeg_audio_lame_raw['RGAD_track'] & 0x01FF;
755
+							$thisfile_mpeg_audio_lame_RGAD_track['raw']['gain_adjust'] = $thisfile_mpeg_audio_lame_raw['RGAD_track'] & 0x01FF;
758 756
 							$thisfile_mpeg_audio_lame_RGAD_track['name']       = getid3_lib::RGADnameLookup($thisfile_mpeg_audio_lame_RGAD_track['raw']['name']);
759 757
 							$thisfile_mpeg_audio_lame_RGAD_track['originator'] = getid3_lib::RGADoriginatorLookup($thisfile_mpeg_audio_lame_RGAD_track['raw']['originator']);
760 758
 							$thisfile_mpeg_audio_lame_RGAD_track['gain_db']    = getid3_lib::RGADadjustmentLookup($thisfile_mpeg_audio_lame_RGAD_track['raw']['gain_adjust'], $thisfile_mpeg_audio_lame_RGAD_track['raw']['sign_bit']);
761 759
 
762
-							if (!empty($thisfile_mpeg_audio_lame_RGAD['peak_amplitude'])) {
763
-								$info['replay_gain']['track']['peak']   = $thisfile_mpeg_audio_lame_RGAD['peak_amplitude'];
760
+							if ( ! empty($thisfile_mpeg_audio_lame_RGAD['peak_amplitude'])) {
761
+								$info['replay_gain']['track']['peak'] = $thisfile_mpeg_audio_lame_RGAD['peak_amplitude'];
764 762
 							}
765 763
 							$info['replay_gain']['track']['originator'] = $thisfile_mpeg_audio_lame_RGAD_track['originator'];
766 764
 							$info['replay_gain']['track']['adjustment'] = $thisfile_mpeg_audio_lame_RGAD_track['gain_db'];
@@ -777,8 +775,8 @@  discard block
 block discarded – undo
777 775
 							$thisfile_mpeg_audio_lame_RGAD_album['originator'] = getid3_lib::RGADoriginatorLookup($thisfile_mpeg_audio_lame_RGAD_album['raw']['originator']);
778 776
 							$thisfile_mpeg_audio_lame_RGAD_album['gain_db']    = getid3_lib::RGADadjustmentLookup($thisfile_mpeg_audio_lame_RGAD_album['raw']['gain_adjust'], $thisfile_mpeg_audio_lame_RGAD_album['raw']['sign_bit']);
779 777
 
780
-							if (!empty($thisfile_mpeg_audio_lame_RGAD['peak_amplitude'])) {
781
-								$info['replay_gain']['album']['peak']   = $thisfile_mpeg_audio_lame_RGAD['peak_amplitude'];
778
+							if ( ! empty($thisfile_mpeg_audio_lame_RGAD['peak_amplitude'])) {
779
+								$info['replay_gain']['album']['peak'] = $thisfile_mpeg_audio_lame_RGAD['peak_amplitude'];
782 780
 							}
783 781
 							$info['replay_gain']['album']['originator'] = $thisfile_mpeg_audio_lame_RGAD_album['originator'];
784 782
 							$info['replay_gain']['album']['adjustment'] = $thisfile_mpeg_audio_lame_RGAD_album['gain_db'];
@@ -796,7 +794,7 @@  discard block
 block discarded – undo
796 794
 						$thisfile_mpeg_audio_lame['encoding_flags']['nssafejoint'] = (bool) ($EncodingFlagsATHtype & 0x20);
797 795
 						$thisfile_mpeg_audio_lame['encoding_flags']['nogap_next']  = (bool) ($EncodingFlagsATHtype & 0x40);
798 796
 						$thisfile_mpeg_audio_lame['encoding_flags']['nogap_prev']  = (bool) ($EncodingFlagsATHtype & 0x80);
799
-						$thisfile_mpeg_audio_lame['ath_type']                      =         $EncodingFlagsATHtype & 0x0F;
797
+						$thisfile_mpeg_audio_lame['ath_type']                      = $EncodingFlagsATHtype & 0x0F;
800 798
 
801 799
 						// byte $B0  if ABR {specified bitrate} else {minimal bitrate}
802 800
 						$thisfile_mpeg_audio_lame['raw']['abrbitrate_minbitrate'] = getid3_lib::BigEndian2Int(substr($headerstring, $LAMEtagOffsetContant + 0xB0, 1));
@@ -811,7 +809,7 @@  discard block
 block discarded – undo
811 809
 						// bytes $B1-$B3  Encoder delays
812 810
 						$EncoderDelays = getid3_lib::BigEndian2Int(substr($headerstring, $LAMEtagOffsetContant + 0xB1, 3));
813 811
 						$thisfile_mpeg_audio_lame['encoder_delay'] = ($EncoderDelays & 0xFFF000) >> 12;
814
-						$thisfile_mpeg_audio_lame['end_padding']   =  $EncoderDelays & 0x000FFF;
812
+						$thisfile_mpeg_audio_lame['end_padding']   = $EncoderDelays & 0x000FFF;
815 813
 
816 814
 						// byte $B4  Misc
817 815
 						$MiscByte = getid3_lib::BigEndian2Int(substr($headerstring, $LAMEtagOffsetContant + 0xB4, 1));
@@ -836,10 +834,10 @@  discard block
 block discarded – undo
836 834
 						$thisfile_mpeg_audio_lame['surround_info']     = self::LAMEsurroundInfoLookup($thisfile_mpeg_audio_lame_raw['surround_info']);
837 835
 						$thisfile_mpeg_audio_lame['preset_used_id']    = ($PresetSurroundBytes & 0x07FF);
838 836
 						$thisfile_mpeg_audio_lame['preset_used']       = self::LAMEpresetUsedLookup($thisfile_mpeg_audio_lame);
839
-						if (!empty($thisfile_mpeg_audio_lame['preset_used_id']) && empty($thisfile_mpeg_audio_lame['preset_used'])) {
837
+						if ( ! empty($thisfile_mpeg_audio_lame['preset_used_id']) && empty($thisfile_mpeg_audio_lame['preset_used'])) {
840 838
 							$info['warning'][] = 'Unknown LAME preset used ('.$thisfile_mpeg_audio_lame['preset_used_id'].') - please report to [email protected]';
841 839
 						}
842
-						if (($thisfile_mpeg_audio_lame['short_version'] == 'LAME3.90.') && !empty($thisfile_mpeg_audio_lame['preset_used_id'])) {
840
+						if (($thisfile_mpeg_audio_lame['short_version'] == 'LAME3.90.') && ! empty($thisfile_mpeg_audio_lame['preset_used_id'])) {
843 841
 							// this may change if 3.90.4 ever comes out
844 842
 							$thisfile_mpeg_audio_lame['short_version'] = 'LAME3.90.3';
845 843
 						}
@@ -948,7 +946,7 @@  discard block
 block discarded – undo
948 946
 					}
949 947
 					$thisfile_mpeg_audio['VBR_bitrate'] = (isset($thisfile_mpeg_audio['VBR_bytes']) ? (($thisfile_mpeg_audio['VBR_bytes'] / $thisfile_mpeg_audio['VBR_frames']) * 8) * ($info['audio']['sample_rate'] / $bytes_per_frame) : 0);
950 948
 					if ($thisfile_mpeg_audio['VBR_bitrate'] > 0) {
951
-						$info['audio']['bitrate']         = $thisfile_mpeg_audio['VBR_bitrate'];
949
+						$info['audio']['bitrate'] = $thisfile_mpeg_audio['VBR_bitrate'];
952 950
 						$thisfile_mpeg_audio['bitrate'] = $thisfile_mpeg_audio['VBR_bitrate']; // to avoid confusion
953 951
 					}
954 952
 					break;
@@ -960,7 +958,7 @@  discard block
 block discarded – undo
960 958
 
961 959
 		if ($recursivesearch) {
962 960
 
963
-			if (!$this->RecursiveFrameScanning($offset, $nextframetestoffset, $ScanAsCBR)) {
961
+			if ( ! $this->RecursiveFrameScanning($offset, $nextframetestoffset, $ScanAsCBR)) {
964 962
 				return false;
965 963
 			}
966 964
 
@@ -1088,7 +1086,7 @@  discard block
 block discarded – undo
1088 1086
 			if ($this->decodeMPEGaudioHeader($nextframetestoffset, $nextframetestarray, false)) {
1089 1087
 				if ($ScanAsCBR) {
1090 1088
 					// force CBR mode, used for trying to pick out invalid audio streams with valid(?) VBR headers, or VBR streams with no VBR header
1091
-					if (!isset($nextframetestarray['mpeg']['audio']['bitrate']) || !isset($firstframetestarray['mpeg']['audio']['bitrate']) || ($nextframetestarray['mpeg']['audio']['bitrate'] != $firstframetestarray['mpeg']['audio']['bitrate'])) {
1089
+					if ( ! isset($nextframetestarray['mpeg']['audio']['bitrate']) || ! isset($firstframetestarray['mpeg']['audio']['bitrate']) || ($nextframetestarray['mpeg']['audio']['bitrate'] != $firstframetestarray['mpeg']['audio']['bitrate'])) {
1092 1090
 						return false;
1093 1091
 					}
1094 1092
 				}
@@ -1102,7 +1100,7 @@  discard block
 block discarded – undo
1102 1100
 					return false;
1103 1101
 				}
1104 1102
 
1105
-			} elseif (!empty($firstframetestarray['mpeg']['audio']['framelength']) && (($nextframetestoffset + $firstframetestarray['mpeg']['audio']['framelength']) > $info['avdataend'])) {
1103
+			} elseif ( ! empty($firstframetestarray['mpeg']['audio']['framelength']) && (($nextframetestoffset + $firstframetestarray['mpeg']['audio']['framelength']) > $info['avdataend'])) {
1106 1104
 
1107 1105
 				// it's not the end of the file, but there's not enough data left for another frame, so assume it's garbage/padding and return OK
1108 1106
 				return true;
@@ -1118,7 +1116,7 @@  discard block
 block discarded – undo
1118 1116
 		return true;
1119 1117
 	}
1120 1118
 
1121
-	public function FreeFormatFrameLength($offset, $deepscan=false) {
1119
+	public function FreeFormatFrameLength($offset, $deepscan = false) {
1122 1120
 		$info = &$this->getid3->info;
1123 1121
 
1124 1122
 		$this->fseek($offset);
@@ -1140,7 +1138,7 @@  discard block
 block discarded – undo
1140 1138
 		if (($framelength2 > 4) && ($framelength2 < $framelength1)) {
1141 1139
 			$framelength = $framelength2;
1142 1140
 		}
1143
-		if (!$framelength) {
1141
+		if ( ! $framelength) {
1144 1142
 
1145 1143
 			// LAME 3.88 has a different value for modeextension on the first frame vs the rest
1146 1144
 			$framelength1 = strpos($MPEGaudioData, substr($SyncPattern1, 0, 3), 4);
@@ -1152,7 +1150,7 @@  discard block
 block discarded – undo
1152 1150
 			if (($framelength2 > 4) && ($framelength2 < $framelength1)) {
1153 1151
 				$framelength = $framelength2;
1154 1152
 			}
1155
-			if (!$framelength) {
1153
+			if ( ! $framelength) {
1156 1154
 				$info['error'][] = 'Cannot find next free-format synch pattern ('.getid3_lib::PrintHexBytes($SyncPattern1).' or '.getid3_lib::PrintHexBytes($SyncPattern2).') after offset '.$offset;
1157 1155
 				return false;
1158 1156
 			} else {
@@ -1239,15 +1237,15 @@  discard block
 block discarded – undo
1239 1237
 				}
1240 1238
 				continue;
1241 1239
 			}
1242
-			if (!isset($MPEGaudioHeaderDecodeCache[$head4])) {
1240
+			if ( ! isset($MPEGaudioHeaderDecodeCache[$head4])) {
1243 1241
 				$MPEGaudioHeaderDecodeCache[$head4] = self::MPEGaudioHeaderDecode($head4);
1244 1242
 			}
1245
-			if (!isset($MPEGaudioHeaderValidCache[$head4])) {
1243
+			if ( ! isset($MPEGaudioHeaderValidCache[$head4])) {
1246 1244
 				$MPEGaudioHeaderValidCache[$head4] = self::MPEGaudioHeaderValid($MPEGaudioHeaderDecodeCache[$head4], false, false);
1247 1245
 			}
1248 1246
 			if ($MPEGaudioHeaderValidCache[$head4]) {
1249 1247
 
1250
-				if (!isset($MPEGaudioHeaderLengthCache[$head4])) {
1248
+				if ( ! isset($MPEGaudioHeaderLengthCache[$head4])) {
1251 1249
 					$LongMPEGversionLookup[$head4]   = $MPEGaudioVersionLookup[$MPEGaudioHeaderDecodeCache[$head4]['version']];
1252 1250
 					$LongMPEGlayerLookup[$head4]     = $MPEGaudioLayerLookup[$MPEGaudioHeaderDecodeCache[$head4]['layer']];
1253 1251
 					$LongMPEGbitrateLookup[$head4]   = $MPEGaudioBitrateLookup[$LongMPEGversionLookup[$head4]][$LongMPEGlayerLookup[$head4]][$MPEGaudioHeaderDecodeCache[$head4]['bitrate']];
@@ -1265,10 +1263,10 @@  discard block
 block discarded – undo
1265 1263
 					$this->fseek($MPEGaudioHeaderLengthCache[$head4] - 4, SEEK_CUR);
1266 1264
 					$next4 = $this->fread(4);
1267 1265
 					if ($next4{0} == "\xFF") {
1268
-						if (!isset($MPEGaudioHeaderDecodeCache[$next4])) {
1266
+						if ( ! isset($MPEGaudioHeaderDecodeCache[$next4])) {
1269 1267
 							$MPEGaudioHeaderDecodeCache[$next4] = self::MPEGaudioHeaderDecode($next4);
1270 1268
 						}
1271
-						if (!isset($MPEGaudioHeaderValidCache[$next4])) {
1269
+						if ( ! isset($MPEGaudioHeaderValidCache[$next4])) {
1272 1270
 							$MPEGaudioHeaderValidCache[$next4] = self::MPEGaudioHeaderValid($MPEGaudioHeaderDecodeCache[$next4], false, false);
1273 1271
 						}
1274 1272
 						if ($MPEGaudioHeaderValidCache[$next4]) {
@@ -1324,7 +1322,7 @@  discard block
 block discarded – undo
1324 1322
 				$bittotal += ($bitratevalue * $bitratecount);
1325 1323
 			}
1326 1324
 		}
1327
-		$info['mpeg']['audio']['frame_count']  = array_sum($Distribution['bitrate']);
1325
+		$info['mpeg']['audio']['frame_count'] = array_sum($Distribution['bitrate']);
1328 1326
 		if ($info['mpeg']['audio']['frame_count'] == 0) {
1329 1327
 			$info['error'][] = 'no MPEG audio frames found';
1330 1328
 			return false;
@@ -1343,7 +1341,7 @@  discard block
 block discarded – undo
1343 1341
 	}
1344 1342
 
1345 1343
 
1346
-	public function getOnlyMPEGaudioInfo($avdataoffset, $BitrateHistogram=false) {
1344
+	public function getOnlyMPEGaudioInfo($avdataoffset, $BitrateHistogram = false) {
1347 1345
 		// looks for synch, decodes MPEG audio header
1348 1346
 
1349 1347
 		$info = &$this->getid3->info;
@@ -1368,7 +1366,7 @@  discard block
 block discarded – undo
1368 1366
 		$sync_seek_buffer_size = strlen($header);
1369 1367
 		$SynchSeekOffset = 0;
1370 1368
 		while ($SynchSeekOffset < $sync_seek_buffer_size) {
1371
-			if ((($avdataoffset + $SynchSeekOffset)  < $info['avdataend']) && !feof($this->getid3->fp)) {
1369
+			if ((($avdataoffset + $SynchSeekOffset) < $info['avdataend']) && ! feof($this->getid3->fp)) {
1372 1370
 
1373 1371
 				if ($SynchSeekOffset > $sync_seek_buffer_size) {
1374 1372
 					// if a synch's not found within the first 128k bytes, then give up
@@ -1393,7 +1391,7 @@  discard block
 block discarded – undo
1393 1391
 					if (isset($info['mpeg']['audio'])) {
1394 1392
 						unset($info['mpeg']['audio']);
1395 1393
 					}
1396
-					if (isset($info['mpeg']) && (!is_array($info['mpeg']) || (count($info['mpeg']) == 0))) {
1394
+					if (isset($info['mpeg']) && ( ! is_array($info['mpeg']) || (count($info['mpeg']) == 0))) {
1397 1395
 						unset($info['mpeg']);
1398 1396
 					}
1399 1397
 					return false;
@@ -1406,10 +1404,10 @@  discard block
 block discarded – undo
1406 1404
 			}
1407 1405
 
1408 1406
 			if (($header{$SynchSeekOffset} == "\xFF") && ($header{($SynchSeekOffset + 1)} > "\xE0")) { // synch detected
1409
-				if (!isset($FirstFrameThisfileInfo) && !isset($info['mpeg']['audio'])) {
1407
+				if ( ! isset($FirstFrameThisfileInfo) && ! isset($info['mpeg']['audio'])) {
1410 1408
 					$FirstFrameThisfileInfo = $info;
1411 1409
 					$FirstFrameAVDataOffset = $avdataoffset + $SynchSeekOffset;
1412
-					if (!$this->decodeMPEGaudioHeader($FirstFrameAVDataOffset, $FirstFrameThisfileInfo, false)) {
1410
+					if ( ! $this->decodeMPEGaudioHeader($FirstFrameAVDataOffset, $FirstFrameThisfileInfo, false)) {
1413 1411
 						// if this is the first valid MPEG-audio frame, save it in case it's a VBR header frame and there's
1414 1412
 						// garbage between this frame and a valid sequence of MPEG-audio frames, to be restored below
1415 1413
 						unset($FirstFrameThisfileInfo);
@@ -1421,16 +1419,12 @@  discard block
 block discarded – undo
1421 1419
 					$info = $dummy;
1422 1420
 					$info['avdataoffset'] = $avdataoffset + $SynchSeekOffset;
1423 1421
 					switch (isset($info['fileformat']) ? $info['fileformat'] : '') {
1424
-						case '':
1425
-						case 'id3':
1426
-						case 'ape':
1427
-						case 'mp3':
1428
-							$info['fileformat']          = 'mp3';
1422
+						case '' : case 'id3' : case 'ape' : case 'mp3' : $info['fileformat']          = 'mp3';
1429 1423
 							$info['audio']['dataformat'] = 'mp3';
1430 1424
 							break;
1431 1425
 					}
1432 1426
 					if (isset($FirstFrameThisfileInfo['mpeg']['audio']['bitrate_mode']) && ($FirstFrameThisfileInfo['mpeg']['audio']['bitrate_mode'] == 'vbr')) {
1433
-						if (!(abs($info['audio']['bitrate'] - $FirstFrameThisfileInfo['audio']['bitrate']) <= 1)) {
1427
+						if ( ! (abs($info['audio']['bitrate'] - $FirstFrameThisfileInfo['audio']['bitrate']) <= 1)) {
1434 1428
 							// If there is garbage data between a valid VBR header frame and a sequence
1435 1429
 							// of valid MPEG-audio frames the VBR data is no longer discarded.
1436 1430
 							$info = $FirstFrameThisfileInfo;
@@ -1450,7 +1444,7 @@  discard block
 block discarded – undo
1450 1444
 							}
1451 1445
 						}
1452 1446
 					}
1453
-					if (isset($info['mpeg']['audio']['bitrate_mode']) && ($info['mpeg']['audio']['bitrate_mode'] == 'vbr') && !isset($info['mpeg']['audio']['VBR_method'])) {
1447
+					if (isset($info['mpeg']['audio']['bitrate_mode']) && ($info['mpeg']['audio']['bitrate_mode'] == 'vbr') && ! isset($info['mpeg']['audio']['VBR_method'])) {
1454 1448
 						// VBR file with no VBR header
1455 1449
 						$BitrateHistogram = true;
1456 1450
 					}
@@ -1479,7 +1473,7 @@  discard block
 block discarded – undo
1479 1473
 						$this->fseek($info['avdataoffset']);
1480 1474
 
1481 1475
 						// you can play with these numbers:
1482
-						$max_frames_scan  = 50000;
1476
+						$max_frames_scan = 50000;
1483 1477
 						$max_scan_segments = 10;
1484 1478
 
1485 1479
 						// don't play with these numbers:
@@ -1541,7 +1535,7 @@  discard block
 block discarded – undo
1541 1535
 						if ($pct_data_scanned > 0) {
1542 1536
 							$info['warning'][] = 'too many MPEG audio frames to scan, only scanned '.$frames_scanned.' frames in '.$max_scan_segments.' segments ('.number_format($pct_data_scanned * 100, 1).'% of file) and extrapolated distribution, playtime and bitrate may be incorrect.';
1543 1537
 							foreach ($info['mpeg']['audio'] as $key1 => $value1) {
1544
-								if (!preg_match('#_distribution$#i', $key1)) {
1538
+								if ( ! preg_match('#_distribution$#i', $key1)) {
1545 1539
 									continue;
1546 1540
 								}
1547 1541
 								foreach ($value1 as $key2 => $value2) {
@@ -1606,7 +1600,7 @@  discard block
 block discarded – undo
1606 1600
 					if (isset($info['mpeg']['audio'])) {
1607 1601
 						unset($info['mpeg']['audio']);
1608 1602
 					}
1609
-					if (isset($info['mpeg']) && (!is_array($info['mpeg']) || empty($info['mpeg']))) {
1603
+					if (isset($info['mpeg']) && ( ! is_array($info['mpeg']) || empty($info['mpeg']))) {
1610 1604
 						unset($info['mpeg']);
1611 1605
 					}
1612 1606
 					return false;
@@ -1636,14 +1630,14 @@  discard block
 block discarded – undo
1636 1630
 	public static function MPEGaudioBitrateArray() {
1637 1631
 		static $MPEGaudioBitrate;
1638 1632
 		if (empty($MPEGaudioBitrate)) {
1639
-			$MPEGaudioBitrate = array (
1640
-				'1'  =>  array (1 => array('free', 32000, 64000, 96000, 128000, 160000, 192000, 224000, 256000, 288000, 320000, 352000, 384000, 416000, 448000),
1641
-								2 => array('free', 32000, 48000, 56000,  64000,  80000,  96000, 112000, 128000, 160000, 192000, 224000, 256000, 320000, 384000),
1642
-								3 => array('free', 32000, 40000, 48000,  56000,  64000,  80000,  96000, 112000, 128000, 160000, 192000, 224000, 256000, 320000)
1633
+			$MPEGaudioBitrate = array(
1634
+				'1'  =>  array(1 => array('free', 32000, 64000, 96000, 128000, 160000, 192000, 224000, 256000, 288000, 320000, 352000, 384000, 416000, 448000),
1635
+								2 => array('free', 32000, 48000, 56000, 64000, 80000, 96000, 112000, 128000, 160000, 192000, 224000, 256000, 320000, 384000),
1636
+								3 => array('free', 32000, 40000, 48000, 56000, 64000, 80000, 96000, 112000, 128000, 160000, 192000, 224000, 256000, 320000)
1643 1637
 							   ),
1644 1638
 
1645
-				'2'  =>  array (1 => array('free', 32000, 48000, 56000,  64000,  80000,  96000, 112000, 128000, 144000, 160000, 176000, 192000, 224000, 256000),
1646
-								2 => array('free',  8000, 16000, 24000,  32000,  40000,  48000,  56000,  64000,  80000,  96000, 112000, 128000, 144000, 160000),
1639
+				'2'  =>  array(1 => array('free', 32000, 48000, 56000, 64000, 80000, 96000, 112000, 128000, 144000, 160000, 176000, 192000, 224000, 256000),
1640
+								2 => array('free', 8000, 16000, 24000, 32000, 40000, 48000, 56000, 64000, 80000, 96000, 112000, 128000, 144000, 160000),
1647 1641
 							   )
1648 1642
 			);
1649 1643
 			$MPEGaudioBitrate['2'][3] = $MPEGaudioBitrate['2'][2];
@@ -1655,10 +1649,10 @@  discard block
 block discarded – undo
1655 1649
 	public static function MPEGaudioFrequencyArray() {
1656 1650
 		static $MPEGaudioFrequency;
1657 1651
 		if (empty($MPEGaudioFrequency)) {
1658
-			$MPEGaudioFrequency = array (
1652
+			$MPEGaudioFrequency = array(
1659 1653
 				'1'   => array(44100, 48000, 32000),
1660 1654
 				'2'   => array(22050, 24000, 16000),
1661
-				'2.5' => array(11025, 12000,  8000)
1655
+				'2.5' => array(11025, 12000, 8000)
1662 1656
 			);
1663 1657
 		}
1664 1658
 		return $MPEGaudioFrequency;
@@ -1672,7 +1666,7 @@  discard block
 block discarded – undo
1672 1666
 	public static function MPEGaudioModeExtensionArray() {
1673 1667
 		static $MPEGaudioModeExtension;
1674 1668
 		if (empty($MPEGaudioModeExtension)) {
1675
-			$MPEGaudioModeExtension = array (
1669
+			$MPEGaudioModeExtension = array(
1676 1670
 				1 => array('4-31', '8-31', '12-31', '16-31'),
1677 1671
 				2 => array('4-31', '8-31', '12-31', '16-31'),
1678 1672
 				3 => array('', 'IS', 'MS', 'IS+MS')
@@ -1686,11 +1680,11 @@  discard block
 block discarded – undo
1686 1680
 		return $MPEGaudioEmphasis;
1687 1681
 	}
1688 1682
 
1689
-	public static function MPEGaudioHeaderBytesValid($head4, $allowBitrate15=false) {
1683
+	public static function MPEGaudioHeaderBytesValid($head4, $allowBitrate15 = false) {
1690 1684
 		return self::MPEGaudioHeaderValid(self::MPEGaudioHeaderDecode($head4), false, $allowBitrate15);
1691 1685
 	}
1692 1686
 
1693
-	public static function MPEGaudioHeaderValid($rawarray, $echoerrors=false, $allowBitrate15=false) {
1687
+	public static function MPEGaudioHeaderValid($rawarray, $echoerrors = false, $allowBitrate15 = false) {
1694 1688
 		if (($rawarray['synch'] & 0x0FFE) != 0x0FFE) {
1695 1689
 			return false;
1696 1690
 		}
@@ -1724,31 +1718,31 @@  discard block
 block discarded – undo
1724 1718
 			echo ($echoerrors ? "\n".'invalid Layer ('.$rawarray['layer'].')' : '');
1725 1719
 			return false;
1726 1720
 		}
1727
-		if (!isset($MPEGaudioBitrateLookup[$decodedVersion][$decodedLayer][$rawarray['bitrate']])) {
1721
+		if ( ! isset($MPEGaudioBitrateLookup[$decodedVersion][$decodedLayer][$rawarray['bitrate']])) {
1728 1722
 			echo ($echoerrors ? "\n".'invalid Bitrate ('.$rawarray['bitrate'].')' : '');
1729 1723
 			if ($rawarray['bitrate'] == 15) {
1730 1724
 				// known issue in LAME 3.90 - 3.93.1 where free-format has bitrate ID of 15 instead of 0
1731 1725
 				// let it go through here otherwise file will not be identified
1732
-				if (!$allowBitrate15) {
1726
+				if ( ! $allowBitrate15) {
1733 1727
 					return false;
1734 1728
 				}
1735 1729
 			} else {
1736 1730
 				return false;
1737 1731
 			}
1738 1732
 		}
1739
-		if (!isset($MPEGaudioFrequencyLookup[$decodedVersion][$rawarray['sample_rate']])) {
1733
+		if ( ! isset($MPEGaudioFrequencyLookup[$decodedVersion][$rawarray['sample_rate']])) {
1740 1734
 			echo ($echoerrors ? "\n".'invalid Frequency ('.$rawarray['sample_rate'].')' : '');
1741 1735
 			return false;
1742 1736
 		}
1743
-		if (!isset($MPEGaudioChannelModeLookup[$rawarray['channelmode']])) {
1737
+		if ( ! isset($MPEGaudioChannelModeLookup[$rawarray['channelmode']])) {
1744 1738
 			echo ($echoerrors ? "\n".'invalid ChannelMode ('.$rawarray['channelmode'].')' : '');
1745 1739
 			return false;
1746 1740
 		}
1747
-		if (!isset($MPEGaudioModeExtensionLookup[$decodedLayer][$rawarray['modeextension']])) {
1741
+		if ( ! isset($MPEGaudioModeExtensionLookup[$decodedLayer][$rawarray['modeextension']])) {
1748 1742
 			echo ($echoerrors ? "\n".'invalid Mode Extension ('.$rawarray['modeextension'].')' : '');
1749 1743
 			return false;
1750 1744
 		}
1751
-		if (!isset($MPEGaudioEmphasisLookup[$rawarray['emphasis']])) {
1745
+		if ( ! isset($MPEGaudioEmphasisLookup[$rawarray['emphasis']])) {
1752 1746
 			echo ($echoerrors ? "\n".'invalid Emphasis ('.$rawarray['emphasis'].')' : '');
1753 1747
 			return false;
1754 1748
 		}
@@ -1785,16 +1779,16 @@  discard block
 block discarded – undo
1785 1779
 		$MPEGrawHeader['synch']         = (getid3_lib::BigEndian2Int(substr($Header4Bytes, 0, 2)) & 0xFFE0) >> 4;
1786 1780
 		$MPEGrawHeader['version']       = (ord($Header4Bytes{1}) & 0x18) >> 3; //    BB
1787 1781
 		$MPEGrawHeader['layer']         = (ord($Header4Bytes{1}) & 0x06) >> 1; //      CC
1788
-		$MPEGrawHeader['protection']    = (ord($Header4Bytes{1}) & 0x01);      //        D
1782
+		$MPEGrawHeader['protection']    = (ord($Header4Bytes{1}) & 0x01); //        D
1789 1783
 		$MPEGrawHeader['bitrate']       = (ord($Header4Bytes{2}) & 0xF0) >> 4; // EEEE
1790 1784
 		$MPEGrawHeader['sample_rate']   = (ord($Header4Bytes{2}) & 0x0C) >> 2; //     FF
1791 1785
 		$MPEGrawHeader['padding']       = (ord($Header4Bytes{2}) & 0x02) >> 1; //       G
1792
-		$MPEGrawHeader['private']       = (ord($Header4Bytes{2}) & 0x01);      //        H
1786
+		$MPEGrawHeader['private']       = (ord($Header4Bytes{2}) & 0x01); //        H
1793 1787
 		$MPEGrawHeader['channelmode']   = (ord($Header4Bytes{3}) & 0xC0) >> 6; // II
1794 1788
 		$MPEGrawHeader['modeextension'] = (ord($Header4Bytes{3}) & 0x30) >> 4; //   JJ
1795 1789
 		$MPEGrawHeader['copyright']     = (ord($Header4Bytes{3}) & 0x08) >> 3; //     K
1796 1790
 		$MPEGrawHeader['original']      = (ord($Header4Bytes{3}) & 0x04) >> 2; //      L
1797
-		$MPEGrawHeader['emphasis']      = (ord($Header4Bytes{3}) & 0x03);      //       MM
1791
+		$MPEGrawHeader['emphasis']      = (ord($Header4Bytes{3}) & 0x03); //       MM
1798 1792
 
1799 1793
 		return $MPEGrawHeader;
1800 1794
 	}
@@ -1802,7 +1796,7 @@  discard block
 block discarded – undo
1802 1796
 	public static function MPEGaudioFrameLength(&$bitrate, &$version, &$layer, $padding, &$samplerate) {
1803 1797
 		static $AudioFrameLengthCache = array();
1804 1798
 
1805
-		if (!isset($AudioFrameLengthCache[$bitrate][$version][$layer][$padding][$samplerate])) {
1799
+		if ( ! isset($AudioFrameLengthCache[$bitrate][$version][$layer][$padding][$samplerate])) {
1806 1800
 			$AudioFrameLengthCache[$bitrate][$version][$layer][$padding][$samplerate] = false;
1807 1801
 			if ($bitrate != 'free') {
1808 1802
 
@@ -1861,10 +1855,10 @@  discard block
 block discarded – undo
1861 1855
 	}
1862 1856
 
1863 1857
 	public static function ClosestStandardMP3Bitrate($bit_rate) {
1864
-		static $standard_bit_rates = array (320000, 256000, 224000, 192000, 160000, 128000, 112000, 96000, 80000, 64000, 56000, 48000, 40000, 32000, 24000, 16000, 8000);
1865
-		static $bit_rate_table = array (0=>'-');
1858
+		static $standard_bit_rates = array(320000, 256000, 224000, 192000, 160000, 128000, 112000, 96000, 80000, 64000, 56000, 48000, 40000, 32000, 24000, 16000, 8000);
1859
+		static $bit_rate_table = array(0=>'-');
1866 1860
 		$round_bit_rate = intval(round($bit_rate, -3));
1867
-		if (!isset($bit_rate_table[$round_bit_rate])) {
1861
+		if ( ! isset($bit_rate_table[$round_bit_rate])) {
1868 1862
 			if ($round_bit_rate > max($standard_bit_rates)) {
1869 1863
 				$bit_rate_table[$round_bit_rate] = round($bit_rate, 2 - strlen($bit_rate));
1870 1864
 			} else {
@@ -1883,20 +1877,20 @@  discard block
 block discarded – undo
1883 1877
 	public static function XingVBRidOffset($version, $channelmode) {
1884 1878
 		static $XingVBRidOffsetCache = array();
1885 1879
 		if (empty($XingVBRidOffset)) {
1886
-			$XingVBRidOffset = array (
1887
-				'1'   => array ('mono'          => 0x15, // 4 + 17 = 21
1880
+			$XingVBRidOffset = array(
1881
+				'1'   => array('mono'          => 0x15, // 4 + 17 = 21
1888 1882
 								'stereo'        => 0x24, // 4 + 32 = 36
1889 1883
 								'joint stereo'  => 0x24,
1890 1884
 								'dual channel'  => 0x24
1891 1885
 							   ),
1892 1886
 
1893
-				'2'   => array ('mono'          => 0x0D, // 4 +  9 = 13
1887
+				'2'   => array('mono'          => 0x0D, // 4 +  9 = 13
1894 1888
 								'stereo'        => 0x15, // 4 + 17 = 21
1895 1889
 								'joint stereo'  => 0x15,
1896 1890
 								'dual channel'  => 0x15
1897 1891
 							   ),
1898 1892
 
1899
-				'2.5' => array ('mono'          => 0x15,
1893
+				'2.5' => array('mono'          => 0x15,
1900 1894
 								'stereo'        => 0x15,
1901 1895
 								'joint stereo'  => 0x15,
1902 1896
 								'dual channel'  => 0x15
@@ -1991,20 +1985,20 @@  discard block
 block discarded – undo
1991 1985
 		$LAMEpresetUsedLookup[1007] = '--alt-preset fast medium';
1992 1986
 
1993 1987
 		// LAME 3.94 additions/changes
1994
-		$LAMEpresetUsedLookup[1010] = '--preset portable';                                                           // 3.94a15 Oct 21 2003
1995
-		$LAMEpresetUsedLookup[1015] = '--preset radio';                                                              // 3.94a15 Oct 21 2003
1988
+		$LAMEpresetUsedLookup[1010] = '--preset portable'; // 3.94a15 Oct 21 2003
1989
+		$LAMEpresetUsedLookup[1015] = '--preset radio'; // 3.94a15 Oct 21 2003
1996 1990
 
1997
-		$LAMEpresetUsedLookup[320]  = '--preset insane';                                                             // 3.94a15 Nov 12 2003
1991
+		$LAMEpresetUsedLookup[320]  = '--preset insane'; // 3.94a15 Nov 12 2003
1998 1992
 		$LAMEpresetUsedLookup[410]  = '-V9';
1999 1993
 		$LAMEpresetUsedLookup[420]  = '-V8';
2000 1994
 		$LAMEpresetUsedLookup[440]  = '-V6';
2001
-		$LAMEpresetUsedLookup[430]  = '--preset radio';                                                              // 3.94a15 Nov 12 2003
2002
-		$LAMEpresetUsedLookup[450]  = '--preset '.(($LAMEtag['raw']['vbr_method'] == 4) ? 'fast ' : '').'portable';  // 3.94a15 Nov 12 2003
2003
-		$LAMEpresetUsedLookup[460]  = '--preset '.(($LAMEtag['raw']['vbr_method'] == 4) ? 'fast ' : '').'medium';    // 3.94a15 Nov 12 2003
2004
-		$LAMEpresetUsedLookup[470]  = '--r3mix';                                                                     // 3.94b1  Dec 18 2003
2005
-		$LAMEpresetUsedLookup[480]  = '--preset '.(($LAMEtag['raw']['vbr_method'] == 4) ? 'fast ' : '').'standard';  // 3.94a15 Nov 12 2003
1995
+		$LAMEpresetUsedLookup[430]  = '--preset radio'; // 3.94a15 Nov 12 2003
1996
+		$LAMEpresetUsedLookup[450]  = '--preset '.(($LAMEtag['raw']['vbr_method'] == 4) ? 'fast ' : '').'portable'; // 3.94a15 Nov 12 2003
1997
+		$LAMEpresetUsedLookup[460]  = '--preset '.(($LAMEtag['raw']['vbr_method'] == 4) ? 'fast ' : '').'medium'; // 3.94a15 Nov 12 2003
1998
+		$LAMEpresetUsedLookup[470]  = '--r3mix'; // 3.94b1  Dec 18 2003
1999
+		$LAMEpresetUsedLookup[480]  = '--preset '.(($LAMEtag['raw']['vbr_method'] == 4) ? 'fast ' : '').'standard'; // 3.94a15 Nov 12 2003
2006 2000
 		$LAMEpresetUsedLookup[490]  = '-V1';
2007
-		$LAMEpresetUsedLookup[500]  = '--preset '.(($LAMEtag['raw']['vbr_method'] == 4) ? 'fast ' : '').'extreme';   // 3.94a15 Nov 12 2003
2001
+		$LAMEpresetUsedLookup[500]  = '--preset '.(($LAMEtag['raw']['vbr_method'] == 4) ? 'fast ' : '').'extreme'; // 3.94a15 Nov 12 2003
2008 2002
 
2009 2003
 		return (isset($LAMEpresetUsedLookup[$LAMEtag['preset_used_id']]) ? $LAMEpresetUsedLookup[$LAMEtag['preset_used_id']] : 'new/unknown preset: '.$LAMEtag['preset_used_id'].' - report to [email protected]');
2010 2004
 	}
Please login to merge, or discard this patch.
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -893,11 +893,9 @@
 block discarded – undo
893 893
 			if ($ExpectedNumberOfAudioBytes > ($info['avdataend'] - $info['avdataoffset'])) {
894 894
 				if ($this->isDependencyFor('matroska') || $this->isDependencyFor('riff')) {
895 895
 					// ignore, audio data is broken into chunks so will always be data "missing"
896
-				}
897
-				elseif (($ExpectedNumberOfAudioBytes - ($info['avdataend'] - $info['avdataoffset'])) == 1) {
896
+				} elseif (($ExpectedNumberOfAudioBytes - ($info['avdataend'] - $info['avdataoffset'])) == 1) {
898 897
 					$this->warning('Last byte of data truncated (this is a known bug in Meracl ID3 Tag Writer before v1.3.5)');
899
-				}
900
-				else {
898
+				} else {
901 899
 					$this->warning('Probable truncated file: expecting '.$ExpectedNumberOfAudioBytes.' bytes of audio data, only found '.($info['avdataend'] - $info['avdataoffset']).' (short by '.($ExpectedNumberOfAudioBytes - ($info['avdataend'] - $info['avdataoffset'])).' bytes)');
902 900
 				}
903 901
 			} else {
Please login to merge, or discard this patch.
src/wp-includes/ID3/module.audio.ogg.php 4 patches
Doc Comments   +5 added lines patch added patch discarded remove patch
@@ -427,6 +427,11 @@
 block discarded – undo
427 427
 	}
428 428
 
429 429
 	// http://tools.ietf.org/html/draft-ietf-codec-oggopus-03
430
+
431
+	/**
432
+	 * @param string $filedata
433
+	 * @param integer $filedataoffset
434
+	 */
430 435
 	public function ParseOpusPageHeader(&$filedata, &$filedataoffset, &$oggpageinfo) {
431 436
 		$info = &$this->getid3->info;
432 437
 		$info['audio']['dataformat']   = 'opus';
Please login to merge, or discard this patch.
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -528,7 +528,7 @@
 block discarded – undo
528 528
 		return $oggheader;
529 529
 	}
530 530
 
531
-    // http://xiph.org/vorbis/doc/Vorbis_I_spec.html#x1-810005
531
+	// http://xiph.org/vorbis/doc/Vorbis_I_spec.html#x1-810005
532 532
 	public function ParseVorbisComments() {
533 533
 		$info = &$this->getid3->info;
534 534
 
Please login to merge, or discard this patch.
Spacing   +61 added lines, -61 removed lines patch added patch discarded remove patch
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
 
66 66
 		} elseif (substr($filedata, 0, 8) == 'OpusHead') {
67 67
 
68
-			if( $this->ParseOpusPageHeader($filedata, $filedataoffset, $oggpageinfo) == false ) {
68
+			if ($this->ParseOpusPageHeader($filedata, $filedataoffset, $oggpageinfo) == false) {
69 69
 				return false;
70 70
 			}
71 71
 
@@ -78,9 +78,9 @@  discard block
 block discarded – undo
78 78
 			$info['audio']['bitrate_mode'] = 'abr';
79 79
 			$info['audio']['lossless']     = false;
80 80
 
81
-			$info['ogg']['pageheader'][$oggpageinfo['page_seqno']]['speex_string']           =                              substr($filedata, $filedataoffset, 8); // hard-coded to 'Speex   '
81
+			$info['ogg']['pageheader'][$oggpageinfo['page_seqno']]['speex_string']           = substr($filedata, $filedataoffset, 8); // hard-coded to 'Speex   '
82 82
 			$filedataoffset += 8;
83
-			$info['ogg']['pageheader'][$oggpageinfo['page_seqno']]['speex_version']          =                              substr($filedata, $filedataoffset, 20);
83
+			$info['ogg']['pageheader'][$oggpageinfo['page_seqno']]['speex_version']          = substr($filedata, $filedataoffset, 20);
84 84
 			$filedataoffset += 20;
85 85
 			$info['ogg']['pageheader'][$oggpageinfo['page_seqno']]['speex_version_id']       = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 4));
86 86
 			$filedataoffset += 4;
@@ -125,45 +125,45 @@  discard block
 block discarded – undo
125 125
 
126 126
 			// http://www.theora.org/doc/Theora.pdf (section 6.2)
127 127
 
128
-			$info['ogg']['pageheader']['theora']['theora_magic']             =                           substr($filedata, $filedataoffset,  7); // hard-coded to "\x80.'theora'
128
+			$info['ogg']['pageheader']['theora']['theora_magic']             = substr($filedata, $filedataoffset, 7); // hard-coded to "\x80.'theora'
129 129
 			$filedataoffset += 7;
130
-			$info['ogg']['pageheader']['theora']['version_major']            = getid3_lib::BigEndian2Int(substr($filedata, $filedataoffset,  1));
130
+			$info['ogg']['pageheader']['theora']['version_major']            = getid3_lib::BigEndian2Int(substr($filedata, $filedataoffset, 1));
131 131
 			$filedataoffset += 1;
132
-			$info['ogg']['pageheader']['theora']['version_minor']            = getid3_lib::BigEndian2Int(substr($filedata, $filedataoffset,  1));
132
+			$info['ogg']['pageheader']['theora']['version_minor']            = getid3_lib::BigEndian2Int(substr($filedata, $filedataoffset, 1));
133 133
 			$filedataoffset += 1;
134
-			$info['ogg']['pageheader']['theora']['version_revision']         = getid3_lib::BigEndian2Int(substr($filedata, $filedataoffset,  1));
134
+			$info['ogg']['pageheader']['theora']['version_revision']         = getid3_lib::BigEndian2Int(substr($filedata, $filedataoffset, 1));
135 135
 			$filedataoffset += 1;
136
-			$info['ogg']['pageheader']['theora']['frame_width_macroblocks']  = getid3_lib::BigEndian2Int(substr($filedata, $filedataoffset,  2));
136
+			$info['ogg']['pageheader']['theora']['frame_width_macroblocks']  = getid3_lib::BigEndian2Int(substr($filedata, $filedataoffset, 2));
137 137
 			$filedataoffset += 2;
138
-			$info['ogg']['pageheader']['theora']['frame_height_macroblocks'] = getid3_lib::BigEndian2Int(substr($filedata, $filedataoffset,  2));
138
+			$info['ogg']['pageheader']['theora']['frame_height_macroblocks'] = getid3_lib::BigEndian2Int(substr($filedata, $filedataoffset, 2));
139 139
 			$filedataoffset += 2;
140
-			$info['ogg']['pageheader']['theora']['resolution_x']             = getid3_lib::BigEndian2Int(substr($filedata, $filedataoffset,  3));
140
+			$info['ogg']['pageheader']['theora']['resolution_x']             = getid3_lib::BigEndian2Int(substr($filedata, $filedataoffset, 3));
141 141
 			$filedataoffset += 3;
142
-			$info['ogg']['pageheader']['theora']['resolution_y']             = getid3_lib::BigEndian2Int(substr($filedata, $filedataoffset,  3));
142
+			$info['ogg']['pageheader']['theora']['resolution_y']             = getid3_lib::BigEndian2Int(substr($filedata, $filedataoffset, 3));
143 143
 			$filedataoffset += 3;
144
-			$info['ogg']['pageheader']['theora']['picture_offset_x']         = getid3_lib::BigEndian2Int(substr($filedata, $filedataoffset,  1));
144
+			$info['ogg']['pageheader']['theora']['picture_offset_x']         = getid3_lib::BigEndian2Int(substr($filedata, $filedataoffset, 1));
145 145
 			$filedataoffset += 1;
146
-			$info['ogg']['pageheader']['theora']['picture_offset_y']         = getid3_lib::BigEndian2Int(substr($filedata, $filedataoffset,  1));
146
+			$info['ogg']['pageheader']['theora']['picture_offset_y']         = getid3_lib::BigEndian2Int(substr($filedata, $filedataoffset, 1));
147 147
 			$filedataoffset += 1;
148
-			$info['ogg']['pageheader']['theora']['frame_rate_numerator']     = getid3_lib::BigEndian2Int(substr($filedata, $filedataoffset,  4));
148
+			$info['ogg']['pageheader']['theora']['frame_rate_numerator']     = getid3_lib::BigEndian2Int(substr($filedata, $filedataoffset, 4));
149 149
 			$filedataoffset += 4;
150
-			$info['ogg']['pageheader']['theora']['frame_rate_denominator']   = getid3_lib::BigEndian2Int(substr($filedata, $filedataoffset,  4));
150
+			$info['ogg']['pageheader']['theora']['frame_rate_denominator']   = getid3_lib::BigEndian2Int(substr($filedata, $filedataoffset, 4));
151 151
 			$filedataoffset += 4;
152
-			$info['ogg']['pageheader']['theora']['pixel_aspect_numerator']   = getid3_lib::BigEndian2Int(substr($filedata, $filedataoffset,  3));
152
+			$info['ogg']['pageheader']['theora']['pixel_aspect_numerator']   = getid3_lib::BigEndian2Int(substr($filedata, $filedataoffset, 3));
153 153
 			$filedataoffset += 3;
154
-			$info['ogg']['pageheader']['theora']['pixel_aspect_denominator'] = getid3_lib::BigEndian2Int(substr($filedata, $filedataoffset,  3));
154
+			$info['ogg']['pageheader']['theora']['pixel_aspect_denominator'] = getid3_lib::BigEndian2Int(substr($filedata, $filedataoffset, 3));
155 155
 			$filedataoffset += 3;
156
-			$info['ogg']['pageheader']['theora']['color_space_id']           = getid3_lib::BigEndian2Int(substr($filedata, $filedataoffset,  1));
156
+			$info['ogg']['pageheader']['theora']['color_space_id']           = getid3_lib::BigEndian2Int(substr($filedata, $filedataoffset, 1));
157 157
 			$filedataoffset += 1;
158
-			$info['ogg']['pageheader']['theora']['nominal_bitrate']          = getid3_lib::BigEndian2Int(substr($filedata, $filedataoffset,  3));
158
+			$info['ogg']['pageheader']['theora']['nominal_bitrate']          = getid3_lib::BigEndian2Int(substr($filedata, $filedataoffset, 3));
159 159
 			$filedataoffset += 3;
160
-			$info['ogg']['pageheader']['theora']['flags']                    = getid3_lib::BigEndian2Int(substr($filedata, $filedataoffset,  2));
160
+			$info['ogg']['pageheader']['theora']['flags']                    = getid3_lib::BigEndian2Int(substr($filedata, $filedataoffset, 2));
161 161
 			$filedataoffset += 2;
162 162
 
163 163
 			$info['ogg']['pageheader']['theora']['quality']         = ($info['ogg']['pageheader']['theora']['flags'] & 0xFC00) >> 10;
164
-			$info['ogg']['pageheader']['theora']['kfg_shift']       = ($info['ogg']['pageheader']['theora']['flags'] & 0x03E0) >>  5;
165
-			$info['ogg']['pageheader']['theora']['pixel_format_id'] = ($info['ogg']['pageheader']['theora']['flags'] & 0x0018) >>  3;
166
-			$info['ogg']['pageheader']['theora']['reserved']        = ($info['ogg']['pageheader']['theora']['flags'] & 0x0007) >>  0; // should be 0
164
+			$info['ogg']['pageheader']['theora']['kfg_shift']       = ($info['ogg']['pageheader']['theora']['flags'] & 0x03E0) >> 5;
165
+			$info['ogg']['pageheader']['theora']['pixel_format_id'] = ($info['ogg']['pageheader']['theora']['flags'] & 0x0018) >> 3;
166
+			$info['ogg']['pageheader']['theora']['reserved']        = ($info['ogg']['pageheader']['theora']['flags'] & 0x0007) >> 0; // should be 0
167 167
 			$info['ogg']['pageheader']['theora']['color_space']     = self::TheoraColorSpace($info['ogg']['pageheader']['theora']['color_space_id']);
168 168
 			$info['ogg']['pageheader']['theora']['pixel_format']    = self::TheoraPixelFormat($info['ogg']['pageheader']['theora']['pixel_format_id']);
169 169
 
@@ -187,24 +187,24 @@  discard block
 block discarded – undo
187 187
 			// Ogg Skeleton version 3.0 Format Specification
188 188
 			// http://xiph.org/ogg/doc/skeleton.html
189 189
 			$filedataoffset += 8;
190
-			$info['ogg']['skeleton']['fishead']['raw']['version_major']                = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset,  2));
190
+			$info['ogg']['skeleton']['fishead']['raw']['version_major']                = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 2));
191 191
 			$filedataoffset += 2;
192
-			$info['ogg']['skeleton']['fishead']['raw']['version_minor']                = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset,  2));
192
+			$info['ogg']['skeleton']['fishead']['raw']['version_minor']                = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 2));
193 193
 			$filedataoffset += 2;
194
-			$info['ogg']['skeleton']['fishead']['raw']['presentationtime_numerator']   = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset,  8));
194
+			$info['ogg']['skeleton']['fishead']['raw']['presentationtime_numerator']   = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 8));
195 195
 			$filedataoffset += 8;
196
-			$info['ogg']['skeleton']['fishead']['raw']['presentationtime_denominator'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset,  8));
196
+			$info['ogg']['skeleton']['fishead']['raw']['presentationtime_denominator'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 8));
197 197
 			$filedataoffset += 8;
198
-			$info['ogg']['skeleton']['fishead']['raw']['basetime_numerator']           = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset,  8));
198
+			$info['ogg']['skeleton']['fishead']['raw']['basetime_numerator']           = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 8));
199 199
 			$filedataoffset += 8;
200
-			$info['ogg']['skeleton']['fishead']['raw']['basetime_denominator']         = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset,  8));
200
+			$info['ogg']['skeleton']['fishead']['raw']['basetime_denominator']         = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 8));
201 201
 			$filedataoffset += 8;
202 202
 			$info['ogg']['skeleton']['fishead']['raw']['utc']                          = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 20));
203 203
 			$filedataoffset += 20;
204 204
 
205 205
 			$info['ogg']['skeleton']['fishead']['version']          = $info['ogg']['skeleton']['fishead']['raw']['version_major'].'.'.$info['ogg']['skeleton']['fishead']['raw']['version_minor'];
206 206
 			$info['ogg']['skeleton']['fishead']['presentationtime'] = $info['ogg']['skeleton']['fishead']['raw']['presentationtime_numerator'] / $info['ogg']['skeleton']['fishead']['raw']['presentationtime_denominator'];
207
-			$info['ogg']['skeleton']['fishead']['basetime']         = $info['ogg']['skeleton']['fishead']['raw']['basetime_numerator']         / $info['ogg']['skeleton']['fishead']['raw']['basetime_denominator'];
207
+			$info['ogg']['skeleton']['fishead']['basetime']         = $info['ogg']['skeleton']['fishead']['raw']['basetime_numerator'] / $info['ogg']['skeleton']['fishead']['raw']['basetime_denominator'];
208 208
 			$info['ogg']['skeleton']['fishead']['utc']              = $info['ogg']['skeleton']['fishead']['raw']['utc'];
209 209
 
210 210
 
@@ -218,23 +218,23 @@  discard block
 block discarded – undo
218 218
 				if (substr($filedata, 0, 8) == "fisbone\x00") {
219 219
 
220 220
 					$filedataoffset = 8;
221
-					$info['ogg']['skeleton']['fisbone']['raw']['message_header_offset']   = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset,  4));
221
+					$info['ogg']['skeleton']['fisbone']['raw']['message_header_offset']   = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 4));
222 222
 					$filedataoffset += 4;
223
-					$info['ogg']['skeleton']['fisbone']['raw']['serial_number']           = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset,  4));
223
+					$info['ogg']['skeleton']['fisbone']['raw']['serial_number']           = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 4));
224 224
 					$filedataoffset += 4;
225
-					$info['ogg']['skeleton']['fisbone']['raw']['number_header_packets']   = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset,  4));
225
+					$info['ogg']['skeleton']['fisbone']['raw']['number_header_packets']   = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 4));
226 226
 					$filedataoffset += 4;
227
-					$info['ogg']['skeleton']['fisbone']['raw']['granulerate_numerator']   = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset,  8));
227
+					$info['ogg']['skeleton']['fisbone']['raw']['granulerate_numerator']   = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 8));
228 228
 					$filedataoffset += 8;
229
-					$info['ogg']['skeleton']['fisbone']['raw']['granulerate_denominator'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset,  8));
229
+					$info['ogg']['skeleton']['fisbone']['raw']['granulerate_denominator'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 8));
230 230
 					$filedataoffset += 8;
231
-					$info['ogg']['skeleton']['fisbone']['raw']['basegranule']             = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset,  8));
231
+					$info['ogg']['skeleton']['fisbone']['raw']['basegranule']             = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 8));
232 232
 					$filedataoffset += 8;
233
-					$info['ogg']['skeleton']['fisbone']['raw']['preroll']                 = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset,  4));
233
+					$info['ogg']['skeleton']['fisbone']['raw']['preroll']                 = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 4));
234 234
 					$filedataoffset += 4;
235
-					$info['ogg']['skeleton']['fisbone']['raw']['granuleshift']            = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset,  1));
235
+					$info['ogg']['skeleton']['fisbone']['raw']['granuleshift']            = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 1));
236 236
 					$filedataoffset += 1;
237
-					$info['ogg']['skeleton']['fisbone']['raw']['padding']                 =                              substr($filedata, $filedataoffset,  3);
237
+					$info['ogg']['skeleton']['fisbone']['raw']['padding']                 = substr($filedata, $filedataoffset, 3);
238 238
 					$filedataoffset += 3;
239 239
 
240 240
 				} elseif (substr($filedata, 1, 6) == 'theora') {
@@ -276,14 +276,14 @@  discard block
 block discarded – undo
276 276
 			case 'vorbis':
277 277
 				$filedata = $this->fread($info['ogg']['pageheader'][$oggpageinfo['page_seqno']]['page_length']);
278 278
 				$info['ogg']['pageheader'][$oggpageinfo['page_seqno']]['packet_type'] = getid3_lib::LittleEndian2Int(substr($filedata, 0, 1));
279
-				$info['ogg']['pageheader'][$oggpageinfo['page_seqno']]['stream_type'] =                              substr($filedata, 1, 6); // hard-coded to 'vorbis'
279
+				$info['ogg']['pageheader'][$oggpageinfo['page_seqno']]['stream_type'] = substr($filedata, 1, 6); // hard-coded to 'vorbis'
280 280
 
281 281
 				$this->ParseVorbisComments();
282 282
 				break;
283 283
 
284 284
 			case 'flac':
285 285
 				$flac = new getid3_flac($this->getid3);
286
-				if (!$flac->parseMETAdata()) {
286
+				if ( ! $flac->parseMETAdata()) {
287 287
 					$info['error'][] = 'Failed to parse FLAC headers';
288 288
 					return false;
289 289
 				}
@@ -298,7 +298,7 @@  discard block
 block discarded – undo
298 298
 			case 'opus':
299 299
 				$filedata = $this->fread($info['ogg']['pageheader'][$oggpageinfo['page_seqno']]['page_length']);
300 300
 				$info['ogg']['pageheader'][$oggpageinfo['page_seqno']]['stream_type'] = substr($filedata, 0, 8); // hard-coded to 'OpusTags'
301
-				if(substr($filedata, 0, 8)  != 'OpusTags') {
301
+				if (substr($filedata, 0, 8) != 'OpusTags') {
302 302
 					$info['error'][] = 'Expected "OpusTags" as header but got "'.substr($filedata, 0, 8).'"';
303 303
 					return false;
304 304
 				}
@@ -309,7 +309,7 @@  discard block
 block discarded – undo
309 309
 		}
310 310
 
311 311
 		// Last Page - Number of Samples
312
-		if (!getid3_lib::intValueSupported($info['avdataend'])) {
312
+		if ( ! getid3_lib::intValueSupported($info['avdataend'])) {
313 313
 
314 314
 			$info['warning'][] = 'Unable to parse Ogg end chunk file (PHP does not support file operations beyond '.round(PHP_INT_MAX / 1073741824).'GB)';
315 315
 
@@ -321,26 +321,26 @@  discard block
 block discarded – undo
321 321
 				$this->fseek($info['avdataend'] - ($LastOggSpostion + strlen('SggO')));
322 322
 				$info['avdataend'] = $this->ftell();
323 323
 				$info['ogg']['pageheader']['eos'] = $this->ParseOggPageHeader();
324
-				$info['ogg']['samples']   = $info['ogg']['pageheader']['eos']['pcm_abs_position'];
324
+				$info['ogg']['samples'] = $info['ogg']['pageheader']['eos']['pcm_abs_position'];
325 325
 				if ($info['ogg']['samples'] == 0) {
326 326
 					$info['error'][] = 'Corrupt Ogg file: eos.number of samples == zero';
327 327
 					return false;
328 328
 				}
329
-				if (!empty($info['audio']['sample_rate'])) {
329
+				if ( ! empty($info['audio']['sample_rate'])) {
330 330
 					$info['ogg']['bitrate_average'] = (($info['avdataend'] - $info['avdataoffset']) * 8) / ($info['ogg']['samples'] / $info['audio']['sample_rate']);
331 331
 				}
332 332
 			}
333 333
 
334 334
 		}
335 335
 
336
-		if (!empty($info['ogg']['bitrate_average'])) {
336
+		if ( ! empty($info['ogg']['bitrate_average'])) {
337 337
 			$info['audio']['bitrate'] = $info['ogg']['bitrate_average'];
338
-		} elseif (!empty($info['ogg']['bitrate_nominal'])) {
338
+		} elseif ( ! empty($info['ogg']['bitrate_nominal'])) {
339 339
 			$info['audio']['bitrate'] = $info['ogg']['bitrate_nominal'];
340
-		} elseif (!empty($info['ogg']['bitrate_min']) && !empty($info['ogg']['bitrate_max'])) {
340
+		} elseif ( ! empty($info['ogg']['bitrate_min']) && ! empty($info['ogg']['bitrate_max'])) {
341 341
 			$info['audio']['bitrate'] = ($info['ogg']['bitrate_min'] + $info['ogg']['bitrate_max']) / 2;
342 342
 		}
343
-		if (isset($info['audio']['bitrate']) && !isset($info['playtime_seconds'])) {
343
+		if (isset($info['audio']['bitrate']) && ! isset($info['playtime_seconds'])) {
344 344
 			if ($info['audio']['bitrate'] == 0) {
345 345
 				$info['error'][] = 'Corrupt Ogg file: bitrate_audio == zero';
346 346
 				return false;
@@ -355,7 +355,7 @@  discard block
 block discarded – undo
355 355
 			if ($info['audio']['dataformat'] == 'vorbis') {
356 356
 
357 357
 				// Vorbis 1.0 starts with Xiph.Org
358
-				if  (preg_match('/^Xiph.Org/', $info['audio']['encoder'])) {
358
+				if (preg_match('/^Xiph.Org/', $info['audio']['encoder'])) {
359 359
 
360 360
 					if ($info['audio']['bitrate_mode'] == 'abr') {
361 361
 
@@ -369,7 +369,7 @@  discard block
 block discarded – undo
369 369
 					}
370 370
 				}
371 371
 
372
-				if (empty($info['audio']['encoder_options']) && !empty($info['ogg']['bitrate_nominal'])) {
372
+				if (empty($info['audio']['encoder_options']) && ! empty($info['ogg']['bitrate_nominal'])) {
373 373
 					$info['audio']['encoder_options'] = 'Nominal bitrate: '.intval(round($info['ogg']['bitrate_nominal'] / 1000)).'kbps';
374 374
 				}
375 375
 			}
@@ -407,7 +407,7 @@  discard block
 block discarded – undo
407 407
 		$filedataoffset += 4;
408 408
 		$info['ogg']['bitrate_min']      = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 4));
409 409
 		$filedataoffset += 4;
410
-		$info['ogg']['blocksize_small']  = pow(2,  getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 1)) & 0x0F);
410
+		$info['ogg']['blocksize_small']  = pow(2, getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 1)) & 0x0F);
411 411
 		$info['ogg']['blocksize_large']  = pow(2, (getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 1)) & 0xF0) >> 4);
412 412
 		$info['ogg']['stop_bit']         = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 1)); // must be 1, marks end of packet
413 413
 
@@ -439,7 +439,7 @@  discard block
 block discarded – undo
439 439
 
440 440
 		$info['ogg']['pageheader']['opus']['opus_magic'] = substr($filedata, $filedataoffset, 8); // hard-coded to 'OpusHead'
441 441
 		$filedataoffset += 8;
442
-		$info['ogg']['pageheader']['opus']['version']    = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset,  1));
442
+		$info['ogg']['pageheader']['opus']['version']    = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 1));
443 443
 		$filedataoffset += 1;
444 444
 
445 445
 		if ($info['ogg']['pageheader']['opus']['version'] < 1 || $info['ogg']['pageheader']['opus']['version'] > 15) {
@@ -447,7 +447,7 @@  discard block
 block discarded – undo
447 447
 			return false;
448 448
 		}
449 449
 
450
-		$info['ogg']['pageheader']['opus']['out_channel_count'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset,  1));
450
+		$info['ogg']['pageheader']['opus']['out_channel_count'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 1));
451 451
 		$filedataoffset += 1;
452 452
 
453 453
 		if ($info['ogg']['pageheader']['opus']['out_channel_count'] == 0) {
@@ -455,10 +455,10 @@  discard block
 block discarded – undo
455 455
 			return false;
456 456
 		}
457 457
 
458
-		$info['ogg']['pageheader']['opus']['pre_skip'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset,  2));
458
+		$info['ogg']['pageheader']['opus']['pre_skip'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 2));
459 459
 		$filedataoffset += 2;
460 460
 
461
-		$info['ogg']['pageheader']['opus']['sample_rate'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset,  4));
461
+		$info['ogg']['pageheader']['opus']['sample_rate'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 4));
462 462
 		$filedataoffset += 4;
463 463
 
464 464
 		//$info['ogg']['pageheader']['opus']['output_gain'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset,  2));
@@ -540,7 +540,7 @@  discard block
 block discarded – undo
540 540
 			case 'vorbis':
541 541
 			case 'speex':
542 542
 			case 'opus':
543
-				$CommentStartOffset = $info['ogg']['pageheader'][$VorbisCommentPage]['page_start_offset'];  // Second Ogg page, after header block
543
+				$CommentStartOffset = $info['ogg']['pageheader'][$VorbisCommentPage]['page_start_offset']; // Second Ogg page, after header block
544 544
 				$this->fseek($CommentStartOffset);
545 545
 				$commentdataoffset = 27 + $info['ogg']['pageheader'][$VorbisCommentPage]['page_segments'];
546 546
 				$commentdata = $this->fread(self::OggPageSegmentLength($info['ogg']['pageheader'][$VorbisCommentPage], 1) + $commentdataoffset);
@@ -641,7 +641,7 @@  discard block
 block discarded – undo
641 641
 				$commentdata .= $AsYetUnusedData;
642 642
 
643 643
 				//$commentdata .= $this->fread($info['ogg']['pageheader'][$oggpageinfo['page_seqno']]['page_length']);
644
-				if (!isset($info['ogg']['pageheader'][$VorbisCommentPage])) {
644
+				if ( ! isset($info['ogg']['pageheader'][$VorbisCommentPage])) {
645 645
 					$info['warning'][] = 'undefined Vorbis Comment page "'.$VorbisCommentPage.'" at offset '.$this->ftell();
646 646
 					break;
647 647
 				}
@@ -658,7 +658,7 @@  discard block
 block discarded – undo
658 658
 			$commentstring = substr($commentdata, $commentdataoffset, $ThisFileInfo_ogg_comments_raw[$i]['size']);
659 659
 			$commentdataoffset += $ThisFileInfo_ogg_comments_raw[$i]['size'];
660 660
 
661
-			if (!$commentstring) {
661
+			if ( ! $commentstring) {
662 662
 
663 663
 				// no comment?
664 664
 				$info['warning'][] = 'Blank Ogg comment ['.$i.']';
@@ -686,7 +686,7 @@  discard block
 block discarded – undo
686 686
 					$this->notice('Found deprecated COVERART tag, it should be replaced in honor of METADATA_BLOCK_PICTURE structure');
687 687
 					/** @todo use 'coverartmime' where available */
688 688
 					$imageinfo = getid3_lib::GetDataImageSize($data);
689
-					if ($imageinfo === false || !isset($imageinfo['mime'])) {
689
+					if ($imageinfo === false || ! isset($imageinfo['mime'])) {
690 690
 						$this->warning('COVERART vorbiscomment tag contains invalid image');
691 691
 						continue;
692 692
 					}
@@ -775,7 +775,7 @@  discard block
 block discarded – undo
775 775
 	}
776 776
 
777 777
 
778
-	public static function OggPageSegmentLength($OggInfoArray, $SegmentNumber=1) {
778
+	public static function OggPageSegmentLength($OggInfoArray, $SegmentNumber = 1) {
779 779
 		for ($i = 0; $i < $SegmentNumber; $i++) {
780 780
 			$segmentlength = 0;
781 781
 			foreach ($OggInfoArray['segment_table'] as $key => $value) {
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -547,8 +547,7 @@
 block discarded – undo
547 547
 
548 548
 				if ($info['audio']['dataformat'] == 'vorbis') {
549 549
 					$commentdataoffset += (strlen('vorbis') + 1);
550
-				}
551
-				else if ($info['audio']['dataformat'] == 'opus') {
550
+				} else if ($info['audio']['dataformat'] == 'opus') {
552 551
 					$commentdataoffset += strlen('OpusTags');
553 552
 				}
554 553
 
Please login to merge, or discard this patch.
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.
Spacing   +210 added lines, -210 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', 'site-lookup', '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', 'site-lookup', '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
 /**
@@ -1069,6 +1069,6 @@  discard block
 block discarded – undo
1069 1069
  * @param mixed $thing Check if unknown variable is a WP_Error object.
1070 1070
  * @return bool True, if WP_Error. False, if not WP_Error.
1071 1071
  */
1072
-function is_wp_error( $thing ) {
1073
-	return ( $thing instanceof WP_Error );
1072
+function is_wp_error($thing) {
1073
+	return ($thing instanceof WP_Error);
1074 1074
 }
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.
src/wp-includes/ms-blogs.php 4 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -595,7 +595,7 @@
 block discarded – undo
595 595
  *
596 596
  * @param int  $new_blog   The id of the blog you want to switch to. Default: current blog
597 597
  * @param bool $deprecated Deprecated argument
598
- * @return true Always returns True.
598
+ * @return boolean Always returns True.
599 599
  */
600 600
 function switch_to_blog( $new_blog, $deprecated = null ) {
601 601
 	global $wpdb;
Please login to merge, or discard this patch.
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -845,7 +845,7 @@
 block discarded – undo
845 845
 		 *
846 846
 		 * @param int    $blog_id Blog ID.
847 847
 		 * @param string $value   The value of blog status.
848
- 		 */
848
+		 */
849 849
 		do_action( 'update_blog_public', $blog_id, $value ); // Moved here from update_blog_public().
850 850
 	}
851 851
 
Please login to merge, or discard this patch.
Spacing   +282 added lines, -282 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
 function wpmu_update_blogs_date() {
19 19
 	global $wpdb;
20 20
 
21
-	update_blog_details( $wpdb->blogid, array('last_updated' => current_time('mysql', true)) );
21
+	update_blog_details($wpdb->blogid, array('last_updated' => current_time('mysql', true)));
22 22
 	/**
23 23
 	 * Fires after the blog details are updated.
24 24
 	 *
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
 	 *
27 27
 	 * @param int $blog_id Site ID.
28 28
 	 */
29
-	do_action( 'wpmu_blog_updated', $wpdb->blogid );
29
+	do_action('wpmu_blog_updated', $wpdb->blogid);
30 30
 }
31 31
 
32 32
 /**
@@ -37,17 +37,17 @@  discard block
 block discarded – undo
37 37
  * @param int $blog_id Blog ID
38 38
  * @return string Full URL of the blog if found. Empty string if not.
39 39
  */
40
-function get_blogaddress_by_id( $blog_id ) {
41
-	$bloginfo = get_site( (int) $blog_id );
40
+function get_blogaddress_by_id($blog_id) {
41
+	$bloginfo = get_site((int) $blog_id);
42 42
 
43
-	if ( empty( $bloginfo ) ) {
43
+	if (empty($bloginfo)) {
44 44
 		return '';
45 45
 	}
46 46
 
47
-	$scheme = parse_url( $bloginfo->home, PHP_URL_SCHEME );
48
-	$scheme = empty( $scheme ) ? 'http' : $scheme;
47
+	$scheme = parse_url($bloginfo->home, PHP_URL_SCHEME);
48
+	$scheme = empty($scheme) ? 'http' : $scheme;
49 49
 
50
-	return esc_url( $scheme . '://' . $bloginfo->domain . $bloginfo->path );
50
+	return esc_url($scheme.'://'.$bloginfo->domain.$bloginfo->path);
51 51
 }
52 52
 
53 53
 /**
@@ -58,17 +58,17 @@  discard block
 block discarded – undo
58 58
  * @param string $blogname The (subdomain or directory) name
59 59
  * @return string
60 60
  */
61
-function get_blogaddress_by_name( $blogname ) {
62
-	if ( is_subdomain_install() ) {
63
-		if ( $blogname == 'main' )
61
+function get_blogaddress_by_name($blogname) {
62
+	if (is_subdomain_install()) {
63
+		if ($blogname == 'main')
64 64
 			$blogname = 'www';
65
-		$url = rtrim( network_home_url(), '/' );
66
-		if ( !empty( $blogname ) )
67
-			$url = preg_replace( '|^([^\.]+://)|', "\${1}" . $blogname . '.', $url );
65
+		$url = rtrim(network_home_url(), '/');
66
+		if ( ! empty($blogname))
67
+			$url = preg_replace('|^([^\.]+://)|', "\${1}".$blogname.'.', $url);
68 68
 	} else {
69
-		$url = network_home_url( $blogname );
69
+		$url = network_home_url($blogname);
70 70
 	}
71
-	return esc_url( $url . '/' );
71
+	return esc_url($url.'/');
72 72
 }
73 73
 
74 74
 /**
@@ -80,30 +80,30 @@  discard block
 block discarded – undo
80 80
  * @param string $slug A site's slug.
81 81
  * @return int|null The site ID, or null if no site is found for the given slug.
82 82
  */
83
-function get_id_from_blogname( $slug ) {
83
+function get_id_from_blogname($slug) {
84 84
 	$current_network = get_network();
85
-	$slug = trim( $slug, '/' );
85
+	$slug = trim($slug, '/');
86 86
 
87
-	if ( is_subdomain_install() ) {
88
-		$domain = $slug . '.' . preg_replace( '|^www\.|', '', $current_network->domain );
87
+	if (is_subdomain_install()) {
88
+		$domain = $slug.'.'.preg_replace('|^www\.|', '', $current_network->domain);
89 89
 		$path = $current_network->path;
90 90
 	} else {
91 91
 		$domain = $current_network->domain;
92
-		$path = $current_network->path . $slug . '/';
92
+		$path = $current_network->path.$slug.'/';
93 93
 	}
94 94
 
95
-	$site_ids = get_sites( array(
95
+	$site_ids = get_sites(array(
96 96
 		'number' => 1,
97 97
 		'fields' => 'ids',
98 98
 		'domain' => $domain,
99 99
 		'path' => $path,
100
-	) );
100
+	));
101 101
 
102
-	if ( empty( $site_ids ) ) {
102
+	if (empty($site_ids)) {
103 103
 		return null;
104 104
 	}
105 105
 
106
-	return array_shift( $site_ids );
106
+	return array_shift($site_ids);
107 107
 }
108 108
 
109 109
 /**
@@ -119,42 +119,42 @@  discard block
 block discarded – undo
119 119
  *                                  Default is true.
120 120
  * @return WP_Site|false Blog details on success. False on failure.
121 121
  */
122
-function get_blog_details( $fields = null, $get_all = true ) {
122
+function get_blog_details($fields = null, $get_all = true) {
123 123
 	global $wpdb;
124 124
 
125
-	if ( is_array($fields ) ) {
126
-		if ( isset($fields['blog_id']) ) {
125
+	if (is_array($fields)) {
126
+		if (isset($fields['blog_id'])) {
127 127
 			$blog_id = $fields['blog_id'];
128
-		} elseif ( isset($fields['domain']) && isset($fields['path']) ) {
129
-			$key = md5( $fields['domain'] . $fields['path'] );
128
+		} elseif (isset($fields['domain']) && isset($fields['path'])) {
129
+			$key = md5($fields['domain'].$fields['path']);
130 130
 			$blog = wp_cache_get($key, 'blog-lookup');
131
-			if ( false !== $blog )
131
+			if (false !== $blog)
132 132
 				return $blog;
133
-			if ( substr( $fields['domain'], 0, 4 ) == 'www.' ) {
134
-				$nowww = substr( $fields['domain'], 4 );
135
-				$blog = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->blogs WHERE domain IN (%s,%s) AND path = %s ORDER BY CHAR_LENGTH(domain) DESC", $nowww, $fields['domain'], $fields['path'] ) );
133
+			if (substr($fields['domain'], 0, 4) == 'www.') {
134
+				$nowww = substr($fields['domain'], 4);
135
+				$blog = $wpdb->get_row($wpdb->prepare("SELECT * FROM $wpdb->blogs WHERE domain IN (%s,%s) AND path = %s ORDER BY CHAR_LENGTH(domain) DESC", $nowww, $fields['domain'], $fields['path']));
136 136
 			} else {
137
-				$blog = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->blogs WHERE domain = %s AND path = %s", $fields['domain'], $fields['path'] ) );
137
+				$blog = $wpdb->get_row($wpdb->prepare("SELECT * FROM $wpdb->blogs WHERE domain = %s AND path = %s", $fields['domain'], $fields['path']));
138 138
 			}
139
-			if ( $blog ) {
140
-				wp_cache_set($blog->blog_id . 'short', $blog, 'blog-details');
139
+			if ($blog) {
140
+				wp_cache_set($blog->blog_id.'short', $blog, 'blog-details');
141 141
 				$blog_id = $blog->blog_id;
142 142
 			} else {
143 143
 				return false;
144 144
 			}
145
-		} elseif ( isset($fields['domain']) && is_subdomain_install() ) {
146
-			$key = md5( $fields['domain'] );
145
+		} elseif (isset($fields['domain']) && is_subdomain_install()) {
146
+			$key = md5($fields['domain']);
147 147
 			$blog = wp_cache_get($key, 'blog-lookup');
148
-			if ( false !== $blog )
148
+			if (false !== $blog)
149 149
 				return $blog;
150
-			if ( substr( $fields['domain'], 0, 4 ) == 'www.' ) {
151
-				$nowww = substr( $fields['domain'], 4 );
152
-				$blog = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->blogs WHERE domain IN (%s,%s) ORDER BY CHAR_LENGTH(domain) DESC", $nowww, $fields['domain'] ) );
150
+			if (substr($fields['domain'], 0, 4) == 'www.') {
151
+				$nowww = substr($fields['domain'], 4);
152
+				$blog = $wpdb->get_row($wpdb->prepare("SELECT * FROM $wpdb->blogs WHERE domain IN (%s,%s) ORDER BY CHAR_LENGTH(domain) DESC", $nowww, $fields['domain']));
153 153
 			} else {
154
-				$blog = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->blogs WHERE domain = %s", $fields['domain'] ) );
154
+				$blog = $wpdb->get_row($wpdb->prepare("SELECT * FROM $wpdb->blogs WHERE domain = %s", $fields['domain']));
155 155
 			}
156
-			if ( $blog ) {
157
-				wp_cache_set($blog->blog_id . 'short', $blog, 'blog-details');
156
+			if ($blog) {
157
+				wp_cache_set($blog->blog_id.'short', $blog, 'blog-details');
158 158
 				$blog_id = $blog->blog_id;
159 159
 			} else {
160 160
 				return false;
@@ -163,10 +163,10 @@  discard block
 block discarded – undo
163 163
 			return false;
164 164
 		}
165 165
 	} else {
166
-		if ( ! $fields )
166
+		if ( ! $fields)
167 167
 			$blog_id = get_current_blog_id();
168
-		elseif ( ! is_numeric( $fields ) )
169
-			$blog_id = get_id_from_blogname( $fields );
168
+		elseif ( ! is_numeric($fields))
169
+			$blog_id = get_id_from_blogname($fields);
170 170
 		else
171 171
 			$blog_id = $fields;
172 172
 	}
@@ -174,15 +174,15 @@  discard block
 block discarded – undo
174 174
 	$blog_id = (int) $blog_id;
175 175
 
176 176
 	$all = $get_all == true ? '' : 'short';
177
-	$details = wp_cache_get( $blog_id . $all, 'blog-details' );
177
+	$details = wp_cache_get($blog_id.$all, 'blog-details');
178 178
 
179
-	if ( $details ) {
180
-		if ( ! is_object( $details ) ) {
181
-			if ( $details == -1 ) {
179
+	if ($details) {
180
+		if ( ! is_object($details)) {
181
+			if ($details == -1) {
182 182
 				return false;
183 183
 			} else {
184 184
 				// Clear old pre-serialized objects. Cache clients do better with that.
185
-				wp_cache_delete( $blog_id . $all, 'blog-details' );
185
+				wp_cache_delete($blog_id.$all, 'blog-details');
186 186
 				unset($details);
187 187
 			}
188 188
 		} else {
@@ -191,18 +191,18 @@  discard block
 block discarded – undo
191 191
 	}
192 192
 
193 193
 	// Try the other cache.
194
-	if ( $get_all ) {
195
-		$details = wp_cache_get( $blog_id . 'short', 'blog-details' );
194
+	if ($get_all) {
195
+		$details = wp_cache_get($blog_id.'short', 'blog-details');
196 196
 	} else {
197
-		$details = wp_cache_get( $blog_id, 'blog-details' );
197
+		$details = wp_cache_get($blog_id, 'blog-details');
198 198
 		// If short was requested and full cache is set, we can return.
199
-		if ( $details ) {
200
-			if ( ! is_object( $details ) ) {
201
-				if ( $details == -1 ) {
199
+		if ($details) {
200
+			if ( ! is_object($details)) {
201
+				if ($details == -1) {
202 202
 					return false;
203 203
 				} else {
204 204
 					// Clear old pre-serialized objects. Cache clients do better with that.
205
-					wp_cache_delete( $blog_id, 'blog-details' );
205
+					wp_cache_delete($blog_id, 'blog-details');
206 206
 					unset($details);
207 207
 				}
208 208
 			} else {
@@ -211,29 +211,29 @@  discard block
 block discarded – undo
211 211
 		}
212 212
 	}
213 213
 
214
-	if ( empty($details) ) {
215
-		$details = WP_Site::get_instance( $blog_id );
216
-		if ( ! $details ) {
214
+	if (empty($details)) {
215
+		$details = WP_Site::get_instance($blog_id);
216
+		if ( ! $details) {
217 217
 			// Set the full cache.
218
-			wp_cache_set( $blog_id, -1, 'blog-details' );
218
+			wp_cache_set($blog_id, -1, 'blog-details');
219 219
 			return false;
220 220
 		}
221 221
 	}
222 222
 
223
-	if ( ! $details instanceof WP_Site ) {
224
-		$details = new WP_Site( $details );
223
+	if ( ! $details instanceof WP_Site) {
224
+		$details = new WP_Site($details);
225 225
 	}
226 226
 
227
-	if ( ! $get_all ) {
228
-		wp_cache_set( $blog_id . $all, $details, 'blog-details' );
227
+	if ( ! $get_all) {
228
+		wp_cache_set($blog_id.$all, $details, 'blog-details');
229 229
 		return $details;
230 230
 	}
231 231
 
232
-	switch_to_blog( $blog_id );
233
-	$details->blogname   = get_option( 'blogname' );
234
-	$details->siteurl    = get_option( 'siteurl' );
235
-	$details->post_count = get_option( 'post_count' );
236
-	$details->home       = get_option( 'home' );
232
+	switch_to_blog($blog_id);
233
+	$details->blogname   = get_option('blogname');
234
+	$details->siteurl    = get_option('siteurl');
235
+	$details->post_count = get_option('post_count');
236
+	$details->home       = get_option('home');
237 237
 	restore_current_blog();
238 238
 
239 239
 	/**
@@ -244,12 +244,12 @@  discard block
 block discarded – undo
244 244
 	 *
245 245
 	 * @param object $details The blog details.
246 246
 	 */
247
-	$details = apply_filters_deprecated( 'blog_details', array( $details ), '4.7.0', 'site_details' );
247
+	$details = apply_filters_deprecated('blog_details', array($details), '4.7.0', 'site_details');
248 248
 
249
-	wp_cache_set( $blog_id . $all, $details, 'blog-details' );
249
+	wp_cache_set($blog_id.$all, $details, 'blog-details');
250 250
 
251
-	$key = md5( $details->domain . $details->path );
252
-	wp_cache_set( $key, $details, 'blog-lookup' );
251
+	$key = md5($details->domain.$details->path);
252
+	wp_cache_set($key, $details, 'blog-lookup');
253 253
 
254 254
 	return $details;
255 255
 }
@@ -261,14 +261,14 @@  discard block
 block discarded – undo
261 261
  *
262 262
  * @param int $blog_id Optional. Blog ID. Defaults to current blog.
263 263
  */
264
-function refresh_blog_details( $blog_id = 0 ) {
264
+function refresh_blog_details($blog_id = 0) {
265 265
 	$blog_id = (int) $blog_id;
266
-	if ( ! $blog_id ) {
266
+	if ( ! $blog_id) {
267 267
 		$blog_id = get_current_blog_id();
268 268
 	}
269 269
 
270
-	$details = get_site( $blog_id );
271
-	if ( ! $details ) {
270
+	$details = get_site($blog_id);
271
+	if ( ! $details) {
272 272
 		// Make sure clean_blog_cache() gets the blog ID
273 273
 		// when the blog has been previously cached as
274 274
 		// non-existent.
@@ -279,7 +279,7 @@  discard block
 block discarded – undo
279 279
 		);
280 280
 	}
281 281
 
282
-	clean_blog_cache( $details );
282
+	clean_blog_cache($details);
283 283
 
284 284
 	/**
285 285
 	 * Fires after the blog details cache is cleared.
@@ -288,7 +288,7 @@  discard block
 block discarded – undo
288 288
 	 *
289 289
 	 * @param int $blog_id Blog ID.
290 290
 	 */
291
-	do_action( 'refresh_blog_details', $blog_id );
291
+	do_action('refresh_blog_details', $blog_id);
292 292
 }
293 293
 
294 294
 /**
@@ -302,17 +302,17 @@  discard block
 block discarded – undo
302 302
  * @param array $details Array of details keyed by blogs table field names.
303 303
  * @return bool True if update succeeds, false otherwise.
304 304
  */
305
-function update_blog_details( $blog_id, $details = array() ) {
305
+function update_blog_details($blog_id, $details = array()) {
306 306
 	global $wpdb;
307 307
 
308
-	if ( empty($details) )
308
+	if (empty($details))
309 309
 		return false;
310 310
 
311
-	if ( is_object($details) )
311
+	if (is_object($details))
312 312
 		$details = get_object_vars($details);
313 313
 
314
-	$current_details = get_site( $blog_id );
315
-	if ( empty($current_details) )
314
+	$current_details = get_site($blog_id);
315
+	if (empty($current_details))
316 316
 		return false;
317 317
 
318 318
 	$current_details = get_object_vars($current_details);
@@ -321,23 +321,23 @@  discard block
 block discarded – undo
321 321
 	$details['last_updated'] = current_time('mysql', true);
322 322
 
323 323
 	$update_details = array();
324
-	$fields = array( 'site_id', 'domain', 'path', 'registered', 'last_updated', 'public', 'archived', 'mature', 'spam', 'deleted', 'lang_id');
325
-	foreach ( array_intersect( array_keys( $details ), $fields ) as $field ) {
326
-		if ( 'path' === $field ) {
327
-			$details[ $field ] = trailingslashit( '/' . trim( $details[ $field ], '/' ) );
324
+	$fields = array('site_id', 'domain', 'path', 'registered', 'last_updated', 'public', 'archived', 'mature', 'spam', 'deleted', 'lang_id');
325
+	foreach (array_intersect(array_keys($details), $fields) as $field) {
326
+		if ('path' === $field) {
327
+			$details[$field] = trailingslashit('/'.trim($details[$field], '/'));
328 328
 		}
329 329
 
330
-		$update_details[ $field ] = $details[ $field ];
330
+		$update_details[$field] = $details[$field];
331 331
 	}
332 332
 
333
-	$result = $wpdb->update( $wpdb->blogs, $update_details, array('blog_id' => $blog_id) );
333
+	$result = $wpdb->update($wpdb->blogs, $update_details, array('blog_id' => $blog_id));
334 334
 
335
-	if ( false === $result )
335
+	if (false === $result)
336 336
 		return false;
337 337
 
338 338
 	// If spam status changed, issue actions.
339
-	if ( $details['spam'] != $current_details['spam'] ) {
340
-		if ( $details['spam'] == 1 ) {
339
+	if ($details['spam'] != $current_details['spam']) {
340
+		if ($details['spam'] == 1) {
341 341
 			/**
342 342
 			 * Fires when the blog status is changed to 'spam'.
343 343
 			 *
@@ -345,7 +345,7 @@  discard block
 block discarded – undo
345 345
 			 *
346 346
 			 * @param int $blog_id Blog ID.
347 347
 			 */
348
-			do_action( 'make_spam_blog', $blog_id );
348
+			do_action('make_spam_blog', $blog_id);
349 349
 		} else {
350 350
 			/**
351 351
 			 * Fires when the blog status is changed to 'ham'.
@@ -354,13 +354,13 @@  discard block
 block discarded – undo
354 354
 			 *
355 355
 			 * @param int $blog_id Blog ID.
356 356
 			 */
357
-			do_action( 'make_ham_blog', $blog_id );
357
+			do_action('make_ham_blog', $blog_id);
358 358
 		}
359 359
 	}
360 360
 
361 361
 	// If mature status changed, issue actions.
362
-	if ( $details['mature'] != $current_details['mature'] ) {
363
-		if ( $details['mature'] == 1 ) {
362
+	if ($details['mature'] != $current_details['mature']) {
363
+		if ($details['mature'] == 1) {
364 364
 			/**
365 365
 			 * Fires when the blog status is changed to 'mature'.
366 366
 			 *
@@ -368,7 +368,7 @@  discard block
 block discarded – undo
368 368
 			 *
369 369
 			 * @param int $blog_id Blog ID.
370 370
 			 */
371
-			do_action( 'mature_blog', $blog_id );
371
+			do_action('mature_blog', $blog_id);
372 372
 		} else {
373 373
 			/**
374 374
 			 * Fires when the blog status is changed to 'unmature'.
@@ -377,13 +377,13 @@  discard block
 block discarded – undo
377 377
 			 *
378 378
 			 * @param int $blog_id Blog ID.
379 379
 			 */
380
-			do_action( 'unmature_blog', $blog_id );
380
+			do_action('unmature_blog', $blog_id);
381 381
 		}
382 382
 	}
383 383
 
384 384
 	// If archived status changed, issue actions.
385
-	if ( $details['archived'] != $current_details['archived'] ) {
386
-		if ( $details['archived'] == 1 ) {
385
+	if ($details['archived'] != $current_details['archived']) {
386
+		if ($details['archived'] == 1) {
387 387
 			/**
388 388
 			 * Fires when the blog status is changed to 'archived'.
389 389
 			 *
@@ -391,7 +391,7 @@  discard block
 block discarded – undo
391 391
 			 *
392 392
 			 * @param int $blog_id Blog ID.
393 393
 			 */
394
-			do_action( 'archive_blog', $blog_id );
394
+			do_action('archive_blog', $blog_id);
395 395
 		} else {
396 396
 			/**
397 397
 			 * Fires when the blog status is changed to 'unarchived'.
@@ -400,13 +400,13 @@  discard block
 block discarded – undo
400 400
 			 *
401 401
 			 * @param int $blog_id Blog ID.
402 402
 			 */
403
-			do_action( 'unarchive_blog', $blog_id );
403
+			do_action('unarchive_blog', $blog_id);
404 404
 		}
405 405
 	}
406 406
 
407 407
 	// If deleted status changed, issue actions.
408
-	if ( $details['deleted'] != $current_details['deleted'] ) {
409
-		if ( $details['deleted'] == 1 ) {
408
+	if ($details['deleted'] != $current_details['deleted']) {
409
+		if ($details['deleted'] == 1) {
410 410
 			/**
411 411
 			 * Fires when the blog status is changed to 'deleted'.
412 412
 			 *
@@ -414,7 +414,7 @@  discard block
 block discarded – undo
414 414
 			 *
415 415
 			 * @param int $blog_id Blog ID.
416 416
 			 */
417
-			do_action( 'make_delete_blog', $blog_id );
417
+			do_action('make_delete_blog', $blog_id);
418 418
 		} else {
419 419
 			/**
420 420
 			 * Fires when the blog status is changed to 'undeleted'.
@@ -423,13 +423,13 @@  discard block
 block discarded – undo
423 423
 			 *
424 424
 			 * @param int $blog_id Blog ID.
425 425
 			 */
426
-			do_action( 'make_undelete_blog', $blog_id );
426
+			do_action('make_undelete_blog', $blog_id);
427 427
 		}
428 428
 	}
429 429
 
430
-	if ( isset( $details['public'] ) ) {
431
-		switch_to_blog( $blog_id );
432
-		update_option( 'blog_public', $details['public'] );
430
+	if (isset($details['public'])) {
431
+		switch_to_blog($blog_id);
432
+		update_option('blog_public', $details['public']);
433 433
 		restore_current_blog();
434 434
 	}
435 435
 
@@ -445,18 +445,18 @@  discard block
 block discarded – undo
445 445
  *
446 446
  * @param WP_Site $blog The site object to be cleared from cache.
447 447
  */
448
-function clean_blog_cache( $blog ) {
448
+function clean_blog_cache($blog) {
449 449
 	$blog_id = $blog->blog_id;
450
-	$domain_path_key = md5( $blog->domain . $blog->path );
450
+	$domain_path_key = md5($blog->domain.$blog->path);
451 451
 
452
-	wp_cache_delete( $blog_id, 'sites' );
453
-	wp_cache_delete( $blog_id, 'site-details' );
454
-	wp_cache_delete( $blog_id , 'blog-details' );
455
-	wp_cache_delete( $blog_id . 'short' , 'blog-details' );
456
-	wp_cache_delete(  $domain_path_key, 'blog-lookup' );
457
-	wp_cache_delete( 'current_blog_' . $blog->domain, 'site-options' );
458
-	wp_cache_delete( 'current_blog_' . $blog->domain . $blog->path, 'site-options' );
459
-	wp_cache_delete( $domain_path_key, 'blog-id-cache' );
452
+	wp_cache_delete($blog_id, 'sites');
453
+	wp_cache_delete($blog_id, 'site-details');
454
+	wp_cache_delete($blog_id, 'blog-details');
455
+	wp_cache_delete($blog_id.'short', 'blog-details');
456
+	wp_cache_delete($domain_path_key, 'blog-lookup');
457
+	wp_cache_delete('current_blog_'.$blog->domain, 'site-options');
458
+	wp_cache_delete('current_blog_'.$blog->domain.$blog->path, 'site-options');
459
+	wp_cache_delete($domain_path_key, 'blog-id-cache');
460 460
 
461 461
 	/**
462 462
 	 * Fires immediately after a site has been removed from the object cache.
@@ -467,9 +467,9 @@  discard block
 block discarded – undo
467 467
 	 * @param WP_Site $blog            Site object.
468 468
 	 * @param string  $domain_path_key md5 hash of domain and path.
469 469
 	 */
470
-	do_action( 'clean_site_cache', $blog_id, $blog, $domain_path_key );
470
+	do_action('clean_site_cache', $blog_id, $blog, $domain_path_key);
471 471
 
472
-	wp_cache_set( 'last_changed', microtime(), 'sites' );
472
+	wp_cache_set('last_changed', microtime(), 'sites');
473 473
 }
474 474
 
475 475
 /**
@@ -483,20 +483,20 @@  discard block
 block discarded – undo
483 483
  * @param WP_Site|int|null $site Optional. Site to retrieve. Default is the current site.
484 484
  * @return WP_Site|null The site object or null if not found.
485 485
  */
486
-function get_site( $site = null ) {
487
-	if ( empty( $site ) ) {
486
+function get_site($site = null) {
487
+	if (empty($site)) {
488 488
 		$site = get_current_blog_id();
489 489
 	}
490 490
 
491
-	if ( $site instanceof WP_Site ) {
491
+	if ($site instanceof WP_Site) {
492 492
 		$_site = $site;
493
-	} elseif ( is_object( $site ) ) {
494
-		$_site = new WP_Site( $site );
493
+	} elseif (is_object($site)) {
494
+		$_site = new WP_Site($site);
495 495
 	} else {
496
-		$_site = WP_Site::get_instance( $site );
496
+		$_site = WP_Site::get_instance($site);
497 497
 	}
498 498
 
499
-	if ( ! $_site ) {
499
+	if ( ! $_site) {
500 500
 		return null;
501 501
 	}
502 502
 
@@ -507,7 +507,7 @@  discard block
 block discarded – undo
507 507
 	 *
508 508
 	 * @param WP_Site $_site Site data.
509 509
 	 */
510
-	$_site = apply_filters( 'get_site', $_site );
510
+	$_site = apply_filters('get_site', $_site);
511 511
 
512 512
 	return $_site;
513 513
 }
@@ -523,14 +523,14 @@  discard block
 block discarded – undo
523 523
  *
524 524
  * @param array $ids ID list.
525 525
  */
526
-function _prime_site_caches( $ids ) {
526
+function _prime_site_caches($ids) {
527 527
 	global $wpdb;
528 528
 
529
-	$non_cached_ids = _get_non_cached_ids( $ids, 'sites' );
530
-	if ( ! empty( $non_cached_ids ) ) {
531
-		$fresh_sites = $wpdb->get_results( sprintf( "SELECT * FROM $wpdb->blogs WHERE blog_id IN (%s)", join( ",", array_map( 'intval', $non_cached_ids ) ) ) );
529
+	$non_cached_ids = _get_non_cached_ids($ids, 'sites');
530
+	if ( ! empty($non_cached_ids)) {
531
+		$fresh_sites = $wpdb->get_results(sprintf("SELECT * FROM $wpdb->blogs WHERE blog_id IN (%s)", join(",", array_map('intval', $non_cached_ids))));
532 532
 
533
-		update_site_cache( $fresh_sites );
533
+		update_site_cache($fresh_sites);
534 534
 	}
535 535
 }
536 536
 
@@ -541,14 +541,14 @@  discard block
 block discarded – undo
541 541
  *
542 542
  * @param array $sites Array of site objects.
543 543
  */
544
-function update_site_cache( $sites ) {
545
-	if ( ! $sites ) {
544
+function update_site_cache($sites) {
545
+	if ( ! $sites) {
546 546
 		return;
547 547
 	}
548 548
 
549
-	foreach ( $sites as $site ) {
550
-		wp_cache_add( $site->blog_id, $site, 'sites' );
551
-		wp_cache_add( $site->blog_id . 'short', $site, 'blog-details' );
549
+	foreach ($sites as $site) {
550
+		wp_cache_add($site->blog_id, $site, 'sites');
551
+		wp_cache_add($site->blog_id.'short', $site, 'blog-details');
552 552
 	}
553 553
 }
554 554
 
@@ -603,10 +603,10 @@  discard block
 block discarded – undo
603 603
  * }
604 604
  * @return array List of sites.
605 605
  */
606
-function get_sites( $args = array() ) {
606
+function get_sites($args = array()) {
607 607
 	$query = new WP_Site_Query();
608 608
 
609
-	return $query->query( $args );
609
+	return $query->query($args);
610 610
 }
611 611
 
612 612
 /**
@@ -626,17 +626,17 @@  discard block
 block discarded – undo
626 626
  * @param mixed  $default Optional. Default value to return if the option does not exist.
627 627
  * @return mixed Value set for the option.
628 628
  */
629
-function get_blog_option( $id, $option, $default = false ) {
629
+function get_blog_option($id, $option, $default = false) {
630 630
 	$id = (int) $id;
631 631
 
632
-	if ( empty( $id ) )
632
+	if (empty($id))
633 633
 		$id = get_current_blog_id();
634 634
 
635
-	if ( get_current_blog_id() == $id )
636
-		return get_option( $option, $default );
635
+	if (get_current_blog_id() == $id)
636
+		return get_option($option, $default);
637 637
 
638
-	switch_to_blog( $id );
639
-	$value = get_option( $option, $default );
638
+	switch_to_blog($id);
639
+	$value = get_option($option, $default);
640 640
 	restore_current_blog();
641 641
 
642 642
 	/**
@@ -649,7 +649,7 @@  discard block
 block discarded – undo
649 649
 	 * @param string  $value The option value.
650 650
 	 * @param int     $id    Blog ID.
651 651
 	 */
652
-	return apply_filters( "blog_option_{$option}", $value, $id );
652
+	return apply_filters("blog_option_{$option}", $value, $id);
653 653
 }
654 654
 
655 655
 /**
@@ -671,17 +671,17 @@  discard block
 block discarded – undo
671 671
  * @param mixed  $value  Optional. Option value, can be anything. Expected to not be SQL-escaped.
672 672
  * @return bool False if option was not added and true if option was added.
673 673
  */
674
-function add_blog_option( $id, $option, $value ) {
674
+function add_blog_option($id, $option, $value) {
675 675
 	$id = (int) $id;
676 676
 
677
-	if ( empty( $id ) )
677
+	if (empty($id))
678 678
 		$id = get_current_blog_id();
679 679
 
680
-	if ( get_current_blog_id() == $id )
681
-		return add_option( $option, $value );
680
+	if (get_current_blog_id() == $id)
681
+		return add_option($option, $value);
682 682
 
683
-	switch_to_blog( $id );
684
-	$return = add_option( $option, $value );
683
+	switch_to_blog($id);
684
+	$return = add_option($option, $value);
685 685
 	restore_current_blog();
686 686
 
687 687
 	return $return;
@@ -696,17 +696,17 @@  discard block
 block discarded – undo
696 696
  * @param string $option Name of option to remove. Expected to not be SQL-escaped.
697 697
  * @return bool True, if option is successfully deleted. False on failure.
698 698
  */
699
-function delete_blog_option( $id, $option ) {
699
+function delete_blog_option($id, $option) {
700 700
 	$id = (int) $id;
701 701
 
702
-	if ( empty( $id ) )
702
+	if (empty($id))
703 703
 		$id = get_current_blog_id();
704 704
 
705
-	if ( get_current_blog_id() == $id )
706
-		return delete_option( $option );
705
+	if (get_current_blog_id() == $id)
706
+		return delete_option($option);
707 707
 
708
-	switch_to_blog( $id );
709
-	$return = delete_option( $option );
708
+	switch_to_blog($id);
709
+	$return = delete_option($option);
710 710
 	restore_current_blog();
711 711
 
712 712
 	return $return;
@@ -723,20 +723,20 @@  discard block
 block discarded – undo
723 723
  * @param mixed  $deprecated Not used.
724 724
  * @return bool True on success, false on failure.
725 725
  */
726
-function update_blog_option( $id, $option, $value, $deprecated = null ) {
726
+function update_blog_option($id, $option, $value, $deprecated = null) {
727 727
 	$id = (int) $id;
728 728
 
729
-	if ( null !== $deprecated  )
730
-		_deprecated_argument( __FUNCTION__, '3.1.0' );
729
+	if (null !== $deprecated)
730
+		_deprecated_argument(__FUNCTION__, '3.1.0');
731 731
 
732
-	if ( get_current_blog_id() == $id )
733
-		return update_option( $option, $value );
732
+	if (get_current_blog_id() == $id)
733
+		return update_option($option, $value);
734 734
 
735
-	switch_to_blog( $id );
736
-	$return = update_option( $option, $value );
735
+	switch_to_blog($id);
736
+	$return = update_option($option, $value);
737 737
 	restore_current_blog();
738 738
 
739
-	refresh_blog_details( $id );
739
+	refresh_blog_details($id);
740 740
 
741 741
 	return $return;
742 742
 }
@@ -765,11 +765,11 @@  discard block
 block discarded – undo
765 765
  * @param bool $deprecated Deprecated argument
766 766
  * @return true Always returns True.
767 767
  */
768
-function switch_to_blog( $new_blog, $deprecated = null ) {
768
+function switch_to_blog($new_blog, $deprecated = null) {
769 769
 	global $wpdb, $wp_roles;
770 770
 
771 771
 	$blog_id = get_current_blog_id();
772
-	if ( empty( $new_blog ) ) {
772
+	if (empty($new_blog)) {
773 773
 		$new_blog = $blog_id;
774 774
 	}
775 775
 
@@ -780,7 +780,7 @@  discard block
 block discarded – undo
780 780
 	 * set the right vars, do the associated actions, but skip
781 781
 	 * the extra unnecessary work
782 782
 	 */
783
-	if ( $new_blog == $blog_id ) {
783
+	if ($new_blog == $blog_id) {
784 784
 		/**
785 785
 		 * Fires when the blog is switched.
786 786
 		 *
@@ -789,46 +789,46 @@  discard block
 block discarded – undo
789 789
 		 * @param int $new_blog New blog ID.
790 790
 		 * @param int $new_blog Blog ID.
791 791
 		 */
792
-		do_action( 'switch_blog', $new_blog, $new_blog );
792
+		do_action('switch_blog', $new_blog, $new_blog);
793 793
 		$GLOBALS['switched'] = true;
794 794
 		return true;
795 795
 	}
796 796
 
797
-	$wpdb->set_blog_id( $new_blog );
797
+	$wpdb->set_blog_id($new_blog);
798 798
 	$GLOBALS['table_prefix'] = $wpdb->get_blog_prefix();
799 799
 	$prev_blog_id = $blog_id;
800 800
 	$GLOBALS['blog_id'] = $new_blog;
801 801
 
802
-	if ( function_exists( 'wp_cache_switch_to_blog' ) ) {
803
-		wp_cache_switch_to_blog( $new_blog );
802
+	if (function_exists('wp_cache_switch_to_blog')) {
803
+		wp_cache_switch_to_blog($new_blog);
804 804
 	} else {
805 805
 		global $wp_object_cache;
806 806
 
807
-		if ( is_object( $wp_object_cache ) && isset( $wp_object_cache->global_groups ) ) {
807
+		if (is_object($wp_object_cache) && isset($wp_object_cache->global_groups)) {
808 808
 			$global_groups = $wp_object_cache->global_groups;
809 809
 		} else {
810 810
 			$global_groups = false;
811 811
 		}
812 812
 		wp_cache_init();
813 813
 
814
-		if ( function_exists( 'wp_cache_add_global_groups' ) ) {
815
-			if ( is_array( $global_groups ) ) {
816
-				wp_cache_add_global_groups( $global_groups );
814
+		if (function_exists('wp_cache_add_global_groups')) {
815
+			if (is_array($global_groups)) {
816
+				wp_cache_add_global_groups($global_groups);
817 817
 			} else {
818
-				wp_cache_add_global_groups( array( 'users', 'userlogins', 'usermeta', 'user_meta', 'useremail', 'userslugs', 'site-transient', 'site-options', 'site-lookup', 'blog-lookup', 'blog-details', 'rss', 'global-posts', 'blog-id-cache', 'networks', 'sites', 'site-details' ) );
818
+				wp_cache_add_global_groups(array('users', 'userlogins', 'usermeta', 'user_meta', 'useremail', 'userslugs', 'site-transient', 'site-options', 'site-lookup', 'blog-lookup', 'blog-details', 'rss', 'global-posts', 'blog-id-cache', 'networks', 'sites', 'site-details'));
819 819
 			}
820
-			wp_cache_add_non_persistent_groups( array( 'counts', 'plugins' ) );
820
+			wp_cache_add_non_persistent_groups(array('counts', 'plugins'));
821 821
 		}
822 822
 	}
823 823
 
824
-	if ( did_action( 'init' ) ) {
824
+	if (did_action('init')) {
825 825
 		$wp_roles = new WP_Roles();
826 826
 		$current_user = wp_get_current_user();
827
-		$current_user->for_blog( $new_blog );
827
+		$current_user->for_blog($new_blog);
828 828
 	}
829 829
 
830 830
 	/** This filter is documented in wp-includes/ms-blogs.php */
831
-	do_action( 'switch_blog', $new_blog, $prev_blog_id );
831
+	do_action('switch_blog', $new_blog, $prev_blog_id);
832 832
 	$GLOBALS['switched'] = true;
833 833
 
834 834
 	return true;
@@ -852,32 +852,32 @@  discard block
 block discarded – undo
852 852
 function restore_current_blog() {
853 853
 	global $wpdb, $wp_roles;
854 854
 
855
-	if ( empty( $GLOBALS['_wp_switched_stack'] ) ) {
855
+	if (empty($GLOBALS['_wp_switched_stack'])) {
856 856
 		return false;
857 857
 	}
858 858
 
859
-	$blog = array_pop( $GLOBALS['_wp_switched_stack'] );
859
+	$blog = array_pop($GLOBALS['_wp_switched_stack']);
860 860
 	$blog_id = get_current_blog_id();
861 861
 
862
-	if ( $blog_id == $blog ) {
862
+	if ($blog_id == $blog) {
863 863
 		/** This filter is documented in wp-includes/ms-blogs.php */
864
-		do_action( 'switch_blog', $blog, $blog );
864
+		do_action('switch_blog', $blog, $blog);
865 865
 		// If we still have items in the switched stack, consider ourselves still 'switched'
866
-		$GLOBALS['switched'] = ! empty( $GLOBALS['_wp_switched_stack'] );
866
+		$GLOBALS['switched'] = ! empty($GLOBALS['_wp_switched_stack']);
867 867
 		return true;
868 868
 	}
869 869
 
870
-	$wpdb->set_blog_id( $blog );
870
+	$wpdb->set_blog_id($blog);
871 871
 	$prev_blog_id = $blog_id;
872 872
 	$GLOBALS['blog_id'] = $blog;
873 873
 	$GLOBALS['table_prefix'] = $wpdb->get_blog_prefix();
874 874
 
875
-	if ( function_exists( 'wp_cache_switch_to_blog' ) ) {
876
-		wp_cache_switch_to_blog( $blog );
875
+	if (function_exists('wp_cache_switch_to_blog')) {
876
+		wp_cache_switch_to_blog($blog);
877 877
 	} else {
878 878
 		global $wp_object_cache;
879 879
 
880
-		if ( is_object( $wp_object_cache ) && isset( $wp_object_cache->global_groups ) ) {
880
+		if (is_object($wp_object_cache) && isset($wp_object_cache->global_groups)) {
881 881
 			$global_groups = $wp_object_cache->global_groups;
882 882
 		} else {
883 883
 			$global_groups = false;
@@ -885,27 +885,27 @@  discard block
 block discarded – undo
885 885
 
886 886
 		wp_cache_init();
887 887
 
888
-		if ( function_exists( 'wp_cache_add_global_groups' ) ) {
889
-			if ( is_array( $global_groups ) ) {
890
-				wp_cache_add_global_groups( $global_groups );
888
+		if (function_exists('wp_cache_add_global_groups')) {
889
+			if (is_array($global_groups)) {
890
+				wp_cache_add_global_groups($global_groups);
891 891
 			} else {
892
-				wp_cache_add_global_groups( array( 'users', 'userlogins', 'usermeta', 'user_meta', 'useremail', 'userslugs', 'site-transient', 'site-options', 'site-lookup', 'blog-lookup', 'blog-details', 'rss', 'global-posts', 'blog-id-cache', 'networks', 'sites', 'site-details' ) );
892
+				wp_cache_add_global_groups(array('users', 'userlogins', 'usermeta', 'user_meta', 'useremail', 'userslugs', 'site-transient', 'site-options', 'site-lookup', 'blog-lookup', 'blog-details', 'rss', 'global-posts', 'blog-id-cache', 'networks', 'sites', 'site-details'));
893 893
 			}
894
-			wp_cache_add_non_persistent_groups( array( 'counts', 'plugins' ) );
894
+			wp_cache_add_non_persistent_groups(array('counts', 'plugins'));
895 895
 		}
896 896
 	}
897 897
 
898
-	if ( did_action( 'init' ) ) {
898
+	if (did_action('init')) {
899 899
 		$wp_roles = new WP_Roles();
900 900
 		$current_user = wp_get_current_user();
901
-		$current_user->for_blog( $blog );
901
+		$current_user->for_blog($blog);
902 902
 	}
903 903
 
904 904
 	/** This filter is documented in wp-includes/ms-blogs.php */
905
-	do_action( 'switch_blog', $blog, $prev_blog_id );
905
+	do_action('switch_blog', $blog, $prev_blog_id);
906 906
 
907 907
 	// If we still have items in the switched stack, consider ourselves still 'switched'
908
-	$GLOBALS['switched'] = ! empty( $GLOBALS['_wp_switched_stack'] );
908
+	$GLOBALS['switched'] = ! empty($GLOBALS['_wp_switched_stack']);
909 909
 
910 910
 	return true;
911 911
 }
@@ -920,7 +920,7 @@  discard block
 block discarded – undo
920 920
  * @return bool True if switched, false otherwise.
921 921
  */
922 922
 function ms_is_switched() {
923
-	return ! empty( $GLOBALS['_wp_switched_stack'] );
923
+	return ! empty($GLOBALS['_wp_switched_stack']);
924 924
 }
925 925
 
926 926
 /**
@@ -931,7 +931,7 @@  discard block
 block discarded – undo
931 931
  * @param int $id The blog id
932 932
  * @return string Whether the blog is archived or not
933 933
  */
934
-function is_archived( $id ) {
934
+function is_archived($id) {
935 935
 	return get_blog_status($id, 'archived');
936 936
 }
937 937
 
@@ -944,7 +944,7 @@  discard block
 block discarded – undo
944 944
  * @param string $archived The new status
945 945
  * @return string $archived
946 946
  */
947
-function update_archived( $id, $archived ) {
947
+function update_archived($id, $archived) {
948 948
 	update_blog_status($id, 'archived', $archived);
949 949
 	return $archived;
950 950
 }
@@ -962,55 +962,55 @@  discard block
 block discarded – undo
962 962
  * @param null   $deprecated
963 963
  * @return string|false $value
964 964
  */
965
-function update_blog_status( $blog_id, $pref, $value, $deprecated = null ) {
965
+function update_blog_status($blog_id, $pref, $value, $deprecated = null) {
966 966
 	global $wpdb;
967 967
 
968
-	if ( null !== $deprecated  )
969
-		_deprecated_argument( __FUNCTION__, '3.1.0' );
968
+	if (null !== $deprecated)
969
+		_deprecated_argument(__FUNCTION__, '3.1.0');
970 970
 
971
-	if ( ! in_array( $pref, array( 'site_id', 'domain', 'path', 'registered', 'last_updated', 'public', 'archived', 'mature', 'spam', 'deleted', 'lang_id') ) )
971
+	if ( ! in_array($pref, array('site_id', 'domain', 'path', 'registered', 'last_updated', 'public', 'archived', 'mature', 'spam', 'deleted', 'lang_id')))
972 972
 		return $value;
973 973
 
974
-	$result = $wpdb->update( $wpdb->blogs, array($pref => $value, 'last_updated' => current_time('mysql', true)), array('blog_id' => $blog_id) );
974
+	$result = $wpdb->update($wpdb->blogs, array($pref => $value, 'last_updated' => current_time('mysql', true)), array('blog_id' => $blog_id));
975 975
 
976
-	if ( false === $result )
976
+	if (false === $result)
977 977
 		return false;
978 978
 
979
-	refresh_blog_details( $blog_id );
979
+	refresh_blog_details($blog_id);
980 980
 
981
-	if ( 'spam' == $pref ) {
982
-		if ( $value == 1 ) {
981
+	if ('spam' == $pref) {
982
+		if ($value == 1) {
983 983
 			/** This filter is documented in wp-includes/ms-blogs.php */
984
-			do_action( 'make_spam_blog', $blog_id );
984
+			do_action('make_spam_blog', $blog_id);
985 985
 		} else {
986 986
 			/** This filter is documented in wp-includes/ms-blogs.php */
987
-			do_action( 'make_ham_blog', $blog_id );
987
+			do_action('make_ham_blog', $blog_id);
988 988
 		}
989
-	} elseif ( 'mature' == $pref ) {
990
-		if ( $value == 1 ) {
989
+	} elseif ('mature' == $pref) {
990
+		if ($value == 1) {
991 991
 			/** This filter is documented in wp-includes/ms-blogs.php */
992
-			do_action( 'mature_blog', $blog_id );
992
+			do_action('mature_blog', $blog_id);
993 993
 		} else {
994 994
 			/** This filter is documented in wp-includes/ms-blogs.php */
995
-			do_action( 'unmature_blog', $blog_id );
995
+			do_action('unmature_blog', $blog_id);
996 996
 		}
997
-	} elseif ( 'archived' == $pref ) {
998
-		if ( $value == 1 ) {
997
+	} elseif ('archived' == $pref) {
998
+		if ($value == 1) {
999 999
 			/** This filter is documented in wp-includes/ms-blogs.php */
1000
-			do_action( 'archive_blog', $blog_id );
1000
+			do_action('archive_blog', $blog_id);
1001 1001
 		} else {
1002 1002
 			/** This filter is documented in wp-includes/ms-blogs.php */
1003
-			do_action( 'unarchive_blog', $blog_id );
1003
+			do_action('unarchive_blog', $blog_id);
1004 1004
 		}
1005
-	} elseif ( 'deleted' == $pref ) {
1006
-		if ( $value == 1 ) {
1005
+	} elseif ('deleted' == $pref) {
1006
+		if ($value == 1) {
1007 1007
 			/** This filter is documented in wp-includes/ms-blogs.php */
1008
-			do_action( 'make_delete_blog', $blog_id );
1008
+			do_action('make_delete_blog', $blog_id);
1009 1009
 		} else {
1010 1010
 			/** This filter is documented in wp-includes/ms-blogs.php */
1011
-			do_action( 'make_undelete_blog', $blog_id );
1011
+			do_action('make_undelete_blog', $blog_id);
1012 1012
 		}
1013
-	} elseif ( 'public' == $pref ) {
1013
+	} elseif ('public' == $pref) {
1014 1014
 		/**
1015 1015
 		 * Fires after the current blog's 'public' setting is updated.
1016 1016
 		 *
@@ -1019,7 +1019,7 @@  discard block
 block discarded – undo
1019 1019
 		 * @param int    $blog_id Blog ID.
1020 1020
 		 * @param string $value   The value of blog status.
1021 1021
  		 */
1022
-		do_action( 'update_blog_public', $blog_id, $value ); // Moved here from update_blog_public().
1022
+		do_action('update_blog_public', $blog_id, $value); // Moved here from update_blog_public().
1023 1023
 	}
1024 1024
 
1025 1025
 	return $value;
@@ -1036,14 +1036,14 @@  discard block
 block discarded – undo
1036 1036
  * @param string $pref A field name
1037 1037
  * @return bool|string|null $value
1038 1038
  */
1039
-function get_blog_status( $id, $pref ) {
1039
+function get_blog_status($id, $pref) {
1040 1040
 	global $wpdb;
1041 1041
 
1042
-	$details = get_site( $id );
1043
-	if ( $details )
1042
+	$details = get_site($id);
1043
+	if ($details)
1044 1044
 		return $details->$pref;
1045 1045
 
1046
-	return $wpdb->get_var( $wpdb->prepare("SELECT %s FROM {$wpdb->blogs} WHERE blog_id = %d", $pref, $id) );
1046
+	return $wpdb->get_var($wpdb->prepare("SELECT %s FROM {$wpdb->blogs} WHERE blog_id = %d", $pref, $id));
1047 1047
 }
1048 1048
 
1049 1049
 /**
@@ -1058,13 +1058,13 @@  discard block
 block discarded – undo
1058 1058
  * @param int   $quantity   The maximum number of blogs to retrieve. Default is 40.
1059 1059
  * @return array The list of blogs
1060 1060
  */
1061
-function get_last_updated( $deprecated = '', $start = 0, $quantity = 40 ) {
1061
+function get_last_updated($deprecated = '', $start = 0, $quantity = 40) {
1062 1062
 	global $wpdb;
1063 1063
 
1064
-	if ( ! empty( $deprecated ) )
1065
-		_deprecated_argument( __FUNCTION__, 'MU' ); // never used
1064
+	if ( ! empty($deprecated))
1065
+		_deprecated_argument(__FUNCTION__, 'MU'); // never used
1066 1066
 
1067
-	return $wpdb->get_results( $wpdb->prepare("SELECT blog_id, domain, path FROM $wpdb->blogs WHERE site_id = %d AND public = '1' AND archived = '0' AND mature = '0' AND spam = '0' AND deleted = '0' AND last_updated != '0000-00-00 00:00:00' ORDER BY last_updated DESC limit %d, %d", $wpdb->siteid, $start, $quantity ) , ARRAY_A );
1067
+	return $wpdb->get_results($wpdb->prepare("SELECT blog_id, domain, path FROM $wpdb->blogs WHERE site_id = %d AND public = '1' AND archived = '0' AND mature = '0' AND spam = '0' AND deleted = '0' AND last_updated != '0000-00-00 00:00:00' ORDER BY last_updated DESC limit %d, %d", $wpdb->siteid, $start, $quantity), ARRAY_A);
1068 1068
 }
1069 1069
 
1070 1070
 /**
@@ -1076,10 +1076,10 @@  discard block
 block discarded – undo
1076 1076
  *                           for information on accepted arguments. Default empty array.
1077 1077
  * @return int|array List of networks or number of found networks if `$count` argument is true.
1078 1078
  */
1079
-function get_networks( $args = array() ) {
1079
+function get_networks($args = array()) {
1080 1080
 	$query = new WP_Network_Query();
1081 1081
 
1082
-	return $query->query( $args );
1082
+	return $query->query($args);
1083 1083
 }
1084 1084
 
1085 1085
 /**
@@ -1095,21 +1095,21 @@  discard block
 block discarded – undo
1095 1095
  * @param WP_Network|int|null $network Optional. Network to retrieve. Default is the current network.
1096 1096
  * @return WP_Network|null The network object or null if not found.
1097 1097
  */
1098
-function get_network( $network = null ) {
1098
+function get_network($network = null) {
1099 1099
 	global $current_site;
1100
-	if ( empty( $network ) && isset( $current_site ) ) {
1100
+	if (empty($network) && isset($current_site)) {
1101 1101
 		$network = $current_site;
1102 1102
 	}
1103 1103
 
1104
-	if ( $network instanceof WP_Network ) {
1104
+	if ($network instanceof WP_Network) {
1105 1105
 		$_network = $network;
1106
-	} elseif ( is_object( $network ) ) {
1107
-		$_network = new WP_Network( $network );
1106
+	} elseif (is_object($network)) {
1107
+		$_network = new WP_Network($network);
1108 1108
 	} else {
1109
-		$_network = WP_Network::get_instance( $network );
1109
+		$_network = WP_Network::get_instance($network);
1110 1110
 	}
1111 1111
 
1112
-	if ( ! $_network ) {
1112
+	if ( ! $_network) {
1113 1113
 		return null;
1114 1114
 	}
1115 1115
 
@@ -1120,7 +1120,7 @@  discard block
 block discarded – undo
1120 1120
 	 *
1121 1121
 	 * @param WP_Network $_network Network data.
1122 1122
 	 */
1123
-	$_network = apply_filters( 'get_network', $_network );
1123
+	$_network = apply_filters('get_network', $_network);
1124 1124
 
1125 1125
 	return $_network;
1126 1126
 }
@@ -1132,9 +1132,9 @@  discard block
 block discarded – undo
1132 1132
  *
1133 1133
  * @param int|array $ids Network ID or an array of network IDs to remove from cache.
1134 1134
  */
1135
-function clean_network_cache( $ids ) {
1136
-	foreach ( (array) $ids as $id ) {
1137
-		wp_cache_delete( $id, 'networks' );
1135
+function clean_network_cache($ids) {
1136
+	foreach ((array) $ids as $id) {
1137
+		wp_cache_delete($id, 'networks');
1138 1138
 
1139 1139
 		/**
1140 1140
 		 * Fires immediately after a network has been removed from the object cache.
@@ -1143,10 +1143,10 @@  discard block
 block discarded – undo
1143 1143
 		 *
1144 1144
 		 * @param int $id Network ID.
1145 1145
 		 */
1146
-		do_action( 'clean_network_cache', $id );
1146
+		do_action('clean_network_cache', $id);
1147 1147
 	}
1148 1148
 
1149
-	wp_cache_set( 'last_changed', microtime(), 'networks' );
1149
+	wp_cache_set('last_changed', microtime(), 'networks');
1150 1150
 }
1151 1151
 
1152 1152
 /**
@@ -1160,9 +1160,9 @@  discard block
 block discarded – undo
1160 1160
  *
1161 1161
  * @param array $networks Array of network row objects.
1162 1162
  */
1163
-function update_network_cache( $networks ) {
1164
-	foreach ( (array) $networks as $network ) {
1165
-		wp_cache_add( $network->id, $network, 'networks' );
1163
+function update_network_cache($networks) {
1164
+	foreach ((array) $networks as $network) {
1165
+		wp_cache_add($network->id, $network, 'networks');
1166 1166
 	}
1167 1167
 }
1168 1168
 
@@ -1177,14 +1177,14 @@  discard block
 block discarded – undo
1177 1177
  *
1178 1178
  * @param array $network_ids Array of network IDs.
1179 1179
  */
1180
-function _prime_network_caches( $network_ids ) {
1180
+function _prime_network_caches($network_ids) {
1181 1181
 	global $wpdb;
1182 1182
 
1183
-	$non_cached_ids = _get_non_cached_ids( $network_ids, 'networks' );
1184
-	if ( !empty( $non_cached_ids ) ) {
1185
-		$fresh_networks = $wpdb->get_results( sprintf( "SELECT $wpdb->site.* FROM $wpdb->site WHERE id IN (%s)", join( ",", array_map( 'intval', $non_cached_ids ) ) ) );
1183
+	$non_cached_ids = _get_non_cached_ids($network_ids, 'networks');
1184
+	if ( ! empty($non_cached_ids)) {
1185
+		$fresh_networks = $wpdb->get_results(sprintf("SELECT $wpdb->site.* FROM $wpdb->site WHERE id IN (%s)", join(",", array_map('intval', $non_cached_ids))));
1186 1186
 
1187
-		update_network_cache( $fresh_networks );
1187
+		update_network_cache($fresh_networks);
1188 1188
 	}
1189 1189
 }
1190 1190
 
@@ -1197,13 +1197,13 @@  discard block
 block discarded – undo
1197 1197
  * @param string $old_status The old post status
1198 1198
  * @param object $post       Post object
1199 1199
  */
1200
-function _update_blog_date_on_post_publish( $new_status, $old_status, $post ) {
1201
-	$post_type_obj = get_post_type_object( $post->post_type );
1202
-	if ( ! $post_type_obj || ! $post_type_obj->public ) {
1200
+function _update_blog_date_on_post_publish($new_status, $old_status, $post) {
1201
+	$post_type_obj = get_post_type_object($post->post_type);
1202
+	if ( ! $post_type_obj || ! $post_type_obj->public) {
1203 1203
 		return;
1204 1204
 	}
1205 1205
 
1206
-	if ( 'publish' != $new_status && 'publish' != $old_status ) {
1206
+	if ('publish' != $new_status && 'publish' != $old_status) {
1207 1207
 		return;
1208 1208
 	}
1209 1209
 
@@ -1219,15 +1219,15 @@  discard block
 block discarded – undo
1219 1219
  *
1220 1220
  * @param int $post_id Post ID
1221 1221
  */
1222
-function _update_blog_date_on_post_delete( $post_id ) {
1223
-	$post = get_post( $post_id );
1222
+function _update_blog_date_on_post_delete($post_id) {
1223
+	$post = get_post($post_id);
1224 1224
 
1225
-	$post_type_obj = get_post_type_object( $post->post_type );
1226
-	if ( ! $post_type_obj || ! $post_type_obj->public ) {
1225
+	$post_type_obj = get_post_type_object($post->post_type);
1226
+	if ( ! $post_type_obj || ! $post_type_obj->public) {
1227 1227
 		return;
1228 1228
 	}
1229 1229
 
1230
-	if ( 'publish' != $post->post_status ) {
1230
+	if ('publish' != $post->post_status) {
1231 1231
 		return;
1232 1232
 	}
1233 1233
 
@@ -1241,10 +1241,10 @@  discard block
 block discarded – undo
1241 1241
  *
1242 1242
  * @param int $post_id Post ID.
1243 1243
  */
1244
-function _update_posts_count_on_delete( $post_id ) {
1245
-	$post = get_post( $post_id );
1244
+function _update_posts_count_on_delete($post_id) {
1245
+	$post = get_post($post_id);
1246 1246
 
1247
-	if ( ! $post || 'publish' !== $post->post_status ) {
1247
+	if ( ! $post || 'publish' !== $post->post_status) {
1248 1248
 		return;
1249 1249
 	}
1250 1250
 
@@ -1259,12 +1259,12 @@  discard block
 block discarded – undo
1259 1259
  * @param string $new_status The status the post is changing to.
1260 1260
  * @param string $old_status The status the post is changing from.
1261 1261
  */
1262
-function _update_posts_count_on_transition_post_status( $new_status, $old_status ) {
1263
-	if ( $new_status === $old_status ) {
1262
+function _update_posts_count_on_transition_post_status($new_status, $old_status) {
1263
+	if ($new_status === $old_status) {
1264 1264
 		return;
1265 1265
 	}
1266 1266
 
1267
-	if ( 'publish' !== $new_status && 'publish' !== $old_status ) {
1267
+	if ('publish' !== $new_status && 'publish' !== $old_status) {
1268 1268
 		return;
1269 1269
 	}
1270 1270
 
Please login to merge, or discard this patch.
Braces   +71 added lines, -48 removed lines patch added patch discarded remove patch
@@ -60,11 +60,13 @@  discard block
 block discarded – undo
60 60
  */
61 61
 function get_blogaddress_by_name( $blogname ) {
62 62
 	if ( is_subdomain_install() ) {
63
-		if ( $blogname == 'main' )
64
-			$blogname = 'www';
63
+		if ( $blogname == 'main' ) {
64
+					$blogname = 'www';
65
+		}
65 66
 		$url = rtrim( network_home_url(), '/' );
66
-		if ( !empty( $blogname ) )
67
-			$url = preg_replace( '|^([^\.]+://)|', "\${1}" . $blogname . '.', $url );
67
+		if ( !empty( $blogname ) ) {
68
+					$url = preg_replace( '|^([^\.]+://)|', "\${1}" . $blogname . '.', $url );
69
+		}
68 70
 	} else {
69 71
 		$url = network_home_url( $blogname );
70 72
 	}
@@ -128,8 +130,9 @@  discard block
 block discarded – undo
128 130
 		} elseif ( isset($fields['domain']) && isset($fields['path']) ) {
129 131
 			$key = md5( $fields['domain'] . $fields['path'] );
130 132
 			$blog = wp_cache_get($key, 'blog-lookup');
131
-			if ( false !== $blog )
132
-				return $blog;
133
+			if ( false !== $blog ) {
134
+							return $blog;
135
+			}
133 136
 			if ( substr( $fields['domain'], 0, 4 ) == 'www.' ) {
134 137
 				$nowww = substr( $fields['domain'], 4 );
135 138
 				$blog = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->blogs WHERE domain IN (%s,%s) AND path = %s ORDER BY CHAR_LENGTH(domain) DESC", $nowww, $fields['domain'], $fields['path'] ) );
@@ -145,8 +148,9 @@  discard block
 block discarded – undo
145 148
 		} elseif ( isset($fields['domain']) && is_subdomain_install() ) {
146 149
 			$key = md5( $fields['domain'] );
147 150
 			$blog = wp_cache_get($key, 'blog-lookup');
148
-			if ( false !== $blog )
149
-				return $blog;
151
+			if ( false !== $blog ) {
152
+							return $blog;
153
+			}
150 154
 			if ( substr( $fields['domain'], 0, 4 ) == 'www.' ) {
151 155
 				$nowww = substr( $fields['domain'], 4 );
152 156
 				$blog = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->blogs WHERE domain IN (%s,%s) ORDER BY CHAR_LENGTH(domain) DESC", $nowww, $fields['domain'] ) );
@@ -163,12 +167,13 @@  discard block
 block discarded – undo
163 167
 			return false;
164 168
 		}
165 169
 	} else {
166
-		if ( ! $fields )
167
-			$blog_id = get_current_blog_id();
168
-		elseif ( ! is_numeric( $fields ) )
169
-			$blog_id = get_id_from_blogname( $fields );
170
-		else
171
-			$blog_id = $fields;
170
+		if ( ! $fields ) {
171
+					$blog_id = get_current_blog_id();
172
+		} elseif ( ! is_numeric( $fields ) ) {
173
+					$blog_id = get_id_from_blogname( $fields );
174
+		} else {
175
+					$blog_id = $fields;
176
+		}
172 177
 	}
173 178
 
174 179
 	$blog_id = (int) $blog_id;
@@ -305,15 +310,18 @@  discard block
 block discarded – undo
305 310
 function update_blog_details( $blog_id, $details = array() ) {
306 311
 	global $wpdb;
307 312
 
308
-	if ( empty($details) )
309
-		return false;
313
+	if ( empty($details) ) {
314
+			return false;
315
+	}
310 316
 
311
-	if ( is_object($details) )
312
-		$details = get_object_vars($details);
317
+	if ( is_object($details) ) {
318
+			$details = get_object_vars($details);
319
+	}
313 320
 
314 321
 	$current_details = get_site( $blog_id );
315
-	if ( empty($current_details) )
316
-		return false;
322
+	if ( empty($current_details) ) {
323
+			return false;
324
+	}
317 325
 
318 326
 	$current_details = get_object_vars($current_details);
319 327
 
@@ -332,8 +340,9 @@  discard block
 block discarded – undo
332 340
 
333 341
 	$result = $wpdb->update( $wpdb->blogs, $update_details, array('blog_id' => $blog_id) );
334 342
 
335
-	if ( false === $result )
336
-		return false;
343
+	if ( false === $result ) {
344
+			return false;
345
+	}
337 346
 
338 347
 	// If spam status changed, issue actions.
339 348
 	if ( $details['spam'] != $current_details['spam'] ) {
@@ -629,11 +638,13 @@  discard block
 block discarded – undo
629 638
 function get_blog_option( $id, $option, $default = false ) {
630 639
 	$id = (int) $id;
631 640
 
632
-	if ( empty( $id ) )
633
-		$id = get_current_blog_id();
641
+	if ( empty( $id ) ) {
642
+			$id = get_current_blog_id();
643
+	}
634 644
 
635
-	if ( get_current_blog_id() == $id )
636
-		return get_option( $option, $default );
645
+	if ( get_current_blog_id() == $id ) {
646
+			return get_option( $option, $default );
647
+	}
637 648
 
638 649
 	switch_to_blog( $id );
639 650
 	$value = get_option( $option, $default );
@@ -674,11 +685,13 @@  discard block
 block discarded – undo
674 685
 function add_blog_option( $id, $option, $value ) {
675 686
 	$id = (int) $id;
676 687
 
677
-	if ( empty( $id ) )
678
-		$id = get_current_blog_id();
688
+	if ( empty( $id ) ) {
689
+			$id = get_current_blog_id();
690
+	}
679 691
 
680
-	if ( get_current_blog_id() == $id )
681
-		return add_option( $option, $value );
692
+	if ( get_current_blog_id() == $id ) {
693
+			return add_option( $option, $value );
694
+	}
682 695
 
683 696
 	switch_to_blog( $id );
684 697
 	$return = add_option( $option, $value );
@@ -699,11 +712,13 @@  discard block
 block discarded – undo
699 712
 function delete_blog_option( $id, $option ) {
700 713
 	$id = (int) $id;
701 714
 
702
-	if ( empty( $id ) )
703
-		$id = get_current_blog_id();
715
+	if ( empty( $id ) ) {
716
+			$id = get_current_blog_id();
717
+	}
704 718
 
705
-	if ( get_current_blog_id() == $id )
706
-		return delete_option( $option );
719
+	if ( get_current_blog_id() == $id ) {
720
+			return delete_option( $option );
721
+	}
707 722
 
708 723
 	switch_to_blog( $id );
709 724
 	$return = delete_option( $option );
@@ -726,11 +741,13 @@  discard block
 block discarded – undo
726 741
 function update_blog_option( $id, $option, $value, $deprecated = null ) {
727 742
 	$id = (int) $id;
728 743
 
729
-	if ( null !== $deprecated  )
730
-		_deprecated_argument( __FUNCTION__, '3.1.0' );
744
+	if ( null !== $deprecated  ) {
745
+			_deprecated_argument( __FUNCTION__, '3.1.0' );
746
+	}
731 747
 
732
-	if ( get_current_blog_id() == $id )
733
-		return update_option( $option, $value );
748
+	if ( get_current_blog_id() == $id ) {
749
+			return update_option( $option, $value );
750
+	}
734 751
 
735 752
 	switch_to_blog( $id );
736 753
 	$return = update_option( $option, $value );
@@ -965,16 +982,19 @@  discard block
 block discarded – undo
965 982
 function update_blog_status( $blog_id, $pref, $value, $deprecated = null ) {
966 983
 	global $wpdb;
967 984
 
968
-	if ( null !== $deprecated  )
969
-		_deprecated_argument( __FUNCTION__, '3.1.0' );
985
+	if ( null !== $deprecated  ) {
986
+			_deprecated_argument( __FUNCTION__, '3.1.0' );
987
+	}
970 988
 
971
-	if ( ! in_array( $pref, array( 'site_id', 'domain', 'path', 'registered', 'last_updated', 'public', 'archived', 'mature', 'spam', 'deleted', 'lang_id') ) )
972
-		return $value;
989
+	if ( ! in_array( $pref, array( 'site_id', 'domain', 'path', 'registered', 'last_updated', 'public', 'archived', 'mature', 'spam', 'deleted', 'lang_id') ) ) {
990
+			return $value;
991
+	}
973 992
 
974 993
 	$result = $wpdb->update( $wpdb->blogs, array($pref => $value, 'last_updated' => current_time('mysql', true)), array('blog_id' => $blog_id) );
975 994
 
976
-	if ( false === $result )
977
-		return false;
995
+	if ( false === $result ) {
996
+			return false;
997
+	}
978 998
 
979 999
 	refresh_blog_details( $blog_id );
980 1000
 
@@ -1040,8 +1060,9 @@  discard block
 block discarded – undo
1040 1060
 	global $wpdb;
1041 1061
 
1042 1062
 	$details = get_site( $id );
1043
-	if ( $details )
1044
-		return $details->$pref;
1063
+	if ( $details ) {
1064
+			return $details->$pref;
1065
+	}
1045 1066
 
1046 1067
 	return $wpdb->get_var( $wpdb->prepare("SELECT %s FROM {$wpdb->blogs} WHERE blog_id = %d", $pref, $id) );
1047 1068
 }
@@ -1061,8 +1082,10 @@  discard block
 block discarded – undo
1061 1082
 function get_last_updated( $deprecated = '', $start = 0, $quantity = 40 ) {
1062 1083
 	global $wpdb;
1063 1084
 
1064
-	if ( ! empty( $deprecated ) )
1065
-		_deprecated_argument( __FUNCTION__, 'MU' ); // never used
1085
+	if ( ! empty( $deprecated ) ) {
1086
+			_deprecated_argument( __FUNCTION__, 'MU' );
1087
+	}
1088
+	// never used
1066 1089
 
1067 1090
 	return $wpdb->get_results( $wpdb->prepare("SELECT blog_id, domain, path FROM $wpdb->blogs WHERE site_id = %d AND public = '1' AND archived = '0' AND mature = '0' AND spam = '0' AND deleted = '0' AND last_updated != '0000-00-00 00:00:00' ORDER BY last_updated DESC limit %d, %d", $wpdb->siteid, $start, $quantity ) , ARRAY_A );
1068 1091
 }
Please login to merge, or discard this patch.
src/wp-includes/ms-load.php 4 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -65,7 +65,7 @@
 block discarded – undo
65 65
  *
66 66
  * @since 3.0.0
67 67
  *
68
- * @return true|string Returns true on success, or drop-in file to include.
68
+ * @return boolean|string Returns true on success, or drop-in file to include.
69 69
  */
70 70
 function ms_site_check() {
71 71
 	$blog = get_blog_details();
Please login to merge, or discard this patch.
Braces   +28 added lines, -20 removed lines patch added patch discarded remove patch
@@ -16,8 +16,9 @@  discard block
 block discarded – undo
16 16
  * @return bool True if subdomain configuration is enabled, false otherwise.
17 17
  */
18 18
 function is_subdomain_install() {
19
-	if ( defined('SUBDOMAIN_INSTALL') )
20
-		return SUBDOMAIN_INSTALL;
19
+	if ( defined('SUBDOMAIN_INSTALL') ) {
20
+			return SUBDOMAIN_INSTALL;
21
+	}
21 22
 
22 23
 	return ( defined( 'VHOST' ) && VHOST == 'yes' );
23 24
 }
@@ -35,8 +36,9 @@  discard block
 block discarded – undo
35 36
  */
36 37
 function wp_get_active_network_plugins() {
37 38
 	$active_plugins = (array) get_site_option( 'active_sitewide_plugins', array() );
38
-	if ( empty( $active_plugins ) )
39
-		return array();
39
+	if ( empty( $active_plugins ) ) {
40
+			return array();
41
+	}
40 42
 
41 43
 	$plugins = array();
42 44
 	$active_plugins = array_keys( $active_plugins );
@@ -46,8 +48,9 @@  discard block
 block discarded – undo
46 48
 		if ( ! validate_file( $plugin ) // $plugin must validate as file
47 49
 			&& '.php' == substr( $plugin, -4 ) // $plugin must end with '.php'
48 50
 			&& file_exists( WP_PLUGIN_DIR . '/' . $plugin ) // $plugin must exist
49
-			)
50
-		$plugins[] = WP_PLUGIN_DIR . '/' . $plugin;
51
+			) {
52
+				$plugins[] = WP_PLUGIN_DIR . '/' . $plugin;
53
+		}
51 54
 	}
52 55
 	return $plugins;
53 56
 }
@@ -78,18 +81,21 @@  discard block
 block discarded – undo
78 81
 	 * @param bool null Whether to skip the blog status check. Default null.
79 82
 	*/
80 83
 	$check = apply_filters( 'ms_site_check', null );
81
-	if ( null !== $check )
82
-		return true;
84
+	if ( null !== $check ) {
85
+			return true;
86
+	}
83 87
 
84 88
 	// Allow super admins to see blocked sites
85
-	if ( is_super_admin() )
86
-		return true;
89
+	if ( is_super_admin() ) {
90
+			return true;
91
+	}
87 92
 
88 93
 	if ( '1' == $blog->deleted ) {
89
-		if ( file_exists( WP_CONTENT_DIR . '/blog-deleted.php' ) )
90
-			return WP_CONTENT_DIR . '/blog-deleted.php';
91
-		else
92
-			wp_die( __( 'This site is no longer available.' ), '', array( 'response' => 410 ) );
94
+		if ( file_exists( WP_CONTENT_DIR . '/blog-deleted.php' ) ) {
95
+					return WP_CONTENT_DIR . '/blog-deleted.php';
96
+		} else {
97
+					wp_die( __( 'This site is no longer available.' ), '', array( 'response' => 410 ) );
98
+		}
93 99
 	}
94 100
 
95 101
 	if ( '2' == $blog->deleted ) {
@@ -107,10 +113,11 @@  discard block
 block discarded – undo
107 113
 	}
108 114
 
109 115
 	if ( $blog->archived == '1' || $blog->spam == '1' ) {
110
-		if ( file_exists( WP_CONTENT_DIR . '/blog-suspended.php' ) )
111
-			return WP_CONTENT_DIR . '/blog-suspended.php';
112
-		else
113
-			wp_die( __( 'This site has been archived or suspended.' ), '', array( 'response' => 410 ) );
116
+		if ( file_exists( WP_CONTENT_DIR . '/blog-suspended.php' ) ) {
117
+					return WP_CONTENT_DIR . '/blog-suspended.php';
118
+		} else {
119
+					wp_die( __( 'This site has been archived or suspended.' ), '', array( 'response' => 410 ) );
120
+		}
114 121
 	}
115 122
 
116 123
 	return true;
@@ -311,8 +318,9 @@  discard block
 block discarded – undo
311 318
 	);
312 319
 	$msg .= ' ' . __( 'If you&#8217;re still stuck with this message, then check that your database contains the following tables:' ) . '</p><ul>';
313 320
 	foreach ( $wpdb->tables('global') as $t => $table ) {
314
-		if ( 'sitecategories' == $t )
315
-			continue;
321
+		if ( 'sitecategories' == $t ) {
322
+					continue;
323
+		}
316 324
 		$msg .= '<li>' . $table . '</li>';
317 325
 	}
318 326
 	$msg .= '</ul>';
Please login to merge, or discard this patch.
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -75,7 +75,7 @@
 block discarded – undo
75 75
 	 * @since 3.0.0
76 76
 	 *
77 77
 	 * @param bool null Whether to skip the blog status check. Default null.
78
-	*/
78
+	 */
79 79
 	$check = apply_filters( 'ms_site_check', null );
80 80
 	if ( null !== $check )
81 81
 		return true;
Please login to merge, or discard this patch.
Spacing   +129 added lines, -129 removed lines patch added patch discarded remove patch
@@ -16,10 +16,10 @@  discard block
 block discarded – undo
16 16
  * @return bool True if subdomain configuration is enabled, false otherwise.
17 17
  */
18 18
 function is_subdomain_install() {
19
-	if ( defined('SUBDOMAIN_INSTALL') )
19
+	if (defined('SUBDOMAIN_INSTALL'))
20 20
 		return SUBDOMAIN_INSTALL;
21 21
 
22
-	return ( defined( 'VHOST' ) && VHOST == 'yes' );
22
+	return (defined('VHOST') && VHOST == 'yes');
23 23
 }
24 24
 
25 25
 /**
@@ -34,20 +34,20 @@  discard block
 block discarded – undo
34 34
  * @return array Files to include.
35 35
  */
36 36
 function wp_get_active_network_plugins() {
37
-	$active_plugins = (array) get_site_option( 'active_sitewide_plugins', array() );
38
-	if ( empty( $active_plugins ) )
37
+	$active_plugins = (array) get_site_option('active_sitewide_plugins', array());
38
+	if (empty($active_plugins))
39 39
 		return array();
40 40
 
41 41
 	$plugins = array();
42
-	$active_plugins = array_keys( $active_plugins );
43
-	sort( $active_plugins );
42
+	$active_plugins = array_keys($active_plugins);
43
+	sort($active_plugins);
44 44
 
45
-	foreach ( $active_plugins as $plugin ) {
46
-		if ( ! validate_file( $plugin ) // $plugin must validate as file
47
-			&& '.php' == substr( $plugin, -4 ) // $plugin must end with '.php'
48
-			&& file_exists( WP_PLUGIN_DIR . '/' . $plugin ) // $plugin must exist
45
+	foreach ($active_plugins as $plugin) {
46
+		if ( ! validate_file($plugin) // $plugin must validate as file
47
+			&& '.php' == substr($plugin, -4) // $plugin must end with '.php'
48
+			&& file_exists(WP_PLUGIN_DIR.'/'.$plugin) // $plugin must exist
49 49
 			)
50
-		$plugins[] = WP_PLUGIN_DIR . '/' . $plugin;
50
+		$plugins[] = WP_PLUGIN_DIR.'/'.$plugin;
51 51
 	}
52 52
 	return $plugins;
53 53
 }
@@ -76,42 +76,42 @@  discard block
 block discarded – undo
76 76
 	 *
77 77
 	 * @param bool null Whether to skip the blog status check. Default null.
78 78
 	*/
79
-	$check = apply_filters( 'ms_site_check', null );
80
-	if ( null !== $check )
79
+	$check = apply_filters('ms_site_check', null);
80
+	if (null !== $check)
81 81
 		return true;
82 82
 
83 83
 	// Allow super admins to see blocked sites
84
-	if ( is_super_admin() )
84
+	if (is_super_admin())
85 85
 		return true;
86 86
 
87 87
 	$blog = get_site();
88 88
 
89
-	if ( '1' == $blog->deleted ) {
90
-		if ( file_exists( WP_CONTENT_DIR . '/blog-deleted.php' ) )
91
-			return WP_CONTENT_DIR . '/blog-deleted.php';
89
+	if ('1' == $blog->deleted) {
90
+		if (file_exists(WP_CONTENT_DIR.'/blog-deleted.php'))
91
+			return WP_CONTENT_DIR.'/blog-deleted.php';
92 92
 		else
93
-			wp_die( __( 'This site is no longer available.' ), '', array( 'response' => 410 ) );
93
+			wp_die(__('This site is no longer available.'), '', array('response' => 410));
94 94
 	}
95 95
 
96
-	if ( '2' == $blog->deleted ) {
97
-		if ( file_exists( WP_CONTENT_DIR . '/blog-inactive.php' ) ) {
98
-			return WP_CONTENT_DIR . '/blog-inactive.php';
96
+	if ('2' == $blog->deleted) {
97
+		if (file_exists(WP_CONTENT_DIR.'/blog-inactive.php')) {
98
+			return WP_CONTENT_DIR.'/blog-inactive.php';
99 99
 		} else {
100
-			$admin_email = str_replace( '@', ' AT ', get_site_option( 'admin_email', 'support@' . get_network()->domain ) );
100
+			$admin_email = str_replace('@', ' AT ', get_site_option('admin_email', 'support@'.get_network()->domain));
101 101
 			wp_die(
102 102
 				/* translators: %s: admin email link */
103
-				sprintf( __( 'This site has not been activated yet. If you are having problems activating your site, please contact %s.' ),
104
-					sprintf( '<a href="mailto:%s">%s</a>', $admin_email )
103
+				sprintf(__('This site has not been activated yet. If you are having problems activating your site, please contact %s.'),
104
+					sprintf('<a href="mailto:%s">%s</a>', $admin_email)
105 105
 				)
106 106
 			);
107 107
 		}
108 108
 	}
109 109
 
110
-	if ( $blog->archived == '1' || $blog->spam == '1' ) {
111
-		if ( file_exists( WP_CONTENT_DIR . '/blog-suspended.php' ) )
112
-			return WP_CONTENT_DIR . '/blog-suspended.php';
110
+	if ($blog->archived == '1' || $blog->spam == '1') {
111
+		if (file_exists(WP_CONTENT_DIR.'/blog-suspended.php'))
112
+			return WP_CONTENT_DIR.'/blog-suspended.php';
113 113
 		else
114
-			wp_die( __( 'This site has been archived or suspended.' ), '', array( 'response' => 410 ) );
114
+			wp_die(__('This site has been archived or suspended.'), '', array('response' => 410));
115 115
 	}
116 116
 
117 117
 	return true;
@@ -129,8 +129,8 @@  discard block
 block discarded – undo
129 129
  * @param int|null $segments Path segments to use. Defaults to null, or the full path.
130 130
  * @return WP_Network|false Network object if successful. False when no network is found.
131 131
  */
132
-function get_network_by_path( $domain, $path, $segments = null ) {
133
-	return WP_Network::get_by_path( $domain, $path, $segments );
132
+function get_network_by_path($domain, $path, $segments = null) {
133
+	return WP_Network::get_by_path($domain, $path, $segments);
134 134
 }
135 135
 
136 136
 /**
@@ -153,8 +153,8 @@  discard block
 block discarded – undo
153 153
  * @param int|null $segments Path segments to use. Defaults to null, or the full path.
154 154
  * @return WP_Site|false Site object if successful. False when no site is found.
155 155
  */
156
-function get_site_by_path( $domain, $path, $segments = null ) {
157
-	$path_segments = array_filter( explode( '/', trim( $path, '/' ) ) );
156
+function get_site_by_path($domain, $path, $segments = null) {
157
+	$path_segments = array_filter(explode('/', trim($path, '/')));
158 158
 
159 159
 	/**
160 160
 	 * Filters the number of path segments to consider when searching for a site.
@@ -167,17 +167,17 @@  discard block
 block discarded – undo
167 167
 	 * @param string   $domain   The requested domain.
168 168
 	 * @param string   $path     The requested path, in full.
169 169
 	 */
170
-	$segments = apply_filters( 'site_by_path_segments_count', $segments, $domain, $path );
170
+	$segments = apply_filters('site_by_path_segments_count', $segments, $domain, $path);
171 171
 
172
-	if ( null !== $segments && count( $path_segments ) > $segments ) {
173
-		$path_segments = array_slice( $path_segments, 0, $segments );
172
+	if (null !== $segments && count($path_segments) > $segments) {
173
+		$path_segments = array_slice($path_segments, 0, $segments);
174 174
 	}
175 175
 
176 176
 	$paths = array();
177 177
 
178
-	while ( count( $path_segments ) ) {
179
-		$paths[] = '/' . implode( '/', $path_segments ) . '/';
180
-		array_pop( $path_segments );
178
+	while (count($path_segments)) {
179
+		$paths[] = '/'.implode('/', $path_segments).'/';
180
+		array_pop($path_segments);
181 181
 	}
182 182
 
183 183
 	$paths[] = '/';
@@ -201,10 +201,10 @@  discard block
 block discarded – undo
201 201
 	 *                                    Default null, meaning the entire path was to be consulted.
202 202
 	 * @param array             $paths    The paths to search for, based on $path and $segments.
203 203
 	 */
204
-	$pre = apply_filters( 'pre_get_site_by_path', null, $domain, $path, $segments, $paths );
205
-	if ( null !== $pre ) {
206
-		if ( false !== $pre && ! $pre instanceof WP_Site ) {
207
-			$pre = new WP_Site( $pre );
204
+	$pre = apply_filters('pre_get_site_by_path', null, $domain, $path, $segments, $paths);
205
+	if (null !== $pre) {
206
+		if (false !== $pre && ! $pre instanceof WP_Site) {
207
+			$pre = new WP_Site($pre);
208 208
 		}
209 209
 		return $pre;
210 210
 	}
@@ -220,9 +220,9 @@  discard block
 block discarded – undo
220 220
 
221 221
 	// Either www or non-www is supported, not both. If a www domain is requested,
222 222
 	// query for both to provide the proper redirect.
223
-	$domains = array( $domain );
224
-	if ( 'www.' === substr( $domain, 0, 4 ) ) {
225
-		$domains[] = substr( $domain, 4 );
223
+	$domains = array($domain);
224
+	if ('www.' === substr($domain, 0, 4)) {
225
+		$domains[] = substr($domain, 4);
226 226
 	}
227 227
 
228 228
 	$args = array(
@@ -231,18 +231,18 @@  discard block
 block discarded – undo
231 231
 		'number' => 1,
232 232
 	);
233 233
 
234
-	if ( count( $domains ) > 1 ) {
234
+	if (count($domains) > 1) {
235 235
 		$args['orderby']['domain_length'] = 'DESC';
236 236
 	}
237 237
 
238
-	if ( count( $paths ) > 1 ) {
238
+	if (count($paths) > 1) {
239 239
 		$args['orderby']['path_length'] = 'DESC';
240 240
 	}
241 241
 
242
-	$result = get_sites( $args );
243
-	$site = array_shift( $result );
242
+	$result = get_sites($args);
243
+	$site = array_shift($result);
244 244
 
245
-	if ( $site ) {
245
+	if ($site) {
246 246
 		return $site;
247 247
 	}
248 248
 
@@ -280,55 +280,55 @@  discard block
 block discarded – undo
280 280
  *                     False if bootstrap could not be properly completed.
281 281
  *                     Redirect URL if parts exist, but the request as a whole can not be fulfilled.
282 282
  */
283
-function ms_load_current_site_and_network( $domain, $path, $subdomain = false ) {
283
+function ms_load_current_site_and_network($domain, $path, $subdomain = false) {
284 284
 	global $wpdb, $current_site, $current_blog;
285 285
 
286 286
 	// If the network is defined in wp-config.php, we can simply use that.
287
-	if ( defined( 'DOMAIN_CURRENT_SITE' ) && defined( 'PATH_CURRENT_SITE' ) ) {
287
+	if (defined('DOMAIN_CURRENT_SITE') && defined('PATH_CURRENT_SITE')) {
288 288
 		$current_site = new stdClass;
289
-		$current_site->id = defined( 'SITE_ID_CURRENT_SITE' ) ? SITE_ID_CURRENT_SITE : 1;
289
+		$current_site->id = defined('SITE_ID_CURRENT_SITE') ? SITE_ID_CURRENT_SITE : 1;
290 290
 		$current_site->domain = DOMAIN_CURRENT_SITE;
291 291
 		$current_site->path = PATH_CURRENT_SITE;
292
-		if ( defined( 'BLOG_ID_CURRENT_SITE' ) ) {
292
+		if (defined('BLOG_ID_CURRENT_SITE')) {
293 293
 			$current_site->blog_id = BLOG_ID_CURRENT_SITE;
294
-		} elseif ( defined( 'BLOGID_CURRENT_SITE' ) ) { // deprecated.
294
+		} elseif (defined('BLOGID_CURRENT_SITE')) { // deprecated.
295 295
 			$current_site->blog_id = BLOGID_CURRENT_SITE;
296 296
 		}
297 297
 
298
-		if ( 0 === strcasecmp( $current_site->domain, $domain ) && 0 === strcasecmp( $current_site->path, $path ) ) {
299
-			$current_blog = get_site_by_path( $domain, $path );
300
-		} elseif ( '/' !== $current_site->path && 0 === strcasecmp( $current_site->domain, $domain ) && 0 === stripos( $path, $current_site->path ) ) {
298
+		if (0 === strcasecmp($current_site->domain, $domain) && 0 === strcasecmp($current_site->path, $path)) {
299
+			$current_blog = get_site_by_path($domain, $path);
300
+		} elseif ('/' !== $current_site->path && 0 === strcasecmp($current_site->domain, $domain) && 0 === stripos($path, $current_site->path)) {
301 301
 			// If the current network has a path and also matches the domain and path of the request,
302 302
 			// we need to look for a site using the first path segment following the network's path.
303
-			$current_blog = get_site_by_path( $domain, $path, 1 + count( explode( '/', trim( $current_site->path, '/' ) ) ) );
303
+			$current_blog = get_site_by_path($domain, $path, 1 + count(explode('/', trim($current_site->path, '/'))));
304 304
 		} else {
305 305
 			// Otherwise, use the first path segment (as usual).
306
-			$current_blog = get_site_by_path( $domain, $path, 1 );
306
+			$current_blog = get_site_by_path($domain, $path, 1);
307 307
 		}
308 308
 
309
-	} elseif ( ! $subdomain ) {
309
+	} elseif ( ! $subdomain) {
310 310
 		/*
311 311
 		 * A "subdomain" install can be re-interpreted to mean "can support any domain".
312 312
 		 * If we're not dealing with one of these installs, then the important part is determining
313 313
 		 * the network first, because we need the network's path to identify any sites.
314 314
 		 */
315
-		if ( ! $current_site = wp_cache_get( 'current_network', 'site-options' ) ) {
315
+		if ( ! $current_site = wp_cache_get('current_network', 'site-options')) {
316 316
 			// Are there even two networks installed?
317
-			$one_network = $wpdb->get_row( "SELECT * FROM $wpdb->site LIMIT 2" ); // [sic]
318
-			if ( 1 === $wpdb->num_rows ) {
319
-				$current_site = new WP_Network( $one_network );
320
-				wp_cache_add( 'current_network', $current_site, 'site-options' );
321
-			} elseif ( 0 === $wpdb->num_rows ) {
317
+			$one_network = $wpdb->get_row("SELECT * FROM $wpdb->site LIMIT 2"); // [sic]
318
+			if (1 === $wpdb->num_rows) {
319
+				$current_site = new WP_Network($one_network);
320
+				wp_cache_add('current_network', $current_site, 'site-options');
321
+			} elseif (0 === $wpdb->num_rows) {
322 322
 				// A network not found hook should fire here.
323 323
 				return false;
324 324
 			}
325 325
 		}
326 326
 
327
-		if ( empty( $current_site ) ) {
328
-			$current_site = WP_Network::get_by_path( $domain, $path, 1 );
327
+		if (empty($current_site)) {
328
+			$current_site = WP_Network::get_by_path($domain, $path, 1);
329 329
 		}
330 330
 
331
-		if ( empty( $current_site ) ) {
331
+		if (empty($current_site)) {
332 332
 			/**
333 333
 			 * Fires when a network cannot be found based on the requested domain and path.
334 334
 			 *
@@ -340,48 +340,48 @@  discard block
 block discarded – undo
340 340
 			 * @param string $domain       The domain used to search for a network.
341 341
 			 * @param string $path         The path used to search for a path.
342 342
 			 */
343
-			do_action( 'ms_network_not_found', $domain, $path );
343
+			do_action('ms_network_not_found', $domain, $path);
344 344
 
345 345
 			return false;
346
-		} elseif ( $path === $current_site->path ) {
347
-			$current_blog = get_site_by_path( $domain, $path );
346
+		} elseif ($path === $current_site->path) {
347
+			$current_blog = get_site_by_path($domain, $path);
348 348
 		} else {
349 349
 			// Search the network path + one more path segment (on top of the network path).
350
-			$current_blog = get_site_by_path( $domain, $path, substr_count( $current_site->path, '/' ) );
350
+			$current_blog = get_site_by_path($domain, $path, substr_count($current_site->path, '/'));
351 351
 		}
352 352
 	} else {
353 353
 		// Find the site by the domain and at most the first path segment.
354
-		$current_blog = get_site_by_path( $domain, $path, 1 );
355
-		if ( $current_blog ) {
356
-			$current_site = WP_Network::get_instance( $current_blog->site_id ? $current_blog->site_id : 1 );
354
+		$current_blog = get_site_by_path($domain, $path, 1);
355
+		if ($current_blog) {
356
+			$current_site = WP_Network::get_instance($current_blog->site_id ? $current_blog->site_id : 1);
357 357
 		} else {
358 358
 			// If you don't have a site with the same domain/path as a network, you're pretty screwed, but:
359
-			$current_site = WP_Network::get_by_path( $domain, $path, 1 );
359
+			$current_site = WP_Network::get_by_path($domain, $path, 1);
360 360
 		}
361 361
 	}
362 362
 
363 363
 	// The network declared by the site trumps any constants.
364
-	if ( $current_blog && $current_blog->site_id != $current_site->id ) {
365
-		$current_site = WP_Network::get_instance( $current_blog->site_id );
364
+	if ($current_blog && $current_blog->site_id != $current_site->id) {
365
+		$current_site = WP_Network::get_instance($current_blog->site_id);
366 366
 	}
367 367
 
368 368
 	// No network has been found, bail.
369
-	if ( empty( $current_site ) ) {
369
+	if (empty($current_site)) {
370 370
 		/** This action is documented in wp-includes/ms-settings.php */
371
-		do_action( 'ms_network_not_found', $domain, $path );
371
+		do_action('ms_network_not_found', $domain, $path);
372 372
 
373 373
 		return false;
374 374
 	}
375 375
 
376 376
 	// During activation of a new subdomain, the requested site does not yet exist.
377
-	if ( empty( $current_blog ) && wp_installing() ) {
377
+	if (empty($current_blog) && wp_installing()) {
378 378
 		$current_blog = new stdClass;
379 379
 		$current_blog->blog_id = $blog_id = 1;
380 380
 		$current_blog->public = 1;
381 381
 	}
382 382
 
383 383
 	// No site has been found, bail.
384
-	if ( empty( $current_blog ) ) {
384
+	if (empty($current_blog)) {
385 385
 		// We're going to redirect to the network URL, with some possible modifications.
386 386
 		$scheme = is_ssl() ? 'https' : 'http';
387 387
 		$destination = "$scheme://{$current_site->domain}{$current_site->path}";
@@ -398,19 +398,19 @@  discard block
 block discarded – undo
398 398
 		 * @param string $domain       The domain used to search for a site.
399 399
 		 * @param string $path         The path used to search for a site.
400 400
 		 */
401
-		do_action( 'ms_site_not_found', $current_site, $domain, $path );
401
+		do_action('ms_site_not_found', $current_site, $domain, $path);
402 402
 
403
-		if ( $subdomain && ! defined( 'NOBLOGREDIRECT' ) ) {
403
+		if ($subdomain && ! defined('NOBLOGREDIRECT')) {
404 404
 			// For a "subdomain" install, redirect to the signup form specifically.
405
-			$destination .= 'wp-signup.php?new=' . str_replace( '.' . $current_site->domain, '', $domain );
406
-		} elseif ( $subdomain ) {
405
+			$destination .= 'wp-signup.php?new='.str_replace('.'.$current_site->domain, '', $domain);
406
+		} elseif ($subdomain) {
407 407
 			// For a "subdomain" install, the NOBLOGREDIRECT constant
408 408
 			// can be used to avoid a redirect to the signup form.
409 409
 			// Using the ms_site_not_found action is preferred to the constant.
410
-			if ( '%siteurl%' !== NOBLOGREDIRECT ) {
410
+			if ('%siteurl%' !== NOBLOGREDIRECT) {
411 411
 				$destination = NOBLOGREDIRECT;
412 412
 			}
413
-		} elseif ( 0 === strcasecmp( $current_site->domain, $domain ) ) {
413
+		} elseif (0 === strcasecmp($current_site->domain, $domain)) {
414 414
 			/*
415 415
 			 * If the domain we were searching for matches the network's domain,
416 416
 			 * it's no use redirecting back to ourselves -- it'll cause a loop.
@@ -423,13 +423,13 @@  discard block
 block discarded – undo
423 423
 	}
424 424
 
425 425
 	// Figure out the current network's main site.
426
-	if ( empty( $current_site->blog_id ) ) {
427
-		if ( $current_blog->domain === $current_site->domain && $current_blog->path === $current_site->path ) {
426
+	if (empty($current_site->blog_id)) {
427
+		if ($current_blog->domain === $current_site->domain && $current_blog->path === $current_site->path) {
428 428
 			$current_site->blog_id = $current_blog->blog_id;
429
-		} elseif ( ! $current_site->blog_id = wp_cache_get( 'network:' . $current_site->id . ':main_site', 'site-options' ) ) {
430
-			$current_site->blog_id = $wpdb->get_var( $wpdb->prepare( "SELECT blog_id FROM $wpdb->blogs WHERE domain = %s AND path = %s",
431
-				$current_site->domain, $current_site->path ) );
432
-			wp_cache_add( 'network:' . $current_site->id . ':main_site', $current_site->blog_id, 'site-options' );
429
+		} elseif ( ! $current_site->blog_id = wp_cache_get('network:'.$current_site->id.':main_site', 'site-options')) {
430
+			$current_site->blog_id = $wpdb->get_var($wpdb->prepare("SELECT blog_id FROM $wpdb->blogs WHERE domain = %s AND path = %s",
431
+				$current_site->domain, $current_site->path));
432
+			wp_cache_add('network:'.$current_site->id.':main_site', $current_site->blog_id, 'site-options');
433 433
 		}
434 434
 	}
435 435
 
@@ -450,50 +450,50 @@  discard block
 block discarded – undo
450 450
  * @param string $domain The requested domain for the error to reference.
451 451
  * @param string $path   The requested path for the error to reference.
452 452
  */
453
-function ms_not_installed( $domain, $path ) {
453
+function ms_not_installed($domain, $path) {
454 454
 	global $wpdb;
455 455
 
456
-	if ( ! is_admin() ) {
456
+	if ( ! is_admin()) {
457 457
 		dead_db();
458 458
 	}
459 459
 
460 460
 	wp_load_translations_early();
461 461
 
462
-	$title = __( 'Error establishing a database connection' );
462
+	$title = __('Error establishing a database connection');
463 463
 
464
-	$msg  = '<h1>' . $title . '</h1>';
465
-	$msg .= '<p>' . __( 'If your site does not display, please contact the owner of this network.' ) . '';
466
-	$msg .= ' ' . __( 'If you are the owner of this network please check that MySQL is running properly and all tables are error free.' ) . '</p>';
467
-	$query = $wpdb->prepare( "SHOW TABLES LIKE %s", $wpdb->esc_like( $wpdb->site ) );
468
-	if ( ! $wpdb->get_var( $query ) ) {
469
-		$msg .= '<p>' . sprintf(
464
+	$msg  = '<h1>'.$title.'</h1>';
465
+	$msg .= '<p>'.__('If your site does not display, please contact the owner of this network.').'';
466
+	$msg .= ' '.__('If you are the owner of this network please check that MySQL is running properly and all tables are error free.').'</p>';
467
+	$query = $wpdb->prepare("SHOW TABLES LIKE %s", $wpdb->esc_like($wpdb->site));
468
+	if ( ! $wpdb->get_var($query)) {
469
+		$msg .= '<p>'.sprintf(
470 470
 			/* translators: %s: table name */
471
-			__( '<strong>Database tables are missing.</strong> This means that MySQL is not running, WordPress was not installed properly, or someone deleted %s. You really should look at your database now.' ),
472
-			'<code>' . $wpdb->site . '</code>'
473
-		) . '</p>';
471
+			__('<strong>Database tables are missing.</strong> This means that MySQL is not running, WordPress was not installed properly, or someone deleted %s. You really should look at your database now.'),
472
+			'<code>'.$wpdb->site.'</code>'
473
+		).'</p>';
474 474
 	} else {
475
-		$msg .= '<p>' . sprintf(
475
+		$msg .= '<p>'.sprintf(
476 476
 			/* translators: 1: site url, 2: table name, 3: database name */
477
-			__( '<strong>Could not find site %1$s.</strong> Searched for table %2$s in database %3$s. Is that right?' ),
478
-			'<code>' . rtrim( $domain . $path, '/' ) . '</code>',
479
-			'<code>' . $wpdb->blogs . '</code>',
480
-			'<code>' . DB_NAME . '</code>'
481
-		) . '</p>';
477
+			__('<strong>Could not find site %1$s.</strong> Searched for table %2$s in database %3$s. Is that right?'),
478
+			'<code>'.rtrim($domain.$path, '/').'</code>',
479
+			'<code>'.$wpdb->blogs.'</code>',
480
+			'<code>'.DB_NAME.'</code>'
481
+		).'</p>';
482 482
 	}
483
-	$msg .= '<p><strong>' . __( 'What do I do now?' ) . '</strong> ';
483
+	$msg .= '<p><strong>'.__('What do I do now?').'</strong> ';
484 484
 	/* translators: %s: Codex URL */
485
-	$msg .= sprintf( __( 'Read the <a href="%s" target="_blank">bug report</a> page. Some of the guidelines there may help you figure out what went wrong.' ),
486
-		__( 'https://codex.wordpress.org/Debugging_a_WordPress_Network' )
485
+	$msg .= sprintf(__('Read the <a href="%s" target="_blank">bug report</a> page. Some of the guidelines there may help you figure out what went wrong.'),
486
+		__('https://codex.wordpress.org/Debugging_a_WordPress_Network')
487 487
 	);
488
-	$msg .= ' ' . __( 'If you&#8217;re still stuck with this message, then check that your database contains the following tables:' ) . '</p><ul>';
489
-	foreach ( $wpdb->tables('global') as $t => $table ) {
490
-		if ( 'sitecategories' == $t )
488
+	$msg .= ' '.__('If you&#8217;re still stuck with this message, then check that your database contains the following tables:').'</p><ul>';
489
+	foreach ($wpdb->tables('global') as $t => $table) {
490
+		if ('sitecategories' == $t)
491 491
 			continue;
492
-		$msg .= '<li>' . $table . '</li>';
492
+		$msg .= '<li>'.$table.'</li>';
493 493
 	}
494 494
 	$msg .= '</ul>';
495 495
 
496
-	wp_die( $msg, $title, array( 'response' => 500 ) );
496
+	wp_die($msg, $title, array('response' => 500));
497 497
 }
498 498
 
499 499
 /**
@@ -509,8 +509,8 @@  discard block
 block discarded – undo
509 509
  * @param object $current_site
510 510
  * @return object
511 511
  */
512
-function get_current_site_name( $current_site ) {
513
-	_deprecated_function( __FUNCTION__, '3.9.0', 'get_current_site()' );
512
+function get_current_site_name($current_site) {
513
+	_deprecated_function(__FUNCTION__, '3.9.0', 'get_current_site()');
514 514
 	return $current_site;
515 515
 }
516 516
 
@@ -530,7 +530,7 @@  discard block
 block discarded – undo
530 530
  */
531 531
 function wpmu_current_site() {
532 532
 	global $current_site;
533
-	_deprecated_function( __FUNCTION__, '3.9.0' );
533
+	_deprecated_function(__FUNCTION__, '3.9.0');
534 534
 	return $current_site;
535 535
 }
536 536
 
@@ -546,11 +546,11 @@  discard block
 block discarded – undo
546 546
  * @param object|int $network The network's database row or ID.
547 547
  * @return WP_Network|false Object containing network information if found, false if not.
548 548
  */
549
-function wp_get_network( $network ) {
550
-	_deprecated_function( __FUNCTION__, '4.7.0', 'get_network()' );
549
+function wp_get_network($network) {
550
+	_deprecated_function(__FUNCTION__, '4.7.0', 'get_network()');
551 551
 
552
-	$network = get_network( $network );
553
-	if ( null === $network ) {
552
+	$network = get_network($network);
553
+	if (null === $network) {
554 554
 		return false;
555 555
 	}
556 556
 
Please login to merge, or discard this patch.