Ticket #28314: comment-template.php.patch
File comment-template.php.patch, 2.6 KB (added by , 9 years ago) |
---|
-
trunk/wp-includes/comment-template.php
1439 1439 * 1440 1440 * @since 2.7.0 1441 1441 * 1442 * @param string $text Optional. Text to display for cancel reply link. Default empty. 1442 * @param array $args { 1443 * Optional. Override default arguments. 1444 * 1445 * @type string $text Optional. Text to display for cancel reply link. Default empty. 1446 * @type string $respond_id The selector identifying the responding comment. Passed as the third parameter 1447 * to addComment.moveForm(), and appended to the link URL as a hash value. 1448 * Default 'respond'. 1449 * } 1443 1450 */ 1444 function get_cancel_comment_reply_link( $text = '' ) { 1445 if ( empty($text) ) 1446 $text = __('Click here to cancel reply.'); 1451 function get_cancel_comment_reply_link( $args = array() ) { 1452 $defaults = array( 1453 'text' => __('Click here to cancel reply.'), 1454 'respond_id' => 'respond' 1455 ); 1447 1456 1448 $style = isset($_GET['replytocom']) ? '' : ' style="display:none;"'; 1449 $link = esc_html( remove_query_arg('replytocom') ) . '#respond'; 1457 /** 1458 * Fallback for earlier Wordpress versions 1459 * 1460 * @since 3.9.2 1461 */ 1462 if( !is_array($args) ) 1463 $args = array('text' => $args); 1450 1464 1465 $args = wp_parse_args($args, $defaults); 1466 1467 extract($args, EXTR_SKIP); 1468 1469 $comment = get_comment($_GET['replytocom']); 1470 $style = $comment && $comment->comment_post_ID == get_the_ID() ? '' : ' style="display:none;"'; 1471 $link = esc_html( remove_query_arg('replytocom') ) . '#' . $respond_id; 1472 1451 1473 $formatted_link = '<a rel="nofollow" id="cancel-comment-reply-link" href="' . $link . '"' . $style . '>' . $text . '</a>'; 1452 1474 /** 1453 1475 * Filter the cancel comment reply link HTML. … … 1466 1488 * 1467 1489 * @since 2.7.0 1468 1490 * 1469 * @param string $text Optional. Text to display for cancel reply link. Default empty. 1491 * @param array $args { 1492 * Optional. Override default arguments. 1493 * 1494 * @type string $text Optional. Text to display for cancel reply link. Default empty. 1495 * @type string $respond_id The selector identifying the responding comment. Passed as the third parameter 1496 * to addComment.moveForm(), and appended to the link URL as a hash value. 1497 * Default 'respond'. 1498 * } 1470 1499 */ 1471 function cancel_comment_reply_link( $ text = '') {1472 echo get_cancel_comment_reply_link($ text);1500 function cancel_comment_reply_link( $args = array() ) { 1501 echo get_cancel_comment_reply_link($args); 1473 1502 } 1474 1503 1475 1504 /**