src/utility/Tools.php
public static function stringToUrl($string, $separator = '_', $encoding = 'UTF-8', $lower = false) {
        if (!Validate::isCharset($encoding))
            throw new \Exception('Encoding in\'t a valid charset type');
        $string = htmlentities(html_entity_decode($string, null, $encoding), ENT_NOQUOTES, $encoding);
        if ($lower)
            $string = strtolower($string);
        $search = array('#\&(.)(?:uml|circ|tilde|acute|grave|cedil|ring)\;#', '#\&(.{2})(?:lig)\;#', '#\&[a-z]+\;#', '#[^a-zA-Z0-9_]#', '#' . $separator . '+#');
        $replace = array('\1', '\1', '', $separator, $separator);
        return trim(preg_replace($search, $replace, $string), $separator);
    }
public static function stringToUrl($string, $separator = '_', $encoding = 'UTF-8', $lower = false) {
        if (!Validate::isCharset($encoding))
            throw new \Exception('Encoding in\'t a valid charset type');
        $string = htmlentities(html_entity_decode($string, null, $encoding), ENT_NOQUOTES, $encoding);
        if ($lower)
            $string = strtolower($string);
        $search = array('#\&(.)(?:uml|circ|tilde|acute|grave|cedil|ring)\;#', '#\&(.{2})(?:lig)\;#', '#\&[a-z]+\;#', '#[^a-zA-Z0-9_]#', '#' . $separator . '+#');
        $replace = array('\1', '\1', '', $separator, $separator);
        return trim(preg_replace($search, $replace, $string), $separator);
    }
public static function stringToUrl ( $ string , $ separator = '_' , $ encoding = 'UTF-8' , $ lower = false ) { if ( ! Validate :: isCharset ( $ encoding ) ) throw new \ Exception ( 'Encoding in\'t a valid charset type' ) ; $ string = htmlentities ( html_entity_decode ( $ string , null , $ encoding ) , ENT_NOQUOTES , $ encoding ) ; if ( $ lower ) $ string = strtolower ( $ string ) ; $ search = array ( '#\&(.)(?:uml|circ|tilde|acute|grave|cedil|ring)\;#' , '#\&(.{2})(?:lig)\;#' , '#\&[a-z]+\;#' , '#[^a-zA-Z0-9_]#' , '#' . $ separator . '+#' ) ; $ replace = array ( '\1' , '\1' , '' , $ separator , $ separator ) ; return trim ( preg_replace ( $ search , $ replace , $ string ) , $ separator ) ; }
Convert a string to url format for url rewrite

@access public
@static
@param string $string String to encode
@param string $separator Separator for replacing space and ponctuation, by default "_"
@param string $encoding Set the encoding of source string
@return string
Convert a string to url format for url rewrite