@@ -3,8 +3,8 @@ discard block |
||
3 | 3 | Loader::load('controller', 'blog/DefaultListController'); |
4 | 4 | Loader::load('utility', 'Search'); |
5 | 5 | |
6 | -final class SearchController extends DefaultListController |
|
7 | -{ |
|
6 | +final class SearchController extends DefaultListController |
|
7 | +{ |
|
8 | 8 | |
9 | 9 | private static $TITLE_MAIN = "%s Search | Jacob Emerick's Blog"; |
10 | 10 | private static $DESCRIPTION_MAIN = "Posts containing the phrase %s on Jacob Emerick's Blog."; |
@@ -29,8 +29,7 @@ discard block |
||
29 | 29 | |
30 | 30 | private $query; |
31 | 31 | |
32 | - public function __construct() |
|
33 | - { |
|
32 | + public function __construct() { |
|
34 | 33 | $query = URLDecode::getPiece(2); |
35 | 34 | $query = urldecode($query); |
36 | 35 | $query = str_replace('-', ' ', $query); |
@@ -40,16 +39,14 @@ discard block |
||
40 | 39 | parent::__construct(); |
41 | 40 | } |
42 | 41 | |
43 | - protected function set_head_data() |
|
44 | - { |
|
42 | + protected function set_head_data() { |
|
45 | 43 | parent::set_head_data(); |
46 | 44 | |
47 | 45 | if($this->page == 1) |
48 | 46 | { |
49 | 47 | $this->set_title(sprintf(self::$TITLE_MAIN, ucwords($this->query))); |
50 | 48 | $this->set_description(sprintf(self::$DESCRIPTION_MAIN, ucwords($this->query))); |
51 | - } |
|
52 | - else |
|
49 | + } else |
|
53 | 50 | { |
54 | 51 | $this->set_title(sprintf(self::$TITLE_PAGINATED, ucwords($this->query), $this->page, $this->total_pages)); |
55 | 52 | $this->set_description(sprintf(self::$DESCRIPTION_PAGINATED, $this->page, $this->total_pages, ucwords($this->query))); |
@@ -60,30 +57,29 @@ discard block |
||
60 | 57 | $this->set_keywords($keyword_array); |
61 | 58 | } |
62 | 59 | |
63 | - protected function get_introduction() |
|
64 | - { |
|
65 | - if($this->total_pages > 1) |
|
66 | - return array( |
|
67 | - 'title' => "Posts from search '{$this->query}', page {$this->page} of {$this->total_pages}."); |
|
68 | - else if($this->total_pages == 1) |
|
69 | - return array( |
|
70 | - 'title' => "Posts from search '{$this->query}'."); |
|
71 | - else |
|
72 | - return array( |
|
73 | - 'title' => "Sorry, '{$this->query}' didn't return any posts."); |
|
60 | + protected function get_introduction() { |
|
61 | + if($this->total_pages > 1) { |
|
62 | + return array( |
|
63 | + 'title' => "Posts from search '{$this->query}', page {$this->page} of {$this->total_pages}."); |
|
64 | + } else if($this->total_pages == 1) { |
|
65 | + return array( |
|
66 | + 'title' => "Posts from search '{$this->query}'."); |
|
67 | + } else { |
|
68 | + return array( |
|
69 | + 'title' => "Sorry, '{$this->query}' didn't return any posts."); |
|
70 | + } |
|
74 | 71 | } |
75 | 72 | |
76 | - protected function get_page_number() |
|
77 | - { |
|
73 | + protected function get_page_number() { |
|
78 | 74 | $page = URLDecode::getPiece(3); |
79 | - if(isset($page) && is_numeric($page)) |
|
80 | - return $page; |
|
75 | + if(isset($page) && is_numeric($page)) { |
|
76 | + return $page; |
|
77 | + } |
|
81 | 78 | return 1; |
82 | 79 | } |
83 | 80 | |
84 | 81 | private $search_result; |
85 | - private function get_search_result() |
|
86 | - { |
|
82 | + private function get_search_result() { |
|
87 | 83 | if(!isset($this->search_result)) |
88 | 84 | { |
89 | 85 | global $container; |
@@ -99,40 +95,39 @@ discard block |
||
99 | 95 | return $this->search_result; |
100 | 96 | } |
101 | 97 | |
102 | - protected function get_list_results() |
|
103 | - { |
|
98 | + protected function get_list_results() { |
|
104 | 99 | return array_slice($this->get_search_result(), $this->offset, self::$POSTS_PER_PAGE); |
105 | 100 | } |
106 | 101 | |
107 | - protected function get_list_description() |
|
108 | - { |
|
102 | + protected function get_list_description() { |
|
109 | 103 | $start = $this->offset + 1; |
110 | 104 | $end = min($this->offset + self::$POSTS_PER_PAGE, $this->get_total_post_count()); |
111 | 105 | |
112 | 106 | return sprintf(self::$LIST_DESCRIPTION, $start, $end, $this->get_total_post_count(), $this->query); |
113 | 107 | } |
114 | 108 | |
115 | - protected function get_list_next_link() |
|
116 | - { |
|
117 | - if($this->page == 1) |
|
118 | - return; |
|
119 | - if($this->page == 2) |
|
120 | - return Content::instance('URLSafe', "/search/{$this->query}/")->activate(); |
|
109 | + protected function get_list_next_link() { |
|
110 | + if($this->page == 1) { |
|
111 | + return; |
|
112 | + } |
|
113 | + if($this->page == 2) { |
|
114 | + return Content::instance('URLSafe', "/search/{$this->query}/")->activate(); |
|
115 | + } |
|
121 | 116 | return Content::instance('URLSafe', "/search/{$this->query}/" . ($this->page - 1) . '/')->activate(); |
122 | 117 | } |
123 | 118 | |
124 | - protected function get_list_prev_link() |
|
125 | - { |
|
126 | - if(($this->page * self::$POSTS_PER_PAGE) >= $this->get_total_post_count()) |
|
127 | - return; |
|
119 | + protected function get_list_prev_link() { |
|
120 | + if(($this->page * self::$POSTS_PER_PAGE) >= $this->get_total_post_count()) { |
|
121 | + return; |
|
122 | + } |
|
128 | 123 | return Content::instance('URLSafe', "/search/{$this->query}/" . ($this->page + 1) . '/')->activate(); |
129 | 124 | } |
130 | 125 | |
131 | 126 | private $total_post_count; |
132 | - protected function get_total_post_count() |
|
133 | - { |
|
134 | - if(!isset($this->total_post_count)) |
|
135 | - $this->total_post_count = count($this->get_search_result()); |
|
127 | + protected function get_total_post_count() { |
|
128 | + if(!isset($this->total_post_count)) { |
|
129 | + $this->total_post_count = count($this->get_search_result()); |
|
130 | + } |
|
136 | 131 | return $this->total_post_count; |
137 | 132 | } |
138 | 133 |
@@ -5,8 +5,8 @@ discard block |
||
5 | 5 | Loader::load('controller', '/PageController'); |
6 | 6 | Loader::load('utility', 'Content'); |
7 | 7 | |
8 | -abstract class DefaultPageController extends PageController |
|
9 | -{ |
|
8 | +abstract class DefaultPageController extends PageController |
|
9 | +{ |
|
10 | 10 | |
11 | 11 | private static $RECENT_COMMENT_COUNT = 10; |
12 | 12 | private static $MINIMUM_TAG_COUNT = 10; |
@@ -16,8 +16,7 @@ discard block |
||
16 | 16 | |
17 | 17 | private static $INTRODUCTION_IMAGE_PATTERN = '<img src="/photo/%s/%s-size-%s.jpg" height="%d" width="%d" alt="%s" />'; |
18 | 18 | |
19 | - protected function set_head_data() |
|
20 | - { |
|
19 | + protected function set_head_data() { |
|
21 | 20 | $this->set_head('rss_link', [ |
22 | 21 | 'title' => 'Jacob Emerick Blog Feed', |
23 | 22 | 'url' => '/rss.xml' |
@@ -31,18 +30,17 @@ discard block |
||
31 | 30 | $this->add_css('blog'); |
32 | 31 | } |
33 | 32 | |
34 | - protected function get_introduction() |
|
35 | - { |
|
33 | + protected function get_introduction() { |
|
36 | 34 | return; |
37 | 35 | } |
38 | 36 | |
39 | - protected function get_introduction_image($id) |
|
40 | - { |
|
37 | + protected function get_introduction_image($id) { |
|
41 | 38 | Loader::load('collector', 'image/PhotoCollector'); |
42 | 39 | $photo_result = PhotoCollector::getRow($id); |
43 | 40 | |
44 | - if($photo_result == null) |
|
45 | - return; |
|
41 | + if($photo_result == null) { |
|
42 | + return; |
|
43 | + } |
|
46 | 44 | |
47 | 45 | $name = $photo_result->name; |
48 | 46 | $category = $photo_result->category; |
@@ -54,8 +52,7 @@ discard block |
||
54 | 52 | return sprintf(self::$INTRODUCTION_IMAGE_PATTERN, $category, $name, $size, $height, $width, $description); |
55 | 53 | } |
56 | 54 | |
57 | - protected function set_body_data() |
|
58 | - { |
|
55 | + protected function set_body_data() { |
|
59 | 56 | $this->set_body('introduction', $this->get_introduction()); |
60 | 57 | $this->set_body('right_side', $this->get_right_side()); |
61 | 58 | $this->set_body('activity_array', $this->get_recent_activity()); |
@@ -63,8 +60,7 @@ discard block |
||
63 | 60 | $this->set_body_view('Page'); |
64 | 61 | } |
65 | 62 | |
66 | - final protected function format_post($post, $trim = false) |
|
67 | - { |
|
63 | + final protected function format_post($post, $trim = false) { |
|
68 | 64 | $post_object = new stdclass(); |
69 | 65 | |
70 | 66 | $post_object->title = $post['title']; |
@@ -80,8 +76,7 @@ discard block |
||
80 | 76 | return $post_object; |
81 | 77 | } |
82 | 78 | |
83 | - final private function get_comments_for_post($post) |
|
84 | - { |
|
79 | + final private function get_comments_for_post($post) { |
|
85 | 80 | $count = CommentCollector::getCommentCountForURL(self::$BLOG_SITE_ID, $post['path']); |
86 | 81 | $count_from_service = $this->get_comments_for_post_from_service($post); |
87 | 82 | |
@@ -93,8 +88,7 @@ discard block |
||
93 | 88 | return $count; |
94 | 89 | } |
95 | 90 | |
96 | - final private function get_comments_for_post_from_service($post) |
|
97 | - { |
|
91 | + final private function get_comments_for_post_from_service($post) { |
|
98 | 92 | global $config; |
99 | 93 | $configuration = new Jacobemerick\CommentService\Configuration(); |
100 | 94 | $configuration->setUsername($config->comments->user); |
@@ -127,8 +121,7 @@ discard block |
||
127 | 121 | return count($comment_response); |
128 | 122 | } |
129 | 123 | |
130 | - final private function get_tags_for_post($post) |
|
131 | - { |
|
124 | + final private function get_tags_for_post($post) { |
|
132 | 125 | global $container; |
133 | 126 | $repository = new Jacobemerick\Web\Domain\Blog\Tag\MysqlTagRepository($container['db_connection_locator']); |
134 | 127 | $tag_result = $repository->getTagsForPost($post['id']); |
@@ -144,12 +137,12 @@ discard block |
||
144 | 137 | return $tag_array; |
145 | 138 | } |
146 | 139 | |
147 | - final private function get_body_for_post($post, $trim) |
|
148 | - { |
|
140 | + final private function get_body_for_post($post, $trim) { |
|
149 | 141 | $body = $post['body']; |
150 | 142 | |
151 | - if($trim) |
|
152 | - $body = Content::instance('SmartTrim', $body)->activate(self::$LENGTH_OF_TRIMMED_POST); |
|
143 | + if($trim) { |
|
144 | + $body = Content::instance('SmartTrim', $body)->activate(self::$LENGTH_OF_TRIMMED_POST); |
|
145 | + } |
|
153 | 146 | |
154 | 147 | $body = Content::instance('FixPhoto', $body)->activate(false, 'standard'); |
155 | 148 | $body = Content::instance('MarkupCode', $body)->activate(); |
@@ -157,16 +150,14 @@ discard block |
||
157 | 150 | return $body; |
158 | 151 | } |
159 | 152 | |
160 | - final protected function get_right_side() |
|
161 | - { |
|
153 | + final protected function get_right_side() { |
|
162 | 154 | $side_array = array(); |
163 | 155 | $side_array['tags'] = $this->get_tag_cloud(); |
164 | 156 | $side_array['comments'] = $this->get_comments(); |
165 | 157 | return $side_array; |
166 | 158 | } |
167 | 159 | |
168 | - final private function get_tag_cloud() |
|
169 | - { |
|
160 | + final private function get_tag_cloud() { |
|
170 | 161 | global $container; |
171 | 162 | $repository = new Jacobemerick\Web\Domain\Blog\Tag\MysqlTagRepository($container['db_connection_locator']); |
172 | 163 | $tag_result = $repository->getTagCloud(); |
@@ -176,8 +167,9 @@ discard block |
||
176 | 167 | $cloud_array = array(); |
177 | 168 | foreach($tag_result as $tag) |
178 | 169 | { |
179 | - if($tag['count'] < self::$MINIMUM_TAG_COUNT) |
|
180 | - continue; |
|
170 | + if($tag['count'] < self::$MINIMUM_TAG_COUNT) { |
|
171 | + continue; |
|
172 | + } |
|
181 | 173 | |
182 | 174 | $tag_object = new stdclass(); |
183 | 175 | $tag_object->name = $tag['tag']; |
@@ -189,20 +181,19 @@ discard block |
||
189 | 181 | return $cloud_array; |
190 | 182 | } |
191 | 183 | |
192 | - final private function get_maximum_tag_count($tag_result) |
|
193 | - { |
|
184 | + final private function get_maximum_tag_count($tag_result) { |
|
194 | 185 | $maximum = 1; |
195 | 186 | |
196 | 187 | foreach($tag_result as $tag) |
197 | 188 | { |
198 | - if($tag['count'] > $maximum) |
|
199 | - $maximum = $tag['count']; |
|
189 | + if($tag['count'] > $maximum) { |
|
190 | + $maximum = $tag['count']; |
|
191 | + } |
|
200 | 192 | } |
201 | 193 | return $maximum; |
202 | 194 | } |
203 | 195 | |
204 | - final private function get_comments() |
|
205 | - { |
|
196 | + final private function get_comments() { |
|
206 | 197 | $comment_array = CommentCollector::getRecentBlogComments(self::$RECENT_COMMENT_COUNT); |
207 | 198 | |
208 | 199 | $array = array(); |
@@ -228,8 +219,7 @@ discard block |
||
228 | 219 | return $array; |
229 | 220 | } |
230 | 221 | |
231 | - final private function get_comments_from_service() |
|
232 | - { |
|
222 | + final private function get_comments_from_service() { |
|
233 | 223 | global $config; |
234 | 224 | $configuration = new Jacobemerick\CommentService\Configuration(); |
235 | 225 | $configuration->setUsername($config->comments->user); |
@@ -2,8 +2,8 @@ discard block |
||
2 | 2 | |
3 | 3 | Loader::load('controller', 'blog/DefaultPageController'); |
4 | 4 | |
5 | -final class AboutController extends DefaultPageController |
|
6 | -{ |
|
5 | +final class AboutController extends DefaultPageController |
|
6 | +{ |
|
7 | 7 | |
8 | 8 | private static $TITLE = 'About the Blog | Jacob Emerick'; |
9 | 9 | private static $DESCRIPTION = "A little bit about the awesomeness on Jacob Emerick's Blog, diving into the topics covered, technology used, and methodology of writing new posts."; |
@@ -15,8 +15,7 @@ discard block |
||
15 | 15 | 'blog', |
16 | 16 | 'Jacob Emerick'); |
17 | 17 | |
18 | - protected function set_head_data() |
|
19 | - { |
|
18 | + protected function set_head_data() { |
|
20 | 19 | $this->set_title(self::$TITLE); |
21 | 20 | $this->set_description(self::$DESCRIPTION); |
22 | 21 | $this->set_keywords(self::$KEYWORD_ARRAY); |
@@ -24,15 +23,13 @@ discard block |
||
24 | 23 | parent::set_head_data(); |
25 | 24 | } |
26 | 25 | |
27 | - protected function set_body_data() |
|
28 | - { |
|
26 | + protected function set_body_data() { |
|
29 | 27 | $this->set_body('view', 'About'); |
30 | 28 | |
31 | 29 | parent::set_body_data(); |
32 | 30 | } |
33 | 31 | |
34 | - protected function get_introduction() |
|
35 | - { |
|
32 | + protected function get_introduction() { |
|
36 | 33 | global $container; |
37 | 34 | $repository = new Jacobemerick\Web\Domain\Blog\Introduction\MysqlIntroductionRepository($container['db_connection_locator']); |
38 | 35 | $introduction_result = $repository->findByType('about'); |
@@ -2,8 +2,8 @@ discard block |
||
2 | 2 | |
3 | 3 | Loader::load('controller', 'blog/DefaultListController'); |
4 | 4 | |
5 | -final class HomeController extends DefaultListController |
|
6 | -{ |
|
5 | +final class HomeController extends DefaultListController |
|
6 | +{ |
|
7 | 7 | |
8 | 8 | private static $TITLE_MAIN = "Jacob Emerick's Blog | Posts on Hiking, Web Development, and more"; |
9 | 9 | private static $TITLE_PAGINATED = "Page %d of %d in Jacob Emerick's Blog"; |
@@ -28,25 +28,25 @@ discard block |
||
28 | 28 | |
29 | 29 | private static $LIST_DESCRIPTION = 'Viewing %d - %d of %d total posts.'; |
30 | 30 | |
31 | - protected function set_head_data() |
|
32 | - { |
|
31 | + protected function set_head_data() { |
|
33 | 32 | parent::set_head_data(); |
34 | 33 | |
35 | - if($this->page == 1) |
|
36 | - $this->set_title(self::$TITLE_MAIN); |
|
37 | - else |
|
38 | - $this->set_title(sprintf(self::$TITLE_PAGINATED, $this->page, $this->total_pages)); |
|
34 | + if($this->page == 1) { |
|
35 | + $this->set_title(self::$TITLE_MAIN); |
|
36 | + } else { |
|
37 | + $this->set_title(sprintf(self::$TITLE_PAGINATED, $this->page, $this->total_pages)); |
|
38 | + } |
|
39 | 39 | |
40 | - if($this->page == 1) |
|
41 | - $this->set_description(self::$DESCRIPTION_MAIN); |
|
42 | - else |
|
43 | - $this->set_description(sprintf(self::$DESCRIPTION_PAGINATED, $this->page, $this->total_pages)); |
|
40 | + if($this->page == 1) { |
|
41 | + $this->set_description(self::$DESCRIPTION_MAIN); |
|
42 | + } else { |
|
43 | + $this->set_description(sprintf(self::$DESCRIPTION_PAGINATED, $this->page, $this->total_pages)); |
|
44 | + } |
|
44 | 45 | |
45 | 46 | $this->set_keywords(self::$KEYWORD_ARRAY); |
46 | 47 | } |
47 | 48 | |
48 | - protected function get_introduction() |
|
49 | - { |
|
49 | + protected function get_introduction() { |
|
50 | 50 | if($this->page == 1) |
51 | 51 | { |
52 | 52 | global $container; |
@@ -65,48 +65,46 @@ discard block |
||
65 | 65 | 'title' => "All of Jacob Emerick's posts, page {$this->page} of {$this->total_pages}."); |
66 | 66 | } |
67 | 67 | |
68 | - protected function get_page_number() |
|
69 | - { |
|
68 | + protected function get_page_number() { |
|
70 | 69 | $page = URLDecode::getPiece(1); |
71 | - if(isset($page) && is_numeric($page)) |
|
72 | - return $page; |
|
70 | + if(isset($page) && is_numeric($page)) { |
|
71 | + return $page; |
|
72 | + } |
|
73 | 73 | return 1; |
74 | 74 | } |
75 | 75 | |
76 | - protected function get_list_results() |
|
77 | - { |
|
76 | + protected function get_list_results() { |
|
78 | 77 | global $container; |
79 | 78 | $repository = new Jacobemerick\Web\Domain\Blog\Post\MysqlPostRepository($container['db_connection_locator']); |
80 | 79 | return $repository->getActivePosts(self::$POSTS_PER_PAGE, $this->offset); |
81 | 80 | } |
82 | 81 | |
83 | - protected function get_list_description() |
|
84 | - { |
|
82 | + protected function get_list_description() { |
|
85 | 83 | $start = $this->offset + 1; |
86 | 84 | $end = min($this->offset + self::$POSTS_PER_PAGE, $this->get_total_post_count()); |
87 | 85 | |
88 | 86 | return sprintf(self::$LIST_DESCRIPTION, $start, $end, $this->get_total_post_count()); |
89 | 87 | } |
90 | 88 | |
91 | - protected function get_list_next_link() |
|
92 | - { |
|
93 | - if($this->page == 1) |
|
94 | - return; |
|
95 | - if($this->page == 2) |
|
96 | - return '/'; |
|
89 | + protected function get_list_next_link() { |
|
90 | + if($this->page == 1) { |
|
91 | + return; |
|
92 | + } |
|
93 | + if($this->page == 2) { |
|
94 | + return '/'; |
|
95 | + } |
|
97 | 96 | return '/' . ($this->page - 1) . '/'; |
98 | 97 | } |
99 | 98 | |
100 | - protected function get_list_prev_link() |
|
101 | - { |
|
102 | - if(($this->page * self::$POSTS_PER_PAGE) >= $this->get_total_post_count()) |
|
103 | - return; |
|
99 | + protected function get_list_prev_link() { |
|
100 | + if(($this->page * self::$POSTS_PER_PAGE) >= $this->get_total_post_count()) { |
|
101 | + return; |
|
102 | + } |
|
104 | 103 | return '/' . ($this->page + 1) . '/'; |
105 | 104 | } |
106 | 105 | |
107 | 106 | private $total_post_count; |
108 | - protected function get_total_post_count() |
|
109 | - { |
|
107 | + protected function get_total_post_count() { |
|
110 | 108 | if(!isset($this->total_post_count)) { |
111 | 109 | global $container; |
112 | 110 | $repository = new Jacobemerick\Web\Domain\Blog\Post\MysqlPostRepository($container['db_connection_locator']); |
@@ -2,8 +2,8 @@ discard block |
||
2 | 2 | |
3 | 3 | Loader::load('controller', 'blog/DefaultListController'); |
4 | 4 | |
5 | -final class CategoryController extends DefaultListController |
|
6 | -{ |
|
5 | +final class CategoryController extends DefaultListController |
|
6 | +{ |
|
7 | 7 | |
8 | 8 | private static $TITLE_MAIN_HIKING = "Hiking | Posts on Upper Peninsula Exploring on Jacob Emerick's Blog"; |
9 | 9 | private static $DESCRIPTION_MAIN_HIKING = "Posts on Jacob Emerick's Blog about hiking the Upper Peninsula, exploring the Huron Mountains, and hunting waterfalls in the Keweenaw."; |
@@ -53,8 +53,7 @@ discard block |
||
53 | 53 | |
54 | 54 | private static $LIST_DESCRIPTION = 'Viewing %d - %d of %d posts in the %s category.'; |
55 | 55 | |
56 | - public function __construct() |
|
57 | - { |
|
56 | + public function __construct() { |
|
58 | 57 | $url = URLDecode::getPiece(1); |
59 | 58 | $this->category = (object) array( |
60 | 59 | 'display' => ucwords(str_replace('-', ' ', $url)), |
@@ -63,8 +62,7 @@ discard block |
||
63 | 62 | parent::__construct(); |
64 | 63 | } |
65 | 64 | |
66 | - protected function set_head_data() |
|
67 | - { |
|
65 | + protected function set_head_data() { |
|
68 | 66 | parent::set_head_data(); |
69 | 67 | |
70 | 68 | switch($this->category->display) |
@@ -74,8 +72,7 @@ discard block |
||
74 | 72 | { |
75 | 73 | $this->set_title(self::$TITLE_MAIN_HIKING); |
76 | 74 | $this->set_description(self::$DESCRIPTION_MAIN_HIKING); |
77 | - } |
|
78 | - else |
|
75 | + } else |
|
79 | 76 | { |
80 | 77 | $this->set_title(sprintf(self::$TITLE_PAGINATED_HIKING, $this->page, $this->total_pages)); |
81 | 78 | $this->set_description(sprintf(self::$DESCRIPTION_PAGINATED_HIKING, $this->page, $this->total_pages)); |
@@ -87,8 +84,7 @@ discard block |
||
87 | 84 | { |
88 | 85 | $this->set_title(self::$TITLE_MAIN_PERSONAL); |
89 | 86 | $this->set_description(self::$DESCRIPTION_MAIN_PERSONAL); |
90 | - } |
|
91 | - else |
|
87 | + } else |
|
92 | 88 | { |
93 | 89 | $this->set_title(sprintf(self::$TITLE_PAGINATED_PERSONAL, $this->page, $this->total_pages)); |
94 | 90 | $this->set_description(sprintf(self::$DESCRIPTION_PAGINATED_PERSONAL, $this->page, $this->total_pages)); |
@@ -100,8 +96,7 @@ discard block |
||
100 | 96 | { |
101 | 97 | $this->set_title(self::$TITLE_MAIN_WEBDEVELOPMENT); |
102 | 98 | $this->set_description(self::$DESCRIPTION_MAIN_WEBDEVELOPMENT); |
103 | - } |
|
104 | - else |
|
99 | + } else |
|
105 | 100 | { |
106 | 101 | $this->set_title(sprintf(self::$TITLE_PAGINATED_WEBDEVELOPMENT, $this->page, $this->total_pages)); |
107 | 102 | $this->set_description(sprintf(self::$DESCRIPTION_PAGINATED_WEBDEVELOPMENT, $this->page, $this->total_pages)); |
@@ -111,8 +106,7 @@ discard block |
||
111 | 106 | } |
112 | 107 | } |
113 | 108 | |
114 | - protected function get_introduction() |
|
115 | - { |
|
109 | + protected function get_introduction() { |
|
116 | 110 | if($this->page == 1) |
117 | 111 | { |
118 | 112 | global $container; |
@@ -131,48 +125,46 @@ discard block |
||
131 | 125 | 'title' => "Posts about {$this->category->display}, page {$this->page} of {$this->total_pages}."); |
132 | 126 | } |
133 | 127 | |
134 | - protected function get_page_number() |
|
135 | - { |
|
128 | + protected function get_page_number() { |
|
136 | 129 | $page = URLDecode::getPiece(2); |
137 | - if(isset($page) && is_numeric($page)) |
|
138 | - return $page; |
|
130 | + if(isset($page) && is_numeric($page)) { |
|
131 | + return $page; |
|
132 | + } |
|
139 | 133 | return 1; |
140 | 134 | } |
141 | 135 | |
142 | - protected function get_list_results() |
|
143 | - { |
|
136 | + protected function get_list_results() { |
|
144 | 137 | global $container; |
145 | 138 | $repository = new Jacobemerick\Web\Domain\Blog\Post\MysqlPostRepository($container['db_connection_locator']); |
146 | 139 | return $repository->getActivePostsByCategory($this->category->link, self::$POSTS_PER_PAGE, $this->offset); |
147 | 140 | } |
148 | 141 | |
149 | - protected function get_list_description() |
|
150 | - { |
|
142 | + protected function get_list_description() { |
|
151 | 143 | $start = $this->offset + 1; |
152 | 144 | $end = min($this->offset + self::$POSTS_PER_PAGE, $this->get_total_post_count()); |
153 | 145 | |
154 | 146 | return sprintf(self::$LIST_DESCRIPTION, $start, $end, $this->get_total_post_count(), $this->category->display); |
155 | 147 | } |
156 | 148 | |
157 | - protected function get_list_next_link() |
|
158 | - { |
|
159 | - if($this->page == 1) |
|
160 | - return; |
|
161 | - if($this->page == 2) |
|
162 | - return Content::instance('URLSafe', "/{$this->category->link}/")->activate(); |
|
149 | + protected function get_list_next_link() { |
|
150 | + if($this->page == 1) { |
|
151 | + return; |
|
152 | + } |
|
153 | + if($this->page == 2) { |
|
154 | + return Content::instance('URLSafe', "/{$this->category->link}/")->activate(); |
|
155 | + } |
|
163 | 156 | return Content::instance('URLSafe', "/{$this->category->link}/" . ($this->page - 1) . '/')->activate(); |
164 | 157 | } |
165 | 158 | |
166 | - protected function get_list_prev_link() |
|
167 | - { |
|
168 | - if(($this->page * self::$POSTS_PER_PAGE) >= $this->get_total_post_count()) |
|
169 | - return; |
|
159 | + protected function get_list_prev_link() { |
|
160 | + if(($this->page * self::$POSTS_PER_PAGE) >= $this->get_total_post_count()) { |
|
161 | + return; |
|
162 | + } |
|
170 | 163 | return Content::instance('URLSafe', "/{$this->category->link}/" . ($this->page + 1) . '/')->activate(); |
171 | 164 | } |
172 | 165 | |
173 | 166 | private $total_post_count; |
174 | - protected function get_total_post_count() |
|
175 | - { |
|
167 | + protected function get_total_post_count() { |
|
176 | 168 | if(!isset($this->total_post_count)) { |
177 | 169 | global $container; |
178 | 170 | $repository = new Jacobemerick\Web\Domain\Blog\Post\MysqlPostRepository($container['db_connection_locator']); |
@@ -2,8 +2,8 @@ discard block |
||
2 | 2 | |
3 | 3 | Loader::load('controller', 'waterfalls/DefaultPageController'); |
4 | 4 | |
5 | -abstract class DefaultListController extends DefaultPageController |
|
6 | -{ |
|
5 | +abstract class DefaultListController extends DefaultPageController |
|
6 | +{ |
|
7 | 7 | |
8 | 8 | private static $IMAGE_ELEMENT_PATTERN = '<img src="/photo/%s/%s-size-%s.jpg" alt="%s" height="%s" width="%s" />'; |
9 | 9 | |
@@ -11,8 +11,7 @@ discard block |
||
11 | 11 | protected $page_count; |
12 | 12 | protected $offset; |
13 | 13 | |
14 | - public function __construct() |
|
15 | - { |
|
14 | + public function __construct() { |
|
16 | 15 | parent::__construct(); |
17 | 16 | |
18 | 17 | $this->page = $this->get_page_number(); |
@@ -20,15 +19,16 @@ discard block |
||
20 | 19 | $this->offset = ($this->page - 1) * $this->get_item_count_per_page(); |
21 | 20 | |
22 | 21 | $items = $this->get_items(); |
23 | - if(count($items) < 1) |
|
24 | - $this->eject(); |
|
22 | + if(count($items) < 1) { |
|
23 | + $this->eject(); |
|
24 | + } |
|
25 | 25 | } |
26 | 26 | |
27 | - final protected function get_page_number() |
|
28 | - { |
|
27 | + final protected function get_page_number() { |
|
29 | 28 | $page = $this->get_page_number_piece(); |
30 | - if(isset($page) && is_numeric($page)) |
|
31 | - return $page; |
|
29 | + if(isset($page) && is_numeric($page)) { |
|
30 | + return $page; |
|
31 | + } |
|
32 | 32 | return 1; |
33 | 33 | } |
34 | 34 | |
@@ -39,10 +39,10 @@ discard block |
||
39 | 39 | abstract protected function get_sidebar(); |
40 | 40 | abstract protected function get_list_view(); |
41 | 41 | |
42 | - final private function get_introduction() |
|
43 | - { |
|
44 | - if($this->page == 1) |
|
45 | - return $this->get_initial_introduction(); |
|
42 | + final private function get_introduction() { |
|
43 | + if($this->page == 1) { |
|
44 | + return $this->get_initial_introduction(); |
|
45 | + } |
|
46 | 46 | |
47 | 47 | return $this->get_subsequent_introduction(); |
48 | 48 | } |
@@ -51,8 +51,7 @@ discard block |
||
51 | 51 | abstract protected function get_subsequent_introduction(); |
52 | 52 | |
53 | 53 | private $items; |
54 | - protected function get_items() |
|
55 | - { |
|
54 | + protected function get_items() { |
|
56 | 55 | if(!isset($this->items)) |
57 | 56 | { |
58 | 57 | $total = $this->get_item_count_per_page(); |
@@ -66,26 +65,26 @@ discard block |
||
66 | 65 | abstract protected function get_item_result($total, $offset); |
67 | 66 | |
68 | 67 | 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(); |
|
68 | + final private function get_item_count() { |
|
69 | + if(!isset($this->item_count)) { |
|
70 | + $this->item_count = $this->get_item_count_result(); |
|
71 | + } |
|
73 | 72 | return $this->item_count; |
74 | 73 | } |
75 | 74 | |
76 | 75 | abstract protected function get_item_count_result(); |
77 | 76 | |
78 | - final protected function set_head_data() |
|
79 | - { |
|
77 | + final protected function set_head_data() { |
|
80 | 78 | parent::set_head_data(); |
81 | 79 | |
82 | 80 | $this->set_head('next_link', $this->get_list_next_link()); |
83 | 81 | $this->set_head('previous_link', $this->get_list_prev_link()); |
84 | 82 | |
85 | - if($this->page == 1) |
|
86 | - $meta_array = $this->get_initial_meta(); |
|
87 | - else |
|
88 | - $meta_array = $this->get_subsequent_meta(); |
|
83 | + if($this->page == 1) { |
|
84 | + $meta_array = $this->get_initial_meta(); |
|
85 | + } else { |
|
86 | + $meta_array = $this->get_subsequent_meta(); |
|
87 | + } |
|
89 | 88 | |
90 | 89 | $this->set_title($meta_array['title']); |
91 | 90 | $this->set_description($meta_array['description']); |
@@ -95,16 +94,14 @@ discard block |
||
95 | 94 | abstract protected function get_initial_meta(); |
96 | 95 | abstract protected function get_subsequent_meta(); |
97 | 96 | |
98 | - final protected function set_body_data($page_type = 'normal') |
|
99 | - { |
|
97 | + final protected function set_body_data($page_type = 'normal') { |
|
100 | 98 | parent::set_body_data($page_type); |
101 | 99 | |
102 | 100 | $this->set_body('view', $this->get_list_view()); |
103 | 101 | $this->set_body('data', $this->get_list_body_data()); |
104 | 102 | } |
105 | 103 | |
106 | - final private function get_list_body_data() |
|
107 | - { |
|
104 | + final private function get_list_body_data() { |
|
108 | 105 | $body_data_array = array(); |
109 | 106 | |
110 | 107 | $body_data_array['introduction'] = $this->get_introduction(); |
@@ -117,37 +114,39 @@ discard block |
||
117 | 114 | return $body_data_array; |
118 | 115 | } |
119 | 116 | |
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(); |
|
117 | + final private function get_list_prev_link() { |
|
118 | + if($this->page == 1) { |
|
119 | + return; |
|
120 | + } |
|
121 | + if($this->page == 2) { |
|
122 | + return $this->get_list_link_root(); |
|
123 | + } |
|
126 | 124 | return $this->get_list_link_root() . ($this->page - 1) . '/'; |
127 | 125 | } |
128 | 126 | |
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; |
|
127 | + final private function get_list_next_link() { |
|
128 | + if(($this->page * $this->get_item_count_per_page()) >= $this->get_item_count()) { |
|
129 | + return; |
|
130 | + } |
|
133 | 131 | return $this->get_list_link_root() . ($this->page + 1) . '/'; |
134 | 132 | } |
135 | 133 | |
136 | 134 | abstract protected function get_list_link_root(); |
137 | 135 | |
138 | - final private function get_list_link_array() |
|
139 | - { |
|
136 | + final private function get_list_link_array() { |
|
140 | 137 | $link_array = array(); |
141 | 138 | |
142 | - if($this->get_item_count_per_page() >= $this->get_item_count()) |
|
143 | - return $link_array; |
|
139 | + if($this->get_item_count_per_page() >= $this->get_item_count()) { |
|
140 | + return $link_array; |
|
141 | + } |
|
144 | 142 | |
145 | 143 | $link = new stdclass(); |
146 | 144 | $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'; |
|
145 | + if($this->get_list_prev_link() !== null) { |
|
146 | + $link->uri = $this->get_list_prev_link(); |
|
147 | + } else { |
|
148 | + $link->class = 'inactive'; |
|
149 | + } |
|
151 | 150 | $link_array[] = $link; |
152 | 151 | |
153 | 152 | for($i = 1; $i <= ceil($this->get_item_count() / $this->get_item_count_per_page()); $i++) |
@@ -155,14 +154,15 @@ discard block |
||
155 | 154 | $link = new stdclass(); |
156 | 155 | $link->anchor = $i; |
157 | 156 | |
158 | - if($i == $this->page) |
|
159 | - $link->class = 'current'; |
|
160 | - else |
|
157 | + if($i == $this->page) { |
|
158 | + $link->class = 'current'; |
|
159 | + } else |
|
161 | 160 | { |
162 | - if($i == 1) |
|
163 | - $link->uri = $this->get_list_link_root(); |
|
164 | - else |
|
165 | - $link->uri = $this->get_list_link_root() . $i . '/'; |
|
161 | + if($i == 1) { |
|
162 | + $link->uri = $this->get_list_link_root(); |
|
163 | + } else { |
|
164 | + $link->uri = $this->get_list_link_root() . $i . '/'; |
|
165 | + } |
|
166 | 166 | } |
167 | 167 | |
168 | 168 | $link_array[] = $link; |
@@ -170,17 +170,17 @@ discard block |
||
170 | 170 | |
171 | 171 | $link = new stdclass(); |
172 | 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'; |
|
173 | + if($this->get_list_next_link() !== null) { |
|
174 | + $link->uri = $this->get_list_next_link(); |
|
175 | + } else { |
|
176 | + $link->class = 'inactive'; |
|
177 | + } |
|
177 | 178 | $link_array[] = $link; |
178 | 179 | |
179 | 180 | return $link_array; |
180 | 181 | } |
181 | 182 | |
182 | - final private function get_list_description() |
|
183 | - { |
|
183 | + final private function get_list_description() { |
|
184 | 184 | $start = ($this->page - 1) * $this->get_item_count_per_page() + 1; |
185 | 185 | $end = min($this->page * $this->get_item_count_per_page(), $this->get_item_count()); |
186 | 186 | $total = $this->get_item_count(); |
@@ -190,8 +190,7 @@ discard block |
||
190 | 190 | |
191 | 191 | abstract protected function get_list_description_pattern(); |
192 | 192 | |
193 | - final protected function get_image_element($category, $path, $description, $size = 'small') |
|
194 | - { |
|
193 | + final protected function get_image_element($category, $path, $description, $size = 'small') { |
|
195 | 194 | switch($size) |
196 | 195 | { |
197 | 196 | case 'medium' : |
@@ -5,8 +5,8 @@ discard block |
||
5 | 5 | 'waterfall/LogCollector')); |
6 | 6 | Loader::load('controller', 'waterfalls/DefaultPageController'); |
7 | 7 | |
8 | -final class LogController extends DefaultPageController |
|
9 | -{ |
|
8 | +final class LogController extends DefaultPageController |
|
9 | +{ |
|
10 | 10 | |
11 | 11 | private static $AUTHOR = 'Jacob Emerick'; |
12 | 12 | private static $AUTHOR_URL = 'https://home.jacobemerick.com/'; |
@@ -18,15 +18,15 @@ discard block |
||
18 | 18 | |
19 | 19 | private $log; |
20 | 20 | |
21 | - public function __construct() |
|
22 | - { |
|
21 | + public function __construct() { |
|
23 | 22 | parent::__construct(); |
24 | 23 | |
25 | 24 | $log_path = URLDecode::getPiece(2); |
26 | 25 | |
27 | 26 | $this->log = LogCollector::getByAlias($log_path); |
28 | - if(!$this->log) |
|
29 | - $this->eject(); |
|
27 | + if(!$this->log) { |
|
28 | + $this->eject(); |
|
29 | + } |
|
30 | 30 | |
31 | 31 | $this->parent_navigation_item = 'journal'; |
32 | 32 | |
@@ -39,8 +39,7 @@ discard block |
||
39 | 39 | $this->add_waterfall_js(); |
40 | 40 | } |
41 | 41 | |
42 | - protected function set_head_data() |
|
43 | - { |
|
42 | + protected function set_head_data() { |
|
44 | 43 | parent::set_head_data(); |
45 | 44 | |
46 | 45 | $this->set_title("{$this->log->title} | " . self::$WEBSITE_TITLE); |
@@ -56,8 +55,7 @@ discard block |
||
56 | 55 | $this->set_keywords($keyword_array); |
57 | 56 | } |
58 | 57 | |
59 | - protected function set_body_data($page_type = 'normal') |
|
60 | - { |
|
58 | + protected function set_body_data($page_type = 'normal') { |
|
61 | 59 | parent::set_body_data($page_type); |
62 | 60 | |
63 | 61 | $this->set_body('view', 'Log'); |
@@ -71,8 +69,7 @@ discard block |
||
71 | 69 | $this->set_body('data', $body_data); |
72 | 70 | } |
73 | 71 | |
74 | - private function get_formatted_log() |
|
75 | - { |
|
72 | + private function get_formatted_log() { |
|
76 | 73 | $formatted_log = array(); |
77 | 74 | |
78 | 75 | $formatted_log['introduction'] = $this->get_log_introduction($this->log); |
@@ -84,8 +81,7 @@ discard block |
||
84 | 81 | return $formatted_log; |
85 | 82 | } |
86 | 83 | |
87 | - private function get_log_introduction($log) |
|
88 | - { |
|
84 | + private function get_log_introduction($log) { |
|
89 | 85 | return array( |
90 | 86 | 'title' => $log->title, |
91 | 87 | 'url' => Loader::getRootURL('waterfalls') . self::$JOURNAL_DIRECTORY . '/' . $log->alias . '/', |
@@ -103,8 +99,7 @@ discard block |
||
103 | 99 | } |
104 | 100 | |
105 | 101 | // @todo - link things up |
106 | - private function get_formatted_log_body() |
|
107 | - { |
|
102 | + private function get_formatted_log_body() { |
|
108 | 103 | $body = $this->log->body; |
109 | 104 | |
110 | 105 | $body = Content::instance('FixPhoto', $body)->activate(false, 'standard'); |
@@ -113,8 +108,7 @@ discard block |
||
113 | 108 | return $body; |
114 | 109 | } |
115 | 110 | |
116 | - private function get_series() |
|
117 | - { |
|
111 | + private function get_series() { |
|
118 | 112 | $series = array( |
119 | 113 | 'previous' => array(), |
120 | 114 | 'next' => array()); |
@@ -140,8 +134,7 @@ discard block |
||
140 | 134 | return $series; |
141 | 135 | } |
142 | 136 | |
143 | - private function get_sidebar() |
|
144 | - { |
|
137 | + private function get_sidebar() { |
|
145 | 138 | $sidebar = array(); |
146 | 139 | |
147 | 140 | $sidebar['companion_list'] = array(); |
@@ -174,12 +167,12 @@ discard block |
||
174 | 167 | return $sidebar; |
175 | 168 | } |
176 | 169 | |
177 | - private function get_album() |
|
178 | - { |
|
170 | + private function get_album() { |
|
179 | 171 | $album = array(); |
180 | 172 | |
181 | - if($this->log->album == 0) |
|
182 | - return $album; |
|
173 | + if($this->log->album == 0) { |
|
174 | + return $album; |
|
175 | + } |
|
183 | 176 | |
184 | 177 | $photo_list = AlbumCollector::getPhotoListForAlbum($this->log->album); |
185 | 178 | foreach($photo_list as $photo) |
@@ -188,10 +181,11 @@ discard block |
||
188 | 181 | $photo_array['full_link'] = sprintf(self::$FULL_IMAGE_LINK, $photo->category, $photo->name); |
189 | 182 | $photo_array['description'] = $photo->description; |
190 | 183 | |
191 | - if($photo->height < $photo->width) |
|
192 | - list($height, $width) = array(75, 100); |
|
193 | - else |
|
194 | - list($height, $width) = array(100, 75); |
|
184 | + if($photo->height < $photo->width) { |
|
185 | + list($height, $width) = array(75, 100); |
|
186 | + } else { |
|
187 | + list($height, $width) = array(100, 75); |
|
188 | + } |
|
195 | 189 | |
196 | 190 | $photo_array['image_node'] = sprintf( |
197 | 191 | self::$THUMB_IMAGE_NODE, |
@@ -3,8 +3,8 @@ discard block |
||
3 | 3 | Loader::load('collector', 'waterfall/PeriodCollector'); |
4 | 4 | Loader::load('controller', 'waterfalls/DefaultLogListController'); |
5 | 5 | |
6 | -final class PeriodListController extends DefaultLogListController |
|
7 | -{ |
|
6 | +final class PeriodListController extends DefaultLogListController |
|
7 | +{ |
|
8 | 8 | |
9 | 9 | private static $DEFAULT_TITLE = '%s Hiking Stories, Page %d of %d'; |
10 | 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'; |
@@ -21,19 +21,18 @@ discard block |
||
21 | 21 | |
22 | 22 | private $period; |
23 | 23 | |
24 | - public function __construct() |
|
25 | - { |
|
24 | + public function __construct() { |
|
26 | 25 | $alias = URLDecode::getPiece(2); |
27 | 26 | $this->period = PeriodCollector::getByAlias($alias); |
28 | 27 | |
29 | - if(!$this->period) |
|
30 | - $this->eject(); |
|
28 | + if(!$this->period) { |
|
29 | + $this->eject(); |
|
30 | + } |
|
31 | 31 | |
32 | 32 | parent::__construct(); |
33 | 33 | } |
34 | 34 | |
35 | - protected function get_initial_meta() |
|
36 | - { |
|
35 | + protected function get_initial_meta() { |
|
37 | 36 | $meta_array = array(); |
38 | 37 | |
39 | 38 | $meta_array['title'] = "Hiking Stories - {$this->period->name} | " . self::$WEBSITE_TITLE; |
@@ -43,8 +42,7 @@ discard block |
||
43 | 42 | return $meta_array; |
44 | 43 | } |
45 | 44 | |
46 | - protected function get_subsequent_meta() |
|
47 | - { |
|
45 | + protected function get_subsequent_meta() { |
|
48 | 46 | $meta_array = array(); |
49 | 47 | |
50 | 48 | $meta_array['title'] = sprintf(self::$DEFAULT_TITLE . ' | ' . self::$WEBSITE_TITLE, $this->period->name, $this->page, $this->page_count); |
@@ -54,15 +52,13 @@ discard block |
||
54 | 52 | return $meta_array; |
55 | 53 | } |
56 | 54 | |
57 | - private function get_keyword_array() |
|
58 | - { |
|
55 | + private function get_keyword_array() { |
|
59 | 56 | $keyword_array = self::$KEYWORD_ARRAY; |
60 | 57 | array_unshift($keyword_array, strtolower($this->period->name)); |
61 | 58 | return $keyword_array; |
62 | 59 | } |
63 | 60 | |
64 | - protected function get_initial_introduction() |
|
65 | - { |
|
61 | + protected function get_initial_introduction() { |
|
66 | 62 | $introduction = array(); |
67 | 63 | |
68 | 64 | $introduction['title'] = $this->period->title; |
@@ -72,37 +68,31 @@ discard block |
||
72 | 68 | return $introduction; |
73 | 69 | } |
74 | 70 | |
75 | - protected function get_subsequent_introduction() |
|
76 | - { |
|
71 | + protected function get_subsequent_introduction() { |
|
77 | 72 | return array( |
78 | 73 | 'title' => sprintf(self::$DEFAULT_HEADER, $this->page, $this->period->name)); |
79 | 74 | } |
80 | 75 | |
81 | - protected function get_page_number_piece() |
|
82 | - { |
|
76 | + protected function get_page_number_piece() { |
|
83 | 77 | return URLDecode::getPiece(3); |
84 | 78 | } |
85 | 79 | |
86 | - protected function get_item_result($total, $offset) |
|
87 | - { |
|
80 | + protected function get_item_result($total, $offset) { |
|
88 | 81 | return PeriodCollector::getLogListForPeriod($this->period->id, $total, $offset); |
89 | 82 | } |
90 | 83 | |
91 | - protected function get_item_count_result() |
|
92 | - { |
|
84 | + protected function get_item_count_result() { |
|
93 | 85 | return PeriodCollector::getLogCountForPeriod($this->period->id); |
94 | 86 | } |
95 | 87 | |
96 | - protected function get_list_description_pattern() |
|
97 | - { |
|
88 | + protected function get_list_description_pattern() { |
|
98 | 89 | $period = $this->period->name; |
99 | 90 | $period = strtolower($period); |
100 | 91 | $navigation_description = str_replace('%PERIOD%', $period, self::$NAVIGATION_DESCRIPTION); |
101 | 92 | return $navigation_description; |
102 | 93 | } |
103 | 94 | |
104 | - protected function get_list_link_root() |
|
105 | - { |
|
95 | + protected function get_list_link_root() { |
|
106 | 96 | return sprintf(self::$LINK_ROOT, $this->period->alias); |
107 | 97 | } |
108 | 98 |
@@ -3,8 +3,8 @@ discard block |
||
3 | 3 | Loader::load('collector', 'waterfall/CompanionCollector'); |
4 | 4 | Loader::load('controller', 'waterfalls/DefaultLogListController'); |
5 | 5 | |
6 | -final class CompanionListController extends DefaultLogListController |
|
7 | -{ |
|
6 | +final class CompanionListController extends DefaultLogListController |
|
7 | +{ |
|
8 | 8 | |
9 | 9 | private static $DEFAULT_TITLE = 'Hiking with %s, Page %d of %d'; |
10 | 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'; |
@@ -22,19 +22,18 @@ discard block |
||
22 | 22 | |
23 | 23 | private $companion; |
24 | 24 | |
25 | - public function __construct() |
|
26 | - { |
|
25 | + public function __construct() { |
|
27 | 26 | $alias = URLDecode::getPiece(2); |
28 | 27 | $this->companion = CompanionCollector::getByAlias($alias); |
29 | 28 | |
30 | - if(!$this->companion) |
|
31 | - $this->eject(); |
|
29 | + if(!$this->companion) { |
|
30 | + $this->eject(); |
|
31 | + } |
|
32 | 32 | |
33 | 33 | parent::__construct(); |
34 | 34 | } |
35 | 35 | |
36 | - protected function get_initial_meta() |
|
37 | - { |
|
36 | + protected function get_initial_meta() { |
|
38 | 37 | $meta_array = array(); |
39 | 38 | |
40 | 39 | $meta_array['title'] = "Hiking Stories with {$this->companion->name} | " . self::$WEBSITE_TITLE; |
@@ -44,8 +43,7 @@ discard block |
||
44 | 43 | return $meta_array; |
45 | 44 | } |
46 | 45 | |
47 | - protected function get_subsequent_meta() |
|
48 | - { |
|
46 | + protected function get_subsequent_meta() { |
|
49 | 47 | $meta_array = array(); |
50 | 48 | |
51 | 49 | $meta_array['title'] = sprintf(self::$DEFAULT_TITLE . ' | ' . self::$WEBSITE_TITLE, $this->companion->name, $this->page, $this->page_count); |
@@ -55,15 +53,13 @@ discard block |
||
55 | 53 | return $meta_array; |
56 | 54 | } |
57 | 55 | |
58 | - private function get_keyword_array() |
|
59 | - { |
|
56 | + private function get_keyword_array() { |
|
60 | 57 | $keyword_array = self::$KEYWORD_ARRAY; |
61 | 58 | array_unshift($keyword_array, strtolower($this->companion->name)); |
62 | 59 | return $keyword_array; |
63 | 60 | } |
64 | 61 | |
65 | - protected function get_initial_introduction() |
|
66 | - { |
|
62 | + protected function get_initial_introduction() { |
|
67 | 63 | $introduction = array(); |
68 | 64 | |
69 | 65 | $introduction['title'] = $this->companion->title; |
@@ -73,34 +69,28 @@ discard block |
||
73 | 69 | return $introduction; |
74 | 70 | } |
75 | 71 | |
76 | - protected function get_subsequent_introduction() |
|
77 | - { |
|
72 | + protected function get_subsequent_introduction() { |
|
78 | 73 | return array( |
79 | 74 | 'title' => sprintf(self::$DEFAULT_HEADER, $this->page, $this->companion->name)); |
80 | 75 | } |
81 | 76 | |
82 | - protected function get_page_number_piece() |
|
83 | - { |
|
77 | + protected function get_page_number_piece() { |
|
84 | 78 | return URLDecode::getPiece(3); |
85 | 79 | } |
86 | 80 | |
87 | - protected function get_item_result($total, $offset) |
|
88 | - { |
|
81 | + protected function get_item_result($total, $offset) { |
|
89 | 82 | return CompanionCollector::getLogListForCompanion($this->companion->id, $total, $offset); |
90 | 83 | } |
91 | 84 | |
92 | - protected function get_item_count_result() |
|
93 | - { |
|
85 | + protected function get_item_count_result() { |
|
94 | 86 | return CompanionCollector::getLogCountForCompanion($this->companion->id); |
95 | 87 | } |
96 | 88 | |
97 | - protected function get_list_description_pattern() |
|
98 | - { |
|
89 | + protected function get_list_description_pattern() { |
|
99 | 90 | return str_replace('%COMPANION%', $this->companion->name, self::$NAVIGATION_DESCRIPTION); |
100 | 91 | } |
101 | 92 | |
102 | - protected function get_list_link_root() |
|
103 | - { |
|
93 | + protected function get_list_link_root() { |
|
104 | 94 | return sprintf(self::$LINK_ROOT, $this->companion->alias); |
105 | 95 | } |
106 | 96 |