PluginProbe
Gutenberg / 14.5.2
Gutenberg v14.5.2
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/block-library/blocks/rss.php +17 -4 12.6.0 → 14.5.2 View file →
@@ -12,12 +12,16 @@
12 12 *
13 13 * @return string Returns the block content with received rss items.
14 14 */
15 15 function gutenberg_render_block_core_rss( $attributes ) {
16 + if ( in_array( untrailingslashit( $attributes['feedURL'] ), array( site_url(), home_url() ), true ) ) {
17 + 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>';
18 + }
19 +
16 20 $rss = fetch_feed( $attributes['feedURL'] );
17 21
18 22 if ( is_wp_error( $rss ) ) {
19 - return '<div class="components-placeholder"><div class="notice notice-error"><strong>' . __( 'RSS Error:' ) . '</strong> ' . $rss->get_error_message() . '</div></div>';
23 + return '<div class="components-placeholder"><div class="notice notice-error"><strong>' . __( 'RSS Error:' ) . '</strong> ' . esc_html( $rss->get_error_message() ) . '</div></div>';
20 24 }
21 25
22 26 if ( ! $rss->get_item_quantity() ) {
23 27 return '<div class="components-placeholder"><div class="notice notice-error">' . __( 'An error has occurred, which probably means the feed is down. Try again later.' ) . '</div></div>';
@@ -43,10 +47,10 @@
43 47
44 48 if ( $date ) {
45 49 $date = sprintf(
46 50 '<time datetime="%1$s" class="wp-block-rss__item-publish-date">%2$s</time> ',
47 - date_i18n( get_option( 'c' ), $date ),
48 - date_i18n( get_option( 'date_format' ), $date )
51 + esc_attr( date_i18n( get_option( 'c' ), $date ) ),
52 + esc_attr( date_i18n( get_option( 'date_format' ), $date ) )
49 53 );
50 54 }
51 55 }
52 56
@@ -82,12 +86,21 @@
82 86 $classnames = array();
83 87 if ( isset( $attributes['blockLayout'] ) && 'grid' === $attributes['blockLayout'] ) {
84 88 $classnames[] = 'is-grid';
85 89 }
86 -
87 90 if ( isset( $attributes['columns'] ) && 'grid' === $attributes['blockLayout'] ) {
88 91 $classnames[] = 'columns-' . $attributes['columns'];
89 92 }
93 + if ( $attributes['displayDate'] ) {
94 + $classnames[] = 'has-dates';
95 + }
96 + if ( $attributes['displayAuthor'] ) {
97 + $classnames[] = 'has-authors';
98 + }
99 + if ( $attributes['displayExcerpt'] ) {
100 + $classnames[] = 'has-excerpts';
101 + }
102 +
90 103 $wrapper_attributes = get_block_wrapper_attributes( array( 'class' => implode( ' ', $classnames ) ) );
91 104
92 105 return sprintf( '<ul %s>%s</ul>', $wrapper_attributes, $list_items );
93 106 }