Completed
Push — 2.x ( 6ff22e...55a998 )
by Naoki
04:44
created
php/plugins/Normalizer/plugin.php 3 patches
Braces   +12 added lines, -8 removed lines patch added patch discarded remove patch
@@ -104,20 +104,24 @@
 block discarded – undo
104 104
 	private function normalize($str, $opts) {
105 105
 		if ($opts['nfc'] || $opts['nfkc']) {
106 106
 			if (class_exists('Normalizer')) {
107
-				if ($opts['nfc'] && ! Normalizer::isNormalized($str, Normalizer::FORM_C))
108
-					$str = Normalizer::normalize($str, Normalizer::FORM_C);
109
-				if ($opts['nfkc'] && ! Normalizer::isNormalized($str, Normalizer::FORM_KC))
110
-					$str = Normalizer::normalize($str, Normalizer::FORM_KC);
107
+				if ($opts['nfc'] && ! Normalizer::isNormalized($str, Normalizer::FORM_C)) {
108
+									$str = Normalizer::normalize($str, Normalizer::FORM_C);
109
+				}
110
+				if ($opts['nfkc'] && ! Normalizer::isNormalized($str, Normalizer::FORM_KC)) {
111
+									$str = Normalizer::normalize($str, Normalizer::FORM_KC);
112
+				}
111 113
 			} else {
112 114
 				if (! class_exists('I18N_UnicodeNormalizer')) {
113 115
 					@ include_once 'I18N/UnicodeNormalizer.php';
114 116
 				}
115 117
 				if (class_exists('I18N_UnicodeNormalizer')) {
116 118
 					$normalizer = new I18N_UnicodeNormalizer();
117
-					if ($opts['nfc'])
118
-						$str = $normalizer->normalize($str, 'NFC');
119
-					if ($opts['nfkc'])
120
-						$str = $normalizer->normalize($str, 'NFKC');
119
+					if ($opts['nfc']) {
120
+											$str = $normalizer->normalize($str, 'NFC');
121
+					}
122
+					if ($opts['nfkc']) {
123
+											$str = $normalizer->normalize($str, 'NFKC');
124
+					}
121 125
 				}
122 126
 			}
123 127
 		}
Please login to merge, or discard this 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.
Indentation   +52 added lines, -52 removed lines patch added patch discarded remove patch
@@ -1,57 +1,57 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * elFinder Plugin Normalizer
4
- * 
5
- * UTF-8 Normalizer of file-name and file-path etc.
6
- * nfc(NFC): Canonical Decomposition followed by Canonical Composition
7
- * nfkc(NFKC): Compatibility Decomposition followed by Canonical
8
- * 
9
- * This plugin require Class "Normalizer" (PHP 5 >= 5.3.0, PECL intl >= 1.0.0)
10
- * or PEAR package "I18N_UnicodeNormalizer"
11
- * 
12
- * ex. binding, configure on connector options
13
- *	$opts = array(
14
- *		'bind' => array(
15
- *			'upload.pre mkdir.pre mkfile.pre rename.pre archive.pre' => array(
16
- *				'Plugin.Normalizer.cmdPreprocess'
17
- *			),
18
- *			'upload.presave' => array(
19
- *				'Plugin.Normalizer.onUpLoadPreSave'
20
- *			)
21
- *		),
22
- *		// global configure (optional)
23
- *		'plugin' => array(
24
- *			'Normalizer' => array(
25
- *				'enable'    => true,
26
- *				'nfc'       => true,
27
- *				'nfkc'      => true,
28
- *				'lowercase' => false,
29
- * 				'convmap'   => array()
30
- *			)
31
- *		),
32
- *		// each volume configure (optional)
33
- *		'roots' => array(
34
- *			array(
35
- *				'driver' => 'LocalFileSystem',
36
- *				'path'   => '/path/to/files/',
37
- *				'URL'    => 'http://localhost/to/files/'
38
- *				'plugin' => array(
39
- *					'Normalizer' => array(
40
- *						'enable'    => true,
41
- *						'nfc'       => true,
42
- *						'nfkc'      => true,
43
- * 						'lowercase' => false,
44
- * 						'convmap'   => array()
45
- *					)
46
- *				)
47
- *			)
48
- *		)
49
- *	);
50
- *
51
- * @package elfinder
52
- * @author Naoki Sawada
53
- * @license New BSD
54
- */
3
+	 * elFinder Plugin Normalizer
4
+	 * 
5
+	 * UTF-8 Normalizer of file-name and file-path etc.
6
+	 * nfc(NFC): Canonical Decomposition followed by Canonical Composition
7
+	 * nfkc(NFKC): Compatibility Decomposition followed by Canonical
8
+	 * 
9
+	 * This plugin require Class "Normalizer" (PHP 5 >= 5.3.0, PECL intl >= 1.0.0)
10
+	 * or PEAR package "I18N_UnicodeNormalizer"
11
+	 * 
12
+	 * ex. binding, configure on connector options
13
+	 *	$opts = array(
14
+	 *		'bind' => array(
15
+	 *			'upload.pre mkdir.pre mkfile.pre rename.pre archive.pre' => array(
16
+	 *				'Plugin.Normalizer.cmdPreprocess'
17
+	 *			),
18
+	 *			'upload.presave' => array(
19
+	 *				'Plugin.Normalizer.onUpLoadPreSave'
20
+	 *			)
21
+	 *		),
22
+	 *		// global configure (optional)
23
+	 *		'plugin' => array(
24
+	 *			'Normalizer' => array(
25
+	 *				'enable'    => true,
26
+	 *				'nfc'       => true,
27
+	 *				'nfkc'      => true,
28
+	 *				'lowercase' => false,
29
+	 * 				'convmap'   => array()
30
+	 *			)
31
+	 *		),
32
+	 *		// each volume configure (optional)
33
+	 *		'roots' => array(
34
+	 *			array(
35
+	 *				'driver' => 'LocalFileSystem',
36
+	 *				'path'   => '/path/to/files/',
37
+	 *				'URL'    => 'http://localhost/to/files/'
38
+	 *				'plugin' => array(
39
+	 *					'Normalizer' => array(
40
+	 *						'enable'    => true,
41
+	 *						'nfc'       => true,
42
+	 *						'nfkc'      => true,
43
+	 * 						'lowercase' => false,
44
+	 * 						'convmap'   => array()
45
+	 *					)
46
+	 *				)
47
+	 *			)
48
+	 *		)
49
+	 *	);
50
+	 *
51
+	 * @package elfinder
52
+	 * @author Naoki Sawada
53
+	 * @license New BSD
54
+	 */
55 55
 class elFinderPluginNormalizer
56 56
 {
57 57
 	private $opts = array();
Please login to merge, or discard this patch.
php/plugins/Sanitizer/plugin.php 2 patches
Indentation   +43 added lines, -43 removed lines patch added patch discarded remove patch
@@ -1,48 +1,48 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * elFinder Plugin Sanitizer
4
- *
5
- * Sanitizer of file-name and file-path etc.
6
- *
7
- * ex. binding, configure on connector options
8
- *	$opts = array(
9
- *		'bind' => array(
10
- *			'upload.pre mkdir.pre mkfile.pre rename.pre archive.pre' => array(
11
- *				'Plugin.Sanitizer.cmdPreprocess'
12
- *			),
13
- *			'upload.presave' => array(
14
- *				'Plugin.Sanitizer.onUpLoadPreSave'
15
- *			)
16
- *		),
17
- *		// global configure (optional)
18
- *		'plugin' => array(
19
- *			'Sanitizer' => array(
20
- *				'enable' => true,
21
- *				'targets'  => array('\\','/',':','*','?','"','<','>','|'), // target chars
22
- *				'replace'  => '_'    // replace to this
23
- *			)
24
- *		),
25
- *		// each volume configure (optional)
26
- *		'roots' => array(
27
- *			array(
28
- *				'driver' => 'LocalFileSystem',
29
- *				'path'   => '/path/to/files/',
30
- *				'URL'    => 'http://localhost/to/files/'
31
- *				'plugin' => array(
32
- *					'Sanitizer' => array(
33
- *						'enable' => true,
34
- *						'targets'  => array('\\','/',':','*','?','"','<','>','|'), // target chars
35
- *						'replace'  => '_'    // replace to this
36
- *					)
37
- *				)
38
- *			)
39
- *		)
40
- *	);
41
- *
42
- * @package elfinder
43
- * @author Naoki Sawada
44
- * @license New BSD
45
- */
3
+	 * elFinder Plugin Sanitizer
4
+	 *
5
+	 * Sanitizer of file-name and file-path etc.
6
+	 *
7
+	 * ex. binding, configure on connector options
8
+	 *	$opts = array(
9
+	 *		'bind' => array(
10
+	 *			'upload.pre mkdir.pre mkfile.pre rename.pre archive.pre' => array(
11
+	 *				'Plugin.Sanitizer.cmdPreprocess'
12
+	 *			),
13
+	 *			'upload.presave' => array(
14
+	 *				'Plugin.Sanitizer.onUpLoadPreSave'
15
+	 *			)
16
+	 *		),
17
+	 *		// global configure (optional)
18
+	 *		'plugin' => array(
19
+	 *			'Sanitizer' => array(
20
+	 *				'enable' => true,
21
+	 *				'targets'  => array('\\','/',':','*','?','"','<','>','|'), // target chars
22
+	 *				'replace'  => '_'    // replace to this
23
+	 *			)
24
+	 *		),
25
+	 *		// each volume configure (optional)
26
+	 *		'roots' => array(
27
+	 *			array(
28
+	 *				'driver' => 'LocalFileSystem',
29
+	 *				'path'   => '/path/to/files/',
30
+	 *				'URL'    => 'http://localhost/to/files/'
31
+	 *				'plugin' => array(
32
+	 *					'Sanitizer' => array(
33
+	 *						'enable' => true,
34
+	 *						'targets'  => array('\\','/',':','*','?','"','<','>','|'), // target chars
35
+	 *						'replace'  => '_'    // replace to this
36
+	 *					)
37
+	 *				)
38
+	 *			)
39
+	 *		)
40
+	 *	);
41
+	 *
42
+	 * @package elfinder
43
+	 * @author Naoki Sawada
44
+	 * @license New BSD
45
+	 */
46 46
 class elFinderPluginSanitizer
47 47
 {
48 48
 	private $opts = array();
Please login to merge, or discard this 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/elFinderVolumeLocalFileSystem.class.php 3 patches
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -5,19 +5,19 @@
 block discarded – undo
5 5
 if (! class_exists('RecursiveCallbackFilterIterator', false)) {
6 6
 	class RecursiveCallbackFilterIterator extends RecursiveFilterIterator {
7 7
 	   
8
-	    public function __construct ( RecursiveIterator $iterator, $callback ) {
9
-	        $this->callback = $callback;
10
-	        parent::__construct($iterator);
11
-	    }
8
+		public function __construct ( RecursiveIterator $iterator, $callback ) {
9
+			$this->callback = $callback;
10
+			parent::__construct($iterator);
11
+		}
12 12
 	   
13
-	    public function accept () {
14
-	        $callback = $this->callback;
15
-	        return $callback(parent::current(), parent::key(), parent::getInnerIterator());
16
-	    }
13
+		public function accept () {
14
+			$callback = $this->callback;
15
+			return $callback(parent::current(), parent::key(), parent::getInnerIterator());
16
+		}
17 17
 	   
18
-	    public function getChildren () {
19
-	        return new self($this->getInnerIterator()->getChildren(), $this->callback);
20
-	    }
18
+		public function getChildren () {
19
+			return new self($this->getInnerIterator()->getChildren(), $this->callback);
20
+		}
21 21
 	}
22 22
 }
23 23
 
Please login to merge, or discard this patch.
Doc Comments   +8 added lines, -9 removed lines patch added patch discarded remove patch
@@ -542,7 +542,7 @@  discard block
 block discarded – undo
542 542
 	 * Return true if path is dir and has at least one childs directory
543 543
 	 *
544 544
 	 * @param  string  $path  dir path
545
-	 * @return bool
545
+	 * @return null|false
546 546
 	 * @author Dmitry (dio) Levashov
547 547
 	 **/
548 548
 	protected function _subdirs($path) {
@@ -696,7 +696,6 @@  discard block
 block discarded – undo
696 696
 	 * Open file and return file pointer
697 697
 	 *
698 698
 	 * @param  string  $path  file path
699
-	 * @param  bool    $write open file for writing
700 699
 	 * @return resource|false
701 700
 	 * @author Dmitry (dio) Levashov
702 701
 	 **/
@@ -722,7 +721,7 @@  discard block
 block discarded – undo
722 721
 	 *
723 722
 	 * @param  string  $path  parent dir path
724 723
 	 * @param string  $name  new directory name
725
-	 * @return string|bool
724
+	 * @return string|false
726 725
 	 * @author Dmitry (dio) Levashov
727 726
 	 **/
728 727
 	protected function _mkdir($path, $name) {
@@ -742,7 +741,7 @@  discard block
 block discarded – undo
742 741
 	 *
743 742
 	 * @param  string  $path  parent dir path
744 743
 	 * @param string  $name  new file name
745
-	 * @return string|bool
744
+	 * @return string|false
746 745
 	 * @author Dmitry (dio) Levashov
747 746
 	 **/
748 747
 	protected function _mkfile($path, $name) {
@@ -790,9 +789,9 @@  discard block
 block discarded – undo
790 789
 	 * Return new file path or false.
791 790
 	 *
792 791
 	 * @param  string  $source  source file path
793
-	 * @param  string  $target  target dir path
792
+	 * @param  string  $targetDir  target dir path
794 793
 	 * @param  string  $name    file name
795
-	 * @return string|bool
794
+	 * @return string|false
796 795
 	 * @author Dmitry (dio) Levashov
797 796
 	 **/
798 797
 	protected function _move($source, $targetDir, $name) {
@@ -836,7 +835,7 @@  discard block
 block discarded – undo
836 835
 	 * @param  string    $dir  target dir path
837 836
 	 * @param  string    $name file name
838 837
 	 * @param  array     $stat file stat (required by some virtual fs)
839
-	 * @return bool|string
838
+	 * @return false|string
840 839
 	 * @author Dmitry (dio) Levashov
841 840
 	 **/
842 841
 	protected function _save($fp, $dir, $name, $stat) {
@@ -868,7 +867,7 @@  discard block
 block discarded – undo
868 867
 	 * Get file contents
869 868
 	 *
870 869
 	 * @param  string  $path  file path
871
-	 * @return string|false
870
+	 * @return string
872 871
 	 * @author Dmitry (dio) Levashov
873 872
 	 **/
874 873
 	protected function _getContents($path) {
@@ -1072,7 +1071,7 @@  discard block
 block discarded – undo
1072 1071
 	 * @param  array   $files  files names list
1073 1072
 	 * @param  string  $name   archive name
1074 1073
 	 * @param  array   $arc    archiver options
1075
-	 * @return string|bool
1074
+	 * @return string|false
1076 1075
 	 * @author Dmitry (dio) Levashov, 
1077 1076
 	 * @author Alexey Sukhotin
1078 1077
 	 **/
Please login to merge, or discard this patch.
Spacing   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -2,20 +2,20 @@  discard block
 block discarded – undo
2 2
 
3 3
 // Implement similar functionality in PHP 5.2 or 5.3
4 4
 // http://php.net/manual/class.recursivecallbackfilteriterator.php#110974
5
-if (! class_exists('RecursiveCallbackFilterIterator', false)) {
5
+if (!class_exists('RecursiveCallbackFilterIterator', false)) {
6 6
 	class RecursiveCallbackFilterIterator extends RecursiveFilterIterator {
7 7
 	   
8
-	    public function __construct ( RecursiveIterator $iterator, $callback ) {
8
+	    public function __construct(RecursiveIterator $iterator, $callback) {
9 9
 	        $this->callback = $callback;
10 10
 	        parent::__construct($iterator);
11 11
 	    }
12 12
 	   
13
-	    public function accept () {
13
+	    public function accept() {
14 14
 	        $callback = $this->callback;
15 15
 	        return $callback(parent::current(), parent::key(), parent::getInnerIterator());
16 16
 	    }
17 17
 	   
18
-	    public function getChildren () {
18
+	    public function getChildren() {
19 19
 	        return new self($this->getInnerIterator()->getChildren(), $this->callback);
20 20
 	    }
21 21
 	}
@@ -60,11 +60,11 @@  discard block
 block discarded – undo
60 60
 	 * @author Dmitry (dio) Levashov
61 61
 	 **/
62 62
 	public function __construct() {
63
-		$this->options['alias']    = '';              // alias to replace root dir name
64
-		$this->options['dirMode']  = 0755;            // new dirs mode
65
-		$this->options['fileMode'] = 0644;            // new files mode
66
-		$this->options['quarantine'] = '.quarantine';  // quarantine folder name - required to check archive (must be hidden)
67
-		$this->options['maxArcFilesSize'] = 0;        // max allowed archive files size (0 - no limit)
63
+		$this->options['alias']    = ''; // alias to replace root dir name
64
+		$this->options['dirMode']  = 0755; // new dirs mode
65
+		$this->options['fileMode'] = 0644; // new files mode
66
+		$this->options['quarantine'] = '.quarantine'; // quarantine folder name - required to check archive (must be hidden)
67
+		$this->options['maxArcFilesSize'] = 0; // max allowed archive files size (0 - no limit)
68 68
 		$this->options['rootCssClass'] = 'elfinder-navbar-root-local';
69 69
 	}
70 70
 	
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
 	protected function init() {
82 82
 		// Normalize directory separator for windows
83 83
 		if (DIRECTORY_SEPARATOR !== '/') {
84
-			foreach(array('path', 'tmbPath', 'tmpPath', 'quarantine') as $key) {
84
+			foreach (array('path', 'tmbPath', 'tmpPath', 'quarantine') as $key) {
85 85
 				if (!empty($this->options[$key])) {
86 86
 					$this->options[$key] = str_replace('/', DIRECTORY_SEPARATOR, $this->options[$key]);
87 87
 				}
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
 		// if no thumbnails url - try detect it
146 146
 		if ($root['read'] && !$this->tmbURL && $this->URL) {
147 147
 			if (strpos($this->tmbPath, $this->root) === 0) {
148
-				$this->tmbURL = $this->URL.str_replace(DIRECTORY_SEPARATOR, '/', substr($this->tmbPath, strlen($this->root)+1));
148
+				$this->tmbURL = $this->URL.str_replace(DIRECTORY_SEPARATOR, '/', substr($this->tmbPath, strlen($this->root) + 1));
149 149
 				if (preg_match("|[^/?&=]$|", $this->tmbURL)) {
150 150
 					$this->tmbURL .= '/';
151 151
 				}
@@ -203,11 +203,11 @@  discard block
 block discarded – undo
203 203
 		if ($mtime != $compare) {
204 204
 			return $mtime;
205 205
 		}
206
-		$inotifywait = defined('ELFINER_INOTIFYWAIT_PATH')? ELFINER_INOTIFYWAIT_PATH : 'inotifywait';
206
+		$inotifywait = defined('ELFINER_INOTIFYWAIT_PATH') ? ELFINER_INOTIFYWAIT_PATH : 'inotifywait';
207 207
 		$path = escapeshellarg($path);
208 208
 		$standby = max(1, intval($standby));
209 209
 		$cmd = $inotifywait.' '.$path.' -t '.$standby.' -e moved_to,moved_from,move,create,delete,delete_self';
210
-		$this->procExec($cmd , $o, $r);
210
+		$this->procExec($cmd, $o, $r);
211 211
 		if ($r === 0) {
212 212
 			// changed
213 213
 			clearstatcache();
@@ -266,7 +266,7 @@  discard block
 block discarded – undo
266 266
 	 * @author Dmitry (dio) Levashov
267 267
 	 **/
268 268
 	protected function _joinPath($dir, $name) {
269
-		return rtrim($dir, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . $name;
269
+		return rtrim($dir, DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR.$name;
270 270
 	}
271 271
 	
272 272
 	/**
@@ -318,7 +318,7 @@  discard block
 block discarded – undo
318 318
 		$comps = $new_comps;
319 319
 		$path = implode('/', $comps);
320 320
 		if ($initial_slashes) {
321
-			$path = str_repeat('/', $initial_slashes) . $path;
321
+			$path = str_repeat('/', $initial_slashes).$path;
322 322
 		}
323 323
 		
324 324
 		if ($changeSep) {
@@ -389,7 +389,7 @@  discard block
 block discarded – undo
389 389
 	 **/
390 390
 	protected function _inpath($path, $parent) {
391 391
 		$cwd = getcwd();
392
-		$real_path   = $this->getFullPath($path,   $cwd);
392
+		$real_path   = $this->getFullPath($path, $cwd);
393 393
 		$real_parent = $this->getFullPath($parent, $cwd);
394 394
 		if ($real_path && $real_parent) {
395 395
 			return $real_path === $real_parent || strpos($real_path, rtrim($real_parent, DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR) === 0;
@@ -448,7 +448,7 @@  discard block
 block discarded – undo
448 448
 					$stat = array();
449 449
 					return $stat;
450 450
 				} else {
451
-					$stat['mime']  = 'symlink-broken';
451
+					$stat['mime'] = 'symlink-broken';
452 452
 					$target = readlink($path);
453 453
 					$lstat = lstat($path);
454 454
 					$ostat = $this->getOwnerStat($lstat['uid'], $lstat['gid']);
@@ -464,7 +464,7 @@  discard block
 block discarded – undo
464 464
 			$fstat = stat($path);
465 465
 			$uid = $fstat['uid'];
466 466
 			$gid = $fstat['gid'];
467
-			$stat['perm'] = substr((string)decoct($fstat['mode']), -4);
467
+			$stat['perm'] = substr((string) decoct($fstat['mode']), -4);
468 468
 			$stat = array_merge($stat, $this->getOwnerStat($uid, $gid));
469 469
 		}
470 470
 		
@@ -474,8 +474,8 @@  discard block
 block discarded – undo
474 474
 			$stat['mime'] = $dir ? 'directory' : $this->mimetype($path);
475 475
 		}
476 476
 		//logical rights first
477
-		$stat['read'] = ($linkreadable || is_readable($path))? null : false;
478
-		$stat['write'] = is_writable($path)? null : false;
477
+		$stat['read'] = ($linkreadable || is_readable($path)) ? null : false;
478
+		$stat['write'] = is_writable($path) ? null : false;
479 479
 
480 480
 		if (is_null($stat['read'])) {
481 481
 			$stat['size'] = $dir ? 0 : $size;
@@ -547,7 +547,7 @@  discard block
 block discarded – undo
547 547
 			$dirItr = new ParentIterator(
548 548
 				new RecursiveDirectoryIterator($path,
549 549
 					FilesystemIterator::SKIP_DOTS |
550
-					(defined('RecursiveDirectoryIterator::FOLLOW_SYMLINKS')?
550
+					(defined('RecursiveDirectoryIterator::FOLLOW_SYMLINKS') ?
551 551
 						RecursiveDirectoryIterator::FOLLOW_SYMLINKS : 0)
552 552
 				)
553 553
 			);
@@ -633,7 +633,7 @@  discard block
 block discarded – undo
633 633
 							$br = true;
634 634
 						} else {
635 635
 							$_path = $fpath;
636
-							$stat['mime']  = 'symlink-broken';
636
+							$stat['mime'] = 'symlink-broken';
637 637
 							$target = readlink($_path);
638 638
 							$lstat = lstat($_path);
639 639
 							$ostat = $this->getOwnerStat($lstat['uid'], $lstat['gid']);
@@ -658,13 +658,13 @@  discard block
 block discarded – undo
658 658
 					if ($statOwner && !$linkreadable) {
659 659
 						$uid = $file->getOwner();
660 660
 						$gid = $file->getGroup();
661
-						$stat['perm'] = substr((string)decoct($file->getPerms()), -4);
661
+						$stat['perm'] = substr((string) decoct($file->getPerms()), -4);
662 662
 						$stat = array_merge($stat, $this->getOwnerStat($uid, $gid));
663 663
 					}
664 664
 					
665 665
 					//logical rights first
666
-					$stat['read'] = ($linkreadable || $file->isReadable())? null : false;
667
-					$stat['write'] = $file->isWritable()? null : false;
666
+					$stat['read'] = ($linkreadable || $file->isReadable()) ? null : false;
667
+					$stat['write'] = $file->isWritable() ? null : false;
668 668
 					
669 669
 					if (is_null($stat['read'])) {
670 670
 						$stat['size'] = $dir ? 0 : $size;
@@ -680,7 +680,7 @@  discard block
 block discarded – undo
680 680
 		
681 681
 		if ($cache) {
682 682
 			$cache = $this->convEncOut($cache, false);
683
-			foreach($cache as $d) {
683
+			foreach ($cache as $d) {
684 684
 				$this->updateCache($d[0], $d[1]);
685 685
 			}
686 686
 		}
@@ -696,7 +696,7 @@  discard block
 block discarded – undo
696 696
 	 * @return resource|false
697 697
 	 * @author Dmitry (dio) Levashov
698 698
 	 **/
699
-	protected function _fopen($path, $mode='rb') {
699
+	protected function _fopen($path, $mode = 'rb') {
700 700
 		return @fopen($path, $mode);
701 701
 	}
702 702
 	
@@ -707,7 +707,7 @@  discard block
 block discarded – undo
707 707
 	 * @return bool
708 708
 	 * @author Dmitry (dio) Levashov
709 709
 	 **/
710
-	protected function _fclose($fp, $path='') {
710
+	protected function _fclose($fp, $path = '') {
711 711
 		return @fclose($fp);
712 712
 	}
713 713
 	
@@ -839,7 +839,7 @@  discard block
 block discarded – undo
839 839
 		$path = $this->_joinPath($dir, $name);
840 840
 
841 841
 		$meta = stream_get_meta_data($fp);
842
-		$uri = isset($meta['uri'])? $meta['uri'] : '';
842
+		$uri = isset($meta['uri']) ? $meta['uri'] : '';
843 843
 		if ($uri && @is_file($uri)) {
844 844
 			fclose($fp);
845 845
 			$isCmdPaste = ($this->ARGS['cmd'] === 'paste');
@@ -903,7 +903,7 @@  discard block
 block discarded – undo
903 903
 	 * @return bool
904 904
 	 **/
905 905
 	protected function _chmod($path, $mode) {
906
-		$modeOct = is_string($mode) ? octdec($mode) : octdec(sprintf("%04o",$mode));
906
+		$modeOct = is_string($mode) ? octdec($mode) : octdec(sprintf("%04o", $mode));
907 907
 		$ret = @chmod($path, $modeOct);
908 908
 		$ret && clearstatcache();
909 909
 		return  $ret;
@@ -1021,7 +1021,7 @@  discard block
 block discarded – undo
1021 1021
 				$src = $dir;
1022 1022
 				$name = basename($path);
1023 1023
 				if (preg_match('/\.((tar\.(gz|bz|bz2|z|lzo))|cpio\.gz|ps\.gz|xcf\.(gz|bz2)|[a-z0-9]{1,4})$/i', $name, $m)) {
1024
-					$name = substr($name, 0,  strlen($name)-strlen($m[0]));
1024
+					$name = substr($name, 0, strlen($name) - strlen($m[0]));
1025 1025
 				}
1026 1026
 				$test = dirname($path).DIRECTORY_SEPARATOR.$name;
1027 1027
 				if (file_exists($test) || is_link($test)) {
@@ -1030,9 +1030,9 @@  discard block
 block discarded – undo
1030 1030
 			}
1031 1031
 			
1032 1032
 			if ($name !== '') {
1033
-				$result  = dirname($path).DIRECTORY_SEPARATOR.$name;
1033
+				$result = dirname($path).DIRECTORY_SEPARATOR.$name;
1034 1034
 
1035
-				if (! @rename($src, $result)) {
1035
+				if (!@rename($src, $result)) {
1036 1036
 					$this->delTree($dir);
1037 1037
 					return false;
1038 1038
 				}
@@ -1040,7 +1040,7 @@  discard block
 block discarded – undo
1040 1040
 				$dstDir = dirname($path);
1041 1041
 				$res = false;
1042 1042
 				$result = array();
1043
-				foreach($ls as $name) {
1043
+				foreach ($ls as $name) {
1044 1044
 					$target = $dstDir.DIRECTORY_SEPARATOR.$name;
1045 1045
 					if (is_dir($target)) {
1046 1046
 						$this->delTree($target);
@@ -1126,7 +1126,7 @@  discard block
 block discarded – undo
1126 1126
 					new RecursiveDirectoryIterator($path,
1127 1127
 						FilesystemIterator::KEY_AS_PATHNAME |
1128 1128
 						FilesystemIterator::SKIP_DOTS |
1129
-						(defined('RecursiveDirectoryIterator::FOLLOW_SYMLINKS')?
1129
+						(defined('RecursiveDirectoryIterator::FOLLOW_SYMLINKS') ?
1130 1130
 							RecursiveDirectoryIterator::FOLLOW_SYMLINKS : 0)
1131 1131
 					),
1132 1132
 					array($this, 'localFileSystemSearchIteratorFilter')
@@ -1148,7 +1148,7 @@  discard block
 block discarded – undo
1148 1148
 		$result = array();
1149 1149
 		
1150 1150
 		if ($match) {
1151
-			foreach($match as $p) {
1151
+			foreach ($match as $p) {
1152 1152
 				$stat = $this->stat($p);
1153 1153
 		
1154 1154
 				if (!$stat) { // invalid links
@@ -1165,7 +1165,7 @@  discard block
 block discarded – undo
1165 1165
 					$stat['path'] = $this->path($stat['hash']);
1166 1166
 					if ($this->URL && !isset($stat['url'])) {
1167 1167
 						$path = str_replace(DIRECTORY_SEPARATOR, '/', substr($p, strlen($this->root) + 1));
1168
-						$stat['url'] = $this->URL . $path;
1168
+						$stat['url'] = $this->URL.$path;
1169 1169
 					}
1170 1170
 		
1171 1171
 					$result[] = $stat;
@@ -1180,9 +1180,9 @@  discard block
 block discarded – undo
1180 1180
 
1181 1181
 	public function localFileSystemSearchIteratorFilter($file, $key, $iterator) {
1182 1182
 		if ($iterator->hasChildren()) {
1183
-			return (bool)$this->attr($key, 'read', null, true);
1183
+			return (bool) $this->attr($key, 'read', null, true);
1184 1184
 		}
1185
-		return ($this->stripos($file->getFilename(), $this->doSearchCurrentQuery) === false)? false : true;
1185
+		return ($this->stripos($file->getFilename(), $this->doSearchCurrentQuery) === false) ? false : true;
1186 1186
 	}
1187 1187
 	
1188 1188
 } // END class 
Please login to merge, or discard this patch.