Make WordPress Core

Ticket #3329: 3329.patch

File 3329.patch, 1.7 KB (added by pishmishy, 15 years ago)

Better handling of % in post slugs

  • wp-includes/query.php

     
    833833                        $where .= " AND DAYOFMONTH(post_date)='" . $q['day'] . "'";
    834834
    835835                if ('' != $q['name']) {
     836                        $q['name'] = urlencode($q['name']);
    836837                        $q['name'] = sanitize_title($q['name']);
    837838                        $where .= " AND post_name = '" . $q['name'] . "'";
    838839                } else if ('' != $q['pagename']) {
  • wp-includes/link-template.php

     
    9797                        $date[3],
    9898                        $date[4],
    9999                        $date[5],
    100                         $post->post_name,
     100                        urlencode($post->post_name),
    101101                        $post->ID,
    102102                        $category,
    103103                        $author,
    104                         $post->post_name,
     104                        urlencode($post->post_name),
    105105                );
    106106                $permalink = get_option('home') . str_replace($rewritecode, $rewritereplace, $permalink);
    107107                $permalink = user_trailingslashit($permalink, 'single');
  • wp-includes/formatting.php

     
    341341
    342342function sanitize_title_with_dashes($title) {
    343343        $title = strip_tags($title);
    344         // Preserve escaped octets.
    345         $title = preg_replace('|%([a-fA-F0-9][a-fA-F0-9])|', '---$1---', $title);
    346         // Remove percent signs that are not part of an octet.
    347         $title = str_replace('%', '', $title);
    348         // Restore octets.
    349         $title = preg_replace('|---([a-fA-F0-9][a-fA-F0-9])---|', '%$1', $title);
    350344
    351345        $title = remove_accents($title);
    352346        if (seems_utf8($title)) {