@@ -50,7 +50,9 @@ |
||
50 | 50 | |
51 | 51 | # Display success message |
52 | 52 | |
53 | - if (false !== Request::get('submitted')) Messages::set('success', Language::get('USER_SUCCESS_EDIT')); |
|
53 | + if (false !== Request::get('submitted')) { |
|
54 | + Messages::set('success', Language::get('USER_SUCCESS_EDIT')); |
|
55 | + } |
|
54 | 56 | |
55 | 57 | # ------------------------ |
56 | 58 |
@@ -46,9 +46,9 @@ discard block |
||
46 | 46 | |
47 | 47 | for ($id = 2; $id <= 4; $id++) $pages[] = ['id' => $id, 'visibility' => VISIBILITY_PUBLISHED, |
48 | 48 | |
49 | - 'locked' => false, 'slug' => ('page-' . ($id - 1)), 'name' => ('page-' . ($id - 1)), |
|
49 | + 'locked' => false, 'slug' => ('page-'.($id - 1)), 'name' => ('page-'.($id - 1)), |
|
50 | 50 | |
51 | - 'title' => (Language::get('INSTALL_PAGE_DEMO_TITLE') . ' ' . ($id - 1)), |
|
51 | + 'title' => (Language::get('INSTALL_PAGE_DEMO_TITLE').' '.($id - 1)), |
|
52 | 52 | |
53 | 53 | 'contents' => Template::block(Language::get('INSTALL_PAGE_DEMO_CONTENTS'))->contents(), |
54 | 54 | |
@@ -81,9 +81,9 @@ discard block |
||
81 | 81 | |
82 | 82 | for ($id = 1; $id <= 3; $id++) $menu[] = [ |
83 | 83 | |
84 | - 'id' => $id, 'active' => true, 'position' => ($id - 1), 'slug' => ('page-' . $id), |
|
84 | + 'id' => $id, 'active' => true, 'position' => ($id - 1), 'slug' => ('page-'.$id), |
|
85 | 85 | |
86 | - 'text' => (Language::get('INSTALL_PAGE_DEMO_TITLE') . ' ' . $id)]; |
|
86 | + 'text' => (Language::get('INSTALL_PAGE_DEMO_TITLE').' '.$id)]; |
|
87 | 87 | |
88 | 88 | # Process insertion |
89 | 89 |
@@ -30,7 +30,11 @@ discard block |
||
30 | 30 | |
31 | 31 | $count = Informer::countEntries(TABLE_PAGES, true); |
32 | 32 | |
33 | - if (false === $count) return false; else if ($count > 0) return true; |
|
33 | + if (false === $count) { |
|
34 | + return false; |
|
35 | + } else if ($count > 0) { |
|
36 | + return true; |
|
37 | + } |
|
34 | 38 | |
35 | 39 | # Process dataset |
36 | 40 | |
@@ -44,7 +48,8 @@ discard block |
||
44 | 48 | |
45 | 49 | 'time_created' => REQUEST_TIME, 'time_modified' => REQUEST_TIME]]; |
46 | 50 | |
47 | - for ($id = 2; $id <= 4; $id++) $pages[] = ['id' => $id, 'visibility' => VISIBILITY_PUBLISHED, |
|
51 | + for ($id = 2; $id <= 4; $id++) { |
|
52 | + $pages[] = ['id' => $id, 'visibility' => VISIBILITY_PUBLISHED, |
|
48 | 53 | |
49 | 54 | 'locked' => false, 'slug' => ('page-' . ($id - 1)), 'name' => ('page-' . ($id - 1)), |
50 | 55 | |
@@ -53,10 +58,13 @@ discard block |
||
53 | 58 | 'contents' => Template::block(Language::get('INSTALL_PAGE_DEMO_CONTENTS'))->contents(), |
54 | 59 | |
55 | 60 | 'time_created' => REQUEST_TIME, 'time_modified' => REQUEST_TIME]; |
61 | + } |
|
56 | 62 | |
57 | 63 | # Process insertion |
58 | 64 | |
59 | - if (!(DB::insert(TABLE_PAGES, $pages, true) && DB::last()->status)) return false; |
|
65 | + if (!(DB::insert(TABLE_PAGES, $pages, true) && DB::last()->status)) { |
|
66 | + return false; |
|
67 | + } |
|
60 | 68 | |
61 | 69 | self::fillRelationsTable(TABLE_PAGES_RELATIONS, 4); |
62 | 70 | |
@@ -73,21 +81,29 @@ discard block |
||
73 | 81 | |
74 | 82 | $count = Informer::countEntries(TABLE_MENU, true); |
75 | 83 | |
76 | - if (false === $count) return false; else if ($count > 0) return true; |
|
84 | + if (false === $count) { |
|
85 | + return false; |
|
86 | + } else if ($count > 0) { |
|
87 | + return true; |
|
88 | + } |
|
77 | 89 | |
78 | 90 | # Process dataset |
79 | 91 | |
80 | 92 | $menu = []; |
81 | 93 | |
82 | - for ($id = 1; $id <= 3; $id++) $menu[] = [ |
|
94 | + for ($id = 1; $id <= 3; $id++) { |
|
95 | + $menu[] = [ |
|
83 | 96 | |
84 | 97 | 'id' => $id, 'active' => true, 'position' => ($id - 1), 'slug' => ('page-' . $id), |
85 | 98 | |
86 | 99 | 'text' => (Language::get('INSTALL_PAGE_DEMO_TITLE') . ' ' . $id)]; |
100 | + } |
|
87 | 101 | |
88 | 102 | # Process insertion |
89 | 103 | |
90 | - if (!(DB::insert(TABLE_MENU, $menu, true) && DB::last()->status)) return false; |
|
104 | + if (!(DB::insert(TABLE_MENU, $menu, true) && DB::last()->status)) { |
|
105 | + return false; |
|
106 | + } |
|
91 | 107 | |
92 | 108 | self::fillRelationsTable(TABLE_MENU_RELATIONS, 3); |
93 | 109 | |
@@ -116,7 +132,9 @@ discard block |
||
116 | 132 | |
117 | 133 | $definitions[] = Entitizer::definition(TABLE_USERS_SESSIONS); |
118 | 134 | |
119 | - foreach ($definitions as $definition) if (!$definition->createTable()) return false; |
|
135 | + foreach ($definitions as $definition) { |
|
136 | + if (!$definition->createTable()) return false; |
|
137 | + } |
|
120 | 138 | |
121 | 139 | # ------------------------ |
122 | 140 |
@@ -16,9 +16,11 @@ discard block |
||
16 | 16 | |
17 | 17 | # Set breadcrumbs |
18 | 18 | |
19 | - if (count($this->path) <= 1) $contents->block('breadcrumbs')->disable(); |
|
20 | - |
|
21 | - else $contents->block('breadcrumbs')->path = $this->path; |
|
19 | + if (count($this->path) <= 1) { |
|
20 | + $contents->block('breadcrumbs')->disable(); |
|
21 | + } else { |
|
22 | + $contents->block('breadcrumbs')->path = $this->path; |
|
23 | + } |
|
22 | 24 | |
23 | 25 | # Set contents |
24 | 26 | |
@@ -41,19 +43,31 @@ discard block |
||
41 | 43 | |
42 | 44 | $slug = implode('/', $this->url->path()); |
43 | 45 | |
44 | - if ('' !== $slug) $this->page->initBySlug($slug); else $this->page->init(1); |
|
46 | + if ('' !== $slug) { |
|
47 | + $this->page->initBySlug($slug); |
|
48 | + } else { |
|
49 | + $this->page->init(1); |
|
50 | + } |
|
45 | 51 | |
46 | 52 | # Display error if not found |
47 | 53 | |
48 | - if (0 === $this->page->id) return false; |
|
54 | + if (0 === $this->page->id) { |
|
55 | + return false; |
|
56 | + } |
|
49 | 57 | |
50 | 58 | # Get path |
51 | 59 | |
52 | - if (false !== ($path = $this->page->path())) $this->path = $path; |
|
60 | + if (false !== ($path = $this->page->path())) { |
|
61 | + $this->path = $path; |
|
62 | + } |
|
53 | 63 | |
54 | 64 | # Set data |
55 | 65 | |
56 | - if ($this->page->id !== 1) $this->title = $this->page->title; else $this->layout = 'Index'; |
|
66 | + if ($this->page->id !== 1) { |
|
67 | + $this->title = $this->page->title; |
|
68 | + } else { |
|
69 | + $this->layout = 'Index'; |
|
70 | + } |
|
57 | 71 | |
58 | 72 | $this->description = $this->page->description; |
59 | 73 | $this->keywords = $this->page->keywords; |
@@ -2,7 +2,9 @@ |
||
2 | 2 | |
3 | 3 | namespace Modules\Entitizer\Form { |
4 | 4 | |
5 | - use Modules\Entitizer, Utils\Form, Utils\Range; |
|
5 | + use Modules\Entitizer; |
|
6 | + use Utils\Form; |
|
7 | + use Utils\Range; |
|
6 | 8 | |
7 | 9 | class Page extends Form { |
8 | 10 |
@@ -32,7 +32,9 @@ |
||
32 | 32 | |
33 | 33 | $parent->block('browse')->disable(); $parent->block('browse_disabled')->enable(); |
34 | 34 | |
35 | - } else $parent->block('browse')->link = $this->parent->link; |
|
35 | + } else { |
|
36 | + $parent->block('browse')->link = $this->parent->link; |
|
37 | + } |
|
36 | 38 | } |
37 | 39 | |
38 | 40 | # Add item additional data |
@@ -14,19 +14,19 @@ |
||
14 | 14 | |
15 | 15 | # Add params |
16 | 16 | |
17 | - $this->params->textual ('code', true, 40, true, ''); |
|
18 | - $this->params->textual ('ip', true, 255, false, ''); |
|
19 | - $this->params->integer ('time', false, 10, true, 0); |
|
17 | + $this->params->textual('code', true, 40, true, ''); |
|
18 | + $this->params->textual('ip', true, 255, false, ''); |
|
19 | + $this->params->integer('time', false, 10, true, 0); |
|
20 | 20 | |
21 | 21 | # Add indexes |
22 | 22 | |
23 | - $this->indexes->add ('code', 'UNIQUE'); |
|
24 | - $this->indexes->add ('ip'); |
|
25 | - $this->indexes->add ('time'); |
|
23 | + $this->indexes->add('code', 'UNIQUE'); |
|
24 | + $this->indexes->add('ip'); |
|
25 | + $this->indexes->add('time'); |
|
26 | 26 | |
27 | 27 | # Add foreign keys |
28 | 28 | |
29 | - $this->foreigns->add ('id', TABLE_USERS, 'id', 'CASCADE', 'RESTRICT'); |
|
29 | + $this->foreigns->add('id', TABLE_USERS, 'id', 'CASCADE', 'RESTRICT'); |
|
30 | 30 | } |
31 | 31 | } |
32 | 32 | } |
@@ -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) { /* Ignore setting value of illegal type */ } |
|
32 | + try { $this->values[$name] = $this->config[$name]($value); } catch (\TypeError $e) { /* Ignore setting value of illegal type */ } |
|
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 | } |
@@ -27,13 +27,13 @@ discard block |
||
27 | 27 | |
28 | 28 | $query = ("DELETE rla FROM " . static::$table_relations . " rla ") . |
29 | 29 | |
30 | - ("JOIN " . static::$table_relations . " rlb ON rlb.descendant = rla.descendant ") . |
|
30 | + ("JOIN " . static::$table_relations . " rlb ON rlb.descendant = rla.descendant ") . |
|
31 | 31 | |
32 | - ("LEFT JOIN " . static::$table_relations . " rlx ") . |
|
32 | + ("LEFT JOIN " . static::$table_relations . " rlx ") . |
|
33 | 33 | |
34 | - ("ON rlx.ancestor = rlb.ancestor AND rlx.descendant = rla.ancestor ") . |
|
34 | + ("ON rlx.ancestor = rlb.ancestor AND rlx.descendant = rla.ancestor ") . |
|
35 | 35 | |
36 | - ("WHERE rlb.ancestor = " . $this->id . " AND rlx.ancestor IS NULL"); |
|
36 | + ("WHERE rlb.ancestor = " . $this->id . " AND rlx.ancestor IS NULL"); |
|
37 | 37 | |
38 | 38 | if (!(DB::send($query) && DB::last()->status)) return false; |
39 | 39 | |
@@ -52,13 +52,13 @@ discard block |
||
52 | 52 | |
53 | 53 | $query = ("INSERT INTO " . static::$table_relations . " (ancestor, descendant, depth) ") . |
54 | 54 | |
55 | - ("SELECT sup.ancestor, sub.descendant, sup.depth + sub.depth + 1 ") . |
|
55 | + ("SELECT sup.ancestor, sub.descendant, sup.depth + sub.depth + 1 ") . |
|
56 | 56 | |
57 | - ("FROM " . static::$table_relations . " sup ") . |
|
57 | + ("FROM " . static::$table_relations . " sup ") . |
|
58 | 58 | |
59 | - ("JOIN " . static::$table_relations . " sub ") . |
|
59 | + ("JOIN " . static::$table_relations . " sub ") . |
|
60 | 60 | |
61 | - ("WHERE sub.ancestor = " . $this->id . " AND sup.descendant = " . $parent_id); |
|
61 | + ("WHERE sub.ancestor = " . $this->id . " AND sup.descendant = " . $parent_id); |
|
62 | 62 | |
63 | 63 | if (!(DB::send($query) && DB::last()->status)) return false; |
64 | 64 |
@@ -25,15 +25,15 @@ discard block |
||
25 | 25 | |
26 | 26 | private function disconnectSubtree() { |
27 | 27 | |
28 | - $query = ("DELETE rla FROM " . static::$table_relations . " rla ") . |
|
28 | + $query = ("DELETE rla FROM ".static::$table_relations." rla "). |
|
29 | 29 | |
30 | - ("JOIN " . static::$table_relations . " rlb ON rlb.descendant = rla.descendant ") . |
|
30 | + ("JOIN ".static::$table_relations." rlb ON rlb.descendant = rla.descendant "). |
|
31 | 31 | |
32 | - ("LEFT JOIN " . static::$table_relations . " rlx ") . |
|
32 | + ("LEFT JOIN ".static::$table_relations." rlx "). |
|
33 | 33 | |
34 | - ("ON rlx.ancestor = rlb.ancestor AND rlx.descendant = rla.ancestor ") . |
|
34 | + ("ON rlx.ancestor = rlb.ancestor AND rlx.descendant = rla.ancestor "). |
|
35 | 35 | |
36 | - ("WHERE rlb.ancestor = " . $this->id . " AND rlx.ancestor IS NULL"); |
|
36 | + ("WHERE rlb.ancestor = ".$this->id." AND rlx.ancestor IS NULL"); |
|
37 | 37 | |
38 | 38 | if (!(DB::send($query) && DB::last()->status)) return false; |
39 | 39 | |
@@ -50,15 +50,15 @@ discard block |
||
50 | 50 | |
51 | 51 | private function connectSubtree(int $parent_id) { |
52 | 52 | |
53 | - $query = ("INSERT INTO " . static::$table_relations . " (ancestor, descendant, depth) ") . |
|
53 | + $query = ("INSERT INTO ".static::$table_relations." (ancestor, descendant, depth) "). |
|
54 | 54 | |
55 | - ("SELECT sup.ancestor, sub.descendant, sup.depth + sub.depth + 1 ") . |
|
55 | + ("SELECT sup.ancestor, sub.descendant, sup.depth + sub.depth + 1 "). |
|
56 | 56 | |
57 | - ("FROM " . static::$table_relations . " sup ") . |
|
57 | + ("FROM ".static::$table_relations." sup "). |
|
58 | 58 | |
59 | - ("JOIN " . static::$table_relations . " sub ") . |
|
59 | + ("JOIN ".static::$table_relations." sub "). |
|
60 | 60 | |
61 | - ("WHERE sub.ancestor = " . $this->id . " AND sup.descendant = " . $parent_id); |
|
61 | + ("WHERE sub.ancestor = ".$this->id." AND sup.descendant = ".$parent_id); |
|
62 | 62 | |
63 | 63 | if (!(DB::send($query) && DB::last()->status)) return false; |
64 | 64 |
@@ -35,7 +35,9 @@ discard block |
||
35 | 35 | |
36 | 36 | ("WHERE rlb.ancestor = " . $this->id . " AND rlx.ancestor IS NULL"); |
37 | 37 | |
38 | - if (!(DB::send($query) && DB::last()->status)) return false; |
|
38 | + if (!(DB::send($query) && DB::last()->status)) { |
|
39 | + return false; |
|
40 | + } |
|
39 | 41 | |
40 | 42 | # Set path |
41 | 43 | |
@@ -60,7 +62,9 @@ discard block |
||
60 | 62 | |
61 | 63 | ("WHERE sub.ancestor = " . $this->id . " AND sup.descendant = " . $parent_id); |
62 | 64 | |
63 | - if (!(DB::send($query) && (DB::last()->rows > 0))) return false; |
|
65 | + if (!(DB::send($query) && (DB::last()->rows > 0))) { |
|
66 | + return false; |
|
67 | + } |
|
64 | 68 | |
65 | 69 | # Set path |
66 | 70 | |
@@ -75,27 +79,37 @@ discard block |
||
75 | 79 | |
76 | 80 | public function create(array $data) { |
77 | 81 | |
78 | - if (0 !== $this->id) return false; |
|
82 | + if (0 !== $this->id) { |
|
83 | + return false; |
|
84 | + } |
|
79 | 85 | |
80 | 86 | $data = $this->dataset->cast($data); |
81 | 87 | |
82 | - if (static::$auto_increment && isset($data['id'])) $data['id'] = 0; |
|
88 | + if (static::$auto_increment && isset($data['id'])) { |
|
89 | + $data['id'] = 0; |
|
90 | + } |
|
83 | 91 | |
84 | 92 | # Insert entity |
85 | 93 | |
86 | 94 | DB::insert(static::$table, $data); |
87 | 95 | |
88 | - if (!(DB::last() && DB::last()->status)) return false; |
|
96 | + if (!(DB::last() && DB::last()->status)) { |
|
97 | + return false; |
|
98 | + } |
|
89 | 99 | |
90 | 100 | # Update data |
91 | 101 | |
92 | - if (static::$auto_increment) $data['id'] = DB::last()->id; |
|
102 | + if (static::$auto_increment) { |
|
103 | + $data['id'] = DB::last()->id; |
|
104 | + } |
|
93 | 105 | |
94 | 106 | $this->dataset->update($data); |
95 | 107 | |
96 | 108 | # Init subtreee |
97 | 109 | |
98 | - if (static::$nesting) $this->initSubtree(); |
|
110 | + if (static::$nesting) { |
|
111 | + $this->initSubtree(); |
|
112 | + } |
|
99 | 113 | |
100 | 114 | # Cache entity |
101 | 115 | |
@@ -110,17 +124,23 @@ discard block |
||
110 | 124 | |
111 | 125 | public function edit(array $data) { |
112 | 126 | |
113 | - if (0 === $this->id) return false; |
|
127 | + if (0 === $this->id) { |
|
128 | + return false; |
|
129 | + } |
|
114 | 130 | |
115 | 131 | $data = $this->dataset->cast($data); |
116 | 132 | |
117 | - if (isset($data['id'])) unset($data['id']); |
|
133 | + if (isset($data['id'])) { |
|
134 | + unset($data['id']); |
|
135 | + } |
|
118 | 136 | |
119 | 137 | # Update entity |
120 | 138 | |
121 | 139 | DB::update(static::$table, $data, ['id' => $this->id]); |
122 | 140 | |
123 | - if (!(DB::last() && DB::last()->status)) return false; |
|
141 | + if (!(DB::last() && DB::last()->status)) { |
|
142 | + return false; |
|
143 | + } |
|
124 | 144 | |
125 | 145 | # Update data |
126 | 146 | |
@@ -128,7 +148,9 @@ discard block |
||
128 | 148 | |
129 | 149 | # Init subtreee |
130 | 150 | |
131 | - if (static::$nesting) $this->initSubtree(); |
|
151 | + if (static::$nesting) { |
|
152 | + $this->initSubtree(); |
|
153 | + } |
|
132 | 154 | |
133 | 155 | # ------------------------ |
134 | 156 | |
@@ -139,30 +161,44 @@ discard block |
||
139 | 161 | |
140 | 162 | public function move(int $parent_id) { |
141 | 163 | |
142 | - if (0 === $this->id) return false; |
|
164 | + if (0 === $this->id) { |
|
165 | + return false; |
|
166 | + } |
|
143 | 167 | |
144 | 168 | # Re-connect entity if not in tree |
145 | 169 | |
146 | - if (!$this->initSubtree()) return false; |
|
170 | + if (!$this->initSubtree()) { |
|
171 | + return false; |
|
172 | + } |
|
147 | 173 | |
148 | 174 | # Create parent entity |
149 | 175 | |
150 | 176 | if (0 !== ($parent = Entitizer::get(static::$table, $parent_id))->id) { |
151 | 177 | |
152 | - if (false === ($path = $parent->path())) return false; |
|
178 | + if (false === ($path = $parent->path())) { |
|
179 | + return false; |
|
180 | + } |
|
153 | 181 | |
154 | - if (false === ($depth = $this->subtreeDepth())) return false; |
|
182 | + if (false === ($depth = $this->subtreeDepth())) { |
|
183 | + return false; |
|
184 | + } |
|
155 | 185 | |
156 | - if ((count($path) + $depth + 1) > CONFIG_ENTITIZER_MAX_DEPTH) return false; |
|
186 | + if ((count($path) + $depth + 1) > CONFIG_ENTITIZER_MAX_DEPTH) { |
|
187 | + return false; |
|
188 | + } |
|
157 | 189 | } |
158 | 190 | |
159 | 191 | # Disconnect subtree from current position |
160 | 192 | |
161 | - if (!$this->disconnectSubtree()) return false; |
|
193 | + if (!$this->disconnectSubtree()) { |
|
194 | + return false; |
|
195 | + } |
|
162 | 196 | |
163 | 197 | # Connect subtree under new position |
164 | 198 | |
165 | - if (0 !== $parent->id) $this->connectSubtree($parent->id); |
|
199 | + if (0 !== $parent->id) { |
|
200 | + $this->connectSubtree($parent->id); |
|
201 | + } |
|
166 | 202 | |
167 | 203 | # ------------------------ |
168 | 204 | |
@@ -173,19 +209,27 @@ discard block |
||
173 | 209 | |
174 | 210 | public function remove() { |
175 | 211 | |
176 | - if (0 === $this->id) return false; |
|
212 | + if (0 === $this->id) { |
|
213 | + return false; |
|
214 | + } |
|
177 | 215 | |
178 | 216 | # Check if entity is removable |
179 | 217 | |
180 | - if (static::$super && ($this->id === 1)) return false; |
|
218 | + if (static::$super && ($this->id === 1)) { |
|
219 | + return false; |
|
220 | + } |
|
181 | 221 | |
182 | - if (static::$nesting && (0 !== $this->subtreeCount())) return false; |
|
222 | + if (static::$nesting && (0 !== $this->subtreeCount())) { |
|
223 | + return false; |
|
224 | + } |
|
183 | 225 | |
184 | 226 | # Remove entity |
185 | 227 | |
186 | 228 | DB::delete(static::$table, ['id' => $this->id]); |
187 | 229 | |
188 | - if (!(DB::last() && DB::last()->status)) return false; |
|
230 | + if (!(DB::last() && DB::last()->status)) { |
|
231 | + return false; |
|
232 | + } |
|
189 | 233 | |
190 | 234 | # Uncache entity |
191 | 235 |
@@ -2,68 +2,68 @@ |
||
2 | 2 | |
3 | 3 | # Cadmium |
4 | 4 | |
5 | -define('CADMIUM_NAME', 'Cadmium CMS'); |
|
6 | -define('CADMIUM_HOME', 'http://cadmium-cms.com'); |
|
5 | +define('CADMIUM_NAME', 'Cadmium CMS'); |
|
6 | +define('CADMIUM_HOME', 'http://cadmium-cms.com'); |
|
7 | 7 | |
8 | -define('CADMIUM_VERSION', '0.3.0'); |
|
9 | -define('CADMIUM_COPY', '2016'); |
|
8 | +define('CADMIUM_VERSION', '0.3.0'); |
|
9 | +define('CADMIUM_COPY', '2016'); |
|
10 | 10 | |
11 | 11 | # External |
12 | 12 | |
13 | -define('JQUERY_VERSION', '2.2.3'); |
|
14 | -define('SEMANTIC_UI_VERSION', '2.1.8'); |
|
15 | -define('CKEDITOR_VERSION', '4.5.8'); |
|
13 | +define('JQUERY_VERSION', '2.2.3'); |
|
14 | +define('SEMANTIC_UI_VERSION', '2.1.8'); |
|
15 | +define('CKEDITOR_VERSION', '4.5.8'); |
|
16 | 16 | |
17 | 17 | # Sections |
18 | 18 | |
19 | -define('SECTION_ADMIN', 'Admin'); |
|
20 | -define('SECTION_SITE', 'Site'); |
|
19 | +define('SECTION_ADMIN', 'Admin'); |
|
20 | +define('SECTION_SITE', 'Site'); |
|
21 | 21 | |
22 | 22 | # Filemanager types |
23 | 23 | |
24 | -define('FILEMANAGER_TYPE_DIR', 'dir'); |
|
25 | -define('FILEMANAGER_TYPE_FILE', 'file'); |
|
24 | +define('FILEMANAGER_TYPE_DIR', 'dir'); |
|
25 | +define('FILEMANAGER_TYPE_FILE', 'file'); |
|
26 | 26 | |
27 | 27 | # Access |
28 | 28 | |
29 | -define('ACCESS_PUBLIC', 0); |
|
30 | -define('ACCESS_REGISTERED', 1); |
|
31 | -define('ACCESS_ADMINISTRATOR', 2); |
|
29 | +define('ACCESS_PUBLIC', 0); |
|
30 | +define('ACCESS_REGISTERED', 1); |
|
31 | +define('ACCESS_ADMINISTRATOR', 2); |
|
32 | 32 | |
33 | 33 | # Frequency |
34 | 34 | |
35 | -define('FREQUENCY_ALWAYS', 'always'); |
|
36 | -define('FREQUENCY_HOURLY', 'hourly'); |
|
37 | -define('FREQUENCY_DAILY', 'daily'); |
|
38 | -define('FREQUENCY_WEEKLY', 'weekly'); |
|
39 | -define('FREQUENCY_MONTHLY', 'monthly'); |
|
40 | -define('FREQUENCY_YEARLY', 'yearly'); |
|
41 | -define('FREQUENCY_NEVER', 'never'); |
|
35 | +define('FREQUENCY_ALWAYS', 'always'); |
|
36 | +define('FREQUENCY_HOURLY', 'hourly'); |
|
37 | +define('FREQUENCY_DAILY', 'daily'); |
|
38 | +define('FREQUENCY_WEEKLY', 'weekly'); |
|
39 | +define('FREQUENCY_MONTHLY', 'monthly'); |
|
40 | +define('FREQUENCY_YEARLY', 'yearly'); |
|
41 | +define('FREQUENCY_NEVER', 'never'); |
|
42 | 42 | |
43 | 43 | # Rank |
44 | 44 | |
45 | -define('RANK_GUEST', 0); |
|
46 | -define('RANK_USER', 1); |
|
47 | -define('RANK_ADMINISTRATOR', 2); |
|
45 | +define('RANK_GUEST', 0); |
|
46 | +define('RANK_USER', 1); |
|
47 | +define('RANK_ADMINISTRATOR', 2); |
|
48 | 48 | |
49 | 49 | # Sex |
50 | 50 | |
51 | -define('SEX_NOT_SELECTED', 0); |
|
52 | -define('SEX_MALE', 1); |
|
53 | -define('SEX_FEMALE', 2); |
|
51 | +define('SEX_NOT_SELECTED', 0); |
|
52 | +define('SEX_MALE', 1); |
|
53 | +define('SEX_FEMALE', 2); |
|
54 | 54 | |
55 | 55 | # Status |
56 | 56 | |
57 | -define('STATUS_ONLINE', 0); |
|
58 | -define('STATUS_MAINTENANCE', 1); |
|
59 | -define('STATUS_UPDATE', 2); |
|
57 | +define('STATUS_ONLINE', 0); |
|
58 | +define('STATUS_MAINTENANCE', 1); |
|
59 | +define('STATUS_UPDATE', 2); |
|
60 | 60 | |
61 | 61 | # Target |
62 | 62 | |
63 | -define('TARGET_SELF', 0); |
|
64 | -define('TARGET_BLANK', 1); |
|
63 | +define('TARGET_SELF', 0); |
|
64 | +define('TARGET_BLANK', 1); |
|
65 | 65 | |
66 | 66 | # Visibility |
67 | 67 | |
68 | -define('VISIBILITY_DRAFT', 0); |
|
69 | -define('VISIBILITY_PUBLISHED', 1); |
|
68 | +define('VISIBILITY_DRAFT', 0); |
|
69 | +define('VISIBILITY_PUBLISHED', 1); |