WordPress.org

Make WordPress Core

Ticket #28314: cancel_comment_reply_link.diff

File cancel_comment_reply_link.diff, 2.2 KB (added by Ninos Ego, 7 years ago)

Patch 1.0 - cancel_comment_reply_link()

Line 
11436c1436,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>  * }
121438,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);
281442,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;
371463c1481,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>  * }
481465,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);