only transliterate if the function exists

Cette révision appartient à :
Stéphane Goetz 2019-12-29 20:54:17 +01:00
Parent 695d2db311
révision 0966f90b2c
1 fichiers modifiés avec 5 ajouts et 2 suppressions

Voir le fichier

@ -224,9 +224,12 @@ class DauxHelper
public static function slug($title) public static function slug($title)
{ {
// Convert to ASCII // Convert to ASCII
$title = transliterator_transliterate("Any-Latin; NFD; [:Nonspacing Mark:] Remove; NFC;", $title); if (function_exists("transliterator_transliterate")) {
$title = transliterator_transliterate("Any-Latin; NFD; [:Nonspacing Mark:] Remove; NFC;", $title);
}
$title = iconv("utf-8", "ASCII//TRANSLIT//IGNORE", $title); $title = iconv("utf-8", "ASCII//TRANSLIT//IGNORE", $title);
// Remove unsupported characters // Remove unsupported characters
$title = preg_replace('/[^\x20-\x7E]/u', '', $title); $title = preg_replace('/[^\x20-\x7E]/u', '', $title);