diff --git a/include/class.format.php b/include/class.format.php index a85d2d69f1f73f3eeee3634118c66be3a1a8bd38..50c8a7fdf144c12d23f9f59ff4c1b3dc87cd4609 100644 --- a/include/class.format.php +++ b/include/class.format.php @@ -739,6 +739,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);