Make WordPress Core

Ticket #26520: 26520.2.patch

File 26520.2.patch, 1.9 KB (added by SergeyBiryukov, 13 years ago)
  • src/wp-includes/default-widgets.php

     
    866866                if ( empty($title) )
    867867                        $title = __('Untitled');
    868868
    869                 $desc = str_replace( array("\n", "\r"), ' ', esc_attr( strip_tags( @html_entity_decode( $item->get_description(), ENT_QUOTES, get_option('blog_charset') ) ) ) );
    870                 $excerpt = wp_html_excerpt( $desc, 360 );
     869                $summary = '';
     870                if ( $show_summary ) {
     871                        $desc = @html_entity_decode( $item->get_description(), ENT_QUOTES, get_option( 'blog_charset' ) );
     872                        $desc = esc_attr( strip_tags( $desc ) );
     873                        $desc = trim( str_replace( array( "\n", "\r" ), ' ', $desc ) );
     874                        $excerpt = wp_html_excerpt( $desc, 360 );
    871875
    872                 // Append ellipsis. Change existing [...] to […].
    873                 if ( '[...]' == substr( $excerpt, -5 ) )
    874                         $excerpt = substr( $excerpt, 0, -5 ) . '[…]';
    875                 elseif ( '[…]' != substr( $excerpt, -10 ) && $desc != $excerpt )
    876                         $excerpt .= ' […]';
     876                        // Append ellipsis. Change existing [...] to […].
     877                        if ( '[...]' == substr( $excerpt, -5 ) ) {
     878                                $excerpt = substr( $excerpt, 0, -5 ) . '[…]';
     879                        } elseif ( '[…]' != substr( $excerpt, -10 ) && $desc != $excerpt ) {
     880                                $excerpt .= ' […]';
     881                        }
    877882
    878                 $excerpt = esc_html( $excerpt );
     883                        $excerpt = esc_html( $excerpt );
    879884
    880                 if ( $show_summary ) {
    881885                        $summary = "<div class='rssSummary'>$excerpt</div>";
    882                 } else {
    883                         $summary = '';
    884886                }
    885887
    886888                $date = '';
    … …  
    904906                if ( $link == '' ) {
    905907                        echo "<li>$title{$date}{$summary}{$author}</li>";
    906908                } else {
    907                         echo "<li><a class='rsswidget' href='$link' title='$desc'>$title</a>{$date}{$summary}{$author}</li>";
     909                        echo "<li><a class='rsswidget' href='$link'>$title</a>{$date}{$summary}{$author}</li>";
    908910                }
    909911        }
    910912        echo '</ul>';