]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
php5-intl is recommended but not required
authorMikael Nordfeldth <mmn@hethane.se>
Thu, 26 Feb 2015 21:58:36 +0000 (22:58 +0100)
committerMikael Nordfeldth <mmn@hethane.se>
Thu, 26 Feb 2015 21:58:36 +0000 (22:58 +0100)
lib/util.php

index 9a70d8d44ebaf9f010675b0c88d5691b01258101..e132c587faf01fbe8693c6701c1b98661d2d76e5 100644 (file)
@@ -1141,6 +1141,13 @@ function common_xml_safe_str($str)
 
 function common_slugify($str)
 {
+    // php5-intl is highly recommended...
+    if (!function_exists('transliterator_transliterate')) {
+        $str = preg_replace('/[^\pL\pN]/u', '', $str);
+        $str = mb_convert_case($str, MB_CASE_LOWER, 'UTF-8');
+        $str = substr($str, 0, 64);
+        return $str;
+    }
     $str = transliterator_transliterate(
                         'Any-Latin;' .      // any charset to latin compatible
                             'NFD;' .        // decompose