Passed
Push — master ( 289cbe...3ce129 )
by Anton
03:29
created
www/engine/System/Classes/Modules/Extend/Utils/Extension.php 3 patches
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -23,10 +23,10 @@
 block discarded – undo
23 23
 		}
24 24
 
25 25
 		/**
26
- 		 * Validate an item name
27
- 		 *
28
- 		 * @return string|false : the name or false on failure
29
- 		 */
26
+		 * Validate an item name
27
+		 *
28
+		 * @return string|false : the name or false on failure
29
+		 */
30 30
 
31 31
 		public static function validate(string $name) {
32 32
 
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@
 block discarded – undo
41 41
 
42 42
 			if (null !== static::$loader) return static::$loader->$name(...$arguments);
43 43
 
44
-			throw new \BadMethodCallException('Call to undefined method ' . get_called_class() . '::' . $name . '()');
44
+			throw new \BadMethodCallException('Call to undefined method '.get_called_class().'::'.$name.'()');
45 45
 		}
46 46
 	}
47 47
 }
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -39,7 +39,9 @@
 block discarded – undo
39 39
 
40 40
 		public static function __callStatic($name, $arguments) {
41 41
 
42
-			if (null !== static::$loader) return static::$loader->$name(...$arguments);
42
+			if (null !== static::$loader) {
43
+				return static::$loader->$name(...$arguments);
44
+			}
43 45
 
44 46
 			throw new \BadMethodCallException('Call to undefined method ' . get_called_class() . '::' . $name . '()');
45 47
 		}
Please login to merge, or discard this patch.
www/engine/System/Classes/Modules/Extend/Utils/Loader/Addons.php 1 patch
Braces   +19 added lines, -7 removed lines patch added patch discarded remove patch
@@ -23,7 +23,9 @@  discard block
 block discarded – undo
23 23
 
24 24
 			foreach ((Schema::get(static::$schema)->load() ?? []) as $item) {
25 25
 
26
-				if (isset($items[$item['name']])) $items[$item['name']]['installed'] = true;
26
+				if (isset($items[$item['name']])) {
27
+					$items[$item['name']]['installed'] = true;
28
+				}
27 29
 			}
28 30
 
29 31
 			# ------------------------
@@ -41,7 +43,9 @@  discard block
 block discarded – undo
41 43
 
42 44
 			foreach ((Schema::get(static::$schema)->load() ?? []) as $item) {
43 45
 
44
-				if (static::$extension_class::isValid($item['name'])) $items[$item['name']] = $item;
46
+				if (static::$extension_class::isValid($item['name'])) {
47
+					$items[$item['name']] = $item;
48
+				}
45 49
 			}
46 50
 
47 51
 			# ------------------------
@@ -70,18 +74,26 @@  discard block
 block discarded – undo
70 74
 
71 75
 		public function install(string $name, bool $value = true) : bool {
72 76
 
73
-			if (!isset($this->items[$name])) return false;
77
+			if (!isset($this->items[$name])) {
78
+				return false;
79
+			}
74 80
 
75 81
 			$items = [];
76 82
 
77 83
 			foreach ($this->items as $item) {
78 84
 
79
-				if ($value) { if ($item['installed'] || ($item['name'] === $name)) $items[] = $item; }
80
-
81
-				else { if ($item['installed'] && ($item['name'] !== $name)) $items[] = $item; }
85
+				if ($value) { if ($item['installed'] || ($item['name'] === $name)) {
86
+					$items[] = $item;
87
+				}
88
+				} else { if ($item['installed'] && ($item['name'] !== $name)) {
89
+					$items[] = $item;
90
+				}
91
+				}
82 92
 			}
83 93
 
84
-			if (!Schema::get(static::$schema)->save($items)) return false;
94
+			if (!Schema::get(static::$schema)->save($items)) {
95
+				return false;
96
+			}
85 97
 
86 98
 			$this->items[$name]['installed'] = $value;
87 99
 
Please login to merge, or discard this patch.
www/engine/System/Classes/Modules/Extend/Utils/Extension/Basic.php 1 patch
Braces   +6 added lines, -3 removed lines patch added patch discarded remove patch
@@ -32,7 +32,9 @@  discard block
 block discarded – undo
32 32
 
33 33
 			# Throw error if no extensions found
34 34
 
35
-			if (false === static::$loader->get('name')) throw new static::$exception_class;
35
+			if (false === static::$loader->get('name')) {
36
+				throw new static::$exception_class;
37
+			}
36 38
 
37 39
 			# Activate user defined extension
38 40
 
@@ -40,9 +42,10 @@  discard block
 block discarded – undo
40 42
 
41 43
 				$name = static::$name; $param = static::$param[static::$loader->getSection()];
42 44
 
43
-				if (static::$loader->activate(Request::get($name)) || static::$loader->activate(Cookie::get($param)))
44
-
45
+				if (static::$loader->activate(Request::get($name)) || static::$loader->activate(Cookie::get($param))) {
46
+				
45 47
 					Cookie::set($param, static::$loader->get('name'), static::$cookie_expires);
48
+				}
46 49
 			}
