get/set baseURI

@param  string   $href
@return string
11542
public function baseURI($href = null)
    {
        if (func_num_args() < 1) {
            $href = @$this->_prop['baseURI'];
        } else {
            if ($href) {
                $t = self::get_url_base($href, true);
                if (!$t) {
                    return false;
                }

                list($bh, $bu) = $t;
            } else {
                $bh = $bu = null;
            }
            $this->_prop['hostURL'] = $bh;
            $this->_prop['baseURL'] = $bu;
            $this->_prop['baseURI'] = $href;
        }

        return $href;
    }
601448
public function getCurrentUri() : string
    {
        $basePath = $this->getBaseUrl();
        $uri = $this->currentUrl;

        $this->base = $basePath;
        $uri = substr($uri, strlen($basePath));

        // Don't take query params into account on the URL
        if (strstr($uri, '?')) {
            $uri = substr($uri, 0, strpos($uri, '?'));
        }

        // Remove trailing slash + enforce a slash at the start
        $uri = '/'.trim($uri, '/');

        return $uri;
    }
362359
public function getBaseUri()
    {
        $script = $this->get('script');
        $base   = str_replace('\\', '/', dirname($script));

        if ($base != '/') {
            $url = strtolower($this->get('scheme')) . $this->get('name') . $base;
        } else {
            $url = strtolower($this->get('scheme')) . $this->get('name');
        }

        return $url;
    }
734036
public static function getUri() {
        if (self::$_uri === null) {
            $uri = explode('?', $_SERVER['REQUEST_URI'], 2)[0];
            self::$_uri = self::fixUri(substr($uri, strlen(BASE_URI)));
        }
        return self::$_uri;
    }
943003
public function getBaseUri()
    {
        if ('' !== $qs = $this->getQueryString()) {
            $qs = '?' . $qs;
        }

        return $this->getSchemeAndHost() . $this->getRequestUri() . $qs;
    }
739486
function uri($current = false)
    {
        if ($current && $this->is_changed('uri')){
            return $this->changes('uri');
        }
        return $this->_attributes['uri'];
    }
57790
public function create($uri = null, $baseuri = null)
    {
        if (empty($uri) && empty($baseuri)) {
            // Empty uri means baseurl
            return $this->baseUrl
                . (($this->urlType == self::URL_APPEND)
                    ? "/$this->scriptName"
                    : null);
        } elseif (empty($uri)) {
            // Empty uri means baseurl with appended $baseuri
            ;
        } elseif (substr($uri, 0, 7) == "http://"
            || substr($uri, 0, 8) == "https://"
            || substr($uri, 0, 2) == "//"
        ) {
            // Fully qualified, just leave as is.
            return $uri;
        } elseif ($uri[0] == "/") {
            // Absolute url, prepend with siteUrl
            //return rtrim($this->siteUrl . rtrim($uri, '/'), '/');
            return $this->siteUrl . $uri;
        } elseif ($uri[0] == "#"
            || $uri[0] == "?"
        ) {
            // Hashtag url to local page, or query part leave as is.
            return $uri;
        } elseif (substr($uri, 0, 7) == "mailto:"
            || substr(html_entity_decode($uri), 0, 7) == "mailto:") {
            // Leave mailto links as is
            // The odd fix is for markdown converting mailto: to UTF-8
            // Might be a better way to solve this...
            return $uri;
        }

        // Prepend uri with baseuri
        $uri = rtrim($uri, "/");
        if (!empty($baseuri)) {
            $uri = rtrim($baseuri, "/") . "/$uri";
        }

        // Remove the trailing index part of the url
        if (basename($uri) == "index") {
            $uri = dirname($uri);
        }

        if ($this->urlType == self::URL_CLEAN) {
            return rtrim($this->baseUrl . "/" . $uri, "/");
        } else {
            return rtrim($this->baseUrl . "/" . $this->scriptName . "/" . $uri, "/");
        }
    }
