@@ -4,7 +4,7 @@ discard block |
||
4 | 4 | * |
5 | 5 | */ |
6 | 6 | |
7 | -defined( 'ABSPATH' ) || exit; |
|
7 | +defined('ABSPATH') || exit; |
|
8 | 8 | |
9 | 9 | /** |
10 | 10 | * Manual Payment Gateway class. |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | * |
25 | 25 | * @var array |
26 | 26 | */ |
27 | - protected $supports = array( 'subscription', 'addons', 'single_subscription_group', 'multiple_subscription_groups' ); |
|
27 | + protected $supports = array('subscription', 'addons', 'single_subscription_group', 'multiple_subscription_groups'); |
|
28 | 28 | |
29 | 29 | /** |
30 | 30 | * Payment method order. |
@@ -39,10 +39,10 @@ discard block |
||
39 | 39 | public function __construct() { |
40 | 40 | parent::__construct(); |
41 | 41 | |
42 | - $this->title = __( 'Test Gateway', 'invoicing' ); |
|
43 | - $this->method_title = __( 'Test Gateway', 'invoicing' ); |
|
42 | + $this->title = __('Test Gateway', 'invoicing'); |
|
43 | + $this->method_title = __('Test Gateway', 'invoicing'); |
|
44 | 44 | |
45 | - add_action( 'getpaid_should_renew_subscription', array( $this, 'maybe_renew_subscription' ) ); |
|
45 | + add_action('getpaid_should_renew_subscription', array($this, 'maybe_renew_subscription')); |
|
46 | 46 | } |
47 | 47 | |
48 | 48 | /** |
@@ -54,25 +54,25 @@ discard block |
||
54 | 54 | * @param GetPaid_Payment_Form_Submission $submission Checkout submission. |
55 | 55 | * @return array |
56 | 56 | */ |
57 | - public function process_payment( $invoice, $submission_data, $submission ) { |
|
57 | + public function process_payment($invoice, $submission_data, $submission) { |
|
58 | 58 | |
59 | 59 | // Mark it as paid. |
60 | 60 | $invoice->mark_paid(); |
61 | 61 | |
62 | 62 | // (Maybe) activate subscriptions. |
63 | - $subscriptions = getpaid_get_invoice_subscriptions( $invoice ); |
|
63 | + $subscriptions = getpaid_get_invoice_subscriptions($invoice); |
|
64 | 64 | |
65 | - if ( ! empty( $subscriptions ) ) { |
|
66 | - $subscriptions = is_array( $subscriptions ) ? $subscriptions : array( $subscriptions ); |
|
65 | + if (!empty($subscriptions)) { |
|
66 | + $subscriptions = is_array($subscriptions) ? $subscriptions : array($subscriptions); |
|
67 | 67 | |
68 | - foreach ( $subscriptions as $subscription ) { |
|
69 | - if ( $subscription->exists() ) { |
|
70 | - $duration = strtotime( $subscription->get_expiration() ) - strtotime( $subscription->get_date_created() ); |
|
71 | - $expiry = date( 'Y-m-d H:i:s', ( current_time( 'timestamp' ) + $duration ) ); |
|
68 | + foreach ($subscriptions as $subscription) { |
|
69 | + if ($subscription->exists()) { |
|
70 | + $duration = strtotime($subscription->get_expiration()) - strtotime($subscription->get_date_created()); |
|
71 | + $expiry = date('Y-m-d H:i:s', (current_time('timestamp') + $duration)); |
|
72 | 72 | |
73 | - $subscription->set_next_renewal_date( $expiry ); |
|
74 | - $subscription->set_date_created( current_time( 'mysql' ) ); |
|
75 | - $subscription->set_profile_id( $invoice->generate_key( 'manual_sub_' . $invoice->get_id() . '_' . $subscription->get_id() ) ); |
|
73 | + $subscription->set_next_renewal_date($expiry); |
|
74 | + $subscription->set_date_created(current_time('mysql')); |
|
75 | + $subscription->set_profile_id($invoice->generate_key('manual_sub_' . $invoice->get_id() . '_' . $subscription->get_id())); |
|
76 | 76 | $subscription->activate(); |
77 | 77 | } |
78 | 78 | } |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | } |
81 | 81 | |
82 | 82 | // Send to the success page. |
83 | - wpinv_send_to_success_page( array( 'invoice_key' => $invoice->get_key() ) ); |
|
83 | + wpinv_send_to_success_page(array('invoice_key' => $invoice->get_key())); |
|
84 | 84 | |
85 | 85 | } |
86 | 86 | |
@@ -90,10 +90,10 @@ discard block |
||
90 | 90 | * |
91 | 91 | * @param WPInv_Subscription $subscription |
92 | 92 | */ |
93 | - public function maybe_renew_subscription( $subscription ) { |
|
93 | + public function maybe_renew_subscription($subscription) { |
|
94 | 94 | |
95 | 95 | // Ensure its our subscription && it's active. |
96 | - if ( $this->id == $subscription->get_gateway() && $subscription->has_status( 'active trialling' ) ) { |
|
96 | + if ($this->id == $subscription->get_gateway() && $subscription->has_status('active trialling')) { |
|
97 | 97 | |
98 | 98 | // Renew the subscription. |
99 | 99 | $subscription->add_payment( |
@@ -116,10 +116,10 @@ discard block |
||
116 | 116 | * @param GetPaid_Form_Item[] $items |
117 | 117 | * @return WPInv_Invoice |
118 | 118 | */ |
119 | - public function process_addons( $invoice, $items ) { |
|
119 | + public function process_addons($invoice, $items) { |
|
120 | 120 | |
121 | - foreach ( $items as $item ) { |
|
122 | - $invoice->add_item( $item ); |
|
121 | + foreach ($items as $item) { |
|
122 | + $invoice->add_item($item); |
|
123 | 123 | } |
124 | 124 | |
125 | 125 | $invoice->recalculate_total(); |