@@ -7,17 +7,17 @@ |
||
7 | 7 | * @version 1.0.19 |
8 | 8 | */ |
9 | 9 | |
10 | -defined( 'ABSPATH' ) || exit; |
|
10 | +defined('ABSPATH') || exit; |
|
11 | 11 | |
12 | -if ( empty( $text ) ) { |
|
12 | +if (empty($text)) { |
|
13 | 13 | return; |
14 | 14 | } |
15 | 15 | |
16 | 16 | aui()->alert( |
17 | 17 | array( |
18 | - 'content' => wp_kses_post( $text ), |
|
19 | - 'dismissible' => ! empty( $dismissible ), |
|
20 | - 'type' => empty( $class ) ? 'info' : str_replace( 'alert-', '', $class ), |
|
18 | + 'content' => wp_kses_post($text), |
|
19 | + 'dismissible' => !empty($dismissible), |
|
20 | + 'type' => empty($class) ? 'info' : str_replace('alert-', '', $class), |
|
21 | 21 | ), |
22 | 22 | true |
23 | 23 | ); |
@@ -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 | 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 | true |
@@ -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 | 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 | true |
@@ -44,18 +44,18 @@ discard block |
||
44 | 44 | } |
45 | 45 | |
46 | 46 | // Item radios; |
47 | -if ( $select_type == 'radios' ) { |
|
47 | +if ($select_type == 'radios') { |
|
48 | 48 | aui()->radio( |
49 | 49 | array( |
50 | - 'name' => esc_attr( $id ), |
|
51 | - 'id' => esc_attr( $id ) . uniqid( '_' ), |
|
52 | - 'label' => empty( $label ) ? '' : esc_html( $label ), |
|
50 | + 'name' => esc_attr($id), |
|
51 | + 'id' => esc_attr($id) . uniqid('_'), |
|
52 | + 'label' => empty($label) ? '' : esc_html($label), |
|
53 | 53 | 'label_type' => 'vertical', |
54 | 54 | 'class' => 'getpaid-price-select-radio getpaid-refresh-on-change w-100', |
55 | 55 | 'value' => $value, |
56 | 56 | 'inline' => false, |
57 | 57 | 'options' => $options, |
58 | - 'help_text' => empty( $description ) ? '' : wp_kses_post( $description ), |
|
58 | + 'help_text' => empty($description) ? '' : wp_kses_post($description), |
|
59 | 59 | ), |
60 | 60 | true |
61 | 61 | ); |
@@ -64,30 +64,30 @@ discard block |
||
64 | 64 | |
65 | 65 | |
66 | 66 | // Display the label. |
67 | -if ( ! empty( $label ) ) { |
|
68 | - $label = esc_html( $label ); |
|
67 | +if (!empty($label)) { |
|
68 | + $label = esc_html($label); |
|
69 | 69 | echo "<label>$label</label>"; |
70 | 70 | } |
71 | 71 | |
72 | 72 | // Item buttons; |
73 | -if ( $select_type == 'buttons' || $select_type == 'circles' ) { |
|
73 | +if ($select_type == 'buttons' || $select_type == 'circles') { |
|
74 | 74 | |
75 | 75 | $class = 'getpaid-price-buttons'; |
76 | 76 | |
77 | - if ( $select_type == 'circles' ) { |
|
77 | + if ($select_type == 'circles') { |
|
78 | 78 | $class .= ' getpaid-price-circles'; |
79 | 79 | } |
80 | 80 | echo "<div class='$class'>"; |
81 | 81 | |
82 | - foreach ( $options as $price => $label ) { |
|
83 | - $label = esc_html( $label ); |
|
84 | - $price = esc_attr( $price ); |
|
85 | - $_id = $id . uniqid( '_' ); |
|
86 | - $checked = checked( $price, $value, false ); |
|
82 | + foreach ($options as $price => $label) { |
|
83 | + $label = esc_html($label); |
|
84 | + $price = esc_attr($price); |
|
85 | + $_id = $id . uniqid('_'); |
|
86 | + $checked = checked($price, $value, false); |
|
87 | 87 | |
88 | 88 | $class = 'rounded'; |
89 | 89 | |
90 | - if ( $select_type == 'circles' ) { |
|
90 | + if ($select_type == 'circles') { |
|
91 | 91 | $class = ''; |
92 | 92 | } |
93 | 93 | echo " |
@@ -103,13 +103,13 @@ discard block |
||
103 | 103 | } |
104 | 104 | |
105 | 105 | // Item checkboxes; |
106 | -if ( $select_type == 'checkboxes' ) { |
|
106 | +if ($select_type == 'checkboxes') { |
|
107 | 107 | echo '<div class="form-group">'; |
108 | 108 | |
109 | - foreach ( $options as $price => $label ) { |
|
110 | - $label = esc_html( $label ); |
|
111 | - $price = esc_attr( $price ); |
|
112 | - $checked = checked( $price, $value, false ); |
|
109 | + foreach ($options as $price => $label) { |
|
110 | + $label = esc_html($label); |
|
111 | + $price = esc_attr($price); |
|
112 | + $checked = checked($price, $value, false); |
|
113 | 113 | echo " |
114 | 114 | <label class='d-block'> |
115 | 115 | <input type='checkbox' class='getpaid-price-select-checkbox getpaid-refresh-on-change w-auto' name='{$id}[]' value='$price' $checked /> |
@@ -122,6 +122,6 @@ discard block |
||
122 | 122 | |
123 | 123 | } |
124 | 124 | |
125 | -if ( ! empty( $description ) ) { |
|
125 | +if (!empty($description)) { |
|
126 | 126 | echo "<small class='form-text text-muted'>$description</small>"; |
127 | 127 | } |
@@ -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 | 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', |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | true |
95 | 95 | ); |
96 | 96 | |
97 | - if ( wpinv_should_validate_vat_number() ) { |
|
97 | + if (wpinv_should_validate_vat_number()) { |
|
98 | 98 | |
99 | 99 | aui()->input( |
100 | 100 | array( |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | 'id' => "shipping-toggle$uniqid", |
104 | 104 | 'wrap_class' => 'getpaid-address-field-wrapper__address-confirm mt-1 d-none', |
105 | 105 | 'required' => false, |
106 | - 'label' => __( 'I certify that I live in the country selected above', 'invoicing' ) . "<span class='text-danger'> *</span>", |
|
106 | + 'label' => __('I certify that I live in the country selected above', 'invoicing') . "<span class='text-danger'> *</span>", |
|
107 | 107 | 'value' => 1, |
108 | 108 | 'checked' => true, |
109 | 109 | 'class' => 'w-auto', |
@@ -118,9 +118,9 @@ discard block |
||
118 | 118 | } |
119 | 119 | |
120 | 120 | // Display the state. |
121 | - elseif ( 'wpinv_state' == $address_field['name'] ) { |
|
121 | + elseif ('wpinv_state' == $address_field['name']) { |
|
122 | 122 | |
123 | - if ( empty( $value ) ) { |
|
123 | + if (empty($value)) { |
|
124 | 124 | $value = wpinv_get_default_state(); |
125 | 125 | } |
126 | 126 | |
@@ -130,15 +130,15 @@ discard block |
||
130 | 130 | $placeholder, |
131 | 131 | $label, |
132 | 132 | $description, |
133 | - ! empty( $address_field['required'] ), |
|
133 | + !empty($address_field['required']), |
|
134 | 134 | $wrap_class, |
135 | 135 | $field_name |
136 | 136 | ); |
137 | 137 | |
138 | 138 | } else { |
139 | 139 | |
140 | - $key = str_replace( 'wpinv_', '', $address_field['name'] ); |
|
141 | - $key = esc_attr( str_replace( '_', '-', $key ) ); |
|
140 | + $key = str_replace('wpinv_', '', $address_field['name']); |
|
141 | + $key = esc_attr(str_replace('_', '-', $key)); |
|
142 | 142 | $autocomplete = ''; |
143 | 143 | $replacements = array( |
144 | 144 | 'zip' => 'postal-code', |
@@ -151,37 +151,37 @@ discard block |
||
151 | 151 | ); |
152 | 152 | |
153 | 153 | |
154 | - if ( isset( $replacements[ $key ] ) ) { |
|
154 | + if (isset($replacements[$key])) { |
|
155 | 155 | $autocomplete = array( |
156 | - 'autocomplete' => "$field_type {$replacements[ $key ]}", |
|
156 | + 'autocomplete' => "$field_type {$replacements[$key]}", |
|
157 | 157 | ); |
158 | 158 | } |
159 | 159 | |
160 | 160 | $append = ''; |
161 | 161 | |
162 | - if ( 'billing' === $field_type && wpinv_should_validate_vat_number() && 'vat-number' === $key ) { |
|
163 | - $valid = esc_attr__( 'Valid', 'invoicing' ); |
|
164 | - $invalid = esc_attr__( 'Invalid', 'invoicing' ); |
|
165 | - $validate = esc_attr__( 'Validate', 'invoicing' ); |
|
162 | + if ('billing' === $field_type && wpinv_should_validate_vat_number() && 'vat-number' === $key) { |
|
163 | + $valid = esc_attr__('Valid', 'invoicing'); |
|
164 | + $invalid = esc_attr__('Invalid', 'invoicing'); |
|
165 | + $validate = esc_attr__('Validate', 'invoicing'); |
|
166 | 166 | $append = "<span class='btn btn-primary getpaid-vat-number-validate' data-valid='$valid' data-invalid='$invalid' data-validate='$validate'>$validate</span>"; |
167 | 167 | } |
168 | 168 | |
169 | - if ( 'billing' === $field_type ) { |
|
170 | - $description .= '<div class="getpaid-error-' . sanitize_html_class( $field_name ) . ' getpaid-custom-payment-form-errors alert alert-danger d-none"></div>'; |
|
169 | + if ('billing' === $field_type) { |
|
170 | + $description .= '<div class="getpaid-error-' . sanitize_html_class($field_name) . ' getpaid-custom-payment-form-errors alert alert-danger d-none"></div>'; |
|
171 | 171 | } |
172 | 172 | |
173 | 173 | aui()->input( |
174 | 174 | array( |
175 | - 'name' => esc_attr( $field_name ), |
|
176 | - 'id' => sanitize_html_class( $field_name ) . $uniqid, |
|
177 | - 'required' => ! empty( $address_field['required'] ), |
|
175 | + 'name' => esc_attr($field_name), |
|
176 | + 'id' => sanitize_html_class($field_name) . $uniqid, |
|
177 | + 'required' => !empty($address_field['required']), |
|
178 | 178 | 'placeholder' => $placeholder, |
179 | - 'label' => wp_kses_post( $label ), |
|
179 | + 'label' => wp_kses_post($label), |
|
180 | 180 | 'label_type' => 'vertical', |
181 | 181 | 'help_text' => $description, |
182 | 182 | 'type' => 'text', |
183 | - 'value' => esc_attr( $value ), |
|
184 | - 'class' => 'getpaid-address-field ' . esc_attr( $address_field['name'] ), |
|
183 | + 'value' => esc_attr($value), |
|
184 | + 'class' => 'getpaid-address-field ' . esc_attr($address_field['name']), |
|
185 | 185 | 'wrap_class' => "$wrap_class getpaid-address-field-wrapper__$key", |
186 | 186 | 'label_class' => 'getpaid-address-field-label getpaid-address-field-label__' . $key, |
187 | 187 | 'extra_attributes' => $autocomplete, |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | |
193 | 193 | } |
194 | 194 | |
195 | - do_action( 'getpaid_payment_form_address_field_after_' . $address_field['name'], $field_type, $address_field ); |
|
195 | + do_action('getpaid_payment_form_address_field_after_' . $address_field['name'], $field_type, $address_field); |
|
196 | 196 | } |
197 | 197 | |
198 | 198 | 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 | 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', |
@@ -48,4 +48,4 @@ discard block |
||
48 | 48 | |
49 | 49 | echo '</span>'; |
50 | 50 | |
51 | -do_action( 'getpaid_after_payment_form_billing_email', $form ); |
|
51 | +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 | 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 | 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( |
@@ -31,4 +31,4 @@ discard block |
||
31 | 31 | true |
32 | 32 | ); |
33 | 33 | |
34 | -do_action( 'getpaid_after_payment_form_pay_button', $form ); |
|
34 | +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 | 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 | ), |
@@ -7,63 +7,63 @@ |
||
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 ) ); |
|
14 | -if ( ! empty( $required ) ) { |
|
12 | +$label = empty($label) ? '' : wp_kses_post($label); |
|
13 | +$label_class = sanitize_key(preg_replace('/[^A-Za-z0-9_-]/', '-', $label)); |
|
14 | +if (!empty($required)) { |
|
15 | 15 | $label .= "<span class='text-danger'> *</span>"; |
16 | 16 | } |
17 | 17 | |
18 | 18 | $disable_dates = array(); |
19 | 19 | |
20 | -if ( ! empty( $disabled_dates ) ) { |
|
21 | - $disabled_dates = preg_replace( '/\s+/', '', $disabled_dates ); |
|
22 | - $disabled_dates = str_ireplace( 'today', current_time( 'Y-m-d' ), $disabled_dates ); |
|
23 | - $disabled_dates = array_filter( explode( ',', $disabled_dates ) ); |
|
20 | +if (!empty($disabled_dates)) { |
|
21 | + $disabled_dates = preg_replace('/\s+/', '', $disabled_dates); |
|
22 | + $disabled_dates = str_ireplace('today', current_time('Y-m-d'), $disabled_dates); |
|
23 | + $disabled_dates = array_filter(explode(',', $disabled_dates)); |
|
24 | 24 | |
25 | - foreach ( $disabled_dates as $disabled_date ) { |
|
25 | + foreach ($disabled_dates as $disabled_date) { |
|
26 | 26 | |
27 | - $disabled_date = trim( $disabled_date ); |
|
27 | + $disabled_date = trim($disabled_date); |
|
28 | 28 | |
29 | - if ( false === strpos( $disabled_date, '|' ) ) { |
|
29 | + if (false === strpos($disabled_date, '|')) { |
|
30 | 30 | $disable_dates[] = $disabled_date; |
31 | 31 | continue; |
32 | 32 | } |
33 | 33 | |
34 | - $disabled_date = explode( '|', $disabled_date ); |
|
34 | + $disabled_date = explode('|', $disabled_date); |
|
35 | 35 | $disable_dates[] = array( |
36 | - 'from' => trim( $disabled_date[0] ), |
|
37 | - 'to' => trim( $disabled_date[1] ), |
|
36 | + 'from' => trim($disabled_date[0]), |
|
37 | + 'to' => trim($disabled_date[1]), |
|
38 | 38 | ); |
39 | 39 | |
40 | 40 | } |
41 | 41 | } |
42 | 42 | |
43 | 43 | $options = array( |
44 | - 'data-default-date' => empty( 'default_date' ) ? false : $default_date, |
|
45 | - 'data-min-date' => empty( 'min_date' ) ? false : $min_date, |
|
46 | - 'data-max-date' => empty( 'max_date' ) ? false : $max_date, |
|
47 | - 'data-mode' => empty( 'mode' ) ? 'single' : $mode, |
|
48 | - 'data-alt-format' => get_option( 'date_format', 'F j, Y' ), |
|
44 | + 'data-default-date' => empty('default_date') ? false : $default_date, |
|
45 | + 'data-min-date' => empty('min_date') ? false : $min_date, |
|
46 | + 'data-max-date' => empty('max_date') ? false : $max_date, |
|
47 | + 'data-mode' => empty('mode') ? 'single' : $mode, |
|
48 | + 'data-alt-format' => get_option('date_format', 'F j, Y'), |
|
49 | 49 | 'data-date-format' => 'Y-m-d', |
50 | 50 | 'data-alt-input' => 'true', |
51 | - 'data-disable_alt' => empty( $disabled_dates ) ? false : wp_json_encode( $disable_dates ), |
|
52 | - 'data-disable_days_alt' => empty( $disable_days ) ? false : wp_json_encode( wp_parse_id_list( $disable_days ) ), |
|
51 | + 'data-disable_alt' => empty($disabled_dates) ? false : wp_json_encode($disable_dates), |
|
52 | + 'data-disable_days_alt' => empty($disable_days) ? false : wp_json_encode(wp_parse_id_list($disable_days)), |
|
53 | 53 | ); |
54 | 54 | |
55 | 55 | aui()->input( |
56 | 56 | array( |
57 | - 'name' => esc_attr( $id ), |
|
58 | - 'id' => esc_attr( $id ) . uniqid( '_' ), |
|
59 | - 'placeholder' => empty( $placeholder ) ? '' : esc_attr( $placeholder ), |
|
60 | - 'required' => ! empty( $required ), |
|
57 | + 'name' => esc_attr($id), |
|
58 | + 'id' => esc_attr($id) . uniqid('_'), |
|
59 | + 'placeholder' => empty($placeholder) ? '' : esc_attr($placeholder), |
|
60 | + 'required' => !empty($required), |
|
61 | 61 | 'label' => $label, |
62 | 62 | 'label_type' => 'vertical', |
63 | - 'help_text' => empty( $description ) ? '' : wp_kses_post( $description ), |
|
63 | + 'help_text' => empty($description) ? '' : wp_kses_post($description), |
|
64 | 64 | 'type' => 'datepicker', |
65 | 65 | 'class' => $label_class . ' getpaid-init-flatpickr flatpickr-input', |
66 | - 'extra_attributes' => array_filter( apply_filters( 'getpaid_date_field_attributes', $options ) ), |
|
66 | + 'extra_attributes' => array_filter(apply_filters('getpaid_date_field_attributes', $options)), |
|
67 | 67 | ), |
68 | 68 | true |
69 | 69 | ); |