@@ -1,7 +1,7 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | $namespace = 'portfolio'; |
4 | -require_once __DIR__ . '/../../bootstrap.php'; |
|
4 | +require_once __DIR__.'/../../bootstrap.php'; |
|
5 | 5 | |
6 | 6 | // route |
7 | 7 | Loader::loadInstance('router', 'Router'); |
@@ -1,7 +1,7 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | $namespace = 'portfolio'; |
4 | -require_once __DIR__ . '/../../bootstrap.php'; |
|
4 | +require_once __DIR__.'/../../bootstrap.php'; |
|
5 | 5 | |
6 | 6 | // route |
7 | 7 | Loader::loadInstance('router', 'Router'); |
@@ -1,7 +1,7 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | $namespace = 'portfolio'; |
4 | -require_once __DIR__ . '/../../bootstrap.php'; |
|
4 | +require_once __DIR__.'/../../bootstrap.php'; |
|
5 | 5 | |
6 | 6 | // route |
7 | 7 | Loader::loadInstance('router', 'Router'); |
@@ -1,7 +1,7 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | $namespace = 'portfolio'; |
4 | -require_once __DIR__ . '/../../bootstrap.php'; |
|
4 | +require_once __DIR__.'/../../bootstrap.php'; |
|
5 | 5 | |
6 | 6 | // route |
7 | 7 | Loader::loadInstance('router', 'Router'); |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | Loader::load('collector', 'image/PhotoCollector'); |
42 | 42 | $photo_result = PhotoCollector::getRow($id); |
43 | 43 | |
44 | - if($photo_result == null) |
|
44 | + if ($photo_result == null) |
|
45 | 45 | return; |
46 | 46 | |
47 | 47 | $name = $photo_result->name; |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | $tag_result = $repository->getTagsForPost($post['id']); |
93 | 93 | |
94 | 94 | $tag_array = array(); |
95 | - foreach($tag_result as $tag) |
|
95 | + foreach ($tag_result as $tag) |
|
96 | 96 | { |
97 | 97 | $tag_object = new stdclass(); |
98 | 98 | $tag_object->name = $tag['tag']; |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | { |
107 | 107 | $body = $post['body']; |
108 | 108 | |
109 | - if($trim) |
|
109 | + if ($trim) |
|
110 | 110 | $body = Content::instance('SmartTrim', $body)->activate(self::$LENGTH_OF_TRIMMED_POST); |
111 | 111 | |
112 | 112 | $body = Content::instance('FixPhoto', $body)->activate(false, 'standard'); |
@@ -132,9 +132,9 @@ discard block |
||
132 | 132 | $maximum_tag_count = $this->get_maximum_tag_count($tag_result); |
133 | 133 | |
134 | 134 | $cloud_array = array(); |
135 | - foreach($tag_result as $tag) |
|
135 | + foreach ($tag_result as $tag) |
|
136 | 136 | { |
137 | - if($tag['count'] < self::$MINIMUM_TAG_COUNT) |
|
137 | + if ($tag['count'] < self::$MINIMUM_TAG_COUNT) |
|
138 | 138 | continue; |
139 | 139 | |
140 | 140 | $tag_object = new stdclass(); |
@@ -151,9 +151,9 @@ discard block |
||
151 | 151 | { |
152 | 152 | $maximum = 1; |
153 | 153 | |
154 | - foreach($tag_result as $tag) |
|
154 | + foreach ($tag_result as $tag) |
|
155 | 155 | { |
156 | - if($tag['count'] > $maximum) |
|
156 | + if ($tag['count'] > $maximum) |
|
157 | 157 | $maximum = $tag['count']; |
158 | 158 | } |
159 | 159 | return $maximum; |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | $comment_array = CommentCollector::getRecentBlogComments(self::$RECENT_COMMENT_COUNT); |
165 | 165 | |
166 | 166 | $array = array(); |
167 | - foreach($comment_array as $comment) |
|
167 | + foreach ($comment_array as $comment) |
|
168 | 168 | { |
169 | 169 | $body = $comment->body; |
170 | 170 | $body = strip_tags($body); |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | $comment_obj = new stdclass(); |
173 | 173 | $comment_obj->description = Content::instance('SmartTrim', $body)->activate(30); |
174 | 174 | $comment_obj->commenter = $comment->name; |
175 | - $comment_obj->link = Loader::getRootURL() . "{$comment->category}/{$comment->path}/#comment-{$comment->id}"; |
|
175 | + $comment_obj->link = Loader::getRootURL()."{$comment->category}/{$comment->path}/#comment-{$comment->id}"; |
|
176 | 176 | $array[] = $comment_obj; |
177 | 177 | } |
178 | 178 | |
@@ -201,7 +201,7 @@ discard block |
||
201 | 201 | $comment_response = $api->getComments(1, self::$RECENT_COMMENT_COUNT, '-date', 'blog.jacobemerick.com'); |
202 | 202 | |
203 | 203 | $array = array(); |
204 | - foreach($comment_response as $comment) |
|
204 | + foreach ($comment_response as $comment) |
|
205 | 205 | { |
206 | 206 | $body = $comment->getBody(); |
207 | 207 | $body = strip_tags($body); |
@@ -5,13 +5,13 @@ discard block |
||
5 | 5 | ini_set('display_errors', 0); |
6 | 6 | |
7 | 7 | |
8 | -require_once __DIR__ . '/vendor/autoload.php'; |
|
8 | +require_once __DIR__.'/vendor/autoload.php'; |
|
9 | 9 | |
10 | 10 | $container = new Pimple\Container(); |
11 | 11 | |
12 | 12 | |
13 | 13 | // load the config for the application |
14 | -$config_path = __DIR__ . '/config.json'; |
|
14 | +$config_path = __DIR__.'/config.json'; |
|
15 | 15 | |
16 | 16 | $handle = @fopen($config_path, 'r'); |
17 | 17 | if ($handle === false) { |
@@ -29,14 +29,14 @@ discard block |
||
29 | 29 | |
30 | 30 | // timezones are fun |
31 | 31 | date_default_timezone_set('America/Phoenix'); // todo - belongs in configuration |
32 | -$container['default_timezone'] = function ($c) { |
|
32 | +$container['default_timezone'] = function($c) { |
|
33 | 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 | -$db_connections->setDefault(function () use ($config) { |
|
39 | +$db_connections->setDefault(function() use ($config) { |
|
40 | 40 | $connection = $config->database->slave; |
41 | 41 | return new Aura\Sql\ExtendedPdo( |
42 | 42 | "mysql:host={$connection->host}", |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | $connection->password |
45 | 45 | ); |
46 | 46 | }); |
47 | -$db_connections->setWrite('master', function () use ($config) { |
|
47 | +$db_connections->setWrite('master', function() use ($config) { |
|
48 | 48 | $connection = $config->database->master; |
49 | 49 | return new Aura\Sql\ExtendedPdo( |
50 | 50 | "mysql:host={$connection->host}", |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | $connection->password |
53 | 53 | ); |
54 | 54 | }); |
55 | -$db_connections->setRead('slave', function () use ($config) { |
|
55 | +$db_connections->setRead('slave', function() use ($config) { |
|
56 | 56 | $connection = $config->database->slave; |
57 | 57 | $pdo = new Aura\Sql\ExtendedPdo( |
58 | 58 | "mysql:host={$connection->host}", |
@@ -70,16 +70,16 @@ discard block |
||
70 | 70 | |
71 | 71 | |
72 | 72 | // setup mail handler |
73 | -$container['mail'] = $container->factory(function ($c) { |
|
73 | +$container['mail'] = $container->factory(function($c) { |
|
74 | 74 | return (new Jacobemerick\Archangel\Archangel())->setLogger($c['logger']); |
75 | 75 | }); |
76 | 76 | |
77 | 77 | |
78 | 78 | // setup the logger |
79 | -$container['setup_logger'] = $container->protect(function ($name) use ($container) { |
|
79 | +$container['setup_logger'] = $container->protect(function($name) use ($container) { |
|
80 | 80 | $logger = new Monolog\Logger($name); |
81 | 81 | |
82 | - $logPath = __DIR__ . "/logs/{$name}.log"; |
|
82 | + $logPath = __DIR__."/logs/{$name}.log"; |
|
83 | 83 | $streamHandler = new Monolog\Handler\StreamHandler($logPath, Monolog\Logger::INFO); |
84 | 84 | $streamHandler->setFormatter( |
85 | 85 | new Monolog\Formatter\LineFormatter("[%datetime%] %channel%.%level_name%: %message%\n") |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | |
108 | 108 | |
109 | 109 | // sets up shutdown function to display profiler |
110 | -register_shutdown_function(function () use ($container) { |
|
110 | +register_shutdown_function(function() use ($container) { |
|
111 | 111 | if ( |
112 | 112 | !isset($_COOKIE['debugger']) || |
113 | 113 | $_COOKIE['debugger'] != 'display' |
@@ -119,10 +119,10 @@ discard block |
||
119 | 119 | ->getRead() |
120 | 120 | ->getProfiler() |
121 | 121 | ->getProfiles(); |
122 | - $dbProfiles = array_filter($dbProfiles, function ($profile) { |
|
122 | + $dbProfiles = array_filter($dbProfiles, function($profile) { |
|
123 | 123 | return $profile['function'] == 'perform'; |
124 | 124 | }); |
125 | - $dbProfiles = array_map(function ($profile) { |
|
125 | + $dbProfiles = array_map(function($profile) { |
|
126 | 126 | return [ |
127 | 127 | 'sql' => trim(preg_replace('/\s+/', ' ', $profile['statement'])), |
128 | 128 | 'parameters' => $profile['bind_values'], |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | $post_result = $activityRepository->getActivities(5); |
65 | 65 | |
66 | 66 | $post_array = array(); |
67 | - foreach($post_result as $row) { |
|
67 | + foreach ($post_result as $row) { |
|
68 | 68 | array_push($post_array, $this->expand_post($row)); |
69 | 69 | } |
70 | 70 | |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | ]; |
81 | 81 | |
82 | 82 | if ($format != 'short') { |
83 | - $post['url'] = Loader::getRootUrl('lifestream') . "{$raw_post['type']}/{$raw_post['id']}/"; |
|
83 | + $post['url'] = Loader::getRootUrl('lifestream')."{$raw_post['type']}/{$raw_post['id']}/"; |
|
84 | 84 | |
85 | 85 | $metadata = json_decode($raw_post['metadata'], true); |
86 | 86 | $post = array_merge($post, $metadata); |
@@ -100,12 +100,12 @@ discard block |
||
100 | 100 | $headers = $this->headers; |
101 | 101 | Header::$headers(); |
102 | 102 | Loader::load('view', '/Head', $this->data_array['head']); |
103 | - foreach($this->body_view_array as $view) |
|
103 | + foreach ($this->body_view_array as $view) |
|
104 | 104 | { |
105 | - if(substr($view, 0, 1) == '/') |
|
105 | + if (substr($view, 0, 1) == '/') |
|
106 | 106 | Loader::load('view', $view, $this->data_array['body']); |
107 | 107 | else |
108 | - Loader::load('view', URLDecode::getSite() . '/' . $view, $this->data_array['body']); |
|
108 | + Loader::load('view', URLDecode::getSite().'/'.$view, $this->data_array['body']); |
|
109 | 109 | } |
110 | 110 | |
111 | 111 | if (URLDecode::getSite() == 'waterfalls') { |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | Loader::load('view', '/Foot', array('tracking_code' => self::$TRACKING_CODE)); |
115 | 115 | } |
116 | 116 | |
117 | - if($view == '/404' || $view == '/503') |
|
117 | + if ($view == '/404' || $view == '/503') |
|
118 | 118 | exit; |
119 | 119 | } |
120 | 120 | |
@@ -170,14 +170,14 @@ discard block |
||
170 | 170 | |
171 | 171 | private function load_assets() |
172 | 172 | { |
173 | - $css_array = array_map(function ($stylesheet) { |
|
173 | + $css_array = array_map(function($stylesheet) { |
|
174 | 174 | $path = "/css/{$stylesheet[0]}.css"; |
175 | 175 | if ($stylesheet[1] > 1) { |
176 | 176 | $path .= "?v={$stylesheet[1]}"; |
177 | 177 | } |
178 | 178 | return $path; |
179 | 179 | }, $this->css_array); |
180 | - $js_array = array_map(function ($script) { |
|
180 | + $js_array = array_map(function($script) { |
|
181 | 181 | if (substr($script, 0, 4) == 'http') { |
182 | 182 | return $script; |
183 | 183 | } |
@@ -195,26 +195,26 @@ discard block |
||
195 | 195 | |
196 | 196 | protected function eject() |
197 | 197 | { |
198 | - if(get_class($this) !== 'Error404Controller') |
|
198 | + if (get_class($this) !== 'Error404Controller') |
|
199 | 199 | Loader::loadNew('controller', '/Error404Controller')->activate(); |
200 | 200 | } |
201 | 201 | |
202 | 202 | protected function unavailable() |
203 | 203 | { |
204 | - if(get_class($this) !== 'Error503Controller') |
|
204 | + if (get_class($this) !== 'Error503Controller') |
|
205 | 205 | Loader::loadNew('controller', '/Error503Controller')->activate(); |
206 | 206 | } |
207 | 207 | |
208 | 208 | protected function redirect($uri, $method = 301) |
209 | 209 | { |
210 | - switch($method) |
|
210 | + switch ($method) |
|
211 | 211 | { |
212 | 212 | case 301 : |
213 | - if(get_class($this) !== 'Error301Controller') |
|
213 | + if (get_class($this) !== 'Error301Controller') |
|
214 | 214 | Loader::loadNew('controller', '/Error301Controller', array($uri))->activate(); |
215 | 215 | break; |
216 | 216 | case 303 : |
217 | - if(get_class($this) !== 'Error303Controller') |
|
217 | + if (get_class($this) !== 'Error303Controller') |
|
218 | 218 | Loader::loadNew('controller', '/Error303Controller', array($uri))->activate(); |
219 | 219 | break; |
220 | 220 | } |
@@ -234,7 +234,7 @@ discard block |
||
234 | 234 | private $comment_errors; |
235 | 235 | protected function handle_comment_submit($site_id, $path, $redirect_url, $page_title) |
236 | 236 | { |
237 | - if(Request::hasPost() && Request::getPost('submit') == 'Submit Comment') |
|
237 | + if (Request::hasPost() && Request::getPost('submit') == 'Submit Comment') |
|
238 | 238 | { |
239 | 239 | $parameters = array($site_id, $path, $redirect_url, $page_title); |
240 | 240 | $this->comment_errors = Loader::loadNew('module', 'form/CommentSubmitModule', $parameters)->activate(); |
@@ -252,7 +252,7 @@ discard block |
||
252 | 252 | $comment_array = array(); |
253 | 253 | $comment_result = CommentCollector::getCommentsForURL($site, $path, $commenter->id); |
254 | 254 | |
255 | - foreach($comment_result as $comment) |
|
255 | + foreach ($comment_result as $comment) |
|
256 | 256 | { |
257 | 257 | $comment_object = new stdclass(); |
258 | 258 | $comment_object->id = $comment->id; |
@@ -262,12 +262,12 @@ discard block |
||
262 | 262 | $comment_object->url = $comment->url; |
263 | 263 | $comment_object->trusted = $comment->trusted; |
264 | 264 | |
265 | - if($comment->reply == 0 && Request::getPost('type') == $comment->id) |
|
265 | + if ($comment->reply == 0 && Request::getPost('type') == $comment->id) |
|
266 | 266 | $comment_object->errors = $this->comment_errors; |
267 | 267 | else |
268 | 268 | $comment_object->errors = array(); |
269 | 269 | |
270 | - if($comment->reply == 0) |
|
270 | + if ($comment->reply == 0) |
|
271 | 271 | { |
272 | 272 | $comment_object->replies = array(); |
273 | 273 | $comment_array[$comment->id] = $comment_object; |
@@ -302,15 +302,15 @@ discard block |
||
302 | 302 | |
303 | 303 | $commenter_cookie_value = json_decode($_COOKIE['commenter']); |
304 | 304 | |
305 | - if($commenter_cookie_value === NULL) |
|
305 | + if ($commenter_cookie_value === NULL) |
|
306 | 306 | return $commenter; |
307 | 307 | |
308 | - if(!isset($commenter_cookie_value->name) || !isset($commenter_cookie_value->email)) |
|
308 | + if (!isset($commenter_cookie_value->name) || !isset($commenter_cookie_value->email)) |
|
309 | 309 | return $commenter; |
310 | 310 | |
311 | 311 | $commenter_object = CommentCollector::getCommenterByFields($commenter_cookie_value->name, $commenter_cookie_value->email, (isset($commenter_cookie_value->website) ? $commenter_cookie_value->website : '')); |
312 | 312 | |
313 | - if($commenter_object === NULL) |
|
313 | + if ($commenter_object === NULL) |
|
314 | 314 | return $commenter; |
315 | 315 | |
316 | 316 | $commenter->id = $commenter_object->id; |
@@ -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 | } |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | $keyword_array = array(); |
97 | 97 | $keywords = $this->tags; |
98 | 98 | |
99 | - foreach($keywords as $keyword) |
|
99 | + foreach ($keywords as $keyword) |
|
100 | 100 | { |
101 | 101 | $keyword_array[] = $keyword['tag']; |
102 | 102 | } |
@@ -110,16 +110,16 @@ discard block |
||
110 | 110 | private function get_series_posts() |
111 | 111 | { |
112 | 112 | $series_posts = $this->fetch_series_posts(); |
113 | - if(count($series_posts) < 1) |
|
113 | + if (count($series_posts) < 1) |
|
114 | 114 | return array(); |
115 | 115 | |
116 | 116 | $previous_post = new stdclass(); |
117 | 117 | $next_post = new stdclass(); |
118 | 118 | |
119 | 119 | $found_current_post = false; |
120 | - foreach($series_posts as $post_row) |
|
120 | + foreach ($series_posts as $post_row) |
|
121 | 121 | { |
122 | - if($post_row['post'] == $this->post['id']) |
|
122 | + if ($post_row['post'] == $this->post['id']) |
|
123 | 123 | { |
124 | 124 | $found_current_post = true; |
125 | 125 | continue; |
@@ -148,9 +148,9 @@ discard block |
||
148 | 148 | $post->title = $post_row['title']; |
149 | 149 | } |
150 | 150 | |
151 | - $post->url = Loader::getRootUrl('blog') . "{$post_row['category']}/{$post_row['path']}/"; |
|
151 | + $post->url = Loader::getRootUrl('blog')."{$post_row['category']}/{$post_row['path']}/"; |
|
152 | 152 | |
153 | - if(!$found_current_post) |
|
153 | + if (!$found_current_post) |
|
154 | 154 | $previous_post = $post; |
155 | 155 | else |
156 | 156 | { |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | private $series_posts; |
170 | 170 | private function fetch_series_posts() |
171 | 171 | { |
172 | - if(!isset($this->series_posts)) { |
|
172 | + if (!isset($this->series_posts)) { |
|
173 | 173 | global $container; |
174 | 174 | $repository = new Jacobemerick\Web\Domain\Blog\Series\MysqlSeriesRepository($container['db_connection_locator']); |
175 | 175 | $this->series_posts = $repository->getSeriesForPost($this->post['id']); |
@@ -180,14 +180,14 @@ discard block |
||
180 | 180 | private function get_related_posts() |
181 | 181 | { |
182 | 182 | $tag_array = array(); |
183 | - foreach($this->tags as $tag) |
|
183 | + foreach ($this->tags as $tag) |
|
184 | 184 | { |
185 | 185 | $tag_array[] = $tag['id']; |
186 | 186 | } |
187 | 187 | |
188 | 188 | $series_posts = $this->fetch_series_posts(); |
189 | 189 | $exclude_post_array = array(); |
190 | - foreach($series_posts as $series_post) |
|
190 | + foreach ($series_posts as $series_post) |
|
191 | 191 | { |
192 | 192 | $exclude_post_array[] = $series_post['post']; |
193 | 193 | } |
@@ -198,11 +198,11 @@ discard block |
||
198 | 198 | |
199 | 199 | $post_array = array(); |
200 | 200 | |
201 | - foreach($post_result as $post_row) |
|
201 | + foreach ($post_result as $post_row) |
|
202 | 202 | { |
203 | 203 | $post = new stdclass(); |
204 | 204 | $post->title = $post_row['title']; |
205 | - $post->url = Loader::getRootUrl('blog') . "{$post_row['category']}/{$post_row['path']}/"; |
|
205 | + $post->url = Loader::getRootUrl('blog')."{$post_row['category']}/{$post_row['path']}/"; |
|
206 | 206 | $post->category = ucwords(str_replace('-', ' ', $post_row['category'])); |
207 | 207 | $post->thumb = Content::instance('FetchFirstPhoto', $post_row['body'])->activate(); |
208 | 208 | $post->body = Content::instance('SmartTrim', $post_row['body'])->activate(($post->thumb !== '') ? self::$POST_LENGTH_SHORT : self::$POST_LENGTH_LONG); |
@@ -246,7 +246,7 @@ discard block |
||
246 | 246 | $container['logger']->info("CommentService | Path | {$elapsed}"); |
247 | 247 | |
248 | 248 | $array = array(); |
249 | - foreach((array) $comment_response as $comment) |
|
249 | + foreach ((array) $comment_response as $comment) |
|
250 | 250 | { |
251 | 251 | $body = $comment->getBody(); |
252 | 252 | $body = Content::instance('CleanComment', $body)->activate(); |