@@ -27,8 +27,8 @@ discard block |
||
27 | 27 | |
28 | 28 | const ABORT = "abortAction"; |
29 | 29 | |
30 | - function __construct($params=null) { |
|
31 | - $this->ci =& get_instance(); |
|
30 | + function __construct($params = null) { |
|
31 | + $this->ci = & get_instance(); |
|
32 | 32 | $this->ci->load->database(); |
33 | 33 | $this->table_name = self::TABLE_PREFIX . (isset($params["name"]) ? "_" . $params["name"] : ""); |
34 | 34 | $this->ci->load->database(); |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | * @param [type] $adminIdColumnConstraint [description] |
46 | 46 | * @return [type] [description] |
47 | 47 | */ |
48 | - public function install($blogName=null, $adminTableName = null, $adminIdColumnName = null, $adminIdColumnConstraint = null) { |
|
48 | + public function install($blogName = null, $adminTableName = null, $adminIdColumnName = null, $adminIdColumnConstraint = null) { |
|
49 | 49 | $blogName = $blogName == null ? $this->table_name : self::TABLE_PREFIX . "_" . $blogName; |
50 | 50 | $this->ci->load->dbforge(); |
51 | 51 | $this->ci->dbforge->add_field("id"); |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | * @param boolean $w3css [description] |
138 | 138 | * @return [type] [description] |
139 | 139 | */ |
140 | - public function loadEditor($callback, $postId=null, $w3css=true) { |
|
140 | + public function loadEditor($callback, $postId = null, $w3css = true) { |
|
141 | 141 | $this->loadScripts($w3css); |
142 | 142 | $this->ci->load->helper("form"); |
143 | 143 | $data = array( |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | * @param [type] $posterId [description] |
159 | 159 | * @return [type] [description] |
160 | 160 | */ |
161 | - public function savePost($posterId=null) { |
|
161 | + public function savePost($posterId = null) { |
|
162 | 162 | $action = $this->ci->security->xss_clean($this->ci->input->post("action")); |
163 | 163 | if ($action == "save") { |
164 | 164 | $id = $this->ci->security->xss_clean($this->ci->input->post("id")); |
@@ -194,7 +194,7 @@ discard block |
||
194 | 194 | * return all posts. false by default. |
195 | 195 | * @return array Array of posts for a given page. |
196 | 196 | */ |
197 | - public function getPosts($page, $limit, $filter=false, $hits=false) { |
|
197 | + public function getPosts($page, $limit, $filter = false, $hits = false) { |
|
198 | 198 | return $this->ci->bmanager->getPosts($page, $limit, $filter, $hits); |
199 | 199 | } |
200 | 200 | /** |
@@ -207,7 +207,7 @@ discard block |
||
207 | 207 | * @param boolean $hits [description] |
208 | 208 | * @return [type] [description] |
209 | 209 | */ |
210 | - public function renderPostItems($view=null, $callback=null, $empty_view=null, $page=1, $limit=5, $filter=false, $hits=false, $slug=true) { |
|
210 | + public function renderPostItems($view = null, $callback = null, $empty_view = null, $page = 1, $limit = 5, $filter = false, $hits = false, $slug = true) { |
|
211 | 211 | if ($view == null || $empty_view == null) $this->ci->load->bind("francis94c/blog", $blogger); |
212 | 212 | $posts = $this->getPosts($page, $limit, $filter, $hits); |
213 | 213 | if (count($posts) == 0) { |
@@ -232,7 +232,7 @@ discard block |
||
232 | 232 | * @param boolean $filter [description] |
233 | 233 | * @return [type] [description] |
234 | 234 | */ |
235 | - public function getRecentPosts($limit=5, $filter=false) { |
|
235 | + public function getRecentPosts($limit = 5, $filter = false) { |
|
236 | 236 | return $this->ci->bmanager->getRecentPosts($limit, $filter); |
237 | 237 | } |
238 | 238 | /** |
@@ -241,7 +241,7 @@ discard block |
||
241 | 241 | * @param [type] $view [description] |
242 | 242 | * @return [type] [description] |
243 | 243 | */ |
244 | - public function renderPost($post, $view=null) { |
|
244 | + public function renderPost($post, $view = null) { |
|
245 | 245 | if (!is_array($post)) $post = $this->ci->bmanager->getPost($post); |
246 | 246 | $post["content"] = $this->ci->parsedown->text($post["content"]); |
247 | 247 | if ($view == null) { |
@@ -275,7 +275,7 @@ discard block |
||
275 | 275 | * @param [type] $postId [description] |
276 | 276 | * @return [type] [description] |
277 | 277 | */ |
278 | - public function getPost($postId, $hit=true) { |
|
278 | + public function getPost($postId, $hit = true) { |
|
279 | 279 | return $this->ci->bmanager->getPost($postId, $hit); |
280 | 280 | } |
281 | 281 | /** |
@@ -311,7 +311,7 @@ discard block |
||
311 | 311 | * @param boolean $filter [description] |
312 | 312 | * @return [type] [description] |
313 | 313 | */ |
314 | - public function searchPosts($words, $page, $limit=0, $filter=false) { |
|
314 | + public function searchPosts($words, $page, $limit = 0, $filter = false) { |
|
315 | 315 | return $this->ci->bmanager->searchPosts($words, $page, $limit, $filter); |
316 | 316 | } |
317 | 317 | } |
@@ -88,7 +88,9 @@ discard block |
||
88 | 88 | "FOREIGN KEY (poster_id) REFERENCES $adminTableName($adminIdColumnName)"); |
89 | 89 | } |
90 | 90 | $attributes = array('ENGINE' => 'InnoDB'); |
91 | - if (!$this->ci->dbforge->create_table($blogName, true, $attributes)) return false; |
|
91 | + if (!$this->ci->dbforge->create_table($blogName, true, $attributes)) { |
|
92 | + return false; |
|
93 | + } |
|
92 | 94 | return true; |
93 | 95 | } |
94 | 96 | /** |
@@ -172,7 +174,9 @@ discard block |
||
172 | 174 | } elseif ($action == "publish" || $action == "createAndPublish") { |
173 | 175 | if ($action == "publish") { |
174 | 176 | $id = $this->ci->security->xss_clean($this->ci->input->post("id")); |
175 | - if ($id == "") return self::ABORT; |
|
177 | + if ($id == "") { |
|
178 | + return self::ABORT; |
|
179 | + } |
|
176 | 180 | $this->ci->bmanager->savePost($id, $this->ci->security->xss_clean($this->ci->input->post("title")), $this->ci->security->xss_clean($this->ci->input->post("editor")), $posterId); |
177 | 181 | $this->ci->bmanager->publishPost($id, true); |
178 | 182 | return self::PUBLISH; |
@@ -181,7 +185,9 @@ discard block |
||
181 | 185 | return self::CREATE_AND_PUBLISH; |
182 | 186 | } |
183 | 187 | } elseif ($action == "delete") { |
184 | - if ($this->ci->bmanager->deletePost($this->ci->security->xss_clean($this->ci->input->post("id")))) return self::DELETE; |
|
188 | + if ($this->ci->bmanager->deletePost($this->ci->security->xss_clean($this->ci->input->post("id")))) { |
|
189 | + return self::DELETE; |
|
190 | + } |
|
185 | 191 | } |
186 | 192 | return false; |
187 | 193 | } |
@@ -208,7 +214,9 @@ discard block |
||
208 | 214 | * @return [type] [description] |
209 | 215 | */ |
210 | 216 | public function renderPostItems($view=null, $callback=null, $empty_view=null, $page=1, $limit=5, $filter=false, $hits=false, $slug=true) { |
211 | - if ($view == null || $empty_view == null) $this->ci->load->bind("francis94c/blog", $blogger); |
|
217 | + if ($view == null || $empty_view == null) { |
|
218 | + $this->ci->load->bind("francis94c/blog", $blogger); |
|
219 | + } |
|
212 | 220 | $posts = $this->getPosts($page, $limit, $filter, $hits); |
213 | 221 | if (count($posts) == 0) { |
214 | 222 | if ($empty_view == null) { $blogger->load->view("empty"); } else { |
@@ -242,7 +250,9 @@ discard block |
||
242 | 250 | * @return [type] [description] |
243 | 251 | */ |
244 | 252 | public function renderPost($post, $view=null) { |
245 | - if (!is_array($post)) $post = $this->ci->bmanager->getPost($post); |
|
253 | + if (!is_array($post)) { |
|
254 | + $post = $this->ci->bmanager->getPost($post); |
|
255 | + } |
|
246 | 256 | $post["content"] = $this->ci->parsedown->text($post["content"]); |
247 | 257 | if ($view == null) { |
248 | 258 | $this->ci->load->splint("francis94c/blog", "-post_item", $post); |
@@ -259,7 +269,9 @@ discard block |
||
259 | 269 | $data = array(); |
260 | 270 | $data["title"] = $post["title"]; |
261 | 271 | $data["description"] = substr($post["content"], 0, 154); |
262 | - if (isset($post["share_image"])) $data["image_link"] = $post["share_image"]; |
|
272 | + if (isset($post["share_image"])) { |
|
273 | + $data["image_link"] = $post["share_image"]; |
|
274 | + } |
|
263 | 275 | $data["url"] = current_url(); |
264 | 276 | return $this->ci->load->splint(self::PACKAGE, "-meta_og", $data, true); |
265 | 277 | } |