@@ -18,14 +18,14 @@ discard block |
||
| 18 | 18 | |
| 19 | 19 | protected function set_head_data() |
| 20 | 20 | { |
| 21 | - $this->set_head('rss_link', [ |
|
| 22 | - 'title' => 'Jacob Emerick Blog Feed', |
|
| 23 | - 'url' => '/rss.xml' |
|
| 24 | - ]); |
|
| 25 | - $this->set_head('rss_comment_link', [ |
|
| 26 | - 'title' => 'Jacob Emerick Blog Comment Feed', |
|
| 27 | - 'url' => '/rss-comments.xml' |
|
| 28 | - ]); |
|
| 21 | + $this->set_head('rss_link', [ |
|
| 22 | + 'title' => 'Jacob Emerick Blog Feed', |
|
| 23 | + 'url' => '/rss.xml' |
|
| 24 | + ]); |
|
| 25 | + $this->set_head('rss_comment_link', [ |
|
| 26 | + 'title' => 'Jacob Emerick Blog Comment Feed', |
|
| 27 | + 'url' => '/rss-comments.xml' |
|
| 28 | + ]); |
|
| 29 | 29 | |
| 30 | 30 | $this->add_css('normalize'); |
| 31 | 31 | $this->add_css('blog'); |
@@ -87,11 +87,11 @@ discard block |
||
| 87 | 87 | |
| 88 | 88 | final private function get_tags_for_post($post) |
| 89 | 89 | { |
| 90 | - global $container; |
|
| 91 | - $repository = new Jacobemerick\Web\Domain\Blog\Tag\MysqlTagRepository($container['db_connection_locator']); |
|
| 92 | - $tag_result = $repository->getTagsForPost($post['id']); |
|
| 90 | + global $container; |
|
| 91 | + $repository = new Jacobemerick\Web\Domain\Blog\Tag\MysqlTagRepository($container['db_connection_locator']); |
|
| 92 | + $tag_result = $repository->getTagsForPost($post['id']); |
|
| 93 | 93 | |
| 94 | - $tag_array = array(); |
|
| 94 | + $tag_array = array(); |
|
| 95 | 95 | foreach($tag_result as $tag) |
| 96 | 96 | { |
| 97 | 97 | $tag_object = new stdclass(); |
@@ -125,9 +125,9 @@ discard block |
||
| 125 | 125 | |
| 126 | 126 | final private function get_tag_cloud() |
| 127 | 127 | { |
| 128 | - global $container; |
|
| 129 | - $repository = new Jacobemerick\Web\Domain\Blog\Tag\MysqlTagRepository($container['db_connection_locator']); |
|
| 130 | - $tag_result = $repository->getTagCloud(); |
|
| 128 | + global $container; |
|
| 129 | + $repository = new Jacobemerick\Web\Domain\Blog\Tag\MysqlTagRepository($container['db_connection_locator']); |
|
| 130 | + $tag_result = $repository->getTagCloud(); |
|
| 131 | 131 | |
| 132 | 132 | $maximum_tag_count = $this->get_maximum_tag_count($tag_result); |
| 133 | 133 | |
@@ -176,43 +176,43 @@ discard block |
||
| 176 | 176 | $array[] = $comment_obj; |
| 177 | 177 | } |
| 178 | 178 | |
| 179 | - $comment_service_array = $this->get_comments_from_service(); |
|
| 180 | - if ($comment_service_array !== $array) { |
|
| 181 | - global $container; |
|
| 182 | - $container['console']->log('Mismatch between comment service and legacy db'); |
|
| 183 | - $container['console']->log($comment_service_array[0]); |
|
| 184 | - $container['console']->log($array[0]); |
|
| 185 | - } |
|
| 179 | + $comment_service_array = $this->get_comments_from_service(); |
|
| 180 | + if ($comment_service_array !== $array) { |
|
| 181 | + global $container; |
|
| 182 | + $container['console']->log('Mismatch between comment service and legacy db'); |
|
| 183 | + $container['console']->log($comment_service_array[0]); |
|
| 184 | + $container['console']->log($array[0]); |
|
| 185 | + } |
|
| 186 | 186 | return $array; |
| 187 | 187 | } |
| 188 | 188 | |
| 189 | - final private function get_comments_from_service() |
|
| 190 | - { |
|
| 191 | - global $config; |
|
| 192 | - $configuration = new Jacobemerick\CommentService\Configuration(); |
|
| 193 | - $configuration->setUsername($config->comments->user); |
|
| 194 | - $configuration->setPassword($config->comments->password); |
|
| 195 | - $configuration->addDefaultHeader('Content-Type', 'application/json'); |
|
| 196 | - $configuration->setHost($config->comments->host); |
|
| 197 | - $configuration->setCurlTimeout($config->comments->timeout); |
|
| 198 | - |
|
| 199 | - $client = new Jacobemerick\CommentService\ApiClient($configuration); |
|
| 200 | - $api = new Jacobemerick\CommentService\Api\DefaultApi($client); |
|
| 201 | - $comment_response = $api->getComments(1, self::$RECENT_COMMENT_COUNT, '-date', 'blog.jacobemerick.com'); |
|
| 202 | - |
|
| 203 | - $array = array(); |
|
| 204 | - foreach($comment_response as $comment) |
|
| 205 | - { |
|
| 206 | - $body = $comment->getBody(); |
|
| 207 | - $body = strip_tags($body); |
|
| 208 | - |
|
| 209 | - $comment_obj = new stdclass(); |
|
| 210 | - $comment_obj->description = Content::instance('SmartTrim', $body)->activate(30); |
|
| 211 | - $comment_obj->commenter = $comment->getCommenter()->getName(); |
|
| 212 | - $comment_obj->link = "{$comment->getUrl()}/#comment-{$comment->getId()}"; |
|
| 213 | - $array[] = $comment_obj; |
|
| 214 | - } |
|
| 215 | - return $array; |
|
| 216 | - } |
|
| 189 | + final private function get_comments_from_service() |
|
| 190 | + { |
|
| 191 | + global $config; |
|
| 192 | + $configuration = new Jacobemerick\CommentService\Configuration(); |
|
| 193 | + $configuration->setUsername($config->comments->user); |
|
| 194 | + $configuration->setPassword($config->comments->password); |
|
| 195 | + $configuration->addDefaultHeader('Content-Type', 'application/json'); |
|
| 196 | + $configuration->setHost($config->comments->host); |
|
| 197 | + $configuration->setCurlTimeout($config->comments->timeout); |
|
| 198 | + |
|
| 199 | + $client = new Jacobemerick\CommentService\ApiClient($configuration); |
|
| 200 | + $api = new Jacobemerick\CommentService\Api\DefaultApi($client); |
|
| 201 | + $comment_response = $api->getComments(1, self::$RECENT_COMMENT_COUNT, '-date', 'blog.jacobemerick.com'); |
|
| 202 | + |
|
| 203 | + $array = array(); |
|
| 204 | + foreach($comment_response as $comment) |
|
| 205 | + { |
|
| 206 | + $body = $comment->getBody(); |
|
| 207 | + $body = strip_tags($body); |
|
| 208 | + |
|
| 209 | + $comment_obj = new stdclass(); |
|
| 210 | + $comment_obj->description = Content::instance('SmartTrim', $body)->activate(30); |
|
| 211 | + $comment_obj->commenter = $comment->getCommenter()->getName(); |
|
| 212 | + $comment_obj->link = "{$comment->getUrl()}/#comment-{$comment->getId()}"; |
|
| 213 | + $array[] = $comment_obj; |
|
| 214 | + } |
|
| 215 | + return $array; |
|
| 216 | + } |
|
| 217 | 217 | |
| 218 | 218 | } |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | Loader::load('collector', 'image/PhotoCollector'); |
| 42 | 42 | $photo_result = PhotoCollector::getRow($id); |
| 43 | 43 | |
| 44 | - if($photo_result == null) |
|
| 44 | + if ($photo_result == null) |
|
| 45 | 45 | return; |
| 46 | 46 | |
| 47 | 47 | $name = $photo_result->name; |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | $tag_result = $repository->getTagsForPost($post['id']); |
| 93 | 93 | |
| 94 | 94 | $tag_array = array(); |
| 95 | - foreach($tag_result as $tag) |
|
| 95 | + foreach ($tag_result as $tag) |
|
| 96 | 96 | { |
| 97 | 97 | $tag_object = new stdclass(); |
| 98 | 98 | $tag_object->name = $tag['tag']; |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | { |
| 107 | 107 | $body = $post['body']; |
| 108 | 108 | |
| 109 | - if($trim) |
|
| 109 | + if ($trim) |
|
| 110 | 110 | $body = Content::instance('SmartTrim', $body)->activate(self::$LENGTH_OF_TRIMMED_POST); |
| 111 | 111 | |
| 112 | 112 | $body = Content::instance('FixPhoto', $body)->activate(false, 'standard'); |
@@ -132,9 +132,9 @@ discard block |
||
| 132 | 132 | $maximum_tag_count = $this->get_maximum_tag_count($tag_result); |
| 133 | 133 | |
| 134 | 134 | $cloud_array = array(); |
| 135 | - foreach($tag_result as $tag) |
|
| 135 | + foreach ($tag_result as $tag) |
|
| 136 | 136 | { |
| 137 | - if($tag['count'] < self::$MINIMUM_TAG_COUNT) |
|
| 137 | + if ($tag['count'] < self::$MINIMUM_TAG_COUNT) |
|
| 138 | 138 | continue; |
| 139 | 139 | |
| 140 | 140 | $tag_object = new stdclass(); |
@@ -151,9 +151,9 @@ discard block |
||
| 151 | 151 | { |
| 152 | 152 | $maximum = 1; |
| 153 | 153 | |
| 154 | - foreach($tag_result as $tag) |
|
| 154 | + foreach ($tag_result as $tag) |
|
| 155 | 155 | { |
| 156 | - if($tag['count'] > $maximum) |
|
| 156 | + if ($tag['count'] > $maximum) |
|
| 157 | 157 | $maximum = $tag['count']; |
| 158 | 158 | } |
| 159 | 159 | return $maximum; |
@@ -164,7 +164,7 @@ discard block |
||
| 164 | 164 | $comment_array = CommentCollector::getRecentBlogComments(self::$RECENT_COMMENT_COUNT); |
| 165 | 165 | |
| 166 | 166 | $array = array(); |
| 167 | - foreach($comment_array as $comment) |
|
| 167 | + foreach ($comment_array as $comment) |
|
| 168 | 168 | { |
| 169 | 169 | $body = $comment->body; |
| 170 | 170 | $body = strip_tags($body); |
@@ -172,7 +172,7 @@ discard block |
||
| 172 | 172 | $comment_obj = new stdclass(); |
| 173 | 173 | $comment_obj->description = Content::instance('SmartTrim', $body)->activate(30); |
| 174 | 174 | $comment_obj->commenter = $comment->name; |
| 175 | - $comment_obj->link = Loader::getRootURL() . "{$comment->category}/{$comment->path}/#comment-{$comment->id}"; |
|
| 175 | + $comment_obj->link = Loader::getRootURL()."{$comment->category}/{$comment->path}/#comment-{$comment->id}"; |
|
| 176 | 176 | $array[] = $comment_obj; |
| 177 | 177 | } |
| 178 | 178 | |
@@ -201,7 +201,7 @@ discard block |
||
| 201 | 201 | $comment_response = $api->getComments(1, self::$RECENT_COMMENT_COUNT, '-date', 'blog.jacobemerick.com'); |
| 202 | 202 | |
| 203 | 203 | $array = array(); |
| 204 | - foreach($comment_response as $comment) |
|
| 204 | + foreach ($comment_response as $comment) |
|
| 205 | 205 | { |
| 206 | 206 | $body = $comment->getBody(); |
| 207 | 207 | $body = strip_tags($body); |