mirror of
https://github.com/skipperbent/simple-php-router.git
synced 2026-06-26 21:19:14 +00:00
Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 5c36e9c652 | |||
| b930c06683 | |||
| 0f8bba7c32 | |||
| 19dc295199 |
@@ -30,6 +30,10 @@ class Request {
|
||||
$this->headers = array_change_key_case(getallheaders(), CASE_LOWER);
|
||||
}
|
||||
|
||||
public function getIsSecure() {
|
||||
return isset($_SERVER['HTTPS']) ? true : (isset($_SERVER['SERVER_PORT']) && $_SERVER['SERVER_PORT'] === 443);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
|
||||
@@ -42,12 +42,15 @@ class RouterRoute extends RouterEntry {
|
||||
$url = parse_url($request->getUri());
|
||||
$url = $url['path'];
|
||||
|
||||
$route = $this->url;
|
||||
$route = rtrim($this->url, '/') . '/';
|
||||
|
||||
$routeMatch = preg_replace('/\/{0,1}'.self::PARAMETERS_REGEX_MATCH.'\/{0,1}/is', '', $route);
|
||||
|
||||
$tmp = explode('/', $route);
|
||||
$tmp2 = explode('/', $url);
|
||||
|
||||
// Check if url parameter count matches
|
||||
if(stripos($url, $routeMatch) === 0) {
|
||||
if(stripos($url, $routeMatch) === 0 || count($tmp) === count($tmp2)) {
|
||||
|
||||
$matches = true;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user