1214914
public function setBaseUri($baseUri)
    {
        if (is_string($baseUri)) {
            $baseUri = new Uri($baseUri);
        }

        $this->baseUri = $baseUri;
    }
1303545
protected function stripLinkBase($link)
    {
        // Trim baseURL
        $link = preg_replace('/^' . preg_quote(Director::baseURL(), '/') .'/', '', $link);

        // Trim link_base
        if ($linkBase = Config::inst()->get('DocumentationViewer', 'link_base')) {
            $link = preg_replace('/^' . preg_quote($linkBase, '/') .'\/?/', '', $link);
        }

        return $link;
    }
27893
public function getBaseURI()
    {
        $hostUri = $this->getHostURI();
        $apiName = ezpRestPrefixFilterInterface::getApiProviderName();
        $apiPrefix = eZINI::instance( 'rest.ini' )->variable( 'System', 'ApiPrefix');
        $uri = str_replace( $apiPrefix, $apiPrefix.'/'.$apiName, $this->uri );
        $baseUri = $hostUri.$uri;

        return $baseUri;
    }
942328
function urlFor($internalUri, $locale = NULL){
        $internalUri= ltrim($internalUri, '/');
        if($locale == NULL)return $this->request->realBaseUrl . $internalUri;
        else return $this->request->realBaseUrl . $locale . '/' . $internalUri;
    }
734411
public static function getBaseUrlFromMetaTag(&$html_source)
  {
    preg_match("#<{1}[ ]{0,}((?i)base){1}[ ]{1,}((?i)href|src)[ ]{0,}=[ ]{0,}(\"|'){0,1}([^\"'><\n ]{0,})(\"|'|>|<|\n| )# i", $html_source, $match);
    
    if (isset($match[4]))
    {
      $match[4] = trim($match[4]);
      return $match[4];
    }
    else return null;
  }
58791
public static function StaticBaseUri( $context )
	{
		if ( is_null( $context->RunningContext->BaseUri ) )
		    return Undefined::getValue();

		return new AnyUriValue( $context->RunningContext->BaseUri );
	}
944360
public function setUri( $uri )
    {
        $uri = (string) $uri;

        if ( empty( $uri ) )
        {
            $uri = '#';
        }
        else if ( ! preg_match( '(^(' . static::VALID_SCHEMES . '))', $uri ) )
        {
            if ( preg_match( '(^[a-z0-9-]+(\.[a-z0-9-]+)+(/.*)?$)', $uri ) )
            {
                $uri = static::DEFAULT_SCHEME . $uri;
            }
            else
            {
                $uri = '/' . ltrim( $uri, '/' );
            }
        }

        $this->uri = $uri;
        return $this;
    }
1309996
private static function _getBaseUri()
    {
        if (defined('MUNICIPIO_STYLEGUIDE_URI') && MUNICIPIO_STYLEGUIDE_URI != "") {
            $uri = MUNICIPIO_STYLEGUIDE_URI;
        } else {
            $uri = self::$_uri;
        }

        $uri = rtrim(apply_filters('Municipio/theme/styleguide_uri', $uri), '/');

        if (defined('STYLEGUIDE_VERSION') && STYLEGUIDE_VERSION != "") {
            $uri .= '/' . STYLEGUIDE_VERSION;
        }

        return $uri;
    }
1024831
public function getEmulatorBaseUri($baseUri, $emulatorHost = null)
    {
        if ($emulatorHost) {
            $baseUri = $this->emulatorBaseUri($emulatorHost);
        }

        return $baseUri;
    }
956439
private function resolveBaseUriVar() {
        $envName = 'APP_BASE_URI';
        $envValue = null;

        if (!isset($_SERVER[$envName]))
            $envName = 'REDIRECT_'.$envName;

        while (isset($_SERVER[$envName])) {
            $envValue = $_SERVER[$envName];
            $envName = 'REDIRECT_'.$envName;
        }
        return $envValue;
    }