--- wp-includes/formatting.php 27 Nov 2010 03:12:10 -0000 1.1 +++ wp-includes/formatting.php 3 Dec 2010 05:54:41 -0000 @@ -1829,7 +1829,9 @@ $text = apply_filters('the_content', $text); $text = str_replace(']]>', ']]>', $text); - $text = strip_tags($text); +// jwz: do better tag stripping +// $text = strip_tags($text); + $text = wp_strip_all_tags($text); $excerpt_length = apply_filters('excerpt_length', 55); $excerpt_more = apply_filters('excerpt_more', ' ' . '[...]'); $words = preg_split("/[\n\r\t ]+/", $text, $excerpt_length + 1, PREG_SPLIT_NO_EMPTY); @@ -2770,6 +2772,16 @@ */ function wp_strip_all_tags($string, $remove_breaks = false) { $string = preg_replace( '@<(script|style)[^>]*?>.*?@si', '', $string ); + + // jwz: convert P and P-like block tags to \n\n. + $string = preg_replace( '@]*?>@si', + "\n\n", $string ); + // jwz: convert BR and other known block-display tags to \n. + $string = preg_replace( '@<(BR|DIV|LI|DT|DD|TR|TD|H\d)\b[^>]*?>@si', + "\n", $string ); + // jwz: compress newlines + $string = preg_replace( "@\n\n\n+@si", "\n\n", $string ); + $string = strip_tags($string); if ( $remove_breaks )