1 | 1436c1436,1443 |
---|
2 | < * @param string $text Optional. Text to display for cancel reply link. Default empty. |
---|
3 | --- |
---|
4 | > * @param array $args { |
---|
5 | > * Optional. Override default arguments. |
---|
6 | > * |
---|
7 | > * @type string $text Optional. Text to display for cancel reply link. Default empty. |
---|
8 | > * @type string $respond_id The selector identifying the responding comment. Passed as the third parameter |
---|
9 | > * to addComment.moveForm(), and appended to the link URL as a hash value. |
---|
10 | > * Default 'respond'. |
---|
11 | > * } |
---|
12 | 1438,1440c1445,1455 |
---|
13 | < function get_cancel_comment_reply_link( $text = '' ) { |
---|
14 | < if ( empty($text) ) |
---|
15 | < $text = __('Click here to cancel reply.'); |
---|
16 | --- |
---|
17 | > function get_cancel_comment_reply_link( $args = array() ) { |
---|
18 | > $defaults = array( |
---|
19 | > 'text' => __('Click here to cancel reply.'), |
---|
20 | > 'respond_id' => 'respond' |
---|
21 | > ); |
---|
22 | > |
---|
23 | > // Fallback for Wordpress < 3.9.1 |
---|
24 | > if( !is_array($args) ) |
---|
25 | > $args = array('text' => $args); |
---|
26 | > |
---|
27 | > $args = wp_parse_args($args, $defaults); |
---|
28 | 1442,1443c1457,1461 |
---|
29 | < $style = isset($_GET['replytocom']) ? '' : ' style="display:none;"'; |
---|
30 | < $link = esc_html( remove_query_arg('replytocom') ) . '#respond'; |
---|
31 | --- |
---|
32 | > extract($args, EXTR_SKIP); |
---|
33 | > |
---|
34 | > $comment = get_comment($_GET['replytocom']); |
---|
35 | > $style = $comment && $comment->comment_post_ID == get_the_ID() ? '' : ' style="display:none;"'; |
---|
36 | > $link = esc_html( remove_query_arg('replytocom') ) . '#' . $respond_id; |
---|
37 | 1463c1481,1488 |
---|
38 | < * @param string $text Optional. Text to display for cancel reply link. Default empty. |
---|
39 | --- |
---|
40 | > * @param array $args { |
---|
41 | > * Optional. Override default arguments. |
---|
42 | > * |
---|
43 | > * @type string $text Optional. Text to display for cancel reply link. Default empty. |
---|
44 | > * @type string $respond_id The selector identifying the responding comment. Passed as the third parameter |
---|
45 | > * to addComment.moveForm(), and appended to the link URL as a hash value. |
---|
46 | > * Default 'respond'. |
---|
47 | > * } |
---|
48 | 1465,1466c1490,1491 |
---|
49 | < function cancel_comment_reply_link( $text = '' ) { |
---|
50 | < echo get_cancel_comment_reply_link($text); |
---|
51 | --- |
---|
52 | > function cancel_comment_reply_link( $args = array() ) { |
---|
53 | > echo get_cancel_comment_reply_link($args); |
---|