PluginProbe
Gutenberg / 22.7.0
Gutenberg v22.7.0
24.0.0 23.9.1 23.9.0 23.8.0 23.7.2 23.7.1 23.7.0 23.6.1 23.6.2 23.6.0 23.5.3 23.5.2 23.5.1 23.5.0 23.4.0 23.3.2 23.3.1 23.3.0 23.2.0 23.2.1 23.2.2 23.1.1 23.1.0 23.0.1 12.6.0 All 403 releases
← All changes | build/scripts/block-library/rss.php +4 -10 24.0.022.7.0 View file →
@@ -14,18 +14,13 @@
14 14 *
15 15 * @return string Returns the block content with received rss items.
16 16 */
17 17 function gutenberg_render_block_core_rss( $attributes ) {
18 - $feed_url = $attributes['feedURL'] ?? null;
19 - if ( ! is_string( $feed_url ) ) {
20 - return '';
21 - }
22 -
23 - if ( in_array( untrailingslashit( $feed_url ), array( site_url(), home_url() ), true ) ) {
18 + if ( in_array( untrailingslashit( $attributes['feedURL'] ), array( site_url(), home_url() ), true ) ) {
24 19 return '<div class="components-placeholder"><div class="notice notice-error">' . __( 'Adding an RSS feed to this site’s homepage is not supported, as it could lead to a loop that slows down your site. Try using another block, like the <strong>Latest Posts</strong> block, to list posts from the site.' ) . '</div></div>';
25 20 }
26 21
27 - $rss = fetch_feed( $feed_url );
22 + $rss = fetch_feed( $attributes['feedURL'] );
28 23
29 24 if ( is_wp_error( $rss ) ) {
30 25 return '<div class="components-placeholder"><div class="notice notice-error"><strong>' . __( 'RSS Error:' ) . '</strong> ' . esc_html( $rss->get_error_message() ) . '</div></div>';
31 26 }
@@ -37,10 +32,9 @@
37 32 $rss_items = $rss->get_items( 0, $attributes['itemsToShow'] );
38 33 $list_items = '';
39 34
40 35 $open_in_new_tab = ! empty( $attributes['openInNewTab'] );
41 - $rel_attr = $attributes['rel'] ?? null;
42 - $rel = is_string( $rel_attr ) && '' !== $rel_attr ? trim( $rel_attr ) : '';
36 + $rel = ! empty( $attributes['rel'] ) ? trim( $attributes['rel'] ) : '';
43 37
44 38 $link_attributes = '';
45 39
46 40 if ( $open_in_new_tab ) {
@@ -102,9 +96,9 @@
102 96 $excerpt = html_entity_decode( $description, ENT_QUOTES, get_option( 'blog_charset' ) );
103 97 $excerpt = esc_attr( wp_trim_words( $excerpt, $attributes['excerptLength'], ' [&hellip;]' ) );
104 98
105 99 // Change existing [...] to [&hellip;].
106 - if ( str_ends_with( $excerpt, '[...]' ) ) {
100 + if ( '[...]' === substr( $excerpt, -5 ) ) {
107 101 $excerpt = substr( $excerpt, 0, -5 ) . '[&hellip;]';
108 102 }
109 103
110 104 $excerpt = '<div class="wp-block-rss__item-excerpt">' . esc_html( $excerpt ) . '</div>';