Get the list of excluded root URL segments

@return array List of lowercase urlsegments
962135
protected function getExcludedURLSegments()
    {
        $excludes = [];

        // Build from rules
        foreach (Director::config()->get('rules') as $pattern => $rule) {
            $route = explode('/', $pattern);
            if (!empty($route) && strpos($route[0], '$') === false) {
                $excludes[] = strtolower($route[0]);
            }
        }

        // Build from base folders
        foreach (glob(Director::publicFolder() . '/*', GLOB_ONLYDIR) as $folder) {
            $excludes[] = strtolower(basename($folder));
        }

        $this->extend('updateExcludedURLSegments', $excludes);
        return $excludes;
    }
405854
protected function cleanPartsPath(): array
    {
        $parts = [];
        foreach ($this->getPathInfo()
                      ->getDirList() as $part) {
            if ('.' === $part) {
                continue;
            }
            if ('..' === $part) {
                /*
                 * Though path may still be valid in the file system in the
                 * case of relative paths here there is no way to validate
                 * them without accessing the file system to do so. These are
                 * unusual paths probably cause by errors or to access
                 * something unexpected anyway.
                 */
                if (\count($parts) < 1) {
                    $mess = 'Unusual above root path found';
                    throw new \DomainException($mess);
                }
                \array_pop($parts);
                continue;
            }
            $parts[] = $part;
        }
        return $parts;
    }
395776
public function getContainmentTreeWithRequestPaths() {
    $tree_by_path = [];

    $tree = $this->getContainmentTree();

    foreach ($tree as $parent => $children) {
      foreach ($children as $child) {
        $tree_by_path[$this->requestPaths[$parent]][] = $this->requestPaths[$child];
      }
    }

    return $tree_by_path;
  }
356544
protected function getExcepts()
    {
        if (!is_array($this->excepts)) {
            $excepts = [];
            if (!empty($this->excepts)) {
                foreach (preg_split('/\s*,\s*/', $this->excepts) as $version) {
                    if (preg_match('/m?(\d{6}_?\d{6})(\D.*?)?$/is', $version, $matches)) {
                        $excepts[$matches[1]] = $matches[1];
                    }
                }
            }
            $this->excepts = $excepts;
        }
        return $this->excepts;
    }
30661
protected static function getUrlParameterNamesToExcludeFromUrl()
    {
        $paramsToExclude = Config::getInstance()->Tracker['url_query_parameter_to_exclude_from_url'];
        $paramsToExclude = explode(",", $paramsToExclude);
        $paramsToExclude = array_map('trim', $paramsToExclude);
        return $paramsToExclude;
    }
649634
protected function initUrlSegments () {
		$this->portDefined = FALSE;
		$this->port = '';
		$this->path = '';
		$this->query = '';
		$this->fragment = '';

		$uri = $this->GetScheme() . '//'
			. $this->globalServer['HTTP_HOST'];
		if (isset($this->globalServer['UNENCODED_URL'])) {
			$uri .= rawurldecode($this->globalServer['UNENCODED_URL']);
		} else if (isset($this->globalServer['UNENCODED_URL'])) {
			$uri .= rawurldecode($this->globalServer['UNENCODED_URL']);
		} else {
			$uri .= rawurldecode($this->globalServer['REQUEST_URI']);
		}

		$firstColonPos = mb_strpos($uri, ':');
		if ($firstColonPos !== FALSE) 
			$uri = mb_substr($uri, $firstColonPos + 1);
		
		if (mb_substr($uri, 0, 2) === '//') {
			$nextSlashPos = mb_strpos($uri, '/', 2);
			if ($nextSlashPos !== FALSE) {
				$authority = mb_substr($uri, 2, $nextSlashPos - 2);
				$uri = mb_substr($uri, $nextSlashPos);
				$colonsCount = mb_substr_count($authority, ':');
				if ($colonsCount === 1) {
					$colonPos = mb_strpos($authority, ':');
					$this->port = mb_substr($authority, $colonPos + 1);
					if ($this->port !== '') 
						$this->portDefined = TRUE;
				}
			} else {
				return;
			}
		}

		$basePath = $this->GetBasePath();
		$uri = mb_substr($uri, mb_strlen($basePath));
		
		$questionMarkPos = mb_strpos($uri, '?');
		$hashPos = mb_strpos($uri, '#');
		$questionMarkContained = $questionMarkPos !== FALSE;
		$hashContained = $hashPos !== FALSE;
		if (!$questionMarkContained && !$hashContained) {
			// path, no query, no hash
			$this->path = $uri;
		} else if ($questionMarkContained && !$hashContained) {
			// path, query and no hash
			$this->path = mb_substr($uri, 0, $questionMarkPos);
			$this->query = trim(mb_substr($uri, $questionMarkPos + 1), '&');
		} else if (!$questionMarkContained && $hashContained) {
			// path, no query and hash
			$this->path = mb_substr($uri, 0, $hashPos);
			$this->fragment = mb_substr($uri, $hashPos + 1);
		} else if ($questionMarkContained && $hashContained && $questionMarkPos < $hashPos) {
			// path, query and hash
			$this->path = mb_substr($uri, 0, $questionMarkPos);
			$this->query = trim(mb_substr($uri, $questionMarkPos + 1, $questionMarkPos + 1 - $hashPos), '&');
			$this->fragment = mb_substr($uri, $hashPos + 1);
		} else {
			// path, no query and hash containing question mark
			$this->path = mb_substr($uri, 0, $questionMarkPos);
			$this->fragment = mb_substr($uri, $hashPos + 1);
		}
	}
