Generates a URI based on a serial stored in the database.

@access public
@author Jerome Bogaerts, <jerome.bogaerts@tudor.lu>
@return string
@throws common_UriProviderException
162654
public function provide()
    {
        $returnValue = (string) '';
        
        
        
        $dbWrapper = core_kernel_classes_DbWrapper::singleton();
        try {
            $sth = $this->getPersistence()->query($this->getPersistence()->getPlatForm()->getSqlFunction("generis_sequence_uri_provider"), array(
                    $this->getOption(self::OPTION_NAMESPACE)
            ));
       
            if ($sth !== false) {
                
                $row = $sth->fetch();
                
                $returnValue = current($row);
                $sth->closeCursor();
            } else {
                throw new UriProviderException("An error occured while calling the stored procedure for persistence ".$this->getOption(self::OPTION_PERSISTENCE).".");
            }
        } catch (Exception $e) {
        	throw new UriProviderException("An error occured while calling the stored ': " . $e->getMessage() . ".");
        }

        return (string) $returnValue;
    }
77520
public static function getURI()
    {
        $s = $_SERVER;
        $ssl = (!empty($s['HTTPS']) && $s['HTTPS'] == 'on');
        $sp = strtolower(array_get($s, 'SERVER_PROTOCOL', 'http://'));
        $protocol = substr($sp, 0, strpos($sp, '/')) . (($ssl) ? 's' : '');
        $port = array_get($s, 'SERVER_PORT', '80');
        $port = ((!$ssl && $port == '80') || ($ssl && $port == '443')) ? '' : ':' . $port;
        $host = (isset($s['HTTP_HOST']) ? $s['HTTP_HOST'] : array_get($s, 'SERVER_NAME', 'localhost'));
        $host = (strpos($host, ':') !== false) ? $host : $host . $port;

        return $protocol . '://' . $host;
    }
656284
private function buildRequestUrl()
    {
        if (!empty($_SERVER['REQUEST_URI'])) {
            return sprintf(
                '%s://%s%s%s',
                $this->guessProtocol(),
                $this->guessHost(),
                $this->guessPort(),
                $_SERVER['REQUEST_URI']
            );
        }
    }
979115
public function uri() {
		$uri = self::uriTrim();
		$webRoot = self::webRoot();
		$uri = str_replace($webRoot, '', $uri);
		$uri = trim($uri, '/');
		return $uri;
	}
71022
public function getUri()
    {
        $userPart = '';
        if ($this->getUser() !== null && $this->getPass() !== null) {
            $userPart = $this->getUser() . ':' . $this->getPass()  . '@';
        } else if ($this->getUser() !== null) {
            $userPart = $this->getUser() . '@';
        }
        $schemePart = ($this->getScheme() ? $this->getScheme() . '://' : '//');
        if (!in_array($this->getScheme(), self::getSchemesWithAuthority())) {
            $schemePart = $this->getScheme() . ':';
        }
        $portPart = ($this->getPort() ? ':' . $this->getPort() : '');
        $queryPart = ($this->getQuery() ? '?' . $this->getQuery() : '');
        $fragmentPart = ($this->getFragment() ? '#' . $this->getFragment() : '');
        if ($this->isRelative()) {
            return $this->getPath() .
            $queryPart .
            $fragmentPart;
        }
        $path = $this->getPath();
        if (0 !== strlen($path) && '/' !== $path[0]) {
            $path = '/' . $path;
        }
        return $schemePart .
        $userPart .
        $this->getHost() .
        $portPart .
        $path .
        $queryPart .
        $fragmentPart;
    }
624366
public function getUrl()
    {
        if(!isset($this->_url))
        {
            //Scheme
            $scheme = $this->getScheme();

            //Host
            $host   = $this->getHost();

            /*
             * Since we are assigning the URI from the server variables, we first need to determine if we
             * are running on apache or IIS.  If PHP_SELF and REQUEST_URI are present, we will assume we
             * are running on apache.
             */
            if (!empty ($_SERVER['PHP_SELF']) && !empty ($_SERVER['REQUEST_URI']))
            {
                //Prepend the protocol, and the http host to the URI string.
                $url = $scheme.'://'.$host . $_SERVER['REQUEST_URI'];
            }
            else
            {
                /*
                 * Since we do not have REQUEST_URI to work with, we will assume we are running on IIS
                 * and will therefore need to work some magic with the SCRIPT_NAME and QUERY_STRING
                 * environment variables.
                 */

                // IIS uses the SCRIPT_NAME variable instead of a REQUEST_URI variable
                $url = $scheme.'://'.$host . $_SERVER['SCRIPT_NAME'];

                // If the query string exists append it to the URI string
                if (isset($_SERVER['QUERY_STRING']) && !empty($_SERVER['QUERY_STRING'])) {
                    $url .= '?' . $_SERVER['QUERY_STRING'];
                }
            }

            // Sanitize the url since we can't trust the server var
            $url = $this->getObject('lib:filter.url')->sanitize($url);

            // Create the URI object
            $this->_url = $this->getObject('lib:http.url', array('url' => $url));

            //Set the url port
            $port = $this->getPort();

            if (($this->_url->scheme == 'http' && $port != 80) || ($this->_url->scheme == 'https' && $port != 443)) {
                $this->_url->port = $port;
            }

            //Set the user
            if($this->_headers->has('PHP_AUTH_USER'))
            {
                $this->_url->user = $this->_headers->get('PHP_AUTH_USER');

                if($this->_headers->has('PHP_AUTH_PW')) {
                    $this->_url->pass = $this->_headers->get('PHP_AUTH_PASS');
                }
            }
        }

        return $this->_url;
    }
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;
    }
