@@ -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'], |
@@ -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 .= '/'; |
@@ -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(); |
@@ -19,26 +19,26 @@ discard block |
||
19 | 19 | |
20 | 20 | private static function get_router_name() |
21 | 21 | { |
22 | - if(Request::isAJAX()) |
|
22 | + if (Request::isAJAX()) |
|
23 | 23 | return 'AJAXRouter'; |
24 | - if(URLDecode::getURI() == '/robots.txt') |
|
24 | + if (URLDecode::getURI() == '/robots.txt') |
|
25 | 25 | return 'RobotRouter'; |
26 | - if(URLDecode::getURI() == '/sitemap.xml') |
|
26 | + if (URLDecode::getURI() == '/sitemap.xml') |
|
27 | 27 | return 'SitemapRouter'; |
28 | - if(URLDecode::getURI() == '/rss/') |
|
28 | + if (URLDecode::getURI() == '/rss/') |
|
29 | 29 | return 'RSSRouter'; |
30 | - if(URLDecode::getExtension() == 'css') |
|
30 | + if (URLDecode::getExtension() == 'css') |
|
31 | 31 | return 'StyleRouter'; |
32 | - if(URLDecode::getExtension() == 'js') |
|
32 | + if (URLDecode::getExtension() == 'js') |
|
33 | 33 | return 'ScriptRouter'; |
34 | - if(URLDecode::getExtension() == 'ico') |
|
34 | + if (URLDecode::getExtension() == 'ico') |
|
35 | 35 | return 'ImageRouter'; |
36 | - if(URLDecode::getExtension() == 'jpg') |
|
36 | + if (URLDecode::getExtension() == 'jpg') |
|
37 | 37 | return 'ImageRouter'; |
38 | - if(URLDecode::getExtension() == 'png') |
|
38 | + if (URLDecode::getExtension() == 'png') |
|
39 | 39 | return 'ImageRouter'; |
40 | 40 | |
41 | - switch(URLDecode::getSite()) |
|
41 | + switch (URLDecode::getSite()) |
|
42 | 42 | { |
43 | 43 | case 'ajax' : |
44 | 44 | return 'AjaxRouter'; |
@@ -86,37 +86,37 @@ discard block |
||
86 | 86 | |
87 | 87 | final protected function check_for_redirect($redirect_uri) |
88 | 88 | { |
89 | - foreach($this->get_redirect_array() as $check) |
|
89 | + foreach ($this->get_redirect_array() as $check) |
|
90 | 90 | { |
91 | 91 | $redirect_uri = preg_replace($check->pattern, $check->replace, $redirect_uri); |
92 | 92 | } |
93 | 93 | |
94 | 94 | $redirect_uri = $this->check_for_special_redirect($redirect_uri); |
95 | 95 | |
96 | - if($this->requires_trailing_slash() && substr($redirect_uri, -1) != '/') |
|
96 | + if ($this->requires_trailing_slash() && substr($redirect_uri, -1) != '/') |
|
97 | 97 | $redirect_uri .= '/'; |
98 | 98 | |
99 | 99 | if (URLDecode::getHost() == 'waterfalls.jacobemerick.com') { |
100 | 100 | $redirect_uri = 'http://' . (!Loader::isLive() ? 'dev' : 'www') . '.waterfallsofthekeweenaw.com' . $redirect_uri; |
101 | 101 | } |
102 | 102 | |
103 | - if($redirect_uri == URLDecode::getURI()) |
|
103 | + if ($redirect_uri == URLDecode::getURI()) |
|
104 | 104 | return; |
105 | 105 | |
106 | 106 | $controller_check = $redirect_uri; |
107 | - if(substr($redirect_uri, 0, 4) == 'http') |
|
107 | + if (substr($redirect_uri, 0, 4) == 'http') |
|
108 | 108 | $controller_check = preg_replace('@^http://([a-z\.]+)@', '', $redirect_uri); |
109 | 109 | |
110 | 110 | $controller = $this->get_controller($controller_check); |
111 | - if($controller == '/Error404Controller') |
|
111 | + if ($controller == '/Error404Controller') |
|
112 | 112 | { |
113 | 113 | Loader::loadNew('controller', '/Error404Controller') |
114 | 114 | ->activate(); |
115 | 115 | exit; |
116 | 116 | } |
117 | 117 | |
118 | - if($this->get_primary_folder() == 'images') { |
|
119 | - $file = $controller_check;//URLDecode::getURI(); |
|
118 | + if ($this->get_primary_folder() == 'images') { |
|
119 | + $file = $controller_check; //URLDecode::getURI(); |
|
120 | 120 | |
121 | 121 | if ( |
122 | 122 | URLDecode::getSite() == 'images' || |
@@ -129,13 +129,13 @@ discard block |
||
129 | 129 | } |
130 | 130 | |
131 | 131 | $image = new ImageOld($file); |
132 | - if(!$image->isValid()) { |
|
132 | + if (!$image->isValid()) { |
|
133 | 133 | Loader::loadNew('controller', '/Error404Controller')->activate(); |
134 | 134 | exit(); |
135 | 135 | } |
136 | 136 | } |
137 | 137 | |
138 | - if(substr($redirect_uri, 0, 4) != 'http') |
|
138 | + if (substr($redirect_uri, 0, 4) != 'http') |
|
139 | 139 | { |
140 | 140 | $redirect_uri = substr($redirect_uri, 1); |
141 | 141 | $redirect_uri = URLDecode::getBase() . $redirect_uri; |
@@ -152,12 +152,12 @@ discard block |
||
152 | 152 | |
153 | 153 | final private function get_controller($uri) |
154 | 154 | { |
155 | - foreach($this->get_direct_array() as $check) |
|
155 | + foreach ($this->get_direct_array() as $check) |
|
156 | 156 | { |
157 | - if($uri == $check->match) |
|
157 | + if ($uri == $check->match) |
|
158 | 158 | return "{$this->get_primary_folder()}/{$check->controller}"; |
159 | 159 | |
160 | - if(preg_match("@^{$check->match}$@", $uri)) |
|
160 | + if (preg_match("@^{$check->match}$@", $uri)) |
|
161 | 161 | return "{$this->get_primary_folder()}/{$check->controller}"; |
162 | 162 | } |
163 | 163 | |
@@ -166,19 +166,19 @@ discard block |
||
166 | 166 | |
167 | 167 | final private function get_primary_folder() |
168 | 168 | { |
169 | - if(Request::isAjax()) |
|
169 | + if (Request::isAjax()) |
|
170 | 170 | return 'ajax'; |
171 | - if(URLDecode::getURI() == '/robots.txt') |
|
171 | + if (URLDecode::getURI() == '/robots.txt') |
|
172 | 172 | return 'robot'; |
173 | - if(URLDecode::getURI() == '/sitemap.xml') |
|
173 | + if (URLDecode::getURI() == '/sitemap.xml') |
|
174 | 174 | return 'sitemap'; |
175 | - if(URLDecode::getURI() == '/rss/') |
|
175 | + if (URLDecode::getURI() == '/rss/') |
|
176 | 176 | return 'rss'; |
177 | - if(URLDecode::getExtension() == 'css') |
|
177 | + if (URLDecode::getExtension() == 'css') |
|
178 | 178 | return 'styles'; |
179 | - if(URLDecode::getExtension() == 'js') |
|
179 | + if (URLDecode::getExtension() == 'js') |
|
180 | 180 | return 'scripts'; |
181 | - if( |
|
181 | + if ( |
|
182 | 182 | URLDecode::getExtension() == 'jpg' || |
183 | 183 | URLDecode::getExtension() == 'ico' || |
184 | 184 | URLDecode::getExtension() == 'png') |
@@ -26,6 +26,6 @@ |
||
26 | 26 | ) |
27 | 27 | ); |
28 | 28 | |
29 | -Router::route($redirect,$direct); |
|
29 | +Router::route($redirect, $direct); |
|
30 | 30 | |
31 | 31 | ?> |
32 | 32 | \ No newline at end of file |
@@ -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'"; |