Make WordPress Core


Ignore:
Timestamp:
02/27/2010 08:06:35 PM (16 years ago)
Author:
nacin
Message:

Add some whitespace to get_body_class(). props coffee2code. Clarify fallback parameter in sanitize_html_class(). see #11331

File:
1 edited

Legend:

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

    r13382 r13468  
    843843 *
    844844 * @param string $class The classname to be sanitized
    845  * @param string $fallback The value to return if the sanitization end's up as an empty string.
     845 * @param string $fallback Optional. The value to return if the sanitization end's up as an empty string.
     846 *  Defaults to an empty string.
    846847 * @return string The sanitized value
    847848 */
    848 function sanitize_html_class($class, $fallback){
     849function sanitize_html_class( $class, $fallback = '' ) {
    849850    //Strip out any % encoded octets
    850851    $sanitized = preg_replace('|%[a-fA-F0-9][a-fA-F0-9]|', '', $class);
     
    853854    $sanitized = preg_replace('/[^A-Za-z0-9-]/', '', $sanitized);
    854855
    855     if ('' == $sanitized)
     856    if ( '' == $sanitized )
    856857        $sanitized = $fallback;
    857858
    858     return apply_filters('sanitize_html_class',$sanitized, $class, $fallback);
     859    return apply_filters( 'sanitize_html_class', $sanitized, $class, $fallback );
    859860}
    860861
Note: See TracChangeset for help on using the changeset viewer.