Make WordPress Core


Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/comment-template.php

    r15434 r17071  
    163163 * @see get_comment_author_link() Echoes result
    164164 *
    165  * @param int The ID of the comment for which to print the author's link. Optional.
     165 * @param int $comment_ID The ID of the comment for which to print the author's link. Optional.
    166166 */
    167167function comment_author_link( $comment_ID = 0 ) {
     
    546546 */
    547547function get_comments_number( $post_id = 0 ) {
    548     global $id;
    549     $post_id = (int) $post_id;
     548    $post_id = absint( $post_id );
    550549
    551550    if ( !$post_id )
    552         $post_id = (int) $id;
     551        $post_id = get_the_ID();
    553552
    554553    $post = get_post($post_id);
     
    565564 *
    566565 * @since 0.71
    567  * @uses $id
    568566 * @uses apply_filters() Calls the 'comments_number' hook on the output and number of comments respectively.
    569567 *
     
    574572 */
    575573function comments_number( $zero = false, $one = false, $more = false, $deprecated = '' ) {
    576     global $id;
    577 
    578574    if ( !empty( $deprecated ) )
    579575        _deprecated_argument( __FUNCTION__, '1.3' );
    580576
    581     $number = get_comments_number($id);
     577    $number = get_comments_number();
    582578
    583579    if ( $number > 1 )
     
    602598function get_comment_text( $comment_ID = 0 ) {
    603599    $comment = get_comment( $comment_ID );
    604     return apply_filters('get_comment_text', $comment->comment_content);
     600    return apply_filters( 'get_comment_text', $comment->comment_content, $comment );
    605601}
    606602
     
    615611 */
    616612function comment_text( $comment_ID = 0 ) {
    617     echo apply_filters('comment_text', get_comment_text() );
     613    $comment = get_comment( $comment_ID );
     614    echo apply_filters( 'comment_text', get_comment_text( $comment_ID ), $comment );
    618615}
    619616
     
    679676 */
    680677function comment_type($commenttxt = false, $trackbacktxt = false, $pingbacktxt = false) {
    681     if ( false === $commenttxt ) $commenttxt = _x( 'Comment', 'noun' );
    682     if ( false === $trackbacktxt ) $trackbacktxt = __( 'Trackback' );
    683     if ( false === $pingbacktxt ) $pingbacktxt = __( 'Pingback' );
     678    if ( false === $commenttxt ) $commenttxt = _x( 'Comment', 'noun' );
     679    if ( false === $trackbacktxt ) $trackbacktxt = __( 'Trackback' );
     680    if ( false === $pingbacktxt ) $pingbacktxt = __( 'Pingback' );
    684681    $type = get_comment_type();
    685682    switch( $type ) {
     
    704701 * @since 1.5.0
    705702 * @uses apply_filters() Calls 'trackback_url' on the resulting trackback URL
    706  * @uses $id
    707703 *
    708704 * @return string The trackback URL after being filtered
    709705 */
    710706function get_trackback_url() {
    711     global $id;
    712707    if ( '' != get_option('permalink_structure') ) {
    713708        $tb_url = trailingslashit(get_permalink()) . user_trailingslashit('trackback', 'single_trackback');
    714709    } else {
    715         $tb_url = get_option('siteurl') . '/wp-trackback.php?p=' . $id;
     710        $tb_url = get_option('siteurl') . '/wp-trackback.php?p=' . get_the_ID();
    716711    }
    717712    return apply_filters('trackback_url', $tb_url);
     
    748743    if ( !empty( $deprecated ) )
    749744        _deprecated_argument( __FUNCTION__, '2.5' );
     745
     746    if ( false !== stripos($_SERVER['HTTP_USER_AGENT'], 'W3C_Validator') )
     747        return;
    750748
    751749    echo '<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
     
    842840 * @global array $comment List of comment objects for the current post
    843841 * @uses $wpdb
    844  * @uses $id
    845842 * @uses $post
    846843 * @uses $withcomments Will not try to get the comments if the post has none.
     
    959956 *
    960957 * @since 0.71
    961  * @uses $id
    962958 * @uses $wpcommentspopupfile
    963959 * @uses $wpcommentsjavascript
     
    972968 */
    973969function comments_popup_link( $zero = false, $one = false, $more = false, $css_class = '', $none = false ) {
    974     global $id, $wpcommentspopupfile, $wpcommentsjavascript;
    975 
    976     if ( false === $zero ) $zero = __( 'No Comments' );
    977     if ( false === $one ) $one = __( '1 Comment' );
    978     if ( false === $more ) $more = __( '% Comments' );
    979     if ( false === $none ) $none = __( 'Comments Off' );
     970    global $wpcommentspopupfile, $wpcommentsjavascript;
     971
     972    $id = get_the_ID();
     973
     974    if ( false === $zero ) $zero = __( 'No Comments' );
     975    if ( false === $one ) $one = __( '1 Comment' );
     976    if ( false === $more ) $more = __( '% Comments' );
     977    if ( false === $none ) $none = __( 'Comments Off' );
    980978
    981979    $number = get_comments_number( $id );
     
    10621060        $link = '<a rel="nofollow" class="comment-reply-login" href="' . esc_url( wp_login_url( get_permalink() ) ) . '">' . $login_text . '</a>';
    10631061    else
    1064         $link = "<a rel='nofollow' class='comment-reply-link' href='" . esc_url( add_query_arg( 'replytocom', $comment->comment_ID ) ) . "#" . $respond_id . "' onclick='return addComment.moveForm(\"$add_below-$comment->comment_ID\", \"$comment->comment_ID\", \"$respond_id\", \"$post->ID\")'>$reply_text</a>";
     1062        $link = "<a class='comment-reply-link' href='" . esc_url( add_query_arg( 'replytocom', $comment->comment_ID ) ) . "#" . $respond_id . "' onclick='return addComment.moveForm(\"$add_below-$comment->comment_ID\", \"$comment->comment_ID\", \"$respond_id\", \"$post->ID\")'>$reply_text</a>";
    10651063    return apply_filters('comment_reply_link', $before . $link . $after, $args, $comment, $post);
    10661064}
     
    11661164 */
    11671165function get_comment_id_fields() {
    1168     global $id;
     1166    $id = get_the_ID();
    11691167
    11701168    $replytoid = isset($_GET['replytocom']) ? (int) $_GET['replytocom'] : 0;
     
    12151213 * @package WordPress
    12161214 * @uses Walker
    1217  * @since unknown
     1215 * @since 2.7.0
    12181216 */
    12191217class Walker_Comment extends Walker {
    12201218    /**
    12211219     * @see Walker::$tree_type
    1222      * @since unknown
     1220     * @since 2.7.0
    12231221     * @var string
    12241222     */
     
    12271225    /**
    12281226     * @see Walker::$db_fields
    1229      * @since unknown
     1227     * @since 2.7.0
    12301228     * @var array
    12311229     */
     
    12341232    /**
    12351233     * @see Walker::start_lvl()
    1236      * @since unknown
     1234     * @since 2.7.0
    12371235     *
    12381236     * @param string $output Passed by reference. Used to append additional content.
     
    12581256    /**
    12591257     * @see Walker::end_lvl()
    1260      * @since unknown
     1258     * @since 2.7.0
    12611259     *
    12621260     * @param string $output Passed by reference. Used to append additional content.
     
    13211319    /**
    13221320     * @see Walker::start_el()
    1323      * @since unknown
     1321     * @since 2.7.0
    13241322     *
    13251323     * @param string $output Passed by reference. Used to append additional content.
     
    13571355        </div>
    13581356<?php if ($comment->comment_approved == '0') : ?>
    1359         <em><?php _e('Your comment is awaiting moderation.') ?></em>
     1357        <em class="comment-awaiting-moderation"><?php _e('Your comment is awaiting moderation.') ?></em>
    13601358        <br />
    13611359<?php endif; ?>
     
    13811379    /**
    13821380     * @see Walker::end_el()
    1383      * @since unknown
     1381     * @since 2.7.0
    13841382     *
    13851383     * @param string $output Passed by reference. Used to append additional content.
Note: See TracChangeset for help on using the changeset viewer.