Implementing middlewares 0.5
This commit is contained in:
@@ -139,6 +139,7 @@ class Route{
|
||||
|
||||
//=======================================================
|
||||
function execute(){
|
||||
|
||||
foreach ($this->_before as $key => $before){
|
||||
if(!in_array($key, $this->_middlewares_to_ignore) ){
|
||||
call_user_func($before);
|
||||
@@ -209,7 +210,7 @@ class Route{
|
||||
}
|
||||
|
||||
function middleware_ignore($name = ''){
|
||||
$this->_middlewares_to_ignore[$name];
|
||||
$this->_middlewares_to_ignore[] = $name;
|
||||
}
|
||||
|
||||
function middleware_add($name = '', $function){
|
||||
|
||||
@@ -94,7 +94,7 @@ class RouteCollection{
|
||||
$verb = "CLI";
|
||||
}else{
|
||||
$verb = strtoupper( $_SERVER['REQUEST_METHOD'] );
|
||||
}
|
||||
}
|
||||
|
||||
if(in_array($verb, self::$_verbs_whitelist)){
|
||||
$this->_verb = $verb;
|
||||
|
||||
Reference in New Issue
Block a user