Passed
Push — master ( 499ba9...8f8300 )
by Brian
29:17 queued 24:46
created
includes/gateways/class-getpaid-payment-gateway.php 1 patch
Spacing   +128 added lines, -128 removed lines patch added patch discarded remove patch
@@ -4,7 +4,7 @@  discard block
 block discarded – undo
4 4
  *
5 5
  */
6 6
 
7
-defined( 'ABSPATH' ) || exit;
7
+defined('ABSPATH') || exit;
8 8
 
9 9
 /**
10 10
  * Abstaract Payment Gateway class.
@@ -139,50 +139,50 @@  discard block
 block discarded – undo
139 139
 	public function __construct() {
140 140
 
141 141
 		// Register gateway.
142
-		add_filter( 'wpinv_payment_gateways', array( $this, 'register_gateway' ) );
142
+		add_filter('wpinv_payment_gateways', array($this, 'register_gateway'));
143 143
 
144
-		$this->enabled = wpinv_is_gateway_active( $this->id );
144
+		$this->enabled = wpinv_is_gateway_active($this->id);
145 145
 
146 146
 		// Add support for various features.
147
-		foreach ( $this->supports as $feature ) {
148
-			add_filter( "wpinv_{$this->id}_support_{$feature}", '__return_true' );
149
-			add_filter( "getpaid_{$this->id}_support_{$feature}", '__return_true' );
150
-			add_filter( "getpaid_{$this->id}_supports_{$feature}", '__return_true' );
147
+		foreach ($this->supports as $feature) {
148
+			add_filter("wpinv_{$this->id}_support_{$feature}", '__return_true');
149
+			add_filter("getpaid_{$this->id}_support_{$feature}", '__return_true');
150
+			add_filter("getpaid_{$this->id}_supports_{$feature}", '__return_true');
151 151
 		}
152 152
 
153 153
 		// Invoice addons.
154
-		if ( $this->supports( 'addons' ) ) {
155
-			add_action( "getpaid_process_{$this->id}_invoice_addons", array( $this, 'process_addons' ), 10, 2 );
154
+		if ($this->supports('addons')) {
155
+			add_action("getpaid_process_{$this->id}_invoice_addons", array($this, 'process_addons'), 10, 2);
156 156
 		}
157 157
 
158 158
 		// Gateway settings.
159
-		add_filter( "wpinv_gateway_settings_{$this->id}", array( $this, 'admin_settings' ) );
159
+		add_filter("wpinv_gateway_settings_{$this->id}", array($this, 'admin_settings'));
160 160
 
161 161
 		// Gateway checkout fiellds.
162
-		add_action( "wpinv_{$this->id}_cc_form", array( $this, 'payment_fields' ), 10, 2 );
162
+		add_action("wpinv_{$this->id}_cc_form", array($this, 'payment_fields'), 10, 2);
163 163
 
164 164
 		// Process payment.
165
-		add_action( "getpaid_gateway_{$this->id}", array( $this, 'process_payment' ), 10, 3 );
165
+		add_action("getpaid_gateway_{$this->id}", array($this, 'process_payment'), 10, 3);
166 166
 
167 167
 		// Change the checkout button text.
168
-		if ( ! empty( $this->checkout_button_text ) ) {
169
-			add_filter( "getpaid_gateway_{$this->id}_checkout_button_label", array( $this, 'rename_checkout_button' ) );
168
+		if (!empty($this->checkout_button_text)) {
169
+			add_filter("getpaid_gateway_{$this->id}_checkout_button_label", array($this, 'rename_checkout_button'));
170 170
 		}
171 171
 
172 172
 		// Check if a gateway is valid for a given currency.
173
-		add_filter( "getpaid_gateway_{$this->id}_is_valid_for_currency", array( $this, 'validate_currency' ), 10, 2 );
173
+		add_filter("getpaid_gateway_{$this->id}_is_valid_for_currency", array($this, 'validate_currency'), 10, 2);
174 174
 
175 175
 		// Generate the transaction url.
176
-		add_filter( "getpaid_gateway_{$this->id}_transaction_url", array( $this, 'filter_transaction_url' ), 10, 2 );
176
+		add_filter("getpaid_gateway_{$this->id}_transaction_url", array($this, 'filter_transaction_url'), 10, 2);
177 177
 
178 178
 		// Generate the subscription url.
179
-		add_filter( 'getpaid_remote_subscription_profile_url', array( $this, 'generate_subscription_url' ), 10, 2 );
179
+		add_filter('getpaid_remote_subscription_profile_url', array($this, 'generate_subscription_url'), 10, 2);
180 180
 
181 181
 		// Confirm payments.
182
-		add_filter( "wpinv_payment_confirm_{$this->id}", array( $this, 'confirm_payment' ), 10, 2 );
182
+		add_filter("wpinv_payment_confirm_{$this->id}", array($this, 'confirm_payment'), 10, 2);
183 183
 
184 184
 		// Verify IPNs.
185
-		add_action( "wpinv_verify_{$this->id}_ipn", array( $this, 'verify_ipn' ) );
185
+		add_action("wpinv_verify_{$this->id}_ipn", array($this, 'verify_ipn'));
186 186
 
187 187
 	}
188 188
 
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
 	 * @since 1.0.19
193 193
 	 * @return bool
194 194
 	 */
