@@ -5,7 +5,7 @@ discard block |
||
5 | 5 | * |
6 | 6 | */ |
7 | 7 | |
8 | -if ( ! defined( 'ABSPATH' ) ) { |
|
8 | +if (!defined('ABSPATH')) { |
|
9 | 9 | exit; // Exit if accessed directly |
10 | 10 | } |
11 | 11 | |
@@ -19,16 +19,16 @@ discard block |
||
19 | 19 | * |
20 | 20 | * @param WP_Post $post |
21 | 21 | */ |
22 | - public static function output( $post ) { |
|
22 | + public static function output($post) { |
|
23 | 23 | |
24 | 24 | // Fetch the invoice. |
25 | - $invoice = new WPInv_Invoice( $post ); |
|
25 | + $invoice = new WPInv_Invoice($post); |
|
26 | 26 | |
27 | 27 | // Fetch the subscription. |
28 | - $subscription = getpaid_get_invoice_subscription( $invoice ); |
|
28 | + $subscription = getpaid_get_invoice_subscription($invoice); |
|
29 | 29 | |
30 | 30 | echo '<div class="bsui">'; |
31 | - getpaid_admin_subscription_details_metabox( /** @scrutinizer ignore-type */$subscription ); |
|
31 | + getpaid_admin_subscription_details_metabox(/** @scrutinizer ignore-type */$subscription); |
|
32 | 32 | echo '</div>'; |
33 | 33 | |
34 | 34 | } |
@@ -38,16 +38,16 @@ discard block |
||
38 | 38 | * |
39 | 39 | * @param WP_Post $post |
40 | 40 | */ |
41 | - public static function output_invoices( $post ) { |
|
41 | + public static function output_invoices($post) { |
|
42 | 42 | |
43 | 43 | // Fetch the invoice. |
44 | - $invoice = new WPInv_Invoice( $post ); |
|
44 | + $invoice = new WPInv_Invoice($post); |
|
45 | 45 | |
46 | 46 | // Fetch the subscription. |
47 | - $subscription = getpaid_get_invoice_subscription( $invoice ); |
|
47 | + $subscription = getpaid_get_invoice_subscription($invoice); |
|
48 | 48 | |
49 | 49 | echo '<div class="bsui">'; |
50 | - getpaid_admin_subscription_invoice_details_metabox( /** @scrutinizer ignore-type */$subscription ); |
|
50 | + getpaid_admin_subscription_invoice_details_metabox(/** @scrutinizer ignore-type */$subscription); |
|
51 | 51 | echo '</div>'; |
52 | 52 | |
53 | 53 | } |
@@ -9,21 +9,21 @@ discard block |
||
9 | 9 | * @var WPInv_Subscriptions_Widget $widget |
10 | 10 | */ |
11 | 11 | |
12 | -defined( 'ABSPATH' ) || exit; |
|
12 | +defined('ABSPATH') || exit; |
|
13 | 13 | |
14 | -foreach ( array_keys( $widget->get_subscriptions_table_columns() ) as $column ) : |
|
14 | +foreach (array_keys($widget->get_subscriptions_table_columns()) as $column) : |
|
15 | 15 | |
16 | - $class = sanitize_html_class( $column ); |
|
16 | + $class = sanitize_html_class($column); |
|
17 | 17 | echo "<td class='getpaid-subscriptions-table-column-$class'>"; |
18 | 18 | |
19 | - do_action( "getpaid_subscriptions_before_frontend_subscription_table_$column", $subscription ); |
|
19 | + do_action("getpaid_subscriptions_before_frontend_subscription_table_$column", $subscription); |
|
20 | 20 | |
21 | - switch( $column ) : |
|
21 | + switch ($column) : |
|
22 | 22 | |
23 | 23 | case 'subscription': |
24 | 24 | $subscription_id = (int) $subscription->get_id(); |
25 | - $url = esc_url( $subscription->get_view_url() ); |
|
26 | - echo $widget->add_row_actions( "<a href='$url' class='text-decoration-none'>#$subscription_id</a>", $subscription ); |
|
25 | + $url = esc_url($subscription->get_view_url()); |
|
26 | + echo $widget->add_row_actions("<a href='$url' class='text-decoration-none'>#$subscription_id</a>", $subscription); |
|
27 | 27 | break; |
28 | 28 | |
29 | 29 | case 'status': |
@@ -31,19 +31,19 @@ discard block |
||
31 | 31 | break; |
32 | 32 | |
33 | 33 | case 'renewal-date': |
34 | - $renewal = getpaid_format_date_value( $subscription->get_next_renewal_date() ); |
|
34 | + $renewal = getpaid_format_date_value($subscription->get_next_renewal_date()); |
|
35 | 35 | echo $subscription->is_active() ? $renewal : "—"; |
36 | 36 | break; |
37 | 37 | |
38 | 38 | case 'amount': |
39 | - $frequency = getpaid_get_subscription_period_label( $subscription->get_period(), $subscription->get_frequency(), '' ); |
|
40 | - $amount = wpinv_price( wpinv_format_amount( wpinv_sanitize_amount( $subscription->get_recurring_amount() ) ), $subscription->get_parent_payment()->get_currency() ); |
|
39 | + $frequency = getpaid_get_subscription_period_label($subscription->get_period(), $subscription->get_frequency(), ''); |
|
40 | + $amount = wpinv_price(wpinv_format_amount(wpinv_sanitize_amount($subscription->get_recurring_amount())), $subscription->get_parent_payment()->get_currency()); |
|
41 | 41 | echo "<strong style='font-weight: 500;'>$amount</strong> / $frequency"; |
42 | 42 | break; |
43 | 43 | |
44 | 44 | endswitch; |
45 | 45 | |
46 | - do_action( "getpaid_subscriptions_frontend_subscription_table_$column", $subscription ); |
|
46 | + do_action("getpaid_subscriptions_frontend_subscription_table_$column", $subscription); |
|
47 | 47 | |
48 | 48 | echo '</td>'; |
49 | 49 |
@@ -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 | * Authorize.net Legacy Payment Gateway class. |
@@ -28,8 +28,8 @@ discard block |
||
28 | 28 | * @param WPInv_Invoice $invoice Invoice. |
29 | 29 | * @return string |
30 | 30 | */ |
31 | - public function get_api_url( $invoice ) { |
|
32 | - return $this->is_sandbox( $invoice ) ? 'https://apitest.authorize.net/xml/v1/request.api' : 'https://api.authorize.net/xml/v1/request.api'; |
|
31 | + public function get_api_url($invoice) { |
|
32 | + return $this->is_sandbox($invoice) ? 'https://apitest.authorize.net/xml/v1/request.api' : 'https://api.authorize.net/xml/v1/request.api'; |
|
33 | 33 | } |
34 | 34 | |
35 | 35 | /** |
@@ -40,40 +40,40 @@ discard block |
||
40 | 40 | * @param WPInv_Invoice $invoice Invoice. |
41 | 41 | * @return stdClass|WP_Error |
42 | 42 | */ |
43 | - public function post( $post, $invoice ){ |
|
43 | + public function post($post, $invoice) { |
|
44 | 44 | |
45 | - $url = $this->get_api_url( $invoice ); |
|
45 | + $url = $this->get_api_url($invoice); |
|
46 | 46 | $response = wp_remote_post( |
47 | 47 | $url, |
48 | 48 | array( |
49 | 49 | 'headers' => array( |
50 | 50 | 'Content-Type' => 'application/json; charset=utf-8' |
51 | 51 | ), |
52 | - 'body' => json_encode( $post ), |
|
52 | + 'body' => json_encode($post), |
|
53 | 53 | 'method' => 'POST' |
54 | 54 | ) |
55 | 55 | ); |
56 | 56 | |
57 | - if ( is_wp_error( $response ) ) { |
|
57 | + if (is_wp_error($response)) { |
|
58 | 58 | return $response; |
59 | 59 | } |
60 | 60 | |
61 | - $response = wp_unslash( wp_remote_retrieve_body( $response ) ); |
|
61 | + $response = wp_unslash(wp_remote_retrieve_body($response)); |
|
62 | 62 | $response = preg_replace('/\xEF\xBB\xBF/', '', $response); // https://community.developer.authorize.net/t5/Integration-and-Testing/JSON-issues/td-p/48851 |
63 | - $response = json_decode( $response ); |
|
63 | + $response = json_decode($response); |
|
64 | 64 | |
65 | - if ( empty( $response ) ) { |
|
66 | - return new WP_Error( 'invalid_reponse', __( 'Invalid gateway response', 'invoicing' ) ); |
|
65 | + if (empty($response)) { |
|
66 | + return new WP_Error('invalid_reponse', __('Invalid gateway response', 'invoicing')); |
|
67 | 67 | } |
68 | 68 | |
69 | - if ( $response->messages->resultCode == 'Error' ) { |
|
69 | + if ($response->messages->resultCode == 'Error') { |
|
70 | 70 | |
71 | - if ( ! empty( $response->transactionResponse ) && ! empty( $response->transactionResponse->errors ) ) { |
|
71 | + if (!empty($response->transactionResponse) && !empty($response->transactionResponse->errors)) { |
|
72 | 72 | $error = $response->transactionResponse->errors[0]; |
73 | - return new WP_Error( $error->errorCode, $error->errorText ); |
|
73 | + return new WP_Error($error->errorCode, $error->errorText); |
|
74 | 74 | } |
75 | 75 | |
76 | - return new WP_Error( $response->messages->message[0]->code, $response->messages->message[0]->text ); |
|
76 | + return new WP_Error($response->messages->message[0]->code, $response->messages->message[0]->text); |
|
77 | 77 | } |
78 | 78 | |
79 | 79 | return $response; |
@@ -89,8 +89,8 @@ discard block |
||
89 | 89 | public function get_auth_params() { |
90 | 90 | |
91 | 91 | return array( |
92 | - 'name' => $this->get_option( 'login_id' ), |
|
93 | - 'transactionKey' => $this->get_option( 'transaction_key' ), |
|
92 | + 'name' => $this->get_option('login_id'), |
|
93 | + 'transactionKey' => $this->get_option('transaction_key'), |
|
94 | 94 | ); |
95 | 95 | |
96 | 96 | } |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | * @param WPInv_Subscription $subscription Subscription. |
103 | 103 | * @param WPInv_Invoice $invoice Invoice. |
104 | 104 | */ |
105 | - public function cancel_subscription( $subscription, $invoice ) { |
|
105 | + public function cancel_subscription($subscription, $invoice) { |
|
106 | 106 | |
107 | 107 | // Backwards compatibility. New version do not use authorize.net subscriptions. |
108 | 108 | $this->post( |
@@ -127,38 +127,38 @@ discard block |
||
127 | 127 | $this->maybe_process_old_ipn(); |
128 | 128 | |
129 | 129 | // Validate the IPN. |
130 | - if ( empty( $_POST ) || ! $this->validate_ipn() ) { |
|
131 | - wp_die( 'Authorize.NET IPN Request Failure', 'Authorize.NET IPN', array( 'response' => 500 ) ); |
|
130 | + if (empty($_POST) || !$this->validate_ipn()) { |
|
131 | + wp_die('Authorize.NET IPN Request Failure', 'Authorize.NET IPN', array('response' => 500)); |
|
132 | 132 | } |
133 | 133 | |
134 | 134 | // Event type. |
135 | - $posted = json_decode( file_get_contents( 'php://input' ) ); |
|
136 | - if ( empty( $posted ) ) { |
|
137 | - wp_die( 'Invalid JSON', 'Authorize.NET IPN', array( 'response' => 500 ) ); |
|
135 | + $posted = json_decode(file_get_contents('php://input')); |
|
136 | + if (empty($posted)) { |
|
137 | + wp_die('Invalid JSON', 'Authorize.NET IPN', array('response' => 500)); |
|
138 | 138 | } |
139 | 139 | |
140 | 140 | // Process the IPN. |
141 | - $posted = (object) wp_unslash( $posted ); |
|
141 | + $posted = (object) wp_unslash($posted); |
|
142 | 142 | |
143 | 143 | // Process refunds. |
144 | - if ( 'net.authorize.payment.refund.created' == $posted->eventType ) { |
|
145 | - $invoice = new WPInv_Invoice( $posted->payload->merchantReferenceId ); |
|
146 | - $this->validate_ipn_invoice( $invoice, $posted->payload ); |
|
144 | + if ('net.authorize.payment.refund.created' == $posted->eventType) { |
|
145 | + $invoice = new WPInv_Invoice($posted->payload->merchantReferenceId); |
|
146 | + $this->validate_ipn_invoice($invoice, $posted->payload); |
|
147 | 147 | $invoice->refund(); |
148 | 148 | } |
149 | 149 | |
150 | 150 | // Held funds approved. |
151 | - if ( 'net.authorize.payment.fraud.approved' == $posted->eventType ) { |
|
152 | - $invoice = new WPInv_Invoice( $posted->payload->id ); |
|
153 | - $this->validate_ipn_invoice( $invoice, $posted->payload ); |
|
154 | - $invoice->mark_paid( false, __( 'Payment released', 'invoicing' ) ); |
|
151 | + if ('net.authorize.payment.fraud.approved' == $posted->eventType) { |
|
152 | + $invoice = new WPInv_Invoice($posted->payload->id); |
|
153 | + $this->validate_ipn_invoice($invoice, $posted->payload); |
|
154 | + $invoice->mark_paid(false, __('Payment released', 'invoicing')); |
|
155 | 155 | } |
156 | 156 | |
157 | 157 | // Held funds declined. |
158 | - if ( 'net.authorize.payment.fraud.declined' == $posted->eventType ) { |
|
159 | - $invoice = new WPInv_Invoice( $posted->payload->id ); |
|
160 | - $this->validate_ipn_invoice( $invoice, $posted->payload ); |
|
161 | - $invoice->set_status( 'wpi-failed', __( 'Payment desclined', 'invoicing' ) ); |
|
158 | + if ('net.authorize.payment.fraud.declined' == $posted->eventType) { |
|
159 | + $invoice = new WPInv_Invoice($posted->payload->id); |
|
160 | + $this->validate_ipn_invoice($invoice, $posted->payload); |
|
161 | + $invoice->set_status('wpi-failed', __('Payment desclined', 'invoicing')); |
|
162 | 162 | $invoice->save(); |
163 | 163 | } |
164 | 164 | |
@@ -173,8 +173,8 @@ discard block |
||
173 | 173 | * @param object $payload |
174 | 174 | * @return void |
175 | 175 | */ |
176 | - public function validate_ipn_invoice( $invoice, $payload ) { |
|
177 | - if ( ! $invoice->exists() || $payload->id != $invoice->get_transaction_id() ) { |
|
176 | + public function validate_ipn_invoice($invoice, $payload) { |
|
177 | + if (!$invoice->exists() || $payload->id != $invoice->get_transaction_id()) { |
|
178 | 178 | exit; |
179 | 179 | } |
180 | 180 | } |
@@ -186,32 +186,32 @@ discard block |
||
186 | 186 | */ |
187 | 187 | public function maybe_process_old_ipn() { |
188 | 188 | |
189 | - $data = wp_unslash( $_POST ); |
|
189 | + $data = wp_unslash($_POST); |
|
190 | 190 | |
191 | 191 | // Only process subscriptions subscriptions. |
192 | - if ( empty( $_POST['x_subscription_id'] ) ) { |
|
192 | + if (empty($_POST['x_subscription_id'])) { |
|
193 | 193 | return; |
194 | 194 | } |
195 | 195 | |
196 | 196 | // Check validity. |
197 | - $this->validate_old_ipn_signature( $data ); |
|
197 | + $this->validate_old_ipn_signature($data); |
|
198 | 198 | |
199 | 199 | // Fetch the associated subscription. |
200 | - $subscription_id = WPInv_Subscription::get_subscription_id_by_field( $_POST['x_subscription_id'] ); |
|
201 | - $subscription = new WPInv_Subscription( $subscription_id ); |
|
200 | + $subscription_id = WPInv_Subscription::get_subscription_id_by_field($_POST['x_subscription_id']); |
|
201 | + $subscription = new WPInv_Subscription($subscription_id); |
|
202 | 202 | |
203 | 203 | // Abort if it is missing or completed. |
204 | - if ( ! $subscription->get_id() || $subscription->has_status( 'completed' ) ) { |
|
204 | + if (!$subscription->get_id() || $subscription->has_status('completed')) { |
|
205 | 205 | return; |
206 | 206 | } |
207 | 207 | |
208 | 208 | // Payment status. |
209 | - if ( 1 == $_POST['x_response_code'] ) { |
|
209 | + if (1 == $_POST['x_response_code']) { |
|
210 | 210 | |
211 | 211 | // Renew the subscription. |
212 | 212 | $subscription->add_payment( |
213 | 213 | array( |
214 | - 'transaction_id' => sanitize_text_field( $data['x_trans_id'] ), |
|
214 | + 'transaction_id' => sanitize_text_field($data['x_trans_id']), |
|
215 | 215 | 'gateway' => $this->id |
216 | 216 | ) |
217 | 217 | ); |
@@ -230,17 +230,17 @@ discard block |
||
230 | 230 | * |
231 | 231 | * @param array $posted |
232 | 232 | */ |
233 | - public function validate_old_ipn_signature( $posted ) { |
|
233 | + public function validate_old_ipn_signature($posted) { |
|
234 | 234 | |
235 | - $signature = $this->get_option( 'signature_key' ); |
|
236 | - if ( ! empty( $signature ) ) { |
|
237 | - $login_id = $this->get_option( 'login_id' ); |
|
235 | + $signature = $this->get_option('signature_key'); |
|
236 | + if (!empty($signature)) { |
|
237 | + $login_id = $this->get_option('login_id'); |
|
238 | 238 | $trans_id = $_POST['x_trans_id']; |
239 | 239 | $amount = $_POST['x_amount']; |
240 | - $hash = hash_hmac ( 'sha512', "^$login_id^$trans_id^$amount^", hex2bin( $signature ) ); |
|
240 | + $hash = hash_hmac('sha512', "^$login_id^$trans_id^$amount^", hex2bin($signature)); |
|
241 | 241 | |
242 | - if ( ! hash_equals( $hash, $posted['x_SHA2_Hash'] ) ) { |
|
243 | - wpinv_error_log( $posted['x_SHA2_Hash'], "Invalid signature. Expected $hash" ); |
|
242 | + if (!hash_equals($hash, $posted['x_SHA2_Hash'])) { |
|
243 | + wpinv_error_log($posted['x_SHA2_Hash'], "Invalid signature. Expected $hash"); |
|
244 | 244 | exit; |
245 | 245 | } |
246 | 246 | |
@@ -253,28 +253,28 @@ discard block |
||
253 | 253 | */ |
254 | 254 | public function validate_ipn() { |
255 | 255 | |
256 | - wpinv_error_log( 'Validating Authorize.NET IPN response' ); |
|
256 | + wpinv_error_log('Validating Authorize.NET IPN response'); |
|
257 | 257 | |
258 | - if ( empty( $_SERVER['HTTP_X_ANET_SIGNATURE'] ) ) { |
|
258 | + if (empty($_SERVER['HTTP_X_ANET_SIGNATURE'])) { |
|
259 | 259 | return false; |
260 | 260 | } |
261 | 261 | |
262 | - $signature = $this->get_option( 'signature_key' ); |
|
262 | + $signature = $this->get_option('signature_key'); |
|
263 | 263 | |
264 | - if ( empty( $signature ) ) { |
|
265 | - wpinv_error_log( 'Error: You have not set a signature key' ); |
|
264 | + if (empty($signature)) { |
|
265 | + wpinv_error_log('Error: You have not set a signature key'); |
|
266 | 266 | return false; |
267 | 267 | } |
268 | 268 | |
269 | - $hash = hash_hmac ( 'sha512', file_get_contents( 'php://input' ), hex2bin( $signature ) ); |
|
269 | + $hash = hash_hmac('sha512', file_get_contents('php://input'), hex2bin($signature)); |
|
270 | 270 | |
271 | - if ( hash_equals( $hash, $_SERVER['HTTP_X_ANET_SIGNATURE'] ) ) { |
|
272 | - wpinv_error_log( 'Successfully validated the IPN' ); |
|
271 | + if (hash_equals($hash, $_SERVER['HTTP_X_ANET_SIGNATURE'])) { |
|
272 | + wpinv_error_log('Successfully validated the IPN'); |
|
273 | 273 | return true; |
274 | 274 | } |
275 | 275 | |
276 | - wpinv_error_log( 'IPN hash is not valid' ); |
|
277 | - wpinv_error_log( $_SERVER['HTTP_X_ANET_SIGNATURE'] ); |
|
276 | + wpinv_error_log('IPN hash is not valid'); |
|
277 | + wpinv_error_log($_SERVER['HTTP_X_ANET_SIGNATURE']); |
|
278 | 278 | return false; |
279 | 279 | |
280 | 280 | } |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if ( ! defined( 'ABSPATH' ) ) { |
|
2 | +if (!defined('ABSPATH')) { |
|
3 | 3 | exit; |
4 | 4 | } |
5 | 5 | |
@@ -22,16 +22,16 @@ discard block |
||
22 | 22 | 'block-keywords'=> "['invoicing','buy', 'buy item', 'form']", |
23 | 23 | 'class_name' => __CLASS__, |
24 | 24 | 'base_id' => 'getpaid', |
25 | - 'name' => __('GetPaid','invoicing'), |
|
25 | + 'name' => __('GetPaid', 'invoicing'), |
|
26 | 26 | 'widget_ops' => array( |
27 | 27 | 'classname' => 'getpaid bsui', |
28 | - 'description' => esc_html__('Show payment forms or buttons.','invoicing'), |
|
28 | + 'description' => esc_html__('Show payment forms or buttons.', 'invoicing'), |
|
29 | 29 | ), |
30 | 30 | 'arguments' => array( |
31 | 31 | |
32 | 32 | 'title' => array( |
33 | - 'title' => __( 'Widget title', 'invoicing' ), |
|
34 | - 'desc' => __( 'Enter widget title.', 'invoicing' ), |
|
33 | + 'title' => __('Widget title', 'invoicing'), |
|
34 | + 'desc' => __('Enter widget title.', 'invoicing'), |
|
35 | 35 | 'type' => 'text', |
36 | 36 | 'desc_tip' => true, |
37 | 37 | 'default' => '', |
@@ -39,28 +39,28 @@ discard block |
||
39 | 39 | ), |
40 | 40 | |
41 | 41 | 'form' => array( |
42 | - 'title' => __( 'Form', 'invoicing' ), |
|
43 | - 'desc' => __( 'Enter a form id in case you want to display a specific payment form', 'invoicing' ), |
|
42 | + 'title' => __('Form', 'invoicing'), |
|
43 | + 'desc' => __('Enter a form id in case you want to display a specific payment form', 'invoicing'), |
|
44 | 44 | 'type' => 'text', |
45 | 45 | 'desc_tip' => true, |
46 | 46 | 'default' => '', |
47 | - 'placeholder' => __('1','invoicing'), |
|
47 | + 'placeholder' => __('1', 'invoicing'), |
|
48 | 48 | 'advanced' => false |
49 | 49 | ), |
50 | 50 | |
51 | 51 | 'item' => array( |
52 | - 'title' => __( 'Items', 'invoicing' ), |
|
53 | - 'desc' => __( 'Enter comma separated list of invoicing item id and quantity (item_id|quantity). Ex. 101|2. This will be ignored in case you specify a form above. Enter 0 as the quantity to let users select their own quantities', 'invoicing' ), |
|
52 | + 'title' => __('Items', 'invoicing'), |
|
53 | + 'desc' => __('Enter comma separated list of invoicing item id and quantity (item_id|quantity). Ex. 101|2. This will be ignored in case you specify a form above. Enter 0 as the quantity to let users select their own quantities', 'invoicing'), |
|
54 | 54 | 'type' => 'text', |
55 | 55 | 'desc_tip' => true, |
56 | 56 | 'default' => '', |
57 | - 'placeholder' => __('1','invoicing'), |
|
57 | + 'placeholder' => __('1', 'invoicing'), |
|
58 | 58 | 'advanced' => false |
59 | 59 | ), |
60 | 60 | |
61 | 61 | 'button' => array( |
62 | - 'title' => __( 'Button', 'invoicing' ), |
|
63 | - 'desc' => __( 'Enter button label in case you would like to display the forms in a popup.', 'invoicing' ), |
|
62 | + 'title' => __('Button', 'invoicing'), |
|
63 | + 'desc' => __('Enter button label in case you would like to display the forms in a popup.', 'invoicing'), |
|
64 | 64 | 'type' => 'text', |
65 | 65 | 'desc_tip' => true, |
66 | 66 | 'default' => '', |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | ); |
73 | 73 | |
74 | 74 | |
75 | - parent::__construct( $options ); |
|
75 | + parent::__construct($options); |
|
76 | 76 | } |
77 | 77 | |
78 | 78 | /** |
@@ -84,23 +84,23 @@ discard block |
||
84 | 84 | * |
85 | 85 | * @return string |
86 | 86 | */ |
87 | - public function output( $args = array(), $widget_args = array(), $content = '' ) { |
|
87 | + public function output($args = array(), $widget_args = array(), $content = '') { |
|
88 | 88 | |
89 | 89 | // Is the shortcode set up correctly? |
90 | - if ( empty( $args['form'] ) && empty( $args['item'] ) ) { |
|
90 | + if (empty($args['form']) && empty($args['item'])) { |
|
91 | 91 | return aui()->alert( |
92 | 92 | array( |
93 | 93 | 'type' => 'warning', |
94 | - 'content' => __( 'No payment form or item selected', 'invoicing' ), |
|
94 | + 'content' => __('No payment form or item selected', 'invoicing'), |
|
95 | 95 | ) |
96 | 96 | ); |
97 | 97 | } |
98 | 98 | |
99 | 99 | // Payment form or button? |
100 | - if ( ! empty( $args['form'] ) ) { |
|
101 | - return $this->handle_payment_form( $args ); |
|
100 | + if (!empty($args['form'])) { |
|
101 | + return $this->handle_payment_form($args); |
|
102 | 102 | } else { |
103 | - return $this->handle_buy_item( $args ); |
|
103 | + return $this->handle_buy_item($args); |
|
104 | 104 | } |
105 | 105 | |
106 | 106 | } |
@@ -110,15 +110,15 @@ discard block |
||
110 | 110 | * |
111 | 111 | * @return string |
112 | 112 | */ |
113 | - protected function handle_payment_form( $args = array() ) { |
|
113 | + protected function handle_payment_form($args = array()) { |
|
114 | 114 | |
115 | - if ( empty( $args['button'] ) ) { |
|
115 | + if (empty($args['button'])) { |
|
116 | 116 | ob_start(); |
117 | - getpaid_display_payment_form( $args['form'] ); |
|
117 | + getpaid_display_payment_form($args['form']); |
|
118 | 118 | return ob_get_clean(); |
119 | 119 | } |
120 | 120 | |
121 | - return $this->payment_form_button( $args['form'], $args['button'] ); |
|
121 | + return $this->payment_form_button($args['form'], $args['button']); |
|
122 | 122 | } |
123 | 123 | |
124 | 124 | /** |
@@ -126,8 +126,8 @@ discard block |
||
126 | 126 | * |
127 | 127 | * @return string |
128 | 128 | */ |
129 | - protected function payment_form_button( $form, $button ) { |
|
130 | - return getpaid_get_payment_button( $button, $form ); |
|
129 | + protected function payment_form_button($form, $button) { |
|
130 | + return getpaid_get_payment_button($button, $form); |
|
131 | 131 | } |
132 | 132 | |
133 | 133 | /** |
@@ -135,13 +135,13 @@ discard block |
||
135 | 135 | * |
136 | 136 | * @return string |
137 | 137 | */ |
138 | - protected function handle_buy_item( $args = array() ) { |
|
138 | + protected function handle_buy_item($args = array()) { |
|
139 | 139 | |
140 | - if ( empty( $args['button'] ) ) { |
|
141 | - return $this->buy_item_form( $args['item'] ); |
|
140 | + if (empty($args['button'])) { |
|
141 | + return $this->buy_item_form($args['item']); |
|
142 | 142 | } |
143 | 143 | |
144 | - return $this->buy_item_button( $args['item'], $args['button'] ); |
|
144 | + return $this->buy_item_button($args['item'], $args['button']); |
|
145 | 145 | |
146 | 146 | } |
147 | 147 | |
@@ -150,10 +150,10 @@ discard block |
||
150 | 150 | * |
151 | 151 | * @return string |
152 | 152 | */ |
153 | - protected function buy_item_form( $item ) { |
|
154 | - $items = getpaid_convert_items_to_array( $item ); |
|
153 | + protected function buy_item_form($item) { |
|
154 | + $items = getpaid_convert_items_to_array($item); |
|
155 | 155 | ob_start(); |
156 | - getpaid_display_item_payment_form( $items ); |
|
156 | + getpaid_display_item_payment_form($items); |
|
157 | 157 | return ob_get_clean(); |
158 | 158 | } |
159 | 159 | |
@@ -162,8 +162,8 @@ discard block |
||
162 | 162 | * |
163 | 163 | * @return string |
164 | 164 | */ |
165 | - protected function buy_item_button( $item, $button ) { |
|
166 | - return getpaid_get_payment_button( $button, null, $item ); |
|
165 | + protected function buy_item_button($item, $button) { |
|
166 | + return getpaid_get_payment_button($button, null, $item); |
|
167 | 167 | } |
168 | 168 | |
169 | 169 | } |
@@ -7,36 +7,36 @@ |
||
7 | 7 | * @version 1.0.19 |
8 | 8 | */ |
9 | 9 | |
10 | -defined( 'ABSPATH' ) || exit; |
|
10 | +defined('ABSPATH') || exit; |
|
11 | 11 | |
12 | -if ( empty( $form->get_items() ) ) { |
|
12 | +if (empty($form->get_items())) { |
|
13 | 13 | return; |
14 | 14 | } |
15 | 15 | |
16 | -if ( empty( $items_type ) ) { |
|
16 | +if (empty($items_type)) { |
|
17 | 17 | $items_type = 'total'; |
18 | 18 | } |
19 | 19 | |
20 | -switch( $items_type ) { |
|
20 | +switch ($items_type) { |
|
21 | 21 | case 'radio': |
22 | - wpinv_get_template( 'payment-forms/variations/radio.php', compact( 'form', 'items_type' ) ); |
|
22 | + wpinv_get_template('payment-forms/variations/radio.php', compact('form', 'items_type')); |
|
23 | 23 | break; |
24 | 24 | case 'checkbox': |
25 | - wpinv_get_template( 'payment-forms/variations/checkbox.php', compact( 'form', 'items_type' ) ); |
|
25 | + wpinv_get_template('payment-forms/variations/checkbox.php', compact('form', 'items_type')); |
|
26 | 26 | break; |
27 | 27 | case 'select': |
28 | - wpinv_get_template( 'payment-forms/variations/select.php', compact( 'form', 'items_type' ) ); |
|
28 | + wpinv_get_template('payment-forms/variations/select.php', compact('form', 'items_type')); |
|
29 | 29 | break; |
30 | 30 | } |
31 | 31 | |
32 | 32 | // Display the cart totals. |
33 | -if ( ! empty( $hide_cart ) ) { |
|
33 | +if (!empty($hide_cart)) { |
|
34 | 34 | echo '<div class="d-none">'; |
35 | 35 | } |
36 | 36 | |
37 | 37 | // Display the cart totals. |
38 | -wpinv_get_template( 'payment-forms/cart.php', compact( 'form', 'items_type' ) ); |
|
38 | +wpinv_get_template('payment-forms/cart.php', compact('form', 'items_type')); |
|
39 | 39 | |
40 | -if ( ! empty( $hide_cart ) ) { |
|
40 | +if (!empty($hide_cart)) { |
|
41 | 41 | echo '</div>'; |
42 | 42 | } |
@@ -7,52 +7,52 @@ |
||
7 | 7 | * @version 1.0.19 |
8 | 8 | */ |
9 | 9 | |
10 | -defined( 'ABSPATH' ) || exit; |
|
10 | +defined('ABSPATH') || exit; |
|
11 | 11 | |
12 | 12 | ?> |
13 | 13 | |
14 | 14 | <small class='form-text text-muted mb-2'> |
15 | - <?php esc_html_e( 'This amount will be added to the total amount for this form', 'invoicing' ); ?> |
|
15 | + <?php esc_html_e('This amount will be added to the total amount for this form', 'invoicing'); ?> |
|
16 | 16 | </small> |
17 | 17 | |
18 | 18 | <div class='form-group'> |
19 | 19 | <label class="d-block"> |
20 | - <span><?php esc_html_e( 'Field Label', 'invoicing' ); ?></span> |
|
20 | + <span><?php esc_html_e('Field Label', 'invoicing'); ?></span> |
|
21 | 21 | <input v-model='active_form_element.label' class='form-control' /> |
22 | 22 | </label> |
23 | 23 | </div> |
24 | 24 | |
25 | 25 | <div class='form-group' v-if="active_form_element.select_type=='select'"> |
26 | 26 | <label class="d-block"> |
27 | - <span><?php esc_html_e( 'Placeholder text', 'invoicing' ); ?></span> |
|
27 | + <span><?php esc_html_e('Placeholder text', 'invoicing'); ?></span> |
|
28 | 28 | <input v-model='active_form_element.placeholder' class='form-control' /> |
29 | 29 | </label> |
30 | 30 | </div> |
31 | 31 | |
32 | 32 | <div class='form-group'> |
33 | 33 | <label class="d-block"> |
34 | - <span><?php esc_html_e( 'Select Type', 'invoicing' ); ?></span> |
|
34 | + <span><?php esc_html_e('Select Type', 'invoicing'); ?></span> |
|
35 | 35 | <select class='form-control custom-select' v-model='active_form_element.select_type'> |
36 | - <option value='select'><?php esc_html_e( 'Dropdown', 'invoicing' ) ?></option> |
|
37 | - <option value='checkboxes'><?php esc_html_e( 'Checkboxes', 'invoicing' ) ?></option> |
|
38 | - <option value='radios'><?php esc_html_e( 'Radio Buttons', 'invoicing' ) ?></option> |
|
39 | - <option value='buttons'><?php esc_html_e( 'Buttons', 'invoicing' ) ?></option> |
|
40 | - <option value='circles'><?php esc_html_e( 'Circles', 'invoicing' ) ?></option> |
|
36 | + <option value='select'><?php esc_html_e('Dropdown', 'invoicing') ?></option> |
|
37 | + <option value='checkboxes'><?php esc_html_e('Checkboxes', 'invoicing') ?></option> |
|
38 | + <option value='radios'><?php esc_html_e('Radio Buttons', 'invoicing') ?></option> |
|
39 | + <option value='buttons'><?php esc_html_e('Buttons', 'invoicing') ?></option> |
|
40 | + <option value='circles'><?php esc_html_e('Circles', 'invoicing') ?></option> |
|
41 | 41 | </select> |
42 | 42 | </label> |
43 | 43 | </div> |
44 | 44 | |
45 | 45 | <div class='form-group'> |
46 | 46 | <label class="d-block"> |
47 | - <span><?php esc_html_e( 'Options', 'invoicing' ); ?></span> |
|
47 | + <span><?php esc_html_e('Options', 'invoicing'); ?></span> |
|
48 | 48 | <textarea placeholder='Basic|10,Pro|99,Business|199' v-model='active_form_element.options' class='form-control' rows='3'></textarea> |
49 | - <small class='form-text text-muted mb-2'><?php esc_html_e( 'Use commas to separate options and pipes to separate a label and its price. Do not include a currency symbol in the price.', 'invoicing' ); ?></small> |
|
49 | + <small class='form-text text-muted mb-2'><?php esc_html_e('Use commas to separate options and pipes to separate a label and its price. Do not include a currency symbol in the price.', 'invoicing'); ?></small> |
|
50 | 50 | </label> |
51 | 51 | </div> |
52 | 52 | |
53 | 53 | <div class='form-group'> |
54 | 54 | <label class="d-block"> |
55 | - <span><?php esc_html_e( 'Help Text', 'invoicing' ); ?></span> |
|
56 | - <textarea placeholder='<?php esc_attr_e( 'Add some help text for this field', 'invoicing' ); ?>' v-model='active_form_element.description' class='form-control' rows='3'></textarea> |
|
55 | + <span><?php esc_html_e('Help Text', 'invoicing'); ?></span> |
|
56 | + <textarea placeholder='<?php esc_attr_e('Add some help text for this field', 'invoicing'); ?>' v-model='active_form_element.description' class='form-control' rows='3'></textarea> |
|
57 | 57 | </label> |
58 | 58 | </div> |
@@ -7,11 +7,11 @@ |
||
7 | 7 | * @version 1.0.19 |
8 | 8 | */ |
9 | 9 | |
10 | -defined( 'ABSPATH' ) || exit; |
|
10 | +defined('ABSPATH') || exit; |
|
11 | 11 | |
12 | 12 | ?> |
13 | 13 | |
14 | 14 | <div class='form-group'> |
15 | - <label :for="active_form_element.id + '_edit'"><?php esc_html_e( 'The total payable text', 'invoicing' ) ?></label> |
|
15 | + <label :for="active_form_element.id + '_edit'"><?php esc_html_e('The total payable text', 'invoicing') ?></label> |
|
16 | 16 | <textarea :id="active_form_element.id + '_edit'" v-model='active_form_element.text' class='form-control' rows='3'></textarea> |
17 | 17 | </div> |
@@ -7,27 +7,27 @@ |
||
7 | 7 | * @version 1.0.19 |
8 | 8 | */ |
9 | 9 | |
10 | -defined( 'ABSPATH' ) || exit; |
|
10 | +defined('ABSPATH') || exit; |
|
11 | 11 | |
12 | 12 | ?> |
13 | 13 | |
14 | 14 | <div class='form-group'> |
15 | 15 | <label class="d-block"> |
16 | - <span><?php esc_html_e( 'Input Label', 'invoicing' ); ?></span> |
|
16 | + <span><?php esc_html_e('Input Label', 'invoicing'); ?></span> |
|
17 | 17 | <input v-model='active_form_element.input_label' class='form-control' type="text"/> |
18 | 18 | </label> |
19 | 19 | </div> |
20 | 20 | |
21 | 21 | <div class='form-group'> |
22 | 22 | <label class="d-block"> |
23 | - <span><?php esc_html_e( 'Button Label', 'invoicing' ); ?></span> |
|
23 | + <span><?php esc_html_e('Button Label', 'invoicing'); ?></span> |
|
24 | 24 | <input v-model='active_form_element.button_label' class='form-control' type="text"/> |
25 | 25 | </label> |
26 | 26 | </div> |
27 | 27 | |
28 | 28 | <div class='form-group'> |
29 | 29 | <label class="d-block"> |
30 | - <span><?php esc_html_e( 'Help Text', 'invoicing' ); ?></span> |
|
31 | - <textarea placeholder='<?php esc_attr_e( 'Add some help text for this field', 'invoicing' ); ?>' v-model='active_form_element.description' class='form-control' rows='3'></textarea> |
|
30 | + <span><?php esc_html_e('Help Text', 'invoicing'); ?></span> |
|
31 | + <textarea placeholder='<?php esc_attr_e('Add some help text for this field', 'invoicing'); ?>' v-model='active_form_element.description' class='form-control' rows='3'></textarea> |
|
32 | 32 | </label> |
33 | 33 | </div> |
@@ -7,11 +7,11 @@ |
||
7 | 7 | * @version 1.0.19 |
8 | 8 | */ |
9 | 9 | |
10 | -defined( 'ABSPATH' ) || exit; |
|
10 | +defined('ABSPATH') || exit; |
|
11 | 11 | |
12 | 12 | ?> |
13 | 13 | |
14 | 14 | <div class='form-group'> |
15 | - <label :for="active_form_element.id + '_edit'"><?php esc_html_e( 'Enter your text', 'invoicing' ) ?></label> |
|
15 | + <label :for="active_form_element.id + '_edit'"><?php esc_html_e('Enter your text', 'invoicing') ?></label> |
|
16 | 16 | <textarea :id="active_form_element.id + '_edit'" v-model='active_form_element.text' class='form-control' rows='3'></textarea> |
17 | 17 | </div> |