Completed
Push — master ( cde0c6...d99bf9 )
by Stephen
15:46
created
src/wp-includes/SimplePie/Sanitize.php 3 patches
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -229,7 +229,7 @@  discard block
 block discarded – undo
229 229
 		{
230 230
 			if ($type & SIMPLEPIE_CONSTRUCT_MAYBE_HTML)
231 231
 			{
232
-				if (preg_match('/(&(#(x[0-9a-fA-F]+|[0-9]+)|[a-zA-Z0-9]+)|<\/[A-Za-z][^\x09\x0A\x0B\x0C\x0D\x20\x2F\x3E]*' . SIMPLEPIE_PCRE_HTML_ATTRIBUTE . '>)/', $data))
232
+				if (preg_match('/(&(#(x[0-9a-fA-F]+|[0-9]+)|[a-zA-Z0-9]+)|<\/[A-Za-z][^\x09\x0A\x0B\x0C\x0D\x20\x2F\x3E]*'.SIMPLEPIE_PCRE_HTML_ATTRIBUTE.'>)/', $data))
233 233
 				{
234 234
 					$type |= SIMPLEPIE_CONSTRUCT_HTML;
235 235
 				}
@@ -247,7 +247,7 @@  discard block
 block discarded – undo
247 247
 			if ($type & (SIMPLEPIE_CONSTRUCT_HTML | SIMPLEPIE_CONSTRUCT_XHTML))
248 248
 			{
249 249
 
250
-				if (!class_exists('DOMDocument'))
250
+				if ( ! class_exists('DOMDocument'))
251 251
 				{
252 252
 					$this->registry->call('Misc', 'error', array('DOMDocument not found, unable to use sanitizer', E_USER_WARNING, __FILE__, __LINE__));
253 253
 					return '';
@@ -311,7 +311,7 @@  discard block
 block discarded – undo
311 311
 
312 312
 							if ($cache->load())
313 313
 							{
314
-								$img->setAttribute('src', $this->image_handler . $image_url);
314
+								$img->setAttribute('src', $this->image_handler.$image_url);
315 315
 							}
316 316
 							else
317 317
 							{
@@ -322,7 +322,7 @@  discard block
 block discarded – undo
322 322
 								{
323 323
 									if ($cache->save(array('headers' => $file->headers, 'body' => $file->body)))
324 324
 									{
325
-										$img->setAttribute('src', $this->image_handler . $image_url);
325
+										$img->setAttribute('src', $this->image_handler.$image_url);
326 326
 									}
327 327
 									else
328 328
 									{
@@ -350,12 +350,12 @@  discard block
 block discarded – undo
350 350
 
351 351
 				if ($this->remove_div)
352 352
 				{
353
-					$data = preg_replace('/^<div' . SIMPLEPIE_PCRE_XML_ATTRIBUTE . '>/', '', $data);
353
+					$data = preg_replace('/^<div'.SIMPLEPIE_PCRE_XML_ATTRIBUTE.'>/', '', $data);
354 354
 					$data = preg_replace('/<\/div>$/', '', $data);
355 355
 				}
356 356
 				else
357 357
 				{
358
-					$data = preg_replace('/^<div' . SIMPLEPIE_PCRE_XML_ATTRIBUTE . '>/', '<div>', $data);
358
+					$data = preg_replace('/^<div'.SIMPLEPIE_PCRE_XML_ATTRIBUTE.'>/', '<div>', $data);
359 359
 				}
360 360
 			}
361 361
 
@@ -388,7 +388,7 @@  discard block
 block discarded – undo
388 388
 		{
389 389
 			// Atom XHTML constructs are wrapped with a div by default
390 390
 			// Note: No protection if $html contains a stray </div>!
391
-			$html = '<div>' . $html . '</div>';
391
+			$html = '<div>'.$html.'</div>';
392 392
 			$ret .= '<!DOCTYPE html>';
393 393
 			$content_type = 'text/html';
394 394
 		}
@@ -399,19 +399,19 @@  discard block
 block discarded – undo
399 399
 		}
400 400
 
401 401
 		$ret .= '<html><head>';
402
-		$ret .= '<meta http-equiv="Content-Type" content="' . $content_type . '; charset=utf-8" />';
403
-		$ret .= '</head><body>' . $html . '</body></html>';
402
+		$ret .= '<meta http-equiv="Content-Type" content="'.$content_type.'; charset=utf-8" />';
403
+		$ret .= '</head><body>'.$html.'</body></html>';
404 404
 		return $ret;
405 405
 	}
406 406
 
407 407
 	public function replace_urls($document, $tag, $attributes)
408 408
 	{
409
-		if (!is_array($attributes))
409
+		if ( ! is_array($attributes))
410 410
 		{
411 411
 			$attributes = array($attributes);
412 412
 		}
413 413
 
414
-		if (!is_array($this->strip_htmltags) || !in_array($tag, $this->strip_htmltags))
414
+		if ( ! is_array($this->strip_htmltags) || ! in_array($tag, $this->strip_htmltags))
415 415
 		{
416 416
 			$elements = $document->getElementsByTagName($tag);
417 417
 			foreach ($elements as $element)
@@ -435,7 +435,7 @@  discard block
 block discarded – undo
435 435
 	{
436 436
 		if ($this->encode_instead_of_strip)
437 437
 		{
438
-			if (isset($match[4]) && !in_array(strtolower($match[1]), array('script', 'style')))
438
+			if (isset($match[4]) && ! in_array(strtolower($match[1]), array('script', 'style')))
439 439
 			{
440 440
 				$match[1] = htmlspecialchars($match[1], ENT_COMPAT, 'UTF-8');
441 441
 				$match[2] = htmlspecialchars($match[2], ENT_COMPAT, 'UTF-8');
@@ -446,7 +446,7 @@  discard block
 block discarded – undo
446 446
 				return htmlspecialchars($match[0], ENT_COMPAT, 'UTF-8');
447 447
 			}
448 448
 		}
449
-		elseif (isset($match[4]) && !in_array(strtolower($match[1]), array('script', 'style')))
449
+		elseif (isset($match[4]) && ! in_array(strtolower($match[1]), array('script', 'style')))
450 450
 		{
451 451
 			return $match[4];
452 452
 		}
@@ -459,7 +459,7 @@  discard block
 block discarded – undo
459 459
 	protected function strip_tag($tag, $document, $type)
460 460
 	{
461 461
 		$xpath = new DOMXPath($document);
462
-		$elements = $xpath->query('body//' . $tag);
462
+		$elements = $xpath->query('body//'.$tag);
463 463
 		if ($this->encode_instead_of_strip)
464 464
 		{
465 465
 			foreach ($elements as $element)
@@ -467,9 +467,9 @@  discard block
 block discarded – undo
467 467
 				$fragment = $document->createDocumentFragment();
468 468
 
469 469
 				// For elements which aren't script or style, include the tag itself
470
-				if (!in_array($tag, array('script', 'style')))
470
+				if ( ! in_array($tag, array('script', 'style')))
471 471
 				{
472
-					$text = '<' . $tag;
472
+					$text = '<'.$tag;
473 473
 					if ($element->hasAttributes())
474 474
 					{
475 475
 						$attrs = array();
@@ -490,9 +490,9 @@  discard block
 block discarded – undo
490 490
 							}
491 491
 
492 492
 							// Standard attribute text
493
-							$attrs[] = $name . '="' . $attr->value . '"';
493
+							$attrs[] = $name.'="'.$attr->value.'"';
494 494
 						}
495
-						$text .= ' ' . implode(' ', $attrs);
495
+						$text .= ' '.implode(' ', $attrs);
496 496
 					}
497 497
 					$text .= '>';
498 498
 					$fragment->appendChild(new DOMText($text));
@@ -505,9 +505,9 @@  discard block
 block discarded – undo
505 505
 					$fragment->appendChild($child);
506 506
 				}
507 507
 
508
-				if (!in_array($tag, array('script', 'style')))
508
+				if ( ! in_array($tag, array('script', 'style')))
509 509
 				{
510
-					$fragment->appendChild(new DOMText('</' . $tag . '>'));
510
+					$fragment->appendChild(new DOMText('</'.$tag.'>'));
511 511
 				}
512 512
 
513 513
 				$element->parentNode->replaceChild($fragment, $element);
@@ -544,7 +544,7 @@  discard block
 block discarded – undo
544 544
 	protected function strip_attr($attrib, $document)
545 545
 	{
546 546
 		$xpath = new DOMXPath($document);
547
-		$elements = $xpath->query('//*[@' . $attrib . ']');
547
+		$elements = $xpath->query('//*[@'.$attrib.']');
548 548
 
549 549
 		foreach ($elements as $element)
550 550
 		{
Please login to merge, or discard this patch.
Braces   +15 added lines, -30 removed lines patch added patch discarded remove patch
@@ -88,8 +88,7 @@  discard block
 block discarded – undo
88 88
 		if ($page)
89 89
 		{
90 90
 			$this->image_handler = (string) $page;
91
-		}
92
-		else
91
+		} else
93 92
 		{
94 93
 			$this->image_handler = false;
95 94
 		}
@@ -143,13 +142,11 @@  discard block
 block discarded – undo
143 142
 			if (is_array($tags))
144 143
 			{
145 144
 				$this->strip_htmltags = $tags;
146
-			}
147
-			else
145
+			} else
148 146
 			{
149 147
 				$this->strip_htmltags = explode(',', $tags);
150 148
 			}
151
-		}
152
-		else
149
+		} else
153 150
 		{
154 151
 			$this->strip_htmltags = false;
155 152
 		}
@@ -167,13 +164,11 @@  discard block
 block discarded – undo
167 164
 			if (is_array($attribs))
168 165
 			{
169 166
 				$this->strip_attributes = $attribs;
170
-			}
171
-			else
167
+			} else
172 168
 			{
173 169
 				$this->strip_attributes = explode(',', $attribs);
174 170
 			}
175
-		}
176
-		else
171
+		} else
177 172
 		{
178 173
 			$this->strip_attributes = false;
179 174
 		}
@@ -232,8 +227,7 @@  discard block
 block discarded – undo
232 227
 				if (preg_match('/(&(#(x[0-9a-fA-F]+|[0-9]+)|[a-zA-Z0-9]+)|<\/[A-Za-z][^\x09\x0A\x0B\x0C\x0D\x20\x2F\x3E]*' . SIMPLEPIE_PCRE_HTML_ATTRIBUTE . '>)/', $data))
233 228
 				{
234 229
 					$type |= SIMPLEPIE_CONSTRUCT_HTML;
235
-				}
236
-				else
230
+				} else
237 231
 				{
238 232
 					$type |= SIMPLEPIE_CONSTRUCT_TEXT;
239 233
 				}
@@ -312,8 +306,7 @@  discard block
 block discarded – undo
312 306
 							if ($cache->load())
313 307
 							{
314 308
 								$img->setAttribute('src', $this->image_handler . $image_url);
315
-							}
316
-							else
309
+							} else
317 310
 							{
318 311
 								$file = $this->registry->create('File', array($img->getAttribute('src'), $this->timeout, 5, array('X-FORWARDED-FOR' => $_SERVER['REMOTE_ADDR']), $this->useragent, $this->force_fsockopen));
319 312
 								$headers = $file->headers;
@@ -323,8 +316,7 @@  discard block
 block discarded – undo
323 316
 									if ($cache->save(array('headers' => $file->headers, 'body' => $file->body)))
324 317
 									{
325 318
 										$img->setAttribute('src', $this->image_handler . $image_url);
326
-									}
327
-									else
319
+									} else
328 320
 									{
329 321
 										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);
