@@ -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 | |
@@ -10,11 +10,15 @@ discard block |
||
| 10 | 10 | |
| 11 | 11 | private function parse(string $string, string $regex) { |
| 12 | 12 | |
| 13 | - if (!preg_match('/^\//', $string)) return false; |
|
| 13 | + if (!preg_match('/^\//', $string)) { |
|
| 14 | + return false; |
|
| 15 | + } |
|
| 14 | 16 | |
| 15 | 17 | $items = preg_split('/\//', $string, 0, PREG_SPLIT_NO_EMPTY); |
| 16 | 18 | |
| 17 | - foreach ($items as $name) if (!preg_match($regex, $name)) return false; |
|
| 19 | + foreach ($items as $name) { |
|
| 20 | + if (!preg_match($regex, $name)) return false; |
|
| 21 | + } |
|
| 18 | 22 | |
| 19 | 23 | # ------------------------ |
| 20 | 24 | |
@@ -25,9 +29,13 @@ discard block |
||
| 25 | 29 | |
| 26 | 30 | public function __construct(string $path, string $handler) { |
| 27 | 31 | |
| 28 | - if (false !== ($path = $this->parse($path, REGEX_MAP_PATH_ITEM_NAME))) $this->path = $path; |
|
| 32 | + if (false !== ($path = $this->parse($path, REGEX_MAP_PATH_ITEM_NAME))) { |
|
| 33 | + $this->path = $path; |
|
| 34 | + } |
|
| 29 | 35 | |
| 30 | - if (false !== ($handler = $this->parse($handler, REGEX_MAP_HANDLER_ITEM_NAME))) $this->handler = $handler; |
|
| 36 | + if (false !== ($handler = $this->parse($handler, REGEX_MAP_HANDLER_ITEM_NAME))) { |
|
| 37 | + $this->handler = $handler; |
|
| 38 | + } |
|
| 31 | 39 | |
| 32 | 40 | $this->parsed = ((false !== $path) && (false !== $handler)); |
| 33 | 41 | } |
@@ -36,7 +44,9 @@ discard block |
||
| 36 | 44 | |
| 37 | 45 | public function handler(array $path) { |
| 38 | 46 | |
| 39 | - if (!$this->parsed || ($path !== $this->path)) return false; |
|
| 47 | + if (!$this->parsed || ($path !== $this->path)) { |
|
| 48 | + return false; |
|
| 49 | + } |
|
| 40 | 50 | |
| 41 | 51 | return implode('\\', $this->handler); |
| 42 | 52 | } |
@@ -20,7 +20,9 @@ discard block |
||
| 20 | 20 | |
| 21 | 21 | $item = new Map\Item($item->path, $item->handler); |
| 22 | 22 | |
| 23 | - if ($item->parsed()) $this->map[] = $item; |
|
| 23 | + if ($item->parsed()) { |
|
| 24 | + $this->map[] = $item; |
|
| 25 | + } |
|
| 24 | 26 | } |
| 25 | 27 | } |
| 26 | 28 | } |
@@ -31,7 +33,9 @@ discard block |
||
| 31 | 33 | |
| 32 | 34 | foreach ($this->map as $item) { |
| 33 | 35 | |
| 34 | - if (false !== ($handler = $item->handler($url->path()))) return $handler; |
|
| 36 | + if (false !== ($handler = $item->handler($url->path()))) { |
|
| 37 | + return $handler; |
|
| 38 | + } |
|
| 35 | 39 | } |
| 36 | 40 | |
| 37 | 41 | # ------------------------ |
@@ -30,7 +30,7 @@ discard block |
||
| 30 | 30 | |
| 31 | 31 | public static function info(string $text = null, string $header = null) { |
| 32 | 32 | |
| 33 | - if (null === $text) return (self::$messages['info'] ?? false); |
|
| 33 | + if (null === $text) return (self::$messages['info'] ? ? false); |
|
| 34 | 34 | |
| 35 | 35 | self::setMessage('info', $text, $header); |
| 36 | 36 | } |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | |
| 40 | 40 | public static function warning(string $text = null, string $header = null) { |
| 41 | 41 | |
| 42 | - if (null === $text) return (self::$messages['warning'] ?? false); |
|
| 42 | + if (null === $text) return (self::$messages['warning'] ? ? false); |
|
| 43 | 43 | |
| 44 | 44 | self::setMessage('warning', $text, $header); |
| 45 | 45 | } |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | |
| 49 | 49 | public static function error(string $text = null, string $header = null) { |
| 50 | 50 | |
| 51 | - if (null === $text) return (self::$messages['error'] ?? false); |
|
| 51 | + if (null === $text) return (self::$messages['error'] ? ? false); |
|
| 52 | 52 | |
| 53 | 53 | self::setMessage('error', $text, $header); |
| 54 | 54 | } |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | |
| 58 | 58 | public static function success(string $text = null, string $header = null) { |
| 59 | 59 | |
| 60 | - if (null === $text) return (self::$messages['success'] ?? false); |
|
| 60 | + if (null === $text) return (self::$messages['success'] ? ? false); |
|
| 61 | 61 | |
| 62 | 62 | self::setMessage('success', $text, $header); |
| 63 | 63 | } |
@@ -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 | |
@@ -10,7 +10,9 @@ |
||
| 10 | 10 | |
| 11 | 11 | public function handle(callable $callback) { |
| 12 | 12 | |
| 13 | - if (false === ($post = $this->post())) return false; |
|
| 13 | + if (false === ($post = $this->post())) { |
|
| 14 | + return false; |
|
| 15 | + } |
|
| 14 | 16 | |
| 15 | 17 | # Check form for errors |
| 16 | 18 | |
@@ -23,11 +23,15 @@ |
||
| 23 | 23 | |
| 24 | 24 | $selection = ['name', 'contents']; $condition = ['display' => 1]; $order = ['name' => 'ASC']; |
| 25 | 25 | |
| 26 | - if (!(DB::select(TABLE_WIDGETS, $selection, $condition, $order) && DB::last()->status)) return; |
|
| 26 | + if (!(DB::select(TABLE_WIDGETS, $selection, $condition, $order) && DB::last()->status)) { |
|
| 27 | + return; |
|
| 28 | + } |
|
| 27 | 29 | |
| 28 | 30 | # Process results |
| 29 | 31 | |
| 30 | - while (null !== ($widget = DB::last()->row())) $this->addItem($widget['name'], $widget['contents']); |
|
| 32 | + while (null !== ($widget = DB::last()->row())) { |
|
| 33 | + $this->addItem($widget['name'], $widget['contents']); |
|
| 34 | + } |
|
| 31 | 35 | } |
| 32 | 36 | |
| 33 | 37 | # Return items |
@@ -23,11 +23,15 @@ |
||
| 23 | 23 | |
| 24 | 24 | $selection = ['name', 'value']; $order = ['name' => 'ASC']; |
| 25 | 25 | |
| 26 | - if (!(DB::select(TABLE_VARIABLES, $selection, null, $order) && DB::last()->status)) return; |
|
| 26 | + if (!(DB::select(TABLE_VARIABLES, $selection, null, $order) && DB::last()->status)) { |
|
| 27 | + return; |
|
| 28 | + } |
|
| 27 | 29 | |
| 28 | 30 | # Process results |
| 29 | 31 | |
| 30 | - while (null !== ($variable = DB::last()->row())) $this->addItem($variable['name'], $variable['value']); |
|
| 32 | + while (null !== ($variable = DB::last()->row())) { |
|
| 33 | + $this->addItem($variable['name'], $variable['value']); |
|
| 34 | + } |
|
| 31 | 35 | } |
| 32 | 36 | |
| 33 | 37 | # Return items |
@@ -14,7 +14,9 @@ discard block |
||
| 14 | 14 | |
| 15 | 15 | $urlset = '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" />'; |
| 16 | 16 | |
| 17 | - if (false !== ($xml = XML::create($urlset))) $this->xml = $xml; |
|
| 17 | + if (false !== ($xml = XML::create($urlset))) { |
|
| 18 | + $this->xml = $xml; |
|
| 19 | + } |
|
| 18 | 20 | } |
| 19 | 21 | |
| 20 | 22 | # Load sitemap |
@@ -25,9 +27,13 @@ discard block |
||
| 25 | 27 | |
| 26 | 28 | $modified = Explorer::modified($file_name); |
| 27 | 29 | |
| 28 | - if ((false === $modified) || ($modified <= $time)) return false; |
|
| 30 | + if ((false === $modified) || ($modified <= $time)) { |
|
| 31 | + return false; |
|
| 32 | + } |
|
| 29 | 33 | |
| 30 | - if (false === ($xml = Explorer::xml($file_name))) return false; |
|
| 34 | + if (false === ($xml = Explorer::xml($file_name))) { |
|
| 35 | + return false; |
|
| 36 | + } |
|
| 31 | 37 | |
| 32 | 38 | # ------------------------ |
| 33 | 39 | |
@@ -38,7 +44,9 @@ discard block |
||
| 38 | 44 | |
| 39 | 45 | public function save() { |
| 40 | 46 | |
| 41 | - if ((null === $this->xml) || $this->loaded) return false; |
|
| 47 | + if ((null === $this->xml) || $this->loaded) { |
|
| 48 | + return false; |
|
| 49 | + } |
|
| 42 | 50 | |
| 43 | 51 | $file_name = (DIR_SYSTEM_DATA . 'Sitemap.xml'); |
| 44 | 52 | |
@@ -51,9 +59,13 @@ discard block |
||
| 51 | 59 | |
| 52 | 60 | public function add(string $loc, string $lastmod = null, string $changefreq = null, float $priority = null) { |
| 53 | 61 | |
| 54 | - if ((null === $this->xml) || $this->loaded) return false; |
|
| 62 | + if ((null === $this->xml) || $this->loaded) { |
|
| 63 | + return false; |
|
| 64 | + } |
|
| 55 | 65 | |
| 56 | - if (false === ($loc = Validate::url($loc))) return false; |
|
| 66 | + if (false === ($loc = Validate::url($loc))) { |
|
| 67 | + return false; |
|
| 68 | + } |
|
| 57 | 69 | |
| 58 | 70 | # Create url object |
| 59 | 71 | |
@@ -75,7 +87,9 @@ discard block |
||
| 75 | 87 | |
| 76 | 88 | # Set priority |
| 77 | 89 | |
| 78 | - if (null !== $priority) $url->addChild('priority', Number::formatFloat($priority, 0, 1, 1)); |
|
| 90 | + if (null !== $priority) { |
|
| 91 | + $url->addChild('priority', Number::formatFloat($priority, 0, 1, 1)); |
|
| 92 | + } |
|
| 79 | 93 | |
| 80 | 94 | # ------------------------ |
| 81 | 95 | |