@@ -49,9 +49,9 @@ discard block |
||
49 | 49 | { |
50 | 50 | if($this->page == 1) |
51 | 51 | { |
52 | - global $container; |
|
53 | - $repository = new Jacobemerick\Web\Domain\Blog\Introduction\MysqlIntroductionRepository($container['db_connection_locator']); |
|
54 | - $introduction_result = $repository->findByType('home'); |
|
52 | + global $container; |
|
53 | + $repository = new Jacobemerick\Web\Domain\Blog\Introduction\MysqlIntroductionRepository($container['db_connection_locator']); |
|
54 | + $introduction_result = $repository->findByType('home'); |
|
55 | 55 | |
56 | 56 | $introduction = array(); |
57 | 57 | $introduction['title'] = $introduction_result['title']; |
@@ -75,9 +75,9 @@ discard block |
||
75 | 75 | |
76 | 76 | protected function get_list_results() |
77 | 77 | { |
78 | - global $container; |
|
79 | - $repository = new Jacobemerick\Web\Domain\Blog\Post\MysqlPostRepository($container['db_connection_locator']); |
|
80 | - return $repository->getActivePosts(self::$POSTS_PER_PAGE, $this->offset); |
|
78 | + global $container; |
|
79 | + $repository = new Jacobemerick\Web\Domain\Blog\Post\MysqlPostRepository($container['db_connection_locator']); |
|
80 | + return $repository->getActivePosts(self::$POSTS_PER_PAGE, $this->offset); |
|
81 | 81 | } |
82 | 82 | |
83 | 83 | protected function get_list_description() |
@@ -107,11 +107,11 @@ discard block |
||
107 | 107 | private $total_post_count; |
108 | 108 | protected function get_total_post_count() |
109 | 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 | - } |
|
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 | 115 | |
116 | 116 | return $this->total_post_count; |
117 | 117 | } |
@@ -32,12 +32,12 @@ discard block |
||
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 |
||
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 |
||
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,16 +90,16 @@ discard block |
||
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 | 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 | 104 | return '/' . ($this->page + 1) . '/'; |
105 | 105 | } |
@@ -107,7 +107,7 @@ discard block |
||
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(); |
@@ -32,15 +32,17 @@ discard block |
||
32 | 32 | { |
33 | 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 | |
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)); |
|
41 | + if($this->page == 1) { |
|
42 | + $this->set_description(self::$DESCRIPTION_MAIN); |
|
43 | + } else { |
|
44 | + $this->set_description(sprintf(self::$DESCRIPTION_PAGINATED, $this->page, $this->total_pages)); |
|
45 | + } |
|
44 | 46 | |
45 | 47 | $this->set_keywords(self::$KEYWORD_ARRAY); |
46 | 48 | } |
@@ -68,8 +70,9 @@ discard block |
||
68 | 70 | protected function get_page_number() |
69 | 71 | { |
70 | 72 | $page = URLDecode::getPiece(1); |
71 | - if(isset($page) && is_numeric($page)) |
|
72 | - return $page; |
|
73 | + if(isset($page) && is_numeric($page)) { |
|
74 | + return $page; |
|
75 | + } |
|
73 | 76 | return 1; |
74 | 77 | } |
75 | 78 | |
@@ -90,17 +93,20 @@ discard block |
||
90 | 93 | |
91 | 94 | protected function get_list_next_link() |
92 | 95 | { |
93 | - if($this->page == 1) |
|
94 | - return; |
|
95 | - if($this->page == 2) |
|
96 | - return '/'; |
|
96 | + if($this->page == 1) { |
|
97 | + return; |
|
98 | + } |
|
99 | + if($this->page == 2) { |
|
100 | + return '/'; |
|
101 | + } |
|
97 | 102 | return '/' . ($this->page - 1) . '/'; |
98 | 103 | } |
99 | 104 | |
100 | 105 | protected function get_list_prev_link() |
101 | 106 | { |
102 | - if(($this->page * self::$POSTS_PER_PAGE) >= $this->get_total_post_count()) |
|
103 | - return; |
|
107 | + if(($this->page * self::$POSTS_PER_PAGE) >= $this->get_total_post_count()) { |
|
108 | + return; |
|
109 | + } |
|
104 | 110 | return '/' . ($this->page + 1) . '/'; |
105 | 111 | } |
106 | 112 |
@@ -26,9 +26,9 @@ discard block |
||
26 | 26 | $tag = URLDecode::getPiece(2); |
27 | 27 | $tag = str_replace('-', ' ', $tag); |
28 | 28 | |
29 | - global $container; |
|
30 | - $repository = new Jacobemerick\Web\Domain\Blog\Tag\MysqlTagRepository($container['db_connection_locator']); |
|
31 | - $tag_result = $repository->findTagByTitle($tag); |
|
29 | + global $container; |
|
30 | + $repository = new Jacobemerick\Web\Domain\Blog\Tag\MysqlTagRepository($container['db_connection_locator']); |
|
31 | + $tag_result = $repository->findTagByTitle($tag); |
|
32 | 32 | |
33 | 33 | if($tag_result === false) |
34 | 34 | $this->eject(); |
@@ -64,9 +64,9 @@ discard block |
||
64 | 64 | |
65 | 65 | if($this->page == 1) |
66 | 66 | { |
67 | - global $container; |
|
68 | - $repository = new Jacobemerick\Web\Domain\Blog\Introduction\MysqlIntroductionRepository($container['db_connection_locator']); |
|
69 | - $introduction_result = $repository->findByType('tag', $this->tag['tag']); |
|
67 | + global $container; |
|
68 | + $repository = new Jacobemerick\Web\Domain\Blog\Introduction\MysqlIntroductionRepository($container['db_connection_locator']); |
|
69 | + $introduction_result = $repository->findByType('tag', $this->tag['tag']); |
|
70 | 70 | |
71 | 71 | if($introduction_result !== false) |
72 | 72 | { |
@@ -96,9 +96,9 @@ discard block |
||
96 | 96 | |
97 | 97 | protected function get_list_results() |
98 | 98 | { |
99 | - global $container; |
|
100 | - $repository = new Jacobemerick\Web\Domain\Blog\Post\MysqlPostRepository($container['db_connection_locator']); |
|
101 | - return $repository->getActivePostsByTag($this->tag['id'], self::$POSTS_PER_PAGE, $this->offset); |
|
99 | + global $container; |
|
100 | + $repository = new Jacobemerick\Web\Domain\Blog\Post\MysqlPostRepository($container['db_connection_locator']); |
|
101 | + return $repository->getActivePostsByTag($this->tag['id'], self::$POSTS_PER_PAGE, $this->offset); |
|
102 | 102 | } |
103 | 103 | |
104 | 104 | protected function get_list_description() |
@@ -129,10 +129,10 @@ discard block |
||
129 | 129 | protected function get_total_post_count() |
130 | 130 | { |
131 | 131 | if(!isset($this->total_post_count)) { |
132 | - global $container; |
|
133 | - $repository = new Jacobemerick\Web\Domain\Blog\Post\MysqlPostRepository($container['db_connection_locator']); |
|
134 | - $this->total_post_count = $repository->getActivePostsCountByTag($this->tag['id']); |
|
135 | - } |
|
132 | + global $container; |
|
133 | + $repository = new Jacobemerick\Web\Domain\Blog\Post\MysqlPostRepository($container['db_connection_locator']); |
|
134 | + $this->total_post_count = $repository->getActivePostsCountByTag($this->tag['id']); |
|
135 | + } |
|
136 | 136 | |
137 | 137 | return $this->total_post_count; |
138 | 138 | } |
@@ -30,7 +30,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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,16 +111,16 @@ discard block |
||
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 | 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 | 125 | return Content::instance('URLSafe', "/tag/{$this->tag['tag']}/" . ($this->page + 1) . '/')->activate(); |
126 | 126 | } |
@@ -128,7 +128,7 @@ discard block |
||
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']); |
@@ -30,8 +30,9 @@ discard block |
||
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 | |
36 | 37 | $this->tag = $tag_result; |
37 | 38 | |
@@ -46,8 +47,7 @@ discard block |
||
46 | 47 | { |
47 | 48 | $this->set_title(sprintf(self::$TITLE_MAIN, ucwords($this->tag['tag']))); |
48 | 49 | $this->set_description(sprintf(self::$DESCRIPTION_MAIN, ucwords($this->tag['tag']))); |
49 | - } |
|
50 | - else |
|
50 | + } else |
|
51 | 51 | { |
52 | 52 | $this->set_title(sprintf(self::$TITLE_PAGINATED, ucwords($this->tag['tag']), $this->page, $this->total_pages)); |
53 | 53 | $this->set_description(sprintf(self::$DESCRIPTION_PAGINATED, $this->page, $this->total_pages, ucwords($this->tag['tag']))); |
@@ -89,8 +89,9 @@ discard block |
||
89 | 89 | protected function get_page_number() |
90 | 90 | { |
91 | 91 | $page = URLDecode::getPiece(3); |
92 | - if(isset($page) && is_numeric($page)) |
|
93 | - return $page; |
|
92 | + if(isset($page) && is_numeric($page)) { |
|
93 | + return $page; |
|
94 | + } |
|
94 | 95 | return 1; |
95 | 96 | } |
96 | 97 | |
@@ -111,17 +112,20 @@ discard block |
||
111 | 112 | |
112 | 113 | protected function get_list_next_link() |
113 | 114 | { |
114 | - if($this->page == 1) |
|
115 | - return; |
|
116 | - if($this->page == 2) |
|
117 | - return Content::instance('URLSafe', "/tag/{$this->tag['tag']}/")->activate(); |
|
115 | + if($this->page == 1) { |
|
116 | + return; |
|
117 | + } |
|
118 | + if($this->page == 2) { |
|
119 | + return Content::instance('URLSafe', "/tag/{$this->tag['tag']}/")->activate(); |
|
120 | + } |
|
118 | 121 | return Content::instance('URLSafe', "/tag/{$this->tag['tag']}/" . ($this->page - 1) . '/')->activate(); |
119 | 122 | } |
120 | 123 | |
121 | 124 | protected function get_list_prev_link() |
122 | 125 | { |
123 | - if(($this->page * self::$POSTS_PER_PAGE) >= $this->get_total_post_count()) |
|
124 | - return; |
|
126 | + if(($this->page * self::$POSTS_PER_PAGE) >= $this->get_total_post_count()) { |
|
127 | + return; |
|
128 | + } |
|
125 | 129 | return Content::instance('URLSafe', "/tag/{$this->tag['tag']}/" . ($this->page + 1) . '/')->activate(); |
126 | 130 | } |
127 | 131 |
@@ -115,9 +115,9 @@ discard block |
||
115 | 115 | { |
116 | 116 | if($this->page == 1) |
117 | 117 | { |
118 | - global $container; |
|
119 | - $repository = new Jacobemerick\Web\Domain\Blog\Introduction\MysqlIntroductionRepository($container['db_connection_locator']); |
|
120 | - $introduction_result = $repository->findByType('category', $this->category->link); |
|
118 | + global $container; |
|
119 | + $repository = new Jacobemerick\Web\Domain\Blog\Introduction\MysqlIntroductionRepository($container['db_connection_locator']); |
|
120 | + $introduction_result = $repository->findByType('category', $this->category->link); |
|
121 | 121 | |
122 | 122 | $introduction = array(); |
123 | 123 | $introduction['title'] = $introduction_result['title']; |
@@ -141,9 +141,9 @@ discard block |
||
141 | 141 | |
142 | 142 | protected function get_list_results() |
143 | 143 | { |
144 | - global $container; |
|
145 | - $repository = new Jacobemerick\Web\Domain\Blog\Post\MysqlPostRepository($container['db_connection_locator']); |
|
146 | - return $repository->getActivePostsByCategory($this->category->link, self::$POSTS_PER_PAGE, $this->offset); |
|
144 | + global $container; |
|
145 | + $repository = new Jacobemerick\Web\Domain\Blog\Post\MysqlPostRepository($container['db_connection_locator']); |
|
146 | + return $repository->getActivePostsByCategory($this->category->link, self::$POSTS_PER_PAGE, $this->offset); |
|
147 | 147 | } |
148 | 148 | |
149 | 149 | protected function get_list_description() |
@@ -174,10 +174,10 @@ discard block |
||
174 | 174 | protected function get_total_post_count() |
175 | 175 | { |
176 | 176 | if(!isset($this->total_post_count)) { |
177 | - global $container; |
|
178 | - $repository = new Jacobemerick\Web\Domain\Blog\Post\MysqlPostRepository($container['db_connection_locator']); |
|
179 | - $this->total_post_count = $repository->getActivePostsCountByCategory($this->category->link); |
|
180 | - } |
|
177 | + global $container; |
|
178 | + $repository = new Jacobemerick\Web\Domain\Blog\Post\MysqlPostRepository($container['db_connection_locator']); |
|
179 | + $this->total_post_count = $repository->getActivePostsCountByCategory($this->category->link); |
|
180 | + } |
|
181 | 181 | return $this->total_post_count; |
182 | 182 | } |
183 | 183 |
@@ -67,10 +67,10 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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,16 +156,16 @@ discard block |
||
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 | 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 | 170 | return Content::instance('URLSafe', "/{$this->category->link}/" . ($this->page + 1) . '/')->activate(); |
171 | 171 | } |
@@ -173,7 +173,7 @@ discard block |
||
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); |
@@ -74,8 +74,7 @@ discard block |
||
74 | 74 | { |
75 | 75 | $this->set_title(self::$TITLE_MAIN_HIKING); |
76 | 76 | $this->set_description(self::$DESCRIPTION_MAIN_HIKING); |
77 | - } |
|
78 | - else |
|
77 | + } else |
|
79 | 78 | { |
80 | 79 | $this->set_title(sprintf(self::$TITLE_PAGINATED_HIKING, $this->page, $this->total_pages)); |
81 | 80 | $this->set_description(sprintf(self::$DESCRIPTION_PAGINATED_HIKING, $this->page, $this->total_pages)); |
@@ -87,8 +86,7 @@ discard block |
||
87 | 86 | { |
88 | 87 | $this->set_title(self::$TITLE_MAIN_PERSONAL); |
89 | 88 | $this->set_description(self::$DESCRIPTION_MAIN_PERSONAL); |
90 | - } |
|
91 | - else |
|
89 | + } else |
|
92 | 90 | { |
93 | 91 | $this->set_title(sprintf(self::$TITLE_PAGINATED_PERSONAL, $this->page, $this->total_pages)); |
94 | 92 | $this->set_description(sprintf(self::$DESCRIPTION_PAGINATED_PERSONAL, $this->page, $this->total_pages)); |
@@ -100,8 +98,7 @@ discard block |
||
100 | 98 | { |
101 | 99 | $this->set_title(self::$TITLE_MAIN_WEBDEVELOPMENT); |
102 | 100 | $this->set_description(self::$DESCRIPTION_MAIN_WEBDEVELOPMENT); |
103 | - } |
|
104 | - else |
|
101 | + } else |
|
105 | 102 | { |
106 | 103 | $this->set_title(sprintf(self::$TITLE_PAGINATED_WEBDEVELOPMENT, $this->page, $this->total_pages)); |
107 | 104 | $this->set_description(sprintf(self::$DESCRIPTION_PAGINATED_WEBDEVELOPMENT, $this->page, $this->total_pages)); |
@@ -134,8 +131,9 @@ discard block |
||
134 | 131 | protected function get_page_number() |
135 | 132 | { |
136 | 133 | $page = URLDecode::getPiece(2); |
137 | - if(isset($page) && is_numeric($page)) |
|
138 | - return $page; |
|
134 | + if(isset($page) && is_numeric($page)) { |
|
135 | + return $page; |
|
136 | + } |
|
139 | 137 | return 1; |
140 | 138 | } |
141 | 139 | |
@@ -156,17 +154,20 @@ discard block |
||
156 | 154 | |
157 | 155 | protected function get_list_next_link() |
158 | 156 | { |
159 | - if($this->page == 1) |
|
160 | - return; |
|
161 | - if($this->page == 2) |
|
162 | - return Content::instance('URLSafe', "/{$this->category->link}/")->activate(); |
|
157 | + if($this->page == 1) { |
|
158 | + return; |
|
159 | + } |
|
160 | + if($this->page == 2) { |
|
161 | + return Content::instance('URLSafe', "/{$this->category->link}/")->activate(); |
|
162 | + } |
|
163 | 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()) |
|
169 | - return; |
|
168 | + if(($this->page * self::$POSTS_PER_PAGE) >= $this->get_total_post_count()) { |
|
169 | + return; |
|
170 | + } |
|
170 | 171 | return Content::instance('URLSafe', "/{$this->category->link}/" . ($this->page + 1) . '/')->activate(); |
171 | 172 | } |
172 | 173 |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | |
16 | 16 | $handle = @fopen($config_path, 'r'); |
17 | 17 | if ($handle === false) { |
18 | - throw new RuntimeException("Could not load config"); |
|
18 | + throw new RuntimeException("Could not load config"); |
|
19 | 19 | } |
20 | 20 | $config = fread($handle, filesize($config_path)); |
21 | 21 | fclose($handle); |
@@ -23,71 +23,71 @@ discard block |
||
23 | 23 | $config = json_decode($config); |
24 | 24 | $last_json_error = json_last_error(); |
25 | 25 | if ($last_json_error !== JSON_ERROR_NONE) { |
26 | - throw new RuntimeException("Could not parse config - JSON error detected"); |
|
26 | + throw new RuntimeException("Could not parse config - JSON error detected"); |
|
27 | 27 | } |
28 | 28 | $container['config'] = $config; |
29 | 29 | |
30 | 30 | // timezones are fun |
31 | 31 | date_default_timezone_set('America/Phoenix'); // todo - belongs in configuration |
32 | 32 | $container['default_timezone'] = function ($c) { |
33 | - return new DateTimeZone('America/Phoenix'); |
|
33 | + return new DateTimeZone('America/Phoenix'); |
|
34 | 34 | }; |
35 | 35 | |
36 | 36 | |
37 | 37 | // configure the db connections holder |
38 | 38 | $db_connections = new Aura\Sql\ConnectionLocator(); |
39 | 39 | $db_connections->setDefault(function () use ($config) { |
40 | - $connection = $config->database->slave; |
|
41 | - return new Aura\Sql\ExtendedPdo( |
|
42 | - "mysql:host={$connection->host}", |
|
43 | - $connection->user, |
|
44 | - $connection->password |
|
45 | - ); |
|
40 | + $connection = $config->database->slave; |
|
41 | + return new Aura\Sql\ExtendedPdo( |
|
42 | + "mysql:host={$connection->host}", |
|
43 | + $connection->user, |
|
44 | + $connection->password |
|
45 | + ); |
|
46 | 46 | }); |
47 | 47 | $db_connections->setWrite('master', function () use ($config) { |
48 | - $connection = $config->database->master; |
|
49 | - return new Aura\Sql\ExtendedPdo( |
|
50 | - "mysql:host={$connection->host}", |
|
51 | - $connection->user, |
|
52 | - $connection->password |
|
53 | - ); |
|
48 | + $connection = $config->database->master; |
|
49 | + return new Aura\Sql\ExtendedPdo( |
|
50 | + "mysql:host={$connection->host}", |
|
51 | + $connection->user, |
|
52 | + $connection->password |
|
53 | + ); |
|
54 | 54 | }); |
55 | 55 | $db_connections->setRead('slave', function () use ($config) { |
56 | - $connection = $config->database->slave; |
|
57 | - $pdo = new Aura\Sql\ExtendedPdo( |
|
58 | - "mysql:host={$connection->host}", |
|
59 | - $connection->user, |
|
60 | - $connection->password |
|
61 | - ); |
|
62 | - |
|
63 | - $profiler = new Aura\Sql\Profiler(); |
|
64 | - $profiler->setActive(true); |
|
65 | - $pdo->setProfiler($profiler); |
|
66 | - |
|
67 | - return $pdo; |
|
56 | + $connection = $config->database->slave; |
|
57 | + $pdo = new Aura\Sql\ExtendedPdo( |
|
58 | + "mysql:host={$connection->host}", |
|
59 | + $connection->user, |
|
60 | + $connection->password |
|
61 | + ); |
|
62 | + |
|
63 | + $profiler = new Aura\Sql\Profiler(); |
|
64 | + $profiler->setActive(true); |
|
65 | + $pdo->setProfiler($profiler); |
|
66 | + |
|
67 | + return $pdo; |
|
68 | 68 | }); |
69 | 69 | $container['db_connection_locator'] = $db_connections; |
70 | 70 | |
71 | 71 | |
72 | 72 | // setup mail handler |
73 | 73 | $container['mail'] = $container->factory(function ($c) { |
74 | - return (new Jacobemerick\Archangel\Archangel())->setLogger($c['logger']); |
|
74 | + return (new Jacobemerick\Archangel\Archangel())->setLogger($c['logger']); |
|
75 | 75 | }); |
76 | 76 | |
77 | 77 | |
78 | 78 | // setup the logger |
79 | 79 | $container['setup_logger'] = $container->protect(function ($name) use ($container) { |
80 | - $logger = new Monolog\Logger($name); |
|
80 | + $logger = new Monolog\Logger($name); |
|
81 | 81 | |
82 | - $logPath = __DIR__ . "/../logs/{$name}.log"; |
|
83 | - $streamHandler = new Monolog\Handler\StreamHandler($logPath, Monolog\Logger::INFO); |
|
84 | - $streamHandler->setFormatter( |
|
85 | - new Monolog\Formatter\LineFormatter("[%datetime%] %channel%.%level_name%: %message%\n") |
|
86 | - ); |
|
87 | - $logger->pushHandler($streamHandler); |
|
82 | + $logPath = __DIR__ . "/../logs/{$name}.log"; |
|
83 | + $streamHandler = new Monolog\Handler\StreamHandler($logPath, Monolog\Logger::INFO); |
|
84 | + $streamHandler->setFormatter( |
|
85 | + new Monolog\Formatter\LineFormatter("[%datetime%] %channel%.%level_name%: %message%\n") |
|
86 | + ); |
|
87 | + $logger->pushHandler($streamHandler); |
|
88 | 88 | |
89 | - Monolog\ErrorHandler::register($logger); |
|
90 | - $container['logger'] = $logger; |
|
89 | + Monolog\ErrorHandler::register($logger); |
|
90 | + $container['logger'] = $logger; |
|
91 | 91 | }); |
92 | 92 | |
93 | 93 | |
@@ -108,30 +108,30 @@ discard block |
||
108 | 108 | |
109 | 109 | // sets up shutdown function to display profiler |
110 | 110 | register_shutdown_function(function () use ($container) { |
111 | - if ( |
|
112 | - !isset($_COOKIE['debugger']) || |
|
113 | - $_COOKIE['debugger'] != 'display' |
|
114 | - ) { |
|
115 | - return; |
|
116 | - } |
|
117 | - |
|
118 | - $dbProfiles = $container['db_connection_locator'] |
|
119 | - ->getRead() |
|
120 | - ->getProfiler() |
|
121 | - ->getProfiles(); |
|
122 | - $dbProfiles = array_filter($dbProfiles, function ($profile) { |
|
123 | - return $profile['function'] == 'perform'; |
|
124 | - }); |
|
125 | - $dbProfiles = array_map(function ($profile) { |
|
126 | - return [ |
|
127 | - 'sql' => trim(preg_replace('/\s+/', ' ', $profile['statement'])), |
|
128 | - 'parameters' => $profile['bind_values'], |
|
129 | - 'time' => $profile['duration'], |
|
130 | - ]; |
|
131 | - }, $dbProfiles); |
|
132 | - $container['profiler']->setProfiledQueries($dbProfiles); |
|
133 | - $container['profiler']->setDisplay(new Particletree\Pqp\Display()); |
|
134 | - $container['profiler']->display($container['db_connection_locator']->getRead()); |
|
111 | + if ( |
|
112 | + !isset($_COOKIE['debugger']) || |
|
113 | + $_COOKIE['debugger'] != 'display' |
|
114 | + ) { |
|
115 | + return; |
|
116 | + } |
|
117 | + |
|
118 | + $dbProfiles = $container['db_connection_locator'] |
|
119 | + ->getRead() |
|
120 | + ->getProfiler() |
|
121 | + ->getProfiles(); |
|
122 | + $dbProfiles = array_filter($dbProfiles, function ($profile) { |
|
123 | + return $profile['function'] == 'perform'; |
|
124 | + }); |
|
125 | + $dbProfiles = array_map(function ($profile) { |
|
126 | + return [ |
|
127 | + 'sql' => trim(preg_replace('/\s+/', ' ', $profile['statement'])), |
|
128 | + 'parameters' => $profile['bind_values'], |
|
129 | + 'time' => $profile['duration'], |
|
130 | + ]; |
|
131 | + }, $dbProfiles); |
|
132 | + $container['profiler']->setProfiledQueries($dbProfiles); |
|
133 | + $container['profiler']->setDisplay(new Particletree\Pqp\Display()); |
|
134 | + $container['profiler']->display($container['db_connection_locator']->getRead()); |
|
135 | 135 | }); |
136 | 136 | |
137 | 137 | $container['console']->logMemory(null, 'PHP - Post-boostrap memory'); |
@@ -29,14 +29,14 @@ discard block |
||
29 | 29 | |
30 | 30 | // timezones are fun |
31 | 31 | date_default_timezone_set('America/Phoenix'); // todo - belongs in configuration |
32 | -$container['default_timezone'] = function ($c) { |
|
32 | +$container['default_timezone'] = function($c) { |
|
33 | 33 | return new DateTimeZone('America/Phoenix'); |
34 | 34 | }; |
35 | 35 | |
36 | 36 | |
37 | 37 | // configure the db connections holder |
38 | 38 | $db_connections = new Aura\Sql\ConnectionLocator(); |
39 | -$db_connections->setDefault(function () use ($config) { |
|
39 | +$db_connections->setDefault(function() use ($config) { |
|
40 | 40 | $connection = $config->database->slave; |
41 | 41 | return new Aura\Sql\ExtendedPdo( |
42 | 42 | "mysql:host={$connection->host}", |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | $connection->password |
45 | 45 | ); |
46 | 46 | }); |
47 | -$db_connections->setWrite('master', function () use ($config) { |
|
47 | +$db_connections->setWrite('master', function() use ($config) { |
|
48 | 48 | $connection = $config->database->master; |
49 | 49 | return new Aura\Sql\ExtendedPdo( |
50 | 50 | "mysql:host={$connection->host}", |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | $connection->password |
53 | 53 | ); |
54 | 54 | }); |
55 | -$db_connections->setRead('slave', function () use ($config) { |
|
55 | +$db_connections->setRead('slave', function() use ($config) { |
|
56 | 56 | $connection = $config->database->slave; |
57 | 57 | $pdo = new Aura\Sql\ExtendedPdo( |
58 | 58 | "mysql:host={$connection->host}", |
@@ -70,13 +70,13 @@ discard block |
||
70 | 70 | |
71 | 71 | |
72 | 72 | // setup mail handler |
73 | -$container['mail'] = $container->factory(function ($c) { |
|
73 | +$container['mail'] = $container->factory(function($c) { |
|
74 | 74 | return (new Jacobemerick\Archangel\Archangel())->setLogger($c['logger']); |
75 | 75 | }); |
76 | 76 | |
77 | 77 | |
78 | 78 | // setup the logger |
79 | -$container['setup_logger'] = $container->protect(function ($name) use ($container) { |
|
79 | +$container['setup_logger'] = $container->protect(function($name) use ($container) { |
|
80 | 80 | $logger = new Monolog\Logger($name); |
81 | 81 | |
82 | 82 | $logPath = __DIR__ . "/../logs/{$name}.log"; |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | |
108 | 108 | |
109 | 109 | // sets up shutdown function to display profiler |
110 | -register_shutdown_function(function () use ($container) { |
|
110 | +register_shutdown_function(function() use ($container) { |
|
111 | 111 | if ( |
112 | 112 | !isset($_COOKIE['debugger']) || |
113 | 113 | $_COOKIE['debugger'] != 'display' |
@@ -119,10 +119,10 @@ discard block |
||
119 | 119 | ->getRead() |
120 | 120 | ->getProfiler() |
121 | 121 | ->getProfiles(); |
122 | - $dbProfiles = array_filter($dbProfiles, function ($profile) { |
|
122 | + $dbProfiles = array_filter($dbProfiles, function($profile) { |
|
123 | 123 | return $profile['function'] == 'perform'; |
124 | 124 | }); |
125 | - $dbProfiles = array_map(function ($profile) { |
|
125 | + $dbProfiles = array_map(function($profile) { |
|
126 | 126 | return [ |
127 | 127 | 'sql' => trim(preg_replace('/\s+/', ' ', $profile['statement'])), |
128 | 128 | 'parameters' => $profile['bind_values'], |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | ], |
27 | 27 | ]; |
28 | 28 | |
29 | - return array_map(function ($row) { |
|
29 | + return array_map(function($row) { |
|
30 | 30 | return (object) $row; |
31 | 31 | }, $paths); |
32 | 32 | } |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | ], |
49 | 49 | ]; |
50 | 50 | |
51 | - return array_map(function ($row) { |
|
51 | + return array_map(function($row) { |
|
52 | 52 | return (object) $row; |
53 | 53 | }, $paths); |
54 | 54 | } |
@@ -5,56 +5,56 @@ |
||
5 | 5 | class PortfolioRouter extends Router |
6 | 6 | { |
7 | 7 | |
8 | - protected function get_redirect_array() |
|
9 | - { |
|
10 | - $paths = [ |
|
11 | - [ |
|
12 | - 'pattern' => '@/index.(html|htm|php)$@', |
|
13 | - 'replace' => '/', |
|
14 | - ], |
|
15 | - [ |
|
16 | - 'pattern' => '@^/print(/?)$@', |
|
17 | - 'replace' => '/projects/', |
|
18 | - ], |
|
19 | - [ |
|
20 | - 'pattern' => '@^/web(/?)$@', |
|
21 | - 'replace' => '/projects/', |
|
22 | - ], |
|
23 | - [ |
|
24 | - 'pattern' => '@^/(web|print)/([a-z0-9-]+)(/?)$@', |
|
25 | - 'replace' => '/projects/', |
|
26 | - ], |
|
27 | - ]; |
|
8 | + protected function get_redirect_array() |
|
9 | + { |
|
10 | + $paths = [ |
|
11 | + [ |
|
12 | + 'pattern' => '@/index.(html|htm|php)$@', |
|
13 | + 'replace' => '/', |
|
14 | + ], |
|
15 | + [ |
|
16 | + 'pattern' => '@^/print(/?)$@', |
|
17 | + 'replace' => '/projects/', |
|
18 | + ], |
|
19 | + [ |
|
20 | + 'pattern' => '@^/web(/?)$@', |
|
21 | + 'replace' => '/projects/', |
|
22 | + ], |
|
23 | + [ |
|
24 | + 'pattern' => '@^/(web|print)/([a-z0-9-]+)(/?)$@', |
|
25 | + 'replace' => '/projects/', |
|
26 | + ], |
|
27 | + ]; |
|
28 | 28 | |
29 | - return array_map(function ($row) { |
|
30 | - return (object) $row; |
|
31 | - }, $paths); |
|
32 | - } |
|
29 | + return array_map(function ($row) { |
|
30 | + return (object) $row; |
|
31 | + }, $paths); |
|
32 | + } |
|
33 | 33 | |
34 | - protected function get_direct_array() |
|
35 | - { |
|
36 | - $paths = [ |
|
37 | - [ |
|
38 | - 'match' => '/', |
|
39 | - 'controller' => 'AboutController', |
|
40 | - ], |
|
41 | - [ |
|
42 | - 'match' => '/contact/', |
|
43 | - 'controller' => 'ContactController', |
|
44 | - ], |
|
45 | - [ |
|
46 | - 'match' => '/projects/', |
|
47 | - 'controller' => 'ProjectsController', |
|
48 | - ], |
|
49 | - [ |
|
50 | - 'match' => '/resume/', |
|
51 | - 'controller' => 'ResumeController', |
|
52 | - ], |
|
53 | - ]; |
|
34 | + protected function get_direct_array() |
|
35 | + { |
|
36 | + $paths = [ |
|
37 | + [ |
|
38 | + 'match' => '/', |
|
39 | + 'controller' => 'AboutController', |
|
40 | + ], |
|
41 | + [ |
|
42 | + 'match' => '/contact/', |
|
43 | + 'controller' => 'ContactController', |
|
44 | + ], |
|
45 | + [ |
|
46 | + 'match' => '/projects/', |
|
47 | + 'controller' => 'ProjectsController', |
|
48 | + ], |
|
49 | + [ |
|
50 | + 'match' => '/resume/', |
|
51 | + 'controller' => 'ResumeController', |
|
52 | + ], |
|
53 | + ]; |
|
54 | 54 | |
55 | - return array_map(function ($row) { |
|
56 | - return (object) $row; |
|
57 | - }, $paths); |
|
58 | - } |
|
55 | + return array_map(function ($row) { |
|
56 | + return (object) $row; |
|
57 | + }, $paths); |
|
58 | + } |
|
59 | 59 | |
60 | 60 | } |
@@ -36,7 +36,7 @@ |
||
36 | 36 | $active_page = ucfirst(URLDecode::getPiece(1)); |
37 | 37 | } |
38 | 38 | |
39 | - return array_map(function ($row) use ($active_page) { |
|
39 | + return array_map(function($row) use ($active_page) { |
|
40 | 40 | $row = (object) $row; |
41 | 41 | $row->active = ($row->name == $active_page); |
42 | 42 | return $row; |
@@ -5,56 +5,56 @@ |
||
5 | 5 | abstract class DefaultPageController extends PageController |
6 | 6 | { |
7 | 7 | |
8 | - public function __construct() |
|
9 | - { |
|
10 | - parent::__construct(); |
|
11 | - |
|
12 | - $this->add_css('reset'); |
|
13 | - $this->add_css('portfolio'); |
|
14 | - } |
|
15 | - |
|
16 | - protected function set_body_data() |
|
17 | - { |
|
18 | - $this->set_body('header_data', [ |
|
19 | - 'menu' => $this->get_menu(), |
|
20 | - 'home_link' => Loader::getRootURL(), |
|
21 | - ]); |
|
22 | - $this->set_body('activity_array', $this->get_recent_activity()); |
|
23 | - |
|
24 | - $this->set_body_view('Page'); |
|
25 | - } |
|
26 | - |
|
27 | - protected function get_menu() |
|
28 | - { |
|
29 | - $menu = [ |
|
30 | - [ |
|
31 | - 'name' => 'About', |
|
32 | - 'link' => Loader::getRootURL(), |
|
33 | - ], |
|
34 | - [ |
|
35 | - 'name' => 'Projects', |
|
36 | - 'link' => Loader::getRootURL() . 'projects/', |
|
37 | - ], |
|
38 | - [ |
|
39 | - 'name' => 'Résumé', |
|
40 | - 'link' => Loader::getRootURL() . 'resume/', |
|
41 | - ], |
|
42 | - [ |
|
43 | - 'name' => 'Contact', |
|
44 | - 'link' => Loader::getRootURL() . 'contact/', |
|
45 | - ], |
|
46 | - ]; |
|
47 | - |
|
48 | - if (!URLDecode::getPiece(1)) { |
|
49 | - $active_page = 'About'; |
|
50 | - } else { |
|
51 | - $active_page = ucfirst(URLDecode::getPiece(1)); |
|
52 | - } |
|
53 | - |
|
54 | - return array_map(function ($row) use ($active_page) { |
|
55 | - $row = (object) $row; |
|
56 | - $row->active = ($row->name == $active_page); |
|
57 | - return $row; |
|
58 | - }, $menu); |
|
59 | - } |
|
8 | + public function __construct() |
|
9 | + { |
|
10 | + parent::__construct(); |
|
11 | + |
|
12 | + $this->add_css('reset'); |
|
13 | + $this->add_css('portfolio'); |
|
14 | + } |
|
15 | + |
|
16 | + protected function set_body_data() |
|
17 | + { |
|
18 | + $this->set_body('header_data', [ |
|
19 | + 'menu' => $this->get_menu(), |
|
20 | + 'home_link' => Loader::getRootURL(), |
|
21 | + ]); |
|
22 | + $this->set_body('activity_array', $this->get_recent_activity()); |
|
23 | + |
|
24 | + $this->set_body_view('Page'); |
|
25 | + } |
|
26 | + |
|
27 | + protected function get_menu() |
|
28 | + { |
|
29 | + $menu = [ |
|
30 | + [ |
|
31 | + 'name' => 'About', |
|
32 | + 'link' => Loader::getRootURL(), |
|
33 | + ], |
|
34 | + [ |
|
35 | + 'name' => 'Projects', |
|
36 | + 'link' => Loader::getRootURL() . 'projects/', |
|
37 | + ], |
|
38 | + [ |
|
39 | + 'name' => 'Résumé', |
|
40 | + 'link' => Loader::getRootURL() . 'resume/', |
|
41 | + ], |
|
42 | + [ |
|
43 | + 'name' => 'Contact', |
|
44 | + 'link' => Loader::getRootURL() . 'contact/', |
|
45 | + ], |
|
46 | + ]; |
|
47 | + |
|
48 | + if (!URLDecode::getPiece(1)) { |
|
49 | + $active_page = 'About'; |
|
50 | + } else { |
|
51 | + $active_page = ucfirst(URLDecode::getPiece(1)); |
|
52 | + } |
|
53 | + |
|
54 | + return array_map(function ($row) use ($active_page) { |
|
55 | + $row = (object) $row; |
|
56 | + $row->active = ($row->name == $active_page); |
|
57 | + return $row; |
|
58 | + }, $menu); |
|
59 | + } |
|
60 | 60 | } |
@@ -5,92 +5,92 @@ |
||
5 | 5 | class ContactController extends DefaultPageController |
6 | 6 | { |
7 | 7 | |
8 | - protected function set_head_data() |
|
9 | - { |
|
10 | - $this->set_title("Contact Page | Jacob Emerick's Portfolio"); |
|
11 | - $this->set_description("Contact page for Jacob Emerick's Portfolio"); |
|
12 | - $this->set_keywords([ |
|
13 | - 'portfolio', |
|
14 | - 'programming portfolio', |
|
15 | - 'contact', |
|
16 | - 'Jacob Emerick', |
|
17 | - 'information', |
|
18 | - 'freelance', |
|
19 | - ]); |
|
20 | - } |
|
8 | + protected function set_head_data() |
|
9 | + { |
|
10 | + $this->set_title("Contact Page | Jacob Emerick's Portfolio"); |
|
11 | + $this->set_description("Contact page for Jacob Emerick's Portfolio"); |
|
12 | + $this->set_keywords([ |
|
13 | + 'portfolio', |
|
14 | + 'programming portfolio', |
|
15 | + 'contact', |
|
16 | + 'Jacob Emerick', |
|
17 | + 'information', |
|
18 | + 'freelance', |
|
19 | + ]); |
|
20 | + } |
|
21 | 21 | |
22 | - protected function set_body_data() |
|
23 | - { |
|
24 | - $this->set_body('body_view', 'Contact'); |
|
22 | + protected function set_body_data() |
|
23 | + { |
|
24 | + $this->set_body('body_view', 'Contact'); |
|
25 | 25 | |
26 | - $body_data = []; |
|
27 | - if (!empty($_POST)) { |
|
28 | - $body_data = $this->process_form_data(); |
|
29 | - } |
|
30 | - $body_data['domain_container'] = $this->get_domain_container(); |
|
31 | - $this->set_body('body_data', $body_data); |
|
26 | + $body_data = []; |
|
27 | + if (!empty($_POST)) { |
|
28 | + $body_data = $this->process_form_data(); |
|
29 | + } |
|
30 | + $body_data['domain_container'] = $this->get_domain_container(); |
|
31 | + $this->set_body('body_data', $body_data); |
|
32 | 32 | |
33 | - parent::set_body_data(); |
|
34 | - } |
|
33 | + parent::set_body_data(); |
|
34 | + } |
|
35 | 35 | |
36 | - private function process_form_data() |
|
37 | - { |
|
38 | - $errors = []; |
|
36 | + private function process_form_data() |
|
37 | + { |
|
38 | + $errors = []; |
|
39 | 39 | |
40 | - if ( |
|
41 | - empty($_POST['name']) || |
|
42 | - !is_string($_POST['name']) || |
|
43 | - strlen($_POST['name']) > 100 |
|
44 | - ) { |
|
45 | - $errors['name'] = 'Please enter a valid name.'; |
|
46 | - } |
|
40 | + if ( |
|
41 | + empty($_POST['name']) || |
|
42 | + !is_string($_POST['name']) || |
|
43 | + strlen($_POST['name']) > 100 |
|
44 | + ) { |
|
45 | + $errors['name'] = 'Please enter a valid name.'; |
|
46 | + } |
|
47 | 47 | |
48 | - if (!filter_var($_POST['email'], FILTER_VALIDATE_EMAIL)) { |
|
49 | - $errors['email'] = 'Please enter a valid email.'; |
|
50 | - } |
|
48 | + if (!filter_var($_POST['email'], FILTER_VALIDATE_EMAIL)) { |
|
49 | + $errors['email'] = 'Please enter a valid email.'; |
|
50 | + } |
|
51 | 51 | |
52 | - if ( |
|
53 | - empty($_POST['message']) || |
|
54 | - !is_string($_POST['message']) || |
|
55 | - strlen($_POST['message']) > 10000 |
|
56 | - ) { |
|
57 | - $errors['message'] = 'Please enter a valid message.'; |
|
58 | - } |
|
52 | + if ( |
|
53 | + empty($_POST['message']) || |
|
54 | + !is_string($_POST['message']) || |
|
55 | + strlen($_POST['message']) > 10000 |
|
56 | + ) { |
|
57 | + $errors['message'] = 'Please enter a valid message.'; |
|
58 | + } |
|
59 | 59 | |
60 | - if (!empty($errors)) { |
|
61 | - $values = $_POST; |
|
62 | - $values = array_intersect_key($values, array_flip([ |
|
63 | - 'name', |
|
64 | - 'email', |
|
65 | - 'message', |
|
66 | - ])); |
|
60 | + if (!empty($errors)) { |
|
61 | + $values = $_POST; |
|
62 | + $values = array_intersect_key($values, array_flip([ |
|
63 | + 'name', |
|
64 | + 'email', |
|
65 | + 'message', |
|
66 | + ])); |
|
67 | 67 | |
68 | - return [ |
|
69 | - 'errors' => $errors, |
|
70 | - 'values' => $values, |
|
71 | - ]; |
|
72 | - } |
|
68 | + return [ |
|
69 | + 'errors' => $errors, |
|
70 | + 'values' => $values, |
|
71 | + ]; |
|
72 | + } |
|
73 | 73 | |
74 | - $message = [ |
|
75 | - "Name: {$_POST['name']}", |
|
76 | - "Email: {$_POST['email']}", |
|
77 | - '', |
|
78 | - 'Message:', |
|
79 | - $_POST['message'], |
|
80 | - ]; |
|
81 | - $message = implode("\n", $message); |
|
74 | + $message = [ |
|
75 | + "Name: {$_POST['name']}", |
|
76 | + "Email: {$_POST['email']}", |
|
77 | + '', |
|
78 | + 'Message:', |
|
79 | + $_POST['message'], |
|
80 | + ]; |
|
81 | + $message = implode("\n", $message); |
|
82 | 82 | |
83 | - global $container; |
|
84 | - $container['mail'] |
|
85 | - ->addTo($container['config']->admin_email) |
|
86 | - ->setSubject('Portfolio Contact') |
|
87 | - ->setPlainMessage($message) |
|
88 | - ->send(); |
|
83 | + global $container; |
|
84 | + $container['mail'] |
|
85 | + ->addTo($container['config']->admin_email) |
|
86 | + ->setSubject('Portfolio Contact') |
|
87 | + ->setPlainMessage($message) |
|
88 | + ->send(); |
|
89 | 89 | |
90 | - return [ |
|
91 | - 'success' => |
|
92 | - "Thank you for your message, {$_POST['name']}! " . |
|
93 | - "I'll get back to you as soon as possible." |
|
94 | - ]; |
|
95 | - } |
|
90 | + return [ |
|
91 | + 'success' => |
|
92 | + "Thank you for your message, {$_POST['name']}! " . |
|
93 | + "I'll get back to you as soon as possible." |
|
94 | + ]; |
|
95 | + } |
|
96 | 96 | } |
@@ -5,24 +5,24 @@ |
||
5 | 5 | class ProjectsController extends DefaultPageController |
6 | 6 | { |
7 | 7 | |
8 | - protected function set_head_data() |
|
9 | - { |
|
10 | - $this->set_title("Projects Page | Jacob Emerick's Portfolio"); |
|
11 | - $this->set_description("Collection of key open-source projects that Jacob has developed and maintained over the years."); |
|
12 | - $this->set_keywords([ |
|
13 | - 'projects', |
|
14 | - 'open source', |
|
15 | - 'example work', |
|
16 | - 'portfolio', |
|
17 | - 'Jacob Emerick', |
|
18 | - 'software development', |
|
19 | - ]); |
|
20 | - } |
|
8 | + protected function set_head_data() |
|
9 | + { |
|
10 | + $this->set_title("Projects Page | Jacob Emerick's Portfolio"); |
|
11 | + $this->set_description("Collection of key open-source projects that Jacob has developed and maintained over the years."); |
|
12 | + $this->set_keywords([ |
|
13 | + 'projects', |
|
14 | + 'open source', |
|
15 | + 'example work', |
|
16 | + 'portfolio', |
|
17 | + 'Jacob Emerick', |
|
18 | + 'software development', |
|
19 | + ]); |
|
20 | + } |
|
21 | 21 | |
22 | - protected function set_body_data() |
|
23 | - { |
|
24 | - $this->set_body('body_view', 'Projects'); |
|
22 | + protected function set_body_data() |
|
23 | + { |
|
24 | + $this->set_body('body_view', 'Projects'); |
|
25 | 25 | |
26 | - parent::set_body_data(); |
|
27 | - } |
|
26 | + parent::set_body_data(); |
|
27 | + } |
|
28 | 28 | } |
@@ -5,26 +5,26 @@ |
||
5 | 5 | class AboutController extends DefaultPageController |
6 | 6 | { |
7 | 7 | |
8 | - protected function set_head_data() |
|
9 | - { |
|
10 | - $this->set_title("Jacob Emerick's Portfolio"); |
|
11 | - $this->set_description("Jacob Emerick's Portfolio - collection of programming projects and resume"); |
|
12 | - $this->set_keywords([ |
|
13 | - 'portfolio', |
|
14 | - 'Jacob Emerick', |
|
15 | - 'web development', |
|
16 | - 'web programming', |
|
17 | - 'software development', |
|
18 | - 'agile', |
|
19 | - 'freelance', |
|
20 | - ]); |
|
21 | - } |
|
8 | + protected function set_head_data() |
|
9 | + { |
|
10 | + $this->set_title("Jacob Emerick's Portfolio"); |
|
11 | + $this->set_description("Jacob Emerick's Portfolio - collection of programming projects and resume"); |
|
12 | + $this->set_keywords([ |
|
13 | + 'portfolio', |
|
14 | + 'Jacob Emerick', |
|
15 | + 'web development', |
|
16 | + 'web programming', |
|
17 | + 'software development', |
|
18 | + 'agile', |
|
19 | + 'freelance', |
|
20 | + ]); |
|
21 | + } |
|
22 | 22 | |
23 | - protected function set_body_data() |
|
24 | - { |
|
25 | - $this->set_body('body_view', 'About'); |
|
26 | - $this->set_body('body_data', []); |
|
23 | + protected function set_body_data() |
|
24 | + { |
|
25 | + $this->set_body('body_view', 'About'); |
|
26 | + $this->set_body('body_data', []); |
|
27 | 27 | |
28 | - parent::set_body_data(); |
|
29 | - } |
|
28 | + parent::set_body_data(); |
|
29 | + } |
|
30 | 30 | } |