Completed
Push — master ( 92ad6f...416cb1 )
by Anton
19:38
created
www/engine/System/Classes/Modules/Entitizer/Utils/Entity/Action/Fill.php 1 patch
Braces   +12 added lines, -4 removed lines patch added patch discarded remove patch
@@ -12,19 +12,27 @@
 block discarded – undo
12 12
 
13 13
 		public function fill(array $data) {
14 14
 
15
-			if (0 !== $this->id) return false;
15
+			if (0 !== $this->id) {
16
+				return false;
17
+			}
16 18
 
17 19
 			$set = $this->getDataset($data, true);
18 20
 
19
-			if (!isset($set['id']) || !($set['id'] > 0)) return false;
21
+			if (!isset($set['id']) || !($set['id'] > 0)) {
22
+				return false;
23
+			}
20 24
 
21 25
 			# Re-init entity
22 26
 
23 27
 			$this->error = false; $this->id = $set['id'];
24 28
 
25
-			foreach ($set as $name => $value) if ($name !== 'id') $this->data[$name] = $value;
29
+			foreach ($set as $name => $value) {
30
+				if ($name !== 'id') $this->data[$name] = $value;
31
+			}
26 32
 
27
-			if (static::$nesting) $this->data['path'] = $this->getPath();
33
+			if (static::$nesting) {
34
+				$this->data['path'] = $this->getPath();
35
+			}
28 36
 
29 37
 			# Implement entity
30 38
 
Please login to merge, or discard this patch.
www/engine/System/Classes/Modules/Extend/Utils/Handler.php 1 patch
Braces   +26 added lines, -10 removed lines patch added patch discarded remove patch
@@ -23,11 +23,15 @@  discard block
 block discarded – undo
23 23
 
24 24
 			$name = Settings::get(self::$param[$this->section]); $primary = self::$default[$this->section];
25 25
 
26
-			if (self::valid($name) && isset($items[$name])) $active = $name;
27
-
28
-			else if (self::valid($primary) && isset($items[$primary])) $active = $primary;
26
+			if (self::valid($name) && isset($items[$name])) {
27
+				$active = $name;
28
+			} else if (self::valid($primary) && isset($items[$primary])) {
29
+				$active = $primary;
30
+			}
29 31
 
30
-			foreach (array_keys($items) as $name) $items[$name]['active'] = ($name === $active);
32
+			foreach (array_keys($items) as $name) {
33
+				$items[$name]['active'] = ($name === $active);
34
+			}
31 35
 
32 36
 			# ------------------------
33 37
 
@@ -73,12 +77,16 @@  discard block
 block discarded – undo
73 77
 
74 78
 				$items->add($item = View::get(self::$view_item));
75 79
 
76
-				foreach (self::$data as $name) $item->$name = $extension[$name];
80
+				foreach (self::$data as $name) {
81
+					$item->$name = $extension[$name];
82
+				}
77 83
 
78 84
 				$item->class = ($extension['active'] ? 'positive' : 'grey');
79 85
 			}
80 86
 
81
-			if ($items->count()) $contents->block('items', $items);
87
+			if ($items->count()) {
88
+				$contents->block('items', $items);
89
+			}
82 90
 
83 91
 			# ------------------------
84 92
 
@@ -93,15 +101,21 @@  discard block
 block discarded – undo
93 101
 
94 102
 			# Check for demo mode
95 103
 
96
-			if (Informer::isDemoMode()) return $ajax->error(Language::get('DEMO_MODE_RESTRICTION'));
104
+			if (Informer::isDemoMode()) {
105
+				return $ajax->error(Language::get('DEMO_MODE_RESTRICTION'));
106
+			}
97 107
 
98 108
 			# Save configuration
99 109
 
100 110
 			$param = self::$param[$this->section]; $name = Request::post('name');
101 111
 
102
-			if (false === Settings::set($param, $name)) return $ajax->error(Language::get(self::$error_name));
112
+			if (false === Settings::set($param, $name)) {
113
+				return $ajax->error(Language::get(self::$error_name));
114
+			}
103 115
 
104
-			if (false === Settings::save()) return $ajax->error(Language::get(self::$error_save));
116
+			if (false === Settings::save()) {
117
+				return $ajax->error(Language::get(self::$error_save));
118
+			}
105 119
 
106 120
 			# ------------------------
107 121
 
