Make WordPress Core


Ignore:
Timestamp:
01/29/2020 12:43:23 AM (7 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-atom-comments.php

    r45932 r47122  
    4646        <updated><?php echo get_feed_build_date( 'Y-m-d\TH:i:s\Z' ); ?></updated>
    4747
    48 <?php if ( is_singular() ) { ?>
     48<?php if ( is_singular() ) : ?>
    4949        <link rel="alternate" type="<?php bloginfo_rss( 'html_type' ); ?>" href="<?php comments_link_feed(); ?>" />
    5050        <link rel="self" type="application/atom+xml" href="<?php echo esc_url( get_post_comments_feed_link( '', 'atom' ) ); ?>" />
    5151        <id><?php echo esc_url( get_post_comments_feed_link( '', 'atom' ) ); ?></id>
    52 <?php } elseif ( is_search() ) { ?>
     52<?php elseif ( is_search() ) : ?>
    5353        <link rel="alternate" type="<?php bloginfo_rss( 'html_type' ); ?>" href="<?php echo home_url() . '?s=' . get_search_query(); ?>" />
    5454        <link rel="self" type="application/atom+xml" href="<?php echo get_search_comments_feed_link( '', 'atom' ); ?>" />
    5555        <id><?php echo get_search_comments_feed_link( '', 'atom' ); ?></id>
    56 <?php } else { ?>
     56<?php else : ?>
    5757        <link rel="alternate" type="<?php bloginfo_rss( 'html_type' ); ?>" href="<?php bloginfo_rss( 'url' ); ?>" />
    5858        <link rel="self" type="application/atom+xml" href="<?php bloginfo_rss( 'comments_atom_url' ); ?>" />
    5959        <id><?php bloginfo_rss( 'comments_atom_url' ); ?></id>
    60 <?php } ?>
     60<?php endif; ?>
    6161<?php
    6262        /**
     
    6868?>
    6969<?php
    70 if ( have_comments() ) :
    71         while ( have_comments() ) :
    72                 the_comment();
    73                 $comment_post    = get_post( $comment->comment_post_ID );
    74                 $GLOBALS['post'] = $comment_post;
    75                 ?>
     70while ( have_comments() ) :
     71        the_comment();
     72        $comment_post    = get_post( $comment->comment_post_ID );
     73        $GLOBALS['post'] = $comment_post;
     74        ?>
    7675        <entry>
    7776                <title>
     
    8887                }
    8988                ?>
    90                         </title>
    91                         <link rel="alternate" href="<?php comment_link(); ?>" type="<?php bloginfo_rss( 'html_type' ); ?>" />
     89                </title>
     90                <link rel="alternate" href="<?php comment_link(); ?>" type="<?php bloginfo_rss( 'html_type' ); ?>" />
    9291
    9392                <author>
     
    103102                <updated><?php echo mysql2date( 'Y-m-d\TH:i:s\Z', get_comment_time( 'Y-m-d H:i:s', true, false ), false ); ?></updated>
    104103                <published><?php echo mysql2date( 'Y-m-d\TH:i:s\Z', get_comment_time( 'Y-m-d H:i:s', true, false ), false ); ?></published>
     104
    105105                <?php if ( post_password_required( $comment_post ) ) : ?>
    106                 <content type="html" xml:base="<?php comment_link(); ?>"><![CDATA[<?php echo get_the_password_form(); ?>]]></content>
    107         <?php else : // post pass ?>
    108                 <content type="html" xml:base="<?php comment_link(); ?>"><![CDATA[<?php comment_text(); ?>]]></content>
     106                        <content type="html" xml:base="<?php comment_link(); ?>"><![CDATA[<?php echo get_the_password_form(); ?>]]></content>
     107                <?php else : ?>
     108                        <content type="html" xml:base="<?php comment_link(); ?>"><![CDATA[<?php comment_text(); ?>]]></content>
     109                <?php endif; // End if post_password_required(). ?>
     110
    109111                <?php
    110         endif; // post pass
    111         // Return comment threading information (https://www.ietf.org/rfc/rfc4685.txt)
    112         if ( $comment->comment_parent == 0 ) : // This comment is top level
     112                // Return comment threading information (https://www.ietf.org/rfc/rfc4685.txt).
     113                if ( $comment->comment_parent == 0 ) : // This comment is top-level.
     114                        ?>
     115                        <thr:in-reply-to ref="<?php the_guid(); ?>" href="<?php the_permalink_rss(); ?>" type="<?php bloginfo_rss( 'html_type' ); ?>" />
     116                        <?php
     117                else : // This comment is in reply to another comment.
     118                        $parent_comment = get_comment( $comment->comment_parent );
     119                        /*
     120                         * The rel attribute below and the id tag above should be GUIDs,
     121                         * but WP doesn't create them for comments (unlike posts).
     122                         * Either way, it's more important that they both use the same system.
     123                         */
     124                        ?>
     125                        <thr:in-reply-to ref="<?php comment_guid( $parent_comment ); ?>" href="<?php echo get_comment_link( $parent_comment ); ?>" type="<?php bloginfo_rss( 'html_type' ); ?>" />
     126                        <?php
     127                endif;
     128
     129                /**
     130                 * Fires at the end of each Atom comment feed item.
     131                 *
     132                 * @since 2.2.0
     133                 *
     134                 * @param int $comment_id      ID of the current comment.
     135                 * @param int $comment_post_id ID of the post the current comment is connected to.
     136                 */
     137                do_action( 'comment_atom_entry', $comment->comment_ID, $comment_post->ID );
    113138                ?>
    114         <thr:in-reply-to ref="<?php the_guid(); ?>" href="<?php the_permalink_rss(); ?>" type="<?php bloginfo_rss( 'html_type' ); ?>" />
    115                 <?php
    116         else : // This comment is in reply to another comment
    117                 $parent_comment = get_comment( $comment->comment_parent );
    118                 // The rel attribute below and the id tag above should be GUIDs, but WP doesn't create them for comments (unlike posts). Either way, it's more important that they both use the same system
    119                 ?>
    120                 <thr:in-reply-to ref="<?php comment_guid( $parent_comment ); ?>" href="<?php echo get_comment_link( $parent_comment ); ?>" type="<?php bloginfo_rss( 'html_type' ); ?>" />
    121                 <?php
    122 endif;
    123         /**
    124          * Fires at the end of each Atom comment feed item.
    125          *
    126          * @since 2.2.0
    127          *
    128          * @param int $comment_id      ID of the current comment.
    129          * @param int $comment_post_id ID of the post the current comment is connected to.
    130          */
    131         do_action( 'comment_atom_entry', $comment->comment_ID, $comment_post->ID );
    132         ?>
    133139        </entry>
    134                 <?php
    135         endwhile;
    136 endif;
     140        <?php
     141endwhile;
    137142?>
    138143</feed>
Note: See TracChangeset for help on using the changeset viewer.