PluginProbe
GiveWP – Donation Plugin and Fundraising Platform / 4.16.9
GiveWP – Donation Plugin and Fundraising Platform v4.16.9
4.16.9 4.16.8.1 4.16.8 4.16.7.2 4.16.7.1 4.16.7 4.16.6.1 4.16.6 4.16.5.1 4.16.5 4.16.4 4.16.3 4.16.2 4.16.1 4.16.0 4.15.5 4.15.4 4.15.3 4.15.2 4.15.1 4.15.0 2.3.0 2.3.1 2.3.2 2.30.0 All 255 releases
← All changes | includes/class-give-comment.php +30 -27 2.3.24.16.9 View file →
@@ -16,9 +16,9 @@
16 16 * @since 2.2.0
17 17 * @access private
18 18 * @var
19 19 */
20 - static private $instance;
20 + private static $instance;
21 21
22 22 /**
23 23 * Comment Types.
24 24 *
@@ -97,9 +97,9 @@
97 97 add_action( 'pre_get_comments', array( $this, 'hide_comments' ), 10 );
98 98 add_filter( 'comments_clauses', array( $this, 'hide_comments_pre_wp_41' ), 10, 1 );
99 99 add_filter( 'comment_feed_where', array( $this, 'hide_comments_from_feeds' ), 10, 1 );
100 100 add_filter( 'wp_count_comments', array( $this, 'remove_comments_from_comment_counts' ), 10, 2 );
101 - add_filter( 'get_comment_author', array( $this, '__get_comment_author' ), 10, 3 );
101 + add_filter( 'get_comment_author', array($this, 'get_comment_author'), 10, 3 );
102 102 }
103 103 }
104 104
105 105 /**
@@ -113,9 +113,9 @@
113 113 * @return int|WP_Error
114 114 */
115 115 public static function add( $comment_args = array() ) {
116 116 // Backward compatibility.
117 - $func_args = func_get_args();
117 + $func_args = func_get_args();
118 118 $comment_id = self::_bc_add( $func_args );
119 119 if ( ! is_null( $comment_id ) ) {
120 120 return $comment_id;
121 121 }
@@ -120,13 +120,13 @@
120 120 return $comment_id;
121 121 }
122 122
123 123 // Backward compatibility.
124 - if( is_numeric( $comment_args ) ) {
124 + if ( is_numeric( $comment_args ) ) {
125 125 $comment_args = array(
126 - 'comment_parent' => $func_args[0],
126 + 'comment_parent' => $func_args[0],
127 127 'comment_content' => $func_args[1],
128 - 'comment_type' => 'payment' === $func_args[2] ? 'donation' : $func_args[1],
128 + 'comment_type' => 'payment' === $func_args[2] ? 'donation' : $func_args[1],
129 129 );
130 130 }
131 131
132 132 $comment_args = wp_parse_args(
@@ -267,15 +267,15 @@
267 267 global $wpdb;
268 268
269 269 // Backward compatibility.
270 270 $func_args = func_get_args();
271 - $comments = self::_bc_get( $func_args );
271 + $comments = self::_bc_get( $func_args );
272 272 if ( ! is_null( $comments ) ) {
273 273 return $comments;
274 274 }
275 275
276 276 // Backward compatibility.
277 - if( is_numeric( $comment_args ) ) {
277 + if ( is_numeric( $comment_args ) ) {
278 278 $comment_args = array(
279 279 'comment_parent' => $func_args[0],
280 280 'comment_type' => 'payment' === $func_args[1] ? 'donation' : $func_args[1],
281 281 );
@@ -431,8 +431,9 @@
431 431
432 432 /**
433 433 * Get donor name
434 434 *
435 + * @since 4.9.0 rename function - PHP 8 compatibility
435 436 * @since 2.2.0
436 437 * @access public
437 438 *
438 439 * @param string $author
@@ -440,9 +441,9 @@
440 441 * @param WP_Comment $comment
441 442 *
442 443 * @return mixed
443 444 */
444 - public function __get_comment_author( $author, $comment_id, $comment ) {
445 + public function get_comment_author( $author, $comment_id, $comment ) {
445 446 if ( in_array( $comment->comment_type, $this->comment_types ) ) {
446 447 switch ( $comment->comment_type ) {
447 448 case 'give_payment_note':
448 449 if ( get_comment_meta( $comment_id, '_give_donor_id', true ) ) {
@@ -517,17 +518,19 @@
517 518 'compare' => 'NOT EXISTS',
518 519 ),
519 520 );
520 521
521 - $comments = get_comments( wp_parse_args(
522 - $comment_args,
523 - array(
524 - 'post_id' => $id,
525 - 'order' => 'ASC',
526 - 'search' => $search,
527 - 'type' => 'give_payment_note',
522 + $comments = get_comments(
523 + wp_parse_args(
524 + $comment_args,
525 + array(
526 + 'post_id' => $id,
527 + 'order' => 'ASC',
528 + 'search' => $search,
529 + 'type' => 'give_payment_note',
530 + )
528 531 )
529 - ) );
532 + );
530 533 break;
531 534
532 535 case 'donor':
533 536 $comment_args['meta_query'] = ! empty( $comment_args['meta_query'] )
@@ -538,16 +541,18 @@
538 541 'value' => $id,
539 542 ),
540 543 );
541 544
542 - $comments = get_comments( wp_parse_args(
543 - $comment_args,
544 - array(
545 - 'order' => 'ASC',
546 - 'search' => $search,
547 - 'type' => 'give_donor_note',
545 + $comments = get_comments(
546 + wp_parse_args(
547 + $comment_args,
548 + array(
549 + 'order' => 'ASC',
550 + 'search' => $search,
551 + 'type' => 'give_donor_note',
552 + )
548 553 )
549 - ) );
554 + );
550 555 break;
551 556 }
552 557
553 558 add_action( 'pre_get_comments', array( self::$instance, 'hide_comments' ), 10, 1 );
@@ -577,9 +582,8 @@
577 582 $note = $comment_args[1];
578 583 $comment_type = $comment_args[2];
579 584 $comment_args = isset( $comment_args[3] ) ? $comment_args[3] : array();
580 585
581 -
582 586 // Bailout
583 587 if ( empty( $id ) || empty( $note ) || empty( $comment_type ) ) {
584 588 return new WP_Error( 'give_invalid_required_param', __( 'This comment has invalid ID or comment text or comment type', 'give' ) );
585 589 }
@@ -615,9 +619,8 @@
615 619
616 620 )
617 621 );
618 622
619 -
620 623 // Check comment max length.
621 624 $error = wp_check_comment_data_max_lengths( $comment_args );
622 625 if ( is_wp_error( $error ) ) {
623 626 return $error;
@@ -660,8 +663,9 @@
660 663
661 664 /**
662 665 * Delete comment
663 666 * Note: This function add backward compatibility for delete function
667 + *
664 668 * @since 2.3.0
665 669 * @access public
666 670 *
667 671 * @param array $comment_args Comment arguments.
@@ -694,9 +698,8 @@
694 698 */
695 699 do_action( "give_pre_delete_{$comment_type}_note", $comment_id, $id );
696 700
697 701 $ret = wp_delete_comment( $comment_id, true );
698 -
699 702
700 703 /**
701 704 * Fires after donation note deleted.
702 705 *