@@ -10,7 +10,7 @@ |
||
10 | 10 | |
11 | 11 | public static function get(string $name) { |
12 | 12 | |
13 | - $class_name = ('Schemas\\' . $name); |
|
13 | + $class_name = ('Schemas\\'.$name); |
|
14 | 14 | |
15 | 15 | if (!isset(self::$cache[$class_name])) self::$cache[$class_name] = new $class_name; |
16 | 16 |
@@ -12,7 +12,9 @@ |
||
12 | 12 | |
13 | 13 | $class_name = ('Schemas\\' . $name); |
14 | 14 | |
15 | - if (!isset(self::$cache[$class_name])) self::$cache[$class_name] = new $class_name; |
|
15 | + if (!isset(self::$cache[$class_name])) { |
|
16 | + self::$cache[$class_name] = new $class_name; |
|
17 | + } |
|
16 | 18 | |
17 | 19 | # ------------------------ |
18 | 20 |
@@ -20,7 +20,9 @@ discard block |
||
20 | 20 | |
21 | 21 | $item->children = ($children = Template::createBlock()); |
22 | 22 | |
23 | - foreach ($this->menu[$id]['children'] as $child) $children->addItem($this->parseItem($child)); |
|
23 | + foreach ($this->menu[$id]['children'] as $child) { |
|
24 | + $children->addItem($this->parseItem($child)); |
|
25 | + } |
|
24 | 26 | |
25 | 27 | } else { |
26 | 28 | |
@@ -44,7 +46,9 @@ discard block |
||
44 | 46 | |
45 | 47 | $menu = Entitizer::treeview(TABLE_MENU)->subtree(0, ['active' => true]); |
46 | 48 | |
47 | - if (false !== $menu) $this->menu = $menu; |
|
49 | + if (false !== $menu) { |
|
50 | + $this->menu = $menu; |
|
51 | + } |
|
48 | 52 | } |
49 | 53 | |
50 | 54 | # Get block |
@@ -53,7 +57,9 @@ discard block |
||
53 | 57 | |
54 | 58 | $menu = Template::createBlock(); |
55 | 59 | |
56 | - foreach ($this->menu[0]['children'] as $id) $menu->addItem($this->parseItem($id)); |
|
60 | + foreach ($this->menu[0]['children'] as $id) { |
|
61 | + $menu->addItem($this->parseItem($id)); |
|
62 | + } |
|
57 | 63 | |
58 | 64 | # ------------------------ |
59 | 65 |
@@ -58,7 +58,7 @@ |
||
58 | 58 | |
59 | 59 | list ($extremum, $index) = $data; $block = $pagination->getBlock($class); |
60 | 60 | |
61 | - if ($active === $extremum) { $block->disable(); $pagination->getBlock($class . '_disabled')->enable(); } |
|
61 | + if ($active === $extremum) { $block->disable(); $pagination->getBlock($class.'_disabled')->enable(); } |
|
62 | 62 | |
63 | 63 | else $block->link = $url->setAttribute('index', $index)->getString(); |
64 | 64 | } |
@@ -14,7 +14,9 @@ discard block |
||
14 | 14 | |
15 | 15 | for ($index = ($active - 2); $index <= ($active + 2); $index++) { |
16 | 16 | |
17 | - if (!($index > 0 && $index <= $count)) continue; |
|
17 | + if (!($index > 0 && $index <= $count)) { |
|
18 | + continue; |
|
19 | + } |
|
18 | 20 | |
19 | 21 | $class = (($index === $active) ? 'active item' : 'item'); |
20 | 22 | |
@@ -41,7 +43,9 @@ discard block |
||
41 | 43 | |
42 | 44 | $block->link = $url->setAttribute('index', $index)->getString(); $block->index = $index; |
43 | 45 | |
44 | - if ($closest) $block->getBlock('ellipsis')->disable(); |
|
46 | + if ($closest) { |
|
47 | + $block->getBlock('ellipsis')->disable(); |
|
48 | + } |
|
45 | 49 | } |
46 | 50 | } |
47 | 51 | |
@@ -58,9 +62,9 @@ discard block |
||
58 | 62 | |
59 | 63 | list ($extremum, $index) = $data; $block = $pagination->getBlock($class); |
60 | 64 | |
61 | - if ($active === $extremum) { $block->disable(); $pagination->getBlock($class . '_disabled')->enable(); } |
|
62 | - |
|
63 | - else $block->link = $url->setAttribute('index', $index)->getString(); |
|
65 | + if ($active === $extremum) { $block->disable(); $pagination->getBlock($class . '_disabled')->enable(); } else { |
|
66 | + $block->link = $url->setAttribute('index', $index)->getString(); |
|
67 | + } |
|
64 | 68 | } |
65 | 69 | } |
66 | 70 | |
@@ -68,9 +72,13 @@ discard block |
||
68 | 72 | |
69 | 73 | public static function block(int $index, int $display, int $total, Url $url) { |
70 | 74 | |
71 | - if (($index <= 0) || ($display <= 0) || ($total <= 0)) return false; |
|
75 | + if (($index <= 0) || ($display <= 0) || ($total <= 0)) { |
|
76 | + return false; |
|
77 | + } |
|
72 | 78 | |
73 | - if (($display >= $total) || ($index > ($count = ceil($total / $display)))) return false; |
|
79 | + if (($display >= $total) || ($index > ($count = ceil($total / $display)))) { |
|
80 | + return false; |
|
81 | + } |
|
74 | 82 | |
75 | 83 | # Create block |
76 | 84 |
@@ -21,7 +21,7 @@ |
||
21 | 21 | |
22 | 22 | if (false === ($path = Extend\Templates::path())) throw new Exception\View; |
23 | 23 | |
24 | - if (!isset(self::$cache[$file_name = ($path . $name . '.tpl')])) { |
|
24 | + if (!isset(self::$cache[$file_name = ($path.$name.'.tpl')])) { |
|
25 | 25 | |
26 | 26 | if (false === ($contents = Explorer::getContents($file_name))) throw new Exception\ViewFile($file_name); |
27 | 27 |
@@ -19,11 +19,15 @@ |
||
19 | 19 | |
20 | 20 | public static function get(string $name) { |
21 | 21 | |
22 | - if (false === ($path = Extend\Templates::path())) throw new Exception\View; |
|
22 | + if (false === ($path = Extend\Templates::path())) { |
|
23 | + throw new Exception\View; |
|
24 | + } |
|
23 | 25 | |
24 | 26 | if (!isset(self::$cache[$file_name = ($path . $name . '.tpl')])) { |
25 | 27 | |
26 | - if (false === ($contents = Explorer::getContents($file_name))) throw new Exception\ViewFile($file_name); |
|
28 | + if (false === ($contents = Explorer::getContents($file_name))) { |
|
29 | + throw new Exception\ViewFile($file_name); |
|
30 | + } |
|
27 | 31 | |
28 | 32 | self::$cache[$file_name] = Template::createBlock($contents); |
29 | 33 | } |
@@ -21,7 +21,9 @@ discard block |
||
21 | 21 | |
22 | 22 | public static function set(string $type, string $text, string $title = null) { |
23 | 23 | |
24 | - if (!in_array($type, static::$types, true) || isset(static::$items[$type]) || ('' === $text)) return; |
|
24 | + if (!in_array($type, static::$types, true) || isset(static::$items[$type]) || ('' === $text)) { |
|
25 | + return; |
|
26 | + } |
|
25 | 27 | |
26 | 28 | static::$items[$type] = ['text' => $text, 'title' => (('' !== $title) ? $title : null)]; |
27 | 29 | } |
@@ -45,7 +47,9 @@ discard block |
||
45 | 47 | |
46 | 48 | $block->type = $type; $block->text = Template::createBlock($item['text']); |
47 | 49 | |
48 | - if (isset($item['title'])) $block->getBlock('title')->set('text', $item['title'])->enable(); |
|
50 | + if (isset($item['title'])) { |
|
51 | + $block->getBlock('title')->set('text', $item['title'])->enable(); |
|
52 | + } |
|
49 | 53 | } |
50 | 54 | |
51 | 55 | # ------------------------ |
@@ -8,13 +8,17 @@ |
||
8 | 8 | |
9 | 9 | public function validate($data) { |
10 | 10 | |
11 | - if (!is_array($data)) return null; |
|
11 | + if (!is_array($data)) { |
|
12 | + return null; |
|
13 | + } |
|
12 | 14 | |
13 | 15 | $result = []; |
14 | 16 | |
15 | 17 | foreach ($data as $item) { |
16 | 18 | |
17 | - if (!is_array($item) || (null === ($item = parent::validate($item)))) return null; |
|
19 | + if (!is_array($item) || (null === ($item = parent::validate($item)))) { |
|
20 | + return null; |
|
21 | + } |
|
18 | 22 | |
19 | 23 | $result[] = $item; |
20 | 24 | } |
@@ -10,7 +10,7 @@ |
||
10 | 10 | |
11 | 11 | protected static $loader_class = 'Modules\Extend\Loader\Addons'; |
12 | 12 | |
13 | - protected static $root_dir = (DIR_SYSTEM_CLASSES . 'Addons/'); |
|
13 | + protected static $root_dir = (DIR_SYSTEM_CLASSES.'Addons/'); |
|
14 | 14 | |
15 | 15 | protected static $schema_prototype = 'Prototype\Addon', $schema = 'Addons', $regex_name = REGEX_ADDON_NAME; |
16 | 16 |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | |
131 | 131 | if (null === $this->primary) return false; |
132 | 132 | |
133 | - return ($this->dir_name . $this->primary['name'] . '/'); |
|
133 | + return ($this->dir_name.$this->primary['name'].'/'); |
|
134 | 134 | } |
135 | 135 | |
136 | 136 | # Get active extension path |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | |
140 | 140 | if (null === $this->active) return false; |
141 | 141 | |
142 | - return ($this->dir_name . $this->active['name'] . '/'); |
|
142 | + return ($this->dir_name.$this->active['name'].'/'); |
|
143 | 143 | } |
144 | 144 | |
145 | 145 | # Get active extension data |
@@ -33,11 +33,15 @@ discard block |
||
33 | 33 | |
34 | 34 | protected function getFirst() { |
35 | 35 | |
36 | - if ($this->loaded) return ($this->items[key($this->items)] ?? null); |
|
36 | + if ($this->loaded) { |
|
37 | + return ($this->items[key($this->items)] ?? null); |
|
38 | + } |
|
37 | 39 | |
38 | 40 | foreach (Explorer::iterateDirs($this->dir_name) as $name) { |
39 | 41 | |
40 | - if (null !== ($data = $this->getItem($name))) return $data; |
|
42 | + if (null !== ($data = $this->getItem($name))) { |
|
43 | + return $data; |
|
44 | + } |
|
41 | 45 | } |
42 | 46 | |
43 | 47 | # ------------------------ |
@@ -53,7 +57,9 @@ discard block |
||
53 | 57 | |
54 | 58 | foreach (Explorer::iterateDirs($this->dir_name) as $name) { |
55 | 59 | |
56 | - if (null !== ($data = $this->getItem($name))) $items[$name] = $data; |
|
60 | + if (null !== ($data = $this->getItem($name))) { |
|
61 | + $items[$name] = $data; |
|
62 | + } |
|
57 | 63 | } |
58 | 64 | |
59 | 65 | # ------------------------ |
@@ -94,7 +100,9 @@ discard block |
||
94 | 100 | |
95 | 101 | public function activate(string $name) { |
96 | 102 | |
97 | - if (null === ($data = $this->getItem($name))) return false; |
|
103 | + if (null === ($data = $this->getItem($name))) { |
|
104 | + return false; |
|
105 | + } |
|
98 | 106 | |
99 | 107 | $this->active = $data; |
100 | 108 | |
@@ -128,7 +136,9 @@ discard block |
||
128 | 136 | |
129 | 137 | public function pathPrimary() { |
130 | 138 | |
131 | - if (null === $this->primary) return false; |
|
139 | + if (null === $this->primary) { |
|
140 | + return false; |
|
141 | + } |
|
132 | 142 | |
133 | 143 | return ($this->dir_name . $this->primary['name'] . '/'); |
134 | 144 | } |
@@ -137,7 +147,9 @@ discard block |
||
137 | 147 | |
138 | 148 | public function path() { |
139 | 149 | |
140 | - if (null === $this->active) return false; |
|
150 | + if (null === $this->active) { |
|
151 | + return false; |
|
152 | + } |
|
141 | 153 | |
142 | 154 | return ($this->dir_name . $this->active['name'] . '/'); |
143 | 155 | } |
@@ -146,7 +158,9 @@ discard block |
||
146 | 158 | |
147 | 159 | public function data(string $name = null) { |
148 | 160 | |
149 | - if (null === $name) return ($this->active ?? false); |
|
161 | + if (null === $name) { |
|
162 | + return ($this->active ?? false); |
|
163 | + } |
|
150 | 164 | |
151 | 165 | return ($this->active[$name] ?? false); |
152 | 166 | } |
@@ -22,7 +22,9 @@ discard block |
||
22 | 22 | |
23 | 23 | foreach ((Schema::get(static::$schema)->load() ?? []) as $item) { |
24 | 24 | |
25 | - if (isset($items[$item['name']])) $items[$item['name']]['installed'] = true; |
|
25 | + if (isset($items[$item['name']])) { |
|
26 | + $items[$item['name']]['installed'] = true; |
|
27 | + } |
|
26 | 28 | } |
27 | 29 | |
28 | 30 | # ------------------------ |
@@ -38,7 +40,9 @@ discard block |
||
38 | 40 | |
39 | 41 | foreach ((Schema::get(static::$schema)->load() ?? []) as $item) { |
40 | 42 | |
41 | - if (static::$extension_class::valid($item['name'])) $items[$item['name']] = $item; |
|
43 | + if (static::$extension_class::valid($item['name'])) { |
|
44 | + $items[$item['name']] = $item; |
|
45 | + } |
|
42 | 46 | } |
43 | 47 | |
44 | 48 | # ------------------------ |
@@ -59,18 +63,26 @@ discard block |
||
59 | 63 | |
60 | 64 | public function install(string $name, bool $value = true) { |
61 | 65 | |
62 | - if (!isset($this->items[$name])) return false; |
|
66 | + if (!isset($this->items[$name])) { |
|
67 | + return false; |
|
68 | + } |
|
63 | 69 | |
64 | 70 | $items = []; |
65 | 71 | |
66 | 72 | foreach ($this->items as $item) { |
67 | 73 | |
68 | - if ($value) { if ($item['installed'] || ($item['name'] === $name)) $items[] = $item; } |
|
69 | - |
|
70 | - else { if ($item['installed'] && ($item['name'] !== $name)) $items[] = $item; } |
|
74 | + if ($value) { if ($item['installed'] || ($item['name'] === $name)) { |
|
75 | + $items[] = $item; |
|
76 | + } |
|
77 | + } else { if ($item['installed'] && ($item['name'] !== $name)) { |
|
78 | + $items[] = $item; |
|
79 | + } |
|
80 | + } |
|
71 | 81 | } |
72 | 82 | |
73 | - if (!Schema::get(static::$schema)->save($items)) return false; |
|
83 | + if (!Schema::get(static::$schema)->save($items)) { |
|
84 | + return false; |
|
85 | + } |
|
74 | 86 | |
75 | 87 | $this->items[$name]['installed'] = $value; |
76 | 88 |