Completed
Push — master ( fff5c4...297df5 )
by Justin
03:28
created
system/packages/com.jukusoft.cms.page/classes/pagetype.php 2 patches
Indentation   +300 added lines, -300 removed lines patch added patch discarded remove patch
@@ -18,331 +18,331 @@
 block discarded – undo
18 18
 
19 19
 class PageType {
20 20
 
21
-	protected $page = null;
21
+    protected $page = null;
22 22
 
23
-	public function __construct() {
24
-		//
25
-	}
23
+    public function __construct() {
24
+        //
25
+    }
26 26
 
27
-	public function setPage (Page &$page) {
28
-		$this->page = $page;
29
-	}
27
+    public function setPage (Page &$page) {
28
+        $this->page = $page;
29
+    }
30 30
 
31
-	protected function getPage () : Page {
32
-		return $this->page;
33
-	}
31
+    protected function getPage () : Page {
32
+        return $this->page;
33
+    }
34 34
 
35
-	public function showDesign () {
36
-		return true;
37
-	}
35
+    public function showDesign () {
36
+        return true;
37
+    }
38 38
 
39
-	public function getContentType () : string {
40
-		return "" . $this->page->getContentType() . "; charset=" . $this->getCharset();
41
-	}
39
+    public function getContentType () : string {
40
+        return "" . $this->page->getContentType() . "; charset=" . $this->getCharset();
41
+    }
42 42
 
43
-	public function getCharset () : string {
44
-		return "utf-8";
45
-	}
43
+    public function getCharset () : string {
44
+        return "utf-8";
45
+    }
46 46
 
47
-	public function setCustomHeader () {
48
-		//
49
-	}
47
+    public function setCustomHeader () {
48
+        //
49
+    }
50 50
 
51
-	public function getAdditionalHeaderCode () : string {
52
-		return "";
53
-	}
51
+    public function getAdditionalHeaderCode () : string {
52
+        return "";
53
+    }
54 54
 
55
-	public function showFooter () : bool {
56
-		return true;
57
-	}
55
+    public function showFooter () : bool {
56
+        return true;
57
+    }
58 58
 
59
-	public function getFooterScripts () : string {
60
-		return "";
61
-	}
59
+    public function getFooterScripts () : string {
60
+        return "";
61
+    }
62 62
 
63
-	public function showHTMLComments () : bool {
64
-		return true;
65
-	}
63
+    public function showHTMLComments () : bool {
64
+        return true;
65
+    }
66 66
 
67
-	public function getOgTitle () : string {
68
-		return $this->page->getOgTitle;
69
-	}
67
+    public function getOgTitle () : string {
68
+        return $this->page->getOgTitle;
69
+    }
70 70
 
71
-	public function getOgType () : string {
72
-		return $this->page->getOgType();
73
-	}
71
+    public function getOgType () : string {
72
+        return $this->page->getOgType();
73
+    }
74 74
 
75
-	public function getOgImage () : string {
76
-		return $this->page->getOgImage();
77
-	}
75
+    public function getOgImage () : string {
76
+        return $this->page->getOgImage();
77
+    }
78 78
 
79
-	public function getOgUrl () : string {
80
-		return DomainUtils::generateURL($this->page->getAlias());
81
-	}
79
+    public function getOgUrl () : string {
80
+        return DomainUtils::generateURL($this->page->getAlias());
81
+    }
82 82
 
83
-	public function getOgTags () : string {
84
-		$tags = array();
85
-		$tags['og:type'] = $this->getOgType();
86
-		$tags['og:url'] = $this->getOgUrl();
87
-		$tags['og:title'] = $this->getOgTitle();
83
+    public function getOgTags () : string {
84
+        $tags = array();
85
+        $tags['og:type'] = $this->getOgType();
86
+        $tags['og:url'] = $this->getOgUrl();
87
+        $tags['og:title'] = $this->getOgTitle();
88 88
 
89 89
 
90
-		$tags = "<meta property=\"og:type\" content=\"" . $this->getOgType() . "\" />
90
+        $tags = "<meta property=\"og:type\" content=\"" . $this->getOgType() . "\" />
91 91
 				<meta property=\"og:url\" content=\"" . $this->getOgUrl() . "\" />
92 92
 				<meta property=\"og:title\" content=\"" . $this->getOgTitle() . "\" />";
93 93
 
94
-		if (!empty($this->getOgImage())) {
95
-			$tags['og:image'] = $this->getOgImage();
96
-		}
97
-
98
-		$this->getAdditionalTags($tags);
99
-
100
-		Events::throwEvent("og_tags", array(
101
-			'page' => &$this->page,
102
-			'page_type' => &$this,
103
-			'tags' => &$tags
104
-		));
105
-
106
-		$tags_lines = "";
107
-
108
-		foreach ($tags as $property=>$content) {
109
-			$tags_lines .= "<meta property=\"" . $property . "\" content=\"" . $content . "\" />";
110
-		}
111
-
112
-		return $tags_lines;
113
-	}
114
-
115
-	/**
116
-	 * add additional tags
117
-	 *
118
-	 * This method was added so that page types doesn't have to override getOgTags() completely
119
-	 */
120
-	protected function getAdditionalTags (array &$tags) {
121
-		//add additional tags
122
-	}
123
-
124
-	public function getContent () : string {
125
-		$content = $this->getPage()->getContent();
126
-
127
-		//check, if page has custom template
128
-		if ($this->getPage()->hasCustomTemplate()) {
129
-			//get custom template
130
-			$template = Validator_String::get($this->getPage()->getCustomTemplate());
131
-
132
-			$current_style = Registry::singleton()->getSetting("current_style_name");
133
-
134
-			//check, if custom template exists
135
-			if (file_exists(STYLE_PATH . $current_style . "/" . $template)) {
136
-				$template = new Template($template);
137
-
138
-				$template->assign("TITLE", $this->getPage()->getTitle());
139
-				$template->assign("CONTENT", $content);
140
-
141
-				$template->parse("main");
142
-				$content = $template->getCode();
143
-			} else {
144
-				throw new IllegalStateException("Custom template '" . $template . "' doesnt exists.");
145
-			}
146
-		}
147
-
148
-		Events::throwEvent("get_content", array(
149
-			'content' => &$content,
150
-			'page' => &$this->page,
151
-			'page_type' => &$this
152
-		));
153
-
154
-		return $content;
155
-	}
156
-
157
-	public function generateNormalPage (string $content, $vars = array()) : string {
158
-		$current_style = Registry::singleton()->getSetting("current_style_name");
159
-
160
-		if (file_exists(STYLE_PATH . $current_style . "/pages/normal.tpl")) {
161
-			$template = new DwooTemplate(STYLE_PATH . $current_style . "/pages/normal.tpl");
162
-
163
-			$title_preafix = Settings::get("title_praefix", "");
164
-			$title_suffix = Settings::get("title_suffix", "");
165
-
166
-			//translate title
167
-			$title = Translator::translateTitle($this->getPage()->getTitle());
168
-
169
-			$template->assign("RAW_TITLE", $title);
170
-			$template->assign("TITLE", $title_preafix . $title . $title_suffix);
171
-			$template->assign("CONTENT", $content);
172
-			$template->assign("FOOTER", Registry::singleton()->getSetting("footer", ""));
173
-
174
-			Events::throwEvent("generate_normal_page", array(
175
-				'template' => &$template,
176
-				'current_style' => $current_style,
177
-				'content' => &$content,
178
-				'page_type' => &$this,
179
-				'page' => $this->getPage()
180
-			));
181
-
182
-			foreach ($vars as $key=>$value) {
183
-				$template->assign($key, $value);
184
-			}
185
-
186
-			return $template->getCode();
187
-		} else {
188
-			throw new IllegalStateException("no normal template (pages/normal.tpl) found!");
189
-			//return $content;
190
-		}
191
-	}
192
-
193
-	public function checkPermissions (PermissionChecker $permission_checker) {
194
-		//first, check required permissions
195
-		if (count($this->listRequiredPermissions()) > 0) {
196
-			$bool = false;
197
-
198
-			foreach ($this->listRequiredPermissions() as $permission) {
199
-				if ($permission_checker->hasRight($permission)) {
200
-					$bool = true;
201
-					break;
202
-				}
203
-			}
204
-
205
-			if (!$bool) {
206
-				return false;
207
-			}
208
-		}
209
-
210
-		if (!$this->getPage()->hasCustomPermissions()) {
211
-			return true;
212
-		} else {
213
-			$permissions = $this->getPage()->listCustomPermissions();
214
-
215
-			foreach ($permissions as $permission) {
216
-				if ($permission_checker->hasRight($permission)) {
217
-					return true;
218
-				}
219
-			}
220
-
221
-			return false;
222
-		}
223
-	}
224
-
225
-	protected function listRequiredPermissions () : array {
226
-		return array();
227
-	}
228
-
229
-	public function exitAfterOutput () {
230
-		return false;
231
-	}
232
-
233
-	public static function reloadCache () {
234
-		Cache::clear("pagetypes");
235
-	}
236
-
237
-	public static function listPageTypes (bool $advanced = false) : array {
238
-		$rows = array();
239
-
240
-		$advanced_str = $advanced ? "advanced" : "normal";
241
-
242
-		if (Cache::contains("pagetypes", "list-" . $advanced_str)) {
243
-			$rows = Cache::get("pagetypes", "list-" . $advanced_str);
244
-		} else {
245
-			if ($advanced) {
246
-				//show all page types
247
-				$rows = Database::getInstance()->listRows("SELECT * FROM `{praefix}page_types` WHERE `activated` = '1' ORDER BY `order`; ");
248
-			} else {
249
-				//show only not-expert page types
250
-				$rows = Database::getInstance()->listRows("SELECT * FROM `{praefix}page_types` WHERE `advanced` = '0' AND `activated` = '1' ORDER BY `order`; ");
251
-			}
252
-
253
-			//put into cache
254
-			Cache::put("pagetypes", "list-" . $advanced_str, $rows);
255
-		}
256
-
257
-		return $rows;
258
-	}
259
-
260
-	public static function createPageType (string $class_name, string $title, bool $advanced = false, int $order = 10, array $permissions = array("none"), string $owner = "system") {
261
-		//validate values
262
-		$class_name = Validator_String::get($class_name);
263
-		$title = Validator_String::get($title);
264
-		$order = Validator_Int::get($order);
265
-
266
-		Events::throwEvent("before_add_pagetype", array(
267
-			'class_name' => &$class_name,
268
-			'title' => &$title,
269
-			'create_permissions' => &$permissions,
270
-			'advanced' => &$advanced,
271
-			'owner' => &$owner,
272
-			'order' => &$order
273
-		));
274
-
275
-		//validate and convert array to string
276
-		$permissions = implode("|", $permissions);
277
-		$permissions = Validator_String::get($permissions);
278
-
279
-		Database::getInstance()->execute("INSERT INTO `{praefix}page_types` (
94
+        if (!empty($this->getOgImage())) {
95
+            $tags['og:image'] = $this->getOgImage();
96
+        }
97
+
98
+        $this->getAdditionalTags($tags);
99
+
100
+        Events::throwEvent("og_tags", array(
101
+            'page' => &$this->page,
102
+            'page_type' => &$this,
103
+            'tags' => &$tags
104
+        ));
105
+
106
+        $tags_lines = "";
107
+
108
+        foreach ($tags as $property=>$content) {
109
+            $tags_lines .= "<meta property=\"" . $property . "\" content=\"" . $content . "\" />";
110
+        }
111
+
112
+        return $tags_lines;
113
+    }
114
+
115
+    /**
116
+     * add additional tags
117
+     *
118
+     * This method was added so that page types doesn't have to override getOgTags() completely
119
+     */
120
+    protected function getAdditionalTags (array &$tags) {
121
+        //add additional tags
122
+    }
123
+
124
+    public function getContent () : string {
125
+        $content = $this->getPage()->getContent();
126
+
127
+        //check, if page has custom template
128
+        if ($this->getPage()->hasCustomTemplate()) {
129
+            //get custom template
130
+            $template = Validator_String::get($this->getPage()->getCustomTemplate());
131
+
132
+            $current_style = Registry::singleton()->getSetting("current_style_name");
133
+
134
+            //check, if custom template exists
135
+            if (file_exists(STYLE_PATH . $current_style . "/" . $template)) {
136
+                $template = new Template($template);
137
+
138
+                $template->assign("TITLE", $this->getPage()->getTitle());
139
+                $template->assign("CONTENT", $content);
140
+
141
+                $template->parse("main");
142
+                $content = $template->getCode();
143
+            } else {
144
+                throw new IllegalStateException("Custom template '" . $template . "' doesnt exists.");
145
+            }
146
+        }
147
+
148
+        Events::throwEvent("get_content", array(
149
+            'content' => &$content,
150
+            'page' => &$this->page,
151
+            'page_type' => &$this
152
+        ));
153
+
154
+        return $content;
155
+    }
156
+
157
+    public function generateNormalPage (string $content, $vars = array()) : string {
158
+        $current_style = Registry::singleton()->getSetting("current_style_name");
159
+
160
+        if (file_exists(STYLE_PATH . $current_style . "/pages/normal.tpl")) {
161
+            $template = new DwooTemplate(STYLE_PATH . $current_style . "/pages/normal.tpl");
162
+
163
+            $title_preafix = Settings::get("title_praefix", "");
164
+            $title_suffix = Settings::get("title_suffix", "");
165
+
166
+            //translate title
167
+            $title = Translator::translateTitle($this->getPage()->getTitle());
168
+
169
+            $template->assign("RAW_TITLE", $title);
170
+            $template->assign("TITLE", $title_preafix . $title . $title_suffix);
171
+            $template->assign("CONTENT", $content);
172
+            $template->assign("FOOTER", Registry::singleton()->getSetting("footer", ""));
173
+
174
+            Events::throwEvent("generate_normal_page", array(
175
+                'template' => &$template,
176
+                'current_style' => $current_style,
177
+                'content' => &$content,
178
+                'page_type' => &$this,
179
+                'page' => $this->getPage()
180
+            ));
181
+
182
+            foreach ($vars as $key=>$value) {
183
+                $template->assign($key, $value);
184
+            }
185
+
186
+            return $template->getCode();
187
+        } else {
188
+            throw new IllegalStateException("no normal template (pages/normal.tpl) found!");
189
+            //return $content;
190
+        }
191
+    }
192
+
193
+    public function checkPermissions (PermissionChecker $permission_checker) {
194
+        //first, check required permissions
195
+        if (count($this->listRequiredPermissions()) > 0) {
196
+            $bool = false;
197
+
198
+            foreach ($this->listRequiredPermissions() as $permission) {
199
+                if ($permission_checker->hasRight($permission)) {
200
+                    $bool = true;
201
+                    break;
202
+                }
203
+            }
204
+
205
+            if (!$bool) {
206
+                return false;
207
+            }
208
+        }
209
+
210
+        if (!$this->getPage()->hasCustomPermissions()) {
211
+            return true;
212
+        } else {
213
+            $permissions = $this->getPage()->listCustomPermissions();
214
+
215
+            foreach ($permissions as $permission) {
216
+                if ($permission_checker->hasRight($permission)) {
217
+                    return true;
218
+                }
219
+            }
220
+
221
+            return false;
222
+        }
223
+    }
224
+
225
+    protected function listRequiredPermissions () : array {
226
+        return array();
227
+    }
228
+
229
+    public function exitAfterOutput () {
230
+        return false;
231
+    }
232
+
233
+    public static function reloadCache () {
234
+        Cache::clear("pagetypes");
235
+    }
236
+
237
+    public static function listPageTypes (bool $advanced = false) : array {
238
+        $rows = array();
239
+
240
+        $advanced_str = $advanced ? "advanced" : "normal";
241
+
242
+        if (Cache::contains("pagetypes", "list-" . $advanced_str)) {
243
+            $rows = Cache::get("pagetypes", "list-" . $advanced_str);
244
+        } else {
245
+            if ($advanced) {
246
+                //show all page types
247
+                $rows = Database::getInstance()->listRows("SELECT * FROM `{praefix}page_types` WHERE `activated` = '1' ORDER BY `order`; ");
248
+            } else {
249
+                //show only not-expert page types
250
+                $rows = Database::getInstance()->listRows("SELECT * FROM `{praefix}page_types` WHERE `advanced` = '0' AND `activated` = '1' ORDER BY `order`; ");
251
+            }
252
+
253
+            //put into cache
254
+            Cache::put("pagetypes", "list-" . $advanced_str, $rows);
255
+        }
256
+
257
+        return $rows;
258
+    }
259
+
260
+    public static function createPageType (string $class_name, string $title, bool $advanced = false, int $order = 10, array $permissions = array("none"), string $owner = "system") {
261
+        //validate values
262
+        $class_name = Validator_String::get($class_name);
263
+        $title = Validator_String::get($title);
264
+        $order = Validator_Int::get($order);
265
+
266
+        Events::throwEvent("before_add_pagetype", array(
267
+            'class_name' => &$class_name,
268
+            'title' => &$title,
269
+            'create_permissions' => &$permissions,
270
+            'advanced' => &$advanced,
271
+            'owner' => &$owner,
272
+            'order' => &$order
273
+        ));
274
+
275
+        //validate and convert array to string
276
+        $permissions = implode("|", $permissions);
277
+        $permissions = Validator_String::get($permissions);
278
+
279
+        Database::getInstance()->execute("INSERT INTO `{praefix}page_types` (
280 280
 			`page_type`, `title`, `create_permissions`, `advanced`, `owner`, `order`, `activated`
281 281
 		) VALUES (
282 282
 			:pagetype, :title, :permissions, :advanced, :owner, :order, '1'
283 283
 		) ON DUPLICATE KEY UPDATE `title` = :title, `create_permissions` = :permissions, `advanced` = :advanced, `owner` = :owner, `order` = :order, `activated` = '1'; ", array(
284
-			'pagetype' => $class_name,
285
-			'title' => $title,
286
-			'permissions' => $permissions,
287
-			'advanced' => ($advanced ? 1 : 0),
288
-			'owner' => $owner,
289
-			'order' => $order
290
-		));
291
-
292
-		Events::throwEvent("after_add_pagetype", array(
293
-			'class_name' => $class_name,
294
-			'title' => $title,
295
-			'create_permissions' => $permissions,
296
-			'advanced' => $advanced,
297
-			'owner' => $owner,
298
-			'order' => $order
299
-		));
300
-
301
-		//clear cache
302
-		Cache::clear("pagetypes");
303
-	}
304
-
305
-	public static function removePageType (string $class_name) {
306
-		//validate value
307
-		$class_name = Validator_String::get($class_name);
308
-
309
-		$delete = true;
310
-
311
-		//throw event, so plugins can interact
312
-		Events::throwEvent("before_remove_pagetype", array(
313
-			'class_name' => &$class_name,
314
-			'delete' => &$delete
315
-		));
316
-
317
-		if ($delete) {
318
-			Database::getInstance()->execute("DELETE FROM `{praefix}page_types` WHERE `page_type` = :pagetype; ", array('pagetype' => $class_name));
319
-
320
-			//throw event, so plugins can interact
321
-			Events::throwEvent("after_remove_pagetype", array(
322
-				'class_name' => $class_name
323
-			));
324
-
325
-			//clear cache
326
-			Cache::clear("pagetypes");
327
-		}
328
-	}
329
-
330
-	public static function removePageTypesByOwner (string $owner) {
331
-		Database::getInstance()->execute("DELETE FROM `{praefix}page_types` WHERE `owner` = :owner; ", array('owner' => $owner));
332
-
333
-		//TODO: change all pages which have this page type
334
-
335
-		//clear cache
336
-		Cache::clear("pagetypes");
337
-	}
338
-
339
-	public static function exists (string $class_name) : bool {
340
-		$row = Database::getInstance()->getRow("SELECT * FROM `{praefix}page_types` WHERE `page_type` = :pagetype; ", array(
341
-			'pagetype' => $class_name
342
-		));
343
-
344
-		return $row !== false;
345
-	}
284
+            'pagetype' => $class_name,
285
+            'title' => $title,
286
+            'permissions' => $permissions,
287
+            'advanced' => ($advanced ? 1 : 0),
288
+            'owner' => $owner,
289
+            'order' => $order
290
+        ));
291
+
292
+        Events::throwEvent("after_add_pagetype", array(
293
+            'class_name' => $class_name,
294
+            'title' => $title,
295
+            'create_permissions' => $permissions,
296
+            'advanced' => $advanced,
297
+            'owner' => $owner,
298
+            'order' => $order
299
+        ));
300
+
301
+        //clear cache
302
+        Cache::clear("pagetypes");
303
+    }
304
+
305
+    public static function removePageType (string $class_name) {
306
+        //validate value
307
+        $class_name = Validator_String::get($class_name);
308
+
309
+        $delete = true;
310
+
311
+        //throw event, so plugins can interact
312
+        Events::throwEvent("before_remove_pagetype", array(
313
+            'class_name' => &$class_name,
314
+            'delete' => &$delete
315
+        ));
316
+
317
+        if ($delete) {
318
+            Database::getInstance()->execute("DELETE FROM `{praefix}page_types` WHERE `page_type` = :pagetype; ", array('pagetype' => $class_name));
319
+
320
+            //throw event, so plugins can interact
321
+            Events::throwEvent("after_remove_pagetype", array(
322
+                'class_name' => $class_name
323
+            ));
324
+
325
+            //clear cache
326
+            Cache::clear("pagetypes");
327
+        }
328
+    }
329
+
330
+    public static function removePageTypesByOwner (string $owner) {
331
+        Database::getInstance()->execute("DELETE FROM `{praefix}page_types` WHERE `owner` = :owner; ", array('owner' => $owner));
332
+
333
+        //TODO: change all pages which have this page type
334
+
335
+        //clear cache
336
+        Cache::clear("pagetypes");
337
+    }
338
+
339
+    public static function exists (string $class_name) : bool {
340
+        $row = Database::getInstance()->getRow("SELECT * FROM `{praefix}page_types` WHERE `page_type` = :pagetype; ", array(
341
+            'pagetype' => $class_name
342
+        ));
343
+
344
+        return $row !== false;
345
+    }
346 346
 
