@@ -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 | } |
@@ -26,26 +26,26 @@ discard block |
||
| 26 | 26 | * @return boolean |
| 27 | 27 | */ |
| 28 | 28 | $buildSitemap = function (array $entries, $domain, $folder) { |
| 29 | - $urlSet = new Urlset(); |
|
| 30 | - foreach ($entries as $path => $entry) { |
|
| 31 | - $url = new Url("{$domain}{$path}"); // todo better detection of domain by env |
|
| 32 | - $url->setLastMod($entry['lastmod']); // todo check if exists |
|
| 33 | - $url->setChangeFreq($entry['changefreq']); // todo check if exists |
|
| 34 | - $url->setPriority($entry['priority']); // todo check if exists |
|
| 35 | - $urlSet->addUrl($url); |
|
| 36 | - } |
|
| 37 | - |
|
| 38 | - $output = new Output(); |
|
| 39 | - $output->setIndentString(' '); // change indentation from 4 to 2 spaces |
|
| 40 | - |
|
| 41 | - $tempSitemap = __DIR__ . "/../../public/{$folder}/sitemap-new.xml"; |
|
| 42 | - $finalSitemap = __DIR__ . "/../../public/{$folder}/sitemap.xml"; |
|
| 43 | - |
|
| 44 | - $sitemapHandle = fopen($tempSitemap, 'w'); |
|
| 45 | - fwrite($sitemapHandle, $output->getOutput($urlSet)); |
|
| 46 | - fclose($sitemapHandle); |
|
| 47 | - |
|
| 48 | - rename($tempSitemap, $finalSitemap); |
|
| 29 | + $urlSet = new Urlset(); |
|
| 30 | + foreach ($entries as $path => $entry) { |
|
| 31 | + $url = new Url("{$domain}{$path}"); // todo better detection of domain by env |
|
| 32 | + $url->setLastMod($entry['lastmod']); // todo check if exists |
|
| 33 | + $url->setChangeFreq($entry['changefreq']); // todo check if exists |
|
| 34 | + $url->setPriority($entry['priority']); // todo check if exists |
|
| 35 | + $urlSet->addUrl($url); |
|
| 36 | + } |
|
| 37 | + |
|
| 38 | + $output = new Output(); |
|
| 39 | + $output->setIndentString(' '); // change indentation from 4 to 2 spaces |
|
| 40 | + |
|
| 41 | + $tempSitemap = __DIR__ . "/../../public/{$folder}/sitemap-new.xml"; |
|
| 42 | + $finalSitemap = __DIR__ . "/../../public/{$folder}/sitemap.xml"; |
|
| 43 | + |
|
| 44 | + $sitemapHandle = fopen($tempSitemap, 'w'); |
|
| 45 | + fwrite($sitemapHandle, $output->getOutput($urlSet)); |
|
| 46 | + fclose($sitemapHandle); |
|
| 47 | + |
|
| 48 | + rename($tempSitemap, $finalSitemap); |
|
| 49 | 49 | }; |
| 50 | 50 | |
| 51 | 51 | |
@@ -53,12 +53,12 @@ discard block |
||
| 53 | 53 | * blog.jacobemerick.com |
| 54 | 54 | *********************************************/ |
| 55 | 55 | $reduceToMostRecentBlogPost = function ($recentPost, $post) { |
| 56 | - if (is_null($recentPost)) { |
|
| 57 | - return $post; |
|
| 58 | - } |
|
| 59 | - $postDate = new DateTime($post['date']); |
|
| 60 | - $recentPostDate = new DateTime($recentPost['date']); |
|
| 61 | - return ($postDate > $recentPostDate) ? $post: $recentPost; |
|
| 56 | + if (is_null($recentPost)) { |
|
| 57 | + return $post; |
|
| 58 | + } |
|
| 59 | + $postDate = new DateTime($post['date']); |
|
| 60 | + $recentPostDate = new DateTime($recentPost['date']); |
|
| 61 | + return ($postDate > $recentPostDate) ? $post: $recentPost; |
|
| 62 | 62 | }; |
| 63 | 63 | |
| 64 | 64 | $blogPostsPerPage = 10; |
@@ -69,107 +69,107 @@ discard block |
||
| 69 | 69 | |
| 70 | 70 | // todo these post-level dates should be accurate to H:i:s |
| 71 | 71 | $entryArray = [ |
| 72 | - '/' => [ |
|
| 73 | - 'lastmod' => (new DateTime($mostRecentBlogPost['date']))->format('Y-m-d'), |
|
| 74 | - 'changefreq' => 'daily', |
|
| 75 | - 'priority' => .9, |
|
| 76 | - ] |
|
| 72 | + '/' => [ |
|
| 73 | + 'lastmod' => (new DateTime($mostRecentBlogPost['date']))->format('Y-m-d'), |
|
| 74 | + 'changefreq' => 'daily', |
|
| 75 | + 'priority' => .9, |
|
| 76 | + ] |
|
| 77 | 77 | ]; |
| 78 | 78 | for ($i = 2; (($i - 1) * $blogPostsPerPage) < count($activeBlogPosts); $i++) { |
| 79 | - $entryKey = "/{$i}/"; |
|
| 80 | - $entryArray += [ |
|
| 81 | - $entryKey => [ |
|
| 82 | - 'lastmod' => (new DateTime($mostRecentBlogPost['date']))->format('Y-m-d'), |
|
| 83 | - 'changefreq' => 'daily', |
|
| 84 | - 'priority' => .1, |
|
| 85 | - ] |
|
| 86 | - ]; |
|
| 79 | + $entryKey = "/{$i}/"; |
|
| 80 | + $entryArray += [ |
|
| 81 | + $entryKey => [ |
|
| 82 | + 'lastmod' => (new DateTime($mostRecentBlogPost['date']))->format('Y-m-d'), |
|
| 83 | + 'changefreq' => 'daily', |
|
| 84 | + 'priority' => .1, |
|
| 85 | + ] |
|
| 86 | + ]; |
|
| 87 | 87 | } |
| 88 | 88 | |
| 89 | 89 | $blogCategoryArray = [ |
| 90 | - 'hiking', |
|
| 91 | - 'personal', |
|
| 92 | - 'web-development', |
|
| 90 | + 'hiking', |
|
| 91 | + 'personal', |
|
| 92 | + 'web-development', |
|
| 93 | 93 | ]; |
| 94 | 94 | |
| 95 | 95 | foreach ($blogCategoryArray as $blogCategory) { |
| 96 | - $blogCategoryPosts = array_filter($activeBlogPosts, function ($post) use ($blogCategory) { |
|
| 97 | - return $post['category'] == $blogCategory; |
|
| 98 | - }); |
|
| 99 | - $mostRecentBlogCategoryPost = array_reduce($blogCategoryPosts, $reduceToMostRecentBlogPost); |
|
| 100 | - |
|
| 101 | - $entryKey = "/{$blogCategory}/"; |
|
| 102 | - $entryArray += [ |
|
| 103 | - $entryKey => [ |
|
| 104 | - 'lastmod' => (new DateTime($mostRecentBlogCategoryPost['date']))->format('Y-m-d'), |
|
| 105 | - 'changefreq' => 'daily', |
|
| 106 | - 'priority' => .3, |
|
| 107 | - ] |
|
| 108 | - ]; |
|
| 109 | - |
|
| 110 | - for ($i = 2; (($i - 1) * $blogPostsPerPage) < count($blogCategoryPosts); $i++) { |
|
| 111 | - $entryKey = "/{$blogCategory}/{$i}/"; |
|
| 112 | - $entryArray += [ |
|
| 113 | - $entryKey => [ |
|
| 114 | - 'lastmod' => (new DateTime($mostRecentBlogCategoryPost['date']))->format('Y-m-d'), |
|
| 115 | - 'changefreq' => 'daily', |
|
| 116 | - 'priority' => .1, |
|
| 117 | - ] |
|
| 118 | - ]; |
|
| 119 | - } |
|
| 96 | + $blogCategoryPosts = array_filter($activeBlogPosts, function ($post) use ($blogCategory) { |
|
| 97 | + return $post['category'] == $blogCategory; |
|
| 98 | + }); |
|
| 99 | + $mostRecentBlogCategoryPost = array_reduce($blogCategoryPosts, $reduceToMostRecentBlogPost); |
|
| 100 | + |
|
| 101 | + $entryKey = "/{$blogCategory}/"; |
|
| 102 | + $entryArray += [ |
|
| 103 | + $entryKey => [ |
|
| 104 | + 'lastmod' => (new DateTime($mostRecentBlogCategoryPost['date']))->format('Y-m-d'), |
|
| 105 | + 'changefreq' => 'daily', |
|
| 106 | + 'priority' => .3, |
|
| 107 | + ] |
|
| 108 | + ]; |
|
| 109 | + |
|
| 110 | + for ($i = 2; (($i - 1) * $blogPostsPerPage) < count($blogCategoryPosts); $i++) { |
|
| 111 | + $entryKey = "/{$blogCategory}/{$i}/"; |
|
| 112 | + $entryArray += [ |
|
| 113 | + $entryKey => [ |
|
| 114 | + 'lastmod' => (new DateTime($mostRecentBlogCategoryPost['date']))->format('Y-m-d'), |
|
| 115 | + 'changefreq' => 'daily', |
|
| 116 | + 'priority' => .1, |
|
| 117 | + ] |
|
| 118 | + ]; |
|
| 119 | + } |
|
| 120 | 120 | } |
| 121 | 121 | |
| 122 | 122 | $blogTagRepository = new BlogTagRepository($container['db_connection_locator']); |
| 123 | 123 | $blogTags = $blogTagRepository->getAllTags(); |
| 124 | 124 | foreach ($blogTags as $blogTag) { |
| 125 | - $blogPostsWithTag = $blogPostRepository->getActivePostsByTag($blogTag['id']); |
|
| 126 | - if (count($blogPostsWithTag) < 1) { |
|
| 127 | - continue; |
|
| 128 | - } |
|
| 129 | - |
|
| 130 | - $mostRecentBlogTagPost = array_reduce($blogPostsWithTag, $reduceToMostRecentBlogPost); |
|
| 131 | - |
|
| 132 | - $blogTagPath = str_replace(' ', '-', $blogTag['tag']); |
|
| 133 | - $entryKey = "/tag/{$blogTagPath}/"; |
|
| 134 | - $entryArray += [ |
|
| 135 | - $entryKey => [ |
|
| 136 | - 'lastmod' => (new DateTime($mostRecentBlogTagPost['date']))->format('Y-m-d'), |
|
| 137 | - 'changefreq' => 'daily', |
|
| 138 | - 'priority' => .1, |
|
| 139 | - ] |
|
| 140 | - ]; |
|
| 141 | - |
|
| 142 | - for ($i = 2; (($i - 1) * $blogPostsPerPage) < count($blogPostsWithTag); $i++) { |
|
| 143 | - $blogTagPath = str_replace(' ', '-', $blogTag['tag']); |
|
| 144 | - $entryKey = "/tag/{$blogTagPath}/{$i}/"; |
|
| 145 | - $entryArray += [ |
|
| 146 | - $entryKey => [ |
|
| 147 | - 'lastmod' => (new DateTime($mostRecentBlogTagPost['date']))->format('Y-m-d'), |
|
| 148 | - 'changefreq' => 'daily', |
|
| 149 | - 'priority' => .1, |
|
| 150 | - ] |
|
| 151 | - ]; |
|
| 152 | - } |
|
| 125 | + $blogPostsWithTag = $blogPostRepository->getActivePostsByTag($blogTag['id']); |
|
| 126 | + if (count($blogPostsWithTag) < 1) { |
|
| 127 | + continue; |
|
| 128 | + } |
|
| 129 | + |
|
| 130 | + $mostRecentBlogTagPost = array_reduce($blogPostsWithTag, $reduceToMostRecentBlogPost); |
|
| 131 | + |
|
| 132 | + $blogTagPath = str_replace(' ', '-', $blogTag['tag']); |
|
| 133 | + $entryKey = "/tag/{$blogTagPath}/"; |
|
| 134 | + $entryArray += [ |
|
| 135 | + $entryKey => [ |
|
| 136 | + 'lastmod' => (new DateTime($mostRecentBlogTagPost['date']))->format('Y-m-d'), |
|
| 137 | + 'changefreq' => 'daily', |
|
| 138 | + 'priority' => .1, |
|
| 139 | + ] |
|
| 140 | + ]; |
|
| 141 | + |
|
| 142 | + for ($i = 2; (($i - 1) * $blogPostsPerPage) < count($blogPostsWithTag); $i++) { |
|
| 143 | + $blogTagPath = str_replace(' ', '-', $blogTag['tag']); |
|
| 144 | + $entryKey = "/tag/{$blogTagPath}/{$i}/"; |
|
| 145 | + $entryArray += [ |
|
| 146 | + $entryKey => [ |
|
| 147 | + 'lastmod' => (new DateTime($mostRecentBlogTagPost['date']))->format('Y-m-d'), |
|
| 148 | + 'changefreq' => 'daily', |
|
| 149 | + 'priority' => .1, |
|
| 150 | + ] |
|
| 151 | + ]; |
|
| 152 | + } |
|
| 153 | 153 | } |
| 154 | 154 | |
| 155 | 155 | $reversedBlogPosts = array_reverse($activeBlogPosts); |
| 156 | 156 | foreach ($reversedBlogPosts as $blogPost) { |
| 157 | - $entryKey = "/{$blogPost['category']}/{$blogPost['path']}/"; |
|
| 158 | - $entryArray += [ |
|
| 159 | - $entryKey => [ |
|
| 160 | - 'lastmod' => (new DateTime($blogPost['date']))->format('Y-m-d'), // todo this should be based on comment |
|
| 161 | - 'changefreq' => 'weekly', |
|
| 162 | - 'priority' => .8, |
|
| 163 | - ], |
|
| 164 | - ]; |
|
| 157 | + $entryKey = "/{$blogPost['category']}/{$blogPost['path']}/"; |
|
| 158 | + $entryArray += [ |
|
| 159 | + $entryKey => [ |
|
| 160 | + 'lastmod' => (new DateTime($blogPost['date']))->format('Y-m-d'), // todo this should be based on comment |
|
| 161 | + 'changefreq' => 'weekly', |
|
| 162 | + 'priority' => .8, |
|
| 163 | + ], |
|
| 164 | + ]; |
|
| 165 | 165 | } |
| 166 | 166 | |
| 167 | 167 | $entryArray += [ |
| 168 | - '/about/' => [ |
|
| 169 | - 'lastmod' => (new DateTime('December 20, 2015'))->format('Y-m-d'), |
|
| 170 | - 'changefreq' => 'monthly', |
|
| 171 | - 'priority' => .2, |
|
| 172 | - ] |
|
| 168 | + '/about/' => [ |
|
| 169 | + 'lastmod' => (new DateTime('December 20, 2015'))->format('Y-m-d'), |
|
| 170 | + 'changefreq' => 'monthly', |
|
| 171 | + 'priority' => .2, |
|
| 172 | + ] |
|
| 173 | 173 | ]; |
| 174 | 174 | |
| 175 | 175 | $buildSitemap($entryArray, 'http://blog.jacobemerick.com', 'blog'); |
@@ -183,21 +183,21 @@ discard block |
||
| 183 | 183 | $mostRecentPost = current($mostRecentPost); |
| 184 | 184 | |
| 185 | 185 | $entryArray = [ |
| 186 | - '/' => [ |
|
| 187 | - 'lastmod' => (new DateTime($mostRecentPost['date']))->format('Y-m-d'), |
|
| 188 | - 'changefreq' => 'daily', |
|
| 189 | - 'priority' => 1, |
|
| 190 | - ], |
|
| 191 | - '/about/' => [ |
|
| 192 | - 'lastmod' => (new DateTime('December 20, 2015'))->format('Y-m-d'), |
|
| 193 | - 'changefreq' => 'monthly', |
|
| 194 | - 'priority' => .4, |
|
| 195 | - ], |
|
| 196 | - '/contact/' => [ |
|
| 197 | - 'lastmod' => (new DateTime('December 20, 2015'))->format('Y-m-d'), |
|
| 198 | - 'changefreq' => 'monthly', |
|
| 199 | - 'priority' => .3, |
|
| 200 | - ], |
|
| 186 | + '/' => [ |
|
| 187 | + 'lastmod' => (new DateTime($mostRecentPost['date']))->format('Y-m-d'), |
|
| 188 | + 'changefreq' => 'daily', |
|
| 189 | + 'priority' => 1, |
|
| 190 | + ], |
|
| 191 | + '/about/' => [ |
|
| 192 | + 'lastmod' => (new DateTime('December 20, 2015'))->format('Y-m-d'), |
|
| 193 | + 'changefreq' => 'monthly', |
|
| 194 | + 'priority' => .4, |
|
| 195 | + ], |
|
| 196 | + '/contact/' => [ |
|
| 197 | + 'lastmod' => (new DateTime('December 20, 2015'))->format('Y-m-d'), |
|
| 198 | + 'changefreq' => 'monthly', |
|
| 199 | + 'priority' => .3, |
|
| 200 | + ], |
|
| 201 | 201 | ]; |
| 202 | 202 | |
| 203 | 203 | $buildSitemap($entryArray, 'http://site.jacobemerick.com', 'site'); |
@@ -207,12 +207,12 @@ discard block |
||
| 207 | 207 | * lifestream.jacobemerick.com |
| 208 | 208 | *********************************************/ |
| 209 | 209 | $reduceToMostRecentStreamPost = function ($recentPost, $post) { |
| 210 | - if (is_null($recentPost)) { |
|
| 211 | - return $post; |
|
| 212 | - } |
|
| 213 | - $postDate = new DateTime($post['date']); |
|
| 214 | - $recentPostDate = new DateTime($recentPost['date']); |
|
| 215 | - return ($postDate > $recentPostDate) ? $post: $recentPost; |
|
| 210 | + if (is_null($recentPost)) { |
|
| 211 | + return $post; |
|
| 212 | + } |
|
| 213 | + $postDate = new DateTime($post['date']); |
|
| 214 | + $recentPostDate = new DateTime($recentPost['date']); |
|
| 215 | + return ($postDate > $recentPostDate) ? $post: $recentPost; |
|
| 216 | 216 | }; |
| 217 | 217 | |
| 218 | 218 | $streamPostsPerPage = 15; |
@@ -222,77 +222,77 @@ discard block |
||
| 222 | 222 | $mostRecentStreamPost = array_reduce($streamPosts, $reduceToMostRecentStreamPost); |
| 223 | 223 | |
| 224 | 224 | $entryArray = [ |
| 225 | - '/' => [ |
|
| 226 | - 'lastmod' => (new DateTime($mostRecentStreamPost['date']))->format('c'), |
|
| 227 | - 'changefreq' => 'hourly', |
|
| 228 | - 'priority' => .9, |
|
| 229 | - ] |
|
| 225 | + '/' => [ |
|
| 226 | + 'lastmod' => (new DateTime($mostRecentStreamPost['date']))->format('c'), |
|
| 227 | + 'changefreq' => 'hourly', |
|
| 228 | + 'priority' => .9, |
|
| 229 | + ] |
|
| 230 | 230 | ]; |
| 231 | 231 | for ($i = 2; (($i - 1) * $streamPostsPerPage) < count($streamPosts); $i++) { |
| 232 | - $entryKey = "/page/{$i}/"; |
|
| 233 | - $entryArray += [ |
|
| 234 | - $entryKey => [ |
|
| 235 | - 'lastmod' => (new DateTime($mostRecentStreamPost['date']))->format('c'), |
|
| 236 | - 'changefreq' => 'hourly', |
|
| 237 | - 'priority' => .1, |
|
| 238 | - ] |
|
| 239 | - ]; |
|
| 232 | + $entryKey = "/page/{$i}/"; |
|
| 233 | + $entryArray += [ |
|
| 234 | + $entryKey => [ |
|
| 235 | + 'lastmod' => (new DateTime($mostRecentStreamPost['date']))->format('c'), |
|
| 236 | + 'changefreq' => 'hourly', |
|
| 237 | + 'priority' => .1, |
|
| 238 | + ] |
|
| 239 | + ]; |
|
| 240 | 240 | } |
| 241 | 241 | |
| 242 | 242 | $streamTypeArray = [ |
| 243 | - 'blog', |
|
| 244 | - 'books', |
|
| 245 | - 'distance', |
|
| 246 | - 'hulu', |
|
| 247 | - 'twitter', |
|
| 248 | - 'youtube', |
|
| 243 | + 'blog', |
|
| 244 | + 'books', |
|
| 245 | + 'distance', |
|
| 246 | + 'hulu', |
|
| 247 | + 'twitter', |
|
| 248 | + 'youtube', |
|
| 249 | 249 | ]; |
| 250 | 250 | |
| 251 | 251 | foreach ($streamTypeArray as $streamType) { |
| 252 | - $streamTypePosts = array_filter($streamPosts, function ($post) use ($streamType) { |
|
| 253 | - return $post['type'] == $streamType; |
|
| 254 | - }); |
|
| 255 | - $mostRecentStreamTypePost = array_reduce($streamTypePosts, $reduceToMostRecentStreamPost); |
|
| 256 | - |
|
| 257 | - $entryKey = "/{$streamType}/"; |
|
| 258 | - $entryArray += [ |
|
| 259 | - $entryKey => [ |
|
| 260 | - 'lastmod' => (new DateTime($mostRecentStreamTypePost['date']))->format('c'), |
|
| 261 | - 'changefreq' => 'hourly', |
|
| 262 | - 'priority' => .3, |
|
| 263 | - ] |
|
| 264 | - ]; |
|
| 265 | - |
|
| 266 | - for ($i = 2; (($i - 1) * $streamPostsPerPage) < count($streamTypePosts); $i++) { |
|
| 267 | - $entryKey = "/{$streamType}/page/{$i}/"; |
|
| 268 | - $entryArray += [ |
|
| 269 | - $entryKey => [ |
|
| 270 | - 'lastmod' => (new DateTime($mostRecentStreamTypePost['date']))->format('c'), |
|
| 271 | - 'changefreq' => 'hourly', |
|
| 272 | - 'priority' => .1, |
|
| 273 | - ] |
|
| 274 | - ]; |
|
| 275 | - } |
|
| 252 | + $streamTypePosts = array_filter($streamPosts, function ($post) use ($streamType) { |
|
| 253 | + return $post['type'] == $streamType; |
|
| 254 | + }); |
|
| 255 | + $mostRecentStreamTypePost = array_reduce($streamTypePosts, $reduceToMostRecentStreamPost); |
|
| 256 | + |
|
| 257 | + $entryKey = "/{$streamType}/"; |
|
| 258 | + $entryArray += [ |
|
| 259 | + $entryKey => [ |
|
| 260 | + 'lastmod' => (new DateTime($mostRecentStreamTypePost['date']))->format('c'), |
|
| 261 | + 'changefreq' => 'hourly', |
|
| 262 | + 'priority' => .3, |
|
| 263 | + ] |
|
| 264 | + ]; |
|
| 265 | + |
|
| 266 | + for ($i = 2; (($i - 1) * $streamPostsPerPage) < count($streamTypePosts); $i++) { |
|
| 267 | + $entryKey = "/{$streamType}/page/{$i}/"; |
|
| 268 | + $entryArray += [ |
|
| 269 | + $entryKey => [ |
|
| 270 | + 'lastmod' => (new DateTime($mostRecentStreamTypePost['date']))->format('c'), |
|
| 271 | + 'changefreq' => 'hourly', |
|
| 272 | + 'priority' => .1, |
|
| 273 | + ] |
|
| 274 | + ]; |
|
| 275 | + } |
|
| 276 | 276 | } |
| 277 | 277 | |
| 278 | 278 | $reversedStreamPosts = array_reverse($streamPosts); |
| 279 | 279 | foreach ($reversedStreamPosts as $streamPost) { |
| 280 | - $entryKey = "/{$streamPost['type']}/{$streamPost['id']}/"; |
|
| 281 | - $entryArray += [ |
|
| 282 | - $entryKey => [ |
|
| 283 | - 'lastmod' => (new DateTime($streamPost['date']))->format('c'), |
|
| 284 | - 'changefreq' => 'never', |
|
| 285 | - 'priority' => .5, |
|
| 286 | - ], |
|
| 287 | - ]; |
|
| 280 | + $entryKey = "/{$streamPost['type']}/{$streamPost['id']}/"; |
|
| 281 | + $entryArray += [ |
|
| 282 | + $entryKey => [ |
|
| 283 | + 'lastmod' => (new DateTime($streamPost['date']))->format('c'), |
|
| 284 | + 'changefreq' => 'never', |
|
| 285 | + 'priority' => .5, |
|
| 286 | + ], |
|
| 287 | + ]; |
|
| 288 | 288 | } |
| 289 | 289 | |
| 290 | 290 | $entryArray += [ |
| 291 | - '/about/' => [ |
|
| 292 | - 'lastmod' => (new DateTime('December 20, 2015'))->format('Y-m-d'), |
|
| 293 | - 'changefreq' => 'monthly', |
|
| 294 | - 'priority' => .7, |
|
| 295 | - ] |
|
| 291 | + '/about/' => [ |
|
| 292 | + 'lastmod' => (new DateTime('December 20, 2015'))->format('Y-m-d'), |
|
| 293 | + 'changefreq' => 'monthly', |
|
| 294 | + 'priority' => .7, |
|
| 295 | + ] |
|
| 296 | 296 | ]; |
| 297 | 297 | |
| 298 | 298 | $buildSitemap($entryArray, 'http://lifestream.jacobemerick.com', 'lifestream'); |
@@ -305,43 +305,43 @@ discard block |
||
| 305 | 305 | $portfolioPieces = $portfolioRepository->getPieces(); |
| 306 | 306 | |
| 307 | 307 | $entryArray = [ |
| 308 | - '/' => [ |
|
| 309 | - 'lastmod' => (new DateTime('December 20, 2015'))->format('Y-m-d'), |
|
| 310 | - 'changefreq' => 'weekly', |
|
| 311 | - 'priority' => 1, |
|
| 312 | - ], |
|
| 313 | - '/print/' => [ |
|
| 314 | - 'lastmod' => (new DateTime('December 20, 2015'))->format('Y-m-d'), |
|
| 315 | - 'changefreq' => 'never', |
|
| 316 | - 'priority' => .1, |
|
| 317 | - ], |
|
| 318 | - '/web/' => [ |
|
| 319 | - 'lastmod' => (new DateTime('December 20, 2015'))->format('Y-m-d'), |
|
| 320 | - 'changefreq' => 'never', |
|
| 321 | - 'priority' => .1, |
|
| 322 | - ], |
|
| 323 | - '/contact/' => [ |
|
| 324 | - 'lastmod' => (new DateTime('December 20, 2015'))->format('Y-m-d'), |
|
| 325 | - 'changefreq' => 'never', |
|
| 326 | - 'priority' => .4, |
|
| 327 | - ], |
|
| 328 | - '/resume/' => [ |
|
| 329 | - 'lastmod' => (new DateTime('December 20, 2015'))->format('Y-m-d'), |
|
| 330 | - 'changefreq' => 'yearly', |
|
| 331 | - 'priority' => .9, |
|
| 332 | - ], |
|
| 308 | + '/' => [ |
|
| 309 | + 'lastmod' => (new DateTime('December 20, 2015'))->format('Y-m-d'), |
|
| 310 | + 'changefreq' => 'weekly', |
|
| 311 | + 'priority' => 1, |
|
| 312 | + ], |
|
| 313 | + '/print/' => [ |
|
| 314 | + 'lastmod' => (new DateTime('December 20, 2015'))->format('Y-m-d'), |
|
| 315 | + 'changefreq' => 'never', |
|
| 316 | + 'priority' => .1, |
|
| 317 | + ], |
|
| 318 | + '/web/' => [ |
|
| 319 | + 'lastmod' => (new DateTime('December 20, 2015'))->format('Y-m-d'), |
|
| 320 | + 'changefreq' => 'never', |
|
| 321 | + 'priority' => .1, |
|
| 322 | + ], |
|
| 323 | + '/contact/' => [ |
|
| 324 | + 'lastmod' => (new DateTime('December 20, 2015'))->format('Y-m-d'), |
|
| 325 | + 'changefreq' => 'never', |
|
| 326 | + 'priority' => .4, |
|
| 327 | + ], |
|
| 328 | + '/resume/' => [ |
|
| 329 | + 'lastmod' => (new DateTime('December 20, 2015'))->format('Y-m-d'), |
|
| 330 | + 'changefreq' => 'yearly', |
|
| 331 | + 'priority' => .9, |
|
| 332 | + ], |
|
| 333 | 333 | ]; |
| 334 | 334 | |
| 335 | 335 | foreach ($portfolioPieces as $portfolioPiece) { |
| 336 | - $portfolioCategory = ($portfolioPiece['category'] == 1) ? 'web' : 'print'; |
|
| 337 | - $entryKey = "/{$portfolioCategory}/{$portfolioPiece['title_url']}/"; |
|
| 338 | - $entryArray += [ |
|
| 339 | - $entryKey => [ |
|
| 340 | - 'lastmod' => (new DateTime('December 20, 2015'))->format('Y-m-d'), |
|
| 341 | - 'changefreq' => 'never', |
|
| 342 | - 'priority' => .7, |
|
| 343 | - ], |
|
| 344 | - ]; |
|
| 336 | + $portfolioCategory = ($portfolioPiece['category'] == 1) ? 'web' : 'print'; |
|
| 337 | + $entryKey = "/{$portfolioCategory}/{$portfolioPiece['title_url']}/"; |
|
| 338 | + $entryArray += [ |
|
| 339 | + $entryKey => [ |
|
| 340 | + 'lastmod' => (new DateTime('December 20, 2015'))->format('Y-m-d'), |
|
| 341 | + 'changefreq' => 'never', |
|
| 342 | + 'priority' => .7, |
|
| 343 | + ], |
|
| 344 | + ]; |
|
| 345 | 345 | } |
| 346 | 346 | |
| 347 | 347 | $buildSitemap($entryArray, 'http://portfolio.jacobemerick.com', 'portfolio'); |
@@ -351,26 +351,26 @@ discard block |
||
| 351 | 351 | * site.jacobemerick.com |
| 352 | 352 | *********************************************/ |
| 353 | 353 | $entryArray = [ |
| 354 | - '/' => [ |
|
| 355 | - 'lastmod' => (new DateTime('December 20, 2015'))->format('Y-m-d'), |
|
| 356 | - 'changefreq' => 'weekly', |
|
| 357 | - 'priority' => 1, |
|
| 358 | - ], |
|
| 359 | - '/terms/' => [ |
|
| 360 | - 'lastmod' => (new DateTime('December 20, 2015'))->format('Y-m-d'), |
|
| 361 | - 'changefreq' => 'weekly', |
|
| 362 | - 'priority' => .3, |
|
| 363 | - ], |
|
| 364 | - '/change-log/' => [ |
|
| 365 | - 'lastmod' => (new DateTime('now'))->format('Y-m-d'), // todo lookup based on changelog |
|
| 366 | - 'changefreq' => 'daily', |
|
| 367 | - 'priority' => .1, |
|
| 368 | - ], |
|
| 369 | - '/contact/' => [ |
|
| 370 | - 'lastmod' => (new DateTime('December 20, 2015'))->format('Y-m-d'), |
|
| 371 | - 'changefreq' => 'weekly', |
|
| 372 | - 'priority' => .6, |
|
| 373 | - ], |
|
| 354 | + '/' => [ |
|
| 355 | + 'lastmod' => (new DateTime('December 20, 2015'))->format('Y-m-d'), |
|
| 356 | + 'changefreq' => 'weekly', |
|
| 357 | + 'priority' => 1, |
|
| 358 | + ], |
|
| 359 | + '/terms/' => [ |
|
| 360 | + 'lastmod' => (new DateTime('December 20, 2015'))->format('Y-m-d'), |
|
| 361 | + 'changefreq' => 'weekly', |
|
| 362 | + 'priority' => .3, |
|
| 363 | + ], |
|
| 364 | + '/change-log/' => [ |
|
| 365 | + 'lastmod' => (new DateTime('now'))->format('Y-m-d'), // todo lookup based on changelog |
|
| 366 | + 'changefreq' => 'daily', |
|
| 367 | + 'priority' => .1, |
|
| 368 | + ], |
|
| 369 | + '/contact/' => [ |
|
| 370 | + 'lastmod' => (new DateTime('December 20, 2015'))->format('Y-m-d'), |
|
| 371 | + 'changefreq' => 'weekly', |
|
| 372 | + 'priority' => .6, |
|
| 373 | + ], |
|
| 374 | 374 | ]; |
| 375 | 375 | |
| 376 | 376 | $buildSitemap($entryArray, 'http://site.jacobemerick.com', 'site'); |
@@ -380,108 +380,108 @@ discard block |
||
| 380 | 380 | * waterfall.jacobemerick.com |
| 381 | 381 | *********************************************/ |
| 382 | 382 | $reduceToMostRecentJournalLog = function ($recentLog, $log) { |
| 383 | - if (is_null($recentLog)) { |
|
| 384 | - return $log; |
|
| 385 | - } |
|
| 386 | - $logDate = new DateTime($log['publish_date']); |
|
| 387 | - $recentLogDate = new DateTime($recentLog['publish_date']); |
|
| 388 | - return ($logDate > $recentLogDate) ? log: $recentLog; |
|
| 383 | + if (is_null($recentLog)) { |
|
| 384 | + return $log; |
|
| 385 | + } |
|
| 386 | + $logDate = new DateTime($log['publish_date']); |
|
| 387 | + $recentLogDate = new DateTime($recentLog['publish_date']); |
|
| 388 | + return ($logDate > $recentLogDate) ? log: $recentLog; |
|
| 389 | 389 | }; |
| 390 | 390 | |
| 391 | 391 | $waterfallRepository = new WaterfallRepository($container['db_connection_locator']); |
| 392 | 392 | $waterfallList = $waterfallRepository->getWaterfalls(); |
| 393 | 393 | |
| 394 | 394 | $entryArray = [ |
| 395 | - '/' => [ |
|
| 396 | - 'lastmod' => (new DateTime('December 20, 2015'))->format('Y-m-d'), |
|
| 397 | - 'changefreq' => 'daily', |
|
| 398 | - 'priority' => 1, |
|
| 399 | - ], |
|
| 400 | - '/falls/' => [ |
|
| 401 | - 'lastmod' => (new DateTime('December 20, 2015'))->format('Y-m-d'), |
|
| 402 | - 'changefreq' => 'weekly', |
|
| 403 | - 'priority' => .3, |
|
| 404 | - ], |
|
| 395 | + '/' => [ |
|
| 396 | + 'lastmod' => (new DateTime('December 20, 2015'))->format('Y-m-d'), |
|
| 397 | + 'changefreq' => 'daily', |
|
| 398 | + 'priority' => 1, |
|
| 399 | + ], |
|
| 400 | + '/falls/' => [ |
|
| 401 | + 'lastmod' => (new DateTime('December 20, 2015'))->format('Y-m-d'), |
|
| 402 | + 'changefreq' => 'weekly', |
|
| 403 | + 'priority' => .3, |
|
| 404 | + ], |
|
| 405 | 405 | ]; |
| 406 | 406 | |
| 407 | 407 | for ($i = 2; (($i - 1) * 24) < count($waterfallList); $i++) { |
| 408 | - $entryKey = "/falls/{$i}/"; |
|
| 409 | - $entryArray += [ |
|
| 410 | - $entryKey => [ |
|
| 411 | - 'lastmod' => (new DateTime('December 20, 2015'))->format('Y-m-d'), |
|
| 412 | - 'changefreq' => 'weekly', |
|
| 413 | - 'priority' => .1, |
|
| 414 | - ] |
|
| 415 | - ]; |
|
| 408 | + $entryKey = "/falls/{$i}/"; |
|
| 409 | + $entryArray += [ |
|
| 410 | + $entryKey => [ |
|
| 411 | + 'lastmod' => (new DateTime('December 20, 2015'))->format('Y-m-d'), |
|
| 412 | + 'changefreq' => 'weekly', |
|
| 413 | + 'priority' => .1, |
|
| 414 | + ] |
|
| 415 | + ]; |
|
| 416 | 416 | } |
| 417 | 417 | |
| 418 | 418 | $waterfallCountyRepository = new WaterfallCountyRepository($container['db_connection_locator']); |
| 419 | 419 | $waterfallCountyList = $waterfallCountyRepository->getCountyList(); |
| 420 | 420 | |
| 421 | 421 | foreach ($waterfallCountyList as $waterfallCounty) { |
| 422 | - $entryKey = "/{$waterfallCounty['alias']}/"; |
|
| 423 | - $entryArray += [ |
|
| 424 | - $entryKey => [ |
|
| 425 | - 'lastmod' => (new DateTime('December 20, 2015'))->format('Y-m-d'), |
|
| 426 | - 'changefreq' => 'monthly', |
|
| 427 | - 'priority' => .6 |
|
| 428 | - ] |
|
| 429 | - ]; |
|
| 430 | - |
|
| 431 | - for ($i = 2; (($i - 1) * 12) < $waterfallCounty['count']; $i++) { |
|
| 432 | - $entryKey = "/{$waterfallCounty['alias']}/{$i}/"; |
|
| 433 | - $entryArray += [ |
|
| 434 | - $entryKey => [ |
|
| 435 | - 'lastmod' => (new DateTime('December 20, 2015'))->format('Y-m-d'), |
|
| 436 | - 'changefreq' => 'monthly', |
|
| 437 | - 'priority' => .1 |
|
| 438 | - ] |
|
| 439 | - ]; |
|
| 440 | - } |
|
| 422 | + $entryKey = "/{$waterfallCounty['alias']}/"; |
|
| 423 | + $entryArray += [ |
|
| 424 | + $entryKey => [ |
|
| 425 | + 'lastmod' => (new DateTime('December 20, 2015'))->format('Y-m-d'), |
|
| 426 | + 'changefreq' => 'monthly', |
|
| 427 | + 'priority' => .6 |
|
| 428 | + ] |
|
| 429 | + ]; |
|
| 430 | + |
|
| 431 | + for ($i = 2; (($i - 1) * 12) < $waterfallCounty['count']; $i++) { |
|
| 432 | + $entryKey = "/{$waterfallCounty['alias']}/{$i}/"; |
|
| 433 | + $entryArray += [ |
|
| 434 | + $entryKey => [ |
|
| 435 | + 'lastmod' => (new DateTime('December 20, 2015'))->format('Y-m-d'), |
|
| 436 | + 'changefreq' => 'monthly', |
|
| 437 | + 'priority' => .1 |
|
| 438 | + ] |
|
| 439 | + ]; |
|
| 440 | + } |
|
| 441 | 441 | } |
| 442 | 442 | |
| 443 | 443 | $waterfallWatercourseRepository = new WaterfallWatercourseRepository($container['db_connection_locator']); |
| 444 | 444 | $waterfallWatercourseList = $waterfallWatercourseRepository->getWatercourseList(); |
| 445 | 445 | |
| 446 | 446 | foreach ($waterfallWatercourseList as $waterfallWatercourse) { |
| 447 | - $entryKey = "/{$waterfallWatercourse['alias']}/"; |
|
| 448 | - $entryArray += [ |
|
| 449 | - $entryKey => [ |
|
| 450 | - 'lastmod' => (new DateTime('December 20, 2015'))->format('Y-m-d'), |
|
| 451 | - 'changefreq' => 'monthly', |
|
| 452 | - 'priority' => .6 |
|
| 453 | - ] |
|
| 454 | - ]; |
|
| 455 | - |
|
| 456 | - for ($i = 2; (($i - 1) * 12) < $waterfallWatercourse['count']; $i++) { |
|
| 457 | - $entryKey = "/{$waterfallWatercourse['alias']}/{$i}/"; |
|
| 458 | - $entryArray += [ |
|
| 459 | - $entryKey => [ |
|
| 460 | - 'lastmod' => (new DateTime('December 20, 2015'))->format('Y-m-d'), |
|
| 461 | - 'changefreq' => 'monthly', |
|
| 462 | - 'priority' => .1 |
|
| 463 | - ] |
|
| 464 | - ]; |
|
| 465 | - } |
|
| 447 | + $entryKey = "/{$waterfallWatercourse['alias']}/"; |
|
| 448 | + $entryArray += [ |
|
| 449 | + $entryKey => [ |
|
| 450 | + 'lastmod' => (new DateTime('December 20, 2015'))->format('Y-m-d'), |
|
| 451 | + 'changefreq' => 'monthly', |
|
| 452 | + 'priority' => .6 |
|
| 453 | + ] |
|
| 454 | + ]; |
|
| 455 | + |
|
| 456 | + for ($i = 2; (($i - 1) * 12) < $waterfallWatercourse['count']; $i++) { |
|
| 457 | + $entryKey = "/{$waterfallWatercourse['alias']}/{$i}/"; |
|
| 458 | + $entryArray += [ |
|
| 459 | + $entryKey => [ |
|
| 460 | + 'lastmod' => (new DateTime('December 20, 2015'))->format('Y-m-d'), |
|
| 461 | + 'changefreq' => 'monthly', |
|
| 462 | + 'priority' => .1 |
|
| 463 | + ] |
|
| 464 | + ]; |
|
| 465 | + } |
|
| 466 | 466 | } |
| 467 | 467 | |
| 468 | 468 | foreach ($waterfallList as $waterfall) { |
| 469 | - $entryKey = "/{$waterfall['watercourse_alias']}/{$waterfall['alias']}/"; |
|
| 470 | - $entryArray += [ |
|
| 471 | - $entryKey => [ |
|
| 472 | - 'lastmod' => (new DateTime('December 20, 2015'))->format('Y-m-d'), |
|
| 473 | - 'changefreq' => 'weekly', |
|
| 474 | - 'priority' => .8, |
|
| 475 | - ], |
|
| 476 | - ]; |
|
| 469 | + $entryKey = "/{$waterfall['watercourse_alias']}/{$waterfall['alias']}/"; |
|
| 470 | + $entryArray += [ |
|
| 471 | + $entryKey => [ |
|
| 472 | + 'lastmod' => (new DateTime('December 20, 2015'))->format('Y-m-d'), |
|
| 473 | + 'changefreq' => 'weekly', |
|
| 474 | + 'priority' => .8, |
|
| 475 | + ], |
|
| 476 | + ]; |
|
| 477 | 477 | } |
| 478 | 478 | |
| 479 | 479 | $entryArray += [ |
| 480 | - '/map/' => [ |
|
| 481 | - 'lastmod' => (new DateTime('December 20, 2015'))->format('Y-m-d'), |
|
| 482 | - 'changefreq' => 'monthly', |
|
| 483 | - 'priority' => .6, |
|
| 484 | - ] |
|
| 480 | + '/map/' => [ |
|
| 481 | + 'lastmod' => (new DateTime('December 20, 2015'))->format('Y-m-d'), |
|
| 482 | + 'changefreq' => 'monthly', |
|
| 483 | + 'priority' => .6, |
|
| 484 | + ] |
|
| 485 | 485 | ]; |
| 486 | 486 | |
| 487 | 487 | $waterfallLogRepository = new WaterfallLogRepository($container['db_connection_locator']); |
@@ -490,91 +490,91 @@ discard block |
||
| 490 | 490 | $mostRecentWaterfallLog = array_reduce($activeWaterfallLogs, $reduceToMostRecentJournalLog); |
| 491 | 491 | |
| 492 | 492 | $entryArray += [ |
| 493 | - '/journal/' => [ |
|
| 494 | - 'lastmod' => (new DateTime($mostRecentWaterfallLog['publish_date']))->format('c'), |
|
| 495 | - 'changefreq' => 'weekly', |
|
| 496 | - 'priority' => .3, |
|
| 497 | - ], |
|
| 493 | + '/journal/' => [ |
|
| 494 | + 'lastmod' => (new DateTime($mostRecentWaterfallLog['publish_date']))->format('c'), |
|
| 495 | + 'changefreq' => 'weekly', |
|
| 496 | + 'priority' => .3, |
|
| 497 | + ], |
|
| 498 | 498 | ]; |
| 499 | 499 | |
| 500 | 500 | for ($i = 2; (($i - 1) * 10) < count($activeWaterfallLogs); $i++) { |
| 501 | - $entryKey = "/journal/{$i}/"; |
|
| 502 | - $entryArray += [ |
|
| 503 | - $entryKey => [ |
|
| 504 | - 'lastmod' => (new DateTime($mostRecentWaterfallLog['publish_date']))->format('c'), |
|
| 505 | - 'changefreq' => 'weekly', |
|
| 506 | - 'priority' => .1, |
|
| 507 | - ] |
|
| 508 | - ]; |
|
| 501 | + $entryKey = "/journal/{$i}/"; |
|
| 502 | + $entryArray += [ |
|
| 503 | + $entryKey => [ |
|
| 504 | + 'lastmod' => (new DateTime($mostRecentWaterfallLog['publish_date']))->format('c'), |
|
| 505 | + 'changefreq' => 'weekly', |
|
| 506 | + 'priority' => .1, |
|
| 507 | + ] |
|
| 508 | + ]; |
|
| 509 | 509 | } |
| 510 | 510 | |
| 511 | 511 | $waterfallCompanionRepository = new WaterfallCompanionRepository($container['db_connection_locator']); |
| 512 | 512 | $waterfallCompanionList = $waterfallCompanionRepository->getCompanionList(); |
| 513 | 513 | |
| 514 | 514 | foreach ($waterfallCompanionList as $waterfallCompanion) { |
| 515 | - $entryKey = "/companion/{$waterfallCompanion['alias']}/"; |
|
| 516 | - $entryArray += [ |
|
| 517 | - $entryKey => [ |
|
| 518 | - 'lastmod' => (new DateTime('December 20, 2015'))->format('Y-m-d'), // todo based on log |
|
| 519 | - 'changefreq' => 'monthly', |
|
| 520 | - 'priority' => .2 |
|
| 521 | - ] |
|
| 522 | - ]; |
|
| 523 | - |
|
| 524 | - for ($i = 2; (($i - 1) * 10) < $waterfallCompanion['count']; $i++) { |
|
| 525 | - $entryKey = "/companion/{$waterfallCompanion['alias']}/{$i}/"; |
|
| 526 | - $entryArray += [ |
|
| 527 | - $entryKey => [ |
|
| 528 | - 'lastmod' => (new DateTime('December 20, 2015'))->format('Y-m-d'), |
|
| 529 | - 'changefreq' => 'monthly', |
|
| 530 | - 'priority' => .1 |
|
| 531 | - ] |
|
| 532 | - ]; |
|
| 533 | - } |
|
| 515 | + $entryKey = "/companion/{$waterfallCompanion['alias']}/"; |
|
| 516 | + $entryArray += [ |
|
| 517 | + $entryKey => [ |
|
| 518 | + 'lastmod' => (new DateTime('December 20, 2015'))->format('Y-m-d'), // todo based on log |
|
| 519 | + 'changefreq' => 'monthly', |
|
| 520 | + 'priority' => .2 |
|
| 521 | + ] |
|
| 522 | + ]; |
|
| 523 | + |
|
| 524 | + for ($i = 2; (($i - 1) * 10) < $waterfallCompanion['count']; $i++) { |
|
| 525 | + $entryKey = "/companion/{$waterfallCompanion['alias']}/{$i}/"; |
|
| 526 | + $entryArray += [ |
|
| 527 | + $entryKey => [ |
|
| 528 | + 'lastmod' => (new DateTime('December 20, 2015'))->format('Y-m-d'), |
|
| 529 | + 'changefreq' => 'monthly', |
|
| 530 | + 'priority' => .1 |
|
| 531 | + ] |
|
| 532 | + ]; |
|
| 533 | + } |
|
| 534 | 534 | } |
| 535 | 535 | |
| 536 | 536 | $waterfallPeriodRepository = new WaterfallPeriodRepository($container['db_connection_locator']); |
| 537 | 537 | $waterfallPeriodList = $waterfallPeriodRepository->getPeriodList(); |
| 538 | 538 | |
| 539 | 539 | foreach ($waterfallPeriodList as $waterfallPeriod) { |
| 540 | - $entryKey = "/period/{$waterfallPeriod['alias']}/"; |
|
| 541 | - $entryArray += [ |
|
| 542 | - $entryKey => [ |
|
| 543 | - 'lastmod' => (new DateTime('December 20, 2015'))->format('Y-m-d'), // todo based on log |
|
| 544 | - 'changefreq' => 'monthly', |
|
| 545 | - 'priority' => .2 |
|
| 546 | - ] |
|
| 547 | - ]; |
|
| 548 | - |
|
| 549 | - for ($i = 2; (($i - 1) * 10) < $waterfallPeriod['count']; $i++) { |
|
| 550 | - $entryKey = "/period/{$waterfallPeriod['alias']}/{$i}/"; |
|
| 551 | - $entryArray += [ |
|
| 552 | - $entryKey => [ |
|
| 553 | - 'lastmod' => (new DateTime('December 20, 2015'))->format('Y-m-d'), |
|
| 554 | - 'changefreq' => 'monthly', |
|
| 555 | - 'priority' => .1 |
|
| 556 | - ] |
|
| 557 | - ]; |
|
| 558 | - } |
|
| 540 | + $entryKey = "/period/{$waterfallPeriod['alias']}/"; |
|
| 541 | + $entryArray += [ |
|
| 542 | + $entryKey => [ |
|
| 543 | + 'lastmod' => (new DateTime('December 20, 2015'))->format('Y-m-d'), // todo based on log |
|
| 544 | + 'changefreq' => 'monthly', |
|
| 545 | + 'priority' => .2 |
|
| 546 | + ] |
|
| 547 | + ]; |
|
| 548 | + |
|
| 549 | + for ($i = 2; (($i - 1) * 10) < $waterfallPeriod['count']; $i++) { |
|
| 550 | + $entryKey = "/period/{$waterfallPeriod['alias']}/{$i}/"; |
|
| 551 | + $entryArray += [ |
|
| 552 | + $entryKey => [ |
|
| 553 | + 'lastmod' => (new DateTime('December 20, 2015'))->format('Y-m-d'), |
|
| 554 | + 'changefreq' => 'monthly', |
|
| 555 | + 'priority' => .1 |
|
| 556 | + ] |
|
| 557 | + ]; |
|
| 558 | + } |
|
| 559 | 559 | } |
| 560 | 560 | |
| 561 | 561 | foreach ($activeWaterfallLogs as $waterfallLog) { |
| 562 | - $entryKey = "/journal/{$waterfallLog['alias']}/"; |
|
| 563 | - $entryArray += [ |
|
| 564 | - $entryKey => [ |
|
| 565 | - 'lastmod' => (new DateTime($waterfallLog['publish_date']))->format('c'), |
|
| 566 | - 'changefreq' => 'weekly', |
|
| 567 | - 'priority' => .4, |
|
| 568 | - ], |
|
| 569 | - ]; |
|
| 562 | + $entryKey = "/journal/{$waterfallLog['alias']}/"; |
|
| 563 | + $entryArray += [ |
|
| 564 | + $entryKey => [ |
|
| 565 | + 'lastmod' => (new DateTime($waterfallLog['publish_date']))->format('c'), |
|
| 566 | + 'changefreq' => 'weekly', |
|
| 567 | + 'priority' => .4, |
|
| 568 | + ], |
|
| 569 | + ]; |
|
| 570 | 570 | } |
| 571 | 571 | |
| 572 | 572 | $entryArray += [ |
| 573 | - '/about/' => [ |
|
| 574 | - 'lastmod' => (new DateTime('December 20, 2015'))->format('Y-m-d'), |
|
| 575 | - 'changefreq' => 'monthly', |
|
| 576 | - 'priority' => .6, |
|
| 577 | - ] |
|
| 573 | + '/about/' => [ |
|
| 574 | + 'lastmod' => (new DateTime('December 20, 2015'))->format('Y-m-d'), |
|
| 575 | + 'changefreq' => 'monthly', |
|
| 576 | + 'priority' => .6, |
|
| 577 | + ] |
|
| 578 | 578 | ]; |
| 579 | 579 | |
| 580 | 580 | $buildSitemap($entryArray, 'http://www.waterfallsofthekeweenaw.com', 'waterfalls'); |
@@ -7,36 +7,36 @@ |
||
| 7 | 7 | class MysqlPieceRepository implements PieceRepositoryInterface |
| 8 | 8 | { |
| 9 | 9 | |
| 10 | - /** @var Aura\Sql\ConnectionLocator */ |
|
| 11 | - protected $connections; |
|
| 12 | - |
|
| 13 | - /** |
|
| 14 | - * @param Aura\Sql\ConnectionLocator $connections |
|
| 15 | - */ |
|
| 16 | - public function __construct(ConnectionLocator $connections) |
|
| 17 | - { |
|
| 18 | - $this->connections = $connections; |
|
| 19 | - } |
|
| 20 | - |
|
| 21 | - public function getPieces($limit = null, $offset = 0) |
|
| 22 | - { |
|
| 23 | - $query = " |
|
| 10 | + /** @var Aura\Sql\ConnectionLocator */ |
|
| 11 | + protected $connections; |
|
| 12 | + |
|
| 13 | + /** |
|
| 14 | + * @param Aura\Sql\ConnectionLocator $connections |
|
| 15 | + */ |
|
| 16 | + public function __construct(ConnectionLocator $connections) |
|
| 17 | + { |
|
| 18 | + $this->connections = $connections; |
|
| 19 | + } |
|
| 20 | + |
|
| 21 | + public function getPieces($limit = null, $offset = 0) |
|
| 22 | + { |
|
| 23 | + $query = " |
|
| 24 | 24 | SELECT `id`, `title`, `title_url`, `category` |
| 25 | 25 | FROM `jpemeric_portfolio`.`piece` |
| 26 | 26 | WHERE `display` = :is_active |
| 27 | 27 | ORDER BY `date` DESC"; |
| 28 | - if ($limit != null) { |
|
| 29 | - $query .= " |
|
| 28 | + if ($limit != null) { |
|
| 29 | + $query .= " |
|
| 30 | 30 | LIMIT {$offset}, {$limit}"; |
| 31 | - } |
|
| 31 | + } |
|
| 32 | 32 | |
| 33 | - $bindings = [ |
|
| 34 | - 'is_active' => 1, |
|
| 35 | - ]; |
|
| 33 | + $bindings = [ |
|
| 34 | + 'is_active' => 1, |
|
| 35 | + ]; |
|
| 36 | 36 | |
| 37 | - return $this |
|
| 38 | - ->connections |
|
| 39 | - ->getRead() |
|
| 40 | - ->fetchAll($query, $bindings); |
|
| 41 | - } |
|
| 37 | + return $this |
|
| 38 | + ->connections |
|
| 39 | + ->getRead() |
|
| 40 | + ->fetchAll($query, $bindings); |
|
| 41 | + } |
|
| 42 | 42 | } |
@@ -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 CompanionRepositoryInterface |
| 6 | 6 | { |
| 7 | - public function getCompanionList(); |
|
| 7 | + public function getCompanionList(); |
|
| 8 | 8 | } |
@@ -7,20 +7,20 @@ discard block |
||
| 7 | 7 | class MysqlCompanionRepository implements CompanionRepositoryInterface |
| 8 | 8 | { |
| 9 | 9 | |
| 10 | - /** @var Aura\Sql\ConnectionLocator */ |
|
| 11 | - protected $connections; |
|
| 12 | - |
|
| 13 | - /** |
|
| 14 | - * @param Aura\Sql\ConnectionLocator $connections |
|
| 15 | - */ |
|
| 16 | - public function __construct(ConnectionLocator $connections) |
|
| 17 | - { |
|
| 18 | - $this->connections = $connections; |
|
| 19 | - } |
|
| 20 | - |
|
| 21 | - public function getCompanionList() |
|
| 22 | - { |
|
| 23 | - $query = " |
|
| 10 | + /** @var Aura\Sql\ConnectionLocator */ |
|
| 11 | + protected $connections; |
|
| 12 | + |
|
| 13 | + /** |
|
| 14 | + * @param Aura\Sql\ConnectionLocator $connections |
|
| 15 | + */ |
|
| 16 | + public function __construct(ConnectionLocator $connections) |
|
| 17 | + { |
|
| 18 | + $this->connections = $connections; |
|
| 19 | + } |
|
| 20 | + |
|
| 21 | + public function getCompanionList() |
|
| 22 | + { |
|
| 23 | + $query = " |
|
| 24 | 24 | SELECT `companion`.`name`, `companion`.`alias`, COUNT(1) AS `count` |
| 25 | 25 | FROM `jpemeric_waterfall`.`companion` |
| 26 | 26 | INNER JOIN `jpemeric_waterfall`.`log_companion_map` ON `log_companion_map`.`companion` = `companion`.`id` |
@@ -29,13 +29,13 @@ discard block |
||
| 29 | 29 | GROUP BY `alias` |
| 30 | 30 | ORDER BY `name`"; |
| 31 | 31 | |
| 32 | - $bindings = [ |
|
| 33 | - 'public' => 1, |
|
| 34 | - ]; |
|
| 32 | + $bindings = [ |
|
| 33 | + 'public' => 1, |
|
| 34 | + ]; |
|
| 35 | 35 | |
| 36 | - return $this |
|
| 37 | - ->connections |
|
| 38 | - ->getRead() |
|
| 39 | - ->fetchAll($query, $bindings); |
|
| 40 | - } |
|
| 36 | + return $this |
|
| 37 | + ->connections |
|
| 38 | + ->getRead() |
|
| 39 | + ->fetchAll($query, $bindings); |
|
| 40 | + } |
|
| 41 | 41 | } |
@@ -4,5 +4,5 @@ |
||
| 4 | 4 | |
| 5 | 5 | interface CountyRepositoryInterface |
| 6 | 6 | { |
| 7 | - public function getCountyList(); |
|
| 7 | + public function getCountyList(); |
|
| 8 | 8 | } |
@@ -7,20 +7,20 @@ discard block |
||
| 7 | 7 | class MysqlCountyRepository implements CountyRepositoryInterface |
| 8 | 8 | { |
| 9 | 9 | |
| 10 | - /** @var Aura\Sql\ConnectionLocator */ |
|
| 11 | - protected $connections; |
|
| 12 | - |
|
| 13 | - /** |
|
| 14 | - * @param Aura\Sql\ConnectionLocator $connections |
|
| 15 | - */ |
|
| 16 | - public function __construct(ConnectionLocator $connections) |
|
| 17 | - { |
|
| 18 | - $this->connections = $connections; |
|
| 19 | - } |
|
| 20 | - |
|
| 21 | - public function getCountyList() |
|
| 22 | - { |
|
| 23 | - $query = " |
|
| 10 | + /** @var Aura\Sql\ConnectionLocator */ |
|
| 11 | + protected $connections; |
|
| 12 | + |
|
| 13 | + /** |
|
| 14 | + * @param Aura\Sql\ConnectionLocator $connections |
|
| 15 | + */ |
|
| 16 | + public function __construct(ConnectionLocator $connections) |
|
| 17 | + { |
|
| 18 | + $this->connections = $connections; |
|
| 19 | + } |
|
| 20 | + |
|
| 21 | + public function getCountyList() |
|
| 22 | + { |
|
| 23 | + $query = " |
|
| 24 | 24 | SELECT `county`.`name`, `county`.`alias`, COUNT(1) AS `count` |
| 25 | 25 | FROM `jpemeric_waterfall`.`county` |
| 26 | 26 | INNER JOIN `jpemeric_waterfall`.`waterfall` ON `waterfall`.`county` = `county`.`id` AND |
@@ -28,13 +28,13 @@ discard block |
||
| 28 | 28 | GROUP BY `alias` |
| 29 | 29 | ORDER BY `name`"; |
| 30 | 30 | |
| 31 | - $bindings = [ |
|
| 32 | - 'public' => 1, |
|
| 33 | - ]; |
|
| 31 | + $bindings = [ |
|
| 32 | + 'public' => 1, |
|
| 33 | + ]; |
|
| 34 | 34 | |
| 35 | - return $this |
|
| 36 | - ->connections |
|
| 37 | - ->getRead() |
|
| 38 | - ->fetchAll($query, $bindings); |
|
| 39 | - } |
|
| 35 | + return $this |
|
| 36 | + ->connections |
|
| 37 | + ->getRead() |
|
| 38 | + ->fetchAll($query, $bindings); |
|
| 39 | + } |
|
| 40 | 40 | } |
@@ -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 | } |