@@ -29,9 +29,9 @@ discard block |
||
29 | 29 | |
30 | 30 | $format = Filemanager\Utils\Mime::getFormat($entity->getExtension()); |
31 | 31 | |
32 | - $query = ('?parent=' . $parent->getPath() . '&name=' . $name); |
|
32 | + $query = ('?parent='.$parent->getPath().'&name='.$name); |
|
33 | 33 | |
34 | - $link = (INSTALL_PATH . '/admin/content/filemanager/' . $parent->getOrigin() . '/file' . $query); |
|
34 | + $link = (INSTALL_PATH.'/admin/content/filemanager/'.$parent->getOrigin().'/file'.$query); |
|
35 | 35 | |
36 | 36 | # Set data |
37 | 37 | |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | |
40 | 40 | # Set link |
41 | 41 | |
42 | - $view->link = ($permissions['browse'] ? (INSTALL_PATH . '/uploads/' . $path) : $link); |
|
42 | + $view->link = ($permissions['browse'] ? (INSTALL_PATH.'/uploads/'.$path) : $link); |
|
43 | 43 | |
44 | 44 | $view->target = ($permissions['browse'] ? '_blank' : '_self'); |
45 | 45 |
@@ -35,7 +35,9 @@ discard block |
||
35 | 35 | |
36 | 36 | public function load(int $index = 0, int $display = 0) : Loader { |
37 | 37 | |
38 | - if (!(($index >= 0) && ($display >= 0))) return $this; |
|
38 | + if (!(($index >= 0) && ($display >= 0))) { |
|
39 | + return $this; |
|
40 | + } |
|
39 | 41 | |
40 | 42 | $dirs = []; $files = []; |
41 | 43 | |
@@ -43,9 +45,15 @@ discard block |
||
43 | 45 | |
44 | 46 | foreach (Explorer::iterate($this->parent->getPathFull()) as $name) { |
45 | 47 | |
46 | - if (!($entity = new Entity($this->parent, $name))->isInited()) continue; |
|
48 | + if (!($entity = new Entity($this->parent, $name))->isInited()) { |
|
49 | + continue; |
|
50 | + } |
|
47 | 51 | |
48 | - if ($entity->isDir()) $dirs[] = $entity; else $files[] = $entity; |
|
52 | + if ($entity->isDir()) { |
|
53 | + $dirs[] = $entity; |
|
54 | + } else { |
|
55 | + $files[] = $entity; |
|
56 | + } |
|
49 | 57 | } |
50 | 58 | |
51 | 59 | # Sort arrays |
@@ -61,7 +69,9 @@ discard block |
||
61 | 69 | |
62 | 70 | $items = array_merge($dirs, $files); $total = count($items); |
63 | 71 | |
64 | - if (($index > 0) && ($display > 0)) $items = array_splice($items, (($index - 1) * $display), $display); |
|
72 | + if (($index > 0) && ($display > 0)) { |
|
73 | + $items = array_splice($items, (($index - 1) * $display), $display); |
|
74 | + } |
|
65 | 75 | |
66 | 76 | # Set properties |
67 | 77 |
@@ -118,9 +118,9 @@ discard block |
||
118 | 118 | |
119 | 119 | if (!$this->entity->isInited()) { |
120 | 120 | |
121 | - $query = (('' !== $this->parent->getPath()) ? ('?parent=' . $this->parent->getPath()) : ''); |
|
121 | + $query = (('' !== $this->parent->getPath()) ? ('?parent='.$this->parent->getPath()) : ''); |
|
122 | 122 | |
123 | - Request::redirect(INSTALL_PATH . '/admin/content/filemanager/' . static::$origin . '/' . $query); |
|
123 | + Request::redirect(INSTALL_PATH.'/admin/content/filemanager/'.static::$origin.'/'.$query); |
|
124 | 124 | } |
125 | 125 | |
126 | 126 | # Create rename form |
@@ -142,9 +142,9 @@ discard block |
||
142 | 142 | |
143 | 143 | foreach ($this->forms as $name => $form) if ($form->handle($this->controllers[$name], true)) { |
144 | 144 | |
145 | - Request::redirect(INSTALL_PATH . '/admin/content/filemanager/' . static::$origin . '/' . static::$type . |
|
145 | + Request::redirect(INSTALL_PATH.'/admin/content/filemanager/'.static::$origin.'/'.static::$type. |
|
146 | 146 | |
147 | - '?parent=' . $this->parent->getPath() . '&name=' . $this->entity->getName() . '&submitted=' . $name); |
|
147 | + '?parent='.$this->parent->getPath().'&name='.$this->entity->getName().'&submitted='.$name); |
|
148 | 148 | } |
149 | 149 | |
150 | 150 | # Display success message |
@@ -45,7 +45,9 @@ discard block |
||
45 | 45 | |
46 | 46 | # Implement forms |
47 | 47 | |
48 | - foreach ($this->forms as $form) $form->implement($contents); |
|
48 | + foreach ($this->forms as $form) { |
|
49 | + $form->implement($contents); |
|
50 | + } |
|
49 | 51 | |
50 | 52 | # Process info block |
51 | 53 | |
@@ -104,7 +106,9 @@ discard block |
||
104 | 106 | |
105 | 107 | # Handle ajax request |
106 | 108 | |
107 | - if ($ajax) return $this->handleAjax(); |
|
109 | + if ($ajax) { |
|
110 | + return $this->handleAjax(); |
|
111 | + } |
|
108 | 112 | |
109 | 113 | # Create parent |
110 | 114 | |
@@ -140,18 +144,22 @@ discard block |
||
140 | 144 | |
141 | 145 | # Handle form |
142 | 146 | |
143 | - foreach ($this->forms as $name => $form) if ($form->handle($this->controllers[$name], true)) { |
|
147 | + foreach ($this->forms as $name => $form) { |
|
148 | + if ($form->handle($this->controllers[$name], true)) { |
|
144 | 149 | |
145 | 150 | Request::redirect(INSTALL_PATH . '/admin/content/filemanager/' . static::$origin . '/' . static::$type . |
146 | 151 | |
147 | 152 | '?parent=' . $this->parent->getPath() . '&name=' . $this->entity->getName() . '&submitted=' . $name); |
148 | 153 | } |
154 | + } |
|
149 | 155 | |
150 | 156 | # Display success message |
151 | 157 | |
152 | - if (Request::get('submitted') === 'rename') Popup::set('positive', Language::get(static::$message_success_rename)); |
|
153 | - |
|
154 | - else if (Request::get('submitted') === 'edit') Popup::set('positive', Language::get(static::$message_success_edit)); |
|
158 | + if (Request::get('submitted') === 'rename') { |
|
159 | + Popup::set('positive', Language::get(static::$message_success_rename)); |
|
160 | + } else if (Request::get('submitted') === 'edit') { |
|
161 | + Popup::set('positive', Language::get(static::$message_success_edit)); |
|
162 | + } |
|
155 | 163 | |
156 | 164 | # ------------------------ |
157 | 165 |
@@ -25,7 +25,7 @@ |
||
25 | 25 | |
26 | 26 | $scheme = array_diff(preg_split('/[\/\\\\]+/', $path, -1, PREG_SPLIT_NO_EMPTY), ['.', '..']); |
27 | 27 | |
28 | - $path_full = ($this->path_full . (('' !== ($path = implode('/', $scheme))) ? ($path . '/') : '')); |
|
28 | + $path_full = ($this->path_full.(('' !== ($path = implode('/', $scheme))) ? ($path.'/') : '')); |
|
29 | 29 | |
30 | 30 | if (!Explorer::isDir($path_full)) return; |
31 | 31 |
@@ -27,7 +27,9 @@ |
||
27 | 27 | |
28 | 28 | $path_full = ($this->path_full . (('' !== ($path = implode('/', $scheme))) ? ($path . '/') : '')); |
29 | 29 | |
30 | - if (!Explorer::isDir($path_full)) return; |
|
30 | + if (!Explorer::isDir($path_full)) { |
|
31 | + return; |
|
32 | + } |
|
31 | 33 | |
32 | 34 | $this->scheme = $scheme; $this->path = $path; $this->path_full = $path_full; |
33 | 35 | } |
@@ -34,19 +34,33 @@ |
||
34 | 34 | |
35 | 35 | public static function getFormat(string $extension) { |
36 | 36 | |
37 | - if (self::isImage($extension)) return 'image'; |
|
37 | + if (self::isImage($extension)) { |
|
38 | + return 'image'; |
|
39 | + } |
|
38 | 40 | |
39 | - if (self::isAudio($extension)) return 'audio'; |
|
41 | + if (self::isAudio($extension)) { |
|
42 | + return 'audio'; |
|
43 | + } |
|
40 | 44 | |
41 | - if (self::isVideo($extension)) return 'video'; |
|
45 | + if (self::isVideo($extension)) { |
|
46 | + return 'video'; |
|
47 | + } |
|
42 | 48 | |
43 | - if (in_array($extension, ['doc', 'docx'], true)) return 'word'; |
|
49 | + if (in_array($extension, ['doc', 'docx'], true)) { |
|
50 | + return 'word'; |
|
51 | + } |
|
44 | 52 | |
45 | - if (in_array($extension, ['xls', 'xlsx'], true)) return 'excel'; |
|
53 | + if (in_array($extension, ['xls', 'xlsx'], true)) { |
|
54 | + return 'excel'; |
|
55 | + } |
|
46 | 56 | |
47 | - if (in_array($extension, ['ppt', 'pptx'], true)) return 'powerpoint'; |
|
57 | + if (in_array($extension, ['ppt', 'pptx'], true)) { |
|
58 | + return 'powerpoint'; |
|
59 | + } |
|
48 | 60 | |
49 | - if ($extension === 'pdf') return 'pdf'; |
|
61 | + if ($extension === 'pdf') { |
|
62 | + return 'pdf'; |
|
63 | + } |
|
50 | 64 | |
51 | 65 | # ------------------------ |
52 | 66 |
@@ -12,7 +12,7 @@ |
||
12 | 12 | |
13 | 13 | protected function getItem(string $name) { |
14 | 14 | |
15 | - $file_name = ($this->dir_name . $name . '/.Config.json'); |
|
15 | + $file_name = ($this->dir_name.$name.'/.Config.json'); |
|
16 | 16 | |
17 | 17 | if (null === ($data = JSON::load($file_name))) return null; |
18 | 18 |
@@ -14,11 +14,17 @@ |
||
14 | 14 | |
15 | 15 | $file_name = ($this->dir_name . $name . '/.Config.json'); |
16 | 16 | |
17 | - if (null === ($data = JSON::load($file_name))) return null; |
|
17 | + if (null === ($data = JSON::load($file_name))) { |
|
18 | + return null; |
|
19 | + } |
|
18 | 20 | |
19 | - if (null === ($data = Schema::get(static::$schema_prototype)->validate($data))) return null; |
|
21 | + if (null === ($data = Schema::get(static::$schema_prototype)->validate($data))) { |
|
22 | + return null; |
|
23 | + } |
|
20 | 24 | |
21 | - if (!(static::$extension_class::valid($data['name']) && ($data['name'] === $name))) return null; |
|
25 | + if (!(static::$extension_class::valid($data['name']) && ($data['name'] === $name))) { |
|
26 | + return null; |
|
27 | + } |
|
22 | 28 | |
23 | 29 | # ------------------------ |
24 | 30 |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | |
24 | 24 | if (($name === '.') || ($name === '..')) continue; |
25 | 25 | |
26 | - if ((null === $type) || (@filetype($dir_name . $name) === $type)) yield $name; |
|
26 | + if ((null === $type) || (@filetype($dir_name.$name) === $type)) yield $name; |
|
27 | 27 | } |
28 | 28 | |
29 | 29 | closedir($handler); |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | |
116 | 116 | foreach (array_diff($list, ['.', '..']) as $name) { |
117 | 117 | |
118 | - $name = ($dir_name . '/' . $name); |
|
118 | + $name = ($dir_name.'/'.$name); |
|
119 | 119 | |
120 | 120 | if (@is_dir($name)) self::removeDir($name, true); |
121 | 121 |
@@ -21,9 +21,13 @@ discard block |
||
21 | 21 | |
22 | 22 | while (false !== ($name = readdir($handler))) { |
23 | 23 | |
24 | - if (($name === '.') || ($name === '..')) continue; |
|
24 | + if (($name === '.') || ($name === '..')) { |
|
25 | + continue; |
|
26 | + } |
|
25 | 27 | |
26 | - if ((null === $type) || (@filetype($dir_name . $name) === $type)) yield $name; |
|
28 | + if ((null === $type) || (@filetype($dir_name . $name) === $type)) { |
|
29 | + yield $name; |
|
30 | + } |
|
27 | 31 | } |
28 | 32 | |
29 | 33 | closedir($handler); |
@@ -38,7 +42,9 @@ discard block |
||
38 | 42 | |
39 | 43 | private static function getInfo(string $file_name, int $param, bool $check_exists = true) { |
40 | 44 | |
41 | - if ($check_exists && !self::isFile($file_name)) return false; |
|
45 | + if ($check_exists && !self::isFile($file_name)) { |
|
46 | + return false; |
|
47 | + } |
|
42 | 48 | |
43 | 49 | return pathinfo($file_name, $param); |
44 | 50 | } |
@@ -117,9 +123,11 @@ discard block |
||
117 | 123 | |
118 | 124 | $name = ($dir_name . '/' . $name); |
119 | 125 | |
120 | - if (@is_dir($name)) self::removeDir($name, true); |
|
121 | - |
|
122 | - else if (@is_file($name)) self::removeFile($name); |
|
126 | + if (@is_dir($name)) { |
|
127 | + self::removeDir($name, true); |
|
128 | + } else if (@is_file($name)) { |
|
129 | + self::removeFile($name); |
|
130 | + } |
|
123 | 131 | } |
124 | 132 | } |
125 | 133 | |
@@ -145,7 +153,9 @@ discard block |
||
145 | 153 | |
146 | 154 | public static function iterate(string $dir_name) : Generator { |
147 | 155 | |
148 | - foreach (self::getList($dir_name) as $name) yield $name; |
|
156 | + foreach (self::getList($dir_name) as $name) { |
|
157 | + yield $name; |
|
158 | + } |
|
149 | 159 | } |
150 | 160 | |
151 | 161 | /** |
@@ -154,7 +164,9 @@ discard block |
||
154 | 164 | |
155 | 165 | public static function iterateDirs(string $dir_name) : Generator { |
156 | 166 | |
157 | - foreach (self::getList($dir_name, 'dir') as $name) yield $name; |
|
167 | + foreach (self::getList($dir_name, 'dir') as $name) { |
|
168 | + yield $name; |
|
169 | + } |
|
158 | 170 | } |
159 | 171 | |
160 | 172 | /** |
@@ -163,7 +175,9 @@ discard block |
||
163 | 175 | |
164 | 176 | public static function iterateFiles(string $dir_name) : Generator { |
165 | 177 | |
166 | - foreach (self::getList($dir_name, 'file') as $name) yield $name; |
|
178 | + foreach (self::getList($dir_name, 'file') as $name) { |
|
179 | + yield $name; |
|
180 | + } |
|
167 | 181 | } |
168 | 182 | |
169 | 183 | /** |
@@ -334,7 +348,9 @@ discard block |
||
334 | 348 | |
335 | 349 | public static function include(string $file_name) { |
336 | 350 | |
337 | - if ((strtolower(self::getExtension($file_name)) !== 'php')) return false; |
|
351 | + if ((strtolower(self::getExtension($file_name)) !== 'php')) { |
|
352 | + return false; |
|
353 | + } |
|
338 | 354 | |
339 | 355 | return @include $file_name; |
340 | 356 | } |