Completed
Push — master ( 5bed8f...b71929 )
by Jacob
04:00
created
utility/content/MarkupCodeContent.class.inc.php 1 patch
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -10,8 +10,9 @@
 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)
14
-			return;
13
+		if(count($matches[1]) == 0) {
14
+					return;
15
+		}
15 16
 		
16 17
 		foreach($matches[3] as $key => $match)
17 18
 		{
Please login to merge, or discard this patch.
utility/content/SmartTrimContent.class.inc.php 1 patch
Braces   +28 added lines, -22 removed lines patch added patch discarded remove patch
@@ -33,17 +33,19 @@  discard block
 block discarded – undo
33 33
 			return;
34 34
 		}
35 35
 		
36
-		if(count($args) == 2)
37
-			$etc = $args[1];
38
-		else
39
-			$etc = self::$ETC;
36
+		if(count($args) == 2) {
37
+					$etc = $args[1];
38
+		} else {
39
+					$etc = self::$ETC;
40
+		}
40 41
 		
41 42
 		$length = $args[0];
42 43
 		
43
-		if($length < strlen($this->content))
44
-			$this->trim_string($length);
45
-        else
46
-            $etc = '';
44
+		if($length < strlen($this->content)) {
45
+					$this->trim_string($length);
46
+		} else {
47
+                    $etc = '';
48
+        }
47 49
 		$this->check_exclude_tags();
48 50
 		$this->close_tags($etc);
49 51
 	}
@@ -54,8 +56,9 @@  discard block
 block discarded – undo
54 56
 		
55 57
 		$last_right_bracket_position = strripos($content, self::$RIGHT_BRACKET);
56 58
 		$last_left_bracket_position = strripos($content, self::$LEFT_BRACKET);
57
-		if($last_left_bracket_position > $last_right_bracket_position)
58
-			$content = substr($content, 0, $last_left_bracket_position);
59
+		if($last_left_bracket_position > $last_right_bracket_position) {
60
+					$content = substr($content, 0, $last_left_bracket_position);
61
+		}
59 62
 		$content = trim($content);
60 63
 		
61 64
 		$this->content = $content;
@@ -76,14 +79,16 @@  discard block
 block discarded – undo
76 79
 		foreach($matches[0] as $match)
77 80
 		{
78 81
 			$max_length += strlen($match[0]);
79
-			if($max_length <= $match[1])
80
-				break;
82
+			if($max_length <= $match[1]) {
83
+							break;
84
+			}
81 85
 			
82 86
 			$content = substr($content, 0, $match[1]) . $match[0] . substr($content, $match[1]);
83 87
 		}
84 88
 		
85
-		if(substr($content, -7) == '</p><p>')
86
-			$content = substr($content, 0, -7);
89
+		if(substr($content, -7) == '</p><p>') {
90
+					$content = substr($content, 0, -7);
91
+		}
87 92
 		
88 93
 		return $content;
89 94
 	}
@@ -118,9 +123,9 @@  discard block
 block discarded – undo
118 123
 			{
119 124
 				$key = array_search($tag, $open_tags);
120 125
 				unset($open_tags[$key]);
121
-			}
122
-			else
123
-				$open_tags[] = $tag;
126
+			} else {
127
+							$open_tags[] = $tag;
128
+			}
124 129
 		}
125 130
 		
126 131
 		$open_tags = array_reverse($open_tags);
@@ -128,13 +133,14 @@  discard block
 block discarded – undo
128 133
 		{
129 134
 			foreach($open_tags as $key => $open_tag)
130 135
 			{
131
-				if($key == count($open_tags) - 1)
132
-					$content .= $etc;
136
+				if($key == count($open_tags) - 1) {
137
+									$content .= $etc;
138
+				}
133 139
 				$content .= "</{$open_tag}>";
134 140
 			}
135
-		}
136
-		else
137
-			$content .= $etc;
141
+		} else {
142
+					$content .= $etc;
143
+		}
138 144
 		
139 145
 		$this->content = $content;
140 146
 	}
Please login to merge, or discard this patch.
utility/content/FixPhotoContent.class.inc.php 1 patch
Braces   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -37,8 +37,9 @@  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)
41
-			return '';
40
+		if($photo_result == false) {
41
+					return '';
42
+		}
42 43
 		
43 44
 		$height = $file_size[1];
