Returns the "system" URI string.
System URI is the URI for internal content controller.
E.g. /content/location/123/full.

If current route is not an URLAlias, then the current Pathinfo is returned.

@return null|string
185974
public function getSystemUriString()
    {
        $request = $this->getCurrentRequest();
        if ($request) {
            if ($request->attributes->get('_route') === UrlAliasRouter::URL_ALIAS_ROUTE_NAME) {
                return $this->router
                    ->generate(
                        '_ezpublishLocation',
                        array(
                            'locationId' => $request->attributes->get('locationId'),
                            'viewType' => $request->attributes->get('viewType'),
                        )
                    );
            }

            return $this->getRequestedUriString();
        }
    }
156177
public function getPathInfo()
	{
		$path = trim($this->uri->getPath(false), '/');
		
		if($this->pathBase == '')
		{
			return $path;
		}
		
		if($path == $this->pathBase)
		{
			return '';
		}
		
		return preg_replace("'^" . preg_quote($this->pathBase, "'") . "/'i", '', $path);
	}
782287
public function uri()
    {
        $uri = (!empty($this->url['scheme']) ? $this->url['scheme'] . '://' : Server::getInstance()->get('scheme', ''));
        $uri .= (!empty($this->url['user']) ? $this->url['user'] . ':' . $this->url['pass'] . '@' : '');
        $uri .= (!empty($this->url['host']) ? $this->url['host'] : Server::getInstance()->get('host', ''));
        $uri .= (!empty($this->url['port']) ? ':' . $this->url['port'] : '');
        $uri .= (!empty($this->url['path']) ? $this->url['path'] : '');
        $uri .= (!empty($this->url['query']) ? '?' . $this->url['query'] : '');
        $uri .= (!empty($this->url['fragment']) ? '#' . $this->url['fragment'] : '');

        return $uri;
    }
76072
public function getRouteNameAndParams()
    {
        if (empty($this->id)) {
            return null;
        }

        // No links for records that are 'viewless'
        if (isset($this->contenttype['viewless']) && $this->contenttype['viewless'] === true) {
            return null;
        }

        list($name, $config) = $this->getRouteConfig();

        if (!$config) {
            return null;
        }

        $slug = $this->getLinkSlug();
        $availableParams = array_filter(
            array_merge(
                $config['defaults'] ?: [],
                $this->getRouteRequirementParams($config),
                [
                    'contenttypeslug' => $this->contenttype['singular_slug'],
                    'id'              => $this->id,
                    'slug'            => $slug,
                ]
            )
        );

        /** @var Route|null $route */
        $route = $this->app['routes']->get($name);
        if (!$route) {
            return null;
        }

        // Needed params as array keys
        $pathVars = $route->compile()->getPathVariables();
        $neededKeys = array_flip($pathVars);

        // Set the values of neededKeys from the availableParams.
        // This removes extra parameters that are not needed for url generation.
        $params = array_replace($neededKeys, array_intersect_key($availableParams, $neededKeys));

        return [$name, $params];
    }
1361801
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, '', '&');
			}
		}

		// 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;
	}
520753
public static function getSiteUrl()
    {
        if (!self::hasServerVariable('HTTP_HOST')) {
            return null;
        }
        
        $protocol = (self::looksLikeHttps()) ? 'https' : 'http';
        $port = self::getServerVariable('SERVER_PORT', 80);
        
        list ($host) = explode(':', self::getServerVariable('HTTP_HOST'));
        
        if (!in_array($port, [
            80,
            443
        ]) || ($protocol != 'https' && $port == 443)) {
            $host .= ':' . $port;
        }
        
        $fullUrl = $protocol . '://' . $host . '/';
        if (USE_INDEX_FILE) {
            $fullUrl .= 'index.php/';
        }
        
        return $fullUrl;
    }
1025992
public function getSeoUri()
    {
        if ( ! empty( $this->_seoUri ) )
        {
            return $this->_seoUri;
        }

        if ( empty( $this->id ) )
        {
            return '';
        }

        if ( empty( $this->_seoUri ) )
        {
            $this->_seoUriStructure = $this->getUriStructure( array(
                $this->getMapper()
                     ->getLocale()
            ) );

            if ( ! empty( $this->_seoUriStructure ) )
            {
                $this->_seoUri = $this->_seoUriStructure->uri;
            }
        }

        return $this->_seoUri;
    }
1064154
public function getPathInfo()
    {
        if ($this->pathInfo === null) {
            $end = strpos($this->uri, '?');

            if ($end === false) {
                $this->pathInfo = $this->uri;
            }else{
                $this->pathInfo = substr($this->uri, 0, $end);
            }

            if (empty($this->pathInfo)) {
                $this->pathInfo = '/';
            }
        }
        
        return $this->pathInfo;
    }