330 322
 									}
@@ -352,8 +344,7 @@  discard block
 block discarded – undo
352 344
 				{
353 345
 					$data = preg_replace('/^<div' . SIMPLEPIE_PCRE_XML_ATTRIBUTE . '>/', '', $data);
354 346
 					$data = preg_replace('/<\/div>$/', '', $data);
355
-				}
356
-				else
347
+				} else
357 348
 				{
358 349
 					$data = preg_replace('/^<div' . SIMPLEPIE_PCRE_XML_ATTRIBUTE . '>/', '<div>', $data);
359 350
 				}
@@ -391,8 +382,7 @@  discard block
 block discarded – undo
391 382
 			$html = '<div>' . $html . '</div>';
392 383
 			$ret .= '<!DOCTYPE html>';
393 384
 			$content_type = 'text/html';
394
-		}
395
-		else
385
+		} else
396 386
 		{
397 387
 			$ret .= '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">';
398 388
 			$content_type = 'application/xhtml+xml';
@@ -440,17 +430,14 @@  discard block
 block discarded – undo
440 430
 				$match[1] = htmlspecialchars($match[1], ENT_COMPAT, 'UTF-8');
441 431
 				$match[2] = htmlspecialchars($match[2], ENT_COMPAT, 'UTF-8');
442 432
 				return "&lt;$match[1]$match[2]&gt;$match[3]&lt;/$match[1]&gt;";
443
-			}
444
-			else
433
+			} else
445 434
 			{
446 435
 				return htmlspecialchars($match[0], ENT_COMPAT, 'UTF-8');
447 436
 			}
