Completed
Push — master ( cde0c6...d99bf9 )
by Stephen
15:46
created
src/wp-includes/compat.php 4 patches
Braces   +15 added lines, -10 removed lines patch added patch discarded remove patch
@@ -161,13 +161,15 @@  discard block
 block discarded – undo
161 161
 function _hash_hmac($algo, $data, $key, $raw_output = false) {
162 162
 	$packs = array('md5' => 'H32', 'sha1' => 'H40');
163 163
 
164
-	if ( !isset($packs[$algo]) )
165
-		return false;
164
+	if ( !isset($packs[$algo]) ) {
165
+			return false;
166
+	}
166 167
 
167 168
 	$pack = $packs[$algo];
168 169
 
169
-	if (strlen($key) > 64)
170
-		$key = pack($pack, $algo($key));
170
+	if (strlen($key) > 64) {
171
+			$key = pack($pack, $algo($key));
172
+	}
171 173
 
172 174
 	$key = str_pad($key, 64, chr(0));
173 175
 
@@ -176,8 +178,9 @@  discard block
 block discarded – undo
176 178
 
177 179
 	$hmac = $algo($opad . pack($pack, $algo($ipad . $data)));
178 180
 
179
-	if ( $raw_output )
180
-		return pack( $pack, $hmac );
181
+	if ( $raw_output ) {
182
+			return pack( $pack, $hmac );
183
+	}
181 184
 	return $hmac;
182 185
 }
183 186
 
@@ -210,8 +213,9 @@  discard block
 block discarded – undo
210 213
 		}
211 214
 
212 215
 		$res = $wp_json->decode( $string );
213
-		if ( $assoc_array )
214
-			$res = _json_decode_object_helper( $res );
216
+		if ( $assoc_array ) {
217
+					$res = _json_decode_object_helper( $res );
218
+		}
215 219
 		return $res;
216 220
 	}
217 221
 
@@ -220,8 +224,9 @@  discard block
 block discarded – undo
220 224
 	 * @return array
221 225
 	 */
222 226
 	function _json_decode_object_helper($data) {
223
-		if ( is_object($data) )
224
-			$data = get_object_vars($data);
227
+		if ( is_object($data) ) {
228
+					$data = get_object_vars($data);
229
+		}
225 230
 		return is_array($data) ? array_map(__FUNCTION__, $data) : $data;
226 231
 	}
227 232
 }
Please login to merge, or discard this patch.
Doc Comments   +5 added lines, -1 removed lines patch added patch discarded remove patch
@@ -8,6 +8,10 @@  discard block
 block discarded – undo
8 8
 
9 9
 // If gettext isn't available
