@@ -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 | |
@@ -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 | |
@@ -12,11 +12,19 @@ discard block |
||
| 12 | 12 | |
| 13 | 13 | private function allocateColor(array $color = null) { |
| 14 | 14 | |
| 15 | - if (!is_resource($this->image)) return false; |
|
| 15 | + if (!is_resource($this->image)) { |
|
| 16 | + return false; |
|
| 17 | + } |
|
| 16 | 18 | |
| 17 | - if (null === $color) $color = [0, 0, 0]; else if (count($color) !== 3) return false; |
|
| 19 | + if (null === $color) { |
|
| 20 | + $color = [0, 0, 0]; |
|
| 21 | + } else if (count($color) !== 3) { |
|
| 22 | + return false; |
|
| 23 | + } |
|
| 18 | 24 | |
| 19 | - foreach (array_values($color) as $key => $value) $color[$key] = Number::format($value, 0, 255); |
|
| 25 | + foreach (array_values($color) as $key => $value) { |
|
| 26 | + $color[$key] = Number::format($value, 0, 255); |
|
| 27 | + } |
|
| 20 | 28 | |
| 21 | 29 | # ------------------------ |
| 22 | 30 | |
@@ -27,7 +35,9 @@ discard block |
||
| 27 | 35 | |
| 28 | 36 | public function __construct(int $width, int $height, array $bg_color = null) { |
| 29 | 37 | |
| 30 | - if (false === ($image = imagecreatetruecolor($width, $height))) return; |
|
| 38 | + if (false === ($image = imagecreatetruecolor($width, $height))) { |
|
| 39 | + return; |
|
| 40 | + } |
|
| 31 | 41 | |
| 32 | 42 | $this->image = $image; $this->width = $width; $this->height = $height; |
| 33 | 43 | |
@@ -41,11 +51,17 @@ discard block |
||
| 41 | 51 | |
| 42 | 52 | public function text(string $font, int $size, int $indent, int $step, string $text, array $color = null) { |
| 43 | 53 | |
| 44 | - if (!is_resource($this->image)) return false; |
|
| 54 | + if (!is_resource($this->image)) { |
|
| 55 | + return false; |
|
| 56 | + } |
|
| 45 | 57 | |
| 46 | - if (!Explorer::isFile($font)) return false; |
|
| 58 | + if (!Explorer::isFile($font)) { |
|
| 59 | + return false; |
|
| 60 | + } |
|
| 47 | 61 | |
| 48 | - if (false === ($color = $this->allocateColor($color))) return false; |
|
| 62 | + if (false === ($color = $this->allocateColor($color))) { |
|
| 63 | + return false; |
|
| 64 | + } |
|
| 49 | 65 | |
| 50 | 66 | $base = (floor(($this->height - $size) / 2) + $size); |
| 51 | 67 | |
@@ -65,13 +81,22 @@ discard block |
||
| 65 | 81 | |
| 66 | 82 | public function noise(int $rate, array $color = null) { |
| 67 | 83 | |
| 68 | - if (!is_resource($this->image)) return false; |
|
| 84 | + if (!is_resource($this->image)) { |
|
| 85 | + return false; |
|
| 86 | + } |
|
| 69 | 87 | |
| 70 | - if (false === ($color = $this->allocateColor($color))) return false; |
|
| 88 | + if (false === ($color = $this->allocateColor($color))) { |
|
| 89 | + return false; |
|
| 90 | + } |
|
| 71 | 91 | |
| 72 | - for ($x = 0; $x < $this->width; $x++) for ($y = 0; $y < $this->height; $y++) { |
|
| 92 | + for ($x = 0; $x < $this->width; $x++) { |
|
| 93 | + for ($y = 0; |
|
| 94 | + } |
|
| 95 | + $y < $this->height; $y++) { |
|
| 73 | 96 | |
| 74 | - if (random_int(1, $rate) === 1) imagesetpixel($this->image, $x, $y, $color); |
|
| 97 | + if (random_int(1, $rate) === 1) { |
|
| 98 | + imagesetpixel($this->image, $x, $y, $color); |
|
| 99 | + } |
|
| 75 | 100 | } |
| 76 | 101 | |
| 77 | 102 | # ------------------------ |
@@ -83,9 +108,13 @@ discard block |
||
| 83 | 108 | |
| 84 | 109 | public function lines(int $count, array $color = null) { |
| 85 | 110 | |
| 86 | - if (!is_resource($this->image)) return false; |
|
| 111 | + if (!is_resource($this->image)) { |
|
| 112 | + return false; |
|
| 113 | + } |
|
| 87 | 114 | |
| 88 | - if (false === ($color = $this->allocateColor($color))) return false; |
|
| 115 | + if (false === ($color = $this->allocateColor($color))) { |
|
| 116 | + return false; |
|
| 117 | + } |
|
| 89 | 118 | |
| 90 | 119 | for ($i = 0; $i < $count; $i++) { |
| 91 | 120 | |
@@ -19,13 +19,17 @@ |
||
| 19 | 19 | |
| 20 | 20 | public static function get(string $name) { |
| 21 | 21 | |
| 22 | - if ('' === self::$section) throw new Exception\View(); |
|
| 22 | + if ('' === self::$section) { |
|
| 23 | + throw new Exception\View(); |
|
| 24 | + } |
|
| 23 | 25 | |
| 24 | 26 | $class_name = ('System\Views\\' . self::$section . '\\' . $name); |
| 25 | 27 | |
| 26 | - if (isset(self::$cache[$class_name])) $view = clone self::$cache[$class_name]; |
|
| 27 | - |
|
| 28 | - else $view = (self::$cache[$class_name] = new $class_name()); |
|
| 28 | + if (isset(self::$cache[$class_name])) { |
|
| 29 | + $view = clone self::$cache[$class_name]; |
|
| 30 | + } else { |
|
| 31 | + $view = (self::$cache[$class_name] = new $class_name()); |
|
| 32 | + } |
|
| 29 | 33 | |
| 30 | 34 | # ------------------------ |
| 31 | 35 | |
@@ -18,7 +18,9 @@ |
||
| 18 | 18 | |
| 19 | 19 | public function __construct() { |
| 20 | 20 | |
| 21 | - if (static::$section !== Extend\Templates::section()) return; |
|
| 21 | + if (static::$section !== Extend\Templates::section()) { |
|
| 22 | + return; |
|
| 23 | + } |
|
| 22 | 24 | |
| 23 | 25 | $file_name = (Extend\Templates::path() . static::$file_name); |
| 24 | 26 | |
@@ -2,11 +2,11 @@ |
||
| 2 | 2 | |
| 3 | 3 | # Database tables |
| 4 | 4 | |
| 5 | -define('TABLE_PAGES', 'pages'); |
|
| 6 | -define('TABLE_MENU', 'menu'); |
|
| 7 | -define('TABLE_VARIABLES', 'variables'); |
|
| 8 | -define('TABLE_WIDGETS', 'widgets'); |
|
| 5 | +define('TABLE_PAGES', 'pages'); |
|
| 6 | +define('TABLE_MENU', 'menu'); |
|
| 7 | +define('TABLE_VARIABLES', 'variables'); |
|
| 8 | +define('TABLE_WIDGETS', 'widgets'); |
|
| 9 | 9 | |
| 10 | -define('TABLE_USERS', 'users'); |
|
| 11 | -define('TABLE_USERS_SECRETS', 'users_secrets'); |
|
| 12 | -define('TABLE_USERS_SESSIONS', 'users_sessions'); |
|
| 10 | +define('TABLE_USERS', 'users'); |
|
| 11 | +define('TABLE_USERS_SECRETS', 'users_secrets'); |
|
| 12 | +define('TABLE_USERS_SESSIONS', 'users_sessions'); |
|