This commit is contained in:
parent
58b3063478
commit
5dd42b0ffa
@ -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);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user