10 10
 if ( !function_exists('_') ) {
11
+
12
+	/**
13
+	 * @param string $string
14
+	 */
11 15
 	function _($string) {
12 16
 		return $string;
13 17
 	}
@@ -366,7 +370,7 @@  discard block
 block discarded – undo
366 370
 	 *
367 371
 	 * @internal This is a compatibility function for PHP <5.5
368 372
 	 *
369
-	 * @return bool|string Returns the error message on success, "No Error" if no error has occurred,
373
+	 * @return false|string Returns the error message on success, "No Error" if no error has occurred,
370 374
 	 *                     or false on failure.
371 375
 	 */
372 376
 	function json_last_error_msg() {
Please login to merge, or discard this patch.
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -472,8 +472,8 @@
 block discarded – undo
472 472
 
473 473
 				foreach ( array_keys( $head ) as $key ) {
474 474
 					if ( isset( $key, $bref ) &&
475
-					     isset( $bref[ $key ] ) && is_array( $bref[ $key ] ) &&
476
-					     isset( $head[ $key ] ) && is_array( $head[ $key ] )
475
+						 isset( $bref[ $key ] ) && is_array( $bref[ $key ] ) &&
476
+						 isset( $head[ $key ] ) && is_array( $head[ $key ] )
477 477
 					) {
478 478
 						$bref_stack[] = &$bref[ $key ];
479 479
 						$head_stack[] = $head[ $key ];
Please login to merge, or discard this patch.
Spacing   +112 added lines, -112 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@  discard block
 block discarded – undo
7 7
  */
8 8
 
9 9
 // If gettext isn't available
10
-if ( !function_exists('_') ) {
10
+if ( ! function_exists('_')) {
11 11
 	function _($string) {
12 12
 		return $string;
13 13
 	}
@@ -27,21 +27,21 @@  discard block
 block discarded – undo
27 27
  *             false  : Used for testing - return false for future calls to this function
28 28
  *             'reset': Used for testing - restore default behavior of this function
29 29
  */
30
-function _wp_can_use_pcre_u( $set = null ) {
30
+function _wp_can_use_pcre_u($set = null) {
31 31
 	static $utf8_pcre = 'reset';
32 32
 
33
-	if ( null !== $set ) {
33
+	if (null !== $set) {
34 34
 		$utf8_pcre = $set;
35 35
 	}
36 36
 
37
-	if ( 'reset' === $utf8_pcre ) {
38
-		$utf8_pcre = @preg_match( '/^./u', 'a' );
37
+	if ('reset' === $utf8_pcre) {
38
+		$utf8_pcre = @preg_match('/^./u', 'a');
39 39
 	}
40 40
 
41 41
 	return $utf8_pcre;
42 42
 }
43 43
 
44
-if ( ! function_exists( 'mb_substr' ) ) :
44
+if ( ! function_exists('mb_substr')) :
45 45
 	/**
46 46
 	 * Compat function to mimic mb_substr().
47 47
 	 *
@@ -57,8 +57,8 @@  discard block
 block discarded – undo
57 57
 	 * @param string|null $encoding Optional. Character encoding to use. Default null.
58 58
 	 * @return string Extracted substring.
59 59
 	 */
60
-	function mb_substr( $str, $start, $length = null, $encoding = null ) {
61
-		return _mb_substr( $str, $start, $length, $encoding );
60
+	function mb_substr($str, $start, $length = null, $encoding = null) {
61
+		return _mb_substr($str, $start, $length, $encoding);
62 62
 	}
63 63
 endif;
64 64
 
@@ -79,24 +79,24 @@  discard block
 block discarded – undo
79 79
  * @param string|null $encoding Optional. Character encoding to use. Default null.
80 80
  * @return string Extracted substring.
81 81
  */
82
-function _mb_substr( $str, $start, $length = null, $encoding = null ) {
83
-	if ( null === $encoding ) {
84
-		$encoding = get_option( 'blog_charset' );
82
+function _mb_substr($str, $start, $length = null, $encoding = null) {
83
+	if (null === $encoding) {
84
+		$encoding = get_option('blog_charset');
85 85
 	}
86 86
 
87 87
 	/*
88 88
 	 * The solution below works only for UTF-8, so in case of a different
89 89
 	 * charset just use built-in substr().
90 90
 	 */
91
-	if ( ! in_array( $encoding, array( 'utf8', 'utf-8', 'UTF8', 'UTF-8' ) ) ) {
92
-		return is_null( $length ) ? substr( $str, $start ) : substr( $str, $start, $length );
91
+	if ( ! in_array($encoding, array('utf8', 'utf-8', 'UTF8', 'UTF-8'))) {
92
+		return is_null($length) ? substr($str, $start) : substr($str, $start, $length);
93 93
 	}
94 94
 
95
-	if ( _wp_can_use_pcre_u() ) {
95
+	if (_wp_can_use_pcre_u()) {
96 96
 		// Use the regex unicode support to separate the UTF-8 characters into an array.
97
-		preg_match_all( '/./us', $str, $match );
98
-		$chars = is_null( $length ) ? array_slice( $match[0], $start ) : array_slice( $match[0], $start, $length );
99
-		return implode( '', $chars );
97
+		preg_match_all('/./us', $str, $match);
98
+		$chars = is_null($length) ? array_slice($match[0], $start) : array_slice($match[0], $start, $length);
99
+		return implode('', $chars);
100 100
 	}
101 101
 
102 102
 	$regex = '/(
@@ -112,26 +112,26 @@  discard block
 block discarded – undo
112 112
 	)/x';
113 113
 
114 114
 	// Start with 1 element instead of 0 since the first thing we do is pop.
115
-	$chars = array( '' );
115
+	$chars = array('');
116 116
 	do {
117 117
 		// We had some string left over from the last round, but we counted it in that last round.
118
-		array_pop( $chars );
118
+		array_pop($chars);
119 119
 
120 120
 		/*
121 121
 		 * Split by UTF-8 character, limit to 1000 characters (last array element will contain
122 122
 		 * the rest of the string).
123 123
 		 */
124
-		$pieces = preg_split( $regex, $str, 1000, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY );
124
+		$pieces = preg_split($regex, $str, 1000, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY);
125 125
 
126
-		$chars = array_merge( $chars, $pieces );
126
+		$chars = array_merge($chars, $pieces);
127 127
 
128 128
 	// If there's anything left over, repeat the loop.
129
-	} while ( count( $pieces ) > 1 && $str = array_pop( $pieces ) );
129
+	} while (count($pieces) > 1 && $str = array_pop($pieces));
130 130
 
131
-	return join( '', array_slice( $chars, $start, $length ) );
131
+	return join('', array_slice($chars, $start, $length));
132 132
 }
133 133
 
134
-if ( ! function_exists( 'mb_strlen' ) ) :
134
+if ( ! function_exists('mb_strlen')) :
135 135
 	/**
136 136
 	 * Compat function to mimic mb_strlen().
137 137
 	 *
@@ -144,8 +144,8 @@  discard block
 block discarded – undo
144 144
 	 * @param string|null $encoding Optional. Character encoding to use. Default null.
145 145
 	 * @return int String length of `$str`.
146 146
 	 */
147
-	function mb_strlen( $str, $encoding = null ) {
148
-		return _mb_strlen( $str, $encoding );
147
+	function mb_strlen($str, $encoding = null) {
148
+		return _mb_strlen($str, $encoding);
149 149
 	}
150 150
 endif;
151 151
 
@@ -163,23 +163,23 @@  discard block
 block discarded – undo
163 163
  * @param string|null $encoding Optional. Character encoding to use. Default null.
164 164
  * @return int String length of `$str`.
165 165
  */
166
-function _mb_strlen( $str, $encoding = null ) {
167
-	if ( null === $encoding ) {
168
-		$encoding = get_option( 'blog_charset' );
166
+function _mb_strlen($str, $encoding = null) {
167
+	if (null === $encoding) {
168
+		$encoding = get_option('blog_charset');
169 169
 	}
170 170
 
171 171
 	/*
172 172
 	 * The solution below works only for UTF-8, so in case of a different charset
173 173
 	 * just use built-in strlen().
174 174
 	 */
175
-	if ( ! in_array( $encoding, array( 'utf8', 'utf-8', 'UTF8', 'UTF-8' ) ) ) {
176
-		return strlen( $str );
175
+	if ( ! in_array($encoding, array('utf8', 'utf-8', 'UTF8', 'UTF-8'))) {
176
+		return strlen($str);
177 177
 	}
178 178
 
179
-	if ( _wp_can_use_pcre_u() ) {
179
+	if (_wp_can_use_pcre_u()) {
180 180
 		// Use the regex unicode support to separate the UTF-8 characters into an array.
181
-		preg_match_all( '/./us', $str, $match );
182
-		return count( $match[0] );
181
+		preg_match_all('/./us', $str, $match);
182
+		return count($match[0]);
183 183
 	}
184 184
 
185 185
 	$regex = '/(?:
@@ -204,19 +204,19 @@  discard block
 block discarded – undo
204 204
 		 * Split by UTF-8 character, limit to 1000 characters (last array element will contain
205 205
 		 * the rest of the string).
206 206
 		 */
207
-		$pieces = preg_split( $regex, $str, 1000 );
207
+		$pieces = preg_split($regex, $str, 1000);
208 208
 
209 209
 		// Increment.
210
-		$count += count( $pieces );
210
+		$count += count($pieces);
211 211
 
212 212
 	// If there's anything left over, repeat the loop.
213
-	} while ( $str = array_pop( $pieces ) );
213
+	} while ($str = array_pop($pieces));
214 214
 
215 215
 	// Fencepost: preg_split() always returns one extra item in the array.
216 216
 	return --$count;
217 217
 }
218 218
 
219
-if ( !function_exists('hash_hmac') ):
219
+if ( ! function_exists('hash_hmac')):
220 220
 /**
221 221
  * Compat function to mimic hash_hmac().
222 222
  *
@@ -255,7 +255,7 @@  discard block
 block discarded – undo
255 255
 function _hash_hmac($algo, $data, $key, $raw_output = false) {
256 256
 	$packs = array('md5' => 'H32', 'sha1' => 'H40');
257 257
 
258
-	if ( !isset($packs[$algo]) )
258
+	if ( ! isset($packs[$algo]))
259 259
 		return false;
260 260
 
261 261
 	$pack = $packs[$algo];
@@ -268,44 +268,44 @@  discard block
 block discarded – undo
268 268
 	$ipad = (substr($key, 0, 64) ^ str_repeat(chr(0x36), 64));
269 269
 	$opad = (substr($key, 0, 64) ^ str_repeat(chr(0x5C), 64));
270 270
 
271
-	$hmac = $algo($opad . pack($pack, $algo($ipad . $data)));
271
+	$hmac = $algo($opad.pack($pack, $algo($ipad.$data)));
272 272
 
273
-	if ( $raw_output )
274
-		return pack( $pack, $hmac );
273
+	if ($raw_output)
274
+		return pack($pack, $hmac);
275 275
 	return $hmac;
276 276
 }
277 277
 
278
-if ( !function_exists('json_encode') ) {
279
-	function json_encode( $string ) {
278
+if ( ! function_exists('json_encode')) {
279
+	function json_encode($string) {
280 280
 		global $wp_json;
281 281
 
282
-		if ( ! ( $wp_json instanceof Services_JSON ) ) {
283
-			require_once( ABSPATH . WPINC . '/class-json.php' );
282
+		if ( ! ($wp_json instanceof Services_JSON)) {
283
+			require_once(ABSPATH.WPINC.'/class-json.php');
284 284
 			$wp_json = new Services_JSON();
285 285
 		}
286 286
 
287
-		return $wp_json->encodeUnsafe( $string );
287
+		return $wp_json->encodeUnsafe($string);
288 288
 	}
289 289
 }
290 290
 
291
-if ( !function_exists('json_decode') ) {
291
+if ( ! function_exists('json_decode')) {
292 292
 	/**
293 293
 	 * @global Services_JSON $wp_json
294 294
 	 * @param string $string
295 295
 	 * @param bool   $assoc_array
296 296
 	 * @return object|array
297 297
 	 */
298
-	function json_decode( $string, $assoc_array = false ) {
298
+	function json_decode($string, $assoc_array = false) {
299 299
 		global $wp_json;
300 300
 
301
-		if ( ! ($wp_json instanceof Services_JSON ) ) {
302
-			require_once( ABSPATH . WPINC . '/class-json.php' );
301
+		if ( ! ($wp_json instanceof Services_JSON)) {
302
+			require_once(ABSPATH.WPINC.'/class-json.php');
303 303
 			$wp_json = new Services_JSON();
304 304
 		}
305 305
 
306
-		$res = $wp_json->decode( $string );
307
-		if ( $assoc_array )
308
-			$res = _json_decode_object_helper( $res );
306
+		$res = $wp_json->decode($string);
307
+		if ($assoc_array)
308
+			$res = _json_decode_object_helper($res);
309 309
 		return $res;
310 310
 	}
311 311
 
@@ -314,13 +314,13 @@  discard block
 block discarded – undo
314 314
 	 * @return array
315 315
 	 */
316 316
 	function _json_decode_object_helper($data) {
317
-		if ( is_object($data) )
317
+		if (is_object($data))
318 318
 			$data = get_object_vars($data);
319 319
 		return is_array($data) ? array_map(__FUNCTION__, $data) : $data;
320 320
 	}
321 321
 }
322 322
 
323
-if ( ! function_exists( 'hash_equals' ) ) :
323
+if ( ! function_exists('hash_equals')) :
324 324
 /**
325 325
  * Timing attack safe string comparison
326 326
  *
@@ -336,16 +336,16 @@  discard block
 block discarded – undo
336 336
  * @param string $b Actual, user supplied, string.
337 337
  * @return bool Whether strings are equal.
338 338
  */
339
-function hash_equals( $a, $b ) {
340
-	$a_length = strlen( $a );
341
-	if ( $a_length !== strlen( $b ) ) {
339
+function hash_equals($a, $b) {
340
+	$a_length = strlen($a);
341
+	if ($a_length !== strlen($b)) {
342 342
 		return false;
343 343
 	}
344 344
 	$result = 0;
345 345
 
346 346
 	// Do not attempt to "optimize" this.
347
-	for ( $i = 0; $i < $a_length; $i++ ) {
348
-		$result |= ord( $a[ $i ] ) ^ ord( $b[ $i ] );
347
+	for ($i = 0; $i < $a_length; $i++) {
348
+		$result |= ord($a[$i]) ^ ord($b[$i]);
349 349
 	}
350 350
 
351 351
 	return $result === 0;
@@ -354,11 +354,11 @@  discard block
 block discarded – undo
354 354
 
355 355
 // JSON_PRETTY_PRINT was introduced in PHP 5.4
356 356
 // Defined here to prevent a notice when using it with wp_json_encode()
357
-if ( ! defined( 'JSON_PRETTY_PRINT' ) ) {
358
-	define( 'JSON_PRETTY_PRINT', 128 );
357
+if ( ! defined('JSON_PRETTY_PRINT')) {
358
+	define('JSON_PRETTY_PRINT', 128);
359 359
 }
360 360
 
361
-if ( ! function_exists( 'json_last_error_msg' ) ) :
361
+if ( ! function_exists('json_last_error_msg')) :
362 362
 	/**
363 363
 	 * Retrieves the error string of the last json_encode() or json_decode() call.
364 364
 	 *
@@ -371,41 +371,41 @@  discard block
 block discarded – undo
371 371
 	 */
372 372
 	function json_last_error_msg() {
373 373
 		// See https://core.trac.wordpress.org/ticket/27799.
374
-		if ( ! function_exists( 'json_last_error' ) ) {
374
+		if ( ! function_exists('json_last_error')) {
375 375
 			return false;
376 376
 		}
377 377
 
378 378
 		$last_error_code = json_last_error();
379 379
 
380 380
 		// Just in case JSON_ERROR_NONE is not defined.
381
-		$error_code_none = defined( 'JSON_ERROR_NONE' ) ? JSON_ERROR_NONE : 0;
381
+		$error_code_none = defined('JSON_ERROR_NONE') ? JSON_ERROR_NONE : 0;
382 382
 
383
-		switch ( true ) {
383
+		switch (true) {
384 384
 			case $last_error_code === $error_code_none:
385 385
 				return 'No error';
386 386
 
387
-			case defined( 'JSON_ERROR_DEPTH' ) && JSON_ERROR_DEPTH === $last_error_code:
387
+			case defined('JSON_ERROR_DEPTH') && JSON_ERROR_DEPTH === $last_error_code:
388 388
 				return 'Maximum stack depth exceeded';
389 389
 
390
-			case defined( 'JSON_ERROR_STATE_MISMATCH' ) && JSON_ERROR_STATE_MISMATCH === $last_error_code:
390
+			case defined('JSON_ERROR_STATE_MISMATCH') && JSON_ERROR_STATE_MISMATCH === $last_error_code:
391 391
 				return 'State mismatch (invalid or malformed JSON)';
392 392
 
393
-			case defined( 'JSON_ERROR_CTRL_CHAR' ) && JSON_ERROR_CTRL_CHAR === $last_error_code:
393
+			case defined('JSON_ERROR_CTRL_CHAR') && JSON_ERROR_CTRL_CHAR === $last_error_code:
394 394
 				return 'Control character error, possibly incorrectly encoded';
395 395
 
396
-			case defined( 'JSON_ERROR_SYNTAX' ) && JSON_ERROR_SYNTAX === $last_error_code:
396
+			case defined('JSON_ERROR_SYNTAX') && JSON_ERROR_SYNTAX === $last_error_code:
397 397
 				return 'Syntax error';
398 398
 
399
-			case defined( 'JSON_ERROR_UTF8' ) && JSON_ERROR_UTF8 === $last_error_code:
399
+			case defined('JSON_ERROR_UTF8') && JSON_ERROR_UTF8 === $last_error_code:
400 400
 				return 'Malformed UTF-8 characters, possibly incorrectly encoded';
401 401
 
402
-			case defined( 'JSON_ERROR_RECURSION' ) && JSON_ERROR_RECURSION === $last_error_code:
402
+			case defined('JSON_ERROR_RECURSION') && JSON_ERROR_RECURSION === $last_error_code:
403 403
 				return 'Recursion detected';
404 404
 
405
-			case defined( 'JSON_ERROR_INF_OR_NAN' ) && JSON_ERROR_INF_OR_NAN === $last_error_code:
405
+			case defined('JSON_ERROR_INF_OR_NAN') && JSON_ERROR_INF_OR_NAN === $last_error_code:
406 406
 				return 'Inf and NaN cannot be JSON encoded';
407 407
 
408
-			case defined( 'JSON_ERROR_UNSUPPORTED_TYPE' ) && JSON_ERROR_UNSUPPORTED_TYPE === $last_error_code:
408
+			case defined('JSON_ERROR_UNSUPPORTED_TYPE') && JSON_ERROR_UNSUPPORTED_TYPE === $last_error_code:
409 409
 				return 'Type is not supported';
410 410
 
411 411
 			default:
@@ -414,8 +414,8 @@  discard block
 block discarded – undo
414 414
 	}
415 415
 endif;
416 416
 
417
-if ( ! interface_exists( 'JsonSerializable' ) ) {
418
-	define( 'WP_JSON_SERIALIZE_COMPATIBLE', true );
417
+if ( ! interface_exists('JsonSerializable')) {
418
+	define('WP_JSON_SERIALIZE_COMPATIBLE', true);
419 419
 	/**
420 420
 	 * JsonSerializable interface.
421 421
 	 *
@@ -431,11 +431,11 @@  discard block
 block discarded – undo
431 431
 }
432 432
 
433 433
 // random_int was introduced in PHP 7.0
434
-if ( ! function_exists( 'random_int' ) ) {
435
-	require ABSPATH . WPINC . '/random_compat/random.php';
434
+if ( ! function_exists('random_int')) {
435
+	require ABSPATH.WPINC.'/random_compat/random.php';
436 436
 }
437 437
 
438
-if ( ! function_exists( 'array_replace_recursive' ) ) :
438
+if ( ! function_exists('array_replace_recursive')) :
439 439
 	/**
440 440
 	 * PHP-agnostic version of {@link array_replace_recursive()}.
441 441
 	 *
@@ -457,31 +457,31 @@  discard block
 block discarded – undo
457 457
 	 *
458 458
 	 * @return array
459 459
 	 */
460
-	function array_replace_recursive( $base = array(), $replacements = array() ) {
461
-		foreach ( array_slice( func_get_args(), 1 ) as $replacements ) {
462
-			$bref_stack = array( &$base );
463
-			$head_stack = array( $replacements );
460
+	function array_replace_recursive($base = array(), $replacements = array()) {
461
+		foreach (array_slice(func_get_args(), 1) as $replacements) {
462
+			$bref_stack = array(&$base);
463
+			$head_stack = array($replacements);
464 464
 
465 465
 			do {
466
-				end( $bref_stack );
466
+				end($bref_stack);
467 467
 
468
-				$bref = &$bref_stack[ key( $bref_stack ) ];
469
-				$head = array_pop( $head_stack );
468
+				$bref = &$bref_stack[key($bref_stack)];
469
+				$head = array_pop($head_stack);
470 470
 
471
-				unset( $bref_stack[ key( $bref_stack ) ] );
471
+				unset($bref_stack[key($bref_stack)]);
472 472
 
473
-				foreach ( array_keys( $head ) as $key ) {
474
-					if ( isset( $key, $bref ) &&
475
-					     isset( $bref[ $key ] ) && is_array( $bref[ $key ] ) &&
476
-					     isset( $head[ $key ] ) && is_array( $head[ $key ] )
473
+				foreach (array_keys($head) as $key) {
474
+					if (isset($key, $bref) &&
475
+					     isset($bref[$key]) && is_array($bref[$key]) &&
476
+					     isset($head[$key]) && is_array($head[$key])
477 477
 					) {
478
-						$bref_stack[] = &$bref[ $key ];
479
-						$head_stack[] = $head[ $key ];
478
+						$bref_stack[] = &$bref[$key];
479
+						$head_stack[] = $head[$key];
480 480
 					} else {
481
-						$bref[ $key ] = $head[ $key ];
481
+						$bref[$key] = $head[$key];
482 482
 					}
483 483
 				}
484
-			} while ( count( $head_stack ) );
484
+			} while (count($head_stack));
485 485
 		}
486 486
 
487 487
 		return $base;
@@ -489,7 +489,7 @@  discard block
 block discarded – undo
489 489
 endif;
490 490
 
491 491
 // SPL can be disabled on PHP 5.2
492
-if ( ! function_exists( 'spl_autoload_register' ) ):
492
+if ( ! function_exists('spl_autoload_register')):
493 493
 	$_wp_spl_autoloaders = array();
494 494
 
495 495
 	/**
@@ -499,18 +499,18 @@  discard block
 block discarded – undo
499 499
 	 *
500 500
 	 * @param string $classname Class to attempt autoloading.
501 501
 	 */
502
-	function __autoload( $classname ) {
502
+	function __autoload($classname) {
503 503
 		global $_wp_spl_autoloaders;
504
-		foreach ( $_wp_spl_autoloaders as $autoloader ) {
505
-			if ( ! is_callable( $autoloader ) ) {
504
+		foreach ($_wp_spl_autoloaders as $autoloader) {
505
+			if ( ! is_callable($autoloader)) {
506 506
 				// Avoid the extra warning if the autoloader isn't callable.
507 507
 				continue;
508 508
 			}
509 509
 
510
-			call_user_func( $autoloader, $classname );
510
+			call_user_func($autoloader, $classname);
511 511
 
512 512
 			// If it has been autoloaded, stop processing.
513
-			if ( class_exists( $classname, false ) ) {
513
+			if (class_exists($classname, false)) {
514 514
 				return;
515 515
 			}
516 516
 		}
@@ -525,21 +525,21 @@  discard block
 block discarded – undo
525 525
 	 * @param boolean $throw Should the function throw an exception if the function isn't callable?
526 526
 	 * @param boolean $prepend Should we prepend the function to the stack?
527 527
 	 */
528
-	function spl_autoload_register( $autoload_function, $throw = true, $prepend = false ) {
529
-		if ( $throw && ! is_callable( $autoload_function ) ) {
528
+	function spl_autoload_register($autoload_function, $throw = true, $prepend = false) {
529
+		if ($throw && ! is_callable($autoload_function)) {
530 530
 			// String not translated to match PHP core.
531
-			throw new Exception( 'Function not callable' );
531
+			throw new Exception('Function not callable');
532 532
 		}
533 533
 
534 534
 		global $_wp_spl_autoloaders;
535 535
 
536 536
 		// Don't allow multiple registration.
537
-		if ( in_array( $autoload_function, $_wp_spl_autoloaders ) ) {
537
+		if (in_array($autoload_function, $_wp_spl_autoloaders)) {
538 538
 			return;
539 539
 		}
540 540
 
541
-		if ( $prepend ) {
542
-			array_unshift( $_wp_spl_autoloaders, $autoload_function );
541
+		if ($prepend) {
542
+			array_unshift($_wp_spl_autoloaders, $autoload_function);
543 543
 		} else {
544 544
 			$_wp_spl_autoloaders[] = $autoload_function;
545 545
 		}
@@ -553,11 +553,11 @@  discard block
 block discarded – undo
553 553
 	 * @param callable $function The function to unregister.
554 554
 	 * @return boolean True if the function was unregistered, false if it could not be.
555 555
 	 */
556
-	function spl_autoload_unregister( $function ) {
556
+	function spl_autoload_unregister($function) {
557 557
 		global $_wp_spl_autoloaders;
558
-		foreach ( $_wp_spl_autoloaders as &$autoloader ) {
559
-			if ( $autoloader === $function ) {
560
-				unset( $autoloader );
558
+		foreach ($_wp_spl_autoloaders as &$autoloader) {
559
+			if ($autoloader === $function) {
560
+				unset($autoloader);
561 561
 				return true;
562 562
 			}
563 563
 		}
Please login to merge, or discard this patch.
src/wp-includes/Text/Diff/Engine/shell.php 3 patches
Indentation   +142 added lines, -142 removed lines patch added patch discarded remove patch
@@ -16,147 +16,147 @@
 block discarded – undo
16 16
  */
17 17
 class Text_Diff_Engine_shell {
18 18
 
19
-    /**
20
-     * Path to the diff executable
21
-     *
22
-     * @var string
23
-     */
24
-    var $_diffCommand = 'diff';
25
-
26
-    /**
27
-     * Returns the array of differences.
28
-     *
29
-     * @param array $from_lines lines of text from old file
30
-     * @param array $to_lines   lines of text from new file
31
-     *
32
-     * @return array all changes made (array with Text_Diff_Op_* objects)
33
-     */
34
-    function diff($from_lines, $to_lines)
35
-    {
36
-        array_walk($from_lines, array('Text_Diff', 'trimNewlines'));
37
-        array_walk($to_lines, array('Text_Diff', 'trimNewlines'));
38
-
39
-        $temp_dir = Text_Diff::_getTempDir();
40
-
41
-        // Execute gnu diff or similar to get a standard diff file.
42
-        $from_file = tempnam($temp_dir, 'Text_Diff');
43
-        $to_file = tempnam($temp_dir, 'Text_Diff');
44
-        $fp = fopen($from_file, 'w');
45
-        fwrite($fp, implode("\n", $from_lines));
46
-        fclose($fp);
47
-        $fp = fopen($to_file, 'w');
48
-        fwrite($fp, implode("\n", $to_lines));
49
-        fclose($fp);
50
-        $diff = shell_exec($this->_diffCommand . ' ' . $from_file . ' ' . $to_file);
51
-        unlink($from_file);
52
-        unlink($to_file);
53
-
54
-        if (is_null($diff)) {
55
-            // No changes were made
56
-            return array(new Text_Diff_Op_copy($from_lines));
57
-        }
58
-
59
-        $from_line_no = 1;
60
-        $to_line_no = 1;
61
-        $edits = array();
62
-
63
-        // Get changed lines by parsing something like:
64
-        // 0a1,2
65
-        // 1,2c4,6
66
-        // 1,5d6
67
-        preg_match_all('#^(\d+)(?:,(\d+))?([adc])(\d+)(?:,(\d+))?$#m', $diff,
68
-            $matches, PREG_SET_ORDER);
69
-
70
-        foreach ($matches as $match) {
71
-            if (!isset($match[5])) {
72
-                // This paren is not set every time (see regex).
73
-                $match[5] = false;
74
-            }
75
-
76
-            if ($match[3] == 'a') {
77
-                $from_line_no--;
78
-            }
79
-
80
-            if ($match[3] == 'd') {
81
-                $to_line_no--;
82
-            }
83
-
84
-            if ($from_line_no < $match[1] || $to_line_no < $match[4]) {
85
-                // copied lines
86
-                assert('$match[1] - $from_line_no == $match[4] - $to_line_no');
87
-                array_push($edits,
88
-                    new Text_Diff_Op_copy(
89
-                        $this->_getLines($from_lines, $from_line_no, $match[1] - 1),
90
-                        $this->_getLines($to_lines, $to_line_no, $match[4] - 1)));
91
-            }
92
-
93
-            switch ($match[3]) {
94
-            case 'd':
95
-                // deleted lines
96
-                array_push($edits,
97
-                    new Text_Diff_Op_delete(
98
-                        $this->_getLines($from_lines, $from_line_no, $match[2])));
99
-                $to_line_no++;
100
-                break;
101
-
102
-            case 'c':
103
-                // changed lines
104
-                array_push($edits,
105
-                    new Text_Diff_Op_change(
106
-                        $this->_getLines($from_lines, $from_line_no, $match[2]),
107
-                        $this->_getLines($to_lines, $to_line_no, $match[5])));
108
-                break;
109
-
110
-            case 'a':
111
-                // added lines
112
-                array_push($edits,
113
-                    new Text_Diff_Op_add(
114
-                        $this->_getLines($to_lines, $to_line_no, $match[5])));
115
-                $from_line_no++;
116
-                break;
117
-            }
118
-        }
119
-
120
-        if (!empty($from_lines)) {
121
-            // Some lines might still be pending. Add them as copied
122
-            array_push($edits,
123
-                new Text_Diff_Op_copy(
124
-                    $this->_getLines($from_lines, $from_line_no,
125
-                                     $from_line_no + count($from_lines) - 1),
126
-                    $this->_getLines($to_lines, $to_line_no,
127
-                                     $to_line_no + count($to_lines) - 1)));
128
-        }
129
-
130
-        return $edits;
131
-    }
132
-
133
-    /**
134
-     * Get lines from either the old or new text
135
-     *
136
-     * @access private
137
-     *
138
-     * @param array &$text_lines Either $from_lines or $to_lines
139
-     * @param int   &$line_no    Current line number
140
-     * @param int   $end         Optional end line, when we want to chop more
141
-     *                           than one line.
142
-     *
143
-     * @return array The chopped lines
144
-     */
145
-    function _getLines(&$text_lines, &$line_no, $end = false)
146
-    {
147
-        if (!empty($end)) {
148
-            $lines = array();
149
-            // We can shift even more
150
-            while ($line_no <= $end) {
151
-                array_push($lines, array_shift($text_lines));
152
-                $line_no++;
153
-            }
154
-        } else {
155
-            $lines = array(array_shift($text_lines));
156
-            $line_no++;
157
-        }
158
-
159
-        return $lines;
160
-    }
19
+	/**
20
+	 * Path to the diff executable
21
+	 *
22
+	 * @var string
23
+	 */
24
+	var $_diffCommand = 'diff';
25
+
26
+	/**
27
+	 * Returns the array of differences.
28
+	 *
29
+	 * @param array $from_lines lines of text from old file
30
+	 * @param array $to_lines   lines of text from new file
31
+	 *
32
+	 * @return array all changes made (array with Text_Diff_Op_* objects)
33
+	 */
34
+	function diff($from_lines, $to_lines)
35
+	{
36
+		array_walk($from_lines, array('Text_Diff', 'trimNewlines'));
37
+		array_walk($to_lines, array('Text_Diff', 'trimNewlines'));
38
+
39
+		$temp_dir = Text_Diff::_getTempDir();
40
+
41
+		// Execute gnu diff or similar to get a standard diff file.
42
+		$from_file = tempnam($temp_dir, 'Text_Diff');
43
+		$to_file = tempnam($temp_dir, 'Text_Diff');
44
+		$fp = fopen($from_file, 'w');
45
+		fwrite($fp, implode("\n", $from_lines));
46
+		fclose($fp);
47
+		$fp = fopen($to_file, 'w');
48
+		fwrite($fp, implode("\n", $to_lines));
49
+		fclose($fp);
50
+		$diff = shell_exec($this->_diffCommand . ' ' . $from_file . ' ' . $to_file);
51
+		unlink($from_file);
52
+		unlink($to_file);
53
+
54
+		if (is_null($diff)) {
55
+			// No changes were made
56
+			return array(new Text_Diff_Op_copy($from_lines));
57
+		}
58
+
59
+		$from_line_no = 1;
60
+		$to_line_no = 1;
61
+		$edits = array();
62
+
63
+		// Get changed lines by parsing something like:
64
+		// 0a1,2
65
+		// 1,2c4,6
66
+		// 1,5d6
67
+		preg_match_all('#^(\d+)(?:,(\d+))?([adc])(\d+)(?:,(\d+))?$#m', $diff,
68
+			$matches, PREG_SET_ORDER);
69
+
70
+		foreach ($matches as $match) {
71
+			if (!isset($match[5])) {
72
+				// This paren is not set every time (see regex).
73
+				$match[5] = false;
74
+			}
75
+
76
+			if ($match[3] == 'a') {
77
+				$from_line_no--;
78
+			}
79
+
80
+			if ($match[3] == 'd') {
81
+				$to_line_no--;
82
+			}
83
+
84
+			if ($from_line_no < $match[1] || $to_line_no < $match[4]) {
85
+				// copied lines
86
+				assert('$match[1] - $from_line_no == $match[4] - $to_line_no');
87
+				array_push($edits,
88
+					new Text_Diff_Op_copy(
89
+						$this->_getLines($from_lines, $from_line_no, $match[1] - 1),
90
+						$this->_getLines($to_lines, $to_line_no, $match[4] - 1)));
91
+			}
92
+
93
+			switch ($match[3]) {
94
+			case 'd':
95
+				// deleted lines
96
+				array_push($edits,
97
+					new Text_Diff_Op_delete(
98
+						$this->_getLines($from_lines, $from_line_no, $match[2])));
99
+				$to_line_no++;
100
+				break;
101
+
102
+			case 'c':
103
+				// changed lines
104
+				array_push($edits,
105
+					new Text_Diff_Op_change(
106
+						$this->_getLines($from_lines, $from_line_no, $match[2]),
107
+						$this->_getLines($to_lines, $to_line_no, $match[5])));
108
+				break;
109
+
110
+			case 'a':
111
+				// added lines
112
+				array_push($edits,
113
+					new Text_Diff_Op_add(
114
+						$this->_getLines($to_lines, $to_line_no, $match[5])));
115
+				$from_line_no++;
116
+				break;
117
+			}
118
+		}
119
+
120
+		if (!empty($from_lines)) {
121
+			// Some lines might still be pending. Add them as copied
122
+			array_push($edits,
123
+				new Text_Diff_Op_copy(
124
+					$this->_getLines($from_lines, $from_line_no,
125
+									 $from_line_no + count($from_lines) - 1),
126
+					$this->_getLines($to_lines, $to_line_no,
127
+									 $to_line_no + count($to_lines) - 1)));
128
+		}
129
+
130
+		return $edits;
131
+	}
132
+
133
+	/**
134
+	 * Get lines from either the old or new text
135
+	 *
136
+	 * @access private
137
+	 *
138
+	 * @param array &$text_lines Either $from_lines or $to_lines
139
+	 * @param int   &$line_no    Current line number
140
+	 * @param int   $end         Optional end line, when we want to chop more
141
+	 *                           than one line.
142
+	 *
143
+	 * @return array The chopped lines
144
+	 */
145
+	function _getLines(&$text_lines, &$line_no, $end = false)
146
+	{
147
+		if (!empty($end)) {
148
+			$lines = array();
149
+			// We can shift even more
150
+			while ($line_no <= $end) {
151
+				array_push($lines, array_shift($text_lines));
152
+				$line_no++;
153
+			}
154
+		} else {
155
+			$lines = array(array_shift($text_lines));
156
+			$line_no++;
157
+		}
158
+
159
+		return $lines;
160
+	}
161 161
 
162 162
 }
Please login to merge, or discard this patch.
Switch Indentation   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -91,29 +91,29 @@
 block discarded – undo
91 91
             }
92 92
 
93 93
             switch ($match[3]) {
94
-            case 'd':
95
-                // deleted lines
96
-                array_push($edits,
97
-                    new Text_Diff_Op_delete(
98
-                        $this->_getLines($from_lines, $from_line_no, $match[2])));
99
-                $to_line_no++;
100
-                break;
101
-
102
-            case 'c':
103
-                // changed lines
104
-                array_push($edits,
105
-                    new Text_Diff_Op_change(
106
-                        $this->_getLines($from_lines, $from_line_no, $match[2]),
107
-                        $this->_getLines($to_lines, $to_line_no, $match[5])));
108
-                break;
109
-
110
-            case 'a':
111
-                // added lines
112
-                array_push($edits,
113
-                    new Text_Diff_Op_add(
114
-                        $this->_getLines($to_lines, $to_line_no, $match[5])));
115
-                $from_line_no++;
116
-                break;
94
+            	case 'd':
95
+                	// deleted lines
96
+                	array_push($edits,
97
+                    	new Text_Diff_Op_delete(
98
+                        	$this->_getLines($from_lines, $from_line_no, $match[2])));
99
+                	$to_line_no++;
100
+                	break;
101
+
102
+            	case 'c':
103
+                	// changed lines
104
+                	array_push($edits,
105
+                    	new Text_Diff_Op_change(
106
+                        	$this->_getLines($from_lines, $from_line_no, $match[2]),
107
+                        	$this->_getLines($to_lines, $to_line_no, $match[5])));
108
+                	break;
109
+
110
+            	case 'a':
111
+                	// added lines
112
+                	array_push($edits,
113
+                    	new Text_Diff_Op_add(
114
+                        	$this->_getLines($to_lines, $to_line_no, $match[5])));
115
+                	$from_line_no++;
116
+                	break;
117 117
             }
118 118
         }
119 119
 
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
         $fp = fopen($to_file, 'w');
48 48
         fwrite($fp, implode("\n", $to_lines));
49 49
         fclose($fp);
50
-        $diff = shell_exec($this->_diffCommand . ' ' . $from_file . ' ' . $to_file);
50
+        $diff = shell_exec($this->_diffCommand.' '.$from_file.' '.$to_file);
51 51
         unlink($from_file);
52 52
         unlink($to_file);
53 53
 
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
             $matches, PREG_SET_ORDER);
69 69
 
70 70
         foreach ($matches as $match) {
71
-            if (!isset($match[5])) {
71
+            if ( ! isset($match[5])) {
72 72
                 // This paren is not set every time (see regex).
73 73
                 $match[5] = false;
74 74
             }
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
             }
118 118
         }
119 119
 
120
-        if (!empty($from_lines)) {
120
+        if ( ! empty($from_lines)) {
121 121
             // Some lines might still be pending. Add them as copied
122 122
             array_push($edits,
123 123
                 new Text_Diff_Op_copy(
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
      */
145 145
     function _getLines(&$text_lines, &$line_no, $end = false)
146 146
     {
147
-        if (!empty($end)) {
147
+        if ( ! empty($end)) {
148 148
             $lines = array();
149 149
             // We can shift even more
150 150
             while ($line_no <= $end) {
Please login to merge, or discard this patch.
src/wp-includes/Text/Diff/Engine/xdiff.php 3 patches
Indentation   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -15,22 +15,22 @@  discard block
 block discarded – undo
15 15
  */
16 16
 class Text_Diff_Engine_xdiff {
17 17
 
18
-    /**
19
-     */
20
-    function diff($from_lines, $to_lines)
21
-    {
22
-        array_walk($from_lines, array('Text_Diff', 'trimNewlines'));
23
-        array_walk($to_lines, array('Text_Diff', 'trimNewlines'));
18
+	/**
19
+	 */
20
+	function diff($from_lines, $to_lines)
21
+	{
22
+		array_walk($from_lines, array('Text_Diff', 'trimNewlines'));
23
+		array_walk($to_lines, array('Text_Diff', 'trimNewlines'));
24 24
 
25
-        /* Convert the two input arrays into strings for xdiff processing. */
26
-        $from_string = implode("\n", $from_lines);
27
-        $to_string = implode("\n", $to_lines);
25
+		/* Convert the two input arrays into strings for xdiff processing. */
26
+		$from_string = implode("\n", $from_lines);
27
+		$to_string = implode("\n", $to_lines);
28 28
 
29
-        /* Diff the two strings and convert the result to an array. */
30
-        $diff = xdiff_string_diff($from_string, $to_string, count($to_lines));
31
-        $diff = explode("\n", $diff);
29
+		/* Diff the two strings and convert the result to an array. */
30
+		$diff = xdiff_string_diff($from_string, $to_string, count($to_lines));
31
+		$diff = explode("\n", $diff);
32 32
 
33
-        /* Walk through the diff one line at a time.  We build the $edits
33
+		/* Walk through the diff one line at a time.  We build the $edits
34 34
          * array of diff operations by reading the first character of the
35 35
          * xdiff output (which is in the "unified diff" format).
36 36
          *
@@ -38,27 +38,27 @@  discard block
 block discarded – undo
38 38
          * lines using this approach, so we can't add Text_Diff_Op_changed
39 39
          * instances to the $edits array.  The result is still perfectly
40 40
          * valid, albeit a little less descriptive and efficient. */
41
-        $edits = array();
42
-        foreach ($diff as $line) {
43
-            if (!strlen($line)) {
44
-                continue;
45
-            }
46
-            switch ($line[0]) {
47
-            case ' ':
48
-                $edits[] = new Text_Diff_Op_copy(array(substr($line, 1)));
49
-                break;
41
+		$edits = array();
42
+		foreach ($diff as $line) {
43
+			if (!strlen($line)) {
44
+				continue;
45
+			}
46
+			switch ($line[0]) {
47
+			case ' ':
48
+				$edits[] = new Text_Diff_Op_copy(array(substr($line, 1)));
49
+				break;
50 50
 
51
-            case '+':
52
-                $edits[] = new Text_Diff_Op_add(array(substr($line, 1)));
53
-                break;
51
+			case '+':
52
+				$edits[] = new Text_Diff_Op_add(array(substr($line, 1)));
53
+				break;
54 54
 
55
-            case '-':
56
-                $edits[] = new Text_Diff_Op_delete(array(substr($line, 1)));
57
-                break;
58
-            }
59
-        }
55
+			case '-':
56
+				$edits[] = new Text_Diff_Op_delete(array(substr($line, 1)));
57
+				break;
58
+			}
59
+		}
60 60
 
61
-        return $edits;
62
-    }
61
+		return $edits;
62
+	}
63 63
 
64 64
 }
Please login to merge, or discard this patch.
Switch Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -44,17 +44,17 @@
 block discarded – undo
44 44
                 continue;
45 45
             }
46 46
             switch ($line[0]) {
47
-            case ' ':
48
-                $edits[] = new Text_Diff_Op_copy(array(substr($line, 1)));
49
-                break;
47
+            	case ' ':
48
+                	$edits[] = new Text_Diff_Op_copy(array(substr($line, 1)));
49
+                	break;
50 50
 
51
-            case '+':
52
-                $edits[] = new Text_Diff_Op_add(array(substr($line, 1)));
53
-                break;
51
+            	case '+':
52
+                	$edits[] = new Text_Diff_Op_add(array(substr($line, 1)));
53
+                	break;
54 54
 
55
-            case '-':
56
-                $edits[] = new Text_Diff_Op_delete(array(substr($line, 1)));
57
-                break;
55
+            	case '-':
56
+                	$edits[] = new Text_Diff_Op_delete(array(substr($line, 1)));
57
+                	break;
58 58
             }
59 59
         }
60 60
 
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@
 block discarded – undo
40 40
          * valid, albeit a little less descriptive and efficient. */
41 41
         $edits = array();
42 42
         foreach ($diff as $line) {
43
-            if (!strlen($line)) {
43
+            if ( ! strlen($line)) {
44 44
                 continue;
45 45
             }
46 46
             switch ($line[0]) {
Please login to merge, or discard this patch.
src/wp-includes/Text/Diff.php 2 patches
Indentation   +356 added lines, -356 removed lines patch added patch discarded remove patch
@@ -17,43 +17,43 @@  discard block
 block discarded – undo
17 17
  */
18 18
 class Text_Diff {
19 19
 
20
-    /**
21
-     * Array of changes.
22
-     *
23
-     * @var array
24
-     */
25
-    var $_edits;
26
-
27
-    /**
28
-     * Computes diffs between sequences of strings.
29
-     *
30
-     * @param string $engine     Name of the diffing engine to use.  'auto'
31
-     *                           will automatically select the best.
32
-     * @param array $params      Parameters to pass to the diffing engine.
33
-     *                           Normally an array of two arrays, each
34
-     *                           containing the lines from a file.
35
-     */
36
-    function __construct( $engine, $params )
37
-    {
38
-        // Backward compatibility workaround.
39
-        if (!is_string($engine)) {
40
-            $params = array($engine, $params);
41
-            $engine = 'auto';
42
-        }
43
-
44
-        if ($engine == 'auto') {
45
-            $engine = extension_loaded('xdiff') ? 'xdiff' : 'native';
46
-        } else {
47
-            $engine = basename($engine);
48
-        }
49
-
50
-        // WP #7391
51
-        require_once dirname(__FILE__).'/Diff/Engine/' . $engine . '.php';
52
-        $class = 'Text_Diff_Engine_' . $engine;
53
-        $diff_engine = new $class();
54
-
55
-        $this->_edits = call_user_func_array(array($diff_engine, 'diff'), $params);
56
-    }
20
+	/**
21
+	 * Array of changes.
22
+	 *
23
+	 * @var array
24
+	 */
25
+	var $_edits;
26
+
27
+	/**
28
+	 * Computes diffs between sequences of strings.
29
+	 *
30
+	 * @param string $engine     Name of the diffing engine to use.  'auto'
31
+	 *                           will automatically select the best.
32
+	 * @param array $params      Parameters to pass to the diffing engine.
33
+	 *                           Normally an array of two arrays, each
34
+	 *                           containing the lines from a file.
35
+	 */
36
+	function __construct( $engine, $params )
37
+	{
38
+		// Backward compatibility workaround.
39
+		if (!is_string($engine)) {
40
+			$params = array($engine, $params);
41
+			$engine = 'auto';
42
+		}
43
+
44
+		if ($engine == 'auto') {
45
+			$engine = extension_loaded('xdiff') ? 'xdiff' : 'native';
46
+		} else {
47
+			$engine = basename($engine);
48
+		}
49
+
50
+		// WP #7391
51
+		require_once dirname(__FILE__).'/Diff/Engine/' . $engine . '.php';
52
+		$class = 'Text_Diff_Engine_' . $engine;
53
+		$diff_engine = new $class();
54
+
55
+		$this->_edits = call_user_func_array(array($diff_engine, 'diff'), $params);
56
+	}
57 57
 
58 58
 	/**
59 59
 	 * PHP4 constructor.
@@ -62,230 +62,230 @@  discard block
 block discarded – undo
62 62
 		self::__construct( $engine, $params );
63 63
 	}
64 64
 
65
-    /**
66
-     * Returns the array of differences.
67
-     */
68
-    function getDiff()
69
-    {
70
-        return $this->_edits;
71
-    }
72
-
73
-    /**
74
-     * returns the number of new (added) lines in a given diff.
75
-     *
76
-     * @since Text_Diff 1.1.0
77
-     *
78
-     * @return integer The number of new lines
79
-     */
80
-    function countAddedLines()
81
-    {
82
-        $count = 0;
83
-        foreach ($this->_edits as $edit) {
84
-            if (is_a($edit, 'Text_Diff_Op_add') ||
85
-                is_a($edit, 'Text_Diff_Op_change')) {
86
-                $count += $edit->nfinal();
87
-            }
88
-        }
89
-        return $count;
90
-    }
91
-
92
-    /**
93
-     * Returns the number of deleted (removed) lines in a given diff.
94
-     *
95
-     * @since Text_Diff 1.1.0
96
-     *
97
-     * @return integer The number of deleted lines
98
-     */
99
-    function countDeletedLines()
100
-    {
101
-        $count = 0;
102
-        foreach ($this->_edits as $edit) {
103
-            if (is_a($edit, 'Text_Diff_Op_delete') ||
104
-                is_a($edit, 'Text_Diff_Op_change')) {
105
-                $count += $edit->norig();
106
-            }
107
-        }
108
-        return $count;
109
-    }
110
-
111
-    /**
112
-     * Computes a reversed diff.
113
-     *
114
-     * Example:
115
-     * <code>
116
-     * $diff = new Text_Diff($lines1, $lines2);
117
-     * $rev = $diff->reverse();
118
-     * </code>
119
-     *
120
-     * @return Text_Diff  A Diff object representing the inverse of the
121
-     *                    original diff.  Note that we purposely don't return a
122
-     *                    reference here, since this essentially is a clone()
123
-     *                    method.
124
-     */
125
-    function reverse()
126
-    {
127
-        if (version_compare(zend_version(), '2', '>')) {
128
-            $rev = clone($this);
129
-        } else {
130
-            $rev = $this;
131
-        }
132
-        $rev->_edits = array();
133
-        foreach ($this->_edits as $edit) {
134
-            $rev->_edits[] = $edit->reverse();
135
-        }
136
-        return $rev;
137
-    }
138
-
139
-    /**
140
-     * Checks for an empty diff.
141
-     *
142
-     * @return boolean  True if two sequences were identical.
143
-     */
144
-    function isEmpty()
145
-    {
146
-        foreach ($this->_edits as $edit) {
147
-            if (!is_a($edit, 'Text_Diff_Op_copy')) {
148
-                return false;
149
-            }
150
-        }
151
-        return true;
152
-    }
153
-
154
-    /**
155
-     * Computes the length of the Longest Common Subsequence (LCS).
156
-     *
157
-     * This is mostly for diagnostic purposes.
158
-     *
159
-     * @return integer  The length of the LCS.
160
-     */
161
-    function lcs()
162
-    {
163
-        $lcs = 0;
164
-        foreach ($this->_edits as $edit) {
165
-            if (is_a($edit, 'Text_Diff_Op_copy')) {
166
-                $lcs += count($edit->orig);
167
-            }
168
-        }
169
-        return $lcs;
170
-    }
171
-
172
-    /**
173
-     * Gets the original set of lines.
174
-     *
175
-     * This reconstructs the $from_lines parameter passed to the constructor.
176
-     *
177
-     * @return array  The original sequence of strings.
178
-     */
179
-    function getOriginal()
180
-    {
181
-        $lines = array();
182
-        foreach ($this->_edits as $edit) {
183
-            if ($edit->orig) {
184
-                array_splice($lines, count($lines), 0, $edit->orig);
185
-            }
186
-        }
187
-        return $lines;
188
-    }
189
-
190
-    /**
191
-     * Gets the final set of lines.
192
-     *
193
-     * This reconstructs the $to_lines parameter passed to the constructor.
194
-     *
195
-     * @return array  The sequence of strings.
196
-     */
197
-    function getFinal()
198
-    {
199
-        $lines = array();
200
-        foreach ($this->_edits as $edit) {
201
-            if ($edit->final) {
202
-                array_splice($lines, count($lines), 0, $edit->final);
203
-            }
204
-        }
205
-        return $lines;
206
-    }
207
-
208
-    /**
209
-     * Removes trailing newlines from a line of text. This is meant to be used
210
-     * with array_walk().
211
-     *
212
-     * @param string $line  The line to trim.
213
-     * @param integer $key  The index of the line in the array. Not used.
214
-     */
215
-    static function trimNewlines(&$line, $key)
216
-    {
217
-        $line = str_replace(array("\n", "\r"), '', $line);
218
-    }
219
-
220
-    /**
221
-     * Determines the location of the system temporary directory.
222
-     *
223
-     * @static
224
-     *
225
-     * @access protected
226
-     *
227
-     * @return string  A directory name which can be used for temp files.
228
-     *                 Returns false if one could not be found.
229
-     */
230
-    function _getTempDir()
231
-    {
232
-        $tmp_locations = array('/tmp', '/var/tmp', 'c:\WUTemp', 'c:\temp',
233
-                               'c:\windows\temp', 'c:\winnt\temp');
234
-
235
-        /* Try PHP's upload_tmp_dir directive. */
236
-        $tmp = ini_get('upload_tmp_dir');
237
-
238
-        /* Otherwise, try to determine the TMPDIR environment variable. */
239
-        if (!strlen($tmp)) {
240
-            $tmp = getenv('TMPDIR');
241
-        }
242
-
243
-        /* If we still cannot determine a value, then cycle through a list of
65
+	/**
66
+	 * Returns the array of differences.
67
+	 */
68
+	function getDiff()
69
+	{
70
+		return $this->_edits;
71
+	}
72
+
73
+	/**
74
+	 * returns the number of new (added) lines in a given diff.
75
+	 *
76
+	 * @since Text_Diff 1.1.0
77
+	 *
78
+	 * @return integer The number of new lines
79
+	 */
80
+	function countAddedLines()
81
+	{
82
+		$count = 0;
83
+		foreach ($this->_edits as $edit) {
84
+			if (is_a($edit, 'Text_Diff_Op_add') ||
85
+				is_a($edit, 'Text_Diff_Op_change')) {
86
+				$count += $edit->nfinal();
87
+			}
88
+		}
89
+		return $count;
90
+	}
91
+
92
+	/**
93
+	 * Returns the number of deleted (removed) lines in a given diff.
94
+	 *
95
+	 * @since Text_Diff 1.1.0
96
+	 *
97
+	 * @return integer The number of deleted lines
98
+	 */
99
+	function countDeletedLines()
100
+	{
101
+		$count = 0;
102
+		foreach ($this->_edits as $edit) {
103
+			if (is_a($edit, 'Text_Diff_Op_delete') ||
104
+				is_a($edit, 'Text_Diff_Op_change')) {
105
+				$count += $edit->norig();
106
+			}
107
+		}
108
+		return $count;
109
+	}
110
+
111
+	/**
112
+	 * Computes a reversed diff.
113
+	 *
114
+	 * Example:
115
+	 * <code>
116
+	 * $diff = new Text_Diff($lines1, $lines2);
117
+	 * $rev = $diff->reverse();
118
+	 * </code>
119
+	 *
120
+	 * @return Text_Diff  A Diff object representing the inverse of the
121
+	 *                    original diff.  Note that we purposely don't return a
122
+	 *                    reference here, since this essentially is a clone()
123
+	 *                    method.
124
+	 */
125
+	function reverse()
126
+	{
127
+		if (version_compare(zend_version(), '2', '>')) {
128
+			$rev = clone($this);
129
+		} else {
130
+			$rev = $this;
131
+		}
132
+		$rev->_edits = array();
133
+		foreach ($this->_edits as $edit) {
134
+			$rev->_edits[] = $edit->reverse();
135
+		}
136
+		return $rev;
137
+	}
138
+
139
+	/**
140
+	 * Checks for an empty diff.
141
+	 *
142
+	 * @return boolean  True if two sequences were identical.
143
+	 */
144
+	function isEmpty()
145
+	{
146
+		foreach ($this->_edits as $edit) {
147
+			if (!is_a($edit, 'Text_Diff_Op_copy')) {
148
+				return false;
149
+			}
150
+		}
151
+		return true;
152
+	}
153
+
154
+	/**
155
+	 * Computes the length of the Longest Common Subsequence (LCS).
156
+	 *
157
+	 * This is mostly for diagnostic purposes.
158
+	 *
159
+	 * @return integer  The length of the LCS.
160
+	 */
161
+	function lcs()
162
+	{
163
+		$lcs = 0;
164
+		foreach ($this->_edits as $edit) {
165
+			if (is_a($edit, 'Text_Diff_Op_copy')) {
166
+				$lcs += count($edit->orig);
167
+			}
168
+		}
169
+		return $lcs;
170
+	}
171
+
172
+	/**
173
+	 * Gets the original set of lines.
174
+	 *
175
+	 * This reconstructs the $from_lines parameter passed to the constructor.
176
+	 *
177
+	 * @return array  The original sequence of strings.
178
+	 */
179
+	function getOriginal()
180
+	{
181
+		$lines = array();
182
+		foreach ($this->_edits as $edit) {
183
+			if ($edit->orig) {
184
+				array_splice($lines, count($lines), 0, $edit->orig);
185
+			}
186
+		}
187
+		return $lines;
188
+	}
189
+
190
+	/**
191
+	 * Gets the final set of lines.
192
+	 *
193
+	 * This reconstructs the $to_lines parameter passed to the constructor.
194
+	 *
195
+	 * @return array  The sequence of strings.
196
+	 */
197
+	function getFinal()
198
+	{
199
+		$lines = array();
200
+		foreach ($this->_edits as $edit) {
201
+			if ($edit->final) {
202
+				array_splice($lines, count($lines), 0, $edit->final);
203
+			}
204
+		}
205
+		return $lines;
206
+	}
207
+
208
+	/**
209
+	 * Removes trailing newlines from a line of text. This is meant to be used
210
+	 * with array_walk().
211
+	 *
212
+	 * @param string $line  The line to trim.
213
+	 * @param integer $key  The index of the line in the array. Not used.
214
+	 */
215
+	static function trimNewlines(&$line, $key)
216
+	{
217
+		$line = str_replace(array("\n", "\r"), '', $line);
218
+	}
219
+
220
+	/**
221
+	 * Determines the location of the system temporary directory.
222
+	 *
223
+	 * @static
224
+	 *
225
+	 * @access protected
226
+	 *
227
+	 * @return string  A directory name which can be used for temp files.
228
+	 *                 Returns false if one could not be found.
229
+	 */
230
+	function _getTempDir()
231
+	{
232
+		$tmp_locations = array('/tmp', '/var/tmp', 'c:\WUTemp', 'c:\temp',
233
+							   'c:\windows\temp', 'c:\winnt\temp');
234
+
235
+		/* Try PHP's upload_tmp_dir directive. */
236
+		$tmp = ini_get('upload_tmp_dir');
237
+
238
+		/* Otherwise, try to determine the TMPDIR environment variable. */
239
+		if (!strlen($tmp)) {
240
+			$tmp = getenv('TMPDIR');
241
+		}
242
+
243
+		/* If we still cannot determine a value, then cycle through a list of
244 244
          * preset possibilities. */
245
-        while (!strlen($tmp) && count($tmp_locations)) {
246
-            $tmp_check = array_shift($tmp_locations);
247
-            if (@is_dir($tmp_check)) {
248
-                $tmp = $tmp_check;
249
-            }
250
-        }
251
-
252
-        /* If it is still empty, we have failed, so return false; otherwise
245
+		while (!strlen($tmp) && count($tmp_locations)) {
246
+			$tmp_check = array_shift($tmp_locations);
247
+			if (@is_dir($tmp_check)) {
248
+				$tmp = $tmp_check;
249
+			}
250
+		}
251
+
252
+		/* If it is still empty, we have failed, so return false; otherwise
253 253
          * return the directory determined. */
254
-        return strlen($tmp) ? $tmp : false;
255
-    }
256
-
257
-    /**
258
-     * Checks a diff for validity.
259
-     *
260
-     * This is here only for debugging purposes.
261
-     */
262
-    function _check($from_lines, $to_lines)
263
-    {
264
-        if (serialize($from_lines) != serialize($this->getOriginal())) {
265
-            trigger_error("Reconstructed original doesn't match", E_USER_ERROR);
266
-        }
267
-        if (serialize($to_lines) != serialize($this->getFinal())) {
268
-            trigger_error("Reconstructed final doesn't match", E_USER_ERROR);
269
-        }
270
-
271
-        $rev = $this->reverse();
272
-        if (serialize($to_lines) != serialize($rev->getOriginal())) {
273
-            trigger_error("Reversed original doesn't match", E_USER_ERROR);
274
-        }
275
-        if (serialize($from_lines) != serialize($rev->getFinal())) {
276
-            trigger_error("Reversed final doesn't match", E_USER_ERROR);
277
-        }
278
-
279
-        $prevtype = null;
280
-        foreach ($this->_edits as $edit) {
281
-            if ($prevtype == get_class($edit)) {
282
-                trigger_error("Edit sequence is non-optimal", E_USER_ERROR);
283
-            }
284
-            $prevtype = get_class($edit);
285
-        }
286
-
287
-        return true;
288
-    }
254
+		return strlen($tmp) ? $tmp : false;
255
+	}
256
+
257
+	/**
258
+	 * Checks a diff for validity.
259
+	 *
260
+	 * This is here only for debugging purposes.
261
+	 */
262
+	function _check($from_lines, $to_lines)
263
+	{
264
+		if (serialize($from_lines) != serialize($this->getOriginal())) {
265
+			trigger_error("Reconstructed original doesn't match", E_USER_ERROR);
266
+		}
267
+		if (serialize($to_lines) != serialize($this->getFinal())) {
268
+			trigger_error("Reconstructed final doesn't match", E_USER_ERROR);
269
+		}
270
+
271
+		$rev = $this->reverse();
272
+		if (serialize($to_lines) != serialize($rev->getOriginal())) {
273
+			trigger_error("Reversed original doesn't match", E_USER_ERROR);
274
+		}
275
+		if (serialize($from_lines) != serialize($rev->getFinal())) {
276
+			trigger_error("Reversed final doesn't match", E_USER_ERROR);
277
+		}
278
+
279
+		$prevtype = null;
280
+		foreach ($this->_edits as $edit) {
281
+			if ($prevtype == get_class($edit)) {
282
+				trigger_error("Edit sequence is non-optimal", E_USER_ERROR);
283
+			}
284
+			$prevtype = get_class($edit);
285
+		}
286
+
287
+		return true;
288
+	}
289 289
 
290 290
 }
291 291
 
@@ -295,53 +295,53 @@  discard block
 block discarded – undo
295 295
  */
296 296
 class Text_MappedDiff extends Text_Diff {
297 297
 
298
-    /**
299
-     * Computes a diff between sequences of strings.
300
-     *
301
-     * This can be used to compute things like case-insensitve diffs, or diffs
302
-     * which ignore changes in white-space.
303
-     *
304
-     * @param array $from_lines         An array of strings.
305
-     * @param array $to_lines           An array of strings.
306
-     * @param array $mapped_from_lines  This array should have the same size
307
-     *                                  number of elements as $from_lines.  The
308
-     *                                  elements in $mapped_from_lines and
309
-     *                                  $mapped_to_lines are what is actually
310
-     *                                  compared when computing the diff.
311
-     * @param array $mapped_to_lines    This array should have the same number
312
-     *                                  of elements as $to_lines.
313
-     */
314
-    function __construct($from_lines, $to_lines,
315
-                             $mapped_from_lines, $mapped_to_lines)
316
-    {
317
-        assert(count($from_lines) == count($mapped_from_lines));
318
-        assert(count($to_lines) == count($mapped_to_lines));
319
-
320
-        parent::Text_Diff($mapped_from_lines, $mapped_to_lines);
321
-
322
-        $xi = $yi = 0;
323
-        for ($i = 0; $i < count($this->_edits); $i++) {
324
-            $orig = &$this->_edits[$i]->orig;
325
-            if (is_array($orig)) {
326
-                $orig = array_slice($from_lines, $xi, count($orig));
327
-                $xi += count($orig);
328
-            }
329
-
330
-            $final = &$this->_edits[$i]->final;
331
-            if (is_array($final)) {
332
-                $final = array_slice($to_lines, $yi, count($final));
333
-                $yi += count($final);
334
-            }
335
-        }
336
-    }
298
+	/**
299
+	 * Computes a diff between sequences of strings.
300
+	 *
301
+	 * This can be used to compute things like case-insensitve diffs, or diffs
302
+	 * which ignore changes in white-space.
303
+	 *
304
+	 * @param array $from_lines         An array of strings.
305
+	 * @param array $to_lines           An array of strings.
306
+	 * @param array $mapped_from_lines  This array should have the same size
307
+	 *                                  number of elements as $from_lines.  The
308
+	 *                                  elements in $mapped_from_lines and
309
+	 *                                  $mapped_to_lines are what is actually
310
+	 *                                  compared when computing the diff.
311
+	 * @param array $mapped_to_lines    This array should have the same number
312
+	 *                                  of elements as $to_lines.
313
+	 */
314
+	function __construct($from_lines, $to_lines,
315
+							 $mapped_from_lines, $mapped_to_lines)
316
+	{
317
+		assert(count($from_lines) == count($mapped_from_lines));
318
+		assert(count($to_lines) == count($mapped_to_lines));
319
+
320
+		parent::Text_Diff($mapped_from_lines, $mapped_to_lines);
321
+
322
+		$xi = $yi = 0;
323
+		for ($i = 0; $i < count($this->_edits); $i++) {
324
+			$orig = &$this->_edits[$i]->orig;
325
+			if (is_array($orig)) {
326
+				$orig = array_slice($from_lines, $xi, count($orig));
327
+				$xi += count($orig);
328
+			}
329
+
330
+			$final = &$this->_edits[$i]->final;
331
+			if (is_array($final)) {
332
+				$final = array_slice($to_lines, $yi, count($final));
333
+				$yi += count($final);
334
+			}
335
+		}
336
+	}
337 337
 
338 338
 	/**
339 339
 	 * PHP4 constructor.
340 340
 	 */
341 341
 	public function Text_MappedDiff( $from_lines, $to_lines,
342
-                             $mapped_from_lines, $mapped_to_lines ) {
342
+							 $mapped_from_lines, $mapped_to_lines ) {
343 343
 		self::__construct( $from_lines, $to_lines,
344
-                             $mapped_from_lines, $mapped_to_lines );
344
+							 $mapped_from_lines, $mapped_to_lines );
345 345
 	}
346 346
 
347 347
 }
@@ -354,23 +354,23 @@  discard block
 block discarded – undo
354 354
  */
355 355
 class Text_Diff_Op {
356 356
 
357
-    var $orig;
358
-    var $final;
357
+	var $orig;
358
+	var $final;
359 359
 
360
-    function &reverse()
361
-    {
362
-        trigger_error('Abstract method', E_USER_ERROR);
363
-    }
360
+	function &reverse()
361
+	{
362
+		trigger_error('Abstract method', E_USER_ERROR);
363
+	}
364 364
 
365
-    function norig()
366
-    {
367
-        return $this->orig ? count($this->orig) : 0;
368
-    }
365
+	function norig()
366
+	{
367
+		return $this->orig ? count($this->orig) : 0;
368
+	}
369 369
 
370
-    function nfinal()
371
-    {
372
-        return $this->final ? count($this->final) : 0;
373
-    }
370
+	function nfinal()
371
+	{
372
+		return $this->final ? count($this->final) : 0;
373
+	}
374 374
 
375 375
 }
376 376
 
@@ -385,14 +385,14 @@  discard block
 block discarded – undo
385 385
 	/**
386 386
 	 * PHP5 constructor.
387 387
 	 */
388
-    function __construct( $orig, $final = false )
389
-    {
390
-        if (!is_array($final)) {
391
-            $final = $orig;
392
-        }
393
-        $this->orig = $orig;
394
-        $this->final = $final;
395
-    }
388
+	function __construct( $orig, $final = false )
389
+	{
390
+		if (!is_array($final)) {
391
+			$final = $orig;
392
+		}
393
+		$this->orig = $orig;
394
+		$this->final = $final;
395
+	}
396 396
 
397 397
 	/**
398 398
 	 * PHP4 constructor.
@@ -401,11 +401,11 @@  discard block
 block discarded – undo
401 401
 		self::__construct( $orig, $final );
402 402
 	}
403 403
 
404
-    function &reverse()
405
-    {
406
-        $reverse = new Text_Diff_Op_copy($this->final, $this->orig);
407
-        return $reverse;
408
-    }
404
+	function &reverse()
405
+	{
406
+		$reverse = new Text_Diff_Op_copy($this->final, $this->orig);
407
+		return $reverse;
408
+	}
409 409
 
410 410
 }
411 411
 
@@ -421,10 +421,10 @@  discard block
 block discarded – undo
421 421
 	 * PHP5 constructor.
422 422
 	 */
423 423
 	function __construct( $lines )
424
-    {
425
-        $this->orig = $lines;
426
-        $this->final = false;
427
-    }
424
+	{
425
+		$this->orig = $lines;
426
+		$this->final = false;
427
+	}
428 428
 
429 429
 	/**
430 430
 	 * PHP4 constructor.
@@ -433,11 +433,11 @@  discard block
 block discarded – undo
433 433
 		self::__construct( $lines );
434 434
 	}
435 435
 
436
-    function &reverse()
437
-    {
438
-        $reverse = new Text_Diff_Op_add($this->orig);
439
-        return $reverse;
440
-    }
436
+	function &reverse()
437
+	{
438
+		$reverse = new Text_Diff_Op_add($this->orig);
439
+		return $reverse;
440
+	}
441 441
 
442 442
 }
443 443
 
@@ -452,11 +452,11 @@  discard block
 block discarded – undo
452 452
 	/**
453 453
 	 * PHP5 constructor.
454 454
 	 */
455
-    function __construct( $lines )
456
-    {
457
-        $this->final = $lines;
458
-        $this->orig = false;
459
-    }
455
+	function __construct( $lines )
456
+	{
457
+		$this->final = $lines;
458
+		$this->orig = false;
459
+	}
460 460
 
461 461
 	/**
462 462
 	 * PHP4 constructor.
@@ -465,11 +465,11 @@  discard block
 block discarded – undo
465 465
 		self::__construct( $lines );
466 466
 	}
467 467
 
468
-    function &reverse()
469
-    {
470
-        $reverse = new Text_Diff_Op_delete($this->final);
471
-        return $reverse;
472
-    }
468
+	function &reverse()
469
+	{
470
+		$reverse = new Text_Diff_Op_delete($this->final);
471
+		return $reverse;
472
+	}
473 473
 
474 474
 }
475 475
 
@@ -484,11 +484,11 @@  discard block
 block discarded – undo
484 484
 	/**
485 485
 	 * PHP5 constructor.
486 486
 	 */
487
-    function __construct( $orig, $final )
488
-    {
489
-        $this->orig = $orig;
490
-        $this->final = $final;
491
-    }
487
+	function __construct( $orig, $final )
488
+	{
489
+		$this->orig = $orig;
490
+		$this->final = $final;
491
+	}
492 492
 
493 493
 	/**
494 494
 	 * PHP4 constructor.
@@ -497,10 +497,10 @@  discard block
 block discarded – undo
497 497
 		self::__construct( $orig, $final );
498 498
 	}
499 499
 
500
-    function &reverse()
501
-    {
502
-        $reverse = new Text_Diff_Op_change($this->final, $this->orig);
503
-        return $reverse;
504
-    }
500
+	function &reverse()
501
+	{
502
+		$reverse = new Text_Diff_Op_change($this->final, $this->orig);
503
+		return $reverse;
504
+	}
505 505
 
506 506
 }
Please login to merge, or discard this patch.
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -33,10 +33,10 @@  discard block
 block discarded – undo
33 33
      *                           Normally an array of two arrays, each
34 34
      *                           containing the lines from a file.
35 35
      */
36
-    function __construct( $engine, $params )
36
+    function __construct($engine, $params)
37 37
     {
38 38
         // Backward compatibility workaround.
39
-        if (!is_string($engine)) {
39
+        if ( ! is_string($engine)) {
40 40
             $params = array($engine, $params);
41 41
             $engine = 'auto';
42 42
         }
@@ -48,8 +48,8 @@  discard block
 block discarded – undo
48 48
         }
49 49
 
50 50
         // WP #7391
51
-        require_once dirname(__FILE__).'/Diff/Engine/' . $engine . '.php';
52
-        $class = 'Text_Diff_Engine_' . $engine;
51
+        require_once dirname(__FILE__).'/Diff/Engine/'.$engine.'.php';
52
+        $class = 'Text_Diff_Engine_'.$engine;
53 53
         $diff_engine = new $class();
54 54
 
55 55
         $this->_edits = call_user_func_array(array($diff_engine, 'diff'), $params);
@@ -58,8 +58,8 @@  discard block
 block discarded – undo
58 58
 	/**
59 59
 	 * PHP4 constructor.
60 60
 	 */
61
-	public function Text_Diff( $engine, $params ) {
62
-		self::__construct( $engine, $params );
61
+	public function Text_Diff($engine, $params) {
62
+		self::__construct($engine, $params);
63 63
 	}
64 64
 
65 65
     /**
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
     function isEmpty()
145 145
     {
146 146
         foreach ($this->_edits as $edit) {
147
-            if (!is_a($edit, 'Text_Diff_Op_copy')) {
147
+            if ( ! is_a($edit, 'Text_Diff_Op_copy')) {
148 148
                 return false;
149 149
             }
150 150
         }
@@ -236,13 +236,13 @@  discard block
 block discarded – undo
236 236
         $tmp = ini_get('upload_tmp_dir');
237 237
 
238 238
         /* Otherwise, try to determine the TMPDIR environment variable. */
239
-        if (!strlen($tmp)) {
239
+        if ( ! strlen($tmp)) {
240 240
             $tmp = getenv('TMPDIR');
241 241
         }
242 242
 
243 243
         /* If we still cannot determine a value, then cycle through a list of
244 244
          * preset possibilities. */
245
-        while (!strlen($tmp) && count($tmp_locations)) {
245
+        while ( ! strlen($tmp) && count($tmp_locations)) {
246 246
             $tmp_check = array_shift($tmp_locations);
247 247
             if (@is_dir($tmp_check)) {
248 248
                 $tmp = $tmp_check;
@@ -338,10 +338,10 @@  discard block
 block discarded – undo
338 338
 	/**
339 339
 	 * PHP4 constructor.
340 340
 	 */
341
-	public function Text_MappedDiff( $from_lines, $to_lines,
342
-                             $mapped_from_lines, $mapped_to_lines ) {
343
-		self::__construct( $from_lines, $to_lines,
344
-                             $mapped_from_lines, $mapped_to_lines );
341
+	public function Text_MappedDiff($from_lines, $to_lines,
342
+                             $mapped_from_lines, $mapped_to_lines) {
343
+		self::__construct($from_lines, $to_lines,
344
+                             $mapped_from_lines, $mapped_to_lines);
345 345
 	}
346 346
 
347 347
 }
@@ -385,9 +385,9 @@  discard block
 block discarded – undo
385 385
 	/**
386 386
 	 * PHP5 constructor.
387 387
 	 */
388
-    function __construct( $orig, $final = false )
388
+    function __construct($orig, $final = false)
389 389
     {
390
-        if (!is_array($final)) {
390
+        if ( ! is_array($final)) {
391 391
             $final = $orig;
392 392
         }
393 393
         $this->orig = $orig;
@@ -397,8 +397,8 @@  discard block
 block discarded – undo
397 397
 	/**
398 398
 	 * PHP4 constructor.
399 399
 	 */
400
-	public function Text_Diff_Op_copy( $orig, $final = false ) {
401
-		self::__construct( $orig, $final );
400
+	public function Text_Diff_Op_copy($orig, $final = false) {
401
+		self::__construct($orig, $final);
402 402
 	}
403 403
 
404 404
     function &reverse()
@@ -420,7 +420,7 @@  discard block
 block discarded – undo
420 420
 	/**
421 421
 	 * PHP5 constructor.
422 422
 	 */
423
-	function __construct( $lines )
423
+	function __construct($lines)
424 424
     {
425 425
         $this->orig = $lines;
426 426
         $this->final = false;
@@ -429,8 +429,8 @@  discard block
 block discarded – undo
429 429
 	/**
430 430
 	 * PHP4 constructor.
431 431
 	 */
432
-	public function Text_Diff_Op_delete( $lines ) {
433
-		self::__construct( $lines );
432
+	public function Text_Diff_Op_delete($lines) {
433
+		self::__construct($lines);
434 434
 	}
435 435
 
436 436
     function &reverse()
@@ -452,7 +452,7 @@  discard block
 block discarded – undo
452 452
 	/**
453 453
 	 * PHP5 constructor.
454 454
 	 */
455
-    function __construct( $lines )
455
+    function __construct($lines)
456 456
     {
457 457
         $this->final = $lines;
458 458
         $this->orig = false;
@@ -461,8 +461,8 @@  discard block
 block discarded – undo
461 461
 	/**
462 462
 	 * PHP4 constructor.
463 463
 	 */
464
-	public function Text_Diff_Op_add( $lines ) {
465
-		self::__construct( $lines );
464
+	public function Text_Diff_Op_add($lines) {
465
+		self::__construct($lines);
466 466
 	}
467 467
 
468 468
     function &reverse()
@@ -484,7 +484,7 @@  discard block
 block discarded – undo
484 484
 	/**
485 485
 	 * PHP5 constructor.
486 486
 	 */
487
-    function __construct( $orig, $final )
487
+    function __construct($orig, $final)
488 488
     {
489 489
         $this->orig = $orig;
490 490
         $this->final = $final;
@@ -493,8 +493,8 @@  discard block
 block discarded – undo
493 493
 	/**
494 494
 	 * PHP4 constructor.
495 495
 	 */
496
-	public function Text_Diff_Op_change( $orig, $final ) {
497
-		self::__construct( $orig, $final );
496
+	public function Text_Diff_Op_change($orig, $final) {
497
+		self::__construct($orig, $final);
498 498
 	}
499 499
 
500 500
     function &reverse()
Please login to merge, or discard this patch.
src/wp-includes/class-simplepie.php 3 patches
Braces   +92 added lines, -180 removed lines patch added patch discarded remove patch
@@ -22,8 +22,9 @@  discard block
 block discarded – undo
22 22
  * @since 3.5.0
23 23
  */
24 24
 function wp_simplepie_autoload( $class ) {
25
-	if ( 0 !== strpos( $class, 'SimplePie_' ) )
26
-		return;
25
+	if ( 0 !== strpos( $class, 'SimplePie_' ) ) {
26
+			return;
27
+	}
27 28
 
28 29
 	$file = ABSPATH . WPINC . '/' . str_replace( '_', '/', $class ) . '.php';
29 30
 	include( $file );
@@ -784,8 +785,7 @@  discard block
 block discarded – undo
784 785
 			{
785 786
 				$this->multifeed_url[] = $this->registry->call('Misc', 'fix_protocol', array($value, 1));
786 787
 			}
787
-		}
788
-		else
788
+		} else
789 789
 		{
790 790
 			$this->feed_url = $this->registry->call('Misc', 'fix_protocol', array($url, 1));
791 791
 		}
@@ -920,8 +920,7 @@  discard block
 block discarded – undo
920 920
 		if ($encoding)
921 921
 		{
922 922
 			$this->input_encoding = (string) $encoding;
923
-		}
924
-		else
923
+		} else
925 924
 		{
926 925
 			$this->input_encoding = false;
927 926
 		}
@@ -1238,8 +1237,7 @@  discard block
 block discarded – undo
1238 1237
 		if ($page !== false)
1239 1238
 		{
1240 1239
 			$this->sanitize->set_image_handler($page . '?' . $qs . '=');
1241
-		}
1242
-		else
1240
+		} else
1243 1241
 		{
1244 1242
 			$this->image_handler = '';
1245 1243
 		}
@@ -1317,8 +1315,7 @@  discard block
 block discarded – undo
1317 1315
 				$i++;
1318 1316
 			}
1319 1317
 			return (bool) $success;
1320
-		}
1321
-		elseif ($this->feed_url === null && $this->raw_data === null)
1318
+		} elseif ($this->feed_url === null && $this->raw_data === null)
1322 1319
 		{
1323 1320
 			return false;
1324 1321
 		}
@@ -1342,8 +1339,7 @@  discard block
 block discarded – undo
1342 1339
 			if (($fetched = $this->fetch_data($cache)) === true)
1343 1340
 			{
1344 1341
 				return true;
1345
-			}
1346
-			elseif ($fetched === false) {
1342
+			} elseif ($fetched === false) {
1347 1343
 				return false;
1348 1344
 			}
1349 1345
 
@@ -1373,8 +1369,7 @@  discard block
 block discarded – undo
1373 1369
 				}
1374 1370
 				$encodings = array_merge($encodings, $this->registry->call('Misc', 'xml_encoding', array($this->raw_data, &$this->registry)));
1375 1371
 				$encodings[] = 'UTF-8';
1376
-			}
1377
-			elseif (in_array($sniffed, $text_types) || substr($sniffed, 0, 5) === 'text/' && substr($sniffed, -4) === '+xml')
1372
+			} elseif (in_array($sniffed, $text_types) || substr($sniffed, 0, 5) === 'text/' && substr($sniffed, -4) === '+xml')
1378 1373
 			{
1379 1374
 				if (isset($headers['content-type']) && preg_match('/;\x20?charset=([^;]*)/i', $headers['content-type'], $charset))
1380 1375
 				{
@@ -1437,8 +1432,7 @@  discard block
 block discarded – undo
1437 1432
 		{
1438 1433
 			// We have an error, just set SimplePie_Misc::error to it and quit
1439 1434
 			$this->error = sprintf('This XML document is invalid, likely due to invalid characters. XML error: %s at line %d, column %d', $parser->get_error_string(), $parser->get_current_line(), $parser->get_current_column());
1440
-		}
1441
-		else
1435
+		} else
1442 1436
 		{
1443 1437
 			$this->error = 'The data could not be converted to UTF-8. You MUST have either the iconv or mbstring extension installed. Upgrading to PHP 5.x (which includes iconv) is highly recommended.';
1444 1438
 		}
@@ -1520,8 +1514,7 @@  discard block
 block discarded – undo
1520 1514
 								$cache->touch();
1521 1515
 								return true;
1522 1516
 							}
1523
-						}
1524
-						else
1517
+						} else
1525 1518
 						{
1526 1519
 							unset($file);
1527 1520
 						}
@@ -1547,8 +1540,7 @@  discard block
 block discarded – undo
1547 1540
 			if ($this->file instanceof SimplePie_File && $this->file->url === $this->feed_url)
1548 1541
 			{
1549 1542
 				$file =& $this->file;
1550
-			}
1551
-			else
1543
+			} else
1552 1544
 			{
1553 1545
 				$headers = array(
1554 1546
 					'Accept' => 'application/atom+xml, application/rss+xml, application/rdf+xml;q=0.9, application/xml;q=0.8, text/xml;q=0.8, text/html;q=0.7, unknown/unknown;q=0.1, application/unknown;q=0.1, */*;q=0.1',
@@ -1580,8 +1572,7 @@  discard block
 block discarded – undo
1580 1572
 						$this->registry->call('Misc', 'error', array($this->error, E_USER_NOTICE, __FILE__, __LINE__));
1581 1573
 						return false;
1582 1574
 					}
1583
-				}
1584
-				catch (SimplePie_Exception $e)
1575
+				} catch (SimplePie_Exception $e)
1585 1576
 				{
1586 1577
 					// This is usually because DOMDocument doesn't exist
1587 1578
 					$this->error = $e->getMessage();
@@ -1672,8 +1663,7 @@  discard block
 block discarded – undo
1672 1663
 			if ($this->get_encoding())
1673 1664
 			{
1674 1665
 				$header .= ' charset=' . $this->get_encoding();
1675
-			}
1676
-			else
1666
+			} else
1677 1667
 			{
1678 1668
 				$header .= ' charset=UTF-8';
1679 1669
 			}
@@ -1715,12 +1705,10 @@  discard block
 block discarded – undo
1715 1705
 			if (isset($this->data['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['feed']))
1716 1706
 			{
1717 1707
 				$this->data['type'] &= SIMPLEPIE_TYPE_ATOM_10;
1718
-			}
1719
-			elseif (isset($this->data['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['feed']))
1708
+			} elseif (isset($this->data['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['feed']))
1720 1709
 			{
1721 1710
 				$this->data['type'] &= SIMPLEPIE_TYPE_ATOM_03;
1722
-			}
1723
-			elseif (isset($this->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF']))
1711
+			} elseif (isset($this->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF']))
1724 1712
 			{
1725 1713
 				if (isset($this->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0]['child'][SIMPLEPIE_NAMESPACE_RSS_10]['channel'])
1726 1714
 				|| isset($this->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0]['child'][SIMPLEPIE_NAMESPACE_RSS_10]['image'])
@@ -1736,8 +1724,7 @@  discard block
 block discarded – undo
1736 1724
 				{
1737 1725
 					$this->data['type'] &= SIMPLEPIE_TYPE_RSS_090;
1738 1726
 				}
1739
-			}
1740
-			elseif (isset($this->data['child'][SIMPLEPIE_NAMESPACE_RSS_20]['rss']))
1727
+			} elseif (isset($this->data['child'][SIMPLEPIE_NAMESPACE_RSS_20]['rss']))
1741 1728
 			{
1742 1729
 				$this->data['type'] &= SIMPLEPIE_TYPE_RSS_ALL;
1743 1730
 				if (isset($this->data['child'][SIMPLEPIE_NAMESPACE_RSS_20]['rss'][0]['attribs']['']['version']))
@@ -1778,8 +1765,7 @@  discard block
 block discarded – undo
1778 1765
 							break;
1779 1766
 					}
1780 1767
 				}
1781
-			}
1782
-			else
1768
+			} else
1783 1769
 			{
1784 1770
 				$this->data['type'] = SIMPLEPIE_TYPE_NONE;
1785 1771
 			}
@@ -1804,8 +1790,7 @@  discard block
 block discarded – undo
1804 1790
 		if ($this->feed_url !== null)
1805 1791
 		{
1806 1792
 			return $this->sanitize($this->feed_url, SIMPLEPIE_CONSTRUCT_IRI);
1807
-		}
1808
-		else
1793
+		} else
1809 1794
 		{
1810 1795
 			return null;
1811 1796
 		}
@@ -2000,12 +1985,10 @@  discard block
 block discarded – undo
2000 1985
 		if (!($this->get_type() & SIMPLEPIE_TYPE_RSS_SYNDICATION) && !empty($element['xml_base_explicit']) && isset($element['xml_base']))
2001 1986
 		{
2002 1987
 			return $element['xml_base'];
2003
-		}
2004
-		elseif ($this->get_link() !== null)
1988
+		} elseif ($this->get_link() !== null)
2005 1989
 		{
2006 1990
 			return $this->get_link();
2007
-		}
2008
-		else
1991
+		} else
2009 1992
 		{
2010 1993
 			return $this->subscribe_url();
2011 1994
 		}
@@ -2039,32 +2022,25 @@  discard block
 block discarded – undo
2039 2022
 		if ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'title'))
2040 2023
 		{
2041 2024
 			return $this->sanitize($return[0]['data'], $this->registry->call('Misc', 'atom_10_construct_type', array($return[0]['attribs'])), $this->get_base($return[0]));
2042
-		}
2043
-		elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'title'))
2025
+		} elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'title'))
2044 2026
 		{
2045 2027
 			return $this->sanitize($return[0]['data'], $this->registry->call('Misc', 'atom_03_construct_type', array($return[0]['attribs'])), $this->get_base($return[0]));
2046
-		}
2047
-		elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'title'))
2028
+		} elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'title'))
2048 2029
 		{
2049 2030
 			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0]));
2050
-		}
2051
-		elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'title'))
2031
+		} elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'title'))
2052 2032
 		{
2053 2033
 			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0]));
2054
-		}
2055
-		elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'title'))
2034
+		} elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'title'))
2056 2035
 		{
2057 2036
 			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0]));
2058
-		}
2059
-		elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_DC_11, 'title'))
2037
+		} elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_DC_11, 'title'))
2060 2038
 		{
2061 2039
 			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
2062
-		}
2063
-		elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_DC_10, 'title'))
2040
+		} elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_DC_10, 'title'))
2064 2041
 		{
2065 2042
 			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
2066
-		}
2067
-		else
2043
+		} else
2068 2044
 		{
2069 2045
 			return null;
2070 2046
 		}
@@ -2083,8 +2059,7 @@  discard block
 block discarded – undo
2083 2059
 		if (isset($categories[$key]))
2084 2060
 		{
2085 2061
 			return $categories[$key];
2086
-		}
2087
-		else
2062
+		} else
2088 2063
 		{
2089 2064
 			return null;
2090 2065
 		}
@@ -2129,8 +2104,7 @@  discard block
 block discarded – undo
2129 2104
 			if (isset($category['attribs']['']['domain']))
2130 2105
 			{
2131 2106
 				$scheme = $this->sanitize($category['attribs']['']['domain'], SIMPLEPIE_CONSTRUCT_TEXT);
2132
-			}
2133
-			else
2107
+			} else
2134 2108
 			{
2135 2109
 				$scheme = null;
2136 2110
 			}
@@ -2148,8 +2122,7 @@  discard block
 block discarded – undo
2148 2122
 		if (!empty($categories))
2149 2123
 		{
2150 2124
 			return array_unique($categories);
2151
-		}
2152
-		else
2125
+		} else
2153 2126
 		{
2154 2127
 			return null;
2155 2128
 		}
@@ -2168,8 +2141,7 @@  discard block
 block discarded – undo
2168 2141
 		if (isset($authors[$key]))
2169 2142
 		{
2170 2143
 			return $authors[$key];
2171
-		}
2172
-		else
2144
+		} else
2173 2145
 		{
2174 2146
 			return null;
2175 2147
 		}
@@ -2246,8 +2218,7 @@  discard block
 block discarded – undo
2246 2218
 		if (!empty($authors))
2247 2219
 		{
2248 2220
 			return array_unique($authors);
2249
-		}
2250
-		else
2221
+		} else
2251 2222
 		{
2252 2223
 			return null;
2253 2224
 		}
@@ -2266,8 +2237,7 @@  discard block
 block discarded – undo
2266 2237
 		if (isset($contributors[$key]))
2267 2238
 		{
2268 2239
 			return $contributors[$key];
2269
-		}
2270
-		else
2240
+		} else
2271 2241
 		{
2272 2242
 			return null;
2273 2243
 		}
@@ -2332,8 +2302,7 @@  discard block
 block discarded – undo
2332 2302
 		if (!empty($contributors))
2333 2303
 		{
2334 2304
 			return array_unique($contributors);
2335
-		}
2336
-		else
2305
+		} else
2337 2306
 		{
2338 2307
 			return null;
2339 2308
 		}
@@ -2353,8 +2322,7 @@  discard block
 block discarded – undo
2353 2322
 		if (isset($links[$key]))
2354 2323
 		{
2355 2324
 			return $links[$key];
2356
-		}
2357
-		else
2325
+		} else
2358 2326
 		{
2359 2327
 			return null;
2360 2328
 		}
@@ -2435,13 +2403,11 @@  discard block
 block discarded – undo
2435 2403
 					{
2436 2404
 						$this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key] = array_merge($this->data['links'][$key], $this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key]);
2437 2405
 						$this->data['links'][$key] =& $this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key];
2438
-					}
2439
-					else
2406
+					} else
2440 2407
 					{
2441 2408
 						$this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key] =& $this->data['links'][$key];
