Completed
Push — master ( 72ee7f...4775c0 )
by Jacob
03:43
created
controller/waterfalls/DefaultLogListController.class.inc.php 1 patch
Braces   +6 added lines, -10 removed lines patch added patch discarded remove patch
@@ -7,23 +7,20 @@  discard block
 block discarded – undo
7 7
 	'waterfall/PeriodCollector'));
8 8
 Loader::load('controller', 'waterfalls/DefaultListController');
9 9
 
10
-abstract class DefaultLogListController extends DefaultListController
11
-{
10
+abstract class DefaultLogListController extends DefaultListController
11
+{
12 12
 
13 13
 	private static $ITEM_COUNT_PER_PAGE = 10;
14 14
 
15
-	final protected function get_list_view()
16
-	{
15
+	final protected function get_list_view() {
17 16
 		return 'LogListing';
18 17
 	}
19 18
 
20
-	final protected function get_item_count_per_page()
21
-	{
19
+	final protected function get_item_count_per_page() {
22 20
 		return self::$ITEM_COUNT_PER_PAGE;
23 21
 	}
24 22
 
25
-	final protected function format_item($item)
26
-	{
23
+	final protected function format_item($item) {
27 24
 		$item_array = array();
28 25
 		
29 26
 		$item_array['title'] = $item->title;
@@ -37,8 +34,7 @@  discard block
 block discarded – undo
37 34
 		return $item_array;
38 35
 	}
39 36
 
40
-	final protected function get_sidebar()
41
-	{
37
+	final protected function get_sidebar() {
42 38
 		$companion_result = CompanionCollector::getCompanionList();
43 39
 		$companion_list = array();
44 40
 		
Please login to merge, or discard this patch.
controller/waterfalls/WaterfallListController.class.inc.php 1 patch
Braces   +11 added lines, -20 removed lines patch added patch discarded remove patch
@@ -5,8 +5,8 @@  discard block
 block discarded – undo
5 5
 	'waterfall/WaterfallCollector'));
6 6
 Loader::load('controller', 'waterfalls/DefaultWaterfallListController');
7 7
 
8
-final class WaterfallListController extends DefaultWaterfallListController
9
-{
8
+final class WaterfallListController extends DefaultWaterfallListController
9
+{
10 10
 
11 11
 	private static $PRIMARY_TITLE = 'Full Listing of Falls';
12 12
 	private static $PRIMARY_DESCRIPTION = 'List of waterfalls found in the general Keweenaw Area, complete with photos, descriptions, directions, and maps.';
@@ -28,8 +28,7 @@  discard block
 block discarded – undo
28 28
 	private static $NAVIGATION_DESCRIPTION = 'displaying %d ~ %d of %d total waterfalls';
29 29
 	private static $LINK_ROOT = '/falls/';
30 30
 
31
-	protected function get_initial_meta()
32
-	{
31
+	protected function get_initial_meta() {
33 32
 		$meta_array = array();
34 33
 		
35 34
 		$meta_array['title'] = self::$PRIMARY_TITLE . ' | ' . self::$WEBSITE_TITLE;
@@ -39,8 +38,7 @@  discard block
 block discarded – undo
39 38
 		return $meta_array;
40 39
 	}
41 40
 
42
-	protected function get_subsequent_meta()
43
-	{
41
+	protected function get_subsequent_meta() {
44 42
 		$meta_array = array();
45 43
 		
46 44
 		$meta_array['title'] = sprintf(self::$SECONDARY_TITLE . ' | ' . self::$WEBSITE_TITLE, $this->page, $this->page_count);
@@ -50,8 +48,7 @@  discard block
 block discarded – undo
50 48
 		return $meta_array;
51 49
 	}
52 50
 
53
-	protected function get_initial_introduction()
54
-	{
51
+	protected function get_initial_introduction() {
55 52
 		$introduction = array();
56 53
 		
57 54
 		$introduction['title'] = self::$PRIMARY_INTRODUCTION_HEADER;
@@ -63,34 +60,28 @@  discard block
 block discarded – undo
63 60
 		return $introduction;
64 61
 	}
65 62
 
66
-	protected function get_subsequent_introduction()
67
-	{
63
+	protected function get_subsequent_introduction() {
68 64
 		return array(
69 65
 			'title' => sprintf(self::$SECONDARY_INTRODUCTION_HEADER, $this->page, $this->page_count));
70 66
 	}
71 67
 
72
-	protected function get_page_number_piece()
73
-	{
68
+	protected function get_page_number_piece() {
74 69
 		return URLDecode::getPiece(2);
75 70
 	}
76 71
 
77
-	protected function get_item_result($total, $offset)
78
-	{
72
+	protected function get_item_result($total, $offset) {
79 73
 		return WaterfallCollector::getList($total, $offset);
80 74
 	}
81 75
 
82
-	protected function get_item_count_result()
83
-	{
76
+	protected function get_item_count_result() {
84 77
 		return WaterfallCollector::getListCount();
85 78
 	}
86 79
 
87
-	protected function get_list_description_pattern()
88
-	{
80
+	protected function get_list_description_pattern() {
89 81
 		return self::$NAVIGATION_DESCRIPTION;
90 82
 	}
91 83
 
92
-	protected function get_list_link_root()
93
-	{
84
+	protected function get_list_link_root() {
94 85
 		return self::$LINK_ROOT;
95 86
 	}
96 87
 
Please login to merge, or discard this patch.
controller/PageController.class.inc.php 1 patch
Braces   +63 added lines, -77 removed lines patch added patch discarded remove patch
@@ -2,8 +2,8 @@  discard block
 block discarded – undo
2 2
 
3 3
 Loader::load('utility', 'Header');
4 4
 
5
-abstract class PageController
6
-{
5
+abstract class PageController
6
+{
7 7
 
8 8
 	private static $TRACKING_CODE = 'UA-11745070-1';
9 9
 	
@@ -24,8 +24,7 @@  discard block
 block discarded – undo
24 24
 	protected function set_body_data() {}
25 25
 	protected function set_data() {}
26 26
 
27
-	public function __construct()
28
-	{
27
+	public function __construct() {
29 28
 		$this->set_header_method('sendHTML');
30 29
 		
31 30
 		$this->set_head('google_verification', 'sgAISiuoWfK54KXnOfm2oU4vQdad8eyNCQX7LkZ1OxM');
@@ -38,8 +37,7 @@  discard block
 block discarded – undo
38 37
 			'date' => date('Y')));
39 38
 	}
40 39
 
41
-	protected function get_domain_container()
42
-	{
40
+	protected function get_domain_container() {
43 41
 		$domain_container = new stdclass();
44 42
 		
45 43
 		$domain_container->blog = Loader::getRootUrl('blog');
@@ -52,8 +50,7 @@  discard block
 block discarded – undo
52 50
 		return $domain_container;
53 51
 	}
54 52
 
55
-    protected function get_recent_activity()
56
-    {
53
+    protected function get_recent_activity() {
57 54
         global $container;
58 55
         $activityRepository = new Jacobemerick\Web\Domain\Stream\Activity\MysqlActivityRepository($container['db_connection_locator']);
59 56
         $post_result = $activityRepository->getActivities(5);
@@ -66,8 +63,7 @@  discard block
 block discarded – undo
66 63
         return $post_array;
67 64
     }
68 65
 
69
-    protected function expand_post($raw_post, $format = 'short')
70
-    {
66
+    protected function expand_post($raw_post, $format = 'short') {
71 67
         $post = [
72 68
             'type' => $raw_post['type'],
73 69
             'title' => ($format == 'short') ? $raw_post['message'] : $raw_post['message_long'],
@@ -84,8 +80,7 @@  discard block
 block discarded – undo
84 80
         return (object) $post;
85 81
     }
86 82
 
87
-	public function activate()
88
-	{
83
+	public function activate() {
89 84
 		$this->set_head_data();
90 85
 		$this->set_body_data();
91 86
 		$this->set_data();
@@ -97,10 +92,11 @@  discard block
 block discarded – undo
97 92
 		Loader::load('view', '/Head', $this->data_array['head']);
98 93
 		foreach($this->body_view_array as $view)
99 94
 		{
100
-			if(substr($view, 0, 1) == '/')
101
-				Loader::load('view', $view, $this->data_array['body']);
102
-			else
103
-				Loader::load('view', URLDecode::getSite() . '/' . $view, $this->data_array['body']);
95
+			if(substr($view, 0, 1) == '/') {
96
+							Loader::load('view', $view, $this->data_array['body']);
97
+			} else {
98
+							Loader::load('view', URLDecode::getSite() . '/' . $view, $this->data_array['body']);
99
+			}
104 100
 		}
105 101
         
106 102
         if (URLDecode::getSite() == 'waterfalls') {
@@ -109,62 +105,52 @@  discard block
 block discarded – undo
109 105
             Loader::load('view', '/Foot', array('tracking_code' => self::$TRACKING_CODE));
110 106
         }
111 107
 		
112
-		if($view == '/404' || $view == '/503')
113
-			exit;
108
+		if($view == '/404' || $view == '/503') {
109
+					exit;
110
+		}
114 111
 	}
115 112
 
116
-	protected function set_header_method($method)
117
-	{
113
+	protected function set_header_method($method) {
118 114
 		$this->headers = $method;
119 115
 	}
120 116
 
121
-	protected function set_title($value)
122
-	{
117
+	protected function set_title($value) {
123 118
 		$this->set_head('title', $value);
124 119
 	}
125 120
 
126
-	protected function set_author($value)
127
-	{
121
+	protected function set_author($value) {
128 122
 		$this->set_head('author', $value);
129 123
 	}
130 124
 
131
-	protected function set_description($value)
132
-	{
125
+	protected function set_description($value) {
133 126
 		$this->set_head('description', $value);
134 127
 	}
135 128
 
136
-	protected function set_keywords($array)
137
-	{
129
+	protected function set_keywords($array) {
138 130
 		$this->set_head('keywords', implode(', ', $array));
139 131
 	}
140 132
 	
141
-	protected function set_canonical($url)
142
-	{
133
+	protected function set_canonical($url) {
143 134
 		$this->set_head('canonical', $url);
144 135
 	}
145 136
 
146
-	protected function set_head($set, $value)
147
-	{
137
+	protected function set_head($set, $value) {
148 138
 		$this->data_array['head'][$set] = $value;
149 139
 	}
150 140
 
151
-	protected function set_body($set, $value)
152
-	{
141
+	protected function set_body($set, $value) {
153 142
 		$this->data_array['body'][$set] = $value;
154 143
 	}
155 144
 
156
-	protected function add_css($file, $version = 1)
157
-	{
145
+	protected function add_css($file, $version = 1) {
158 146
 		$this->css_array[] = [$file, $version];
159 147
 	}
160 148
 
161
-	protected function add_js($file)
162
-	{
149
+	protected function add_js($file) {
163 150
 		$this->js_array[] = $file;
164 151
 	}
165 152
 
166
-	private function load_assets()
167
-	{
153
+	private function load_assets() {
168 154
     $css_array = array_map(function ($stylesheet) {
169 155
       $path = "/css/{$stylesheet[0]}.css";
170 156
       if ($stylesheet[1] > 1) {
@@ -183,40 +169,39 @@  discard block
 block discarded – undo
183 169
 		$this->set_head('js_link_array', $js_array);
184 170
 	}
185 171
 
186
-	protected function set_body_view($view)
187
-	{
172
+	protected function set_body_view($view) {
188 173
 		$this->body_view_array[] = $view;
189 174
 	}
190 175
 
191
-	protected function eject()
192
-	{
193
-		if(get_class($this) !== 'Error404Controller')
194
-			Loader::loadNew('controller', '/Error404Controller')->activate();
176
+	protected function eject() {
177
+		if(get_class($this) !== 'Error404Controller') {
178
+					Loader::loadNew('controller', '/Error404Controller')->activate();
179
+		}
195 180
 	}
196 181
 
197
-	protected function unavailable()
198
-	{
199
-		if(get_class($this) !== 'Error503Controller')
200
-			Loader::loadNew('controller', '/Error503Controller')->activate();
182
+	protected function unavailable() {
183
+		if(get_class($this) !== 'Error503Controller') {
184
+					Loader::loadNew('controller', '/Error503Controller')->activate();
185
+		}
201 186
 	}
202 187
 
203
-	protected function redirect($uri, $method = 301)
204
-	{
188
+	protected function redirect($uri, $method = 301) {
205 189
 		switch($method)
206 190
 		{
207 191
 			case 301 :
208
-				if(get_class($this) !== 'Error301Controller')
209
-					Loader::loadNew('controller', '/Error301Controller', array($uri))->activate();
192
+				if(get_class($this) !== 'Error301Controller') {
193
+									Loader::loadNew('controller', '/Error301Controller', array($uri))->activate();
194
+				}
210 195
 				break;
211 196
 			case 303 :
212
-				if(get_class($this) !== 'Error303Controller')
213
-					Loader::loadNew('controller', '/Error303Controller', array($uri))->activate();
197
+				if(get_class($this) !== 'Error303Controller') {
198
+									Loader::loadNew('controller', '/Error303Controller', array($uri))->activate();
199
+				}
214 200
 				break;
215 201
 		}
216 202
 	}
217 203
 
218
-	final protected function get_parsed_date($date)
219
-	{
204
+	final protected function get_parsed_date($date) {
220 205
 		$parsed_date = new stdclass();
221 206
 		
222 207
 		$parsed_date->stamp = date('c', strtotime($date));
@@ -227,8 +212,7 @@  discard block
 block discarded – undo
227 212
 	}
228 213
 
229 214
 	private $comment_errors;
230
-	protected function handle_comment_submit($site_id, $path, $redirect_url, $page_title)
231
-	{
215
+	protected function handle_comment_submit($site_id, $path, $redirect_url, $page_title) {
232 216
 		if(Request::hasPost() && Request::getPost('submit') == 'Submit Comment')
233 217
 		{
234 218
 			$parameters = array($site_id, $path, $redirect_url, $page_title);
@@ -238,8 +222,7 @@  discard block
 block discarded – undo
238 222
 		return;
239 223
 	}
240 224
 
241
-	protected function get_comment_array($site, $path)
242
-	{
225
+	protected function get_comment_array($site, $path) {
243 226
 		Loader::load('collector', 'comment/CommentCollector');
244 227
 		
245 228
 		$commenter = $this->get_commenter();
@@ -257,18 +240,19 @@  discard block
 block discarded – undo
257 240
 			$comment_object->url = $comment->url;
258 241
 			$comment_object->trusted = $comment->trusted;
259 242
 			
260
-			if($comment->reply == 0 && Request::getPost('type') == $comment->id)
261
-				$comment_object->errors = $this->comment_errors;
262
-			else
263
-				$comment_object->errors = array();
243
+			if($comment->reply == 0 && Request::getPost('type') == $comment->id) {
244
+							$comment_object->errors = $this->comment_errors;
245
+			} else {
246
+							$comment_object->errors = array();
247
+			}
264 248
 			
265 249
 			if($comment->reply == 0)
266 250
 			{
267 251
 				$comment_object->replies = array();
268 252
 				$comment_array[$comment->id] = $comment_object;
269
-			}
270
-			else
271
-				$comment_array[$comment->reply]->replies[$comment->id] = $comment_object;
253
+			} else {
254
+							$comment_array[$comment->reply]->replies[$comment->id] = $comment_object;
255
+			}
272 256
 		}
273 257
 		
274 258
 		$comment_count = CommentCollector::getCommentCountForURL($site, $path);
@@ -280,8 +264,7 @@  discard block
 block discarded – undo
280 264
 			'comment_count' => $comment_count);
281 265
 	}
282 266
 
283
-	private function get_commenter()
284
-	{
267
+	private function get_commenter() {
285 268
 		Loader::load('collector', 'comment/CommentCollector');
286 269
 
287 270
 		$commenter = new stdclass();
@@ -297,16 +280,19 @@  discard block
 block discarded – undo
297 280
 
298 281
 		$commenter_cookie_value = json_decode($_COOKIE['commenter']);
299 282
 		
300
-		if($commenter_cookie_value === NULL)
301
-			return $commenter;
283
+		if($commenter_cookie_value === NULL) {
284
+					return $commenter;
285
+		}
302 286
 		
303
-		if(!isset($commenter_cookie_value->name) || !isset($commenter_cookie_value->email))
304
-			return $commenter;
287
+		if(!isset($commenter_cookie_value->name) || !isset($commenter_cookie_value->email)) {
288
+					return $commenter;
289
+		}
305 290
 		
306 291
 		$commenter_object = CommentCollector::getCommenterByFields($commenter_cookie_value->name, $commenter_cookie_value->email, (isset($commenter_cookie_value->website) ? $commenter_cookie_value->website : ''));
307 292
 		
308
-		if($commenter_object === NULL)
309
-			return $commenter;
293
+		if($commenter_object === NULL) {
294
+					return $commenter;
295
+		}
310 296
 		
311 297
 		$commenter->id = $commenter_object->id;
312 298
 		$commenter->name = $commenter_object->name;
Please login to merge, or discard this patch.
controller/lifestream/TagController.class.inc.php 1 patch
Braces   +28 added lines, -34 removed lines patch added patch discarded remove patch
@@ -2,8 +2,8 @@  discard block
 block discarded – undo
2 2
 
3 3
 Loader::load('controller', 'lifestream/DefaultListController');
4 4
 
5
-final class TagController extends DefaultListController
6
-{
5
+final class TagController extends DefaultListController
6
+{
7 7
 
8 8
 	private static $TITLE = "%s Activity | Jacob Emerick's Lifestream";
9 9
 	private static $DESCRIPTION = "%s activity on Jacob Emerick's lifestream, all nice and paginated in one awesome website.";
@@ -17,15 +17,13 @@  discard block
 block discarded – undo
17 17
 
18 18
 	private $tag;
19 19
 
20
-	public function __construct()
21
-	{
20
+	public function __construct() {
22 21
 		parent::__construct();
23 22
 		
24 23
 		$this->tag = URLDecode::getPiece(1);
25 24
 	}
26 25
 
27
-	protected function set_head_data()
28
-	{
26
+	protected function set_head_data() {
29 27
 		$this->set_title(sprintf(self::$TITLE, ucwords($this->tag)));
30 28
 		$this->set_description(sprintf(self::$DESCRIPTION, ucwords($this->tag)));
31 29
 		
@@ -36,16 +34,14 @@  discard block
 block discarded – undo
36 34
 		parent::set_head_data();
37 35
 	}
38 36
 
39
-	protected function set_body_data()
40
-	{
37
+	protected function set_body_data() {
41 38
 		$this->set_body('title', $this->get_title());
42 39
 		$this->set_body('description', $this->get_description());
43 40
 		
44 41
 		parent::set_body_data();
45 42
 	}
46 43
 
47
-	private function get_title()
48
-	{
44
+	private function get_title() {
49 45
 		switch($this->tag)
50 46
 		{
51 47
 			case 'blog' :
@@ -72,8 +68,7 @@  discard block
 block discarded – undo
72 68
 		}
73 69
 	}
74 70
 
75
-	private function get_description()
76
-	{
71
+	private function get_description() {
77 72
 		switch($this->tag)
78 73
 		{
79 74
 			case 'blog' :
@@ -100,48 +95,47 @@  discard block
 block discarded – undo
100 95
 		}
101 96
 	}
102 97
 
103
-	protected function get_page_number()
104
-	{
98
+	protected function get_page_number() {
105 99
 		$page = URLDecode::getPiece(3);
106
-		if(isset($page) && is_numeric($page))
107
-			return $page;
100
+		if(isset($page) && is_numeric($page)) {
101
+					return $page;
102
+		}
108 103
 		return 1;
109 104
 	}
110 105
 
111
-	protected function get_list_results()
112
-	{
106
+	protected function get_list_results() {
113 107
 		return $this->activityRepository->getActivitiesByType($this->tag, self::$POSTS_PER_PAGE, $this->offset);
114 108
 	}
115 109
 
116
-	protected function get_list_description()
117
-	{
110
+	protected function get_list_description() {
118 111
 		$start = $this->offset + 1;
119 112
 		$end = min($this->offset + self::$POSTS_PER_PAGE, $this->get_total_post_count());
120 113
 		
121 114
 		return sprintf(self::$LIST_DESCRIPTION, $start, $end, $this->get_total_post_count(), $this->tag);
122 115
 	}
123 116
 
124
-	protected function get_list_next_link()
125
-	{
126
-		if($this->page == 1)
127
-			return;
128
-		if($this->page == 2)
129
-			return Loader::getRootUrl('lifestream') . $this->tag . '/';
117
+	protected function get_list_next_link() {
118
+		if($this->page == 1) {
119
+					return;
120
+		}
121
+		if($this->page == 2) {
122
+					return Loader::getRootUrl('lifestream') . $this->tag . '/';
123
+		}
130 124
 		return Loader::getRootUrl('lifestream') . $this->tag . '/page/' . ($this->page - 1) . '/';
131 125
 	}
132 126
 
133
-	protected function get_list_prev_link()
134
-	{
135
-		if(($this->page * self::$POSTS_PER_PAGE) >= $this->get_total_post_count())
136
-			return;
127
+	protected function get_list_prev_link() {
128
+		if(($this->page * self::$POSTS_PER_PAGE) >= $this->get_total_post_count()) {
129
+					return;
130
+		}
137 131
 		return Loader::getRootUrl('lifestream') . $this->tag . '/page/' . ($this->page + 1) . '/';
138 132
 	}
139 133
 
140 134
 	private $total_post_count;
141
-	protected function get_total_post_count()
142
-	{
143
-		if(!isset($this->total_post_count))
144
-			$this->total_post_count = $this->activityRepository->getActivitiesByTypeCount($this->tag);
135
+	protected function get_total_post_count() {
136
+		if(!isset($this->total_post_count)) {
137
+					$this->total_post_count = $this->activityRepository->getActivitiesByTypeCount($this->tag);
138
+		}
145 139
 		return $this->total_post_count;
146 140
 	}
147 141
 
Please login to merge, or discard this patch.
controller/lifestream/PostController.class.inc.php 1 patch
Braces   +16 added lines, -18 removed lines patch added patch discarded remove patch
@@ -2,8 +2,8 @@  discard block
 block discarded – undo
2 2
 
3 3
 Loader::load('controller', 'lifestream/DefaultPageController');
4 4
 
5
-final class PostController extends DefaultPageController
6
-{
5
+final class PostController extends DefaultPageController
6
+{
7 7
 
8 8
 	private static $TITLE = "Post %d | %s Activity | Jacob Emerick's Lifestream";
9 9
 	private static $DESCRIPTION = "Post %d of %s activity on Jacob Emerick's Lifestream.";
@@ -15,26 +15,27 @@  discard block
 block discarded – undo
15 15
 
16 16
 	private $post;
17 17
 
18
-	public function __construct()
19
-	{
18
+	public function __construct() {
20 19
 		parent::__construct();
21 20
 		
22 21
 		$id = URLDecode::getPiece(2);
23
-		if(!$id || !is_numeric($id))
24
-			$this->eject();
22
+		if(!$id || !is_numeric($id)) {
23
+					$this->eject();
24
+		}
25 25
 		
26 26
 		$post = $this->activityRepository->getActivityById($id);
27
-		if(!$post)
28
-			$this->eject();
27
+		if(!$post) {
28
+					$this->eject();
29
+		}
29 30
 		
30
-		if(URLDecode::getPiece(1) != $post['type'])
31
-			$this->eject();
31
+		if(URLDecode::getPiece(1) != $post['type']) {
32
+					$this->eject();
33
+		}
32 34
 		
33 35
 		$this->post = $post;
34 36
 	}
35 37
 
36
-	protected function set_head_data()
37
-	{
38
+	protected function set_head_data() {
38 39
 		$this->set_title(sprintf(self::$TITLE, $this->post['id'], ucwords($this->post['type'])));
39 40
 		$this->set_description(sprintf(self::$DESCRIPTION, $this->post['id'], ucwords($this->post['type'])));
40 41
 		
@@ -45,8 +46,7 @@  discard block
 block discarded – undo
45 46
 		parent::set_head_data();
46 47
 	}
47 48
 
48
-	protected function set_body_data()
49
-	{
49
+	protected function set_body_data() {
50 50
 		$this->set_body('title', $this->get_title());
51 51
 		$this->set_body('description', $this->get_description());
52 52
 		
@@ -57,8 +57,7 @@  discard block
 block discarded – undo
57 57
 		parent::set_body_data();
58 58
 	}
59 59
 
60
-	private function get_title()
61
-	{
60
+	private function get_title() {
62 61
 		switch($this->post['type'])
63 62
 		{
64 63
 			case 'blog' :
@@ -85,8 +84,7 @@  discard block
 block discarded – undo
85 84
 		}
86 85
 	}
87 86
 
88
-	private function get_description()
89
-	{
87
+	private function get_description() {
90 88
 		switch($this->post['type'])
91 89
 		{
92 90
 			case 'blog' :
Please login to merge, or discard this patch.
controller/lifestream/DefaultListController.class.inc.php 1 patch
Braces   +10 added lines, -14 removed lines patch added patch discarded remove patch
@@ -2,16 +2,15 @@  discard block
 block discarded – undo
2 2
 
3 3
 Loader::load('controller', 'lifestream/DefaultPageController');
4 4
 
5
-abstract class DefaultListController extends DefaultPageController
6
-{
5
+abstract class DefaultListController extends DefaultPageController
6
+{
7 7
 
8 8
 	protected static $POSTS_PER_PAGE = 15;
9 9
 
10 10
 	protected $page;
11 11
 	protected $offset;
12 12
 
13
-	public function __construct()
14
-	{
13
+	public function __construct() {
15 14
 		parent::__construct();
16 15
 
17 16
 		$this->page = $this->get_page_number();
@@ -25,24 +24,21 @@  discard block
 block discarded – undo
25 24
 	abstract protected function get_list_prev_link();
26 25
 	abstract protected function get_total_post_count();
27 26
 
28
-	protected function set_head_data()
29
-	{
27
+	protected function set_head_data() {
30 28
 		parent::set_head_data();
31 29
 		
32 30
 		$this->set_head('next_link', $this->get_list_next_link());
33 31
 		$this->set_head('previous_link', $this->get_list_prev_link());
34 32
 	}
35 33
 
36
-	protected function set_body_data()
37
-	{
34
+	protected function set_body_data() {
38 35
 		parent::set_body_data();
39 36
 		
40 37
 		$this->set_body('view', 'Listing');
41 38
 		$this->set_body('data', $this->get_list_body_data());
42 39
 	}
43 40
 
44
-	final private function get_list_body_data()
45
-	{
41
+	final private function get_list_body_data() {
46 42
 		return array(
47 43
 			'posts' => $this->get_list_posts(),
48 44
 			'type' => 'list',
@@ -52,15 +48,15 @@  discard block
 block discarded – undo
52 48
 				'prev' => $this->get_list_prev_link()));
53 49
 	}
54 50
 
55
-	final private function get_list_posts()
56
-	{
51
+	final private function get_list_posts() {
57 52
 		$post_array = array();
58 53
 		foreach($this->get_list_results() as $post)
59 54
 		{
60 55
 			$post_array[] = $this->expand_post($post, 'full');
61 56
 		}
62
-		if(count($post_array) < 1 && URLDecode::getPiece(1) !== 'search')
63
-			$this->eject();
57
+		if(count($post_array) < 1 && URLDecode::getPiece(1) !== 'search') {
58
+					$this->eject();
59
+		}
64 60
 		return $post_array;
65 61
 	}
66 62
 
Please login to merge, or discard this patch.
controller/lifestream/DefaultPageController.class.inc.php 1 patch
Braces   +5 added lines, -8 removed lines patch added patch discarded remove patch
@@ -3,27 +3,24 @@
 block discarded – undo
3 3
 Loader::load('controller', '/PageController');
4 4
 Loader::load('utility', 'Content');
5 5
 
6
-abstract class DefaultPageController extends PageController
7
-{
6
+abstract class DefaultPageController extends PageController
7
+{
8 8
 
9 9
   protected $activityRepository;
10 10
 
11
-  public function __construct()
12
-  {
11
+  public function __construct() {
13 12
     parent::__construct();
14 13
 
15 14
     global $container;
16 15
     $this->activityRepository = new Jacobemerick\Web\Domain\Stream\Activity\MysqlActivityRepository($container['db_connection_locator']);
17 16
   }
18 17
 
19
-	protected function set_head_data()
20
-	{
18
+	protected function set_head_data() {
21 19
 		$this->add_css('normalize');
22 20
 		$this->add_css('lifestream', 2);
23 21
 	}
24 22
 
25
-	protected function set_body_data()
26
-	{
23
+	protected function set_body_data() {
27 24
 		$this->set_body_view('Page');
28 25
 	}
29 26
 
Please login to merge, or discard this patch.
controller/lifestream/HomeController.class.inc.php 1 patch
Braces   +25 added lines, -28 removed lines patch added patch discarded remove patch
@@ -2,8 +2,8 @@  discard block
 block discarded – undo
2 2
 
3 3
 Loader::load('controller', 'lifestream/DefaultListController');
4 4
 
5
-final class HomeController extends DefaultListController
6
-{
5
+final class HomeController extends DefaultListController
6
+{
7 7
 
8 8
 	private static $TITLE = "Jacob Emerick's Lifestream";
9 9
 	private static $DESCRIPTION = 'Lifestream for Jacob Emerick, a combination of his latest twitter, youtube, running, reading, and blogging activity.';
@@ -18,8 +18,7 @@  discard block
 block discarded – undo
18 18
 
19 19
 	private static $LIST_DESCRIPTION = 'viewing %d - %d of %d total activities';
20 20
 
21
-	protected function set_head_data()
22
-	{
21
+	protected function set_head_data() {
23 22
 		$this->set_title(self::$TITLE);
24 23
 		$this->set_description(self::$DESCRIPTION);
25 24
 		$this->set_keywords(self::$KEYWORD_ARRAY);
@@ -27,56 +26,54 @@  discard block
 block discarded – undo
27 26
 		parent::set_head_data();
28 27
 	}
29 28
 
30
-	protected function set_body_data()
31
-	{
29
+	protected function set_body_data() {
32 30
 		$this->set_body('title', "What's Jacob Up To?");
33 31
 		$this->set_body('description', "A combination of Jacob Emerick's tweets, runs, reads, blogs, and YouTubes all in <em>one awesome lifestream</em>.");
34 32
 		
35 33
 		parent::set_body_data();
36 34
 	}
37 35
 
38
-	protected function get_page_number()
39
-	{
36
+	protected function get_page_number() {
40 37
 		$page = URLDecode::getPiece(2);
41
-		if(isset($page) && is_numeric($page))
42
-			return $page;
38
+		if(isset($page) && is_numeric($page)) {
39
+					return $page;
40
+		}
43 41
 		return 1;
44 42
 	}
45 43
 
46
-	protected function get_list_results()
47
-	{
44
+	protected function get_list_results() {
48 45
     return $this->activityRepository->getActivities(self::$POSTS_PER_PAGE, $this->offset);
49 46
 	}
50 47
 
51
-	protected function get_list_description()
52
-	{
48
+	protected function get_list_description() {
53 49
 		$start = $this->offset + 1;
54 50
 		$end = min($this->offset + self::$POSTS_PER_PAGE, $this->get_total_post_count());
55 51
 		
56 52
 		return sprintf(self::$LIST_DESCRIPTION, $start, $end, $this->get_total_post_count());
57 53
 	}
58 54
 
59
-	protected function get_list_next_link()
60
-	{
61
-		if($this->page == 1)
62
-			return;
63
-		if($this->page == 2)
64
-			return Loader::getRootUrl('lifestream');
55
+	protected function get_list_next_link() {
56
+		if($this->page == 1) {
57
+					return;
58
+		}
59
+		if($this->page == 2) {
60
+					return Loader::getRootUrl('lifestream');
61
+		}
65 62
 		return Loader::getRootUrl('lifestream') . 'page/' . ($this->page - 1) . '/';
66 63
 	}
67 64
 
68
-	protected function get_list_prev_link()
69
-	{
70
-		if(($this->page * self::$POSTS_PER_PAGE) >= $this->get_total_post_count())
71
-			return;
65
+	protected function get_list_prev_link() {
66
+		if(($this->page * self::$POSTS_PER_PAGE) >= $this->get_total_post_count()) {
67
+					return;
68
+		}
72 69
 		return Loader::getRootUrl('lifestream') . 'page/' . ($this->page + 1) . '/';
73 70
 	}
74 71
 
75 72
 	private $total_post_count;
76
-	protected function get_total_post_count()
77
-	{
78
-		if(!isset($this->total_post_count))
79
-			$this->total_post_count = $this->activityRepository->getActivitiesCount();
73
+	protected function get_total_post_count() {
74
+		if(!isset($this->total_post_count)) {
75
+					$this->total_post_count = $this->activityRepository->getActivitiesCount();
76
+		}
80 77
 		return $this->total_post_count;
81 78
 	}
82 79
 
Please login to merge, or discard this patch.
controller/Error503Controller.class.inc.php 1 patch
Braces   +4 added lines, -6 removed lines patch added patch discarded remove patch
@@ -2,11 +2,10 @@  discard block
 block discarded – undo
2 2
 
3 3
 Loader::load('controller', '/PageController');
4 4
 
5
-class Error503Controller extends PageController
6
-{
5
+class Error503Controller extends PageController
6
+{
7 7
 
8
-	protected function set_head_data()
9
-	{
8
+	protected function set_head_data() {
10 9
 		$this->set_header_method('send503');
11 10
 		$this->add_css('normalize');
12 11
 		$this->add_css('503');
@@ -16,8 +15,7 @@  discard block
 block discarded – undo
16 15
 		$this->set_keywords(array());
17 16
 	}
18 17
 
19
-	protected function set_body_data()
20
-	{
18
+	protected function set_body_data() {
21 19
 		$this->set_body_view('/503');
22 20
 	}
23 21
 
Please login to merge, or discard this patch.