@@ -23,9 +23,9 @@ discard block |
||
23 | 23 | { |
24 | 24 | parent::__construct(); |
25 | 25 | |
26 | - global $container; |
|
27 | - $repository = new Jacobemerick\Web\Domain\Blog\Post\MysqlPostRepository($container['db_connection_locator']); |
|
28 | - $this->post = $repository->findPostByPath(URLDecode::getPiece(2)); |
|
26 | + global $container; |
|
27 | + $repository = new Jacobemerick\Web\Domain\Blog\Post\MysqlPostRepository($container['db_connection_locator']); |
|
28 | + $this->post = $repository->findPostByPath(URLDecode::getPiece(2)); |
|
29 | 29 | |
30 | 30 | if($this->post == null) |
31 | 31 | $this->eject(); |
@@ -36,9 +36,9 @@ discard block |
||
36 | 36 | Loader::getRootUrl('blog') . $this->post['category'] . '/' . $this->post['path'] . '/', |
37 | 37 | $this->post['title']); |
38 | 38 | |
39 | - global $container; |
|
40 | - $repository = new Jacobemerick\Web\Domain\Blog\Tag\MysqlTagRepository($container['db_connection_locator']); |
|
41 | - $this->tags = $repository->getTagsForPost($this->post['id']); |
|
39 | + global $container; |
|
40 | + $repository = new Jacobemerick\Web\Domain\Blog\Tag\MysqlTagRepository($container['db_connection_locator']); |
|
41 | + $this->tags = $repository->getTagsForPost($this->post['id']); |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | protected function set_head_data() |
@@ -50,9 +50,9 @@ discard block |
||
50 | 50 | $this->set_keywords($this->get_post_keywords()); |
51 | 51 | $this->set_author(self::$AUTHOR); |
52 | 52 | |
53 | - $photo = Content::instance('FetchFirstPhoto', $this->post['body'])->activate(true); |
|
54 | - $photo = preg_match('/^<img src="([a-z-:\.\/]+)" [^>]+>$/', $photo, $matches); |
|
55 | - $this->set_head('thumbnail', $matches[1]); |
|
53 | + $photo = Content::instance('FetchFirstPhoto', $this->post['body'])->activate(true); |
|
54 | + $photo = preg_match('/^<img src="([a-z-:\.\/]+)" [^>]+>$/', $photo, $matches); |
|
55 | + $this->set_head('thumbnail', $matches[1]); |
|
56 | 56 | |
57 | 57 | if (array_key_exists($this->post['id'], self::$DEPRECATED_BLOGS)) { |
58 | 58 | $log_id = self::$DEPRECATED_BLOGS[$this->post['id']]; |
@@ -126,16 +126,16 @@ discard block |
||
126 | 126 | |
127 | 127 | $post = new stdclass(); |
128 | 128 | |
129 | - if ( |
|
130 | - strpos($post_row['title'], 'Rainy Supe Loop') === 0 || |
|
131 | - strpos($post_row['title'], 'Malapais Loop') === 0 |
|
132 | - ) { |
|
133 | - $title = $post_row['title']; |
|
134 | - $title = explode(':', $title); |
|
135 | - $title = array_pop($title); |
|
136 | - $title = trim($title); |
|
137 | - $post->title = $title; |
|
138 | - } else if (strpos($post_row['title'], 'Isle Royale') === 0) { |
|
129 | + if ( |
|
130 | + strpos($post_row['title'], 'Rainy Supe Loop') === 0 || |
|
131 | + strpos($post_row['title'], 'Malapais Loop') === 0 |
|
132 | + ) { |
|
133 | + $title = $post_row['title']; |
|
134 | + $title = explode(':', $title); |
|
135 | + $title = array_pop($title); |
|
136 | + $title = trim($title); |
|
137 | + $post->title = $title; |
|
138 | + } else if (strpos($post_row['title'], 'Isle Royale') === 0) { |
|
139 | 139 | $title = $post_row['title']; |
140 | 140 | $title = explode(',', $title); |
141 | 141 | $title = array_pop($title); |
@@ -166,12 +166,12 @@ discard block |
||
166 | 166 | private $series_posts; |
167 | 167 | private function fetch_series_posts() |
168 | 168 | { |
169 | - if(!isset($this->series_posts)) { |
|
170 | - global $container; |
|
171 | - $repository = new Jacobemerick\Web\Domain\Blog\Series\MysqlSeriesRepository($container['db_connection_locator']); |
|
172 | - $this->series_posts = $repository->getSeriesForPost($this->post['id']); |
|
173 | - } |
|
174 | - return $this->series_posts; |
|
169 | + if(!isset($this->series_posts)) { |
|
170 | + global $container; |
|
171 | + $repository = new Jacobemerick\Web\Domain\Blog\Series\MysqlSeriesRepository($container['db_connection_locator']); |
|
172 | + $this->series_posts = $repository->getSeriesForPost($this->post['id']); |
|
173 | + } |
|
174 | + return $this->series_posts; |
|
175 | 175 | } |
176 | 176 | |
177 | 177 | private function get_related_posts() |
@@ -189,11 +189,11 @@ discard block |
||
189 | 189 | $exclude_post_array[] = $series_post['post']; |
190 | 190 | } |
191 | 191 | |
192 | - global $container; |
|
193 | - $repository = new Jacobemerick\Web\Domain\Blog\Post\MysqlPostRepository($container['db_connection_locator']); |
|
194 | - $post_result = $repository->getActivePostsByRelatedTags($this->post['id']); |
|
192 | + global $container; |
|
193 | + $repository = new Jacobemerick\Web\Domain\Blog\Post\MysqlPostRepository($container['db_connection_locator']); |
|
194 | + $post_result = $repository->getActivePostsByRelatedTags($this->post['id']); |
|
195 | 195 | |
196 | - $post_array = array(); |
|
196 | + $post_array = array(); |
|
197 | 197 | |
198 | 198 | foreach($post_result as $post_row) |
199 | 199 | { |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | |
16 | 16 | $handle = @fopen($config_path, 'r'); |
17 | 17 | if ($handle === false) { |
18 | - throw new RuntimeException("Could not load config"); |
|
18 | + throw new RuntimeException("Could not load config"); |
|
19 | 19 | } |
20 | 20 | $config = fread($handle, filesize($config_path)); |
21 | 21 | fclose($handle); |
@@ -23,71 +23,71 @@ discard block |
||
23 | 23 | $config = json_decode($config); |
24 | 24 | $last_json_error = json_last_error(); |
25 | 25 | if ($last_json_error !== JSON_ERROR_NONE) { |
26 | - throw new RuntimeException("Could not parse config - JSON error detected"); |
|
26 | + throw new RuntimeException("Could not parse config - JSON error detected"); |
|
27 | 27 | } |
28 | 28 | $container['config'] = $config; |
29 | 29 | |
30 | 30 | // timezones are fun |
31 | 31 | date_default_timezone_set('America/Phoenix'); // todo - belongs in configuration |
32 | 32 | $container['default_timezone'] = function ($c) { |
33 | - return new DateTimeZone('America/Phoenix'); |
|
33 | + return new DateTimeZone('America/Phoenix'); |
|
34 | 34 | }; |
35 | 35 | |
36 | 36 | |
37 | 37 | // configure the db connections holder |
38 | 38 | $db_connections = new Aura\Sql\ConnectionLocator(); |
39 | 39 | $db_connections->setDefault(function () use ($config) { |
40 | - $connection = $config->database->slave; |
|
41 | - return new Aura\Sql\ExtendedPdo( |
|
42 | - "mysql:host={$connection->host}", |
|
43 | - $connection->user, |
|
44 | - $connection->password |
|
45 | - ); |
|
40 | + $connection = $config->database->slave; |
|
41 | + return new Aura\Sql\ExtendedPdo( |
|
42 | + "mysql:host={$connection->host}", |
|
43 | + $connection->user, |
|
44 | + $connection->password |
|
45 | + ); |
|
46 | 46 | }); |
47 | 47 | $db_connections->setWrite('master', function () use ($config) { |
48 | - $connection = $config->database->master; |
|
49 | - return new Aura\Sql\ExtendedPdo( |
|
50 | - "mysql:host={$connection->host}", |
|
51 | - $connection->user, |
|
52 | - $connection->password |
|
53 | - ); |
|
48 | + $connection = $config->database->master; |
|
49 | + return new Aura\Sql\ExtendedPdo( |
|
50 | + "mysql:host={$connection->host}", |
|
51 | + $connection->user, |
|
52 | + $connection->password |
|
53 | + ); |
|
54 | 54 | }); |
55 | 55 | $db_connections->setRead('slave', function () use ($config) { |
56 | - $connection = $config->database->slave; |
|
57 | - $pdo = new Aura\Sql\ExtendedPdo( |
|
58 | - "mysql:host={$connection->host}", |
|
59 | - $connection->user, |
|
60 | - $connection->password |
|
61 | - ); |
|
62 | - |
|
63 | - $profiler = new Aura\Sql\Profiler(); |
|
64 | - $profiler->setActive(true); |
|
65 | - $pdo->setProfiler($profiler); |
|
66 | - |
|
67 | - return $pdo; |
|
56 | + $connection = $config->database->slave; |
|
57 | + $pdo = new Aura\Sql\ExtendedPdo( |
|
58 | + "mysql:host={$connection->host}", |
|
59 | + $connection->user, |
|
60 | + $connection->password |
|
61 | + ); |
|
62 | + |
|
63 | + $profiler = new Aura\Sql\Profiler(); |
|
64 | + $profiler->setActive(true); |
|
65 | + $pdo->setProfiler($profiler); |
|
66 | + |
|
67 | + return $pdo; |
|
68 | 68 | }); |
69 | 69 | $container['db_connection_locator'] = $db_connections; |
70 | 70 | |
71 | 71 | |
72 | 72 | // setup mail handler |
73 | 73 | $container['mail'] = $container->factory(function ($c) { |
74 | - return (new Jacobemerick\Archangel\Archangel())->setLogger($c['logger']); |
|
74 | + return (new Jacobemerick\Archangel\Archangel())->setLogger($c['logger']); |
|
75 | 75 | }); |
76 | 76 | |
77 | 77 | |
78 | 78 | // setup the logger |
79 | 79 | $container['setup_logger'] = $container->protect(function ($name) use ($container) { |
80 | - $logger = new Monolog\Logger($name); |
|
80 | + $logger = new Monolog\Logger($name); |
|
81 | 81 | |
82 | - $logPath = __DIR__ . "/../logs/{$name}.log"; |
|
83 | - $streamHandler = new Monolog\Handler\StreamHandler($logPath, Monolog\Logger::INFO); |
|
84 | - $streamHandler->setFormatter( |
|
85 | - new Monolog\Formatter\LineFormatter("[%datetime%] %channel%.%level_name%: %message%\n") |
|
86 | - ); |
|
87 | - $logger->pushHandler($streamHandler); |
|
82 | + $logPath = __DIR__ . "/../logs/{$name}.log"; |
|
83 | + $streamHandler = new Monolog\Handler\StreamHandler($logPath, Monolog\Logger::INFO); |
|
84 | + $streamHandler->setFormatter( |
|
85 | + new Monolog\Formatter\LineFormatter("[%datetime%] %channel%.%level_name%: %message%\n") |
|
86 | + ); |
|
87 | + $logger->pushHandler($streamHandler); |
|
88 | 88 | |
89 | - Monolog\ErrorHandler::register($logger); |
|
90 | - $container['logger'] = $logger; |
|
89 | + Monolog\ErrorHandler::register($logger); |
|
90 | + $container['logger'] = $logger; |
|
91 | 91 | }); |
92 | 92 | |
93 | 93 | |
@@ -108,30 +108,30 @@ discard block |
||
108 | 108 | |
109 | 109 | // sets up shutdown function to display profiler |
110 | 110 | register_shutdown_function(function () use ($container) { |
111 | - if ( |
|
112 | - !isset($_COOKIE['debugger']) || |
|
113 | - $_COOKIE['debugger'] != 'display' |
|
114 | - ) { |
|
115 | - return; |
|
116 | - } |
|
117 | - |
|
118 | - $dbProfiles = $container['db_connection_locator'] |
|
119 | - ->getRead() |
|
120 | - ->getProfiler() |
|
121 | - ->getProfiles(); |
|
122 | - $dbProfiles = array_filter($dbProfiles, function ($profile) { |
|
123 | - return $profile['function'] == 'perform'; |
|
124 | - }); |
|
125 | - $dbProfiles = array_map(function ($profile) { |
|
126 | - return [ |
|
127 | - 'sql' => trim(preg_replace('/\s+/', ' ', $profile['statement'])), |
|
128 | - 'parameters' => $profile['bind_values'], |
|
129 | - 'time' => $profile['duration'], |
|
130 | - ]; |
|
131 | - }, $dbProfiles); |
|
132 | - $container['profiler']->setProfiledQueries($dbProfiles); |
|
133 | - $container['profiler']->setDisplay(new Particletree\Pqp\Display()); |
|
134 | - $container['profiler']->display($container['db_connection_locator']->getRead()); |
|
111 | + if ( |
|
112 | + !isset($_COOKIE['debugger']) || |
|
113 | + $_COOKIE['debugger'] != 'display' |
|
114 | + ) { |
|
115 | + return; |
|
116 | + } |
|
117 | + |
|
118 | + $dbProfiles = $container['db_connection_locator'] |
|
119 | + ->getRead() |
|
120 | + ->getProfiler() |
|
121 | + ->getProfiles(); |
|
122 | + $dbProfiles = array_filter($dbProfiles, function ($profile) { |
|
123 | + return $profile['function'] == 'perform'; |
|
124 | + }); |
|
125 | + $dbProfiles = array_map(function ($profile) { |
|
126 | + return [ |
|
127 | + 'sql' => trim(preg_replace('/\s+/', ' ', $profile['statement'])), |
|
128 | + 'parameters' => $profile['bind_values'], |
|
129 | + 'time' => $profile['duration'], |
|
130 | + ]; |
|
131 | + }, $dbProfiles); |
|
132 | + $container['profiler']->setProfiledQueries($dbProfiles); |
|
133 | + $container['profiler']->setDisplay(new Particletree\Pqp\Display()); |
|
134 | + $container['profiler']->display($container['db_connection_locator']->getRead()); |
|
135 | 135 | }); |
136 | 136 | |
137 | 137 | $container['console']->logMemory(null, 'PHP - Post-boostrap memory'); |
@@ -24,21 +24,21 @@ |
||
24 | 24 | |
25 | 25 | self::$array['host'] = $host; |
26 | 26 | |
27 | - if ( |
|
28 | - $host == 'www.waterfallsofthekeweenaw.com' || |
|
29 | - $host == 'waterfallsofthekeweenaw.com' |
|
30 | - ) { |
|
27 | + if ( |
|
28 | + $host == 'www.waterfallsofthekeweenaw.com' || |
|
29 | + $host == 'waterfallsofthekeweenaw.com' |
|
30 | + ) { |
|
31 | 31 | self::$array['site'] = 'waterfalls'; |
32 | 32 | } else { |
33 | 33 | self::$array['site'] = substr($host, 0, strpos($host, '.')); |
34 | 34 | } |
35 | 35 | |
36 | - $base = ''; |
|
37 | - $base .= (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') ? 'https' : 'http'; |
|
38 | - $base .= '://'; |
|
39 | - $base .= (!Loader::isLive()) ? 'dev.' : ''; |
|
40 | - $base .= $host; |
|
41 | - $base .= '/'; |
|
36 | + $base = ''; |
|
37 | + $base .= (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') ? 'https' : 'http'; |
|
38 | + $base .= '://'; |
|
39 | + $base .= (!Loader::isLive()) ? 'dev.' : ''; |
|
40 | + $base .= $host; |
|
41 | + $base .= '/'; |
|
42 | 42 | |
43 | 43 | self::$array['base'] = $base; |
44 | 44 | self::$array['uri'] = '/' . implode('/', $uri_array); |
@@ -5,92 +5,92 @@ |
||
5 | 5 | class ContactController extends DefaultPageController |
6 | 6 | { |
7 | 7 | |
8 | - protected function set_head_data() |
|
9 | - { |
|
10 | - $this->set_title("Contact Page | Jacob Emerick's Portfolio"); |
|
11 | - $this->set_description("Contact page for Jacob Emerick's Portfolio"); |
|
12 | - $this->set_keywords([ |
|
13 | - 'portfolio', |
|
14 | - 'programming portfolio', |
|
15 | - 'contact', |
|
16 | - 'Jacob Emerick', |
|
17 | - 'information', |
|
18 | - 'freelance', |
|
19 | - ]); |
|
20 | - } |
|
8 | + protected function set_head_data() |
|
9 | + { |
|
10 | + $this->set_title("Contact Page | Jacob Emerick's Portfolio"); |
|
11 | + $this->set_description("Contact page for Jacob Emerick's Portfolio"); |
|
12 | + $this->set_keywords([ |
|
13 | + 'portfolio', |
|
14 | + 'programming portfolio', |
|
15 | + 'contact', |
|
16 | + 'Jacob Emerick', |
|
17 | + 'information', |
|
18 | + 'freelance', |
|
19 | + ]); |
|
20 | + } |
|
21 | 21 | |
22 | - protected function set_body_data() |
|
23 | - { |
|
24 | - $this->set_body('body_view', 'Contact'); |
|
22 | + protected function set_body_data() |
|
23 | + { |
|
24 | + $this->set_body('body_view', 'Contact'); |
|
25 | 25 | |
26 | - $body_data = []; |
|
27 | - if (!empty($_POST)) { |
|
28 | - $body_data = $this->process_form_data(); |
|
29 | - } |
|
30 | - $body_data['domain_container'] = $this->get_domain_container(); |
|
31 | - $this->set_body('body_data', $body_data); |
|
26 | + $body_data = []; |
|
27 | + if (!empty($_POST)) { |
|
28 | + $body_data = $this->process_form_data(); |
|
29 | + } |
|
30 | + $body_data['domain_container'] = $this->get_domain_container(); |
|
31 | + $this->set_body('body_data', $body_data); |
|
32 | 32 | |
33 | - parent::set_body_data(); |
|
34 | - } |
|
33 | + parent::set_body_data(); |
|
34 | + } |
|
35 | 35 | |
36 | - private function process_form_data() |
|
37 | - { |
|
38 | - $errors = []; |
|
36 | + private function process_form_data() |
|
37 | + { |
|
38 | + $errors = []; |
|
39 | 39 | |
40 | - if ( |
|
41 | - empty($_POST['name']) || |
|
42 | - !is_string($_POST['name']) || |
|
43 | - strlen($_POST['name']) > 100 |
|
44 | - ) { |
|
45 | - $errors['name'] = 'Please enter a valid name.'; |
|
46 | - } |
|
40 | + if ( |
|
41 | + empty($_POST['name']) || |
|
42 | + !is_string($_POST['name']) || |
|
43 | + strlen($_POST['name']) > 100 |
|
44 | + ) { |
|
45 | + $errors['name'] = 'Please enter a valid name.'; |
|
46 | + } |
|
47 | 47 | |
48 | - if (!filter_var($_POST['email'], FILTER_VALIDATE_EMAIL)) { |
|
49 | - $errors['email'] = 'Please enter a valid email.'; |
|
50 | - } |
|
48 | + if (!filter_var($_POST['email'], FILTER_VALIDATE_EMAIL)) { |
|
49 | + $errors['email'] = 'Please enter a valid email.'; |
|
50 | + } |
|
51 | 51 | |
52 | - if ( |
|
53 | - empty($_POST['message']) || |
|
54 | - !is_string($_POST['message']) || |
|
55 | - strlen($_POST['message']) > 10000 |
|
56 | - ) { |
|
57 | - $errors['message'] = 'Please enter a valid message.'; |
|
58 | - } |
|
52 | + if ( |
|
53 | + empty($_POST['message']) || |
|
54 | + !is_string($_POST['message']) || |
|
55 | + strlen($_POST['message']) > 10000 |
|
56 | + ) { |
|
57 | + $errors['message'] = 'Please enter a valid message.'; |
|
58 | + } |
|
59 | 59 | |
60 | - if (!empty($errors)) { |
|
61 | - $values = $_POST; |
|
62 | - $values = array_intersect_key($values, array_flip([ |
|
63 | - 'name', |
|
64 | - 'email', |
|
65 | - 'message', |
|
66 | - ])); |
|
60 | + if (!empty($errors)) { |
|
61 | + $values = $_POST; |
|
62 | + $values = array_intersect_key($values, array_flip([ |
|
63 | + 'name', |
|
64 | + 'email', |
|
65 | + 'message', |
|
66 | + ])); |
|
67 | 67 | |
68 | - return [ |
|
69 | - 'errors' => $errors, |
|
70 | - 'values' => $values, |
|
71 | - ]; |
|
72 | - } |
|
68 | + return [ |
|
69 | + 'errors' => $errors, |
|
70 | + 'values' => $values, |
|
71 | + ]; |
|
72 | + } |
|
73 | 73 | |
74 | - $message = [ |
|
75 | - "Name: {$_POST['name']}", |
|
76 | - "Email: {$_POST['email']}", |
|
77 | - '', |
|
78 | - 'Message:', |
|
79 | - $_POST['message'], |
|
80 | - ]; |
|
81 | - $message = implode("\n", $message); |
|
74 | + $message = [ |
|
75 | + "Name: {$_POST['name']}", |
|
76 | + "Email: {$_POST['email']}", |
|
77 | + '', |
|
78 | + 'Message:', |
|
79 | + $_POST['message'], |
|
80 | + ]; |
|
81 | + $message = implode("\n", $message); |
|
82 | 82 | |
83 | - global $container; |
|
84 | - $container['mail'] |
|
85 | - ->addTo($container['config']->admin_email) |
|
86 | - ->setSubject('Portfolio Contact') |
|
87 | - ->setPlainMessage($message) |
|
88 | - ->send(); |
|
83 | + global $container; |
|
84 | + $container['mail'] |
|
85 | + ->addTo($container['config']->admin_email) |
|
86 | + ->setSubject('Portfolio Contact') |
|
87 | + ->setPlainMessage($message) |
|
88 | + ->send(); |
|
89 | 89 | |
90 | - return [ |
|
91 | - 'success' => |
|
92 | - "Thank you for your message, {$_POST['name']}! " . |
|
93 | - "I'll get back to you as soon as possible." |
|
94 | - ]; |
|
95 | - } |
|
90 | + return [ |
|
91 | + 'success' => |
|
92 | + "Thank you for your message, {$_POST['name']}! " . |
|
93 | + "I'll get back to you as soon as possible." |
|
94 | + ]; |
|
95 | + } |
|
96 | 96 | } |
@@ -5,56 +5,56 @@ |
||
5 | 5 | class PortfolioRouter extends Router |
6 | 6 | { |
7 | 7 | |
8 | - protected function get_redirect_array() |
|
9 | - { |
|
10 | - $paths = [ |
|
11 | - [ |
|
12 | - 'pattern' => '@/index.(html|htm|php)$@', |
|
13 | - 'replace' => '/', |
|
14 | - ], |
|
15 | - [ |
|
16 | - 'pattern' => '@^/print(/?)$@', |
|
17 | - 'replace' => '/projects/', |
|
18 | - ], |
|
19 | - [ |
|
20 | - 'pattern' => '@^/web(/?)$@', |
|
21 | - 'replace' => '/projects/', |
|
22 | - ], |
|
23 | - [ |
|
24 | - 'pattern' => '@^/(web|print)/([a-z0-9-]+)(/?)$@', |
|
25 | - 'replace' => '/projects/', |
|
26 | - ], |
|
27 | - ]; |
|
8 | + protected function get_redirect_array() |
|
9 | + { |
|
10 | + $paths = [ |
|
11 | + [ |
|
12 | + 'pattern' => '@/index.(html|htm|php)$@', |
|
13 | + 'replace' => '/', |
|
14 | + ], |
|
15 | + [ |
|
16 | + 'pattern' => '@^/print(/?)$@', |
|
17 | + 'replace' => '/projects/', |
|
18 | + ], |
|
19 | + [ |
|
20 | + 'pattern' => '@^/web(/?)$@', |
|
21 | + 'replace' => '/projects/', |
|
22 | + ], |
|
23 | + [ |
|
24 | + 'pattern' => '@^/(web|print)/([a-z0-9-]+)(/?)$@', |
|
25 | + 'replace' => '/projects/', |
|
26 | + ], |
|
27 | + ]; |
|
28 | 28 | |
29 | - return array_map(function ($row) { |
|
30 | - return (object) $row; |
|
31 | - }, $paths); |
|
32 | - } |
|
29 | + return array_map(function ($row) { |
|
30 | + return (object) $row; |
|
31 | + }, $paths); |
|
32 | + } |
|
33 | 33 | |
34 | - protected function get_direct_array() |
|
35 | - { |
|
36 | - $paths = [ |
|
37 | - [ |
|
38 | - 'match' => '/', |
|
39 | - 'controller' => 'AboutController', |
|
40 | - ], |
|
41 | - [ |
|
42 | - 'match' => '/contact/', |
|
43 | - 'controller' => 'ContactController', |
|
44 | - ], |
|
45 | - [ |
|
46 | - 'match' => '/projects/', |
|
47 | - 'controller' => 'ProjectsController', |
|
48 | - ], |
|
49 | - [ |
|
50 | - 'match' => '/resume/', |
|
51 | - 'controller' => 'ResumeController', |
|
52 | - ], |
|
53 | - ]; |
|
34 | + protected function get_direct_array() |
|
35 | + { |
|
36 | + $paths = [ |
|
37 | + [ |
|
38 | + 'match' => '/', |
|
39 | + 'controller' => 'AboutController', |
|
40 | + ], |
|
41 | + [ |
|
42 | + 'match' => '/contact/', |
|
43 | + 'controller' => 'ContactController', |
|
44 | + ], |
|
45 | + [ |
|
46 | + 'match' => '/projects/', |
|
47 | + 'controller' => 'ProjectsController', |
|
48 | + ], |
|
49 | + [ |
|
50 | + 'match' => '/resume/', |
|
51 | + 'controller' => 'ResumeController', |
|
52 | + ], |
|
53 | + ]; |
|
54 | 54 | |
55 | - return array_map(function ($row) { |
|
56 | - return (object) $row; |
|
57 | - }, $paths); |
|
58 | - } |
|
55 | + return array_map(function ($row) { |
|
56 | + return (object) $row; |
|
57 | + }, $paths); |
|
58 | + } |
|
59 | 59 | |
60 | 60 | } |
@@ -5,26 +5,26 @@ |
||
5 | 5 | class AboutController extends DefaultPageController |
6 | 6 | { |
7 | 7 | |
8 | - protected function set_head_data() |
|
9 | - { |
|
10 | - $this->set_title("Jacob Emerick's Portfolio"); |
|
11 | - $this->set_description("Jacob Emerick's Portfolio - collection of programming projects and resume"); |
|
12 | - $this->set_keywords([ |
|
13 | - 'portfolio', |
|
14 | - 'Jacob Emerick', |
|
15 | - 'web development', |
|
16 | - 'web programming', |
|
17 | - 'software development', |
|
18 | - 'agile', |
|
19 | - 'freelance', |
|
20 | - ]); |
|
21 | - } |
|
8 | + protected function set_head_data() |
|
9 | + { |
|
10 | + $this->set_title("Jacob Emerick's Portfolio"); |
|
11 | + $this->set_description("Jacob Emerick's Portfolio - collection of programming projects and resume"); |
|
12 | + $this->set_keywords([ |
|
13 | + 'portfolio', |
|
14 | + 'Jacob Emerick', |
|
15 | + 'web development', |
|
16 | + 'web programming', |
|
17 | + 'software development', |
|
18 | + 'agile', |
|
19 | + 'freelance', |
|
20 | + ]); |
|
21 | + } |
|
22 | 22 | |
23 | - protected function set_body_data() |
|
24 | - { |
|
25 | - $this->set_body('body_view', 'About'); |
|
26 | - $this->set_body('body_data', []); |
|
23 | + protected function set_body_data() |
|
24 | + { |
|
25 | + $this->set_body('body_view', 'About'); |
|
26 | + $this->set_body('body_data', []); |
|
27 | 27 | |
28 | - parent::set_body_data(); |
|
29 | - } |
|
28 | + parent::set_body_data(); |
|
29 | + } |
|
30 | 30 | } |
@@ -5,31 +5,31 @@ |
||
5 | 5 | class ResumeController extends DefaultPageController |
6 | 6 | { |
7 | 7 | |
8 | - protected $resume = 'resume-20160318.json'; |
|
8 | + protected $resume = 'resume-20160318.json'; |
|
9 | 9 | |
10 | - protected function set_head_data() |
|
11 | - { |
|
12 | - $this->set_title("Resume | Jacob Emerick's Portfolio"); |
|
13 | - $this->set_description("Resume for Jacob Emerick, a software engineer extraordinaire"); |
|
14 | - $this->set_keywords([ |
|
15 | - 'resume', |
|
16 | - 'programming resume', |
|
17 | - 'Jacob Emerick', |
|
18 | - 'software engineer', |
|
19 | - 'portfolio', |
|
20 | - 'shutterstock', |
|
21 | - ]); |
|
22 | - } |
|
10 | + protected function set_head_data() |
|
11 | + { |
|
12 | + $this->set_title("Resume | Jacob Emerick's Portfolio"); |
|
13 | + $this->set_description("Resume for Jacob Emerick, a software engineer extraordinaire"); |
|
14 | + $this->set_keywords([ |
|
15 | + 'resume', |
|
16 | + 'programming resume', |
|
17 | + 'Jacob Emerick', |
|
18 | + 'software engineer', |
|
19 | + 'portfolio', |
|
20 | + 'shutterstock', |
|
21 | + ]); |
|
22 | + } |
|
23 | 23 | |
24 | - protected function set_body_data() |
|
25 | - { |
|
26 | - $this->set_body('body_view', 'Resume'); |
|
24 | + protected function set_body_data() |
|
25 | + { |
|
26 | + $this->set_body('body_view', 'Resume'); |
|
27 | 27 | |
28 | - $resumePath = Loader::getRootURL('portfolio') . "/jsonresume/{$this->resume}"; |
|
29 | - $resume = file_get_contents($resumePath); |
|
30 | - $resume = json_decode($resume, true); |
|
31 | - $this->set_body('body_data', $resume); |
|
28 | + $resumePath = Loader::getRootURL('portfolio') . "/jsonresume/{$this->resume}"; |
|
29 | + $resume = file_get_contents($resumePath); |
|
30 | + $resume = json_decode($resume, true); |
|
31 | + $this->set_body('body_data', $resume); |
|
32 | 32 | |
33 | - parent::set_body_data(); |
|
34 | - } |
|
33 | + parent::set_body_data(); |
|
34 | + } |
|
35 | 35 | } |
@@ -5,25 +5,25 @@ |
||
5 | 5 | class ProjectsController extends DefaultPageController |
6 | 6 | { |
7 | 7 | |
8 | - protected function set_head_data() |
|
9 | - { |
|
10 | - $this->set_title("Projects Page | Jacob Emerick's Portfolio"); |
|
11 | - $this->set_description("Collection of key open-source projects that Jacob has developed and maintained over the years."); |
|
12 | - $this->set_keywords([ |
|
13 | - 'projects', |
|
14 | - 'open source', |
|
15 | - 'example work', |
|
16 | - 'portfolio', |
|
17 | - 'Jacob Emerick', |
|
18 | - 'software development', |
|
19 | - ]); |
|
20 | - } |
|
8 | + protected function set_head_data() |
|
9 | + { |
|
10 | + $this->set_title("Projects Page | Jacob Emerick's Portfolio"); |
|
11 | + $this->set_description("Collection of key open-source projects that Jacob has developed and maintained over the years."); |
|
12 | + $this->set_keywords([ |
|
13 | + 'projects', |
|
14 | + 'open source', |
|
15 | + 'example work', |
|
16 | + 'portfolio', |
|
17 | + 'Jacob Emerick', |
|
18 | + 'software development', |
|
19 | + ]); |
|
20 | + } |
|
21 | 21 | |
22 | - protected function set_body_data() |
|
23 | - { |
|
24 | - $this->set_body('body_view', 'Projects'); |
|
25 | - $this->set_body('body_data', []); |
|
22 | + protected function set_body_data() |
|
23 | + { |
|
24 | + $this->set_body('body_view', 'Projects'); |
|
25 | + $this->set_body('body_data', []); |
|
26 | 26 | |
27 | - parent::set_body_data(); |
|
28 | - } |
|
27 | + parent::set_body_data(); |
|
28 | + } |
|
29 | 29 | } |
@@ -5,56 +5,56 @@ |
||
5 | 5 | abstract class DefaultPageController extends PageController |
6 | 6 | { |
7 | 7 | |
8 | - public function __construct() |
|
9 | - { |
|
10 | - parent::__construct(); |
|
11 | - |
|
12 | - $this->add_css('reset'); |
|
13 | - $this->add_css('portfolio', 3); |
|
14 | - } |
|
15 | - |
|
16 | - protected function set_body_data() |
|
17 | - { |
|
18 | - $this->set_body('header_data', [ |
|
19 | - 'menu' => $this->get_menu(), |
|
20 | - 'home_link' => Loader::getRootURL(), |
|
21 | - ]); |
|
22 | - $this->set_body('activity_array', $this->get_recent_activity()); |
|
23 | - |
|
24 | - $this->set_body_view('Page'); |
|
25 | - } |
|
26 | - |
|
27 | - protected function get_menu() |
|
28 | - { |
|
29 | - $menu = [ |
|
30 | - [ |
|
31 | - 'name' => 'About', |
|
32 | - 'link' => Loader::getRootURL(), |
|
33 | - ], |
|
34 | - [ |
|
35 | - 'name' => 'Projects', |
|
36 | - 'link' => Loader::getRootURL() . 'projects/', |
|
37 | - ], |
|
38 | - [ |
|
39 | - 'name' => 'Résumé', |
|
40 | - 'link' => Loader::getRootURL() . 'resume/', |
|
41 | - ], |
|
42 | - [ |
|
43 | - 'name' => 'Contact', |
|
44 | - 'link' => Loader::getRootURL() . 'contact/', |
|
45 | - ], |
|
46 | - ]; |
|
47 | - |
|
48 | - if (!URLDecode::getPiece(1)) { |
|
49 | - $active_page = 'About'; |
|
50 | - } else { |
|
51 | - $active_page = ucfirst(URLDecode::getPiece(1)); |
|
52 | - } |
|
53 | - |
|
54 | - return array_map(function ($row) use ($active_page) { |
|
55 | - $row = (object) $row; |
|
56 | - $row->active = ($row->name == $active_page); |
|
57 | - return $row; |
|
58 | - }, $menu); |
|
59 | - } |
|
8 | + public function __construct() |
|
9 | + { |
|
10 | + parent::__construct(); |
|
11 | + |
|
12 | + $this->add_css('reset'); |
|
13 | + $this->add_css('portfolio', 3); |
|
14 | + } |
|
15 | + |
|
16 | + protected function set_body_data() |
|
17 | + { |
|
18 | + $this->set_body('header_data', [ |
|
19 | + 'menu' => $this->get_menu(), |
|
20 | + 'home_link' => Loader::getRootURL(), |
|
21 | + ]); |
|
22 | + $this->set_body('activity_array', $this->get_recent_activity()); |
|
23 | + |
|
24 | + $this->set_body_view('Page'); |
|
25 | + } |
|
26 | + |
|
27 | + protected function get_menu() |
|
28 | + { |
|
29 | + $menu = [ |
|
30 | + [ |
|
31 | + 'name' => 'About', |
|
32 | + 'link' => Loader::getRootURL(), |
|
33 | + ], |
|
34 | + [ |
|
35 | + 'name' => 'Projects', |
|
36 | + 'link' => Loader::getRootURL() . 'projects/', |
|
37 | + ], |
|
38 | + [ |
|
39 | + 'name' => 'Résumé', |
|
40 | + 'link' => Loader::getRootURL() . 'resume/', |
|
41 | + ], |
|
42 | + [ |
|
43 | + 'name' => 'Contact', |
|
44 | + 'link' => Loader::getRootURL() . 'contact/', |
|
45 | + ], |
|
46 | + ]; |
|
47 | + |
|
48 | + if (!URLDecode::getPiece(1)) { |
|
49 | + $active_page = 'About'; |
|
50 | + } else { |
|
51 | + $active_page = ucfirst(URLDecode::getPiece(1)); |
|
52 | + } |
|
53 | + |
|
54 | + return array_map(function ($row) use ($active_page) { |
|
55 | + $row = (object) $row; |
|
56 | + $row->active = ($row->name == $active_page); |
|
57 | + return $row; |
|
58 | + }, $menu); |
|
59 | + } |
|
60 | 60 | } |