Completed
Push — master ( c330e2...cf0c7a )
by Jacob
03:58
created
utility/content/MarkupCodeContent.class.inc.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -10,10 +10,10 @@  discard block
 block discarded – undo
10 10
 	protected function execute($title = '')
11 11
 	{
12 12
 		preg_match_all(self::$MARKUP_DELIMITER, $this->content, $matches);
13
-		if(count($matches[1]) == 0)
13
+		if (count($matches[1]) == 0)
14 14
 			return;
15 15
 		
16
-		foreach($matches[3] as $key => $match)
16
+		foreach ($matches[3] as $key => $match)
17 17
 		{
18 18
 			$replacement = $match;
19 19
 			$replacement = $this->wrap_in_list($replacement);
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
 	{
30 30
 		$content_array = explode("\n", $content);
31 31
 		
32
-		foreach($content_array as $key => $row)
32
+		foreach ($content_array as $key => $row)
33 33
 		{
34 34
 			$new_row = ($key % 2 == 0) ? '<li class="even">' : '<li class="odd">';
35 35
 			$new_row .= '<p>';
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
 
47 47
 	private function highlight_code($content, $type)
48 48
 	{
49
-		switch($type)
49
+		switch ($type)
50 50
 		{
51 51
 			default :
52 52
 				return $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.
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/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/SmartTrimContent.class.inc.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -27,20 +27,20 @@  discard block
 block discarded – undo
27 27
 	protected function execute()
28 28
 	{
29 29
 		$args = func_get_args();
30
-		if(count($args) < 1)
30
+		if (count($args) < 1)
31 31
 		{
32 32
 			trigger_error('Someone called SmartTrimContent w/o defining a length... bad!');
33 33
 			return;
34 34
 		}
35 35
 		
36
-		if(count($args) == 2)
36
+		if (count($args) == 2)
37 37
 			$etc = $args[1];
38 38
 		else
39 39
 			$etc = self::$ETC;
40 40
 		
41 41
 		$length = $args[0];
42 42
 		
43
-		if($length < strlen($this->content))
43
+		if ($length < strlen($this->content))
44 44
 			$this->trim_string($length);
45 45
         else
46 46
             $etc = '';
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
 		
55 55
 		$last_right_bracket_position = strripos($content, self::$RIGHT_BRACKET);
56 56
 		$last_left_bracket_position = strripos($content, self::$LEFT_BRACKET);
57
-		if($last_left_bracket_position > $last_right_bracket_position)
57
+		if ($last_left_bracket_position > $last_right_bracket_position)
58 58
 			$content = substr($content, 0, $last_left_bracket_position);
59 59
 		$content = trim($content);
60 60
 		
@@ -73,16 +73,16 @@  discard block
 block discarded – undo
73 73
 		$content = current($content);
74 74
 		
75 75
 		$max_length = $length;
76
-		foreach($matches[0] as $match)
76
+		foreach ($matches[0] as $match)
77 77
 		{
78 78
 			$max_length += strlen($match[0]);
79
-			if($max_length <= $match[1])
79
+			if ($max_length <= $match[1])
80 80
 				break;
81 81
 			
82 82
 			$content = substr($content, 0, $match[1]) . $match[0] . substr($content, $match[1]);
83 83
 		}
84 84
 		
85
-		if(substr($content, -7) == '</p><p>')
85
+		if (substr($content, -7) == '</p><p>')
86 86
 			$content = substr($content, 0, -7);
87 87
 		
88 88
 		return $content;
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
 		$tags_preg = $this->get_tags_preg(self::$EXCLUDE_TAGS);
95 95
 		preg_match_all($tags_preg, $content, $matches, PREG_OFFSET_CAPTURE);
96 96
 		
97
-		if(count($matches[1]) % 2 == 1)
97
+		if (count($matches[1]) % 2 == 1)
98 98
 		{
99 99
 			$cut_tag = end($matches[1]);
100 100
 			$cut_tag_position = $cut_tag[1] - 1;
@@ -112,9 +112,9 @@  discard block
 block discarded – undo
112 112
 		preg_match_all($tags_preg, $content, $matches);
113 113
 		$open_tags = array();
114 114
 		
115
-		foreach($matches[1] as $tag)
115
+		foreach ($matches[1] as $tag)
116 116
 		{
117
-			if(in_array($tag, $open_tags))
117
+			if (in_array($tag, $open_tags))
118 118
 			{
119 119
 				$key = array_search($tag, $open_tags);
120 120
 				unset($open_tags[$key]);
@@ -124,11 +124,11 @@  discard block
 block discarded – undo
124 124
 		}
125 125
 		
126 126
 		$open_tags = array_reverse($open_tags);
127
-		if(count($open_tags) > 0)
127
+		if (count($open_tags) > 0)
128 128
 		{
129
-			foreach($open_tags as $key => $open_tag)
129
+			foreach ($open_tags as $key => $open_tag)
130 130
 			{
131
-				if($key == count($open_tags) - 1)
131
+				if ($key == count($open_tags) - 1)
132 132
 					$content .= $etc;
133 133
 				$content .= "</{$open_tag}>";
134 134
 			}
Please login to merge, or discard this patch.
utility/content/FixUnacceptableCharacterContent.class.inc.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -11,9 +11,9 @@
 block discarded – undo
11 11
 
12 12
 	protected function execute()
13 13
 	{
14
-		foreach(self::$UNACCEPTABLE_CHARACTER_ARRAY as $match => $replace)
14
+		foreach (self::$UNACCEPTABLE_CHARACTER_ARRAY as $match => $replace)
15 15
 		{
16
-			if(stristr($this->content, $match))
16
+			if (stristr($this->content, $match))
17 17
 				$this->content = str_replace($match, $replace, $this->content);
18 18
 		}
19 19
 		return;
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/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/FixPhotoContent.class.inc.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
 	protected function execute($is_absolute = false, $size = 'medium')
13 13
 	{
14 14
 		preg_match_all(self::$PHOTO_PLACEHOLDER_MATCH, $this->content, $matches);
15
-		foreach($matches[1] as $key => $match)
15
+		foreach ($matches[1] as $key => $match)
16 16
 		{
17 17
 			$photo_content = $this->get_photo_content($match, $size, $is_absolute);
18 18
 			$this->content = str_replace($matches[0][$key], $photo_content, $this->content);
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 		
38 38
 		Loader::load('collector', 'image/PhotoCollector');
39 39
 		$photo_result = PhotoCollector::fetchRow($category, $photo);
40
-		if($photo_result == false)
40
+		if ($photo_result == false)
41 41
 			return '';
42 42
 		
43 43
 		$height = $file_size[1];
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
         }
50 50
 		
51 51
 		$domain = '/';
52
-		if($is_absolute)
52
+		if ($is_absolute)
53 53
 			$domain = Loader::getRootUrl('blog');
54 54
 		
55 55
 		return sprintf(self::$PHOTO_CONTENT, $domain, $category, $photo, $size, $height, $width, $description, $description);
Please login to merge, or discard this patch.