fixes #49 & #91 - basically reverting 9f610ddac3f3a566f7ec672f5741d2314ea63ffc

This commit is contained in:
azett 2022-09-10 14:20:23 +02:00
parent 58b3063478
commit 5dd42b0ffa

View File

@ -487,25 +487,21 @@ function sanitize_title($title, $fallback_title = '') {
function sanitize_title_with_dashes($title) { function sanitize_title_with_dashes($title) {
$title = strip_tags($title); $title = strip_tags($title);
if (seems_utf8($title)) {
if (function_exists('mb_strtolower')) {
$title = mb_strtolower($title, 'UTF-8');
}
$title = utf8_uri_encode($title);
}
// Preserve escaped octets. // Preserve escaped octets.
$title = preg_replace('|%([a-fA-F0-9][a-fA-F0-9])|', '---$1---', $title); $title = preg_replace('|%([a-fA-F0-9][a-fA-F0-9])|', '---$1---', $title);
// Remove percent signs that are not part of an octet. // Remove percent signs that are not part of an octet.
$title = str_replace('%', '', $title); $title = str_replace('%', '', $title);
// Restore octets. // Restore octets.
$title = preg_replace('|---([a-fA-F0-9][a-fA-F0-9])---|', '%$1', $title); $title = preg_replace('|---([a-fA-F0-9][a-fA-F0-9])---|', '%$1', $title);
// and finally: Kill octets
$title = preg_replace('|%([a-fA-F0-9][a-fA-F0-9])|', '', $title);
// remove accents // remove accents
$title = remove_accents($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);
}
// title is in lower case always // title is in lower case always
$title = strtolower($title); $title = strtolower($title);