| @@ -13,7 +13,7 @@ | ||
| 13 | 13 | public function __construct() | 
| 14 | 14 |      { | 
| 15 | 15 | $extendedPdo = $this->newExtendedPdo(); | 
| 16 | -        $this->connections = new ConnectionLocator(function () use ($extendedPdo) { | |
| 16 | +        $this->connections = new ConnectionLocator(function() use ($extendedPdo) { | |
| 17 | 17 | return $extendedPdo; | 
| 18 | 18 | }); | 
| 19 | 19 | } | 
| @@ -5,7 +5,7 @@ | ||
| 5 | 5 | interface PostRepository | 
| 6 | 6 |  { | 
| 7 | 7 | public function findPostByPath($category, $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); | 
| @@ -48,7 +48,7 @@ | ||
| 48 | 48 | $recentPosts = $postRepository->getActivePosts(3); | 
| 49 | 49 | |
| 50 | 50 | $recent_post_array = array(); | 
| 51 | - foreach($recentPosts as $postResult) | |
| 51 | + foreach ($recentPosts as $postResult) | |
| 52 | 52 |  		{ | 
| 53 | 53 | $post = new stdclass(); | 
| 54 | 54 | $post->title = $postResult['title']; | 
| @@ -8,7 +8,7 @@ discard block | ||
| 8 | 8 | |
| 9 | 9 | private static $UNKNOWN_ERROR_FILE = 'Unknown File'; | 
| 10 | 10 | private static $UNKNOWN_ERROR_LINE = 'Unknown Line'; | 
| 11 | - private static $UNKNOWN_ERROR_CONTEXT = 'Unknown Context'; | |
| 11 | + private static $UNKNOWN_ERROR_CONTEXT = 'Unknown Context'; | |
| 12 | 12 | |
| 13 | 13 | private $profiler; | 
| 14 | 14 | private $display = true; | 
| @@ -24,7 +24,7 @@ discard block | ||
| 24 | 24 | |
| 25 | 25 | public static function instance() | 
| 26 | 26 |  	{ | 
| 27 | - if(!isset(self::$instance)) | |
| 27 | + if (!isset(self::$instance)) | |
| 28 | 28 | self::$instance = new Debugger(); | 
| 29 | 29 | return self::$instance; | 
| 30 | 30 | } | 
| @@ -52,11 +52,11 @@ discard block | ||
| 52 | 52 | |
| 53 | 53 | public static function internal_error($code, $string, $file = null, $line = null, $context = null) | 
| 54 | 54 |  	{ | 
| 55 | - if($file == null) | |
| 55 | + if ($file == null) | |
| 56 | 56 | $file = self::$UNKNOWN_ERROR_FILE; | 
| 57 | - if($line == null) | |
| 57 | + if ($line == null) | |
| 58 | 58 | $line = self::$UNKNOWN_ERROR_LINE; | 
| 59 | - if($context == null) | |
| 59 | + if ($context == null) | |
| 60 | 60 | $context = self::$UNKNOWN_ERROR_CONTEXT; | 
| 61 | 61 | |
| 62 | 62 |  		self::instance()->console->logError(new Exception($string), "{$string}... TYPE: {$code}"); | 
| @@ -68,7 +68,7 @@ discard block | ||
| 68 | 68 |  	{ | 
| 69 | 69 | $error = error_get_last(); | 
| 70 | 70 | |
| 71 | - if(isset($error)) | |
| 71 | + if (isset($error)) | |
| 72 | 72 | self::internal_error($error['type'], $error['message'], $error['file'], $error['line']); | 
| 73 | 73 | |
| 74 | 74 | self::display(); | 
| @@ -90,10 +90,10 @@ discard block | ||
| 90 | 90 | } | 
| 91 | 91 |        if (!empty($pdo)) { | 
| 92 | 92 | $profiles = $pdo->getProfiler()->getProfiles(); | 
| 93 | -        $profiles = array_filter($profiles, function ($profile) { | |
| 93 | +        $profiles = array_filter($profiles, function($profile) { | |
| 94 | 94 | return $profile['function'] == 'perform'; | 
| 95 | 95 | }); | 
| 96 | -        $profiles = array_map(function ($profile) { | |
| 96 | +        $profiles = array_map(function($profile) { | |
| 97 | 97 | return array( | 
| 98 | 98 |                  'sql' => trim(preg_replace('/\s+/', ' ', $profile['statement'])), | 
| 99 | 99 | 'parameters' => $profile['bind_values'], | 
| @@ -24,8 +24,9 @@ discard block | ||
| 24 | 24 | |
| 25 | 25 | public static function instance() | 
| 26 | 26 |  	{ | 
| 27 | - if(!isset(self::$instance)) | |
| 28 | - self::$instance = new Debugger(); | |
| 27 | +		if(!isset(self::$instance)) {
 | |
| 28 | + self::$instance = new Debugger(); | |
| 29 | + } | |
| 29 | 30 | return self::$instance; | 
| 30 | 31 | } | 
| 31 | 32 | |
| @@ -52,12 +53,15 @@ discard block | ||
| 52 | 53 | |
| 53 | 54 | public static function internal_error($code, $string, $file = null, $line = null, $context = null) | 
| 54 | 55 |  	{ | 
| 55 | - if($file == null) | |
| 56 | - $file = self::$UNKNOWN_ERROR_FILE; | |
| 57 | - if($line == null) | |
| 58 | - $line = self::$UNKNOWN_ERROR_LINE; | |
| 59 | - if($context == null) | |
| 60 | - $context = self::$UNKNOWN_ERROR_CONTEXT; | |
| 56 | +		if($file == null) {
 | |
| 57 | + $file = self::$UNKNOWN_ERROR_FILE; | |
| 58 | + } | |
| 59 | +		if($line == null) {
 | |
| 60 | + $line = self::$UNKNOWN_ERROR_LINE; | |
| 61 | + } | |
| 62 | +		if($context == null) {
 | |
| 63 | + $context = self::$UNKNOWN_ERROR_CONTEXT; | |
| 64 | + } | |
| 61 | 65 | |
| 62 | 66 |  		self::instance()->console->logError(new Exception($string), "{$string}... TYPE: {$code}"); | 
| 63 | 67 | |
| @@ -68,8 +72,9 @@ discard block | ||
| 68 | 72 |  	{ | 
| 69 | 73 | $error = error_get_last(); | 
| 70 | 74 | |
| 71 | - if(isset($error)) | |
| 72 | - self::internal_error($error['type'], $error['message'], $error['file'], $error['line']); | |
| 75 | +		if(isset($error)) {
 | |
| 76 | + self::internal_error($error['type'], $error['message'], $error['file'], $error['line']); | |
| 77 | + } | |
| 73 | 78 | |
| 74 | 79 | self::display(); | 
| 75 | 80 | return true; | 
| @@ -45,11 +45,11 @@ 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 |  			Loader::load('collector', 'blog/PostCollector'); | 
| 51 | 51 | $post = PostCollector::getPostByURI($matches[2]); | 
| 52 | - if(!$post) | |
| 52 | + if (!$post) | |
| 53 | 53 |  			{ | 
| 54 | 54 |  				Loader::loadNew('controller', '/Error404Controller') | 
| 55 | 55 | ->activate(); | 
| @@ -61,21 +61,21 @@ discard block | ||
| 61 | 61 | else | 
| 62 | 62 |  		{ | 
| 63 | 63 | $post_uri = URLDecode::getPiece(1); | 
| 64 | - if($post_uri !== null) | |
| 64 | + if ($post_uri !== null) | |
| 65 | 65 |  			{ | 
| 66 | 66 |  				Loader::load('collector', 'blog/PostCollector'); | 
| 67 | 67 | $post = PostCollector::getPostByURI($post_uri); | 
| 68 | 68 | |
| 69 | - if($post != false) | |
| 69 | + if ($post != false) | |
| 70 | 70 |  				{ | 
| 71 | 71 |  					Loader::load('utility', 'Content'); | 
| 72 | 72 |  					$uri = Content::instance('URLSafe', "/{$post->category}/{$post->title_url}/")->activate(); | 
| 73 | 73 | } | 
| 74 | 74 | } | 
| 75 | 75 | } | 
| 76 | - if($uri == '/search/') | |
| 76 | + if ($uri == '/search/') | |
| 77 | 77 |  		{ | 
| 78 | -			if(Request::getGet('submit') == 'Submit Search' && Request::getGet('search')) | |
| 78 | +			if (Request::getGet('submit') == 'Submit Search' && Request::getGet('search')) | |
| 79 | 79 |  			{ | 
| 80 | 80 |  				$uri .= Request::getGet('search'); | 
| 81 | 81 | $uri .= '/'; | 
| @@ -57,8 +57,7 @@ | ||
| 57 | 57 | |
| 58 | 58 |  			Loader::load('utility', 'Content'); | 
| 59 | 59 |  			$uri = Content::instance('URLSafe', "/{$post->category}/{$post->title_url}/")->activate(); | 
| 60 | - } | |
| 61 | - else | |
| 60 | + } else | |
| 62 | 61 |  		{ | 
| 63 | 62 | $post_uri = URLDecode::getPiece(1); | 
| 64 | 63 | if($post_uri !== null) | 
| @@ -27,12 +27,12 @@ | ||
| 27 | 27 | |
| 28 | 28 | protected function check_for_special_redirect($uri) | 
| 29 | 29 |  	{ | 
| 30 | -		if(preg_match('@^/piece/([a-z0-9-]+)(/?)$@', $uri, $matches)) | |
| 30 | +		if (preg_match('@^/piece/([a-z0-9-]+)(/?)$@', $uri, $matches)) | |
| 31 | 31 |  		{ | 
| 32 | 32 |  			Loader::load('collector', 'portfolio/PortfolioCollector'); | 
| 33 | 33 | $piece = PortfolioCollector::getPieceByURI($matches[1]); | 
| 34 | 34 | |
| 35 | - if($piece === null) | |
| 35 | + if ($piece === null) | |
| 36 | 36 |  			{ | 
| 37 | 37 |  				Loader::loadNew('controller', '/Error404Controller') | 
| 38 | 38 | ->activate(); | 
| @@ -163,7 +163,7 @@ | ||
| 163 | 163 |  	{ | 
| 164 | 164 | $path = self::escape($path); | 
| 165 | 165 | |
| 166 | - if($commenter != 0) | |
| 166 | + if ($commenter != 0) | |
| 167 | 167 |  			$trusted_commenter_clause = "(`commenter`.`trusted` = '1' || `commenter`.`id` = '{$commenter}')"; | 
| 168 | 168 | else | 
| 169 | 169 | $trusted_commenter_clause = "`commenter`.`trusted` = '1'"; | 
| @@ -163,10 +163,11 @@ | ||
| 163 | 163 |  	{ | 
| 164 | 164 | $path = self::escape($path); | 
| 165 | 165 | |
| 166 | - if($commenter != 0) | |
| 167 | -			$trusted_commenter_clause = "(`commenter`.`trusted` = '1' || `commenter`.`id` = '{$commenter}')"; | |
| 168 | - else | |
| 169 | - $trusted_commenter_clause = "`commenter`.`trusted` = '1'"; | |
| 166 | +		if($commenter != 0) {
 | |
| 167 | +					$trusted_commenter_clause = "(`commenter`.`trusted` = '1' || `commenter`.`id` = '{$commenter}')";
 | |
| 168 | +		} else {
 | |
| 169 | + $trusted_commenter_clause = "`commenter`.`trusted` = '1'"; | |
| 170 | + } | |
| 170 | 171 | |
| 171 | 172 | $query = " | 
| 172 | 173 | SELECT | 
| @@ -80,7 +80,7 @@ | ||
| 80 | 80 |  		$tag_clause = "'{$tag_clause}'"; | 
| 81 | 81 | |
| 82 | 82 | $exclude_clause = ''; | 
| 83 | - if(count($exclude_posts) > 0) | |
| 83 | + if (count($exclude_posts) > 0) | |
| 84 | 84 |  		{ | 
| 85 | 85 |  			$exclude_clause .= " && `ptlink`.`post_id` NOT IN ('"; | 
| 86 | 86 |  			$exclude_clause .= implode("', '", $exclude_posts); | 
| @@ -28,7 +28,7 @@ | ||
| 28 | 28 | |
| 29 | 29 | protected function set_response($message, $type = 'internal') | 
| 30 | 30 |  	{ | 
| 31 | - switch($type) | |
| 31 | + switch ($type) | |
| 32 | 32 |  		{ | 
| 33 | 33 | case 'internal' : | 
| 34 | 34 | $this->response['internal'] = $message; |