@@ -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,7 +63,7 @@ discard block |
||
| 63 | 63 | $post_result = $activityRepository->getActivities(5); |
| 64 | 64 | |
| 65 | 65 | $post_array = array(); |
| 66 | - foreach($post_result as $row) { |
|
| 66 | + foreach ($post_result as $row) { |
|
| 67 | 67 | array_push($post_array, $this->expand_post($row)); |
| 68 | 68 | } |
| 69 | 69 | |
@@ -99,9 +99,9 @@ discard block |
||
| 99 | 99 | $headers = $this->headers; |
| 100 | 100 | Header::$headers(); |
| 101 | 101 | Loader::load('view', '/Head', $this->data_array['head']); |
| 102 | - foreach($this->body_view_array as $view) |
|
| 102 | + foreach ($this->body_view_array as $view) |
|
| 103 | 103 | { |
| 104 | - if(substr($view, 0, 1) == '/') |
|
| 104 | + if (substr($view, 0, 1) == '/') |
|
| 105 | 105 | Loader::load('view', $view, $this->data_array['body']); |
| 106 | 106 | else |
| 107 | 107 | Loader::load('view', URLDecode::getSite() . '/' . $view, $this->data_array['body']); |
@@ -113,7 +113,7 @@ discard block |
||
| 113 | 113 | Loader::load('view', '/Foot', array('tracking_code' => self::$TRACKING_CODE)); |
| 114 | 114 | } |
| 115 | 115 | |
| 116 | - if($view == '/404' || $view == '/503') |
|
| 116 | + if ($view == '/404' || $view == '/503') |
|
| 117 | 117 | exit; |
| 118 | 118 | } |
| 119 | 119 | |
@@ -169,10 +169,10 @@ discard block |
||
| 169 | 169 | |
| 170 | 170 | private function load_assets() |
| 171 | 171 | { |
| 172 | - $css_array = array_map(function ($stylesheet) { |
|
| 172 | + $css_array = array_map(function($stylesheet) { |
|
| 173 | 173 | return "/css/{$stylesheet}.css"; |
| 174 | 174 | }, $this->css_array); |
| 175 | - $js_array = array_map(function ($script) { |
|
| 175 | + $js_array = array_map(function($script) { |
|
| 176 | 176 | if (substr($script, 0, 4) == 'http') { |
| 177 | 177 | return $script; |
| 178 | 178 | } |
@@ -190,26 +190,26 @@ discard block |
||
| 190 | 190 | |
| 191 | 191 | protected function eject() |
| 192 | 192 | { |
| 193 | - if(get_class($this) !== 'Error404Controller') |
|
| 193 | + if (get_class($this) !== 'Error404Controller') |
|
| 194 | 194 | Loader::loadNew('controller', '/Error404Controller')->activate(); |
| 195 | 195 | } |
| 196 | 196 | |
| 197 | 197 | protected function unavailable() |
| 198 | 198 | { |
| 199 | - if(get_class($this) !== 'Error503Controller') |
|
| 199 | + if (get_class($this) !== 'Error503Controller') |
|
| 200 | 200 | Loader::loadNew('controller', '/Error503Controller')->activate(); |
| 201 | 201 | } |
| 202 | 202 | |
| 203 | 203 | protected function redirect($uri, $method = 301) |
| 204 | 204 | { |
| 205 | - switch($method) |
|
| 205 | + switch ($method) |
|
| 206 | 206 | { |
| 207 | 207 | case 301 : |
| 208 | - if(get_class($this) !== 'Error301Controller') |
|
| 208 | + if (get_class($this) !== 'Error301Controller') |
|
| 209 | 209 | Loader::loadNew('controller', '/Error301Controller', array($uri))->activate(); |
| 210 | 210 | break; |
| 211 | 211 | case 303 : |
| 212 | - if(get_class($this) !== 'Error303Controller') |
|
| 212 | + if (get_class($this) !== 'Error303Controller') |
|
| 213 | 213 | Loader::loadNew('controller', '/Error303Controller', array($uri))->activate(); |
| 214 | 214 | break; |
| 215 | 215 | } |
@@ -229,7 +229,7 @@ discard block |
||
| 229 | 229 | private $comment_errors; |
| 230 | 230 | protected function handle_comment_submit($site_id, $path, $redirect_url, $page_title) |
| 231 | 231 | { |
| 232 | - if(Request::hasPost() && Request::getPost('submit') == 'Submit Comment') |
|
| 232 | + if (Request::hasPost() && Request::getPost('submit') == 'Submit Comment') |
|
| 233 | 233 | { |
| 234 | 234 | $parameters = array($site_id, $path, $redirect_url, $page_title); |
| 235 | 235 | $this->comment_errors = Loader::loadNew('module', 'form/CommentSubmitModule', $parameters)->activate(); |
@@ -247,7 +247,7 @@ discard block |
||
| 247 | 247 | $comment_array = array(); |
| 248 | 248 | $comment_result = CommentCollector::getCommentsForURL($site, $path, $commenter->id); |
| 249 | 249 | |
| 250 | - foreach($comment_result as $comment) |
|
| 250 | + foreach ($comment_result as $comment) |
|
| 251 | 251 | { |
| 252 | 252 | $comment_object = new stdclass(); |
| 253 | 253 | $comment_object->id = $comment->id; |
@@ -257,12 +257,12 @@ discard block |
||
| 257 | 257 | $comment_object->url = $comment->url; |
| 258 | 258 | $comment_object->trusted = $comment->trusted; |
| 259 | 259 | |
| 260 | - if($comment->reply == 0 && Request::getPost('type') == $comment->id) |
|
| 260 | + if ($comment->reply == 0 && Request::getPost('type') == $comment->id) |
|
| 261 | 261 | $comment_object->errors = $this->comment_errors; |
| 262 | 262 | else |
| 263 | 263 | $comment_object->errors = array(); |
| 264 | 264 | |
| 265 | - if($comment->reply == 0) |
|
| 265 | + if ($comment->reply == 0) |
|
| 266 | 266 | { |
| 267 | 267 | $comment_object->replies = array(); |
| 268 | 268 | $comment_array[$comment->id] = $comment_object; |
@@ -293,21 +293,21 @@ discard block |
||
| 293 | 293 | $commenter->website = ''; |
| 294 | 294 | |
| 295 | 295 | $commenter_cookie = Cookie::instance('Commenter'); |
| 296 | - if(!$commenter_cookie->exists()) |
|
| 296 | + if (!$commenter_cookie->exists()) |
|
| 297 | 297 | return $commenter; |
| 298 | 298 | |
| 299 | 299 | $commenter_cookie_value = $commenter_cookie->getValue(); |
| 300 | 300 | $commenter_cookie_value = json_decode($commenter_cookie_value); |
| 301 | 301 | |
| 302 | - if($commenter_cookie_value === NULL) |
|
| 302 | + if ($commenter_cookie_value === NULL) |
|
| 303 | 303 | return $commenter; |
| 304 | 304 | |
| 305 | - if(!isset($commenter_cookie_value->name) || !isset($commenter_cookie_value->email)) |
|
| 305 | + if (!isset($commenter_cookie_value->name) || !isset($commenter_cookie_value->email)) |
|
| 306 | 306 | return $commenter; |
| 307 | 307 | |
| 308 | 308 | $commenter_object = CommentCollector::getCommenterByFields($commenter_cookie_value->name, $commenter_cookie_value->email, (isset($commenter_cookie_value->website) ? $commenter_cookie_value->website : '')); |
| 309 | 309 | |
| 310 | - if($commenter_object === NULL) |
|
| 310 | + if ($commenter_object === NULL) |
|
| 311 | 311 | return $commenter; |
| 312 | 312 | |
| 313 | 313 | $commenter->id = $commenter_object->id; |
@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | * @param string $domain |
| 27 | 27 | * @return boolean |
| 28 | 28 | */ |
| 29 | -$buildSitemap = function (array $entries, $domain, $folder) { |
|
| 29 | +$buildSitemap = function(array $entries, $domain, $folder) { |
|
| 30 | 30 | $urlSet = new Urlset(); |
| 31 | 31 | foreach ($entries as $path => $entry) { |
| 32 | 32 | $url = new Url("{$domain}{$path}"); // todo better detection of domain by env |
@@ -53,13 +53,13 @@ discard block |
||
| 53 | 53 | /********************************************* |
| 54 | 54 | * blog.jacobemerick.com |
| 55 | 55 | *********************************************/ |
| 56 | -$reduceToMostRecentBlogPost = function ($recentPost, $post) { |
|
| 56 | +$reduceToMostRecentBlogPost = function($recentPost, $post) { |
|
| 57 | 57 | if (is_null($recentPost)) { |
| 58 | 58 | return $post; |
| 59 | 59 | } |
| 60 | 60 | $postDate = new DateTime($post['date']); |
| 61 | 61 | $recentPostDate = new DateTime($recentPost['date']); |
| 62 | - return ($postDate > $recentPostDate) ? $post: $recentPost; |
|
| 62 | + return ($postDate > $recentPostDate) ? $post : $recentPost; |
|
| 63 | 63 | }; |
| 64 | 64 | |
| 65 | 65 | $blogPostsPerPage = 10; |
@@ -94,7 +94,7 @@ discard block |
||
| 94 | 94 | ]; |
| 95 | 95 | |
| 96 | 96 | foreach ($blogCategoryArray as $blogCategory) { |
| 97 | - $blogCategoryPosts = array_filter($activeBlogPosts, function ($post) use ($blogCategory) { |
|
| 97 | + $blogCategoryPosts = array_filter($activeBlogPosts, function($post) use ($blogCategory) { |
|
| 98 | 98 | return $post['category'] == $blogCategory; |
| 99 | 99 | }); |
| 100 | 100 | $mostRecentBlogCategoryPost = array_reduce($blogCategoryPosts, $reduceToMostRecentBlogPost); |
@@ -207,13 +207,13 @@ discard block |
||
| 207 | 207 | /********************************************* |
| 208 | 208 | * lifestream.jacobemerick.com |
| 209 | 209 | *********************************************/ |
| 210 | -$reduceToMostRecentStreamActivity = function ($recentActivity, $activity) { |
|
| 210 | +$reduceToMostRecentStreamActivity = function($recentActivity, $activity) { |
|
| 211 | 211 | if (is_null($recentActivity)) { |
| 212 | 212 | return $activity; |
| 213 | 213 | } |
| 214 | 214 | $activityDate = new DateTime($activity['datetime']); |
| 215 | 215 | $recentActivityDate = new DateTime($recentActivity['datetime']); |
| 216 | - return ($activityDate > $recentActivityDate) ? $activity: $recentActivity; |
|
| 216 | + return ($activityDate > $recentActivityDate) ? $activity : $recentActivity; |
|
| 217 | 217 | }; |
| 218 | 218 | |
| 219 | 219 | $streamActivitiesPerPage = 15; |
@@ -251,7 +251,7 @@ discard block |
||
| 251 | 251 | ]; |
| 252 | 252 | |
| 253 | 253 | foreach ($streamTypeArray as $streamType) { |
| 254 | - $streamTypeActivities = array_filter($streamActivities, function ($post) use ($streamType) { |
|
| 254 | + $streamTypeActivities = array_filter($streamActivities, function($post) use ($streamType) { |
|
| 255 | 255 | return $post['type'] == $streamType; |
| 256 | 256 | }); |
| 257 | 257 | $mostRecentStreamTypeActivity = array_reduce($streamTypeActivities, $reduceToMostRecentStreamActivity); |
@@ -385,13 +385,13 @@ discard block |
||
| 385 | 385 | /********************************************* |
| 386 | 386 | * www.waterfallofthekeweenaw.com |
| 387 | 387 | *********************************************/ |
| 388 | -$reduceToMostRecentJournalLog = function ($recentLog, $log) { |
|
| 388 | +$reduceToMostRecentJournalLog = function($recentLog, $log) { |
|
| 389 | 389 | if (is_null($recentLog)) { |
| 390 | 390 | return $log; |
| 391 | 391 | } |
| 392 | 392 | $logDate = new DateTime($log['publish_date']); |
| 393 | 393 | $recentLogDate = new DateTime($recentLog['publish_date']); |
| 394 | - return ($logDate > $recentLogDate) ? log: $recentLog; |
|
| 394 | + return ($logDate > $recentLogDate) ? log : $recentLog; |
|
| 395 | 395 | }; |
| 396 | 396 | |
| 397 | 397 | $waterfallRepository = new WaterfallRepository($container['db_connection_locator']); |