Get the fully resolved path to the application's front controller.

@param  string  $sitePath
@param  string  $siteName
@param  string  $uri
@return string
424168
public function frontControllerPath($sitePath, $siteName, $uri)
    {
        if ($uri === '/install.php') {
            return $sitePath.'/web/install.php';
        }

        if (0 === strncmp($uri, '/app_dev.php', 12)) {
            $_SERVER['SCRIPT_NAME'] = '/app_dev.php';
            $_SERVER['SCRIPT_FILENAME'] = $sitePath.'/app_dev.php';

            return $sitePath.'/web/app_dev.php';
        }

        return $sitePath.'/web/app.php';
    }
624311
protected static function updatePath($base, $uri)
    {
        $path = $uri->getPath();
        if (strlen($base) > 0 && strpos($path, $base) === 0) {
            $path = substr($path, strlen($base));
        }
        if ($path === '/index.php' && $uri->getQuery()) {
            $path = $uri->getQuery();
        }
        if (empty($path) || $path === '/' || $path === '//' || $path === '/index.php') {
            $path = '/';
        }
        $endsWithIndex = '/' . (Configure::read('App.webroot') ?: 'webroot') . '/index.php';
        $endsWithLength = strlen($endsWithIndex);
        if (strlen($path) >= $endsWithLength &&
            substr($path, -$endsWithLength) === $endsWithIndex
        ) {
            $path = '/';
        }

        return $uri->withPath($path);
    }
331478
protected String getSitePath(String uri) {

        if (m_internal) {
            String siteRoot = getSiteRoot();
            if (siteRoot != null) {
                return uri.substring(siteRoot.length());
            } else {
                return uri;
            }
        }
        return null;
    }
680364
public function frontControllerPath($sitePath)
    {
        $_SERVER['SCRIPT_FILENAME'] = $this->sitePath($sitePath);
        $_SERVER['SCRIPT_NAME']     = $this->directoryIndex();

        return $_SERVER['SCRIPT_FILENAME'];
    }
98189
public String getCacheKey(String siteRoot, String uri) {

        return new StringBuffer(siteRoot).append(uri).toString();
    }
36976
function ( uri ) {
    var ret = {
        folder: false,
        redirect: false
    };

    uri = uri.replace( rSlash, "" );

    for ( var i = serverConfig.siteData.siteLayout.layout.length; i--; ) {
        var layout = serverConfig.siteData.siteLayout.layout[ i ];

        // Break out if folder matched
        if ( ret.folder ) {
            break;
        }

        // Skip hidden navigations
        //if ( layout.identifier === "_hidden" ) {
        //    continue;
        //}

        for ( var j = layout.links.length; j--; ) {
            var link = layout.links[ j ];

            // Matched a root level folder uri request
            if ( rIndexFolder.test( link.typeName ) && link.urlId === uri ) {
                if ( rFolder && keyFiles.folderList ) {
                    break;

                } else if ( rIndex && keyFiles.indexList ) {
                    break;

                } else {
                    ret.folder = true;
                    ret.redirect = ("/" + link.children[ 0 ].urlId + "/");
                    break;
                }
            }
        }
    }

    return ret;
}
739005
public function frontControllerPath($sitePath, $siteName, $uri)
    {
        $sitePath = $this->addSubdirectory($sitePath);

        if (!isset($_GET['q']) && !empty($uri) && $uri !== '/') {
          $_GET['q'] = $uri;
        }

        $matches = [];
        if (preg_match('/^\/(.*?)\.php/', $uri, $matches)) {
            $filename = $matches[0];
            if (file_exists($sitePath.$filename) && ! is_dir($sitePath.$filename)) {
                $_SERVER['SCRIPT_FILENAME'] = $sitePath.$filename;
                $_SERVER['SCRIPT_NAME'] = $filename;
                return $sitePath.$filename;
            }
        }

        // Fallback
        $_SERVER['SCRIPT_FILENAME'] = $sitePath.'/index.php';
        $_SERVER['SCRIPT_NAME'] = '/index.php';
        return $sitePath.'/index.php';
    }
255782
public function isStaticFile($sitePath, $siteName, $uri)
    {
        $frontControllerDirectory = $this->frontControllerDirectory($sitePath);

        if ($this->isActualFile($staticFilePath = $sitePath.'/'.$frontControllerDirectory.$uri)) {
            return $staticFilePath;
        }

        return false;
    }
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;
    }
801835
public function getFullPath()
    {
        /** @var Uri $uri */
        $uri = $this->getUri();

        return rtrim($uri->getBasePath(), '/') . '/' . ltrim($uri->getPath(), '/');
    }
