Make WordPress Core


Ignore:
Timestamp:
05/15/2014 03:34:37 PM (11 years ago)
Author:
wonderboymusic
Message:

Eliminate use of extract() in get_comment_reply_link().

See #22400.

File:
1 edited

Legend:

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

    r28429 r28431  
    12921292 * @return mixed Link to show comment form, if successful. False, if comments are closed.
    12931293 */
    1294 function get_comment_reply_link($args = array(), $comment = null, $post = null) {
     1294function get_comment_reply_link( $args = array(), $comment = null, $post = null ) {
    12951295
    12961296    $defaults = array(
     
    13041304    );
    13051305
    1306     $args = wp_parse_args($args, $defaults);
    1307 
    1308     if ( 0 == $args['depth'] || $args['max_depth'] <= $args['depth'] )
     1306    $args = wp_parse_args( $args, $defaults );
     1307
     1308    if ( 0 == $args['depth'] || $args['max_depth'] <= $args['depth'] ) {
    13091309        return;
    1310 
    1311     extract($args, EXTR_SKIP);
    1312 
    1313     $comment = get_comment($comment);
    1314     if ( empty($post) )
     1310    }
     1311
     1312    $add_below = $args['add_below'];
     1313    $respond_id = $args['respond_id'];
     1314    $reply_text = $args['reply_text'];
     1315
     1316    $comment = get_comment( $comment );
     1317    if ( empty( $post ) ) {
    13151318        $post = $comment->comment_post_ID;
    1316     $post = get_post($post);
    1317 
    1318     if ( !comments_open($post->ID) )
     1319    }
     1320    $post = get_post( $post );
     1321
     1322    if ( ! comments_open( $post->ID ) ) {
    13191323        return false;
    1320 
    1321     if ( get_option('comment_registration') && ! is_user_logged_in() )
    1322         $link = '<a rel="nofollow" class="comment-reply-login" href="' . esc_url( wp_login_url( get_permalink() ) ) . '">' . $login_text . '</a>';
    1323     else
     1324    }
     1325
     1326    if ( get_option( 'comment_registration' ) && ! is_user_logged_in() ) {
     1327        $link = '<a rel="nofollow" class="comment-reply-login" href="' . esc_url( wp_login_url( get_permalink() ) ) . '">' . $args['login_text'] . '</a>';
     1328    } else {
    13241329        $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>";
    1325 
     1330    }
    13261331    /**
    13271332     * Filter the comment reply link.
     
    13341339     * @param WP_Post $post    The WP_Post object.
    13351340     */
    1336     return apply_filters( 'comment_reply_link', $before . $link . $after, $args, $comment, $post );
     1341    return apply_filters( 'comment_reply_link', $args['before'] . $link . $args['after'], $args, $comment, $post );
    13371342}
    13381343
Note: See TracChangeset for help on using the changeset viewer.