@@ -5,206 +5,206 @@ |
||
5 | 5 | abstract class DefaultListController extends DefaultPageController |
6 | 6 | { |
7 | 7 | |
8 | - private static $IMAGE_ELEMENT_PATTERN = '<img src="/photo/%s/%s-size-%s.jpg" alt="%s" height="%s" width="%s" />'; |
|
9 | - |
|
10 | - protected $page; |
|
11 | - protected $page_count; |
|
12 | - protected $offset; |
|
13 | - |
|
14 | - public function __construct() |
|
15 | - { |
|
16 | - parent::__construct(); |
|
17 | - |
|
18 | - $this->page = $this->get_page_number(); |
|
19 | - $this->page_count = ceil($this->get_item_count() / $this->get_item_count_per_page()); |
|
20 | - $this->offset = ($this->page - 1) * $this->get_item_count_per_page(); |
|
21 | - |
|
22 | - $items = $this->get_items(); |
|
23 | - if(count($items) < 1) |
|
24 | - $this->eject(); |
|
25 | - } |
|
26 | - |
|
27 | - final protected function get_page_number() |
|
28 | - { |
|
29 | - $page = $this->get_page_number_piece(); |
|
30 | - if(isset($page) && is_numeric($page)) |
|
31 | - return $page; |
|
32 | - return 1; |
|
33 | - } |
|
34 | - |
|
35 | - abstract protected function get_page_number_piece(); |
|
36 | - |
|
37 | - abstract protected function get_item_count_per_page(); |
|
38 | - abstract protected function format_item($item); |
|
39 | - abstract protected function get_sidebar(); |
|
40 | - abstract protected function get_list_view(); |
|
41 | - |
|
42 | - final private function get_introduction() |
|
43 | - { |
|
44 | - if($this->page == 1) |
|
45 | - return $this->get_initial_introduction(); |
|
46 | - |
|
47 | - return $this->get_subsequent_introduction(); |
|
48 | - } |
|
49 | - |
|
50 | - abstract protected function get_initial_introduction(); |
|
51 | - abstract protected function get_subsequent_introduction(); |
|
52 | - |
|
53 | - private $items; |
|
54 | - protected function get_items() |
|
55 | - { |
|
56 | - if(!isset($this->items)) |
|
57 | - { |
|
58 | - $total = $this->get_item_count_per_page(); |
|
59 | - $offset = ($this->page - 1) * $this->get_item_count_per_page(); |
|
8 | + private static $IMAGE_ELEMENT_PATTERN = '<img src="/photo/%s/%s-size-%s.jpg" alt="%s" height="%s" width="%s" />'; |
|
9 | + |
|
10 | + protected $page; |
|
11 | + protected $page_count; |
|
12 | + protected $offset; |
|
13 | + |
|
14 | + public function __construct() |
|
15 | + { |
|
16 | + parent::__construct(); |
|
17 | + |
|
18 | + $this->page = $this->get_page_number(); |
|
19 | + $this->page_count = ceil($this->get_item_count() / $this->get_item_count_per_page()); |
|
20 | + $this->offset = ($this->page - 1) * $this->get_item_count_per_page(); |
|
21 | + |
|
22 | + $items = $this->get_items(); |
|
23 | + if(count($items) < 1) |
|
24 | + $this->eject(); |
|
25 | + } |
|
26 | + |
|
27 | + final protected function get_page_number() |
|
28 | + { |
|
29 | + $page = $this->get_page_number_piece(); |
|
30 | + if(isset($page) && is_numeric($page)) |
|
31 | + return $page; |
|
32 | + return 1; |
|
33 | + } |
|
34 | + |
|
35 | + abstract protected function get_page_number_piece(); |
|
36 | + |
|
37 | + abstract protected function get_item_count_per_page(); |
|
38 | + abstract protected function format_item($item); |
|
39 | + abstract protected function get_sidebar(); |
|
40 | + abstract protected function get_list_view(); |
|
41 | + |
|
42 | + final private function get_introduction() |
|
43 | + { |
|
44 | + if($this->page == 1) |
|
45 | + return $this->get_initial_introduction(); |
|
46 | + |
|
47 | + return $this->get_subsequent_introduction(); |
|
48 | + } |
|
49 | + |
|
50 | + abstract protected function get_initial_introduction(); |
|
51 | + abstract protected function get_subsequent_introduction(); |
|
52 | + |
|
53 | + private $items; |
|
54 | + protected function get_items() |
|
55 | + { |
|
56 | + if(!isset($this->items)) |
|
57 | + { |
|
58 | + $total = $this->get_item_count_per_page(); |
|
59 | + $offset = ($this->page - 1) * $this->get_item_count_per_page(); |
|
60 | 60 | |
61 | - $this->items = $this->get_item_result($total, $offset); |
|
62 | - } |
|
63 | - return $this->items; |
|
64 | - } |
|
61 | + $this->items = $this->get_item_result($total, $offset); |
|
62 | + } |
|
63 | + return $this->items; |
|
64 | + } |
|
65 | 65 | |
66 | - abstract protected function get_item_result($total, $offset); |
|
66 | + abstract protected function get_item_result($total, $offset); |
|
67 | 67 | |
68 | - private $item_count; |
|
69 | - final private function get_item_count() |
|
70 | - { |
|
71 | - if(!isset($this->item_count)) |
|
72 | - $this->item_count = $this->get_item_count_result(); |
|
73 | - return $this->item_count; |
|
74 | - } |
|
68 | + private $item_count; |
|
69 | + final private function get_item_count() |
|
70 | + { |
|
71 | + if(!isset($this->item_count)) |
|
72 | + $this->item_count = $this->get_item_count_result(); |
|
73 | + return $this->item_count; |
|
74 | + } |
|
75 | 75 | |
76 | - abstract protected function get_item_count_result(); |
|
76 | + abstract protected function get_item_count_result(); |
|
77 | 77 | |
78 | - final protected function set_head_data() |
|
79 | - { |
|
80 | - parent::set_head_data(); |
|
78 | + final protected function set_head_data() |
|
79 | + { |
|
80 | + parent::set_head_data(); |
|
81 | 81 | |
82 | - $this->set_head('next_link', $this->get_list_next_link()); |
|
83 | - $this->set_head('previous_link', $this->get_list_prev_link()); |
|
82 | + $this->set_head('next_link', $this->get_list_next_link()); |
|
83 | + $this->set_head('previous_link', $this->get_list_prev_link()); |
|
84 | 84 | |
85 | - if($this->page == 1) |
|
86 | - $meta_array = $this->get_initial_meta(); |
|
87 | - else |
|
88 | - $meta_array = $this->get_subsequent_meta(); |
|
85 | + if($this->page == 1) |
|
86 | + $meta_array = $this->get_initial_meta(); |
|
87 | + else |
|
88 | + $meta_array = $this->get_subsequent_meta(); |
|
89 | 89 | |
90 | - $this->set_title($meta_array['title']); |
|
91 | - $this->set_description($meta_array['description']); |
|
92 | - $this->set_keywords($meta_array['keywords']); |
|
93 | - } |
|
90 | + $this->set_title($meta_array['title']); |
|
91 | + $this->set_description($meta_array['description']); |
|
92 | + $this->set_keywords($meta_array['keywords']); |
|
93 | + } |
|
94 | 94 | |
95 | - abstract protected function get_initial_meta(); |
|
96 | - abstract protected function get_subsequent_meta(); |
|
95 | + abstract protected function get_initial_meta(); |
|
96 | + abstract protected function get_subsequent_meta(); |
|
97 | 97 | |
98 | 98 | final protected function set_body_data($page_type = 'normal') |
99 | 99 | { |
100 | 100 | parent::set_body_data($page_type); |
101 | 101 | |
102 | - $this->set_body('view', $this->get_list_view()); |
|
103 | - $this->set_body('data', $this->get_list_body_data()); |
|
104 | - } |
|
102 | + $this->set_body('view', $this->get_list_view()); |
|
103 | + $this->set_body('data', $this->get_list_body_data()); |
|
104 | + } |
|
105 | 105 | |
106 | - final private function get_list_body_data() |
|
107 | - { |
|
108 | - $body_data_array = array(); |
|
106 | + final private function get_list_body_data() |
|
107 | + { |
|
108 | + $body_data_array = array(); |
|
109 | 109 | |
110 | 110 | $body_data_array['introduction'] = $this->get_introduction(); |
111 | - $body_data_array['items'] = array_map(array($this, 'format_item'), $this->get_items()); |
|
112 | - $body_data_array['navigation'] = array( |
|
113 | - 'description' => $this->get_list_description(), |
|
114 | - 'list' => $this->get_list_link_array()); |
|
115 | - $body_data_array['sidebar'] = $this->get_sidebar(); |
|
116 | - |
|
117 | - return $body_data_array; |
|
118 | - } |
|
119 | - |
|
120 | - final private function get_list_prev_link() |
|
121 | - { |
|
122 | - if($this->page == 1) |
|
123 | - return; |
|
124 | - if($this->page == 2) |
|
125 | - return $this->get_list_link_root(); |
|
126 | - return $this->get_list_link_root() . ($this->page - 1) . '/'; |
|
127 | - } |
|
128 | - |
|
129 | - final private function get_list_next_link() |
|
130 | - { |
|
131 | - if(($this->page * $this->get_item_count_per_page()) >= $this->get_item_count()) |
|
132 | - return; |
|
133 | - return $this->get_list_link_root() . ($this->page + 1) . '/'; |
|
134 | - } |
|
135 | - |
|
136 | - abstract protected function get_list_link_root(); |
|
137 | - |
|
138 | - final private function get_list_link_array() |
|
139 | - { |
|
140 | - $link_array = array(); |
|
141 | - |
|
142 | - if($this->get_item_count_per_page() >= $this->get_item_count()) |
|
143 | - return $link_array; |
|
144 | - |
|
145 | - $link = new stdclass(); |
|
146 | - $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'; |
|
151 | - $link_array[] = $link; |
|
152 | - |
|
153 | - for($i = 1; $i <= ceil($this->get_item_count() / $this->get_item_count_per_page()); $i++) |
|
154 | - { |
|
155 | - $link = new stdclass(); |
|
156 | - $link->anchor = $i; |
|
111 | + $body_data_array['items'] = array_map(array($this, 'format_item'), $this->get_items()); |
|
112 | + $body_data_array['navigation'] = array( |
|
113 | + 'description' => $this->get_list_description(), |
|
114 | + 'list' => $this->get_list_link_array()); |
|
115 | + $body_data_array['sidebar'] = $this->get_sidebar(); |
|
116 | + |
|
117 | + return $body_data_array; |
|
118 | + } |
|
119 | + |
|
120 | + final private function get_list_prev_link() |
|
121 | + { |
|
122 | + if($this->page == 1) |
|
123 | + return; |
|
124 | + if($this->page == 2) |
|
125 | + return $this->get_list_link_root(); |
|
126 | + return $this->get_list_link_root() . ($this->page - 1) . '/'; |
|
127 | + } |
|
128 | + |
|
129 | + final private function get_list_next_link() |
|
130 | + { |
|
131 | + if(($this->page * $this->get_item_count_per_page()) >= $this->get_item_count()) |
|
132 | + return; |
|
133 | + return $this->get_list_link_root() . ($this->page + 1) . '/'; |
|
134 | + } |
|
135 | + |
|
136 | + abstract protected function get_list_link_root(); |
|
137 | + |
|
138 | + final private function get_list_link_array() |
|
139 | + { |
|
140 | + $link_array = array(); |
|
141 | + |
|
142 | + if($this->get_item_count_per_page() >= $this->get_item_count()) |
|
143 | + return $link_array; |
|
144 | + |
|
145 | + $link = new stdclass(); |
|
146 | + $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'; |
|
151 | + $link_array[] = $link; |
|
152 | + |
|
153 | + for($i = 1; $i <= ceil($this->get_item_count() / $this->get_item_count_per_page()); $i++) |
|
154 | + { |
|
155 | + $link = new stdclass(); |
|
156 | + $link->anchor = $i; |
|
157 | 157 | |
158 | - if($i == $this->page) |
|
159 | - $link->class = 'current'; |
|
160 | - else |
|
161 | - { |
|
162 | - if($i == 1) |
|
163 | - $link->uri = $this->get_list_link_root(); |
|
164 | - else |
|
165 | - $link->uri = $this->get_list_link_root() . $i . '/'; |
|
166 | - } |
|
158 | + if($i == $this->page) |
|
159 | + $link->class = 'current'; |
|
160 | + else |
|
161 | + { |
|
162 | + if($i == 1) |
|
163 | + $link->uri = $this->get_list_link_root(); |
|
164 | + else |
|
165 | + $link->uri = $this->get_list_link_root() . $i . '/'; |
|
166 | + } |
|
167 | 167 | |
168 | - $link_array[] = $link; |
|
169 | - } |
|
170 | - |
|
171 | - $link = new stdclass(); |
|
172 | - $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'; |
|
177 | - $link_array[] = $link; |
|
178 | - |
|
179 | - return $link_array; |
|
180 | - } |
|
181 | - |
|
182 | - final private function get_list_description() |
|
183 | - { |
|
184 | - $start = ($this->page - 1) * $this->get_item_count_per_page() + 1; |
|
185 | - $end = min($this->page * $this->get_item_count_per_page(), $this->get_item_count()); |
|
186 | - $total = $this->get_item_count(); |
|
187 | - |
|
188 | - return sprintf($this->get_list_description_pattern(), $start, $end, $total); |
|
189 | - } |
|
190 | - |
|
191 | - abstract protected function get_list_description_pattern(); |
|
192 | - |
|
193 | - final protected function get_image_element($category, $path, $description, $size = 'small') |
|
194 | - { |
|
195 | - switch($size) |
|
196 | - { |
|
197 | - case 'medium' : |
|
198 | - $height = 375; |
|
199 | - $width = 500; |
|
200 | - break; |
|
201 | - case 'small' : |
|
202 | - $height = 180; |
|
203 | - $width = 240; |
|
204 | - break; |
|
205 | - } |
|
206 | - |
|
207 | - return sprintf(self::$IMAGE_ELEMENT_PATTERN, $category, $path, $size, $description, $height, $width); |
|
208 | - } |
|
168 | + $link_array[] = $link; |
|
169 | + } |
|
170 | + |
|
171 | + $link = new stdclass(); |
|
172 | + $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'; |
|
177 | + $link_array[] = $link; |
|
178 | + |
|
179 | + return $link_array; |
|
180 | + } |
|
181 | + |
|
182 | + final private function get_list_description() |
|
183 | + { |
|
184 | + $start = ($this->page - 1) * $this->get_item_count_per_page() + 1; |
|
185 | + $end = min($this->page * $this->get_item_count_per_page(), $this->get_item_count()); |
|
186 | + $total = $this->get_item_count(); |
|
187 | + |
|
188 | + return sprintf($this->get_list_description_pattern(), $start, $end, $total); |
|
189 | + } |
|
190 | + |
|
191 | + abstract protected function get_list_description_pattern(); |
|
192 | + |
|
193 | + final protected function get_image_element($category, $path, $description, $size = 'small') |
|
194 | + { |
|
195 | + switch($size) |
|
196 | + { |
|
197 | + case 'medium' : |
|
198 | + $height = 375; |
|
199 | + $width = 500; |
|
200 | + break; |
|
201 | + case 'small' : |
|
202 | + $height = 180; |
|
203 | + $width = 240; |
|
204 | + break; |
|
205 | + } |
|
206 | + |
|
207 | + return sprintf(self::$IMAGE_ELEMENT_PATTERN, $category, $path, $size, $description, $height, $width); |
|
208 | + } |
|
209 | 209 | |
210 | 210 | } |
211 | 211 | \ No newline at end of file |
@@ -6,104 +6,104 @@ |
||
6 | 6 | final class PeriodListController extends DefaultLogListController |
7 | 7 | { |
8 | 8 | |
9 | - private static $DEFAULT_TITLE = '%s Hiking Stories, Page %d of %d'; |
|
10 | - private static $DEFAULT_DESCRIPTION = 'Page %d of %d of epic %s hiking stories written by Jacob Emerick, all about his adventures hunting waterfalls in the Upper Peninsula of Michigan'; |
|
11 | - private static $DEFAULT_HEADER = 'Page %d of Awesome %s Waterfall Hiking Stories'; |
|
9 | + private static $DEFAULT_TITLE = '%s Hiking Stories, Page %d of %d'; |
|
10 | + private static $DEFAULT_DESCRIPTION = 'Page %d of %d of epic %s hiking stories written by Jacob Emerick, all about his adventures hunting waterfalls in the Upper Peninsula of Michigan'; |
|
11 | + private static $DEFAULT_HEADER = 'Page %d of Awesome %s Waterfall Hiking Stories'; |
|
12 | 12 | |
13 | - private static $KEYWORD_ARRAY = array( |
|
14 | - 'journal', |
|
15 | - 'stories', |
|
16 | - 'blog', |
|
17 | - 'waterfalls'); |
|
13 | + private static $KEYWORD_ARRAY = array( |
|
14 | + 'journal', |
|
15 | + 'stories', |
|
16 | + 'blog', |
|
17 | + 'waterfalls'); |
|
18 | 18 | |
19 | - private static $NAVIGATION_DESCRIPTION = 'displaying %d ~ %d of %d %PERIOD% journal entries'; |
|
20 | - private static $LINK_ROOT = '/period/%s/'; |
|
19 | + private static $NAVIGATION_DESCRIPTION = 'displaying %d ~ %d of %d %PERIOD% journal entries'; |
|
20 | + private static $LINK_ROOT = '/period/%s/'; |
|
21 | 21 | |
22 | - private $period; |
|
22 | + private $period; |
|
23 | 23 | |
24 | - public function __construct() |
|
25 | - { |
|
26 | - $alias = URLDecode::getPiece(2); |
|
27 | - $this->period = PeriodCollector::getByAlias($alias); |
|
24 | + public function __construct() |
|
25 | + { |
|
26 | + $alias = URLDecode::getPiece(2); |
|
27 | + $this->period = PeriodCollector::getByAlias($alias); |
|
28 | 28 | |
29 | - if(!$this->period) |
|
30 | - $this->eject(); |
|
29 | + if(!$this->period) |
|
30 | + $this->eject(); |
|
31 | 31 | |
32 | - parent::__construct(); |
|
33 | - } |
|
32 | + parent::__construct(); |
|
33 | + } |
|
34 | 34 | |
35 | - protected function get_initial_meta() |
|
36 | - { |
|
37 | - $meta_array = array(); |
|
35 | + protected function get_initial_meta() |
|
36 | + { |
|
37 | + $meta_array = array(); |
|
38 | 38 | |
39 | - $meta_array['title'] = "Hiking Stories - {$this->period->name} | " . self::$WEBSITE_TITLE; |
|
40 | - $meta_array['description'] = $this->period->description; |
|
41 | - $meta_array['keywords'] = $this->get_keyword_array(); |
|
39 | + $meta_array['title'] = "Hiking Stories - {$this->period->name} | " . self::$WEBSITE_TITLE; |
|
40 | + $meta_array['description'] = $this->period->description; |
|
41 | + $meta_array['keywords'] = $this->get_keyword_array(); |
|
42 | 42 | |
43 | - return $meta_array; |
|
44 | - } |
|
43 | + return $meta_array; |
|
44 | + } |
|
45 | 45 | |
46 | - protected function get_subsequent_meta() |
|
47 | - { |
|
48 | - $meta_array = array(); |
|
46 | + protected function get_subsequent_meta() |
|
47 | + { |
|
48 | + $meta_array = array(); |
|
49 | 49 | |
50 | - $meta_array['title'] = sprintf(self::$DEFAULT_TITLE . ' | ' . self::$WEBSITE_TITLE, $this->period->name, $this->page, $this->page_count); |
|
51 | - $meta_array['description'] = sprintf(self::$DEFAULT_DESCRIPTION, $this->page, $this->page_count, $this->period->name); |
|
52 | - $meta_array['keywords'] = $this->get_keyword_array(); |
|
50 | + $meta_array['title'] = sprintf(self::$DEFAULT_TITLE . ' | ' . self::$WEBSITE_TITLE, $this->period->name, $this->page, $this->page_count); |
|
51 | + $meta_array['description'] = sprintf(self::$DEFAULT_DESCRIPTION, $this->page, $this->page_count, $this->period->name); |
|
52 | + $meta_array['keywords'] = $this->get_keyword_array(); |
|
53 | 53 | |
54 | - return $meta_array; |
|
55 | - } |
|
56 | - |
|
57 | - private function get_keyword_array() |
|
58 | - { |
|
59 | - $keyword_array = self::$KEYWORD_ARRAY; |
|
60 | - array_unshift($keyword_array, strtolower($this->period->name)); |
|
61 | - return $keyword_array; |
|
62 | - } |
|
63 | - |
|
64 | - protected function get_initial_introduction() |
|
65 | - { |
|
66 | - $introduction = array(); |
|
54 | + return $meta_array; |
|
55 | + } |
|
56 | + |
|
57 | + private function get_keyword_array() |
|
58 | + { |
|
59 | + $keyword_array = self::$KEYWORD_ARRAY; |
|
60 | + array_unshift($keyword_array, strtolower($this->period->name)); |
|
61 | + return $keyword_array; |
|
62 | + } |
|
63 | + |
|
64 | + protected function get_initial_introduction() |
|
65 | + { |
|
66 | + $introduction = array(); |
|
67 | 67 | |
68 | - $introduction['title'] = $this->period->title; |
|
69 | - $introduction['description'] = Content::instance('FixInternalLink', $this->period->introduction)->activate(); |
|
70 | - $introduction['image'] = $this->get_image_element($this->period->photo_category, $this->period->photo, $this->period->photo_description, 'medium'); |
|
68 | + $introduction['title'] = $this->period->title; |
|
69 | + $introduction['description'] = Content::instance('FixInternalLink', $this->period->introduction)->activate(); |
|
70 | + $introduction['image'] = $this->get_image_element($this->period->photo_category, $this->period->photo, $this->period->photo_description, 'medium'); |
|
71 | 71 | |
72 | - return $introduction; |
|
73 | - } |
|
74 | - |
|
75 | - protected function get_subsequent_introduction() |
|
76 | - { |
|
77 | - return array( |
|
78 | - 'title' => sprintf(self::$DEFAULT_HEADER, $this->page, $this->period->name)); |
|
79 | - } |
|
80 | - |
|
81 | - protected function get_page_number_piece() |
|
82 | - { |
|
83 | - return URLDecode::getPiece(3); |
|
84 | - } |
|
85 | - |
|
86 | - protected function get_item_result($total, $offset) |
|
87 | - { |
|
88 | - return PeriodCollector::getLogListForPeriod($this->period->id, $total, $offset); |
|
89 | - } |
|
90 | - |
|
91 | - protected function get_item_count_result() |
|
92 | - { |
|
93 | - return PeriodCollector::getLogCountForPeriod($this->period->id); |
|
94 | - } |
|
95 | - |
|
96 | - protected function get_list_description_pattern() |
|
97 | - { |
|
98 | - $period = $this->period->name; |
|
99 | - $period = strtolower($period); |
|
100 | - $navigation_description = str_replace('%PERIOD%', $period, self::$NAVIGATION_DESCRIPTION); |
|
101 | - return $navigation_description; |
|
102 | - } |
|
103 | - |
|
104 | - protected function get_list_link_root() |
|
105 | - { |
|
106 | - return sprintf(self::$LINK_ROOT, $this->period->alias); |
|
107 | - } |
|
72 | + return $introduction; |
|
73 | + } |
|
74 | + |
|
75 | + protected function get_subsequent_introduction() |
|
76 | + { |
|
77 | + return array( |
|
78 | + 'title' => sprintf(self::$DEFAULT_HEADER, $this->page, $this->period->name)); |
|
79 | + } |
|
80 | + |
|
81 | + protected function get_page_number_piece() |
|
82 | + { |
|
83 | + return URLDecode::getPiece(3); |
|
84 | + } |
|
85 | + |
|
86 | + protected function get_item_result($total, $offset) |
|
87 | + { |
|
88 | + return PeriodCollector::getLogListForPeriod($this->period->id, $total, $offset); |
|
89 | + } |
|
90 | + |
|
91 | + protected function get_item_count_result() |
|
92 | + { |
|
93 | + return PeriodCollector::getLogCountForPeriod($this->period->id); |
|
94 | + } |
|
95 | + |
|
96 | + protected function get_list_description_pattern() |
|
97 | + { |
|
98 | + $period = $this->period->name; |
|
99 | + $period = strtolower($period); |
|
100 | + $navigation_description = str_replace('%PERIOD%', $period, self::$NAVIGATION_DESCRIPTION); |
|
101 | + return $navigation_description; |
|
102 | + } |
|
103 | + |
|
104 | + protected function get_list_link_root() |
|
105 | + { |
|
106 | + return sprintf(self::$LINK_ROOT, $this->period->alias); |
|
107 | + } |
|
108 | 108 | |
109 | 109 | } |
110 | 110 | \ No newline at end of file |
@@ -6,102 +6,102 @@ |
||
6 | 6 | final class CompanionListController extends DefaultLogListController |
7 | 7 | { |
8 | 8 | |
9 | - private static $DEFAULT_TITLE = 'Hiking with %s, Page %d of %d'; |
|
10 | - private static $DEFAULT_DESCRIPTION = 'Page %d of %d of legendary hiking stories with %s written by Jacob Emerick, all about his adventures hunting waterfalls in the Upper Peninsula of Michigan'; |
|
11 | - private static $DEFAULT_HEADER = 'Page %d of Legendary Hiking Stories with %s'; |
|
12 | - |
|
13 | - private static $KEYWORD_ARRAY = array( |
|
14 | - 'hiking companions', |
|
15 | - 'journal', |
|
16 | - 'stories', |
|
17 | - 'blog', |
|
18 | - 'waterfalls'); |
|
19 | - |
|
20 | - private static $NAVIGATION_DESCRIPTION = 'displaying %d ~ %d of %d journal entries with %COMPANION%'; |
|
21 | - private static $LINK_ROOT = '/companion/%s/'; |
|
22 | - |
|
23 | - private $companion; |
|
24 | - |
|
25 | - public function __construct() |
|
26 | - { |
|
27 | - $alias = URLDecode::getPiece(2); |
|
28 | - $this->companion = CompanionCollector::getByAlias($alias); |
|
9 | + private static $DEFAULT_TITLE = 'Hiking with %s, Page %d of %d'; |
|
10 | + private static $DEFAULT_DESCRIPTION = 'Page %d of %d of legendary hiking stories with %s written by Jacob Emerick, all about his adventures hunting waterfalls in the Upper Peninsula of Michigan'; |
|
11 | + private static $DEFAULT_HEADER = 'Page %d of Legendary Hiking Stories with %s'; |
|
12 | + |
|
13 | + private static $KEYWORD_ARRAY = array( |
|
14 | + 'hiking companions', |
|
15 | + 'journal', |
|
16 | + 'stories', |
|
17 | + 'blog', |
|
18 | + 'waterfalls'); |
|
19 | + |
|
20 | + private static $NAVIGATION_DESCRIPTION = 'displaying %d ~ %d of %d journal entries with %COMPANION%'; |
|
21 | + private static $LINK_ROOT = '/companion/%s/'; |
|
22 | + |
|
23 | + private $companion; |
|
24 | + |
|
25 | + public function __construct() |
|
26 | + { |
|
27 | + $alias = URLDecode::getPiece(2); |
|
28 | + $this->companion = CompanionCollector::getByAlias($alias); |
|
29 | 29 | |
30 | - if(!$this->companion) |
|
31 | - $this->eject(); |
|
30 | + if(!$this->companion) |
|
31 | + $this->eject(); |
|
32 | 32 | |
33 | - parent::__construct(); |
|
34 | - } |
|
33 | + parent::__construct(); |
|
34 | + } |
|
35 | 35 | |
36 | - protected function get_initial_meta() |
|
37 | - { |
|
38 | - $meta_array = array(); |
|
36 | + protected function get_initial_meta() |
|
37 | + { |
|
38 | + $meta_array = array(); |
|
39 | 39 | |
40 | - $meta_array['title'] = "Hiking Stories with {$this->companion->name} | " . self::$WEBSITE_TITLE; |
|
41 | - $meta_array['description'] = $this->companion->description; |
|
42 | - $meta_array['keywords'] = $this->get_keyword_array(); |
|
40 | + $meta_array['title'] = "Hiking Stories with {$this->companion->name} | " . self::$WEBSITE_TITLE; |
|
41 | + $meta_array['description'] = $this->companion->description; |
|
42 | + $meta_array['keywords'] = $this->get_keyword_array(); |
|
43 | 43 | |
44 | - return $meta_array; |
|
45 | - } |
|
44 | + return $meta_array; |
|
45 | + } |
|
46 | 46 | |
47 | - protected function get_subsequent_meta() |
|
48 | - { |
|
49 | - $meta_array = array(); |
|
47 | + protected function get_subsequent_meta() |
|
48 | + { |
|
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); |
|
52 | - $meta_array['description'] = sprintf(self::$DEFAULT_DESCRIPTION, $this->page, $this->page_count, $this->companion->name); |
|
53 | - $meta_array['keywords'] = $this->get_keyword_array(); |
|
51 | + $meta_array['title'] = sprintf(self::$DEFAULT_TITLE . ' | ' . self::$WEBSITE_TITLE, $this->companion->name, $this->page, $this->page_count); |
|
52 | + $meta_array['description'] = sprintf(self::$DEFAULT_DESCRIPTION, $this->page, $this->page_count, $this->companion->name); |
|
53 | + $meta_array['keywords'] = $this->get_keyword_array(); |
|
54 | 54 | |
55 | - return $meta_array; |
|
56 | - } |
|
57 | - |
|
58 | - private function get_keyword_array() |
|
59 | - { |
|
60 | - $keyword_array = self::$KEYWORD_ARRAY; |
|
61 | - array_unshift($keyword_array, strtolower($this->companion->name)); |
|
62 | - return $keyword_array; |
|
63 | - } |
|
64 | - |
|
65 | - protected function get_initial_introduction() |
|
66 | - { |
|
67 | - $introduction = array(); |
|
55 | + return $meta_array; |
|
56 | + } |
|
57 | + |
|
58 | + private function get_keyword_array() |
|
59 | + { |
|
60 | + $keyword_array = self::$KEYWORD_ARRAY; |
|
61 | + array_unshift($keyword_array, strtolower($this->companion->name)); |
|
62 | + return $keyword_array; |
|
63 | + } |
|
64 | + |
|
65 | + protected function get_initial_introduction() |
|
66 | + { |
|
67 | + $introduction = array(); |
|
68 | 68 | |
69 | - $introduction['title'] = $this->companion->title; |
|
70 | - $introduction['description'] = Content::instance('FixInternalLink', $this->companion->introduction)->activate(); |
|
71 | - $introduction['image'] = $this->get_image_element($this->companion->photo_category, $this->companion->photo, $this->companion->photo_description, 'medium'); |
|
69 | + $introduction['title'] = $this->companion->title; |
|
70 | + $introduction['description'] = Content::instance('FixInternalLink', $this->companion->introduction)->activate(); |
|
71 | + $introduction['image'] = $this->get_image_element($this->companion->photo_category, $this->companion->photo, $this->companion->photo_description, 'medium'); |
|
72 | 72 | |
73 | - return $introduction; |
|
74 | - } |
|
75 | - |
|
76 | - protected function get_subsequent_introduction() |
|
77 | - { |
|
78 | - return array( |
|
79 | - 'title' => sprintf(self::$DEFAULT_HEADER, $this->page, $this->companion->name)); |
|
80 | - } |
|
81 | - |
|
82 | - protected function get_page_number_piece() |
|
83 | - { |
|
84 | - return URLDecode::getPiece(3); |
|
85 | - } |
|
86 | - |
|
87 | - protected function get_item_result($total, $offset) |
|
88 | - { |
|
89 | - return CompanionCollector::getLogListForCompanion($this->companion->id, $total, $offset); |
|
90 | - } |
|
91 | - |
|
92 | - protected function get_item_count_result() |
|
93 | - { |
|
94 | - return CompanionCollector::getLogCountForCompanion($this->companion->id); |
|
95 | - } |
|
96 | - |
|
97 | - protected function get_list_description_pattern() |
|
98 | - { |
|
99 | - return str_replace('%COMPANION%', $this->companion->name, self::$NAVIGATION_DESCRIPTION); |
|
100 | - } |
|
101 | - |
|
102 | - protected function get_list_link_root() |
|
103 | - { |
|
104 | - return sprintf(self::$LINK_ROOT, $this->companion->alias); |
|
105 | - } |
|
73 | + return $introduction; |
|
74 | + } |
|
75 | + |
|
76 | + protected function get_subsequent_introduction() |
|
77 | + { |
|
78 | + return array( |
|
79 | + 'title' => sprintf(self::$DEFAULT_HEADER, $this->page, $this->companion->name)); |
|
80 | + } |
|
81 | + |
|
82 | + protected function get_page_number_piece() |
|
83 | + { |
|
84 | + return URLDecode::getPiece(3); |
|
85 | + } |
|
86 | + |
|
87 | + protected function get_item_result($total, $offset) |
|
88 | + { |
|
89 | + return CompanionCollector::getLogListForCompanion($this->companion->id, $total, $offset); |
|
90 | + } |
|
91 | + |
|
92 | + protected function get_item_count_result() |
|
93 | + { |
|
94 | + return CompanionCollector::getLogCountForCompanion($this->companion->id); |
|
95 | + } |
|
96 | + |
|
97 | + protected function get_list_description_pattern() |
|
98 | + { |
|
99 | + return str_replace('%COMPANION%', $this->companion->name, self::$NAVIGATION_DESCRIPTION); |
|
100 | + } |
|
101 | + |
|
102 | + protected function get_list_link_root() |
|
103 | + { |
|
104 | + return sprintf(self::$LINK_ROOT, $this->companion->alias); |
|
105 | + } |
|
106 | 106 | |
107 | 107 | } |
108 | 108 | \ No newline at end of file |
@@ -1,97 +1,97 @@ |
||
1 | 1 | <? |
2 | 2 | |
3 | 3 | Loader::load('collector', array( |
4 | - 'image/PhotoCollector', |
|
5 | - 'waterfall/LogCollector')); |
|
4 | + 'image/PhotoCollector', |
|
5 | + 'waterfall/LogCollector')); |
|
6 | 6 | Loader::load('controller', 'waterfalls/DefaultLogListController'); |
7 | 7 | |
8 | 8 | final class LogListController extends DefaultLogListController |
9 | 9 | { |
10 | 10 | |
11 | - private static $PRIMARY_TITLE = 'Journal from Waterfall Hikes'; |
|
12 | - private static $PRIMARY_DESCRIPTION = 'Stories written by Jacob Emerick about his epic waterfall adventures in the general Keweenaw, Ontonagon, and Marquette areas.'; |
|
13 | - private static $PRIMARY_INTRODUCTION_HEADER = 'Journal of Waterfall Adventuring'; |
|
14 | - private static $PRIMARY_INTRODUCTION_IMAGE = 707; |
|
15 | - private static $PRIMARY_INTRODUCTION_DESCRIPTION = 'Whether he is hiking alone through the woods, with Logan running ahead to chase down deer, or with a group of friends, every hike that Jacob sets out turns into an adventure. Hopping from slick rock to rock along a small creek in the city, splashing through deep water over an uncertain riverbed, or pushing thick branches out of the way in thick brush, every journey turns into a little story of discovery.'; |
|
16 | - |
|
17 | - private static $SECONDARY_TITLE = 'Journal Entries - Page %d'; |
|
18 | - private static $SECONDARY_DESCRIPTION = 'Page %d of %d of epic hiking stories written by Jacob Emerick, all about his adventures hunting waterfalls in the Upper Peninsula of Michigan'; |
|
19 | - private static $SECONDARY_INTRODUCTION_HEADER = 'Waterfall Adventure Journal, Page %d of %d'; |
|
20 | - |
|
21 | - private static $KEYWORD_ARRAY = array( |
|
22 | - 'journal', |
|
23 | - 'travel log', |
|
24 | - 'blog', |
|
25 | - 'waterfalls', |
|
26 | - 'hiking companions'); |
|
27 | - |
|
28 | - private static $NAVIGATION_DESCRIPTION = 'displaying %d ~ %d of %d total journal entries'; |
|
29 | - private static $LINK_ROOT = '/journal/'; |
|
30 | - |
|
31 | - protected function get_initial_meta() |
|
32 | - { |
|
33 | - $meta_array = array(); |
|
11 | + private static $PRIMARY_TITLE = 'Journal from Waterfall Hikes'; |
|
12 | + private static $PRIMARY_DESCRIPTION = 'Stories written by Jacob Emerick about his epic waterfall adventures in the general Keweenaw, Ontonagon, and Marquette areas.'; |
|
13 | + private static $PRIMARY_INTRODUCTION_HEADER = 'Journal of Waterfall Adventuring'; |
|
14 | + private static $PRIMARY_INTRODUCTION_IMAGE = 707; |
|
15 | + private static $PRIMARY_INTRODUCTION_DESCRIPTION = 'Whether he is hiking alone through the woods, with Logan running ahead to chase down deer, or with a group of friends, every hike that Jacob sets out turns into an adventure. Hopping from slick rock to rock along a small creek in the city, splashing through deep water over an uncertain riverbed, or pushing thick branches out of the way in thick brush, every journey turns into a little story of discovery.'; |
|
16 | + |
|
17 | + private static $SECONDARY_TITLE = 'Journal Entries - Page %d'; |
|
18 | + private static $SECONDARY_DESCRIPTION = 'Page %d of %d of epic hiking stories written by Jacob Emerick, all about his adventures hunting waterfalls in the Upper Peninsula of Michigan'; |
|
19 | + private static $SECONDARY_INTRODUCTION_HEADER = 'Waterfall Adventure Journal, Page %d of %d'; |
|
20 | + |
|
21 | + private static $KEYWORD_ARRAY = array( |
|
22 | + 'journal', |
|
23 | + 'travel log', |
|
24 | + 'blog', |
|
25 | + 'waterfalls', |
|
26 | + 'hiking companions'); |
|
27 | + |
|
28 | + private static $NAVIGATION_DESCRIPTION = 'displaying %d ~ %d of %d total journal entries'; |
|
29 | + private static $LINK_ROOT = '/journal/'; |
|
30 | + |
|
31 | + protected function get_initial_meta() |
|
32 | + { |
|
33 | + $meta_array = array(); |
|
34 | 34 | |
35 | - $meta_array['title'] = self::$PRIMARY_TITLE . ' | ' . self::$WEBSITE_TITLE; |
|
36 | - $meta_array['description'] = self::$PRIMARY_DESCRIPTION; |
|
37 | - $meta_array['keywords'] = self::$KEYWORD_ARRAY; |
|
35 | + $meta_array['title'] = self::$PRIMARY_TITLE . ' | ' . self::$WEBSITE_TITLE; |
|
36 | + $meta_array['description'] = self::$PRIMARY_DESCRIPTION; |
|
37 | + $meta_array['keywords'] = self::$KEYWORD_ARRAY; |
|
38 | 38 | |
39 | - return $meta_array; |
|
40 | - } |
|
39 | + return $meta_array; |
|
40 | + } |
|
41 | 41 | |
42 | - protected function get_subsequent_meta() |
|
43 | - { |
|
44 | - $meta_array = array(); |
|
42 | + protected function get_subsequent_meta() |
|
43 | + { |
|
44 | + $meta_array = array(); |
|
45 | 45 | |
46 | - $meta_array['title'] = sprintf(self::$SECONDARY_TITLE . ' | ' . self::$WEBSITE_TITLE, $this->page); |
|
47 | - $meta_array['description'] = sprintf(self::$SECONDARY_DESCRIPTION, $this->page, $this->page_count); |
|
48 | - $meta_array['keywords'] = self::$KEYWORD_ARRAY; |
|
46 | + $meta_array['title'] = sprintf(self::$SECONDARY_TITLE . ' | ' . self::$WEBSITE_TITLE, $this->page); |
|
47 | + $meta_array['description'] = sprintf(self::$SECONDARY_DESCRIPTION, $this->page, $this->page_count); |
|
48 | + $meta_array['keywords'] = self::$KEYWORD_ARRAY; |
|
49 | 49 | |
50 | - return $meta_array; |
|
51 | - } |
|
50 | + return $meta_array; |
|
51 | + } |
|
52 | 52 | |
53 | - protected function get_initial_introduction() |
|
54 | - { |
|
55 | - $introduction = array(); |
|
53 | + protected function get_initial_introduction() |
|
54 | + { |
|
55 | + $introduction = array(); |
|
56 | 56 | |
57 | - $introduction['title'] = self::$PRIMARY_INTRODUCTION_HEADER; |
|
58 | - $introduction['description'] = self::$PRIMARY_INTRODUCTION_DESCRIPTION; |
|
57 | + $introduction['title'] = self::$PRIMARY_INTRODUCTION_HEADER; |
|
58 | + $introduction['description'] = self::$PRIMARY_INTRODUCTION_DESCRIPTION; |
|
59 | 59 | |
60 | - $image = PhotoCollector::getRow(self::$PRIMARY_INTRODUCTION_IMAGE); |
|
61 | - $introduction['image'] = $this->get_image_element($image->category, $image->name, $image->description, 'medium'); |
|
60 | + $image = PhotoCollector::getRow(self::$PRIMARY_INTRODUCTION_IMAGE); |
|
61 | + $introduction['image'] = $this->get_image_element($image->category, $image->name, $image->description, 'medium'); |
|
62 | 62 | |
63 | - return $introduction; |
|
64 | - } |
|
65 | - |
|
66 | - protected function get_subsequent_introduction() |
|
67 | - { |
|
68 | - return array( |
|
69 | - 'title' => sprintf(self::$SECONDARY_INTRODUCTION_HEADER, $this->page, $this->page_count)); |
|
70 | - } |
|
71 | - |
|
72 | - protected function get_page_number_piece() |
|
73 | - { |
|
74 | - return URLDecode::getPiece(2); |
|
75 | - } |
|
76 | - |
|
77 | - protected function get_item_result($total, $offset) |
|
78 | - { |
|
79 | - return LogCollector::getList($total, $offset); |
|
80 | - } |
|
81 | - |
|
82 | - protected function get_item_count_result() |
|
83 | - { |
|
84 | - return LogCollector::getListCount(); |
|
85 | - } |
|
86 | - |
|
87 | - protected function get_list_description_pattern() |
|
88 | - { |
|
89 | - return self::$NAVIGATION_DESCRIPTION; |
|
90 | - } |
|
91 | - |
|
92 | - protected function get_list_link_root() |
|
93 | - { |
|
94 | - return self::$LINK_ROOT; |
|
95 | - } |
|
63 | + return $introduction; |
|
64 | + } |
|
65 | + |
|
66 | + protected function get_subsequent_introduction() |
|
67 | + { |
|
68 | + return array( |
|
69 | + 'title' => sprintf(self::$SECONDARY_INTRODUCTION_HEADER, $this->page, $this->page_count)); |
|
70 | + } |
|
71 | + |
|
72 | + protected function get_page_number_piece() |
|
73 | + { |
|
74 | + return URLDecode::getPiece(2); |
|
75 | + } |
|
76 | + |
|
77 | + protected function get_item_result($total, $offset) |
|
78 | + { |
|
79 | + return LogCollector::getList($total, $offset); |
|
80 | + } |
|
81 | + |
|
82 | + protected function get_item_count_result() |
|
83 | + { |
|
84 | + return LogCollector::getListCount(); |
|
85 | + } |
|
86 | + |
|
87 | + protected function get_list_description_pattern() |
|
88 | + { |
|
89 | + return self::$NAVIGATION_DESCRIPTION; |
|
90 | + } |
|
91 | + |
|
92 | + protected function get_list_link_root() |
|
93 | + { |
|
94 | + return self::$LINK_ROOT; |
|
95 | + } |
|
96 | 96 | |
97 | 97 | } |
98 | 98 | \ No newline at end of file |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | |
28 | 28 | $this->waterfall = WaterfallCollector::getByAlias($path_watercourse, $path_fall); |
29 | 29 | if (!$this->waterfall) { |
30 | - $this->eject(); |
|
30 | + $this->eject(); |
|
31 | 31 | } |
32 | 32 | |
33 | 33 | $this->handle_comment_submit( |
@@ -141,18 +141,18 @@ discard block |
||
141 | 141 | return $album; |
142 | 142 | } |
143 | 143 | |
144 | - private function get_sidebar($waterfall) |
|
145 | - { |
|
146 | - $sidebar_data = array(); |
|
147 | - $sidebar_data['name'] = $waterfall->name; |
|
148 | - $sidebar_data['watercourse'] = $waterfall->watercourse; |
|
144 | + private function get_sidebar($waterfall) |
|
145 | + { |
|
146 | + $sidebar_data = array(); |
|
147 | + $sidebar_data['name'] = $waterfall->name; |
|
148 | + $sidebar_data['watercourse'] = $waterfall->watercourse; |
|
149 | 149 | $sidebar_data['main_watercourse'] = $this->get_main_watercourse($waterfall->watercourse_alias); |
150 | - $sidebar_data['rating_display'] = ($waterfall->rating / 2) . '/5'; |
|
150 | + $sidebar_data['rating_display'] = ($waterfall->rating / 2) . '/5'; |
|
151 | 151 | $sidebar_data['rating'] = $waterfall->rating; |
152 | - $sidebar_data['height'] = Content::instance('ImperialUnit', $waterfall->height)->activate('inches'); |
|
153 | - $sidebar_data['width'] = Content::instance('ImperialUnit', $waterfall->width)->activate('inches'); |
|
154 | - $sidebar_data['drop_height'] = Content::instance('ImperialUnit', $waterfall->drop_height)->activate('inches'); |
|
155 | - $sidebar_data['drop_count'] = $waterfall->drop_count; |
|
152 | + $sidebar_data['height'] = Content::instance('ImperialUnit', $waterfall->height)->activate('inches'); |
|
153 | + $sidebar_data['width'] = Content::instance('ImperialUnit', $waterfall->width)->activate('inches'); |
|
154 | + $sidebar_data['drop_height'] = Content::instance('ImperialUnit', $waterfall->drop_height)->activate('inches'); |
|
155 | + $sidebar_data['drop_count'] = $waterfall->drop_count; |
|
156 | 156 | |
157 | 157 | $sidebar_data['county'] = (object) array ( |
158 | 158 | 'name' => $waterfall->county, |
@@ -160,10 +160,10 @@ discard block |
||
160 | 160 | 'title' => $waterfall->county_title, |
161 | 161 | ); |
162 | 162 | |
163 | - $sidebar_data['nearest_town'] = $waterfall->nearest_town; |
|
164 | - $sidebar_data['latitude'] = round($waterfall->latitude, 5); |
|
165 | - $sidebar_data['longitude'] = round($waterfall->longitude, 5); |
|
166 | - $sidebar_data['elevation'] = Content::instance('ImperialUnit', $waterfall->elevation)->activate('feet'); |
|
163 | + $sidebar_data['nearest_town'] = $waterfall->nearest_town; |
|
164 | + $sidebar_data['latitude'] = round($waterfall->latitude, 5); |
|
165 | + $sidebar_data['longitude'] = round($waterfall->longitude, 5); |
|
166 | + $sidebar_data['elevation'] = Content::instance('ImperialUnit', $waterfall->elevation)->activate('feet'); |
|
167 | 167 | |
168 | 168 | $sidebar_data['map'] = $this->get_map_piece($waterfall); |
169 | 169 | |
@@ -171,8 +171,8 @@ discard block |
||
171 | 171 | |
172 | 172 | $sidebar_data['nearby_list'] = $this->get_nearby_list($waterfall->id); |
173 | 173 | |
174 | - return $sidebar_data; |
|
175 | - } |
|
174 | + return $sidebar_data; |
|
175 | + } |
|
176 | 176 | |
177 | 177 | private function get_journal_list($waterfall) |
178 | 178 | { |
@@ -5,19 +5,19 @@ discard block |
||
5 | 5 | abstract class DefaultPageController extends PageController |
6 | 6 | { |
7 | 7 | |
8 | - protected static $WEBSITE_TITLE = 'Waterfalls of the Keweenaw'; |
|
9 | - protected static $PAGE_DESCRIPTION_LIMIT = 250; |
|
8 | + protected static $WEBSITE_TITLE = 'Waterfalls of the Keweenaw'; |
|
9 | + protected static $PAGE_DESCRIPTION_LIMIT = 250; |
|
10 | 10 | |
11 | - protected static $WATERFALL_SITE_ID = 5; |
|
11 | + protected static $WATERFALL_SITE_ID = 5; |
|
12 | 12 | |
13 | 13 | protected $parent_navigation_item = ''; |
14 | 14 | |
15 | - protected function set_head_data() |
|
16 | - { |
|
17 | - $this->set_head('google_verification', 'm9ua4n8lp4FUYYa2UOh51UyZYfdivl-kRTtXKwaH0-s'); |
|
18 | - $this->add_css('normalize'); |
|
19 | - $this->add_css('waterfalls'); |
|
20 | - } |
|
15 | + protected function set_head_data() |
|
16 | + { |
|
17 | + $this->set_head('google_verification', 'm9ua4n8lp4FUYYa2UOh51UyZYfdivl-kRTtXKwaH0-s'); |
|
18 | + $this->add_css('normalize'); |
|
19 | + $this->add_css('waterfalls'); |
|
20 | + } |
|
21 | 21 | |
22 | 22 | protected function add_waterfall_js() |
23 | 23 | { |
@@ -26,9 +26,9 @@ discard block |
||
26 | 26 | $this->add_js('waterfalls'); |
27 | 27 | } |
28 | 28 | |
29 | - protected function set_body_data($page_type = 'normal') |
|
30 | - { |
|
31 | - $this->set_body('activity_array', $this->get_recent_activity()); |
|
29 | + protected function set_body_data($page_type = 'normal') |
|
30 | + { |
|
31 | + $this->set_body('activity_array', $this->get_recent_activity()); |
|
32 | 32 | |
33 | 33 | $this->set_body('main_navigation', array( |
34 | 34 | (object) array( |
@@ -6,109 +6,109 @@ |
||
6 | 6 | final class WatercourseListController extends DefaultWaterfallListController |
7 | 7 | { |
8 | 8 | |
9 | - private static $DEFAULT_TITLE = 'Hiking with %s, Page %d of %d'; |
|
10 | - private static $DEFAULT_DESCRIPTION = 'Page %d of %d of legendary hiking stories with %s written by Jacob Emerick, all about his adventures hunting waterfalls in the Upper Peninsula of Michigan'; |
|
11 | - private static $DEFAULT_HEADER = 'Page %d of Legendary Hiking Stories with %s'; |
|
9 | + private static $DEFAULT_TITLE = 'Hiking with %s, Page %d of %d'; |
|
10 | + private static $DEFAULT_DESCRIPTION = 'Page %d of %d of legendary hiking stories with %s written by Jacob Emerick, all about his adventures hunting waterfalls in the Upper Peninsula of Michigan'; |
|
11 | + private static $DEFAULT_HEADER = 'Page %d of Legendary Hiking Stories with %s'; |
|
12 | 12 | |
13 | - private static $KEYWORD_ARRAY = array( |
|
14 | - 'hiking companions', |
|
15 | - 'journal', |
|
16 | - 'stories', |
|
17 | - 'blog', |
|
18 | - 'waterfalls'); |
|
13 | + private static $KEYWORD_ARRAY = array( |
|
14 | + 'hiking companions', |
|
15 | + 'journal', |
|
16 | + 'stories', |
|
17 | + 'blog', |
|
18 | + 'waterfalls'); |
|
19 | 19 | |
20 | - private static $NAVIGATION_DESCRIPTION = 'displaying %d ~ %d of %d waterfalls in %COUNTY%'; |
|
21 | - private static $LINK_ROOT = '/%s/'; |
|
20 | + private static $NAVIGATION_DESCRIPTION = 'displaying %d ~ %d of %d waterfalls in %COUNTY%'; |
|
21 | + private static $LINK_ROOT = '/%s/'; |
|
22 | 22 | |
23 | - protected static $ITEM_COUNT_PER_PAGE = 12; |
|
23 | + protected static $ITEM_COUNT_PER_PAGE = 12; |
|
24 | 24 | |
25 | - private $watercourse; |
|
25 | + private $watercourse; |
|
26 | 26 | |
27 | - public function __construct() |
|
28 | - { |
|
29 | - $path = URLDecode::getPiece(1); |
|
30 | - $this->watercourse = WatercourseCollector::getByAlias($path); |
|
27 | + public function __construct() |
|
28 | + { |
|
29 | + $path = URLDecode::getPiece(1); |
|
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 | - parent::__construct(); |
|
36 | - } |
|
35 | + parent::__construct(); |
|
36 | + } |
|
37 | 37 | |
38 | - protected function get_initial_meta() |
|
39 | - { |
|
40 | - $meta_array = array(); |
|
38 | + protected function get_initial_meta() |
|
39 | + { |
|
40 | + $meta_array = array(); |
|
41 | 41 | |
42 | - $meta_array['title'] = "{$this->watercourse->name} | " . self::$WEBSITE_TITLE; |
|
43 | - $meta_array['description'] = $this->watercourse->description; |
|
44 | - $meta_array['keywords'] = $this->get_keyword_array(); |
|
42 | + $meta_array['title'] = "{$this->watercourse->name} | " . self::$WEBSITE_TITLE; |
|
43 | + $meta_array['description'] = $this->watercourse->description; |
|
44 | + $meta_array['keywords'] = $this->get_keyword_array(); |
|
45 | 45 | |
46 | - return $meta_array; |
|
47 | - } |
|
46 | + return $meta_array; |
|
47 | + } |
|
48 | 48 | |
49 | - protected function get_subsequent_meta() |
|
50 | - { |
|
51 | - $meta_array = array(); |
|
49 | + protected function get_subsequent_meta() |
|
50 | + { |
|
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); |
|
54 | - $meta_array['description'] = sprintf(self::$DEFAULT_DESCRIPTION, $this->page, $this->page_count, $this->watercourse->name); |
|
55 | - $meta_array['keywords'] = $this->get_keyword_array(); |
|
53 | + $meta_array['title'] = sprintf(self::$DEFAULT_TITLE . ' | ' . self::$WEBSITE_TITLE, $this->watercourse->name, $this->page, $this->page_count); |
|
54 | + $meta_array['description'] = sprintf(self::$DEFAULT_DESCRIPTION, $this->page, $this->page_count, $this->watercourse->name); |
|
55 | + $meta_array['keywords'] = $this->get_keyword_array(); |
|
56 | 56 | |
57 | - return $meta_array; |
|
58 | - } |
|
59 | - |
|
60 | - private function get_keyword_array() |
|
61 | - { |
|
62 | - $keyword_array = self::$KEYWORD_ARRAY; |
|
63 | - array_unshift($keyword_array, strtolower($this->watercourse->name)); |
|
64 | - return $keyword_array; |
|
65 | - } |
|
66 | - |
|
67 | - protected function get_initial_introduction() |
|
68 | - { |
|
69 | - $introduction = array(); |
|
57 | + return $meta_array; |
|
58 | + } |
|
59 | + |
|
60 | + private function get_keyword_array() |
|
61 | + { |
|
62 | + $keyword_array = self::$KEYWORD_ARRAY; |
|
63 | + array_unshift($keyword_array, strtolower($this->watercourse->name)); |
|
64 | + return $keyword_array; |
|
65 | + } |
|
66 | + |
|
67 | + protected function get_initial_introduction() |
|
68 | + { |
|
69 | + $introduction = array(); |
|
70 | 70 | |
71 | - $introduction['title'] = $this->watercourse->header; |
|
72 | - $introduction['description'] = Content::instance('FixInternalLink', $this->watercourse->introduction)->activate(); |
|
73 | - $introduction['image'] = $this->get_image_element($this->watercourse->photo_category, $this->watercourse->photo, $this->watercourse->photo_description, 'medium'); |
|
71 | + $introduction['title'] = $this->watercourse->header; |
|
72 | + $introduction['description'] = Content::instance('FixInternalLink', $this->watercourse->introduction)->activate(); |
|
73 | + $introduction['image'] = $this->get_image_element($this->watercourse->photo_category, $this->watercourse->photo, $this->watercourse->photo_description, 'medium'); |
|
74 | 74 | |
75 | - return $introduction; |
|
76 | - } |
|
77 | - |
|
78 | - protected function get_subsequent_introduction() |
|
79 | - { |
|
80 | - return array( |
|
81 | - 'title' => sprintf(self::$DEFAULT_HEADER, $this->page, $this->watercourse->name)); |
|
82 | - } |
|
83 | - |
|
84 | - protected function get_item_count_per_page() |
|
85 | - { |
|
86 | - return self::$ITEM_COUNT_PER_PAGE; |
|
87 | - } |
|
88 | - |
|
89 | - protected function get_page_number_piece() |
|
90 | - { |
|
91 | - return URLDecode::getPiece(2); |
|
92 | - } |
|
93 | - |
|
94 | - protected function get_item_result($total, $offset) |
|
95 | - { |
|
96 | - return WatercourseCollector::getLogListForWatercourse($this->watercourse->id, $total, $offset); |
|
97 | - } |
|
98 | - |
|
99 | - protected function get_item_count_result() |
|
100 | - { |
|
101 | - return WatercourseCollector::getLogCountForWatercourse($this->watercourse->id); |
|
102 | - } |
|
103 | - |
|
104 | - protected function get_list_description_pattern() |
|
105 | - { |
|
106 | - return str_replace('%COUNTY%', $this->watercourse->name, self::$NAVIGATION_DESCRIPTION); |
|
107 | - } |
|
108 | - |
|
109 | - protected function get_list_link_root() |
|
110 | - { |
|
111 | - return sprintf(self::$LINK_ROOT, $this->watercourse->alias); |
|
112 | - } |
|
75 | + return $introduction; |
|
76 | + } |
|
77 | + |
|
78 | + protected function get_subsequent_introduction() |
|
79 | + { |
|
80 | + return array( |
|
81 | + 'title' => sprintf(self::$DEFAULT_HEADER, $this->page, $this->watercourse->name)); |
|
82 | + } |
|
83 | + |
|
84 | + protected function get_item_count_per_page() |
|
85 | + { |
|
86 | + return self::$ITEM_COUNT_PER_PAGE; |
|
87 | + } |
|
88 | + |
|
89 | + protected function get_page_number_piece() |
|
90 | + { |
|
91 | + return URLDecode::getPiece(2); |
|
92 | + } |
|
93 | + |
|
94 | + protected function get_item_result($total, $offset) |
|
95 | + { |
|
96 | + return WatercourseCollector::getLogListForWatercourse($this->watercourse->id, $total, $offset); |
|
97 | + } |
|
98 | + |
|
99 | + protected function get_item_count_result() |
|
100 | + { |
|
101 | + return WatercourseCollector::getLogCountForWatercourse($this->watercourse->id); |
|
102 | + } |
|
103 | + |
|
104 | + protected function get_list_description_pattern() |
|
105 | + { |
|
106 | + return str_replace('%COUNTY%', $this->watercourse->name, self::$NAVIGATION_DESCRIPTION); |
|
107 | + } |
|
108 | + |
|
109 | + protected function get_list_link_root() |
|
110 | + { |
|
111 | + return sprintf(self::$LINK_ROOT, $this->watercourse->alias); |
|
112 | + } |
|
113 | 113 | |
114 | 114 | } |
115 | 115 | \ No newline at end of file |
@@ -5,71 +5,71 @@ |
||
5 | 5 | final class ContactController extends DefaultPageController |
6 | 6 | { |
7 | 7 | |
8 | - private static $TITLE = 'Contact Jacob Emerick | Waterfalls of the Keweenaw'; |
|
9 | - private static $DESCRIPTION = 'Contact page to reach Jacob Emerick by email or social networks'; |
|
8 | + private static $TITLE = 'Contact Jacob Emerick | Waterfalls of the Keweenaw'; |
|
9 | + private static $DESCRIPTION = 'Contact page to reach Jacob Emerick by email or social networks'; |
|
10 | 10 | |
11 | - private static $KEYWORD_ARRAY = array( |
|
12 | - 'contact', |
|
13 | - 'email', |
|
14 | - 'waterfalls', |
|
15 | - 'Jacob Emerick'); |
|
11 | + private static $KEYWORD_ARRAY = array( |
|
12 | + 'contact', |
|
13 | + 'email', |
|
14 | + 'waterfalls', |
|
15 | + 'Jacob Emerick'); |
|
16 | 16 | |
17 | - protected function set_head_data() |
|
18 | - { |
|
19 | - $this->set_title(self::$TITLE); |
|
20 | - $this->set_description(self::$DESCRIPTION); |
|
21 | - $this->set_keywords(self::$KEYWORD_ARRAY); |
|
17 | + protected function set_head_data() |
|
18 | + { |
|
19 | + $this->set_title(self::$TITLE); |
|
20 | + $this->set_description(self::$DESCRIPTION); |
|
21 | + $this->set_keywords(self::$KEYWORD_ARRAY); |
|
22 | 22 | |
23 | - parent::set_head_data(); |
|
24 | - } |
|
23 | + parent::set_head_data(); |
|
24 | + } |
|
25 | 25 | |
26 | - protected function set_body_data() |
|
27 | - { |
|
28 | - $this->set_body('form_container', $this->process_form()); |
|
29 | - $this->set_body('view', 'Contact'); |
|
26 | + protected function set_body_data() |
|
27 | + { |
|
28 | + $this->set_body('form_container', $this->process_form()); |
|
29 | + $this->set_body('view', 'Contact'); |
|
30 | 30 | |
31 | - parent::set_body_data(); |
|
32 | - } |
|
31 | + parent::set_body_data(); |
|
32 | + } |
|
33 | 33 | |
34 | - private function process_form() |
|
35 | - { |
|
36 | - if(!Request::hasPost() || Request::getPost('submit') != 'Send Message!') |
|
37 | - return (object) array('display' => 'normal'); |
|
34 | + private function process_form() |
|
35 | + { |
|
36 | + if(!Request::hasPost() || Request::getPost('submit') != 'Send Message!') |
|
37 | + return (object) array('display' => 'normal'); |
|
38 | 38 | |
39 | - Loader::load('utility', 'Validate'); |
|
40 | - $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'; |
|
39 | + Loader::load('utility', 'Validate'); |
|
40 | + $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'; |
|
47 | 47 | |
48 | - $values = (object) array( |
|
49 | - 'name' => Request::getPost('name'), |
|
50 | - 'email' => Request::getPost('email'), |
|
51 | - 'message' => Request::getPost('message')); |
|
48 | + $values = (object) array( |
|
49 | + 'name' => Request::getPost('name'), |
|
50 | + 'email' => Request::getPost('email'), |
|
51 | + 'message' => Request::getPost('message')); |
|
52 | 52 | |
53 | - if(count($error_result) > 0) |
|
54 | - { |
|
55 | - return (object) array( |
|
56 | - 'display' => 'error', |
|
57 | - 'messages' => $error_result, |
|
58 | - 'values' => $values); |
|
59 | - } |
|
53 | + if(count($error_result) > 0) |
|
54 | + { |
|
55 | + return (object) array( |
|
56 | + 'display' => 'error', |
|
57 | + 'messages' => $error_result, |
|
58 | + 'values' => $values); |
|
59 | + } |
|
60 | 60 | |
61 | 61 | global $container; |
62 | 62 | $sent = $container['mail'] |
63 | - ->addTo($container['config']->admin_email) |
|
64 | - ->setSubject('Waterfall Site Contact') |
|
65 | - ->setPlainMessage( |
|
63 | + ->addTo($container['config']->admin_email) |
|
64 | + ->setSubject('Waterfall Site Contact') |
|
65 | + ->setPlainMessage( |
|
66 | 66 | "Name: {$values->name}\n" . |
67 | 67 | "Email: {$values->email}\n" . |
68 | 68 | "Message: {$values->message}" |
69 | - ) |
|
70 | - ->send(); |
|
69 | + ) |
|
70 | + ->send(); |
|
71 | 71 | |
72 | - return (object) array('display' => 'success'); |
|
73 | - } |
|
72 | + return (object) array('display' => 'success'); |
|
73 | + } |
|
74 | 74 | |
75 | 75 | } |
@@ -5,62 +5,62 @@ |
||
5 | 5 | final class SearchListController extends DefaultListController |
6 | 6 | { |
7 | 7 | |
8 | - private static $TITLE = 'Search Listing'; |
|
9 | - private static $DESCRIPTION = ''; |
|
8 | + private static $TITLE = 'Search Listing'; |
|
9 | + private static $DESCRIPTION = ''; |
|
10 | 10 | |
11 | - private static $KEYWORD_ARRAY = array(); |
|
11 | + private static $KEYWORD_ARRAY = array(); |
|
12 | 12 | |
13 | - protected function set_head_data() |
|
14 | - { |
|
15 | - parent::set_head_data(); |
|
13 | + protected function set_head_data() |
|
14 | + { |
|
15 | + parent::set_head_data(); |
|
16 | 16 | |
17 | - $this->set_title(self::$TITLE); |
|
18 | - $this->set_description(self::$DESCRIPTION); |
|
19 | - $this->set_keywords(self::$KEYWORD_ARRAY); |
|
20 | - } |
|
17 | + $this->set_title(self::$TITLE); |
|
18 | + $this->set_description(self::$DESCRIPTION); |
|
19 | + $this->set_keywords(self::$KEYWORD_ARRAY); |
|
20 | + } |
|
21 | 21 | |
22 | - protected function get_introduction() |
|
23 | - { |
|
24 | - return; |
|
25 | - } |
|
22 | + protected function get_introduction() |
|
23 | + { |
|
24 | + return; |
|
25 | + } |
|
26 | 26 | |
27 | - protected function get_page_number() |
|
28 | - { |
|
29 | - $page = URLDecode::getPiece(2); |
|
30 | - if(isset($page) && is_numeric($page)) |
|
31 | - return $page; |
|
32 | - return 1; |
|
33 | - } |
|
27 | + protected function get_page_number() |
|
28 | + { |
|
29 | + $page = URLDecode::getPiece(2); |
|
30 | + if(isset($page) && is_numeric($page)) |
|
31 | + return $page; |
|
32 | + return 1; |
|
33 | + } |
|
34 | 34 | |
35 | - protected function get_items() |
|
36 | - { |
|
37 | - return array(); |
|
38 | - } |
|
35 | + protected function get_items() |
|
36 | + { |
|
37 | + return array(); |
|
38 | + } |
|
39 | 39 | |
40 | - protected function get_list_description() |
|
41 | - { |
|
42 | - return 'yay cloud'; |
|
43 | - } |
|
40 | + protected function get_list_description() |
|
41 | + { |
|
42 | + return 'yay cloud'; |
|
43 | + } |
|
44 | 44 | |
45 | - protected function get_list_next_link() |
|
46 | - { |
|
47 | - return '/'; |
|
48 | - } |
|
45 | + protected function get_list_next_link() |
|
46 | + { |
|
47 | + return '/'; |
|
48 | + } |
|
49 | 49 | |
50 | - protected function get_list_prev_link() |
|
51 | - { |
|
52 | - return '/'; |
|
53 | - } |
|
50 | + protected function get_list_prev_link() |
|
51 | + { |
|
52 | + return '/'; |
|
53 | + } |
|
54 | 54 | |
55 | - private $total_post_count; |
|
56 | - protected function get_item_count() |
|
57 | - { |
|
58 | - return 20; |
|
59 | - } |
|
55 | + private $total_post_count; |
|
56 | + protected function get_item_count() |
|
57 | + { |
|
58 | + return 20; |
|
59 | + } |
|
60 | 60 | |
61 | - protected function get_item_count_per_page() |
|
62 | - { |
|
63 | - return 20; |
|
64 | - } |
|
61 | + protected function get_item_count_per_page() |
|
62 | + { |
|
63 | + return 20; |
|
64 | + } |
|
65 | 65 | |
66 | 66 | } |
67 | 67 | \ No newline at end of file |