448
-		}
449
-		elseif (isset($match[4]) && !in_array(strtolower($match[1]), array('script', 'style')))
437
+		} elseif (isset($match[4]) && !in_array(strtolower($match[1]), array('script', 'style')))
450 438
 		{
451 439
 			return $match[4];
452
-		}
453
-		else
440
+		} else
454 441
 		{
455 442
 			return '';
456 443
 		}
@@ -514,8 +501,7 @@  discard block
 block discarded – undo
514 501
 			}
515 502
 
516 503
 			return;
517
-		}
518
-		elseif (in_array($tag, array('script', 'style')))
504
+		} elseif (in_array($tag, array('script', 'style')))
519 505
 		{
520 506
 			foreach ($elements as $element)
521 507
 			{
@@ -523,8 +509,7 @@  discard block
 block discarded – undo
523 509
 			}
524 510
 
525 511
 			return;
526
-		}
527
-		else
512
+		} else
528 513
 		{
529 514
 			foreach ($elements as $element)
530 515
 			{
Please login to merge, or discard this patch.
Doc Comments   +16 added lines patch added patch discarded remove patch
@@ -222,6 +222,10 @@  discard block
 block discarded – undo
222 222
 		$this->replace_url_attributes = (array) $element_attribute;
223 223
 	}
224 224
 
225
+	/**
226
+	 * @param string $data
227
+	 * @param integer $type
228
+	 */
225 229
 	public function sanitize($data, $type, $base = '')
226 230
 	{
227 231
 		$data = trim($data);
@@ -381,6 +385,9 @@  discard block
 block discarded – undo
381 385
 		return $data;
382 386
 	}
383 387
 
388
+	/**
389
+	 * @param string $html
390
+	 */
384 391
 	protected function preprocess($html, $type)
385 392
 	{
386 393
 		$ret = '';
@@ -404,6 +411,9 @@  discard block
 block discarded – undo
404 411
 		return $ret;
405 412
 	}
406 413
 
414
+	/**
415
+	 * @param DOMDocument $document
416
+	 */
407 417
 	public function replace_urls($document, $tag, $attributes)
408 418
 	{
409 419
 		if (!is_array($attributes))
@@ -456,6 +466,9 @@  discard block
 block discarded – undo
456 466
 		}
457 467
 	}
458 468
 
469
+	/**
470
+	 * @param DOMDocument $document
471
+	 */
459 472
 	protected function strip_tag($tag, $document, $type)
460 473
 	{
461 474
 		$xpath = new DOMXPath($document);
@@ -541,6 +554,9 @@  discard block
 block discarded – undo
541 554
 		}
542 555
 	}
543 556
 
557
+	/**
558
+	 * @param DOMDocument $document
559
+	 */
544 560
 	protected function strip_attr($attrib, $document)
545 561
 	{
546 562
 		$xpath = new DOMXPath($document);
Please login to merge, or discard this patch.
src/wp-includes/SimplePie/File.php 2 patches
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -82,11 +82,11 @@  discard block
 block discarded – undo
82 82
 				$useragent = ini_get('user_agent');
83 83
 				$this->useragent = $useragent;
84 84
 			}
85
-			if (!is_array($headers))
85
+			if ( ! is_array($headers))
86 86
 			{
87 87
 				$headers = array();
88 88
 			}
89
-			if (!$force_fsockopen && function_exists('curl_exec'))
89
+			if ( ! $force_fsockopen && function_exists('curl_exec'))
90 90
 			{
91 91
 				$this->method = SIMPLEPIE_FILE_SOURCE_REMOTE | SIMPLEPIE_FILE_SOURCE_CURL;
92 92
 				$fp = curl_init();
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
 				curl_setopt($fp, CURLOPT_REFERER, $url);
108 108
 				curl_setopt($fp, CURLOPT_USERAGENT, $useragent);
109 109
 				curl_setopt($fp, CURLOPT_HTTPHEADER, $headers2);
110
-				if (!ini_get('open_basedir') && !ini_get('safe_mode') && version_compare(SimplePie_Misc::get_curl_version(), '7.15.2', '>='))
110
+				if ( ! ini_get('open_basedir') && ! ini_get('safe_mode') && version_compare(SimplePie_Misc::get_curl_version(), '7.15.2', '>='))
111 111
 				{
112 112
 					curl_setopt($fp, CURLOPT_FOLLOWLOCATION, 1);
113 113
 					curl_setopt($fp, CURLOPT_MAXREDIRS, $redirects);
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
 				}
122 122
 				if (curl_errno($fp))
123 123
 				{
124
-					$this->error = 'cURL error ' . curl_errno($fp) . ': ' . curl_error($fp);
124
+					$this->error = 'cURL error '.curl_errno($fp).': '.curl_error($fp);
125 125
 					$this->success = false;
126 126
 				}
127 127
 				else
@@ -155,14 +155,14 @@  discard block
 block discarded – undo
155 155
 					$socket_host = "ssl://$url_parts[host]";
156 156
 					$url_parts['port'] = 443;
157 157
 				}
