Make WordPress Core

Ticket #4409: 4409c.diff

File 4409c.diff, 2.3 KB (added by mdawaffe, 19 years ago)

better than b

  • wp-includes/default-filters.php

     
    1212add_filter('the_content', 'wptexturize');
    1313add_filter('the_excerpt', 'wptexturize');
    1414add_filter('bloginfo', 'wptexturize');
     15add_filter('pre_kses', 'wp_pre_kses_less_than');
    1516
    1617// Comments, trackbacks, pingbacks
    1718add_filter('pre_comment_author_name', 'strip_tags');
     
    184185add_action( 'plugins_loaded', 'wp_maybe_load_widgets', 0 );
    185186add_action( 'shutdown', 'wp_ob_end_flush_all', 1);
    186187
    187 ?>
    188  No newline at end of file
     188?>
  • wp-includes/formatting.php

     
    11951195        $array = apply_filters( 'wp_parse_str', $array );
    11961196}
    11971197
     1198// Convert lone less than signs.  KSES already converts lone greater than signs.
     1199function wp_pre_kses_less_than( $text ) {
     1200        return preg_replace_callback('%<[^>]*?((?=<)|>|$)%', 'wp_pre_kses_less_than_callback', $text);
     1201}
     1202
     1203function wp_pre_kses_less_than_callback( $matches ) {
     1204        if ( false === strpos($matches[0], '>') )
     1205                return wp_specialchars($matches[0]);
     1206        return $matches[0];
     1207}
     1208
    11981209?>
  • wp-includes/kses.php

     
    230230        $string = wp_kses_no_null($string);
    231231        $string = wp_kses_js_entities($string);
    232232        $string = wp_kses_normalize_entities($string);
    233         $string = wp_kses_hook($string);
    234233        $allowed_html_fixed = wp_kses_array_lc($allowed_html);
     234        $string = wp_kses_hook($string, $allowed_html_fixed, $allowed_protocols); // WP changed the order of these funcs and added args to wp_kses_hook
    235235        return wp_kses_split($string, $allowed_html_fixed, $allowed_protocols);
    236236} # function wp_kses
    237237
    238 function wp_kses_hook($string)
     238function wp_kses_hook($string, $allowed_html, $allowed_protocols)
    239239###############################################################################
    240240# You add any kses hooks here.
    241241###############################################################################
    242242{
     243        $string = apply_filters( 'pre_kses', $string );
    243244        return $string;
    244245} # function wp_kses_hook
    245246