@@ -18,12 +18,12 @@ discard block |
||
18 | 18 | |
19 | 19 | private static function get_router_name() |
20 | 20 | { |
21 | - if(Request::isAJAX()) |
|
21 | + if (Request::isAJAX()) |
|
22 | 22 | return 'AJAXRouter'; |
23 | - if(URLDecode::getURI() == '/sitemap.xml') |
|
23 | + if (URLDecode::getURI() == '/sitemap.xml') |
|
24 | 24 | return 'SitemapRouter'; |
25 | 25 | |
26 | - switch(URLDecode::getSite()) |
|
26 | + switch (URLDecode::getSite()) |
|
27 | 27 | { |
28 | 28 | case 'ajax' : |
29 | 29 | return 'AjaxRouter'; |
@@ -68,36 +68,36 @@ discard block |
||
68 | 68 | |
69 | 69 | final protected function check_for_redirect($redirect_uri) |
70 | 70 | { |
71 | - foreach($this->get_redirect_array() as $check) |
|
71 | + foreach ($this->get_redirect_array() as $check) |
|
72 | 72 | { |
73 | 73 | $redirect_uri = preg_replace($check->pattern, $check->replace, $redirect_uri); |
74 | 74 | } |
75 | 75 | |
76 | 76 | $redirect_uri = $this->check_for_special_redirect($redirect_uri); |
77 | 77 | |
78 | - if($this->requires_trailing_slash() && substr($redirect_uri, -1) != '/') |
|
78 | + if ($this->requires_trailing_slash() && substr($redirect_uri, -1) != '/') |
|
79 | 79 | $redirect_uri .= '/'; |
80 | 80 | |
81 | 81 | if (URLDecode::getHost() == 'waterfalls.jacobemerick.com') { |
82 | 82 | $redirect_uri = 'http://' . (!Loader::isLive() ? 'dev' : 'www') . '.waterfallsofthekeweenaw.com' . $redirect_uri; |
83 | 83 | } |
84 | 84 | |
85 | - if($redirect_uri == URLDecode::getURI()) |
|
85 | + if ($redirect_uri == URLDecode::getURI()) |
|
86 | 86 | return; |
87 | 87 | |
88 | 88 | $controller_check = $redirect_uri; |
89 | - if(substr($redirect_uri, 0, 4) == 'http') |
|
89 | + if (substr($redirect_uri, 0, 4) == 'http') |
|
90 | 90 | $controller_check = preg_replace('@^http://([a-z\.]+)@', '', $redirect_uri); |
91 | 91 | |
92 | 92 | $controller = $this->get_controller($controller_check); |
93 | - if($controller == '/Error404Controller') |
|
93 | + if ($controller == '/Error404Controller') |
|
94 | 94 | { |
95 | 95 | Loader::loadNew('controller', '/Error404Controller') |
96 | 96 | ->activate(); |
97 | 97 | exit; |
98 | 98 | } |
99 | 99 | |
100 | - if(substr($redirect_uri, 0, 4) != 'http') |
|
100 | + if (substr($redirect_uri, 0, 4) != 'http') |
|
101 | 101 | { |
102 | 102 | $redirect_uri = substr($redirect_uri, 1); |
103 | 103 | $redirect_uri = URLDecode::getBase() . $redirect_uri; |
@@ -114,12 +114,12 @@ discard block |
||
114 | 114 | |
115 | 115 | final private function get_controller($uri) |
116 | 116 | { |
117 | - foreach($this->get_direct_array() as $check) |
|
117 | + foreach ($this->get_direct_array() as $check) |
|
118 | 118 | { |
119 | - if($uri == $check->match) |
|
119 | + if ($uri == $check->match) |
|
120 | 120 | return "{$this->get_primary_folder()}/{$check->controller}"; |
121 | 121 | |
122 | - if(preg_match("@^{$check->match}$@", $uri)) |
|
122 | + if (preg_match("@^{$check->match}$@", $uri)) |
|
123 | 123 | return "{$this->get_primary_folder()}/{$check->controller}"; |
124 | 124 | } |
125 | 125 | |
@@ -128,9 +128,9 @@ discard block |
||
128 | 128 | |
129 | 129 | final private function get_primary_folder() |
130 | 130 | { |
131 | - if(Request::isAjax()) |
|
131 | + if (Request::isAjax()) |
|
132 | 132 | return 'ajax'; |
133 | - if(URLDecode::getURI() == '/sitemap.xml') |
|
133 | + if (URLDecode::getURI() == '/sitemap.xml') |
|
134 | 134 | return 'sitemap'; |
135 | 135 | |
136 | 136 | return URLDecode::getSite(); |
@@ -18,10 +18,12 @@ discard block |
||
18 | 18 | |
19 | 19 | private static function get_router_name() |
20 | 20 | { |
21 | - if(Request::isAJAX()) |
|
22 | - return 'AJAXRouter'; |
|
23 | - if(URLDecode::getURI() == '/sitemap.xml') |
|
24 | - return 'SitemapRouter'; |
|
21 | + if(Request::isAJAX()) { |
|
22 | + return 'AJAXRouter'; |
|
23 | + } |
|
24 | + if(URLDecode::getURI() == '/sitemap.xml') { |
|
25 | + return 'SitemapRouter'; |
|
26 | + } |
|
25 | 27 | |
26 | 28 | switch(URLDecode::getSite()) |
27 | 29 | { |
@@ -75,19 +77,22 @@ discard block |
||
75 | 77 | |
76 | 78 | $redirect_uri = $this->check_for_special_redirect($redirect_uri); |
77 | 79 | |
78 | - if($this->requires_trailing_slash() && substr($redirect_uri, -1) != '/') |
|
79 | - $redirect_uri .= '/'; |
|
80 | + if($this->requires_trailing_slash() && substr($redirect_uri, -1) != '/') { |
|
81 | + $redirect_uri .= '/'; |
|
82 | + } |
|
80 | 83 | |
81 | 84 | if (URLDecode::getHost() == 'waterfalls.jacobemerick.com') { |
82 | 85 | $redirect_uri = 'http://' . (!Loader::isLive() ? 'dev' : 'www') . '.waterfallsofthekeweenaw.com' . $redirect_uri; |
83 | 86 | } |
84 | 87 | |
85 | - if($redirect_uri == URLDecode::getURI()) |
|
86 | - return; |
|
88 | + if($redirect_uri == URLDecode::getURI()) { |
|
89 | + return; |
|
90 | + } |
|
87 | 91 | |
88 | 92 | $controller_check = $redirect_uri; |
89 | - if(substr($redirect_uri, 0, 4) == 'http') |
|
90 | - $controller_check = preg_replace('@^http://([a-z\.]+)@', '', $redirect_uri); |
|
93 | + if(substr($redirect_uri, 0, 4) == 'http') { |
|
94 | + $controller_check = preg_replace('@^http://([a-z\.]+)@', '', $redirect_uri); |
|
95 | + } |
|
91 | 96 | |
92 | 97 | $controller = $this->get_controller($controller_check); |
93 | 98 | if($controller == '/Error404Controller') |
@@ -116,11 +121,13 @@ discard block |
||
116 | 121 | { |
117 | 122 | foreach($this->get_direct_array() as $check) |
118 | 123 | { |
119 | - if($uri == $check->match) |
|
120 | - return "{$this->get_primary_folder()}/{$check->controller}"; |
|
124 | + if($uri == $check->match) { |
|
125 | + return "{$this->get_primary_folder()}/{$check->controller}"; |
|
126 | + } |
|
121 | 127 | |
122 | - if(preg_match("@^{$check->match}$@", $uri)) |
|
123 | - return "{$this->get_primary_folder()}/{$check->controller}"; |
|
128 | + if(preg_match("@^{$check->match}$@", $uri)) { |
|
129 | + return "{$this->get_primary_folder()}/{$check->controller}"; |
|
130 | + } |
|
124 | 131 | } |
125 | 132 | |
126 | 133 | return '/Error404Controller'; |
@@ -128,10 +135,12 @@ discard block |
||
128 | 135 | |
129 | 136 | final private function get_primary_folder() |
130 | 137 | { |
131 | - if(Request::isAjax()) |
|
132 | - return 'ajax'; |
|
133 | - if(URLDecode::getURI() == '/sitemap.xml') |
|
134 | - return 'sitemap'; |
|
138 | + if(Request::isAjax()) { |
|
139 | + return 'ajax'; |
|
140 | + } |
|
141 | + if(URLDecode::getURI() == '/sitemap.xml') { |
|
142 | + return 'sitemap'; |
|
143 | + } |
|
135 | 144 | |
136 | 145 | return URLDecode::getSite(); |
137 | 146 | } |