Completed
Push — master ( 99f0cc...43937d )
by Jacob
03:09
created
utility/CronController.class.inc.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -20,9 +20,9 @@  discard block
 block discarded – undo
20 20
 
21 21
 	public function activate()
22 22
 	{
23
-		foreach(self::$CRON_ARRAY as $cron => $frequency)
23
+		foreach (self::$CRON_ARRAY as $cron => $frequency)
24 24
 		{
25
-			if(!$this->time_to_run($frequency))
25
+			if (!$this->time_to_run($frequency))
26 26
 				continue;
27 27
 			
28 28
 			Loader::load('utility', "cron/{$cron}");
@@ -46,19 +46,19 @@  discard block
 block discarded – undo
46 46
 		$operator = explode(' ', $frequency);
47 47
 		list($time['minute'], $time['hour'], $time['day'], $time['month'], $time['weekday']) = $operator;
48 48
 		
49
-		foreach($time as $key => $value)
49
+		foreach ($time as $key => $value)
50 50
 		{
51
-			if($value == '*')
51
+			if ($value == '*')
52 52
 				continue;
53
-			if(stristr($value, '/'))
53
+			if (stristr($value, '/'))
54 54
 			{
55 55
 				$value = substr($value, 2);
56
-				if($cur[$key] % $value == 0)
56
+				if ($cur[$key] % $value == 0)
57 57
 					continue;
58 58
 				else
59 59
 					return;
60 60
 			}
61
-			if($cur[$key] == $value)
61
+			if ($cur[$key] == $value)
62 62
 				continue;
63 63
 			return;
64 64
 		}
Please login to merge, or discard this patch.
controller/PageController.class.inc.php 1 patch
Spacing   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
 			'date' => date('Y')));
39 39
 		
40 40
 		Loader::loadInstance('utility', 'Database');
41
-		if(Database::isConnected() === false)
41
+		if (Database::isConnected() === false)
42 42
 			$this->unavailable();
43 43
 	}
44 44
 
@@ -63,9 +63,9 @@  discard block
 block discarded – undo
63 63
     $post_result = $activityRepository->getPosts(5);
64 64
 
65 65
 		$post_array = array();
66
-		foreach($post_result as $row)
66
+		foreach ($post_result as $row)
67 67
 		{
68
-			$post_array[] = $this->expand_post($row);;
68
+			$post_array[] = $this->expand_post($row); ;
69 69
 		}
70 70
 		
71 71
 		return $post_array;
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
 
86 86
 		$post = new stdclass();
87 87
 		
