Completed
Push — master ( 72ee7f...4775c0 )
by Jacob
03:43
created
collector/waterfall/CompanionCollector.class.inc.php 1 patch
Braces   +6 added lines, -10 removed lines patch added patch discarded remove patch
@@ -2,11 +2,10 @@  discard block
 block discarded – undo
2 2
 
3 3
 Loader::load('collector', 'Collector');
4 4
 
5
-final class CompanionCollector extends Collector
6
-{
5
+final class CompanionCollector extends Collector
6
+{
7 7
 
8
-	public static function getByAlias($alias)
9
-	{
8
+	public static function getByAlias($alias) {
10 9
 		$alias = self::escape($alias);
11 10
 		
12 11
 		$query = "
@@ -35,8 +34,7 @@  discard block
 block discarded – undo
35 34
 		return self::run_row_query($query);
36 35
 	}
37 36
 
38
-	public static function getCompanionList()
39
-	{
37
+	public static function getCompanionList() {
40 38
 		$query = "
41 39
 			SELECT
42 40
 				`companion`.`name`,
@@ -60,8 +58,7 @@  discard block
 block discarded – undo
60 58
 		return self::run_query($query);
61 59
 	}
62 60
 
63
-	public static function getLogListForCompanion($companion, $total, $offset = 0)
64
-	{
61
+	public static function getLogListForCompanion($companion, $total, $offset = 0) {
65 62
 		$query = "
66 63
 			SELECT
67 64
 				`log`.`id`,
@@ -93,8 +90,7 @@  discard block
 block discarded – undo
93 90
 		return self::run_query($query);
94 91
 	}
95 92
 
96
-	public static function getLogCountForCompanion($companion)
97
-	{
93
+	public static function getLogCountForCompanion($companion) {
98 94
 		$query = "
99 95
 			SELECT
100 96
 				COUNT(1) AS `count`
Please login to merge, or discard this patch.
collector/waterfall/PeriodCollector.class.inc.php 1 patch
Braces   +6 added lines, -10 removed lines patch added patch discarded remove patch
@@ -2,11 +2,10 @@  discard block
 block discarded – undo
2 2
 
3 3
 Loader::load('collector', 'Collector');
4 4
 
5
-final class PeriodCollector extends Collector
6
-{
5
+final class PeriodCollector extends Collector
6
+{
7 7
 
8
-	public static function getByAlias($alias)
9
-	{
8
+	public static function getByAlias($alias) {
10 9
 		$alias = self::escape($alias);
11 10
 		
12 11
 		$query = "
@@ -34,8 +33,7 @@  discard block
 block discarded – undo
34 33
 		return self::run_row_query($query);
35 34
 	}
36 35
 
37
-	public static function getPeriodList()
38
-	{
36
+	public static function getPeriodList() {
39 37
 		$query = "
40 38
 			SELECT
41 39
 				`period`.`name`,
@@ -55,8 +53,7 @@  discard block
 block discarded – undo
55 53
 		return self::run_query($query);
56 54
 	}
57 55
 
58
-	public static function getLogListForPeriod($period, $total, $offset = 0)
59
-	{
56
+	public static function getLogListForPeriod($period, $total, $offset = 0) {
60 57
 		$query = "
61 58
 			SELECT
62 59
 				`log`.`id`,
@@ -86,8 +83,7 @@  discard block
 block discarded – undo
86 83
 		return self::run_query($query);
87 84
 	}
88 85
 
89
-	public static function getLogCountForPeriod($period)
90
-	{
86
+	public static function getLogCountForPeriod($period) {
91 87
 		$query = "
92 88
 			SELECT
93 89
 				COUNT(1) AS `count`
Please login to merge, or discard this patch.
collector/waterfall/CountyCollector.class.inc.php 1 patch
Braces   +6 added lines, -10 removed lines patch added patch discarded remove patch
@@ -2,11 +2,10 @@  discard block
 block discarded – undo
2 2
 
3 3
 Loader::load('collector', 'Collector');
4 4
 
5
-final class CountyCollector extends Collector
6
-{
5
+final class CountyCollector extends Collector
6
+{
7 7
 
8
-	public static function getByAlias($alias)
9
-	{
8
+	public static function getByAlias($alias) {
10 9
 		$alias = self::escape($alias);
11 10
 		
12 11
 		$query = "
@@ -35,8 +34,7 @@  discard block
 block discarded – undo
35 34
 		return self::run_row_query($query);
36 35
 	}
37 36
 
38
-	public static function getCountyList()
39
-	{
37
+	public static function getCountyList() {
40 38
 		$query = "
41 39
 			SELECT
42 40
 				`county`.`name`,
@@ -57,8 +55,7 @@  discard block
 block discarded – undo
57 55
 		return self::run_query($query);
58 56
 	}
59 57
 
60
-	public static function getLogListForCounty($county, $total, $offset = 0)
61
-	{
58
+	public static function getLogListForCounty($county, $total, $offset = 0) {
62 59
 		$query = "
63 60
 			SELECT
64 61
 				`waterfall`.`id`,
@@ -96,8 +93,7 @@  discard block
 block discarded – undo
96 93
 		return self::run_query($query);
97 94
 	}
98 95
 
99
-	public static function getLogCountForCounty($county)
100
-	{
96
+	public static function getLogCountForCounty($county) {
101 97
 		$query = "
102 98
 			SELECT
103 99
 				COUNT(1) AS `count`
Please login to merge, or discard this patch.
collector/waterfall/LogCollector.class.inc.php 1 patch
Braces   +14 added lines, -26 removed lines patch added patch discarded remove patch
@@ -2,11 +2,10 @@  discard block
 block discarded – undo
2 2
 
3 3
 Loader::load('collector', 'Collector');
4 4
 
5
-final class LogCollector extends Collector
6
-{
5
+final class LogCollector extends Collector
6
+{
7 7
 
8
-	public static function getList($total, $offset = 0)
9
-	{
8
+	public static function getList($total, $offset = 0) {
10 9
 		$query = "
11 10
 			SELECT
12 11
 				`log`.`id`,
@@ -34,8 +33,7 @@  discard block
 block discarded – undo
34 33
 		return self::run_query($query);
35 34
 	}
36 35
 
37
-    public static function getRecentList($total)
38
-    {
36
+    public static function getRecentList($total) {
39 37
         $query = "
40 38
             SELECT
41 39
                 `log`.`title`,
@@ -62,8 +60,7 @@  discard block
 block discarded – undo
62 60
         return self::run_query($query);
63 61
     }
64 62
 
65
-	public static function getListCount()
66
-	{
63
+	public static function getListCount() {
67 64
 		$query = "
68 65
 			SELECT
69 66
 				COUNT(1) AS `count`
@@ -74,8 +71,7 @@  discard block
 block discarded – undo
74 71
 		return self::get_count($query);
75 72
 	}
76 73
 
77
-	public static function getCompanionListForLog($log)
78
-	{
74
+	public static function getCompanionListForLog($log) {
79 75
 		$query = "
80 76
 			SELECT
81 77
 				`companion`.`name`,
@@ -90,8 +86,7 @@  discard block
 block discarded – undo
90 86
 		return self::run_query($query);
91 87
 	}
92 88
 
93
-	public static function getWaterfallListForLog($log)
94
-	{
89
+	public static function getWaterfallListForLog($log) {
95 90
 		$query = "
96 91
 			SELECT
97 92
 				`waterfall`.`name`,
@@ -113,8 +108,7 @@  discard block
 block discarded – undo
113 108
 		return self::run_query($query);
114 109
 	}
115 110
 
116
-	public static function getLogListForWaterfall($waterfall)
117
-	{
111
+	public static function getLogListForWaterfall($waterfall) {
118 112
 		$query = "
119 113
 			SELECT
120 114
 				`log`.`title`,
@@ -133,8 +127,7 @@  discard block
 block discarded – undo
133 127
 		return self::run_query($query);
134 128
 	}
135 129
 
136
-	public static function getTagListForLog($log)
137
-	{
130
+	public static function getTagListForLog($log) {
138 131
 		$query = "
139 132
 			SELECT
140 133
 				`tag`.`name`,
@@ -147,8 +140,7 @@  discard block
 block discarded – undo
147 140
 		return self::run_query($query);
148 141
 	}
149 142
 
150
-	public static function getByAlias($alias)
151
-	{
143
+	public static function getByAlias($alias) {
152 144
 		$alias = self::escape($alias);
153 145
 		
154 146
 		$query = "
@@ -178,8 +170,7 @@  discard block
 block discarded – undo
178 170
 		return self::run_row_query($query);
179 171
 	}
180 172
 
181
-    public static function getByDate($date)
182
-    {
173
+    public static function getByDate($date) {
183 174
         $date = self::escape($date);
184 175
         
185 176
         $query = "
@@ -195,8 +186,7 @@  discard block
 block discarded – undo
195 186
         return self::run_row_query($query);
196 187
     }
197 188
 	
198
-	public static function getById($log)
199
-	{
189
+	public static function getById($log) {
200 190
 		$query = "
201 191
 			SELECT
202 192
 				`title`,
@@ -211,8 +201,7 @@  discard block
 block discarded – undo
211 201
 		return self::run_row_query($query);
212 202
 	}
213 203
 
214
-	public static function getPreviousLog($log)
215
-	{
204
+	public static function getPreviousLog($log) {
216 205
 		$query = "
217 206
 			SELECT
218 207
 				`title`,
@@ -236,8 +225,7 @@  discard block
 block discarded – undo
236 225
 		return self::run_row_query($query);
237 226
 	}
238 227
 
239
-	public static function getNextLog($log)
240
-	{
228
+	public static function getNextLog($log) {
241 229
 		$query = "
242 230
 			SELECT
243 231
 				`title`,
Please login to merge, or discard this patch.
collector/waterfall/WaterfallCollector.class.inc.php 1 patch
Braces   +8 added lines, -14 removed lines patch added patch discarded remove patch
@@ -2,11 +2,10 @@  discard block
 block discarded – undo
2 2
 
3 3
 Loader::load('collector', 'Collector');
4 4
 
5
-final class WaterfallCollector extends Collector
6
-{
5
+final class WaterfallCollector extends Collector
6
+{
7 7
 
8
-	public static function getList($total, $offset = 0)
9
-	{
8
+	public static function getList($total, $offset = 0) {
10 9
 		$query = "
11 10
 			SELECT
12 11
 				`waterfall`.`id`,
@@ -43,8 +42,7 @@  discard block
 block discarded – undo
43 42
 		return self::run_query($query);
44 43
 	}
45 44
 
46
-    public static function getMapList()
47
-    {
45
+    public static function getMapList() {
48 46
         $query = "
49 47
             SELECT
50 48
                 `waterfall`.`name`,
@@ -74,8 +72,7 @@  discard block
 block discarded – undo
74 72
         return self::run_query($query);
75 73
     }
76 74
 
77
-	public static function getListCount()
78
-	{
75
+	public static function getListCount() {
79 76
 		$query = "
80 77
 			SELECT
81 78
 				COUNT(1) AS `count`
@@ -92,8 +89,7 @@  discard block
 block discarded – undo
92 89
 		return self::get_count($query);
93 90
 	}
94 91
 
95
-    public static function getNearbyList($waterfall)
96
-    {
92
+    public static function getNearbyList($waterfall) {
97 93
         $query = "
98 94
             SELECT
99 95
                 `waterfall`.`name`,
@@ -117,8 +113,7 @@  discard block
 block discarded – undo
117 113
         return self::run_query($query);
118 114
     }
119 115
 
120
-    public static function getByOldAlias($alias)
121
-    {
116
+    public static function getByOldAlias($alias) {
122 117
         $alias = self::escape($alias);
123 118
         
124 119
         $query = "
@@ -137,8 +132,7 @@  discard block
 block discarded – undo
137 132
         return self::run_row_query($query);
138 133
     }
139 134
 
140
-	public static function getByAlias($watercourse, $waterfall)
141
-	{
135
+	public static function getByAlias($watercourse, $waterfall) {
142 136
 		$watercourse = self::escape($watercourse);
143 137
 		$waterfall = self::escape($waterfall);
144 138
 		
Please login to merge, or discard this patch.
collector/waterfall/LogTagCollector.class.inc.php 1 patch
Braces   +5 added lines, -8 removed lines patch added patch discarded remove patch
@@ -2,11 +2,10 @@  discard block
 block discarded – undo
2 2
 
3 3
 Loader::load('collector', 'Collector');
4 4
 
5
-final class LogTagCollector extends Collector
6
-{
5
+final class LogTagCollector extends Collector
6
+{
7 7
 
8
-	public static function getTag($alias)
9
-	{
8
+	public static function getTag($alias) {
10 9
 		$alias = self::escape($alias);
11 10
 		
12 11
 		$query = "
@@ -23,8 +22,7 @@  discard block
 block discarded – undo
23 22
 		return self::run_row_query($query);
24 23
 	}
25 24
 
26
-	public static function getLogListForTag($tag, $total, $offset = 0)
27
-	{
25
+	public static function getLogListForTag($tag, $total, $offset = 0) {
28 26
 		$query = "
29 27
 			SELECT
30 28
 				`log`.`id`,
@@ -57,8 +55,7 @@  discard block
 block discarded – undo
57 55
 		return self::run_query($query);
58 56
 	}
59 57
 
60
-	public static function getLogCountForTag($tag)
61
-	{
58
+	public static function getLogCountForTag($tag) {
62 59
 		$query = "
63 60
 			SELECT
64 61
 				COUNT(1) AS `count`
Please login to merge, or discard this patch.
collector/comment/CommentCollector.class.inc.php 1 patch
Braces   +15 added lines, -22 removed lines patch added patch discarded remove patch
@@ -2,11 +2,10 @@  discard block
 block discarded – undo
2 2
 
3 3
 Loader::load('collector', 'Collector');
4 4
 
5
-final class CommentCollector extends Collector
6
-{
5
+final class CommentCollector extends Collector
6
+{
7 7
 
8
-	public static function getCommenterByFields($name, $email, $website)
9
-	{
8
+	public static function getCommenterByFields($name, $email, $website) {
10 9
 		$name = self::escape($name);
11 10
 		$email = self::escape($email);
12 11
 		$website = self::escape($website);
@@ -25,8 +24,7 @@  discard block
 block discarded – undo
25 24
 		return self::run_row_query($query);
26 25
 	}
27 26
 
28
-	public static function getCommentByBody($body)
29
-	{
27
+	public static function getCommentByBody($body) {
30 28
 		$body = self::escape($body);
31 29
 		
32 30
 		$query = "
@@ -41,8 +39,7 @@  discard block
 block discarded – undo
41 39
 		return self::run_row_query($query);
42 40
 	}
43 41
 
44
-	public static function getCommentPageByURL($path, $site)
45
-	{
42
+	public static function getCommentPageByURL($path, $site) {
46 43
 		$path = self::escape($path);
47 44
 		
48 45
 		$query = "
@@ -59,8 +56,7 @@  discard block
 block discarded – undo
59 56
 		return self::run_row_query($query);
60 57
 	}
61 58
 
62
-	public static function getNotificationForPage($comment_page)
63
-	{
59
+	public static function getNotificationForPage($comment_page) {
64 60
 		$query = "
65 61
 			SELECT
66 62
 				`name`,
@@ -83,8 +79,7 @@  discard block
 block discarded – undo
83 79
 		return self::run_query($query);
84 80
 	}
85 81
 
86
-	public static function getRecentBlogComments($count)
87
-	{
82
+	public static function getRecentBlogComments($count) {
88 83
 		$query = "
89 84
 			SELECT
90 85
 				`comment_meta`.`id`,
@@ -114,8 +109,7 @@  discard block
 block discarded – undo
114 109
 		return self::run_query($query);
115 110
 	}
116 111
 
117
-    public static function getRecentWaterfallComments($count = 5)
118
-    {
112
+    public static function getRecentWaterfallComments($count = 5) {
119 113
         $query = "
120 114
             SELECT
121 115
                 `comment_meta`.`id`,
@@ -159,14 +153,14 @@  discard block
 block discarded – undo
159 153
         return self::run_query($query);
160 154
     }
161 155
 
162
-	public static function getCommentsForURL($site, $path, $commenter = 0)
163
-	{
156
+	public static function getCommentsForURL($site, $path, $commenter = 0) {
164 157
 		$path = self::escape($path);
165 158
 		
166
-		if($commenter != 0)
167
-			$trusted_commenter_clause = "(`commenter`.`trusted` = '1' || `commenter`.`id` = '{$commenter}')";
168
-		else
169
-			$trusted_commenter_clause = "`commenter`.`trusted` = '1'";
159
+		if($commenter != 0) {
160
+					$trusted_commenter_clause = "(`commenter`.`trusted` = '1' || `commenter`.`id` = '{$commenter}')";
161
+		} else {
162
+					$trusted_commenter_clause = "`commenter`.`trusted` = '1'";
163
+		}
170 164
 		
171 165
 		$query = "
172 166
 			SELECT
@@ -197,8 +191,7 @@  discard block
 block discarded – undo
197 191
 		return self::run_query($query);
198 192
 	}
199 193
 
200
-	public static function getCommentCountForURL($site, $path)
201
-	{
194
+	public static function getCommentCountForURL($site, $path) {
202 195
 		$path = self::escape($path);
203 196
 		
204 197
 		$query = "
Please login to merge, or discard this patch.
collector/Collector.class.inc.php 1 patch
Braces   +7 added lines, -12 removed lines patch added patch discarded remove patch
@@ -2,31 +2,26 @@
 block discarded – undo
2 2
 
3 3
 Loader::loadInstance('utility', 'Database');
4 4
 
5
-abstract class Collector
6
-{
5
+abstract class Collector
6
+{
7 7
 
8
-	protected static function run_query($query)
9
-	{
8
+	protected static function run_query($query) {
10 9
 		return Database::select($query);
11 10
 	}
12 11
 
13
-	protected static function run_row_query($query)
14
-	{
12
+	protected static function run_row_query($query) {
15 13
 		return Database::selectRow($query);
16 14
 	}
17 15
 
18
-	protected static function get_count($query)
19
-	{
16
+	protected static function get_count($query) {
20 17
 		return Database::selectRow($query)->count;
21 18
 	}
22 19
 
23
-	protected static function check_exists($query)
24
-	{
20
+	protected static function check_exists($query) {
25 21
 		return Database::selectRow($query) !== null;
26 22
 	}
27 23
 
28
-	protected static function escape($string)
29
-	{
24
+	protected static function escape($string) {
30 25
 		return Database::escape($string);
31 26
 	}
32 27
 
Please login to merge, or discard this patch.
controller/blog/TagController.class.inc.php 1 patch
Braces   +27 added lines, -32 removed lines patch added patch discarded remove patch
@@ -2,8 +2,8 @@  discard block
 block discarded – undo
2 2
 
3 3
 Loader::load('controller', 'blog/DefaultListController');
4 4
 
5
-final class TagController extends DefaultListController
6
-{
5
+final class TagController extends DefaultListController
6
+{
7 7
 
8 8
 	private static $TITLE_MAIN = "%s Tag | Jacob Emerick's Blog";
9 9
 	private static $DESCRIPTION_MAIN = "Posts tagged with %s on Jacob Emerick's Blog, a website about Upper Peninsula hiking and web development best practices.";
@@ -21,8 +21,7 @@  discard block
 block discarded – undo
21 21
 
22 22
 	private $tag;
23 23
 
24
-	public function __construct()
25
-	{
24
+	public function __construct() {
26 25
 		$tag = URLDecode::getPiece(2);
27 26
 		$tag = str_replace('-', ' ', $tag);
28 27
 
@@ -30,24 +29,23 @@  discard block
 block discarded – undo
30 29
         $repository = new Jacobemerick\Web\Domain\Blog\Tag\MysqlTagRepository($container['db_connection_locator']);
31 30
         $tag_result = $repository->findTagByTitle($tag);
32 31
 
33
-		if($tag_result === false)
34
-			$this->eject();
32
+		if($tag_result === false) {
33
+					$this->eject();
34
+		}
35 35
 		
36 36
 		$this->tag = $tag_result;
37 37
 		
38 38
 		parent::__construct();
39 39
 	}
40 40
 
41
-	protected function set_head_data()
42
-	{
41
+	protected function set_head_data() {
43 42
 		parent::set_head_data();
44 43
 		
45 44
 		if($this->page == 1)
46 45
 		{
47 46
 			$this->set_title(sprintf(self::$TITLE_MAIN, ucwords($this->tag['tag'])));
48 47
 			$this->set_description(sprintf(self::$DESCRIPTION_MAIN, ucwords($this->tag['tag'])));
49
-		}
50
-		else
48
+		} else
51 49
 		{
52 50
 			$this->set_title(sprintf(self::$TITLE_PAGINATED, ucwords($this->tag['tag']), $this->page, $this->total_pages));
53 51
 			$this->set_description(sprintf(self::$DESCRIPTION_PAGINATED, $this->page, $this->total_pages, ucwords($this->tag['tag'])));
@@ -58,8 +56,7 @@  discard block
 block discarded – undo
58 56
 		$this->set_keywords($keyword_array);
59 57
 	}
60 58
 
61
-	protected function get_introduction()
62
-	{
59
+	protected function get_introduction() {
63 60
 		$tag = ucwords($this->tag['tag']);
64 61
 		
65 62
 		if($this->page == 1)
@@ -86,48 +83,46 @@  discard block
 block discarded – undo
86 83
 			'title' => "{$tag} posts, page {$this->page} of {$this->total_pages}.");
87 84
 	}
88 85
 
89
-	protected function get_page_number()
90
-	{
86
+	protected function get_page_number() {
91 87
 		$page = URLDecode::getPiece(3);
92
-		if(isset($page) && is_numeric($page))
93
-			return $page;
88
+		if(isset($page) && is_numeric($page)) {
89
+					return $page;
90
+		}
94 91
 		return 1;
95 92
 	}
96 93
 
97
-	protected function get_list_results()
98
-	{
94
+	protected function get_list_results() {
99 95
         global $container;
100 96
         $repository = new Jacobemerick\Web\Domain\Blog\Post\MysqlPostRepository($container['db_connection_locator']);
101 97
         return $repository->getActivePostsByTag($this->tag['id'], self::$POSTS_PER_PAGE, $this->offset);
102 98
 	}
103 99
 
104
-	protected function get_list_description()
105
-	{
100
+	protected function get_list_description() {
106 101
 		$start = $this->offset + 1;
107 102
 		$end = min($this->offset + self::$POSTS_PER_PAGE, $this->get_total_post_count());
108 103
 		
109 104
 		return sprintf(self::$LIST_DESCRIPTION, $start, $end, $this->get_total_post_count(), $this->tag['tag']);
110 105
 	}
111 106
 
112
-	protected function get_list_next_link()
113
-	{
114
-		if($this->page == 1)
115
-			return;
116
-		if($this->page == 2)
117
-			return Content::instance('URLSafe', "/tag/{$this->tag['tag']}/")->activate();
107
+	protected function get_list_next_link() {
108
+		if($this->page == 1) {
109
+					return;
110
+		}
111
+		if($this->page == 2) {
112
+					return Content::instance('URLSafe', "/tag/{$this->tag['tag']}/")->activate();
113
+		}
118 114
 		return Content::instance('URLSafe', "/tag/{$this->tag['tag']}/" . ($this->page - 1) . '/')->activate();
119 115
 	}
120 116
 
121
-	protected function get_list_prev_link()
122
-	{
123
-		if(($this->page * self::$POSTS_PER_PAGE) >= $this->get_total_post_count())
124
-			return;
117
+	protected function get_list_prev_link() {
118
+		if(($this->page * self::$POSTS_PER_PAGE) >= $this->get_total_post_count()) {
119
+					return;
120
+		}
125 121
 		return Content::instance('URLSafe', "/tag/{$this->tag['tag']}/" . ($this->page + 1) . '/')->activate();
126 122
 	}
127 123
 
128 124
 	private $total_post_count;
129
-	protected function get_total_post_count()
130
-	{
125
+	protected function get_total_post_count() {
131 126
 		if(!isset($this->total_post_count)) {
132 127
         global $container;
133 128
         $repository = new Jacobemerick\Web\Domain\Blog\Post\MysqlPostRepository($container['db_connection_locator']);
Please login to merge, or discard this patch.