237487
public function findRoute()
    {
        $pathinfo = !empty($_SERVER['PATH_INFO']) && $_SERVER['PATH_INFO'] != '/' ? $_SERVER['PATH_INFO'] : '/index/index';
        $items    = $pathinfo ? explode('/', ltrim($pathinfo, '/')) : [];
        $count    = count($items);

        foreach ($this->routes as $value) {
            if ($count === $value['count'] && !is_null($value['action'])
                && ($value['method'] === 'ALL' || $_SERVER['REQUEST_METHOD'] === $value['method'])
            ) {
                // match full uri
                if ($pathinfo === '/' . implode('/', $value['params'])) {
                    return [strtolower(substr($value['controller'], strrpos($value['controller'], '\\') + 1, -10)), $value['action'], $value['controller']];
                }

                // match RESTful uri
                $f = false;
                $url_args = [];
                foreach ($items as $k => $v) {
                    $slug = $value['params'][$k];

                    $origin_key_pos = strpos($slug, '(');
                    if ($origin_key_pos !== false) {
                        // match :id(\d+)
                        $preg = substr($slug, $origin_key_pos + 1, -1);
                        if (preg_match('/^' . $preg . '$/', $v) > 0) {
                            $f = true;
                            $slug = substr($slug, 1, $origin_key_pos - 1);
                            $url_args[$slug] = $v;
                            continue;
                        }
                    } elseif (substr($slug, 0, 1) === ':') {
                        // match :id
                        $f = true;
                        $slug = substr($slug, 1);
                        $url_args[$slug] = $v;
                        continue;
                    }
                }

                // Match uri success
                if ($f) {
                    if (count($url_args) > 0) {
                        $_GET = array_merge($_GET, $url_args);
                    }

                    return [strtolower(substr($value['controller'], strrpos($value['controller'], '\\') + 1, -10)), $value['action'], $value['controller']];
                }
            } elseif (is_null($value['action'])) {
                // match auto route
                $controller_name = strtolower(substr($value['controller'], strrpos($value['controller'], '\\') + 1, -10));

                if ($value['count'] === 0 && $items[0] === $controller_name) {
                    // has not prefixUri
                    return [$controller_name, isset($items[1])?$items[1]:'index', $value['controller']];
                } elseif ($value['count'] > 0) {
                    // has prefixUri
                    $prefix = '/' . implode('/', $value['params']);
                    // check has same prefix uri
                    if (substr($pathinfo, 0, strlen($prefix)) === $prefix) {
                        $items = $pathinfo ? explode('/', substr($pathinfo, strlen($prefix)+1)) : [];
                        // not contains prefix uri, and it must match controller name
                        if ($items[0] === $controller_name) {
                            return [$controller_name, empty($items[1])?'index':$items[1], $value['controller']];
                        }
                    }
                }
            }
        }

        return [];
    }
28065
public function getBaseUri()
    {
        $controller = $this;
        return preg_replace_callback('/:(\w+)/', function ($matches) use ($controller) {
            return $controller->routeData($matches[1]);
        }, $this->baseUri);
    }
