@@ -45,7 +45,9 @@ discard block |
||
45 | 45 | |
46 | 46 | private function processSelector(Template\Block $selector) { |
47 | 47 | |
48 | - if ($this->create) return $selector->disable(); |
|
48 | + if ($this->create) { |
|
49 | + return $selector->disable(); |
|
50 | + } |
|
49 | 51 | |
50 | 52 | $selector->parent_id = $this->entity->parent_id; |
51 | 53 | |
@@ -68,25 +70,33 @@ discard block |
||
68 | 70 | |
69 | 71 | # Set path / title |
70 | 72 | |
71 | - if (static::$nesting) $contents->path = $this->path; |
|
72 | - |
|
73 | - else $contents->title = ($this->create ? Language::get(static::$naming_new) : $this->entity->get(static::$naming)); |
|
73 | + if (static::$nesting) { |
|
74 | + $contents->path = $this->path; |
|
75 | + } else { |
|
76 | + $contents->title = ($this->create ? Language::get(static::$naming_new) : $this->entity->get(static::$naming)); |
|
77 | + } |
|
74 | 78 | |
75 | 79 | # Process parent block |
76 | 80 | |
77 | - if (static::$nesting) $this->processParent($contents->getBlock('parent')); |
|
81 | + if (static::$nesting) { |
|
82 | + $this->processParent($contents->getBlock('parent')); |
|
83 | + } |
|
78 | 84 | |
79 | 85 | # Set link |
80 | 86 | |
81 | 87 | $link = (INSTALL_PATH . static::$link . '/'); |
82 | 88 | |
83 | - if (static::$nesting) $contents->link = ($link . ($this->create ? 'create' : 'edit') . '?id=' . $this->parent->id); |
|
84 | - |
|
85 | - else $contents->link = ($link . ($this->create ? 'create' : ('edit?id=' . $this->entity->id))); |
|
89 | + if (static::$nesting) { |
|
90 | + $contents->link = ($link . ($this->create ? 'create' : 'edit') . '?id=' . $this->parent->id); |
|
91 | + } else { |
|
92 | + $contents->link = ($link . ($this->create ? 'create' : ('edit?id=' . $this->entity->id))); |
|
93 | + } |
|
86 | 94 | |
87 | 95 | # Process selector block |
88 | 96 | |
89 | - if (static::$nesting) $this->processSelector($contents->getBlock('selector')); |
|
97 | + if (static::$nesting) { |
|
98 | + $this->processSelector($contents->getBlock('selector')); |
|
99 | + } |
|
90 | 100 | |
91 | 101 | # Implement form |
92 | 102 | |
@@ -119,11 +129,15 @@ discard block |
||
119 | 129 | |
120 | 130 | $parent_id = Number::forceInt(Request::post('parent_id')); |
121 | 131 | |
122 | - if (!$this->entity->move($parent_id)) return $ajax->setError(Language::get(static::$message_error_move)); |
|
132 | + if (!$this->entity->move($parent_id)) { |
|
133 | + return $ajax->setError(Language::get(static::$message_error_move)); |
|
134 | + } |
|
123 | 135 | |
124 | 136 | } else if (Request::post('action') === 'remove') { |
125 | 137 | |
126 | - if (!$this->entity->remove()) return $ajax->setError(Language::get(static::$message_error_remove)); |
|
138 | + if (!$this->entity->remove()) { |
|
139 | + return $ajax->setError(Language::get(static::$message_error_remove)); |
|
140 | + } |
|
127 | 141 | } |
128 | 142 | |
129 | 143 | # ------------------------ |
@@ -135,7 +149,9 @@ discard block |
||
135 | 149 | |
136 | 150 | protected function handle(bool $ajax = false) { |
137 | 151 | |
138 | - if (!$this->create && $ajax) return $this->handleAjax(); |
|
152 | + if (!$this->create && $ajax) { |
|
153 | + return $this->handleAjax(); |
|
154 | + } |
|
139 | 155 | |
140 | 156 | # Create entity |
141 | 157 | |
@@ -143,7 +159,9 @@ discard block |
||
143 | 159 | |
144 | 160 | $this->entity = Entitizer::get(static::$table, (!$this->create ? $id : 0)); |
145 | 161 | |
146 | - if (!$this->create && (0 === $this->entity->id)) return Request::redirect(INSTALL_PATH . static::$link); |
|
162 | + if (!$this->create && (0 === $this->entity->id)) { |
|
163 | + return Request::redirect(INSTALL_PATH . static::$link); |
|
164 | + } |
|
147 | 165 | |
148 | 166 | # Create parent entity |
149 | 167 | |
@@ -151,7 +169,9 @@ discard block |
||
151 | 169 | |
152 | 170 | # Get path |
153 | 171 | |
154 | - if (false !== ($path = $this->parent->path())) $this->path = $path; |
|
172 | + if (false !== ($path = $this->parent->path())) { |
|
173 | + $this->path = $path; |
|
174 | + } |
|
155 | 175 | |
156 | 176 | # Create form |
157 | 177 | |
@@ -161,7 +181,9 @@ discard block |
||
161 | 181 | |
162 | 182 | if ($this->form->handle(new static::$controller($this->entity), true)) { |
163 | 183 | |
164 | - if ($this->create && (0 !== $this->parent->id)) $this->entity->move($this->parent->id); |
|
184 | + if ($this->create && (0 !== $this->parent->id)) { |
|
185 | + $this->entity->move($this->parent->id); |
|
186 | + } |
|
165 | 187 | |
166 | 188 | Request::redirect(INSTALL_PATH . static::$link . '/edit?id=' . $this->entity->id . '&submitted'); |
167 | 189 | } |
@@ -78,11 +78,11 @@ discard block |
||
78 | 78 | |
79 | 79 | # Set link |
80 | 80 | |
81 | - $link = (INSTALL_PATH . static::$link . '/'); |
|
81 | + $link = (INSTALL_PATH.static::$link.'/'); |
|
82 | 82 | |
83 | - if (static::$nesting) $contents->link = ($link . ($this->create ? 'create' : 'edit') . '?id=' . $this->parent->id); |
|
83 | + if (static::$nesting) $contents->link = ($link.($this->create ? 'create' : 'edit').'?id='.$this->parent->id); |
|
84 | 84 | |
85 | - else $contents->link = ($link . ($this->create ? 'create' : ('edit?id=' . $this->entity->id))); |
|
85 | + else $contents->link = ($link.($this->create ? 'create' : ('edit?id='.$this->entity->id))); |
|
86 | 86 | |
87 | 87 | # Process selector block |
88 | 88 | |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | |
144 | 144 | $this->entity = Entitizer::get(static::$table, (!$this->create ? $id : 0)); |
145 | 145 | |
146 | - if (!$this->create && (0 === $this->entity->id)) return Request::redirect(INSTALL_PATH . static::$link); |
|
146 | + if (!$this->create && (0 === $this->entity->id)) return Request::redirect(INSTALL_PATH.static::$link); |
|
147 | 147 | |
148 | 148 | # Create parent entity |
149 | 149 | |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | |
164 | 164 | if ($this->create && (0 !== $this->parent->id)) $this->entity->move($this->parent->id); |
165 | 165 | |
166 | - Request::redirect(INSTALL_PATH . static::$link . '/edit?id=' . $this->entity->id . '&submitted'); |
|
166 | + Request::redirect(INSTALL_PATH.static::$link.'/edit?id='.$this->entity->id.'&submitted'); |
|
167 | 167 | } |
168 | 168 | |
169 | 169 | # Display success message |
@@ -14,7 +14,9 @@ |
||
14 | 14 | |
15 | 15 | DB::select(TABLE_VARIABLES, ['name', 'value'], null, ['name' => 'ASC']); |
16 | 16 | |
17 | - if (!(DB::getLast() && DB::getLast()->status)) return; |
|
17 | + if (!(DB::getLast() && DB::getLast()->status)) { |
|
18 | + return; |
|
19 | + } |
|
18 | 20 | |
19 | 21 | # Process results |
20 | 22 |
@@ -12,11 +12,15 @@ |
||
12 | 12 | |
13 | 13 | # Process selection |
14 | 14 | |
15 | - if (0 === count($name = array_keys(Template::getWidgets()))) return; |
|
15 | + if (0 === count($name = array_keys(Template::getWidgets()))) { |
|
16 | + return; |
|
17 | + } |
|
16 | 18 | |
17 | 19 | DB::select(TABLE_WIDGETS, ['name', 'contents'], ['active' => 1, 'name' => $name], ['name' => 'ASC']); |
18 | 20 | |
19 | - if (!(DB::getLast() && DB::getLast()->status)) return; |
|
21 | + if (!(DB::getLast() && DB::getLast()->status)) { |
|
22 | + return; |
|
23 | + } |
|
20 | 24 | |
21 | 25 | # Process results |
22 | 26 |
@@ -71,7 +71,7 @@ |
||
71 | 71 | |
72 | 72 | public static function robots() { |
73 | 73 | |
74 | - return ((self::robotsIndex() ? 'INDEX' : 'NOINDEX') . ',' . (self::robotsFollow() ? 'FOLLOW' : 'NOFOLLOW')); |
|
74 | + return ((self::robotsIndex() ? 'INDEX' : 'NOINDEX').','.(self::robotsFollow() ? 'FOLLOW' : 'NOFOLLOW')); |
|
75 | 75 | } |
76 | 76 | } |
77 | 77 | } |
@@ -17,7 +17,9 @@ discard block |
||
17 | 17 | |
18 | 18 | public static function title(string $value = null) { |
19 | 19 | |
20 | - if (null === $value) return (self::$data['title'] ?? false); |
|
20 | + if (null === $value) { |
|
21 | + return (self::$data['title'] ?? false); |
|
22 | + } |
|
21 | 23 | |
22 | 24 | self::$data['title'] = $value; |
23 | 25 | } |
@@ -26,7 +28,9 @@ discard block |
||
26 | 28 | |
27 | 29 | public static function description(string $value = null) { |
28 | 30 | |
29 | - if (null === $value) return (self::$data['description'] ?? false); |
|
31 | + if (null === $value) { |
|
32 | + return (self::$data['description'] ?? false); |
|
33 | + } |
|
30 | 34 | |
31 | 35 | self::$data['description'] = $value; |
32 | 36 | } |
@@ -35,7 +39,9 @@ discard block |
||
35 | 39 | |
36 | 40 | public static function keywords(string $value = null) { |
37 | 41 | |
38 | - if (null === $value) return (self::$data['keywords'] ?? false); |
|
42 | + if (null === $value) { |
|
43 | + return (self::$data['keywords'] ?? false); |
|
44 | + } |
|
39 | 45 | |
40 | 46 | self::$data['keywords'] = $value; |
41 | 47 | } |
@@ -44,7 +50,9 @@ discard block |
||
44 | 50 | |
45 | 51 | public static function robotsIndex(bool $value = null) { |
46 | 52 | |
47 | - if (null === $value) return (self::$data['robots_index'] ?? false); |
|
53 | + if (null === $value) { |
|
54 | + return (self::$data['robots_index'] ?? false); |
|
55 | + } |
|
48 | 56 | |
49 | 57 | self::$data['robots_index'] = $value; |
50 | 58 | } |
@@ -53,7 +61,9 @@ discard block |
||
53 | 61 | |
54 | 62 | public static function robotsFollow(bool $value = null) { |
55 | 63 | |
56 | - if (null === $value) return (self::$data['robots_follow'] ?? false); |
|
64 | + if (null === $value) { |
|
65 | + return (self::$data['robots_follow'] ?? false); |
|
66 | + } |
|
57 | 67 | |
58 | 68 | self::$data['robots_follow'] = $value; |
59 | 69 | } |
@@ -62,7 +72,9 @@ discard block |
||
62 | 72 | |
63 | 73 | public static function canonical(string $value = null) { |
64 | 74 | |
65 | - if (null === $value) return (self::$data['canonical'] ?? false); |
|
75 | + if (null === $value) { |
|
76 | + return (self::$data['canonical'] ?? false); |
|
77 | + } |
|
66 | 78 | |
67 | 79 | self::$data['canonical'] = $value; |
68 | 80 | } |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | |
22 | 22 | private function getTitle() : string { |
23 | 23 | |
24 | - return ((('' !== $this->title) ? (Language::get($this->title) . ' | ') : '') . CADMIUM_NAME); |
|
24 | + return ((('' !== $this->title) ? (Language::get($this->title).' | ') : '').CADMIUM_NAME); |
|
25 | 25 | } |
26 | 26 | |
27 | 27 | /** |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | |
31 | 31 | protected function _display(Template\Block $layout) { |
32 | 32 | |
33 | - $view = View::get('Main/' . $this->view); |
|
33 | + $view = View::get('Main/'.$this->view); |
|
34 | 34 | |
35 | 35 | # Set language |
36 | 36 |
@@ -34,7 +34,7 @@ discard block |
||
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 |
||
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::active())); |
|
52 | + Template::setGlobal('template_name', strtolower(Extend\Templates::active())); |
|
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 | /** |
@@ -32,10 +32,12 @@ discard block |
||
32 | 32 | |
33 | 33 | $phrases = (static::PHRASES + array_keys(Extend\Addons::items() ?? [])); |
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 |
||
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 |
@@ -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::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::canonical()) $page->getBlock('canonical')->enable()->link = SEO::canonical(); |
|
87 | + if (false !== SEO::canonical()) { |
|
88 | + $page->getBlock('canonical')->enable()->link = SEO::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 |
@@ -78,11 +78,11 @@ |
||
78 | 78 | 'DASHBOARD_LINK_INFORMATION' => 'Больше информации', |
79 | 79 | |
80 | 80 | 'DASHBOARD_MESSAGE_INSTALL_REQUIREMENTS' => 'Некоторые возможности могут быть недоступны из-за неверной конфигурации сервера. Подробнее на ' . |
81 | - '<a href="$install_path$/admin/system/information#diagnostics">странице диагностики</a>.', |
|
81 | + '<a href="$install_path$/admin/system/information#diagnostics">странице диагностики</a>.', |
|
82 | 82 | 'DASHBOARD_MESSAGE_INSTALL_FILE' => 'Установочный файл <b>install.php</b> по-прежнему находится в корневой директории сайта. ' . |
83 | - 'Рекомендуется удалить его.', |
|
83 | + 'Рекомендуется удалить его.', |
|
84 | 84 | 'DASHBOARD_MESSAGE_SETTINGS_FILE' => 'Похоже, Вы пока не редактировали настройки сайта. '. |
85 | - 'Перейдите на <a href="$install_path$/admin/system/settings">страницу настроек</a> для ввода актуальных данных.', |
|
85 | + 'Перейдите на <a href="$install_path$/admin/system/settings">страницу настроек</a> для ввода актуальных данных.', |
|
86 | 86 | |
87 | 87 | # Pages |
88 | 88 |
@@ -77,9 +77,9 @@ |
||
77 | 77 | 'DASHBOARD_LINK_SETTINGS' => 'Редактировать настройки', |
78 | 78 | 'DASHBOARD_LINK_INFORMATION' => 'Больше информации', |
79 | 79 | |
80 | - 'DASHBOARD_MESSAGE_INSTALL_REQUIREMENTS' => 'Некоторые возможности могут быть недоступны из-за неверной конфигурации сервера. Подробнее на ' . |
|
80 | + 'DASHBOARD_MESSAGE_INSTALL_REQUIREMENTS' => 'Некоторые возможности могут быть недоступны из-за неверной конфигурации сервера. Подробнее на '. |
|
81 | 81 | '<a href="$install_path$/admin/system/information#diagnostics">странице диагностики</a>.', |
82 | - 'DASHBOARD_MESSAGE_INSTALL_FILE' => 'Установочный файл <b>install.php</b> по-прежнему находится в корневой директории сайта. ' . |
|
82 | + 'DASHBOARD_MESSAGE_INSTALL_FILE' => 'Установочный файл <b>install.php</b> по-прежнему находится в корневой директории сайта. '. |
|
83 | 83 | 'Рекомендуется удалить его.', |
84 | 84 | 'DASHBOARD_MESSAGE_SETTINGS_FILE' => 'Похоже, Вы пока не редактировали настройки сайта. '. |
85 | 85 | 'Перейдите на <a href="$install_path$/admin/system/settings">страницу настроек</a> для ввода актуальных данных.', |
@@ -78,11 +78,11 @@ |
||
78 | 78 | 'DASHBOARD_LINK_INFORMATION' => 'Більше інформації', |
79 | 79 | |
80 | 80 | 'DASHBOARD_MESSAGE_INSTALL_REQUIREMENTS' => 'Деякі можливості можуть бути недоступні через невірну конфігурацію сервера. Детальніше на ' . |
81 | - '<a href="$install_path$/admin/system/information#diagnostics">сторінці діагностики</a>.', |
|
81 | + '<a href="$install_path$/admin/system/information#diagnostics">сторінці діагностики</a>.', |
|
82 | 82 | 'DASHBOARD_MESSAGE_INSTALL_FILE' => 'Інсталяційний файл <b>install.php</b> досі знаходиться в кореневій директорії сайта. '. |
83 | - 'Рекомендовано видалити його.', |
|
83 | + 'Рекомендовано видалити його.', |
|
84 | 84 | 'DASHBOARD_MESSAGE_SETTINGS_FILE' => 'Схоже, Ви поки не редагували налаштування сайта. '. |
85 | - 'Перейдіть на <a href="$install_path$/admin/system/settings">сторінку налаштувань</a> для введення актуальних даних.', |
|
85 | + 'Перейдіть на <a href="$install_path$/admin/system/settings">сторінку налаштувань</a> для введення актуальних даних.', |
|
86 | 86 | |
87 | 87 | # Pages |
88 | 88 |
@@ -77,7 +77,7 @@ |
||
77 | 77 | 'DASHBOARD_LINK_SETTINGS' => 'Редагувати налаштування', |
78 | 78 | 'DASHBOARD_LINK_INFORMATION' => 'Більше інформації', |
79 | 79 | |
80 | - 'DASHBOARD_MESSAGE_INSTALL_REQUIREMENTS' => 'Деякі можливості можуть бути недоступні через невірну конфігурацію сервера. Детальніше на ' . |
|
80 | + 'DASHBOARD_MESSAGE_INSTALL_REQUIREMENTS' => 'Деякі можливості можуть бути недоступні через невірну конфігурацію сервера. Детальніше на '. |
|
81 | 81 | '<a href="$install_path$/admin/system/information#diagnostics">сторінці діагностики</a>.', |
82 | 82 | 'DASHBOARD_MESSAGE_INSTALL_FILE' => 'Інсталяційний файл <b>install.php</b> досі знаходиться в кореневій директорії сайта. '. |
83 | 83 | 'Рекомендовано видалити його.', |