@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | $alias = URLDecode::getPiece(2); |
28 | 28 | $this->companion = CompanionCollector::getByAlias($alias); |
29 | 29 | |
30 | - if(!$this->companion) |
|
30 | + if (!$this->companion) |
|
31 | 31 | $this->eject(); |
32 | 32 | |
33 | 33 | parent::__construct(); |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | { |
38 | 38 | $meta_array = array(); |
39 | 39 | |
40 | - $meta_array['title'] = "Hiking Stories with {$this->companion->name} | " . self::$WEBSITE_TITLE; |
|
40 | + $meta_array['title'] = "Hiking Stories with {$this->companion->name} | ".self::$WEBSITE_TITLE; |
|
41 | 41 | $meta_array['description'] = $this->companion->description; |
42 | 42 | $meta_array['keywords'] = $this->get_keyword_array(); |
43 | 43 | |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | { |
49 | 49 | $meta_array = array(); |
50 | 50 | |
51 | - $meta_array['title'] = sprintf(self::$DEFAULT_TITLE . ' | ' . self::$WEBSITE_TITLE, $this->companion->name, $this->page, $this->page_count); |
|
51 | + $meta_array['title'] = sprintf(self::$DEFAULT_TITLE.' | '.self::$WEBSITE_TITLE, $this->companion->name, $this->page, $this->page_count); |
|
52 | 52 | $meta_array['description'] = sprintf(self::$DEFAULT_DESCRIPTION, $this->page, $this->page_count, $this->companion->name); |
53 | 53 | $meta_array['keywords'] = $this->get_keyword_array(); |
54 | 54 |
@@ -6,102 +6,102 @@ |
||
6 | 6 | final class CompanionListController extends DefaultLogListController |
7 | 7 | { |
8 | 8 | |
9 | - private static $DEFAULT_TITLE = 'Hiking with %s, Page %d of %d'; |
|
10 | - private static $DEFAULT_DESCRIPTION = 'Page %d of %d of legendary hiking stories with %s written by Jacob Emerick, all about his adventures hunting waterfalls in the Upper Peninsula of Michigan'; |
|
11 | - private static $DEFAULT_HEADER = 'Page %d of Legendary Hiking Stories with %s'; |
|
12 | - |
|
13 | - private static $KEYWORD_ARRAY = array( |
|
14 | - 'hiking companions', |
|
15 | - 'journal', |
|
16 | - 'stories', |
|
17 | - 'blog', |
|
18 | - 'waterfalls'); |
|
19 | - |
|
20 | - private static $NAVIGATION_DESCRIPTION = 'displaying %d ~ %d of %d journal entries with %COMPANION%'; |
|
21 | - private static $LINK_ROOT = '/companion/%s/'; |
|
22 | - |
|
23 | - private $companion; |
|
24 | - |
|
25 | - public function __construct() |
|
26 | - { |
|
27 | - $alias = URLDecode::getPiece(2); |
|
28 | - $this->companion = CompanionCollector::getByAlias($alias); |
|
9 | + private static $DEFAULT_TITLE = 'Hiking with %s, Page %d of %d'; |
|
10 | + private static $DEFAULT_DESCRIPTION = 'Page %d of %d of legendary hiking stories with %s written by Jacob Emerick, all about his adventures hunting waterfalls in the Upper Peninsula of Michigan'; |
|
11 | + private static $DEFAULT_HEADER = 'Page %d of Legendary Hiking Stories with %s'; |
|
12 | + |
|
13 | + private static $KEYWORD_ARRAY = array( |
|
14 | + 'hiking companions', |
|
15 | + 'journal', |
|
16 | + 'stories', |
|
17 | + 'blog', |
|
18 | + 'waterfalls'); |
|
19 | + |
|
20 | + private static $NAVIGATION_DESCRIPTION = 'displaying %d ~ %d of %d journal entries with %COMPANION%'; |
|
21 | + private static $LINK_ROOT = '/companion/%s/'; |
|
22 | + |
|
23 | + private $companion; |
|
24 | + |
|
25 | + public function __construct() |
|
26 | + { |
|
27 | + $alias = URLDecode::getPiece(2); |
|
28 | + $this->companion = CompanionCollector::getByAlias($alias); |
|
29 | 29 | |
30 | - if(!$this->companion) |
|
31 | - $this->eject(); |
|
30 | + if(!$this->companion) |
|
31 | + $this->eject(); |
|
32 | 32 | |
33 | - parent::__construct(); |
|
34 | - } |
|
33 | + parent::__construct(); |
|
34 | + } |
|
35 | 35 | |
36 | - protected function get_initial_meta() |
|
37 | - { |
|
38 | - $meta_array = array(); |
|
36 | + protected function get_initial_meta() |
|
37 | + { |
|
38 | + $meta_array = array(); |
|
39 | 39 | |
40 | - $meta_array['title'] = "Hiking Stories with {$this->companion->name} | " . self::$WEBSITE_TITLE; |
|
41 | - $meta_array['description'] = $this->companion->description; |
|
42 | - $meta_array['keywords'] = $this->get_keyword_array(); |
|
40 | + $meta_array['title'] = "Hiking Stories with {$this->companion->name} | " . self::$WEBSITE_TITLE; |
|
41 | + $meta_array['description'] = $this->companion->description; |
|
42 | + $meta_array['keywords'] = $this->get_keyword_array(); |
|
43 | 43 | |
44 | - return $meta_array; |
|
45 | - } |
|
44 | + return $meta_array; |
|
45 | + } |
|
46 | 46 | |
47 | - protected function get_subsequent_meta() |
|
48 | - { |
|
49 | - $meta_array = array(); |
|
47 | + protected function get_subsequent_meta() |
|
48 | + { |
|
49 | + $meta_array = array(); |
|
50 | 50 | |
51 | - $meta_array['title'] = sprintf(self::$DEFAULT_TITLE . ' | ' . self::$WEBSITE_TITLE, $this->companion->name, $this->page, $this->page_count); |
|
52 | - $meta_array['description'] = sprintf(self::$DEFAULT_DESCRIPTION, $this->page, $this->page_count, $this->companion->name); |
|
53 | - $meta_array['keywords'] = $this->get_keyword_array(); |
|
51 | + $meta_array['title'] = sprintf(self::$DEFAULT_TITLE . ' | ' . self::$WEBSITE_TITLE, $this->companion->name, $this->page, $this->page_count); |
|
52 | + $meta_array['description'] = sprintf(self::$DEFAULT_DESCRIPTION, $this->page, $this->page_count, $this->companion->name); |
|
53 | + $meta_array['keywords'] = $this->get_keyword_array(); |
|
54 | 54 | |
55 | - return $meta_array; |
|
56 | - } |
|
57 | - |
|
58 | - private function get_keyword_array() |
|
59 | - { |
|
60 | - $keyword_array = self::$KEYWORD_ARRAY; |
|
61 | - array_unshift($keyword_array, strtolower($this->companion->name)); |
|
62 | - return $keyword_array; |
|
63 | - } |
|
64 | - |
|
65 | - protected function get_initial_introduction() |
|
66 | - { |
|
67 | - $introduction = array(); |
|
55 | + return $meta_array; |
|
56 | + } |
|
57 | + |
|
58 | + private function get_keyword_array() |
|
59 | + { |
|
60 | + $keyword_array = self::$KEYWORD_ARRAY; |
|
61 | + array_unshift($keyword_array, strtolower($this->companion->name)); |
|
62 | + return $keyword_array; |
|
63 | + } |
|
64 | + |
|
65 | + protected function get_initial_introduction() |
|
66 | + { |
|
67 | + $introduction = array(); |
|
68 | 68 | |
69 | - $introduction['title'] = $this->companion->title; |
|
70 | - $introduction['description'] = Content::instance('FixInternalLink', $this->companion->introduction)->activate(); |
|
71 | - $introduction['image'] = $this->get_image_element($this->companion->photo_category, $this->companion->photo, $this->companion->photo_description, 'medium'); |
|
69 | + $introduction['title'] = $this->companion->title; |
|
70 | + $introduction['description'] = Content::instance('FixInternalLink', $this->companion->introduction)->activate(); |
|
71 | + $introduction['image'] = $this->get_image_element($this->companion->photo_category, $this->companion->photo, $this->companion->photo_description, 'medium'); |
|
72 | 72 | |
73 | - return $introduction; |
|
74 | - } |
|
75 | - |
|
76 | - protected function get_subsequent_introduction() |
|
77 | - { |
|
78 | - return array( |
|
79 | - 'title' => sprintf(self::$DEFAULT_HEADER, $this->page, $this->companion->name)); |
|
80 | - } |
|
81 | - |
|
82 | - protected function get_page_number_piece() |
|
83 | - { |
|
84 | - return URLDecode::getPiece(3); |
|
85 | - } |
|
86 | - |
|
87 | - protected function get_item_result($total, $offset) |
|
88 | - { |
|
89 | - return CompanionCollector::getLogListForCompanion($this->companion->id, $total, $offset); |
|
90 | - } |
|
91 | - |
|
92 | - protected function get_item_count_result() |
|
93 | - { |
|
94 | - return CompanionCollector::getLogCountForCompanion($this->companion->id); |
|
95 | - } |
|
96 | - |
|
97 | - protected function get_list_description_pattern() |
|
98 | - { |
|
99 | - return str_replace('%COMPANION%', $this->companion->name, self::$NAVIGATION_DESCRIPTION); |
|
100 | - } |
|
101 | - |
|
102 | - protected function get_list_link_root() |
|
103 | - { |
|
104 | - return sprintf(self::$LINK_ROOT, $this->companion->alias); |
|
105 | - } |
|
73 | + return $introduction; |
|
74 | + } |
|
75 | + |
|
76 | + protected function get_subsequent_introduction() |
|
77 | + { |
|
78 | + return array( |
|
79 | + 'title' => sprintf(self::$DEFAULT_HEADER, $this->page, $this->companion->name)); |
|
80 | + } |
|
81 | + |
|
82 | + protected function get_page_number_piece() |
|
83 | + { |
|
84 | + return URLDecode::getPiece(3); |
|
85 | + } |
|
86 | + |
|
87 | + protected function get_item_result($total, $offset) |
|
88 | + { |
|
89 | + return CompanionCollector::getLogListForCompanion($this->companion->id, $total, $offset); |
|
90 | + } |
|
91 | + |
|
92 | + protected function get_item_count_result() |
|
93 | + { |
|
94 | + return CompanionCollector::getLogCountForCompanion($this->companion->id); |
|
95 | + } |
|
96 | + |
|
97 | + protected function get_list_description_pattern() |
|
98 | + { |
|
99 | + return str_replace('%COMPANION%', $this->companion->name, self::$NAVIGATION_DESCRIPTION); |
|
100 | + } |
|
101 | + |
|
102 | + protected function get_list_link_root() |
|
103 | + { |
|
104 | + return sprintf(self::$LINK_ROOT, $this->companion->alias); |
|
105 | + } |
|
106 | 106 | |
107 | 107 | } |
108 | 108 | \ No newline at end of file |
@@ -3,8 +3,8 @@ discard block |
||
3 | 3 | Loader::load('collector', 'waterfall/CompanionCollector'); |
4 | 4 | Loader::load('controller', 'waterfalls/DefaultLogListController'); |
5 | 5 | |
6 | -final class CompanionListController extends DefaultLogListController |
|
7 | -{ |
|
6 | +final class CompanionListController extends DefaultLogListController |
|
7 | +{ |
|
8 | 8 | |
9 | 9 | private static $DEFAULT_TITLE = 'Hiking with %s, Page %d of %d'; |
10 | 10 | private static $DEFAULT_DESCRIPTION = 'Page %d of %d of legendary hiking stories with %s written by Jacob Emerick, all about his adventures hunting waterfalls in the Upper Peninsula of Michigan'; |
@@ -22,19 +22,20 @@ discard block |
||
22 | 22 | |
23 | 23 | private $companion; |
24 | 24 | |
25 | - public function __construct() |
|
26 | - { |
|
25 | + public function __construct() |
|
26 | + { |
|
27 | 27 | $alias = URLDecode::getPiece(2); |
28 | 28 | $this->companion = CompanionCollector::getByAlias($alias); |
29 | 29 | |
30 | - if(!$this->companion) |
|
31 | - $this->eject(); |
|
30 | + if(!$this->companion) { |
|
31 | + $this->eject(); |
|
32 | + } |
|
32 | 33 | |
33 | 34 | parent::__construct(); |
34 | 35 | } |
35 | 36 | |
36 | - protected function get_initial_meta() |
|
37 | - { |
|
37 | + protected function get_initial_meta() |
|
38 | + { |
|
38 | 39 | $meta_array = array(); |
39 | 40 | |
40 | 41 | $meta_array['title'] = "Hiking Stories with {$this->companion->name} | " . self::$WEBSITE_TITLE; |
@@ -44,8 +45,8 @@ discard block |
||
44 | 45 | return $meta_array; |
45 | 46 | } |
46 | 47 | |
47 | - protected function get_subsequent_meta() |
|
48 | - { |
|
48 | + protected function get_subsequent_meta() |
|
49 | + { |
|
49 | 50 | $meta_array = array(); |
50 | 51 | |
51 | 52 | $meta_array['title'] = sprintf(self::$DEFAULT_TITLE . ' | ' . self::$WEBSITE_TITLE, $this->companion->name, $this->page, $this->page_count); |
@@ -55,15 +56,15 @@ discard block |
||
55 | 56 | return $meta_array; |
56 | 57 | } |
57 | 58 | |
58 | - private function get_keyword_array() |
|
59 | - { |
|
59 | + private function get_keyword_array() |
|
60 | + { |
|
60 | 61 | $keyword_array = self::$KEYWORD_ARRAY; |
61 | 62 | array_unshift($keyword_array, strtolower($this->companion->name)); |
62 | 63 | return $keyword_array; |
63 | 64 | } |
64 | 65 | |
65 | - protected function get_initial_introduction() |
|
66 | - { |
|
66 | + protected function get_initial_introduction() |
|
67 | + { |
|
67 | 68 | $introduction = array(); |
68 | 69 | |
69 | 70 | $introduction['title'] = $this->companion->title; |
@@ -73,34 +74,34 @@ discard block |
||
73 | 74 | return $introduction; |
74 | 75 | } |
75 | 76 | |
76 | - protected function get_subsequent_introduction() |
|
77 | - { |
|
77 | + protected function get_subsequent_introduction() |
|
78 | + { |
|
78 | 79 | return array( |
79 | 80 | 'title' => sprintf(self::$DEFAULT_HEADER, $this->page, $this->companion->name)); |
80 | 81 | } |
81 | 82 | |
82 | - protected function get_page_number_piece() |
|
83 | - { |
|
83 | + protected function get_page_number_piece() |
|
84 | + { |
|
84 | 85 | return URLDecode::getPiece(3); |
85 | 86 | } |
86 | 87 | |
87 | - protected function get_item_result($total, $offset) |
|
88 | - { |
|
88 | + protected function get_item_result($total, $offset) |
|
89 | + { |
|
89 | 90 | return CompanionCollector::getLogListForCompanion($this->companion->id, $total, $offset); |
90 | 91 | } |
91 | 92 | |
92 | - protected function get_item_count_result() |
|
93 | - { |
|
93 | + protected function get_item_count_result() |
|
94 | + { |
|
94 | 95 | return CompanionCollector::getLogCountForCompanion($this->companion->id); |
95 | 96 | } |
96 | 97 | |
97 | - protected function get_list_description_pattern() |
|
98 | - { |
|
98 | + protected function get_list_description_pattern() |
|
99 | + { |
|
99 | 100 | return str_replace('%COMPANION%', $this->companion->name, self::$NAVIGATION_DESCRIPTION); |
100 | 101 | } |
101 | 102 | |
102 | - protected function get_list_link_root() |
|
103 | - { |
|
103 | + protected function get_list_link_root() |
|
104 | + { |
|
104 | 105 | return sprintf(self::$LINK_ROOT, $this->companion->alias); |
105 | 106 | } |
106 | 107 |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | { |
33 | 33 | $meta_array = array(); |
34 | 34 | |
35 | - $meta_array['title'] = self::$PRIMARY_TITLE . ' | ' . self::$WEBSITE_TITLE; |
|
35 | + $meta_array['title'] = self::$PRIMARY_TITLE.' | '.self::$WEBSITE_TITLE; |
|
36 | 36 | $meta_array['description'] = self::$PRIMARY_DESCRIPTION; |
37 | 37 | $meta_array['keywords'] = self::$KEYWORD_ARRAY; |
38 | 38 | |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | { |
44 | 44 | $meta_array = array(); |
45 | 45 | |
46 | - $meta_array['title'] = sprintf(self::$SECONDARY_TITLE . ' | ' . self::$WEBSITE_TITLE, $this->page, $this->page_count); |
|
46 | + $meta_array['title'] = sprintf(self::$SECONDARY_TITLE.' | '.self::$WEBSITE_TITLE, $this->page, $this->page_count); |
|
47 | 47 | $meta_array['description'] = sprintf(self::$SECONDARY_DESCRIPTION, $this->page, $this->page_count); |
48 | 48 | $meta_array['keywords'] = self::$KEYWORD_ARRAY; |
49 | 49 |
@@ -1,97 +1,97 @@ |
||
1 | 1 | <? |
2 | 2 | |
3 | 3 | Loader::load('collector', array( |
4 | - 'image/PhotoCollector', |
|
5 | - 'waterfall/WaterfallCollector')); |
|
4 | + 'image/PhotoCollector', |
|
5 | + 'waterfall/WaterfallCollector')); |
|
6 | 6 | Loader::load('controller', 'waterfalls/DefaultWaterfallListController'); |
7 | 7 | |
8 | 8 | final class WaterfallListController extends DefaultWaterfallListController |
9 | 9 | { |
10 | 10 | |
11 | - private static $PRIMARY_TITLE = 'Full Listing of Falls'; |
|
12 | - private static $PRIMARY_DESCRIPTION = 'List of waterfalls found in the general Keweenaw Area, complete with photos, descriptions, directions, and maps.'; |
|
13 | - private static $PRIMARY_INTRODUCTION_HEADER = 'A Giant List of Waterfalls'; |
|
14 | - private static $PRIMARY_INTRODUCTION_IMAGE = 2212; |
|
15 | - private static $PRIMARY_INTRODUCTION_DESCRIPTION = "Jacob has been to a lot of waterfalls. From the sandstone drops of Ontonagon to the volcanic plunges of the Huron Mountains to Keweenaw Ridge's craggy slides, he's gotten around. Some of the falls end up being surprising finds, numerous drops that are not documented anywhere else, while others end up being huge disappointments that barely warrant the long searches and planning stages."; |
|
16 | - |
|
17 | - private static $SECONDARY_TITLE = 'Falls Listing, Page %d of %d'; |
|
18 | - private static $SECONDARY_DESCRIPTION = 'Page %d of %d of waterfalls found in the general Keweenaw area.'; |
|
19 | - private static $SECONDARY_INTRODUCTION_HEADER = 'Page %d of %d of the full waterfall listing'; |
|
20 | - |
|
21 | - private static $KEYWORD_ARRAY = array( |
|
22 | - 'journal', |
|
23 | - 'stories', |
|
24 | - 'blog', |
|
25 | - 'waterfalls', |
|
26 | - 'hiking companions'); |
|
27 | - |
|
28 | - private static $NAVIGATION_DESCRIPTION = 'displaying %d ~ %d of %d total waterfalls'; |
|
29 | - private static $LINK_ROOT = '/falls/'; |
|
30 | - |
|
31 | - protected function get_initial_meta() |
|
32 | - { |
|
33 | - $meta_array = array(); |
|
11 | + private static $PRIMARY_TITLE = 'Full Listing of Falls'; |
|
12 | + private static $PRIMARY_DESCRIPTION = 'List of waterfalls found in the general Keweenaw Area, complete with photos, descriptions, directions, and maps.'; |
|
13 | + private static $PRIMARY_INTRODUCTION_HEADER = 'A Giant List of Waterfalls'; |
|
14 | + private static $PRIMARY_INTRODUCTION_IMAGE = 2212; |
|
15 | + private static $PRIMARY_INTRODUCTION_DESCRIPTION = "Jacob has been to a lot of waterfalls. From the sandstone drops of Ontonagon to the volcanic plunges of the Huron Mountains to Keweenaw Ridge's craggy slides, he's gotten around. Some of the falls end up being surprising finds, numerous drops that are not documented anywhere else, while others end up being huge disappointments that barely warrant the long searches and planning stages."; |
|
16 | + |
|
17 | + private static $SECONDARY_TITLE = 'Falls Listing, Page %d of %d'; |
|
18 | + private static $SECONDARY_DESCRIPTION = 'Page %d of %d of waterfalls found in the general Keweenaw area.'; |
|
19 | + private static $SECONDARY_INTRODUCTION_HEADER = 'Page %d of %d of the full waterfall listing'; |
|
20 | + |
|
21 | + private static $KEYWORD_ARRAY = array( |
|
22 | + 'journal', |
|
23 | + 'stories', |
|
24 | + 'blog', |
|
25 | + 'waterfalls', |
|
26 | + 'hiking companions'); |
|
27 | + |
|
28 | + private static $NAVIGATION_DESCRIPTION = 'displaying %d ~ %d of %d total waterfalls'; |
|
29 | + private static $LINK_ROOT = '/falls/'; |
|
30 | + |
|
31 | + protected function get_initial_meta() |
|
32 | + { |
|
33 | + $meta_array = array(); |
|
34 | 34 | |
35 | - $meta_array['title'] = self::$PRIMARY_TITLE . ' | ' . self::$WEBSITE_TITLE; |
|
36 | - $meta_array['description'] = self::$PRIMARY_DESCRIPTION; |
|
37 | - $meta_array['keywords'] = self::$KEYWORD_ARRAY; |
|
35 | + $meta_array['title'] = self::$PRIMARY_TITLE . ' | ' . self::$WEBSITE_TITLE; |
|
36 | + $meta_array['description'] = self::$PRIMARY_DESCRIPTION; |
|
37 | + $meta_array['keywords'] = self::$KEYWORD_ARRAY; |
|
38 | 38 | |
39 | - return $meta_array; |
|
40 | - } |
|
39 | + return $meta_array; |
|
40 | + } |
|
41 | 41 | |
42 | - protected function get_subsequent_meta() |
|
43 | - { |
|
44 | - $meta_array = array(); |
|
42 | + protected function get_subsequent_meta() |
|
43 | + { |
|
44 | + $meta_array = array(); |
|
45 | 45 | |
46 | - $meta_array['title'] = sprintf(self::$SECONDARY_TITLE . ' | ' . self::$WEBSITE_TITLE, $this->page, $this->page_count); |
|
47 | - $meta_array['description'] = sprintf(self::$SECONDARY_DESCRIPTION, $this->page, $this->page_count); |
|
48 | - $meta_array['keywords'] = self::$KEYWORD_ARRAY; |
|
46 | + $meta_array['title'] = sprintf(self::$SECONDARY_TITLE . ' | ' . self::$WEBSITE_TITLE, $this->page, $this->page_count); |
|
47 | + $meta_array['description'] = sprintf(self::$SECONDARY_DESCRIPTION, $this->page, $this->page_count); |
|
48 | + $meta_array['keywords'] = self::$KEYWORD_ARRAY; |
|
49 | 49 | |
50 | - return $meta_array; |
|
51 | - } |
|
50 | + return $meta_array; |
|
51 | + } |
|
52 | 52 | |
53 | - protected function get_initial_introduction() |
|
54 | - { |
|
55 | - $introduction = array(); |
|
53 | + protected function get_initial_introduction() |
|
54 | + { |
|
55 | + $introduction = array(); |
|
56 | 56 | |
57 | - $introduction['title'] = self::$PRIMARY_INTRODUCTION_HEADER; |
|
58 | - $introduction['description'] = self::$PRIMARY_INTRODUCTION_DESCRIPTION; |
|
57 | + $introduction['title'] = self::$PRIMARY_INTRODUCTION_HEADER; |
|
58 | + $introduction['description'] = self::$PRIMARY_INTRODUCTION_DESCRIPTION; |
|
59 | 59 | |
60 | - $image = PhotoCollector::getRow(self::$PRIMARY_INTRODUCTION_IMAGE); |
|
61 | - $introduction['image'] = $this->get_image_element($image->category, $image->name, $image->description, 'medium'); |
|
60 | + $image = PhotoCollector::getRow(self::$PRIMARY_INTRODUCTION_IMAGE); |
|
61 | + $introduction['image'] = $this->get_image_element($image->category, $image->name, $image->description, 'medium'); |
|
62 | 62 | |
63 | - return $introduction; |
|
64 | - } |
|
65 | - |
|
66 | - protected function get_subsequent_introduction() |
|
67 | - { |
|
68 | - return array( |
|
69 | - 'title' => sprintf(self::$SECONDARY_INTRODUCTION_HEADER, $this->page, $this->page_count)); |
|
70 | - } |
|
71 | - |
|
72 | - protected function get_page_number_piece() |
|
73 | - { |
|
74 | - return URLDecode::getPiece(2); |
|
75 | - } |
|
76 | - |
|
77 | - protected function get_item_result($total, $offset) |
|
78 | - { |
|
79 | - return WaterfallCollector::getList($total, $offset); |
|
80 | - } |
|
81 | - |
|
82 | - protected function get_item_count_result() |
|
83 | - { |
|
84 | - return WaterfallCollector::getListCount(); |
|
85 | - } |
|
86 | - |
|
87 | - protected function get_list_description_pattern() |
|
88 | - { |
|
89 | - return self::$NAVIGATION_DESCRIPTION; |
|
90 | - } |
|
91 | - |
|
92 | - protected function get_list_link_root() |
|
93 | - { |
|
94 | - return self::$LINK_ROOT; |
|
95 | - } |
|
63 | + return $introduction; |
|
64 | + } |
|
65 | + |
|
66 | + protected function get_subsequent_introduction() |
|
67 | + { |
|
68 | + return array( |
|
69 | + 'title' => sprintf(self::$SECONDARY_INTRODUCTION_HEADER, $this->page, $this->page_count)); |
|
70 | + } |
|
71 | + |
|
72 | + protected function get_page_number_piece() |
|
73 | + { |
|
74 | + return URLDecode::getPiece(2); |
|
75 | + } |
|
76 | + |
|
77 | + protected function get_item_result($total, $offset) |
|
78 | + { |
|
79 | + return WaterfallCollector::getList($total, $offset); |
|
80 | + } |
|
81 | + |
|
82 | + protected function get_item_count_result() |
|
83 | + { |
|
84 | + return WaterfallCollector::getListCount(); |
|
85 | + } |
|
86 | + |
|
87 | + protected function get_list_description_pattern() |
|
88 | + { |
|
89 | + return self::$NAVIGATION_DESCRIPTION; |
|
90 | + } |
|
91 | + |
|
92 | + protected function get_list_link_root() |
|
93 | + { |
|
94 | + return self::$LINK_ROOT; |
|
95 | + } |
|
96 | 96 | |
97 | 97 | } |
@@ -5,8 +5,8 @@ discard block |
||
5 | 5 | 'waterfall/WaterfallCollector')); |
6 | 6 | Loader::load('controller', 'waterfalls/DefaultWaterfallListController'); |
7 | 7 | |
8 | -final class WaterfallListController extends DefaultWaterfallListController |
|
9 | -{ |
|
8 | +final class WaterfallListController extends DefaultWaterfallListController |
|
9 | +{ |
|
10 | 10 | |
11 | 11 | private static $PRIMARY_TITLE = 'Full Listing of Falls'; |
12 | 12 | private static $PRIMARY_DESCRIPTION = 'List of waterfalls found in the general Keweenaw Area, complete with photos, descriptions, directions, and maps.'; |
@@ -28,8 +28,8 @@ discard block |
||
28 | 28 | private static $NAVIGATION_DESCRIPTION = 'displaying %d ~ %d of %d total waterfalls'; |
29 | 29 | private static $LINK_ROOT = '/falls/'; |
30 | 30 | |
31 | - protected function get_initial_meta() |
|
32 | - { |
|
31 | + protected function get_initial_meta() |
|
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, $this->page_count); |
@@ -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 WaterfallCollector::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 WaterfallCollector::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 |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | { |
33 | 33 | $meta_array = array(); |
34 | 34 | |
35 | - $meta_array['title'] = self::$PRIMARY_TITLE . ' | ' . self::$WEBSITE_TITLE; |
|
35 | + $meta_array['title'] = self::$PRIMARY_TITLE.' | '.self::$WEBSITE_TITLE; |
|
36 | 36 | $meta_array['description'] = self::$PRIMARY_DESCRIPTION; |
37 | 37 | $meta_array['keywords'] = self::$KEYWORD_ARRAY; |
38 | 38 | |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | { |
44 | 44 | $meta_array = array(); |
45 | 45 | |
46 | - $meta_array['title'] = sprintf(self::$SECONDARY_TITLE . ' | ' . self::$WEBSITE_TITLE, $this->page); |
|
46 | + $meta_array['title'] = sprintf(self::$SECONDARY_TITLE.' | '.self::$WEBSITE_TITLE, $this->page); |
|
47 | 47 | $meta_array['description'] = sprintf(self::$SECONDARY_DESCRIPTION, $this->page, $this->page_count); |
48 | 48 | $meta_array['keywords'] = self::$KEYWORD_ARRAY; |
49 | 49 |
@@ -1,97 +1,97 @@ |
||
1 | 1 | <? |
2 | 2 | |
3 | 3 | Loader::load('collector', array( |
4 | - 'image/PhotoCollector', |
|
5 | - 'waterfall/LogCollector')); |
|
4 | + 'image/PhotoCollector', |
|
5 | + 'waterfall/LogCollector')); |
|
6 | 6 | Loader::load('controller', 'waterfalls/DefaultLogListController'); |
7 | 7 | |
8 | 8 | final class LogListController extends DefaultLogListController |
9 | 9 | { |
10 | 10 | |
11 | - private static $PRIMARY_TITLE = 'Journal from Waterfall Hikes'; |
|
12 | - private static $PRIMARY_DESCRIPTION = 'Stories written by Jacob Emerick about his epic waterfall adventures in the general Keweenaw, Ontonagon, and Marquette areas.'; |
|
13 | - private static $PRIMARY_INTRODUCTION_HEADER = 'Journal of Waterfall Adventuring'; |
|
14 | - private static $PRIMARY_INTRODUCTION_IMAGE = 707; |
|
15 | - private static $PRIMARY_INTRODUCTION_DESCRIPTION = 'Whether he is hiking alone through the woods, with Logan running ahead to chase down deer, or with a group of friends, every hike that Jacob sets out turns into an adventure. Hopping from slick rock to rock along a small creek in the city, splashing through deep water over an uncertain riverbed, or pushing thick branches out of the way in thick brush, every journey turns into a little story of discovery.'; |
|
16 | - |
|
17 | - private static $SECONDARY_TITLE = 'Journal Entries - Page %d'; |
|
18 | - private static $SECONDARY_DESCRIPTION = 'Page %d of %d of epic hiking stories written by Jacob Emerick, all about his adventures hunting waterfalls in the Upper Peninsula of Michigan'; |
|
19 | - private static $SECONDARY_INTRODUCTION_HEADER = 'Waterfall Adventure Journal, Page %d of %d'; |
|
20 | - |
|
21 | - private static $KEYWORD_ARRAY = array( |
|
22 | - 'journal', |
|
23 | - 'travel log', |
|
24 | - 'blog', |
|
25 | - 'waterfalls', |
|
26 | - 'hiking companions'); |
|
27 | - |
|
28 | - private static $NAVIGATION_DESCRIPTION = 'displaying %d ~ %d of %d total journal entries'; |
|
29 | - private static $LINK_ROOT = '/journal/'; |
|
30 | - |
|
31 | - protected function get_initial_meta() |
|
32 | - { |
|
33 | - $meta_array = array(); |
|
11 | + private static $PRIMARY_TITLE = 'Journal from Waterfall Hikes'; |
|
12 | + private static $PRIMARY_DESCRIPTION = 'Stories written by Jacob Emerick about his epic waterfall adventures in the general Keweenaw, Ontonagon, and Marquette areas.'; |
|
13 | + private static $PRIMARY_INTRODUCTION_HEADER = 'Journal of Waterfall Adventuring'; |
|
14 | + private static $PRIMARY_INTRODUCTION_IMAGE = 707; |
|
15 | + private static $PRIMARY_INTRODUCTION_DESCRIPTION = 'Whether he is hiking alone through the woods, with Logan running ahead to chase down deer, or with a group of friends, every hike that Jacob sets out turns into an adventure. Hopping from slick rock to rock along a small creek in the city, splashing through deep water over an uncertain riverbed, or pushing thick branches out of the way in thick brush, every journey turns into a little story of discovery.'; |
|
16 | + |
|
17 | + private static $SECONDARY_TITLE = 'Journal Entries - Page %d'; |
|
18 | + private static $SECONDARY_DESCRIPTION = 'Page %d of %d of epic hiking stories written by Jacob Emerick, all about his adventures hunting waterfalls in the Upper Peninsula of Michigan'; |
|
19 | + private static $SECONDARY_INTRODUCTION_HEADER = 'Waterfall Adventure Journal, Page %d of %d'; |
|
20 | + |
|
21 | + private static $KEYWORD_ARRAY = array( |
|
22 | + 'journal', |
|
23 | + 'travel log', |
|
24 | + 'blog', |
|
25 | + 'waterfalls', |
|
26 | + 'hiking companions'); |
|
27 | + |
|
28 | + private static $NAVIGATION_DESCRIPTION = 'displaying %d ~ %d of %d total journal entries'; |
|
29 | + private static $LINK_ROOT = '/journal/'; |
|
30 | + |
|
31 | + protected function get_initial_meta() |
|
32 | + { |
|
33 | + $meta_array = array(); |
|
34 | 34 | |
35 | - $meta_array['title'] = self::$PRIMARY_TITLE . ' | ' . self::$WEBSITE_TITLE; |
|
36 | - $meta_array['description'] = self::$PRIMARY_DESCRIPTION; |
|
37 | - $meta_array['keywords'] = self::$KEYWORD_ARRAY; |
|
35 | + $meta_array['title'] = self::$PRIMARY_TITLE . ' | ' . self::$WEBSITE_TITLE; |
|
36 | + $meta_array['description'] = self::$PRIMARY_DESCRIPTION; |
|
37 | + $meta_array['keywords'] = self::$KEYWORD_ARRAY; |
|
38 | 38 | |
39 | - return $meta_array; |
|
40 | - } |
|
39 | + return $meta_array; |
|
40 | + } |
|
41 | 41 | |
42 | - protected function get_subsequent_meta() |
|
43 | - { |
|
44 | - $meta_array = array(); |
|
42 | + protected function get_subsequent_meta() |
|
43 | + { |
|
44 | + $meta_array = array(); |
|
45 | 45 | |
46 | - $meta_array['title'] = sprintf(self::$SECONDARY_TITLE . ' | ' . self::$WEBSITE_TITLE, $this->page); |
|
47 | - $meta_array['description'] = sprintf(self::$SECONDARY_DESCRIPTION, $this->page, $this->page_count); |
|
48 | - $meta_array['keywords'] = self::$KEYWORD_ARRAY; |
|
46 | + $meta_array['title'] = sprintf(self::$SECONDARY_TITLE . ' | ' . self::$WEBSITE_TITLE, $this->page); |
|
47 | + $meta_array['description'] = sprintf(self::$SECONDARY_DESCRIPTION, $this->page, $this->page_count); |
|
48 | + $meta_array['keywords'] = self::$KEYWORD_ARRAY; |
|
49 | 49 | |
50 | - return $meta_array; |
|
51 | - } |
|
50 | + return $meta_array; |
|
51 | + } |
|
52 | 52 | |
53 | - protected function get_initial_introduction() |
|
54 | - { |
|
55 | - $introduction = array(); |
|
53 | + protected function get_initial_introduction() |
|
54 | + { |
|
55 | + $introduction = array(); |
|
56 | 56 | |
57 | - $introduction['title'] = self::$PRIMARY_INTRODUCTION_HEADER; |
|
58 | - $introduction['description'] = self::$PRIMARY_INTRODUCTION_DESCRIPTION; |
|
57 | + $introduction['title'] = self::$PRIMARY_INTRODUCTION_HEADER; |
|
58 | + $introduction['description'] = self::$PRIMARY_INTRODUCTION_DESCRIPTION; |
|
59 | 59 | |
60 | - $image = PhotoCollector::getRow(self::$PRIMARY_INTRODUCTION_IMAGE); |
|
61 | - $introduction['image'] = $this->get_image_element($image->category, $image->name, $image->description, 'medium'); |
|
60 | + $image = PhotoCollector::getRow(self::$PRIMARY_INTRODUCTION_IMAGE); |
|
61 | + $introduction['image'] = $this->get_image_element($image->category, $image->name, $image->description, 'medium'); |
|
62 | 62 | |
63 | - return $introduction; |
|
64 | - } |
|
65 | - |
|
66 | - protected function get_subsequent_introduction() |
|
67 | - { |
|
68 | - return array( |
|
69 | - 'title' => sprintf(self::$SECONDARY_INTRODUCTION_HEADER, $this->page, $this->page_count)); |
|
70 | - } |
|
71 | - |
|
72 | - protected function get_page_number_piece() |
|
73 | - { |
|
74 | - return URLDecode::getPiece(2); |
|
75 | - } |
|
76 | - |
|
77 | - protected function get_item_result($total, $offset) |
|
78 | - { |
|
79 | - return LogCollector::getList($total, $offset); |
|
80 | - } |
|
81 | - |
|
82 | - protected function get_item_count_result() |
|
83 | - { |
|
84 | - return LogCollector::getListCount(); |
|
85 | - } |
|
86 | - |
|
87 | - protected function get_list_description_pattern() |
|
88 | - { |
|
89 | - return self::$NAVIGATION_DESCRIPTION; |
|
90 | - } |
|
91 | - |
|
92 | - protected function get_list_link_root() |
|
93 | - { |
|
94 | - return self::$LINK_ROOT; |
|
95 | - } |
|
63 | + return $introduction; |
|
64 | + } |
|
65 | + |
|
66 | + protected function get_subsequent_introduction() |
|
67 | + { |
|
68 | + return array( |
|
69 | + 'title' => sprintf(self::$SECONDARY_INTRODUCTION_HEADER, $this->page, $this->page_count)); |
|
70 | + } |
|
71 | + |
|
72 | + protected function get_page_number_piece() |
|
73 | + { |
|
74 | + return URLDecode::getPiece(2); |
|
75 | + } |
|
76 | + |
|
77 | + protected function get_item_result($total, $offset) |
|
78 | + { |
|
79 | + return LogCollector::getList($total, $offset); |
|
80 | + } |
|
81 | + |
|
82 | + protected function get_item_count_result() |
|
83 | + { |
|
84 | + return LogCollector::getListCount(); |
|
85 | + } |
|
86 | + |
|
87 | + protected function get_list_description_pattern() |
|
88 | + { |
|
89 | + return self::$NAVIGATION_DESCRIPTION; |
|
90 | + } |
|
91 | + |
|
92 | + protected function get_list_link_root() |
|
93 | + { |
|
94 | + return self::$LINK_ROOT; |
|
95 | + } |
|
96 | 96 | |
97 | 97 | } |
98 | 98 | \ No newline at end of file |
@@ -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 |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | $path = URLDecode::getPiece(1); |
30 | 30 | $this->watercourse = WatercourseCollector::getByAlias($path); |
31 | 31 | |
32 | - if(!$this->watercourse) |
|
32 | + if (!$this->watercourse) |
|
33 | 33 | $this->eject(); |
34 | 34 | |
35 | 35 | parent::__construct(); |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | { |
40 | 40 | $meta_array = array(); |
41 | 41 | |
42 | - $meta_array['title'] = "{$this->watercourse->name} | " . self::$WEBSITE_TITLE; |
|
42 | + $meta_array['title'] = "{$this->watercourse->name} | ".self::$WEBSITE_TITLE; |
|
43 | 43 | $meta_array['description'] = $this->watercourse->description; |
44 | 44 | $meta_array['keywords'] = $this->get_keyword_array(); |
45 | 45 | |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | { |
51 | 51 | $meta_array = array(); |
52 | 52 | |
53 | - $meta_array['title'] = sprintf(self::$DEFAULT_TITLE . ' | ' . self::$WEBSITE_TITLE, $this->watercourse->name, $this->page, $this->page_count); |
|
53 | + $meta_array['title'] = sprintf(self::$DEFAULT_TITLE.' | '.self::$WEBSITE_TITLE, $this->watercourse->name, $this->page, $this->page_count); |
|
54 | 54 | $meta_array['description'] = sprintf(self::$DEFAULT_DESCRIPTION, $this->page, $this->page_count, $this->watercourse->name); |
55 | 55 | $meta_array['keywords'] = $this->get_keyword_array(); |
56 | 56 |
@@ -6,109 +6,109 @@ |
||
6 | 6 | final class WatercourseListController extends DefaultWaterfallListController |
7 | 7 | { |
8 | 8 | |
9 | - private static $DEFAULT_TITLE = 'Hiking with %s, Page %d of %d'; |
|
10 | - private static $DEFAULT_DESCRIPTION = 'Page %d of %d of legendary hiking stories with %s written by Jacob Emerick, all about his adventures hunting waterfalls in the Upper Peninsula of Michigan'; |
|
11 | - private static $DEFAULT_HEADER = 'Page %d of Legendary Hiking Stories with %s'; |
|
9 | + private static $DEFAULT_TITLE = 'Hiking with %s, Page %d of %d'; |
|
10 | + private static $DEFAULT_DESCRIPTION = 'Page %d of %d of legendary hiking stories with %s written by Jacob Emerick, all about his adventures hunting waterfalls in the Upper Peninsula of Michigan'; |
|
11 | + private static $DEFAULT_HEADER = 'Page %d of Legendary Hiking Stories with %s'; |
|
12 | 12 | |
13 | - private static $KEYWORD_ARRAY = array( |
|
14 | - 'hiking companions', |
|
15 | - 'journal', |
|
16 | - 'stories', |
|
17 | - 'blog', |
|
18 | - 'waterfalls'); |
|
13 | + private static $KEYWORD_ARRAY = array( |
|
14 | + 'hiking companions', |
|
15 | + 'journal', |
|
16 | + 'stories', |
|
17 | + 'blog', |
|
18 | + 'waterfalls'); |
|
19 | 19 | |
20 | - private static $NAVIGATION_DESCRIPTION = 'displaying %d ~ %d of %d waterfalls in %COUNTY%'; |
|
21 | - private static $LINK_ROOT = '/%s/'; |
|
20 | + private static $NAVIGATION_DESCRIPTION = 'displaying %d ~ %d of %d waterfalls in %COUNTY%'; |
|
21 | + private static $LINK_ROOT = '/%s/'; |
|
22 | 22 | |
23 | - protected static $ITEM_COUNT_PER_PAGE = 12; |
|
23 | + protected static $ITEM_COUNT_PER_PAGE = 12; |
|
24 | 24 | |
25 | - private $watercourse; |
|
25 | + private $watercourse; |
|
26 | 26 | |
27 | - public function __construct() |
|
28 | - { |
|
29 | - $path = URLDecode::getPiece(1); |
|
30 | - $this->watercourse = WatercourseCollector::getByAlias($path); |
|
27 | + public function __construct() |
|
28 | + { |
|
29 | + $path = URLDecode::getPiece(1); |
|
30 | + $this->watercourse = WatercourseCollector::getByAlias($path); |
|
31 | 31 | |
32 | - if(!$this->watercourse) |
|
33 | - $this->eject(); |
|
32 | + if(!$this->watercourse) |
|
33 | + $this->eject(); |
|
34 | 34 | |
35 | - parent::__construct(); |
|
36 | - } |
|
35 | + parent::__construct(); |
|
36 | + } |
|
37 | 37 | |
38 | - protected function get_initial_meta() |
|
39 | - { |
|
40 | - $meta_array = array(); |
|
38 | + protected function get_initial_meta() |
|
39 | + { |
|
40 | + $meta_array = array(); |
|
41 | 41 | |
42 | - $meta_array['title'] = "{$this->watercourse->name} | " . self::$WEBSITE_TITLE; |
|
43 | - $meta_array['description'] = $this->watercourse->description; |
|
44 | - $meta_array['keywords'] = $this->get_keyword_array(); |
|
42 | + $meta_array['title'] = "{$this->watercourse->name} | " . self::$WEBSITE_TITLE; |
|
43 | + $meta_array['description'] = $this->watercourse->description; |
|
44 | + $meta_array['keywords'] = $this->get_keyword_array(); |
|
45 | 45 | |
46 | - return $meta_array; |
|
47 | - } |
|
46 | + return $meta_array; |
|
47 | + } |
|
48 | 48 | |
49 | - protected function get_subsequent_meta() |
|
50 | - { |
|
51 | - $meta_array = array(); |
|
49 | + protected function get_subsequent_meta() |
|
50 | + { |
|
51 | + $meta_array = array(); |
|
52 | 52 | |
53 | - $meta_array['title'] = sprintf(self::$DEFAULT_TITLE . ' | ' . self::$WEBSITE_TITLE, $this->watercourse->name, $this->page, $this->page_count); |
|
54 | - $meta_array['description'] = sprintf(self::$DEFAULT_DESCRIPTION, $this->page, $this->page_count, $this->watercourse->name); |
|
55 | - $meta_array['keywords'] = $this->get_keyword_array(); |
|
53 | + $meta_array['title'] = sprintf(self::$DEFAULT_TITLE . ' | ' . self::$WEBSITE_TITLE, $this->watercourse->name, $this->page, $this->page_count); |
|
54 | + $meta_array['description'] = sprintf(self::$DEFAULT_DESCRIPTION, $this->page, $this->page_count, $this->watercourse->name); |
|
55 | + $meta_array['keywords'] = $this->get_keyword_array(); |
|
56 | 56 | |
57 | - return $meta_array; |
|
58 | - } |
|
59 | - |
|
60 | - private function get_keyword_array() |
|
61 | - { |
|
62 | - $keyword_array = self::$KEYWORD_ARRAY; |
|
63 | - array_unshift($keyword_array, strtolower($this->watercourse->name)); |
|
64 | - return $keyword_array; |
|
65 | - } |
|
66 | - |
|
67 | - protected function get_initial_introduction() |
|
68 | - { |
|
69 | - $introduction = array(); |
|
57 | + return $meta_array; |
|
58 | + } |
|
59 | + |
|
60 | + private function get_keyword_array() |
|
61 | + { |
|
62 | + $keyword_array = self::$KEYWORD_ARRAY; |
|
63 | + array_unshift($keyword_array, strtolower($this->watercourse->name)); |
|
64 | + return $keyword_array; |
|
65 | + } |
|
66 | + |
|
67 | + protected function get_initial_introduction() |
|
68 | + { |
|
69 | + $introduction = array(); |
|
70 | 70 | |
71 | - $introduction['title'] = $this->watercourse->header; |
|
72 | - $introduction['description'] = Content::instance('FixInternalLink', $this->watercourse->introduction)->activate(); |
|
73 | - $introduction['image'] = $this->get_image_element($this->watercourse->photo_category, $this->watercourse->photo, $this->watercourse->photo_description, 'medium'); |
|
71 | + $introduction['title'] = $this->watercourse->header; |
|
72 | + $introduction['description'] = Content::instance('FixInternalLink', $this->watercourse->introduction)->activate(); |
|
73 | + $introduction['image'] = $this->get_image_element($this->watercourse->photo_category, $this->watercourse->photo, $this->watercourse->photo_description, 'medium'); |
|
74 | 74 | |
75 | - return $introduction; |
|
76 | - } |
|
77 | - |
|
78 | - protected function get_subsequent_introduction() |
|
79 | - { |
|
80 | - return array( |
|
81 | - 'title' => sprintf(self::$DEFAULT_HEADER, $this->page, $this->watercourse->name)); |
|
82 | - } |
|
83 | - |
|
84 | - protected function get_item_count_per_page() |
|
85 | - { |
|
86 | - return self::$ITEM_COUNT_PER_PAGE; |
|
87 | - } |
|
88 | - |
|
89 | - protected function get_page_number_piece() |
|
90 | - { |
|
91 | - return URLDecode::getPiece(2); |
|
92 | - } |
|
93 | - |
|
94 | - protected function get_item_result($total, $offset) |
|
95 | - { |
|
96 | - return WatercourseCollector::getLogListForWatercourse($this->watercourse->id, $total, $offset); |
|
97 | - } |
|
98 | - |
|
99 | - protected function get_item_count_result() |
|
100 | - { |
|
101 | - return WatercourseCollector::getLogCountForWatercourse($this->watercourse->id); |
|
102 | - } |
|
103 | - |
|
104 | - protected function get_list_description_pattern() |
|
105 | - { |
|
106 | - return str_replace('%COUNTY%', $this->watercourse->name, self::$NAVIGATION_DESCRIPTION); |
|
107 | - } |
|
108 | - |
|
109 | - protected function get_list_link_root() |
|
110 | - { |
|
111 | - return sprintf(self::$LINK_ROOT, $this->watercourse->alias); |
|
112 | - } |
|
75 | + return $introduction; |
|
76 | + } |
|
77 | + |
|
78 | + protected function get_subsequent_introduction() |
|
79 | + { |
|
80 | + return array( |
|
81 | + 'title' => sprintf(self::$DEFAULT_HEADER, $this->page, $this->watercourse->name)); |
|
82 | + } |
|
83 | + |
|
84 | + protected function get_item_count_per_page() |
|
85 | + { |
|
86 | + return self::$ITEM_COUNT_PER_PAGE; |
|
87 | + } |
|
88 | + |
|
89 | + protected function get_page_number_piece() |
|
90 | + { |
|
91 | + return URLDecode::getPiece(2); |
|
92 | + } |
|
93 | + |
|
94 | + protected function get_item_result($total, $offset) |
|
95 | + { |
|
96 | + return WatercourseCollector::getLogListForWatercourse($this->watercourse->id, $total, $offset); |
|
97 | + } |
|
98 | + |
|
99 | + protected function get_item_count_result() |
|
100 | + { |
|
101 | + return WatercourseCollector::getLogCountForWatercourse($this->watercourse->id); |
|
102 | + } |
|
103 | + |
|
104 | + protected function get_list_description_pattern() |
|
105 | + { |
|
106 | + return str_replace('%COUNTY%', $this->watercourse->name, self::$NAVIGATION_DESCRIPTION); |
|
107 | + } |
|
108 | + |
|
109 | + protected function get_list_link_root() |
|
110 | + { |
|
111 | + return sprintf(self::$LINK_ROOT, $this->watercourse->alias); |
|
112 | + } |
|
113 | 113 | |
114 | 114 | } |
115 | 115 | \ No newline at end of file |
@@ -3,8 +3,8 @@ discard block |
||
3 | 3 | Loader::load('collector', 'waterfall/WaterfallCollector'); |
4 | 4 | Loader::load('controller', 'waterfalls/DefaultWaterfallListController'); |
5 | 5 | |
6 | -final class WatercourseListController extends DefaultWaterfallListController |
|
7 | -{ |
|
6 | +final class WatercourseListController extends DefaultWaterfallListController |
|
7 | +{ |
|
8 | 8 | |
9 | 9 | private static $DEFAULT_TITLE = 'Hiking with %s, Page %d of %d'; |
10 | 10 | private static $DEFAULT_DESCRIPTION = 'Page %d of %d of legendary hiking stories with %s written by Jacob Emerick, all about his adventures hunting waterfalls in the Upper Peninsula of Michigan'; |
@@ -24,19 +24,20 @@ discard block |
||
24 | 24 | |
25 | 25 | private $watercourse; |
26 | 26 | |
27 | - public function __construct() |
|
28 | - { |
|
27 | + public function __construct() |
|
28 | + { |
|
29 | 29 | $path = URLDecode::getPiece(1); |
30 | 30 | $this->watercourse = WatercourseCollector::getByAlias($path); |
31 | 31 | |
32 | - if(!$this->watercourse) |
|
33 | - $this->eject(); |
|
32 | + if(!$this->watercourse) { |
|
33 | + $this->eject(); |
|
34 | + } |
|
34 | 35 | |
35 | 36 | parent::__construct(); |
36 | 37 | } |
37 | 38 | |
38 | - protected function get_initial_meta() |
|
39 | - { |
|
39 | + protected function get_initial_meta() |
|
40 | + { |
|
40 | 41 | $meta_array = array(); |
41 | 42 | |
42 | 43 | $meta_array['title'] = "{$this->watercourse->name} | " . self::$WEBSITE_TITLE; |
@@ -46,8 +47,8 @@ discard block |
||
46 | 47 | return $meta_array; |
47 | 48 | } |
48 | 49 | |
49 | - protected function get_subsequent_meta() |
|
50 | - { |
|
50 | + protected function get_subsequent_meta() |
|
51 | + { |
|
51 | 52 | $meta_array = array(); |
52 | 53 | |
53 | 54 | $meta_array['title'] = sprintf(self::$DEFAULT_TITLE . ' | ' . self::$WEBSITE_TITLE, $this->watercourse->name, $this->page, $this->page_count); |
@@ -57,15 +58,15 @@ discard block |
||
57 | 58 | return $meta_array; |
58 | 59 | } |
59 | 60 | |
60 | - private function get_keyword_array() |
|
61 | - { |
|
61 | + private function get_keyword_array() |
|
62 | + { |
|
62 | 63 | $keyword_array = self::$KEYWORD_ARRAY; |
63 | 64 | array_unshift($keyword_array, strtolower($this->watercourse->name)); |
64 | 65 | return $keyword_array; |
65 | 66 | } |
66 | 67 | |
67 | - protected function get_initial_introduction() |
|
68 | - { |
|
68 | + protected function get_initial_introduction() |
|
69 | + { |
|
69 | 70 | $introduction = array(); |
70 | 71 | |
71 | 72 | $introduction['title'] = $this->watercourse->header; |
@@ -75,39 +76,39 @@ discard block |
||
75 | 76 | return $introduction; |
76 | 77 | } |
77 | 78 | |
78 | - protected function get_subsequent_introduction() |
|
79 | - { |
|
79 | + protected function get_subsequent_introduction() |
|
80 | + { |
|
80 | 81 | return array( |
81 | 82 | 'title' => sprintf(self::$DEFAULT_HEADER, $this->page, $this->watercourse->name)); |
82 | 83 | } |
83 | 84 | |
84 | - protected function get_item_count_per_page() |
|
85 | - { |
|
85 | + protected function get_item_count_per_page() |
|
86 | + { |
|
86 | 87 | return self::$ITEM_COUNT_PER_PAGE; |
87 | 88 | } |
88 | 89 | |
89 | - protected function get_page_number_piece() |
|
90 | - { |
|
90 | + protected function get_page_number_piece() |
|
91 | + { |
|
91 | 92 | return URLDecode::getPiece(2); |
92 | 93 | } |
93 | 94 | |
94 | - protected function get_item_result($total, $offset) |
|
95 | - { |
|
95 | + protected function get_item_result($total, $offset) |
|
96 | + { |
|
96 | 97 | return WatercourseCollector::getLogListForWatercourse($this->watercourse->id, $total, $offset); |
97 | 98 | } |
98 | 99 | |
99 | - protected function get_item_count_result() |
|
100 | - { |
|
100 | + protected function get_item_count_result() |
|
101 | + { |
|
101 | 102 | return WatercourseCollector::getLogCountForWatercourse($this->watercourse->id); |
102 | 103 | } |
103 | 104 | |
104 | - protected function get_list_description_pattern() |
|
105 | - { |
|
105 | + protected function get_list_description_pattern() |
|
106 | + { |
|
106 | 107 | return str_replace('%COUNTY%', $this->watercourse->name, self::$NAVIGATION_DESCRIPTION); |
107 | 108 | } |
108 | 109 | |
109 | - protected function get_list_link_root() |
|
110 | - { |
|
110 | + protected function get_list_link_root() |
|
111 | + { |
|
111 | 112 | return sprintf(self::$LINK_ROOT, $this->watercourse->alias); |
112 | 113 | } |
113 | 114 |
@@ -35,16 +35,16 @@ discard block |
||
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 |
||
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 |
||
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(); |
@@ -5,73 +5,73 @@ |
||
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 | } |
@@ -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'), |
@@ -48,11 +48,11 @@ |
||
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); |
@@ -8,58 +8,58 @@ |
||
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 | } |
@@ -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); |
@@ -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,24 +111,24 @@ 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 | - 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']); |
@@ -5,136 +5,136 @@ |
||
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 | } |
@@ -2,8 +2,8 @@ discard block |
||
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,8 @@ discard block |
||
21 | 21 | |
22 | 22 | private $tag; |
23 | 23 | |
24 | - public function __construct() |
|
25 | - { |
|
24 | + public function __construct() |
|
25 | + { |
|
26 | 26 | $tag = URLDecode::getPiece(2); |
27 | 27 | $tag = str_replace('-', ' ', $tag); |
28 | 28 | |
@@ -30,24 +30,24 @@ 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 | |
38 | 39 | parent::__construct(); |
39 | 40 | } |
40 | 41 | |
41 | - protected function set_head_data() |
|
42 | - { |
|
42 | + protected function set_head_data() |
|
43 | + { |
|
43 | 44 | parent::set_head_data(); |
44 | 45 | |
45 | 46 | if($this->page == 1) |
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']))); |
@@ -58,8 +58,8 @@ discard block |
||
58 | 58 | $this->set_keywords($keyword_array); |
59 | 59 | } |
60 | 60 | |
61 | - protected function get_introduction() |
|
62 | - { |
|
61 | + protected function get_introduction() |
|
62 | + { |
|
63 | 63 | $tag = ucwords($this->tag['tag']); |
64 | 64 | |
65 | 65 | if($this->page == 1) |
@@ -86,48 +86,52 @@ discard block |
||
86 | 86 | 'title' => "{$tag} posts, page {$this->page} of {$this->total_pages}."); |
87 | 87 | } |
88 | 88 | |
89 | - protected function get_page_number() |
|
90 | - { |
|
89 | + protected function get_page_number() |
|
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 | |
97 | - protected function get_list_results() |
|
98 | - { |
|
98 | + protected function get_list_results() |
|
99 | + { |
|
99 | 100 | global $container; |
100 | 101 | $repository = new Jacobemerick\Web\Domain\Blog\Post\MysqlPostRepository($container['db_connection_locator']); |
101 | 102 | return $repository->getActivePostsByTag($this->tag['id'], self::$POSTS_PER_PAGE, $this->offset); |
102 | 103 | } |
103 | 104 | |
104 | - protected function get_list_description() |
|
105 | - { |
|
105 | + protected function get_list_description() |
|
106 | + { |
|
106 | 107 | $start = $this->offset + 1; |
107 | 108 | $end = min($this->offset + self::$POSTS_PER_PAGE, $this->get_total_post_count()); |
108 | 109 | |
109 | 110 | return sprintf(self::$LIST_DESCRIPTION, $start, $end, $this->get_total_post_count(), $this->tag['tag']); |
110 | 111 | } |
111 | 112 | |
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(); |
|
113 | + protected function get_list_next_link() |
|
114 | + { |
|
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 | - protected function get_list_prev_link() |
|
122 | - { |
|
123 | - if(($this->page * self::$POSTS_PER_PAGE) >= $this->get_total_post_count()) |
|
124 | - return; |
|
124 | + protected function get_list_prev_link() |
|
125 | + { |
|
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 | |
128 | 132 | private $total_post_count; |
129 | - protected function get_total_post_count() |
|
130 | - { |
|
133 | + protected function get_total_post_count() |
|
134 | + { |
|
131 | 135 | if(!isset($this->total_post_count)) { |
132 | 136 | global $container; |
133 | 137 | $repository = new Jacobemerick\Web\Domain\Blog\Post\MysqlPostRepository($container['db_connection_locator']); |
@@ -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,24 +156,24 @@ 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 | - 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); |
@@ -5,180 +5,180 @@ |
||
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 | } |
@@ -2,8 +2,8 @@ discard block |
||
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,8 @@ discard block |
||
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() |
|
57 | + { |
|
58 | 58 | $url = URLDecode::getPiece(1); |
59 | 59 | $this->category = (object) array( |
60 | 60 | 'display' => ucwords(str_replace('-', ' ', $url)), |
@@ -63,8 +63,8 @@ discard block |
||
63 | 63 | parent::__construct(); |
64 | 64 | } |
65 | 65 | |
66 | - protected function set_head_data() |
|
67 | - { |
|
66 | + protected function set_head_data() |
|
67 | + { |
|
68 | 68 | parent::set_head_data(); |
69 | 69 | |
70 | 70 | switch($this->category->display) |
@@ -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)); |
@@ -111,8 +108,8 @@ discard block |
||
111 | 108 | } |
112 | 109 | } |
113 | 110 | |
114 | - protected function get_introduction() |
|
115 | - { |
|
111 | + protected function get_introduction() |
|
112 | + { |
|
116 | 113 | if($this->page == 1) |
117 | 114 | { |
118 | 115 | global $container; |
@@ -131,48 +128,52 @@ discard block |
||
131 | 128 | 'title' => "Posts about {$this->category->display}, page {$this->page} of {$this->total_pages}."); |
132 | 129 | } |
133 | 130 | |
134 | - protected function get_page_number() |
|
135 | - { |
|
131 | + protected function get_page_number() |
|
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 | |
142 | - protected function get_list_results() |
|
143 | - { |
|
140 | + protected function get_list_results() |
|
141 | + { |
|
144 | 142 | global $container; |
145 | 143 | $repository = new Jacobemerick\Web\Domain\Blog\Post\MysqlPostRepository($container['db_connection_locator']); |
146 | 144 | return $repository->getActivePostsByCategory($this->category->link, self::$POSTS_PER_PAGE, $this->offset); |
147 | 145 | } |
148 | 146 | |
149 | - protected function get_list_description() |
|
150 | - { |
|
147 | + protected function get_list_description() |
|
148 | + { |
|
151 | 149 | $start = $this->offset + 1; |
152 | 150 | $end = min($this->offset + self::$POSTS_PER_PAGE, $this->get_total_post_count()); |
153 | 151 | |
154 | 152 | return sprintf(self::$LIST_DESCRIPTION, $start, $end, $this->get_total_post_count(), $this->category->display); |
155 | 153 | } |
156 | 154 | |
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(); |
|
155 | + protected function get_list_next_link() |
|
156 | + { |
|
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 | - protected function get_list_prev_link() |
|
167 | - { |
|
168 | - if(($this->page * self::$POSTS_PER_PAGE) >= $this->get_total_post_count()) |
|
169 | - return; |
|
166 | + protected function get_list_prev_link() |
|
167 | + { |
|
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 | |
173 | 174 | private $total_post_count; |
174 | - protected function get_total_post_count() |
|
175 | - { |
|
175 | + protected function get_total_post_count() |
|
176 | + { |
|
176 | 177 | if(!isset($this->total_post_count)) { |
177 | 178 | global $container; |
178 | 179 | $repository = new Jacobemerick\Web\Domain\Blog\Post\MysqlPostRepository($container['db_connection_locator']); |
@@ -27,13 +27,13 @@ discard block |
||
27 | 27 | $repository = new Jacobemerick\Web\Domain\Blog\Post\MysqlPostRepository($container['db_connection_locator']); |
28 | 28 | $this->post = $repository->findPostByPath(URLDecode::getPiece(2)); |
29 | 29 | |
30 | - if($this->post == null) |
|
30 | + if ($this->post == null) |
|
31 | 31 | $this->eject(); |
32 | 32 | |
33 | 33 | $this->handle_comment_submit( |
34 | 34 | self::$BLOG_SITE_ID, |
35 | 35 | $this->post['path'], |
36 | - Loader::getRootUrl('blog') . $this->post['category'] . '/' . $this->post['path'] . '/', |
|
36 | + Loader::getRootUrl('blog').$this->post['category'].'/'.$this->post['path'].'/', |
|
37 | 37 | $this->post['title']); |
38 | 38 | |
39 | 39 | global $container; |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | $log_id = self::$DEPRECATED_BLOGS[$this->post['id']]; |
59 | 59 | $log = LogCollector::getById($log_id); |
60 | 60 | if (!empty($log)) { |
61 | - $log_url = Loader::getRootUrl('waterfalls') . "journal/{$log->alias}/"; |
|
61 | + $log_url = Loader::getRootUrl('waterfalls')."journal/{$log->alias}/"; |
|
62 | 62 | $this->set_canonical($log_url); |
63 | 63 | } |
64 | 64 | } |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | $keyword_array = array(); |
96 | 96 | $keywords = $this->tags; |
97 | 97 | |
98 | - foreach($keywords as $keyword) |
|
98 | + foreach ($keywords as $keyword) |
|
99 | 99 | { |
100 | 100 | $keyword_array[] = $keyword['tag']; |
101 | 101 | } |
@@ -109,16 +109,16 @@ discard block |
||
109 | 109 | private function get_series_posts() |
110 | 110 | { |
111 | 111 | $series_posts = $this->fetch_series_posts(); |
112 | - if(count($series_posts) < 1) |
|
112 | + if (count($series_posts) < 1) |
|
113 | 113 | return array(); |
114 | 114 | |
115 | 115 | $previous_post = new stdclass(); |
116 | 116 | $next_post = new stdclass(); |
117 | 117 | |
118 | 118 | $found_current_post = false; |
119 | - foreach($series_posts as $post_row) |
|
119 | + foreach ($series_posts as $post_row) |
|
120 | 120 | { |
121 | - if($post_row['post'] == $this->post['id']) |
|
121 | + if ($post_row['post'] == $this->post['id']) |
|
122 | 122 | { |
123 | 123 | $found_current_post = true; |
124 | 124 | continue; |
@@ -146,9 +146,9 @@ discard block |
||
146 | 146 | $post->title = $post_row['title']; |
147 | 147 | } |
148 | 148 | |
149 | - $post->url = Loader::getRootUrl('blog') . "{$post_row['category']}/{$post_row['path']}/"; |
|
149 | + $post->url = Loader::getRootUrl('blog')."{$post_row['category']}/{$post_row['path']}/"; |
|
150 | 150 | |
151 | - if(!$found_current_post) |
|
151 | + if (!$found_current_post) |
|
152 | 152 | $previous_post = $post; |
153 | 153 | else |
154 | 154 | { |
@@ -167,7 +167,7 @@ discard block |
||
167 | 167 | private $series_posts; |
168 | 168 | private function fetch_series_posts() |
169 | 169 | { |
170 | - if(!isset($this->series_posts)) { |
|
170 | + if (!isset($this->series_posts)) { |
|
171 | 171 | global $container; |
172 | 172 | $repository = new Jacobemerick\Web\Domain\Blog\Series\MysqlSeriesRepository($container['db_connection_locator']); |
173 | 173 | $this->series_posts = $repository->getSeriesForPost($this->post['id']); |
@@ -178,14 +178,14 @@ discard block |
||
178 | 178 | private function get_related_posts() |
179 | 179 | { |
180 | 180 | $tag_array = array(); |
181 | - foreach($this->tags as $tag) |
|
181 | + foreach ($this->tags as $tag) |
|
182 | 182 | { |
183 | 183 | $tag_array[] = $tag['id']; |
184 | 184 | } |
185 | 185 | |
186 | 186 | $series_posts = $this->fetch_series_posts(); |
187 | 187 | $exclude_post_array = array(); |
188 | - foreach($series_posts as $series_post) |
|
188 | + foreach ($series_posts as $series_post) |
|
189 | 189 | { |
190 | 190 | $exclude_post_array[] = $series_post['post']; |
191 | 191 | } |
@@ -196,11 +196,11 @@ discard block |
||
196 | 196 | |
197 | 197 | $post_array = array(); |
198 | 198 | |
199 | - foreach($post_result as $post_row) |
|
199 | + foreach ($post_result as $post_row) |
|
200 | 200 | { |
201 | 201 | $post = new stdclass(); |
202 | 202 | $post->title = $post_row['title']; |
203 | - $post->url = Loader::getRootUrl('blog') . "{$post_row['category']}/{$post_row['path']}/"; |
|
203 | + $post->url = Loader::getRootUrl('blog')."{$post_row['category']}/{$post_row['path']}/"; |
|
204 | 204 | $post->category = ucwords(str_replace('-', ' ', $post_row['category'])); |
205 | 205 | $post->thumb = Content::instance('FetchFirstPhoto', $post_row['body'])->activate(); |
206 | 206 | $post->body = Content::instance('SmartTrim', $post_row['body'])->activate(($post->thumb !== '') ? self::$POST_LENGTH_SHORT : self::$POST_LENGTH_LONG); |
@@ -3,8 +3,8 @@ discard block |
||
3 | 3 | Loader::load('collector', 'waterfall/LogCollector'); |
4 | 4 | Loader::load('controller', 'blog/DefaultPageController'); |
5 | 5 | |
6 | -final class PostController extends DefaultPageController |
|
7 | -{ |
|
6 | +final class PostController extends DefaultPageController |
|
7 | +{ |
|
8 | 8 | |
9 | 9 | private static $PAGE_DESCRIPTION_LIMIT = 250; |
10 | 10 | |
@@ -19,16 +19,17 @@ discard block |
||
19 | 19 | private $tags; |
20 | 20 | private $comment_errors = array(); |
21 | 21 | |
22 | - public function __construct() |
|
23 | - { |
|
22 | + public function __construct() |
|
23 | + { |
|
24 | 24 | parent::__construct(); |
25 | 25 | |
26 | 26 | global $container; |
27 | 27 | $repository = new Jacobemerick\Web\Domain\Blog\Post\MysqlPostRepository($container['db_connection_locator']); |
28 | 28 | $this->post = $repository->findPostByPath(URLDecode::getPiece(2)); |
29 | 29 | |
30 | - if($this->post == null) |
|
31 | - $this->eject(); |
|
30 | + if($this->post == null) { |
|
31 | + $this->eject(); |
|
32 | + } |
|
32 | 33 | |
33 | 34 | $this->handle_comment_submit( |
34 | 35 | self::$BLOG_SITE_ID, |
@@ -41,8 +42,8 @@ discard block |
||
41 | 42 | $this->tags = $repository->getTagsForPost($this->post['id']); |
42 | 43 | } |
43 | 44 | |
44 | - protected function set_head_data() |
|
45 | - { |
|
45 | + protected function set_head_data() |
|
46 | + { |
|
46 | 47 | parent::set_head_data(); |
47 | 48 | |
48 | 49 | $this->set_title(sprintf(self::$TITLE, $this->post['title'])); |
@@ -64,10 +65,12 @@ discard block |
||
64 | 65 | } |
65 | 66 | } |
66 | 67 | |
67 | - protected function get_introduction() {} |
|
68 | + protected function get_introduction() |
|
69 | + { |
|
70 | +} |
|
68 | 71 | |
69 | - protected function set_body_data() |
|
70 | - { |
|
72 | + protected function set_body_data() |
|
73 | + { |
|
71 | 74 | parent::set_body_data(); |
72 | 75 | |
73 | 76 | $this->set_body('title', $this->post['title']); |
@@ -85,8 +88,8 @@ discard block |
||
85 | 88 | )); |
86 | 89 | } |
87 | 90 | |
88 | - protected function get_post_description() |
|
89 | - { |
|
91 | + protected function get_post_description() |
|
92 | + { |
|
90 | 93 | $description = $this->post['body']; |
91 | 94 | $description = strip_tags($description); |
92 | 95 | $description = Content::instance('SmartTrim', $description)->activate(self::$PAGE_DESCRIPTION_LIMIT); |
@@ -94,8 +97,8 @@ discard block |
||
94 | 97 | return $description; |
95 | 98 | } |
96 | 99 | |
97 | - protected function get_post_keywords() |
|
98 | - { |
|
100 | + protected function get_post_keywords() |
|
101 | + { |
|
99 | 102 | $keyword_array = array(); |
100 | 103 | $keywords = $this->tags; |
101 | 104 | |
@@ -110,11 +113,12 @@ discard block |
||
110 | 113 | return $keyword_array; |
111 | 114 | } |
112 | 115 | |
113 | - private function get_series_posts() |
|
114 | - { |
|
116 | + private function get_series_posts() |
|
117 | + { |
|
115 | 118 | $series_posts = $this->fetch_series_posts(); |
116 | - if(count($series_posts) < 1) |
|
117 | - return array(); |
|
119 | + if(count($series_posts) < 1) { |
|
120 | + return array(); |
|
121 | + } |
|
118 | 122 | |
119 | 123 | $previous_post = new stdclass(); |
120 | 124 | $next_post = new stdclass(); |
@@ -153,9 +157,9 @@ discard block |
||
153 | 157 | |
154 | 158 | $post->url = Loader::getRootUrl('blog') . "{$post_row['category']}/{$post_row['path']}/"; |
155 | 159 | |
156 | - if(!$found_current_post) |
|
157 | - $previous_post = $post; |
|
158 | - else |
|
160 | + if(!$found_current_post) { |
|
161 | + $previous_post = $post; |
|
162 | + } else |
|
159 | 163 | { |
160 | 164 | $next_post = $post; |
161 | 165 | break; |
@@ -170,8 +174,8 @@ discard block |
||
170 | 174 | } |
171 | 175 | |
172 | 176 | private $series_posts; |
173 | - private function fetch_series_posts() |
|
174 | - { |
|
177 | + private function fetch_series_posts() |
|
178 | + { |
|
175 | 179 | if(!isset($this->series_posts)) { |
176 | 180 | global $container; |
177 | 181 | $repository = new Jacobemerick\Web\Domain\Blog\Series\MysqlSeriesRepository($container['db_connection_locator']); |
@@ -180,8 +184,8 @@ discard block |
||
180 | 184 | return $this->series_posts; |
181 | 185 | } |
182 | 186 | |
183 | - private function get_related_posts() |
|
184 | - { |
|
187 | + private function get_related_posts() |
|
188 | + { |
|
185 | 189 | $tag_array = array(); |
186 | 190 | foreach($this->tags as $tag) |
187 | 191 | { |
@@ -6,131 +6,131 @@ discard block |
||
6 | 6 | final class PostController extends DefaultPageController |
7 | 7 | { |
8 | 8 | |
9 | - private static $PAGE_DESCRIPTION_LIMIT = 250; |
|
9 | + private static $PAGE_DESCRIPTION_LIMIT = 250; |
|
10 | 10 | |
11 | - private static $TITLE = "%s | Jacob Emerick's Blog"; |
|
12 | - private static $AUTHOR = 'Jacob Emerick'; |
|
13 | - private static $AUTHOR_URL = 'https://home.jacobemerick.com/'; |
|
11 | + private static $TITLE = "%s | Jacob Emerick's Blog"; |
|
12 | + private static $AUTHOR = 'Jacob Emerick'; |
|
13 | + private static $AUTHOR_URL = 'https://home.jacobemerick.com/'; |
|
14 | 14 | |
15 | - private static $POST_LENGTH_SHORT = 100; |
|
16 | - private static $POST_LENGTH_LONG = 140; |
|
15 | + private static $POST_LENGTH_SHORT = 100; |
|
16 | + private static $POST_LENGTH_LONG = 140; |
|
17 | 17 | |
18 | - private $post; |
|
19 | - private $tags; |
|
20 | - private $comment_errors = array(); |
|
18 | + private $post; |
|
19 | + private $tags; |
|
20 | + private $comment_errors = array(); |
|
21 | 21 | |
22 | - public function __construct() |
|
23 | - { |
|
24 | - parent::__construct(); |
|
22 | + public function __construct() |
|
23 | + { |
|
24 | + parent::__construct(); |
|
25 | 25 | |
26 | 26 | global $container; |
27 | 27 | $repository = new Jacobemerick\Web\Domain\Blog\Post\MysqlPostRepository($container['db_connection_locator']); |
28 | 28 | $this->post = $repository->findPostByPath(URLDecode::getPiece(2)); |
29 | 29 | |
30 | - if($this->post == null) |
|
31 | - $this->eject(); |
|
30 | + if($this->post == null) |
|
31 | + $this->eject(); |
|
32 | 32 | |
33 | - $this->handle_comment_submit( |
|
34 | - self::$BLOG_SITE_ID, |
|
35 | - $this->post['path'], |
|
36 | - Loader::getRootUrl('blog') . $this->post['category'] . '/' . $this->post['path'] . '/', |
|
37 | - $this->post['title']); |
|
33 | + $this->handle_comment_submit( |
|
34 | + self::$BLOG_SITE_ID, |
|
35 | + $this->post['path'], |
|
36 | + Loader::getRootUrl('blog') . $this->post['category'] . '/' . $this->post['path'] . '/', |
|
37 | + $this->post['title']); |
|
38 | 38 | |
39 | 39 | global $container; |
40 | 40 | $repository = new Jacobemerick\Web\Domain\Blog\Tag\MysqlTagRepository($container['db_connection_locator']); |
41 | 41 | $this->tags = $repository->getTagsForPost($this->post['id']); |
42 | - } |
|
42 | + } |
|
43 | 43 | |
44 | - protected function set_head_data() |
|
45 | - { |
|
46 | - parent::set_head_data(); |
|
44 | + protected function set_head_data() |
|
45 | + { |
|
46 | + parent::set_head_data(); |
|
47 | 47 | |
48 | - $this->set_title(sprintf(self::$TITLE, $this->post['title'])); |
|
49 | - $this->set_description($this->get_post_description()); |
|
50 | - $this->set_keywords($this->get_post_keywords()); |
|
51 | - $this->set_author(self::$AUTHOR); |
|
48 | + $this->set_title(sprintf(self::$TITLE, $this->post['title'])); |
|
49 | + $this->set_description($this->get_post_description()); |
|
50 | + $this->set_keywords($this->get_post_keywords()); |
|
51 | + $this->set_author(self::$AUTHOR); |
|
52 | 52 | |
53 | 53 | $photo = Content::instance('FetchFirstPhoto', $this->post['body'])->activate(true); |
54 | 54 | $photo = preg_match('/^<img src="([a-z-:\.\/]+)" [^>]+>$/', $photo, $matches); |
55 | 55 | $this->set_head('thumbnail', $matches[1]); |
56 | 56 | |
57 | - if (array_key_exists($this->post['id'], self::$DEPRECATED_BLOGS)) { |
|
58 | - $log_id = self::$DEPRECATED_BLOGS[$this->post['id']]; |
|
59 | - $log = LogCollector::getById($log_id); |
|
60 | - if (!empty($log)) { |
|
61 | - $log_url = Loader::getRootUrl('waterfalls') . "journal/{$log->alias}/"; |
|
62 | - $this->set_canonical($log_url); |
|
63 | - } |
|
64 | - } |
|
65 | - } |
|
66 | - |
|
67 | - protected function get_introduction() {} |
|
68 | - |
|
69 | - protected function set_body_data() |
|
70 | - { |
|
71 | - parent::set_body_data(); |
|
57 | + if (array_key_exists($this->post['id'], self::$DEPRECATED_BLOGS)) { |
|
58 | + $log_id = self::$DEPRECATED_BLOGS[$this->post['id']]; |
|
59 | + $log = LogCollector::getById($log_id); |
|
60 | + if (!empty($log)) { |
|
61 | + $log_url = Loader::getRootUrl('waterfalls') . "journal/{$log->alias}/"; |
|
62 | + $this->set_canonical($log_url); |
|
63 | + } |
|
64 | + } |
|
65 | + } |
|
66 | + |
|
67 | + protected function get_introduction() {} |
|
68 | + |
|
69 | + protected function set_body_data() |
|
70 | + { |
|
71 | + parent::set_body_data(); |
|
72 | 72 | |
73 | - $this->set_body('title', $this->post['title']); |
|
74 | - $this->set_body('view', 'Post'); |
|
75 | - $this->set_body('data', array( |
|
76 | - 'post' => $this->format_post($this->post, false), |
|
77 | - 'series_posts' => $this->get_series_posts(), |
|
78 | - 'related_posts' => $this->get_related_posts(), |
|
79 | - 'author' => self::$AUTHOR, |
|
80 | - 'author_url' => self::$AUTHOR_URL, |
|
81 | - 'comment_array' => $this->get_comment_array( |
|
82 | - 'blog.jacobemerick.com', |
|
83 | - "{$this->post['category']}/{$this->post['path']}" |
|
84 | - ), |
|
73 | + $this->set_body('title', $this->post['title']); |
|
74 | + $this->set_body('view', 'Post'); |
|
75 | + $this->set_body('data', array( |
|
76 | + 'post' => $this->format_post($this->post, false), |
|
77 | + 'series_posts' => $this->get_series_posts(), |
|
78 | + 'related_posts' => $this->get_related_posts(), |
|
79 | + 'author' => self::$AUTHOR, |
|
80 | + 'author_url' => self::$AUTHOR_URL, |
|
81 | + 'comment_array' => $this->get_comment_array( |
|
82 | + 'blog.jacobemerick.com', |
|
83 | + "{$this->post['category']}/{$this->post['path']}" |
|
84 | + ), |
|
85 | 85 | )); |
86 | - } |
|
86 | + } |
|
87 | 87 | |
88 | - protected function get_post_description() |
|
89 | - { |
|
90 | - $description = $this->post['body']; |
|
91 | - $description = strip_tags($description); |
|
92 | - $description = Content::instance('SmartTrim', $description)->activate(self::$PAGE_DESCRIPTION_LIMIT); |
|
88 | + protected function get_post_description() |
|
89 | + { |
|
90 | + $description = $this->post['body']; |
|
91 | + $description = strip_tags($description); |
|
92 | + $description = Content::instance('SmartTrim', $description)->activate(self::$PAGE_DESCRIPTION_LIMIT); |
|
93 | 93 | |
94 | - return $description; |
|
95 | - } |
|
94 | + return $description; |
|
95 | + } |
|
96 | 96 | |
97 | - protected function get_post_keywords() |
|
98 | - { |
|
99 | - $keyword_array = array(); |
|
100 | - $keywords = $this->tags; |
|
97 | + protected function get_post_keywords() |
|
98 | + { |
|
99 | + $keyword_array = array(); |
|
100 | + $keywords = $this->tags; |
|
101 | 101 | |
102 | - foreach($keywords as $keyword) |
|
103 | - { |
|
104 | - $keyword_array[] = $keyword['tag']; |
|
105 | - } |
|
102 | + foreach($keywords as $keyword) |
|
103 | + { |
|
104 | + $keyword_array[] = $keyword['tag']; |
|
105 | + } |
|
106 | 106 | |
107 | - $keyword_array[] = 'blog'; |
|
108 | - $keyword_array[] = 'Jacob Emerick'; |
|
107 | + $keyword_array[] = 'blog'; |
|
108 | + $keyword_array[] = 'Jacob Emerick'; |
|
109 | 109 | |
110 | - return $keyword_array; |
|
111 | - } |
|
112 | - |
|
113 | - private function get_series_posts() |
|
114 | - { |
|
115 | - $series_posts = $this->fetch_series_posts(); |
|
116 | - if(count($series_posts) < 1) |
|
117 | - return array(); |
|
110 | + return $keyword_array; |
|
111 | + } |
|
112 | + |
|
113 | + private function get_series_posts() |
|
114 | + { |
|
115 | + $series_posts = $this->fetch_series_posts(); |
|
116 | + if(count($series_posts) < 1) |
|
117 | + return array(); |
|
118 | 118 | |
119 | - $previous_post = new stdclass(); |
|
120 | - $next_post = new stdclass(); |
|
119 | + $previous_post = new stdclass(); |
|
120 | + $next_post = new stdclass(); |
|
121 | 121 | |
122 | - $found_current_post = false; |
|
123 | - foreach($series_posts as $post_row) |
|
124 | - { |
|
125 | - if($post_row['post'] == $this->post['id']) |
|
126 | - { |
|
127 | - $found_current_post = true; |
|
128 | - continue; |
|
129 | - } |
|
122 | + $found_current_post = false; |
|
123 | + foreach($series_posts as $post_row) |
|
124 | + { |
|
125 | + if($post_row['post'] == $this->post['id']) |
|
126 | + { |
|
127 | + $found_current_post = true; |
|
128 | + continue; |
|
129 | + } |
|
130 | 130 | |
131 | - $post = new stdclass(); |
|
131 | + $post = new stdclass(); |
|
132 | 132 | |
133 | - if ( |
|
133 | + if ( |
|
134 | 134 | strpos($post_row['title'], 'Rainy Supe Loop') === 0 || |
135 | 135 | strpos($post_row['title'], 'Malapais Loop') === 0 || |
136 | 136 | strpos($post_row['title'], 'Mazatzal Peak Loop') === 0 || |
@@ -140,65 +140,65 @@ discard block |
||
140 | 140 | strpos($post_row['title'], 'Across the Mazatzals') === 0 || |
141 | 141 | strpos($post_row['title'], 'Upper Mazzie Loop') === 0 || |
142 | 142 | strpos($post_row['title'], 'Moody-Coon Loop') === 0 |
143 | - ) { |
|
143 | + ) { |
|
144 | 144 | $title = $post_row['title']; |
145 | 145 | $title = explode(':', $title); |
146 | 146 | $title = array_pop($title); |
147 | 147 | $title = trim($title); |
148 | 148 | $post->title = $title; |
149 | - } else if (strpos($post_row['title'], 'Isle Royale') === 0) { |
|
150 | - $title = $post_row['title']; |
|
151 | - $title = explode(',', $title); |
|
152 | - $title = array_pop($title); |
|
153 | - $title = trim($title); |
|
154 | - $post->title = $title; |
|
155 | - } else { |
|
156 | - $post->title = $post_row['title']; |
|
157 | - } |
|
158 | - |
|
159 | - $post->url = Loader::getRootUrl('blog') . "{$post_row['category']}/{$post_row['path']}/"; |
|
149 | + } else if (strpos($post_row['title'], 'Isle Royale') === 0) { |
|
150 | + $title = $post_row['title']; |
|
151 | + $title = explode(',', $title); |
|
152 | + $title = array_pop($title); |
|
153 | + $title = trim($title); |
|
154 | + $post->title = $title; |
|
155 | + } else { |
|
156 | + $post->title = $post_row['title']; |
|
157 | + } |
|
158 | + |
|
159 | + $post->url = Loader::getRootUrl('blog') . "{$post_row['category']}/{$post_row['path']}/"; |
|
160 | 160 | |
161 | - if(!$found_current_post) |
|
162 | - $previous_post = $post; |
|
163 | - else |
|
164 | - { |
|
165 | - $next_post = $post; |
|
166 | - break; |
|
167 | - } |
|
168 | - } |
|
161 | + if(!$found_current_post) |
|
162 | + $previous_post = $post; |
|
163 | + else |
|
164 | + { |
|
165 | + $next_post = $post; |
|
166 | + break; |
|
167 | + } |
|
168 | + } |
|
169 | 169 | |
170 | - return array( |
|
171 | - 'title' => $post_row['series_title'], |
|
172 | - 'description' => Content::instance('FixInternalLink', $post_row['series_description'])->activate(), |
|
173 | - 'previous' => $previous_post, |
|
174 | - 'next' => $next_post); |
|
175 | - } |
|
176 | - |
|
177 | - private $series_posts; |
|
178 | - private function fetch_series_posts() |
|
179 | - { |
|
180 | - if(!isset($this->series_posts)) { |
|
181 | - global $container; |
|
182 | - $repository = new Jacobemerick\Web\Domain\Blog\Series\MysqlSeriesRepository($container['db_connection_locator']); |
|
183 | - $this->series_posts = $repository->getSeriesForPost($this->post['id']); |
|
184 | - } |
|
185 | - return $this->series_posts; |
|
186 | - } |
|
187 | - |
|
188 | - private function get_related_posts() |
|
189 | - { |
|
190 | - $tag_array = array(); |
|
191 | - foreach($this->tags as $tag) |
|
192 | - { |
|
193 | - $tag_array[] = $tag['id']; |
|
194 | - } |
|
170 | + return array( |
|
171 | + 'title' => $post_row['series_title'], |
|
172 | + 'description' => Content::instance('FixInternalLink', $post_row['series_description'])->activate(), |
|
173 | + 'previous' => $previous_post, |
|
174 | + 'next' => $next_post); |
|
175 | + } |
|
176 | + |
|
177 | + private $series_posts; |
|
178 | + private function fetch_series_posts() |
|
179 | + { |
|
180 | + if(!isset($this->series_posts)) { |
|
181 | + global $container; |
|
182 | + $repository = new Jacobemerick\Web\Domain\Blog\Series\MysqlSeriesRepository($container['db_connection_locator']); |
|
183 | + $this->series_posts = $repository->getSeriesForPost($this->post['id']); |
|
184 | + } |
|
185 | + return $this->series_posts; |
|
186 | + } |
|
187 | + |
|
188 | + private function get_related_posts() |
|
189 | + { |
|
190 | + $tag_array = array(); |
|
191 | + foreach($this->tags as $tag) |
|
192 | + { |
|
193 | + $tag_array[] = $tag['id']; |
|
194 | + } |
|
195 | 195 | |
196 | - $series_posts = $this->fetch_series_posts(); |
|
197 | - $exclude_post_array = array(); |
|
198 | - foreach($series_posts as $series_post) |
|
199 | - { |
|
200 | - $exclude_post_array[] = $series_post['post']; |
|
201 | - } |
|
196 | + $series_posts = $this->fetch_series_posts(); |
|
197 | + $exclude_post_array = array(); |
|
198 | + foreach($series_posts as $series_post) |
|
199 | + { |
|
200 | + $exclude_post_array[] = $series_post['post']; |
|
201 | + } |
|
202 | 202 | |
203 | 203 | global $container; |
204 | 204 | $repository = new Jacobemerick\Web\Domain\Blog\Post\MysqlPostRepository($container['db_connection_locator']); |
@@ -206,18 +206,18 @@ discard block |
||
206 | 206 | |
207 | 207 | $post_array = array(); |
208 | 208 | |
209 | - foreach($post_result as $post_row) |
|
210 | - { |
|
211 | - $post = new stdclass(); |
|
212 | - $post->title = $post_row['title']; |
|
213 | - $post->url = Loader::getRootUrl('blog') . "{$post_row['category']}/{$post_row['path']}/"; |
|
214 | - $post->category = ucwords(str_replace('-', ' ', $post_row['category'])); |
|
215 | - $post->thumb = Content::instance('FetchFirstPhoto', $post_row['body'])->activate(); |
|
216 | - $post->body = Content::instance('SmartTrim', $post_row['body'])->activate(($post->thumb !== '') ? self::$POST_LENGTH_SHORT : self::$POST_LENGTH_LONG); |
|
209 | + foreach($post_result as $post_row) |
|
210 | + { |
|
211 | + $post = new stdclass(); |
|
212 | + $post->title = $post_row['title']; |
|
213 | + $post->url = Loader::getRootUrl('blog') . "{$post_row['category']}/{$post_row['path']}/"; |
|
214 | + $post->category = ucwords(str_replace('-', ' ', $post_row['category'])); |
|
215 | + $post->thumb = Content::instance('FetchFirstPhoto', $post_row['body'])->activate(); |
|
216 | + $post->body = Content::instance('SmartTrim', $post_row['body'])->activate(($post->thumb !== '') ? self::$POST_LENGTH_SHORT : self::$POST_LENGTH_LONG); |
|
217 | 217 | |
218 | - $post_array[] = $post; |
|
219 | - } |
|
218 | + $post_array[] = $post; |
|
219 | + } |
|
220 | 220 | |
221 | - return $post_array; |
|
222 | - } |
|
221 | + return $post_array; |
|
222 | + } |
|
223 | 223 | } |