@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | $companion_result = CompanionCollector::getCompanionList(); |
43 | 43 | $companion_list = array(); |
44 | 44 | |
45 | - foreach($companion_result as $companion_row) |
|
45 | + foreach ($companion_result as $companion_row) |
|
46 | 46 | { |
47 | 47 | $companion = new stdclass(); |
48 | 48 | $companion->name = $companion_row->name; |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | $period_result = PeriodCollector::getPeriodList(); |
56 | 56 | $period_list = array(); |
57 | 57 | |
58 | - foreach($period_result as $period_row) |
|
58 | + foreach ($period_result as $period_row) |
|
59 | 59 | { |
60 | 60 | $period = new stdclass(); |
61 | 61 | $period->name = $period_row->name; |
@@ -27,7 +27,7 @@ |
||
27 | 27 | protected function get_page_number() |
28 | 28 | { |
29 | 29 | $page = URLDecode::getPiece(2); |
30 | - if(isset($page) && is_numeric($page)) |
|
30 | + if (isset($page) && is_numeric($page)) |
|
31 | 31 | return $page; |
32 | 32 | return 1; |
33 | 33 | } |
@@ -27,8 +27,9 @@ |
||
27 | 27 | protected function get_page_number() |
28 | 28 | { |
29 | 29 | $page = URLDecode::getPiece(2); |
30 | - if(isset($page) && is_numeric($page)) |
|
31 | - return $page; |
|
30 | + if(isset($page) && is_numeric($page)) { |
|
31 | + return $page; |
|
32 | + } |
|
32 | 33 | return 1; |
33 | 34 | } |
34 | 35 |
@@ -1,84 +1,84 @@ |
||
1 | 1 | <? |
2 | 2 | |
3 | 3 | Loader::load('collector', array( |
4 | - 'comment/CommentCollector', |
|
5 | - 'image/PhotoCollector', |
|
6 | - 'waterfall/LogCollector', |
|
4 | + 'comment/CommentCollector', |
|
5 | + 'image/PhotoCollector', |
|
6 | + 'waterfall/LogCollector', |
|
7 | 7 | )); |
8 | 8 | Loader::load('controller', 'waterfalls/DefaultPageController'); |
9 | 9 | |
10 | 10 | final class HomeController extends DefaultPageController |
11 | 11 | { |
12 | 12 | |
13 | - private static $TITLE = 'Waterfalls of the Keweenaw | Stories and Tips from Jacob Emerick'; |
|
14 | - private static $DESCRIPTION = 'Stories, maps, and details about many of the waterfalls in the Upper Peninsula of Michigan, compiled by Jacob Emerick.'; |
|
15 | - private static $KEYWORD_ARRAY = array( |
|
16 | - 'waterfalls', |
|
17 | - 'keweenaw', |
|
18 | - 'upper peninsula', |
|
19 | - 'jacob emerick', |
|
20 | - ); |
|
13 | + private static $TITLE = 'Waterfalls of the Keweenaw | Stories and Tips from Jacob Emerick'; |
|
14 | + private static $DESCRIPTION = 'Stories, maps, and details about many of the waterfalls in the Upper Peninsula of Michigan, compiled by Jacob Emerick.'; |
|
15 | + private static $KEYWORD_ARRAY = array( |
|
16 | + 'waterfalls', |
|
17 | + 'keweenaw', |
|
18 | + 'upper peninsula', |
|
19 | + 'jacob emerick', |
|
20 | + ); |
|
21 | 21 | |
22 | - private static $BANNER_IMAGE = 2661; |
|
22 | + private static $BANNER_IMAGE = 2661; |
|
23 | 23 | |
24 | - protected function set_head_data() |
|
25 | - { |
|
26 | - parent::set_head_data(); |
|
24 | + protected function set_head_data() |
|
25 | + { |
|
26 | + parent::set_head_data(); |
|
27 | 27 | |
28 | - $this->set_title(self::$TITLE); |
|
29 | - $this->set_description(self::$DESCRIPTION); |
|
30 | - $this->set_keywords(self::$KEYWORD_ARRAY); |
|
31 | - } |
|
28 | + $this->set_title(self::$TITLE); |
|
29 | + $this->set_description(self::$DESCRIPTION); |
|
30 | + $this->set_keywords(self::$KEYWORD_ARRAY); |
|
31 | + } |
|
32 | 32 | |
33 | - protected function set_body_data($page_type = 'wide') |
|
34 | - { |
|
35 | - parent::set_body_data($page_type); |
|
33 | + protected function set_body_data($page_type = 'wide') |
|
34 | + { |
|
35 | + parent::set_body_data($page_type); |
|
36 | 36 | |
37 | - $photo = PhotoCollector::getRow(self::$BANNER_IMAGE); |
|
38 | - $photo_obj = (object) array( |
|
39 | - 'file' => "/photo/{$photo->category}/{$photo->name}-size-full.jpg", |
|
40 | - 'description' => $photo->description, |
|
41 | - ); |
|
42 | - $this->set_body('photo', $photo_obj); |
|
37 | + $photo = PhotoCollector::getRow(self::$BANNER_IMAGE); |
|
38 | + $photo_obj = (object) array( |
|
39 | + 'file' => "/photo/{$photo->category}/{$photo->name}-size-full.jpg", |
|
40 | + 'description' => $photo->description, |
|
41 | + ); |
|
42 | + $this->set_body('photo', $photo_obj); |
|
43 | 43 | |
44 | - $recent_log_container; |
|
45 | - $recent_logs = LogCollector::getRecentList(4); |
|
46 | - foreach ($recent_logs as $log) { |
|
47 | - $recent_log_container[] = (object) array( |
|
48 | - 'photo' => (object) array( |
|
49 | - 'file' => "/photo/{$log->photo_category}/{$log->photo}-size-thumb.jpg", |
|
50 | - 'description' => $log->photo_description, |
|
51 | - ), |
|
52 | - 'title' => $log->title, |
|
53 | - 'link' => "/journal/{$log->alias}/", |
|
54 | - 'date' => date('F j, Y', strtotime($log->publish_date)), |
|
55 | - ); |
|
56 | - } |
|
57 | - $this->set_body('logs', $recent_log_container); |
|
44 | + $recent_log_container; |
|
45 | + $recent_logs = LogCollector::getRecentList(4); |
|
46 | + foreach ($recent_logs as $log) { |
|
47 | + $recent_log_container[] = (object) array( |
|
48 | + 'photo' => (object) array( |
|
49 | + 'file' => "/photo/{$log->photo_category}/{$log->photo}-size-thumb.jpg", |
|
50 | + 'description' => $log->photo_description, |
|
51 | + ), |
|
52 | + 'title' => $log->title, |
|
53 | + 'link' => "/journal/{$log->alias}/", |
|
54 | + 'date' => date('F j, Y', strtotime($log->publish_date)), |
|
55 | + ); |
|
56 | + } |
|
57 | + $this->set_body('logs', $recent_log_container); |
|
58 | 58 | |
59 | - $recent_comments = CommentCollector::getRecentWaterfallComments(); |
|
59 | + $recent_comments = CommentCollector::getRecentWaterfallComments(); |
|
60 | 60 | |
61 | - $recent_comment_container = array(); |
|
62 | - foreach($recent_comments as $comment) { |
|
63 | - $body = $comment->body; |
|
64 | - $body = strip_tags($body); |
|
61 | + $recent_comment_container = array(); |
|
62 | + foreach($recent_comments as $comment) { |
|
63 | + $body = $comment->body; |
|
64 | + $body = strip_tags($body); |
|
65 | 65 | |
66 | - $comment_obj = new stdclass(); |
|
67 | - $comment_obj->description = Content::instance('SmartTrim', $body)->activate(50); |
|
68 | - $comment_obj->commenter = $comment->name; |
|
69 | - if (!empty($comment->log_path)) { |
|
70 | - $comment_obj->link = Loader::getRootURL() . "{$comment->log_path}/#comment-{$comment->id}"; |
|
71 | - $comment_obj->location = $comment->log_title; |
|
72 | - } else { |
|
73 | - $comment_obj->link = Loader::getRootURL() . "{$comment->waterfall_path}/#comment-{$comment->id}"; |
|
74 | - $comment_obj->location = $comment->waterfall_title; |
|
75 | - } |
|
66 | + $comment_obj = new stdclass(); |
|
67 | + $comment_obj->description = Content::instance('SmartTrim', $body)->activate(50); |
|
68 | + $comment_obj->commenter = $comment->name; |
|
69 | + if (!empty($comment->log_path)) { |
|
70 | + $comment_obj->link = Loader::getRootURL() . "{$comment->log_path}/#comment-{$comment->id}"; |
|
71 | + $comment_obj->location = $comment->log_title; |
|
72 | + } else { |
|
73 | + $comment_obj->link = Loader::getRootURL() . "{$comment->waterfall_path}/#comment-{$comment->id}"; |
|
74 | + $comment_obj->location = $comment->waterfall_title; |
|
75 | + } |
|
76 | 76 | |
77 | - $recent_comment_container[] = $comment_obj; |
|
78 | - } |
|
79 | - $this->set_body('comments', $recent_comment_container); |
|
77 | + $recent_comment_container[] = $comment_obj; |
|
78 | + } |
|
79 | + $this->set_body('comments', $recent_comment_container); |
|
80 | 80 | |
81 | - $this->set_body('view', 'Home'); |
|
82 | - } |
|
81 | + $this->set_body('view', 'Home'); |
|
82 | + } |
|
83 | 83 | |
84 | 84 | } |
85 | 85 | \ No newline at end of file |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | $recent_comments = CommentCollector::getRecentWaterfallComments(); |
60 | 60 | |
61 | 61 | $recent_comment_container = array(); |
62 | - foreach($recent_comments as $comment) { |
|
62 | + foreach ($recent_comments as $comment) { |
|
63 | 63 | $body = $comment->body; |
64 | 64 | $body = strip_tags($body); |
65 | 65 | |
@@ -67,10 +67,10 @@ discard block |
||
67 | 67 | $comment_obj->description = Content::instance('SmartTrim', $body)->activate(50); |
68 | 68 | $comment_obj->commenter = $comment->name; |
69 | 69 | if (!empty($comment->log_path)) { |
70 | - $comment_obj->link = Loader::getRootURL() . "{$comment->log_path}/#comment-{$comment->id}"; |
|
70 | + $comment_obj->link = Loader::getRootURL()."{$comment->log_path}/#comment-{$comment->id}"; |
|
71 | 71 | $comment_obj->location = $comment->log_title; |
72 | 72 | } else { |
73 | - $comment_obj->link = Loader::getRootURL() . "{$comment->waterfall_path}/#comment-{$comment->id}"; |
|
73 | + $comment_obj->link = Loader::getRootURL()."{$comment->waterfall_path}/#comment-{$comment->id}"; |
|
74 | 74 | $comment_obj->location = $comment->waterfall_title; |
75 | 75 | } |
76 | 76 |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | $county_result = CountyCollector::getCountyList(); |
42 | 42 | $county_list = array(); |
43 | 43 | |
44 | - foreach($county_result as $county_row) |
|
44 | + foreach ($county_result as $county_row) |
|
45 | 45 | { |
46 | 46 | $county = new stdclass(); |
47 | 47 | $county->name = $county_row->name; |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | $watercourse_result = WatercourseCollector::getWatercourseList(); |
55 | 55 | $watercourse_list = array(); |
56 | 56 | |
57 | - foreach($watercourse_result as $watercourse_row) |
|
57 | + foreach ($watercourse_result as $watercourse_row) |
|
58 | 58 | { |
59 | 59 | $watercourse = new stdclass(); |
60 | 60 | $watercourse->name = $watercourse_row->name; |
@@ -33,17 +33,21 @@ |
||
33 | 33 | |
34 | 34 | private function process_form() |
35 | 35 | { |
36 | - if(!Request::hasPost() || Request::getPost('submit') != 'Send Message!') |
|
37 | - return (object) array('display' => 'normal'); |
|
36 | + if(!Request::hasPost() || Request::getPost('submit') != 'Send Message!') { |
|
37 | + return (object) array('display' => 'normal'); |
|
38 | + } |
|
38 | 39 | |
39 | 40 | Loader::load('utility', 'Validate'); |
40 | 41 | $error_result = array(); |
41 | - if(!Validate::checkRequest('post', 'name', 'string')) |
|
42 | - $error_result['name'] = 'please enter your name'; |
|
43 | - if(!Validate::checkRequest('post', 'email', 'string')) |
|
44 | - $error_result['email'] = 'please enter a valid email'; |
|
45 | - if(!Validate::checkRequest('post', 'message', 'string')) |
|
46 | - $error_result['message'] = 'please write a message'; |
|
42 | + if(!Validate::checkRequest('post', 'name', 'string')) { |
|
43 | + $error_result['name'] = 'please enter your name'; |
|
44 | + } |
|
45 | + if(!Validate::checkRequest('post', 'email', 'string')) { |
|
46 | + $error_result['email'] = 'please enter a valid email'; |
|
47 | + } |
|
48 | + if(!Validate::checkRequest('post', 'message', 'string')) { |
|
49 | + $error_result['message'] = 'please write a message'; |
|
50 | + } |
|
47 | 51 | |
48 | 52 | $values = (object) array( |
49 | 53 | 'name' => Request::getPost('name'), |
@@ -58,16 +58,16 @@ |
||
58 | 58 | 'values' => $values); |
59 | 59 | } |
60 | 60 | |
61 | - global $container; |
|
62 | - $sent = $container['mail'] |
|
63 | - ->addTo($container['config']->admin_email) |
|
64 | - ->setSubject('Waterfall Site Contact') |
|
65 | - ->setPlainMessage( |
|
66 | - "Name: {$values->name}\n" . |
|
67 | - "Email: {$values->email}\n" . |
|
68 | - "Message: {$values->message}" |
|
69 | - ) |
|
70 | - ->send(); |
|
61 | + global $container; |
|
62 | + $sent = $container['mail'] |
|
63 | + ->addTo($container['config']->admin_email) |
|
64 | + ->setSubject('Waterfall Site Contact') |
|
65 | + ->setPlainMessage( |
|
66 | + "Name: {$values->name}\n" . |
|
67 | + "Email: {$values->email}\n" . |
|
68 | + "Message: {$values->message}" |
|
69 | + ) |
|
70 | + ->send(); |
|
71 | 71 | |
72 | 72 | return (object) array('display' => 'success'); |
73 | 73 | } |
@@ -35,16 +35,16 @@ discard block |
||
35 | 35 | |
36 | 36 | private function process_form() |
37 | 37 | { |
38 | - if(!Request::hasPost() || Request::getPost('submit') != 'Send Message!') |
|
38 | + if (!Request::hasPost() || Request::getPost('submit') != 'Send Message!') |
|
39 | 39 | return (object) array('display' => 'normal'); |
40 | 40 | |
41 | 41 | Loader::load('utility', 'Validate'); |
42 | 42 | $error_result = array(); |
43 | - if(!Validate::checkRequest('post', 'name', 'string')) |
|
43 | + if (!Validate::checkRequest('post', 'name', 'string')) |
|
44 | 44 | $error_result['name'] = 'please enter your name'; |
45 | - if(!Validate::checkRequest('post', 'email', 'string')) |
|
45 | + if (!Validate::checkRequest('post', 'email', 'string')) |
|
46 | 46 | $error_result['email'] = 'please enter a valid email'; |
47 | - if(!Validate::checkRequest('post', 'message', 'string')) |
|
47 | + if (!Validate::checkRequest('post', 'message', 'string')) |
|
48 | 48 | $error_result['message'] = 'please write a message'; |
49 | 49 | |
50 | 50 | $values = (object) array( |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | 'email' => Request::getPost('email'), |
53 | 53 | 'message' => Request::getPost('message')); |
54 | 54 | |
55 | - if(count($error_result) > 0) |
|
55 | + if (count($error_result) > 0) |
|
56 | 56 | { |
57 | 57 | return (object) array( |
58 | 58 | 'display' => 'error', |
@@ -65,8 +65,8 @@ discard block |
||
65 | 65 | ->addTo($container['config']->admin_email) |
66 | 66 | ->setSubject('Home Page Contact') |
67 | 67 | ->setPlainMessage( |
68 | - "Name: {$values->name}\n" . |
|
69 | - "Email: {$values->email}\n" . |
|
68 | + "Name: {$values->name}\n". |
|
69 | + "Email: {$values->email}\n". |
|
70 | 70 | "Message: {$values->message}" |
71 | 71 | ) |
72 | 72 | ->send(); |
@@ -27,8 +27,9 @@ |
||
27 | 27 | $alias = URLDecode::getPiece(3); |
28 | 28 | $this->tag = LogTagCollector::getTag($alias); |
29 | 29 | |
30 | - if(!$this->tag) |
|
31 | - $this->eject(); |
|
30 | + if(!$this->tag) { |
|
31 | + $this->eject(); |
|
32 | + } |
|
32 | 33 | |
33 | 34 | parent::__construct(); |
34 | 35 | } |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | $alias = URLDecode::getPiece(3); |
28 | 28 | $this->tag = LogTagCollector::getTag($alias); |
29 | 29 | |
30 | - if(!$this->tag) |
|
30 | + if (!$this->tag) |
|
31 | 31 | $this->eject(); |
32 | 32 | |
33 | 33 | parent::__construct(); |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | { |
38 | 38 | $meta_array = array(); |
39 | 39 | |
40 | - $meta_array['title'] = "{$this->tag->name} | " . self::$WEBSITE_TITLE; |
|
40 | + $meta_array['title'] = "{$this->tag->name} | ".self::$WEBSITE_TITLE; |
|
41 | 41 | $meta_array['description'] = $this->tag->name; |
42 | 42 | $meta_array['keywords'] = $this->get_keyword_array(); |
43 | 43 | |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | { |
49 | 49 | $meta_array = array(); |
50 | 50 | |
51 | - $meta_array['title'] = sprintf(self::$DEFAULT_TITLE . ' | ' . self::$WEBSITE_TITLE, $this->companion->name, $this->page, $this->page_count); |
|
51 | + $meta_array['title'] = sprintf(self::$DEFAULT_TITLE.' | '.self::$WEBSITE_TITLE, $this->companion->name, $this->page, $this->page_count); |
|
52 | 52 | $meta_array['description'] = sprintf(self::$DEFAULT_DESCRIPTION, $this->page, $this->page_count, $this->tag->name); |
53 | 53 | $meta_array['keywords'] = $this->get_keyword_array(); |
54 | 54 |
@@ -29,8 +29,9 @@ |
||
29 | 29 | $path = URLDecode::getPiece(1); |
30 | 30 | $this->watercourse = WatercourseCollector::getByAlias($path); |
31 | 31 | |
32 | - if(!$this->watercourse) |
|
33 | - $this->eject(); |
|
32 | + if(!$this->watercourse) { |
|
33 | + $this->eject(); |
|
34 | + } |
|
34 | 35 | |
35 | 36 | parent::__construct(); |
36 | 37 | } |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | $path = URLDecode::getPiece(1); |
30 | 30 | $this->watercourse = WatercourseCollector::getByAlias($path); |
31 | 31 | |
32 | - if(!$this->watercourse) |
|
32 | + if (!$this->watercourse) |
|
33 | 33 | $this->eject(); |
34 | 34 | |
35 | 35 | parent::__construct(); |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | { |
40 | 40 | $meta_array = array(); |
41 | 41 | |
42 | - $meta_array['title'] = "{$this->watercourse->name} | " . self::$WEBSITE_TITLE; |
|
42 | + $meta_array['title'] = "{$this->watercourse->name} | ".self::$WEBSITE_TITLE; |
|
43 | 43 | $meta_array['description'] = $this->watercourse->description; |
44 | 44 | $meta_array['keywords'] = $this->get_keyword_array(); |
45 | 45 | |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | { |
51 | 51 | $meta_array = array(); |
52 | 52 | |
53 | - $meta_array['title'] = sprintf(self::$DEFAULT_TITLE . ' | ' . self::$WEBSITE_TITLE, $this->watercourse->name, $this->page, $this->page_count); |
|
53 | + $meta_array['title'] = sprintf(self::$DEFAULT_TITLE.' | '.self::$WEBSITE_TITLE, $this->watercourse->name, $this->page, $this->page_count); |
|
54 | 54 | $meta_array['description'] = sprintf(self::$DEFAULT_DESCRIPTION, $this->page, $this->page_count, $this->watercourse->name); |
55 | 55 | $meta_array['keywords'] = $this->get_keyword_array(); |
56 | 56 |
@@ -95,9 +95,9 @@ discard block |
||
95 | 95 | abstract protected function get_initial_meta(); |
96 | 96 | abstract protected function get_subsequent_meta(); |
97 | 97 | |
98 | - final protected function set_body_data($page_type = 'normal') |
|
99 | - { |
|
100 | - parent::set_body_data($page_type); |
|
98 | + final protected function set_body_data($page_type = 'normal') |
|
99 | + { |
|
100 | + parent::set_body_data($page_type); |
|
101 | 101 | |
102 | 102 | $this->set_body('view', $this->get_list_view()); |
103 | 103 | $this->set_body('data', $this->get_list_body_data()); |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | { |
108 | 108 | $body_data_array = array(); |
109 | 109 | |
110 | - $body_data_array['introduction'] = $this->get_introduction(); |
|
110 | + $body_data_array['introduction'] = $this->get_introduction(); |
|
111 | 111 | $body_data_array['items'] = array_map(array($this, 'format_item'), $this->get_items()); |
112 | 112 | $body_data_array['navigation'] = array( |
113 | 113 | 'description' => $this->get_list_description(), |
@@ -20,15 +20,17 @@ discard block |
||
20 | 20 | $this->offset = ($this->page - 1) * $this->get_item_count_per_page(); |
21 | 21 | |
22 | 22 | $items = $this->get_items(); |
23 | - if(count($items) < 1) |
|
24 | - $this->eject(); |
|
23 | + if(count($items) < 1) { |
|
24 | + $this->eject(); |
|
25 | + } |
|
25 | 26 | } |
26 | 27 | |
27 | 28 | final protected function get_page_number() |
28 | 29 | { |
29 | 30 | $page = $this->get_page_number_piece(); |
30 | - if(isset($page) && is_numeric($page)) |
|
31 | - return $page; |
|
31 | + if(isset($page) && is_numeric($page)) { |
|
32 | + return $page; |
|
33 | + } |
|
32 | 34 | return 1; |
33 | 35 | } |
34 | 36 | |
@@ -41,8 +43,9 @@ discard block |
||
41 | 43 | |
42 | 44 | final private function get_introduction() |
43 | 45 | { |
44 | - if($this->page == 1) |
|
45 | - return $this->get_initial_introduction(); |
|
46 | + if($this->page == 1) { |
|
47 | + return $this->get_initial_introduction(); |
|
48 | + } |
|
46 | 49 | |
47 | 50 | return $this->get_subsequent_introduction(); |
48 | 51 | } |
@@ -68,8 +71,9 @@ discard block |
||
68 | 71 | private $item_count; |
69 | 72 | final private function get_item_count() |
70 | 73 | { |
71 | - if(!isset($this->item_count)) |
|
72 | - $this->item_count = $this->get_item_count_result(); |
|
74 | + if(!isset($this->item_count)) { |
|
75 | + $this->item_count = $this->get_item_count_result(); |
|
76 | + } |
|
73 | 77 | return $this->item_count; |
74 | 78 | } |
75 | 79 | |
@@ -82,10 +86,11 @@ discard block |
||
82 | 86 | $this->set_head('next_link', $this->get_list_next_link()); |
83 | 87 | $this->set_head('previous_link', $this->get_list_prev_link()); |
84 | 88 | |
85 | - if($this->page == 1) |
|
86 | - $meta_array = $this->get_initial_meta(); |
|
87 | - else |
|
88 | - $meta_array = $this->get_subsequent_meta(); |
|
89 | + if($this->page == 1) { |
|
90 | + $meta_array = $this->get_initial_meta(); |
|
91 | + } else { |
|
92 | + $meta_array = $this->get_subsequent_meta(); |
|
93 | + } |
|
89 | 94 | |
90 | 95 | $this->set_title($meta_array['title']); |
91 | 96 | $this->set_description($meta_array['description']); |
@@ -119,17 +124,20 @@ discard block |
||
119 | 124 | |
120 | 125 | final private function get_list_prev_link() |
121 | 126 | { |
122 | - if($this->page == 1) |
|
123 | - return; |
|
124 | - if($this->page == 2) |
|
125 | - return $this->get_list_link_root(); |
|
127 | + if($this->page == 1) { |
|
128 | + return; |
|
129 | + } |
|
130 | + if($this->page == 2) { |
|
131 | + return $this->get_list_link_root(); |
|
132 | + } |
|
126 | 133 | return $this->get_list_link_root() . ($this->page - 1) . '/'; |
127 | 134 | } |
128 | 135 | |
129 | 136 | final private function get_list_next_link() |
130 | 137 | { |
131 | - if(($this->page * $this->get_item_count_per_page()) >= $this->get_item_count()) |
|
132 | - return; |
|
138 | + if(($this->page * $this->get_item_count_per_page()) >= $this->get_item_count()) { |
|
139 | + return; |
|
140 | + } |
|
133 | 141 | return $this->get_list_link_root() . ($this->page + 1) . '/'; |
134 | 142 | } |
135 | 143 | |
@@ -139,15 +147,17 @@ discard block |
||
139 | 147 | { |
140 | 148 | $link_array = array(); |
141 | 149 | |
142 | - if($this->get_item_count_per_page() >= $this->get_item_count()) |
|
143 | - return $link_array; |
|
150 | + if($this->get_item_count_per_page() >= $this->get_item_count()) { |
|
151 | + return $link_array; |
|
152 | + } |
|
144 | 153 | |
145 | 154 | $link = new stdclass(); |
146 | 155 | $link->anchor = '« previous'; |
147 | - if($this->get_list_prev_link() !== null) |
|
148 | - $link->uri = $this->get_list_prev_link(); |
|
149 | - else |
|
150 | - $link->class = 'inactive'; |
|
156 | + if($this->get_list_prev_link() !== null) { |
|
157 | + $link->uri = $this->get_list_prev_link(); |
|
158 | + } else { |
|
159 | + $link->class = 'inactive'; |
|
160 | + } |
|
151 | 161 | $link_array[] = $link; |
152 | 162 | |
153 | 163 | for($i = 1; $i <= ceil($this->get_item_count() / $this->get_item_count_per_page()); $i++) |
@@ -155,14 +165,15 @@ discard block |
||
155 | 165 | $link = new stdclass(); |
156 | 166 | $link->anchor = $i; |
157 | 167 | |
158 | - if($i == $this->page) |
|
159 | - $link->class = 'current'; |
|
160 | - else |
|
168 | + if($i == $this->page) { |
|
169 | + $link->class = 'current'; |
|
170 | + } else |
|
161 | 171 | { |
162 | - if($i == 1) |
|
163 | - $link->uri = $this->get_list_link_root(); |
|
164 | - else |
|
165 | - $link->uri = $this->get_list_link_root() . $i . '/'; |
|
172 | + if($i == 1) { |
|
173 | + $link->uri = $this->get_list_link_root(); |
|
174 | + } else { |
|
175 | + $link->uri = $this->get_list_link_root() . $i . '/'; |
|
176 | + } |
|
166 | 177 | } |
167 | 178 | |
168 | 179 | $link_array[] = $link; |
@@ -170,10 +181,11 @@ discard block |
||
170 | 181 | |
171 | 182 | $link = new stdclass(); |
172 | 183 | $link->anchor = 'next »'; |
173 | - if($this->get_list_next_link() !== null) |
|
174 | - $link->uri = $this->get_list_next_link(); |
|
175 | - else |
|
176 | - $link->class = 'inactive'; |
|
184 | + if($this->get_list_next_link() !== null) { |
|
185 | + $link->uri = $this->get_list_next_link(); |
|
186 | + } else { |
|
187 | + $link->class = 'inactive'; |
|
188 | + } |
|
177 | 189 | $link_array[] = $link; |
178 | 190 | |
179 | 191 | return $link_array; |
@@ -20,14 +20,14 @@ discard block |
||
20 | 20 | $this->offset = ($this->page - 1) * $this->get_item_count_per_page(); |
21 | 21 | |
22 | 22 | $items = $this->get_items(); |
23 | - if(count($items) < 1) |
|
23 | + if (count($items) < 1) |
|
24 | 24 | $this->eject(); |
25 | 25 | } |
26 | 26 | |
27 | 27 | final protected function get_page_number() |
28 | 28 | { |
29 | 29 | $page = $this->get_page_number_piece(); |
30 | - if(isset($page) && is_numeric($page)) |
|
30 | + if (isset($page) && is_numeric($page)) |
|
31 | 31 | return $page; |
32 | 32 | return 1; |
33 | 33 | } |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | |
42 | 42 | final private function get_introduction() |
43 | 43 | { |
44 | - if($this->page == 1) |
|
44 | + if ($this->page == 1) |
|
45 | 45 | return $this->get_initial_introduction(); |
46 | 46 | |
47 | 47 | return $this->get_subsequent_introduction(); |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | private $items; |
54 | 54 | protected function get_items() |
55 | 55 | { |
56 | - if(!isset($this->items)) |
|
56 | + if (!isset($this->items)) |
|
57 | 57 | { |
58 | 58 | $total = $this->get_item_count_per_page(); |
59 | 59 | $offset = ($this->page - 1) * $this->get_item_count_per_page(); |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | private $item_count; |
69 | 69 | final private function get_item_count() |
70 | 70 | { |
71 | - if(!isset($this->item_count)) |
|
71 | + if (!isset($this->item_count)) |
|
72 | 72 | $this->item_count = $this->get_item_count_result(); |
73 | 73 | return $this->item_count; |
74 | 74 | } |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | $this->set_head('next_link', $this->get_list_next_link()); |
83 | 83 | $this->set_head('previous_link', $this->get_list_prev_link()); |
84 | 84 | |
85 | - if($this->page == 1) |
|
85 | + if ($this->page == 1) |
|
86 | 86 | $meta_array = $this->get_initial_meta(); |
87 | 87 | else |
88 | 88 | $meta_array = $this->get_subsequent_meta(); |
@@ -119,18 +119,18 @@ discard block |
||
119 | 119 | |
120 | 120 | final private function get_list_prev_link() |
121 | 121 | { |
122 | - if($this->page == 1) |
|
122 | + if ($this->page == 1) |
|
123 | 123 | return; |
124 | - if($this->page == 2) |
|
124 | + if ($this->page == 2) |
|
125 | 125 | return $this->get_list_link_root(); |
126 | - return $this->get_list_link_root() . ($this->page - 1) . '/'; |
|
126 | + return $this->get_list_link_root().($this->page - 1).'/'; |
|
127 | 127 | } |
128 | 128 | |
129 | 129 | final private function get_list_next_link() |
130 | 130 | { |
131 | - if(($this->page * $this->get_item_count_per_page()) >= $this->get_item_count()) |
|
131 | + if (($this->page * $this->get_item_count_per_page()) >= $this->get_item_count()) |
|
132 | 132 | return; |
133 | - return $this->get_list_link_root() . ($this->page + 1) . '/'; |
|
133 | + return $this->get_list_link_root().($this->page + 1).'/'; |
|
134 | 134 | } |
135 | 135 | |
136 | 136 | abstract protected function get_list_link_root(); |
@@ -139,30 +139,30 @@ discard block |
||
139 | 139 | { |
140 | 140 | $link_array = array(); |
141 | 141 | |
142 | - if($this->get_item_count_per_page() >= $this->get_item_count()) |
|
142 | + if ($this->get_item_count_per_page() >= $this->get_item_count()) |
|
143 | 143 | return $link_array; |
144 | 144 | |
145 | 145 | $link = new stdclass(); |
146 | 146 | $link->anchor = '« previous'; |
147 | - if($this->get_list_prev_link() !== null) |
|
147 | + if ($this->get_list_prev_link() !== null) |
|
148 | 148 | $link->uri = $this->get_list_prev_link(); |
149 | 149 | else |
150 | 150 | $link->class = 'inactive'; |
151 | 151 | $link_array[] = $link; |
152 | 152 | |
153 | - for($i = 1; $i <= ceil($this->get_item_count() / $this->get_item_count_per_page()); $i++) |
|
153 | + for ($i = 1; $i <= ceil($this->get_item_count() / $this->get_item_count_per_page()); $i++) |
|
154 | 154 | { |
155 | 155 | $link = new stdclass(); |
156 | 156 | $link->anchor = $i; |
157 | 157 | |
158 | - if($i == $this->page) |
|
158 | + if ($i == $this->page) |
|
159 | 159 | $link->class = 'current'; |
160 | 160 | else |
161 | 161 | { |
162 | - if($i == 1) |
|
162 | + if ($i == 1) |
|
163 | 163 | $link->uri = $this->get_list_link_root(); |
164 | 164 | else |
165 | - $link->uri = $this->get_list_link_root() . $i . '/'; |
|
165 | + $link->uri = $this->get_list_link_root().$i.'/'; |
|
166 | 166 | } |
167 | 167 | |
168 | 168 | $link_array[] = $link; |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | |
171 | 171 | $link = new stdclass(); |
172 | 172 | $link->anchor = 'next »'; |
173 | - if($this->get_list_next_link() !== null) |
|
173 | + if ($this->get_list_next_link() !== null) |
|
174 | 174 | $link->uri = $this->get_list_next_link(); |
175 | 175 | else |
176 | 176 | $link->class = 'inactive'; |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | |
193 | 193 | final protected function get_image_element($category, $path, $description, $size = 'small') |
194 | 194 | { |
195 | - switch($size) |
|
195 | + switch ($size) |
|
196 | 196 | { |
197 | 197 | case 'medium' : |
198 | 198 | $height = 375; |
@@ -6,62 +6,62 @@ |
||
6 | 6 | final class MapController extends DefaultPageController |
7 | 7 | { |
8 | 8 | |
9 | - private static $TITLE = 'Map of Upper Peninsula Waterfalls'; |
|
10 | - private static $DESCRIPTION = ''; |
|
11 | - private static $KEYWORD_ARRAY = array(); |
|
9 | + private static $TITLE = 'Map of Upper Peninsula Waterfalls'; |
|
10 | + private static $DESCRIPTION = ''; |
|
11 | + private static $KEYWORD_ARRAY = array(); |
|
12 | 12 | |
13 | - private static $HIDE_ON_INITIAL_LOAD_LIST = array( |
|
14 | - 'Lower Tahquamenon Falls', |
|
15 | - 'Rainbow Falls', |
|
16 | - 'Sandstone Falls', |
|
17 | - 'Upper Tahquamenon Falls', |
|
18 | - ); |
|
13 | + private static $HIDE_ON_INITIAL_LOAD_LIST = array( |
|
14 | + 'Lower Tahquamenon Falls', |
|
15 | + 'Rainbow Falls', |
|
16 | + 'Sandstone Falls', |
|
17 | + 'Upper Tahquamenon Falls', |
|
18 | + ); |
|
19 | 19 | |
20 | - public function __construct() |
|
21 | - { |
|
22 | - parent::__construct(); |
|
20 | + public function __construct() |
|
21 | + { |
|
22 | + parent::__construct(); |
|
23 | 23 | |
24 | - $this->add_js('https://maps.googleapis.com/maps/api/js?sensor=false'); |
|
25 | - $this->add_waterfall_js(); |
|
26 | - } |
|
24 | + $this->add_js('https://maps.googleapis.com/maps/api/js?sensor=false'); |
|
25 | + $this->add_waterfall_js(); |
|
26 | + } |
|
27 | 27 | |
28 | - protected function set_head_data() |
|
29 | - { |
|
30 | - parent::set_head_data(); |
|
28 | + protected function set_head_data() |
|
29 | + { |
|
30 | + parent::set_head_data(); |
|
31 | 31 | |
32 | - $this->set_title(self::$TITLE . ' | ' . self::$WEBSITE_TITLE); |
|
33 | - $this->set_description(self::$DESCRIPTION); |
|
34 | - $this->set_keywords(self::$KEYWORD_ARRAY); |
|
35 | - } |
|
32 | + $this->set_title(self::$TITLE . ' | ' . self::$WEBSITE_TITLE); |
|
33 | + $this->set_description(self::$DESCRIPTION); |
|
34 | + $this->set_keywords(self::$KEYWORD_ARRAY); |
|
35 | + } |
|
36 | 36 | |
37 | - protected function set_body_data($page_type = 'wide') |
|
38 | - { |
|
39 | - parent::set_body_data($page_type); |
|
37 | + protected function set_body_data($page_type = 'wide') |
|
38 | + { |
|
39 | + parent::set_body_data($page_type); |
|
40 | 40 | |
41 | - $this->set_head('full_page_map', true); |
|
42 | - $this->set_body('waterfall_list', $this->fetch_waterfall_list()); |
|
43 | - $this->set_body('view', 'Map'); |
|
44 | - } |
|
41 | + $this->set_head('full_page_map', true); |
|
42 | + $this->set_body('waterfall_list', $this->fetch_waterfall_list()); |
|
43 | + $this->set_body('view', 'Map'); |
|
44 | + } |
|
45 | 45 | |
46 | - private function fetch_waterfall_list() |
|
47 | - { |
|
48 | - $list = WaterfallCollector::getMapList(); |
|
49 | - array_walk($list, array($this, 'parse_waterfall')); |
|
50 | - return $list; |
|
51 | - } |
|
46 | + private function fetch_waterfall_list() |
|
47 | + { |
|
48 | + $list = WaterfallCollector::getMapList(); |
|
49 | + array_walk($list, array($this, 'parse_waterfall')); |
|
50 | + return $list; |
|
51 | + } |
|
52 | 52 | |
53 | - private function parse_waterfall(&$waterfall) |
|
54 | - { |
|
55 | - $waterfall = (object) array( |
|
56 | - 'name' => $waterfall->name, |
|
57 | - 'latitude' => $waterfall->latitude, |
|
58 | - 'longitude' => $waterfall->longitude, |
|
59 | - 'link' => "/{$waterfall->watercourse_alias}/{$waterfall->alias}/", |
|
60 | - 'image' => "/photo/{$waterfall->photo_category}/{$waterfall->photo}-size-medium.jpg", |
|
61 | - 'image_alt' => $waterfall->photo_description, |
|
62 | - 'watercourse' => $waterfall->watercourse, |
|
63 | - 'hide_on_initial_load' => (in_array($waterfall->name, self::$HIDE_ON_INITIAL_LOAD_LIST)), |
|
64 | - ); |
|
65 | - } |
|
53 | + private function parse_waterfall(&$waterfall) |
|
54 | + { |
|
55 | + $waterfall = (object) array( |
|
56 | + 'name' => $waterfall->name, |
|
57 | + 'latitude' => $waterfall->latitude, |
|
58 | + 'longitude' => $waterfall->longitude, |
|
59 | + 'link' => "/{$waterfall->watercourse_alias}/{$waterfall->alias}/", |
|
60 | + 'image' => "/photo/{$waterfall->photo_category}/{$waterfall->photo}-size-medium.jpg", |
|
61 | + 'image_alt' => $waterfall->photo_description, |
|
62 | + 'watercourse' => $waterfall->watercourse, |
|
63 | + 'hide_on_initial_load' => (in_array($waterfall->name, self::$HIDE_ON_INITIAL_LOAD_LIST)), |
|
64 | + ); |
|
65 | + } |
|
66 | 66 | |
67 | 67 | } |
@@ -29,7 +29,7 @@ |
||
29 | 29 | { |
30 | 30 | parent::set_head_data(); |
31 | 31 | |
32 | - $this->set_title(self::$TITLE . ' | ' . self::$WEBSITE_TITLE); |
|
32 | + $this->set_title(self::$TITLE.' | '.self::$WEBSITE_TITLE); |
|
33 | 33 | $this->set_description(self::$DESCRIPTION); |
34 | 34 | $this->set_keywords(self::$KEYWORD_ARRAY); |
35 | 35 | } |