@@ -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(); |
@@ -96,9 +96,9 @@ discard block |
||
96 | 96 | if($this->requires_trailing_slash() && substr($redirect_uri, -1) != '/') |
97 | 97 | $redirect_uri .= '/'; |
98 | 98 | |
99 | - if (URLDecode::getHost() == 'waterfalls.jacobemerick.com') { |
|
100 | - $redirect_uri = 'http://' . (!Loader::isLive() ? 'dev' : 'www') . '.waterfallsofthekeweenaw.com' . $redirect_uri; |
|
101 | - } |
|
99 | + if (URLDecode::getHost() == 'waterfalls.jacobemerick.com') { |
|
100 | + $redirect_uri = 'http://' . (!Loader::isLive() ? 'dev' : 'www') . '.waterfallsofthekeweenaw.com' . $redirect_uri; |
|
101 | + } |
|
102 | 102 | |
103 | 103 | if($redirect_uri == URLDecode::getURI()) |
104 | 104 | return; |
@@ -129,8 +129,8 @@ discard block |
||
129 | 129 | } |
130 | 130 | |
131 | 131 | $image = new ImageOld($file); |
132 | - if(!$image->isValid()) { |
|
133 | - Loader::loadNew('controller', '/Error404Controller')->activate(); |
|
132 | + if(!$image->isValid()) { |
|
133 | + Loader::loadNew('controller', '/Error404Controller')->activate(); |
|
134 | 134 | exit(); |
135 | 135 | } |
136 | 136 | } |
@@ -201,7 +201,7 @@ discard block |
||
201 | 201 | URLDecode::getExtension() != 'jpg' && |
202 | 202 | URLDecode::getExtension() != 'png' && |
203 | 203 | URLDecode::getExtension() != 'ico' && |
204 | - strstr(URLDecode::getURI(), '#') === false); |
|
204 | + strstr(URLDecode::getURI(), '#') === false); |
|
205 | 205 | } |
206 | 206 | |
207 | 207 | } |
@@ -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') |
@@ -19,24 +19,33 @@ discard block |
||
19 | 19 | |
20 | 20 | private static function get_router_name() |
21 | 21 | { |
22 | - if(Request::isAJAX()) |
|
23 | - return 'AJAXRouter'; |
|
24 | - if(URLDecode::getURI() == '/robots.txt') |
|
25 | - return 'RobotRouter'; |
|
26 | - if(URLDecode::getURI() == '/sitemap.xml') |
|
27 | - return 'SitemapRouter'; |
|
28 | - if(URLDecode::getURI() == '/rss/') |
|
29 | - return 'RSSRouter'; |
|
30 | - if(URLDecode::getExtension() == 'css') |
|
31 | - return 'StyleRouter'; |
|
32 | - if(URLDecode::getExtension() == 'js') |
|
33 | - return 'ScriptRouter'; |
|
34 | - if(URLDecode::getExtension() == 'ico') |
|
35 | - return 'ImageRouter'; |
|
36 | - if(URLDecode::getExtension() == 'jpg') |
|
37 | - return 'ImageRouter'; |
|
38 | - if(URLDecode::getExtension() == 'png') |
|
39 | - return 'ImageRouter'; |
|
22 | + if(Request::isAJAX()) { |
|
23 | + return 'AJAXRouter'; |
|
24 | + } |
|
25 | + if(URLDecode::getURI() == '/robots.txt') { |
|
26 | + return 'RobotRouter'; |
|
27 | + } |
|
28 | + if(URLDecode::getURI() == '/sitemap.xml') { |
|
29 | + return 'SitemapRouter'; |
|
30 | + } |
|
31 | + if(URLDecode::getURI() == '/rss/') { |
|
32 | + return 'RSSRouter'; |
|
33 | + } |
|
34 | + if(URLDecode::getExtension() == 'css') { |
|
35 | + return 'StyleRouter'; |
|
36 | + } |
|
37 | + if(URLDecode::getExtension() == 'js') { |
|
38 | + return 'ScriptRouter'; |
|
39 | + } |
|
40 | + if(URLDecode::getExtension() == 'ico') { |
|
41 | + return 'ImageRouter'; |
|
42 | + } |
|
43 | + if(URLDecode::getExtension() == 'jpg') { |
|
44 | + return 'ImageRouter'; |
|
45 | + } |
|
46 | + if(URLDecode::getExtension() == 'png') { |
|
47 | + return 'ImageRouter'; |
|
48 | + } |
|
40 | 49 | |
41 | 50 | switch(URLDecode::getSite()) |
42 | 51 | { |
@@ -93,19 +102,22 @@ discard block |
||
93 | 102 | |
94 | 103 | $redirect_uri = $this->check_for_special_redirect($redirect_uri); |
95 | 104 | |
96 | - if($this->requires_trailing_slash() && substr($redirect_uri, -1) != '/') |
|
97 | - $redirect_uri .= '/'; |
|
105 | + if($this->requires_trailing_slash() && substr($redirect_uri, -1) != '/') { |
|
106 | + $redirect_uri .= '/'; |
|
107 | + } |
|
98 | 108 | |
99 | 109 | if (URLDecode::getHost() == 'waterfalls.jacobemerick.com') { |
100 | 110 | $redirect_uri = 'http://' . (!Loader::isLive() ? 'dev' : 'www') . '.waterfallsofthekeweenaw.com' . $redirect_uri; |
101 | 111 | } |
102 | 112 | |
103 | - if($redirect_uri == URLDecode::getURI()) |
|
104 | - return; |
|
113 | + if($redirect_uri == URLDecode::getURI()) { |
|
114 | + return; |
|
115 | + } |
|
105 | 116 | |
106 | 117 | $controller_check = $redirect_uri; |
107 | - if(substr($redirect_uri, 0, 4) == 'http') |
|
108 | - $controller_check = preg_replace('@^http://([a-z\.]+)@', '', $redirect_uri); |
|
118 | + if(substr($redirect_uri, 0, 4) == 'http') { |
|
119 | + $controller_check = preg_replace('@^http://([a-z\.]+)@', '', $redirect_uri); |
|
120 | + } |
|
109 | 121 | |
110 | 122 | $controller = $this->get_controller($controller_check); |
111 | 123 | if($controller == '/Error404Controller') |
@@ -154,11 +166,13 @@ discard block |
||
154 | 166 | { |
155 | 167 | foreach($this->get_direct_array() as $check) |
156 | 168 | { |
157 | - if($uri == $check->match) |
|
158 | - return "{$this->get_primary_folder()}/{$check->controller}"; |
|
169 | + if($uri == $check->match) { |
|
170 | + return "{$this->get_primary_folder()}/{$check->controller}"; |
|
171 | + } |
|
159 | 172 | |
160 | - if(preg_match("@^{$check->match}$@", $uri)) |
|
161 | - return "{$this->get_primary_folder()}/{$check->controller}"; |
|
173 | + if(preg_match("@^{$check->match}$@", $uri)) { |
|
174 | + return "{$this->get_primary_folder()}/{$check->controller}"; |
|
175 | + } |
|
162 | 176 | } |
163 | 177 | |
164 | 178 | return '/Error404Controller'; |
@@ -166,23 +180,30 @@ discard block |
||
166 | 180 | |
167 | 181 | final private function get_primary_folder() |
168 | 182 | { |
169 | - if(Request::isAjax()) |
|
170 | - return 'ajax'; |
|
171 | - if(URLDecode::getURI() == '/robots.txt') |
|
172 | - return 'robot'; |
|
173 | - if(URLDecode::getURI() == '/sitemap.xml') |
|
174 | - return 'sitemap'; |
|
175 | - if(URLDecode::getURI() == '/rss/') |
|
176 | - return 'rss'; |
|
177 | - if(URLDecode::getExtension() == 'css') |
|
178 | - return 'styles'; |
|
179 | - if(URLDecode::getExtension() == 'js') |
|
180 | - return 'scripts'; |
|
183 | + if(Request::isAjax()) { |
|
184 | + return 'ajax'; |
|
185 | + } |
|
186 | + if(URLDecode::getURI() == '/robots.txt') { |
|
187 | + return 'robot'; |
|
188 | + } |
|
189 | + if(URLDecode::getURI() == '/sitemap.xml') { |
|
190 | + return 'sitemap'; |
|
191 | + } |
|
192 | + if(URLDecode::getURI() == '/rss/') { |
|
193 | + return 'rss'; |
|
194 | + } |
|
195 | + if(URLDecode::getExtension() == 'css') { |
|
196 | + return 'styles'; |
|
197 | + } |
|
198 | + if(URLDecode::getExtension() == 'js') { |
|
199 | + return 'scripts'; |
|
200 | + } |
|
181 | 201 | if( |
182 | 202 | URLDecode::getExtension() == 'jpg' || |
183 | 203 | URLDecode::getExtension() == 'ico' || |
184 | - URLDecode::getExtension() == 'png') |
|
185 | - return 'images'; |
|
204 | + URLDecode::getExtension() == 'png') { |
|
205 | + return 'images'; |
|
206 | + } |
|
186 | 207 | |
187 | 208 | return URLDecode::getSite(); |
188 | 209 | } |
@@ -16,9 +16,9 @@ |
||
16 | 16 | protected function get_direct_array() |
17 | 17 | { |
18 | 18 | $site = URLDecode::getSite(); |
19 | - if ($site == 'waterfalls') { |
|
20 | - $site = 'waterfall'; |
|
21 | - } |
|
19 | + if ($site == 'waterfalls') { |
|
20 | + $site = 'waterfall'; |
|
21 | + } |
|
22 | 22 | $site = ucwords($site); |
23 | 23 | |
24 | 24 | return array( |
@@ -1,8 +1,8 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | Loader::load('collector', array( |
4 | - 'waterfall/LogCollector', |
|
5 | - 'waterfall/WaterfallCollector')); |
|
4 | + 'waterfall/LogCollector', |
|
5 | + 'waterfall/WaterfallCollector')); |
|
6 | 6 | Loader::load('router', 'Router'); |
7 | 7 | |
8 | 8 | class WaterfallRouter extends Router |
@@ -26,15 +26,15 @@ discard block |
||
26 | 26 | (object) array( |
27 | 27 | 'pattern' => '@^/falls/results(/?)$@', |
28 | 28 | 'replace' => '/falls/'), |
29 | - (object) array( |
|
30 | - 'pattern' => '@^/log(/?)$@', |
|
31 | - 'replace' => '/journal/'), |
|
32 | - (object) array( |
|
33 | - 'pattern' => '@^/log/(\d+)(/?)$@', |
|
34 | - 'replace' => '/journal/$1'), |
|
35 | - (object) array( |
|
36 | - 'pattern' => '@^/map/([^/]+)(/?)$@', |
|
37 | - 'replace' => '/map/'), |
|
29 | + (object) array( |
|
30 | + 'pattern' => '@^/log(/?)$@', |
|
31 | + 'replace' => '/journal/'), |
|
32 | + (object) array( |
|
33 | + 'pattern' => '@^/log/(\d+)(/?)$@', |
|
34 | + 'replace' => '/journal/$1'), |
|
35 | + (object) array( |
|
36 | + 'pattern' => '@^/map/([^/]+)(/?)$@', |
|
37 | + 'replace' => '/map/'), |
|
38 | 38 | (object) array( |
39 | 39 | 'pattern' => '@^/about/([a-z]*)(/?)$@', |
40 | 40 | 'replace' => '/about/'), |
@@ -73,57 +73,57 @@ discard block |
||
73 | 73 | |
74 | 74 | protected function check_for_special_redirect($uri) |
75 | 75 | { |
76 | - if (preg_match('@^/falls/([a-z\'-]+)(/?)$@', $uri, $matches)) { |
|
77 | - $alias = $matches[1]; |
|
78 | - $alias = str_replace("'", '', $alias); |
|
79 | - $alias .= '-falls'; |
|
80 | - $result = WaterfallCollector::getByOldAlias($alias); |
|
81 | - if ($result !== null) { |
|
82 | - return "/{$result->watercourse_alias}/{$result->alias}/"; |
|
83 | - } else { |
|
84 | - Loader::loadNew('controller', '/Error404Controller')->activate(); |
|
85 | - } |
|
86 | - } |
|
76 | + if (preg_match('@^/falls/([a-z\'-]+)(/?)$@', $uri, $matches)) { |
|
77 | + $alias = $matches[1]; |
|
78 | + $alias = str_replace("'", '', $alias); |
|
79 | + $alias .= '-falls'; |
|
80 | + $result = WaterfallCollector::getByOldAlias($alias); |
|
81 | + if ($result !== null) { |
|
82 | + return "/{$result->watercourse_alias}/{$result->alias}/"; |
|
83 | + } else { |
|
84 | + Loader::loadNew('controller', '/Error404Controller')->activate(); |
|
85 | + } |
|
86 | + } |
|
87 | 87 | |
88 | - if (preg_match('@^/photos/([a-z\'-]+)-([^/]+)(/?)$@', $uri, $matches)) { |
|
89 | - $alias = $matches[1]; |
|
90 | - $alias = explode('-', $alias); |
|
91 | - array_pop($alias); |
|
92 | - $alias = implode('-', $alias); |
|
93 | - $alias = str_replace("'", '', $alias); |
|
94 | - $alias .= '-falls'; |
|
95 | - $result = WaterfallCollector::getByOldAlias($alias); |
|
96 | - if ($result !== null) { |
|
97 | - return "/{$result->watercourse_alias}/{$result->alias}/"; |
|
98 | - } else { |
|
99 | - Loader::loadNew('controller', '/Error404Controller')->activate(); |
|
100 | - } |
|
101 | - } |
|
88 | + if (preg_match('@^/photos/([a-z\'-]+)-([^/]+)(/?)$@', $uri, $matches)) { |
|
89 | + $alias = $matches[1]; |
|
90 | + $alias = explode('-', $alias); |
|
91 | + array_pop($alias); |
|
92 | + $alias = implode('-', $alias); |
|
93 | + $alias = str_replace("'", '', $alias); |
|
94 | + $alias .= '-falls'; |
|
95 | + $result = WaterfallCollector::getByOldAlias($alias); |
|
96 | + if ($result !== null) { |
|
97 | + return "/{$result->watercourse_alias}/{$result->alias}/"; |
|
98 | + } else { |
|
99 | + Loader::loadNew('controller', '/Error404Controller')->activate(); |
|
100 | + } |
|
101 | + } |
|
102 | 102 | |
103 | - if (preg_match('@/log/([a-z]+-\d{2}-\d{4})(/?)$@', $uri, $matches)) { |
|
104 | - $date = $matches[1]; |
|
105 | - $date = explode('-', $date); |
|
106 | - $date = mktime(0, 0, 0, date('n', strtotime($date[0])), $date[1], $date[2]); |
|
107 | - $date = date('Y-m-d', $date); |
|
108 | - $result = LogCollector::getByDate($date); |
|
109 | - if ($result !== null) { |
|
110 | - return "/journal/{$result->alias}/"; |
|
111 | - } else { |
|
112 | - Loader::loadNew('controller', '/Error404Controller')->activate(); |
|
113 | - } |
|
114 | - } |
|
103 | + if (preg_match('@/log/([a-z]+-\d{2}-\d{4})(/?)$@', $uri, $matches)) { |
|
104 | + $date = $matches[1]; |
|
105 | + $date = explode('-', $date); |
|
106 | + $date = mktime(0, 0, 0, date('n', strtotime($date[0])), $date[1], $date[2]); |
|
107 | + $date = date('Y-m-d', $date); |
|
108 | + $result = LogCollector::getByDate($date); |
|
109 | + if ($result !== null) { |
|
110 | + return "/journal/{$result->alias}/"; |
|
111 | + } else { |
|
112 | + Loader::loadNew('controller', '/Error404Controller')->activate(); |
|
113 | + } |
|
114 | + } |
|
115 | 115 | |
116 | - if (preg_match('@/map/([a-z\'-]+)(/?)$@', $uri, $matches)) { |
|
117 | - $alias = $matches[1]; |
|
118 | - $alias = str_replace("'", '', $alias); |
|
119 | - $alias .= '-falls'; |
|
120 | - $result = WaterfallCollector::getByOldAlias($alias); |
|
121 | - if ($result !== null) { |
|
122 | - return "/map/#{$result->watercourse_alias}/{$result->alias}"; |
|
123 | - } else { |
|
124 | - Loader::loadNew('controller', '/Error404Controller')->activate(); |
|
125 | - } |
|
126 | - } |
|
116 | + if (preg_match('@/map/([a-z\'-]+)(/?)$@', $uri, $matches)) { |
|
117 | + $alias = $matches[1]; |
|
118 | + $alias = str_replace("'", '', $alias); |
|
119 | + $alias .= '-falls'; |
|
120 | + $result = WaterfallCollector::getByOldAlias($alias); |
|
121 | + if ($result !== null) { |
|
122 | + return "/map/#{$result->watercourse_alias}/{$result->alias}"; |
|
123 | + } else { |
|
124 | + Loader::loadNew('controller', '/Error404Controller')->activate(); |
|
125 | + } |
|
126 | + } |
|
127 | 127 | |
128 | 128 | return $uri; |
129 | 129 | } |
@@ -164,9 +164,9 @@ discard block |
||
164 | 164 | (object) array( |
165 | 165 | 'match' => '/map/', |
166 | 166 | 'controller' => 'MapController'), |
167 | - (object) array( |
|
168 | - 'match' => '/map/#[a-z-/]+', |
|
169 | - 'controller' => 'MapController'), |
|
167 | + (object) array( |
|
168 | + 'match' => '/map/#[a-z-/]+', |
|
169 | + 'controller' => 'MapController'), |
|
170 | 170 | (object) array( |
171 | 171 | 'match' => '/journal/', |
172 | 172 | 'controller' => 'LogListController'), |
@@ -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 |
@@ -20,6 +20,6 @@ |
||
20 | 20 | ) |
21 | 21 | ); |
22 | 22 | |
23 | -Router::route($redirect,$direct); |
|
23 | +Router::route($redirect, $direct); |
|
24 | 24 | |
25 | 25 | ?> |
26 | 26 | \ No newline at end of file |
@@ -7,27 +7,27 @@ |
||
7 | 7 | class MysqlPostRepository implements PostRepository |
8 | 8 | { |
9 | 9 | |
10 | - protected $connections; |
|
10 | + protected $connections; |
|
11 | 11 | |
12 | - public function __construct(ConnectionLocator $connections) |
|
13 | - { |
|
14 | - $this->connections = $connections; |
|
15 | - } |
|
12 | + public function __construct(ConnectionLocator $connections) |
|
13 | + { |
|
14 | + $this->connections = $connections; |
|
15 | + } |
|
16 | 16 | |
17 | - // todo make this smarter - it should parse by category as well |
|
18 | - public function findByUri($uri) |
|
19 | - { |
|
20 | - $query = " |
|
17 | + // todo make this smarter - it should parse by category as well |
|
18 | + public function findByUri($uri) |
|
19 | + { |
|
20 | + $query = " |
|
21 | 21 | SELECT `id`, `title`, `path`, `date`, `body`, `category` |
22 | 22 | FROM `jpemeric_blog`.`post` |
23 | 23 | WHERE `path` = :uri AND `display` = '1' |
24 | 24 | LIMIT 1"; |
25 | - $bindings = [ |
|
26 | - 'uri' => $uri, |
|
27 | - ]; |
|
28 | - return $this |
|
29 | - ->connections |
|
30 | - ->getRead() |
|
31 | - ->fetchOne($query, $bindings); |
|
32 | - } |
|
25 | + $bindings = [ |
|
26 | + 'uri' => $uri, |
|
27 | + ]; |
|
28 | + return $this |
|
29 | + ->connections |
|
30 | + ->getRead() |
|
31 | + ->fetchOne($query, $bindings); |
|
32 | + } |
|
33 | 33 | } |
@@ -4,5 +4,5 @@ |
||
4 | 4 | |
5 | 5 | interface PostRepository |
6 | 6 | { |
7 | - public function findByUri($uri); |
|
7 | + public function findByUri($uri); |
|
8 | 8 | } |
@@ -26,7 +26,7 @@ |
||
26 | 26 | { |
27 | 27 | //if(!$this->time_to_run($frequency)) |
28 | 28 | // continue; |
29 | - if ($cron != 'TwitterCron') continue; |
|
29 | + if ($cron != 'TwitterCron') continue; |
|
30 | 30 | |
31 | 31 | Loader::load('utility', "cron/{$cron}"); |
32 | 32 | $reflection = new ReflectionClass($cron); |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | |
23 | 23 | public function activate() |
24 | 24 | { |
25 | - foreach(self::$CRON_ARRAY as $cron => $frequency) |
|
25 | + foreach (self::$CRON_ARRAY as $cron => $frequency) |
|
26 | 26 | { |
27 | 27 | //if(!$this->time_to_run($frequency)) |
28 | 28 | // continue; |
@@ -49,19 +49,19 @@ discard block |
||
49 | 49 | $operator = explode(' ', $frequency); |
50 | 50 | list($time['minute'], $time['hour'], $time['day'], $time['month'], $time['weekday']) = $operator; |
51 | 51 | |
52 | - foreach($time as $key => $value) |
|
52 | + foreach ($time as $key => $value) |
|
53 | 53 | { |
54 | - if($value == '*') |
|
54 | + if ($value == '*') |
|
55 | 55 | continue; |
56 | - if(stristr($value, '/')) |
|
56 | + if (stristr($value, '/')) |
|
57 | 57 | { |
58 | 58 | $value = substr($value, 2); |
59 | - if($cur[$key] % $value == 0) |
|
59 | + if ($cur[$key] % $value == 0) |
|
60 | 60 | continue; |
61 | 61 | else |
62 | 62 | return; |
63 | 63 | } |
64 | - if($cur[$key] == $value) |
|
64 | + if ($cur[$key] == $value) |
|
65 | 65 | continue; |
66 | 66 | return; |
67 | 67 | } |
@@ -26,7 +26,9 @@ discard block |
||
26 | 26 | { |
27 | 27 | //if(!$this->time_to_run($frequency)) |
28 | 28 | // continue; |
29 | - if ($cron != 'TwitterCron') continue; |
|
29 | + if ($cron != 'TwitterCron') { |
|
30 | + continue; |
|
31 | + } |
|
30 | 32 | |
31 | 33 | Loader::load('utility', "cron/{$cron}"); |
32 | 34 | $reflection = new ReflectionClass($cron); |
@@ -51,18 +53,21 @@ discard block |
||
51 | 53 | |
52 | 54 | foreach($time as $key => $value) |
53 | 55 | { |
54 | - if($value == '*') |
|
55 | - continue; |
|
56 | + if($value == '*') { |
|
57 | + continue; |
|
58 | + } |
|
56 | 59 | if(stristr($value, '/')) |
57 | 60 | { |
58 | 61 | $value = substr($value, 2); |
59 | - if($cur[$key] % $value == 0) |
|
60 | - continue; |
|
61 | - else |
|
62 | - return; |
|
62 | + if($cur[$key] % $value == 0) { |
|
63 | + continue; |
|
64 | + } else { |
|
65 | + return; |
|
66 | + } |
|
67 | + } |
|
68 | + if($cur[$key] == $value) { |
|
69 | + continue; |
|
63 | 70 | } |
64 | - if($cur[$key] == $value) |
|
65 | - continue; |
|
66 | 71 | return; |
67 | 72 | } |
68 | 73 | return true; |