@@ -20,9 +20,9 @@ discard block |
||
| 20 | 20 | |
| 21 | 21 | public function activate() |
| 22 | 22 | { |
| 23 | - foreach(self::$CRON_ARRAY as $cron => $frequency) |
|
| 23 | + foreach (self::$CRON_ARRAY as $cron => $frequency) |
|
| 24 | 24 | { |
| 25 | - if(!$this->time_to_run($frequency)) |
|
| 25 | + if (!$this->time_to_run($frequency)) |
|
| 26 | 26 | continue; |
| 27 | 27 | |
| 28 | 28 | Loader::load('utility', "cron/{$cron}"); |
@@ -46,19 +46,19 @@ discard block |
||
| 46 | 46 | $operator = explode(' ', $frequency); |
| 47 | 47 | list($time['minute'], $time['hour'], $time['day'], $time['month'], $time['weekday']) = $operator; |
| 48 | 48 | |
| 49 | - foreach($time as $key => $value) |
|
| 49 | + foreach ($time as $key => $value) |
|
| 50 | 50 | { |
| 51 | - if($value == '*') |
|
| 51 | + if ($value == '*') |
|
| 52 | 52 | continue; |
| 53 | - if(stristr($value, '/')) |
|
| 53 | + if (stristr($value, '/')) |
|
| 54 | 54 | { |
| 55 | 55 | $value = substr($value, 2); |
| 56 | - if($cur[$key] % $value == 0) |
|
| 56 | + if ($cur[$key] % $value == 0) |
|
| 57 | 57 | continue; |
| 58 | 58 | else |
| 59 | 59 | return; |
| 60 | 60 | } |
| 61 | - if($cur[$key] == $value) |
|
| 61 | + if ($cur[$key] == $value) |
|
| 62 | 62 | continue; |
| 63 | 63 | return; |
| 64 | 64 | } |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | 'date' => date('Y'))); |
| 39 | 39 | |
| 40 | 40 | Loader::loadInstance('utility', 'Database'); |
| 41 | - if(Database::isConnected() === false) |
|
| 41 | + if (Database::isConnected() === false) |
|
| 42 | 42 | $this->unavailable(); |
| 43 | 43 | } |
| 44 | 44 | |
@@ -63,9 +63,9 @@ discard block |
||
| 63 | 63 | $post_result = $activityRepository->getPosts(5); |
| 64 | 64 | |
| 65 | 65 | $post_array = array(); |
| 66 | - foreach($post_result as $row) |
|
| 66 | + foreach ($post_result as $row) |
|
| 67 | 67 | { |
| 68 | - $post_array[] = $this->expand_post($row);; |
|
| 68 | + $post_array[] = $this->expand_post($row); ; |
|
| 69 | 69 | } |
| 70 | 70 | |
| 71 | 71 | return $post_array; |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | |
| 86 | 86 | $post = new stdclass(); |
| 87 | 87 | |
| 88 | - switch($raw_post['type']) |
|
| 88 | + switch ($raw_post['type']) |
|
| 89 | 89 | { |
| 90 | 90 | case 'blog' : |
| 91 | 91 | $row = $blogRepository->getBlogById($raw_post['type_id']); |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | $post->title = "Blogged about {$category}: <a href=\"{$row['url']}\">{$row['title']}</a>."; |
| 97 | 97 | $post->comments = $row['comments']; |
| 98 | 98 | |
| 99 | - if($format == 'full') |
|
| 99 | + if ($format == 'full') |
|
| 100 | 100 | $post->image = Content::instance('FetchFirstPhoto', $row['body'])->activate(false, 'standard'); |
| 101 | 101 | break; |
| 102 | 102 | case 'book' : |
@@ -105,23 +105,23 @@ discard block |
||
| 105 | 105 | $post->type = 'book'; |
| 106 | 106 | $post->title = "Just finished reading {$row['title']} by {$row['author']}."; |
| 107 | 107 | |
| 108 | - if($format == 'full') |
|
| 108 | + if ($format == 'full') |
|
| 109 | 109 | $post->image = "<img alt=\"{$row['title']} by {$row['author']}\" src=\"{$row['image']}\" />"; |
| 110 | 110 | break; |
| 111 | 111 | case 'distance' : |
| 112 | 112 | $row = $distanceRepository->getDistanceById($raw_post['type_id']); |
| 113 | 113 | |
| 114 | 114 | $post->type = 'distance'; |
| 115 | - if($row['type'] == 'running') |
|
| 115 | + if ($row['type'] == 'running') |
|
| 116 | 116 | { |
| 117 | 117 | $post->title = "Ran {$row['distance']} miles and felt {$row['felt']}."; |
| 118 | - if(strlen($row['message']) > 0) |
|
| 118 | + if (strlen($row['message']) > 0) |
|
| 119 | 119 | $post->title .= " Afterwards, I was all like '{$row['message']}'."; |
| 120 | 120 | } |
| 121 | - else if($row['type'] == 'hiking') |
|
| 121 | + else if ($row['type'] == 'hiking') |
|
| 122 | 122 | { |
| 123 | 123 | $post->title = "Hiked {$row['distance']} miles and felt {$row['felt']}."; |
| 124 | - if(strlen($row['title']) > 0) |
|
| 124 | + if (strlen($row['title']) > 0) |
|
| 125 | 125 | $post->title .= " I was hiking up around the {$row['title']} area."; |
| 126 | 126 | } |
| 127 | 127 | else if ($row['type'] == 'walking') { |
@@ -139,7 +139,7 @@ discard block |
||
| 139 | 139 | |
| 140 | 140 | $post->type = 'twitter'; |
| 141 | 141 | |
| 142 | - if($format == 'full') |
|
| 142 | + if ($format == 'full') |
|
| 143 | 143 | $post->title = $row['text_formatted_full']; |
| 144 | 144 | else |
| 145 | 145 | $post->title = $row['text_formatted']; |
@@ -152,12 +152,12 @@ discard block |
||
| 152 | 152 | |
| 153 | 153 | $post->type = 'youtube'; |
| 154 | 154 | |
| 155 | - if($format == 'full') |
|
| 155 | + if ($format == 'full') |
|
| 156 | 156 | $post->title = "Favorited {$row['title']} by {$row['author']} on YouTube."; |
| 157 | 157 | else |
| 158 | 158 | $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."; |
| 159 | 159 | |
| 160 | - if($format == 'full') |
|
| 160 | + if ($format == 'full') |
|
| 161 | 161 | $post->embed_code = "<iframe src=\"http://www.youtube.com/embed/{$row['video_id']}?rel=0\" frameborder=\"0\" allowfullscreen></iframe>"; |
| 162 | 162 | break; |
| 163 | 163 | } |
@@ -185,9 +185,9 @@ discard block |
||
| 185 | 185 | $headers = $this->headers; |
| 186 | 186 | Header::$headers(); |
| 187 | 187 | Loader::load('view', '/Head', $this->data_array['head']); |
| 188 | - foreach($this->body_view_array as $view) |
|
| 188 | + foreach ($this->body_view_array as $view) |
|
| 189 | 189 | { |
| 190 | - if(substr($view, 0, 1) == '/') |
|
| 190 | + if (substr($view, 0, 1) == '/') |
|
| 191 | 191 | Loader::load('view', $view, $this->data_array['body']); |
| 192 | 192 | else |
| 193 | 193 | Loader::load('view', URLDecode::getSite() . '/' . $view, $this->data_array['body']); |
@@ -199,7 +199,7 @@ discard block |
||
| 199 | 199 | Loader::load('view', '/Foot', array('tracking_code' => self::$TRACKING_CODE)); |
| 200 | 200 | } |
| 201 | 201 | |
| 202 | - if($view == '/404' || $view == '/503') |
|
| 202 | + if ($view == '/404' || $view == '/503') |
|
| 203 | 203 | exit; |
| 204 | 204 | } |
| 205 | 205 | |
@@ -255,10 +255,10 @@ discard block |
||
| 255 | 255 | |
| 256 | 256 | private function load_assets() |
| 257 | 257 | { |
| 258 | - $css_array = array_map(function ($stylesheet) { |
|
| 258 | + $css_array = array_map(function($stylesheet) { |
|
| 259 | 259 | return "/css/{$stylesheet}.css"; |
| 260 | 260 | }, $this->css_array); |
| 261 | - $js_array = array_map(function ($script) { |
|
| 261 | + $js_array = array_map(function($script) { |
|
| 262 | 262 | return "/js/{$script}.js"; |
| 263 | 263 | }, $this->js_array); |
| 264 | 264 | |
@@ -273,26 +273,26 @@ discard block |
||
| 273 | 273 | |
| 274 | 274 | protected function eject() |
| 275 | 275 | { |
| 276 | - if(get_class($this) !== 'Error404Controller') |
|
| 276 | + if (get_class($this) !== 'Error404Controller') |
|
| 277 | 277 | Loader::loadNew('controller', '/Error404Controller')->activate(); |
| 278 | 278 | } |
| 279 | 279 | |
| 280 | 280 | protected function unavailable() |
| 281 | 281 | { |
| 282 | - if(get_class($this) !== 'Error503Controller') |
|
| 282 | + if (get_class($this) !== 'Error503Controller') |
|
| 283 | 283 | Loader::loadNew('controller', '/Error503Controller')->activate(); |
| 284 | 284 | } |
| 285 | 285 | |
| 286 | 286 | protected function redirect($uri, $method = 301) |
| 287 | 287 | { |
| 288 | - switch($method) |
|
| 288 | + switch ($method) |
|
| 289 | 289 | { |
| 290 | 290 | case 301 : |
| 291 | - if(get_class($this) !== 'Error301Controller') |
|
| 291 | + if (get_class($this) !== 'Error301Controller') |
|
| 292 | 292 | Loader::loadNew('controller', '/Error301Controller', array($uri))->activate(); |
| 293 | 293 | break; |
| 294 | 294 | case 303 : |
| 295 | - if(get_class($this) !== 'Error303Controller') |
|
| 295 | + if (get_class($this) !== 'Error303Controller') |
|
| 296 | 296 | Loader::loadNew('controller', '/Error303Controller', array($uri))->activate(); |
| 297 | 297 | break; |
| 298 | 298 | } |
@@ -312,7 +312,7 @@ discard block |
||
| 312 | 312 | private $comment_errors; |
| 313 | 313 | protected function handle_comment_submit($site_id, $path, $redirect_url, $page_title) |
| 314 | 314 | { |
| 315 | - if(Request::hasPost() && Request::getPost('submit') == 'Submit Comment') |
|
| 315 | + if (Request::hasPost() && Request::getPost('submit') == 'Submit Comment') |
|
| 316 | 316 | { |
| 317 | 317 | $parameters = array($site_id, $path, $redirect_url, $page_title); |
| 318 | 318 | $this->comment_errors = Loader::loadNew('module', 'form/CommentSubmitModule', $parameters)->activate(); |
@@ -330,7 +330,7 @@ discard block |
||
| 330 | 330 | $comment_array = array(); |
| 331 | 331 | $comment_result = CommentCollector::getCommentsForURL($site, $path, $commenter->id); |
| 332 | 332 | |
| 333 | - foreach($comment_result as $comment) |
|
| 333 | + foreach ($comment_result as $comment) |
|
| 334 | 334 | { |
| 335 | 335 | $comment_object = new stdclass(); |
| 336 | 336 | $comment_object->id = $comment->id; |
@@ -340,12 +340,12 @@ discard block |
||
| 340 | 340 | $comment_object->url = $comment->url; |
| 341 | 341 | $comment_object->trusted = $comment->trusted; |
| 342 | 342 | |
| 343 | - if($comment->reply == 0 && Request::getPost('type') == $comment->id) |
|
| 343 | + if ($comment->reply == 0 && Request::getPost('type') == $comment->id) |
|
| 344 | 344 | $comment_object->errors = $this->comment_errors; |
| 345 | 345 | else |
| 346 | 346 | $comment_object->errors = array(); |
| 347 | 347 | |
| 348 | - if($comment->reply == 0) |
|
| 348 | + if ($comment->reply == 0) |
|
| 349 | 349 | { |
| 350 | 350 | $comment_object->replies = array(); |
| 351 | 351 | $comment_array[$comment->id] = $comment_object; |
@@ -376,21 +376,21 @@ discard block |
||
| 376 | 376 | $commenter->website = ''; |
| 377 | 377 | |
| 378 | 378 | $commenter_cookie = Cookie::instance('Commenter'); |
| 379 | - if(!$commenter_cookie->exists()) |
|
| 379 | + if (!$commenter_cookie->exists()) |
|
| 380 | 380 | return $commenter; |
| 381 | 381 | |
| 382 | 382 | $commenter_cookie_value = $commenter_cookie->getValue(); |
| 383 | 383 | $commenter_cookie_value = json_decode($commenter_cookie_value); |
| 384 | 384 | |
| 385 | - if($commenter_cookie_value === NULL) |
|
| 385 | + if ($commenter_cookie_value === NULL) |
|
| 386 | 386 | return $commenter; |
| 387 | 387 | |
| 388 | - if(!isset($commenter_cookie_value->name) || !isset($commenter_cookie_value->email)) |
|
| 388 | + if (!isset($commenter_cookie_value->name) || !isset($commenter_cookie_value->email)) |
|
| 389 | 389 | return $commenter; |
| 390 | 390 | |
| 391 | 391 | $commenter_object = CommentCollector::getCommenterByFields($commenter_cookie_value->name, $commenter_cookie_value->email, (isset($commenter_cookie_value->website) ? $commenter_cookie_value->website : '')); |
| 392 | 392 | |
| 393 | - if($commenter_object === NULL) |
|
| 393 | + if ($commenter_object === NULL) |
|
| 394 | 394 | return $commenter; |
| 395 | 395 | |
| 396 | 396 | $commenter->id = $commenter_object->id; |
@@ -19,18 +19,18 @@ discard block |
||
| 19 | 19 | |
| 20 | 20 | private static function get_router_name() |
| 21 | 21 | { |
| 22 | - if(Request::isAJAX()) |
|
| 22 | + if (Request::isAJAX()) |
|
| 23 | 23 | return 'AJAXRouter'; |
| 24 | - if(URLDecode::getURI() == '/sitemap.xml') |
|
| 24 | + if (URLDecode::getURI() == '/sitemap.xml') |
|
| 25 | 25 | return 'SitemapRouter'; |
| 26 | - if(URLDecode::getURI() == '/rss/') |
|
| 26 | + if (URLDecode::getURI() == '/rss/') |
|
| 27 | 27 | return 'RSSRouter'; |
| 28 | - if(URLDecode::getExtension() == 'jpg') |
|
| 28 | + if (URLDecode::getExtension() == 'jpg') |
|
| 29 | 29 | return 'ImageRouter'; |
| 30 | - if(URLDecode::getExtension() == 'png') |
|
| 30 | + if (URLDecode::getExtension() == 'png') |
|
| 31 | 31 | return 'ImageRouter'; |
| 32 | 32 | |
| 33 | - switch(URLDecode::getSite()) |
|
| 33 | + switch (URLDecode::getSite()) |
|
| 34 | 34 | { |
| 35 | 35 | case 'ajax' : |
| 36 | 36 | return 'AjaxRouter'; |
@@ -78,37 +78,37 @@ discard block |
||
| 78 | 78 | |
| 79 | 79 | final protected function check_for_redirect($redirect_uri) |
| 80 | 80 | { |
| 81 | - foreach($this->get_redirect_array() as $check) |
|
| 81 | + foreach ($this->get_redirect_array() as $check) |
|
| 82 | 82 | { |
| 83 | 83 | $redirect_uri = preg_replace($check->pattern, $check->replace, $redirect_uri); |
| 84 | 84 | } |
| 85 | 85 | |
| 86 | 86 | $redirect_uri = $this->check_for_special_redirect($redirect_uri); |
| 87 | 87 | |
| 88 | - if($this->requires_trailing_slash() && substr($redirect_uri, -1) != '/') |
|
| 88 | + if ($this->requires_trailing_slash() && substr($redirect_uri, -1) != '/') |
|
| 89 | 89 | $redirect_uri .= '/'; |
| 90 | 90 | |
| 91 | 91 | if (URLDecode::getHost() == 'waterfalls.jacobemerick.com') { |
| 92 | 92 | $redirect_uri = 'http://' . (!Loader::isLive() ? 'dev' : 'www') . '.waterfallsofthekeweenaw.com' . $redirect_uri; |
| 93 | 93 | } |
| 94 | 94 | |
| 95 | - if($redirect_uri == URLDecode::getURI()) |
|
| 95 | + if ($redirect_uri == URLDecode::getURI()) |
|
| 96 | 96 | return; |
| 97 | 97 | |
| 98 | 98 | $controller_check = $redirect_uri; |
| 99 | - if(substr($redirect_uri, 0, 4) == 'http') |
|
| 99 | + if (substr($redirect_uri, 0, 4) == 'http') |
|
| 100 | 100 | $controller_check = preg_replace('@^http://([a-z\.]+)@', '', $redirect_uri); |
| 101 | 101 | |
| 102 | 102 | $controller = $this->get_controller($controller_check); |
| 103 | - if($controller == '/Error404Controller') |
|
| 103 | + if ($controller == '/Error404Controller') |
|
| 104 | 104 | { |
| 105 | 105 | Loader::loadNew('controller', '/Error404Controller') |
| 106 | 106 | ->activate(); |
| 107 | 107 | exit; |
| 108 | 108 | } |
| 109 | 109 | |
| 110 | - if($this->get_primary_folder() == 'images') { |
|
| 111 | - $file = $controller_check;//URLDecode::getURI(); |
|
| 110 | + if ($this->get_primary_folder() == 'images') { |
|
| 111 | + $file = $controller_check; //URLDecode::getURI(); |
|
| 112 | 112 | |
| 113 | 113 | if ( |
| 114 | 114 | URLDecode::getSite() == 'images' || |
@@ -121,13 +121,13 @@ discard block |
||
| 121 | 121 | } |
| 122 | 122 | |
| 123 | 123 | $image = new ImageOld($file); |
| 124 | - if(!$image->isValid()) { |
|
| 124 | + if (!$image->isValid()) { |
|
| 125 | 125 | Loader::loadNew('controller', '/Error404Controller')->activate(); |
| 126 | 126 | exit(); |
| 127 | 127 | } |
| 128 | 128 | } |
| 129 | 129 | |
| 130 | - if(substr($redirect_uri, 0, 4) != 'http') |
|
| 130 | + if (substr($redirect_uri, 0, 4) != 'http') |
|
| 131 | 131 | { |
| 132 | 132 | $redirect_uri = substr($redirect_uri, 1); |
| 133 | 133 | $redirect_uri = URLDecode::getBase() . $redirect_uri; |
@@ -144,12 +144,12 @@ discard block |
||
| 144 | 144 | |
| 145 | 145 | final private function get_controller($uri) |
| 146 | 146 | { |
| 147 | - foreach($this->get_direct_array() as $check) |
|
| 147 | + foreach ($this->get_direct_array() as $check) |
|
| 148 | 148 | { |
| 149 | - if($uri == $check->match) |
|
| 149 | + if ($uri == $check->match) |
|
| 150 | 150 | return "{$this->get_primary_folder()}/{$check->controller}"; |
| 151 | 151 | |
| 152 | - if(preg_match("@^{$check->match}$@", $uri)) |
|
| 152 | + if (preg_match("@^{$check->match}$@", $uri)) |
|
| 153 | 153 | return "{$this->get_primary_folder()}/{$check->controller}"; |
| 154 | 154 | } |
| 155 | 155 | |
@@ -158,13 +158,13 @@ discard block |
||
| 158 | 158 | |
| 159 | 159 | final private function get_primary_folder() |
| 160 | 160 | { |
| 161 | - if(Request::isAjax()) |
|
| 161 | + if (Request::isAjax()) |
|
| 162 | 162 | return 'ajax'; |
| 163 | - if(URLDecode::getURI() == '/sitemap.xml') |
|
| 163 | + if (URLDecode::getURI() == '/sitemap.xml') |
|
| 164 | 164 | return 'sitemap'; |
| 165 | - if(URLDecode::getURI() == '/rss/') |
|
| 165 | + if (URLDecode::getURI() == '/rss/') |
|
| 166 | 166 | return 'rss'; |
| 167 | - if( |
|
| 167 | + if ( |
|
| 168 | 168 | URLDecode::getExtension() == 'jpg' || |
| 169 | 169 | URLDecode::getExtension() == 'png') |
| 170 | 170 | return 'images'; |