diff --git a/kernel/helpers/text.class.php b/kernel/helpers/text.class.php index 33a441ea..3b4967ef 100644 --- a/kernel/helpers/text.class.php +++ b/kernel/helpers/text.class.php @@ -52,6 +52,7 @@ class Text { return $text; } +/* public static function cleanUrl($string, $separator='-') { // Delete characters @@ -72,6 +73,21 @@ class Text { return $string; } +*/ + + public static function cleanUrl($string, $separator='-') + { + if(function_exists('iconv')) { + $string = iconv('UTF-8', 'ASCII//TRANSLIT', $string); + } + + $string = preg_replace("/[^a-zA-Z0-9\/_|+ -]/", '', $string); + $string = trim($string, '-'); + $string = self::lowercase($string); + $string = preg_replace("/[\/_|+ -]+/", $separator, $string); + + return $string; + } // Replace all occurrences of the search string with the replacement string. public static function replace($search, $replace, $string)