@@ -10,7 +10,9 @@ |
||
10 | 10 | |
11 | 11 | private static function validate(string $string, string $regex, int $min, int $max) { |
12 | 12 | |
13 | - if (!preg_match($regex, $string)) return false; |
|
13 | + if (!preg_match($regex, $string)) { |
|
14 | + return false; |
|
15 | + } |
|
14 | 16 | |
15 | 17 | return ((Str::between($string, $min, $max)) ? $string : false); |
16 | 18 | } |
@@ -20,7 +20,9 @@ |
||
20 | 20 | |
21 | 21 | # Implement form |
22 | 22 | |
23 | - if (null !== $this->form) $this->form->implement($contents); |
|
23 | + if (null !== $this->form) { |
|
24 | + $this->form->implement($contents); |
|
25 | + } |
|
24 | 26 | |
25 | 27 | # ------------------------ |
26 | 28 |
@@ -16,7 +16,9 @@ discard block |
||
16 | 16 | |
17 | 17 | $path = implode('/', $scheme); $path_full = (DIR_UPLOADS . (('' !== $path) ? ($path . '/') : '')); |
18 | 18 | |
19 | - if (!Explorer::isDir($path_full)) return; |
|
19 | + if (!Explorer::isDir($path_full)) { |
|
20 | + return; |
|
21 | + } |
|
20 | 22 | |
21 | 23 | $this->scheme = $scheme; $this->path = $path; $this->path_full = $path_full; |
22 | 24 | } |
@@ -27,9 +29,12 @@ discard block |
||
27 | 29 | |
28 | 30 | $scheme = []; $breadcrumbs = []; |
29 | 31 | |
30 | - if ([] !== $this->scheme) foreach ($this->scheme as $name) { |
|
32 | + if ([] !== $this->scheme) { |
|
33 | + foreach ($this->scheme as $name) { |
|
31 | 34 | |
32 | - $scheme[] = $name; $breadcrumbs[] = ['path' => implode('/', $scheme), 'name' => $name]; |
|
35 | + $scheme[] = $name; |
|
36 | + } |
|
37 | + $breadcrumbs[] = ['path' => implode('/', $scheme), 'name' => $name]; |
|
33 | 38 | } |
34 | 39 | |
35 | 40 | # ------------------------ |
@@ -12,7 +12,9 @@ discard block |
||
12 | 12 | |
13 | 13 | private function getPrototype(string $name) { |
14 | 14 | |
15 | - if (preg_match('/[\/\\\\]/', $name)) return false; |
|
15 | + if (preg_match('/[\/\\\\]/', $name)) { |
|
16 | + return false; |
|
17 | + } |
|
16 | 18 | |
17 | 19 | $path = (($this->parent->path() ? ($this->parent->path() . '/') : '') . $name); |
18 | 20 | |
@@ -34,11 +36,17 @@ discard block |
||
34 | 36 | |
35 | 37 | public function init(string $name) { |
36 | 38 | |
37 | - if (false === ($prototype = $this->getPrototype($name))) return false; |
|
39 | + if (false === ($prototype = $this->getPrototype($name))) { |
|
40 | + return false; |
|
41 | + } |
|
38 | 42 | |
39 | - if (!Explorer::{static::$checker}($prototype['path_full'])) return false; |
|
43 | + if (!Explorer::{static::$checker}($prototype['path_full'])) { |
|
44 | + return false; |
|
45 | + } |
|
40 | 46 | |
41 | - foreach ($prototype as $var => $value) $this->$var = $value; |
|
47 | + foreach ($prototype as $var => $value) { |
|
48 | + $this->$var = $value; |
|
49 | + } |
|
42 | 50 | |
43 | 51 | # ------------------------ |
44 | 52 | |
@@ -49,11 +57,17 @@ discard block |
||
49 | 57 | |
50 | 58 | public function create(string $name) { |
51 | 59 | |
52 | - if (('' !== $this->name) || (false === ($prototype = $this->getPrototype($name)))) return false; |
|
60 | + if (('' !== $this->name) || (false === ($prototype = $this->getPrototype($name)))) { |
|
61 | + return false; |
|
62 | + } |
|
53 | 63 | |
54 | - if (!Explorer::{static::$creator}($prototype['path_full'])) return false; |
|
64 | + if (!Explorer::{static::$creator}($prototype['path_full'])) { |
|
65 | + return false; |
|
66 | + } |
|
55 | 67 | |
56 | - foreach ($prototype as $var => $value) $this->$var = $value; |
|
68 | + foreach ($prototype as $var => $value) { |
|
69 | + $this->$var = $value; |
|
70 | + } |
|
57 | 71 | |
58 | 72 | # ------------------------ |
59 | 73 | |
@@ -64,11 +78,17 @@ discard block |
||
64 | 78 | |
65 | 79 | public function rename(string $name) { |
66 | 80 | |
67 | - if (('' === $this->name) || (false === ($prototype = $this->getPrototype($name)))) return false; |
|
81 | + if (('' === $this->name) || (false === ($prototype = $this->getPrototype($name)))) { |
|
82 | + return false; |
|
83 | + } |
|
68 | 84 | |
69 | - if (!@rename($this->path_full, $prototype['path_full'])) return false; |
|
85 | + if (!@rename($this->path_full, $prototype['path_full'])) { |
|
86 | + return false; |
|
87 | + } |
|
70 | 88 | |
71 | - foreach ($prototype as $var => $value) $this->$var = $value; |
|
89 | + foreach ($prototype as $var => $value) { |
|
90 | + $this->$var = $value; |
|
91 | + } |
|
72 | 92 | |
73 | 93 | # ------------------------ |
74 | 94 | |
@@ -79,9 +99,13 @@ discard block |
||
79 | 99 | |
80 | 100 | public function remove() { |
81 | 101 | |
82 | - if ('' === $this->name) return false; |
|
102 | + if ('' === $this->name) { |
|
103 | + return false; |
|
104 | + } |
|
83 | 105 | |
84 | - if (!Explorer::{static::$remover}($this->path_full, true)) return false; |
|
106 | + if (!Explorer::{static::$remover}($this->path_full, true)) { |
|
107 | + return false; |
|
108 | + } |
|
85 | 109 | |
86 | 110 | $this->name = ''; $this->path = ''; $this->path_full = ''; |
87 | 111 |
@@ -12,19 +12,33 @@ |
||
12 | 12 | |
13 | 13 | $extension = strtolower(Explorer::extension($file_name, false)); |
14 | 14 | |
15 | - if (self::isImage($extension)) return 'image'; |
|
15 | + if (self::isImage($extension)) { |
|
16 | + return 'image'; |
|
17 | + } |
|
16 | 18 | |
17 | - if (self::isAudio($extension)) return 'audio'; |
|
19 | + if (self::isAudio($extension)) { |
|
20 | + return 'audio'; |
|
21 | + } |
|
18 | 22 | |
19 | - if (self::isVideo($extension)) return 'video'; |
|
23 | + if (self::isVideo($extension)) { |
|
24 | + return 'video'; |
|
25 | + } |
|
20 | 26 | |
21 | - if (in_array($extension, ['doc', 'docx'], true)) return 'word'; |
|
27 | + if (in_array($extension, ['doc', 'docx'], true)) { |
|
28 | + return 'word'; |
|
29 | + } |
|
22 | 30 | |
23 | - if (in_array($extension, ['xls', 'xlsx'], true)) return 'excel'; |
|
31 | + if (in_array($extension, ['xls', 'xlsx'], true)) { |
|
32 | + return 'excel'; |
|
33 | + } |
|
24 | 34 | |
25 | - if (in_array($extension, ['ppt', 'pptx'], true)) return 'powerpoint'; |
|
35 | + if (in_array($extension, ['ppt', 'pptx'], true)) { |
|
36 | + return 'powerpoint'; |
|
37 | + } |
|
26 | 38 | |
27 | - if ($extension === 'pdf') return 'pdf'; |
|
39 | + if ($extension === 'pdf') { |
|
40 | + return 'pdf'; |
|
41 | + } |
|
28 | 42 | |
29 | 43 | # ------------------------ |
30 | 44 |
@@ -35,11 +35,15 @@ |
||
35 | 35 | |
36 | 36 | # Check if install file exists |
37 | 37 | |
38 | - if (Informer::checkInstallFile()) Messages::error(Language::get('DASHBOARD_MESSAGE_INSTALL_FILE')); |
|
38 | + if (Informer::checkInstallFile()) { |
|
39 | + Messages::error(Language::get('DASHBOARD_MESSAGE_INSTALL_FILE')); |
|
40 | + } |
|
39 | 41 | |
40 | 42 | # Check if configuration file is loaded |
41 | 43 | |
42 | - if (!Settings::loaded()) Messages::warning(Language::get('DASHBOARD_MESSAGE_CONFIG_FILE')); |
|
44 | + if (!Settings::loaded()) { |
|
45 | + Messages::warning(Language::get('DASHBOARD_MESSAGE_CONFIG_FILE')); |
|
46 | + } |
|
43 | 47 | |
44 | 48 | # ------------------------ |
45 | 49 |
@@ -45,7 +45,9 @@ |
||
45 | 45 | |
46 | 46 | public static function mysqlVersion() { |
47 | 47 | |
48 | - if (!(DB::send("SELECT VERSION() as version") && DB::last()->status)) return false; |
|
48 | + if (!(DB::send("SELECT VERSION() as version") && DB::last()->status)) { |
|
49 | + return false; |
|
50 | + } |
|
49 | 51 | |
50 | 52 | return strval(DB::last()->row()['version']); |
51 | 53 | } |
@@ -29,9 +29,13 @@ discard block |
||
29 | 29 | |
30 | 30 | # Check name exists |
31 | 31 | |
32 | - if (false === ($check_name = $this->variable->check('name', $name))) return 'VARIABLE_ERROR_MODIFY'; |
|
32 | + if (false === ($check_name = $this->variable->check('name', $name))) { |
|
33 | + return 'VARIABLE_ERROR_MODIFY'; |
|
34 | + } |
|
33 | 35 | |
34 | - if ($check_name === 1) return 'VARIABLE_ERROR_NAME_DUPLICATE'; |
|
36 | + if ($check_name === 1) { |
|
37 | + return 'VARIABLE_ERROR_NAME_DUPLICATE'; |
|
38 | + } |
|
35 | 39 | |
36 | 40 | # Modify variable |
37 | 41 | |
@@ -43,7 +47,9 @@ discard block |
||
43 | 47 | |
44 | 48 | $modifier = ((0 === $this->variable->id) ? 'create' : 'edit'); |
45 | 49 | |
46 | - if (!$this->variable->$modifier($data)) return 'VARIABLE_ERROR_MODIFY'; |
|
50 | + if (!$this->variable->$modifier($data)) { |
|
51 | + return 'VARIABLE_ERROR_MODIFY'; |
|
52 | + } |
|
47 | 53 | |
48 | 54 | # ------------------------ |
49 | 55 |
@@ -39,7 +39,9 @@ |
||
39 | 39 | |
40 | 40 | $modifier = ((0 === $this->menuitem->id) ? 'create' : 'edit'); |
41 | 41 | |
42 | - if (!$this->menuitem->$modifier($data)) return 'MENUITEM_ERROR_MODIFY'; |
|
42 | + if (!$this->menuitem->$modifier($data)) { |
|
43 | + return 'MENUITEM_ERROR_MODIFY'; |
|
44 | + } |
|
43 | 45 | |
44 | 46 | # ------------------------ |
45 | 47 |