src/HTTP.php
public static function cleanPath($path){

		$path = str_replace(['\\', '/./'], '/', $path);
		$path = preg_replace('/[\/]+/', '/', $path);
		$path = rtrim($path, '/');

		$path = preg_replace('/[^a-z0-9 \-\/]+/i', '', $path);
		$path = preg_replace('/[ \-]+/', '-', $path);

		return $path;
	}
public static function cleanPath($path){

		$path = str_replace(['\\', '/./'], '/', $path);
		$path = preg_replace('/[\/]+/', '/', $path);
		$path = rtrim($path, '/');

		$path = preg_replace('/[^a-z0-9 \-\/]+/i', '', $path);
		$path = preg_replace('/[ \-]+/', '-', $path);

		return $path;
	}
public static function cleanPath ( $ path ) { $ path = str_replace ( [ '\\' , '/./' ] , '/' , $ path ) ; $ path = preg_replace ( '/[\/]+/' , '/' , $ path ) ; $ path = rtrim ( $ path , '/' ) ; $ path = preg_replace ( '/[^a-z0-9 \-\/]+/i' , '' , $ path ) ; $ path = preg_replace ( '/[ \-]+/' , '-' , $ path ) ; return $ path ; }
Strictly clean a URL-path from any unwanted characters.

<p>Enforces a very strict "clean path"-policy, allowing only [A-Z],
[a-z], [0-9] and hyphens ("-"). All spaces are replaced with a hyphen,
all back-slashes are converted to forward-slashes and all superfluous
slashes are removed. Any other remaining, invalid, characters are also
removed.</p>

@param string $path
@return string
Strictly clean a URL - path from any unwanted characters .