Completed
Push — master ( 8e013f...5c10bd )
by Anton
03:39
created
www/engine/System/Classes/Modules/Entitizer/Listview/Widgets.php 1 patch
Unused Use Statements   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -2,7 +2,9 @@
 block discarded – undo
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
 
Please login to merge, or discard this patch.
www/engine/System/Classes/Modules/Entitizer/Utils/Entity/Entity.php 2 patches
Unused Use Statements   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -2,7 +2,8 @@
 block discarded – undo
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
 
Please login to merge, or discard this patch.
Braces   +24 added lines, -8 removed lines patch added patch discarded remove patch
@@ -20,7 +20,9 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 		}
Please login to merge, or discard this patch.
www/engine/System/Classes/Modules/Entitizer/Utils/Handler.php 2 patches
Unused Use Statements   +8 added lines, -1 removed lines patch added patch discarded remove patch
@@ -2,7 +2,14 @@
 block discarded – undo
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
 
Please login to merge, or discard this patch.
Braces   +37 added lines, -15 removed lines patch added patch discarded remove patch
@@ -24,7 +24,9 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.
www/engine/System/Classes/Modules/Entitizer/Utils/Listview.php 2 patches
Unused Use Statements   +8 added lines, -1 removed lines patch added patch discarded remove patch
@@ -2,7 +2,14 @@
 block discarded – undo
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
 
Please login to merge, or discard this patch.
Braces   +26 added lines, -10 removed lines patch added patch discarded remove patch
@@ -22,9 +22,11 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.
www/engine/System/Classes/Modules/Filemanager/Handler/Dir.php 1 patch
Unused Use Statements   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -2,7 +2,9 @@
 block discarded – undo
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
 
Please login to merge, or discard this patch.
www/engine/System/Classes/Modules/Filemanager/Handler/File.php 1 patch
Unused Use Statements   +6 added lines, -1 removed lines patch added patch discarded remove patch
@@ -2,7 +2,12 @@
 block discarded – undo
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
 
Please login to merge, or discard this patch.
www/engine/System/Classes/Modules/Filemanager/Handler/Listview.php 2 patches
Unused Use Statements   +9 added lines, -2 removed lines patch added patch discarded remove patch
@@ -2,8 +2,15 @@
 block discarded – undo
2 2
 
