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
Push — develop ( 04174c...db47f7 )
by gyeong-won
22:39 queued 10:06
created
classes/file/FileHandler.class.php 2 patches
Spacing   +138 added lines, -138 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,16 +827,16 @@  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
 		}
@@ -845,37 +845,37 @@  discard block
 block discarded – undo
845 845
 
846 846
 		// create temporary image having original type
847 847
 		$source = NULL;
848
-		switch($type)
848
+		switch ($type)
849 849
 		{
850 850
 			case 'gif' :
851
-				if(function_exists('imagecreatefromgif'))
851
+				if (function_exists('imagecreatefromgif'))
852 852
 				{
853 853
 					$source = @imagecreatefromgif($source_file);
854 854
 				}
855 855
 				break;
856 856
 			case 'jpeg' :
857 857
 			case 'jpg' :
858
-				if(function_exists('imagecreatefromjpeg'))
858
+				if (function_exists('imagecreatefromjpeg'))
859 859
 				{
860 860
 					$source = @imagecreatefromjpeg($source_file);
861 861
 				}
862 862
 				break;
863 863
 			case 'png' :
864
-				if(function_exists('imagecreatefrompng'))
864
+				if (function_exists('imagecreatefrompng'))
865 865
 				{
866 866
 					$source = @imagecreatefrompng($source_file);
867 867
 				}
868 868
 				break;
869 869
 			case 'wbmp' :
870 870
 			case 'bmp' :
871
-				if(function_exists('imagecreatefromwbmp'))
871
+				if (function_exists('imagecreatefromwbmp'))
872 872
 				{
873 873
 					$source = @imagecreatefromwbmp($source_file);
874 874
 				}
875 875
 				break;
876 876
 		}
877 877
 
