@@ -2,7 +2,9 @@ |
||
2 | 2 | |
3 | 3 | namespace { |
4 | 4 | |
5 | - use Modules\Extend, Utils\Map, Utils\Schema; |
|
5 | + use Modules\Extend; |
|
6 | + use Utils\Map; |
|
7 | + use Utils\Schema; |
|
6 | 8 | |
7 | 9 | class Dispatcher { |
8 | 10 |
@@ -14,7 +14,7 @@ |
||
14 | 14 | |
15 | 15 | if (null === ($data = Schema::get('System')->load())) { |
16 | 16 | |
17 | - Request::redirect(INSTALL_PATH . '/install.php'); |
|
17 | + Request::redirect(INSTALL_PATH.'/install.php'); |
|
18 | 18 | } |
19 | 19 | |
20 | 20 | # Connect to database |
@@ -2,7 +2,12 @@ |
||
2 | 2 | |
3 | 3 | namespace Frames\Admin\Area { |
4 | 4 | |
5 | - use Frames, Frames\Status, Modules, Ajax, Request, Template; |
|
5 | + use Frames; |
|
6 | + use Frames\Status; |
|
7 | + use Modules; |
|
8 | + use Ajax; |
|
9 | + use Request; |
|
10 | + use Template; |
|
6 | 11 | |
7 | 12 | abstract class Authorized extends Frames\Admin\Section { |
8 | 13 |
@@ -16,7 +16,7 @@ |
||
16 | 16 | |
17 | 17 | if (!Modules\Auth::check() || ((false !== Request::get('logout')) && Modules\Auth::logout())) { |
18 | 18 | |
19 | - Request::redirect(INSTALL_PATH . '/admin/login'); |
|
19 | + Request::redirect(INSTALL_PATH.'/admin/login'); |
|
20 | 20 | } |
21 | 21 | |
22 | 22 | # Handle request |
@@ -19,9 +19,13 @@ |
||
19 | 19 | |
20 | 20 | # Handle request |
21 | 21 | |
22 | - if (Template::isBlock($result = $this->handle())) return $this->displayPage($result, STATUS_CODE_200); |
|
22 | + if (Template::isBlock($result = $this->handle())) { |
|
23 | + return $this->displayPage($result, STATUS_CODE_200); |
|
24 | + } |
|
23 | 25 | |
24 | - if (Ajax::isResponse($result)) return Ajax::output($result); |
|
26 | + if (Ajax::isResponse($result)) { |
|
27 | + return Ajax::output($result); |
|
28 | + } |
|
25 | 29 | |
26 | 30 | # ------------------------ |
27 | 31 |
@@ -2,8 +2,17 @@ |
||
2 | 2 | |
3 | 3 | namespace Frames\Admin { |
4 | 4 | |
5 | - use Frames, Frames\Status, Modules\Auth, Modules\Extend, Utils\Messages, Utils\Popup, Utils\View; |
|
6 | - use DB, Debug, Language, Template; |
|
5 | + use Frames; |
|
6 | + use Frames\Status; |
|
7 | + use Modules\Auth; |
|
8 | + use Modules\Extend; |
|
9 | + use Utils\Messages; |
|
10 | + use Utils\Popup; |
|
11 | + use Utils\View; |
|
12 | + use DB; |
|
13 | + use Debug; |
|
14 | + use Language; |
|
15 | + use Template; |
|
7 | 16 | |
8 | 17 | abstract class Section extends Frames\Section { |
9 | 18 |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | |
24 | 24 | private function getLayout(Template\Block $contents) { |
25 | 25 | |
26 | - $layout = View::get('Layouts/' . $this->layout); |
|
26 | + $layout = View::get('Layouts/'.$this->layout); |
|
27 | 27 | |
28 | 28 | # Set menu and user |
29 | 29 | |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | |
83 | 83 | protected function displayPage(Template\Block $contents, int $status = STATUS_CODE_200) { |
84 | 84 | |
85 | - $page = View::get('Main/' . $this->layout); |
|
85 | + $page = View::get('Main/'.$this->layout); |
|
86 | 86 | |
87 | 87 | # Set language |
88 | 88 | |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | |
91 | 91 | # Set title |
92 | 92 | |
93 | - $page->title = ((('' !== $this->title) ? (Language::get($this->title) . ' | ') : '') . CADMIUM_NAME); |
|
93 | + $page->title = ((('' !== $this->title) ? (Language::get($this->title).' | ') : '').CADMIUM_NAME); |
|
94 | 94 | |
95 | 95 | # Set layout |
96 | 96 |
@@ -111,7 +111,9 @@ |
||
111 | 111 | |
112 | 112 | $ips = preg_split('/ +/', CONFIG_ADMIN_IP, -1, PREG_SPLIT_NO_EMPTY); |
113 | 113 | |
114 | - if (!in_array(REQUEST_CLIENT_IP, $ips, true)) return Status::error404(); |
|
114 | + if (!in_array(REQUEST_CLIENT_IP, $ips, true)) { |
|
115 | + return Status::error404(); |
|
116 | + } |
|
115 | 117 | } |
116 | 118 | |
117 | 119 | # ------------------------ |
@@ -2,7 +2,15 @@ |
||
2 | 2 | |
3 | 3 | namespace Frames { |
4 | 4 | |
5 | - use Modules\Auth, Modules\Extend, Modules\Settings, Utils\Messages, Utils\Popup, Utils\SEO, Utils\View, Language, Template; |
|
5 | + use Modules\Auth; |
|
6 | + use Modules\Extend; |
|
7 | + use Modules\Settings; |
|
8 | + use Utils\Messages; |
|
9 | + use Utils\Popup; |
|
10 | + use Utils\SEO; |
|
11 | + use Utils\View; |
|
12 | + use Language; |
|
13 | + use Template; |
|
6 | 14 | |
7 | 15 | abstract class Section extends Main { |
8 | 16 |
@@ -36,22 +36,22 @@ |
||
36 | 36 | |
37 | 37 | foreach (array_unique($languages) as $path) foreach ($phrases as $name) { |
38 | 38 | |
39 | - Language::load($path . 'Phrases/' . $name . '.php'); |
|
39 | + Language::load($path.'Phrases/'.$name.'.php'); |
|
40 | 40 | } |
41 | 41 | |
42 | 42 | # Set template globals |
43 | 43 | |
44 | - Template::setGlobal('template_name', strtolower(Extend\Templates::active())); |
|
44 | + Template::setGlobal('template_name', strtolower(Extend\Templates::active())); |
|
45 | 45 | |
46 | - Template::setGlobal('site_title', Settings::get('site_title')); |
|
46 | + Template::setGlobal('site_title', Settings::get('site_title')); |
|
47 | 47 | |
48 | - Template::setGlobal('system_url', Settings::get('system_url')); |
|
48 | + Template::setGlobal('system_url', Settings::get('system_url')); |
|
49 | 49 | |
50 | - Template::setGlobal('system_email', Settings::get('system_email')); |
|
50 | + Template::setGlobal('system_email', Settings::get('system_email')); |
|
51 | 51 | |
52 | - Template::setGlobal('install_path', INSTALL_PATH); |
|
52 | + Template::setGlobal('install_path', INSTALL_PATH); |
|
53 | 53 | |
54 | - Template::setGlobal('index_page', (('' !== INSTALL_PATH) ? INSTALL_PATH : '/')); |
|
54 | + Template::setGlobal('index_page', (('' !== INSTALL_PATH) ? INSTALL_PATH : '/')); |
|
55 | 55 | |
56 | 56 | # Init utils |
57 | 57 |
@@ -34,10 +34,12 @@ discard block |
||
34 | 34 | |
35 | 35 | $phrases = array_merge(static::PHRASES, array_keys(Extend\Addons::items() ?? [])); |
36 | 36 | |
37 | - foreach (array_unique($languages) as $path) foreach ($phrases as $name) { |
|
37 | + foreach (array_unique($languages) as $path) { |
|
38 | + foreach ($phrases as $name) { |
|
38 | 39 | |
39 | 40 | Language::load($path . 'Phrases/' . $name . '.php'); |
40 | 41 | } |
42 | + } |
|
41 | 43 | |
42 | 44 | # Set template globals |
43 | 45 | |
@@ -59,7 +61,9 @@ discard block |
||
59 | 61 | |
60 | 62 | # Set timezone |
61 | 63 | |
62 | - if (Auth::check() && ('' !== ($timezone = Auth::user()->timezone))) date_default_timezone_set($timezone); |
|
64 | + if (Auth::check() && ('' !== ($timezone = Auth::user()->timezone))) { |
|
65 | + date_default_timezone_set($timezone); |
|
66 | + } |
|
63 | 67 | |
64 | 68 | # ------------------------ |
65 | 69 |
@@ -2,8 +2,20 @@ |
||
2 | 2 | |
3 | 3 | namespace Frames\Site { |
4 | 4 | |
5 | - use Frames, Frames\Status, Modules\Auth, Modules\Extend, Modules\Settings, Utils\Menu, Utils\Messages; |
|
6 | - use Utils\SEO, Utils\Template\Variables, Utils\Template\Widgets, Utils\View, Date, Language, Template; |
|
5 | + use Frames; |
|
6 | + use Frames\Status; |
|
7 | + use Modules\Auth; |
|
8 | + use Modules\Extend; |
|
9 | + use Modules\Settings; |
|
10 | + use Utils\Menu; |
|
11 | + use Utils\Messages; |
|
12 | + use Utils\SEO; |
|
13 | + use Utils\Template\Variables; |
|
14 | + use Utils\Template\Widgets; |
|
15 | + use Utils\View; |
|
16 | + use Date; |
|
17 | + use Language; |
|
18 | + use Template; |
|
7 | 19 | |
8 | 20 | abstract class Section extends Frames\Section { |
9 | 21 |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | |
24 | 24 | private function getLayout(Template\Block $contents) { |
25 | 25 | |
26 | - $layout = View::get('Layouts/' . $this->layout); |
|
26 | + $layout = View::get('Layouts/'.$this->layout); |
|
27 | 27 | |
28 | 28 | # Create layout components |
29 | 29 | |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | |
40 | 40 | $layout->getBlock('user')->enable(); |
41 | 41 | |
42 | - $layout->getBlock('user')->gravatar = Auth::user()->gravatar;; |
|
42 | + $layout->getBlock('user')->gravatar = Auth::user()->gravatar; ; |
|
43 | 43 | |
44 | 44 | $layout->getBlock('user')->name = Auth::user()->name; |
45 | 45 | |
@@ -50,9 +50,7 @@ discard block |
||
50 | 50 | |
51 | 51 | # Set title |
52 | 52 | |
53 | - $layout->title = (('' !== SEO::title()) ? SEO::title() : |
|
54 | - |
|
55 | - (('' !== $this->title) ? Language::get($this->title) : Settings::get('site_title'))); |
|
53 | + $layout->title = (('' !== SEO::title()) ? SEO::title() : (('' !== $this->title) ? Language::get($this->title) : Settings::get('site_title'))); |
|
56 | 54 | |
57 | 55 | # Set slogan |
58 | 56 | |
@@ -95,13 +93,11 @@ discard block |
||
95 | 93 | |
96 | 94 | $page->keywords = ('' !== SEO::keywords()) ? SEO::keywords() : Settings::get('site_keywords'); |
97 | 95 | |
98 | - $page->robots = ((SEO::robotsIndex() ? 'INDEX' : 'NOINDEX') . ',' . (SEO::robotsFollow() ? 'FOLLOW' : 'NOFOLLOW')); |
|
96 | + $page->robots = ((SEO::robotsIndex() ? 'INDEX' : 'NOINDEX').','.(SEO::robotsFollow() ? 'FOLLOW' : 'NOFOLLOW')); |
|
99 | 97 | |
100 | 98 | # Set title |
101 | 99 | |
102 | - $page->title = (('' !== SEO::title()) ? SEO::title() : |
|
103 | - |
|
104 | - ((('' !== $this->title) ? (Language::get($this->title) . ' | ') : '') . Settings::get('site_title'))); |
|
100 | + $page->title = (('' !== SEO::title()) ? SEO::title() : ((('' !== $this->title) ? (Language::get($this->title).' | ') : '').Settings::get('site_title'))); |
|
105 | 101 | |
106 | 102 | # Set canonical |
107 | 103 |
@@ -45,7 +45,9 @@ discard block |
||
45 | 45 | |
46 | 46 | $layout->getBlock('auth')->disable(); |
47 | 47 | |
48 | - if (Auth::user()->rank === RANK_ADMINISTRATOR) $layout->getBlock('admin')->enable(); |
|
48 | + if (Auth::user()->rank === RANK_ADMINISTRATOR) { |
|
49 | + $layout->getBlock('admin')->enable(); |
|
50 | + } |
|
49 | 51 | } |
50 | 52 | |
51 | 53 | # Set title |
@@ -105,9 +107,11 @@ discard block |
||
105 | 107 | |
106 | 108 | # Set canonical |
107 | 109 | |
108 | - if ('' === SEO::canonical()) $page->getBlock('canonical')->disable(); |
|
109 | - |
|
110 | - else $page->getBlock('canonical')->link = SEO::canonical(); |
|
110 | + if ('' === SEO::canonical()) { |
|
111 | + $page->getBlock('canonical')->disable(); |
|
112 | + } else { |
|
113 | + $page->getBlock('canonical')->link = SEO::canonical(); |
|
114 | + } |
|
111 | 115 | |
112 | 116 | # Set layout |
113 | 117 | |
@@ -119,9 +123,13 @@ discard block |
||
119 | 123 | |
120 | 124 | # Set global components |
121 | 125 | |
122 | - foreach (Variables::generate() as $name => $value) Template::setGlobal($name, $value); |
|
126 | + foreach (Variables::generate() as $name => $value) { |
|
127 | + Template::setGlobal($name, $value); |
|
128 | + } |
|
123 | 129 | |
124 | - foreach (Widgets::generate() as $name => $block) Template::setWidget($name, $block); |
|
130 | + foreach (Widgets::generate() as $name => $block) { |
|
131 | + Template::setWidget($name, $block); |
|
132 | + } |
|
125 | 133 | |
126 | 134 | # ------------------------ |
127 | 135 | |
@@ -134,9 +142,13 @@ discard block |
||
134 | 142 | |
135 | 143 | # Check site status |
136 | 144 | |
137 | - if (Settings::get('site_status') === STATUS_MAINTENANCE) return Status::maintenance(); |
|
145 | + if (Settings::get('site_status') === STATUS_MAINTENANCE) { |
|
146 | + return Status::maintenance(); |
|
147 | + } |
|
138 | 148 | |
139 | - if (Settings::get('site_status') === STATUS_UPDATE) return Status::update(); |
|
149 | + if (Settings::get('site_status') === STATUS_UPDATE) { |
|
150 | + return Status::update(); |
|
151 | + } |
|
140 | 152 | |
141 | 153 | # ------------------------ |
142 | 154 |
@@ -2,7 +2,11 @@ |
||
2 | 2 | |
3 | 3 | namespace Frames { |
4 | 4 | |
5 | - use Modules\Extend, Modules\Settings, Utils\View, Date, Language, Template; |
|
5 | + use Modules\Extend; |
|
6 | + use Utils\View; |
|
7 | + use Date; |
|
8 | + use Language; |
|
9 | + use Template; |
|
6 | 10 | |
7 | 11 | abstract class Status { |
8 | 12 |
@@ -2,7 +2,8 @@ |
||
2 | 2 | |
3 | 3 | namespace Modules\Entitizer\Listview { |
4 | 4 | |
5 | - use Modules\Entitizer, Template; |
|
5 | + use Modules\Entitizer; |
|
6 | + use Template; |
|
6 | 7 | |
7 | 8 | class Variables extends Entitizer\Utils\Listview { |
8 | 9 |
@@ -30,9 +30,9 @@ |
||
30 | 30 | |
31 | 31 | protected function processEntityParent(Template\Block $parent) { |
32 | 32 | |
33 | - if (0 !== $this->parent->id) $parent->getBlock('browse')->link = $this->parent->link; |
|
34 | - |
|
35 | - else { $parent->getBlock('browse')->disable(); $parent->getBlock('browse_disabled')->enable(); } |
|
33 | + if (0 !== $this->parent->id) { |
|
34 | + $parent->getBlock('browse')->link = $this->parent->link; |
|
35 | + } else { $parent->getBlock('browse')->disable(); $parent->getBlock('browse_disabled')->enable(); } |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | # Add item additional data |
@@ -2,7 +2,11 @@ |
||
2 | 2 | |
3 | 3 | namespace Modules\Extend\Utils\Handler { |
4 | 4 | |
5 | - use Modules\Extend, Modules\Informer, Ajax, Arr, Language, Request, Template; |
|
5 | + use Modules\Extend; |
|
6 | + use Ajax; |
|
7 | + use Language; |
|
8 | + use Request; |
|
9 | + use Template; |
|
6 | 10 | |
7 | 11 | abstract class Addons extends Extend\Utils\Handler { |
8 | 12 |
@@ -35,13 +35,17 @@ discard block |
||
35 | 35 | |
36 | 36 | $name = Request::post('name'); |
37 | 37 | |
38 | - if (!$this->loader->install($name, true)) return $ajax->setError(Language::get(static::$error_install)); |
|
38 | + if (!$this->loader->install($name, true)) { |
|
39 | + return $ajax->setError(Language::get(static::$error_install)); |
|
40 | + } |
|
39 | 41 | |
40 | 42 | } else if (Request::post('action') === 'uninstall') { |
41 | 43 | |
42 | 44 | $name = Request::post('name'); |
43 | 45 | |
44 | - if (!$this->loader->install($name, false)) return $ajax->setError(Language::get(static::$error_uninstall)); |
|
46 | + if (!$this->loader->install($name, false)) { |
|
47 | + return $ajax->setError(Language::get(static::$error_uninstall)); |
|
48 | + } |
|
45 | 49 | } |
46 | 50 | |
47 | 51 | # ------------------------ |
@@ -55,7 +59,9 @@ discard block |
||
55 | 59 | |
56 | 60 | $this->loader = new static::$loader_class; |
57 | 61 | |
58 | - if (Request::isAjax()) return $this->handleAjax(); |
|
62 | + if (Request::isAjax()) { |
|
63 | + return $this->handleAjax(); |
|
64 | + } |
|
59 | 65 | |
60 | 66 | # ------------------------ |
61 | 67 |
@@ -2,7 +2,13 @@ |
||
2 | 2 | |
3 | 3 | namespace Modules\Extend\Utils\Handler { |
4 | 4 | |
5 | - use Modules\Extend, Modules\Informer, Modules\Settings, Ajax, Arr, Language, Request, Template, JSON; |
|
5 | + use Modules\Extend; |
|
6 | + use Modules\Informer; |
|
7 | + use Modules\Settings; |
|
8 | + use Ajax; |
|
9 | + use Language; |
|
10 | + use Request; |
|
11 | + use Template; |
|
6 | 12 | |
7 | 13 | abstract class Basic extends Extend\Utils\Handler { |
8 | 14 |
@@ -30,13 +30,19 @@ discard block |
||
30 | 30 | |
31 | 31 | if (Request::post('action') === 'activate') { |
32 | 32 | |
33 | - if (Informer::isDemoMode()) return $ajax->setError(Language::get('DEMO_MODE_RESTRICTION')); |
|
33 | + if (Informer::isDemoMode()) { |
|
34 | + return $ajax->setError(Language::get('DEMO_MODE_RESTRICTION')); |
|
35 | + } |
|
34 | 36 | |
35 | 37 | $param = static::$param[$this->loader->section()]; $name = Request::post('name'); |
36 | 38 | |
37 | - if (false === Settings::set($param, $name)) return $ajax->setError(Language::get(static::$error_activate)); |
|
39 | + if (false === Settings::set($param, $name)) { |
|
40 | + return $ajax->setError(Language::get(static::$error_activate)); |
|
41 | + } |
|
38 | 42 | |
39 | - if (false === Settings::save()) return $ajax->setError(Language::get(static::$error_save)); |
|
43 | + if (false === Settings::save()) { |
|
44 | + return $ajax->setError(Language::get(static::$error_save)); |
|
45 | + } |
|
40 | 46 | |
41 | 47 | } else if (Request::post('action') === 'list') { |
42 | 48 | |
@@ -54,7 +60,9 @@ discard block |
||
54 | 60 | |
55 | 61 | $this->loader = new static::$loader_class(Request::get('list')); |
56 | 62 | |
57 | - if (Request::isAjax()) return $this->handleAjax(); |
|
63 | + if (Request::isAjax()) { |
|
64 | + return $this->handleAjax(); |
|
65 | + } |
|
58 | 66 | |
59 | 67 | # ------------------------ |
60 | 68 |