Remove % from title before utf8 uri encoding is done.
git-svn-id: https://develop.svn.wordpress.org/trunk@2036 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
04c9b09202
commit
6bbc7fe7a0
|
@ -205,34 +205,35 @@ function remove_accents($string) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function sanitize_title($title, $fallback_title = '') {
|
function sanitize_title($title, $fallback_title = '') {
|
||||||
$title = strip_tags($title);
|
$title = strip_tags($title);
|
||||||
$title = apply_filters('sanitize_title', $title);
|
$title = apply_filters('sanitize_title', $title);
|
||||||
|
|
||||||
if (empty($title)) {
|
if (empty($title)) {
|
||||||
$title = $fallback_title;
|
$title = $fallback_title;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $title;
|
return $title;
|
||||||
}
|
}
|
||||||
|
|
||||||
function sanitize_title_with_dashes($title) {
|
function sanitize_title_with_dashes($title) {
|
||||||
$title = strip_tags($title);
|
$title = strip_tags($title);
|
||||||
$title = remove_accents($title);
|
$title = preg_replace('|%|', '', $title);
|
||||||
if (seems_utf8($title)) {
|
$title = remove_accents($title);
|
||||||
if (function_exists('mb_strtolower')) {
|
if (seems_utf8($title)) {
|
||||||
$title = mb_strtolower($title, 'UTF-8');
|
if (function_exists('mb_strtolower')) {
|
||||||
}
|
$title = mb_strtolower($title, 'UTF-8');
|
||||||
$title = utf8_uri_encode($title);
|
|
||||||
}
|
}
|
||||||
|
$title = utf8_uri_encode($title);
|
||||||
|
}
|
||||||
|
|
||||||
$title = strtolower($title);
|
$title = strtolower($title);
|
||||||
$title = preg_replace('/&.+?;/', '', $title); // kill entities
|
$title = preg_replace('/&.+?;/', '', $title); // kill entities
|
||||||
$title = preg_replace('/[^a-z0-9 _-]/', '', $title);
|
$title = preg_replace('/[^%a-z0-9 _-]/', '', $title);
|
||||||
$title = preg_replace('/\s+/', '-', $title);
|
$title = preg_replace('/\s+/', '-', $title);
|
||||||
$title = preg_replace('|-+|', '-', $title);
|
$title = preg_replace('|-+|', '-', $title);
|
||||||
$title = trim($title, '-');
|
$title = trim($title, '-');
|
||||||
|
|
||||||
return $title;
|
return $title;
|
||||||
}
|
}
|
||||||
|
|
||||||
function convert_chars($content, $flag = 'obsolete') {
|
function convert_chars($content, $flag = 'obsolete') {
|
||||||
|
|
Loading…
Reference in New Issue