Completed
Branch master (de1ee7)
by Jacob
05:01
created
utility/content/AcceptableContent.class.inc.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -9,9 +9,9 @@  discard block
 block discarded – undo
9 9
 	protected function execute()
10 10
 	{
11 11
 		$is_acceptable = true;
12
-		foreach($this->getUnacceptableWords() as $unacceptableWord)
12
+		foreach ($this->getUnacceptableWords() as $unacceptableWord)
13 13
 		{
14
-			if(stristr($unacceptableWord->word, $this->content))
14
+			if (stristr($unacceptableWord->word, $this->content))
15 15
 				$is_acceptable = false;
16 16
 		}
17 17
 		return $is_acceptable;
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
 	private $unacceptableWords;
21 21
 	private function getUnacceptableWords()
22 22
 	{
23
-		if(!$this->unacceptableWords)
23
+		if (!$this->unacceptableWords)
24 24
 			$this->unacceptableWords = UnacceptableWordCollector::getWords();
25 25
 		return $this->unacceptableWords;
26 26
 	}
Please login to merge, or discard this patch.
utility/content/AutolinkTwitterHashContent.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 AutolinkTwitterHash!');
21 21
 			return;
@@ -23,10 +23,10 @@  discard block
 block discarded – undo
23 23
 		$parameters = array_shift($parameters);
24 24
 		
25 25
 		$found_hash = preg_match_all(self::$HASH_PATTERN, $this->content, $matches, PREG_SET_ORDER);
26
-		if($found_hash === false || $found_hash === 0)
26
+		if ($found_hash === false || $found_hash === 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/content/AutolinkTwitterURLContent.class.inc.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -10,11 +10,11 @@  discard block
 block discarded – undo
10 10
 
11 11
 	protected function execute()
12 12
 	{
13
-		if(stristr($this->content, 'http') === false)
13
+		if (stristr($this->content, 'http') === false)
14 14
 			return;
15 15
 		
16 16
 		$parameters = func_get_args();
17
-		if(count($parameters) > 1 || (count($parameters) == 1 && !is_array($parameters[0])))
17
+		if (count($parameters) > 1 || (count($parameters) == 1 && !is_array($parameters[0])))
18 18
 		{
19 19
 			trigger_error('Unexpected parameters passed into AutolinkTwitterURL!');
20 20
 			return;
@@ -22,10 +22,10 @@  discard block
 block discarded – undo
22 22
 		$parameters = array_shift($parameters);
23 23
 		
24 24
 		$found_link = preg_match_all(self::$LINK_PATTERN, $this->content, $matches, PREG_SET_ORDER);
25
-		if($found_link === false || $found_link === 0)
25
+		if ($found_link === false || $found_link === 0)
26 26
 			return;
27 27
 		
28
-		foreach($matches as $match)
28
+		foreach ($matches as $match)
29 29
 		{
30 30
 			$parameters['href'] = $match[0];
31 31
 			$display_url = $this->get_display_url($match);
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
 	{
42 42
 		$display_url = $this->check_for_redirect($match[0]);
43 43
 		
44
-		if(strlen($display_url) > (self::$DISPLAY_URL_LENGTH - 2))
44
+		if (strlen($display_url) > (self::$DISPLAY_URL_LENGTH - 2))
45 45
 		{
46 46
 			$display_url = substr($display_url, 0, self::$DISPLAY_URL_LENGTH);
47 47
 			$display_url .= '...';
@@ -53,12 +53,12 @@  discard block
 block discarded – undo
53 53
 	private function get_replacement_link($parameters, $display_url)
54 54
 	{
55 55
 		$link = '<a';
56
-		foreach($parameters as $attribute => $value)
56
+		foreach ($parameters as $attribute => $value)
57 57
 		{
58 58
 			$link .= ' ';
59 59
 			$link .= $attribute;
60 60
 			$link .= '=';
61
-			$link .= '"' . $value .'"';
61
+			$link .= '"' . $value . '"';
62 62
 		}
63 63
 		$link .= '>';
64 64
 		$link .= $display_url;
@@ -70,14 +70,14 @@  discard block
 block discarded – undo
70 70
 	private function check_for_redirect($url)
71 71
 	{
72 72
 		$headers = @get_headers($url);
73
-		if($headers === false)
73
+		if ($headers === false)
74 74
 			$headers = $this->get_headers($url);
75 75
 		
76
-		if(stristr($headers[0], '301') !== false || stristr($headers[0], '302') !== false)
76
+		if (stristr($headers[0], '301') !== false || stristr($headers[0], '302') !== false)
77 77
 		{
78
-			foreach($headers as $header)
78
+			foreach ($headers as $header)
79 79
 			{
80
-				if(substr($header, 0, 9) == 'Location:')
80
+				if (substr($header, 0, 9) == 'Location:')
81 81
 					break;
82 82
 			}
83 83
 			
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/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/ElapsedTimeContent.class.inc.php 1 patch
Spacing   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -10,61 +10,61 @@
 block discarded – undo
10 10
 		$previous_time = strtotime($this->content);
11 11
 		$current_time = time();
12 12
 		
13
-		if($current_time <= $previous_time)
13
+		if ($current_time <= $previous_time)
14 14
 			$this->content = 'few seconds ago';
15
-		else if(($current_time - $previous_time) < 30)
15
+		else if (($current_time - $previous_time) < 30)
16 16
 			$this->content = 'few seconds ago';
17
-		else if(($current_time - $previous_time) < 1.5 * 60)
17
+		else if (($current_time - $previous_time) < 1.5 * 60)
18 18
 			$this->content = 'a minute ago';
19
-		else if(($current_time - $previous_time) < 4 * 60)
19
+		else if (($current_time - $previous_time) < 4 * 60)
20 20
 			$this->content = 'few minutes ago';
21
-		else if(($current_time - $previous_time) < 7 * 60)
21
+		else if (($current_time - $previous_time) < 7 * 60)
22 22
 			$this->content = 'five minutes ago';
23
-		else if(($current_time - $previous_time) < 12 * 60)
23
+		else if (($current_time - $previous_time) < 12 * 60)
24 24
 			$this->content = 'ten minutes ago';
25
-		else if(($current_time - $previous_time) < 17 * 60)
25
+		else if (($current_time - $previous_time) < 17 * 60)
26 26
 			$this->content = 'fifteen minutes ago';
27
-		else if(($current_time - $previous_time) < 22 * 60)
27
+		else if (($current_time - $previous_time) < 22 * 60)
28 28
 			$this->content = 'twenty minutes ago';
29
-		else if(($current_time - $previous_time) < 37 * 60)
29
+		else if (($current_time - $previous_time) < 37 * 60)
30 30
 			$this->content = 'half hour ago';
31
-		else if(($current_time - $previous_time) < 52 * 60)
31
+		else if (($current_time - $previous_time) < 52 * 60)
32 32
 			$this->content = 'forty-five minutes ago';
33
-		else if(($current_time - $previous_time) < 1.5 * 60 * 60)
33
+		else if (($current_time - $previous_time) < 1.5 * 60 * 60)
34 34
 			$this->content = 'an hour ago';
35
-		else if(($current_time - $previous_time) < 2.5 * 60 * 60)
35
+		else if (($current_time - $previous_time) < 2.5 * 60 * 60)
36 36
 			$this->content = 'two hours ago';
37
-		else if(($current_time - $previous_time) < 3.5 * 60 * 60)
37
+		else if (($current_time - $previous_time) < 3.5 * 60 * 60)
38 38
 			$this->content = 'three hours ago';
39
-		else if(($current_time - $previous_time) < 4.5 * 60 * 60)
39
+		else if (($current_time - $previous_time) < 4.5 * 60 * 60)
40 40
 			$this->content = 'few hours ago';
41
-		else if(($current_time - $previous_time) < 1 * 24 * 60 * 60 && date('j', $current_time) == date('j', $previous_time) && date('a', $previous_time) == 'pm')
41
+		else if (($current_time - $previous_time) < 1 * 24 * 60 * 60 && date('j', $current_time) == date('j', $previous_time) && date('a', $previous_time) == 'pm')
42 42
 			$this->content = 'this afternoon';
43
-		else if(($current_time - $previous_time) < 1 * 24 * 60 * 60 && date('j', $current_time) == date('j', $previous_time) && date('a', $previous_time) == 'am')
43
+		else if (($current_time - $previous_time) < 1 * 24 * 60 * 60 && date('j', $current_time) == date('j', $previous_time) && date('a', $previous_time) == 'am')
44 44
 			$this->content = 'this morning';
45
-		else if(($current_time - $previous_time) < 2 * 24 * 60 * 60 && date('j', $current_time) == date('j', $previous_time) + 1 && date('a', $previous_time) == 'pm' && date('G', $previous_time) >= 17)
45
+		else if (($current_time - $previous_time) < 2 * 24 * 60 * 60 && date('j', $current_time) == date('j', $previous_time) + 1 && date('a', $previous_time) == 'pm' && date('G', $previous_time) >= 17)
46 46
 			$this->content = 'yesterday evening';
47
-		else if(($current_time - $previous_time) < 2 * 24 * 60 * 60 && date('j', $current_time) == date('j', $previous_time) + 1 && date('a', $previous_time) == 'pm')
47
+		else if (($current_time - $previous_time) < 2 * 24 * 60 * 60 && date('j', $current_time) == date('j', $previous_time) + 1 && date('a', $previous_time) == 'pm')
48 48
 			$this->content = 'yesterday afternoon';
49
-		else if(($current_time - $previous_time) < 2 * 24 * 60 * 60 && date('j', $current_time) == date('j', $previous_time) + 1 && date('a', $previous_time) == 'am')
49
+		else if (($current_time - $previous_time) < 2 * 24 * 60 * 60 && date('j', $current_time) == date('j', $previous_time) + 1 && date('a', $previous_time) == 'am')
50 50
 			$this->content = 'yesterday morning';
51
-		else if(($current_time - $previous_time) < 3 * 24 * 60 * 60 && date('j', $current_time) == date('j', $previous_time) + 2)
51
+		else if (($current_time - $previous_time) < 3 * 24 * 60 * 60 && date('j', $current_time) == date('j', $previous_time) + 2)
52 52
 			$this->content = 'two days ago';
53
-		else if(($current_time - $previous_time) < 4 * 24 * 60 * 60 && date('j', $current_time) == date('j', $previous_time) + 3)
53
+		else if (($current_time - $previous_time) < 4 * 24 * 60 * 60 && date('j', $current_time) == date('j', $previous_time) + 3)
54 54
 			$this->content = 'three days ago';
55
-		else if(($current_time - $previous_time) < 1 * 7 * 24 * 60 * 60 && date('W', $current_time) == date('W', $previous_time))
55
+		else if (($current_time - $previous_time) < 1 * 7 * 24 * 60 * 60 && date('W', $current_time) == date('W', $previous_time))
56 56
 			$this->content = 'earlier this week';
57
-		else if(($current_time - $previous_time) < 2 * 7 * 24 * 60 * 60 && date('W', $current_time) == date('W', $previous_time) + 1 && date('w', $previous_time) >= 3)
57
+		else if (($current_time - $previous_time) < 2 * 7 * 24 * 60 * 60 && date('W', $current_time) == date('W', $previous_time) + 1 && date('w', $previous_time) >= 3)
58 58
 			$this->content = 'late last week';
59
-		else if(($current_time - $previous_time) < 2 * 7 * 24 * 60 * 60 && date('W', $current_time) == date('W', $previous_time) + 1)
59
+		else if (($current_time - $previous_time) < 2 * 7 * 24 * 60 * 60 && date('W', $current_time) == date('W', $previous_time) + 1)
60 60
 			$this->content = 'early last week';
61
-		else if(($current_time - $previous_time) < 3 * 7 * 24 * 60 * 60)
61
+		else if (($current_time - $previous_time) < 3 * 7 * 24 * 60 * 60)
62 62
 			$this->content = 'few weeks ago';
63
-		else if(($current_time - $previous_time) < 1.25* 4 * 7 * 24 * 60 * 60 && date('n', $current_time) == date('n', $previous_time))
63
+		else if (($current_time - $previous_time) < 1.25 * 4 * 7 * 24 * 60 * 60 && date('n', $current_time) == date('n', $previous_time))
64 64
 			$this->content = 'earlier this month';
65
-		else if(($current_time - $previous_time) < 2 * 4 * 7 * 24 * 60 * 60 && date('n', $current_time) == date('n', $previous_time) + 1)
65
+		else if (($current_time - $previous_time) < 2 * 4 * 7 * 24 * 60 * 60 && date('n', $current_time) == date('n', $previous_time) + 1)
66 66
 			$this->content = 'last month';
67
-		else if(($current_time - $previous_time) < 4 * 4 * 7 * 24 * 60 * 60)
67
+		else if (($current_time - $previous_time) < 4 * 4 * 7 * 24 * 60 * 60)
68 68
 			$this->content = 'several months ago';
69 69
 		else
70 70
 			$this->content = 'long ago';
Please login to merge, or discard this patch.
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/FixImageContent.class.inc.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@
 block discarded – undo
10 10
 	protected function execute($is_absolute = false)
11 11
 	{
12 12
 		preg_match_all(self::$IMAGE_PLACEHOLDER_MATCH, $this->content, $matches);
13
-		foreach($matches[1] as $key => $match)
13
+		foreach ($matches[1] as $key => $match)
14 14
 		{
15 15
 			$image_path = $this->get_file_path($match);
16 16
 			$this->content = str_replace($matches[0][$key], $image_path, $this->content);
Please login to merge, or discard this patch.
utility/content/FixInternalLinkContent.class.inc.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -12,9 +12,9 @@  discard block
 block discarded – undo
12 12
 	protected function execute($is_absolute = true)
13 13
 	{
14 14
 		preg_match_all(self::$LINK_PLACEHOLDER_MATCH, $this->content, $matches);
15
-		foreach($matches[1] as $key => $match)
15
+		foreach ($matches[1] as $key => $match)
16 16
 		{
17
-			if(isset($matches[3][$key]))
17
+			if (isset($matches[3][$key]))
18 18
 				$link_content = $this->get_link($match, $is_absolute, $matches[3][$key]);
19 19
 			else
20 20
 				$link_content = $this->get_link($match, $is_absolute);
@@ -29,19 +29,19 @@  discard block
 block discarded – undo
29 29
 		
30 30
 		$link = '';
31 31
 		
32
-		switch($type)
32
+		switch ($type)
33 33
 		{
34 34
 			case 'blog' :
35 35
 				Loader::load('collector', 'blog/PostCollector');
36 36
 				$post = PostCollector::getPostByURI($uri);
37 37
 				
38
-				if($post === NULL)
38
+				if ($post === NULL)
39 39
 					return;
40 40
 				
41 41
 				$link .= ($is_absolute) ? Loader::getRootURL('blog') : '/';
42 42
 				$link .= "{$post->category}/{$post->path}/";
43 43
 				
44
-				if($anchor == '')
44
+				if ($anchor == '')
45 45
 					$anchor = $post->title;
46 46
 				
47 47
 				break;
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
 				$link .= ($is_absolute) ? Loader::getRootURL('blog') : '/';
50 50
 				$link .= "tag/{$uri}/";
51 51
 				
52
-				if($anchor == '')
52
+				if ($anchor == '')
53 53
 				{
54 54
 					$anchor = $uri;
55 55
 					$anchor = str_replace('-', ' ', $anchor);
@@ -61,13 +61,13 @@  discard block
 block discarded – undo
61 61
 				Loader::load('collector', 'waterfall/LogCollector');
62 62
 				$log = LogCollector::getByAlias($uri);
63 63
 				
64
-				if($log === NULL)
64
+				if ($log === NULL)
65 65
 					return;
66 66
 				
67 67
 				$link .= ($is_absolute) ? Loader::getRootURL('waterfalls') : '/';
68 68
 				$link .= "journal/{$log->alias}/";
69 69
 				
70
-				if($anchor == '')
70
+				if ($anchor == '')
71 71
 					$anchor = $log->title;
72 72
 				
73 73
 				break;
Please login to merge, or discard this patch.