Passed
Pull Request — master (#11)
by Anton
03:24
created
www/engine/System/Classes/Modules/Entitizer/Collection/Pages.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -12,44 +12,44 @@
 block discarded – undo
12 12
 
13 13
 		protected function init() {
14 14
 
15
-			$this->config->addParam('active', '', function (bool $active) {
15
+			$this->config->addParam('active', '', function(bool $active) {
16 16
 
17
-				return ($active ? ("ent.visibility = " . VISIBILITY_PUBLISHED . " AND ent.locked = 0") : '');
17
+				return ($active ? ("ent.visibility = ".VISIBILITY_PUBLISHED." AND ent.locked = 0") : '');
18 18
 			});
19 19
 
20
-			$this->config->addParam('rank', '', function (int $rank = null) {
20
+			$this->config->addParam('rank', '', function(int $rank = null) {
21 21
 
22
-				return ((null !== $rank) ? ("ent.access <= " . $rank) : '');
22
+				return ((null !== $rank) ? ("ent.access <= ".$rank) : '');
23 23
 			});
24 24
 
25
-			$this->config->addParam('slug', '', function (string $slug) {
25
+			$this->config->addParam('slug', '', function(string $slug) {
26 26
 
27
-				return (('' !== $slug) ? ("ent.slug = '" . addslashes($slug) . "'") : '');
27
+				return (('' !== $slug) ? ("ent.slug = '".addslashes($slug)."'") : '');
28 28
 			});
29 29
 
30
-			$this->config->addParam('name', '', function (string $name) {
30
+			$this->config->addParam('name', '', function(string $name) {
31 31
 
32
-				return (('' !== $name) ? ("ent.name = '" . addslashes($name) . "'") : '');
32
+				return (('' !== $name) ? ("ent.name = '".addslashes($name)."'") : '');
33 33
 			});
34 34
 
35
-			$this->config->addParam('time_created >=', '', function (int $time) {
35
+			$this->config->addParam('time_created >=', '', function(int $time) {
36 36
 
37
-				return ((0 < $time) ? ("ent.time_created >= " . $time) : '');
37
+				return ((0 < $time) ? ("ent.time_created >= ".$time) : '');
38 38
 			});
39 39
 
40
-			$this->config->addParam('time_created <=', '', function (int $time) {
40
+			$this->config->addParam('time_created <=', '', function(int $time) {
41 41
 
42
-				return ((0 < $time) ? ("ent.time_created <= " . $time) : '');
42
+				return ((0 < $time) ? ("ent.time_created <= ".$time) : '');
43 43
 			});
44 44
 
45
-			$this->config->addParam('time_modified >=', '', function (int $time) {
45
+			$this->config->addParam('time_modified >=', '', function(int $time) {
46 46
 
47
-				return ((0 < $time) ? ("ent.time_modified >= " . $time) : '');
47
+				return ((0 < $time) ? ("ent.time_modified >= ".$time) : '');
48 48
 			});
49 49
 
50
-			$this->config->addParam('time_modified <=', '', function (int $time) {
50
+			$this->config->addParam('time_modified <=', '', function(int $time) {
51 51
 
52
-				return ((0 < $time) ? ("ent.time_modified <= " . $time) : '');
52
+				return ((0 < $time) ? ("ent.time_modified <= ".$time) : '');
53 53
 			});
54 54
 		}
55 55
 	}
Please login to merge, or discard this patch.
www/engine/System/Classes/Modules/Entitizer/Collection/Users.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -12,29 +12,29 @@
 block discarded – undo
12 12
 
13 13
 		protected function init() {
14 14
 
15
-			$this->config->addParam('rank', '', function (int $rank = null) {
15
+			$this->config->addParam('rank', '', function(int $rank = null) {
16 16
 
17
-				return ((null !== $rank) ? ("ent.rank >= " . $rank) : '');
17
+				return ((null !== $rank) ? ("ent.rank >= ".$rank) : '');
18 18
 			});
19 19
 
20
-			$this->config->addParam('time_registered >=', '', function (int $time) {
20
+			$this->config->addParam('time_registered >=', '', function(int $time) {
21 21
 
22
-				return ((0 < $time) ? ("ent.time_registered >= " . $time) : '');
22
+				return ((0 < $time) ? ("ent.time_registered >= ".$time) : '');
23 23
 			});
24 24
 
25
-			$this->config->addParam('time_registered <=', '', function (int $time) {
25
+			$this->config->addParam('time_registered <=', '', function(int $time) {
26 26
 
27
-				return ((0 < $time) ? ("ent.time_registered <= " . $time) : '');
27
+				return ((0 < $time) ? ("ent.time_registered <= ".$time) : '');
28 28
 			});
29 29
 
30
-			$this->config->addParam('time_logged >=', '', function (int $time) {
30
+			$this->config->addParam('time_logged >=', '', function(int $time) {
31 31
 
32
-				return ((0 < $time) ? ("ent.time_logged >= " . $time) : '');
32
+				return ((0 < $time) ? ("ent.time_logged >= ".$time) : '');
33 33
 			});
34 34
 
35
-			$this->config->addParam('time_logged <=', '', function (int $time) {
35
+			$this->config->addParam('time_logged <=', '', function(int $time) {
36 36
 
37
-				return ((0 < $time) ? ("ent.time_logged <= " . $time) : '');
37
+				return ((0 < $time) ? ("ent.time_logged <= ".$time) : '');
38 38
 			});
39 39
 		}
40 40
 	}
Please login to merge, or discard this patch.
www/engine/System/Classes/Modules/Entitizer/Handler/Edit/User.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -30,7 +30,9 @@
 block discarded – undo
30 30
 
31 31
 		protected function processEntity(Template\Block $contents) {
32 32
 
33
-			if ($this->create) $contents->getBlock('info')->disable(); else {
33
+			if ($this->create) {
34
+				$contents->getBlock('info')->disable();
35
+			} else {
34 36
 
35 37
 				$contents->getBlock('info')->time_registered = Date::get(DATE_FORMAT_DATETIME, $this->entity->time_registered);
36 38
 
Please login to merge, or discard this patch.
www/engine/System/Classes/Modules/Entitizer/Handler/Edit/Page.php 1 patch
Braces   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -32,16 +32,18 @@
 block discarded – undo
32 32
 
33 33
 		protected function processEntityParent(Template\Block $parent) {
34 34
 
35
-			if ((0 !== $this->parent->id) && $this->parent->active) $parent->getBlock('browse')->link = $this->parent->link;
36
-
37
-			else { $parent->getBlock('browse')->disable(); $parent->getBlock('browse_disabled')->enable(); }
35
+			if ((0 !== $this->parent->id) && $this->parent->active) {
36
+				$parent->getBlock('browse')->link = $this->parent->link;
37
+			} else { $parent->getBlock('browse')->disable(); $parent->getBlock('browse_disabled')->enable(); }
38 38
 		}
39 39
 
40 40
 		# Add additional parent data for specific entity
41 41
 
42 42
 		protected function processEntity(Template\Block $contents) {
43 43
 
44
-			if (!$this->create && $this->parent->locked) $contents->getBlock('locked')->enable();
44
+			if (!$this->create && $this->parent->locked) {
45
+				$contents->getBlock('locked')->enable();
46
+			}
45 47
 		}
46 48
 	}
47 49
 }
Please login to merge, or discard this patch.
www/engine/System/Classes/Modules/Entitizer/Dataset/User.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -12,14 +12,14 @@
 block discarded – undo
12 12
 
13 13
 		protected function init() {
14 14
 
15
-			$this->addWorker('gravatar', function (array $data) {
15
+			$this->addWorker('gravatar', function(array $data) {
16 16
 
17 17
 				return md5(strtolower($data['email']));
18 18
 			});
19 19
 
20
-			$this->addWorker('full_name', function (array $data) {
20
+			$this->addWorker('full_name', function(array $data) {
21 21
 
22
-				return trim($data['first_name'] . ' ' . $data['last_name']);
22
+				return trim($data['first_name'].' '.$data['last_name']);
23 23
 			});
24 24
 		}
25 25
 	}
Please login to merge, or discard this patch.
www/engine/System/Classes/Modules/Entitizer/Dataset/Page.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -12,23 +12,23 @@
 block discarded – undo
12 12
 
13 13
 		protected function init() {
14 14
 
15
-			$this->addWorker('active', function (array $data) {
15
+			$this->addWorker('active', function(array $data) {
16 16
 
17 17
 				return (($data['visibility'] === VISIBILITY_PUBLISHED) && !$data['locked']);
18 18
 			});
19 19
 
20
-			$this->addWorker('link', function (array $data) {
20
+			$this->addWorker('link', function(array $data) {
21 21
 
22 22
 				if ('' === $data['slug']) return '';
23 23
 
24
-				return (INSTALL_PATH . '/' . $data['slug']);
24
+				return (INSTALL_PATH.'/'.$data['slug']);
25 25
 			});
26 26
 
27
-			$this->addWorker('canonical', function (array $data) {
27
+			$this->addWorker('canonical', function(array $data) {
28 28
 
29 29
 				if ('' === $data['slug']) return '';
30 30
 
31
-				return (Settings::get('system_url') . (($data['id'] !== 1) ? ('/' . $data['slug']) : ''));
31
+				return (Settings::get('system_url').(($data['id'] !== 1) ? ('/'.$data['slug']) : ''));
32 32
 			});
33 33
 		}
34 34
 	}
Please login to merge, or discard this patch.
www/engine/System/Classes/Modules/Entitizer/Dataset/Menuitem.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -12,13 +12,13 @@
 block discarded – undo
12 12
 
13 13
 		protected function init() {
14 14
 
15
-			$this->addWorker('link', function (array $data) {
15
+			$this->addWorker('link', function(array $data) {
16 16
 
17 17
 				if ('' === $data['slug']) return '';
18 18
 
19 19
 				if (false !== Validate::url($data['slug'])) return $data['slug'];
20 20
 
21
-				return (INSTALL_PATH . '/' . $data['slug']);
21
+				return (INSTALL_PATH.'/'.$data['slug']);
22 22
 			});
23 23
 		}
24 24
 	}
Please login to merge, or discard this patch.
www/engine/System/Classes/Modules/Entitizer/Utils/Entity/Modify.php 1 patch
Braces   +66 added lines, -22 removed lines patch added patch discarded remove patch
@@ -35,7 +35,9 @@  discard block
 block discarded – undo
35 35
 
36 36
 			         ("WHERE rlb.ancestor = " . $this->id . " AND rlx.ancestor IS NULL");
37 37
 
38
-			if (!(DB::send($query) && DB::getLast()->status)) return false;
38
+			if (!(DB::send($query) && DB::getLast()->status)) {
39
+				return false;
40
+			}
39 41
 
40 42
 			# Set path
41 43
 
@@ -60,7 +62,9 @@  discard block
 block discarded – undo
60 62
 
61 63
 			         ("WHERE sub.ancestor = " . $this->id . " AND sup.descendant = " . $parent_id);
62 64
 
63
-			if (!(DB::send($query) && (DB::getLast()->rows > 0))) return false;
65
+			if (!(DB::send($query) && (DB::getLast()->rows > 0))) {
66
+				return false;
67
+			}
64 68
 
65 69
 			# Set path
66 70
 
@@ -75,27 +79,37 @@  discard block
 block discarded – undo
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::getLast() && DB::getLast()->status)) return false;
96
+			if (!(DB::getLast() && DB::getLast()->status)) {
97
+				return false;
98
+			}
89 99
 
90 100
 			# Update data
91 101
 
92
-			if (static::$auto_increment) $data['id'] = DB::getLast()->id;
102
+			if (static::$auto_increment) {
103
+				$data['id'] = DB::getLast()->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
 block discarded – undo
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::getLast() && DB::getLast()->status)) return false;
141
+			if (!(DB::getLast() && DB::getLast()->status)) {
142
+				return false;
143
+			}
124 144
 
125 145
 			# Update data
126 146
 
@@ -128,7 +148,9 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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::getLast() && DB::getLast()->status)) return false;
230
+			if (!(DB::getLast() && DB::getLast()->status)) {
231
+				return false;
232
+			}
189 233
 
190 234
 			# Uncache entity
191 235
 
Please login to merge, or discard this patch.
www/engine/System/Classes/Modules/Entitizer/Utils/Lister.php 1 patch
Braces   +36 added lines, -16 removed lines patch added patch discarded remove patch
@@ -20,15 +20,15 @@  discard block
 block discarded – undo
20 20
 
21 21
 			# Set create button
22 22
 
23
-			if (count($this->path) < CONFIG_ENTITIZER_MAX_DEPTH) $parent->getBlock('create')->id = $this->parent->id;
24
-
25
-			else { $parent->getBlock('create')->disable(); $parent->getBlock('create_disabled')->enable(); }
23
+			if (count($this->path) < CONFIG_ENTITIZER_MAX_DEPTH) {
24
+				$parent->getBlock('create')->id = $this->parent->id;
25
+			} else { $parent->getBlock('create')->disable(); $parent->getBlock('create_disabled')->enable(); }
26 26
 
27 27
 			# Set edit button
28 28
 
29
-			if (0 !== $this->parent->id) $parent->getBlock('edit')->id = $this->parent->id;
30
-
31
-			else { $parent->getBlock('edit')->disable(); $parent->getBlock('edit_disabled')->enable(); }
29
+			if (0 !== $this->parent->id) {
30
+				$parent->getBlock('edit')->id = $this->parent->id;
31
+			} else { $parent->getBlock('edit')->disable(); $parent->getBlock('edit_disabled')->enable(); }
32 32
 
33 33
 			# Add parent additional data
34 34
 
@@ -41,7 +41,9 @@  discard block
 block discarded – undo
41 41
 
42 42
 			foreach ($this->items['list'] as $item) {
43 43
 
44
-				if ((null !== $this->entity) && ($item['dataset']->id === $this->entity->id)) continue;
44
+				if ((null !== $this->entity) && ($item['dataset']->id === $this->entity->id)) {
45
+					continue;
46
+				}
45 47
 
46 48
 				$items->addItem($view = View::get(!$ajax ? static::$view_item : static::$view_ajax_item));
47 49
 
@@ -104,11 +106,15 @@  discard block
 block discarded – undo
104 106
 
105 107
 			# Set path
106 108
 
107
-			if (static::$nesting) $contents->path = $this->path;
109
+			if (static::$nesting) {
110
+				$contents->path = $this->path;
111
+			}
108 112
 
109 113
 			# Process parent block
110 114
 
111
-			if (static::$nesting && !$ajax) $this->processParent($contents->getBlock('parent'));
115
+			if (static::$nesting && !$ajax) {
116
+				$this->processParent($contents->getBlock('parent'));
117
+			}
112 118
 
113 119
 			# Process items block
114 120
 
@@ -116,7 +122,9 @@  discard block
 block discarded – undo
116 122
 
117 123
 			# Set pagination
118 124
 
119
-			if (!$ajax) $contents->pagination = $this->getPaginationBlock();
125
+			if (!$ajax) {
126
+				$contents->pagination = $this->getPaginationBlock();
127
+			}
120 128
 
121 129
 			# ------------------------
122 130
 
@@ -141,15 +149,21 @@  discard block
 block discarded – undo
141 149
 
142 150
 			# Get path and depth
143 151
 
144
-			if (false !== ($path = $this->parent->path())) $this->path = $path;
152
+			if (false !== ($path = $this->parent->path())) {
153
+				$this->path = $path;
154
+			}
145 155
 
146
-			if ((0 !== $this->entity->id) && (false !== ($depth = $this->entity->subtreeDepth()))) $this->depth = $depth;
156
+			if ((0 !== $this->entity->id) && (false !== ($depth = $this->entity->subtreeDepth()))) {
157
+				$this->depth = $depth;
158
+			}
147 159
 
148 160
 			# Get items list
149 161
 
150 162
 			$lister = (static::$nesting ? 'children' : 'items');
151 163
 
152
-			if (false !== ($items = $this->parent->$lister())) $this->items = $items;
164
+			if (false !== ($items = $this->parent->$lister())) {
165
+				$this->items = $items;
166
+			}
153 167
 
154 168
 			# ------------------------
155 169
 
@@ -160,7 +174,9 @@  discard block
 block discarded – undo
160 174
 
161 175
 		protected function handle() {
162 176
 
163
-			if (Request::isAjax()) return $this->handleAjax();
177
+			if (Request::isAjax()) {
178
+				return $this->handleAjax();
179
+			}
164 180
 
165 181
 			$this->index = Number::forceInt(Request::get('index'), 1, 999999);
166 182
 
@@ -172,13 +188,17 @@  discard block
 block discarded – undo
172 188
 
173 189
 			# Get path
174 190
 
175
-			if (false !== ($path = $this->parent->path())) $this->path = $path;
191
+			if (false !== ($path = $this->parent->path())) {
192
+				$this->path = $path;
193
+			}
176 194
 
177 195
 			# Get items list
178 196
 
179 197
 			$lister = (static::$nesting ? 'children' : 'items'); $index = $this->index; $display = static::$display;
180 198
 
181
-			if (false !== ($items = $this->parent->$lister([], [], $index, $display))) $this->items = $items;
199
+			if (false !== ($items = $this->parent->$lister([], [], $index, $display))) {
200
+				$this->items = $items;
201
+			}
182 202
 
183 203
 			# ------------------------
184 204
 
Please login to merge, or discard this patch.