Remove the entity decoding and recoding from wp_html_excerpt. Fixes #6077 props nbachiyski.

git-svn-id: http://svn.automattic.com/wordpress/trunk@7190 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
westi 2008-03-09 22:11:20 +00:00
parent 215a5b33d9
commit fcddc04547
1 changed files with 3 additions and 7 deletions

View File

@ -1373,22 +1373,18 @@ function wp_sprintf_l($pattern, $args) {
/**
* Safely extracts not more than the first $count characters from html string
*
* UTF-8, tags and entities safe prefix extraction. Entities inside will be
* counted as one character. As a side effect, all entities will be converted to
* their decimal form.
* UTF-8, tags and entities safe prefix extraction. Entities inside will *NOT* be
* counted as one character. For example & will be counted as 4, < as 3, etc.
*
* @param integer $str String to get the excerpt from
* @param integer $count Maximum number of visible characters to take
* @param integer $count Maximum number of characters to take
* @eaturn string the excerpt
*/
function wp_html_excerpt( $str, $count ) {
$str = strip_tags( $str );
$str = html_entity_decode( $str, ENT_QUOTES);
$str = mb_strcut( $str, 0, $count );
// remove part of an entity at the end
$str = preg_replace( '/&[^;\s]{0,6}$/', '', $str );
// we decoded some entities we should put back
$str = wp_specialchars( $str );
return $str;
}