@@ -133,8 +133,9 @@ discard block |
||
133 | 133 | |
134 | 134 | private static function send($array, $gzip = true) |
135 | 135 | { |
136 | - if($gzip) |
|
137 | - self::start_gzipping(); |
|
136 | + if($gzip) { |
|
137 | + self::start_gzipping(); |
|
138 | + } |
|
138 | 139 | |
139 | 140 | foreach($array as $row) |
140 | 141 | { |
@@ -144,15 +145,17 @@ discard block |
||
144 | 145 | |
145 | 146 | private static function get_date($timestamp = false) |
146 | 147 | { |
147 | - if($timestamp == 0) |
|
148 | - $timestamp = time(); |
|
148 | + if($timestamp == 0) { |
|
149 | + $timestamp = time(); |
|
150 | + } |
|
149 | 151 | return gmdate('D, d M Y H:i:s \G\M\T', $timestamp); |
150 | 152 | } |
151 | 153 | |
152 | 154 | private static function start_gzipping() |
153 | 155 | { |
154 | - if(!ob_start('ob_gzhandler')) |
|
155 | - ob_start(); |
|
156 | + if(!ob_start('ob_gzhandler')) { |
|
157 | + ob_start(); |
|
158 | + } |
|
156 | 159 | } |
157 | 160 | |
158 | 161 | } |
@@ -38,8 +38,9 @@ discard block |
||
38 | 38 | 'date' => date('Y'))); |
39 | 39 | |
40 | 40 | Loader::loadInstance('utility', 'Database'); |
41 | - if(Database::isConnected() === false) |
|
42 | - $this->unavailable(); |
|
41 | + if(Database::isConnected() === false) { |
|
42 | + $this->unavailable(); |
|
43 | + } |
|
43 | 44 | } |
44 | 45 | |
45 | 46 | protected function get_domain_container() |
@@ -96,8 +97,9 @@ discard block |
||
96 | 97 | $post->title = "Blogged about {$category}: <a href=\"{$row['url']}\">{$row['title']}</a>."; |
97 | 98 | $post->comments = $row['comments']; |
98 | 99 | |
99 | - if($format == 'full') |
|
100 | - $post->image = Content::instance('FetchFirstPhoto', $row['body'])->activate(false, 'standard'); |
|
100 | + if($format == 'full') { |
|
101 | + $post->image = Content::instance('FetchFirstPhoto', $row['body'])->activate(false, 'standard'); |
|
102 | + } |
|
101 | 103 | break; |
102 | 104 | case 'book' : |
103 | 105 | $row = $bookRepository->getBookById($raw_post['type_id']); |
@@ -105,8 +107,9 @@ discard block |
||
105 | 107 | $post->type = 'book'; |
106 | 108 | $post->title = "Just finished reading {$row['title']} by {$row['author']}."; |
107 | 109 | |
108 | - if($format == 'full') |
|
109 | - $post->image = "<img alt=\"{$row['title']} by {$row['author']}\" src=\"{$row['image']}\" />"; |
|
110 | + if($format == 'full') { |
|
111 | + $post->image = "<img alt=\"{$row['title']} by {$row['author']}\" src=\"{$row['image']}\" />"; |
|
112 | + } |
|
110 | 113 | break; |
111 | 114 | case 'distance' : |
112 | 115 | $row = $distanceRepository->getDistanceById($raw_post['type_id']); |
@@ -115,16 +118,16 @@ discard block |
||
115 | 118 | if($row['type'] == 'running') |
116 | 119 | { |
117 | 120 | $post->title = "Ran {$row['distance']} miles and felt {$row['felt']}."; |
118 | - if(strlen($row['message']) > 0) |
|
119 | - $post->title .= " Afterwards, I was all like '{$row['message']}'."; |
|
120 | - } |
|
121 | - else if($row['type'] == 'hiking') |
|
121 | + if(strlen($row['message']) > 0) { |
|
122 | + $post->title .= " Afterwards, I was all like '{$row['message']}'."; |
|
123 | + } |
|
124 | + } else if($row['type'] == 'hiking') |
|
122 | 125 | { |
123 | 126 | $post->title = "Hiked {$row['distance']} miles and felt {$row['felt']}."; |
124 | - if(strlen($row['title']) > 0) |
|
125 | - $post->title .= " I was hiking up around the {$row['title']} area."; |
|
126 | - } |
|
127 | - else if ($row['type'] == 'walking') { |
|
127 | + if(strlen($row['title']) > 0) { |
|
128 | + $post->title .= " I was hiking up around the {$row['title']} area."; |
|
129 | + } |
|
130 | + } else if ($row['type'] == 'walking') { |
|
128 | 131 | $post->title = "Walked {$row['distance']} miles and felt {$row['felt']}."; |
129 | 132 | } |
130 | 133 | break; |
@@ -139,10 +142,11 @@ discard block |
||
139 | 142 | |
140 | 143 | $post->type = 'twitter'; |
141 | 144 | |
142 | - if($format == 'full') |
|
143 | - $post->title = $row['text_formatted_full']; |
|
144 | - else |
|
145 | - $post->title = $row['text_formatted']; |
|
145 | + if($format == 'full') { |
|
146 | + $post->title = $row['text_formatted_full']; |
|
147 | + } else { |
|
148 | + $post->title = $row['text_formatted']; |
|
149 | + } |
|
146 | 150 | |
147 | 151 | $post->retweets = ($row['is_retweet'] == 0) ? $row['retweets'] : 0; |
148 | 152 | $post->favorites = ($row['is_retweet'] == 0) ? $row['favorites'] : 0; |
@@ -152,13 +156,15 @@ discard block |
||
152 | 156 | |
153 | 157 | $post->type = 'youtube'; |
154 | 158 | |
155 | - if($format == 'full') |
|
156 | - $post->title = "Favorited {$row['title']} by {$row['author']} on YouTube."; |
|
157 | - else |
|
158 | - $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."; |
|
159 | + if($format == 'full') { |
|
160 | + $post->title = "Favorited {$row['title']} by {$row['author']} on YouTube."; |
|
161 | + } else { |
|
162 | + $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."; |
|
163 | + } |
|
159 | 164 | |
160 | - if($format == 'full') |
|
161 | - $post->embed_code = "<iframe src=\"http://www.youtube.com/embed/{$row['video_id']}?rel=0\" frameborder=\"0\" allowfullscreen></iframe>"; |
|
165 | + if($format == 'full') { |
|
166 | + $post->embed_code = "<iframe src=\"http://www.youtube.com/embed/{$row['video_id']}?rel=0\" frameborder=\"0\" allowfullscreen></iframe>"; |
|
167 | + } |
|
162 | 168 | break; |
163 | 169 | } |
164 | 170 | |
@@ -187,10 +193,11 @@ discard block |
||
187 | 193 | Loader::load('view', '/Head', $this->data_array['head']); |
188 | 194 | foreach($this->body_view_array as $view) |
189 | 195 | { |
190 | - if(substr($view, 0, 1) == '/') |
|
191 | - Loader::load('view', $view, $this->data_array['body']); |
|
192 | - else |
|
193 | - Loader::load('view', URLDecode::getSite() . '/' . $view, $this->data_array['body']); |
|
196 | + if(substr($view, 0, 1) == '/') { |
|
197 | + Loader::load('view', $view, $this->data_array['body']); |
|
198 | + } else { |
|
199 | + Loader::load('view', URLDecode::getSite() . '/' . $view, $this->data_array['body']); |
|
200 | + } |
|
194 | 201 | } |
195 | 202 | |
196 | 203 | if (URLDecode::getSite() == 'waterfalls') { |
@@ -199,8 +206,9 @@ discard block |
||
199 | 206 | Loader::load('view', '/Foot', array('tracking_code' => self::$TRACKING_CODE)); |
200 | 207 | } |
201 | 208 | |
202 | - if($view == '/404' || $view == '/503') |
|
203 | - exit; |
|
209 | + if($view == '/404' || $view == '/503') { |
|
210 | + exit; |
|
211 | + } |
|
204 | 212 | } |
205 | 213 | |
206 | 214 | protected function set_header_method($method) |
@@ -273,14 +281,16 @@ discard block |
||
273 | 281 | |
274 | 282 | protected function eject() |
275 | 283 | { |
276 | - if(get_class($this) !== 'Error404Controller') |
|
277 | - Loader::loadNew('controller', '/Error404Controller')->activate(); |
|
284 | + if(get_class($this) !== 'Error404Controller') { |
|
285 | + Loader::loadNew('controller', '/Error404Controller')->activate(); |
|
286 | + } |
|
278 | 287 | } |
279 | 288 | |
280 | 289 | protected function unavailable() |
281 | 290 | { |
282 | - if(get_class($this) !== 'Error503Controller') |
|
283 | - Loader::loadNew('controller', '/Error503Controller')->activate(); |
|
291 | + if(get_class($this) !== 'Error503Controller') { |
|
292 | + Loader::loadNew('controller', '/Error503Controller')->activate(); |
|
293 | + } |
|
284 | 294 | } |
285 | 295 | |
286 | 296 | protected function redirect($uri, $method = 301) |
@@ -288,12 +298,14 @@ discard block |
||
288 | 298 | switch($method) |
289 | 299 | { |
290 | 300 | case 301 : |
291 | - if(get_class($this) !== 'Error301Controller') |
|
292 | - Loader::loadNew('controller', '/Error301Controller', array($uri))->activate(); |
|
301 | + if(get_class($this) !== 'Error301Controller') { |
|
302 | + Loader::loadNew('controller', '/Error301Controller', array($uri))->activate(); |
|
303 | + } |
|
293 | 304 | break; |
294 | 305 | case 303 : |
295 | - if(get_class($this) !== 'Error303Controller') |
|
296 | - Loader::loadNew('controller', '/Error303Controller', array($uri))->activate(); |
|
306 | + if(get_class($this) !== 'Error303Controller') { |
|
307 | + Loader::loadNew('controller', '/Error303Controller', array($uri))->activate(); |
|
308 | + } |
|
297 | 309 | break; |
298 | 310 | } |
299 | 311 | } |
@@ -340,18 +352,19 @@ discard block |
||
340 | 352 | $comment_object->url = $comment->url; |
341 | 353 | $comment_object->trusted = $comment->trusted; |
342 | 354 | |
343 | - if($comment->reply == 0 && Request::getPost('type') == $comment->id) |
|
344 | - $comment_object->errors = $this->comment_errors; |
|
345 | - else |
|
346 | - $comment_object->errors = array(); |
|
355 | + if($comment->reply == 0 && Request::getPost('type') == $comment->id) { |
|
356 | + $comment_object->errors = $this->comment_errors; |
|
357 | + } else { |
|
358 | + $comment_object->errors = array(); |
|
359 | + } |
|
347 | 360 | |
348 | 361 | if($comment->reply == 0) |
349 | 362 | { |
350 | 363 | $comment_object->replies = array(); |
351 | 364 | $comment_array[$comment->id] = $comment_object; |
352 | - } |
|
353 | - else |
|
354 | - $comment_array[$comment->reply]->replies[$comment->id] = $comment_object; |
|
365 | + } else { |
|
366 | + $comment_array[$comment->reply]->replies[$comment->id] = $comment_object; |
|
367 | + } |
|
355 | 368 | } |
356 | 369 | |
357 | 370 | $comment_count = CommentCollector::getCommentCountForURL($site, $path); |
@@ -376,22 +389,26 @@ discard block |
||
376 | 389 | $commenter->website = ''; |
377 | 390 | |
378 | 391 | $commenter_cookie = Cookie::instance('Commenter'); |
379 | - if(!$commenter_cookie->exists()) |
|
380 | - return $commenter; |
|
392 | + if(!$commenter_cookie->exists()) { |
|
393 | + return $commenter; |
|
394 | + } |
|
381 | 395 | |
382 | 396 | $commenter_cookie_value = $commenter_cookie->getValue(); |
383 | 397 | $commenter_cookie_value = json_decode($commenter_cookie_value); |
384 | 398 | |
385 | - if($commenter_cookie_value === NULL) |
|
386 | - return $commenter; |
|
399 | + if($commenter_cookie_value === NULL) { |
|
400 | + return $commenter; |
|
401 | + } |
|
387 | 402 | |
388 | - if(!isset($commenter_cookie_value->name) || !isset($commenter_cookie_value->email)) |
|
389 | - return $commenter; |
|
403 | + if(!isset($commenter_cookie_value->name) || !isset($commenter_cookie_value->email)) { |
|
404 | + return $commenter; |
|
405 | + } |
|
390 | 406 | |
391 | 407 | $commenter_object = CommentCollector::getCommenterByFields($commenter_cookie_value->name, $commenter_cookie_value->email, (isset($commenter_cookie_value->website) ? $commenter_cookie_value->website : '')); |
392 | 408 | |
393 | - if($commenter_object === NULL) |
|
394 | - return $commenter; |
|
409 | + if($commenter_object === NULL) { |
|
410 | + return $commenter; |
|
411 | + } |
|
395 | 412 | |
396 | 413 | $commenter->id = $commenter_object->id; |
397 | 414 | $commenter->name = $commenter_object->name; |
@@ -19,16 +19,21 @@ discard block |
||
19 | 19 | |
20 | 20 | private static function get_router_name() |
21 | 21 | { |
22 | - if(Request::isAJAX()) |
|
23 | - return 'AJAXRouter'; |
|
24 | - if(URLDecode::getURI() == '/sitemap.xml') |
|
25 | - return 'SitemapRouter'; |
|
26 | - if(URLDecode::getURI() == '/rss/') |
|
27 | - return 'RSSRouter'; |
|
28 | - if(URLDecode::getExtension() == 'jpg') |
|
29 | - return 'ImageRouter'; |
|
30 | - if(URLDecode::getExtension() == 'png') |
|
31 | - return 'ImageRouter'; |
|
22 | + if(Request::isAJAX()) { |
|
23 | + return 'AJAXRouter'; |
|
24 | + } |
|
25 | + if(URLDecode::getURI() == '/sitemap.xml') { |
|
26 | + return 'SitemapRouter'; |
|
27 | + } |
|
28 | + if(URLDecode::getURI() == '/rss/') { |
|
29 | + return 'RSSRouter'; |
|
30 | + } |
|
31 | + if(URLDecode::getExtension() == 'jpg') { |
|
32 | + return 'ImageRouter'; |
|
33 | + } |
|
34 | + if(URLDecode::getExtension() == 'png') { |
|
35 | + return 'ImageRouter'; |
|
36 | + } |
|
32 | 37 | |
33 | 38 | switch(URLDecode::getSite()) |
34 | 39 | { |
@@ -85,19 +90,22 @@ discard block |
||
85 | 90 | |
86 | 91 | $redirect_uri = $this->check_for_special_redirect($redirect_uri); |
87 | 92 | |
88 | - if($this->requires_trailing_slash() && substr($redirect_uri, -1) != '/') |
|
89 | - $redirect_uri .= '/'; |
|
93 | + if($this->requires_trailing_slash() && substr($redirect_uri, -1) != '/') { |
|
94 | + $redirect_uri .= '/'; |
|
95 | + } |
|
90 | 96 | |
91 | 97 | if (URLDecode::getHost() == 'waterfalls.jacobemerick.com') { |
92 | 98 | $redirect_uri = 'http://' . (!Loader::isLive() ? 'dev' : 'www') . '.waterfallsofthekeweenaw.com' . $redirect_uri; |
93 | 99 | } |
94 | 100 | |
95 | - if($redirect_uri == URLDecode::getURI()) |
|
96 | - return; |
|
101 | + if($redirect_uri == URLDecode::getURI()) { |
|
102 | + return; |
|
103 | + } |
|
97 | 104 | |
98 | 105 | $controller_check = $redirect_uri; |
99 | - if(substr($redirect_uri, 0, 4) == 'http') |
|
100 | - $controller_check = preg_replace('@^http://([a-z\.]+)@', '', $redirect_uri); |
|
106 | + if(substr($redirect_uri, 0, 4) == 'http') { |
|
107 | + $controller_check = preg_replace('@^http://([a-z\.]+)@', '', $redirect_uri); |
|
108 | + } |
|
101 | 109 | |
102 | 110 | $controller = $this->get_controller($controller_check); |
103 | 111 | if($controller == '/Error404Controller') |
@@ -146,11 +154,13 @@ discard block |
||
146 | 154 | { |
147 | 155 | foreach($this->get_direct_array() as $check) |
148 | 156 | { |
149 | - if($uri == $check->match) |
|
150 | - return "{$this->get_primary_folder()}/{$check->controller}"; |
|
157 | + if($uri == $check->match) { |
|
158 | + return "{$this->get_primary_folder()}/{$check->controller}"; |
|
159 | + } |
|
151 | 160 | |
152 | - if(preg_match("@^{$check->match}$@", $uri)) |
|
153 | - return "{$this->get_primary_folder()}/{$check->controller}"; |
|
161 | + if(preg_match("@^{$check->match}$@", $uri)) { |
|
162 | + return "{$this->get_primary_folder()}/{$check->controller}"; |
|
163 | + } |
|
154 | 164 | } |
155 | 165 | |
156 | 166 | return '/Error404Controller'; |
@@ -158,16 +168,20 @@ discard block |
||
158 | 168 | |
159 | 169 | final private function get_primary_folder() |
160 | 170 | { |
161 | - if(Request::isAjax()) |
|
162 | - return 'ajax'; |
|
163 | - if(URLDecode::getURI() == '/sitemap.xml') |
|
164 | - return 'sitemap'; |
|
165 | - if(URLDecode::getURI() == '/rss/') |
|
166 | - return 'rss'; |
|
171 | + if(Request::isAjax()) { |
|
172 | + return 'ajax'; |
|
173 | + } |
|
174 | + if(URLDecode::getURI() == '/sitemap.xml') { |
|
175 | + return 'sitemap'; |
|
176 | + } |
|
177 | + if(URLDecode::getURI() == '/rss/') { |
|
178 | + return 'rss'; |
|
179 | + } |
|
167 | 180 | if( |
168 | 181 | URLDecode::getExtension() == 'jpg' || |
169 | - URLDecode::getExtension() == 'png') |
|
170 | - return 'images'; |
|
182 | + URLDecode::getExtension() == 'png') { |
|
183 | + return 'images'; |
|
184 | + } |
|
171 | 185 | |
172 | 186 | return URLDecode::getSite(); |
173 | 187 | } |