@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | |
12 | 12 | function __construct() { |
13 | 13 | parent::__construct(); |
14 | - $this->ci =& get_instance(); |
|
14 | + $this->ci = & get_instance(); |
|
15 | 15 | $this->ci->load->database(); |
16 | 16 | } |
17 | 17 | /** |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | * database. Returns 0 if the post couldn't be |
45 | 45 | * created. |
46 | 46 | */ |
47 | - function createPost(string $title, string $content, int $adminId=null): int { |
|
47 | + function createPost(string $title, string $content, int $adminId = null): int { |
|
48 | 48 | $this->ci->load->helper("url"); |
49 | 49 | $data = array( |
50 | 50 | "title" => $title, |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | * @param [type] $adminId [description] |
64 | 64 | * @return [type] [description] |
65 | 65 | */ |
66 | - function createAndPublishPost($title, $content, $adminId=null) { |
|
66 | + function createAndPublishPost($title, $content, $adminId = null) { |
|
67 | 67 | $data = array( |
68 | 68 | "title" => $title, |
69 | 69 | "content" => $content, |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | * @param boolean $hits order by hits. |
87 | 87 | * @return array Array of posts for a given page. |
88 | 88 | */ |
89 | - function getPosts($page=1, $limit=5, $filter=false, $hits=false) { |
|
89 | + function getPosts($page = 1, $limit = 5, $filter = false, $hits = false) { |
|
90 | 90 | if ($limit != 0) $this->db->limit($limit, ($page * $limit) - $limit); |
91 | 91 | if ($filter) $this->db->where("published", 1); |
92 | 92 | if ($hits) { |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | * @param boolean $filter [description] |
103 | 103 | * @return [type] [description] |
104 | 104 | */ |
105 | - function getRecentPosts($limit=5, $filter=false) { |
|
105 | + function getRecentPosts($limit = 5, $filter = false) { |
|
106 | 106 | if ($limit != null && $limit != null) $this->db->limit($limit); |
107 | 107 | if ($filter) $this->db->where("published", 1); |
108 | 108 | $this->db->order_by("id", "DESC"); |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | * @return bool True on success, False if not. |
118 | 118 | */ |
119 | 119 | function savePost($postId, $title, $content): bool { |
120 | - $data = array ( |
|
120 | + $data = array( |
|
121 | 121 | "title" => $title, |
122 | 122 | "content" => $content, |
123 | 123 | "slug" => url_title($title) |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | * @param int $postId ID of the post to retrieve. |
132 | 132 | * @return array An associative array for the Posts's data. |
133 | 133 | */ |
134 | - function getPost($postId, $hit=true) { |
|
134 | + function getPost($postId, $hit = true) { |
|
135 | 135 | if (is_numeric($postId)) { |
136 | 136 | $this->db->where("id", $postId); |
137 | 137 | } else { |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | $this->db->update($this->table_name); |
148 | 148 | } |
149 | 149 | } |
150 | - $post = $query->result_array()[0]; |
|
150 | + $post = $query->result_array()[0]; |
|
151 | 151 | $images = array(); |
152 | 152 | // Fetch all images in post. |
153 | 153 | preg_match("/<img\s[^>]*?src\s*=\s*['\"]([^'\"]*?)['\"][^>]*?>/", $post["content"], $images); |
@@ -210,7 +210,7 @@ discard block |
||
210 | 210 | * @param boolean $filter [description] |
211 | 211 | * @return [type] [description] |
212 | 212 | */ |
213 | - function searchPosts($words, $page, $limit=0, $filter=false) { |
|
213 | + function searchPosts($words, $page, $limit = 0, $filter = false) { |
|
214 | 214 | if ($limit != 0) $this->db->limit($limit, ($page * $limit) - $limit); |
215 | 215 | if ($filter) $this->db->where("published", 1); |
216 | 216 | $this->db->like("title", $words); |
@@ -74,8 +74,8 @@ discard block |
||
74 | 74 | * Constructor |
75 | 75 | * @param mixed $params associative array of parameters. See README.md |
76 | 76 | */ |
77 | - function __construct($params=null) { |
|
78 | - $this->ci =& /** @scrutinizer ignore-call */ get_instance(); |
|
77 | + function __construct($params = null) { |
|
78 | + $this->ci = & /** @scrutinizer ignore-call */ get_instance(); |
|
79 | 79 | $this->ci->load->database(); |
80 | 80 | $this->table_name = self::TABLE_PREFIX . (isset($params["name"]) ? "_" . $params["name"] : ""); |
81 | 81 | $this->ci->load->database(); |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | * |
100 | 100 | * @return bool True on Success, False if Not. |
101 | 101 | */ |
102 | - public function install(string $blogName=null, string $adminTableName=null, string $adminIdColumnName=null, int $adminIdColumnConstraint=null): bool { |
|
102 | + public function install(string $blogName = null, string $adminTableName = null, string $adminIdColumnName = null, int $adminIdColumnConstraint = null): bool { |
|
103 | 103 | $blogName = $blogName === null ? $this->table_name : self::TABLE_PREFIX . "_" . $blogName; |
104 | 104 | $this->ci->load->dbforge(); |
105 | 105 | $this->ci->dbforge->add_field("id"); |
@@ -215,7 +215,7 @@ discard block |
||
215 | 215 | * |
216 | 216 | * @return bool True if sucessfull without errors, false if not. |
217 | 217 | */ |
218 | - public function loadEditor(string $callback, int $postId=null, bool $w3css=true): bool { |
|
218 | + public function loadEditor(string $callback, int $postId = null, bool $w3css = true): bool { |
|
219 | 219 | $this->loadScripts($w3css); |
220 | 220 | $this->ci->load->helper("form"); |
221 | 221 | $data = array( |
@@ -245,7 +245,7 @@ discard block |
||
245 | 245 | * inputs. These are public string constants declared in |
246 | 246 | * this file. |
247 | 247 | */ |
248 | - public function savePost(int $posterId=null): string { |
|
248 | + public function savePost(int $posterId = null): string { |
|
249 | 249 | $action = $this->ci->security->xss_clean($this->ci->input->post("action")); |
250 | 250 | if ($action == "save") { |
251 | 251 | return $this->handleSavePost(); |
@@ -296,7 +296,7 @@ discard block |
||
296 | 296 | * |
297 | 297 | * @return array Array of posts for a given page. |
298 | 298 | */ |
299 | - public function getPosts(int $page, int $limit, bool $filter=false, bool $hits=false): array { |
|
299 | + public function getPosts(int $page, int $limit, bool $filter = false, bool $hits = false): array { |
|
300 | 300 | return $this->ci->bmanager->getPosts($page, $limit, $filter, $hits); |
301 | 301 | } |
302 | 302 | /** |
@@ -309,7 +309,7 @@ discard block |
||
309 | 309 | * @param boolean $hits [description] |
310 | 310 | * @return [type] [description] |
311 | 311 | */ |
312 | - public function renderPostItems($view=null, $callback=null, $empty_view=null, $page=1, $limit=5, $filter=false, $hits=false, $slug=true) { |
|
312 | + public function renderPostItems($view = null, $callback = null, $empty_view = null, $page = 1, $limit = 5, $filter = false, $hits = false, $slug = true) { |
|
313 | 313 | if ($view == null || $empty_view == null) $this->ci->load->bind("francis94c/blog", $blogger); |
314 | 314 | $posts = $this->getPosts($page, $limit, $filter, $hits); |
315 | 315 | if (count($posts) == 0) { |
@@ -335,7 +335,7 @@ discard block |
||
335 | 335 | * @param boolean $filter [description] |
336 | 336 | * @return [type] [description] |
337 | 337 | */ |
338 | - public function getRecentPosts($limit=5, $filter=false) { |
|
338 | + public function getRecentPosts($limit = 5, $filter = false) { |
|
339 | 339 | return $this->ci->bmanager->getRecentPosts($limit, $filter); |
340 | 340 | } |
341 | 341 | /** |
@@ -344,7 +344,7 @@ discard block |
||
344 | 344 | * @param [type] $view [description] |
345 | 345 | * @return [type] [description] |
346 | 346 | */ |
347 | - public function renderPost($post, $view=null) { |
|
347 | + public function renderPost($post, $view = null) { |
|
348 | 348 | if (!is_array($post)) $post = $this->ci->bmanager->getPost($post); |
349 | 349 | if (!$post) return false; |
350 | 350 | $post["content"] = $this->ci->parsedown->text($post["content"]); |
@@ -380,7 +380,7 @@ discard block |
||
380 | 380 | * @param [type] $postId [description] |
381 | 381 | * @return [type] [description] |
382 | 382 | */ |
383 | - public function getPost($postId, $hit=true) { |
|
383 | + public function getPost($postId, $hit = true) { |
|
384 | 384 | return $this->ci->bmanager->getPost($postId, $hit); |
385 | 385 | } |
386 | 386 | /** |
@@ -416,7 +416,7 @@ discard block |
||
416 | 416 | * @param boolean $filter [description] |
417 | 417 | * @return [type] [description] |
418 | 418 | */ |
419 | - public function searchPosts($words, $page, $limit=0, $filter=false) { |
|
419 | + public function searchPosts($words, $page, $limit = 0, $filter = false) { |
|
420 | 420 | return $this->ci->bmanager->searchPosts($words, $page, $limit, $filter); |
421 | 421 | } |
422 | 422 | } |