Exemplo n.º 1
0
 /**
  * {@inheritdoc}
  */
 public function postFilter($url, Context $context)
 {
     if (!preg_match('|^[a-z]+://|', $url) && $url[0] !== '/') {
         $url = rtrim($context->getBaseUrl(), '/') . '/' . $url;
     }
     return $url;
 }
Exemplo n.º 2
0
 /**
  * {@inheritdoc}
  */
 public function match($pathInfo, Context $context)
 {
     if (strpos($pathInfo, '/backend/') === 0 || strpos($pathInfo, '/api/') === 0) {
         return $pathInfo;
     }
     if ($context->getShopId() === null) {
         //only frontend
         return $pathInfo;
     }
     $request = new EnlightRequest();
     $request->setBaseUrl($context->getBaseUrl());
     $request->setPathInfo($pathInfo);
     $event = $this->eventManager->notifyUntil('Enlight_Controller_Router_Route', ['request' => $request, 'context' => $context]);
     return $event !== null ? $event->getReturn() : false;
 }