Make WordPress Core

Ticket #13867: 13867.4.diff

File 13867.4.diff, 3.1 KB (added by telmoteixeira, 7 years ago)
  • src/wp-includes/feed-rss2-comments.php

     
    3232        ?>
    3333>
    3434<channel>
    35         <title>
    36         <?php
     35        <title><?php
     36        $page_title = '';
    3737        if ( is_singular() ) {
    3838                /* translators: Comments feed title. 1: Post title */
    39                 printf( ent2ncr( __( 'Comments on: %s' ) ), get_the_title_rss() );
     39                $page_title = sprintf( ent2ncr( __( 'Comments on: %s' ) ), get_the_title_rss() );
    4040        } elseif ( is_search() ) {
    4141                /* translators: Comments feed title. 1: Site name, 2: Search query */
    42                 printf( ent2ncr( __( 'Comments for %1$s searching on %2$s' ) ), get_bloginfo_rss( 'name' ), get_search_query() );
     42                $page_title = sprintf( ent2ncr( __( 'Comments for %1$s searching on %2$s' ) ), get_bloginfo_rss( 'name' ), get_search_query() );
    4343        } else {
    4444                /* translators: Comments feed title. 1: Site name */
    45                 printf( ent2ncr( __( 'Comments for %s' ) ), get_wp_title_rss() );
     45                $page_title = sprintf( ent2ncr( __( 'Comments for %s' ) ), get_bloginfo_rss( 'name' ) . get_wp_title_rss() );
    4646        }
    47         ?>
    48         </title>
     47
     48        /**
     49         * Filter the page title for the RSS2 comments feed.
     50         *
     51         * @since 4.9
     52         *
     53         * @param string $page_title RSS2 comments feed page title.
     54         */
     55        echo apply_filters( 'rss_comments_page_title', $page_title, get_the_title_rss() );
     56        ?></title>
    4957        <atom:link href="<?php self_link(); ?>" rel="self" type="application/rss+xml" />
    5058        <link><?php ( is_single() ) ? the_permalink_rss() : bloginfo_rss( 'url' ); ?></link>
    5159        <description><?php bloginfo_rss( 'description' ); ?></description>
     
    8189                        $comment_post = $GLOBALS['post'] = get_post( $comment->comment_post_ID );
    8290                        ?>
    8391                        <item>
    84                                 <title>
    85                                 <?php
     92                                <title><?php
     93                                $item_title = '';
    8694                                if ( ! is_singular() ) {
    8795                                        $title = get_the_title( $comment_post->ID );
    8896                                        /** This filter is documented in wp-includes/feed.php */
    8997                                        $title = apply_filters( 'the_title_rss', $title );
    9098                                        /* translators: Individual comment title. 1: Post title, 2: Comment author name */
    91                                         printf( ent2ncr( __( 'Comment on %1$s by %2$s' ) ), $title, get_comment_author_rss() );
     99                                        $item_title = sprintf( ent2ncr( __( 'Comment on %1$s by %2$s' ) ), $title, get_comment_author_rss() );
    92100                                } else {
    93101                                        /* translators: Comment author title. 1: Comment author name */
    94                                         printf( ent2ncr( __( 'By: %s' ) ), get_comment_author_rss() );
     102                                        $item_title = sprintf( ent2ncr( __( 'By: %s' ) ), get_comment_author_rss() );
    95103                                }
    96                                 ?>
    97                                 </title>
     104
     105                                /**
     106                                 * Filter the title to use for an item in an RSS2 comments feed.
     107                                 *
     108                                 * @since 4.9
     109                                 *
     110                                 * @param string $item_title   RSS2 comments feed item title.
     111                                 * @param object $comment_post Comment post object.
     112                                 */
     113                                echo apply_filters( 'rss_comments_item_title', $item_title, $comment_post );
     114                                ?></title>
    98115                                <link><?php comment_link(); ?></link>
    99116                <dc:creator><![CDATA[<?php echo get_comment_author_rss(); ?>]]></dc:creator>
    100117                <pubDate><?php echo mysql2date( 'D, d M Y H:i:s +0000', get_comment_time( 'Y-m-d H:i:s', true, false ), false ); ?></pubDate>