33558
public static function uri()
	{
		if (static::$detected_uri !== null)
		{
			return static::$detected_uri;
		}

		if (\Fuel::$is_cli)
		{
			if ($uri = \Cli::option('uri') !== null)
			{
				static::$detected_uri = $uri;
			}
			else
			{
				static::$detected_uri = \Cli::option(1);
			}

			return static::$detected_uri;
		}

		// We want to use PATH_INFO if we can.
		if ( ! empty($_SERVER['PATH_INFO']))
		{
			$uri = $_SERVER['PATH_INFO'];
		}
		// Only use ORIG_PATH_INFO if it contains the path
		elseif ( ! empty($_SERVER['ORIG_PATH_INFO']) and ($path = str_replace($_SERVER['SCRIPT_NAME'], '', $_SERVER['ORIG_PATH_INFO'])) != '')
		{
			$uri = $path;
		}
		else
		{
			// Fall back to parsing the REQUEST URI
			if (isset($_SERVER['REQUEST_URI']))
			{
				$uri = strpos($_SERVER['SCRIPT_NAME'], $_SERVER['REQUEST_URI']) !== 0 ? $_SERVER['REQUEST_URI'] : '';
			}
			else
			{
				throw new \FuelException('Unable to detect the URI.');
			}

			// Remove the base URL from the URI
			$base_url = parse_url(\Config::get('base_url'), PHP_URL_PATH);
			if ($uri != '' and strncmp($uri, $base_url, strlen($base_url)) === 0)
			{
				$uri = substr($uri, strlen($base_url) - 1);
			}

			// If we are using an index file (not mod_rewrite) then remove it
			$index_file = \Config::get('index_file');
			if ($index_file and strncmp($uri, $index_file, strlen($index_file)) === 0)
			{
				$uri = substr($uri, strlen($index_file));
			}

			// When index.php? is used and the config is set wrong, lets just
			// be nice and help them out.
			if ($index_file and strncmp($uri, '?/', 2) === 0)
			{
				$uri = substr($uri, 1);
			}

			// decode the uri, and put any + back (does not mean a space in the url path)
			$uri = str_replace("\r", '+', urldecode(str_replace('+', "\r", $uri)));

			// Lets split the URI up in case it contains a ?.  This would
			// indicate the server requires 'index.php?' and that mod_rewrite
			// is not being used.
			preg_match('#(.*?)\?(.*)#i', $uri, $matches);

			// If there are matches then lets set set everything correctly
			if ( ! empty($matches))
			{
				$uri = $matches[1];

				// only reconstruct $_GET if we didn't have a query string
				if (empty($_SERVER['QUERY_STRING']))
				{
					$_SERVER['QUERY_STRING'] = $matches[2];
					parse_str($matches[2], $_GET);
					$_GET = \Security::clean($_GET);
				}
			}
		}

		// Deal with any trailing dots
		$uri = rtrim($uri, '.');

		// Do we have a URI and does it not end on a slash?
		if ($uri and substr($uri, -1) !== '/')
		{
			// Strip the defined url suffix from the uri if needed
			$ext = strrchr($uri, '.');
			$path = $ext === false ? $uri : substr($uri, 0, -strlen($ext));

			// Did we detect something that looks like an extension?
			if ( ! empty($ext))
			{
				// if it has a slash in it, it's a URI segment with a dot in it
				if (strpos($ext,'/') === false)
				{
					static::$detected_ext = ltrim($ext, '.');

					if (\Config::get('routing.strip_extension', true))
					{
						$uri = $path;
					}
				}
			}
		}

		// Do some final clean up of the uri
		static::$detected_uri = \Security::clean_uri($uri, true);

		return static::$detected_uri;
	}
801835
public function getFullPath()
    {
        /** @var Uri $uri */
        $uri = $this->getUri();

        return rtrim($uri->getBasePath(), '/') . '/' . ltrim($uri->getPath(), '/');
    }
438653
public function getRequestUri()
    {
        if (isset($this->env['REQUEST_URI'])) {
            $uri = $this->env['REQUEST_URI'];
        } else {
            $uri = "/";
        }
        if (strstr($uri, "?")) {
            $uri = strstr($uri, "?", true);
        }
        return $uri;
    }
653109
public function getUri(): string
    {
        foreach ($this->getParameterArray() as $parameter) {
            if (property_exists($this, $parameter)) {
                if (isset($this->$parameter)) {
                    $this->uri = str_replace('{' . $parameter . '}', $this->$parameter, $this->uri);
                } else {
                    $this->uri = str_replace('&'. $parameter . '={' . $parameter . '}', '', $this->uri);
                }
            }
        }
        foreach ($this->extraParameters as $parameter => $function) {
            $this->uri = str_replace('{' . $parameter . '}', $this->$function(), $this->uri);
        }
        return $this->uri;
    }
51040
public function getPathInfo()
    {
        if ($this->pathInfo == null) {
            if ($this->server->get('PATH_INFO')) {
                $this->pathInfo = $this->server->get('PATH_INFO');
            } else {
                $query = $this->getQueryString();
                $uri = $this->getUri();
                $this->pathInfo = rtrim(str_replace('?'.$query, '', $uri), '/');
            }
        }
        return $this->pathInfo;
    }
363580
public function uri(){
        $basepath = implode('/', array_slice(explode('/', $_SERVER['SCRIPT_NAME']), 0, -1)) . '/';
        $uri = substr($_SERVER['REQUEST_URI'], strlen($basepath));
        if (strstr($uri, '?')) $uri = substr($uri, 0, strpos($uri, '?'));
        $uri = '/' . trim($uri, '/');
        return $uri;
    }
759116
public function path(): string
    {
        $path = $this->uri()->getPath();

        if (empty($path)) {
            return '/';
        } elseif ($path[0] !== '/') {
            return '/' . $path;
        }

        return $path;
    }