2442 2409
 					}
2443
-				}
2444
-				elseif (substr($key, 0, 41) === SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY)
2410
+				} elseif (substr($key, 0, 41) === SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY)
2445 2411
 				{
2446 2412
 					$this->data['links'][substr($key, 41)] =& $this->data['links'][$key];
2447 2413
 				}
@@ -2452,8 +2418,7 @@  discard block
 block discarded – undo
2452 2418
 		if (isset($this->data['links'][$rel]))
2453 2419
 		{
2454 2420
 			return $this->data['links'][$rel];
2455
-		}
2456
-		else
2421
+		} else
2457 2422
 		{
2458 2423
 			return null;
2459 2424
 		}
@@ -2478,40 +2443,31 @@  discard block
 block discarded – undo
2478 2443
 		if ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'subtitle'))
2479 2444
 		{
2480 2445
 			return $this->sanitize($return[0]['data'], $this->registry->call('Misc', 'atom_10_construct_type', array($return[0]['attribs'])), $this->get_base($return[0]));
2481
-		}
2482
-		elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'tagline'))
2446
+		} elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'tagline'))
2483 2447
 		{
2484 2448
 			return $this->sanitize($return[0]['data'], $this->registry->call('Misc', 'atom_03_construct_type', array($return[0]['attribs'])), $this->get_base($return[0]));
2485
-		}
2486
-		elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'description'))
2449
+		} elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'description'))
2487 2450
 		{
2488 2451
 			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0]));