158
-				if (!isset($url_parts['port']))
158
+				if ( ! isset($url_parts['port']))
159 159
 				{
160 160
 					$url_parts['port'] = 80;
161 161
 				}
162 162
 				$fp = @fsockopen($socket_host, $url_parts['port'], $errno, $errstr, $timeout);
163
-				if (!$fp)
163
+				if ( ! $fp)
164 164
 				{
165
-					$this->error = 'fsockopen error: ' . $errstr;
165
+					$this->error = 'fsockopen error: '.$errstr;
166 166
 					$this->success = false;
167 167
 				}
168 168
 				else
@@ -193,7 +193,7 @@  discard block
 block discarded – undo
193 193
 
194 194
 					if (isset($url_parts['user']) && isset($url_parts['pass']))
195 195
 					{
196
-						$out .= "Authorization: Basic " . base64_encode("$url_parts[user]:$url_parts[pass]") . "\r\n";
196
+						$out .= "Authorization: Basic ".base64_encode("$url_parts[user]:$url_parts[pass]")."\r\n";
197 197
 					}
198 198
 					foreach ($headers as $key => $value)
199 199
 					{
@@ -205,12 +205,12 @@  discard block
 block discarded – undo
205 205
 					$info = stream_get_meta_data($fp);
206 206
 
207 207
 					$this->headers = '';
208
-					while (!$info['eof'] && !$info['timed_out'])
208
+					while ( ! $info['eof'] && ! $info['timed_out'])
209 209
 					{
210 210
 						$this->headers .= fread($fp, 1160);
211 211
 						$info = stream_get_meta_data($fp);
212 212
 					}
213
-					if (!$info['timed_out'])
213
+					if ( ! $info['timed_out'])
214 214
 					{
215 215
 						$parser = new SimplePie_HTTP_Parser($this->headers);
216 216
 						if ($parser->parse())
@@ -232,7 +232,7 @@  discard block
 block discarded – undo
232 232
 									case 'gzip':
233 233
 									case 'x-gzip':
234 234
 										$decoder = new SimplePie_gzdecode($this->body);
235
-										if (!$decoder->parse())
235
+										if ( ! $decoder->parse())
236 236
 										{
237 237
 											$this->error = 'Unable to decode HTTP "gzip" stream';
238 238
 											$this->success = false;
@@ -282,7 +282,7 @@  discard block
 block discarded – undo
282 282
 		else
283 283
 		{
284 284
 			$this->method = SIMPLEPIE_FILE_SOURCE_LOCAL | SIMPLEPIE_FILE_SOURCE_FILE_GET_CONTENTS;
285
-			if (!$this->body = file_get_contents($url))
285
+			if ( ! $this->body = file_get_contents($url))
286 286
 			{
287 287
 				$this->error = 'file_get_contents could not read the file';
288 288
 				$this->success = false;
Please login to merge, or discard this patch.
Braces   +11 added lines, -22 removed lines patch added patch discarded remove patch
@@ -123,8 +123,7 @@  discard block
 block discarded – undo
123 123
 				{
124 124
 					$this->error = 'cURL error ' . curl_errno($fp) . ': ' . curl_error($fp);
125 125
 					$this->success = false;
126
-				}
127
-				else
126
+				} else
128 127
 				{
129 128
 					$info = curl_getinfo($fp);
130 129
 					curl_close($fp);
@@ -144,8 +143,7 @@  discard block
 block discarded – undo
144 143
 						}
145 144
 					}
146 145
 				}
147
-			}
148
-			else
146
+			} else
149 147
 			{
150 148
 				$this->method = SIMPLEPIE_FILE_SOURCE_REMOTE | SIMPLEPIE_FILE_SOURCE_FSOCKOPEN;
151 149
 				$url_parts = parse_url($url);
@@ -164,8 +162,7 @@  discard block
 block discarded – undo
164 162
 				{
165 163
 					$this->error = 'fsockopen error: ' . $errstr;
166 164
 					$this->success = false;
167
-				}
168
-				else
165
+				} else
169 166
 				{
170 167
 					stream_set_timeout($fp, $timeout);
171 168
 					if (isset($url_parts['path']))
@@ -173,13 +170,11 @@  discard block
 block discarded – undo
173 170
 						if (isset($url_parts['query']))
174 171
 						{
175 172
 							$get = "$url_parts[path]?$url_parts[query]";
176
-						}
177
-						else
173
+						} else
178 174
 						{
179 175
 							$get = $url_parts['path'];
180 176
 						}
181
-					}
182
-					else
177
+					} else
183 178
 					{
184 179
 						$get = '/';
185 180
 					}
@@ -236,8 +231,7 @@  discard block
 block discarded – undo
236 231
 										{
237 232
 											$this->error = 'Unable to decode HTTP "gzip" stream';
238 233
 											$this->success = false;
239
-										}
240
-										else
234
+										} else
241 235
 										{
242 236
 											$this->body = $decoder->data;
243 237
 										}
@@ -247,16 +241,13 @@  discard block
 block discarded – undo
