@@ -20,9 +20,9 @@ discard block |
||
20 | 20 | |
21 | 21 | public function activate() |
22 | 22 | { |
23 | - foreach(self::$CRON_ARRAY as $cron => $frequency) |
|
23 | + foreach (self::$CRON_ARRAY as $cron => $frequency) |
|
24 | 24 | { |
25 | - if(!$this->time_to_run($frequency)) |
|
25 | + if (!$this->time_to_run($frequency)) |
|
26 | 26 | continue; |
27 | 27 | |
28 | 28 | Loader::load('utility', "cron/{$cron}"); |
@@ -46,19 +46,19 @@ discard block |
||
46 | 46 | $operator = explode(' ', $frequency); |
47 | 47 | list($time['minute'], $time['hour'], $time['day'], $time['month'], $time['weekday']) = $operator; |
48 | 48 | |
49 | - foreach($time as $key => $value) |
|
49 | + foreach ($time as $key => $value) |
|
50 | 50 | { |
51 | - if($value == '*') |
|
51 | + if ($value == '*') |
|
52 | 52 | continue; |
53 | - if(stristr($value, '/')) |
|
53 | + if (stristr($value, '/')) |
|
54 | 54 | { |
55 | 55 | $value = substr($value, 2); |
56 | - if($cur[$key] % $value == 0) |
|
56 | + if ($cur[$key] % $value == 0) |
|
57 | 57 | continue; |
58 | 58 | else |
59 | 59 | return; |
60 | 60 | } |
61 | - if($cur[$key] == $value) |
|
61 | + if ($cur[$key] == $value) |
|
62 | 62 | continue; |
63 | 63 | return; |
64 | 64 | } |
@@ -22,8 +22,9 @@ discard block |
||
22 | 22 | { |
23 | 23 | foreach(self::$CRON_ARRAY as $cron => $frequency) |
24 | 24 | { |
25 | - if(!$this->time_to_run($frequency)) |
|
26 | - continue; |
|
25 | + if(!$this->time_to_run($frequency)) { |
|
26 | + continue; |
|
27 | + } |
|
27 | 28 | |
28 | 29 | Loader::load('utility', "cron/{$cron}"); |
29 | 30 | $reflection = new ReflectionClass($cron); |
@@ -48,18 +49,21 @@ discard block |
||
48 | 49 | |
49 | 50 | foreach($time as $key => $value) |
50 | 51 | { |
51 | - if($value == '*') |
|
52 | - continue; |
|
52 | + if($value == '*') { |
|
53 | + continue; |
|
54 | + } |
|
53 | 55 | if(stristr($value, '/')) |
54 | 56 | { |
55 | 57 | $value = substr($value, 2); |
56 | - if($cur[$key] % $value == 0) |
|
57 | - continue; |
|
58 | - else |
|
59 | - return; |
|
58 | + if($cur[$key] % $value == 0) { |
|
59 | + continue; |
|
60 | + } else { |
|
61 | + return; |
|
62 | + } |
|
60 | 63 | } |
61 | - if($cur[$key] == $value) |
|
62 | - continue; |
|
64 | + if($cur[$key] == $value) { |
|
65 | + continue; |
|
66 | + } |
|
63 | 67 | return; |
64 | 68 | } |
65 | 69 | return true; |
@@ -32,37 +32,37 @@ |
||
32 | 32 | |
33 | 33 | private function get_sites() |
34 | 34 | { |
35 | - return [ |
|
36 | - [ |
|
37 | - 'url' => 'http://home.jacobemerick.com/', |
|
38 | - 'title' => "Jacob Emerick's Home", |
|
39 | - 'name' => 'Home' |
|
40 | - ], |
|
41 | - [ |
|
42 | - 'url' => 'http://blog.jacobemerick.com/', |
|
43 | - 'title' => "Jacob Emerick's Blog", |
|
44 | - 'name' => 'Blog' |
|
45 | - ], |
|
46 | - [ |
|
47 | - 'url' => 'http://lifestream.jacobemerick.com/', |
|
48 | - 'title' => "Jacob Emerick's Lifestream", |
|
49 | - 'name' => 'Lifestream' |
|
50 | - ], |
|
51 | - [ |
|
52 | - 'url' => 'http://map.jacobemerick.com/', |
|
53 | - 'title' => "Jacob Emerick's Hiking Map", |
|
54 | - 'name' => 'Map' |
|
55 | - ], |
|
56 | - [ |
|
57 | - 'url' => 'http://portfolio.jacobemerick.com/', |
|
58 | - 'title' => "Jacob Emerick's Portfolio", |
|
59 | - 'name' => 'Portfolio', |
|
60 | - ], |
|
61 | - [ |
|
62 | - 'url' => 'http://www.waterfallsofthekeweenaw.com/', |
|
63 | - 'title' => 'Waterfalls of the Keweenaw', |
|
64 | - 'name' => 'Waterfalls' |
|
65 | - ] |
|
35 | + return [ |
|
36 | + [ |
|
37 | + 'url' => 'http://home.jacobemerick.com/', |
|
38 | + 'title' => "Jacob Emerick's Home", |
|
39 | + 'name' => 'Home' |
|
40 | + ], |
|
41 | + [ |
|
42 | + 'url' => 'http://blog.jacobemerick.com/', |
|
43 | + 'title' => "Jacob Emerick's Blog", |
|
44 | + 'name' => 'Blog' |
|
45 | + ], |
|
46 | + [ |
|
47 | + 'url' => 'http://lifestream.jacobemerick.com/', |
|
48 | + 'title' => "Jacob Emerick's Lifestream", |
|
49 | + 'name' => 'Lifestream' |
|
50 | + ], |
|
51 | + [ |
|
52 | + 'url' => 'http://map.jacobemerick.com/', |
|
53 | + 'title' => "Jacob Emerick's Hiking Map", |
|
54 | + 'name' => 'Map' |
|
55 | + ], |
|
56 | + [ |
|
57 | + 'url' => 'http://portfolio.jacobemerick.com/', |
|
58 | + 'title' => "Jacob Emerick's Portfolio", |
|
59 | + 'name' => 'Portfolio', |
|
60 | + ], |
|
61 | + [ |
|
62 | + 'url' => 'http://www.waterfallsofthekeweenaw.com/', |
|
63 | + 'title' => 'Waterfalls of the Keweenaw', |
|
64 | + 'name' => 'Waterfalls' |
|
65 | + ] |
|
66 | 66 | ]; |
67 | 67 | } |
68 | 68 |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | |
11 | 11 | protected static $WATERFALL_SITE_ID = 5; |
12 | 12 | |
13 | - protected $parent_navigation_item = ''; |
|
13 | + protected $parent_navigation_item = ''; |
|
14 | 14 | |
15 | 15 | protected function set_head_data() |
16 | 16 | { |
@@ -19,45 +19,45 @@ discard block |
||
19 | 19 | $this->add_css('waterfalls'); |
20 | 20 | } |
21 | 21 | |
22 | - protected function add_waterfall_js() |
|
23 | - { |
|
24 | - $this->add_js('jquery'); |
|
25 | - $this->add_js('imagelightbox'); |
|
26 | - $this->add_js('waterfalls'); |
|
27 | - } |
|
22 | + protected function add_waterfall_js() |
|
23 | + { |
|
24 | + $this->add_js('jquery'); |
|
25 | + $this->add_js('imagelightbox'); |
|
26 | + $this->add_js('waterfalls'); |
|
27 | + } |
|
28 | 28 | |
29 | 29 | protected function set_body_data($page_type = 'normal') |
30 | 30 | { |
31 | 31 | $this->set_body('activity_array', $this->get_recent_activity()); |
32 | 32 | |
33 | - $this->set_body('main_navigation', array( |
|
34 | - (object) array( |
|
35 | - 'uri' => '/falls/', |
|
36 | - 'anchor' => 'Falls', |
|
37 | - 'is_active' => $this->parent_navigation_item === 'falls', |
|
38 | - ), |
|
39 | - (object) array( |
|
40 | - 'uri' => '/map/', |
|
41 | - 'anchor' => 'Map', |
|
42 | - 'is_active' => $this->parent_navigation_item === 'map', |
|
43 | - ), |
|
44 | - (object) array( |
|
45 | - 'uri' => '/journal/', |
|
46 | - 'anchor' => 'Journal', |
|
47 | - 'is_active' => $this->parent_navigation_item === 'journal', |
|
48 | - ), |
|
49 | - (object) array( |
|
50 | - 'uri' => '/about/', |
|
51 | - 'anchor' => 'About', |
|
52 | - 'is_active' => $this->parent_navigation_item === 'about', |
|
53 | - ) |
|
54 | - )); |
|
55 | - |
|
56 | - if ($page_type == 'wide') { |
|
57 | - $this->set_body_view('WidePage'); |
|
58 | - } else { |
|
59 | - $this->set_body_view('Page'); |
|
60 | - } |
|
61 | - } |
|
33 | + $this->set_body('main_navigation', array( |
|
34 | + (object) array( |
|
35 | + 'uri' => '/falls/', |
|
36 | + 'anchor' => 'Falls', |
|
37 | + 'is_active' => $this->parent_navigation_item === 'falls', |
|
38 | + ), |
|
39 | + (object) array( |
|
40 | + 'uri' => '/map/', |
|
41 | + 'anchor' => 'Map', |
|
42 | + 'is_active' => $this->parent_navigation_item === 'map', |
|
43 | + ), |
|
44 | + (object) array( |
|
45 | + 'uri' => '/journal/', |
|
46 | + 'anchor' => 'Journal', |
|
47 | + 'is_active' => $this->parent_navigation_item === 'journal', |
|
48 | + ), |
|
49 | + (object) array( |
|
50 | + 'uri' => '/about/', |
|
51 | + 'anchor' => 'About', |
|
52 | + 'is_active' => $this->parent_navigation_item === 'about', |
|
53 | + ) |
|
54 | + )); |
|
55 | + |
|
56 | + if ($page_type == 'wide') { |
|
57 | + $this->set_body_view('WidePage'); |
|
58 | + } else { |
|
59 | + $this->set_body_view('Page'); |
|
60 | + } |
|
61 | + } |
|
62 | 62 | |
63 | 63 | } |
@@ -12,9 +12,9 @@ |
||
12 | 12 | |
13 | 13 | $portfolio_result = PortfolioCollector::getImageById($id); |
14 | 14 | |
15 | - $image_path = "portfolio/{$portfolio_result->name}"; |
|
16 | - $image_path = Loader::getImagePath('image', $image_path); |
|
17 | - $image_size = getimagesize($image_path); |
|
15 | + $image_path = "portfolio/{$portfolio_result->name}"; |
|
16 | + $image_path = Loader::getImagePath('image', $image_path); |
|
17 | + $image_size = getimagesize($image_path); |
|
18 | 18 | |
19 | 19 | $main_image = new stdclass(); |
20 | 20 | $main_image->id = $portfolio_result->id; |
@@ -80,9 +80,9 @@ discard block |
||
80 | 80 | if($this->requires_trailing_slash() && substr($redirect_uri, -1) != '/') |
81 | 81 | $redirect_uri .= '/'; |
82 | 82 | |
83 | - if (URLDecode::getHost() == 'waterfalls.jacobemerick.com') { |
|
84 | - $redirect_uri = 'http://' . (!Loader::isLive() ? 'dev' : 'www') . '.waterfallsofthekeweenaw.com' . $redirect_uri; |
|
85 | - } |
|
83 | + if (URLDecode::getHost() == 'waterfalls.jacobemerick.com') { |
|
84 | + $redirect_uri = 'http://' . (!Loader::isLive() ? 'dev' : 'www') . '.waterfallsofthekeweenaw.com' . $redirect_uri; |
|
85 | + } |
|
86 | 86 | |
87 | 87 | if($redirect_uri == URLDecode::getURI()) |
88 | 88 | return; |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | URLDecode::getExtension() != 'json' && |
148 | 148 | URLDecode::getExtension() != 'jpg' && |
149 | 149 | URLDecode::getExtension() != 'png' && |
150 | - strstr(URLDecode::getURI(), '#') === false); |
|
150 | + strstr(URLDecode::getURI(), '#') === false); |
|
151 | 151 | } |
152 | 152 | |
153 | 153 | } |
@@ -18,10 +18,10 @@ discard block |
||
18 | 18 | |
19 | 19 | private static function get_router_name() |
20 | 20 | { |
21 | - if(Request::isAJAX()) |
|
21 | + if (Request::isAJAX()) |
|
22 | 22 | return 'AJAXRouter'; |
23 | 23 | |
24 | - switch(URLDecode::getSite()) |
|
24 | + switch (URLDecode::getSite()) |
|
25 | 25 | { |
26 | 26 | case 'ajax' : |
27 | 27 | return 'AjaxRouter'; |
@@ -66,36 +66,36 @@ discard block |
||
66 | 66 | |
67 | 67 | final protected function check_for_redirect($redirect_uri) |
68 | 68 | { |
69 | - foreach($this->get_redirect_array() as $check) |
|
69 | + foreach ($this->get_redirect_array() as $check) |
|
70 | 70 | { |
71 | 71 | $redirect_uri = preg_replace($check->pattern, $check->replace, $redirect_uri); |
72 | 72 | } |
73 | 73 | |
74 | 74 | $redirect_uri = $this->check_for_special_redirect($redirect_uri); |
75 | 75 | |
76 | - if($this->requires_trailing_slash() && substr($redirect_uri, -1) != '/') |
|
76 | + if ($this->requires_trailing_slash() && substr($redirect_uri, -1) != '/') |
|
77 | 77 | $redirect_uri .= '/'; |
78 | 78 | |
79 | 79 | if (URLDecode::getHost() == 'waterfalls.jacobemerick.com') { |
80 | 80 | $redirect_uri = 'http://' . (!Loader::isLive() ? 'dev' : 'www') . '.waterfallsofthekeweenaw.com' . $redirect_uri; |
81 | 81 | } |
82 | 82 | |
83 | - if($redirect_uri == URLDecode::getURI()) |
|
83 | + if ($redirect_uri == URLDecode::getURI()) |
|
84 | 84 | return; |
85 | 85 | |
86 | 86 | $controller_check = $redirect_uri; |
87 | - if(substr($redirect_uri, 0, 4) == 'http') |
|
87 | + if (substr($redirect_uri, 0, 4) == 'http') |
|
88 | 88 | $controller_check = preg_replace('@^http://([a-z\.]+)@', '', $redirect_uri); |
89 | 89 | |
90 | 90 | $controller = $this->get_controller($controller_check); |
91 | - if($controller == '/Error404Controller') |
|
91 | + if ($controller == '/Error404Controller') |
|
92 | 92 | { |
93 | 93 | Loader::loadNew('controller', '/Error404Controller') |
94 | 94 | ->activate(); |
95 | 95 | exit; |
96 | 96 | } |
97 | 97 | |
98 | - if(substr($redirect_uri, 0, 4) != 'http') |
|
98 | + if (substr($redirect_uri, 0, 4) != 'http') |
|
99 | 99 | { |
100 | 100 | $redirect_uri = substr($redirect_uri, 1); |
101 | 101 | $redirect_uri = URLDecode::getBase() . $redirect_uri; |
@@ -112,12 +112,12 @@ discard block |
||
112 | 112 | |
113 | 113 | final private function get_controller($uri) |
114 | 114 | { |
115 | - foreach($this->get_direct_array() as $check) |
|
115 | + foreach ($this->get_direct_array() as $check) |
|
116 | 116 | { |
117 | - if($uri == $check->match) |
|
117 | + if ($uri == $check->match) |
|
118 | 118 | return "{$this->get_primary_folder()}/{$check->controller}"; |
119 | 119 | |
120 | - if(preg_match("@^{$check->match}$@", $uri)) |
|
120 | + if (preg_match("@^{$check->match}$@", $uri)) |
|
121 | 121 | return "{$this->get_primary_folder()}/{$check->controller}"; |
122 | 122 | } |
123 | 123 | |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | |
127 | 127 | final private function get_primary_folder() |
128 | 128 | { |
129 | - if(Request::isAjax()) |
|
129 | + if (Request::isAjax()) |
|
130 | 130 | return 'ajax'; |
131 | 131 | |
132 | 132 | return URLDecode::getSite(); |
@@ -18,8 +18,9 @@ discard block |
||
18 | 18 | |
19 | 19 | private static function get_router_name() |
20 | 20 | { |
21 | - if(Request::isAJAX()) |
|
22 | - return 'AJAXRouter'; |
|
21 | + if(Request::isAJAX()) { |
|
22 | + return 'AJAXRouter'; |
|
23 | + } |
|
23 | 24 | |
24 | 25 | switch(URLDecode::getSite()) |
25 | 26 | { |
@@ -73,19 +74,22 @@ discard block |
||
73 | 74 | |
74 | 75 | $redirect_uri = $this->check_for_special_redirect($redirect_uri); |
75 | 76 | |
76 | - if($this->requires_trailing_slash() && substr($redirect_uri, -1) != '/') |
|
77 | - $redirect_uri .= '/'; |
|
77 | + if($this->requires_trailing_slash() && substr($redirect_uri, -1) != '/') { |
|
78 | + $redirect_uri .= '/'; |
|
79 | + } |
|
78 | 80 | |
79 | 81 | if (URLDecode::getHost() == 'waterfalls.jacobemerick.com') { |
80 | 82 | $redirect_uri = 'http://' . (!Loader::isLive() ? 'dev' : 'www') . '.waterfallsofthekeweenaw.com' . $redirect_uri; |
81 | 83 | } |
82 | 84 | |
83 | - if($redirect_uri == URLDecode::getURI()) |
|
84 | - return; |
|
85 | + if($redirect_uri == URLDecode::getURI()) { |
|
86 | + return; |
|
87 | + } |
|
85 | 88 | |
86 | 89 | $controller_check = $redirect_uri; |
87 | - if(substr($redirect_uri, 0, 4) == 'http') |
|
88 | - $controller_check = preg_replace('@^http://([a-z\.]+)@', '', $redirect_uri); |
|
90 | + if(substr($redirect_uri, 0, 4) == 'http') { |
|
91 | + $controller_check = preg_replace('@^http://([a-z\.]+)@', '', $redirect_uri); |
|
92 | + } |
|
89 | 93 | |
90 | 94 | $controller = $this->get_controller($controller_check); |
91 | 95 | if($controller == '/Error404Controller') |
@@ -114,11 +118,13 @@ discard block |
||
114 | 118 | { |
115 | 119 | foreach($this->get_direct_array() as $check) |
116 | 120 | { |
117 | - if($uri == $check->match) |
|
118 | - return "{$this->get_primary_folder()}/{$check->controller}"; |
|
121 | + if($uri == $check->match) { |
|
122 | + return "{$this->get_primary_folder()}/{$check->controller}"; |
|
123 | + } |
|
119 | 124 | |
120 | - if(preg_match("@^{$check->match}$@", $uri)) |
|
121 | - return "{$this->get_primary_folder()}/{$check->controller}"; |
|
125 | + if(preg_match("@^{$check->match}$@", $uri)) { |
|
126 | + return "{$this->get_primary_folder()}/{$check->controller}"; |
|
127 | + } |
|
122 | 128 | } |
123 | 129 | |
124 | 130 | return '/Error404Controller'; |
@@ -126,8 +132,9 @@ discard block |
||
126 | 132 | |
127 | 133 | final private function get_primary_folder() |
128 | 134 | { |
129 | - if(Request::isAjax()) |
|
130 | - return 'ajax'; |
|
135 | + if(Request::isAjax()) { |
|
136 | + return 'ajax'; |
|
137 | + } |
|
131 | 138 | |
132 | 139 | return URLDecode::getSite(); |
133 | 140 | } |
@@ -12,8 +12,8 @@ |
||
12 | 12 | $formatter = new LineFormatter('[%datetime%] %channel%.%level_name%: %message%'); |
13 | 13 | |
14 | 14 | $handler = new StreamHandler( |
15 | - __DIR__ . '/../../logs/site.log', |
|
16 | - Logger::DEBUG |
|
15 | + __DIR__ . '/../../logs/site.log', |
|
16 | + Logger::DEBUG |
|
17 | 17 | ); |
18 | 18 | $handler->setFormatter($formatter); |
19 | 19 |
@@ -18,7 +18,7 @@ |
||
18 | 18 | * @param string $folder |
19 | 19 | * @return boolean |
20 | 20 | */ |
21 | -$buildFeed = function (Feed $feed, $folder) { |
|
21 | +$buildFeed = function(Feed $feed, $folder) { |
|
22 | 22 | $tempFeed = __DIR__ . "/../../public/{$folder}/rss-new.xml"; |
23 | 23 | $finalFeed = __DIR__ . "/../../public/{$folder}/rss.xml"; |
24 | 24 |
@@ -16,14 +16,14 @@ discard block |
||
16 | 16 | * @return boolean |
17 | 17 | */ |
18 | 18 | $buildFeed = function (Feed $feed, $folder) { |
19 | - $tempFeed = __DIR__ . "/../../public/{$folder}/rss-new.xml"; |
|
20 | - $finalFeed = __DIR__ . "/../../public/{$folder}/rss.xml"; |
|
19 | + $tempFeed = __DIR__ . "/../../public/{$folder}/rss-new.xml"; |
|
20 | + $finalFeed = __DIR__ . "/../../public/{$folder}/rss.xml"; |
|
21 | 21 | |
22 | - $feedHandle = fopen($tempFeed, 'w'); |
|
23 | - fwrite($feedHandle, $feed->render()); |
|
24 | - fclose($feedHandle); |
|
22 | + $feedHandle = fopen($tempFeed, 'w'); |
|
23 | + fwrite($feedHandle, $feed->render()); |
|
24 | + fclose($feedHandle); |
|
25 | 25 | |
26 | - rename($tempFeed, $finalFeed); |
|
26 | + rename($tempFeed, $finalFeed); |
|
27 | 27 | }; |
28 | 28 | |
29 | 29 | |
@@ -42,34 +42,34 @@ discard block |
||
42 | 42 | $activeBlogPosts = $blogPostRepository->getActivePosts(); |
43 | 43 | |
44 | 44 | foreach ($activeBlogPosts as $blogPost) { |
45 | - $blogPostItem = new Item(); |
|
46 | - |
|
47 | - $blogPostItem->title($blogPost['title']); |
|
48 | - |
|
49 | - $url = "http://blog.jacobemerick.com/{$blogPost['category']}/{$blogPost['path']}/"; |
|
50 | - $blogPostItem->url($url); |
|
51 | - $blogPostItem->guid($url, true); |
|
52 | - |
|
53 | - $description = $blogPost['body']; |
|
54 | - $description = strip_tags($description); |
|
55 | - $description = strtok($description, "\n"); |
|
56 | - if (strlen($description) > 250) { |
|
57 | - $description = wordwrap($description, 250); |
|
58 | - $description = strtok($description, "\n"); |
|
59 | - if (substr($description, -1) != '.') { |
|
60 | - $description .= '…'; |
|
61 | - } |
|
62 | - } |
|
63 | - $description = html_entity_decode($description); |
|
64 | - $blogPostItem->description($description); |
|
65 | - |
|
66 | - $categoryUrl = "http://blog.jacobemerick.com/{$blogPost['category']}/"; |
|
67 | - $blogPostItem->category($blogPost['category'], $categoryUrl); |
|
68 | - |
|
69 | - $pubDate = new DateTime($blogPost['date']); |
|
70 | - $blogPostItem->pubDate($pubDate->getTimestamp()); |
|
71 | - |
|
72 | - $blogPostItem->appendTo($blogPostChannel); |
|
45 | + $blogPostItem = new Item(); |
|
46 | + |
|
47 | + $blogPostItem->title($blogPost['title']); |
|
48 | + |
|
49 | + $url = "http://blog.jacobemerick.com/{$blogPost['category']}/{$blogPost['path']}/"; |
|
50 | + $blogPostItem->url($url); |
|
51 | + $blogPostItem->guid($url, true); |
|
52 | + |
|
53 | + $description = $blogPost['body']; |
|
54 | + $description = strip_tags($description); |
|
55 | + $description = strtok($description, "\n"); |
|
56 | + if (strlen($description) > 250) { |
|
57 | + $description = wordwrap($description, 250); |
|
58 | + $description = strtok($description, "\n"); |
|
59 | + if (substr($description, -1) != '.') { |
|
60 | + $description .= '…'; |
|
61 | + } |
|
62 | + } |
|
63 | + $description = html_entity_decode($description); |
|
64 | + $blogPostItem->description($description); |
|
65 | + |
|
66 | + $categoryUrl = "http://blog.jacobemerick.com/{$blogPost['category']}/"; |
|
67 | + $blogPostItem->category($blogPost['category'], $categoryUrl); |
|
68 | + |
|
69 | + $pubDate = new DateTime($blogPost['date']); |
|
70 | + $blogPostItem->pubDate($pubDate->getTimestamp()); |
|
71 | + |
|
72 | + $blogPostItem->appendTo($blogPostChannel); |
|
73 | 73 | } |
74 | 74 | |
75 | 75 | $buildFeed($blogPostFeed, 'blog'); |
@@ -11,7 +11,7 @@ |
||
11 | 11 | protected $connections; |
12 | 12 | |
13 | 13 | /** |
14 | - * @param Aura\Sql\ConnectionLocator $connections |
|
14 | + * @param ConnectionLocator $connections |
|
15 | 15 | */ |
16 | 16 | public function __construct(ConnectionLocator $connections) |
17 | 17 | { |
@@ -7,38 +7,38 @@ |
||
7 | 7 | class MysqlWaterfallRepository implements WaterfallRepositoryInterface |
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 getWaterfalls($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 getWaterfalls($limit = null, $offset = 0) |
|
22 | + { |
|
23 | + $query = " |
|
24 | 24 | SELECT `waterfall`.`id`, `waterfall`.`name`, `waterfall`.`alias`, |
25 | 25 | `watercourse`.`name` AS `watercourse`, `watercourse`.`alias` AS `watercourse_alias` |
26 | 26 | FROM `jpemeric_waterfall`.`waterfall` |
27 | 27 | INNER JOIN `jpemeric_waterfall`.`watercourse` ON `waterfall`.`watercourse` = `watercourse`.`id` |
28 | 28 | WHERE `is_public` = :public |
29 | 29 | ORDER BY `name`, `watercourse`"; |
30 | - if ($limit != null) { |
|
31 | - $query .= " |
|
30 | + if ($limit != null) { |
|
31 | + $query .= " |
|
32 | 32 | LIMIT {$offset}, {$limit}"; |
33 | - } |
|
33 | + } |
|
34 | 34 | |
35 | - $bindings = [ |
|
36 | - 'public' => 1, |
|
37 | - ]; |
|
35 | + $bindings = [ |
|
36 | + 'public' => 1, |
|
37 | + ]; |
|
38 | 38 | |
39 | - return $this |
|
40 | - ->connections |
|
41 | - ->getRead() |
|
42 | - ->fetchAll($query, $bindings); |
|
43 | - } |
|
39 | + return $this |
|
40 | + ->connections |
|
41 | + ->getRead() |
|
42 | + ->fetchAll($query, $bindings); |
|
43 | + } |
|
44 | 44 | } |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | * @param string $domain |
26 | 26 | * @return boolean |
27 | 27 | */ |
28 | -$buildSitemap = function (array $entries, $domain, $folder) { |
|
28 | +$buildSitemap = function(array $entries, $domain, $folder) { |
|
29 | 29 | $urlSet = new Urlset(); |
30 | 30 | foreach ($entries as $path => $entry) { |
31 | 31 | $url = new Url("{$domain}{$path}"); // todo better detection of domain by env |
@@ -52,13 +52,13 @@ discard block |
||
52 | 52 | /********************************************* |
53 | 53 | * blog.jacobemerick.com |
54 | 54 | *********************************************/ |
55 | -$reduceToMostRecentBlogPost = function ($recentPost, $post) { |
|
55 | +$reduceToMostRecentBlogPost = function($recentPost, $post) { |
|
56 | 56 | if (is_null($recentPost)) { |
57 | 57 | return $post; |
58 | 58 | } |
59 | 59 | $postDate = new DateTime($post['date']); |
60 | 60 | $recentPostDate = new DateTime($recentPost['date']); |
61 | - return ($postDate > $recentPostDate) ? $post: $recentPost; |
|
61 | + return ($postDate > $recentPostDate) ? $post : $recentPost; |
|
62 | 62 | }; |
63 | 63 | |
64 | 64 | $blogPostsPerPage = 10; |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | ]; |
94 | 94 | |
95 | 95 | foreach ($blogCategoryArray as $blogCategory) { |
96 | - $blogCategoryPosts = array_filter($activeBlogPosts, function ($post) use ($blogCategory) { |
|
96 | + $blogCategoryPosts = array_filter($activeBlogPosts, function($post) use ($blogCategory) { |
|
97 | 97 | return $post['category'] == $blogCategory; |
98 | 98 | }); |
99 | 99 | $mostRecentBlogCategoryPost = array_reduce($blogCategoryPosts, $reduceToMostRecentBlogPost); |
@@ -206,13 +206,13 @@ discard block |
||
206 | 206 | /********************************************* |
207 | 207 | * lifestream.jacobemerick.com |
208 | 208 | *********************************************/ |
209 | -$reduceToMostRecentStreamPost = function ($recentPost, $post) { |
|
209 | +$reduceToMostRecentStreamPost = function($recentPost, $post) { |
|
210 | 210 | if (is_null($recentPost)) { |
211 | 211 | return $post; |
212 | 212 | } |
213 | 213 | $postDate = new DateTime($post['date']); |
214 | 214 | $recentPostDate = new DateTime($recentPost['date']); |
215 | - return ($postDate > $recentPostDate) ? $post: $recentPost; |
|
215 | + return ($postDate > $recentPostDate) ? $post : $recentPost; |
|
216 | 216 | }; |
217 | 217 | |
218 | 218 | $streamPostsPerPage = 15; |
@@ -249,7 +249,7 @@ discard block |
||
249 | 249 | ]; |
250 | 250 | |
251 | 251 | foreach ($streamTypeArray as $streamType) { |
252 | - $streamTypePosts = array_filter($streamPosts, function ($post) use ($streamType) { |
|
252 | + $streamTypePosts = array_filter($streamPosts, function($post) use ($streamType) { |
|
253 | 253 | return $post['type'] == $streamType; |
254 | 254 | }); |
255 | 255 | $mostRecentStreamTypePost = array_reduce($streamTypePosts, $reduceToMostRecentStreamPost); |
@@ -379,13 +379,13 @@ discard block |
||
379 | 379 | /********************************************* |
380 | 380 | * waterfall.jacobemerick.com |
381 | 381 | *********************************************/ |
382 | -$reduceToMostRecentJournalLog = function ($recentLog, $log) { |
|
382 | +$reduceToMostRecentJournalLog = function($recentLog, $log) { |
|
383 | 383 | if (is_null($recentLog)) { |
384 | 384 | return $log; |
385 | 385 | } |
386 | 386 | $logDate = new DateTime($log['publish_date']); |
387 | 387 | $recentLogDate = new DateTime($recentLog['publish_date']); |
388 | - return ($logDate > $recentLogDate) ? log: $recentLog; |
|
388 | + return ($logDate > $recentLogDate) ? log : $recentLog; |
|
389 | 389 | }; |
390 | 390 | |
391 | 391 | $waterfallRepository = new WaterfallRepository($container['db_connection_locator']); |
@@ -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'); |