800252
protected function _getHostFromUri()
    {
        $host  = $this->uri->getHost();
        $host .= $this->uri->getPort() ? ':' . $this->uri->getPort() : '';
        return $host;
    }
259012
protected static function generate_base_url()
	{
		$base_url = '';
		if(\Input::server('http_host'))
		{
			$base_url .= \Input::protocol().'://'.\Input::server('http_host');
		}
		if (\Input::server('script_name'))
		{
			$common = get_common_path(array(\Input::server('request_uri'), \Input::server('script_name')));
			$base_url .= $common;
		}

		// Add a slash if it is missing and return it
		return rtrim($base_url, '/').'/';
	}
493019
public function getUri()
    {
        if ($this->valid() === false) {
            require_once 'Zend/Uri/Exception.php';
            throw new Zend_Uri_Exception('One or more parts of the URI are invalid');
        }

        $password = strlen($this->_password) > 0 ? ":$this->_password" : '';
        $auth     = strlen($this->_username) > 0 ? "$this->_username$password@" : '';
        $port     = strlen($this->_port) > 0 ? ":$this->_port" : '';
        $query    = strlen($this->_query) > 0 ? "?$this->_query" : '';
        $fragment = strlen($this->_fragment) > 0 ? "#$this->_fragment" : '';

        return $this->_scheme
             . '://'
             . $auth
             . $this->_host
             . $port
             . $this->_path
             . $query
             . $fragment;
    }
542381
public function getUri(): string
    {
        $configuration = GeneralUtility::makeInstance(ConfigurationService::class);

        // Find host-name / IP, always in lowercase:
        $isHttp = (0 === \mb_strpos(GeneralUtility::getIndpEnv('TYPO3_REQUEST_HOST'), 'http://'));
        $uri = GeneralUtility::getIndpEnv('REQUEST_URI');
        if ($configuration->isBool('recreateURI')) {
            $uri = $this->recreateUriPath($uri);
        }

        $uri = ($isHttp ? 'http://' : 'https://') . \mb_strtolower(GeneralUtility::getIndpEnv('HTTP_HOST')) . '/' . \ltrim($uri, '/');

        try {
            $idnaConverter = GeneralUtility::makeInstance(IdnaConvert::class);

            return $idnaConverter->encode($uri);
        } catch (\InvalidArgumentException $exception) {
            // The URI is already in puny code (no logging needed)
            return $uri;
        }
    }
255383
public function getUri()
    {
        $schema = "http";

        if ($this->isSecure) {
            $schema = "https";
        }
        
        $uri = sprintf(
            "%s://%s%s",
            $schema,
            $this->serverName,
            $this->path
        );
        
        return new Uri($uri);
    }
994745
public function provide()
    {
        $returnValue = (string) '';
        
        $nextId = $this->getPersistence()->incr(self::PERSISTENCE_KEY);
        list($usec, $sec) = explode(" ", microtime());
        $uri = $this->getOption(self::OPTION_NAMESPACE) .'i'. (str_replace(".","",$sec."".$usec)) . $nextId;

        return (string) $uri;
    }
722780
protected function getCurrentUri() {
    $protocol = isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on'
      ? 'https://'
      : 'http://';
    $current_uri = $protocol . $_SERVER['HTTP_HOST'] . $this->getRequestUri();
    $parts = parse_url($current_uri);

    $query = '';
    if (!empty($parts['query'])) {
      $params = array();
      parse_str($parts['query'], $params);
      $params = array_filter($params);
      if (!empty($params)) {
        $query = '?' . http_build_query($params, NULL, '&');
      }
    }

    // Use port if non default.
    $port = isset($parts['port']) &&
      (($protocol === 'http://' && $parts['port'] !== 80) || ($protocol === 'https://' && $parts['port'] !== 443))
      ? ':' . $parts['port'] : '';

    // Rebuild.
    return $protocol . $parts['host'] . $port . $parts['path'] . $query;
  }
154246
protected function getHostFromUri()
    {
        $host = $this->uri->getHost();
        $host .= $this->uri->getPort() ? ':' . $this->uri->getPort() : '';

        return $host;
    }
1058112
public function getUri($uri) {
        $curieSeperator = ':';

        if (preg_match('/http(s*)\:\/\//', $uri) == false) {
            if (strpos($uri, $curieSeperator) !== false) {
                list($prefix, $action) = explode($curieSeperator, $uri);
                
                if(isset($this->WAMP->prefixes[$prefix]) === true){
                  return $this->WAMP->prefixes[$prefix] . '#' . $action;
                }
            }
        }

        return $uri;
    }
506470
protected function getAjaxUri()
    {
        $action = $this->arguments['action'];
        $arguments = $this->arguments['arguments'];

        if ($action === null) {
            $action = $this->controllerContext->getRequest()->getControllerActionName();
        }
        $arguments['@action'] = $action;
        if (strlen($this->arguments['format']) > 0) {
            $arguments['@format'] = $this->arguments['format'];
        }
        /** @var $widgetContext WidgetContext */
        $widgetContext = $this->controllerContext->getRequest()->getInternalArgument('__widgetContext');
        if ($widgetContext === null) {
            throw new WidgetContextNotFoundException('Widget context not found in <f:widget.uri>', 1307450639);
        }
        if ($this->arguments['includeWidgetContext'] === true) {
            $serializedWidgetContext = base64_encode(serialize($widgetContext));
            $arguments['__widgetContext'] = $this->hashService->appendHmac($serializedWidgetContext);
        } else {
            $arguments['__widgetId'] = $widgetContext->getAjaxWidgetIdentifier();
        }
        return '?' . http_build_query($arguments, null, '&');
    }