@@ -2,7 +2,9 @@ |
||
2 | 2 | |
3 | 3 | namespace System\Modules\Entitizer\Listview { |
4 | 4 | |
5 | - use System\Modules\Entitizer, System\Utils\Lister, Template; |
|
5 | + use System\Modules\Entitizer; |
|
6 | + use System\Utils\Lister; |
|
7 | + use Template; |
|
6 | 8 | |
7 | 9 | class Pages extends Entitizer\Utils\Listview { |
8 | 10 |
@@ -34,7 +34,9 @@ |
||
34 | 34 | |
35 | 35 | $contents->block('parent')->block('browse')->disable(); |
36 | 36 | |
37 | - } else $contents->block('parent')->block('browse')->link = $this->parent->link; |
|
37 | + } else { |
|
38 | + $contents->block('parent')->block('browse')->link = $this->parent->link; |
|
39 | + } |
|
38 | 40 | } |
39 | 41 | |
40 | 42 | # Add item additional data |
@@ -2,7 +2,10 @@ |
||
2 | 2 | |
3 | 3 | namespace System\Modules\Entitizer\Listview { |
4 | 4 | |
5 | - use System\Modules\Auth, System\Modules\Entitizer, System\Utils\Lister, Template; |
|
5 | + use System\Modules\Auth; |
|
6 | + use System\Modules\Entitizer; |
|
7 | + use System\Utils\Lister; |
|
8 | + use Template; |
|
6 | 9 | |
7 | 10 | class Users extends Entitizer\Utils\Listview { |
8 | 11 |
@@ -36,7 +36,9 @@ |
||
36 | 36 | |
37 | 37 | $view->rank = Lister\Rank::get($user->rank); |
38 | 38 | |
39 | - if ($user->id === Auth::user()->id) $view->block('remove')->class = 'disabled'; |
|
39 | + if ($user->id === Auth::user()->id) { |
|
40 | + $view->block('remove')->class = 'disabled'; |
|
41 | + } |
|
40 | 42 | } |
41 | 43 | } |
42 | 44 | } |
@@ -2,7 +2,8 @@ |
||
2 | 2 | |
3 | 3 | namespace System\Modules\Entitizer\Listview { |
4 | 4 | |
5 | - use System\Modules\Entitizer, Template; |
|
5 | + use System\Modules\Entitizer; |
|
6 | + use Template; |
|
6 | 7 | |
7 | 8 | class Variables extends Entitizer\Utils\Listview { |
8 | 9 |
@@ -2,7 +2,9 @@ |
||
2 | 2 | |
3 | 3 | namespace System\Modules\Entitizer\Listview { |
4 | 4 | |
5 | - use System\Modules\Entitizer, Template, Language; |
|
5 | + use System\Modules\Entitizer; |
|
6 | + use Template; |
|
7 | + use Language; |
|
6 | 8 | |
7 | 9 | class Widgets extends Entitizer\Utils\Listview { |
8 | 10 |
@@ -2,7 +2,8 @@ |
||
2 | 2 | |
3 | 3 | namespace System\Modules\Entitizer\Utils { |
4 | 4 | |
5 | - use System\Modules\Entitizer, DB; |
|
5 | + use System\Modules\Entitizer; |
|
6 | + use DB; |
|
6 | 7 | |
7 | 8 | abstract class Entity extends Entitizer { |
8 | 9 |
@@ -20,7 +20,9 @@ discard block |
||
20 | 20 | |
21 | 21 | $entity = self::get(static::$type, $entity->data['parent_id']); |
22 | 22 | |
23 | - if (0 === $entity->id) return []; |
|
23 | + if (0 === $entity->id) { |
|
24 | + return []; |
|
25 | + } |
|
24 | 26 | |
25 | 27 | $path[] = array_merge(['id' => $entity->id], $entity->data); |
26 | 28 | } |
@@ -43,7 +45,9 @@ discard block |
||
43 | 45 | |
44 | 46 | foreach ($this->definition->params() as $name => $param) { |
45 | 47 | |
46 | - if (isset($data[$name])) $set[$name] = $param->cast($data[$name]); |
|
48 | + if (isset($data[$name])) { |
|
49 | + $set[$name] = $param->cast($data[$name]); |
|
50 | + } |
|
47 | 51 | } |
48 | 52 | |
49 | 53 | # ------------------------ |
@@ -61,11 +65,15 @@ discard block |
||
61 | 65 | |
62 | 66 | # Preset data array |
63 | 67 | |
64 | - foreach ($this->definition->params() as $name => $param) $this->data[$name] = $param->cast(null); |
|
68 | + foreach ($this->definition->params() as $name => $param) { |
|
69 | + $this->data[$name] = $param->cast(null); |
|
70 | + } |
|
65 | 71 | |
66 | 72 | # Preset path |
67 | 73 | |
68 | - if (static::$nesting) $this->data['path'] = []; |
|
74 | + if (static::$nesting) { |
|
75 | + $this->data['path'] = []; |
|
76 | + } |
|
69 | 77 | |
70 | 78 | # Implement entity |
71 | 79 | |
@@ -73,14 +81,18 @@ discard block |
||
73 | 81 | |
74 | 82 | # Init entity |
75 | 83 | |
76 | - if ($id > 0) $this->init($id); |
|
84 | + if ($id > 0) { |
|
85 | + $this->init($id); |
|
86 | + } |
|
77 | 87 | } |
78 | 88 | |
79 | 89 | # Check if unique param value exists |
80 | 90 | |
81 | 91 | public function check(string $name, $value) { |
82 | 92 | |
83 | - if ((false === ($param = $this->definition->get($name))) || !$param->unique()) return false; |
|
93 | + if ((false === ($param = $this->definition->get($name))) || !$param->unique()) { |
|
94 | + return false; |
|
95 | + } |
|
84 | 96 | |
85 | 97 | # Select entity from DB |
86 | 98 | |
@@ -101,7 +113,9 @@ discard block |
||
101 | 113 | |
102 | 114 | DB::select(static::$table, 'COUNT(id) as count', ['parent_id' => $this->id]); |
103 | 115 | |
104 | - if (!(DB::last() && DB::last()->status)) return false; |
|
116 | + if (!(DB::last() && DB::last()->status)) { |
|
117 | + return false; |
|
118 | + } |
|
105 | 119 | |
106 | 120 | # ------------------------ |
107 | 121 | |
@@ -133,7 +147,9 @@ discard block |
||
133 | 147 | |
134 | 148 | public function __get(string $name) { |
135 | 149 | |
136 | - if ($name === 'id') return $this->id; |
|
150 | + if ($name === 'id') { |
|
151 | + return $this->id; |
|
152 | + } |
|
137 | 153 | |
138 | 154 | return (isset($this->data[$name]) ? $this->data[$name] : null); |
139 | 155 | } |
@@ -2,7 +2,14 @@ |
||
2 | 2 | |
3 | 3 | namespace System\Modules\Entitizer\Utils { |
4 | 4 | |
5 | - use System\Modules\Entitizer, System\Utils\Messages, System\Utils\View, Ajax, Language, Number, Request, Template; |
|
5 | + use System\Modules\Entitizer; |
|
6 | + use System\Utils\Messages; |
|
7 | + use System\Utils\View; |
|
8 | + use Ajax; |
|
9 | + use Language; |
|
10 | + use Number; |
|
11 | + use Request; |
|
12 | + use Template; |
|
6 | 13 | |
7 | 14 | abstract class Handler { |
8 | 15 |
@@ -24,7 +24,9 @@ discard block |
||
24 | 24 | |
25 | 25 | # Set edit button |
26 | 26 | |
27 | - if (0 === $this->parent->id) $parent->block('edit')->disable(); else { |
|
27 | + if (0 === $this->parent->id) { |
|
28 | + $parent->block('edit')->disable(); |
|
29 | + } else { |
|
28 | 30 | |
29 | 31 | $parent->block('edit')->class = (!$this->create ? 'active item' : 'item'); |
30 | 32 | |
@@ -36,7 +38,9 @@ discard block |
||
36 | 38 | |
37 | 39 | private function processSelector(Template\Asset\Block $selector) { |
38 | 40 | |
39 | - if ($this->create) return $selector->disable(); |
|
41 | + if ($this->create) { |
|
42 | + return $selector->disable(); |
|
43 | + } |
|
40 | 44 | |
41 | 45 | $parent = Entitizer::get(static::$type, $this->entity->parent_id); |
42 | 46 | |
@@ -55,25 +59,33 @@ discard block |
||
55 | 59 | |
56 | 60 | # Set path / title |
57 | 61 | |
58 | - if (static::$nesting) $contents->path = $this->parent->path; |
|
59 | - |
|
60 | - else $contents->title = ($this->create ? Language::get(static::$naming_new) : $this->entity->__get(static::$naming)); |
|
62 | + if (static::$nesting) { |
|
63 | + $contents->path = $this->parent->path; |
|
64 | + } else { |
|
65 | + $contents->title = ($this->create ? Language::get(static::$naming_new) : $this->entity->__get(static::$naming)); |
|
66 | + } |
|
61 | 67 | |
62 | 68 | # Set link |
63 | 69 | |
64 | 70 | $link = (INSTALL_PATH . static::$link . '/'); |
65 | 71 | |
66 | - if (static::$nesting) $contents->link = ($link . ($this->create ? 'create' : 'edit') . '?id=' . $this->parent->id); |
|
67 | - |
|
68 | - else $contents->link = ($link . ($this->create ? 'create' : ('edit?id=' . $this->entity->id))); |
|
72 | + if (static::$nesting) { |
|
73 | + $contents->link = ($link . ($this->create ? 'create' : 'edit') . '?id=' . $this->parent->id); |
|
74 | + } else { |
|
75 | + $contents->link = ($link . ($this->create ? 'create' : ('edit?id=' . $this->entity->id))); |
|
76 | + } |
|
69 | 77 | |
70 | 78 | # Process parent block |
71 | 79 | |
72 | - if (static::$nesting) $this->processParent($contents->block('parent')); |
|
80 | + if (static::$nesting) { |
|
81 | + $this->processParent($contents->block('parent')); |
|
82 | + } |
|
73 | 83 | |
74 | 84 | # Process selector block |
75 | 85 | |
76 | - if (static::$nesting) $this->processSelector($contents->block('selector')); |
|
86 | + if (static::$nesting) { |
|
87 | + $this->processSelector($contents->block('selector')); |
|
88 | + } |
|
77 | 89 | |
78 | 90 | # Implement form |
79 | 91 | |
@@ -102,7 +114,9 @@ discard block |
||
102 | 114 | |
103 | 115 | if (Request::post('action') === 'remove') { |
104 | 116 | |
105 | - if (!$this->entity->remove()) return $ajax->error(Language::get(static::$message_error_remove)); |
|
117 | + if (!$this->entity->remove()) { |
|
118 | + return $ajax->error(Language::get(static::$message_error_remove)); |
|
119 | + } |
|
106 | 120 | } |
107 | 121 | |
108 | 122 | # ------------------------ |
@@ -114,23 +128,31 @@ discard block |
||
114 | 128 | |
115 | 129 | public function handle(bool $create = false) { |
116 | 130 | |
117 | - if (!($this->create = $create) && Request::isAjax()) return $this->handleAjax(); |
|
131 | + if (!($this->create = $create) && Request::isAjax()) { |
|
132 | + return $this->handleAjax(); |
|
133 | + } |
|
118 | 134 | |
119 | 135 | # Create entity |
120 | 136 | |
121 | - if (static::$nesting) $this->parent = Entitizer::get(static::$type, Number::format(Request::get('id'))); |
|
137 | + if (static::$nesting) { |
|
138 | + $this->parent = Entitizer::get(static::$type, Number::format(Request::get('id'))); |
|
139 | + } |
|
122 | 140 | |
123 | 141 | $this->entity = Entitizer::get(static::$type, (!$this->create ? Number::format(Request::get('id')) : 0)); |
124 | 142 | |
125 | 143 | # Redirect if entity not found |
126 | 144 | |
127 | - if (!$this->create && (0 === $this->entity->id)) return Request::redirect(INSTALL_PATH . static::$link); |
|
145 | + if (!$this->create && (0 === $this->entity->id)) { |
|
146 | + return Request::redirect(INSTALL_PATH . static::$link); |
|
147 | + } |
|
128 | 148 | |
129 | 149 | # Create form |
130 | 150 | |
131 | 151 | $this->form = new static::$form_class($this->entity); |
132 | 152 | |
133 | - if (static::$nesting && $this->create) $this->form->get('parent_id')->set($this->parent->id); |
|
153 | + if (static::$nesting && $this->create) { |
|
154 | + $this->form->get('parent_id')->set($this->parent->id); |
|
155 | + } |
|
134 | 156 | |
135 | 157 | # Handle form |
136 | 158 |
@@ -2,7 +2,14 @@ |
||
2 | 2 | |
3 | 3 | namespace System\Modules\Entitizer\Utils { |
4 | 4 | |
5 | - use System\Modules\Entitizer, System\Utils\Pagination, System\Utils\View, Ajax, Number, Request, Template, Url; |
|
5 | + use System\Modules\Entitizer; |
|
6 | + use System\Utils\Pagination; |
|
7 | + use System\Utils\View; |
|
8 | + use Ajax; |
|
9 | + use Number; |
|
10 | + use Request; |
|
11 | + use Template; |
|
12 | + use Url; |
|
6 | 13 | |
7 | 14 | abstract class Listview { |
8 | 15 |
@@ -22,9 +22,11 @@ discard block |
||
22 | 22 | |
23 | 23 | # Set edit button |
24 | 24 | |
25 | - if (0 === $this->parent->id) $parent->block('edit')->disable(); |
|
26 | - |
|
27 | - else $parent->block('edit')->id = $this->parent->id; |
|
25 | + if (0 === $this->parent->id) { |
|
26 | + $parent->block('edit')->disable(); |
|
27 | + } else { |
|
28 | + $parent->block('edit')->id = $this->parent->id; |
|
29 | + } |
|
28 | 30 | } |
29 | 31 | |
30 | 32 | # Get items block |
@@ -82,21 +84,29 @@ discard block |
||
82 | 84 | |
83 | 85 | # Set path |
84 | 86 | |
85 | - if (static::$nesting) $contents->path = $this->parent->path; |
|
87 | + if (static::$nesting) { |
|
88 | + $contents->path = $this->parent->path; |
|
89 | + } |
|
86 | 90 | |
87 | 91 | # Process parent block |
88 | 92 | |
89 | - if (static::$nesting && !$ajax) $this->processParent($contents->block('parent')); |
|
93 | + if (static::$nesting && !$ajax) { |
|
94 | + $this->processParent($contents->block('parent')); |
|
95 | + } |
|
90 | 96 | |
91 | 97 | # Set items |
92 | 98 | |
93 | 99 | $items = $this->getItemsBlock($ajax); |
94 | 100 | |
95 | - if ($items->count() > 0) $contents->items = $items; |
|
101 | + if ($items->count() > 0) { |
|
102 | + $contents->items = $items; |
|
103 | + } |
|
96 | 104 | |
97 | 105 | # Set pagination |
98 | 106 | |
99 | - if (!$ajax) $contents->pagination = $this->getPaginationBlock(); |
|
107 | + if (!$ajax) { |
|
108 | + $contents->pagination = $this->getPaginationBlock(); |
|
109 | + } |
|
100 | 110 | |
101 | 111 | # Add additional data for specific entity |
102 | 112 | |
@@ -115,7 +125,9 @@ discard block |
||
115 | 125 | |
116 | 126 | # Create parent entity |
117 | 127 | |
118 | - if (static::$nesting) $this->parent = Entitizer::get(static::$type, Number::format(Request::get('parent_id'))); |
|
128 | + if (static::$nesting) { |
|
129 | + $this->parent = Entitizer::get(static::$type, Number::format(Request::get('parent_id'))); |
|
130 | + } |
|
119 | 131 | |
120 | 132 | # Get children items |
121 | 133 | |
@@ -132,13 +144,17 @@ discard block |
||
132 | 144 | |
133 | 145 | public function handle() { |
134 | 146 | |
135 | - if (Request::isAjax()) return $this->handleAjax(); |
|
147 | + if (Request::isAjax()) { |
|
148 | + return $this->handleAjax(); |
|
149 | + } |
|
136 | 150 | |
137 | 151 | $this->index = Number::format(Request::get('index'), 1, 999999); |
138 | 152 | |
139 | 153 | # Create parent entity |
140 | 154 | |
141 | - if (static::$nesting) $this->parent = Entitizer::get(static::$type, Number::format(Request::get('parent_id'))); |
|
155 | + if (static::$nesting) { |
|
156 | + $this->parent = Entitizer::get(static::$type, Number::format(Request::get('parent_id'))); |
|
157 | + } |
|
142 | 158 | |
143 | 159 | # Get children items |
144 | 160 |
@@ -2,7 +2,9 @@ |
||
2 | 2 | |
3 | 3 | namespace System\Modules\Filemanager\Handler { |
4 | 4 | |
5 | - use System\Modules\Filemanager, Date, Template; |
|
5 | + use System\Modules\Filemanager; |
|
6 | + use Date; |
|
7 | + use Template; |
|
6 | 8 | |
7 | 9 | class Dir extends Filemanager\Utils\Handler { |
8 | 10 |
@@ -2,7 +2,12 @@ |
||
2 | 2 | |
3 | 3 | namespace System\Modules\Filemanager\Handler { |
4 | 4 | |
5 | - use System\Modules\Filemanager, Date, Explorer, Mime, Number, Template; |
|
5 | + use System\Modules\Filemanager; |
|
6 | + use Date; |
|
7 | + use Explorer; |
|
8 | + use Mime; |
|
9 | + use Number; |
|
10 | + use Template; |
|
6 | 11 | |
7 | 12 | class File extends Filemanager\Utils\Handler { |
8 | 13 |