@@ -18,10 +18,10 @@ discard block |
||
| 18 | 18 | |
| 19 | 19 | private static function get_router_name() |
| 20 | 20 | { |
| 21 | - if(Request::isAJAX()) |
|
| 21 | + if (Request::isAJAX()) |
|
| 22 | 22 | return 'AJAXRouter'; |
| 23 | 23 | |
| 24 | - switch(URLDecode::getSite()) |
|
| 24 | + switch (URLDecode::getSite()) |
|
| 25 | 25 | { |
| 26 | 26 | case 'ajax' : |
| 27 | 27 | return 'AjaxRouter'; |
@@ -66,36 +66,36 @@ discard block |
||
| 66 | 66 | |
| 67 | 67 | final protected function check_for_redirect($redirect_uri) |
| 68 | 68 | { |
| 69 | - foreach($this->get_redirect_array() as $check) |
|
| 69 | + foreach ($this->get_redirect_array() as $check) |
|
| 70 | 70 | { |
| 71 | 71 | $redirect_uri = preg_replace($check->pattern, $check->replace, $redirect_uri); |
| 72 | 72 | } |
| 73 | 73 | |
| 74 | 74 | $redirect_uri = $this->check_for_special_redirect($redirect_uri); |
| 75 | 75 | |
| 76 | - if($this->requires_trailing_slash() && substr($redirect_uri, -1) != '/') |
|
| 76 | + if ($this->requires_trailing_slash() && substr($redirect_uri, -1) != '/') |
|
| 77 | 77 | $redirect_uri .= '/'; |
| 78 | 78 | |
| 79 | 79 | if (URLDecode::getHost() == 'waterfalls.jacobemerick.com') { |
| 80 | 80 | $redirect_uri = 'http://' . (!Loader::isLive() ? 'dev' : 'www') . '.waterfallsofthekeweenaw.com' . $redirect_uri; |
| 81 | 81 | } |
| 82 | 82 | |
| 83 | - if($redirect_uri == URLDecode::getURI()) |
|
| 83 | + if ($redirect_uri == URLDecode::getURI()) |
|
| 84 | 84 | return; |
| 85 | 85 | |
| 86 | 86 | $controller_check = $redirect_uri; |
| 87 | - if(substr($redirect_uri, 0, 4) == 'http') |
|
| 87 | + if (substr($redirect_uri, 0, 4) == 'http') |
|
| 88 | 88 | $controller_check = preg_replace('@^http://([a-z\.]+)@', '', $redirect_uri); |
| 89 | 89 | |
| 90 | 90 | $controller = $this->get_controller($controller_check); |
| 91 | - if($controller == '/Error404Controller') |
|
| 91 | + if ($controller == '/Error404Controller') |
|
| 92 | 92 | { |
| 93 | 93 | Loader::loadNew('controller', '/Error404Controller') |
| 94 | 94 | ->activate(); |
| 95 | 95 | exit; |
| 96 | 96 | } |
| 97 | 97 | |
| 98 | - if(substr($redirect_uri, 0, 4) != 'http') |
|
| 98 | + if (substr($redirect_uri, 0, 4) != 'http') |
|
| 99 | 99 | { |
| 100 | 100 | $redirect_uri = substr($redirect_uri, 1); |
| 101 | 101 | $redirect_uri = URLDecode::getBase() . $redirect_uri; |
@@ -112,12 +112,12 @@ discard block |
||
| 112 | 112 | |
| 113 | 113 | final private function get_controller($uri) |
| 114 | 114 | { |
| 115 | - foreach($this->get_direct_array() as $check) |
|
| 115 | + foreach ($this->get_direct_array() as $check) |
|
| 116 | 116 | { |
| 117 | - if($uri == $check->match) |
|
| 117 | + if ($uri == $check->match) |
|
| 118 | 118 | return "{$this->get_primary_folder()}/{$check->controller}"; |
| 119 | 119 | |
| 120 | - if(preg_match("@^{$check->match}$@", $uri)) |
|
| 120 | + if (preg_match("@^{$check->match}$@", $uri)) |
|
| 121 | 121 | return "{$this->get_primary_folder()}/{$check->controller}"; |
| 122 | 122 | } |
| 123 | 123 | |
@@ -126,7 +126,7 @@ discard block |
||
| 126 | 126 | |
| 127 | 127 | final private function get_primary_folder() |
| 128 | 128 | { |
| 129 | - if(Request::isAjax()) |
|
| 129 | + if (Request::isAjax()) |
|
| 130 | 130 | return 'ajax'; |
| 131 | 131 | |
| 132 | 132 | return URLDecode::getSite(); |
@@ -18,8 +18,9 @@ discard block |
||
| 18 | 18 | |
| 19 | 19 | private static function get_router_name() |
| 20 | 20 | { |
| 21 | - if(Request::isAJAX()) |
|
| 22 | - return 'AJAXRouter'; |
|
| 21 | + if(Request::isAJAX()) {
|
|
| 22 | + return 'AJAXRouter'; |
|
| 23 | + } |
|
| 23 | 24 | |
| 24 | 25 | switch(URLDecode::getSite()) |
| 25 | 26 | { |
@@ -73,19 +74,22 @@ discard block |
||
| 73 | 74 | |
| 74 | 75 | $redirect_uri = $this->check_for_special_redirect($redirect_uri); |
| 75 | 76 | |
| 76 | - if($this->requires_trailing_slash() && substr($redirect_uri, -1) != '/') |
|
| 77 | - $redirect_uri .= '/'; |
|
| 77 | + if($this->requires_trailing_slash() && substr($redirect_uri, -1) != '/') {
|
|
| 78 | + $redirect_uri .= '/'; |
|
| 79 | + } |
|
| 78 | 80 | |
| 79 | 81 | if (URLDecode::getHost() == 'waterfalls.jacobemerick.com') { |
| 80 | 82 | $redirect_uri = 'http://' . (!Loader::isLive() ? 'dev' : 'www') . '.waterfallsofthekeweenaw.com' . $redirect_uri; |
| 81 | 83 | } |
| 82 | 84 | |
| 83 | - if($redirect_uri == URLDecode::getURI()) |
|
| 84 | - return; |
|
| 85 | + if($redirect_uri == URLDecode::getURI()) {
|
|
| 86 | + return; |
|
| 87 | + } |
|
| 85 | 88 | |
| 86 | 89 | $controller_check = $redirect_uri; |
| 87 | - if(substr($redirect_uri, 0, 4) == 'http') |
|
| 88 | - $controller_check = preg_replace('@^http://([a-z\.]+)@', '', $redirect_uri); |
|
| 90 | + if(substr($redirect_uri, 0, 4) == 'http') {
|
|
| 91 | + $controller_check = preg_replace('@^http://([a-z\.]+)@', '', $redirect_uri);
|
|
| 92 | + } |
|
| 89 | 93 | |
| 90 | 94 | $controller = $this->get_controller($controller_check); |
| 91 | 95 | if($controller == '/Error404Controller') |
@@ -114,11 +118,13 @@ discard block |
||
| 114 | 118 | { |
| 115 | 119 | foreach($this->get_direct_array() as $check) |
| 116 | 120 | { |
| 117 | - if($uri == $check->match) |
|
| 118 | - return "{$this->get_primary_folder()}/{$check->controller}"; |
|
| 121 | + if($uri == $check->match) {
|
|
| 122 | + return "{$this->get_primary_folder()}/{$check->controller}";
|
|
| 123 | + } |
|
| 119 | 124 | |
| 120 | - if(preg_match("@^{$check->match}$@", $uri)) |
|
| 121 | - return "{$this->get_primary_folder()}/{$check->controller}"; |
|
| 125 | + if(preg_match("@^{$check->match}$@", $uri)) {
|
|
| 126 | + return "{$this->get_primary_folder()}/{$check->controller}";
|
|
| 127 | + } |
|
| 122 | 128 | } |
| 123 | 129 | |
| 124 | 130 | return '/Error404Controller'; |
@@ -126,8 +132,9 @@ discard block |
||
| 126 | 132 | |
| 127 | 133 | final private function get_primary_folder() |
| 128 | 134 | { |
| 129 | - if(Request::isAjax()) |
|
| 130 | - return 'ajax'; |
|
| 135 | + if(Request::isAjax()) {
|
|
| 136 | + return 'ajax'; |
|
| 137 | + } |
|
| 131 | 138 | |
| 132 | 139 | return URLDecode::getSite(); |
| 133 | 140 | } |
@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | * @param string $domain |
| 26 | 26 | * @return boolean |
| 27 | 27 | */ |
| 28 | -$buildSitemap = function (array $entries, $domain, $folder) { |
|
| 28 | +$buildSitemap = function(array $entries, $domain, $folder) { |
|
| 29 | 29 | $urlSet = new Urlset(); |
| 30 | 30 | foreach ($entries as $path => $entry) { |
| 31 | 31 | $url = new Url("{$domain}{$path}"); // todo better detection of domain by env |
@@ -52,13 +52,13 @@ discard block |
||
| 52 | 52 | /********************************************* |
| 53 | 53 | * blog.jacobemerick.com |
| 54 | 54 | *********************************************/ |
| 55 | -$reduceToMostRecentBlogPost = function ($recentPost, $post) { |
|
| 55 | +$reduceToMostRecentBlogPost = function($recentPost, $post) { |
|
| 56 | 56 | if (is_null($recentPost)) { |
| 57 | 57 | return $post; |
| 58 | 58 | } |
| 59 | 59 | $postDate = new DateTime($post['date']); |
| 60 | 60 | $recentPostDate = new DateTime($recentPost['date']); |
| 61 | - return ($postDate > $recentPostDate) ? $post: $recentPost; |
|
| 61 | + return ($postDate > $recentPostDate) ? $post : $recentPost; |
|
| 62 | 62 | }; |
| 63 | 63 | |
| 64 | 64 | $blogPostsPerPage = 10; |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | ]; |
| 94 | 94 | |
| 95 | 95 | foreach ($blogCategoryArray as $blogCategory) { |
| 96 | - $blogCategoryPosts = array_filter($activeBlogPosts, function ($post) use ($blogCategory) { |
|
| 96 | + $blogCategoryPosts = array_filter($activeBlogPosts, function($post) use ($blogCategory) { |
|
| 97 | 97 | return $post['category'] == $blogCategory; |
| 98 | 98 | }); |
| 99 | 99 | $mostRecentBlogCategoryPost = array_reduce($blogCategoryPosts, $reduceToMostRecentBlogPost); |
@@ -206,13 +206,13 @@ discard block |
||
| 206 | 206 | /********************************************* |
| 207 | 207 | * lifestream.jacobemerick.com |
| 208 | 208 | *********************************************/ |
| 209 | -$reduceToMostRecentStreamPost = function ($recentPost, $post) { |
|
| 209 | +$reduceToMostRecentStreamPost = function($recentPost, $post) { |
|
| 210 | 210 | if (is_null($recentPost)) { |
| 211 | 211 | return $post; |
| 212 | 212 | } |
| 213 | 213 | $postDate = new DateTime($post['date']); |
| 214 | 214 | $recentPostDate = new DateTime($recentPost['date']); |
| 215 | - return ($postDate > $recentPostDate) ? $post: $recentPost; |
|
| 215 | + return ($postDate > $recentPostDate) ? $post : $recentPost; |
|
| 216 | 216 | }; |
| 217 | 217 | |
| 218 | 218 | $streamPostsPerPage = 15; |
@@ -249,7 +249,7 @@ discard block |
||
| 249 | 249 | ]; |
| 250 | 250 | |
| 251 | 251 | foreach ($streamTypeArray as $streamType) { |
| 252 | - $streamTypePosts = array_filter($streamPosts, function ($post) use ($streamType) { |
|
| 252 | + $streamTypePosts = array_filter($streamPosts, function($post) use ($streamType) { |
|
| 253 | 253 | return $post['type'] == $streamType; |
| 254 | 254 | }); |
| 255 | 255 | $mostRecentStreamTypePost = array_reduce($streamTypePosts, $reduceToMostRecentStreamPost); |
@@ -379,13 +379,13 @@ discard block |
||
| 379 | 379 | /********************************************* |
| 380 | 380 | * waterfall.jacobemerick.com |
| 381 | 381 | *********************************************/ |
| 382 | -$reduceToMostRecentJournalLog = function ($recentLog, $log) { |
|
| 382 | +$reduceToMostRecentJournalLog = function($recentLog, $log) { |
|
| 383 | 383 | if (is_null($recentLog)) { |
| 384 | 384 | return $log; |
| 385 | 385 | } |
| 386 | 386 | $logDate = new DateTime($log['publish_date']); |
| 387 | 387 | $recentLogDate = new DateTime($recentLog['publish_date']); |
| 388 | - return ($logDate > $recentLogDate) ? log: $recentLog; |
|
| 388 | + return ($logDate > $recentLogDate) ? log : $recentLog; |
|
| 389 | 389 | }; |
| 390 | 390 | |
| 391 | 391 | $waterfallRepository = new WaterfallRepository($container['db_connection_locator']); |
@@ -4,5 +4,5 @@ |
||
| 4 | 4 | |
| 5 | 5 | interface PieceRepositoryInterface |
| 6 | 6 | { |
| 7 | - public function getPieces($limit = null, $offset= 0); |
|
| 7 | + public function getPieces($limit = null, $offset = 0); |
|
| 8 | 8 | } |
@@ -4,5 +4,5 @@ |
||
| 4 | 4 | |
| 5 | 5 | interface LogRepositoryInterface |
| 6 | 6 | { |
| 7 | - public function getActiveLogs($limit = null, $offset= 0); |
|
| 7 | + public function getActiveLogs($limit = null, $offset = 0); |
|
| 8 | 8 | } |
@@ -4,5 +4,5 @@ |
||
| 4 | 4 | |
| 5 | 5 | interface WaterfallRepositoryInterface |
| 6 | 6 | { |
| 7 | - public function getWaterfalls($limit = null, $offset= 0); |
|
| 7 | + public function getWaterfalls($limit = null, $offset = 0); |
|
| 8 | 8 | } |