247 241
 										if (($decompressed = gzinflate($this->body)) !== false)
248 242
 										{
249 243
 											$this->body = $decompressed;
250
-										}
251
-										else if (($decompressed = gzuncompress($this->body)) !== false)
244
+										} else if (($decompressed = gzuncompress($this->body)) !== false)
252 245
 										{
253 246
 											$this->body = $decompressed;
254
-										}
255
-										else if (function_exists('gzdecode') && ($decompressed = gzdecode($this->body)) !== false)
247
+										} else if (function_exists('gzdecode') && ($decompressed = gzdecode($this->body)) !== false)
256 248
 										{
257 249
 											$this->body = $decompressed;
258
-										}
259
-										else
250
+										} else
260 251
 										{
261 252
 											$this->error = 'Unable to decode HTTP "deflate" stream';
262 253
 											$this->success = false;
@@ -269,8 +260,7 @@  discard block
 block discarded – undo
269 260
 								}
270 261
 							}
271 262
 						}
272
-					}
273
-					else
263
+					} else
274 264
 					{
275 265
 						$this->error = 'fsocket timed out';
276 266
 						$this->success = false;
@@ -278,8 +268,7 @@  discard block
 block discarded – undo
278 268
 					fclose($fp);
279 269
 				}
280 270
 			}
281
-		}
282
-		else
271
+		} else
283 272
 		{
284 273
 			$this->method = SIMPLEPIE_FILE_SOURCE_LOCAL | SIMPLEPIE_FILE_SOURCE_FILE_GET_CONTENTS;
285 274
 			if (!$this->body = file_get_contents($url))
Please login to merge, or discard this patch.
src/wp-includes/SimplePie/Rating.php 1 patch
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -103,8 +103,7 @@  discard block
 block discarded – undo
103 103
 		if ($this->scheme !== null)
104 104
 		{
105 105
 			return $this->scheme;
106
-		}
107
-		else
106
+		} else
108 107
 		{
109 108
 			return null;
110 109
 		}
@@ -120,8 +119,7 @@  discard block
 block discarded – undo
120 119
 		if ($this->value !== null)
121 120
 		{
122 121
 			return $this->value;
123
-		}
124
-		else
122
+		} else
125 123
 		{
126 124
 			return null;
127 125
 		}
Please login to merge, or discard this patch.
src/wp-includes/SimplePie/Caption.php 1 patch
Braces   +5 added lines, -10 removed lines patch added patch discarded remove patch
@@ -131,8 +131,7 @@  discard block
 block discarded – undo
131 131
 		if ($this->endTime !== null)
132 132
 		{
133 133
 			return $this->endTime;
134
-		}
135
-		else
134
+		} else
136 135
 		{
137 136
 			return null;
138 137
 		}
@@ -149,8 +148,7 @@  discard block
 block discarded – undo
149 148
 		if ($this->lang !== null)
150 149
 		{
151 150
 			return $this->lang;
152
-		}
153
-		else
151
+		} else
154 152
 		{
155 153
 			return null;
156 154
 		}
@@ -166,8 +164,7 @@  discard block
 block discarded – undo
166 164
 		if ($this->startTime !== null)
167 165
 		{
168 166
 			return $this->startTime;
169
-		}
170
-		else
167
+		} else
171 168
 		{
172 169
 			return null;
173 170
 		}
@@ -183,8 +180,7 @@  discard block
 block discarded – undo
183 180
 		if ($this->text !== null)
184 181
 		{
185 182
 			return $this->text;
186
-		}
187
-		else
183
+		} else
188 184
 		{
189 185
 			return null;
190 186
 		}
@@ -200,8 +196,7 @@  discard block
 block discarded – undo
200 196
 		if ($this->type !== null)
201 197
 		{
202 198
 			return $this->type;
203
-		}
204
-		else
199
+		} else
205 200
 		{
206 201
 			return null;
207 202
 		}
Please login to merge, or discard this patch.
src/wp-includes/SimplePie/gzdecode.php 1 patch
Braces   +7 added lines, -14 removed lines patch added patch discarded remove patch
@@ -261,8 +261,7 @@  discard block
 block discarded – undo
261 261
 					// Set the extra field to the given data
262 262
 					$this->extra_field = substr($this->compressed_data, $this->position, $len);
263 263
 					$this->position += $len;
264
-				}
265
-				else
264
+				} else
266 265
 				{
267 266
 					return false;
268 267
 				}
@@ -281,8 +280,7 @@  discard block
 block discarded – undo
281 280
 					// Set the original filename to the given string
282 281
 					$this->filename = substr($this->compressed_data, $this->position, $len);
283 282
 					$this->position += $len + 1;
284
-				}
285
-				else
283
+				} else
286 284
 				{
287 285
 					return false;
288 286
 				}
@@ -301,8 +299,7 @@  discard block
 block discarded – undo
301 299
 					// Set the original comment to the given string
302 300
 					$this->comment = substr($this->compressed_data, $this->position, $len);
303 301
 					$this->position += $len + 1;
304
-				}
305
-				else
302
+				} else
306 303
 				{
307 304
 					return false;
308 305
 				}
@@ -322,13 +319,11 @@  discard block
 block discarded – undo
322 319
 					if ((crc32(substr($this->compressed_data, 0, $this->position)) & 0xFFFF) === $crc)
323 320
 					{
324 321
 						$this->position += 2;
325
-					}
326
-					else
322
+					} else
327 323
 					{
328 324
 						return false;
329 325
 					}
330
-				}
331
-				else
326
+				} else
332 327
 				{
333 328
 					return false;
334 329
 				}
@@ -338,8 +333,7 @@  discard block
 block discarded – undo
338 333
 			if (($this->data = gzinflate(substr($this->compressed_data, $this->position, -8))) === false)