542516
public function getUri($pathinfo = null, $defaultExt = null, Site $site = null, $url_type = null)
    {
        return $this->getApplication()->getRouting()->getUri($pathinfo, $defaultExt, $site, $url_type);
    }
613725
public static function getFull($path = NULL, $front = '')
    {
        if($path){
            $hostInfo = Yii::$app->request->getHostInfo();
            $hostInfo = parse_url($hostInfo);
            $scheme =  $hostInfo['scheme'];
            $host =  $hostInfo['host'];
            if($front){
                $host = explode(".", $host);
                $host[0] = $front;
                $host = join(".", $host);
            }
            $path = $scheme . '://' . $host . '/' . ltrim($path, '/');
        }

        return $path;
    }
1311728
public static Locale getLocaleFromPath(String sitePath) {

        Locale result = null;
        if (sitePath.indexOf("/") == 0) {
            sitePath = sitePath.substring(1);
        }
        if (sitePath.length() > 1) {
            String localePrefix;
            if (!sitePath.contains("/")) {
                // this may be the case for paths pointing to the root folder of a site
                // check for parameters
                int separator = -1;
                int param = sitePath.indexOf("?");
                int hash = sitePath.indexOf("#");
                if (param >= 0) {
                    if (hash != 0) {
                        separator = param < hash ? param : hash;
                    } else {
                        separator = param;
                    }
                } else {
                    separator = hash;
                }
                if (separator >= 0) {
                    localePrefix = sitePath.substring(0, separator);
                } else {
                    localePrefix = sitePath;
                }
            } else {
                localePrefix = sitePath.substring(0, sitePath.indexOf("/"));
            }
            Locale locale = CmsLocaleManager.getLocale(localePrefix);
            if (localePrefix.equals(locale.toString())
                && OpenCms.getLocaleManager().getAvailableLocales().contains(locale)) {
                result = locale;
            }
        }
        return result;
    }
383222
public function serves($sitePath, $siteName, $uri)
    {
        $typo3Dir = $sitePath . $this->documentRoot . '/typo3';
        return file_exists($typo3Dir) && is_dir($typo3Dir);
    }
925745
public String getPath(String base, String uri) throws ResourceNotFoundException, IOException {

		String fileName = uri;
		if (!fileName.endsWith(".scss")) {
			fileName += ".scss";
		}

		String parentPath = base.replace('\\', '/');
		fileName = fileName.replace('\\', '/');

		return PathNormalizer.concatWebPath(parentPath, fileName);
	}
681204
public function baseUrl($targetPath = null)
    {
        if (!isset($this->baseUrl)) {
            throw new RuntimeException(sprintf(
                'The base URI is not defined for [%s]',
                get_class($this)
            ));
        }

        if ($targetPath !== null) {
            return $this->createAbsoluteUrl($this->baseUrl, $targetPath);
        }

        return rtrim($this->baseUrl, '/').'/';
    }
