Completed
Push — master ( cda546...72ee7f )
by Jacob
03:25
created
controller/home/ContactController.class.inc.php 3 patches
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -35,16 +35,16 @@  discard block
 block discarded – undo
35 35
 
36 36
 	private function process_form()
37 37
 	{
38
-		if(!Request::hasPost() || Request::getPost('submit') != 'Send Message!')
38
+		if (!Request::hasPost() || Request::getPost('submit') != 'Send Message!')
39 39
 			return (object) array('display' => 'normal');
40 40
 		
41 41
 		Loader::load('utility', 'Validate');
42 42
 		$error_result = array();
43
-		if(!Validate::checkRequest('post', 'name', 'string'))
43
+		if (!Validate::checkRequest('post', 'name', 'string'))
44 44
 			$error_result['name'] = 'please enter your name';
45
-		if(!Validate::checkRequest('post', 'email', 'string'))
45
+		if (!Validate::checkRequest('post', 'email', 'string'))
46 46
 			$error_result['email'] = 'please enter a valid email';
47
-		if(!Validate::checkRequest('post', 'message', 'string'))
47
+		if (!Validate::checkRequest('post', 'message', 'string'))
48 48
 			$error_result['message'] = 'please write a message';
49 49
 		
50 50
 		$values = (object) array(
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
 			'email' => Request::getPost('email'),
53 53
 			'message' => Request::getPost('message'));
54 54
 		
55
-		if(count($error_result) > 0)
55
+		if (count($error_result) > 0)
56 56
 		{
57 57
 			return (object) array(
58 58
 				'display' => 'error',
@@ -65,8 +65,8 @@  discard block
 block discarded – undo
65 65
       ->addTo($container['config']->admin_email)
66 66
       ->setSubject('Home Page Contact')
67 67
       ->setPlainMessage(
68
-        "Name: {$values->name}\n" .
69
-        "Email: {$values->email}\n" .
68
+        "Name: {$values->name}\n".
69
+        "Email: {$values->email}\n".
70 70
         "Message: {$values->message}"
71 71
       )
72 72
       ->send();		
Please login to merge, or discard this patch.
Indentation   +52 added lines, -52 removed lines patch added patch discarded remove patch
@@ -5,73 +5,73 @@
 block discarded – undo
5 5
 final class ContactController extends DefaultPageController
6 6
 {
7 7
 
8
-	private static $TITLE = 'Contact | Jacob Emerick';
9
-	private static $DESCRIPTION = 'Contact page to reach Jacob Emerick by email or social networks';
8
+    private static $TITLE = 'Contact | Jacob Emerick';
9
+    private static $DESCRIPTION = 'Contact page to reach Jacob Emerick by email or social networks';
10 10
 
11
-	private static $KEYWORD_ARRAY = array(
12
-		'Jacob Emerick',
13
-		'jacobemerick',
14
-		'jpemeric',
15
-		'contact',
16
-		'email',
17
-		'connect');
11
+    private static $KEYWORD_ARRAY = array(
12
+        'Jacob Emerick',
13
+        'jacobemerick',
14
+        'jpemeric',
15
+        'contact',
16
+        'email',
17
+        'connect');
18 18
 
19
-	protected function set_head_data()
20
-	{
21
-		$this->set_title(self::$TITLE);
22
-		$this->set_description(self::$DESCRIPTION);
23
-		$this->set_keywords(self::$KEYWORD_ARRAY);
19
+    protected function set_head_data()
20
+    {
21
+        $this->set_title(self::$TITLE);
22
+        $this->set_description(self::$DESCRIPTION);
23
+        $this->set_keywords(self::$KEYWORD_ARRAY);
24 24
 		
25
-		parent::set_head_data();
26
-	}
25
+        parent::set_head_data();
26
+    }
27 27
 
28
-	protected function set_body_data()
29
-	{
30
-		$this->set_body('form_container', $this->process_form());
31
-		$this->set_body_view('Contact');
28
+    protected function set_body_data()
29
+    {
30
+        $this->set_body('form_container', $this->process_form());
31
+        $this->set_body_view('Contact');
32 32
 		
33
-		parent::set_body_data();
34
-	}
33
+        parent::set_body_data();
34
+    }
35 35
 
36
-	private function process_form()
37
-	{
38
-		if(!Request::hasPost() || Request::getPost('submit') != 'Send Message!')
39
-			return (object) array('display' => 'normal');
36
+    private function process_form()
37
+    {
38
+        if(!Request::hasPost() || Request::getPost('submit') != 'Send Message!')
39
+            return (object) array('display' => 'normal');
40 40
 		
41
-		Loader::load('utility', 'Validate');
42
-		$error_result = array();
43
-		if(!Validate::checkRequest('post', 'name', 'string'))
44
-			$error_result['name'] = 'please enter your name';
45
-		if(!Validate::checkRequest('post', 'email', 'string'))
46
-			$error_result['email'] = 'please enter a valid email';
47
-		if(!Validate::checkRequest('post', 'message', 'string'))
48
-			$error_result['message'] = 'please write a message';
41
+        Loader::load('utility', 'Validate');
42
+        $error_result = array();
43
+        if(!Validate::checkRequest('post', 'name', 'string'))
44
+            $error_result['name'] = 'please enter your name';
45
+        if(!Validate::checkRequest('post', 'email', 'string'))
46
+            $error_result['email'] = 'please enter a valid email';
47
+        if(!Validate::checkRequest('post', 'message', 'string'))
48
+            $error_result['message'] = 'please write a message';
49 49
 		
50
-		$values = (object) array(
51
-			'name' => Request::getPost('name'),
52
-			'email' => Request::getPost('email'),
53
-			'message' => Request::getPost('message'));
50
+        $values = (object) array(
51
+            'name' => Request::getPost('name'),
52
+            'email' => Request::getPost('email'),
53
+            'message' => Request::getPost('message'));
54 54
 		
55
-		if(count($error_result) > 0)
56
-		{
57
-			return (object) array(
58
-				'display' => 'error',
59
-				'messages' => $error_result,
60
-				'values' => $values);
61
-		}
55
+        if(count($error_result) > 0)
56
+        {
57
+            return (object) array(
58
+                'display' => 'error',
59
+                'messages' => $error_result,
60
+                'values' => $values);
61
+        }
62 62
 
63 63
     global $container;
64 64
     $sent = $container['mail']
65
-      ->addTo($container['config']->admin_email)
66
-      ->setSubject('Home Page Contact')
67
-      ->setPlainMessage(
65
+        ->addTo($container['config']->admin_email)
66
+        ->setSubject('Home Page Contact')
67
+        ->setPlainMessage(
68 68
         "Name: {$values->name}\n" .
69 69
         "Email: {$values->email}\n" .
70 70
         "Message: {$values->message}"
71
-      )
72
-      ->send();		
71
+        )
72
+        ->send();		
73 73
 
74
-		return (object) array('display' => 'success');
75
-	}
74
+        return (object) array('display' => 'success');
75
+    }
76 76
 
77 77
 }
Please login to merge, or discard this patch.
Braces   +17 added lines, -16 removed lines patch added patch discarded remove patch
@@ -2,8 +2,8 @@  discard block
 block discarded – undo
2 2
 
3 3
 Loader::load('controller', 'home/DefaultPageController');
4 4
 
5
-final class ContactController extends DefaultPageController
6
-{
5
+final class ContactController extends DefaultPageController
6
+{
7 7
 
8 8
 	private static $TITLE = 'Contact | Jacob Emerick';
9 9
 	private static $DESCRIPTION = 'Contact page to reach Jacob Emerick by email or social networks';
@@ -16,8 +16,7 @@  discard block
 block discarded – undo
16 16
 		'email',
17 17
 		'connect');
18 18
 
19
-	protected function set_head_data()
20
-	{
19
+	protected function set_head_data() {
21 20
 		$this->set_title(self::$TITLE);
22 21
 		$this->set_description(self::$DESCRIPTION);
23 22
 		$this->set_keywords(self::$KEYWORD_ARRAY);
@@ -25,27 +24,29 @@  discard block
 block discarded – undo
25 24
 		parent::set_head_data();
26 25
 	}
27 26
 
28
-	protected function set_body_data()
29
-	{
27
+	protected function set_body_data() {
30 28
 		$this->set_body('form_container', $this->process_form());
31 29
 		$this->set_body_view('Contact');
32 30
 		
33 31
 		parent::set_body_data();
34 32
 	}
35 33
 
36
-	private function process_form()
37
-	{
38
-		if(!Request::hasPost() || Request::getPost('submit') != 'Send Message!')
39
-			return (object) array('display' => 'normal');
34
+	private function process_form() {
35
+		if(!Request::hasPost() || Request::getPost('submit') != 'Send Message!') {
36
+					return (object) array('display' => 'normal');
37
+		}
40 38
 		
41 39
 		Loader::load('utility', 'Validate');
42 40
 		$error_result = array();
43
-		if(!Validate::checkRequest('post', 'name', 'string'))
44
-			$error_result['name'] = 'please enter your name';
45
-		if(!Validate::checkRequest('post', 'email', 'string'))
46
-			$error_result['email'] = 'please enter a valid email';
47
-		if(!Validate::checkRequest('post', 'message', 'string'))
48
-			$error_result['message'] = 'please write a message';
41
+		if(!Validate::checkRequest('post', 'name', 'string')) {
42
+					$error_result['name'] = 'please enter your name';
43
+		}
44
+		if(!Validate::checkRequest('post', 'email', 'string')) {
45
+					$error_result['email'] = 'please enter a valid email';
46
+		}
47
+		if(!Validate::checkRequest('post', 'message', 'string')) {
48
+					$error_result['message'] = 'please write a message';
49
+		}
49 50
 		
50 51
 		$values = (object) array(
51 52
 			'name' => Request::getPost('name'),
Please login to merge, or discard this patch.
controller/home/HomeController.class.inc.php 3 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -48,11 +48,11 @@
 block discarded – undo
48 48
     $recentPosts = $postRepository->getActivePosts(3);
49 49
 
50 50
 		$recent_post_array = array();
51
-		foreach($recentPosts as $postResult)
51
+		foreach ($recentPosts as $postResult)
52 52
 		{
53 53
 			$post = new stdclass();
54 54
 			$post->title = $postResult['title'];
55
-			$post->url = Loader::getRootUrl('blog') . "{$postResult['category']}/{$postResult['path']}/";
55
+			$post->url = Loader::getRootUrl('blog')."{$postResult['category']}/{$postResult['path']}/";
56 56
 			$post->category = ucwords(str_replace('-', ' ', $postResult['category']));
57 57
 			$post->thumb = Content::instance('FetchFirstPhoto', $postResult['body'])->activate();
58 58
 			$post->body = Content::instance('SmartTrim', $postResult['body'])->activate(($post->thumb !== '') ? self::$POST_LENGTH_SHORT : self::$POST_LENGTH_LONG);
Please login to merge, or discard this patch.
Indentation   +41 added lines, -41 removed lines patch added patch discarded remove patch
@@ -8,58 +8,58 @@
 block discarded – undo
8 8
 final class HomeController extends DefaultPageController
9 9
 {
10 10
 
11
-	private static $TITLE = "Jacob Emerick's Home | Web Developer, Hiker, Innovator";
12
-	private static $DESCRIPTION = 'Home page for Jacob Emerick, with links to his blog, waterfall site, and other side projects';
11
+    private static $TITLE = "Jacob Emerick's Home | Web Developer, Hiker, Innovator";
12
+    private static $DESCRIPTION = 'Home page for Jacob Emerick, with links to his blog, waterfall site, and other side projects';
13 13
 
14
-	private static $KEYWORD_ARRAY = array(
15
-		'Jacob Emerick',
16
-		'jacobemerick',
17
-		'jpemeric',
18
-		'home',
19
-		'web developer',
20
-		'hiker',
21
-		'application programmer',
22
-		'innovator');
14
+    private static $KEYWORD_ARRAY = array(
15
+        'Jacob Emerick',
16
+        'jacobemerick',
17
+        'jpemeric',
18
+        'home',
19
+        'web developer',
20
+        'hiker',
21
+        'application programmer',
22
+        'innovator');
23 23
 
24
-	private static $POST_LENGTH_SHORT = 160;
25
-	private static $POST_LENGTH_LONG = 240;
24
+    private static $POST_LENGTH_SHORT = 160;
25
+    private static $POST_LENGTH_LONG = 240;
26 26
 
27
-	protected function set_head_data()
28
-	{
29
-		$this->set_title(self::$TITLE);
30
-		$this->set_description(self::$DESCRIPTION);
31
-		$this->set_keywords(self::$KEYWORD_ARRAY);
27
+    protected function set_head_data()
28
+    {
29
+        $this->set_title(self::$TITLE);
30
+        $this->set_description(self::$DESCRIPTION);
31
+        $this->set_keywords(self::$KEYWORD_ARRAY);
32 32
 		
33
-		parent::set_head_data();
34
-	}
33
+        parent::set_head_data();
34
+    }
35 35
 
36
-	protected function set_body_data()
37
-	{
38
-		$this->set_body('post_array', $this->get_recent_posts());
39
-		$this->set_body_view('Home');
36
+    protected function set_body_data()
37
+    {
38
+        $this->set_body('post_array', $this->get_recent_posts());
39
+        $this->set_body_view('Home');
40 40
 		
41
-		parent::set_body_data();
42
-	}
41
+        parent::set_body_data();
42
+    }
43 43
 
44
-	private function get_recent_posts()
45
-	{
44
+    private function get_recent_posts()
45
+    {
46 46
     global $container;
47 47
     $postRepository = new MysqlPostRepository($container['db_connection_locator']);
48 48
     $recentPosts = $postRepository->getActivePosts(3);
49 49
 
50
-		$recent_post_array = array();
51
-		foreach($recentPosts as $postResult)
52
-		{
53
-			$post = new stdclass();
54
-			$post->title = $postResult['title'];
55
-			$post->url = Loader::getRootUrl('blog') . "{$postResult['category']}/{$postResult['path']}/";
56
-			$post->category = ucwords(str_replace('-', ' ', $postResult['category']));
57
-			$post->thumb = Content::instance('FetchFirstPhoto', $postResult['body'])->activate();
58
-			$post->body = Content::instance('SmartTrim', $postResult['body'])->activate(($post->thumb !== '') ? self::$POST_LENGTH_SHORT : self::$POST_LENGTH_LONG);
50
+        $recent_post_array = array();
51
+        foreach($recentPosts as $postResult)
52
+        {
53
+            $post = new stdclass();
54
+            $post->title = $postResult['title'];
55
+            $post->url = Loader::getRootUrl('blog') . "{$postResult['category']}/{$postResult['path']}/";
56
+            $post->category = ucwords(str_replace('-', ' ', $postResult['category']));
57
+            $post->thumb = Content::instance('FetchFirstPhoto', $postResult['body'])->activate();
58
+            $post->body = Content::instance('SmartTrim', $postResult['body'])->activate(($post->thumb !== '') ? self::$POST_LENGTH_SHORT : self::$POST_LENGTH_LONG);
59 59
 						
60
-			$recent_post_array[] = $post;
61
-		}
62
-		return $recent_post_array;
63
-	}
60
+            $recent_post_array[] = $post;
61
+        }
62
+        return $recent_post_array;
63
+    }
64 64
 
65 65
 }
Please login to merge, or discard this patch.
Braces   +5 added lines, -8 removed lines patch added patch discarded remove patch
@@ -5,8 +5,8 @@  discard block
 block discarded – undo
5 5
 Loader::load('controller', 'home/DefaultPageController');
6 6
 Loader::load('utility', 'Content');
7 7
 
8
-final class HomeController extends DefaultPageController
9
-{
8
+final class HomeController extends DefaultPageController
9
+{
10 10
 
11 11
 	private static $TITLE = "Jacob Emerick's Home | Web Developer, Hiker, Innovator";
12 12
 	private static $DESCRIPTION = 'Home page for Jacob Emerick, with links to his blog, waterfall site, and other side projects';
@@ -24,8 +24,7 @@  discard block
 block discarded – undo
24 24
 	private static $POST_LENGTH_SHORT = 160;
25 25
 	private static $POST_LENGTH_LONG = 240;
26 26
 
27
-	protected function set_head_data()
28
-	{
27
+	protected function set_head_data() {
29 28
 		$this->set_title(self::$TITLE);
30 29
 		$this->set_description(self::$DESCRIPTION);
31 30
 		$this->set_keywords(self::$KEYWORD_ARRAY);
@@ -33,16 +32,14 @@  discard block
 block discarded – undo
33 32
 		parent::set_head_data();
34 33
 	}
35 34
 
36
-	protected function set_body_data()
37
-	{
35
+	protected function set_body_data() {
38 36
 		$this->set_body('post_array', $this->get_recent_posts());
39 37
 		$this->set_body_view('Home');
40 38
 		
41 39
 		parent::set_body_data();
42 40
 	}
43 41
 
44
-	private function get_recent_posts()
45
-	{
42
+	private function get_recent_posts() {
46 43
     global $container;
47 44
     $postRepository = new MysqlPostRepository($container['db_connection_locator']);
48 45
     $recentPosts = $postRepository->getActivePosts(3);
Please login to merge, or discard this patch.
controller/blog/TagController.class.inc.php 3 patches
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
         $repository = new Jacobemerick\Web\Domain\Blog\Tag\MysqlTagRepository($container['db_connection_locator']);
31 31
         $tag_result = $repository->findTagByTitle($tag);
32 32
 
33
-		if($tag_result === false)
33
+		if ($tag_result === false)
34 34
 			$this->eject();
35 35
 		
36 36
 		$this->tag = $tag_result;
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
 	{
43 43
 		parent::set_head_data();
44 44
 		
45
-		if($this->page == 1)
45
+		if ($this->page == 1)
46 46
 		{
47 47
 			$this->set_title(sprintf(self::$TITLE_MAIN, ucwords($this->tag['tag'])));
48 48
 			$this->set_description(sprintf(self::$DESCRIPTION_MAIN, ucwords($this->tag['tag'])));
@@ -62,13 +62,13 @@  discard block
 block discarded – undo
62 62
 	{
63 63
 		$tag = ucwords($this->tag['tag']);
64 64
 		
65
-		if($this->page == 1)
65
+		if ($this->page == 1)
66 66
 		{
67 67
         global $container;
68 68
         $repository = new Jacobemerick\Web\Domain\Blog\Introduction\MysqlIntroductionRepository($container['db_connection_locator']);
69 69
         $introduction_result = $repository->findByType('tag', $this->tag['tag']);
70 70
 			
71
-			if($introduction_result !== false)
71
+			if ($introduction_result !== false)
72 72
 			{
73 73
 				$introduction = array();
74 74
 				$introduction['title'] = $introduction_result['title'];
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
 	protected function get_page_number()
90 90
 	{
91 91
 		$page = URLDecode::getPiece(3);
92
-		if(isset($page) && is_numeric($page))
92
+		if (isset($page) && is_numeric($page))
93 93
 			return $page;
94 94
 		return 1;
95 95
 	}
@@ -111,24 +111,24 @@  discard block
 block discarded – undo
111 111
 
112 112
 	protected function get_list_next_link()
113 113
 	{
114
-		if($this->page == 1)
114
+		if ($this->page == 1)
115 115
 			return;
116
-		if($this->page == 2)
116
+		if ($this->page == 2)
117 117
 			return Content::instance('URLSafe', "/tag/{$this->tag['tag']}/")->activate();
118
-		return Content::instance('URLSafe', "/tag/{$this->tag['tag']}/" . ($this->page - 1) . '/')->activate();
118
+		return Content::instance('URLSafe', "/tag/{$this->tag['tag']}/".($this->page - 1).'/')->activate();
119 119
 	}
120 120
 
121 121
 	protected function get_list_prev_link()
122 122
 	{
123
-		if(($this->page * self::$POSTS_PER_PAGE) >= $this->get_total_post_count())
123
+		if (($this->page * self::$POSTS_PER_PAGE) >= $this->get_total_post_count())
124 124
 			return;
125
-		return Content::instance('URLSafe', "/tag/{$this->tag['tag']}/" . ($this->page + 1) . '/')->activate();
125
+		return Content::instance('URLSafe', "/tag/{$this->tag['tag']}/".($this->page + 1).'/')->activate();
126 126
 	}
127 127
 
128 128
 	private $total_post_count;
129 129
 	protected function get_total_post_count()
130 130
 	{
131
-		if(!isset($this->total_post_count)) {
131
+		if (!isset($this->total_post_count)) {
132 132
         global $container;
133 133
         $repository = new Jacobemerick\Web\Domain\Blog\Post\MysqlPostRepository($container['db_connection_locator']);
134 134
         $this->total_post_count = $repository->getActivePostsCountByTag($this->tag['id']);
Please login to merge, or discard this patch.
Indentation   +98 added lines, -98 removed lines patch added patch discarded remove patch
@@ -5,136 +5,136 @@
 block discarded – undo
5 5
 final class TagController extends DefaultListController
6 6
 {
7 7
 
8
-	private static $TITLE_MAIN = "%s Tag | Jacob Emerick's Blog";
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.";
8
+    private static $TITLE_MAIN = "%s Tag | Jacob Emerick's Blog";
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.";
10 10
 
11
-	private static $TITLE_PAGINATED = "%s - Page %d of %d | Jacob Emerick's Blog";
12
-	private static $DESCRIPTION_PAGINATED = "Page %d of %d with posts tagged with %s on Jacob Emerick's Blog, a website about the hiking and development adventures of a young man.";
11
+    private static $TITLE_PAGINATED = "%s - Page %d of %d | Jacob Emerick's Blog";
12
+    private static $DESCRIPTION_PAGINATED = "Page %d of %d with posts tagged with %s on Jacob Emerick's Blog, a website about the hiking and development adventures of a young man.";
13 13
 
14
-	private static $KEYWORD_ARRAY = array(
15
-		'hiking',
16
-		'web development',
17
-		'blog',
18
-		'Jacob Emerick');
14
+    private static $KEYWORD_ARRAY = array(
15
+        'hiking',
16
+        'web development',
17
+        'blog',
18
+        'Jacob Emerick');
19 19
 
20
-	private static $LIST_DESCRIPTION = 'Viewing %d - %d of %d posts tagged with %s.';
20
+    private static $LIST_DESCRIPTION = 'Viewing %d - %d of %d posts tagged with %s.';
21 21
 
22
-	private $tag;
22
+    private $tag;
23 23
 
24
-	public function __construct()
25
-	{
26
-		$tag = URLDecode::getPiece(2);
27
-		$tag = str_replace('-', ' ', $tag);
24
+    public function __construct()
25
+    {
26
+        $tag = URLDecode::getPiece(2);
27
+        $tag = str_replace('-', ' ', $tag);
28 28
 
29 29
         global $container;
30 30
         $repository = new Jacobemerick\Web\Domain\Blog\Tag\MysqlTagRepository($container['db_connection_locator']);
31 31
         $tag_result = $repository->findTagByTitle($tag);
32 32
 
33
-		if($tag_result === false)
34
-			$this->eject();
33
+        if($tag_result === false)
34
+            $this->eject();
35 35
 		
36
-		$this->tag = $tag_result;
36
+        $this->tag = $tag_result;
37 37
 		
38
-		parent::__construct();
39
-	}
38
+        parent::__construct();
39
+    }
40 40
 
41
-	protected function set_head_data()
42
-	{
43
-		parent::set_head_data();
41
+    protected function set_head_data()
42
+    {
43
+        parent::set_head_data();
44 44
 		
45
-		if($this->page == 1)
46
-		{
47
-			$this->set_title(sprintf(self::$TITLE_MAIN, ucwords($this->tag['tag'])));
48
-			$this->set_description(sprintf(self::$DESCRIPTION_MAIN, ucwords($this->tag['tag'])));
49
-		}
50
-		else
51
-		{
52
-			$this->set_title(sprintf(self::$TITLE_PAGINATED, ucwords($this->tag['tag']), $this->page, $this->total_pages));
53
-			$this->set_description(sprintf(self::$DESCRIPTION_PAGINATED, $this->page, $this->total_pages, ucwords($this->tag['tag'])));
54
-		}
45
+        if($this->page == 1)
46
+        {
47
+            $this->set_title(sprintf(self::$TITLE_MAIN, ucwords($this->tag['tag'])));
48
+            $this->set_description(sprintf(self::$DESCRIPTION_MAIN, ucwords($this->tag['tag'])));
49
+        }
50
+        else
51
+        {
52
+            $this->set_title(sprintf(self::$TITLE_PAGINATED, ucwords($this->tag['tag']), $this->page, $this->total_pages));
53
+            $this->set_description(sprintf(self::$DESCRIPTION_PAGINATED, $this->page, $this->total_pages, ucwords($this->tag['tag'])));
54
+        }
55 55
 		
56
-		$keyword_array = self::$KEYWORD_ARRAY;
57
-		array_unshift($keyword_array, $this->tag['tag']);
58
-		$this->set_keywords($keyword_array);
59
-	}
60
-
61
-	protected function get_introduction()
62
-	{
63
-		$tag = ucwords($this->tag['tag']);
56
+        $keyword_array = self::$KEYWORD_ARRAY;
57
+        array_unshift($keyword_array, $this->tag['tag']);
58
+        $this->set_keywords($keyword_array);
59
+    }
60
+
61
+    protected function get_introduction()
62
+    {
63
+        $tag = ucwords($this->tag['tag']);
64 64
 		
65
-		if($this->page == 1)
66
-		{
65
+        if($this->page == 1)
66
+        {
67 67
         global $container;
68 68
         $repository = new Jacobemerick\Web\Domain\Blog\Introduction\MysqlIntroductionRepository($container['db_connection_locator']);
69 69
         $introduction_result = $repository->findByType('tag', $this->tag['tag']);
70 70
 			
71
-			if($introduction_result !== false)
72
-			{
73
-				$introduction = array();
74
-				$introduction['title'] = $introduction_result['title'];
75
-				$introduction['content'] = $introduction_result['content'];
76
-				$introduction['image'] = $this->get_introduction_image($introduction_result['image']);
71
+            if($introduction_result !== false)
72
+            {
73
+                $introduction = array();
74
+                $introduction['title'] = $introduction_result['title'];
75
+                $introduction['content'] = $introduction_result['content'];
76
+                $introduction['image'] = $this->get_introduction_image($introduction_result['image']);
77 77
 				
78
-				return $introduction;
79
-			}
78
+                return $introduction;
79
+            }
80 80
 			
81
-			return array(
82
-				'title' => "Viewing posts about {$tag}.");
83
-		}
81
+            return array(
82
+                'title' => "Viewing posts about {$tag}.");
83
+        }
84 84
 		
85
-		return array(
86
-			'title' => "{$tag} posts, page {$this->page} of {$this->total_pages}.");
87
-	}
88
-
89
-	protected function get_page_number()
90
-	{
91
-		$page = URLDecode::getPiece(3);
92
-		if(isset($page) && is_numeric($page))
93
-			return $page;
94
-		return 1;
95
-	}
96
-
97
-	protected function get_list_results()
98
-	{
85
+        return array(
86
+            'title' => "{$tag} posts, page {$this->page} of {$this->total_pages}.");
87
+    }
88
+
89
+    protected function get_page_number()
90
+    {
91
+        $page = URLDecode::getPiece(3);
92
+        if(isset($page) && is_numeric($page))
93
+            return $page;
94
+        return 1;
95
+    }
96
+
97
+    protected function get_list_results()
98
+    {
99 99
         global $container;
100 100
         $repository = new Jacobemerick\Web\Domain\Blog\Post\MysqlPostRepository($container['db_connection_locator']);
101 101
         return $repository->getActivePostsByTag($this->tag['id'], self::$POSTS_PER_PAGE, $this->offset);
102
-	}
102
+    }
103 103
 
104
-	protected function get_list_description()
105
-	{
106
-		$start = $this->offset + 1;
107
-		$end = min($this->offset + self::$POSTS_PER_PAGE, $this->get_total_post_count());
104
+    protected function get_list_description()
105
+    {
106
+        $start = $this->offset + 1;
107
+        $end = min($this->offset + self::$POSTS_PER_PAGE, $this->get_total_post_count());
108 108
 		
109
-		return sprintf(self::$LIST_DESCRIPTION, $start, $end, $this->get_total_post_count(), $this->tag['tag']);
110
-	}
111
-
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();
118
-		return Content::instance('URLSafe', "/tag/{$this->tag['tag']}/" . ($this->page - 1) . '/')->activate();
119
-	}
120
-
121
-	protected function get_list_prev_link()
122
-	{
123
-		if(($this->page * self::$POSTS_PER_PAGE) >= $this->get_total_post_count())
124
-			return;
125
-		return Content::instance('URLSafe', "/tag/{$this->tag['tag']}/" . ($this->page + 1) . '/')->activate();
126
-	}
127
-
128
-	private $total_post_count;
129
-	protected function get_total_post_count()
130
-	{
131
-		if(!isset($this->total_post_count)) {
109
+        return sprintf(self::$LIST_DESCRIPTION, $start, $end, $this->get_total_post_count(), $this->tag['tag']);
110
+    }
111
+
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();
118
+        return Content::instance('URLSafe', "/tag/{$this->tag['tag']}/" . ($this->page - 1) . '/')->activate();
119
+    }
120
+
121
+    protected function get_list_prev_link()
122
+    {
123
+        if(($this->page * self::$POSTS_PER_PAGE) >= $this->get_total_post_count())
124
+            return;
125
+        return Content::instance('URLSafe', "/tag/{$this->tag['tag']}/" . ($this->page + 1) . '/')->activate();
126
+    }
127
+
128
+    private $total_post_count;
129
+    protected function get_total_post_count()
130
+    {
131
+        if(!isset($this->total_post_count)) {
132 132
         global $container;
133 133
         $repository = new Jacobemerick\Web\Domain\Blog\Post\MysqlPostRepository($container['db_connection_locator']);
134 134
         $this->total_post_count = $repository->getActivePostsCountByTag($this->tag['id']);
135 135
     }
136 136
 
137
-		return $this->total_post_count;
138
-	}
137
+        return $this->total_post_count;
138
+    }
139 139
 
140 140
 }
Please login to merge, or discard this 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.
controller/blog/CategoryController.class.inc.php 3 patches
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -67,10 +67,10 @@  discard block
 block discarded – undo
67 67
 	{
68 68
 		parent::set_head_data();
69 69
 		
70
-		switch($this->category->display)
70
+		switch ($this->category->display)
71 71
 		{
72 72
 			case 'Hiking' :
73
-				if($this->page == 1)
73
+				if ($this->page == 1)
74 74
 				{
75 75
 					$this->set_title(self::$TITLE_MAIN_HIKING);
76 76
 					$this->set_description(self::$DESCRIPTION_MAIN_HIKING);
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
 				$this->set_keywords(self::$KEYWORD_ARRAY_HIKING);
84 84
 			break;
85 85
 			case 'Personal' :
86
-				if($this->page == 1)
86
+				if ($this->page == 1)
87 87
 				{
88 88
 					$this->set_title(self::$TITLE_MAIN_PERSONAL);
89 89
 					$this->set_description(self::$DESCRIPTION_MAIN_PERSONAL);
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
 				$this->set_keywords(self::$KEYWORD_ARRAY_PERSONAL);
97 97
 			break;
98 98
 			case 'Web Development' :
99
-				if($this->page == 1)
99
+				if ($this->page == 1)
100 100
 				{
101 101
 					$this->set_title(self::$TITLE_MAIN_WEBDEVELOPMENT);
102 102
 					$this->set_description(self::$DESCRIPTION_MAIN_WEBDEVELOPMENT);
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
 
114 114
 	protected function get_introduction()
115 115
 	{
116
-		if($this->page == 1)
116
+		if ($this->page == 1)
117 117
 		{
118 118
         global $container;
119 119
         $repository = new Jacobemerick\Web\Domain\Blog\Introduction\MysqlIntroductionRepository($container['db_connection_locator']);
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
 	protected function get_page_number()
135 135
 	{
136 136
 		$page = URLDecode::getPiece(2);
137
-		if(isset($page) && is_numeric($page))
137
+		if (isset($page) && is_numeric($page))
138 138
 			return $page;
139 139
 		return 1;
140 140
 	}
@@ -156,24 +156,24 @@  discard block
 block discarded – undo
156 156
 
157 157
 	protected function get_list_next_link()
158 158
 	{
159
-		if($this->page == 1)
159
+		if ($this->page == 1)
160 160
 			return;
161
-		if($this->page == 2)
161
+		if ($this->page == 2)
162 162
 			return Content::instance('URLSafe', "/{$this->category->link}/")->activate();
163
-		return Content::instance('URLSafe', "/{$this->category->link}/" . ($this->page - 1) . '/')->activate();
163
+		return Content::instance('URLSafe', "/{$this->category->link}/".($this->page - 1).'/')->activate();
164 164
 	}
165 165
 
166 166
 	protected function get_list_prev_link()
167 167
 	{
168
-		if(($this->page * self::$POSTS_PER_PAGE) >= $this->get_total_post_count())
168
+		if (($this->page * self::$POSTS_PER_PAGE) >= $this->get_total_post_count())
169 169
 			return;
170
-		return Content::instance('URLSafe', "/{$this->category->link}/" . ($this->page + 1) . '/')->activate();
170
+		return Content::instance('URLSafe', "/{$this->category->link}/".($this->page + 1).'/')->activate();
171 171
 	}
172 172
 
173 173
 	private $total_post_count;
174 174
 	protected function get_total_post_count()
175 175
 	{
176
-		if(!isset($this->total_post_count)) {
176
+		if (!isset($this->total_post_count)) {
177 177
         global $container;
178 178
         $repository = new Jacobemerick\Web\Domain\Blog\Post\MysqlPostRepository($container['db_connection_locator']);
179 179
         $this->total_post_count = $repository->getActivePostsCountByCategory($this->category->link);
Please login to merge, or discard this patch.
Indentation   +157 added lines, -157 removed lines patch added patch discarded remove patch
@@ -5,180 +5,180 @@
 block discarded – undo
5 5
 final class CategoryController extends DefaultListController
6 6
 {
7 7
 
8
-	private static $TITLE_MAIN_HIKING = "Hiking | Posts on Upper Peninsula Exploring on Jacob Emerick's Blog";
9
-	private static $DESCRIPTION_MAIN_HIKING = "Posts on Jacob Emerick's Blog about hiking the Upper Peninsula, exploring the Huron Mountains, and hunting waterfalls in the Keweenaw.";
10
-
11
-	private static $TITLE_MAIN_PERSONAL = "Personal | Posts about life changes on Jacob Emerick's Blog";
12
-	private static $DESCRIPTION_MAIN_PERSONAL = "Stories about life changes for Jacob and Katie. New jobs, getting married, and general thoughts on things.";
13
-
14
-	private static $TITLE_MAIN_WEBDEVELOPMENT = "Web Development | Tutorials and Best Practices on Jacob Emerick's Blog";
15
-	private static $DESCRIPTION_MAIN_WEBDEVELOPMENT = "Variety of tutorials and advice on best practices on Jacob Emerick's Blog, with a focus on object-orientated PHP development and project management.";
16
-
17
-	private static $TITLE_PAGINATED_HIKING = "Hiking - Page %d of %d | Jacob Emerick's Blog";
18
-	private static $DESCRIPTION_PAGINATED_HIKING = "Page %d of %d about hiking on Jacob Emerick's Blog. Posts about hiking the Upper Peninsula, exploring the Huron Mountains, and hunting waterfalls of the Keweenaw.";
19
-
20
-	private static $TITLE_PAGINATED_PERSONAL = "Personal - Page %d of %d | Jacob Emerick's Blog";
21
-	private static $DESCRIPTION_PAGINATED_PERSONAL = "Page %d of %d of personal posts on Jacob Emerick's Blog about life changes and general musings.";
22
-
23
-	private static $TITLE_PAGINATED_WEBDEVELOPMENT = "Web Development - Page %d of %d | Jacob Emerick's Blog";
24
-	private static $DESCRIPTION_PAGINATED_WEBDEVELOPMENT = "Page %d of %d of posts on web development, ranging from general tutorials to advanced best practices, on Jacob Emerick's Blog.";
25
-
26
-	private static $KEYWORD_ARRAY_HIKING = array(
27
-		'hiking',
28
-		'upper peninsula',
29
-		'huron mountains',
30
-		'keweenaw',
31
-		'michigan',
32
-		'backpacking',
33
-		'Jacob Emerick');
34
-
35
-	private static $KEYWORD_ARRAY_PERSONAL = array(
36
-		'dealerfire',
37
-		'sparknet',
38
-		'katie',
39
-		'logan',
40
-		'marriage',
41
-		'Jacob Emerick');
42
-
43
-	private static $KEYWORD_ARRAY_WEBDEVELOPMENT = array(
44
-		'best practices',
45
-		'object orientated php',
46
-		'data abstraction',
47
-		'semantic web',
48
-		'responsive design',
49
-		'responsible development',
50
-		'Jacob Emerick');
51
-
52
-	private $category;
53
-
54
-	private static $LIST_DESCRIPTION = 'Viewing %d - %d of %d posts in the %s category.';
55
-
56
-	public function __construct()
57
-	{
58
-		$url = URLDecode::getPiece(1);
59
-		$this->category = (object) array(
60
-			'display' => ucwords(str_replace('-', ' ', $url)),
61
-			'link' => $url);
8
+    private static $TITLE_MAIN_HIKING = "Hiking | Posts on Upper Peninsula Exploring on Jacob Emerick's Blog";
9
+    private static $DESCRIPTION_MAIN_HIKING = "Posts on Jacob Emerick's Blog about hiking the Upper Peninsula, exploring the Huron Mountains, and hunting waterfalls in the Keweenaw.";
10
+
11
+    private static $TITLE_MAIN_PERSONAL = "Personal | Posts about life changes on Jacob Emerick's Blog";
12
+    private static $DESCRIPTION_MAIN_PERSONAL = "Stories about life changes for Jacob and Katie. New jobs, getting married, and general thoughts on things.";
13
+
14
+    private static $TITLE_MAIN_WEBDEVELOPMENT = "Web Development | Tutorials and Best Practices on Jacob Emerick's Blog";
15
+    private static $DESCRIPTION_MAIN_WEBDEVELOPMENT = "Variety of tutorials and advice on best practices on Jacob Emerick's Blog, with a focus on object-orientated PHP development and project management.";
16
+
17
+    private static $TITLE_PAGINATED_HIKING = "Hiking - Page %d of %d | Jacob Emerick's Blog";
18
+    private static $DESCRIPTION_PAGINATED_HIKING = "Page %d of %d about hiking on Jacob Emerick's Blog. Posts about hiking the Upper Peninsula, exploring the Huron Mountains, and hunting waterfalls of the Keweenaw.";
19
+
20
+    private static $TITLE_PAGINATED_PERSONAL = "Personal - Page %d of %d | Jacob Emerick's Blog";
21
+    private static $DESCRIPTION_PAGINATED_PERSONAL = "Page %d of %d of personal posts on Jacob Emerick's Blog about life changes and general musings.";
22
+
23
+    private static $TITLE_PAGINATED_WEBDEVELOPMENT = "Web Development - Page %d of %d | Jacob Emerick's Blog";
24
+    private static $DESCRIPTION_PAGINATED_WEBDEVELOPMENT = "Page %d of %d of posts on web development, ranging from general tutorials to advanced best practices, on Jacob Emerick's Blog.";
25
+
26
+    private static $KEYWORD_ARRAY_HIKING = array(
27
+        'hiking',
28
+        'upper peninsula',
29
+        'huron mountains',
30
+        'keweenaw',
31
+        'michigan',
32
+        'backpacking',
33
+        'Jacob Emerick');
34
+
35
+    private static $KEYWORD_ARRAY_PERSONAL = array(
36
+        'dealerfire',
37
+        'sparknet',
38
+        'katie',
39
+        'logan',
40
+        'marriage',
41
+        'Jacob Emerick');
42
+
43
+    private static $KEYWORD_ARRAY_WEBDEVELOPMENT = array(
44
+        'best practices',
45
+        'object orientated php',
46
+        'data abstraction',
47
+        'semantic web',
48
+        'responsive design',
49
+        'responsible development',
50
+        'Jacob Emerick');
51
+
52
+    private $category;
53
+
54
+    private static $LIST_DESCRIPTION = 'Viewing %d - %d of %d posts in the %s category.';
55
+
56
+    public function __construct()
57
+    {
58
+        $url = URLDecode::getPiece(1);
59
+        $this->category = (object) array(
60
+            'display' => ucwords(str_replace('-', ' ', $url)),
61
+            'link' => $url);
62 62
 		
63
-		parent::__construct();
64
-	}
63
+        parent::__construct();
64
+    }
65 65
 
66
-	protected function set_head_data()
67
-	{
68
-		parent::set_head_data();
66
+    protected function set_head_data()
67
+    {
68
+        parent::set_head_data();
69 69
 		
70
-		switch($this->category->display)
71
-		{
72
-			case 'Hiking' :
73
-				if($this->page == 1)
74
-				{
75
-					$this->set_title(self::$TITLE_MAIN_HIKING);
76
-					$this->set_description(self::$DESCRIPTION_MAIN_HIKING);
77
-				}
78
-				else
79
-				{
80
-					$this->set_title(sprintf(self::$TITLE_PAGINATED_HIKING, $this->page, $this->total_pages));
81
-					$this->set_description(sprintf(self::$DESCRIPTION_PAGINATED_HIKING, $this->page, $this->total_pages));
82
-				}
83
-				$this->set_keywords(self::$KEYWORD_ARRAY_HIKING);
84
-			break;
85
-			case 'Personal' :
86
-				if($this->page == 1)
87
-				{
88
-					$this->set_title(self::$TITLE_MAIN_PERSONAL);
89
-					$this->set_description(self::$DESCRIPTION_MAIN_PERSONAL);
90
-				}
91
-				else
92
-				{
93
-					$this->set_title(sprintf(self::$TITLE_PAGINATED_PERSONAL, $this->page, $this->total_pages));
94
-					$this->set_description(sprintf(self::$DESCRIPTION_PAGINATED_PERSONAL, $this->page, $this->total_pages));
95
-				}
96
-				$this->set_keywords(self::$KEYWORD_ARRAY_PERSONAL);
97
-			break;
98
-			case 'Web Development' :
99
-				if($this->page == 1)
100
-				{
101
-					$this->set_title(self::$TITLE_MAIN_WEBDEVELOPMENT);
102
-					$this->set_description(self::$DESCRIPTION_MAIN_WEBDEVELOPMENT);
103
-				}
104
-				else
105
-				{
106
-					$this->set_title(sprintf(self::$TITLE_PAGINATED_WEBDEVELOPMENT, $this->page, $this->total_pages));
107
-					$this->set_description(sprintf(self::$DESCRIPTION_PAGINATED_WEBDEVELOPMENT, $this->page, $this->total_pages));
108
-				}
109
-				$this->set_keywords(self::$KEYWORD_ARRAY_WEBDEVELOPMENT);
110
-			break;
111
-		}
112
-	}
113
-
114
-	protected function get_introduction()
115
-	{
116
-		if($this->page == 1)
117
-		{
70
+        switch($this->category->display)
71
+        {
72
+            case 'Hiking' :
73
+                if($this->page == 1)
74
+                {
75
+                    $this->set_title(self::$TITLE_MAIN_HIKING);
76
+                    $this->set_description(self::$DESCRIPTION_MAIN_HIKING);
77
+                }
78
+                else
79
+                {
80
+                    $this->set_title(sprintf(self::$TITLE_PAGINATED_HIKING, $this->page, $this->total_pages));
81
+                    $this->set_description(sprintf(self::$DESCRIPTION_PAGINATED_HIKING, $this->page, $this->total_pages));
82
+                }
83
+                $this->set_keywords(self::$KEYWORD_ARRAY_HIKING);
84
+            break;
85
+            case 'Personal' :
86
+                if($this->page == 1)
87
+                {
88
+                    $this->set_title(self::$TITLE_MAIN_PERSONAL);
89
+                    $this->set_description(self::$DESCRIPTION_MAIN_PERSONAL);
90
+                }
91
+                else
92
+                {
93
+                    $this->set_title(sprintf(self::$TITLE_PAGINATED_PERSONAL, $this->page, $this->total_pages));
94
+                    $this->set_description(sprintf(self::$DESCRIPTION_PAGINATED_PERSONAL, $this->page, $this->total_pages));
95
+                }
96
+                $this->set_keywords(self::$KEYWORD_ARRAY_PERSONAL);
97
+            break;
98
+            case 'Web Development' :
99
+                if($this->page == 1)
100
+                {
101
+                    $this->set_title(self::$TITLE_MAIN_WEBDEVELOPMENT);
102
+                    $this->set_description(self::$DESCRIPTION_MAIN_WEBDEVELOPMENT);
103
+                }
104
+                else
105
+                {
106
+                    $this->set_title(sprintf(self::$TITLE_PAGINATED_WEBDEVELOPMENT, $this->page, $this->total_pages));
107
+                    $this->set_description(sprintf(self::$DESCRIPTION_PAGINATED_WEBDEVELOPMENT, $this->page, $this->total_pages));
108
+                }
109
+                $this->set_keywords(self::$KEYWORD_ARRAY_WEBDEVELOPMENT);
110
+            break;
111
+        }
112
+    }
113
+
114
+    protected function get_introduction()
115
+    {
116
+        if($this->page == 1)
117
+        {
118 118
         global $container;
119 119
         $repository = new Jacobemerick\Web\Domain\Blog\Introduction\MysqlIntroductionRepository($container['db_connection_locator']);
120 120
         $introduction_result = $repository->findByType('category', $this->category->link);
121 121
 			
122
-			$introduction = array();
123
-			$introduction['title'] = $introduction_result['title'];
124
-			$introduction['content'] = $introduction_result['content'];
125
-			$introduction['image'] = $this->get_introduction_image($introduction_result['image']);
122
+            $introduction = array();
123
+            $introduction['title'] = $introduction_result['title'];
124
+            $introduction['content'] = $introduction_result['content'];
125
+            $introduction['image'] = $this->get_introduction_image($introduction_result['image']);
126 126
 			
127
-			return $introduction;
128
-		}
127
+            return $introduction;
128
+        }
129 129
 		
130
-		return array(
131
-			'title' => "Posts about {$this->category->display}, page {$this->page} of {$this->total_pages}.");
132
-	}
133
-
134
-	protected function get_page_number()
135
-	{
136
-		$page = URLDecode::getPiece(2);
137
-		if(isset($page) && is_numeric($page))
138
-			return $page;
139
-		return 1;
140
-	}
141
-
142
-	protected function get_list_results()
143
-	{
130
+        return array(
131
+            'title' => "Posts about {$this->category->display}, page {$this->page} of {$this->total_pages}.");
132
+    }
133
+
134
+    protected function get_page_number()
135
+    {
136
+        $page = URLDecode::getPiece(2);
137
+        if(isset($page) && is_numeric($page))
138
+            return $page;
139
+        return 1;
140
+    }
141
+
142
+    protected function get_list_results()
143
+    {
144 144
         global $container;
145 145
         $repository = new Jacobemerick\Web\Domain\Blog\Post\MysqlPostRepository($container['db_connection_locator']);
146 146
         return $repository->getActivePostsByCategory($this->category->link, self::$POSTS_PER_PAGE, $this->offset);
147
-	}
147
+    }
148 148
 
149
-	protected function get_list_description()
150
-	{
151
-		$start = $this->offset + 1;
152
-		$end = min($this->offset + self::$POSTS_PER_PAGE, $this->get_total_post_count());
149
+    protected function get_list_description()
150
+    {
151
+        $start = $this->offset + 1;
152
+        $end = min($this->offset + self::$POSTS_PER_PAGE, $this->get_total_post_count());
153 153
 		
154
-		return sprintf(self::$LIST_DESCRIPTION, $start, $end, $this->get_total_post_count(), $this->category->display);
155
-	}
156
-
157
-	protected function get_list_next_link()
158
-	{
159
-		if($this->page == 1)
160
-			return;
161
-		if($this->page == 2)
162
-			return Content::instance('URLSafe', "/{$this->category->link}/")->activate();
163
-		return Content::instance('URLSafe', "/{$this->category->link}/" . ($this->page - 1) . '/')->activate();
164
-	}
165
-
166
-	protected function get_list_prev_link()
167
-	{
168
-		if(($this->page * self::$POSTS_PER_PAGE) >= $this->get_total_post_count())
169
-			return;
170
-		return Content::instance('URLSafe', "/{$this->category->link}/" . ($this->page + 1) . '/')->activate();
171
-	}
172
-
173
-	private $total_post_count;
174
-	protected function get_total_post_count()
175
-	{
176
-		if(!isset($this->total_post_count)) {
154
+        return sprintf(self::$LIST_DESCRIPTION, $start, $end, $this->get_total_post_count(), $this->category->display);
155
+    }
156
+
157
+    protected function get_list_next_link()
158
+    {
159
+        if($this->page == 1)
160
+            return;
161
+        if($this->page == 2)
162
+            return Content::instance('URLSafe', "/{$this->category->link}/")->activate();
163
+        return Content::instance('URLSafe', "/{$this->category->link}/" . ($this->page - 1) . '/')->activate();
164
+    }
165
+
166
+    protected function get_list_prev_link()
167
+    {
168
+        if(($this->page * self::$POSTS_PER_PAGE) >= $this->get_total_post_count())
169
+            return;
170
+        return Content::instance('URLSafe', "/{$this->category->link}/" . ($this->page + 1) . '/')->activate();
171
+    }
172
+
173
+    private $total_post_count;
174
+    protected function get_total_post_count()
175
+    {
176
+        if(!isset($this->total_post_count)) {
177 177
         global $container;
178 178
         $repository = new Jacobemerick\Web\Domain\Blog\Post\MysqlPostRepository($container['db_connection_locator']);
179 179
         $this->total_post_count = $repository->getActivePostsCountByCategory($this->category->link);
180 180
     }
181
-		return $this->total_post_count;
182
-	}
181
+        return $this->total_post_count;
182
+    }
183 183
 
184 184
 }
Please login to merge, or discard this patch.
Braces   +26 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', 'blog/DefaultListController');
4 4
 
5
-final class CategoryController extends DefaultListController
6
-{
5
+final class CategoryController extends DefaultListController
6
+{
7 7
 
8 8
 	private static $TITLE_MAIN_HIKING = "Hiking | Posts on Upper Peninsula Exploring on Jacob Emerick's Blog";
9 9
 	private static $DESCRIPTION_MAIN_HIKING = "Posts on Jacob Emerick's Blog about hiking the Upper Peninsula, exploring the Huron Mountains, and hunting waterfalls in the Keweenaw.";
@@ -53,8 +53,7 @@  discard block
 block discarded – undo
53 53
 
54 54
 	private static $LIST_DESCRIPTION = 'Viewing %d - %d of %d posts in the %s category.';
55 55
 
56
-	public function __construct()
57
-	{
56
+	public function __construct() {
58 57
 		$url = URLDecode::getPiece(1);
59 58
 		$this->category = (object) array(
60 59
 			'display' => ucwords(str_replace('-', ' ', $url)),
@@ -63,8 +62,7 @@  discard block
 block discarded – undo
63 62
 		parent::__construct();
64 63
 	}
65 64
 
66
-	protected function set_head_data()
67
-	{
65
+	protected function set_head_data() {
68 66
 		parent::set_head_data();
69 67
 		
70 68
 		switch($this->category->display)
@@ -74,8 +72,7 @@  discard block
 block discarded – undo
74 72
 				{
75 73
 					$this->set_title(self::$TITLE_MAIN_HIKING);
76 74
 					$this->set_description(self::$DESCRIPTION_MAIN_HIKING);
77
-				}
78
-				else
75
+				} else
79 76
 				{
80 77
 					$this->set_title(sprintf(self::$TITLE_PAGINATED_HIKING, $this->page, $this->total_pages));
81 78
 					$this->set_description(sprintf(self::$DESCRIPTION_PAGINATED_HIKING, $this->page, $this->total_pages));
@@ -87,8 +84,7 @@  discard block
 block discarded – undo
87 84
 				{
88 85
 					$this->set_title(self::$TITLE_MAIN_PERSONAL);
89 86
 					$this->set_description(self::$DESCRIPTION_MAIN_PERSONAL);
90
-				}
91
-				else
87
+				} else
92 88
 				{
93 89
 					$this->set_title(sprintf(self::$TITLE_PAGINATED_PERSONAL, $this->page, $this->total_pages));
94 90
 					$this->set_description(sprintf(self::$DESCRIPTION_PAGINATED_PERSONAL, $this->page, $this->total_pages));
@@ -100,8 +96,7 @@  discard block
 block discarded – undo
100 96
 				{
101 97
 					$this->set_title(self::$TITLE_MAIN_WEBDEVELOPMENT);
102 98
 					$this->set_description(self::$DESCRIPTION_MAIN_WEBDEVELOPMENT);
103
-				}
104
-				else
99
+				} else
105 100
 				{
106 101
 					$this->set_title(sprintf(self::$TITLE_PAGINATED_WEBDEVELOPMENT, $this->page, $this->total_pages));
107 102
 					$this->set_description(sprintf(self::$DESCRIPTION_PAGINATED_WEBDEVELOPMENT, $this->page, $this->total_pages));
@@ -111,8 +106,7 @@  discard block
 block discarded – undo
111 106
 		}
112 107
 	}
113 108
 
114
-	protected function get_introduction()
115
-	{
109
+	protected function get_introduction() {
116 110
 		if($this->page == 1)
117 111
 		{
118 112
         global $container;
@@ -131,48 +125,46 @@  discard block
 block discarded – undo
131 125
 			'title' => "Posts about {$this->category->display}, page {$this->page} of {$this->total_pages}.");
132 126
 	}
133 127
 
134
-	protected function get_page_number()
135
-	{
128
+	protected function get_page_number() {
136 129
 		$page = URLDecode::getPiece(2);
137
-		if(isset($page) && is_numeric($page))
138
-			return $page;
130
+		if(isset($page) && is_numeric($page)) {
131
+					return $page;
132
+		}
139 133
 		return 1;
140 134
 	}
141 135
 
142
-	protected function get_list_results()
143
-	{
136
+	protected function get_list_results() {
144 137
         global $container;
145 138
         $repository = new Jacobemerick\Web\Domain\Blog\Post\MysqlPostRepository($container['db_connection_locator']);
146 139
         return $repository->getActivePostsByCategory($this->category->link, self::$POSTS_PER_PAGE, $this->offset);
147 140
 	}
148 141
 
149
-	protected function get_list_description()
150
-	{
142
+	protected function get_list_description() {
151 143
 		$start = $this->offset + 1;
152 144
 		$end = min($this->offset + self::$POSTS_PER_PAGE, $this->get_total_post_count());
153 145
 		
154 146
 		return sprintf(self::$LIST_DESCRIPTION, $start, $end, $this->get_total_post_count(), $this->category->display);
155 147
 	}
156 148
 
157
-	protected function get_list_next_link()
158
-	{
159
-		if($this->page == 1)
160
-			return;
161
-		if($this->page == 2)
162
-			return Content::instance('URLSafe', "/{$this->category->link}/")->activate();
149
+	protected function get_list_next_link() {
150
+		if($this->page == 1) {
151
+					return;
152
+		}
153
+		if($this->page == 2) {
154
+					return Content::instance('URLSafe', "/{$this->category->link}/")->activate();
155
+		}
163 156
 		return Content::instance('URLSafe', "/{$this->category->link}/" . ($this->page - 1) . '/')->activate();
164 157
 	}
165 158
 
166
-	protected function get_list_prev_link()
167
-	{
168
-		if(($this->page * self::$POSTS_PER_PAGE) >= $this->get_total_post_count())
169
-			return;
159
+	protected function get_list_prev_link() {
160
+		if(($this->page * self::$POSTS_PER_PAGE) >= $this->get_total_post_count()) {
161
+					return;
162
+		}
170 163
 		return Content::instance('URLSafe', "/{$this->category->link}/" . ($this->page + 1) . '/')->activate();
171 164
 	}
172 165
 
173 166
 	private $total_post_count;
174
-	protected function get_total_post_count()
175
-	{
167
+	protected function get_total_post_count() {
176 168
 		if(!isset($this->total_post_count)) {
177 169
         global $container;
178 170
         $repository = new Jacobemerick\Web\Domain\Blog\Post\MysqlPostRepository($container['db_connection_locator']);
Please login to merge, or discard this patch.
controller/blog/HomeController.class.inc.php 3 patches
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -32,12 +32,12 @@  discard block
 block discarded – undo
32 32
 	{
33 33
 		parent::set_head_data();
34 34
 		
35
-		if($this->page == 1)
35
+		if ($this->page == 1)
36 36
 			$this->set_title(self::$TITLE_MAIN);
37 37
 		else
38 38
 			$this->set_title(sprintf(self::$TITLE_PAGINATED, $this->page, $this->total_pages));
39 39
 		
40
-		if($this->page == 1)
40
+		if ($this->page == 1)
41 41
 			$this->set_description(self::$DESCRIPTION_MAIN);
42 42
 		else
43 43
 			$this->set_description(sprintf(self::$DESCRIPTION_PAGINATED, $this->page, $this->total_pages));
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
 
48 48
 	protected function get_introduction()
49 49
 	{
50
-		if($this->page == 1)
50
+		if ($this->page == 1)
51 51
 		{
52 52
         global $container;
53 53
         $repository = new Jacobemerick\Web\Domain\Blog\Introduction\MysqlIntroductionRepository($container['db_connection_locator']);
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
 	protected function get_page_number()
69 69
 	{
70 70
 		$page = URLDecode::getPiece(1);
71
-		if(isset($page) && is_numeric($page))
71
+		if (isset($page) && is_numeric($page))
72 72
 			return $page;
73 73
 		return 1;
74 74
 	}
@@ -90,24 +90,24 @@  discard block
 block discarded – undo
90 90
 
91 91
 	protected function get_list_next_link()
92 92
 	{
93
-		if($this->page == 1)
93
+		if ($this->page == 1)
94 94
 			return;
95
-		if($this->page == 2)
95
+		if ($this->page == 2)
96 96
 			return '/';
97
-		return '/' . ($this->page - 1) . '/';
97
+		return '/'.($this->page - 1).'/';
98 98
 	}
99 99
 
100 100
 	protected function get_list_prev_link()
101 101
 	{
102
-		if(($this->page * self::$POSTS_PER_PAGE) >= $this->get_total_post_count())
102
+		if (($this->page * self::$POSTS_PER_PAGE) >= $this->get_total_post_count())
103 103
 			return;
104
-		return '/' . ($this->page + 1) . '/';
104
+		return '/'.($this->page + 1).'/';
105 105
 	}
106 106
 
107 107
 	private $total_post_count;
108 108
 	protected function get_total_post_count()
109 109
 	{
110
-      if(!isset($this->total_post_count)) {
110
+      if (!isset($this->total_post_count)) {
111 111
           global $container;
112 112
           $repository = new Jacobemerick\Web\Domain\Blog\Post\MysqlPostRepository($container['db_connection_locator']);
113 113
           $this->total_post_count = $repository->getActivePostsCount();
Please login to merge, or discard this patch.
Indentation   +95 added lines, -95 removed lines patch added patch discarded remove patch
@@ -5,115 +5,115 @@
 block discarded – undo
5 5
 final class HomeController extends DefaultListController
6 6
 {
7 7
 
8
-	private static $TITLE_MAIN = "Jacob Emerick's Blog | Posts on Hiking, Web Development, and more";
9
-	private static $TITLE_PAGINATED = "Page %d of %d in Jacob Emerick's Blog";
10
-
11
-	private static $DESCRIPTION_MAIN = "Jacob Emerick's Blog - a collection of posts about hiking the Upper Peninsula, learning to be a web developer, and other experiences of a young man.";
12
-	private static $DESCRIPTION_PAGINATED = "Page %d of %d of posts about hiking in the Upper Peninsula, learning to be a web developer, and more on Jacob Emerick's Blog.";
13
-
14
-	private static $KEYWORD_ARRAY = array(
15
-		'blog',
16
-		'Jacob Emerick',
17
-		'hiking',
18
-		'Huron Mountains',
19
-		'Peshekee Highlands',
20
-		'Keweenaw',
21
-		'Michigan',
22
-		'Upper Peninsula',
23
-		'leadership',
24
-		'web development',
25
-		'php programming',
26
-		'data handling',
27
-		'optimization');
28
-
29
-	private static $LIST_DESCRIPTION = 'Viewing %d - %d of %d total posts.';
30
-
31
-	protected function set_head_data()
32
-	{
33
-		parent::set_head_data();
8
+    private static $TITLE_MAIN = "Jacob Emerick's Blog | Posts on Hiking, Web Development, and more";
9
+    private static $TITLE_PAGINATED = "Page %d of %d in Jacob Emerick's Blog";
10
+
11
+    private static $DESCRIPTION_MAIN = "Jacob Emerick's Blog - a collection of posts about hiking the Upper Peninsula, learning to be a web developer, and other experiences of a young man.";
12
+    private static $DESCRIPTION_PAGINATED = "Page %d of %d of posts about hiking in the Upper Peninsula, learning to be a web developer, and more on Jacob Emerick's Blog.";
13
+
14
+    private static $KEYWORD_ARRAY = array(
15
+        'blog',
16
+        'Jacob Emerick',
17
+        'hiking',
18
+        'Huron Mountains',
19
+        'Peshekee Highlands',
20
+        'Keweenaw',
21
+        'Michigan',
22
+        'Upper Peninsula',
23
+        'leadership',
24
+        'web development',
25
+        'php programming',
26
+        'data handling',
27
+        'optimization');
28
+
29
+    private static $LIST_DESCRIPTION = 'Viewing %d - %d of %d total posts.';
30
+
31
+    protected function set_head_data()
32
+    {
33
+        parent::set_head_data();
34 34
 		
35
-		if($this->page == 1)
36
-			$this->set_title(self::$TITLE_MAIN);
37
-		else
38
-			$this->set_title(sprintf(self::$TITLE_PAGINATED, $this->page, $this->total_pages));
35
+        if($this->page == 1)
36
+            $this->set_title(self::$TITLE_MAIN);
37
+        else
38
+            $this->set_title(sprintf(self::$TITLE_PAGINATED, $this->page, $this->total_pages));
39 39
 		
40
-		if($this->page == 1)
41
-			$this->set_description(self::$DESCRIPTION_MAIN);
42
-		else
43
-			$this->set_description(sprintf(self::$DESCRIPTION_PAGINATED, $this->page, $this->total_pages));
40
+        if($this->page == 1)
41
+            $this->set_description(self::$DESCRIPTION_MAIN);
42
+        else
43
+            $this->set_description(sprintf(self::$DESCRIPTION_PAGINATED, $this->page, $this->total_pages));
44 44
 		
45
-		$this->set_keywords(self::$KEYWORD_ARRAY);
46
-	}
45
+        $this->set_keywords(self::$KEYWORD_ARRAY);
46
+    }
47 47
 
48
-	protected function get_introduction()
49
-	{
50
-		if($this->page == 1)
51
-		{
48
+    protected function get_introduction()
49
+    {
50
+        if($this->page == 1)
51
+        {
52 52
         global $container;
53 53
         $repository = new Jacobemerick\Web\Domain\Blog\Introduction\MysqlIntroductionRepository($container['db_connection_locator']);
54 54
         $introduction_result = $repository->findByType('home');
55 55
 			
56
-			$introduction = array();
57
-			$introduction['title'] = $introduction_result['title'];
58
-			$introduction['content'] = $introduction_result['content'];
59
-			$introduction['image'] = $this->get_introduction_image($introduction_result['image']);
56
+            $introduction = array();
57
+            $introduction['title'] = $introduction_result['title'];
58
+            $introduction['content'] = $introduction_result['content'];
59
+            $introduction['image'] = $this->get_introduction_image($introduction_result['image']);
60 60
 			
61
-			return $introduction;
62
-		}
61
+            return $introduction;
62
+        }
63 63
 		
64
-		return array(
65
-			'title' => "All of Jacob Emerick's posts, page {$this->page} of {$this->total_pages}.");
66
-	}
67
-
68
-	protected function get_page_number()
69
-	{
70
-		$page = URLDecode::getPiece(1);
71
-		if(isset($page) && is_numeric($page))
72
-			return $page;
73
-		return 1;
74
-	}
75
-
76
-	protected function get_list_results()
77
-	{
64
+        return array(
65
+            'title' => "All of Jacob Emerick's posts, page {$this->page} of {$this->total_pages}.");
66
+    }
67
+
68
+    protected function get_page_number()
69
+    {
70
+        $page = URLDecode::getPiece(1);
71
+        if(isset($page) && is_numeric($page))
72
+            return $page;
73
+        return 1;
74
+    }
75
+
76
+    protected function get_list_results()
77
+    {
78 78
         global $container;
79 79
         $repository = new Jacobemerick\Web\Domain\Blog\Post\MysqlPostRepository($container['db_connection_locator']);
80 80
         return $repository->getActivePosts(self::$POSTS_PER_PAGE, $this->offset);
81
-	}
81
+    }
82 82
 
83
-	protected function get_list_description()
84
-	{
85
-		$start = $this->offset + 1;
86
-		$end = min($this->offset + self::$POSTS_PER_PAGE, $this->get_total_post_count());
83
+    protected function get_list_description()
84
+    {
85
+        $start = $this->offset + 1;
86
+        $end = min($this->offset + self::$POSTS_PER_PAGE, $this->get_total_post_count());
87 87
 		
88
-		return sprintf(self::$LIST_DESCRIPTION, $start, $end, $this->get_total_post_count());
89
-	}
90
-
91
-	protected function get_list_next_link()
92
-	{
93
-		if($this->page == 1)
94
-			return;
95
-		if($this->page == 2)
96
-			return '/';
97
-		return '/' . ($this->page - 1) . '/';
98
-	}
99
-
100
-	protected function get_list_prev_link()
101
-	{
102
-		if(($this->page * self::$POSTS_PER_PAGE) >= $this->get_total_post_count())
103
-			return;
104
-		return '/' . ($this->page + 1) . '/';
105
-	}
106
-
107
-	private $total_post_count;
108
-	protected function get_total_post_count()
109
-	{
110
-      if(!isset($this->total_post_count)) {
111
-          global $container;
112
-          $repository = new Jacobemerick\Web\Domain\Blog\Post\MysqlPostRepository($container['db_connection_locator']);
113
-          $this->total_post_count = $repository->getActivePostsCount();
114
-      }
115
-
116
-		return $this->total_post_count;
117
-	}
88
+        return sprintf(self::$LIST_DESCRIPTION, $start, $end, $this->get_total_post_count());
89
+    }
90
+
91
+    protected function get_list_next_link()
92
+    {
93
+        if($this->page == 1)
94
+            return;
95
+        if($this->page == 2)
96
+            return '/';
97
+        return '/' . ($this->page - 1) . '/';
98
+    }
99
+
100
+    protected function get_list_prev_link()
101
+    {
102
+        if(($this->page * self::$POSTS_PER_PAGE) >= $this->get_total_post_count())
103
+            return;
104
+        return '/' . ($this->page + 1) . '/';
105
+    }
106
+
107
+    private $total_post_count;
108
+    protected function get_total_post_count()
109
+    {
110
+        if(!isset($this->total_post_count)) {
111
+            global $container;
112
+            $repository = new Jacobemerick\Web\Domain\Blog\Post\MysqlPostRepository($container['db_connection_locator']);
113
+            $this->total_post_count = $repository->getActivePostsCount();
114
+        }
115
+
116
+        return $this->total_post_count;
117
+    }
118 118
 
119 119
 }
Please login to merge, or discard this patch.
Braces   +32 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', 'blog/DefaultListController');
4 4
 
5
-final class HomeController extends DefaultListController
6
-{
5
+final class HomeController extends DefaultListController
6
+{
7 7
 
8 8
 	private static $TITLE_MAIN = "Jacob Emerick's Blog | Posts on Hiking, Web Development, and more";
9 9
 	private static $TITLE_PAGINATED = "Page %d of %d in Jacob Emerick's Blog";
@@ -28,25 +28,25 @@  discard block
 block discarded – undo
28 28
 
29 29
 	private static $LIST_DESCRIPTION = 'Viewing %d - %d of %d total posts.';
30 30
 
31
-	protected function set_head_data()
32
-	{
31
+	protected function set_head_data() {
33 32
 		parent::set_head_data();
34 33
 		
35
-		if($this->page == 1)
36
-			$this->set_title(self::$TITLE_MAIN);
37
-		else
38
-			$this->set_title(sprintf(self::$TITLE_PAGINATED, $this->page, $this->total_pages));
34
+		if($this->page == 1) {
35
+					$this->set_title(self::$TITLE_MAIN);
36
+		} else {
37
+					$this->set_title(sprintf(self::$TITLE_PAGINATED, $this->page, $this->total_pages));
38
+		}
39 39
 		
40
-		if($this->page == 1)
41
-			$this->set_description(self::$DESCRIPTION_MAIN);
42
-		else
43
-			$this->set_description(sprintf(self::$DESCRIPTION_PAGINATED, $this->page, $this->total_pages));
40
+		if($this->page == 1) {
41
+					$this->set_description(self::$DESCRIPTION_MAIN);
42
+		} else {
43
+					$this->set_description(sprintf(self::$DESCRIPTION_PAGINATED, $this->page, $this->total_pages));
44
+		}
44 45
 		
45 46
 		$this->set_keywords(self::$KEYWORD_ARRAY);
46 47
 	}
47 48
 
48
-	protected function get_introduction()
49
-	{
49
+	protected function get_introduction() {
50 50
 		if($this->page == 1)
51 51
 		{
52 52
         global $container;
@@ -65,48 +65,46 @@  discard block
 block discarded – undo
65 65
 			'title' => "All of Jacob Emerick's posts, page {$this->page} of {$this->total_pages}.");
66 66
 	}
67 67
 
68
-	protected function get_page_number()
69
-	{
68
+	protected function get_page_number() {
70 69
 		$page = URLDecode::getPiece(1);
71
-		if(isset($page) && is_numeric($page))
72
-			return $page;
70
+		if(isset($page) && is_numeric($page)) {
71
+					return $page;
72
+		}
73 73
 		return 1;
74 74
 	}
75 75
 
76
-	protected function get_list_results()
77
-	{
76
+	protected function get_list_results() {
78 77
         global $container;
79 78
         $repository = new Jacobemerick\Web\Domain\Blog\Post\MysqlPostRepository($container['db_connection_locator']);
80 79
         return $repository->getActivePosts(self::$POSTS_PER_PAGE, $this->offset);
81 80
 	}
82 81
 
83
-	protected function get_list_description()
84
-	{
82
+	protected function get_list_description() {
85 83
 		$start = $this->offset + 1;
86 84
 		$end = min($this->offset + self::$POSTS_PER_PAGE, $this->get_total_post_count());
87 85
 		
88 86
 		return sprintf(self::$LIST_DESCRIPTION, $start, $end, $this->get_total_post_count());
89 87
 	}
90 88
 
91
-	protected function get_list_next_link()
92
-	{
93
-		if($this->page == 1)
94
-			return;
95
-		if($this->page == 2)
96
-			return '/';
89
+	protected function get_list_next_link() {
90
+		if($this->page == 1) {
91
+					return;
92
+		}
93
+		if($this->page == 2) {
94
+					return '/';
95
+		}
97 96
 		return '/' . ($this->page - 1) . '/';
98 97
 	}
99 98
 
100
-	protected function get_list_prev_link()
101
-	{
102
-		if(($this->page * self::$POSTS_PER_PAGE) >= $this->get_total_post_count())
103
-			return;
99
+	protected function get_list_prev_link() {
100
+		if(($this->page * self::$POSTS_PER_PAGE) >= $this->get_total_post_count()) {
101
+					return;
102
+		}
104 103
 		return '/' . ($this->page + 1) . '/';
105 104
 	}
106 105
 
107 106
 	private $total_post_count;
108
-	protected function get_total_post_count()
109
-	{
107
+	protected function get_total_post_count() {
110 108
       if(!isset($this->total_post_count)) {
111 109
           global $container;
112 110
           $repository = new Jacobemerick\Web\Domain\Blog\Post\MysqlPostRepository($container['db_connection_locator']);
Please login to merge, or discard this patch.
controller/blog/SearchController.class.inc.php 3 patches
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
 	{
45 45
 		parent::set_head_data();
46 46
 		
47
-		if($this->page == 1)
47
+		if ($this->page == 1)
48 48
 		{
49 49
 			$this->set_title(sprintf(self::$TITLE_MAIN, ucwords($this->query)));
50 50
 			$this->set_description(sprintf(self::$DESCRIPTION_MAIN, ucwords($this->query)));
@@ -62,10 +62,10 @@  discard block
 block discarded – undo
62 62
 
63 63
 	protected function get_introduction()
64 64
 	{
65
-		if($this->total_pages > 1)
65
+		if ($this->total_pages > 1)
66 66
 			return array(
67 67
 				'title' => "Posts from search '{$this->query}', page {$this->page} of {$this->total_pages}.");
68
-		else if($this->total_pages == 1)
68
+		else if ($this->total_pages == 1)
69 69
 			return array(
70 70
 				'title' => "Posts from search '{$this->query}'.");
71 71
 		else
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
 	protected function get_page_number()
77 77
 	{
78 78
 		$page = URLDecode::getPiece(3);
79
-		if(isset($page) && is_numeric($page))
79
+		if (isset($page) && is_numeric($page))
80 80
 			return $page;
81 81
 		return 1;
82 82
 	}
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
 	private $search_result;
85 85
 	private function get_search_result()
86 86
 	{
87
-		if(!isset($this->search_result))
87
+		if (!isset($this->search_result))
88 88
 		{
89 89
         global $container;
90 90
         $repository = new Jacobemerick\Web\Domain\Blog\Post\MysqlPostRepository($container['db_connection_locator']);
@@ -114,24 +114,24 @@  discard block
 block discarded – undo
114 114
 
115 115
 	protected function get_list_next_link()
116 116
 	{
117
-		if($this->page == 1)
117
+		if ($this->page == 1)
118 118
 			return;
119
-		if($this->page == 2)
119
+		if ($this->page == 2)
120 120
 			return Content::instance('URLSafe', "/search/{$this->query}/")->activate();
121
-		return Content::instance('URLSafe', "/search/{$this->query}/" . ($this->page - 1) . '/')->activate();
121
+		return Content::instance('URLSafe', "/search/{$this->query}/".($this->page - 1).'/')->activate();
122 122
 	}
123 123
 
124 124
 	protected function get_list_prev_link()
125 125
 	{
126
-		if(($this->page * self::$POSTS_PER_PAGE) >= $this->get_total_post_count())
126
+		if (($this->page * self::$POSTS_PER_PAGE) >= $this->get_total_post_count())
127 127
 			return;
128
-		return Content::instance('URLSafe', "/search/{$this->query}/" . ($this->page + 1) . '/')->activate();
128
+		return Content::instance('URLSafe', "/search/{$this->query}/".($this->page + 1).'/')->activate();
129 129
 	}
130 130
 
131 131
 	private $total_post_count;
132 132
 	protected function get_total_post_count()
133 133
 	{
134
-		if(!isset($this->total_post_count))
134
+		if (!isset($this->total_post_count))
135 135
 			$this->total_post_count = count($this->get_search_result());
136 136
 		return $this->total_post_count;
137 137
 	}
Please login to merge, or discard this patch.
Indentation   +118 added lines, -118 removed lines patch added patch discarded remove patch
@@ -6,134 +6,134 @@
 block discarded – undo
6 6
 final class SearchController extends DefaultListController
7 7
 {
8 8
 
9
-	private static $TITLE_MAIN = "%s Search | Jacob Emerick's Blog";
10
-	private static $DESCRIPTION_MAIN = "Posts containing the phrase %s on Jacob Emerick's Blog.";
11
-
12
-	private static $TITLE_PAGINATED = "%s Search - Page %d of %d | Jacob Emerick's Blog";
13
-	private static $DESCRIPTION_PAGINATED = "Page %d of %d with posts containing the phrase %s on Jacob Emerick's Blog.";
14
-
15
-	private static $KEYWORD_ARRAY = array(
16
-		'hiking',
17
-		'web development',
18
-		'blog',
19
-		'Jacob Emerick');
20
-
21
-	private static $LIST_DESCRIPTION = 'Viewing %d - %d of %d posts containing the phrase %s.';
22
-	private static $SEARCH_WEIGHTS = array(
23
-		array(
24
-			'field' => 'title',
25
-			'weight' => 8),
26
-		array(
27
-			'field' => 'body',
28
-			'weight' => 4));
29
-
30
-	private $query;
31
-
32
-	public function __construct()
33
-	{
34
-		$query = URLDecode::getPiece(2);
35
-		$query = urldecode($query);
9
+    private static $TITLE_MAIN = "%s Search | Jacob Emerick's Blog";
10
+    private static $DESCRIPTION_MAIN = "Posts containing the phrase %s on Jacob Emerick's Blog.";
11
+
12
+    private static $TITLE_PAGINATED = "%s Search - Page %d of %d | Jacob Emerick's Blog";
13
+    private static $DESCRIPTION_PAGINATED = "Page %d of %d with posts containing the phrase %s on Jacob Emerick's Blog.";
14
+
15
+    private static $KEYWORD_ARRAY = array(
16
+        'hiking',
17
+        'web development',
18
+        'blog',
19
+        'Jacob Emerick');
20
+
21
+    private static $LIST_DESCRIPTION = 'Viewing %d - %d of %d posts containing the phrase %s.';
22
+    private static $SEARCH_WEIGHTS = array(
23
+        array(
24
+            'field' => 'title',
25
+            'weight' => 8),
26
+        array(
27
+            'field' => 'body',
28
+            'weight' => 4));
29
+
30
+    private $query;
31
+
32
+    public function __construct()
33
+    {
34
+        $query = URLDecode::getPiece(2);
35
+        $query = urldecode($query);
36 36
         $query = str_replace('-', ' ', $query);
37 37
 		
38
-		$this->query = $query;
38
+        $this->query = $query;
39 39
 		
40
-		parent::__construct();
41
-	}
40
+        parent::__construct();
41
+    }
42 42
 
43
-	protected function set_head_data()
44
-	{
45
-		parent::set_head_data();
43
+    protected function set_head_data()
44
+    {
45
+        parent::set_head_data();
46 46
 		
47
-		if($this->page == 1)
48
-		{
49
-			$this->set_title(sprintf(self::$TITLE_MAIN, ucwords($this->query)));
50
-			$this->set_description(sprintf(self::$DESCRIPTION_MAIN, ucwords($this->query)));
51
-		}
52
-		else
53
-		{
54
-			$this->set_title(sprintf(self::$TITLE_PAGINATED, ucwords($this->query), $this->page, $this->total_pages));
55
-			$this->set_description(sprintf(self::$DESCRIPTION_PAGINATED, $this->page, $this->total_pages, ucwords($this->query)));
56
-		}
47
+        if($this->page == 1)
48
+        {
49
+            $this->set_title(sprintf(self::$TITLE_MAIN, ucwords($this->query)));
50
+            $this->set_description(sprintf(self::$DESCRIPTION_MAIN, ucwords($this->query)));
51
+        }
52
+        else
53
+        {
54
+            $this->set_title(sprintf(self::$TITLE_PAGINATED, ucwords($this->query), $this->page, $this->total_pages));
55
+            $this->set_description(sprintf(self::$DESCRIPTION_PAGINATED, $this->page, $this->total_pages, ucwords($this->query)));
56
+        }
57 57
 		
58
-		$keyword_array = self::$KEYWORD_ARRAY;
59
-		array_unshift($keyword_array, $this->query);
60
-		$this->set_keywords($keyword_array);
61
-	}
62
-
63
-	protected function get_introduction()
64
-	{
65
-		if($this->total_pages > 1)
66
-			return array(
67
-				'title' => "Posts from search '{$this->query}', page {$this->page} of {$this->total_pages}.");
68
-		else if($this->total_pages == 1)
69
-			return array(
70
-				'title' => "Posts from search '{$this->query}'.");
71
-		else
72
-			return array(
73
-				'title' => "Sorry, '{$this->query}' didn't return any posts.");
74
-	}
75
-
76
-	protected function get_page_number()
77
-	{
78
-		$page = URLDecode::getPiece(3);
79
-		if(isset($page) && is_numeric($page))
80
-			return $page;
81
-		return 1;
82
-	}
83
-
84
-	private $search_result;
85
-	private function get_search_result()
86
-	{
87
-		if(!isset($this->search_result))
88
-		{
58
+        $keyword_array = self::$KEYWORD_ARRAY;
59
+        array_unshift($keyword_array, $this->query);
60
+        $this->set_keywords($keyword_array);
61
+    }
62
+
63
+    protected function get_introduction()
64
+    {
65
+        if($this->total_pages > 1)
66
+            return array(
67
+                'title' => "Posts from search '{$this->query}', page {$this->page} of {$this->total_pages}.");
68
+        else if($this->total_pages == 1)
69
+            return array(
70
+                'title' => "Posts from search '{$this->query}'.");
71
+        else
72
+            return array(
73
+                'title' => "Sorry, '{$this->query}' didn't return any posts.");
74
+    }
75
+
76
+    protected function get_page_number()
77
+    {
78
+        $page = URLDecode::getPiece(3);
79
+        if(isset($page) && is_numeric($page))
80
+            return $page;
81
+        return 1;
82
+    }
83
+
84
+    private $search_result;
85
+    private function get_search_result()
86
+    {
87
+        if(!isset($this->search_result))
88
+        {
89 89
         global $container;
90 90
         $repository = new Jacobemerick\Web\Domain\Blog\Post\MysqlPostRepository($container['db_connection_locator']);
91 91
         $posts = $repository->getActivePosts();
92 92
 			
93
-			$this->search_result = Search::instance()
94
-				->setQuery($this->query)
95
-				->setResult($posts)
96
-				->setWeight(self::$SEARCH_WEIGHTS)
97
-				->perform();
98
-		}
99
-		return $this->search_result;
100
-	}
101
-
102
-	protected function get_list_results()
103
-	{
104
-		return array_slice($this->get_search_result(), $this->offset, self::$POSTS_PER_PAGE);
105
-	}
106
-
107
-	protected function get_list_description()
108
-	{
109
-		$start = $this->offset + 1;
110
-		$end = min($this->offset + self::$POSTS_PER_PAGE, $this->get_total_post_count());
93
+            $this->search_result = Search::instance()
94
+                ->setQuery($this->query)
95
+                ->setResult($posts)
96
+                ->setWeight(self::$SEARCH_WEIGHTS)
97
+                ->perform();
98
+        }
99
+        return $this->search_result;
100
+    }
101
+
102
+    protected function get_list_results()
103
+    {
104
+        return array_slice($this->get_search_result(), $this->offset, self::$POSTS_PER_PAGE);
105
+    }
106
+
107
+    protected function get_list_description()
108
+    {
109
+        $start = $this->offset + 1;
110
+        $end = min($this->offset + self::$POSTS_PER_PAGE, $this->get_total_post_count());
111 111
 		
112
-		return sprintf(self::$LIST_DESCRIPTION, $start, $end, $this->get_total_post_count(), $this->query);
113
-	}
114
-
115
-	protected function get_list_next_link()
116
-	{
117
-		if($this->page == 1)
118
-			return;
119
-		if($this->page == 2)
120
-			return Content::instance('URLSafe', "/search/{$this->query}/")->activate();
121
-		return Content::instance('URLSafe', "/search/{$this->query}/" . ($this->page - 1) . '/')->activate();
122
-	}
123
-
124
-	protected function get_list_prev_link()
125
-	{
126
-		if(($this->page * self::$POSTS_PER_PAGE) >= $this->get_total_post_count())
127
-			return;
128
-		return Content::instance('URLSafe', "/search/{$this->query}/" . ($this->page + 1) . '/')->activate();
129
-	}
130
-
131
-	private $total_post_count;
132
-	protected function get_total_post_count()
133
-	{
134
-		if(!isset($this->total_post_count))
135
-			$this->total_post_count = count($this->get_search_result());
136
-		return $this->total_post_count;
137
-	}
112
+        return sprintf(self::$LIST_DESCRIPTION, $start, $end, $this->get_total_post_count(), $this->query);
113
+    }
114
+
115
+    protected function get_list_next_link()
116
+    {
117
+        if($this->page == 1)
118
+            return;
119
+        if($this->page == 2)
120
+            return Content::instance('URLSafe', "/search/{$this->query}/")->activate();
121
+        return Content::instance('URLSafe', "/search/{$this->query}/" . ($this->page - 1) . '/')->activate();
122
+    }
123
+
124
+    protected function get_list_prev_link()
125
+    {
126
+        if(($this->page * self::$POSTS_PER_PAGE) >= $this->get_total_post_count())
127
+            return;
128
+        return Content::instance('URLSafe', "/search/{$this->query}/" . ($this->page + 1) . '/')->activate();
129
+    }
130
+
131
+    private $total_post_count;
132
+    protected function get_total_post_count()
133
+    {
134
+        if(!isset($this->total_post_count))
135
+            $this->total_post_count = count($this->get_search_result());
136
+        return $this->total_post_count;
137
+    }
138 138
 
139 139
 }
Please login to merge, or discard this patch.
Braces   +38 added lines, -43 removed lines patch added patch discarded remove patch
@@ -3,8 +3,8 @@  discard block
 block discarded – undo
3 3
 Loader::load('controller', 'blog/DefaultListController');
4 4
 Loader::load('utility', 'Search');
5 5
 
6
-final class SearchController extends DefaultListController
7
-{
6
+final class SearchController extends DefaultListController
7
+{
8 8
 
9 9
 	private static $TITLE_MAIN = "%s Search | Jacob Emerick's Blog";
10 10
 	private static $DESCRIPTION_MAIN = "Posts containing the phrase %s on Jacob Emerick's Blog.";
@@ -29,8 +29,7 @@  discard block
 block discarded – undo
29 29
 
30 30
 	private $query;
31 31
 
32
-	public function __construct()
33
-	{
32
+	public function __construct() {
34 33
 		$query = URLDecode::getPiece(2);
35 34
 		$query = urldecode($query);
36 35
         $query = str_replace('-', ' ', $query);
@@ -40,16 +39,14 @@  discard block
 block discarded – undo
40 39
 		parent::__construct();
41 40
 	}
42 41
 
43
-	protected function set_head_data()
44
-	{
42
+	protected function set_head_data() {
45 43
 		parent::set_head_data();
46 44
 		
47 45
 		if($this->page == 1)
48 46
 		{
49 47
 			$this->set_title(sprintf(self::$TITLE_MAIN, ucwords($this->query)));
50 48
 			$this->set_description(sprintf(self::$DESCRIPTION_MAIN, ucwords($this->query)));
51
-		}
52
-		else
49
+		} else
53 50
 		{
54 51
 			$this->set_title(sprintf(self::$TITLE_PAGINATED, ucwords($this->query), $this->page, $this->total_pages));
55 52
 			$this->set_description(sprintf(self::$DESCRIPTION_PAGINATED, $this->page, $this->total_pages, ucwords($this->query)));
@@ -60,30 +57,29 @@  discard block
 block discarded – undo
60 57
 		$this->set_keywords($keyword_array);
61 58
 	}
62 59
 
63
-	protected function get_introduction()
64
-	{
65
-		if($this->total_pages > 1)
66
-			return array(
67
-				'title' => "Posts from search '{$this->query}', page {$this->page} of {$this->total_pages}.");
68
-		else if($this->total_pages == 1)
69
-			return array(
70
-				'title' => "Posts from search '{$this->query}'.");
71
-		else
72
-			return array(
73
-				'title' => "Sorry, '{$this->query}' didn't return any posts.");
60
+	protected function get_introduction() {
61
+		if($this->total_pages > 1) {
62
+					return array(
63
+				'title' => "Posts from search '{$this->query}', page {$this->page} of {$this->total_pages}.");
64
+		} else if($this->total_pages == 1) {
65
+					return array(
66
+				'title' => "Posts from search '{$this->query}'.");
67
+		} else {
68
+					return array(
69
+				'title' => "Sorry, '{$this->query}' didn't return any posts.");
70
+		}
74 71
 	}
75 72
 
76
-	protected function get_page_number()
77
-	{
73
+	protected function get_page_number() {
78 74
 		$page = URLDecode::getPiece(3);
79
-		if(isset($page) && is_numeric($page))
80
-			return $page;
75
+		if(isset($page) && is_numeric($page)) {
76
+					return $page;
77
+		}
81 78
 		return 1;
82 79
 	}
83 80
 
84 81
 	private $search_result;
85
-	private function get_search_result()
86
-	{
82
+	private function get_search_result() {
87 83
 		if(!isset($this->search_result))
88 84
 		{
89 85
         global $container;
@@ -99,40 +95,39 @@  discard block
 block discarded – undo
99 95
 		return $this->search_result;
100 96
 	}
101 97
 
102
-	protected function get_list_results()
103
-	{
98
+	protected function get_list_results() {
104 99
 		return array_slice($this->get_search_result(), $this->offset, self::$POSTS_PER_PAGE);
105 100
 	}
106 101
 
107
-	protected function get_list_description()
108
-	{
102
+	protected function get_list_description() {
109 103
 		$start = $this->offset + 1;
110 104
 		$end = min($this->offset + self::$POSTS_PER_PAGE, $this->get_total_post_count());
111 105
 		
112 106
 		return sprintf(self::$LIST_DESCRIPTION, $start, $end, $this->get_total_post_count(), $this->query);
113 107
 	}
114 108
 
115
-	protected function get_list_next_link()
116
-	{
117
-		if($this->page == 1)
118
-			return;
119
-		if($this->page == 2)
120
-			return Content::instance('URLSafe', "/search/{$this->query}/")->activate();
109
+	protected function get_list_next_link() {
110
+		if($this->page == 1) {
111
+					return;
112
+		}
113
+		if($this->page == 2) {
114
+					return Content::instance('URLSafe', "/search/{$this->query}/")->activate();
115
+		}
121 116
 		return Content::instance('URLSafe', "/search/{$this->query}/" . ($this->page - 1) . '/')->activate();
122 117
 	}
123 118
 
124
-	protected function get_list_prev_link()
125
-	{
126
-		if(($this->page * self::$POSTS_PER_PAGE) >= $this->get_total_post_count())
127
-			return;
119
+	protected function get_list_prev_link() {
120
+		if(($this->page * self::$POSTS_PER_PAGE) >= $this->get_total_post_count()) {
121
+					return;
122
+		}
128 123
 		return Content::instance('URLSafe', "/search/{$this->query}/" . ($this->page + 1) . '/')->activate();
129 124
 	}
130 125
 
131 126
 	private $total_post_count;
132
-	protected function get_total_post_count()
133
-	{
134
-		if(!isset($this->total_post_count))
135
-			$this->total_post_count = count($this->get_search_result());
127
+	protected function get_total_post_count() {
128
+		if(!isset($this->total_post_count)) {
129
+					$this->total_post_count = count($this->get_search_result());
130
+		}
136 131
 		return $this->total_post_count;
137 132
 	}
138 133
 
Please login to merge, or discard this patch.
controller/portfolio/ResumeController.class.inc.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@
 block discarded – undo
25 25
     {
26 26
         $this->set_body('body_view', 'Resume');
27 27
 
28
-        $resumePath = Loader::getRootURL('portfolio') . "/jsonresume/{$this->resume}";
28
+        $resumePath = Loader::getRootURL('portfolio')."/jsonresume/{$this->resume}";
29 29
         $resume = file_get_contents($resumePath);
30 30
         $resume = json_decode($resume, true);
31 31
         $this->set_body('body_data', $resume);
Please login to merge, or discard this patch.
Braces   +4 added lines, -6 removed lines patch added patch discarded remove patch
@@ -2,13 +2,12 @@  discard block
 block discarded – undo
2 2
 
3 3
 Loader::load('controller', 'portfolio/DefaultPageController');
4 4
 
5
-class ResumeController extends DefaultPageController
6
-{
5
+class ResumeController extends DefaultPageController
6
+{
7 7
 
8 8
     protected $resume = 'resume-20160318.json';
9 9
 
10
-    protected function set_head_data()
11
-    {
10
+    protected function set_head_data() {
12 11
         $this->set_title("Resume | Jacob Emerick's Portfolio");
13 12
         $this->set_description("Resume for Jacob Emerick, a software engineer extraordinaire");
14 13
         $this->set_keywords([
@@ -21,8 +20,7 @@  discard block
 block discarded – undo
21 20
         ]);
22 21
     }
23 22
 
24
-    protected function set_body_data()
25
-    {
23
+    protected function set_body_data() {
26 24
         $this->set_body('body_view', 'Resume');
27 25
 
28 26
         $resumePath = Loader::getRootURL('portfolio') . "/jsonresume/{$this->resume}";
Please login to merge, or discard this patch.
controller/portfolio/ContactController.class.inc.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -89,7 +89,7 @@
 block discarded – undo
89 89
 
90 90
         return [
91 91
             'success' =>
92
-                "Thank you for your message, {$_POST['name']}! " .
92
+                "Thank you for your message, {$_POST['name']}! ".
93 93
                 "I'll get back to you as soon as possible."
94 94
         ];
95 95
     }
Please login to merge, or discard this 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('controller', 'portfolio/DefaultPageController');
4 4
 
5
-class ContactController extends DefaultPageController
6
-{
5
+class ContactController extends DefaultPageController
6
+{
7 7
 
8
-    protected function set_head_data()
9
-    {
8
+    protected function set_head_data() {
10 9
         $this->set_title("Contact Page | Jacob Emerick's Portfolio");
11 10
         $this->set_description("Contact page for Jacob Emerick's Portfolio");
12 11
         $this->set_keywords([
@@ -19,8 +18,7 @@  discard block
 block discarded – undo
19 18
         ]);
20 19
     }
21 20
 
22
-    protected function set_body_data()
23
-    {
21
+    protected function set_body_data() {
24 22
         $this->set_body('body_view', 'Contact');
25 23
 
26 24
         $body_data = [];
@@ -33,8 +31,7 @@  discard block
 block discarded – undo
33 31
         parent::set_body_data();
34 32
     }
35 33
 
36
-    private function process_form_data()
37
-    {
34
+    private function process_form_data() {
38 35
         $errors = [];
39 36
 
40 37
         if (
Please login to merge, or discard this patch.
controller/portfolio/DefaultPageController.class.inc.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -33,15 +33,15 @@  discard block
 block discarded – undo
33 33
             ],
34 34
             [
35 35
                 'name' => 'Projects',
36
-                'link' => Loader::getRootURL() . 'projects/',
36
+                'link' => Loader::getRootURL().'projects/',
37 37
             ],
38 38
             [
39 39
                 'name' => 'Résumé',
40
-                'link' => Loader::getRootURL() . 'resume/',
40
+                'link' => Loader::getRootURL().'resume/',
41 41
             ],
42 42
             [
43 43
                 'name' => 'Contact',
44
-                'link' => Loader::getRootURL() . 'contact/',
44
+                'link' => Loader::getRootURL().'contact/',
45 45
             ],
46 46
         ];
47 47
 
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
             $active_page = ucfirst(URLDecode::getPiece(1));
52 52
         }
53 53
 
54
-        return array_map(function ($row) use ($active_page) {
54
+        return array_map(function($row) use ($active_page) {
55 55
             $row = (object) $row;
56 56
             $row->active = ($row->name == $active_page);
57 57
             return $row;
Please login to merge, or discard this patch.
Braces   +5 added lines, -8 removed lines patch added patch discarded remove patch
@@ -2,19 +2,17 @@  discard block
 block discarded – undo
2 2
 
3 3
 Loader::load('controller', '/PageController');
4 4
 
5
-abstract class DefaultPageController extends PageController
6
-{
5
+abstract class DefaultPageController extends PageController
6
+{
7 7
 
8
-    public function __construct()
9
-    {
8
+    public function __construct() {
10 9
         parent::__construct();
11 10
 
12 11
         $this->add_css('reset');
13 12
         $this->add_css('portfolio', 4);
14 13
     }
15 14
 
16
-    protected function set_body_data()
17
-    {
15
+    protected function set_body_data() {
18 16
         $this->set_body('header_data', [
19 17
             'menu' => $this->get_menu(),
20 18
             'home_link' => Loader::getRootURL(),
@@ -24,8 +22,7 @@  discard block
 block discarded – undo
24 22
         $this->set_body_view('Page');
25 23
     }
26 24
 
27
-    protected function get_menu()
28
-    {
25
+    protected function get_menu() {
29 26
         $menu = [
30 27
             [
31 28
                 'name' => 'About',
Please login to merge, or discard this patch.