339 334
 			{
340 335
 				return false;
341
-			}
342
-			else
336
+			} else
343 337
 			{
344 338
 				$this->position = $this->compressed_size - 8;
345 339
 			}
@@ -362,8 +356,7 @@  discard block
 block discarded – undo
362 356
 
363 357
 			// Wow, against all odds, we've actually got a valid gzip string
364 358
 			return true;
365
-		}
366
-		else
359
+		} else
367 360
 		{
368 361
 			return false;
369 362
 		}
Please login to merge, or discard this patch.
src/wp-includes/SimplePie/Content/Type/Sniffer.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -85,7 +85,7 @@
 block discarded – undo
85 85
 	{
86 86
 		if (isset($this->file->headers['content-type']))
87 87
 		{
88
-			if (!isset($this->file->headers['content-encoding'])
88
+			if ( ! isset($this->file->headers['content-encoding'])
89 89
 				&& ($this->file->headers['content-type'] === 'text/plain'
90 90
 					|| $this->file->headers['content-type'] === 'text/plain; charset=ISO-8859-1'
91 91
 					|| $this->file->headers['content-type'] === 'text/plain; charset=iso-8859-1'
Please login to merge, or discard this patch.
Braces   +30 added lines, -60 removed lines patch added patch discarded remove patch
@@ -97,8 +97,7 @@  discard block
 block discarded – undo
97 97
 			if (($pos = strpos($this->file->headers['content-type'], ';')) !== false)
98 98
 			{
99 99
 				$official = substr($this->file->headers['content-type'], 0, $pos);
100
-			}
101
-			else
100
+			} else
102 101
 			{
103 102
 				$official = $this->file->headers['content-type'];
104 103
 			}
@@ -108,34 +107,28 @@  discard block
 block discarded – undo
108 107
 				|| $official === 'application/unknown')
109 108
 			{
110 109
 				return $this->unknown();
111
-			}
112
-			elseif (substr($official, -4) === '+xml'
110
+			} elseif (substr($official, -4) === '+xml'
113 111
 				|| $official === 'text/xml'
114 112
 				|| $official === 'application/xml')
115 113
 			{
116 114
 				return $official;
117
-			}
118
-			elseif (substr($official, 0, 6) === 'image/')
115
+			} elseif (substr($official, 0, 6) === 'image/')
119 116
 			{
120 117
 				if ($return = $this->image())
121 118
 				{
122 119
 					return $return;
123
-				}
124
-				else
120
+				} else
125 121
 				{
126 122
 					return $official;
127 123
 				}
128
-			}
129
-			elseif ($official === 'text/html')
124
+			} elseif ($official === 'text/html')
130 125
 			{
131 126
 				return $this->feed_or_html();
132
-			}
133
-			else
127
+			} else
134 128
 			{
135 129
 				return $official;
136 130
 			}
137
-		}
138
-		else
131
+		} else
139 132
 		{
140 133
 			return $this->unknown();
141 134
 		}
@@ -154,12 +147,10 @@  discard block
 block discarded – undo
154 147
 			|| substr($this->file->body, 0, 3) === "\xEF\xBB\xBF")
155 148
 		{
156 149
 			return 'text/plain';
157
-		}
158
-		elseif (preg_match('/[\x00-\x08\x0E-\x1A\x1C-\x1F]/', $this->file->body))
150
+		} elseif (preg_match('/[\x00-\x08\x0E-\x1A\x1C-\x1F]/', $this->file->body))
159 151
 		{
160 152
 			return 'application/octect-stream';
161
-		}
162
-		else
153
+		} else
163 154
 		{
164 155
 			return 'text/plain';
165 156
 		}
@@ -178,37 +169,29 @@  discard block
 block discarded – undo
178 169
 			|| strtolower(substr($this->file->body, $ws, 7)) === '<script')
179 170
 		{
180 171
 			return 'text/html';
181
-		}
182
-		elseif (substr($this->file->body, 0, 5) === '%PDF-')
172
+		} elseif (substr($this->file->body, 0, 5) === '%PDF-')
183 173
 		{
184 174
 			return 'application/pdf';
185
-		}
186
-		elseif (substr($this->file->body, 0, 11) === '%!PS-Adobe-')
175
+		} elseif (substr($this->file->body, 0, 11) === '%!PS-Adobe-')
187 176
 		{
188 177
 			return 'application/postscript';
189
-		}
190
-		elseif (substr($this->file->body, 0, 6) === 'GIF87a'
178
+		} elseif (substr($this->file->body, 0, 6) === 'GIF87a'
191 179
 			|| substr($this->file->body, 0, 6) === 'GIF89a')
192 180
 		{
193 181
 			return 'image/gif';
194
-		}
195
-		elseif (substr($this->file->body, 0, 8) === "\x89\x50\x4E\x47\x0D\x0A\x1A\x0A")
182
+		} elseif (substr($this->file->body, 0, 8) === "\x89\x50\x4E\x47\x0D\x0A\x1A\x0A")
196 183
 		{
197 184
 			return 'image/png';
198
-		}
199
-		elseif (substr($this->file->body, 0, 3) === "\xFF\xD8\xFF")
185
+		} elseif (substr($this->file->body, 0, 3) === "\xFF\xD8\xFF")
200 186
 		{
201 187
 			return 'image/jpeg';
202
-		}
203
-		elseif (substr($this->file->body, 0, 2) === "\x42\x4D")
188
+		} elseif (substr($this->file->body, 0, 2) === "\x42\x4D")
204 189
 		{
205 190
 			return 'image/bmp';
206
-		}
207
-		elseif (substr($this->file->body, 0, 4) === "\x00\x00\x01\x00")
191
+		} elseif (substr($this->file->body, 0, 4) === "\x00\x00\x01\x00")
208 192
 		{
209 193
 			return 'image/vnd.microsoft.icon';
210
-		}
211
-		else
194
+		} else
212 195
 		{
213 196
 			return $this->text_or_binary();
214 197
 		}
