Changeset 61009 for trunk/src/wp-includes/blocks/rss.php
- Timestamp:
- 10/21/2025 07:11:53 AM (3 months ago)
- File:
-
- 1 edited
-
trunk/src/wp-includes/blocks/rss.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/blocks/rss.php
r59775 r61009 32 32 $rss_items = $rss->get_items( 0, $attributes['itemsToShow'] ); 33 33 $list_items = ''; 34 35 $open_in_new_tab = ! empty( $attributes['openInNewTab'] ); 36 $rel = ! empty( $attributes['rel'] ) ? trim( $attributes['rel'] ) : ''; 37 38 $link_attributes = ''; 39 40 if ( $open_in_new_tab ) { 41 $link_attributes .= ' target="_blank"'; 42 } 43 44 if ( '' !== $rel ) { 45 $link_attributes .= ' rel="' . esc_attr( $rel ) . '"'; 46 } 47 34 48 foreach ( $rss_items as $item ) { 35 $title = esc_html( trim( strip_tags( $item->get_title() ) ) ); 49 $title = esc_html( trim( strip_tags( html_entity_decode( $item->get_title() ) ) ) ); 50 36 51 if ( empty( $title ) ) { 37 52 $title = __( '(no title)' ); … … 39 54 $link = $item->get_link(); 40 55 $link = esc_url( $link ); 56 41 57 if ( $link ) { 42 $title = "<a href='{$link}' >{$title}</a>";58 $title = "<a href='{$link}'{$link_attributes}>{$title}</a>"; 43 59 } 44 60 $title = "<div class='wp-block-rss__item-title'>{$title}</div>"; 45 61 46 $date = '';47 if ( $attributes['displayDate']) {48 $ date= $item->get_date( 'U' );62 $date_markup = ''; 63 if ( ! empty( $attributes['displayDate'] ) ) { 64 $timestamp = $item->get_date( 'U' ); 49 65 50 if ( $date ) { 51 $date = sprintf( 66 if ( $timestamp ) { 67 $gmt_offset = get_option( 'gmt_offset' ); 68 $timestamp += (int) ( (float) $gmt_offset * HOUR_IN_SECONDS ); 69 70 $date_markup = sprintf( 52 71 '<time datetime="%1$s" class="wp-block-rss__item-publish-date">%2$s</time> ', 53 esc_attr( date_i18n( 'c', $ date) ),54 esc_ attr( date_i18n( get_option( 'date_format' ), $date) )72 esc_attr( date_i18n( 'c', $timestamp ) ), 73 esc_html( date_i18n( get_option( 'date_format' ), $timestamp ) ) 55 74 ); 56 75 } … … 86 105 } 87 106 88 $list_items .= "<li class='wp-block-rss__item'>{$title}{$date }{$author}{$excerpt}</li>";107 $list_items .= "<li class='wp-block-rss__item'>{$title}{$date_markup}{$author}{$excerpt}</li>"; 89 108 } 90 109
Note: See TracChangeset
for help on using the changeset viewer.