@@ -40,8 +40,9 @@ discard block |
||
| 40 | 40 | 'date' => date('Y'))); |
| 41 | 41 | |
| 42 | 42 | Loader::loadInstance('utility', 'Database'); |
| 43 | - if(Database::isConnected() === false) |
|
| 44 | - $this->unavailable(); |
|
| 43 | + if(Database::isConnected() === false) {
|
|
| 44 | + $this->unavailable(); |
|
| 45 | + } |
|
| 45 | 46 | } |
| 46 | 47 | |
| 47 | 48 | protected function get_domain_container() |
@@ -98,8 +99,9 @@ discard block |
||
| 98 | 99 | $post->title = "Blogged about {$category}: <a href=\"{$row['url']}\">{$row['title']}</a>."; |
| 99 | 100 | $post->comments = $row['comments']; |
| 100 | 101 | |
| 101 | - if($format == 'full') |
|
| 102 | - $post->image = Content::instance('FetchFirstPhoto', $row['body'])->activate(false, 'standard'); |
|
| 102 | + if($format == 'full') {
|
|
| 103 | + $post->image = Content::instance('FetchFirstPhoto', $row['body'])->activate(false, 'standard');
|
|
| 104 | + } |
|
| 103 | 105 | break; |
| 104 | 106 | case 'book' : |
| 105 | 107 | $row = $bookRepository->getBookById($raw_post['type_id']); |
@@ -107,8 +109,9 @@ discard block |
||
| 107 | 109 | $post->type = 'book'; |
| 108 | 110 | $post->title = "Just finished reading {$row['title']} by {$row['author']}."; |
| 109 | 111 | |
| 110 | - if($format == 'full') |
|
| 111 | - $post->image = "<img alt=\"{$row['title']} by {$row['author']}\" src=\"{$row['image']}\" />"; |
|
| 112 | + if($format == 'full') {
|
|
| 113 | + $post->image = "<img alt=\"{$row['title']} by {$row['author']}\" src=\"{$row['image']}\" />";
|
|
| 114 | + } |
|
| 112 | 115 | break; |
| 113 | 116 | case 'distance' : |
| 114 | 117 | $row = $distanceRepository->getDistanceById($raw_post['type_id']); |
@@ -117,16 +120,16 @@ discard block |
||
| 117 | 120 | if($row['type'] == 'running') |
| 118 | 121 | { |
| 119 | 122 | $post->title = "Ran {$row['distance']} miles and felt {$row['felt']}."; |
| 120 | - if(strlen($row['message']) > 0) |
|
| 121 | - $post->title .= " Afterwards, I was all like '{$row['message']}'."; |
|
| 122 | - } |
|
| 123 | - else if($row['type'] == 'hiking') |
|
| 123 | + if(strlen($row['message']) > 0) {
|
|
| 124 | + $post->title .= " Afterwards, I was all like '{$row['message']}'.";
|
|
| 125 | + } |
|
| 126 | + } else if($row['type'] == 'hiking') |
|
| 124 | 127 | { |
| 125 | 128 | $post->title = "Hiked {$row['distance']} miles and felt {$row['felt']}."; |
| 126 | - if(strlen($row['title']) > 0) |
|
| 127 | - $post->title .= " I was hiking up around the {$row['title']} area."; |
|
| 128 | - } |
|
| 129 | - else if ($row['type'] == 'walking') { |
|
| 129 | + if(strlen($row['title']) > 0) {
|
|
| 130 | + $post->title .= " I was hiking up around the {$row['title']} area.";
|
|
| 131 | + } |
|
| 132 | + } else if ($row['type'] == 'walking') { |
|
| 130 | 133 | $post->title = "Walked {$row['distance']} miles and felt {$row['felt']}."; |
| 131 | 134 | } |
| 132 | 135 | break; |
@@ -141,10 +144,11 @@ discard block |
||
| 141 | 144 | |
| 142 | 145 | $post->type = 'twitter'; |
| 143 | 146 | |
| 144 | - if($format == 'full') |
|
| 145 | - $post->title = $row['text_formatted_full']; |
|
| 146 | - else |
|
| 147 | - $post->title = $row['text_formatted']; |
|
| 147 | + if($format == 'full') {
|
|
| 148 | + $post->title = $row['text_formatted_full']; |
|
| 149 | + } else {
|
|
| 150 | + $post->title = $row['text_formatted']; |
|
| 151 | + } |
|
| 148 | 152 | |
| 149 | 153 | $post->retweets = ($row['is_retweet'] == 0) ? $row['retweets'] : 0; |
| 150 | 154 | $post->favorites = ($row['is_retweet'] == 0) ? $row['favorites'] : 0; |
@@ -154,13 +158,15 @@ discard block |
||
| 154 | 158 | |
| 155 | 159 | $post->type = 'youtube'; |
| 156 | 160 | |
| 157 | - if($format == 'full') |
|
| 158 | - $post->title = "Favorited {$row['title']} by {$row['author']} on YouTube."; |
|
| 159 | - else |
|
| 160 | - $post->title = "Favorited <a href=\"http://www.youtube.com/watch?feature=player_embedded&v={$row['video_id']}\" rel=\"nofollow\" target=\"_blank\" title=\"{$row['content']}\">{$row['title']}</a> by {$row['author']} on YouTube."; |
|
| 161 | + if($format == 'full') {
|
|
| 162 | + $post->title = "Favorited {$row['title']} by {$row['author']} on YouTube.";
|
|
| 163 | + } else {
|
|
| 164 | + $post->title = "Favorited <a href=\"http://www.youtube.com/watch?feature=player_embedded&v={$row['video_id']}\" rel=\"nofollow\" target=\"_blank\" title=\"{$row['content']}\">{$row['title']}</a> by {$row['author']} on YouTube.";
|
|
| 165 | + } |
|
| 161 | 166 | |
| 162 | - if($format == 'full') |
|
| 163 | - $post->embed_code = "<iframe src=\"http://www.youtube.com/embed/{$row['video_id']}?rel=0\" frameborder=\"0\" allowfullscreen></iframe>"; |
|
| 167 | + if($format == 'full') {
|
|
| 168 | + $post->embed_code = "<iframe src=\"http://www.youtube.com/embed/{$row['video_id']}?rel=0\" frameborder=\"0\" allowfullscreen></iframe>";
|
|
| 169 | + } |
|
| 164 | 170 | break; |
| 165 | 171 | } |
| 166 | 172 | |
@@ -189,10 +195,11 @@ discard block |
||
| 189 | 195 | Loader::load('view', '/Head', $this->data_array['head']); |
| 190 | 196 | foreach($this->body_view_array as $view) |
| 191 | 197 | { |
| 192 | - if(substr($view, 0, 1) == '/') |
|
| 193 | - Loader::load('view', $view, $this->data_array['body']); |
|
| 194 | - else |
|
| 195 | - Loader::load('view', URLDecode::getSite() . '/' . $view, $this->data_array['body']); |
|
| 198 | + if(substr($view, 0, 1) == '/') {
|
|
| 199 | + Loader::load('view', $view, $this->data_array['body']);
|
|
| 200 | + } else {
|
|
| 201 | + Loader::load('view', URLDecode::getSite() . '/' . $view, $this->data_array['body']);
|
|
| 202 | + } |
|
| 196 | 203 | } |
| 197 | 204 | |
| 198 | 205 | if (URLDecode::getSite() == 'waterfalls') { |
@@ -201,8 +208,9 @@ discard block |
||
| 201 | 208 | Loader::load('view', '/Foot', array('tracking_code' => self::$TRACKING_CODE)); |
| 202 | 209 | } |
| 203 | 210 | |
| 204 | - if($view == '/404' || $view == '/503') |
|
| 205 | - exit; |
|
| 211 | + if($view == '/404' || $view == '/503') {
|
|
| 212 | + exit; |
|
| 213 | + } |
|
| 206 | 214 | } |
| 207 | 215 | |
| 208 | 216 | protected function set_header_method($method) |
@@ -262,11 +270,13 @@ discard block |
||
| 262 | 270 | |
| 263 | 271 | $js_array = array(); |
| 264 | 272 | |
| 265 | - if(count($this->js_array) > 0) |
|
| 266 | - $js_array = array_merge($js_array, $this->js_array); |
|
| 273 | + if(count($this->js_array) > 0) {
|
|
| 274 | + $js_array = array_merge($js_array, $this->js_array); |
|
| 275 | + } |
|
| 267 | 276 | |
| 268 | - if(count($js_array) > 0) |
|
| 269 | - $js_array = Asset::getJS($js_array); |
|
| 277 | + if(count($js_array) > 0) {
|
|
| 278 | + $js_array = Asset::getJS($js_array); |
|
| 279 | + } |
|
| 270 | 280 | |
| 271 | 281 | $this->set_head('css_link_array', $css_array); |
| 272 | 282 | $this->set_head('js_link_array', $js_array); |
@@ -279,14 +289,16 @@ discard block |
||
| 279 | 289 | |
| 280 | 290 | protected function eject() |
| 281 | 291 | { |
| 282 | - if(get_class($this) !== 'Error404Controller') |
|
| 283 | - Loader::loadNew('controller', '/Error404Controller')->activate(); |
|
| 292 | + if(get_class($this) !== 'Error404Controller') {
|
|
| 293 | + Loader::loadNew('controller', '/Error404Controller')->activate();
|
|
| 294 | + } |
|
| 284 | 295 | } |
| 285 | 296 | |
| 286 | 297 | protected function unavailable() |
| 287 | 298 | { |
| 288 | - if(get_class($this) !== 'Error503Controller') |
|
| 289 | - Loader::loadNew('controller', '/Error503Controller')->activate(); |
|
| 299 | + if(get_class($this) !== 'Error503Controller') {
|
|
| 300 | + Loader::loadNew('controller', '/Error503Controller')->activate();
|
|
| 301 | + } |
|
| 290 | 302 | } |
| 291 | 303 | |
| 292 | 304 | protected function redirect($uri, $method = 301) |
@@ -294,12 +306,14 @@ discard block |
||
| 294 | 306 | switch($method) |
| 295 | 307 | { |
| 296 | 308 | case 301 : |
| 297 | - if(get_class($this) !== 'Error301Controller') |
|
| 298 | - Loader::loadNew('controller', '/Error301Controller', array($uri))->activate(); |
|
| 309 | + if(get_class($this) !== 'Error301Controller') {
|
|
| 310 | + Loader::loadNew('controller', '/Error301Controller', array($uri))->activate();
|
|
| 311 | + } |
|
| 299 | 312 | break; |
| 300 | 313 | case 303 : |
| 301 | - if(get_class($this) !== 'Error303Controller') |
|
| 302 | - Loader::loadNew('controller', '/Error303Controller', array($uri))->activate(); |
|
| 314 | + if(get_class($this) !== 'Error303Controller') {
|
|
| 315 | + Loader::loadNew('controller', '/Error303Controller', array($uri))->activate();
|
|
| 316 | + } |
|
| 303 | 317 | break; |
| 304 | 318 | } |
| 305 | 319 | } |
@@ -346,18 +360,19 @@ discard block |
||
| 346 | 360 | $comment_object->url = $comment->url; |
| 347 | 361 | $comment_object->trusted = $comment->trusted; |
| 348 | 362 | |
| 349 | - if($comment->reply == 0 && Request::getPost('type') == $comment->id) |
|
| 350 | - $comment_object->errors = $this->comment_errors; |
|
| 351 | - else |
|
| 352 | - $comment_object->errors = array(); |
|
| 363 | + if($comment->reply == 0 && Request::getPost('type') == $comment->id) {
|
|
| 364 | + $comment_object->errors = $this->comment_errors; |
|
| 365 | + } else {
|
|
| 366 | + $comment_object->errors = array(); |
|
| 367 | + } |
|
| 353 | 368 | |
| 354 | 369 | if($comment->reply == 0) |
| 355 | 370 | { |
| 356 | 371 | $comment_object->replies = array(); |
| 357 | 372 | $comment_array[$comment->id] = $comment_object; |
| 358 | - } |
|
| 359 | - else |
|
| 360 | - $comment_array[$comment->reply]->replies[$comment->id] = $comment_object; |
|
| 373 | + } else {
|
|
| 374 | + $comment_array[$comment->reply]->replies[$comment->id] = $comment_object; |
|
| 375 | + } |
|
| 361 | 376 | } |
| 362 | 377 | |
| 363 | 378 | $comment_count = CommentCollector::getCommentCountForURL($site, $path); |
@@ -382,22 +397,26 @@ discard block |
||
| 382 | 397 | $commenter->website = ''; |
| 383 | 398 | |
| 384 | 399 | $commenter_cookie = Cookie::instance('Commenter'); |
| 385 | - if(!$commenter_cookie->exists()) |
|
| 386 | - return $commenter; |
|
| 400 | + if(!$commenter_cookie->exists()) {
|
|
| 401 | + return $commenter; |
|
| 402 | + } |
|
| 387 | 403 | |
| 388 | 404 | $commenter_cookie_value = $commenter_cookie->getValue(); |
| 389 | 405 | $commenter_cookie_value = json_decode($commenter_cookie_value); |
| 390 | 406 | |
| 391 | - if($commenter_cookie_value === NULL) |
|
| 392 | - return $commenter; |
|
| 407 | + if($commenter_cookie_value === NULL) {
|
|
| 408 | + return $commenter; |
|
| 409 | + } |
|
| 393 | 410 | |
| 394 | - if(!isset($commenter_cookie_value->name) || !isset($commenter_cookie_value->email)) |
|
| 395 | - return $commenter; |
|
| 411 | + if(!isset($commenter_cookie_value->name) || !isset($commenter_cookie_value->email)) {
|
|
| 412 | + return $commenter; |
|
| 413 | + } |
|
| 396 | 414 | |
| 397 | 415 | $commenter_object = CommentCollector::getCommenterByFields($commenter_cookie_value->name, $commenter_cookie_value->email, (isset($commenter_cookie_value->website) ? $commenter_cookie_value->website : '')); |
| 398 | 416 | |
| 399 | - if($commenter_object === NULL) |
|
| 400 | - return $commenter; |
|
| 417 | + if($commenter_object === NULL) {
|
|
| 418 | + return $commenter; |
|
| 419 | + } |
|
| 401 | 420 | |
| 402 | 421 | $commenter->id = $commenter_object->id; |
| 403 | 422 | $commenter->name = $commenter_object->name; |
@@ -38,8 +38,9 @@ discard block |
||
| 38 | 38 | protected function get_page_number() |
| 39 | 39 | { |
| 40 | 40 | $page = URLDecode::getPiece(2); |
| 41 | - if(isset($page) && is_numeric($page)) |
|
| 42 | - return $page; |
|
| 41 | + if(isset($page) && is_numeric($page)) {
|
|
| 42 | + return $page; |
|
| 43 | + } |
|
| 43 | 44 | return 1; |
| 44 | 45 | } |
| 45 | 46 | |
@@ -58,25 +59,29 @@ discard block |
||
| 58 | 59 | |
| 59 | 60 | protected function get_list_next_link() |
| 60 | 61 | { |
| 61 | - if($this->page == 1) |
|
| 62 | - return; |
|
| 63 | - if($this->page == 2) |
|
| 64 | - return Loader::getRootUrl('lifestream'); |
|
| 62 | + if($this->page == 1) {
|
|
| 63 | + return; |
|
| 64 | + } |
|
| 65 | + if($this->page == 2) {
|
|
| 66 | + return Loader::getRootUrl('lifestream');
|
|
| 67 | + } |
|
| 65 | 68 | return Loader::getRootUrl('lifestream') . 'page/' . ($this->page - 1) . '/'; |
| 66 | 69 | } |
| 67 | 70 | |
| 68 | 71 | protected function get_list_prev_link() |
| 69 | 72 | { |
| 70 | - if(($this->page * self::$POSTS_PER_PAGE) >= $this->get_total_post_count()) |
|
| 71 | - return; |
|
| 73 | + if(($this->page * self::$POSTS_PER_PAGE) >= $this->get_total_post_count()) {
|
|
| 74 | + return; |
|
| 75 | + } |
|
| 72 | 76 | return Loader::getRootUrl('lifestream') . 'page/' . ($this->page + 1) . '/'; |
| 73 | 77 | } |
| 74 | 78 | |
| 75 | 79 | private $total_post_count; |
| 76 | 80 | protected function get_total_post_count() |
| 77 | 81 | { |
| 78 | - if(!isset($this->total_post_count)) |
|
| 79 | - $this->total_post_count = $this->postRepository->getPostsCount(); |
|
| 82 | + if(!isset($this->total_post_count)) {
|
|
| 83 | + $this->total_post_count = $this->postRepository->getPostsCount(); |
|
| 84 | + } |
|
| 80 | 85 | return $this->total_post_count; |
| 81 | 86 | } |
| 82 | 87 | |
@@ -20,15 +20,18 @@ |
||
| 20 | 20 | parent::__construct(); |
| 21 | 21 | |
| 22 | 22 | $id = URLDecode::getPiece(2); |
| 23 | - if(!$id || !is_numeric($id)) |
|
| 24 | - $this->eject(); |
|
| 23 | + if(!$id || !is_numeric($id)) {
|
|
| 24 | + $this->eject(); |
|
| 25 | + } |
|
| 25 | 26 | |
| 26 | 27 | $post = $this->postRepository->getPostById($id); |
| 27 | - if(!$post) |
|
| 28 | - $this->eject(); |
|
| 28 | + if(!$post) {
|
|
| 29 | + $this->eject(); |
|
| 30 | + } |
|
| 29 | 31 | |
| 30 | - if(URLDecode::getPiece(1) != $post['type']) |
|
| 31 | - $this->eject(); |
|
| 32 | + if(URLDecode::getPiece(1) != $post['type']) {
|
|
| 33 | + $this->eject(); |
|
| 34 | + } |
|
| 32 | 35 | |
| 33 | 36 | $this->post = $post; |
| 34 | 37 | } |
@@ -97,8 +97,9 @@ discard block |
||
| 97 | 97 | protected function get_page_number() |
| 98 | 98 | { |
| 99 | 99 | $page = URLDecode::getPiece(3); |
| 100 | - if(isset($page) && is_numeric($page)) |
|
| 101 | - return $page; |
|
| 100 | + if(isset($page) && is_numeric($page)) {
|
|
| 101 | + return $page; |
|
| 102 | + } |
|
| 102 | 103 | return 1; |
| 103 | 104 | } |
| 104 | 105 | |
@@ -117,25 +118,29 @@ discard block |
||
| 117 | 118 | |
| 118 | 119 | protected function get_list_next_link() |
| 119 | 120 | { |
| 120 | - if($this->page == 1) |
|
| 121 | - return; |
|
| 122 | - if($this->page == 2) |
|
| 123 | - return Loader::getRootUrl('lifestream') . $this->tag . '/'; |
|
| 121 | + if($this->page == 1) {
|
|
| 122 | + return; |
|
| 123 | + } |
|
| 124 | + if($this->page == 2) {
|
|
| 125 | + return Loader::getRootUrl('lifestream') . $this->tag . '/';
|
|
| 126 | + } |
|
| 124 | 127 | return Loader::getRootUrl('lifestream') . $this->tag . '/page/' . ($this->page - 1) . '/'; |
| 125 | 128 | } |
| 126 | 129 | |
| 127 | 130 | protected function get_list_prev_link() |
| 128 | 131 | { |
| 129 | - if(($this->page * self::$POSTS_PER_PAGE) >= $this->get_total_post_count()) |
|
| 130 | - return; |
|
| 132 | + if(($this->page * self::$POSTS_PER_PAGE) >= $this->get_total_post_count()) {
|
|
| 133 | + return; |
|
| 134 | + } |
|
| 131 | 135 | return Loader::getRootUrl('lifestream') . $this->tag . '/page/' . ($this->page + 1) . '/'; |
| 132 | 136 | } |
| 133 | 137 | |
| 134 | 138 | private $total_post_count; |
| 135 | 139 | protected function get_total_post_count() |
| 136 | 140 | { |
| 137 | - if(!isset($this->total_post_count)) |
|
| 138 | - $this->total_post_count = $this->postRepository->getPostsByTypeCount($this->tag); |
|
| 141 | + if(!isset($this->total_post_count)) {
|
|
| 142 | + $this->total_post_count = $this->postRepository->getPostsByTypeCount($this->tag); |
|
| 143 | + } |
|
| 139 | 144 | return $this->total_post_count; |
| 140 | 145 | } |
| 141 | 146 | |