2489
-		}
2490
-		elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'description'))
2452
+		} elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'description'))
2491 2453
 		{
2492 2454
 			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0]));
2493
-		}
2494
-		elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'description'))
2455
+		} elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'description'))
2495 2456
 		{
2496 2457
 			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_HTML, $this->get_base($return[0]));
2497
-		}
2498
-		elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_DC_11, 'description'))
2458
+		} elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_DC_11, 'description'))
2499 2459
 		{
2500 2460
 			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
2501
-		}
2502
-		elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_DC_10, 'description'))
2461
+		} elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_DC_10, 'description'))
2503 2462
 		{
2504 2463
 			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
2505
-		}
2506
-		elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'summary'))
2464
+		} elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'summary'))
2507 2465
 		{
2508 2466
 			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_HTML, $this->get_base($return[0]));
2509
-		}
2510
-		elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'subtitle'))
2467
+		} elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'subtitle'))
2511 2468
 		{
2512 2469
 			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_HTML, $this->get_base($return[0]));
2513
-		}
2514
-		else
2470
+		} else
2515 2471
 		{
2516 2472
 			return null;
2517 2473
 		}
@@ -2530,24 +2486,19 @@  discard block
 block discarded – undo
2530 2486
 		if ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'rights'))
2531 2487
 		{
2532 2488
 			return $this->sanitize($return[0]['data'], $this->registry->call('Misc', 'atom_10_construct_type', array($return[0]['attribs'])), $this->get_base($return[0]));
2533
-		}
2534
-		elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'copyright'))
2489
+		} elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'copyright'))
2535 2490
 		{
2536 2491
 			return $this->sanitize($return[0]['data'], $this->registry->call('Misc', 'atom_03_construct_type', array($return[0]['attribs'])), $this->get_base($return[0]));
2537
-		}
2538
-		elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'copyright'))
2492
+		} elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'copyright'))
2539 2493
 		{
2540 2494
 			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
2541
-		}
2542
-		elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_DC_11, 'rights'))
2495
+		} elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_DC_11, 'rights'))
2543 2496
 		{
2544 2497
 			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
2545
-		}
2546
-		elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_DC_10, 'rights'))
2498
+		} elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_DC_10, 'rights'))
2547 2499
 		{
2548 2500
 			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
2549
-		}
2550
-		else
2501
+		} else
2551 2502
 		{
2552 2503
 			return null;
2553 2504
 		}
@@ -2566,32 +2517,25 @@  discard block
 block discarded – undo
2566 2517
 		if ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'language'))
2567 2518
 		{
2568 2519
 			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
2569
-		}
2570
-		elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_DC_11, 'language'))
2520
+		} elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_DC_11, 'language'))
2571 2521
 		{
2572 2522
 			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
2573
-		}
2574
-		elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_DC_10, 'language'))
2523
+		} elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_DC_10, 'language'))
2575 2524
 		{
2576 2525
 			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
2577
-		}
2578
-		elseif (isset($this->data['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['feed'][0]['xml_lang']))
2526
+		} elseif (isset($this->data['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['feed'][0]['xml_lang']))
2579 2527
 		{
2580 2528
 			return $this->sanitize($this->data['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['feed'][0]['xml_lang'], SIMPLEPIE_CONSTRUCT_TEXT);
2581
-		}
2582
-		elseif (isset($this->data['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['feed'][0]['xml_lang']))
2529
+		} elseif (isset($this->data['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['feed'][0]['xml_lang']))
2583 2530
 		{
2584 2531
 			return $this->sanitize($this->data['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['feed'][0]['xml_lang'], SIMPLEPIE_CONSTRUCT_TEXT);
2585
-		}
2586
-		elseif (isset($this->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0]['xml_lang']))
2532
+		} elseif (isset($this->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0]['xml_lang']))
2587 2533
 		{
2588 2534
 			return $this->sanitize($this->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0]['xml_lang'], SIMPLEPIE_CONSTRUCT_TEXT);
2589
-		}
2590
-		elseif (isset($this->data['headers']['content-language']))
2535
+		} elseif (isset($this->data['headers']['content-language']))
2591 2536
 		{
2592 2537
 			return $this->sanitize($this->data['headers']['content-language'], SIMPLEPIE_CONSTRUCT_TEXT);
2593
-		}
2594
-		else
2538
+		} else
2595 2539
 		{
2596 2540
 			return null;
2597 2541
 		}
@@ -2615,12 +2559,10 @@  discard block
 block discarded – undo
2615 2559
 		if ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_W3C_BASIC_GEO, 'lat'))
2616 2560
 		{
2617 2561
 			return (float) $return[0]['data'];
2618
-		}
2619
-		elseif (($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_GEORSS, 'point')) && preg_match('/^((?:-)?[0-9]+(?:\.[0-9]+)) ((?:-)?[0-9]+(?:\.[0-9]+))$/', trim($return[0]['data']), $match))
2562
+		} elseif (($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_GEORSS, 'point')) && preg_match('/^((?:-)?[0-9]+(?:\.[0-9]+)) ((?:-)?[0-9]+(?:\.[0-9]+))$/', trim($return[0]['data']), $match))
2620 2563
 		{
2621 2564
 			return (float) $match[1];
2622
-		}
2623
-		else
2565
+		} else
2624 2566
 		{
2625 2567
 			return null;
2626 2568
 		}
@@ -2643,16 +2585,13 @@  discard block
 block discarded – undo
2643 2585
 		if ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_W3C_BASIC_GEO, 'long'))
2644 2586
 		{
2645 2587
 			return (float) $return[0]['data'];
2646
-		}
2647
-		elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_W3C_BASIC_GEO, 'lon'))
2588
+		} elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_W3C_BASIC_GEO, 'lon'))
2648 2589
 		{
2649 2590
 			return (float) $return[0]['data'];
2650
-		}
2651
-		elseif (($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_GEORSS, 'point')) && preg_match('/^((?:-)?[0-9]+(?:\.[0-9]+)) ((?:-)?[0-9]+(?:\.[0-9]+))$/', trim($return[0]['data']), $match))
2591
+		} elseif (($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_GEORSS, 'point')) && preg_match('/^((?:-)?[0-9]+(?:\.[0-9]+)) ((?:-)?[0-9]+(?:\.[0-9]+))$/', trim($return[0]['data']), $match))
2652 2592
 		{
2653 2593
 			return (float) $match[2];
2654
-		}
2655
-		else
2594
+		} else
2656 2595
 		{
2657 2596
 			return null;
2658 2597
 		}
