@@ -36,7 +36,7 @@ |
||
| 36 | 36 | } |
| 37 | 37 | if ($success) { |
| 38 | 38 | $this->alertBox->setAlert('Configuration updates successfully'); |
| 39 | - } else { |
|
| 39 | + }else { |
|
| 40 | 40 | $this->alertBox->setAlert('error in configuration update', 'error'); |
| 41 | 41 | } |
| 42 | 42 | $this->container->getResponse()->redirect('admin/config'); |
@@ -38,7 +38,7 @@ |
||
| 38 | 38 | if (!$configModel->updateConfig($update->name, $update->value)) { |
| 39 | 39 | $result['success'] = false; |
| 40 | 40 | $result['errorId'][] = $update->name; |
| 41 | - } else { |
|
| 41 | + }else { |
|
| 42 | 42 | $result['successId'][] = $update->name; |
| 43 | 43 | } |
| 44 | 44 | } |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | $this->query($sql); |
| 88 | 88 | if ($select != null) { |
| 89 | 89 | foreach ($select as $col => $val) { |
| 90 | - $this->bind(":" . $col, $val); |
|
| 90 | + $this->bind(":".$col, $val); |
|
| 91 | 91 | } |
| 92 | 92 | } |
| 93 | 93 | $this->bind(":limit", $limit); |
@@ -121,7 +121,7 @@ discard block |
||
| 121 | 121 | $this->query($sql); |
| 122 | 122 | if ($select != null) { |
| 123 | 123 | foreach ($select as $col => $val) { |
| 124 | - $this->bind(":" . $col, $val); |
|
| 124 | + $this->bind(":".$col, $val); |
|
| 125 | 125 | } |
| 126 | 126 | } |
| 127 | 127 | $this->execute(); |
@@ -291,7 +291,7 @@ discard block |
||
| 291 | 291 | |
| 292 | 292 | $this->execute(); |
| 293 | 293 | |
| 294 | - return (int)$this->dbh->lastInsertId(); |
|
| 294 | + return (int) $this->dbh->lastInsertId(); |
|
| 295 | 295 | } |
| 296 | 296 | |
| 297 | 297 | /** |
@@ -67,7 +67,7 @@ |
||
| 67 | 67 | $this->query($sql); |
| 68 | 68 | $this->bind(":tag", $tag); |
| 69 | 69 | $this->execute(); |
| 70 | - return (int)$this->dbh->lastInsertId(); |
|
| 70 | + return (int) $this->dbh->lastInsertId(); |
|
| 71 | 71 | |
| 72 | 72 | } |
| 73 | 73 | |
@@ -23,5 +23,5 @@ |
||
| 23 | 23 | const POSTS_PER_PAGE = 4; |
| 24 | 24 | const LIST_PER_PAGE = 10; |
| 25 | 25 | |
| 26 | - const EXCERPT_WORD_COUNT =50; |
|
| 26 | + const EXCERPT_WORD_COUNT = 50; |
|
| 27 | 27 | } |
| 28 | 28 | \ No newline at end of file |
@@ -34,7 +34,7 @@ |
||
| 34 | 34 | $categories = $categoryModel->getCategories(); |
| 35 | 35 | foreach ($categories as $category) { |
| 36 | 36 | $data += [ |
| 37 | - $category->category_name => '/category/posts/' . $category->categories_slug |
|
| 37 | + $category->category_name => '/category/posts/'.$category->categories_slug |
|
| 38 | 38 | ]; |
| 39 | 39 | } |
| 40 | 40 | return $data; |
@@ -139,7 +139,7 @@ discard block |
||
| 139 | 139 | $table = $reflect->getShortName(); //this is to only get the model name, otherwise we get the full namespace |
| 140 | 140 | //since our models all end with Model, we should remove it. |
| 141 | 141 | $table = $this->removeFromEnd($table, 'Model'); |
| 142 | - $table = $table . 's'; //adding the s since the table should be plural. Might be some special case where the plural isn't just with an s |
|
| 142 | + $table = $table.'s'; //adding the s since the table should be plural. Might be some special case where the plural isn't just with an s |
|
| 143 | 143 | $table = strtolower($table); //the database names are in lowercase |
| 144 | 144 | } |
| 145 | 145 | |
@@ -162,7 +162,7 @@ discard block |
||
| 162 | 162 | } |
| 163 | 163 | |
| 164 | 164 | //if we are here, then table doesn't exist, check for view |
| 165 | - $view = 'v_' . $table; |
|
| 165 | + $view = 'v_'.$table; |
|
| 166 | 166 | $stmt->bindValue(':table', $view, PDO::PARAM_STR); |
| 167 | 167 | $stmt->execute(); |
| 168 | 168 | $exists = $stmt->rowCount() > 0; //will return 1 if table exists or 0 if non existant |
@@ -186,7 +186,7 @@ discard block |
||
| 186 | 186 | protected function getTablePrefix($table) |
| 187 | 187 | { |
| 188 | 188 | if (Config::TABLE_PREFIX != '') { |
| 189 | - $table = Config::TABLE_PREFIX . '_' . $table; |
|
| 189 | + $table = Config::TABLE_PREFIX.'_'.$table; |
|
| 190 | 190 | } |
| 191 | 191 | return $table; |
| 192 | 192 | } |
@@ -255,7 +255,7 @@ discard block |
||
| 255 | 255 | protected function getRowById($rowId, $table = null) |
| 256 | 256 | { |
| 257 | 257 | $tableName = $this->getTable($table); |
| 258 | - $idName = 'id' . $tableName; |
|
| 258 | + $idName = 'id'.$tableName; |
|
| 259 | 259 | $sql = "SELECT * FROM $tableName WHERE $idName = :rowId"; |
| 260 | 260 | $this->query($sql); |
| 261 | 261 | $this->bind(':rowId', $rowId); |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | |
| 85 | 85 | //Searching for the page break tag |
| 86 | 86 | $breakTagPosition = strpos($text, "<!-- EndOfExcerptBlogOc -->"); |
| 87 | - if($breakTagPosition > 0){ |
|
| 87 | + if ($breakTagPosition > 0) { |
|
| 88 | 88 | return $this->completeDom(substr($text, 0, $breakTagPosition)); |
| 89 | 89 | } |
| 90 | 90 | |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | $string = preg_split('/(<img[^>]+\>)|(<p[^>]+\>)|(<span[^>]+\>)|\s/', $text, -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE); |
| 93 | 93 | |
| 94 | 94 | //The preg split can return false, probably will never happen but just in case. |
| 95 | - if(!$string) |
|
| 95 | + if (!$string) |
|
| 96 | 96 | { |
| 97 | 97 | throw new \Error("excerpt generation failed"); |
| 98 | 98 | } |
@@ -105,7 +105,7 @@ discard block |
||
| 105 | 105 | $trimed .= $string[$wordCounter]; |
| 106 | 106 | if ($wordCounter < $count - 1) { |
| 107 | 107 | $trimed .= " "; |
| 108 | - } else { |
|
| 108 | + }else { |
|
| 109 | 109 | $trimed .= "[...]"; |
| 110 | 110 | } |
| 111 | 111 | } |
@@ -159,7 +159,7 @@ discard block |
||
| 159 | 159 | $result = true; |
| 160 | 160 | foreach ($strings as $string) |
| 161 | 161 | { |
| 162 | - if(!$this->isAlphaNum($string)) |
|
| 162 | + if (!$this->isAlphaNum($string)) |
|
| 163 | 163 | { |
| 164 | 164 | $result = false; |
| 165 | 165 | } |
@@ -211,10 +211,12 @@ |
||
| 211 | 211 | $this->alertBox->setAlert("empty slug not allowed", "error"); |
| 212 | 212 | } |
| 213 | 213 | |
| 214 | - if ($postSlug != $originalPostSlug) //if the slug has been updated |
|
| 214 | + if ($postSlug != $originalPostSlug) { |
|
| 215 | + //if the slug has been updated |
|
| 215 | 216 | { |
| 216 | 217 | if (!$this->postModel->isPostSlugUnique($postSlug)) { |
| 217 | 218 | $error = true; |
| 219 | + } |
|
| 218 | 220 | $originalPostSlug = $this->postModel->getPostSlugFromId($postId); |
| 219 | 221 | $this->alertBox->setAlert("Slug not unique", "error"); |
| 220 | 222 | } |
@@ -166,10 +166,10 @@ discard block |
||
| 166 | 166 | |
| 167 | 167 | //checking result and redirecting |
| 168 | 168 | if ($postId != null) { |
| 169 | - $this->alertBox->setAlert("Post " . $title . " Created"); |
|
| 170 | - $this->container->getResponse()->redirect("admin/post/modify/" . $postSlug); |
|
| 169 | + $this->alertBox->setAlert("Post ".$title." Created"); |
|
| 170 | + $this->container->getResponse()->redirect("admin/post/modify/".$postSlug); |
|
| 171 | 171 | } |
| 172 | - $this->alertBox->setAlert("Error creating " . $title, "error"); |
|
| 172 | + $this->alertBox->setAlert("Error creating ".$title, "error"); |
|
| 173 | 173 | $this->container->getResponse()->redirect("admin/post/new"); |
| 174 | 174 | |
| 175 | 175 | } |
@@ -237,11 +237,11 @@ discard block |
||
| 237 | 237 | |
| 238 | 238 | //checking result and redirecting |
| 239 | 239 | if ($postUpdate) { |
| 240 | - $this->alertBox->setAlert("Post " . $title . " Updated"); |
|
| 241 | - $this->container->getResponse()->redirect("admin/post/modify/" . $postSlug); |
|
| 240 | + $this->alertBox->setAlert("Post ".$title." Updated"); |
|
| 241 | + $this->container->getResponse()->redirect("admin/post/modify/".$postSlug); |
|
| 242 | 242 | } |
| 243 | - $this->alertBox->setAlert("Error updating " . $title, "error"); |
|
| 244 | - $this->container->getResponse()->redirect("admin/post/modify/" . $originalPostSlug); |
|
| 243 | + $this->alertBox->setAlert("Error updating ".$title, "error"); |
|
| 244 | + $this->container->getResponse()->redirect("admin/post/modify/".$originalPostSlug); |
|
| 245 | 245 | } |
| 246 | 246 | |
| 247 | 247 | |
@@ -258,7 +258,7 @@ discard block |
||
| 258 | 258 | $removedPost = $this->postModel->deletePost($postId); |
| 259 | 259 | |
| 260 | 260 | if ($removedPost) { |
| 261 | - $this->alertBox->setAlert("Post " . $postTitle . " deleted"); |
|
| 261 | + $this->alertBox->setAlert("Post ".$postTitle." deleted"); |
|
| 262 | 262 | } |
| 263 | 263 | |
| 264 | 264 | $this->response->redirect("admin/post/list/"); |