Completed
Push — master ( bf05f4...1e9202 )
by Jacob
04:21
created
collector/comment/CommentCollector.class.inc.php 4 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -83,6 +83,9 @@
 block discarded – undo
83 83
 		return self::run_query($query);
84 84
 	}
85 85
 
86
+	/**
87
+	 * @param integer $count
88
+	 */
86 89
 	public static function getRecentBlogComments($count)
87 90
 	{
88 91
 		$query = "
Please login to merge, or discard this patch.
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -114,9 +114,9 @@  discard block
 block discarded – undo
114 114
 		return self::run_query($query);
115 115
 	}
116 116
 
117
-    public static function getRecentWaterfallComments($count = 5)
118
-    {
119
-        $query = "
117
+	public static function getRecentWaterfallComments($count = 5)
118
+	{
119
+		$query = "
120 120
             SELECT
121 121
                 `comment_meta`.`id`,
122 122
                 CONCAT('journal/', `log`.`alias`) AS `log_path`,
@@ -156,8 +156,8 @@  discard block
 block discarded – undo
156 156
                 `comment_meta`.`date` DESC
157 157
             LIMIT {$count}";
158 158
         
159
-        return self::run_query($query);
160
-    }
159
+		return self::run_query($query);
160
+	}
161 161
 
162 162
 	public static function getCommentsForURL($site, $path, $commenter = 0)
