@@ -25,7 +25,7 @@ |
||
| 25 | 25 | { |
| 26 | 26 | $this->set_body('body_view', 'Resume'); |
| 27 | 27 | |
| 28 | - $resumePath = Loader::getRootURL('portfolio') . "/jsonresume/{$this->resume}"; |
|
| 28 | + $resumePath = Loader::getRootURL('portfolio')."/jsonresume/{$this->resume}"; |
|
| 29 | 29 | $resume = file_get_contents($resumePath); |
| 30 | 30 | $resume = json_decode($resume, true); |
| 31 | 31 | $this->set_body('body_data', $resume); |
@@ -89,7 +89,7 @@ |
||
| 89 | 89 | |
| 90 | 90 | return [ |
| 91 | 91 | 'success' => |
| 92 | - "Thank you for your message, {$_POST['name']}! " . |
|
| 92 | + "Thank you for your message, {$_POST['name']}! ". |
|
| 93 | 93 | "I'll get back to you as soon as possible." |
| 94 | 94 | ]; |
| 95 | 95 | } |
@@ -33,15 +33,15 @@ discard block |
||
| 33 | 33 | ], |
| 34 | 34 | [ |
| 35 | 35 | 'name' => 'Projects', |
| 36 | - 'link' => Loader::getRootURL() . 'projects/', |
|
| 36 | + 'link' => Loader::getRootURL().'projects/', |
|
| 37 | 37 | ], |
| 38 | 38 | [ |
| 39 | 39 | 'name' => 'Résumé', |
| 40 | - 'link' => Loader::getRootURL() . 'resume/', |
|
| 40 | + 'link' => Loader::getRootURL().'resume/', |
|
| 41 | 41 | ], |
| 42 | 42 | [ |
| 43 | 43 | 'name' => 'Contact', |
| 44 | - 'link' => Loader::getRootURL() . 'contact/', |
|
| 44 | + 'link' => Loader::getRootURL().'contact/', |
|
| 45 | 45 | ], |
| 46 | 46 | ]; |
| 47 | 47 | |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | $active_page = ucfirst(URLDecode::getPiece(1)); |
| 52 | 52 | } |
| 53 | 53 | |
| 54 | - return array_map(function ($row) use ($active_page) { |
|
| 54 | + return array_map(function($row) use ($active_page) { |
|
| 55 | 55 | $row = (object) $row; |
| 56 | 56 | $row->active = ($row->name == $active_page); |
| 57 | 57 | return $row; |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | $post_result = $activityRepository->getActivities(5); |
| 60 | 60 | |
| 61 | 61 | $post_array = array(); |
| 62 | - foreach($post_result as $row) { |
|
| 62 | + foreach ($post_result as $row) { |
|
| 63 | 63 | array_push($post_array, $this->expand_post($row)); |
| 64 | 64 | } |
| 65 | 65 | |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | ]; |
| 76 | 76 | |
| 77 | 77 | if ($format != 'short') { |
| 78 | - $post['url'] = Loader::getRootUrl('lifestream') . "{$raw_post['type']}/{$raw_post['id']}/"; |
|
| 78 | + $post['url'] = Loader::getRootUrl('lifestream')."{$raw_post['type']}/{$raw_post['id']}/"; |
|
| 79 | 79 | |
| 80 | 80 | $metadata = json_decode($raw_post['metadata'], true); |
| 81 | 81 | $post = array_merge($post, $metadata); |
@@ -95,12 +95,12 @@ discard block |
||
| 95 | 95 | $headers = $this->headers; |
| 96 | 96 | Header::$headers(); |
| 97 | 97 | Loader::load('view', '/Head', $this->data_array['head']); |
| 98 | - foreach($this->body_view_array as $view) |
|
| 98 | + foreach ($this->body_view_array as $view) |
|
| 99 | 99 | { |
| 100 | - if(substr($view, 0, 1) == '/') |
|
| 100 | + if (substr($view, 0, 1) == '/') |
|
| 101 | 101 | Loader::load('view', $view, $this->data_array['body']); |
| 102 | 102 | else |
| 103 | - Loader::load('view', URLDecode::getSite() . '/' . $view, $this->data_array['body']); |
|
| 103 | + Loader::load('view', URLDecode::getSite().'/'.$view, $this->data_array['body']); |
|
| 104 | 104 | } |
| 105 | 105 | |
| 106 | 106 | if (URLDecode::getSite() == 'waterfalls') { |
@@ -109,7 +109,7 @@ discard block |
||
| 109 | 109 | Loader::load('view', '/Foot', array('tracking_code' => self::$TRACKING_CODE)); |
| 110 | 110 | } |
| 111 | 111 | |
| 112 | - if($view == '/404' || $view == '/503') |
|
| 112 | + if ($view == '/404' || $view == '/503') |
|
| 113 | 113 | exit; |
| 114 | 114 | } |
| 115 | 115 | |
@@ -165,14 +165,14 @@ discard block |
||
| 165 | 165 | |
| 166 | 166 | private function load_assets() |
| 167 | 167 | { |
| 168 | - $css_array = array_map(function ($stylesheet) { |
|
| 168 | + $css_array = array_map(function($stylesheet) { |
|
| 169 | 169 | $path = "/css/{$stylesheet[0]}.css"; |
| 170 | 170 | if ($stylesheet[1] > 1) { |
| 171 | 171 | $path .= "?v={$stylesheet[1]}"; |
| 172 | 172 | } |
| 173 | 173 | return $path; |
| 174 | 174 | }, $this->css_array); |
| 175 | - $js_array = array_map(function ($script) { |
|
| 175 | + $js_array = array_map(function($script) { |
|
| 176 | 176 | if (substr($script, 0, 4) == 'http') { |
| 177 | 177 | return $script; |
| 178 | 178 | } |
@@ -190,26 +190,26 @@ discard block |
||
| 190 | 190 | |
| 191 | 191 | protected function eject() |
| 192 | 192 | { |
| 193 | - if(get_class($this) !== 'Error404Controller') |
|
| 193 | + if (get_class($this) !== 'Error404Controller') |
|
| 194 | 194 | Loader::loadNew('controller', '/Error404Controller')->activate(); |
| 195 | 195 | } |
| 196 | 196 | |
| 197 | 197 | protected function unavailable() |
| 198 | 198 | { |
| 199 | - if(get_class($this) !== 'Error503Controller') |
|
| 199 | + if (get_class($this) !== 'Error503Controller') |
|
| 200 | 200 | Loader::loadNew('controller', '/Error503Controller')->activate(); |
| 201 | 201 | } |
| 202 | 202 | |
| 203 | 203 | protected function redirect($uri, $method = 301) |
| 204 | 204 | { |
| 205 | - switch($method) |
|
| 205 | + switch ($method) |
|
| 206 | 206 | { |
| 207 | 207 | case 301 : |
| 208 | - if(get_class($this) !== 'Error301Controller') |
|
| 208 | + if (get_class($this) !== 'Error301Controller') |
|
| 209 | 209 | Loader::loadNew('controller', '/Error301Controller', array($uri))->activate(); |
| 210 | 210 | break; |
| 211 | 211 | case 303 : |
| 212 | - if(get_class($this) !== 'Error303Controller') |
|
| 212 | + if (get_class($this) !== 'Error303Controller') |
|
| 213 | 213 | Loader::loadNew('controller', '/Error303Controller', array($uri))->activate(); |
| 214 | 214 | break; |
| 215 | 215 | } |
@@ -229,7 +229,7 @@ discard block |
||
| 229 | 229 | private $comment_errors; |
| 230 | 230 | protected function handle_comment_submit($site_id, $path, $redirect_url, $page_title) |
| 231 | 231 | { |
| 232 | - if(Request::hasPost() && Request::getPost('submit') == 'Submit Comment') |
|
| 232 | + if (Request::hasPost() && Request::getPost('submit') == 'Submit Comment') |
|
| 233 | 233 | { |
| 234 | 234 | $parameters = array($site_id, $path, $redirect_url, $page_title); |
| 235 | 235 | $this->comment_errors = Loader::loadNew('module', 'form/CommentSubmitModule', $parameters)->activate(); |
@@ -261,7 +261,7 @@ discard block |
||
| 261 | 261 | $container['logger']->info("CommentService | Path | {$elapsed}"); |
| 262 | 262 | |
| 263 | 263 | $array = array(); |
| 264 | - foreach((array) $comment_response as $comment) |
|
| 264 | + foreach ((array) $comment_response as $comment) |
|
| 265 | 265 | { |
| 266 | 266 | $body = Content::instance('CleanComment', $comment['body'])->activate(); |
| 267 | 267 | $body = strip_tags($body); |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | Loader::load('collector', 'image/PhotoCollector'); |
| 40 | 40 | $photo_result = PhotoCollector::getRow($id); |
| 41 | 41 | |
| 42 | - if($photo_result == null) |
|
| 42 | + if ($photo_result == null) |
|
| 43 | 43 | return; |
| 44 | 44 | |
| 45 | 45 | $name = $photo_result->name; |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | $tag_result = $repository->getTagsForPost($post['id']); |
| 85 | 85 | |
| 86 | 86 | $tag_array = array(); |
| 87 | - foreach($tag_result as $tag) |
|
| 87 | + foreach ($tag_result as $tag) |
|
| 88 | 88 | { |
| 89 | 89 | $tag_object = new stdclass(); |
| 90 | 90 | $tag_object->name = $tag['tag']; |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | { |
| 99 | 99 | $body = $post['body']; |
| 100 | 100 | |
| 101 | - if($trim) |
|
| 101 | + if ($trim) |
|
| 102 | 102 | $body = Content::instance('SmartTrim', $body)->activate(self::$LENGTH_OF_TRIMMED_POST); |
| 103 | 103 | |
| 104 | 104 | $body = Content::instance('FixPhoto', $body)->activate(false, 'standard'); |
@@ -124,9 +124,9 @@ discard block |
||
| 124 | 124 | $maximum_tag_count = $this->get_maximum_tag_count($tag_result); |
| 125 | 125 | |
| 126 | 126 | $cloud_array = array(); |
| 127 | - foreach($tag_result as $tag) |
|
| 127 | + foreach ($tag_result as $tag) |
|
| 128 | 128 | { |
| 129 | - if($tag['count'] < self::$MINIMUM_TAG_COUNT) |
|
| 129 | + if ($tag['count'] < self::$MINIMUM_TAG_COUNT) |
|
| 130 | 130 | continue; |
| 131 | 131 | |
| 132 | 132 | $tag_object = new stdclass(); |
@@ -143,9 +143,9 @@ discard block |
||
| 143 | 143 | { |
| 144 | 144 | $maximum = 1; |
| 145 | 145 | |
| 146 | - foreach($tag_result as $tag) |
|
| 146 | + foreach ($tag_result as $tag) |
|
| 147 | 147 | { |
| 148 | - if($tag['count'] > $maximum) |
|
| 148 | + if ($tag['count'] > $maximum) |
|
| 149 | 149 | $maximum = $tag['count']; |
| 150 | 150 | } |
| 151 | 151 | return $maximum; |
@@ -174,7 +174,7 @@ discard block |
||
| 174 | 174 | $container['logger']->info("CommentService | Sidebar | {$elapsed}"); |
| 175 | 175 | |
| 176 | 176 | $array = array(); |
| 177 | - foreach($comment_response as $comment) |
|
| 177 | + foreach ($comment_response as $comment) |
|
| 178 | 178 | { |
| 179 | 179 | $body = Content::instance('CleanComment', $comment['body'])->activate(); |
| 180 | 180 | $body = strip_tags($body); |
@@ -82,7 +82,7 @@ |
||
| 82 | 82 | $container['logger']->info("CommentService | Sidebar | {$elapsed}"); |
| 83 | 83 | |
| 84 | 84 | $array = array(); |
| 85 | - foreach($comment_response as $comment) |
|
| 85 | + foreach ($comment_response as $comment) |
|
| 86 | 86 | { |
| 87 | 87 | $body = Content::instance('CleanComment', $comment['body'])->activate(); |
| 88 | 88 | $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,7 +70,7 @@ discard block |
||
| 70 | 70 | |
| 71 | 71 | |
| 72 | 72 | // configure the comment service connection |
| 73 | -$container['comment_service_api'] = function () use ($config) { |
|
| 73 | +$container['comment_service_api'] = function() use ($config) { |
|
| 74 | 74 | $configuration = (new Jacobemerick\CommentService\Configuration()) |
| 75 | 75 | ->setUsername($config->comments->user) |
| 76 | 76 | ->setPassword($config->comments->password) |
@@ -84,16 +84,16 @@ discard block |
||
| 84 | 84 | |
| 85 | 85 | |
| 86 | 86 | // setup mail handler |
| 87 | -$container['mail'] = $container->factory(function ($c) { |
|
| 87 | +$container['mail'] = $container->factory(function($c) { |
|
| 88 | 88 | return (new Jacobemerick\Archangel\Archangel())->setLogger($c['logger']); |
| 89 | 89 | }); |
| 90 | 90 | |
| 91 | 91 | |
| 92 | 92 | // setup the logger |
| 93 | -$container['setup_logger'] = $container->protect(function ($name) use ($container) { |
|
| 93 | +$container['setup_logger'] = $container->protect(function($name) use ($container) { |
|
| 94 | 94 | $logger = new Monolog\Logger($name); |
| 95 | 95 | |
| 96 | - $logPath = __DIR__ . "/logs/{$name}.log"; |
|
| 96 | + $logPath = __DIR__."/logs/{$name}.log"; |
|
| 97 | 97 | $streamHandler = new Monolog\Handler\StreamHandler($logPath, Monolog\Logger::INFO); |
| 98 | 98 | // todo - make this more useful |
| 99 | 99 | // $streamHandler->setFormatter( |
@@ -122,7 +122,7 @@ discard block |
||
| 122 | 122 | |
| 123 | 123 | |
| 124 | 124 | // sets up shutdown function to display profiler |
| 125 | -register_shutdown_function(function () use ($container) { |
|
| 125 | +register_shutdown_function(function() use ($container) { |
|
| 126 | 126 | if ( |
| 127 | 127 | !isset($_COOKIE['debugger']) || |
| 128 | 128 | $_COOKIE['debugger'] != 'display' |
@@ -134,10 +134,10 @@ discard block |
||
| 134 | 134 | ->getRead() |
| 135 | 135 | ->getProfiler() |
| 136 | 136 | ->getProfiles(); |
| 137 | - $dbProfiles = array_filter($dbProfiles, function ($profile) { |
|
| 137 | + $dbProfiles = array_filter($dbProfiles, function($profile) { |
|
| 138 | 138 | return $profile['function'] == 'perform'; |
| 139 | 139 | }); |
| 140 | - $dbProfiles = array_map(function ($profile) { |
|
| 140 | + $dbProfiles = array_map(function($profile) { |
|
| 141 | 141 | return [ |
| 142 | 142 | 'sql' => trim(preg_replace('/\s+/', ' ', $profile['statement'])), |
| 143 | 143 | 'parameters' => $profile['bind_values'], |
@@ -45,13 +45,13 @@ discard block |
||
| 45 | 45 | |
| 46 | 46 | protected function check_for_special_redirect($uri) |
| 47 | 47 | { |
| 48 | - if(preg_match('@^/post_([0-9]{4}-[0-9]{2}-[0-9]{2})_([a-z0-9-]+)(/?)$@', $uri, $matches)) |
|
| 48 | + if (preg_match('@^/post_([0-9]{4}-[0-9]{2}-[0-9]{2})_([a-z0-9-]+)(/?)$@', $uri, $matches)) |
|
| 49 | 49 | { |
| 50 | 50 | global $container; |
| 51 | 51 | $repository = new Jacobemerick\Web\Domain\Blog\Post\MysqlPostRepository($container['db_connection_locator']); |
| 52 | 52 | $post = $repository->findPostByPath($matches[2]); |
| 53 | 53 | |
| 54 | - if(!$post) |
|
| 54 | + if (!$post) |
|
| 55 | 55 | { |
| 56 | 56 | Loader::loadNew('controller', '/Error404Controller') |
| 57 | 57 | ->activate(); |
@@ -63,22 +63,22 @@ discard block |
||
| 63 | 63 | else |
| 64 | 64 | { |
| 65 | 65 | $post_uri = URLDecode::getPiece(1); |
| 66 | - if($post_uri !== null) |
|
| 66 | + if ($post_uri !== null) |
|
| 67 | 67 | { |
| 68 | 68 | global $container; |
| 69 | 69 | $repository = new Jacobemerick\Web\Domain\Blog\Post\MysqlPostRepository($container['db_connection_locator']); |
| 70 | 70 | $post = $repository->findPostByPath($post_uri); |
| 71 | 71 | |
| 72 | - if($post != false) |
|
| 72 | + if ($post != false) |
|
| 73 | 73 | { |
| 74 | 74 | Loader::load('utility', 'Content'); |
| 75 | 75 | $uri = Content::instance('URLSafe', "/{$post['category']}/{$post['path']}/")->activate(); |
| 76 | 76 | } |
| 77 | 77 | } |
| 78 | 78 | } |
| 79 | - if($uri == '/search/') |
|
| 79 | + if ($uri == '/search/') |
|
| 80 | 80 | { |
| 81 | - if(Request::getGet('submit') == 'Submit Search' && Request::getGet('search')) |
|
| 81 | + if (Request::getGet('submit') == 'Submit Search' && Request::getGet('search')) |
|
| 82 | 82 | { |
| 83 | 83 | $uri .= Request::getGet('search'); |
| 84 | 84 | $uri .= '/'; |
@@ -5,7 +5,7 @@ |
||
| 5 | 5 | interface PostRepositoryInterface |
| 6 | 6 | { |
| 7 | 7 | public function findPostByPath($path); |
| 8 | - public function getActivePosts($limit = null, $offset= 0); |
|
| 8 | + public function getActivePosts($limit = null, $offset = 0); |
|
| 9 | 9 | public function getActivePostsCount(); |
| 10 | 10 | public function getActivePostsByTag($tag, $limit = null, $offset = 0); |
| 11 | 11 | public function getActivePostsCountByTag($tag); |