88
-		switch($raw_post['type'])
88
+		switch ($raw_post['type'])
89 89
 		{
90 90
 			case 'blog' :
91 91
 				$row = $blogRepository->getBlogById($raw_post['type_id']);
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
 				$post->title = "Blogged about {$category}: <a href=\"{$row['url']}\">{$row['title']}</a>.";
97 97
 				$post->comments = $row['comments'];
98 98
 				
99
-				if($format == 'full')
99
+				if ($format == 'full')
100 100
 					$post->image = Content::instance('FetchFirstPhoto', $row['body'])->activate(false, 'standard');
101 101
 			break;
102 102
 			case 'book' :
@@ -105,23 +105,23 @@  discard block
 block discarded – undo
105 105
 				$post->type = 'book';
106 106
 				$post->title = "Just finished reading {$row['title']} by {$row['author']}.";
107 107
 				
108
-				if($format == 'full')
108
+				if ($format == 'full')
109 109
 					$post->image = "<img alt=\"{$row['title']} by {$row['author']}\" src=\"{$row['image']}\" />";
110 110
 			break;
111 111
 			case 'distance' :
112 112
 				$row = $distanceRepository->getDistanceById($raw_post['type_id']);
113 113
 				
114 114
 				$post->type = 'distance';
115
-				if($row['type'] == 'running')
115
+				if ($row['type'] == 'running')
116 116
 				{
117 117
 					$post->title = "Ran {$row['distance']} miles and felt {$row['felt']}.";
118
-					if(strlen($row['message']) > 0)
118
+					if (strlen($row['message']) > 0)
119 119
 						$post->title .= " Afterwards, I was all like '{$row['message']}'.";
120 120
 				}
121
-				else if($row['type'] == 'hiking')
121
+				else if ($row['type'] == 'hiking')
122 122
 				{
123 123
 					$post->title = "Hiked {$row['distance']} miles and felt {$row['felt']}.";
124
-					if(strlen($row['title']) > 0)
124
+					if (strlen($row['title']) > 0)
125 125
 						$post->title .= " I was hiking up around the {$row['title']} area.";
126 126
 				}
127 127
                 else if ($row['type'] == 'walking') {
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
 				
140 140
 				$post->type = 'twitter';
141 141
 				
142
-				if($format == 'full')
142
+				if ($format == 'full')
143 143
 					$post->title = $row['text_formatted_full'];
144 144
 				else
145 145
 					$post->title = $row['text_formatted'];
@@ -152,12 +152,12 @@  discard block
 block discarded – undo
152 152
 				
153 153
 				$post->type = 'youtube';
154 154
 				
155
-				if($format == 'full')
155
+				if ($format == 'full')
156 156
 					$post->title = "Favorited {$row['title']} by {$row['author']} on YouTube.";
157 157
 				else
158 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 159
 				
160
-				if($format == 'full')
160
+				if ($format == 'full')
161 161
 					$post->embed_code = "<iframe src=\"http://www.youtube.com/embed/{$row['video_id']}?rel=0\" frameborder=\"0\" allowfullscreen></iframe>";
162 162
 			break;
163 163
 		}
@@ -185,9 +185,9 @@  discard block
 block discarded – undo
185 185
 		$headers = $this->headers;
186 186
 		Header::$headers();
187 187
 		Loader::load('view', '/Head', $this->data_array['head']);
188
-		foreach($this->body_view_array as $view)
188
+		foreach ($this->body_view_array as $view)
189 189
 		{
190
-			if(substr($view, 0, 1) == '/')
190
+			if (substr($view, 0, 1) == '/')
191 191
 				Loader::load('view', $view, $this->data_array['body']);
192 192
 			else
193 193
 				Loader::load('view', URLDecode::getSite() . '/' . $view, $this->data_array['body']);
@@ -199,7 +199,7 @@  discard block
 block discarded – undo
199 199
             Loader::load('view', '/Foot', array('tracking_code' => self::$TRACKING_CODE));
200 200
         }
201 201
 		
202
-		if($view == '/404' || $view == '/503')
202
+		if ($view == '/404' || $view == '/503')
203 203
 			exit;
204 204
 	}
205 205
 
@@ -255,10 +255,10 @@  discard block
 block discarded – undo
255 255
 
256 256
 	private function load_assets()
