GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Pull Request — develop (#2228)
by
unknown
13:09
created
classes/file/FileHandler.class.php 2 patches
Braces   +32 added lines, -49 removed lines patch added patch discarded remove patch
@@ -74,14 +74,12 @@  discard block
 block discarded – undo
74 74
 			if(is_dir($source_dir . $file))
75 75
 			{
76 76
 				self::copyDir($source_dir . $file, $target_dir . $file, $type);
77
-			}
78
-			else
77
+			} else
79 78
 			{
80 79
 				if($type == 'force')
81 80
 				{
82 81
 					@unlink($target_dir . $file);
83
-				}
84
-				else
82
+				} else
85 83
 				{
86 84
 					if(!file_exists($target_dir . $file))
87 85
 					{
@@ -381,15 +379,13 @@  discard block
 block discarded – undo
381 379
 				if(is_dir($target))
382 380
 				{
383 381
 					self::removeDir($target);
384
-				}
385
-				else
382
+				} else
386 383
 				{
387 384
 					unlink($target);
388 385
 				}
389 386
 			}
390 387
 			rmdir($path);
391
-		}
392
-		else
388
+		} else
393 389
 		{
394 390
 			unlink($path);
395 391
 		}
@@ -456,16 +452,16 @@  discard block
 block discarded – undo
456 452
 				if(is_dir($target))
457 453
 				{
458 454
 					self::removeFilesInDir($target);
459
-				}
460
-				else
455
+				} else
461 456
 				{
462 457
 					unlink($target);
463 458
 				}
464 459
 			}
465
-		}
466
-		else
460
+		} else
467 461
 		{
468
-			if(self::exists($path)) unlink($path);
462
+			if(self::exists($path)) {
463
+				unlink($path);
464
+			}
469 465
 		}
470 466
 
471 467
 	}
@@ -535,8 +531,7 @@  discard block
 block discarded – undo
535 531
 				$oRequest = new HTTP_Request(__PROXY_SERVER__);
536 532
 				$oRequest->setMethod('POST');
537 533
 				$oRequest->addPostData('arg', serialize(array('Destination' => $url, 'method' => $method, 'body' => $body, 'content_type' => $content_type, "headers" => $headers, "post_data" => $post_data)));
538
-			}
539
-			else
534
+			} else
540 535
 			{
541 536
 				$oRequest = new HTTP_Request($url);
542 537
 
@@ -560,8 +555,7 @@  discard block
 block discarded – undo
560 555
 							{
561 556
 								$oRequest->attach($observer);
562 557
 							}
563
-						}
564
-						else
558
+						} else
565 559
 						{
566 560
 							$oRequest->setConfig($key, $val);
567 561
 						}
@@ -572,8 +566,7 @@  discard block
 block discarded – undo
572 566
 					if(extension_loaded('curl'))
573 567
 					{
574 568
 						$oRequest->setConfig('adapter', 'curl');
575
-					}
576
-					elseif(version_compare(PHP_VERSION, '5.6', '<'))
569
+					} elseif(version_compare(PHP_VERSION, '5.6', '<'))
577 570
 					{
578 571
 						$oRequest->setConfig('ssl_verify_host', false);
579 572
 					}
@@ -605,20 +598,21 @@  discard block
 block discarded – undo
605 598
 						$oRequest->addPostData($key, $val);
606 599
 					}
607 600
 				}
608
-				if(!$content_type)
609
-					$oRequest->addHeader('Content-Type', 'text/html');
610
-				else
611
-					$oRequest->addHeader('Content-Type', $content_type);
601
+				if(!$content_type) {
602
+									$oRequest->addHeader('Content-Type', 'text/html');
603
+				} else {
604
+									$oRequest->addHeader('Content-Type', $content_type);
605
+				}
612 606
 				$oRequest->setMethod($method);
613
-				if($body)
614
-					$oRequest->setBody($body);
607
+				if($body) {
608
+									$oRequest->setBody($body);
609
+				}
615 610
 			}
616 611
 			
617 612
 			if(method_exists($oRequest, 'setConfig'))
618 613
 			{
619 614
 				$oRequest->setConfig('timeout', $timeout);
620
-			}
621
-			elseif(property_exists($oRequest, '_timeout'))
615
+			} elseif(property_exists($oRequest, '_timeout'))
622 616
 			{
623 617
 				$oRequest->_timeout = $timeout;
624 618
 			}
@@ -649,13 +643,11 @@  discard block
 block discarded – undo
649 643
 			if(isset($request_config['store_body']) && !$request_config['store_body'])
650 644
 			{
651 645
 				return TRUE;
652
-			}
653
-			else
646
+			} else
654 647
 			{
655 648
 				return $response;
656 649
 			}
657
-		}
658
-		catch(Exception $e)
650
+		} catch(Exception $e)
659 651
 		{
660 652
 			return NULL;
661 653
 		}
@@ -688,8 +680,7 @@  discard block
 block discarded – undo
688 680
 			$result = self::getRemoteResource($url, $body, $timeout, $method, $content_type, $headers, $cookies, $post_data, $request_config);
689 681
 			self::clearStatCache($target_filename);
690 682
 			self::invalidateOpcache($target_filename);
691
-		}
692
-		catch(Exception $e)
683
+		} catch(Exception $e)
693 684
 		{
694 685
 			return FALSE;
695 686
 		}
@@ -820,8 +811,7 @@  discard block
 block discarded – undo
820 811
 			$per = ($width_per > $height_per) ? $height_per : $width_per;
821 812
 			$resize_width = $width * $per;
822 813
 			$resize_height = $height * $per;
