Make WordPress Core

Ticket #52224: 52224.4-filter.diff

File 52224.4-filter.diff, 8.1 KB (added by sabernhardt, 3 years ago)

filter with theme and unit test updates (no checkbox option), plus Twenty Seventeen RTL fix

  • src/wp-content/themes/twentyseventeen/rtl.css

     
    229229        margin: 0;
    230230}
    231231
     232.widget_rss .widget-title .rsswidget:first-child:not(.rss-widget-title) {
     233        float: left;
     234}
     235
    232236.search-form .search-submit {
    233237        left: 3px;
    234238        right: auto;
  • src/wp-content/themes/twentyseventeen/style.css

     
    26622662
    26632663/* RSS Widget */
    26642664
    2665 .widget_rss .widget-title .rsswidget:first-child {
     2665.widget_rss .widget-title .rsswidget:first-child:not(.rss-widget-title) {
    26662666        float: right;
    26672667}
    26682668
  • src/wp-content/themes/twentytwenty/style-rtl.css

     
    42864286
    42874287/* Widget: RSS ------------------------------- */
    42884288
    4289 .widget_rss .widget-title a.rsswidget:first-of-type {
     4289.widget_rss .widget-title a.rsswidget:first-of-type:not(.rss-widget-title) {
    42904290        display: none;
    42914291}
    42924292
  • src/wp-content/themes/twentytwenty/style.css

     
    43204320
    43214321/* Widget: RSS ------------------------------- */
    43224322
    4323 .widget_rss .widget-title a.rsswidget:first-of-type {
     4323.widget_rss .widget-title a.rsswidget:first-of-type:not(.rss-widget-title) {
    43244324        display: none;
    43254325}
    43264326
  • src/wp-includes/widgets/class-wp-widget-rss.php

     
    8686                /** This filter is documented in wp-includes/widgets/class-wp-widget-pages.php */
    8787                $title = apply_filters( 'widget_title', $title, $instance, $this->id_base );
    8888
    89                 $url  = strip_tags( $url );
    90                 $icon = includes_url( 'images/rss.png' );
    9189                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>';
    93114                }
    94115
    95116                echo $args['before_widget'];
  • tests/phpunit/tests/rest-api/rest-widgets-controller.php

     
    319319                                        'id'       => 'rss-1',
    320320                                        'id_base'  => 'rss',
    321321                                        'sidebar'  => 'sidebar-1',
    322                                         'rendered' => '<a class="rsswidget" href="https://wordpress.org/news/feed"><img class="rss-widget-icon" style="border:0" width="14" height="14" src="http://example.org/wp-includes/images/rss.png" alt="RSS" /></a> <a class="rsswidget" href="https://wordpress.org/news">RSS test</a><ul><li><a class=\'rsswidget\' href=\'https://wordpress.org/news/2020/12/introducing-learn-wordpress/\'>Introducing Learn WordPress</a></li><li><a class=\'rsswidget\' href=\'https://wordpress.org/news/2020/12/simone/\'>WordPress 5.6 “Simone”</a></li><li><a class=\'rsswidget\' href=\'https://wordpress.org/news/2020/12/state-of-the-word-2020/\'>State of the Word 2020</a></li><li><a class=\'rsswidget\' href=\'https://wordpress.org/news/2020/12/the-month-in-wordpress-november-2020/\'>The Month in WordPress: November 2020</a></li><li><a class=\'rsswidget\' href=\'https://wordpress.org/news/2020/12/wordpress-5-6-release-candidate-2/\'>WordPress 5.6 Release Candidate 2</a></li><li><a class=\'rsswidget\' href=\'https://wordpress.org/news/2020/11/wordpress-5-6-release-candidate/\'>WordPress 5.6 Release Candidate</a></li><li><a class=\'rsswidget\' href=\'https://wordpress.org/news/2020/11/wordpress-5-6-beta-4/\'>WordPress 5.6 Beta 4</a></li><li><a class=\'rsswidget\' href=\'https://wordpress.org/news/2020/11/wordpress-5-6-beta-3/\'>WordPress 5.6 Beta 3</a></li><li><a class=\'rsswidget\' href=\'https://wordpress.org/news/2020/11/the-month-in-wordpress-october-2020/\'>The Month in WordPress: October 2020</a></li><li><a class=\'rsswidget\' href=\'https://wordpress.org/news/2020/10/wordpress-5-5-3-maintenance-release/\'>WordPress 5.5.3 Maintenance Release</a></li></ul>',
     322                                        'rendered' => '<a class="rsswidget rss-widget-feed" href="https://wordpress.org/news/feed"><img class="rss-widget-icon" style="border:0" width="14" height="14" src="http://example.org/wp-includes/images/rss.png" alt="RSS" loading="lazy" /></a> <a class="rsswidget rss-widget-title" href="https://wordpress.org/news">RSS test</a><ul><li><a class=\'rsswidget\' href=\'https://wordpress.org/news/2020/12/introducing-learn-wordpress/\'>Introducing Learn WordPress</a></li><li><a class=\'rsswidget\' href=\'https://wordpress.org/news/2020/12/simone/\'>WordPress 5.6 “Simone”</a></li><li><a class=\'rsswidget\' href=\'https://wordpress.org/news/2020/12/state-of-the-word-2020/\'>State of the Word 2020</a></li><li><a class=\'rsswidget\' href=\'https://wordpress.org/news/2020/12/the-month-in-wordpress-november-2020/\'>The Month in WordPress: November 2020</a></li><li><a class=\'rsswidget\' href=\'https://wordpress.org/news/2020/12/wordpress-5-6-release-candidate-2/\'>WordPress 5.6 Release Candidate 2</a></li><li><a class=\'rsswidget\' href=\'https://wordpress.org/news/2020/11/wordpress-5-6-release-candidate/\'>WordPress 5.6 Release Candidate</a></li><li><a class=\'rsswidget\' href=\'https://wordpress.org/news/2020/11/wordpress-5-6-beta-4/\'>WordPress 5.6 Beta 4</a></li><li><a class=\'rsswidget\' href=\'https://wordpress.org/news/2020/11/wordpress-5-6-beta-3/\'>WordPress 5.6 Beta 3</a></li><li><a class=\'rsswidget\' href=\'https://wordpress.org/news/2020/11/the-month-in-wordpress-october-2020/\'>The Month in WordPress: October 2020</a></li><li><a class=\'rsswidget\' href=\'https://wordpress.org/news/2020/10/wordpress-5-5-3-maintenance-release/\'>WordPress 5.5.3 Maintenance Release</a></li></ul>',
    323323                                        'instance' => array(
    324324                                                'encoded' => base64_encode(
    325325                                                        serialize(
  • tests/phpunit/tests/widgets/wpWidgetRss.php

     
    9494                return array(
    9595                        'when url is given' => array(
    9696                                'url' => 'https://wordpress.org/news/feed/',
    97                                 '<section id="widget_rss-5" class="widget widget_rss"><h2><a class="rsswidget" href="https://wordpress.org/news/feed/">',
     97                                '<section id="widget_rss-5" class="widget widget_rss"><h2><a class="rsswidget rss-widget-feed" href="https://wordpress.org/news/feed/">',
    9898                        ),
    9999                );
    100100        }