@@ -20,7 +20,9 @@ discard block |
||
20 | 20 | |
21 | 21 | $item->children = ($children = Template::createBlock()); |
22 | 22 | |
23 | - foreach ($this->menu[$id]['children'] as $child) $children->addItem($this->parseItem($child)); |
|
23 | + foreach ($this->menu[$id]['children'] as $child) { |
|
24 | + $children->addItem($this->parseItem($child)); |
|
25 | + } |
|
24 | 26 | |
25 | 27 | } else { |
26 | 28 | |
@@ -44,7 +46,9 @@ discard block |
||
44 | 46 | |
45 | 47 | $menu = Entitizer::getTreeview(TABLE_MENU)->getSubtree(0, ['active' => true]); |
46 | 48 | |
47 | - if (false !== $menu) $this->menu = $menu; |
|
49 | + if (false !== $menu) { |
|
50 | + $this->menu = $menu; |
|
51 | + } |
|
48 | 52 | } |
49 | 53 | |
50 | 54 | # Get block |
@@ -53,7 +57,9 @@ discard block |
||
53 | 57 | |
54 | 58 | $menu = Template::createBlock(); |
55 | 59 | |
56 | - foreach ($this->menu[0]['children'] as $id) $menu->addItem($this->parseItem($id)); |
|
60 | + foreach ($this->menu[0]['children'] as $id) { |
|
61 | + $menu->addItem($this->parseItem($id)); |
|
62 | + } |
|
57 | 63 | |
58 | 64 | # ------------------------ |
59 | 65 |
@@ -25,9 +25,11 @@ discard block |
||
25 | 25 | |
26 | 26 | # Set breadcrumbs |
27 | 27 | |
28 | - if (count($this->path) <= 1) $contents->getBlock('breadcrumbs')->disable(); |
|
29 | - |
|
30 | - else $contents->getBlock('breadcrumbs')->path = $this->path; |
|
28 | + if (count($this->path) <= 1) { |
|
29 | + $contents->getBlock('breadcrumbs')->disable(); |
|
30 | + } else { |
|
31 | + $contents->getBlock('breadcrumbs')->path = $this->path; |
|
32 | + } |
|
31 | 33 | |
32 | 34 | # Set contents |
33 | 35 | |
@@ -54,19 +56,31 @@ discard block |
||
54 | 56 | |
55 | 57 | $slug = $this->_url->getSlug(); |
56 | 58 | |
57 | - if ('' !== $slug) $this->page->initBySlug($slug); else $this->page->init(1); |
|
59 | + if ('' !== $slug) { |
|
60 | + $this->page->initBySlug($slug); |
|
61 | + } else { |
|
62 | + $this->page->init(1); |
|
63 | + } |
|
58 | 64 | |
59 | 65 | # Display error if not found |
60 | 66 | |
61 | - if (0 === $this->page->id) return false; |
|
67 | + if (0 === $this->page->id) { |
|
68 | + return false; |
|
69 | + } |
|
62 | 70 | |
63 | 71 | # Get path |
64 | 72 | |
65 | - if (false !== ($path = $this->page->getPath())) $this->path = $path; |
|
73 | + if (false !== ($path = $this->page->getPath())) { |
|
74 | + $this->path = $path; |
|
75 | + } |
|
66 | 76 | |
67 | 77 | # Set data |
68 | 78 | |
69 | - if ($this->page->id !== 1) SEO::title($this->page->title); else $this->_layout = 'Index'; |
|
79 | + if ($this->page->id !== 1) { |
|
80 | + SEO::title($this->page->title); |
|
81 | + } else { |
|
82 | + $this->_layout = 'Index'; |
|
83 | + } |
|
70 | 84 | |
71 | 85 | SEO::description ($this->page->description); |
72 | 86 | SEO::keywords ($this->page->keywords); |
@@ -28,14 +28,18 @@ |
||
28 | 28 | |
29 | 29 | $this->addVirtual('link', function (array $data) { |
30 | 30 | |
31 | - if ('' === $data['slug']) return ''; |
|
31 | + if ('' === $data['slug']) { |
|
32 | + return ''; |
|
33 | + } |
|
32 | 34 | |
33 | 35 | return (INSTALL_PATH . '/' . $data['slug']); |
34 | 36 | }); |
35 | 37 | |
36 | 38 | $this->addVirtual('canonical', function (array $data) { |
37 | 39 | |
38 | - if ('' === $data['slug']) return ''; |
|
40 | + if ('' === $data['slug']) { |
|
41 | + return ''; |
|
42 | + } |
|
39 | 43 | |
40 | 44 | return (Settings::get('system_url') . (($data['id'] !== 1) ? ('/' . $data['slug']) : '')); |
41 | 45 | }); |
@@ -23,9 +23,13 @@ |
||
23 | 23 | |
24 | 24 | $this->addVirtual('link', function (array $data) { |
25 | 25 | |
26 | - if ('' === $data['slug']) return ''; |
|
26 | + if ('' === $data['slug']) { |
|
27 | + return ''; |
|
28 | + } |
|
27 | 29 | |
28 | - if (false !== Validate::url($data['slug'])) return $data['slug']; |
|
30 | + if (false !== Validate::url($data['slug'])) { |
|
31 | + return $data['slug']; |
|
32 | + } |
|
29 | 33 | |
30 | 34 | return (INSTALL_PATH . '/' . $data['slug']); |
31 | 35 | }); |
@@ -37,9 +37,13 @@ |
||
37 | 37 | |
38 | 38 | public static function get(string $table, int $id = 0) : Entitizer\Utils\Entity { |
39 | 39 | |
40 | - if (!isset(self::$classes[$table])) throw new Exception\General(self::$error_message); |
|
40 | + if (!isset(self::$classes[$table])) { |
|
41 | + throw new Exception\General(self::$error_message); |
|
42 | + } |
|
41 | 43 | |
42 | - if (isset(self::$cache[$table][$id])) return self::$cache[$table][$id]; |
|
44 | + if (isset(self::$cache[$table][$id])) { |
|
45 | + return self::$cache[$table][$id]; |
|
46 | + } |
|
43 | 47 | |
44 | 48 | $entity = new self::$classes[$table]; $entity->init($id); |
45 | 49 |
@@ -23,7 +23,9 @@ discard block |
||
23 | 23 | |
24 | 24 | public function initBySlug(string $slug) : bool { |
25 | 25 | |
26 | - if (0 !== $this->id) return false; |
|
26 | + if (0 !== $this->id) { |
|
27 | + return false; |
|
28 | + } |
|
27 | 29 | |
28 | 30 | # Process value |
29 | 31 | |
@@ -33,7 +35,9 @@ discard block |
||
33 | 35 | |
34 | 36 | $selection = array_keys($this->definition->getParams()); |
35 | 37 | |
36 | - foreach ($selection as $key => $field) $selection[$key] = ('ent.' . $field); |
|
38 | + foreach ($selection as $key => $field) { |
|
39 | + $selection[$key] = ('ent.' . $field); |
|
40 | + } |
|
37 | 41 | |
38 | 42 | # Process query |
39 | 43 | |
@@ -49,7 +53,9 @@ discard block |
||
49 | 53 | |
50 | 54 | # Select entity from DB |
51 | 55 | |
52 | - if (!(DB::send($query) && (DB::getLast()->rows === 1))) return false; |
|
56 | + if (!(DB::send($query) && (DB::getLast()->rows === 1))) { |
|
57 | + return false; |
|
58 | + } |
|
53 | 59 | |
54 | 60 | # ------------------------ |
55 | 61 | |
@@ -64,7 +70,9 @@ discard block |
||
64 | 70 | |
65 | 71 | public function updateSlugs() : bool { |
66 | 72 | |
67 | - if (0 === $this->id) return false; |
|
73 | + if (0 === $this->id) { |
|
74 | + return false; |
|
75 | + } |
|
68 | 76 | |
69 | 77 | # Send lock/update request |
70 | 78 | |
@@ -82,7 +90,9 @@ discard block |
||
82 | 90 | |
83 | 91 | (") slg ON slg.id = ent.id SET ent.locked = 1, ent.slug = slg.slug"); |
84 | 92 | |
85 | - if (!(DB::send($query) && DB::getLast()->status)) return false; |
|
93 | + if (!(DB::send($query) && DB::getLast()->status)) { |
|
94 | + return false; |
|
95 | + } |
|
86 | 96 | |
87 | 97 | # Send unlock request |
88 | 98 | |
@@ -98,7 +108,9 @@ discard block |
||
98 | 108 | |
99 | 109 | (") chk ON chk.id = ent.id SET ent.locked = 0"); |
100 | 110 | |
101 | - if (!(DB::send($query) && DB::getLast()->status)) return false; |
|
111 | + if (!(DB::send($query) && DB::getLast()->status)) { |
|
112 | + return false; |
|
113 | + } |
|
102 | 114 | |
103 | 115 | # ------------------------ |
104 | 116 | |
@@ -113,7 +125,9 @@ discard block |
||
113 | 125 | |
114 | 126 | public function create(array $data) : bool { |
115 | 127 | |
116 | - if (!parent::create($data)) return false; |
|
128 | + if (!parent::create($data)) { |
|
129 | + return false; |
|
130 | + } |
|
117 | 131 | |
118 | 132 | $this->updateSlugs(); |
119 | 133 | |
@@ -130,7 +144,9 @@ discard block |
||
130 | 144 | |
131 | 145 | public function edit(array $data) : bool { |
132 | 146 | |
133 | - if (!parent::edit($data)) return false; |
|
147 | + if (!parent::edit($data)) { |
|
148 | + return false; |
|
149 | + } |
|
134 | 150 | |
135 | 151 | $this->updateSlugs(); |
136 | 152 | |
@@ -147,7 +163,9 @@ discard block |
||
147 | 163 | |
148 | 164 | public function move(int $parent_id) : bool { |
149 | 165 | |
150 | - if (!parent::move($parent_id)) return false; |
|
166 | + if (!parent::move($parent_id)) { |
|
167 | + return false; |
|
168 | + } |
|
151 | 169 | |
152 | 170 | $this->updateSlugs(); |
153 | 171 |
@@ -36,9 +36,13 @@ |
||
36 | 36 | |
37 | 37 | $this->name = $name; $this->table = $table; $this->field = $field; |
38 | 38 | |
39 | - if (null !== $delete) $this->delete = $this->validateAction($delete); |
|
39 | + if (null !== $delete) { |
|
40 | + $this->delete = $this->validateAction($delete); |
|
41 | + } |
|
40 | 42 | |
41 | - if (null !== $update) $this->update = $this->validateAction($update); |
|
43 | + if (null !== $update) { |
|
44 | + $this->update = $this->validateAction($update); |
|
45 | + } |
|
42 | 46 | } |
43 | 47 | |
44 | 48 | /** |
@@ -21,7 +21,9 @@ |
||
21 | 21 | |
22 | 22 | public function __construct(string $name, bool $short = false, int $length = 0, bool $unsigned = false, int $default = 0) { |
23 | 23 | |
24 | - foreach (get_defined_vars() as $name => $value) $this->$name = $value; |
|
24 | + foreach (get_defined_vars() as $name => $value) { |
|
25 | + $this->$name = $value; |
|
26 | + } |
|
25 | 27 | } |
26 | 28 | |
27 | 29 | /** |
@@ -21,7 +21,9 @@ |
||
21 | 21 | |
22 | 22 | public function __construct(string $name, bool $default = false) { |
23 | 23 | |
24 | - foreach (get_defined_vars() as $name => $value) $this->$name = $value; |
|
24 | + foreach (get_defined_vars() as $name => $value) { |
|
25 | + $this->$name = $value; |
|
26 | + } |
|
25 | 27 | } |
26 | 28 | |
27 | 29 | /** |