@@ -38,8 +38,9 @@ discard block |
||
| 38 | 38 | 'date' => date('Y'))); |
| 39 | 39 | |
| 40 | 40 | Loader::loadInstance('utility', 'Database'); |
| 41 | - if(Database::isConnected() === false) |
|
| 42 | - $this->unavailable(); |
|
| 41 | + if(Database::isConnected() === false) {
|
|
| 42 | + $this->unavailable(); |
|
| 43 | + } |
|
| 43 | 44 | } |
| 44 | 45 | |
| 45 | 46 | protected function get_domain_container() |
@@ -101,10 +102,11 @@ discard block |
||
| 101 | 102 | Loader::load('view', '/Head', $this->data_array['head']); |
| 102 | 103 | foreach($this->body_view_array as $view) |
| 103 | 104 | { |
| 104 | - if(substr($view, 0, 1) == '/') |
|
| 105 | - Loader::load('view', $view, $this->data_array['body']); |
|
| 106 | - else |
|
| 107 | - Loader::load('view', URLDecode::getSite() . '/' . $view, $this->data_array['body']); |
|
| 105 | + if(substr($view, 0, 1) == '/') {
|
|
| 106 | + Loader::load('view', $view, $this->data_array['body']);
|
|
| 107 | + } else {
|
|
| 108 | + Loader::load('view', URLDecode::getSite() . '/' . $view, $this->data_array['body']);
|
|
| 109 | + } |
|
| 108 | 110 | } |
| 109 | 111 | |
| 110 | 112 | if (URLDecode::getSite() == 'waterfalls') { |
@@ -113,8 +115,9 @@ discard block |
||
| 113 | 115 | Loader::load('view', '/Foot', array('tracking_code' => self::$TRACKING_CODE)); |
| 114 | 116 | } |
| 115 | 117 | |
| 116 | - if($view == '/404' || $view == '/503') |
|
| 117 | - exit; |
|
| 118 | + if($view == '/404' || $view == '/503') {
|
|
| 119 | + exit; |
|
| 120 | + } |
|
| 118 | 121 | } |
| 119 | 122 | |
| 120 | 123 | protected function set_header_method($method) |
@@ -190,14 +193,16 @@ discard block |
||
| 190 | 193 | |
| 191 | 194 | protected function eject() |
| 192 | 195 | { |
| 193 | - if(get_class($this) !== 'Error404Controller') |
|
| 194 | - Loader::loadNew('controller', '/Error404Controller')->activate(); |
|
| 196 | + if(get_class($this) !== 'Error404Controller') {
|
|
| 197 | + Loader::loadNew('controller', '/Error404Controller')->activate();
|
|
| 198 | + } |
|
| 195 | 199 | } |
| 196 | 200 | |
| 197 | 201 | protected function unavailable() |
| 198 | 202 | { |
| 199 | - if(get_class($this) !== 'Error503Controller') |
|
| 200 | - Loader::loadNew('controller', '/Error503Controller')->activate(); |
|
| 203 | + if(get_class($this) !== 'Error503Controller') {
|
|
| 204 | + Loader::loadNew('controller', '/Error503Controller')->activate();
|
|
| 205 | + } |
|
| 201 | 206 | } |
| 202 | 207 | |
| 203 | 208 | protected function redirect($uri, $method = 301) |
@@ -205,12 +210,14 @@ discard block |
||
| 205 | 210 | switch($method) |
| 206 | 211 | { |
| 207 | 212 | case 301 : |
| 208 | - if(get_class($this) !== 'Error301Controller') |
|
| 209 | - Loader::loadNew('controller', '/Error301Controller', array($uri))->activate(); |
|
| 213 | + if(get_class($this) !== 'Error301Controller') {
|
|
| 214 | + Loader::loadNew('controller', '/Error301Controller', array($uri))->activate();
|
|
| 215 | + } |
|
| 210 | 216 | break; |
| 211 | 217 | case 303 : |
| 212 | - if(get_class($this) !== 'Error303Controller') |
|
| 213 | - Loader::loadNew('controller', '/Error303Controller', array($uri))->activate(); |
|
| 218 | + if(get_class($this) !== 'Error303Controller') {
|
|
| 219 | + Loader::loadNew('controller', '/Error303Controller', array($uri))->activate();
|
|
| 220 | + } |
|
| 214 | 221 | break; |
| 215 | 222 | } |
| 216 | 223 | } |
@@ -257,18 +264,19 @@ discard block |
||
| 257 | 264 | $comment_object->url = $comment->url; |
| 258 | 265 | $comment_object->trusted = $comment->trusted; |
| 259 | 266 | |
| 260 | - if($comment->reply == 0 && Request::getPost('type') == $comment->id) |
|
| 261 | - $comment_object->errors = $this->comment_errors; |
|
| 262 | - else |
|
| 263 | - $comment_object->errors = array(); |
|
| 267 | + if($comment->reply == 0 && Request::getPost('type') == $comment->id) {
|
|
| 268 | + $comment_object->errors = $this->comment_errors; |
|
| 269 | + } else {
|
|
| 270 | + $comment_object->errors = array(); |
|
| 271 | + } |
|
| 264 | 272 | |
| 265 | 273 | if($comment->reply == 0) |
| 266 | 274 | { |
| 267 | 275 | $comment_object->replies = array(); |
| 268 | 276 | $comment_array[$comment->id] = $comment_object; |
| 269 | - } |
|
| 270 | - else |
|
| 271 | - $comment_array[$comment->reply]->replies[$comment->id] = $comment_object; |
|
| 277 | + } else {
|
|
| 278 | + $comment_array[$comment->reply]->replies[$comment->id] = $comment_object; |
|
| 279 | + } |
|
| 272 | 280 | } |
| 273 | 281 | |
| 274 | 282 | $comment_count = CommentCollector::getCommentCountForURL($site, $path); |
@@ -293,22 +301,26 @@ discard block |
||
| 293 | 301 | $commenter->website = ''; |
| 294 | 302 | |
| 295 | 303 | $commenter_cookie = Cookie::instance('Commenter'); |
| 296 | - if(!$commenter_cookie->exists()) |
|
| 297 | - return $commenter; |
|
| 304 | + if(!$commenter_cookie->exists()) {
|
|
| 305 | + return $commenter; |
|
| 306 | + } |
|
| 298 | 307 | |
| 299 | 308 | $commenter_cookie_value = $commenter_cookie->getValue(); |
| 300 | 309 | $commenter_cookie_value = json_decode($commenter_cookie_value); |
| 301 | 310 | |
| 302 | - if($commenter_cookie_value === NULL) |
|
| 303 | - return $commenter; |
|
| 311 | + if($commenter_cookie_value === NULL) {
|
|
| 312 | + return $commenter; |
|
| 313 | + } |
|
| 304 | 314 | |
| 305 | - if(!isset($commenter_cookie_value->name) || !isset($commenter_cookie_value->email)) |
|
| 306 | - return $commenter; |
|
| 315 | + if(!isset($commenter_cookie_value->name) || !isset($commenter_cookie_value->email)) {
|
|
| 316 | + return $commenter; |
|
| 317 | + } |
|
| 307 | 318 | |
| 308 | 319 | $commenter_object = CommentCollector::getCommenterByFields($commenter_cookie_value->name, $commenter_cookie_value->email, (isset($commenter_cookie_value->website) ? $commenter_cookie_value->website : '')); |
| 309 | 320 | |
| 310 | - if($commenter_object === NULL) |
|
| 311 | - return $commenter; |
|
| 321 | + if($commenter_object === NULL) {
|
|
| 322 | + return $commenter; |
|
| 323 | + } |
|
| 312 | 324 | |
| 313 | 325 | $commenter->id = $commenter_object->id; |
| 314 | 326 | $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->activityRepository->getActivitiesCount(); |
|
| 82 | + if(!isset($this->total_post_count)) {
|
|
| 83 | + $this->total_post_count = $this->activityRepository->getActivitiesCount(); |
|
| 84 | + } |
|
| 80 | 85 | return $this->total_post_count; |
| 81 | 86 | } |
| 82 | 87 | |
@@ -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->activityRepository->getActivitiesByTypeCount($this->tag); |
|
| 141 | + if(!isset($this->total_post_count)) {
|
|
| 142 | + $this->total_post_count = $this->activityRepository->getActivitiesByTypeCount($this->tag); |
|
| 143 | + } |
|
| 139 | 144 | return $this->total_post_count; |
| 140 | 145 | } |
| 141 | 146 | |