WordPress.org

Make WordPress Core

Changeset 3429


Ignore:
Timestamp:
01/13/2006 07:28:47 AM (16 years ago)
Author:
ryan
Message:

kses regex tweakage for better comment filtering. fixes #2130

File:
1 edited

Legend:

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

    r3418 r3429  
    7878###############################################################################
    7979{
    80     return preg_replace('%(<!--.*?-->)|(<'.# EITHER: <
    81     '[^>]*'.# things that aren't >
    82     '(>|$)'.# > or end of string
    83     '|>)%e', # OR: just a >
     80    return preg_replace('%((<!--.*?(-->|$))|(<[^>]*(>|$)|>))%e',
    8481    "wp_kses_split2('\\1', \$allowed_html, ".'$allowed_protocols)', $string);
    8582} # function wp_kses_split
     
    9996    # It matched a ">" character
    10097
    101     if (preg_match('%^<!--(.*)-->$%', $string, $matches)) {
    102         $string = $matches[1];
     98    if (preg_match('%^<!--(.*?)(-->)?$%', $string, $matches)) {
     99        $string = str_replace(array('<!--', '-->'), '', $matches[1]);
    103100        while ( $string != $newstring = wp_kses($string, $allowed_html, $allowed_protocols) )
    104101            $string = $newstring;
     102        if ( $string == '' )
     103            return '';
    105104        return "<!--{$string}-->";
    106105    }
Note: See TracChangeset for help on using the changeset viewer.