@@ -225,24 +208,19 @@  discard block
 block discarded – undo
225 208
 			|| substr($this->file->body, 0, 6) === 'GIF89a')
226 209
 		{
227 210
 			return 'image/gif';
228
-		}
229
-		elseif (substr($this->file->body, 0, 8) === "\x89\x50\x4E\x47\x0D\x0A\x1A\x0A")
211
+		} elseif (substr($this->file->body, 0, 8) === "\x89\x50\x4E\x47\x0D\x0A\x1A\x0A")
230 212
 		{
231 213
 			return 'image/png';
232
-		}
233
-		elseif (substr($this->file->body, 0, 3) === "\xFF\xD8\xFF")
214
+		} elseif (substr($this->file->body, 0, 3) === "\xFF\xD8\xFF")
234 215
 		{
235 216
 			return 'image/jpeg';
236
-		}
237
-		elseif (substr($this->file->body, 0, 2) === "\x42\x4D")
217
+		} elseif (substr($this->file->body, 0, 2) === "\x42\x4D")
238 218
 		{
239 219
 			return 'image/bmp';
240
-		}
241
-		elseif (substr($this->file->body, 0, 4) === "\x00\x00\x01\x00")
220
+		} elseif (substr($this->file->body, 0, 4) === "\x00\x00\x01\x00")
242 221
 		{
243 222
 			return 'image/vnd.microsoft.icon';
244
-		}
245
-		else
223
+		} else
246 224
 		{
247 225
 			return false;
248 226
 		}
@@ -283,44 +261,36 @@  discard block
 block discarded – undo
283 261
 				if ($pos < $len && ($pos = strpos($this->file->body, '-->', $pos)) !== false)
284 262
 				{
285 263
 					$pos += 3;
286
-				}
287
-				else
264
+				} else
288 265
 				{
289 266
 					return 'text/html';
290 267
 				}
291
-			}
292
-			elseif (substr($this->file->body, $pos, 1) === '!')
268
+			} elseif (substr($this->file->body, $pos, 1) === '!')
293 269
 			{
294 270
 				if ($pos < $len && ($pos = strpos($this->file->body, '>', $pos)) !== false)
295 271
 				{
296 272
 					$pos++;
297
-				}
298
-				else
273
+				} else
299 274
 				{
300 275
 					return 'text/html';
301 276
 				}
302
-			}
303
-			elseif (substr($this->file->body, $pos, 1) === '?')
277
+			} elseif (substr($this->file->body, $pos, 1) === '?')
304 278
 			{
305 279
 				if ($pos < $len && ($pos = strpos($this->file->body, '?>', $pos)) !== false)
306 280
 				{
307 281
 					$pos += 2;
308
-				}
309
-				else
282
+				} else
310 283
 				{
311 284
 					return 'text/html';
312 285
 				}
313
-			}
314
-			elseif (substr($this->file->body, $pos, 3) === 'rss'
286
+			} elseif (substr($this->file->body, $pos, 3) === 'rss'
315 287
 				|| substr($this->file->body, $pos, 7) === 'rdf:RDF')
316 288
 			{
317 289
 				return 'application/rss+xml';
318
-			}
319
-			elseif (substr($this->file->body, $pos, 4) === 'feed')
290
+			} elseif (substr($this->file->body, $pos, 4) === 'feed')
320 291
 			{
321 292
 				return 'application/atom+xml';
322
-			}
323
-			else
293
+			} else
324 294
 			{
325 295
 				return 'text/html';
326 296
 			}
Please login to merge, or discard this patch.
src/wp-includes/SimplePie/XML/Declaration/Parser.php 1 patch
Braces   +14 added lines, -28 removed lines patch added patch discarded remove patch
@@ -136,8 +136,7 @@  discard block
 block discarded – undo
136 136
 		if ($this->state === 'emit')
137 137
 		{
138 138
 			return true;
139
-		}
140
-		else
139
+		} else
141 140
 		{
142 141
 			$this->version = '';
143 142
 			$this->encoding = '';
@@ -194,8 +193,7 @@  discard block
 block discarded – undo
194 193
 		if ($this->skip_whitespace())
195 194
 		{
196 195
 			$this->state = 'version_name';
197
-		}
198
-		else
196
+		} else
199 197
 		{
200 198
 			$this->state = false;
201 199
 		}
@@ -208,8 +206,7 @@  discard block
 block discarded – undo
208 206
 			$this->position += 7;
209 207
 			$this->skip_whitespace();
210 208
 			$this->state = 'version_equals';
211
-		}
212
-		else
209
+		} else
213 210
 		{
214 211
 			$this->state = false;
215 212
 		}
@@ -222,8 +219,7 @@  discard block
 block discarded – undo
222 219
 			$this->position++;
223 220
 			$this->skip_whitespace();
224 221
 			$this->state = 'version_value';
225
-		}
226
-		else
222
+		} else
227 223
 		{
228 224
 			$this->state = false;
229 225
 		}
@@ -237,13 +233,11 @@  discard block
 block discarded – undo
237 233
 			if ($this->has_data())
238 234
 			{
239 235
 				$this->state = 'encoding_name';
240
-			}
241
-			else
236
+			} else
242 237
 			{
243 238
 				$this->state = 'emit';
244 239
 			}
245
-		}
246
-		else
240
+		} else
247 241
 		{
248 242
 			$this->state = false;
249 243
 		}
@@ -256,8 +250,7 @@  discard block
 block discarded – undo
256 250
 			$this->position += 8;
257 251
 			$this->skip_whitespace();
258 252
 			$this->state = 'encoding_equals';
259
-		}
260
-		else
253
+		} else
261 254
 		{
262 255
 			$this->state = 'standalone_name';
263 256
 		}
@@ -270,8 +263,7 @@  discard block
 block discarded – undo
270 263
 			$this->position++;
