@@ -133,7 +133,7 @@ |
||
| 133 | 133 | /** |
| 134 | 134 | * Get the active item data or a specific param value |
| 135 | 135 | * |
| 136 | - * @return array|mixed|false : the data array, the param value, or false if the active item was not loaded |
|
| 136 | + * @return string : the data array, the param value, or false if the active item was not loaded |
|
| 137 | 137 | */ |
| 138 | 138 | |
| 139 | 139 | public function get(string $param = null) { |
@@ -34,11 +34,15 @@ discard block |
||
| 34 | 34 | |
| 35 | 35 | protected function loadFirst() { |
| 36 | 36 | |
| 37 | - if ($this->loaded) return ($this->items[key($this->items)] ?? null); |
|
| 37 | + if ($this->loaded) { |
|
| 38 | + return ($this->items[key($this->items)] ?? null); |
|
| 39 | + } |
|
| 38 | 40 | |
| 39 | 41 | foreach (Explorer::iterateDirs($this->dir_name) as $name) { |
| 40 | 42 | |
| 41 | - if (null !== ($data = $this->loadItem($name))) return $data; |
|
| 43 | + if (null !== ($data = $this->loadItem($name))) { |
|
| 44 | + return $data; |
|
| 45 | + } |
|
| 42 | 46 | } |
| 43 | 47 | |
| 44 | 48 | # ------------------------ |
@@ -97,9 +101,13 @@ discard block |
||
| 97 | 101 | |
| 98 | 102 | public function activate(string $name, bool $save = false) : bool { |
| 99 | 103 | |
| 100 | - if (null === ($data = $this->loadItem($name))) return false; |
|
| 104 | + if (null === ($data = $this->loadItem($name))) { |
|
| 105 | + return false; |
|
| 106 | + } |
|
| 101 | 107 | |
| 102 | - if ($save && ((!Settings::set(static::$param[$this->section], $name)) || !Settings::save())) return false; |
|
| 108 | + if ($save && ((!Settings::set(static::$param[$this->section], $name)) || !Settings::save())) { |
|
| 109 | + return false; |
|
| 110 | + } |
|
| 103 | 111 | |
| 104 | 112 | $this->active = $data; |
| 105 | 113 | |
@@ -125,7 +133,9 @@ discard block |
||
| 125 | 133 | |
| 126 | 134 | public function getPrimary(string $param = null) { |
| 127 | 135 | |
| 128 | - if (null !== $param) return ($this->primary[$param] ?? false); |
|
| 136 | + if (null !== $param) { |
|
| 137 | + return ($this->primary[$param] ?? false); |
|
| 138 | + } |
|
| 129 | 139 | |
| 130 | 140 | return ($this->primary ?? false); |
| 131 | 141 | } |
@@ -138,7 +148,9 @@ discard block |
||
| 138 | 148 | |
| 139 | 149 | public function get(string $param = null) { |
| 140 | 150 | |
| 141 | - if (null !== $param) return ($this->active[$param] ?? false); |
|
| 151 | + if (null !== $param) { |
|
| 152 | + return ($this->active[$param] ?? false); |
|
| 153 | + } |
|
| 142 | 154 | |
| 143 | 155 | return ($this->active ?? false); |
| 144 | 156 | } |
@@ -60,7 +60,7 @@ |
||
| 60 | 60 | /** |
| 61 | 61 | * Save an uploaded file |
| 62 | 62 | * |
| 63 | - * @return true|string|false : true on success, an error code on failure, or false if there are no uploaded files |
|
| 63 | + * @return string|boolean : true on success, an error code on failure, or false if there are no uploaded files |
|
| 64 | 64 | */ |
| 65 | 65 | |
| 66 | 66 | public static function save(string $name, string $dir_name) { |
@@ -21,19 +21,33 @@ discard block |
||
| 21 | 21 | |
| 22 | 22 | private static function getErrorCode(int $error) : string { |
| 23 | 23 | |
| 24 | - if ($error === UPLOAD_ERR_INI_SIZE) return 'UPLOADER_ERROR_INI_SIZE'; |
|
| 24 | + if ($error === UPLOAD_ERR_INI_SIZE) { |
|
| 25 | + return 'UPLOADER_ERROR_INI_SIZE'; |
|
| 26 | + } |
|
| 25 | 27 | |
| 26 | - if ($error === UPLOAD_ERR_FORM_SIZE) return 'UPLOADER_ERROR_FORM_SIZE'; |
|
| 28 | + if ($error === UPLOAD_ERR_FORM_SIZE) { |
|
| 29 | + return 'UPLOADER_ERROR_FORM_SIZE'; |
|
| 30 | + } |
|
| 27 | 31 | |
| 28 | - if ($error === UPLOAD_ERR_PARTIAL) return 'UPLOADER_ERROR_PARTIAL'; |
|
| 32 | + if ($error === UPLOAD_ERR_PARTIAL) { |
|
| 33 | + return 'UPLOADER_ERROR_PARTIAL'; |
|
| 34 | + } |
|
| 29 | 35 | |
| 30 | - if ($error === UPLOAD_ERR_NO_FILE) return 'UPLOADER_ERROR_NO_FILE'; |
|
| 36 | + if ($error === UPLOAD_ERR_NO_FILE) { |
|
| 37 | + return 'UPLOADER_ERROR_NO_FILE'; |
|
| 38 | + } |
|
| 31 | 39 | |
| 32 | - if ($error === UPLOAD_ERR_NO_TMP_DIR) return 'UPLOADER_ERROR_NO_TMP_DIR'; |
|
| 40 | + if ($error === UPLOAD_ERR_NO_TMP_DIR) { |
|
| 41 | + return 'UPLOADER_ERROR_NO_TMP_DIR'; |
|
| 42 | + } |
|
| 33 | 43 | |
| 34 | - if ($error === UPLOAD_ERR_CANT_WRITE) return 'UPLOADER_ERROR_CANT_WRITE'; |
|
| 44 | + if ($error === UPLOAD_ERR_CANT_WRITE) { |
|
| 45 | + return 'UPLOADER_ERROR_CANT_WRITE'; |
|
| 46 | + } |
|
| 35 | 47 | |
| 36 | - if ($error === UPLOAD_ERR_EXTENSION) return 'UPLOADER_ERROR_EXTENSION'; |
|
| 48 | + if ($error === UPLOAD_ERR_EXTENSION) { |
|
| 49 | + return 'UPLOADER_ERROR_EXTENSION'; |
|
| 50 | + } |
|
| 37 | 51 | |
| 38 | 52 | # ------------------------ |
| 39 | 53 | |
@@ -50,7 +64,11 @@ discard block |
||
| 50 | 64 | |
| 51 | 65 | $text = Language::get($phrase); |
| 52 | 66 | |
| 53 | - if (!$popup) Messages::set('error', $text); else Popup::set('negative', $text); |
|
| 67 | + if (!$popup) { |
|
| 68 | + Messages::set('error', $text); |
|
| 69 | + } else { |
|
| 70 | + Popup::set('negative', $text); |
|
| 71 | + } |
|
| 54 | 72 | |
| 55 | 73 | # ------------------------ |
| 56 | 74 | |
@@ -65,19 +83,27 @@ discard block |
||
| 65 | 83 | |
| 66 | 84 | public static function save(string $name, string $dir_name) { |
| 67 | 85 | |
| 68 | - if (false === ($file = Request::file($name))) return false; |
|
| 86 | + if (false === ($file = Request::file($name))) { |
|
| 87 | + return false; |
|
| 88 | + } |
|
| 69 | 89 | |
| 70 | 90 | # Check for upload errors |
| 71 | 91 | |
| 72 | - if ($file['error'] !== UPLOAD_ERR_OK) return self::getErrorCode($file['error']); |
|
| 92 | + if ($file['error'] !== UPLOAD_ERR_OK) { |
|
| 93 | + return self::getErrorCode($file['error']); |
|
| 94 | + } |
|
| 73 | 95 | |
| 74 | 96 | # Check for secure upload |
| 75 | 97 | |
| 76 | - if (!is_uploaded_file($file['tmp_name'])) return 'UPLOADER_ERROR_SECURITY'; |
|
| 98 | + if (!is_uploaded_file($file['tmp_name'])) { |
|
| 99 | + return 'UPLOADER_ERROR_SECURITY'; |
|
| 100 | + } |
|
| 77 | 101 | |
| 78 | 102 | # Check size |
| 79 | 103 | |
| 80 | - if ($file['size'] > CONFIG_UPLOADS_MAX_SIZE) return 'UPLOADER_ERROR_SIZE'; |
|
| 104 | + if ($file['size'] > CONFIG_UPLOADS_MAX_SIZE) { |
|
| 105 | + return 'UPLOADER_ERROR_SIZE'; |
|
| 106 | + } |
|
| 81 | 107 | |
| 82 | 108 | # Check file extension |
| 83 | 109 | |
@@ -85,21 +111,29 @@ discard block |
||
| 85 | 111 | |
| 86 | 112 | $extension = strtolower(Explorer::getExtension($file['name'], false)); |
| 87 | 113 | |
| 88 | - if (in_array($extension, $extensions, true)) return 'UPLOADER_ERROR_TYPE'; |
|
| 114 | + if (in_array($extension, $extensions, true)) { |
|
| 115 | + return 'UPLOADER_ERROR_TYPE'; |
|
| 116 | + } |
|
| 89 | 117 | |
| 90 | 118 | # Check target directory |
| 91 | 119 | |
| 92 | - if (!Explorer::isDir($dir_name) && !Explorer::createDir($dir_name)) return 'UPLOADER_ERROR_DIR'; |
|
| 120 | + if (!Explorer::isDir($dir_name) && !Explorer::createDir($dir_name)) { |
|
| 121 | + return 'UPLOADER_ERROR_DIR'; |
|
| 122 | + } |
|
| 93 | 123 | |
| 94 | 124 | # Check target file |
| 95 | 125 | |
| 96 | 126 | $base_name = basename($file['name']); $file_name = ($dir_name . '/' . $base_name); |
| 97 | 127 | |
| 98 | - if (Explorer::isDir($file_name) || Explorer::isFile($file_name)) return 'UPLOADER_ERROR_EXISTS'; |
|
| 128 | + if (Explorer::isDir($file_name) || Explorer::isFile($file_name)) { |
|
| 129 | + return 'UPLOADER_ERROR_EXISTS'; |
|
| 130 | + } |
|
| 99 | 131 | |
| 100 | 132 | # Save uploaded file |
| 101 | 133 | |
| 102 | - if (!@move_uploaded_file($file['tmp_name'], $file_name)) return 'UPLOADER_ERROR_SAVE'; |
|
| 134 | + if (!@move_uploaded_file($file['tmp_name'], $file_name)) { |
|
| 135 | + return 'UPLOADER_ERROR_SAVE'; |
|
| 136 | + } |
|
| 103 | 137 | |
| 104 | 138 | # Set upload data |
| 105 | 139 | |
@@ -122,7 +156,9 @@ discard block |
||
| 122 | 156 | |
| 123 | 157 | $result = self::save($name, $dir_name); |
| 124 | 158 | |
| 125 | - if (is_string($result)) return self::displayError($result, $popup); |
|
| 159 | + if (is_string($result)) { |
|
| 160 | + return self::displayError($result, $popup); |
|
| 161 | + } |
|
| 126 | 162 | |
| 127 | 163 | # ------------------------ |
| 128 | 164 | |
@@ -92,7 +92,7 @@ |
||
| 92 | 92 | |
| 93 | 93 | if (false === ($handler = self::parseString($route['handler'], REGEX_MAP_ITEM_HANDLER))) return; |
| 94 | 94 | |
| 95 | - self::$routes['/' . implode('/', $path)] = ('Addons\\' . $name . '\\' . implode('\\', $handler)); |
|
| 95 | + self::$routes['/'.implode('/', $path)] = ('Addons\\'.$name.'\\'.implode('\\', $handler)); |
|
| 96 | 96 | } |
| 97 | 97 | |
| 98 | 98 | /** |
@@ -75,7 +75,9 @@ discard block |
||
| 75 | 75 | |
| 76 | 76 | $parts = preg_split('/\//', $string, 0, PREG_SPLIT_NO_EMPTY); |
| 77 | 77 | |
| 78 | - foreach ($parts as $name) if (!preg_match($regex, $name)) return false; |
|
| 78 | + foreach ($parts as $name) { |
|
| 79 | + if (!preg_match($regex, $name)) return false; |
|
| 80 | + } |
|
| 79 | 81 | |
| 80 | 82 | # ------------------------ |
| 81 | 83 | |
@@ -88,9 +90,13 @@ discard block |
||
| 88 | 90 | |
| 89 | 91 | private static function parseRoute(string $name, array $route) { |
| 90 | 92 | |
| 91 | - if (false === ($path = self::parseString($route['path'], REGEX_MAP_ITEM_PATH))) return; |
|
| 93 | + if (false === ($path = self::parseString($route['path'], REGEX_MAP_ITEM_PATH))) { |
|
| 94 | + return; |
|
| 95 | + } |
|
| 92 | 96 | |
| 93 | - if (false === ($handler = self::parseString($route['handler'], REGEX_MAP_ITEM_HANDLER))) return; |
|
| 97 | + if (false === ($handler = self::parseString($route['handler'], REGEX_MAP_ITEM_HANDLER))) { |
|
| 98 | + return; |
|
| 99 | + } |
|
| 94 | 100 | |
| 95 | 101 | self::$routes['/' . implode('/', $path)] = ('Addons\\' . $name . '\\' . implode('\\', $handler)); |
| 96 | 102 | } |
@@ -103,7 +109,9 @@ discard block |
||
| 103 | 109 | |
| 104 | 110 | foreach (Extend\Addons::getItems() as $item) { |
| 105 | 111 | |
| 106 | - foreach ($item['routes'] as $route) self::parseRoute($item['name'], $route); |
|
| 112 | + foreach ($item['routes'] as $route) { |
|
| 113 | + self::parseRoute($item['name'], $route); |
|
| 114 | + } |
|
| 107 | 115 | } |
| 108 | 116 | } |
| 109 | 117 | |
@@ -29,7 +29,9 @@ discard block |
||
| 29 | 29 | |
| 30 | 30 | $item->children = ($children = Template::createBlock()); |
| 31 | 31 | |
| 32 | - foreach ($this->menu[$id]['children'] as $child) $children->addItem($this->parseItem($child)); |
|
| 32 | + foreach ($this->menu[$id]['children'] as $child) { |
|
| 33 | + $children->addItem($this->parseItem($child)); |
|
| 34 | + } |
|
| 33 | 35 | |
| 34 | 36 | } else { |
| 35 | 37 | |
@@ -55,7 +57,9 @@ discard block |
||
| 55 | 57 | |
| 56 | 58 | $menu = Entitizer::getTreeview(TABLE_MENU)->getSubtree(0, ['active' => true]); |
| 57 | 59 | |
| 58 | - if (false !== $menu) $this->menu = $menu; |
|
| 60 | + if (false !== $menu) { |
|
| 61 | + $this->menu = $menu; |
|
| 62 | + } |
|
| 59 | 63 | } |
| 60 | 64 | |
| 61 | 65 | /** |
@@ -66,7 +70,9 @@ discard block |
||
| 66 | 70 | |
| 67 | 71 | $menu = Template::createBlock(); |
| 68 | 72 | |
| 69 | - foreach ($this->menu[0]['children'] as $id) $menu->addItem($this->parseItem($id)); |
|
| 73 | + foreach ($this->menu[0]['children'] as $id) { |
|
| 74 | + $menu->addItem($this->parseItem($id)); |
|
| 75 | + } |
|
| 70 | 76 | |
| 71 | 77 | # ------------------------ |
| 72 | 78 | |
@@ -27,7 +27,9 @@ discard block |
||
| 27 | 27 | |
| 28 | 28 | protected function addArray(string $name) { |
| 29 | 29 | |
| 30 | - if ('' !== $name) return $this->properties[$name] = new _Array; |
|
| 30 | + if ('' !== $name) { |
|
| 31 | + return $this->properties[$name] = new _Array; |
|
| 32 | + } |
|
| 31 | 33 | } |
| 32 | 34 | |
| 33 | 35 | /** |
@@ -36,7 +38,9 @@ discard block |
||
| 36 | 38 | |
| 37 | 39 | protected function addBoolean(string $name) { |
| 38 | 40 | |
| 39 | - if ('' !== $name) return $this->properties[$name] = new _Boolean; |
|
| 41 | + if ('' !== $name) { |
|
| 42 | + return $this->properties[$name] = new _Boolean; |
|
| 43 | + } |
|
| 40 | 44 | } |
| 41 | 45 | |
| 42 | 46 | /** |
@@ -45,7 +49,9 @@ discard block |
||
| 45 | 49 | |
| 46 | 50 | protected function addInteger(string $name) { |
| 47 | 51 | |
| 48 | - if ('' !== $name) return $this->properties[$name] = new _Integer; |
|
| 52 | + if ('' !== $name) { |
|
| 53 | + return $this->properties[$name] = new _Integer; |
|
| 54 | + } |
|
| 49 | 55 | } |
| 50 | 56 | |
| 51 | 57 | /** |
@@ -54,7 +60,9 @@ discard block |
||
| 54 | 60 | |
| 55 | 61 | protected function addObject(string $name) { |
| 56 | 62 | |
| 57 | - if ('' !== $name) return $this->properties[$name] = new _Object; |
|
| 63 | + if ('' !== $name) { |
|
| 64 | + return $this->properties[$name] = new _Object; |
|
| 65 | + } |
|
| 58 | 66 | } |
| 59 | 67 | |
| 60 | 68 | /** |
@@ -63,7 +71,9 @@ discard block |
||
| 63 | 71 | |
| 64 | 72 | protected function addString(string $name) { |
| 65 | 73 | |
| 66 | - if ('' !== $name) return $this->properties[$name] = new _String; |
|
| 74 | + if ('' !== $name) { |
|
| 75 | + return $this->properties[$name] = new _String; |
|
| 76 | + } |
|
| 67 | 77 | } |
| 68 | 78 | |
| 69 | 79 | /** |
@@ -74,13 +84,17 @@ discard block |
||
| 74 | 84 | |
| 75 | 85 | public function validate($data) { |
| 76 | 86 | |
| 77 | - if (!is_array($data)) return null; |
|
| 87 | + if (!is_array($data)) { |
|
| 88 | + return null; |
|
| 89 | + } |
|
| 78 | 90 | |
| 79 | 91 | $result = []; |
| 80 | 92 | |
| 81 | 93 | foreach ($this->properties as $name => $property) { |
| 82 | 94 | |
| 83 | - if (!isset($data[$name]) || (null === ($value = $property->validate($data[$name])))) return null; |
|
| 95 | + if (!isset($data[$name]) || (null === ($value = $property->validate($data[$name])))) { |
|
| 96 | + return null; |
|
| 97 | + } |
|
| 84 | 98 | |
| 85 | 99 | $result[$name] = $value; |
| 86 | 100 | } |
@@ -98,13 +112,19 @@ discard block |
||
| 98 | 112 | |
| 99 | 113 | public function load() { |
| 100 | 114 | |
| 101 | - if ('' === static::$file_name) return null; |
|
| 115 | + if ('' === static::$file_name) { |
|
| 116 | + return null; |
|
| 117 | + } |
|
| 102 | 118 | |
| 103 | 119 | $file_name = (DIR_SYSTEM_DATA . static::$file_name); |
| 104 | 120 | |
| 105 | - if (null === ($data = JSON::load($file_name))) return null; |
|
| 121 | + if (null === ($data = JSON::load($file_name))) { |
|
| 122 | + return null; |
|
| 123 | + } |
|
| 106 | 124 | |
| 107 | - if (null === ($data = $this->validate($data))) return null; |
|
| 125 | + if (null === ($data = $this->validate($data))) { |
|
| 126 | + return null; |
|
| 127 | + } |
|
| 108 | 128 | |
| 109 | 129 | # ------------------------ |
| 110 | 130 | |
@@ -119,13 +139,19 @@ discard block |
||
| 119 | 139 | |
| 120 | 140 | public function save(array $data) : bool { |
| 121 | 141 | |
| 122 | - if ('' === static::$file_name) return false; |
|
| 142 | + if ('' === static::$file_name) { |
|
| 143 | + return false; |
|
| 144 | + } |
|
| 123 | 145 | |
| 124 | 146 | $file_name = (DIR_SYSTEM_DATA . static::$file_name); |
| 125 | 147 | |
| 126 | - if (null === ($data = $this->validate($data))) return false; |
|
| 148 | + if (null === ($data = $this->validate($data))) { |
|
| 149 | + return false; |
|
| 150 | + } |
|
| 127 | 151 | |
| 128 | - if (false === JSON::save($file_name, $data)) return false; |
|
| 152 | + if (false === JSON::save($file_name, $data)) { |
|
| 153 | + return false; |
|
| 154 | + } |
|
| 129 | 155 | |
| 130 | 156 | # ------------------------ |
| 131 | 157 | |
@@ -140,7 +166,9 @@ discard block |
||
| 140 | 166 | |
| 141 | 167 | public function remove() : bool { |
| 142 | 168 | |
| 143 | - if ('' === static::$file_name) return false; |
|
| 169 | + if ('' === static::$file_name) { |
|
| 170 | + return false; |
|
| 171 | + } |
|
| 144 | 172 | |
| 145 | 173 | $file_name = (DIR_SYSTEM_DATA . static::$file_name); |
| 146 | 174 | |
@@ -19,7 +19,7 @@ |
||
| 19 | 19 | |
| 20 | 20 | public static function get(string $name) : Schema\_Object { |
| 21 | 21 | |
| 22 | - $class_name = ('Schemas\\' . $name); |
|
| 22 | + $class_name = ('Schemas\\'.$name); |
|
| 23 | 23 | |
| 24 | 24 | if (!isset(self::$cache[$class_name])) self::$cache[$class_name] = new $class_name; |
| 25 | 25 | |
@@ -23,7 +23,11 @@ discard block |
||
| 23 | 23 | |
| 24 | 24 | $text = Language::get($phrase); |
| 25 | 25 | |
| 26 | - if (!$popup) Messages::set('error', $text); else Popup::set('negative', $text); |
|
| 26 | + if (!$popup) { |
|
| 27 | + Messages::set('error', $text); |
|
| 28 | + } else { |
|
| 29 | + Popup::set('negative', $text); |
|
| 30 | + } |
|
| 27 | 31 | |
| 28 | 32 | # ------------------------ |
| 29 | 33 | |
@@ -41,17 +45,25 @@ discard block |
||
| 41 | 45 | |
| 42 | 46 | public function handle(callable $callback, bool $popup = false) : bool { |
| 43 | 47 | |
| 44 | - if (false === ($post = $this->post())) return false; |
|
| 48 | + if (false === ($post = $this->post())) { |
|
| 49 | + return false; |
|
| 50 | + } |
|
| 45 | 51 | |
| 46 | 52 | # Check form for errors |
| 47 | 53 | |
| 48 | - if ($this->hasErrors()) return $this->displayError('FORM_ERROR_REQUIRED', $popup); |
|
| 54 | + if ($this->hasErrors()) { |
|
| 55 | + return $this->displayError('FORM_ERROR_REQUIRED', $popup); |
|
| 56 | + } |
|
| 49 | 57 | |
| 50 | 58 | # Call controller method and display error |
| 51 | 59 | |
| 52 | - if (is_string($result = $callback($post))) return $this->displayError($result, $popup); |
|
| 60 | + if (is_string($result = $callback($post))) { |
|
| 61 | + return $this->displayError($result, $popup); |
|
| 62 | + } |
|
| 53 | 63 | |
| 54 | - if (is_array($result)) return (($this->getField($result[0])->error = true) && $this->displayError($result[1], $popup)); |
|
| 64 | + if (is_array($result)) { |
|
| 65 | + return (($this->getField($result[0])->error = true) && $this->displayError($result[1], $popup)); |
|
| 66 | + } |
|
| 55 | 67 | |
| 56 | 68 | # ------------------------ |
| 57 | 69 | |
@@ -23,7 +23,9 @@ discard block |
||
| 23 | 23 | |
| 24 | 24 | for ($index = ($active - 2); $index <= ($active + 2); $index++) { |
| 25 | 25 | |
| 26 | - if (!($index > 0 && $index <= $count)) continue; |
|
| 26 | + if (!($index > 0 && $index <= $count)) { |
|
| 27 | + continue; |
|
| 28 | + } |
|
| 27 | 29 | |
| 28 | 30 | $class = (($index === $active) ? 'active item' : 'item'); |
| 29 | 31 | |
@@ -52,7 +54,9 @@ discard block |
||
| 52 | 54 | |
| 53 | 55 | $block->link = $url->setAttribute('index', $index)->getString(); $block->index = $index; |
| 54 | 56 | |
| 55 | - if ($closest) $block->getBlock('ellipsis')->disable(); |
|
| 57 | + if ($closest) { |
|
| 58 | + $block->getBlock('ellipsis')->disable(); |
|
| 59 | + } |
|
| 56 | 60 | } |
| 57 | 61 | } |
| 58 | 62 | |
@@ -71,9 +75,9 @@ discard block |
||
| 71 | 75 | |
| 72 | 76 | list ($extremum, $index) = $data; $block = $pagination->getBlock($class); |
| 73 | 77 | |
| 74 | - if ($active === $extremum) { $block->disable(); $pagination->getBlock($class . '_disabled')->enable(); } |
|
| 75 | - |
|
| 76 | - else $block->link = $url->setAttribute('index', $index)->getString(); |
|
| 78 | + if ($active === $extremum) { $block->disable(); $pagination->getBlock($class . '_disabled')->enable(); } else { |
|
| 79 | + $block->link = $url->setAttribute('index', $index)->getString(); |
|
| 80 | + } |
|
| 77 | 81 | } |
| 78 | 82 | } |
| 79 | 83 | |
@@ -90,9 +94,13 @@ discard block |
||
| 90 | 94 | |
| 91 | 95 | public static function getBlock(int $index, int $display, int $total, Url $url) { |
| 92 | 96 | |
| 93 | - if (($index <= 0) || ($display <= 0) || ($total <= 0)) return false; |
|
| 97 | + if (($index <= 0) || ($display <= 0) || ($total <= 0)) { |
|
| 98 | + return false; |
|
| 99 | + } |
|
| 94 | 100 | |
| 95 | - if (($display >= $total) || ($index > ($count = ceil($total / $display)))) return false; |
|
| 101 | + if (($display >= $total) || ($index > ($count = ceil($total / $display)))) { |
|
| 102 | + return false; |
|
| 103 | + } |
|
| 96 | 104 | |
| 97 | 105 | # Create block |
| 98 | 106 | |
@@ -32,7 +32,7 @@ |
||
| 32 | 32 | |
| 33 | 33 | if (false === ($path = Extend\Templates::get('path'))) throw new Exception\View; |
| 34 | 34 | |
| 35 | - if (!isset(self::$cache[$file_name = ($path . $name . '.ctp')])) { |
|
| 35 | + if (!isset(self::$cache[$file_name = ($path.$name.'.ctp')])) { |
|
| 36 | 36 | |
| 37 | 37 | if (false === ($contents = Explorer::getContents($file_name))) throw new Exception\ViewFile($file_name); |
| 38 | 38 | |
@@ -30,11 +30,15 @@ |
||
| 30 | 30 | |
| 31 | 31 | public static function get(string $name) : Template\Block { |
| 32 | 32 | |
| 33 | - if (false === ($path = Extend\Templates::get('path'))) throw new Exception\View; |
|
| 33 | + if (false === ($path = Extend\Templates::get('path'))) { |
|
| 34 | + throw new Exception\View; |
|
| 35 | + } |
|
| 34 | 36 | |
| 35 | 37 | if (!isset(self::$cache[$file_name = ($path . $name . '.ctp')])) { |
| 36 | 38 | |
| 37 | - if (false === ($contents = Explorer::getContents($file_name))) throw new Exception\ViewFile($file_name); |
|
| 39 | + if (false === ($contents = Explorer::getContents($file_name))) { |
|
| 40 | + throw new Exception\ViewFile($file_name); |
|
| 41 | + } |
|
| 38 | 42 | |
| 39 | 43 | self::$cache[$file_name] = Template::createBlock($contents); |
| 40 | 44 | } |