PluginProbe
Gutenberg / 24.0.0
Gutenberg v24.0.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 +10 -4 23.2.224.0.0 View file →
@@ -14,13 +14,18 @@
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 - if ( in_array( untrailingslashit( $attributes['feedURL'] ), array( site_url(), home_url() ), true ) ) {
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 ) ) {
19 24 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>';
20 25 }
21 26
22 - $rss = fetch_feed( $attributes['feedURL'] );
27 + $rss = fetch_feed( $feed_url );
23 28
24 29 if ( is_wp_error( $rss ) ) {
25 30 return '<div class="components-placeholder"><div class="notice notice-error"><strong>' . __( 'RSS Error:' ) . '</strong> ' . esc_html( $rss->get_error_message() ) . '</div></div>';
26 31 }
@@ -32,9 +37,10 @@
32 37 $rss_items = $rss->get_items( 0, $attributes['itemsToShow'] );
33 38 $list_items = '';
34 39
35 40 $open_in_new_tab = ! empty( $attributes['openInNewTab'] );
36 - $rel = ! empty( $attributes['rel'] ) ? trim( $attributes['rel'] ) : '';
41 + $rel_attr = $attributes['rel'] ?? null;
42 + $rel = is_string( $rel_attr ) && '' !== $rel_attr ? trim( $rel_attr ) : '';
37 43
38 44 $link_attributes = '';
39 45
40 46 if ( $open_in_new_tab ) {
@@ -96,9 +102,9 @@
96 102 $excerpt = html_entity_decode( $description, ENT_QUOTES, get_option( 'blog_charset' ) );
97 103 $excerpt = esc_attr( wp_trim_words( $excerpt, $attributes['excerptLength'], ' [&hellip;]' ) );
98 104
99 105 // Change existing [...] to [&hellip;].
100 - if ( '[...]' === substr( $excerpt, -5 ) ) {
106 + if ( str_ends_with( $excerpt, '[...]' ) ) {
101 107 $excerpt = substr( $excerpt, 0, -5 ) . '[&hellip;]';
102 108 }
103 109
104 110 $excerpt = '<div class="wp-block-rss__item-excerpt">' . esc_html( $excerpt ) . '</div>';