@@ -2,7 +2,8 @@ |
||
2 | 2 | |
3 | 3 | namespace Modules\Entitizer\Utils { |
4 | 4 | |
5 | - use Modules\Entitizer, Config; |
|
5 | + use Modules\Entitizer; |
|
6 | + use Config; |
|
6 | 7 | |
7 | 8 | abstract class View { |
8 | 9 |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | |
33 | 33 | $selection = []; |
34 | 34 | |
35 | - foreach ($this->definition->paramsSecure() as $field) $selection[] = ('ent.' . $field); |
|
35 | + foreach ($this->definition->paramsSecure() as $field) $selection[] = ('ent.'.$field); |
|
36 | 36 | |
37 | 37 | # ------------------------ |
38 | 38 | |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | |
46 | 46 | $order_by = []; |
47 | 47 | |
48 | - foreach ($this->castOrderBy($data) as $field => $direction) $order_by[] = ('ent.' . $field . ' ' . $direction); |
|
48 | + foreach ($this->castOrderBy($data) as $field => $direction) $order_by[] = ('ent.'.$field.' '.$direction); |
|
49 | 49 | |
50 | 50 | # ------------------------ |
51 | 51 |
@@ -16,7 +16,9 @@ discard block |
||
16 | 16 | |
17 | 17 | foreach ($data as $field => $direction) { |
18 | 18 | |
19 | - if (false === ($param = $this->definition->param($field))) continue; |
|
19 | + if (false === ($param = $this->definition->param($field))) { |
|
20 | + continue; |
|
21 | + } |
|
20 | 22 | |
21 | 23 | $order_by[$param->name] = ((strtoupper($direction) !== 'DESC') ? 'ASC' : 'DESC'); |
22 | 24 | } |
@@ -32,7 +34,9 @@ discard block |
||
32 | 34 | |
33 | 35 | $selection = []; |
34 | 36 | |
35 | - foreach ($this->definition->paramsSecure() as $field) $selection[] = ('ent.' . $field); |
|
37 | + foreach ($this->definition->paramsSecure() as $field) { |
|
38 | + $selection[] = ('ent.' . $field); |
|
39 | + } |
|
36 | 40 | |
37 | 41 | # ------------------------ |
38 | 42 | |
@@ -45,7 +49,9 @@ discard block |
||
45 | 49 | |
46 | 50 | $order_by = []; |
47 | 51 | |
48 | - foreach ($this->castOrderBy($data) as $field => $direction) $order_by[] = ('ent.' . $field . ' ' . $direction); |
|
52 | + foreach ($this->castOrderBy($data) as $field => $direction) { |
|
53 | + $order_by[] = ('ent.' . $field . ' ' . $direction); |
|
54 | + } |
|
49 | 55 | |
50 | 56 | # ------------------------ |
51 | 57 |
@@ -10,7 +10,9 @@ |
||
10 | 10 | |
11 | 11 | protected static function init(string $file_name) { |
12 | 12 | |
13 | - if (is_array($range = Explorer::php($file_name))) static::$range = $range; |
|
13 | + if (is_array($range = Explorer::php($file_name))) { |
|
14 | + static::$range = $range; |
|
15 | + } |
|
14 | 16 | } |
15 | 17 | |
16 | 18 | # Check if item exists |
@@ -12,14 +12,14 @@ |
||
12 | 12 | |
13 | 13 | if (false === ($mime = self::get($extension))) return false; |
14 | 14 | |
15 | - return (preg_match(('/^' . $type . '\//'), $mime) ? true : false); |
|
15 | + return (preg_match(('/^'.$type.'\//'), $mime) ? true : false); |
|
16 | 16 | } |
17 | 17 | |
18 | 18 | # Autoloader |
19 | 19 | |
20 | 20 | public static function __autoload() { |
21 | 21 | |
22 | - self::init(DIR_DATA . 'Mime.php'); |
|
22 | + self::init(DIR_DATA.'Mime.php'); |
|
23 | 23 | } |
24 | 24 | |
25 | 25 | # Check if extension is image |
@@ -10,7 +10,12 @@ discard block |
||
10 | 10 | |
11 | 11 | $value = false; |
12 | 12 | |
13 | - foreach ($path as $item) if (isset($array[$item])) $value = ($array = $array[$item]); else return false; |
|
13 | + foreach ($path as $item) { |
|
14 | + if (isset($array[$item])) $value = ($array = $array[$item]); |
|
15 | + } |
|
16 | + else { |
|
17 | + return false; |
|
18 | + } |
|
14 | 19 | |
15 | 20 | # ------------------------ |
16 | 21 | |
@@ -23,10 +28,12 @@ discard block |
||
23 | 28 | |
24 | 29 | $result = []; |
25 | 30 | |
26 | - foreach ($keys as $key) if (is_scalar($key)) { |
|
31 | + foreach ($keys as $key) { |
|
32 | + if (is_scalar($key)) { |
|
27 | 33 | |
28 | 34 | $result[$key] = ((isset($array[$key]) && is_scalar($array[$key])) ? $array[$key] : false); |
29 | 35 | } |
36 | + } |
|
30 | 37 | |
31 | 38 | # ------------------------ |
32 | 39 | |
@@ -39,7 +46,9 @@ discard block |
||
39 | 46 | |
40 | 47 | $result = []; |
41 | 48 | |
42 | - foreach ($array as $key => $value) $result[] = [$key_name => $key, $value_name => $value]; |
|
49 | + foreach ($array as $key => $value) { |
|
50 | + $result[] = [$key_name => $key, $value_name => $value]; |
|
51 | + } |
|
43 | 52 | |
44 | 53 | # ------------------------ |
45 | 54 | |
@@ -57,9 +66,15 @@ discard block |
||
57 | 66 | |
58 | 67 | $result = []; $column = array_map($select_key, $array); |
59 | 68 | |
60 | - if (!$descending) asort($column); else arsort($column); |
|
69 | + if (!$descending) { |
|
70 | + asort($column); |
|
71 | + } else { |
|
72 | + arsort($column); |
|
73 | + } |
|
61 | 74 | |
62 | - foreach (array_keys($column) as $key) $result[$key] = $array[$key]; |
|
75 | + foreach (array_keys($column) as $key) { |
|
76 | + $result[$key] = $array[$key]; |
|
77 | + } |
|
63 | 78 | |
64 | 79 | # ------------------------ |
65 | 80 |
@@ -10,7 +10,9 @@ discard block |
||
10 | 10 | |
11 | 11 | public function add(string $name, $default, callable $handler) { |
12 | 12 | |
13 | - if ('' === $name) return; |
|
13 | + if ('' === $name) { |
|
14 | + return; |
|
15 | + } |
|
14 | 16 | |
15 | 17 | $this->config[$name] = $handler; $this->values[$name] = null; |
16 | 18 | |
@@ -23,11 +25,11 @@ discard block |
||
23 | 25 | |
24 | 26 | foreach ($data as $name => $value) { |
25 | 27 | |
26 | - if (!isset($this->config[$name])) continue; |
|
27 | - |
|
28 | - try { $this->values[$name] = $this->config[$name]($value); } |
|
28 | + if (!isset($this->config[$name])) { |
|
29 | + continue; |
|
30 | + } |
|
29 | 31 | |
30 | - catch (\TypeError $e) {} |
|
32 | + try { $this->values[$name] = $this->config[$name]($value); } catch (\TypeError $e) {} |
|
31 | 33 | } |
32 | 34 | } |
33 | 35 | |
@@ -39,11 +41,11 @@ discard block |
||
39 | 41 | |
40 | 42 | foreach ($this->config as $name => $handler) { |
41 | 43 | |
42 | - if (!($isset = isset($data[$name])) && !$process_all) continue; |
|
44 | + if (!($isset = isset($data[$name])) && !$process_all) { |
|
45 | + continue; |
|
46 | + } |
|
43 | 47 | |
44 | - try { $cast[$name] = ($isset ? $handler($data[$name]) : $this->values[$name]); } |
|
45 | - |
|
46 | - catch (\TypeError $e) { $cast[$name] = $this->values[$name]; } |
|
48 | + try { $cast[$name] = ($isset ? $handler($data[$name]) : $this->values[$name]); } catch (\TypeError $e) { $cast[$name] = $this->values[$name]; } |
|
47 | 49 | } |
48 | 50 | |
49 | 51 | # ------------------------ |
@@ -55,7 +57,9 @@ discard block |
||
55 | 57 | |
56 | 58 | public function get(string $name = null) { |
57 | 59 | |
58 | - if (null === $name) return $this->values; |
|
60 | + if (null === $name) { |
|
61 | + return $this->values; |
|
62 | + } |
|
59 | 63 | |
60 | 64 | return ($this->values[$name] ?? null); |
61 | 65 | } |
@@ -10,7 +10,9 @@ |
||
10 | 10 | |
11 | 11 | public function set(string $name, $value) { |
12 | 12 | |
13 | - if (is_scalar($value)) $this->data[$name] = $value; |
|
13 | + if (is_scalar($value)) { |
|
14 | + $this->data[$name] = $value; |
|
15 | + } |
|
14 | 16 | |
15 | 17 | return $this; |
16 | 18 | } |
@@ -24,14 +24,14 @@ |
||
24 | 24 | |
25 | 25 | if (0 === $key) $names = $this->getString(array_keys($row), '$name', ', '); |
26 | 26 | |
27 | - $values[] = ('(' . $this->getString(array_values($row), '$value', ', ') . ')'); |
|
27 | + $values[] = ('('.$this->getString(array_values($row), '$value', ', ').')'); |
|
28 | 28 | } |
29 | 29 | |
30 | 30 | # Build query |
31 | 31 | |
32 | - $this->query = ('INSERT ' . ($ignore ? 'IGNORE ' : '') . |
|
32 | + $this->query = ('INSERT '.($ignore ? 'IGNORE ' : ''). |
|
33 | 33 | |
34 | - 'INTO ' . $table . ' (' . $names . ') VALUES ' . implode(', ', $values)); |
|
34 | + 'INTO '.$table.' ('.$names.') VALUES '.implode(', ', $values)); |
|
35 | 35 | } |
36 | 36 | } |
37 | 37 | } |
@@ -10,18 +10,18 @@ discard block |
||
10 | 10 | |
11 | 11 | # Define constants |
12 | 12 | |
13 | -define('DIR_ENGINE', (dirname(__FILE__) . '/')); |
|
13 | +define('DIR_ENGINE', (dirname(__FILE__).'/')); |
|
14 | 14 | |
15 | -define('DIR_WWW', (DIR_ENGINE . '../')); |
|
16 | -define('DIR_UPLOADS', (DIR_ENGINE . '../uploads/')); |
|
15 | +define('DIR_WWW', (DIR_ENGINE.'../')); |
|
16 | +define('DIR_UPLOADS', (DIR_ENGINE.'../uploads/')); |
|
17 | 17 | |
18 | 18 | # Require framework main file |
19 | 19 | |
20 | -require_once(DIR_ENGINE . 'Framework/Main.php'); |
|
20 | +require_once(DIR_ENGINE.'Framework/Main.php'); |
|
21 | 21 | |
22 | 22 | # Require system main file |
23 | 23 | |
24 | -require_once(DIR_ENGINE . 'System/Main.php'); |
|
24 | +require_once(DIR_ENGINE.'System/Main.php'); |
|
25 | 25 | |
26 | 26 | # Register classes autoloader |
27 | 27 | |
@@ -33,13 +33,13 @@ discard block |
||
33 | 33 | |
34 | 34 | $system_classes = ['Frames', 'Handlers', 'Modules', 'Utils', 'Views', 'Dispatcher', 'Installer']; |
35 | 35 | |
36 | - $path = ((in_array($path[0], $system_classes, true) ? DIR_SYSTEM_CLASSES : DIR_CLASSES) . implode('/', $path)); |
|
36 | + $path = ((in_array($path[0], $system_classes, true) ? DIR_SYSTEM_CLASSES : DIR_CLASSES).implode('/', $path)); |
|
37 | 37 | |
38 | 38 | # Require class file |
39 | 39 | |
40 | - if (@file_exists($file_name = ($path . '.php')) && @is_file($file_name)) require_once $file_name; |
|
40 | + if (@file_exists($file_name = ($path.'.php')) && @is_file($file_name)) require_once $file_name; |
|
41 | 41 | |
42 | - else if (@file_exists($file_name = ($path . '/' . $last . '.php')) && @is_file($file_name)) require_once $file_name; |
|
42 | + else if (@file_exists($file_name = ($path.'/'.$last.'.php')) && @is_file($file_name)) require_once $file_name; |
|
43 | 43 | |
44 | 44 | # Check if class exists |
45 | 45 |
@@ -2,15 +2,15 @@ |
||
2 | 2 | |
3 | 3 | # Database tables |
4 | 4 | |
5 | -define('TABLE_PAGES', 'pages'); |
|
6 | -define('TABLE_PAGES_RELATIONS', 'pages_relations'); |
|
5 | +define('TABLE_PAGES', 'pages'); |
|
6 | +define('TABLE_PAGES_RELATIONS', 'pages_relations'); |
|
7 | 7 | |
8 | -define('TABLE_MENU', 'menu'); |
|
9 | -define('TABLE_MENU_RELATIONS', 'menu_relations'); |
|
8 | +define('TABLE_MENU', 'menu'); |
|
9 | +define('TABLE_MENU_RELATIONS', 'menu_relations'); |
|
10 | 10 | |
11 | -define('TABLE_VARIABLES', 'variables'); |
|
12 | -define('TABLE_WIDGETS', 'widgets'); |
|
11 | +define('TABLE_VARIABLES', 'variables'); |
|
12 | +define('TABLE_WIDGETS', 'widgets'); |
|
13 | 13 | |
14 | -define('TABLE_USERS', 'users'); |
|
15 | -define('TABLE_USERS_SECRETS', 'users_secrets'); |
|
16 | -define('TABLE_USERS_SESSIONS', 'users_sessions'); |
|
14 | +define('TABLE_USERS', 'users'); |
|
15 | +define('TABLE_USERS_SECRETS', 'users_secrets'); |
|
16 | +define('TABLE_USERS_SESSIONS', 'users_sessions'); |