967625
public static function segmentizeUrl($url)
        {
            $url = self::normalizeUrl($url);
            $segments = explode('/', $url);

            $result = array();

            foreach ($segments as $segment) {
                if (strlen($segment)) $result[] = $segment;
            }

            return $result;
        }
109805
public function rules()
    {
        $footer = $this->route('seo_footer');

        return [
            // Footer Rules
            'name'            => ['required', 'string'],
            'localization'    => ['required', 'string'],
            'uri'             => ['required', 'string', $this->getUniqueUriRule()->ignore($footer->id)],
            'locale'          => $this->getLocaleRule(),
            'page'            => $this->getPageRule(),
            // SEO Rules
            'seo_title'       => ['required', 'string'],
            'seo_description' => ['required', 'string'],
            'seo_keywords'    => ['required', 'array', 'min:1'],
        ];
    }
73991
protected function getAllNonFilteredParts()
    {
        $parts = [ $this ];
        foreach ($this->children as $part) {
            if ($part instanceof MimePart) {
                $parts = array_merge(
                    $parts,
                    $part->getAllNonFilteredParts()
                );
            } else {
                array_push($parts, $part);
            }
        }
        return $parts;
    }
600096
protected function _get_root_template_part_slugs() {
		if ( ! $this->root ) {
			return [];
		}

		if ( $this->name ) {
			$templates[] = trailingslashit( $this->root ) . $this->slug . '-' . $this->name . '.php';
		}
		$templates[] = trailingslashit( $this->root ) . $this->slug . '.php';

		return $templates;
	}
29373
public function Breadcrumbs()
    {
        $basePath = str_replace(Director::protocolAndHost(), '', Director::absoluteBaseURL());
        $relPath = parse_url(
            substr($_SERVER['REQUEST_URI'], strlen($basePath), strlen($_SERVER['REQUEST_URI'])),
            PHP_URL_PATH
        );
        $parts = explode('/', $relPath);
        $base = Director::absoluteBaseURL();
        $pathPart = "";
        $pathLinks = array();
        foreach ($parts as $part) {
            if ($part != '') {
                $pathPart .= "$part/";
                $pathLinks[] = "<a href=\"$base$pathPart\">$part</a>";
            }
        }
        return implode('&nbsp;&rarr;&nbsp;', $pathLinks);
    }
143197
private function _parse_routes()
	{
		$uri=implode('/', $this->uri->segments());

		if (isset($this->router[$uri])) {
			return $this->_set_request(explode('/', $this->router[$uri]));
		}

		foreach ($this->router as $key => $val) {
			$key = str_replace(':any', '.+', str_replace(':num', '[0-9]+', $key));

			if (preg_match('#^'.$key.'$#', $uri)) {
				if (strpos($val, '$') !== FALSE AND strpos($key, '(') !== FALSE) {
					$val = preg_replace('#^'.$key.'$#', $val, $uri);
				}

				return $this->_set_request(explode('/', $val));
			}
		}

		$this->_set_request($this->uri->segments());
	}
963729
public function getRootPages(): array
    {
        return $this->connection->createQueryBuilder()
            ->select('language', 'id', 'fallback')
            ->from('tl_page')
            ->where('type=:type')
            ->setParameter('type', 'root')
            ->orderBy('fallback')
            ->addOrderBy('sorting')
            ->execute()
            ->fetchAll(\PDO::FETCH_ASSOC);
    }
338854
public function getAllAttachmentParts()
    {
        $parts = $this->getAllParts(
            $this->partFilterFactory->newFilterFromArray([
                'multipart' => PartFilter::FILTER_EXCLUDE
            ])
        );
        return array_values(array_filter(
            $parts,
            function ($part) {
                return !(
                    $part->isTextPart()
                    && $part->getContentDisposition() === 'inline'
                );
            }
        ));
    }
1285694
protected function getRequestedUrls()
    {
        $oInput = Factory::service('Input');
        $sUrls  = $oInput->get('urls') ?: $oInput->header('X-Cdn-Urls');
        $aUrls  = !is_array($sUrls) ? explode(',', $sUrls) : $sUrls;
        $aUrls  = array_map('strtolower', $aUrls);

        //  Filter out any which don't follow the format {digit}x{digit}-{scale|crop} || raw
        foreach ($aUrls as &$sDimension) {

            if (!is_string($sDimension)) {
                $sDimension = null;
                continue;
            }

            preg_match_all('/^(\d+?)x(\d+?)-(scale|crop)$/i', $sDimension, $aMatches);

            if (empty($aMatches[0])) {
                $sDimension = null;
            } else {
                $sDimension = [
                    'width'  => !empty($aMatches[1][0]) ? $aMatches[1][0] : null,
                    'height' => !empty($aMatches[2][0]) ? $aMatches[2][0] : null,
                    'type'   => !empty($aMatches[3][0]) ? $aMatches[3][0] : 'crop',
                ];
            }
        }

        return array_filter($aUrls);
    }
456616
public function getParts()
    {
        $query = (string) $this->query;

        return array(
            'scheme' => $this->scheme,
            'user' => $this->username,
            'pass' => $this->password,
            'host' => $this->host,
            'port' => $this->port,
            'path' => $this->getPath(),
            'query' => $query !== '' ? $query : null,
            'fragment' => $this->fragment,
        );
    }
228937
public function getSupportedTanMechanisms()
    {
        $segments = $this->findSegments('HIRMS');
        // @todo create method to get reference element from request
        foreach ($segments as $segment) {
            $segment = $this->splitSegment($segment);
            array_shift($segment);
            foreach ($segment as $seg) {
                list($id, $msg) = explode('::', $seg, 2);
                if ("3920" == $id) {
                    if (preg_match_all('/\d{3}/', $msg, $matches)) {
                        return $matches[0];
                    }
                }
            }
        }

        return array();
    }