@@ -2672,24 +2611,19 @@  discard block
 block discarded – undo
2672 2611
 		if ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'title'))
2673 2612
 		{
2674 2613
 			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
2675
-		}
2676
-		elseif ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'title'))
2614
+		} elseif ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'title'))
2677 2615
 		{
2678 2616
 			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
2679
-		}
2680
-		elseif ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'title'))
2617
+		} elseif ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'title'))
2681 2618
 		{
2682 2619
 			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
2683
-		}
2684
-		elseif ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_DC_11, 'title'))
2620
+		} elseif ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_DC_11, 'title'))
2685 2621
 		{
2686 2622
 			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
2687
-		}
2688
-		elseif ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_DC_10, 'title'))
2623
+		} elseif ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_DC_10, 'title'))
2689 2624
 		{
2690 2625
 			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
2691
-		}
2692
-		else
2626
+		} else
2693 2627
 		{
2694 2628
 			return null;
2695 2629
 		}
@@ -2711,28 +2645,22 @@  discard block
 block discarded – undo
2711 2645
 		if ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'image'))
2712 2646
 		{
2713 2647
 			return $this->sanitize($return[0]['attribs']['']['href'], SIMPLEPIE_CONSTRUCT_IRI);
2714
-		}
2715
-		elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'logo'))
2648
+		} elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'logo'))
2716 2649
 		{
2717 2650
 			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($return[0]));
2718
-		}
2719
-		elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'icon'))
2651
+		} elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'icon'))
2720 2652
 		{
2721 2653
 			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($return[0]));
2722
-		}
2723
-		elseif ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'url'))
2654
+		} elseif ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'url'))
2724 2655
 		{
2725 2656
 			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($return[0]));
2726
-		}
2727
-		elseif ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'url'))
2657
+		} elseif ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'url'))
2728 2658
 		{
2729 2659
 			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($return[0]));
2730
-		}
2731
-		elseif ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'url'))
2660
+		} elseif ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'url'))
2732 2661
 		{
2733 2662
 			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($return[0]));
2734
-		}
2735
-		else
2663
+		} else
2736 2664
 		{
2737 2665
 			return null;
2738 2666
 		}
@@ -2755,16 +2683,13 @@  discard block
 block discarded – undo
2755 2683
 		if ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'link'))
2756 2684
 		{
2757 2685
 			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($return[0]));
2758
-		}
2759
-		elseif ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'link'))
2686
+		} elseif ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'link'))
2760 2687
 		{
2761 2688
 			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($return[0]));
2762
-		}
2763
-		elseif ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'link'))
2689
+		} elseif ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'link'))
2764 2690
 		{
2765 2691
 			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($return[0]));
2766
-		}
2767
-		else
2692
+		} else
2768 2693
 		{
2769 2694
 			return null;
2770 2695
 		}
@@ -2785,12 +2710,10 @@  discard block
 block discarded – undo
2785 2710
 		if ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'width'))
2786 2711
 		{
2787 2712
 			return round($return[0]['data']);
2788
-		}
2789
-		elseif ($this->get_type() & SIMPLEPIE_TYPE_RSS_SYNDICATION && $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'url'))
2713
+		} elseif ($this->get_type() & SIMPLEPIE_TYPE_RSS_SYNDICATION && $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'url'))
2790 2714
 		{
2791 2715
 			return 88.0;
2792
-		}
2793
-		else
2716
+		} else
2794 2717
 		{
2795 2718
 			return null;
2796 2719
 		}
@@ -2811,12 +2734,10 @@  discard block
 block discarded – undo
2811 2734
 		if ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'height'))
2812 2735
 		{
2813 2736
 			return round($return[0]['data']);
2814
-		}
2815
-		elseif ($this->get_type() & SIMPLEPIE_TYPE_RSS_SYNDICATION && $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'url'))
2737
+		} elseif ($this->get_type() & SIMPLEPIE_TYPE_RSS_SYNDICATION && $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'url'))
2816 2738
 		{
2817 2739
 			return 31.0;
2818
-		}
2819
-		else
2740
+		} else
2820 2741
 		{
2821 2742
 			return null;
2822 2743
 		}
@@ -2838,8 +2759,7 @@  discard block
 block discarded – undo
2838 2759
 		if ($max === 0)
2839 2760
 		{
2840 2761
 			return $qty;
2841
-		}
2842
-		else
2762
+		} else
2843 2763
 		{
2844 2764
 			return ($qty > $max) ? $max : $qty;
2845 2765
 		}
@@ -2863,8 +2783,7 @@  discard block
 block discarded – undo
2863 2783
 		if (isset($items[$key]))
2864 2784
 		{
2865 2785
 			return $items[$key];
2866
-		}
2867
-		else
2786
+		} else
2868 2787
 		{
2869 2788
 			return null;
2870 2789
 		}
@@ -2890,8 +2809,7 @@  discard block
 block discarded – undo
2890 2809
 			if (!empty($this->multifeed_objects))
2891 2810
 			{
2892 2811
 				$this->data['items'] = SimplePie::merge_items($this->multifeed_objects, $start, $end, $this->item_limit);
2893
-			}
2894
-			else
2812
+			} else
2895 2813
 			{
2896 2814
 				$this->data['items'] = array();
2897 2815
 				if ($items = $this->get_feed_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'entry'))
@@ -2961,8 +2879,7 @@  discard block
 block discarded – undo
2961 2879
 					}
2962 2880
 				}
2963 2881
 				$items = $this->data['ordered_items'];
2964
-			}
2965
-			else
2882
+			} else
2966 2883
 			{
2967 2884
 				$items = $this->data['items'];
2968 2885
 			}
@@ -2971,13 +2888,11 @@  discard block
 block discarded – undo
2971 2888
 			if ($end === 0)
2972 2889
 			{
2973 2890
 				return array_slice($items, $start);
2974
-			}
2975
-			else
2891
+			} else
2976 2892
 			{
2977 2893
 				return array_slice($items, $start, $end);
2978 2894
 			}
2979
-		}
2980
-		else
2895
+		} else
2981 2896
 		{
2982 2897
 			return array();
2983 2898
 		}
@@ -3078,8 +2993,7 @@  discard block
 block discarded – undo
3078 2993
 				if ($arg instanceof SimplePie)
3079 2994
 				{
3080 2995
 					$items = array_merge($items, $arg->get_items(0, $limit));
3081
-				}
3082
-				else
2996
+				} else
3083 2997
 				{
3084 2998
 					trigger_error('Arguments must be SimplePie objects', E_USER_WARNING);
3085 2999
 				}
@@ -3103,13 +3017,11 @@  discard block
 block discarded – undo
3103 3017
 			if ($end === 0)
3104 3018
 			{
3105 3019
 				return array_slice($items, $start);
3106
-			}
3107
-			else
3020
+			} else
3108 3021
 			{
3109 3022
 				return array_slice($items, $start, $end);
3110 3023
 			}
