diff --git a/b2-include/b2functions.php b/b2-include/b2functions.php index d3a6c69a8..6f8994a9d 100644 --- a/b2-include/b2functions.php +++ b/b2-include/b2functions.php @@ -1207,9 +1207,9 @@ function pingback($content, $post_ID) { ** This is how we can do bad stuff! **/ function sanitise_html_attributes($text) { - $text = preg_replace('#( on[a-z]{1,}|style|class|id)="(.*?)"#i', '', $text); - $text = preg_replace('#( on[a-z]{1,}|style|class|id)=\'(.*?)\'#i', '', $text); - $text = preg_replace('#( on[a-z]{1,}|style|class|id)[ \t]*=[ \t]*([^ \t\>]*?)#i', '', $text); + $text = preg_replace('#(([\s"\'])on[a-z]{1,}|style|class|id)="(.*?)"#i', '$1', $text); + $text = preg_replace('#(([\s"\'])on[a-z]{1,}|style|class|id)=\'(.*?)\'#i', '$1', $text); + $text = preg_replace('#(([\s"\'])on[a-z]{1,}|style|class|id)[ \t]*=[ \t]*([^ \t\>]*?)#i', '$1', $text); $text = preg_replace('#([a-z]{1,})="(( |\t)*?)(javascript|vbscript|about):(.*?)"#i', '$1=""', $text); $text = preg_replace('#([a-z]{1,})=\'(( |\t)*?)(javascript|vbscript|about):(.*?)\'#i', '$1=""', $text); $text = preg_replace('#\<(\/{0,1})([a-z]{0,2})(frame|applet)(.*?)\>#i', '', $text);