@@ -34,6 +34,9 @@ discard block |
||
34 | 34 | return self::run_query($query); |
35 | 35 | } |
36 | 36 | |
37 | + /** |
|
38 | + * @param integer $total |
|
39 | + */ |
|
37 | 40 | public static function getRecentList($total) |
38 | 41 | { |
39 | 42 | $query = " |
@@ -178,6 +181,9 @@ discard block |
||
178 | 181 | return self::run_row_query($query); |
179 | 182 | } |
180 | 183 | |
184 | + /** |
|
185 | + * @param string $date |
|
186 | + */ |
|
181 | 187 | public static function getByDate($date) |
182 | 188 | { |
183 | 189 | $date = self::escape($date); |
@@ -34,9 +34,9 @@ discard block |
||
34 | 34 | return self::run_query($query); |
35 | 35 | } |
36 | 36 | |
37 | - public static function getRecentList($total) |
|
38 | - { |
|
39 | - $query = " |
|
37 | + public static function getRecentList($total) |
|
38 | + { |
|
39 | + $query = " |
|
40 | 40 | SELECT |
41 | 41 | `log`.`title`, |
42 | 42 | `log`.`alias`, |
@@ -59,8 +59,8 @@ discard block |
||
59 | 59 | `log`.`date` DESC |
60 | 60 | LIMIT |
61 | 61 | {$total}"; |
62 | - return self::run_query($query); |
|
63 | - } |
|
62 | + return self::run_query($query); |
|
63 | + } |
|
64 | 64 | |
65 | 65 | public static function getListCount() |
66 | 66 | { |
@@ -178,11 +178,11 @@ discard block |
||
178 | 178 | return self::run_row_query($query); |
179 | 179 | } |
180 | 180 | |
181 | - public static function getByDate($date) |
|
182 | - { |
|
183 | - $date = self::escape($date); |
|
181 | + public static function getByDate($date) |
|
182 | + { |
|
183 | + $date = self::escape($date); |
|
184 | 184 | |
185 | - $query = " |
|
185 | + $query = " |
|
186 | 186 | SELECT |
187 | 187 | `log`.`alias` |
188 | 188 | FROM |
@@ -192,8 +192,8 @@ discard block |
||
192 | 192 | `log`.`is_public` = '1' |
193 | 193 | LIMIT 1"; |
194 | 194 | |
195 | - return self::run_row_query($query); |
|
196 | - } |
|
195 | + return self::run_row_query($query); |
|
196 | + } |
|
197 | 197 | |
198 | 198 | public static function getById($log) |
199 | 199 | { |
@@ -117,6 +117,9 @@ |
||
117 | 117 | return self::run_query($query); |
118 | 118 | } |
119 | 119 | |
120 | + /** |
|
121 | + * @param string $alias |
|
122 | + */ |
|
120 | 123 | public static function getByOldAlias($alias) |
121 | 124 | { |
122 | 125 | $alias = self::escape($alias); |
@@ -43,9 +43,9 @@ discard block |
||
43 | 43 | return self::run_query($query); |
44 | 44 | } |
45 | 45 | |
46 | - public static function getMapList() |
|
47 | - { |
|
48 | - $query = " |
|
46 | + public static function getMapList() |
|
47 | + { |
|
48 | + $query = " |
|
49 | 49 | SELECT |
50 | 50 | `waterfall`.`name`, |
51 | 51 | `waterfall`.`alias`, |
@@ -71,8 +71,8 @@ discard block |
||
71 | 71 | ORDER BY |
72 | 72 | `waterfall`.`name`"; |
73 | 73 | |
74 | - return self::run_query($query); |
|
75 | - } |
|
74 | + return self::run_query($query); |
|
75 | + } |
|
76 | 76 | |
77 | 77 | public static function getListCount() |
78 | 78 | { |
@@ -92,9 +92,9 @@ discard block |
||
92 | 92 | return self::get_count($query); |
93 | 93 | } |
94 | 94 | |
95 | - public static function getNearbyList($waterfall) |
|
96 | - { |
|
97 | - $query = " |
|
95 | + public static function getNearbyList($waterfall) |
|
96 | + { |
|
97 | + $query = " |
|
98 | 98 | SELECT |
99 | 99 | `waterfall`.`name`, |
100 | 100 | `waterfall`.`alias` AS `alias`, |
@@ -114,14 +114,14 @@ discard block |
||
114 | 114 | `waterfall`.`name`, |
115 | 115 | `watercourse`.`name`"; |
116 | 116 | |
117 | - return self::run_query($query); |
|
118 | - } |
|
117 | + return self::run_query($query); |
|
118 | + } |
|
119 | 119 | |
120 | - public static function getByOldAlias($alias) |
|
121 | - { |
|
122 | - $alias = self::escape($alias); |
|
120 | + public static function getByOldAlias($alias) |
|
121 | + { |
|
122 | + $alias = self::escape($alias); |
|
123 | 123 | |
124 | - $query = " |
|
124 | + $query = " |
|
125 | 125 | SELECT |
126 | 126 | `waterfall`.`alias`, |
127 | 127 | `watercourse`.`alias` AS `watercourse_alias` |
@@ -134,8 +134,8 @@ discard block |
||
134 | 134 | `waterfall`.`is_public` = '1' |
135 | 135 | LIMIT 1"; |
136 | 136 | |
137 | - return self::run_row_query($query); |
|
138 | - } |
|
137 | + return self::run_row_query($query); |
|
138 | + } |
|
139 | 139 | |
140 | 140 | public static function getByAlias($watercourse, $waterfall) |
141 | 141 | { |
@@ -97,6 +97,9 @@ |
||
97 | 97 | return $tag_array; |
98 | 98 | } |
99 | 99 | |
100 | + /** |
|
101 | + * @param boolean $trim |
|
102 | + */ |
|
100 | 103 | final private function get_body_for_post($post, $trim) |
101 | 104 | { |
102 | 105 | $body = $post->body; |
@@ -86,7 +86,7 @@ |
||
86 | 86 | Loader::load('collector', 'blog/TagCollector'); |
87 | 87 | |
88 | 88 | $tag_result = TagCollector::getTagsForPost($post->id); |
89 | - $tag_array = array(); |
|
89 | + $tag_array = array(); |
|
90 | 90 | foreach($tag_result as $tag) |
91 | 91 | { |
92 | 92 | $tag_object = new stdclass(); |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | Loader::load('collector', 'image/PhotoCollector'); |
38 | 38 | $photo_result = PhotoCollector::getRow($id); |
39 | 39 | |
40 | - if($photo_result == null) |
|
40 | + if ($photo_result == null) |
|
41 | 41 | return; |
42 | 42 | |
43 | 43 | $name = $photo_result->name; |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | |
88 | 88 | $tag_result = TagCollector::getTagsForPost($post->id); |
89 | 89 | $tag_array = array(); |
90 | - foreach($tag_result as $tag) |
|
90 | + foreach ($tag_result as $tag) |
|
91 | 91 | { |
92 | 92 | $tag_object = new stdclass(); |
93 | 93 | $tag_object->name = $tag->tag; |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | { |
102 | 102 | $body = $post->body; |
103 | 103 | |
104 | - if($trim) |
|
104 | + if ($trim) |
|
105 | 105 | $body = Content::instance('SmartTrim', $body)->activate(self::$LENGTH_OF_TRIMMED_POST); |
106 | 106 | |
107 | 107 | $body = Content::instance('FixPhoto', $body)->activate(false, 'standard'); |
@@ -126,9 +126,9 @@ discard block |
||
126 | 126 | $maximum_tag_count = $this->get_maximum_tag_count($tag_result); |
127 | 127 | |
128 | 128 | $cloud_array = array(); |
129 | - foreach($tag_result as $tag) |
|
129 | + foreach ($tag_result as $tag) |
|
130 | 130 | { |
131 | - if($tag->tag_count < self::$MINIMUM_TAG_COUNT) |
|
131 | + if ($tag->tag_count < self::$MINIMUM_TAG_COUNT) |
|
132 | 132 | continue; |
133 | 133 | |
134 | 134 | $tag_object = new stdclass(); |
@@ -145,9 +145,9 @@ discard block |
||
145 | 145 | { |
146 | 146 | $maximum = 1; |
147 | 147 | |
148 | - foreach($tag_result as $tag) |
|
148 | + foreach ($tag_result as $tag) |
|
149 | 149 | { |
150 | - if($tag->tag_count > $maximum) |
|
150 | + if ($tag->tag_count > $maximum) |
|
151 | 151 | $maximum = $tag->tag_count; |
152 | 152 | } |
153 | 153 | return $maximum; |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | $comment_array = CommentCollector::getRecentBlogComments(self::$RECENT_COMMENT_COUNT); |
159 | 159 | |
160 | 160 | $array = array(); |
161 | - foreach($comment_array as $comment) |
|
161 | + foreach ($comment_array as $comment) |
|
162 | 162 | { |
163 | 163 | $body = $comment->body; |
164 | 164 | $body = strip_tags($body); |
@@ -37,8 +37,9 @@ discard block |
||
37 | 37 | Loader::load('collector', 'image/PhotoCollector'); |
38 | 38 | $photo_result = PhotoCollector::getRow($id); |
39 | 39 | |
40 | - if($photo_result == null) |
|
41 | - return; |
|
40 | + if($photo_result == null) { |
|
41 | + return; |
|
42 | + } |
|
42 | 43 | |
43 | 44 | $name = $photo_result->name; |
44 | 45 | $category = $photo_result->category; |
@@ -101,8 +102,9 @@ discard block |
||
101 | 102 | { |
102 | 103 | $body = $post->body; |
103 | 104 | |
104 | - if($trim) |
|
105 | - $body = Content::instance('SmartTrim', $body)->activate(self::$LENGTH_OF_TRIMMED_POST); |
|
105 | + if($trim) { |
|
106 | + $body = Content::instance('SmartTrim', $body)->activate(self::$LENGTH_OF_TRIMMED_POST); |
|
107 | + } |
|
106 | 108 | |
107 | 109 | $body = Content::instance('FixPhoto', $body)->activate(false, 'standard'); |
108 | 110 | $body = Content::instance('MarkupCode', $body)->activate(); |
@@ -128,8 +130,9 @@ discard block |
||
128 | 130 | $cloud_array = array(); |
129 | 131 | foreach($tag_result as $tag) |
130 | 132 | { |
131 | - if($tag->tag_count < self::$MINIMUM_TAG_COUNT) |
|
132 | - continue; |
|
133 | + if($tag->tag_count < self::$MINIMUM_TAG_COUNT) { |
|
134 | + continue; |
|
135 | + } |
|
133 | 136 | |
134 | 137 | $tag_object = new stdclass(); |
135 | 138 | $tag_object->name = $tag->tag; |
@@ -147,8 +150,9 @@ discard block |
||
147 | 150 | |
148 | 151 | foreach($tag_result as $tag) |
149 | 152 | { |
150 | - if($tag->tag_count > $maximum) |
|
151 | - $maximum = $tag->tag_count; |
|
153 | + if($tag->tag_count > $maximum) { |
|
154 | + $maximum = $tag->tag_count; |
|
155 | + } |
|
152 | 156 | } |
153 | 157 | return $maximum; |
154 | 158 | } |
@@ -204,6 +204,9 @@ discard block |
||
204 | 204 | exit; |
205 | 205 | } |
206 | 206 | |
207 | + /** |
|
208 | + * @param string $method |
|
209 | + */ |
|
207 | 210 | protected function set_header_method($method) |
208 | 211 | { |
209 | 212 | $this->headers = $method; |
@@ -214,6 +217,9 @@ discard block |
||
214 | 217 | $this->set_head('title', $value); |
215 | 218 | } |
216 | 219 | |
220 | + /** |
|
221 | + * @param string $value |
|
222 | + */ |
|
217 | 223 | protected function set_author($value) |
218 | 224 | { |
219 | 225 | $this->set_head('author', $value); |
@@ -229,26 +235,41 @@ discard block |
||
229 | 235 | $this->set_head('keywords', implode(', ', $array)); |
230 | 236 | } |
231 | 237 | |
238 | + /** |
|
239 | + * @param string $url |
|
240 | + */ |
|
232 | 241 | protected function set_canonical($url) |
233 | 242 | { |
234 | 243 | $this->set_head('canonical', $url); |
235 | 244 | } |
236 | 245 | |
246 | + /** |
|
247 | + * @param string $set |
|
248 | + */ |
|
237 | 249 | protected function set_head($set, $value) |
238 | 250 | { |
239 | 251 | $this->data_array['head'][$set] = $value; |
240 | 252 | } |
241 | 253 | |
254 | + /** |
|
255 | + * @param string $set |
|
256 | + */ |
|
242 | 257 | protected function set_body($set, $value) |
243 | 258 | { |
244 | 259 | $this->data_array['body'][$set] = $value; |
245 | 260 | } |
246 | 261 | |
262 | + /** |
|
263 | + * @param string $file |
|
264 | + */ |
|
247 | 265 | protected function add_css($file) |
248 | 266 | { |
249 | 267 | $this->css_array[] = $file; |
250 | 268 | } |
251 | 269 | |
270 | + /** |
|
271 | + * @param string $file |
|
272 | + */ |
|
252 | 273 | protected function add_js($file) |
253 | 274 | { |
254 | 275 | $this->js_array[] = $file; |
@@ -271,6 +292,9 @@ discard block |
||
271 | 292 | $this->set_head('js_link_array', $js_array); |
272 | 293 | } |
273 | 294 | |
295 | + /** |
|
296 | + * @param string $view |
|
297 | + */ |
|
274 | 298 | protected function set_body_view($view) |
275 | 299 | { |
276 | 300 | $this->body_view_array[] = $view; |
@@ -315,6 +339,10 @@ discard block |
||
315 | 339 | } |
316 | 340 | |
317 | 341 | private $comment_errors; |
342 | + |
|
343 | + /** |
|
344 | + * @param string $redirect_url |
|
345 | + */ |
|
318 | 346 | protected function handle_comment_submit($site_id, $path, $redirect_url, $page_title) |
319 | 347 | { |
320 | 348 | if(Request::hasPost() && Request::getPost('submit') == 'Submit Comment') |
@@ -125,9 +125,9 @@ discard block |
||
125 | 125 | if(strlen($row->title) > 0) |
126 | 126 | $post->title .= " I was hiking up around the {$row->title} area."; |
127 | 127 | } |
128 | - else if ($row->type == 'walking') { |
|
129 | - $post->title = "Walked {$row->distance} miles and felt {$row->felt}."; |
|
130 | - } |
|
128 | + else if ($row->type == 'walking') { |
|
129 | + $post->title = "Walked {$row->distance} miles and felt {$row->felt}."; |
|
130 | + } |
|
131 | 131 | break; |
132 | 132 | case 'hulu' : |
133 | 133 | $row = HuluCollector::getRow($raw_post->type_id); |
@@ -194,11 +194,11 @@ discard block |
||
194 | 194 | Loader::load('view', URLDecode::getSite() . '/' . $view, $this->data_array['body']); |
195 | 195 | } |
196 | 196 | |
197 | - if (URLDecode::getSite() == 'waterfalls') { |
|
198 | - Loader::load('view', '/WaterfallFoot'); |
|
199 | - } else { |
|
200 | - Loader::load('view', '/Foot', array('tracking_code' => self::$TRACKING_CODE)); |
|
201 | - } |
|
197 | + if (URLDecode::getSite() == 'waterfalls') { |
|
198 | + Loader::load('view', '/WaterfallFoot'); |
|
199 | + } else { |
|
200 | + Loader::load('view', '/Foot', array('tracking_code' => self::$TRACKING_CODE)); |
|
201 | + } |
|
202 | 202 | |
203 | 203 | if($view == '/404' || $view == '/503') |
204 | 204 | exit; |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | 'date' => date('Y'))); |
41 | 41 | |
42 | 42 | Loader::loadInstance('utility', 'Database'); |
43 | - if(Database::isConnected() === false) |
|
43 | + if (Database::isConnected() === false) |
|
44 | 44 | $this->unavailable(); |
45 | 45 | } |
46 | 46 | |
@@ -65,9 +65,9 @@ discard block |
||
65 | 65 | $post_array = array(); |
66 | 66 | $post_result = ActivityCollector::getRecent(); |
67 | 67 | |
68 | - foreach($post_result as $row) |
|
68 | + foreach ($post_result as $row) |
|
69 | 69 | { |
70 | - $post_array[] = $this->expand_post($row);; |
|
70 | + $post_array[] = $this->expand_post($row); ; |
|
71 | 71 | } |
72 | 72 | |
73 | 73 | return $post_array; |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | |
87 | 87 | $post = new stdclass(); |
88 | 88 | |
89 | - switch($raw_post->type) |
|
89 | + switch ($raw_post->type) |
|
90 | 90 | { |
91 | 91 | case 'blog' : |
92 | 92 | $row = BlogCollector::getRow($raw_post->type_id); |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | $post->title = "Blogged about {$category}: <a href=\"{$row->url}\">{$row->title}</a>."; |
98 | 98 | $post->comments = $row->comments; |
99 | 99 | |
100 | - if($format == 'full') |
|
100 | + if ($format == 'full') |
|
101 | 101 | $post->image = Content::instance('FetchFirstPhoto', $row->body)->activate(false, 'standard'); |
102 | 102 | break; |
103 | 103 | case 'book' : |
@@ -106,23 +106,23 @@ discard block |
||
106 | 106 | $post->type = 'book'; |
107 | 107 | $post->title = "Just finished reading {$row->title} by {$row->author}."; |
108 | 108 | |
109 | - if($format == 'full') |
|
109 | + if ($format == 'full') |
|
110 | 110 | $post->image = "<img alt=\"{$row->title} by {$row->author}\" src=\"{$row->image}\" />"; |
111 | 111 | break; |
112 | 112 | case 'distance' : |
113 | 113 | $row = DistanceCollector::getRow($raw_post->type_id); |
114 | 114 | |
115 | 115 | $post->type = 'distance'; |
116 | - if($row->type == 'running') |
|
116 | + if ($row->type == 'running') |
|
117 | 117 | { |
118 | 118 | $post->title = "Ran {$row->distance} miles and felt {$row->felt}."; |
119 | - if(strlen($row->message) > 0) |
|
119 | + if (strlen($row->message) > 0) |
|
120 | 120 | $post->title .= " Afterwards, I was all like '{$row->message}'."; |
121 | 121 | } |
122 | - else if($row->type == 'hiking') |
|
122 | + else if ($row->type == 'hiking') |
|
123 | 123 | { |
124 | 124 | $post->title = "Hiked {$row->distance} miles and felt {$row->felt}."; |
125 | - if(strlen($row->title) > 0) |
|
125 | + if (strlen($row->title) > 0) |
|
126 | 126 | $post->title .= " I was hiking up around the {$row->title} area."; |
127 | 127 | } |
128 | 128 | else if ($row->type == 'walking') { |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | |
141 | 141 | $post->type = 'twitter'; |
142 | 142 | |
143 | - if($format == 'full') |
|
143 | + if ($format == 'full') |
|
144 | 144 | $post->title = $row->text_formatted_full; |
145 | 145 | else |
146 | 146 | $post->title = $row->text_formatted; |
@@ -153,12 +153,12 @@ discard block |
||
153 | 153 | |
154 | 154 | $post->type = 'youtube'; |
155 | 155 | |
156 | - if($format == 'full') |
|
156 | + if ($format == 'full') |
|
157 | 157 | $post->title = "Favorited {$row->title} by {$row->author} on YouTube."; |
158 | 158 | else |
159 | 159 | $post->title = "Favorited <a href=\"http://www.youtube.com/watch?feature=player_embedded&v={$row->video_id}\" rel=\"nofollow\" target=\"_blank\" title=\"{$row->content}\">{$row->title}</a> by {$row->author} on YouTube."; |
160 | 160 | |
161 | - if($format == 'full') |
|
161 | + if ($format == 'full') |
|
162 | 162 | $post->embed_code = "<iframe src=\"http://www.youtube.com/embed/{$row->video_id}?rel=0\" frameborder=\"0\" allowfullscreen></iframe>"; |
163 | 163 | break; |
164 | 164 | } |
@@ -186,9 +186,9 @@ discard block |
||
186 | 186 | $headers = $this->headers; |
187 | 187 | Header::$headers(); |
188 | 188 | Loader::load('view', '/Head', $this->data_array['head']); |
189 | - foreach($this->body_view_array as $view) |
|
189 | + foreach ($this->body_view_array as $view) |
|
190 | 190 | { |
191 | - if(substr($view, 0, 1) == '/') |
|
191 | + if (substr($view, 0, 1) == '/') |
|
192 | 192 | Loader::load('view', $view, $this->data_array['body']); |
193 | 193 | else |
194 | 194 | Loader::load('view', URLDecode::getSite() . '/' . $view, $this->data_array['body']); |
@@ -200,7 +200,7 @@ discard block |
||
200 | 200 | Loader::load('view', '/Foot', array('tracking_code' => self::$TRACKING_CODE)); |
201 | 201 | } |
202 | 202 | |
203 | - if($view == '/404' || $view == '/503') |
|
203 | + if ($view == '/404' || $view == '/503') |
|
204 | 204 | exit; |
205 | 205 | } |
206 | 206 | |
@@ -261,10 +261,10 @@ discard block |
||
261 | 261 | |
262 | 262 | $js_array = array(); |
263 | 263 | |
264 | - if(count($this->js_array) > 0) |
|
264 | + if (count($this->js_array) > 0) |
|
265 | 265 | $js_array = array_merge($js_array, $this->js_array); |
266 | 266 | |
267 | - if(count($js_array) > 0) |
|
267 | + if (count($js_array) > 0) |
|
268 | 268 | $js_array = Asset::getJS($js_array); |
269 | 269 | |
270 | 270 | $this->set_head('css_link_array', $css_array); |
@@ -278,26 +278,26 @@ discard block |
||
278 | 278 | |
279 | 279 | protected function eject() |
280 | 280 | { |
281 | - if(get_class($this) !== 'Error404Controller') |
|
281 | + if (get_class($this) !== 'Error404Controller') |
|
282 | 282 | Loader::loadNew('controller', '/Error404Controller')->activate(); |
283 | 283 | } |
284 | 284 | |
285 | 285 | protected function unavailable() |
286 | 286 | { |
287 | - if(get_class($this) !== 'Error503Controller') |
|
287 | + if (get_class($this) !== 'Error503Controller') |
|
288 | 288 | Loader::loadNew('controller', '/Error503Controller')->activate(); |
289 | 289 | } |
290 | 290 | |
291 | 291 | protected function redirect($uri, $method = 301) |
292 | 292 | { |
293 | - switch($method) |
|
293 | + switch ($method) |
|
294 | 294 | { |
295 | 295 | case 301 : |
296 | - if(get_class($this) !== 'Error301Controller') |
|
296 | + if (get_class($this) !== 'Error301Controller') |
|
297 | 297 | Loader::loadNew('controller', '/Error301Controller', array($uri))->activate(); |
298 | 298 | break; |
299 | 299 | case 303 : |
300 | - if(get_class($this) !== 'Error303Controller') |
|
300 | + if (get_class($this) !== 'Error303Controller') |
|
301 | 301 | Loader::loadNew('controller', '/Error303Controller', array($uri))->activate(); |
302 | 302 | break; |
303 | 303 | } |
@@ -317,7 +317,7 @@ discard block |
||
317 | 317 | private $comment_errors; |
318 | 318 | protected function handle_comment_submit($site_id, $path, $redirect_url, $page_title) |
319 | 319 | { |
320 | - if(Request::hasPost() && Request::getPost('submit') == 'Submit Comment') |
|
320 | + if (Request::hasPost() && Request::getPost('submit') == 'Submit Comment') |
|
321 | 321 | { |
322 | 322 | $parameters = array($site_id, $path, $redirect_url, $page_title); |
323 | 323 | $this->comment_errors = Loader::loadNew('module', 'form/CommentSubmitModule', $parameters)->activate(); |
@@ -335,7 +335,7 @@ discard block |
||
335 | 335 | $comment_array = array(); |
336 | 336 | $comment_result = CommentCollector::getCommentsForURL($site, $path, $commenter->id); |
337 | 337 | |
338 | - foreach($comment_result as $comment) |
|
338 | + foreach ($comment_result as $comment) |
|
339 | 339 | { |
340 | 340 | $comment_object = new stdclass(); |
341 | 341 | $comment_object->id = $comment->id; |
@@ -345,12 +345,12 @@ discard block |
||
345 | 345 | $comment_object->url = $comment->url; |
346 | 346 | $comment_object->trusted = $comment->trusted; |
347 | 347 | |
348 | - if($comment->reply == 0 && Request::getPost('type') == $comment->id) |
|
348 | + if ($comment->reply == 0 && Request::getPost('type') == $comment->id) |
|
349 | 349 | $comment_object->errors = $this->comment_errors; |
350 | 350 | else |
351 | 351 | $comment_object->errors = array(); |
352 | 352 | |
353 | - if($comment->reply == 0) |
|
353 | + if ($comment->reply == 0) |
|
354 | 354 | { |
355 | 355 | $comment_object->replies = array(); |
356 | 356 | $comment_array[$comment->id] = $comment_object; |
@@ -381,21 +381,21 @@ discard block |
||
381 | 381 | $commenter->website = ''; |
382 | 382 | |
383 | 383 | $commenter_cookie = Cookie::instance('Commenter'); |
384 | - if(!$commenter_cookie->exists()) |
|
384 | + if (!$commenter_cookie->exists()) |
|
385 | 385 | return $commenter; |
386 | 386 | |
387 | 387 | $commenter_cookie_value = $commenter_cookie->getValue(); |
388 | 388 | $commenter_cookie_value = json_decode($commenter_cookie_value); |
389 | 389 | |
390 | - if($commenter_cookie_value === NULL) |
|
390 | + if ($commenter_cookie_value === NULL) |
|
391 | 391 | return $commenter; |
392 | 392 | |
393 | - if(!isset($commenter_cookie_value->name) || !isset($commenter_cookie_value->email)) |
|
393 | + if (!isset($commenter_cookie_value->name) || !isset($commenter_cookie_value->email)) |
|
394 | 394 | return $commenter; |
395 | 395 | |
396 | 396 | $commenter_object = CommentCollector::getCommenterByFields($commenter_cookie_value->name, $commenter_cookie_value->email, (isset($commenter_cookie_value->website) ? $commenter_cookie_value->website : '')); |
397 | 397 | |
398 | - if($commenter_object === NULL) |
|
398 | + if ($commenter_object === NULL) |
|
399 | 399 | return $commenter; |
400 | 400 | |
401 | 401 | $commenter->id = $commenter_object->id; |
@@ -40,8 +40,9 @@ discard block |
||
40 | 40 | 'date' => date('Y'))); |
41 | 41 | |
42 | 42 | Loader::loadInstance('utility', 'Database'); |
43 | - if(Database::isConnected() === false) |
|
44 | - $this->unavailable(); |
|
43 | + if(Database::isConnected() === false) { |
|
44 | + $this->unavailable(); |
|
45 | + } |
|
45 | 46 | } |
46 | 47 | |
47 | 48 | protected function get_domain_container() |
@@ -97,8 +98,9 @@ discard block |
||
97 | 98 | $post->title = "Blogged about {$category}: <a href=\"{$row->url}\">{$row->title}</a>."; |
98 | 99 | $post->comments = $row->comments; |
99 | 100 | |
100 | - if($format == 'full') |
|
101 | - $post->image = Content::instance('FetchFirstPhoto', $row->body)->activate(false, 'standard'); |
|
101 | + if($format == 'full') { |
|
102 | + $post->image = Content::instance('FetchFirstPhoto', $row->body)->activate(false, 'standard'); |
|
103 | + } |
|
102 | 104 | break; |
103 | 105 | case 'book' : |
104 | 106 | $row = BookCollector::getRow($raw_post->type_id); |
@@ -106,8 +108,9 @@ discard block |
||
106 | 108 | $post->type = 'book'; |
107 | 109 | $post->title = "Just finished reading {$row->title} by {$row->author}."; |
108 | 110 | |
109 | - if($format == 'full') |
|
110 | - $post->image = "<img alt=\"{$row->title} by {$row->author}\" src=\"{$row->image}\" />"; |
|
111 | + if($format == 'full') { |
|
112 | + $post->image = "<img alt=\"{$row->title} by {$row->author}\" src=\"{$row->image}\" />"; |
|
113 | + } |
|
111 | 114 | break; |
112 | 115 | case 'distance' : |
113 | 116 | $row = DistanceCollector::getRow($raw_post->type_id); |
@@ -116,16 +119,16 @@ discard block |
||
116 | 119 | if($row->type == 'running') |
117 | 120 | { |
118 | 121 | $post->title = "Ran {$row->distance} miles and felt {$row->felt}."; |
119 | - if(strlen($row->message) > 0) |
|
120 | - $post->title .= " Afterwards, I was all like '{$row->message}'."; |
|
121 | - } |
|
122 | - else if($row->type == 'hiking') |
|
122 | + if(strlen($row->message) > 0) { |
|
123 | + $post->title .= " Afterwards, I was all like '{$row->message}'."; |
|
124 | + } |
|
125 | + } else if($row->type == 'hiking') |
|
123 | 126 | { |
124 | 127 | $post->title = "Hiked {$row->distance} miles and felt {$row->felt}."; |
125 | - if(strlen($row->title) > 0) |
|
126 | - $post->title .= " I was hiking up around the {$row->title} area."; |
|
127 | - } |
|
128 | - else if ($row->type == 'walking') { |
|
128 | + if(strlen($row->title) > 0) { |
|
129 | + $post->title .= " I was hiking up around the {$row->title} area."; |
|
130 | + } |
|
131 | + } else if ($row->type == 'walking') { |
|
129 | 132 | $post->title = "Walked {$row->distance} miles and felt {$row->felt}."; |
130 | 133 | } |
131 | 134 | break; |
@@ -140,10 +143,11 @@ discard block |
||
140 | 143 | |
141 | 144 | $post->type = 'twitter'; |
142 | 145 | |
143 | - if($format == 'full') |
|
144 | - $post->title = $row->text_formatted_full; |
|
145 | - else |
|
146 | - $post->title = $row->text_formatted; |
|
146 | + if($format == 'full') { |
|
147 | + $post->title = $row->text_formatted_full; |
|
148 | + } else { |
|
149 | + $post->title = $row->text_formatted; |
|
150 | + } |
|
147 | 151 | |
148 | 152 | $post->retweets = ($row->is_retweet == 0) ? $row->retweets : 0; |
149 | 153 | $post->favorites = ($row->is_retweet == 0) ? $row->favorites : 0; |
@@ -153,13 +157,15 @@ discard block |
||
153 | 157 | |
154 | 158 | $post->type = 'youtube'; |
155 | 159 | |
156 | - if($format == 'full') |
|
157 | - $post->title = "Favorited {$row->title} by {$row->author} on YouTube."; |
|
158 | - else |
|
159 | - $post->title = "Favorited <a href=\"http://www.youtube.com/watch?feature=player_embedded&v={$row->video_id}\" rel=\"nofollow\" target=\"_blank\" title=\"{$row->content}\">{$row->title}</a> by {$row->author} on YouTube."; |
|
160 | + if($format == 'full') { |
|
161 | + $post->title = "Favorited {$row->title} by {$row->author} on YouTube."; |
|
162 | + } else { |
|
163 | + $post->title = "Favorited <a href=\"http://www.youtube.com/watch?feature=player_embedded&v={$row->video_id}\" rel=\"nofollow\" target=\"_blank\" title=\"{$row->content}\">{$row->title}</a> by {$row->author} on YouTube."; |
|
164 | + } |
|
160 | 165 | |
161 | - if($format == 'full') |
|
162 | - $post->embed_code = "<iframe src=\"http://www.youtube.com/embed/{$row->video_id}?rel=0\" frameborder=\"0\" allowfullscreen></iframe>"; |
|
166 | + if($format == 'full') { |
|
167 | + $post->embed_code = "<iframe src=\"http://www.youtube.com/embed/{$row->video_id}?rel=0\" frameborder=\"0\" allowfullscreen></iframe>"; |
|
168 | + } |
|
163 | 169 | break; |
164 | 170 | } |
165 | 171 | |
@@ -188,10 +194,11 @@ discard block |
||
188 | 194 | Loader::load('view', '/Head', $this->data_array['head']); |
189 | 195 | foreach($this->body_view_array as $view) |
190 | 196 | { |
191 | - if(substr($view, 0, 1) == '/') |
|
192 | - Loader::load('view', $view, $this->data_array['body']); |
|
193 | - else |
|
194 | - Loader::load('view', URLDecode::getSite() . '/' . $view, $this->data_array['body']); |
|
197 | + if(substr($view, 0, 1) == '/') { |
|
198 | + Loader::load('view', $view, $this->data_array['body']); |
|
199 | + } else { |
|
200 | + Loader::load('view', URLDecode::getSite() . '/' . $view, $this->data_array['body']); |
|
201 | + } |
|
195 | 202 | } |
196 | 203 | |
197 | 204 | if (URLDecode::getSite() == 'waterfalls') { |
@@ -200,8 +207,9 @@ discard block |
||
200 | 207 | Loader::load('view', '/Foot', array('tracking_code' => self::$TRACKING_CODE)); |
201 | 208 | } |
202 | 209 | |
203 | - if($view == '/404' || $view == '/503') |
|
204 | - exit; |
|
210 | + if($view == '/404' || $view == '/503') { |
|
211 | + exit; |
|
212 | + } |
|
205 | 213 | } |
206 | 214 | |
207 | 215 | protected function set_header_method($method) |
@@ -261,11 +269,13 @@ discard block |
||
261 | 269 | |
262 | 270 | $js_array = array(); |
263 | 271 | |
264 | - if(count($this->js_array) > 0) |
|
265 | - $js_array = array_merge($js_array, $this->js_array); |
|
272 | + if(count($this->js_array) > 0) { |
|
273 | + $js_array = array_merge($js_array, $this->js_array); |
|
274 | + } |
|
266 | 275 | |
267 | - if(count($js_array) > 0) |
|
268 | - $js_array = Asset::getJS($js_array); |
|
276 | + if(count($js_array) > 0) { |
|
277 | + $js_array = Asset::getJS($js_array); |
|
278 | + } |
|
269 | 279 | |
270 | 280 | $this->set_head('css_link_array', $css_array); |
271 | 281 | $this->set_head('js_link_array', $js_array); |
@@ -278,14 +288,16 @@ discard block |
||
278 | 288 | |
279 | 289 | protected function eject() |
280 | 290 | { |
281 | - if(get_class($this) !== 'Error404Controller') |
|
282 | - Loader::loadNew('controller', '/Error404Controller')->activate(); |
|
291 | + if(get_class($this) !== 'Error404Controller') { |
|
292 | + Loader::loadNew('controller', '/Error404Controller')->activate(); |
|
293 | + } |
|
283 | 294 | } |
284 | 295 | |
285 | 296 | protected function unavailable() |
286 | 297 | { |
287 | - if(get_class($this) !== 'Error503Controller') |
|
288 | - Loader::loadNew('controller', '/Error503Controller')->activate(); |
|
298 | + if(get_class($this) !== 'Error503Controller') { |
|
299 | + Loader::loadNew('controller', '/Error503Controller')->activate(); |
|
300 | + } |
|
289 | 301 | } |
290 | 302 | |
291 | 303 | protected function redirect($uri, $method = 301) |
@@ -293,12 +305,14 @@ discard block |
||
293 | 305 | switch($method) |
294 | 306 | { |
295 | 307 | case 301 : |
296 | - if(get_class($this) !== 'Error301Controller') |
|
297 | - Loader::loadNew('controller', '/Error301Controller', array($uri))->activate(); |
|
308 | + if(get_class($this) !== 'Error301Controller') { |
|
309 | + Loader::loadNew('controller', '/Error301Controller', array($uri))->activate(); |
|
310 | + } |
|
298 | 311 | break; |
299 | 312 | case 303 : |
300 | - if(get_class($this) !== 'Error303Controller') |
|
301 | - Loader::loadNew('controller', '/Error303Controller', array($uri))->activate(); |
|
313 | + if(get_class($this) !== 'Error303Controller') { |
|
314 | + Loader::loadNew('controller', '/Error303Controller', array($uri))->activate(); |
|
315 | + } |
|
302 | 316 | break; |
303 | 317 | } |
304 | 318 | } |
@@ -345,18 +359,19 @@ discard block |
||
345 | 359 | $comment_object->url = $comment->url; |
346 | 360 | $comment_object->trusted = $comment->trusted; |
347 | 361 | |
348 | - if($comment->reply == 0 && Request::getPost('type') == $comment->id) |
|
349 | - $comment_object->errors = $this->comment_errors; |
|
350 | - else |
|
351 | - $comment_object->errors = array(); |
|
362 | + if($comment->reply == 0 && Request::getPost('type') == $comment->id) { |
|
363 | + $comment_object->errors = $this->comment_errors; |
|
364 | + } else { |
|
365 | + $comment_object->errors = array(); |
|
366 | + } |
|
352 | 367 | |
353 | 368 | if($comment->reply == 0) |
354 | 369 | { |
355 | 370 | $comment_object->replies = array(); |
356 | 371 | $comment_array[$comment->id] = $comment_object; |
372 | + } else { |
|
373 | + $comment_array[$comment->reply]->replies[$comment->id] = $comment_object; |
|
357 | 374 | } |
358 | - else |
|
359 | - $comment_array[$comment->reply]->replies[$comment->id] = $comment_object; |
|
360 | 375 | } |
361 | 376 | |
362 | 377 | $comment_count = CommentCollector::getCommentCountForURL($site, $path); |
@@ -381,22 +396,26 @@ discard block |
||
381 | 396 | $commenter->website = ''; |
382 | 397 | |
383 | 398 | $commenter_cookie = Cookie::instance('Commenter'); |
384 | - if(!$commenter_cookie->exists()) |
|
385 | - return $commenter; |
|
399 | + if(!$commenter_cookie->exists()) { |
|
400 | + return $commenter; |
|
401 | + } |
|
386 | 402 | |
387 | 403 | $commenter_cookie_value = $commenter_cookie->getValue(); |
388 | 404 | $commenter_cookie_value = json_decode($commenter_cookie_value); |
389 | 405 | |
390 | - if($commenter_cookie_value === NULL) |
|
391 | - return $commenter; |
|
406 | + if($commenter_cookie_value === NULL) { |
|
407 | + return $commenter; |
|
408 | + } |
|
392 | 409 | |
393 | - if(!isset($commenter_cookie_value->name) || !isset($commenter_cookie_value->email)) |
|
394 | - return $commenter; |
|
410 | + if(!isset($commenter_cookie_value->name) || !isset($commenter_cookie_value->email)) { |
|
411 | + return $commenter; |
|
412 | + } |
|
395 | 413 | |
396 | 414 | $commenter_object = CommentCollector::getCommenterByFields($commenter_cookie_value->name, $commenter_cookie_value->email, (isset($commenter_cookie_value->website) ? $commenter_cookie_value->website : '')); |
397 | 415 | |
398 | - if($commenter_object === NULL) |
|
399 | - return $commenter; |
|
416 | + if($commenter_object === NULL) { |
|
417 | + return $commenter; |
|
418 | + } |
|
400 | 419 | |
401 | 420 | $commenter->id = $commenter_object->id; |
402 | 421 | $commenter->name = $commenter_object->name; |
@@ -38,6 +38,9 @@ |
||
38 | 38 | $this->entries[] = $entry; |
39 | 39 | } |
40 | 40 | |
41 | + /** |
|
42 | + * @param string $url |
|
43 | + */ |
|
41 | 44 | protected function disallow_for_all_robots($url = null) |
42 | 45 | { |
43 | 46 | $entry = new stdclass(); |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | { |
28 | 28 | $entry = new stdclass(); |
29 | 29 | $entry->agent = self::$ALL_ROBOTS; |
30 | - if($url) |
|
30 | + if ($url) |
|
31 | 31 | $entry->allow = $url; |
32 | 32 | else |
33 | 33 | { |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | { |
43 | 43 | $entry = new stdclass(); |
44 | 44 | $entry->agent = self::$ALL_ROBOTS; |
45 | - if($url) |
|
45 | + if ($url) |
|
46 | 46 | $entry->disallow = $url; |
47 | 47 | else |
48 | 48 | $entry->disallow = self::$ALL_URL; |
@@ -55,18 +55,18 @@ discard block |
||
55 | 55 | $this->set_data(); |
56 | 56 | Header::sendRobot(); |
57 | 57 | |
58 | - foreach($this->entries as $key => $entry) |
|
58 | + foreach ($this->entries as $key => $entry) |
|
59 | 59 | { |
60 | - if($key == 0) |
|
60 | + if ($key == 0) |
|
61 | 61 | echo "User-agent: {$entry->agent}\n"; |
62 | - if(isset($entry->disallow) && $entry->disallow != '') |
|
62 | + if (isset($entry->disallow) && $entry->disallow != '') |
|
63 | 63 | echo "Disallow: {$entry->disallow}\n"; |
64 | - if(isset($entry->allow)) |
|
64 | + if (isset($entry->allow)) |
|
65 | 65 | echo "Allow: {$entry->allow}\n"; |
66 | 66 | //echo "\n"; |
67 | 67 | } |
68 | 68 | |
69 | - if($this->show_sitemap) |
|
69 | + if ($this->show_sitemap) |
|
70 | 70 | { |
71 | 71 | echo "\n"; |
72 | 72 | $sitemap = URLDecode::getBase() . 'sitemap.xml'; |
@@ -27,9 +27,9 @@ discard block |
||
27 | 27 | { |
28 | 28 | $entry = new stdclass(); |
29 | 29 | $entry->agent = self::$ALL_ROBOTS; |
30 | - if($url) |
|
31 | - $entry->allow = $url; |
|
32 | - else |
|
30 | + if($url) { |
|
31 | + $entry->allow = $url; |
|
32 | + } else |
|
33 | 33 | { |
34 | 34 | $entry->disallow = ''; |
35 | 35 | $entry->allow = self::$ALL_URL; |
@@ -42,10 +42,11 @@ discard block |
||
42 | 42 | { |
43 | 43 | $entry = new stdclass(); |
44 | 44 | $entry->agent = self::$ALL_ROBOTS; |
45 | - if($url) |
|
46 | - $entry->disallow = $url; |
|
47 | - else |
|
48 | - $entry->disallow = self::$ALL_URL; |
|
45 | + if($url) { |
|
46 | + $entry->disallow = $url; |
|
47 | + } else { |
|
48 | + $entry->disallow = self::$ALL_URL; |
|
49 | + } |
|
49 | 50 | |
50 | 51 | $this->entries[] = $entry; |
51 | 52 | } |
@@ -57,12 +58,15 @@ discard block |
||
57 | 58 | |
58 | 59 | foreach($this->entries as $key => $entry) |
59 | 60 | { |
60 | - if($key == 0) |
|
61 | - echo "User-agent: {$entry->agent}\n"; |
|
62 | - if(isset($entry->disallow) && $entry->disallow != '') |
|
63 | - echo "Disallow: {$entry->disallow}\n"; |
|
64 | - if(isset($entry->allow)) |
|
65 | - echo "Allow: {$entry->allow}\n"; |
|
61 | + if($key == 0) { |
|
62 | + echo "User-agent: {$entry->agent}\n"; |
|
63 | + } |
|
64 | + if(isset($entry->disallow) && $entry->disallow != '') { |
|
65 | + echo "Disallow: {$entry->disallow}\n"; |
|
66 | + } |
|
67 | + if(isset($entry->allow)) { |
|
68 | + echo "Allow: {$entry->allow}\n"; |
|
69 | + } |
|
66 | 70 | //echo "\n"; |
67 | 71 | } |
68 | 72 |
@@ -18,6 +18,9 @@ discard block |
||
18 | 18 | Debugger::hide(); |
19 | 19 | } |
20 | 20 | |
21 | + /** |
|
22 | + * @param string $title |
|
23 | + */ |
|
21 | 24 | final protected function setTitle($title) |
22 | 25 | { |
23 | 26 | $this->xml->channel->addChild('title', $title); |
@@ -30,11 +33,17 @@ discard block |
||
30 | 33 | $this->xml->channel->addChild('link', $url); |
31 | 34 | } |
32 | 35 | |
36 | + /** |
|
37 | + * @param string $description |
|
38 | + */ |
|
33 | 39 | final protected function setDescription($description) |
34 | 40 | { |
35 | 41 | $this->xml->channel->addChild('description', $description); |
36 | 42 | } |
37 | 43 | |
44 | + /** |
|
45 | + * @param string $url |
|
46 | + */ |
|
38 | 47 | final protected function setAtom($url) |
39 | 48 | { |
40 | 49 | $atom = $this->xml->channel->addChild('link', '', 'http://www.w3.org/2005/Atom'); |
@@ -76,6 +85,9 @@ discard block |
||
76 | 85 | $this->xml->channel->addChild('ttl', $ttl); |
77 | 86 | } |
78 | 87 | |
88 | + /** |
|
89 | + * @param string $pubDate |
|
90 | + */ |
|
79 | 91 | final protected function addItem($title, $link, $description, $category, $pubDate) |
80 | 92 | { |
81 | 93 | $item = $this->xml->channel->addChild('item'); |
@@ -57,10 +57,10 @@ |
||
57 | 57 | |
58 | 58 | final protected function setWebMaster($webmaster = '') |
59 | 59 | { |
60 | - if ($webmaster == '') { |
|
61 | - global $config; |
|
62 | - $webmaster = "{$config->admin_email} (Jacob Emerick)"; |
|
63 | - } |
|
60 | + if ($webmaster == '') { |
|
61 | + global $config; |
|
62 | + $webmaster = "{$config->admin_email} (Jacob Emerick)"; |
|
63 | + } |
|
64 | 64 | $this->xml->channel->addChild('webMaster', $webmaster); |
65 | 65 | } |
66 | 66 |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | |
26 | 26 | final protected function setLink($url = null) |
27 | 27 | { |
28 | - if(!isset($url)) |
|
28 | + if (!isset($url)) |
|
29 | 29 | $url = URLDecode::getBase(); |
30 | 30 | $this->xml->channel->addChild('link', $url); |
31 | 31 | } |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | |
51 | 51 | final protected function setCopyright($copyright = null) |
52 | 52 | { |
53 | - if(!isset($copyright)) |
|
53 | + if (!isset($copyright)) |
|
54 | 54 | $copyright = 'Copyright ' . date('Y') . ' Jacob Emerick'; |
55 | 55 | $this->xml->channel->addChild('copyright', $copyright); |
56 | 56 | } |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | |
67 | 67 | final protected function setPubDate($date = null) |
68 | 68 | { |
69 | - if(!isset($date)) |
|
69 | + if (!isset($date)) |
|
70 | 70 | $date = date('r'); |
71 | 71 | $this->xml->channel->addChild('pubDate', $date); |
72 | 72 | } |
@@ -25,8 +25,9 @@ discard block |
||
25 | 25 | |
26 | 26 | final protected function setLink($url = null) |
27 | 27 | { |
28 | - if(!isset($url)) |
|
29 | - $url = URLDecode::getBase(); |
|
28 | + if(!isset($url)) { |
|
29 | + $url = URLDecode::getBase(); |
|
30 | + } |
|
30 | 31 | $this->xml->channel->addChild('link', $url); |
31 | 32 | } |
32 | 33 | |
@@ -50,8 +51,9 @@ discard block |
||
50 | 51 | |
51 | 52 | final protected function setCopyright($copyright = null) |
52 | 53 | { |
53 | - if(!isset($copyright)) |
|
54 | - $copyright = 'Copyright ' . date('Y') . ' Jacob Emerick'; |
|
54 | + if(!isset($copyright)) { |
|
55 | + $copyright = 'Copyright ' . date('Y') . ' Jacob Emerick'; |
|
56 | + } |
|
55 | 57 | $this->xml->channel->addChild('copyright', $copyright); |
56 | 58 | } |
57 | 59 | |
@@ -66,8 +68,9 @@ discard block |
||
66 | 68 | |
67 | 69 | final protected function setPubDate($date = null) |
68 | 70 | { |
69 | - if(!isset($date)) |
|
70 | - $date = date('r'); |
|
71 | + if(!isset($date)) { |
|
72 | + $date = date('r'); |
|
73 | + } |
|
71 | 74 | $this->xml->channel->addChild('pubDate', $date); |
72 | 75 | } |
73 | 76 |
@@ -83,6 +83,9 @@ |
||
83 | 83 | } |
84 | 84 | } |
85 | 85 | |
86 | + /** |
|
87 | + * @param string $changefreq |
|
88 | + */ |
|
86 | 89 | private function add_paginated_pages($post_count, $base_url, $changefreq, $rank) |
87 | 90 | { |
88 | 91 | switch($changefreq) |
@@ -9,19 +9,19 @@ discard block |
||
9 | 9 | final class BlogSitemapController extends SitemapController |
10 | 10 | { |
11 | 11 | |
12 | - private static $HOME_PAGE_RANK = .9; |
|
13 | - private static $CATEGORY_PAGE_RANK = .3; |
|
14 | - private static $TAG_PAGE_RANK = .2; |
|
15 | - private static $PAGINATED_PAGE_RANK = .1; |
|
16 | - private static $POST_PAGE_RANK = .8; |
|
12 | + private static $HOME_PAGE_RANK = .9; |
|
13 | + private static $CATEGORY_PAGE_RANK = .3; |
|
14 | + private static $TAG_PAGE_RANK = .2; |
|
15 | + private static $PAGINATED_PAGE_RANK = .1; |
|
16 | + private static $POST_PAGE_RANK = .8; |
|
17 | 17 | |
18 | 18 | private static $HOME_PAGE_CHANGEFREQ = 'daily'; |
19 | - private static $CATEGORY_PAGE_CHANGEFREQ = 'weekly'; |
|
19 | + private static $CATEGORY_PAGE_CHANGEFREQ = 'weekly'; |
|
20 | 20 | private static $TAG_PAGE_CHANGEFREQ = 'monthly'; |
21 | - private static $PAGINATED_PAGE_CHANGEFREQ = 'monthly'; |
|
21 | + private static $PAGINATED_PAGE_CHANGEFREQ = 'monthly'; |
|
22 | 22 | private static $POST_PAGE_CHANGEFREQ = 'weekly'; |
23 | 23 | |
24 | - private static $POSTS_PER_PAGE = 10; |
|
24 | + private static $POSTS_PER_PAGE = 10; |
|
25 | 25 | |
26 | 26 | private static $CATEGORY_ARRAY = array( |
27 | 27 | 'hiking', |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | { |
51 | 51 | $categories = self::$CATEGORY_ARRAY; |
52 | 52 | |
53 | - foreach($categories as $category) |
|
53 | + foreach ($categories as $category) |
|
54 | 54 | { |
55 | 55 | $post_count = PostCollector::getPostCountForCategory($category); |
56 | 56 | |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | { |
64 | 64 | $tags = TagCollector::getAllTags(); |
65 | 65 | |
66 | - foreach($tags as $tag) |
|
66 | + foreach ($tags as $tag) |
|
67 | 67 | { |
68 | 68 | $post_count = PostCollector::getPostCountForTag($tag->id); |
69 | 69 | |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | { |
77 | 77 | $posts = PostCollector::getMainList(500); |
78 | 78 | |
79 | - foreach($posts as $post) |
|
79 | + foreach ($posts as $post) |
|
80 | 80 | { |
81 | 81 | $base_url = "{$post->category}/{$post->path}/"; |
82 | 82 | $this->addURL($base_url, date('Y-m-d', strtotime('last Monday')), self::$POST_PAGE_CHANGEFREQ, self::$POST_PAGE_RANK); |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | |
86 | 86 | private function add_paginated_pages($post_count, $base_url, $changefreq, $rank) |
87 | 87 | { |
88 | - switch($changefreq) |
|
88 | + switch ($changefreq) |
|
89 | 89 | { |
90 | 90 | case 'daily' : |
91 | 91 | $lastmod = date('Y-m-d'); |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | } |
100 | 100 | |
101 | 101 | $this->addURL($base_url, $lastmod, $changefreq, $rank); |
102 | - for($i = 2; (($i - 1) * self::$POSTS_PER_PAGE) < $post_count; $i++) |
|
102 | + for ($i = 2; (($i - 1) * self::$POSTS_PER_PAGE) < $post_count; $i++) |
|
103 | 103 | { |
104 | 104 | $this->addURL("{$base_url}{$i}/", date('Y-m-01'), self::$PAGINATED_PAGE_CHANGEFREQ, self::$PAGINATED_PAGE_RANK); |
105 | 105 | } |
@@ -64,6 +64,9 @@ |
||
64 | 64 | } |
65 | 65 | } |
66 | 66 | |
67 | + /** |
|
68 | + * @param string $changefreq |
|
69 | + */ |
|
67 | 70 | private function add_paginated_pages($posts, $base_url, $changefreq, $rank) |
68 | 71 | { |
69 | 72 | switch($changefreq) |
@@ -7,16 +7,16 @@ discard block |
||
7 | 7 | { |
8 | 8 | |
9 | 9 | private static $HOME_PAGE_RANK = .9; |
10 | - private static $TAG_PAGE_RANK = .3; |
|
11 | - private static $PAGINATED_PAGE_RANK = .1; |
|
10 | + private static $TAG_PAGE_RANK = .3; |
|
11 | + private static $PAGINATED_PAGE_RANK = .1; |
|
12 | 12 | private static $POST_PAGE_RANK = .5; |
13 | - private static $ABOUT_PAGE_RANK = .7; |
|
13 | + private static $ABOUT_PAGE_RANK = .7; |
|
14 | 14 | |
15 | 15 | private static $HOME_PAGE_CHANGEFREQ = 'hourly'; |
16 | 16 | private static $TAG_PAGE_CHANGEFREQ = 'daily'; |
17 | - private static $PAGINATED_PAGE_CHANGEFREQ = 'daily'; |
|
17 | + private static $PAGINATED_PAGE_CHANGEFREQ = 'daily'; |
|
18 | 18 | private static $POST_PAGE_CHANGEFREQ = 'weekly'; |
19 | - private static $ABOUT_PAGE_CHANGEFREQ = 'monthly'; |
|
19 | + private static $ABOUT_PAGE_CHANGEFREQ = 'monthly'; |
|
20 | 20 | |
21 | 21 | private static $POSTS_PER_PAGE = 15; |
22 | 22 | |
@@ -42,12 +42,12 @@ discard block |
||
42 | 42 | $posts = ActivityCollector::getAll(); |
43 | 43 | |
44 | 44 | $tag_post_holder = array(); |
45 | - foreach($posts as $post) |
|
45 | + foreach ($posts as $post) |
|
46 | 46 | { |
47 | 47 | $tag_post_holder[$post->type][] = $post; |
48 | 48 | } |
49 | 49 | |
50 | - foreach($tag_post_holder as $tag => $posts) |
|
50 | + foreach ($tag_post_holder as $tag => $posts) |
|
51 | 51 | { |
52 | 52 | $url = "{$tag}/"; |
53 | 53 | $this->add_paginated_pages($posts, $url, self::$TAG_PAGE_CHANGEFREQ, self::$TAG_PAGE_RANK); |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | { |
59 | 59 | $posts = ActivityCollector::getAll(); |
60 | 60 | |
61 | - foreach($posts as $post) |
|
61 | + foreach ($posts as $post) |
|
62 | 62 | { |
63 | 63 | $this->addURL("{$post->type}/{$post->id}/", date('Y-m-d', strtotime('last Monday')), self::$POST_PAGE_CHANGEFREQ, self::$POST_PAGE_RANK); |
64 | 64 | } |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | |
67 | 67 | private function add_paginated_pages($posts, $base_url, $changefreq, $rank) |
68 | 68 | { |
69 | - switch($changefreq) |
|
69 | + switch ($changefreq) |
|
70 | 70 | { |
71 | 71 | case 'hourly' : |
72 | 72 | $lastmod = date('Y-m-d H:00:00'); |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | } |
84 | 84 | |
85 | 85 | $this->addURL($base_url, $lastmod, $changefreq, $rank); |
86 | - for($i = 2; (($i - 1) * self::$POSTS_PER_PAGE) < count($posts); $i++) |
|
86 | + for ($i = 2; (($i - 1) * self::$POSTS_PER_PAGE) < count($posts); $i++) |
|
87 | 87 | { |
88 | 88 | $this->addURL("{$base_url}page/{$i}/", date('Y-m-01'), self::$PAGINATED_PAGE_CHANGEFREQ, self::$PAGINATED_PAGE_RANK); |
89 | 89 | } |
@@ -133,6 +133,10 @@ |
||
133 | 133 | $this->addURL('about/', date('Y-01-01'), self::$ABOUT_PAGE_CHANGEFREQ, self::$ABOUT_PAGE_RANK); |
134 | 134 | } |
135 | 135 | |
136 | + /** |
|
137 | + * @param integer $items_per_page |
|
138 | + * @param string $type |
|
139 | + */ |
|
136 | 140 | private function add_paginated_pages($count, $items_per_page, $base_url, $type) |
137 | 141 | { |
138 | 142 | switch($type) { |
@@ -1,13 +1,13 @@ discard block |
||
1 | 1 | <? |
2 | 2 | |
3 | 3 | Loader::load('collector', array( |
4 | - 'waterfall/CompanionCollector', |
|
5 | - 'waterfall/CountyCollector', |
|
6 | - 'waterfall/LogCollector', |
|
7 | - 'waterfall/LogTagCollector', |
|
8 | - 'waterfall/PeriodCollector', |
|
9 | - 'waterfall/WatercourseCollector', |
|
10 | - 'waterfall/WaterfallCollector', |
|
4 | + 'waterfall/CompanionCollector', |
|
5 | + 'waterfall/CountyCollector', |
|
6 | + 'waterfall/LogCollector', |
|
7 | + 'waterfall/LogTagCollector', |
|
8 | + 'waterfall/PeriodCollector', |
|
9 | + 'waterfall/WatercourseCollector', |
|
10 | + 'waterfall/WaterfallCollector', |
|
11 | 11 | )); |
12 | 12 | Loader::load('controller', '/SitemapController'); |
13 | 13 | Loader::load('utility', 'Content'); |
@@ -15,143 +15,143 @@ discard block |
||
15 | 15 | final class WaterfallSitemapController extends SitemapController |
16 | 16 | { |
17 | 17 | |
18 | - private static $HOME_PAGE_RANK = .9; |
|
19 | - |
|
20 | - private static $WATERFALL_LISTING_RANK = .3; |
|
21 | - private static $WATERFALL_COUNTY_LISTING_RANK = .6; |
|
22 | - private static $WATERFALL_WATERCOURSE_LISTING_RANK = .6; |
|
23 | - private static $WATERFALL_LISTING_SUBPAGES_RANK = .1; |
|
24 | - private static $WATERFALL_PAGE_RANK = .8; |
|
25 | - |
|
26 | - private static $MAP_PAGE_RANK = .6; |
|
27 | - |
|
28 | - private static $LOG_LISTING_RANK = .3; |
|
29 | - private static $LOG_COMPANION_LISTING_RANK = .3; |
|
30 | - private static $LOG_PERIOD_LISTING_RANK = .3; |
|
31 | - private static $LOG_LISTING_SUBPAGES_RANK = .1; |
|
32 | - private static $LOG_PAGE_RANK = .7; |
|
33 | - |
|
34 | - private static $ABOUT_PAGE_RANK = .6; |
|
35 | - |
|
36 | - |
|
37 | - private static $HOME_PAGE_CHANGEFREQ = 'daily'; |
|
38 | - |
|
39 | - private static $WATERFALL_LISTING_CHANGEFREQ = 'monthly'; |
|
40 | - private static $WATERFALL_COUNTY_LISTING_CHANGEFREQ = 'monthly'; |
|
41 | - private static $WATERFALL_WATERCOURSE_LISTING_CHANGEFREQ = 'monthly'; |
|
42 | - private static $WATERFALL_LISTING_SUBPAGES_CHANGEFREQ = 'monthly'; |
|
43 | - private static $WATERFALL_PAGE_CHANGEFREQ = 'weekly'; |
|
44 | - |
|
45 | - private static $MAP_PAGE_CHANGEFREQ = 'monthly'; |
|
46 | - |
|
47 | - private static $LOG_LISTING_CHANGEFREQ = 'weekly'; |
|
48 | - private static $LOG_COMPANION_LISTING_CHANGEFREQ = 'monthly'; |
|
49 | - private static $LOG_PERIOD_LISTING_CHANGEFREQ = 'monthly'; |
|
50 | - private static $LOG_LISTING_SUBPAGES_CHANGEFREQ = 'monthly'; |
|
51 | - private static $LOG_PAGE_CHANGEFREQ = 'weekly'; |
|
52 | - |
|
53 | - private static $ABOUT_PAGE_CHANGEFREQ = 'yearly'; |
|
54 | - |
|
55 | - |
|
56 | - private static $WATERFALLS_PER_LISTING = 24; |
|
57 | - private static $WATERFALLS_PER_COUNTY_LISTING = 12; |
|
58 | - private static $WATERFALLS_PER_WATERCOURSE_LISTING = 12; |
|
59 | - |
|
60 | - private static $LOGS_PER_LISTING = 10; |
|
61 | - private static $LOGS_PER_COMPANION_LISTING = 10; |
|
62 | - private static $LOGS_PER_PERIOD_LISTING = 10; |
|
63 | - |
|
64 | - protected function set_data() |
|
65 | - { |
|
66 | - $this->add_home_pages(); |
|
67 | - $this->add_waterfall_pages(); |
|
68 | - $this->add_map_pages(); |
|
69 | - $this->add_log_pages(); |
|
70 | - $this->add_about_pages(); |
|
71 | - } |
|
72 | - |
|
73 | - private function add_home_pages() |
|
74 | - { |
|
75 | - $this->addURL('', date('Y-m-d'), self::$HOME_PAGE_CHANGEFREQ, self::$HOME_PAGE_RANK); |
|
76 | - } |
|
77 | - |
|
78 | - private function add_waterfall_pages() |
|
79 | - { |
|
80 | - $this->addURL('falls/', date('Y-m-01'), self::$WATERFALL_LISTING_CHANGEFREQ, self::$WATERFALL_LISTING_RANK); |
|
81 | - $count = WaterfallCollector::getListCount(); |
|
82 | - $this->add_paginated_pages($count, self::$WATERFALLS_PER_LISTING, 'falls', 'waterfall'); |
|
83 | - |
|
84 | - $county_list = CountyCollector::getCountyList(); |
|
85 | - foreach ($county_list as $county) { |
|
86 | - $this->addURL("{$county->alias}/", date('Y-m-01'), self::$WATERFALL_COUNTY_LISTING_CHANGEFREQ, self::$WATERFALL_COUNTY_LISTING_RANK); |
|
87 | - $this->add_paginated_pages($county->count, self::$WATERFALLS_PER_COUNTY_LISTING, $county->alias, 'waterfall'); |
|
88 | - } |
|
89 | - |
|
90 | - $watercourse_list = WatercourseCollector::getWatercourseList(); |
|
91 | - foreach ($watercourse_list as $watercourse) { |
|
92 | - $this->addURL("{$watercourse->alias}/", date('Y-m-01'), self::$WATERFALL_WATERCOURSE_LISTING_CHANGEFREQ, self::$WATERFALL_WATERCOURSE_LISTING_RANK); |
|
93 | - $this->add_paginated_pages($watercourse->count, self::$WATERFALLS_PER_WATERCOURSE_LISTING, $watercourse->alias, 'waterfall'); |
|
94 | - } |
|
95 | - |
|
96 | - $waterfall_list = WaterfallCollector::getList(500); |
|
97 | - foreach ($waterfall_list as $waterfall) { |
|
98 | - $this->addURL("{$waterfall->watercourse_alias}/{$waterfall->waterfall_alias}/", date('Y-m-d', strtotime('last Monday')), self::$WATERFALL_PAGE_CHANGEFREQ, self::$WATERFALL_PAGE_RANK); |
|
99 | - } |
|
100 | - } |
|
101 | - |
|
102 | - private function add_map_pages() |
|
103 | - { |
|
104 | - $this->addURL('map/', date('Y-m-01'), self::$MAP_PAGE_CHANGEFREQ, self::$MAP_PAGE_RANK); |
|
105 | - } |
|
106 | - |
|
107 | - private function add_log_pages() |
|
108 | - { |
|
109 | - $this->addURL('journal/', date('Y-m-d', strtotime('last Monday')), self::$LOG_LISTING_CHANGEFREQ, self::$LOG_LISTING_RANK); |
|
110 | - $count = LogCollector::getListCount(); |
|
111 | - $this->add_paginated_pages($count, self::$LOGS_PER_LISTING, 'journal', 'log'); |
|
112 | - |
|
113 | - $companion_list = CompanionCollector::getCompanionList(); |
|
114 | - foreach ($companion_list as $companion) { |
|
115 | - $this->addURL("companion/{$companion->alias}/", date('Y-m-01'), self::$LOG_COMPANION_LISTING_CHANGEFREQ, self::$LOG_COMPANION_LISTING_RANK); |
|
116 | - $this->add_paginated_pages($companion->count, self::$LOGS_PER_COMPANION_LISTING, "companion/{$companion->alias}", 'log'); |
|
117 | - } |
|
118 | - |
|
119 | - $period_list = PeriodCollector::getPeriodList(); |
|
120 | - foreach ($period_list as $period) { |
|
121 | - $this->addURL("period/{$period->alias}/", date('Y-m-01'), self::$LOG_PERIOD_LISTING_CHANGEFREQ, self::$LOG_PERIOD_LISTING_RANK); |
|
122 | - $this->add_paginated_pages($period->count, self::$LOGS_PER_PERIOD_LISTING, "period/{$period->alias}", 'log'); |
|
123 | - } |
|
124 | - |
|
125 | - $log_list = LogCollector::getList(500); |
|
126 | - foreach ($log_list as $log) { |
|
127 | - $this->addURL("journal/{$log->alias}/", date('Y-m-d', strtotime('last Monday')), self::$LOG_PAGE_CHANGEFREQ, self::$LOG_PAGE_RANK); |
|
128 | - } |
|
129 | - } |
|
130 | - |
|
131 | - private function add_about_pages() |
|
132 | - { |
|
133 | - $this->addURL('about/', date('Y-01-01'), self::$ABOUT_PAGE_CHANGEFREQ, self::$ABOUT_PAGE_RANK); |
|
134 | - } |
|
135 | - |
|
136 | - private function add_paginated_pages($count, $items_per_page, $base_url, $type) |
|
137 | - { |
|
138 | - switch($type) { |
|
139 | - case 'waterfall': |
|
140 | - $lastmod = date('Y-m-01'); |
|
141 | - $changefreq = self::$WATERFALL_LISTING_SUBPAGES_CHANGEFREQ; |
|
142 | - $rank = self::$WATERFALL_LISTING_SUBPAGES_RANK; |
|
143 | - break; |
|
144 | - case 'log': |
|
145 | - $lastmod = date('Y-m-01'); |
|
146 | - $changefreq = self::$LOG_LISTING_SUBPAGES_CHANGEFREQ; |
|
147 | - $rank = self::$LOG_LISTING_SUBPAGES_RANK; |
|
148 | - break; |
|
149 | - } |
|
150 | - |
|
151 | - for($i = 2; (($i - 1) * $items_per_page) < $count; $i++) { |
|
152 | - $this->addURL("{$base_url}/{$i}/", $lastmod, $changefreq, $rank); |
|
153 | - } |
|
154 | - } |
|
18 | + private static $HOME_PAGE_RANK = .9; |
|
19 | + |
|
20 | + private static $WATERFALL_LISTING_RANK = .3; |
|
21 | + private static $WATERFALL_COUNTY_LISTING_RANK = .6; |
|
22 | + private static $WATERFALL_WATERCOURSE_LISTING_RANK = .6; |
|
23 | + private static $WATERFALL_LISTING_SUBPAGES_RANK = .1; |
|
24 | + private static $WATERFALL_PAGE_RANK = .8; |
|
25 | + |
|
26 | + private static $MAP_PAGE_RANK = .6; |
|
27 | + |
|
28 | + private static $LOG_LISTING_RANK = .3; |
|
29 | + private static $LOG_COMPANION_LISTING_RANK = .3; |
|
30 | + private static $LOG_PERIOD_LISTING_RANK = .3; |
|
31 | + private static $LOG_LISTING_SUBPAGES_RANK = .1; |
|
32 | + private static $LOG_PAGE_RANK = .7; |
|
33 | + |
|
34 | + private static $ABOUT_PAGE_RANK = .6; |
|
35 | + |
|
36 | + |
|
37 | + private static $HOME_PAGE_CHANGEFREQ = 'daily'; |
|
38 | + |
|
39 | + private static $WATERFALL_LISTING_CHANGEFREQ = 'monthly'; |
|
40 | + private static $WATERFALL_COUNTY_LISTING_CHANGEFREQ = 'monthly'; |
|
41 | + private static $WATERFALL_WATERCOURSE_LISTING_CHANGEFREQ = 'monthly'; |
|
42 | + private static $WATERFALL_LISTING_SUBPAGES_CHANGEFREQ = 'monthly'; |
|
43 | + private static $WATERFALL_PAGE_CHANGEFREQ = 'weekly'; |
|
44 | + |
|
45 | + private static $MAP_PAGE_CHANGEFREQ = 'monthly'; |
|
46 | + |
|
47 | + private static $LOG_LISTING_CHANGEFREQ = 'weekly'; |
|
48 | + private static $LOG_COMPANION_LISTING_CHANGEFREQ = 'monthly'; |
|
49 | + private static $LOG_PERIOD_LISTING_CHANGEFREQ = 'monthly'; |
|
50 | + private static $LOG_LISTING_SUBPAGES_CHANGEFREQ = 'monthly'; |
|
51 | + private static $LOG_PAGE_CHANGEFREQ = 'weekly'; |
|
52 | + |
|
53 | + private static $ABOUT_PAGE_CHANGEFREQ = 'yearly'; |
|
54 | + |
|
55 | + |
|
56 | + private static $WATERFALLS_PER_LISTING = 24; |
|
57 | + private static $WATERFALLS_PER_COUNTY_LISTING = 12; |
|
58 | + private static $WATERFALLS_PER_WATERCOURSE_LISTING = 12; |
|
59 | + |
|
60 | + private static $LOGS_PER_LISTING = 10; |
|
61 | + private static $LOGS_PER_COMPANION_LISTING = 10; |
|
62 | + private static $LOGS_PER_PERIOD_LISTING = 10; |
|
63 | + |
|
64 | + protected function set_data() |
|
65 | + { |
|
66 | + $this->add_home_pages(); |
|
67 | + $this->add_waterfall_pages(); |
|
68 | + $this->add_map_pages(); |
|
69 | + $this->add_log_pages(); |
|
70 | + $this->add_about_pages(); |
|
71 | + } |
|
72 | + |
|
73 | + private function add_home_pages() |
|
74 | + { |
|
75 | + $this->addURL('', date('Y-m-d'), self::$HOME_PAGE_CHANGEFREQ, self::$HOME_PAGE_RANK); |
|
76 | + } |
|
77 | + |
|
78 | + private function add_waterfall_pages() |
|
79 | + { |
|
80 | + $this->addURL('falls/', date('Y-m-01'), self::$WATERFALL_LISTING_CHANGEFREQ, self::$WATERFALL_LISTING_RANK); |
|
81 | + $count = WaterfallCollector::getListCount(); |
|
82 | + $this->add_paginated_pages($count, self::$WATERFALLS_PER_LISTING, 'falls', 'waterfall'); |
|
83 | + |
|
84 | + $county_list = CountyCollector::getCountyList(); |
|
85 | + foreach ($county_list as $county) { |
|
86 | + $this->addURL("{$county->alias}/", date('Y-m-01'), self::$WATERFALL_COUNTY_LISTING_CHANGEFREQ, self::$WATERFALL_COUNTY_LISTING_RANK); |
|
87 | + $this->add_paginated_pages($county->count, self::$WATERFALLS_PER_COUNTY_LISTING, $county->alias, 'waterfall'); |
|
88 | + } |
|
89 | + |
|
90 | + $watercourse_list = WatercourseCollector::getWatercourseList(); |
|
91 | + foreach ($watercourse_list as $watercourse) { |
|
92 | + $this->addURL("{$watercourse->alias}/", date('Y-m-01'), self::$WATERFALL_WATERCOURSE_LISTING_CHANGEFREQ, self::$WATERFALL_WATERCOURSE_LISTING_RANK); |
|
93 | + $this->add_paginated_pages($watercourse->count, self::$WATERFALLS_PER_WATERCOURSE_LISTING, $watercourse->alias, 'waterfall'); |
|
94 | + } |
|
95 | + |
|
96 | + $waterfall_list = WaterfallCollector::getList(500); |
|
97 | + foreach ($waterfall_list as $waterfall) { |
|
98 | + $this->addURL("{$waterfall->watercourse_alias}/{$waterfall->waterfall_alias}/", date('Y-m-d', strtotime('last Monday')), self::$WATERFALL_PAGE_CHANGEFREQ, self::$WATERFALL_PAGE_RANK); |
|
99 | + } |
|
100 | + } |
|
101 | + |
|
102 | + private function add_map_pages() |
|
103 | + { |
|
104 | + $this->addURL('map/', date('Y-m-01'), self::$MAP_PAGE_CHANGEFREQ, self::$MAP_PAGE_RANK); |
|
105 | + } |
|
106 | + |
|
107 | + private function add_log_pages() |
|
108 | + { |
|
109 | + $this->addURL('journal/', date('Y-m-d', strtotime('last Monday')), self::$LOG_LISTING_CHANGEFREQ, self::$LOG_LISTING_RANK); |
|
110 | + $count = LogCollector::getListCount(); |
|
111 | + $this->add_paginated_pages($count, self::$LOGS_PER_LISTING, 'journal', 'log'); |
|
112 | + |
|
113 | + $companion_list = CompanionCollector::getCompanionList(); |
|
114 | + foreach ($companion_list as $companion) { |
|
115 | + $this->addURL("companion/{$companion->alias}/", date('Y-m-01'), self::$LOG_COMPANION_LISTING_CHANGEFREQ, self::$LOG_COMPANION_LISTING_RANK); |
|
116 | + $this->add_paginated_pages($companion->count, self::$LOGS_PER_COMPANION_LISTING, "companion/{$companion->alias}", 'log'); |
|
117 | + } |
|
118 | + |
|
119 | + $period_list = PeriodCollector::getPeriodList(); |
|
120 | + foreach ($period_list as $period) { |
|
121 | + $this->addURL("period/{$period->alias}/", date('Y-m-01'), self::$LOG_PERIOD_LISTING_CHANGEFREQ, self::$LOG_PERIOD_LISTING_RANK); |
|
122 | + $this->add_paginated_pages($period->count, self::$LOGS_PER_PERIOD_LISTING, "period/{$period->alias}", 'log'); |
|
123 | + } |
|
124 | + |
|
125 | + $log_list = LogCollector::getList(500); |
|
126 | + foreach ($log_list as $log) { |
|
127 | + $this->addURL("journal/{$log->alias}/", date('Y-m-d', strtotime('last Monday')), self::$LOG_PAGE_CHANGEFREQ, self::$LOG_PAGE_RANK); |
|
128 | + } |
|
129 | + } |
|
130 | + |
|
131 | + private function add_about_pages() |
|
132 | + { |
|
133 | + $this->addURL('about/', date('Y-01-01'), self::$ABOUT_PAGE_CHANGEFREQ, self::$ABOUT_PAGE_RANK); |
|
134 | + } |
|
135 | + |
|
136 | + private function add_paginated_pages($count, $items_per_page, $base_url, $type) |
|
137 | + { |
|
138 | + switch($type) { |
|
139 | + case 'waterfall': |
|
140 | + $lastmod = date('Y-m-01'); |
|
141 | + $changefreq = self::$WATERFALL_LISTING_SUBPAGES_CHANGEFREQ; |
|
142 | + $rank = self::$WATERFALL_LISTING_SUBPAGES_RANK; |
|
143 | + break; |
|
144 | + case 'log': |
|
145 | + $lastmod = date('Y-m-01'); |
|
146 | + $changefreq = self::$LOG_LISTING_SUBPAGES_CHANGEFREQ; |
|
147 | + $rank = self::$LOG_LISTING_SUBPAGES_RANK; |
|
148 | + break; |
|
149 | + } |
|
150 | + |
|
151 | + for($i = 2; (($i - 1) * $items_per_page) < $count; $i++) { |
|
152 | + $this->addURL("{$base_url}/{$i}/", $lastmod, $changefreq, $rank); |
|
153 | + } |
|
154 | + } |
|
155 | 155 | |
156 | 156 | } |
157 | 157 |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | |
136 | 136 | private function add_paginated_pages($count, $items_per_page, $base_url, $type) |
137 | 137 | { |
138 | - switch($type) { |
|
138 | + switch ($type) { |
|
139 | 139 | case 'waterfall': |
140 | 140 | $lastmod = date('Y-m-01'); |
141 | 141 | $changefreq = self::$WATERFALL_LISTING_SUBPAGES_CHANGEFREQ; |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | break; |
149 | 149 | } |
150 | 150 | |
151 | - for($i = 2; (($i - 1) * $items_per_page) < $count; $i++) { |
|
151 | + for ($i = 2; (($i - 1) * $items_per_page) < $count; $i++) { |
|
152 | 152 | $this->addURL("{$base_url}/{$i}/", $lastmod, $changefreq, $rank); |
153 | 153 | } |
154 | 154 | } |