| @@ 117-128 (lines=12) @@ | ||
| 114 | */ |
|
| 115 | public function blockMiddleware($action) |
|
| 116 | { |
|
| 117 | if (isset($this->middleware[$action]['block_middleware'])) { |
|
| 118 | if (isset($this->middleware[$action]['block_middleware'][$this->router->route->getTarget('block')])) { |
|
| 119 | $blocks = $this->middleware[$action]['block_middleware'][$this->router->route->getTarget('block')]; |
|
| 120 | if (is_array($blocks)) { |
|
| 121 | foreach ($blocks as $block) { |
|
| 122 | $this->callHandler($block); |
|
| 123 | } |
|
| 124 | } elseif (is_string($blocks)) { |
|
| 125 | return $this->callHandler($blocks); |
|
| 126 | } |
|
| 127 | } |
|
| 128 | } |
|
| 129 | return true; |
|
| 130 | } |
|
| 131 | ||
| @@ 163-172 (lines=10) @@ | ||
| 160 | public function routeMiddleware($action) |
|
| 161 | { |
|
| 162 | if (isset($this->middleware[$action]['route_middleware'])) { |
|
| 163 | if (isset($this->router->route->getPath()['middleware']) && class_exists($this->middleware[$action]['route_middleware'][$this->router->route->getPath()['middleware']])) { |
|
| 164 | $classes = $this->middleware[$action]['route_middleware'][$this->router->route->getPath()['middleware']]; |
|
| 165 | if (is_array($classes)) { |
|
| 166 | foreach ($classes as $class) { |
|
| 167 | $this->callHandler($class); |
|
| 168 | } |
|
| 169 | } elseif (is_string($classes)) { |
|
| 170 | return $this->callHandler($classes); |
|
| 171 | } |
|
| 172 | } |
|
| 173 | } |
|
| 174 | return true; |
|
| 175 | } |
|