@@ -16,9 +16,11 @@ discard block |
||
16 | 16 | |
17 | 17 | # Set breadcrumbs |
18 | 18 | |
19 | - if (count($this->path) <= 1) $contents->block('breadcrumbs')->disable(); |
|
20 | - |
|
21 | - else $contents->block('breadcrumbs')->path = $this->path; |
|
19 | + if (count($this->path) <= 1) { |
|
20 | + $contents->block('breadcrumbs')->disable(); |
|
21 | + } else { |
|
22 | + $contents->block('breadcrumbs')->path = $this->path; |
|
23 | + } |
|
22 | 24 | |
23 | 25 | # Set contents |
24 | 26 | |
@@ -41,19 +43,31 @@ discard block |
||
41 | 43 | |
42 | 44 | $slug = implode('/', $this->url->path()); |
43 | 45 | |
44 | - if ('' !== $slug) $this->page->initBySlug($slug); else $this->page->init(1); |
|
46 | + if ('' !== $slug) { |
|
47 | + $this->page->initBySlug($slug); |
|
48 | + } else { |
|
49 | + $this->page->init(1); |
|
50 | + } |
|
45 | 51 | |
46 | 52 | # Display error if not found |
47 | 53 | |
48 | - if (0 === $this->page->id) return false; |
|
54 | + if (0 === $this->page->id) { |
|
55 | + return false; |
|
56 | + } |
|
49 | 57 | |
50 | 58 | # Get path |
51 | 59 | |
52 | - if (false !== ($path = $this->page->path())) $this->path = $path; |
|
60 | + if (false !== ($path = $this->page->path())) { |
|
61 | + $this->path = $path; |
|
62 | + } |
|
53 | 63 | |
54 | 64 | # Set data |
55 | 65 | |
56 | - if ($this->page->id !== 1) $this->title = $this->page->title; else $this->layout = 'Index'; |
|
66 | + if ($this->page->id !== 1) { |
|
67 | + $this->title = $this->page->title; |
|
68 | + } else { |
|
69 | + $this->layout = 'Index'; |
|
70 | + } |
|
57 | 71 | |
58 | 72 | $this->description = $this->page->description; |
59 | 73 | $this->keywords = $this->page->keywords; |
@@ -2,7 +2,9 @@ |
||
2 | 2 | |
3 | 3 | namespace Modules\Entitizer\Form { |
4 | 4 | |
5 | - use Modules\Entitizer, Utils\Form, Utils\Range; |
|
5 | + use Modules\Entitizer; |
|
6 | + use Utils\Form; |
|
7 | + use Utils\Range; |
|
6 | 8 | |
7 | 9 | class Page extends Form { |
8 | 10 |
@@ -14,19 +14,19 @@ |
||
14 | 14 | |
15 | 15 | # Add params |
16 | 16 | |
17 | - $this->params->textual ('code', true, 40, true, ''); |
|
18 | - $this->params->textual ('ip', true, 255, false, ''); |
|
19 | - $this->params->integer ('time', false, 10, true, 0); |
|
17 | + $this->params->textual('code', true, 40, true, ''); |
|
18 | + $this->params->textual('ip', true, 255, false, ''); |
|
19 | + $this->params->integer('time', false, 10, true, 0); |
|
20 | 20 | |
21 | 21 | # Add indexes |
22 | 22 | |
23 | - $this->indexes->add ('code', 'UNIQUE'); |
|
24 | - $this->indexes->add ('ip'); |
|
25 | - $this->indexes->add ('time'); |
|
23 | + $this->indexes->add('code', 'UNIQUE'); |
|
24 | + $this->indexes->add('ip'); |
|
25 | + $this->indexes->add('time'); |
|
26 | 26 | |
27 | 27 | # Add foreign keys |
28 | 28 | |
29 | - $this->foreigns->add ('id', TABLE_USERS, 'id', 'CASCADE', 'RESTRICT'); |
|
29 | + $this->foreigns->add('id', TABLE_USERS, 'id', 'CASCADE', 'RESTRICT'); |
|
30 | 30 | } |
31 | 31 | } |
32 | 32 | } |
@@ -10,7 +10,9 @@ discard block |
||
10 | 10 | |
11 | 11 | public function add(string $name, $default, callable $handler) { |
12 | 12 | |
13 | - if ('' === $name) return; |
|
13 | + if ('' === $name) { |
|
14 | + return; |
|
15 | + } |
|
14 | 16 | |
15 | 17 | $this->config[$name] = $handler; $this->values[$name] = null; |
16 | 18 | |
@@ -23,11 +25,11 @@ discard block |
||
23 | 25 | |
24 | 26 | foreach ($data as $name => $value) { |
25 | 27 | |
26 | - if (!isset($this->config[$name])) continue; |
|
27 | - |
|
28 | - try { $this->values[$name] = $this->config[$name]($value); } |
|
28 | + if (!isset($this->config[$name])) { |
|
29 | + continue; |
|
30 | + } |
|
29 | 31 | |
30 | - catch (\TypeError $e) { /* Ignore setting value of illegal type */ } |
|
32 | + try { $this->values[$name] = $this->config[$name]($value); } catch (\TypeError $e) { /* Ignore setting value of illegal type */ } |
|
31 | 33 | } |
32 | 34 | } |
33 | 35 | |
@@ -39,11 +41,11 @@ discard block |
||
39 | 41 | |
40 | 42 | foreach ($this->config as $name => $handler) { |
41 | 43 | |
42 | - if (!($isset = isset($data[$name])) && !$process_all) continue; |
|
44 | + if (!($isset = isset($data[$name])) && !$process_all) { |
|
45 | + continue; |
|
46 | + } |
|
43 | 47 | |
44 | - try { $cast[$name] = ($isset ? $handler($data[$name]) : $this->values[$name]); } |
|
45 | - |
|
46 | - catch (\TypeError $e) { $cast[$name] = $this->values[$name]; } |
|
48 | + try { $cast[$name] = ($isset ? $handler($data[$name]) : $this->values[$name]); } catch (\TypeError $e) { $cast[$name] = $this->values[$name]; } |
|
47 | 49 | } |
48 | 50 | |
49 | 51 | # ------------------------ |
@@ -55,7 +57,9 @@ discard block |
||
55 | 57 | |
56 | 58 | public function get(string $name = null) { |
57 | 59 | |
58 | - if (null === $name) return $this->values; |
|
60 | + if (null === $name) { |
|
61 | + return $this->values; |
|
62 | + } |
|
59 | 63 | |
60 | 64 | return ($this->values[$name] ?? null); |
61 | 65 | } |
@@ -2,68 +2,68 @@ |
||
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.3.0'); |
|
9 | -define('CADMIUM_COPY', '2016'); |
|
8 | +define('CADMIUM_VERSION', '0.3.0'); |
|
9 | +define('CADMIUM_COPY', '2016'); |
|
10 | 10 | |
11 | 11 | # External |
12 | 12 | |
13 | -define('JQUERY_VERSION', '2.2.3'); |
|
14 | -define('SEMANTIC_UI_VERSION', '2.1.8'); |
|
15 | -define('CKEDITOR_VERSION', '4.5.8'); |
|
13 | +define('JQUERY_VERSION', '2.2.3'); |
|
14 | +define('SEMANTIC_UI_VERSION', '2.1.8'); |
|
15 | +define('CKEDITOR_VERSION', '4.5.8'); |
|
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); |
@@ -2,7 +2,8 @@ |
||
2 | 2 | |
3 | 3 | namespace Modules\Entitizer\Utils { |
4 | 4 | |
5 | - use Modules\Entitizer, Config; |
|
5 | + use Modules\Entitizer; |
|
6 | + use Config; |
|
6 | 7 | |
7 | 8 | abstract class View { |
8 | 9 |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | |
33 | 33 | $selection = []; |
34 | 34 | |
35 | - foreach ($this->definition->paramsSecure() as $field) $selection[] = ('ent.' . $field); |
|
35 | + foreach ($this->definition->paramsSecure() as $field) $selection[] = ('ent.'.$field); |
|
36 | 36 | |
37 | 37 | # ------------------------ |
38 | 38 | |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | |
46 | 46 | $order_by = []; |
47 | 47 | |
48 | - foreach ($this->castOrderBy($data) as $field => $direction) $order_by[] = ('ent.' . $field . ' ' . $direction); |
|
48 | + foreach ($this->castOrderBy($data) as $field => $direction) $order_by[] = ('ent.'.$field.' '.$direction); |
|
49 | 49 | |
50 | 50 | # ------------------------ |
51 | 51 |
@@ -16,7 +16,9 @@ discard block |
||
16 | 16 | |
17 | 17 | foreach ($data as $field => $direction) { |
18 | 18 | |
19 | - if (false === ($param = $this->definition->param($field))) continue; |
|
19 | + if (false === ($param = $this->definition->param($field))) { |
|
20 | + continue; |
|
21 | + } |
|
20 | 22 | |
21 | 23 | $order_by[$param->name] = ((strtoupper($direction) !== 'DESC') ? 'ASC' : 'DESC'); |
22 | 24 | } |
@@ -32,7 +34,9 @@ discard block |
||
32 | 34 | |
33 | 35 | $selection = []; |
34 | 36 | |
35 | - foreach ($this->definition->paramsSecure() as $field) $selection[] = ('ent.' . $field); |
|
37 | + foreach ($this->definition->paramsSecure() as $field) { |
|
38 | + $selection[] = ('ent.' . $field); |
|
39 | + } |
|
36 | 40 | |
37 | 41 | # ------------------------ |
38 | 42 | |
@@ -45,7 +49,9 @@ discard block |
||
45 | 49 | |
46 | 50 | $order_by = []; |
47 | 51 | |
48 | - foreach ($this->castOrderBy($data) as $field => $direction) $order_by[] = ('ent.' . $field . ' ' . $direction); |
|
52 | + foreach ($this->castOrderBy($data) as $field => $direction) { |
|
53 | + $order_by[] = ('ent.' . $field . ' ' . $direction); |
|
54 | + } |
|
49 | 55 | |
50 | 56 | # ------------------------ |
51 | 57 |
@@ -12,7 +12,9 @@ discard block |
||
12 | 12 | |
13 | 13 | $selection = 'MAX(time_modified) as last_modified'; |
14 | 14 | |
15 | - if (!(DB::select(TABLE_PAGES, $selection) && (DB::last()->rows === 1))) return 0; |
|
15 | + if (!(DB::select(TABLE_PAGES, $selection) && (DB::last()->rows === 1))) { |
|
16 | + return 0; |
|
17 | + } |
|
16 | 18 | |
17 | 19 | # ------------------------ |
18 | 20 | |
@@ -27,11 +29,15 @@ discard block |
||
27 | 29 | |
28 | 30 | $condition = ['visibility' => VISIBILITY_PUBLISHED, 'access' => ACCESS_PUBLIC, 'locked' => 0]; |
29 | 31 | |
30 | - if (!(DB::select(TABLE_PAGES, $selection, $condition, 'slug') && DB::last()->status)) return; |
|
32 | + if (!(DB::select(TABLE_PAGES, $selection, $condition, 'slug') && DB::last()->status)) { |
|
33 | + return; |
|
34 | + } |
|
31 | 35 | |
32 | 36 | # ------------------------ |
33 | 37 | |
34 | - while (null !== ($page = DB::last()->row())) yield Entitizer::dataset(TABLE_PAGES, $page); |
|
38 | + while (null !== ($page = DB::last()->row())) { |
|
39 | + yield Entitizer::dataset(TABLE_PAGES, $page); |
|
40 | + } |
|
35 | 41 | } |
36 | 42 | |
37 | 43 | # Handle request |
@@ -44,7 +50,9 @@ discard block |
||
44 | 50 | |
45 | 51 | # Get last modification time |
46 | 52 | |
47 | - if ($sitemap->load($this->getLastModified())) return $sitemap; |
|
53 | + if ($sitemap->load($this->getLastModified())) { |
|
54 | + return $sitemap; |
|
55 | + } |
|
48 | 56 | |
49 | 57 | # Fill sitemap |
50 | 58 |
@@ -12,23 +12,23 @@ |
||
12 | 12 | |
13 | 13 | protected function init() { |
14 | 14 | |
15 | - $this->addHandler('active', function (array $data) { |
|
15 | + $this->addHandler('active', function(array $data) { |
|
16 | 16 | |
17 | 17 | return (($data['visibility'] === VISIBILITY_PUBLISHED) && !$data['locked']); |
18 | 18 | }); |
19 | 19 | |
20 | - $this->addHandler('link', function (array $data) { |
|
20 | + $this->addHandler('link', function(array $data) { |
|
21 | 21 | |
22 | 22 | if ('' === $data['slug']) return ''; |
23 | 23 | |
24 | - return (INSTALL_PATH . '/' . $data['slug']); |
|
24 | + return (INSTALL_PATH.'/'.$data['slug']); |
|
25 | 25 | }); |
26 | 26 | |
27 | - $this->addHandler('canonical', function (array $data) { |
|
27 | + $this->addHandler('canonical', function(array $data) { |
|
28 | 28 | |
29 | 29 | if ('' === $data['slug']) return ''; |
30 | 30 | |
31 | - return (Settings::get('system_url') . (($data['id'] !== 1) ? ('/' . $data['slug']) : '')); |
|
31 | + return (Settings::get('system_url').(($data['id'] !== 1) ? ('/'.$data['slug']) : '')); |
|
32 | 32 | }); |
33 | 33 | } |
34 | 34 | } |
@@ -19,14 +19,18 @@ |
||
19 | 19 | |
20 | 20 | $this->addHandler('link', function (array $data) { |
21 | 21 | |
22 | - if ('' === $data['slug']) return ''; |
|
22 | + if ('' === $data['slug']) { |
|
23 | + return ''; |
|
24 | + } |
|
23 | 25 | |
24 | 26 | return (INSTALL_PATH . '/' . $data['slug']); |
25 | 27 | }); |
26 | 28 | |
27 | 29 | $this->addHandler('canonical', function (array $data) { |
28 | 30 | |
29 | - if ('' === $data['slug']) return ''; |
|
31 | + if ('' === $data['slug']) { |
|
32 | + return ''; |
|
33 | + } |
|
30 | 34 | |
31 | 35 | return (Settings::get('system_url') . (($data['id'] !== 1) ? ('/' . $data['slug']) : '')); |
32 | 36 | }); |
@@ -12,9 +12,9 @@ |
||
12 | 12 | |
13 | 13 | protected function init() { |
14 | 14 | |
15 | - $this->addHandler('full_name', function (array $data) { |
|
15 | + $this->addHandler('full_name', function(array $data) { |
|
16 | 16 | |
17 | - return trim($data['first_name'] . ' ' . $data['last_name']); |
|
17 | + return trim($data['first_name'].' '.$data['last_name']); |
|
18 | 18 | }); |
19 | 19 | } |
20 | 20 | } |