/** * Convert a URL to a server-side path. * * This method returns false if the URL cannot be converted to a server-side path, * e.g. if the URL belongs to an external domain. * * @param string $url * @return string */ public static function toServerPath($url) { $url = self::getCanonicalURL($url); if (!self::isInternalURL($url)) { return false; } return Filters\FilenameFilter::cleanPath($_SERVER['DOCUMENT_ROOT'] . parse_url($url, \PHP_URL_PATH)); }