@@ -12,11 +12,19 @@ discard block |
||
12 | 12 | |
13 | 13 | private function allocateColor(array $color = null) { |
14 | 14 | |
15 | - if (null === $this->image) return false; |
|
15 | + if (null === $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::forceInt($value, 0, 255); |
|
25 | + foreach (array_values($color) as $key => $value) { |
|
26 | + $color[$key] = Number::forceInt($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 (null === $this->image) return false; |
|
54 | + if (null === $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 (null === $this->image) return false; |
|
84 | + if (null === $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 (null === $this->image) return false; |
|
111 | + if (null === $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 |
@@ -12,7 +12,7 @@ |
||
12 | 12 | |
13 | 13 | public function __construct() { |
14 | 14 | |
15 | - $urlset = '<?xml version="1.0" encoding="UTF-8" ?>' . |
|
15 | + $urlset = '<?xml version="1.0" encoding="UTF-8" ?>'. |
|
16 | 16 | |
17 | 17 | '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" />'; |
18 | 18 |
@@ -16,14 +16,18 @@ discard block |
||
16 | 16 | |
17 | 17 | '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" />'; |
18 | 18 | |
19 | - if (false !== ($xml = XML::parse($urlset))) $this->xml = $xml; |
|
19 | + if (false !== ($xml = XML::parse($urlset))) { |
|
20 | + $this->xml = $xml; |
|
21 | + } |
|
20 | 22 | } |
21 | 23 | |
22 | 24 | # Load sitemap |
23 | 25 | |
24 | 26 | public function load(string $file_name) { |
25 | 27 | |
26 | - if (false === ($xml = XML::load($file_name))) return false; |
|
28 | + if (false === ($xml = XML::load($file_name))) { |
|
29 | + return false; |
|
30 | + } |
|
27 | 31 | |
28 | 32 | $this->xml = $xml; $this->loaded = true; |
29 | 33 | |
@@ -36,9 +40,13 @@ discard block |
||
36 | 40 | |
37 | 41 | public function save(string $file_name) { |
38 | 42 | |
39 | - if ((null === $this->xml) || $this->loaded) return false; |
|
43 | + if ((null === $this->xml) || $this->loaded) { |
|
44 | + return false; |
|
45 | + } |
|
40 | 46 | |
41 | - if (false === XML::save($file_name, $this->xml)) return false; |
|
47 | + if (false === XML::save($file_name, $this->xml)) { |
|
48 | + return false; |
|
49 | + } |
|
42 | 50 | |
43 | 51 | # ------------------------ |
44 | 52 | |
@@ -49,9 +57,13 @@ discard block |
||
49 | 57 | |
50 | 58 | public function add(string $loc, string $lastmod = null, string $changefreq = null, float $priority = null) { |
51 | 59 | |
52 | - if ((null === $this->xml) || $this->loaded) return false; |
|
60 | + if ((null === $this->xml) || $this->loaded) { |
|
61 | + return false; |
|
62 | + } |
|
53 | 63 | |
54 | - if (false === ($loc = Validate::url($loc))) return false; |
|
64 | + if (false === ($loc = Validate::url($loc))) { |
|
65 | + return false; |
|
66 | + } |
|
55 | 67 | |
56 | 68 | # Create url object |
57 | 69 | |
@@ -73,7 +85,9 @@ discard block |
||
73 | 85 | |
74 | 86 | # Set priority |
75 | 87 | |
76 | - if (null !== $priority) $url->addChild('priority', Number::forceFloat($priority, 0, 1, 1)); |
|
88 | + if (null !== $priority) { |
|
89 | + $url->addChild('priority', Number::forceFloat($priority, 0, 1, 1)); |
|
90 | + } |
|
77 | 91 | |
78 | 92 | # ------------------------ |
79 | 93 |
@@ -32,14 +32,18 @@ |
||
32 | 32 | |
33 | 33 | foreach (['full_name', 'city'] as $name) { |
34 | 34 | |
35 | - if ('' === ($text = Auth::user()->$name)) $contents->getBlock($name)->disable(); |
|
36 | - |
|
37 | - else $contents->getBlock($name)->text = $text; |
|
35 | + if ('' === ($text = Auth::user()->$name)) { |
|
36 | + $contents->getBlock($name)->disable(); |
|
37 | + } else { |
|
38 | + $contents->getBlock($name)->text = $text; |
|
39 | + } |
|
38 | 40 | } |
39 | 41 | |
40 | 42 | # Set country |
41 | 43 | |
42 | - if ('' === ($country = Auth::user()->country)) $contents->getBlock('country')->disable(); else { |
|
44 | + if ('' === ($country = Auth::user()->country)) { |
|
45 | + $contents->getBlock('country')->disable(); |
|
46 | + } else { |
|
43 | 47 | |
44 | 48 | $contents->getBlock('country')->code = $country; |
45 | 49 |
@@ -55,11 +55,11 @@ |
||
55 | 55 | |
56 | 56 | if ($this->page->id !== 1) SEO::title($this->page->title); else $this->layout = 'Index'; |
57 | 57 | |
58 | - SEO::description ($this->page->description); |
|
59 | - SEO::keywords ($this->page->keywords); |
|
60 | - SEO::robotsIndex ($this->page->robots_index); |
|
61 | - SEO::robotsFollow ($this->page->robots_follow); |
|
62 | - SEO::canonical ($this->page->canonical); |
|
58 | + SEO::description($this->page->description); |
|
59 | + SEO::keywords($this->page->keywords); |
|
60 | + SEO::robotsIndex($this->page->robots_index); |
|
61 | + SEO::robotsFollow($this->page->robots_follow); |
|
62 | + SEO::canonical($this->page->canonical); |
|
63 | 63 | |
64 | 64 | # ------------------------ |
65 | 65 |
@@ -16,9 +16,11 @@ discard block |
||
16 | 16 | |
17 | 17 | # Set breadcrumbs |
18 | 18 | |
19 | - if (count($this->path) <= 1) $contents->getBlock('breadcrumbs')->disable(); |
|
20 | - |
|
21 | - else $contents->getBlock('breadcrumbs')->path = $this->path; |
|
19 | + if (count($this->path) <= 1) { |
|
20 | + $contents->getBlock('breadcrumbs')->disable(); |
|
21 | + } else { |
|
22 | + $contents->getBlock('breadcrumbs')->path = $this->path; |
|
23 | + } |
|
22 | 24 | |
23 | 25 | # Set contents |
24 | 26 | |
@@ -41,19 +43,31 @@ discard block |
||
41 | 43 | |
42 | 44 | $slug = $this->url->getSlug(); |
43 | 45 | |
44 | - if ('' !== $slug) $this->page->initBySlug($slug); else $this->page->init(1); |
|
46 | + if ('' !== $slug) { |
|
47 | + $this->page->initBySlug($slug); |
|
48 | + } else { |
|
49 | + $this->page->init(1); |
|
50 | + } |
|
45 | 51 | |
46 | 52 | # Display error if not found |
47 | 53 | |
48 | - if (0 === $this->page->id) return false; |
|
54 | + if (0 === $this->page->id) { |
|
55 | + return false; |
|
56 | + } |
|
49 | 57 | |
50 | 58 | # Get path |
51 | 59 | |
52 | - if (false !== ($path = $this->page->path())) $this->path = $path; |
|
60 | + if (false !== ($path = $this->page->path())) { |
|
61 | + $this->path = $path; |
|
62 | + } |
|
53 | 63 | |
54 | 64 | # Set data |
55 | 65 | |
56 | - if ($this->page->id !== 1) SEO::title($this->page->title); else $this->layout = 'Index'; |
|
66 | + if ($this->page->id !== 1) { |
|
67 | + SEO::title($this->page->title); |
|
68 | + } else { |
|
69 | + $this->layout = 'Index'; |
|
70 | + } |
|
57 | 71 | |
58 | 72 | SEO::description ($this->page->description); |
59 | 73 | SEO::keywords ($this->page->keywords); |
@@ -12,14 +12,18 @@ |
||
12 | 12 | |
13 | 13 | public static function __autoload() { |
14 | 14 | |
15 | - if (null === self::$settings) self::$settings = new Settings\Utils\Dataset; |
|
15 | + if (null === self::$settings) { |
|
16 | + self::$settings = new Settings\Utils\Dataset; |
|
17 | + } |
|
16 | 18 | } |
17 | 19 | |
18 | 20 | # Load settings |
19 | 21 | |
20 | 22 | public static function load() { |
21 | 23 | |
22 | - if (null === ($data = Schema::get('Settings')->load())) return false; |
|
24 | + if (null === ($data = Schema::get('Settings')->load())) { |
|
25 | + return false; |
|
26 | + } |
|
23 | 27 | |
24 | 28 | self::$settings->setArray($data); self::$loaded = true; |
25 | 29 |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | |
13 | 13 | if (empty($host = getenv('HTTP_HOST'))) return; |
14 | 14 | |
15 | - return ((Request::isSecure() ? 'https://' : 'http://') . $host); |
|
15 | + return ((Request::isSecure() ? 'https://' : 'http://').$host); |
|
16 | 16 | } |
17 | 17 | |
18 | 18 | # Get system email |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | |
22 | 22 | if (empty($host = getenv('HTTP_HOST'))) return; |
23 | 23 | |
24 | - return ('admin@' . $host); |
|
24 | + return ('admin@'.$host); |
|
25 | 25 | } |
26 | 26 | |
27 | 27 | # Constructor |
@@ -30,84 +30,84 @@ discard block |
||
30 | 30 | |
31 | 31 | # Admin language |
32 | 32 | |
33 | - $this->addParam('admin_language', CONFIG_ADMIN_LANGUAGE_DEFAULT, function (string $name) { |
|
33 | + $this->addParam('admin_language', CONFIG_ADMIN_LANGUAGE_DEFAULT, function(string $name) { |
|
34 | 34 | |
35 | 35 | return ((false !== ($name = Extend\Languages::validate($name))) ? $name : null); |
36 | 36 | }); |
37 | 37 | |
38 | 38 | # Admin template |
39 | 39 | |
40 | - $this->addParam('admin_template', CONFIG_ADMIN_TEMPLATE_DEFAULT, function (string $name) { |
|
40 | + $this->addParam('admin_template', CONFIG_ADMIN_TEMPLATE_DEFAULT, function(string $name) { |
|
41 | 41 | |
42 | 42 | return ((false !== ($name = Extend\Templates::validate($name))) ? $name : null); |
43 | 43 | }); |
44 | 44 | |
45 | 45 | # Site language |
46 | 46 | |
47 | - $this->addParam('site_language', CONFIG_SITE_LANGUAGE_DEFAULT, function (string $name) { |
|
47 | + $this->addParam('site_language', CONFIG_SITE_LANGUAGE_DEFAULT, function(string $name) { |
|
48 | 48 | |
49 | 49 | return ((false !== ($name = Extend\Languages::validate($name))) ? $name : null); |
50 | 50 | }); |
51 | 51 | |
52 | 52 | # Site template |
53 | 53 | |
54 | - $this->addParam('site_template', CONFIG_SITE_TEMPLATE_DEFAULT, function (string $name) { |
|
54 | + $this->addParam('site_template', CONFIG_SITE_TEMPLATE_DEFAULT, function(string $name) { |
|
55 | 55 | |
56 | 56 | return ((false !== ($name = Extend\Templates::validate($name))) ? $name : null); |
57 | 57 | }); |
58 | 58 | |
59 | 59 | # Site title |
60 | 60 | |
61 | - $this->addParam('site_title', CONFIG_SITE_TITLE_DEFAULT, function (string $title) { |
|
61 | + $this->addParam('site_title', CONFIG_SITE_TITLE_DEFAULT, function(string $title) { |
|
62 | 62 | |
63 | 63 | return (('' !== $title) ? $title : null); |
64 | 64 | }); |
65 | 65 | |
66 | 66 | # Site slogan |
67 | 67 | |
68 | - $this->addParam('site_slogan', CONFIG_SITE_SLOGAN_DEFAULT, function (string $slogan) { |
|
68 | + $this->addParam('site_slogan', CONFIG_SITE_SLOGAN_DEFAULT, function(string $slogan) { |
|
69 | 69 | |
70 | 70 | return $slogan; |
71 | 71 | }); |
72 | 72 | |
73 | 73 | # Site status |
74 | 74 | |
75 | - $this->addParam('site_status', STATUS_ONLINE, function (string $status) { |
|
75 | + $this->addParam('site_status', STATUS_ONLINE, function(string $status) { |
|
76 | 76 | |
77 | 77 | return ((false !== ($status = Range\Status::validate($status))) ? $status : null); |
78 | 78 | }); |
79 | 79 | |
80 | 80 | # Site description |
81 | 81 | |
82 | - $this->addParam('site_description', '', function (string $description) { |
|
82 | + $this->addParam('site_description', '', function(string $description) { |
|
83 | 83 | |
84 | 84 | return $description; |
85 | 85 | }); |
86 | 86 | |
87 | 87 | # Site keywords |
88 | 88 | |
89 | - $this->addParam('site_keywords', '', function (string $keywords) { |
|
89 | + $this->addParam('site_keywords', '', function(string $keywords) { |
|
90 | 90 | |
91 | 91 | return $keywords; |
92 | 92 | }); |
93 | 93 | |
94 | 94 | # System url |
95 | 95 | |
96 | - $this->addParam('system_url', $this->getSystemUrl(), function (string $url) { |
|
96 | + $this->addParam('system_url', $this->getSystemUrl(), function(string $url) { |
|
97 | 97 | |
98 | 98 | return ((false !== ($url = Validate::url($url))) ? $url : null); |
99 | 99 | }); |
100 | 100 | |
101 | 101 | # System email |
102 | 102 | |
103 | - $this->addParam('system_email', $this->getSystemEmail(), function (string $email) { |
|
103 | + $this->addParam('system_email', $this->getSystemEmail(), function(string $email) { |
|
104 | 104 | |
105 | 105 | return ((false !== ($email = Validate::email($email))) ? $email : null); |
106 | 106 | }); |
107 | 107 | |
108 | 108 | # System timezone |
109 | 109 | |
110 | - $this->addParam('system_timezone', CONFIG_SYSTEM_TIMEZONE_DEFAULT, function (string $timezone) { |
|
110 | + $this->addParam('system_timezone', CONFIG_SYSTEM_TIMEZONE_DEFAULT, function(string $timezone) { |
|
111 | 111 | |
112 | 112 | return ((false !== ($timezone = Timezone::validate($timezone))) ? $timezone : null); |
113 | 113 | }); |
@@ -10,7 +10,9 @@ discard block |
||
10 | 10 | |
11 | 11 | private function getSystemUrl() { |
12 | 12 | |
13 | - if (empty($host = getenv('HTTP_HOST'))) return; |
|
13 | + if (empty($host = getenv('HTTP_HOST'))) { |
|
14 | + return; |
|
15 | + } |
|
14 | 16 | |
15 | 17 | return ((Request::isSecure() ? 'https://' : 'http://') . $host); |
16 | 18 | } |
@@ -19,7 +21,9 @@ discard block |
||
19 | 21 | |
20 | 22 | private function getSystemEmail() { |
21 | 23 | |
22 | - if (empty($host = getenv('HTTP_HOST'))) return; |
|
24 | + if (empty($host = getenv('HTTP_HOST'))) { |
|
25 | + return; |
|
26 | + } |
|
23 | 27 | |
24 | 28 | return ('admin@' . $host); |
25 | 29 | } |
@@ -37,11 +37,15 @@ |
||
37 | 37 | |
38 | 38 | # Check if install file exists |
39 | 39 | |
40 | - if (Informer::checkInstallFile()) Messages::set('error', Language::get('DASHBOARD_MESSAGE_INSTALL_FILE')); |
|
40 | + if (Informer::checkInstallFile()) { |
|
41 | + Messages::set('error', Language::get('DASHBOARD_MESSAGE_INSTALL_FILE')); |
|
42 | + } |
|
41 | 43 | |
42 | 44 | # Check if configuration file is loaded |
43 | 45 | |
44 | - if (!Settings::loaded()) Messages::set('warning', Language::get('DASHBOARD_MESSAGE_SETTINGS_FILE')); |
|
46 | + if (!Settings::loaded()) { |
|
47 | + Messages::set('warning', Language::get('DASHBOARD_MESSAGE_SETTINGS_FILE')); |
|
48 | + } |
|
45 | 49 | |
46 | 50 | # ------------------------ |
47 | 51 |
@@ -45,7 +45,9 @@ |
||
45 | 45 | |
46 | 46 | public static function mysqlVersion() { |
47 | 47 | |
48 | - if (!(DB::send("SELECT VERSION() as version") && DB::getLast()->status)) return false; |
|
48 | + if (!(DB::send("SELECT VERSION() as version") && DB::getLast()->status)) { |
|
49 | + return false; |
|
50 | + } |
|
49 | 51 | |
50 | 52 | return strval(DB::getLast()->getRow()['version']); |
51 | 53 | } |
@@ -24,7 +24,7 @@ |
||
24 | 24 | |
25 | 25 | public static function checkInstallFile() { |
26 | 26 | |
27 | - return Explorer::isFile(DIR_WWW . 'install.php'); |
|
27 | + return Explorer::isFile(DIR_WWW.'install.php'); |
|
28 | 28 | } |
29 | 29 | |
30 | 30 | # Get MySQL version |
@@ -14,14 +14,14 @@ |
||
14 | 14 | |
15 | 15 | if (null !== ($data = Schema::get('System')->load())) { |
16 | 16 | |
17 | - Request::redirect(INSTALL_PATH . '/index.php'); |
|
17 | + Request::redirect(INSTALL_PATH.'/index.php'); |
|
18 | 18 | } |
19 | 19 | |
20 | 20 | # Determine handler class |
21 | 21 | |
22 | 22 | $checked = (Install::status() && Validate::boolean(Request::get('checked'))); |
23 | 23 | |
24 | - $class = ('Modules\Install\Handler\\' . (!$checked ? 'Check' : 'Database')); |
|
24 | + $class = ('Modules\Install\Handler\\'.(!$checked ? 'Check' : 'Database')); |
|
25 | 25 | |
26 | 26 | # ------------------------ |
27 | 27 |