Ticket #10910: 10910-cancel_comment_reply_link.patch
File 10910-cancel_comment_reply_link.patch, 3.4 KB (added by , 15 years ago) |
---|
-
wp-includes/comment-template.php
1109 1109 * @since 2.7.0 1110 1110 * 1111 1111 * @param string $text Optional. Text to display for cancel reply link. 1112 * @param string $before The text or HTML to display before the cancel reply link. 1113 * @param string $after The text or HTML to display after the cancel reply link. 1112 1114 */ 1113 function get_cancel_comment_reply_link($text = '') { 1115 function get_cancel_comment_reply_link($text = '', $before = '', $after = '') { 1116 if ( '0' == get_comments_number() || ( !comments_open() && !pings_open() ) || !get_option('thread_comments') || ( get_option('comment_registration') && !is_user_logged_in() ) ) 1117 return false; 1118 1114 1119 if ( empty($text) ) 1115 1120 $text = __('Click here to cancel reply.'); 1116 1121 1117 1122 $style = isset($_GET['replytocom']) ? '' : ' style="display:none;"'; 1118 1123 $link = esc_html( remove_query_arg('replytocom') ) . '#respond'; 1119 return apply_filters('cancel_comment_reply_link', '<a rel="nofollow" id="cancel-comment-reply-link" href="' . $link . '"' . $style . '>' . $text . '</a>', $link, $text); 1124 $return = $before . '<a rel="nofollow" id="cancel-comment-reply-link" href="' . $link . '"' . $style . '>' . $text . '</a>' . $after; 1125 return apply_filters('cancel_comment_reply_link', $return); 1120 1126 } 1121 1127 1122 1128 /** … … 1125 1131 * @since 2.7.0 1126 1132 * 1127 1133 * @param string $text Optional. Text to display for cancel reply link. 1134 * @param string $before The text or HTML to display before the cancel reply link. 1135 * @param string $after The text or HTML to display after the cancel reply link. 1128 1136 */ 1129 function cancel_comment_reply_link($text = '' ) {1130 echo get_cancel_comment_reply_link($text );1137 function cancel_comment_reply_link($text = '', $before = '', $after = '') { 1138 echo get_cancel_comment_reply_link($text, $before, $after); 1131 1139 } 1132 1140 1133 1141 /** … … 1491 1499 1492 1500 $commenter = wp_get_current_commenter(); 1493 1501 1494 $req = get_option( 'require_name_email' ); 1502 $req = get_option( 'require_name_email' ); 1495 1503 $aria_req = ( $req ? " aria-required='true'" : '' ); 1496 1504 $fields = array( 1497 1505 'author' => '<p class="comment-form-author">' . '<label for="author">' . __( 'Name' ) . '</label> ' . ( $req ? '<span class="required">*</span>' : '' ) . … … 1516 1524 'title_reply_to' => __( 'Leave a Reply to %s' ), 1517 1525 'cancel_reply_link' => __( 'Cancel reply' ), 1518 1526 'label_submit' => __( 'Post Comment' ), 1527 'cancel_reply_link_before' => '<span>', 1528 'cancel_reply_link_after' => '</span>' 1519 1529 ); 1520 1530 1521 1531 $args = wp_parse_args( $args, apply_filters( 'comment_form_defaults', $defaults ) ); … … 1524 1534 <?php if ( comments_open() ) : ?> 1525 1535 <?php do_action( 'comment_form_before' ); ?> 1526 1536 <div id="respond"> 1527 <h3 id="reply-title"><?php comment_form_title( $args['title_reply'], $args['title_reply_to'] ); ?> < small><?php cancel_comment_reply_link( $args['cancel_reply_link'] ); ?></small></h3>1537 <h3 id="reply-title"><?php comment_form_title( $args['title_reply'], $args['title_reply_to'] ); ?> <?php cancel_comment_reply_link( $args['cancel_reply_link'], $args['cancel_reply_link_before'], $args['cancel_reply_link_after'] ); ?></h3> 1528 1538 <?php if ( get_option( 'comment_registration' ) && !is_user_logged_in() ) : ?> 1529 1539 <?php echo $args['must_log_in']; ?> 1530 1540 <?php do_action( 'comment_form_must_log_in_after' ); ?>