Completed
Push — 2.x ( ccb6e2...0befff )
by Naoki
04:19
created
php/chars-test.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -24,10 +24,10 @@
 block discarded – undo
24 24
 
25 25
 //                     й                 ё              Й               Ё              Ø         Å
26 26
 $patterns = array("\u0438\u0306", "\u0435\u0308", "\u0418\u0306", "\u0415\u0308", "\u00d8A", "\u030a");
27
-$replace  = array("\u0439",        "\u0451",       "\u0419",       "\u0401",       "\u00d8", "\u00c5");
27
+$replace  = array("\u0439", "\u0451", "\u0419", "\u0401", "\u00d8", "\u00c5");
28 28
 
29 29
 
30
-foreach(scandir($path) as $f) {
30
+foreach (scandir($path) as $f) {
31 31
 	if ($f != '.' && $f != '..' && substr($f, 0, 1) != '.') {
32 32
 		
33 33
 		// echo mb_detect_encoding($f);
Please login to merge, or discard this patch.
php/elFinderConnector.class.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
 	 * @return void
35 35
 	 * @author Dmitry (dio) Levashov
36 36
 	 **/
37
-	public function __construct($elFinder, $debug=false) {
37
+	public function __construct($elFinder, $debug = false) {
38 38
 		
39 39
 		$this->elFinder = $elFinder;
40 40
 		if ($debug) {
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
 		if ($isPost && !$src && $rawPostData = @file_get_contents('php://input')) {
55 55
 			// for support IE XDomainRequest()
56 56
 			$parts = explode('&', $rawPostData);
57
-			foreach($parts as $part) {
57
+			foreach ($parts as $part) {
58 58
 				list($key, $value) = array_pad(explode('=', $part), 2, '');
59 59
 				$key = rawurldecode($key);
60 60
 				if (substr($key, -2) === '[]') {
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
 	 **/
122 122
 	protected function output(array $data) {
123 123
 		// clear output buffer
124
-		while(@ob_get_level()){ @ob_end_clean(); }
124
+		while (@ob_get_level()) { @ob_end_clean(); }
125 125
 		
126 126
 		$header = isset($data['header']) ? $data['header'] : $this->header;
127 127
 		unset($data['header']);
@@ -162,14 +162,14 @@  discard block
 block discarded – undo
162 162
 							$psize = $end - $start + 1;
163 163
 							
164 164
 							header('HTTP/1.1 206 Partial Content');
165
-							header('Content-Length: ' . $psize);
166
-							header('Content-Range: bytes ' . $start . '-' . $end . '/' . $size);
165
+							header('Content-Length: '.$psize);
166
+							header('Content-Range: bytes '.$start.'-'.$end.'/'.$size);
167 167
 							
168 168
 							fseek($fp, $start);
169 169
 						}
170 170
 					}
171 171
 				}
172
-				if (is_null($psize)){
172
+				if (is_null($psize)) {
173 173
 					rewind($fp);
174 174
 				}
175 175
 			} else {
Please login to merge, or discard this patch.
php/elFinderVolumeMySQL.class.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -311,7 +311,7 @@  discard block
 block discarded – undo
311 311
 		$dirs = array();
312 312
 		if ($path != $this->root) {
313 313
 			$inpath = array(intval($path));
314
-			while($inpath) {
314
+			while ($inpath) {
315 315
 				$in = '('.join(',', $inpath).')';
316 316
 				$inpath = array();
317 317
 				$sql = 'SELECT f.id FROM %s AS f WHERE f.parent_id IN '.$in.' AND `mime` = \'directory\'';
@@ -330,7 +330,7 @@  discard block
 block discarded – undo
330 330
 		
331 331
 		if ($mimes) {
332 332
 			$whrs = array();
333
-			foreach($mimes as $mime) {
333
+			foreach ($mimes as $mime) {
334 334
 				if (strpos($mime, '/') === false) {
335 335
 					$whrs[] = sprintf('f.mime LIKE "%s/%%"', $this->db->real_escape_string($mime));
336 336
 				} else {
@@ -342,7 +342,7 @@  discard block
 block discarded – undo
342 342
 			$whr = sprintf('f.name RLIKE "%s"', $this->db->real_escape_string($q));
343 343
 		}
344 344
 		if ($dirs) {
345
-			$whr = '(' . $whr . ') AND (`parent_id` IN (' . join(',', $dirs) . '))';
345
+			$whr = '('.$whr.') AND (`parent_id` IN ('.join(',', $dirs).'))';
346 346
 		}
347 347
 		
348 348
 		$sql = 'SELECT f.id, f.parent_id, f.name, f.size, f.mtime AS ts, f.mime, f.read, f.write, f.locked, f.hidden, f.width, f.height, 0 AS dirs 
@@ -587,7 +587,7 @@  discard block
 block discarded – undo
587 587
 	 * @return resource|false
588 588
 	 * @author Dmitry (dio) Levashov
589 589
 	 **/
590
-	protected function _fopen($path, $mode='rb') {
590
+	protected function _fopen($path, $mode = 'rb') {
591 591
 		$fp = $this->tmbPath
592 592
 			? @fopen($this->getTempFile($path), 'w+')
593 593
 			: @tmpfile();
@@ -614,7 +614,7 @@  discard block
 block discarded – undo
614 614
 	 * @return bool
615 615
 	 * @author Dmitry (dio) Levashov
616 616
 	 **/
617
-	protected function _fclose($fp, $path='') {
617
+	protected function _fclose($fp, $path = '') {
618 618
 		@fclose($fp);
619 619
 		if ($path) {
620 620
 			@unlink($this->getTempFile($path));
@@ -746,7 +746,7 @@  discard block
 block discarded – undo
746 746
 		$this->clearcache();
747 747
 		
748 748
 		$mime = $stat['mime'];
749
-		$w = !empty($stat['width'])  ? $stat['width']  : 0;
749
+		$w = !empty($stat['width']) ? $stat['width'] : 0;
750 750
 		$h = !empty($stat['height']) ? $stat['height'] : 0;
751 751
 		
752 752
 		$id = $this->_joinPath($dir, $name);
Please login to merge, or discard this patch.
php/elFinderVolumeS3.class.php 1 patch
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -61,8 +61,8 @@  discard block
 block discarded – undo
61 61
 	 **/
62 62
 	protected function _dirname($path) {
63 63
 	
64
-		$newpath =  preg_replace("/\/$/", "", $path);
65
-		$dn = substr($path, 0, strrpos($newpath, '/')) ;
64
+		$newpath = preg_replace("/\/$/", "", $path);
65
+		$dn = substr($path, 0, strrpos($newpath, '/'));
66 66
 		
67 67
 		if (substr($dn, 0, 1) != '/') {
68 68
 		 $dn = "/$dn";
@@ -105,9 +105,9 @@  discard block
 block discarded – undo
105 105
 	 * @author Troex Nevelin
106 106
 	 **/
107 107
 	protected function _normpath($path) {
108
-		$tmp =  preg_replace("/^\//", "", $path);
109
-		$tmp =  preg_replace("/\/\//", "/", $tmp);
110
-		$tmp =  preg_replace("/\/$/", "", $tmp);
108
+		$tmp = preg_replace("/^\//", "", $path);
109
+		$tmp = preg_replace("/\/\//", "/", $tmp);
110
+		$tmp = preg_replace("/\/$/", "", $tmp);
111 111
 		return $tmp;
112 112
 	}
113 113
 
@@ -128,9 +128,9 @@  discard block
 block discarded – undo
128 128
 			$newpath = "/$newpath";
129 129
 		}
130 130
 		
131
-		$newpath =  preg_replace("/\/$/", "", $newpath);
131
+		$newpath = preg_replace("/\/$/", "", $newpath);
132 132
 	
133
-		$ret = ($newpath == $this->root) ? '' : substr($newpath, strlen($this->root)+1);
133
+		$ret = ($newpath == $this->root) ? '' : substr($newpath, strlen($this->root) + 1);
134 134
 		
135 135
 		return $ret;
136 136
 	}
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
 		$np = $this->_normpath($path);
232 232
 		
233 233
 		try {
234
-			$obj = $this->s3->GetObject(array('Bucket' => $this->options['bucket'], 'Key' => $np , 'GetMetadata' => true, 'InlineData' => false, 'GetData' => false));
234
+			$obj = $this->s3->GetObject(array('Bucket' => $this->options['bucket'], 'Key' => $np, 'GetMetadata' => true, 'InlineData' => false, 'GetData' => false));
235 235
 		} catch (Exception $e) {
236 236
 		
237 237
 		}
@@ -239,7 +239,7 @@  discard block
 block discarded – undo
239 239
 		if (!isset($obj) || ($obj->GetObjectResponse->Status->Code != 200)) {
240 240
 			$np .= '/';
241 241
 			try {
242
-				$obj = $this->s3->GetObject(array('Bucket' => $this->options['bucket'], 'Key' => $np , 'GetMetadata' => true, 'InlineData' => false, 'GetData' => false));
242
+				$obj = $this->s3->GetObject(array('Bucket' => $this->options['bucket'], 'Key' => $np, 'GetMetadata' => true, 'InlineData' => false, 'GetData' => false));
243 243
 			} catch (Exception $e) {
244 244
 		
245 245
 			}
@@ -341,14 +341,14 @@  discard block
 block discarded – undo
341 341
 	 **/
342 342
 	protected function _scandir($path) {
343 343
 		
344
-		$s3path = preg_replace("/^\//", "", $path) . '/';
344
+		$s3path = preg_replace("/^\//", "", $path).'/';
345 345
 		
346 346
 		$files = $this->s3->ListBucket(array('Bucket' => $this->options['bucket'], 'delimiter' => '/', 'Prefix' => $s3path))->ListBucketResponse->Contents;
347 347
 	
348 348
 		$finalfiles = array();
349 349
 		
350 350
 		foreach ($files as $file) {
351
-			if (preg_match("|^" . $s3path . "[^/]*/?$|", $file->Key)) {
351
+			if (preg_match("|^".$s3path."[^/]*/?$|", $file->Key)) {
352 352
 				$fname = preg_replace("/\/$/", "", $file->Key);
353 353
 				$fname = $file->Key;
354 354
 				
@@ -373,7 +373,7 @@  discard block
 block discarded – undo
373 373
 	 * @author Dmitry (dio) Levashov,
374 374
 	 * @author Alexey Sukhotin
375 375
 	 **/
376
-	protected function _fopen($path, $mode="rb") {
376
+	protected function _fopen($path, $mode = "rb") {
377 377
 	
378 378
 		$tn = $this->getTempFile($path);
379 379
 	
@@ -385,8 +385,8 @@  discard block
 block discarded – undo
385 385
 		if ($fp) {
386 386
 
387 387
 			try {
388
-				$obj = $this->s3->GetObject(array('Bucket' => $this->options['bucket'], 'Key' => $this->_normpath($path) , 'GetMetadata' => true, 'InlineData' => true, 'GetData' => true));
389
-			}	catch (Exception $e) {
388
+				$obj = $this->s3->GetObject(array('Bucket' => $this->options['bucket'], 'Key' => $this->_normpath($path), 'GetMetadata' => true, 'InlineData' => true, 'GetData' => true));
389
+			} catch (Exception $e) {
390 390
 		
391 391
 			}
392 392
 				
@@ -410,7 +410,7 @@  discard block
 block discarded – undo
410 410
 	 * @return bool
411 411
 	 * @author Dmitry (dio) Levashov
412 412
 	 **/
413
-	protected function _fclose($fp, $path='') {
413
+	protected function _fclose($fp, $path = '') {
414 414
 		@fclose($fp);
415 415
 		if ($path) {
416 416
 			@unlink($this->getTempFile($path));
@@ -435,7 +435,7 @@  discard block
 block discarded – undo
435 435
 		$newkey = "$newkey/$name/";
436 436
 
437 437
 		try {
438
-			$obj = $this->s3->PutObjectInline(array('Bucket' => $this->options['bucket'], 'Key' => $newkey , 'ContentLength' => 0, 'Data' => ''));
438
+			$obj = $this->s3->PutObjectInline(array('Bucket' => $this->options['bucket'], 'Key' => $newkey, 'ContentLength' => 0, 'Data' => ''));
439 439
 		} catch (Exception $e) {
440 440
 		
441 441
 		}
@@ -462,7 +462,7 @@  discard block
 block discarded – undo
462 462
 		$newkey = "$newkey/$name";
463 463
 
464 464
 		try {
465
-			$obj = $this->s3->PutObjectInline(array('Bucket' => $this->options['bucket'], 'Key' => $newkey , 'ContentLength' => 0, 'Data' => '', 'Metadata' => array(array('Name' => 'Content-Type', 'Value' => 'text/plain'))));
465
+			$obj = $this->s3->PutObjectInline(array('Bucket' => $this->options['bucket'], 'Key' => $newkey, 'ContentLength' => 0, 'Data' => '', 'Metadata' => array(array('Name' => 'Content-Type', 'Value' => 'text/plain'))));
466 466
 		} catch (Exception $e) {
467 467
 		
468 468
 		}
@@ -563,7 +563,7 @@  discard block
 block discarded – undo
563 563
 	 * @author Dmitry (dio) Levashov
564 564
 	 **/
565 565
 	protected function _rmdir($path) {
566
-		return $this->_unlink($path . '/');
566
+		return $this->_unlink($path.'/');
567 567
 	}
568 568
 
569 569
 	/**
@@ -682,7 +682,7 @@  discard block
 block discarded – undo
682 682
 		/* Getting list of S3 web service functions which requires signing */
683 683
 		$funcs = $this->__getFunctions();
684 684
 		
685
-		$funcnames  = array();
685
+		$funcnames = array();
686 686
 		
687 687
 		foreach ($funcs as $func) {
688 688
 			preg_match("/\S+\s+([^\)]+)\(/", $func, $m);
@@ -723,7 +723,7 @@  discard block
 block discarded – undo
723 723
 			'Timestamp' => gmdate('Y-m-d\TH:i:s.000\Z'),
724 724
 		);
725 725
 
726
-		$sign_str = 'AmazonS3' . $operation . $params['Timestamp'];
726
+		$sign_str = 'AmazonS3'.$operation.$params['Timestamp'];
727 727
 		
728 728
 		$params['Signature'] = base64_encode(hash_hmac('sha1', $sign_str, $this->secretkey, TRUE));
729 729
 		
Please login to merge, or discard this patch.
php/plugins/Watermark/plugin.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -57,13 +57,13 @@  discard block
 block discarded – undo
57 57
 
58 58
 	public function __construct($opts) {
59 59
 		$defaults = array(
60
-			'enable'         => true,       // For control by volume driver
60
+			'enable'         => true, // For control by volume driver
61 61
 			'source'         => 'logo.png', // Path to Water mark image
62
-			'marginRight'    => 5,          // Margin right pixel
63
-			'marginBottom'   => 5,          // Margin bottom pixel
64
-			'quality'        => 95,         // JPEG image save quality
65
-			'transparency'   => 70,         // Water mark image transparency ( other than PNG )
66
-			'targetType'     => IMG_GIF|IMG_JPG|IMG_PNG|IMG_WBMP, // Target image formats ( bit-field )
62
+			'marginRight'    => 5, // Margin right pixel
63
+			'marginBottom'   => 5, // Margin bottom pixel
64
+			'quality'        => 95, // JPEG image save quality
65
+			'transparency'   => 70, // Water mark image transparency ( other than PNG )
66
+			'targetType'     => IMG_GIF | IMG_JPG | IMG_PNG | IMG_WBMP, // Target image formats ( bit-field )
67 67
 			'targetMinPixel' => 200         // Target image minimum pixel size
68 68
 		);
69 69
 
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
 			$opts = array_merge($this->opts, $volOpts);
80 80
 		}
81 81
 		
82
-		if (! $opts['enable']) {
82
+		if (!$opts['enable']) {
83 83
 			return false;
84 84
 		}
85 85
 		
@@ -94,12 +94,12 @@  discard block
 block discarded – undo
94 94
 		}
95 95
 		
96 96
 		// check water mark image
97
-		if (! file_exists($opts['source'])) {
98
-			$opts['source'] = dirname(__FILE__) . "/" . $opts['source'];
97
+		if (!file_exists($opts['source'])) {
98
+			$opts['source'] = dirname(__FILE__)."/".$opts['source'];
99 99
 		}
100 100
 		if (is_readable($opts['source'])) {
101 101
 			$watermarkImgInfo = @getimagesize($opts['source']);
102
-			if (! $watermarkImgInfo) {
102
+			if (!$watermarkImgInfo) {
103 103
 				return false;
104 104
 			}
105 105
 		} else {
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
 			IMAGETYPE_PNG => IMG_PNG,
120 120
 			IMAGETYPE_WBMP => IMG_WBMP,
121 121
 		);
122
-		if (! ($opts['targetType'] & $imgTypes[$srcImgInfo[2]])) {
122
+		if (!($opts['targetType'] & $imgTypes[$srcImgInfo[2]])) {
123 123
 			return false;
124 124
 		}
125 125
 		
@@ -192,14 +192,14 @@  discard block
 block discarded – undo
192 192
 				break;
193 193
 			case 'image/jpeg':
194 194
 				if (@imagetypes() & IMG_JPG) {
195
-					$oWatermarkImg = @imagecreatefromjpeg($watermark) ;
195
+					$oWatermarkImg = @imagecreatefromjpeg($watermark);
196 196
 				} else {
197 197
 					$ermsg = 'JPEG images are not supported';
198 198
 				}
199 199
 				break;
200 200
 			case 'image/png':
201 201
 				if (@imagetypes() & IMG_PNG) {
202
-					$oWatermarkImg = @imagecreatefrompng($watermark) ;
202
+					$oWatermarkImg = @imagecreatefrompng($watermark);
203 203
 				} else {
204 204
 					$ermsg = 'PNG images are not supported';
205 205
 				}
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
 				break;
218 218
 		}
219 219
 		
220
-		if (! $ermsg) {
220
+		if (!$ermsg) {
221 221
 			switch ($srcImgInfo['mime']) {
222 222
 				case 'image/gif':
223 223
 					if (@imagetypes() & IMG_GIF) {
@@ -228,14 +228,14 @@  discard block
 block discarded – undo
228 228
 					break;
229 229
 				case 'image/jpeg':
230 230
 					if (@imagetypes() & IMG_JPG) {
231
-						$oSrcImg = @imagecreatefromjpeg($src) ;
231
+						$oSrcImg = @imagecreatefromjpeg($src);
232 232
 					} else {
233 233
 						$ermsg = 'JPEG images are not supported';
234 234
 					}
235 235
 					break;
236 236
 				case 'image/png':
237 237
 					if (@imagetypes() & IMG_PNG) {
238
-						$oSrcImg = @imagecreatefrompng($src) ;
238
+						$oSrcImg = @imagecreatefrompng($src);
239 239
 					} else {
240 240
 						$ermsg = 'PNG images are not supported';
241 241
 					}
@@ -261,7 +261,7 @@  discard block
 block discarded – undo
261 261
 		if ($srcImgInfo['mime'] === 'image/png') {
262 262
 			if (function_exists('imagecolorallocatealpha')) {
263 263
 				$bg = imagecolorallocatealpha($oSrcImg, 255, 255, 255, 127);
264
-				imagefill($oSrcImg, 0, 0 , $bg);
264
+				imagefill($oSrcImg, 0, 0, $bg);
265 265
 			}
266 266
 		}
267 267
 		
Please login to merge, or discard this patch.
php/plugins/Sanitizer/plugin.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -49,8 +49,8 @@  discard block
 block discarded – undo
49 49
 	
50 50
 	public function __construct($opts) {
51 51
 		$defaults = array(
52
-			'enable'   => true,  // For control by volume driver
53
-			'targets'  => array('\\','/',':','*','?','"','<','>','|'), // target chars
52
+			'enable'   => true, // For control by volume driver
53
+			'targets'  => array('\\', '/', ':', '*', '?', '"', '<', '>', '|'), // target chars
54 54
 			'replace'  => '_'    // replace to this
55 55
 		);
56 56
 	
@@ -59,13 +59,13 @@  discard block
 block discarded – undo
59 59
 	
60 60
 	public function cmdPreprocess($cmd, &$args, $elfinder, $volume) {
61 61
 		$opts = $this->getOpts($volume);
62
-		if (! $opts['enable']) {
62
+		if (!$opts['enable']) {
63 63
 			return false;
64 64
 		}
65 65
 	
66 66
 		if (isset($args['name'])) {
67 67
 			if (is_array($args['name'])) {
68
-				foreach($args['name'] as $i => $name) {
68
+				foreach ($args['name'] as $i => $name) {
69 69
 					$args['name'][$i] = $this->sanitizeFileName($name, $opts);
70 70
 				}
71 71
 			} else {
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
 
78 78
 	public function onUpLoadPreSave(&$path, &$name, $src, $elfinder, $volume) {
79 79
 		$opts = $this->getOpts($volume);
80
-		if (! $opts['enable']) {
80
+		if (!$opts['enable']) {
81 81
 			return false;
82 82
 		}
83 83
 	
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
 	}
101 101
 	
102 102
 	private function sanitizeFileName($filename, $opts, $allows = array()) {
103
-		$targets = $allows? array_diff($opts['targets'], $allows) : $opts['targets'];
103
+		$targets = $allows ? array_diff($opts['targets'], $allows) : $opts['targets'];
104 104
 		return str_replace($targets, $opts['replace'], $filename);
105 105
   	}
106 106
 }
Please login to merge, or discard this patch.
php/plugins/Normalizer/plugin.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -58,9 +58,9 @@  discard block
 block discarded – undo
58 58
 	
59 59
 	public function __construct($opts) {
60 60
 		$defaults = array(
61
-			'enable'    => true,  // For control by volume driver
62
-			'nfc'       => true,  // Canonical Decomposition followed by Canonical Composition
63
-			'nfkc'      => true,  // Compatibility Decomposition followed by Canonical
61
+			'enable'    => true, // For control by volume driver
62
+			'nfc'       => true, // Canonical Decomposition followed by Canonical Composition
63
+			'nfkc'      => true, // Compatibility Decomposition followed by Canonical
64 64
 			'lowercase' => false, // Make chars lowercase
65 65
 			'convmap'   => array()// Convert map ('FROM' => 'TO') array
66 66
 		);
@@ -70,13 +70,13 @@  discard block
 block discarded – undo
70 70
 	
71 71
 	public function cmdPreprocess($cmd, &$args, $elfinder, $volume) {
72 72
 		$opts = $this->getOpts($volume);
73
-		if (! $opts['enable']) {
73
+		if (!$opts['enable']) {
74 74
 			return false;
75 75
 		}
76 76
 		
77 77
 		if (isset($args['name'])) {
78 78
 			if (is_array($args['name'])) {
79
-				foreach($args['name'] as $i => $name) {
79
+				foreach ($args['name'] as $i => $name) {
80 80
 					$args['name'][$i] = $this->normalize($name, $opts);
81 81
 				}
82 82
 			} else {
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
 	
89 89
 	public function onUpLoadPreSave(&$path, &$name, $src, $elfinder, $volume) {
90 90
 		$opts = $this->getOpts($volume);
91
-		if (! $opts['enable']) {
91
+		if (!$opts['enable']) {
92 92
 			return false;
93 93
 		}
94 94
 		
@@ -113,12 +113,12 @@  discard block
 block discarded – undo
113 113
 	private function normalize($str, $opts) {
114 114
 		if ($opts['nfc'] || $opts['nfkc']) {
115 115
 			if (class_exists('Normalizer', false)) {
116
-				if ($opts['nfc'] && ! Normalizer::isNormalized($str, Normalizer::FORM_C))
116
+				if ($opts['nfc'] && !Normalizer::isNormalized($str, Normalizer::FORM_C))
117 117
 					$str = Normalizer::normalize($str, Normalizer::FORM_C);
118
-				if ($opts['nfkc'] && ! Normalizer::isNormalized($str, Normalizer::FORM_KC))
118
+				if ($opts['nfkc'] && !Normalizer::isNormalized($str, Normalizer::FORM_KC))
119 119
 					$str = Normalizer::normalize($str, Normalizer::FORM_KC);
120 120
 			} else {
121
-				if (! class_exists('I18N_UnicodeNormalizer', false)) {
121
+				if (!class_exists('I18N_UnicodeNormalizer', false)) {
122 122
 					@ include_once 'I18N/UnicodeNormalizer.php';
123 123
 				}
124 124
 				if (class_exists('I18N_UnicodeNormalizer', false)) {
Please login to merge, or discard this patch.
php/plugins/AutoResize/plugin.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -52,12 +52,12 @@  discard block
 block discarded – undo
52 52
 
53 53
 	public function __construct($opts) {
54 54
 		$defaults = array(
55
-			'enable'         => true,       // For control by volume driver
56
-			'maxWidth'       => 1024,       // Path to Water mark image
57
-			'maxHeight'      => 1024,       // Margin right pixel
58
-			'quality'        => 95,         // JPEG image save quality
59
-			'preserveExif'   => false,      // Preserve EXIF data (Imagick only)
60
-			'targetType'     => IMG_GIF|IMG_JPG|IMG_PNG|IMG_WBMP // Target image formats ( bit-field )
55
+			'enable'         => true, // For control by volume driver
56
+			'maxWidth'       => 1024, // Path to Water mark image
57
+			'maxHeight'      => 1024, // Margin right pixel
58
+			'quality'        => 95, // JPEG image save quality
59
+			'preserveExif'   => false, // Preserve EXIF data (Imagick only)
60
+			'targetType'     => IMG_GIF | IMG_JPG | IMG_PNG | IMG_WBMP // Target image formats ( bit-field )
61 61
 		);
62 62
 
63 63
 		$this->opts = array_merge($defaults, $opts);
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
 			$opts = array_merge($this->opts, $volOpts);
72 72
 		}
73 73
 		
74
-		if (! $opts['enable']) {
74
+		if (!$opts['enable']) {
75 75
 			return false;
76 76
 		}
77 77
 		
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
 				IMAGETYPE_PNG => IMG_PNG,
88 88
 				IMAGETYPE_WBMP => IMG_WBMP,
89 89
 		);
90
-		if (! ($opts['targetType'] & $imgTypes[$srcImgInfo[2]])) {
90
+		if (!($opts['targetType'] & $imgTypes[$srcImgInfo[2]])) {
91 91
 			return false;
92 92
 		}
93 93
 		
@@ -99,9 +99,9 @@  discard block
 block discarded – undo
99 99
 	}
100 100
 	
101 101
 	private function resize($src, $srcImgInfo, $maxWidth, $maxHeight, $quality, $preserveExif) {
102
-		$zoom = min(($maxWidth/$srcImgInfo[0]),($maxHeight/$srcImgInfo[1]));
103
-		$width = round($srcImgInfo[0] * $zoom);
104
-		$height = round($srcImgInfo[1] * $zoom);
102
+		$zoom = min(($maxWidth/$srcImgInfo[0]), ($maxHeight/$srcImgInfo[1]));
103
+		$width = round($srcImgInfo[0]*$zoom);
104
+		$height = round($srcImgInfo[1]*$zoom);
105 105
 		
106 106
 		if (class_exists('Imagick', false)) {
107 107
 			return $this->resize_imagick($src, $width, $height, $quality, $preserveExif);
@@ -121,14 +121,14 @@  discard block
 block discarded – undo
121 121
 				break;
122 122
 			case 'image/jpeg':
123 123
 				if (@imagetypes() & IMG_JPG) {
124
-					$oSrcImg = @imagecreatefromjpeg($src) ;
124
+					$oSrcImg = @imagecreatefromjpeg($src);
125 125
 				} else {
126 126
 					$ermsg = 'JPEG images are not supported';
127 127
 				}
128 128
 				break;
129 129
 			case 'image/png':
130 130
 				if (@imagetypes() & IMG_PNG) {
131
-					$oSrcImg = @imagecreatefrompng($src) ;
131
+					$oSrcImg = @imagecreatefrompng($src);
132 132
 				} else {
133 133
 					$ermsg = 'PNG images are not supported';
134 134
 				}
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
 				break;
147 147
 		}
148 148
 		
149
-		if ($oSrcImg &&  false != ($tmp = imagecreatetruecolor($width, $height))) {
149
+		if ($oSrcImg && false != ($tmp = imagecreatetruecolor($width, $height))) {
150 150
 			
151 151
 			if (!imagecopyresampled($tmp, $oSrcImg, 0, 0, 0, 0, $width, $height, $srcImgInfo[0], $srcImgInfo[1])) {
152 152
 				return false;
Please login to merge, or discard this patch.
php/elFinderVolumeDriver.class.php 1 patch
Spacing   +138 added lines, -139 removed lines patch added patch discarded remove patch
@@ -298,7 +298,7 @@  discard block
 block discarded – undo
298 298
 		'utf8fix'      => false,
299 299
 		 //                           й                 ё              Й               Ё              Ø         Å
300 300
 		'utf8patterns' => array("\u0438\u0306", "\u0435\u0308", "\u0418\u0306", "\u0415\u0308", "\u00d8A", "\u030a"),
301
-		'utf8replace'  => array("\u0439",        "\u0451",       "\u0419",       "\u0401",       "\u00d8", "\u00c5")
301
+		'utf8replace'  => array("\u0439", "\u0451", "\u0419", "\u0401", "\u00d8", "\u00c5")
302 302
 	);
303 303
 
304 304
 	/**
@@ -593,7 +593,7 @@  discard block
 block discarded – undo
593 593
 	 **/
594 594
 	protected function configure() {
595 595
 		// set ARGS
596
-		$this->ARGS = $_SERVER['REQUEST_METHOD'] === 'POST'? $_POST : $_GET;
596
+		$this->ARGS = $_SERVER['REQUEST_METHOD'] === 'POST' ? $_POST : $_GET;
597 597
 		// set thumbnails path
598 598
 		$path = $this->options['tmbPath'];
599 599
 		if ($path) {
@@ -624,7 +624,7 @@  discard block
 block discarded – undo
624 624
 		
625 625
 		// check 'statOwner' for command `chmod`
626 626
 		if (empty($this->options['statOwner'])) {
627
-			$this->disabled[] ='chmod';
627
+			$this->disabled[] = 'chmod';
628 628
 		}
629 629
 		
630 630
 		// check 'mimeMap'
@@ -748,7 +748,7 @@  discard block
 block discarded – undo
748 748
 	 **/
749 749
 	public function mount(array $opts) {
750 750
 		if (!isset($opts['path']) || $opts['path'] === '') {
751
-			return $this->setError('Path undefined.');;
751
+			return $this->setError('Path undefined.'); ;
752 752
 		}
753 753
 		
754 754
 		$this->options = array_merge($this->options, $opts);
@@ -767,14 +767,14 @@  discard block
 block discarded – undo
767 767
 		$argInit = !empty($this->ARGS['init']);
768 768
 		
769 769
 		// session cache
770
-		if ($argInit || ! isset($_SESSION[elFinder::$sessionCacheKey][$this->id])) {
770
+		if ($argInit || !isset($_SESSION[elFinder::$sessionCacheKey][$this->id])) {
771 771
 			$_SESSION[elFinder::$sessionCacheKey][$this->id] = array();
772 772
 		}
773 773
 		$this->sessionCache = &$_SESSION[elFinder::$sessionCacheKey][$this->id];
774 774
 		
775 775
 		// default file attribute
776 776
 		$this->defaults = array(
777
-			'read'    => isset($this->options['defaults']['read'])  ? !!$this->options['defaults']['read']  : true,
777
+			'read'    => isset($this->options['defaults']['read']) ? !!$this->options['defaults']['read'] : true,
778 778
 			'write'   => isset($this->options['defaults']['write']) ? !!$this->options['defaults']['write'] : true,
779 779
 			'locked'  => isset($this->options['defaults']['locked']) ? !!$this->options['defaults']['locked'] : false,
780 780
 			'hidden'  => isset($this->options['defaults']['hidden']) ? !!$this->options['defaults']['hidden'] : false
@@ -801,8 +801,8 @@  discard block
 block discarded – undo
801 801
 			$this->access = $this->options['accessControl'];
802 802
 		}
803 803
 		
804
-		$this->today     = mktime(0,0,0, date('m'), date('d'), date('Y'));
805
-		$this->yesterday = $this->today-86400;
804
+		$this->today     = mktime(0, 0, 0, date('m'), date('d'), date('Y'));
805
+		$this->yesterday = $this->today - 86400;
806 806
 		
807 807
 		// debug($this->attributes);
808 808
 		if (!$this->init()) {
@@ -901,7 +901,7 @@  discard block
 block discarded – undo
901 901
 				foreach ($mimecf as $line_num => $line) {
902 902
 					if (!preg_match('/^\s*#/', $line)) {
903 903
 						$mime = preg_split('/\s+/', $line, -1, PREG_SPLIT_NO_EMPTY);
904
-						for ($i = 1, $size = count($mime); $i < $size ; $i++) {
904
+						for ($i = 1, $size = count($mime); $i < $size; $i++) {
905 905
 							if (!isset(self::$mimetypes[$mime[$i]])) {
906 906
 								self::$mimetypes[$mime[$i]] = $mime[0];
907 907
 							}
@@ -930,7 +930,7 @@  discard block
 block discarded – undo
930 930
 		
931 931
 		if ($root['read']) {
932 932
 			// check startPath - path to open by default instead of root
933
-			$startPath = $this->options['startPath']? $this->normpathCE($this->options['startPath']) : '';
933
+			$startPath = $this->options['startPath'] ? $this->normpathCE($this->options['startPath']) : '';
934 934
 			if ($startPath) {
935 935
 				$start = $this->stat($startPath);
936 936
 				if (!empty($start)
@@ -954,8 +954,8 @@  discard block
 block discarded – undo
954 954
 				'read'    => false
955 955
 			));
956 956
 		}
957
-		$this->treeDeep = $this->options['treeDeep'] > 0 ? (int)$this->options['treeDeep'] : 1;
958
-		$this->tmbSize  = $this->options['tmbSize'] > 0 ? (int)$this->options['tmbSize'] : 48;
957
+		$this->treeDeep = $this->options['treeDeep'] > 0 ? (int) $this->options['treeDeep'] : 1;
958
+		$this->tmbSize  = $this->options['tmbSize'] > 0 ? (int) $this->options['tmbSize'] : 48;
959 959
 		$this->URL      = $this->options['URL'];
960 960
 		if ($this->URL && preg_match("|[^/?&=]$|", $this->URL)) {
961 961
 			$this->URL .= '/';
@@ -1008,7 +1008,7 @@  discard block
 block discarded – undo
1008 1008
 		$this->configure();
1009 1009
 		
1010 1010
 		// fix sync interval
1011
-		$options['syncMinMs'] = max($options[$this->options['syncChkAsTs']? 'tsPlSleep' : 'lsPlSleep'] * 1000, intval($options['syncMinMs']));
1011
+		$options['syncMinMs'] = max($options[$this->options['syncChkAsTs'] ? 'tsPlSleep' : 'lsPlSleep']*1000, intval($options['syncMinMs']));
1012 1012
 
1013 1013
 		return $this->mounted = true;
1014 1014
 	}
@@ -1111,7 +1111,7 @@  discard block
 block discarded – undo
1111 1111
 	public function options($hash) {
1112 1112
 		$create = $createext = array();
1113 1113
 		if (isset($this->archivers['create']) && is_array($this->archivers['create'])) {
1114
-			foreach($this->archivers['create'] as $m => $v) {
1114
+			foreach ($this->archivers['create'] as $m => $v) {
1115 1115
 				$create[] = $m;
1116 1116
 				$createext[$m] = $v['ext'];
1117 1117
 			}
@@ -1132,7 +1132,7 @@  discard block
 block discarded – undo
1132 1132
 				'extract'   => isset($this->archivers['extract']) && is_array($this->archivers['extract']) ? array_keys($this->archivers['extract']) : array(),
1133 1133
 				'createext' => $createext
1134 1134
 			),
1135
-			'uiCmdMap'        => (isset($this->options['uiCmdMap']) && is_array($this->options['uiCmdMap']))? $this->options['uiCmdMap'] : array(),
1135
+			'uiCmdMap'        => (isset($this->options['uiCmdMap']) && is_array($this->options['uiCmdMap'])) ? $this->options['uiCmdMap'] : array(),
1136 1136
 			'syncChkAsTs'     => intval($this->options['syncChkAsTs']),
1137 1137
 			'syncMinMs'       => intval($this->options['syncMinMs'])
1138 1138
 		);
@@ -1146,7 +1146,7 @@  discard block
 block discarded – undo
1146 1146
 	 * @author Naoki Sawada
1147 1147
 	 */
1148 1148
 	public function getOption($name) {
1149
-		return isset($this->options[$name])? $this->options[$name] : null;
1149
+		return isset($this->options[$name]) ? $this->options[$name] : null;
1150 1150
 	}
1151 1151
 	
1152 1152
 	/**
@@ -1158,7 +1158,7 @@  discard block
 block discarded – undo
1158 1158
 	 */
1159 1159
 	public function getOptionsPlugin($name = '') {
1160 1160
 		if ($name) {
1161
-			return isset($this->options['plugin'][$name])? $this->options['plugin'][$name] : array();
1161
+			return isset($this->options['plugin'][$name]) ? $this->options['plugin'][$name] : array();
1162 1162
 		} else {
1163 1163
 			return $this->options['plugin'];
1164 1164
 		}
@@ -1292,7 +1292,7 @@  discard block
 block discarded – undo
1292 1292
 		$file = $this->stat($path);
1293 1293
 		
1294 1294
 		if ($isRoot) {
1295
-			$file['uiCmdMap'] = (isset($this->options['uiCmdMap']) && is_array($this->options['uiCmdMap']))? $this->options['uiCmdMap'] : array();
1295
+			$file['uiCmdMap'] = (isset($this->options['uiCmdMap']) && is_array($this->options['uiCmdMap'])) ? $this->options['uiCmdMap'] : array();
1296 1296
 			$file['disabled'] = array_merge(array_unique($this->disabled)); // `array_merge` for type array of JSON
1297 1297
 		}
1298 1298
 		
@@ -1307,7 +1307,7 @@  discard block
 block discarded – undo
1307 1307
 	 * @return array|false
1308 1308
 	 * @author Dmitry (dio) Levashov
1309 1309
 	 **/
1310
-	public function dir($hash, $resolveLink=false) {
1310
+	public function dir($hash, $resolveLink = false) {
1311 1311
 		if (($dir = $this->file($hash)) == false) {
1312 1312
 			return $this->setError(elFinder::ERROR_DIR_NOT_FOUND);
1313 1313
 		}
@@ -1371,14 +1371,14 @@  discard block
 block discarded – undo
1371 1371
 	 * @return array|false
1372 1372
 	 * @author Dmitry (dio) Levashov
1373 1373
 	 **/
1374
-	public function tree($hash='', $deep=0, $exclude='') {
1374
+	public function tree($hash = '', $deep = 0, $exclude = '') {
1375 1375
 		$path = $hash ? $this->decode($hash) : $this->root;
1376 1376
 		
1377 1377
 		if (($dir = $this->stat($path)) == false || $dir['mime'] != 'directory') {
1378 1378
 			return false;
1379 1379
 		}
1380 1380
 		
1381
-		$dirs = $this->gettree($path, $deep > 0 ? $deep -1 : $this->treeDeep-1, $exclude ? $this->decode($exclude) : null);
1381
+		$dirs = $this->gettree($path, $deep > 0 ? $deep - 1 : $this->treeDeep - 1, $exclude ? $this->decode($exclude) : null);
1382 1382
 		array_unshift($dirs, $dir);
1383 1383
 		return $dirs;
1384 1384
 	}
@@ -1608,7 +1608,7 @@  discard block
 block discarded – undo
1608 1608
 	 * @return array|false
1609 1609
 	 * @author Dmitry (dio) Levashov
1610 1610
 	 **/
1611
-	public function duplicate($hash, $suffix='copy') {
1611
+	public function duplicate($hash, $suffix = 'copy') {
1612 1612
 		if ($this->commandDisabled('duplicate')) {
1613 1613
 			return $this->setError(elFinder::ERROR_COPY, '#'.$hash, elFinder::ERROR_PERM_DENIED);
1614 1614
 		}
@@ -1684,7 +1684,7 @@  discard block
 block discarded – undo
1684 1684
 		
1685 1685
 		if ($file) { // file exists
1686 1686
 			// check POST data `overwrite` for 3rd party uploader
1687
-			$overwrite = isset($_POST['overwrite'])? (bool)$_POST['overwrite'] : $this->options['uploadOverwrite'];
1687
+			$overwrite = isset($_POST['overwrite']) ? (bool) $_POST['overwrite'] : $this->options['uploadOverwrite'];
1688 1688
 			if ($overwrite) {
1689 1689
 				if (!$file['write']) {
1690 1690
 					return $this->setError(elFinder::ERROR_PERM_DENIED);
@@ -1755,7 +1755,7 @@  discard block
 block discarded – undo
1755 1755
 		if (($test = $volume->closest($src, $rmSrc ? 'locked' : 'read', $rmSrc))) {
1756 1756
 			return $rmSrc
1757 1757
 				? $this->setError($err, $errpath, elFinder::ERROR_LOCKED, $volume->path($test))
1758
-				: $this->setError($err, $errpath, !empty($file['thash'])? elFinder::ERROR_PERM_DENIED : elFinder::ERROR_MKOUTLINK);
1758
+				: $this->setError($err, $errpath, !empty($file['thash']) ? elFinder::ERROR_PERM_DENIED : elFinder::ERROR_MKOUTLINK);
1759 1759
 		}
1760 1760
 
1761 1761
 		$test = $this->joinPathCE($destination, $name);
@@ -1918,7 +1918,7 @@  discard block
 block discarded – undo
1918 1918
 			return $this->setError(elFinder::ERROR_PERM_DENIED);
1919 1919
 		}
1920 1920
 		$this->clearcache();
1921
-		$this->extractToNewdir = is_null($makedir)? 'auto' : (bool)$makedir;
1921
+		$this->extractToNewdir = is_null($makedir) ? 'auto' : (bool) $makedir;
1922 1922
 		
1923 1923
 		if ($path = $this->convEncOut($this->_extract($this->convEncIn($path), $archiver))) {
1924 1924
 			if (is_array($path)) {
@@ -1976,9 +1976,9 @@  discard block
 block discarded – undo
1976 1976
 		if ($name === '') {
1977 1977
 			$name = count($files) == 1 ? $files[0] : 'Archive';
1978 1978
 		} else {
1979
-			$name = str_replace(array('/', '\\'), '_', preg_replace('/\.' . preg_quote($archiver['ext'], '/') . '$/i', '', $name));
1979
+			$name = str_replace(array('/', '\\'), '_', preg_replace('/\.'.preg_quote($archiver['ext'], '/').'$/i', '', $name));
1980 1980
 		}
1981
-		$name .='.' . $archiver['ext'];
1981
+		$name .= '.'.$archiver['ext'];
1982 1982
 		$name = $this->uniqueName($dir, $name, '');
1983 1983
 		$this->clearcache();
1984 1984
 		return ($path = $this->convEncOut($this->_archive($this->convEncIn($dir), $this->convEncIn($files), $this->convEncIn($name), $archiver))) ? $this->stat($path) : false;
@@ -2017,7 +2017,7 @@  discard block
 block discarded – undo
2017 2017
 		
2018 2018
 		$path = $this->decode($hash);
2019 2019
 		
2020
-		$work_path = $this->getWorkFile($this->encoding? $this->convEncIn($path, true) : $path);
2020
+		$work_path = $this->getWorkFile($this->encoding ? $this->convEncIn($path, true) : $path);
2021 2021
 
2022 2022
 		if (!$work_path || !is_writable($work_path)) {
2023 2023
 			if ($work_path && $path !== $work_path && is_file($work_path)) {
@@ -2032,7 +2032,7 @@  discard block
 block discarded – undo
2032 2032
 			}
2033 2033
 		}
2034 2034
 
2035
-		switch($mode) {
2035
+		switch ($mode) {
2036 2036
 			
2037 2037
 			case 'propresize':
2038 2038
 				$result = $this->imgResize($work_path, $width, $height, true, true, null, $jpgQuality);
@@ -2128,7 +2128,7 @@  discard block
 block discarded – undo
2128 2128
 		}
2129 2129
 		return ($q === '' || $this->commandDisabled('search'))
2130 2130
 			? array()
2131
-			: $this->doSearch(is_null($dir)? $this->root : $dir, $q, $mimes);
2131
+			: $this->doSearch(is_null($dir) ? $this->root : $dir, $q, $mimes);
2132 2132
 	}
2133 2133
 	
2134 2134
 	/**
@@ -2200,9 +2200,9 @@  discard block
 block discarded – undo
2200 2200
 		$path = ltrim($path, $this->separator);
2201 2201
 		$dirs = explode($this->separator, $path);
2202 2202
 		array_pop($dirs);
2203
-		foreach($dirs as $dir) {
2203
+		foreach ($dirs as $dir) {
2204 2204
 			$targetPath = $this->joinPathCE($base, $dir);
2205
-			if (! $_realpath = $this->realpath($this->encode($targetPath))) {
2205
+			if (!$_realpath = $this->realpath($this->encode($targetPath))) {
2206 2206
 				if ($stat = $this->mkdir($targetHash, $dir)) {
2207 2207
 					$result['added'][] = $stat;
2208 2208
 					$targetHash = $stat['hash'];
@@ -2269,7 +2269,7 @@  discard block
 block discarded – undo
2269 2269
 	 * @author Naoki Sawada
2270 2270
 	 **/
2271 2271
 	protected function dirnameCE($path) {
2272
-		return (!$this->encoding)? $this->_dirname($path) :	$this->convEncOut($this->_dirname($this->convEncIn($path)));
2272
+		return (!$this->encoding) ? $this->_dirname($path) : $this->convEncOut($this->_dirname($this->convEncIn($path)));
2273 2273
 	}
2274 2274
 	
2275 2275
 	/**
@@ -2280,7 +2280,7 @@  discard block
 block discarded – undo
2280 2280
 	 * @author Naoki Sawada
2281 2281
 	 **/
2282 2282
 	protected function basenameCE($path) {
2283
-		return (!$this->encoding)? $this->_basename($path) : $this->convEncOut($this->_basename($this->convEncIn($path)));
2283
+		return (!$this->encoding) ? $this->_basename($path) : $this->convEncOut($this->_basename($this->convEncIn($path)));
2284 2284
 	}
2285 2285
 	
2286 2286
 	/**
@@ -2293,7 +2293,7 @@  discard block
 block discarded – undo
2293 2293
 	 * @author Naoki Sawada
2294 2294
 	 **/
2295 2295
 	protected function joinPathCE($dir, $name) {
2296
-		return (!$this->encoding)? $this->_joinPath($dir, $name) : $this->convEncOut($this->_joinPath($this->convEncIn($dir), $this->convEncIn($name)));
2296
+		return (!$this->encoding) ? $this->_joinPath($dir, $name) : $this->convEncOut($this->_joinPath($this->convEncIn($dir), $this->convEncIn($name)));
2297 2297
 	}
2298 2298
 	
2299 2299
 	/**
@@ -2304,7 +2304,7 @@  discard block
 block discarded – undo
2304 2304
 	 * @author Naoki Sawada
2305 2305
 	 **/
2306 2306
 	protected function normpathCE($path) {
2307
-		return (!$this->encoding)? $this->_normpath($path) : $this->convEncOut($this->_normpath($this->convEncIn($path)));
2307
+		return (!$this->encoding) ? $this->_normpath($path) : $this->convEncOut($this->_normpath($this->convEncIn($path)));
2308 2308
 	}
2309 2309
 	
2310 2310
 	/**
@@ -2315,7 +2315,7 @@  discard block
 block discarded – undo
2315 2315
 	 * @author Naoki Sawada
2316 2316
 	 **/
2317 2317
 	protected function relpathCE($path) {
2318
-		return (!$this->encoding)? $this->_relpath($path) : $this->convEncOut($this->_relpath($this->convEncIn($path)));
2318
+		return (!$this->encoding) ? $this->_relpath($path) : $this->convEncOut($this->_relpath($this->convEncIn($path)));
2319 2319
 	}
2320 2320
 	
2321 2321
 	/**
@@ -2326,7 +2326,7 @@  discard block
 block discarded – undo
2326 2326
 	 * @author Naoki Sawada
2327 2327
 	 **/
2328 2328
 	protected function abspathCE($path) {
2329
-		return (!$this->encoding)? $this->_abspath($path): $this->convEncOut($this->_abspath($this->convEncIn($path)));
2329
+		return (!$this->encoding) ? $this->_abspath($path) : $this->convEncOut($this->_abspath($this->convEncIn($path)));
2330 2330
 	}
2331 2331
 	
2332 2332
 	/**
@@ -2338,7 +2338,7 @@  discard block
 block discarded – undo
2338 2338
 	 * @author Naoki Sawada
2339 2339
 	 **/
2340 2340
 	protected function inpathCE($path, $parent) {
2341
-		return (!$this->encoding)? $this->_inpath($path, $parent) : $this->convEncOut($this->_inpath($this->convEncIn($path), $this->convEncIn($parent)));
2341
+		return (!$this->encoding) ? $this->_inpath($path, $parent) : $this->convEncOut($this->_inpath($this->convEncIn($path), $this->convEncIn($parent)));
2342 2342
 	}
2343 2343
 	
2344 2344
 	/**
@@ -2349,8 +2349,8 @@  discard block
 block discarded – undo
2349 2349
 	 * @return resource|false
2350 2350
 	 * @author Naoki Sawada
2351 2351
 	 **/
2352
-	protected function fopenCE($path, $mode='rb') {
2353
-		return (!$this->encoding)? $this->_fopen($path, $mode) : $this->convEncOut($this->_fopen($this->convEncIn($path), $mode));
2352
+	protected function fopenCE($path, $mode = 'rb') {
2353
+		return (!$this->encoding) ? $this->_fopen($path, $mode) : $this->convEncOut($this->_fopen($this->convEncIn($path), $mode));
2354 2354
 	}
2355 2355
 	
2356 2356
 	/**
@@ -2361,8 +2361,8 @@  discard block
 block discarded – undo
2361 2361
 	 * @return bool
2362 2362
 	 * @author Naoki Sawada
2363 2363
 	 **/
2364
-	protected function fcloseCE($fp, $path='') {
2365
-		return (!$this->encoding)? $this->_fclose($fp, $path) : $this->convEncOut($this->_fclose($fp, $this->convEncIn($path)));
2364
+	protected function fcloseCE($fp, $path = '') {
2365
+		return (!$this->encoding) ? $this->_fclose($fp, $path) : $this->convEncOut($this->_fclose($fp, $this->convEncIn($path)));
2366 2366
 	}
2367 2367
 	
2368 2368
 	/**
@@ -2377,7 +2377,7 @@  discard block
 block discarded – undo
2377 2377
 	 * @author Naoki Sawada
2378 2378
 	 **/
2379 2379
 	protected function saveCE($fp, $dir, $name, $stat) {
2380
-		return (!$this->encoding)? $this->_save($fp, $dir, $name, $stat) : $this->convEncOut($this->_save($fp, $this->convEncIn($dir), $this->convEncIn($name), $this->convEncIn($stat)));
2380
+		return (!$this->encoding) ? $this->_save($fp, $dir, $name, $stat) : $this->convEncOut($this->_save($fp, $this->convEncIn($dir), $this->convEncIn($name), $this->convEncIn($stat)));
2381 2381
 	}
2382 2382
 	
2383 2383
 	/**
@@ -2389,7 +2389,7 @@  discard block
 block discarded – undo
2389 2389
 	 **/
2390 2390
 	protected function subdirsCE($path) {
2391 2391
 		if (!isset($this->subdirsCache[$path])) {
2392
-			$this->subdirsCache[$path] = (!$this->encoding)? $this->_subdirs($path) : $this->convEncOut($this->_subdirs($this->convEncIn($path)));
2392
+			$this->subdirsCache[$path] = (!$this->encoding) ? $this->_subdirs($path) : $this->convEncOut($this->_subdirs($this->convEncIn($path)));
2393 2393
 		}
2394 2394
 		return $this->subdirsCache[$path];
2395 2395
 	}
@@ -2402,7 +2402,7 @@  discard block
 block discarded – undo
2402 2402
 	 * @author Naoki Sawada
2403 2403
 	 **/
2404 2404
 	protected function scandirCE($path) {
2405
-		return (!$this->encoding)? $this->_scandir($path) : $this->convEncOut($this->_scandir($this->convEncIn($path)));
2405
+		return (!$this->encoding) ? $this->_scandir($path) : $this->convEncOut($this->_scandir($this->convEncIn($path)));
2406 2406
 	}
2407 2407
 	
2408 2408
 	/**
@@ -2415,7 +2415,7 @@  discard block
 block discarded – undo
2415 2415
 	 * @author Naoki Sawada
2416 2416
 	 **/
2417 2417
 	protected function symlinkCE($source, $targetDir, $name) {
2418
-		return (!$this->encoding)? $this->_symlink($source, $targetDir, $name) : $this->convEncOut($this->_symlink($this->convEncIn($source), $this->convEncIn($targetDir), $this->convEncIn($name)));
2418
+		return (!$this->encoding) ? $this->_symlink($source, $targetDir, $name) : $this->convEncOut($this->_symlink($this->convEncIn($source), $this->convEncIn($targetDir), $this->convEncIn($name)));
2419 2419
 	}
2420 2420
 	
2421 2421
 	/***************** paths *******************/
@@ -2434,7 +2434,7 @@  discard block
 block discarded – undo
2434 2434
 			// cut ROOT from $path for security reason, even if hacker decodes the path he will not know the root
2435 2435
 			$p = $this->relpathCE($path);
2436 2436
 			// if reqesting root dir $path will be empty, then assign '/' as we cannot leave it blank for crypt
2437
-			if ($p === '')	{
2437
+			if ($p === '') {
2438 2438
 				$p = DIRECTORY_SEPARATOR;
2439 2439
 			}
2440 2440
 
@@ -2467,7 +2467,7 @@  discard block
 block discarded – undo
2467 2467
 			// TODO uncrypt hash and return path
2468 2468
 			$path = $this->uncrypt($h); 
2469 2469
 			// append ROOT to path after it was cut in encode
2470
-			return $this->abspathCE($path);//$this->root.($path == DIRECTORY_SEPARATOR ? '' : DIRECTORY_SEPARATOR.$path); 
2470
+			return $this->abspathCE($path); //$this->root.($path == DIRECTORY_SEPARATOR ? '' : DIRECTORY_SEPARATOR.$path); 
2471 2471
 		}
2472 2472
 	}
2473 2473
 	
@@ -2527,21 +2527,21 @@  discard block
 block discarded – undo
2527 2527
 	 * @author Dmitry (dio) Levashov
2528 2528
 	 **/
2529 2529
 	public function uniqueName($dir, $name, $suffix = ' copy', $checkNum = true, $start = 1) {
2530
-		$ext  = '';
2530
+		$ext = '';
2531 2531
 
2532 2532
 		if (preg_match('/\.((tar\.(gz|bz|bz2|z|lzo))|cpio\.gz|ps\.gz|xcf\.(gz|bz2)|[a-z0-9]{1,4})$/i', $name, $m)) {
2533 2533
 			$ext  = '.'.$m[1];
2534
-			$name = substr($name, 0,  strlen($name)-strlen($m[0]));
2534
+			$name = substr($name, 0, strlen($name) - strlen($m[0]));
2535 2535
 		} 
2536 2536
 		
2537 2537
 		if ($checkNum && preg_match('/('.preg_quote($suffix, '/').')(\d*)$/i', $name, $m)) {
2538
-			$i    = (int)$m[2];
2539
-			$name = substr($name, 0, strlen($name)-strlen($m[2]));
2538
+			$i    = (int) $m[2];
2539
+			$name = substr($name, 0, strlen($name) - strlen($m[2]));
2540 2540
 		} else {
2541 2541
 			$i     = $start;
2542 2542
 			$name .= $suffix;
2543 2543
 		}
2544
-		$max = $i+100000;
2544
+		$max = $i + 100000;
2545 2545
 
2546 2546
 		while ($i <= $max) {
2547 2547
 			$n = $name.($i > 0 ? $i : '').$ext;
@@ -2565,7 +2565,7 @@  discard block
 block discarded – undo
2565 2565
 	 * @author Naoki Sawada
2566 2566
 	 */
2567 2567
 	public function convEncIn($var = null, $restoreLocale = false, $unknown = '_') {
2568
-		return (!$this->encoding)? $var : $this->convEnc($var, 'UTF-8', $this->encoding, $this->options['locale'], $restoreLocale, $unknown);
2568
+		return (!$this->encoding) ? $var : $this->convEnc($var, 'UTF-8', $this->encoding, $this->options['locale'], $restoreLocale, $unknown);
2569 2569
 	}
2570 2570
 	
2571 2571
 	/**
@@ -2578,7 +2578,7 @@  discard block
 block discarded – undo
2578 2578
 	 * @author Naoki Sawada
2579 2579
 	 */
2580 2580
 	public function convEncOut($var = null, $restoreLocale = true, $unknown = '_') {
2581
-		return (!$this->encoding)? $var : $this->convEnc($var, $this->encoding, 'UTF-8', $this->options['locale'], $restoreLocale, $unknown);
2581
+		return (!$this->encoding) ? $var : $this->convEnc($var, $this->encoding, 'UTF-8', $this->options['locale'], $restoreLocale, $unknown);
2582 2582
 	}
2583 2583
 	
2584 2584
 	/**
@@ -2598,7 +2598,7 @@  discard block
 block discarded – undo
2598 2598
 			}
2599 2599
 			if (is_array($var)) {
2600 2600
 				$_ret = array();
2601
-				foreach($var as $_k => $_v) {
2601
+				foreach ($var as $_k => $_v) {
2602 2602
 					$_ret[$_k] = $this->convEnc($_v, $from, $to, '', false, $unknown = '_');
2603 2603
 				}
2604 2604
 				$var = $_ret;
@@ -2610,7 +2610,7 @@  discard block
 block discarded – undo
2610 2610
 						$_var = str_replace('?', $unknown, $_var);
2611 2611
 					}
2612 2612
 				}
2613
-				if  ($_var !== false) {
2613
+				if ($_var !== false) {
2614 2614
 					$var = $_var;
2615 2615
 				}
2616 2616
 			}
@@ -2637,7 +2637,7 @@  discard block
 block discarded – undo
2637 2637
 		
2638 2638
 		$key = '';
2639 2639
 		if ($path !== '') {
2640
-			$key = $this->id . '#' . $path;
2640
+			$key = $this->id.'#'.$path;
2641 2641
 			if (isset($cache[$key])) {
2642 2642
 				return $cache[$key];
2643 2643
 			}
@@ -2669,7 +2669,7 @@  discard block
 block discarded – undo
2669 2669
 		if ($work = $this->getTempFile()) {
2670 2670
 			if ($wfp = fopen($work, 'wb')) {
2671 2671
 				if ($fp = $this->_fopen($path)) {
2672
-					while(!feof($fp)) {
2672
+					while (!feof($fp)) {
2673 2673
 						fwrite($wfp, fread($fp, 8192));
2674 2674
 					}
2675 2675
 					$this->_fclose($fp, $path);
@@ -2713,7 +2713,7 @@  discard block
 block discarded – undo
2713 2713
 			@set_time_limit(30);
2714 2714
 			$stat = $this->stat($this->convEncOut($p));
2715 2715
 			$this->convEncIn();
2716
-			($stat['mime'] === 'directory')? $this->delTree($p) : $this->_unlink($p);
2716
+			($stat['mime'] === 'directory') ? $this->delTree($p) : $this->_unlink($p);
2717 2717
 		}
2718 2718
 		return $this->_rmdir($localpath);
2719 2719
 	}
@@ -2730,7 +2730,7 @@  discard block
 block discarded – undo
2730 2730
 	 * @return bool
2731 2731
 	 * @author Dmitry (dio) Levashov
2732 2732
 	 **/
2733
-	protected function attr($path, $name, $val=null, $isDir=null) {
2733
+	protected function attr($path, $name, $val = null, $isDir = null) {
2734 2734
 		if (!isset($this->defaults[$name])) {
2735 2735
 			return false;
2736 2736
 		}
@@ -2762,7 +2762,7 @@  discard block
 block discarded – undo
2762 2762
 			} 
2763 2763
 		}
2764 2764
 		
2765
-		return $perm === null ? (is_null($val)? $this->defaults[$name] : $val) : !!$perm;
2765
+		return $perm === null ? (is_null($val) ? $this->defaults[$name] : $val) : !!$perm;
2766 2766
 	}
2767 2767
 	
2768 2768
 	/**
@@ -2806,7 +2806,7 @@  discard block
 block discarded – undo
2806 2806
 	protected function allowPutMime($mime) {
2807 2807
 		// logic based on http://httpd.apache.org/docs/2.2/mod/mod_authz_host.html#order
2808 2808
 		$allow  = $this->mimeAccepted($mime, $this->uploadAllow, null);
2809
-		$deny   = $this->mimeAccepted($mime, $this->uploadDeny,  null);
2809
+		$deny   = $this->mimeAccepted($mime, $this->uploadDeny, null);
2810 2810
 		$res = true; // default to allow
2811 2811
 		if (strtolower($this->uploadOrder[0]) == 'allow') { // array('allow', 'deny'), default is to 'deny'
2812 2812
 			$res = false; // default is deny
@@ -2840,7 +2840,7 @@  discard block
 block discarded – undo
2840 2840
 				$this->sessionCache['rootstat'] = array();
2841 2841
 			}
2842 2842
 			//if (empty($this->ARGS['reload']) || empty($this->ARGS['target']) || strpos($this->ARGS['target'], $this->id) !== 0) {
2843
-			if (! $this->isMyReload()) {
2843
+			if (!$this->isMyReload()) {
2844 2844
 				// need $path as key for netmount/netunmount
2845 2845
 				if (isset($this->sessionCache['rootstat'][$rootKey])) {
2846 2846
 					if ($ret = elFinder::sessionDataDecode($this->sessionCache['rootstat'][$rootKey], 'array')) {
@@ -2880,10 +2880,10 @@  discard block
 block discarded – undo
2880 2880
 			if ($this->rootName) {
2881 2881
 				$stat['name'] = $this->rootName;
2882 2882
 			}
2883
-			if (! empty($this->options['icon'])) {
2883
+			if (!empty($this->options['icon'])) {
2884 2884
 				$stat['icon'] = $this->options['icon'];
2885 2885
 			}
2886
-			if (! empty($this->options['rootCssClass'])) {
2886
+			if (!empty($this->options['rootCssClass'])) {
2887 2887
 				$stat['csscls'] = $this->options['rootCssClass'];
2888 2888
 			}
2889 2889
 		} else {
@@ -2931,7 +2931,7 @@  discard block
 block discarded – undo
2931 2931
 			// lock when parent directory is not writable
2932 2932
 			if (!isset($stat['locked'])) {
2933 2933
 				$parent = $this->dirnameCE($path);
2934
-				$pstat = isset($this->cache[$parent])? $this->cache[$parent] : array();
2934
+				$pstat = isset($this->cache[$parent]) ? $this->cache[$parent] : array();
2935 2935
 				if (isset($pstat['write']) && !$pstat['write']) {
2936 2936
 					$stat['locked'] = true;
2937 2937
 				}
@@ -2989,7 +2989,7 @@  discard block
 block discarded – undo
2989 2989
 			}
2990 2990
 			if (!isset($stat['url']) && $this->URL && $this->encoding) {
2991 2991
 				$_path = str_replace($this->separator, '/', substr($path, strlen($this->root) + 1));
2992
-				$stat['url'] = rtrim($this->URL, '/') . '/' . str_replace('%2F', '/', rawurlencode((substr(PHP_OS, 0, 3) === 'WIN')? $_path : $this->convEncIn($_path, true)));
2992
+				$stat['url'] = rtrim($this->URL, '/').'/'.str_replace('%2F', '/', rawurlencode((substr(PHP_OS, 0, 3) === 'WIN') ? $_path : $this->convEncIn($_path, true)));
2993 2993
 			}
2994 2994
 		} else {
2995 2995
 			if ($isDir) {
@@ -3112,7 +3112,7 @@  discard block
 block discarded – undo
3112 3112
 				foreach ($mimecf as $line_num => $line) {
3113 3113
 					if (!preg_match('/^\s*#/', $line)) {
3114 3114
 						$mime = preg_split('/\s+/', $line, -1, PREG_SPLIT_NO_EMPTY);
3115
-						for ($i = 1, $size = count($mime); $i < $size ; $i++) {
3115
+						for ($i = 1, $size = count($mime); $i < $size; $i++) {
3116 3116
 							if (!isset(elFinderVolumeDriver::$mimetypes[$mime[$i]])) {
3117 3117
 								elFinderVolumeDriver::$mimetypes[$mime[$i]] = $mime[0];
3118 3118
 							}
@@ -3218,10 +3218,10 @@  discard block
 block discarded – undo
3218 3218
 	}
3219 3219
 	
3220 3220
 	protected function isMyReload($target = '', $ARGtarget = '') {
3221
-		if (! empty($this->ARGS['reload'])) {
3221
+		if (!empty($this->ARGS['reload'])) {
3222 3222
 			if ($ARGtarget === '') {
3223
-				$ARGtarget = isset($this->ARGS['target'])? $this->ARGS['target']
3224
-					: ((isset($this->ARGS['targets']) && is_array($this->ARGS['targets']) && count($this->ARGS['targets']) === 1)?
3223
+				$ARGtarget = isset($this->ARGS['target']) ? $this->ARGS['target']
3224
+					: ((isset($this->ARGS['targets']) && is_array($this->ARGS['targets']) && count($this->ARGS['targets']) === 1) ?
3225 3225
 						$this->ARGS['targets'][0] : '');
3226 3226
 			}
3227 3227
 			if ($ARGtarget !== '') {
@@ -3270,7 +3270,7 @@  discard block
 block discarded – undo
3270 3270
 	 * @return array
3271 3271
 	 * @author Dmitry (dio) Levashov
3272 3272
 	 **/
3273
-	protected function gettree($path, $deep, $exclude='') {
3273
+	protected function gettree($path, $deep, $exclude = '') {
3274 3274
 		$dirs = array();
3275 3275
 		
3276 3276
 		!isset($this->dirsCache[$path]) && $this->cacheDir($path);
@@ -3281,7 +3281,7 @@  discard block
 block discarded – undo
3281 3281
 			if ($stat && empty($stat['hidden']) && $p != $exclude && $stat['mime'] == 'directory') {
3282 3282
 				$dirs[] = $stat;
3283 3283
 				if ($deep > 0 && !empty($stat['dirs'])) {
3284
-					$dirs = array_merge($dirs, $this->gettree($p, $deep-1));
3284
+					$dirs = array_merge($dirs, $this->gettree($p, $deep - 1));
3285 3285
 				}
3286 3286
 			}
3287 3287
 		}
@@ -3301,7 +3301,7 @@  discard block
 block discarded – undo
3301 3301
 	protected function doSearch($path, $q, $mimes) {
3302 3302
 		$result = array();
3303 3303
 
3304
-		foreach($this->scandirCE($path) as $p) {
3304
+		foreach ($this->scandirCE($path) as $p) {
3305 3305
 			@set_time_limit(30);
3306 3306
 			$stat = $this->stat($p);
3307 3307
 
@@ -3322,7 +3322,7 @@  discard block
 block discarded – undo
3322 3322
 					if ($this->encoding) {
3323 3323
 						$path = str_replace('%2F', '/', rawurlencode($this->convEncIn($path, true)));
3324 3324
 					}
3325
-					$stat['url'] = $this->URL . $path;
3325
+					$stat['url'] = $this->URL.$path;
3326 3326
 				}
3327 3327
 				
3328 3328
 				$result[] = $stat;
@@ -3356,7 +3356,7 @@  discard block
 block discarded – undo
3356 3356
 			if (!$this->inpathCE($target, $this->root)) {
3357 3357
 				return $this->setError(elFinder::ERROR_COPY, $this->path($srcStat['hash']), elFinder::ERROR_MKOUTLINK);
3358 3358
 			}
3359
-			$stat   = $this->stat($target);
3359
+			$stat = $this->stat($target);
3360 3360
 			$this->clearcache();
3361 3361
 			return $stat && $this->symlinkCE($target, $dst, $name)
3362 3362
 				? $this->joinPathCE($dst, $name)
@@ -3637,15 +3637,15 @@  discard block
 block discarded – undo
3637 3637
 		}
3638 3638
 
3639 3639
 		/* If image smaller or equal thumbnail size - just fitting to thumbnail square */
3640
-		if ($s[0] <= $tmbSize && $s[1]	<= $tmbSize) {
3641
-			$result = $this->imgSquareFit($tmb, $tmbSize, $tmbSize, 'center', 'middle', $this->options['tmbBgColor'], 'png' );
3640
+		if ($s[0] <= $tmbSize && $s[1] <= $tmbSize) {
3641
+			$result = $this->imgSquareFit($tmb, $tmbSize, $tmbSize, 'center', 'middle', $this->options['tmbBgColor'], 'png');
3642 3642
 		} else {
3643 3643
 		
3644 3644
 			if ($this->options['tmbCrop']) {
3645 3645
 		
3646 3646
 				$result = $tmb;
3647 3647
 				/* Resize and crop if image bigger than thumbnail */
3648
-				if (!(($s[0] > $tmbSize && $s[1] <= $tmbSize) || ($s[0] <= $tmbSize && $s[1] > $tmbSize) ) || ($s[0] > $tmbSize && $s[1] > $tmbSize)) {
3648
+				if (!(($s[0] > $tmbSize && $s[1] <= $tmbSize) || ($s[0] <= $tmbSize && $s[1] > $tmbSize)) || ($s[0] > $tmbSize && $s[1] > $tmbSize)) {
3649 3649
 					$result = $this->imgResize($tmb, $tmbSize, $tmbSize, true, false, 'png');
3650 3650
 				}
3651 3651
 		
@@ -3662,7 +3662,7 @@  discard block
 block discarded – undo
3662 3662
 			}
3663 3663
 		
3664 3664
 			if ($result) {
3665
-				$result = $this->imgSquareFit($result, $tmbSize, $tmbSize, 'center', 'middle', $this->options['tmbBgColor'], 'png' );
3665
+				$result = $this->imgSquareFit($result, $tmbSize, $tmbSize, 'center', 'middle', $this->options['tmbBgColor'], 'png');
3666 3666
 			}
3667 3667
 		}
3668 3668
 		
@@ -3708,18 +3708,18 @@  discard block
 block discarded – undo
3708 3708
 			/* Resizing by biggest side */
3709 3709
 			if ($resizeByBiggerSide) {
3710 3710
 				if ($orig_w > $orig_h) {
3711
-					$size_h = round($orig_h * $width / $orig_w);
3711
+					$size_h = round($orig_h*$width/$orig_w);
3712 3712
 					$size_w = $width;
3713 3713
 				} else {
3714
-					$size_w = round($orig_w * $height / $orig_h);
3714
+					$size_w = round($orig_w*$height/$orig_h);
3715 3715
 					$size_h = $height;
3716 3716
 				}
3717 3717
 			} else {
3718 3718
 				if ($orig_w > $orig_h) {
3719
-					$size_w = round($orig_w * $height / $orig_h);
3719
+					$size_w = round($orig_w*$height/$orig_h);
3720 3720
 					$size_h = $height;
3721 3721
 				} else {
3722
-					$size_h = round($orig_h * $width / $orig_w);
3722
+					$size_h = round($orig_h*$width/$orig_w);
3723 3723
 					$size_w = $width;
3724 3724
 				}
3725 3725
 			}
@@ -3737,7 +3737,7 @@  discard block
 block discarded – undo
3737 3737
 				// Imagick::FILTER_BOX faster than FILTER_LANCZOS so use for createTmb
3738 3738
 				// resize bench: http://app-mgng.rhcloud.com/9
3739 3739
 				// resize sample: http://www.dylanbeattie.net/magick/filters/result.html
3740
-				$filter = ($destformat === 'png' /* createTmb */)? Imagick::FILTER_BOX : Imagick::FILTER_LANCZOS;
3740
+				$filter = ($destformat === 'png' /* createTmb */) ? Imagick::FILTER_BOX : Imagick::FILTER_LANCZOS;
3741 3741
 				
3742 3742
 				$ani = ($img->getNumberImages() > 1);
3743 3743
 				if ($ani && is_null($destformat)) {
@@ -3762,11 +3762,11 @@  discard block
 block discarded – undo
3762 3762
 				break;
3763 3763
 
3764 3764
 			case 'gd':
3765
-				$img = $this->gdImageCreate($path,$s['mime']);
3765
+				$img = $this->gdImageCreate($path, $s['mime']);
3766 3766
 
3767
-				if ($img &&  false != ($tmp = imagecreatetruecolor($size_w, $size_h))) {
3767
+				if ($img && false != ($tmp = imagecreatetruecolor($size_w, $size_h))) {
3768 3768
 				
3769
-					$this->gdImageBackground($tmp,$this->options['tmbBgColor']);
3769
+					$this->gdImageBackground($tmp, $this->options['tmbBgColor']);
3770 3770
 					
3771 3771
 					if (!imagecopyresampled($tmp, $img, 0, 0, 0, 0, $size_w, $size_h, $s[0], $s[1])) {
3772 3772
 						return false;
@@ -3847,11 +3847,11 @@  discard block
 block discarded – undo
3847 3847
 				break;
3848 3848
 
3849 3849
 			case 'gd':
3850
-				$img = $this->gdImageCreate($path,$s['mime']);
3850
+				$img = $this->gdImageCreate($path, $s['mime']);
3851 3851
 
3852
-				if ($img &&  false != ($tmp = imagecreatetruecolor($width, $height))) {
3852
+				if ($img && false != ($tmp = imagecreatetruecolor($width, $height))) {
3853 3853
 					
3854
-					$this->gdImageBackground($tmp,$this->options['tmbBgColor']);
3854
+					$this->gdImageBackground($tmp, $this->options['tmbBgColor']);
3855 3855
 
3856 3856
 					$size_w = $width;
3857 3857
 					$size_h = $height;
@@ -3902,8 +3902,8 @@  discard block
 block discarded – undo
3902 3902
 		$result = false;
3903 3903
 
3904 3904
 		/* Coordinates for image over square aligning */
3905
-		$y = ceil(abs($height - $s[1]) / 2); 
3906
-		$x = ceil(abs($width - $s[0]) / 2);
3905
+		$y = ceil(abs($height - $s[1])/2); 
3906
+		$x = ceil(abs($width - $s[0])/2);
3907 3907
 
3908 3908
 		if (!$jpgQuality) {
3909 3909
 			$jpgQuality = $this->options['jpgQuality'];
@@ -3927,7 +3927,7 @@  discard block
 block discarded – undo
3927 3927
 						$gif->newImage($width, $height, new ImagickPixel($bgcolor));
3928 3928
 						$gif->setImageColorspace($img->getImageColorspace());
3929 3929
 						$gif->setImageFormat('gif');
3930
-						$gif->compositeImage( $img, imagick::COMPOSITE_OVER, $x, $y );
3930
+						$gif->compositeImage($img, imagick::COMPOSITE_OVER, $x, $y);
3931 3931
 						$gif->setImageDelay($img->getImageDelay());
3932 3932
 						$gif->setImageIterations($img->getImageIterations());
3933 3933
 						$img1->addImage($gif);
@@ -3942,7 +3942,7 @@  discard block
 block discarded – undo
3942 3942
 					$img1 = new Imagick();
3943 3943
 					$img1->newImage($width, $height, new ImagickPixel($bgcolor));
3944 3944
 					$img1->setImageColorspace($img->getImageColorspace());
3945
-					$img1->compositeImage( $img, imagick::COMPOSITE_OVER, $x, $y );
3945
+					$img1->compositeImage($img, imagick::COMPOSITE_OVER, $x, $y);
3946 3946
 					$result = $this->imagickImage($img, $path, $destformat, $jpgQuality);
3947 3947
 				}
3948 3948
 				
@@ -3953,11 +3953,11 @@  discard block
 block discarded – undo
3953 3953
 				break;
3954 3954
 
3955 3955
 			case 'gd':
3956
-				$img = $this->gdImageCreate($path,$s['mime']);
3956
+				$img = $this->gdImageCreate($path, $s['mime']);
3957 3957
 
3958
-				if ($img &&  false != ($tmp = imagecreatetruecolor($width, $height))) {
3958
+				if ($img && false != ($tmp = imagecreatetruecolor($width, $height))) {
3959 3959
 
3960
-					$this->gdImageBackground($tmp,$bgcolor);
3960
+					$this->gdImageBackground($tmp, $bgcolor);
3961 3961
 
3962 3962
 					if (!imagecopy($tmp, $img, $x, $y, 0, 0, $s[0], $s[1])) {
3963 3963
 						return false;
@@ -3989,15 +3989,15 @@  discard block
 block discarded – undo
3989 3989
 	 * @author Troex Nevelin
3990 3990
 	 **/
3991 3991
 	protected function imgRotate($path, $degree, $bgcolor = '#ffffff', $destformat = null, $jpgQuality = null) {
3992
-		if (($s = @getimagesize($path)) == false || $degree % 360 === 0) {
3992
+		if (($s = @getimagesize($path)) == false || $degree%360 === 0) {
3993 3993
 			return false;
3994 3994
 		}
3995 3995
 
3996 3996
 		$result = false;
3997 3997
 
3998 3998
 		// try lossless rotate
3999
-		if ($degree % 90 === 0 && in_array($s[2], array(IMAGETYPE_JPEG, IMAGETYPE_JPEG2000))) {
4000
-			$count = ($degree / 90) % 4;
3999
+		if ($degree%90 === 0 && in_array($s[2], array(IMAGETYPE_JPEG, IMAGETYPE_JPEG2000))) {
4000
+			$count = ($degree/90)%4;
4001 4001
 			$exiftran = array(
4002 4002
 				1 => '-9',
4003 4003
 				2 => '-1',
@@ -4013,7 +4013,7 @@  discard block
 block discarded – undo
4013 4013
 				'exiftran -i '.$exiftran[$count].' '.$path,
4014 4014
 				'jpegtran -rotate '.$jpegtran[$count].' -copy all -outfile '.$quotedPath.' '.$quotedPath
4015 4015
 			);
4016
-			foreach($cmds as $cmd) {
4016
+			foreach ($cmds as $cmd) {
4017 4017
 				if ($this->procExec($cmd) === 0) {
4018 4018
 					$result = true;
4019 4019
 					break;
@@ -4053,12 +4053,12 @@  discard block
 block discarded – undo
4053 4053
 				break;
4054 4054
 
4055 4055
 			case 'gd':
4056
-				$img = $this->gdImageCreate($path,$s['mime']);
4056
+				$img = $this->gdImageCreate($path, $s['mime']);
4057 4057
 
4058 4058
 				$degree = 360 - $degree;
4059 4059
 				list($r, $g, $b) = sscanf($bgcolor, "#%02x%02x%02x");
4060 4060
 				$bgcolor = imagecolorallocate($img, $r, $g, $b);
4061
-				$tmp = imageRotate($img, $degree, (int)$bgcolor);
4061
+				$tmp = imageRotate($img, $degree, (int) $bgcolor);
4062 4062
 
4063 4063
 				$result = $this->gdImage($tmp, $path, $destformat, $s['mime'], $jpgQuality);
4064 4064
 
@@ -4083,11 +4083,11 @@  discard block
 block discarded – undo
4083 4083
 	 * @return int     exit code
4084 4084
 	 * @author Alexey Sukhotin
4085 4085
 	 **/
4086
-	protected function procExec($command , array &$output = null, &$return_var = -1, array &$error_output = null) {
4086
+	protected function procExec($command, array &$output = null, &$return_var = -1, array &$error_output = null) {
4087 4087
 
4088 4088
 		$descriptorspec = array(
4089
-			0 => array("pipe", "r"),  // stdin
4090
-			1 => array("pipe", "w"),  // stdout
4089
+			0 => array("pipe", "r"), // stdin
4090
+			1 => array("pipe", "w"), // stdout
4091 4091
 			2 => array("pipe", "w")   // stderr
4092 4092
 		);
4093 4093
 
@@ -4144,8 +4144,8 @@  discard block
 block discarded – undo
4144 4144
 	 * @param string $mime
4145 4145
 	 * @return gd image resource identifier
4146 4146
 	 */
4147
-	protected function gdImageCreate($path,$mime){
4148
-		switch($mime){
4147
+	protected function gdImageCreate($path, $mime) {
4148
+		switch ($mime) {
4149 4149
 			case 'image/jpeg':
4150 4150
 			return imagecreatefromjpeg($path);
4151 4151
 
@@ -4170,7 +4170,7 @@  discard block
 block discarded – undo
4170 4170
 	 * @param string $mime The original image mime type
4171 4171
 	 * @param int    $jpgQuality  JEPG quality (1-100)
4172 4172
 	 */
4173
-	protected function gdImage($image, $filename, $destformat, $mime, $jpgQuality = null ){
4173
+	protected function gdImage($image, $filename, $destformat, $mime, $jpgQuality = null) {
4174 4174
 
4175 4175
 		if (!$jpgQuality) {
4176 4176
 			$jpgQuality = $this->options['jpgQuality'];
@@ -4194,7 +4194,7 @@  discard block
 block discarded – undo
4194 4194
 	 * @param string $destformat The Image type to use for $filename
4195 4195
 	 * @param int    $jpgQuality  JEPG quality (1-100)
4196 4196
 	 */
4197
-	protected function imagickImage($img, $filename, $destformat, $jpgQuality = null ){
4197
+	protected function imagickImage($img, $filename, $destformat, $jpgQuality = null) {
4198 4198
 
4199 4199
 		if (!$jpgQuality) {
4200 4200
 			$jpgQuality = $this->options['jpgQuality'];
@@ -4249,13 +4249,13 @@  discard block
 block discarded – undo
4249 4249
 	 * @param resource $image gd image resource
4250 4250
 	 * @param string $bgcolor background color in #rrggbb format
4251 4251
 	 */
4252
-	protected function gdImageBackground($image, $bgcolor){
4252
+	protected function gdImageBackground($image, $bgcolor) {
4253 4253
 
4254
-		if( $bgcolor == 'transparent' ){
4255
-			imagesavealpha($image,true);
4254
+		if ($bgcolor == 'transparent') {
4255
+			imagesavealpha($image, true);
4256 4256
 			$bgcolor1 = imagecolorallocatealpha($image, 255, 255, 255, 127);
4257 4257
 
4258
-		}else{
4258
+		} else {
4259 4259
 			list($r, $g, $b) = sscanf($bgcolor, "#%02x%02x%02x");
4260 4260
 			$bgcolor1 = imagecolorallocate($image, $r, $g, $b);
4261 4261
 		}
@@ -4293,13 +4293,13 @@  discard block
 block discarded – undo
4293 4293
 	* @return int|bool
4294 4294
 	* @author Alexey Sukhotin
4295 4295
 	**/
4296
-	protected function stripos($haystack , $needle , $offset = 0) {
4296
+	protected function stripos($haystack, $needle, $offset = 0) {
4297 4297
 		if (function_exists('mb_stripos')) {
4298
-			return mb_stripos($haystack , $needle , $offset, 'UTF-8');
4298
+			return mb_stripos($haystack, $needle, $offset, 'UTF-8');
4299 4299
 		} else if (function_exists('mb_strtolower') && function_exists('mb_strpos')) {
4300 4300
 			return mb_strpos(mb_strtolower($haystack, 'UTF-8'), mb_strtolower($needle, 'UTF-8'), $offset);
4301 4301
 		} 
4302
-		return stripos($haystack , $needle , $offset);
4302
+		return stripos($haystack, $needle, $offset);
4303 4303
 	}
4304 4304
 
4305 4305
 	/**
@@ -4349,22 +4349,22 @@  discard block
 block discarded – undo
4349 4349
 			unset($o);
4350 4350
 			$this->procExec('zip -v', $o, $c);
4351 4351
 			if ($c == 0) {
4352
-				$arcs['create']['application/zip']  = array('cmd' => 'zip', 'argc' => '-r9', 'ext' => 'zip');
4352
+				$arcs['create']['application/zip'] = array('cmd' => 'zip', 'argc' => '-r9', 'ext' => 'zip');
4353 4353
 			}
4354 4354
 			unset($o);
4355 4355
 			$this->procExec('unzip --help', $o, $c);
4356 4356
 			if ($c == 0) {
4357
-				$arcs['extract']['application/zip'] = array('cmd' => 'unzip', 'argc' => '',  'ext' => 'zip');
4357
+				$arcs['extract']['application/zip'] = array('cmd' => 'unzip', 'argc' => '', 'ext' => 'zip');
4358 4358
 			}
4359 4359
 			unset($o);
4360 4360
 			$this->procExec('rar --version', $o, $c);
4361 4361
 			if ($c == 0 || $c == 7) {
4362 4362
 				$arcs['create']['application/x-rar']  = array('cmd' => 'rar', 'argc' => 'a -inul', 'ext' => 'rar');
4363
-				$arcs['extract']['application/x-rar'] = array('cmd' => 'rar', 'argc' => 'x -y',    'ext' => 'rar');
4363
+				$arcs['extract']['application/x-rar'] = array('cmd' => 'rar', 'argc' => 'x -y', 'ext' => 'rar');
4364 4364
 			} else {
4365 4365
 				unset($o);
4366 4366
 				$test = $this->procExec('unrar', $o, $c);
4367
-				if ($c==0 || $c == 7) {
4367
+				if ($c == 0 || $c == 7) {
4368 4368
 					$arcs['extract']['application/x-rar'] = array('cmd' => 'unrar', 'argc' => 'x -y', 'ext' => 'rar');
4369 4369
 				}
4370 4370
 			}
@@ -4386,7 +4386,7 @@  discard block
 block discarded – undo
4386 4386
 				if (empty($arcs['extract']['application/x-tar'])) {
4387 4387
 					$arcs['extract']['application/x-tar'] = array('cmd' => '7za', 'argc' => 'x -ttar -y', 'ext' => 'tar');
4388 4388
 				}
4389
-			} else if (substr(PHP_OS,0,3) === 'WIN') {
4389
+			} else if (substr(PHP_OS, 0, 3) === 'WIN') {
4390 4390
 				// check `7z` for Windows server.
4391 4391
 				unset($o);
4392 4392
 				$this->procExec('7z', $o, $c);
@@ -4440,22 +4440,22 @@  discard block
 block discarded – undo
4440 4440
 
4441 4441
 		// normalize `/../`
4442 4442
 		$normreg = '#('.$sepquoted.')[^'.$sepquoted.']+'.$sepquoted.'\.\.'.$sepquoted.'#';
4443
-		while(preg_match($normreg, $path)) {
4443
+		while (preg_match($normreg, $path)) {
4444 4444
 			$path = preg_replace($normreg, '$1', $path);
4445 4445
 		}
4446 4446
 		
4447 4447
 		// 'Here'
4448
-		if ($path === '' || $path === '.' . $separator) return $base;
4448
+		if ($path === '' || $path === '.'.$separator) return $base;
4449 4449
 		
4450 4450
 		// Absolute path
4451 4451
 		if ($path[0] === $separator || strpos($path, $systemroot) === 0) {
4452 4452
 			return $path;
4453 4453
 		}
4454 4454
 		
4455
-		$preg_separator = '#' . $sepquoted . '#';
4455
+		$preg_separator = '#'.$sepquoted.'#';
4456 4456
 		
4457 4457
 		// Relative path from 'Here'
4458
-		if (substr($path, 0, 2) === '.' . $separator || $path[0] !== '.' || substr($path, 0, 3) !== '..' . $separator) {
4458
+		if (substr($path, 0, 2) === '.'.$separator || $path[0] !== '.' || substr($path, 0, 3) !== '..'.$separator) {
4459 4459
 			$arrn = preg_split($preg_separator, $path, -1, PREG_SPLIT_NO_EMPTY);
4460 4460
 			if ($arrn[0] !== '.') {
4461 4461
 				array_unshift($arrn, '.');
@@ -4469,12 +4469,11 @@  discard block
 block discarded – undo
4469 4469
 			$arrn = preg_split($preg_separator, $path, -1, PREG_SPLIT_NO_EMPTY);
4470 4470
 			$arrp = preg_split($preg_separator, $base, -1, PREG_SPLIT_NO_EMPTY);
4471 4471
 		
4472
-			while (! empty($arrn) && $arrn[0] === '..') {
4472
+			while (!empty($arrn) && $arrn[0] === '..') {
4473 4473
 				array_shift($arrn);
4474 4474
 				array_pop($arrp);
4475 4475
 			}
4476
-			$path = ! empty($arrp) ? $systemroot . join($separator, array_merge($arrp, $arrn)) :
4477
-				(! empty($arrn) ? $systemroot . join($separator, $arrn) : $systemroot);
4476
+			$path = !empty($arrp) ? $systemroot.join($separator, array_merge($arrp, $arrn)) : (!empty($arrn) ? $systemroot.join($separator, $arrn) : $systemroot);
4478 4477
 		}
4479 4478
 		
4480 4479
 		return $path;
@@ -4492,7 +4491,7 @@  discard block
 block discarded – undo
4492 4491
 			@chmod($dir, 0777);
4493 4492
 			foreach (array_diff(scandir($dir), array('.', '..')) as $file) {
4494 4493
 				@set_time_limit(30);
4495
-				$path = $dir . DIRECTORY_SEPARATOR . $file;
4494
+				$path = $dir.DIRECTORY_SEPARATOR.$file;
4496 4495
 				if (!is_link($dir) && is_dir($path)) {
4497 4496
 					$this->rmdirRecursive($path);
4498 4497
 				} else {
@@ -4579,22 +4578,22 @@  discard block
 block discarded – undo
4579 4578
 		try {
4580 4579
 			if ($start = is_string($zipPath)) {
4581 4580
 				$zip = new ZipArchive();
4582
-				if ($zip->open($dir . DIRECTORY_SEPARATOR . $zipPath, ZipArchive::CREATE) !== true) {
4581
+				if ($zip->open($dir.DIRECTORY_SEPARATOR.$zipPath, ZipArchive::CREATE) !== true) {
4583 4582
 					$zip = false;
4584 4583
 				}
4585 4584
 			} else {
4586 4585
 				$zip = $zipPath;
4587 4586
 			}
4588 4587
 			if ($zip) {
4589
-				foreach($files as $file) {
4590
-					$path = $dir . DIRECTORY_SEPARATOR . $file;
4588
+				foreach ($files as $file) {
4589
+					$path = $dir.DIRECTORY_SEPARATOR.$file;
4591 4590
 					if (is_dir($path)) {
4592 4591
 						$zip->addEmptyDir($file);
4593 4592
 						$_files = array();
4594 4593
 						if ($handle = opendir($path)) {
4595 4594
 							while (false !== ($entry = readdir($handle))) {
4596 4595
 								if ($entry !== "." && $entry !== "..") {
4597
-									$_files[] = $file . DIRECTORY_SEPARATOR . $entry;
4596
+									$_files[] = $file.DIRECTORY_SEPARATOR.$entry;
4598 4597
 								}
4599 4598
 							}
4600 4599
 							closedir($handle);
@@ -4779,7 +4778,7 @@  discard block
 block discarded – undo
4779 4778
 	 * @return resource|false
4780 4779
 	 * @author Dmitry (dio) Levashov
4781 4780
 	 **/
4782
-	abstract protected function _fopen($path, $mode="rb");
4781
+	abstract protected function _fopen($path, $mode = "rb");
4783 4782
 	
4784 4783
 	/**
4785 4784
 	 * Close opened file
@@ -4789,7 +4788,7 @@  discard block
 block discarded – undo
4789 4788
 	 * @return bool
4790 4789
 	 * @author Dmitry (dio) Levashov
4791 4790
 	 **/
4792
-	abstract protected function _fclose($fp, $path='');
4791
+	abstract protected function _fclose($fp, $path = '');
4793 4792
 	
4794 4793
 	/********************  file/dir manipulations *************************/
4795 4794
 	
Please login to merge, or discard this patch.