@@ -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 | ) |
@@ -7,62 +7,62 @@ |
||
| 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 | echo 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 | ); |
@@ -7,25 +7,25 @@ |
||
| 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()->select( |
| 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 ), |
|
| 28 | - 'options' => empty( $options ) ? array() : array_combine( $options, $options ), |
|
| 27 | + 'help_text' => empty($description) ? '' : wp_kses_post($description), |
|
| 28 | + 'options' => empty($options) ? array() : array_combine($options, $options), |
|
| 29 | 29 | 'class' => $label_class, |
| 30 | 30 | ) |
| 31 | 31 | ); |
@@ -7,44 +7,44 @@ |
||
| 7 | 7 | * @version 1.0.19 |
| 8 | 8 | */ |
| 9 | 9 | |
| 10 | -defined( 'ABSPATH' ) || exit; |
|
| 10 | +defined('ABSPATH') || exit; |
|
| 11 | 11 | |
| 12 | -if ( empty( $form->get_items() ) ) { |
|
| 12 | +if (empty($form->get_items())) { |
|
| 13 | 13 | return; |
| 14 | 14 | } |
| 15 | 15 | |
| 16 | -if ( ! empty( $GLOBALS['getpaid_force_checkbox'] ) ) { |
|
| 16 | +if (!empty($GLOBALS['getpaid_force_checkbox'])) { |
|
| 17 | 17 | $items_type = 'checkbox'; |
| 18 | 18 | } |
| 19 | 19 | |
| 20 | -if ( empty( $items_type ) ) { |
|
| 20 | +if (empty($items_type)) { |
|
| 21 | 21 | $items_type = 'total'; |
| 22 | 22 | } |
| 23 | 23 | |
| 24 | -do_action( 'getpaid_before_payment_form_items', $form ); |
|
| 24 | +do_action('getpaid_before_payment_form_items', $form); |
|
| 25 | 25 | |
| 26 | -switch ( $items_type ) { |
|
| 26 | +switch ($items_type) { |
|
| 27 | 27 | case 'radio': |
| 28 | - wpinv_get_template( 'payment-forms/variations/radio.php', compact( 'form', 'items_type' ) ); |
|
| 28 | + wpinv_get_template('payment-forms/variations/radio.php', compact('form', 'items_type')); |
|
| 29 | 29 | break; |
| 30 | 30 | case 'checkbox': |
| 31 | - wpinv_get_template( 'payment-forms/variations/checkbox.php', compact( 'form', 'items_type' ) ); |
|
| 31 | + wpinv_get_template('payment-forms/variations/checkbox.php', compact('form', 'items_type')); |
|
| 32 | 32 | break; |
| 33 | 33 | case 'select': |
| 34 | - wpinv_get_template( 'payment-forms/variations/select.php', compact( 'form', 'items_type' ) ); |
|
| 34 | + wpinv_get_template('payment-forms/variations/select.php', compact('form', 'items_type')); |
|
| 35 | 35 | break; |
| 36 | 36 | } |
| 37 | 37 | |
| 38 | -do_action( 'getpaid_before_payment_form_cart', $form ); |
|
| 38 | +do_action('getpaid_before_payment_form_cart', $form); |
|
| 39 | 39 | |
| 40 | 40 | // Display the cart totals. |
| 41 | -if ( ! empty( $hide_cart ) ) { |
|
| 41 | +if (!empty($hide_cart)) { |
|
| 42 | 42 | echo '<div class="d-none">'; |
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | // Display the cart totals. |
| 46 | -wpinv_get_template( 'payment-forms/cart.php', compact( 'form', 'items_type' ) ); |
|
| 46 | +wpinv_get_template('payment-forms/cart.php', compact('form', 'items_type')); |
|
| 47 | 47 | |
| 48 | -if ( ! empty( $hide_cart ) ) { |
|
| 48 | +if (!empty($hide_cart)) { |
|
| 49 | 49 | echo '</div>'; |
| 50 | 50 | } |
@@ -7,26 +7,26 @@ |
||
| 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()->radio( |
| 20 | 20 | array( |
| 21 | - 'name' => esc_attr( $id ), |
|
| 22 | - 'id' => esc_attr( $id ) . uniqid( '_' ), |
|
| 23 | - 'required' => ! empty( $required ), |
|
| 21 | + 'name' => esc_attr($id), |
|
| 22 | + 'id' => esc_attr($id) . uniqid('_'), |
|
| 23 | + 'required' => !empty($required), |
|
| 24 | 24 | 'label' => $label, |
| 25 | 25 | 'label_type' => 'vertical', |
| 26 | 26 | 'class' => 'w-auto', |
| 27 | 27 | 'inline' => false, |
| 28 | - 'options' => empty( $options ) ? array() : array_combine( $options, $options ), |
|
| 29 | - 'help_text' => empty( $description ) ? '' : wp_kses_post( $description ), |
|
| 28 | + 'options' => empty($options) ? array() : array_combine($options, $options), |
|
| 29 | + 'help_text' => empty($description) ? '' : wp_kses_post($description), |
|
| 30 | 30 | 'class' => $label_class, |
| 31 | 31 | ) |
| 32 | 32 | ); |