Fixes in routes, urls, etc

This commit is contained in:
absurdo 2023-06-18 19:46:22 +02:00
parent 841b16266a
commit 22b90ea1f6
4 changed files with 58 additions and 22 deletions

View file

@ -34,23 +34,7 @@ class Utils {
static public function slugify($text, $respect_upper=0, $replace_space='-', $replace_dot=0, $replace_barr=0)
{
/*$from='àáâãäåæçèéêëìíîïðòóôõöøùúûýþÿŕñ';
$to= 'aaaaaaaceeeeiiiidoooooouuuybyrn';
//$text = utf8_decode(urldecode($text));
$text = strtr($text, utf8_encode($from), $to);
echo $text;
$text=strtolower(trim($text));
$text=str_replace(' ', $replace_space, $text);
$text=preg_replace('~-+~', $replace_space, $text);
$text=preg_replace('~[^-\w]+~', '', $text);
return $text;*/
/*
$from='àáâãäåæçèéêëìíîïðòóôõöøùúûýþÿŕñÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÐÒÓÔÕÖØÙÚÛÝỲŸÞŔÑ¿?!¡()"|#*%,;+&$ºª<>`çÇ{}@~=^:´[]';
$to= 'aaaaaaaceeeeiiiidoooooouuuybyrnAAAAAACEEEEIIIIDOOOOOOUUUYYYBRN---------------------------------';
@ -84,13 +68,23 @@ class Utils {
$text = strtolower($text);
}
}*/
$text=iconv('utf-8', 'us-ascii//TRANSLIT', $text);
$text=trim(preg_replace('~'.$replace_space.'+~', $replace_space, $text), '-');
$text=preg_replace('~[^-\w]+~', '', $text);
return utf8_encode($text);
if (empty($text)) {
return 'n-a';
}else {
return iconv('us-ascii//TRANSLIT', 'utf-8', $text); // utf8_encode($text);
}
}