347 347
 }
348 348
 
Please login to merge, or discard this patch.
Spacing   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -24,63 +24,63 @@  discard block
 block discarded – undo
24 24
 		//
25 25
 	}
26 26
 
27
-	public function setPage (Page &$page) {
27
+	public function setPage(Page &$page) {
28 28
 		$this->page = $page;
29 29
 	}
30 30
 
31
-	protected function getPage () : Page {
31
+	protected function getPage() : Page {
32 32
 		return $this->page;
33 33
 	}
34 34
 
35
-	public function showDesign () {
35
+	public function showDesign() {
36 36
 		return true;
37 37
 	}
38 38
 
39
-	public function getContentType () : string {
39
+	public function getContentType() : string {
40 40
 		return "" . $this->page->getContentType() . "; charset=" . $this->getCharset();
41 41
 	}
42 42
 
43
-	public function getCharset () : string {
43
+	public function getCharset() : string {
44 44
 		return "utf-8";
45 45
 	}
46 46
 
47
-	public function setCustomHeader () {
47
+	public function setCustomHeader() {
48 48
 		//
49 49
 	}
50 50
 
51
-	public function getAdditionalHeaderCode () : string {
51
+	public function getAdditionalHeaderCode() : string {
52 52
 		return "";
53 53
 	}
54 54
 
55
-	public function showFooter () : bool {
55
+	public function showFooter() : bool {
56 56
 		return true;
57 57
 	}
58 58
 
59
-	public function getFooterScripts () : string {
59
+	public function getFooterScripts() : string {
60 60
 		return "";
61 61
 	}
62 62
 
63
-	public function showHTMLComments () : bool {
63
+	public function showHTMLComments() : bool {
64 64
 		return true;
65 65
 	}
66 66
 
67
-	public function getOgTitle () : string {
67
+	public function getOgTitle() : string {
68 68
 		return $this->page->getOgTitle;
69 69
 	}
70 70
 
71
-	public function getOgType () : string {
71
+	public function getOgType() : string {
72 72
 		return $this->page->getOgType();
73 73
 	}
74 74
 
75
-	public function getOgImage () : string {
75
+	public function getOgImage() : string {
76 76
 		return $this->page->getOgImage();
77 77
 	}
78 78
 
79
-	public function getOgUrl () : string {
79
+	public function getOgUrl() : string {
80 80
 		return DomainUtils::generateURL($this->page->getAlias());
81 81
 	}
82 82
 
83
-	public function getOgTags () : string {
83
+	public function getOgTags() : string {
84 84
 		$tags = array();
85 85
 		$tags['og:type'] = $this->getOgType();
86 86
 		$tags['og:url'] = $this->getOgUrl();
@@ -117,11 +117,11 @@  discard block
 block discarded – undo
117 117
 	 *
118 118
 	 * This method was added so that page types doesn't have to override getOgTags() completely
119 119
 	 */
120
-	protected function getAdditionalTags (array &$tags) {
120
+	protected function getAdditionalTags(array &$tags) {
121 121
 		//add additional tags
122 122
 	}
123 123
 
124
-	public function getContent () : string {
124
+	public function getContent() : string {
125 125
 		$content = $this->getPage()->getContent();
126 126
 
127 127
 		//check, if page has custom template
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
 		return $content;
155 155
 	}
156 156
 
157
-	public function generateNormalPage (string $content, $vars = array()) : string {
157
+	public function generateNormalPage(string $content, $vars = array()) : string {
158 158
 		$current_style = Registry::singleton()->getSetting("current_style_name");
159 159
 
160 160
 		if (file_exists(STYLE_PATH . $current_style . "/pages/normal.tpl")) {
@@ -190,7 +190,7 @@  discard block
 block discarded – undo
190 190
 		}
191 191
 	}
192 192
 
193
-	public function checkPermissions (PermissionChecker $permission_checker) {
193
+	public function checkPermissions(PermissionChecker $permission_checker) {
194 194
 		//first, check required permissions
195 195
 		if (count($this->listRequiredPermissions()) > 0) {
196 196
 			$bool = false;
@@ -222,19 +222,19 @@  discard block
 block discarded – undo
222 222
 		}
223 223
 	}
224 224
 
225
-	protected function listRequiredPermissions () : array {
225
+	protected function listRequiredPermissions() : array {
226 226
 		return array();
227 227
 	}
228 228
 
229
-	public function exitAfterOutput () {
229
+	public function exitAfterOutput() {
230 230
 		return false;
231 231
 	}
232 232
 
233
-	public static function reloadCache () {
233
+	public static function reloadCache() {
234 234
 		Cache::clear("pagetypes");
235 235
 	}
236 236
 
237
-	public static function listPageTypes (bool $advanced = false) : array {
237
+	public static function listPageTypes(bool $advanced = false) : array {
238 238
 		$rows = array();
239 239
 
240 240
 		$advanced_str = $advanced ? "advanced" : "normal";
@@ -257,7 +257,7 @@  discard block
 block discarded – undo
257 257
 		return $rows;
258 258
 	}
259 259
 
260
-	public static function createPageType (string $class_name, string $title, bool $advanced = false, int $order = 10, array $permissions = array("none"), string $owner = "system") {
260
+	public static function createPageType(string $class_name, string $title, bool $advanced = false, int $order = 10, array $permissions = array("none"), string $owner = "system") {
261 261
 		//validate values
262 262
 		$class_name = Validator_String::get($class_name);
263 263
 		$title = Validator_String::get($title);
@@ -302,7 +302,7 @@  discard block
 block discarded – undo
302 302
 		Cache::clear("pagetypes");
303 303
 	}
304 304
 
305
-	public static function removePageType (string $class_name) {
305
+	public static function removePageType(string $class_name) {
306 306
 		//validate value
307 307
 		$class_name = Validator_String::get($class_name);
308 308
 
@@ -327,7 +327,7 @@  discard block
 block discarded – undo
327 327
 		}
328 328
 	}
329 329
 
330
-	public static function removePageTypesByOwner (string $owner) {
330
+	public static function removePageTypesByOwner(string $owner) {
331 331
 		Database::getInstance()->execute("DELETE FROM `{praefix}page_types` WHERE `owner` = :owner; ", array('owner' => $owner));
332 332
 
333 333
 		//TODO: change all pages which have this page type
@@ -336,7 +336,7 @@  discard block
 block discarded – undo
336 336
 		Cache::clear("pagetypes");
337 337
 	}
338 338
 
339
-	public static function exists (string $class_name) : bool {
339
+	public static function exists(string $class_name) : bool {
340 340
 		$row = Database::getInstance()->getRow("SELECT * FROM `{praefix}page_types` WHERE `page_type` = :pagetype; ", array(
341 341
 			'pagetype' => $class_name
342 342
 		));
Please login to merge, or discard this patch.