diff --git a/wp-includes/default-widgets.php b/wp-includes/default-widgets.php index 9495ea1b6b..2cc34dd4fb 100644 --- a/wp-includes/default-widgets.php +++ b/wp-includes/default-widgets.php @@ -866,21 +866,23 @@ function wp_widget_rss_output( $rss, $args = array() ) { if ( empty($title) ) $title = __('Untitled'); - $desc = str_replace( array("\n", "\r"), ' ', esc_attr( strip_tags( @html_entity_decode( $item->get_description(), ENT_QUOTES, get_option('blog_charset') ) ) ) ); - $excerpt = wp_html_excerpt( $desc, 360 ); - - // Append ellipsis. Change existing [...] to […]. - if ( '[...]' == substr( $excerpt, -5 ) ) - $excerpt = substr( $excerpt, 0, -5 ) . '[…]'; - elseif ( '[…]' != substr( $excerpt, -10 ) && $desc != $excerpt ) - $excerpt .= ' […]'; - - $excerpt = esc_html( $excerpt ); + $desc = @html_entity_decode( $item->get_description(), ENT_QUOTES, get_option( 'blog_charset' ) ); + $desc = esc_attr( strip_tags( $desc ) ); + $desc = trim( str_replace( array( "\n", "\r" ), ' ', $desc ) ); + $desc = wp_html_excerpt( $desc, 360 ); + $summary = ''; if ( $show_summary ) { - $summary = "
$excerpt
"; - } else { - $summary = ''; + $summary = $desc; + + // Append ellipsis. Change existing [...] to […]. + if ( '[...]' == substr( $summary, -5 ) ) { + $summary = substr( $summary, 0, -5 ) . '[…]'; + } elseif ( '[…]' != substr( $summary, -10 ) && $desc !== $summary ) { + $summary .= ' […]'; + } + + $summary = '
' . esc_html( $summary ) . '
'; } $date = ''; @@ -903,8 +905,10 @@ function wp_widget_rss_output( $rss, $args = array() ) { if ( $link == '' ) { echo "
  • $title{$date}{$summary}{$author}
  • "; + } elseif ( $show_summary ) { + echo "
  • $title{$date}{$summary}{$author}
  • "; } else { - echo "
  • $title{$date}{$summary}{$author}
  • "; + echo "
  • $title{$date}{$author}
  • "; } } echo '';