Make WordPress Core

Changeset 2036


Ignore:
Timestamp:
01/02/2005 09:08:55 AM (20 years ago)
Author:
rboren
Message:

Remove % from title before utf8 uri encoding is done.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/functions-formatting.php

    r2018 r2036  
    206206
    207207function sanitize_title($title, $fallback_title = '') {
    208     $title = strip_tags($title);
    209     $title = apply_filters('sanitize_title', $title);
    210 
    211     if (empty($title)) {
    212         $title = $fallback_title;
    213     }
    214 
    215     return $title;
     208    $title = strip_tags($title);
     209    $title = apply_filters('sanitize_title', $title);
     210
     211    if (empty($title)) {
     212        $title = $fallback_title;
     213    }
     214
     215    return $title;
    216216}
    217217
    218218function sanitize_title_with_dashes($title) {
    219219    $title = strip_tags($title);
    220     $title = remove_accents($title);
    221         if (seems_utf8($title)) {
    222             if (function_exists('mb_strtolower')) {
    223                 $title = mb_strtolower($title, 'UTF-8');
    224             }
    225             $title = utf8_uri_encode($title);
    226         }
    227 
    228     $title = strtolower($title);
    229     $title = preg_replace('/&.+?;/', '', $title); // kill entities
    230     $title = preg_replace('/[^a-z0-9 _-]/', '', $title);
    231     $title = preg_replace('/\s+/', '-', $title);
    232     $title = preg_replace('|-+|', '-', $title);
    233     $title = trim($title, '-');
    234 
    235     return $title;
     220    $title = preg_replace('|%|', '', $title);
     221    $title = remove_accents($title);
     222    if (seems_utf8($title)) {
     223        if (function_exists('mb_strtolower')) {
     224            $title = mb_strtolower($title, 'UTF-8');
     225        }
     226        $title = utf8_uri_encode($title);
     227    }
     228
     229    $title = strtolower($title);
     230    $title = preg_replace('/&.+?;/', '', $title); // kill entities
     231    $title = preg_replace('/[^%a-z0-9 _-]/', '', $title);
     232    $title = preg_replace('/\s+/', '-', $title);
     233    $title = preg_replace('|-+|', '-', $title);
     234    $title = trim($title, '-');
     235
     236    return $title;
    236237}
    237238
Note: See TracChangeset for help on using the changeset viewer.