Exemplo n.º 1
0
 public static function getAbsoluteRoute($path)
 {
     $url = UrlHelper::parse(UrlHelper::getRequestUrl());
     $url['path'] = self::getRelativePath(self::getRoute($path));
     $url['params'] = array();
     return UrlHelper::build($url);
 }
Exemplo n.º 2
0
 /**
  * @return string
  */
 public function buildUrl()
 {
     $url = UrlHelper::parse($this->getUrl());
     $get = $this->getArguments();
     if (!empty($get)) {
         foreach ($get as $arg => $val) {
             if ($this->getFlag() & self::REWRITE_SEGMENTS_QUERY) {
                 $url['params'][$arg] = null;
                 $path = '/' . $arg . '/';
                 if (1 === preg_match('#\\/' . $arg . '\\/[^\\/]*#i', $url['path'], $matches)) {
                     $url['path'] = str_replace($matches[0], '/' . $arg . '/' . urlencode($val), $url['path']);
                 } else {
                     $url['path'] .= '/' . $arg . '/' . urlencode($val);
                 }
             } else {
                 $url['params'][$arg] = $val;
             }
         }
     }
     $user = $this->getAuthentication('user');
     if (!empty($user)) {
         $url['user'] = $user;
     }
     $pwd = $this->getAuthentication('pwd');
     if (!empty($pwd)) {
         $url['pass'] = $pwd;
     }
     $built_url = UrlHelper::build($url);
     return $built_url;
 }