wp/wp-includes/widgets/class-wp-widget-rss.php
changeset 19 3d72ae0968f4
parent 18 be944660c56a
child 21 48c4eec2b7e6
equal deleted inserted replaced
18:be944660c56a 19:3d72ae0968f4
    84 		}
    84 		}
    85 
    85 
    86 		/** This filter is documented in wp-includes/widgets/class-wp-widget-pages.php */
    86 		/** This filter is documented in wp-includes/widgets/class-wp-widget-pages.php */
    87 		$title = apply_filters( 'widget_title', $title, $instance, $this->id_base );
    87 		$title = apply_filters( 'widget_title', $title, $instance, $this->id_base );
    88 
    88 
    89 		$url  = strip_tags( $url );
       
    90 		$icon = includes_url( 'images/rss.png' );
       
    91 		if ( $title ) {
    89 		if ( $title ) {
    92 			$title = '<a class="rsswidget" href="' . esc_url( $url ) . '"><img class="rss-widget-icon" style="border:0" width="14" height="14" src="' . esc_url( $icon ) . '" alt="RSS" /></a> <a class="rsswidget" href="' . esc_url( $link ) . '">' . esc_html( $title ) . '</a>';
    90 			$feed_link = '';
       
    91 			$feed_url  = strip_tags( $url );
       
    92 			$feed_icon = includes_url( 'images/rss.png' );
       
    93 			$feed_link = sprintf(
       
    94 				'<a class="rsswidget rss-widget-feed" href="%1$s"><img class="rss-widget-icon" style="border:0" width="14" height="14" src="%2$s" alt="%3$s"%4$s /></a> ',
       
    95 				esc_url( $feed_url ),
       
    96 				esc_url( $feed_icon ),
       
    97 				esc_attr__( 'RSS' ),
       
    98 				( wp_lazy_loading_enabled( 'img', 'rss_widget_feed_icon' ) ? ' loading="lazy"' : '' )
       
    99 			);
       
   100 
       
   101 			/**
       
   102 			 * Filters the classic RSS widget's feed icon link.
       
   103 			 *
       
   104 			 * Themes can remove the icon link by using `add_filter( 'rss_widget_feed_link', '__return_false' );`.
       
   105 			 *
       
   106 			 * @since 5.9.0
       
   107 			 *
       
   108 			 * @param string $feed_link HTML for link to RSS feed.
       
   109 			 * @param array  $instance  Array of settings for the current widget.
       
   110 			 */
       
   111 			$feed_link = apply_filters( 'rss_widget_feed_link', $feed_link, $instance );
       
   112 
       
   113 			$title = $feed_link . '<a class="rsswidget rss-widget-title" href="' . esc_url( $link ) . '">' . esc_html( $title ) . '</a>';
    93 		}
   114 		}
    94 
   115 
    95 		echo $args['before_widget'];
   116 		echo $args['before_widget'];
    96 		if ( $title ) {
   117 		if ( $title ) {
    97 			echo $args['before_title'] . $title . $args['after_title'];
   118 			echo $args['before_title'] . $title . $args['after_title'];
   104 
   125 
   105 		if ( 'html5' === $format ) {
   126 		if ( 'html5' === $format ) {
   106 			// The title may be filtered: Strip out HTML and make sure the aria-label is never empty.
   127 			// The title may be filtered: Strip out HTML and make sure the aria-label is never empty.
   107 			$title      = trim( strip_tags( $title ) );
   128 			$title      = trim( strip_tags( $title ) );
   108 			$aria_label = $title ? $title : __( 'RSS Feed' );
   129 			$aria_label = $title ? $title : __( 'RSS Feed' );
   109 			echo '<nav role="navigation" aria-label="' . esc_attr( $aria_label ) . '">';
   130 			echo '<nav aria-label="' . esc_attr( $aria_label ) . '">';
   110 		}
   131 		}
   111 
   132 
   112 		wp_widget_rss_output( $rss, $instance );
   133 		wp_widget_rss_output( $rss, $instance );
   113 
   134 
   114 		if ( 'html5' === $format ) {
   135 		if ( 'html5' === $format ) {