@@ -24,7 +24,9 @@ |
||
24 | 24 | |
25 | 25 | public static function __callStatic($name, $arguments) { |
26 | 26 | |
27 | - if (null !== static::$loader) return static::$loader->$name(...$arguments); |
|
27 | + if (null !== static::$loader) { |
|
28 | + return static::$loader->$name(...$arguments); |
|
29 | + } |
|
28 | 30 | } |
29 | 31 | } |
30 | 32 | } |
@@ -21,7 +21,9 @@ discard block |
||
21 | 21 | |
22 | 22 | # Throw error if no extensions found |
23 | 23 | |
24 | - if (false === static::$loader->active()) throw new static::$exception_class; |
|
24 | + if (false === static::$loader->active()) { |
|
25 | + throw new static::$exception_class; |
|
26 | + } |
|
25 | 27 | |
26 | 28 | # Activate user defined extension |
27 | 29 | |
@@ -29,9 +31,10 @@ discard block |
||
29 | 31 | |
30 | 32 | $name = static::$name; $param = static::$param[static::$loader->section()]; |
31 | 33 | |
32 | - if (static::$loader->activate(Request::get($name)) || static::$loader->activate(Cookie::get($param))) |
|
33 | - |
|
34 | + if (static::$loader->activate(Request::get($name)) || static::$loader->activate(Cookie::get($param))) { |
|
35 | + |
|
34 | 36 | Cookie::set($param, static::$loader->data('name'), static::$cookie_expires); |
37 | + } |
|
35 | 38 | } |
36 | 39 | } |
37 | 40 | } |
@@ -12,7 +12,7 @@ |
||
12 | 12 | |
13 | 13 | protected function getItem(string $name) { |
14 | 14 | |
15 | - $file_name = ($this->dir_name . $name . '/Config.json'); |
|
15 | + $file_name = ($this->dir_name.$name.'/Config.json'); |
|
16 | 16 | |
17 | 17 | if (null === ($data = JSON::load($file_name))) return null; |
18 | 18 |
@@ -14,11 +14,17 @@ |
||
14 | 14 | |
15 | 15 | $file_name = ($this->dir_name . $name . '/Config.json'); |
16 | 16 | |
17 | - if (null === ($data = JSON::load($file_name))) return null; |
|
17 | + if (null === ($data = JSON::load($file_name))) { |
|
18 | + return null; |
|
19 | + } |
|
18 | 20 | |
19 | - if (null === ($data = Schema::get(static::$schema_prototype)->validate($data))) return null; |
|
21 | + if (null === ($data = Schema::get(static::$schema_prototype)->validate($data))) { |
|
22 | + return null; |
|
23 | + } |
|
20 | 24 | |
21 | - if (!(static::$extension_class::valid($data['name']) && ($data['name'] === $name))) return null; |
|
25 | + if (!(static::$extension_class::valid($data['name']) && ($data['name'] === $name))) { |
|
26 | + return null; |
|
27 | + } |
|
22 | 28 | |
23 | 29 | # ------------------------ |
24 | 30 |
@@ -12,7 +12,7 @@ |
||
12 | 12 | |
13 | 13 | protected function init() { |
14 | 14 | |
15 | - $this->config->addParam('active', '', function (bool $active) { |
|
15 | + $this->config->addParam('active', '', function(bool $active) { |
|
16 | 16 | |
17 | 17 | return ($active ? "ent.active = 1" : ''); |
18 | 18 | }); |
@@ -12,29 +12,29 @@ |
||
12 | 12 | |
13 | 13 | protected function init() { |
14 | 14 | |
15 | - $this->config->addParam('rank', '', function (int $rank = null) { |
|
15 | + $this->config->addParam('rank', '', function(int $rank = null) { |
|
16 | 16 | |
17 | - return ((null !== $rank) ? ("ent.rank >= " . $rank) : ''); |
|
17 | + return ((null !== $rank) ? ("ent.rank >= ".$rank) : ''); |
|
18 | 18 | }); |
19 | 19 | |
20 | - $this->config->addParam('time_registered >=', '', function (int $time) { |
|
20 | + $this->config->addParam('time_registered >=', '', function(int $time) { |
|
21 | 21 | |
22 | - return ((0 < $time) ? ("ent.time_registered >= " . $time) : ''); |
|
22 | + return ((0 < $time) ? ("ent.time_registered >= ".$time) : ''); |
|
23 | 23 | }); |
24 | 24 | |
25 | - $this->config->addParam('time_registered <=', '', function (int $time) { |
|
25 | + $this->config->addParam('time_registered <=', '', function(int $time) { |
|
26 | 26 | |
27 | - return ((0 < $time) ? ("ent.time_registered <= " . $time) : ''); |
|
27 | + return ((0 < $time) ? ("ent.time_registered <= ".$time) : ''); |
|
28 | 28 | }); |
29 | 29 | |
30 | - $this->config->addParam('time_logged >=', '', function (int $time) { |
|
30 | + $this->config->addParam('time_logged >=', '', function(int $time) { |
|
31 | 31 | |
32 | - return ((0 < $time) ? ("ent.time_logged >= " . $time) : ''); |
|
32 | + return ((0 < $time) ? ("ent.time_logged >= ".$time) : ''); |
|
33 | 33 | }); |
34 | 34 | |
35 | - $this->config->addParam('time_logged <=', '', function (int $time) { |
|
35 | + $this->config->addParam('time_logged <=', '', function(int $time) { |
|
36 | 36 | |
37 | - return ((0 < $time) ? ("ent.time_logged <= " . $time) : ''); |
|
37 | + return ((0 < $time) ? ("ent.time_logged <= ".$time) : ''); |
|
38 | 38 | }); |
39 | 39 | } |
40 | 40 | } |
@@ -30,7 +30,9 @@ |
||
30 | 30 | |
31 | 31 | protected function processEntity(Template\Block $contents) { |
32 | 32 | |
33 | - if ($this->create) $contents->getBlock('info')->disable(); else { |
|
33 | + if ($this->create) { |
|
34 | + $contents->getBlock('info')->disable(); |
|
35 | + } else { |
|
34 | 36 | |
35 | 37 | $contents->getBlock('info')->time_registered = Date::get(DATE_FORMAT_DATETIME, $this->entity->time_registered); |
36 | 38 |
@@ -24,7 +24,7 @@ |
||
24 | 24 | |
25 | 25 | # Customize captcha |
26 | 26 | |
27 | - $font = (DIR_SYSTEM_DATA . CONFIG_CAPTCHA_FONT); $size = CONFIG_CAPTCHA_FONT_SIZE; |
|
27 | + $font = (DIR_SYSTEM_DATA.CONFIG_CAPTCHA_FONT); $size = CONFIG_CAPTCHA_FONT_SIZE; |
|
28 | 28 | |
29 | 29 | $indent = CONFIG_CAPTCHA_TEXT_INDENT; $step = CONFIG_CAPTCHA_TEXT_STEP; |
30 | 30 |
@@ -44,7 +44,7 @@ |
||
44 | 44 | |
45 | 45 | # Load sitemap |
46 | 46 | |
47 | - $file_name = (DIR_SYSTEM_DATA . 'Sitemap.xml'); |
|
47 | + $file_name = (DIR_SYSTEM_DATA.'Sitemap.xml'); |
|
48 | 48 | |
49 | 49 | $modified = Explorer::getModified($file_name); |
50 | 50 |
@@ -12,7 +12,9 @@ discard block |
||
12 | 12 | |
13 | 13 | $selection = 'MAX(time_modified) as last_modified'; |
14 | 14 | |
15 | - if (!(DB::select(TABLE_PAGES, $selection) && (DB::getLast()->rows === 1))) return 0; |
|
15 | + if (!(DB::select(TABLE_PAGES, $selection) && (DB::getLast()->rows === 1))) { |
|
16 | + return 0; |
|
17 | + } |
|
16 | 18 | |
17 | 19 | # ------------------------ |
18 | 20 | |
@@ -27,11 +29,15 @@ discard block |
||
27 | 29 | |
28 | 30 | $condition = ['visibility' => VISIBILITY_PUBLISHED, 'access' => ACCESS_PUBLIC, 'locked' => 0]; |
29 | 31 | |
30 | - if (!(DB::select(TABLE_PAGES, $selection, $condition, 'slug') && DB::getLast()->status)) return; |
|
32 | + if (!(DB::select(TABLE_PAGES, $selection, $condition, 'slug') && DB::getLast()->status)) { |
|
33 | + return; |
|
34 | + } |
|
31 | 35 | |
32 | 36 | # ------------------------ |
33 | 37 | |
34 | - while (null !== ($data = DB::getLast()->getRow())) yield Entitizer::getDataset(TABLE_PAGES, $data); |
|
38 | + while (null !== ($data = DB::getLast()->getRow())) { |
|
39 | + yield Entitizer::getDataset(TABLE_PAGES, $data); |
|
40 | + } |
|
35 | 41 | } |
36 | 42 | |
37 | 43 | # Handle request |
@@ -50,7 +56,9 @@ discard block |
||
50 | 56 | |
51 | 57 | if ((false !== $modified) && ($modified > $this->getLastModified())) { |
52 | 58 | |
53 | - if (false !== $sitemap->load($file_name)) return $sitemap; |
|
59 | + if (false !== $sitemap->load($file_name)) { |
|
60 | + return $sitemap; |
|
61 | + } |
|
54 | 62 | } |
55 | 63 | |
56 | 64 | # Fill sitemap |
@@ -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 |