| @@ 154-189 (lines=36) @@ | ||
| 151 | return $maximum; |
|
| 152 | } |
|
| 153 | ||
| 154 | final private function get_comments() |
|
| 155 | { |
|
| 156 | global $container; |
|
| 157 | $repository = new Jacobemerick\Web\Domain\Comment\Comment\ServiceCommentRepository($container['comment_service_api']); |
|
| 158 | $start = microtime(true); |
|
| 159 | try { |
|
| 160 | $comment_response = $repository->getComments( |
|
| 161 | 'blog.jacobemerick.com', |
|
| 162 | null, |
|
| 163 | 1, |
|
| 164 | self::$RECENT_COMMENT_COUNT, |
|
| 165 | '-date' |
|
| 166 | ); |
|
| 167 | } catch (Exception $e) { |
|
| 168 | $container['logger']->warning("CommentService | Sidebar | {$e->getMessage()}"); |
|
| 169 | return; |
|
| 170 | } |
|
| 171 | ||
| 172 | $elapsed = microtime(true) - $start; |
|
| 173 | global $container; |
|
| 174 | $container['logger']->info("CommentService | Sidebar | {$elapsed}"); |
|
| 175 | ||
| 176 | $array = array(); |
|
| 177 | foreach($comment_response as $comment) |
|
| 178 | { |
|
| 179 | $body = Content::instance('CleanComment', $comment['body'])->activate(); |
|
| 180 | $body = strip_tags($body); |
|
| 181 | ||
| 182 | $comment_obj = new stdclass(); |
|
| 183 | $comment_obj->description = Content::instance('SmartTrim', $body)->activate(30); |
|
| 184 | $comment_obj->commenter = $comment['commenter']['name']; |
|
| 185 | $comment_obj->link = $comment['url']; |
|
| 186 | $array[] = $comment_obj; |
|
| 187 | } |
|
| 188 | return $array; |
|
| 189 | } |
|
| 190 | } |
|
| 191 | ||
| @@ 62-97 (lines=36) @@ | ||
| 59 | $this->set_body('view', 'Home'); |
|
| 60 | } |
|
| 61 | ||
| 62 | protected function get_comments() |
|
| 63 | { |
|
| 64 | global $container; |
|
| 65 | $repository = new Jacobemerick\Web\Domain\Comment\Comment\ServiceCommentRepository($container['comment_service_api']); |
|
| 66 | $start = microtime(true); |
|
| 67 | try { |
|
| 68 | $comment_response = $repository->getComments( |
|
| 69 | 'waterfallsofthekeweenaw.com', |
|
| 70 | null, |
|
| 71 | 1, |
|
| 72 | 5, |
|
| 73 | '-date' |
|
| 74 | ); |
|
| 75 | } catch (Exception $e) { |
|
| 76 | $container['logger']->warning("CommentService | Sidebar | {$e->getMessage()}"); |
|
| 77 | return; |
|
| 78 | } |
|
| 79 | ||
| 80 | $elapsed = microtime(true) - $start; |
|
| 81 | global $container; |
|
| 82 | $container['logger']->info("CommentService | Sidebar | {$elapsed}"); |
|
| 83 | ||
| 84 | $array = array(); |
|
| 85 | foreach($comment_response as $comment) |
|
| 86 | { |
|
| 87 | $body = Content::instance('CleanComment', $comment['body'])->activate(); |
|
| 88 | $body = strip_tags($body); |
|
| 89 | ||
| 90 | $comment_obj = new stdclass(); |
|
| 91 | $comment_obj->description = Content::instance('SmartTrim', $body)->activate(50); |
|
| 92 | $comment_obj->commenter = $comment['commenter']['name']; |
|
| 93 | $comment_obj->link = $comment['url']; |
|
| 94 | $array[] = $comment_obj; |
|
| 95 | } |
|
| 96 | return $array; |
|
| 97 | } |
|
| 98 | } |
|
| 99 | ||