Clean URL improves
This commit is contained in:
parent
e76d9ff651
commit
903b3a5293
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user