Ticket #21702: 21702.diff

File 21702.diff, 1.2 KB (added by kovshenin, 7 months ago)

Preserve the original $desc and use $excerpt instead. Comparing the two will tell whether or not hellip should be added.

  • wp-includes/default-widgets.php

     
    857857                        $title = __('Untitled'); 
    858858 
    859859                $desc = str_replace( array("\n", "\r"), ' ', esc_attr( strip_tags( @html_entity_decode( $item->get_description(), ENT_QUOTES, get_option('blog_charset') ) ) ) ); 
    860                 $desc = wp_html_excerpt( $desc, 360 ); 
     860                $excerpt = wp_html_excerpt( $desc, 360 ); 
    861861 
    862862                // Append ellipsis. Change existing [...] to […]. 
    863                 if ( '[...]' == substr( $desc, -5 ) ) 
    864                         $desc = substr( $desc, 0, -5 ) . '[…]'; 
    865                 elseif ( '[…]' != substr( $desc, -10 ) ) 
    866                         $desc .= ' […]'; 
     863                if ( '[...]' == substr( $excerpt, -5 ) ) 
     864                        $excerpt = substr( $excerpt, 0, -5 ) . '[…]'; 
     865                elseif ( '[…]' != substr( $excerpt, -10 ) && $desc != $excerpt ) 
     866                        $excerpt .= ' […]'; 
    867867 
    868                 $desc = esc_html( $desc ); 
     868                $excerpt = esc_html( $excerpt ); 
    869869 
    870870                if ( $show_summary ) { 
    871                         $summary = "<div class='rssSummary'>$desc</div>"; 
     871                        $summary = "<div class='rssSummary'>$excerpt</div>"; 
    872872                } else { 
    873873                        $summary = ''; 
    874874                }