47 50
 		}
48 51
 	}
Please login to merge, or discard this patch.
www/engine/System/Classes/Frames/Section.php 2 patches
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
 
35 35
 			foreach (array_unique($languages) as $path) foreach ($phrases as $name) {
36 36
 
37
-				Language::load($path . 'Phrases/' . $name . '.php');
37
+				Language::load($path.'Phrases/'.$name.'.php');
38 38
 			}
39 39
 		}
40 40
 
@@ -44,24 +44,24 @@  discard block
 block discarded – undo
44 44
 
45 45
 		private function setGlobals() {
46 46
 
47
-			Template::setGlobal('cadmium_home',         CADMIUM_HOME);
48
-			Template::setGlobal('cadmium_copy',         CADMIUM_COPY);
49
-			Template::setGlobal('cadmium_name',         CADMIUM_NAME);
50
-			Template::setGlobal('cadmium_version',      CADMIUM_VERSION);
47
+			Template::setGlobal('cadmium_home', CADMIUM_HOME);
48
+			Template::setGlobal('cadmium_copy', CADMIUM_COPY);
49
+			Template::setGlobal('cadmium_name', CADMIUM_NAME);
50
+			Template::setGlobal('cadmium_version', CADMIUM_VERSION);
51 51
 
52
-			Template::setGlobal('template_name',        strtolower(Extend\Templates::get('name')));
52
+			Template::setGlobal('template_name', strtolower(Extend\Templates::get('name')));
53 53
 
54
-			Template::setGlobal('site_title',           Settings::get('site_title'));
55
-			Template::setGlobal('site_slogan',          Settings::get('site_slogan'));
54
+			Template::setGlobal('site_title', Settings::get('site_title'));
55
+			Template::setGlobal('site_slogan', Settings::get('site_slogan'));
56 56
 
57
-			Template::setGlobal('system_url',           Settings::get('system_url'));
58
-			Template::setGlobal('system_email',         Settings::get('system_email'));
57
+			Template::setGlobal('system_url', Settings::get('system_url'));
58
+			Template::setGlobal('system_email', Settings::get('system_email'));
59 59
 
60
-			Template::setGlobal('install_path',         INSTALL_PATH);
60
+			Template::setGlobal('install_path', INSTALL_PATH);
61 61
 
62
-			Template::setGlobal('index_page',           (('' !== INSTALL_PATH) ? INSTALL_PATH : '/'));
62
+			Template::setGlobal('index_page', (('' !== INSTALL_PATH) ? INSTALL_PATH : '/'));
63 63
 
64
-			Template::setGlobal('current_year',         Date::getYear());
64
+			Template::setGlobal('current_year', Date::getYear());
65 65
 		}
66 66
 
