RSS widgets: Omit the title attribute when the summary is shown.

Trim the title attribute to ensure whitespace isn't rendered.

props SergeyBiryukov.
fixes #26520. see #26552.

Built from https://develop.svn.wordpress.org/trunk@27691


git-svn-id: http://core.svn.wordpress.org/trunk@27530 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Andrew Nacin 2014-03-24 21:08:15 +00:00
parent 4eadc109f8
commit 3ffc6dd559
1 changed files with 18 additions and 14 deletions

View File

@ -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 );
$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 = $desc;
// Append ellipsis. Change existing [...] to […].
if ( '[...]' == substr( $excerpt, -5 ) )
$excerpt = substr( $excerpt, 0, -5 ) . '[…]';
elseif ( '[…]' != substr( $excerpt, -10 ) && $desc != $excerpt )
$excerpt .= ' […]';
if ( '[...]' == substr( $summary, -5 ) ) {
$summary = substr( $summary, 0, -5 ) . '[…]';
} elseif ( '[…]' != substr( $summary, -10 ) && $desc !== $summary ) {
$summary .= ' […]';
}
$excerpt = esc_html( $excerpt );
if ( $show_summary ) {
$summary = "<div class='rssSummary'>$excerpt</div>";
} else {
$summary = '';
$summary = '<div class="rssSummary">' . esc_html( $summary ) . '</div>';
}
$date = '';
@ -903,8 +905,10 @@ function wp_widget_rss_output( $rss, $args = array() ) {
if ( $link == '' ) {
echo "<li>$title{$date}{$summary}{$author}</li>";
} elseif ( $show_summary ) {
echo "<li><a class='rsswidget' href='$link'>$title</a>{$date}{$summary}{$author}</li>";
} else {
echo "<li><a class='rsswidget' href='$link' title='$desc'>$title</a>{$date}{$summary}{$author}</li>";
echo "<li><a class='rsswidget' href='$link' title='$desc'>$title</a>{$date}{$author}</li>";
}
}
echo '</ul>';