@@ -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 | 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->activityRepository->getActivitiesCount(); |
|
82 | + if(!isset($this->total_post_count)) { |
|
83 | + $this->total_post_count = $this->activityRepository->getActivitiesCount(); |
|
84 | + } |
|
80 | 85 | return $this->total_post_count; |
81 | 86 | } |
82 | 87 |
@@ -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->activityRepository->getActivitiesByTypeCount($this->tag); |
|
141 | + if(!isset($this->total_post_count)) { |
|
142 | + $this->total_post_count = $this->activityRepository->getActivitiesByTypeCount($this->tag); |
|
143 | + } |
|
139 | 144 | return $this->total_post_count; |
140 | 145 | } |
141 | 146 |
@@ -102,10 +102,11 @@ discard block |
||
102 | 102 | Loader::load('view', '/Head', $this->data_array['head']); |
103 | 103 | foreach($this->body_view_array as $view) |
104 | 104 | { |
105 | - if(substr($view, 0, 1) == '/') |
|
106 | - Loader::load('view', $view, $this->data_array['body']); |
|
107 | - else |
|
108 | - Loader::load('view', URLDecode::getSite() . '/' . $view, $this->data_array['body']); |
|
105 | + if(substr($view, 0, 1) == '/') { |
|
106 | + Loader::load('view', $view, $this->data_array['body']); |
|
107 | + } else { |
|
108 | + Loader::load('view', URLDecode::getSite() . '/' . $view, $this->data_array['body']); |
|
109 | + } |
|
109 | 110 | } |
110 | 111 | |
111 | 112 | if (URLDecode::getSite() == 'waterfalls') { |
@@ -114,8 +115,9 @@ discard block |
||
114 | 115 | Loader::load('view', '/Foot', array('tracking_code' => self::$TRACKING_CODE)); |
115 | 116 | } |
116 | 117 | |
117 | - if($view == '/404' || $view == '/503') |
|
118 | - exit; |
|
118 | + if($view == '/404' || $view == '/503') { |
|
119 | + exit; |
|
120 | + } |
|
119 | 121 | } |
120 | 122 | |
121 | 123 | protected function set_header_method($method) |
@@ -195,14 +197,16 @@ discard block |
||
195 | 197 | |
196 | 198 | protected function eject() |
197 | 199 | { |
198 | - if(get_class($this) !== 'Error404Controller') |
|
199 | - Loader::loadNew('controller', '/Error404Controller')->activate(); |
|
200 | + if(get_class($this) !== 'Error404Controller') { |
|
201 | + Loader::loadNew('controller', '/Error404Controller')->activate(); |
|
202 | + } |
|
200 | 203 | } |
201 | 204 | |
202 | 205 | protected function unavailable() |
203 | 206 | { |
204 | - if(get_class($this) !== 'Error503Controller') |
|
205 | - Loader::loadNew('controller', '/Error503Controller')->activate(); |
|
207 | + if(get_class($this) !== 'Error503Controller') { |
|
208 | + Loader::loadNew('controller', '/Error503Controller')->activate(); |
|
209 | + } |
|
206 | 210 | } |
207 | 211 | |
208 | 212 | protected function redirect($uri, $method = 301) |
@@ -210,12 +214,14 @@ discard block |
||
210 | 214 | switch($method) |
211 | 215 | { |
212 | 216 | case 301 : |
213 | - if(get_class($this) !== 'Error301Controller') |
|
214 | - Loader::loadNew('controller', '/Error301Controller', array($uri))->activate(); |
|
217 | + if(get_class($this) !== 'Error301Controller') { |
|
218 | + Loader::loadNew('controller', '/Error301Controller', array($uri))->activate(); |
|
219 | + } |
|
215 | 220 | break; |
216 | 221 | case 303 : |
217 | - if(get_class($this) !== 'Error303Controller') |
|
218 | - Loader::loadNew('controller', '/Error303Controller', array($uri))->activate(); |
|
222 | + if(get_class($this) !== 'Error303Controller') { |
|
223 | + Loader::loadNew('controller', '/Error303Controller', array($uri))->activate(); |
|
224 | + } |
|
219 | 225 | break; |
220 | 226 | } |
221 | 227 | } |
@@ -262,18 +268,19 @@ discard block |
||
262 | 268 | $comment_object->url = $comment->url; |
263 | 269 | $comment_object->trusted = $comment->trusted; |
264 | 270 | |
265 | - if($comment->reply == 0 && Request::getPost('type') == $comment->id) |
|
266 | - $comment_object->errors = $this->comment_errors; |
|
267 | - else |
|
268 | - $comment_object->errors = array(); |
|
271 | + if($comment->reply == 0 && Request::getPost('type') == $comment->id) { |
|
272 | + $comment_object->errors = $this->comment_errors; |
|
273 | + } else { |
|
274 | + $comment_object->errors = array(); |
|
275 | + } |
|
269 | 276 | |
270 | 277 | if($comment->reply == 0) |
271 | 278 | { |
272 | 279 | $comment_object->replies = array(); |
273 | 280 | $comment_array[$comment->id] = $comment_object; |
274 | - } |
|
275 | - else |
|
276 | - $comment_array[$comment->reply]->replies[$comment->id] = $comment_object; |
|
281 | + } else { |
|
282 | + $comment_array[$comment->reply]->replies[$comment->id] = $comment_object; |
|
283 | + } |
|
277 | 284 | } |
278 | 285 | |
279 | 286 | $comment_count = CommentCollector::getCommentCountForURL($site, $path); |
@@ -298,22 +305,26 @@ discard block |
||
298 | 305 | $commenter->website = ''; |
299 | 306 | |
300 | 307 | $commenter_cookie = Cookie::instance('Commenter'); |
301 | - if(!$commenter_cookie->exists()) |
|
302 | - return $commenter; |
|
308 | + if(!$commenter_cookie->exists()) { |
|
309 | + return $commenter; |
|
310 | + } |
|
303 | 311 | |
304 | 312 | $commenter_cookie_value = $commenter_cookie->getValue(); |
305 | 313 | $commenter_cookie_value = json_decode($commenter_cookie_value); |
306 | 314 | |
307 | - if($commenter_cookie_value === NULL) |
|
308 | - return $commenter; |
|
315 | + if($commenter_cookie_value === NULL) { |
|
316 | + return $commenter; |
|
317 | + } |
|
309 | 318 | |
310 | - if(!isset($commenter_cookie_value->name) || !isset($commenter_cookie_value->email)) |
|
311 | - return $commenter; |
|
319 | + if(!isset($commenter_cookie_value->name) || !isset($commenter_cookie_value->email)) { |
|
320 | + return $commenter; |
|
321 | + } |
|
312 | 322 | |
313 | 323 | $commenter_object = CommentCollector::getCommenterByFields($commenter_cookie_value->name, $commenter_cookie_value->email, (isset($commenter_cookie_value->website) ? $commenter_cookie_value->website : '')); |
314 | 324 | |
315 | - if($commenter_object === NULL) |
|
316 | - return $commenter; |
|
325 | + if($commenter_object === NULL) { |
|
326 | + return $commenter; |
|
327 | + } |
|
317 | 328 | |
318 | 329 | $commenter->id = $commenter_object->id; |
319 | 330 | $commenter->name = $commenter_object->name; |
@@ -17,8 +17,9 @@ discard block |
||
17 | 17 | |
18 | 18 | public static function instance() |
19 | 19 | { |
20 | - if(!isset(self::$instance)) |
|
21 | - self::$instance = new Loader(); |
|
20 | + if(!isset(self::$instance)) { |
|
21 | + self::$instance = new Loader(); |
|
22 | + } |
|
22 | 23 | return self::$instance; |
23 | 24 | } |
24 | 25 | |
@@ -107,8 +108,9 @@ discard block |
||
107 | 108 | foreach((array) $files as $file) |
108 | 109 | { |
109 | 110 | $file_path = self::instance()->get_path($type, $file); |
110 | - if(in_array($file_path, self::instance()->get_included_files()) && $type !== 'view') |
|
111 | - continue; |
|
111 | + if(in_array($file_path, self::instance()->get_included_files()) && $type !== 'view') { |
|
112 | + continue; |
|
113 | + } |
|
112 | 114 | |
113 | 115 | // if(!file_exists($file_path)) |
114 | 116 | // Debugger::logMessage("Requested file does not exist: {$type}, {$file}"); |
@@ -160,10 +162,11 @@ discard block |
||
160 | 162 | |
161 | 163 | $reflectionObject = self::create_reflection_class($file); |
162 | 164 | |
163 | - if($reflectionObject->hasMethod('__construct')) |
|
164 | - return $reflectionObject->newInstanceArgs($data); |
|
165 | - else |
|
166 | - return $reflectionObject->newInstance(); |
|
165 | + if($reflectionObject->hasMethod('__construct')) { |
|
166 | + return $reflectionObject->newInstanceArgs($data); |
|
167 | + } else { |
|
168 | + return $reflectionObject->newInstance(); |
|
169 | + } |
|
167 | 170 | } |
168 | 171 | |
169 | 172 | public static function getRoot() |
@@ -11,10 +11,11 @@ discard block |
||
11 | 11 | |
12 | 12 | protected function execute($is_absolute = false, $size = 'thumb') |
13 | 13 | { |
14 | - if(preg_match(self::$PHOTO_PLACEHOLDER_MATCH, $this->content, $match) === 1) |
|
15 | - $this->content = $this->get_thumb($match[1], $is_absolute, $size); |
|
16 | - else |
|
17 | - $this->content = self::$DEFAULT_RETURN; |
|
14 | + if(preg_match(self::$PHOTO_PLACEHOLDER_MATCH, $this->content, $match) === 1) { |
|
15 | + $this->content = $this->get_thumb($match[1], $is_absolute, $size); |
|
16 | + } else { |
|
17 | + $this->content = self::$DEFAULT_RETURN; |
|
18 | + } |
|
18 | 19 | return; |
19 | 20 | } |
20 | 21 | |
@@ -34,16 +35,18 @@ discard block |
||
34 | 35 | |
35 | 36 | Loader::load('collector', 'image/PhotoCollector'); |
36 | 37 | $photo_result = PhotoCollector::fetchRow($category, $photo); |
37 | - if($photo_result == false) |
|
38 | - return ''; |
|
38 | + if($photo_result == false) { |
|
39 | + return ''; |
|
40 | + } |
|
39 | 41 | |
40 | 42 | $height = $file_size[1]; |
41 | 43 | $width = $file_size[0]; |
42 | 44 | $description = $photo_result->description; |
43 | 45 | |
44 | 46 | $domain = '/'; |
45 | - if($is_absolute) |
|
46 | - $domain = Loader::getRootURL(URLDecode::getSite()); |
|
47 | + if($is_absolute) { |
|
48 | + $domain = Loader::getRootURL(URLDecode::getSite()); |
|
49 | + } |
|
47 | 50 | |
48 | 51 | return sprintf(self::$IMAGE_NODE, $domain, $category, $photo, $size, $extension, $height, $width, $description); |
49 | 52 | } |
@@ -18,8 +18,9 @@ discard block |
||
18 | 18 | |
19 | 19 | private static function get_router_name() |
20 | 20 | { |
21 | - if(Request::isAJAX()) |
|
22 | - return 'AJAXRouter'; |
|
21 | + if(Request::isAJAX()) { |
|
22 | + return 'AJAXRouter'; |
|
23 | + } |
|
23 | 24 | |
24 | 25 | switch(URLDecode::getSite()) |
25 | 26 | { |
@@ -72,16 +73,18 @@ discard block |
||
72 | 73 | |
73 | 74 | $redirect_uri = $this->check_for_special_redirect($redirect_uri); |
74 | 75 | |
75 | - if($this->requires_trailing_slash() && substr($redirect_uri, -1) != '/') |
|
76 | - $redirect_uri .= '/'; |
|
76 | + if($this->requires_trailing_slash() && substr($redirect_uri, -1) != '/') { |
|
77 | + $redirect_uri .= '/'; |
|
78 | + } |
|
77 | 79 | |
78 | 80 | if (URLDecode::getHost() == 'waterfalls.jacobemerick.com') { |
79 | 81 | $protocol = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') ? 'https' : 'http'; |
80 | 82 | $redirect_uri = $protocol . '://' . (!Loader::isLive() ? 'dev' : 'www') . '.waterfallsofthekeweenaw.com' . $redirect_uri; |
81 | 83 | } |
82 | 84 | |
83 | - if($redirect_uri == URLDecode::getURI()) |
|
84 | - return; |
|
85 | + if($redirect_uri == URLDecode::getURI()) { |
|
86 | + return; |
|
87 | + } |
|
85 | 88 | |
86 | 89 | $controller_check = $redirect_uri; |
87 | 90 | if(substr($redirect_uri, 0, 4) == 'http') { |
@@ -115,11 +118,13 @@ discard block |
||
115 | 118 | { |
116 | 119 | foreach($this->get_direct_array() as $check) |
117 | 120 | { |
118 | - if($uri == $check->match) |
|
119 | - return "{$this->get_primary_folder()}/{$check->controller}"; |
|
121 | + if($uri == $check->match) { |
|
122 | + return "{$this->get_primary_folder()}/{$check->controller}"; |
|
123 | + } |
|
120 | 124 | |
121 | - if(preg_match("@^{$check->match}$@", $uri)) |
|
122 | - return "{$this->get_primary_folder()}/{$check->controller}"; |
|
125 | + if(preg_match("@^{$check->match}$@", $uri)) { |
|
126 | + return "{$this->get_primary_folder()}/{$check->controller}"; |
|
127 | + } |
|
123 | 128 | } |
124 | 129 | |
125 | 130 | return '/Error404Controller'; |
@@ -127,8 +132,9 @@ discard block |
||
127 | 132 | |
128 | 133 | final private function get_primary_folder() |
129 | 134 | { |
130 | - if(Request::isAjax()) |
|
131 | - return 'ajax'; |
|
135 | + if(Request::isAjax()) { |
|
136 | + return 'ajax'; |
|
137 | + } |
|
132 | 138 | |
133 | 139 | return URLDecode::getSite(); |
134 | 140 | } |
@@ -26,8 +26,9 @@ discard block |
||
26 | 26 | parent::__construct(); |
27 | 27 | |
28 | 28 | $this->post = PostCollector::getPostByURI(URLDecode::getPiece(2)); |
29 | - if($this->post == null) |
|
30 | - $this->eject(); |
|
29 | + if($this->post == null) { |
|
30 | + $this->eject(); |
|
31 | + } |
|
31 | 32 | |
32 | 33 | $this->handle_comment_submit( |
33 | 34 | self::$BLOG_SITE_ID, |
@@ -106,8 +107,9 @@ discard block |
||
106 | 107 | private function get_series_posts() |
107 | 108 | { |
108 | 109 | $series_posts = $this->fetch_series_posts(); |
109 | - if(count($series_posts) < 1) |
|
110 | - return array(); |
|
110 | + if(count($series_posts) < 1) { |
|
111 | + return array(); |
|
112 | + } |
|
111 | 113 | |
112 | 114 | $previous_post = new stdclass(); |
113 | 115 | $next_post = new stdclass(); |
@@ -141,9 +143,9 @@ discard block |
||
141 | 143 | |
142 | 144 | $post->url = Loader::getRootUrl('blog') . "{$post_row['category']}/{$post_row['path']}/"; |
143 | 145 | |
144 | - if(!$found_current_post) |
|
145 | - $previous_post = $post; |
|
146 | - else |
|
146 | + if(!$found_current_post) { |
|
147 | + $previous_post = $post; |
|
148 | + } else |
|
147 | 149 | { |
148 | 150 | $next_post = $post; |
149 | 151 | break; |
@@ -14,10 +14,11 @@ discard block |
||
14 | 14 | preg_match_all(self::$LINK_PLACEHOLDER_MATCH, $this->content, $matches); |
15 | 15 | foreach($matches[1] as $key => $match) |
16 | 16 | { |
17 | - if(isset($matches[3][$key])) |
|
18 | - $link_content = $this->get_link($match, $is_absolute, $matches[3][$key]); |
|
19 | - else |
|
20 | - $link_content = $this->get_link($match, $is_absolute); |
|
17 | + if(isset($matches[3][$key])) { |
|
18 | + $link_content = $this->get_link($match, $is_absolute, $matches[3][$key]); |
|
19 | + } else { |
|
20 | + $link_content = $this->get_link($match, $is_absolute); |
|
21 | + } |
|
21 | 22 | $this->content = str_replace($matches[0][$key], $link_content, $this->content); |
22 | 23 | } |
23 | 24 | return; |
@@ -36,14 +37,16 @@ discard block |
||
36 | 37 | $repository = new Jacobemerick\Web\Domain\Blog\Post\MysqlPostRepository($container['db_connection_locator']); |
37 | 38 | $post = $repository->findPostByPath($post_uri); |
38 | 39 | |
39 | - if($post === NULL) |
|
40 | - return; |
|
40 | + if($post === NULL) { |
|
41 | + return; |
|
42 | + } |
|
41 | 43 | |
42 | 44 | $link .= ($is_absolute) ? Loader::getRootURL('blog') : '/'; |
43 | 45 | $link .= "{$post['category']}/{$post['path']}/"; |
44 | 46 | |
45 | - if($anchor == '') |
|
46 | - $anchor = $post['title']; |
|
47 | + if($anchor == '') { |
|
48 | + $anchor = $post['title']; |
|
49 | + } |
|
47 | 50 | |
48 | 51 | break; |
49 | 52 | case 'blog-tag' : |
@@ -62,14 +65,16 @@ discard block |
||
62 | 65 | Loader::load('collector', 'waterfall/LogCollector'); |
63 | 66 | $log = LogCollector::getByAlias($uri); |
64 | 67 | |
65 | - if($log === NULL) |
|
66 | - return; |
|
68 | + if($log === NULL) { |
|
69 | + return; |
|
70 | + } |
|
67 | 71 | |
68 | 72 | $link .= ($is_absolute) ? Loader::getRootURL('waterfalls') : '/'; |
69 | 73 | $link .= "journal/{$log->alias}/"; |
70 | 74 | |
71 | - if($anchor == '') |
|
72 | - $anchor = $log->title; |
|
75 | + if($anchor == '') { |
|
76 | + $anchor = $log->title; |
|
77 | + } |
|
73 | 78 | |
74 | 79 | break; |
75 | 80 | case 'falls' : |