@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | $comment_id = $this->save_comment(); |
42 | 42 | |
43 | 43 | $comment_meta_id = $this->save_comment_meta($commenter_id, $comment_id, $page_id); |
44 | - $comment_service_id = $this->save_to_comment_service(Request::getPost()); |
|
44 | + $comment_service_id = $this->save_to_comment_service(Request::getPost()); |
|
45 | 45 | |
46 | 46 | $this->send_notifications($page_id); |
47 | 47 | $this->redirect_to_comment($comment_meta_id); |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | if(Request::getPost('website') != '') |
89 | 89 | $cookie_value['website'] = Request::getPost('website'); |
90 | 90 | |
91 | - setcookie('commenter', json_encode($cookie_value), time() + 31536000, '/', 'jacobemerick.com'); |
|
91 | + setcookie('commenter', json_encode($cookie_value), time() + 31536000, '/', 'jacobemerick.com'); |
|
92 | 92 | |
93 | 93 | $commenter_result = CommentCollector::getCommenterByFields(Request::getPost('name'), Request::getPost('email'), Request::getPost('website')); |
94 | 94 | if($commenter_result !== null) |
@@ -163,26 +163,26 @@ discard block |
||
163 | 163 | } |
164 | 164 | } |
165 | 165 | |
166 | - $site = URLDecode::getSite(); |
|
166 | + $site = URLDecode::getSite(); |
|
167 | 167 | |
168 | - if ($site == 'blog') { |
|
169 | - $subject = "New Comment on Jacob Emerick's Blog"; |
|
170 | - $message = "Hello!\nThere has been a new comment on the post '{$this->page_title}' at Jacob Emerick's Blog. You have chosen to be notified of it - please reply to [email protected] if you would like to be removed from these notifications.\n\nOn " . date('F j, Y g:i a') . ", " . Request::getPost('name') . " commented...\n" . Request::getPost('comment') . "\n\nVisit {$this->full_path}#comments to see and reply to all the comments on this post.\nThank you!"; |
|
171 | - } else if ($site == 'waterfalls') { |
|
172 | - $subject = "New Comment on Waterfalls of the Keweenaw"; |
|
173 | - $message = "Hello!\nThere has been a new comment on the page '{$this->page_title}' at Waterfalls of the Keweenaw. You have chosen to be notified of it - please reply to [email protected] if you would like to be removed from these notifications.\n\nOn " . date('F j, Y g:i a') . ", " . Request::getPost('name') . " commented...\n" . Request::getPost('comment') . "\n\nVisit {$this->full_path}#comments to see and reply to all the comments on this post.\nThank you!"; |
|
174 | - } |
|
168 | + if ($site == 'blog') { |
|
169 | + $subject = "New Comment on Jacob Emerick's Blog"; |
|
170 | + $message = "Hello!\nThere has been a new comment on the post '{$this->page_title}' at Jacob Emerick's Blog. You have chosen to be notified of it - please reply to [email protected] if you would like to be removed from these notifications.\n\nOn " . date('F j, Y g:i a') . ", " . Request::getPost('name') . " commented...\n" . Request::getPost('comment') . "\n\nVisit {$this->full_path}#comments to see and reply to all the comments on this post.\nThank you!"; |
|
171 | + } else if ($site == 'waterfalls') { |
|
172 | + $subject = "New Comment on Waterfalls of the Keweenaw"; |
|
173 | + $message = "Hello!\nThere has been a new comment on the page '{$this->page_title}' at Waterfalls of the Keweenaw. You have chosen to be notified of it - please reply to [email protected] if you would like to be removed from these notifications.\n\nOn " . date('F j, Y g:i a') . ", " . Request::getPost('name') . " commented...\n" . Request::getPost('comment') . "\n\nVisit {$this->full_path}#comments to see and reply to all the comments on this post.\nThank you!"; |
|
174 | + } |
|
175 | 175 | |
176 | - global $container; |
|
176 | + global $container; |
|
177 | 177 | |
178 | 178 | foreach($email_recipient_array as $email_recipient) |
179 | 179 | { |
180 | - $sent = $container['mail'] |
|
181 | - ->addTo($email_recipient['email'], $email_recipient['name']) |
|
182 | - ->addBCC($container['config']->admin_email) |
|
183 | - ->setSubject($subject) |
|
184 | - ->setPlainMessage($message) |
|
185 | - ->send(); |
|
180 | + $sent = $container['mail'] |
|
181 | + ->addTo($email_recipient['email'], $email_recipient['name']) |
|
182 | + ->addBCC($container['config']->admin_email) |
|
183 | + ->setSubject($subject) |
|
184 | + ->setPlainMessage($message) |
|
185 | + ->send(); |
|
186 | 186 | } |
187 | 187 | } |
188 | 188 | |
@@ -196,42 +196,42 @@ discard block |
||
196 | 196 | exit; |
197 | 197 | } |
198 | 198 | |
199 | - private function save_to_comment_service(array $data) |
|
200 | - { |
|
201 | - $path = $_SERVER['REQUEST_URI']; |
|
202 | - $path = explode('/', $path); |
|
203 | - $path = array_filter($path); |
|
204 | - $path = array_slice($path, 0, 2); |
|
205 | - $path = implode('/', $path); |
|
206 | - |
|
207 | - $body = [ |
|
208 | - 'commenter' => [ |
|
209 | - 'name' => $data['name'], |
|
210 | - 'email' => $data['email'], |
|
211 | - 'website' => $data['website'], |
|
212 | - ], |
|
213 | - 'body' => $data['comment'], |
|
214 | - 'should_notify' => (isset($data['notify']) && $data['notify'] == 'check'), |
|
215 | - 'domain' => (URLDecode::getSite() == 'blog' ? 'blog.jacobemerick.com' : 'waterfallsofthekeweenaw.com'), |
|
216 | - 'path' => $path, |
|
217 | - 'url' => "{$this->full_path}/#comment-{{id}}", |
|
218 | - 'thread' => 'comments', |
|
219 | - 'reply_to' => ($data['type'] == 'new' ? 0 : $data['type']), |
|
220 | - 'ip_address' => $_SERVER['REMOTE_ADDR'], |
|
221 | - 'user_agent' => $_SERVER['HTTP_USER_AGENT'], |
|
222 | - 'referrer' => $_SERVER['HTTP_REFERER'], |
|
223 | - ]; |
|
224 | - |
|
225 | - global $config; |
|
226 | - $configuration = new Jacobemerick\CommentService\Configuration(); |
|
227 | - $configuration->setUsername($config->comments->user); |
|
228 | - $configuration->setPassword($config->comments->password); |
|
229 | - $configuration->addDefaultHeader('Content-Type', 'application/json'); |
|
230 | - $configuration->setHost($config->comments->host); |
|
231 | - $configuration->setCurlTimeout($config->comments->timeout); |
|
232 | - |
|
233 | - $client = new Jacobemerick\CommentService\ApiClient($configuration); |
|
234 | - $api = new Jacobemerick\CommentService\Api\DefaultApi($client); |
|
235 | - $response = $api->createComment($body); |
|
236 | - } |
|
199 | + private function save_to_comment_service(array $data) |
|
200 | + { |
|
201 | + $path = $_SERVER['REQUEST_URI']; |
|
202 | + $path = explode('/', $path); |
|
203 | + $path = array_filter($path); |
|
204 | + $path = array_slice($path, 0, 2); |
|
205 | + $path = implode('/', $path); |
|
206 | + |
|
207 | + $body = [ |
|
208 | + 'commenter' => [ |
|
209 | + 'name' => $data['name'], |
|
210 | + 'email' => $data['email'], |
|
211 | + 'website' => $data['website'], |
|
212 | + ], |
|
213 | + 'body' => $data['comment'], |
|
214 | + 'should_notify' => (isset($data['notify']) && $data['notify'] == 'check'), |
|
215 | + 'domain' => (URLDecode::getSite() == 'blog' ? 'blog.jacobemerick.com' : 'waterfallsofthekeweenaw.com'), |
|
216 | + 'path' => $path, |
|
217 | + 'url' => "{$this->full_path}/#comment-{{id}}", |
|
218 | + 'thread' => 'comments', |
|
219 | + 'reply_to' => ($data['type'] == 'new' ? 0 : $data['type']), |
|
220 | + 'ip_address' => $_SERVER['REMOTE_ADDR'], |
|
221 | + 'user_agent' => $_SERVER['HTTP_USER_AGENT'], |
|
222 | + 'referrer' => $_SERVER['HTTP_REFERER'], |
|
223 | + ]; |
|
224 | + |
|
225 | + global $config; |
|
226 | + $configuration = new Jacobemerick\CommentService\Configuration(); |
|
227 | + $configuration->setUsername($config->comments->user); |
|
228 | + $configuration->setPassword($config->comments->password); |
|
229 | + $configuration->addDefaultHeader('Content-Type', 'application/json'); |
|
230 | + $configuration->setHost($config->comments->host); |
|
231 | + $configuration->setCurlTimeout($config->comments->timeout); |
|
232 | + |
|
233 | + $client = new Jacobemerick\CommentService\ApiClient($configuration); |
|
234 | + $api = new Jacobemerick\CommentService\Api\DefaultApi($client); |
|
235 | + $response = $api->createComment($body); |
|
236 | + } |
|
237 | 237 | } |
@@ -23,9 +23,9 @@ discard block |
||
23 | 23 | { |
24 | 24 | parent::__construct(); |
25 | 25 | |
26 | - global $container; |
|
27 | - $repository = new Jacobemerick\Web\Domain\Blog\Post\MysqlPostRepository($container['db_connection_locator']); |
|
28 | - $this->post = $repository->findPostByPath(URLDecode::getPiece(2)); |
|
26 | + global $container; |
|
27 | + $repository = new Jacobemerick\Web\Domain\Blog\Post\MysqlPostRepository($container['db_connection_locator']); |
|
28 | + $this->post = $repository->findPostByPath(URLDecode::getPiece(2)); |
|
29 | 29 | |
30 | 30 | if($this->post == null) |
31 | 31 | $this->eject(); |
@@ -36,9 +36,9 @@ discard block |
||
36 | 36 | Loader::getRootUrl('blog') . $this->post['category'] . '/' . $this->post['path'] . '/', |
37 | 37 | $this->post['title']); |
38 | 38 | |
39 | - global $container; |
|
40 | - $repository = new Jacobemerick\Web\Domain\Blog\Tag\MysqlTagRepository($container['db_connection_locator']); |
|
41 | - $this->tags = $repository->getTagsForPost($this->post['id']); |
|
39 | + global $container; |
|
40 | + $repository = new Jacobemerick\Web\Domain\Blog\Tag\MysqlTagRepository($container['db_connection_locator']); |
|
41 | + $this->tags = $repository->getTagsForPost($this->post['id']); |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | protected function set_head_data() |
@@ -50,9 +50,9 @@ discard block |
||
50 | 50 | $this->set_keywords($this->get_post_keywords()); |
51 | 51 | $this->set_author(self::$AUTHOR); |
52 | 52 | |
53 | - $photo = Content::instance('FetchFirstPhoto', $this->post['body'])->activate(true); |
|
54 | - $photo = preg_match('/^<img src="([a-z-:\.\/]+)" [^>]+>$/', $photo, $matches); |
|
55 | - $this->set_head('thumbnail', $matches[1]); |
|
53 | + $photo = Content::instance('FetchFirstPhoto', $this->post['body'])->activate(true); |
|
54 | + $photo = preg_match('/^<img src="([a-z-:\.\/]+)" [^>]+>$/', $photo, $matches); |
|
55 | + $this->set_head('thumbnail', $matches[1]); |
|
56 | 56 | |
57 | 57 | if (array_key_exists($this->post['id'], self::$DEPRECATED_BLOGS)) { |
58 | 58 | $log_id = self::$DEPRECATED_BLOGS[$this->post['id']]; |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | 'author' => self::$AUTHOR, |
80 | 80 | 'author_url' => self::$AUTHOR_URL, |
81 | 81 | 'comment_array' => $this->get_comment_array("{$this->post['category']}/{$this->post['path']}"), |
82 | - )); |
|
82 | + )); |
|
83 | 83 | } |
84 | 84 | |
85 | 85 | protected function get_post_description() |
@@ -127,18 +127,18 @@ discard block |
||
127 | 127 | |
128 | 128 | $post = new stdclass(); |
129 | 129 | |
130 | - if ( |
|
131 | - strpos($post_row['title'], 'Rainy Supe Loop') === 0 || |
|
132 | - strpos($post_row['title'], 'Malapais Loop') === 0 || |
|
133 | - strpos($post_row['title'], 'Mazatzal Peak Loop') === 0 || |
|
134 | - strpos($post_row['title'], 'Dripping Springs Loop') === 0 |
|
135 | - ) { |
|
136 | - $title = $post_row['title']; |
|
137 | - $title = explode(':', $title); |
|
138 | - $title = array_pop($title); |
|
139 | - $title = trim($title); |
|
140 | - $post->title = $title; |
|
141 | - } else if (strpos($post_row['title'], 'Isle Royale') === 0) { |
|
130 | + if ( |
|
131 | + strpos($post_row['title'], 'Rainy Supe Loop') === 0 || |
|
132 | + strpos($post_row['title'], 'Malapais Loop') === 0 || |
|
133 | + strpos($post_row['title'], 'Mazatzal Peak Loop') === 0 || |
|
134 | + strpos($post_row['title'], 'Dripping Springs Loop') === 0 |
|
135 | + ) { |
|
136 | + $title = $post_row['title']; |
|
137 | + $title = explode(':', $title); |
|
138 | + $title = array_pop($title); |
|
139 | + $title = trim($title); |
|
140 | + $post->title = $title; |
|
141 | + } else if (strpos($post_row['title'], 'Isle Royale') === 0) { |
|
142 | 142 | $title = $post_row['title']; |
143 | 143 | $title = explode(',', $title); |
144 | 144 | $title = array_pop($title); |
@@ -169,12 +169,12 @@ discard block |
||
169 | 169 | private $series_posts; |
170 | 170 | private function fetch_series_posts() |
171 | 171 | { |
172 | - if(!isset($this->series_posts)) { |
|
173 | - global $container; |
|
174 | - $repository = new Jacobemerick\Web\Domain\Blog\Series\MysqlSeriesRepository($container['db_connection_locator']); |
|
175 | - $this->series_posts = $repository->getSeriesForPost($this->post['id']); |
|
176 | - } |
|
177 | - return $this->series_posts; |
|
172 | + if(!isset($this->series_posts)) { |
|
173 | + global $container; |
|
174 | + $repository = new Jacobemerick\Web\Domain\Blog\Series\MysqlSeriesRepository($container['db_connection_locator']); |
|
175 | + $this->series_posts = $repository->getSeriesForPost($this->post['id']); |
|
176 | + } |
|
177 | + return $this->series_posts; |
|
178 | 178 | } |
179 | 179 | |
180 | 180 | private function get_related_posts() |
@@ -192,11 +192,11 @@ discard block |
||
192 | 192 | $exclude_post_array[] = $series_post['post']; |
193 | 193 | } |
194 | 194 | |
195 | - global $container; |
|
196 | - $repository = new Jacobemerick\Web\Domain\Blog\Post\MysqlPostRepository($container['db_connection_locator']); |
|
197 | - $post_result = $repository->getActivePostsByRelatedTags($this->post['id']); |
|
195 | + global $container; |
|
196 | + $repository = new Jacobemerick\Web\Domain\Blog\Post\MysqlPostRepository($container['db_connection_locator']); |
|
197 | + $post_result = $repository->getActivePostsByRelatedTags($this->post['id']); |
|
198 | 198 | |
199 | - $post_array = array(); |
|
199 | + $post_array = array(); |
|
200 | 200 | |
201 | 201 | foreach($post_result as $post_row) |
202 | 202 | { |
@@ -213,64 +213,64 @@ discard block |
||
213 | 213 | return $post_array; |
214 | 214 | } |
215 | 215 | |
216 | - protected function get_comment_array($path) |
|
217 | - { |
|
218 | - global $config; |
|
219 | - $configuration = new Jacobemerick\CommentService\Configuration(); |
|
220 | - $configuration->setUsername($config->comments->user); |
|
221 | - $configuration->setPassword($config->comments->password); |
|
222 | - $configuration->addDefaultHeader('Content-Type', 'application/json'); |
|
223 | - $configuration->setHost($config->comments->host); |
|
224 | - $configuration->setCurlTimeout($config->comments->timeout); |
|
216 | + protected function get_comment_array($path) |
|
217 | + { |
|
218 | + global $config; |
|
219 | + $configuration = new Jacobemerick\CommentService\Configuration(); |
|
220 | + $configuration->setUsername($config->comments->user); |
|
221 | + $configuration->setPassword($config->comments->password); |
|
222 | + $configuration->addDefaultHeader('Content-Type', 'application/json'); |
|
223 | + $configuration->setHost($config->comments->host); |
|
224 | + $configuration->setCurlTimeout($config->comments->timeout); |
|
225 | 225 | |
226 | - $client = new Jacobemerick\CommentService\ApiClient($configuration); |
|
227 | - $api = new Jacobemerick\CommentService\Api\DefaultApi($client); |
|
226 | + $client = new Jacobemerick\CommentService\ApiClient($configuration); |
|
227 | + $api = new Jacobemerick\CommentService\Api\DefaultApi($client); |
|
228 | 228 | |
229 | - $start = microtime(true); |
|
230 | - try { |
|
231 | - $comment_response = $api->getComments( |
|
232 | - 1, |
|
233 | - null, |
|
234 | - 'date', |
|
235 | - 'blog.jacobemerick.com', |
|
236 | - $path |
|
237 | - ); |
|
238 | - } catch (Exception $e) { |
|
239 | - global $container; |
|
240 | - $container['logger']->warning("CommentService | Path | {$e->getMessage()}"); |
|
241 | - return; |
|
242 | - } |
|
229 | + $start = microtime(true); |
|
230 | + try { |
|
231 | + $comment_response = $api->getComments( |
|
232 | + 1, |
|
233 | + null, |
|
234 | + 'date', |
|
235 | + 'blog.jacobemerick.com', |
|
236 | + $path |
|
237 | + ); |
|
238 | + } catch (Exception $e) { |
|
239 | + global $container; |
|
240 | + $container['logger']->warning("CommentService | Path | {$e->getMessage()}"); |
|
241 | + return; |
|
242 | + } |
|
243 | 243 | |
244 | - $elapsed = microtime(true) - $start; |
|
245 | - global $container; |
|
246 | - $container['logger']->info("CommentService | Path | {$elapsed}"); |
|
244 | + $elapsed = microtime(true) - $start; |
|
245 | + global $container; |
|
246 | + $container['logger']->info("CommentService | Path | {$elapsed}"); |
|
247 | 247 | |
248 | - $array = array(); |
|
249 | - foreach((array) $comment_response as $comment) |
|
250 | - { |
|
251 | - $body = $comment->getBody(); |
|
252 | - $body = Content::instance('CleanComment', $body)->activate(); |
|
253 | - $body = strip_tags($body); |
|
248 | + $array = array(); |
|
249 | + foreach((array) $comment_response as $comment) |
|
250 | + { |
|
251 | + $body = $comment->getBody(); |
|
252 | + $body = Content::instance('CleanComment', $body)->activate(); |
|
253 | + $body = strip_tags($body); |
|
254 | 254 | |
255 | - $comment_obj = new stdclass(); |
|
256 | - $comment_obj->id = $comment->getId(); |
|
257 | - $comment_obj->name = $comment->getCommenter()->getName(); |
|
258 | - $comment_obj->url = $comment->getCommenter()->getWebsite(); |
|
259 | - $comment_obj->trusted = true; |
|
260 | - $comment_obj->date = $comment->getDate()->format('M j, \'y'); |
|
261 | - $comment_obj->body = $body; |
|
255 | + $comment_obj = new stdclass(); |
|
256 | + $comment_obj->id = $comment->getId(); |
|
257 | + $comment_obj->name = $comment->getCommenter()->getName(); |
|
258 | + $comment_obj->url = $comment->getCommenter()->getWebsite(); |
|
259 | + $comment_obj->trusted = true; |
|
260 | + $comment_obj->date = $comment->getDate()->format('M j, \'y'); |
|
261 | + $comment_obj->body = $body; |
|
262 | 262 | |
263 | - // todo figure out if reply |
|
264 | - $array[] = $comment_obj; |
|
265 | - } |
|
263 | + // todo figure out if reply |
|
264 | + $array[] = $comment_obj; |
|
265 | + } |
|
266 | 266 | |
267 | - // todo figure out commenter obj |
|
268 | - // todo figure out how to handle errors or whatever |
|
269 | - return [ |
|
270 | - 'comments' => $array, |
|
271 | - 'commenter' => [], |
|
272 | - 'errors' => [], |
|
273 | - 'comment_count' => count($array), |
|
274 | - ]; |
|
275 | - } |
|
267 | + // todo figure out commenter obj |
|
268 | + // todo figure out how to handle errors or whatever |
|
269 | + return [ |
|
270 | + 'comments' => $array, |
|
271 | + 'commenter' => [], |
|
272 | + 'errors' => [], |
|
273 | + 'comment_count' => count($array), |
|
274 | + ]; |
|
275 | + } |
|
276 | 276 | } |
@@ -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 | } |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | $keyword_array = array(); |
97 | 97 | $keywords = $this->tags; |
98 | 98 | |
99 | - foreach($keywords as $keyword) |
|
99 | + foreach ($keywords as $keyword) |
|
100 | 100 | { |
101 | 101 | $keyword_array[] = $keyword['tag']; |
102 | 102 | } |
@@ -110,16 +110,16 @@ discard block |
||
110 | 110 | private function get_series_posts() |
111 | 111 | { |
112 | 112 | $series_posts = $this->fetch_series_posts(); |
113 | - if(count($series_posts) < 1) |
|
113 | + if (count($series_posts) < 1) |
|
114 | 114 | return array(); |
115 | 115 | |
116 | 116 | $previous_post = new stdclass(); |
117 | 117 | $next_post = new stdclass(); |
118 | 118 | |
119 | 119 | $found_current_post = false; |
120 | - foreach($series_posts as $post_row) |
|
120 | + foreach ($series_posts as $post_row) |
|
121 | 121 | { |
122 | - if($post_row['post'] == $this->post['id']) |
|
122 | + if ($post_row['post'] == $this->post['id']) |
|
123 | 123 | { |
124 | 124 | $found_current_post = true; |
125 | 125 | continue; |
@@ -148,9 +148,9 @@ discard block |
||
148 | 148 | $post->title = $post_row['title']; |
149 | 149 | } |
150 | 150 | |
151 | - $post->url = Loader::getRootUrl('blog') . "{$post_row['category']}/{$post_row['path']}/"; |
|
151 | + $post->url = Loader::getRootUrl('blog')."{$post_row['category']}/{$post_row['path']}/"; |
|
152 | 152 | |
153 | - if(!$found_current_post) |
|
153 | + if (!$found_current_post) |
|
154 | 154 | $previous_post = $post; |
155 | 155 | else |
156 | 156 | { |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | private $series_posts; |
170 | 170 | private function fetch_series_posts() |
171 | 171 | { |
172 | - if(!isset($this->series_posts)) { |
|
172 | + if (!isset($this->series_posts)) { |
|
173 | 173 | global $container; |
174 | 174 | $repository = new Jacobemerick\Web\Domain\Blog\Series\MysqlSeriesRepository($container['db_connection_locator']); |
175 | 175 | $this->series_posts = $repository->getSeriesForPost($this->post['id']); |
@@ -180,14 +180,14 @@ discard block |
||
180 | 180 | private function get_related_posts() |
181 | 181 | { |
182 | 182 | $tag_array = array(); |
183 | - foreach($this->tags as $tag) |
|
183 | + foreach ($this->tags as $tag) |
|
184 | 184 | { |
185 | 185 | $tag_array[] = $tag['id']; |
186 | 186 | } |
187 | 187 | |
188 | 188 | $series_posts = $this->fetch_series_posts(); |
189 | 189 | $exclude_post_array = array(); |
190 | - foreach($series_posts as $series_post) |
|
190 | + foreach ($series_posts as $series_post) |
|
191 | 191 | { |
192 | 192 | $exclude_post_array[] = $series_post['post']; |
193 | 193 | } |
@@ -198,11 +198,11 @@ discard block |
||
198 | 198 | |
199 | 199 | $post_array = array(); |
200 | 200 | |
201 | - foreach($post_result as $post_row) |
|
201 | + foreach ($post_result as $post_row) |
|
202 | 202 | { |
203 | 203 | $post = new stdclass(); |
204 | 204 | $post->title = $post_row['title']; |
205 | - $post->url = Loader::getRootUrl('blog') . "{$post_row['category']}/{$post_row['path']}/"; |
|
205 | + $post->url = Loader::getRootUrl('blog')."{$post_row['category']}/{$post_row['path']}/"; |
|
206 | 206 | $post->category = ucwords(str_replace('-', ' ', $post_row['category'])); |
207 | 207 | $post->thumb = Content::instance('FetchFirstPhoto', $post_row['body'])->activate(); |
208 | 208 | $post->body = Content::instance('SmartTrim', $post_row['body'])->activate(($post->thumb !== '') ? self::$POST_LENGTH_SHORT : self::$POST_LENGTH_LONG); |
@@ -246,7 +246,7 @@ discard block |
||
246 | 246 | $container['logger']->info("CommentService | Path | {$elapsed}"); |
247 | 247 | |
248 | 248 | $array = array(); |
249 | - foreach((array) $comment_response as $comment) |
|
249 | + foreach ((array) $comment_response as $comment) |
|
250 | 250 | { |
251 | 251 | $body = $comment->getBody(); |
252 | 252 | $body = Content::instance('CleanComment', $body)->activate(); |