src/Tao/Html/Modifiers.php
public static function tidyUrl($string, $bKeepSlashes = true, $bKeepSpaces = false)
	{
		$string = strip_tags($string);
		$string = str_replace([
			'?',
			'&',
			'#',
			'=',
			'+',
			'<',
			'>',
			'"',
			'%'
		], '', $string);
		$string = str_replace("'", ' ', $string);
		$string = preg_replace('/[\s]+/u', ' ', trim($string));

		if (!$bKeepSlashes) {
			$string = str_replace('/', '-', $string);
		}

		if (!$bKeepSpaces) {
			$string = str_replace(' ', '-', $string);
		}

		$string = preg_replace('/[-]+/', '-', $string);

		# Remove path changes in URL
		$string = preg_replace('%^/%', '', $string);
		$string = preg_replace('%\.+/%', '', $string);

		return $string;
	}
public static function tidyUrl($string, $bKeepSlashes = true, $bKeepSpaces = false)
	{
		$string = strip_tags($string);
		$string = str_replace([
			'?',
			'&',
			'#',
			'=',
			'+',
			'<',
			'>',
			'"',
			'%'
		], '', $string);
		$string = str_replace("'", ' ', $string);
		$string = preg_replace('/[\s]+/u', ' ', trim($string));

		if (!$bKeepSlashes) {
			$string = str_replace('/', '-', $string);
		}

		if (!$bKeepSpaces) {
			$string = str_replace(' ', '-', $string);
		}

		$string = preg_replace('/[-]+/', '-', $string);

		# Remove path changes in URL
		$string = preg_replace('%^/%', '', $string);
		$string = preg_replace('%\.+/%', '', $string);

		return $string;
	}
public static function tidyUrl ( $ string , $ bKeepSlashes = true , $ bKeepSpaces = false ) { $ string = strip_tags ( $ string ) ; $ string = str_replace ( [ '?' , '&' , '#' , '=' , '+' , '<' , '>' , '"' , '%' ] , '' , $ string ) ; $ string = str_replace ( "'" , ' ' , $ string ) ; $ string = preg_replace ( '/[\s]+/u' , ' ' , trim ( $ string ) ) ; if ( ! $ bKeepSlashes ) { $ string = str_replace ( '/' , '-' , $ string ) ; } if ( ! $ bKeepSpaces ) { $ string = str_replace ( ' ' , '-' , $ string ) ; } $ string = preg_replace ( '/[-]+/' , '-' , $ string ) ; # Remove path changes in URL $ string = preg_replace ( '%^/%' , '' , $ string ) ; $ string = preg_replace ( '%\.+/%' , '' , $ string ) ; return $ string ; }
URL cleanup.

@copyright Copyright (c) 2003-2013 Olivier Meunier & Association Dotclear
@license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html

@param string $string
tidy
@param boolean $bKeepSlashes
in URL
@param boolean $bKeepSpaces
in URL
@return string
URL cleanup .