Completed
Push — 2.x ( 0e0569...8c9fca )
by Naoki
08:04 queued 05:06
created
php/elFinderVolumeLocalFileSystem.class.php 1 patch
Spacing   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -32,11 +32,11 @@  discard block
 block discarded – undo
32 32
 	 * @author Dmitry (dio) Levashov
33 33
 	 **/
34 34
 	public function __construct() {
35
-		$this->options['alias']    = '';              // alias to replace root dir name
36
-		$this->options['dirMode']  = 0755;            // new dirs mode
37
-		$this->options['fileMode'] = 0644;            // new files mode
38
-		$this->options['quarantine'] = '.quarantine';  // quarantine folder name - required to check archive (must be hidden)
39
-		$this->options['maxArcFilesSize'] = 0;        // max allowed archive files size (0 - no limit)
35
+		$this->options['alias']    = ''; // alias to replace root dir name
36
+		$this->options['dirMode']  = 0755; // new dirs mode
37
+		$this->options['fileMode'] = 0644; // new files mode
38
+		$this->options['quarantine'] = '.quarantine'; // quarantine folder name - required to check archive (must be hidden)
39
+		$this->options['maxArcFilesSize'] = 0; // max allowed archive files size (0 - no limit)
40 40
 		$this->options['rootCssClass'] = 'elfinder-navbar-root-local';
41 41
 	}
