Completed
Push — master ( 881d4b...b9d18d )
by Jacob
06:59
created
controller/lifestream/PostController.class.inc.php 1 patch
Braces   +9 added lines, -6 removed lines patch added patch discarded remove patch
@@ -20,15 +20,18 @@
 block discarded – undo
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
 	}
Please login to merge, or discard this patch.
controller/lifestream/TagController.class.inc.php 1 patch
Braces   +15 added lines, -10 removed lines patch added patch discarded remove patch
@@ -97,8 +97,9 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.
utility/CronController.class.inc.php 1 patch
Braces   +14 added lines, -10 removed lines patch added patch discarded remove patch
@@ -22,8 +22,9 @@  discard block
 block discarded – undo
22 22
 	{
23 23
 		foreach(self::$CRON_ARRAY as $cron => $frequency)
24 24
 		{
25
-			if(!$this->time_to_run($frequency))
26
-				continue;
25
+			if(!$this->time_to_run($frequency)) {
26
+							continue;
27
+			}
27 28
 			
28 29
 			Loader::load('utility', "cron/{$cron}");
29 30
 			$reflection = new ReflectionClass($cron);
@@ -48,18 +49,21 @@  discard block
 block discarded – undo
48 49
 		
49 50
 		foreach($time as $key => $value)
50 51
 		{
51
-			if($value == '*')
52
-				continue;
52
+			if($value == '*') {
53
+							continue;
54
+			}
53 55
 			if(stristr($value, '/'))
54 56
 			{
55 57
 				$value = substr($value, 2);
56
-				if($cur[$key] % $value == 0)
57
-					continue;
58
-				else
59
-					return;
58
+				if($cur[$key] % $value == 0) {
59
+									continue;
60
+				} else {
61
+									return;
62
+				}
60 63
 			}
61
-			if($cur[$key] == $value)
62
-				continue;
64
+			if($cur[$key] == $value) {
65
+							continue;
66
+			}
63 67
 			return;
64 68
 		}
65 69
 		return true;
Please login to merge, or discard this patch.
utility/Header.class.inc.php 1 patch
Braces   +9 added lines, -6 removed lines patch added patch discarded remove patch
@@ -133,8 +133,9 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
controller/PageController.class.inc.php 1 patch
Braces   +70 added lines, -53 removed lines patch added patch discarded remove patch
@@ -38,8 +38,9 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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;
Please login to merge, or discard this patch.
utility/Loader.class.inc.php 1 patch
Braces   +14 added lines, -10 removed lines patch added patch discarded remove patch
@@ -17,8 +17,9 @@  discard block
 block discarded – undo
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,11 +108,13 @@  discard block
 block discarded – undo
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
-			if(!file_exists($file_path))
114
-				Debugger::logMessage("Requested file does not exist: {$type}, {$file}");
115
+			if(!file_exists($file_path)) {
116
+							Debugger::logMessage("Requested file does not exist: {$type}, {$file}");
117
+			}
115 118
 			
116 119
 			self::instance()->add_included_file($file_path);
117 120
 			
@@ -160,10 +163,11 @@  discard block
 block discarded – undo
160 163
 		
161 164
 		$reflectionObject = self::create_reflection_class($file);
162 165
 		
163
-		if($reflectionObject->hasMethod('__construct'))
164
-			return $reflectionObject->newInstanceArgs($data);
165
-		else
166
-			return $reflectionObject->newInstance();
166
+		if($reflectionObject->hasMethod('__construct')) {
167
+					return $reflectionObject->newInstanceArgs($data);
168
+		} else {
169
+					return $reflectionObject->newInstance();
170
+		}
167 171
 	}
168 172
 
169 173
 	public static function getRoot()
Please login to merge, or discard this patch.
router/Router.class.inc.php 1 patch
Braces   +21 added lines, -14 removed lines patch added patch discarded remove patch
@@ -18,8 +18,9 @@  discard block
 block discarded – undo
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
 		{
@@ -73,19 +74,22 @@  discard block
 block discarded – undo
73 74
 		
74 75
 		$redirect_uri = $this->check_for_special_redirect($redirect_uri);
75 76
 		
76
-		if($this->requires_trailing_slash() && substr($redirect_uri, -1) != '/')
77
-			$redirect_uri .= '/';
77
+		if($this->requires_trailing_slash() && substr($redirect_uri, -1) != '/') {
78
+					$redirect_uri .= '/';
79
+		}
78 80
 		
79 81
         if (URLDecode::getHost() == 'waterfalls.jacobemerick.com') {
80 82
             $redirect_uri = 'http://' . (!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
-		if(substr($redirect_uri, 0, 4) == 'http')
88
-			$controller_check = preg_replace('@^http://([a-z\.]+)@', '', $redirect_uri);
90
+		if(substr($redirect_uri, 0, 4) == 'http') {
91
+					$controller_check = preg_replace('@^http://([a-z\.]+)@', '', $redirect_uri);
92
+		}
89 93
 		
90 94
 		$controller = $this->get_controller($controller_check);
91 95
 		if($controller == '/Error404Controller')
@@ -114,11 +118,13 @@  discard block
 block discarded – undo
114 118
 	{
115 119
 		foreach($this->get_direct_array() as $check)
116 120
 		{
117
-			if($uri == $check->match)
118
-				return "{$this->get_primary_folder()}/{$check->controller}";
121
+			if($uri == $check->match) {
122
+							return "{$this->get_primary_folder()}/{$check->controller}";
123
+			}
119 124
 			
120
-			if(preg_match("@^{$check->match}$@", $uri))
121
-				return "{$this->get_primary_folder()}/{$check->controller}";
125
+			if(preg_match("@^{$check->match}$@", $uri)) {
126
+							return "{$this->get_primary_folder()}/{$check->controller}";
127
+			}
122 128
 		}
123 129
 		
124 130
 		return '/Error404Controller';
@@ -126,8 +132,9 @@  discard block
 block discarded – undo
126 132
 
127 133
 	final private function get_primary_folder()
128 134
 	{
129
-		if(Request::isAjax())
130
-			return 'ajax';
135
+		if(Request::isAjax()) {
136
+					return 'ajax';
137
+		}
131 138
 		
132 139
 		return URLDecode::getSite();
133 140
 	}
Please login to merge, or discard this patch.