@@ -23,9 +23,9 @@ |
||
23 | 23 | |
24 | 24 | public static function __autoload() { |
25 | 25 | |
26 | - $file_mobiles = (DIR_DATA . 'Agent/Mobiles.php'); |
|
26 | + $file_mobiles = (DIR_DATA.'Agent/Mobiles.php'); |
|
27 | 27 | |
28 | - $file_robots = (DIR_DATA . 'Agent/Robots.php'); |
|
28 | + $file_robots = (DIR_DATA.'Agent/Robots.php'); |
|
29 | 29 | |
30 | 30 | if (is_array($mobiles = Explorer::php($file_mobiles))) self::$mobiles = $mobiles; |
31 | 31 |
@@ -21,9 +21,13 @@ discard block |
||
21 | 21 | |
22 | 22 | private static function search(array &$list) { |
23 | 23 | |
24 | - if (empty($agent = getenv('HTTP_USER_AGENT'))) return false; |
|
24 | + if (empty($agent = getenv('HTTP_USER_AGENT'))) { |
|
25 | + return false; |
|
26 | + } |
|
25 | 27 | |
26 | - foreach ($list as $item) if (false !== stripos($agent, $item)) return true; |
|
28 | + foreach ($list as $item) { |
|
29 | + if (false !== stripos($agent, $item)) return true; |
|
30 | + } |
|
27 | 31 | |
28 | 32 | # ------------------------ |
29 | 33 | |
@@ -40,9 +44,13 @@ discard block |
||
40 | 44 | |
41 | 45 | $file_robots = (DIR_DATA . 'Agent/Robots.php'); |
42 | 46 | |
43 | - if (is_array($mobiles = Explorer::include($file_mobiles))) self::$mobiles = $mobiles; |
|
47 | + if (is_array($mobiles = Explorer::include($file_mobiles))) { |
|
48 | + self::$mobiles = $mobiles; |
|
49 | + } |
|
44 | 50 | |
45 | - if (is_array($robots = Explorer::include($file_robots))) self::$robots = $robots; |
|
51 | + if (is_array($robots = Explorer::include($file_robots))) { |
|
52 | + self::$robots = $robots; |
|
53 | + } |
|
46 | 54 | } |
47 | 55 | |
48 | 56 | /** |
@@ -12,13 +12,13 @@ |
||
12 | 12 | |
13 | 13 | # Set headers |
14 | 14 | |
15 | - $headers = ('MIME-Version: 1.0' . "\r\n"); |
|
15 | + $headers = ('MIME-Version: 1.0'."\r\n"); |
|
16 | 16 | |
17 | - $headers .= ('Content-Type: ' . ($is_html ? 'text/html' : 'text/plain') . '; charset=UTF-8' . "\r\n"); |
|
17 | + $headers .= ('Content-Type: '.($is_html ? 'text/html' : 'text/plain').'; charset=UTF-8'."\r\n"); |
|
18 | 18 | |
19 | - $headers .= ('From: ' . $sender . ' <' . $from . '>' . "\r\n" . 'Reply-To: ' . $reply_to . "\r\n"); |
|
19 | + $headers .= ('From: '.$sender.' <'.$from.'>'."\r\n".'Reply-To: '.$reply_to."\r\n"); |
|
20 | 20 | |
21 | - $headers .= ('X-Mailer: PHP/' . phpversion() . "\r\n"); |
|
21 | + $headers .= ('X-Mailer: PHP/'.phpversion()."\r\n"); |
|
22 | 22 | |
23 | 23 | # Send message |
24 | 24 |
@@ -18,7 +18,7 @@ |
||
18 | 18 | |
19 | 19 | # Build query |
20 | 20 | |
21 | - $this->query = ('DELETE FROM ' . $table . ($condition ? (' WHERE (' . $condition . ')') : '')); |
|
21 | + $this->query = ('DELETE FROM '.$table.($condition ? (' WHERE ('.$condition.')') : '')); |
|
22 | 22 | } |
23 | 23 | } |
24 | 24 | } |
@@ -22,9 +22,9 @@ |
||
22 | 22 | |
23 | 23 | # Build query |
24 | 24 | |
25 | - $this->query = ('SELECT ' . $selection . ' FROM ' . $table . ($condition ? (' WHERE (' . $condition . ')') : '') . |
|
25 | + $this->query = ('SELECT '.$selection.' FROM '.$table.($condition ? (' WHERE ('.$condition.')') : ''). |
|
26 | 26 | |
27 | - ($order ? (' ORDER BY ' . $order) : '') . ($limit ? (' LIMIT ' . $limit) : '')); |
|
27 | + ($order ? (' ORDER BY '.$order) : '').($limit ? (' LIMIT '.$limit) : '')); |
|
28 | 28 | } |
29 | 29 | } |
30 | 30 | } |
@@ -63,7 +63,7 @@ |
||
63 | 63 | 'DASHBOARD_GROUP_GENERAL' => 'Основне', |
64 | 64 | 'DASHBOARD_GROUP_DATABASE' => 'База даних', |
65 | 65 | |
66 | - 'DASHBOARD_MESSAGE_INSTALL_FILE' => 'Інсталяційний файл <a href="$install_path$/install.php" target="_blank">install.php</a> ' . |
|
66 | + 'DASHBOARD_MESSAGE_INSTALL_FILE' => 'Інсталяційний файл <a href="$install_path$/install.php" target="_blank">install.php</a> '. |
|
67 | 67 | 'досі знаходиться в кореневій директорії сайта. Необхідно видалити його.', |
68 | 68 | 'DASHBOARD_MESSAGE_CONFIG_FILE' => 'Схоже, Ви поки не редагували конфігурацію сайта. '. |
69 | 69 | 'Перейдіть на <a href="$install_path$/admin/system/settings">сторінку налаштувань</a> для введення актуальних значень.', |
@@ -65,9 +65,9 @@ |
||
65 | 65 | 'DASHBOARD_GROUP_DATABASE' => 'База даних', |
66 | 66 | |
67 | 67 | 'DASHBOARD_MESSAGE_INSTALL_FILE' => 'Інсталяційний файл <a href="$install_path$/install.php" target="_blank">install.php</a> ' . |
68 | - 'досі знаходиться в кореневій директорії сайта. Необхідно видалити його.', |
|
68 | + 'досі знаходиться в кореневій директорії сайта. Необхідно видалити його.', |
|
69 | 69 | 'DASHBOARD_MESSAGE_SETTINGS_FILE' => 'Схоже, Ви поки не редагували налаштування сайта. '. |
70 | - 'Перейдіть на <a href="$install_path$/admin/system/settings">сторінку налаштувань</a> для введення актуальних даних.', |
|
70 | + 'Перейдіть на <a href="$install_path$/admin/system/settings">сторінку налаштувань</a> для введення актуальних даних.', |
|
71 | 71 | |
72 | 72 | # Pages |
73 | 73 |
@@ -63,7 +63,7 @@ |
||
63 | 63 | 'DASHBOARD_GROUP_GENERAL' => 'Основное', |
64 | 64 | 'DASHBOARD_GROUP_DATABASE' => 'База данных', |
65 | 65 | |
66 | - 'DASHBOARD_MESSAGE_INSTALL_FILE' => 'Установочный файл <a href="$install_path$/install.php" target="_blank">install.php</a> ' . |
|
66 | + 'DASHBOARD_MESSAGE_INSTALL_FILE' => 'Установочный файл <a href="$install_path$/install.php" target="_blank">install.php</a> '. |
|
67 | 67 | 'по-прежнему находится в корневой директории сайта. Необходимо удалить его.', |
68 | 68 | 'DASHBOARD_MESSAGE_CONFIG_FILE' => 'Похоже, Вы пока не редактировали конфигурацию сайта. '. |
69 | 69 | 'Перейдите на <a href="$install_path$/admin/system/settings">страницу настроек</a> для ввода актуальных значений.', |
@@ -65,9 +65,9 @@ |
||
65 | 65 | 'DASHBOARD_GROUP_DATABASE' => 'База данных', |
66 | 66 | |
67 | 67 | 'DASHBOARD_MESSAGE_INSTALL_FILE' => 'Установочный файл <a href="$install_path$/install.php" target="_blank">install.php</a> ' . |
68 | - 'по-прежнему находится в корневой директории сайта. Необходимо удалить его.', |
|
68 | + 'по-прежнему находится в корневой директории сайта. Необходимо удалить его.', |
|
69 | 69 | 'DASHBOARD_MESSAGE_SETTINGS_FILE' => 'Похоже, Вы пока не редактировали настройки сайта. '. |
70 | - 'Перейдите на <a href="$install_path$/admin/system/settings">страницу настроек</a> для ввода актуальных данных.', |
|
70 | + 'Перейдите на <a href="$install_path$/admin/system/settings">страницу настроек</a> для ввода актуальных данных.', |
|
71 | 71 | |
72 | 72 | # Pages |
73 | 73 |
@@ -24,21 +24,21 @@ |
||
24 | 24 | |
25 | 25 | public static function checkInstallFile() { |
26 | 26 | |
27 | - return Explorer::isFile(DIR_WWW . 'install.php'); |
|
27 | + return Explorer::isFile(DIR_WWW.'install.php'); |
|
28 | 28 | } |
29 | 29 | |
30 | 30 | # Check if debug mode forced |
31 | 31 | |
32 | 32 | public static function isDebugMode() { |
33 | 33 | |
34 | - return Explorer::isFile(DIR_SYSTEM_DATA . '.debug'); |
|
34 | + return Explorer::isFile(DIR_SYSTEM_DATA.'.debug'); |
|
35 | 35 | } |
36 | 36 | |
37 | 37 | # Check if demo mode forced |
38 | 38 | |
39 | 39 | public static function isDemoMode() { |
40 | 40 | |
41 | - return Explorer::isFile(DIR_SYSTEM_DATA . '.demo'); |
|
41 | + return Explorer::isFile(DIR_SYSTEM_DATA.'.demo'); |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | # Get MySQL version |
@@ -45,7 +45,9 @@ |
||
45 | 45 | |
46 | 46 | public static function mysqlVersion() { |
47 | 47 | |
48 | - if (!(DB::send("SELECT VERSION() as version") && DB::getLast()->status)) return false; |
|
48 | + if (!(DB::send("SELECT VERSION() as version") && DB::getLast()->status)) { |
|
49 | + return false; |
|
50 | + } |
|
49 | 51 | |
50 | 52 | return strval(DB::getLast()->getRow()['version']); |
51 | 53 | } |
@@ -88,9 +88,9 @@ discard block |
||
88 | 88 | |
89 | 89 | if (!$this->entity->init(Request::get('name'))) { |
90 | 90 | |
91 | - $query = (('' !== $this->parent->path()) ? ('?parent=' . $this->parent->path()) : ''); |
|
91 | + $query = (('' !== $this->parent->path()) ? ('?parent='.$this->parent->path()) : ''); |
|
92 | 92 | |
93 | - Request::redirect(INSTALL_PATH . '/admin/content/filemanager' . $query); |
|
93 | + Request::redirect(INSTALL_PATH.'/admin/content/filemanager'.$query); |
|
94 | 94 | } |
95 | 95 | |
96 | 96 | # Create form |
@@ -101,9 +101,9 @@ discard block |
||
101 | 101 | |
102 | 102 | if ($this->form->handle(new Filemanager\Controller\Rename($this->entity))) { |
103 | 103 | |
104 | - $query = ('?parent=' . $this->parent->path() . '&name=' . $this->entity->name() . '&submitted'); |
|
104 | + $query = ('?parent='.$this->parent->path().'&name='.$this->entity->name().'&submitted'); |
|
105 | 105 | |
106 | - Request::redirect(INSTALL_PATH . '/admin/content/filemanager/' . static::$type . $query); |
|
106 | + Request::redirect(INSTALL_PATH.'/admin/content/filemanager/'.static::$type.$query); |
|
107 | 107 | } |
108 | 108 | |
109 | 109 | # Display success message |
@@ -47,7 +47,9 @@ discard block |
||
47 | 47 | |
48 | 48 | # Check for demo mode |
49 | 49 | |
50 | - if (Informer::isDemoMode()) return $ajax->setError(Language::get('DEMO_MODE_RESTRICTION')); |
|
50 | + if (Informer::isDemoMode()) { |
|
51 | + return $ajax->setError(Language::get('DEMO_MODE_RESTRICTION')); |
|
52 | + } |
|
51 | 53 | |
52 | 54 | # Init entity |
53 | 55 | |
@@ -60,7 +62,9 @@ discard block |
||
60 | 62 | |
61 | 63 | if (Request::post('action') === 'remove') { |
62 | 64 | |
63 | - if (!$this->entity->remove()) return $ajax->setError(Language::get(static::$message_error_remove)); |
|
65 | + if (!$this->entity->remove()) { |
|
66 | + return $ajax->setError(Language::get(static::$message_error_remove)); |
|
67 | + } |
|
64 | 68 | } |
65 | 69 | |
66 | 70 | # ------------------------ |
@@ -82,7 +86,9 @@ discard block |
||
82 | 86 | |
83 | 87 | # Handle ajax request |
84 | 88 | |
85 | - if (Request::isAjax()) return $this->handleAjax(); |
|
89 | + if (Request::isAjax()) { |
|
90 | + return $this->handleAjax(); |
|
91 | + } |
|
86 | 92 | |
87 | 93 | # Init entity |
88 | 94 | |
@@ -108,7 +114,9 @@ discard block |
||
108 | 114 | |
109 | 115 | # Display success message |
110 | 116 | |
111 | - if (false !== Request::get('submitted')) Popup::set('positive', Language::get(static::$message_success_rename)); |
|
117 | + if (false !== Request::get('submitted')) { |
|
118 | + Popup::set('positive', Language::get(static::$message_success_rename)); |
|
119 | + } |
|
112 | 120 | |
113 | 121 | # ------------------------ |
114 | 122 |
@@ -61,11 +61,11 @@ discard block |
||
61 | 61 | |
62 | 62 | # Set link |
63 | 63 | |
64 | - $link = (INSTALL_PATH . static::$link . '/'); |
|
64 | + $link = (INSTALL_PATH.static::$link.'/'); |
|
65 | 65 | |
66 | - if (static::$nesting) $contents->link = ($link . ($this->create ? 'create' : 'edit') . '?id=' . $this->parent->id); |
|
66 | + if (static::$nesting) $contents->link = ($link.($this->create ? 'create' : 'edit').'?id='.$this->parent->id); |
|
67 | 67 | |
68 | - else $contents->link = ($link . ($this->create ? 'create' : ('edit?id=' . $this->entity->id))); |
|
68 | + else $contents->link = ($link.($this->create ? 'create' : ('edit?id='.$this->entity->id))); |
|
69 | 69 | |
70 | 70 | # Process parent block |
71 | 71 | |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | |
125 | 125 | # Redirect if entity not found |
126 | 126 | |
127 | - if (!$this->create && (0 === $this->entity->id)) return Request::redirect(INSTALL_PATH . static::$link); |
|
127 | + if (!$this->create && (0 === $this->entity->id)) return Request::redirect(INSTALL_PATH.static::$link); |
|
128 | 128 | |
129 | 129 | # Create form |
130 | 130 | |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | |
137 | 137 | if ($this->form->handle(new static::$controller($this->entity))) { |
138 | 138 | |
139 | - Request::redirect(INSTALL_PATH . static::$link . '/edit?id=' . $this->entity->id . '&submitted'); |
|
139 | + Request::redirect(INSTALL_PATH.static::$link.'/edit?id='.$this->entity->id.'&submitted'); |
|
140 | 140 | } |
141 | 141 | |
142 | 142 | # Display success message |
@@ -2,7 +2,15 @@ |
||
2 | 2 | |
3 | 3 | namespace Modules\Entitizer\Utils { |
4 | 4 | |
5 | - use Frames, Modules\Entitizer, Utils\Popup, Utils\View, Ajax, Language, Number, Request, Template; |
|
5 | + use Frames; |
|
6 | + use Modules\Entitizer; |
|
7 | + use Utils\Popup; |
|
8 | + use Utils\View; |
|
9 | + use Ajax; |
|
10 | + use Language; |
|
11 | + use Number; |
|
12 | + use Request; |
|
13 | + use Template; |
|
6 | 14 | |
7 | 15 | abstract class Handler extends Frames\Admin\Area\Authorized { |
8 | 16 |
@@ -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() { |
137 | 151 | |
138 | - if (!$this->create && Request::isAjax()) return $this->handleAjax(); |
|
152 | + if (!$this->create && Request::isAjax()) { |
|
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 | } |