@@ -116,7 +130,9 @@  discard block
 block discarded – undo
116 130
 
117 131
 			$this->items = $this->getHandlerItems();
118 132
 
119
-			if (Request::isAjax()) return $this->handleAjax();
133
+			if (Request::isAjax()) {
134
+				return $this->handleAjax();
135
+			}
120 136
 
121 137
 			# ------------------------
122 138
 
Please login to merge, or discard this patch.
www/engine/System/Classes/Modules/Extend/Utils/Extension.php 1 patch
Braces   +43 added lines, -15 removed lines patch added patch discarded remove patch
@@ -32,11 +32,15 @@  discard block
 block discarded – undo
32 32
 
33 33
 				$file_name = ($dir_name . $name . '/Config.php');
34 34
 
35
-				if (!is_array($include = Explorer::php($file_name))) continue;
35
+				if (!is_array($include = Explorer::php($file_name))) {
36
+					continue;
37
+				}
36 38
 
37 39
 				$config = Arr::select($include, self::$data);
38 40
 
39
-				if (!(self::valid($config['name']) && ($config['name'] === $name))) continue;
41
+				if (!(self::valid($config['name']) && ($config['name'] === $name))) {
42
+					continue;
43
+				}
40 44
 
41 45
 				$items[$name] = $config;
42 46
 			}
@@ -52,11 +56,19 @@  discard block
 block discarded – undo
52 56
 
53 57
 			$name = ''; $param = self::$param[self::$section];
54 58
 
55
-			if (self::exists($name_cookie = Cookie::get($param))) $name = $name_cookie;
59
+			if (self::exists($name_cookie = Cookie::get($param))) {
60
+				$name = $name_cookie;
61
+			}
56 62
 
57
-			if (self::exists($name_get = Request::get(self::$name))) $name = $name_get;
63
+			if (self::exists($name_get = Request::get(self::$name))) {
64
+				$name = $name_get;
65
+			}
58 66
 
59
-			if ('' !== $name) Cookie::set($param, $name, self::$cookie_expires); else return false;
67
+			if ('' !== $name) {
68
+				Cookie::set($param, $name, self::$cookie_expires);
69
+			} else {
70
+				return false;
71
+			}
60 72
 
61 73
 			# ------------------------
62 74
 
@@ -90,7 +102,9 @@  discard block
 block discarded – undo
90 102
 
91 103
 			$section = self::getSection($section); $dir_name = self::getDirName($section);
92 104
 
93
-			if (!Explorer::isDir($dir_name)) throw new Exception\General(self::$error_directory);
105
+			if (!Explorer::isDir($dir_name)) {
106
+				throw new Exception\General(self::$error_directory);
107
+			}
94 108
 
95 109
 			self::$section = $section; self::$dir_name = $dir_name; self::$items = self::getItems($dir_name);
96 110
 
@@ -98,11 +112,15 @@  discard block
 block discarded – undo
98 112
 
99 113
 			$primary = (self::exists(self::$default[$section]) ? self::$default[$section] : false);
100 114
 
101
-			if ($selectable && (false !== ($name = self::getUserDefined()))) $name_valid = true;
102
-
103
-			else $name_valid = (self::exists($name = Settings::get($param)) || (false !== ($name = $primary)));
115
+			if ($selectable && (false !== ($name = self::getUserDefined()))) {
116
+				$name_valid = true;
117
+			} else {
118
+				$name_valid = (self::exists($name = Settings::get($param)) || (false !== ($name = $primary)));
119
+			}
104 120
 
105
-			if (!($name_valid || (null !== ($name = key(self::$items))))) throw new Exception\General(self::$error_select);
121
+			if (!($name_valid || (null !== ($name = key(self::$items))))) {
122
+				throw new Exception\General(self::$error_select);
123
+			}
106 124
 
107 125
 			# ------------------------
108 126
 
@@ -127,7 +145,9 @@  discard block
 block discarded – undo
127 145
 
