@@ -16,7 +16,9 @@ |
||
16 | 16 | |
17 | 17 | # Set field configuration |
18 | 18 | |
19 | - foreach (get_defined_vars() as $name => $value) $this->$name = $value; |
|
19 | + foreach (get_defined_vars() as $name => $value) { |
|
20 | + $this->$name = $value; |
|
21 | + } |
|
20 | 22 | } |
21 | 23 | |
22 | 24 | # Get field statement |
@@ -22,15 +22,19 @@ discard block |
||
22 | 22 | |
23 | 23 | $type = $matches[2][$key]; $name = $matches[3][$key]; $contents = ($matches[4][$key] ?? ''); |
24 | 24 | |
25 | - if (!preg_match(REGEX_TEMPLATE_ITEM_NAME, $name)) continue; |
|
25 | + if (!preg_match(REGEX_TEMPLATE_ITEM_NAME, $name)) { |
|
26 | + continue; |
|
27 | + } |
|
26 | 28 | |
27 | 29 | $this->contents = str_replace($match, ('{ ' . $type . ':' . $name . ' / }'), $this->contents); |
28 | 30 | |
29 | - if ($type === 'block') $this->blocks[$name] = (new Block($contents))->$toggle(); |
|
30 | - |
|
31 | - else if ($type === 'for') $this->loops[$name] = new Loop($contents); |
|
32 | - |
|
33 | - else if ($type === 'widget') $this->widgets[] = $name; |
|
31 | + if ($type === 'block') { |
|
32 | + $this->blocks[$name] = (new Block($contents))->$toggle(); |
|
33 | + } else if ($type === 'for') { |
|
34 | + $this->loops[$name] = new Loop($contents); |
|
35 | + } else if ($type === 'widget') { |
|
36 | + $this->widgets[] = $name; |
|
37 | + } |
|
34 | 38 | } |
35 | 39 | } |
36 | 40 | |
@@ -48,7 +52,9 @@ discard block |
||
48 | 52 | |
49 | 53 | foreach ($matches[1] as $index => $name) { |
50 | 54 | |
51 | - if (!preg_match(REGEX_TEMPLATE_ITEM_NAME, $name)) continue; |
|
55 | + if (!preg_match(REGEX_TEMPLATE_ITEM_NAME, $name)) { |
|
56 | + continue; |
|
57 | + } |
|
52 | 58 | |
53 | 59 | $elementaries['stack'][$name] = false; |
54 | 60 | } |
@@ -68,29 +74,39 @@ discard block |
||
68 | 74 | |
69 | 75 | public function __clone() { |
70 | 76 | |
71 | - foreach ($this->blocks as $name => $block) $this->blocks[$name] = clone $block; |
|
77 | + foreach ($this->blocks as $name => $block) { |
|
78 | + $this->blocks[$name] = clone $block; |
|
79 | + } |
|
72 | 80 | |
73 | - foreach ($this->loops as $name => $loop) $this->loops[$name] = clone $loop; |
|
81 | + foreach ($this->loops as $name => $loop) { |
|
82 | + $this->loops[$name] = clone $loop; |
|
83 | + } |
|
74 | 84 | } |
75 | 85 | |
76 | 86 | # Setter |
77 | 87 | |
78 | 88 | public function __set(string $name, $value) { |
79 | 89 | |
80 | - if ($value instanceof Block) $this->block($name, $value); |
|
81 | - |
|
82 | - else if (is_array($value)) $this->loop($name, $value); |
|
83 | - |
|
84 | - else if (is_scalar($value)) $this->set($name, $value); |
|
90 | + if ($value instanceof Block) { |
|
91 | + $this->block($name, $value); |
|
92 | + } else if (is_array($value)) { |
|
93 | + $this->loop($name, $value); |
|
94 | + } else if (is_scalar($value)) { |
|
95 | + $this->set($name, $value); |
|
96 | + } |
|
85 | 97 | } |
86 | 98 | |
87 | 99 | # Set block |
88 | 100 | |
89 | 101 | public function block(string $name, Block $block = null) { |
90 | 102 | |
91 | - if (!isset($this->blocks[$name])) return ((null === $block) ? new Block() : $this); |
|
103 | + if (!isset($this->blocks[$name])) { |
|
104 | + return ((null === $block) ? new Block() : $this); |
|
105 | + } |
|
92 | 106 | |
93 | - if (null === $block) return $this->blocks[$name]; |
|
107 | + if (null === $block) { |
|
108 | + return $this->blocks[$name]; |
|
109 | + } |
|
94 | 110 | |
95 | 111 | $this->blocks[$name] = $block; |
96 | 112 | |
@@ -103,9 +119,13 @@ discard block |
||
103 | 119 | |
104 | 120 | public function loop(string $name, array $range = null) { |
105 | 121 | |
106 | - if (!isset($this->loops[$name])) return ((null === $range) ? new Loop() : $this); |
|
122 | + if (!isset($this->loops[$name])) { |
|
123 | + return ((null === $range) ? new Loop() : $this); |
|
124 | + } |
|
107 | 125 | |
108 | - if (null === $range) return $this->loops[$name]; |
|
126 | + if (null === $range) { |
|
127 | + return $this->loops[$name]; |
|
128 | + } |
|
109 | 129 | |
110 | 130 | $this->loops[$name]->range($range); |
111 | 131 | |
@@ -118,7 +138,9 @@ discard block |
||
118 | 138 | |
119 | 139 | public function set(string $name, string $value) { |
120 | 140 | |
121 | - if (isset($this->variables[$name])) $this->variables[$name] = $value; |
|
141 | + if (isset($this->variables[$name])) { |
|
142 | + $this->variables[$name] = $value; |
|
143 | + } |
|
122 | 144 | |
123 | 145 | return $this; |
124 | 146 | } |
@@ -127,7 +149,9 @@ discard block |
||
127 | 149 | |
128 | 150 | public function contents() { |
129 | 151 | |
130 | - if (!$this->enabled) return ''; |
|
152 | + if (!$this->enabled) { |
|
153 | + return ''; |
|
154 | + } |
|
131 | 155 | |
132 | 156 | $this->enabled = false; $insertions = []; |
133 | 157 |
@@ -47,13 +47,17 @@ discard block |
||
47 | 47 | |
48 | 48 | # Check for demo mode |
49 | 49 | |
50 | - if (Informer::isDemoMode()) return $ajax->error(Language::get('DEMO_MODE_RESTRICTION')); |
|
50 | + if (Informer::isDemoMode()) { |
|
51 | + return $ajax->error(Language::get('DEMO_MODE_RESTRICTION')); |
|
52 | + } |
|
51 | 53 | |
52 | 54 | # Remove item |
53 | 55 | |
54 | 56 | if (Request::post('action') === 'remove') { |
55 | 57 | |
56 | - if (!$this->entity->remove()) return $ajax->error(Language::get(static::$message_error_remove)); |
|
58 | + if (!$this->entity->remove()) { |
|
59 | + return $ajax->error(Language::get(static::$message_error_remove)); |
|
60 | + } |
|
57 | 61 | } |
58 | 62 | |
59 | 63 | # ------------------------ |
@@ -84,7 +88,9 @@ discard block |
||
84 | 88 | |
85 | 89 | # Handle ajax request |
86 | 90 | |
87 | - if (Request::isAjax()) return $this->handleAjax(); |
|
91 | + if (Request::isAjax()) { |
|
92 | + return $this->handleAjax(); |
|
93 | + } |
|
88 | 94 | |
89 | 95 | # Create form |
90 | 96 | |
@@ -101,7 +107,9 @@ discard block |
||
101 | 107 | |
102 | 108 | # Display success message |
103 | 109 | |
104 | - if (false !== Request::get('submitted')) Messages::success(Language::get(static::$message_success_rename)); |
|
110 | + if (false !== Request::get('submitted')) { |
|
111 | + Messages::success(Language::get(static::$message_success_rename)); |
|
112 | + } |
|
105 | 113 | |
106 | 114 | # ------------------------ |
107 | 115 |
@@ -10,19 +10,33 @@ discard block |
||
10 | 10 | |
11 | 11 | private static function translateError(int $error) { |
12 | 12 | |
13 | - if ($error === UPLOAD_ERR_INI_SIZE) return 'UPLOADER_ERROR_INI_SIZE'; |
|
13 | + if ($error === UPLOAD_ERR_INI_SIZE) { |
|
14 | + return 'UPLOADER_ERROR_INI_SIZE'; |
|
15 | + } |
|
14 | 16 | |
15 | - if ($error === UPLOAD_ERR_FORM_SIZE) return 'UPLOADER_ERROR_FORM_SIZE'; |
|
17 | + if ($error === UPLOAD_ERR_FORM_SIZE) { |
|
18 | + return 'UPLOADER_ERROR_FORM_SIZE'; |
|
19 | + } |
|
16 | 20 | |
17 | - if ($error === UPLOAD_ERR_PARTIAL) return 'UPLOADER_ERROR_PARTIAL'; |
|
21 | + if ($error === UPLOAD_ERR_PARTIAL) { |
|
22 | + return 'UPLOADER_ERROR_PARTIAL'; |
|
23 | + } |
|
18 | 24 | |
19 | - if ($error === UPLOAD_ERR_NO_FILE) return 'UPLOADER_ERROR_NO_FILE'; |
|
25 | + if ($error === UPLOAD_ERR_NO_FILE) { |
|
26 | + return 'UPLOADER_ERROR_NO_FILE'; |
|
27 | + } |
|
20 | 28 | |
21 | - if ($error === UPLOAD_ERR_NO_TMP_DIR) return 'UPLOADER_ERROR_NO_TMP_DIR'; |
|
29 | + if ($error === UPLOAD_ERR_NO_TMP_DIR) { |
|
30 | + return 'UPLOADER_ERROR_NO_TMP_DIR'; |
|
31 | + } |
|
22 | 32 | |
23 | - if ($error === UPLOAD_ERR_CANT_WRITE) return 'UPLOADER_ERROR_CANT_WRITE'; |
|
33 | + if ($error === UPLOAD_ERR_CANT_WRITE) { |
|
34 | + return 'UPLOADER_ERROR_CANT_WRITE'; |
|
35 | + } |
|
24 | 36 | |
25 | - if ($error === UPLOAD_ERR_EXTENSION) return 'UPLOADER_ERROR_EXTENSION'; |
|
37 | + if ($error === UPLOAD_ERR_EXTENSION) { |
|
38 | + return 'UPLOADER_ERROR_EXTENSION'; |
|
39 | + } |
|
26 | 40 | |
27 | 41 | # ------------------------ |
28 | 42 | |
@@ -33,39 +47,55 @@ discard block |
||
33 | 47 | |
34 | 48 | public static function save(string $name, string $dir_name) { |
35 | 49 | |
36 | - if ((false === ($file = Request::file($name))) || !is_uploaded_file($file['tmp_name'])) return false; |
|
50 | + if ((false === ($file = Request::file($name))) || !is_uploaded_file($file['tmp_name'])) { |
|
51 | + return false; |
|
52 | + } |
|
37 | 53 | |
38 | 54 | # Check for demo mode |
39 | 55 | |
40 | - if (Informer::isDemoMode()) return 'DEMO_MODE_RESTRICTION'; |
|
56 | + if (Informer::isDemoMode()) { |
|
57 | + return 'DEMO_MODE_RESTRICTION'; |
|
58 | + } |
|
41 | 59 | |
42 | 60 | # Check for upload errors |
43 | 61 | |
44 | - if ($file['error'] !== UPLOAD_ERR_OK) return self::translateError($file['error']); |
|
62 | + if ($file['error'] !== UPLOAD_ERR_OK) { |
|
63 | + return self::translateError($file['error']); |
|
64 | + } |
|
45 | 65 | |
46 | 66 | # Check size |
47 | 67 | |
48 | - if ($file['size'] > CONFIG_UPLOADS_MAX_SIZE) return 'UPLOADER_ERROR_SIZE'; |
|
68 | + if ($file['size'] > CONFIG_UPLOADS_MAX_SIZE) { |
|
69 | + return 'UPLOADER_ERROR_SIZE'; |
|
70 | + } |
|
49 | 71 | |
50 | 72 | # Check file extension |
51 | 73 | |
52 | 74 | $extensions = ['php', 'phtml', 'php3', 'php4', 'php5', 'phps']; |
53 | 75 | |
54 | - if (in_array(Explorer::extension($file['name'], false), $extensions)) return 'UPLOADER_ERROR_TYPE'; |
|
76 | + if (in_array(Explorer::extension($file['name'], false), $extensions)) { |
|
77 | + return 'UPLOADER_ERROR_TYPE'; |
|
78 | + } |
|
55 | 79 | |
56 | 80 | # Check target directory |
57 | 81 | |
58 | - if (!Explorer::isDir($dir_name)) return 'UPLOADER_ERROR_DIR'; |
|
82 | + if (!Explorer::isDir($dir_name)) { |
|
83 | + return 'UPLOADER_ERROR_DIR'; |
|
84 | + } |
|
59 | 85 | |
60 | 86 | # Check target file |
61 | 87 | |
62 | 88 | $file_name = ($dir_name . '/' . basename($file['name'])); |
63 | 89 | |
64 | - if (Explorer::isDir($file_name) || Explorer::isFile($file_name)) return 'UPLOADER_ERROR_EXISTS'; |
|
90 | + if (Explorer::isDir($file_name) || Explorer::isFile($file_name)) { |
|
91 | + return 'UPLOADER_ERROR_EXISTS'; |
|
92 | + } |
|
65 | 93 | |
66 | 94 | # Save uploaded file |
67 | 95 | |
68 | - if (!@move_uploaded_file($file['tmp_name'], $file_name)) return 'UPLOADER_ERROR_SAVE'; |
|
96 | + if (!@move_uploaded_file($file['tmp_name'], $file_name)) { |
|
97 | + return 'UPLOADER_ERROR_SAVE'; |
|
98 | + } |
|
69 | 99 | |
70 | 100 | # ------------------------ |
71 | 101 |
@@ -2,7 +2,11 @@ |
||
2 | 2 | |
3 | 3 | namespace Utils { |
4 | 4 | |
5 | - use Modules\Informer, Utils\Messages, Explorer, Language, Request; |
|
5 | + use Modules\Informer; |
|
6 | + use Utils\Messages; |
|
7 | + use Explorer; |
|
8 | + use Language; |
|
9 | + use Request; |
|
6 | 10 | |
7 | 11 | abstract class Uploader { |
8 | 12 |
@@ -2,7 +2,13 @@ |
||
2 | 2 | |
3 | 3 | namespace Modules\Auth\Utils { |
4 | 4 | |
5 | - use Modules\Auth, Modules\Entitizer, Modules\Settings, Utils\View, Date, Language, Mailer; |
|
5 | + use Modules\Auth; |
|
6 | + use Modules\Entitizer; |
|
7 | + use Modules\Settings; |
|
8 | + use Utils\View; |
|
9 | + use Date; |
|
10 | + use Language; |
|
11 | + use Mailer; |
|
6 | 12 | |
7 | 13 | abstract class Mail { |
8 | 14 |
@@ -2,7 +2,9 @@ |
||
2 | 2 | |
3 | 3 | namespace Modules\Entitizer\Form { |
4 | 4 | |
5 | - use Modules\Entitizer, Utils\Form, Utils\Lister; |
|
5 | + use Modules\Entitizer; |
|
6 | + use Utils\Form; |
|
7 | + use Utils\Lister; |
|
6 | 8 | |
7 | 9 | class Page extends Form { |
8 | 10 |
@@ -2,7 +2,13 @@ |
||
2 | 2 | |
3 | 3 | namespace Modules\Entitizer\Form { |
4 | 4 | |
5 | - use Modules\Auth, Modules\Entitizer, Utils\Form, Utils\Lister, Geo\Country, Geo\Timezone, Language; |
|
5 | + use Modules\Auth; |
|
6 | + use Modules\Entitizer; |
|
7 | + use Utils\Form; |
|
8 | + use Utils\Lister; |
|
9 | + use Geo\Country; |
|
10 | + use Geo\Timezone; |
|
11 | + use Language; |
|
6 | 12 | |
7 | 13 | class User extends Form { |
8 | 14 |
@@ -2,7 +2,8 @@ |
||
2 | 2 | |
3 | 3 | namespace Modules\Entitizer\Form { |
4 | 4 | |
5 | - use Modules\Entitizer, Utils\Form; |
|
5 | + use Modules\Entitizer; |
|
6 | + use Utils\Form; |
|
6 | 7 | |
7 | 8 | class Widget extends Form { |
8 | 9 |
@@ -2,7 +2,8 @@ |
||
2 | 2 | |
3 | 3 | namespace Modules\Entitizer\Listview { |
4 | 4 | |
5 | - use Modules\Entitizer, Template; |
|
5 | + use Modules\Entitizer; |
|
6 | + use Template; |
|
6 | 7 | |
7 | 8 | class Variables extends Entitizer\Utils\Listview { |
8 | 9 |