823
-		}
824
-		else
814
+		} else
825 815
 		{
826 816
 			$per = ($width_per < $height_per) ? $height_per : $width_per;
827 817
 		}
@@ -831,8 +821,7 @@  discard block
 block discarded – undo
831 821
 		if(function_exists('imagecreateTRUEcolor'))
832 822
 		{
833 823
 			$thumb = imagecreateTRUEcolor($resize_width, $resize_height);
834
-		}
835
-		else if(function_exists('imagecreate'))
824
+		} else if(function_exists('imagecreate'))
836 825
 		{
837 826
 			$thumb = imagecreate($resize_width, $resize_height);
838 827
 		}
@@ -855,8 +844,7 @@  discard block
 block discarded – undo
855 844
 			{
856 845
 				imagealphablending($thumb, true);
857 846
 			}
858
-		}
859
-		else
847
+		} else
860 848
 		{
861 849
 			imagefilledrectangle($thumb, 0, 0, $resize_width - 1, $resize_height - 1, imagecolorallocate($thumb, 255, 255, 255));
862 850
 		}
@@ -914,8 +902,7 @@  discard block
 block discarded – undo
914 902
 		if(function_exists('imagecopyresampled'))
915 903
 		{
916 904
 			imagecopyresampled($thumb, $source, $x, $y, 0, 0, $new_width, $new_height, $width, $height);
917
-		}
918
-		else
905
+		} else
919 906
 		{
920 907
 			imagecopyresized($thumb, $source, $x, $y, 0, 0, $new_width, $new_height, $width, $height);
921 908
 		}
@@ -984,8 +971,7 @@  discard block
 block discarded – undo
984 971
 		if(is_array($arr) && count($arr) > 0)
985 972
 		{
986 973
 			return $arr;
987
-		}
988
-		else
974
+		} else
989 975
 		{
990 976
 			return array();
991 977
 		}
@@ -1035,12 +1021,10 @@  discard block
 block discarded – undo
1035 1021
 					$return[] = sprintf("%s=\"%s\"", $k, $v);
1036 1022
 				}
1037 1023
 				// value
1038
-			}
1039
-			else if(is_object($val))
1024
+			} else if(is_object($val))
1040 1025
 			{
1041 1026
 				continue;
1042
-			}
1043
-			else
1027
+			} else
1044 1028
 			{
1045 1029
 				$return[] = sprintf("%s=\"%s\"", $key, $val);
1046 1030
 			}
@@ -1182,8 +1166,7 @@  discard block
 block discarded – undo
1182 1166
 		if(substr($target, -4) === '.php')
1183 1167
 		{
1184 1168
 			opcache_invalidate(self::getRealPath($target), $force);
1185
-		}
1186
-		else if($path = self::isDir($target))
1169
+		} else if($path = self::isDir($target))
1187 1170
 		{
1188 1171
 			self::invalidateOpcache(self::readDir($path, '', false, true));
1189 1172
 		}
Please login to merge, or discard this patch.
Spacing   +141 added lines, -141 removed lines patch added patch discarded remove patch
@@ -17,9 +17,9 @@  discard block
 block discarded – undo
17 17
 	 */
18 18
 	function getRealPath($source)
