diff --git a/include/class.format.php b/include/class.format.php index 6058142d8c0adb2b51e996943f2ac1562d60b647..f9f2ab574424810bb89cdaeb6a6146e03b6ec042 100644 --- a/include/class.format.php +++ b/include/class.format.php @@ -737,6 +737,13 @@ class Format { // Thanks, http://stackoverflow.com/a/2955878/1025836 /* static */ function slugify($text) { + // convert special characters to entities + $text = htmlentities($text, ENT_NOQUOTES, 'UTF-8'); + + // removes entity suffixes, leaving only un-accented characters + $text = preg_replace('~&([A-za-z])(?:acute|cedil|circ|grave|orn|ring|slash|th|tilde|uml);~', '$1', $text); + $text = preg_replace('~&([A-za-z]{2})(?:lig);~', '$1', $text); + // replace non letter or digits by - $text = preg_replace('~[^\p{L}\p{N}]+~u', '-', $text);