function sanitize_title_with_dashes($title) { $title = strip_tags($title); $title = preg_replace('|%([a-fA-F0-9][a-fA-F0-9])|', '---$1---', $title); $title = str_replace('%', '', $title); $title = preg_replace('|---([a-fA-F0-9][a-fA-F0-9])---|', '%$1', $title); $title = remove_accents($title); if (seems_utf8($title)) { /*if (function_exists('mb_strtolower')) { $title = mb_strtolower($title,'UTF-8'); <------------------ }*/ $title = utf8_uri_encode($title, 200); } $title = strtolower($title); $title = preg_replace('/&.+?;/', '', $title); $title = str_replace('.', '-', $title); $title = preg_replace('/[^%a-z0-9 _-]/', '', $title); $title = preg_replace('/\s+/', '-', $title); $title = preg_replace('|-+|', '-', $title); $title = trim($title, '-'); return $title; }