mirror of
https://github.com/WordPress/WordPress.git
synced 2025-01-03 15:08:10 +01:00
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:
parent
215a5b33d9
commit
fcddc04547
@ -1373,22 +1373,18 @@ function wp_sprintf_l($pattern, $args) {
|
|||||||
/**
|
/**
|
||||||
* Safely extracts not more than the first $count characters from html string
|
* Safely extracts not more than the first $count characters from html string
|
||||||
*
|
*
|
||||||
* UTF-8, tags and entities safe prefix extraction. Entities inside will be
|
* UTF-8, tags and entities safe prefix extraction. Entities inside will *NOT* be
|
||||||
* counted as one character. As a side effect, all entities will be converted to
|
* counted as one character. For example & will be counted as 4, < as 3, etc.
|
||||||
* their decimal form.
|
|
||||||
*
|
*
|
||||||
* @param integer $str String to get the excerpt from
|
* @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
|
* @eaturn string the excerpt
|
||||||
*/
|
*/
|
||||||
function wp_html_excerpt( $str, $count ) {
|
function wp_html_excerpt( $str, $count ) {
|
||||||
$str = strip_tags( $str );
|
$str = strip_tags( $str );
|
||||||
$str = html_entity_decode( $str, ENT_QUOTES);
|
|
||||||
$str = mb_strcut( $str, 0, $count );
|
$str = mb_strcut( $str, 0, $count );
|
||||||
// remove part of an entity at the end
|
// remove part of an entity at the end
|
||||||
$str = preg_replace( '/&[^;\s]{0,6}$/', '', $str );
|
$str = preg_replace( '/&[^;\s]{0,6}$/', '', $str );
|
||||||
// we decoded some entities we should put back
|
|
||||||
$str = wp_specialchars( $str );
|
|
||||||
return $str;
|
return $str;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user