From 72430a4584cca0700f8e777f881f86f766d2ea4f Mon Sep 17 00:00:00 2001 From: rboren Date: Sun, 2 Jan 2005 09:08:55 +0000 Subject: [PATCH] Remove % from title before utf8 uri encoding is done. git-svn-id: http://svn.automattic.com/wordpress/trunk@2036 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/functions-formatting.php | 39 ++++++++++++++-------------- 1 file changed, 20 insertions(+), 19 deletions(-) diff --git a/wp-includes/functions-formatting.php b/wp-includes/functions-formatting.php index f44bb9cb9b..b9ff720f73 100644 --- a/wp-includes/functions-formatting.php +++ b/wp-includes/functions-formatting.php @@ -205,34 +205,35 @@ function remove_accents($string) { } function sanitize_title($title, $fallback_title = '') { - $title = strip_tags($title); - $title = apply_filters('sanitize_title', $title); + $title = strip_tags($title); + $title = apply_filters('sanitize_title', $title); - if (empty($title)) { - $title = $fallback_title; - } + if (empty($title)) { + $title = $fallback_title; + } - return $title; + return $title; } function sanitize_title_with_dashes($title) { $title = strip_tags($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 = preg_replace('|%|', '', $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 = strtolower($title); - $title = preg_replace('/&.+?;/', '', $title); // kill entities - $title = preg_replace('/[^a-z0-9 _-]/', '', $title); - $title = preg_replace('/\s+/', '-', $title); - $title = preg_replace('|-+|', '-', $title); - $title = trim($title, '-'); + $title = strtolower($title); + $title = preg_replace('/&.+?;/', '', $title); // kill entities + $title = preg_replace('/[^%a-z0-9 _-]/', '', $title); + $title = preg_replace('/\s+/', '-', $title); + $title = preg_replace('|-+|', '-', $title); + $title = trim($title, '-'); - return $title; + return $title; } function convert_chars($content, $flag = 'obsolete') {