19 19
 	{
20
-		if(strlen($source) >= 2 && substr_compare($source, './', 0, 2) === 0)
20
+		if (strlen($source) >= 2 && substr_compare($source, './', 0, 2) === 0)
21 21
 		{
22
-			return _XE_PATH_ . substr($source, 2);
22
+			return _XE_PATH_.substr($source, 2);
23 23
 		}
24 24
 
25 25
 		return $source;
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
 	{
41 41
 		$source_dir = self::getRealPath($source_dir);
42 42
 		$target_dir = self::getRealPath($target_dir);
43
-		if(!is_dir($source_dir))
43
+		if (!is_dir($source_dir))
44 44
 		{
45 45
 			return FALSE;
46 46
 		}
@@ -48,44 +48,44 @@  discard block
 block discarded – undo
48 48
 		// generate when no target exists
49 49
 		self::makeDir($target_dir);
50 50
 
51
-		if(substr($source_dir, -1) != DIRECTORY_SEPARATOR)
51
+		if (substr($source_dir, -1) != DIRECTORY_SEPARATOR)
52 52
 		{
53 53
 			$source_dir .= DIRECTORY_SEPARATOR;
54 54
 		}
55 55
 
56
-		if(substr($target_dir, -1) != DIRECTORY_SEPARATOR)
56
+		if (substr($target_dir, -1) != DIRECTORY_SEPARATOR)
57 57
 		{
58 58
 			$target_dir .= DIRECTORY_SEPARATOR;
59 59
 		}
60 60
 
61 61
 		$oDir = dir($source_dir);
62
-		while($file = $oDir->read())
62
+		while ($file = $oDir->read())
63 63
 		{
64
-			if($file{0} == '.')
64
+			if ($file{0} == '.')
65 65
 			{
66 66
 				continue;
67 67
 			}
68 68
 
69
-			if($filter && preg_match($filter, $file))
69
+			if ($filter && preg_match($filter, $file))
70 70
 			{
71 71
 				continue;
72 72
 			}
73 73
 
74
-			if(is_dir($source_dir . $file))
74
+			if (is_dir($source_dir.$file))
75 75
 			{
76
-				self::copyDir($source_dir . $file, $target_dir . $file, $type);
76
+				self::copyDir($source_dir.$file, $target_dir.$file, $type);
77 77
 			}
78 78
 			else
79 79
 			{
80
-				if($type == 'force')
80
+				if ($type == 'force')
81 81
 				{
82
-					@unlink($target_dir . $file);
82
+					@unlink($target_dir.$file);
83 83
 				}
84 84
 				else
85 85
 				{
86
-					if(!file_exists($target_dir . $file))
86
+					if (!file_exists($target_dir.$file))
87 87
 					{
88
-						@copy($source_dir . $file, $target_dir . $file);
88
+						@copy($source_dir.$file, $target_dir.$file);
89 89
 					}
90 90
 				}
91 91
 			}
@@ -110,12 +110,12 @@  discard block
 block discarded – undo
110 110
 
111 111
 		self::makeDir($target_dir);
112 112
 
113
-		if($force == 'Y')
113
+		if ($force == 'Y')
114 114
 		{
115
-			@unlink($target_dir . DIRECTORY_SEPARATOR . $target);
115
+			@unlink($target_dir.DIRECTORY_SEPARATOR.$target);
116 116
 		}
117 117
 
118
-		@copy($source, $target_dir . DIRECTORY_SEPARATOR . $target);
118
+		@copy($source, $target_dir.DIRECTORY_SEPARATOR.$target);
119 119
 	}
120 120
 
121 121
 	/**
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
 	 */
127 127
 	function readFile($filename)
128 128
 	{
129
-		if(($filename = self::exists($filename)) === FALSE || filesize($filename) < 1)
129
+		if (($filename = self::exists($filename)) === FALSE || filesize($filename) < 1)
130 130
 		{
131 131
 			return;
132 132
 		}
@@ -149,12 +149,12 @@  discard block
 block discarded – undo
149 149
 		self::makeDir($pathinfo['dirname']);
150 150
 
151 151
 		$flags = 0;
152
-		if(strtolower($mode) == 'a')
152
+		if (strtolower($mode) == 'a')
153 153
 		{
154 154
 			$flags = FILE_APPEND;
155 155
 		}
156 156
 
157
-		@file_put_contents($filename, $buff, $flags|LOCK_EX);
157
+		@file_put_contents($filename, $buff, $flags | LOCK_EX);
158 158
 		@chmod($filename, 0644);
159 159
 		self::clearStatCache($filename);
160 160
 		self::invalidateOpcache($filename);
@@ -194,7 +194,7 @@  discard block
 block discarded – undo
194 194
 	 */
195 195
 	function moveFile($source, $target)
196 196
 	{
197
-		if(($source = self::exists($source)) !== FALSE)
197
+		if (($source = self::exists($source)) !== FALSE)
198 198
 		{
199 199
 			self::removeFile($target);
200 200
 			return self::rename($source, $target);
@@ -232,35 +232,35 @@  discard block
 block discarded – undo
232 232
 		$path = self::getRealPath($path);
233 233
 		$output = array();
234 234
 
235
-		if(substr($path, -1) != '/')
235
+		if (substr($path, -1) != '/')
236 236
 		{
237 237
 			$path .= '/';
238 238
 		}
239 239
 
240
-		if(!is_dir($path))
240
+		if (!is_dir($path))
241 241
 		{
242 242
 			return $output;
243 243
 		}
244 244
 
245 245
 		$files = scandir($path);
246
-		foreach($files as $file)
246
+		foreach ($files as $file)
247 247
 		{
248
-			if($file{0} == '.' || ($filter && !preg_match($filter, $file)))
248
+			if ($file{0} == '.' || ($filter && !preg_match($filter, $file)))
249 249
 			{
250 250
 				continue;
251 251
 			}
252 252
 
253
-			if($to_lower)
253
+			if ($to_lower)
254 254
 			{
255 255
 				$file = strtolower($file);
256 256
 			}
257 257
 
258
-			if($filter)
258
+			if ($filter)
259 259
 			{
260 260
 				$file = preg_replace($filter, '$1', $file);
261 261
 			}
262 262
 
263
-			if($concat_prefix)
263
+			if ($concat_prefix)
264 264
 			{
265 265
 				$file = sprintf('%s%s', str_replace(_XE_PATH_, '', $path), $file);
266 266
 			}
@@ -281,12 +281,12 @@  discard block
 block discarded – undo
281 281
 	 */
282 282
 	function makeDir($path_string)
283 283
 	{
284
-		if(self::exists($path_string) !== FALSE)
284
+		if (self::exists($path_string) !== FALSE)
285 285
 		{
286 286
 			return TRUE;
287 287
 		}
288 288
 
289
-		if(!ini_get('safe_mode'))
289
+		if (!ini_get('safe_mode'))
290 290
 		{
291 291
 			@mkdir($path_string, 0755, TRUE);
292 292
 			@chmod($path_string, 0755);
@@ -297,35 +297,35 @@  discard block
 block discarded – undo
297 297
 			static $oFtp = NULL;
298 298
 
299 299
 			$ftp_info = Context::getFTPInfo();
300
-			if($oFtp == NULL)
300
+			if ($oFtp == NULL)
301 301
 			{
302
-				if(!Context::isFTPRegisted())
302
+				if (!Context::isFTPRegisted())
303 303
 				{
304 304
 					return;
305 305
 				}
306 306
 
307
-				require_once(_XE_PATH_ . 'libs/ftp.class.php');
307
+				require_once(_XE_PATH_.'libs/ftp.class.php');
308 308
 				$oFtp = new ftp();
309
-				if(!$ftp_info->ftp_host)
309
+				if (!$ftp_info->ftp_host)
310 310
 				{
311 311
 					$ftp_info->ftp_host = "127.0.0.1";
312 312
 				}
313
-				if(!$ftp_info->ftp_port)
313
+				if (!$ftp_info->ftp_port)
314 314
 				{
315 315
 					$ftp_info->ftp_port = 21;
316 316
 				}
317
-				if(!$oFtp->ftp_connect($ftp_info->ftp_host, $ftp_info->ftp_port))
317
+				if (!$oFtp->ftp_connect($ftp_info->ftp_host, $ftp_info->ftp_port))
318 318
 				{
319 319
 					return;
320 320
 				}
321
-				if(!$oFtp->ftp_login($ftp_info->ftp_user, $ftp_info->ftp_password))
321
+				if (!$oFtp->ftp_login($ftp_info->ftp_user, $ftp_info->ftp_password))
322 322
 				{
323 323
 					$oFtp->ftp_quit();
324 324
 					return;
325 325
 				}
326 326
 			}
327 327
 
328
-			if(!($ftp_path = $ftp_info->ftp_root_path))
328
+			if (!($ftp_path = $ftp_info->ftp_root_path))
329 329
 			{
330 330
 				$ftp_path = DIRECTORY_SEPARATOR;
331 331
 			}
@@ -334,19 +334,19 @@  discard block
 block discarded – undo
334 334
 			$path_list = explode(DIRECTORY_SEPARATOR, $path_string);
335 335
 
336 336
 			$path = _XE_PATH_;
337
-			for($i = 0, $c = count($path_list); $i < $c; $i++)
337
+			for ($i = 0, $c = count($path_list); $i < $c; $i++)
338 338
 			{
339
-				if(!$path_list[$i])
339
+				if (!$path_list[$i])
340 340
 				{
341 341
 					continue;
342 342
 				}
343 343
 
344
-				$path .= $path_list[$i] . DIRECTORY_SEPARATOR;
345
-				$ftp_path .= $path_list[$i] . DIRECTORY_SEPARATOR;
346
-				if(!is_dir($path))
344
+				$path .= $path_list[$i].DIRECTORY_SEPARATOR;
345
+				$ftp_path .= $path_list[$i].DIRECTORY_SEPARATOR;
346
+				if (!is_dir($path))
347 347
 				{
348 348
 					$oFtp->ftp_mkdir($ftp_path);
349
-					$oFtp->ftp_site("CHMOD 777 " . $ftp_path);
349
+					$oFtp->ftp_site("CHMOD 777 ".$ftp_path);
350 350
 				}
351 351
 			}
352 352
 		}
@@ -362,23 +362,23 @@  discard block
 block discarded – undo
362 362
 	 */
363 363
 	function removeDir($path)
364 364
 	{
365
-		if(($path = self::isDir($path)) === FALSE)
365
+		if (($path = self::isDir($path)) === FALSE)
366 366
 		{
367 367
 			return;
368 368
 		}
369 369
 
370
-		if(self::isDir($path))
370
+		if (self::isDir($path))
371 371
 		{
372 372
 			$files = array_diff(scandir($path), array('..', '.'));
373 373
 
374
-			foreach($files as $file)
374
+			foreach ($files as $file)
375 375
 			{
376
-				if(($target = self::getRealPath($path . DIRECTORY_SEPARATOR . $file)) === FALSE)
376
+				if (($target = self::getRealPath($path.DIRECTORY_SEPARATOR.$file)) === FALSE)
377 377
 				{
378 378
 					continue;
379 379
 				}
380 380
 
381
-				if(is_dir($target))
381
+				if (is_dir($target))
382 382
 				{
383 383
 					self::removeDir($target);
384 384
 				}
@@ -403,22 +403,22 @@  discard block
 block discarded – undo
403 403
 	 */
404 404
 	function removeBlankDir($path)
405 405
 	{
406
-		if(($path = self::isDir($path)) === FALSE)
406
+		if (($path = self::isDir($path)) === FALSE)
407 407
 		{
408 408
 			return;
409 409
 		}
410 410
 
411 411
 		$files = array_diff(scandir($path), array('..', '.'));
412 412
 
413
-		if(count($files) < 1)
413
+		if (count($files) < 1)
414 414
 		{
415 415
 			rmdir($path);
416 416
 			return;
417 417
 		}
418 418
 
419
-		foreach($files as $file)
419
+		foreach ($files as $file)
420 420
 		{
421
-			if(($target = self::isDir($path . DIRECTORY_SEPARATOR . $file)) === FALSE)
421
+			if (($target = self::isDir($path.DIRECTORY_SEPARATOR.$file)) === FALSE)
422 422
 			{
423 423
 				continue;
424 424
 			}
@@ -437,23 +437,23 @@  discard block
 block discarded – undo
437 437
 	 */
438 438
 	function removeFilesInDir($path)
439 439
 	{
440
-		if(($path = self::getRealPath($path)) === FALSE)
440
+		if (($path = self::getRealPath($path)) === FALSE)
441 441
 		{
442 442
 			return;
443 443
 		}
444 444
 
445
-		if(is_dir($path))
445
+		if (is_dir($path))
446 446
 		{
447 447
 			$files = array_diff(scandir($path), array('..', '.'));
448 448
 
449
-			foreach($files as $file)
449
+			foreach ($files as $file)
450 450
 			{
451
-				if(($target = self::getRealPath($path . DIRECTORY_SEPARATOR . $file)) === FALSE)
451
+				if (($target = self::getRealPath($path.DIRECTORY_SEPARATOR.$file)) === FALSE)
452 452
 				{
453 453
 					continue;
454 454
 				}
455 455
 
456
-				if(is_dir($target))
456
+				if (is_dir($target))
457 457
 				{
458 458
 					self::removeFilesInDir($target);
459 459
 				}
@@ -465,7 +465,7 @@  discard block
 block discarded – undo
465 465
 		}
466 466
 		else
467 467
 		{
468
-			if(self::exists($path)) unlink($path);
468
+			if (self::exists($path)) unlink($path);
469 469
 		}
470 470
 
471 471
 	}
@@ -479,22 +479,22 @@  discard block
 block discarded – undo
479 479
 	 */
480 480
 	function filesize($size)
481 481
 	{
482
-		if(!$size)
482
+		if (!$size)
483 483
 		{
484 484
 			return '0Byte';
485 485
 		}
486 486
 
487
-		if($size === 1)
487
+		if ($size === 1)
488 488
 		{
489 489
 			return '1Byte';
490 490
 		}
491 491
 
492
-		if($size < 1024)
492
+		if ($size < 1024)
493 493
 		{
494
-			return $size . 'Bytes';
494
+			return $size.'Bytes';
495 495
 		}
496 496
 
497
-		if($size >= 1024 && $size < 1024 * 1024)
497
+		if ($size >= 1024 && $size < 1024 * 1024)
498 498
 		{
499 499
 			return sprintf("%0.1fKB", $size / 1024);
500 500
 		}
@@ -519,7 +519,7 @@  discard block
 block discarded – undo
519 519
 	 */
520 520
 	function getRemoteResource($url, $body = null, $timeout = 3, $method = 'GET', $content_type = null, $headers = array(), $cookies = array(), $post_data = array(), $request_config = array())
521 521
 	{
522
-		require_once(_XE_PATH_ . 'libs/idna_convert/idna_convert.class.php');
522
+		require_once(_XE_PATH_.'libs/idna_convert/idna_convert.class.php');
523 523
 		$IDN = new idna_convert(array('idn_version' => 2008));
524 524
 		$url = $IDN->encode($url);
525 525
 
@@ -529,7 +529,7 @@  discard block
 block discarded – undo
529 529
 			require_once('HTTP/Request.php');
530 530
 
531 531
 			$parsed_url = parse_url(__PROXY_SERVER__);
532
-			if($parsed_url["host"] && $parsed_url["path"])
532
+			if ($parsed_url["host"] && $parsed_url["path"])
533 533
 			{
534 534
 				// Old style proxy server support (POST payload to proxy script)
535 535
 				$oRequest = new HTTP_Request(__PROXY_SERVER__);
@@ -541,7 +541,7 @@  discard block
 block discarded – undo
541 541
 				$oRequest = new HTTP_Request($url);
542 542
 
543 543
 				// New style proxy server support (Use HTTP_Request2 native config format)
544
-				if($parsed_url['host'])
544
+				if ($parsed_url['host'])
545 545
 				{
546 546
 					$request_config['proxy_host'] = $parsed_url['host'];
547 547
 					$request_config['proxy_port'] = $parsed_url['port'] ? $parsed_url['port'] : '';
@@ -550,13 +550,13 @@  discard block
 block discarded – undo
550 550
 					$request_config['proxy_type'] = $parsed_url['scheme'] ? $parsed_url['scheme'] : 'http';
551 551
 				}
552 552
 
553
-				if(count($request_config) && method_exists($oRequest, 'setConfig'))
553
+				if (count($request_config) && method_exists($oRequest, 'setConfig'))
554 554
 				{
555
-					foreach($request_config as $key=>$val)
555
+					foreach ($request_config as $key=>$val)
556 556
 					{
557
-						if($key === 'observers')
557
+						if ($key === 'observers')
558 558
 						{
559
-							foreach($val as $observer)
559
+							foreach ($val as $observer)
560 560
 							{
561 561
 								$oRequest->attach($observer);
562 562
 							}
@@ -567,58 +567,58 @@  discard block
 block discarded – undo
567 567
 						}
568 568
 					}
569 569
 				}
570
-				if(method_exists($oRequest, 'setConfig'))
570
+				if (method_exists($oRequest, 'setConfig'))
571 571
 				{
572
-					if(extension_loaded('curl'))
572
+					if (extension_loaded('curl'))
573 573
 					{
574 574
 						$oRequest->setConfig('adapter', 'curl');
575 575
 					}
576
-					elseif(version_compare(PHP_VERSION, '5.6', '<'))
576
+					elseif (version_compare(PHP_VERSION, '5.6', '<'))
577 577
 					{
578 578
 						$oRequest->setConfig('ssl_verify_host', false);
579 579
 					}
580
-					if(file_exists(_XE_PATH_ . 'libs/cacert/cacert.pem'))
580
+					if (file_exists(_XE_PATH_.'libs/cacert/cacert.pem'))
581 581
 					{
582
-						$oRequest->setConfig('ssl_cafile', _XE_PATH_ . 'libs/cacert/cacert.pem');
582
+						$oRequest->setConfig('ssl_cafile', _XE_PATH_.'libs/cacert/cacert.pem');
583 583
 					}
584 584
 				}
585 585
 
586
-				if(count($headers) > 0)
586
+				if (count($headers) > 0)
587 587
 				{
588
-					foreach($headers as $key => $val)
588
+					foreach ($headers as $key => $val)
589 589
 					{
590 590
 						$oRequest->addHeader($key, $val);
591 591
 					}
592 592
 				}
593 593
 				$host = parse_url($url, PHP_URL_HOST);
594
-				if($cookies[$host])
594
+				if ($cookies[$host])
595 595
 				{
596
-					foreach($cookies[$host] as $key => $val)
596
+					foreach ($cookies[$host] as $key => $val)
597 597
 					{
598 598
 						$oRequest->addCookie($key, $val);
599 599
 					}
600 600
 				}
601
-				if(count($post_data) > 0)
601
+				if (count($post_data) > 0)
602 602
 				{
603
-					foreach($post_data as $key => $val)
603
+					foreach ($post_data as $key => $val)
604 604
 					{
605 605
 						$oRequest->addPostData($key, $val);
606 606
 					}
607 607
 				}
608
-				if(!$content_type)
608
+				if (!$content_type)
609 609
 					$oRequest->addHeader('Content-Type', 'text/html');
610 610
 				else
611 611
 					$oRequest->addHeader('Content-Type', $content_type);
612 612
 				$oRequest->setMethod($method);
613
-				if($body)
613
+				if ($body)
614 614
 					$oRequest->setBody($body);
615 615
 			}
616 616
 			
617
-			if(method_exists($oRequest, 'setConfig'))
617
+			if (method_exists($oRequest, 'setConfig'))
618 618
 			{
619 619
 				$oRequest->setConfig('timeout', $timeout);
620 620
 			}
621
-			elseif(property_exists($oRequest, '_timeout'))
621
+			elseif (property_exists($oRequest, '_timeout'))
622 622
 			{
623 623
 				$oRequest->_timeout = $timeout;
624 624
 			}
@@ -628,25 +628,25 @@  discard block
 block discarded – undo
628 628
 			$code = $oRequest->getResponseCode();
629 629
 			$header = $oRequest->getResponseHeader();
630 630
 			$response = $oRequest->getResponseBody();
631
-			if($c = $oRequest->getResponseCookies())
631
+			if ($c = $oRequest->getResponseCookies())
632 632
 			{
633
-				foreach($c as $k => $v)
633
+				foreach ($c as $k => $v)
634 634
 				{
635 635
 					$cookies[$host][$v['name']] = $v['value'];
636 636
 				}
637 637
 			}
638 638
 
639
-			if($code > 300 && $code < 399 && $header['location'])
639
+			if ($code > 300 && $code < 399 && $header['location'])
640 640
 			{
641 641
 				return self::getRemoteResource($header['location'], $body, $timeout, $method, $content_type, $headers, $cookies, $post_data);
642 642
 			}
643 643
 
644
-			if($code != 200)
644
+			if ($code != 200)
645 645
 			{
646 646
 				return;
647 647
 			}
648 648
 
649
-			if(isset($request_config['store_body']) && !$request_config['store_body'])
649
+			if (isset($request_config['store_body']) && !$request_config['store_body'])
650 650
 			{
651 651
 				return TRUE;
652 652
 			}
@@ -655,7 +655,7 @@  discard block
 block discarded – undo
655 655
 				return $response;
656 656
 			}
657 657
 		}
658
-		catch(Exception $e)
658
+		catch (Exception $e)
659 659
 		{
660 660
 			return NULL;
661 661
 		}
@@ -689,7 +689,7 @@  discard block
 block discarded – undo
689 689
 			self::clearStatCache($target_filename);
690 690
 			self::invalidateOpcache($target_filename);
691 691
 		}
692
-		catch(Exception $e)
692
+		catch (Exception $e)
693 693
 		{
694 694
 			return FALSE;
695 695
 		}
@@ -706,7 +706,7 @@  discard block
 block discarded – undo
706 706
 	function returnBytes($val)
707 707
 	{
708 708
 		$unit = strtoupper(substr($val, -1));
709
-		$val = (float)$val;
709
+		$val = (float) $val;
710 710
 
711 711
 		switch ($unit)
712 712
 		{
@@ -729,13 +729,13 @@  discard block
 block discarded – undo
729 729
 		$K64 = 65536;
730 730
 		$TWEAKFACTOR = 2.0;
731 731
 		$channels = $imageInfo['channels'];
732
-		if(!$channels)
732
+		if (!$channels)
733 733
 		{
734 734
 			$channels = 6; //for png
735 735
 		}
736
-		$memoryNeeded = round(($imageInfo[0] * $imageInfo[1] * $imageInfo['bits'] * $channels / 8 + $K64 ) * $TWEAKFACTOR);
736
+		$memoryNeeded = round(($imageInfo[0] * $imageInfo[1] * $imageInfo['bits'] * $channels / 8 + $K64) * $TWEAKFACTOR);
737 737
 		$availableMemory = self::returnBytes(ini_get('memory_limit')) - memory_get_usage();
738
-		if($availableMemory < $memoryNeeded)
738
+		if ($availableMemory < $memoryNeeded)
739 739
 		{
740 740
 			return FALSE;
741 741
 		}
@@ -762,30 +762,30 @@  discard block
 block discarded – undo
762 762
 		}
763 763
 
764 764
 		$target_file = self::getRealPath($target_file);
765
-		if(!$resize_width)
765
+		if (!$resize_width)
766 766
 		{
767 767
 			$resize_width = 100;
768 768
 		}
769 769
 
770
-		if(!$resize_height)
770
+		if (!$resize_height)
771 771
 		{
772 772
 			$resize_height = $resize_width;
773 773
 		}
774 774
 
775 775
 		// retrieve source image's information
776 776
 		$imageInfo = getimagesize($source_file);
777
-		if(!self::checkMemoryLoadImage($imageInfo))
777
+		if (!self::checkMemoryLoadImage($imageInfo))
778 778
 		{
779 779
 			return FALSE;
780 780
 		}
781 781
 
782 782
 		list($width, $height, $type, $attrs) = $imageInfo;
783
-		if($width < 1 || $height < 1)
783
+		if ($width < 1 || $height < 1)
784 784
 		{
785 785
 			return;
786 786
 		}
787 787
 
788
-		switch($type)
788
+		switch ($type)
789 789
 		{
790 790
 			case '1' :
791 791
 				$type = 'gif';
@@ -803,7 +803,7 @@  discard block
 block discarded – undo
803 803
 				return;
804 804
 		}
805 805
 
806
-		if(!$target_type)
806
+		if (!$target_type)
807 807
 		{
808 808
 			$target_type = $type;
809 809
 		}
@@ -814,7 +814,7 @@  discard block
 block discarded – undo
814 814
 		$height_per = ($resize_height > 0 && $height >= $resize_height) ? $resize_height / $height : 1;
815 815
 
816 816
 		$per = NULL;
817
-		if($thumbnail_type == 'ratio')
817
+		if ($thumbnail_type == 'ratio')
818 818
 		{
819 819
 			$per = ($width_per > $height_per) ? $height_per : $width_per;
820 820
 			$resize_width = $width * $per;
@@ -827,30 +827,30 @@  discard block
 block discarded – undo
827 827
 
828 828
 		// create temporary image with target size
829 829
 		$thumb = NULL;
830
-		if(function_exists('imagecreateTRUEcolor'))
830
+		if (function_exists('imagecreateTRUEcolor'))
831 831
 		{
832 832
 			$thumb = imagecreateTRUEcolor($resize_width, $resize_height);
833 833
 		}
834
-		else if(function_exists('imagecreate'))
834
+		else if (function_exists('imagecreate'))
835 835
 		{
836 836
 			$thumb = imagecreate($resize_width, $resize_height);
837 837
 		}
838 838
 
839
-		if(!$thumb)
839
+		if (!$thumb)
840 840
 		{
841 841
 			return FALSE;
842 842
 		}
843 843
 
844
-		if(function_exists('imagecolorallocatealpha') && $target_type == 'png')
844
+		if (function_exists('imagecolorallocatealpha') && $target_type == 'png')
845 845
 		{
846 846
 			imagefill($thumb, 0, 0, imagecolorallocatealpha($thumb, 0, 0, 0, 127));
847 847
 			
848
-			if(function_exists('imagesavealpha'))
848
+			if (function_exists('imagesavealpha'))
849 849
 			{
850 850
 				imagesavealpha($thumb, TRUE);
851 851
 			}
852 852
 
853
-			if(function_exists('imagealphablending'))
853
+			if (function_exists('imagealphablending'))
854 854
 			{
855 855
 				imagealphablending($thumb, true);
856 856
 			}
@@ -862,37 +862,37 @@  discard block
 block discarded – undo
862 862
 
863 863
 		// create temporary image having original type
864 864
 		$source = NULL;
865
-		switch($type)
865
+		switch ($type)
866 866
 		{
867 867
 			case 'gif' :
868
-				if(function_exists('imagecreatefromgif'))
868
+				if (function_exists('imagecreatefromgif'))
869 869
 				{
870 870
 					$source = @imagecreatefromgif($source_file);
871 871
 				}
872 872
 				break;
873 873
 			case 'jpeg' :
874 874
 			case 'jpg' :
875
-				if(function_exists('imagecreatefromjpeg'))
875
+				if (function_exists('imagecreatefromjpeg'))
876 876
 				{
877 877
 					$source = @imagecreatefromjpeg($source_file);
878 878
 				}
879 879
 				break;
880 880
 			case 'png' :
881
-				if(function_exists('imagecreatefrompng'))
881
+				if (function_exists('imagecreatefrompng'))
882 882
 				{
883 883
 					$source = @imagecreatefrompng($source_file);
884 884
 				}
885 885
 				break;
886 886
 			case 'wbmp' :
887 887
 			case 'bmp' :
888
-				if(function_exists('imagecreatefromwbmp'))
888
+				if (function_exists('imagecreatefromwbmp'))
889 889
 				{
890 890
 					$source = @imagecreatefromwbmp($source_file);
891 891
 				}
892 892
 				break;
893 893
 		}
894 894
 
895
-		if(!$source)
895
+		if (!$source)
896 896
 		{
897 897
 			imagedestroy($thumb);
898 898
 			return FALSE;
@@ -904,13 +904,13 @@  discard block
 block discarded – undo
904 904
 
905 905
 		$x = 0;
906 906
 		$y = 0;
907
-		if($thumbnail_type == 'crop')
907
+		if ($thumbnail_type == 'crop')
908 908
 		{
909 909
 			$x = (int) ($resize_width / 2 - $new_width / 2);
910 910
 			$y = (int) ($resize_height / 2 - $new_height / 2);
911 911
 		}
912 912
 
913
-		if(function_exists('imagecopyresampled'))
913
+		if (function_exists('imagecopyresampled'))
914 914
 		{
915 915
 			imagecopyresampled($thumb, $source, $x, $y, 0, 0, $new_width, $new_height, $width, $height);
916 916
 		}
@@ -924,30 +924,30 @@  discard block
 block discarded – undo
924 924
 
925 925
 		// write into the file
926 926
 		$output = NULL;
927
-		switch($target_type)
927
+		switch ($target_type)
928 928
 		{
929 929
 			case 'gif' :
930
-				if(function_exists('imagegif'))
930
+				if (function_exists('imagegif'))
931 931
 				{
932 932
 					$output = imagegif($thumb, $target_file);
933 933
 				}
934 934
 				break;
935 935
 			case 'jpeg' :
936 936
 			case 'jpg' :
937
-				if(function_exists('imagejpeg'))
937
+				if (function_exists('imagejpeg'))
938 938
 				{
939 939
 					$output = imagejpeg($thumb, $target_file, 100);
940 940
 				}
941 941
 				break;
942 942
 			case 'png' :
943
-				if(function_exists('imagepng'))
943
+				if (function_exists('imagepng'))
944 944
 				{
945 945
 					$output = imagepng($thumb, $target_file, 9);
946 946
 				}
947 947
 				break;
948 948
 			case 'wbmp' :
949 949
 			case 'bmp' :
950
-				if(function_exists('imagewbmp'))
950
+				if (function_exists('imagewbmp'))
951 951
 				{
952 952
 					$output = imagewbmp($thumb, $target_file, 100);
953 953
 				}
@@ -957,7 +957,7 @@  discard block
 block discarded – undo
957 957
 		imagedestroy($thumb);
958 958
 		imagedestroy($source);
959 959
 
960
-		if(!$output)
960
+		if (!$output)
961 961
 		{
962 962
 			return FALSE;
963 963
 		}
@@ -975,12 +975,12 @@  discard block
 block discarded – undo
975 975
 	 */
976 976
 	function readIniFile($filename)
977 977
 	{
978
-		if(($filename = self::exists($filename)) === FALSE)
978
+		if (($filename = self::exists($filename)) === FALSE)
979 979
 		{
980 980
 			return FALSE;
981 981
 		}
982 982
 		$arr = parse_ini_file($filename, TRUE);
983
-		if(is_array($arr) && count($arr) > 0)
983
+		if (is_array($arr) && count($arr) > 0)
984 984
 		{
985 985
 			return $arr;
986 986
 		}
@@ -1006,7 +1006,7 @@  discard block
 block discarded – undo
1006 1006
 	 */
1007 1007
 	function writeIniFile($filename, $arr)
1008 1008
 	{
1009
-		if(!is_array($arr) || count($arr) == 0)
1009
+		if (!is_array($arr) || count($arr) == 0)
1010 1010
 		{
1011 1011
 			return FALSE;
1012 1012
 		}
@@ -1023,19 +1023,19 @@  discard block
 block discarded – undo
1023 1023
 	function _makeIniBuff($arr)
1024 1024
 	{
1025 1025
 		$return = array();
1026
-		foreach($arr as $key => $val)
1026
+		foreach ($arr as $key => $val)
1027 1027
 		{
1028 1028
 			// section
1029
-			if(is_array($val))
1029
+			if (is_array($val))
1030 1030
 			{
1031 1031
 				$return[] = sprintf("[%s]", $key);
1032
-				foreach($val as $k => $v)
1032
+				foreach ($val as $k => $v)
1033 1033
 				{
1034 1034
 					$return[] = sprintf("%s=\"%s\"", $k, $v);
1035 1035
 				}
1036 1036
 				// value
1037 1037
 			}
1038
-			else if(is_object($val))
1038
+			else if (is_object($val))
1039 1039
 			{
1040 1040
 				continue;
1041 1041
 			}
@@ -1110,15 +1110,15 @@  discard block
 block discarded – undo
1110 1110
 	function isWritableDir($path)
1111 1111
 	{
1112 1112
 		$path = self::getRealPath($path);
1113
-		if(is_dir($path)==FALSE)
1113
+		if (is_dir($path) == FALSE)
1114 1114
 		{
1115 1115
 			return FALSE;
1116 1116
 		}
1117 1117
 
1118
-		$checkFile = $path . '/_CheckWritableDir';
1118
+		$checkFile = $path.'/_CheckWritableDir';
1119 1119
 
1120 1120
 		$fp = fopen($checkFile, 'w');
1121
-		if(!is_resource($fp))
1121
+		if (!is_resource($fp))
1122 1122
 		{
1123 1123
 			return FALSE;
1124 1124
 		}
@@ -1136,7 +1136,7 @@  discard block
 block discarded – undo
1136 1136
 	 **/
1137 1137
 	static public function clearStatCache($target, $include = false)
1138 1138
 	{
1139
-		if(is_array($target))
1139
+		if (is_array($target))
1140 1140
 		{
1141 1141
 			array_map('self::clearStatCache', $target);
1142 1142
 			return;
@@ -1144,7 +1144,7 @@  discard block
 block discarded – undo
1144 1144
 
1145 1145
 		$target = self::getRealPath($target);
1146 1146
 
1147
-		if($include && self::isDir($target))
1147
+		if ($include && self::isDir($target))
1148 1148
 		{
1149 1149
 			self::clearStatCache(self::readDir($target, '', false, true), $include);
1150 1150
 		}
@@ -1162,27 +1162,27 @@  discard block
 block discarded – undo
1162 1162
 	{
1163 1163
 		static $opcache = null;
1164 1164
 
1165
-		if($opcache === null)
1165
+		if ($opcache === null)
1166 1166
 		{
1167 1167
 			$opcache = (function_exists('opcache_get_status') && function_exists('opcache_invalidate'));
1168 1168
 		}
1169 1169
 
1170
-		if($opcache === false)
1170
+		if ($opcache === false)
1171 1171
 		{
1172 1172
 			return;
1173 1173
 		}
1174 1174
 
1175
-		if(is_array($target))
1175
+		if (is_array($target))
1176 1176
 		{
1177 1177
 			array_map('self::invalidateOpcache', $target);
1178 1178
 			return;
1179 1179
 		}
1180 1180
 
1181
-		if(substr($target, -4) === '.php')
1181
+		if (substr($target, -4) === '.php')
1182 1182
 		{
1183 1183
 			opcache_invalidate(self::getRealPath($target), $force);
1184 1184
 		}
1185
-		else if($path = self::isDir($target))
1185
+		else if ($path = self::isDir($target))
1186 1186
 		{
1187 1187
 			self::invalidateOpcache(self::readDir($path, '', false, true));
1188 1188
 		}
Please login to merge, or discard this patch.