src/classes/CCStr.php
public static function clean_url( $string, $sep = null ) 
	{
		// basic clean
		$string = strtolower( static::replace_accents( trim( $string ) ) );

		// these characters get replaced with our seperator
		$string = str_replace( array( ' ', '&', '\r\n', '\n', '+', ',', '.', '_' ) , '-', $string );

		$string = preg_replace( array(
			'/[^a-z0-9\-]/', // remove non alphanumerics
			'/[\-]+/', // only allow one in a row
		), array( '', '-' ), $string );

		// custom seperator
		if ( !is_null( $sep ) ) {
			$string = str_replace( '-', $sep, $string );
		}

		// trim the result again
		return trim( $string, '-' );
	}
public static function clean_url( $string, $sep = null ) 
	{
		// basic clean
		$string = strtolower( static::replace_accents( trim( $string ) ) );

		// these characters get replaced with our seperator
		$string = str_replace( array( ' ', '&', '\r\n', '\n', '+', ',', '.', '_' ) , '-', $string );

		$string = preg_replace( array(
			'/[^a-z0-9\-]/', // remove non alphanumerics
			'/[\-]+/', // only allow one in a row
		), array( '', '-' ), $string );

		// custom seperator
		if ( !is_null( $sep ) ) {
			$string = str_replace( '-', $sep, $string );
		}

		// trim the result again
		return trim( $string, '-' );
	}
public static function clean_url ( $ string , $ sep = null ) { // basic clean $ string = strtolower ( static :: replace_accents ( trim ( $ string ) ) ) ; // these characters get replaced with our seperator $ string = str_replace ( array ( ' ' , '&' , '\r\n' , '\n' , '+' , ',' , '.' , '_' ) , '-' , $ string ) ; $ string = preg_replace ( array ( '/[^a-z0-9\-]/' , // remove non alphanumerics '/[\-]+/' , // only allow one in a row ) , array ( '' , '-' ) , $ string ) ; // custom seperator if ( ! is_null ( $ sep ) ) { $ string = str_replace ( '-' , $ sep , $ string ) ; } // trim the result again return trim ( $ string , '-' ) ; }
Try to form a string to url valid segment. It will remove all special characters replace
accents characters remove and replace whitespaces breaks etc..

@param string 	$string
@param string 	$sep			You can define another seperator default is "-"
@return string
Try to form a string to url valid segment . It will remove all special characters replace accents characters remove and replace whitespaces breaks etc ..