3111
-		}
3112
-		else
3024
+		} else
3113 3025
 		{
3114 3026
 			trigger_error('Cannot merge zero SimplePie objects', E_USER_WARNING);
3115 3027
 			return array();
Please login to merge, or discard this patch.
Spacing   +65 added lines, -65 removed lines patch added patch discarded remove patch
@@ -1,38 +1,38 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if ( ! class_exists( 'SimplePie', false ) ) :
2
+if ( ! class_exists('SimplePie', false)) :
3 3
 
4 4
 // Load classes we will need.
5
-require ABSPATH . WPINC . '/SimplePie/Misc.php';
6
-require ABSPATH . WPINC . '/SimplePie/Cache.php';
7
-require ABSPATH . WPINC . '/SimplePie/File.php';
8
-require ABSPATH . WPINC . '/SimplePie/Sanitize.php';
9
-require ABSPATH . WPINC . '/SimplePie/Registry.php';
10
-require ABSPATH . WPINC . '/SimplePie/IRI.php';
11
-require ABSPATH . WPINC . '/SimplePie/Locator.php';
12
-require ABSPATH . WPINC . '/SimplePie/Content/Type/Sniffer.php';
13
-require ABSPATH . WPINC . '/SimplePie/XML/Declaration/Parser.php';
14
-require ABSPATH . WPINC . '/SimplePie/Parser.php';
15
-require ABSPATH . WPINC . '/SimplePie/Item.php';
16
-require ABSPATH . WPINC . '/SimplePie/Parse/Date.php';
17
-require ABSPATH . WPINC . '/SimplePie/Author.php';
5
+require ABSPATH.WPINC.'/SimplePie/Misc.php';
6
+require ABSPATH.WPINC.'/SimplePie/Cache.php';
7
+require ABSPATH.WPINC.'/SimplePie/File.php';
8
+require ABSPATH.WPINC.'/SimplePie/Sanitize.php';
9
+require ABSPATH.WPINC.'/SimplePie/Registry.php';
10
+require ABSPATH.WPINC.'/SimplePie/IRI.php';
11
+require ABSPATH.WPINC.'/SimplePie/Locator.php';
12
+require ABSPATH.WPINC.'/SimplePie/Content/Type/Sniffer.php';
13
+require ABSPATH.WPINC.'/SimplePie/XML/Declaration/Parser.php';
14
+require ABSPATH.WPINC.'/SimplePie/Parser.php';
15
+require ABSPATH.WPINC.'/SimplePie/Item.php';
16
+require ABSPATH.WPINC.'/SimplePie/Parse/Date.php';
17
+require ABSPATH.WPINC.'/SimplePie/Author.php';
18 18
 
19 19
 /**
20 20
  * WordPress autoloader for SimplePie.
21 21
  *
22 22
  * @since 3.5.0
23 23
  */
24
-function wp_simplepie_autoload( $class ) {
25
-	if ( 0 !== strpos( $class, 'SimplePie_' ) )
24
+function wp_simplepie_autoload($class) {
25
+	if (0 !== strpos($class, 'SimplePie_'))
26 26
 		return;
27 27
 
28
-	$file = ABSPATH . WPINC . '/' . str_replace( '_', '/', $class ) . '.php';
29
-	include( $file );
28
+	$file = ABSPATH.WPINC.'/'.str_replace('_', '/', $class).'.php';
29
+	include($file);
30 30
 }
31 31
 
32 32
 /**
33 33
  * We autoload classes we may not need.
34 34
  */
35
-spl_autoload_register( 'wp_simplepie_autoload' );
35
+spl_autoload_register('wp_simplepie_autoload');
36 36
 
37 37
 /**
38 38
  * SimplePie
@@ -102,12 +102,12 @@  discard block
 block discarded – undo
102 102
  * SimplePie Useragent
103 103
  * @see SimplePie::set_useragent()
104 104
  */
105
-define('SIMPLEPIE_USERAGENT', SIMPLEPIE_NAME . '/' . SIMPLEPIE_VERSION . ' (Feed Parser; ' . SIMPLEPIE_URL . '; Allow like Gecko) Build/' . SIMPLEPIE_BUILD);
105
+define('SIMPLEPIE_USERAGENT', SIMPLEPIE_NAME.'/'.SIMPLEPIE_VERSION.' (Feed Parser; '.SIMPLEPIE_URL.'; Allow like Gecko) Build/'.SIMPLEPIE_BUILD);
106 106
 
107 107
 /**
108 108
  * SimplePie Linkback
109 109
  */
110
-define('SIMPLEPIE_LINKBACK', '<a href="' . SIMPLEPIE_URL . '" title="' . SIMPLEPIE_NAME . ' ' . SIMPLEPIE_VERSION . '">' . SIMPLEPIE_NAME . '</a>');
110
+define('SIMPLEPIE_LINKBACK', '<a href="'.SIMPLEPIE_URL.'" title="'.SIMPLEPIE_NAME.' '.SIMPLEPIE_VERSION.'">'.SIMPLEPIE_NAME.'</a>');
111 111
 
112 112
 /**
113 113
  * No Autodiscovery
@@ -700,9 +700,9 @@  discard block
 block discarded – undo
700 700
 	 */
701 701
 	public function __destruct()
702 702
 	{
703
-		if ((version_compare(PHP_VERSION, '5.3', '<') || !gc_enabled()) && !ini_get('zend.ze1_compatibility_mode'))
703
+		if ((version_compare(PHP_VERSION, '5.3', '<') || ! gc_enabled()) && ! ini_get('zend.ze1_compatibility_mode'))
704 704
 		{
705
-			if (!empty($this->data['items']))
705
+			if ( ! empty($this->data['items']))
706 706
 			{
707 707
 				foreach ($this->data['items'] as $item)
708 708
 				{
@@ -710,7 +710,7 @@  discard block
 block discarded – undo
710 710
 				}
711 711
 				unset($item, $this->data['items']);
712 712
 			}
713
-			if (!empty($this->data['ordered_items']))
713
+			if ( ! empty($this->data['ordered_items']))
714 714
 			{
715 715
 				foreach ($this->data['ordered_items'] as $item)
716 716
 				{
@@ -777,7 +777,7 @@  discard block
 block discarded – undo
777 777
 		if ($file instanceof SimplePie_File)
778 778
 		{
779 779
 			$this->feed_url = $file->url;
780
-			$this->file =& $file;
780
+			$this->file = & $file;
781 781
 			return true;
782 782
 		}
783 783
 		return false;
@@ -1212,7 +1212,7 @@  discard block
 block discarded – undo
1212 1212
 	{
1213 1213
 		if ($page !== false)
1214 1214
 		{
1215
-			$this->sanitize->set_image_handler($page . '?' . $qs . '=');
1215
+			$this->sanitize->set_image_handler($page.'?'.$qs.'=');
1216 1216
 		}
1217 1217
 		else
1218 1218
 		{
@@ -1242,12 +1242,12 @@  discard block
 block discarded – undo
1242 1242
 	public function init()
1243 1243
 	{
1244 1244
 		// Check absolute bare minimum requirements.
1245
-		if (!extension_loaded('xml') || !extension_loaded('pcre'))
1245
+		if ( ! extension_loaded('xml') || ! extension_loaded('pcre'))
1246 1246
 		{
1247 1247
 			return false;
1248 1248
 		}
1249 1249
 		// Then check the xml extension is sane (i.e., libxml 2.7.x issue on PHP < 5.2.9 and libxml 2.7.0 to 2.7.2 on any version) if we don't have xmlreader.
1250
-		elseif (!extension_loaded('xmlreader'))
1250
+		elseif ( ! extension_loaded('xmlreader'))
1251 1251
 		{
1252 1252
 			static $xml_is_sane = null;
1253 1253
 			if ($xml_is_sane === null)
@@ -1257,7 +1257,7 @@  discard block
 block discarded – undo
1257 1257
 				xml_parser_free($parser_check);
1258 1258
 				$xml_is_sane = isset($values[0]['value']);
1259 1259
 			}
1260
-			if (!$xml_is_sane)
1260
+			if ( ! $xml_is_sane)
1261 1261
 			{
1262 1262
 				return false;
1263 1263
 			}
@@ -1273,7 +1273,7 @@  discard block
 block discarded – undo
1273 1273
 		$this->sanitize->pass_cache_data($this->cache, $this->cache_location, $this->cache_name_function, $this->registry->get_class('Cache'));
1274 1274
 		$this->sanitize->pass_file_data($this->registry->get_class('File'), $this->timeout, $this->useragent, $this->force_fsockopen);
1275 1275
 
1276
-		if (!empty($this->multifeed_url))
1276
+		if ( ! empty($this->multifeed_url))
1277 1277
 		{
1278 1278
 			$i = 0;
1279 1279
 			$success = 0;
@@ -1285,7 +1285,7 @@  discard block
 block discarded – undo
1285 1285
 				$this->multifeed_objects[$i]->set_feed_url($url);
1286 1286
 				$single_success = $this->multifeed_objects[$i]->init();
1287 1287
 				$success |= $single_success;
1288
-				if (!$single_success)
1288
+				if ( ! $single_success)
1289 1289
 				{
1290 1290
 					$this->error[$i] = $this->multifeed_objects[$i]->error();
1291 1291
 				}
@@ -1385,7 +1385,7 @@  discard block
 block discarded – undo
1385 1385
 				if ($parser->parse($utf8_data, 'UTF-8'))
1386 1386
 				{
1387 1387
 					$this->data = $parser->get_data();
1388
-					if (!($this->get_type() & ~SIMPLEPIE_TYPE_NONE))
1388
+					if ( ! ($this->get_type() & ~SIMPLEPIE_TYPE_NONE))
1389 1389
 					{
1390 1390
 						$this->error = "A feed could not be found at $this->feed_url. This does not appear to be a valid RSS or Atom feed.";
1391 1391
 						$this->registry->call('Misc', 'error', array($this->error, E_USER_NOTICE, __FILE__, __LINE__));
@@ -1399,7 +1399,7 @@  discard block
 block discarded – undo
1399 1399
 					$this->data['build'] = SIMPLEPIE_BUILD;
1400 1400
 
1401 1401
 					// Cache the file if caching is enabled
1402
-					if ($cache && !$cache->save($this))
1402
+					if ($cache && ! $cache->save($this))
1403 1403
 					{
1404 1404
 						trigger_error("$this->cache_location is not writeable. Make sure you've set the correct relative or absolute path, and that the location is server-writable.", E_USER_WARNING);
1405 1405
 					}
@@ -1437,10 +1437,10 @@  discard block
 block discarded – undo
1437 1437
 		{
1438 1438
 			// Load the Cache
1439 1439
 			$this->data = $cache->load();
1440
-			if (!empty($this->data))
1440
+			if ( ! empty($this->data))
1441 1441
 			{
1442 1442
 				// If the cache is for an outdated build of SimplePie
1443
-				if (!isset($this->data['build']) || $this->data['build'] !== SIMPLEPIE_BUILD)
1443
+				if ( ! isset($this->data['build']) || $this->data['build'] !== SIMPLEPIE_BUILD)
1444 1444
 				{
1445 1445
 					$cache->unlink();
1446 1446
 					$this->data = array();
@@ -1486,7 +1486,7 @@  discard block
 block discarded – undo
1486 1486
 							$headers['if-none-match'] = $this->data['headers']['etag'];
1487 1487
 						}
1488 1488
 
1489
-						$file = $this->registry->create('File', array($this->feed_url, $this->timeout/10, 5, $headers, $this->useragent, $this->force_fsockopen));
1489
+						$file = $this->registry->create('File', array($this->feed_url, $this->timeout / 10, 5, $headers, $this->useragent, $this->force_fsockopen));
1490 1490
 
1491 1491
 						if ($file->success)
1492 1492
 						{
@@ -1517,11 +1517,11 @@  discard block
 block discarded – undo
1517 1517
 			}
1518 1518
 		}
1519 1519
 		// If we don't already have the file (it'll only exist if we've opened it to check if the cache has been modified), open it.
1520
-		if (!isset($file))
1520
+		if ( ! isset($file))
1521 1521
 		{
1522 1522
 			if ($this->file instanceof SimplePie_File && $this->file->url === $this->feed_url)
1523 1523
 			{
1524
-				$file =& $this->file;
1524
+				$file = & $this->file;
1525 1525
 			}
1526 1526
 			else
1527 1527
 			{
@@ -1532,26 +1532,26 @@  discard block
 block discarded – undo
1532 1532
 			}
1533 1533
 		}
1534 1534
 		// If the file connection has an error, set SimplePie::error to that and quit
1535
-		if (!$file->success && !($file->method & SIMPLEPIE_FILE_SOURCE_REMOTE === 0 || ($file->status_code === 200 || $file->status_code > 206 && $file->status_code < 300)))
1535
+		if ( ! $file->success && ! ($file->method & SIMPLEPIE_FILE_SOURCE_REMOTE === 0 || ($file->status_code === 200 || $file->status_code > 206 && $file->status_code < 300)))
1536 1536
 		{
1537 1537
 			$this->error = $file->error;
1538
-			return !empty($this->data);
1538
+			return ! empty($this->data);
1539 1539
 		}
1540 1540
 
1541
-		if (!$this->force_feed)
1541
+		if ( ! $this->force_feed)
1542 1542
 		{
1543 1543
 			// Check if the supplied URL is a feed, if it isn't, look for it.
1544 1544
 			$locate = $this->registry->create('Locator', array(&$file, $this->timeout, $this->useragent, $this->max_checked_feeds));
1545 1545
 
1546
-			if (!$locate->is_feed($file))
1546
+			if ( ! $locate->is_feed($file))
1547 1547
 			{
1548 1548
 				// We need to unset this so that if SimplePie::set_file() has been called that object is untouched
1549 1549
 				unset($file);
1550 1550
 				try
1551 1551
 				{
1552
-					if (!($file = $locate->find($this->autodiscovery, $this->all_discovered_feeds)))
1552
+					if ( ! ($file = $locate->find($this->autodiscovery, $this->all_discovered_feeds)))
1553 1553
 					{
1554
-						$this->error = "A feed could not be found at $this->feed_url. A feed with an invalid mime type may fall victim to this error, or " . SIMPLEPIE_NAME . " was unable to auto-discover it.. Use force_feed() if you are certain this URL is a real feed.";
1554
+						$this->error = "A feed could not be found at $this->feed_url. A feed with an invalid mime type may fall victim to this error, or ".SIMPLEPIE_NAME." was unable to auto-discover it.. Use force_feed() if you are certain this URL is a real feed.";
1555 1555
 						$this->registry->call('Misc', 'error', array($this->error, E_USER_NOTICE, __FILE__, __LINE__));
1556 1556
 						return false;
1557 1557
 					}
@@ -1566,7 +1566,7 @@  discard block
 block discarded – undo
1566 1566
 				if ($cache)
1567 1567
 				{
1568 1568
 					$this->data = array('url' => $this->feed_url, 'feed_url' => $file->url, 'build' => SIMPLEPIE_BUILD);
1569
-					if (!$cache->save($this))
1569
+					if ( ! $cache->save($this))
1570 1570
 					{
1571 1571
 						trigger_error("$this->cache_location is not writeable. Make sure you've set the correct relative or absolute path, and that the location is server-writable.", E_USER_WARNING);
1572 1572
 					}
@@ -1641,12 +1641,12 @@  discard block
 block discarded – undo
1641 1641
 	 */
1642 1642
 	public function handle_content_type($mime = 'text/html')
1643 1643
 	{
1644
-		if (!headers_sent())
1644
+		if ( ! headers_sent())
1645 1645
 		{
1646 1646
 			$header = "Content-type: $mime;";
1647 1647
 			if ($this->get_encoding())
1648 1648
 			{
1649
-				$header .= ' charset=' . $this->get_encoding();
1649
+				$header .= ' charset='.$this->get_encoding();
1650 1650
 			}
1651 1651
 			else
1652 1652
 			{
@@ -1684,7 +1684,7 @@  discard block
 block discarded – undo
1684 1684
 	 */
1685 1685
 	public function get_type()
1686 1686
 	{
1687
-		if (!isset($this->data['type']))
1687
+		if ( ! isset($this->data['type']))
1688 1688
 		{
1689 1689
 			$this->data['type'] = SIMPLEPIE_TYPE_ALL;
1690 1690
 			if (isset($this->data['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['feed']))
@@ -1972,7 +1972,7 @@  discard block
 block discarded – undo
1972 1972
 	 */
1973 1973
 	public function get_base($element = array())
1974 1974
 	{
1975
-		if (!($this->get_type() & SIMPLEPIE_TYPE_RSS_SYNDICATION) && !empty($element['xml_base_explicit']) && isset($element['xml_base']))
1975
+		if ( ! ($this->get_type() & SIMPLEPIE_TYPE_RSS_SYNDICATION) && ! empty($element['xml_base_explicit']) && isset($element['xml_base']))
1976 1976
 		{
1977 1977
 			return $element['xml_base'];
1978 1978
 		}
@@ -2120,7 +2120,7 @@  discard block
 block discarded – undo
2120 2120
 			$categories[] = $this->registry->create('Category', array($this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null));
2121 2121
 		}
2122 2122
 
2123
-		if (!empty($categories))
2123
+		if ( ! empty($categories))
2124 2124
 		{
2125 2125
 			return array_unique($categories);
2126 2126
 		}
@@ -2218,7 +2218,7 @@  discard block
 block discarded – undo
2218 2218
 			$authors[] = $this->registry->create('Author', array($this->sanitize($author['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null));
2219 2219
 		}
2220 2220
 
2221
-		if (!empty($authors))
2221
+		if ( ! empty($authors))
2222 2222
 		{
2223 2223
 			return array_unique($authors);
2224 2224
 		}
@@ -2304,7 +2304,7 @@  discard block
 block discarded – undo
2304 2304
 			}
2305 2305
 		}
2306 2306
 
2307
-		if (!empty($contributors))
2307
+		if ( ! empty($contributors))
2308 2308
 		{
2309 2309
 			return array_unique($contributors);
2310 2310
 		}
@@ -2362,7 +2362,7 @@  discard block
 block discarded – undo
2362 2362
 	 */
2363 2363
 	public function get_links($rel = 'alternate')
2364 2364
 	{
2365
-		if (!isset($this->data['links']))
2365
+		if ( ! isset($this->data['links']))
2366 2366
 		{
2367 2367
 			$this->data['links'] = array();
2368 2368
 			if ($links = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'link'))
@@ -2406,19 +2406,19 @@  discard block
 block discarded – undo
2406 2406
 			{
2407 2407
 				if ($this->registry->call('Misc', 'is_isegment_nz_nc', array($key)))
2408 2408
 				{
2409
-					if (isset($this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key]))
2409
+					if (isset($this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY.$key]))
2410 2410
 					{
2411
-						$this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key] = array_merge($this->data['links'][$key], $this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key]);
2412
-						$this->data['links'][$key] =& $this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key];
2411
+						$this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY.$key] = array_merge($this->data['links'][$key], $this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY.$key]);
2412
+						$this->data['links'][$key] = & $this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY.$key];
2413 2413
 					}
2414 2414
 					else
2415 2415
 					{
2416
-						$this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key] =& $this->data['links'][$key];
2416
+						$this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY.$key] = & $this->data['links'][$key];
2417 2417
 					}
2418 2418
 				}
2419 2419
 				elseif (substr($key, 0, 41) === SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY)
2420 2420
 				{
2421
-					$this->data['links'][substr($key, 41)] =& $this->data['links'][$key];
2421
+					$this->data['links'][substr($key, 41)] = & $this->data['links'][$key];
2422 2422
 				}
2423 2423
 				$this->data['links'][$key] = array_unique($this->data['links'][$key]);
2424 2424
 			}
@@ -2860,9 +2860,9 @@  discard block
 block discarded – undo
2860 2860
 	 */
2861 2861
 	public function get_items($start = 0, $end = 0)
2862 2862
 	{
2863
-		if (!isset($this->data['items']))
2863
+		if ( ! isset($this->data['items']))
2864 2864
 		{
2865
-			if (!empty($this->multifeed_objects))
2865
+			if ( ! empty($this->multifeed_objects))
2866 2866
 			{
2867 2867
 				$this->data['items'] = SimplePie::merge_items($this->multifeed_objects, $start, $end, $this->item_limit);
2868 2868
 			}
@@ -2912,17 +2912,17 @@  discard block
 block discarded – undo
2912 2912
 			}
2913 2913
 		}
2914 2914
 
2915
-		if (!empty($this->data['items']))
2915
+		if ( ! empty($this->data['items']))
2916 2916
 		{
2917 2917
 			// If we want to order it by date, check if all items have a date, and then sort it
2918 2918
 			if ($this->order_by_date && empty($this->multifeed_objects))
2919 2919
 			{
2920
-				if (!isset($this->data['ordered_items']))
2920
+				if ( ! isset($this->data['ordered_items']))
2921 2921
 				{
2922 2922
 					$do_sort = true;
2923 2923
 					foreach ($this->data['items'] as $item)
2924 2924
 					{
2925
-						if (!$item->get_date('U'))
2925
+						if ( ! $item->get_date('U'))
2926 2926
 						{
2927 2927
 							$do_sort = false;
2928 2928
 							break;
@@ -2982,7 +2982,7 @@  discard block
 block discarded – undo
2982 2982
 
2983 2983
 		if (($url = $this->get_link()) !== null)
2984 2984
 		{
2985
-			return 'http://g.etfv.co/' . urlencode($url);
2985
+			return 'http://g.etfv.co/'.urlencode($url);
2986 2986
 		}
2987 2987
 
2988 2988
 		return false;
@@ -3063,7 +3063,7 @@  discard block
 block discarded – undo
3063 3063
 			$do_sort = true;
3064 3064
 			foreach ($items as $item)
3065 3065
 			{
3066
-				if (!$item->get_date('U'))
3066
+				if ( ! $item->get_date('U'))
3067 3067
 				{
3068 3068
 					$do_sort = false;
3069 3069
 					break;
Please login to merge, or discard this patch.
Doc Comments   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1589,7 +1589,7 @@  discard block
 block discarded – undo
1589 1589
 	/**
1590 1590
 	 * Get the error message for the occurred error.
1591 1591
 	 *
1592
-	 * @return string|array Error message, or array of messages for multifeeds
1592
+	 * @return string Error message, or array of messages for multifeeds
1593 1593
 	 */
1594 1594
 	public function error()
1595 1595
 	{
@@ -2582,7 +2582,7 @@  discard block
 block discarded – undo
2582 2582
 	 * @since 1.0
2583 2583
 	 * @link http://www.w3.org/2003/01/geo/ W3C WGS84 Basic Geo
2584 2584
 	 * @link http://www.georss.org/ GeoRSS
2585
-	 * @return string|null
2585
+	 * @return double|null
2586 2586
 	 */
2587 2587
 	public function get_latitude()
2588 2588
 	{
@@ -2611,7 +2611,7 @@  discard block
 block discarded – undo
2611 2611
 	 * @since 1.0
2612 2612
 	 * @link http://www.w3.org/2003/01/geo/ W3C WGS84 Basic Geo
2613 2613
 	 * @link http://www.georss.org/ GeoRSS
2614
-	 * @return string|null
2614
+	 * @return double|null
2615 2615
 	 */
2616 2616
 	public function get_longitude()
2617 2617
 	{
@@ -2753,7 +2753,7 @@  discard block
 block discarded – undo
2753 2753
 	 * Uses `<image><width>` or defaults to 88.0 if no width is specified and
2754 2754
 	 * the feed is an RSS 2.0 feed.
2755 2755
 	 *
2756
-	 * @return int|float|null
2756
+	 * @return double|null
2757 2757
 	 */
2758 2758
 	public function get_image_width()
2759 2759
 	{
@@ -2779,7 +2779,7 @@  discard block
 block discarded – undo
2779 2779
 	 * Uses `<image><height>` or defaults to 31.0 if no height is specified and
2780 2780
 	 * the feed is an RSS 2.0 feed.
2781 2781
 	 *
2782
-	 * @return int|float|null
2782
+	 * @return double|null
2783 2783
 	 */
2784 2784
 	public function get_image_height()
2785 2785
 	{
Please login to merge, or discard this patch.
src/wp-includes/nav-menu-template.php 2 patches
Braces   +56 added lines, -39 removed lines patch added patch discarded remove patch
@@ -272,8 +272,9 @@  discard block
 block discarded – undo
272 272
 	$menu = wp_get_nav_menu_object( $args->menu );
273 273
 
274 274
 	// Get the nav menu based on the theme_location
275
-	if ( ! $menu && $args->theme_location && ( $locations = get_nav_menu_locations() ) && isset( $locations[ $args->theme_location ] ) )
276
-		$menu = wp_get_nav_menu_object( $locations[ $args->theme_location ] );
275
+	if ( ! $menu && $args->theme_location && ( $locations = get_nav_menu_locations() ) && isset( $locations[ $args->theme_location ] ) ) {
276
+			$menu = wp_get_nav_menu_object( $locations[ $args->theme_location ] );
277
+	}
277 278
 
278 279
 	// get the first menu that has items if we still can't find a menu
279 280
 	if ( ! $menu && !$args->theme_location ) {
@@ -291,8 +292,9 @@  discard block
 block discarded – undo
291 292
 	}
292 293
 
293 294
 	// If the menu exists, get its items.
294
-	if ( $menu && ! is_wp_error($menu) && !isset($menu_items) )
295
-		$menu_items = wp_get_nav_menu_items( $menu->term_id, array( 'update_post_term_cache' => false ) );
295
+	if ( $menu && ! is_wp_error($menu) && !isset($menu_items) ) {
296
+			$menu_items = wp_get_nav_menu_items( $menu->term_id, array( 'update_post_term_cache' => false ) );
297
+	}
296 298
 
297 299
 	/*
298 300
 	 * If no menu was found:
@@ -303,11 +305,13 @@  discard block
 block discarded – undo
303 305
 	 *  - Otherwise, bail.
304 306
 	 */
305 307
 	if ( ( !$menu || is_wp_error($menu) || ( isset($menu_items) && empty($menu_items) && !$args->theme_location ) )
306
-		&& isset( $args->fallback_cb ) && $args->fallback_cb && is_callable( $args->fallback_cb ) )
307
-			return call_user_func( $args->fallback_cb, (array) $args );
308
+		&& isset( $args->fallback_cb ) && $args->fallback_cb && is_callable( $args->fallback_cb ) ) {
309
+				return call_user_func( $args->fallback_cb, (array) $args );
310
+	}
308 311
 
309
-	if ( ! $menu || is_wp_error( $menu ) )
310
-		return false;
312
+	if ( ! $menu || is_wp_error( $menu ) ) {
313
+			return false;
314
+	}
311 315
 
312 316
 	$nav_menu = $items = '';
313 317
 
@@ -336,15 +340,17 @@  discard block
 block discarded – undo
336 340
 	$sorted_menu_items = $menu_items_with_children = array();
337 341
 	foreach ( (array) $menu_items as $menu_item ) {
338 342
 		$sorted_menu_items[ $menu_item->menu_order ] = $menu_item;
339
-		if ( $menu_item->menu_item_parent )
340
-			$menu_items_with_children[ $menu_item->menu_item_parent ] = true;
343
+		if ( $menu_item->menu_item_parent ) {
344
+					$menu_items_with_children[ $menu_item->menu_item_parent ] = true;
345
+		}
341 346
 	}
342 347
 
343 348
 	// Add the menu-item-has-children class where applicable
344 349
 	if ( $menu_items_with_children ) {
345 350
 		foreach ( $sorted_menu_items as &$menu_item ) {
346
-			if ( isset( $menu_items_with_children[ $menu_item->ID ] ) )
347
-				$menu_item->classes[] = 'menu-item-has-children';
351
+			if ( isset( $menu_items_with_children[ $menu_item->ID ] ) ) {
352
+							$menu_item->classes[] = 'menu-item-has-children';
353
+			}
348 354
 		}
349 355
 	}
350 356
 
@@ -369,10 +375,11 @@  discard block
 block discarded – undo
369 375
 	} else {
370 376
 		$wrap_id = 'menu-' . $menu->slug;
371 377
 		while ( in_array( $wrap_id, $menu_id_slugs ) ) {
372
-			if ( preg_match( '#-(\d+)$#', $wrap_id, $matches ) )
373
-				$wrap_id = preg_replace('#-(\d+)$#', '-' . ++$matches[1], $wrap_id );
374
-			else
375
-				$wrap_id = $wrap_id . '-1';
378
+			if ( preg_match( '#-(\d+)$#', $wrap_id, $matches ) ) {
379
+							$wrap_id = preg_replace('#-(\d+)$#', '-' . ++$matches[1], $wrap_id );
380
+			} else {
381
+							$wrap_id = $wrap_id . '-1';
382
+			}
376 383
 		}
377 384
 	}
378 385
 	$menu_id_slugs[] = $wrap_id;
@@ -403,14 +410,16 @@  discard block
 block discarded – undo
403 410
 	$items = apply_filters( "wp_nav_menu_{$menu->slug}_items", $items, $args );
404 411
 
405 412
 	// Don't print any markup if there are no items at this point.
406
-	if ( empty( $items ) )
407
-		return false;
413
+	if ( empty( $items ) ) {
414
+			return false;
415
+	}
408 416
 
409 417
 	$nav_menu .= sprintf( $args->items_wrap, esc_attr( $wrap_id ), esc_attr( $wrap_class ), $items );
410 418
 	unset( $items );
411 419
 
412
-	if ( $show_container )
413
-		$nav_menu .= '</' . $args->container . '>';
420
+	if ( $show_container ) {
421
+			$nav_menu .= '</' . $args->container . '>';
422
+	}
414 423
 
415 424
 	/**
416 425
 	 * Filter the HTML content for navigation menus.
@@ -424,11 +433,12 @@  discard block
 block discarded – undo
424 433
 	 */
425 434
 	$nav_menu = apply_filters( 'wp_nav_menu', $nav_menu, $args );
426 435
 
427
-	if ( $args->echo )
428
-		echo $nav_menu;
429
-	else
430
-		return $nav_menu;
431
-}
436
+	if ( $args->echo ) {
437
+			echo $nav_menu;
438
+	} else {
439
+			return $nav_menu;
440
+	}
441
+	}
432 442
 
433 443
 /**
434 444
  * Add the class property classes for the current context, if applicable.
@@ -464,8 +474,9 @@  discard block
 block discarded – undo
464 474
 					$possible_object_parents = array_merge( $possible_object_parents, $terms );
465 475
 					$term_to_ancestor = array();
466 476
 					foreach ( (array) $term_hierarchy as $anc => $descs ) {
467
-						foreach ( (array) $descs as $desc )
468
-							$term_to_ancestor[ $desc ] = $anc;
477
+						foreach ( (array) $descs as $desc ) {
478
+													$term_to_ancestor[ $desc ] = $anc;
479
+						}
469 480
 					}
470 481
 
471 482
 					foreach ( $terms as $desc ) {
@@ -487,8 +498,9 @@  discard block
 block discarded – undo
487 498
 		$term_hierarchy = _get_term_hierarchy( $queried_object->taxonomy );
488 499
 		$term_to_ancestor = array();
489 500
 		foreach ( (array) $term_hierarchy as $anc => $descs ) {
490
-			foreach ( (array) $descs as $desc )
491
-				$term_to_ancestor[ $desc ] = $anc;
501
+			foreach ( (array) $descs as $desc ) {
502
+							$term_to_ancestor[ $desc ] = $anc;
503
+			}
492 504
 		}
493 505
 		$desc = $queried_object->term_id;
494 506
 		do {
@@ -585,13 +597,15 @@  discard block
 block discarded – undo
585 597
 				$classes[] = 'current-menu-item';
586 598
 			}
587 599
 
588
-			if ( untrailingslashit($item_url) == home_url() )
589
-				$classes[] = 'menu-item-home';
600
+			if ( untrailingslashit($item_url) == home_url() ) {
601
+							$classes[] = 'menu-item-home';
602
+			}
590 603
 		}
591 604
 
592 605
 		// back-compat with wp_page_menu: add "current_page_parent" to static home page link for any non-page query
593
-		if ( ! empty( $home_page_id ) && 'post_type' == $menu_item->type && empty( $wp_query->is_page ) && $home_page_id == $menu_item->object_id )
594
-			$classes[] = 'current_page_parent';
606
+		if ( ! empty( $home_page_id ) && 'post_type' == $menu_item->type && empty( $wp_query->is_page ) && $home_page_id == $menu_item->object_id ) {
607
+					$classes[] = 'current_page_parent';
608
+		}
595 609
 
596 610
 		$menu_items[$key]->classes = array_unique( $classes );
597 611
 	}
@@ -640,15 +654,18 @@  discard block
 block discarded – undo
640 654
 			$classes[] = 'current-menu-parent';
641 655
 			$menu_items[$key]->current_item_parent = true;
642 656
 		}
643
-		if ( in_array( $parent_item->object_id, $active_parent_object_ids ) )
644
-			$classes[] = 'current-' . $active_object . '-parent';
657
+		if ( in_array( $parent_item->object_id, $active_parent_object_ids ) ) {
658
+					$classes[] = 'current-' . $active_object . '-parent';
659
+		}
645 660
 
646 661
 		if ( 'post_type' == $parent_item->type && 'page' == $parent_item->object ) {
647 662
 			// Back compat classes for pages to match wp_page_menu()
648
-			if ( in_array('current-menu-parent', $classes) )
649
-				$classes[] = 'current_page_parent';
650
-			if ( in_array('current-menu-ancestor', $classes) )
651
-				$classes[] = 'current_page_ancestor';
663
+			if ( in_array('current-menu-parent', $classes) ) {
664
+							$classes[] = 'current_page_parent';
665
+			}
666
+			if ( in_array('current-menu-ancestor', $classes) ) {
667
+							$classes[] = 'current_page_ancestor';
668
+			}
652 669
 		}
653 670
 
654 671
 		$menu_items[$key]->classes = array_unique( $classes );
Please login to merge, or discard this patch.
Spacing   +142 added lines, -142 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
  */
9 9
 
10 10
 /** Walker_Nav_Menu class */
11
-require_once ABSPATH . WPINC . '/class-walker-nav-menu.php';
11
+require_once ABSPATH.WPINC.'/class-walker-nav-menu.php';
12 12
 
13 13
 /**
14 14
  * Displays a navigation menu.
@@ -45,16 +45,16 @@  discard block
 block discarded – undo
45 45
  * }
46 46
  * @return object|false|void Menu output if $echo is false, false if there are no items or no menu was found.
47 47
  */
48
-function wp_nav_menu( $args = array() ) {
48
+function wp_nav_menu($args = array()) {
49 49
 	static $menu_id_slugs = array();
50 50
 
51
-	$defaults = array( 'menu' => '', 'container' => 'div', 'container_class' => '', 'container_id' => '', 'menu_class' => 'menu', 'menu_id' => '',
51
+	$defaults = array('menu' => '', 'container' => 'div', 'container_class' => '', 'container_id' => '', 'menu_class' => 'menu', 'menu_id' => '',
52 52
 	'echo' => true, 'fallback_cb' => 'wp_page_menu', 'before' => '', 'after' => '', 'link_before' => '', 'link_after' => '', 'items_wrap' => '<ul id="%1$s" class="%2$s">%3$s</ul>', 'item_spacing' => 'preserve',
53
-	'depth' => 0, 'walker' => '', 'theme_location' => '' );
53
+	'depth' => 0, 'walker' => '', 'theme_location' => '');
54 54
 
55
-	$args = wp_parse_args( $args, $defaults );
55
+	$args = wp_parse_args($args, $defaults);
56 56
 
57
-	if ( ! in_array( $args['item_spacing'], array( 'preserve', 'discard' ), true ) ) {
57
+	if ( ! in_array($args['item_spacing'], array('preserve', 'discard'), true)) {
58 58
 		// invalid value, fall back to default.
59 59
 		$args['item_spacing'] = $defaults['item_spacing'];
60 60
 	}
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
 	 *
69 69
 	 * @param array $args Array of wp_nav_menu() arguments.
70 70
 	 */
71
-	$args = apply_filters( 'wp_nav_menu_args', $args );
71
+	$args = apply_filters('wp_nav_menu_args', $args);
72 72
 	$args = (object) $args;
73 73
 
74 74
 	/**
@@ -85,10 +85,10 @@  discard block
 block discarded – undo
85 85
 	 * @param string|null $output Nav menu output to short-circuit with. Default null.
86 86
 	 * @param stdClass    $args   An object containing wp_nav_menu() arguments.
87 87
 	 */
88
-	$nav_menu = apply_filters( 'pre_wp_nav_menu', null, $args );
88
+	$nav_menu = apply_filters('pre_wp_nav_menu', null, $args);
89 89
 
90
-	if ( null !== $nav_menu ) {
91
-		if ( $args->echo ) {
90
+	if (null !== $nav_menu) {
91
+		if ($args->echo) {
92 92
 			echo $nav_menu;
93 93
 			return;
94 94
 		}
@@ -97,30 +97,30 @@  discard block
 block discarded – undo
97 97
 	}
98 98
 
99 99
 	// Get the nav menu based on the requested menu
100
-	$menu = wp_get_nav_menu_object( $args->menu );
100
+	$menu = wp_get_nav_menu_object($args->menu);
101 101
 
102 102
 	// Get the nav menu based on the theme_location
103
-	if ( ! $menu && $args->theme_location && ( $locations = get_nav_menu_locations() ) && isset( $locations[ $args->theme_location ] ) )
104
-		$menu = wp_get_nav_menu_object( $locations[ $args->theme_location ] );
103
+	if ( ! $menu && $args->theme_location && ($locations = get_nav_menu_locations()) && isset($locations[$args->theme_location]))
104
+		$menu = wp_get_nav_menu_object($locations[$args->theme_location]);
105 105
 
106 106
 	// get the first menu that has items if we still can't find a menu
107
-	if ( ! $menu && !$args->theme_location ) {
107
+	if ( ! $menu && ! $args->theme_location) {
108 108
 		$menus = wp_get_nav_menus();
109
-		foreach ( $menus as $menu_maybe ) {
110
-			if ( $menu_items = wp_get_nav_menu_items( $menu_maybe->term_id, array( 'update_post_term_cache' => false ) ) ) {
109
+		foreach ($menus as $menu_maybe) {
110
+			if ($menu_items = wp_get_nav_menu_items($menu_maybe->term_id, array('update_post_term_cache' => false))) {
111 111
 				$menu = $menu_maybe;
112 112
 				break;
113 113
 			}
114 114
 		}
115 115
 	}
116 116
 
117
-	if ( empty( $args->menu ) ) {
117
+	if (empty($args->menu)) {
118 118
 		$args->menu = $menu;
119 119
 	}
120 120
 
121 121
 	// If the menu exists, get its items.
122
-	if ( $menu && ! is_wp_error($menu) && !isset($menu_items) )
123
-		$menu_items = wp_get_nav_menu_items( $menu->term_id, array( 'update_post_term_cache' => false ) );
122
+	if ($menu && ! is_wp_error($menu) && ! isset($menu_items))
123
+		$menu_items = wp_get_nav_menu_items($menu->term_id, array('update_post_term_cache' => false));
124 124
 
125 125
 	/*
126 126
 	 * If no menu was found:
@@ -130,17 +130,17 @@  discard block
 block discarded – undo
130 130
 	 *  - Fall back, but only if no theme location was specified.
131 131
 	 *  - Otherwise, bail.
132 132
 	 */
133
-	if ( ( !$menu || is_wp_error($menu) || ( isset($menu_items) && empty($menu_items) && !$args->theme_location ) )
134
-		&& isset( $args->fallback_cb ) && $args->fallback_cb && is_callable( $args->fallback_cb ) )
135
-			return call_user_func( $args->fallback_cb, (array) $args );
133
+	if (( ! $menu || is_wp_error($menu) || (isset($menu_items) && empty($menu_items) && ! $args->theme_location))
134
+		&& isset($args->fallback_cb) && $args->fallback_cb && is_callable($args->fallback_cb))
135
+			return call_user_func($args->fallback_cb, (array) $args);
136 136
 
137
-	if ( ! $menu || is_wp_error( $menu ) )
137
+	if ( ! $menu || is_wp_error($menu))
138 138
 		return false;
139 139
 
140 140
 	$nav_menu = $items = '';
141 141
 
142 142
 	$show_container = false;
143
-	if ( $args->container ) {
143
+	if ($args->container) {
144 144
 		/**
145 145
 		 * Filters the list of HTML tags that are valid for use as menu containers.
146 146
 		 *
@@ -149,34 +149,34 @@  discard block
 block discarded – undo
149 149
 		 * @param array $tags The acceptable HTML tags for use as menu containers.
150 150
 		 *                    Default is array containing 'div' and 'nav'.
151 151
 		 */
152
-		$allowed_tags = apply_filters( 'wp_nav_menu_container_allowedtags', array( 'div', 'nav' ) );
153
-		if ( is_string( $args->container ) && in_array( $args->container, $allowed_tags ) ) {
152
+		$allowed_tags = apply_filters('wp_nav_menu_container_allowedtags', array('div', 'nav'));
153
+		if (is_string($args->container) && in_array($args->container, $allowed_tags)) {
154 154
 			$show_container = true;
155
-			$class = $args->container_class ? ' class="' . esc_attr( $args->container_class ) . '"' : ' class="menu-'. $menu->slug .'-container"';
156
-			$id = $args->container_id ? ' id="' . esc_attr( $args->container_id ) . '"' : '';
157
-			$nav_menu .= '<'. $args->container . $id . $class . '>';
155
+			$class = $args->container_class ? ' class="'.esc_attr($args->container_class).'"' : ' class="menu-'.$menu->slug.'-container"';
156
+			$id = $args->container_id ? ' id="'.esc_attr($args->container_id).'"' : '';
157
+			$nav_menu .= '<'.$args->container.$id.$class.'>';
158 158
 		}
159 159
 	}
160 160
 
161 161
 	// Set up the $menu_item variables
162
-	_wp_menu_item_classes_by_context( $menu_items );
162
+	_wp_menu_item_classes_by_context($menu_items);
163 163
 
164 164
 	$sorted_menu_items = $menu_items_with_children = array();
165
-	foreach ( (array) $menu_items as $menu_item ) {
166
-		$sorted_menu_items[ $menu_item->menu_order ] = $menu_item;
167
-		if ( $menu_item->menu_item_parent )
168
-			$menu_items_with_children[ $menu_item->menu_item_parent ] = true;
165
+	foreach ((array) $menu_items as $menu_item) {
166
+		$sorted_menu_items[$menu_item->menu_order] = $menu_item;
167
+		if ($menu_item->menu_item_parent)
168
+			$menu_items_with_children[$menu_item->menu_item_parent] = true;
169 169
 	}
170 170
 
171 171
 	// Add the menu-item-has-children class where applicable
172
-	if ( $menu_items_with_children ) {
173
-		foreach ( $sorted_menu_items as &$menu_item ) {
174
-			if ( isset( $menu_items_with_children[ $menu_item->ID ] ) )
172
+	if ($menu_items_with_children) {
173
+		foreach ($sorted_menu_items as &$menu_item) {
174
+			if (isset($menu_items_with_children[$menu_item->ID]))
175 175
 				$menu_item->classes[] = 'menu-item-has-children';
176 176
 		}
177 177
 	}
178 178
 
179
-	unset( $menu_items, $menu_item );
179
+	unset($menu_items, $menu_item);
180 180
 
181 181
 	/**
182 182
 	 * Filters the sorted list of menu item objects before generating the menu's HTML.
@@ -186,21 +186,21 @@  discard block
 block discarded – undo
186 186
 	 * @param array    $sorted_menu_items The menu items, sorted by each menu item's menu order.
187 187
 	 * @param stdClass $args              An object containing wp_nav_menu() arguments.
188 188
 	 */
189
-	$sorted_menu_items = apply_filters( 'wp_nav_menu_objects', $sorted_menu_items, $args );
189
+	$sorted_menu_items = apply_filters('wp_nav_menu_objects', $sorted_menu_items, $args);
190 190
 
191
-	$items .= walk_nav_menu_tree( $sorted_menu_items, $args->depth, $args );
191
+	$items .= walk_nav_menu_tree($sorted_menu_items, $args->depth, $args);
192 192
 	unset($sorted_menu_items);
193 193
 
194 194
 	// Attributes
195
-	if ( ! empty( $args->menu_id ) ) {
195
+	if ( ! empty($args->menu_id)) {
196 196
 		$wrap_id = $args->menu_id;
197 197
 	} else {
198
-		$wrap_id = 'menu-' . $menu->slug;
199
-		while ( in_array( $wrap_id, $menu_id_slugs ) ) {
200
-			if ( preg_match( '#-(\d+)$#', $wrap_id, $matches ) )
201
-				$wrap_id = preg_replace('#-(\d+)$#', '-' . ++$matches[1], $wrap_id );
198
+		$wrap_id = 'menu-'.$menu->slug;
199
+		while (in_array($wrap_id, $menu_id_slugs)) {
200
+			if (preg_match('#-(\d+)$#', $wrap_id, $matches))
201
+				$wrap_id = preg_replace('#-(\d+)$#', '-'.++$matches[1], $wrap_id);
202 202
 			else
203
-				$wrap_id = $wrap_id . '-1';
203
+				$wrap_id = $wrap_id.'-1';
204 204
 		}
205 205
 	}
206 206
 	$menu_id_slugs[] = $wrap_id;
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
 	 * @param string   $items The HTML list content for the menu items.
218 218
 	 * @param stdClass $args  An object containing wp_nav_menu() arguments.
219 219
 	 */
220
-	$items = apply_filters( 'wp_nav_menu_items', $items, $args );
220
+	$items = apply_filters('wp_nav_menu_items', $items, $args);
221 221
 	/**
222 222
 	 * Filters the HTML list content for a specific navigation menu.
223 223
 	 *
@@ -228,17 +228,17 @@  discard block
 block discarded – undo
228 228
 	 * @param string   $items The HTML list content for the menu items.
229 229
 	 * @param stdClass $args  An object containing wp_nav_menu() arguments.
230 230
 	 */
231
-	$items = apply_filters( "wp_nav_menu_{$menu->slug}_items", $items, $args );
231
+	$items = apply_filters("wp_nav_menu_{$menu->slug}_items", $items, $args);
232 232
 
233 233
 	// Don't print any markup if there are no items at this point.
234
-	if ( empty( $items ) )
234
+	if (empty($items))
235 235
 		return false;
236 236
 
237
-	$nav_menu .= sprintf( $args->items_wrap, esc_attr( $wrap_id ), esc_attr( $wrap_class ), $items );
238
-	unset( $items );
237
+	$nav_menu .= sprintf($args->items_wrap, esc_attr($wrap_id), esc_attr($wrap_class), $items);
238
+	unset($items);
239 239
 
240
-	if ( $show_container )
241
-		$nav_menu .= '</' . $args->container . '>';
240
+	if ($show_container)
241
+		$nav_menu .= '</'.$args->container.'>';
242 242
 
243 243
 	/**
244 244
 	 * Filters the HTML content for navigation menus.
@@ -250,9 +250,9 @@  discard block
 block discarded – undo
250 250
 	 * @param string   $nav_menu The HTML content for the navigation menu.
251 251
 	 * @param stdClass $args     An object containing wp_nav_menu() arguments.
252 252
 	 */
253
-	$nav_menu = apply_filters( 'wp_nav_menu', $nav_menu, $args );
253
+	$nav_menu = apply_filters('wp_nav_menu', $nav_menu, $args);
254 254
 
255
-	if ( $args->echo )
255
+	if ($args->echo)
256 256
 		echo $nav_menu;
257 257
 	else
258 258
 		return $nav_menu;
@@ -269,7 +269,7 @@  discard block
 block discarded – undo
269 269
  *
270 270
  * @param array $menu_items The current menu item objects to which to add the class property information.
271 271
  */
272
-function _wp_menu_item_classes_by_context( &$menu_items ) {
272
+function _wp_menu_item_classes_by_context(&$menu_items) {
273 273
 	global $wp_query, $wp_rewrite;
274 274
 
275 275
 	$queried_object = $wp_query->get_queried_object();
@@ -281,77 +281,77 @@  discard block
 block discarded – undo
281 281
 	$active_parent_object_ids = array();
282 282
 	$possible_taxonomy_ancestors = array();
283 283
 	$possible_object_parents = array();
284
-	$home_page_id = (int) get_option( 'page_for_posts' );
285
-
286
-	if ( $wp_query->is_singular && ! empty( $queried_object->post_type ) && ! is_post_type_hierarchical( $queried_object->post_type ) ) {
287
-		foreach ( (array) get_object_taxonomies( $queried_object->post_type ) as $taxonomy ) {
288
-			if ( is_taxonomy_hierarchical( $taxonomy ) ) {
289
-				$term_hierarchy = _get_term_hierarchy( $taxonomy );
290
-				$terms = wp_get_object_terms( $queried_object_id, $taxonomy, array( 'fields' => 'ids' ) );
291
-				if ( is_array( $terms ) ) {
292
-					$possible_object_parents = array_merge( $possible_object_parents, $terms );
284
+	$home_page_id = (int) get_option('page_for_posts');
285
+
286
+	if ($wp_query->is_singular && ! empty($queried_object->post_type) && ! is_post_type_hierarchical($queried_object->post_type)) {
287
+		foreach ((array) get_object_taxonomies($queried_object->post_type) as $taxonomy) {
288
+			if (is_taxonomy_hierarchical($taxonomy)) {
289
+				$term_hierarchy = _get_term_hierarchy($taxonomy);
290
+				$terms = wp_get_object_terms($queried_object_id, $taxonomy, array('fields' => 'ids'));
291
+				if (is_array($terms)) {
292
+					$possible_object_parents = array_merge($possible_object_parents, $terms);
293 293
 					$term_to_ancestor = array();
294
-					foreach ( (array) $term_hierarchy as $anc => $descs ) {
295
-						foreach ( (array) $descs as $desc )
296
-							$term_to_ancestor[ $desc ] = $anc;
294
+					foreach ((array) $term_hierarchy as $anc => $descs) {
295
+						foreach ((array) $descs as $desc)
296
+							$term_to_ancestor[$desc] = $anc;
297 297
 					}
298 298
 
299
-					foreach ( $terms as $desc ) {
299
+					foreach ($terms as $desc) {
300 300
 						do {
301
-							$possible_taxonomy_ancestors[ $taxonomy ][] = $desc;
302
-							if ( isset( $term_to_ancestor[ $desc ] ) ) {
303
-								$_desc = $term_to_ancestor[ $desc ];
304
-								unset( $term_to_ancestor[ $desc ] );
301
+							$possible_taxonomy_ancestors[$taxonomy][] = $desc;
302
+							if (isset($term_to_ancestor[$desc])) {
303
+								$_desc = $term_to_ancestor[$desc];
304
+								unset($term_to_ancestor[$desc]);
305 305
 								$desc = $_desc;
306 306
 							} else {
307 307
 								$desc = 0;
308 308
 							}
309
-						} while ( ! empty( $desc ) );
309
+						} while ( ! empty($desc));
310 310
 					}
311 311
 				}
312 312
 			}
313 313
 		}
314
-	} elseif ( ! empty( $queried_object->taxonomy ) && is_taxonomy_hierarchical( $queried_object->taxonomy ) ) {
315
-		$term_hierarchy = _get_term_hierarchy( $queried_object->taxonomy );
314
+	} elseif ( ! empty($queried_object->taxonomy) && is_taxonomy_hierarchical($queried_object->taxonomy)) {
315
+		$term_hierarchy = _get_term_hierarchy($queried_object->taxonomy);
316 316
 		$term_to_ancestor = array();
317
-		foreach ( (array) $term_hierarchy as $anc => $descs ) {
318
-			foreach ( (array) $descs as $desc )
319
-				$term_to_ancestor[ $desc ] = $anc;
317
+		foreach ((array) $term_hierarchy as $anc => $descs) {
318
+			foreach ((array) $descs as $desc)
319
+				$term_to_ancestor[$desc] = $anc;
320 320
 		}
321 321
 		$desc = $queried_object->term_id;
322 322
 		do {
323
-			$possible_taxonomy_ancestors[ $queried_object->taxonomy ][] = $desc;
324
-			if ( isset( $term_to_ancestor[ $desc ] ) ) {
325
-				$_desc = $term_to_ancestor[ $desc ];
326
-				unset( $term_to_ancestor[ $desc ] );
323
+			$possible_taxonomy_ancestors[$queried_object->taxonomy][] = $desc;
324
+			if (isset($term_to_ancestor[$desc])) {
325
+				$_desc = $term_to_ancestor[$desc];
326
+				unset($term_to_ancestor[$desc]);
327 327
 				$desc = $_desc;
328 328
 			} else {
329 329
 				$desc = 0;
330 330
 			}
331
-		} while ( ! empty( $desc ) );
331
+		} while ( ! empty($desc));
332 332
 	}
333 333
 
334
-	$possible_object_parents = array_filter( $possible_object_parents );
334
+	$possible_object_parents = array_filter($possible_object_parents);
335 335
 
336 336
 	$front_page_url = home_url();
337
-	$front_page_id  = (int) get_option( 'page_on_front' );
337
+	$front_page_id  = (int) get_option('page_on_front');
338 338
 
339
-	foreach ( (array) $menu_items as $key => $menu_item ) {
339
+	foreach ((array) $menu_items as $key => $menu_item) {
340 340
 
341 341
 		$menu_items[$key]->current = false;
342 342
 
343 343
 		$classes = (array) $menu_item->classes;
344 344
 		$classes[] = 'menu-item';
345
-		$classes[] = 'menu-item-type-' . $menu_item->type;
346
-		$classes[] = 'menu-item-object-' . $menu_item->object;
345
+		$classes[] = 'menu-item-type-'.$menu_item->type;
346
+		$classes[] = 'menu-item-object-'.$menu_item->object;
347 347
 
348 348
 		// This menu item is set as the 'Front Page'.
349
-		if ( 'post_type' === $menu_item->type && $front_page_id === (int) $menu_item->object_id ) {
349
+		if ('post_type' === $menu_item->type && $front_page_id === (int) $menu_item->object_id) {
350 350
 			$classes[] = 'menu-item-home';
351 351
 		}
352 352
 
353 353
 		// if the menu item corresponds to a taxonomy term for the currently-queried non-hierarchical post object
354
-		if ( $wp_query->is_singular && 'taxonomy' == $menu_item->type && in_array( $menu_item->object_id, $possible_object_parents ) ) {
354
+		if ($wp_query->is_singular && 'taxonomy' == $menu_item->type && in_array($menu_item->object_id, $possible_object_parents)) {
355 355
 			$active_parent_object_ids[] = (int) $menu_item->object_id;
356 356
 			$active_parent_item_ids[] = (int) $menu_item->db_id;
357 357
 			$active_object = $queried_object->post_type;
@@ -360,26 +360,26 @@  discard block
 block discarded – undo
360 360
 		} elseif (
361 361
 			$menu_item->object_id == $queried_object_id &&
362 362
 			(
363
-				( ! empty( $home_page_id ) && 'post_type' == $menu_item->type && $wp_query->is_home && $home_page_id == $menu_item->object_id ) ||
364
-				( 'post_type' == $menu_item->type && $wp_query->is_singular ) ||
365
-				( 'taxonomy' == $menu_item->type && ( $wp_query->is_category || $wp_query->is_tag || $wp_query->is_tax ) && $queried_object->taxonomy == $menu_item->object )
363
+				( ! empty($home_page_id) && 'post_type' == $menu_item->type && $wp_query->is_home && $home_page_id == $menu_item->object_id) ||
364
+				('post_type' == $menu_item->type && $wp_query->is_singular) ||
365
+				('taxonomy' == $menu_item->type && ($wp_query->is_category || $wp_query->is_tag || $wp_query->is_tax) && $queried_object->taxonomy == $menu_item->object)
366 366
 			)
367 367
 		) {
368 368
 			$classes[] = 'current-menu-item';
369 369
 			$menu_items[$key]->current = true;
370 370
 			$_anc_id = (int) $menu_item->db_id;
371 371
 
372
-			while(
373
-				( $_anc_id = get_post_meta( $_anc_id, '_menu_item_menu_item_parent', true ) ) &&
374
-				! in_array( $_anc_id, $active_ancestor_item_ids )
372
+			while (
373
+				($_anc_id = get_post_meta($_anc_id, '_menu_item_menu_item_parent', true)) &&
374
+				! in_array($_anc_id, $active_ancestor_item_ids)
375 375
 			) {
376 376
 				$active_ancestor_item_ids[] = $_anc_id;
377 377
 			}
378 378
 
379
-			if ( 'post_type' == $menu_item->type && 'page' == $menu_item->object ) {
379
+			if ('post_type' == $menu_item->type && 'page' == $menu_item->object) {
380 380
 				// Back compat classes for pages to match wp_page_menu()
381 381
 				$classes[] = 'page_item';
382
-				$classes[] = 'page-item-' . $menu_item->object_id;
382
+				$classes[] = 'page-item-'.$menu_item->object_id;
383 383
 				$classes[] = 'current_page_item';
384 384
 			}
385 385
 
@@ -390,31 +390,31 @@  discard block
 block discarded – undo
390 390
 		// if the menu item corresponds to the currently-queried post type archive
391 391
 		} elseif (
392 392
 			'post_type_archive' == $menu_item->type &&
393
-			is_post_type_archive( array( $menu_item->object ) )
393
+			is_post_type_archive(array($menu_item->object))
394 394
 		) {
395 395
 			$classes[] = 'current-menu-item';
396 396
 			$menu_items[$key]->current = true;
397 397
 		// if the menu item corresponds to the currently-requested URL
398
-		} elseif ( 'custom' == $menu_item->object && isset( $_SERVER['HTTP_HOST'] ) ) {
399
-			$_root_relative_current = untrailingslashit( $_SERVER['REQUEST_URI'] );
400
-			$current_url = set_url_scheme( 'http://' . $_SERVER['HTTP_HOST'] . $_root_relative_current );
401
-			$raw_item_url = strpos( $menu_item->url, '#' ) ? substr( $menu_item->url, 0, strpos( $menu_item->url, '#' ) ) : $menu_item->url;
402
-			$item_url = set_url_scheme( untrailingslashit( $raw_item_url ) );
403
-			$_indexless_current = untrailingslashit( preg_replace( '/' . preg_quote( $wp_rewrite->index, '/' ) . '$/', '', $current_url ) );
404
-
405
-			if ( $raw_item_url && in_array( $item_url, array( $current_url, $_indexless_current, $_root_relative_current ) ) ) {
398
+		} elseif ('custom' == $menu_item->object && isset($_SERVER['HTTP_HOST'])) {
399
+			$_root_relative_current = untrailingslashit($_SERVER['REQUEST_URI']);
400
+			$current_url = set_url_scheme('http://'.$_SERVER['HTTP_HOST'].$_root_relative_current);
401
+			$raw_item_url = strpos($menu_item->url, '#') ? substr($menu_item->url, 0, strpos($menu_item->url, '#')) : $menu_item->url;
402
+			$item_url = set_url_scheme(untrailingslashit($raw_item_url));
403
+			$_indexless_current = untrailingslashit(preg_replace('/'.preg_quote($wp_rewrite->index, '/').'$/', '', $current_url));
404
+
405
+			if ($raw_item_url && in_array($item_url, array($current_url, $_indexless_current, $_root_relative_current))) {
406 406
 				$classes[] = 'current-menu-item';
407 407
 				$menu_items[$key]->current = true;
408 408
 				$_anc_id = (int) $menu_item->db_id;
409 409
 
410
-				while(
411
-					( $_anc_id = get_post_meta( $_anc_id, '_menu_item_menu_item_parent', true ) ) &&
412
-					! in_array( $_anc_id, $active_ancestor_item_ids )
410
+				while (
411
+					($_anc_id = get_post_meta($_anc_id, '_menu_item_menu_item_parent', true)) &&
412
+					! in_array($_anc_id, $active_ancestor_item_ids)
413 413
 				) {
414 414
 					$active_ancestor_item_ids[] = $_anc_id;
415 415
 				}
416 416
 
417
-				if ( in_array( home_url(), array( untrailingslashit( $current_url ), untrailingslashit( $_indexless_current ) ) ) ) {
417
+				if (in_array(home_url(), array(untrailingslashit($current_url), untrailingslashit($_indexless_current)))) {
418 418
 					// Back compat for home link to match wp_page_menu()
419 419
 					$classes[] = 'current_page_item';
420 420
 				}
@@ -423,77 +423,77 @@  discard block
 block discarded – undo
423 423
 				$active_object = $menu_item->object;
424 424
 
425 425
 			// give front page item current-menu-item class when extra query arguments involved
426
-			} elseif ( $item_url == $front_page_url && is_front_page() ) {
426
+			} elseif ($item_url == $front_page_url && is_front_page()) {
427 427
 				$classes[] = 'current-menu-item';
428 428
 			}
429 429
 
430
-			if ( untrailingslashit($item_url) == home_url() )
430
+			if (untrailingslashit($item_url) == home_url())
431 431
 				$classes[] = 'menu-item-home';
432 432
 		}
433 433
 
434 434
 		// back-compat with wp_page_menu: add "current_page_parent" to static home page link for any non-page query
435
-		if ( ! empty( $home_page_id ) && 'post_type' == $menu_item->type && empty( $wp_query->is_page ) && $home_page_id == $menu_item->object_id )
435
+		if ( ! empty($home_page_id) && 'post_type' == $menu_item->type && empty($wp_query->is_page) && $home_page_id == $menu_item->object_id)
436 436
 			$classes[] = 'current_page_parent';
437 437
 
438
-		$menu_items[$key]->classes = array_unique( $classes );
438
+		$menu_items[$key]->classes = array_unique($classes);
439 439
 	}
440
-	$active_ancestor_item_ids = array_filter( array_unique( $active_ancestor_item_ids ) );
441
-	$active_parent_item_ids = array_filter( array_unique( $active_parent_item_ids ) );
442
-	$active_parent_object_ids = array_filter( array_unique( $active_parent_object_ids ) );
440
+	$active_ancestor_item_ids = array_filter(array_unique($active_ancestor_item_ids));
441
+	$active_parent_item_ids = array_filter(array_unique($active_parent_item_ids));
442
+	$active_parent_object_ids = array_filter(array_unique($active_parent_object_ids));
443 443
 
444 444
 	// set parent's class
445
-	foreach ( (array) $menu_items as $key => $parent_item ) {
445
+	foreach ((array) $menu_items as $key => $parent_item) {
446 446
 		$classes = (array) $parent_item->classes;
447 447
 		$menu_items[$key]->current_item_ancestor = false;
448 448
 		$menu_items[$key]->current_item_parent = false;
449 449
 
450 450
 		if (
451
-			isset( $parent_item->type ) &&
451
+			isset($parent_item->type) &&
452 452
 			(
453 453
 				// ancestral post object
454 454
 				(
455 455
 					'post_type' == $parent_item->type &&
456
-					! empty( $queried_object->post_type ) &&
457
-					is_post_type_hierarchical( $queried_object->post_type ) &&
458
-					in_array( $parent_item->object_id, $queried_object->ancestors ) &&
456
+					! empty($queried_object->post_type) &&
457
+					is_post_type_hierarchical($queried_object->post_type) &&
458
+					in_array($parent_item->object_id, $queried_object->ancestors) &&
459 459
 					$parent_item->object != $queried_object->ID
460 460
 				) ||
461 461
 
462 462
 				// ancestral term
463 463
 				(
464 464
 					'taxonomy' == $parent_item->type &&
465
-					isset( $possible_taxonomy_ancestors[ $parent_item->object ] ) &&
466
-					in_array( $parent_item->object_id, $possible_taxonomy_ancestors[ $parent_item->object ] ) &&
465
+					isset($possible_taxonomy_ancestors[$parent_item->object]) &&
466
+					in_array($parent_item->object_id, $possible_taxonomy_ancestors[$parent_item->object]) &&
467 467
 					(
468
-						! isset( $queried_object->term_id ) ||
468
+						! isset($queried_object->term_id) ||
469 469
 						$parent_item->object_id != $queried_object->term_id
470 470
 					)
471 471
 				)
472 472
 			)
473 473
 		) {
474
-			$classes[] = empty( $queried_object->taxonomy ) ? 'current-' . $queried_object->post_type . '-ancestor' : 'current-' . $queried_object->taxonomy . '-ancestor';
474
+			$classes[] = empty($queried_object->taxonomy) ? 'current-'.$queried_object->post_type.'-ancestor' : 'current-'.$queried_object->taxonomy.'-ancestor';
475 475
 		}
476 476
 
477
-		if ( in_array(  intval( $parent_item->db_id ), $active_ancestor_item_ids ) ) {
477
+		if (in_array(intval($parent_item->db_id), $active_ancestor_item_ids)) {
478 478
 			$classes[] = 'current-menu-ancestor';
479 479
 			$menu_items[$key]->current_item_ancestor = true;
480 480
 		}
481
-		if ( in_array( $parent_item->db_id, $active_parent_item_ids ) ) {
481
+		if (in_array($parent_item->db_id, $active_parent_item_ids)) {
482 482
 			$classes[] = 'current-menu-parent';
483 483
 			$menu_items[$key]->current_item_parent = true;
484 484
 		}
485
-		if ( in_array( $parent_item->object_id, $active_parent_object_ids ) )
486
-			$classes[] = 'current-' . $active_object . '-parent';
485
+		if (in_array($parent_item->object_id, $active_parent_object_ids))
486
+			$classes[] = 'current-'.$active_object.'-parent';
487 487
 
488
-		if ( 'post_type' == $parent_item->type && 'page' == $parent_item->object ) {
488
+		if ('post_type' == $parent_item->type && 'page' == $parent_item->object) {
489 489
 			// Back compat classes for pages to match wp_page_menu()
490
-			if ( in_array('current-menu-parent', $classes) )
490
+			if (in_array('current-menu-parent', $classes))
491 491
 				$classes[] = 'current_page_parent';
492
-			if ( in_array('current-menu-ancestor', $classes) )
492
+			if (in_array('current-menu-ancestor', $classes))
493 493
 				$classes[] = 'current_page_ancestor';
494 494
 		}
495 495
 
496
-		$menu_items[$key]->classes = array_unique( $classes );
496
+		$menu_items[$key]->classes = array_unique($classes);
497 497
 	}
498 498
 }
499 499
 
@@ -508,11 +508,11 @@  discard block
 block discarded – undo
508 508
  * @param stdClass $r     An object containing wp_nav_menu() arguments.
509 509
  * @return string The HTML list content for the menu items.
510 510
  */
511
-function walk_nav_menu_tree( $items, $depth, $r ) {
512
-	$walker = ( empty($r->walker) ) ? new Walker_Nav_Menu : $r->walker;
513
-	$args = array( $items, $depth, $r );
511
+function walk_nav_menu_tree($items, $depth, $r) {
512
+	$walker = (empty($r->walker)) ? new Walker_Nav_Menu : $r->walker;
513
+	$args = array($items, $depth, $r);
514 514
 
515
-	return call_user_func_array( array( $walker, 'walk' ), $args );
515
+	return call_user_func_array(array($walker, 'walk'), $args);
516 516
 }
517 517
 
518 518
 /**
@@ -526,9 +526,9 @@  discard block
 block discarded – undo
526 526
  * @param object $item
527 527
  * @return string
528 528
  */
529
-function _nav_menu_item_id_use_once( $id, $item ) {
529
+function _nav_menu_item_id_use_once($id, $item) {
530 530
 	static $_used_ids = array();
531
-	if ( in_array( $item->ID, $_used_ids ) ) {
531
+	if (in_array($item->ID, $_used_ids)) {
532 532
 		return '';
533 533
 	}
534 534
 	$_used_ids[] = $item->ID;
Please login to merge, or discard this patch.
src/wp-includes/feed-rss2.php 2 patches
Braces   +10 added lines, -4 removed lines patch added patch discarded remove patch
@@ -91,13 +91,19 @@
 block discarded – undo
91 91
 		<guid isPermaLink="false"><?php the_guid(); ?></guid>
92 92
 <?php if (get_option('rss_use_excerpt')) : ?>
93 93
 		<description><![CDATA[<?php the_excerpt_rss(); ?>]]></description>
94
-<?php else : ?>
95
-		<description><![CDATA[<?php the_excerpt_rss(); ?>]]></description>
94
+<?php else {
95
+	: ?>
96
+		<description><![CDATA[<?php the_excerpt_rss();
97
+}
98
+?>]]></description>
96 99
 	<?php $content = get_the_content_feed('rss2'); ?>
97 100
 	<?php if ( strlen( $content ) > 0 ) : ?>
98 101
 		<content:encoded><![CDATA[<?php echo $content; ?>]]></content:encoded>
99
-	<?php else : ?>
100
-		<content:encoded><![CDATA[<?php the_excerpt_rss(); ?>]]></content:encoded>
102
+	<?php else {
103
+	: ?>
104
+		<content:encoded><![CDATA[<?php the_excerpt_rss();
105
+}
106
+?>]]></content:encoded>
101 107
 	<?php endif; ?>
102 108
 <?php endif; ?>
103 109
 		<wfw:commentRss><?php echo esc_url( get_post_comments_feed_link(null, 'rss2') ); ?></wfw:commentRss>
Please login to merge, or discard this patch.
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -5,7 +5,7 @@  discard block
 block discarded – undo
5 5
  * @package WordPress
6 6
  */
7 7
 
8
-header('Content-Type: ' . feed_content_type('rss2') . '; charset=' . get_option('blog_charset'), true);
8
+header('Content-Type: '.feed_content_type('rss2').'; charset='.get_option('blog_charset'), true);
9 9
 $more = 1;
10 10
 
11 11
 echo '<?xml version="1.0" encoding="'.get_option('blog_charset').'"?'.'>';
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
  * @param string $context Type of feed. Possible values include 'rss2', 'rss2-comments',
19 19
  *                        'rdf', 'atom', and 'atom-comments'.
20 20
  */
21
-do_action( 'rss_tag_pre', 'rss2' );
21
+do_action('rss_tag_pre', 'rss2');
22 22
 ?>
23 23
 <rss version="2.0"
24 24
 	xmlns:content="http://purl.org/rss/1.0/modules/content/"
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
 	 *
34 34
 	 * @since 2.0.0
35 35
 	 */
36
-	do_action( 'rss2_ns' );
36
+	do_action('rss2_ns');
37 37
 	?>
38 38
 >
39 39
 
@@ -43,10 +43,10 @@  discard block
 block discarded – undo
43 43
 	<link><?php bloginfo_rss('url') ?></link>
44 44
 	<description><?php bloginfo_rss("description") ?></description>
45 45
 	<lastBuildDate><?php
46
-		$date = get_lastpostmodified( 'GMT' );
47
-		echo $date ? mysql2date( 'r', $date, false ) : date( 'r' );
46
+		$date = get_lastpostmodified('GMT');
47
+		echo $date ? mysql2date('r', $date, false) : date('r');
48 48
 	?></lastBuildDate>
49
-	<language><?php bloginfo_rss( 'language' ); ?></language>
49
+	<language><?php bloginfo_rss('language'); ?></language>
50 50
 	<sy:updatePeriod><?php
51 51
 		$duration = 'hourly';
52 52
 
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
 		 * @param string $duration The update period. Accepts 'hourly', 'daily', 'weekly', 'monthly',
59 59
 		 *                         'yearly'. Default 'hourly'.
60 60
 		 */
61
-		echo apply_filters( 'rss_update_period', $duration );
61
+		echo apply_filters('rss_update_period', $duration);
62 62
 	?></sy:updatePeriod>
63 63
 	<sy:updateFrequency><?php
64 64
 		$frequency = '1';
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
 		 * @param string $frequency An integer passed as a string representing the frequency
72 72
 		 *                          of RSS updates within the update period. Default '1'.
73 73
 		 */
74
-		echo apply_filters( 'rss_update_frequency', $frequency );
74
+		echo apply_filters('rss_update_frequency', $frequency);
75 75
 	?></sy:updateFrequency>
76 76
 	<?php
77 77
 	/**
@@ -79,14 +79,14 @@  discard block
 block discarded – undo
79 79
 	 *
80 80
 	 * @since 2.0.0
81 81
 	 */
82
-	do_action( 'rss2_head');
82
+	do_action('rss2_head');
83 83
 
84
-	while( have_posts()) : the_post();
84
+	while (have_posts()) : the_post();
85 85
 	?>
86 86
 	<item>
87 87
 		<title><?php the_title_rss() ?></title>
88 88
 		<link><?php the_permalink_rss() ?></link>
89
-<?php if ( get_comments_number() || comments_open() ) : ?>
89
+<?php if (get_comments_number() || comments_open()) : ?>
90 90
 		<comments><?php comments_link_feed(); ?></comments>
91 91
 <?php endif; ?>
92 92
 		<pubDate><?php echo mysql2date('D, d M Y H:i:s +0000', get_post_time('Y-m-d H:i:s', true), false); ?></pubDate>
@@ -99,14 +99,14 @@  discard block
 block discarded – undo
99 99
 <?php else : ?>
100 100
 		<description><![CDATA[<?php the_excerpt_rss(); ?>]]></description>
101 101
 	<?php $content = get_the_content_feed('rss2'); ?>
102
-	<?php if ( strlen( $content ) > 0 ) : ?>
102
+	<?php if (strlen($content) > 0) : ?>
103 103
 		<content:encoded><![CDATA[<?php echo $content; ?>]]></content:encoded>
104 104
 	<?php else : ?>
105 105
 		<content:encoded><![CDATA[<?php the_excerpt_rss(); ?>]]></content:encoded>
106 106
 	<?php endif; ?>
107 107
 <?php endif; ?>
108
-<?php if ( get_comments_number() || comments_open() ) : ?>
109
-		<wfw:commentRss><?php echo esc_url( get_post_comments_feed_link(null, 'rss2') ); ?></wfw:commentRss>
108
+<?php if (get_comments_number() || comments_open()) : ?>
109
+		<wfw:commentRss><?php echo esc_url(get_post_comments_feed_link(null, 'rss2')); ?></wfw:commentRss>
110 110
 		<slash:comments><?php echo get_comments_number(); ?></slash:comments>
111 111
 <?php endif; ?>
112 112
 <?php rss_enclosure(); ?>
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
 	 *
117 117
 	 * @since 2.0.0
118 118
 	 */
119
-	do_action( 'rss2_item' );
119
+	do_action('rss2_item');
120 120
 	?>
121 121
 	</item>
122 122
 	<?php endwhile; ?>
Please login to merge, or discard this patch.
src/wp-includes/SimplePie/HTTP/Parser.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -258,7 +258,7 @@  discard block
 block discarded – undo
258 258
 			// We should only use the last Content-Type header. c.f. issue #1
259 259
 			if (isset($this->headers[$this->name]) && $this->name !== 'content-type')
260 260
 			{
261
-				$this->headers[$this->name] .= ', ' . $this->value;
261
+				$this->headers[$this->name] .= ', '.$this->value;
262 262
 			}
263 263
 			else
264 264
 			{
@@ -441,7 +441,7 @@  discard block
 block discarded – undo
441 441
 	protected function body()
442 442
 	{
443 443
 		$this->body = substr($this->data, $this->position);
444
-		if (!empty($this->headers['transfer-encoding']))
444
+		if ( ! empty($this->headers['transfer-encoding']))
445 445
 		{
446 446
 			unset($this->headers['transfer-encoding']);
447 447
 			$this->state = 'chunked';
@@ -457,7 +457,7 @@  discard block
 block discarded – undo
457 457
 	 */
458 458
 	protected function chunked()
459 459
 	{
460
-		if (!preg_match('/^([0-9a-f]+)[^\r\n]*\r\n/i', trim($this->body)))
460
+		if ( ! preg_match('/^([0-9a-f]+)[^\r\n]*\r\n/i', trim($this->body)))
461 461
 		{
462 462
 			$this->state = 'emit';
463 463
 			return;
@@ -468,8 +468,8 @@  discard block
 block discarded – undo
468 468
 
469 469
 		while (true)
470 470
 		{
471
-			$is_chunked = (bool) preg_match( '/^([0-9a-f]+)[^\r\n]*\r\n/i', $encoded, $matches );
472
-			if (!$is_chunked)
471
+			$is_chunked = (bool) preg_match('/^([0-9a-f]+)[^\r\n]*\r\n/i', $encoded, $matches);
472
+			if ( ! $is_chunked)
473 473
 			{
474 474
 				// Looks like it's not chunked after all
475 475
 				$this->state = 'emit';
Please login to merge, or discard this patch.
Braces   +13 added lines, -26 removed lines patch added patch discarded remove patch
@@ -155,8 +155,7 @@  discard block
 block discarded – undo
155 155
 		if ($this->state === 'emit' || $this->state === 'body')
156 156
 		{
157 157
 			return true;
158
-		}
159
-		else
158
+		} else
160 159
 		{
161 160
 			$this->http_version = '';
162 161
 			$this->status_code = '';
@@ -206,13 +205,11 @@  discard block
 block discarded – undo
206 205
 				$this->http_version = (float) $this->http_version;
207 206
 				$this->position += strspn($this->data, "\x09\x20", $this->position);
208 207
 				$this->state = 'status';
209
-			}
210
-			else
208
+			} else
211 209
 			{
212 210
 				$this->state = false;
213 211
 			}
214
-		}
215
-		else
212
+		} else
216 213
 		{
217 214
 			$this->state = false;
218 215
 		}
@@ -228,8 +225,7 @@  discard block
 block discarded – undo
228 225
 			$this->status_code = (int) substr($this->data, $this->position, $len);
229 226
 			$this->position += $len;
230 227
 			$this->state = 'reason';
231
-		}
232
-		else
228
+		} else
233 229
 		{
234 230
 			$this->state = false;
235 231
 		}
@@ -259,8 +255,7 @@  discard block
 block discarded – undo
259 255
 			if (isset($this->headers[$this->name]) && $this->name !== 'content-type')
260 256
 			{
261 257
 				$this->headers[$this->name] .= ', ' . $this->value;
262
-			}
263
-			else
258
+			} else
264 259
 			{
265 260
 				$this->headers[$this->name] = $this->value;
266 261
 			}
@@ -271,13 +266,11 @@  discard block
 block discarded – undo
271 266
 		{
272 267
 			$this->position += 2;
273 268
 			$this->state = 'body';
274
-		}
275
-		elseif ($this->data[$this->position] === "\x0A")
269
+		} elseif ($this->data[$this->position] === "\x0A")
276 270
 		{
277 271
 			$this->position++;
278 272
 			$this->state = 'body';
279
-		}
280
-		else
273
+		} else
281 274
 		{
282 275
 			$this->state = 'name';
283 276
 		}
@@ -295,15 +288,13 @@  discard block
 block discarded – undo
295 288
 			{
296 289
 				$this->position += $len;
297 290
 				$this->state = 'new_line';
298
-			}
299
-			else
291
+			} else
300 292
 			{
301 293
 				$this->name = substr($this->data, $this->position, $len);
302 294
 				$this->position += $len + 1;
303 295
 				$this->state = 'value';
304 296
 			}
305
-		}
306
-		else
297
+		} else
307 298
 		{
308 299
 			$this->state = false;
309 300
 		}
@@ -319,8 +310,7 @@  discard block
 block discarded – undo
319 310
 			if (substr($this->data, $this->position, 2) === "\x0D\x0A")
320 311
 			{
321 312
 				$this->position += 2;
322
-			}
323
-			elseif ($this->data[$this->position] === "\x0A")
313
+			} elseif ($this->data[$this->position] === "\x0A")
324 314
 			{
325 315
 				$this->position++;
326 316
 			}
@@ -337,8 +327,7 @@  discard block
 block discarded – undo
337 327
 		if ($this->is_linear_whitespace())
338 328
 		{
339 329
 			$this->linear_whitespace();
340
-		}
341
-		else
330
+		} else
342 331
 		{
343 332
 			switch ($this->data[$this->position])
344 333
 			{
@@ -387,8 +376,7 @@  discard block
 block discarded – undo
387 376
 		if ($this->is_linear_whitespace())
388 377
 		{
389 378
 			$this->linear_whitespace();
390
-		}
391
-		else
379
+		} else
392 380
 		{
393 381
 			switch ($this->data[$this->position])
394 382
 			{
@@ -445,8 +433,7 @@  discard block
 block discarded – undo
445 433
 		{
446 434
 			unset($this->headers['transfer-encoding']);
447 435
 			$this->state = 'chunked';
448
-		}
449
-		else
436
+		} else
450 437
 		{
451 438
 			$this->state = 'emit';
452 439
 		}
Please login to merge, or discard this patch.
src/wp-includes/SimplePie/Source.php 2 patches
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
 			$categories[] = $this->registry->create('Category', array($this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null));
198 198
 		}
199 199
 
200
-		if (!empty($categories))
200
+		if ( ! empty($categories))
201 201
 		{
202 202
 			return array_unique($categories);
203 203
 		}
@@ -280,7 +280,7 @@  discard block
 block discarded – undo
280 280
 			$authors[] = $this->registry->create('Author', array($this->sanitize($author['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null));
281 281
 		}
282 282
 
283
-		if (!empty($authors))
283
+		if ( ! empty($authors))
284 284
 		{
285 285
 			return array_unique($authors);
286 286
 		}
@@ -351,7 +351,7 @@  discard block
 block discarded – undo
351 351
 			}
352 352
 		}
353 353
 
354
-		if (!empty($contributors))
354
+		if ( ! empty($contributors))
355 355
 		{
356 356
 			return array_unique($contributors);
357 357
 		}
@@ -384,7 +384,7 @@  discard block
 block discarded – undo
384 384
 
385 385
 	public function get_links($rel = 'alternate')
386 386
 	{
387
-		if (!isset($this->data['links']))
387
+		if ( ! isset($this->data['links']))
388 388
 		{
389 389
 			$this->data['links'] = array();
390 390
 			if ($links = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'link'))
@@ -428,19 +428,19 @@  discard block
 block discarded – undo
428 428
 			{
429 429
 				if ($this->registry->call('Misc', 'is_isegment_nz_nc', array($key)))
430 430
 				{
431
-					if (isset($this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key]))
431
+					if (isset($this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY.$key]))
432 432
 					{
433
-						$this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key] = array_merge($this->data['links'][$key], $this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key]);
434
-						$this->data['links'][$key] =& $this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key];
433
+						$this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY.$key] = array_merge($this->data['links'][$key], $this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY.$key]);
434
+						$this->data['links'][$key] = & $this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY.$key];
435 435
 					}
436 436
 					else
437 437
 					{
438
-						$this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key] =& $this->data['links'][$key];
438
+						$this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY.$key] = & $this->data['links'][$key];
439 439
 					}
440 440
 				}
441 441
 				elseif (substr($key, 0, 41) === SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY)
442 442
 				{
443
-					$this->data['links'][substr($key, 41)] =& $this->data['links'][$key];
443
+					$this->data['links'][substr($key, 41)] = & $this->data['links'][$key];
444 444
 				}
445 445
 				$this->data['links'][$key] = array_unique($this->data['links'][$key]);
446 446
 			}
Please login to merge, or discard this patch.
Braces   +45 added lines, -90 removed lines patch added patch discarded remove patch
@@ -79,8 +79,7 @@  discard block
 block discarded – undo
79 79
 		if (isset($this->data['child'][$namespace][$tag]))
80 80
 		{
81 81
 			return $this->data['child'][$namespace][$tag];
82
-		}
83
-		else
82
+		} else
84 83
 		{
85 84
 			return null;
86 85
 		}
@@ -106,32 +105,25 @@  discard block
 block discarded – undo
106 105
 		if ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'title'))
107 106
 		{
108 107
 			return $this->sanitize($return[0]['data'], $this->registry->call('Misc', 'atom_10_construct_type', array($return[0]['attribs'])), $this->get_base($return[0]));
109
-		}
110
-		elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'title'))
108
+		} elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'title'))
111 109
 		{
112 110
 			return $this->sanitize($return[0]['data'], $this->registry->call('Misc', 'atom_03_construct_type', array($return[0]['attribs'])), $this->get_base($return[0]));
113
-		}
114
-		elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'title'))
111
+		} elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'title'))
115 112
 		{
116 113
 			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0]));
117
-		}
118
-		elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'title'))
114
+		} elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'title'))
119 115
 		{
120 116
 			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0]));
121
-		}
122
-		elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'title'))
117
+		} elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'title'))
123 118
 		{
124 119
 			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0]));
125
-		}
126
-		elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_11, 'title'))
120
+		} elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_11, 'title'))
127 121
 		{
128 122
 			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
129
-		}
130
-		elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_10, 'title'))
123
+		} elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_10, 'title'))
131 124
 		{
132 125
 			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
133
-		}
134
-		else
126
+		} else
135 127
 		{
136 128
 			return null;
137 129
 		}
@@ -143,8 +135,7 @@  discard block
 block discarded – undo
143 135
 		if (isset($categories[$key]))
144 136
 		{
145 137
 			return $categories[$key];
146
-		}
147
-		else
138
+		} else
148 139
 		{
149 140
 			return null;
150 141
 		}
@@ -181,8 +172,7 @@  discard block
 block discarded – undo
181 172
 			if (isset($category['attribs']['']['domain']))
182 173
 			{
183 174
 				$scheme = $this->sanitize($category['attribs']['']['domain'], SIMPLEPIE_CONSTRUCT_TEXT);
184
-			}
185
-			else
175
+			} else
186 176
 			{
187 177
 				$scheme = null;
188 178
 			}
@@ -200,8 +190,7 @@  discard block
 block discarded – undo
200 190
 		if (!empty($categories))
201 191
 		{
202 192
 			return array_unique($categories);
203
-		}
204
-		else
193
+		} else
205 194
 		{
206 195
 			return null;
207 196
 		}
@@ -213,8 +202,7 @@  discard block
 block discarded – undo
213 202
 		if (isset($authors[$key]))
214 203
 		{
215 204
 			return $authors[$key];
216
-		}
217
-		else
205
+		} else
218 206
 		{
219 207
 			return null;
220 208
 		}
@@ -283,8 +271,7 @@  discard block
 block discarded – undo
283 271
 		if (!empty($authors))
284 272
 		{
285 273
 			return array_unique($authors);
286
-		}
287
-		else
274
+		} else
288 275
 		{
289 276
 			return null;
290 277
 		}
@@ -296,8 +283,7 @@  discard block
 block discarded – undo
296 283
 		if (isset($contributors[$key]))
297 284
 		{
298 285
 			return $contributors[$key];
299
-		}
300
-		else
286
+		} else
301 287
 		{
302 288
 			return null;
303 289
 		}
@@ -354,8 +340,7 @@  discard block
 block discarded – undo
354 340
 		if (!empty($contributors))
355 341
 		{
356 342
 			return array_unique($contributors);
357
-		}
358
-		else
343
+		} else
359 344
 		{
360 345
 			return null;
361 346
 		}
@@ -367,8 +352,7 @@  discard block
 block discarded – undo
367 352
 		if (isset($links[$key]))
368 353
 		{
369 354
 			return $links[$key];
370
-		}
371
-		else
355
+		} else
372 356
 		{
373 357
 			return null;
374 358
 		}
