@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | $onFrontpage = $posts["isOnFrontPage"]; |
| 87 | 87 | $idUser = $userSessionid; |
| 88 | 88 | |
| 89 | - if(!is_int($idUser) || $idUser === null) |
|
| 89 | + if (!is_int($idUser) || $idUser === null) |
|
| 90 | 90 | { |
| 91 | 91 | throw new \Error("Invalid userID"); |
| 92 | 92 | } |
@@ -129,10 +129,10 @@ discard block |
||
| 129 | 129 | |
| 130 | 130 | //checking result and redirecting |
| 131 | 131 | if ($postId != null) { |
| 132 | - $this->alertBox->setAlert("Post " . $title . " Created"); |
|
| 133 | - $this->container->getResponse()->redirect("admin/post/modify/" . $postSlug); |
|
| 132 | + $this->alertBox->setAlert("Post ".$title." Created"); |
|
| 133 | + $this->container->getResponse()->redirect("admin/post/modify/".$postSlug); |
|
| 134 | 134 | } |
| 135 | - $this->alertBox->setAlert("Error creating " . $title, "error"); |
|
| 135 | + $this->alertBox->setAlert("Error creating ".$title, "error"); |
|
| 136 | 136 | $this->container->getResponse()->redirect("admin/post/new"); |
| 137 | 137 | |
| 138 | 138 | } |
@@ -211,10 +211,10 @@ discard block |
||
| 211 | 211 | |
| 212 | 212 | //checking result and redirecting |
| 213 | 213 | if ($postUpdate) { |
| 214 | - $this->alertBox->setAlert("Post " . $title . " Updated"); |
|
| 215 | - $this->container->getResponse()->redirect("admin/post/modify/" . $postSlug); |
|
| 214 | + $this->alertBox->setAlert("Post ".$title." Updated"); |
|
| 215 | + $this->container->getResponse()->redirect("admin/post/modify/".$postSlug); |
|
| 216 | 216 | } |
| 217 | - $this->alertBox->setAlert("Error updating " . $title, "error"); |
|
| 218 | - $this->container->getResponse()->redirect("admin/post/modify/" . $originalPostSlug); |
|
| 217 | + $this->alertBox->setAlert("Error updating ".$title, "error"); |
|
| 218 | + $this->container->getResponse()->redirect("admin/post/modify/".$originalPostSlug); |
|
| 219 | 219 | } |
| 220 | 220 | } |
| 221 | 221 | \ No newline at end of file |
@@ -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 | /** |
@@ -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 | } |
@@ -26,7 +26,7 @@ |
||
| 26 | 26 | $postSlug = $this->request->getData("postSlug"); |
| 27 | 27 | |
| 28 | 28 | $data = false; |
| 29 | - if($this->isAlphaNum($postSlug)) |
|
| 29 | + if ($this->isAlphaNum($postSlug)) |
|
| 30 | 30 | { |
| 31 | 31 | $slugModel = new SlugModel($this->container); |
| 32 | 32 | |
@@ -43,13 +43,13 @@ discard block |
||
| 43 | 43 | private function getFilename(string $folder, string $file):string |
| 44 | 44 | { |
| 45 | 45 | |
| 46 | - $fileUrl = $folder . $file; |
|
| 46 | + $fileUrl = $folder.$file; |
|
| 47 | 47 | $docRoot = $this->request->getDocumentRoot(); |
| 48 | 48 | $filePath = $docRoot."/public/".$fileUrl; |
| 49 | - if(file_exists($filePath) !== 1) |
|
| 49 | + if (file_exists($filePath) !== 1) |
|
| 50 | 50 | { |
| 51 | 51 | $fileNum = 0; |
| 52 | - while(file_exists($filePath)) |
|
| 52 | + while (file_exists($filePath)) |
|
| 53 | 53 | { |
| 54 | 54 | $fileUrl = $folder.$fileNum."_".$file; |
| 55 | 55 | $filePath = $docRoot."/public/".$fileUrl; |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | |
| 77 | 77 | // Respond to the successful upload with JSON. |
| 78 | 78 | echo json_encode(array('location' => $filetowrite)); |
| 79 | - } else { |
|
| 79 | + }else { |
|
| 80 | 80 | // Notify editor that the upload failed |
| 81 | 81 | echo json_encode(array('error' => 'Upload failed, file might be too big')); |
| 82 | 82 | |
@@ -110,7 +110,7 @@ discard block |
||
| 110 | 110 | |
| 111 | 111 | // Respond to the successful upload with JSON. |
| 112 | 112 | echo json_encode(array('location' => $filetowrite)); |
| 113 | - } else { |
|
| 113 | + }else { |
|
| 114 | 114 | // Notify editor that the upload failed |
| 115 | 115 | header("HTTP/1.1 500 Server Error"); |
| 116 | 116 | } |
@@ -8,7 +8,7 @@ discard block |
||
| 8 | 8 | use Core\Controller; |
| 9 | 9 | use Core\Container; |
| 10 | 10 | |
| 11 | -class Post extends Controller{ |
|
| 11 | +class Post extends Controller { |
|
| 12 | 12 | |
| 13 | 13 | protected $siteConfig; |
| 14 | 14 | |
@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | * @throws \Twig_Error_Runtime |
| 27 | 27 | * @throws \Twig_Error_Syntax |
| 28 | 28 | */ |
| 29 | - public function viewPost(string $slug){ |
|
| 29 | + public function viewPost(string $slug) { |
|
| 30 | 30 | |
| 31 | 31 | $tagModel = new TagModel($this->container); |
| 32 | 32 | $postModel = new PostModel($this->container); |
@@ -4,7 +4,7 @@ |
||
| 4 | 4 | |
| 5 | 5 | use Core\Model; |
| 6 | 6 | |
| 7 | -class UserModel extends Model{ |
|
| 7 | +class UserModel extends Model { |
|
| 8 | 8 | |
| 9 | 9 | public function getAuthorDetails(int $authorId) |
| 10 | 10 | { |
@@ -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 | |
@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | * fetches the result from an executed query |
| 102 | 102 | * @return array |
| 103 | 103 | */ |
| 104 | - protected function fetchAll(){ |
|
| 104 | + protected function fetchAll() { |
|
| 105 | 105 | return $this->stmt->fetchAll(); |
| 106 | 106 | } |
| 107 | 107 | |
@@ -109,7 +109,7 @@ discard block |
||
| 109 | 109 | * returns a single line from the executed query |
| 110 | 110 | * @return mixed |
| 111 | 111 | */ |
| 112 | - protected function fetch(){ |
|
| 112 | + protected function fetch() { |
|
| 113 | 113 | return $this->stmt->fetch(); |
| 114 | 114 | } |
| 115 | 115 | |
@@ -136,7 +136,7 @@ discard block |
||
| 136 | 136 | $table = $reflect->getShortName(); //this is to only get the model name, otherwise we get the full namespace |
| 137 | 137 | //since our models all end with Model, we should remove it. |
| 138 | 138 | $table = $this->removeFromEnd($table, 'Model'); |
| 139 | - $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 |
|
| 139 | + $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 |
|
| 140 | 140 | $table = strtolower($table); //the database names are in lowercase |
| 141 | 141 | } |
| 142 | 142 | |
@@ -155,7 +155,7 @@ discard block |
||
| 155 | 155 | } |
| 156 | 156 | |
| 157 | 157 | //if we are here, then table doesn't exist, check for view |
| 158 | - $view = 'v_' . $table; |
|
| 158 | + $view = 'v_'.$table; |
|
| 159 | 159 | $stmt->bindValue(':table', $view, PDO::PARAM_STR); |
| 160 | 160 | $stmt->execute(); |
| 161 | 161 | $exists = $stmt->rowCount() > 0; //will return 1 if table exists or 0 if non existant |
@@ -176,8 +176,8 @@ discard block |
||
| 176 | 176 | * @param $table string the table name |
| 177 | 177 | * @return string |
| 178 | 178 | */ |
| 179 | - protected function getTablePrefix($table){ |
|
| 180 | - if(Config::TABLE_PREFIX != '') |
|
| 179 | + protected function getTablePrefix($table) { |
|
| 180 | + if (Config::TABLE_PREFIX != '') |
|
| 181 | 181 | { |
| 182 | 182 | $table = Config::TABLE_PREFIX.'_'.$table; |
| 183 | 183 | } |
@@ -248,7 +248,7 @@ discard block |
||
| 248 | 248 | protected function getRowById($rowId, $table = null) |
| 249 | 249 | { |
| 250 | 250 | $tableName = $this->getTable($table); |
| 251 | - $idName = 'id' . $tableName; |
|
| 251 | + $idName = 'id'.$tableName; |
|
| 252 | 252 | $sql = "SELECT * FROM $tableName WHERE $idName = :rowId"; |
| 253 | 253 | $this->query($sql); |
| 254 | 254 | $this->bind(':rowId', $rowId); |