public function rel($relativeUri) { $relativeUri = $relativeUri instanceof uri ? $relativeUri : uri::fromString(strval($relativeUri)); $rel = new uri(); $rel->setPath(array_merge($this->_uri->getPath(), $relativeUri->getPath())); return $rel; }
public function arel($relativeUri = '', $absolute = false, $stripLast = false) { $relativeUri = strval($relativeUri); //if (is_object($relativeUri)) if (is_string($relativeUri)) { $relativeUri = uri::fromString($relativeUri); } $a = array(); $rel = $this->_relativeUri->getPath(); if ($stripLast) { $xrel = array_reverse($rel); $stripa = $relativeUri->getPath(); foreach ($xrel as $action) { $stripAction = array_pop($stripa); if ($action != $stripAction) { break; } array_pop($rel); } } //$relativeUri foreach ($rel as $action) { $a[] = $action; } if (!is_object($relativeUri)) { throw new Exception('$relativeUri not an object'); } $relativeUri->setPath(array_merge($this->_baseUri->getPath(), $a, $relativeUri->getPath())); if ($absolute) { return 'http://' . request::getDomainName() . $relativeUri; } return $relativeUri; }
public function wrel($relativeUri = '') { $relativeUri = strval($relativeUri); if (is_string($relativeUri)) { $relativeUri = uri::fromString($relativeUri); } if (!is_object($relativeUri)) { throw new Exception('$relativeUri not an object'); } $relativeUri->setPath(array_merge($this->_widgetUri->getPath(), $relativeUri->getPath())); return $relativeUri; }
public function rel($uri) { if (!is_object($uri)) { $uri = uri::fromString(strval($uri)); } $rel = clone $this; $path = $rel->getPath(); foreach ($uri->getPath() as $p) { $path[] = $p; } $rel->setPath($path); return $rel; }
public function setRelativeUriFromBase($uriString) { $baseUri = uri::fromString($uriString); $this->_relativeUri = uri::fromRequestUri(); $this->_relativeUri->subtractBase($baseUri); }