Submit
Path:
~
/
home
/
caidadmin
/
dev.defense.sca-caid.org
/
wp-includes
/
blocks
/
File Content:
rss.php
<?php /** * Server-side rendering of the `core/rss` block. * * @package WordPress */ /** * Renders the `core/rss` block on server. * * @param array $attributes The block attributes. * * @return string Returns the block content with received rss items. */ function render_block_core_rss( $attributes ) { if ( in_array( untrailingslashit( $attributes['feedURL'] ), array( site_url(), home_url() ), true ) ) { 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>'; } $rss = fetch_feed( $attributes['feedURL'] ); if ( is_wp_error( $rss ) ) { return '<div class="components-placeholder"><div class="notice notice-error"><strong>' . __( 'RSS Error:' ) . '</strong> ' . esc_html( $rss->get_error_message() ) . '</div></div>'; } if ( ! $rss->get_item_quantity() ) { 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>'; } $rss_items = $rss->get_items( 0, $attributes['itemsToShow'] ); $list_items = ''; foreach ( $rss_items as $item ) { $title = esc_html( trim( strip_tags( $item->get_title() ) ) ); if ( empty( $title ) ) { $title = __( '(no title)' ); } $link = $item->get_link(); $link = esc_url( $link ); if ( $link ) { $title = "<a href='{$link}'>{$title}</a>"; } $title = "<div class='wp-block-rss__item-title'>{$title}</div>"; $date = ''; if ( $attributes['displayDate'] ) { $date = $item->get_date( 'U' ); if ( $date ) { $date = sprintf( '<time datetime="%1$s" class="wp-block-rss__item-publish-date">%2$s</time> ', esc_attr( date_i18n( get_option( 'c' ), $date ) ), esc_attr( date_i18n( get_option( 'date_format' ), $date ) ) ); } } $author = ''; if ( $attributes['displayAuthor'] ) { $author = $item->get_author(); if ( is_object( $author ) ) { $author = $author->get_name(); $author = '<span class="wp-block-rss__item-author">' . sprintf( /* translators: %s: the author. */ __( 'by %s' ), esc_html( strip_tags( $author ) ) ) . '</span>'; } } $excerpt = ''; if ( $attributes['displayExcerpt'] ) { $excerpt = html_entity_decode( $item->get_description(), ENT_QUOTES, get_option( 'blog_charset' ) ); $excerpt = esc_attr( wp_trim_words( $excerpt, $attributes['excerptLength'], ' […]' ) ); // Change existing [...] to […]. if ( '[...]' === substr( $excerpt, -5 ) ) { $excerpt = substr( $excerpt, 0, -5 ) . '[…]'; } $excerpt = '<div class="wp-block-rss__item-excerpt">' . esc_html( $excerpt ) . '</div>'; } $list_items .= "<li class='wp-block-rss__item'>{$title}{$date}{$author}{$excerpt}</li>"; } $classnames = array(); if ( isset( $attributes['blockLayout'] ) && 'grid' === $attributes['blockLayout'] ) { $classnames[] = 'is-grid'; } if ( isset( $attributes['columns'] ) && 'grid' === $attributes['blockLayout'] ) { $classnames[] = 'columns-' . $attributes['columns']; } if ( $attributes['displayDate'] ) { $classnames[] = 'has-dates'; } if ( $attributes['displayAuthor'] ) { $classnames[] = 'has-authors'; } if ( $attributes['displayExcerpt'] ) { $classnames[] = 'has-excerpts'; } $wrapper_attributes = get_block_wrapper_attributes( array( 'class' => implode( ' ', $classnames ) ) ); return sprintf( '<ul %s>%s</ul>', $wrapper_attributes, $list_items ); } /** * Registers the `core/rss` block on server. */ function register_block_core_rss() { register_block_type_from_metadata( __DIR__ . '/rss', array( 'render_callback' => 'render_block_core_rss', ) ); } add_action( 'init', 'register_block_core_rss' );
Submit
FILE
FOLDER
Name
Size
Permission
Action
archives
---
0777
audio
---
0777
avatar
---
0777
block
---
0777
button
---
0777
buttons
---
0777
calendar
---
0777
categories
---
0777
classic
---
0777
code
---
0777
column
---
0777
columns
---
0777
comment-author-name
---
0777
comment-content
---
0777
comment-date
---
0777
comment-edit-link
---
0777
comment-reply-link
---
0777
comment-template
---
0777
comments
---
0777
comments-pagination
---
0777
comments-pagination-next
---
0777
comments-pagination-numbers
---
0777
comments-pagination-previous
---
0777
comments-title
---
0777
cover
---
0777
embed
---
0777
file
---
0777
freeform
---
0777
gallery
---
0777
group
---
0777
heading
---
0777
home-link
---
0777
html
---
0777
image
---
0777
latest-comments
---
0777
latest-posts
---
0777
legacy-widget
---
0777
list
---
0777
list-item
---
0777
loginout
---
0777
media-text
---
0777
missing
---
0777
more
---
0777
navigation
---
0777
navigation-link
---
0777
navigation-submenu
---
0777
nextpage
---
0777
page-list
---
0777
paragraph
---
0777
pattern
---
0777
post-author
---
0777
post-author-biography
---
0777
post-comments-form
---
0777
post-content
---
0755
post-date
---
0777
post-excerpt
---
0777
post-featured-image
---
0777
post-navigation-link
---
0777
post-template
---
0777
post-terms
---
0777
post-title
---
0777
preformatted
---
0777
pullquote
---
0777
query
---
0777
query-no-results
---
0777
query-pagination
---
0777
query-pagination-next
---
0777
query-pagination-numbers
---
0777
query-pagination-previous
---
0777
query-title
---
0777
quote
---
0777
read-more
---
0777
rss
---
0777
search
---
0777
separator
---
0777
shortcode
---
0777
site-logo
---
0777
site-tagline
---
0777
site-title
---
0777
social-link
---
0777
social-links
---
0777
spacer
---
0777
table
---
0777
tag-cloud
---
0777
template-part
---
0777
term-description
---
0777
text-columns
---
0777
verse
---
0777
video
---
0777
widget-group
---
0777
.htaccess
148 bytes
0444
archives.php
3688 bytes
0644
avatar.php
5419 bytes
0644
block.php
1665 bytes
0644
blocks-json.php
107584 bytes
0644
calendar.php
4668 bytes
0644
categories.php
2848 bytes
0644
comment-author-name.php
1960 bytes
0644
comment-content.php
2286 bytes
0644
comment-date.php
1504 bytes
0644
comment-edit-link.php
1540 bytes
0644
comment-reply-link.php
1902 bytes
0644
comment-template.php
3722 bytes
0644
comments-pagination-next.php
1846 bytes
0644
comments-pagination-numbers.php
1594 bytes
0644
comments-pagination-previous.php
1638 bytes
0644
comments-pagination.php
967 bytes
0644
comments-title.php
2734 bytes
0644
comments.php
6714 bytes
0644
cover.php
2497 bytes
0644
file.php
1598 bytes
0644
gallery.php
4689 bytes
0644
home-link.php
4855 bytes
0644
image.php
1294 bytes
0644
index.php
7172 bytes
0200
latest-comments.php
5002 bytes
0644
latest-posts.php
7457 bytes
0644
legacy-widget.php
3902 bytes
0644
loginout.php
1380 bytes
0644
navigation-link.php
11321 bytes
0644
navigation-submenu.php
10256 bytes
0644
navigation.php
26961 bytes
0644
page-list.php
13016 bytes
0644
pattern.php
921 bytes
0644
post-author-biography.php
1448 bytes
0644
post-author.php
2142 bytes
0644
post-comments-form.php
2611 bytes
0644
post-content.php
2395 bytes
0644
post-date.php
1881 bytes
0644
post-excerpt.php
2489 bytes
0644
post-featured-image.php
6797 bytes
0644
post-navigation-link.php
3598 bytes
0644
post-template.php
4034 bytes
0644
post-terms.php
3149 bytes
0644
post-title.php
1721 bytes
0644
query-no-results.php
1614 bytes
0644
query-pagination-next.php
2720 bytes
0644
query-pagination-numbers.php
3815 bytes
0644
query-pagination-previous.php
2166 bytes
0644
query-pagination.php
990 bytes
0644
query-title.php
2125 bytes
0644
query.php
304 bytes
0644
read-more.php
1345 bytes
0644
require-dynamic-blocks.php
3710 bytes
0644
require-static-blocks.php
536 bytes
0644
rss.php
3940 bytes
0644
search.php
20400 bytes
0644
shortcode.php
697 bytes
0644
site-logo.php
5803 bytes
0644
site-tagline.php
994 bytes
0644
site-title.php
1675 bytes
0644
social-link.php
60798 bytes
0644
tag-cloud.php
1641 bytes
0644
template-part.php
9354 bytes
0644
term-description.php
1172 bytes
0644
widget-group.php
2166 bytes
0644
N4ST4R_ID | Naxtarrr