@@ -27,13 +27,13 @@ discard block |
||
27 | 27 | $repository = new Jacobemerick\Web\Domain\Blog\Post\MysqlPostRepository($container['db_connection_locator']); |
28 | 28 | $this->post = $repository->findPostByPath(URLDecode::getPiece(2)); |
29 | 29 | |
30 | - if($this->post == null) |
|
30 | + if ($this->post == null) |
|
31 | 31 | $this->eject(); |
32 | 32 | |
33 | 33 | $this->handle_comment_submit( |
34 | 34 | self::$BLOG_SITE_ID, |
35 | 35 | $this->post['path'], |
36 | - Loader::getRootUrl('blog') . $this->post['category'] . '/' . $this->post['path'] . '/', |
|
36 | + Loader::getRootUrl('blog').$this->post['category'].'/'.$this->post['path'].'/', |
|
37 | 37 | $this->post['title']); |
38 | 38 | |
39 | 39 | global $container; |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | $log_id = self::$DEPRECATED_BLOGS[$this->post['id']]; |
59 | 59 | $log = LogCollector::getById($log_id); |
60 | 60 | if (!empty($log)) { |
61 | - $log_url = Loader::getRootUrl('waterfalls') . "journal/{$log->alias}/"; |
|
61 | + $log_url = Loader::getRootUrl('waterfalls')."journal/{$log->alias}/"; |
|
62 | 62 | $this->set_canonical($log_url); |
63 | 63 | } |
64 | 64 | } |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | $keyword_array = array(); |
96 | 96 | $keywords = $this->tags; |
97 | 97 | |
98 | - foreach($keywords as $keyword) |
|
98 | + foreach ($keywords as $keyword) |
|
99 | 99 | { |
100 | 100 | $keyword_array[] = $keyword['tag']; |
101 | 101 | } |
@@ -109,16 +109,16 @@ discard block |
||
109 | 109 | private function get_series_posts() |
110 | 110 | { |
111 | 111 | $series_posts = $this->fetch_series_posts(); |
112 | - if(count($series_posts) < 1) |
|
112 | + if (count($series_posts) < 1) |
|
113 | 113 | return array(); |
114 | 114 | |
115 | 115 | $previous_post = new stdclass(); |
116 | 116 | $next_post = new stdclass(); |
117 | 117 | |
118 | 118 | $found_current_post = false; |
119 | - foreach($series_posts as $post_row) |
|
119 | + foreach ($series_posts as $post_row) |
|
120 | 120 | { |
121 | - if($post_row['post'] == $this->post['id']) |
|
121 | + if ($post_row['post'] == $this->post['id']) |
|
122 | 122 | { |
123 | 123 | $found_current_post = true; |
124 | 124 | continue; |
@@ -146,9 +146,9 @@ discard block |
||
146 | 146 | $post->title = $post_row['title']; |
147 | 147 | } |
148 | 148 | |
149 | - $post->url = Loader::getRootUrl('blog') . "{$post_row['category']}/{$post_row['path']}/"; |
|
149 | + $post->url = Loader::getRootUrl('blog')."{$post_row['category']}/{$post_row['path']}/"; |
|
150 | 150 | |
151 | - if(!$found_current_post) |
|
151 | + if (!$found_current_post) |
|
152 | 152 | $previous_post = $post; |
153 | 153 | else |
154 | 154 | { |
@@ -167,7 +167,7 @@ discard block |
||
167 | 167 | private $series_posts; |
168 | 168 | private function fetch_series_posts() |
169 | 169 | { |
170 | - if(!isset($this->series_posts)) { |
|
170 | + if (!isset($this->series_posts)) { |
|
171 | 171 | global $container; |
172 | 172 | $repository = new Jacobemerick\Web\Domain\Blog\Series\MysqlSeriesRepository($container['db_connection_locator']); |
173 | 173 | $this->series_posts = $repository->getSeriesForPost($this->post['id']); |
@@ -178,14 +178,14 @@ discard block |
||
178 | 178 | private function get_related_posts() |
179 | 179 | { |
180 | 180 | $tag_array = array(); |
181 | - foreach($this->tags as $tag) |
|
181 | + foreach ($this->tags as $tag) |
|
182 | 182 | { |
183 | 183 | $tag_array[] = $tag['id']; |
184 | 184 | } |
185 | 185 | |
186 | 186 | $series_posts = $this->fetch_series_posts(); |
187 | 187 | $exclude_post_array = array(); |
188 | - foreach($series_posts as $series_post) |
|
188 | + foreach ($series_posts as $series_post) |
|
189 | 189 | { |
190 | 190 | $exclude_post_array[] = $series_post['post']; |
191 | 191 | } |
@@ -196,11 +196,11 @@ discard block |
||
196 | 196 | |
197 | 197 | $post_array = array(); |
198 | 198 | |
199 | - foreach($post_result as $post_row) |
|
199 | + foreach ($post_result as $post_row) |
|
200 | 200 | { |
201 | 201 | $post = new stdclass(); |
202 | 202 | $post->title = $post_row['title']; |
203 | - $post->url = Loader::getRootUrl('blog') . "{$post_row['category']}/{$post_row['path']}/"; |
|
203 | + $post->url = Loader::getRootUrl('blog')."{$post_row['category']}/{$post_row['path']}/"; |
|
204 | 204 | $post->category = ucwords(str_replace('-', ' ', $post_row['category'])); |
205 | 205 | $post->thumb = Content::instance('FetchFirstPhoto', $post_row['body'])->activate(); |
206 | 206 | $post->body = Content::instance('SmartTrim', $post_row['body'])->activate(($post->thumb !== '') ? self::$POST_LENGTH_SHORT : self::$POST_LENGTH_LONG); |
@@ -6,194 +6,194 @@ discard block |
||
6 | 6 | final class PostController extends DefaultPageController |
7 | 7 | { |
8 | 8 | |
9 | - private static $PAGE_DESCRIPTION_LIMIT = 250; |
|
9 | + private static $PAGE_DESCRIPTION_LIMIT = 250; |
|
10 | 10 | |
11 | - private static $TITLE = "%s | Jacob Emerick's Blog"; |
|
12 | - private static $AUTHOR = 'Jacob Emerick'; |
|
13 | - private static $AUTHOR_URL = 'https://home.jacobemerick.com/'; |
|
11 | + private static $TITLE = "%s | Jacob Emerick's Blog"; |
|
12 | + private static $AUTHOR = 'Jacob Emerick'; |
|
13 | + private static $AUTHOR_URL = 'https://home.jacobemerick.com/'; |
|
14 | 14 | |
15 | - private static $POST_LENGTH_SHORT = 100; |
|
16 | - private static $POST_LENGTH_LONG = 140; |
|
15 | + private static $POST_LENGTH_SHORT = 100; |
|
16 | + private static $POST_LENGTH_LONG = 140; |
|
17 | 17 | |
18 | - private $post; |
|
19 | - private $tags; |
|
20 | - private $comment_errors = array(); |
|
18 | + private $post; |
|
19 | + private $tags; |
|
20 | + private $comment_errors = array(); |
|
21 | 21 | |
22 | - public function __construct() |
|
23 | - { |
|
24 | - parent::__construct(); |
|
22 | + public function __construct() |
|
23 | + { |
|
24 | + parent::__construct(); |
|
25 | 25 | |
26 | 26 | global $container; |
27 | 27 | $repository = new Jacobemerick\Web\Domain\Blog\Post\MysqlPostRepository($container['db_connection_locator']); |
28 | 28 | $this->post = $repository->findPostByPath(URLDecode::getPiece(2)); |
29 | 29 | |
30 | - if($this->post == null) |
|
31 | - $this->eject(); |
|
30 | + if($this->post == null) |
|
31 | + $this->eject(); |
|
32 | 32 | |
33 | - $this->handle_comment_submit( |
|
34 | - self::$BLOG_SITE_ID, |
|
35 | - $this->post['path'], |
|
36 | - Loader::getRootUrl('blog') . $this->post['category'] . '/' . $this->post['path'] . '/', |
|
37 | - $this->post['title']); |
|
33 | + $this->handle_comment_submit( |
|
34 | + self::$BLOG_SITE_ID, |
|
35 | + $this->post['path'], |
|
36 | + Loader::getRootUrl('blog') . $this->post['category'] . '/' . $this->post['path'] . '/', |
|
37 | + $this->post['title']); |
|
38 | 38 | |
39 | 39 | global $container; |
40 | 40 | $repository = new Jacobemerick\Web\Domain\Blog\Tag\MysqlTagRepository($container['db_connection_locator']); |
41 | 41 | $this->tags = $repository->getTagsForPost($this->post['id']); |
42 | - } |
|
42 | + } |
|
43 | 43 | |
44 | - protected function set_head_data() |
|
45 | - { |
|
46 | - parent::set_head_data(); |
|
44 | + protected function set_head_data() |
|
45 | + { |
|
46 | + parent::set_head_data(); |
|
47 | 47 | |
48 | - $this->set_title(sprintf(self::$TITLE, $this->post['title'])); |
|
49 | - $this->set_description($this->get_post_description()); |
|
50 | - $this->set_keywords($this->get_post_keywords()); |
|
51 | - $this->set_author(self::$AUTHOR); |
|
48 | + $this->set_title(sprintf(self::$TITLE, $this->post['title'])); |
|
49 | + $this->set_description($this->get_post_description()); |
|
50 | + $this->set_keywords($this->get_post_keywords()); |
|
51 | + $this->set_author(self::$AUTHOR); |
|
52 | 52 | |
53 | 53 | $photo = Content::instance('FetchFirstPhoto', $this->post['body'])->activate(true); |
54 | 54 | $photo = preg_match('/^<img src="([a-z-:\.\/]+)" [^>]+>$/', $photo, $matches); |
55 | 55 | $this->set_head('thumbnail', $matches[1]); |
56 | 56 | |
57 | - if (array_key_exists($this->post['id'], self::$DEPRECATED_BLOGS)) { |
|
58 | - $log_id = self::$DEPRECATED_BLOGS[$this->post['id']]; |
|
59 | - $log = LogCollector::getById($log_id); |
|
60 | - if (!empty($log)) { |
|
61 | - $log_url = Loader::getRootUrl('waterfalls') . "journal/{$log->alias}/"; |
|
62 | - $this->set_canonical($log_url); |
|
63 | - } |
|
64 | - } |
|
65 | - } |
|
66 | - |
|
67 | - protected function get_introduction() {} |
|
68 | - |
|
69 | - protected function set_body_data() |
|
70 | - { |
|
71 | - parent::set_body_data(); |
|
57 | + if (array_key_exists($this->post['id'], self::$DEPRECATED_BLOGS)) { |
|
58 | + $log_id = self::$DEPRECATED_BLOGS[$this->post['id']]; |
|
59 | + $log = LogCollector::getById($log_id); |
|
60 | + if (!empty($log)) { |
|
61 | + $log_url = Loader::getRootUrl('waterfalls') . "journal/{$log->alias}/"; |
|
62 | + $this->set_canonical($log_url); |
|
63 | + } |
|
64 | + } |
|
65 | + } |
|
66 | + |
|
67 | + protected function get_introduction() {} |
|
68 | + |
|
69 | + protected function set_body_data() |
|
70 | + { |
|
71 | + parent::set_body_data(); |
|
72 | 72 | |
73 | - $this->set_body('title', $this->post['title']); |
|
74 | - $this->set_body('view', 'Post'); |
|
75 | - $this->set_body('data', array( |
|
76 | - 'post' => $this->format_post($this->post, false), |
|
77 | - 'series_posts' => $this->get_series_posts(), |
|
78 | - 'related_posts' => $this->get_related_posts(), |
|
79 | - 'author' => self::$AUTHOR, |
|
80 | - 'author_url' => self::$AUTHOR_URL, |
|
81 | - 'comment_array' => $this->get_comment_array( |
|
82 | - 'blog.jacobemerick.com', |
|
83 | - "{$this->post['category']}/{$this->post['path']}" |
|
84 | - ), |
|
73 | + $this->set_body('title', $this->post['title']); |
|
74 | + $this->set_body('view', 'Post'); |
|
75 | + $this->set_body('data', array( |
|
76 | + 'post' => $this->format_post($this->post, false), |
|
77 | + 'series_posts' => $this->get_series_posts(), |
|
78 | + 'related_posts' => $this->get_related_posts(), |
|
79 | + 'author' => self::$AUTHOR, |
|
80 | + 'author_url' => self::$AUTHOR_URL, |
|
81 | + 'comment_array' => $this->get_comment_array( |
|
82 | + 'blog.jacobemerick.com', |
|
83 | + "{$this->post['category']}/{$this->post['path']}" |
|
84 | + ), |
|
85 | 85 | )); |
86 | - } |
|
86 | + } |
|
87 | 87 | |
88 | - protected function get_post_description() |
|
89 | - { |
|
90 | - $description = $this->post['body']; |
|
91 | - $description = strip_tags($description); |
|
92 | - $description = Content::instance('SmartTrim', $description)->activate(self::$PAGE_DESCRIPTION_LIMIT); |
|
88 | + protected function get_post_description() |
|
89 | + { |
|
90 | + $description = $this->post['body']; |
|
91 | + $description = strip_tags($description); |
|
92 | + $description = Content::instance('SmartTrim', $description)->activate(self::$PAGE_DESCRIPTION_LIMIT); |
|
93 | 93 | |
94 | - return $description; |
|
95 | - } |
|
94 | + return $description; |
|
95 | + } |
|
96 | 96 | |
97 | - protected function get_post_keywords() |
|
98 | - { |
|
99 | - $keyword_array = array(); |
|
100 | - $keywords = $this->tags; |
|
97 | + protected function get_post_keywords() |
|
98 | + { |
|
99 | + $keyword_array = array(); |
|
100 | + $keywords = $this->tags; |
|
101 | 101 | |
102 | - foreach($keywords as $keyword) |
|
103 | - { |
|
104 | - $keyword_array[] = $keyword['tag']; |
|
105 | - } |
|
102 | + foreach($keywords as $keyword) |
|
103 | + { |
|
104 | + $keyword_array[] = $keyword['tag']; |
|
105 | + } |
|
106 | 106 | |
107 | - $keyword_array[] = 'blog'; |
|
108 | - $keyword_array[] = 'Jacob Emerick'; |
|
107 | + $keyword_array[] = 'blog'; |
|
108 | + $keyword_array[] = 'Jacob Emerick'; |
|
109 | 109 | |
110 | - return $keyword_array; |
|
111 | - } |
|
112 | - |
|
113 | - private function get_series_posts() |
|
114 | - { |
|
115 | - $series_posts = $this->fetch_series_posts(); |
|
116 | - if(count($series_posts) < 1) |
|
117 | - return array(); |
|
110 | + return $keyword_array; |
|
111 | + } |
|
112 | + |
|
113 | + private function get_series_posts() |
|
114 | + { |
|
115 | + $series_posts = $this->fetch_series_posts(); |
|
116 | + if(count($series_posts) < 1) |
|
117 | + return array(); |
|
118 | 118 | |
119 | - $previous_post = new stdclass(); |
|
120 | - $next_post = new stdclass(); |
|
119 | + $previous_post = new stdclass(); |
|
120 | + $next_post = new stdclass(); |
|
121 | 121 | |
122 | - $found_current_post = false; |
|
123 | - foreach($series_posts as $post_row) |
|
124 | - { |
|
125 | - if($post_row['post'] == $this->post['id']) |
|
126 | - { |
|
127 | - $found_current_post = true; |
|
128 | - continue; |
|
129 | - } |
|
122 | + $found_current_post = false; |
|
123 | + foreach($series_posts as $post_row) |
|
124 | + { |
|
125 | + if($post_row['post'] == $this->post['id']) |
|
126 | + { |
|
127 | + $found_current_post = true; |
|
128 | + continue; |
|
129 | + } |
|
130 | 130 | |
131 | - $post = new stdclass(); |
|
131 | + $post = new stdclass(); |
|
132 | 132 | |
133 | - if ( |
|
133 | + if ( |
|
134 | 134 | strpos($post_row['title'], 'Rainy Supe Loop') === 0 || |
135 | 135 | strpos($post_row['title'], 'Malapais Loop') === 0 || |
136 | 136 | strpos($post_row['title'], 'Mazatzal Peak Loop') === 0 || |
137 | 137 | strpos($post_row['title'], 'Dripping Springs Loop') === 0 |
138 | - ) { |
|
138 | + ) { |
|
139 | 139 | $title = $post_row['title']; |
140 | 140 | $title = explode(':', $title); |
141 | 141 | $title = array_pop($title); |
142 | 142 | $title = trim($title); |
143 | 143 | $post->title = $title; |
144 | - } else if (strpos($post_row['title'], 'Isle Royale') === 0) { |
|
145 | - $title = $post_row['title']; |
|
146 | - $title = explode(',', $title); |
|
147 | - $title = array_pop($title); |
|
148 | - $title = trim($title); |
|
149 | - $post->title = $title; |
|
150 | - } else { |
|
151 | - $post->title = $post_row['title']; |
|
152 | - } |
|
153 | - |
|
154 | - $post->url = Loader::getRootUrl('blog') . "{$post_row['category']}/{$post_row['path']}/"; |
|
144 | + } else if (strpos($post_row['title'], 'Isle Royale') === 0) { |
|
145 | + $title = $post_row['title']; |
|
146 | + $title = explode(',', $title); |
|
147 | + $title = array_pop($title); |
|
148 | + $title = trim($title); |
|
149 | + $post->title = $title; |
|
150 | + } else { |
|
151 | + $post->title = $post_row['title']; |
|
152 | + } |
|
153 | + |
|
154 | + $post->url = Loader::getRootUrl('blog') . "{$post_row['category']}/{$post_row['path']}/"; |
|
155 | 155 | |
156 | - if(!$found_current_post) |
|
157 | - $previous_post = $post; |
|
158 | - else |
|
159 | - { |
|
160 | - $next_post = $post; |
|
161 | - break; |
|
162 | - } |
|
163 | - } |
|
156 | + if(!$found_current_post) |
|
157 | + $previous_post = $post; |
|
158 | + else |
|
159 | + { |
|
160 | + $next_post = $post; |
|
161 | + break; |
|
162 | + } |
|
163 | + } |
|
164 | 164 | |
165 | - return array( |
|
166 | - 'title' => $post_row['series_title'], |
|
167 | - 'description' => Content::instance('FixInternalLink', $post_row['series_description'])->activate(), |
|
168 | - 'previous' => $previous_post, |
|
169 | - 'next' => $next_post); |
|
170 | - } |
|
171 | - |
|
172 | - private $series_posts; |
|
173 | - private function fetch_series_posts() |
|
174 | - { |
|
175 | - if(!isset($this->series_posts)) { |
|
176 | - global $container; |
|
177 | - $repository = new Jacobemerick\Web\Domain\Blog\Series\MysqlSeriesRepository($container['db_connection_locator']); |
|
178 | - $this->series_posts = $repository->getSeriesForPost($this->post['id']); |
|
179 | - } |
|
180 | - return $this->series_posts; |
|
181 | - } |
|
182 | - |
|
183 | - private function get_related_posts() |
|
184 | - { |
|
185 | - $tag_array = array(); |
|
186 | - foreach($this->tags as $tag) |
|
187 | - { |
|
188 | - $tag_array[] = $tag['id']; |
|
189 | - } |
|
165 | + return array( |
|
166 | + 'title' => $post_row['series_title'], |
|
167 | + 'description' => Content::instance('FixInternalLink', $post_row['series_description'])->activate(), |
|
168 | + 'previous' => $previous_post, |
|
169 | + 'next' => $next_post); |
|
170 | + } |
|
171 | + |
|
172 | + private $series_posts; |
|
173 | + private function fetch_series_posts() |
|
174 | + { |
|
175 | + if(!isset($this->series_posts)) { |
|
176 | + global $container; |
|
177 | + $repository = new Jacobemerick\Web\Domain\Blog\Series\MysqlSeriesRepository($container['db_connection_locator']); |
|
178 | + $this->series_posts = $repository->getSeriesForPost($this->post['id']); |
|
179 | + } |
|
180 | + return $this->series_posts; |
|
181 | + } |
|
182 | + |
|
183 | + private function get_related_posts() |
|
184 | + { |
|
185 | + $tag_array = array(); |
|
186 | + foreach($this->tags as $tag) |
|
187 | + { |
|
188 | + $tag_array[] = $tag['id']; |
|
189 | + } |
|
190 | 190 | |
191 | - $series_posts = $this->fetch_series_posts(); |
|
192 | - $exclude_post_array = array(); |
|
193 | - foreach($series_posts as $series_post) |
|
194 | - { |
|
195 | - $exclude_post_array[] = $series_post['post']; |
|
196 | - } |
|
191 | + $series_posts = $this->fetch_series_posts(); |
|
192 | + $exclude_post_array = array(); |
|
193 | + foreach($series_posts as $series_post) |
|
194 | + { |
|
195 | + $exclude_post_array[] = $series_post['post']; |
|
196 | + } |
|
197 | 197 | |
198 | 198 | global $container; |
199 | 199 | $repository = new Jacobemerick\Web\Domain\Blog\Post\MysqlPostRepository($container['db_connection_locator']); |
@@ -201,18 +201,18 @@ discard block |
||
201 | 201 | |
202 | 202 | $post_array = array(); |
203 | 203 | |
204 | - foreach($post_result as $post_row) |
|
205 | - { |
|
206 | - $post = new stdclass(); |
|
207 | - $post->title = $post_row['title']; |
|
208 | - $post->url = Loader::getRootUrl('blog') . "{$post_row['category']}/{$post_row['path']}/"; |
|
209 | - $post->category = ucwords(str_replace('-', ' ', $post_row['category'])); |
|
210 | - $post->thumb = Content::instance('FetchFirstPhoto', $post_row['body'])->activate(); |
|
211 | - $post->body = Content::instance('SmartTrim', $post_row['body'])->activate(($post->thumb !== '') ? self::$POST_LENGTH_SHORT : self::$POST_LENGTH_LONG); |
|
204 | + foreach($post_result as $post_row) |
|
205 | + { |
|
206 | + $post = new stdclass(); |
|
207 | + $post->title = $post_row['title']; |
|
208 | + $post->url = Loader::getRootUrl('blog') . "{$post_row['category']}/{$post_row['path']}/"; |
|
209 | + $post->category = ucwords(str_replace('-', ' ', $post_row['category'])); |
|
210 | + $post->thumb = Content::instance('FetchFirstPhoto', $post_row['body'])->activate(); |
|
211 | + $post->body = Content::instance('SmartTrim', $post_row['body'])->activate(($post->thumb !== '') ? self::$POST_LENGTH_SHORT : self::$POST_LENGTH_LONG); |
|
212 | 212 | |
213 | - $post_array[] = $post; |
|
214 | - } |
|
213 | + $post_array[] = $post; |
|
214 | + } |
|
215 | 215 | |
216 | - return $post_array; |
|
217 | - } |
|
216 | + return $post_array; |
|
217 | + } |
|
218 | 218 | } |
@@ -3,8 +3,8 @@ discard block |
||
3 | 3 | Loader::load('collector', 'waterfall/LogCollector'); |
4 | 4 | Loader::load('controller', 'blog/DefaultPageController'); |
5 | 5 | |
6 | -final class PostController extends DefaultPageController |
|
7 | -{ |
|
6 | +final class PostController extends DefaultPageController |
|
7 | +{ |
|
8 | 8 | |
9 | 9 | private static $PAGE_DESCRIPTION_LIMIT = 250; |
10 | 10 | |
@@ -19,16 +19,17 @@ discard block |
||
19 | 19 | private $tags; |
20 | 20 | private $comment_errors = array(); |
21 | 21 | |
22 | - public function __construct() |
|
23 | - { |
|
22 | + public function __construct() |
|
23 | + { |
|
24 | 24 | parent::__construct(); |
25 | 25 | |
26 | 26 | global $container; |
27 | 27 | $repository = new Jacobemerick\Web\Domain\Blog\Post\MysqlPostRepository($container['db_connection_locator']); |
28 | 28 | $this->post = $repository->findPostByPath(URLDecode::getPiece(2)); |
29 | 29 | |
30 | - if($this->post == null) |
|
31 | - $this->eject(); |
|
30 | + if($this->post == null) { |
|
31 | + $this->eject(); |
|
32 | + } |
|
32 | 33 | |
33 | 34 | $this->handle_comment_submit( |
34 | 35 | self::$BLOG_SITE_ID, |
@@ -41,8 +42,8 @@ discard block |
||
41 | 42 | $this->tags = $repository->getTagsForPost($this->post['id']); |
42 | 43 | } |
43 | 44 | |
44 | - protected function set_head_data() |
|
45 | - { |
|
45 | + protected function set_head_data() |
|
46 | + { |
|
46 | 47 | parent::set_head_data(); |
47 | 48 | |
48 | 49 | $this->set_title(sprintf(self::$TITLE, $this->post['title'])); |
@@ -64,10 +65,12 @@ discard block |
||
64 | 65 | } |
65 | 66 | } |
66 | 67 | |
67 | - protected function get_introduction() {} |
|
68 | + protected function get_introduction() |
|
69 | + { |
|
70 | +} |
|
68 | 71 | |
69 | - protected function set_body_data() |
|
70 | - { |
|
72 | + protected function set_body_data() |
|
73 | + { |
|
71 | 74 | parent::set_body_data(); |
72 | 75 | |
73 | 76 | $this->set_body('title', $this->post['title']); |
@@ -85,8 +88,8 @@ discard block |
||
85 | 88 | )); |
86 | 89 | } |
87 | 90 | |
88 | - protected function get_post_description() |
|
89 | - { |
|
91 | + protected function get_post_description() |
|
92 | + { |
|
90 | 93 | $description = $this->post['body']; |
91 | 94 | $description = strip_tags($description); |
92 | 95 | $description = Content::instance('SmartTrim', $description)->activate(self::$PAGE_DESCRIPTION_LIMIT); |
@@ -94,8 +97,8 @@ discard block |
||
94 | 97 | return $description; |
95 | 98 | } |
96 | 99 | |
97 | - protected function get_post_keywords() |
|
98 | - { |
|
100 | + protected function get_post_keywords() |
|
101 | + { |
|
99 | 102 | $keyword_array = array(); |
100 | 103 | $keywords = $this->tags; |
101 | 104 | |
@@ -110,11 +113,12 @@ discard block |
||
110 | 113 | return $keyword_array; |
111 | 114 | } |
112 | 115 | |
113 | - private function get_series_posts() |
|
114 | - { |
|
116 | + private function get_series_posts() |
|
117 | + { |
|
115 | 118 | $series_posts = $this->fetch_series_posts(); |
116 | - if(count($series_posts) < 1) |
|
117 | - return array(); |
|
119 | + if(count($series_posts) < 1) { |
|
120 | + return array(); |
|
121 | + } |
|
118 | 122 | |
119 | 123 | $previous_post = new stdclass(); |
120 | 124 | $next_post = new stdclass(); |
@@ -153,9 +157,9 @@ discard block |
||
153 | 157 | |
154 | 158 | $post->url = Loader::getRootUrl('blog') . "{$post_row['category']}/{$post_row['path']}/"; |
155 | 159 | |
156 | - if(!$found_current_post) |
|
157 | - $previous_post = $post; |
|
158 | - else |
|
160 | + if(!$found_current_post) { |
|
161 | + $previous_post = $post; |
|
162 | + } else |
|
159 | 163 | { |
160 | 164 | $next_post = $post; |
161 | 165 | break; |
@@ -170,8 +174,8 @@ discard block |
||
170 | 174 | } |
171 | 175 | |
172 | 176 | private $series_posts; |
173 | - private function fetch_series_posts() |
|
174 | - { |
|
177 | + private function fetch_series_posts() |
|
178 | + { |
|
175 | 179 | if(!isset($this->series_posts)) { |
176 | 180 | global $container; |
177 | 181 | $repository = new Jacobemerick\Web\Domain\Blog\Series\MysqlSeriesRepository($container['db_connection_locator']); |
@@ -180,8 +184,8 @@ discard block |
||
180 | 184 | return $this->series_posts; |
181 | 185 | } |
182 | 186 | |
183 | - private function get_related_posts() |
|
184 | - { |
|
187 | + private function get_related_posts() |
|
188 | + { |
|
185 | 189 | $tag_array = array(); |
186 | 190 | foreach($this->tags as $tag) |
187 | 191 | { |
@@ -113,6 +113,9 @@ discard block |
||
113 | 113 | exit; |
114 | 114 | } |
115 | 115 | |
116 | + /** |
|
117 | + * @param string $method |
|
118 | + */ |
|
116 | 119 | protected function set_header_method($method) |
117 | 120 | { |
118 | 121 | $this->headers = $method; |
@@ -123,6 +126,9 @@ discard block |
||
123 | 126 | $this->set_head('title', $value); |
124 | 127 | } |
125 | 128 | |
129 | + /** |
|
130 | + * @param string $value |
|
131 | + */ |
|
126 | 132 | protected function set_author($value) |
127 | 133 | { |
128 | 134 | $this->set_head('author', $value); |
@@ -138,26 +144,41 @@ discard block |
||
138 | 144 | $this->set_head('keywords', implode(', ', $array)); |
139 | 145 | } |
140 | 146 | |
147 | + /** |
|
148 | + * @param string $url |
|
149 | + */ |
|
141 | 150 | protected function set_canonical($url) |
142 | 151 | { |
143 | 152 | $this->set_head('canonical', $url); |
144 | 153 | } |
145 | 154 | |
155 | + /** |
|
156 | + * @param string $set |
|
157 | + */ |
|
146 | 158 | protected function set_head($set, $value) |
147 | 159 | { |
148 | 160 | $this->data_array['head'][$set] = $value; |
149 | 161 | } |
150 | 162 | |
163 | + /** |
|
164 | + * @param string $set |
|
165 | + */ |
|
151 | 166 | protected function set_body($set, $value) |
152 | 167 | { |
153 | 168 | $this->data_array['body'][$set] = $value; |
154 | 169 | } |
155 | 170 | |
171 | + /** |
|
172 | + * @param string $file |
|
173 | + */ |
|
156 | 174 | protected function add_css($file, $version = 1) |
157 | 175 | { |
158 | 176 | $this->css_array[] = [$file, $version]; |
159 | 177 | } |
160 | 178 | |
179 | + /** |
|
180 | + * @param string $file |
|
181 | + */ |
|
161 | 182 | protected function add_js($file) |
162 | 183 | { |
163 | 184 | $this->js_array[] = $file; |
@@ -183,6 +204,9 @@ discard block |
||
183 | 204 | $this->set_head('js_link_array', $js_array); |
184 | 205 | } |
185 | 206 | |
207 | + /** |
|
208 | + * @param string $view |
|
209 | + */ |
|
186 | 210 | protected function set_body_view($view) |
187 | 211 | { |
188 | 212 | $this->body_view_array[] = $view; |
@@ -227,6 +251,10 @@ discard block |
||
227 | 251 | } |
228 | 252 | |
229 | 253 | private $comment_errors; |
254 | + |
|
255 | + /** |
|
256 | + * @param string $redirect_url |
|
257 | + */ |
|
230 | 258 | protected function handle_comment_submit($site_id, $path, $redirect_url, $page_title) |
231 | 259 | { |
232 | 260 | if(Request::hasPost() && Request::getPost('submit') == 'Submit Comment') |
@@ -238,6 +266,9 @@ discard block |
||
238 | 266 | return; |
239 | 267 | } |
240 | 268 | |
269 | + /** |
|
270 | + * @param string $site |
|
271 | + */ |
|
241 | 272 | protected function get_comment_array($site, $path) |
242 | 273 | { |
243 | 274 | global $container; |
@@ -5,52 +5,52 @@ discard block |
||
5 | 5 | abstract class PageController |
6 | 6 | { |
7 | 7 | |
8 | - private static $TRACKING_CODE = 'UA-11745070-1'; |
|
8 | + private static $TRACKING_CODE = 'UA-11745070-1'; |
|
9 | 9 | |
10 | - protected static $DEPRECATED_BLOGS = array( |
|
11 | - 10 => 63, |
|
12 | - 55 => 67, |
|
13 | - ); |
|
14 | - |
|
15 | - private $headers; |
|
16 | - private $css_array = array(); |
|
17 | - private $font_css_array = array(); |
|
18 | - private $js_array = array(); |
|
19 | - |
|
20 | - private $data_array = array(); |
|
21 | - private $body_view_array = array(); |
|
22 | - |
|
23 | - protected function set_head_data() {} |
|
24 | - protected function set_body_data() {} |
|
25 | - protected function set_data() {} |
|
26 | - |
|
27 | - public function __construct() |
|
28 | - { |
|
29 | - $this->set_header_method('sendHTML'); |
|
10 | + protected static $DEPRECATED_BLOGS = array( |
|
11 | + 10 => 63, |
|
12 | + 55 => 67, |
|
13 | + ); |
|
14 | + |
|
15 | + private $headers; |
|
16 | + private $css_array = array(); |
|
17 | + private $font_css_array = array(); |
|
18 | + private $js_array = array(); |
|
19 | + |
|
20 | + private $data_array = array(); |
|
21 | + private $body_view_array = array(); |
|
22 | + |
|
23 | + protected function set_head_data() {} |
|
24 | + protected function set_body_data() {} |
|
25 | + protected function set_data() {} |
|
26 | + |
|
27 | + public function __construct() |
|
28 | + { |
|
29 | + $this->set_header_method('sendHTML'); |
|
30 | 30 | |
31 | - $this->set_head('google_verification', 'sgAISiuoWfK54KXnOfm2oU4vQdad8eyNCQX7LkZ1OxM'); |
|
32 | - $this->set_head('bing_verification', 'AF1A4CEA30A7589590E9294C4B512607'); |
|
31 | + $this->set_head('google_verification', 'sgAISiuoWfK54KXnOfm2oU4vQdad8eyNCQX7LkZ1OxM'); |
|
32 | + $this->set_head('bing_verification', 'AF1A4CEA30A7589590E9294C4B512607'); |
|
33 | 33 | |
34 | - $this->set_body('domain_container', $this->get_domain_container()); |
|
35 | - $this->set_body('footer', array( |
|
36 | - 'link' => Loader::getRootUrl('site'), |
|
37 | - 'anchor' => 'jacobemerick.com', |
|
38 | - 'date' => date('Y'))); |
|
39 | - } |
|
40 | - |
|
41 | - protected function get_domain_container() |
|
42 | - { |
|
43 | - $domain_container = new stdclass(); |
|
34 | + $this->set_body('domain_container', $this->get_domain_container()); |
|
35 | + $this->set_body('footer', array( |
|
36 | + 'link' => Loader::getRootUrl('site'), |
|
37 | + 'anchor' => 'jacobemerick.com', |
|
38 | + 'date' => date('Y'))); |
|
39 | + } |
|
40 | + |
|
41 | + protected function get_domain_container() |
|
42 | + { |
|
43 | + $domain_container = new stdclass(); |
|
44 | 44 | |
45 | - $domain_container->blog = Loader::getRootUrl('blog'); |
|
46 | - $domain_container->home = Loader::getRootUrl('home'); |
|
47 | - $domain_container->lifestream = Loader::getRootUrl('lifestream'); |
|
48 | - $domain_container->map = Loader::getRootUrl('map'); |
|
49 | - $domain_container->portfolio = Loader::getRootUrl('portfolio'); |
|
50 | - $domain_container->waterfalls = Loader::getRootUrl('waterfalls'); |
|
45 | + $domain_container->blog = Loader::getRootUrl('blog'); |
|
46 | + $domain_container->home = Loader::getRootUrl('home'); |
|
47 | + $domain_container->lifestream = Loader::getRootUrl('lifestream'); |
|
48 | + $domain_container->map = Loader::getRootUrl('map'); |
|
49 | + $domain_container->portfolio = Loader::getRootUrl('portfolio'); |
|
50 | + $domain_container->waterfalls = Loader::getRootUrl('waterfalls'); |
|
51 | 51 | |
52 | - return $domain_container; |
|
53 | - } |
|
52 | + return $domain_container; |
|
53 | + } |
|
54 | 54 | |
55 | 55 | protected function get_recent_activity() |
56 | 56 | { |
@@ -84,24 +84,24 @@ discard block |
||
84 | 84 | return (object) $post; |
85 | 85 | } |
86 | 86 | |
87 | - public function activate() |
|
88 | - { |
|
89 | - $this->set_head_data(); |
|
90 | - $this->set_body_data(); |
|
91 | - $this->set_data(); |
|
87 | + public function activate() |
|
88 | + { |
|
89 | + $this->set_head_data(); |
|
90 | + $this->set_body_data(); |
|
91 | + $this->set_data(); |
|
92 | 92 | |
93 | - $this->load_assets(); |
|
93 | + $this->load_assets(); |
|
94 | 94 | |
95 | - $headers = $this->headers; |
|
96 | - Header::$headers(); |
|
97 | - Loader::load('view', '/Head', $this->data_array['head']); |
|
98 | - foreach($this->body_view_array as $view) |
|
99 | - { |
|
100 | - if(substr($view, 0, 1) == '/') |
|
101 | - Loader::load('view', $view, $this->data_array['body']); |
|
102 | - else |
|
103 | - Loader::load('view', URLDecode::getSite() . '/' . $view, $this->data_array['body']); |
|
104 | - } |
|
95 | + $headers = $this->headers; |
|
96 | + Header::$headers(); |
|
97 | + Loader::load('view', '/Head', $this->data_array['head']); |
|
98 | + foreach($this->body_view_array as $view) |
|
99 | + { |
|
100 | + if(substr($view, 0, 1) == '/') |
|
101 | + Loader::load('view', $view, $this->data_array['body']); |
|
102 | + else |
|
103 | + Loader::load('view', URLDecode::getSite() . '/' . $view, $this->data_array['body']); |
|
104 | + } |
|
105 | 105 | |
106 | 106 | if (URLDecode::getSite() == 'waterfalls') { |
107 | 107 | Loader::load('view', '/WaterfallFoot'); |
@@ -109,134 +109,134 @@ discard block |
||
109 | 109 | Loader::load('view', '/Foot', array('tracking_code' => self::$TRACKING_CODE)); |
110 | 110 | } |
111 | 111 | |
112 | - if($view == '/404' || $view == '/503') |
|
113 | - exit; |
|
114 | - } |
|
115 | - |
|
116 | - protected function set_header_method($method) |
|
117 | - { |
|
118 | - $this->headers = $method; |
|
119 | - } |
|
120 | - |
|
121 | - protected function set_title($value) |
|
122 | - { |
|
123 | - $this->set_head('title', $value); |
|
124 | - } |
|
125 | - |
|
126 | - protected function set_author($value) |
|
127 | - { |
|
128 | - $this->set_head('author', $value); |
|
129 | - } |
|
130 | - |
|
131 | - protected function set_description($value) |
|
132 | - { |
|
133 | - $this->set_head('description', $value); |
|
134 | - } |
|
135 | - |
|
136 | - protected function set_keywords($array) |
|
137 | - { |
|
138 | - $this->set_head('keywords', implode(', ', $array)); |
|
139 | - } |
|
112 | + if($view == '/404' || $view == '/503') |
|
113 | + exit; |
|
114 | + } |
|
115 | + |
|
116 | + protected function set_header_method($method) |
|
117 | + { |
|
118 | + $this->headers = $method; |
|
119 | + } |
|
120 | + |
|
121 | + protected function set_title($value) |
|
122 | + { |
|
123 | + $this->set_head('title', $value); |
|
124 | + } |
|
125 | + |
|
126 | + protected function set_author($value) |
|
127 | + { |
|
128 | + $this->set_head('author', $value); |
|
129 | + } |
|
130 | + |
|
131 | + protected function set_description($value) |
|
132 | + { |
|
133 | + $this->set_head('description', $value); |
|
134 | + } |
|
135 | + |
|
136 | + protected function set_keywords($array) |
|
137 | + { |
|
138 | + $this->set_head('keywords', implode(', ', $array)); |
|
139 | + } |
|
140 | 140 | |
141 | - protected function set_canonical($url) |
|
142 | - { |
|
143 | - $this->set_head('canonical', $url); |
|
144 | - } |
|
145 | - |
|
146 | - protected function set_head($set, $value) |
|
147 | - { |
|
148 | - $this->data_array['head'][$set] = $value; |
|
149 | - } |
|
150 | - |
|
151 | - protected function set_body($set, $value) |
|
152 | - { |
|
153 | - $this->data_array['body'][$set] = $value; |
|
154 | - } |
|
155 | - |
|
156 | - protected function add_css($file, $version = 1) |
|
157 | - { |
|
158 | - $this->css_array[] = [$file, $version]; |
|
159 | - } |
|
160 | - |
|
161 | - protected function add_js($file) |
|
162 | - { |
|
163 | - $this->js_array[] = $file; |
|
164 | - } |
|
165 | - |
|
166 | - private function load_assets() |
|
167 | - { |
|
141 | + protected function set_canonical($url) |
|
142 | + { |
|
143 | + $this->set_head('canonical', $url); |
|
144 | + } |
|
145 | + |
|
146 | + protected function set_head($set, $value) |
|
147 | + { |
|
148 | + $this->data_array['head'][$set] = $value; |
|
149 | + } |
|
150 | + |
|
151 | + protected function set_body($set, $value) |
|
152 | + { |
|
153 | + $this->data_array['body'][$set] = $value; |
|
154 | + } |
|
155 | + |
|
156 | + protected function add_css($file, $version = 1) |
|
157 | + { |
|
158 | + $this->css_array[] = [$file, $version]; |
|
159 | + } |
|
160 | + |
|
161 | + protected function add_js($file) |
|
162 | + { |
|
163 | + $this->js_array[] = $file; |
|
164 | + } |
|
165 | + |
|
166 | + private function load_assets() |
|
167 | + { |
|
168 | 168 | $css_array = array_map(function ($stylesheet) { |
169 | - $path = "/css/{$stylesheet[0]}.css"; |
|
170 | - if ($stylesheet[1] > 1) { |
|
169 | + $path = "/css/{$stylesheet[0]}.css"; |
|
170 | + if ($stylesheet[1] > 1) { |
|
171 | 171 | $path .= "?v={$stylesheet[1]}"; |
172 | - } |
|
173 | - return $path; |
|
172 | + } |
|
173 | + return $path; |
|
174 | 174 | }, $this->css_array); |
175 | 175 | $js_array = array_map(function ($script) { |
176 | - if (substr($script, 0, 4) == 'http') { |
|
176 | + if (substr($script, 0, 4) == 'http') { |
|
177 | 177 | return $script; |
178 | - } |
|
179 | - return "/js/{$script}.min.js"; |
|
178 | + } |
|
179 | + return "/js/{$script}.min.js"; |
|
180 | 180 | }, $this->js_array); |
181 | 181 | |
182 | - $this->set_head('css_link_array', $css_array); |
|
183 | - $this->set_head('js_link_array', $js_array); |
|
184 | - } |
|
185 | - |
|
186 | - protected function set_body_view($view) |
|
187 | - { |
|
188 | - $this->body_view_array[] = $view; |
|
189 | - } |
|
190 | - |
|
191 | - protected function eject() |
|
192 | - { |
|
193 | - if(get_class($this) !== 'Error404Controller') |
|
194 | - Loader::loadNew('controller', '/Error404Controller')->activate(); |
|
195 | - } |
|
196 | - |
|
197 | - protected function unavailable() |
|
198 | - { |
|
199 | - if(get_class($this) !== 'Error503Controller') |
|
200 | - Loader::loadNew('controller', '/Error503Controller')->activate(); |
|
201 | - } |
|
202 | - |
|
203 | - protected function redirect($uri, $method = 301) |
|
204 | - { |
|
205 | - switch($method) |
|
206 | - { |
|
207 | - case 301 : |
|
208 | - if(get_class($this) !== 'Error301Controller') |
|
209 | - Loader::loadNew('controller', '/Error301Controller', array($uri))->activate(); |
|
210 | - break; |
|
211 | - case 303 : |
|
212 | - if(get_class($this) !== 'Error303Controller') |
|
213 | - Loader::loadNew('controller', '/Error303Controller', array($uri))->activate(); |
|
214 | - break; |
|
215 | - } |
|
216 | - } |
|
217 | - |
|
218 | - final protected function get_parsed_date($date) |
|
219 | - { |
|
220 | - $parsed_date = new stdclass(); |
|
182 | + $this->set_head('css_link_array', $css_array); |
|
183 | + $this->set_head('js_link_array', $js_array); |
|
184 | + } |
|
185 | + |
|
186 | + protected function set_body_view($view) |
|
187 | + { |
|
188 | + $this->body_view_array[] = $view; |
|
189 | + } |
|
190 | + |
|
191 | + protected function eject() |
|
192 | + { |
|
193 | + if(get_class($this) !== 'Error404Controller') |
|
194 | + Loader::loadNew('controller', '/Error404Controller')->activate(); |
|
195 | + } |
|
196 | + |
|
197 | + protected function unavailable() |
|
198 | + { |
|
199 | + if(get_class($this) !== 'Error503Controller') |
|
200 | + Loader::loadNew('controller', '/Error503Controller')->activate(); |
|
201 | + } |
|
202 | + |
|
203 | + protected function redirect($uri, $method = 301) |
|
204 | + { |
|
205 | + switch($method) |
|
206 | + { |
|
207 | + case 301 : |
|
208 | + if(get_class($this) !== 'Error301Controller') |
|
209 | + Loader::loadNew('controller', '/Error301Controller', array($uri))->activate(); |
|
210 | + break; |
|
211 | + case 303 : |
|
212 | + if(get_class($this) !== 'Error303Controller') |
|
213 | + Loader::loadNew('controller', '/Error303Controller', array($uri))->activate(); |
|
214 | + break; |
|
215 | + } |
|
216 | + } |
|
217 | + |
|
218 | + final protected function get_parsed_date($date) |
|
219 | + { |
|
220 | + $parsed_date = new stdclass(); |
|
221 | 221 | |
222 | - $parsed_date->stamp = date('c', strtotime($date)); |
|
223 | - $parsed_date->friendly = date('F j, Y', strtotime($date)); |
|
224 | - $parsed_date->elapsed = Content::instance('ElapsedTime', $date)->activate(); |
|
222 | + $parsed_date->stamp = date('c', strtotime($date)); |
|
223 | + $parsed_date->friendly = date('F j, Y', strtotime($date)); |
|
224 | + $parsed_date->elapsed = Content::instance('ElapsedTime', $date)->activate(); |
|
225 | 225 | |
226 | - return $parsed_date; |
|
227 | - } |
|
228 | - |
|
229 | - private $comment_errors; |
|
230 | - protected function handle_comment_submit($site_id, $path, $redirect_url, $page_title) |
|
231 | - { |
|
232 | - if(Request::hasPost() && Request::getPost('submit') == 'Submit Comment') |
|
233 | - { |
|
234 | - $parameters = array($site_id, $path, $redirect_url, $page_title); |
|
235 | - $this->comment_errors = Loader::loadNew('module', 'form/CommentSubmitModule', $parameters)->activate(); |
|
236 | - } |
|
226 | + return $parsed_date; |
|
227 | + } |
|
228 | + |
|
229 | + private $comment_errors; |
|
230 | + protected function handle_comment_submit($site_id, $path, $redirect_url, $page_title) |
|
231 | + { |
|
232 | + if(Request::hasPost() && Request::getPost('submit') == 'Submit Comment') |
|
233 | + { |
|
234 | + $parameters = array($site_id, $path, $redirect_url, $page_title); |
|
235 | + $this->comment_errors = Loader::loadNew('module', 'form/CommentSubmitModule', $parameters)->activate(); |
|
236 | + } |
|
237 | 237 | |
238 | - return; |
|
239 | - } |
|
238 | + return; |
|
239 | + } |
|
240 | 240 | |
241 | 241 | protected function get_comment_array($site, $path) |
242 | 242 | { |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | $post_result = $activityRepository->getActivities(5); |
60 | 60 | |
61 | 61 | $post_array = array(); |
62 | - foreach($post_result as $row) { |
|
62 | + foreach ($post_result as $row) { |
|
63 | 63 | array_push($post_array, $this->expand_post($row)); |
64 | 64 | } |
65 | 65 | |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | ]; |
76 | 76 | |
77 | 77 | if ($format != 'short') { |
78 | - $post['url'] = Loader::getRootUrl('lifestream') . "{$raw_post['type']}/{$raw_post['id']}/"; |
|
78 | + $post['url'] = Loader::getRootUrl('lifestream')."{$raw_post['type']}/{$raw_post['id']}/"; |
|
79 | 79 | |
80 | 80 | $metadata = json_decode($raw_post['metadata'], true); |
81 | 81 | $post = array_merge($post, $metadata); |
@@ -95,12 +95,12 @@ discard block |
||
95 | 95 | $headers = $this->headers; |
96 | 96 | Header::$headers(); |
97 | 97 | Loader::load('view', '/Head', $this->data_array['head']); |
98 | - foreach($this->body_view_array as $view) |
|
98 | + foreach ($this->body_view_array as $view) |
|
99 | 99 | { |
100 | - if(substr($view, 0, 1) == '/') |
|
100 | + if (substr($view, 0, 1) == '/') |
|
101 | 101 | Loader::load('view', $view, $this->data_array['body']); |
102 | 102 | else |
103 | - Loader::load('view', URLDecode::getSite() . '/' . $view, $this->data_array['body']); |
|
103 | + Loader::load('view', URLDecode::getSite().'/'.$view, $this->data_array['body']); |
|
104 | 104 | } |
105 | 105 | |
106 | 106 | if (URLDecode::getSite() == 'waterfalls') { |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | Loader::load('view', '/Foot', array('tracking_code' => self::$TRACKING_CODE)); |
110 | 110 | } |
111 | 111 | |
112 | - if($view == '/404' || $view == '/503') |
|
112 | + if ($view == '/404' || $view == '/503') |
|
113 | 113 | exit; |
114 | 114 | } |
115 | 115 | |
@@ -165,14 +165,14 @@ discard block |
||
165 | 165 | |
166 | 166 | private function load_assets() |
167 | 167 | { |
168 | - $css_array = array_map(function ($stylesheet) { |
|
168 | + $css_array = array_map(function($stylesheet) { |
|
169 | 169 | $path = "/css/{$stylesheet[0]}.css"; |
170 | 170 | if ($stylesheet[1] > 1) { |
171 | 171 | $path .= "?v={$stylesheet[1]}"; |
172 | 172 | } |
173 | 173 | return $path; |
174 | 174 | }, $this->css_array); |
175 | - $js_array = array_map(function ($script) { |
|
175 | + $js_array = array_map(function($script) { |
|
176 | 176 | if (substr($script, 0, 4) == 'http') { |
177 | 177 | return $script; |
178 | 178 | } |
@@ -190,26 +190,26 @@ discard block |
||
190 | 190 | |
191 | 191 | protected function eject() |
192 | 192 | { |
193 | - if(get_class($this) !== 'Error404Controller') |
|
193 | + if (get_class($this) !== 'Error404Controller') |
|
194 | 194 | Loader::loadNew('controller', '/Error404Controller')->activate(); |
195 | 195 | } |
196 | 196 | |
197 | 197 | protected function unavailable() |
198 | 198 | { |
199 | - if(get_class($this) !== 'Error503Controller') |
|
199 | + if (get_class($this) !== 'Error503Controller') |
|
200 | 200 | Loader::loadNew('controller', '/Error503Controller')->activate(); |
201 | 201 | } |
202 | 202 | |
203 | 203 | protected function redirect($uri, $method = 301) |
204 | 204 | { |
205 | - switch($method) |
|
205 | + switch ($method) |
|
206 | 206 | { |
207 | 207 | case 301 : |
208 | - if(get_class($this) !== 'Error301Controller') |
|
208 | + if (get_class($this) !== 'Error301Controller') |
|
209 | 209 | Loader::loadNew('controller', '/Error301Controller', array($uri))->activate(); |
210 | 210 | break; |
211 | 211 | case 303 : |
212 | - if(get_class($this) !== 'Error303Controller') |
|
212 | + if (get_class($this) !== 'Error303Controller') |
|
213 | 213 | Loader::loadNew('controller', '/Error303Controller', array($uri))->activate(); |
214 | 214 | break; |
215 | 215 | } |
@@ -229,7 +229,7 @@ discard block |
||
229 | 229 | private $comment_errors; |
230 | 230 | protected function handle_comment_submit($site_id, $path, $redirect_url, $page_title) |
231 | 231 | { |
232 | - if(Request::hasPost() && Request::getPost('submit') == 'Submit Comment') |
|
232 | + if (Request::hasPost() && Request::getPost('submit') == 'Submit Comment') |
|
233 | 233 | { |
234 | 234 | $parameters = array($site_id, $path, $redirect_url, $page_title); |
235 | 235 | $this->comment_errors = Loader::loadNew('module', 'form/CommentSubmitModule', $parameters)->activate(); |
@@ -261,7 +261,7 @@ discard block |
||
261 | 261 | $container['logger']->info("CommentService | Path | {$elapsed}"); |
262 | 262 | |
263 | 263 | $array = array(); |
264 | - foreach((array) $comment_response as $comment) |
|
264 | + foreach ((array) $comment_response as $comment) |
|
265 | 265 | { |
266 | 266 | $body = Content::instance('CleanComment', $comment['body'])->activate(); |
267 | 267 | $body = strip_tags($body); |
@@ -2,8 +2,8 @@ discard block |
||
2 | 2 | |
3 | 3 | Loader::load('utility', 'Header'); |
4 | 4 | |
5 | -abstract class PageController |
|
6 | -{ |
|
5 | +abstract class PageController |
|
6 | +{ |
|
7 | 7 | |
8 | 8 | private static $TRACKING_CODE = 'UA-11745070-1'; |
9 | 9 | |
@@ -20,12 +20,18 @@ discard block |
||
20 | 20 | private $data_array = array(); |
21 | 21 | private $body_view_array = array(); |
22 | 22 | |
23 | - protected function set_head_data() {} |
|
24 | - protected function set_body_data() {} |
|
25 | - protected function set_data() {} |
|
23 | + protected function set_head_data() |
|
24 | + { |
|
25 | +} |
|
26 | + protected function set_body_data() |
|
27 | + { |
|
28 | +} |
|
29 | + protected function set_data() |
|
30 | + { |
|
31 | +} |
|
26 | 32 | |
27 | - public function __construct() |
|
28 | - { |
|
33 | + public function __construct() |
|
34 | + { |
|
29 | 35 | $this->set_header_method('sendHTML'); |
30 | 36 | |
31 | 37 | $this->set_head('google_verification', 'sgAISiuoWfK54KXnOfm2oU4vQdad8eyNCQX7LkZ1OxM'); |
@@ -38,8 +44,8 @@ discard block |
||
38 | 44 | 'date' => date('Y'))); |
39 | 45 | } |
40 | 46 | |
41 | - protected function get_domain_container() |
|
42 | - { |
|
47 | + protected function get_domain_container() |
|
48 | + { |
|
43 | 49 | $domain_container = new stdclass(); |
44 | 50 | |
45 | 51 | $domain_container->blog = Loader::getRootUrl('blog'); |
@@ -52,8 +58,8 @@ discard block |
||
52 | 58 | return $domain_container; |
53 | 59 | } |
54 | 60 | |
55 | - protected function get_recent_activity() |
|
56 | - { |
|
61 | + protected function get_recent_activity() |
|
62 | + { |
|
57 | 63 | global $container; |
58 | 64 | $activityRepository = new Jacobemerick\Web\Domain\Stream\Activity\MysqlActivityRepository($container['db_connection_locator']); |
59 | 65 | $post_result = $activityRepository->getActivities(5); |
@@ -66,8 +72,8 @@ discard block |
||
66 | 72 | return $post_array; |
67 | 73 | } |
68 | 74 | |
69 | - protected function expand_post($raw_post, $format = 'short') |
|
70 | - { |
|
75 | + protected function expand_post($raw_post, $format = 'short') |
|
76 | + { |
|
71 | 77 | $post = [ |
72 | 78 | 'type' => $raw_post['type'], |
73 | 79 | 'title' => ($format == 'short') ? $raw_post['message'] : $raw_post['message_long'], |
@@ -84,8 +90,8 @@ discard block |
||
84 | 90 | return (object) $post; |
85 | 91 | } |
86 | 92 | |
87 | - public function activate() |
|
88 | - { |
|
93 | + public function activate() |
|
94 | + { |
|
89 | 95 | $this->set_head_data(); |
90 | 96 | $this->set_body_data(); |
91 | 97 | $this->set_data(); |
@@ -97,10 +103,11 @@ discard block |
||
97 | 103 | Loader::load('view', '/Head', $this->data_array['head']); |
98 | 104 | foreach($this->body_view_array as $view) |
99 | 105 | { |
100 | - if(substr($view, 0, 1) == '/') |
|
101 | - Loader::load('view', $view, $this->data_array['body']); |
|
102 | - else |
|
103 | - Loader::load('view', URLDecode::getSite() . '/' . $view, $this->data_array['body']); |
|
106 | + if(substr($view, 0, 1) == '/') { |
|
107 | + Loader::load('view', $view, $this->data_array['body']); |
|
108 | + } else { |
|
109 | + Loader::load('view', URLDecode::getSite() . '/' . $view, $this->data_array['body']); |
|
110 | + } |
|
104 | 111 | } |
105 | 112 | |
106 | 113 | if (URLDecode::getSite() == 'waterfalls') { |
@@ -109,62 +116,63 @@ discard block |
||
109 | 116 | Loader::load('view', '/Foot', array('tracking_code' => self::$TRACKING_CODE)); |
110 | 117 | } |
111 | 118 | |
112 | - if($view == '/404' || $view == '/503') |
|
113 | - exit; |
|
119 | + if($view == '/404' || $view == '/503') { |
|
120 | + exit; |
|
121 | + } |
|
114 | 122 | } |
115 | 123 | |
116 | - protected function set_header_method($method) |
|
117 | - { |
|
124 | + protected function set_header_method($method) |
|
125 | + { |
|
118 | 126 | $this->headers = $method; |
119 | 127 | } |
120 | 128 | |
121 | - protected function set_title($value) |
|
122 | - { |
|
129 | + protected function set_title($value) |
|
130 | + { |
|
123 | 131 | $this->set_head('title', $value); |
124 | 132 | } |
125 | 133 | |
126 | - protected function set_author($value) |
|
127 | - { |
|
134 | + protected function set_author($value) |
|
135 | + { |
|
128 | 136 | $this->set_head('author', $value); |
129 | 137 | } |
130 | 138 | |
131 | - protected function set_description($value) |
|
132 | - { |
|
139 | + protected function set_description($value) |
|
140 | + { |
|
133 | 141 | $this->set_head('description', $value); |
134 | 142 | } |
135 | 143 | |
136 | - protected function set_keywords($array) |
|
137 | - { |
|
144 | + protected function set_keywords($array) |
|
145 | + { |
|
138 | 146 | $this->set_head('keywords', implode(', ', $array)); |
139 | 147 | } |
140 | 148 | |
141 | - protected function set_canonical($url) |
|
142 | - { |
|
149 | + protected function set_canonical($url) |
|
150 | + { |
|
143 | 151 | $this->set_head('canonical', $url); |
144 | 152 | } |
145 | 153 | |
146 | - protected function set_head($set, $value) |
|
147 | - { |
|
154 | + protected function set_head($set, $value) |
|
155 | + { |
|
148 | 156 | $this->data_array['head'][$set] = $value; |
149 | 157 | } |
150 | 158 | |
151 | - protected function set_body($set, $value) |
|
152 | - { |
|
159 | + protected function set_body($set, $value) |
|
160 | + { |
|
153 | 161 | $this->data_array['body'][$set] = $value; |
154 | 162 | } |
155 | 163 | |
156 | - protected function add_css($file, $version = 1) |
|
157 | - { |
|
164 | + protected function add_css($file, $version = 1) |
|
165 | + { |
|
158 | 166 | $this->css_array[] = [$file, $version]; |
159 | 167 | } |
160 | 168 | |
161 | - protected function add_js($file) |
|
162 | - { |
|
169 | + protected function add_js($file) |
|
170 | + { |
|
163 | 171 | $this->js_array[] = $file; |
164 | 172 | } |
165 | 173 | |
166 | - private function load_assets() |
|
167 | - { |
|
174 | + private function load_assets() |
|
175 | + { |
|
168 | 176 | $css_array = array_map(function ($stylesheet) { |
169 | 177 | $path = "/css/{$stylesheet[0]}.css"; |
170 | 178 | if ($stylesheet[1] > 1) { |
@@ -183,40 +191,44 @@ discard block |
||
183 | 191 | $this->set_head('js_link_array', $js_array); |
184 | 192 | } |
185 | 193 | |
186 | - protected function set_body_view($view) |
|
187 | - { |
|
194 | + protected function set_body_view($view) |
|
195 | + { |
|
188 | 196 | $this->body_view_array[] = $view; |
189 | 197 | } |
190 | 198 | |
191 | - protected function eject() |
|
192 | - { |
|
193 | - if(get_class($this) !== 'Error404Controller') |
|
194 | - Loader::loadNew('controller', '/Error404Controller')->activate(); |
|
199 | + protected function eject() |
|
200 | + { |
|
201 | + if(get_class($this) !== 'Error404Controller') { |
|
202 | + Loader::loadNew('controller', '/Error404Controller')->activate(); |
|
203 | + } |
|
195 | 204 | } |
196 | 205 | |
197 | - protected function unavailable() |
|
198 | - { |
|
199 | - if(get_class($this) !== 'Error503Controller') |
|
200 | - Loader::loadNew('controller', '/Error503Controller')->activate(); |
|
206 | + protected function unavailable() |
|
207 | + { |
|
208 | + if(get_class($this) !== 'Error503Controller') { |
|
209 | + Loader::loadNew('controller', '/Error503Controller')->activate(); |
|
210 | + } |
|
201 | 211 | } |
202 | 212 | |
203 | - protected function redirect($uri, $method = 301) |
|
204 | - { |
|
213 | + protected function redirect($uri, $method = 301) |
|
214 | + { |
|
205 | 215 | switch($method) |
206 | 216 | { |
207 | 217 | case 301 : |
208 | - if(get_class($this) !== 'Error301Controller') |
|
209 | - Loader::loadNew('controller', '/Error301Controller', array($uri))->activate(); |
|
218 | + if(get_class($this) !== 'Error301Controller') { |
|
219 | + Loader::loadNew('controller', '/Error301Controller', array($uri))->activate(); |
|
220 | + } |
|
210 | 221 | break; |
211 | 222 | case 303 : |
212 | - if(get_class($this) !== 'Error303Controller') |
|
213 | - Loader::loadNew('controller', '/Error303Controller', array($uri))->activate(); |
|
223 | + if(get_class($this) !== 'Error303Controller') { |
|
224 | + Loader::loadNew('controller', '/Error303Controller', array($uri))->activate(); |
|
225 | + } |
|
214 | 226 | break; |
215 | 227 | } |
216 | 228 | } |
217 | 229 | |
218 | - final protected function get_parsed_date($date) |
|
219 | - { |
|
230 | + final protected function get_parsed_date($date) |
|
231 | + { |
|
220 | 232 | $parsed_date = new stdclass(); |
221 | 233 | |
222 | 234 | $parsed_date->stamp = date('c', strtotime($date)); |
@@ -227,8 +239,8 @@ discard block |
||
227 | 239 | } |
228 | 240 | |
229 | 241 | private $comment_errors; |
230 | - protected function handle_comment_submit($site_id, $path, $redirect_url, $page_title) |
|
231 | - { |
|
242 | + protected function handle_comment_submit($site_id, $path, $redirect_url, $page_title) |
|
243 | + { |
|
232 | 244 | if(Request::hasPost() && Request::getPost('submit') == 'Submit Comment') |
233 | 245 | { |
234 | 246 | $parameters = array($site_id, $path, $redirect_url, $page_title); |
@@ -238,8 +250,8 @@ discard block |
||
238 | 250 | return; |
239 | 251 | } |
240 | 252 | |
241 | - protected function get_comment_array($site, $path) |
|
242 | - { |
|
253 | + protected function get_comment_array($site, $path) |
|
254 | + { |
|
243 | 255 | global $container; |
244 | 256 | $repository = new Jacobemerick\Web\Domain\Comment\Comment\ServiceCommentRepository($container['comment_service_api']); |
245 | 257 | $start = microtime(true); |
@@ -5,13 +5,13 @@ discard block |
||
5 | 5 | final class CommentCollector extends Collector |
6 | 6 | { |
7 | 7 | |
8 | - public static function getCommenterByFields($name, $email, $website) |
|
9 | - { |
|
10 | - $name = self::escape($name); |
|
11 | - $email = self::escape($email); |
|
12 | - $website = self::escape($website); |
|
8 | + public static function getCommenterByFields($name, $email, $website) |
|
9 | + { |
|
10 | + $name = self::escape($name); |
|
11 | + $email = self::escape($email); |
|
12 | + $website = self::escape($website); |
|
13 | 13 | |
14 | - $query = " |
|
14 | + $query = " |
|
15 | 15 | SELECT |
16 | 16 | * |
17 | 17 | FROM |
@@ -22,14 +22,14 @@ discard block |
||
22 | 22 | `url` = '{$website}' |
23 | 23 | LIMIT 1"; |
24 | 24 | |
25 | - return self::run_row_query($query); |
|
26 | - } |
|
25 | + return self::run_row_query($query); |
|
26 | + } |
|
27 | 27 | |
28 | - public static function getCommentByBody($body) |
|
29 | - { |
|
30 | - $body = self::escape($body); |
|
28 | + public static function getCommentByBody($body) |
|
29 | + { |
|
30 | + $body = self::escape($body); |
|
31 | 31 | |
32 | - $query = " |
|
32 | + $query = " |
|
33 | 33 | SELECT |
34 | 34 | * |
35 | 35 | FROM |
@@ -38,14 +38,14 @@ discard block |
||
38 | 38 | `body` = '{$body}' |
39 | 39 | LIMIT 1"; |
40 | 40 | |
41 | - return self::run_row_query($query); |
|
42 | - } |
|
41 | + return self::run_row_query($query); |
|
42 | + } |
|
43 | 43 | |
44 | - public static function getCommentPageByURL($path, $site) |
|
45 | - { |
|
46 | - $path = self::escape($path); |
|
44 | + public static function getCommentPageByURL($path, $site) |
|
45 | + { |
|
46 | + $path = self::escape($path); |
|
47 | 47 | |
48 | - $query = " |
|
48 | + $query = " |
|
49 | 49 | SELECT |
50 | 50 | * |
51 | 51 | FROM |
@@ -56,12 +56,12 @@ discard block |
||
56 | 56 | LIMIT |
57 | 57 | 1"; |
58 | 58 | |
59 | - return self::run_row_query($query); |
|
60 | - } |
|
59 | + return self::run_row_query($query); |
|
60 | + } |
|
61 | 61 | |
62 | - public static function getNotificationForPage($comment_page) |
|
63 | - { |
|
64 | - $query = " |
|
62 | + public static function getNotificationForPage($comment_page) |
|
63 | + { |
|
64 | + $query = " |
|
65 | 65 | SELECT |
66 | 66 | `name`, |
67 | 67 | `email` |
@@ -80,6 +80,6 @@ discard block |
||
80 | 80 | ORDER BY |
81 | 81 | `date` DESC"; |
82 | 82 | |
83 | - return self::run_query($query); |
|
84 | - } |
|
83 | + return self::run_query($query); |
|
84 | + } |
|
85 | 85 | } |
@@ -2,11 +2,11 @@ discard block |
||
2 | 2 | |
3 | 3 | Loader::load('collector', 'Collector'); |
4 | 4 | |
5 | -final class CommentCollector extends Collector |
|
6 | -{ |
|
5 | +final class CommentCollector extends Collector |
|
6 | +{ |
|
7 | 7 | |
8 | - public static function getCommenterByFields($name, $email, $website) |
|
9 | - { |
|
8 | + public static function getCommenterByFields($name, $email, $website) |
|
9 | + { |
|
10 | 10 | $name = self::escape($name); |
11 | 11 | $email = self::escape($email); |
12 | 12 | $website = self::escape($website); |
@@ -25,8 +25,8 @@ discard block |
||
25 | 25 | return self::run_row_query($query); |
26 | 26 | } |
27 | 27 | |
28 | - public static function getCommentByBody($body) |
|
29 | - { |
|
28 | + public static function getCommentByBody($body) |
|
29 | + { |
|
30 | 30 | $body = self::escape($body); |
31 | 31 | |
32 | 32 | $query = " |
@@ -41,8 +41,8 @@ discard block |
||
41 | 41 | return self::run_row_query($query); |
42 | 42 | } |
43 | 43 | |
44 | - public static function getCommentPageByURL($path, $site) |
|
45 | - { |
|
44 | + public static function getCommentPageByURL($path, $site) |
|
45 | + { |
|
46 | 46 | $path = self::escape($path); |
47 | 47 | |
48 | 48 | $query = " |
@@ -59,8 +59,8 @@ discard block |
||
59 | 59 | return self::run_row_query($query); |
60 | 60 | } |
61 | 61 | |
62 | - public static function getNotificationForPage($comment_page) |
|
63 | - { |
|
62 | + public static function getNotificationForPage($comment_page) |
|
63 | + { |
|
64 | 64 | $query = " |
65 | 65 | SELECT |
66 | 66 | `name`, |
@@ -6,150 +6,150 @@ |
||
6 | 6 | abstract class DefaultPageController extends PageController |
7 | 7 | { |
8 | 8 | |
9 | - private static $RECENT_COMMENT_COUNT = 10; |
|
10 | - private static $MINIMUM_TAG_COUNT = 10; |
|
11 | - protected static $LENGTH_OF_TRIMMED_POST = 300; |
|
9 | + private static $RECENT_COMMENT_COUNT = 10; |
|
10 | + private static $MINIMUM_TAG_COUNT = 10; |
|
11 | + protected static $LENGTH_OF_TRIMMED_POST = 300; |
|
12 | 12 | |
13 | - protected static $BLOG_SITE_ID = 2; |
|
13 | + protected static $BLOG_SITE_ID = 2; |
|
14 | 14 | |
15 | - private static $INTRODUCTION_IMAGE_PATTERN = '<img src="/photo/%s/%s-size-%s.jpg" height="%d" width="%d" alt="%s" />'; |
|
15 | + private static $INTRODUCTION_IMAGE_PATTERN = '<img src="/photo/%s/%s-size-%s.jpg" height="%d" width="%d" alt="%s" />'; |
|
16 | 16 | |
17 | - protected function set_head_data() |
|
18 | - { |
|
17 | + protected function set_head_data() |
|
18 | + { |
|
19 | 19 | $this->set_head('rss_link', [ |
20 | - 'title' => 'Jacob Emerick Blog Feed', |
|
21 | - 'url' => '/rss.xml' |
|
20 | + 'title' => 'Jacob Emerick Blog Feed', |
|
21 | + 'url' => '/rss.xml' |
|
22 | 22 | ]); |
23 | 23 | $this->set_head('rss_comment_link', [ |
24 | - 'title' => 'Jacob Emerick Blog Comment Feed', |
|
25 | - 'url' => '/rss-comments.xml' |
|
24 | + 'title' => 'Jacob Emerick Blog Comment Feed', |
|
25 | + 'url' => '/rss-comments.xml' |
|
26 | 26 | ]); |
27 | 27 | |
28 | - $this->add_css('normalize'); |
|
29 | - $this->add_css('blog'); |
|
30 | - } |
|
31 | - |
|
32 | - protected function get_introduction() |
|
33 | - { |
|
34 | - return; |
|
35 | - } |
|
36 | - |
|
37 | - protected function get_introduction_image($id) |
|
38 | - { |
|
39 | - Loader::load('collector', 'image/PhotoCollector'); |
|
40 | - $photo_result = PhotoCollector::getRow($id); |
|
28 | + $this->add_css('normalize'); |
|
29 | + $this->add_css('blog'); |
|
30 | + } |
|
31 | + |
|
32 | + protected function get_introduction() |
|
33 | + { |
|
34 | + return; |
|
35 | + } |
|
36 | + |
|
37 | + protected function get_introduction_image($id) |
|
38 | + { |
|
39 | + Loader::load('collector', 'image/PhotoCollector'); |
|
40 | + $photo_result = PhotoCollector::getRow($id); |
|
41 | 41 | |
42 | - if($photo_result == null) |
|
43 | - return; |
|
42 | + if($photo_result == null) |
|
43 | + return; |
|
44 | 44 | |
45 | - $name = $photo_result->name; |
|
46 | - $category = $photo_result->category; |
|
47 | - $size = 'medium'; |
|
48 | - $height = 375; |
|
49 | - $width = 500; |
|
50 | - $description = $photo_result->description; |
|
45 | + $name = $photo_result->name; |
|
46 | + $category = $photo_result->category; |
|
47 | + $size = 'medium'; |
|
48 | + $height = 375; |
|
49 | + $width = 500; |
|
50 | + $description = $photo_result->description; |
|
51 | 51 | |
52 | - return sprintf(self::$INTRODUCTION_IMAGE_PATTERN, $category, $name, $size, $height, $width, $description); |
|
53 | - } |
|
54 | - |
|
55 | - protected function set_body_data() |
|
56 | - { |
|
57 | - $this->set_body('introduction', $this->get_introduction()); |
|
58 | - $this->set_body('right_side', $this->get_right_side()); |
|
59 | - $this->set_body('activity_array', $this->get_recent_activity()); |
|
52 | + return sprintf(self::$INTRODUCTION_IMAGE_PATTERN, $category, $name, $size, $height, $width, $description); |
|
53 | + } |
|
54 | + |
|
55 | + protected function set_body_data() |
|
56 | + { |
|
57 | + $this->set_body('introduction', $this->get_introduction()); |
|
58 | + $this->set_body('right_side', $this->get_right_side()); |
|
59 | + $this->set_body('activity_array', $this->get_recent_activity()); |
|
60 | 60 | |
61 | - $this->set_body_view('Page'); |
|
62 | - } |
|
61 | + $this->set_body_view('Page'); |
|
62 | + } |
|
63 | 63 | |
64 | - final protected function format_post($post, $trim = false) |
|
65 | - { |
|
66 | - $post_object = new stdclass(); |
|
64 | + final protected function format_post($post, $trim = false) |
|
65 | + { |
|
66 | + $post_object = new stdclass(); |
|
67 | 67 | |
68 | - $post_object->title = $post['title']; |
|
69 | - $post_object->path = "/{$post['category']}/{$post['path']}/"; |
|
70 | - $post_object->category = ucwords(str_replace('-', ' ', $post['category'])); |
|
71 | - $post_object->category_link = "/{$post['category']}/"; |
|
72 | - $post_object->tags = $this->get_tags_for_post($post); |
|
73 | - $post_object->image = Content::instance('FetchFirstPhoto', $post['body'])->activate(false, 'small'); |
|
74 | - $post_object->body = $this->get_body_for_post($post, $trim); |
|
75 | - $post_object->date = $this->get_parsed_date($post['date']); |
|
76 | - |
|
77 | - return $post_object; |
|
78 | - } |
|
79 | - |
|
80 | - final private function get_tags_for_post($post) |
|
81 | - { |
|
68 | + $post_object->title = $post['title']; |
|
69 | + $post_object->path = "/{$post['category']}/{$post['path']}/"; |
|
70 | + $post_object->category = ucwords(str_replace('-', ' ', $post['category'])); |
|
71 | + $post_object->category_link = "/{$post['category']}/"; |
|
72 | + $post_object->tags = $this->get_tags_for_post($post); |
|
73 | + $post_object->image = Content::instance('FetchFirstPhoto', $post['body'])->activate(false, 'small'); |
|
74 | + $post_object->body = $this->get_body_for_post($post, $trim); |
|
75 | + $post_object->date = $this->get_parsed_date($post['date']); |
|
76 | + |
|
77 | + return $post_object; |
|
78 | + } |
|
79 | + |
|
80 | + final private function get_tags_for_post($post) |
|
81 | + { |
|
82 | 82 | global $container; |
83 | 83 | $repository = new Jacobemerick\Web\Domain\Blog\Tag\MysqlTagRepository($container['db_connection_locator']); |
84 | 84 | $tag_result = $repository->getTagsForPost($post['id']); |
85 | 85 | |
86 | 86 | $tag_array = array(); |
87 | - foreach($tag_result as $tag) |
|
88 | - { |
|
89 | - $tag_object = new stdclass(); |
|
90 | - $tag_object->name = $tag['tag']; |
|
91 | - $tag_object->link = Content::instance('URLSafe', "/tag/{$tag['tag']}/")->activate(); |
|
92 | - $tag_array[] = $tag_object; |
|
93 | - } |
|
94 | - return $tag_array; |
|
95 | - } |
|
96 | - |
|
97 | - final private function get_body_for_post($post, $trim) |
|
98 | - { |
|
99 | - $body = $post['body']; |
|
87 | + foreach($tag_result as $tag) |
|
88 | + { |
|
89 | + $tag_object = new stdclass(); |
|
90 | + $tag_object->name = $tag['tag']; |
|
91 | + $tag_object->link = Content::instance('URLSafe', "/tag/{$tag['tag']}/")->activate(); |
|
92 | + $tag_array[] = $tag_object; |
|
93 | + } |
|
94 | + return $tag_array; |
|
95 | + } |
|
96 | + |
|
97 | + final private function get_body_for_post($post, $trim) |
|
98 | + { |
|
99 | + $body = $post['body']; |
|
100 | 100 | |
101 | - if($trim) |
|
102 | - $body = Content::instance('SmartTrim', $body)->activate(self::$LENGTH_OF_TRIMMED_POST); |
|
101 | + if($trim) |
|
102 | + $body = Content::instance('SmartTrim', $body)->activate(self::$LENGTH_OF_TRIMMED_POST); |
|
103 | 103 | |
104 | - $body = Content::instance('FixPhoto', $body)->activate(false, 'standard'); |
|
105 | - $body = Content::instance('MarkupCode', $body)->activate(); |
|
104 | + $body = Content::instance('FixPhoto', $body)->activate(false, 'standard'); |
|
105 | + $body = Content::instance('MarkupCode', $body)->activate(); |
|
106 | 106 | |
107 | - return $body; |
|
108 | - } |
|
109 | - |
|
110 | - final protected function get_right_side() |
|
111 | - { |
|
112 | - $side_array = array(); |
|
113 | - $side_array['tags'] = $this->get_tag_cloud(); |
|
114 | - $side_array['comments'] = $this->get_comments(); |
|
115 | - return $side_array; |
|
116 | - } |
|
117 | - |
|
118 | - final private function get_tag_cloud() |
|
119 | - { |
|
107 | + return $body; |
|
108 | + } |
|
109 | + |
|
110 | + final protected function get_right_side() |
|
111 | + { |
|
112 | + $side_array = array(); |
|
113 | + $side_array['tags'] = $this->get_tag_cloud(); |
|
114 | + $side_array['comments'] = $this->get_comments(); |
|
115 | + return $side_array; |
|
116 | + } |
|
117 | + |
|
118 | + final private function get_tag_cloud() |
|
119 | + { |
|
120 | 120 | global $container; |
121 | 121 | $repository = new Jacobemerick\Web\Domain\Blog\Tag\MysqlTagRepository($container['db_connection_locator']); |
122 | 122 | $tag_result = $repository->getTagCloud(); |
123 | 123 | |
124 | - $maximum_tag_count = $this->get_maximum_tag_count($tag_result); |
|
124 | + $maximum_tag_count = $this->get_maximum_tag_count($tag_result); |
|
125 | 125 | |
126 | - $cloud_array = array(); |
|
127 | - foreach($tag_result as $tag) |
|
128 | - { |
|
129 | - if($tag['count'] < self::$MINIMUM_TAG_COUNT) |
|
130 | - continue; |
|
126 | + $cloud_array = array(); |
|
127 | + foreach($tag_result as $tag) |
|
128 | + { |
|
129 | + if($tag['count'] < self::$MINIMUM_TAG_COUNT) |
|
130 | + continue; |
|
131 | 131 | |
132 | - $tag_object = new stdclass(); |
|
133 | - $tag_object->name = $tag['tag']; |
|
134 | - $tag_object->link = Content::instance('URLSafe', "/tag/{$tag['tag']}/")->activate(); |
|
135 | - $tag_object->scalar = floor(($tag['count'] - 1) * (9 / ($maximum_tag_count - self::$MINIMUM_TAG_COUNT))); |
|
136 | - $cloud_array[] = $tag_object; |
|
137 | - } |
|
132 | + $tag_object = new stdclass(); |
|
133 | + $tag_object->name = $tag['tag']; |
|
134 | + $tag_object->link = Content::instance('URLSafe', "/tag/{$tag['tag']}/")->activate(); |
|
135 | + $tag_object->scalar = floor(($tag['count'] - 1) * (9 / ($maximum_tag_count - self::$MINIMUM_TAG_COUNT))); |
|
136 | + $cloud_array[] = $tag_object; |
|
137 | + } |
|
138 | 138 | |
139 | - return $cloud_array; |
|
140 | - } |
|
139 | + return $cloud_array; |
|
140 | + } |
|
141 | 141 | |
142 | - final private function get_maximum_tag_count($tag_result) |
|
143 | - { |
|
144 | - $maximum = 1; |
|
142 | + final private function get_maximum_tag_count($tag_result) |
|
143 | + { |
|
144 | + $maximum = 1; |
|
145 | 145 | |
146 | - foreach($tag_result as $tag) |
|
147 | - { |
|
148 | - if($tag['count'] > $maximum) |
|
149 | - $maximum = $tag['count']; |
|
150 | - } |
|
151 | - return $maximum; |
|
152 | - } |
|
146 | + foreach($tag_result as $tag) |
|
147 | + { |
|
148 | + if($tag['count'] > $maximum) |
|
149 | + $maximum = $tag['count']; |
|
150 | + } |
|
151 | + return $maximum; |
|
152 | + } |
|
153 | 153 | |
154 | 154 | final private function get_comments() |
155 | 155 | { |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | Loader::load('collector', 'image/PhotoCollector'); |
40 | 40 | $photo_result = PhotoCollector::getRow($id); |
41 | 41 | |
42 | - if($photo_result == null) |
|
42 | + if ($photo_result == null) |
|
43 | 43 | return; |
44 | 44 | |
45 | 45 | $name = $photo_result->name; |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | $tag_result = $repository->getTagsForPost($post['id']); |
85 | 85 | |
86 | 86 | $tag_array = array(); |
87 | - foreach($tag_result as $tag) |
|
87 | + foreach ($tag_result as $tag) |
|
88 | 88 | { |
89 | 89 | $tag_object = new stdclass(); |
90 | 90 | $tag_object->name = $tag['tag']; |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | { |
99 | 99 | $body = $post['body']; |
100 | 100 | |
101 | - if($trim) |
|
101 | + if ($trim) |
|
102 | 102 | $body = Content::instance('SmartTrim', $body)->activate(self::$LENGTH_OF_TRIMMED_POST); |
103 | 103 | |
104 | 104 | $body = Content::instance('FixPhoto', $body)->activate(false, 'standard'); |
@@ -124,9 +124,9 @@ discard block |
||
124 | 124 | $maximum_tag_count = $this->get_maximum_tag_count($tag_result); |
125 | 125 | |
126 | 126 | $cloud_array = array(); |
127 | - foreach($tag_result as $tag) |
|
127 | + foreach ($tag_result as $tag) |
|
128 | 128 | { |
129 | - if($tag['count'] < self::$MINIMUM_TAG_COUNT) |
|
129 | + if ($tag['count'] < self::$MINIMUM_TAG_COUNT) |
|
130 | 130 | continue; |
131 | 131 | |
132 | 132 | $tag_object = new stdclass(); |
@@ -143,9 +143,9 @@ discard block |
||
143 | 143 | { |
144 | 144 | $maximum = 1; |
145 | 145 | |
146 | - foreach($tag_result as $tag) |
|
146 | + foreach ($tag_result as $tag) |
|
147 | 147 | { |
148 | - if($tag['count'] > $maximum) |
|
148 | + if ($tag['count'] > $maximum) |
|
149 | 149 | $maximum = $tag['count']; |
150 | 150 | } |
151 | 151 | return $maximum; |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | $container['logger']->info("CommentService | Sidebar | {$elapsed}"); |
175 | 175 | |
176 | 176 | $array = array(); |
177 | - foreach($comment_response as $comment) |
|
177 | + foreach ($comment_response as $comment) |
|
178 | 178 | { |
179 | 179 | $body = Content::instance('CleanComment', $comment['body'])->activate(); |
180 | 180 | $body = strip_tags($body); |
@@ -3,8 +3,8 @@ discard block |
||
3 | 3 | Loader::load('controller', '/PageController'); |
4 | 4 | Loader::load('utility', 'Content'); |
5 | 5 | |
6 | -abstract class DefaultPageController extends PageController |
|
7 | -{ |
|
6 | +abstract class DefaultPageController extends PageController |
|
7 | +{ |
|
8 | 8 | |
9 | 9 | private static $RECENT_COMMENT_COUNT = 10; |
10 | 10 | private static $MINIMUM_TAG_COUNT = 10; |
@@ -14,8 +14,8 @@ discard block |
||
14 | 14 | |
15 | 15 | private static $INTRODUCTION_IMAGE_PATTERN = '<img src="/photo/%s/%s-size-%s.jpg" height="%d" width="%d" alt="%s" />'; |
16 | 16 | |
17 | - protected function set_head_data() |
|
18 | - { |
|
17 | + protected function set_head_data() |
|
18 | + { |
|
19 | 19 | $this->set_head('rss_link', [ |
20 | 20 | 'title' => 'Jacob Emerick Blog Feed', |
21 | 21 | 'url' => '/rss.xml' |
@@ -29,18 +29,19 @@ discard block |
||
29 | 29 | $this->add_css('blog'); |
30 | 30 | } |
31 | 31 | |
32 | - protected function get_introduction() |
|
33 | - { |
|
32 | + protected function get_introduction() |
|
33 | + { |
|
34 | 34 | return; |
35 | 35 | } |
36 | 36 | |
37 | - protected function get_introduction_image($id) |
|
38 | - { |
|
37 | + protected function get_introduction_image($id) |
|
38 | + { |
|
39 | 39 | Loader::load('collector', 'image/PhotoCollector'); |
40 | 40 | $photo_result = PhotoCollector::getRow($id); |
41 | 41 | |
42 | - if($photo_result == null) |
|
43 | - return; |
|
42 | + if($photo_result == null) { |
|
43 | + return; |
|
44 | + } |
|
44 | 45 | |
45 | 46 | $name = $photo_result->name; |
46 | 47 | $category = $photo_result->category; |
@@ -52,8 +53,8 @@ discard block |
||
52 | 53 | return sprintf(self::$INTRODUCTION_IMAGE_PATTERN, $category, $name, $size, $height, $width, $description); |
53 | 54 | } |
54 | 55 | |
55 | - protected function set_body_data() |
|
56 | - { |
|
56 | + protected function set_body_data() |
|
57 | + { |
|
57 | 58 | $this->set_body('introduction', $this->get_introduction()); |
58 | 59 | $this->set_body('right_side', $this->get_right_side()); |
59 | 60 | $this->set_body('activity_array', $this->get_recent_activity()); |
@@ -61,8 +62,8 @@ discard block |
||
61 | 62 | $this->set_body_view('Page'); |
62 | 63 | } |
63 | 64 | |
64 | - final protected function format_post($post, $trim = false) |
|
65 | - { |
|
65 | + final protected function format_post($post, $trim = false) |
|
66 | + { |
|
66 | 67 | $post_object = new stdclass(); |
67 | 68 | |
68 | 69 | $post_object->title = $post['title']; |
@@ -77,8 +78,8 @@ discard block |
||
77 | 78 | return $post_object; |
78 | 79 | } |
79 | 80 | |
80 | - final private function get_tags_for_post($post) |
|
81 | - { |
|
81 | + final private function get_tags_for_post($post) |
|
82 | + { |
|
82 | 83 | global $container; |
83 | 84 | $repository = new Jacobemerick\Web\Domain\Blog\Tag\MysqlTagRepository($container['db_connection_locator']); |
84 | 85 | $tag_result = $repository->getTagsForPost($post['id']); |
@@ -94,12 +95,13 @@ discard block |
||
94 | 95 | return $tag_array; |
95 | 96 | } |
96 | 97 | |
97 | - final private function get_body_for_post($post, $trim) |
|
98 | - { |
|
98 | + final private function get_body_for_post($post, $trim) |
|
99 | + { |
|
99 | 100 | $body = $post['body']; |
100 | 101 | |
101 | - if($trim) |
|
102 | - $body = Content::instance('SmartTrim', $body)->activate(self::$LENGTH_OF_TRIMMED_POST); |
|
102 | + if($trim) { |
|
103 | + $body = Content::instance('SmartTrim', $body)->activate(self::$LENGTH_OF_TRIMMED_POST); |
|
104 | + } |
|
103 | 105 | |
104 | 106 | $body = Content::instance('FixPhoto', $body)->activate(false, 'standard'); |
105 | 107 | $body = Content::instance('MarkupCode', $body)->activate(); |
@@ -107,16 +109,16 @@ discard block |
||
107 | 109 | return $body; |
108 | 110 | } |
109 | 111 | |
110 | - final protected function get_right_side() |
|
111 | - { |
|
112 | + final protected function get_right_side() |
|
113 | + { |
|
112 | 114 | $side_array = array(); |
113 | 115 | $side_array['tags'] = $this->get_tag_cloud(); |
114 | 116 | $side_array['comments'] = $this->get_comments(); |
115 | 117 | return $side_array; |
116 | 118 | } |
117 | 119 | |
118 | - final private function get_tag_cloud() |
|
119 | - { |
|
120 | + final private function get_tag_cloud() |
|
121 | + { |
|
120 | 122 | global $container; |
121 | 123 | $repository = new Jacobemerick\Web\Domain\Blog\Tag\MysqlTagRepository($container['db_connection_locator']); |
122 | 124 | $tag_result = $repository->getTagCloud(); |
@@ -126,8 +128,9 @@ discard block |
||
126 | 128 | $cloud_array = array(); |
127 | 129 | foreach($tag_result as $tag) |
128 | 130 | { |
129 | - if($tag['count'] < self::$MINIMUM_TAG_COUNT) |
|
130 | - continue; |
|
131 | + if($tag['count'] < self::$MINIMUM_TAG_COUNT) { |
|
132 | + continue; |
|
133 | + } |
|
131 | 134 | |
132 | 135 | $tag_object = new stdclass(); |
133 | 136 | $tag_object->name = $tag['tag']; |
@@ -139,20 +142,21 @@ discard block |
||
139 | 142 | return $cloud_array; |
140 | 143 | } |
141 | 144 | |
142 | - final private function get_maximum_tag_count($tag_result) |
|
143 | - { |
|
145 | + final private function get_maximum_tag_count($tag_result) |
|
146 | + { |
|
144 | 147 | $maximum = 1; |
145 | 148 | |
146 | 149 | foreach($tag_result as $tag) |
147 | 150 | { |
148 | - if($tag['count'] > $maximum) |
|
149 | - $maximum = $tag['count']; |
|
151 | + if($tag['count'] > $maximum) { |
|
152 | + $maximum = $tag['count']; |
|
153 | + } |
|
150 | 154 | } |
151 | 155 | return $maximum; |
152 | 156 | } |
153 | 157 | |
154 | - final private function get_comments() |
|
155 | - { |
|
158 | + final private function get_comments() |
|
159 | + { |
|
156 | 160 | global $container; |
157 | 161 | $repository = new Jacobemerick\Web\Domain\Comment\Comment\ServiceCommentRepository($container['comment_service_api']); |
158 | 162 | $start = microtime(true); |
@@ -1,71 +1,71 @@ |
||
1 | 1 | <? |
2 | 2 | |
3 | 3 | Loader::load('collector', array( |
4 | - 'waterfall/CountyCollector', |
|
5 | - 'waterfall/WatercourseCollector', |
|
6 | - 'waterfall/WaterfallCollector')); |
|
4 | + 'waterfall/CountyCollector', |
|
5 | + 'waterfall/WatercourseCollector', |
|
6 | + 'waterfall/WaterfallCollector')); |
|
7 | 7 | Loader::load('controller', 'waterfalls/DefaultListController'); |
8 | 8 | |
9 | 9 | abstract class DefaultWaterfallListController extends DefaultListController |
10 | 10 | { |
11 | 11 | |
12 | - protected static $ITEM_COUNT_PER_PAGE = 24; |
|
12 | + protected static $ITEM_COUNT_PER_PAGE = 24; |
|
13 | 13 | |
14 | - final protected function get_list_view() |
|
15 | - { |
|
16 | - return 'FallListing'; |
|
17 | - } |
|
14 | + final protected function get_list_view() |
|
15 | + { |
|
16 | + return 'FallListing'; |
|
17 | + } |
|
18 | 18 | |
19 | - protected function get_item_count_per_page() |
|
20 | - { |
|
21 | - return self::$ITEM_COUNT_PER_PAGE; |
|
22 | - } |
|
19 | + protected function get_item_count_per_page() |
|
20 | + { |
|
21 | + return self::$ITEM_COUNT_PER_PAGE; |
|
22 | + } |
|
23 | 23 | |
24 | - final protected function format_item($item) |
|
25 | - { |
|
26 | - $item_array = array(); |
|
24 | + final protected function format_item($item) |
|
25 | + { |
|
26 | + $item_array = array(); |
|
27 | 27 | |
28 | - $item_array['name'] = $item->name; |
|
29 | - $item_array['watercourse'] = $item->watercourse; |
|
30 | - $item_array['county'] = $item->county; |
|
31 | - $item_array['image'] = $this->get_image_element($item->photo_category, $item->photo, $item->photo_description, 'medium'); |
|
32 | - $item_array['path'] = "/{$item->watercourse_alias}/{$item->waterfall_alias}/"; |
|
33 | - $item_array['comment_count'] = 0; // todo this |
|
28 | + $item_array['name'] = $item->name; |
|
29 | + $item_array['watercourse'] = $item->watercourse; |
|
30 | + $item_array['county'] = $item->county; |
|
31 | + $item_array['image'] = $this->get_image_element($item->photo_category, $item->photo, $item->photo_description, 'medium'); |
|
32 | + $item_array['path'] = "/{$item->watercourse_alias}/{$item->waterfall_alias}/"; |
|
33 | + $item_array['comment_count'] = 0; // todo this |
|
34 | 34 | |
35 | - return $item_array; |
|
36 | - } |
|
35 | + return $item_array; |
|
36 | + } |
|
37 | 37 | |
38 | - final protected function get_sidebar() |
|
39 | - { |
|
40 | - $county_result = CountyCollector::getCountyList(); |
|
41 | - $county_list = array(); |
|
38 | + final protected function get_sidebar() |
|
39 | + { |
|
40 | + $county_result = CountyCollector::getCountyList(); |
|
41 | + $county_list = array(); |
|
42 | 42 | |
43 | - foreach($county_result as $county_row) |
|
44 | - { |
|
45 | - $county = new stdclass(); |
|
46 | - $county->name = $county_row->name; |
|
47 | - $county->uri = "/{$county_row->alias}/"; |
|
48 | - $county->count = $county_row->count; |
|
43 | + foreach($county_result as $county_row) |
|
44 | + { |
|
45 | + $county = new stdclass(); |
|
46 | + $county->name = $county_row->name; |
|
47 | + $county->uri = "/{$county_row->alias}/"; |
|
48 | + $county->count = $county_row->count; |
|
49 | 49 | |
50 | - $county_list[] = $county; |
|
51 | - } |
|
50 | + $county_list[] = $county; |
|
51 | + } |
|
52 | 52 | |
53 | - $watercourse_result = WatercourseCollector::getWatercourseList(); |
|
54 | - $watercourse_list = array(); |
|
53 | + $watercourse_result = WatercourseCollector::getWatercourseList(); |
|
54 | + $watercourse_list = array(); |
|
55 | 55 | |
56 | - foreach($watercourse_result as $watercourse_row) |
|
57 | - { |
|
58 | - $watercourse = new stdclass(); |
|
59 | - $watercourse->name = $watercourse_row->name; |
|
60 | - $watercourse->uri = "/{$watercourse_row->alias}/"; |
|
61 | - $watercourse->count = $watercourse_row->count; |
|
56 | + foreach($watercourse_result as $watercourse_row) |
|
57 | + { |
|
58 | + $watercourse = new stdclass(); |
|
59 | + $watercourse->name = $watercourse_row->name; |
|
60 | + $watercourse->uri = "/{$watercourse_row->alias}/"; |
|
61 | + $watercourse->count = $watercourse_row->count; |
|
62 | 62 | |
63 | - $watercourse_list[] = $watercourse; |
|
64 | - } |
|
63 | + $watercourse_list[] = $watercourse; |
|
64 | + } |
|
65 | 65 | |
66 | - return array( |
|
67 | - 'county_list' => $county_list, |
|
68 | - 'watercourse_list' => $watercourse_list); |
|
69 | - } |
|
66 | + return array( |
|
67 | + 'county_list' => $county_list, |
|
68 | + 'watercourse_list' => $watercourse_list); |
|
69 | + } |
|
70 | 70 | |
71 | 71 | } |
@@ -82,7 +82,7 @@ |
||
82 | 82 | $container['logger']->info("CommentService | Sidebar | {$elapsed}"); |
83 | 83 | |
84 | 84 | $array = array(); |
85 | - foreach($comment_response as $comment) |
|
85 | + foreach ($comment_response as $comment) |
|
86 | 86 | { |
87 | 87 | $body = Content::instance('CleanComment', $comment['body'])->activate(); |
88 | 88 | $body = strip_tags($body); |
@@ -6,8 +6,8 @@ discard block |
||
6 | 6 | )); |
7 | 7 | Loader::load('controller', 'waterfalls/DefaultPageController'); |
8 | 8 | |
9 | -final class HomeController extends DefaultPageController |
|
10 | -{ |
|
9 | +final class HomeController extends DefaultPageController |
|
10 | +{ |
|
11 | 11 | |
12 | 12 | private static $TITLE = 'Waterfalls of the Keweenaw | Stories and Tips from Jacob Emerick'; |
13 | 13 | private static $DESCRIPTION = 'Stories, maps, and details about many of the waterfalls in the Upper Peninsula of Michigan, compiled by Jacob Emerick.'; |
@@ -20,8 +20,8 @@ discard block |
||
20 | 20 | |
21 | 21 | private static $BANNER_IMAGE = 2661; |
22 | 22 | |
23 | - protected function set_head_data() |
|
24 | - { |
|
23 | + protected function set_head_data() |
|
24 | + { |
|
25 | 25 | parent::set_head_data(); |
26 | 26 | |
27 | 27 | $this->set_title(self::$TITLE); |
@@ -29,8 +29,8 @@ discard block |
||
29 | 29 | $this->set_keywords(self::$KEYWORD_ARRAY); |
30 | 30 | } |
31 | 31 | |
32 | - protected function set_body_data($page_type = 'wide') |
|
33 | - { |
|
32 | + protected function set_body_data($page_type = 'wide') |
|
33 | + { |
|
34 | 34 | parent::set_body_data($page_type); |
35 | 35 | |
36 | 36 | $photo = PhotoCollector::getRow(self::$BANNER_IMAGE); |
@@ -59,8 +59,8 @@ discard block |
||
59 | 59 | $this->set_body('view', 'Home'); |
60 | 60 | } |
61 | 61 | |
62 | - protected function get_comments() |
|
63 | - { |
|
62 | + protected function get_comments() |
|
63 | + { |
|
64 | 64 | global $container; |
65 | 65 | $repository = new Jacobemerick\Web\Domain\Comment\Comment\ServiceCommentRepository($container['comment_service_api']); |
66 | 66 | $start = microtime(true); |
@@ -1,72 +1,72 @@ |
||
1 | 1 | <? |
2 | 2 | |
3 | 3 | Loader::load('collector', array( |
4 | - 'waterfall/CompanionCollector', |
|
5 | - 'waterfall/LogCollector', |
|
6 | - 'waterfall/PeriodCollector')); |
|
4 | + 'waterfall/CompanionCollector', |
|
5 | + 'waterfall/LogCollector', |
|
6 | + 'waterfall/PeriodCollector')); |
|
7 | 7 | Loader::load('controller', 'waterfalls/DefaultListController'); |
8 | 8 | |
9 | 9 | abstract class DefaultLogListController extends DefaultListController |
10 | 10 | { |
11 | 11 | |
12 | - private static $ITEM_COUNT_PER_PAGE = 10; |
|
12 | + private static $ITEM_COUNT_PER_PAGE = 10; |
|
13 | 13 | |
14 | - final protected function get_list_view() |
|
15 | - { |
|
16 | - return 'LogListing'; |
|
17 | - } |
|
14 | + final protected function get_list_view() |
|
15 | + { |
|
16 | + return 'LogListing'; |
|
17 | + } |
|
18 | 18 | |
19 | - final protected function get_item_count_per_page() |
|
20 | - { |
|
21 | - return self::$ITEM_COUNT_PER_PAGE; |
|
22 | - } |
|
19 | + final protected function get_item_count_per_page() |
|
20 | + { |
|
21 | + return self::$ITEM_COUNT_PER_PAGE; |
|
22 | + } |
|
23 | 23 | |
24 | - final protected function format_item($item) |
|
25 | - { |
|
26 | - $item_array = array(); |
|
24 | + final protected function format_item($item) |
|
25 | + { |
|
26 | + $item_array = array(); |
|
27 | 27 | |
28 | - $item_array['title'] = $item->title; |
|
29 | - $item_array['image'] = $this->get_image_element($item->photo_category, $item->photo, $item->photo_description); |
|
30 | - $item_array['waterfall_list'] = LogCollector::getWaterfallListForLog($item->id); |
|
31 | - $item_array['introduction'] = $item->introduction; |
|
32 | - $item_array['path'] = "/journal/{$item->alias}/"; |
|
33 | - $item_array['comment_count'] = 0; // todo - this |
|
34 | - $item_array['date'] = $this->get_parsed_date($item->date); |
|
28 | + $item_array['title'] = $item->title; |
|
29 | + $item_array['image'] = $this->get_image_element($item->photo_category, $item->photo, $item->photo_description); |
|
30 | + $item_array['waterfall_list'] = LogCollector::getWaterfallListForLog($item->id); |
|
31 | + $item_array['introduction'] = $item->introduction; |
|
32 | + $item_array['path'] = "/journal/{$item->alias}/"; |
|
33 | + $item_array['comment_count'] = 0; // todo - this |
|
34 | + $item_array['date'] = $this->get_parsed_date($item->date); |
|
35 | 35 | |
36 | - return $item_array; |
|
37 | - } |
|
36 | + return $item_array; |
|
37 | + } |
|
38 | 38 | |
39 | - final protected function get_sidebar() |
|
40 | - { |
|
41 | - $companion_result = CompanionCollector::getCompanionList(); |
|
42 | - $companion_list = array(); |
|
39 | + final protected function get_sidebar() |
|
40 | + { |
|
41 | + $companion_result = CompanionCollector::getCompanionList(); |
|
42 | + $companion_list = array(); |
|
43 | 43 | |
44 | - foreach($companion_result as $companion_row) |
|
45 | - { |
|
46 | - $companion = new stdclass(); |
|
47 | - $companion->name = $companion_row->name; |
|
48 | - $companion->uri = "/companion/{$companion_row->alias}/"; |
|
49 | - $companion->count = $companion_row->count; |
|
44 | + foreach($companion_result as $companion_row) |
|
45 | + { |
|
46 | + $companion = new stdclass(); |
|
47 | + $companion->name = $companion_row->name; |
|
48 | + $companion->uri = "/companion/{$companion_row->alias}/"; |
|
49 | + $companion->count = $companion_row->count; |
|
50 | 50 | |
51 | - $companion_list[] = $companion; |
|
52 | - } |
|
51 | + $companion_list[] = $companion; |
|
52 | + } |
|
53 | 53 | |
54 | - $period_result = PeriodCollector::getPeriodList(); |
|
55 | - $period_list = array(); |
|
54 | + $period_result = PeriodCollector::getPeriodList(); |
|
55 | + $period_list = array(); |
|
56 | 56 | |
57 | - foreach($period_result as $period_row) |
|
58 | - { |
|
59 | - $period = new stdclass(); |
|
60 | - $period->name = $period_row->name; |
|
61 | - $period->uri = "/period/{$period_row->alias}/"; |
|
62 | - $period->count = $period_row->count; |
|
57 | + foreach($period_result as $period_row) |
|
58 | + { |
|
59 | + $period = new stdclass(); |
|
60 | + $period->name = $period_row->name; |
|
61 | + $period->uri = "/period/{$period_row->alias}/"; |
|
62 | + $period->count = $period_row->count; |
|
63 | 63 | |
64 | - $period_list[] = $period; |
|
65 | - } |
|
64 | + $period_list[] = $period; |
|
65 | + } |
|
66 | 66 | |
67 | - return array( |
|
68 | - 'companion_list' => $companion_list, |
|
69 | - 'period_list' => $period_list); |
|
70 | - } |
|
67 | + return array( |
|
68 | + 'companion_list' => $companion_list, |
|
69 | + 'period_list' => $period_list); |
|
70 | + } |
|
71 | 71 | |
72 | 72 | } |