Completed
Push — master ( 34318d...75f992 )
by Jacob
03:35
created
utility/cookie/CommenterCookie.class.inc.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -6,8 +6,8 @@
 block discarded – undo
6 6
 {
7 7
 
8 8
 	private static $COOKIE_NAME			= 'commenter';
9
-	private static $COOKIE_DURATION		= 31536000; // one year
10
-	private static $COOKIE_DOMAIN		= 'jacobemerick.com';
9
+	private static $COOKIE_DURATION = 31536000; // one year
10
+	private static $COOKIE_DOMAIN = 'jacobemerick.com';
11 11
 	private static $COOKIE_PATH			= '/';
12 12
 
13 13
 	protected function getName()
Please login to merge, or discard this patch.
utility/cron/BlogCron.class.inc.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -22,13 +22,13 @@
 block discarded – undo
22 22
 
23 23
 	public function activate()
24 24
 	{
25
-		foreach($this->post_array as $post)
25
+		foreach ($this->post_array as $post)
26 26
 		{
27 27
 			$blog_result = BlogCollector::getBlogByTitle($post->title);
28
-			if($blog_result !== null)
28
+			if ($blog_result !== null)
29 29
 			{
30 30
 				$comments = CommentCollector::getCommentCountForURL(2, $post->path);
31
-				if($blog_result->comments != $comments)
31
+				if ($blog_result->comments != $comments)
32 32
 				{
33 33
 					$query = sprintf(self::$UPDATE_COMMENTS_QUERY, $comments, $blog_result->id);
34 34
 					Database::execute($query);
Please login to merge, or discard this patch.
utility/cron/BookCron.class.inc.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -19,12 +19,12 @@  discard block
 block discarded – undo
19 19
 
20 20
 	public function activate()
21 21
 	{
22
-		if(!$this->xml)
22
+		if (!$this->xml)
23 23
 			return $this->error('Could not connect to feed.');
24 24
 		
25
-		foreach($this->xml->channel->item as $item)
25
+		foreach ($this->xml->channel->item as $item)
26 26
 		{
27
-			if(strtotime($item->user_read_at) <= 0)
27
+			if (strtotime($item->user_read_at) <= 0)
28 28
 				continue;
29 29
 			
30 30
 			$title = $item->title;
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
 			$date_added = date('Y-m-d H:i:s', strtotime($item->user_date_created));
43 43
 			
44 44
 			$book_result = BookCollector::getBookByFields($title, $author);
45
-			if($book_result !== null)
45
+			if ($book_result !== null)
46 46
 				continue;
47 47
 			
48 48
 			$query = sprintf(self::$QUERY, $title, $author, $link, $description, $image, $date_read, $date_added);
Please login to merge, or discard this patch.
utility/cron/ChangelogCron.class.inc.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -16,16 +16,16 @@  discard block
 block discarded – undo
16 16
 	public function activate()
17 17
 	{
18 18
 		$loop_count = 0;
19
-		for($loop_count = 0; $loop_count < self::$MAXIMUM_LOOP_COUNT; $loop_count++)
19
+		for ($loop_count = 0; $loop_count < self::$MAXIMUM_LOOP_COUNT; $loop_count++)
20 20
 		{
21 21
 			$changeset_to_check = $this->get_changeset_to_check();
22 22
 			$data = $this->get_changeset_page_data($changeset_to_check);
23 23
 			
24
-			if(!isset($data))
24
+			if (!isset($data))
25 25
 				break;
26 26
 			
27 27
 			$this->save_changeset_data($data);
28
-			if($loop_count > 20)
28
+			if ($loop_count > 20)
29 29
 				exit;
30 30
 		}
31 31
 		
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
 	{
54 54
 		$changeset = ChangelogCollector::getMostRecentChange();
55 55
 		
56
-		if($changeset === null)
56
+		if ($changeset === null)
57 57
 			return 1;
58 58
 		
59 59
 		$number = $changeset->number;
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
 		$changeset_page = $this->get_changeset_page($page);
67 67
 		
68 68
 		preg_match('@<h1>(.+)</h1>@', $changeset_page, $match);
69
-		if(stristr($match[1], 'Error: Invalid Changeset Number') !== false)
69
+		if (stristr($match[1], 'Error: Invalid Changeset Number') !== false)
70 70
 			return;
71 71
 		
72 72
 		preg_match('@<h1>Changeset (\d+)</h1>@', $changeset_page, $match);
Please login to merge, or discard this patch.
utility/cron/DistanceCron.class.inc.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -20,11 +20,11 @@  discard block
 block discarded – undo
20 20
 
21 21
 	public function activate()
22 22
 	{
23
-		if(!$this->json)
23
+		if (!$this->json)
24 24
 			return $this->error('Could not connect to feed.');
25 25
 		
26 26
 		$count = 0;
27
-		foreach($this->json->entries as $entry)
27
+		foreach ($this->json->entries as $entry)
28 28
 		{
29 29
 			$type = $entry->workout->activity_type;
30 30
 			$type = strtolower($type);
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
 			$date = date('Y-m-d H:i:s', strtotime($entry->at));
42 42
 			
43 43
 			$distance_result = DistanceCollector::getDistanceByFields($date, $type, $distance);
44
-			if($distance_result !== null)
44
+			if ($distance_result !== null)
45 45
 				continue;
46 46
 			
47 47
 			$query = sprintf(self::$QUERY, $type, $distance, $url, $felt, $title, $message, $date);
Please login to merge, or discard this patch.
utility/cron/ErrorCron.class.inc.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -13,23 +13,23 @@  discard block
 block discarded – undo
13 13
 
14 14
 	function __construct()
15 15
 	{
16
-		if(Loader::isLive())
16
+		if (Loader::isLive())
17 17
 			$handle[] = self::$live_root;
18 18
 		else
19 19
 			$handle[] = self::$test_root;
20 20
 		
21 21
 		$i = 0;
22
-		while(isset($handle[$i]))
22
+		while (isset($handle[$i]))
23 23
 		{
24 24
 			$path = $handle[$i];
25 25
 			$fh = opendir($path);
26
-			while(false !== ($file = readdir($fh)))
26
+			while (false !== ($file = readdir($fh)))
27 27
 			{
28
-				if($file != '.' && $file != '..')
28
+				if ($file != '.' && $file != '..')
29 29
 				{
30
-					if(is_dir("{$path}/{$file}"))
30
+					if (is_dir("{$path}/{$file}"))
31 31
 						$handle[] = "{$path}/{$file}";
32
-					if($file == 'error.log')
32
+					if ($file == 'error.log')
33 33
 						$this->error_files[] = "{$path}/{$file}";
34 34
 				}
35 35
 			}
@@ -42,10 +42,10 @@  discard block
 block discarded – undo
42 42
 	{
43 43
 		$message = '';
44 44
 		
45
-		if(count($this->error_files) > 0)
45
+		if (count($this->error_files) > 0)
46 46
 		{
47 47
 			$message .= "Errors from flat-file logs.\n\n";
48
-			foreach($this->error_files as $error_file)
48
+			foreach ($this->error_files as $error_file)
49 49
 			{
50 50
 				$contents = file_get_contents($error_file);
51 51
 				$message .= "{$error_file}\n{$contents}\n\n";
@@ -60,9 +60,9 @@  discard block
 block discarded – undo
60 60
 		$mail->setMessage($message);
61 61
 		$mail->send();
62 62
 		
63
-		if(count($this->error_files) > 0)
63
+		if (count($this->error_files) > 0)
64 64
 		{
65
-			foreach($this->error_files as $error_file)
65
+			foreach ($this->error_files as $error_file)
66 66
 			{
67 67
 			//	if(file_exists($error_file))
68 68
 			//		unlink($error_file);
Please login to merge, or discard this patch.
utility/cron/HuluCron.class.inc.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -20,28 +20,28 @@  discard block
 block discarded – undo
20 20
 
21 21
 	public function activate()
22 22
 	{
23
-		if(!$this->xml)
23
+		if (!$this->xml)
24 24
 			return $this->error('Could not connect to feed.');
25 25
 		
26 26
 		$count = 0;
27
-		foreach($this->xml->channel->item as $item)
27
+		foreach ($this->xml->channel->item as $item)
28 28
 		{
29 29
 			$date = date('Y-m-d H:i:s', strtotime($item->pubDate));
30 30
 			
31
-			if(preg_match_all('/((rated)|(wrote a review about)|(subscribed to)|(watched) )(.+)/', $item->title, $title_array) > 0)
31
+			if (preg_match_all('/((rated)|(wrote a review about)|(subscribed to)|(watched) )(.+)/', $item->title, $title_array) > 0)
32 32
 			{
33 33
 				$video = array_pop($title_array);
34 34
 				$video = current($video);
35 35
 				$video = substr($video, 0, -1);
36 36
 			}
37
-			else if(preg_match_all('/(.*) - (s\d+) | (e\d+) - (.*)/', $item->title, $title_array) > 0)
37
+			else if (preg_match_all('/(.*) - (s\d+) | (e\d+) - (.*)/', $item->title, $title_array) > 0)
38 38
 				$video = "{$title_array[1][0]}: {$title_array[4][1]}";
39 39
 			else
40 40
 				$video = $item->title;
41 41
 			
42 42
 			$url = $item->link;
43 43
 			
44
-			if($item->category == 'Vote')
44
+			if ($item->category == 'Vote')
45 45
 			{
46 46
 				$description = stristr($video, 'and gave it');
47 47
 				$description = substr($description, 12);
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
 			else
54 54
 				$description = '';
55 55
 			
56
-			switch($item->category)
56
+			switch ($item->category)
57 57
 			{
58 58
 				case 'ActivityViewedVideo' :
59 59
 					$action = 1;
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
 			}
74 74
 			
75 75
 			$hulu_result = HuluCollector::getHuluByFields($video, $action);
76
-			if($hulu_result !== null)
76
+			if ($hulu_result !== null)
77 77
 				continue;
78 78
 			
79 79
 			$display = (
Please login to merge, or discard this patch.
utility/cron/StreamCron.class.inc.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -61,10 +61,10 @@  discard block
 block discarded – undo
61 61
 
62 62
 	private function remove_existing($result, $type)
63 63
 	{
64
-		foreach($result as $key => $row)
64
+		foreach ($result as $key => $row)
65 65
 		{
66 66
 			$stream_result = ActivityCollector::getPostByFields($row->id, $type);
67
-			if($stream_result)
67
+			if ($stream_result)
68 68
 				unset($result[$key]);
69 69
 		}
70 70
 		return $result;
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
 
73 73
 	private function add_posts($result, $type)
74 74
 	{
75
-		foreach($result as $row)
75
+		foreach ($result as $row)
76 76
 		{
77 77
 			$query = sprintf(self::$QUERY, $type, $row->id, $row->date);
78 78
 			Database::execute($query);
Please login to merge, or discard this patch.
utility/cron/TwitterCron.class.inc.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
 	private $oauth_array;
84 84
 	private function get_oauth_array()
85 85
 	{
86
-		if(!isset($this->oauth_array))
86
+		if (!isset($this->oauth_array))
87 87
 		{
88 88
 			$this->oauth_array = array(
89 89
 				'screen_name' => self::$SCREEN_NAME,
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
 	{
117 117
 		$encoded_array = array();
118 118
 		ksort($array);
119
-		foreach($array as $key => $value)
119
+		foreach ($array as $key => $value)
120 120
 		{
121 121
 			$value = rawurlencode($value);
122 122
 			$value = ($wrap_values) ? '"' . $value . '"' : $value;
@@ -127,27 +127,27 @@  discard block
 block discarded – undo
127 127
 
128 128
 	public function activate()
129 129
 	{
130
-		if(!$this->json)
130
+		if (!$this->json)
131 131
 			return $this->error('Could not connect to twitter json feed.');
132 132
 		
133 133
 		$count = 0;
134
-		foreach($this->json as $status)
134
+		foreach ($this->json as $status)
135 135
 		{
136 136
 			$text = Database::escape($status->text);
137 137
 			$date = date('Y-m-d H:i:s', strtotime($status->created_at));
138 138
 			
139 139
 			$tweet_result = TwitterCollector::getTweetByFields($date, $text);
140
-			if($tweet_result !== null)
140
+			if ($tweet_result !== null)
141 141
 			{
142 142
 				$favorites = (int) $status->favorite_count;
143
-				if($favorites != 0 && $tweet_result->favorites != $favorites)
143
+				if ($favorites != 0 && $tweet_result->favorites != $favorites)
144 144
 				{
145 145
 					$query = sprintf(self::$UPDATE_FAVORITES_QUERY, $favorites, $tweet_result->id);
146 146
 					Database::execute($query);
147 147
 				}
148 148
 				
149 149
 				$retweets = (int) $status->retweet_count;
150
-				if($retweets != 0 && $tweet_result->retweets != $retweets)
150
+				if ($retweets != 0 && $tweet_result->retweets != $retweets)
151 151
 				{
152 152
 					$query = sprintf(self::$UPDATE_RETWEETS_QUERY, $retweets, $tweet_result->id);
153 153
 					Database::execute($query);
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
 			{
158 158
 				$twitter_id = (string) $status->id_str;
159 159
 				
160
-				if(isset($status->retweeted_status))
160
+				if (isset($status->retweeted_status))
161 161
 				{
162 162
 					$text_formatted = $this->get_formatted($status->retweeted_status->text, $status->retweeted_status->entities);
163 163
 					$text_formatted_full = $this->get_formatted($status->retweeted_status->text, $status->retweeted_status->entities, 'full');
@@ -200,9 +200,9 @@  discard block
 block discarded – undo
200 200
 
201 201
 	private function get_source($source)
202 202
 	{
203
-		if(stristr($source, 'tweetdeck'))
203
+		if (stristr($source, 'tweetdeck'))
204 204
 			return 'tweetdeck';
205
-		if(stristr($source, 'windows phone'))
205
+		if (stristr($source, 'windows phone'))
206 206
 			return 'phone';
207 207
 		else
208 208
 			return '';
@@ -211,9 +211,9 @@  discard block
 block discarded – undo
211 211
 	private function get_formatted($text, $entities, $type = 'short')
212 212
 	{
213 213
 		$holder = array();
214
-		foreach($entities as $entity_type => $entity_collection)
214
+		foreach ($entities as $entity_type => $entity_collection)
215 215
 		{
216
-			foreach($entity_collection as $entity)
216
+			foreach ($entity_collection as $entity)
217 217
 			{
218 218
 				$start = $entity->indices[0];
219 219
 				$end = $entity->indices[1];
@@ -228,7 +228,7 @@  discard block
 block discarded – undo
228 228
 		
229 229
 		krsort($holder);
230 230
 		
231
-		foreach($holder as $entity)
231
+		foreach ($holder as $entity)
232 232
 		{
233 233
 			$text = mb_substr($text, 0, $entity->start, 'UTF-8') . $entity->replace . mb_substr($text, $entity->end, 5000, 'UTF-8');
234 234
 		}
@@ -241,7 +241,7 @@  discard block
 block discarded – undo
241 241
 
242 242
 	private function get_replace_text($entity_type, $entity, $type)
243 243
 	{
244
-		switch($entity_type)
244
+		switch ($entity_type)
245 245
 		{
246 246
 			case 'hashtags' :
247 247
 				$replace = sprintf(self::$HASHTAG_LINK, $entity->text);
@@ -253,7 +253,7 @@  discard block
 block discarded – undo
253 253
 				$replace = sprintf(self::$USER_MENTION_LINK, $entity->screen_name, $entity->name);
254 254
 				break;
255 255
 			case 'media' :
256
-				if($type == 'full')
256
+				if ($type == 'full')
257 257
 					$replace = sprintf(self::$MEDIA_LINK, $entity->url, $entity->display_url, $entity->media_url, 'large', 'Photo from Twitter', $entity->sizes->large->h, $entity->sizes->large->w);
258 258
 				else
259 259
 					$replace = sprintf(self::$URL_LINK, $entity->url, $entity->expanded_url, $entity->display_url);
Please login to merge, or discard this patch.