257 257
 	{
258
-    $css_array = array_map(function ($stylesheet) {
258
+    $css_array = array_map(function($stylesheet) {
259 259
       return "/css/{$stylesheet}.css";
260 260
     }, $this->css_array);
261
-    $js_array = array_map(function ($script) {
261
+    $js_array = array_map(function($script) {
262 262
       return "/js/{$script}.js";
263 263
     }, $this->js_array);
264 264
 		
@@ -273,26 +273,26 @@  discard block
 block discarded – undo
273 273
 
274 274
 	protected function eject()
275 275
 	{
276
-		if(get_class($this) !== 'Error404Controller')
276
+		if (get_class($this) !== 'Error404Controller')
277 277
 			Loader::loadNew('controller', '/Error404Controller')->activate();
278 278
 	}
279 279
 
280 280
 	protected function unavailable()
281 281
 	{
282
-		if(get_class($this) !== 'Error503Controller')
282
+		if (get_class($this) !== 'Error503Controller')
283 283
 			Loader::loadNew('controller', '/Error503Controller')->activate();
284 284
 	}
285 285
 
286 286
 	protected function redirect($uri, $method = 301)
287 287
 	{
288
-		switch($method)
288
+		switch ($method)
289 289
 		{
290 290
 			case 301 :
291
-				if(get_class($this) !== 'Error301Controller')
291
+				if (get_class($this) !== 'Error301Controller')
292 292
 					Loader::loadNew('controller', '/Error301Controller', array($uri))->activate();
293 293
 				break;
294 294
 			case 303 :
295
-				if(get_class($this) !== 'Error303Controller')
295
+				if (get_class($this) !== 'Error303Controller')
296 296
 					Loader::loadNew('controller', '/Error303Controller', array($uri))->activate();
297 297
 				break;
298 298
 		}
@@ -312,7 +312,7 @@  discard block
 block discarded – undo
312 312
 	private $comment_errors;
313 313
 	protected function handle_comment_submit($site_id, $path, $redirect_url, $page_title)
314 314
 	{
315
-		if(Request::hasPost() && Request::getPost('submit') == 'Submit Comment')
315
+		if (Request::hasPost() && Request::getPost('submit') == 'Submit Comment')
316 316
 		{
317 317
 			$parameters = array($site_id, $path, $redirect_url, $page_title);
318 318
 			$this->comment_errors = Loader::loadNew('module', 'form/CommentSubmitModule', $parameters)->activate();
@@ -330,7 +330,7 @@  discard block
 block discarded – undo
330 330
 		$comment_array = array();
331 331
 		$comment_result = CommentCollector::getCommentsForURL($site, $path, $commenter->id);
332 332
 		
333
-		foreach($comment_result as $comment)
333
+		foreach ($comment_result as $comment)
334 334
 		{
335 335
 			$comment_object = new stdclass();
336 336
 			$comment_object->id = $comment->id;
@@ -340,12 +340,12 @@  discard block
 block discarded – undo
340 340
 			$comment_object->url = $comment->url;
341 341
 			$comment_object->trusted = $comment->trusted;
342 342
 			
343
-			if($comment->reply == 0 && Request::getPost('type') == $comment->id)
343
+			if ($comment->reply == 0 && Request::getPost('type') == $comment->id)
344 344
 				$comment_object->errors = $this->comment_errors;
345 345
 			else
346 346
 				$comment_object->errors = array();
347 347
 			
348
-			if($comment->reply == 0)
348
+			if ($comment->reply == 0)
349 349
 			{
350 350
 				$comment_object->replies = array();
351 351
 				$comment_array[$comment->id] = $comment_object;
@@ -376,21 +376,21 @@  discard block
 block discarded – undo
376 376
 		$commenter->website = '';
377 377
 		
378 378
 		$commenter_cookie = Cookie::instance('Commenter');
379
-		if(!$commenter_cookie->exists())
379
+		if (!$commenter_cookie->exists())
380 380
 			return $commenter;
381 381
 		
382 382
 		$commenter_cookie_value = $commenter_cookie->getValue();
383 383
 		$commenter_cookie_value = json_decode($commenter_cookie_value);
384 384
 		
385
-		if($commenter_cookie_value === NULL)
385
+		if ($commenter_cookie_value === NULL)
386 386
 			return $commenter;
387 387
 		
388
-		if(!isset($commenter_cookie_value->name) || !isset($commenter_cookie_value->email))
388
+		if (!isset($commenter_cookie_value->name) || !isset($commenter_cookie_value->email))
389 389
 			return $commenter;
390 390
 		
391 391
 		$commenter_object = CommentCollector::getCommenterByFields($commenter_cookie_value->name, $commenter_cookie_value->email, (isset($commenter_cookie_value->website) ? $commenter_cookie_value->website : ''));
392 392
 		
393
-		if($commenter_object === NULL)
393
+		if ($commenter_object === NULL)
394 394
 			return $commenter;
395 395
 		
396 396
 		$commenter->id = $commenter_object->id;
Please login to merge, or discard this patch.
utility/Loader.class.inc.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -17,14 +17,14 @@  discard block
 block discarded – undo
17 17
 
18 18
 	public static function instance()
19 19
 	{
20
-		if(!isset(self::$instance))
20
+		if (!isset(self::$instance))
21 21
 			self::$instance = new Loader();
22 22
 		return self::$instance;
23 23
 	}
24 24
 
25 25
 	private function get_root()
26 26
 	{
27
-		if(!isset($this->root))
27
+		if (!isset($this->root))
28 28
 		{
29 29
 			$current_directory = dirname(__FILE__);
30 30
 			$current_directory = substr($current_directory, 0, -7);
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
 
53 53
 	private static function get_extension($type)
54 54
 	{
55
-		switch($type)
55
+		switch ($type)
56 56
 		{
57 57
 			case 'collector' :
58 58
 			case 'controller' :
@@ -104,18 +104,18 @@  discard block
 block discarded – undo
104 104
 
105 105
 	public static function load($type, $files, $data = array())
106 106
 	{
107
-		foreach((array) $files as $file)
107
+		foreach ((array) $files as $file)
108 108
 		{
109 109
 			$file_path = self::instance()->get_path($type, $file);
110
-			if(in_array($file_path, self::instance()->get_included_files()) && $type !== 'view')
110
+			if (in_array($file_path, self::instance()->get_included_files()) && $type !== 'view')
111 111
 				continue;
112 112
 			
113
-			if(!file_exists($file_path))
113
+			if (!file_exists($file_path))
114 114
 				Debugger::logMessage("Requested file does not exist: {$type}, {$file}");
115 115
 			
116 116
 			self::instance()->add_included_file($file_path);
117 117
 			
118
-			switch($type)
118
+			switch ($type)
119 119
 			{
120 120
 				case 'images' :
121 121
 				case 'scripts' :
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
 		
146 146
 		$reflectionObject = self::create_reflection_class($file);
147 147
 		
148
-		if(
148
+		if (
149 149
 			$reflectionObject->hasMethod('instance') &&
150 150
 			$reflectionObject->getMethod('instance')->isStatic())
151 151
 		{
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
 		
161 161
 		$reflectionObject = self::create_reflection_class($file);
162 162
 		
163
-		if($reflectionObject->hasMethod('__construct'))
163
+		if ($reflectionObject->hasMethod('__construct'))
164 164
 			return $reflectionObject->newInstanceArgs($data);
165 165
 		else
166 166
 			return $reflectionObject->newInstance();
Please login to merge, or discard this patch.
script/cron/generate-rss-feeds.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@
 block discarded – undo
18 18
  * @param string $folder
19 19
  * @return boolean
20 20
  */
21
-$buildFeed = function (Feed $feed, $folder) {
21
+$buildFeed = function(Feed $feed, $folder) {
22 22
     $tempFeed = __DIR__ . "/../../public/{$folder}/rss-new.xml";
23 23
     $finalFeed = __DIR__ . "/../../public/{$folder}/rss.xml";
24 24
 
Please login to merge, or discard this patch.
script/cron/generate-sitemaps.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
  * @param string $domain
17 17
  * @return boolean
18 18
  */
19
-$buildSitemap = function (array $entries, $domain, $folder) {
19
+$buildSitemap = function(array $entries, $domain, $folder) {
20 20
     $urlSet = new Urlset();
21 21
     foreach ($entries as $path => $entry) {
22 22
         $url = new Url("{$domain}{$path}"); // todo better detection of domain by env
@@ -43,13 +43,13 @@  discard block
 block discarded – undo
43 43
 /*********************************************
44 44
  * blog.jacobemerick.com
45 45
  *********************************************/
46
-$reduceToMostRecentBlogPost = function ($recentPost, $post) {
46
+$reduceToMostRecentBlogPost = function($recentPost, $post) {
47 47
     if (is_null($recentPost)) {
48 48
         return $post;
49 49
     }
50 50
     $postDate = new DateTime($post['date']);
51 51
     $recentPostDate = new DateTime($recentPost['date']);
52
-    return ($postDate > $recentPostDate) ? $post: $recentPost;
52
+    return ($postDate > $recentPostDate) ? $post : $recentPost;
53 53
 };
54 54
 
55 55
 $blogPostsPerPage = 10;
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
 ];
85 85
 
86 86
 foreach ($blogCategoryArray as $blogCategory) {
87
-    $blogCategoryPosts = array_filter($activeBlogPosts, function ($post) use ($blogCategory) {
87
+    $blogCategoryPosts = array_filter($activeBlogPosts, function($post) use ($blogCategory) {
88 88
         return $post['category'] == $blogCategory;
89 89
     });
90 90
     $mostRecentBlogCategoryPost = array_reduce($blogCategoryPosts, $reduceToMostRecentBlogPost);
Please login to merge, or discard this patch.
router/Router.class.inc.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -18,12 +18,12 @@  discard block
 block discarded – undo
18 18
 
19 19
 	private static function get_router_name()
20 20
 	{
21
-		if(Request::isAJAX())
21
+		if (Request::isAJAX())
22 22
 			return 'AJAXRouter';
23
-		if(URLDecode::getURI() == '/sitemap.xml')
23
+		if (URLDecode::getURI() == '/sitemap.xml')
24 24
 			return 'SitemapRouter';
25 25
 		
26
-		switch(URLDecode::getSite())
26
+		switch (URLDecode::getSite())
27 27
 		{
28 28
 			case 'ajax' :
29 29
 				return 'AjaxRouter';
@@ -68,36 +68,36 @@  discard block
 block discarded – undo
68 68
 
69 69
 	final protected function check_for_redirect($redirect_uri)
70 70
 	{
71
-		foreach($this->get_redirect_array() as $check)
71
+		foreach ($this->get_redirect_array() as $check)
72 72
 		{
73 73
 			$redirect_uri = preg_replace($check->pattern, $check->replace, $redirect_uri);
74 74
 		}
75 75
 		
76 76
 		$redirect_uri = $this->check_for_special_redirect($redirect_uri);
77 77
 		
78
-		if($this->requires_trailing_slash() && substr($redirect_uri, -1) != '/')
78
+		if ($this->requires_trailing_slash() && substr($redirect_uri, -1) != '/')
79 79
 			$redirect_uri .= '/';
80 80
 		
81 81
         if (URLDecode::getHost() == 'waterfalls.jacobemerick.com') {
82 82
             $redirect_uri = 'http://' . (!Loader::isLive() ? 'dev' : 'www') . '.waterfallsofthekeweenaw.com' . $redirect_uri;
83 83
         }
84 84
         
85
-		if($redirect_uri == URLDecode::getURI())
85
+		if ($redirect_uri == URLDecode::getURI())
86 86
 			return;
87 87
 		
88 88
 		$controller_check = $redirect_uri;
89
-		if(substr($redirect_uri, 0, 4) == 'http')
89
+		if (substr($redirect_uri, 0, 4) == 'http')
90 90
 			$controller_check = preg_replace('@^http://([a-z\.]+)@', '', $redirect_uri);
91 91
 		
92 92
 		$controller = $this->get_controller($controller_check);
93
-		if($controller == '/Error404Controller')
93
+		if ($controller == '/Error404Controller')
94 94
 		{
95 95
 			Loader::loadNew('controller', '/Error404Controller')
96 96
 				->activate();
97 97
 			exit;
98 98
 		}
99 99
 
100
-		if(substr($redirect_uri, 0, 4) != 'http')
100
+		if (substr($redirect_uri, 0, 4) != 'http')
101 101
 		{
102 102
 			$redirect_uri = substr($redirect_uri, 1);
103 103
 			$redirect_uri = URLDecode::getBase() . $redirect_uri;
@@ -114,12 +114,12 @@  discard block
 block discarded – undo
114 114
 
115 115
 	final private function get_controller($uri)
116 116
 	{
117
-		foreach($this->get_direct_array() as $check)
117
+		foreach ($this->get_direct_array() as $check)
118 118
 		{
119
-			if($uri == $check->match)
119
+			if ($uri == $check->match)
120 120
 				return "{$this->get_primary_folder()}/{$check->controller}";
121 121
 			
122
-			if(preg_match("@^{$check->match}$@", $uri))
122
+			if (preg_match("@^{$check->match}$@", $uri))
123 123
 				return "{$this->get_primary_folder()}/{$check->controller}";
124 124
 		}
125 125
 		
@@ -128,9 +128,9 @@  discard block
 block discarded – undo
128 128
 
129 129
 	final private function get_primary_folder()
130 130
 	{
131
-		if(Request::isAjax())
131
+		if (Request::isAjax())
132 132
 			return 'ajax';
133
-		if(URLDecode::getURI() == '/sitemap.xml')
133
+		if (URLDecode::getURI() == '/sitemap.xml')
134 134
 			return 'sitemap';
135 135
 		
136 136
 		return URLDecode::getSite();
Please login to merge, or discard this patch.