@@ -12,19 +12,27 @@ |
||
| 12 | 12 | |
| 13 | 13 | public function fill(array $data) { |
| 14 | 14 | |
| 15 | - if (0 !== $this->id) return false; |
|
| 15 | + if (0 !== $this->id) { |
|
| 16 | + return false; |
|
| 17 | + } |
|
| 16 | 18 | |
| 17 | 19 | $set = $this->getDataset($data, true); |
| 18 | 20 | |
| 19 | - if (!isset($set['id']) || !($set['id'] > 0)) return false; |
|
| 21 | + if (!isset($set['id']) || !($set['id'] > 0)) { |
|
| 22 | + return false; |
|
| 23 | + } |
|
| 20 | 24 | |
| 21 | 25 | # Re-init entity |
| 22 | 26 | |
| 23 | 27 | $this->error = false; $this->id = $set['id']; |
| 24 | 28 | |
| 25 | - foreach ($set as $name => $value) if ($name !== 'id') $this->data[$name] = $value; |
|
| 29 | + foreach ($set as $name => $value) { |
|
| 30 | + if ($name !== 'id') $this->data[$name] = $value; |
|
| 31 | + } |
|
| 26 | 32 | |
| 27 | - if (static::$nesting) $this->data['path'] = $this->getPath(); |
|
| 33 | + if (static::$nesting) { |
|
| 34 | + $this->data['path'] = $this->getPath(); |
|
| 35 | + } |
|
| 28 | 36 | |
| 29 | 37 | # Implement entity |
| 30 | 38 | |
@@ -22,9 +22,11 @@ discard block |
||
| 22 | 22 | |
| 23 | 23 | # Set edit button |
| 24 | 24 | |
| 25 | - if (0 === $this->parent->id) $parent->block('edit')->disable(); |
|
| 26 | - |
|
| 27 | - else $parent->block('edit')->id = $this->parent->id; |
|
| 25 | + if (0 === $this->parent->id) { |
|
| 26 | + $parent->block('edit')->disable(); |
|
| 27 | + } else { |
|
| 28 | + $parent->block('edit')->id = $this->parent->id; |
|
| 29 | + } |
|
| 28 | 30 | } |
| 29 | 31 | |
| 30 | 32 | # Get items block |
@@ -82,21 +84,29 @@ discard block |
||
| 82 | 84 | |
| 83 | 85 | # Set path |
| 84 | 86 | |
| 85 | - if (static::$nesting) $contents->path = $this->parent->path; |
|
| 87 | + if (static::$nesting) { |
|
| 88 | + $contents->path = $this->parent->path; |
|
| 89 | + } |
|
| 86 | 90 | |
| 87 | 91 | # Process parent block |
| 88 | 92 | |
| 89 | - if (static::$nesting && !$ajax) $this->processParent($contents->block('parent')); |
|
| 93 | + if (static::$nesting && !$ajax) { |
|
| 94 | + $this->processParent($contents->block('parent')); |
|
| 95 | + } |
|
| 90 | 96 | |
| 91 | 97 | # Set items |
| 92 | 98 | |
| 93 | 99 | $items = $this->getItemsBlock($ajax); |
| 94 | 100 | |
| 95 | - if ($items->count() > 0) $contents->items = $items; |
|
| 101 | + if ($items->count() > 0) { |
|
| 102 | + $contents->items = $items; |
|
| 103 | + } |
|
| 96 | 104 | |
| 97 | 105 | # Set pagination |
| 98 | 106 | |
| 99 | - if (!$ajax) $contents->pagination = $this->getPaginationBlock(); |
|
| 107 | + if (!$ajax) { |
|
| 108 | + $contents->pagination = $this->getPaginationBlock(); |
|
| 109 | + } |
|
| 100 | 110 | |
| 101 | 111 | # Add additional data for specific entity |
| 102 | 112 | |
@@ -115,7 +125,9 @@ discard block |
||
| 115 | 125 | |
| 116 | 126 | # Create parent entity |
| 117 | 127 | |
| 118 | - if (static::$nesting) $this->parent = Entitizer::get(static::$type, Number::format(Request::get('parent_id'))); |
|
| 128 | + if (static::$nesting) { |
|
| 129 | + $this->parent = Entitizer::get(static::$type, Number::format(Request::get('parent_id'))); |
|
| 130 | + } |
|
| 119 | 131 | |
| 120 | 132 | # Get children items |
| 121 | 133 | |
@@ -132,13 +144,17 @@ discard block |
||
| 132 | 144 | |
| 133 | 145 | public function handle() { |
| 134 | 146 | |
| 135 | - if (Request::isAjax()) return $this->handleAjax(); |
|
| 147 | + if (Request::isAjax()) { |
|
| 148 | + return $this->handleAjax(); |
|
| 149 | + } |
|
| 136 | 150 | |
| 137 | 151 | $this->index = Number::format(Request::get('index'), 1, 999999); |
| 138 | 152 | |
| 139 | 153 | # Create parent entity |
| 140 | 154 | |
| 141 | - if (static::$nesting) $this->parent = Entitizer::get(static::$type, Number::format(Request::get('parent_id'))); |
|
| 155 | + if (static::$nesting) { |
|
| 156 | + $this->parent = Entitizer::get(static::$type, Number::format(Request::get('parent_id'))); |
|
| 157 | + } |
|
| 142 | 158 | |
| 143 | 159 | # Get children items |
| 144 | 160 | |
@@ -2,7 +2,14 @@ |
||
| 2 | 2 | |
| 3 | 3 | namespace Modules\Entitizer\Utils { |
| 4 | 4 | |
| 5 | - use Modules\Entitizer, Utils\Pagination, Utils\View, Ajax, Number, Request, Template, Url; |
|
| 5 | + use Modules\Entitizer; |
|
| 6 | + use Utils\Pagination; |
|
| 7 | + use Utils\View; |
|
| 8 | + use Ajax; |
|
| 9 | + use Number; |
|
| 10 | + use Request; |
|
| 11 | + use Template; |
|
| 12 | + use Url; |
|
| 6 | 13 | |
| 7 | 14 | abstract class Listview { |
| 8 | 15 | |
@@ -23,11 +23,15 @@ discard block |
||
| 23 | 23 | |
| 24 | 24 | $name = Settings::get(self::$param[$this->section]); $primary = self::$default[$this->section]; |
| 25 | 25 | |
| 26 | - if (self::valid($name) && isset($items[$name])) $active = $name; |
|
| 27 | - |
|
| 28 | - else if (self::valid($primary) && isset($items[$primary])) $active = $primary; |
|
| 26 | + if (self::valid($name) && isset($items[$name])) { |
|
| 27 | + $active = $name; |
|
| 28 | + } else if (self::valid($primary) && isset($items[$primary])) { |
|
| 29 | + $active = $primary; |
|
| 30 | + } |
|
| 29 | 31 | |
| 30 | - foreach (array_keys($items) as $name) $items[$name]['active'] = ($name === $active); |
|
| 32 | + foreach (array_keys($items) as $name) { |
|
| 33 | + $items[$name]['active'] = ($name === $active); |
|
| 34 | + } |
|
| 31 | 35 | |
| 32 | 36 | # ------------------------ |
| 33 | 37 | |
@@ -73,12 +77,16 @@ discard block |
||
| 73 | 77 | |
| 74 | 78 | $items->add($item = View::get(self::$view_item)); |
| 75 | 79 | |
| 76 | - foreach (self::$data as $name) $item->$name = $extension[$name]; |
|
| 80 | + foreach (self::$data as $name) { |
|
| 81 | + $item->$name = $extension[$name]; |
|
| 82 | + } |
|
| 77 | 83 | |
| 78 | 84 | $item->class = ($extension['active'] ? 'positive' : 'grey'); |
| 79 | 85 | } |
| 80 | 86 | |
| 81 | - if ($items->count()) $contents->block('items', $items); |
|
| 87 | + if ($items->count()) { |
|
| 88 | + $contents->block('items', $items); |
|
| 89 | + } |
|
| 82 | 90 | |
| 83 | 91 | # ------------------------ |
| 84 | 92 | |
@@ -93,15 +101,21 @@ discard block |
||
| 93 | 101 | |
| 94 | 102 | # Check for demo mode |
| 95 | 103 | |
| 96 | - if (Informer::isDemoMode()) return $ajax->error(Language::get('DEMO_MODE_RESTRICTION')); |
|
| 104 | + if (Informer::isDemoMode()) { |
|
| 105 | + return $ajax->error(Language::get('DEMO_MODE_RESTRICTION')); |
|
| 106 | + } |
|
| 97 | 107 | |
| 98 | 108 | # Save configuration |
| 99 | 109 | |
| 100 | 110 | $param = self::$param[$this->section]; $name = Request::post('name'); |
| 101 | 111 | |
| 102 | - if (false === Settings::set($param, $name)) return $ajax->error(Language::get(self::$error_name)); |
|
| 112 | + if (false === Settings::set($param, $name)) { |
|
| 113 | + return $ajax->error(Language::get(self::$error_name)); |
|
| 114 | + } |
|
| 103 | 115 | |
| 104 | - if (false === Settings::save()) return $ajax->error(Language::get(self::$error_save)); |
|
| 116 | + if (false === Settings::save()) { |
|
| 117 | + return $ajax->error(Language::get(self::$error_save)); |
|
| 118 | + } |
|
| 105 | 119 | |
| 106 | 120 | # ------------------------ |
| 107 | 121 | |
@@ -116,7 +130,9 @@ discard block |
||
| 116 | 130 | |
| 117 | 131 | $this->items = $this->getHandlerItems(); |
| 118 | 132 | |
| 119 | - if (Request::isAjax()) return $this->handleAjax(); |
|
| 133 | + if (Request::isAjax()) { |
|
| 134 | + return $this->handleAjax(); |
|
| 135 | + } |
|
| 120 | 136 | |
| 121 | 137 | # ------------------------ |
| 122 | 138 | |
@@ -32,10 +32,12 @@ discard block |
||
| 32 | 32 | |
| 33 | 33 | $languages = [Extend\Languages::pathPrimary(), Extend\Languages::path()]; |
| 34 | 34 | |
| 35 | - foreach (array_unique($languages) as $path) foreach (static::PHRASES as $name) { |
|
| 35 | + foreach (array_unique($languages) as $path) { |
|
| 36 | + foreach (static::PHRASES as $name) { |
|
| 36 | 37 | |
| 37 | 38 | Language::load($path . 'Phrases/' . $name . '.php'); |
| 38 | 39 | } |
| 40 | + } |
|
| 39 | 41 | |
| 40 | 42 | # Set template globals |
| 41 | 43 | |
@@ -57,7 +59,9 @@ discard block |
||
| 57 | 59 | |
| 58 | 60 | # Set timezone |
| 59 | 61 | |
| 60 | - if (Auth::check() && ('' !== ($timezone = Auth::user()->timezone))) date_default_timezone_set($timezone); |
|
| 62 | + if (Auth::check() && ('' !== ($timezone = Auth::user()->timezone))) { |
|
| 63 | + date_default_timezone_set($timezone); |
|
| 64 | + } |
|
| 61 | 65 | |
| 62 | 66 | # ------------------------ |
| 63 | 67 | |
@@ -147,20 +147,29 @@ discard block |
||
| 147 | 147 | |
| 148 | 148 | if ($this instanceof Component\Install) { |
| 149 | 149 | |
| 150 | - if (Template::isBlock($result = $this->handle())) return $this->displayForm($result, STATUS_CODE_200); |
|
| 150 | + if (Template::isBlock($result = $this->handle())) { |
|
| 151 | + return $this->displayForm($result, STATUS_CODE_200); |
|
| 152 | + } |
|
| 151 | 153 | } |
| 152 | 154 | |
| 153 | 155 | # Handle auth component request |
| 154 | 156 | |
| 155 | 157 | else if ($this instanceof Component\Auth) { |
| 156 | 158 | |
| 157 | - if (Auth::check()) Request::redirect(INSTALL_PATH . '/admin'); |
|
| 158 | - |
|
| 159 | - if ($this instanceof Component\Auth\Initial) { if (!Auth::initial()) Request::redirect(INSTALL_PATH . '/admin/login'); } |
|
| 159 | + if (Auth::check()) { |
|
| 160 | + Request::redirect(INSTALL_PATH . '/admin'); |
|
| 161 | + } |
|
| 160 | 162 | |
| 161 | - else if (Auth::initial()) Request::redirect(INSTALL_PATH . '/admin/register'); |
|
| 163 | + if ($this instanceof Component\Auth\Initial) { if (!Auth::initial()) { |
|
| 164 | + Request::redirect(INSTALL_PATH . '/admin/login'); |
|
| 165 | + } |
|
| 166 | + } else if (Auth::initial()) { |
|
| 167 | + Request::redirect(INSTALL_PATH . '/admin/register'); |
|
| 168 | + } |
|
| 162 | 169 | |
| 163 | - if (Template::isBlock($result = $this->handle())) return $this->displayForm($result, STATUS_CODE_401); |
|
| 170 | + if (Template::isBlock($result = $this->handle())) { |
|
| 171 | + return $this->displayForm($result, STATUS_CODE_401); |
|
| 172 | + } |
|
| 164 | 173 | } |
| 165 | 174 | |
| 166 | 175 | # Handle panel component request |
@@ -172,9 +181,13 @@ discard block |
||
| 172 | 181 | Request::redirect(INSTALL_PATH . '/admin/login'); |
| 173 | 182 | } |
| 174 | 183 | |
| 175 | - if (Template::isBlock($result = $this->handle())) return $this->displayPage($result); |
|
| 184 | + if (Template::isBlock($result = $this->handle())) { |
|
| 185 | + return $this->displayPage($result); |
|
| 186 | + } |
|
| 176 | 187 | |
| 177 | - if (Ajax::isResponse($result)) return Ajax::output($result); |
|
| 188 | + if (Ajax::isResponse($result)) { |
|
| 189 | + return Ajax::output($result); |
|
| 190 | + } |
|
| 178 | 191 | } |
| 179 | 192 | } |
| 180 | 193 | |
@@ -40,7 +40,9 @@ discard block |
||
| 40 | 40 | |
| 41 | 41 | if (Settings::get('users_registration')) { |
| 42 | 42 | |
| 43 | - if (!Auth::check()) $layout->block('auth')->enable(); else { |
|
| 43 | + if (!Auth::check()) { |
|
| 44 | + $layout->block('auth')->enable(); |
|
| 45 | + } else { |
|
| 44 | 46 | |
| 45 | 47 | $layout->block('user')->enable(); |
| 46 | 48 | |
@@ -48,7 +50,9 @@ discard block |
||
| 48 | 50 | |
| 49 | 51 | $layout->block('user')->name = Auth::user()->name; |
| 50 | 52 | |
| 51 | - if (Auth::user()->rank === RANK_ADMINISTRATOR) $layout->block('user')->block('admin')->enable(); |
|
| 53 | + if (Auth::user()->rank === RANK_ADMINISTRATOR) { |
|
| 54 | + $layout->block('user')->block('admin')->enable(); |
|
| 55 | + } |
|
| 52 | 56 | } |
| 53 | 57 | } |
| 54 | 58 | |
@@ -109,9 +113,11 @@ discard block |
||
| 109 | 113 | |
| 110 | 114 | # Set canonical |
| 111 | 115 | |
| 112 | - if ('' === $this->canonical) $page->block('canonical')->disable(); |
|
| 113 | - |
|
| 114 | - else $page->block('canonical')->link = $this->canonical; |
|
| 116 | + if ('' === $this->canonical) { |
|
| 117 | + $page->block('canonical')->disable(); |
|
| 118 | + } else { |
|
| 119 | + $page->block('canonical')->link = $this->canonical; |
|
| 120 | + } |
|
| 115 | 121 | |
| 116 | 122 | # Set layout |
| 117 | 123 | |
@@ -128,19 +134,27 @@ discard block |
||
| 128 | 134 | |
| 129 | 135 | # Check site status |
| 130 | 136 | |
| 131 | - if (Settings::get('site_status') === STATUS_MAINTENANCE) return Status::maintenance(); |
|
| 137 | + if (Settings::get('site_status') === STATUS_MAINTENANCE) { |
|
| 138 | + return Status::maintenance(); |
|
| 139 | + } |
|
| 132 | 140 | |
| 133 | - if (Settings::get('site_status') === STATUS_UPDATE) return Status::update(); |
|
| 141 | + if (Settings::get('site_status') === STATUS_UPDATE) { |
|
| 142 | + return Status::update(); |
|
| 143 | + } |
|
| 134 | 144 | |
| 135 | 145 | # Check access rights |
| 136 | 146 | |
| 137 | 147 | if ($this instanceof Component\Profile) { |
| 138 | 148 | |
| 139 | - if (!Settings::get('users_registration')) return Status::error404(); |
|
| 149 | + if (!Settings::get('users_registration')) { |
|
| 150 | + return Status::error404(); |
|
| 151 | + } |
|
| 140 | 152 | |
| 141 | 153 | if (($this instanceof Component\Profile\Auth)) { |
| 142 | 154 | |
| 143 | - if (Auth::check()) Request::redirect(INSTALL_PATH . '/profile'); |
|
| 155 | + if (Auth::check()) { |
|
| 156 | + Request::redirect(INSTALL_PATH . '/profile'); |
|
| 157 | + } |
|
| 144 | 158 | |
| 145 | 159 | } else if (!Auth::check() || ((false !== Request::get('logout')) && Auth::logout())) { |
| 146 | 160 | |
@@ -156,9 +170,13 @@ discard block |
||
| 156 | 170 | |
| 157 | 171 | $variables = new Variables(); $widgets = new Widgets(); |
| 158 | 172 | |
| 159 | - foreach ($variables->items() as $name => $value) Template::global($name, $value); |
|
| 173 | + foreach ($variables->items() as $name => $value) { |
|
| 174 | + Template::global($name, $value); |
|
| 175 | + } |
|
| 160 | 176 | |
| 161 | - foreach ($widgets->items() as $name => $block) Template::widget($name, $block); |
|
| 177 | + foreach ($widgets->items() as $name => $block) { |
|
| 178 | + Template::widget($name, $block); |
|
| 179 | + } |
|
| 162 | 180 | |
| 163 | 181 | # Display page |
| 164 | 182 | |
@@ -14,7 +14,9 @@ discard block |
||
| 14 | 14 | |
| 15 | 15 | for ($index = ($active - 2); $index <= ($active + 2); $index++) { |
| 16 | 16 | |
| 17 | - if (!($index > 0 && $index <= $count)) continue; |
|
| 17 | + if (!($index > 0 && $index <= $count)) { |
|
| 18 | + continue; |
|
| 19 | + } |
|
| 18 | 20 | |
| 19 | 21 | $class = (($index === $active) ? 'active item' : 'item'); |
| 20 | 22 | |
@@ -41,7 +43,9 @@ discard block |
||
| 41 | 43 | |
| 42 | 44 | $block->link = $url->set('index', $index)->get(); $block->index = $index; |
| 43 | 45 | |
| 44 | - if ($closest) $block->block('ellipsis')->disable(); |
|
| 46 | + if ($closest) { |
|
| 47 | + $block->block('ellipsis')->disable(); |
|
| 48 | + } |
|
| 45 | 49 | } |
| 46 | 50 | } |
| 47 | 51 | |
@@ -58,9 +62,9 @@ discard block |
||
| 58 | 62 | |
| 59 | 63 | list ($extremum, $index) = $data; $block = $pagination->block($class); |
| 60 | 64 | |
| 61 | - if ($active === $extremum) { $block->disable(); $pagination->block($class . '_disabled')->enable(); } |
|
| 62 | - |
|
| 63 | - else $block->link = $url->set('index', $index)->get(); |
|
| 65 | + if ($active === $extremum) { $block->disable(); $pagination->block($class . '_disabled')->enable(); } else { |
|
| 66 | + $block->link = $url->set('index', $index)->get(); |
|
| 67 | + } |
|
| 64 | 68 | } |
| 65 | 69 | } |
| 66 | 70 | |
@@ -68,9 +72,13 @@ discard block |
||
| 68 | 72 | |
| 69 | 73 | public static function block(int $index, int $display, int $total, Url $url) { |
| 70 | 74 | |
| 71 | - if (($index <= 0) || ($display <= 0) || ($total <= 0)) return false; |
|
| 75 | + if (($index <= 0) || ($display <= 0) || ($total <= 0)) { |
|
| 76 | + return false; |
|
| 77 | + } |
|
| 72 | 78 | |
| 73 | - if (($display >= $total) || ($index > ($count = ceil($total / $display)))) return false; |
|
| 79 | + if (($display >= $total) || ($index > ($count = ceil($total / $display)))) { |
|
| 80 | + return false; |
|
| 81 | + } |
|
| 74 | 82 | |
| 75 | 83 | # Create block |
| 76 | 84 | |
@@ -12,11 +12,15 @@ discard block |
||
| 12 | 12 | |
| 13 | 13 | private static function setMessage(string $type, string $text, string $header = null) { |
| 14 | 14 | |
| 15 | - if (('' === $text) || isset(self::$messages[$type])) return; |
|
| 15 | + if (('' === $text) || isset(self::$messages[$type])) { |
|
| 16 | + return; |
|
| 17 | + } |
|
| 16 | 18 | |
| 17 | 19 | self::$messages[$type] = ['text' => $text, 'header' => null]; |
| 18 | 20 | |
| 19 | - if ((null !== $header) && ('' !== $header)) self::$messages[$type]['header'] = $header; |
|
| 21 | + if ((null !== $header) && ('' !== $header)) { |
|
| 22 | + self::$messages[$type]['header'] = $header; |
|
| 23 | + } |
|
| 20 | 24 | } |
| 21 | 25 | |
| 22 | 26 | # Init messages |
@@ -30,7 +34,9 @@ discard block |
||
| 30 | 34 | |
| 31 | 35 | public static function info(string $text = null, string $header = null) { |
| 32 | 36 | |
| 33 | - if (null === $text) return (self::$messages['info'] ?? false); |
|
| 37 | + if (null === $text) { |
|
| 38 | + return (self::$messages['info'] ?? false); |
|
| 39 | + } |
|
| 34 | 40 | |
| 35 | 41 | self::setMessage('info', $text, $header); |
| 36 | 42 | } |
@@ -39,7 +45,9 @@ discard block |
||
| 39 | 45 | |
| 40 | 46 | public static function warning(string $text = null, string $header = null) { |
| 41 | 47 | |
| 42 | - if (null === $text) return (self::$messages['warning'] ?? false); |
|
| 48 | + if (null === $text) { |
|
| 49 | + return (self::$messages['warning'] ?? false); |
|
| 50 | + } |
|
| 43 | 51 | |
| 44 | 52 | self::setMessage('warning', $text, $header); |
| 45 | 53 | } |
@@ -48,7 +56,9 @@ discard block |
||
| 48 | 56 | |
| 49 | 57 | public static function error(string $text = null, string $header = null) { |
| 50 | 58 | |
| 51 | - if (null === $text) return (self::$messages['error'] ?? false); |
|
| 59 | + if (null === $text) { |
|
| 60 | + return (self::$messages['error'] ?? false); |
|
| 61 | + } |
|
| 52 | 62 | |
| 53 | 63 | self::setMessage('error', $text, $header); |
| 54 | 64 | } |
@@ -57,7 +67,9 @@ discard block |
||
| 57 | 67 | |
| 58 | 68 | public static function success(string $text = null, string $header = null) { |
| 59 | 69 | |
| 60 | - if (null === $text) return (self::$messages['success'] ?? false); |
|
| 70 | + if (null === $text) { |
|
| 71 | + return (self::$messages['success'] ?? false); |
|
| 72 | + } |
|
| 61 | 73 | |
| 62 | 74 | self::setMessage('success', $text, $header); |
| 63 | 75 | } |
@@ -74,7 +86,11 @@ discard block |
||
| 74 | 86 | |
| 75 | 87 | $block->type = $type; $block->text = Template::block($message['text']); $header = $block->block('header'); |
| 76 | 88 | |
| 77 | - if (isset($message['header'])) $header->text = $message['header']; else $header->disable(); |
|
| 89 | + if (isset($message['header'])) { |
|
| 90 | + $header->text = $message['header']; |
|
| 91 | + } else { |
|
| 92 | + $header->disable(); |
|
| 93 | + } |
|
| 78 | 94 | } |
| 79 | 95 | |
| 80 | 96 | # ------------------------ |
@@ -20,7 +20,9 @@ discard block |
||
| 20 | 20 | |
| 21 | 21 | $item->children = ($children = Template::group()); |
| 22 | 22 | |
| 23 | - foreach ($this->items[$id]['children'] as $child) $children->add($this->parseItem($child)); |
|
| 23 | + foreach ($this->items[$id]['children'] as $child) { |
|
| 24 | + $children->add($this->parseItem($child)); |
|
| 25 | + } |
|
| 24 | 26 | |
| 25 | 27 | } else { |
| 26 | 28 | |
@@ -46,7 +48,9 @@ discard block |
||
| 46 | 48 | |
| 47 | 49 | ("FROM " . TABLE_MENU . " men ORDER BY men.parent_id ASC, men.position ASC, men.id ASC"); |
| 48 | 50 | |
| 49 | - if (!(DB::send($query) && DB::last()->status)) return; |
|
| 51 | + if (!(DB::send($query) && DB::last()->status)) { |
|
| 52 | + return; |
|
| 53 | + } |
|
| 50 | 54 | |
| 51 | 55 | # Process results |
| 52 | 56 | |
@@ -57,9 +61,13 @@ discard block |
||
| 57 | 61 | $this->items[$entity->id()] = $entity->data(); |
| 58 | 62 | } |
| 59 | 63 | |
| 60 | - foreach ($this->items as $id => $item) if (0 === $item['parent_id']) $this->menu[] = $id; |
|
| 64 | + foreach ($this->items as $id => $item) { |
|
| 65 | + if (0 === $item['parent_id']) $this->menu[] = $id; |
|
| 66 | + } |
|
| 61 | 67 | |
| 62 | - else if (isset($this->items[$item['parent_id']])) $this->items[$item['parent_id']]['children'][] = $id; |
|
| 68 | + else if (isset($this->items[$item['parent_id']])) { |
|
| 69 | + $this->items[$item['parent_id']]['children'][] = $id; |
|
| 70 | + } |
|
| 63 | 71 | } |
| 64 | 72 | |
| 65 | 73 | # Get block |
@@ -68,7 +76,9 @@ discard block |
||
| 68 | 76 | |
| 69 | 77 | $menu = Template::group(); |
| 70 | 78 | |
| 71 | - foreach ($this->menu as $id) $menu->add($this->parseItem($id)); |
|
| 79 | + foreach ($this->menu as $id) { |
|
| 80 | + $menu->add($this->parseItem($id)); |
|
| 81 | + } |
|
| 72 | 82 | |
| 73 | 83 | # ------------------------ |
| 74 | 84 | |