@@ -22,7 +22,7 @@ discard block |
||
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 |
||
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 |
@@ -38,7 +38,9 @@ discard block |
||
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 |
||
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 |
||
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 |
@@ -17,13 +17,13 @@ discard block |
||
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 |
||
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 |
||
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 |
@@ -36,17 +36,29 @@ discard block |
||
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 |
||
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 |
@@ -9,64 +9,64 @@ |
||
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); |