@@ -432,13 +416,11 @@  discard block
 block discarded – undo
432 416
 					{
433 417
 						$this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key] = array_merge($this->data['links'][$key], $this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key]);
434 418
 						$this->data['links'][$key] =& $this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key];
435
-					}
436
-					else
419
+					} else
437 420
 					{
438 421
 						$this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key] =& $this->data['links'][$key];
439 422
 					}
440
-				}
441
-				elseif (substr($key, 0, 41) === SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY)
423
+				} elseif (substr($key, 0, 41) === SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY)
442 424
 				{
443 425
 					$this->data['links'][substr($key, 41)] =& $this->data['links'][$key];
444 426
 				}
@@ -449,8 +431,7 @@  discard block
 block discarded – undo
449 431
 		if (isset($this->data['links'][$rel]))
450 432
 		{
451 433
 			return $this->data['links'][$rel];
452
-		}
453
-		else
434
+		} else
454 435
 		{
455 436
 			return null;
456 437
 		}
@@ -461,40 +442,31 @@  discard block
 block discarded – undo
461 442
 		if ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'subtitle'))
462 443
 		{
463 444
 			return $this->sanitize($return[0]['data'], $this->registry->call('Misc', 'atom_10_construct_type', array($return[0]['attribs'])), $this->get_base($return[0]));
464
-		}
465
-		elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'tagline'))
445
+		} elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'tagline'))
466 446
 		{
467 447
 			return $this->sanitize($return[0]['data'], $this->registry->call('Misc', 'atom_03_construct_type', array($return[0]['attribs'])), $this->get_base($return[0]));
468
-		}
469
-		elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'description'))
448
+		} elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'description'))
470 449
 		{
471 450
 			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0]));
