Passed
Branch doc (45b632)
by Anton
03:24
created
www/engine/Framework/Classes/Ajax/Response.php 1 patch
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -21,7 +21,9 @@  discard block
 block discarded – undo
21 21
 
22 22
 		public function set(string $name, $value) {
23 23
 
24
-			if (!in_array($name, ['error', 'status'], true)) $this->data[$name] = $value;
24
+			if (!in_array($name, ['error', 'status'], true)) {
25
+				$this->data[$name] = $value;
26
+			}
25 27
 
26 28
 			return $this;
27 29
 		}
@@ -82,7 +84,9 @@  discard block
 block discarded – undo
82 84
 
83 85
 			$data = ['status' => $this->status];
84 86
 
85
-			if (null !== $this->error) $data['error'] = $this->error;
87
+			if (null !== $this->error) {
88
+				$data['error'] = $this->error;
89
+			}
86 90
 
87 91
 			# ------------------------
88 92
 
Please login to merge, or discard this patch.
www/engine/Framework/Classes/Url/Url.php 3 patches
Braces   +9 added lines, -3 removed lines patch added patch discarded remove patch
@@ -19,18 +19,24 @@
 block discarded – undo
19 19
 
20 20
 		public function __construct(string $url = '') {
21 21
 
22
-			if (false === ($url = parse_url($url))) return;
22
+			if (false === ($url = parse_url($url))) {
23
+				return;
24
+			}
23 25
 
24 26
 			# Parse path
25 27
 
26
-			if (isset($url['path'])) foreach (explode('/', $url['path']) as $part) {
28
+			if (isset($url['path'])) {
29
+				foreach (explode('/', $url['path']) as $part) {
27 30
 
28 31
 				if ('' !== $part) $this->path[] = urldecode($part);
29 32
 			}
33
+			}
30 34
 
31 35
 			# Parse query
32 36
 
33
-			if (isset($url['query'])) parse_str($url['query'], $this->query);
37
+			if (isset($url['query'])) {
38
+				parse_str($url['query'], $this->query);
39
+			}
34 40
 		}
35 41
 
36 42
 		/**
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
 
73 73
 		public function getPath() : string {
74 74
 
75
-			return ('/' . implode('/', array_map('urlencode', $this->path)));
75
+			return ('/'.implode('/', array_map('urlencode', $this->path)));
76 76
 		}
77 77
 
78 78
 		/**
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
 
82 82
 		public function getQuery() : string {
83 83
 
84
-			return (($query = http_build_query($this->query)) ? ('?' . $query) : '');
84
+			return (($query = http_build_query($this->query)) ? ('?'.$query) : '');
85 85
 		}
86 86
 
87 87
 		/**
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
 
109 109
 		public function getString(bool $include_query = true) : string {
110 110
 
111
-			return ($this->getPath() . ($include_query ? $this->getQuery() : ''));
111
+			return ($this->getPath().($include_query ? $this->getQuery() : ''));
112 112
 		}
113 113
 	}
114 114
 }
Please login to merge, or discard this patch.
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -47,10 +47,10 @@
 block discarded – undo
47 47
 		}
48 48
 
49 49
 		/**
50
-		* Get a query attribute
51
-		*
52
-		* @return string|false: the value or false if the attribute does not exist
53
-		*/
50
+		 * Get a query attribute
51
+		 *
52
+		 * @return string|false: the value or false if the attribute does not exist
53
+		 */
54 54
 
55 55
 		public function getAttribute(string $name) {
56 56
 
Please login to merge, or discard this patch.
www/engine/Framework/Classes/Form/Form.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -181,7 +181,7 @@
 block discarded – undo
181 181
 
182 182
 			foreach ($this->fields as $field) {
183 183
 
184
-				$block->setBlock(('field_' . $field->getName()), $field->getBlock());
184
+				$block->setBlock(('field_'.$field->getName()), $field->getBlock());
185 185
 			}
186 186
 		}
187 187
 	}
