Make WordPress Core

Ticket #25310: 25310.diff

File 25310.diff, 5.4 KB (added by DrewAPicture, 12 years ago)

functional + filter docs

  • src/wp-includes/comment-template.php

     
    10181018/**
    10191019 * Retrieve HTML content for reply to comment link.
    10201020 *
    1021  * The default arguments that can be override are 'add_below', 'respond_id',
    1022  * 'reply_text', 'login_text', and 'depth'. The 'login_text' argument will be
    1023  * used, if the user must log in or register first before posting a comment. The
    1024  * 'reply_text' will be used, if they can post a reply. The 'add_below' and
    1025  * 'respond_id' arguments are for the JavaScript moveAddCommentForm() function
    1026  * parameters.
    1027  *
    10281021 * @since 2.7.0
    10291022 *
    1030  * @param array $args Optional. Override default options.
    1031  * @param int $comment Optional. Comment being replied to.
    1032  * @param int $post Optional. Post that the comment is going to be displayed on.
     1023 * @param array $args {
     1024 *     Override default options.
     1025 *
     1026 *     @type string 'add_below'  The first part of the selector used to identify the comment to respond below. The resulting value is passed as the first parameter to addComment.moveForm(), concatenated as $add_below-$comment->comment_ID.
     1027 *                               Default is 'comment'.
     1028 *     @type string 'respond_id' The selector identifying the responding comment. Passed as the third parameter to addComment.moveForm(), and appended to the link URL as a hash value.
     1029 *                               Default is 'respond'.
     1030 *     @type string 'reply_text' The text of the Reply link.
     1031 *                               Default is 'Reply'.
     1032 *     @type string 'login_text' The text of the link to reply if logged out.
     1033 *                               Default is 'Log in to Reply'.
     1034 *     @type int    'depth'      The depth of the new comment. Must be greater than 0 and less than the value of the 'thread_comments_depth' option set in Settings > Discussion.
     1035 *                               Default is 0.
     1036 *     @type string 'before'     The text or HTML to add before the reply link.
     1037 *                               Default empty string.
     1038 *     @type string 'after'      The text or HTML to add after the reply link.
     1039 *                               Default empty string.
     1040 * }
     1041 * @param int   $comment (optional) Comment being replied to.
     1042 * @param int   $post    (optional) Post that the comment is going to be displayed on.
    10331043 * @return string|bool|null Link to show comment form, if successful. False, if comments are closed.
    10341044 */
    10351045function get_comment_reply_link($args = array(), $comment = null, $post = null) {
    10361046        global $user_ID;
    10371047
    1038         $defaults = array('add_below' => 'comment', 'respond_id' => 'respond', 'reply_text' => __('Reply'),
    1039                 'login_text' => __('Log in to Reply'), 'depth' => 0, 'before' => '', 'after' => '');
     1048        $defaults = array(
     1049                'add_below'  => 'comment',
     1050                'respond_id' => 'respond',
     1051                'reply_text' => __('Reply'),
     1052                'login_text' => __('Log in to Reply'),
     1053                'depth'      => 0,
     1054                'before'     => '',
     1055                'after'      => ''
     1056        );
    10401057
    10411058        $args = wp_parse_args($args, $defaults);
    10421059
     
    10591076                $link = '<a rel="nofollow" class="comment-reply-login" href="' . esc_url( wp_login_url( get_permalink() ) ) . '">' . $login_text . '</a>';
    10601077        else
    10611078                $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>";
    1062         return apply_filters('comment_reply_link', $before . $link . $after, $args, $comment, $post);
     1079
     1080        /**
     1081         * Filter the comment reply link.
     1082         *
     1083         * @since 2.7.0
     1084         *
     1085         * @param string  $before  Text or HTML displayed before the reply link.
     1086         * @param string  $link    The HTML markup for the comment reply link.
     1087         * @param string  $after   Text or HTML displayed after the reply link.
     1088         * @param array   $args    An array of arguments overriding the defaults.
     1089         * @param object  $comment The object of the comment being replied.
     1090         * @param WP_Post $post    The WP_Post object.
     1091         */
     1092        return apply_filters( 'comment_reply_link', $before . $link . $after, $args, $comment, $post );
    10631093}
    10641094
    10651095/**
     
    10681098 * @since 2.7.0
    10691099 * @see get_comment_reply_link() Echoes result
    10701100 *
    1071  * @param array $args Optional. Override default options.
     1101 * @param array $args Optional. Override default options, @see get_comment_reply_link().
    10721102 * @param int $comment Optional. Comment being replied to.
    10731103 * @param int $post Optional. Post that the comment is going to be displayed on.
    10741104 * @return string|bool|null Link to show comment form, if successful. False, if comments are closed.
     
    10871117 * 'respond_id' arguments are for the JavaScript moveAddCommentForm() function
    10881118 * parameters.
    10891119 *
     1120 * @todo See get_comment_reply_link() for a template of the args docblock.
     1121 *
    10901122 * @since 2.7.0
    10911123 *
    10921124 * @param array $args Optional. Override default options.
     
    11161148
    11171149/**
    11181150 * Displays the HTML content for reply to post link.
     1151 *
    11191152 * @since 2.7.0
    1120  * @see get_post_reply_link()
    11211153 *
    1122  * @param array $args Optional. Override default options.
     1154 * @param array $args Optional. Override default options @see get_post_reply_link().
    11231155 * @param int|object $post Optional. Post that the comment is going to be displayed on.
    11241156 * @return string|bool|null Link to show comment form, if successful. False, if comments are closed.
    11251157 */