@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | defined( 'ABSPATH' ) || exit; |
11 | 11 | |
12 | 12 | if ( empty( $fields ) ) { |
13 | - return; |
|
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). |
@@ -18,12 +18,12 @@ discard block |
||
18 | 18 | |
19 | 19 | // Prepare the user's country. |
20 | 20 | if ( ! empty( $form->invoice ) ) { |
21 | - $country = $form->invoice->get_country(); |
|
21 | + $country = $form->invoice->get_country(); |
|
22 | 22 | } |
23 | 23 | |
24 | 24 | if ( empty( $country ) ) { |
25 | - $country = empty( $country ) ? getpaid_get_ip_country() : $country; |
|
26 | - $country = empty( $country ) ? wpinv_get_default_country() : $country; |
|
25 | + $country = empty( $country ) ? getpaid_get_ip_country() : $country; |
|
26 | + $country = empty( $country ) ? wpinv_get_default_country() : $country; |
|
27 | 27 | } |
28 | 28 | |
29 | 29 | // A prefix for all ids (so that a form can be included in the same page multiple times). |
@@ -55,10 +55,10 @@ discard block |
||
55 | 55 | <!-- Start Billing Address --> |
56 | 56 | <div class="getpaid-billing-address-wrapper"> |
57 | 57 | <?php |
58 | - $field_type = 'billing'; |
|
59 | - include plugin_dir_path( __FILE__ ) . 'address-fields.php'; |
|
60 | - do_action( 'getpaid_after_payment_form_billing_fields', $form ); |
|
61 | - ?> |
|
58 | + $field_type = 'billing'; |
|
59 | + include plugin_dir_path( __FILE__ ) . 'address-fields.php'; |
|
60 | + do_action( 'getpaid_after_payment_form_billing_fields', $form ); |
|
61 | + ?> |
|
62 | 62 | </div> |
63 | 63 | <!-- End Billing Address --> |
64 | 64 | |
@@ -70,20 +70,20 @@ discard block |
||
70 | 70 | |
71 | 71 | <?php |
72 | 72 | |
73 | - echo aui()->input( |
|
74 | - array( |
|
75 | - 'type' => 'checkbox', |
|
76 | - 'name' => 'same-shipping-address', |
|
77 | - 'id' => "shipping-toggle$uniqid", |
|
78 | - 'required' => false, |
|
79 | - 'label' => wp_kses_post( $shipping_address_toggle ), |
|
80 | - 'value' => 1, |
|
81 | - 'checked' => true, |
|
82 | - 'class' => 'w-auto', |
|
83 | - ) |
|
84 | - ); |
|
73 | + echo aui()->input( |
|
74 | + array( |
|
75 | + 'type' => 'checkbox', |
|
76 | + 'name' => 'same-shipping-address', |
|
77 | + 'id' => "shipping-toggle$uniqid", |
|
78 | + 'required' => false, |
|
79 | + 'label' => wp_kses_post( $shipping_address_toggle ), |
|
80 | + 'value' => 1, |
|
81 | + 'checked' => true, |
|
82 | + 'class' => 'w-auto', |
|
83 | + ) |
|
84 | + ); |
|
85 | 85 | |
86 | - ?> |
|
86 | + ?> |
|
87 | 87 | |
88 | 88 | |
89 | 89 | <!-- Start Shipping Address Title --> |
@@ -102,10 +102,10 @@ discard block |
||
102 | 102 | <!-- Start Shipping Address --> |
103 | 103 | <div class="getpaid-shipping-address-wrapper"> |
104 | 104 | <?php |
105 | - $field_type = 'shipping'; |
|
106 | - include plugin_dir_path( __FILE__ ) . 'address-fields.php'; |
|
107 | - do_action( 'getpaid_after_payment_form_shipping_fields', $form ); |
|
108 | - ?> |
|
105 | + $field_type = 'shipping'; |
|
106 | + include plugin_dir_path( __FILE__ ) . 'address-fields.php'; |
|
107 | + do_action( 'getpaid_after_payment_form_shipping_fields', $form ); |
|
108 | + ?> |
|
109 | 109 | </div> |
110 | 110 | <!-- End Shipping Address --> |
111 | 111 |
@@ -7,57 +7,57 @@ 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 | -if ( ! empty( $form->invoice ) ) { |
|
20 | +if (!empty($form->invoice)) { |
|
21 | 21 | $country = $form->invoice->get_country(); |
22 | 22 | } |
23 | 23 | |
24 | -if ( empty( $country ) ) { |
|
25 | - $country = empty( $country ) ? getpaid_get_ip_country() : $country; |
|
26 | - $country = empty( $country ) ? wpinv_get_default_country() : $country; |
|
24 | +if (empty($country)) { |
|
25 | + $country = empty($country) ? getpaid_get_ip_country() : $country; |
|
26 | + $country = empty($country) ? wpinv_get_default_country() : $country; |
|
27 | 27 | } |
28 | 28 | |
29 | 29 | // A prefix for all ids (so that a form can be included in the same page multiple times). |
30 | -$uniqid = uniqid( '_' ); |
|
30 | +$uniqid = uniqid('_'); |
|
31 | 31 | |
32 | -$address_type = empty( $address_type ) ? 'billing' : $address_type; |
|
32 | +$address_type = empty($address_type) ? 'billing' : $address_type; |
|
33 | 33 | |
34 | 34 | ?> |
35 | 35 | |
36 | -<?php if ( 'both' === $address_type ) : ?> |
|
36 | +<?php if ('both' === $address_type) : ?> |
|
37 | 37 | |
38 | 38 | <!-- Start Billing/Shipping Address Title --> |
39 | 39 | <h4 class="mb-3 getpaid-shipping-billing-address-title"> |
40 | - <?php esc_html_e( 'Billing / Shipping Address', 'invoicing' ); ?> |
|
40 | + <?php esc_html_e('Billing / Shipping Address', 'invoicing'); ?> |
|
41 | 41 | </h4> |
42 | 42 | <!-- End Billing Address Title --> |
43 | 43 | |
44 | 44 | <!-- Start Billing Address Title --> |
45 | 45 | <h4 class="mb-3 getpaid-billing-address-title"> |
46 | - <?php esc_html_e( 'Billing Address', 'invoicing' ); ?> |
|
46 | + <?php esc_html_e('Billing Address', 'invoicing'); ?> |
|
47 | 47 | </h4> |
48 | 48 | <!-- End Billing Address Title --> |
49 | 49 | |
50 | 50 | <?php endif; ?> |
51 | 51 | |
52 | 52 | |
53 | -<?php if ( 'both' === $address_type || 'billing' === $address_type ) : ?> |
|
53 | +<?php if ('both' === $address_type || 'billing' === $address_type) : ?> |
|
54 | 54 | |
55 | 55 | <!-- Start Billing Address --> |
56 | 56 | <div class="getpaid-billing-address-wrapper"> |
57 | 57 | <?php |
58 | 58 | $field_type = 'billing'; |
59 | - include plugin_dir_path( __FILE__ ) . 'address-fields.php'; |
|
60 | - do_action( 'getpaid_after_payment_form_billing_fields', $form ); |
|
59 | + include plugin_dir_path(__FILE__) . 'address-fields.php'; |
|
60 | + do_action('getpaid_after_payment_form_billing_fields', $form); |
|
61 | 61 | ?> |
62 | 62 | </div> |
63 | 63 | <!-- End Billing Address --> |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | <?php endif; ?> |
66 | 66 | |
67 | 67 | |
68 | -<?php if ( 'both' === $address_type ) : ?> |
|
68 | +<?php if ('both' === $address_type) : ?> |
|
69 | 69 | |
70 | 70 | |
71 | 71 | <?php |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | 'name' => 'same-shipping-address', |
77 | 77 | 'id' => "shipping-toggle$uniqid", |
78 | 78 | 'required' => false, |
79 | - 'label' => wp_kses_post( $shipping_address_toggle ), |
|
79 | + 'label' => wp_kses_post($shipping_address_toggle), |
|
80 | 80 | 'value' => 1, |
81 | 81 | 'checked' => true, |
82 | 82 | 'class' => 'w-auto', |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | |
89 | 89 | <!-- Start Shipping Address Title --> |
90 | 90 | <h4 class="mb-3 getpaid-shipping-address-title"> |
91 | - <?php esc_html_e( 'Shipping Address', 'invoicing' ); ?> |
|
91 | + <?php esc_html_e('Shipping Address', 'invoicing'); ?> |
|
92 | 92 | </h4> |
93 | 93 | <!-- End Shipping Address Title --> |
94 | 94 | |
@@ -97,14 +97,14 @@ discard block |
||
97 | 97 | |
98 | 98 | |
99 | 99 | |
100 | -<?php if ( 'both' === $address_type || 'shipping' === $address_type ) : ?> |
|
100 | +<?php if ('both' === $address_type || 'shipping' === $address_type) : ?> |
|
101 | 101 | |
102 | 102 | <!-- Start Shipping Address --> |
103 | 103 | <div class="getpaid-shipping-address-wrapper"> |
104 | 104 | <?php |
105 | 105 | $field_type = 'shipping'; |
106 | - include plugin_dir_path( __FILE__ ) . 'address-fields.php'; |
|
107 | - do_action( 'getpaid_after_payment_form_shipping_fields', $form ); |
|
106 | + include plugin_dir_path(__FILE__) . 'address-fields.php'; |
|
107 | + do_action('getpaid_after_payment_form_shipping_fields', $form); |
|
108 | 108 | ?> |
109 | 109 | </div> |
110 | 110 | <!-- End Shipping Address --> |
@@ -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 | -$label = empty( $label ) ? '' : wp_kses_post( $label ); |
|
13 | -$label_class = sanitize_key( preg_replace( '/[^A-Za-z0-9_-]/', '-', $label ) ); |
|
12 | +$label = empty($label) ? '' : wp_kses_post($label); |
|
13 | +$label_class = sanitize_key(preg_replace('/[^A-Za-z0-9_-]/', '-', $label)); |
|
14 | 14 | |
15 | -if ( ! empty( $required ) ) { |
|
15 | +if (!empty($required)) { |
|
16 | 16 | $label .= "<span class='text-danger'> *</span>"; |
17 | 17 | } |
18 | 18 | |
19 | -$current_url = ! empty( $_GET['current_url'] ) ? esc_url_raw( urldecode( $_GET['current_url'] ) ) : get_permalink(); |
|
19 | +$current_url = !empty($_GET['current_url']) ? esc_url_raw(urldecode($_GET['current_url'])) : get_permalink(); |
|
20 | 20 | echo aui()->input( |
21 | 21 | array( |
22 | - 'name' => esc_attr( $id ), |
|
23 | - 'id' => esc_attr( $id ) . uniqid( '_' ), |
|
24 | - 'placeholder' => empty( $placeholder ) ? '' : esc_attr( $placeholder ), |
|
25 | - 'required' => ! empty( $required ), |
|
22 | + 'name' => esc_attr($id), |
|
23 | + 'id' => esc_attr($id) . uniqid('_'), |
|
24 | + 'placeholder' => empty($placeholder) ? '' : esc_attr($placeholder), |
|
25 | + 'required' => !empty($required), |
|
26 | 26 | 'label' => $label, |
27 | 27 | 'label_type' => 'vertical', |
28 | - 'help_text' => empty( $description ) ? '' : wp_kses_post( $description ), |
|
28 | + 'help_text' => empty($description) ? '' : wp_kses_post($description), |
|
29 | 29 | 'type' => 'url', |
30 | - 'value' => ! empty( $default_current_post ) ? $current_url : '', |
|
30 | + 'value' => !empty($default_current_post) ? $current_url : '', |
|
31 | 31 | 'class' => $label_class, |
32 | 32 | ) |
33 | 33 | ); |
@@ -7,32 +7,32 @@ |
||
7 | 7 | * @version 1.0.19 |
8 | 8 | */ |
9 | 9 | |
10 | -defined( 'ABSPATH' ) || exit; |
|
10 | +defined('ABSPATH') || exit; |
|
11 | 11 | |
12 | 12 | // Set the currency position. |
13 | 13 | $position = wpinv_currency_position(); |
14 | 14 | |
15 | -if ( $position == 'left_space' ) { |
|
15 | +if ($position == 'left_space') { |
|
16 | 16 | $position = 'left'; |
17 | 17 | } |
18 | 18 | |
19 | -if ( $position == 'right_space' ) { |
|
19 | +if ($position == 'right_space') { |
|
20 | 20 | $position = 'right'; |
21 | 21 | } |
22 | -$label = empty( $label ) ? '' : esc_html( $label ); |
|
23 | -$label_class = sanitize_key( preg_replace( '/[^A-Za-z0-9_-]/', '-', $label ) ); |
|
22 | +$label = empty($label) ? '' : esc_html($label); |
|
23 | +$label_class = sanitize_key(preg_replace('/[^A-Za-z0-9_-]/', '-', $label)); |
|
24 | 24 | |
25 | 25 | echo aui()->input( |
26 | 26 | array( |
27 | - 'name' => esc_attr( $id ), |
|
28 | - 'id' => esc_attr( $id ) . uniqid( '_' ), |
|
29 | - 'placeholder' => empty( $placeholder ) ? wpinv_format_amount( 0 ) : wpinv_format_amount( $placeholder ), |
|
30 | - 'value' => empty( $value ) ? wpinv_format_amount( 0 ) : wpinv_format_amount( $value ), |
|
31 | - 'label' => empty( $label ) ? '' : wp_kses_post( $label ), |
|
27 | + 'name' => esc_attr($id), |
|
28 | + 'id' => esc_attr($id) . uniqid('_'), |
|
29 | + 'placeholder' => empty($placeholder) ? wpinv_format_amount(0) : wpinv_format_amount($placeholder), |
|
30 | + 'value' => empty($value) ? wpinv_format_amount(0) : wpinv_format_amount($value), |
|
31 | + 'label' => empty($label) ? '' : wp_kses_post($label), |
|
32 | 32 | 'label_type' => 'vertical', |
33 | - 'help_text' => empty( $description ) ? '' : wp_kses_post( $description ), |
|
34 | - 'input_group_right' => $position == 'right' ? wpinv_currency_symbol( $form->get_currency() ) : '', |
|
35 | - 'input_group_left' => $position == 'left' ? wpinv_currency_symbol( $form->get_currency() ) : '', |
|
33 | + 'help_text' => empty($description) ? '' : wp_kses_post($description), |
|
34 | + 'input_group_right' => $position == 'right' ? wpinv_currency_symbol($form->get_currency()) : '', |
|
35 | + 'input_group_left' => $position == 'left' ? wpinv_currency_symbol($form->get_currency()) : '', |
|
36 | 36 | 'class' => 'getpaid-refresh-on-change ' . $label_class, |
37 | 37 | ) |
38 | 38 | ); |
@@ -7,35 +7,35 @@ discard block |
||
7 | 7 | * @version 1.0.19 |
8 | 8 | */ |
9 | 9 | |
10 | -defined( 'ABSPATH' ) || exit; |
|
10 | +defined('ABSPATH') || exit; |
|
11 | 11 | |
12 | 12 | // Ensure that we have options. |
13 | -if ( empty( $options ) ) { |
|
13 | +if (empty($options)) { |
|
14 | 14 | return; |
15 | 15 | } |
16 | 16 | |
17 | 17 | // Prepare price options. |
18 | -$options = getpaid_convert_price_string_to_options( $options ); |
|
19 | -$keys = array_keys( $options ); |
|
20 | -$value = empty( $options ) ? '' : $keys[0]; |
|
18 | +$options = getpaid_convert_price_string_to_options($options); |
|
19 | +$keys = array_keys($options); |
|
20 | +$value = empty($options) ? '' : $keys[0]; |
|
21 | 21 | |
22 | 22 | // Prepare id. |
23 | -$id = esc_attr( $id ); |
|
23 | +$id = esc_attr($id); |
|
24 | 24 | |
25 | -$select_type = empty( $select_type ) ? 'select' : $select_type; |
|
25 | +$select_type = empty($select_type) ? 'select' : $select_type; |
|
26 | 26 | |
27 | 27 | // Item select; |
28 | -if ( $select_type == 'select' ) { |
|
28 | +if ($select_type == 'select') { |
|
29 | 29 | echo aui()->select( |
30 | 30 | array( |
31 | 31 | 'name' => $id, |
32 | - 'id' => $id . uniqid( '_' ), |
|
33 | - 'placeholder' => empty( $placeholder ) ? '' : esc_attr( $placeholder ), |
|
32 | + 'id' => $id . uniqid('_'), |
|
33 | + 'placeholder' => empty($placeholder) ? '' : esc_attr($placeholder), |
|
34 | 34 | 'value' => $value, |
35 | - 'label' => empty( $label ) ? '' : esc_html( $label ), |
|
35 | + 'label' => empty($label) ? '' : esc_html($label), |
|
36 | 36 | 'label_type' => 'vertical', |
37 | 37 | 'class' => 'getpaid-price-select-dropdown getpaid-refresh-on-change', |
38 | - 'help_text' => empty( $description ) ? '' : wp_kses_post( $description ), |
|
38 | + 'help_text' => empty($description) ? '' : wp_kses_post($description), |
|
39 | 39 | 'options' => $options, |
40 | 40 | ) |
41 | 41 | ); |
@@ -43,18 +43,18 @@ discard block |
||
43 | 43 | } |
44 | 44 | |
45 | 45 | // Item radios; |
46 | -if ( $select_type == 'radios' ) { |
|
46 | +if ($select_type == 'radios') { |
|
47 | 47 | echo aui()->radio( |
48 | 48 | array( |
49 | - 'name' => esc_attr( $id ), |
|
50 | - 'id' => esc_attr( $id ) . uniqid( '_' ), |
|
51 | - 'label' => empty( $label ) ? '' : esc_html( $label ), |
|
49 | + 'name' => esc_attr($id), |
|
50 | + 'id' => esc_attr($id) . uniqid('_'), |
|
51 | + 'label' => empty($label) ? '' : esc_html($label), |
|
52 | 52 | 'label_type' => 'vertical', |
53 | 53 | 'class' => 'getpaid-price-select-radio getpaid-refresh-on-change w-100', |
54 | 54 | 'value' => $value, |
55 | 55 | 'inline' => false, |
56 | 56 | 'options' => $options, |
57 | - 'help_text' => empty( $description ) ? '' : wp_kses_post( $description ), |
|
57 | + 'help_text' => empty($description) ? '' : wp_kses_post($description), |
|
58 | 58 | ) |
59 | 59 | ); |
60 | 60 | return; |
@@ -62,30 +62,30 @@ discard block |
||
62 | 62 | |
63 | 63 | |
64 | 64 | // Display the label. |
65 | -if ( ! empty( $label ) ) { |
|
66 | - $label = esc_html( $label ); |
|
65 | +if (!empty($label)) { |
|
66 | + $label = esc_html($label); |
|
67 | 67 | echo "<label>$label</label>"; |
68 | 68 | } |
69 | 69 | |
70 | 70 | // Item buttons; |
71 | -if ( $select_type == 'buttons' || $select_type == 'circles' ) { |
|
71 | +if ($select_type == 'buttons' || $select_type == 'circles') { |
|
72 | 72 | |
73 | 73 | $class = 'getpaid-price-buttons'; |
74 | 74 | |
75 | - if ( $select_type == 'circles' ) { |
|
75 | + if ($select_type == 'circles') { |
|
76 | 76 | $class .= ' getpaid-price-circles'; |
77 | 77 | } |
78 | 78 | echo "<div class='$class'>"; |
79 | 79 | |
80 | - foreach ( $options as $price => $label ) { |
|
81 | - $label = esc_html( $label ); |
|
82 | - $price = esc_attr( $price ); |
|
83 | - $_id = $id . uniqid( '_' ); |
|
84 | - $checked = checked( $price, $value, false ); |
|
80 | + foreach ($options as $price => $label) { |
|
81 | + $label = esc_html($label); |
|
82 | + $price = esc_attr($price); |
|
83 | + $_id = $id . uniqid('_'); |
|
84 | + $checked = checked($price, $value, false); |
|
85 | 85 | |
86 | 86 | $class = 'rounded'; |
87 | 87 | |
88 | - if ( $select_type == 'circles' ) { |
|
88 | + if ($select_type == 'circles') { |
|
89 | 89 | $class = ''; |
90 | 90 | } |
91 | 91 | echo " |
@@ -101,13 +101,13 @@ discard block |
||
101 | 101 | } |
102 | 102 | |
103 | 103 | // Item checkboxes; |
104 | -if ( $select_type == 'checkboxes' ) { |
|
104 | +if ($select_type == 'checkboxes') { |
|
105 | 105 | echo '<div class="form-group">'; |
106 | 106 | |
107 | - foreach ( $options as $price => $label ) { |
|
108 | - $label = esc_html( $label ); |
|
109 | - $price = esc_attr( $price ); |
|
110 | - $checked = checked( $price, $value, false ); |
|
107 | + foreach ($options as $price => $label) { |
|
108 | + $label = esc_html($label); |
|
109 | + $price = esc_attr($price); |
|
110 | + $checked = checked($price, $value, false); |
|
111 | 111 | echo " |
112 | 112 | <label class='d-block'> |
113 | 113 | <input type='checkbox' class='getpaid-price-select-checkbox getpaid-refresh-on-change w-auto' name='{$id}[]' value='$price' $checked /> |
@@ -120,6 +120,6 @@ discard block |
||
120 | 120 | |
121 | 121 | } |
122 | 122 | |
123 | -if ( ! empty( $description ) ) { |
|
123 | +if (!empty($description)) { |
|
124 | 124 | echo "<small class='form-text text-muted'>$description</small>"; |
125 | 125 | } |
@@ -12,75 +12,75 @@ discard block |
||
12 | 12 | * @var GetPaid_Payment_Form $form |
13 | 13 | */ |
14 | 14 | |
15 | -defined( 'ABSPATH' ) || exit; |
|
15 | +defined('ABSPATH') || exit; |
|
16 | 16 | |
17 | -$field_type = sanitize_key( $field_type ); |
|
17 | +$field_type = sanitize_key($field_type); |
|
18 | 18 | |
19 | 19 | echo "<div class='row $field_type'>"; |
20 | 20 | |
21 | 21 | // Prepare current user. |
22 | -if ( ! empty( $form->invoice ) ) { |
|
22 | +if (!empty($form->invoice)) { |
|
23 | 23 | $user_id = $form->invoice->get_user_id(); |
24 | 24 | } |
25 | 25 | |
26 | -if ( empty( $user_id ) && is_user_logged_in() ) { |
|
26 | +if (empty($user_id) && is_user_logged_in()) { |
|
27 | 27 | $user_id = get_current_user_id(); |
28 | 28 | } |
29 | 29 | |
30 | -if ( ! empty( $user_id ) ) { |
|
31 | - $user = wp_get_current_user(); |
|
30 | +if (!empty($user_id)) { |
|
31 | + $user = wp_get_current_user(); |
|
32 | 32 | } |
33 | 33 | |
34 | -foreach ( $fields as $address_field ) { |
|
34 | +foreach ($fields as $address_field) { |
|
35 | 35 | |
36 | 36 | // Skip if it is hidden. |
37 | - if ( empty( $address_field['visible'] ) ) { |
|
37 | + if (empty($address_field['visible'])) { |
|
38 | 38 | continue; |
39 | 39 | } |
40 | 40 | |
41 | - do_action( 'getpaid_payment_form_address_field_before_' . $address_field['name'], $field_type, $address_field ); |
|
41 | + do_action('getpaid_payment_form_address_field_before_' . $address_field['name'], $field_type, $address_field); |
|
42 | 42 | |
43 | 43 | // Prepare variables. |
44 | 44 | $field_name = $address_field['name']; |
45 | 45 | $field_name = "{$field_type}[$field_name]"; |
46 | - $wrap_class = getpaid_get_form_element_grid_class( $address_field ); |
|
47 | - $wrap_class = esc_attr( "$wrap_class getpaid-address-field-wrapper" ); |
|
48 | - $placeholder = empty( $address_field['placeholder'] ) ? '' : esc_attr( $address_field['placeholder'] ); |
|
49 | - $description = empty( $address_field['description'] ) ? '' : wp_kses_post( $address_field['description'] ); |
|
50 | - $value = ! empty( $user_id ) ? get_user_meta( $user_id, '_' . $address_field['name'], true ) : ''; |
|
51 | - $label = empty( $address_field['label'] ) ? '' : wp_kses_post( $address_field['label'] ); |
|
52 | - |
|
53 | - $method_name = 'get_' . str_replace( 'wpinv_', '', $address_field['name'] ); |
|
54 | - if ( ! empty( $form->invoice ) && is_callable( array( $form->invoice, $method_name ) ) ) { |
|
55 | - $value = call_user_func( array( $form->invoice, $method_name ) ); |
|
46 | + $wrap_class = getpaid_get_form_element_grid_class($address_field); |
|
47 | + $wrap_class = esc_attr("$wrap_class getpaid-address-field-wrapper"); |
|
48 | + $placeholder = empty($address_field['placeholder']) ? '' : esc_attr($address_field['placeholder']); |
|
49 | + $description = empty($address_field['description']) ? '' : wp_kses_post($address_field['description']); |
|
50 | + $value = !empty($user_id) ? get_user_meta($user_id, '_' . $address_field['name'], true) : ''; |
|
51 | + $label = empty($address_field['label']) ? '' : wp_kses_post($address_field['label']); |
|
52 | + |
|
53 | + $method_name = 'get_' . str_replace('wpinv_', '', $address_field['name']); |
|
54 | + if (!empty($form->invoice) && is_callable(array($form->invoice, $method_name))) { |
|
55 | + $value = call_user_func(array($form->invoice, $method_name)); |
|
56 | 56 | } |
57 | 57 | |
58 | - if ( empty( $value ) && 'wpinv_first_name' == $address_field['name'] && ! empty( $user ) ) { |
|
58 | + if (empty($value) && 'wpinv_first_name' == $address_field['name'] && !empty($user)) { |
|
59 | 59 | $value = $user->first_name; |
60 | 60 | } |
61 | 61 | |
62 | - if ( empty( $value ) && 'wpinv_last_name' == $address_field['name'] && ! empty( $user ) ) { |
|
62 | + if (empty($value) && 'wpinv_last_name' == $address_field['name'] && !empty($user)) { |
|
63 | 63 | $value = $user->last_name; |
64 | 64 | } |
65 | 65 | |
66 | - if ( ! empty( $address_field['required'] ) ) { |
|
66 | + if (!empty($address_field['required'])) { |
|
67 | 67 | $label .= "<span class='text-danger'> *</span>"; |
68 | 68 | } |
69 | 69 | |
70 | 70 | // Display the country. |
71 | - if ( 'wpinv_country' == $address_field['name'] ) { |
|
71 | + if ('wpinv_country' == $address_field['name']) { |
|
72 | 72 | |
73 | 73 | echo "<div class='form-group $wrap_class getpaid-address-field-wrapper__country'"; |
74 | 74 | |
75 | 75 | echo aui()->select( |
76 | 76 | array( |
77 | 77 | 'options' => wpinv_get_country_list(), |
78 | - 'name' => esc_attr( $field_name ), |
|
79 | - 'id' => sanitize_html_class( $field_name ) . $uniqid, |
|
80 | - 'value' => esc_attr( $country ), |
|
78 | + 'name' => esc_attr($field_name), |
|
79 | + 'id' => sanitize_html_class($field_name) . $uniqid, |
|
80 | + 'value' => esc_attr($country), |
|
81 | 81 | 'placeholder' => $placeholder, |
82 | - 'required' => ! empty( $address_field['required'] ), |
|
83 | - 'label' => wp_kses_post( $label ), |
|
82 | + 'required' => !empty($address_field['required']), |
|
83 | + 'label' => wp_kses_post($label), |
|
84 | 84 | 'label_type' => 'vertical', |
85 | 85 | 'help_text' => $description, |
86 | 86 | 'class' => 'getpaid-address-field wpinv_country', |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | ) |
94 | 94 | ); |
95 | 95 | |
96 | - if ( wpinv_should_validate_vat_number() ) { |
|
96 | + if (wpinv_should_validate_vat_number()) { |
|
97 | 97 | |
98 | 98 | echo aui()->input( |
99 | 99 | array( |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | 'id' => "shipping-toggle$uniqid", |
103 | 103 | 'wrap_class' => 'getpaid-address-field-wrapper__address-confirm mt-1 d-none', |
104 | 104 | 'required' => false, |
105 | - 'label' => __( 'I certify that I live in the country selected above', 'invoicing' ) . "<span class='text-danger'> *</span>", |
|
105 | + 'label' => __('I certify that I live in the country selected above', 'invoicing') . "<span class='text-danger'> *</span>", |
|
106 | 106 | 'value' => 1, |
107 | 107 | 'checked' => true, |
108 | 108 | 'class' => 'w-auto', |
@@ -116,9 +116,9 @@ discard block |
||
116 | 116 | } |
117 | 117 | |
118 | 118 | // Display the state. |
119 | - elseif ( 'wpinv_state' == $address_field['name'] ) { |
|
119 | + elseif ('wpinv_state' == $address_field['name']) { |
|
120 | 120 | |
121 | - if ( empty( $value ) ) { |
|
121 | + if (empty($value)) { |
|
122 | 122 | $value = wpinv_get_default_state(); |
123 | 123 | } |
124 | 124 | |
@@ -128,15 +128,15 @@ discard block |
||
128 | 128 | $placeholder, |
129 | 129 | $label, |
130 | 130 | $description, |
131 | - ! empty( $address_field['required'] ), |
|
131 | + !empty($address_field['required']), |
|
132 | 132 | $wrap_class, |
133 | 133 | $field_name |
134 | 134 | ); |
135 | 135 | |
136 | 136 | } else { |
137 | 137 | |
138 | - $key = str_replace( 'wpinv_', '', $address_field['name'] ); |
|
139 | - $key = esc_attr( str_replace( '_', '-', $key ) ); |
|
138 | + $key = str_replace('wpinv_', '', $address_field['name']); |
|
139 | + $key = esc_attr(str_replace('_', '-', $key)); |
|
140 | 140 | $autocomplete = ''; |
141 | 141 | $replacements = array( |
142 | 142 | 'zip' => 'postal-code', |
@@ -149,37 +149,37 @@ discard block |
||
149 | 149 | ); |
150 | 150 | |
151 | 151 | |
152 | - if ( isset( $replacements[ $key ] ) ) { |
|
152 | + if (isset($replacements[$key])) { |
|
153 | 153 | $autocomplete = array( |
154 | - 'autocomplete' => "$field_type {$replacements[ $key ]}", |
|
154 | + 'autocomplete' => "$field_type {$replacements[$key]}", |
|
155 | 155 | ); |
156 | 156 | } |
157 | 157 | |
158 | 158 | $append = ''; |
159 | 159 | |
160 | - if ( 'billing' === $field_type && wpinv_should_validate_vat_number() && 'vat-number' === $key ) { |
|
161 | - $valid = esc_attr__( 'Valid', 'invoicing' ); |
|
162 | - $invalid = esc_attr__( 'Invalid', 'invoicing' ); |
|
163 | - $validate = esc_attr__( 'Validate', 'invoicing' ); |
|
160 | + if ('billing' === $field_type && wpinv_should_validate_vat_number() && 'vat-number' === $key) { |
|
161 | + $valid = esc_attr__('Valid', 'invoicing'); |
|
162 | + $invalid = esc_attr__('Invalid', 'invoicing'); |
|
163 | + $validate = esc_attr__('Validate', 'invoicing'); |
|
164 | 164 | $append = "<span class='btn btn-primary getpaid-vat-number-validate' data-valid='$valid' data-invalid='$invalid' data-validate='$validate'>$validate</span>"; |
165 | 165 | } |
166 | 166 | |
167 | - if ( 'billing' === $field_type ) { |
|
168 | - $description .= '<div class="getpaid-error-' . sanitize_html_class( $field_name ) . ' getpaid-custom-payment-form-errors alert alert-danger d-none"></div>'; |
|
167 | + if ('billing' === $field_type) { |
|
168 | + $description .= '<div class="getpaid-error-' . sanitize_html_class($field_name) . ' getpaid-custom-payment-form-errors alert alert-danger d-none"></div>'; |
|
169 | 169 | } |
170 | 170 | |
171 | 171 | echo aui()->input( |
172 | 172 | array( |
173 | - 'name' => esc_attr( $field_name ), |
|
174 | - 'id' => sanitize_html_class( $field_name ) . $uniqid, |
|
175 | - 'required' => ! empty( $address_field['required'] ), |
|
173 | + 'name' => esc_attr($field_name), |
|
174 | + 'id' => sanitize_html_class($field_name) . $uniqid, |
|
175 | + 'required' => !empty($address_field['required']), |
|
176 | 176 | 'placeholder' => $placeholder, |
177 | - 'label' => wp_kses_post( $label ), |
|
177 | + 'label' => wp_kses_post($label), |
|
178 | 178 | 'label_type' => 'vertical', |
179 | 179 | 'help_text' => $description, |
180 | 180 | 'type' => 'text', |
181 | - 'value' => esc_attr( $value ), |
|
182 | - 'class' => 'getpaid-address-field ' . esc_attr( $address_field['name'] ), |
|
181 | + 'value' => esc_attr($value), |
|
182 | + 'class' => 'getpaid-address-field ' . esc_attr($address_field['name']), |
|
183 | 183 | 'wrap_class' => "$wrap_class getpaid-address-field-wrapper__$key", |
184 | 184 | 'label_class' => 'getpaid-address-field-label getpaid-address-field-label__' . $key, |
185 | 185 | 'extra_attributes' => $autocomplete, |
@@ -189,7 +189,7 @@ discard block |
||
189 | 189 | |
190 | 190 | } |
191 | 191 | |
192 | - do_action( 'getpaid_payment_form_address_field_after_' . $address_field['name'], $field_type, $address_field ); |
|
192 | + do_action('getpaid_payment_form_address_field_after_' . $address_field['name'], $field_type, $address_field); |
|
193 | 193 | } |
194 | 194 | |
195 | 195 | echo '</div>'; |
@@ -7,35 +7,35 @@ 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 ( ! empty( $form->invoice ) ) { |
|
16 | - $value = sanitize_email( $form->invoice->get_email() ); |
|
17 | -} elseif ( is_user_logged_in() ) { |
|
15 | +if (!empty($form->invoice)) { |
|
16 | + $value = sanitize_email($form->invoice->get_email()); |
|
17 | +} elseif (is_user_logged_in()) { |
|
18 | 18 | $user = wp_get_current_user(); |
19 | - $value = sanitize_email( $user->user_email ); |
|
19 | + $value = sanitize_email($user->user_email); |
|
20 | 20 | } |
21 | 21 | |
22 | -if ( ! empty( $value ) && ! empty( $hide_billing_email ) ) { |
|
22 | +if (!empty($value) && !empty($hide_billing_email)) { |
|
23 | 23 | $class = 'd-none'; |
24 | 24 | } |
25 | 25 | |
26 | -do_action( 'getpaid_before_payment_form_billing_email', $form ); |
|
26 | +do_action('getpaid_before_payment_form_billing_email', $form); |
|
27 | 27 | |
28 | 28 | echo "<span class='$class'>"; |
29 | 29 | |
30 | 30 | echo aui()->input( |
31 | 31 | array( |
32 | 32 | 'name' => 'billing_email', |
33 | - 'id' => esc_attr( $id ) . uniqid( '_' ), |
|
34 | - 'placeholder' => empty( $placeholder ) ? '' : esc_attr( $placeholder ), |
|
35 | - 'required' => ! empty( $required ), |
|
36 | - 'label' => empty( $label ) ? '' : wp_kses_post( $label ) . '<span class="text-danger"> *</span>', |
|
33 | + 'id' => esc_attr($id) . uniqid('_'), |
|
34 | + 'placeholder' => empty($placeholder) ? '' : esc_attr($placeholder), |
|
35 | + 'required' => !empty($required), |
|
36 | + 'label' => empty($label) ? '' : wp_kses_post($label) . '<span class="text-danger"> *</span>', |
|
37 | 37 | 'label_type' => 'vertical', |
38 | - 'help_text' => empty( $description ) ? '' : wp_kses_post( $description ), |
|
38 | + 'help_text' => empty($description) ? '' : wp_kses_post($description), |
|
39 | 39 | 'type' => 'email', |
40 | 40 | 'value' => $value, |
41 | 41 | 'class' => 'wpinv_billing_email', |
@@ -47,4 +47,4 @@ discard block |
||
47 | 47 | |
48 | 48 | echo '</span>'; |
49 | 49 | |
50 | -do_action( 'getpaid_after_payment_form_billing_email', $form ); |
|
50 | +do_action('getpaid_after_payment_form_billing_email', $form); |
@@ -7,24 +7,24 @@ |
||
7 | 7 | * @version 1.0.19 |
8 | 8 | */ |
9 | 9 | |
10 | -defined( 'ABSPATH' ) || exit; |
|
10 | +defined('ABSPATH') || exit; |
|
11 | 11 | |
12 | -$label = empty( $label ) ? '' : wp_kses_post( $label ); |
|
13 | -$label_class = sanitize_key( preg_replace( '/[^A-Za-z0-9_-]/', '-', $label ) ); |
|
12 | +$label = empty($label) ? '' : wp_kses_post($label); |
|
13 | +$label_class = sanitize_key(preg_replace('/[^A-Za-z0-9_-]/', '-', $label)); |
|
14 | 14 | |
15 | -if ( ! empty( $required ) ) { |
|
15 | +if (!empty($required)) { |
|
16 | 16 | $label .= "<span class='text-danger'> *</span>"; |
17 | 17 | } |
18 | 18 | |
19 | 19 | echo aui()->input( |
20 | 20 | array( |
21 | - 'name' => esc_attr( $id ), |
|
22 | - 'id' => esc_attr( $id ) . uniqid( '_' ), |
|
23 | - 'placeholder' => empty( $placeholder ) ? '' : esc_attr( $placeholder ), |
|
24 | - 'required' => ! empty( $required ), |
|
21 | + 'name' => esc_attr($id), |
|
22 | + 'id' => esc_attr($id) . uniqid('_'), |
|
23 | + 'placeholder' => empty($placeholder) ? '' : esc_attr($placeholder), |
|
24 | + 'required' => !empty($required), |
|
25 | 25 | 'label' => $label, |
26 | 26 | 'label_type' => 'vertical', |
27 | - 'help_text' => empty( $description ) ? '' : wp_kses_post( $description ), |
|
27 | + 'help_text' => empty($description) ? '' : wp_kses_post($description), |
|
28 | 28 | 'type' => 'time', |
29 | 29 | 'class' => $label_class, |
30 | 30 | ) |
@@ -7,20 +7,20 @@ discard block |
||
7 | 7 | * @version 1.0.19 |
8 | 8 | */ |
9 | 9 | |
10 | -defined( 'ABSPATH' ) || exit; |
|
10 | +defined('ABSPATH') || exit; |
|
11 | 11 | |
12 | -$class = empty( $class ) ? 'btn-primary' : sanitize_html_class( $class ); |
|
13 | -$label = empty( $label ) ? esc_attr__( 'Pay %price% »', 'invoicing' ) : esc_attr( $label ); |
|
14 | -$free = empty( $free ) ? esc_attr__( 'Continue »', 'invoicing' ) : esc_attr( $free ); |
|
12 | +$class = empty($class) ? 'btn-primary' : sanitize_html_class($class); |
|
13 | +$label = empty($label) ? esc_attr__('Pay %price% »', 'invoicing') : esc_attr($label); |
|
14 | +$free = empty($free) ? esc_attr__('Continue »', 'invoicing') : esc_attr($free); |
|
15 | 15 | |
16 | -do_action( 'getpaid_before_payment_form_pay_button', $form ); |
|
16 | +do_action('getpaid_before_payment_form_pay_button', $form); |
|
17 | 17 | |
18 | 18 | echo aui()->input( |
19 | 19 | array( |
20 | - 'name' => esc_attr( $id ), |
|
21 | - 'id' => esc_attr( $id ) . uniqid( '_' ), |
|
20 | + 'name' => esc_attr($id), |
|
21 | + 'id' => esc_attr($id) . uniqid('_'), |
|
22 | 22 | 'value' => $label, |
23 | - 'help_text' => empty( $description ) ? '' : wp_kses_post( $description ), |
|
23 | + 'help_text' => empty($description) ? '' : wp_kses_post($description), |
|
24 | 24 | 'type' => 'submit', |
25 | 25 | 'class' => 'getpaid-payment-form-submit btn btn-block submit-button ' . $class, |
26 | 26 | 'extra_attributes' => array( |
@@ -30,4 +30,4 @@ discard block |
||
30 | 30 | ) |
31 | 31 | ); |
32 | 32 | |
33 | -do_action( 'getpaid_after_payment_form_pay_button', $form ); |
|
33 | +do_action('getpaid_after_payment_form_pay_button', $form); |
@@ -7,24 +7,24 @@ |
||
7 | 7 | * @version 1.0.19 |
8 | 8 | */ |
9 | 9 | |
10 | -defined( 'ABSPATH' ) || exit; |
|
10 | +defined('ABSPATH') || exit; |
|
11 | 11 | |
12 | -$label = empty( $label ) ? '' : wp_kses_post( $label ); |
|
13 | -$label_class = sanitize_key( preg_replace( '/[^A-Za-z0-9_-]/', '-', $label ) ); |
|
12 | +$label = empty($label) ? '' : wp_kses_post($label); |
|
13 | +$label_class = sanitize_key(preg_replace('/[^A-Za-z0-9_-]/', '-', $label)); |
|
14 | 14 | |
15 | -if ( ! empty( $required ) ) { |
|
15 | +if (!empty($required)) { |
|
16 | 16 | $label .= "<span class='text-danger'> *</span>"; |
17 | 17 | } |
18 | 18 | |
19 | 19 | echo aui()->input( |
20 | 20 | array( |
21 | - 'name' => esc_attr( $id ), |
|
22 | - 'id' => esc_attr( $id ) . uniqid( '_' ), |
|
23 | - 'placeholder' => empty( $placeholder ) ? '' : esc_attr( $placeholder ), |
|
24 | - 'required' => ! empty( $required ), |
|
21 | + 'name' => esc_attr($id), |
|
22 | + 'id' => esc_attr($id) . uniqid('_'), |
|
23 | + 'placeholder' => empty($placeholder) ? '' : esc_attr($placeholder), |
|
24 | + 'required' => !empty($required), |
|
25 | 25 | 'label' => $label, |
26 | 26 | 'label_type' => 'vertical', |
27 | - 'help_text' => empty( $description ) ? '' : wp_kses_post( $description ), |
|
27 | + 'help_text' => empty($description) ? '' : wp_kses_post($description), |
|
28 | 28 | 'type' => 'number', |
29 | 29 | 'class' => $label_class, |
30 | 30 | ) |