@@ -7,34 +7,34 @@ discard block |
||
7 | 7 | * @version 1.0.19 |
8 | 8 | */ |
9 | 9 | |
10 | -defined( 'ABSPATH' ) || exit; |
|
10 | +defined('ABSPATH') || exit; |
|
11 | 11 | |
12 | 12 | $value = ''; |
13 | 13 | $class = ''; |
14 | 14 | |
15 | -if ( is_user_logged_in() ) { |
|
15 | +if (is_user_logged_in()) { |
|
16 | 16 | $user = wp_get_current_user(); |
17 | - $value = sanitize_email( $user->user_email ); |
|
17 | + $value = sanitize_email($user->user_email); |
|
18 | 18 | |
19 | - if ( ! empty( $hide_billing_email ) ) { |
|
19 | + if (!empty($hide_billing_email)) { |
|
20 | 20 | $class = 'd-none'; |
21 | 21 | } |
22 | 22 | |
23 | 23 | } |
24 | 24 | |
25 | -do_action( 'getpaid_before_payment_form_billing_email', $form ); |
|
25 | +do_action('getpaid_before_payment_form_billing_email', $form); |
|
26 | 26 | |
27 | 27 | echo "<span class='$class'>"; |
28 | 28 | |
29 | 29 | echo aui()->input( |
30 | 30 | array( |
31 | 31 | 'name' => 'billing_email', |
32 | - 'id' => esc_attr( $id ) . uniqid( '_' ), |
|
33 | - 'placeholder'=> empty( $placeholder ) ? '' : esc_attr( $placeholder ), |
|
34 | - 'required' => ! empty( $required ), |
|
35 | - 'label' => empty( $label ) ? '' : wp_kses_post( $label ) . '<span class="text-danger"> *</span>', |
|
32 | + 'id' => esc_attr($id) . uniqid('_'), |
|
33 | + 'placeholder'=> empty($placeholder) ? '' : esc_attr($placeholder), |
|
34 | + 'required' => !empty($required), |
|
35 | + 'label' => empty($label) ? '' : wp_kses_post($label) . '<span class="text-danger"> *</span>', |
|
36 | 36 | 'label_type' => 'vertical', |
37 | - 'help_text' => empty( $description ) ? '' : wp_kses_post( $description ), |
|
37 | + 'help_text' => empty($description) ? '' : wp_kses_post($description), |
|
38 | 38 | 'type' => 'email', |
39 | 39 | 'value' => $value, |
40 | 40 | ) |
@@ -42,4 +42,4 @@ discard block |
||
42 | 42 | |
43 | 43 | echo '</span>'; |
44 | 44 | |
45 | -do_action( 'getpaid_after_payment_form_billing_email', $form ); |
|
45 | +do_action('getpaid_after_payment_form_billing_email', $form); |
@@ -7,52 +7,52 @@ discard block |
||
7 | 7 | * @version 1.0.19 |
8 | 8 | */ |
9 | 9 | |
10 | -defined( 'ABSPATH' ) || exit; |
|
10 | +defined('ABSPATH') || exit; |
|
11 | 11 | |
12 | -if ( empty( $fields ) ) { |
|
12 | +if (empty($fields)) { |
|
13 | 13 | return; |
14 | 14 | } |
15 | 15 | |
16 | 16 | // A prefix for all ids (so that a form can be included in the same page multiple times). |
17 | -$uniqid = uniqid( '_' ); |
|
17 | +$uniqid = uniqid('_'); |
|
18 | 18 | |
19 | 19 | // Prepare the user's country. |
20 | -$country = is_user_logged_in() ? get_user_meta( get_current_user_id(), '_wpinv_country', true ) : ''; |
|
21 | -$country = empty( $country ) ? getpaid_get_ip_country() : $country; |
|
22 | -$country = empty( $country ) ? wpinv_get_default_country() : $country; |
|
20 | +$country = is_user_logged_in() ? get_user_meta(get_current_user_id(), '_wpinv_country', true) : ''; |
|
21 | +$country = empty($country) ? getpaid_get_ip_country() : $country; |
|
22 | +$country = empty($country) ? wpinv_get_default_country() : $country; |
|
23 | 23 | |
24 | 24 | // A prefix for all ids (so that a form can be included in the same page multiple times). |
25 | -$uniqid = uniqid( '_' ); |
|
25 | +$uniqid = uniqid('_'); |
|
26 | 26 | |
27 | -$address_type = empty( $address_type ) ? 'billing' : $address_type; |
|
27 | +$address_type = empty($address_type) ? 'billing' : $address_type; |
|
28 | 28 | |
29 | 29 | ?> |
30 | 30 | |
31 | -<?php if ( 'both' === $address_type ) : ?> |
|
31 | +<?php if ('both' === $address_type) : ?> |
|
32 | 32 | |
33 | 33 | <!-- Start Billing/Shipping Address Title --> |
34 | 34 | <h4 class="mb-3 getpaid-shipping-billing-address-title"> |
35 | - <?php _e( 'Billing / Shipping Address', 'invoicing' ); ?> |
|
35 | + <?php _e('Billing / Shipping Address', 'invoicing'); ?> |
|
36 | 36 | </h4> |
37 | 37 | <!-- End Billing Address Title --> |
38 | 38 | |
39 | 39 | <!-- Start Billing Address Title --> |
40 | 40 | <h4 class="mb-3 getpaid-billing-address-title"> |
41 | - <?php _e( 'Billing Address', 'invoicing' ); ?> |
|
41 | + <?php _e('Billing Address', 'invoicing'); ?> |
|
42 | 42 | </h4> |
43 | 43 | <!-- End Billing Address Title --> |
44 | 44 | |
45 | 45 | <?php endif; ?> |
46 | 46 | |
47 | 47 | |
48 | -<?php if ( 'both' === $address_type || 'billing' === $address_type ) : ?> |
|
48 | +<?php if ('both' === $address_type || 'billing' === $address_type) : ?> |
|
49 | 49 | |
50 | 50 | <!-- Start Billing Address --> |
51 | 51 | <div class="getpaid-billing-address-wrapper"> |
52 | 52 | <?php |
53 | 53 | $field_type = 'billing'; |
54 | - include plugin_dir_path( __FILE__ ) . 'address-fields.php'; |
|
55 | - do_action( 'getpaid_after_payment_form_billing_fields', $form ); |
|
54 | + include plugin_dir_path(__FILE__) . 'address-fields.php'; |
|
55 | + do_action('getpaid_after_payment_form_billing_fields', $form); |
|
56 | 56 | ?> |
57 | 57 | </div> |
58 | 58 | <!-- End Billing Address --> |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | <?php endif; ?> |
61 | 61 | |
62 | 62 | |
63 | -<?php if ( 'both' === $address_type ) : ?> |
|
63 | +<?php if ('both' === $address_type) : ?> |
|
64 | 64 | |
65 | 65 | |
66 | 66 | <?php |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | 'name' => 'same-shipping-address', |
72 | 72 | 'id' => "shipping-toggle$uniqid", |
73 | 73 | 'required' => false, |
74 | - 'label' => wp_kses_post( $shipping_address_toggle ), |
|
74 | + 'label' => wp_kses_post($shipping_address_toggle), |
|
75 | 75 | 'value' => 1, |
76 | 76 | 'checked' => true, |
77 | 77 | ) |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | |
83 | 83 | <!-- Start Shipping Address Title --> |
84 | 84 | <h4 class="mb-3 getpaid-shipping-address-title"> |
85 | - <?php _e( 'Shipping Address', 'invoicing' ); ?> |
|
85 | + <?php _e('Shipping Address', 'invoicing'); ?> |
|
86 | 86 | </h4> |
87 | 87 | <!-- End Shipping Address Title --> |
88 | 88 | |
@@ -91,14 +91,14 @@ discard block |
||
91 | 91 | |
92 | 92 | |
93 | 93 | |
94 | -<?php if ( 'both' === $address_type || 'shipping' === $address_type ) : ?> |
|
94 | +<?php if ('both' === $address_type || 'shipping' === $address_type) : ?> |
|
95 | 95 | |
96 | 96 | <!-- Start Shipping Address --> |
97 | 97 | <div class="getpaid-shipping-address-wrapper"> |
98 | 98 | <?php |
99 | 99 | $field_type = 'shipping'; |
100 | - include plugin_dir_path( __FILE__ ) . 'address-fields.php'; |
|
101 | - do_action( 'getpaid_after_payment_form_shipping_fields', $form ); |
|
100 | + include plugin_dir_path(__FILE__) . 'address-fields.php'; |
|
101 | + do_action('getpaid_after_payment_form_shipping_fields', $form); |
|
102 | 102 | ?> |
103 | 103 | </div> |
104 | 104 | <!-- End Shipping Address --> |
@@ -7,45 +7,45 @@ discard block |
||
7 | 7 | * @version 1.0.19 |
8 | 8 | */ |
9 | 9 | |
10 | -defined( 'ABSPATH' ) || exit; |
|
10 | +defined('ABSPATH') || exit; |
|
11 | 11 | |
12 | 12 | // The payment methods select title. |
13 | -if ( empty( $text ) ) { |
|
14 | - $text = __( 'Select Payment Method', 'invoicing' ); |
|
13 | +if (empty($text)) { |
|
14 | + $text = __('Select Payment Method', 'invoicing'); |
|
15 | 15 | } |
16 | 16 | |
17 | 17 | // An array of active payment methods. |
18 | -$gateways = wpinv_get_enabled_payment_gateways( true ); |
|
18 | +$gateways = wpinv_get_enabled_payment_gateways(true); |
|
19 | 19 | |
20 | 20 | // The current invoice id. |
21 | 21 | $invoice_id = 0; |
22 | 22 | $chosen_gateway = wpinv_get_default_gateway(); |
23 | 23 | |
24 | -if ( ! empty( $form->invoice ) ) { |
|
24 | +if (!empty($form->invoice)) { |
|
25 | 25 | $invoice_id = $form->invoice->get_id(); |
26 | 26 | $chosen_gateway = $form->invoice->get_gateway(); |
27 | 27 | } |
28 | 28 | |
29 | 29 | ?> |
30 | 30 | |
31 | - <?php do_action( 'getpaid_before_payment_form_gateway_select', $form ); ?> |
|
31 | + <?php do_action('getpaid_before_payment_form_gateway_select', $form); ?> |
|
32 | 32 | <div class="mt-4 mb-4 getpaid-gateways"> |
33 | 33 | |
34 | - <?php do_action( 'wpinv_payment_mode_top', $invoice_id, $chosen_gateway, $gateways, $form ); ?> |
|
34 | + <?php do_action('wpinv_payment_mode_top', $invoice_id, $chosen_gateway, $gateways, $form); ?> |
|
35 | 35 | |
36 | 36 | <div class="getpaid-select-gateway-title-div"> |
37 | - <h6><?php echo sanitize_text_field( $text ); ?></h6> |
|
37 | + <h6><?php echo sanitize_text_field($text); ?></h6> |
|
38 | 38 | </div> |
39 | 39 | |
40 | 40 | <div class="getpaid-available-gateways-div"> |
41 | 41 | |
42 | - <?php foreach ( array_keys( $gateways ) as $gateway ) : ?> |
|
42 | + <?php foreach (array_keys($gateways) as $gateway) : ?> |
|
43 | 43 | |
44 | - <div class="pt-1 pb-1 getpaid-gateway getpaid-gateway-<?php echo sanitize_html_class( $gateway ) ;?>" data-checkout-label='<?php echo esc_attr( apply_filters( "getpaid_gateway_{$gateway}_checkout_button_label", '' ) ); ?>'> |
|
44 | + <div class="pt-1 pb-1 getpaid-gateway getpaid-gateway-<?php echo sanitize_html_class($gateway); ?>" data-checkout-label='<?php echo esc_attr(apply_filters("getpaid_gateway_{$gateway}_checkout_button_label", '')); ?>'> |
|
45 | 45 | |
46 | 46 | <label class="d-block w-100 getpaid-gateway-radio"> |
47 | - <input type="radio" value="<?php echo esc_attr( $gateway ) ;?>" <?php checked( $gateway, $chosen_gateway ) ;?> name="wpi-gateway"> |
|
48 | - <span><?php echo sanitize_text_field( wpinv_get_gateway_checkout_label( $gateway ) ); ?></span> |
|
47 | + <input type="radio" value="<?php echo esc_attr($gateway); ?>" <?php checked($gateway, $chosen_gateway); ?> name="wpi-gateway"> |
|
48 | + <span><?php echo sanitize_text_field(wpinv_get_gateway_checkout_label($gateway)); ?></span> |
|
49 | 49 | </label> |
50 | 50 | |
51 | 51 | </div> |
@@ -56,22 +56,22 @@ discard block |
||
56 | 56 | |
57 | 57 | <div class="getpaid-gateway-descriptions-div"> |
58 | 58 | |
59 | - <?php foreach ( array_keys( $gateways ) as $gateway ) : ?> |
|
59 | + <?php foreach (array_keys($gateways) as $gateway) : ?> |
|
60 | 60 | |
61 | - <div class="my-2 p-3 bg-light border getpaid-gateway-description getpaid-description-<?php echo sanitize_html_class( $gateway ) ;?>" style="display: none;"> |
|
61 | + <div class="my-2 p-3 bg-light border getpaid-gateway-description getpaid-description-<?php echo sanitize_html_class($gateway); ?>" style="display: none;"> |
|
62 | 62 | <?php |
63 | 63 | |
64 | - $description = wpinv_get_gateway_description( $gateway ); |
|
64 | + $description = wpinv_get_gateway_description($gateway); |
|
65 | 65 | |
66 | - if ( wpinv_is_test_mode( $gateway ) ) { |
|
67 | - $sandbox_notice = apply_filters( "getpaid_{$gateway}_sandbox_notice", __( 'SANDBOX ENABLED: No real payments will occur.', 'invoicing' ) ); |
|
66 | + if (wpinv_is_test_mode($gateway)) { |
|
67 | + $sandbox_notice = apply_filters("getpaid_{$gateway}_sandbox_notice", __('SANDBOX ENABLED: No real payments will occur.', 'invoicing')); |
|
68 | 68 | $description = "$description $sandbox_notice"; |
69 | 69 | } |
70 | 70 | |
71 | - echo wpautop( wp_kses_post( $description ) ); |
|
71 | + echo wpautop(wp_kses_post($description)); |
|
72 | 72 | |
73 | - do_action( 'wpinv_' . $gateway . '_checkout_fields', $invoice_id ) ; |
|
74 | - do_action( 'wpinv_' . $gateway . '_cc_form', $invoice_id, $form ) ; |
|
73 | + do_action('wpinv_' . $gateway . '_checkout_fields', $invoice_id); |
|
74 | + do_action('wpinv_' . $gateway . '_cc_form', $invoice_id, $form); |
|
75 | 75 | |
76 | 76 | ?> |
77 | 77 | </div> |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | <?php |
85 | 85 | echo aui()->alert( |
86 | 86 | array( |
87 | - 'content' => __( 'None of the available payment gateways support subscriptions.', 'invoicing' ), |
|
87 | + 'content' => __('None of the available payment gateways support subscriptions.', 'invoicing'), |
|
88 | 88 | 'type' => 'danger', |
89 | 89 | ) |
90 | 90 | ); |
@@ -95,14 +95,14 @@ discard block |
||
95 | 95 | <?php |
96 | 96 | echo aui()->alert( |
97 | 97 | array( |
98 | - 'content' => __( 'There is no active payment gateway available to process your request.', 'invoicing' ), |
|
98 | + 'content' => __('There is no active payment gateway available to process your request.', 'invoicing'), |
|
99 | 99 | 'type' => 'danger', |
100 | 100 | ) |
101 | 101 | ); |
102 | 102 | ?> |
103 | 103 | </div> |
104 | 104 | |
105 | - <?php do_action( 'wpinv_payment_mode_bottom', $invoice_id, $chosen_gateway, $gateways, $form ); ?> |
|
105 | + <?php do_action('wpinv_payment_mode_bottom', $invoice_id, $chosen_gateway, $gateways, $form); ?> |
|
106 | 106 | |
107 | 107 | </div> |
108 | - <?php do_action( 'getpaid_after_payment_form_gateway_select', $form ); ?> |
|
108 | + <?php do_action('getpaid_after_payment_form_gateway_select', $form); ?> |