@@ -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.8'); |
|
16 | -define('CADMIUM_COPY', '2017'); |
|
15 | +define('CADMIUM_VERSION', '0.4.8'); |
|
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); |
@@ -15,6 +15,6 @@ |
||
15 | 15 | |
16 | 16 | use Filemanager\Common\Templates; |
17 | 17 | |
18 | - protected $path_full = (DIR_SYSTEM_TEMPLATES . 'Site/'); |
|
18 | + protected $path_full = (DIR_SYSTEM_TEMPLATES.'Site/'); |
|
19 | 19 | } |
20 | 20 | } |
@@ -50,7 +50,7 @@ |
||
50 | 50 | |
51 | 51 | # Sort arrays |
52 | 52 | |
53 | - $sort = function (Entity $a, Entity $b) { |
|
53 | + $sort = function(Entity $a, Entity $b) { |
|
54 | 54 | |
55 | 55 | return strcmp(Str::toLower($a->getName()), Str::toLower($b->getName())); |
56 | 56 | }; |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | |
31 | 31 | protected function getValue(string $value) : string { |
32 | 32 | |
33 | - return ('\'' . addslashes($value) . '\''); |
|
33 | + return ('\''.addslashes($value).'\''); |
|
34 | 34 | } |
35 | 35 | |
36 | 36 | /** |
@@ -39,9 +39,9 @@ discard block |
||
39 | 39 | |
40 | 40 | protected function getRange(array $value) : string { |
41 | 41 | |
42 | - $parser = function ($value) { if (is_scalar($value)) return $this->getValue($value); }; |
|
42 | + $parser = function($value) { if (is_scalar($value)) return $this->getValue($value); }; |
|
43 | 43 | |
44 | - return ('(' . implode(', ', array_filter(array_map($parser, $value))) . ')'); |
|
44 | + return ('('.implode(', ', array_filter(array_map($parser, $value))).')'); |
|
45 | 45 | } |
46 | 46 | |
47 | 47 | /** |
@@ -50,21 +50,21 @@ discard block |
||
50 | 50 | |
51 | 51 | protected function getOperatable($value) { |
52 | 52 | |
53 | - if (is_scalar($value)) return ('= ' . $this->getValue($value)); |
|
53 | + if (is_scalar($value)) return ('= '.$this->getValue($value)); |
|
54 | 54 | |
55 | - if (is_array($value)) return ('IN ' . $this->getRange($value)); |
|
55 | + if (is_array($value)) return ('IN '.$this->getRange($value)); |
|
56 | 56 | |
57 | - if ($value instanceof Type\Not) return ('NOT ' . $this->getValue($value->get())); |
|
57 | + if ($value instanceof Type\Not) return ('NOT '.$this->getValue($value->get())); |
|
58 | 58 | |
59 | - if ($value instanceof Type\Like) return ('LIKE ' . $this->getValue($value->get())); |
|
59 | + if ($value instanceof Type\Like) return ('LIKE '.$this->getValue($value->get())); |
|
60 | 60 | |
61 | - if ($value instanceof Type\LessThan) return ('< ' . $value->get()); |
|
61 | + if ($value instanceof Type\LessThan) return ('< '.$value->get()); |
|
62 | 62 | |
63 | - if ($value instanceof Type\GreaterThan) return ('> ' . $value->get()); |
|
63 | + if ($value instanceof Type\GreaterThan) return ('> '.$value->get()); |
|
64 | 64 | |
65 | - if ($value instanceof Type\LessThanOrEqual) return ('<= ' . $value->get()); |
|
65 | + if ($value instanceof Type\LessThanOrEqual) return ('<= '.$value->get()); |
|
66 | 66 | |
67 | - if ($value instanceof Type\GreaterThanOrEqual) return ('>= ' . $value->get()); |
|
67 | + if ($value instanceof Type\GreaterThanOrEqual) return ('>= '.$value->get()); |
|
68 | 68 | |
69 | 69 | # ------------------------ |
70 | 70 |
@@ -39,7 +39,10 @@ discard block |
||
39 | 39 | |
40 | 40 | protected function getRange(array $value) : string { |
41 | 41 | |
42 | - $parser = function ($value) { if (is_scalar($value)) return $this->getValue($value); }; |
|
42 | + $parser = function ($value) { if (is_scalar($value)) { |
|
43 | + return $this->getValue($value); |
|
44 | + } |
|
45 | + }; |
|
43 | 46 | |
44 | 47 | return ('(' . implode(', ', array_filter(array_map($parser, $value))) . ')'); |
45 | 48 | } |
@@ -50,21 +53,37 @@ discard block |
||
50 | 53 | |
51 | 54 | protected function getOperatable($value) { |
52 | 55 | |
53 | - if (is_scalar($value)) return ('= ' . $this->getValue($value)); |
|
56 | + if (is_scalar($value)) { |
|
57 | + return ('= ' . $this->getValue($value)); |
|
58 | + } |
|
54 | 59 | |
55 | - if (is_array($value)) return ('IN ' . $this->getRange($value)); |
|
60 | + if (is_array($value)) { |
|
61 | + return ('IN ' . $this->getRange($value)); |
|
62 | + } |
|
56 | 63 | |
57 | - if ($value instanceof Type\Not) return ('NOT ' . $this->getValue($value->get())); |
|
64 | + if ($value instanceof Type\Not) { |
|
65 | + return ('NOT ' . $this->getValue($value->get())); |
|
66 | + } |
|
58 | 67 | |
59 | - if ($value instanceof Type\Like) return ('LIKE ' . $this->getValue($value->get())); |
|
68 | + if ($value instanceof Type\Like) { |
|
69 | + return ('LIKE ' . $this->getValue($value->get())); |
|
70 | + } |
|
60 | 71 | |
61 | - if ($value instanceof Type\LessThan) return ('< ' . $value->get()); |
|
72 | + if ($value instanceof Type\LessThan) { |
|
73 | + return ('< ' . $value->get()); |
|
74 | + } |
|
62 | 75 | |
63 | - if ($value instanceof Type\GreaterThan) return ('> ' . $value->get()); |
|
76 | + if ($value instanceof Type\GreaterThan) { |
|
77 | + return ('> ' . $value->get()); |
|
78 | + } |
|
64 | 79 | |
65 | - if ($value instanceof Type\LessThanOrEqual) return ('<= ' . $value->get()); |
|
80 | + if ($value instanceof Type\LessThanOrEqual) { |
|
81 | + return ('<= ' . $value->get()); |
|
82 | + } |
|
66 | 83 | |
67 | - if ($value instanceof Type\GreaterThanOrEqual) return ('>= ' . $value->get()); |
|
84 | + if ($value instanceof Type\GreaterThanOrEqual) { |
|
85 | + return ('>= ' . $value->get()); |
|
86 | + } |
|
68 | 87 | |
69 | 88 | # ------------------------ |
70 | 89 | |
@@ -86,7 +105,9 @@ discard block |
||
86 | 105 | |
87 | 106 | protected function getString($source = null, string $pattern = '', string $separator = '') : string { |
88 | 107 | |
89 | - if (!is_array($source)) return (is_scalar($source) ? strval($source) : ''); |
|
108 | + if (!is_array($source)) { |
|
109 | + return (is_scalar($source) ? strval($source) : ''); |
|
110 | + } |
|
90 | 111 | |
91 | 112 | $regexs = ['key' => '/\^([a-z]+)/', 'value' => '/\$([a-z]+)/']; $matches = ['key' => [], 'value' => []]; |
92 | 113 | |
@@ -98,7 +119,9 @@ discard block |
||
98 | 119 | |
99 | 120 | # Parse pattern |
100 | 121 | |
101 | - foreach ($regexs as $name => $regex) preg_match($regex, $pattern, $matches[$name]); |
|
122 | + foreach ($regexs as $name => $regex) { |
|
123 | + preg_match($regex, $pattern, $matches[$name]); |
|
124 | + } |
|
102 | 125 | |
103 | 126 | # Process replacements |
104 | 127 | |
@@ -106,9 +129,12 @@ discard block |
||
106 | 129 | |
107 | 130 | $output[$count] = $pattern; $item = &$output[$count++]; |
108 | 131 | |
109 | - foreach ($matches as $name => $match) if (isset($match[1]) && isset($parsers[$match[1]])) { |
|
132 | + foreach ($matches as $name => $match) { |
|
133 | + if (isset($match[1]) && isset($parsers[$match[1]])) { |
|
110 | 134 | |
111 | - try { $replace = [$this, $parsers[$match[1]]]($$name); } catch (\TypeError $e) { $replace = ''; } |
|
135 | + try { $replace = [$this, $parsers[$match[1]]]($$name); |
|
136 | + } |
|
137 | + } catch (\TypeError $e) { $replace = ''; } |
|
112 | 138 | |
113 | 139 | $item = str_replace($match[0], $replace, $item); |
114 | 140 | } |