@@ -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 | * Abstaract Payment Gateway class. |
@@ -139,55 +139,55 @@ discard block |
||
| 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 | // Enable Subscriptions. |
| 147 | - if ( $this->supports( 'subscription' ) ) { |
|
| 148 | - add_filter( "wpinv_{$this->id}_support_subscription", '__return_true' ); |
|
| 147 | + if ($this->supports('subscription')) { |
|
| 148 | + add_filter("wpinv_{$this->id}_support_subscription", '__return_true'); |
|
| 149 | 149 | } |
| 150 | 150 | |
| 151 | 151 | // Enable sandbox. |
| 152 | - if ( $this->supports( 'sandbox' ) ) { |
|
| 153 | - add_filter( "wpinv_{$this->id}_supports_sandbox", '__return_true' ); |
|
| 152 | + if ($this->supports('sandbox')) { |
|
| 153 | + add_filter("wpinv_{$this->id}_supports_sandbox", '__return_true'); |
|
| 154 | 154 | } |
| 155 | 155 | |
| 156 | 156 | // Invoice addons. |
| 157 | - if ( $this->supports( 'addons' ) ) { |
|
| 158 | - add_filter( "getpaid_{$this->id}_supports_addons", '__return_true' ); |
|
| 159 | - add_action( "getpaid_process_{$this->id}_invoice_addons", array( $this, 'process_addons' ), 10, 2 ); |
|
| 157 | + if ($this->supports('addons')) { |
|
| 158 | + add_filter("getpaid_{$this->id}_supports_addons", '__return_true'); |
|
| 159 | + add_action("getpaid_process_{$this->id}_invoice_addons", array($this, 'process_addons'), 10, 2); |
|
| 160 | 160 | } |
| 161 | 161 | |
| 162 | 162 | // Gateway settings. |
| 163 | - add_filter( "wpinv_gateway_settings_{$this->id}", array( $this, 'admin_settings' ) ); |
|
| 163 | + add_filter("wpinv_gateway_settings_{$this->id}", array($this, 'admin_settings')); |
|
| 164 | 164 | |
| 165 | 165 | |
| 166 | 166 | // Gateway checkout fiellds. |
| 167 | - add_action( "wpinv_{$this->id}_cc_form", array( $this, 'payment_fields' ), 10, 2 ); |
|
| 167 | + add_action("wpinv_{$this->id}_cc_form", array($this, 'payment_fields'), 10, 2); |
|
| 168 | 168 | |
| 169 | 169 | // Process payment. |
| 170 | - add_action( "getpaid_gateway_{$this->id}", array( $this, 'process_payment' ), 10, 3 ); |
|
| 170 | + add_action("getpaid_gateway_{$this->id}", array($this, 'process_payment'), 10, 3); |
|
| 171 | 171 | |
| 172 | 172 | // Change the checkout button text. |
| 173 | - if ( ! empty( $this->checkout_button_text ) ) { |
|
| 174 | - add_filter( "getpaid_gateway_{$this->id}_checkout_button_label", array( $this, 'rename_checkout_button' ) ); |
|
| 173 | + if (!empty($this->checkout_button_text)) { |
|
| 174 | + add_filter("getpaid_gateway_{$this->id}_checkout_button_label", array($this, 'rename_checkout_button')); |
|
| 175 | 175 | } |
| 176 | 176 | |
| 177 | 177 | // Check if a gateway is valid for a given currency. |
| 178 | - add_filter( "getpaid_gateway_{$this->id}_is_valid_for_currency", array( $this, 'validate_currency' ), 10, 2 ); |
|
| 178 | + add_filter("getpaid_gateway_{$this->id}_is_valid_for_currency", array($this, 'validate_currency'), 10, 2); |
|
| 179 | 179 | |
| 180 | 180 | // Generate the transaction url. |
| 181 | - add_filter( "getpaid_gateway_{$this->id}_transaction_url", array( $this, 'filter_transaction_url' ), 10, 2 ); |
|
| 181 | + add_filter("getpaid_gateway_{$this->id}_transaction_url", array($this, 'filter_transaction_url'), 10, 2); |
|
| 182 | 182 | |
| 183 | 183 | // Generate the subscription url. |
| 184 | - add_filter( "getpaid_gateway_{$this->id}_subscription_url", array( $this, 'filter_subscription_url' ), 10, 2 ); |
|
| 184 | + add_filter("getpaid_gateway_{$this->id}_subscription_url", array($this, 'filter_subscription_url'), 10, 2); |
|
| 185 | 185 | |
| 186 | 186 | // Confirm payments. |
| 187 | - add_filter( "wpinv_payment_confirm_{$this->id}", array( $this, 'confirm_payment' ), 10, 2 ); |
|
| 187 | + add_filter("wpinv_payment_confirm_{$this->id}", array($this, 'confirm_payment'), 10, 2); |
|
| 188 | 188 | |
| 189 | 189 | // Verify IPNs. |
| 190 | - add_action( "wpinv_verify_{$this->id}_ipn", array( $this, 'verify_ipn' ) ); |
|
| 190 | + add_action("wpinv_verify_{$this->id}_ipn", array($this, 'verify_ipn')); |
|
| 191 | 191 | |
| 192 | 192 | } |
| 193 | 193 | |
@@ -197,7 +197,7 @@ discard block |
||
| 197 | 197 | * @since 1.0.19 |
| 198 | 198 | * @return bool |
| 199 | 199 | */ |
| 200 | - public function is( $gateway ) { |
|
| 200 | + public function is($gateway) { |
|
| 201 | 201 | return $gateway == $this->id; |
| 202 | 202 | } |
| 203 | 203 | |
@@ -207,23 +207,23 @@ discard block |
||
| 207 | 207 | * @since 1.0.19 |
| 208 | 208 | * @return array |
| 209 | 209 | */ |
| 210 | - public function get_tokens( $sandbox = null ) { |
|
| 210 | + public function get_tokens($sandbox = null) { |
|
| 211 | 211 | |
| 212 | - if ( is_user_logged_in() && $this->supports( 'tokens' ) && 0 == count( $this->tokens ) ) { |
|
| 213 | - $tokens = get_user_meta( get_current_user_id(), "getpaid_{$this->id}_tokens", true ); |
|
| 212 | + if (is_user_logged_in() && $this->supports('tokens') && 0 == count($this->tokens)) { |
|
| 213 | + $tokens = get_user_meta(get_current_user_id(), "getpaid_{$this->id}_tokens", true); |
|
| 214 | 214 | |
| 215 | - if ( is_array( $tokens ) ) { |
|
| 215 | + if (is_array($tokens)) { |
|
| 216 | 216 | $this->tokens = $tokens; |
| 217 | 217 | } |
| 218 | 218 | |
| 219 | 219 | } |
| 220 | 220 | |
| 221 | - if ( ! is_bool( $sandbox ) ) { |
|
| 221 | + if (!is_bool($sandbox)) { |
|
| 222 | 222 | return $this->tokens; |
| 223 | 223 | } |
| 224 | 224 | |
| 225 | - $args = array( 'type' => $sandbox ? 'sandbox' : 'live' ); |
|
| 226 | - return wp_list_filter( $this->tokens, $args ); |
|
| 225 | + $args = array('type' => $sandbox ? 'sandbox' : 'live'); |
|
| 226 | + return wp_list_filter($this->tokens, $args); |
|
| 227 | 227 | |
| 228 | 228 | } |
| 229 | 229 | |
@@ -232,12 +232,12 @@ discard block |
||
| 232 | 232 | * |
| 233 | 233 | * @since 1.0.19 |
| 234 | 234 | */ |
| 235 | - public function save_token( $token ) { |
|
| 235 | + public function save_token($token) { |
|
| 236 | 236 | |
| 237 | 237 | $tokens = $this->get_tokens(); |
| 238 | 238 | $tokens[] = $token; |
| 239 | 239 | |
| 240 | - update_user_meta( get_current_user_id(), "getpaid_{$this->id}_tokens", $tokens ); |
|
| 240 | + update_user_meta(get_current_user_id(), "getpaid_{$this->id}_tokens", $tokens); |
|
| 241 | 241 | |
| 242 | 242 | $this->tokens = $tokens; |
| 243 | 243 | |
@@ -249,7 +249,7 @@ discard block |
||
| 249 | 249 | * @return string |
| 250 | 250 | */ |
| 251 | 251 | public function get_method_title() { |
| 252 | - return apply_filters( 'getpaid_gateway_method_title', $this->method_title, $this ); |
|
| 252 | + return apply_filters('getpaid_gateway_method_title', $this->method_title, $this); |
|
| 253 | 253 | } |
| 254 | 254 | |
| 255 | 255 | /** |
@@ -258,7 +258,7 @@ discard block |
||
| 258 | 258 | * @return string |
| 259 | 259 | */ |
| 260 | 260 | public function get_method_description() { |
| 261 | - return apply_filters( 'getpaid_gateway_method_description', $this->method_description, $this ); |
|
| 261 | + return apply_filters('getpaid_gateway_method_description', $this->method_description, $this); |
|
| 262 | 262 | } |
| 263 | 263 | |
| 264 | 264 | /** |
@@ -267,7 +267,7 @@ discard block |
||
| 267 | 267 | * @param WPInv_Invoice $invoice Invoice object. |
| 268 | 268 | * @return string |
| 269 | 269 | */ |
| 270 | - public function get_return_url( $invoice ) { |
|
| 270 | + public function get_return_url($invoice) { |
|
| 271 | 271 | |
| 272 | 272 | // Payment success url |
| 273 | 273 | $return_url = add_query_arg( |
@@ -279,7 +279,7 @@ discard block |
||
| 279 | 279 | wpinv_get_success_page_uri() |
| 280 | 280 | ); |
| 281 | 281 | |
| 282 | - return apply_filters( 'getpaid_gateway_success_url', $return_url, $invoice, $this ); |
|
| 282 | + return apply_filters('getpaid_gateway_success_url', $return_url, $invoice, $this); |
|
| 283 | 283 | } |
| 284 | 284 | |
| 285 | 285 | /** |
@@ -288,24 +288,24 @@ discard block |
||
| 288 | 288 | * @param string $content Success page content. |
| 289 | 289 | * @return string |
| 290 | 290 | */ |
| 291 | - public function confirm_payment( $content ) { |
|
| 291 | + public function confirm_payment($content) { |
|
| 292 | 292 | |
| 293 | 293 | // Retrieve the invoice. |
| 294 | 294 | $invoice_id = getpaid_get_current_invoice_id(); |
| 295 | - $invoice = wpinv_get_invoice( $invoice_id ); |
|
| 295 | + $invoice = wpinv_get_invoice($invoice_id); |
|
| 296 | 296 | |
| 297 | 297 | // Ensure that it exists and that it is pending payment. |
| 298 | - if ( empty( $invoice_id ) || ! $invoice->needs_payment() ) { |
|
| 298 | + if (empty($invoice_id) || !$invoice->needs_payment()) { |
|
| 299 | 299 | return $content; |
| 300 | 300 | } |
| 301 | 301 | |
| 302 | 302 | // Can the user view this invoice?? |
| 303 | - if ( ! wpinv_user_can_view_invoice( $invoice ) ) { |
|
| 303 | + if (!wpinv_user_can_view_invoice($invoice)) { |
|
| 304 | 304 | return $content; |
| 305 | 305 | } |
| 306 | 306 | |
| 307 | 307 | // Show payment processing indicator. |
| 308 | - return wpinv_get_template_html( 'wpinv-payment-processing.php', compact( 'invoice' ) ); |
|
| 308 | + return wpinv_get_template_html('wpinv-payment-processing.php', compact('invoice')); |
|
| 309 | 309 | } |
| 310 | 310 | |
| 311 | 311 | /** |
@@ -322,7 +322,7 @@ discard block |
||
| 322 | 322 | * @param GetPaid_Form_Item[] $items |
| 323 | 323 | * @return WPInv_Invoice |
| 324 | 324 | */ |
| 325 | - public function process_addons( $invoice, $items ) { |
|
| 325 | + public function process_addons($invoice, $items) { |
|
| 326 | 326 | |
| 327 | 327 | } |
| 328 | 328 | |
@@ -333,14 +333,14 @@ discard block |
||
| 333 | 333 | * @param WPInv_Invoice $invoice Invoice object. |
| 334 | 334 | * @return string transaction URL, or empty string. |
| 335 | 335 | */ |
| 336 | - public function filter_transaction_url( $transaction_url, $invoice ) { |
|
| 336 | + public function filter_transaction_url($transaction_url, $invoice) { |
|
| 337 | 337 | |
| 338 | - $transaction_id = $invoice->get_transaction_id(); |
|
| 338 | + $transaction_id = $invoice->get_transaction_id(); |
|
| 339 | 339 | |
| 340 | - if ( ! empty( $this->view_transaction_url ) && ! empty( $transaction_id ) ) { |
|
| 341 | - $transaction_url = sprintf( $this->view_transaction_url, $transaction_id ); |
|
| 342 | - $replace = $this->is_sandbox( $invoice ) ? 'sandbox' : ''; |
|
| 343 | - $transaction_url = str_replace( '{sandbox}', $replace, $transaction_url ); |
|
| 340 | + if (!empty($this->view_transaction_url) && !empty($transaction_id)) { |
|
| 341 | + $transaction_url = sprintf($this->view_transaction_url, $transaction_id); |
|
| 342 | + $replace = $this->is_sandbox($invoice) ? 'sandbox' : ''; |
|
| 343 | + $transaction_url = str_replace('{sandbox}', $replace, $transaction_url); |
|
| 344 | 344 | } |
| 345 | 345 | |
| 346 | 346 | return $transaction_url; |
@@ -353,15 +353,15 @@ discard block |
||
| 353 | 353 | * @param WPInv_Invoice $invoice Invoice object. |
| 354 | 354 | * @return string subscription URL, or empty string. |
| 355 | 355 | */ |
| 356 | - public function filter_subscription_url( $subscription_url, $invoice ) { |
|
| 356 | + public function filter_subscription_url($subscription_url, $invoice) { |
|
| 357 | 357 | |
| 358 | - $profile_id = $invoice->get_subscription_id(); |
|
| 358 | + $profile_id = $invoice->get_subscription_id(); |
|
| 359 | 359 | |
| 360 | - if ( ! empty( $this->view_subscription_url ) && ! empty( $profile_id ) ) { |
|
| 360 | + if (!empty($this->view_subscription_url) && !empty($profile_id)) { |
|
| 361 | 361 | |
| 362 | - $subscription_url = sprintf( $this->view_subscription_url, $profile_id ); |
|
| 363 | - $replace = $this->is_sandbox( $invoice ) ? 'sandbox' : ''; |
|
| 364 | - $subscription_url = str_replace( '{sandbox}', $replace, $subscription_url ); |
|
| 362 | + $subscription_url = sprintf($this->view_subscription_url, $profile_id); |
|
| 363 | + $replace = $this->is_sandbox($invoice) ? 'sandbox' : ''; |
|
| 364 | + $subscription_url = str_replace('{sandbox}', $replace, $subscription_url); |
|
| 365 | 365 | |
| 366 | 366 | } |
| 367 | 367 | |
@@ -374,7 +374,7 @@ discard block |
||
| 374 | 374 | * @return bool |
| 375 | 375 | */ |
| 376 | 376 | public function is_available() { |
| 377 | - return ! empty( $this->enabled ); |
|
| 377 | + return !empty($this->enabled); |
|
| 378 | 378 | } |
| 379 | 379 | |
| 380 | 380 | /** |
@@ -383,7 +383,7 @@ discard block |
||
| 383 | 383 | * @return string |
| 384 | 384 | */ |
| 385 | 385 | public function get_title() { |
| 386 | - return apply_filters( 'getpaid_gateway_title', $this->title, $this ); |
|
| 386 | + return apply_filters('getpaid_gateway_title', $this->title, $this); |
|
| 387 | 387 | } |
| 388 | 388 | |
| 389 | 389 | /** |
@@ -392,7 +392,7 @@ discard block |
||
| 392 | 392 | * @return string |
| 393 | 393 | */ |
| 394 | 394 | public function get_description() { |
| 395 | - return apply_filters( 'getpaid_gateway_description', $this->description, $this ); |
|
| 395 | + return apply_filters('getpaid_gateway_description', $this->description, $this); |
|
| 396 | 396 | } |
| 397 | 397 | |
| 398 | 398 | /** |
@@ -404,9 +404,9 @@ discard block |
||
| 404 | 404 | * @param GetPaid_Payment_Form_Submission $submission Checkout submission. |
| 405 | 405 | * @return void |
| 406 | 406 | */ |
| 407 | - public function process_payment( $invoice, $submission_data, $submission ) { |
|
| 407 | + public function process_payment($invoice, $submission_data, $submission) { |
|
| 408 | 408 | // Process the payment then either redirect to the success page or the gateway. |
| 409 | - do_action( 'getpaid_process_invoice_payment_' . $this->id, $invoice, $submission_data, $submission ); |
|
| 409 | + do_action('getpaid_process_invoice_payment_' . $this->id, $invoice, $submission_data, $submission); |
|
| 410 | 410 | } |
| 411 | 411 | |
| 412 | 412 | /** |
@@ -420,8 +420,8 @@ discard block |
||
| 420 | 420 | * @param string $reason Refund reason. |
| 421 | 421 | * @return WP_Error|bool True or false based on success, or a WP_Error object. |
| 422 | 422 | */ |
| 423 | - public function process_refund( $invoice, $amount = null, $reason = '' ) { |
|
| 424 | - return apply_filters( 'getpaid_process_invoice_refund_' . $this->id, false, $invoice, $amount, $reason ); |
|
| 423 | + public function process_refund($invoice, $amount = null, $reason = '') { |
|
| 424 | + return apply_filters('getpaid_process_invoice_refund_' . $this->id, false, $invoice, $amount, $reason); |
|
| 425 | 425 | } |
| 426 | 426 | |
| 427 | 427 | /** |
@@ -430,8 +430,8 @@ discard block |
||
| 430 | 430 | * @param int $invoice_id 0 or invoice id. |
| 431 | 431 | * @param GetPaid_Payment_Form $form Current payment form. |
| 432 | 432 | */ |
| 433 | - public function payment_fields( $invoice_id, $form ) { |
|
| 434 | - do_action( 'getpaid_getpaid_gateway_payment_fields_' . $this->id, $invoice_id, $form ); |
|
| 433 | + public function payment_fields($invoice_id, $form) { |
|
| 434 | + do_action('getpaid_getpaid_gateway_payment_fields_' . $this->id, $invoice_id, $form); |
|
| 435 | 435 | } |
| 436 | 436 | |
| 437 | 437 | /** |
@@ -439,7 +439,7 @@ discard block |
||
| 439 | 439 | * |
| 440 | 440 | * @param array $admin_settings |
| 441 | 441 | */ |
| 442 | - public function admin_settings( $admin_settings ) { |
|
| 442 | + public function admin_settings($admin_settings) { |
|
| 443 | 443 | return $admin_settings; |
| 444 | 444 | } |
| 445 | 445 | |
@@ -448,8 +448,8 @@ discard block |
||
| 448 | 448 | * |
| 449 | 449 | * @param string $option |
| 450 | 450 | */ |
| 451 | - public function get_option( $option, $default = false ) { |
|
| 452 | - return wpinv_get_option( $this->id . '_' . $option, $default ); |
|
| 451 | + public function get_option($option, $default = false) { |
|
| 452 | + return wpinv_get_option($this->id . '_' . $option, $default); |
|
| 453 | 453 | } |
| 454 | 454 | |
| 455 | 455 | /** |
@@ -462,8 +462,8 @@ discard block |
||
| 462 | 462 | * @return bool True if the gateway supports the feature, false otherwise. |
| 463 | 463 | * @since 1.0.19 |
| 464 | 464 | */ |
| 465 | - public function supports( $feature ) { |
|
| 466 | - return apply_filters( 'getpaid_payment_gateway_supports', in_array( $feature, $this->supports ), $feature, $this ); |
|
| 465 | + public function supports($feature) { |
|
| 466 | + return apply_filters('getpaid_payment_gateway_supports', in_array($feature, $this->supports), $feature, $this); |
|
| 467 | 467 | } |
| 468 | 468 | |
| 469 | 469 | /** |
@@ -471,36 +471,36 @@ discard block |
||
| 471 | 471 | * |
| 472 | 472 | * @param bool $save whether or not to display the save button. |
| 473 | 473 | */ |
| 474 | - public function get_cc_form( $save = false ) { |
|
| 474 | + public function get_cc_form($save = false) { |
|
| 475 | 475 | |
| 476 | 476 | ob_start(); |
| 477 | 477 | |
| 478 | - $id_prefix = esc_attr( uniqid( $this->id ) ); |
|
| 478 | + $id_prefix = esc_attr(uniqid($this->id)); |
|
| 479 | 479 | |
| 480 | 480 | $months = array( |
| 481 | - '01' => __( 'January', 'invoicing' ), |
|
| 482 | - '02' => __( 'February', 'invoicing' ), |
|
| 483 | - '03' => __( 'March', 'invoicing' ), |
|
| 484 | - '04' => __( 'April', 'invoicing' ), |
|
| 485 | - '05' => __( 'May', 'invoicing' ), |
|
| 486 | - '06' => __( 'June', 'invoicing' ), |
|
| 487 | - '07' => __( 'July', 'invoicing' ), |
|
| 488 | - '08' => __( 'August', 'invoicing' ), |
|
| 489 | - '09' => __( 'September', 'invoicing' ), |
|
| 490 | - '10' => __( 'October', 'invoicing' ), |
|
| 491 | - '11' => __( 'November', 'invoicing' ), |
|
| 492 | - '12' => __( 'December', 'invoicing' ), |
|
| 481 | + '01' => __('January', 'invoicing'), |
|
| 482 | + '02' => __('February', 'invoicing'), |
|
| 483 | + '03' => __('March', 'invoicing'), |
|
| 484 | + '04' => __('April', 'invoicing'), |
|
| 485 | + '05' => __('May', 'invoicing'), |
|
| 486 | + '06' => __('June', 'invoicing'), |
|
| 487 | + '07' => __('July', 'invoicing'), |
|
| 488 | + '08' => __('August', 'invoicing'), |
|
| 489 | + '09' => __('September', 'invoicing'), |
|
| 490 | + '10' => __('October', 'invoicing'), |
|
| 491 | + '11' => __('November', 'invoicing'), |
|
| 492 | + '12' => __('December', 'invoicing'), |
|
| 493 | 493 | ); |
| 494 | 494 | |
| 495 | - $year = (int) date( 'Y', current_time( 'timestamp' ) ); |
|
| 495 | + $year = (int) date('Y', current_time('timestamp')); |
|
| 496 | 496 | $years = array(); |
| 497 | 497 | |
| 498 | - for ( $i = 0; $i <= 10; $i++ ) { |
|
| 499 | - $years[ $year + $i ] = $year + $i; |
|
| 498 | + for ($i = 0; $i <= 10; $i++) { |
|
| 499 | + $years[$year + $i] = $year + $i; |
|
| 500 | 500 | } |
| 501 | 501 | |
| 502 | 502 | ?> |
| 503 | - <div class="<?php echo esc_attr( $this->id );?>-cc-form getpaid-cc-form mt-1"> |
|
| 503 | + <div class="<?php echo esc_attr($this->id); ?>-cc-form getpaid-cc-form mt-1"> |
|
| 504 | 504 | |
| 505 | 505 | |
| 506 | 506 | <div class="getpaid-cc-card-inner"> |
@@ -509,14 +509,14 @@ discard block |
||
| 509 | 509 | <div class="col-12"> |
| 510 | 510 | |
| 511 | 511 | <div class="form-group"> |
| 512 | - <label for="<?php echo esc_attr( "$id_prefix-cc-number" ) ?>"><?php _e( 'Card number', 'invoicing' ); ?></label> |
|
| 512 | + <label for="<?php echo esc_attr("$id_prefix-cc-number") ?>"><?php _e('Card number', 'invoicing'); ?></label> |
|
| 513 | 513 | <div class="input-group input-group-sm"> |
| 514 | 514 | <div class="input-group-prepend "> |
| 515 | 515 | <span class="input-group-text"> |
| 516 | 516 | <i class="fa fa-credit-card"></i> |
| 517 | 517 | </span> |
| 518 | 518 | </div> |
| 519 | - <input type="text" name="<?php echo esc_attr( $this->id . '[cc_number]' ) ?>authorizenet[cc_number]" id="<?php echo esc_attr( "$id_prefix-cc-number" ) ?>" class="form-control form-control-sm" autocomplete="cc-number"> |
|
| 519 | + <input type="text" name="<?php echo esc_attr($this->id . '[cc_number]') ?>authorizenet[cc_number]" id="<?php echo esc_attr("$id_prefix-cc-number") ?>" class="form-control form-control-sm" autocomplete="cc-number"> |
|
| 520 | 520 | </div> |
| 521 | 521 | </div> |
| 522 | 522 | |
@@ -524,17 +524,17 @@ discard block |
||
| 524 | 524 | |
| 525 | 525 | <div class="col-12"> |
| 526 | 526 | <div class="form-group"> |
| 527 | - <label><?php _e( 'Expiration', 'invoicing' ); ?></label> |
|
| 527 | + <label><?php _e('Expiration', 'invoicing'); ?></label> |
|
| 528 | 528 | <div class="form-row"> |
| 529 | 529 | |
| 530 | 530 | <div class="col"> |
| 531 | - <select class="form-control form-control-sm" autocomplete="cc-exp-month" name="<?php echo esc_attr( $this->id );?>[cc_expire_month]"> |
|
| 532 | - <option disabled selected="selected"><?php _e( 'MM', 'invoicing' ); ?></option> |
|
| 531 | + <select class="form-control form-control-sm" autocomplete="cc-exp-month" name="<?php echo esc_attr($this->id); ?>[cc_expire_month]"> |
|
| 532 | + <option disabled selected="selected"><?php _e('MM', 'invoicing'); ?></option> |
|
| 533 | 533 | |
| 534 | 534 | <?php |
| 535 | - foreach ( $months as $key => $month ) { |
|
| 536 | - $key = esc_attr( $key ); |
|
| 537 | - $month = wpinv_clean( $month ); |
|
| 535 | + foreach ($months as $key => $month) { |
|
| 536 | + $key = esc_attr($key); |
|
| 537 | + $month = wpinv_clean($month); |
|
| 538 | 538 | echo "<option value='$key'>$month</option>" . PHP_EOL; |
| 539 | 539 | } |
| 540 | 540 | ?> |
@@ -543,13 +543,13 @@ discard block |
||
| 543 | 543 | </div> |
| 544 | 544 | |
| 545 | 545 | <div class="col"> |
| 546 | - <select class="form-control form-control-sm" autocomplete="cc-exp-year" name="<?php echo esc_attr( $this->id );?>[cc_expire_year]"> |
|
| 547 | - <option disabled selected="selected"><?php _e( 'YY', 'invoicing' ); ?></option> |
|
| 546 | + <select class="form-control form-control-sm" autocomplete="cc-exp-year" name="<?php echo esc_attr($this->id); ?>[cc_expire_year]"> |
|
| 547 | + <option disabled selected="selected"><?php _e('YY', 'invoicing'); ?></option> |
|
| 548 | 548 | |
| 549 | 549 | <?php |
| 550 | - foreach ( $years as $key => $year ) { |
|
| 551 | - $key = esc_attr( $key ); |
|
| 552 | - $year = wpinv_clean( $year ); |
|
| 550 | + foreach ($years as $key => $year) { |
|
| 551 | + $key = esc_attr($key); |
|
| 552 | + $year = wpinv_clean($year); |
|
| 553 | 553 | echo "<option value='$key'>$year</option>" . PHP_EOL; |
| 554 | 554 | } |
| 555 | 555 | ?> |
@@ -567,7 +567,7 @@ discard block |
||
| 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( |
@@ -582,7 +582,7 @@ discard block |
||
| 582 | 582 | |
| 583 | 583 | <?php |
| 584 | 584 | |
| 585 | - if ( $save ) { |
|
| 585 | + if ($save) { |
|
| 586 | 586 | echo $this->save_payment_method_checkbox(); |
| 587 | 587 | } |
| 588 | 588 | |
@@ -601,7 +601,7 @@ discard block |
||
| 601 | 601 | * |
| 602 | 602 | * @since 1.0.19 |
| 603 | 603 | */ |
| 604 | - public function new_payment_method_entry( $form ) { |
|
| 604 | + public function new_payment_method_entry($form) { |
|
| 605 | 605 | echo "<div class='getpaid-new-payment-method-form' style='display:none;'>$form</div>"; |
| 606 | 606 | } |
| 607 | 607 | |
@@ -611,16 +611,16 @@ discard block |
||
| 611 | 611 | * @since 1.0.19 |
| 612 | 612 | */ |
| 613 | 613 | public function saved_payment_methods() { |
| 614 | - $html = '<ul class="getpaid-saved-payment-methods list-unstyled m-0 mt-2" data-count="' . esc_attr( count( $this->get_tokens( $this->is_sandbox() ) ) ) . '">'; |
|
| 614 | + $html = '<ul class="getpaid-saved-payment-methods list-unstyled m-0 mt-2" data-count="' . esc_attr(count($this->get_tokens($this->is_sandbox()))) . '">'; |
|
| 615 | 615 | |
| 616 | - foreach ( $this->get_tokens( $this->is_sandbox() ) as $token ) { |
|
| 617 | - $html .= $this->get_saved_payment_method_option_html( $token ); |
|
| 616 | + foreach ($this->get_tokens($this->is_sandbox()) as $token) { |
|
| 617 | + $html .= $this->get_saved_payment_method_option_html($token); |
|
| 618 | 618 | } |
| 619 | 619 | |
| 620 | 620 | $html .= $this->get_new_payment_method_option_html(); |
| 621 | 621 | $html .= '</ul>'; |
| 622 | 622 | |
| 623 | - echo apply_filters( 'getpaid_payment_gateway_form_saved_payment_methods_html', $html, $this ); |
|
| 623 | + echo apply_filters('getpaid_payment_gateway_form_saved_payment_methods_html', $html, $this); |
|
| 624 | 624 | } |
| 625 | 625 | |
| 626 | 626 | /** |
@@ -630,7 +630,7 @@ discard block |
||
| 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 | return sprintf( |
| 636 | 636 | '<li class="getpaid-payment-method form-group"> |
@@ -639,10 +639,10 @@ discard block |
||
| 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 ) |
|
| 642 | + esc_attr($this->id), |
|
| 643 | + esc_attr($token['id']), |
|
| 644 | + esc_html($token['name']), |
|
| 645 | + checked(empty($token['default']), false, false) |
|
| 646 | 646 | ); |
| 647 | 647 | |
| 648 | 648 | } |
@@ -654,7 +654,7 @@ discard block |
||
| 654 | 654 | */ |
| 655 | 655 | public function get_new_payment_method_option_html() { |
| 656 | 656 | |
| 657 | - $label = apply_filters( 'getpaid_new_payment_method_label', $this->new_method_label ? $this->new_method_label : __( 'Use a new payment method', 'invoicing' ), $this ); |
|
| 657 | + $label = apply_filters('getpaid_new_payment_method_label', $this->new_method_label ? $this->new_method_label : __('Use a new payment method', 'invoicing'), $this); |
|
| 658 | 658 | |
| 659 | 659 | return sprintf( |
| 660 | 660 | '<li class="getpaid-new-payment-method"> |
@@ -663,8 +663,8 @@ discard block |
||
| 663 | 663 | <span>%2$s</span> |
| 664 | 664 | </label> |
| 665 | 665 | </li>', |
| 666 | - esc_attr( $this->id ), |
|
| 667 | - esc_html( $label ) |
|
| 666 | + esc_attr($this->id), |
|
| 667 | + esc_html($label) |
|
| 668 | 668 | ); |
| 669 | 669 | |
| 670 | 670 | } |
@@ -683,8 +683,8 @@ discard block |
||
| 683 | 683 | <span>%2$s</span> |
| 684 | 684 | </label> |
| 685 | 685 | </p>', |
| 686 | - esc_attr( $this->id ), |
|
| 687 | - esc_html__( 'Save payment method', 'invoicing' ) |
|
| 686 | + esc_attr($this->id), |
|
| 687 | + esc_html__('Save payment method', 'invoicing') |
|
| 688 | 688 | ); |
| 689 | 689 | |
| 690 | 690 | } |
@@ -694,9 +694,9 @@ discard block |
||
| 694 | 694 | * |
| 695 | 695 | * @return array |
| 696 | 696 | */ |
| 697 | - public function register_gateway( $gateways ) { |
|
| 697 | + public function register_gateway($gateways) { |
|
| 698 | 698 | |
| 699 | - $gateways[ $this->id ] = array( |
|
| 699 | + $gateways[$this->id] = array( |
|
| 700 | 700 | |
| 701 | 701 | 'admin_label' => $this->method_title, |
| 702 | 702 | 'checkout_label' => $this->title, |
@@ -714,13 +714,13 @@ discard block |
||
| 714 | 714 | * @param WPInv_Invoice|null $invoice Invoice object or null. |
| 715 | 715 | * @return bool |
| 716 | 716 | */ |
| 717 | - public function is_sandbox( $invoice = null ) { |
|
| 717 | + public function is_sandbox($invoice = null) { |
|
| 718 | 718 | |
| 719 | - if ( ! empty( $invoice ) && ! $invoice->needs_payment() ) { |
|
| 719 | + if (!empty($invoice) && !$invoice->needs_payment()) { |
|
| 720 | 720 | return $invoice->get_mode() == 'test'; |
| 721 | 721 | } |
| 722 | 722 | |
| 723 | - return wpinv_is_test_mode( $this->id ); |
|
| 723 | + return wpinv_is_test_mode($this->id); |
|
| 724 | 724 | |
| 725 | 725 | } |
| 726 | 726 | |
@@ -738,15 +738,15 @@ discard block |
||
| 738 | 738 | * |
| 739 | 739 | * @return bool |
| 740 | 740 | */ |
| 741 | - public function validate_currency( $validation, $currency ) { |
|
| 741 | + public function validate_currency($validation, $currency) { |
|
| 742 | 742 | |
| 743 | 743 | // Required currencies. |
| 744 | - if ( ! empty( $this->currencies ) && ! in_array( $currency, $this->currencies ) ) { |
|
| 744 | + if (!empty($this->currencies) && !in_array($currency, $this->currencies)) { |
|
| 745 | 745 | return false; |
| 746 | 746 | } |
| 747 | 747 | |
| 748 | 748 | // Excluded currencies. |
| 749 | - if ( ! empty( $this->exclude_currencies ) && in_array( $currency, $this->exclude_currencies ) ) { |
|
| 749 | + if (!empty($this->exclude_currencies) && in_array($currency, $this->exclude_currencies)) { |
|
| 750 | 750 | return false; |
| 751 | 751 | } |
| 752 | 752 | |
@@ -757,13 +757,13 @@ discard block |
||
| 757 | 757 | * Displays an error |
| 758 | 758 | * |
| 759 | 759 | */ |
| 760 | - public function show_error( $code, $message, $type ) { |
|
| 760 | + public function show_error($code, $message, $type) { |
|
| 761 | 761 | |
| 762 | - if ( is_admin() ) { |
|
| 763 | - getpaid_admin()->{"show_$type"}( $message ); |
|
| 762 | + if (is_admin()) { |
|
| 763 | + getpaid_admin()->{"show_$type"}($message); |
|
| 764 | 764 | } |
| 765 | 765 | |
| 766 | - wpinv_set_error( $code, $message, $type ); |
|
| 766 | + wpinv_set_error($code, $message, $type); |
|
| 767 | 767 | |
| 768 | 768 | } |
| 769 | 769 | |