/**
  * Setup the middleware your application will use.
  *
  * @param \Cake\Http\MiddlewareQueue $middleware The middleware queue to setup.
  * @return \Cake\Http\MiddlewareQueue The updated middleware.
  */
 public function middleware($middleware)
 {
     $middleware->add(new ErrorHandlerMiddleware(Configure::read('Error.exceptionRenderer')))->add(new AssetMiddleware())->add(new RoutingMiddleware());
     $middleware->push(new LanguageSwitcherMiddleware(Configure::read('LanguageSwitcher.Middleware')));
     $middleware->push(new \ADmad\Glide\Middleware\GlideMiddleware(Configure::read('Glide')));
     return $middleware;
 }
Exemplo n.º 2
0
 /**
  * @param \Psr\Http\Message\ServerRequestInterface $request  The server request
  * @param \Psr\Http\Message\ResponseInterface $response The response object
  * @return \Psr\Http\Message\ResponseInterface An updated response
  */
 public function __invoke(ServerRequestInterface $request, ResponseInterface $response)
 {
     $next = $this->middleware->get($this->index);
     if ($next) {
         $this->index++;
         return $next($request, $response, $this);
     }
     // End of the queue
     return $response;
 }
Exemplo n.º 3
0
 /**
  * Setup the middleware your application will use.
  *
  * @param \Cake\Http\MiddlewareQueue $middleware The middleware queue to setup.
  * @return \Cake\Http\MiddlewareQueue The updated middleware.
  */
 public function middleware($middleware)
 {
     $middleware->add(new AssetMiddleware())->add(new RoutingMiddleware())->add(new LocaleSelectorMiddleware(['locales' => ['en_US', 'en', 'fr_FR', 'fr']]));
     return $middleware;
 }
 /**
  * Setup the middleware your application will use.
  *
  * @param \Cake\Http\MiddlewareQueue $middleware The middleware queue to setup.
  * @return \Cake\Http\MiddlewareQueue The updated middleware.
  */
 public function middleware($middleware)
 {
     $middleware->add(new ErrorHandlerMiddleware(Configure::read('Error.exceptionRenderer')))->add(new AssetMiddleware())->add(new RoutingMiddleware());
     return $middleware;
 }