3 3
 namespace System\Modules\Filemanager\Handler {
4 4
 
5
-	use System\Modules\Filemanager, System\Utils\Messages, System\Utils\Pagination, System\Utils\Uploader, System\Utils\View;
6
-	use Ajax, Arr, Explorer, Language, Number, Request, Template, Url;
5
+	use System\Modules\Filemanager;
6
+	use System\Utils\Pagination;
7
+	use System\Utils\Uploader;
8
+	use System\Utils\View;
9
+	use Arr;
10
+	use Number;
11
+	use Request;
12
+	use Template;
13
+	use Url;
7 14
 
8 15
 	class Listview {
9 16
 
Please login to merge, or discard this patch.
Braces   +16 added lines, -8 removed lines patch added patch discarded remove patch
@@ -23,15 +23,19 @@  discard block
 block discarded – undo
23 23
 
24 24
 				while (false !== ($name = readdir($handler))) {
25 25
 
26
-					if (in_array($name, ['.', '..', '.empty'], true)) continue;
26
+					if (in_array($name, ['.', '..', '.empty'], true)) {
27
+						continue;
28
+					}
27 29
 
28 30
 					$path = ($prefix . $name); $path_full = ($this->parent->pathFull() . $name);
29 31
 
30 32
 					$data = ['name' => $name, 'path' => $path, 'path_full' => $path_full];
31 33
 
32
-					if (@is_dir($path_full)) $dirs[] = array_merge($data, ['type' => FILEMANAGER_TYPE_DIR]);
33
-
34
-					else if (@is_file($path_full)) $files[] = array_merge($data, ['type' => FILEMANAGER_TYPE_FILE]);
34
+					if (@is_dir($path_full)) {
35
+						$dirs[] = array_merge($data, ['type' => FILEMANAGER_TYPE_DIR]);
36
+					} else if (@is_file($path_full)) {
37
+						$files[] = array_merge($data, ['type' => FILEMANAGER_TYPE_FILE]);
38
+					}
35 39
 				}
36 40
 
37 41
 				closedir($handler);
@@ -98,9 +102,11 @@  discard block
 block discarded – undo
98 102
 
99 103
 			foreach ($this->items['list'] as $item) {
100 104
 
101
-				if ($item['type'] === FILEMANAGER_TYPE_DIR) $items->add($this->getDirItemBlock($item));
102
-
103
-				else if ($item['type'] === FILEMANAGER_TYPE_FILE) $items->add($this->getFileItemBlock($item));
105
+				if ($item['type'] === FILEMANAGER_TYPE_DIR) {
106
+					$items->add($this->getDirItemBlock($item));
107
+				} else if ($item['type'] === FILEMANAGER_TYPE_FILE) {
108
+					$items->add($this->getFileItemBlock($item));
109
+				}
104 110
 			}
105 111
 
106 112
 			# ------------------------
@@ -149,7 +155,9 @@  discard block
 block discarded – undo
149 155
 
150 156
 			$items = $this->getItemsBlock();
151 157
 
152
-			if ($items->count() > 0) $contents->items = $items;
158
+			if ($items->count() > 0) {
159
+				$contents->items = $items;
160
+			}
153 161
 
154 162
 			# Set pagination
155 163
 
Please login to merge, or discard this patch.
www/engine/System/Classes/Utils/Uploader.php 2 patches
Unused Use Statements   +4 added lines, -1 removed lines patch added patch discarded remove patch
@@ -2,7 +2,10 @@
 block discarded – undo
2 2
 
3 3
 namespace System\Utils {
4 4
 
5
-	use System\Utils\Messages, Explorer, Language, Request;
5
+	use System\Utils\Messages;
6
+	use Explorer;
7
+	use Language;
8
+	use Request;
6 9
 
7 10
 	abstract class Uploader {
8 11
 
Please login to merge, or discard this patch.
Braces   +42 added lines, -14 removed lines patch added patch discarded remove patch
@@ -10,19 +10,33 @@  discard block
 block discarded – undo
10 10
 
11 11
 		private static function translateError(int $error) {
12 12
 
13
-			if ($error === UPLOAD_ERR_INI_SIZE)         return 'UPLOADER_ERROR_INI_SIZE';
13
+			if ($error === UPLOAD_ERR_INI_SIZE) {
14
+				return 'UPLOADER_ERROR_INI_SIZE';
15
+			}
14 16
 
15
-			if ($error === UPLOAD_ERR_FORM_SIZE)        return 'UPLOADER_ERROR_FORM_SIZE';
17
+			if ($error === UPLOAD_ERR_FORM_SIZE) {
18
+				return 'UPLOADER_ERROR_FORM_SIZE';
19
+			}
16 20
 
17
-			if ($error === UPLOAD_ERR_PARTIAL)          return 'UPLOADER_ERROR_PARTIAL';
21
+			if ($error === UPLOAD_ERR_PARTIAL) {
22
+				return 'UPLOADER_ERROR_PARTIAL';
23
+			}
18 24
 
19
-			if ($error === UPLOAD_ERR_NO_FILE)          return 'UPLOADER_ERROR_NO_FILE';
25
+			if ($error === UPLOAD_ERR_NO_FILE) {
26
+				return 'UPLOADER_ERROR_NO_FILE';
27
+			}
20 28
 
21
-			if ($error === UPLOAD_ERR_NO_TMP_DIR)       return 'UPLOADER_ERROR_NO_TMP_DIR';
29
+			if ($error === UPLOAD_ERR_NO_TMP_DIR) {
30
+				return 'UPLOADER_ERROR_NO_TMP_DIR';
31
+			}
22 32
 
23
-			if ($error === UPLOAD_ERR_CANT_WRITE)       return 'UPLOADER_ERROR_CANT_WRITE';
33
+			if ($error === UPLOAD_ERR_CANT_WRITE) {
34
+				return 'UPLOADER_ERROR_CANT_WRITE';
35
+			}
24 36
 
25
-			if ($error === UPLOAD_ERR_EXTENSION)        return 'UPLOADER_ERROR_EXTENSION';
37
+			if ($error === UPLOAD_ERR_EXTENSION) {
38
+				return 'UPLOADER_ERROR_EXTENSION';
39
+			}
26 40
 
27 41
 			# ------------------------
28 42
 
@@ -33,35 +47,49 @@  discard block
 block discarded – undo
33 47
 
34 48
 		public static function save(string $name, string $dir_name) {
35 49
 
36
-			if ((false === ($file = Request::file($name))) || !is_uploaded_file($file['tmp_name'])) return false;
50
+			if ((false === ($file = Request::file($name))) || !is_uploaded_file($file['tmp_name'])) {
51
+				return false;
52
+			}
37 53
 
38 54
 			# Check for upload errors
39 55
 
40
-			if ($file['error'] !== UPLOAD_ERR_OK) return self::translateError($file['error']);
56
+			if ($file['error'] !== UPLOAD_ERR_OK) {
57
+				return self::translateError($file['error']);
58
+			}
41 59
 
42 60
 			# Check size
43 61
 
44
-			if ($file['size'] > CONFIG_UPLOADS_MAX_SIZE) return 'UPLOADER_ERROR_SIZE';
62
+			if ($file['size'] > CONFIG_UPLOADS_MAX_SIZE) {
63
+				return 'UPLOADER_ERROR_SIZE';
64
+			}
45 65
 
46 66
 			# Check file extension
47 67
 
48 68
 			$extensions = ['php', 'phtml', 'php3', 'php4', 'php5', 'phps'];
49 69
 
50
-			if (in_array(Explorer::extension($file['name'], false), $extensions)) return 'UPLOADER_ERROR_TYPE';
70
+			if (in_array(Explorer::extension($file['name'], false), $extensions)) {
71
+				return 'UPLOADER_ERROR_TYPE';
72
+			}
51 73
 
52 74
 			# Check target directory
53 75
 
54
-			if (!Explorer::isDir($dir_name)) return 'UPLOADER_ERROR_DIR';
76
+			if (!Explorer::isDir($dir_name)) {
77
+				return 'UPLOADER_ERROR_DIR';
78
+			}
55 79
 
56 80
 			# Check target file
57 81
 
58 82
 			$file_name = ($dir_name . '/' . basename($file['name']));
59 83
 
60
-			if (Explorer::isDir($file_name) || Explorer::isFile($file_name)) return 'UPLOADER_ERROR_EXISTS';
84
+			if (Explorer::isDir($file_name) || Explorer::isFile($file_name)) {
85
+				return 'UPLOADER_ERROR_EXISTS';
86
+			}
61 87
 
62 88
 			# Save uploaded file
63 89
 
64
-			if (!@move_uploaded_file($file['tmp_name'], $file_name)) return 'UPLOADER_ERROR_SAVE';
90
+			if (!@move_uploaded_file($file['tmp_name'], $file_name)) {
91
+				return 'UPLOADER_ERROR_SAVE';
92
+			}
65 93
 
66 94
 			# ------------------------
67 95
 
Please login to merge, or discard this patch.
www/engine/Main.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -10,10 +10,10 @@
 block discarded – undo
10 10
 
11 11
 # Define constants
12 12
 
13
-define('DIR_ENGINE',        (dirname(__FILE__) . '/'));
13
+define('DIR_ENGINE', (dirname(__FILE__) . '/'));
14 14
 
15
-define('DIR_WWW',           (DIR_ENGINE . '../'));
16
-define('DIR_UPLOADS',       (DIR_ENGINE . '../uploads/'));
15
+define('DIR_WWW', (DIR_ENGINE . '../'));
16
+define('DIR_UPLOADS', (DIR_ENGINE . '../uploads/'));
17 17
 
18 18
 # Require framework main file
19 19
 
Please login to merge, or discard this patch.
Braces   +22 added lines, -12 removed lines patch added patch discarded remove patch
@@ -2,7 +2,9 @@  discard block
 block discarded – undo
2 2
 
3 3
 # Check PHP version
4 4
 
5
-if (version_compare(PHP_VERSION, '7.0.0') < 0) exit('PHP version 7 or higher is required.');
5
+if (version_compare(PHP_VERSION, '7.0.0') < 0) {
6
+	exit('PHP version 7 or higher is required.');
7
+}
6 8
 
7 9
 # Set error reporting
8 10
 
@@ -31,23 +33,31 @@  discard block
 block discarded – undo
31 33
 
32 34
 	# Determine class path
33 35
 
34
-	if ($path[0] === 'System') $path = (DIR_SYSTEM_CLASSES . implode('/', array_slice($path, 1)));
35
-
36
-	else if ($path[0] === 'Plugins') $path = (DIR_SYSTEM_PLUGINS . implode('/', array_slice($path, 1)));
37
-
38
-	else $path = (DIR_CLASSES . implode('/', $path));
36
+	if ($path[0] === 'System') {
37
+		$path = (DIR_SYSTEM_CLASSES . implode('/', array_slice($path, 1)));
38
+	} else if ($path[0] === 'Plugins') {
39
+		$path = (DIR_SYSTEM_PLUGINS . implode('/', array_slice($path, 1)));
40
+	} else {
41
+		$path = (DIR_CLASSES . implode('/', $path));
42
+	}
39 43
 
40 44
 	# Require class file
41 45
 
42
-	if (@file_exists($file_name = ($path . '.php')) && @is_file($file_name)) require_once $file_name;
43
-
44
-	else if (@file_exists($file_name = ($path . '/' . $last . '.php')) && @is_file($file_name)) require_once $file_name;
46
+	if (@file_exists($file_name = ($path . '.php')) && @is_file($file_name)) {
47
+		require_once $file_name;
48
+	} else if (@file_exists($file_name = ($path . '/' . $last . '.php')) && @is_file($file_name)) {
49
+		require_once $file_name;
50
+	}
45 51
 
46 52
 	# Check if class exists
47 53
 
48
-	if (!class_exists($class_name) && !interface_exists($class_name) && !trait_exists($class_name)) throw new Exception\ClassLoad($class_name);
54
+	if (!class_exists($class_name) && !interface_exists($class_name) && !trait_exists($class_name)) {
55
+		throw new Exception\ClassLoad($class_name);
56
+	}
49 57
 
50 58
 	# Call autoload method
51 59
 
52
-	if (method_exists($class_name, '__autoload')) $class_name::__autoload();
53
-});
60
+	if (method_exists($class_name, '__autoload')) {
61
+		$class_name::__autoload();
62
+	}
63
+	});
Please login to merge, or discard this patch.