44 45
 		$width = $file_size[0];
@@ -49,8 +50,9 @@  discard block
 block discarded – undo
49 50
         }
50 51
 		
51 52
 		$domain = '/';
52
-		if($is_absolute)
53
-			$domain = Loader::getRootUrl('blog');
53
+		if($is_absolute) {
54
+					$domain = Loader::getRootUrl('blog');
55
+		}
54 56
 		
55 57
 		return sprintf(self::$PHOTO_CONTENT, $domain, $category, $photo, $size, $height, $width, $description, $description);
56 58
 	}
Please login to merge, or discard this patch.
utility/content/ElapsedTimeContent.class.inc.php 1 patch
Braces   +59 added lines, -58 removed lines patch added patch discarded remove patch
@@ -10,64 +10,65 @@
 block discarded – undo
10 10
 		$previous_time = strtotime($this->content);
11 11
 		$current_time = time();
12 12
 		
13
-		if($current_time <= $previous_time)
14
-			$this->content = 'few seconds ago';
15
-		else if(($current_time - $previous_time) < 30)
16
-			$this->content = 'few seconds ago';
17
-		else if(($current_time - $previous_time) < 1.5 * 60)
18
-			$this->content = 'a minute ago';
19
-		else if(($current_time - $previous_time) < 4 * 60)
20
-			$this->content = 'few minutes ago';
21
-		else if(($current_time - $previous_time) < 7 * 60)
22
-			$this->content = 'five minutes ago';
23
-		else if(($current_time - $previous_time) < 12 * 60)
24
-			$this->content = 'ten minutes ago';
25
-		else if(($current_time - $previous_time) < 17 * 60)
26
-			$this->content = 'fifteen minutes ago';
27
-		else if(($current_time - $previous_time) < 22 * 60)
28
-			$this->content = 'twenty minutes ago';
29
-		else if(($current_time - $previous_time) < 37 * 60)
30
-			$this->content = 'half hour ago';
31
-		else if(($current_time - $previous_time) < 52 * 60)
32
-			$this->content = 'forty-five minutes ago';
33
-		else if(($current_time - $previous_time) < 1.5 * 60 * 60)
34
-			$this->content = 'an hour ago';
35
-		else if(($current_time - $previous_time) < 2.5 * 60 * 60)
36
-			$this->content = 'two hours ago';
37
-		else if(($current_time - $previous_time) < 3.5 * 60 * 60)
38
-			$this->content = 'three hours ago';
39
-		else if(($current_time - $previous_time) < 4.5 * 60 * 60)
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')
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')
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)
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')
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')
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)
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)
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))
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)
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)
60
-			$this->content = 'early last week';
61
-		else if(($current_time - $previous_time) < 3 * 7 * 24 * 60 * 60)
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))
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)
66
-			$this->content = 'last month';
67
-		else if(($current_time - $previous_time) < 4 * 4 * 7 * 24 * 60 * 60)
68
-			$this->content = 'several months ago';
69
-		else
70
-			$this->content = 'long ago';
13
+		if($current_time <= $previous_time) {
14
+					$this->content = 'few seconds ago';
15
+		} else if(($current_time - $previous_time) < 30) {
16
+					$this->content = 'few seconds ago';
17
+		} else if(($current_time - $previous_time) < 1.5 * 60) {
18
+					$this->content = 'a minute ago';
19
+		} else if(($current_time - $previous_time) < 4 * 60) {
20
+					$this->content = 'few minutes ago';
21
+		} else if(($current_time - $previous_time) < 7 * 60) {
22
+					$this->content = 'five minutes ago';
23
+		} else if(($current_time - $previous_time) < 12 * 60) {
24
+					$this->content = 'ten minutes ago';
25
+		} else if(($current_time - $previous_time) < 17 * 60) {
26
+					$this->content = 'fifteen minutes ago';
27
+		} else if(($current_time - $previous_time) < 22 * 60) {
28
+					$this->content = 'twenty minutes ago';
29
+		} else if(($current_time - $previous_time) < 37 * 60) {
30
+					$this->content = 'half hour ago';
31
+		} else if(($current_time - $previous_time) < 52 * 60) {
32
+					$this->content = 'forty-five minutes ago';
33
+		} else if(($current_time - $previous_time) < 1.5 * 60 * 60) {
34
+					$this->content = 'an hour ago';
35
+		} else if(($current_time - $previous_time) < 2.5 * 60 * 60) {
36
+					$this->content = 'two hours ago';
37
+		} else if(($current_time - $previous_time) < 3.5 * 60 * 60) {
38
+					$this->content = 'three hours ago';
39
+		} else if(($current_time - $previous_time) < 4.5 * 60 * 60) {
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') {
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') {
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) {
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') {
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') {
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) {
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) {
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)) {
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) {
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) {
60
+					$this->content = 'early last week';
61
+		} else if(($current_time - $previous_time) < 3 * 7 * 24 * 60 * 60) {
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)) {
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) {
66
+					$this->content = 'last month';
67
+		} else if(($current_time - $previous_time) < 4 * 4 * 7 * 24 * 60 * 60) {
68
+					$this->content = 'several months ago';
69
+		} else {
70
+					$this->content = 'long ago';
71
+		}
71 72
 	}