195
-	public function is( $gateway ) {
195
+	public function is($gateway) {
196 196
 		return $gateway == $this->id;
197 197
 	}
198 198
 
@@ -202,23 +202,23 @@  discard block
 block discarded – undo
202 202
 	 * @since 1.0.19
203 203
 	 * @return array
204 204
 	 */
205
-	public function get_tokens( $sandbox = null ) {
205
+	public function get_tokens($sandbox = null) {
206 206
 
207
-		if ( is_user_logged_in() && $this->supports( 'tokens' ) && 0 == count( $this->tokens ) ) {
208
-			$tokens = get_user_meta( get_current_user_id(), "getpaid_{$this->id}_tokens", true );
207
+		if (is_user_logged_in() && $this->supports('tokens') && 0 == count($this->tokens)) {
208
+			$tokens = get_user_meta(get_current_user_id(), "getpaid_{$this->id}_tokens", true);
209 209
 
210
-			if ( is_array( $tokens ) ) {
210
+			if (is_array($tokens)) {
211 211
 				$this->tokens = $tokens;
212 212
 			}
213 213
 }
214 214
 
215
-		if ( ! is_bool( $sandbox ) ) {
215
+		if (!is_bool($sandbox)) {
216 216
 			return $this->tokens;
217 217
 		}
218 218
 
219 219
 		// Filter tokens.
220
-		$args = array( 'type' => $sandbox ? 'sandbox' : 'live' );
221
-		return wp_list_filter( $this->tokens, $args );
220
+		$args = array('type' => $sandbox ? 'sandbox' : 'live');
221
+		return wp_list_filter($this->tokens, $args);
222 222
 
223 223
 	}
224 224
 
@@ -227,12 +227,12 @@  discard block
 block discarded – undo
227 227
 	 *
228 228
 	 * @since 1.0.19
229 229
 	 */
230
-	public function save_token( $token ) {
230
+	public function save_token($token) {
231 231
 
232 232
 		$tokens   = $this->get_tokens();
233 233
 		$tokens[] = $token;
234 234
 
235
-		update_user_meta( get_current_user_id(), "getpaid_{$this->id}_tokens", $tokens );
235
+		update_user_meta(get_current_user_id(), "getpaid_{$this->id}_tokens", $tokens);
236 236
 
237 237
 		$this->tokens = $tokens;
238 238
 
@@ -244,7 +244,7 @@  discard block
 block discarded – undo
244 244
 	 * @return string
245 245
 	 */
246 246
 	public function get_method_title() {
247
-		return apply_filters( 'getpaid_gateway_method_title', $this->method_title, $this );
247
+		return apply_filters('getpaid_gateway_method_title', $this->method_title, $this);
248 248
 	}
249 249
 
250 250
 	/**
@@ -253,7 +253,7 @@  discard block
 block discarded – undo
253 253
 	 * @return string
254 254
 	 */
255 255
 	public function get_method_description() {
256
-		return apply_filters( 'getpaid_gateway_method_description', $this->method_description, $this );
256
+		return apply_filters('getpaid_gateway_method_description', $this->method_description, $this);
257 257
 	}
258 258
 
259 259
 	/**
@@ -262,7 +262,7 @@  discard block
 block discarded – undo
262 262
 	 * @param WPInv_Invoice $invoice Invoice object.
263 263
 	 * @return string
264 264
 	 */
265
-	public function get_return_url( $invoice ) {
265
+	public function get_return_url($invoice) {
266 266
 
267 267
 		// Payment success url
268 268
 		$return_url = add_query_arg(
@@ -274,7 +274,7 @@  discard block
 block discarded – undo
274 274
 			wpinv_get_success_page_uri()
275 275
 		);
276 276
 
277
-		return apply_filters( 'getpaid_gateway_success_url', $return_url, $invoice, $this );
277
+		return apply_filters('getpaid_gateway_success_url', $return_url, $invoice, $this);
278 278
 	}
279 279
 
280 280
 	/**
@@ -283,24 +283,24 @@  discard block
 block discarded – undo
283 283
 	 * @param string $content Success page content.
284 284
 	 * @return string
285 285
 	 */
286
-	public function confirm_payment( $content ) {
286
+	public function confirm_payment($content) {
287 287
 
288 288
 		// Retrieve the invoice.
289 289
 		$invoice_id = getpaid_get_current_invoice_id();
290
-		$invoice    = wpinv_get_invoice( $invoice_id );
290
+		$invoice    = wpinv_get_invoice($invoice_id);
291 291
 
292 292
 		// Ensure that it exists and that it is pending payment.
293
-		if ( empty( $invoice_id ) || ! $invoice->needs_payment() ) {
293
+		if (empty($invoice_id) || !$invoice->needs_payment()) {
294 294
 			return $content;
295 295
 		}
296 296
 
297 297
 		// Can the user view this invoice??
298
-		if ( ! wpinv_user_can_view_invoice( $invoice ) ) {
298
+		if (!wpinv_user_can_view_invoice($invoice)) {
299 299
 			return $content;
300 300
 		}
301 301
 
302 302
 		// Show payment processing indicator.
303
-		return wpinv_get_template_html( 'wpinv-payment-processing.php', compact( 'invoice' ) );
303
+		return wpinv_get_template_html('wpinv-payment-processing.php', compact('invoice'));
304 304
 	}
305 305
 
306 306
 	/**
@@ -317,7 +317,7 @@  discard block
 block discarded – undo
317 317
 	 * @param GetPaid_Form_Item[] $items
318 318
 	 * @return WPInv_Invoice
319 319
 	 */
320
-	public function process_addons( $invoice, $items ) {
320
+	public function process_addons($invoice, $items) {
321 321
 
322 322
 	}
323 323
 
@@ -328,14 +328,14 @@  discard block
 block discarded – undo
328 328
 	 * @param WPInv_Invoice $invoice Invoice object.
329 329
 	 * @return string transaction URL, or empty string.
330 330
 	 */
331
-	public function filter_transaction_url( $transaction_url, $invoice ) {
331
+	public function filter_transaction_url($transaction_url, $invoice) {
332 332
 
333
-		$transaction_id  = $invoice->get_transaction_id();
333
+		$transaction_id = $invoice->get_transaction_id();
334 334
 
335
-		if ( ! empty( $this->view_transaction_url ) && ! empty( $transaction_id ) ) {
336
-			$transaction_url = sprintf( $this->view_transaction_url, $transaction_id );
337
-			$replace         = $this->is_sandbox( $invoice ) ? 'sandbox' : '';
338
-			$transaction_url = str_replace( '{sandbox}', $replace, $transaction_url );
335
+		if (!empty($this->view_transaction_url) && !empty($transaction_id)) {
336
+			$transaction_url = sprintf($this->view_transaction_url, $transaction_id);
337
+			$replace         = $this->is_sandbox($invoice) ? 'sandbox' : '';
338
+			$transaction_url = str_replace('{sandbox}', $replace, $transaction_url);
339 339
 		}
340 340
 
341 341
 		return $transaction_url;
@@ -348,15 +348,15 @@  discard block
 block discarded – undo
348 348
 	 * @param WPInv_Subscription $subscription Subscription objectt.
349 349
 	 * @return string subscription URL, or empty string.
350 350
 	 */
351
-	public function generate_subscription_url( $subscription_url, $subscription ) {
351
+	public function generate_subscription_url($subscription_url, $subscription) {
352 352
 
353
-		$profile_id      = $subscription->get_profile_id();
353
+		$profile_id = $subscription->get_profile_id();
354 354
 
355
-		if ( $this->id == $subscription->get_gateway() && ! empty( $this->view_subscription_url ) && ! empty( $profile_id ) ) {
355
+		if ($this->id == $subscription->get_gateway() && !empty($this->view_subscription_url) && !empty($profile_id)) {
356 356
 
357
-			$subscription_url = sprintf( $this->view_subscription_url, $profile_id );
358
-			$replace          = $this->is_sandbox( $subscription->get_parent_invoice() ) ? 'sandbox' : '';
359
-			$subscription_url = str_replace( '{sandbox}', $replace, $subscription_url );
357
+			$subscription_url = sprintf($this->view_subscription_url, $profile_id);
358
+			$replace          = $this->is_sandbox($subscription->get_parent_invoice()) ? 'sandbox' : '';
359
+			$subscription_url = str_replace('{sandbox}', $replace, $subscription_url);
360 360
 
361 361
 		}
362 362
 
@@ -369,7 +369,7 @@  discard block
 block discarded – undo
369 369
 	 * @return bool
370 370
 	 */
371 371
 	public function is_available() {
372
-		return ! empty( $this->enabled );
372
+		return !empty($this->enabled);
373 373
 	}
374 374
 
375 375
 	/**
@@ -378,7 +378,7 @@  discard block
 block discarded – undo
378 378
 	 * @return string
379 379
 	 */
380 380
 	public function get_title() {
381
-		return apply_filters( 'getpaid_gateway_title', $this->title, $this );
381
+		return apply_filters('getpaid_gateway_title', $this->title, $this);
382 382
 	}
383 383
 
384 384
 	/**
@@ -387,7 +387,7 @@  discard block
 block discarded – undo
387 387
 	 * @return string
388 388
 	 */
389 389
 	public function get_description() {
390
-		return apply_filters( 'getpaid_gateway_description', $this->description, $this );
390
+		return apply_filters('getpaid_gateway_description', $this->description, $this);
391 391
 	}
392 392
 
393 393
 	/**
@@ -399,9 +399,9 @@  discard block
 block discarded – undo
399 399
 	 * @param GetPaid_Payment_Form_Submission $submission Checkout submission.
400 400
 	 * @return void
401 401
 	 */
402
-	public function process_payment( $invoice, $submission_data, $submission ) {
402
+	public function process_payment($invoice, $submission_data, $submission) {
403 403
 		// Process the payment then either redirect to the success page or the gateway.
404
-		do_action( 'getpaid_process_invoice_payment_' . $this->id, $invoice, $submission_data, $submission );
404
+		do_action('getpaid_process_invoice_payment_' . $this->id, $invoice, $submission_data, $submission);
405 405
 	}
406 406
 
407 407
 	/**
@@ -415,8 +415,8 @@  discard block
 block discarded – undo
415 415
 	 * @param  string $reason Refund reason.
416 416
 	 * @return WP_Error|bool True or false based on success, or a WP_Error object.
417 417
 	 */
418
-	public function process_refund( $invoice, $amount = null, $reason = '' ) {
419
-		return apply_filters( 'getpaid_process_invoice_refund_' . $this->id, false, $invoice, $amount, $reason );
418
+	public function process_refund($invoice, $amount = null, $reason = '') {
419
+		return apply_filters('getpaid_process_invoice_refund_' . $this->id, false, $invoice, $amount, $reason);
420 420
 	}
421 421
 
422 422
 	/**
@@ -425,8 +425,8 @@  discard block
 block discarded – undo
425 425
 	 * @param int $invoice_id 0 or invoice id.
426 426
 	 * @param GetPaid_Payment_Form $form Current payment form.
427 427
 	 */
428
-	public function payment_fields( $invoice_id, $form ) {
429
-		do_action( 'getpaid_getpaid_gateway_payment_fields_' . $this->id, $invoice_id, $form );
428
+	public function payment_fields($invoice_id, $form) {
429
+		do_action('getpaid_getpaid_gateway_payment_fields_' . $this->id, $invoice_id, $form);
430 430
 	}
431 431
 
432 432
 	/**
@@ -434,7 +434,7 @@  discard block
 block discarded – undo
434 434
 	 *
435 435
 	 * @param array $admin_settings
436 436
 	 */
437
-	public function admin_settings( $admin_settings ) {
437
+	public function admin_settings($admin_settings) {
438 438
 		return $admin_settings;
439 439
 	}
440 440
 
@@ -443,8 +443,8 @@  discard block
 block discarded – undo
443 443
 	 *
444 444
 	 * @param string $option
445 445
 	 */
446
-	public function get_option( $option, $default = false ) {
447
-		return wpinv_get_option( $this->id . '_' . $option, $default );
446
+	public function get_option($option, $default = false) {
447
+		return wpinv_get_option($this->id . '_' . $option, $default);
448 448
 	}
449 449
 
450 450
 	/**
@@ -457,8 +457,8 @@  discard block
 block discarded – undo
457 457
 	 * @return bool True if the gateway supports the feature, false otherwise.
458 458
 	 * @since 1.0.19
459 459
 	 */
460
-	public function supports( $feature ) {
461
-		return getpaid_payment_gateway_supports( $this->id, $feature );
460
+	public function supports($feature) {
461
+		return getpaid_payment_gateway_supports($this->id, $feature);
462 462
 	}
463 463
 
464 464
 	/**
@@ -466,39 +466,39 @@  discard block
 block discarded – undo
466 466
 	 *
467 467
 	 * @param bool $save whether or not to display the save button.
468 468
 	 */
469
-    public function get_cc_form( $save = false ) {
469
+    public function get_cc_form($save = false) {
470 470
 
471 471
 		ob_start();
472 472
 
473
-        $id_prefix = esc_attr( uniqid( $this->id ) );
473
+        $id_prefix = esc_attr(uniqid($this->id));
474 474
 
475 475
         $months = array(
476
-            '01' => __( 'January', 'invoicing' ),
477
-            '02' => __( 'February', 'invoicing' ),
478
-            '03' => __( 'March', 'invoicing' ),
479
-            '04' => __( 'April', 'invoicing' ),
480
-            '05' => __( 'May', 'invoicing' ),
481
-            '06' => __( 'June', 'invoicing' ),
482
-            '07' => __( 'July', 'invoicing' ),
483
-            '08' => __( 'August', 'invoicing' ),
484
-            '09' => __( 'September', 'invoicing' ),
485
-            '10' => __( 'October', 'invoicing' ),
486
-            '11' => __( 'November', 'invoicing' ),
487
-            '12' => __( 'December', 'invoicing' ),
476
+            '01' => __('January', 'invoicing'),
477
+            '02' => __('February', 'invoicing'),
478
+            '03' => __('March', 'invoicing'),
479
+            '04' => __('April', 'invoicing'),
480
+            '05' => __('May', 'invoicing'),
481
+            '06' => __('June', 'invoicing'),
482
+            '07' => __('July', 'invoicing'),
483
+            '08' => __('August', 'invoicing'),
484
+            '09' => __('September', 'invoicing'),
485
+            '10' => __('October', 'invoicing'),
486
+            '11' => __('November', 'invoicing'),
487
+            '12' => __('December', 'invoicing'),
488 488
         );
489
-		$months = apply_filters( 'getpaid_cc_months', $months, $this );
489
+		$months = apply_filters('getpaid_cc_months', $months, $this);
490 490
 
491
-        $year  = (int) current_time( 'Y' );
491
+        $year  = (int) current_time('Y');
492 492
         $years = array();
493 493
 
494
-        for ( $i = 0; $i <= 10; $i++ ) {
495
-            $years[ $year + $i ] = $year + $i;
494
+        for ($i = 0; $i <= 10; $i++) {
495
+            $years[$year + $i] = $year + $i;
496 496
         }
497 497
 
498
-		$years = apply_filters( 'getpaid_cc_years', $years, $this );
498
+		$years = apply_filters('getpaid_cc_years', $years, $this);
499 499
 
500 500
         ?>
501
-            <div class="<?php echo esc_attr( $this->id ); ?>-cc-form getpaid-cc-form mt-1">
501
+            <div class="<?php echo esc_attr($this->id); ?>-cc-form getpaid-cc-form mt-1">
502 502
 
503 503
 
504 504
                 <div class="getpaid-cc-card-inner">
@@ -507,9 +507,9 @@  discard block
 block discarded – undo
507 507
                         <div class="col-12">
508 508
 
509 509
 							<div class="form-group mb-3">
510
-								<label for="<?php echo esc_attr( "$id_prefix-cc-number" ); ?>"><?php esc_html_e( 'Card number', 'invoicing' ); ?></label>
510
+								<label for="<?php echo esc_attr("$id_prefix-cc-number"); ?>"><?php esc_html_e('Card number', 'invoicing'); ?></label>
511 511
 								<div class="input-group input-group-sm">
512
-									<?php if ( empty( $GLOBALS['aui_bs5'] ) ) : ?>
512
+									<?php if (empty($GLOBALS['aui_bs5'])) : ?>
513 513
                                         <div class="input-group-prepend ">
514 514
 											<span class="input-group-text">
515 515
 												<i class="fa fa-credit-card"></i>
@@ -520,7 +520,7 @@  discard block
 block discarded – undo
520 520
 											<i class="fa fa-credit-card"></i>
521 521
 										</span>
522 522
                                     <?php endif; ?>
523
-									<input type="text" name="<?php echo esc_attr( $this->id . '[cc_number]' ); ?>" id="<?php echo esc_attr( "$id_prefix-cc-number" ); ?>" class="form-control form-control-sm getpaid-format-card-number" autocomplete="cc-number">
523
+									<input type="text" name="<?php echo esc_attr($this->id . '[cc_number]'); ?>" id="<?php echo esc_attr("$id_prefix-cc-number"); ?>" class="form-control form-control-sm getpaid-format-card-number" autocomplete="cc-number">
524 524
 								</div>
525 525
 							</div>
526 526
 
@@ -528,16 +528,16 @@  discard block
 block discarded – undo
528 528
 
529 529
                         <div class="col-12">
530 530
                             <div class="form-group mb-3">
531
-                                <label><?php esc_html_e( 'Expiration', 'invoicing' ); ?></label>
531
+                                <label><?php esc_html_e('Expiration', 'invoicing'); ?></label>
532 532
                                 <div class="form-row row">
533 533
 
534 534
                                     <div class="col">
535
-                                        <select class="form-control form-control-sm" autocomplete="cc-exp-month" name="<?php echo esc_attr( $this->id ); ?>[cc_expire_month]">
536
-                                            <option disabled selected="selected"><?php esc_html_e( 'MM', 'invoicing' ); ?></option>
535
+                                        <select class="form-control form-control-sm" autocomplete="cc-exp-month" name="<?php echo esc_attr($this->id); ?>[cc_expire_month]">
536
+                                            <option disabled selected="selected"><?php esc_html_e('MM', 'invoicing'); ?></option>
537 537
 
538 538
                                             <?php
539
-                                                foreach ( $months as $key => $month ) {
540
-												echo "<option value='" . esc_attr( $key ) . "'>" . esc_html( $month ) . '</option>';
539
+                                                foreach ($months as $key => $month) {
540
+												echo "<option value='" . esc_attr($key) . "'>" . esc_html($month) . '</option>';
541 541
                                                 }
542 542
                                             ?>
543 543
 
@@ -545,12 +545,12 @@  discard block
 block discarded – undo
545 545
                                     </div>
546 546
 
547 547
                                     <div class="col">
548
-                                        <select class="form-control form-control-sm" autocomplete="cc-exp-year" name="<?php echo esc_attr( $this->id ); ?>[cc_expire_year]">
549
-                                            <option disabled selected="selected"><?php esc_html_e( 'YY', 'invoicing' ); ?></option>
548
+                                        <select class="form-control form-control-sm" autocomplete="cc-exp-year" name="<?php echo esc_attr($this->id); ?>[cc_expire_year]">
549
+                                            <option disabled selected="selected"><?php esc_html_e('YY', 'invoicing'); ?></option>
550 550
 
551 551
                                             <?php
552
-                                                foreach ( $years as $key => $year ) {
553
-												echo "<option value='" . esc_attr( $key ) . "'>" . esc_html( $year ) . '</option>';
552
+                                                foreach ($years as $key => $year) {
553
+												echo "<option value='" . esc_attr($key) . "'>" . esc_html($year) . '</option>';
554 554
                                                 }
555 555
                                             ?>
556 556
 
@@ -567,7 +567,7 @@  discard block
 block discarded – undo
567 567
                                     array(
568 568
                                         'name'             => $this->id . '[cc_cvv2]',
569 569
                                         'id'               => "$id_prefix-cc-cvv2",
570
-                                        'label'            => __( 'CCV', 'invoicing' ),
570
+                                        'label'            => __('CCV', 'invoicing'),
571 571
 										'label_type'       => 'vertical',
572 572
 										'class'            => 'form-control-sm',
573 573
 										'extra_attributes' => array(
@@ -583,7 +583,7 @@  discard block
 block discarded – undo
583 583
 
584 584
 					<?php
585 585
 
586
-						if ( $save ) {
586
+						if ($save) {
587 587
 							$this->save_payment_method_checkbox();
588 588
 						}
589 589
 
@@ -602,8 +602,8 @@  discard block
 block discarded – undo
602 602
 	 *
603 603
 	 * @since 1.0.19
604 604
 	 */
605
-	public function new_payment_method_entry( $form ) {
606
-		echo "<div class='getpaid-new-payment-method-form' style='display:none;'> " . wp_kses( $form, getpaid_allowed_html() ) . '</div>';
605
+	public function new_payment_method_entry($form) {
606
+		echo "<div class='getpaid-new-payment-method-form' style='display:none;'> " . wp_kses($form, getpaid_allowed_html()) . '</div>';
607 607
 	}
608 608
 
609 609
 	/**
@@ -612,10 +612,10 @@  discard block
 block discarded – undo
612 612
 	 * @since 1.0.19
613 613
 	 */
614 614
 	public function saved_payment_methods() {
615
-		echo '<ul class="getpaid-saved-payment-methods list-unstyled m-0 mt-2" data-count="' . esc_attr( count( $this->get_tokens( $this->is_sandbox() ) ) ) . '">';
615
+		echo '<ul class="getpaid-saved-payment-methods list-unstyled m-0 mt-2" data-count="' . esc_attr(count($this->get_tokens($this->is_sandbox()))) . '">';
616 616
 
617
-		foreach ( $this->get_tokens( $this->is_sandbox() ) as $token ) {
618
-			$this->get_saved_payment_method_option_html( $token );
617
+		foreach ($this->get_tokens($this->is_sandbox()) as $token) {
618
+			$this->get_saved_payment_method_option_html($token);
619 619
 		}
620 620
 
621 621
 		$this->get_new_payment_method_option_html();
@@ -630,7 +630,7 @@  discard block
 block discarded – undo
630 630
 	 * @param  array $token Payment Token.
631 631
 	 * @return string Generated payment method HTML
632 632
 	 */
633
-	public function get_saved_payment_method_option_html( $token ) {
633
+	public function get_saved_payment_method_option_html($token) {
634 634
 
635 635
 		printf(
636 636
 			'<li class="getpaid-payment-method form-group mb-3">
@@ -639,11 +639,11 @@  discard block
 block discarded – undo
639 639
 					<span>%3$s</span>
640 640
 				</label>
641 641
 			</li>',
642
-			esc_attr( $this->id ),
643
-			esc_attr( $token['id'] ),
644
-			esc_html( $token['name'] ),
645
-			checked( empty( $token['default'] ), false, false ),
646
-			empty( $token['currency'] ) ? 'none' : esc_attr( $token['currency'] )
642
+			esc_attr($this->id),
643
+			esc_attr($token['id']),
644
+			esc_html($token['name']),
645
+			checked(empty($token['default']), false, false),
646
+			empty($token['currency']) ? 'none' : esc_attr($token['currency'])
647 647
 		);
648 648
 
649 649
 	}
@@ -655,7 +655,7 @@  discard block
 block discarded – undo
655 655
 	 */
656 656
 	public function get_new_payment_method_option_html() {
657 657
 
658
-		$label = apply_filters( 'getpaid_new_payment_method_label', $this->new_method_label ? $this->new_method_label : __( 'Use a new payment method', 'invoicing' ), $this );
658
+		$label = apply_filters('getpaid_new_payment_method_label', $this->new_method_label ? $this->new_method_label : __('Use a new payment method', 'invoicing'), $this);
659 659
 
660 660
 		printf(
661 661
 			'<li class="getpaid-new-payment-method">
@@ -664,8 +664,8 @@  discard block
 block discarded – undo
664 664
 					<span>%2$s</span>
665 665
 				</label>
666 666
 			</li>',
667
-			esc_attr( $this->id ),
668
-			esc_html( $label )
667
+			esc_attr($this->id),
668
+			esc_html($label)
669 669
 		);
670 670
 
671 671
 	}
@@ -680,10 +680,10 @@  discard block
 block discarded – undo
680 680
 		aui()->input(
681 681
 			array(
682 682
 				'type'       => 'checkbox',
683
-				'name'       => esc_attr( "getpaid-$this->id-new-payment-method" ),
684
-				'id'         => esc_attr( uniqid( $this->id ) ),
683
+				'name'       => esc_attr("getpaid-$this->id-new-payment-method"),
684
+				'id'         => esc_attr(uniqid($this->id)),
685 685
 				'required'   => false,
686
-				'label'      => esc_html__( 'Save payment method', 'invoicing' ),
686
+				'label'      => esc_html__('Save payment method', 'invoicing'),
687 687
 				'value'      => 'true',
688 688
 				'checked'    => true,
689 689
 				'wrap_class' => 'getpaid-save-payment-method pt-1 pb-1',
@@ -698,9 +698,9 @@  discard block
 block discarded – undo
698 698
 	 *
699 699
 	 * @return array
700 700
 	 */
701
-	public function register_gateway( $gateways ) {
701
+	public function register_gateway($gateways) {
702 702
 
703
-		$gateways[ $this->id ] = array(
703
+		$gateways[$this->id] = array(
704 704
 
705 705
 			'admin_label'    => $this->method_title,
706 706
             'checkout_label' => $this->title,
@@ -718,13 +718,13 @@  discard block
 block discarded – undo
718 718
 	 * @param  WPInv_Invoice|null $invoice Invoice object or null.
719 719
 	 * @return bool
720 720
 	 */
721
-	public function is_sandbox( $invoice = null ) {
721
+	public function is_sandbox($invoice = null) {
722 722
 
723
-		if ( ! empty( $invoice ) && ! $invoice->needs_payment() ) {
723
+		if (!empty($invoice) && !$invoice->needs_payment()) {
724 724
 			return $invoice->get_mode() == 'test';
725 725
 		}
726 726
 
727
-		return wpinv_is_test_mode( $this->id );
727
+		return wpinv_is_test_mode($this->id);
728 728
 
729 729
 	}
730 730
 
@@ -742,15 +742,15 @@  discard block
 block discarded – undo
742 742
 	 *
743 743
 	 * @return bool
744 744
 	 */
745
-	public function validate_currency( $validation, $currency ) {
745
+	public function validate_currency($validation, $currency) {
746 746
 
747 747
 		// Required currencies.
748
-		if ( ! empty( $this->currencies ) && ! in_array( $currency, $this->currencies ) ) {
748
+		if (!empty($this->currencies) && !in_array($currency, $this->currencies)) {
749 749
 			return false;
750 750
 		}
751 751
 
752 752
 		// Excluded currencies.
753
-		if ( ! empty( $this->exclude_currencies ) && in_array( $currency, $this->exclude_currencies ) ) {
753
+		if (!empty($this->exclude_currencies) && in_array($currency, $this->exclude_currencies)) {
754 754
 			return false;
755 755
 		}
756 756
 
@@ -761,13 +761,13 @@  discard block
 block discarded – undo
761 761
 	 * Displays an error
762 762
 	 *
763 763
 	 */
764
-	public function show_error( $code, $message, $type ) {
764
+	public function show_error($code, $message, $type) {
765 765
 
766
-		if ( is_admin() ) {
767
-			getpaid_admin()->{"show_$type"}( $message );
766
+		if (is_admin()) {
767
+			getpaid_admin()->{"show_$type"}($message);
768 768
 		}
769 769
 
770
-		wpinv_set_error( $code, $message, $type );
770
+		wpinv_set_error($code, $message, $type);
771 771
 
772 772
 	}
773 773
 
Please login to merge, or discard this patch.