@@ -2,19 +2,19 @@ |
||
| 2 | 2 | |
| 3 | 3 | Loader::load('router', 'Router'); |
| 4 | 4 | |
| 5 | -class AJAXRouter extends Router |
|
| 6 | -{ |
|
| 5 | +class AJAXRouter extends Router |
|
| 6 | +{
|
|
| 7 | 7 | |
| 8 | - protected function get_redirect_array() |
|
| 9 | - { |
|
| 8 | + protected function get_redirect_array() |
|
| 9 | + {
|
|
| 10 | 10 | return array( |
| 11 | 11 | (object) array( |
| 12 | 12 | 'pattern' => '@^/$@', |
| 13 | 13 | 'replace' => 'https://home.jacobemerick.com/')); |
| 14 | 14 | } |
| 15 | 15 | |
| 16 | - protected function get_direct_array() |
|
| 17 | - { |
|
| 16 | + protected function get_direct_array() |
|
| 17 | + {
|
|
| 18 | 18 | return array( |
| 19 | 19 | (object) array( |
| 20 | 20 | 'match' => '/get/portfolioImage.json', |
@@ -5,11 +5,11 @@ discard block |
||
| 5 | 5 | 'waterfall/WaterfallCollector')); |
| 6 | 6 | Loader::load('router', 'Router'); |
| 7 | 7 | |
| 8 | -class WaterfallRouter extends Router |
|
| 9 | -{ |
|
| 8 | +class WaterfallRouter extends Router |
|
| 9 | +{
|
|
| 10 | 10 | |
| 11 | - protected function get_redirect_array() |
|
| 12 | - { |
|
| 11 | + protected function get_redirect_array() |
|
| 12 | + {
|
|
| 13 | 13 | return array( |
| 14 | 14 | (object) array( |
| 15 | 15 | 'pattern' => '@/index.(html|htm|php)$@', |
@@ -71,8 +71,8 @@ discard block |
||
| 71 | 71 | ); |
| 72 | 72 | } |
| 73 | 73 | |
| 74 | - protected function check_for_special_redirect($uri) |
|
| 75 | - { |
|
| 74 | + protected function check_for_special_redirect($uri) |
|
| 75 | + {
|
|
| 76 | 76 | if (preg_match('@^/falls/([a-z\'-]+)(/?)$@', $uri, $matches)) { |
| 77 | 77 | $alias = $matches[1]; |
| 78 | 78 | $alias = str_replace("'", '', $alias); |
@@ -128,8 +128,8 @@ discard block |
||
| 128 | 128 | return $uri; |
| 129 | 129 | } |
| 130 | 130 | |
| 131 | - protected function get_direct_array() |
|
| 132 | - { |
|
| 131 | + protected function get_direct_array() |
|
| 132 | + {
|
|
| 133 | 133 | return array( |
| 134 | 134 | (object) array( |
| 135 | 135 | 'match' => '/', |
@@ -2,11 +2,11 @@ discard block |
||
| 2 | 2 | |
| 3 | 3 | Loader::load('controller', '/PageController'); |
| 4 | 4 | |
| 5 | -class Error503Controller extends PageController |
|
| 6 | -{ |
|
| 5 | +class Error503Controller extends PageController |
|
| 6 | +{
|
|
| 7 | 7 | |
| 8 | - protected function set_head_data() |
|
| 9 | - { |
|
| 8 | + protected function set_head_data() |
|
| 9 | + {
|
|
| 10 | 10 | $this->set_header_method('send503'); |
| 11 | 11 | $this->add_css('normalize'); |
| 12 | 12 | $this->add_css('503'); |
@@ -16,8 +16,8 @@ discard block |
||
| 16 | 16 | $this->set_keywords(array()); |
| 17 | 17 | } |
| 18 | 18 | |
| 19 | - protected function set_body_data() |
|
| 20 | - { |
|
| 19 | + protected function set_body_data() |
|
| 20 | + {
|
|
| 21 | 21 | $this->set_body_view('/503'); |
| 22 | 22 | } |
| 23 | 23 | |
@@ -4,11 +4,11 @@ discard block |
||
| 4 | 4 | |
| 5 | 5 | Loader::load('controller', 'site/DefaultPageController'); |
| 6 | 6 | |
| 7 | -final class ChangelogController extends DefaultPageController |
|
| 8 | -{ |
|
| 7 | +final class ChangelogController extends DefaultPageController |
|
| 8 | +{
|
|
| 9 | 9 | |
| 10 | - protected function set_head_data() |
|
| 11 | - { |
|
| 10 | + protected function set_head_data() |
|
| 11 | + {
|
|
| 12 | 12 | $this->set_title("Changelog for Jacob Emerick's Sites"); |
| 13 | 13 | $this->set_description("Listing of the last changes done on the framework behind Jacob Emerick's websites. Yeah, he's down with that version control."); |
| 14 | 14 | $this->set_keywords(array('changelog', 'version control', 'code', 'comments', 'Jacob Emerick')); |
@@ -16,8 +16,8 @@ discard block |
||
| 16 | 16 | parent::set_head_data(); |
| 17 | 17 | } |
| 18 | 18 | |
| 19 | - protected function set_body_data() |
|
| 20 | - { |
|
| 19 | + protected function set_body_data() |
|
| 20 | + {
|
|
| 21 | 21 | parent::set_body_data(); |
| 22 | 22 | |
| 23 | 23 | $this->set_body('top_data', array('title' => 'Change Log')); |
@@ -26,8 +26,8 @@ discard block |
||
| 26 | 26 | $this->set_body('body_view', 'Changelog'); |
| 27 | 27 | } |
| 28 | 28 | |
| 29 | - private function get_changelog() |
|
| 30 | - { |
|
| 29 | + private function get_changelog() |
|
| 30 | + {
|
|
| 31 | 31 | global $container; |
| 32 | 32 | $changelogRepository = new MysqlChangelogRepository($container['db_connection_locator']); |
| 33 | 33 | $changelog_result = $changelogRepository->getChanges(40); |
@@ -2,8 +2,8 @@ discard block |
||
| 2 | 2 | |
| 3 | 3 | Loader::load('controller', '/PageController'); |
| 4 | 4 | |
| 5 | -abstract class DefaultPageController extends PageController |
|
| 6 | -{ |
|
| 5 | +abstract class DefaultPageController extends PageController |
|
| 6 | +{
|
|
| 7 | 7 | |
| 8 | 8 | private static $MENU = array( |
| 9 | 9 | array( |
@@ -19,14 +19,14 @@ discard block |
||
| 19 | 19 | 'name' => 'Contact', |
| 20 | 20 | 'uri' => 'contact')); |
| 21 | 21 | |
| 22 | - protected function set_head_data() |
|
| 23 | - { |
|
| 22 | + protected function set_head_data() |
|
| 23 | + {
|
|
| 24 | 24 | $this->add_css('reset'); |
| 25 | 25 | $this->add_css('site'); |
| 26 | 26 | } |
| 27 | 27 | |
| 28 | - protected function set_body_data() |
|
| 29 | - { |
|
| 28 | + protected function set_body_data() |
|
| 29 | + {
|
|
| 30 | 30 | $this->set_body('top_data', array()); |
| 31 | 31 | $this->set_body('body_data', array()); |
| 32 | 32 | |
@@ -36,8 +36,8 @@ discard block |
||
| 36 | 36 | $this->set_body_view('Page'); |
| 37 | 37 | } |
| 38 | 38 | |
| 39 | - private function get_menu() |
|
| 40 | - { |
|
| 39 | + private function get_menu() |
|
| 40 | + {
|
|
| 41 | 41 | $active_page = $this->get_active_page(); |
| 42 | 42 | |
| 43 | 43 | $menu = array(); |
@@ -52,18 +52,20 @@ discard block |
||
| 52 | 52 | return $menu; |
| 53 | 53 | } |
| 54 | 54 | |
| 55 | - private function get_active_page() |
|
| 56 | - { |
|
| 55 | + private function get_active_page() |
|
| 56 | + {
|
|
| 57 | 57 | $current_uri = URLDecode::getPiece(1); |
| 58 | 58 | |
| 59 | - if(!isset($current_uri)) |
|
| 60 | - return 'About'; |
|
| 59 | + if(!isset($current_uri)) {
|
|
| 60 | + return 'About'; |
|
| 61 | + } |
|
| 61 | 62 | |
| 62 | 63 | $menu = self::$MENU; |
| 63 | 64 | foreach($menu as $link) |
| 64 | 65 | { |
| 65 | - if($link['uri'] == $current_uri) |
|
| 66 | - return $link['name']; |
|
| 66 | + if($link['uri'] == $current_uri) {
|
|
| 67 | + return $link['name']; |
|
| 68 | + } |
|
| 67 | 69 | } |
| 68 | 70 | |
| 69 | 71 | return 'About'; |
@@ -2,11 +2,11 @@ discard block |
||
| 2 | 2 | |
| 3 | 3 | Loader::load('controller', 'site/DefaultPageController'); |
| 4 | 4 | |
| 5 | -final class HomeController extends DefaultPageController |
|
| 6 | -{ |
|
| 5 | +final class HomeController extends DefaultPageController |
|
| 6 | +{
|
|
| 7 | 7 | |
| 8 | - protected function set_head_data() |
|
| 9 | - { |
|
| 8 | + protected function set_head_data() |
|
| 9 | + {
|
|
| 10 | 10 | $this->set_title("Jacob Emerick's Site Information | General and Technical Information"); |
| 11 | 11 | $this->set_description("Meta information about Jacob Emerick's websites and content. Introduces the man behind the code, discusses the reasons behind the sites, and goes into some technical background of the custom framework."); |
| 12 | 12 | $this->set_keywords(array('site', 'technical', 'support', 'help', 'information', 'Jacob Emerick')); |
@@ -14,8 +14,8 @@ discard block |
||
| 14 | 14 | parent::set_head_data(); |
| 15 | 15 | } |
| 16 | 16 | |
| 17 | - protected function set_body_data() |
|
| 18 | - { |
|
| 17 | + protected function set_body_data() |
|
| 18 | + {
|
|
| 19 | 19 | $this->set_body('body_view', 'Home'); |
| 20 | 20 | |
| 21 | 21 | parent::set_body_data(); |
@@ -2,11 +2,11 @@ discard block |
||
| 2 | 2 | |
| 3 | 3 | Loader::load('controller', 'site/DefaultPageController'); |
| 4 | 4 | |
| 5 | -final class TermsController extends DefaultPageController |
|
| 6 | -{ |
|
| 5 | +final class TermsController extends DefaultPageController |
|
| 6 | +{
|
|
| 7 | 7 | |
| 8 | - protected function set_head_data() |
|
| 9 | - { |
|
| 8 | + protected function set_head_data() |
|
| 9 | + {
|
|
| 10 | 10 | $this->set_title("Terms of Use for Jacob Emerick's Sites"); |
| 11 | 11 | $this->set_description("Some basic (and boring) legal jargon and perferred usage of the content on Jacob Emerick's sites. Includes re-use terms and advice on retracing hikes."); |
| 12 | 12 | $this->set_keywords(array('terms of use', 'legal', 'accountability', 'trespassing', 'Jacob Emerick')); |
@@ -14,8 +14,8 @@ discard block |
||
| 14 | 14 | parent::set_head_data(); |
| 15 | 15 | } |
| 16 | 16 | |
| 17 | - protected function set_body_data() |
|
| 18 | - { |
|
| 17 | + protected function set_body_data() |
|
| 18 | + {
|
|
| 19 | 19 | $this->set_body('top_data', array('title' => 'Terms of Use')); |
| 20 | 20 | |
| 21 | 21 | $this->set_body('body_view', 'Terms'); |
@@ -4,11 +4,11 @@ discard block |
||
| 4 | 4 | Loader::load('utility', array( |
| 5 | 5 | 'Validate')); |
| 6 | 6 | |
| 7 | -final class ContactController extends DefaultPageController |
|
| 8 | -{ |
|
| 7 | +final class ContactController extends DefaultPageController |
|
| 8 | +{
|
|
| 9 | 9 | |
| 10 | - protected function set_head_data() |
|
| 11 | - { |
|
| 10 | + protected function set_head_data() |
|
| 11 | + {
|
|
| 12 | 12 | $this->set_title("Contact Form for Jacob Emerick's Sites"); |
| 13 | 13 | $this->set_description("Want to reach out to Jacob Emerick with questions or concerns? Well, then here's a handy contact form for you that will connect you with the man himself."); |
| 14 | 14 | $this->set_keywords(array('contact', 'webmaster', 'support', 'help', 'Jacob Emerick')); |
@@ -16,8 +16,8 @@ discard block |
||
| 16 | 16 | parent::set_head_data(); |
| 17 | 17 | } |
| 18 | 18 | |
| 19 | - protected function set_body_data() |
|
| 20 | - { |
|
| 19 | + protected function set_body_data() |
|
| 20 | + {
|
|
| 21 | 21 | parent::set_body_data(); |
| 22 | 22 | |
| 23 | 23 | $this->set_body('top_data', array('title' => 'Contact Me')); |
@@ -26,17 +26,21 @@ discard block |
||
| 26 | 26 | $this->set_body('body_view', 'Contact'); |
| 27 | 27 | } |
| 28 | 28 | |
| 29 | - private function get_form_results() |
|
| 30 | - { |
|
| 31 | - if(!Request::hasPost()) |
|
| 32 | - return array(); |
|
| 29 | + private function get_form_results() |
|
| 30 | + {
|
|
| 31 | + if(!Request::hasPost()) {
|
|
| 32 | + return array(); |
|
| 33 | + } |
|
| 33 | 34 | |
| 34 | - if(!Validate::checkRequest('post', 'name', 'string')) |
|
| 35 | - $error_message['name'] = 'Please enter a value for your name.'; |
|
| 36 | - if(!Validate::checkRequest('post', 'email', 'string')) |
|
| 37 | - $error_message['email'] = 'Please enter a valid email address.'; |
|
| 38 | - if(!Validate::checkRequest('post', 'message', 'string')) |
|
| 39 | - $error_message['message'] = 'Please enter a message.'; |
|
| 35 | + if(!Validate::checkRequest('post', 'name', 'string')) {
|
|
| 36 | + $error_message['name'] = 'Please enter a value for your name.'; |
|
| 37 | + } |
|
| 38 | + if(!Validate::checkRequest('post', 'email', 'string')) {
|
|
| 39 | + $error_message['email'] = 'Please enter a valid email address.'; |
|
| 40 | + } |
|
| 41 | + if(!Validate::checkRequest('post', 'message', 'string')) {
|
|
| 42 | + $error_message['message'] = 'Please enter a message.'; |
|
| 43 | + } |
|
| 40 | 44 | |
| 41 | 45 | if(!empty($error_message)) |
| 42 | 46 | { |
@@ -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']); |