@@ -28,9 +28,9 @@ discard block |
||
28 | 28 | |
29 | 29 | # Set link |
30 | 30 | |
31 | - $query = (('' !== $this->parent->getPath()) ? ('?parent=' . $this->parent->getPath()) : ''); |
|
31 | + $query = (('' !== $this->parent->getPath()) ? ('?parent='.$this->parent->getPath()) : ''); |
|
32 | 32 | |
33 | - $bar->link = (INSTALL_PATH . '/admin/content/filemanager' . $query); |
|
33 | + $bar->link = (INSTALL_PATH.'/admin/content/filemanager'.$query); |
|
34 | 34 | |
35 | 35 | # Implement form |
36 | 36 | |
@@ -45,9 +45,9 @@ discard block |
||
45 | 45 | |
46 | 46 | private function getPaginationBlock() { |
47 | 47 | |
48 | - $query = (('' !== $this->parent->getPath()) ? ('?parent=' . $this->parent->getPath()) : ''); |
|
48 | + $query = (('' !== $this->parent->getPath()) ? ('?parent='.$this->parent->getPath()) : ''); |
|
49 | 49 | |
50 | - $url = new Url(INSTALL_PATH . '/admin/content/filemanager' . $query); |
|
50 | + $url = new Url(INSTALL_PATH.'/admin/content/filemanager'.$query); |
|
51 | 51 | |
52 | 52 | # ------------------------ |
53 | 53 | |
@@ -148,9 +148,9 @@ discard block |
||
148 | 148 | |
149 | 149 | if (isset($submitted)) { |
150 | 150 | |
151 | - Request::redirect(INSTALL_PATH . '/admin/content/filemanager/' . static::$origin . '?' . (('' !== |
|
151 | + Request::redirect(INSTALL_PATH.'/admin/content/filemanager/'.static::$origin.'?'.(('' !== |
|
152 | 152 | |
153 | - ($parent = $this->parent->getPath())) ? ('parent=' . $parent . '&') : '') . 'submitted=' . $submitted); |
|
153 | + ($parent = $this->parent->getPath())) ? ('parent='.$parent.'&') : '').'submitted='.$submitted); |
|
154 | 154 | } |
155 | 155 | |
156 | 156 | # Display success message |
@@ -64,7 +64,9 @@ discard block |
||
64 | 64 | |
65 | 65 | # Set parent |
66 | 66 | |
67 | - if (!$ajax) $contents->parent = $this->parent->getPath(); |
|
67 | + if (!$ajax) { |
|
68 | + $contents->parent = $this->parent->getPath(); |
|
69 | + } |
|
68 | 70 | |
69 | 71 | # Set origin and title |
70 | 72 | |
@@ -76,7 +78,9 @@ discard block |
||
76 | 78 | |
77 | 79 | # Process bar |
78 | 80 | |
79 | - if (!$ajax) $this->processBar($contents->getBlock('bar')); |
|
81 | + if (!$ajax) { |
|
82 | + $this->processBar($contents->getBlock('bar')); |
|
83 | + } |
|
80 | 84 | |
81 | 85 | # Set items |
82 | 86 | |
@@ -84,14 +88,18 @@ discard block |
||
84 | 88 | |
85 | 89 | foreach ($this->loader->getItems() as $entity) { |
86 | 90 | |
87 | - if ($entity->isDir()) $items->addItem(Lister\Dir::getBlock($entity, $ajax)); |
|
88 | - |
|
89 | - else $items->addItem(Lister\File::getBlock($entity, $ajax)); |
|
91 | + if ($entity->isDir()) { |
|
92 | + $items->addItem(Lister\Dir::getBlock($entity, $ajax)); |
|
93 | + } else { |
|
94 | + $items->addItem(Lister\File::getBlock($entity, $ajax)); |
|
95 | + } |
|
90 | 96 | } |
91 | 97 | |
92 | 98 | # Set pagination |
93 | 99 | |
94 | - if (!$ajax) $contents->pagination = $this->getPaginationBlock(); |
|
100 | + if (!$ajax) { |
|
101 | + $contents->pagination = $this->getPaginationBlock(); |
|
102 | + } |
|
95 | 103 | |
96 | 104 | # ------------------------ |
97 | 105 | |
@@ -127,7 +135,9 @@ discard block |
||
127 | 135 | |
128 | 136 | protected function handle(bool $ajax = false) { |
129 | 137 | |
130 | - if ($ajax) return $this->handleAjax(); |
|
138 | + if ($ajax) { |
|
139 | + return $this->handleAjax(); |
|
140 | + } |
|
131 | 141 | |
132 | 142 | # Create parent |
133 | 143 | |
@@ -141,9 +151,11 @@ discard block |
||
141 | 151 | |
142 | 152 | if (static::$permissions['manage']) { |
143 | 153 | |
144 | - if (Uploader::submit('upload', $this->parent->getPathFull())) $submitted = 'upload'; |
|
145 | - |
|
146 | - else if ($this->form->handle(new Filemanager\Controller\Create($this->parent), true)) $submitted = 'create'; |
|
154 | + if (Uploader::submit('upload', $this->parent->getPathFull())) { |
|
155 | + $submitted = 'upload'; |
|
156 | + } else if ($this->form->handle(new Filemanager\Controller\Create($this->parent), true)) { |
|
157 | + $submitted = 'create'; |
|
158 | + } |
|
147 | 159 | } |
148 | 160 | |
149 | 161 | if (isset($submitted)) { |
@@ -155,9 +167,11 @@ discard block |
||
155 | 167 | |
156 | 168 | # Display success message |
157 | 169 | |
158 | - if (Request::get('submitted') === 'upload') Popup::set('positive', Language::get('FILEMANAGER_SUCCESS_UPLOAD')); |
|
159 | - |
|
160 | - else if (Request::get('submitted') === 'create') Popup::set('positive', Language::get('FILEMANAGER_SUCCESS_DIR_CREATE')); |
|
170 | + if (Request::get('submitted') === 'upload') { |
|
171 | + Popup::set('positive', Language::get('FILEMANAGER_SUCCESS_UPLOAD')); |
|
172 | + } else if (Request::get('submitted') === 'create') { |
|
173 | + Popup::set('positive', Language::get('FILEMANAGER_SUCCESS_DIR_CREATE')); |
|
174 | + } |
|
161 | 175 | |
162 | 176 | # Load items |
163 | 177 |
@@ -25,9 +25,9 @@ discard block |
||
25 | 25 | |
26 | 26 | $name = $entity->getName(); $path = $entity->getPath(); |
27 | 27 | |
28 | - $query = ('?parent=' . $parent->getPath() . '&name=' . $name); |
|
28 | + $query = ('?parent='.$parent->getPath().'&name='.$name); |
|
29 | 29 | |
30 | - $link = (INSTALL_PATH . '/admin/content/filemanager/' . $parent->getOrigin() . '/dir' . $query); |
|
30 | + $link = (INSTALL_PATH.'/admin/content/filemanager/'.$parent->getOrigin().'/dir'.$query); |
|
31 | 31 | |
32 | 32 | # Set data |
33 | 33 | |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | |
36 | 36 | # Set link |
37 | 37 | |
38 | - $view->link = (INSTALL_PATH . '/admin/content/filemanager/' . $parent->getOrigin() . '?parent=' . $path); |
|
38 | + $view->link = (INSTALL_PATH.'/admin/content/filemanager/'.$parent->getOrigin().'?parent='.$path); |
|
39 | 39 | |
40 | 40 | # Set buttons |
41 | 41 |
@@ -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 |
@@ -29,15 +29,15 @@ discard block |
||
29 | 29 | |
30 | 30 | # Set create button |
31 | 31 | |
32 | - if (count($this->path) < CONFIG_ENTITIZER_MAX_DEPTH) $parent->getBlock('create')->id = $this->parent->id; |
|
33 | - |
|
34 | - else { $parent->getBlock('create')->disable(); $parent->getBlock('create_disabled')->enable(); } |
|
32 | + if (count($this->path) < CONFIG_ENTITIZER_MAX_DEPTH) { |
|
33 | + $parent->getBlock('create')->id = $this->parent->id; |
|
34 | + } else { $parent->getBlock('create')->disable(); $parent->getBlock('create_disabled')->enable(); } |
|
35 | 35 | |
36 | 36 | # Set edit button |
37 | 37 | |
38 | - if (0 !== $this->parent->id) $parent->getBlock('edit')->id = $this->parent->id; |
|
39 | - |
|
40 | - else { $parent->getBlock('edit')->disable(); $parent->getBlock('edit_disabled')->enable(); } |
|
38 | + if (0 !== $this->parent->id) { |
|
39 | + $parent->getBlock('edit')->id = $this->parent->id; |
|
40 | + } else { $parent->getBlock('edit')->disable(); $parent->getBlock('edit_disabled')->enable(); } |
|
41 | 41 | |
42 | 42 | # Add parent additional data |
43 | 43 | |
@@ -52,7 +52,9 @@ discard block |
||
52 | 52 | |
53 | 53 | foreach ($this->items['list'] as $item) { |
54 | 54 | |
55 | - if ((null !== $this->entity) && ($item['dataset']->id === $this->entity->id)) continue; |
|
55 | + if ((null !== $this->entity) && ($item['dataset']->id === $this->entity->id)) { |
|
56 | + continue; |
|
57 | + } |
|
56 | 58 | |
57 | 59 | $items->addItem($view = View::get(!$ajax ? static::$view_item : static::$view_ajax_item)); |
58 | 60 | |
@@ -121,11 +123,15 @@ discard block |
||
121 | 123 | |
122 | 124 | # Set path |
123 | 125 | |
124 | - if (static::$nesting) $contents->path = $this->path; |
|
126 | + if (static::$nesting) { |
|
127 | + $contents->path = $this->path; |
|
128 | + } |
|
125 | 129 | |
126 | 130 | # Process parent block |
127 | 131 | |
128 | - if (static::$nesting && !$ajax) $this->processParent($contents->getBlock('parent')); |
|
132 | + if (static::$nesting && !$ajax) { |
|
133 | + $this->processParent($contents->getBlock('parent')); |
|
134 | + } |
|
129 | 135 | |
130 | 136 | # Process items block |
131 | 137 | |
@@ -133,7 +139,9 @@ discard block |
||
133 | 139 | |
134 | 140 | # Set pagination |
135 | 141 | |
136 | - if (!$ajax) $contents->pagination = $this->getPaginationBlock(); |
|
142 | + if (!$ajax) { |
|
143 | + $contents->pagination = $this->getPaginationBlock(); |
|
144 | + } |
|
137 | 145 | |
138 | 146 | # ------------------------ |
139 | 147 | |
@@ -160,15 +168,21 @@ discard block |
||
160 | 168 | |
161 | 169 | # Get path and depth |
162 | 170 | |
163 | - if (false !== ($path = $this->parent->getPath())) $this->path = $path; |
|
171 | + if (false !== ($path = $this->parent->getPath())) { |
|
172 | + $this->path = $path; |
|
173 | + } |
|
164 | 174 | |
165 | - if ((0 !== $this->entity->id) && (false !== ($depth = $this->entity->getSubtreeDepth()))) $this->depth = $depth; |
|
175 | + if ((0 !== $this->entity->id) && (false !== ($depth = $this->entity->getSubtreeDepth()))) { |
|
176 | + $this->depth = $depth; |
|
177 | + } |
|
166 | 178 | |
167 | 179 | # Get items list |
168 | 180 | |
169 | 181 | $lister = (static::$nesting ? 'getChildren' : 'getItems'); |
170 | 182 | |
171 | - if (false !== ($items = $this->parent->$lister())) $this->items = $items; |
|
183 | + if (false !== ($items = $this->parent->$lister())) { |
|
184 | + $this->items = $items; |
|
185 | + } |
|
172 | 186 | |
173 | 187 | # ------------------------ |
174 | 188 | |
@@ -183,7 +197,9 @@ discard block |
||
183 | 197 | |
184 | 198 | protected function handle(bool $ajax = false) { |
185 | 199 | |
186 | - if ($ajax) return $this->handleAjax(); |
|
200 | + if ($ajax) { |
|
201 | + return $this->handleAjax(); |
|
202 | + } |
|
187 | 203 | |
188 | 204 | # Create parent entity |
189 | 205 | |
@@ -193,7 +209,9 @@ discard block |
||
193 | 209 | |
194 | 210 | # Get path |
195 | 211 | |
196 | - if (false !== ($path = $this->parent->getPath())) $this->path = $path; |
|
212 | + if (false !== ($path = $this->parent->getPath())) { |
|
213 | + $this->path = $path; |
|
214 | + } |
|
197 | 215 | |
198 | 216 | # Get index |
199 | 217 | |
@@ -203,7 +221,9 @@ discard block |
||
203 | 221 | |
204 | 222 | $lister = (static::$nesting ? 'getChildren' : 'getItems'); $display = Settings::get('admin_display_entities'); |
205 | 223 | |
206 | - if (false !== ($items = $this->parent->$lister([], [], $this->index, $display))) $this->items = $items; |
|
224 | + if (false !== ($items = $this->parent->$lister([], [], $this->index, $display))) { |
|
225 | + $this->items = $items; |
|
226 | + } |
|
207 | 227 | |
208 | 228 | # ------------------------ |
209 | 229 |