@@ -2,8 +2,8 @@ discard block |
||
2 | 2 | |
3 | 3 | Loader::load('controller', 'lifestream/DefaultListController'); |
4 | 4 | |
5 | -final class HomeController extends DefaultListController |
|
6 | -{ |
|
5 | +final class HomeController extends DefaultListController |
|
6 | +{ |
|
7 | 7 | |
8 | 8 | private static $TITLE = "Jacob Emerick's Lifestream"; |
9 | 9 | private static $DESCRIPTION = 'Lifestream for Jacob Emerick, a combination of his latest twitter, youtube, running, reading, and blogging activity.'; |
@@ -18,8 +18,7 @@ discard block |
||
18 | 18 | |
19 | 19 | private static $LIST_DESCRIPTION = 'viewing %d - %d of %d total activities'; |
20 | 20 | |
21 | - protected function set_head_data() |
|
22 | - { |
|
21 | + protected function set_head_data() { |
|
23 | 22 | $this->set_title(self::$TITLE); |
24 | 23 | $this->set_description(self::$DESCRIPTION); |
25 | 24 | $this->set_keywords(self::$KEYWORD_ARRAY); |
@@ -27,56 +26,54 @@ discard block |
||
27 | 26 | parent::set_head_data(); |
28 | 27 | } |
29 | 28 | |
30 | - protected function set_body_data() |
|
31 | - { |
|
29 | + protected function set_body_data() { |
|
32 | 30 | $this->set_body('title', "What's Jacob Up To?"); |
33 | 31 | $this->set_body('description', "A combination of Jacob Emerick's tweets, runs, reads, blogs, and YouTubes all in <em>one awesome lifestream</em>."); |
34 | 32 | |
35 | 33 | parent::set_body_data(); |
36 | 34 | } |
37 | 35 | |
38 | - protected function get_page_number() |
|
39 | - { |
|
36 | + protected function get_page_number() { |
|
40 | 37 | $page = URLDecode::getPiece(2); |
41 | - if(isset($page) && is_numeric($page)) |
|
42 | - return $page; |
|
38 | + if(isset($page) && is_numeric($page)) { |
|
39 | + return $page; |
|
40 | + } |
|
43 | 41 | return 1; |
44 | 42 | } |
45 | 43 | |
46 | - protected function get_list_results() |
|
47 | - { |
|
44 | + protected function get_list_results() { |
|
48 | 45 | return $this->activityRepository->getActivities(self::$POSTS_PER_PAGE, $this->offset); |
49 | 46 | } |
50 | 47 | |
51 | - protected function get_list_description() |
|
52 | - { |
|
48 | + protected function get_list_description() { |
|
53 | 49 | $start = $this->offset + 1; |
54 | 50 | $end = min($this->offset + self::$POSTS_PER_PAGE, $this->get_total_post_count()); |
55 | 51 | |
56 | 52 | return sprintf(self::$LIST_DESCRIPTION, $start, $end, $this->get_total_post_count()); |
57 | 53 | } |
58 | 54 | |
59 | - protected function get_list_next_link() |
|
60 | - { |
|
61 | - if($this->page == 1) |
|
62 | - return; |
|
63 | - if($this->page == 2) |
|
64 | - return Loader::getRootUrl('lifestream'); |
|
55 | + protected function get_list_next_link() { |
|
56 | + if($this->page == 1) { |
|
57 | + return; |
|
58 | + } |
|
59 | + if($this->page == 2) { |
|
60 | + return Loader::getRootUrl('lifestream'); |
|
61 | + } |
|
65 | 62 | return Loader::getRootUrl('lifestream') . 'page/' . ($this->page - 1) . '/'; |
66 | 63 | } |
67 | 64 | |
68 | - protected function get_list_prev_link() |
|
69 | - { |
|
70 | - if(($this->page * self::$POSTS_PER_PAGE) >= $this->get_total_post_count()) |
|
71 | - return; |
|
65 | + protected function get_list_prev_link() { |
|
66 | + if(($this->page * self::$POSTS_PER_PAGE) >= $this->get_total_post_count()) { |
|
67 | + return; |
|
68 | + } |
|
72 | 69 | return Loader::getRootUrl('lifestream') . 'page/' . ($this->page + 1) . '/'; |
73 | 70 | } |
74 | 71 | |
75 | 72 | private $total_post_count; |
76 | - protected function get_total_post_count() |
|
77 | - { |
|
78 | - if(!isset($this->total_post_count)) |
|
79 | - $this->total_post_count = $this->activityRepository->getActivitiesCount(); |
|
73 | + protected function get_total_post_count() { |
|
74 | + if(!isset($this->total_post_count)) { |
|
75 | + $this->total_post_count = $this->activityRepository->getActivitiesCount(); |
|
76 | + } |
|
80 | 77 | return $this->total_post_count; |
81 | 78 | } |
82 | 79 |
@@ -2,11 +2,10 @@ 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() { |
|
10 | 9 | $this->set_header_method('send503'); |
11 | 10 | $this->add_css('normalize'); |
12 | 11 | $this->add_css('503'); |
@@ -16,8 +15,7 @@ discard block |
||
16 | 15 | $this->set_keywords(array()); |
17 | 16 | } |
18 | 17 | |
19 | - protected function set_body_data() |
|
20 | - { |
|
18 | + protected function set_body_data() { |
|
21 | 19 | $this->set_body_view('/503'); |
22 | 20 | } |
23 | 21 |
@@ -2,11 +2,10 @@ |
||
2 | 2 | |
3 | 3 | Loader::load('controller', '/PageController'); |
4 | 4 | |
5 | -class Error301Controller extends PageController |
|
6 | -{ |
|
5 | +class Error301Controller extends PageController |
|
6 | +{ |
|
7 | 7 | |
8 | - public function __construct($uri) |
|
9 | - { |
|
8 | + public function __construct($uri) { |
|
10 | 9 | Header::redirect($uri); |
11 | 10 | exit; |
12 | 11 | } |
@@ -2,11 +2,10 @@ discard block |
||
2 | 2 | |
3 | 3 | Loader::load('controller', 'portfolio/DefaultPageController'); |
4 | 4 | |
5 | -class ProjectsController extends DefaultPageController |
|
6 | -{ |
|
5 | +class ProjectsController extends DefaultPageController |
|
6 | +{ |
|
7 | 7 | |
8 | - protected function set_head_data() |
|
9 | - { |
|
8 | + protected function set_head_data() { |
|
10 | 9 | $this->set_title("Projects Page | Jacob Emerick's Portfolio"); |
11 | 10 | $this->set_description("Collection of key open-source projects that Jacob has developed and maintained over the years."); |
12 | 11 | $this->set_keywords([ |
@@ -19,8 +18,7 @@ discard block |
||
19 | 18 | ]); |
20 | 19 | } |
21 | 20 | |
22 | - protected function set_body_data() |
|
23 | - { |
|
21 | + protected function set_body_data() { |
|
24 | 22 | $this->set_body('body_view', 'Projects'); |
25 | 23 | $this->set_body('body_data', []); |
26 | 24 |
@@ -2,13 +2,12 @@ discard block |
||
2 | 2 | |
3 | 3 | Loader::load('controller', 'portfolio/DefaultPageController'); |
4 | 4 | |
5 | -class ResumeController extends DefaultPageController |
|
6 | -{ |
|
5 | +class ResumeController extends DefaultPageController |
|
6 | +{ |
|
7 | 7 | |
8 | 8 | protected $resume = 'resume-20160318.json'; |
9 | 9 | |
10 | - protected function set_head_data() |
|
11 | - { |
|
10 | + protected function set_head_data() { |
|
12 | 11 | $this->set_title("Resume | Jacob Emerick's Portfolio"); |
13 | 12 | $this->set_description("Resume for Jacob Emerick, a software engineer extraordinaire"); |
14 | 13 | $this->set_keywords([ |
@@ -21,8 +20,7 @@ discard block |
||
21 | 20 | ]); |
22 | 21 | } |
23 | 22 | |
24 | - protected function set_body_data() |
|
25 | - { |
|
23 | + protected function set_body_data() { |
|
26 | 24 | $this->set_body('body_view', 'Resume'); |
27 | 25 | |
28 | 26 | $resumePath = Loader::getRootURL('portfolio') . "/jsonresume/{$this->resume}"; |
@@ -2,19 +2,17 @@ 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 | - public function __construct() |
|
9 | - { |
|
8 | + public function __construct() { |
|
10 | 9 | parent::__construct(); |
11 | 10 | |
12 | 11 | $this->add_css('reset'); |
13 | 12 | $this->add_css('portfolio', 4); |
14 | 13 | } |
15 | 14 | |
16 | - protected function set_body_data() |
|
17 | - { |
|
15 | + protected function set_body_data() { |
|
18 | 16 | $this->set_body('header_data', [ |
19 | 17 | 'menu' => $this->get_menu(), |
20 | 18 | 'home_link' => Loader::getRootURL(), |
@@ -24,8 +22,7 @@ discard block |
||
24 | 22 | $this->set_body_view('Page'); |
25 | 23 | } |
26 | 24 | |
27 | - protected function get_menu() |
|
28 | - { |
|
25 | + protected function get_menu() { |
|
29 | 26 | $menu = [ |
30 | 27 | [ |
31 | 28 | 'name' => 'About', |
@@ -2,11 +2,10 @@ discard block |
||
2 | 2 | |
3 | 3 | Loader::load('controller', 'portfolio/DefaultPageController'); |
4 | 4 | |
5 | -class AboutController extends DefaultPageController |
|
6 | -{ |
|
5 | +class AboutController extends DefaultPageController |
|
6 | +{ |
|
7 | 7 | |
8 | - protected function set_head_data() |
|
9 | - { |
|
8 | + protected function set_head_data() { |
|
10 | 9 | $this->set_title("Jacob Emerick's Portfolio"); |
11 | 10 | $this->set_description("Jacob Emerick's Portfolio - collection of programming projects and resume"); |
12 | 11 | $this->set_keywords([ |
@@ -20,8 +19,7 @@ discard block |
||
20 | 19 | ]); |
21 | 20 | } |
22 | 21 | |
23 | - protected function set_body_data() |
|
24 | - { |
|
22 | + protected function set_body_data() { |
|
25 | 23 | $this->set_body('body_view', 'About'); |
26 | 24 | $this->set_body('body_data', []); |
27 | 25 |
@@ -2,11 +2,10 @@ discard block |
||
2 | 2 | |
3 | 3 | Loader::load('controller', 'portfolio/DefaultPageController'); |
4 | 4 | |
5 | -class ContactController extends DefaultPageController |
|
6 | -{ |
|
5 | +class ContactController extends DefaultPageController |
|
6 | +{ |
|
7 | 7 | |
8 | - protected function set_head_data() |
|
9 | - { |
|
8 | + protected function set_head_data() { |
|
10 | 9 | $this->set_title("Contact Page | Jacob Emerick's Portfolio"); |
11 | 10 | $this->set_description("Contact page for Jacob Emerick's Portfolio"); |
12 | 11 | $this->set_keywords([ |
@@ -19,8 +18,7 @@ discard block |
||
19 | 18 | ]); |
20 | 19 | } |
21 | 20 | |
22 | - protected function set_body_data() |
|
23 | - { |
|
21 | + protected function set_body_data() { |
|
24 | 22 | $this->set_body('body_view', 'Contact'); |
25 | 23 | |
26 | 24 | $body_data = []; |
@@ -33,8 +31,7 @@ discard block |
||
33 | 31 | parent::set_body_data(); |
34 | 32 | } |
35 | 33 | |
36 | - private function process_form_data() |
|
37 | - { |
|
34 | + private function process_form_data() { |
|
38 | 35 | $errors = []; |
39 | 36 | |
40 | 37 | if ( |
@@ -4,8 +4,8 @@ discard block |
||
4 | 4 | 'Header', |
5 | 5 | 'Request')); |
6 | 6 | |
7 | -abstract class AJAXController |
|
8 | -{ |
|
7 | +abstract class AJAXController |
|
8 | +{ |
|
9 | 9 | |
10 | 10 | private static $RESPONSE_HEADER = 'sendJSON'; |
11 | 11 | |
@@ -15,16 +15,14 @@ discard block |
||
15 | 15 | |
16 | 16 | function __construct() {} |
17 | 17 | |
18 | - public function activate() |
|
19 | - { |
|
18 | + public function activate() { |
|
20 | 19 | call_user_func(array('Header', self::$RESPONSE_HEADER)); |
21 | 20 | |
22 | 21 | $this->set_data(); |
23 | 22 | echo $this->response_as_json(); |
24 | 23 | } |
25 | 24 | |
26 | - protected function set_response($message, $type = 'internal') |
|
27 | - { |
|
25 | + protected function set_response($message, $type = 'internal') { |
|
28 | 26 | switch($type) |
29 | 27 | { |
30 | 28 | case 'internal' : |
@@ -38,21 +36,18 @@ discard block |
||
38 | 36 | } |
39 | 37 | } |
40 | 38 | |
41 | - protected function fail_response($message) |
|
42 | - { |
|
39 | + protected function fail_response($message) { |
|
43 | 40 | $this->set_response($message, 'error'); |
44 | 41 | return false; |
45 | 42 | } |
46 | 43 | |
47 | - protected function eject($message) |
|
48 | - { |
|
44 | + protected function eject($message) { |
|
49 | 45 | $this->fail_response($message); |
50 | 46 | echo $this->response_as_json(); |
51 | 47 | exit(); |
52 | 48 | } |
53 | 49 | |
54 | - private function response_as_json() |
|
55 | - { |
|
50 | + private function response_as_json() { |
|
56 | 51 | return json_encode($this->response); |
57 | 52 | } |
58 | 53 |