@@ -7,7 +7,7 @@ discard block |
||
7 | 7 | * @version 1.0.19 |
8 | 8 | */ |
9 | 9 | |
10 | -defined( 'ABSPATH' ) || exit; |
|
10 | +defined('ABSPATH') || exit; |
|
11 | 11 | |
12 | 12 | ?> |
13 | 13 | |
@@ -31,44 +31,44 @@ discard block |
||
31 | 31 | |
32 | 32 | <div class='form-group'> |
33 | 33 | <label class="d-block"> |
34 | - <span><?php esc_html_e( 'Field Label', 'invoicing' ); ?></span> |
|
34 | + <span><?php esc_html_e('Field Label', 'invoicing'); ?></span> |
|
35 | 35 | <input v-model='field.label' class='form-control' type="text"/> |
36 | 36 | </label> |
37 | 37 | </div> |
38 | 38 | |
39 | 39 | <div class='form-group'> |
40 | 40 | <label class="d-block"> |
41 | - <span><?php esc_html_e( 'Placeholder text', 'invoicing' ); ?></span> |
|
41 | + <span><?php esc_html_e('Placeholder text', 'invoicing'); ?></span> |
|
42 | 42 | <input v-model='field.placeholder' class='form-control' type="text"/> |
43 | 43 | </label> |
44 | 44 | </div> |
45 | 45 | |
46 | 46 | <div class='form-group'> |
47 | 47 | <label class="d-block"> |
48 | - <span><?php esc_html_e( 'Width', 'invoicing' ) ?></span> |
|
48 | + <span><?php esc_html_e('Width', 'invoicing') ?></span> |
|
49 | 49 | <select class='form-control custom-select' v-model='field.grid_width'> |
50 | - <option value='full'><?php esc_html_e( 'Full Width', 'invoicing' ); ?></option> |
|
51 | - <option value='half'><?php esc_html_e( 'Half Width', 'invoicing' ); ?></option> |
|
52 | - <option value='third'><?php esc_html_e( '1/3 Width', 'invoicing' ); ?></option> |
|
50 | + <option value='full'><?php esc_html_e('Full Width', 'invoicing'); ?></option> |
|
51 | + <option value='half'><?php esc_html_e('Half Width', 'invoicing'); ?></option> |
|
52 | + <option value='third'><?php esc_html_e('1/3 Width', 'invoicing'); ?></option> |
|
53 | 53 | </select> |
54 | 54 | </label> |
55 | 55 | </div> |
56 | 56 | |
57 | 57 | <div class='form-group'> |
58 | 58 | <label class="d-block"> |
59 | - <span><?php esc_html_e( 'Help Text', 'invoicing' ); ?></span> |
|
60 | - <textarea placeholder='<?php esc_attr_e( 'Add some help text for this field', 'invoicing' ); ?>' v-model='field.description' class='form-control' rows='3'></textarea> |
|
59 | + <span><?php esc_html_e('Help Text', 'invoicing'); ?></span> |
|
60 | + <textarea placeholder='<?php esc_attr_e('Add some help text for this field', 'invoicing'); ?>' v-model='field.description' class='form-control' rows='3'></textarea> |
|
61 | 61 | </label> |
62 | 62 | </div> |
63 | 63 | |
64 | 64 | <div class='form-group form-check'> |
65 | 65 | <input :id="active_form_element.id + '_edit_required' + index" v-model='field.required' type='checkbox' class='form-check-input' /> |
66 | - <label class='form-check-label' :for="active_form_element.id + '_edit_required' + index"><?php esc_html_e( 'Is required', 'invoicing' ); ?></label> |
|
66 | + <label class='form-check-label' :for="active_form_element.id + '_edit_required' + index"><?php esc_html_e('Is required', 'invoicing'); ?></label> |
|
67 | 67 | </div> |
68 | 68 | |
69 | 69 | <div class='form-group form-check'> |
70 | 70 | <input :id="active_form_element.id + '_edit_visible' + index" v-model='field.visible' type='checkbox' class='form-check-input' /> |
71 | - <label class='form-check-label' :for="active_form_element.id + '_edit_visible' + index"><?php esc_html_e( 'Is visible', 'invoicing' ); ?></label> |
|
71 | + <label class='form-check-label' :for="active_form_element.id + '_edit_visible' + index"><?php esc_html_e('Is visible', 'invoicing'); ?></label> |
|
72 | 72 | </div> |
73 | 73 | |
74 | 74 | </div> |
@@ -81,18 +81,18 @@ discard block |
||
81 | 81 | |
82 | 82 | <div class='form-group'> |
83 | 83 | <label class="d-block"> |
84 | - <span><?php esc_html_e( 'Address Type', 'invoicing' ) ?><span> |
|
84 | + <span><?php esc_html_e('Address Type', 'invoicing') ?><span> |
|
85 | 85 | <select class='form-control custom-select' v-model='active_form_element.address_type'> |
86 | - <option value='billing'><?php esc_html_e( 'Billing', 'invoicing' ); ?></option> |
|
87 | - <option value='shipping'><?php esc_html_e( 'Shipping', 'invoicing' ); ?></option> |
|
88 | - <option value='both'><?php esc_html_e( 'Both', 'invoicing' ); ?></option> |
|
86 | + <option value='billing'><?php esc_html_e('Billing', 'invoicing'); ?></option> |
|
87 | + <option value='shipping'><?php esc_html_e('Shipping', 'invoicing'); ?></option> |
|
88 | + <option value='both'><?php esc_html_e('Both', 'invoicing'); ?></option> |
|
89 | 89 | </select> |
90 | 90 | </label> |
91 | 91 | </div> |
92 | 92 | |
93 | 93 | <div class='form-group' v-if="active_form_element.address_type == 'both'"> |
94 | 94 | <label class="d-block"> |
95 | - <span><?php esc_html_e( 'Shipping Address Toggle', 'invoicing' ) ?><span> |
|
95 | + <span><?php esc_html_e('Shipping Address Toggle', 'invoicing') ?><span> |
|
96 | 96 | <input type="text" class='form-control custom-select' v-model='active_form_element.shipping_address_toggle' > |
97 | 97 | </label> |
98 | 98 | </div> |
@@ -7,13 +7,13 @@ |
||
7 | 7 | * @version 1.0.19 |
8 | 8 | */ |
9 | 9 | |
10 | -defined( 'ABSPATH' ) || exit; |
|
10 | +defined('ABSPATH') || exit; |
|
11 | 11 | |
12 | 12 | ?> |
13 | 13 | |
14 | 14 | <div class='wpinv-address-wrapper row'> |
15 | 15 | |
16 | - <h4 v-if="form_element.address_type == 'both'" class="col-12 mb-3"><?php _e( 'Billing / Shipping Address', 'invoicing' ); ?></h4> |
|
16 | + <h4 v-if="form_element.address_type == 'both'" class="col-12 mb-3"><?php _e('Billing / Shipping Address', 'invoicing'); ?></h4> |
|
17 | 17 | |
18 | 18 | <div class='form-group address-field-preview wpinv-payment-form-field-preview' v-for='(field, index) in visible_fields( form_element.fields )' :class='grid_class( field )' :key='field.name'> |
19 | 19 | <label class="d-block w-100"> |
@@ -11,46 +11,46 @@ discard block |
||
11 | 11 | * @var string $country The current user's country |
12 | 12 | */ |
13 | 13 | |
14 | -defined( 'ABSPATH' ) || exit; |
|
14 | +defined('ABSPATH') || exit; |
|
15 | 15 | |
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 | -foreach ( $fields as $address_field ) { |
|
21 | +foreach ($fields as $address_field) { |
|
22 | 22 | |
23 | 23 | // Skip if it is hidden. |
24 | - if ( empty( $address_field['visible'] ) ) { |
|
24 | + if (empty($address_field['visible'])) { |
|
25 | 25 | continue; |
26 | 26 | } |
27 | 27 | |
28 | 28 | // Prepare variables. |
29 | 29 | $field_name = $address_field['name']; |
30 | 30 | $field_name = "{$field_type}[$field_name]"; |
31 | - $wrap_class = getpaid_get_form_element_grid_class( $address_field ); |
|
32 | - $wrap_class = esc_attr( "$wrap_class getpaid-address-field-wrapper" ); |
|
33 | - $placeholder = empty( $address_field['placeholder'] ) ? '' : esc_attr( $address_field['placeholder'] ); |
|
34 | - $description = empty( $address_field['description'] ) ? '' : wp_kses_post( $address_field['description'] ); |
|
35 | - $value = is_user_logged_in() ? get_user_meta( get_current_user_id(), '_' . $address_field['name'], true ) : ''; |
|
36 | - $label = empty( $address_field['label'] ) ? '' : wp_kses_post( $address_field['label'] ); |
|
37 | - |
|
38 | - if ( ! empty( $address_field['required'] ) ) { |
|
31 | + $wrap_class = getpaid_get_form_element_grid_class($address_field); |
|
32 | + $wrap_class = esc_attr("$wrap_class getpaid-address-field-wrapper"); |
|
33 | + $placeholder = empty($address_field['placeholder']) ? '' : esc_attr($address_field['placeholder']); |
|
34 | + $description = empty($address_field['description']) ? '' : wp_kses_post($address_field['description']); |
|
35 | + $value = is_user_logged_in() ? get_user_meta(get_current_user_id(), '_' . $address_field['name'], true) : ''; |
|
36 | + $label = empty($address_field['label']) ? '' : wp_kses_post($address_field['label']); |
|
37 | + |
|
38 | + if (!empty($address_field['required'])) { |
|
39 | 39 | $label .= "<span class='text-danger'> *</span>"; |
40 | 40 | } |
41 | 41 | |
42 | 42 | // Display the country. |
43 | - if ( 'wpinv_country' == $address_field['name'] ) { |
|
43 | + if ('wpinv_country' == $address_field['name']) { |
|
44 | 44 | |
45 | 45 | echo aui()->select( |
46 | 46 | array( |
47 | 47 | 'options' => wpinv_get_country_list(), |
48 | - 'name' => esc_attr( $field_name ), |
|
49 | - 'id' => sanitize_html_class( $field_name ) . $uniqid, |
|
50 | - 'value' => sanitize_text_field( $country ), |
|
48 | + 'name' => esc_attr($field_name), |
|
49 | + 'id' => sanitize_html_class($field_name) . $uniqid, |
|
50 | + 'value' => sanitize_text_field($country), |
|
51 | 51 | 'placeholder' => $placeholder, |
52 | - 'required' => ! empty( $address_field['required'] ), |
|
53 | - 'label' => wp_kses_post( $label ), |
|
52 | + 'required' => !empty($address_field['required']), |
|
53 | + 'label' => wp_kses_post($label), |
|
54 | 54 | 'label_type' => 'vertical', |
55 | 55 | 'help_text' => $description, |
56 | 56 | 'class' => 'getpaid-address-field wpinv_country', |
@@ -63,19 +63,19 @@ discard block |
||
63 | 63 | } |
64 | 64 | |
65 | 65 | // Display the state. |
66 | - if ( 'wpinv_state' == $address_field['name'] ) { |
|
66 | + if ('wpinv_state' == $address_field['name']) { |
|
67 | 67 | |
68 | - if ( empty( $value ) ) { |
|
68 | + if (empty($value)) { |
|
69 | 69 | $value = wpinv_get_default_state(); |
70 | 70 | } |
71 | 71 | |
72 | - echo getpaid_get_states_select_markup ( |
|
72 | + echo getpaid_get_states_select_markup( |
|
73 | 73 | $country, |
74 | 74 | $value, |
75 | 75 | $placeholder, |
76 | 76 | $label, |
77 | 77 | $description, |
78 | - ! empty( $address_field['required'] ), |
|
78 | + !empty($address_field['required']), |
|
79 | 79 | $wrap_class, |
80 | 80 | $field_name |
81 | 81 | ); |
@@ -83,20 +83,20 @@ discard block |
||
83 | 83 | continue; |
84 | 84 | } |
85 | 85 | |
86 | - $key = str_replace( 'wpinv_', '', $address_field['name'] ); |
|
87 | - $key = esc_attr( str_replace( '_', '-', $key ) ); |
|
86 | + $key = str_replace('wpinv_', '', $address_field['name']); |
|
87 | + $key = esc_attr(str_replace('_', '-', $key)); |
|
88 | 88 | echo aui()->input( |
89 | 89 | array( |
90 | - 'name' => esc_attr( $field_name ), |
|
91 | - 'id' => sanitize_html_class( $field_name ) . $uniqid, |
|
92 | - 'required' => ! empty( $address_field['required'] ), |
|
90 | + 'name' => esc_attr($field_name), |
|
91 | + 'id' => sanitize_html_class($field_name) . $uniqid, |
|
92 | + 'required' => !empty($address_field['required']), |
|
93 | 93 | 'placeholder' => $placeholder, |
94 | - 'label' => wp_kses_post( $label ), |
|
94 | + 'label' => wp_kses_post($label), |
|
95 | 95 | 'label_type' => 'vertical', |
96 | 96 | 'help_text' => $description, |
97 | 97 | 'type' => 'text', |
98 | - 'value' => sanitize_text_field( $value ), |
|
99 | - 'class' => 'getpaid-address-field ' . esc_attr( $address_field['name'] ), |
|
98 | + 'value' => sanitize_text_field($value), |
|
99 | + 'class' => 'getpaid-address-field ' . esc_attr($address_field['name']), |
|
100 | 100 | 'wrap_class' => "$wrap_class getpaid-address-field-wrapper__$key", |
101 | 101 | 'label_class' => 'getpaid-address-field-label getpaid-address-field-label__' . $key, |
102 | 102 | ) |
@@ -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). |
@@ -50,9 +50,9 @@ discard block |
||
50 | 50 | <!-- Start Billing Address --> |
51 | 51 | <div class="getpaid-billing-address-wrapper"> |
52 | 52 | <?php |
53 | - $field_type = 'billing'; |
|
54 | - include plugin_dir_path( __FILE__ ) . 'address-fields.php'; |
|
55 | - ?> |
|
53 | + $field_type = 'billing'; |
|
54 | + include plugin_dir_path( __FILE__ ) . 'address-fields.php'; |
|
55 | + ?> |
|
56 | 56 | </div> |
57 | 57 | <!-- End Billing Address --> |
58 | 58 | |
@@ -64,19 +64,19 @@ discard block |
||
64 | 64 | |
65 | 65 | <?php |
66 | 66 | |
67 | - echo aui()->input( |
|
68 | - array( |
|
69 | - 'type' => 'checkbox', |
|
70 | - 'name' => 'same-shipping-address', |
|
71 | - 'id' => "shipping-toggle$uniqid", |
|
72 | - 'required' => false, |
|
73 | - 'label' => wp_kses_post( $shipping_address_toggle ), |
|
74 | - 'value' => 1, |
|
75 | - 'checked' => true, |
|
76 | - ) |
|
77 | - ); |
|
67 | + echo aui()->input( |
|
68 | + array( |
|
69 | + 'type' => 'checkbox', |
|
70 | + 'name' => 'same-shipping-address', |
|
71 | + 'id' => "shipping-toggle$uniqid", |
|
72 | + 'required' => false, |
|
73 | + 'label' => wp_kses_post( $shipping_address_toggle ), |
|
74 | + 'value' => 1, |
|
75 | + 'checked' => true, |
|
76 | + ) |
|
77 | + ); |
|
78 | 78 | |
79 | - ?> |
|
79 | + ?> |
|
80 | 80 | |
81 | 81 | |
82 | 82 | <!-- Start Shipping Address Title --> |
@@ -95,9 +95,9 @@ discard block |
||
95 | 95 | <!-- Start Shipping Address --> |
96 | 96 | <div class="getpaid-shipping-address-wrapper"> |
97 | 97 | <?php |
98 | - $field_type = 'shipping'; |
|
99 | - include plugin_dir_path( __FILE__ ) . 'address-fields.php'; |
|
100 | - ?> |
|
98 | + $field_type = 'shipping'; |
|
99 | + include plugin_dir_path( __FILE__ ) . 'address-fields.php'; |
|
100 | + ?> |
|
101 | 101 | </div> |
102 | 102 | <!-- End Shipping Address --> |
103 | 103 |
@@ -7,51 +7,51 @@ discard block |
||
7 | 7 | * @version 1.0.19 |
8 | 8 | */ |
9 | 9 | |
10 | -defined( 'ABSPATH' ) || exit; |
|
10 | +defined('ABSPATH') || exit; |
|
11 | 11 | |
12 | -if ( empty( $fields ) ) { |
|
12 | +if (empty($fields)) { |
|
13 | 13 | return; |
14 | 14 | } |
15 | 15 | |
16 | 16 | // A prefix for all ids (so that a form can be included in the same page multiple times). |
17 | -$uniqid = uniqid( '_' ); |
|
17 | +$uniqid = uniqid('_'); |
|
18 | 18 | |
19 | 19 | // Prepare the user's country. |
20 | -$country = is_user_logged_in() ? get_user_meta( get_current_user_id(), '_wpinv_country', true ) : ''; |
|
21 | -$country = empty( $country ) ? getpaid_get_ip_country() : $country; |
|
22 | -$country = empty( $country ) ? wpinv_get_default_country() : $country; |
|
20 | +$country = is_user_logged_in() ? get_user_meta(get_current_user_id(), '_wpinv_country', true) : ''; |
|
21 | +$country = empty($country) ? getpaid_get_ip_country() : $country; |
|
22 | +$country = empty($country) ? wpinv_get_default_country() : $country; |
|
23 | 23 | |
24 | 24 | // A prefix for all ids (so that a form can be included in the same page multiple times). |
25 | -$uniqid = uniqid( '_' ); |
|
25 | +$uniqid = uniqid('_'); |
|
26 | 26 | |
27 | -$address_type = empty( $address_type ) ? 'billing' : $address_type; |
|
27 | +$address_type = empty($address_type) ? 'billing' : $address_type; |
|
28 | 28 | |
29 | 29 | ?> |
30 | 30 | |
31 | -<?php if ( 'both' === $address_type ) : ?> |
|
31 | +<?php if ('both' === $address_type) : ?> |
|
32 | 32 | |
33 | 33 | <!-- Start Billing/Shipping Address Title --> |
34 | 34 | <h4 class="mb-3 getpaid-shipping-billing-address-title"> |
35 | - <?php _e( 'Billing / Shipping Address', 'invoicing' ); ?> |
|
35 | + <?php _e('Billing / Shipping Address', 'invoicing'); ?> |
|
36 | 36 | </h4> |
37 | 37 | <!-- End Billing Address Title --> |
38 | 38 | |
39 | 39 | <!-- Start Billing Address Title --> |
40 | 40 | <h4 class="mb-3 getpaid-billing-address-title"> |
41 | - <?php _e( 'Billing Address', 'invoicing' ); ?> |
|
41 | + <?php _e('Billing Address', 'invoicing'); ?> |
|
42 | 42 | </h4> |
43 | 43 | <!-- End Billing Address Title --> |
44 | 44 | |
45 | 45 | <?php endif; ?> |
46 | 46 | |
47 | 47 | |
48 | -<?php if ( 'both' === $address_type || 'billing' === $address_type ) : ?> |
|
48 | +<?php if ('both' === $address_type || 'billing' === $address_type) : ?> |
|
49 | 49 | |
50 | 50 | <!-- Start Billing Address --> |
51 | 51 | <div class="getpaid-billing-address-wrapper"> |
52 | 52 | <?php |
53 | 53 | $field_type = 'billing'; |
54 | - include plugin_dir_path( __FILE__ ) . 'address-fields.php'; |
|
54 | + include plugin_dir_path(__FILE__) . 'address-fields.php'; |
|
55 | 55 | ?> |
56 | 56 | </div> |
57 | 57 | <!-- End Billing Address --> |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | <?php endif; ?> |
60 | 60 | |
61 | 61 | |
62 | -<?php if ( 'both' === $address_type ) : ?> |
|
62 | +<?php if ('both' === $address_type) : ?> |
|
63 | 63 | |
64 | 64 | |
65 | 65 | <?php |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | 'name' => 'same-shipping-address', |
71 | 71 | 'id' => "shipping-toggle$uniqid", |
72 | 72 | 'required' => false, |
73 | - 'label' => wp_kses_post( $shipping_address_toggle ), |
|
73 | + 'label' => wp_kses_post($shipping_address_toggle), |
|
74 | 74 | 'value' => 1, |
75 | 75 | 'checked' => true, |
76 | 76 | ) |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | |
82 | 82 | <!-- Start Shipping Address Title --> |
83 | 83 | <h4 class="mb-3 getpaid-shipping-address-title"> |
84 | - <?php _e( 'Shipping Address', 'invoicing' ); ?> |
|
84 | + <?php _e('Shipping Address', 'invoicing'); ?> |
|
85 | 85 | </h4> |
86 | 86 | <!-- End Shipping Address Title --> |
87 | 87 | |
@@ -90,13 +90,13 @@ discard block |
||
90 | 90 | |
91 | 91 | |
92 | 92 | |
93 | -<?php if ( 'both' === $address_type || 'shipping' === $address_type ) : ?> |
|
93 | +<?php if ('both' === $address_type || 'shipping' === $address_type) : ?> |
|
94 | 94 | |
95 | 95 | <!-- Start Shipping Address --> |
96 | 96 | <div class="getpaid-shipping-address-wrapper"> |
97 | 97 | <?php |
98 | 98 | $field_type = 'shipping'; |
99 | - include plugin_dir_path( __FILE__ ) . 'address-fields.php'; |
|
99 | + include plugin_dir_path(__FILE__) . 'address-fields.php'; |
|
100 | 100 | ?> |
101 | 101 | </div> |
102 | 102 | <!-- End Shipping Address --> |