@@ -46,9 +46,9 @@ discard block |
||
46 | 46 | |
47 | 47 | for ($id = 2; $id <= 4; $id++) $pages[] = ['id' => $id, 'visibility' => VISIBILITY_PUBLISHED, |
48 | 48 | |
49 | - 'locked' => false, 'slug' => ('page-' . ($id - 1)), 'name' => ('page-' . ($id - 1)), |
|
49 | + 'locked' => false, 'slug' => ('page-'.($id - 1)), 'name' => ('page-'.($id - 1)), |
|
50 | 50 | |
51 | - 'title' => (Language::get('INSTALL_PAGE_DEMO_TITLE') . ' ' . ($id - 1)), |
|
51 | + 'title' => (Language::get('INSTALL_PAGE_DEMO_TITLE').' '.($id - 1)), |
|
52 | 52 | |
53 | 53 | 'contents' => Template::block(Language::get('INSTALL_PAGE_DEMO_CONTENTS'))->contents(), |
54 | 54 | |
@@ -81,9 +81,9 @@ discard block |
||
81 | 81 | |
82 | 82 | for ($id = 1; $id <= 3; $id++) $menu[] = [ |
83 | 83 | |
84 | - 'id' => $id, 'active' => true, 'position' => ($id - 1), 'slug' => ('page-' . $id), |
|
84 | + 'id' => $id, 'active' => true, 'position' => ($id - 1), 'slug' => ('page-'.$id), |
|
85 | 85 | |
86 | - 'text' => (Language::get('INSTALL_PAGE_DEMO_TITLE') . ' ' . $id)]; |
|
86 | + 'text' => (Language::get('INSTALL_PAGE_DEMO_TITLE').' '.$id)]; |
|
87 | 87 | |
88 | 88 | # Process insertion |
89 | 89 |
@@ -30,7 +30,11 @@ discard block |
||
30 | 30 | |
31 | 31 | $count = Informer::countEntries(TABLE_PAGES, true); |
32 | 32 | |
33 | - if (false === $count) return false; else if ($count > 0) return true; |
|
33 | + if (false === $count) { |
|
34 | + return false; |
|
35 | + } else if ($count > 0) { |
|
36 | + return true; |
|
37 | + } |
|
34 | 38 | |
35 | 39 | # Process dataset |
36 | 40 | |
@@ -44,7 +48,8 @@ discard block |
||
44 | 48 | |
45 | 49 | 'time_created' => REQUEST_TIME, 'time_modified' => REQUEST_TIME]]; |
46 | 50 | |
47 | - for ($id = 2; $id <= 4; $id++) $pages[] = ['id' => $id, 'visibility' => VISIBILITY_PUBLISHED, |
|
51 | + for ($id = 2; $id <= 4; $id++) { |
|
52 | + $pages[] = ['id' => $id, 'visibility' => VISIBILITY_PUBLISHED, |
|
48 | 53 | |
49 | 54 | 'locked' => false, 'slug' => ('page-' . ($id - 1)), 'name' => ('page-' . ($id - 1)), |
50 | 55 | |
@@ -53,10 +58,13 @@ discard block |
||
53 | 58 | 'contents' => Template::block(Language::get('INSTALL_PAGE_DEMO_CONTENTS'))->contents(), |
54 | 59 | |
55 | 60 | 'time_created' => REQUEST_TIME, 'time_modified' => REQUEST_TIME]; |
61 | + } |
|
56 | 62 | |
57 | 63 | # Process insertion |
58 | 64 | |
59 | - if (!(DB::insert(TABLE_PAGES, $pages, true) && DB::last()->status)) return false; |
|
65 | + if (!(DB::insert(TABLE_PAGES, $pages, true) && DB::last()->status)) { |
|
66 | + return false; |
|
67 | + } |
|
60 | 68 | |
61 | 69 | self::fillRelationsTable(TABLE_PAGES_RELATIONS, 4); |
62 | 70 | |
@@ -73,21 +81,29 @@ discard block |
||
73 | 81 | |
74 | 82 | $count = Informer::countEntries(TABLE_MENU, true); |
75 | 83 | |
76 | - if (false === $count) return false; else if ($count > 0) return true; |
|
84 | + if (false === $count) { |
|
85 | + return false; |
|
86 | + } else if ($count > 0) { |
|
87 | + return true; |
|
88 | + } |
|
77 | 89 | |
78 | 90 | # Process dataset |
79 | 91 | |
80 | 92 | $menu = []; |
81 | 93 | |
82 | - for ($id = 1; $id <= 3; $id++) $menu[] = [ |
|
94 | + for ($id = 1; $id <= 3; $id++) { |
|
95 | + $menu[] = [ |
|
83 | 96 | |
84 | 97 | 'id' => $id, 'active' => true, 'position' => ($id - 1), 'slug' => ('page-' . $id), |
85 | 98 | |
86 | 99 | 'text' => (Language::get('INSTALL_PAGE_DEMO_TITLE') . ' ' . $id)]; |
100 | + } |
|
87 | 101 | |
88 | 102 | # Process insertion |
89 | 103 | |
90 | - if (!(DB::insert(TABLE_MENU, $menu, true) && DB::last()->status)) return false; |
|
104 | + if (!(DB::insert(TABLE_MENU, $menu, true) && DB::last()->status)) { |
|
105 | + return false; |
|
106 | + } |
|
91 | 107 | |
92 | 108 | self::fillRelationsTable(TABLE_MENU_RELATIONS, 3); |
93 | 109 | |
@@ -116,7 +132,9 @@ discard block |
||
116 | 132 | |
117 | 133 | $definitions[] = Entitizer::definition(TABLE_USERS_SESSIONS); |
118 | 134 | |
119 | - foreach ($definitions as $definition) if (!$definition->createTable()) return false; |
|
135 | + foreach ($definitions as $definition) { |
|
136 | + if (!$definition->createTable()) return false; |
|
137 | + } |
|
120 | 138 | |
121 | 139 | # ------------------------ |
122 | 140 |
@@ -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; |
@@ -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::create(TABLE_PAGES, $page); |
|
38 | + while (null !== ($page = DB::last()->row())) { |
|
39 | + yield Entitizer::create(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 |
@@ -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 |
@@ -12,7 +12,7 @@ |
||
12 | 12 | |
13 | 13 | protected function init() { |
14 | 14 | |
15 | - $this->config->add('active', false, function (bool $active) { |
|
15 | + $this->config->add('active', false, function(bool $active) { |
|
16 | 16 | |
17 | 17 | return ($active ? "ent.active = 1" : ''); |
18 | 18 | }); |
@@ -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 | } |
@@ -19,7 +19,9 @@ |
||
19 | 19 | |
20 | 20 | public function add(string $name, string $type = null) { |
21 | 21 | |
22 | - if (!isset($this->definition->params()[$name]) || isset($this->list[$name])) return; |
|
22 | + if (!isset($this->definition->params()[$name]) || isset($this->list[$name])) { |
|
23 | + return; |
|
24 | + } |
|
23 | 25 | |
24 | 26 | $this->list[$name] = new Definition\Item\Index($name, $type); |
25 | 27 | } |
@@ -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); |