67 67
 		/**
Please login to merge, or discard this 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
 			$phrases = array_merge(static::PHRASES, array_keys(Extend\Addons::getItems() ?? []));
34 34
 
35
-			foreach (array_unique($languages) as $path) foreach ($phrases as $name) {
35
+			foreach (array_unique($languages) as $path) {
36
+				foreach ($phrases as $name) {
36 37
 
37 38
 				Language::load($path . 'Phrases/' . $name . '.php');
38 39
 			}
40
+			}
39 41
 		}
40 42
 
41 43
 		/**
@@ -86,7 +88,9 @@  discard block
 block discarded – undo
86 88
 
87 89
 			# Set timezone
88 90
 
89
-			if (Auth::isLogged() && ('' !== ($timezone = Auth::get('timezone')))) date_default_timezone_set($timezone);
91
+			if (Auth::isLogged() && ('' !== ($timezone = Auth::get('timezone')))) {
92
+				date_default_timezone_set($timezone);
93
+			}
90 94
 
91 95
 			# Init utils
92 96
 
Please login to merge, or discard this patch.
www/engine/System/Classes/Frames/Site/View.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
 
23 23
 		private function getLayout(Template\Block $contents) : Template\Block {
24 24
 
25
-			$layout = View::get('Layouts/' . $this->layout);
25
+			$layout = View::get('Layouts/'.$this->layout);
26 26
 
27 27
 			# Set menu
28 28
 
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
 
79 79
 			$title = (SEO::get('title') ?: Language::get($this->title) ?: '');
80 80
 
81
-			$page->title = ((('' !== $title) ? ($title . ' | ') : '') . Settings::get('site_title'));
81
+			$page->title = ((('' !== $title) ? ($title.' | ') : '').Settings::get('site_title'));
82 82
 
83 83
 			# Set canonical
84 84
 
Please login to merge, or discard this patch.
Braces   +12 added lines, -4 removed lines patch added patch discarded remove patch
@@ -38,7 +38,9 @@  discard block
 block discarded – undo
38 38
 
39 39
 				$layout->getBlock('user')->name = Auth::get('name');
40 40
 
41
-				if (Auth::get('rank') === RANK_ADMINISTRATOR) $layout->getBlock('admin')->enable();
41
+				if (Auth::get('rank') === RANK_ADMINISTRATOR) {
42
+					$layout->getBlock('admin')->enable();
43
+				}
42 44
 			}
43 45
 
44 46
 			# Set title
@@ -82,7 +84,9 @@  discard block
 block discarded – undo
82 84
 
83 85
 			# Set canonical
84 86
 
85
-			if (false !== SEO::get('canonical')) $page->getBlock('canonical')->enable()->link = SEO::get('canonical');
87
+			if (false !== SEO::get('canonical')) {
88
+				$page->getBlock('canonical')->enable()->link = SEO::get('canonical');
89
+			}
86 90
 
87 91
 			# Set layout
88 92
 
@@ -90,9 +94,13 @@  discard block
 block discarded – undo
90 94
 
91 95
 			# Set global components
92 96
 
93
-			foreach (Variables::generate() as $name => $value) Template::setGlobal($name, $value);
97
+			foreach (Variables::generate() as $name => $value) {
98
+				Template::setGlobal($name, $value);
99
+			}
94 100
 
95
-			foreach (Widgets::generate() as $name => $block) Template::setWidget($name, $block);
101
+			foreach (Widgets::generate() as $name => $block) {
102
+				Template::setWidget($name, $block);
103
+			}
96 104
 
97 105
 			# ------------------------
98 106
 
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
@@ -17,13 +17,13 @@  discard block
 block discarded – undo
17 17
 
18 18
 		private static function parseContents(string $contents, Throwable $exc) : string {
19 19
 
20
-		   $contents = str_replace('$message$',             $exc->getMessage(),                 $contents);
20
+		   $contents = str_replace('$message$', $exc->getMessage(), $contents);
21 21
 
22
-		   $contents = str_replace('$file$',                $exc->getFile(),                    $contents);
22
+		   $contents = str_replace('$file$', $exc->getFile(), $contents);
23 23
 
24
-		   $contents = str_replace('$line$',                $exc->getLine(),                    $contents);
24
+		   $contents = str_replace('$line$', $exc->getLine(), $contents);
25 25
 
26
-		   $contents = str_replace('$trace$',               nl2br($exc->getTraceAsString()),    $contents);
26
+		   $contents = str_replace('$trace$', nl2br($exc->getTraceAsString()), $contents);
27 27
 
28 28
 		   # ------------------------
29 29
 
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
 
62 62
 			# Load template
63 63
 
64
-			$file_name = (DIR_TEMPLATES . 'Exception.ctp');
64
+			$file_name = (DIR_TEMPLATES.'Exception.ctp');
65 65
 
66 66
 			if (false === ($contents = @file_get_contents($file_name))) $output = nl2br($exc);
67 67
 
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
 
78 78
 			header('Pragma: no-cache');
79 79
 
80
-			header($_SERVER['SERVER_PROTOCOL'] . ' 500 Internal Server Error', true, 500);
80
+			header($_SERVER['SERVER_PROTOCOL'].' 500 Internal Server Error', true, 500);
81 81
 
82 82
 			header('Content-type: text/html; charset=UTF-8');
83 83
 
Please login to merge, or discard this patch.
Braces   +23 added lines, -9 removed lines patch added patch discarded remove patch
@@ -36,17 +36,29 @@  discard block
 block discarded – undo
36 36
 
37 37
 		public static function getIP() : string {
38 38
 
39
-			if (!empty($_SERVER['HTTP_CLIENT_IP']))         return $_SERVER['HTTP_CLIENT_IP'];
39
+			if (!empty($_SERVER['HTTP_CLIENT_IP'])) {
40
+				return $_SERVER['HTTP_CLIENT_IP'];
41
+			}
40 42
 
41
-			if (!empty($_SERVER['HTTP_X_FORWARDED_FOR']))   return $_SERVER['HTTP_X_FORWARDED_FOR'];
43
+			if (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
44
+				return $_SERVER['HTTP_X_FORWARDED_FOR'];
45
+			}
42 46
 
43
-			if (!empty($_SERVER['HTTP_X_FORWARDED']))       return $_SERVER['HTTP_X_FORWARDED'];
47
+			if (!empty($_SERVER['HTTP_X_FORWARDED'])) {
48
+				return $_SERVER['HTTP_X_FORWARDED'];
49
+			}
44 50
 
45
-			if (!empty($_SERVER['HTTP_FORWARDED_FOR']))     return $_SERVER['HTTP_FORWARDED_FOR'];
51
+			if (!empty($_SERVER['HTTP_FORWARDED_FOR'])) {
52
+				return $_SERVER['HTTP_FORWARDED_FOR'];
53
+			}
46 54
 
47
-			if (!empty($_SERVER['HTTP_FORWARDED']))         return $_SERVER['HTTP_FORWARDED'];
55
+			if (!empty($_SERVER['HTTP_FORWARDED'])) {
56
+				return $_SERVER['HTTP_FORWARDED'];
57
+			}
48 58
 
49
-			if (!empty($_SERVER['REMOTE_ADDR']))            return $_SERVER['REMOTE_ADDR'];
59
+			if (!empty($_SERVER['REMOTE_ADDR'])) {
60
+				return $_SERVER['REMOTE_ADDR'];
61
+			}
50 62
 
51 63
 			# ------------------------
52 64
 
@@ -63,9 +75,11 @@  discard block
 block discarded – undo
63 75
 
64 76
 			$file_name = (DIR_TEMPLATES . 'Exception.ctp');
65 77
 
66
-			if (false === ($contents = @file_get_contents($file_name))) $output = nl2br($exc);
67
-
68
-			else $output = self::parseContents($contents, $exc);
78
+			if (false === ($contents = @file_get_contents($file_name))) {
79
+				$output = nl2br($exc);
80
+			} else {
81
+				$output = self::parseContents($contents, $exc);
82
+			}
69 83
 
70 84
 			# Set headers
71 85
 
Please login to merge, or discard this patch.
www/engine/System/Includes/Constants.php 1 patch
Spacing   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -9,64 +9,64 @@
 block discarded – undo
9 9
 
10 10
 # Cadmium
11 11
 
12
-define('CADMIUM_NAME',                              'Cadmium CMS');
13
-define('CADMIUM_HOME',                              'http://cadmium-cms.com');
12
+define('CADMIUM_NAME', 'Cadmium CMS');
13
+define('CADMIUM_HOME', 'http://cadmium-cms.com');
14 14
 
15
-define('CADMIUM_VERSION',                           '0.4.7');
16
-define('CADMIUM_COPY',                              '2017');
15
+define('CADMIUM_VERSION', '0.4.7');
16
+define('CADMIUM_COPY', '2017');
17 17
 
18 18
 # Third-party
19 19
 
20
-define('JQUERY_VERSION',                            '3.2.1');
21
-define('SEMANTIC_UI_VERSION',                       '2.2.10');
22
-define('CKEDITOR_VERSION',                          '4.6.2');
23
-define('ACE_VERSION',                               '1.2.6');
20
+define('JQUERY_VERSION', '3.2.1');
21
+define('SEMANTIC_UI_VERSION', '2.2.10');
22
+define('CKEDITOR_VERSION', '4.6.2');
23
+define('ACE_VERSION', '1.2.6');
24 24
 
25 25
 # Sections
26 26
 
27
-define('SECTION_SITE',                              'site');
28
-define('SECTION_ADMIN',                             'admin');
27
+define('SECTION_SITE', 'site');
28
+define('SECTION_ADMIN', 'admin');
29 29
 
30 30
 # Access
31 31
 
32
-define('ACCESS_PUBLIC',                             0);
33
-define('ACCESS_REGISTERED',                         1);
34
-define('ACCESS_ADMINISTRATOR',                      2);
32
+define('ACCESS_PUBLIC', 0);
33
+define('ACCESS_REGISTERED', 1);
34
+define('ACCESS_ADMINISTRATOR', 2);
35 35
 
36 36
 # Frequency
37 37
 
38
-define('FREQUENCY_ALWAYS',                          'always');
39
-define('FREQUENCY_HOURLY',                          'hourly');
40
-define('FREQUENCY_DAILY',                           'daily');
41
-define('FREQUENCY_WEEKLY',                          'weekly');
42
-define('FREQUENCY_MONTHLY',                         'monthly');
43
-define('FREQUENCY_YEARLY',                          'yearly');
44
-define('FREQUENCY_NEVER',                           'never');
38
+define('FREQUENCY_ALWAYS', 'always');
39
+define('FREQUENCY_HOURLY', 'hourly');
40
+define('FREQUENCY_DAILY', 'daily');
41
+define('FREQUENCY_WEEKLY', 'weekly');
42
+define('FREQUENCY_MONTHLY', 'monthly');
43
+define('FREQUENCY_YEARLY', 'yearly');
44
+define('FREQUENCY_NEVER', 'never');
45 45
 
46 46
 # Rank
47 47
 
48
-define('RANK_GUEST',                                0);
49
-define('RANK_USER',                                 1);
50
-define('RANK_ADMINISTRATOR',                        2);
48
+define('RANK_GUEST', 0);
49
+define('RANK_USER', 1);
50
+define('RANK_ADMINISTRATOR', 2);
51 51
 
52 52
 # Sex
53 53
 
54
-define('SEX_NOT_SELECTED',                          0);
55
-define('SEX_MALE',                                  1);
56
-define('SEX_FEMALE',                                2);
54
+define('SEX_NOT_SELECTED', 0);
55
+define('SEX_MALE', 1);
56
+define('SEX_FEMALE', 2);
57 57
 
58 58
 # Status
59 59
 
60
-define('STATUS_ONLINE',                             0);
61
-define('STATUS_MAINTENANCE',                        1);
62
-define('STATUS_UPDATE',                             2);
60
+define('STATUS_ONLINE', 0);
61
+define('STATUS_MAINTENANCE', 1);
62
+define('STATUS_UPDATE', 2);
63 63
 
64 64
 # Target
65 65
 
66
-define('TARGET_SELF',                               0);
67
-define('TARGET_BLANK',                              1);
66
+define('TARGET_SELF', 0);
67
+define('TARGET_BLANK', 1);
68 68
 
69 69
 # Visibility
70 70
 
71
-define('VISIBILITY_DRAFT',                          0);
72
-define('VISIBILITY_PUBLISHED',                      1);
71
+define('VISIBILITY_DRAFT', 0);
72
+define('VISIBILITY_PUBLISHED', 1);
Please login to merge, or discard this patch.