@@ -2,8 +2,8 @@ discard block |
||
2 | 2 | |
3 | 3 | Loader::load('controller', 'home/DefaultPageController'); |
4 | 4 | |
5 | -final class AboutController extends DefaultPageController |
|
6 | -{ |
|
5 | +final class AboutController extends DefaultPageController |
|
6 | +{ |
|
7 | 7 | |
8 | 8 | private static $TITLE = 'About | Jacob Emerick'; |
9 | 9 | private static $DESCRIPTION = 'Some basic information about Jacob Emerick and his past, web development, and hiking adventures'; |
@@ -17,8 +17,7 @@ discard block |
||
17 | 17 | 'web developer', |
18 | 18 | 'hiker'); |
19 | 19 | |
20 | - protected function set_head_data() |
|
21 | - { |
|
20 | + protected function set_head_data() { |
|
22 | 21 | $this->set_title(self::$TITLE); |
23 | 22 | $this->set_description(self::$DESCRIPTION); |
24 | 23 | $this->set_keywords(self::$KEYWORD_ARRAY); |
@@ -26,8 +25,7 @@ discard block |
||
26 | 25 | parent::set_head_data(); |
27 | 26 | } |
28 | 27 | |
29 | - protected function set_body_data() |
|
30 | - { |
|
28 | + protected function set_body_data() { |
|
31 | 29 | $this->set_body_view('About'); |
32 | 30 | |
33 | 31 | parent::set_body_data(); |
@@ -2,8 +2,8 @@ discard block |
||
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 |
||
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 |
||
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'), |
@@ -5,8 +5,8 @@ discard block |
||
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 |
||
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 |
||
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); |
@@ -2,11 +2,10 @@ discard block |
||
2 | 2 | |
3 | 3 | Loader::load('controller', 'site/DefaultPageController'); |
4 | 4 | |
5 | -final class TermsController extends DefaultPageController |
|
6 | -{ |
|
5 | +final class TermsController extends DefaultPageController |
|
6 | +{ |
|
7 | 7 | |
8 | - protected function set_head_data() |
|
9 | - { |
|
8 | + protected function set_head_data() { |
|
10 | 9 | $this->set_title("Terms of Use for Jacob Emerick's Sites"); |
11 | 10 | $this->set_description("Some basic (and boring) legal jargon and perferred usage of the content on Jacob Emerick's sites. Includes re-use terms and advice on retracing hikes."); |
12 | 11 | $this->set_keywords(array('terms of use', 'legal', 'accountability', 'trespassing', 'Jacob Emerick')); |
@@ -14,8 +13,7 @@ discard block |
||
14 | 13 | parent::set_head_data(); |
15 | 14 | } |
16 | 15 | |
17 | - protected function set_body_data() |
|
18 | - { |
|
16 | + protected function set_body_data() { |
|
19 | 17 | $this->set_body('top_data', array('title' => 'Terms of Use')); |
20 | 18 | |
21 | 19 | $this->set_body('body_view', 'Terms'); |
@@ -4,11 +4,10 @@ discard block |
||
4 | 4 | |
5 | 5 | Loader::load('controller', 'site/DefaultPageController'); |
6 | 6 | |
7 | -final class ChangelogController extends DefaultPageController |
|
8 | -{ |
|
7 | +final class ChangelogController extends DefaultPageController |
|
8 | +{ |
|
9 | 9 | |
10 | - protected function set_head_data() |
|
11 | - { |
|
10 | + protected function set_head_data() { |
|
12 | 11 | $this->set_title("Changelog for Jacob Emerick's Sites"); |
13 | 12 | $this->set_description("Listing of the last changes done on the framework behind Jacob Emerick's websites. Yeah, he's down with that version control."); |
14 | 13 | $this->set_keywords(array('changelog', 'version control', 'code', 'comments', 'Jacob Emerick')); |
@@ -16,8 +15,7 @@ discard block |
||
16 | 15 | parent::set_head_data(); |
17 | 16 | } |
18 | 17 | |
19 | - protected function set_body_data() |
|
20 | - { |
|
18 | + protected function set_body_data() { |
|
21 | 19 | parent::set_body_data(); |
22 | 20 | |
23 | 21 | $this->set_body('top_data', array('title' => 'Change Log')); |
@@ -26,8 +24,7 @@ discard block |
||
26 | 24 | $this->set_body('body_view', 'Changelog'); |
27 | 25 | } |
28 | 26 | |
29 | - private function get_changelog() |
|
30 | - { |
|
27 | + private function get_changelog() { |
|
31 | 28 | global $container; |
32 | 29 | $changelogRepository = new MysqlChangelogRepository($container['db_connection_locator']); |
33 | 30 | $changelog_result = $changelogRepository->getChanges(40); |
@@ -2,8 +2,8 @@ discard block |
||
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 | 8 | private static $MENU = array( |
9 | 9 | array( |
@@ -19,14 +19,12 @@ discard block |
||
19 | 19 | 'name' => 'Contact', |
20 | 20 | 'uri' => 'contact')); |
21 | 21 | |
22 | - protected function set_head_data() |
|
23 | - { |
|
22 | + protected function set_head_data() { |
|
24 | 23 | $this->add_css('reset'); |
25 | 24 | $this->add_css('site'); |
26 | 25 | } |
27 | 26 | |
28 | - protected function set_body_data() |
|
29 | - { |
|
27 | + protected function set_body_data() { |
|
30 | 28 | $this->set_body('top_data', array()); |
31 | 29 | $this->set_body('body_data', array()); |
32 | 30 | |
@@ -36,8 +34,7 @@ discard block |
||
36 | 34 | $this->set_body_view('Page'); |
37 | 35 | } |
38 | 36 | |
39 | - private function get_menu() |
|
40 | - { |
|
37 | + private function get_menu() { |
|
41 | 38 | $active_page = $this->get_active_page(); |
42 | 39 | |
43 | 40 | $menu = array(); |
@@ -52,18 +49,19 @@ discard block |
||
52 | 49 | return $menu; |
53 | 50 | } |
54 | 51 | |
55 | - private function get_active_page() |
|
56 | - { |
|
52 | + private function get_active_page() { |
|
57 | 53 | $current_uri = URLDecode::getPiece(1); |
58 | 54 | |
59 | - if(!isset($current_uri)) |
|
60 | - return 'About'; |
|
55 | + if(!isset($current_uri)) { |
|
56 | + return 'About'; |
|
57 | + } |
|
61 | 58 | |
62 | 59 | $menu = self::$MENU; |
63 | 60 | foreach($menu as $link) |
64 | 61 | { |
65 | - if($link['uri'] == $current_uri) |
|
66 | - return $link['name']; |
|
62 | + if($link['uri'] == $current_uri) { |
|
63 | + return $link['name']; |
|
64 | + } |
|
67 | 65 | } |
68 | 66 | |
69 | 67 | return 'About'; |
@@ -4,11 +4,10 @@ discard block |
||
4 | 4 | Loader::load('utility', array( |
5 | 5 | 'Validate')); |
6 | 6 | |
7 | -final class ContactController extends DefaultPageController |
|
8 | -{ |
|
7 | +final class ContactController extends DefaultPageController |
|
8 | +{ |
|
9 | 9 | |
10 | - protected function set_head_data() |
|
11 | - { |
|
10 | + protected function set_head_data() { |
|
12 | 11 | $this->set_title("Contact Form for Jacob Emerick's Sites"); |
13 | 12 | $this->set_description("Want to reach out to Jacob Emerick with questions or concerns? Well, then here's a handy contact form for you that will connect you with the man himself."); |
14 | 13 | $this->set_keywords(array('contact', 'webmaster', 'support', 'help', 'Jacob Emerick')); |
@@ -16,8 +15,7 @@ discard block |
||
16 | 15 | parent::set_head_data(); |
17 | 16 | } |
18 | 17 | |
19 | - protected function set_body_data() |
|
20 | - { |
|
18 | + protected function set_body_data() { |
|
21 | 19 | parent::set_body_data(); |
22 | 20 | |
23 | 21 | $this->set_body('top_data', array('title' => 'Contact Me')); |
@@ -26,17 +24,20 @@ discard block |
||
26 | 24 | $this->set_body('body_view', 'Contact'); |
27 | 25 | } |
28 | 26 | |
29 | - private function get_form_results() |
|
30 | - { |
|
31 | - if(!Request::hasPost()) |
|
32 | - return array(); |
|
27 | + private function get_form_results() { |
|
28 | + if(!Request::hasPost()) { |
|
29 | + return array(); |
|
30 | + } |
|
33 | 31 | |
34 | - if(!Validate::checkRequest('post', 'name', 'string')) |
|
35 | - $error_message['name'] = 'Please enter a value for your name.'; |
|
36 | - if(!Validate::checkRequest('post', 'email', 'string')) |
|
37 | - $error_message['email'] = 'Please enter a valid email address.'; |
|
38 | - if(!Validate::checkRequest('post', 'message', 'string')) |
|
39 | - $error_message['message'] = 'Please enter a message.'; |
|
32 | + if(!Validate::checkRequest('post', 'name', 'string')) { |
|
33 | + $error_message['name'] = 'Please enter a value for your name.'; |
|
34 | + } |
|
35 | + if(!Validate::checkRequest('post', 'email', 'string')) { |
|
36 | + $error_message['email'] = 'Please enter a valid email address.'; |
|
37 | + } |
|
38 | + if(!Validate::checkRequest('post', 'message', 'string')) { |
|
39 | + $error_message['message'] = 'Please enter a message.'; |
|
40 | + } |
|
40 | 41 | |
41 | 42 | if(!empty($error_message)) |
42 | 43 | { |
@@ -2,11 +2,10 @@ discard block |
||
2 | 2 | |
3 | 3 | Loader::load('controller', 'site/DefaultPageController'); |
4 | 4 | |
5 | -final class HomeController extends DefaultPageController |
|
6 | -{ |
|
5 | +final class HomeController extends DefaultPageController |
|
6 | +{ |
|
7 | 7 | |
8 | - protected function set_head_data() |
|
9 | - { |
|
8 | + protected function set_head_data() { |
|
10 | 9 | $this->set_title("Jacob Emerick's Site Information | General and Technical Information"); |
11 | 10 | $this->set_description("Meta information about Jacob Emerick's websites and content. Introduces the man behind the code, discusses the reasons behind the sites, and goes into some technical background of the custom framework."); |
12 | 11 | $this->set_keywords(array('site', 'technical', 'support', 'help', 'information', 'Jacob Emerick')); |
@@ -14,8 +13,7 @@ discard block |
||
14 | 13 | parent::set_head_data(); |
15 | 14 | } |
16 | 15 | |
17 | - protected function set_body_data() |
|
18 | - { |
|
16 | + protected function set_body_data() { |
|
19 | 17 | $this->set_body('body_view', 'Home'); |
20 | 18 | |
21 | 19 | parent::set_body_data(); |
@@ -2,11 +2,10 @@ |
||
2 | 2 | |
3 | 3 | Loader::load('controller', '/PageController'); |
4 | 4 | |
5 | -class Error303Controller extends PageController |
|
6 | -{ |
|
5 | +class Error303Controller extends PageController |
|
6 | +{ |
|
7 | 7 | |
8 | - public function __construct($uri) |
|
9 | - { |
|
8 | + public function __construct($uri) { |
|
10 | 9 | Header::redirect($uri, 303); |
11 | 10 | exit; |
12 | 11 | } |