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