128 146
 		public static function items(string $section = null) {
129 147
 
130
-			if (null === $section) return self::$items;
148
+			if (null === $section) {
149
+				return self::$items;
150
+			}
131 151
 
132 152
 			$section = self::getSection($section); $dir_name = self::getDirName($section);
133 153
 
@@ -152,7 +172,9 @@  discard block
 block discarded – undo
152 172
 
153 173
 		public static function path() {
154 174
 
155
-			if ('' === self::$active) return false;
175
+			if ('' === self::$active) {
176
+				return false;
177
+			}
156 178
 
157 179
 			return (self::$dir_name . self::$active . '/');
158 180
 		}
@@ -161,7 +183,9 @@  discard block
 block discarded – undo
161 183
 
162 184
 		public static function pathPrimary() {
163 185
 
164
-			if ('' === self::$primary) return false;
186
+			if ('' === self::$primary) {
187
+				return false;
188
+			}
165 189
 
166 190
 			return (self::$dir_name . self::$primary . '/');
167 191
 		}
@@ -170,9 +194,13 @@  discard block
 block discarded – undo
170 194
 
171 195
 		public static function data(string $name = null) {
172 196
 
173
-			if ('' === self::$active) return false;
197
+			if ('' === self::$active) {
198
+				return false;
199
+			}
174 200
 
175
-			if (null === $name) return self::$items[self::$active];
201
+			if (null === $name) {
202
+				return self::$items[self::$active];
203
+			}
176 204
 
177 205
 			return (isset(self::$items[self::$active][$name]) ? self::$items[self::$active][$name] : false);
178 206
 		}
Please login to merge, or discard this patch.
www/engine/System/Classes/Frames/Section.php 1 patch
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -32,10 +32,12 @@  discard block
 block discarded – undo
32 32
 
33 33
 			$languages = [Extend\Languages::pathPrimary(), Extend\Languages::path()];
34 34
 
35
-			foreach (array_unique($languages) as $path) foreach (static::PHRASES as $name) {
35
+			foreach (array_unique($languages) as $path) {
36
+				foreach (static::PHRASES as $name) {
36 37
 
37 38
 				Language::load($path . 'Phrases/' . $name . '.php');
38 39
 			}
40
+			}
39 41
 
40 42
 			# Set template globals
41 43
 
@@ -57,7 +59,9 @@  discard block
 block discarded – undo
57 59
 
58 60
 			# Set timezone
59 61
 
60
-			if (Auth::check() && ('' !== ($timezone = Auth::user()->timezone))) date_default_timezone_set($timezone);
62
+			if (Auth::check() && ('' !== ($timezone = Auth::user()->timezone))) {
63
+				date_default_timezone_set($timezone);
64
+			}
61 65
 
62 66
 			# ------------------------
63 67
 
Please login to merge, or discard this patch.
www/engine/System/Classes/Frames/Admin/Section.php 1 patch
Braces   +21 added lines, -8 removed lines patch added patch discarded remove patch
@@ -147,20 +147,29 @@  discard block
 block discarded – undo
147 147
 
148 148
 				if ($this instanceof Component\Install) {
149 149
 
150
-					if (Template::isBlock($result = $this->handle())) return $this->displayForm($result, STATUS_CODE_200);
150
+					if (Template::isBlock($result = $this->handle())) {
151
+						return $this->displayForm($result, STATUS_CODE_200);
152
+					}
151 153
 				}
152 154
 
153 155
 				# Handle auth component request
154 156
 
155 157
 				else if ($this instanceof Component\Auth) {
156 158
 
157
-					if (Auth::check()) Request::redirect(INSTALL_PATH . '/admin');
158
-
159
-					if ($this instanceof Component\Auth\Initial) { if (!Auth::initial()) Request::redirect(INSTALL_PATH . '/admin/login'); }
159
+					if (Auth::check()) {
160
+						Request::redirect(INSTALL_PATH . '/admin');
161
+					}
160 162
 
161
-					else if (Auth::initial()) Request::redirect(INSTALL_PATH . '/admin/register');
163
+					if ($this instanceof Component\Auth\Initial) { if (!Auth::initial()) {
164
+						Request::redirect(INSTALL_PATH . '/admin/login');
165
+					}
166
+					} else if (Auth::initial()) {
167
+						Request::redirect(INSTALL_PATH . '/admin/register');
168
+					}
162 169
 
163
-					if (Template::isBlock($result = $this->handle())) return $this->displayForm($result, STATUS_CODE_401);
170
+					if (Template::isBlock($result = $this->handle())) {
171
+						return $this->displayForm($result, STATUS_CODE_401);
172
+					}
164 173
 				}
165 174
 
166 175
 				# Handle panel component request
@@ -172,9 +181,13 @@  discard block
 block discarded – undo
172 181
 						Request::redirect(INSTALL_PATH . '/admin/login');
173 182
 					}
174 183
 
175
-					if (Template::isBlock($result = $this->handle())) return $this->displayPage($result);
184
+					if (Template::isBlock($result = $this->handle())) {
185
+						return $this->displayPage($result);
186
+					}
176 187
 
177
-					if (Ajax::isResponse($result)) return Ajax::output($result);
188
+					if (Ajax::isResponse($result)) {
189
+						return Ajax::output($result);
190
+					}
178 191
 				}