449546
protected String getSimpleRootPath(CmsObject cms, String targetUri, String basePath) {

        if (cms == null) {
            // required by unit test cases
            return targetUri;
        }

        URI uri;
        String path;
        String suffix = "";

        // malformed uri
        try {
            uri = new URI(targetUri);
            path = uri.getPath();
            suffix = getSuffix(uri);
        } catch (Exception e) {
            if (LOG.isWarnEnabled()) {
                LOG.warn(Messages.get().getBundle().key(Messages.LOG_MALFORMED_URI_1, targetUri), e);
            }
            return null;
        }
        // opaque URI
        if (uri.isOpaque()) {
            return null;
        }

        // in case the target is the workplace UI
        if (CmsLinkManager.isWorkplaceUri(uri)) {
            return null;
        }

        // in case the target is a static resource served from the class path
        if (CmsStaticResourceHandler.isStaticResourceUri(uri)) {
            return CmsStringUtil.joinPaths(
                CmsStaticResourceHandler.STATIC_RESOURCE_PREFIX,
                CmsStaticResourceHandler.removeStaticResourcePrefix(path));
        }

        CmsStaticExportManager exportManager = OpenCms.getStaticExportManager();
        if (exportManager.isValidRfsName(path)) {
            String originalSiteRoot = cms.getRequestContext().getSiteRoot();
            String vfsName = null;
            try {
                cms.getRequestContext().setSiteRoot("");
                vfsName = exportManager.getVfsName(cms, path);
                if (vfsName != null) {
                    return vfsName;
                }
            } finally {
                cms.getRequestContext().setSiteRoot(originalSiteRoot);
            }
        }

        // absolute URI (i.e. URI has a scheme component like http:// ...)
        if (uri.isAbsolute()) {
            CmsSiteMatcher targetMatcher = new CmsSiteMatcher(targetUri);
            if (OpenCms.getSiteManager().isMatching(targetMatcher)
                || targetMatcher.equals(cms.getRequestContext().getRequestMatcher())) {

                path = CmsLinkManager.removeOpenCmsContext(path);
                boolean isWorkplaceServer = OpenCms.getSiteManager().isWorkplaceRequest(targetMatcher)
                    || targetMatcher.equals(cms.getRequestContext().getRequestMatcher());
                if (isWorkplaceServer) {
                    String selectedPath;
                    String targetSiteRoot = OpenCms.getSiteManager().getSiteRoot(path);
                    if (targetSiteRoot != null) {
                        selectedPath = getRootPathForSite(cms, path, targetSiteRoot, true);
                    } else {
                        // set selectedPath with the path for the current site
                        selectedPath = getRootPathForSite(cms, path, cms.getRequestContext().getSiteRoot(), false);
                        String pathForMatchedSite = getRootPathForSite(
                            cms,
                            path,
                            OpenCms.getSiteManager().matchSite(targetMatcher).getSiteRoot(),
                            false);
                        String originalSiteRoot = cms.getRequestContext().getSiteRoot();
                        try {
                            cms.getRequestContext().setSiteRoot("");
                            // the path for the current site normally is preferred, but if it doesn't exist and the path for the matched site
                            // does exist, then use the path for the matched site
                            if (!cms.existsResource(selectedPath, CmsResourceFilter.ALL)
                                && cms.existsResource(pathForMatchedSite, CmsResourceFilter.ALL)) {
                                selectedPath = pathForMatchedSite;
                            }
                        } finally {
                            cms.getRequestContext().setSiteRoot(originalSiteRoot);
                        }
                    }
                    return selectedPath + suffix;
                } else {
                    // add the site root of the matching site
                    return getRootPathForSite(
                        cms,
                        path + suffix,
                        OpenCms.getSiteManager().matchSite(targetMatcher).getSiteRoot(),
                        false);
                }
            } else {
                return null;
            }
        }

        // relative URI (i.e. no scheme component, but filename can still start with "/")
        String context = OpenCms.getSystemInfo().getOpenCmsContext();
        String vfsPrefix = OpenCms.getStaticExportManager().getVfsPrefix();
        if ((context != null) && (path.startsWith(context + "/") || (path.startsWith(vfsPrefix + "/")))) {
            // URI is starting with opencms context

            // cut context from path
            path = CmsLinkManager.removeOpenCmsContext(path);

            String targetSiteRoot = getTargetSiteRoot(cms, path, basePath);

            return getRootPathForSite(
                cms,
                path + suffix,
                targetSiteRoot,
                (targetSiteRoot != null) && path.startsWith(targetSiteRoot));
        }

        // URI with relative path is relative to the given relativePath if available and in a site,
        // otherwise invalid
        if (CmsStringUtil.isNotEmpty(path) && (path.charAt(0) != '/')) {
            if (basePath != null) {
                String absolutePath;
                int pos = path.indexOf("../../galleries/pics/");
                if (pos >= 0) {
                    // HACK: mixed up editor path to system gallery image folder
                    return CmsWorkplace.VFS_PATH_SYSTEM + path.substring(pos + 6) + suffix;
                }
                absolutePath = CmsLinkManager.getAbsoluteUri(path, cms.getRequestContext().addSiteRoot(basePath));
                if (OpenCms.getSiteManager().getSiteRoot(absolutePath) != null) {
                    return absolutePath + suffix;
                }
                // HACK: some editor components (e.g. HtmlArea) mix up the editor URL with the current request URL
                absolutePath = CmsLinkManager.getAbsoluteUri(
                    path,
                    cms.getRequestContext().getSiteRoot() + CmsWorkplace.VFS_PATH_EDITORS);
                if (OpenCms.getSiteManager().getSiteRoot(absolutePath) != null) {
                    return absolutePath + suffix;
                }
                // HACK: same as above, but XmlContent editor has one path element more
                absolutePath = CmsLinkManager.getAbsoluteUri(
                    path,
                    cms.getRequestContext().getSiteRoot() + CmsWorkplace.VFS_PATH_EDITORS + "xmlcontent/");
                if (OpenCms.getSiteManager().getSiteRoot(absolutePath) != null) {
                    return absolutePath + suffix;
                }
            }

            return null;
        }

        if (CmsStringUtil.isNotEmpty(path)) {
            String targetSiteRoot = getTargetSiteRoot(cms, path, basePath);

            return getRootPathForSite(
                cms,
                path + suffix,
                targetSiteRoot,
                (targetSiteRoot != null) && path.startsWith(targetSiteRoot));
        }

        // URI without path (typically local link)
        return suffix;
    }