--- a/wp/wp-includes/widgets/class-wp-widget-rss.php Tue Oct 22 16:11:46 2019 +0200
+++ b/wp/wp-includes/widgets/class-wp-widget-rss.php Tue Dec 15 13:49:49 2020 +0100
@@ -48,7 +48,7 @@
}
$url = ! empty( $instance['url'] ) ? $instance['url'] : '';
- while ( stristr( $url, 'http' ) != $url ) {
+ while ( stristr( $url, 'http' ) !== $url ) {
$url = substr( $url, 1 );
}
@@ -56,8 +56,8 @@
return;
}
- // self-url destruction sequence
- if ( in_array( untrailingslashit( $url ), array( site_url(), home_url() ) ) ) {
+ // Self-URL destruction sequence.
+ if ( in_array( untrailingslashit( $url ), array( site_url(), home_url() ), true ) ) {
return;
}
@@ -67,12 +67,12 @@
$link = '';
if ( ! is_wp_error( $rss ) ) {
- $desc = esc_attr( strip_tags( @html_entity_decode( $rss->get_description(), ENT_QUOTES, get_option( 'blog_charset' ) ) ) );
+ $desc = esc_attr( strip_tags( html_entity_decode( $rss->get_description(), ENT_QUOTES, get_option( 'blog_charset' ) ) ) );
if ( empty( $title ) ) {
$title = strip_tags( $rss->get_title() );
}
$link = strip_tags( $rss->get_permalink() );
- while ( stristr( $link, 'http' ) != $link ) {
+ while ( stristr( $link, 'http' ) !== $link ) {
$link = substr( $link, 1 );
}
}
@@ -94,7 +94,25 @@
if ( $title ) {
echo $args['before_title'] . $title . $args['after_title'];
}
+
+ $format = current_theme_supports( 'html5', 'navigation-widgets' ) ? 'html5' : 'xhtml';
+
+ /** This filter is documented in wp-includes/widgets/class-wp-nav-menu-widget.php */
+ $format = apply_filters( 'navigation_widgets_format', $format );
+
+ if ( 'html5' === $format ) {
+ // The title may be filtered: Strip out HTML and make sure the aria-label is never empty.
+ $title = trim( strip_tags( $title ) );
+ $aria_label = $title ? $title : __( 'RSS Feed' );
+ echo '<nav role="navigation" aria-label="' . esc_attr( $aria_label ) . '">';
+ }
+
wp_widget_rss_output( $rss, $instance );
+
+ if ( 'html5' === $format ) {
+ echo '</nav>';
+ }
+
echo $args['after_widget'];
if ( ! is_wp_error( $rss ) ) {
@@ -114,7 +132,7 @@
* @return array Updated settings to save.
*/
public function update( $new_instance, $old_instance ) {
- $testurl = ( isset( $new_instance['url'] ) && ( ! isset( $old_instance['url'] ) || ( $new_instance['url'] != $old_instance['url'] ) ) );
+ $testurl = ( isset( $new_instance['url'] ) && ( ! isset( $old_instance['url'] ) || ( $new_instance['url'] !== $old_instance['url'] ) ) );
return wp_widget_rss_process( $new_instance, $testurl );
}