@@ -34,7 +34,9 @@ discard block |
||
34 | 34 | |
35 | 35 | public static function set(string $type, string $text, string $title = null) { |
36 | 36 | |
37 | - if (!in_array($type, static::$types, true) || isset(static::$items[$type]) || ('' === $text)) return; |
|
37 | + if (!in_array($type, static::$types, true) || isset(static::$items[$type]) || ('' === $text)) { |
|
38 | + return; |
|
39 | + } |
|
38 | 40 | |
39 | 41 | static::$items[$type] = ['text' => $text, 'title' => (('' !== $title) ? $title : null)]; |
40 | 42 | } |
@@ -64,7 +66,9 @@ discard block |
||
64 | 66 | |
65 | 67 | $message->type = $type; $message->text = Template::createBlock($item['text']); |
66 | 68 | |
67 | - if (isset($item['title'])) $message->getBlock('title')->set('text', $item['title'])->enable(); |
|
69 | + if (isset($item['title'])) { |
|
70 | + $message->getBlock('title')->set('text', $item['title'])->enable(); |
|
71 | + } |
|
68 | 72 | } |
69 | 73 | |
70 | 74 | # ------------------------ |
@@ -68,11 +68,11 @@ |
||
68 | 68 | |
69 | 69 | if ($this->page->id !== 1) SEO::set('title', $this->page->title); else $this->_layout = 'Index'; |
70 | 70 | |
71 | - SEO::set('description', $this->page->description); |
|
72 | - SEO::set('keywords', $this->page->keywords); |
|
73 | - SEO::set('robots_index', $this->page->robots_index); |
|
74 | - SEO::set('robots_follow', $this->page->robots_follow); |
|
75 | - SEO::set('canonical', $this->page->canonical); |
|
71 | + SEO::set('description', $this->page->description); |
|
72 | + SEO::set('keywords', $this->page->keywords); |
|
73 | + SEO::set('robots_index', $this->page->robots_index); |
|
74 | + SEO::set('robots_follow', $this->page->robots_follow); |
|
75 | + SEO::set('canonical', $this->page->canonical); |
|
76 | 76 | |
77 | 77 | # ------------------------ |
78 | 78 |
@@ -25,9 +25,11 @@ discard block |
||
25 | 25 | |
26 | 26 | # Set breadcrumbs |
27 | 27 | |
28 | - if (count($this->path) <= 1) $contents->getBlock('breadcrumbs')->disable(); |
|
29 | - |
|
30 | - else $contents->getBlock('breadcrumbs')->path = $this->path; |
|
28 | + if (count($this->path) <= 1) { |
|
29 | + $contents->getBlock('breadcrumbs')->disable(); |
|
30 | + } else { |
|
31 | + $contents->getBlock('breadcrumbs')->path = $this->path; |
|
32 | + } |
|
31 | 33 | |
32 | 34 | # Set contents |
33 | 35 | |
@@ -54,19 +56,31 @@ discard block |
||
54 | 56 | |
55 | 57 | $slug = $this->_url->getSlug(); |
56 | 58 | |
57 | - if ('' !== $slug) $this->page->initBySlug($slug); else $this->page->init(1); |
|
59 | + if ('' !== $slug) { |
|
60 | + $this->page->initBySlug($slug); |
|
61 | + } else { |
|
62 | + $this->page->init(1); |
|
63 | + } |
|
58 | 64 | |
59 | 65 | # Display error if not found |
60 | 66 | |
61 | - if (0 === $this->page->id) return false; |
|
67 | + if (0 === $this->page->id) { |
|
68 | + return false; |
|
69 | + } |
|
62 | 70 | |
63 | 71 | # Get path |
64 | 72 | |
65 | - if (false !== ($path = $this->page->getPath())) $this->path = $path; |
|
73 | + if (false !== ($path = $this->page->getPath())) { |
|
74 | + $this->path = $path; |
|
75 | + } |
|
66 | 76 | |
67 | 77 | # Set data |
68 | 78 | |
69 | - if ($this->page->id !== 1) SEO::set('title', $this->page->title); else $this->_layout = 'Index'; |
|
79 | + if ($this->page->id !== 1) { |
|
80 | + SEO::set('title', $this->page->title); |
|
81 | + } else { |
|
82 | + $this->_layout = 'Index'; |
|
83 | + } |
|
70 | 84 | |
71 | 85 | SEO::set('description', $this->page->description); |
72 | 86 | SEO::set('keywords', $this->page->keywords); |
@@ -45,7 +45,9 @@ discard block |
||
45 | 45 | |
46 | 46 | $name = Request::post('name'); |
47 | 47 | |
48 | - if (!$this->loader->activate($name, true)) return $ajax->setError(Language::get(static::$error_activate)); |
|
48 | + if (!$this->loader->activate($name, true)) { |
|
49 | + return $ajax->setError(Language::get(static::$error_activate)); |
|
50 | + } |
|
49 | 51 | |
50 | 52 | } else if (Request::post('action') === 'list') { |
51 | 53 | |
@@ -67,7 +69,9 @@ discard block |
||
67 | 69 | |
68 | 70 | $this->loader = new static::$loader_class(Request::get('list')); |
69 | 71 | |
70 | - if ($ajax) return $this->handleAjax(); |
|
72 | + if ($ajax) { |
|
73 | + return $this->handleAjax(); |
|
74 | + } |
|
71 | 75 | |
72 | 76 | # ------------------------ |
73 | 77 |
@@ -41,9 +41,9 @@ |
||
41 | 41 | |
42 | 42 | protected function loadItem(string $name) { |
43 | 43 | |
44 | - $path = ($this->dir_name . $name . '/'); |
|
44 | + $path = ($this->dir_name.$name.'/'); |
|
45 | 45 | |
46 | - if (null === ($data = JSON::load($path . '.Config.json'))) return null; |
|
46 | + if (null === ($data = JSON::load($path.'.Config.json'))) return null; |
|
47 | 47 | |
48 | 48 | if (null === ($data = Schema::get(static::$schema_prototype)->validate($data))) return null; |
49 | 49 |
@@ -25,7 +25,9 @@ discard block |
||
25 | 25 | |
26 | 26 | foreach (Explorer::iterateDirs($this->dir_name) as $name) { |
27 | 27 | |
28 | - if (null !== ($data = $this->loadItem($name))) $items[$name] = ($pattern + $data); |
|
28 | + if (null !== ($data = $this->loadItem($name))) { |
|
29 | + $items[$name] = ($pattern + $data); |
|
30 | + } |
|
29 | 31 | } |
30 | 32 | |
31 | 33 | # ------------------------ |
@@ -43,11 +45,17 @@ discard block |
||
43 | 45 | |
44 | 46 | $path = ($this->dir_name . $name . '/'); |
45 | 47 | |
46 | - if (null === ($data = JSON::load($path . '.Config.json'))) return null; |
|
48 | + if (null === ($data = JSON::load($path . '.Config.json'))) { |
|
49 | + return null; |
|
50 | + } |
|
47 | 51 | |
48 | - if (null === ($data = Schema::get(static::$schema_prototype)->validate($data))) return null; |
|
52 | + if (null === ($data = Schema::get(static::$schema_prototype)->validate($data))) { |
|
53 | + return null; |
|
54 | + } |
|
49 | 55 | |
50 | - if (!(static::$extension_class::isValid($data['name']) && ($data['name'] === $name))) return null; |
|
56 | + if (!(static::$extension_class::isValid($data['name']) && ($data['name'] === $name))) { |
|
57 | + return null; |
|
58 | + } |
|
51 | 59 | |
52 | 60 | # ------------------------ |
53 | 61 |
@@ -23,10 +23,10 @@ |
||
23 | 23 | } |
24 | 24 | |
25 | 25 | /** |
26 | - * Validate an item name |
|
27 | - * |
|
28 | - * @return string|false : the name or false on failure |
|
29 | - */ |
|
26 | + * Validate an item name |
|
27 | + * |
|
28 | + * @return string|false : the name or false on failure |
|
29 | + */ |
|
30 | 30 | |
31 | 31 | public static function validate(string $name) { |
32 | 32 |
@@ -41,7 +41,7 @@ |
||
41 | 41 | |
42 | 42 | if (null !== static::$loader) return static::$loader->$name(...$arguments); |
43 | 43 | |
44 | - throw new \BadMethodCallException('Call to undefined method ' . get_called_class() . '::' . $name . '()'); |
|
44 | + throw new \BadMethodCallException('Call to undefined method '.get_called_class().'::'.$name.'()'); |
|
45 | 45 | } |
46 | 46 | } |
47 | 47 | } |
@@ -39,7 +39,9 @@ |
||
39 | 39 | |
40 | 40 | public static function __callStatic($name, $arguments) { |
41 | 41 | |
42 | - if (null !== static::$loader) return static::$loader->$name(...$arguments); |
|
42 | + if (null !== static::$loader) { |
|
43 | + return static::$loader->$name(...$arguments); |
|
44 | + } |
|
43 | 45 | |
44 | 46 | throw new \BadMethodCallException('Call to undefined method ' . get_called_class() . '::' . $name . '()'); |
45 | 47 | } |
@@ -23,7 +23,9 @@ discard block |
||
23 | 23 | |
24 | 24 | foreach ((Schema::get(static::$schema)->load() ?? []) as $item) { |
25 | 25 | |
26 | - if (isset($items[$item['name']])) $items[$item['name']]['installed'] = true; |
|
26 | + if (isset($items[$item['name']])) { |
|
27 | + $items[$item['name']]['installed'] = true; |
|
28 | + } |
|
27 | 29 | } |
28 | 30 | |
29 | 31 | # ------------------------ |
@@ -41,7 +43,9 @@ discard block |
||
41 | 43 | |
42 | 44 | foreach ((Schema::get(static::$schema)->load() ?? []) as $item) { |
43 | 45 | |
44 | - if (static::$extension_class::isValid($item['name'])) $items[$item['name']] = $item; |
|
46 | + if (static::$extension_class::isValid($item['name'])) { |
|
47 | + $items[$item['name']] = $item; |
|
48 | + } |
|
45 | 49 | } |
46 | 50 | |
47 | 51 | # ------------------------ |
@@ -70,18 +74,26 @@ discard block |
||
70 | 74 | |
71 | 75 | public function install(string $name, bool $value = true) : bool { |
72 | 76 | |
73 | - if (!isset($this->items[$name])) return false; |
|
77 | + if (!isset($this->items[$name])) { |
|
78 | + return false; |
|
79 | + } |
|
74 | 80 | |
75 | 81 | $items = []; |
76 | 82 | |
77 | 83 | foreach ($this->items as $item) { |
78 | 84 | |
79 | - if ($value) { if ($item['installed'] || ($item['name'] === $name)) $items[] = $item; } |
|
80 | - |
|
81 | - else { if ($item['installed'] && ($item['name'] !== $name)) $items[] = $item; } |
|
85 | + if ($value) { if ($item['installed'] || ($item['name'] === $name)) { |
|
86 | + $items[] = $item; |
|
87 | + } |
|
88 | + } else { if ($item['installed'] && ($item['name'] !== $name)) { |
|
89 | + $items[] = $item; |
|
90 | + } |
|
91 | + } |
|
82 | 92 | } |
83 | 93 | |
84 | - if (!Schema::get(static::$schema)->save($items)) return false; |
|
94 | + if (!Schema::get(static::$schema)->save($items)) { |
|
95 | + return false; |
|
96 | + } |
|
85 | 97 | |
86 | 98 | $this->items[$name]['installed'] = $value; |
87 | 99 |
@@ -32,7 +32,9 @@ discard block |
||
32 | 32 | |
33 | 33 | # Throw error if no extensions found |
34 | 34 | |
35 | - if (false === static::$loader->get('name')) throw new static::$exception_class; |
|
35 | + if (false === static::$loader->get('name')) { |
|
36 | + throw new static::$exception_class; |
|
37 | + } |
|
36 | 38 | |
37 | 39 | # Activate user defined extension |
38 | 40 | |
@@ -40,9 +42,10 @@ discard block |
||
40 | 42 | |
41 | 43 | $name = static::$name; $param = static::$param[static::$loader->getSection()]; |
42 | 44 | |
43 | - if (static::$loader->activate(Request::get($name)) || static::$loader->activate(Cookie::get($param))) |
|
44 | - |
|
45 | + if (static::$loader->activate(Request::get($name)) || static::$loader->activate(Cookie::get($param))) { |
|
46 | + |
|
45 | 47 | Cookie::set($param, static::$loader->get('name'), static::$cookie_expires); |
48 | + } |
|
46 | 49 | } |
47 | 50 | } |
48 | 51 | } |
@@ -33,9 +33,9 @@ |
||
33 | 33 | |
34 | 34 | # Save uploaded file |
35 | 35 | |
36 | - if (true === ($upload = (Uploader::save('upload', (DIR_UPLOADS . $target_dir))))) { |
|
36 | + if (true === ($upload = (Uploader::save('upload', (DIR_UPLOADS.$target_dir))))) { |
|
37 | 37 | |
38 | - $name = Uploader::getBasename(); $url = (INSTALL_PATH . '/uploads/' . $target_dir . $name); |
|
38 | + $name = Uploader::getBasename(); $url = (INSTALL_PATH.'/uploads/'.$target_dir.$name); |
|
39 | 39 | |
40 | 40 | $ajax->set('name', $name)->set('url', $url); |
41 | 41 |
@@ -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::handle('upload', $this->parent->getPathFull(), true)) $submitted = 'upload'; |
|
145 | - |
|
146 | - else if ($this->form->handle(new Filemanager\Controller\Create($this->parent), true)) $submitted = 'create'; |
|
154 | + if (Uploader::handle('upload', $this->parent->getPathFull(), true)) { |
|
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 |