Completed
Push — master ( c330e2...cf0c7a )
by Jacob
03:58
created
utility/content/FetchFirstPhotoContent.class.inc.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
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)
14
+		if (preg_match(self::$PHOTO_PLACEHOLDER_MATCH, $this->content, $match) === 1)
15 15
 			$this->content = $this->get_thumb($match[1], $is_absolute, $size);
16 16
 		else
17 17
 			$this->content = self::$DEFAULT_RETURN;
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
 		
35 35
 		Loader::load('collector', 'image/PhotoCollector');
36 36
 		$photo_result = PhotoCollector::fetchRow($category, $photo);
37
-		if($photo_result == false)
37
+		if ($photo_result == false)
38 38
 			return '';
39 39
 		
40 40
 		$height = $file_size[1];
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
 		$description = $photo_result->description;
43 43
 		
44 44
 		$domain = '/';
45
-		if($is_absolute)
45
+		if ($is_absolute)
46 46
 			$domain = Loader::getRootUrl();
47 47
 		
48 48
 		return sprintf(self::$IMAGE_NODE, $domain, $category, $photo, $size, $extension, $height, $width, $description);
Please login to merge, or discard this patch.
utility/content/CleanCommentContent.class.inc.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -40,10 +40,10 @@  discard block
 block discarded – undo
40 40
 	{
41 41
 		$match_count = preg_match_all($pattern, $this->content, $matches, PREG_SET_ORDER);
42 42
 		
43
-		if($match_count < 1)
43
+		if ($match_count < 1)
44 44
 			return;
45 45
 		
46
-		foreach($matches as $match)
46
+		foreach ($matches as $match)
47 47
 		{
48 48
 			$full_match = array_shift($match);
49 49
 			$placeholder = $this->create_placeholder($full_match);
@@ -79,10 +79,10 @@  discard block
 block discarded – undo
79 79
 	{
80 80
 		$match_count = preg_match_all($pattern, $this->content, $matches, PREG_SET_ORDER);
81 81
 		
82
-		if($match_count < 1)
82
+		if ($match_count < 1)
83 83
 			return;
84 84
 		
85
-		foreach($matches as $match)
85
+		foreach ($matches as $match)
86 86
 		{
87 87
 			$full_match = array_shift($match);
88 88
 			$full_match_pattern = $this->create_full_match_pattern($full_match);
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
 
100 100
 	private function replace_element_patterns()
101 101
 	{
102
-		foreach($this->replacement_array as $key => $replace)
102
+		foreach ($this->replacement_array as $key => $replace)
103 103
 		{
104 104
 			$this->content = str_replace($key, $replace, $this->content);
105 105
 		}
Please login to merge, or discard this patch.
utility/content/AutolinkTwitterUserContent.class.inc.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -10,12 +10,12 @@  discard block
 block discarded – undo
10 10
 
11 11
 	protected function execute()
12 12
 	{
13
-		if(stristr($this->content, '@') === false)
13
+		if (stristr($this->content, '@') === false)
14 14
 			return;
15 15
 		
16 16
 		// yeah yeah, i'm currently ignoring the link, whatevs
17 17
 		$parameters = func_get_args();
18
-		if(count($parameters) > 1 || (count($parameters) == 1 && !is_array($parameters[0])))
18
+		if (count($parameters) > 1 || (count($parameters) == 1 && !is_array($parameters[0])))
19 19
 		{
20 20
 			trigger_error('Unexpected parameters passed into AutolinkTwitterUser!');
21 21
 			return;
@@ -23,10 +23,10 @@  discard block
 block discarded – undo
23 23
 		$parameters = array_shift($parameters);
24 24
 		
25 25
 		$found_user = preg_match_all(self::$USER_PATTERN, $this->content, $matches, PREG_SET_ORDER);
26
-		if($found_user === false || $found_user === 0)
26
+		if ($found_user === false || $found_user === 0)
27 27
 			return;
28 28
 		
29
-		foreach($matches as $match)
29
+		foreach ($matches as $match)
30 30
 		{
31 31
 			$replacement = $this->get_replacement_link($match[1], $match[0]);
32 32
 			$this->content = str_replace($match[0], $replacement, $this->content);
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/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.
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/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/YouTubeCron.class.inc.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -20,18 +20,18 @@
 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 youtube xml feed.');
25 25
 		
26 26
 		$count = 0;
27
-		foreach($this->xml->entry as $entry)
27
+		foreach ($this->xml->entry as $entry)
28 28
 		{
29 29
 			$video_id = $entry->id;
30 30
 			$video_id = explode('/', $video_id);
31 31
 			$video_id = array_pop($video_id);
32 32
 			
33 33
 			$video_exists = YouTubeCollector::checkForVideoByVideoID($video_id);
34
-			if($video_exists)
34
+			if ($video_exists)
35 35
 				continue;
36 36
 			
37 37
 			$title = Database::escape($entry->title);
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.