Please login to merge, or discard this patch.
Braces   +20 added lines, -6 removed lines patch added patch discarded remove patch
@@ -23,7 +23,9 @@  discard block
 block discarded – undo
23 23
 
24 24
 		private function addField(Form\Field $field) {
25 25
 
26
-			if ($this->posted || ('' === ($key = $field->getKey()))) return false;
26
+			if ($this->posted || ('' === ($key = $field->getKey()))) {
27
+				return false;
28
+			}
27 29
 
28 30
 			$this->fields[$key] = $field;
29 31
 
@@ -38,7 +40,9 @@  discard block
 block discarded – undo
38 40
 
39 41
 		public function __construct(string $name = '') {
40 42
 
41
-			if (preg_match(REGEX_FORM_NAME, $name)) $this->name = $name;
43
+			if (preg_match(REGEX_FORM_NAME, $name)) {
44
+				$this->name = $name;
45
+			}
42 46
 		}
43 47
 
44 48
 		/**
@@ -90,9 +94,15 @@  discard block
 block discarded – undo
90 94
 
91 95
 			foreach ($this->fields as $field) {
92 96
 
93
-				if (($field instanceof Form\Field\Checkbox) || $field->disabled) continue;
97
+				if (($field instanceof Form\Field\Checkbox) || $field->disabled) {
98
+					continue;
99
+				}
94 100
 
95
-				if (false !== Request::post($field->getName())) $check = true; else return false;
101
+				if (false !== Request::post($field->getName())) {
102
+					$check = true;
103
+				} else {
104
+					return false;
105
+				}
96 106
 			}
97 107
 
98 108
 			# ------------------------
@@ -108,7 +118,9 @@  discard block
 block discarded – undo
108 118
 
109 119
 		public function post() {
110 120
 
111
-			if ($this->posted || !$this->check()) return false;
121
+			if ($this->posted || !$this->check()) {
122
+				return false;
123
+			}
112 124
 
113 125
 			$post = []; $errors = false;
114 126
 
@@ -116,7 +128,9 @@  discard block
 block discarded – undo
116 128
 
117 129
 				$field->post(); $post[$field->getKey()] = $field->getValue();
118 130
 
119
-				if ($field->error) $errors = true;
131
+				if ($field->error) {
132
+					$errors = true;
133
+				}
120 134
 			}
121 135
 
122 136
 			$this->posted = true; $this->errors = $errors;
Please login to merge, or discard this patch.
www/engine/Framework/Classes/Form/Field/Checkbox.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -53,7 +53,9 @@
 block discarded – undo
53 53
 
54 54
 			$tag->setAttribute('type', 'checkbox');
55 55
 
56
-			if ($this->value) $tag->setAttribute('checked', 'checked');
56
+			if ($this->value) {
57
+				$tag->setAttribute('checked', 'checked');
58
+			}
57 59
 
58 60
 			# ------------------------
59 61
 
Please login to merge, or discard this patch.
www/engine/Framework/Classes/Form/Field.php 3 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -31,9 +31,9 @@
 block discarded – undo
31 31
 
32 32
 			if (preg_match(REGEX_FORM_FIELD_KEY, $key)) {
33 33
 
34
-				$prefix = (('' !== $this->form->getName()) ? ($this->form->getName() . '_') : '');
34
+				$prefix = (('' !== $this->form->getName()) ? ($this->form->getName().'_') : '');
35 35
 
36
-				$this->key = $key; $this->name = ($prefix . $key); $this->id = str_replace('_', '-', $this->name);
36
+				$this->key = $key; $this->name = ($prefix.$key); $this->id = str_replace('_', '-', $this->name);
37 37
 			}
38 38
 
39 39
 			# Set configuration
Please login to merge, or discard this patch.
Unused Use Statements   +4 added lines, -1 removed lines patch added patch discarded remove patch
@@ -9,7 +9,10 @@
 block discarded – undo
9 9
 
10 10
 namespace Form {
11 11
 
12
-	use Dataset, Form, Request, Tag;
12
+	use Dataset;
13
+	use Form;
14
+	use Request;
15
+	use Tag;
13 16
 
14 17
 	abstract class Field {
15 18
 
Please login to merge, or discard this patch.
Braces   +12 added lines, -4 removed lines patch added patch discarded remove patch
@@ -57,11 +57,17 @@  discard block
 block discarded – undo
57 57
 
58 58
 			# Set appearance
59 59
 
60
-			if ($this->disabled)    $data['disabled']           = 'disabled';
60
+			if ($this->disabled) {
61
+				$data['disabled']           = 'disabled';
62
+			}
61 63
 
62
-			if ($this->required)    $data['data-required']      = 'required';
64
+			if ($this->required) {
65
+				$data['data-required']      = 'required';
66
+			}
63 67
 
64
-			if ($this->error)       $data['data-error']         = 'error';
68
+			if ($this->error) {
69
+				$data['data-error']         = 'error';
70
+			}
65 71
 
66 72
 			# ------------------------
67 73
 
@@ -76,7 +82,9 @@  discard block
 block discarded – undo
76 82
 
77 83
 		public function post() : bool {
78 84
 
79
-			if ($this->posted || $this->disabled || ('' === $this->key)) return false;
85
+			if ($this->posted || $this->disabled || ('' === $this->key)) {
86
+				return false;
87
+			}
80 88
 
81 89
 			$this->error = (!$this->setValue(Request::post($this->name)) && $this->required);
82 90
 
Please login to merge, or discard this patch.
www/engine/Framework/Classes/Explorer/Explorer.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
 
24 24
 					if (($name === '.') || ($name === '..')) continue;
25 25
 
26
-					if (@$checker($dir_name . $name)) yield $name;
26
+					if (@$checker($dir_name.$name)) yield $name;
27 27
 				}
28 28
 
29 29
 				closedir($handler);
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
 
94 94
 				foreach (array_diff($list, ['.', '..']) as $name) {
95 95
 
96
-					$name = ($dir_name . '/' . $name);
96
+					$name = ($dir_name.'/'.$name);
97 97
 
98 98
 					if (@is_dir($name)) self::removeDir($name, true);
99 99
 
Please login to merge, or discard this patch.
Braces   +23 added lines, -9 removed lines patch added patch discarded remove patch
@@ -21,9 +21,13 @@  discard block
 block discarded – undo
21 21
 
22 22
 				while (false !== ($name = readdir($handler))) {
23 23
 
24
-					if (($name === '.') || ($name === '..')) continue;
24
+					if (($name === '.') || ($name === '..')) {
25
+						continue;
26
+					}
25 27
 
26
-					if (@$checker($dir_name . $name)) yield $name;
28
+					if (@$checker($dir_name . $name)) {
29
+						yield $name;
30
+					}
27 31
 				}
28 32
 
29 33
 				closedir($handler);
@@ -36,7 +40,9 @@  discard block
 block discarded – undo
36 40
 
37 41
 		private static function getInfo(string $file_name, int $param, bool $check_exists = true) {
38 42
 
39
-			if ($check_exists && !self::isFile($file_name)) return false;
43
+			if ($check_exists && !self::isFile($file_name)) {
44
+				return false;
45
+			}
40 46
 
41 47
 			return pathinfo($file_name, $param);
42 48
 		}
@@ -95,9 +101,11 @@  discard block
 block discarded – undo
95 101
 
96 102
 					$name = ($dir_name . '/' . $name);
97 103
 
98
-					if (@is_dir($name)) self::removeDir($name, true);
99
-
100
-					else if (@is_file($name)) self::removeFile($name);
104
+					if (@is_dir($name)) {
105
+						self::removeDir($name, true);
106
+					} else if (@is_file($name)) {
107
+						self::removeFile($name);
108
+					}
101 109
 				}
102 110
 			}
103 111
 
@@ -123,7 +131,9 @@  discard block
 block discarded – undo
123 131
 
124 132
 		public static function iterateDirs(string $dir_name) {
125 133
 
126
-			foreach (self::getList($dir_name, 'is_dir') as $name) yield $name;
134
+			foreach (self::getList($dir_name, 'is_dir') as $name) {
135
+				yield $name;
136
+			}
127 137
 		}
128 138
 
129 139
 		/**
@@ -132,7 +142,9 @@  discard block
 block discarded – undo
132 142
 
133 143
 		public static function iterateFiles(string $dir_name) {
134 144
 
135
-			foreach (self::getList($dir_name, 'is_file') as $name) yield $name;
145
+			foreach (self::getList($dir_name, 'is_file') as $name) {
146
+				yield $name;
147
+			}
136 148
 		}
137 149
 
138 150
 		/**
@@ -238,7 +250,9 @@  discard block
 block discarded – undo
238 250
 
239 251
 		public static function include(string $file_name) {
240 252
 
241
-			if ((strtolower(self::getExtension($file_name)) !== 'php')) return false;
253
+			if ((strtolower(self::getExtension($file_name)) !== 'php')) {
254
+				return false;
255
+			}
242 256
 
243 257
 			return @include $file_name;
244 258
 		}
Please login to merge, or discard this patch.
www/engine/Framework/Classes/JSON/JSON.php 1 patch
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -41,7 +41,9 @@  discard block
 block discarded – undo
41 41
 
42 42
 		public static function load(string $file_name) {
43 43
 
44
-			if (false === ($contents = Explorer::getContents($file_name))) return null;
44
+			if (false === ($contents = Explorer::getContents($file_name))) {
45
+				return null;
46
+			}
45 47
 
46 48
 			return self::parse($contents);
47 49
 		}
@@ -54,7 +56,9 @@  discard block
 block discarded – undo
54 56
 
55 57
 		public static function save(string $file_name, $value) {
56 58
 
57
-			if (false === ($value = self::stringify($value))) return false;
59
+			if (false === ($value = self::stringify($value))) {
60
+				return false;
61
+			}
58 62
 
59 63
 			return Explorer::putContents($file_name, $value);
60 64
 		}
Please login to merge, or discard this patch.
www/engine/Framework/Engine.php 2 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -10,13 +10,13 @@  discard block
 block discarded – undo
10 10
 
11 11
 		private static function parseContents(string $contents, Throwable $exc) {
12 12
 
13
-		   $contents = str_replace('$message$',            $exc->getMessage(),                  $contents);
13
+		   $contents = str_replace('$message$', $exc->getMessage(), $contents);
14 14
 
15
-		   $contents = str_replace('$file$',               $exc->getFile(),                     $contents);
15
+		   $contents = str_replace('$file$', $exc->getFile(), $contents);
16 16
 
17
-		   $contents = str_replace('$line$',               $exc->getLine(),                     $contents);
17
+		   $contents = str_replace('$line$', $exc->getLine(), $contents);
18 18
 
19
-		   $contents = str_replace('$trace$',              nl2br($exc->getTraceAsString()),     $contents);
19
+		   $contents = str_replace('$trace$', nl2br($exc->getTraceAsString()), $contents);
20 20
 
21 21
 		   # ------------------------
22 22
 
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
 
55 55
 			# Load template
56 56
 
57
-			$file_name = (DIR_TEMPLATES . 'Exception.tpl');
57
+			$file_name = (DIR_TEMPLATES.'Exception.tpl');
58 58
 
59 59
 			if (false === ($contents = @file_get_contents($file_name))) $output = nl2br($exc);
60 60
 
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
 
71 71
 			header('Pragma: no-cache');
72 72
 
73
-			header(getenv('SERVER_PROTOCOL') . ' 500 Internal Server Error', true, 500);
73
+			header(getenv('SERVER_PROTOCOL').' 500 Internal Server Error', true, 500);
74 74
 
75 75
 			header('Content-type: text/html; charset=UTF-8');
76 76
 
Please login to merge, or discard this patch.
Braces   +23 added lines, -9 removed lines patch added patch discarded remove patch
@@ -29,17 +29,29 @@  discard block
 block discarded – undo
29 29
 
30 30
 		public static function getIP() {
31 31
 
32
-			if (!empty(getenv('HTTP_CLIENT_IP')))           return getenv('HTTP_CLIENT_IP');
32
+			if (!empty(getenv('HTTP_CLIENT_IP'))) {
33
+				return getenv('HTTP_CLIENT_IP');
34
+			}
33 35
 
34
-			if (!empty(getenv('HTTP_X_FORWARDED_FOR')))     return getenv('HTTP_X_FORWARDED_FOR');
36
+			if (!empty(getenv('HTTP_X_FORWARDED_FOR'))) {
37
+				return getenv('HTTP_X_FORWARDED_FOR');
38
+			}
35 39
 
36
-			if (!empty(getenv('HTTP_X_FORWARDED')))         return getenv('HTTP_X_FORWARDED');
40
+			if (!empty(getenv('HTTP_X_FORWARDED'))) {
41
+				return getenv('HTTP_X_FORWARDED');
42
+			}
37 43
 
38
-			if (!empty(getenv('HTTP_FORWARDED_FOR')))       return getenv('HTTP_FORWARDED_FOR');
44
+			if (!empty(getenv('HTTP_FORWARDED_FOR'))) {
45
+				return getenv('HTTP_FORWARDED_FOR');
46
+			}
39 47
 
40
-			if (!empty(getenv('HTTP_FORWARDED')))           return getenv('HTTP_FORWARDED');
48
+			if (!empty(getenv('HTTP_FORWARDED'))) {
49
+				return getenv('HTTP_FORWARDED');
50
+			}
41 51
 
42
-			if (!empty(getenv('REMOTE_ADDR')))              return getenv('REMOTE_ADDR');
52
+			if (!empty(getenv('REMOTE_ADDR'))) {
53
+				return getenv('REMOTE_ADDR');
54
+			}
43 55
 
44 56
 			# ------------------------
45 57
 
@@ -56,9 +68,11 @@  discard block
 block discarded – undo
56 68
 
57 69
 			$file_name = (DIR_TEMPLATES . 'Exception.tpl');
58 70
 
59
-			if (false === ($contents = @file_get_contents($file_name))) $output = nl2br($exc);
60
-
61
-			else $output = self::parseContents($contents, $exc);
71
+			if (false === ($contents = @file_get_contents($file_name))) {
72
+				$output = nl2br($exc);
73
+			} else {
74
+				$output = self::parseContents($contents, $exc);
75
+			}
62 76
 
63 77
 			# Set headers
64 78
 
Please login to merge, or discard this patch.
www/engine/System/Includes/Constants.php 1 patch
Spacing   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -2,68 +2,68 @@
 block discarded – undo
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.4.0');
9
-define('CADMIUM_COPY',                              '2016');
8
+define('CADMIUM_VERSION', '0.4.0');
9
+define('CADMIUM_COPY', '2016');
10 10
 
11 11
 # External
12 12
 
13
-define('JQUERY_VERSION',                            '3.1.1');
14
-define('SEMANTIC_UI_VERSION',                       '2.2.6');
15
-define('CKEDITOR_VERSION',                          '4.5.11');
13
+define('JQUERY_VERSION', '3.1.1');
14
+define('SEMANTIC_UI_VERSION', '2.2.6');
15
+define('CKEDITOR_VERSION', '4.5.11');
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);
Please login to merge, or discard this patch.