|
|
@@ -139,13 +139,12 @@ class Route{
|
|
|
|
|
|
//=======================================================
|
|
|
function execute(){
|
|
|
-
|
|
|
foreach ($this->_before as $key => $before){
|
|
|
- if(!in_array($key, $this->_middlewares_to_ignore) ){
|
|
|
+ if(!in_array($key, $this->_middlewares_to_ignore) && !$this->_ignore ){
|
|
|
call_user_func($before);
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
foreach ($this->_callback as $callback){
|
|
|
call_user_func_array($callback, $this->_params);
|
|
|
}
|
|
|
@@ -211,11 +210,17 @@ class Route{
|
|
|
|
|
|
function middleware_ignore($name = ''){
|
|
|
$this->_middlewares_to_ignore[] = $name;
|
|
|
+ return $this;
|
|
|
}
|
|
|
|
|
|
- function middleware_add($name = '', $function){
|
|
|
+ function middleware_add($name = ''){
|
|
|
+ $this->_before[$name] = $function;
|
|
|
+ }
|
|
|
+
|
|
|
+ function middleware_append($name = '', $function){
|
|
|
$this->_before[$name] = $function;
|
|
|
}
|
|
|
+
|
|
|
|
|
|
function set_weight($weigth = 0){
|
|
|
$this->_weight = $weigth;
|