@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | protected $connections; |
12 | 12 | |
13 | 13 | /** |
14 | - * @param ConnectonLocator $connections |
|
14 | + * @param ConnectionLocator $connections |
|
15 | 15 | */ |
16 | 16 | public function __construct(ConnectionLocator $connections) |
17 | 17 | { |
@@ -41,7 +41,6 @@ discard block |
||
41 | 41 | } |
42 | 42 | |
43 | 43 | /** |
44 | - * @param string $title |
|
45 | 44 | * |
46 | 45 | * @return array|false |
47 | 46 | */ |
@@ -7,75 +7,75 @@ |
||
7 | 7 | class MysqlYouTubeRepository implements YouTubeRepositoryInterface |
8 | 8 | { |
9 | 9 | |
10 | - /** @var ConnectionLocator */ |
|
11 | - protected $connections; |
|
10 | + /** @var ConnectionLocator */ |
|
11 | + protected $connections; |
|
12 | 12 | |
13 | - /** |
|
14 | - * @param ConnectonLocator $connections |
|
15 | - */ |
|
16 | - public function __construct(ConnectionLocator $connections) |
|
17 | - { |
|
18 | - $this->connections = $connections; |
|
19 | - } |
|
13 | + /** |
|
14 | + * @param ConnectonLocator $connections |
|
15 | + */ |
|
16 | + public function __construct(ConnectionLocator $connections) |
|
17 | + { |
|
18 | + $this->connections = $connections; |
|
19 | + } |
|
20 | 20 | |
21 | - /** |
|
22 | - * @param integer $id |
|
23 | - * |
|
24 | - * @return array|false |
|
25 | - */ |
|
26 | - public function getYouTubeById($id) |
|
27 | - { |
|
28 | - $query = " |
|
21 | + /** |
|
22 | + * @param integer $id |
|
23 | + * |
|
24 | + * @return array|false |
|
25 | + */ |
|
26 | + public function getYouTubeById($id) |
|
27 | + { |
|
28 | + $query = " |
|
29 | 29 | SELECT * |
30 | 30 | FROM `jpemeric_stream`.`youtube` |
31 | 31 | WHERE `id` = :id |
32 | 32 | LIMIT 1"; |
33 | - $bindings = [ |
|
34 | - 'id' => $id, |
|
35 | - ]; |
|
33 | + $bindings = [ |
|
34 | + 'id' => $id, |
|
35 | + ]; |
|
36 | 36 | |
37 | - return $this |
|
38 | - ->connections |
|
39 | - ->getRead() |
|
40 | - ->fetchOne($query, $bindings); |
|
41 | - } |
|
37 | + return $this |
|
38 | + ->connections |
|
39 | + ->getRead() |
|
40 | + ->fetchOne($query, $bindings); |
|
41 | + } |
|
42 | 42 | |
43 | - /** |
|
44 | - * @param string $title |
|
45 | - * |
|
46 | - * @return array|false |
|
47 | - */ |
|
48 | - public function getYouTubeByVideoId($videoId) |
|
49 | - { |
|
50 | - $query = " |
|
43 | + /** |
|
44 | + * @param string $title |
|
45 | + * |
|
46 | + * @return array|false |
|
47 | + */ |
|
48 | + public function getYouTubeByVideoId($videoId) |
|
49 | + { |
|
50 | + $query = " |
|
51 | 51 | SELECT * |
52 | 52 | FROM `jpemeric_stream`.`youtube` |
53 | 53 | WHERE `video_id` = :video_id |
54 | 54 | LIMIT 1"; |
55 | - $bindings = [ |
|
56 | - 'video_id' => $videoId, |
|
57 | - ]; |
|
55 | + $bindings = [ |
|
56 | + 'video_id' => $videoId, |
|
57 | + ]; |
|
58 | 58 | |
59 | - return $this |
|
60 | - ->connections |
|
61 | - ->getRead() |
|
62 | - ->fetchOne($query, $bindings); |
|
63 | - } |
|
59 | + return $this |
|
60 | + ->connections |
|
61 | + ->getRead() |
|
62 | + ->fetchOne($query, $bindings); |
|
63 | + } |
|
64 | 64 | |
65 | - /** |
|
66 | - * @return array|false |
|
67 | - */ |
|
68 | - public function getUnmappedYouTubes() |
|
69 | - { |
|
70 | - $query = " |
|
65 | + /** |
|
66 | + * @return array|false |
|
67 | + */ |
|
68 | + public function getUnmappedYouTubes() |
|
69 | + { |
|
70 | + $query = " |
|
71 | 71 | SELECT `id`, `date` |
72 | 72 | FROM `jpemeric_stream`.`youtube` |
73 | 73 | LEFT JOIN `jpemeric_stream`.`post` |
74 | 74 | ON `post`.`type_id` = `youtube`.`id` AND `post`.`id` IS NULL"; |
75 | 75 | |
76 | - return $this |
|
77 | - ->connections |
|
78 | - ->getRead() |
|
79 | - ->fetchAll($query); |
|
80 | - } |
|
76 | + return $this |
|
77 | + ->connections |
|
78 | + ->getRead() |
|
79 | + ->fetchAll($query); |
|
80 | + } |
|
81 | 81 | } |
@@ -60,9 +60,9 @@ discard block |
||
60 | 60 | |
61 | 61 | protected function get_recent_activity() |
62 | 62 | { |
63 | - global $container; |
|
64 | - $activityRepository = new Jacobemerick\Web\Domain\Stream\Post\MysqlPostRepository($container['db_connection_locator']); |
|
65 | - $post_result = $activityRepository->getPosts(5); |
|
63 | + global $container; |
|
64 | + $activityRepository = new Jacobemerick\Web\Domain\Stream\Post\MysqlPostRepository($container['db_connection_locator']); |
|
65 | + $post_result = $activityRepository->getPosts(5); |
|
66 | 66 | |
67 | 67 | $post_array = array(); |
68 | 68 | foreach($post_result as $row) |
@@ -77,13 +77,13 @@ discard block |
||
77 | 77 | { |
78 | 78 | Loader::load('utility', 'Content'); |
79 | 79 | |
80 | - global $container; |
|
81 | - $blogRepository = new Jacobemerick\Web\Domain\Stream\Blog\MysqlBlogRepository($container['db_connection_locator']); |
|
82 | - $bookRepository = new Jacobemerick\Web\Domain\Stream\Book\MysqlBookRepository($container['db_connection_locator']); |
|
83 | - $distanceRepository = new Jacobemerick\Web\Domain\Stream\Distance\MysqlDistanceRepository($container['db_connection_locator']); |
|
84 | - $huluRepository = new Jacobemerick\Web\Domain\Stream\Hulu\MysqlHuluRepository($container['db_connection_locator']); |
|
85 | - $twitterRepository = new Jacobemerick\Web\Domain\Stream\Twitter\MysqlTwitterRepository($container['db_connection_locator']); |
|
86 | - $youtubeRepository = new Jacobemerick\Web\Domain\Stream\YouTube\MysqlYouTubeRepository($container['db_connection_locator']); |
|
80 | + global $container; |
|
81 | + $blogRepository = new Jacobemerick\Web\Domain\Stream\Blog\MysqlBlogRepository($container['db_connection_locator']); |
|
82 | + $bookRepository = new Jacobemerick\Web\Domain\Stream\Book\MysqlBookRepository($container['db_connection_locator']); |
|
83 | + $distanceRepository = new Jacobemerick\Web\Domain\Stream\Distance\MysqlDistanceRepository($container['db_connection_locator']); |
|
84 | + $huluRepository = new Jacobemerick\Web\Domain\Stream\Hulu\MysqlHuluRepository($container['db_connection_locator']); |
|
85 | + $twitterRepository = new Jacobemerick\Web\Domain\Stream\Twitter\MysqlTwitterRepository($container['db_connection_locator']); |
|
86 | + $youtubeRepository = new Jacobemerick\Web\Domain\Stream\YouTube\MysqlYouTubeRepository($container['db_connection_locator']); |
|
87 | 87 | |
88 | 88 | $post = new stdclass(); |
89 | 89 | |
@@ -126,9 +126,9 @@ discard block |
||
126 | 126 | if(strlen($row['title']) > 0) |
127 | 127 | $post->title .= " I was hiking up around the {$row['title']} area."; |
128 | 128 | } |
129 | - else if ($row['type'] == 'walking') { |
|
130 | - $post->title = "Walked {$row['distance']} miles and felt {$row['felt']}."; |
|
131 | - } |
|
129 | + else if ($row['type'] == 'walking') { |
|
130 | + $post->title = "Walked {$row['distance']} miles and felt {$row['felt']}."; |
|
131 | + } |
|
132 | 132 | break; |
133 | 133 | case 'hulu' : |
134 | 134 | $row = $huluRepository->getHuluById($raw_post['type_id']); |
@@ -195,11 +195,11 @@ discard block |
||
195 | 195 | Loader::load('view', URLDecode::getSite() . '/' . $view, $this->data_array['body']); |
196 | 196 | } |
197 | 197 | |
198 | - if (URLDecode::getSite() == 'waterfalls') { |
|
199 | - Loader::load('view', '/WaterfallFoot'); |
|
200 | - } else { |
|
201 | - Loader::load('view', '/Foot', array('tracking_code' => self::$TRACKING_CODE)); |
|
202 | - } |
|
198 | + if (URLDecode::getSite() == 'waterfalls') { |
|
199 | + Loader::load('view', '/WaterfallFoot'); |
|
200 | + } else { |
|
201 | + Loader::load('view', '/Foot', array('tracking_code' => self::$TRACKING_CODE)); |
|
202 | + } |
|
203 | 203 | |
204 | 204 | if($view == '/404' || $view == '/503') |
205 | 205 | exit; |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | 'date' => date('Y'))); |
41 | 41 | |
42 | 42 | Loader::loadInstance('utility', 'Database'); |
43 | - if(Database::isConnected() === false) |
|
43 | + if (Database::isConnected() === false) |
|
44 | 44 | $this->unavailable(); |
45 | 45 | } |
46 | 46 | |
@@ -65,9 +65,9 @@ discard block |
||
65 | 65 | $post_result = $activityRepository->getPosts(5); |
66 | 66 | |
67 | 67 | $post_array = array(); |
68 | - foreach($post_result as $row) |
|
68 | + foreach ($post_result as $row) |
|
69 | 69 | { |
70 | - $post_array[] = $this->expand_post($row);; |
|
70 | + $post_array[] = $this->expand_post($row); ; |
|
71 | 71 | } |
72 | 72 | |
73 | 73 | return $post_array; |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | |
88 | 88 | $post = new stdclass(); |
89 | 89 | |
90 | - switch($raw_post['type']) |
|
90 | + switch ($raw_post['type']) |
|
91 | 91 | { |
92 | 92 | case 'blog' : |
93 | 93 | $row = $blogRepository->getBlogById($raw_post['type_id']); |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | $post->title = "Blogged about {$category}: <a href=\"{$row['url']}\">{$row['title']}</a>."; |
99 | 99 | $post->comments = $row['comments']; |
100 | 100 | |
101 | - if($format == 'full') |
|
101 | + if ($format == 'full') |
|
102 | 102 | $post->image = Content::instance('FetchFirstPhoto', $row['body'])->activate(false, 'standard'); |
103 | 103 | break; |
104 | 104 | case 'book' : |
@@ -107,23 +107,23 @@ discard block |
||
107 | 107 | $post->type = 'book'; |
108 | 108 | $post->title = "Just finished reading {$row['title']} by {$row['author']}."; |
109 | 109 | |
110 | - if($format == 'full') |
|
110 | + if ($format == 'full') |
|
111 | 111 | $post->image = "<img alt=\"{$row['title']} by {$row['author']}\" src=\"{$row['image']}\" />"; |
112 | 112 | break; |
113 | 113 | case 'distance' : |
114 | 114 | $row = $distanceRepository->getDistanceById($raw_post['type_id']); |
115 | 115 | |
116 | 116 | $post->type = 'distance'; |
117 | - if($row['type'] == 'running') |
|
117 | + if ($row['type'] == 'running') |
|
118 | 118 | { |
119 | 119 | $post->title = "Ran {$row['distance']} miles and felt {$row['felt']}."; |
120 | - if(strlen($row['message']) > 0) |
|
120 | + if (strlen($row['message']) > 0) |
|
121 | 121 | $post->title .= " Afterwards, I was all like '{$row['message']}'."; |
122 | 122 | } |
123 | - else if($row['type'] == 'hiking') |
|
123 | + else if ($row['type'] == 'hiking') |
|
124 | 124 | { |
125 | 125 | $post->title = "Hiked {$row['distance']} miles and felt {$row['felt']}."; |
126 | - if(strlen($row['title']) > 0) |
|
126 | + if (strlen($row['title']) > 0) |
|
127 | 127 | $post->title .= " I was hiking up around the {$row['title']} area."; |
128 | 128 | } |
129 | 129 | else if ($row['type'] == 'walking') { |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | |
142 | 142 | $post->type = 'twitter'; |
143 | 143 | |
144 | - if($format == 'full') |
|
144 | + if ($format == 'full') |
|
145 | 145 | $post->title = $row['text_formatted_full']; |
146 | 146 | else |
147 | 147 | $post->title = $row['text_formatted']; |
@@ -154,12 +154,12 @@ discard block |
||
154 | 154 | |
155 | 155 | $post->type = 'youtube'; |
156 | 156 | |
157 | - if($format == 'full') |
|
157 | + if ($format == 'full') |
|
158 | 158 | $post->title = "Favorited {$row['title']} by {$row['author']} on YouTube."; |
159 | 159 | else |
160 | 160 | $post->title = "Favorited <a href=\"http://www.youtube.com/watch?feature=player_embedded&v={$row['video_id']}\" rel=\"nofollow\" target=\"_blank\" title=\"{$row['content']}\">{$row['title']}</a> by {$row['author']} on YouTube."; |
161 | 161 | |
162 | - if($format == 'full') |
|
162 | + if ($format == 'full') |
|
163 | 163 | $post->embed_code = "<iframe src=\"http://www.youtube.com/embed/{$row['video_id']}?rel=0\" frameborder=\"0\" allowfullscreen></iframe>"; |
164 | 164 | break; |
165 | 165 | } |
@@ -187,9 +187,9 @@ discard block |
||
187 | 187 | $headers = $this->headers; |
188 | 188 | Header::$headers(); |
189 | 189 | Loader::load('view', '/Head', $this->data_array['head']); |
190 | - foreach($this->body_view_array as $view) |
|
190 | + foreach ($this->body_view_array as $view) |
|
191 | 191 | { |
192 | - if(substr($view, 0, 1) == '/') |
|
192 | + if (substr($view, 0, 1) == '/') |
|
193 | 193 | Loader::load('view', $view, $this->data_array['body']); |
194 | 194 | else |
195 | 195 | Loader::load('view', URLDecode::getSite() . '/' . $view, $this->data_array['body']); |
@@ -201,7 +201,7 @@ discard block |
||
201 | 201 | Loader::load('view', '/Foot', array('tracking_code' => self::$TRACKING_CODE)); |
202 | 202 | } |
203 | 203 | |
204 | - if($view == '/404' || $view == '/503') |
|
204 | + if ($view == '/404' || $view == '/503') |
|
205 | 205 | exit; |
206 | 206 | } |
207 | 207 | |
@@ -262,10 +262,10 @@ discard block |
||
262 | 262 | |
263 | 263 | $js_array = array(); |
264 | 264 | |
265 | - if(count($this->js_array) > 0) |
|
265 | + if (count($this->js_array) > 0) |
|
266 | 266 | $js_array = array_merge($js_array, $this->js_array); |
267 | 267 | |
268 | - if(count($js_array) > 0) |
|
268 | + if (count($js_array) > 0) |
|
269 | 269 | $js_array = Asset::getJS($js_array); |
270 | 270 | |
271 | 271 | $this->set_head('css_link_array', $css_array); |
@@ -279,26 +279,26 @@ discard block |
||
279 | 279 | |
280 | 280 | protected function eject() |
281 | 281 | { |
282 | - if(get_class($this) !== 'Error404Controller') |
|
282 | + if (get_class($this) !== 'Error404Controller') |
|
283 | 283 | Loader::loadNew('controller', '/Error404Controller')->activate(); |
284 | 284 | } |
285 | 285 | |
286 | 286 | protected function unavailable() |
287 | 287 | { |
288 | - if(get_class($this) !== 'Error503Controller') |
|
288 | + if (get_class($this) !== 'Error503Controller') |
|
289 | 289 | Loader::loadNew('controller', '/Error503Controller')->activate(); |
290 | 290 | } |
291 | 291 | |
292 | 292 | protected function redirect($uri, $method = 301) |
293 | 293 | { |
294 | - switch($method) |
|
294 | + switch ($method) |
|
295 | 295 | { |
296 | 296 | case 301 : |
297 | - if(get_class($this) !== 'Error301Controller') |
|
297 | + if (get_class($this) !== 'Error301Controller') |
|
298 | 298 | Loader::loadNew('controller', '/Error301Controller', array($uri))->activate(); |
299 | 299 | break; |
300 | 300 | case 303 : |
301 | - if(get_class($this) !== 'Error303Controller') |
|
301 | + if (get_class($this) !== 'Error303Controller') |
|
302 | 302 | Loader::loadNew('controller', '/Error303Controller', array($uri))->activate(); |
303 | 303 | break; |
304 | 304 | } |
@@ -318,7 +318,7 @@ discard block |
||
318 | 318 | private $comment_errors; |
319 | 319 | protected function handle_comment_submit($site_id, $path, $redirect_url, $page_title) |
320 | 320 | { |
321 | - if(Request::hasPost() && Request::getPost('submit') == 'Submit Comment') |
|
321 | + if (Request::hasPost() && Request::getPost('submit') == 'Submit Comment') |
|
322 | 322 | { |
323 | 323 | $parameters = array($site_id, $path, $redirect_url, $page_title); |
324 | 324 | $this->comment_errors = Loader::loadNew('module', 'form/CommentSubmitModule', $parameters)->activate(); |
@@ -336,7 +336,7 @@ discard block |
||
336 | 336 | $comment_array = array(); |
337 | 337 | $comment_result = CommentCollector::getCommentsForURL($site, $path, $commenter->id); |
338 | 338 | |
339 | - foreach($comment_result as $comment) |
|
339 | + foreach ($comment_result as $comment) |
|
340 | 340 | { |
341 | 341 | $comment_object = new stdclass(); |
342 | 342 | $comment_object->id = $comment->id; |
@@ -346,12 +346,12 @@ discard block |
||
346 | 346 | $comment_object->url = $comment->url; |
347 | 347 | $comment_object->trusted = $comment->trusted; |
348 | 348 | |
349 | - if($comment->reply == 0 && Request::getPost('type') == $comment->id) |
|
349 | + if ($comment->reply == 0 && Request::getPost('type') == $comment->id) |
|
350 | 350 | $comment_object->errors = $this->comment_errors; |
351 | 351 | else |
352 | 352 | $comment_object->errors = array(); |
353 | 353 | |
354 | - if($comment->reply == 0) |
|
354 | + if ($comment->reply == 0) |
|
355 | 355 | { |
356 | 356 | $comment_object->replies = array(); |
357 | 357 | $comment_array[$comment->id] = $comment_object; |
@@ -382,21 +382,21 @@ discard block |
||
382 | 382 | $commenter->website = ''; |
383 | 383 | |
384 | 384 | $commenter_cookie = Cookie::instance('Commenter'); |
385 | - if(!$commenter_cookie->exists()) |
|
385 | + if (!$commenter_cookie->exists()) |
|
386 | 386 | return $commenter; |
387 | 387 | |
388 | 388 | $commenter_cookie_value = $commenter_cookie->getValue(); |
389 | 389 | $commenter_cookie_value = json_decode($commenter_cookie_value); |
390 | 390 | |
391 | - if($commenter_cookie_value === NULL) |
|
391 | + if ($commenter_cookie_value === NULL) |
|
392 | 392 | return $commenter; |
393 | 393 | |
394 | - if(!isset($commenter_cookie_value->name) || !isset($commenter_cookie_value->email)) |
|
394 | + if (!isset($commenter_cookie_value->name) || !isset($commenter_cookie_value->email)) |
|
395 | 395 | return $commenter; |
396 | 396 | |
397 | 397 | $commenter_object = CommentCollector::getCommenterByFields($commenter_cookie_value->name, $commenter_cookie_value->email, (isset($commenter_cookie_value->website) ? $commenter_cookie_value->website : '')); |
398 | 398 | |
399 | - if($commenter_object === NULL) |
|
399 | + if ($commenter_object === NULL) |
|
400 | 400 | return $commenter; |
401 | 401 | |
402 | 402 | $commenter->id = $commenter_object->id; |
@@ -40,8 +40,9 @@ discard block |
||
40 | 40 | 'date' => date('Y'))); |
41 | 41 | |
42 | 42 | Loader::loadInstance('utility', 'Database'); |
43 | - if(Database::isConnected() === false) |
|
44 | - $this->unavailable(); |
|
43 | + if(Database::isConnected() === false) { |
|
44 | + $this->unavailable(); |
|
45 | + } |
|
45 | 46 | } |
46 | 47 | |
47 | 48 | protected function get_domain_container() |
@@ -98,8 +99,9 @@ discard block |
||
98 | 99 | $post->title = "Blogged about {$category}: <a href=\"{$row['url']}\">{$row['title']}</a>."; |
99 | 100 | $post->comments = $row['comments']; |
100 | 101 | |
101 | - if($format == 'full') |
|
102 | - $post->image = Content::instance('FetchFirstPhoto', $row['body'])->activate(false, 'standard'); |
|
102 | + if($format == 'full') { |
|
103 | + $post->image = Content::instance('FetchFirstPhoto', $row['body'])->activate(false, 'standard'); |
|
104 | + } |
|
103 | 105 | break; |
104 | 106 | case 'book' : |
105 | 107 | $row = $bookRepository->getBookById($raw_post['type_id']); |
@@ -107,8 +109,9 @@ discard block |
||
107 | 109 | $post->type = 'book'; |
108 | 110 | $post->title = "Just finished reading {$row['title']} by {$row['author']}."; |
109 | 111 | |
110 | - if($format == 'full') |
|
111 | - $post->image = "<img alt=\"{$row['title']} by {$row['author']}\" src=\"{$row['image']}\" />"; |
|
112 | + if($format == 'full') { |
|
113 | + $post->image = "<img alt=\"{$row['title']} by {$row['author']}\" src=\"{$row['image']}\" />"; |
|
114 | + } |
|
112 | 115 | break; |
113 | 116 | case 'distance' : |
114 | 117 | $row = $distanceRepository->getDistanceById($raw_post['type_id']); |
@@ -117,16 +120,16 @@ discard block |
||
117 | 120 | if($row['type'] == 'running') |
118 | 121 | { |
119 | 122 | $post->title = "Ran {$row['distance']} miles and felt {$row['felt']}."; |
120 | - if(strlen($row['message']) > 0) |
|
121 | - $post->title .= " Afterwards, I was all like '{$row['message']}'."; |
|
122 | - } |
|
123 | - else if($row['type'] == 'hiking') |
|
123 | + if(strlen($row['message']) > 0) { |
|
124 | + $post->title .= " Afterwards, I was all like '{$row['message']}'."; |
|
125 | + } |
|
126 | + } else if($row['type'] == 'hiking') |
|
124 | 127 | { |
125 | 128 | $post->title = "Hiked {$row['distance']} miles and felt {$row['felt']}."; |
126 | - if(strlen($row['title']) > 0) |
|
127 | - $post->title .= " I was hiking up around the {$row['title']} area."; |
|
128 | - } |
|
129 | - else if ($row['type'] == 'walking') { |
|
129 | + if(strlen($row['title']) > 0) { |
|
130 | + $post->title .= " I was hiking up around the {$row['title']} area."; |
|
131 | + } |
|
132 | + } else if ($row['type'] == 'walking') { |
|
130 | 133 | $post->title = "Walked {$row['distance']} miles and felt {$row['felt']}."; |
131 | 134 | } |
132 | 135 | break; |
@@ -141,10 +144,11 @@ discard block |
||
141 | 144 | |
142 | 145 | $post->type = 'twitter'; |
143 | 146 | |
144 | - if($format == 'full') |
|
145 | - $post->title = $row['text_formatted_full']; |
|
146 | - else |
|
147 | - $post->title = $row['text_formatted']; |
|
147 | + if($format == 'full') { |
|
148 | + $post->title = $row['text_formatted_full']; |
|
149 | + } else { |
|
150 | + $post->title = $row['text_formatted']; |
|
151 | + } |
|
148 | 152 | |
149 | 153 | $post->retweets = ($row['is_retweet'] == 0) ? $row['retweets'] : 0; |
150 | 154 | $post->favorites = ($row['is_retweet'] == 0) ? $row['favorites'] : 0; |
@@ -154,13 +158,15 @@ discard block |
||
154 | 158 | |
155 | 159 | $post->type = 'youtube'; |
156 | 160 | |
157 | - if($format == 'full') |
|
158 | - $post->title = "Favorited {$row['title']} by {$row['author']} on YouTube."; |
|
159 | - else |
|
160 | - $post->title = "Favorited <a href=\"http://www.youtube.com/watch?feature=player_embedded&v={$row['video_id']}\" rel=\"nofollow\" target=\"_blank\" title=\"{$row['content']}\">{$row['title']}</a> by {$row['author']} on YouTube."; |
|
161 | + if($format == 'full') { |
|
162 | + $post->title = "Favorited {$row['title']} by {$row['author']} on YouTube."; |
|
163 | + } else { |
|
164 | + $post->title = "Favorited <a href=\"http://www.youtube.com/watch?feature=player_embedded&v={$row['video_id']}\" rel=\"nofollow\" target=\"_blank\" title=\"{$row['content']}\">{$row['title']}</a> by {$row['author']} on YouTube."; |
|
165 | + } |
|
161 | 166 | |
162 | - if($format == 'full') |
|
163 | - $post->embed_code = "<iframe src=\"http://www.youtube.com/embed/{$row['video_id']}?rel=0\" frameborder=\"0\" allowfullscreen></iframe>"; |
|
167 | + if($format == 'full') { |
|
168 | + $post->embed_code = "<iframe src=\"http://www.youtube.com/embed/{$row['video_id']}?rel=0\" frameborder=\"0\" allowfullscreen></iframe>"; |
|
169 | + } |
|
164 | 170 | break; |
165 | 171 | } |
166 | 172 | |
@@ -189,10 +195,11 @@ discard block |
||
189 | 195 | Loader::load('view', '/Head', $this->data_array['head']); |
190 | 196 | foreach($this->body_view_array as $view) |
191 | 197 | { |
192 | - if(substr($view, 0, 1) == '/') |
|
193 | - Loader::load('view', $view, $this->data_array['body']); |
|
194 | - else |
|
195 | - Loader::load('view', URLDecode::getSite() . '/' . $view, $this->data_array['body']); |
|
198 | + if(substr($view, 0, 1) == '/') { |
|
199 | + Loader::load('view', $view, $this->data_array['body']); |
|
200 | + } else { |
|
201 | + Loader::load('view', URLDecode::getSite() . '/' . $view, $this->data_array['body']); |
|
202 | + } |
|
196 | 203 | } |
197 | 204 | |
198 | 205 | if (URLDecode::getSite() == 'waterfalls') { |
@@ -201,8 +208,9 @@ discard block |
||
201 | 208 | Loader::load('view', '/Foot', array('tracking_code' => self::$TRACKING_CODE)); |
202 | 209 | } |
203 | 210 | |
204 | - if($view == '/404' || $view == '/503') |
|
205 | - exit; |
|
211 | + if($view == '/404' || $view == '/503') { |
|
212 | + exit; |
|
213 | + } |
|
206 | 214 | } |
207 | 215 | |
208 | 216 | protected function set_header_method($method) |
@@ -262,11 +270,13 @@ discard block |
||
262 | 270 | |
263 | 271 | $js_array = array(); |
264 | 272 | |
265 | - if(count($this->js_array) > 0) |
|
266 | - $js_array = array_merge($js_array, $this->js_array); |
|
273 | + if(count($this->js_array) > 0) { |
|
274 | + $js_array = array_merge($js_array, $this->js_array); |
|
275 | + } |
|
267 | 276 | |
268 | - if(count($js_array) > 0) |
|
269 | - $js_array = Asset::getJS($js_array); |
|
277 | + if(count($js_array) > 0) { |
|
278 | + $js_array = Asset::getJS($js_array); |
|
279 | + } |
|
270 | 280 | |
271 | 281 | $this->set_head('css_link_array', $css_array); |
272 | 282 | $this->set_head('js_link_array', $js_array); |
@@ -279,14 +289,16 @@ discard block |
||
279 | 289 | |
280 | 290 | protected function eject() |
281 | 291 | { |
282 | - if(get_class($this) !== 'Error404Controller') |
|
283 | - Loader::loadNew('controller', '/Error404Controller')->activate(); |
|
292 | + if(get_class($this) !== 'Error404Controller') { |
|
293 | + Loader::loadNew('controller', '/Error404Controller')->activate(); |
|
294 | + } |
|
284 | 295 | } |
285 | 296 | |
286 | 297 | protected function unavailable() |
287 | 298 | { |
288 | - if(get_class($this) !== 'Error503Controller') |
|
289 | - Loader::loadNew('controller', '/Error503Controller')->activate(); |
|
299 | + if(get_class($this) !== 'Error503Controller') { |
|
300 | + Loader::loadNew('controller', '/Error503Controller')->activate(); |
|
301 | + } |
|
290 | 302 | } |
291 | 303 | |
292 | 304 | protected function redirect($uri, $method = 301) |
@@ -294,12 +306,14 @@ discard block |
||
294 | 306 | switch($method) |
295 | 307 | { |
296 | 308 | case 301 : |
297 | - if(get_class($this) !== 'Error301Controller') |
|
298 | - Loader::loadNew('controller', '/Error301Controller', array($uri))->activate(); |
|
309 | + if(get_class($this) !== 'Error301Controller') { |
|
310 | + Loader::loadNew('controller', '/Error301Controller', array($uri))->activate(); |
|
311 | + } |
|
299 | 312 | break; |
300 | 313 | case 303 : |
301 | - if(get_class($this) !== 'Error303Controller') |
|
302 | - Loader::loadNew('controller', '/Error303Controller', array($uri))->activate(); |
|
314 | + if(get_class($this) !== 'Error303Controller') { |
|
315 | + Loader::loadNew('controller', '/Error303Controller', array($uri))->activate(); |
|
316 | + } |
|
303 | 317 | break; |
304 | 318 | } |
305 | 319 | } |
@@ -346,18 +360,19 @@ discard block |
||
346 | 360 | $comment_object->url = $comment->url; |
347 | 361 | $comment_object->trusted = $comment->trusted; |
348 | 362 | |
349 | - if($comment->reply == 0 && Request::getPost('type') == $comment->id) |
|
350 | - $comment_object->errors = $this->comment_errors; |
|
351 | - else |
|
352 | - $comment_object->errors = array(); |
|
363 | + if($comment->reply == 0 && Request::getPost('type') == $comment->id) { |
|
364 | + $comment_object->errors = $this->comment_errors; |
|
365 | + } else { |
|
366 | + $comment_object->errors = array(); |
|
367 | + } |
|
353 | 368 | |
354 | 369 | if($comment->reply == 0) |
355 | 370 | { |
356 | 371 | $comment_object->replies = array(); |
357 | 372 | $comment_array[$comment->id] = $comment_object; |
358 | - } |
|
359 | - else |
|
360 | - $comment_array[$comment->reply]->replies[$comment->id] = $comment_object; |
|
373 | + } else { |
|
374 | + $comment_array[$comment->reply]->replies[$comment->id] = $comment_object; |
|
375 | + } |
|
361 | 376 | } |
362 | 377 | |
363 | 378 | $comment_count = CommentCollector::getCommentCountForURL($site, $path); |
@@ -382,22 +397,26 @@ discard block |
||
382 | 397 | $commenter->website = ''; |
383 | 398 | |
384 | 399 | $commenter_cookie = Cookie::instance('Commenter'); |
385 | - if(!$commenter_cookie->exists()) |
|
386 | - return $commenter; |
|
400 | + if(!$commenter_cookie->exists()) { |
|
401 | + return $commenter; |
|
402 | + } |
|
387 | 403 | |
388 | 404 | $commenter_cookie_value = $commenter_cookie->getValue(); |
389 | 405 | $commenter_cookie_value = json_decode($commenter_cookie_value); |
390 | 406 | |
391 | - if($commenter_cookie_value === NULL) |
|
392 | - return $commenter; |
|
407 | + if($commenter_cookie_value === NULL) { |
|
408 | + return $commenter; |
|
409 | + } |
|
393 | 410 | |
394 | - if(!isset($commenter_cookie_value->name) || !isset($commenter_cookie_value->email)) |
|
395 | - return $commenter; |
|
411 | + if(!isset($commenter_cookie_value->name) || !isset($commenter_cookie_value->email)) { |
|
412 | + return $commenter; |
|
413 | + } |
|
396 | 414 | |
397 | 415 | $commenter_object = CommentCollector::getCommenterByFields($commenter_cookie_value->name, $commenter_cookie_value->email, (isset($commenter_cookie_value->website) ? $commenter_cookie_value->website : '')); |
398 | 416 | |
399 | - if($commenter_object === NULL) |
|
400 | - return $commenter; |
|
417 | + if($commenter_object === NULL) { |
|
418 | + return $commenter; |
|
419 | + } |
|
401 | 420 | |
402 | 421 | $commenter->id = $commenter_object->id; |
403 | 422 | $commenter->name = $commenter_object->name; |
@@ -10,10 +10,10 @@ |
||
10 | 10 | |
11 | 11 | public function __construct() |
12 | 12 | { |
13 | - parent::__construct(); |
|
13 | + parent::__construct(); |
|
14 | 14 | |
15 | - global $container; |
|
16 | - $this->postRepository = new Jacobemerick\Web\Domain\Stream\Post\MysqlPostRepository($container['db_connection_locator']); |
|
15 | + global $container; |
|
16 | + $this->postRepository = new Jacobemerick\Web\Domain\Stream\Post\MysqlPostRepository($container['db_connection_locator']); |
|
17 | 17 | } |
18 | 18 | |
19 | 19 | protected function set_head_data() |
@@ -45,7 +45,7 @@ |
||
45 | 45 | |
46 | 46 | protected function get_list_results() |
47 | 47 | { |
48 | - return $this->postRepository->getPosts(self::$POSTS_PER_PAGE, $this->offset); |
|
48 | + return $this->postRepository->getPosts(self::$POSTS_PER_PAGE, $this->offset); |
|
49 | 49 | } |
50 | 50 | |
51 | 51 | protected function get_list_description() |
@@ -38,8 +38,9 @@ discard block |
||
38 | 38 | protected function get_page_number() |
39 | 39 | { |
40 | 40 | $page = URLDecode::getPiece(2); |
41 | - if(isset($page) && is_numeric($page)) |
|
42 | - return $page; |
|
41 | + if(isset($page) && is_numeric($page)) { |
|
42 | + return $page; |
|
43 | + } |
|
43 | 44 | return 1; |
44 | 45 | } |
45 | 46 | |
@@ -58,25 +59,29 @@ discard block |
||
58 | 59 | |
59 | 60 | protected function get_list_next_link() |
60 | 61 | { |
61 | - if($this->page == 1) |
|
62 | - return; |
|
63 | - if($this->page == 2) |
|
64 | - return Loader::getRootUrl('lifestream'); |
|
62 | + if($this->page == 1) { |
|
63 | + return; |
|
64 | + } |
|
65 | + if($this->page == 2) { |
|
66 | + return Loader::getRootUrl('lifestream'); |
|
67 | + } |
|
65 | 68 | return Loader::getRootUrl('lifestream') . 'page/' . ($this->page - 1) . '/'; |
66 | 69 | } |
67 | 70 | |
68 | 71 | protected function get_list_prev_link() |
69 | 72 | { |
70 | - if(($this->page * self::$POSTS_PER_PAGE) >= $this->get_total_post_count()) |
|
71 | - return; |
|
73 | + if(($this->page * self::$POSTS_PER_PAGE) >= $this->get_total_post_count()) { |
|
74 | + return; |
|
75 | + } |
|
72 | 76 | return Loader::getRootUrl('lifestream') . 'page/' . ($this->page + 1) . '/'; |
73 | 77 | } |
74 | 78 | |
75 | 79 | private $total_post_count; |
76 | 80 | protected function get_total_post_count() |
77 | 81 | { |
78 | - if(!isset($this->total_post_count)) |
|
79 | - $this->total_post_count = $this->postRepository->getPostsCount(); |
|
82 | + if(!isset($this->total_post_count)) { |
|
83 | + $this->total_post_count = $this->postRepository->getPostsCount(); |
|
84 | + } |
|
80 | 85 | return $this->total_post_count; |
81 | 86 | } |
82 | 87 |
@@ -20,14 +20,14 @@ discard block |
||
20 | 20 | parent::__construct(); |
21 | 21 | |
22 | 22 | $id = URLDecode::getPiece(2); |
23 | - if(!$id || !is_numeric($id)) |
|
23 | + if (!$id || !is_numeric($id)) |
|
24 | 24 | $this->eject(); |
25 | 25 | |
26 | 26 | $post = $this->postRepository->getPostById($id); |
27 | - if(!$post) |
|
27 | + if (!$post) |
|
28 | 28 | $this->eject(); |
29 | 29 | |
30 | - if(URLDecode::getPiece(1) != $post['type']) |
|
30 | + if (URLDecode::getPiece(1) != $post['type']) |
|
31 | 31 | $this->eject(); |
32 | 32 | |
33 | 33 | $this->post = $post; |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | |
60 | 60 | private function get_title() |
61 | 61 | { |
62 | - switch($this->post['type']) |
|
62 | + switch ($this->post['type']) |
|
63 | 63 | { |
64 | 64 | case 'blog' : |
65 | 65 | return 'Jacob blogged'; |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | |
85 | 85 | private function get_description() |
86 | 86 | { |
87 | - switch($this->post['type']) |
|
87 | + switch ($this->post['type']) |
|
88 | 88 | { |
89 | 89 | case 'blog' : |
90 | 90 | return 'Another awesome blog post from Jacob. Did I mention it was awesome?'; |
@@ -20,15 +20,18 @@ |
||
20 | 20 | parent::__construct(); |
21 | 21 | |
22 | 22 | $id = URLDecode::getPiece(2); |
23 | - if(!$id || !is_numeric($id)) |
|
24 | - $this->eject(); |
|
23 | + if(!$id || !is_numeric($id)) { |
|
24 | + $this->eject(); |
|
25 | + } |
|
25 | 26 | |
26 | 27 | $post = $this->postRepository->getPostById($id); |
27 | - if(!$post) |
|
28 | - $this->eject(); |
|
28 | + if(!$post) { |
|
29 | + $this->eject(); |
|
30 | + } |
|
29 | 31 | |
30 | - if(URLDecode::getPiece(1) != $post['type']) |
|
31 | - $this->eject(); |
|
32 | + if(URLDecode::getPiece(1) != $post['type']) { |
|
33 | + $this->eject(); |
|
34 | + } |
|
32 | 35 | |
33 | 36 | $this->post = $post; |
34 | 37 | } |
@@ -97,8 +97,9 @@ discard block |
||
97 | 97 | protected function get_page_number() |
98 | 98 | { |
99 | 99 | $page = URLDecode::getPiece(3); |
100 | - if(isset($page) && is_numeric($page)) |
|
101 | - return $page; |
|
100 | + if(isset($page) && is_numeric($page)) { |
|
101 | + return $page; |
|
102 | + } |
|
102 | 103 | return 1; |
103 | 104 | } |
104 | 105 | |
@@ -117,25 +118,29 @@ discard block |
||
117 | 118 | |
118 | 119 | protected function get_list_next_link() |
119 | 120 | { |
120 | - if($this->page == 1) |
|
121 | - return; |
|
122 | - if($this->page == 2) |
|
123 | - return Loader::getRootUrl('lifestream') . $this->tag . '/'; |
|
121 | + if($this->page == 1) { |
|
122 | + return; |
|
123 | + } |
|
124 | + if($this->page == 2) { |
|
125 | + return Loader::getRootUrl('lifestream') . $this->tag . '/'; |
|
126 | + } |
|
124 | 127 | return Loader::getRootUrl('lifestream') . $this->tag . '/page/' . ($this->page - 1) . '/'; |
125 | 128 | } |
126 | 129 | |
127 | 130 | protected function get_list_prev_link() |
128 | 131 | { |
129 | - if(($this->page * self::$POSTS_PER_PAGE) >= $this->get_total_post_count()) |
|
130 | - return; |
|
132 | + if(($this->page * self::$POSTS_PER_PAGE) >= $this->get_total_post_count()) { |
|
133 | + return; |
|
134 | + } |
|
131 | 135 | return Loader::getRootUrl('lifestream') . $this->tag . '/page/' . ($this->page + 1) . '/'; |
132 | 136 | } |
133 | 137 | |
134 | 138 | private $total_post_count; |
135 | 139 | protected function get_total_post_count() |
136 | 140 | { |
137 | - if(!isset($this->total_post_count)) |
|
138 | - $this->total_post_count = $this->postRepository->getPostsByTypeCount($this->tag); |
|
141 | + if(!isset($this->total_post_count)) { |
|
142 | + $this->total_post_count = $this->postRepository->getPostsByTypeCount($this->tag); |
|
143 | + } |
|
139 | 144 | return $this->total_post_count; |
140 | 145 | } |
141 | 146 |
@@ -4,7 +4,7 @@ |
||
4 | 4 | |
5 | 5 | interface BlogRepositoryInterface |
6 | 6 | { |
7 | - public function getBlogById($id); |
|
8 | - public function getBlogByTitle($title); |
|
9 | - public function getUnmappedBlogs(); |
|
7 | + public function getBlogById($id); |
|
8 | + public function getBlogByTitle($title); |
|
9 | + public function getUnmappedBlogs(); |
|
10 | 10 | } |
@@ -7,75 +7,75 @@ |
||
7 | 7 | class MysqlBlogRepository implements BlogRepositoryInterface |
8 | 8 | { |
9 | 9 | |
10 | - /** @var ConnectionLocator */ |
|
11 | - protected $connections; |
|
10 | + /** @var ConnectionLocator */ |
|
11 | + protected $connections; |
|
12 | 12 | |
13 | - /** |
|
14 | - * @param ConnectonLocator $connections |
|
15 | - */ |
|
16 | - public function __construct(ConnectionLocator $connections) |
|
17 | - { |
|
18 | - $this->connections = $connections; |
|
19 | - } |
|
13 | + /** |
|
14 | + * @param ConnectonLocator $connections |
|
15 | + */ |
|
16 | + public function __construct(ConnectionLocator $connections) |
|
17 | + { |
|
18 | + $this->connections = $connections; |
|
19 | + } |
|
20 | 20 | |
21 | - /** |
|
22 | - * @param integer $id |
|
23 | - * |
|
24 | - * @return array|false |
|
25 | - */ |
|
26 | - public function getBlogById($id) |
|
27 | - { |
|
28 | - $query = " |
|
21 | + /** |
|
22 | + * @param integer $id |
|
23 | + * |
|
24 | + * @return array|false |
|
25 | + */ |
|
26 | + public function getBlogById($id) |
|
27 | + { |
|
28 | + $query = " |
|
29 | 29 | SELECT * |
30 | 30 | FROM `jpemeric_stream`.`blog` |
31 | 31 | WHERE `id` = :id |
32 | 32 | LIMIT 1"; |
33 | - $bindings = [ |
|
34 | - 'id' => $id, |
|
35 | - ]; |
|
33 | + $bindings = [ |
|
34 | + 'id' => $id, |
|
35 | + ]; |
|
36 | 36 | |
37 | - return $this |
|
38 | - ->connections |
|
39 | - ->getRead() |
|
40 | - ->fetchOne($query, $bindings); |
|
41 | - } |
|
37 | + return $this |
|
38 | + ->connections |
|
39 | + ->getRead() |
|
40 | + ->fetchOne($query, $bindings); |
|
41 | + } |
|
42 | 42 | |
43 | - /** |
|
44 | - * @param string $title |
|
45 | - * |
|
46 | - * @return array|false |
|
47 | - */ |
|
48 | - public function getBlogByTitle($title) |
|
49 | - { |
|
50 | - $query = " |
|
43 | + /** |
|
44 | + * @param string $title |
|
45 | + * |
|
46 | + * @return array|false |
|
47 | + */ |
|
48 | + public function getBlogByTitle($title) |
|
49 | + { |
|
50 | + $query = " |
|
51 | 51 | SELECT * |
52 | 52 | FROM `jpemeric_stream`.`blog` |
53 | 53 | WHERE `title` = :title |
54 | 54 | LIMIT 1"; |
55 | - $bindings = [ |
|
56 | - 'title' => $title, |
|
57 | - ]; |
|
55 | + $bindings = [ |
|
56 | + 'title' => $title, |
|
57 | + ]; |
|
58 | 58 | |
59 | - return $this |
|
60 | - ->connections |
|
61 | - ->getRead() |
|
62 | - ->fetchOne($query, $bindings); |
|
63 | - } |
|
59 | + return $this |
|
60 | + ->connections |
|
61 | + ->getRead() |
|
62 | + ->fetchOne($query, $bindings); |
|
63 | + } |
|
64 | 64 | |
65 | - /** |
|
66 | - * @return array|false |
|
67 | - */ |
|
68 | - public function getUnmappedBlogs() |
|
69 | - { |
|
70 | - $query = " |
|
65 | + /** |
|
66 | + * @return array|false |
|
67 | + */ |
|
68 | + public function getUnmappedBlogs() |
|
69 | + { |
|
70 | + $query = " |
|
71 | 71 | SELECT `id`, `date` |
72 | 72 | FROM `jpemeric_stream`.`blog` |
73 | 73 | LEFT JOIN `jpemeric_stream`.`post` |
74 | 74 | ON `post`.`type_id` = `blog`.`id` AND `post`.`id` IS NULL"; |
75 | 75 | |
76 | - return $this |
|
77 | - ->connections |
|
78 | - ->getRead() |
|
79 | - ->fetchAll($query); |
|
80 | - } |
|
76 | + return $this |
|
77 | + ->connections |
|
78 | + ->getRead() |
|
79 | + ->fetchAll($query); |
|
80 | + } |
|
81 | 81 | } |
@@ -4,7 +4,7 @@ |
||
4 | 4 | |
5 | 5 | interface BookRepositoryInterface |
6 | 6 | { |
7 | - public function getBookById($id); |
|
8 | - public function getBookByFields($title, $author); |
|
9 | - public function getUnmappedBooks(); |
|
7 | + public function getBookById($id); |
|
8 | + public function getBookByFields($title, $author); |
|
9 | + public function getUnmappedBooks(); |
|
10 | 10 | } |