271 264
 			$this->skip_whitespace();
272 265
 			$this->state = 'encoding_value';
273
-		}
274
-		else
266
+		} else
275 267
 		{
276 268
 			$this->state = false;
277 269
 		}
@@ -285,13 +277,11 @@  discard block
 block discarded – undo
285 277
 			if ($this->has_data())
286 278
 			{
287 279
 				$this->state = 'standalone_name';
288
-			}
289
-			else
280
+			} else
290 281
 			{
291 282
 				$this->state = 'emit';
292 283
 			}
293
-		}
294
-		else
284
+		} else
295 285
 		{
296 286
 			$this->state = false;
297 287
 		}
@@ -304,8 +294,7 @@  discard block
 block discarded – undo
304 294
 			$this->position += 10;
305 295
 			$this->skip_whitespace();
306 296
 			$this->state = 'standalone_equals';
307
-		}
308
-		else
297
+		} else
309 298
 		{
310 299
 			$this->state = false;
311 300
 		}
@@ -318,8 +307,7 @@  discard block
 block discarded – undo
318 307
 			$this->position++;
319 308
 			$this->skip_whitespace();
320 309
 			$this->state = 'standalone_value';
321
-		}
322
-		else
310
+		} else
323 311
 		{
324 312
 			$this->state = false;
325 313
 		}
@@ -348,13 +336,11 @@  discard block
 block discarded – undo
348 336
 			if ($this->has_data())
349 337
 			{
350 338
 				$this->state = false;
351
-			}
352
-			else
339
+			} else
353 340
 			{
354 341
 				$this->state = 'emit';
355 342
 			}
356
-		}
357
-		else
343
+		} else
358 344
 		{
359 345
 			$this->state = false;
360 346
 		}
Please login to merge, or discard this patch.
src/wp-includes/SimplePie/Cache/DB.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
 		$items = $data->get_items();
64 64
 		$items_by_id = array();
65 65
 
66
-		if (!empty($items))
66
+		if ( ! empty($items))
67 67
 		{
68 68
 			foreach ($items as $item)
69 69
 			{
@@ -81,19 +81,19 @@  discard block
 block discarded – undo
81 81
 
82 82
 			if (isset($data->data['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['feed'][0]))
83 83
 			{
84
-				$channel =& $data->data['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['feed'][0];
84
+				$channel = & $data->data['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['feed'][0];
85 85
 			}
86 86
 			elseif (isset($data->data['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['feed'][0]))
87 87
 			{
88
-				$channel =& $data->data['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['feed'][0];
88
+				$channel = & $data->data['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['feed'][0];
89 89
 			}
90 90
 			elseif (isset($data->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0]))
91 91
 			{
92
-				$channel =& $data->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0];
92
+				$channel = & $data->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0];
93 93
 			}
94 94
 			elseif (isset($data->data['child'][SIMPLEPIE_NAMESPACE_RSS_20]['rss'][0]['child'][SIMPLEPIE_NAMESPACE_RSS_20]['channel'][0]))
95 95
 			{
96
-				$channel =& $data->data['child'][SIMPLEPIE_NAMESPACE_RSS_20]['rss'][0]['child'][SIMPLEPIE_NAMESPACE_RSS_20]['channel'][0];
96
+				$channel = & $data->data['child'][SIMPLEPIE_NAMESPACE_RSS_20]['rss'][0]['child'][SIMPLEPIE_NAMESPACE_RSS_20]['channel'][0];
97 97
 			}
98 98
 			else
99 99
 			{
Please login to merge, or discard this patch.
Braces   +4 added lines, -8 removed lines patch added patch discarded remove patch
@@ -82,20 +82,16 @@
 block discarded – undo
82 82
 			if (isset($data->data['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['feed'][0]))
83 83
 			{
84 84
 				$channel =& $data->data['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['feed'][0];
85
-			}
86
-			elseif (isset($data->data['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['feed'][0]))
85
+			} elseif (isset($data->data['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['feed'][0]))
87 86
 			{
88 87
 				$channel =& $data->data['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['feed'][0];
89
-			}
90
-			elseif (isset($data->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0]))
88
+			} elseif (isset($data->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0]))
91 89
 			{
92 90
 				$channel =& $data->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0];
93
-			}
94
-			elseif (isset($data->data['child'][SIMPLEPIE_NAMESPACE_RSS_20]['rss'][0]['child'][SIMPLEPIE_NAMESPACE_RSS_20]['channel'][0]))
91
+			} elseif (isset($data->data['child'][SIMPLEPIE_NAMESPACE_RSS_20]['rss'][0]['child'][SIMPLEPIE_NAMESPACE_RSS_20]['channel'][0]))
95 92
 			{
96 93
 				$channel =& $data->data['child'][SIMPLEPIE_NAMESPACE_RSS_20]['rss'][0]['child'][SIMPLEPIE_NAMESPACE_RSS_20]['channel'][0];
97
-			}
98
-			else
94
+			} else
99 95
 			{
100 96
 				$channel = null;
101 97
 			}
Please login to merge, or discard this patch.
src/wp-includes/SimplePie/Cache/Memcache.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -99,7 +99,7 @@
 block discarded – undo
99 99
 		$this->options['host'] = empty($parsed['host']) ? $this->options['host'] : $parsed['host'];
100 100
 		$this->options['port'] = empty($parsed['port']) ? $this->options['port'] : $parsed['port'];
101 101
 		$this->options['extras'] = array_merge($this->options['extras'], $parsed['extras']);
102
-		$this->name = $this->options['extras']['prefix'] . md5("$name:$type");
102
+		$this->name = $this->options['extras']['prefix'].md5("$name:$type");
103 103
 
104 104
 		$this->cache = new Memcache();
105 105
 		$this->cache->addServer($this->options['host'], (int) $this->options['port']);
Please login to merge, or discard this patch.