472
-		}
473
-		elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'description'))
451
+		} elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'description'))
474 452
 		{
475 453
 			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0]));
476
-		}
477
-		elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'description'))
454
+		} elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'description'))
478 455
 		{
479 456
 			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0]));
480
-		}
481
-		elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_11, 'description'))
457
+		} elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_11, 'description'))
482 458
 		{
483 459
 			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
484
-		}
485
-		elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_10, 'description'))
460
+		} elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_10, 'description'))
486 461
 		{
487 462
 			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
488
-		}
489
-		elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'summary'))
463
+		} elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'summary'))
490 464
 		{
491 465
 			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_HTML, $this->get_base($return[0]));
492
-		}
493
-		elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'subtitle'))
466
+		} elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'subtitle'))
494 467
 		{
495 468
 			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_HTML, $this->get_base($return[0]));
496
-		}
497
-		else
469
+		} else
498 470
 		{
499 471
 			return null;
500 472
 		}
@@ -505,24 +477,19 @@  discard block
 block discarded – undo
505 477
 		if ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'rights'))
506 478
 		{
507 479
 			return $this->sanitize($return[0]['data'], $this->registry->call('Misc', 'atom_10_construct_type', array($return[0]['attribs'])), $this->get_base($return[0]));
508
-		}
509
-		elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'copyright'))
480
+		} elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'copyright'))
510 481
 		{
511 482
 			return $this->sanitize($return[0]['data'], $this->registry->call('Misc', 'atom_03_construct_type', array($return[0]['attribs'])), $this->get_base($return[0]));
512
-		}
513
-		elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'copyright'))
483
+		} elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'copyright'))
514 484
 		{
515 485
 			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
516
-		}
517
-		elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_11, 'rights'))
486
+		} elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_11, 'rights'))
518 487
 		{
519 488
 			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
520
-		}
521
-		elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_10, 'rights'))
489
+		} elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_10, 'rights'))
522 490
 		{
523 491
 			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
524
-		}
525
-		else
492
+		} else
526 493
 		{
527 494
 			return null;
528 495
 		}
@@ -533,20 +500,16 @@  discard block
 block discarded – undo
533 500
 		if ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'language'))
534 501
 		{
535 502
 			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
536
-		}
537
-		elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_11, 'language'))
503
+		} elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_11, 'language'))
538 504
 		{
539 505
 			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
540
-		}
541
-		elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_10, 'language'))
506
+		} elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_10, 'language'))
542 507
 		{
543 508
 			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
544
-		}
545
-		elseif (isset($this->data['xml_lang']))
509
+		} elseif (isset($this->data['xml_lang']))
546 510
 		{
547 511
 			return $this->sanitize($this->data['xml_lang'], SIMPLEPIE_CONSTRUCT_TEXT);
548
-		}
549
-		else
512
+		} else
550 513
 		{
551 514
 			return null;
552 515
 		}
@@ -557,12 +520,10 @@  discard block
 block discarded – undo
557 520
 		if ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_W3C_BASIC_GEO, 'lat'))
558 521
 		{
559 522
 			return (float) $return[0]['data'];
560
-		}
561
-		elseif (($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_GEORSS, 'point')) && preg_match('/^((?:-)?[0-9]+(?:\.[0-9]+)) ((?:-)?[0-9]+(?:\.[0-9]+))$/', trim($return[0]['data']), $match))
523
+		} elseif (($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_GEORSS, 'point')) && preg_match('/^((?:-)?[0-9]+(?:\.[0-9]+)) ((?:-)?[0-9]+(?:\.[0-9]+))$/', trim($return[0]['data']), $match))
562 524
 		{
563 525
 			return (float) $match[1];
564
-		}
565
-		else
526
+		} else
566 527
 		{
567 528
 			return null;
568 529
 		}
@@ -573,16 +534,13 @@  discard block
 block discarded – undo
573 534
 		if ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_W3C_BASIC_GEO, 'long'))
574 535
 		{
575 536
 			return (float) $return[0]['data'];
576
-		}
577
-		elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_W3C_BASIC_GEO, 'lon'))
537
+		} elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_W3C_BASIC_GEO, 'lon'))
578 538
 		{
579 539
 			return (float) $return[0]['data'];
580
-		}
581
-		elseif (($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_GEORSS, 'point')) && preg_match('/^((?:-)?[0-9]+(?:\.[0-9]+)) ((?:-)?[0-9]+(?:\.[0-9]+))$/', trim($return[0]['data']), $match))
540
+		} elseif (($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_GEORSS, 'point')) && preg_match('/^((?:-)?[0-9]+(?:\.[0-9]+)) ((?:-)?[0-9]+(?:\.[0-9]+))$/', trim($return[0]['data']), $match))
582 541
 		{
583 542
 			return (float) $match[2];
584
-		}
585
-		else
543
+		} else
586 544
 		{
587 545
 			return null;
588 546
 		}
@@ -593,16 +551,13 @@  discard block
 block discarded – undo
593 551
 		if ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'image'))
594 552
 		{
595 553
 			return $this->sanitize($return[0]['attribs']['']['href'], SIMPLEPIE_CONSTRUCT_IRI);
596
-		}
597
-		elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'logo'))
554
+		} elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'logo'))
598 555
 		{
599 556
 			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($return[0]));
600
-		}
601
-		elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'icon'))
557
+		} elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'icon'))
602 558
 		{
603 559
 			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($return[0]));
604
-		}
605
-		else
560
+		} else
606 561
 		{
607 562
 			return null;
608 563
 		}
Please login to merge, or discard this patch.