@@ -4,8 +4,8 @@ discard block |
||
4 | 4 | 'Header', |
5 | 5 | 'Request')); |
6 | 6 | |
7 | -abstract class AJAXController |
|
8 | -{ |
|
7 | +abstract class AJAXController |
|
8 | +{ |
|
9 | 9 | |
10 | 10 | private static $RESPONSE_HEADER = 'sendJSON'; |
11 | 11 | |
@@ -13,18 +13,20 @@ discard block |
||
13 | 13 | |
14 | 14 | abstract protected function set_data(); |
15 | 15 | |
16 | - function __construct() {} |
|
16 | + function __construct() |
|
17 | + { |
|
18 | +} |
|
17 | 19 | |
18 | - public function activate() |
|
19 | - { |
|
20 | + public function activate() |
|
21 | + { |
|
20 | 22 | call_user_func(array('Header', self::$RESPONSE_HEADER)); |
21 | 23 | |
22 | 24 | $this->set_data(); |
23 | 25 | echo $this->response_as_json(); |
24 | 26 | } |
25 | 27 | |
26 | - protected function set_response($message, $type = 'internal') |
|
27 | - { |
|
28 | + protected function set_response($message, $type = 'internal') |
|
29 | + { |
|
28 | 30 | switch($type) |
29 | 31 | { |
30 | 32 | case 'internal' : |
@@ -38,21 +40,21 @@ discard block |
||
38 | 40 | } |
39 | 41 | } |
40 | 42 | |
41 | - protected function fail_response($message) |
|
42 | - { |
|
43 | + protected function fail_response($message) |
|
44 | + { |
|
43 | 45 | $this->set_response($message, 'error'); |
44 | 46 | return false; |
45 | 47 | } |
46 | 48 | |
47 | - protected function eject($message) |
|
48 | - { |
|
49 | + protected function eject($message) |
|
50 | + { |
|
49 | 51 | $this->fail_response($message); |
50 | 52 | echo $this->response_as_json(); |
51 | 53 | exit(); |
52 | 54 | } |
53 | 55 | |
54 | - private function response_as_json() |
|
55 | - { |
|
56 | + private function response_as_json() |
|
57 | + { |
|
56 | 58 | return json_encode($this->response); |
57 | 59 | } |
58 | 60 |
@@ -2,16 +2,20 @@ |
||
2 | 2 | |
3 | 3 | Loader::load('controller', '/PageController'); |
4 | 4 | |
5 | -class Error301Controller extends PageController |
|
6 | -{ |
|
5 | +class Error301Controller extends PageController |
|
6 | +{ |
|
7 | 7 | |
8 | - public function __construct($uri) |
|
9 | - { |
|
8 | + public function __construct($uri) |
|
9 | + { |
|
10 | 10 | Header::redirect($uri); |
11 | 11 | exit; |
12 | 12 | } |
13 | 13 | |
14 | - protected function set_head_data() {} |
|
15 | - protected function set_body_data() {} |
|
14 | + protected function set_head_data() |
|
15 | + { |
|
16 | +} |
|
17 | + protected function set_body_data() |
|
18 | + { |
|
19 | +} |
|
16 | 20 | |
17 | 21 | } |
@@ -2,17 +2,17 @@ |
||
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 | - protected function set_head_data() |
|
9 | - { |
|
8 | + protected function set_head_data() |
|
9 | + { |
|
10 | 10 | $this->add_css('normalize'); |
11 | 11 | $this->add_css('home'); |
12 | 12 | } |
13 | 13 | |
14 | - protected function set_body_data() |
|
15 | - { |
|
14 | + protected function set_body_data() |
|
15 | + { |
|
16 | 16 | $this->set_body('activity_array', $this->get_recent_activity()); |
17 | 17 | } |
18 | 18 |
@@ -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,8 @@ 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() |
|
28 | + { |
|
29 | 29 | $this->set_title(self::$TITLE); |
30 | 30 | $this->set_description(self::$DESCRIPTION); |
31 | 31 | $this->set_keywords(self::$KEYWORD_ARRAY); |
@@ -33,16 +33,16 @@ discard block |
||
33 | 33 | parent::set_head_data(); |
34 | 34 | } |
35 | 35 | |
36 | - protected function set_body_data() |
|
37 | - { |
|
36 | + protected function set_body_data() |
|
37 | + { |
|
38 | 38 | $this->set_body('post_array', $this->get_recent_posts()); |
39 | 39 | $this->set_body_view('Home'); |
40 | 40 | |
41 | 41 | parent::set_body_data(); |
42 | 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); |
@@ -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,8 @@ discard block |
||
16 | 16 | 'email', |
17 | 17 | 'connect'); |
18 | 18 | |
19 | - protected function set_head_data() |
|
20 | - { |
|
19 | + protected function set_head_data() |
|
20 | + { |
|
21 | 21 | $this->set_title(self::$TITLE); |
22 | 22 | $this->set_description(self::$DESCRIPTION); |
23 | 23 | $this->set_keywords(self::$KEYWORD_ARRAY); |
@@ -25,27 +25,31 @@ discard block |
||
25 | 25 | parent::set_head_data(); |
26 | 26 | } |
27 | 27 | |
28 | - protected function set_body_data() |
|
29 | - { |
|
28 | + protected function set_body_data() |
|
29 | + { |
|
30 | 30 | $this->set_body('form_container', $this->process_form()); |
31 | 31 | $this->set_body_view('Contact'); |
32 | 32 | |
33 | 33 | parent::set_body_data(); |
34 | 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 | |
41 | 42 | Loader::load('utility', 'Validate'); |
42 | 43 | $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'; |
|
44 | + if(!Validate::checkRequest('post', 'name', 'string')) { |
|
45 | + $error_result['name'] = 'please enter your name'; |
|
46 | + } |
|
47 | + if(!Validate::checkRequest('post', 'email', 'string')) { |
|
48 | + $error_result['email'] = 'please enter a valid email'; |
|
49 | + } |
|
50 | + if(!Validate::checkRequest('post', 'message', 'string')) { |
|
51 | + $error_result['message'] = 'please write a message'; |
|
52 | + } |
|
49 | 53 | |
50 | 54 | $values = (object) array( |
51 | 55 | 'name' => Request::getPost('name'), |
@@ -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,8 @@ discard block |
||
17 | 17 | 'web developer', |
18 | 18 | 'hiker'); |
19 | 19 | |
20 | - protected function set_head_data() |
|
21 | - { |
|
20 | + protected function set_head_data() |
|
21 | + { |
|
22 | 22 | $this->set_title(self::$TITLE); |
23 | 23 | $this->set_description(self::$DESCRIPTION); |
24 | 24 | $this->set_keywords(self::$KEYWORD_ARRAY); |
@@ -26,8 +26,8 @@ discard block |
||
26 | 26 | parent::set_head_data(); |
27 | 27 | } |
28 | 28 | |
29 | - protected function set_body_data() |
|
30 | - { |
|
29 | + protected function set_body_data() |
|
30 | + { |
|
31 | 31 | $this->set_body_view('About'); |
32 | 32 | |
33 | 33 | parent::set_body_data(); |
@@ -5,8 +5,8 @@ discard block |
||
5 | 5 | 'waterfall/LogCollector')); |
6 | 6 | Loader::load('controller', 'waterfalls/DefaultPageController'); |
7 | 7 | |
8 | -final class LogController extends DefaultPageController |
|
9 | -{ |
|
8 | +final class LogController extends DefaultPageController |
|
9 | +{ |
|
10 | 10 | |
11 | 11 | private static $AUTHOR = 'Jacob Emerick'; |
12 | 12 | private static $AUTHOR_URL = 'https://home.jacobemerick.com/'; |
@@ -18,15 +18,16 @@ discard block |
||
18 | 18 | |
19 | 19 | private $log; |
20 | 20 | |
21 | - public function __construct() |
|
22 | - { |
|
21 | + public function __construct() |
|
22 | + { |
|
23 | 23 | parent::__construct(); |
24 | 24 | |
25 | 25 | $log_path = URLDecode::getPiece(2); |
26 | 26 | |
27 | 27 | $this->log = LogCollector::getByAlias($log_path); |
28 | - if(!$this->log) |
|
29 | - $this->eject(); |
|
28 | + if(!$this->log) { |
|
29 | + $this->eject(); |
|
30 | + } |
|
30 | 31 | |
31 | 32 | $this->parent_navigation_item = 'journal'; |
32 | 33 | |
@@ -39,8 +40,8 @@ discard block |
||
39 | 40 | $this->add_waterfall_js(); |
40 | 41 | } |
41 | 42 | |
42 | - protected function set_head_data() |
|
43 | - { |
|
43 | + protected function set_head_data() |
|
44 | + { |
|
44 | 45 | parent::set_head_data(); |
45 | 46 | |
46 | 47 | $this->set_title("{$this->log->title} | " . self::$WEBSITE_TITLE); |
@@ -56,8 +57,8 @@ discard block |
||
56 | 57 | $this->set_keywords($keyword_array); |
57 | 58 | } |
58 | 59 | |
59 | - protected function set_body_data($page_type = 'normal') |
|
60 | - { |
|
60 | + protected function set_body_data($page_type = 'normal') |
|
61 | + { |
|
61 | 62 | parent::set_body_data($page_type); |
62 | 63 | |
63 | 64 | $this->set_body('view', 'Log'); |
@@ -71,8 +72,8 @@ discard block |
||
71 | 72 | $this->set_body('data', $body_data); |
72 | 73 | } |
73 | 74 | |
74 | - private function get_formatted_log() |
|
75 | - { |
|
75 | + private function get_formatted_log() |
|
76 | + { |
|
76 | 77 | $formatted_log = array(); |
77 | 78 | |
78 | 79 | $formatted_log['introduction'] = $this->get_log_introduction($this->log); |
@@ -84,8 +85,8 @@ discard block |
||
84 | 85 | return $formatted_log; |
85 | 86 | } |
86 | 87 | |
87 | - private function get_log_introduction($log) |
|
88 | - { |
|
88 | + private function get_log_introduction($log) |
|
89 | + { |
|
89 | 90 | return array( |
90 | 91 | 'title' => $log->title, |
91 | 92 | 'url' => Loader::getRootURL('waterfalls') . self::$JOURNAL_DIRECTORY . '/' . $log->alias . '/', |
@@ -103,8 +104,8 @@ discard block |
||
103 | 104 | } |
104 | 105 | |
105 | 106 | // @todo - link things up |
106 | - private function get_formatted_log_body() |
|
107 | - { |
|
107 | + private function get_formatted_log_body() |
|
108 | + { |
|
108 | 109 | $body = $this->log->body; |
109 | 110 | |
110 | 111 | $body = Content::instance('FixPhoto', $body)->activate(false, 'standard'); |
@@ -113,8 +114,8 @@ discard block |
||
113 | 114 | return $body; |
114 | 115 | } |
115 | 116 | |
116 | - private function get_series() |
|
117 | - { |
|
117 | + private function get_series() |
|
118 | + { |
|
118 | 119 | $series = array( |
119 | 120 | 'previous' => array(), |
120 | 121 | 'next' => array()); |
@@ -140,8 +141,8 @@ discard block |
||
140 | 141 | return $series; |
141 | 142 | } |
142 | 143 | |
143 | - private function get_sidebar() |
|
144 | - { |
|
144 | + private function get_sidebar() |
|
145 | + { |
|
145 | 146 | $sidebar = array(); |
146 | 147 | |
147 | 148 | $sidebar['companion_list'] = array(); |
@@ -174,12 +175,13 @@ discard block |
||
174 | 175 | return $sidebar; |
175 | 176 | } |
176 | 177 | |
177 | - private function get_album() |
|
178 | - { |
|
178 | + private function get_album() |
|
179 | + { |
|
179 | 180 | $album = array(); |
180 | 181 | |
181 | - if($this->log->album == 0) |
|
182 | - return $album; |
|
182 | + if($this->log->album == 0) { |
|
183 | + return $album; |
|
184 | + } |
|
183 | 185 | |
184 | 186 | $photo_list = AlbumCollector::getPhotoListForAlbum($this->log->album); |
185 | 187 | foreach($photo_list as $photo) |
@@ -188,10 +190,11 @@ discard block |
||
188 | 190 | $photo_array['full_link'] = sprintf(self::$FULL_IMAGE_LINK, $photo->category, $photo->name); |
189 | 191 | $photo_array['description'] = $photo->description; |
190 | 192 | |
191 | - if($photo->height < $photo->width) |
|
192 | - list($height, $width) = array(75, 100); |
|
193 | - else |
|
194 | - list($height, $width) = array(100, 75); |
|
193 | + if($photo->height < $photo->width) { |
|
194 | + list($height, $width) = array(75, 100); |
|
195 | + } else { |
|
196 | + list($height, $width) = array(100, 75); |
|
197 | + } |
|
195 | 198 | |
196 | 199 | $photo_array['image_node'] = sprintf( |
197 | 200 | self::$THUMB_IMAGE_NODE, |
@@ -7,23 +7,23 @@ discard block |
||
7 | 7 | 'waterfall/WaterfallCollector')); |
8 | 8 | Loader::load('controller', 'waterfalls/DefaultListController'); |
9 | 9 | |
10 | -abstract class DefaultWaterfallListController extends DefaultListController |
|
11 | -{ |
|
10 | +abstract class DefaultWaterfallListController extends DefaultListController |
|
11 | +{ |
|
12 | 12 | |
13 | 13 | protected static $ITEM_COUNT_PER_PAGE = 24; |
14 | 14 | |
15 | - final protected function get_list_view() |
|
16 | - { |
|
15 | + final protected function get_list_view() |
|
16 | + { |
|
17 | 17 | return 'FallListing'; |
18 | 18 | } |
19 | 19 | |
20 | - protected function get_item_count_per_page() |
|
21 | - { |
|
20 | + protected function get_item_count_per_page() |
|
21 | + { |
|
22 | 22 | return self::$ITEM_COUNT_PER_PAGE; |
23 | 23 | } |
24 | 24 | |
25 | - final protected function format_item($item) |
|
26 | - { |
|
25 | + final protected function format_item($item) |
|
26 | + { |
|
27 | 27 | $item_array = array(); |
28 | 28 | |
29 | 29 | $item_array['name'] = $item->name; |
@@ -36,8 +36,8 @@ discard block |
||
36 | 36 | return $item_array; |
37 | 37 | } |
38 | 38 | |
39 | - final protected function get_sidebar() |
|
40 | - { |
|
39 | + final protected function get_sidebar() |
|
40 | + { |
|
41 | 41 | $county_result = CountyCollector::getCountyList(); |
42 | 42 | $county_list = array(); |
43 | 43 |
@@ -5,8 +5,8 @@ discard block |
||
5 | 5 | 'waterfall/LogCollector')); |
6 | 6 | Loader::load('controller', 'waterfalls/DefaultLogListController'); |
7 | 7 | |
8 | -final class LogListController extends DefaultLogListController |
|
9 | -{ |
|
8 | +final class LogListController extends DefaultLogListController |
|
9 | +{ |
|
10 | 10 | |
11 | 11 | private static $PRIMARY_TITLE = 'Journal from Waterfall Hikes'; |
12 | 12 | private static $PRIMARY_DESCRIPTION = 'Stories written by Jacob Emerick about his epic waterfall adventures in the general Keweenaw, Ontonagon, and Marquette areas.'; |
@@ -28,8 +28,8 @@ discard block |
||
28 | 28 | private static $NAVIGATION_DESCRIPTION = 'displaying %d ~ %d of %d total journal entries'; |
29 | 29 | private static $LINK_ROOT = '/journal/'; |
30 | 30 | |
31 | - protected function get_initial_meta() |
|
32 | - { |
|
31 | + protected function get_initial_meta() |
|
32 | + { |
|
33 | 33 | $meta_array = array(); |
34 | 34 | |
35 | 35 | $meta_array['title'] = self::$PRIMARY_TITLE . ' | ' . self::$WEBSITE_TITLE; |
@@ -39,8 +39,8 @@ discard block |
||
39 | 39 | return $meta_array; |
40 | 40 | } |
41 | 41 | |
42 | - protected function get_subsequent_meta() |
|
43 | - { |
|
42 | + protected function get_subsequent_meta() |
|
43 | + { |
|
44 | 44 | $meta_array = array(); |
45 | 45 | |
46 | 46 | $meta_array['title'] = sprintf(self::$SECONDARY_TITLE . ' | ' . self::$WEBSITE_TITLE, $this->page); |
@@ -50,8 +50,8 @@ discard block |
||
50 | 50 | return $meta_array; |
51 | 51 | } |
52 | 52 | |
53 | - protected function get_initial_introduction() |
|
54 | - { |
|
53 | + protected function get_initial_introduction() |
|
54 | + { |
|
55 | 55 | $introduction = array(); |
56 | 56 | |
57 | 57 | $introduction['title'] = self::$PRIMARY_INTRODUCTION_HEADER; |
@@ -63,34 +63,34 @@ discard block |
||
63 | 63 | return $introduction; |
64 | 64 | } |
65 | 65 | |
66 | - protected function get_subsequent_introduction() |
|
67 | - { |
|
66 | + protected function get_subsequent_introduction() |
|
67 | + { |
|
68 | 68 | return array( |
69 | 69 | 'title' => sprintf(self::$SECONDARY_INTRODUCTION_HEADER, $this->page, $this->page_count)); |
70 | 70 | } |
71 | 71 | |
72 | - protected function get_page_number_piece() |
|
73 | - { |
|
72 | + protected function get_page_number_piece() |
|
73 | + { |
|
74 | 74 | return URLDecode::getPiece(2); |
75 | 75 | } |
76 | 76 | |
77 | - protected function get_item_result($total, $offset) |
|
78 | - { |
|
77 | + protected function get_item_result($total, $offset) |
|
78 | + { |
|
79 | 79 | return LogCollector::getList($total, $offset); |
80 | 80 | } |
81 | 81 | |
82 | - protected function get_item_count_result() |
|
83 | - { |
|
82 | + protected function get_item_count_result() |
|
83 | + { |
|
84 | 84 | return LogCollector::getListCount(); |
85 | 85 | } |
86 | 86 | |
87 | - protected function get_list_description_pattern() |
|
88 | - { |
|
87 | + protected function get_list_description_pattern() |
|
88 | + { |
|
89 | 89 | return self::$NAVIGATION_DESCRIPTION; |
90 | 90 | } |
91 | 91 | |
92 | - protected function get_list_link_root() |
|
93 | - { |
|
92 | + protected function get_list_link_root() |
|
93 | + { |
|
94 | 94 | return self::$LINK_ROOT; |
95 | 95 | } |
96 | 96 |