@@ -12,7 +12,9 @@ discard block |
||
| 12 | 12 | |
| 13 | 13 | public function edit(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); |
| 18 | 20 | |
@@ -20,13 +22,19 @@ discard block |
||
| 20 | 22 | |
| 21 | 23 | DB::update(static::$table, $set, ['id' => $this->id]); |
| 22 | 24 | |
| 23 | - if (!(DB::last() && DB::last()->status)) return false; |
|
| 25 | + if (!(DB::last() && DB::last()->status)) { |
|
| 26 | + return false; |
|
| 27 | + } |
|
| 24 | 28 | |
| 25 | 29 | # Re-init entity |
| 26 | 30 | |
| 27 | - foreach ($set as $name => $value) $this->data[$name] = $value; |
|
| 31 | + foreach ($set as $name => $value) { |
|
| 32 | + $this->data[$name] = $value; |
|
| 33 | + } |
|
| 28 | 34 | |
| 29 | - if (static::$nesting) $this->data['path'] = $this->getPath(); |
|
| 35 | + if (static::$nesting) { |
|
| 36 | + $this->data['path'] = $this->getPath(); |
|
| 37 | + } |
|
| 30 | 38 | |
| 31 | 39 | # Implement entity |
| 32 | 40 | |
@@ -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,11 +32,15 @@ discard block |
||
| 32 | 32 | |
| 33 | 33 | $file_name = ($dir_name . $name . '/Config.php'); |
| 34 | 34 | |
| 35 | - if (!is_array($include = Explorer::php($file_name))) continue; |
|
| 35 | + if (!is_array($include = Explorer::php($file_name))) { |
|
| 36 | + continue; |
|
| 37 | + } |
|
| 36 | 38 | |
| 37 | 39 | $config = Arr::select($include, self::$data); |
| 38 | 40 | |
| 39 | - if (!(self::valid($config['name']) && ($config['name'] === $name))) continue; |
|
| 41 | + if (!(self::valid($config['name']) && ($config['name'] === $name))) { |
|
| 42 | + continue; |
|
| 43 | + } |
|
| 40 | 44 | |
| 41 | 45 | $items[$name] = $config; |
| 42 | 46 | } |
@@ -52,11 +56,19 @@ discard block |
||
| 52 | 56 | |
| 53 | 57 | $name = ''; $param = self::$param[self::$section]; |
| 54 | 58 | |
| 55 | - if (self::exists($name_cookie = Cookie::get($param))) $name = $name_cookie; |
|
| 59 | + if (self::exists($name_cookie = Cookie::get($param))) { |
|
| 60 | + $name = $name_cookie; |
|
| 61 | + } |
|
| 56 | 62 | |
| 57 | - if (self::exists($name_get = Request::get(self::$name))) $name = $name_get; |
|
| 63 | + if (self::exists($name_get = Request::get(self::$name))) { |
|
| 64 | + $name = $name_get; |
|
| 65 | + } |
|
| 58 | 66 | |
| 59 | - if ('' !== $name) Cookie::set($param, $name, self::$cookie_expires); else return false; |
|
| 67 | + if ('' !== $name) { |
|
| 68 | + Cookie::set($param, $name, self::$cookie_expires); |
|
| 69 | + } else { |
|
| 70 | + return false; |
|
| 71 | + } |
|
| 60 | 72 | |
| 61 | 73 | # ------------------------ |
| 62 | 74 | |
@@ -90,7 +102,9 @@ discard block |
||
| 90 | 102 | |
| 91 | 103 | $section = self::getSection($section); $dir_name = self::getDirName($section); |
| 92 | 104 | |
| 93 | - if (!Explorer::isDir($dir_name)) throw new Exception\General(self::$error_directory); |
|
| 105 | + if (!Explorer::isDir($dir_name)) { |
|
| 106 | + throw new Exception\General(self::$error_directory); |
|
| 107 | + } |
|
| 94 | 108 | |
| 95 | 109 | self::$section = $section; self::$dir_name = $dir_name; self::$items = self::getItems($dir_name); |
| 96 | 110 | |
@@ -98,11 +112,15 @@ discard block |
||
| 98 | 112 | |
| 99 | 113 | $primary = (self::exists(self::$default[$section]) ? self::$default[$section] : false); |
| 100 | 114 | |
| 101 | - if ($selectable && (false !== ($name = self::getUserDefined()))) $name_valid = true; |
|
| 102 | - |
|
| 103 | - else $name_valid = (self::exists($name = Settings::get($param)) || (false !== ($name = $primary))); |
|
| 115 | + if ($selectable && (false !== ($name = self::getUserDefined()))) { |
|
| 116 | + $name_valid = true; |
|
| 117 | + } else { |
|
| 118 | + $name_valid = (self::exists($name = Settings::get($param)) || (false !== ($name = $primary))); |
|
| 119 | + } |
|
| 104 | 120 | |
| 105 | - if (!($name_valid || (null !== ($name = key(self::$items))))) throw new Exception\General(self::$error_select); |
|
| 121 | + if (!($name_valid || (null !== ($name = key(self::$items))))) { |
|
| 122 | + throw new Exception\General(self::$error_select); |
|
| 123 | + } |
|
| 106 | 124 | |
| 107 | 125 | # ------------------------ |
| 108 | 126 | |
@@ -127,7 +145,9 @@ discard block |
||
| 127 | 145 | |
| 128 | 146 | public static function items(string $section = null) { |
| 129 | 147 | |
| 130 | - if (null === $section) return self::$items; |
|
| 148 | + if (null === $section) { |
|
| 149 | + return self::$items; |
|
| 150 | + } |
|
| 131 | 151 | |
| 132 | 152 | $section = self::getSection($section); $dir_name = self::getDirName($section); |
| 133 | 153 | |
@@ -152,7 +172,9 @@ discard block |
||
| 152 | 172 | |
| 153 | 173 | public static function path() { |
| 154 | 174 | |
| 155 | - if ('' === self::$active) return false; |
|
| 175 | + if ('' === self::$active) { |
|
| 176 | + return false; |
|
| 177 | + } |
|
| 156 | 178 | |
| 157 | 179 | return (self::$dir_name . self::$active . '/'); |
| 158 | 180 | } |
@@ -161,7 +183,9 @@ discard block |
||
| 161 | 183 | |
| 162 | 184 | public static function pathPrimary() { |
| 163 | 185 | |
| 164 | - if ('' === self::$primary) return false; |
|
| 186 | + if ('' === self::$primary) { |
|
| 187 | + return false; |
|
| 188 | + } |
|
| 165 | 189 | |
| 166 | 190 | return (self::$dir_name . self::$primary . '/'); |
| 167 | 191 | } |
@@ -170,9 +194,13 @@ discard block |
||
| 170 | 194 | |
| 171 | 195 | public static function data(string $name = null) { |
| 172 | 196 | |
| 173 | - if ('' === self::$active) return false; |
|
| 197 | + if ('' === self::$active) { |
|
| 198 | + return false; |
|
| 199 | + } |
|
| 174 | 200 | |
| 175 | - if (null === $name) return self::$items[self::$active]; |
|
| 201 | + if (null === $name) { |
|
| 202 | + return self::$items[self::$active]; |
|
| 203 | + } |
|
| 176 | 204 | |
| 177 | 205 | return (isset(self::$items[self::$active][$name]) ? self::$items[self::$active][$name] : false); |
| 178 | 206 | } |
@@ -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 | |