/**
  * @param \SS_HTTPRequest $request
  * @return \Heyday\Redirects\Redirect
  */
 public function getRedirectForRequest(\SS_HTTPRequest $request)
 {
     $url = $request->getURL();
     foreach ($this->dataSource->get() as $redirect) {
         if ($redirect->match($url)) {
             return $redirect;
         }
     }
     return false;
 }
Пример #2
0
 /**
  * @param \SS_HTTPRequest $request
  * @return \Heyday\Redirects\Redirect
  */
 public function getRedirectForRequest(\SS_HTTPRequest $request)
 {
     // Format the URL as the key will have been formatted
     $url = Redirect::formatUrl($request->getURL());
     $dataSource = $this->dataSource->get();
     // Check if there's a key for the URL
     if (isset($dataSource[$url])) {
         $redirect = $dataSource[$url];
         if ($redirect->match($url)) {
             return $redirect;
         }
     }
     return false;
 }