179 192
 			}
180 193
 
Please login to merge, or discard this patch.
www/engine/System/Classes/Frames/Site/Section.php 1 patch
Braces   +29 added lines, -11 removed lines patch added patch discarded remove patch
@@ -40,7 +40,9 @@  discard block
 block discarded – undo
40 40
 
41 41
 			if (Settings::get('users_registration')) {
42 42
 
43
-				if (!Auth::check()) $layout->block('auth')->enable(); else {
43
+				if (!Auth::check()) {
44
+					$layout->block('auth')->enable();
45
+				} else {
44 46
 
45 47
 					$layout->block('user')->enable();
46 48
 
@@ -48,7 +50,9 @@  discard block
 block discarded – undo
48 50
 
49 51
 					$layout->block('user')->name = Auth::user()->name;
50 52
 
51
-					if (Auth::user()->rank === RANK_ADMINISTRATOR) $layout->block('user')->block('admin')->enable();
53
+					if (Auth::user()->rank === RANK_ADMINISTRATOR) {
54
+						$layout->block('user')->block('admin')->enable();
55
+					}
52 56
 				}
53 57
 			}
54 58
 
@@ -109,9 +113,11 @@  discard block
 block discarded – undo
109 113
 
110 114
 			# Set canonical
111 115
 
112
-			if ('' === $this->canonical) $page->block('canonical')->disable();
113
-
114
-			else $page->block('canonical')->link = $this->canonical;
116
+			if ('' === $this->canonical) {
117
+				$page->block('canonical')->disable();
118
+			} else {
119
+				$page->block('canonical')->link = $this->canonical;
120
+			}
115 121
 
116 122
 			# Set layout
117 123
 
@@ -128,19 +134,27 @@  discard block
 block discarded – undo
128 134
 
129 135
 			# Check site status
130 136
 
131
-			if (Settings::get('site_status') === STATUS_MAINTENANCE) return Status::maintenance();
137
+			if (Settings::get('site_status') === STATUS_MAINTENANCE) {
138
+				return Status::maintenance();
139
+			}
132 140
 
133
-			if (Settings::get('site_status') === STATUS_UPDATE) return Status::update();
141
+			if (Settings::get('site_status') === STATUS_UPDATE) {
142
+				return Status::update();
143
+			}
134 144
 
135 145
 			# Check access rights
136 146
 
137 147
 			if ($this instanceof Component\Profile) {
138 148
 
139
-				if (!Settings::get('users_registration')) return Status::error404();
149
+				if (!Settings::get('users_registration')) {
150
+					return Status::error404();
151
+				}
140 152
 
141 153
 				if (($this instanceof Component\Profile\Auth)) {
142 154
 
143
-					if (Auth::check()) Request::redirect(INSTALL_PATH . '/profile');
155
+					if (Auth::check()) {
156
+						Request::redirect(INSTALL_PATH . '/profile');
157
+					}
144 158
 
145 159
 				} else if (!Auth::check() || ((false !== Request::get('logout')) && Auth::logout())) {
146 160
 
@@ -156,9 +170,13 @@  discard block
 block discarded – undo
156 170
 
157 171
 				$variables = new Variables(); $widgets = new Widgets();
158 172
 
159
-				foreach ($variables->items() as $name => $value) Template::global($name, $value);
173
+				foreach ($variables->items() as $name => $value) {
174
+					Template::global($name, $value);
175
+				}
160 176
 
161
-				foreach ($widgets->items() as $name => $block) Template::widget($name, $block);
177
+				foreach ($widgets->items() as $name => $block) {
178
+					Template::widget($name, $block);
179
+				}
162 180
 
163 181
 				# Display page
164 182
 
Please login to merge, or discard this patch.
www/engine/System/Classes/Utils/Pagination.php 1 patch
Braces   +15 added lines, -7 removed lines patch added patch discarded remove patch
@@ -14,7 +14,9 @@  discard block
 block discarded – undo
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
 block discarded – undo
41 43
 
42 44
 				$block->link = $url->set('index', $index)->get(); $block->index = $index;
43 45
 
44
-				if ($closest) $block->block('ellipsis')->disable();
46
+				if ($closest) {
47
+					$block->block('ellipsis')->disable();
48
+				}
45 49
 			}
46 50
 		}
47 51
 
@@ -58,9 +62,9 @@  discard block
 block discarded – undo
58 62
 
59 63
 				list ($extremum, $index) = $data; $block = $pagination->block($class);
60 64
 
61
-				if ($active === $extremum) { $block->disable(); $pagination->block($class . '_disabled')->enable(); }
62
-
63
-				else $block->link = $url->set('index', $index)->get();
65
+				if ($active === $extremum) { $block->disable(); $pagination->block($class . '_disabled')->enable(); } else {
66
+					$block->link = $url->set('index', $index)->get();
67
+				}
64 68
 			}
