getRelativeUrl() public méthode

Returns the relative-URI.
public getRelativeUrl ( ) : string
Résultat string
 /**
  * Pro zadane URL vytvori URL na minimalizacni skript
  * @param string $url
  * @param int $width [optional]
  * @param int $height [optional]
  * @return string
  */
 public function min($url, $width = NULL, $height = NULL, $topcut = FALSE)
 {
     $min = new Url($this->scriptUrl);
     $min->setQueryParameter('file', $url);
     if ($width) {
         $min->setQueryParameter('w', $width);
     }
     if ($height) {
         $min->setQueryParameter('h', $height);
     }
     if ($width && $height) {
         $min->setQueryParameter('exact', TRUE);
         if ($topcut) {
             $min->setQueryParameter('topcut', TRUE);
         }
     }
     $minUrl = "/" . $min->getRelativeUrl();
     return $minUrl;
 }
Exemple #2
0
 /**
  * @param Application\Request $appRequest
  * @param Http\Url $refUrl
  * @return NULL|string
  */
 public function constructUrl(Application\Request $appRequest, Http\Url $refUrl)
 {
     if (count($this->actionDictionary) > 0) {
         $appRequest = clone $appRequest;
         $params = $appRequest->getParameters();
         $params['action'] = 'default';
         // so the request matches with route with action dictionary
         $appRequest->setParameters($params);
     }
     $url = parent::constructUrl($appRequest, $refUrl);
     if ($url === NULL) {
         return NULL;
     }
     $httpUrl = new Http\Url($url);
     $httpUrl->query = Strings::replace($httpUrl->query, '/action=([a-zA-Z0-9_+%-]*)/i', '');
     return $httpUrl->getBasePath() . $httpUrl->getRelativeUrl();
 }