Make WordPress Core


Ignore:
Timestamp:
01/29/2020 12:43:23 AM (5 years ago)
Author:
SergeyBiryukov
Message:

Docs: Improve inline comments per the documentation standards.

Includes minor code layout fixes for better readability.

See #48303.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/feed-rss2-comments.php

    r45932 r47122  
    7171    do_action( 'commentsrss2_head' );
    7272
    73     if ( have_comments() ) :
    74         while ( have_comments() ) :
    75             the_comment();
    76             $comment_post    = get_post( $comment->comment_post_ID );
    77             $GLOBALS['post'] = $comment_post;
    78             ?>
    79             <item>
    80                 <title>
    81                 <?php
    82                 if ( ! is_singular() ) {
    83                     $title = get_the_title( $comment_post->ID );
    84                     /** This filter is documented in wp-includes/feed.php */
    85                     $title = apply_filters( 'the_title_rss', $title );
    86                     /* translators: Individual comment title. 1: Post title, 2: Comment author name. */
    87                     printf( ent2ncr( __( 'Comment on %1$s by %2$s' ) ), $title, get_comment_author_rss() );
    88                 } else {
    89                     /* translators: Comment author title. %s: Comment author name. */
    90                     printf( ent2ncr( __( 'By: %s' ) ), get_comment_author_rss() );
    91                 }
    92                 ?>
    93                 </title>
    94                 <link><?php comment_link(); ?></link>
     73    while ( have_comments() ) :
     74        the_comment();
     75        $comment_post    = get_post( $comment->comment_post_ID );
     76        $GLOBALS['post'] = $comment_post;
     77        ?>
     78    <item>
     79        <title>
     80        <?php
     81        if ( ! is_singular() ) {
     82            $title = get_the_title( $comment_post->ID );
     83            /** This filter is documented in wp-includes/feed.php */
     84            $title = apply_filters( 'the_title_rss', $title );
     85            /* translators: Individual comment title. 1: Post title, 2: Comment author name. */
     86            printf( ent2ncr( __( 'Comment on %1$s by %2$s' ) ), $title, get_comment_author_rss() );
     87        } else {
     88            /* translators: Comment author title. %s: Comment author name. */
     89            printf( ent2ncr( __( 'By: %s' ) ), get_comment_author_rss() );
     90        }
     91        ?>
     92        </title>
     93        <link><?php comment_link(); ?></link>
     94
    9595        <dc:creator><![CDATA[<?php echo get_comment_author_rss(); ?>]]></dc:creator>
    9696        <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>
    9797        <guid isPermaLink="false"><?php comment_guid(); ?></guid>
    98             <?php if ( post_password_required( $comment_post ) ) : ?>
    99         <description><?php echo ent2ncr( __( 'Protected Comments: Please enter your password to view comments.' ) ); ?></description>
    100         <content:encoded><![CDATA[<?php echo get_the_password_form(); ?>]]></content:encoded>
    101         <?php else : // post pass ?>
    102         <description><![CDATA[<?php comment_text_rss(); ?>]]></description>
    103         <content:encoded><![CDATA[<?php comment_text(); ?>]]></content:encoded>
    104             <?php
    105         endif; // post pass
    106             /**
    107              * Fires at the end of each RSS2 comment feed item.
    108              *
    109              * @since 2.1.0
    110              *
    111              * @param int $comment->comment_ID The ID of the comment being displayed.
    112              * @param int $comment_post->ID    The ID of the post the comment is connected to.
    113              */
    114             do_action( 'commentrss2_item', $comment->comment_ID, $comment_post->ID );
     98
     99        <?php if ( post_password_required( $comment_post ) ) : ?>
     100            <description><?php echo ent2ncr( __( 'Protected Comments: Please enter your password to view comments.' ) ); ?></description>
     101            <content:encoded><![CDATA[<?php echo get_the_password_form(); ?>]]></content:encoded>
     102        <?php else : ?>
     103            <description><![CDATA[<?php comment_text_rss(); ?>]]></description>
     104            <content:encoded><![CDATA[<?php comment_text(); ?>]]></content:encoded>
     105        <?php endif; // End if post_password_required(). ?>
     106
     107        <?php
     108        /**
     109         * Fires at the end of each RSS2 comment feed item.
     110         *
     111         * @since 2.1.0
     112         *
     113         * @param int $comment->comment_ID The ID of the comment being displayed.
     114         * @param int $comment_post->ID    The ID of the post the comment is connected to.
     115         */
     116        do_action( 'commentrss2_item', $comment->comment_ID, $comment_post->ID );
    115117        ?>
    116             </item>
    117             <?php
    118         endwhile;
    119 endif;
    120     ?>
     118    </item>
     119    <?php endwhile; ?>
    121120</channel>
    122121</rss>
Note: See TracChangeset for help on using the changeset viewer.