wp/wp-includes/blocks/rss.php
changeset 22 8c2e4d02f4ef
parent 21 48c4eec2b7e6
equal deleted inserted replaced
21:48c4eec2b7e6 22:8c2e4d02f4ef
    59 		$author = '';
    59 		$author = '';
    60 		if ( $attributes['displayAuthor'] ) {
    60 		if ( $attributes['displayAuthor'] ) {
    61 			$author = $item->get_author();
    61 			$author = $item->get_author();
    62 			if ( is_object( $author ) ) {
    62 			if ( is_object( $author ) ) {
    63 				$author = $author->get_name();
    63 				$author = $author->get_name();
    64 				$author = '<span class="wp-block-rss__item-author">' . sprintf(
    64 				if ( ! empty( $author ) ) {
    65 					/* translators: %s: the author. */
    65 					$author = '<span class="wp-block-rss__item-author">' . sprintf(
    66 					__( 'by %s' ),
    66 						/* translators: byline. %s: author. */
    67 					esc_html( strip_tags( $author ) )
    67 						__( 'by %s' ),
    68 				) . '</span>';
    68 						esc_html( strip_tags( $author ) )
       
    69 					) . '</span>';
       
    70 				}
    69 			}
    71 			}
    70 		}
    72 		}
    71 
    73 
    72 		$excerpt = '';
    74 		$excerpt     = '';
    73 		if ( $attributes['displayExcerpt'] ) {
    75 		$description = $item->get_description();
    74 			$excerpt = html_entity_decode( $item->get_description(), ENT_QUOTES, get_option( 'blog_charset' ) );
    76 		if ( $attributes['displayExcerpt'] && ! empty( $description ) ) {
       
    77 			$excerpt = html_entity_decode( $description, ENT_QUOTES, get_option( 'blog_charset' ) );
    75 			$excerpt = esc_attr( wp_trim_words( $excerpt, $attributes['excerptLength'], ' [&hellip;]' ) );
    78 			$excerpt = esc_attr( wp_trim_words( $excerpt, $attributes['excerptLength'], ' [&hellip;]' ) );
    76 
    79 
    77 			// Change existing [...] to [&hellip;].
    80 			// Change existing [...] to [&hellip;].
    78 			if ( '[...]' === substr( $excerpt, -5 ) ) {
    81 			if ( '[...]' === substr( $excerpt, -5 ) ) {
    79 				$excerpt = substr( $excerpt, 0, -5 ) . '[&hellip;]';
    82 				$excerpt = substr( $excerpt, 0, -5 ) . '[&hellip;]';