42 42
 	
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
 	protected function init() {
54 54
 		// Normalize directory separator for windows
55 55
 		if (DIRECTORY_SEPARATOR !== '/') {
56
-			foreach(array('path', 'tmpPath', 'quarantine') as $key) {
56
+			foreach (array('path', 'tmpPath', 'quarantine') as $key) {
57 57
 				if ($this->options[$key]) {
58 58
 					$this->options[$key] = str_replace('/', DIRECTORY_SEPARATOR, $this->options[$key]);
59 59
 				}
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
 		// if no thumbnails url - try detect it
100 100
 		if ($root['read'] && !$this->tmbURL && $this->URL) {
101 101
 			if (strpos($this->tmbPath, $this->root) === 0) {
102
-				$this->tmbURL = $this->URL.str_replace(DIRECTORY_SEPARATOR, '/', substr($this->tmbPath, strlen($this->root)+1));
102
+				$this->tmbURL = $this->URL.str_replace(DIRECTORY_SEPARATOR, '/', substr($this->tmbPath, strlen($this->root) + 1));
103 103
 				if (preg_match("|[^/?&=]$|", $this->tmbURL)) {
104 104
 					$this->tmbURL .= '/';
105 105
 				}
@@ -175,7 +175,7 @@  discard block
 block discarded – undo
175 175
 	 * @author Dmitry (dio) Levashov
176 176
 	 **/
177 177
 	protected function _joinPath($dir, $name) {
178
-		return rtrim($dir, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . $name;
178
+		return rtrim($dir, DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR.$name;
179 179
 	}
180 180
 	
181 181
 	/**
@@ -227,7 +227,7 @@  discard block
 block discarded – undo
227 227
 		$comps = $new_comps;
228 228
 		$path = implode('/', $comps);
229 229
 		if ($initial_slashes) {
230
-			$path = str_repeat('/', $initial_slashes) . $path;
230
+			$path = str_repeat('/', $initial_slashes).$path;
231 231
 		}
232 232
 		
233 233
 		if ($changeSep) {
@@ -298,7 +298,7 @@  discard block
 block discarded – undo
298 298
 	 **/
299 299
 	protected function _inpath($path, $parent) {
300 300
 		$cwd = getcwd();
301
-		$real_path   = $this->getFullPath($path,   $cwd);
301
+		$real_path   = $this->getFullPath($path, $cwd);
302 302
 		$real_parent = $this->getFullPath($parent, $cwd);
303 303
 		if ($real_path && $real_parent) {
304 304
 			return $real_path === $real_parent || strpos($real_path, rtrim($real_parent, DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR) === 0;
@@ -357,7 +357,7 @@  discard block
 block discarded – undo
357 357
 					$stat = array();
358 358
 					return $stat;
359 359
 				} else {
360
-					$stat['mime']  = 'symlink-broken';
360
+					$stat['mime'] = 'symlink-broken';
361 361
 					$target = readlink($path);
362 362
 					$lstat = lstat($path);
363 363
 					$ostat = $this->getOwnerStat($lstat['uid'], $lstat['gid']);
@@ -373,7 +373,7 @@  discard block
 block discarded – undo
373 373
 			$fstat = stat($path);
374 374
 			$uid = $fstat['uid'];
375 375
 			$gid = $fstat['gid'];
376
-			$stat['perm'] = substr((string)decoct($fstat['mode']), -4);
376
+			$stat['perm'] = substr((string) decoct($fstat['mode']), -4);
377 377
 			$stat = array_merge($stat, $this->getOwnerStat($uid, $gid));
378 378
 		}
379 379
 		
@@ -383,8 +383,8 @@  discard block
 block discarded – undo
383 383
 			$stat['mime'] = $dir ? 'directory' : $this->mimetype($path);
384 384
 		}
385 385
 		//logical rights first
386
-		$stat['read'] = ($linkreadable || is_readable($path))? null : false;
387
-		$stat['write'] = is_writable($path)? null : false;
386
+		$stat['read'] = ($linkreadable || is_readable($path)) ? null : false;
387
+		$stat['write'] = is_writable($path) ? null : false;
388 388
 
389 389
 		if (is_null($stat['read'])) {
390 390
 			$stat['size'] = $dir ? 0 : $size;
@@ -454,7 +454,7 @@  discard block
 block discarded – undo
454 454
 
455 455
 		if (is_dir($path)) {
456 456
 			$path = strtr($path, array('['  => '\\[', ']'  => '\\]', '*'  => '\\*', '?'  => '\\?'));
457
-			return (bool)glob(rtrim($path, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . '*', GLOB_ONLYDIR);
457
+			return (bool) glob(rtrim($path, DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR.'*', GLOB_ONLYDIR);
458 458
 		}
459 459
 		return false;
460 460
 	}
@@ -535,7 +535,7 @@  discard block
 block discarded – undo
535 535
 							$br = true;
536 536
 						} else {
537 537
 							$_path = $fpath;
538
-							$stat['mime']  = 'symlink-broken';
538
+							$stat['mime'] = 'symlink-broken';
539 539
 							$target = readlink($_path);
540 540
 							$lstat = lstat($_path);
541 541
 							$ostat = $this->getOwnerStat($lstat['uid'], $lstat['gid']);
@@ -560,13 +560,13 @@  discard block
 block discarded – undo
560 560
 					if ($statOwner && !$linkreadable) {
561 561
 						$uid = $file->getOwner();
562 562
 						$gid = $file->getGroup();
563
-						$stat['perm'] = substr((string)decoct($file->getPerms()), -4);
563
+						$stat['perm'] = substr((string) decoct($file->getPerms()), -4);
564 564
 						$stat = array_merge($stat, $this->getOwnerStat($uid, $gid));
565 565
 					}
566 566
 					
567 567
 					//logical rights first
568
-					$stat['read'] = ($linkreadable || $file->isReadable())? null : false;
569
-					$stat['write'] = $file->isWritable()? null : false;
568
+					$stat['read'] = ($linkreadable || $file->isReadable()) ? null : false;
569
+					$stat['write'] = $file->isWritable() ? null : false;
570 570
 					
571 571
 					if (is_null($stat['read'])) {
572 572
 						$stat['size'] = $dir ? 0 : $size;
@@ -582,7 +582,7 @@  discard block
 block discarded – undo
582 582
 		
583 583
 		if ($cache) {
584 584
 			$cache = $this->convEncOut($cache, false);
585
-			foreach($cache as $d) {
585
+			foreach ($cache as $d) {
586 586
 				$this->updateCache($d[0], $d[1]);
587 587
 			}
588 588
 		}
@@ -598,7 +598,7 @@  discard block
 block discarded – undo
598 598
 	 * @return resource|false
599 599
 	 * @author Dmitry (dio) Levashov
600 600
 	 **/
601
-	protected function _fopen($path, $mode='rb') {
601
+	protected function _fopen($path, $mode = 'rb') {
602 602
 		return @fopen($path, $mode);
603 603
 	}
604 604
 	
@@ -609,7 +609,7 @@  discard block
 block discarded – undo
609 609
 	 * @return bool
610 610
 	 * @author Dmitry (dio) Levashov
611 611
 	 **/
612
-	protected function _fclose($fp, $path='') {
612
+	protected function _fclose($fp, $path = '') {
613 613
 		return @fclose($fp);
614 614
 	}
615 615
 	
@@ -741,7 +741,7 @@  discard block
 block discarded – undo
741 741
 		$path = $this->_joinPath($dir, $name);
742 742
 
743 743
 		$meta = stream_get_meta_data($fp);
744
-		$uri = isset($meta['uri'])? $meta['uri'] : '';
744
+		$uri = isset($meta['uri']) ? $meta['uri'] : '';
745 745
 		if ($uri && @is_file($uri)) {
746 746
 			fclose($fp);
747 747
 			$isCmdPaste = ($this->ARGS['cmd'] === 'paste');
@@ -805,7 +805,7 @@  discard block
 block discarded – undo
805 805
 	 * @return bool
806 806
 	 **/
807 807
 	protected function _chmod($path, $mode) {
808
-		$modeOct = is_string($mode) ? octdec($mode) : octdec(sprintf("%04o",$mode));
808
+		$modeOct = is_string($mode) ? octdec($mode) : octdec(sprintf("%04o", $mode));
809 809
 		$ret = @chmod($path, $modeOct);
810 810
 		$ret && clearstatcache();
811 811
 		return  $ret;
@@ -923,7 +923,7 @@  discard block
 block discarded – undo
923 923
 				$src = $dir;
924 924
 				$name = basename($path);
925 925
 				if (preg_match('/\.((tar\.(gz|bz|bz2|z|lzo))|cpio\.gz|ps\.gz|xcf\.(gz|bz2)|[a-z0-9]{1,4})$/i', $name, $m)) {
926
-					$name = substr($name, 0,  strlen($name)-strlen($m[0]));
926
+					$name = substr($name, 0, strlen($name) - strlen($m[0]));
927 927
 				}
928 928
 				$test = dirname($path).DIRECTORY_SEPARATOR.$name;
929 929
 				if (file_exists($test) || is_link($test)) {
@@ -932,9 +932,9 @@  discard block
 block discarded – undo
932 932
 			}
933 933
 			
934 934
 			if ($name !== '') {
935
-				$result  = dirname($path).DIRECTORY_SEPARATOR.$name;
935
+				$result = dirname($path).DIRECTORY_SEPARATOR.$name;
936 936
 
937
-				if (! @rename($src, $result)) {
937
+				if (!@rename($src, $result)) {
938 938
 					$this->delTree($dir);
939 939
 					return false;
940 940
 				}
@@ -942,7 +942,7 @@  discard block
 block discarded – undo
942 942
 				$dstDir = dirname($path);
943 943
 				$res = false;
944 944
 				$result = array();
945
-				foreach($ls as $name) {
945
+				foreach ($ls as $name) {
946 946
 					$target = $dstDir.DIRECTORY_SEPARATOR.$name;
947 947
 					if (is_dir($target)) {
948 948
 						$this->delTree($target);
@@ -1034,10 +1034,10 @@  discard block
 block discarded – undo
1034 1034
 		
1035 1035
 		$path = strtr($path, $escaper);
1036 1036
 		$_q = strtr($q, $escaper);
1037
-		$dirs = glob(rtrim($path, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . '*', GLOB_ONLYDIR);
1038
-		$match = glob(rtrim($path, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . '*'.$_q.'*', GLOB_NOSORT);
1037
+		$dirs = glob(rtrim($path, DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR.'*', GLOB_ONLYDIR);
1038
+		$match = glob(rtrim($path, DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR.'*'.$_q.'*', GLOB_NOSORT);
1039 1039
 		if ($match) {
1040
-			foreach($match as $p) {
1040
+			foreach ($match as $p) {
1041 1041
 				$stat = $this->stat($p);
1042 1042
 		
1043 1043
 				if (!$stat) { // invalid links
@@ -1054,7 +1054,7 @@  discard block
 block discarded – undo
1054 1054
 					$stat['path'] = $this->path($stat['hash']);
1055 1055
 					if ($this->URL && !isset($stat['url'])) {
1056 1056
 						$path = str_replace(DIRECTORY_SEPARATOR, '/', substr($p, strlen($this->root) + 1));
1057
-						$stat['url'] = $this->URL . $path;
1057
+						$stat['url'] = $this->URL.$path;
1058 1058
 					}
1059 1059
 		
1060 1060
 					$result[] = $stat;
@@ -1062,7 +1062,7 @@  discard block
 block discarded – undo
1062 1062
 			}
1063 1063
 		}
1064 1064
 		if ($dirs) {
1065
-			foreach($dirs as $dir) {
1065
+			foreach ($dirs as $dir) {
1066 1066
 				$stat = $this->stat($dir);
1067 1067
 				if ($stat['read'] && !isset($stat['alias'])) {
1068 1068
 					@set_time_limit(30);
Please login to merge, or discard this patch.
php/elFinderVolumeDriver.class.php 1 patch
Spacing   +131 added lines, -132 removed lines patch added patch discarded remove patch
@@ -278,7 +278,7 @@  discard block
 block discarded – undo
278 278
 		'utf8fix'      => false,
279 279
 		 //                           й                 ё              Й               Ё              Ø         Å
280 280
 		'utf8patterns' => array("\u0438\u0306", "\u0435\u0308", "\u0418\u0306", "\u0415\u0308", "\u00d8A", "\u030a"),
281
-		'utf8replace'  => array("\u0439",        "\u0451",       "\u0419",       "\u0401",       "\u00d8", "\u00c5")
281
+		'utf8replace'  => array("\u0439", "\u0451", "\u0419", "\u0401", "\u00d8", "\u00c5")
282 282
 	);
283 283
 
284 284
 	/**
@@ -573,7 +573,7 @@  discard block
 block discarded – undo
573 573
 	 **/
574 574
 	protected function configure() {
575 575
 		// set ARGS
576
-		$this->ARGS = $_SERVER['REQUEST_METHOD'] === 'POST'? $_POST : $_GET;
576
+		$this->ARGS = $_SERVER['REQUEST_METHOD'] === 'POST' ? $_POST : $_GET;
577 577
 		// set thumbnails path
578 578
 		$path = $this->options['tmbPath'];
579 579
 		if ($path) {
@@ -604,7 +604,7 @@  discard block
 block discarded – undo
604 604
 		
605 605
 		// check 'statOwner' for command `chmod`
606 606
 		if (empty($this->options['statOwner'])) {
607
-			$this->disabled[] ='chmod';
607
+			$this->disabled[] = 'chmod';
608 608
 		}
609 609
 		
610 610
 		// check 'mimeMap'
@@ -710,7 +710,7 @@  discard block
 block discarded – undo
710 710
 	 **/
711 711
 	public function mount(array $opts) {
712 712
 		if (!isset($opts['path']) || $opts['path'] === '') {
713
-			return $this->setError('Path undefined.');;
713
+			return $this->setError('Path undefined.'); ;
714 714
 		}
715 715
 		
716 716
 		$this->options = array_merge($this->options, $opts);
@@ -729,14 +729,14 @@  discard block
 block discarded – undo
729 729
 		$argInit = !empty($this->ARGS['init']);
730 730
 		
731 731
 		// session cache
732
-		if ($argInit || ! isset($_SESSION[elFinder::$sessionCacheKey][$this->id])) {
732
+		if ($argInit || !isset($_SESSION[elFinder::$sessionCacheKey][$this->id])) {
733 733
 			$_SESSION[elFinder::$sessionCacheKey][$this->id] = array();
734 734
 		}
735 735
 		$this->sessionCache = &$_SESSION[elFinder::$sessionCacheKey][$this->id];
736 736
 		
737 737
 		// default file attribute
738 738
 		$this->defaults = array(
739
-			'read'    => isset($this->options['defaults']['read'])  ? !!$this->options['defaults']['read']  : true,
739
+			'read'    => isset($this->options['defaults']['read']) ? !!$this->options['defaults']['read'] : true,
740 740
 			'write'   => isset($this->options['defaults']['write']) ? !!$this->options['defaults']['write'] : true,
741 741
 			'locked'  => isset($this->options['defaults']['locked']) ? !!$this->options['defaults']['locked'] : false,
742 742
 			'hidden'  => isset($this->options['defaults']['hidden']) ? !!$this->options['defaults']['hidden'] : false
@@ -763,8 +763,8 @@  discard block
 block discarded – undo
763 763
 			$this->access = $this->options['accessControl'];
764 764
 		}
765 765
 		
766
-		$this->today     = mktime(0,0,0, date('m'), date('d'), date('Y'));
767
-		$this->yesterday = $this->today-86400;
766
+		$this->today     = mktime(0, 0, 0, date('m'), date('d'), date('Y'));
767
+		$this->yesterday = $this->today - 86400;
768 768
 		
769 769
 		// debug($this->attributes);
770 770
 		if (!$this->init()) {
@@ -863,7 +863,7 @@  discard block
 block discarded – undo
863 863
 				foreach ($mimecf as $line_num => $line) {
864 864
 					if (!preg_match('/^\s*#/', $line)) {
865 865
 						$mime = preg_split('/\s+/', $line, -1, PREG_SPLIT_NO_EMPTY);
866
-						for ($i = 1, $size = count($mime); $i < $size ; $i++) {
866
+						for ($i = 1, $size = count($mime); $i < $size; $i++) {
867 867
 							if (!isset(self::$mimetypes[$mime[$i]])) {
868 868
 								self::$mimetypes[$mime[$i]] = $mime[0];
869 869
 							}
@@ -915,8 +915,8 @@  discard block
 block discarded – undo
915 915
 				'read'    => false
916 916
 			));
917 917
 		}
918
-		$this->treeDeep = $this->options['treeDeep'] > 0 ? (int)$this->options['treeDeep'] : 1;
919
-		$this->tmbSize  = $this->options['tmbSize'] > 0 ? (int)$this->options['tmbSize'] : 48;
918
+		$this->treeDeep = $this->options['treeDeep'] > 0 ? (int) $this->options['treeDeep'] : 1;
919
+		$this->tmbSize  = $this->options['tmbSize'] > 0 ? (int) $this->options['tmbSize'] : 48;
920 920
 		$this->URL      = $this->options['URL'];
921 921
 		if ($this->URL && preg_match("|[^/?&=]$|", $this->URL)) {
922 922
 			$this->URL .= '/';
@@ -1070,7 +1070,7 @@  discard block
 block discarded – undo
1070 1070
 	public function options($hash) {
1071 1071
 		$create = $createext = array();
1072 1072
 		if (isset($this->archivers['create']) && is_array($this->archivers['create'])) {
1073
-			foreach($this->archivers['create'] as $m => $v) {
1073
+			foreach ($this->archivers['create'] as $m => $v) {
1074 1074
 				$create[] = $m;
1075 1075
 				$createext[$m] = $v['ext'];
1076 1076
 			}
@@ -1090,7 +1090,7 @@  discard block
 block discarded – undo
1090 1090
 				'extract'   => isset($this->archivers['extract']) && is_array($this->archivers['extract']) ? array_keys($this->archivers['extract']) : array(),
1091 1091
 				'createext' => $createext
1092 1092
 			),
1093
-			'uiCmdMap'        => (isset($this->options['uiCmdMap']) && is_array($this->options['uiCmdMap']))? $this->options['uiCmdMap'] : array()
1093
+			'uiCmdMap'        => (isset($this->options['uiCmdMap']) && is_array($this->options['uiCmdMap'])) ? $this->options['uiCmdMap'] : array()
1094 1094
 		);
1095 1095
 	}
1096 1096
 	
@@ -1102,7 +1102,7 @@  discard block
 block discarded – undo
1102 1102
 	 * @author Naoki Sawada
1103 1103
 	 */
1104 1104
 	public function getOption($name) {
1105
-		return isset($this->options[$name])? $this->options[$name] : null;
1105
+		return isset($this->options[$name]) ? $this->options[$name] : null;
1106 1106
 	}
1107 1107
 	
1108 1108
 	/**
@@ -1114,7 +1114,7 @@  discard block
 block discarded – undo
1114 1114
 	 */
1115 1115
 	public function getOptionsPlugin($name = '') {
1116 1116
 		if ($name) {
1117
-			return isset($this->options['plugin'][$name])? $this->options['plugin'][$name] : array();
1117
+			return isset($this->options['plugin'][$name]) ? $this->options['plugin'][$name] : array();
1118 1118
 		} else {
1119 1119
 			return $this->options['plugin'];
1120 1120
 		}
@@ -1244,7 +1244,7 @@  discard block
 block discarded – undo
1244 1244
 		$file = $this->stat($path);
1245 1245
 		
1246 1246
 		if ($hash === $this->root()) {
1247
-			$file['uiCmdMap'] = (isset($this->options['uiCmdMap']) && is_array($this->options['uiCmdMap']))? $this->options['uiCmdMap'] : array();
1247
+			$file['uiCmdMap'] = (isset($this->options['uiCmdMap']) && is_array($this->options['uiCmdMap'])) ? $this->options['uiCmdMap'] : array();
1248 1248
 			$file['disabled'] = array_merge(array_unique($this->disabled)); // `array_merge` for type array of JSON
1249 1249
 		}
1250 1250
 		
@@ -1259,7 +1259,7 @@  discard block
 block discarded – undo
1259 1259
 	 * @return array|false
1260 1260
 	 * @author Dmitry (dio) Levashov
1261 1261
 	 **/
1262
-	public function dir($hash, $resolveLink=false) {
1262
+	public function dir($hash, $resolveLink = false) {
1263 1263
 		if (($dir = $this->file($hash)) == false) {
1264 1264
 			return $this->setError(elFinder::ERROR_DIR_NOT_FOUND);
1265 1265
 		}
@@ -1323,14 +1323,14 @@  discard block
 block discarded – undo
1323 1323
 	 * @return array|false
1324 1324
 	 * @author Dmitry (dio) Levashov
1325 1325
 	 **/
1326
-	public function tree($hash='', $deep=0, $exclude='') {
1326
+	public function tree($hash = '', $deep = 0, $exclude = '') {
1327 1327
 		$path = $hash ? $this->decode($hash) : $this->root;
1328 1328
 		
1329 1329
 		if (($dir = $this->stat($path)) == false || $dir['mime'] != 'directory') {
1330 1330
 			return false;
1331 1331
 		}
1332 1332
 		
1333
-		$dirs = $this->gettree($path, $deep > 0 ? $deep -1 : $this->treeDeep-1, $exclude ? $this->decode($exclude) : null);
1333
+		$dirs = $this->gettree($path, $deep > 0 ? $deep - 1 : $this->treeDeep - 1, $exclude ? $this->decode($exclude) : null);
1334 1334
 		array_unshift($dirs, $dir);
1335 1335
 		return $dirs;
1336 1336
 	}
@@ -1560,7 +1560,7 @@  discard block
 block discarded – undo
1560 1560
 	 * @return array|false
1561 1561
 	 * @author Dmitry (dio) Levashov
1562 1562
 	 **/
1563
-	public function duplicate($hash, $suffix='copy') {
1563
+	public function duplicate($hash, $suffix = 'copy') {
1564 1564
 		if ($this->commandDisabled('duplicate')) {
1565 1565
 			return $this->setError(elFinder::ERROR_COPY, '#'.$hash, elFinder::ERROR_PERM_DENIED);
1566 1566
 		}
@@ -1636,7 +1636,7 @@  discard block
 block discarded – undo
1636 1636
 		
1637 1637
 		if ($file) { // file exists
1638 1638
 			// check POST data `overwrite` for 3rd party uploader
1639
-			$overwrite = isset($_POST['overwrite'])? (bool)$_POST['overwrite'] : $this->options['uploadOverwrite'];
1639
+			$overwrite = isset($_POST['overwrite']) ? (bool) $_POST['overwrite'] : $this->options['uploadOverwrite'];
1640 1640
 			if ($overwrite) {
1641 1641
 				if (!$file['write']) {
1642 1642
 					return $this->setError(elFinder::ERROR_PERM_DENIED);
@@ -1707,7 +1707,7 @@  discard block
 block discarded – undo
1707 1707
 		if (($test = $volume->closest($src, $rmSrc ? 'locked' : 'read', $rmSrc))) {
1708 1708
 			return $rmSrc
1709 1709
 				? $this->setError($err, $errpath, elFinder::ERROR_LOCKED, $volume->path($test))
1710
-				: $this->setError($err, $errpath, !empty($file['thash'])? elFinder::ERROR_PERM_DENIED : elFinder::ERROR_MKOUTLINK);
1710
+				: $this->setError($err, $errpath, !empty($file['thash']) ? elFinder::ERROR_PERM_DENIED : elFinder::ERROR_MKOUTLINK);
1711 1711
 		}
1712 1712
 
1713 1713
 		$test = $this->joinPathCE($destination, $name);
@@ -1870,7 +1870,7 @@  discard block
 block discarded – undo
1870 1870
 			return $this->setError(elFinder::ERROR_PERM_DENIED);
1871 1871
 		}
1872 1872
 		$this->clearcache();
1873
-		$this->extractToNewdir = is_null($makedir)? 'auto' : (bool)$makedir;
1873
+		$this->extractToNewdir = is_null($makedir) ? 'auto' : (bool) $makedir;
1874 1874
 		
1875 1875
 		if ($path = $this->convEncOut($this->_extract($this->convEncIn($path), $archiver))) {
1876 1876
 			if (is_array($path)) {
@@ -1928,9 +1928,9 @@  discard block
 block discarded – undo
1928 1928
 		if ($name === '') {
1929 1929
 			$name = count($files) == 1 ? $files[0] : 'Archive';
1930 1930
 		} else {
1931
-			$name = str_replace(array('/', '\\'), '_', preg_replace('/\.' . preg_quote($archiver['ext'], '/') . '$/i', '', $name));
1931
+			$name = str_replace(array('/', '\\'), '_', preg_replace('/\.'.preg_quote($archiver['ext'], '/').'$/i', '', $name));
1932 1932
 		}
1933
-		$name .='.' . $archiver['ext'];
1933
+		$name .= '.'.$archiver['ext'];
1934 1934
 		$name = $this->uniqueName($dir, $name, '');
1935 1935
 		$this->clearcache();
1936 1936
 		return ($path = $this->convEncOut($this->_archive($this->convEncIn($dir), $this->convEncIn($files), $this->convEncIn($name), $archiver))) ? $this->stat($path) : false;
@@ -1966,7 +1966,7 @@  discard block
 block discarded – undo
1966 1966
 		
1967 1967
 		$path = $this->decode($hash);
1968 1968
 		
1969
-		$work_path = $this->getWorkFile($this->encoding? $this->convEncIn($path, true) : $path);
1969
+		$work_path = $this->getWorkFile($this->encoding ? $this->convEncIn($path, true) : $path);
1970 1970
 
1971 1971
 		if (!$work_path || !is_writable($work_path)) {
1972 1972
 			if ($work_path && $path !== $work_path && is_file($work_path)) {
@@ -1981,7 +1981,7 @@  discard block
 block discarded – undo
1981 1981
 			}
1982 1982
 		}
1983 1983
 
1984
-		switch($mode) {
1984
+		switch ($mode) {
1985 1985
 			
1986 1986
 			case 'propresize':
1987 1987
 				$result = $this->imgResize($work_path, $width, $height, true, true);
@@ -2077,7 +2077,7 @@  discard block
 block discarded – undo
2077 2077
 		}
2078 2078
 		return ($q === '' || $this->commandDisabled('search'))
2079 2079
 			? array()
2080
-			: $this->doSearch(is_null($dir)? $this->root : $dir, $q, $mimes);
2080
+			: $this->doSearch(is_null($dir) ? $this->root : $dir, $q, $mimes);
2081 2081
 	}
2082 2082
 	
2083 2083
 	/**
@@ -2146,9 +2146,9 @@  discard block
 block discarded – undo
2146 2146
 		$path = ltrim($path, $this->separator);
2147 2147
 		$dirs = explode($this->separator, $path);
2148 2148
 		array_pop($dirs);
2149
-		foreach($dirs as $dir) {
2149
+		foreach ($dirs as $dir) {
2150 2150
 			$targetPath = $this->joinPathCE($base, $dir);
2151
-			if (! $_realpath = $this->realpath($this->encode($targetPath))) {
2151
+			if (!$_realpath = $this->realpath($this->encode($targetPath))) {
2152 2152
 				if ($stat = $this->mkdir($targetHash, $dir)) {
2153 2153
 					$result['added'][] = $stat;
2154 2154
 					$targetHash = $stat['hash'];
@@ -2215,7 +2215,7 @@  discard block
 block discarded – undo
2215 2215
 	 * @author Naoki Sawada
2216 2216
 	 **/
2217 2217
 	protected function dirnameCE($path) {
2218
-		return (!$this->encoding)? $this->_dirname($path) :	$this->convEncOut($this->_dirname($this->convEncIn($path)));
2218
+		return (!$this->encoding) ? $this->_dirname($path) : $this->convEncOut($this->_dirname($this->convEncIn($path)));
2219 2219
 	}
2220 2220
 	
2221 2221
 	/**
@@ -2226,7 +2226,7 @@  discard block
 block discarded – undo
2226 2226
 	 * @author Naoki Sawada
2227 2227
 	 **/
2228 2228
 	protected function basenameCE($path) {
2229
-		return (!$this->encoding)? $this->_basename($path) : $this->convEncOut($this->_basename($this->convEncIn($path)));
2229
+		return (!$this->encoding) ? $this->_basename($path) : $this->convEncOut($this->_basename($this->convEncIn($path)));
2230 2230
 	}
2231 2231
 	
2232 2232
 	/**
@@ -2239,7 +2239,7 @@  discard block
 block discarded – undo
2239 2239
 	 * @author Naoki Sawada
2240 2240
 	 **/
2241 2241
 	protected function joinPathCE($dir, $name) {
2242
-		return (!$this->encoding)? $this->_joinPath($dir, $name) : $this->convEncOut($this->_joinPath($this->convEncIn($dir), $this->convEncIn($name)));
2242
+		return (!$this->encoding) ? $this->_joinPath($dir, $name) : $this->convEncOut($this->_joinPath($this->convEncIn($dir), $this->convEncIn($name)));
2243 2243
 	}
2244 2244
 	
2245 2245
 	/**
@@ -2250,7 +2250,7 @@  discard block
 block discarded – undo
2250 2250
 	 * @author Naoki Sawada
2251 2251
 	 **/
2252 2252
 	protected function normpathCE($path) {
2253
-		return (!$this->encoding)? $this->_normpath($path) : $this->convEncOut($this->_normpath($this->convEncIn($path)));
2253
+		return (!$this->encoding) ? $this->_normpath($path) : $this->convEncOut($this->_normpath($this->convEncIn($path)));
2254 2254
 	}
2255 2255
 	
2256 2256
 	/**
@@ -2261,7 +2261,7 @@  discard block
 block discarded – undo
2261 2261
 	 * @author Naoki Sawada
2262 2262
 	 **/
2263 2263
 	protected function relpathCE($path) {
2264
-		return (!$this->encoding)? $this->_relpath($path) : $this->convEncOut($this->_relpath($this->convEncIn($path)));
2264
+		return (!$this->encoding) ? $this->_relpath($path) : $this->convEncOut($this->_relpath($this->convEncIn($path)));
2265 2265
 	}
2266 2266
 	
2267 2267
 	/**
@@ -2272,7 +2272,7 @@  discard block
 block discarded – undo
2272 2272
 	 * @author Naoki Sawada
2273 2273
 	 **/
2274 2274
 	protected function abspathCE($path) {
2275
-		return (!$this->encoding)? $this->_abspath($path): $this->convEncOut($this->_abspath($this->convEncIn($path)));
2275
+		return (!$this->encoding) ? $this->_abspath($path) : $this->convEncOut($this->_abspath($this->convEncIn($path)));
2276 2276
 	}
2277 2277
 	
2278 2278
 	/**
@@ -2284,7 +2284,7 @@  discard block
 block discarded – undo
2284 2284
 	 * @author Naoki Sawada
2285 2285
 	 **/
2286 2286
 	protected function inpathCE($path, $parent) {
2287
-		return (!$this->encoding)? $this->_inpath($path, $parent) : $this->convEncOut($this->_inpath($this->convEncIn($path), $this->convEncIn($parent)));
2287
+		return (!$this->encoding) ? $this->_inpath($path, $parent) : $this->convEncOut($this->_inpath($this->convEncIn($path), $this->convEncIn($parent)));
2288 2288
 	}
2289 2289
 	
2290 2290
 	/**
@@ -2295,8 +2295,8 @@  discard block
 block discarded – undo
2295 2295
 	 * @return resource|false
2296 2296
 	 * @author Naoki Sawada
2297 2297
 	 **/
2298
-	protected function fopenCE($path, $mode='rb') {
2299
-		return (!$this->encoding)? $this->_fopen($path, $mode) : $this->convEncOut($this->_fopen($this->convEncIn($path), $mode));
2298
+	protected function fopenCE($path, $mode = 'rb') {
2299
+		return (!$this->encoding) ? $this->_fopen($path, $mode) : $this->convEncOut($this->_fopen($this->convEncIn($path), $mode));
2300 2300
 	}
2301 2301
 	
2302 2302
 	/**
@@ -2307,8 +2307,8 @@  discard block
 block discarded – undo
2307 2307
 	 * @return bool
2308 2308
 	 * @author Naoki Sawada
2309 2309
 	 **/
2310
-	protected function fcloseCE($fp, $path='') {
2311
-		return (!$this->encoding)? $this->_fclose($fp, $path) : $this->convEncOut($this->_fclose($fp, $this->convEncIn($path)));
2310
+	protected function fcloseCE($fp, $path = '') {
2311
+		return (!$this->encoding) ? $this->_fclose($fp, $path) : $this->convEncOut($this->_fclose($fp, $this->convEncIn($path)));
2312 2312
 	}
2313 2313
 	
2314 2314
 	/**
@@ -2323,7 +2323,7 @@  discard block
 block discarded – undo
2323 2323
 	 * @author Naoki Sawada
2324 2324
 	 **/
2325 2325
 	protected function saveCE($fp, $dir, $name, $stat) {
2326
-		return (!$this->encoding)? $this->_save($fp, $dir, $name, $stat) : $this->convEncOut($this->_save($fp, $this->convEncIn($dir), $this->convEncIn($name), $this->convEncIn($stat)));
2326
+		return (!$this->encoding) ? $this->_save($fp, $dir, $name, $stat) : $this->convEncOut($this->_save($fp, $this->convEncIn($dir), $this->convEncIn($name), $this->convEncIn($stat)));
2327 2327
 	}
2328 2328
 	
2329 2329
 	/**
@@ -2335,7 +2335,7 @@  discard block
 block discarded – undo
2335 2335
 	 **/
2336 2336
 	protected function subdirsCE($path) {
2337 2337
 		if (!isset($this->subdirsCache[$path])) {
2338
-			$this->subdirsCache[$path] = (!$this->encoding)? $this->_subdirs($path) : $this->convEncOut($this->_subdirs($this->convEncIn($path)));
2338
+			$this->subdirsCache[$path] = (!$this->encoding) ? $this->_subdirs($path) : $this->convEncOut($this->_subdirs($this->convEncIn($path)));
2339 2339
 		}
2340 2340
 		return $this->subdirsCache[$path];
2341 2341
 	}
@@ -2348,7 +2348,7 @@  discard block
 block discarded – undo
2348 2348
 	 * @author Naoki Sawada
2349 2349
 	 **/
2350 2350
 	protected function scandirCE($path) {
2351
-		return (!$this->encoding)? $this->_scandir($path) : $this->convEncOut($this->_scandir($this->convEncIn($path)));
2351
+		return (!$this->encoding) ? $this->_scandir($path) : $this->convEncOut($this->_scandir($this->convEncIn($path)));
2352 2352
 	}
2353 2353
 	
2354 2354
 	/**
@@ -2361,7 +2361,7 @@  discard block
 block discarded – undo
2361 2361
 	 * @author Naoki Sawada
2362 2362
 	 **/
2363 2363
 	protected function symlinkCE($source, $targetDir, $name) {
2364
-		return (!$this->encoding)? $this->_symlink($source, $targetDir, $name) : $this->convEncOut($this->_symlink($this->convEncIn($source), $this->convEncIn($targetDir), $this->convEncIn($name)));
2364
+		return (!$this->encoding) ? $this->_symlink($source, $targetDir, $name) : $this->convEncOut($this->_symlink($this->convEncIn($source), $this->convEncIn($targetDir), $this->convEncIn($name)));
2365 2365
 	}
2366 2366
 	
2367 2367
 	/***************** paths *******************/
@@ -2380,7 +2380,7 @@  discard block
 block discarded – undo
2380 2380
 			// cut ROOT from $path for security reason, even if hacker decodes the path he will not know the root
2381 2381
 			$p = $this->relpathCE($path);
2382 2382
 			// if reqesting root dir $path will be empty, then assign '/' as we cannot leave it blank for crypt
2383
-			if ($p === '')	{
2383
+			if ($p === '') {
2384 2384
 				$p = DIRECTORY_SEPARATOR;
2385 2385
 			}
2386 2386
 
@@ -2413,7 +2413,7 @@  discard block
 block discarded – undo
2413 2413
 			// TODO uncrypt hash and return path
2414 2414
 			$path = $this->uncrypt($h); 
2415 2415
 			// append ROOT to path after it was cut in encode
2416
-			return $this->abspathCE($path);//$this->root.($path == DIRECTORY_SEPARATOR ? '' : DIRECTORY_SEPARATOR.$path); 
2416
+			return $this->abspathCE($path); //$this->root.($path == DIRECTORY_SEPARATOR ? '' : DIRECTORY_SEPARATOR.$path); 
2417 2417
 		}
2418 2418
 	}
2419 2419
 	
@@ -2473,21 +2473,21 @@  discard block
 block discarded – undo
2473 2473
 	 * @author Dmitry (dio) Levashov
2474 2474
 	 **/
2475 2475
 	public function uniqueName($dir, $name, $suffix = ' copy', $checkNum = true, $start = 1) {
2476
-		$ext  = '';
2476
+		$ext = '';
2477 2477
 
2478 2478
 		if (preg_match('/\.((tar\.(gz|bz|bz2|z|lzo))|cpio\.gz|ps\.gz|xcf\.(gz|bz2)|[a-z0-9]{1,4})$/i', $name, $m)) {
2479 2479
 			$ext  = '.'.$m[1];
2480
-			$name = substr($name, 0,  strlen($name)-strlen($m[0]));
2480
+			$name = substr($name, 0, strlen($name) - strlen($m[0]));
2481 2481
 		} 
2482 2482
 		
2483 2483
 		if ($checkNum && preg_match('/('.preg_quote($suffix, '/').')(\d*)$/i', $name, $m)) {
2484
-			$i    = (int)$m[2];
2485
-			$name = substr($name, 0, strlen($name)-strlen($m[2]));
2484
+			$i    = (int) $m[2];
2485
+			$name = substr($name, 0, strlen($name) - strlen($m[2]));
2486 2486
 		} else {
2487 2487
 			$i     = $start;
2488 2488
 			$name .= $suffix;
2489 2489
 		}
2490
-		$max = $i+100000;
2490
+		$max = $i + 100000;
2491 2491
 
2492 2492
 		while ($i <= $max) {
2493 2493
 			$n = $name.($i > 0 ? $i : '').$ext;
@@ -2511,7 +2511,7 @@  discard block
 block discarded – undo
2511 2511
 	 * @author Naoki Sawada
2512 2512
 	 */
2513 2513
 	public function convEncIn($var = null, $restoreLocale = false, $unknown = '_') {
2514
-		return (!$this->encoding)? $var : $this->convEnc($var, 'UTF-8', $this->encoding, $this->options['locale'], $restoreLocale, $unknown);
2514
+		return (!$this->encoding) ? $var : $this->convEnc($var, 'UTF-8', $this->encoding, $this->options['locale'], $restoreLocale, $unknown);
2515 2515
 	}
2516 2516
 	
2517 2517
 	/**
@@ -2524,7 +2524,7 @@  discard block
 block discarded – undo
2524 2524
 	 * @author Naoki Sawada
2525 2525
 	 */
2526 2526
 	public function convEncOut($var = null, $restoreLocale = true, $unknown = '_') {
2527
-		return (!$this->encoding)? $var : $this->convEnc($var, $this->encoding, 'UTF-8', $this->options['locale'], $restoreLocale, $unknown);
2527
+		return (!$this->encoding) ? $var : $this->convEnc($var, $this->encoding, 'UTF-8', $this->options['locale'], $restoreLocale, $unknown);
2528 2528
 	}
2529 2529
 	
2530 2530
 	/**
@@ -2544,7 +2544,7 @@  discard block
 block discarded – undo
2544 2544
 			}
2545 2545
 			if (is_array($var)) {
2546 2546
 				$_ret = array();
2547
-				foreach($var as $_k => $_v) {
2547
+				foreach ($var as $_k => $_v) {
2548 2548
 					$_ret[$_k] = $this->convEnc($_v, $from, $to, '', false, $unknown = '_');
2549 2549
 				}
2550 2550
 				$var = $_ret;
@@ -2556,7 +2556,7 @@  discard block
 block discarded – undo
2556 2556
 						$_var = str_replace('?', $unknown, $_var);
2557 2557
 					}
2558 2558
 				}
2559
-				if  ($_var !== false) {
2559
+				if ($_var !== false) {
2560 2560
 					$var = $_var;
2561 2561
 				}
2562 2562
 			}
@@ -2583,7 +2583,7 @@  discard block
 block discarded – undo
2583 2583
 		
2584 2584
 		$key = '';
2585 2585
 		if ($path !== '') {
2586
-			$key = $this->id . '#' . $path;
2586
+			$key = $this->id.'#'.$path;
2587 2587
 			if (isset($cache[$key])) {
2588 2588
 				return $cache[$key];
2589 2589
 			}
@@ -2615,7 +2615,7 @@  discard block
 block discarded – undo
2615 2615
 		if ($work = $this->getTempFile()) {
2616 2616
 			if ($wfp = fopen($work, 'wb')) {
2617 2617
 				if ($fp = $this->_fopen($path)) {
2618
-					while(!feof($fp)) {
2618
+					while (!feof($fp)) {
2619 2619
 						fwrite($wfp, fread($fp, 8192));
2620 2620
 					}
2621 2621
 					$this->_fclose($fp, $path);
@@ -2659,7 +2659,7 @@  discard block
 block discarded – undo
2659 2659
 			@set_time_limit(30);
2660 2660
 			$stat = $this->stat($this->convEncOut($p));
2661 2661
 			$this->convEncIn();
2662
-			($stat['mime'] === 'directory')? $this->delTree($p) : $this->_unlink($p);
2662
+			($stat['mime'] === 'directory') ? $this->delTree($p) : $this->_unlink($p);
2663 2663
 		}
2664 2664
 		return $this->_rmdir($localpath);
2665 2665
 	}
@@ -2676,7 +2676,7 @@  discard block
 block discarded – undo
2676 2676
 	 * @return bool
2677 2677
 	 * @author Dmitry (dio) Levashov
2678 2678
 	 **/
2679
-	protected function attr($path, $name, $val=null, $isDir=null) {
2679
+	protected function attr($path, $name, $val = null, $isDir = null) {
2680 2680
 		if (!isset($this->defaults[$name])) {
2681 2681
 			return false;
2682 2682
 		}
@@ -2708,7 +2708,7 @@  discard block
 block discarded – undo
2708 2708
 			} 
2709 2709
 		}
2710 2710
 		
2711
-		return $perm === null ? (is_null($val)? $this->defaults[$name] : $val) : !!$perm;
2711
+		return $perm === null ? (is_null($val) ? $this->defaults[$name] : $val) : !!$perm;
2712 2712
 	}
2713 2713
 	
2714 2714
 	/**
@@ -2752,7 +2752,7 @@  discard block
 block discarded – undo
2752 2752
 	protected function allowPutMime($mime) {
2753 2753
 		// logic based on http://httpd.apache.org/docs/2.2/mod/mod_authz_host.html#order
2754 2754
 		$allow  = $this->mimeAccepted($mime, $this->uploadAllow, null);
2755
-		$deny   = $this->mimeAccepted($mime, $this->uploadDeny,  null);
2755
+		$deny   = $this->mimeAccepted($mime, $this->uploadDeny, null);
2756 2756
 		$res = true; // default to allow
2757 2757
 		if (strtolower($this->uploadOrder[0]) == 'allow') { // array('allow', 'deny'), default is to 'deny'
2758 2758
 			$res = false; // default is deny
@@ -2825,10 +2825,10 @@  discard block
 block discarded – undo
2825 2825
 			if ($this->rootName) {
2826 2826
 				$stat['name'] = $this->rootName;
2827 2827
 			}
2828
-			if (! empty($this->options['icon'])) {
2828
+			if (!empty($this->options['icon'])) {
2829 2829
 				$stat['icon'] = $this->options['icon'];
2830 2830
 			}
2831
-			if (! empty($this->options['rootCssClass'])) {
2831
+			if (!empty($this->options['rootCssClass'])) {
2832 2832
 				$stat['csscls'] = $this->options['rootCssClass'];
2833 2833
 			}
2834 2834
 		} else {
@@ -2876,7 +2876,7 @@  discard block
 block discarded – undo
2876 2876
 			// lock when parent directory is not writable
2877 2877
 			if (!isset($stat['locked'])) {
2878 2878
 				$parent = $this->dirnameCE($path);
2879
-				$pstat = isset($this->cache[$parent])? $this->cache[$parent] : array();
2879
+				$pstat = isset($this->cache[$parent]) ? $this->cache[$parent] : array();
2880 2880
 				if (isset($pstat['write']) && !$pstat['write']) {
2881 2881
 					$stat['locked'] = true;
2882 2882
 				}
@@ -2934,7 +2934,7 @@  discard block
 block discarded – undo
2934 2934
 			}
2935 2935
 			if (!isset($stat['url']) && $this->URL && $this->encoding) {
2936 2936
 				$_path = str_replace($this->separator, '/', substr($path, strlen($this->root) + 1));
2937
-				$stat['url'] = rtrim($this->URL, '/') . '/' . str_replace('%2F', '/', rawurlencode((substr(PHP_OS, 0, 3) === 'WIN')? $_path : $this->convEncIn($_path, true)));
2937
+				$stat['url'] = rtrim($this->URL, '/').'/'.str_replace('%2F', '/', rawurlencode((substr(PHP_OS, 0, 3) === 'WIN') ? $_path : $this->convEncIn($_path, true)));
2938 2938
 			}
2939 2939
 		} else {
2940 2940
 			if ($isDir) {
@@ -3057,7 +3057,7 @@  discard block
 block discarded – undo
3057 3057
 				foreach ($mimecf as $line_num => $line) {
3058 3058
 					if (!preg_match('/^\s*#/', $line)) {
3059 3059
 						$mime = preg_split('/\s+/', $line, -1, PREG_SPLIT_NO_EMPTY);
3060
-						for ($i = 1, $size = count($mime); $i < $size ; $i++) {
3060
+						for ($i = 1, $size = count($mime); $i < $size; $i++) {
3061 3061
 							if (!isset(elFinderVolumeDriver::$mimetypes[$mime[$i]])) {
3062 3062
 								elFinderVolumeDriver::$mimetypes[$mime[$i]] = $mime[0];
3063 3063
 							}
@@ -3195,7 +3195,7 @@  discard block
 block discarded – undo
3195 3195
 	 * @return array
3196 3196
 	 * @author Dmitry (dio) Levashov
3197 3197
 	 **/
3198
-	protected function gettree($path, $deep, $exclude='') {
3198
+	protected function gettree($path, $deep, $exclude = '') {
3199 3199
 		$dirs = array();
3200 3200
 		
3201 3201
 		!isset($this->dirsCache[$path]) && $this->cacheDir($path);
@@ -3206,7 +3206,7 @@  discard block
 block discarded – undo
3206 3206
 			if ($stat && empty($stat['hidden']) && $p != $exclude && $stat['mime'] == 'directory') {
3207 3207
 				$dirs[] = $stat;
3208 3208
 				if ($deep > 0 && !empty($stat['dirs'])) {
3209
-					$dirs = array_merge($dirs, $this->gettree($p, $deep-1));
3209
+					$dirs = array_merge($dirs, $this->gettree($p, $deep - 1));
3210 3210
 				}
3211 3211
 			}
3212 3212
 		}
@@ -3226,7 +3226,7 @@  discard block
 block discarded – undo
3226 3226
 	protected function doSearch($path, $q, $mimes) {
3227 3227
 		$result = array();
3228 3228
 
3229
-		foreach($this->scandirCE($path) as $p) {
3229
+		foreach ($this->scandirCE($path) as $p) {
3230 3230
 			@set_time_limit(30);
3231 3231
 			$stat = $this->stat($p);
3232 3232
 
@@ -3247,7 +3247,7 @@  discard block
 block discarded – undo
3247 3247
 					if ($this->encoding) {
3248 3248
 						$path = str_replace('%2F', '/', rawurlencode($this->convEncIn($path, true)));
3249 3249
 					}
3250
-					$stat['url'] = $this->URL . $path;
3250
+					$stat['url'] = $this->URL.$path;
3251 3251
 				}
3252 3252
 				
3253 3253
 				$result[] = $stat;
@@ -3281,7 +3281,7 @@  discard block
 block discarded – undo
3281 3281
 			if (!$this->inpathCE($target, $this->root)) {
3282 3282
 				return $this->setError(elFinder::ERROR_COPY, $this->path($srcStat['hash']), elFinder::ERROR_MKOUTLINK);
3283 3283
 			}
3284
-			$stat   = $this->stat($target);
3284
+			$stat = $this->stat($target);
3285 3285
 			$this->clearcache();
3286 3286
 			return $stat && $this->symlinkCE($target, $dst, $name)
3287 3287
 				? $this->joinPathCE($dst, $name)
@@ -3562,15 +3562,15 @@  discard block
 block discarded – undo
3562 3562
 		}
3563 3563
 
3564 3564
 		/* If image smaller or equal thumbnail size - just fitting to thumbnail square */
3565
-		if ($s[0] <= $tmbSize && $s[1]	<= $tmbSize) {
3566
-			$result = $this->imgSquareFit($tmb, $tmbSize, $tmbSize, 'center', 'middle', $this->options['tmbBgColor'], 'png' );
3565
+		if ($s[0] <= $tmbSize && $s[1] <= $tmbSize) {
3566
+			$result = $this->imgSquareFit($tmb, $tmbSize, $tmbSize, 'center', 'middle', $this->options['tmbBgColor'], 'png');
3567 3567
 		} else {
3568 3568
 		
3569 3569
 			if ($this->options['tmbCrop']) {
3570 3570
 		
3571 3571
 				$result = $tmb;
3572 3572
 				/* Resize and crop if image bigger than thumbnail */
3573
-				if (!(($s[0] > $tmbSize && $s[1] <= $tmbSize) || ($s[0] <= $tmbSize && $s[1] > $tmbSize) ) || ($s[0] > $tmbSize && $s[1] > $tmbSize)) {
3573
+				if (!(($s[0] > $tmbSize && $s[1] <= $tmbSize) || ($s[0] <= $tmbSize && $s[1] > $tmbSize)) || ($s[0] > $tmbSize && $s[1] > $tmbSize)) {
3574 3574
 					$result = $this->imgResize($tmb, $tmbSize, $tmbSize, true, false, 'png');
3575 3575
 				}
3576 3576
 		
@@ -3587,7 +3587,7 @@  discard block
 block discarded – undo
3587 3587
 			}
3588 3588
 		
3589 3589
 			if ($result) {
3590
-				$result = $this->imgSquareFit($result, $tmbSize, $tmbSize, 'center', 'middle', $this->options['tmbBgColor'], 'png' );
3590
+				$result = $this->imgSquareFit($result, $tmbSize, $tmbSize, 'center', 'middle', $this->options['tmbBgColor'], 'png');
3591 3591
 			}
3592 3592
 		}
3593 3593
 		
@@ -3628,18 +3628,18 @@  discard block
 block discarded – undo
3628 3628
 			/* Resizing by biggest side */
3629 3629
 			if ($resizeByBiggerSide) {
3630 3630
 				if ($orig_w > $orig_h) {
3631
-					$size_h = round($orig_h * $width / $orig_w);
3631
+					$size_h = round($orig_h*$width/$orig_w);
3632 3632
 					$size_w = $width;
3633 3633
 				} else {
3634
-					$size_w = round($orig_w * $height / $orig_h);
3634
+					$size_w = round($orig_w*$height/$orig_h);
3635 3635
 					$size_h = $height;
3636 3636
 				}
3637 3637
 			} else {
3638 3638
 				if ($orig_w > $orig_h) {
3639
-					$size_w = round($orig_w * $height / $orig_h);
3639
+					$size_w = round($orig_w*$height/$orig_h);
3640 3640
 					$size_h = $height;
3641 3641
 				} else {
3642
-					$size_h = round($orig_h * $width / $orig_w);
3642
+					$size_h = round($orig_h*$width/$orig_w);
3643 3643
 					$size_w = $width;
3644 3644
 				}
3645 3645
 			}
@@ -3657,7 +3657,7 @@  discard block
 block discarded – undo
3657 3657
 				// Imagick::FILTER_BOX faster than FILTER_LANCZOS so use for createTmb
3658 3658
 				// resize bench: http://app-mgng.rhcloud.com/9
3659 3659
 				// resize sample: http://www.dylanbeattie.net/magick/filters/result.html
3660
-				$filter = ($destformat === 'png' /* createTmb */)? Imagick::FILTER_BOX : Imagick::FILTER_LANCZOS;
3660
+				$filter = ($destformat === 'png' /* createTmb */) ? Imagick::FILTER_BOX : Imagick::FILTER_LANCZOS;
3661 3661
 				
3662 3662
 				$ani = ($img->getNumberImages() > 1);
3663 3663
 				if ($ani && is_null($destformat)) {
@@ -3682,11 +3682,11 @@  discard block
 block discarded – undo
3682 3682
 				break;
3683 3683
 
3684 3684
 			case 'gd':
3685
-				$img = self::gdImageCreate($path,$s['mime']);
3685
+				$img = self::gdImageCreate($path, $s['mime']);
3686 3686
 
3687
-				if ($img &&  false != ($tmp = imagecreatetruecolor($size_w, $size_h))) {
3687
+				if ($img && false != ($tmp = imagecreatetruecolor($size_w, $size_h))) {
3688 3688
 				
3689
-					self::gdImageBackground($tmp,$this->options['tmbBgColor']);
3689
+					self::gdImageBackground($tmp, $this->options['tmbBgColor']);
3690 3690
 					
3691 3691
 					if (!imagecopyresampled($tmp, $img, 0, 0, 0, 0, $size_w, $size_h, $s[0], $s[1])) {
3692 3692
 						return false;
@@ -3762,11 +3762,11 @@  discard block
 block discarded – undo
3762 3762
 				break;
3763 3763
 
3764 3764
 			case 'gd':
3765
-				$img = self::gdImageCreate($path,$s['mime']);
3765
+				$img = self::gdImageCreate($path, $s['mime']);
3766 3766
 
3767
-				if ($img &&  false != ($tmp = imagecreatetruecolor($width, $height))) {
3767
+				if ($img && false != ($tmp = imagecreatetruecolor($width, $height))) {
3768 3768
 					
3769
-					self::gdImageBackground($tmp,$this->options['tmbBgColor']);
3769
+					self::gdImageBackground($tmp, $this->options['tmbBgColor']);
3770 3770
 
3771 3771
 					$size_w = $width;
3772 3772
 					$size_h = $height;
@@ -3816,8 +3816,8 @@  discard block
 block discarded – undo
3816 3816
 		$result = false;
3817 3817
 
3818 3818
 		/* Coordinates for image over square aligning */
3819
-		$y = ceil(abs($height - $s[1]) / 2); 
3820
-		$x = ceil(abs($width - $s[0]) / 2);
3819
+		$y = ceil(abs($height - $s[1])/2); 
3820
+		$x = ceil(abs($width - $s[0])/2);
3821 3821
 
3822 3822
 		switch ($this->imgLib) {
3823 3823
 			case 'imagick':
@@ -3837,7 +3837,7 @@  discard block
 block discarded – undo
3837 3837
 						$gif->newImage($width, $height, new ImagickPixel($bgcolor));
3838 3838
 						$gif->setImageColorspace($img->getImageColorspace());
3839 3839
 						$gif->setImageFormat('gif');
3840
-						$gif->compositeImage( $img, imagick::COMPOSITE_OVER, $x, $y );
3840
+						$gif->compositeImage($img, imagick::COMPOSITE_OVER, $x, $y);
3841 3841
 						$gif->setImageDelay($img->getImageDelay());
3842 3842
 						$gif->setImageIterations($img->getImageIterations());
3843 3843
 						$img1->addImage($gif);
@@ -3853,7 +3853,7 @@  discard block
 block discarded – undo
3853 3853
 					$img1->newImage($width, $height, new ImagickPixel($bgcolor));
3854 3854
 					$img1->setImageColorspace($img->getImageColorspace());
3855 3855
 					$img1->setImageFormat($destformat != null ? $destformat : $img->getFormat());
3856
-					$img1->compositeImage( $img, imagick::COMPOSITE_OVER, $x, $y );
3856
+					$img1->compositeImage($img, imagick::COMPOSITE_OVER, $x, $y);
3857 3857
 					$result = $img1->writeImage($path);
3858 3858
 				}
3859 3859
 				
@@ -3864,11 +3864,11 @@  discard block
 block discarded – undo
3864 3864
 				break;
3865 3865
 
3866 3866
 			case 'gd':
3867
-				$img = self::gdImageCreate($path,$s['mime']);
3867
+				$img = self::gdImageCreate($path, $s['mime']);
3868 3868
 
3869
-				if ($img &&  false != ($tmp = imagecreatetruecolor($width, $height))) {
3869
+				if ($img && false != ($tmp = imagecreatetruecolor($width, $height))) {
3870 3870
 
3871
-					self::gdImageBackground($tmp,$bgcolor);
3871
+					self::gdImageBackground($tmp, $bgcolor);
3872 3872
 
3873 3873
 					if (!imagecopy($tmp, $img, $x, $y, 0, 0, $s[0], $s[1])) {
3874 3874
 						return false;
@@ -3899,15 +3899,15 @@  discard block
 block discarded – undo
3899 3899
 	 * @author Troex Nevelin
3900 3900
 	 **/
3901 3901
 	protected function imgRotate($path, $degree, $bgcolor = '#ffffff', $destformat = null) {
3902
-		if (($s = @getimagesize($path)) == false || $degree % 360 === 0) {
3902
+		if (($s = @getimagesize($path)) == false || $degree%360 === 0) {
3903 3903
 			return false;
3904 3904
 		}
3905 3905
 
3906 3906
 		$result = false;
3907 3907
 
3908 3908
 		// try lossless rotate
3909
-		if ($degree % 90 === 0 && in_array($s[2], array(IMAGETYPE_JPEG, IMAGETYPE_JPEG2000))) {
3910
-			$count = ($degree / 90) % 4;
3909
+		if ($degree%90 === 0 && in_array($s[2], array(IMAGETYPE_JPEG, IMAGETYPE_JPEG2000))) {
3910
+			$count = ($degree/90)%4;
3911 3911
 			$exiftran = array(
3912 3912
 				1 => '-9',
3913 3913
 				2 => '-1',
@@ -3923,7 +3923,7 @@  discard block
 block discarded – undo
3923 3923
 				'exiftran -i '.$exiftran[$count].' '.$path,
3924 3924
 				'jpegtran -rotate '.$jpegtran[$count].' -copy all -outfile '.$quotedPath.' '.$quotedPath
3925 3925
 			);
3926
-			foreach($cmds as $cmd) {
3926
+			foreach ($cmds as $cmd) {
3927 3927
 				if ($this->procExec($cmd) === 0) {
3928 3928
 					$result = true;
3929 3929
 					break;
@@ -3959,12 +3959,12 @@  discard block
 block discarded – undo
3959 3959
 				break;
3960 3960
 
3961 3961
 			case 'gd':
3962
-				$img = self::gdImageCreate($path,$s['mime']);
3962
+				$img = self::gdImageCreate($path, $s['mime']);
3963 3963
 
3964 3964
 				$degree = 360 - $degree;
3965 3965
 				list($r, $g, $b) = sscanf($bgcolor, "#%02x%02x%02x");
3966 3966
 				$bgcolor = imagecolorallocate($img, $r, $g, $b);
3967
-				$tmp = imageRotate($img, $degree, (int)$bgcolor);
3967
+				$tmp = imageRotate($img, $degree, (int) $bgcolor);
3968 3968
 
3969 3969
 				$result = self::gdImage($tmp, $path, $destformat, $s['mime']);
3970 3970
 
@@ -3989,11 +3989,11 @@  discard block
 block discarded – undo
3989 3989
 	 * @return int     exit code
3990 3990
 	 * @author Alexey Sukhotin
3991 3991
 	 **/
3992
-	protected function procExec($command , array &$output = null, &$return_var = -1, array &$error_output = null) {
3992
+	protected function procExec($command, array &$output = null, &$return_var = -1, array &$error_output = null) {
3993 3993
 
3994 3994
 		$descriptorspec = array(
3995
-			0 => array("pipe", "r"),  // stdin
3996
-			1 => array("pipe", "w"),  // stdout
3995
+			0 => array("pipe", "r"), // stdin
3996
+			1 => array("pipe", "w"), // stdout
3997 3997
 			2 => array("pipe", "w")   // stderr
3998 3998
 		);
3999 3999
 
@@ -4050,8 +4050,8 @@  discard block
 block discarded – undo
4050 4050
 	 * @param string $mime
4051 4051
 	 * @return gd image resource identifier
4052 4052
 	 */
4053
-	protected function gdImageCreate($path,$mime){
4054
-		switch($mime){
4053
+	protected function gdImageCreate($path, $mime) {
4054
+		switch ($mime) {
4055 4055
 			case 'image/jpeg':
4056 4056
 			return imagecreatefromjpeg($path);
4057 4057
 
@@ -4075,7 +4075,7 @@  discard block
 block discarded – undo
4075 4075
 	 * @param string $destformat The Image type to use for $filename
4076 4076
 	 * @param string $mime The original image mime type
4077 4077
 	 */
4078
-	protected function gdImage($image, $filename, $destformat, $mime ){
4078
+	protected function gdImage($image, $filename, $destformat, $mime) {
4079 4079
 
4080 4080
 		if ($destformat == 'jpg' || ($destformat == null && $mime == 'image/jpeg')) {
4081 4081
 			return imagejpeg($image, $filename, 100);
@@ -4094,13 +4094,13 @@  discard block
 block discarded – undo
4094 4094
 	 * @param resource $image gd image resource
4095 4095
 	 * @param string $bgcolor background color in #rrggbb format
4096 4096
 	 */
4097
-	protected function gdImageBackground($image, $bgcolor){
4097
+	protected function gdImageBackground($image, $bgcolor) {
4098 4098
 
4099
-		if( $bgcolor == 'transparent' ){
4100
-			imagesavealpha($image,true);
4099
+		if ($bgcolor == 'transparent') {
4100
+			imagesavealpha($image, true);
4101 4101
 			$bgcolor1 = imagecolorallocatealpha($image, 255, 255, 255, 127);
4102 4102
 
4103
-		}else{
4103
+		} else {
4104 4104
 			list($r, $g, $b) = sscanf($bgcolor, "#%02x%02x%02x");
4105 4105
 			$bgcolor1 = imagecolorallocate($image, $r, $g, $b);
4106 4106
 		}
@@ -4138,13 +4138,13 @@  discard block
 block discarded – undo
4138 4138
 	* @return int|bool
4139 4139
 	* @author Alexey Sukhotin
4140 4140
 	**/
4141
-	protected function stripos($haystack , $needle , $offset = 0) {
4141
+	protected function stripos($haystack, $needle, $offset = 0) {
4142 4142
 		if (function_exists('mb_stripos')) {
4143
-			return mb_stripos($haystack , $needle , $offset, 'UTF-8');
4143
+			return mb_stripos($haystack, $needle, $offset, 'UTF-8');
4144 4144
 		} else if (function_exists('mb_strtolower') && function_exists('mb_strpos')) {
4145 4145
 			return mb_strpos(mb_strtolower($haystack, 'UTF-8'), mb_strtolower($needle, 'UTF-8'), $offset);
4146 4146
 		} 
4147
-		return stripos($haystack , $needle , $offset);
4147
+		return stripos($haystack, $needle, $offset);
4148 4148
 	}
4149 4149
 
4150 4150
 	/**
@@ -4194,22 +4194,22 @@  discard block
 block discarded – undo
4194 4194
 			unset($o);
4195 4195
 			$this->procExec('zip -v', $o, $c);
4196 4196
 			if ($c == 0) {
4197
-				$arcs['create']['application/zip']  = array('cmd' => 'zip', 'argc' => '-r9', 'ext' => 'zip');
4197
+				$arcs['create']['application/zip'] = array('cmd' => 'zip', 'argc' => '-r9', 'ext' => 'zip');
4198 4198
 			}
4199 4199
 			unset($o);
4200 4200
 			$this->procExec('unzip --help', $o, $c);
4201 4201
 			if ($c == 0) {
4202
-				$arcs['extract']['application/zip'] = array('cmd' => 'unzip', 'argc' => '',  'ext' => 'zip');
4202
+				$arcs['extract']['application/zip'] = array('cmd' => 'unzip', 'argc' => '', 'ext' => 'zip');
4203 4203
 			}
4204 4204
 			unset($o);
4205 4205
 			$this->procExec('rar --version', $o, $c);
4206 4206
 			if ($c == 0 || $c == 7) {
4207 4207
 				$arcs['create']['application/x-rar']  = array('cmd' => 'rar', 'argc' => 'a -inul', 'ext' => 'rar');
4208
-				$arcs['extract']['application/x-rar'] = array('cmd' => 'rar', 'argc' => 'x -y',    'ext' => 'rar');
4208
+				$arcs['extract']['application/x-rar'] = array('cmd' => 'rar', 'argc' => 'x -y', 'ext' => 'rar');
4209 4209
 			} else {
4210 4210
 				unset($o);
4211 4211
 				$test = $this->procExec('unrar', $o, $c);
4212
-				if ($c==0 || $c == 7) {
4212
+				if ($c == 0 || $c == 7) {
4213 4213
 					$arcs['extract']['application/x-rar'] = array('cmd' => 'unrar', 'argc' => 'x -y', 'ext' => 'rar');
4214 4214
 				}
4215 4215
 			}
@@ -4231,7 +4231,7 @@  discard block
 block discarded – undo
4231 4231
 				if (empty($arcs['extract']['application/x-tar'])) {
4232 4232
 					$arcs['extract']['application/x-tar'] = array('cmd' => '7za', 'argc' => 'x -ttar -y', 'ext' => 'tar');
4233 4233
 				}
4234
-			} else if (substr(PHP_OS,0,3) === 'WIN') {
4234
+			} else if (substr(PHP_OS, 0, 3) === 'WIN') {
4235 4235
 				// check `7z` for Windows server.
4236 4236
 				unset($o);
4237 4237
 				$this->procExec('7z', $o, $c);
@@ -4285,22 +4285,22 @@  discard block
 block discarded – undo
4285 4285
 
4286 4286
 		// normalize `/../`
4287 4287
 		$normreg = '#('.$sepquoted.')[^'.$sepquoted.']+'.$sepquoted.'\.\.'.$sepquoted.'#';
4288
-		while(preg_match($normreg, $path)) {
4288
+		while (preg_match($normreg, $path)) {
4289 4289
 			$path = preg_replace($normreg, '$1', $path);
4290 4290
 		}
4291 4291
 		
4292 4292
 		// 'Here'
4293
-		if ($path === '' || $path === '.' . $separator) return $base;
4293
+		if ($path === '' || $path === '.'.$separator) return $base;
4294 4294
 		
4295 4295
 		// Absolute path
4296 4296
 		if ($path[0] === $separator || strpos($path, $systemroot) === 0) {
4297 4297
 			return $path;
4298 4298
 		}
4299 4299
 		
4300
-		$preg_separator = '#' . $sepquoted . '#';
4300
+		$preg_separator = '#'.$sepquoted.'#';
4301 4301
 		
4302 4302
 		// Relative path from 'Here'
4303
-		if (substr($path, 0, 2) === '.' . $separator || $path[0] !== '.' || substr($path, 0, 3) !== '..' . $separator) {
4303
+		if (substr($path, 0, 2) === '.'.$separator || $path[0] !== '.' || substr($path, 0, 3) !== '..'.$separator) {
4304 4304
 			$arrn = preg_split($preg_separator, $path, -1, PREG_SPLIT_NO_EMPTY);
4305 4305
 			if ($arrn[0] !== '.') {
4306 4306
 				array_unshift($arrn, '.');
@@ -4314,12 +4314,11 @@  discard block
 block discarded – undo
4314 4314
 			$arrn = preg_split($preg_separator, $path, -1, PREG_SPLIT_NO_EMPTY);
4315 4315
 			$arrp = preg_split($preg_separator, $base, -1, PREG_SPLIT_NO_EMPTY);
4316 4316
 		
4317
-			while (! empty($arrn) && $arrn[0] === '..') {
4317
+			while (!empty($arrn) && $arrn[0] === '..') {
4318 4318
 				array_shift($arrn);
4319 4319
 				array_pop($arrp);
4320 4320
 			}
4321
-			$path = ! empty($arrp) ? $systemroot . join($separator, array_merge($arrp, $arrn)) :
4322
-				(! empty($arrn) ? $systemroot . join($separator, $arrn) : $systemroot);
4321
+			$path = !empty($arrp) ? $systemroot.join($separator, array_merge($arrp, $arrn)) : (!empty($arrn) ? $systemroot.join($separator, $arrn) : $systemroot);
4323 4322
 		}
4324 4323
 		
4325 4324
 		return $path;
@@ -4337,7 +4336,7 @@  discard block
 block discarded – undo
4337 4336
 			@chmod($dir, 0777);
4338 4337
 			foreach (array_diff(scandir($dir), array('.', '..')) as $file) {
4339 4338
 				@set_time_limit(30);
4340
-				$path = $dir . DIRECTORY_SEPARATOR . $file;
4339
+				$path = $dir.DIRECTORY_SEPARATOR.$file;
4341 4340
 				if (!is_link($dir) && is_dir($path)) {
4342 4341
 					$this->rmdirRecursive($path);
4343 4342
 				} else {
@@ -4424,22 +4423,22 @@  discard block
 block discarded – undo
4424 4423
 		try {
4425 4424
 			if ($start = is_string($zipPath)) {
4426 4425
 				$zip = new ZipArchive();
4427
-				if ($zip->open($dir . DIRECTORY_SEPARATOR . $zipPath, ZipArchive::CREATE) !== true) {
4426
+				if ($zip->open($dir.DIRECTORY_SEPARATOR.$zipPath, ZipArchive::CREATE) !== true) {
4428 4427
 					$zip = false;
4429 4428
 				}
4430 4429
 			} else {
4431 4430
 				$zip = $zipPath;
4432 4431
 			}
4433 4432
 			if ($zip) {
4434
-				foreach($files as $file) {
4435
-					$path = $dir . DIRECTORY_SEPARATOR . $file;
4433
+				foreach ($files as $file) {
4434
+					$path = $dir.DIRECTORY_SEPARATOR.$file;
4436 4435
 					if (is_dir($path)) {
4437 4436
 						$zip->addEmptyDir($file);
4438 4437
 						$_files = array();
4439 4438
 						if ($handle = opendir($path)) {
4440 4439
 							while (false !== ($entry = readdir($handle))) {
4441 4440
 								if ($entry !== "." && $entry !== "..") {
4442
-									$_files[] = $file . DIRECTORY_SEPARATOR . $entry;
4441
+									$_files[] = $file.DIRECTORY_SEPARATOR.$entry;
4443 4442
 								}
4444 4443
 							}
4445 4444
 							closedir($handle);
@@ -4624,7 +4623,7 @@  discard block
 block discarded – undo
4624 4623
 	 * @return resource|false
4625 4624
 	 * @author Dmitry (dio) Levashov
4626 4625
 	 **/
4627
-	abstract protected function _fopen($path, $mode="rb");
4626
+	abstract protected function _fopen($path, $mode = "rb");
4628 4627
 	
4629 4628
 	/**
4630 4629
 	 * Close opened file
@@ -4634,7 +4633,7 @@  discard block
 block discarded – undo
4634 4633
 	 * @return bool
4635 4634
 	 * @author Dmitry (dio) Levashov
4636 4635
 	 **/
4637
-	abstract protected function _fclose($fp, $path='');
4636
+	abstract protected function _fclose($fp, $path = '');
4638 4637
 	
4639 4638
 	/********************  file/dir manipulations *************************/
4640 4639
 	
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.