Multi-byte character safe excerpting from nbachiyski. fixes #6077

git-svn-id: http://svn.automattic.com/wordpress/trunk@7140 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan
2008-03-03 21:05:23 +00:00
parent b1f0a853da
commit 6e181bb941
6 changed files with 56 additions and 19 deletions

View File

@@ -72,15 +72,8 @@ if ( !empty($tb_url) && !empty($title) ) {
if ( !pings_open($tb_id) )
trackback_response(1, 'Sorry, trackbacks are closed for this item.');
$title = wp_specialchars( strip_tags( $title ) );
$excerpt = strip_tags($excerpt);
if ( function_exists('mb_strcut') ) { // For international trackbacks
$excerpt = mb_strcut($excerpt, 0, 252, get_option('blog_charset')) . '...';
$title = mb_strcut($title, 0, 250, get_option('blog_charset')) . '...';
} else {
$excerpt = (strlen($excerpt) > 255) ? substr($excerpt, 0, 252) . '...' : $excerpt;
$title = (strlen($title) > 250) ? substr($title, 0, 250) . '...' : $title;
}
$title = wp_html_excerpt( $title, 250 ).'...';
$excerpt = wp_html_excerpt( $excerpt, 252 ).'...';
$comment_post_ID = (int) $tb_id;
$comment_author = $blog_name;
@@ -100,4 +93,4 @@ if ( !empty($tb_url) && !empty($title) ) {
do_action('trackback_post', $wpdb->insert_id);
trackback_response(0);
}
?>
?>