Make WordPress Core

Changeset 17614


Ignore:
Timestamp:
04/06/2011 09:28:52 PM (14 years ago)
Author:
nacin
Message:

Make underscores valid in sanitize_html_class. fixes #17067.

File:
1 edited

Legend:

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

    r17570 r17614  
    877877 * Santizes a html classname to ensure it only contains valid characters
    878878 *
    879  * Strips the string down to A-Z,a-z,0-9,'-' if this results in an empty
     879 * Strips the string down to A-Z,a-z,0-9,_,-. If this results in an empty
    880880 * string then it will return the alternative value supplied.
    881881 *
     
    891891function sanitize_html_class( $class, $fallback = '' ) {
    892892    //Strip out any % encoded octets
    893     $sanitized = preg_replace('|%[a-fA-F0-9][a-fA-F0-9]|', '', $class);
    894 
    895     //Limit to A-Z,a-z,0-9,'-'
    896     $sanitized = preg_replace('/[^A-Za-z0-9-]/', '', $sanitized);
     893    $sanitized = preg_replace( '|%[a-fA-F0-9][a-fA-F0-9]|', '', $class );
     894
     895    //Limit to A-Z,a-z,0-9,_,-
     896    $sanitized = preg_replace( '/[^A-Za-z0-9_-]/', '', $sanitized );
    897897
    898898    if ( '' == $sanitized )
Note: See TracChangeset for help on using the changeset viewer.