Make WordPress Core

Changeset 20686


Ignore:
Timestamp:
05/02/2012 04:37:42 PM (10 years ago)
Author:
nacin
Message:

Add characters to be stripped or replaced in sanitize_title_with_dashes().

  • Replace times (multiplication sign) with x.
  • Strip low quotation marks and other curly quotes we don't already deal with.

props SergeyBiryukov. fixes #19820.

File:
1 edited

Legend:

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

    r20672 r20686  
    918918
    919919    if ( 'save' == $context ) {
    920         // nbsp, ndash and mdash
     920        // Convert nbsp, ndash and mdash to hyphens
    921921        $title = str_replace( array( '%c2%a0', '%e2%80%93', '%e2%80%94' ), '-', $title );
    922         // iexcl and iquest
    923         $title = str_replace( array( '%c2%a1', '%c2%bf' ), '', $title );
    924         // angle quotes
    925         $title = str_replace( array( '%c2%ab', '%c2%bb', '%e2%80%b9', '%e2%80%ba' ), '', $title );
    926         // curly quotes
    927         $title = str_replace( array( '%e2%80%98', '%e2%80%99', '%e2%80%9c', '%e2%80%9d' ), '', $title );
    928         // copy, reg, deg, hellip and trade
    929         $title = str_replace( array( '%c2%a9', '%c2%ae', '%c2%b0', '%e2%80%a6', '%e2%84%a2' ), '', $title );
     922
     923        // Strip these characters entirely
     924        $title = str_replace( array(
     925            // iexcl and iquest
     926            '%c2%a1', '%c2%bf',
     927            // angle quotes
     928            '%c2%ab', '%c2%bb', '%e2%80%b9', '%e2%80%ba',
     929            // curly quotes
     930            '%e2%80%98', '%e2%80%99', '%e2%80%9c', '%e2%80%9d',
     931            '%e2%80%9a', '%e2%80%9b', '%e2%80%9e', '%e2%80%9f',
     932            // copy, reg, deg, hellip and trade
     933            '%c2%a9', '%c2%ae', '%c2%b0', '%e2%80%a6', '%e2%84%a2',
     934        ), '', $title );
     935
     936        // Convert times to x
     937        $title = str_replace( '%c3%97', 'x', $title );
    930938    }
    931939
Note: See TracChangeset for help on using the changeset viewer.