Ticket #25310: 25310.diff
| File 25310.diff, 5.4 KB (added by , 12 years ago) |
|---|
-
src/wp-includes/comment-template.php
1018 1018 /** 1019 1019 * Retrieve HTML content for reply to comment link. 1020 1020 * 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 be1023 * used, if the user must log in or register first before posting a comment. The1024 * 'reply_text' will be used, if they can post a reply. The 'add_below' and1025 * 'respond_id' arguments are for the JavaScript moveAddCommentForm() function1026 * parameters.1027 *1028 1021 * @since 2.7.0 1029 1022 * 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. 1033 1043 * @return string|bool|null Link to show comment form, if successful. False, if comments are closed. 1034 1044 */ 1035 1045 function get_comment_reply_link($args = array(), $comment = null, $post = null) { 1036 1046 global $user_ID; 1037 1047 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 ); 1040 1057 1041 1058 $args = wp_parse_args($args, $defaults); 1042 1059 … … 1059 1076 $link = '<a rel="nofollow" class="comment-reply-login" href="' . esc_url( wp_login_url( get_permalink() ) ) . '">' . $login_text . '</a>'; 1060 1077 else 1061 1078 $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 ); 1063 1093 } 1064 1094 1065 1095 /** … … 1068 1098 * @since 2.7.0 1069 1099 * @see get_comment_reply_link() Echoes result 1070 1100 * 1071 * @param array $args Optional. Override default options .1101 * @param array $args Optional. Override default options, @see get_comment_reply_link(). 1072 1102 * @param int $comment Optional. Comment being replied to. 1073 1103 * @param int $post Optional. Post that the comment is going to be displayed on. 1074 1104 * @return string|bool|null Link to show comment form, if successful. False, if comments are closed. … … 1087 1117 * 'respond_id' arguments are for the JavaScript moveAddCommentForm() function 1088 1118 * parameters. 1089 1119 * 1120 * @todo See get_comment_reply_link() for a template of the args docblock. 1121 * 1090 1122 * @since 2.7.0 1091 1123 * 1092 1124 * @param array $args Optional. Override default options. … … 1116 1148 1117 1149 /** 1118 1150 * Displays the HTML content for reply to post link. 1151 * 1119 1152 * @since 2.7.0 1120 * @see get_post_reply_link()1121 1153 * 1122 * @param array $args Optional. Override default options .1154 * @param array $args Optional. Override default options @see get_post_reply_link(). 1123 1155 * @param int|object $post Optional. Post that the comment is going to be displayed on. 1124 1156 * @return string|bool|null Link to show comment form, if successful. False, if comments are closed. 1125 1157 */