72 73
 
73 74
 }
74 75
\ No newline at end of file
Please login to merge, or discard this patch.
utility/content/CleanCommentContent.class.inc.php 1 patch
Braces   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -40,8 +40,9 @@  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)
44
-			return;
43
+		if($match_count < 1) {
44
+					return;
45
+		}
45 46
 		
46 47
 		foreach($matches as $match)
47 48
 		{
@@ -79,8 +80,9 @@  discard block
 block discarded – undo
79 80
 	{
80 81
 		$match_count = preg_match_all($pattern, $this->content, $matches, PREG_SET_ORDER);
81 82
 		
82
-		if($match_count < 1)
83
-			return;
83
+		if($match_count < 1) {
84
+					return;
85
+		}
84 86
 		
85 87
 		foreach($matches as $match)
86 88
 		{
Please login to merge, or discard this patch.
utility/Validate.class.inc.php 1 patch
Braces   +27 added lines, -18 removed lines patch added patch discarded remove patch
@@ -11,40 +11,47 @@  discard block
 block discarded – undo
11 11
 
12 12
 	public static function isBoolean($value, $strict = false)
13 13
 	{
14
-		if($strict && ($value === true || $value === false))
15
-			return true;
16
-		if(!$strict && ((bool) $value === true || (bool) $value === false))
17
-			return true;
14
+		if($strict && ($value === true || $value === false)) {
15
+					return true;
16
+		}
17
+		if(!$strict && ((bool) $value === true || (bool) $value === false)) {
18
+					return true;
19
+		}
18 20
 		return false;
19 21
 	}
20 22
 
21 23
 	public static function isDate($value)
22 24
 	{
23
-		if(strtotime($value) !== -1)
24
-			return true;
25
-		if(date('y', $value) !== false)
26
-			return true;
25
+		if(strtotime($value) !== -1) {
26
+					return true;
27
+		}
28
+		if(date('y', $value) !== false) {
29
+					return true;
30
+		}
27 31
 		return false;
28 32
 	}
29 33
 
30 34
 	public static function isInteger($value, $strict = false)
31 35
 	{
32
-		if($strict)
33
-			return is_int($value);
36
+		if($strict) {
37
+					return is_int($value);
38
+		}
34 39
 		return (int) $value == $value;
35 40
 	}
36 41
 
37 42
 	public static function isIP($value)
38 43
 	{
39
-		if(self::isInteger(ip2long($value)))
40
-			return true;
44
+		if(self::isInteger(ip2long($value))) {
45
+					return true;
46
+		}
41 47
 		return false;
42 48
 	}
43 49
 
44 50
 	public static function isString($value, $strict = false)
45 51
 	{
46
-		if($strict)
47
-			return is_string($value);
52
+		if($strict) {
53
+					return is_string($value);
54
+		}
48 55
 		return (string) $value == $value;
49 56
 	}
50 57
 
@@ -67,8 +74,9 @@  discard block
 block discarded – undo
67 74
 	private static function check_value($pattern, $string)
68 75
 	{
69 76
 		preg_match($pattern, $string, $matches);
70
-		if(empty($matches))
71
-			return false;
77
+		if(empty($matches)) {
78
+					return false;
79
+		}
72 80
 		return $matches[0] == $string;
73 81
 	}
74 82
 
@@ -84,8 +92,9 @@  discard block
 block discarded – undo
84 92
 			break;
85 93
 		}
86 94
 		
87
-		if($value == false)
88
-			return false;
95
+		if($value == false) {
96
+					return false;
97
+		}
89 98
 		
90 99
 		switch($validation)
91 100
 		{
Please login to merge, or discard this patch.
utility/Request.class.inc.php 1 patch
Braces   +12 added lines, -8 removed lines patch added patch discarded remove patch
@@ -20,8 +20,9 @@  discard block
 block discarded – undo
20 20
 	{
21 21
 		if($key)
22 22
 		{
23
-			if(isset(self::$server[$key]))
24
-				return self::$server[$key];
23
+			if(isset(self::$server[$key])) {
24
+							return self::$server[$key];
25
+			}
25 26
 			return false;
26 27
 		}
27 28
 		return self::$server;
@@ -29,8 +30,9 @@  discard block
 block discarded – undo
29 30
 
30 31
 	static function isAjax()
31 32
 	{
32
-		if(self::getServer(self::$AJAX_REQUEST))
33
-			return true;
33
+		if(self::getServer(self::$AJAX_REQUEST)) {
34
+					return true;
35
+		}
34 36
 		return false;
35 37
 	}
36 38
 
@@ -38,8 +40,9 @@  discard block
 block discarded – undo
38 40
 	{
39 41
 		if($key)
40 42
 		{
41
-			if(isset(self::$get[$key]))
42
-				return self::$get[$key];
43
+			if(isset(self::$get[$key])) {
44
+							return self::$get[$key];
45
+			}
43 46
 			return false;
44 47
 		}
45 48
 		return self::$get;
@@ -49,8 +52,9 @@  discard block
 block discarded – undo
49 52
 	{
50 53
 		if($key)
51 54
 		{
52
-			if(isset(self::$post[$key]))
53
-				return self::$post[$key];
55
+			if(isset(self::$post[$key])) {
56
+							return self::$post[$key];
57
+			}
54 58
 			return false;
55 59
 		}
56 60
 		return self::$post;
Please login to merge, or discard this patch.
controller/lifestream/DefaultListController.class.inc.php 1 patch
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -60,8 +60,9 @@
 block discarded – undo
60 60
 		{
61 61
 			$post_array[] = $this->format_post($post, true);
62 62
 		}
63
-		if(count($post_array) < 1 && URLDecode::getPiece(1) !== 'search')
64
-			$this->eject();
63
+		if(count($post_array) < 1 && URLDecode::getPiece(1) !== 'search') {
64
+					$this->eject();
65
+		}
65 66
 		return $post_array;
66 67
 	}
67 68
 
Please login to merge, or discard this patch.
controller/home/ContactController.class.inc.php 1 patch
Braces   +12 added lines, -8 removed lines patch added patch discarded remove patch
@@ -33,17 +33,21 @@
 block discarded – undo
33 33
 
34 34
 	private function process_form()
35 35
 	{
36
-		if(!Request::hasPost() || Request::getPost('submit') != 'Send Message!')
37
-			return (object) array('display' => 'normal');
36
+		if(!Request::hasPost() || Request::getPost('submit') != 'Send Message!') {
37
+					return (object) array('display' => 'normal');
38
+		}
38 39
 		
39 40
 		Loader::load('utility', 'Validate');
40 41
 		$error_result = array();
41
-		if(!Validate::checkRequest('post', 'name', 'string'))
42
-			$error_result['name'] = 'please enter your name';
43
-		if(!Validate::checkRequest('post', 'email', 'string'))
44
-			$error_result['email'] = 'please enter a valid email';
45
-		if(!Validate::checkRequest('post', 'message', 'string'))
46
-			$error_result['message'] = 'please write a message';
42
+		if(!Validate::checkRequest('post', 'name', 'string')) {
43
+					$error_result['name'] = 'please enter your name';
44
+		}
45
+		if(!Validate::checkRequest('post', 'email', 'string')) {
46
+					$error_result['email'] = 'please enter a valid email';
47
+		}
48
+		if(!Validate::checkRequest('post', 'message', 'string')) {
49
+					$error_result['message'] = 'please write a message';
50
+		}
47 51
 		
48 52
 		$values = (object) array(
49 53
 			'name' => Request::getPost('name'),
Please login to merge, or discard this patch.