Make WordPress Core

Ticket #10797: 10797.3.patch

File 10797.3.patch, 2.4 KB (added by SergeyBiryukov, 13 years ago)
  • wp-includes/default-filters.php

     
    182182add_filter( 'option_siteurl',           '_config_wp_siteurl'                  );
    183183add_filter( 'tiny_mce_before_init',     '_mce_set_direction'                  );
    184184add_filter( 'pre_kses',                 'wp_pre_kses_less_than'               );
    185 add_filter( 'sanitize_title',           'sanitize_title_with_dashes'          );
     185add_filter( 'sanitize_title',           'sanitize_title_with_dashes',   10, 3 );
    186186add_action( 'check_comment_flood',      'check_comment_flood_db',       10, 3 );
    187187add_filter( 'comment_flood_filter',     'wp_throttle_comment_flood',    10, 3 );
    188188add_filter( 'pre_comment_content',      'wp_rel_nofollow',              15    );
  • wp-includes/formatting.php

     
    803803}
    804804
    805805/**
    806  * Sanitizes title, replacing whitespace with dashes.
     806 * Sanitizes title, replacing whitespace and a few other characters with dashes.
    807807 *
    808808 * Limits the output to alphanumeric characters, underscore (_) and dash (-).
    809809 * Whitespace becomes a dash.
     
    811811 * @since 1.2.0
    812812 *
    813813 * @param string $title The title to be sanitized.
     814 * @param string $raw_title Optional. Not used.
     815 * @param string $context Optional. The operation for which the string is sanitized.
    814816 * @return string The sanitized title.
    815817 */
    816 function sanitize_title_with_dashes($title) {
     818function sanitize_title_with_dashes($title, $raw_title = '', $context = 'display') {
    817819        $title = strip_tags($title);
    818820        // Preserve escaped octets.
    819821        $title = preg_replace('|%([a-fA-F0-9][a-fA-F0-9])|', '---$1---', $title);
     
    832834        $title = strtolower($title);
    833835        $title = preg_replace('/&.+?;/', '', $title); // kill entities
    834836        $title = str_replace('.', '-', $title);
     837
     838        if ( 'save' == $context ) {
     839                // ndash and mdash
     840                $title = str_replace( array( '%e2%80%93', '%e2%80%94' ), '-', $title );
     841                // curly quotes and hellip
     842                $title = str_replace( array( '%e2%80%9c', '%e2%80%9d', '%e2%80%98', '%e2%80%99', '%e2%80%a6' ), '', $title );
     843        }
     844
    835845        $title = preg_replace('/[^%a-z0-9 _-]/', '', $title);
    836846        $title = preg_replace('/\s+/', '-', $title);
    837847        $title = preg_replace('|-+|', '-', $title);