163 163
 	{
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -163,7 +163,7 @@
 block discarded – undo
163 163
 	{
164 164
 		$path = self::escape($path);
165 165
 		
166
-		if($commenter != 0)
166
+		if ($commenter != 0)
167 167
 			$trusted_commenter_clause = "(`commenter`.`trusted` = '1' || `commenter`.`id` = '{$commenter}')";
168 168
 		else
169 169
 			$trusted_commenter_clause = "`commenter`.`trusted` = '1'";
Please login to merge, or discard this patch.
Braces   +5 added lines, -4 removed lines patch added patch discarded remove patch
@@ -163,10 +163,11 @@
 block discarded – undo
163 163
 	{
164 164
 		$path = self::escape($path);
165 165
 		
166
-		if($commenter != 0)
167
-			$trusted_commenter_clause = "(`commenter`.`trusted` = '1' || `commenter`.`id` = '{$commenter}')";
168
-		else
169
-			$trusted_commenter_clause = "`commenter`.`trusted` = '1'";
166
+		if($commenter != 0) {
167
+					$trusted_commenter_clause = "(`commenter`.`trusted` = '1' || `commenter`.`id` = '{$commenter}')";
168
+		} else {
169
+					$trusted_commenter_clause = "`commenter`.`trusted` = '1'";
170
+		}
170 171
 		
171 172
 		$query = "
172 173
 			SELECT
Please login to merge, or discard this patch.
collector/waterfall/LogCollector.class.inc.php 2 patches
Doc Comments   +6 added lines patch added patch discarded remove patch
@@ -34,6 +34,9 @@  discard block
 block discarded – undo
34 34
 		return self::run_query($query);
35 35
 	}
36 36
 
37
+    /**
38
+     * @param integer $total
39
+     */
37 40
     public static function getRecentList($total)
38 41
     {
39 42
         $query = "
@@ -178,6 +181,9 @@  discard block
 block discarded – undo
178 181
 		return self::run_row_query($query);
179 182
 	}
180 183
 
184
+    /**
185
+     * @param string $date
186
+     */
181 187
     public static function getByDate($date)
182 188
     {
183 189
         $date = self::escape($date);
Please login to merge, or discard this patch.
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -34,9 +34,9 @@  discard block
 block discarded – undo
34 34
 		return self::run_query($query);
35 35
 	}
36 36
 
37
-    public static function getRecentList($total)
38
-    {
39
-        $query = "
37
+	public static function getRecentList($total)
38
+	{
39
+		$query = "
40 40
             SELECT
41 41
                 `log`.`title`,
42 42
                 `log`.`alias`,
@@ -59,8 +59,8 @@  discard block
 block discarded – undo
59 59
                 `log`.`date` DESC
60 60
             LIMIT
61 61
                 {$total}";
62
-        return self::run_query($query);
63
-    }
62
+		return self::run_query($query);
63
+	}
64 64
 
65 65
 	public static function getListCount()
66 66
 	{
@@ -178,11 +178,11 @@  discard block
 block discarded – undo
178 178
 		return self::run_row_query($query);
179 179
 	}
180 180
 
181
-    public static function getByDate($date)
182
-    {
183
-        $date = self::escape($date);
181
+	public static function getByDate($date)
182
+	{
183
+		$date = self::escape($date);
184 184
         
185
-        $query = "
185
+		$query = "
186 186
             SELECT
187 187
                 `log`.`alias`
188 188
             FROM
@@ -192,8 +192,8 @@  discard block
 block discarded – undo
192 192
                 `log`.`is_public` = '1'
193 193
             LIMIT 1";
194 194
         
195
-        return self::run_row_query($query);
196
-    }
195
+		return self::run_row_query($query);
196
+	}
197 197
 	
198 198
 	public static function getById($log)
199 199
 	{
Please login to merge, or discard this patch.
collector/waterfall/WaterfallCollector.class.inc.php 2 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -117,6 +117,9 @@
 block discarded – undo
117 117
         return self::run_query($query);
118 118
     }
119 119
 
120
+    /**
121
+     * @param string $alias
122
+     */
120 123
     public static function getByOldAlias($alias)
121 124
     {
122 125
         $alias = self::escape($alias);
Please login to merge, or discard this patch.
Indentation   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -43,9 +43,9 @@  discard block
 block discarded – undo
43 43
 		return self::run_query($query);
44 44
 	}
45 45
 
46
-    public static function getMapList()
47
-    {
48
-        $query = "
46
+	public static function getMapList()
47
+	{
48
+		$query = "
49 49
             SELECT
50 50
                 `waterfall`.`name`,
51 51
                 `waterfall`.`alias`,
@@ -71,8 +71,8 @@  discard block
 block discarded – undo
71 71
             ORDER BY
72 72
                 `waterfall`.`name`";
73 73
         
74
-        return self::run_query($query);
75
-    }
74
+		return self::run_query($query);
75
+	}
76 76
 
77 77
 	public static function getListCount()
78 78
 	{
@@ -92,9 +92,9 @@  discard block
 block discarded – undo
92 92
 		return self::get_count($query);
93 93
 	}
94 94
 
95
-    public static function getNearbyList($waterfall)
96
-    {
97
-        $query = "
95
+	public static function getNearbyList($waterfall)
96
+	{
97
+		$query = "
98 98
             SELECT
99 99
                 `waterfall`.`name`,
100 100
                 `waterfall`.`alias` AS `alias`,
@@ -114,14 +114,14 @@  discard block
 block discarded – undo
114 114
                 `waterfall`.`name`,
115 115
                 `watercourse`.`name`";
116 116
         
117
-        return self::run_query($query);
118
-    }
117
+		return self::run_query($query);
118
+	}
119 119
 
120
-    public static function getByOldAlias($alias)
121
-    {
122
-        $alias = self::escape($alias);
120
+	public static function getByOldAlias($alias)
121
+	{
122
+		$alias = self::escape($alias);
123 123
         
124
-        $query = "
124
+		$query = "
125 125
             SELECT
126 126
                 `waterfall`.`alias`,
127 127
                 `watercourse`.`alias` AS `watercourse_alias`
@@ -134,8 +134,8 @@  discard block
 block discarded – undo
134 134
                 `waterfall`.`is_public` = '1'
135 135
             LIMIT 1";
136 136
         
137
-        return self::run_row_query($query);
138
-    }
137
+		return self::run_row_query($query);
138
+	}
139 139
 
140 140
 	public static function getByAlias($watercourse, $waterfall)
141 141
 	{
Please login to merge, or discard this patch.
controller/blog/DefaultPageController.class.inc.php 4 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -97,6 +97,9 @@
 block discarded – undo
97 97
 		return $tag_array;
98 98
 	}
99 99
 
100
+	/**
101
+	 * @param boolean $trim
102
+	 */
100 103
 	final private function get_body_for_post($post, $trim)
101 104
 	{
102 105
 		$body = $post->body;
Please login to merge, or discard this patch.
Braces   +12 added lines, -8 removed lines patch added patch discarded remove patch
@@ -41,8 +41,9 @@  discard block
 block discarded – undo
41 41
 		Loader::load('collector', 'image/PhotoCollector');
42 42
 		$photo_result = PhotoCollector::getRow($id);
43 43
 		
44
-		if($photo_result == null)
45
-			return;
44
+		if($photo_result == null) {
45
+					return;
46
+		}
46 47
 		
47 48
 		$name = $photo_result->name;
48 49
 		$category = $photo_result->category;
@@ -106,8 +107,9 @@  discard block
 block discarded – undo
106 107
 	{
107 108
 		$body = $post['body'];
108 109
 		
109
-		if($trim)
110
-			$body = Content::instance('SmartTrim', $body)->activate(self::$LENGTH_OF_TRIMMED_POST);
110
+		if($trim) {
111
+					$body = Content::instance('SmartTrim', $body)->activate(self::$LENGTH_OF_TRIMMED_POST);
112
+		}
111 113
 		
112 114
 		$body = Content::instance('FixPhoto', $body)->activate(false, 'standard');
113 115
 		$body = Content::instance('MarkupCode', $body)->activate();
@@ -134,8 +136,9 @@  discard block
 block discarded – undo
134 136
 		$cloud_array = array();
135 137
 		foreach($tag_result as $tag)
136 138
 		{
137
-			if($tag['count'] < self::$MINIMUM_TAG_COUNT)
138
-				continue;
139
+			if($tag['count'] < self::$MINIMUM_TAG_COUNT) {
140
+							continue;
141
+			}
139 142
 			
140 143
 			$tag_object = new stdclass();
141 144
 			$tag_object->name = $tag['tag'];
@@ -153,8 +156,9 @@  discard block
 block discarded – undo
153 156
 		
154 157
 		foreach($tag_result as $tag)
155 158
 		{
156
-			if($tag['count'] > $maximum)
157
-				$maximum = $tag['count'];
159
+			if($tag['count'] > $maximum) {
160
+							$maximum = $tag['count'];
161
+			}
158 162
 		}
159 163
 		return $maximum;
160 164
 	}
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
 		Loader::load('collector', 'image/PhotoCollector');
42 42
 		$photo_result = PhotoCollector::getRow($id);
43 43
 		
44
-		if($photo_result == null)
44
+		if ($photo_result == null)
45 45
 			return;
46 46
 		
47 47
 		$name = $photo_result->name;
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
         $tag_result = $repository->getTagsForPost($post['id']);
93 93
 
94 94
         $tag_array = array();
95
-		foreach($tag_result as $tag)
95
+		foreach ($tag_result as $tag)
96 96
 		{
97 97
 			$tag_object = new stdclass();
98 98
 			$tag_object->name = $tag['tag'];
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
 	{
107 107
 		$body = $post['body'];
108 108
 		
109
-		if($trim)
109
+		if ($trim)
110 110
 			$body = Content::instance('SmartTrim', $body)->activate(self::$LENGTH_OF_TRIMMED_POST);
111 111
 		
112 112
 		$body = Content::instance('FixPhoto', $body)->activate(false, 'standard');
@@ -132,9 +132,9 @@  discard block
 block discarded – undo
132 132
 		$maximum_tag_count = $this->get_maximum_tag_count($tag_result);
133 133
 		
134 134
 		$cloud_array = array();
135
-		foreach($tag_result as $tag)
135
+		foreach ($tag_result as $tag)
136 136
 		{
137
-			if($tag['count'] < self::$MINIMUM_TAG_COUNT)
137
+			if ($tag['count'] < self::$MINIMUM_TAG_COUNT)
138 138
 				continue;
139 139
 			
140 140
 			$tag_object = new stdclass();
@@ -151,9 +151,9 @@  discard block
 block discarded – undo
151 151
 	{
152 152
 		$maximum = 1;
153 153
 		
154
-		foreach($tag_result as $tag)
154
+		foreach ($tag_result as $tag)
155 155
 		{
156
-			if($tag['count'] > $maximum)
156
+			if ($tag['count'] > $maximum)
157 157
 				$maximum = $tag['count'];
158 158
 		}
159 159
 		return $maximum;
@@ -164,7 +164,7 @@  discard block
 block discarded – undo
164 164
 		$comment_array = CommentCollector::getRecentBlogComments(self::$RECENT_COMMENT_COUNT);
165 165
 		
166 166
 		$array = array();
167
-		foreach($comment_array as $comment)
167
+		foreach ($comment_array as $comment)
168 168
 		{
169 169
 			$body = $comment->body;
170 170
 			$body = strip_tags($body);
@@ -172,7 +172,7 @@  discard block
 block discarded – undo
172 172
 			$comment_obj = new stdclass();
173 173
 			$comment_obj->description = Content::instance('SmartTrim', $body)->activate(30);
174 174
 			$comment_obj->commenter = $comment->name;
175
-			$comment_obj->link = Loader::getRootURL() . "{$comment->category}/{$comment->path}/#comment-{$comment->id}";
175
+			$comment_obj->link = Loader::getRootURL()."{$comment->category}/{$comment->path}/#comment-{$comment->id}";
176 176
 			$array[] = $comment_obj;
177 177
 		}
178 178
 
@@ -201,7 +201,7 @@  discard block
 block discarded – undo
201 201
         $comment_response = $api->getComments(1, self::$RECENT_COMMENT_COUNT, '-date', 'blog.jacobemerick.com');
202 202
 
203 203
         $array = array();
204
-        foreach($comment_response as $comment)
204
+        foreach ($comment_response as $comment)
205 205
         {
206 206
             $body = $comment->getBody();
207 207
             $body = strip_tags($body);
Please login to merge, or discard this patch.
Indentation   +108 added lines, -108 removed lines patch added patch discarded remove patch
@@ -18,14 +18,14 @@  discard block
 block discarded – undo
18 18
 
19 19
 	protected function set_head_data()
20 20
 	{
21
-    $this->set_head('rss_link', [
22
-      'title' => 'Jacob Emerick Blog Feed',
23
-      'url' => '/rss.xml'
24
-    ]);
25
-    $this->set_head('rss_comment_link', [
26
-      'title' => 'Jacob Emerick Blog Comment Feed',
27
-      'url' => '/rss-comments.xml'
28
-    ]);
21
+	$this->set_head('rss_link', [
22
+	  'title' => 'Jacob Emerick Blog Feed',
23
+	  'url' => '/rss.xml'
24
+	]);
25
+	$this->set_head('rss_comment_link', [
26
+	  'title' => 'Jacob Emerick Blog Comment Feed',
27
+	  'url' => '/rss-comments.xml'
28
+	]);
29 29
 		
30 30
 		$this->add_css('normalize');
31 31
 		$this->add_css('blog');
@@ -83,57 +83,57 @@  discard block
 block discarded – undo
83 83
 	final private function get_comments_for_post($post)
84 84
 	{
85 85
 		$count = CommentCollector::getCommentCountForURL(self::$BLOG_SITE_ID, $post['path']);
86
-    $count_from_service = $this->get_comments_for_post_from_service($post);
87
-
88
-    if ($count_from_service !== null && $count_from_service != $count) {
89
-        global $container;
90
-        $container['console']->log('Mismatch between comment service and legacy db');
91
-        $container['console']->log("{$count}, {$count_from_service} in service");
92
-    }
93
-    return $count;
86
+	$count_from_service = $this->get_comments_for_post_from_service($post);
87
+
88
+	if ($count_from_service !== null && $count_from_service != $count) {
89
+		global $container;
90
+		$container['console']->log('Mismatch between comment service and legacy db');
91
+		$container['console']->log("{$count}, {$count_from_service} in service");
92
+	}
93
+	return $count;
94 94
 	}
95 95
 
96
-    final private function get_comments_for_post_from_service($post)
97
-    {
98
-        global $config;
99
-        $configuration = new Jacobemerick\CommentService\Configuration();
100
-        $configuration->setUsername($config->comments->user);
101
-        $configuration->setPassword($config->comments->password);
102
-        $configuration->addDefaultHeader('Content-Type', 'application/json');
103
-        $configuration->setHost($config->comments->host);
104
-        $configuration->setCurlTimeout($config->comments->timeout);
105
-
106
-        $client = new Jacobemerick\CommentService\ApiClient($configuration);
107
-        $api = new Jacobemerick\CommentService\Api\DefaultApi($client);
108
-
109
-        $start = microtime(true);
110
-        try {
111
-            $comment_response = $api->getComments(
112
-                null,
113
-                null,
114
-                null,
115
-                'blog.jacobemerick.com',
116
-                "{$post['category']}/{$post['path']}"
117
-            );
118
-        } catch (Exception $e) {
119
-            global $container;
120
-            $container['logger']->warning("CommentService | Comment Count | {$e->getMessage()}");
121
-            return;
122
-        }
123
-        $elapsed = microtime(true) - $start;
124
-        global $container;
125
-        $container['logger']->info("CommentService | Comment Count | {$elapsed}");
126
-
127
-        return count($comment_response);
128
-    }
96
+	final private function get_comments_for_post_from_service($post)
97
+	{
98
+		global $config;
99
+		$configuration = new Jacobemerick\CommentService\Configuration();
100
+		$configuration->setUsername($config->comments->user);
101
+		$configuration->setPassword($config->comments->password);
102
+		$configuration->addDefaultHeader('Content-Type', 'application/json');
103
+		$configuration->setHost($config->comments->host);
104
+		$configuration->setCurlTimeout($config->comments->timeout);
105
+
106
+		$client = new Jacobemerick\CommentService\ApiClient($configuration);
107
+		$api = new Jacobemerick\CommentService\Api\DefaultApi($client);
108
+
109
+		$start = microtime(true);
110
+		try {
111
+			$comment_response = $api->getComments(
112
+				null,
113
+				null,
114
+				null,
115
+				'blog.jacobemerick.com',
116
+				"{$post['category']}/{$post['path']}"
117
+			);
118
+		} catch (Exception $e) {
119
+			global $container;
120
+			$container['logger']->warning("CommentService | Comment Count | {$e->getMessage()}");
121
+			return;
122
+		}
123
+		$elapsed = microtime(true) - $start;
124
+		global $container;
125
+		$container['logger']->info("CommentService | Comment Count | {$elapsed}");
126
+
127
+		return count($comment_response);
128
+	}
129 129
 
130 130
 	final private function get_tags_for_post($post)
131 131
 	{
132
-        global $container;
133
-        $repository = new Jacobemerick\Web\Domain\Blog\Tag\MysqlTagRepository($container['db_connection_locator']);
134
-        $tag_result = $repository->getTagsForPost($post['id']);
132
+		global $container;
133
+		$repository = new Jacobemerick\Web\Domain\Blog\Tag\MysqlTagRepository($container['db_connection_locator']);
134
+		$tag_result = $repository->getTagsForPost($post['id']);
135 135
 
136
-        $tag_array = array();
136
+		$tag_array = array();
137 137
 		foreach($tag_result as $tag)
138 138
 		{
139 139
 			$tag_object = new stdclass();
@@ -167,9 +167,9 @@  discard block
 block discarded – undo
167 167
 
168 168
 	final private function get_tag_cloud()
169 169
 	{
170
-        global $container;
171
-        $repository = new Jacobemerick\Web\Domain\Blog\Tag\MysqlTagRepository($container['db_connection_locator']);
172
-        $tag_result = $repository->getTagCloud();
170
+		global $container;
171
+		$repository = new Jacobemerick\Web\Domain\Blog\Tag\MysqlTagRepository($container['db_connection_locator']);
172
+		$tag_result = $repository->getTagCloud();
173 173
 		
174 174
 		$maximum_tag_count = $this->get_maximum_tag_count($tag_result);
175 175
 		
@@ -218,61 +218,61 @@  discard block
 block discarded – undo
218 218
 			$array[] = $comment_obj;
219 219
 		}
220 220
 
221
-    $comment_service_array = $this->get_comments_from_service();
222
-    if ($comment_service_array !== null && $comment_service_array !== $array) {
223
-      global $container;
224
-      $container['console']->log('Mismatch between comment service and legacy db');
225
-      $container['console']->log($comment_service_array[0]);
226
-      $container['console']->log($array[0]);
227
-    }
221
+	$comment_service_array = $this->get_comments_from_service();
222
+	if ($comment_service_array !== null && $comment_service_array !== $array) {
223
+	  global $container;
224
+	  $container['console']->log('Mismatch between comment service and legacy db');
225
+	  $container['console']->log($comment_service_array[0]);
226
+	  $container['console']->log($array[0]);
227
+	}
228 228
 		return $array;
229 229
 	}
230 230
 
231
-    final private function get_comments_from_service()
232
-    {
233
-        global $config;
234
-        $configuration = new Jacobemerick\CommentService\Configuration();
235
-        $configuration->setUsername($config->comments->user);
236
-        $configuration->setPassword($config->comments->password);
237
-        $configuration->addDefaultHeader('Content-Type', 'application/json');
238
-        $configuration->setHost($config->comments->host);
239
-        $configuration->setCurlTimeout($config->comments->timeout);
240
-
241
-        $client = new Jacobemerick\CommentService\ApiClient($configuration);
242
-        $api = new Jacobemerick\CommentService\Api\DefaultApi($client);
243
-
244
-        $start = microtime(true);
245
-        try {
246
-            $comment_response = $api->getComments(
247
-                1,
248
-                self::$RECENT_COMMENT_COUNT,
249
-                '-date',
250
-                'blog.jacobemerick.com'
251
-            );
252
-        } catch (Exception $e) {
253
-            global $container;
254
-            $container['logger']->warning("CommentService | Sidebar | {$e->getMessage()}");
255
-            return;
256
-        }
231
+	final private function get_comments_from_service()
232
+	{
233
+		global $config;
234
+		$configuration = new Jacobemerick\CommentService\Configuration();
235
+		$configuration->setUsername($config->comments->user);
236
+		$configuration->setPassword($config->comments->password);
237
+		$configuration->addDefaultHeader('Content-Type', 'application/json');
238
+		$configuration->setHost($config->comments->host);
239
+		$configuration->setCurlTimeout($config->comments->timeout);
240
+
241
+		$client = new Jacobemerick\CommentService\ApiClient($configuration);
242
+		$api = new Jacobemerick\CommentService\Api\DefaultApi($client);
243
+
244
+		$start = microtime(true);
245
+		try {
246
+			$comment_response = $api->getComments(
247
+				1,
248
+				self::$RECENT_COMMENT_COUNT,
249
+				'-date',
250
+				'blog.jacobemerick.com'
251
+			);
252
+		} catch (Exception $e) {
253
+			global $container;
254
+			$container['logger']->warning("CommentService | Sidebar | {$e->getMessage()}");
255
+			return;
256
+		}
257 257
  
258
-        $elapsed = microtime(true) - $start;
259
-        global $container;
260
-        $container['logger']->info("CommentService | Sidebar | {$elapsed}");
261
-
262
-        $array = array();
263
-        foreach($comment_response as $comment)
264
-        {
265
-            $body = $comment->getBody();
266
-            $body = Content::instance('CleanComment', $body)->activate();
267
-            $body = strip_tags($body);
268
-
269
-            $comment_obj = new stdclass();
270
-            $comment_obj->description = Content::instance('SmartTrim', $body)->activate(30);
271
-            $comment_obj->commenter = $comment->getCommenter()->getName();
272
-            $comment_obj->link = "{$comment->getUrl()}/#comment-{$comment->getId()}";
273
-            $array[] = $comment_obj;
274
-        }
275
-        return $array;
276
-    }
258
+		$elapsed = microtime(true) - $start;
259
+		global $container;
260
+		$container['logger']->info("CommentService | Sidebar | {$elapsed}");
261
+
262
+		$array = array();
263
+		foreach($comment_response as $comment)
264
+		{
265
+			$body = $comment->getBody();
266
+			$body = Content::instance('CleanComment', $body)->activate();
267
+			$body = strip_tags($body);
268
+
269
+			$comment_obj = new stdclass();
270
+			$comment_obj->description = Content::instance('SmartTrim', $body)->activate(30);
271
+			$comment_obj->commenter = $comment->getCommenter()->getName();
272
+			$comment_obj->link = "{$comment->getUrl()}/#comment-{$comment->getId()}";
273
+			$array[] = $comment_obj;
274
+		}
275
+		return $array;
276
+	}
277 277
 
278 278
 }
Please login to merge, or discard this patch.
controller/PageController.class.inc.php 4 patches
Doc Comments   +28 added lines patch added patch discarded remove patch
@@ -204,6 +204,9 @@  discard block
 block discarded – undo
204 204
 			exit;
205 205
 	}
206 206
 
207
+	/**
208
+	 * @param string $method
209
+	 */
207 210
 	protected function set_header_method($method)
208 211
 	{
209 212
 		$this->headers = $method;
@@ -214,6 +217,9 @@  discard block
 block discarded – undo
214 217
 		$this->set_head('title', $value);
215 218
 	}
216 219
 
220
+	/**
221
+	 * @param string $value
222
+	 */
217 223
 	protected function set_author($value)
218 224
 	{
219 225
 		$this->set_head('author', $value);
@@ -229,26 +235,41 @@  discard block
 block discarded – undo
229 235
 		$this->set_head('keywords', implode(', ', $array));
230 236
 	}
231 237
 	
238
+	/**
239
+	 * @param string $url
240
+	 */
232 241
 	protected function set_canonical($url)
233 242
 	{
234 243
 		$this->set_head('canonical', $url);
235 244
 	}
236 245
 
246
+	/**
247
+	 * @param string $set
248
+	 */
237 249
 	protected function set_head($set, $value)
238 250
 	{
239 251
 		$this->data_array['head'][$set] = $value;
240 252
 	}
241 253
 
254
+	/**
255
+	 * @param string $set
256
+	 */
242 257
 	protected function set_body($set, $value)
243 258
 	{
244 259
 		$this->data_array['body'][$set] = $value;
245 260
 	}
246 261
 
262
+	/**
263
+	 * @param string $file
264
+	 */
247 265
 	protected function add_css($file)
248 266
 	{
249 267
 		$this->css_array[] = $file;
250 268
 	}
251 269
 
270
+	/**
271
+	 * @param string $file
272
+	 */
252 273
 	protected function add_js($file)
253 274
 	{
254 275
 		$this->js_array[] = $file;
@@ -271,6 +292,9 @@  discard block
 block discarded – undo
271 292
 		$this->set_head('js_link_array', $js_array);
272 293
 	}
273 294
 
295
+	/**
296
+	 * @param string $view
297
+	 */
274 298
 	protected function set_body_view($view)
275 299
 	{
276 300
 		$this->body_view_array[] = $view;
@@ -315,6 +339,10 @@  discard block
 block discarded – undo
315 339
 	}
316 340
 
317 341
 	private $comment_errors;
342
+
343
+	/**
344
+	 * @param string $redirect_url
345
+	 */
318 346
 	protected function handle_comment_submit($site_id, $path, $redirect_url, $page_title)
319 347
 	{
320 348
 		if(Request::hasPost() && Request::getPost('submit') == 'Submit Comment')
Please login to merge, or discard this patch.
Indentation   +52 added lines, -52 removed lines patch added patch discarded remove patch
@@ -57,37 +57,37 @@  discard block
 block discarded – undo
57 57
 		return $domain_container;
58 58
 	}
59 59
 
60
-    protected function get_recent_activity()
61
-    {
62
-        global $container;
63
-        $activityRepository = new Jacobemerick\Web\Domain\Stream\Activity\MysqlActivityRepository($container['db_connection_locator']);
64
-        $post_result = $activityRepository->getActivities(5);
65
-
66
-        $post_array = array();
67
-        foreach($post_result as $row) {
68
-            array_push($post_array, $this->expand_post($row));
69
-        }
70
-
71
-        return $post_array;
72
-    }
73
-
74
-    protected function expand_post($raw_post, $format = 'short')
75
-    {
76
-        $post = [
77
-            'type' => $raw_post['type'],
78
-            'title' => ($format == 'short') ? $raw_post['message'] : $raw_post['message_long'],
79
-            'date' => $this->get_parsed_date($raw_post['datetime']),
80
-        ];
81
-
82
-        if ($format != 'short') {
83
-            $post['url'] = Loader::getRootUrl('lifestream') . "{$raw_post['type']}/{$raw_post['id']}/";
84
-
85
-            $metadata = json_decode($raw_post['metadata'], true);
86
-            $post = array_merge($post, $metadata);
87
-        }
88
-
89
-        return (object) $post;
90
-    }
60
+	protected function get_recent_activity()
61
+	{
62
+		global $container;
63
+		$activityRepository = new Jacobemerick\Web\Domain\Stream\Activity\MysqlActivityRepository($container['db_connection_locator']);
64
+		$post_result = $activityRepository->getActivities(5);
65
+
66
+		$post_array = array();
67
+		foreach($post_result as $row) {
68
+			array_push($post_array, $this->expand_post($row));
69
+		}
70
+
71
+		return $post_array;
72
+	}
73
+
74
+	protected function expand_post($raw_post, $format = 'short')
75
+	{
76
+		$post = [
77
+			'type' => $raw_post['type'],
78
+			'title' => ($format == 'short') ? $raw_post['message'] : $raw_post['message_long'],
79
+			'date' => $this->get_parsed_date($raw_post['datetime']),
80
+		];
81
+
82
+		if ($format != 'short') {
83
+			$post['url'] = Loader::getRootUrl('lifestream') . "{$raw_post['type']}/{$raw_post['id']}/";
84
+
85
+			$metadata = json_decode($raw_post['metadata'], true);
86
+			$post = array_merge($post, $metadata);
87
+		}
88
+
89
+		return (object) $post;
90
+	}
91 91
 
92 92
 	public function activate()
93 93
 	{
@@ -108,11 +108,11 @@  discard block
 block discarded – undo
108 108
 				Loader::load('view', URLDecode::getSite() . '/' . $view, $this->data_array['body']);
109 109
 		}
110 110
         
111
-        if (URLDecode::getSite() == 'waterfalls') {
112
-            Loader::load('view', '/WaterfallFoot');
113
-        } else {
114
-            Loader::load('view', '/Foot', array('tracking_code' => self::$TRACKING_CODE));
115
-        }
111
+		if (URLDecode::getSite() == 'waterfalls') {
112
+			Loader::load('view', '/WaterfallFoot');
113
+		} else {
114
+			Loader::load('view', '/Foot', array('tracking_code' => self::$TRACKING_CODE));
115
+		}
116 116
 		
117 117
 		if($view == '/404' || $view == '/503')
118 118
 			exit;
@@ -170,19 +170,19 @@  discard block
 block discarded – undo
170 170
 
171 171
 	private function load_assets()
172 172
 	{
173
-    $css_array = array_map(function ($stylesheet) {
174
-      $path = "/css/{$stylesheet[0]}.css";
175
-      if ($stylesheet[1] > 1) {
176
-        $path .= "?v={$stylesheet[1]}";
177
-      }
178
-      return $path;
179
-    }, $this->css_array);
180
-    $js_array = array_map(function ($script) {
181
-      if (substr($script, 0, 4) == 'http') {
182
-        return $script;
183
-      }
184
-      return "/js/{$script}.min.js";
185
-    }, $this->js_array);
173
+	$css_array = array_map(function ($stylesheet) {
174
+	  $path = "/css/{$stylesheet[0]}.css";
175
+	  if ($stylesheet[1] > 1) {
176
+		$path .= "?v={$stylesheet[1]}";
177
+	  }
178
+	  return $path;
179
+	}, $this->css_array);
180
+	$js_array = array_map(function ($script) {
181
+	  if (substr($script, 0, 4) == 'http') {
182
+		return $script;
183
+	  }
184
+	  return "/js/{$script}.min.js";
185
+	}, $this->js_array);
186 186
 		
187 187
 		$this->set_head('css_link_array', $css_array);
188 188
 		$this->set_head('js_link_array', $js_array);
@@ -296,9 +296,9 @@  discard block
 block discarded – undo
296 296
 		$commenter->email = '';
297 297
 		$commenter->website = '';
298 298
 
299
-    if (!isset($_COOKIE['commenter'])) {
300
-      return $commenter;
301
-    }
299
+	if (!isset($_COOKIE['commenter'])) {
300
+	  return $commenter;
301
+	}
302 302
 
303 303
 		$commenter_cookie_value = json_decode($_COOKIE['commenter']);
304 304
 		
Please login to merge, or discard this patch.
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
         $post_result = $activityRepository->getActivities(5);
65 65
 
66 66
         $post_array = array();
67
-        foreach($post_result as $row) {
67
+        foreach ($post_result as $row) {
68 68
             array_push($post_array, $this->expand_post($row));
69 69
         }
70 70
 
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
         ];
81 81
 
82 82
         if ($format != 'short') {
83
-            $post['url'] = Loader::getRootUrl('lifestream') . "{$raw_post['type']}/{$raw_post['id']}/";
83
+            $post['url'] = Loader::getRootUrl('lifestream')."{$raw_post['type']}/{$raw_post['id']}/";
84 84
 
85 85
             $metadata = json_decode($raw_post['metadata'], true);
86 86
             $post = array_merge($post, $metadata);
@@ -100,12 +100,12 @@  discard block
 block discarded – undo
100 100
 		$headers = $this->headers;
101 101
 		Header::$headers();
102 102
 		Loader::load('view', '/Head', $this->data_array['head']);
103
-		foreach($this->body_view_array as $view)
103
+		foreach ($this->body_view_array as $view)
104 104
 		{
105
-			if(substr($view, 0, 1) == '/')
105
+			if (substr($view, 0, 1) == '/')
106 106
 				Loader::load('view', $view, $this->data_array['body']);
107 107
 			else
108
-				Loader::load('view', URLDecode::getSite() . '/' . $view, $this->data_array['body']);
108
+				Loader::load('view', URLDecode::getSite().'/'.$view, $this->data_array['body']);
109 109
 		}
110 110
         
111 111
         if (URLDecode::getSite() == 'waterfalls') {
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
             Loader::load('view', '/Foot', array('tracking_code' => self::$TRACKING_CODE));
115 115
         }
116 116
 		
117
-		if($view == '/404' || $view == '/503')
117
+		if ($view == '/404' || $view == '/503')
118 118
 			exit;
119 119
 	}
120 120
 
@@ -170,14 +170,14 @@  discard block
 block discarded – undo
170 170
 
171 171
 	private function load_assets()
172 172
 	{
173
-    $css_array = array_map(function ($stylesheet) {
173
+    $css_array = array_map(function($stylesheet) {
174 174
       $path = "/css/{$stylesheet[0]}.css";
175 175
       if ($stylesheet[1] > 1) {
176 176
         $path .= "?v={$stylesheet[1]}";
177 177
       }
178 178
       return $path;
179 179
     }, $this->css_array);
180
-    $js_array = array_map(function ($script) {
180
+    $js_array = array_map(function($script) {
181 181
       if (substr($script, 0, 4) == 'http') {
182 182
         return $script;
183 183
       }
@@ -195,26 +195,26 @@  discard block
 block discarded – undo
195 195
 
196 196
 	protected function eject()
197 197
 	{
198
-		if(get_class($this) !== 'Error404Controller')
198
+		if (get_class($this) !== 'Error404Controller')
199 199
 			Loader::loadNew('controller', '/Error404Controller')->activate();
200 200
 	}
201 201
 
202 202
 	protected function unavailable()
203 203
 	{
204
-		if(get_class($this) !== 'Error503Controller')
204
+		if (get_class($this) !== 'Error503Controller')
205 205
 			Loader::loadNew('controller', '/Error503Controller')->activate();
206 206
 	}
207 207
 
208 208
 	protected function redirect($uri, $method = 301)
209 209
 	{
210
-		switch($method)
210
+		switch ($method)
211 211
 		{
212 212
 			case 301 :
213
-				if(get_class($this) !== 'Error301Controller')
213
+				if (get_class($this) !== 'Error301Controller')
214 214
 					Loader::loadNew('controller', '/Error301Controller', array($uri))->activate();
215 215
 				break;
216 216
 			case 303 :
217
-				if(get_class($this) !== 'Error303Controller')
217
+				if (get_class($this) !== 'Error303Controller')
218 218
 					Loader::loadNew('controller', '/Error303Controller', array($uri))->activate();
219 219
 				break;
220 220
 		}
@@ -234,7 +234,7 @@  discard block
 block discarded – undo
234 234
 	private $comment_errors;
235 235
 	protected function handle_comment_submit($site_id, $path, $redirect_url, $page_title)
236 236
 	{
237
-		if(Request::hasPost() && Request::getPost('submit') == 'Submit Comment')
237
+		if (Request::hasPost() && Request::getPost('submit') == 'Submit Comment')
238 238
 		{
239 239
 			$parameters = array($site_id, $path, $redirect_url, $page_title);
240 240
 			$this->comment_errors = Loader::loadNew('module', 'form/CommentSubmitModule', $parameters)->activate();
@@ -252,7 +252,7 @@  discard block
 block discarded – undo
252 252
 		$comment_array = array();
253 253
 		$comment_result = CommentCollector::getCommentsForURL($site, $path, $commenter->id);
254 254
 		
255
-		foreach($comment_result as $comment)
255
+		foreach ($comment_result as $comment)
256 256
 		{
257 257
 			$comment_object = new stdclass();
258 258
 			$comment_object->id = $comment->id;
@@ -262,12 +262,12 @@  discard block
 block discarded – undo
262 262
 			$comment_object->url = $comment->url;
263 263
 			$comment_object->trusted = $comment->trusted;
264 264
 			
265
-			if($comment->reply == 0 && Request::getPost('type') == $comment->id)
265
+			if ($comment->reply == 0 && Request::getPost('type') == $comment->id)
266 266
 				$comment_object->errors = $this->comment_errors;
267 267
 			else
268 268
 				$comment_object->errors = array();
269 269
 			
270
-			if($comment->reply == 0)
270
+			if ($comment->reply == 0)
271 271
 			{
272 272
 				$comment_object->replies = array();
273 273
 				$comment_array[$comment->id] = $comment_object;
@@ -302,15 +302,15 @@  discard block
 block discarded – undo
302 302
 
303 303
 		$commenter_cookie_value = json_decode($_COOKIE['commenter']);
304 304
 		
305
-		if($commenter_cookie_value === NULL)
305
+		if ($commenter_cookie_value === NULL)
306 306
 			return $commenter;
307 307
 		
308
-		if(!isset($commenter_cookie_value->name) || !isset($commenter_cookie_value->email))
308
+		if (!isset($commenter_cookie_value->name) || !isset($commenter_cookie_value->email))
309 309
 			return $commenter;
310 310
 		
311 311
 		$commenter_object = CommentCollector::getCommenterByFields($commenter_cookie_value->name, $commenter_cookie_value->email, (isset($commenter_cookie_value->website) ? $commenter_cookie_value->website : ''));
312 312
 		
313
-		if($commenter_object === NULL)
313
+		if ($commenter_object === NULL)
314 314
 			return $commenter;
315 315
 		
316 316
 		$commenter->id = $commenter_object->id;
Please login to merge, or discard this patch.
Braces   +37 added lines, -27 removed lines patch added patch discarded remove patch
@@ -102,10 +102,11 @@  discard block
 block discarded – undo
102 102
 		Loader::load('view', '/Head', $this->data_array['head']);
103 103
 		foreach($this->body_view_array as $view)
104 104
 		{
105
-			if(substr($view, 0, 1) == '/')
106
-				Loader::load('view', $view, $this->data_array['body']);
107
-			else
108
-				Loader::load('view', URLDecode::getSite() . '/' . $view, $this->data_array['body']);
105
+			if(substr($view, 0, 1) == '/') {
106
+							Loader::load('view', $view, $this->data_array['body']);
107
+			} else {
108
+							Loader::load('view', URLDecode::getSite() . '/' . $view, $this->data_array['body']);
109
+			}
109 110
 		}
110 111
         
111 112
         if (URLDecode::getSite() == 'waterfalls') {
@@ -114,8 +115,9 @@  discard block
 block discarded – undo
114 115
             Loader::load('view', '/Foot', array('tracking_code' => self::$TRACKING_CODE));
115 116
         }
116 117
 		
117
-		if($view == '/404' || $view == '/503')
118
-			exit;
118
+		if($view == '/404' || $view == '/503') {
119
+					exit;
120
+		}
119 121
 	}
120 122
 
121 123
 	protected function set_header_method($method)
@@ -195,14 +197,16 @@  discard block
 block discarded – undo
195 197
 
196 198
 	protected function eject()
197 199
 	{
198
-		if(get_class($this) !== 'Error404Controller')
199
-			Loader::loadNew('controller', '/Error404Controller')->activate();
200
+		if(get_class($this) !== 'Error404Controller') {
201
+					Loader::loadNew('controller', '/Error404Controller')->activate();
202
+		}
200 203
 	}
201 204
 
202 205
 	protected function unavailable()
203 206
 	{
204
-		if(get_class($this) !== 'Error503Controller')
205
-			Loader::loadNew('controller', '/Error503Controller')->activate();
207
+		if(get_class($this) !== 'Error503Controller') {
208
+					Loader::loadNew('controller', '/Error503Controller')->activate();
209
+		}
206 210
 	}
207 211
 
208 212
 	protected function redirect($uri, $method = 301)
@@ -210,12 +214,14 @@  discard block
 block discarded – undo
210 214
 		switch($method)
211 215
 		{
212 216
 			case 301 :
213
-				if(get_class($this) !== 'Error301Controller')
214
-					Loader::loadNew('controller', '/Error301Controller', array($uri))->activate();
217
+				if(get_class($this) !== 'Error301Controller') {
218
+									Loader::loadNew('controller', '/Error301Controller', array($uri))->activate();
219
+				}
215 220
 				break;
216 221
 			case 303 :
217
-				if(get_class($this) !== 'Error303Controller')
218
-					Loader::loadNew('controller', '/Error303Controller', array($uri))->activate();
222
+				if(get_class($this) !== 'Error303Controller') {
223
+									Loader::loadNew('controller', '/Error303Controller', array($uri))->activate();
224
+				}
219 225
 				break;
220 226
 		}
221 227
 	}
@@ -262,18 +268,19 @@  discard block
 block discarded – undo
262 268
 			$comment_object->url = $comment->url;
263 269
 			$comment_object->trusted = $comment->trusted;
264 270
 			
265
-			if($comment->reply == 0 && Request::getPost('type') == $comment->id)
266
-				$comment_object->errors = $this->comment_errors;
267
-			else
268
-				$comment_object->errors = array();
271
+			if($comment->reply == 0 && Request::getPost('type') == $comment->id) {
272
+							$comment_object->errors = $this->comment_errors;
273
+			} else {
274
+							$comment_object->errors = array();
275
+			}
269 276
 			
270 277
 			if($comment->reply == 0)
271 278
 			{
272 279
 				$comment_object->replies = array();
273 280
 				$comment_array[$comment->id] = $comment_object;
274
-			}
275
-			else
276
-				$comment_array[$comment->reply]->replies[$comment->id] = $comment_object;
281
+			} else {
282
+							$comment_array[$comment->reply]->replies[$comment->id] = $comment_object;
283
+			}
277 284
 		}
278 285
 		
279 286
 		$comment_count = CommentCollector::getCommentCountForURL($site, $path);
@@ -302,16 +309,19 @@  discard block
 block discarded – undo
302 309
 
303 310
 		$commenter_cookie_value = json_decode($_COOKIE['commenter']);
304 311
 		
305
-		if($commenter_cookie_value === NULL)
306
-			return $commenter;
312
+		if($commenter_cookie_value === NULL) {
313
+					return $commenter;
314
+		}
307 315
 		
308
-		if(!isset($commenter_cookie_value->name) || !isset($commenter_cookie_value->email))
309
-			return $commenter;
316
+		if(!isset($commenter_cookie_value->name) || !isset($commenter_cookie_value->email)) {
317
+					return $commenter;
318
+		}
310 319
 		
311 320
 		$commenter_object = CommentCollector::getCommenterByFields($commenter_cookie_value->name, $commenter_cookie_value->email, (isset($commenter_cookie_value->website) ? $commenter_cookie_value->website : ''));
312 321
 		
313
-		if($commenter_object === NULL)
314
-			return $commenter;
322
+		if($commenter_object === NULL) {
323
+					return $commenter;
324
+		}
315 325
 		
316 326
 		$commenter->id = $commenter_object->id;
317 327
 		$commenter->name = $commenter_object->name;
Please login to merge, or discard this patch.
utility/content/MarkupCodeContent.class.inc.php 3 patches
Doc Comments   +6 added lines patch added patch discarded remove patch
@@ -25,6 +25,9 @@  discard block
 block discarded – undo
25 25
 		return;
26 26
 	}
27 27
 
28
+	/**
29
+	 * @param string $content
30
+	 */
28 31
 	private function wrap_in_list($content)
29 32
 	{
30 33
 		$content_array = explode("\n", $content);
@@ -44,6 +47,9 @@  discard block
 block discarded – undo
44 47
 		return $content;
45 48
 	}
46 49
 
50
+	/**
51
+	 * @param string $type
52
+	 */
47 53
 	private function highlight_code($content, $type)
48 54
 	{
49 55
 		switch($type)
Please login to merge, or discard this 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.
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 4 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -62,6 +62,9 @@
 block discarded – undo
62 62
 		$this->is_trimmed = true;
63 63
 	}
64 64
 
65
+	/**
66
+	 * @param string $content
67
+	 */
65 68
 	private function trim_html_string($content, $length)
66 69
 	{
67 70
 		$content = preg_replace(self::$PHOTO_PLACEHOLDER_MATCH, '', $content);
Please login to merge, or discard this patch.
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -42,8 +42,8 @@
 block discarded – undo
42 42
 		
43 43
 		if($length < strlen($this->content))
44 44
 			$this->trim_string($length);
45
-        else
46
-            $etc = '';
45
+		else
46
+			$etc = '';
47 47
 		$this->check_exclude_tags();
48 48
 		$this->close_tags($etc);
49 49
 	}
Please login to merge, or discard this 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.
Spacing   +15 added lines, -15 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
-			$content = substr($content, 0, $match[1]) . $match[0] . substr($content, $match[1]);
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
 			}
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
 
142 142
 	private function get_tags_preg($tag_array)
143 143
 	{
144
-		return '@</?(' . implode('|', $tag_array) . ')@';
144
+		return '@</?('.implode('|', $tag_array).')@';
145 145
 	}
146 146
 
147 147
 }
Please login to merge, or discard this patch.
utility/Request.class.inc.php 3 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -34,6 +34,9 @@
 block discarded – undo
34 34
 		return false;
35 35
 	}
36 36
 
37
+	/**
38
+	 * @param string $key
39
+	 */
37 40
 	static function getGet($key = null)
38 41
 	{
39 42
 		if($key)
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -18,9 +18,9 @@  discard block
 block discarded – undo
18 18
 
19 19
 	static function getServer($key = null)
20 20
 	{
21
-		if($key)
21
+		if ($key)
22 22
 		{
23
-			if(isset(self::$server[$key]))
23
+			if (isset(self::$server[$key]))
24 24
 				return self::$server[$key];
25 25
 			return false;
26 26
 		}
@@ -29,16 +29,16 @@  discard block
 block discarded – undo
29 29
 
30 30
 	static function isAjax()
31 31
 	{
32
-		if(self::getServer(self::$AJAX_REQUEST))
32
+		if (self::getServer(self::$AJAX_REQUEST))
33 33
 			return true;
34 34
 		return false;
35 35
 	}
36 36
 
37 37
 	static function getGet($key = null)
38 38
 	{
39
-		if($key)
39
+		if ($key)
40 40
 		{
41
-			if(isset(self::$get[$key]))
41
+			if (isset(self::$get[$key]))
42 42
 				return self::$get[$key];
43 43
 			return false;
44 44
 		}
@@ -47,9 +47,9 @@  discard block
 block discarded – undo
47 47
 
48 48
 	static function getPost($key = null)
49 49
 	{
50
-		if($key)
50
+		if ($key)
51 51
 		{
52
-			if(isset(self::$post[$key]))
52
+			if (isset(self::$post[$key]))
53 53
 				return self::$post[$key];
54 54
 			return false;
55 55
 		}
Please login to merge, or discard this 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.
utility/URLDecode.class.inc.php 4 patches
Doc Comments   +6 added lines patch added patch discarded remove patch
@@ -38,6 +38,9 @@  discard block
 block discarded – undo
38 38
 		self::$array['pieces'] = (array) $uri_array;
39 39
 	}
40 40
 
41
+	/**
42
+	 * @return string
43
+	 */
41 44
 	static function getSite()
42 45
 	{
43 46
 		return self::$array['site'];
@@ -66,6 +69,9 @@  discard block
 block discarded – undo
66 69
 		return substr($file, strrpos($file, '.') + 1);;
67 70
 	}
68 71
 
72
+	/**
73
+	 * @param integer $piece
74
+	 */
69 75
 	static function getPiece($piece = null)
70 76
 	{
71 77
 		if(!$piece)
Please login to merge, or discard this patch.
Braces   +21 added lines, -14 removed lines patch added patch discarded remove patch
@@ -15,12 +15,14 @@  discard block
 block discarded – undo
15 15
 	static private function form_url_array($host, $uri)
16 16
 	{
17 17
 		$uri = substr($uri, 1);
18
-		if(strpos($uri, '?'))
19
-			$uri = substr($uri, 0, strpos($uri, '?'));
18
+		if(strpos($uri, '?')) {
19
+					$uri = substr($uri, 0, strpos($uri, '?'));
20
+		}
20 21
 		$uri_array = explode('/', $uri);
21 22
 		
22
-		if(!Loader::isLive())
23
-			$host = substr($host, strpos($host, '.') + 1);
23
+		if(!Loader::isLive()) {
24
+					$host = substr($host, strpos($host, '.') + 1);
25
+		}
24 26
 		
25 27
 		self::$array['host'] = $host;
26 28
 		
@@ -33,8 +35,9 @@  discard block
 block discarded – undo
33 35
 		self::$array['base'] = 'http://' . (!Loader::isLive() ? 'dev.' : '') . $host . '/';
34 36
 		self::$array['uri'] = '/' . implode('/', $uri_array);
35 37
 		
36
-		if(end($uri_array) == '')
37
-			$uri_array = array_slice($uri_array, 0, count($uri_array) - 1);
38
+		if(end($uri_array) == '') {
39
+					$uri_array = array_slice($uri_array, 0, count($uri_array) - 1);
40
+		}
38 41
 		self::$array['pieces'] = (array) $uri_array;
39 42
 	}
40 43
 
@@ -61,22 +64,26 @@  discard block
 block discarded – undo
61 64
 	static function getExtension()
62 65
 	{
63 66
 		$file = self::getPiece(-1);
64
-		if(substr($file, -1) == '/')
65
-			return false;
67
+		if(substr($file, -1) == '/') {
68
+					return false;
69
+		}
66 70
 		return substr($file, strrpos($file, '.') + 1);;
67 71
 	}
68 72
 
69 73
 	static function getPiece($piece = null)
70 74
 	{
71
-		if(!$piece)
72
-			return self::$array['pieces'];
75
+		if(!$piece) {
76
+					return self::$array['pieces'];
77
+		}
73 78
 		
74
-		if($piece == -1)
75
-			return end(self::$array['pieces']);
79
+		if($piece == -1) {
80
+					return end(self::$array['pieces']);
81
+		}
76 82
 		
77 83
 		$piece = $piece - 1;
78
-		if(array_key_exists($piece, self::$array['pieces']))
79
-			return self::$array['pieces'][$piece];
84
+		if(array_key_exists($piece, self::$array['pieces'])) {
85
+					return self::$array['pieces'][$piece];
86
+		}
80 87
 		return;
81 88
 	}
82 89
 
Please login to merge, or discard this patch.
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -24,21 +24,21 @@
 block discarded – undo
24 24
 		
25 25
 		self::$array['host'] = $host;
26 26
 		
27
-    if (
28
-      $host == 'www.waterfallsofthekeweenaw.com' ||
29
-      $host == 'waterfallsofthekeweenaw.com'
30
-    ) {
27
+	if (
28
+	  $host == 'www.waterfallsofthekeweenaw.com' ||
29
+	  $host == 'waterfallsofthekeweenaw.com'
30
+	) {
31 31
 			self::$array['site'] = 'waterfalls';
32 32
 		} else {
33 33
 			self::$array['site'] = substr($host, 0, strpos($host, '.'));
34 34
 		}
35 35
 
36
-    $base = '';
37
-    $base .= (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') ? 'https' : 'http';
38
-    $base .= '://';
39
-    $base .= (!Loader::isLive()) ? 'dev.' : '';
40
-    $base .= $host;
41
-    $base .= '/';
36
+	$base = '';
37
+	$base .= (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') ? 'https' : 'http';
38
+	$base .= '://';
39
+	$base .= (!Loader::isLive()) ? 'dev.' : '';
40
+	$base .= $host;
41
+	$base .= '/';
42 42
 
43 43
 		self::$array['base'] = $base;
44 44
 		self::$array['uri'] = '/' . implode('/', $uri_array);
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -15,11 +15,11 @@  discard block
 block discarded – undo
15 15
 	static private function form_url_array($host, $uri)
16 16
 	{
17 17
 		$uri = substr($uri, 1);
18
-		if(strpos($uri, '?'))
18
+		if (strpos($uri, '?'))
19 19
 			$uri = substr($uri, 0, strpos($uri, '?'));
20 20
 		$uri_array = explode('/', $uri);
21 21
 		
22
-		if(!Loader::isLive())
22
+		if (!Loader::isLive())
23 23
 			$host = substr($host, strpos($host, '.') + 1);
24 24
 		
25 25
 		self::$array['host'] = $host;
@@ -41,9 +41,9 @@  discard block
 block discarded – undo
41 41
     $base .= '/';
42 42
 
43 43
 		self::$array['base'] = $base;
44
-		self::$array['uri'] = '/' . implode('/', $uri_array);
44
+		self::$array['uri'] = '/'.implode('/', $uri_array);
45 45
 		
46
-		if(end($uri_array) == '')
46
+		if (end($uri_array) == '')
47 47
 			$uri_array = array_slice($uri_array, 0, count($uri_array) - 1);
48 48
 		self::$array['pieces'] = (array) $uri_array;
49 49
 	}
@@ -71,21 +71,21 @@  discard block
 block discarded – undo
71 71
 	static function getExtension()
72 72
 	{
73 73
 		$file = self::getPiece(-1);
74
-		if(substr($file, -1) == '/')
74
+		if (substr($file, -1) == '/')
75 75
 			return false;
76
-		return substr($file, strrpos($file, '.') + 1);;
76
+		return substr($file, strrpos($file, '.') + 1); ;
77 77
 	}
78 78
 
79 79
 	static function getPiece($piece = null)
80 80
 	{
81
-		if(!$piece)
81
+		if (!$piece)
82 82
 			return self::$array['pieces'];
83 83
 		
84
-		if($piece == -1)
84
+		if ($piece == -1)
85 85
 			return end(self::$array['pieces']);
86 86
 		
87 87
 		$piece = $piece - 1;
88
-		if(array_key_exists($piece, self::$array['pieces']))
88
+		if (array_key_exists($piece, self::$array['pieces']))
89 89
 			return self::$array['pieces'][$piece];
90 90
 		return;
91 91
 	}
Please login to merge, or discard this patch.