mirror of
https://github.com/skipperbent/simple-php-router.git
synced 2026-06-20 02:01:26 +00:00
Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 6e14ded03f | |||
| eb3ddf2bf7 | |||
| 2afe784f47 | |||
| 899081f8d8 | |||
| 94e98ad5f0 | |||
| e7b9206bc9 | |||
| 8f24256434 | |||
| ec355c90b5 |
@@ -384,7 +384,7 @@ Example:
|
||||
* @return \Pecee\Http\Input\Input
|
||||
*/
|
||||
function input() {
|
||||
return new \Pecee\Http\Input\Input();
|
||||
return \Pecee\Http\Request::getInstance()->getInput();
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
@@ -89,7 +89,7 @@ class Input {
|
||||
return ($key !== null && isset($item->getValue()[$key])) ? $item->getValue()[$key] : $item->getValue();
|
||||
}
|
||||
|
||||
return ($item->getValue() === null) ? $default : $item->getValue();
|
||||
return (trim($item->getValue()) === '') ? $default : $item->getValue();
|
||||
}
|
||||
|
||||
return $default;
|
||||
|
||||
@@ -125,13 +125,11 @@ class Request {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get request input or default value
|
||||
* @param string $name
|
||||
* @param string $defaultValue
|
||||
* @return mixed
|
||||
* Get input class
|
||||
* @return Input
|
||||
*/
|
||||
public function getInput($name, $defaultValue) {
|
||||
return (isset($_REQUEST[$name]) ? $_REQUEST[$name] : $defaultValue);
|
||||
public function getInput() {
|
||||
return $this->input;
|
||||
}
|
||||
|
||||
public function isFormatAccepted($format) {
|
||||
|
||||
@@ -111,13 +111,6 @@ class RouterBase {
|
||||
|
||||
$originalUri = $this->request->getUri();
|
||||
|
||||
// Load group middlewares
|
||||
|
||||
/* @var $middleware RouterEntry */
|
||||
foreach($this->middlewaresToLoad as $middleware) {
|
||||
$middleware->loadMiddleware($this->request);
|
||||
}
|
||||
|
||||
// Initialize boot-managers
|
||||
if(count($this->bootManagers)) {
|
||||
/* @var $manager RouterBootManager */
|
||||
@@ -138,6 +131,12 @@ class RouterBase {
|
||||
// Loop through each route-request
|
||||
$this->processRoutes($this->routes);
|
||||
|
||||
// Load group middlewares
|
||||
/* @var $route RouterEntry */
|
||||
foreach($this->middlewaresToLoad as $route) {
|
||||
$route->loadMiddleware($this->request);
|
||||
}
|
||||
|
||||
$routeNotAllowed = false;
|
||||
|
||||
// Make sure routes with longer urls are rendered first
|
||||
@@ -309,7 +308,7 @@ class RouterBase {
|
||||
return '';
|
||||
}
|
||||
|
||||
protected function processUrl($route, $method = null, $parameters = null, $getParams = null) {
|
||||
protected function processUrl(RouterRoute $route, $method = null, $parameters = null, $getParams = null) {
|
||||
|
||||
$domain = '';
|
||||
|
||||
|
||||
Reference in New Issue
Block a user