From 06532a3304ebf50a7370ab1c9449cbf5e08170a4 Mon Sep 17 00:00:00 2001 From: Ryan Boren Date: Mon, 9 Jan 2006 23:49:56 +0000 Subject: [PATCH] Pass comments through kses. Props tsimmons. fixes #2130 #2167 git-svn-id: https://develop.svn.wordpress.org/trunk@3417 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-includes/kses.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/wp-includes/kses.php b/wp-includes/kses.php index d6f5a4c507..bc9d5141e5 100644 --- a/wp-includes/kses.php +++ b/wp-includes/kses.php @@ -77,7 +77,7 @@ function wp_kses_split($string, $allowed_html, $allowed_protocols) # matches stray ">" characters. ############################################################################### { - return preg_replace('%(<'.# EITHER: < + return preg_replace('%()|(<'.# EITHER: < '[^>]*'.# things that aren't > '(>|$)'.# > or end of string '|>)%e', # OR: just a > @@ -98,6 +98,10 @@ function wp_kses_split2($string, $allowed_html, $allowed_protocols) return '>'; # It matched a ">" character + if (preg_match('%^$%', $string)) + return $string; + # Allow HTML comments + if (!preg_match('%^<\s*(/\s*)?([a-zA-Z0-9]+)([^>]*)>?$%', $string, $matches)) return ''; # It's seriously malformed