@@ -392,7 +392,7 @@ discard block |
||
| 392 | 392 | * |
| 393 | 393 | * @param int|bool $payment_id A given payment |
| 394 | 394 | * |
| 395 | - * @return mixed void|false |
|
| 395 | + * @return false|null void|false |
|
| 396 | 396 | */ |
| 397 | 397 | public function __construct( $payment_id = false ) { |
| 398 | 398 | |
@@ -463,7 +463,7 @@ discard block |
||
| 463 | 463 | * |
| 464 | 464 | * @param string $name The attribute to get |
| 465 | 465 | * |
| 466 | - * @return boolean If the item is set or not |
|
| 466 | + * @return boolean|null If the item is set or not |
|
| 467 | 467 | */ |
| 468 | 468 | public function __isset( $name ) { |
| 469 | 469 | if ( property_exists( $this, $name ) ) { |
@@ -1302,7 +1302,7 @@ discard block |
||
| 1302 | 1302 | * |
| 1303 | 1303 | * @param string $note The note to add |
| 1304 | 1304 | * |
| 1305 | - * @return void |
|
| 1305 | + * @return false|null |
|
| 1306 | 1306 | */ |
| 1307 | 1307 | public function add_note( $note = false ) { |
| 1308 | 1308 | // Bail if no note specified. |
@@ -1050,7 +1050,7 @@ |
||
| 1050 | 1050 | // Find a match between price_id and level_id. |
| 1051 | 1051 | // First verify array keys exists THEN make the match. |
| 1052 | 1052 | if ( ( isset( $args['price_id'] ) && isset( $price['_give_id']['level_id'] ) ) |
| 1053 | - && $args['price_id'] == $price['_give_id']['level_id'] |
|
| 1053 | + && $args['price_id'] == $price['_give_id']['level_id'] |
|
| 1054 | 1054 | ) { |
| 1055 | 1055 | $item_price = $price['_give_amount']; |
| 1056 | 1056 | } |
@@ -10,7 +10,7 @@ discard block |
||
| 10 | 10 | */ |
| 11 | 11 | |
| 12 | 12 | // Exit if accessed directly. |
| 13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 13 | +if ( ! defined('ABSPATH')) { |
|
| 14 | 14 | exit; |
| 15 | 15 | } |
| 16 | 16 | |
@@ -371,13 +371,13 @@ discard block |
||
| 371 | 371 | * |
| 372 | 372 | * @return mixed void|false |
| 373 | 373 | */ |
| 374 | - public function __construct( $payment_id = false ) { |
|
| 374 | + public function __construct($payment_id = false) { |
|
| 375 | 375 | |
| 376 | - if ( empty( $payment_id ) ) { |
|
| 376 | + if (empty($payment_id)) { |
|
| 377 | 377 | return false; |
| 378 | 378 | } |
| 379 | 379 | |
| 380 | - $this->setup_payment( $payment_id ); |
|
| 380 | + $this->setup_payment($payment_id); |
|
| 381 | 381 | } |
| 382 | 382 | |
| 383 | 383 | /** |
@@ -390,11 +390,11 @@ discard block |
||
| 390 | 390 | * |
| 391 | 391 | * @return mixed The value. |
| 392 | 392 | */ |
| 393 | - public function __get( $key ) { |
|
| 393 | + public function __get($key) { |
|
| 394 | 394 | |
| 395 | - if ( method_exists( $this, 'get_' . $key ) ) { |
|
| 395 | + if (method_exists($this, 'get_'.$key)) { |
|
| 396 | 396 | |
| 397 | - $value = call_user_func( array( $this, 'get_' . $key ) ); |
|
| 397 | + $value = call_user_func(array($this, 'get_'.$key)); |
|
| 398 | 398 | |
| 399 | 399 | } else { |
| 400 | 400 | |
@@ -416,18 +416,18 @@ discard block |
||
| 416 | 416 | * @param string $key The property name |
| 417 | 417 | * @param mixed $value The value of the property |
| 418 | 418 | */ |
| 419 | - public function __set( $key, $value ) { |
|
| 420 | - $ignore = array( '_ID' ); |
|
| 419 | + public function __set($key, $value) { |
|
| 420 | + $ignore = array('_ID'); |
|
| 421 | 421 | |
| 422 | - if ( $key === 'status' ) { |
|
| 422 | + if ($key === 'status') { |
|
| 423 | 423 | $this->old_status = $this->status; |
| 424 | 424 | } |
| 425 | 425 | |
| 426 | - if ( ! in_array( $key, $ignore ) ) { |
|
| 427 | - $this->pending[ $key ] = $value; |
|
| 426 | + if ( ! in_array($key, $ignore)) { |
|
| 427 | + $this->pending[$key] = $value; |
|
| 428 | 428 | } |
| 429 | 429 | |
| 430 | - if ( '_ID' !== $key ) { |
|
| 430 | + if ('_ID' !== $key) { |
|
| 431 | 431 | $this->$key = $value; |
| 432 | 432 | } |
| 433 | 433 | } |
@@ -442,9 +442,9 @@ discard block |
||
| 442 | 442 | * |
| 443 | 443 | * @return boolean If the item is set or not |
| 444 | 444 | */ |
| 445 | - public function __isset( $name ) { |
|
| 446 | - if ( property_exists( $this, $name ) ) { |
|
| 447 | - return false === empty( $this->$name ); |
|
| 445 | + public function __isset($name) { |
|
| 446 | + if (property_exists($this, $name)) { |
|
| 447 | + return false === empty($this->$name); |
|
| 448 | 448 | } else { |
| 449 | 449 | return null; |
| 450 | 450 | } |
@@ -460,20 +460,20 @@ discard block |
||
| 460 | 460 | * |
| 461 | 461 | * @return bool If the setup was successful or not |
| 462 | 462 | */ |
| 463 | - private function setup_payment( $payment_id ) { |
|
| 463 | + private function setup_payment($payment_id) { |
|
| 464 | 464 | $this->pending = array(); |
| 465 | 465 | |
| 466 | - if ( empty( $payment_id ) ) { |
|
| 466 | + if (empty($payment_id)) { |
|
| 467 | 467 | return false; |
| 468 | 468 | } |
| 469 | 469 | |
| 470 | - $payment = get_post( $payment_id ); |
|
| 470 | + $payment = get_post($payment_id); |
|
| 471 | 471 | |
| 472 | - if ( ! $payment || is_wp_error( $payment ) ) { |
|
| 472 | + if ( ! $payment || is_wp_error($payment)) { |
|
| 473 | 473 | return false; |
| 474 | 474 | } |
| 475 | 475 | |
| 476 | - if ( 'give_payment' !== $payment->post_type ) { |
|
| 476 | + if ('give_payment' !== $payment->post_type) { |
|
| 477 | 477 | return false; |
| 478 | 478 | } |
| 479 | 479 | |
@@ -487,13 +487,13 @@ discard block |
||
| 487 | 487 | * @param Give_Payment $this Payment object. |
| 488 | 488 | * @param int $payment_id The ID of the payment. |
| 489 | 489 | */ |
| 490 | - do_action( 'give_pre_setup_payment', $this, $payment_id ); |
|
| 490 | + do_action('give_pre_setup_payment', $this, $payment_id); |
|
| 491 | 491 | |
| 492 | 492 | // Primary Identifier. |
| 493 | - $this->ID = absint( $payment_id ); |
|
| 493 | + $this->ID = absint($payment_id); |
|
| 494 | 494 | |
| 495 | 495 | // Protected ID that can never be changed. |
| 496 | - $this->_ID = absint( $payment_id ); |
|
| 496 | + $this->_ID = absint($payment_id); |
|
| 497 | 497 | |
| 498 | 498 | // We have a payment, get the generic payment_meta item to reduce calls to it. |
| 499 | 499 | $this->payment_meta = $this->get_meta(); |
@@ -508,7 +508,7 @@ discard block |
||
| 508 | 508 | $this->parent_payment = $payment->post_parent; |
| 509 | 509 | |
| 510 | 510 | $all_payment_statuses = give_get_payment_statuses(); |
| 511 | - $this->status_nicename = array_key_exists( $this->status, $all_payment_statuses ) ? $all_payment_statuses[ $this->status ] : ucfirst( $this->status ); |
|
| 511 | + $this->status_nicename = array_key_exists($this->status, $all_payment_statuses) ? $all_payment_statuses[$this->status] : ucfirst($this->status); |
|
| 512 | 512 | |
| 513 | 513 | // Currency Based. |
| 514 | 514 | $this->total = $this->setup_total(); |
@@ -546,7 +546,7 @@ discard block |
||
| 546 | 546 | * @param Give_Payment $this Payment object. |
| 547 | 547 | * @param int $payment_id The ID of the payment. |
| 548 | 548 | */ |
| 549 | - do_action( 'give_setup_payment', $this, $payment_id ); |
|
| 549 | + do_action('give_setup_payment', $this, $payment_id); |
|
| 550 | 550 | |
| 551 | 551 | return true; |
| 552 | 552 | } |
@@ -564,8 +564,8 @@ discard block |
||
| 564 | 564 | * |
| 565 | 565 | * @return void |
| 566 | 566 | */ |
| 567 | - public function update_payment_setup( $payment_id ) { |
|
| 568 | - $this->setup_payment( $payment_id ); |
|
| 567 | + public function update_payment_setup($payment_id) { |
|
| 568 | + $this->setup_payment($payment_id); |
|
| 569 | 569 | } |
| 570 | 570 | |
| 571 | 571 | /** |
@@ -580,24 +580,24 @@ discard block |
||
| 580 | 580 | |
| 581 | 581 | // Construct the payment title. |
| 582 | 582 | $payment_title = ''; |
| 583 | - if ( ! empty( $this->first_name ) && ! empty( $this->last_name ) ) { |
|
| 584 | - $payment_title = $this->first_name . ' ' . $this->last_name; |
|
| 585 | - } elseif ( ! empty( $this->first_name ) && empty( $this->last_name ) ) { |
|
| 583 | + if ( ! empty($this->first_name) && ! empty($this->last_name)) { |
|
| 584 | + $payment_title = $this->first_name.' '.$this->last_name; |
|
| 585 | + } elseif ( ! empty($this->first_name) && empty($this->last_name)) { |
|
| 586 | 586 | $payment_title = $this->first_name; |
| 587 | - } elseif ( ! empty( $this->email ) && is_email( $this->email ) ) { |
|
| 587 | + } elseif ( ! empty($this->email) && is_email($this->email)) { |
|
| 588 | 588 | $payment_title = $this->email; |
| 589 | 589 | } |
| 590 | 590 | |
| 591 | 591 | // Set Key. |
| 592 | - if ( empty( $this->key ) ) { |
|
| 592 | + if (empty($this->key)) { |
|
| 593 | 593 | |
| 594 | - $auth_key = defined( 'AUTH_KEY' ) ? AUTH_KEY : ''; |
|
| 595 | - $this->key = strtolower( md5( $this->email . date( 'Y-m-d H:i:s' ) . $auth_key . uniqid( 'give', true ) ) ); // Unique key |
|
| 594 | + $auth_key = defined('AUTH_KEY') ? AUTH_KEY : ''; |
|
| 595 | + $this->key = strtolower(md5($this->email.date('Y-m-d H:i:s').$auth_key.uniqid('give', true))); // Unique key |
|
| 596 | 596 | $this->pending['key'] = $this->key; |
| 597 | 597 | } |
| 598 | 598 | |
| 599 | 599 | // Set IP. |
| 600 | - if ( empty( $this->ip ) ) { |
|
| 600 | + if (empty($this->ip)) { |
|
| 601 | 601 | |
| 602 | 602 | $this->ip = give_get_ip(); |
| 603 | 603 | $this->pending['ip'] = $this->ip; |
@@ -623,57 +623,57 @@ discard block |
||
| 623 | 623 | 'status' => $this->status, |
| 624 | 624 | ); |
| 625 | 625 | |
| 626 | - $args = apply_filters( 'give_insert_payment_args', array( |
|
| 626 | + $args = apply_filters('give_insert_payment_args', array( |
|
| 627 | 627 | 'post_title' => $payment_title, |
| 628 | 628 | 'post_status' => $this->status, |
| 629 | 629 | 'post_type' => 'give_payment', |
| 630 | - 'post_date' => ! empty( $this->date ) ? $this->date : null, |
|
| 631 | - 'post_date_gmt' => ! empty( $this->date ) ? get_gmt_from_date( $this->date ) : null, |
|
| 630 | + 'post_date' => ! empty($this->date) ? $this->date : null, |
|
| 631 | + 'post_date_gmt' => ! empty($this->date) ? get_gmt_from_date($this->date) : null, |
|
| 632 | 632 | 'post_parent' => $this->parent_payment, |
| 633 | - ), $payment_data ); |
|
| 633 | + ), $payment_data); |
|
| 634 | 634 | |
| 635 | 635 | // Create a blank payment |
| 636 | - $payment_id = wp_insert_post( $args ); |
|
| 636 | + $payment_id = wp_insert_post($args); |
|
| 637 | 637 | |
| 638 | - if ( ! empty( $payment_id ) ) { |
|
| 638 | + if ( ! empty($payment_id)) { |
|
| 639 | 639 | |
| 640 | 640 | $this->ID = $payment_id; |
| 641 | 641 | $this->_ID = $payment_id; |
| 642 | 642 | |
| 643 | 643 | $donor = new stdClass; |
| 644 | 644 | |
| 645 | - if ( did_action( 'give_pre_process_donation' ) && is_user_logged_in() ) { |
|
| 646 | - $donor = new Give_Donor( get_current_user_id(), true ); |
|
| 645 | + if (did_action('give_pre_process_donation') && is_user_logged_in()) { |
|
| 646 | + $donor = new Give_Donor(get_current_user_id(), true); |
|
| 647 | 647 | |
| 648 | 648 | // Donor is logged in but used a different email to purchase with so assign to their donor record. |
| 649 | - if ( ! empty( $donor->id ) && $this->email != $donor->email ) { |
|
| 650 | - $donor->add_email( $this->email ); |
|
| 649 | + if ( ! empty($donor->id) && $this->email != $donor->email) { |
|
| 650 | + $donor->add_email($this->email); |
|
| 651 | 651 | } |
| 652 | 652 | } |
| 653 | 653 | |
| 654 | - if ( empty( $donor->id ) ) { |
|
| 655 | - $donor = new Give_Donor( $this->email ); |
|
| 654 | + if (empty($donor->id)) { |
|
| 655 | + $donor = new Give_Donor($this->email); |
|
| 656 | 656 | } |
| 657 | 657 | |
| 658 | - if ( empty( $donor->id ) ) { |
|
| 658 | + if (empty($donor->id)) { |
|
| 659 | 659 | |
| 660 | 660 | $donor_data = array( |
| 661 | - 'name' => ! is_email( $payment_title ) ? $this->first_name . ' ' . $this->last_name : '', |
|
| 661 | + 'name' => ! is_email($payment_title) ? $this->first_name.' '.$this->last_name : '', |
|
| 662 | 662 | 'email' => $this->email, |
| 663 | 663 | 'user_id' => $this->user_id, |
| 664 | 664 | ); |
| 665 | 665 | |
| 666 | - $donor->create( $donor_data ); |
|
| 666 | + $donor->create($donor_data); |
|
| 667 | 667 | |
| 668 | 668 | } |
| 669 | 669 | |
| 670 | 670 | $this->customer_id = $donor->id; |
| 671 | 671 | $this->pending['customer_id'] = $this->customer_id; |
| 672 | - $donor->attach_payment( $this->ID, false ); |
|
| 672 | + $donor->attach_payment($this->ID, false); |
|
| 673 | 673 | |
| 674 | - $this->payment_meta = apply_filters( 'give_payment_meta', $this->payment_meta, $payment_data ); |
|
| 674 | + $this->payment_meta = apply_filters('give_payment_meta', $this->payment_meta, $payment_data); |
|
| 675 | 675 | |
| 676 | - $this->update_meta( '_give_payment_meta', $this->payment_meta ); |
|
| 676 | + $this->update_meta('_give_payment_meta', $this->payment_meta); |
|
| 677 | 677 | $this->new = true; |
| 678 | 678 | }// End if(). |
| 679 | 679 | |
@@ -695,11 +695,11 @@ discard block |
||
| 695 | 695 | $saved = false; |
| 696 | 696 | |
| 697 | 697 | // Must have an ID. |
| 698 | - if ( empty( $this->ID ) ) { |
|
| 698 | + if (empty($this->ID)) { |
|
| 699 | 699 | |
| 700 | 700 | $payment_id = $this->insert_payment(); |
| 701 | 701 | |
| 702 | - if ( false === $payment_id ) { |
|
| 702 | + if (false === $payment_id) { |
|
| 703 | 703 | $saved = false; |
| 704 | 704 | } else { |
| 705 | 705 | $this->ID = $payment_id; |
@@ -707,48 +707,48 @@ discard block |
||
| 707 | 707 | } |
| 708 | 708 | |
| 709 | 709 | // Set ID if not matching. |
| 710 | - if ( $this->ID !== $this->_ID ) { |
|
| 710 | + if ($this->ID !== $this->_ID) { |
|
| 711 | 711 | $this->ID = $this->_ID; |
| 712 | 712 | } |
| 713 | 713 | |
| 714 | 714 | // If we have something pending, let's save it. |
| 715 | - if ( ! empty( $this->pending ) ) { |
|
| 715 | + if ( ! empty($this->pending)) { |
|
| 716 | 716 | |
| 717 | 717 | $total_increase = 0; |
| 718 | 718 | $total_decrease = 0; |
| 719 | 719 | |
| 720 | - foreach ( $this->pending as $key => $value ) { |
|
| 720 | + foreach ($this->pending as $key => $value) { |
|
| 721 | 721 | |
| 722 | - switch ( $key ) { |
|
| 722 | + switch ($key) { |
|
| 723 | 723 | |
| 724 | 724 | case 'donations': |
| 725 | 725 | // Update totals for pending donations. |
| 726 | - foreach ( $this->pending[ $key ] as $item ) { |
|
| 726 | + foreach ($this->pending[$key] as $item) { |
|
| 727 | 727 | |
| 728 | - $quantity = isset( $item['quantity'] ) ? $item['quantity'] : 1; |
|
| 729 | - $price_id = isset( $item['price_id'] ) ? $item['price_id'] : 0; |
|
| 728 | + $quantity = isset($item['quantity']) ? $item['quantity'] : 1; |
|
| 729 | + $price_id = isset($item['price_id']) ? $item['price_id'] : 0; |
|
| 730 | 730 | |
| 731 | - switch ( $item['action'] ) { |
|
| 731 | + switch ($item['action']) { |
|
| 732 | 732 | |
| 733 | 733 | case 'add': |
| 734 | 734 | |
| 735 | 735 | $price = $item['price']; |
| 736 | 736 | |
| 737 | - if ( 'publish' === $this->status || 'complete' === $this->status ) { |
|
| 737 | + if ('publish' === $this->status || 'complete' === $this->status) { |
|
| 738 | 738 | |
| 739 | 739 | // Add sales logs. |
| 740 | - $log_date = date_i18n( 'Y-m-d G:i:s', current_time( 'timestamp' ) ); |
|
| 740 | + $log_date = date_i18n('Y-m-d G:i:s', current_time('timestamp')); |
|
| 741 | 741 | |
| 742 | 742 | $y = 0; |
| 743 | - while ( $y < $quantity ) { |
|
| 743 | + while ($y < $quantity) { |
|
| 744 | 744 | |
| 745 | - give_record_donation_in_log( $item['id'], $this->ID, $price_id, $log_date ); |
|
| 746 | - $y ++; |
|
| 745 | + give_record_donation_in_log($item['id'], $this->ID, $price_id, $log_date); |
|
| 746 | + $y++; |
|
| 747 | 747 | } |
| 748 | 748 | |
| 749 | - $form = new Give_Donate_Form( $item['id'] ); |
|
| 750 | - $form->increase_sales( $quantity ); |
|
| 751 | - $form->increase_earnings( $price ); |
|
| 749 | + $form = new Give_Donate_Form($item['id']); |
|
| 750 | + $form->increase_sales($quantity); |
|
| 751 | + $form->increase_earnings($price); |
|
| 752 | 752 | |
| 753 | 753 | $total_increase += $price; |
| 754 | 754 | } |
@@ -773,15 +773,15 @@ discard block |
||
| 773 | 773 | ), |
| 774 | 774 | ); |
| 775 | 775 | |
| 776 | - $found_logs = get_posts( $log_args ); |
|
| 777 | - foreach ( $found_logs as $log ) { |
|
| 778 | - wp_delete_post( $log->ID, true ); |
|
| 776 | + $found_logs = get_posts($log_args); |
|
| 777 | + foreach ($found_logs as $log) { |
|
| 778 | + wp_delete_post($log->ID, true); |
|
| 779 | 779 | } |
| 780 | 780 | |
| 781 | - if ( 'publish' === $this->status || 'complete' === $this->status ) { |
|
| 782 | - $form = new Give_Donate_Form( $item['id'] ); |
|
| 783 | - $form->decrease_sales( $quantity ); |
|
| 784 | - $form->decrease_earnings( $item['amount'] ); |
|
| 781 | + if ('publish' === $this->status || 'complete' === $this->status) { |
|
| 782 | + $form = new Give_Donate_Form($item['id']); |
|
| 783 | + $form->decrease_sales($quantity); |
|
| 784 | + $form->decrease_earnings($item['amount']); |
|
| 785 | 785 | |
| 786 | 786 | $total_decrease += $item['amount']; |
| 787 | 787 | } |
@@ -792,43 +792,43 @@ discard block |
||
| 792 | 792 | break; |
| 793 | 793 | |
| 794 | 794 | case 'status': |
| 795 | - $this->update_status( $this->status ); |
|
| 795 | + $this->update_status($this->status); |
|
| 796 | 796 | break; |
| 797 | 797 | |
| 798 | 798 | case 'gateway': |
| 799 | - $this->update_meta( '_give_payment_gateway', $this->gateway ); |
|
| 799 | + $this->update_meta('_give_payment_gateway', $this->gateway); |
|
| 800 | 800 | break; |
| 801 | 801 | |
| 802 | 802 | case 'mode': |
| 803 | - $this->update_meta( '_give_payment_mode', $this->mode ); |
|
| 803 | + $this->update_meta('_give_payment_mode', $this->mode); |
|
| 804 | 804 | break; |
| 805 | 805 | |
| 806 | 806 | case 'transaction_id': |
| 807 | - $this->update_meta( '_give_payment_transaction_id', $this->transaction_id ); |
|
| 807 | + $this->update_meta('_give_payment_transaction_id', $this->transaction_id); |
|
| 808 | 808 | break; |
| 809 | 809 | |
| 810 | 810 | case 'ip': |
| 811 | - $this->update_meta( '_give_payment_user_ip', $this->ip ); |
|
| 811 | + $this->update_meta('_give_payment_user_ip', $this->ip); |
|
| 812 | 812 | break; |
| 813 | 813 | |
| 814 | 814 | case 'customer_id': |
| 815 | - $this->update_meta( '_give_payment_customer_id', $this->customer_id ); |
|
| 815 | + $this->update_meta('_give_payment_customer_id', $this->customer_id); |
|
| 816 | 816 | break; |
| 817 | 817 | |
| 818 | 818 | case 'user_id': |
| 819 | - $this->update_meta( '_give_payment_user_id', $this->user_id ); |
|
| 819 | + $this->update_meta('_give_payment_user_id', $this->user_id); |
|
| 820 | 820 | break; |
| 821 | 821 | |
| 822 | 822 | case 'form_title': |
| 823 | - $this->update_meta( '_give_payment_form_title', $this->form_title ); |
|
| 823 | + $this->update_meta('_give_payment_form_title', $this->form_title); |
|
| 824 | 824 | break; |
| 825 | 825 | |
| 826 | 826 | case 'form_id': |
| 827 | - $this->update_meta( '_give_payment_form_id', $this->form_id ); |
|
| 827 | + $this->update_meta('_give_payment_form_id', $this->form_id); |
|
| 828 | 828 | break; |
| 829 | 829 | |
| 830 | 830 | case 'price_id': |
| 831 | - $this->update_meta( '_give_payment_price_id', $this->price_id ); |
|
| 831 | + $this->update_meta('_give_payment_price_id', $this->price_id); |
|
| 832 | 832 | break; |
| 833 | 833 | |
| 834 | 834 | case 'first_name': |
@@ -844,15 +844,15 @@ discard block |
||
| 844 | 844 | break; |
| 845 | 845 | |
| 846 | 846 | case 'email': |
| 847 | - $this->update_meta( '_give_payment_user_email', $this->email ); |
|
| 847 | + $this->update_meta('_give_payment_user_email', $this->email); |
|
| 848 | 848 | break; |
| 849 | 849 | |
| 850 | 850 | case 'key': |
| 851 | - $this->update_meta( '_give_payment_purchase_key', $this->key ); |
|
| 851 | + $this->update_meta('_give_payment_purchase_key', $this->key); |
|
| 852 | 852 | break; |
| 853 | 853 | |
| 854 | 854 | case 'number': |
| 855 | - $this->update_meta( '_give_payment_number', $this->number ); |
|
| 855 | + $this->update_meta('_give_payment_number', $this->number); |
|
| 856 | 856 | break; |
| 857 | 857 | |
| 858 | 858 | case 'date': |
@@ -862,11 +862,11 @@ discard block |
||
| 862 | 862 | 'edit_date' => true, |
| 863 | 863 | ); |
| 864 | 864 | |
| 865 | - wp_update_post( $args ); |
|
| 865 | + wp_update_post($args); |
|
| 866 | 866 | break; |
| 867 | 867 | |
| 868 | 868 | case 'completed_date': |
| 869 | - $this->update_meta( '_give_completed_date', $this->completed_date ); |
|
| 869 | + $this->update_meta('_give_completed_date', $this->completed_date); |
|
| 870 | 870 | break; |
| 871 | 871 | |
| 872 | 872 | case 'parent_payment': |
@@ -875,7 +875,7 @@ discard block |
||
| 875 | 875 | 'post_parent' => $this->parent_payment, |
| 876 | 876 | ); |
| 877 | 877 | |
| 878 | - wp_update_post( $args ); |
|
| 878 | + wp_update_post($args); |
|
| 879 | 879 | break; |
| 880 | 880 | |
| 881 | 881 | default: |
@@ -886,33 +886,33 @@ discard block |
||
| 886 | 886 | * |
| 887 | 887 | * @param Give_Payment $this Payment object. |
| 888 | 888 | */ |
| 889 | - do_action( 'give_payment_save', $this, $key ); |
|
| 889 | + do_action('give_payment_save', $this, $key); |
|
| 890 | 890 | break; |
| 891 | 891 | }// End switch(). |
| 892 | 892 | }// End foreach(). |
| 893 | 893 | |
| 894 | - if ( 'pending' !== $this->status ) { |
|
| 894 | + if ('pending' !== $this->status) { |
|
| 895 | 895 | |
| 896 | - $donor = new Give_Donor( $this->customer_id ); |
|
| 896 | + $donor = new Give_Donor($this->customer_id); |
|
| 897 | 897 | |
| 898 | 898 | $total_change = $total_increase - $total_decrease; |
| 899 | - if ( $total_change < 0 ) { |
|
| 899 | + if ($total_change < 0) { |
|
| 900 | 900 | |
| 901 | - $total_change = - ( $total_change ); |
|
| 901 | + $total_change = - ($total_change); |
|
| 902 | 902 | // Decrease the donor's donation stats. |
| 903 | - $donor->decrease_value( $total_change ); |
|
| 904 | - give_decrease_total_earnings( $total_change ); |
|
| 903 | + $donor->decrease_value($total_change); |
|
| 904 | + give_decrease_total_earnings($total_change); |
|
| 905 | 905 | |
| 906 | - } elseif ( $total_change > 0 ) { |
|
| 906 | + } elseif ($total_change > 0) { |
|
| 907 | 907 | |
| 908 | 908 | // Increase the donor's donation stats. |
| 909 | - $donor->increase_value( $total_change ); |
|
| 910 | - give_increase_total_earnings( $total_change ); |
|
| 909 | + $donor->increase_value($total_change); |
|
| 910 | + give_increase_total_earnings($total_change); |
|
| 911 | 911 | |
| 912 | 912 | } |
| 913 | 913 | } |
| 914 | 914 | |
| 915 | - $this->update_meta( '_give_payment_total', give_sanitize_amount_for_db( $this->total ) ); |
|
| 915 | + $this->update_meta('_give_payment_total', give_sanitize_amount_for_db($this->total)); |
|
| 916 | 916 | |
| 917 | 917 | $new_meta = array( |
| 918 | 918 | 'form_title' => $this->form_title, |
@@ -923,12 +923,12 @@ discard block |
||
| 923 | 923 | ); |
| 924 | 924 | |
| 925 | 925 | $meta = $this->get_meta(); |
| 926 | - $merged_meta = array_merge( $meta, $new_meta ); |
|
| 926 | + $merged_meta = array_merge($meta, $new_meta); |
|
| 927 | 927 | |
| 928 | 928 | // Only save the payment meta if it's changed. |
| 929 | - if ( md5( serialize( $meta ) ) !== md5( serialize( $merged_meta ) ) ) { |
|
| 930 | - $updated = $this->update_meta( '_give_payment_meta', $merged_meta ); |
|
| 931 | - if ( false !== $updated ) { |
|
| 929 | + if (md5(serialize($meta)) !== md5(serialize($merged_meta))) { |
|
| 930 | + $updated = $this->update_meta('_give_payment_meta', $merged_meta); |
|
| 931 | + if (false !== $updated) { |
|
| 932 | 932 | $saved = true; |
| 933 | 933 | } |
| 934 | 934 | } |
@@ -937,8 +937,8 @@ discard block |
||
| 937 | 937 | $saved = true; |
| 938 | 938 | }// End if(). |
| 939 | 939 | |
| 940 | - if ( true === $saved ) { |
|
| 941 | - $this->setup_payment( $this->ID ); |
|
| 940 | + if (true === $saved) { |
|
| 941 | + $this->setup_payment($this->ID); |
|
| 942 | 942 | } |
| 943 | 943 | |
| 944 | 944 | return $saved; |
@@ -956,12 +956,12 @@ discard block |
||
| 956 | 956 | * |
| 957 | 957 | * @return bool True when successful, false otherwise |
| 958 | 958 | */ |
| 959 | - public function add_donation( $form_id = 0, $args = array(), $options = array() ) { |
|
| 959 | + public function add_donation($form_id = 0, $args = array(), $options = array()) { |
|
| 960 | 960 | |
| 961 | - $donation = new Give_Donate_Form( $form_id ); |
|
| 961 | + $donation = new Give_Donate_Form($form_id); |
|
| 962 | 962 | |
| 963 | 963 | // Bail if this post isn't a give donation form. |
| 964 | - if ( ! $donation || $donation->post_type !== 'give_forms' ) { |
|
| 964 | + if ( ! $donation || $donation->post_type !== 'give_forms') { |
|
| 965 | 965 | return false; |
| 966 | 966 | } |
| 967 | 967 | |
@@ -971,59 +971,59 @@ discard block |
||
| 971 | 971 | 'price_id' => false, |
| 972 | 972 | ); |
| 973 | 973 | |
| 974 | - $args = wp_parse_args( apply_filters( 'give_payment_add_donation_args', $args, $donation->ID ), $defaults ); |
|
| 974 | + $args = wp_parse_args(apply_filters('give_payment_add_donation_args', $args, $donation->ID), $defaults); |
|
| 975 | 975 | |
| 976 | 976 | // Allow overriding the price. |
| 977 | - if ( false !== $args['price'] ) { |
|
| 977 | + if (false !== $args['price']) { |
|
| 978 | 978 | $item_price = $args['price']; |
| 979 | 979 | } else { |
| 980 | 980 | |
| 981 | 981 | // Deal with variable pricing. |
| 982 | - if ( give_has_variable_prices( $donation->ID ) ) { |
|
| 983 | - $prices = maybe_unserialize( give_get_meta( $form_id, '_give_donation_levels', true ) ); |
|
| 982 | + if (give_has_variable_prices($donation->ID)) { |
|
| 983 | + $prices = maybe_unserialize(give_get_meta($form_id, '_give_donation_levels', true)); |
|
| 984 | 984 | $item_price = ''; |
| 985 | 985 | // Loop through prices. |
| 986 | - foreach ( $prices as $price ) { |
|
| 986 | + foreach ($prices as $price) { |
|
| 987 | 987 | // Find a match between price_id and level_id. |
| 988 | 988 | // First verify array keys exists THEN make the match. |
| 989 | - if ( ( isset( $args['price_id'] ) && isset( $price['_give_id']['level_id'] ) ) |
|
| 989 | + if ((isset($args['price_id']) && isset($price['_give_id']['level_id'])) |
|
| 990 | 990 | && $args['price_id'] == $price['_give_id']['level_id'] |
| 991 | 991 | ) { |
| 992 | 992 | $item_price = $price['_give_amount']; |
| 993 | 993 | } |
| 994 | 994 | } |
| 995 | 995 | // Fallback to the lowest price point. |
| 996 | - if ( $item_price == '' ) { |
|
| 997 | - $item_price = give_get_lowest_price_option( $donation->ID ); |
|
| 998 | - $args['price_id'] = give_get_lowest_price_id( $donation->ID ); |
|
| 996 | + if ($item_price == '') { |
|
| 997 | + $item_price = give_get_lowest_price_option($donation->ID); |
|
| 998 | + $args['price_id'] = give_get_lowest_price_id($donation->ID); |
|
| 999 | 999 | } |
| 1000 | 1000 | } else { |
| 1001 | 1001 | // Simple form price. |
| 1002 | - $item_price = give_get_form_price( $donation->ID ); |
|
| 1002 | + $item_price = give_get_form_price($donation->ID); |
|
| 1003 | 1003 | } |
| 1004 | 1004 | } |
| 1005 | 1005 | |
| 1006 | 1006 | // Sanitizing the price here so we don't have a dozen calls later. |
| 1007 | - $item_price = give_maybe_sanitize_amount( $item_price ); |
|
| 1008 | - $total = round( $item_price, give_currency_decimal_filter() ); |
|
| 1007 | + $item_price = give_maybe_sanitize_amount($item_price); |
|
| 1008 | + $total = round($item_price, give_currency_decimal_filter()); |
|
| 1009 | 1009 | |
| 1010 | 1010 | // Add Options. |
| 1011 | 1011 | $default_options = array(); |
| 1012 | - if ( false !== $args['price_id'] ) { |
|
| 1012 | + if (false !== $args['price_id']) { |
|
| 1013 | 1013 | $default_options['price_id'] = (int) $args['price_id']; |
| 1014 | 1014 | } |
| 1015 | - $options = wp_parse_args( $options, $default_options ); |
|
| 1015 | + $options = wp_parse_args($options, $default_options); |
|
| 1016 | 1016 | |
| 1017 | 1017 | // Do not allow totals to go negative. |
| 1018 | - if ( $total < 0 ) { |
|
| 1018 | + if ($total < 0) { |
|
| 1019 | 1019 | $total = 0; |
| 1020 | 1020 | } |
| 1021 | 1021 | |
| 1022 | 1022 | $donation = array( |
| 1023 | 1023 | 'name' => $donation->post_title, |
| 1024 | 1024 | 'id' => $donation->ID, |
| 1025 | - 'price' => round( $total, give_currency_decimal_filter() ), |
|
| 1026 | - 'subtotal' => round( $total, give_currency_decimal_filter() ), |
|
| 1025 | + 'price' => round($total, give_currency_decimal_filter()), |
|
| 1026 | + 'subtotal' => round($total, give_currency_decimal_filter()), |
|
| 1027 | 1027 | 'price_id' => $args['price_id'], |
| 1028 | 1028 | 'action' => 'add', |
| 1029 | 1029 | 'options' => $options, |
@@ -1031,7 +1031,7 @@ discard block |
||
| 1031 | 1031 | |
| 1032 | 1032 | $this->pending['donations'][] = $donation; |
| 1033 | 1033 | |
| 1034 | - $this->increase_subtotal( $total ); |
|
| 1034 | + $this->increase_subtotal($total); |
|
| 1035 | 1035 | |
| 1036 | 1036 | return true; |
| 1037 | 1037 | |
@@ -1048,7 +1048,7 @@ discard block |
||
| 1048 | 1048 | * |
| 1049 | 1049 | * @return bool If the item was removed or not |
| 1050 | 1050 | */ |
| 1051 | - public function remove_donation( $form_id, $args = array() ) { |
|
| 1051 | + public function remove_donation($form_id, $args = array()) { |
|
| 1052 | 1052 | |
| 1053 | 1053 | // Set some defaults. |
| 1054 | 1054 | $defaults = array( |
@@ -1056,12 +1056,12 @@ discard block |
||
| 1056 | 1056 | 'price' => false, |
| 1057 | 1057 | 'price_id' => false, |
| 1058 | 1058 | ); |
| 1059 | - $args = wp_parse_args( $args, $defaults ); |
|
| 1059 | + $args = wp_parse_args($args, $defaults); |
|
| 1060 | 1060 | |
| 1061 | - $form = new Give_Donate_Form( $form_id ); |
|
| 1061 | + $form = new Give_Donate_Form($form_id); |
|
| 1062 | 1062 | |
| 1063 | 1063 | // Bail if this post isn't a valid give donation form. |
| 1064 | - if ( ! $form || $form->post_type !== 'give_forms' ) { |
|
| 1064 | + if ( ! $form || $form->post_type !== 'give_forms') { |
|
| 1065 | 1065 | return false; |
| 1066 | 1066 | } |
| 1067 | 1067 | |
@@ -1074,7 +1074,7 @@ discard block |
||
| 1074 | 1074 | |
| 1075 | 1075 | $this->pending['donations'][] = $pending_args; |
| 1076 | 1076 | |
| 1077 | - $this->decrease_subtotal( $this->total ); |
|
| 1077 | + $this->decrease_subtotal($this->total); |
|
| 1078 | 1078 | |
| 1079 | 1079 | return true; |
| 1080 | 1080 | } |
@@ -1090,13 +1090,13 @@ discard block |
||
| 1090 | 1090 | * |
| 1091 | 1091 | * @return void |
| 1092 | 1092 | */ |
| 1093 | - public function add_note( $note = false ) { |
|
| 1093 | + public function add_note($note = false) { |
|
| 1094 | 1094 | // Bail if no note specified. |
| 1095 | - if ( ! $note ) { |
|
| 1095 | + if ( ! $note) { |
|
| 1096 | 1096 | return false; |
| 1097 | 1097 | } |
| 1098 | 1098 | |
| 1099 | - give_insert_payment_note( $this->ID, $note ); |
|
| 1099 | + give_insert_payment_note($this->ID, $note); |
|
| 1100 | 1100 | } |
| 1101 | 1101 | |
| 1102 | 1102 | /** |
@@ -1109,8 +1109,8 @@ discard block |
||
| 1109 | 1109 | * |
| 1110 | 1110 | * @return void |
| 1111 | 1111 | */ |
| 1112 | - private function increase_subtotal( $amount = 0.00 ) { |
|
| 1113 | - $amount = (float) $amount; |
|
| 1112 | + private function increase_subtotal($amount = 0.00) { |
|
| 1113 | + $amount = (float) $amount; |
|
| 1114 | 1114 | $this->subtotal += $amount; |
| 1115 | 1115 | |
| 1116 | 1116 | $this->recalculate_total(); |
@@ -1126,11 +1126,11 @@ discard block |
||
| 1126 | 1126 | * |
| 1127 | 1127 | * @return void |
| 1128 | 1128 | */ |
| 1129 | - private function decrease_subtotal( $amount = 0.00 ) { |
|
| 1130 | - $amount = (float) $amount; |
|
| 1129 | + private function decrease_subtotal($amount = 0.00) { |
|
| 1130 | + $amount = (float) $amount; |
|
| 1131 | 1131 | $this->subtotal -= $amount; |
| 1132 | 1132 | |
| 1133 | - if ( $this->subtotal < 0 ) { |
|
| 1133 | + if ($this->subtotal < 0) { |
|
| 1134 | 1134 | $this->subtotal = 0; |
| 1135 | 1135 | } |
| 1136 | 1136 | |
@@ -1159,24 +1159,24 @@ discard block |
||
| 1159 | 1159 | * |
| 1160 | 1160 | * @return bool $updated Returns if the status was successfully updated. |
| 1161 | 1161 | */ |
| 1162 | - public function update_status( $status = false ) { |
|
| 1162 | + public function update_status($status = false) { |
|
| 1163 | 1163 | |
| 1164 | 1164 | // standardize the 'complete(d)' status. |
| 1165 | - if ( $status == 'completed' || $status == 'complete' ) { |
|
| 1165 | + if ($status == 'completed' || $status == 'complete') { |
|
| 1166 | 1166 | $status = 'publish'; |
| 1167 | 1167 | } |
| 1168 | 1168 | |
| 1169 | - $old_status = ! empty( $this->old_status ) ? $this->old_status : false; |
|
| 1169 | + $old_status = ! empty($this->old_status) ? $this->old_status : false; |
|
| 1170 | 1170 | |
| 1171 | - if ( $old_status === $status ) { |
|
| 1171 | + if ($old_status === $status) { |
|
| 1172 | 1172 | return false; // Don't permit status changes that aren't changes. |
| 1173 | 1173 | } |
| 1174 | 1174 | |
| 1175 | - $do_change = apply_filters( 'give_should_update_payment_status', true, $this->ID, $status, $old_status ); |
|
| 1175 | + $do_change = apply_filters('give_should_update_payment_status', true, $this->ID, $status, $old_status); |
|
| 1176 | 1176 | |
| 1177 | 1177 | $updated = false; |
| 1178 | 1178 | |
| 1179 | - if ( $do_change ) { |
|
| 1179 | + if ($do_change) { |
|
| 1180 | 1180 | |
| 1181 | 1181 | /** |
| 1182 | 1182 | * Fires before changing payment status. |
@@ -1187,21 +1187,21 @@ discard block |
||
| 1187 | 1187 | * @param string $status The new status. |
| 1188 | 1188 | * @param string $old_status The old status. |
| 1189 | 1189 | */ |
| 1190 | - do_action( 'give_before_payment_status_change', $this->ID, $status, $old_status ); |
|
| 1190 | + do_action('give_before_payment_status_change', $this->ID, $status, $old_status); |
|
| 1191 | 1191 | |
| 1192 | 1192 | $update_fields = array( |
| 1193 | 1193 | 'ID' => $this->ID, |
| 1194 | 1194 | 'post_status' => $status, |
| 1195 | - 'edit_date' => current_time( 'mysql' ), |
|
| 1195 | + 'edit_date' => current_time('mysql'), |
|
| 1196 | 1196 | ); |
| 1197 | 1197 | |
| 1198 | - $updated = wp_update_post( apply_filters( 'give_update_payment_status_fields', $update_fields ) ); |
|
| 1198 | + $updated = wp_update_post(apply_filters('give_update_payment_status_fields', $update_fields)); |
|
| 1199 | 1199 | |
| 1200 | 1200 | $all_payment_statuses = give_get_payment_statuses(); |
| 1201 | - $this->status_nicename = array_key_exists( $status, $all_payment_statuses ) ? $all_payment_statuses[ $status ] : ucfirst( $status ); |
|
| 1201 | + $this->status_nicename = array_key_exists($status, $all_payment_statuses) ? $all_payment_statuses[$status] : ucfirst($status); |
|
| 1202 | 1202 | |
| 1203 | 1203 | // Process any specific status functions. |
| 1204 | - switch ( $status ) { |
|
| 1204 | + switch ($status) { |
|
| 1205 | 1205 | case 'refunded': |
| 1206 | 1206 | $this->process_refund(); |
| 1207 | 1207 | break; |
@@ -1228,7 +1228,7 @@ discard block |
||
| 1228 | 1228 | * @param string $status The new status. |
| 1229 | 1229 | * @param string $old_status The old status. |
| 1230 | 1230 | */ |
| 1231 | - do_action( 'give_update_payment_status', $this->ID, $status, $old_status ); |
|
| 1231 | + do_action('give_update_payment_status', $this->ID, $status, $old_status); |
|
| 1232 | 1232 | |
| 1233 | 1233 | }// End if(). |
| 1234 | 1234 | |
@@ -1263,33 +1263,33 @@ discard block |
||
| 1263 | 1263 | * |
| 1264 | 1264 | * @return mixed The value from the post meta |
| 1265 | 1265 | */ |
| 1266 | - public function get_meta( $meta_key = '_give_payment_meta', $single = true ) { |
|
| 1266 | + public function get_meta($meta_key = '_give_payment_meta', $single = true) { |
|
| 1267 | 1267 | |
| 1268 | - $meta = give_get_meta( $this->ID, $meta_key, $single ); |
|
| 1268 | + $meta = give_get_meta($this->ID, $meta_key, $single); |
|
| 1269 | 1269 | |
| 1270 | - if ( $meta_key === '_give_payment_meta' ) { |
|
| 1270 | + if ($meta_key === '_give_payment_meta') { |
|
| 1271 | 1271 | $meta = (array) $meta; |
| 1272 | 1272 | |
| 1273 | - if ( empty( $meta['key'] ) ) { |
|
| 1273 | + if (empty($meta['key'])) { |
|
| 1274 | 1274 | $meta['key'] = $this->setup_payment_key(); |
| 1275 | 1275 | } |
| 1276 | 1276 | |
| 1277 | - if ( empty( $meta['form_title'] ) ) { |
|
| 1277 | + if (empty($meta['form_title'])) { |
|
| 1278 | 1278 | $meta['form_title'] = $this->setup_form_title(); |
| 1279 | 1279 | } |
| 1280 | 1280 | |
| 1281 | - if ( empty( $meta['email'] ) ) { |
|
| 1281 | + if (empty($meta['email'])) { |
|
| 1282 | 1282 | $meta['email'] = $this->setup_email(); |
| 1283 | 1283 | } |
| 1284 | 1284 | |
| 1285 | - if ( empty( $meta['date'] ) ) { |
|
| 1286 | - $meta['date'] = get_post_field( 'post_date', $this->ID ); |
|
| 1285 | + if (empty($meta['date'])) { |
|
| 1286 | + $meta['date'] = get_post_field('post_date', $this->ID); |
|
| 1287 | 1287 | } |
| 1288 | 1288 | } |
| 1289 | 1289 | |
| 1290 | - $meta = apply_filters( "give_get_payment_meta_{$meta_key}", $meta, $this->ID ); |
|
| 1290 | + $meta = apply_filters("give_get_payment_meta_{$meta_key}", $meta, $this->ID); |
|
| 1291 | 1291 | |
| 1292 | - return apply_filters( 'give_get_payment_meta', $meta, $this->ID, $meta_key ); |
|
| 1292 | + return apply_filters('give_get_payment_meta', $meta, $this->ID, $meta_key); |
|
| 1293 | 1293 | } |
| 1294 | 1294 | |
| 1295 | 1295 | /** |
@@ -1304,23 +1304,23 @@ discard block |
||
| 1304 | 1304 | * |
| 1305 | 1305 | * @return int|bool Meta ID if the key didn't exist, true on successful update, false on failure |
| 1306 | 1306 | */ |
| 1307 | - public function update_meta( $meta_key = '', $meta_value = '', $prev_value = '' ) { |
|
| 1308 | - if ( empty( $meta_key ) ) { |
|
| 1307 | + public function update_meta($meta_key = '', $meta_value = '', $prev_value = '') { |
|
| 1308 | + if (empty($meta_key)) { |
|
| 1309 | 1309 | return false; |
| 1310 | 1310 | } |
| 1311 | 1311 | |
| 1312 | - if ( $meta_key == 'key' || $meta_key == 'date' ) { |
|
| 1312 | + if ($meta_key == 'key' || $meta_key == 'date') { |
|
| 1313 | 1313 | |
| 1314 | 1314 | $current_meta = $this->get_meta(); |
| 1315 | - $current_meta[ $meta_key ] = $meta_value; |
|
| 1315 | + $current_meta[$meta_key] = $meta_value; |
|
| 1316 | 1316 | |
| 1317 | 1317 | $meta_key = '_give_payment_meta'; |
| 1318 | 1318 | $meta_value = $current_meta; |
| 1319 | 1319 | |
| 1320 | - } elseif ( $meta_key == 'email' || $meta_key == '_give_payment_user_email' ) { |
|
| 1320 | + } elseif ($meta_key == 'email' || $meta_key == '_give_payment_user_email') { |
|
| 1321 | 1321 | |
| 1322 | - $meta_value = apply_filters( "give_update_payment_meta_{$meta_key}", $meta_value, $this->ID ); |
|
| 1323 | - give_update_meta( $this->ID, '_give_payment_user_email', $meta_value ); |
|
| 1322 | + $meta_value = apply_filters("give_update_payment_meta_{$meta_key}", $meta_value, $this->ID); |
|
| 1323 | + give_update_meta($this->ID, '_give_payment_user_email', $meta_value); |
|
| 1324 | 1324 | |
| 1325 | 1325 | $current_meta = $this->get_meta(); |
| 1326 | 1326 | $current_meta['user_info']['email'] = $meta_value; |
@@ -1330,9 +1330,9 @@ discard block |
||
| 1330 | 1330 | |
| 1331 | 1331 | } |
| 1332 | 1332 | |
| 1333 | - $meta_value = apply_filters( "give_update_payment_meta_{$meta_key}", $meta_value, $this->ID ); |
|
| 1333 | + $meta_value = apply_filters("give_update_payment_meta_{$meta_key}", $meta_value, $this->ID); |
|
| 1334 | 1334 | |
| 1335 | - return give_update_meta( $this->ID, $meta_key, $meta_value, $prev_value ); |
|
| 1335 | + return give_update_meta($this->ID, $meta_key, $meta_value, $prev_value); |
|
| 1336 | 1336 | } |
| 1337 | 1337 | |
| 1338 | 1338 | /** |
@@ -1347,14 +1347,14 @@ discard block |
||
| 1347 | 1347 | $process_refund = true; |
| 1348 | 1348 | |
| 1349 | 1349 | // If the payment was not in publish or revoked status, don't decrement stats as they were never incremented. |
| 1350 | - if ( 'publish' != $this->old_status || 'refunded' != $this->status ) { |
|
| 1350 | + if ('publish' != $this->old_status || 'refunded' != $this->status) { |
|
| 1351 | 1351 | $process_refund = false; |
| 1352 | 1352 | } |
| 1353 | 1353 | |
| 1354 | 1354 | // Allow extensions to filter for their own payment types, Example: Recurring Payments. |
| 1355 | - $process_refund = apply_filters( 'give_should_process_refund', $process_refund, $this ); |
|
| 1355 | + $process_refund = apply_filters('give_should_process_refund', $process_refund, $this); |
|
| 1356 | 1356 | |
| 1357 | - if ( false === $process_refund ) { |
|
| 1357 | + if (false === $process_refund) { |
|
| 1358 | 1358 | return; |
| 1359 | 1359 | } |
| 1360 | 1360 | |
@@ -1365,13 +1365,13 @@ discard block |
||
| 1365 | 1365 | * |
| 1366 | 1366 | * @param Give_Payment $this Payment object. |
| 1367 | 1367 | */ |
| 1368 | - do_action( 'give_pre_refund_payment', $this ); |
|
| 1368 | + do_action('give_pre_refund_payment', $this); |
|
| 1369 | 1369 | |
| 1370 | - $decrease_earnings = apply_filters( 'give_decrease_store_earnings_on_refund', true, $this ); |
|
| 1371 | - $decrease_customer_value = apply_filters( 'give_decrease_customer_value_on_refund', true, $this ); |
|
| 1372 | - $decrease_purchase_count = apply_filters( 'give_decrease_customer_purchase_count_on_refund', true, $this ); |
|
| 1370 | + $decrease_earnings = apply_filters('give_decrease_store_earnings_on_refund', true, $this); |
|
| 1371 | + $decrease_customer_value = apply_filters('give_decrease_customer_value_on_refund', true, $this); |
|
| 1372 | + $decrease_purchase_count = apply_filters('give_decrease_customer_purchase_count_on_refund', true, $this); |
|
| 1373 | 1373 | |
| 1374 | - $this->maybe_alter_stats( $decrease_earnings, $decrease_customer_value, $decrease_purchase_count ); |
|
| 1374 | + $this->maybe_alter_stats($decrease_earnings, $decrease_customer_value, $decrease_purchase_count); |
|
| 1375 | 1375 | $this->delete_sales_logs(); |
| 1376 | 1376 | |
| 1377 | 1377 | // @todo: Refresh only range related stat cache |
@@ -1384,7 +1384,7 @@ discard block |
||
| 1384 | 1384 | * |
| 1385 | 1385 | * @param Give_Payment $this Payment object. |
| 1386 | 1386 | */ |
| 1387 | - do_action( 'give_post_refund_payment', $this ); |
|
| 1387 | + do_action('give_post_refund_payment', $this); |
|
| 1388 | 1388 | } |
| 1389 | 1389 | |
| 1390 | 1390 | /** |
@@ -1411,26 +1411,26 @@ discard block |
||
| 1411 | 1411 | $process_pending = true; |
| 1412 | 1412 | |
| 1413 | 1413 | // If the payment was not in publish or revoked status, don't decrement stats as they were never incremented. |
| 1414 | - if ( 'publish' != $this->old_status || 'pending' != $this->status ) { |
|
| 1414 | + if ('publish' != $this->old_status || 'pending' != $this->status) { |
|
| 1415 | 1415 | $process_pending = false; |
| 1416 | 1416 | } |
| 1417 | 1417 | |
| 1418 | 1418 | // Allow extensions to filter for their own payment types, Example: Recurring Payments. |
| 1419 | - $process_pending = apply_filters( 'give_should_process_pending', $process_pending, $this ); |
|
| 1419 | + $process_pending = apply_filters('give_should_process_pending', $process_pending, $this); |
|
| 1420 | 1420 | |
| 1421 | - if ( false === $process_pending ) { |
|
| 1421 | + if (false === $process_pending) { |
|
| 1422 | 1422 | return; |
| 1423 | 1423 | } |
| 1424 | 1424 | |
| 1425 | - $decrease_earnings = apply_filters( 'give_decrease_earnings_on_pending', true, $this ); |
|
| 1426 | - $decrease_donor_value = apply_filters( 'give_decrease_donor_value_on_pending', true, $this ); |
|
| 1427 | - $decrease_donation_count = apply_filters( 'give_decrease_donors_donation_count_on_pending', true, $this ); |
|
| 1425 | + $decrease_earnings = apply_filters('give_decrease_earnings_on_pending', true, $this); |
|
| 1426 | + $decrease_donor_value = apply_filters('give_decrease_donor_value_on_pending', true, $this); |
|
| 1427 | + $decrease_donation_count = apply_filters('give_decrease_donors_donation_count_on_pending', true, $this); |
|
| 1428 | 1428 | |
| 1429 | - $this->maybe_alter_stats( $decrease_earnings, $decrease_donor_value, $decrease_donation_count ); |
|
| 1429 | + $this->maybe_alter_stats($decrease_earnings, $decrease_donor_value, $decrease_donation_count); |
|
| 1430 | 1430 | $this->delete_sales_logs(); |
| 1431 | 1431 | |
| 1432 | 1432 | $this->completed_date = false; |
| 1433 | - $this->update_meta( '_give_completed_date', '' ); |
|
| 1433 | + $this->update_meta('_give_completed_date', ''); |
|
| 1434 | 1434 | |
| 1435 | 1435 | // @todo: Refresh only range related stat cache |
| 1436 | 1436 | give_delete_donation_stats(); |
@@ -1448,26 +1448,26 @@ discard block |
||
| 1448 | 1448 | $process_cancelled = true; |
| 1449 | 1449 | |
| 1450 | 1450 | // If the payment was not in publish or revoked status, don't decrement stats as they were never incremented. |
| 1451 | - if ( 'publish' != $this->old_status || 'cancelled' != $this->status ) { |
|
| 1451 | + if ('publish' != $this->old_status || 'cancelled' != $this->status) { |
|
| 1452 | 1452 | $process_cancelled = false; |
| 1453 | 1453 | } |
| 1454 | 1454 | |
| 1455 | 1455 | // Allow extensions to filter for their own payment types, Example: Recurring Payments. |
| 1456 | - $process_cancelled = apply_filters( 'give_should_process_cancelled', $process_cancelled, $this ); |
|
| 1456 | + $process_cancelled = apply_filters('give_should_process_cancelled', $process_cancelled, $this); |
|
| 1457 | 1457 | |
| 1458 | - if ( false === $process_cancelled ) { |
|
| 1458 | + if (false === $process_cancelled) { |
|
| 1459 | 1459 | return; |
| 1460 | 1460 | } |
| 1461 | 1461 | |
| 1462 | - $decrease_earnings = apply_filters( 'give_decrease_earnings_on_cancelled', true, $this ); |
|
| 1463 | - $decrease_donor_value = apply_filters( 'give_decrease_donor_value_on_cancelled', true, $this ); |
|
| 1464 | - $decrease_donation_count = apply_filters( 'give_decrease_donors_donation_count_on_cancelled', true, $this ); |
|
| 1462 | + $decrease_earnings = apply_filters('give_decrease_earnings_on_cancelled', true, $this); |
|
| 1463 | + $decrease_donor_value = apply_filters('give_decrease_donor_value_on_cancelled', true, $this); |
|
| 1464 | + $decrease_donation_count = apply_filters('give_decrease_donors_donation_count_on_cancelled', true, $this); |
|
| 1465 | 1465 | |
| 1466 | - $this->maybe_alter_stats( $decrease_earnings, $decrease_donor_value, $decrease_donation_count ); |
|
| 1466 | + $this->maybe_alter_stats($decrease_earnings, $decrease_donor_value, $decrease_donation_count); |
|
| 1467 | 1467 | $this->delete_sales_logs(); |
| 1468 | 1468 | |
| 1469 | 1469 | $this->completed_date = false; |
| 1470 | - $this->update_meta( '_give_completed_date', '' ); |
|
| 1470 | + $this->update_meta('_give_completed_date', ''); |
|
| 1471 | 1471 | |
| 1472 | 1472 | // @todo: Refresh only range related stat cache |
| 1473 | 1473 | give_delete_donation_stats(); |
@@ -1483,26 +1483,26 @@ discard block |
||
| 1483 | 1483 | $process_revoked = true; |
| 1484 | 1484 | |
| 1485 | 1485 | // If the payment was not in publish, don't decrement stats as they were never incremented. |
| 1486 | - if ( 'publish' != $this->old_status || 'revoked' != $this->status ) { |
|
| 1486 | + if ('publish' != $this->old_status || 'revoked' != $this->status) { |
|
| 1487 | 1487 | $process_revoked = false; |
| 1488 | 1488 | } |
| 1489 | 1489 | |
| 1490 | 1490 | // Allow extensions to filter for their own payment types, Example: Recurring Payments. |
| 1491 | - $process_revoked = apply_filters( 'give_should_process_revoked', $process_revoked, $this ); |
|
| 1491 | + $process_revoked = apply_filters('give_should_process_revoked', $process_revoked, $this); |
|
| 1492 | 1492 | |
| 1493 | - if ( false === $process_revoked ) { |
|
| 1493 | + if (false === $process_revoked) { |
|
| 1494 | 1494 | return; |
| 1495 | 1495 | } |
| 1496 | 1496 | |
| 1497 | - $decrease_earnings = apply_filters( 'give_decrease_earnings_on_revoked', true, $this ); |
|
| 1498 | - $decrease_donor_value = apply_filters( 'give_decrease_donor_value_on_revoked', true, $this ); |
|
| 1499 | - $decrease_donation_count = apply_filters( 'give_decrease_donors_donation_count_on_revoked', true, $this ); |
|
| 1497 | + $decrease_earnings = apply_filters('give_decrease_earnings_on_revoked', true, $this); |
|
| 1498 | + $decrease_donor_value = apply_filters('give_decrease_donor_value_on_revoked', true, $this); |
|
| 1499 | + $decrease_donation_count = apply_filters('give_decrease_donors_donation_count_on_revoked', true, $this); |
|
| 1500 | 1500 | |
| 1501 | - $this->maybe_alter_stats( $decrease_earnings, $decrease_donor_value, $decrease_donation_count ); |
|
| 1501 | + $this->maybe_alter_stats($decrease_earnings, $decrease_donor_value, $decrease_donation_count); |
|
| 1502 | 1502 | $this->delete_sales_logs(); |
| 1503 | 1503 | |
| 1504 | 1504 | $this->completed_date = false; |
| 1505 | - $this->update_meta( '_give_completed_date', '' ); |
|
| 1505 | + $this->update_meta('_give_completed_date', ''); |
|
| 1506 | 1506 | |
| 1507 | 1507 | // @todo: Refresh only range related stat cache |
| 1508 | 1508 | give_delete_donation_stats(); |
@@ -1520,25 +1520,25 @@ discard block |
||
| 1520 | 1520 | * |
| 1521 | 1521 | * @return void |
| 1522 | 1522 | */ |
| 1523 | - private function maybe_alter_stats( $alter_store_earnings, $alter_customer_value, $alter_customer_purchase_count ) { |
|
| 1523 | + private function maybe_alter_stats($alter_store_earnings, $alter_customer_value, $alter_customer_purchase_count) { |
|
| 1524 | 1524 | |
| 1525 | - give_undo_donation( $this->ID ); |
|
| 1525 | + give_undo_donation($this->ID); |
|
| 1526 | 1526 | |
| 1527 | 1527 | // Decrease store earnings. |
| 1528 | - if ( true === $alter_store_earnings ) { |
|
| 1529 | - give_decrease_total_earnings( $this->total ); |
|
| 1528 | + if (true === $alter_store_earnings) { |
|
| 1529 | + give_decrease_total_earnings($this->total); |
|
| 1530 | 1530 | } |
| 1531 | 1531 | |
| 1532 | 1532 | // Decrement the stats for the donor. |
| 1533 | - if ( ! empty( $this->customer_id ) ) { |
|
| 1533 | + if ( ! empty($this->customer_id)) { |
|
| 1534 | 1534 | |
| 1535 | - $donor = new Give_Donor( $this->customer_id ); |
|
| 1535 | + $donor = new Give_Donor($this->customer_id); |
|
| 1536 | 1536 | |
| 1537 | - if ( true === $alter_customer_value ) { |
|
| 1538 | - $donor->decrease_value( $this->total ); |
|
| 1537 | + if (true === $alter_customer_value) { |
|
| 1538 | + $donor->decrease_value($this->total); |
|
| 1539 | 1539 | } |
| 1540 | 1540 | |
| 1541 | - if ( true === $alter_customer_purchase_count ) { |
|
| 1541 | + if (true === $alter_customer_purchase_count) { |
|
| 1542 | 1542 | $donor->decrease_donation_count(); |
| 1543 | 1543 | } |
| 1544 | 1544 | } |
@@ -1587,13 +1587,13 @@ discard block |
||
| 1587 | 1587 | * @return string The date the payment was completed |
| 1588 | 1588 | */ |
| 1589 | 1589 | private function setup_completed_date() { |
| 1590 | - $payment = get_post( $this->ID ); |
|
| 1590 | + $payment = get_post($this->ID); |
|
| 1591 | 1591 | |
| 1592 | - if ( 'pending' == $payment->post_status || 'preapproved' == $payment->post_status ) { |
|
| 1592 | + if ('pending' == $payment->post_status || 'preapproved' == $payment->post_status) { |
|
| 1593 | 1593 | return false; // This payment was never completed. |
| 1594 | 1594 | } |
| 1595 | 1595 | |
| 1596 | - $date = ( $date = $this->get_meta( '_give_completed_date', true ) ) ? $date : $payment->modified_date; |
|
| 1596 | + $date = ($date = $this->get_meta('_give_completed_date', true)) ? $date : $payment->modified_date; |
|
| 1597 | 1597 | |
| 1598 | 1598 | return $date; |
| 1599 | 1599 | } |
@@ -1607,7 +1607,7 @@ discard block |
||
| 1607 | 1607 | * @return string The payment mode |
| 1608 | 1608 | */ |
| 1609 | 1609 | private function setup_mode() { |
| 1610 | - return $this->get_meta( '_give_payment_mode' ); |
|
| 1610 | + return $this->get_meta('_give_payment_mode'); |
|
| 1611 | 1611 | } |
| 1612 | 1612 | |
| 1613 | 1613 | /** |
@@ -1619,18 +1619,18 @@ discard block |
||
| 1619 | 1619 | * @return float The payment total |
| 1620 | 1620 | */ |
| 1621 | 1621 | private function setup_total() { |
| 1622 | - $amount = $this->get_meta( '_give_payment_total', true ); |
|
| 1622 | + $amount = $this->get_meta('_give_payment_total', true); |
|
| 1623 | 1623 | |
| 1624 | - if ( empty( $amount ) && '0.00' != $amount ) { |
|
| 1625 | - $meta = $this->get_meta( '_give_payment_meta', true ); |
|
| 1626 | - $meta = maybe_unserialize( $meta ); |
|
| 1624 | + if (empty($amount) && '0.00' != $amount) { |
|
| 1625 | + $meta = $this->get_meta('_give_payment_meta', true); |
|
| 1626 | + $meta = maybe_unserialize($meta); |
|
| 1627 | 1627 | |
| 1628 | - if ( isset( $meta['amount'] ) ) { |
|
| 1628 | + if (isset($meta['amount'])) { |
|
| 1629 | 1629 | $amount = $meta['amount']; |
| 1630 | 1630 | } |
| 1631 | 1631 | } |
| 1632 | 1632 | |
| 1633 | - return round( floatval( $amount ), give_currency_decimal_filter() ); |
|
| 1633 | + return round(floatval($amount), give_currency_decimal_filter()); |
|
| 1634 | 1634 | } |
| 1635 | 1635 | |
| 1636 | 1636 | /** |
@@ -1656,7 +1656,7 @@ discard block |
||
| 1656 | 1656 | * @return string The currency for the payment |
| 1657 | 1657 | */ |
| 1658 | 1658 | private function setup_currency() { |
| 1659 | - $currency = isset( $this->payment_meta['currency'] ) ? $this->payment_meta['currency'] : apply_filters( 'give_payment_currency_default', give_get_currency(), $this ); |
|
| 1659 | + $currency = isset($this->payment_meta['currency']) ? $this->payment_meta['currency'] : apply_filters('give_payment_currency_default', give_get_currency(), $this); |
|
| 1660 | 1660 | |
| 1661 | 1661 | return $currency; |
| 1662 | 1662 | } |
@@ -1670,7 +1670,7 @@ discard block |
||
| 1670 | 1670 | * @return string The gateway |
| 1671 | 1671 | */ |
| 1672 | 1672 | private function setup_gateway() { |
| 1673 | - $gateway = $this->get_meta( '_give_payment_gateway', true ); |
|
| 1673 | + $gateway = $this->get_meta('_give_payment_gateway', true); |
|
| 1674 | 1674 | |
| 1675 | 1675 | return $gateway; |
| 1676 | 1676 | } |
@@ -1684,11 +1684,11 @@ discard block |
||
| 1684 | 1684 | * @return string The donation ID |
| 1685 | 1685 | */ |
| 1686 | 1686 | private function setup_transaction_id() { |
| 1687 | - $transaction_id = $this->get_meta( '_give_payment_transaction_id', true ); |
|
| 1687 | + $transaction_id = $this->get_meta('_give_payment_transaction_id', true); |
|
| 1688 | 1688 | |
| 1689 | - if ( empty( $transaction_id ) ) { |
|
| 1689 | + if (empty($transaction_id)) { |
|
| 1690 | 1690 | $gateway = $this->gateway; |
| 1691 | - $transaction_id = apply_filters( "give_get_payment_transaction_id-{$gateway}", $this->ID ); |
|
| 1691 | + $transaction_id = apply_filters("give_get_payment_transaction_id-{$gateway}", $this->ID); |
|
| 1692 | 1692 | } |
| 1693 | 1693 | |
| 1694 | 1694 | return $transaction_id; |
@@ -1703,7 +1703,7 @@ discard block |
||
| 1703 | 1703 | * @return string The IP address for the payment |
| 1704 | 1704 | */ |
| 1705 | 1705 | private function setup_ip() { |
| 1706 | - $ip = $this->get_meta( '_give_payment_user_ip', true ); |
|
| 1706 | + $ip = $this->get_meta('_give_payment_user_ip', true); |
|
| 1707 | 1707 | |
| 1708 | 1708 | return $ip; |
| 1709 | 1709 | } |
@@ -1717,7 +1717,7 @@ discard block |
||
| 1717 | 1717 | * @return int The Donor ID. |
| 1718 | 1718 | */ |
| 1719 | 1719 | private function setup_donor_id() { |
| 1720 | - $customer_id = $this->get_meta( '_give_payment_customer_id', true ); |
|
| 1720 | + $customer_id = $this->get_meta('_give_payment_customer_id', true); |
|
| 1721 | 1721 | |
| 1722 | 1722 | return $customer_id; |
| 1723 | 1723 | } |
@@ -1731,7 +1731,7 @@ discard block |
||
| 1731 | 1731 | * @return int The User ID |
| 1732 | 1732 | */ |
| 1733 | 1733 | private function setup_user_id() { |
| 1734 | - $user_id = $this->get_meta( '_give_payment_user_id', true ); |
|
| 1734 | + $user_id = $this->get_meta('_give_payment_user_id', true); |
|
| 1735 | 1735 | |
| 1736 | 1736 | return $user_id; |
| 1737 | 1737 | } |
@@ -1745,10 +1745,10 @@ discard block |
||
| 1745 | 1745 | * @return string The email address for the payment. |
| 1746 | 1746 | */ |
| 1747 | 1747 | private function setup_email() { |
| 1748 | - $email = $this->get_meta( '_give_payment_user_email', true ); |
|
| 1748 | + $email = $this->get_meta('_give_payment_user_email', true); |
|
| 1749 | 1749 | |
| 1750 | - if ( empty( $email ) && $this->customer_id ) { |
|
| 1751 | - $email = Give()->donors->get_column( 'email', $this->customer_id ); |
|
| 1750 | + if (empty($email) && $this->customer_id) { |
|
| 1751 | + $email = Give()->donors->get_column('email', $this->customer_id); |
|
| 1752 | 1752 | } |
| 1753 | 1753 | |
| 1754 | 1754 | return $email; |
@@ -1768,15 +1768,15 @@ discard block |
||
| 1768 | 1768 | 'last_name' => $this->last_name, |
| 1769 | 1769 | ); |
| 1770 | 1770 | |
| 1771 | - $user_info = isset( $this->payment_meta['user_info'] ) ? maybe_unserialize( $this->payment_meta['user_info'] ) : array(); |
|
| 1772 | - $user_info = wp_parse_args( $user_info, $defaults ); |
|
| 1771 | + $user_info = isset($this->payment_meta['user_info']) ? maybe_unserialize($this->payment_meta['user_info']) : array(); |
|
| 1772 | + $user_info = wp_parse_args($user_info, $defaults); |
|
| 1773 | 1773 | |
| 1774 | - if ( empty( $user_info ) ) { |
|
| 1774 | + if (empty($user_info)) { |
|
| 1775 | 1775 | // Get the donor, but only if it's been created. |
| 1776 | - $donor = new Give_Donor( $this->customer_id ); |
|
| 1776 | + $donor = new Give_Donor($this->customer_id); |
|
| 1777 | 1777 | |
| 1778 | - if ( $donor->id > 0 ) { |
|
| 1779 | - $name = explode( ' ', $donor->name, 2 ); |
|
| 1778 | + if ($donor->id > 0) { |
|
| 1779 | + $name = explode(' ', $donor->name, 2); |
|
| 1780 | 1780 | $user_info = array( |
| 1781 | 1781 | 'first_name' => $name[0], |
| 1782 | 1782 | 'last_name' => $name[1], |
@@ -1786,29 +1786,29 @@ discard block |
||
| 1786 | 1786 | } |
| 1787 | 1787 | } else { |
| 1788 | 1788 | // Get the donor, but only if it's been created. |
| 1789 | - $donor = new Give_Donor( $this->customer_id ); |
|
| 1790 | - if ( $donor->id > 0 ) { |
|
| 1791 | - foreach ( $user_info as $key => $value ) { |
|
| 1792 | - if ( ! empty( $value ) ) { |
|
| 1789 | + $donor = new Give_Donor($this->customer_id); |
|
| 1790 | + if ($donor->id > 0) { |
|
| 1791 | + foreach ($user_info as $key => $value) { |
|
| 1792 | + if ( ! empty($value)) { |
|
| 1793 | 1793 | continue; |
| 1794 | 1794 | } |
| 1795 | 1795 | |
| 1796 | - switch ( $key ) { |
|
| 1796 | + switch ($key) { |
|
| 1797 | 1797 | case 'first_name': |
| 1798 | - $name = explode( ' ', $donor->name, 2 ); |
|
| 1798 | + $name = explode(' ', $donor->name, 2); |
|
| 1799 | 1799 | |
| 1800 | - $user_info[ $key ] = $name[0]; |
|
| 1800 | + $user_info[$key] = $name[0]; |
|
| 1801 | 1801 | break; |
| 1802 | 1802 | |
| 1803 | 1803 | case 'last_name': |
| 1804 | - $name = explode( ' ', $donor->name, 2 ); |
|
| 1805 | - $last_name = ! empty( $name[1] ) ? $name[1] : ''; |
|
| 1804 | + $name = explode(' ', $donor->name, 2); |
|
| 1805 | + $last_name = ! empty($name[1]) ? $name[1] : ''; |
|
| 1806 | 1806 | |
| 1807 | - $user_info[ $key ] = $last_name; |
|
| 1807 | + $user_info[$key] = $last_name; |
|
| 1808 | 1808 | break; |
| 1809 | 1809 | |
| 1810 | 1810 | case 'email': |
| 1811 | - $user_info[ $key ] = $donor->email; |
|
| 1811 | + $user_info[$key] = $donor->email; |
|
| 1812 | 1812 | break; |
| 1813 | 1813 | } |
| 1814 | 1814 | } |
@@ -1829,7 +1829,7 @@ discard block |
||
| 1829 | 1829 | */ |
| 1830 | 1830 | private function setup_address() { |
| 1831 | 1831 | |
| 1832 | - $address = ! empty( $this->payment_meta['user_info']['address'] ) ? $this->payment_meta['user_info']['address'] : array( |
|
| 1832 | + $address = ! empty($this->payment_meta['user_info']['address']) ? $this->payment_meta['user_info']['address'] : array( |
|
| 1833 | 1833 | 'line1' => '', |
| 1834 | 1834 | 'line2' => '', |
| 1835 | 1835 | 'city' => '', |
@@ -1851,7 +1851,7 @@ discard block |
||
| 1851 | 1851 | */ |
| 1852 | 1852 | private function setup_form_title() { |
| 1853 | 1853 | |
| 1854 | - $form_id = $this->get_meta( '_give_payment_form_title', true ); |
|
| 1854 | + $form_id = $this->get_meta('_give_payment_form_title', true); |
|
| 1855 | 1855 | |
| 1856 | 1856 | return $form_id; |
| 1857 | 1857 | } |
@@ -1866,7 +1866,7 @@ discard block |
||
| 1866 | 1866 | */ |
| 1867 | 1867 | private function setup_form_id() { |
| 1868 | 1868 | |
| 1869 | - $form_id = $this->get_meta( '_give_payment_form_id', true ); |
|
| 1869 | + $form_id = $this->get_meta('_give_payment_form_id', true); |
|
| 1870 | 1870 | |
| 1871 | 1871 | return $form_id; |
| 1872 | 1872 | } |
@@ -1880,7 +1880,7 @@ discard block |
||
| 1880 | 1880 | * @return int The Form Price ID. |
| 1881 | 1881 | */ |
| 1882 | 1882 | private function setup_price_id() { |
| 1883 | - $price_id = $this->get_meta( '_give_payment_price_id', true ); |
|
| 1883 | + $price_id = $this->get_meta('_give_payment_price_id', true); |
|
| 1884 | 1884 | |
| 1885 | 1885 | return $price_id; |
| 1886 | 1886 | } |
@@ -1894,7 +1894,7 @@ discard block |
||
| 1894 | 1894 | * @return string The Payment Key. |
| 1895 | 1895 | */ |
| 1896 | 1896 | private function setup_payment_key() { |
| 1897 | - $key = $this->get_meta( '_give_payment_purchase_key', true ); |
|
| 1897 | + $key = $this->get_meta('_give_payment_purchase_key', true); |
|
| 1898 | 1898 | |
| 1899 | 1899 | return $key; |
| 1900 | 1900 | } |
@@ -1910,11 +1910,11 @@ discard block |
||
| 1910 | 1910 | private function setup_payment_number() { |
| 1911 | 1911 | $number = $this->ID; |
| 1912 | 1912 | |
| 1913 | - if ( give_get_option( 'enable_sequential' ) ) { |
|
| 1913 | + if (give_get_option('enable_sequential')) { |
|
| 1914 | 1914 | |
| 1915 | - $number = $this->get_meta( '_give_payment_number', true ); |
|
| 1915 | + $number = $this->get_meta('_give_payment_number', true); |
|
| 1916 | 1916 | |
| 1917 | - if ( ! $number ) { |
|
| 1917 | + if ( ! $number) { |
|
| 1918 | 1918 | |
| 1919 | 1919 | $number = $this->ID; |
| 1920 | 1920 | |
@@ -1932,7 +1932,7 @@ discard block |
||
| 1932 | 1932 | * @return array The payment object as an array. |
| 1933 | 1933 | */ |
| 1934 | 1934 | public function array_convert() { |
| 1935 | - return get_object_vars( $this ); |
|
| 1935 | + return get_object_vars($this); |
|
| 1936 | 1936 | } |
| 1937 | 1937 | |
| 1938 | 1938 | |
@@ -1945,7 +1945,7 @@ discard block |
||
| 1945 | 1945 | * @return bool |
| 1946 | 1946 | */ |
| 1947 | 1947 | public function is_completed() { |
| 1948 | - return ( 'publish' === $this->status && $this->completed_date ); |
|
| 1948 | + return ('publish' === $this->status && $this->completed_date); |
|
| 1949 | 1949 | } |
| 1950 | 1950 | |
| 1951 | 1951 | /** |
@@ -1957,7 +1957,7 @@ discard block |
||
| 1957 | 1957 | * @return string Date payment was completed. |
| 1958 | 1958 | */ |
| 1959 | 1959 | private function get_completed_date() { |
| 1960 | - return apply_filters( 'give_payment_completed_date', $this->completed_date, $this->ID, $this ); |
|
| 1960 | + return apply_filters('give_payment_completed_date', $this->completed_date, $this->ID, $this); |
|
| 1961 | 1961 | } |
| 1962 | 1962 | |
| 1963 | 1963 | /** |
@@ -1969,7 +1969,7 @@ discard block |
||
| 1969 | 1969 | * @return float Payment subtotal. |
| 1970 | 1970 | */ |
| 1971 | 1971 | private function get_subtotal() { |
| 1972 | - return apply_filters( 'give_get_payment_subtotal', $this->subtotal, $this->ID, $this ); |
|
| 1972 | + return apply_filters('give_get_payment_subtotal', $this->subtotal, $this->ID, $this); |
|
| 1973 | 1973 | } |
| 1974 | 1974 | |
| 1975 | 1975 | /** |
@@ -1981,7 +1981,7 @@ discard block |
||
| 1981 | 1981 | * @return string Payment currency code. |
| 1982 | 1982 | */ |
| 1983 | 1983 | private function get_currency() { |
| 1984 | - return apply_filters( 'give_payment_currency_code', $this->currency, $this->ID, $this ); |
|
| 1984 | + return apply_filters('give_payment_currency_code', $this->currency, $this->ID, $this); |
|
| 1985 | 1985 | } |
| 1986 | 1986 | |
| 1987 | 1987 | /** |
@@ -1993,7 +1993,7 @@ discard block |
||
| 1993 | 1993 | * @return string Gateway used. |
| 1994 | 1994 | */ |
| 1995 | 1995 | private function get_gateway() { |
| 1996 | - return apply_filters( 'give_payment_gateway', $this->gateway, $this->ID, $this ); |
|
| 1996 | + return apply_filters('give_payment_gateway', $this->gateway, $this->ID, $this); |
|
| 1997 | 1997 | } |
| 1998 | 1998 | |
| 1999 | 1999 | /** |
@@ -2005,7 +2005,7 @@ discard block |
||
| 2005 | 2005 | * @return string Donation ID from merchant processor. |
| 2006 | 2006 | */ |
| 2007 | 2007 | private function get_transaction_id() { |
| 2008 | - return apply_filters( 'give_get_payment_transaction_id', $this->transaction_id, $this->ID, $this ); |
|
| 2008 | + return apply_filters('give_get_payment_transaction_id', $this->transaction_id, $this->ID, $this); |
|
| 2009 | 2009 | } |
| 2010 | 2010 | |
| 2011 | 2011 | /** |
@@ -2017,7 +2017,7 @@ discard block |
||
| 2017 | 2017 | * @return string Payment IP address |
| 2018 | 2018 | */ |
| 2019 | 2019 | private function get_ip() { |
| 2020 | - return apply_filters( 'give_payment_user_ip', $this->ip, $this->ID, $this ); |
|
| 2020 | + return apply_filters('give_payment_user_ip', $this->ip, $this->ID, $this); |
|
| 2021 | 2021 | } |
| 2022 | 2022 | |
| 2023 | 2023 | /** |
@@ -2029,7 +2029,7 @@ discard block |
||
| 2029 | 2029 | * @return int Payment donor ID. |
| 2030 | 2030 | */ |
| 2031 | 2031 | private function get_donor_id() { |
| 2032 | - return apply_filters( 'give_payment_customer_id', $this->customer_id, $this->ID, $this ); |
|
| 2032 | + return apply_filters('give_payment_customer_id', $this->customer_id, $this->ID, $this); |
|
| 2033 | 2033 | } |
| 2034 | 2034 | |
| 2035 | 2035 | /** |
@@ -2041,7 +2041,7 @@ discard block |
||
| 2041 | 2041 | * @return int Payment user ID. |
| 2042 | 2042 | */ |
| 2043 | 2043 | private function get_user_id() { |
| 2044 | - return apply_filters( 'give_payment_user_id', $this->user_id, $this->ID, $this ); |
|
| 2044 | + return apply_filters('give_payment_user_id', $this->user_id, $this->ID, $this); |
|
| 2045 | 2045 | } |
| 2046 | 2046 | |
| 2047 | 2047 | /** |
@@ -2053,7 +2053,7 @@ discard block |
||
| 2053 | 2053 | * @return string Payment donor email. |
| 2054 | 2054 | */ |
| 2055 | 2055 | private function get_email() { |
| 2056 | - return apply_filters( 'give_payment_user_email', $this->email, $this->ID, $this ); |
|
| 2056 | + return apply_filters('give_payment_user_email', $this->email, $this->ID, $this); |
|
| 2057 | 2057 | } |
| 2058 | 2058 | |
| 2059 | 2059 | /** |
@@ -2065,7 +2065,7 @@ discard block |
||
| 2065 | 2065 | * @return array Payment user info. |
| 2066 | 2066 | */ |
| 2067 | 2067 | private function get_user_info() { |
| 2068 | - return apply_filters( 'give_payment_meta_user_info', $this->user_info, $this->ID, $this ); |
|
| 2068 | + return apply_filters('give_payment_meta_user_info', $this->user_info, $this->ID, $this); |
|
| 2069 | 2069 | } |
| 2070 | 2070 | |
| 2071 | 2071 | /** |
@@ -2077,7 +2077,7 @@ discard block |
||
| 2077 | 2077 | * @return array Payment billing address. |
| 2078 | 2078 | */ |
| 2079 | 2079 | private function get_address() { |
| 2080 | - return apply_filters( 'give_payment_address', $this->address, $this->ID, $this ); |
|
| 2080 | + return apply_filters('give_payment_address', $this->address, $this->ID, $this); |
|
| 2081 | 2081 | } |
| 2082 | 2082 | |
| 2083 | 2083 | /** |
@@ -2089,7 +2089,7 @@ discard block |
||
| 2089 | 2089 | * @return string Payment key. |
| 2090 | 2090 | */ |
| 2091 | 2091 | private function get_key() { |
| 2092 | - return apply_filters( 'give_payment_key', $this->key, $this->ID, $this ); |
|
| 2092 | + return apply_filters('give_payment_key', $this->key, $this->ID, $this); |
|
| 2093 | 2093 | } |
| 2094 | 2094 | |
| 2095 | 2095 | /** |
@@ -2101,7 +2101,7 @@ discard block |
||
| 2101 | 2101 | * @return string Payment form id |
| 2102 | 2102 | */ |
| 2103 | 2103 | private function get_form_id() { |
| 2104 | - return apply_filters( 'give_payment_form_id', $this->form_id, $this->ID, $this ); |
|
| 2104 | + return apply_filters('give_payment_form_id', $this->form_id, $this->ID, $this); |
|
| 2105 | 2105 | } |
| 2106 | 2106 | |
| 2107 | 2107 | /** |
@@ -2113,7 +2113,7 @@ discard block |
||
| 2113 | 2113 | * @return int|string Payment number |
| 2114 | 2114 | */ |
| 2115 | 2115 | private function get_number() { |
| 2116 | - return apply_filters( 'give_payment_number', $this->number, $this->ID, $this ); |
|
| 2116 | + return apply_filters('give_payment_number', $this->number, $this->ID, $this); |
|
| 2117 | 2117 | } |
| 2118 | 2118 | |
| 2119 | 2119 | } |
@@ -10,7 +10,7 @@ discard block |
||
| 10 | 10 | */ |
| 11 | 11 | |
| 12 | 12 | // Exit if accessed directly. |
| 13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 13 | +if ( ! defined('ABSPATH')) { |
|
| 14 | 14 | exit; |
| 15 | 15 | } |
| 16 | 16 | |
@@ -34,8 +34,8 @@ discard block |
||
| 34 | 34 | * @see Give_Cron::weekly_events() |
| 35 | 35 | */ |
| 36 | 36 | public function __construct() { |
| 37 | - add_filter( 'cron_schedules', array( $this, 'add_schedules' ) ); |
|
| 38 | - add_action( 'wp', array( $this, 'schedule_Events' ) ); |
|
| 37 | + add_filter('cron_schedules', array($this, 'add_schedules')); |
|
| 38 | + add_action('wp', array($this, 'schedule_Events')); |
|
| 39 | 39 | } |
| 40 | 40 | |
| 41 | 41 | /** |
@@ -48,11 +48,11 @@ discard block |
||
| 48 | 48 | * |
| 49 | 49 | * @return array An array of non-default cron schedules. |
| 50 | 50 | */ |
| 51 | - public function add_schedules( $schedules = array() ) { |
|
| 51 | + public function add_schedules($schedules = array()) { |
|
| 52 | 52 | // Adds once weekly to the existing schedules. |
| 53 | 53 | $schedules['weekly'] = array( |
| 54 | 54 | 'interval' => 604800, |
| 55 | - 'display' => esc_html__( 'Once Weekly', 'give' ) |
|
| 55 | + 'display' => esc_html__('Once Weekly', 'give') |
|
| 56 | 56 | ); |
| 57 | 57 | |
| 58 | 58 | return $schedules; |
@@ -80,8 +80,8 @@ discard block |
||
| 80 | 80 | * @return void |
| 81 | 81 | */ |
| 82 | 82 | private function weekly_events() { |
| 83 | - if ( ! wp_next_scheduled( 'give_weekly_scheduled_events' ) ) { |
|
| 84 | - wp_schedule_event( current_time( 'timestamp' ), 'weekly', 'give_weekly_scheduled_events' ); |
|
| 83 | + if ( ! wp_next_scheduled('give_weekly_scheduled_events')) { |
|
| 84 | + wp_schedule_event(current_time('timestamp'), 'weekly', 'give_weekly_scheduled_events'); |
|
| 85 | 85 | } |
| 86 | 86 | } |
| 87 | 87 | |
@@ -94,8 +94,8 @@ discard block |
||
| 94 | 94 | * @return void |
| 95 | 95 | */ |
| 96 | 96 | private function daily_events() { |
| 97 | - if ( ! wp_next_scheduled( 'give_daily_scheduled_events' ) ) { |
|
| 98 | - wp_schedule_event( current_time( 'timestamp' ), 'daily', 'give_daily_scheduled_events' ); |
|
| 97 | + if ( ! wp_next_scheduled('give_daily_scheduled_events')) { |
|
| 98 | + wp_schedule_event(current_time('timestamp'), 'daily', 'give_daily_scheduled_events'); |
|
| 99 | 99 | } |
| 100 | 100 | } |
| 101 | 101 | |
@@ -79,13 +79,13 @@ discard block |
||
| 79 | 79 | 'default' => get_bloginfo( 'admin_email' ), |
| 80 | 80 | 'type' => 'text' |
| 81 | 81 | ), |
| 82 | - array( |
|
| 83 | - 'name' => esc_html__( 'Email Settings Docs Link', 'give' ), |
|
| 84 | - 'id' => 'email_settings_docs_link', |
|
| 85 | - 'url' => esc_url( 'http://docs.givewp.com/settings-emails' ), |
|
| 86 | - 'title' => __( 'Email Settings', 'give' ), |
|
| 87 | - 'type' => 'give_docs_link', |
|
| 88 | - ), |
|
| 82 | + array( |
|
| 83 | + 'name' => esc_html__( 'Email Settings Docs Link', 'give' ), |
|
| 84 | + 'id' => 'email_settings_docs_link', |
|
| 85 | + 'url' => esc_url( 'http://docs.givewp.com/settings-emails' ), |
|
| 86 | + 'title' => __( 'Email Settings', 'give' ), |
|
| 87 | + 'type' => 'give_docs_link', |
|
| 88 | + ), |
|
| 89 | 89 | array( |
| 90 | 90 | 'id' => 'give_title_email_settings_1', |
| 91 | 91 | 'type' => 'sectionend' |
@@ -118,13 +118,13 @@ discard block |
||
| 118 | 118 | 'type' => 'wysiwyg', |
| 119 | 119 | 'default' => give_get_default_donation_receipt_email() |
| 120 | 120 | ), |
| 121 | - array( |
|
| 122 | - 'name' => esc_html__( 'Donation Receipt Settings Docs Link', 'give' ), |
|
| 123 | - 'id' => 'donation_receipt_settings_docs_link', |
|
| 124 | - 'url' => esc_url( 'http://docs.givewp.com/settings-donation-receipt' ), |
|
| 125 | - 'title' => __( 'Donation Receipt Settings', 'give' ), |
|
| 126 | - 'type' => 'give_docs_link', |
|
| 127 | - ), |
|
| 121 | + array( |
|
| 122 | + 'name' => esc_html__( 'Donation Receipt Settings Docs Link', 'give' ), |
|
| 123 | + 'id' => 'donation_receipt_settings_docs_link', |
|
| 124 | + 'url' => esc_url( 'http://docs.givewp.com/settings-donation-receipt' ), |
|
| 125 | + 'title' => __( 'Donation Receipt Settings', 'give' ), |
|
| 126 | + 'type' => 'give_docs_link', |
|
| 127 | + ), |
|
| 128 | 128 | array( |
| 129 | 129 | 'id' => 'give_title_email_settings_2', |
| 130 | 130 | 'type' => 'sectionend' |
@@ -175,13 +175,13 @@ discard block |
||
| 175 | 175 | 'type' => 'textarea', |
| 176 | 176 | 'default' => get_bloginfo( 'admin_email' ) |
| 177 | 177 | ), |
| 178 | - array( |
|
| 179 | - 'name' => esc_html__( 'Donation Notification Settings Docs Link', 'give' ), |
|
| 180 | - 'id' => 'donation_notification_settings_docs_link', |
|
| 181 | - 'url' => esc_url( 'http://docs.givewp.com/settings-donation-notification' ), |
|
| 182 | - 'title' => __( 'Donation Notification Settings', 'give' ), |
|
| 183 | - 'type' => 'give_docs_link', |
|
| 184 | - ), |
|
| 178 | + array( |
|
| 179 | + 'name' => esc_html__( 'Donation Notification Settings Docs Link', 'give' ), |
|
| 180 | + 'id' => 'donation_notification_settings_docs_link', |
|
| 181 | + 'url' => esc_url( 'http://docs.givewp.com/settings-donation-notification' ), |
|
| 182 | + 'title' => __( 'Donation Notification Settings', 'give' ), |
|
| 183 | + 'type' => 'give_docs_link', |
|
| 184 | + ), |
|
| 185 | 185 | array( |
| 186 | 186 | 'id' => 'give_title_email_settings_3', |
| 187 | 187 | 'type' => 'sectionend' |
@@ -9,11 +9,11 @@ discard block |
||
| 9 | 9 | * @since 1.8 |
| 10 | 10 | */ |
| 11 | 11 | |
| 12 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 12 | +if ( ! defined('ABSPATH')) { |
|
| 13 | 13 | exit; // Exit if accessed directly |
| 14 | 14 | } |
| 15 | 15 | |
| 16 | -if ( ! class_exists( 'Give_Settings_Email' ) ) : |
|
| 16 | +if ( ! class_exists('Give_Settings_Email')) : |
|
| 17 | 17 | |
| 18 | 18 | /** |
| 19 | 19 | * Give_Settings_Email. |
@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | */ |
| 28 | 28 | public function __construct() { |
| 29 | 29 | $this->id = 'emails'; |
| 30 | - $this->label = esc_html__( 'Emails', 'give' ); |
|
| 30 | + $this->label = esc_html__('Emails', 'give'); |
|
| 31 | 31 | |
| 32 | 32 | $this->default_tab = 'email-settings'; |
| 33 | 33 | |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | $settings = array(); |
| 45 | 45 | $current_section = give_get_current_setting_section(); |
| 46 | 46 | |
| 47 | - switch ( $current_section ) { |
|
| 47 | + switch ($current_section) { |
|
| 48 | 48 | case 'email-settings' : |
| 49 | 49 | $settings = array( |
| 50 | 50 | // Section 1: Email |
@@ -54,36 +54,36 @@ discard block |
||
| 54 | 54 | ), |
| 55 | 55 | array( |
| 56 | 56 | 'id' => 'email_template', |
| 57 | - 'name' => esc_html__( 'Email Template', 'give' ), |
|
| 58 | - 'desc' => esc_html__( 'Choose your template from the available registered template types.', 'give' ), |
|
| 57 | + 'name' => esc_html__('Email Template', 'give'), |
|
| 58 | + 'desc' => esc_html__('Choose your template from the available registered template types.', 'give'), |
|
| 59 | 59 | 'type' => 'select', |
| 60 | 60 | 'options' => give_get_email_templates() |
| 61 | 61 | ), |
| 62 | 62 | array( |
| 63 | 63 | 'id' => 'email_logo', |
| 64 | - 'name' => esc_html__( 'Logo', 'give' ), |
|
| 65 | - 'desc' => esc_html__( 'Upload or choose a logo to be displayed at the top of the donation receipt emails. Displayed on HTML emails only.', 'give' ), |
|
| 64 | + 'name' => esc_html__('Logo', 'give'), |
|
| 65 | + 'desc' => esc_html__('Upload or choose a logo to be displayed at the top of the donation receipt emails. Displayed on HTML emails only.', 'give'), |
|
| 66 | 66 | 'type' => 'file' |
| 67 | 67 | ), |
| 68 | 68 | array( |
| 69 | 69 | 'id' => 'from_name', |
| 70 | - 'name' => esc_html__( 'From Name', 'give' ), |
|
| 71 | - 'desc' => esc_html__( 'The name which appears in the "From" field in all Give donation emails.', 'give' ), |
|
| 72 | - 'default' => get_bloginfo( 'name' ), |
|
| 70 | + 'name' => esc_html__('From Name', 'give'), |
|
| 71 | + 'desc' => esc_html__('The name which appears in the "From" field in all Give donation emails.', 'give'), |
|
| 72 | + 'default' => get_bloginfo('name'), |
|
| 73 | 73 | 'type' => 'text' |
| 74 | 74 | ), |
| 75 | 75 | array( |
| 76 | 76 | 'id' => 'from_email', |
| 77 | - 'name' => esc_html__( 'From Email', 'give' ), |
|
| 78 | - 'desc' => esc_html__( 'Email address from which all Give emails are sent from. This will act as the "from" and "reply-to" email address.', 'give' ), |
|
| 79 | - 'default' => get_bloginfo( 'admin_email' ), |
|
| 77 | + 'name' => esc_html__('From Email', 'give'), |
|
| 78 | + 'desc' => esc_html__('Email address from which all Give emails are sent from. This will act as the "from" and "reply-to" email address.', 'give'), |
|
| 79 | + 'default' => get_bloginfo('admin_email'), |
|
| 80 | 80 | 'type' => 'text' |
| 81 | 81 | ), |
| 82 | 82 | array( |
| 83 | - 'name' => esc_html__( 'Email Settings Docs Link', 'give' ), |
|
| 83 | + 'name' => esc_html__('Email Settings Docs Link', 'give'), |
|
| 84 | 84 | 'id' => 'email_settings_docs_link', |
| 85 | - 'url' => esc_url( 'http://docs.givewp.com/settings-emails' ), |
|
| 86 | - 'title' => __( 'Email Settings', 'give' ), |
|
| 85 | + 'url' => esc_url('http://docs.givewp.com/settings-emails'), |
|
| 86 | + 'title' => __('Email Settings', 'give'), |
|
| 87 | 87 | 'type' => 'give_docs_link', |
| 88 | 88 | ), |
| 89 | 89 | array( |
@@ -102,27 +102,27 @@ discard block |
||
| 102 | 102 | ), |
| 103 | 103 | array( |
| 104 | 104 | 'id' => 'donation_subject', |
| 105 | - 'name' => esc_html__( 'Donation Email Subject', 'give' ), |
|
| 106 | - 'desc' => esc_html__( 'Enter the subject line for the donation receipt email.', 'give' ), |
|
| 107 | - 'default' => esc_attr__( 'Donation Receipt', 'give' ), |
|
| 105 | + 'name' => esc_html__('Donation Email Subject', 'give'), |
|
| 106 | + 'desc' => esc_html__('Enter the subject line for the donation receipt email.', 'give'), |
|
| 107 | + 'default' => esc_attr__('Donation Receipt', 'give'), |
|
| 108 | 108 | 'type' => 'text' |
| 109 | 109 | ), |
| 110 | 110 | array( |
| 111 | 111 | 'id' => 'donation_receipt', |
| 112 | - 'name' => esc_html__( 'Donation Receipt', 'give' ), |
|
| 112 | + 'name' => esc_html__('Donation Receipt', 'give'), |
|
| 113 | 113 | 'desc' => sprintf( |
| 114 | 114 | /* translators: %s: emails tags list */ |
| 115 | - __( 'Enter the email that is sent to users after completing a successful donation. HTML is accepted.<br /><strong>Available template tags:</strong> %s', 'give' ), |
|
| 115 | + __('Enter the email that is sent to users after completing a successful donation. HTML is accepted.<br /><strong>Available template tags:</strong> %s', 'give'), |
|
| 116 | 116 | '<br/>'.give_get_emails_tags_list() |
| 117 | 117 | ), |
| 118 | 118 | 'type' => 'wysiwyg', |
| 119 | 119 | 'default' => give_get_default_donation_receipt_email() |
| 120 | 120 | ), |
| 121 | 121 | array( |
| 122 | - 'name' => esc_html__( 'Donation Receipt Settings Docs Link', 'give' ), |
|
| 122 | + 'name' => esc_html__('Donation Receipt Settings Docs Link', 'give'), |
|
| 123 | 123 | 'id' => 'donation_receipt_settings_docs_link', |
| 124 | - 'url' => esc_url( 'http://docs.givewp.com/settings-donation-receipt' ), |
|
| 125 | - 'title' => __( 'Donation Receipt Settings', 'give' ), |
|
| 124 | + 'url' => esc_url('http://docs.givewp.com/settings-donation-receipt'), |
|
| 125 | + 'title' => __('Donation Receipt Settings', 'give'), |
|
| 126 | 126 | 'type' => 'give_docs_link', |
| 127 | 127 | ), |
| 128 | 128 | array( |
@@ -141,28 +141,28 @@ discard block |
||
| 141 | 141 | ), |
| 142 | 142 | array( |
| 143 | 143 | 'id' => 'admin_notices', |
| 144 | - 'name' => esc_html__( 'Admin Notifications', 'give' ), |
|
| 145 | - 'desc' => esc_html__( 'Enable/Disable all admin notifications from Give completely.', 'give' ), |
|
| 144 | + 'name' => esc_html__('Admin Notifications', 'give'), |
|
| 145 | + 'desc' => esc_html__('Enable/Disable all admin notifications from Give completely.', 'give'), |
|
| 146 | 146 | 'type' => 'radio_inline', |
| 147 | 147 | 'default' => 'enabled', |
| 148 | 148 | 'options' => array( |
| 149 | - 'enabled' => __( 'Enabled', 'give' ), |
|
| 150 | - 'disabled' => __( 'Disabled', 'give' ), |
|
| 149 | + 'enabled' => __('Enabled', 'give'), |
|
| 150 | + 'disabled' => __('Disabled', 'give'), |
|
| 151 | 151 | ) |
| 152 | 152 | ), |
| 153 | 153 | array( |
| 154 | 154 | 'id' => 'donation_notification_subject', |
| 155 | - 'name' => esc_html__( 'Donation Notification Subject', 'give' ), |
|
| 156 | - 'desc' => esc_html__( 'Enter the subject line for the admin donation notification email.', 'give' ), |
|
| 155 | + 'name' => esc_html__('Donation Notification Subject', 'give'), |
|
| 156 | + 'desc' => esc_html__('Enter the subject line for the admin donation notification email.', 'give'), |
|
| 157 | 157 | 'type' => 'text', |
| 158 | - 'default' => esc_attr__( 'New Donation - #{payment_id}', 'give' ) |
|
| 158 | + 'default' => esc_attr__('New Donation - #{payment_id}', 'give') |
|
| 159 | 159 | ), |
| 160 | 160 | array( |
| 161 | 161 | 'id' => 'donation_notification', |
| 162 | - 'name' => esc_html__( 'Donation Notification', 'give' ), |
|
| 162 | + 'name' => esc_html__('Donation Notification', 'give'), |
|
| 163 | 163 | 'desc' => sprintf( |
| 164 | 164 | /* translators: %s: emails tags list */ |
| 165 | - __( 'Enter the content of the email that is sent to notify an admin of a new donation. HTML is accepted. <br /><strong>Available template tags:</strong> %s', 'give' ), |
|
| 165 | + __('Enter the content of the email that is sent to notify an admin of a new donation. HTML is accepted. <br /><strong>Available template tags:</strong> %s', 'give'), |
|
| 166 | 166 | '<br/>'.give_get_emails_tags_list() |
| 167 | 167 | ), |
| 168 | 168 | 'type' => 'wysiwyg', |
@@ -170,16 +170,16 @@ discard block |
||
| 170 | 170 | ), |
| 171 | 171 | array( |
| 172 | 172 | 'id' => 'admin_notice_emails', |
| 173 | - 'name' => esc_html__( 'Donation Notification Emails', 'give' ), |
|
| 174 | - 'desc' => __( 'Enter the email address(es) that should receive a notification anytime a donation is made, please only enter <span class="give-underline">one email address per line</span> and <strong>not separated by commas</strong>.', 'give' ), |
|
| 173 | + 'name' => esc_html__('Donation Notification Emails', 'give'), |
|
| 174 | + 'desc' => __('Enter the email address(es) that should receive a notification anytime a donation is made, please only enter <span class="give-underline">one email address per line</span> and <strong>not separated by commas</strong>.', 'give'), |
|
| 175 | 175 | 'type' => 'textarea', |
| 176 | - 'default' => get_bloginfo( 'admin_email' ) |
|
| 176 | + 'default' => get_bloginfo('admin_email') |
|
| 177 | 177 | ), |
| 178 | 178 | array( |
| 179 | - 'name' => esc_html__( 'Donation Notification Settings Docs Link', 'give' ), |
|
| 179 | + 'name' => esc_html__('Donation Notification Settings Docs Link', 'give'), |
|
| 180 | 180 | 'id' => 'donation_notification_settings_docs_link', |
| 181 | - 'url' => esc_url( 'http://docs.givewp.com/settings-donation-notification' ), |
|
| 182 | - 'title' => __( 'Donation Notification Settings', 'give' ), |
|
| 181 | + 'url' => esc_url('http://docs.givewp.com/settings-donation-notification'), |
|
| 182 | + 'title' => __('Donation Notification Settings', 'give'), |
|
| 183 | 183 | 'type' => 'give_docs_link', |
| 184 | 184 | ), |
| 185 | 185 | array( |
@@ -194,7 +194,7 @@ discard block |
||
| 194 | 194 | * Filter the emails settings. |
| 195 | 195 | * Backward compatibility: Please do not use this filter. This filter is deprecated in 1.8 |
| 196 | 196 | */ |
| 197 | - $settings = apply_filters( 'give_settings_emails', $settings ); |
|
| 197 | + $settings = apply_filters('give_settings_emails', $settings); |
|
| 198 | 198 | |
| 199 | 199 | /** |
| 200 | 200 | * Filter the settings. |
@@ -202,7 +202,7 @@ discard block |
||
| 202 | 202 | * @since 1.8 |
| 203 | 203 | * @param array $settings |
| 204 | 204 | */ |
| 205 | - $settings = apply_filters( 'give_get_settings_' . $this->id, $settings ); |
|
| 205 | + $settings = apply_filters('give_get_settings_'.$this->id, $settings); |
|
| 206 | 206 | |
| 207 | 207 | // Output. |
| 208 | 208 | return $settings; |
@@ -216,12 +216,12 @@ discard block |
||
| 216 | 216 | */ |
| 217 | 217 | public function get_sections() { |
| 218 | 218 | $sections = array( |
| 219 | - 'email-settings' => esc_html__( 'Email Settings', 'give' ), |
|
| 220 | - 'donation-receipt' => esc_html__( 'Donation Receipt', 'give' ), |
|
| 221 | - 'new-donation-notification' => esc_html__( 'New Donation Notification', 'give' ) |
|
| 219 | + 'email-settings' => esc_html__('Email Settings', 'give'), |
|
| 220 | + 'donation-receipt' => esc_html__('Donation Receipt', 'give'), |
|
| 221 | + 'new-donation-notification' => esc_html__('New Donation Notification', 'give') |
|
| 222 | 222 | ); |
| 223 | 223 | |
| 224 | - return apply_filters( 'give_get_sections_' . $this->id, $sections ); |
|
| 224 | + return apply_filters('give_get_sections_'.$this->id, $sections); |
|
| 225 | 225 | } |
| 226 | 226 | } |
| 227 | 227 | |
@@ -10,7 +10,7 @@ discard block |
||
| 10 | 10 | */ |
| 11 | 11 | |
| 12 | 12 | // Exit if accessed directly. |
| 13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 13 | +if ( ! defined('ABSPATH')) { |
|
| 14 | 14 | exit; |
| 15 | 15 | } |
| 16 | 16 | |
@@ -21,9 +21,9 @@ discard block |
||
| 21 | 21 | */ |
| 22 | 22 | public function __construct() { |
| 23 | 23 | |
| 24 | - $this->shortcode['label'] = esc_html__( 'Profile Editor', 'give' ); |
|
| 24 | + $this->shortcode['label'] = esc_html__('Profile Editor', 'give'); |
|
| 25 | 25 | |
| 26 | - parent::__construct( 'give_profile_editor' ); |
|
| 26 | + parent::__construct('give_profile_editor'); |
|
| 27 | 27 | } |
| 28 | 28 | } |
| 29 | 29 | |
@@ -10,7 +10,7 @@ discard block |
||
| 10 | 10 | */ |
| 11 | 11 | |
| 12 | 12 | // Exit if accessed directly. |
| 13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 13 | +if ( ! defined('ABSPATH')) { |
|
| 14 | 14 | exit; |
| 15 | 15 | } |
| 16 | 16 | |
@@ -24,10 +24,10 @@ discard block |
||
| 24 | 24 | */ |
| 25 | 25 | public function __construct() { |
| 26 | 26 | |
| 27 | - $this->shortcode['title'] = esc_html__( 'Donation Receipt', 'give' ); |
|
| 28 | - $this->shortcode['label'] = esc_html__( 'Donation Receipt', 'give' ); |
|
| 27 | + $this->shortcode['title'] = esc_html__('Donation Receipt', 'give'); |
|
| 28 | + $this->shortcode['label'] = esc_html__('Donation Receipt', 'give'); |
|
| 29 | 29 | |
| 30 | - parent::__construct( 'give_receipt' ); |
|
| 30 | + parent::__construct('give_receipt'); |
|
| 31 | 31 | } |
| 32 | 32 | |
| 33 | 33 | /** |
@@ -40,60 +40,60 @@ discard block |
||
| 40 | 40 | return array( |
| 41 | 41 | array( |
| 42 | 42 | 'type' => 'container', |
| 43 | - 'html' => sprintf( '<p class="strong">%s</p>', esc_html__( 'Optional settings', 'give' ) ), |
|
| 43 | + 'html' => sprintf('<p class="strong">%s</p>', esc_html__('Optional settings', 'give')), |
|
| 44 | 44 | ), |
| 45 | 45 | array( |
| 46 | 46 | 'type' => 'listbox', |
| 47 | 47 | 'name' => 'price', |
| 48 | - 'label' => esc_html__( 'Show Donation Amount:', 'give' ), |
|
| 48 | + 'label' => esc_html__('Show Donation Amount:', 'give'), |
|
| 49 | 49 | 'options' => array( |
| 50 | - 'true' => esc_html__( 'Show', 'give' ), |
|
| 51 | - 'false' => esc_html__( 'Hide', 'give' ), |
|
| 50 | + 'true' => esc_html__('Show', 'give'), |
|
| 51 | + 'false' => esc_html__('Hide', 'give'), |
|
| 52 | 52 | ), |
| 53 | 53 | ), |
| 54 | 54 | array( |
| 55 | 55 | 'type' => 'listbox', |
| 56 | 56 | 'name' => 'donor', |
| 57 | - 'label' => esc_html__( 'Show Donor Name:', 'give' ), |
|
| 57 | + 'label' => esc_html__('Show Donor Name:', 'give'), |
|
| 58 | 58 | 'options' => array( |
| 59 | - 'true' => esc_html__( 'Show', 'give' ), |
|
| 60 | - 'false' => esc_html__( 'Hide', 'give' ), |
|
| 59 | + 'true' => esc_html__('Show', 'give'), |
|
| 60 | + 'false' => esc_html__('Hide', 'give'), |
|
| 61 | 61 | ), |
| 62 | 62 | ), |
| 63 | 63 | array( |
| 64 | 64 | 'type' => 'listbox', |
| 65 | 65 | 'name' => 'date', |
| 66 | - 'label' => esc_html__( 'Show Date:', 'give' ), |
|
| 66 | + 'label' => esc_html__('Show Date:', 'give'), |
|
| 67 | 67 | 'options' => array( |
| 68 | - 'true' => esc_html__( 'Show', 'give' ), |
|
| 69 | - 'false' => esc_html__( 'Hide', 'give' ), |
|
| 68 | + 'true' => esc_html__('Show', 'give'), |
|
| 69 | + 'false' => esc_html__('Hide', 'give'), |
|
| 70 | 70 | ), |
| 71 | 71 | ), |
| 72 | 72 | array( |
| 73 | 73 | 'type' => 'listbox', |
| 74 | 74 | 'name' => 'payment_key', |
| 75 | - 'label' => esc_html__( 'Show Payment Key:', 'give' ), |
|
| 75 | + 'label' => esc_html__('Show Payment Key:', 'give'), |
|
| 76 | 76 | 'options' => array( |
| 77 | - 'true' => esc_html__( 'Show', 'give' ), |
|
| 78 | - 'false' => esc_html__( 'Hide', 'give' ), |
|
| 77 | + 'true' => esc_html__('Show', 'give'), |
|
| 78 | + 'false' => esc_html__('Hide', 'give'), |
|
| 79 | 79 | ), |
| 80 | 80 | ), |
| 81 | 81 | array( |
| 82 | 82 | 'type' => 'listbox', |
| 83 | 83 | 'name' => 'payment_method', |
| 84 | - 'label' => esc_html__( 'Show Payment Method:', 'give' ), |
|
| 84 | + 'label' => esc_html__('Show Payment Method:', 'give'), |
|
| 85 | 85 | 'options' => array( |
| 86 | - 'true' => esc_html__( 'Show', 'give' ), |
|
| 87 | - 'false' => esc_html__( 'Hide', 'give' ), |
|
| 86 | + 'true' => esc_html__('Show', 'give'), |
|
| 87 | + 'false' => esc_html__('Hide', 'give'), |
|
| 88 | 88 | ), |
| 89 | 89 | ), |
| 90 | 90 | array( |
| 91 | 91 | 'type' => 'listbox', |
| 92 | 92 | 'name' => 'payment_id', |
| 93 | - 'label' => esc_html__( 'Show Payment ID:', 'give' ), |
|
| 93 | + 'label' => esc_html__('Show Payment ID:', 'give'), |
|
| 94 | 94 | 'options' => array( |
| 95 | - 'true' => esc_html__( 'Show', 'give' ), |
|
| 96 | - 'false' => esc_html__( 'Hide', 'give' ), |
|
| 95 | + 'true' => esc_html__('Show', 'give'), |
|
| 96 | + 'false' => esc_html__('Hide', 'give'), |
|
| 97 | 97 | ), |
| 98 | 98 | ), |
| 99 | 99 | ); |
@@ -10,7 +10,7 @@ discard block |
||
| 10 | 10 | */ |
| 11 | 11 | |
| 12 | 12 | // Exit if accessed directly. |
| 13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 13 | +if ( ! defined('ABSPATH')) { |
|
| 14 | 14 | exit; |
| 15 | 15 | } |
| 16 | 16 | |
@@ -21,10 +21,10 @@ discard block |
||
| 21 | 21 | */ |
| 22 | 22 | public function __construct() { |
| 23 | 23 | |
| 24 | - $this->shortcode['title'] = esc_html__( 'Register', 'give' ); |
|
| 25 | - $this->shortcode['label'] = esc_html__( 'Register', 'give' ); |
|
| 24 | + $this->shortcode['title'] = esc_html__('Register', 'give'); |
|
| 25 | + $this->shortcode['label'] = esc_html__('Register', 'give'); |
|
| 26 | 26 | |
| 27 | - parent::__construct( 'give_register' ); |
|
| 27 | + parent::__construct('give_register'); |
|
| 28 | 28 | } |
| 29 | 29 | |
| 30 | 30 | /** |
@@ -37,13 +37,13 @@ discard block |
||
| 37 | 37 | return array( |
| 38 | 38 | array( |
| 39 | 39 | 'type' => 'container', |
| 40 | - 'html' => sprintf( '<p class="no-margin">%s</p>', esc_html__( 'Redirect URL (optional):', 'give' ) ), |
|
| 40 | + 'html' => sprintf('<p class="no-margin">%s</p>', esc_html__('Redirect URL (optional):', 'give')), |
|
| 41 | 41 | ), |
| 42 | 42 | array( |
| 43 | 43 | 'type' => 'textbox', |
| 44 | 44 | 'name' => 'redirect', |
| 45 | 45 | 'minWidth' => 320, |
| 46 | - 'tooltip' => esc_attr__( 'Enter an URL here to redirect to after registering.', 'give' ), |
|
| 46 | + 'tooltip' => esc_attr__('Enter an URL here to redirect to after registering.', 'give'), |
|
| 47 | 47 | ), |
| 48 | 48 | ); |
| 49 | 49 | } |
@@ -10,7 +10,7 @@ discard block |
||
| 10 | 10 | */ |
| 11 | 11 | |
| 12 | 12 | // Exit if accessed directly. |
| 13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 13 | +if ( ! defined('ABSPATH')) { |
|
| 14 | 14 | exit; |
| 15 | 15 | } |
| 16 | 16 | |
@@ -21,9 +21,9 @@ discard block |
||
| 21 | 21 | */ |
| 22 | 22 | public function __construct() { |
| 23 | 23 | |
| 24 | - $this->shortcode['label'] = esc_html__( 'Donation History', 'give' ); |
|
| 24 | + $this->shortcode['label'] = esc_html__('Donation History', 'give'); |
|
| 25 | 25 | |
| 26 | - parent::__construct( 'donation_history' ); |
|
| 26 | + parent::__construct('donation_history'); |
|
| 27 | 27 | } |
| 28 | 28 | } |
| 29 | 29 | |
@@ -111,14 +111,14 @@ discard block |
||
| 111 | 111 | * @since 1.0 |
| 112 | 112 | * @access public |
| 113 | 113 | * |
| 114 | - * @param int $column Column ID. |
|
| 115 | - * @param int $row_id Row ID. |
|
| 116 | - * |
|
| 117 | - * @return object |
|
| 114 | + * @param int $column Column ID. |
|
| 115 | + * @param int $row_id Row ID. |
|
| 116 | + * |
|
| 117 | + * @return object |
|
| 118 | 118 | */ |
| 119 | 119 | public function get_by( $column, $row_id ) { |
| 120 | - /* @var WPDB $wpdb */ |
|
| 121 | - global $wpdb; |
|
| 120 | + /* @var WPDB $wpdb */ |
|
| 121 | + global $wpdb; |
|
| 122 | 122 | |
| 123 | 123 | $column = esc_sql( $column ); |
| 124 | 124 | return $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $this->table_name WHERE $column = %s LIMIT 1;", $row_id ) ); |
@@ -129,15 +129,15 @@ discard block |
||
| 129 | 129 | * |
| 130 | 130 | * @since 1.0 |
| 131 | 131 | * @access public |
| 132 | - * |
|
| 133 | - * @param int $column Column ID. |
|
| 134 | - * @param int $row_id Row ID. |
|
| 135 | - * |
|
| 132 | + * |
|
| 133 | + * @param int $column Column ID. |
|
| 134 | + * @param int $row_id Row ID. |
|
| 135 | + * |
|
| 136 | 136 | * @return string Column value. |
| 137 | 137 | */ |
| 138 | 138 | public function get_column( $column, $row_id ) { |
| 139 | - /* @var WPDB $wpdb */ |
|
| 140 | - global $wpdb; |
|
| 139 | + /* @var WPDB $wpdb */ |
|
| 140 | + global $wpdb; |
|
| 141 | 141 | |
| 142 | 142 | $column = esc_sql( $column ); |
| 143 | 143 | return $wpdb->get_var( $wpdb->prepare( "SELECT $column FROM $this->table_name WHERE $this->primary_key = %s LIMIT 1;", $row_id ) ); |
@@ -148,16 +148,16 @@ discard block |
||
| 148 | 148 | * |
| 149 | 149 | * @since 1.0 |
| 150 | 150 | * @access public |
| 151 | - * |
|
| 152 | - * @param int $column Column ID. |
|
| 153 | - * @param string $column_where Column name. |
|
| 154 | - * @param string $column_value Column value. |
|
| 155 | - * |
|
| 151 | + * |
|
| 152 | + * @param int $column Column ID. |
|
| 153 | + * @param string $column_where Column name. |
|
| 154 | + * @param string $column_value Column value. |
|
| 155 | + * |
|
| 156 | 156 | * @return string |
| 157 | 157 | */ |
| 158 | 158 | public function get_column_by( $column, $column_where, $column_value ) { |
| 159 | - /* @var WPDB $wpdb */ |
|
| 160 | - global $wpdb; |
|
| 159 | + /* @var WPDB $wpdb */ |
|
| 160 | + global $wpdb; |
|
| 161 | 161 | |
| 162 | 162 | $column_where = esc_sql( $column_where ); |
| 163 | 163 | $column = esc_sql( $column ); |
@@ -169,15 +169,15 @@ discard block |
||
| 169 | 169 | * |
| 170 | 170 | * @since 1.0 |
| 171 | 171 | * @access public |
| 172 | - * |
|
| 173 | - * @param array $data |
|
| 174 | - * @param string $type |
|
| 175 | - * |
|
| 172 | + * |
|
| 173 | + * @param array $data |
|
| 174 | + * @param string $type |
|
| 175 | + * |
|
| 176 | 176 | * @return int |
| 177 | 177 | */ |
| 178 | 178 | public function insert( $data, $type = '' ) { |
| 179 | - /* @var WPDB $wpdb */ |
|
| 180 | - global $wpdb; |
|
| 179 | + /* @var WPDB $wpdb */ |
|
| 180 | + global $wpdb; |
|
| 181 | 181 | |
| 182 | 182 | // Set default values. |
| 183 | 183 | $data = wp_parse_args( $data, $this->get_column_defaults() ); |
@@ -224,16 +224,16 @@ discard block |
||
| 224 | 224 | * |
| 225 | 225 | * @since 1.0 |
| 226 | 226 | * @access public |
| 227 | - * |
|
| 228 | - * @param int $row_id Column ID |
|
| 229 | - * @param array $data |
|
| 230 | - * @param string $where Column value |
|
| 231 | - * |
|
| 227 | + * |
|
| 228 | + * @param int $row_id Column ID |
|
| 229 | + * @param array $data |
|
| 230 | + * @param string $where Column value |
|
| 231 | + * |
|
| 232 | 232 | * @return bool |
| 233 | 233 | */ |
| 234 | 234 | public function update( $row_id, $data = array(), $where = '' ) { |
| 235 | - /* @var WPDB $wpdb */ |
|
| 236 | - global $wpdb; |
|
| 235 | + /* @var WPDB $wpdb */ |
|
| 236 | + global $wpdb; |
|
| 237 | 237 | |
| 238 | 238 | // Row ID must be positive integer |
| 239 | 239 | $row_id = absint( $row_id ); |
@@ -271,14 +271,14 @@ discard block |
||
| 271 | 271 | * |
| 272 | 272 | * @since 1.0 |
| 273 | 273 | * @access public |
| 274 | - * |
|
| 275 | - * @param int $row_id Column ID. |
|
| 276 | - * |
|
| 274 | + * |
|
| 275 | + * @param int $row_id Column ID. |
|
| 276 | + * |
|
| 277 | 277 | * @return bool |
| 278 | 278 | */ |
| 279 | 279 | public function delete( $row_id = 0 ) { |
| 280 | - /* @var WPDB $wpdb */ |
|
| 281 | - global $wpdb; |
|
| 280 | + /* @var WPDB $wpdb */ |
|
| 281 | + global $wpdb; |
|
| 282 | 282 | |
| 283 | 283 | // Row ID must be positive integer |
| 284 | 284 | $row_id = absint( $row_id ); |
@@ -299,13 +299,13 @@ discard block |
||
| 299 | 299 | * |
| 300 | 300 | * @since 1.3.2 |
| 301 | 301 | * @access public |
| 302 | - * |
|
| 302 | + * |
|
| 303 | 303 | * @param string $table The table name. |
| 304 | - * |
|
| 304 | + * |
|
| 305 | 305 | * @return bool If the table name exists. |
| 306 | 306 | */ |
| 307 | 307 | public function table_exists( $table ) { |
| 308 | - /* @var WPDB $wpdb */ |
|
| 308 | + /* @var WPDB $wpdb */ |
|
| 309 | 309 | global $wpdb; |
| 310 | 310 | |
| 311 | 311 | $table = sanitize_text_field( $table ); |
@@ -10,7 +10,7 @@ discard block |
||
| 10 | 10 | */ |
| 11 | 11 | |
| 12 | 12 | // Exit if accessed directly. |
| 13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 13 | +if ( ! defined('ABSPATH')) { |
|
| 14 | 14 | exit; |
| 15 | 15 | } |
| 16 | 16 | |
@@ -98,11 +98,11 @@ discard block |
||
| 98 | 98 | * |
| 99 | 99 | * @return object |
| 100 | 100 | */ |
| 101 | - public function get( $row_id ) { |
|
| 101 | + public function get($row_id) { |
|
| 102 | 102 | /* @var WPDB $wpdb */ |
| 103 | 103 | global $wpdb; |
| 104 | 104 | |
| 105 | - return $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $this->table_name WHERE $this->primary_key = %s LIMIT 1;", $row_id ) ); |
|
| 105 | + return $wpdb->get_row($wpdb->prepare("SELECT * FROM $this->table_name WHERE $this->primary_key = %s LIMIT 1;", $row_id)); |
|
| 106 | 106 | } |
| 107 | 107 | |
| 108 | 108 | /** |
@@ -116,12 +116,12 @@ discard block |
||
| 116 | 116 | * |
| 117 | 117 | * @return object |
| 118 | 118 | */ |
| 119 | - public function get_by( $column, $row_id ) { |
|
| 119 | + public function get_by($column, $row_id) { |
|
| 120 | 120 | /* @var WPDB $wpdb */ |
| 121 | 121 | global $wpdb; |
| 122 | 122 | |
| 123 | - $column = esc_sql( $column ); |
|
| 124 | - return $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $this->table_name WHERE $column = %s LIMIT 1;", $row_id ) ); |
|
| 123 | + $column = esc_sql($column); |
|
| 124 | + return $wpdb->get_row($wpdb->prepare("SELECT * FROM $this->table_name WHERE $column = %s LIMIT 1;", $row_id)); |
|
| 125 | 125 | } |
| 126 | 126 | |
| 127 | 127 | /** |
@@ -135,12 +135,12 @@ discard block |
||
| 135 | 135 | * |
| 136 | 136 | * @return string Column value. |
| 137 | 137 | */ |
| 138 | - public function get_column( $column, $row_id ) { |
|
| 138 | + public function get_column($column, $row_id) { |
|
| 139 | 139 | /* @var WPDB $wpdb */ |
| 140 | 140 | global $wpdb; |
| 141 | 141 | |
| 142 | - $column = esc_sql( $column ); |
|
| 143 | - return $wpdb->get_var( $wpdb->prepare( "SELECT $column FROM $this->table_name WHERE $this->primary_key = %s LIMIT 1;", $row_id ) ); |
|
| 142 | + $column = esc_sql($column); |
|
| 143 | + return $wpdb->get_var($wpdb->prepare("SELECT $column FROM $this->table_name WHERE $this->primary_key = %s LIMIT 1;", $row_id)); |
|
| 144 | 144 | } |
| 145 | 145 | |
| 146 | 146 | /** |
@@ -155,13 +155,13 @@ discard block |
||
| 155 | 155 | * |
| 156 | 156 | * @return string |
| 157 | 157 | */ |
| 158 | - public function get_column_by( $column, $column_where, $column_value ) { |
|
| 158 | + public function get_column_by($column, $column_where, $column_value) { |
|
| 159 | 159 | /* @var WPDB $wpdb */ |
| 160 | 160 | global $wpdb; |
| 161 | 161 | |
| 162 | - $column_where = esc_sql( $column_where ); |
|
| 163 | - $column = esc_sql( $column ); |
|
| 164 | - return $wpdb->get_var( $wpdb->prepare( "SELECT $column FROM $this->table_name WHERE $column_where = %s LIMIT 1;", $column_value ) ); |
|
| 162 | + $column_where = esc_sql($column_where); |
|
| 163 | + $column = esc_sql($column); |
|
| 164 | + return $wpdb->get_var($wpdb->prepare("SELECT $column FROM $this->table_name WHERE $column_where = %s LIMIT 1;", $column_value)); |
|
| 165 | 165 | } |
| 166 | 166 | |
| 167 | 167 | /** |
@@ -175,12 +175,12 @@ discard block |
||
| 175 | 175 | * |
| 176 | 176 | * @return int |
| 177 | 177 | */ |
| 178 | - public function insert( $data, $type = '' ) { |
|
| 178 | + public function insert($data, $type = '') { |
|
| 179 | 179 | /* @var WPDB $wpdb */ |
| 180 | 180 | global $wpdb; |
| 181 | 181 | |
| 182 | 182 | // Set default values. |
| 183 | - $data = wp_parse_args( $data, $this->get_column_defaults() ); |
|
| 183 | + $data = wp_parse_args($data, $this->get_column_defaults()); |
|
| 184 | 184 | |
| 185 | 185 | /** |
| 186 | 186 | * Fires before inserting data to the database. |
@@ -189,22 +189,22 @@ discard block |
||
| 189 | 189 | * |
| 190 | 190 | * @param array $data |
| 191 | 191 | */ |
| 192 | - do_action( "give_pre_insert_{$type}", $data ); |
|
| 192 | + do_action("give_pre_insert_{$type}", $data); |
|
| 193 | 193 | |
| 194 | 194 | // Initialise column format array |
| 195 | 195 | $column_formats = $this->get_columns(); |
| 196 | 196 | |
| 197 | 197 | // Force fields to lower case |
| 198 | - $data = array_change_key_case( $data ); |
|
| 198 | + $data = array_change_key_case($data); |
|
| 199 | 199 | |
| 200 | 200 | // White list columns |
| 201 | - $data = array_intersect_key( $data, $column_formats ); |
|
| 201 | + $data = array_intersect_key($data, $column_formats); |
|
| 202 | 202 | |
| 203 | 203 | // Reorder $column_formats to match the order of columns given in $data |
| 204 | - $data_keys = array_keys( $data ); |
|
| 205 | - $column_formats = array_merge( array_flip( $data_keys ), $column_formats ); |
|
| 204 | + $data_keys = array_keys($data); |
|
| 205 | + $column_formats = array_merge(array_flip($data_keys), $column_formats); |
|
| 206 | 206 | |
| 207 | - $wpdb->insert( $this->table_name, $data, $column_formats ); |
|
| 207 | + $wpdb->insert($this->table_name, $data, $column_formats); |
|
| 208 | 208 | |
| 209 | 209 | /** |
| 210 | 210 | * Fires after inserting data to the database. |
@@ -214,7 +214,7 @@ discard block |
||
| 214 | 214 | * @param int $insert_id |
| 215 | 215 | * @param array $data |
| 216 | 216 | */ |
| 217 | - do_action( "give_post_insert_{$type}", $wpdb->insert_id, $data ); |
|
| 217 | + do_action("give_post_insert_{$type}", $wpdb->insert_id, $data); |
|
| 218 | 218 | |
| 219 | 219 | return $wpdb->insert_id; |
| 220 | 220 | } |
@@ -231,18 +231,18 @@ discard block |
||
| 231 | 231 | * |
| 232 | 232 | * @return bool |
| 233 | 233 | */ |
| 234 | - public function update( $row_id, $data = array(), $where = '' ) { |
|
| 234 | + public function update($row_id, $data = array(), $where = '') { |
|
| 235 | 235 | /* @var WPDB $wpdb */ |
| 236 | 236 | global $wpdb; |
| 237 | 237 | |
| 238 | 238 | // Row ID must be positive integer |
| 239 | - $row_id = absint( $row_id ); |
|
| 239 | + $row_id = absint($row_id); |
|
| 240 | 240 | |
| 241 | - if ( empty( $row_id ) ) { |
|
| 241 | + if (empty($row_id)) { |
|
| 242 | 242 | return false; |
| 243 | 243 | } |
| 244 | 244 | |
| 245 | - if ( empty( $where ) ) { |
|
| 245 | + if (empty($where)) { |
|
| 246 | 246 | $where = $this->primary_key; |
| 247 | 247 | } |
| 248 | 248 | |
@@ -250,16 +250,16 @@ discard block |
||
| 250 | 250 | $column_formats = $this->get_columns(); |
| 251 | 251 | |
| 252 | 252 | // Force fields to lower case |
| 253 | - $data = array_change_key_case( $data ); |
|
| 253 | + $data = array_change_key_case($data); |
|
| 254 | 254 | |
| 255 | 255 | // White list columns |
| 256 | - $data = array_intersect_key( $data, $column_formats ); |
|
| 256 | + $data = array_intersect_key($data, $column_formats); |
|
| 257 | 257 | |
| 258 | 258 | // Reorder $column_formats to match the order of columns given in $data |
| 259 | - $data_keys = array_keys( $data ); |
|
| 260 | - $column_formats = array_merge( array_flip( $data_keys ), $column_formats ); |
|
| 259 | + $data_keys = array_keys($data); |
|
| 260 | + $column_formats = array_merge(array_flip($data_keys), $column_formats); |
|
| 261 | 261 | |
| 262 | - if ( false === $wpdb->update( $this->table_name, $data, array( $where => $row_id ), $column_formats ) ) { |
|
| 262 | + if (false === $wpdb->update($this->table_name, $data, array($where => $row_id), $column_formats)) { |
|
| 263 | 263 | return false; |
| 264 | 264 | } |
| 265 | 265 | |
@@ -276,18 +276,18 @@ discard block |
||
| 276 | 276 | * |
| 277 | 277 | * @return bool |
| 278 | 278 | */ |
| 279 | - public function delete( $row_id = 0 ) { |
|
| 279 | + public function delete($row_id = 0) { |
|
| 280 | 280 | /* @var WPDB $wpdb */ |
| 281 | 281 | global $wpdb; |
| 282 | 282 | |
| 283 | 283 | // Row ID must be positive integer |
| 284 | - $row_id = absint( $row_id ); |
|
| 284 | + $row_id = absint($row_id); |
|
| 285 | 285 | |
| 286 | - if ( empty( $row_id ) ) { |
|
| 286 | + if (empty($row_id)) { |
|
| 287 | 287 | return false; |
| 288 | 288 | } |
| 289 | 289 | |
| 290 | - if ( false === $wpdb->query( $wpdb->prepare( "DELETE FROM $this->table_name WHERE $this->primary_key = %d", $row_id ) ) ) { |
|
| 290 | + if (false === $wpdb->query($wpdb->prepare("DELETE FROM $this->table_name WHERE $this->primary_key = %d", $row_id))) { |
|
| 291 | 291 | return false; |
| 292 | 292 | } |
| 293 | 293 | |
@@ -304,13 +304,13 @@ discard block |
||
| 304 | 304 | * |
| 305 | 305 | * @return bool If the table name exists. |
| 306 | 306 | */ |
| 307 | - public function table_exists( $table ) { |
|
| 307 | + public function table_exists($table) { |
|
| 308 | 308 | /* @var WPDB $wpdb */ |
| 309 | 309 | global $wpdb; |
| 310 | 310 | |
| 311 | - $table = sanitize_text_field( $table ); |
|
| 311 | + $table = sanitize_text_field($table); |
|
| 312 | 312 | |
| 313 | - return $wpdb->get_var( $wpdb->prepare( "SHOW TABLES LIKE '%s'", $table ) ) === $table; |
|
| 313 | + return $wpdb->get_var($wpdb->prepare("SHOW TABLES LIKE '%s'", $table)) === $table; |
|
| 314 | 314 | } |
| 315 | 315 | |
| 316 | 316 | /** |
@@ -322,7 +322,7 @@ discard block |
||
| 322 | 322 | * @return bool Returns if the customers table was installed and upgrade routine run. |
| 323 | 323 | */ |
| 324 | 324 | public function installed() { |
| 325 | - return $this->table_exists( $this->table_name ); |
|
| 325 | + return $this->table_exists($this->table_name); |
|
| 326 | 326 | } |
| 327 | 327 | |
| 328 | 328 | /** |
@@ -332,8 +332,8 @@ discard block |
||
| 332 | 332 | * @access public |
| 333 | 333 | */ |
| 334 | 334 | public function register_table() { |
| 335 | - $current_version = get_option( $this->table_name . '_db_version' ); |
|
| 336 | - if ( ! $current_version || version_compare( $current_version, $this->version, '<' ) ) { |
|
| 335 | + $current_version = get_option($this->table_name.'_db_version'); |
|
| 336 | + if ( ! $current_version || version_compare($current_version, $this->version, '<')) { |
|
| 337 | 337 | $this->create_table(); |
| 338 | 338 | } |
| 339 | 339 | } |
@@ -344,5 +344,5 @@ discard block |
||
| 344 | 344 | * @since 1.8.9 |
| 345 | 345 | * @access public |
| 346 | 346 | */ |
| 347 | - public function create_table(){} |
|
| 347 | + public function create_table() {} |
|
| 348 | 348 | } |
@@ -10,7 +10,7 @@ |
||
| 10 | 10 | */ |
| 11 | 11 | |
| 12 | 12 | // Exit if accessed directly. |
| 13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 13 | +if ( ! defined('ABSPATH')) { |
|
| 14 | 14 | exit; |
| 15 | 15 | } |
| 16 | 16 | |