custom_query)) { $requestpath = $this->custom_query; } else { if(!empty($_SERVER['REQUEST_URI'])) { $requestpath = trim($_SERVER['REQUEST_URI']); } else { $requestpath = "/"; } } if($this->ignore_query === true) { if(strpos($requestpath, "?") !== false) { list($requestpath, $bogus) = explode("?", $requestpath, 2); } } $found = false; // Workaround because a break after an include apparently doesn't work in PHP. foreach($this->routes as $priority) { foreach($priority as $route_regex => $route_destination) { if($found === false) { if($this->allow_slash === true) { $route_regex = "{$route_regex}/?"; } $regex = str_replace("/", "\/", $route_regex); if(preg_match("/{$regex}/i", $requestpath, $matches)) { $this->uParameters = $matches; include($route_destination); $found = true; } } } } } }