878
-		if(!$source)
878
+		if (!$source)
879 879
 		{
880 880
 			imagedestroy($thumb);
881 881
 			return FALSE;
@@ -887,13 +887,13 @@  discard block
 block discarded – undo
887 887
 
888 888
 		$x = 0;
889 889
 		$y = 0;
890
-		if($thumbnail_type == 'crop')
890
+		if ($thumbnail_type == 'crop')
891 891
 		{
892 892
 			$x = (int) ($resize_width / 2 - $new_width / 2);
893 893
 			$y = (int) ($resize_height / 2 - $new_height / 2);
894 894
 		}
895 895
 
896
-		if(function_exists('imagecopyresampled'))
896
+		if (function_exists('imagecopyresampled'))
897 897
 		{
898 898
 			imagecopyresampled($thumb, $source, $x, $y, 0, 0, $new_width, $new_height, $width, $height);
899 899
 		}
@@ -907,30 +907,30 @@  discard block
 block discarded – undo
907 907
 
908 908
 		// write into the file
909 909
 		$output = NULL;
910
-		switch($target_type)
910
+		switch ($target_type)
911 911
 		{
912 912
 			case 'gif' :
913
-				if(function_exists('imagegif'))
913
+				if (function_exists('imagegif'))
914 914
 				{
915 915
 					$output = imagegif($thumb, $target_file);
916 916
 				}
917 917
 				break;
918 918
 			case 'jpeg' :
919 919
 			case 'jpg' :
920
-				if(function_exists('imagejpeg'))
920
+				if (function_exists('imagejpeg'))
921 921
 				{
922 922
 					$output = imagejpeg($thumb, $target_file, 100);
923 923
 				}
924 924
 				break;
925 925
 			case 'png' :
926
-				if(function_exists('imagepng'))
926
+				if (function_exists('imagepng'))
927 927
 				{
928 928
 					$output = imagepng($thumb, $target_file, 9);
929 929
 				}
930 930
 				break;
931 931
 			case 'wbmp' :
932 932
 			case 'bmp' :
933
-				if(function_exists('imagewbmp'))
933
+				if (function_exists('imagewbmp'))
934 934
 				{
935 935
 					$output = imagewbmp($thumb, $target_file, 100);
936 936
 				}
@@ -940,7 +940,7 @@  discard block
 block discarded – undo
940 940
 		imagedestroy($thumb);
941 941
 		imagedestroy($source);
942 942
 
943
-		if(!$output)
943
+		if (!$output)
944 944
 		{
945 945
 			return FALSE;
946 946
 		}
@@ -958,12 +958,12 @@  discard block
 block discarded – undo
958 958
 	 */
959 959
 	function readIniFile($filename)
960 960
 	{
961
-		if(($filename = self::exists($filename)) === FALSE)
961
+		if (($filename = self::exists($filename)) === FALSE)
962 962
 		{
963 963
 			return FALSE;
964 964
 		}
965 965
 		$arr = parse_ini_file($filename, TRUE);
966
-		if(is_array($arr) && count($arr) > 0)
966
+		if (is_array($arr) && count($arr) > 0)
967 967
 		{
968 968
 			return $arr;
969 969
 		}
@@ -989,7 +989,7 @@  discard block
 block discarded – undo
989 989
 	 */
990 990
 	function writeIniFile($filename, $arr)
991 991
 	{
992
-		if(!is_array($arr) || count($arr) == 0)
992
+		if (!is_array($arr) || count($arr) == 0)
993 993
 		{
994 994
 			return FALSE;
995 995
 		}
@@ -1006,19 +1006,19 @@  discard block
 block discarded – undo
1006 1006
 	function _makeIniBuff($arr)
1007 1007
 	{
1008 1008
 		$return = array();
1009
-		foreach($arr as $key => $val)
1009
+		foreach ($arr as $key => $val)
1010 1010
 		{
1011 1011
 			// section
1012
-			if(is_array($val))
1012
+			if (is_array($val))
1013 1013
 			{
1014 1014
 				$return[] = sprintf("[%s]", $key);
1015
-				foreach($val as $k => $v)
1015
+				foreach ($val as $k => $v)
1016 1016
 				{
1017 1017
 					$return[] = sprintf("%s=\"%s\"", $k, $v);
1018 1018
 				}
1019 1019
 				// value
1020 1020
 			}
1021
-			else if(is_object($val))
1021
+			else if (is_object($val))
1022 1022
 			{
1023 1023
 				continue;
1024 1024
 			}
@@ -1093,15 +1093,15 @@  discard block
 block discarded – undo
1093 1093
 	function isWritableDir($path)
1094 1094
 	{
1095 1095
 		$path = self::getRealPath($path);
1096
-		if(is_dir($path)==FALSE)
1096
+		if (is_dir($path) == FALSE)
1097 1097
 		{
1098 1098
 			return FALSE;
1099 1099
 		}
1100 1100
 
1101
-		$checkFile = $path . '/_CheckWritableDir';
1101
+		$checkFile = $path.'/_CheckWritableDir';
1102 1102
 
1103 1103
 		$fp = fopen($checkFile, 'w');
1104
-		if(!is_resource($fp))
1104
+		if (!is_resource($fp))
1105 1105
 		{
1106 1106
 			return FALSE;
1107 1107
 		}
@@ -1119,7 +1119,7 @@  discard block
 block discarded – undo
1119 1119
 	 **/
1120 1120
 	static public function clearStatCache($target, $include = false)
1121 1121
 	{
1122
-		if(is_array($target))
1122
+		if (is_array($target))
1123 1123
 		{
1124 1124
 			array_map('self::clearStatCache', $target);
1125 1125
 			return;
@@ -1127,7 +1127,7 @@  discard block
 block discarded – undo
1127 1127
 
1128 1128
 		$target = self::getRealPath($target);
1129 1129
 
1130
-		if($include && self::isDir($target))
1130
+		if ($include && self::isDir($target))
1131 1131
 		{
1132 1132
 			self::clearStatCache(self::readDir($target, '', false, true), $include);
1133 1133
 		}
@@ -1145,27 +1145,27 @@  discard block
 block discarded – undo
1145 1145
 	{
1146 1146
 		static $opcache = null;
1147 1147
 
1148
-		if($opcache === null)
1148
+		if ($opcache === null)
1149 1149
 		{
1150 1150
 			$opcache = (function_exists('opcache_get_status') && function_exists('opcache_invalidate'));
1151 1151
 		}
1152 1152
 
1153
-		if($opcache === false)
1153
+		if ($opcache === false)
1154 1154
 		{
1155 1155
 			return;
1156 1156
 		}
1157 1157
 
1158
-		if(is_array($target))
1158
+		if (is_array($target))
1159 1159
 		{
1160 1160
 			array_map('self::invalidateOpcache', $target);
1161 1161
 			return;
1162 1162
 		}
1163 1163
 
1164
-		if(substr($target, -4) === '.php')
1164
+		if (substr($target, -4) === '.php')
1165 1165
 		{
1166 1166
 			opcache_invalidate(self::getRealPath($target), $force);
1167 1167
 		}
1168
-		else if($path = self::isDir($target))
1168
+		else if ($path = self::isDir($target))
1169 1169
 		{
1170 1170
 			self::invalidateOpcache(self::readDir($path, '', false, true));
1171 1171
 		}
Please login to merge, or discard this patch.
Braces   +31 added lines, -47 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
 		}
@@ -819,8 +810,7 @@  discard block
 block discarded – undo
819 810
 			$per = ($width_per > $height_per) ? $height_per : $width_per;
820 811
 			$resize_width = $width * $per;
821 812
 			$resize_height = $height * $per;
822
-		}
823
-		else
813
+		} else
824 814
 		{
825 815
 			$per = ($width_per < $height_per) ? $height_per : $width_per;
826 816
 		}
@@ -830,8 +820,7 @@  discard block
 block discarded – undo
830 820
 		if(function_exists('imagecreateTRUEcolor'))
831 821
 		{
832 822
 			$thumb = imagecreateTRUEcolor($resize_width, $resize_height);
833
-		}
834
-		else if(function_exists('imagecreate'))
823
+		} else if(function_exists('imagecreate'))
835 824
 		{
836 825
 			$thumb = imagecreate($resize_width, $resize_height);
837 826
 		}
@@ -896,8 +885,7 @@  discard block
 block discarded – undo
896 885
 		if(function_exists('imagecopyresampled'))
897 886
 		{
898 887
 			imagecopyresampled($thumb, $source, $x, $y, 0, 0, $new_width, $new_height, $width, $height);
899
-		}
900
-		else
888
+		} else
901 889
 		{
902 890
 			imagecopyresized($thumb, $source, $x, $y, 0, 0, $new_width, $new_height, $width, $height);
903 891
 		}
@@ -966,8 +954,7 @@  discard block
 block discarded – undo
966 954
 		if(is_array($arr) && count($arr) > 0)
967 955
 		{
968 956
 			return $arr;
969
-		}
970
-		else
957
+		} else
971 958
 		{
972 959
 			return array();
973 960
 		}
@@ -1017,12 +1004,10 @@  discard block
 block discarded – undo
1017 1004
 					$return[] = sprintf("%s=\"%s\"", $k, $v);
1018 1005
 				}
1019 1006
 				// value
1020
-			}
1021
-			else if(is_object($val))
1007
+			} else if(is_object($val))
1022 1008
 			{
1023 1009
 				continue;
1024
-			}
1025
-			else
1010
+			} else
1026 1011
 			{
1027 1012
 				$return[] = sprintf("%s=\"%s\"", $key, $val);
1028 1013
 			}
@@ -1164,8 +1149,7 @@  discard block
 block discarded – undo
1164 1149
 		if(substr($target, -4) === '.php')
1165 1150
 		{
1166 1151
 			opcache_invalidate(self::getRealPath($target), $force);
1167
-		}
1168
-		else if($path = self::isDir($target))
1152
+		} else if($path = self::isDir($target))
1169 1153
 		{
1170 1154
 			self::invalidateOpcache(self::readDir($path, '', false, true));
1171 1155
 		}
Please login to merge, or discard this patch.