65 69
 		}
66 70
 
@@ -68,9 +72,13 @@  discard block
 block discarded – undo
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
 
Please login to merge, or discard this patch.
www/engine/System/Classes/Utils/Map/Item.php 1 patch
Braces   +15 added lines, -5 removed lines patch added patch discarded remove patch
@@ -10,11 +10,15 @@  discard block
 block discarded – undo
10 10
 
11 11
 		private function parse(string $string, string $regex) {
12 12
 
13
-			if (!preg_match('/^\//', $string)) return false;
13
+			if (!preg_match('/^\//', $string)) {
14
+				return false;
15
+			}
14 16
 
15 17
 			$items = preg_split('/\//', $string, 0, PREG_SPLIT_NO_EMPTY);
16 18
 
17
-			foreach ($items as $name) if (!preg_match($regex, $name)) return false;
19
+			foreach ($items as $name) {
20
+				if (!preg_match($regex, $name)) return false;
21
+			}
18 22
 
19 23
 			# ------------------------
20 24
 
@@ -25,9 +29,13 @@  discard block
 block discarded – undo
25 29
 
26 30
 		public function __construct(string $path, string $handler) {
27 31
 
28
-			if (false !== ($path = $this->parse($path, REGEX_MAP_PATH_ITEM_NAME))) $this->path = $path;
32
+			if (false !== ($path = $this->parse($path, REGEX_MAP_PATH_ITEM_NAME))) {
33
+				$this->path = $path;
34
+			}
29 35
 
30
-			if (false !== ($handler = $this->parse($handler, REGEX_MAP_HANDLER_ITEM_NAME))) $this->handler = $handler;
36
+			if (false !== ($handler = $this->parse($handler, REGEX_MAP_HANDLER_ITEM_NAME))) {
37
+				$this->handler = $handler;
38
+			}
31 39
 
32 40
 			$this->parsed = ((false !== $path) && (false !== $handler));
33 41
 		}
@@ -36,7 +44,9 @@  discard block
 block discarded – undo
36 44
 
37 45
 		public function handler(array $path) {
38 46
 
39
-			if (!$this->parsed || ($path !== $this->path)) return false;
47
+			if (!$this->parsed || ($path !== $this->path)) {
48
+				return false;
49
+			}
40 50
 
41 51
 			return implode('\\', $this->handler);
42 52
 		}
Please login to merge, or discard this patch.
www/engine/System/Classes/Utils/Map/Map.php 1 patch
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -20,7 +20,9 @@  discard block
 block discarded – undo
20 20
 
21 21
 					$item = new Map\Item($item->path, $item->handler);
22 22
 
23
-					if ($item->parsed()) $this->map[] = $item;
23
+					if ($item->parsed()) {
24
+						$this->map[] = $item;
25
+					}
24 26
 				}
25 27
 			}
26 28
 		}
@@ -31,7 +33,9 @@  discard block
 block discarded – undo
31 33
 
32 34
 			foreach ($this->map as $item) {
33 35
 
34
-				if (false !== ($handler = $item->handler($url->path()))) return $handler;
36
+				if (false !== ($handler = $item->handler($url->path()))) {
37
+					return $handler;
38
+				}
35 39
 			}
36 40
 
37 41
 			# ------------------------
Please login to merge, or discard this patch.