@@ -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 | -if ( empty( $text ) ) { |
|
13 | - $text = __( 'Total to pay:', 'invoicing' ); |
|
12 | +if (empty($text)) { |
|
13 | + $text = __('Total to pay:', 'invoicing'); |
|
14 | 14 | } |
15 | 15 | ?> |
16 | 16 | <div class="form-group mt-4"> |
17 | - <strong><?php echo esc_html( $text ); ?></strong> |
|
17 | + <strong><?php echo esc_html($text); ?></strong> |
|
18 | 18 | <span class="getpaid-checkout-total-payable"></span> |
19 | 19 | </div> |
@@ -12,62 +12,62 @@ 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 | -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 | - do_action( 'getpaid_payment_form_address_field_before_' . $address_field['name'], $field_type, $address_field ); |
|
28 | + do_action('getpaid_payment_form_address_field_before_' . $address_field['name'], $field_type, $address_field); |
|
29 | 29 | |
30 | 30 | // Prepare variables. |
31 | - if ( ! empty( $form->invoice ) ) { |
|
31 | + if (!empty($form->invoice)) { |
|
32 | 32 | $user_id = $form->invoice->get_user_id(); |
33 | 33 | } |
34 | 34 | |
35 | - if ( empty( $user_id ) && is_user_logged_in() ) { |
|
35 | + if (empty($user_id) && is_user_logged_in()) { |
|
36 | 36 | $user_id = get_current_user_id(); |
37 | 37 | } |
38 | 38 | |
39 | 39 | $field_name = $address_field['name']; |
40 | 40 | $field_name = "{$field_type}[$field_name]"; |
41 | - $wrap_class = getpaid_get_form_element_grid_class( $address_field ); |
|
42 | - $wrap_class = esc_attr( "$wrap_class getpaid-address-field-wrapper" ); |
|
43 | - $placeholder = empty( $address_field['placeholder'] ) ? '' : esc_attr( $address_field['placeholder'] ); |
|
44 | - $description = empty( $address_field['description'] ) ? '' : wp_kses_post( $address_field['description'] ); |
|
45 | - $value = ! empty( $user_id ) ? get_user_meta( $user_id, '_' . $address_field['name'], true ) : ''; |
|
46 | - $label = empty( $address_field['label'] ) ? '' : wp_kses_post( $address_field['label'] ); |
|
47 | - |
|
48 | - $method_name = 'get_' . str_replace( 'wpinv_', '', $address_field['name'] ); |
|
49 | - if ( ! empty( $form->invoice ) && is_callable( array( $form->invoice, $method_name ) ) ) { |
|
50 | - $value = call_user_func( array( $form->invoice, $method_name ) ); |
|
41 | + $wrap_class = getpaid_get_form_element_grid_class($address_field); |
|
42 | + $wrap_class = esc_attr("$wrap_class getpaid-address-field-wrapper"); |
|
43 | + $placeholder = empty($address_field['placeholder']) ? '' : esc_attr($address_field['placeholder']); |
|
44 | + $description = empty($address_field['description']) ? '' : wp_kses_post($address_field['description']); |
|
45 | + $value = !empty($user_id) ? get_user_meta($user_id, '_' . $address_field['name'], true) : ''; |
|
46 | + $label = empty($address_field['label']) ? '' : wp_kses_post($address_field['label']); |
|
47 | + |
|
48 | + $method_name = 'get_' . str_replace('wpinv_', '', $address_field['name']); |
|
49 | + if (!empty($form->invoice) && is_callable(array($form->invoice, $method_name))) { |
|
50 | + $value = call_user_func(array($form->invoice, $method_name)); |
|
51 | 51 | } |
52 | 52 | |
53 | - if ( ! empty( $address_field['required'] ) ) { |
|
53 | + if (!empty($address_field['required'])) { |
|
54 | 54 | $label .= "<span class='text-danger'> *</span>"; |
55 | 55 | } |
56 | 56 | |
57 | 57 | // Display the country. |
58 | - if ( 'wpinv_country' == $address_field['name'] ) { |
|
58 | + if ('wpinv_country' == $address_field['name']) { |
|
59 | 59 | |
60 | 60 | echo "<div class='form-group $wrap_class getpaid-address-field-wrapper__country'"; |
61 | 61 | |
62 | 62 | echo aui()->select( |
63 | 63 | array( |
64 | 64 | 'options' => wpinv_get_country_list(), |
65 | - 'name' => esc_attr( $field_name ), |
|
66 | - 'id' => sanitize_html_class( $field_name ) . $uniqid, |
|
67 | - 'value' => esc_attr( $country ), |
|
65 | + 'name' => esc_attr($field_name), |
|
66 | + 'id' => sanitize_html_class($field_name) . $uniqid, |
|
67 | + 'value' => esc_attr($country), |
|
68 | 68 | 'placeholder' => $placeholder, |
69 | - 'required' => ! empty( $address_field['required'] ), |
|
70 | - 'label' => wp_kses_post( $label ), |
|
69 | + 'required' => !empty($address_field['required']), |
|
70 | + 'label' => wp_kses_post($label), |
|
71 | 71 | 'label_type' => 'vertical', |
72 | 72 | 'help_text' => $description, |
73 | 73 | 'class' => 'getpaid-address-field wpinv_country', |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | ) |
81 | 81 | ); |
82 | 82 | |
83 | - if ( wpinv_should_validate_vat_number() ) { |
|
83 | + if (wpinv_should_validate_vat_number()) { |
|
84 | 84 | |
85 | 85 | echo aui()->input( |
86 | 86 | array( |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | 'id' => "shipping-toggle$uniqid", |
90 | 90 | 'wrap_class' => "getpaid-address-field-wrapper__address-confirm mt-1 d-none", |
91 | 91 | 'required' => false, |
92 | - 'label' => __( 'I certify that I live in the country selected above', 'invoicing' ) . "<span class='text-danger'> *</span>", |
|
92 | + 'label' => __('I certify that I live in the country selected above', 'invoicing') . "<span class='text-danger'> *</span>", |
|
93 | 93 | 'value' => 1, |
94 | 94 | 'checked' => true, |
95 | 95 | 'class' => 'w-auto', |
@@ -103,27 +103,27 @@ discard block |
||
103 | 103 | } |
104 | 104 | |
105 | 105 | // Display the state. |
106 | - else if ( 'wpinv_state' == $address_field['name'] ) { |
|
106 | + else if ('wpinv_state' == $address_field['name']) { |
|
107 | 107 | |
108 | - if ( empty( $value ) ) { |
|
108 | + if (empty($value)) { |
|
109 | 109 | $value = wpinv_get_default_state(); |
110 | 110 | } |
111 | 111 | |
112 | - echo getpaid_get_states_select_markup ( |
|
112 | + echo getpaid_get_states_select_markup( |
|
113 | 113 | $country, |
114 | 114 | $value, |
115 | 115 | $placeholder, |
116 | 116 | $label, |
117 | 117 | $description, |
118 | - ! empty( $address_field['required'] ), |
|
118 | + !empty($address_field['required']), |
|
119 | 119 | $wrap_class, |
120 | 120 | $field_name |
121 | 121 | ); |
122 | 122 | |
123 | 123 | } else { |
124 | 124 | |
125 | - $key = str_replace( 'wpinv_', '', $address_field['name'] ); |
|
126 | - $key = esc_attr( str_replace( '_', '-', $key ) ); |
|
125 | + $key = str_replace('wpinv_', '', $address_field['name']); |
|
126 | + $key = esc_attr(str_replace('_', '-', $key)); |
|
127 | 127 | $autocomplete = ''; |
128 | 128 | $replacements = array( |
129 | 129 | 'zip' => 'postal-code', |
@@ -136,37 +136,37 @@ discard block |
||
136 | 136 | ); |
137 | 137 | |
138 | 138 | |
139 | - if ( isset( $replacements[ $key ] ) ) { |
|
139 | + if (isset($replacements[$key])) { |
|
140 | 140 | $autocomplete = array( |
141 | - 'autocomplete' => "$field_type {$replacements[ $key ]}", |
|
141 | + 'autocomplete' => "$field_type {$replacements[$key]}", |
|
142 | 142 | ); |
143 | 143 | } |
144 | 144 | |
145 | 145 | $append = ''; |
146 | 146 | |
147 | - if ( 'billing' === $field_type && wpinv_should_validate_vat_number() && 'vat-number' === $key ) { |
|
148 | - $valid = esc_attr__( 'Valid', 'invoicing' ); |
|
149 | - $invalid = esc_attr__( 'Invalid', 'invoicing' ); |
|
150 | - $validate = esc_attr__( 'Validate', 'invoicing' ); |
|
147 | + if ('billing' === $field_type && wpinv_should_validate_vat_number() && 'vat-number' === $key) { |
|
148 | + $valid = esc_attr__('Valid', 'invoicing'); |
|
149 | + $invalid = esc_attr__('Invalid', 'invoicing'); |
|
150 | + $validate = esc_attr__('Validate', 'invoicing'); |
|
151 | 151 | $append = "<span class='btn btn-primary getpaid-vat-number-validate' data-valid='$valid' data-invalid='$invalid' data-validate='$validate'>$validate</span>"; |
152 | 152 | } |
153 | 153 | |
154 | - if ( 'billing' === $field_type ) { |
|
155 | - $description .= '<div class="getpaid-error-' . sanitize_html_class( $field_name ) . ' getpaid-custom-payment-form-errors alert alert-danger d-none"></div>'; |
|
154 | + if ('billing' === $field_type) { |
|
155 | + $description .= '<div class="getpaid-error-' . sanitize_html_class($field_name) . ' getpaid-custom-payment-form-errors alert alert-danger d-none"></div>'; |
|
156 | 156 | } |
157 | 157 | |
158 | 158 | echo aui()->input( |
159 | 159 | array( |
160 | - 'name' => esc_attr( $field_name ), |
|
161 | - 'id' => sanitize_html_class( $field_name ) . $uniqid, |
|
162 | - 'required' => ! empty( $address_field['required'] ), |
|
160 | + 'name' => esc_attr($field_name), |
|
161 | + 'id' => sanitize_html_class($field_name) . $uniqid, |
|
162 | + 'required' => !empty($address_field['required']), |
|
163 | 163 | 'placeholder' => $placeholder, |
164 | - 'label' => wp_kses_post( $label ), |
|
164 | + 'label' => wp_kses_post($label), |
|
165 | 165 | 'label_type' => 'vertical', |
166 | 166 | 'help_text' => $description, |
167 | 167 | 'type' => 'text', |
168 | - 'value' => esc_attr( $value ), |
|
169 | - 'class' => 'getpaid-address-field ' . esc_attr( $address_field['name'] ), |
|
168 | + 'value' => esc_attr($value), |
|
169 | + 'class' => 'getpaid-address-field ' . esc_attr($address_field['name']), |
|
170 | 170 | 'wrap_class' => "$wrap_class getpaid-address-field-wrapper__$key", |
171 | 171 | 'label_class' => 'getpaid-address-field-label getpaid-address-field-label__' . $key, |
172 | 172 | 'extra_attributes' => $autocomplete, |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | |
177 | 177 | } |
178 | 178 | |
179 | - do_action( 'getpaid_payment_form_address_field_after_' . $address_field['name'], $field_type, $address_field ); |
|
179 | + do_action('getpaid_payment_form_address_field_after_' . $address_field['name'], $field_type, $address_field); |
|
180 | 180 | } |
181 | 181 | |
182 | 182 | echo "</div>"; |
@@ -7,45 +7,45 @@ discard block |
||
7 | 7 | * @version 1.0.19 |
8 | 8 | */ |
9 | 9 | |
10 | -defined( 'ABSPATH' ) || exit; |
|
10 | +defined('ABSPATH') || exit; |
|
11 | 11 | |
12 | 12 | // The payment methods select title. |
13 | -if ( empty( $text ) ) { |
|
14 | - $text = __( 'Select Payment Method', 'invoicing' ); |
|
13 | +if (empty($text)) { |
|
14 | + $text = __('Select Payment Method', 'invoicing'); |
|
15 | 15 | } |
16 | 16 | |
17 | 17 | // An array of active payment methods. |
18 | -$gateways = wpinv_get_enabled_payment_gateways( true ); |
|
18 | +$gateways = wpinv_get_enabled_payment_gateways(true); |
|
19 | 19 | |
20 | 20 | // The current invoice id. |
21 | 21 | $invoice_id = 0; |
22 | 22 | $chosen_gateway = wpinv_get_default_gateway(); |
23 | 23 | |
24 | -if ( ! empty( $form->invoice ) ) { |
|
24 | +if (!empty($form->invoice)) { |
|
25 | 25 | $invoice_id = $form->invoice->get_id(); |
26 | 26 | $chosen_gateway = $form->invoice->get_gateway(); |
27 | 27 | } |
28 | 28 | |
29 | 29 | ?> |
30 | 30 | |
31 | - <?php do_action( 'getpaid_before_payment_form_gateway_select', $form ); ?> |
|
31 | + <?php do_action('getpaid_before_payment_form_gateway_select', $form); ?> |
|
32 | 32 | <div class="mt-4 mb-4 getpaid-gateways"> |
33 | 33 | |
34 | - <?php do_action( 'wpinv_payment_mode_top', $invoice_id, $chosen_gateway, $gateways, $form ); ?> |
|
34 | + <?php do_action('wpinv_payment_mode_top', $invoice_id, $chosen_gateway, $gateways, $form); ?> |
|
35 | 35 | |
36 | 36 | <div class="getpaid-select-gateway-title-div"> |
37 | - <h6><?php echo esc_html( $text ); ?></h6> |
|
37 | + <h6><?php echo esc_html($text); ?></h6> |
|
38 | 38 | </div> |
39 | 39 | |
40 | 40 | <div class="getpaid-available-gateways-div"> |
41 | 41 | |
42 | - <?php foreach ( array_keys( $gateways ) as $gateway ) : ?> |
|
42 | + <?php foreach (array_keys($gateways) as $gateway) : ?> |
|
43 | 43 | |
44 | - <div class="pt-1 pb-1 getpaid-gateway getpaid-gateway-<?php echo sanitize_html_class( $gateway ) ;?>" data-checkout-label='<?php echo esc_attr( apply_filters( "getpaid_gateway_{$gateway}_checkout_button_label", '' ) ); ?>'> |
|
44 | + <div class="pt-1 pb-1 getpaid-gateway getpaid-gateway-<?php echo sanitize_html_class($gateway); ?>" data-checkout-label='<?php echo esc_attr(apply_filters("getpaid_gateway_{$gateway}_checkout_button_label", '')); ?>'> |
|
45 | 45 | |
46 | 46 | <label class="d-block w-100 getpaid-gateway-radio"> |
47 | - <input type="radio" value="<?php echo esc_attr( $gateway ) ;?>" <?php checked( $gateway, $chosen_gateway ) ;?> name="wpi-gateway"> |
|
48 | - <span><?php echo esc_html( wpinv_get_gateway_checkout_label( $gateway ) ); ?></span> |
|
47 | + <input type="radio" value="<?php echo esc_attr($gateway); ?>" <?php checked($gateway, $chosen_gateway); ?> name="wpi-gateway"> |
|
48 | + <span><?php echo esc_html(wpinv_get_gateway_checkout_label($gateway)); ?></span> |
|
49 | 49 | </label> |
50 | 50 | |
51 | 51 | </div> |
@@ -56,22 +56,22 @@ discard block |
||
56 | 56 | |
57 | 57 | <div class="getpaid-gateway-descriptions-div"> |
58 | 58 | |
59 | - <?php foreach ( array_keys( $gateways ) as $gateway ) : ?> |
|
59 | + <?php foreach (array_keys($gateways) as $gateway) : ?> |
|
60 | 60 | |
61 | - <div class="my-2 p-3 bg-light border getpaid-gateway-description getpaid-description-<?php echo sanitize_html_class( $gateway ) ;?>" style="display: none;"> |
|
61 | + <div class="my-2 p-3 bg-light border getpaid-gateway-description getpaid-description-<?php echo sanitize_html_class($gateway); ?>" style="display: none;"> |
|
62 | 62 | <?php |
63 | 63 | |
64 | - $description = wpinv_get_gateway_description( $gateway ); |
|
64 | + $description = wpinv_get_gateway_description($gateway); |
|
65 | 65 | |
66 | - if ( wpinv_is_test_mode( $gateway ) ) { |
|
67 | - $sandbox_notice = apply_filters( "getpaid_{$gateway}_sandbox_notice", __( 'SANDBOX ENABLED: No real payments will occur.', 'invoicing' ) ); |
|
66 | + if (wpinv_is_test_mode($gateway)) { |
|
67 | + $sandbox_notice = apply_filters("getpaid_{$gateway}_sandbox_notice", __('SANDBOX ENABLED: No real payments will occur.', 'invoicing')); |
|
68 | 68 | $description = "$description $sandbox_notice"; |
69 | 69 | } |
70 | 70 | |
71 | - echo wpautop( wp_kses_post( $description ) ); |
|
71 | + echo wpautop(wp_kses_post($description)); |
|
72 | 72 | |
73 | - do_action( 'wpinv_' . $gateway . '_checkout_fields', $invoice_id ) ; |
|
74 | - do_action( 'wpinv_' . $gateway . '_cc_form', $invoice_id, $form ) ; |
|
73 | + do_action('wpinv_' . $gateway . '_checkout_fields', $invoice_id); |
|
74 | + do_action('wpinv_' . $gateway . '_cc_form', $invoice_id, $form); |
|
75 | 75 | |
76 | 76 | ?> |
77 | 77 | </div> |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | <?php |
85 | 85 | echo aui()->alert( |
86 | 86 | array( |
87 | - 'content' => __( 'None of the available payment gateways support purchasing recurring items.', 'invoicing' ), |
|
87 | + 'content' => __('None of the available payment gateways support purchasing recurring items.', 'invoicing'), |
|
88 | 88 | 'type' => 'danger', |
89 | 89 | ) |
90 | 90 | ); |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | <?php |
96 | 96 | echo aui()->alert( |
97 | 97 | array( |
98 | - 'content' => __( 'None of the available payment gateways support purchasing multiple subscriptions in a single order.', 'invoicing' ), |
|
98 | + 'content' => __('None of the available payment gateways support purchasing multiple subscriptions in a single order.', 'invoicing'), |
|
99 | 99 | 'type' => 'danger', |
100 | 100 | ) |
101 | 101 | ); |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | <?php |
107 | 107 | echo aui()->alert( |
108 | 108 | array( |
109 | - 'content' => __( 'None of the available payment gateways support purchasing multiple subscriptions with different billing schedules in a single order.', 'invoicing' ), |
|
109 | + 'content' => __('None of the available payment gateways support purchasing multiple subscriptions with different billing schedules in a single order.', 'invoicing'), |
|
110 | 110 | 'type' => 'danger', |
111 | 111 | ) |
112 | 112 | ); |
@@ -117,14 +117,14 @@ discard block |
||
117 | 117 | <?php |
118 | 118 | echo aui()->alert( |
119 | 119 | array( |
120 | - 'content' => __( 'There is no active payment gateway available to process your request.', 'invoicing' ), |
|
120 | + 'content' => __('There is no active payment gateway available to process your request.', 'invoicing'), |
|
121 | 121 | 'type' => 'danger', |
122 | 122 | ) |
123 | 123 | ); |
124 | 124 | ?> |
125 | 125 | </div> |
126 | 126 | |
127 | - <?php do_action( 'wpinv_payment_mode_bottom', $invoice_id, $chosen_gateway, $gateways, $form ); ?> |
|
127 | + <?php do_action('wpinv_payment_mode_bottom', $invoice_id, $chosen_gateway, $gateways, $form); ?> |
|
128 | 128 | |
129 | 129 | </div> |
130 | - <?php do_action( 'getpaid_after_payment_form_gateway_select', $form ); ?> |
|
130 | + <?php do_action('getpaid_after_payment_form_gateway_select', $form); ?> |
@@ -24,64 +24,64 @@ discard block |
||
24 | 24 | |
25 | 25 | <?php |
26 | 26 | |
27 | - // Fires before printing a line item column. |
|
28 | - do_action( "getpaid_form_cart_item_before_$key", $item, $form ); |
|
27 | + // Fires before printing a line item column. |
|
28 | + do_action( "getpaid_form_cart_item_before_$key", $item, $form ); |
|
29 | 29 | |
30 | - // Item name. |
|
31 | - if ( 'name' == $key ) { |
|
30 | + // Item name. |
|
31 | + if ( 'name' == $key ) { |
|
32 | 32 | |
33 | - // Display the name. |
|
34 | - echo '<div class="mb-1">' . esc_html( $item->get_name() ) . '</div>'; |
|
33 | + // Display the name. |
|
34 | + echo '<div class="mb-1">' . esc_html( $item->get_name() ) . '</div>'; |
|
35 | 35 | |
36 | - // And an optional description. |
|
36 | + // And an optional description. |
|
37 | 37 | $description = $item->get_description(); |
38 | 38 | |
39 | 39 | if ( ! empty( $description ) ) { |
40 | 40 | $description = wp_kses_post( $description ); |
41 | 41 | echo "<small class='form-text text-muted pr-2 m-0'>$description</small>"; |
42 | - } |
|
42 | + } |
|
43 | 43 | |
44 | - // Price help text. |
|
44 | + // Price help text. |
|
45 | 45 | $description = getpaid_item_recurring_price_help_text( $item, $currency ); |
46 | 46 | if ( $description ) { |
47 | 47 | echo "<small class='getpaid-form-item-price-desc form-text text-muted pr-2 m-0'>$description</small>"; |
48 | - } |
|
48 | + } |
|
49 | 49 | |
50 | - } |
|
50 | + } |
|
51 | 51 | |
52 | - // Item price. |
|
53 | - if ( 'price' == $key ) { |
|
52 | + // Item price. |
|
53 | + if ( 'price' == $key ) { |
|
54 | 54 | |
55 | - // Set the currency position. |
|
56 | - $position = wpinv_currency_position(); |
|
55 | + // Set the currency position. |
|
56 | + $position = wpinv_currency_position(); |
|
57 | 57 | |
58 | - if ( $position == 'left_space' ) { |
|
59 | - $position = 'left'; |
|
60 | - } |
|
58 | + if ( $position == 'left_space' ) { |
|
59 | + $position = 'left'; |
|
60 | + } |
|
61 | 61 | |
62 | - if ( $position == 'right_space' ) { |
|
63 | - $position = 'right'; |
|
64 | - } |
|
62 | + if ( $position == 'right_space' ) { |
|
63 | + $position = 'right'; |
|
64 | + } |
|
65 | 65 | |
66 | - if ( $item->user_can_set_their_price() ) { |
|
67 | - $price = max( (float) $item->get_price(), (float) $item->get_minimum_price() ); |
|
68 | - $minimum = (float) $item->get_minimum_price(); |
|
69 | - $validate_minimum = ''; |
|
70 | - $class = ''; |
|
71 | - $data_minimum = ''; |
|
66 | + if ( $item->user_can_set_their_price() ) { |
|
67 | + $price = max( (float) $item->get_price(), (float) $item->get_minimum_price() ); |
|
68 | + $minimum = (float) $item->get_minimum_price(); |
|
69 | + $validate_minimum = ''; |
|
70 | + $class = ''; |
|
71 | + $data_minimum = ''; |
|
72 | 72 | |
73 | - if ( $minimum > 0 ) { |
|
74 | - $validate_minimum = sprintf( |
|
75 | - esc_attr__( 'The minimum allowed amount is %s', 'invoicing' ), |
|
76 | - strip_tags( wpinv_price( $minimum, $currency ) ) |
|
77 | - ); |
|
73 | + if ( $minimum > 0 ) { |
|
74 | + $validate_minimum = sprintf( |
|
75 | + esc_attr__( 'The minimum allowed amount is %s', 'invoicing' ), |
|
76 | + strip_tags( wpinv_price( $minimum, $currency ) ) |
|
77 | + ); |
|
78 | 78 | |
79 | - $class = 'getpaid-validate-minimum-amount'; |
|
79 | + $class = 'getpaid-validate-minimum-amount'; |
|
80 | 80 | |
81 | - $data_minimum = "data-minimum-amount='" . esc_attr( getpaid_unstandardize_amount( $minimum ) ) . "'"; |
|
82 | - } |
|
81 | + $data_minimum = "data-minimum-amount='" . esc_attr( getpaid_unstandardize_amount( $minimum ) ) . "'"; |
|
82 | + } |
|
83 | 83 | |
84 | - ?> |
|
84 | + ?> |
|
85 | 85 | <div class="input-group input-group-sm"> |
86 | 86 | <?php if( 'left' == $position ) : ?> |
87 | 87 | <div class="input-group-prepend"> |
@@ -105,38 +105,38 @@ discard block |
||
105 | 105 | </div> |
106 | 106 | |
107 | 107 | <?php |
108 | - } else { |
|
109 | - echo wpinv_price( $item->get_price(), $currency ); |
|
110 | - ?> |
|
108 | + } else { |
|
109 | + echo wpinv_price( $item->get_price(), $currency ); |
|
110 | + ?> |
|
111 | 111 | <input name='getpaid-items[<?php echo (int) $item->get_id(); ?>][price]' type='hidden' class='getpaid-item-price-input' value='<?php echo esc_attr( $item->get_price() ); ?>'> |
112 | 112 | <?php |
113 | - } |
|
114 | - } |
|
113 | + } |
|
114 | + } |
|
115 | 115 | |
116 | - // Item quantity. |
|
117 | - if ( 'quantity' == $key ) { |
|
116 | + // Item quantity. |
|
117 | + if ( 'quantity' == $key ) { |
|
118 | 118 | |
119 | - if ( $item->allows_quantities() ) { |
|
120 | - ?> |
|
119 | + if ( $item->allows_quantities() ) { |
|
120 | + ?> |
|
121 | 121 | <input name='getpaid-items[<?php echo (int) $item->get_id(); ?>][quantity]' type='text' style='width: 64px; line-height: 1; min-height: 35px;' class='getpaid-item-quantity-input p-1 align-middle font-weight-normal shadow-none m-0 rounded-0 text-center border' value='<?php echo (float) $item->get_quantity() == 0 ? 1 : (float) $item->get_quantity(); ?>' min='1' required> |
122 | 122 | <?php |
123 | - } else { |
|
124 | - echo (float) $item->get_quantity(); |
|
125 | - echo ' '; |
|
126 | - ?> |
|
123 | + } else { |
|
124 | + echo (float) $item->get_quantity(); |
|
125 | + echo ' '; |
|
126 | + ?> |
|
127 | 127 | <input type='hidden' name='getpaid-items[<?php echo (int) $item->get_id(); ?>][quantity]' class='getpaid-item-quantity-input' value='<?php echo (float) $item->get_quantity(); ?>'> |
128 | 128 | <?php |
129 | - } |
|
129 | + } |
|
130 | 130 | |
131 | - } |
|
131 | + } |
|
132 | 132 | |
133 | - // Item sub total. |
|
134 | - if ( 'subtotal' == $key ) { |
|
135 | - echo wpinv_price( $item->get_sub_total(), $currency ); |
|
136 | - } |
|
133 | + // Item sub total. |
|
134 | + if ( 'subtotal' == $key ) { |
|
135 | + echo wpinv_price( $item->get_sub_total(), $currency ); |
|
136 | + } |
|
137 | 137 | |
138 | - do_action( "getpaid_payment_form_cart_item_$key", $item, $form ); |
|
139 | - ?> |
|
138 | + do_action( "getpaid_payment_form_cart_item_$key", $item, $form ); |
|
139 | + ?> |
|
140 | 140 | |
141 | 141 | </div> |
142 | 142 |
@@ -7,116 +7,116 @@ discard block |
||
7 | 7 | * @version 1.0.19 |
8 | 8 | */ |
9 | 9 | |
10 | -defined( 'ABSPATH' ) || exit; |
|
10 | +defined('ABSPATH') || exit; |
|
11 | 11 | |
12 | -do_action( 'getpaid_before_payment_form_cart_item', $form, $item ); |
|
12 | +do_action('getpaid_before_payment_form_cart_item', $form, $item); |
|
13 | 13 | |
14 | 14 | $currency = $form->get_currency(); |
15 | 15 | |
16 | 16 | ?> |
17 | -<div class='getpaid-payment-form-items-cart-item getpaid-<?php echo $item->is_required() ? 'required' : 'selectable'; ?> item-<?php echo $item->get_id(); ?> border-bottom py-2 px-3'> |
|
17 | +<div class='getpaid-payment-form-items-cart-item getpaid-<?php echo $item->is_required() ? 'required' : 'selectable'; ?> item-<?php echo $item->get_id(); ?> border-bottom py-2 px-3'> |
|
18 | 18 | |
19 | 19 | <div class="form-row needs-validation"> |
20 | 20 | |
21 | - <?php foreach ( array_keys( $columns ) as $key ) : ?> |
|
21 | + <?php foreach (array_keys($columns) as $key) : ?> |
|
22 | 22 | |
23 | - <div class="<?php echo 'name' == $key ? 'col-12 col-sm-6' : 'col-12 col-sm' ?> position-relative getpaid-form-cart-item-<?php echo sanitize_html_class( $key ); ?> getpaid-form-cart-item-<?php echo sanitize_html_class( $key ); ?>-<?php echo $item->get_id(); ?>"> |
|
23 | + <div class="<?php echo 'name' == $key ? 'col-12 col-sm-6' : 'col-12 col-sm' ?> position-relative getpaid-form-cart-item-<?php echo sanitize_html_class($key); ?> getpaid-form-cart-item-<?php echo sanitize_html_class($key); ?>-<?php echo $item->get_id(); ?>"> |
|
24 | 24 | |
25 | 25 | <?php |
26 | 26 | |
27 | 27 | // Fires before printing a line item column. |
28 | - do_action( "getpaid_form_cart_item_before_$key", $item, $form ); |
|
28 | + do_action("getpaid_form_cart_item_before_$key", $item, $form); |
|
29 | 29 | |
30 | 30 | // Item name. |
31 | - if ( 'name' == $key ) { |
|
31 | + if ('name' == $key) { |
|
32 | 32 | |
33 | 33 | // Display the name. |
34 | - echo '<div class="mb-1">' . esc_html( $item->get_name() ) . '</div>'; |
|
34 | + echo '<div class="mb-1">' . esc_html($item->get_name()) . '</div>'; |
|
35 | 35 | |
36 | 36 | // And an optional description. |
37 | 37 | $description = $item->get_description(); |
38 | 38 | |
39 | - if ( ! empty( $description ) ) { |
|
40 | - $description = wp_kses_post( $description ); |
|
39 | + if (!empty($description)) { |
|
40 | + $description = wp_kses_post($description); |
|
41 | 41 | echo "<small class='form-text text-muted pr-2 m-0'>$description</small>"; |
42 | 42 | } |
43 | 43 | |
44 | 44 | // Price help text. |
45 | - $description = getpaid_item_recurring_price_help_text( $item, $currency ); |
|
46 | - if ( $description ) { |
|
45 | + $description = getpaid_item_recurring_price_help_text($item, $currency); |
|
46 | + if ($description) { |
|
47 | 47 | echo "<small class='getpaid-form-item-price-desc form-text text-muted pr-2 m-0'>$description</small>"; |
48 | 48 | } |
49 | 49 | |
50 | 50 | } |
51 | 51 | |
52 | 52 | // Item price. |
53 | - if ( 'price' == $key ) { |
|
53 | + if ('price' == $key) { |
|
54 | 54 | |
55 | 55 | // Set the currency position. |
56 | 56 | $position = wpinv_currency_position(); |
57 | 57 | |
58 | - if ( $position == 'left_space' ) { |
|
58 | + if ($position == 'left_space') { |
|
59 | 59 | $position = 'left'; |
60 | 60 | } |
61 | 61 | |
62 | - if ( $position == 'right_space' ) { |
|
62 | + if ($position == 'right_space') { |
|
63 | 63 | $position = 'right'; |
64 | 64 | } |
65 | 65 | |
66 | - if ( $item->user_can_set_their_price() ) { |
|
67 | - $price = max( (float) $item->get_price(), (float) $item->get_minimum_price() ); |
|
66 | + if ($item->user_can_set_their_price()) { |
|
67 | + $price = max((float) $item->get_price(), (float) $item->get_minimum_price()); |
|
68 | 68 | $minimum = (float) $item->get_minimum_price(); |
69 | 69 | $validate_minimum = ''; |
70 | 70 | $class = ''; |
71 | 71 | $data_minimum = ''; |
72 | 72 | |
73 | - if ( $minimum > 0 ) { |
|
73 | + if ($minimum > 0) { |
|
74 | 74 | $validate_minimum = sprintf( |
75 | - esc_attr__( 'The minimum allowed amount is %s', 'invoicing' ), |
|
76 | - strip_tags( wpinv_price( $minimum, $currency ) ) |
|
75 | + esc_attr__('The minimum allowed amount is %s', 'invoicing'), |
|
76 | + strip_tags(wpinv_price($minimum, $currency)) |
|
77 | 77 | ); |
78 | 78 | |
79 | 79 | $class = 'getpaid-validate-minimum-amount'; |
80 | 80 | |
81 | - $data_minimum = "data-minimum-amount='" . esc_attr( getpaid_unstandardize_amount( $minimum ) ) . "'"; |
|
81 | + $data_minimum = "data-minimum-amount='" . esc_attr(getpaid_unstandardize_amount($minimum)) . "'"; |
|
82 | 82 | } |
83 | 83 | |
84 | 84 | ?> |
85 | 85 | <div class="input-group input-group-sm"> |
86 | - <?php if( 'left' == $position ) : ?> |
|
86 | + <?php if ('left' == $position) : ?> |
|
87 | 87 | <div class="input-group-prepend"> |
88 | - <span class="input-group-text"><?php echo wpinv_currency_symbol( $currency ); ?></span> |
|
88 | + <span class="input-group-text"><?php echo wpinv_currency_symbol($currency); ?></span> |
|
89 | 89 | </div> |
90 | 90 | <?php endif; ?> |
91 | 91 | |
92 | - <input type="text" <?php echo $data_minimum; ?> name="getpaid-items[<?php echo (int) $item->get_id(); ?>][price]" value="<?php echo esc_attr( getpaid_unstandardize_amount( $price ) ); ?>" placeholder="<?php echo esc_attr( getpaid_unstandardize_amount( $item->get_minimum_price() ) ); ?>" class="getpaid-item-price-input p-1 align-middle font-weight-normal shadow-none m-0 rounded-0 text-center border <?php echo $class; ?>" style="width: 64px; line-height: 1; min-height: 35px;"> |
|
92 | + <input type="text" <?php echo $data_minimum; ?> name="getpaid-items[<?php echo (int) $item->get_id(); ?>][price]" value="<?php echo esc_attr(getpaid_unstandardize_amount($price)); ?>" placeholder="<?php echo esc_attr(getpaid_unstandardize_amount($item->get_minimum_price())); ?>" class="getpaid-item-price-input p-1 align-middle font-weight-normal shadow-none m-0 rounded-0 text-center border <?php echo $class; ?>" style="width: 64px; line-height: 1; min-height: 35px;"> |
|
93 | 93 | |
94 | - <?php if ( ! empty( $validate_minimum ) ) : ?> |
|
94 | + <?php if (!empty($validate_minimum)) : ?> |
|
95 | 95 | <div class="invalid-tooltip"> |
96 | 96 | <?php echo $validate_minimum; ?> |
97 | 97 | </div> |
98 | 98 | <?php endif; ?> |
99 | 99 | |
100 | - <?php if( 'left' != $position ) : ?> |
|
100 | + <?php if ('left' != $position) : ?> |
|
101 | 101 | <div class="input-group-append"> |
102 | - <span class="input-group-text"><?php echo wpinv_currency_symbol( $currency ); ?></span> |
|
102 | + <span class="input-group-text"><?php echo wpinv_currency_symbol($currency); ?></span> |
|
103 | 103 | </div> |
104 | 104 | <?php endif; ?> |
105 | 105 | </div> |
106 | 106 | |
107 | 107 | <?php |
108 | 108 | } else { |
109 | - echo wpinv_price( $item->get_price(), $currency ); |
|
109 | + echo wpinv_price($item->get_price(), $currency); |
|
110 | 110 | ?> |
111 | - <input name='getpaid-items[<?php echo (int) $item->get_id(); ?>][price]' type='hidden' class='getpaid-item-price-input' value='<?php echo esc_attr( $item->get_price() ); ?>'> |
|
111 | + <input name='getpaid-items[<?php echo (int) $item->get_id(); ?>][price]' type='hidden' class='getpaid-item-price-input' value='<?php echo esc_attr($item->get_price()); ?>'> |
|
112 | 112 | <?php |
113 | 113 | } |
114 | 114 | } |
115 | 115 | |
116 | 116 | // Item quantity. |
117 | - if ( 'quantity' == $key ) { |
|
117 | + if ('quantity' == $key) { |
|
118 | 118 | |
119 | - if ( $item->allows_quantities() ) { |
|
119 | + if ($item->allows_quantities()) { |
|
120 | 120 | ?> |
121 | 121 | <input name='getpaid-items[<?php echo (int) $item->get_id(); ?>][quantity]' type='text' style='width: 64px; line-height: 1; min-height: 35px;' class='getpaid-item-quantity-input p-1 align-middle font-weight-normal shadow-none m-0 rounded-0 text-center border' value='<?php echo (float) $item->get_quantity() == 0 ? 1 : (float) $item->get_quantity(); ?>' min='1' required> |
122 | 122 | <?php |
@@ -131,11 +131,11 @@ discard block |
||
131 | 131 | } |
132 | 132 | |
133 | 133 | // Item sub total. |
134 | - if ( 'subtotal' == $key ) { |
|
135 | - echo wpinv_price( $item->get_sub_total(), $currency ); |
|
134 | + if ('subtotal' == $key) { |
|
135 | + echo wpinv_price($item->get_sub_total(), $currency); |
|
136 | 136 | } |
137 | 137 | |
138 | - do_action( "getpaid_payment_form_cart_item_$key", $item, $form ); |
|
138 | + do_action("getpaid_payment_form_cart_item_$key", $item, $form); |
|
139 | 139 | ?> |
140 | 140 | |
141 | 141 | </div> |
@@ -146,4 +146,4 @@ discard block |
||
146 | 146 | |
147 | 147 | </div> |
148 | 148 | <?php |
149 | -do_action( 'getpaid_payment_form_cart_item', $form, $item ); |
|
149 | +do_action('getpaid_payment_form_cart_item', $form, $item); |
@@ -7,17 +7,17 @@ discard block |
||
7 | 7 | * @version 1.0.19 |
8 | 8 | */ |
9 | 9 | |
10 | -defined( 'ABSPATH' ) || exit; |
|
10 | +defined('ABSPATH') || exit; |
|
11 | 11 | |
12 | 12 | // Totals rows. |
13 | 13 | $totals = apply_filters( |
14 | 14 | 'getpaid_payment_form_cart_table_totals', |
15 | 15 | array( |
16 | - 'subtotal' => __( 'Subtotal', 'invoicing' ), |
|
17 | - 'tax' => __( 'Tax', 'invoicing' ), |
|
18 | - 'fees' => __( 'Fee', 'invoicing' ), |
|
19 | - 'discount' => __( 'Discount', 'invoicing' ), |
|
20 | - 'total' => __( 'Total', 'invoicing' ), |
|
16 | + 'subtotal' => __('Subtotal', 'invoicing'), |
|
17 | + 'tax' => __('Tax', 'invoicing'), |
|
18 | + 'fees' => __('Fee', 'invoicing'), |
|
19 | + 'discount' => __('Discount', 'invoicing'), |
|
20 | + 'total' => __('Total', 'invoicing'), |
|
21 | 21 | ), |
22 | 22 | $form |
23 | 23 | ); |
@@ -25,15 +25,15 @@ discard block |
||
25 | 25 | $currency = $form->get_currency(); |
26 | 26 | $country = wpinv_get_default_country(); |
27 | 27 | |
28 | -if ( ! empty( $form->invoice ) ) { |
|
29 | - $country = $form->invoice->get_country(); |
|
28 | +if (!empty($form->invoice)) { |
|
29 | + $country = $form->invoice->get_country(); |
|
30 | 30 | } |
31 | 31 | |
32 | -if ( ! wpinv_use_taxes() && isset( $totals['tax'] ) ) { |
|
33 | - unset( $totals['tax'] ); |
|
32 | +if (!wpinv_use_taxes() && isset($totals['tax'])) { |
|
33 | + unset($totals['tax']); |
|
34 | 34 | } |
35 | 35 | |
36 | -do_action( 'getpaid_before_payment_form_cart_totals', $form, $totals ); |
|
36 | +do_action('getpaid_before_payment_form_cart_totals', $form, $totals); |
|
37 | 37 | |
38 | 38 | ?> |
39 | 39 | <style> |
@@ -47,26 +47,26 @@ discard block |
||
47 | 47 | <div class="row"> |
48 | 48 | <div class="col-12 offset-sm-6 col-sm-6 border-sm-left pl-sm-0"> |
49 | 49 | |
50 | - <?php foreach ( $totals as $key => $label ) : ?> |
|
50 | + <?php foreach ($totals as $key => $label) : ?> |
|
51 | 51 | |
52 | - <div class="getpaid-form-cart-totals-col getpaid-form-cart-totals-<?php echo esc_attr( $key ); ?> font-weight-bold py-2 px-3 <?php echo 'total' == $key ? 'bg-light' : 'border-bottom' ?>"> |
|
52 | + <div class="getpaid-form-cart-totals-col getpaid-form-cart-totals-<?php echo esc_attr($key); ?> font-weight-bold py-2 px-3 <?php echo 'total' == $key ? 'bg-light' : 'border-bottom' ?>"> |
|
53 | 53 | |
54 | 54 | <div class="form-row"> |
55 | 55 | |
56 | 56 | <div class="col-8 pl-sm-0 getpaid-payment-form-line-totals-label"> |
57 | - <?php echo esc_html( $label ); ?> |
|
57 | + <?php echo esc_html($label); ?> |
|
58 | 58 | </div> |
59 | 59 | |
60 | - <div class="col-4 getpaid-payment-form-line-totals-value getpaid-form-cart-totals-total-<?php echo esc_attr( $key ); ?>"> |
|
60 | + <div class="col-4 getpaid-payment-form-line-totals-value getpaid-form-cart-totals-total-<?php echo esc_attr($key); ?>"> |
|
61 | 61 | |
62 | 62 | <?php |
63 | 63 | |
64 | 64 | // Total tax. |
65 | - if ( in_array( $key, array( 'tax', 'discount', 'subtotal', 'total', 'fees' ) ) ) { |
|
66 | - echo wpinv_price( 0, $currency ); |
|
65 | + if (in_array($key, array('tax', 'discount', 'subtotal', 'total', 'fees'))) { |
|
66 | + echo wpinv_price(0, $currency); |
|
67 | 67 | } |
68 | 68 | |
69 | - do_action( "getpaid_payment_form_cart_totals_$key", $form ); |
|
69 | + do_action("getpaid_payment_form_cart_totals_$key", $form); |
|
70 | 70 | ?> |
71 | 71 | |
72 | 72 | </div> |
@@ -82,4 +82,4 @@ discard block |
||
82 | 82 | </div> |
83 | 83 | |
84 | 84 | <?php |
85 | -do_action( 'getpaid_payment_form_cart_totals', $form, $totals ); |
|
85 | +do_action('getpaid_payment_form_cart_totals', $form, $totals); |
@@ -8,22 +8,22 @@ discard block |
||
8 | 8 | * @var WPInv_Invoice $invoice |
9 | 9 | */ |
10 | 10 | |
11 | -defined( 'ABSPATH' ) || exit; |
|
11 | +defined('ABSPATH') || exit; |
|
12 | 12 | |
13 | 13 | // Totals rows. |
14 | -$totals = getpaid_invoice_totals_rows( $invoice ); |
|
14 | +$totals = getpaid_invoice_totals_rows($invoice); |
|
15 | 15 | |
16 | -do_action( 'getpaid_before_email_line_totals', $invoice, $totals ); |
|
16 | +do_action('getpaid_before_email_line_totals', $invoice, $totals); |
|
17 | 17 | |
18 | 18 | ?> |
19 | 19 | |
20 | 20 | |
21 | -<?php if ( has_action( 'wpinv_email_footer_buttons' ) ) : ?> |
|
21 | +<?php if (has_action('wpinv_email_footer_buttons')) : ?> |
|
22 | 22 | |
23 | 23 | <tr class="wpinv_cart_footer_row"> |
24 | 24 | |
25 | - <td colspan="<?php echo ( (int) $column_count ); ?>"> |
|
26 | - <?php do_action( 'wpinv_email_footer_buttons' ); ?> |
|
25 | + <td colspan="<?php echo ((int) $column_count); ?>"> |
|
26 | + <?php do_action('wpinv_email_footer_buttons'); ?> |
|
27 | 27 | </td> |
28 | 28 | |
29 | 29 | </tr> |
@@ -31,44 +31,44 @@ discard block |
||
31 | 31 | <?php endif; ?> |
32 | 32 | |
33 | 33 | |
34 | -<?php foreach ( $totals as $key => $label ) : ?> |
|
34 | +<?php foreach ($totals as $key => $label) : ?> |
|
35 | 35 | |
36 | - <tr class="wpinv_cart_footer_row wpinv_cart_<?php echo sanitize_html_class( $key ); ?>_row"> |
|
36 | + <tr class="wpinv_cart_footer_row wpinv_cart_<?php echo sanitize_html_class($key); ?>_row"> |
|
37 | 37 | |
38 | - <td colspan="<?php echo ( $column_count - 1 ); ?>" class="wpinv_cart_<?php echo sanitize_html_class( $key ); ?>_label text-right"> |
|
39 | - <strong><?php echo esc_html( $label ); ?>:</strong> |
|
38 | + <td colspan="<?php echo ($column_count - 1); ?>" class="wpinv_cart_<?php echo sanitize_html_class($key); ?>_label text-right"> |
|
39 | + <strong><?php echo esc_html($label); ?>:</strong> |
|
40 | 40 | </td> |
41 | 41 | |
42 | - <td class="wpinv_cart_<?php echo sanitize_html_class( $key ); ?> text-right"> |
|
42 | + <td class="wpinv_cart_<?php echo sanitize_html_class($key); ?> text-right"> |
|
43 | 43 | |
44 | 44 | <?php |
45 | 45 | |
46 | 46 | // Total tax. |
47 | - if ( 'tax' == $key ) { |
|
48 | - echo wpinv_price( $invoice->get_total_tax(), $invoice->get_currency() ); |
|
47 | + if ('tax' == $key) { |
|
48 | + echo wpinv_price($invoice->get_total_tax(), $invoice->get_currency()); |
|
49 | 49 | } |
50 | 50 | |
51 | - if ( 'fee' == $key ) { |
|
52 | - echo wpinv_price( $invoice->get_total_fees(), $invoice->get_currency() ); |
|
51 | + if ('fee' == $key) { |
|
52 | + echo wpinv_price($invoice->get_total_fees(), $invoice->get_currency()); |
|
53 | 53 | } |
54 | 54 | |
55 | 55 | // Total discount. |
56 | - if ( 'discount' == $key ) { |
|
57 | - echo wpinv_price( $invoice->get_total_discount(), $invoice->get_currency() ); |
|
56 | + if ('discount' == $key) { |
|
57 | + echo wpinv_price($invoice->get_total_discount(), $invoice->get_currency()); |
|
58 | 58 | } |
59 | 59 | |
60 | 60 | // Sub total. |
61 | - if ( 'subtotal' == $key ) { |
|
62 | - echo wpinv_price( $invoice->get_subtotal(), $invoice->get_currency() ); |
|
61 | + if ('subtotal' == $key) { |
|
62 | + echo wpinv_price($invoice->get_subtotal(), $invoice->get_currency()); |
|
63 | 63 | } |
64 | 64 | |
65 | 65 | // Total. |
66 | - if ( 'total' == $key ) { |
|
67 | - echo wpinv_price( $invoice->get_total(), $invoice->get_currency() ); |
|
66 | + if ('total' == $key) { |
|
67 | + echo wpinv_price($invoice->get_total(), $invoice->get_currency()); |
|
68 | 68 | } |
69 | 69 | |
70 | 70 | // Fires when printing a cart total in an email. |
71 | - do_action( "getpaid_email_cart_totals_$key", $invoice ); |
|
71 | + do_action("getpaid_email_cart_totals_$key", $invoice); |
|
72 | 72 | |
73 | 73 | ?> |
74 | 74 | |
@@ -80,4 +80,4 @@ discard block |
||
80 | 80 | |
81 | 81 | <?php |
82 | 82 | |
83 | - do_action( 'getpaid_after_email_line_totals', $invoice, $totals ); |
|
83 | + do_action('getpaid_after_email_line_totals', $invoice, $totals); |
@@ -8,45 +8,45 @@ discard block |
||
8 | 8 | * @var WPInv_Invoice $invoice |
9 | 9 | * @var array $columns |
10 | 10 | */ |
11 | -defined( 'ABSPATH' ) || exit; |
|
11 | +defined('ABSPATH') || exit; |
|
12 | 12 | |
13 | -$meta_data = getpaid_get_invoice_meta( $invoice ); |
|
13 | +$meta_data = getpaid_get_invoice_meta($invoice); |
|
14 | 14 | |
15 | -if ( isset( $meta_data['status'] ) ) { |
|
15 | +if (isset($meta_data['status'])) { |
|
16 | 16 | $meta_data['status']['value'] = $invoice->get_status_nicename(); |
17 | 17 | } |
18 | 18 | |
19 | -do_action( 'wpinv_email_before_invoice_details', $invoice, $sent_to_admin ); |
|
19 | +do_action('wpinv_email_before_invoice_details', $invoice, $sent_to_admin); |
|
20 | 20 | |
21 | 21 | ?> |
22 | 22 | |
23 | 23 | <div id="wpinv-email-details"> |
24 | 24 | |
25 | 25 | <h3 class="invoice-details-title"> |
26 | - <?php echo sprintf( esc_html__( '%s Details', 'invoicing' ), ucfirst( $invoice->get_invoice_quote_type() )); ?> |
|
26 | + <?php echo sprintf(esc_html__('%s Details', 'invoicing'), ucfirst($invoice->get_invoice_quote_type())); ?> |
|
27 | 27 | </h3> |
28 | 28 | |
29 | 29 | <table class="table table-bordered table-sm"> |
30 | 30 | |
31 | - <?php foreach ( $meta_data as $key => $data ) : ?> |
|
31 | + <?php foreach ($meta_data as $key => $data) : ?> |
|
32 | 32 | |
33 | - <?php if ( ! empty( $data['value'] ) ) : ?> |
|
33 | + <?php if (!empty($data['value'])) : ?> |
|
34 | 34 | |
35 | - <?php do_action( "getpaid_before_email_details_$key", $invoice, $data ); ?> |
|
35 | + <?php do_action("getpaid_before_email_details_$key", $invoice, $data); ?> |
|
36 | 36 | |
37 | - <tr class="getpaid-email-details-<?php echo sanitize_html_class( $key ); ?>"> |
|
37 | + <tr class="getpaid-email-details-<?php echo sanitize_html_class($key); ?>"> |
|
38 | 38 | |
39 | 39 | <td class="getpaid-lable-td"> |
40 | - <?php echo esc_html( $data['label'] ); ?> |
|
40 | + <?php echo esc_html($data['label']); ?> |
|
41 | 41 | </td> |
42 | 42 | |
43 | 43 | <td class="getpaid-value-td"> |
44 | - <span class="getpaid-invoice-meta-<?php echo sanitize_html_class( $key ); ?>-value"><?php echo wp_kses_post( $data['value'] ); ?></span> |
|
44 | + <span class="getpaid-invoice-meta-<?php echo sanitize_html_class($key); ?>-value"><?php echo wp_kses_post($data['value']); ?></span> |
|
45 | 45 | </td> |
46 | 46 | |
47 | 47 | </tr> |
48 | 48 | |
49 | - <?php do_action( "getpaid_after_email_details_$key", $invoice, $data ); ?> |
|
49 | + <?php do_action("getpaid_after_email_details_$key", $invoice, $data); ?> |
|
50 | 50 | |
51 | 51 | <?php endif; ?> |
52 | 52 | |
@@ -56,4 +56,4 @@ discard block |
||
56 | 56 | |
57 | 57 | </div> |
58 | 58 | |
59 | -<?php do_action( 'wpinv_email_after_invoice_details', $invoice, $sent_to_admin ); ?> |
|
59 | +<?php do_action('wpinv_email_after_invoice_details', $invoice, $sent_to_admin); ?> |
@@ -10,66 +10,66 @@ discard block |
||
10 | 10 | * @var array $columns |
11 | 11 | */ |
12 | 12 | |
13 | -defined( 'ABSPATH' ) || exit; |
|
13 | +defined('ABSPATH') || exit; |
|
14 | 14 | |
15 | 15 | ?> |
16 | 16 | |
17 | -<?php do_action( 'getpaid_before_email_line_item', $invoice, $item ); ?> |
|
17 | +<?php do_action('getpaid_before_email_line_item', $invoice, $item); ?> |
|
18 | 18 | |
19 | -<tr class="wpinv_cart_item item-type-<?php echo sanitize_html_class( $item->get_type() ); ?>"> |
|
19 | +<tr class="wpinv_cart_item item-type-<?php echo sanitize_html_class($item->get_type()); ?>"> |
|
20 | 20 | |
21 | - <?php foreach ( array_keys( $columns ) as $column ): ?> |
|
21 | + <?php foreach (array_keys($columns) as $column): ?> |
|
22 | 22 | |
23 | - <td class="<?php echo 'name' == $column ? 'text-left' : 'text-right' ?> wpinv_cart_item_<?php echo sanitize_html_class( $column ); ?>"> |
|
23 | + <td class="<?php echo 'name' == $column ? 'text-left' : 'text-right' ?> wpinv_cart_item_<?php echo sanitize_html_class($column); ?>"> |
|
24 | 24 | |
25 | 25 | <?php |
26 | 26 | |
27 | 27 | // Fires before printing a line item column. |
28 | - do_action( "getpaid_email_line_item_before_$column", $item, $invoice ); |
|
28 | + do_action("getpaid_email_line_item_before_$column", $item, $invoice); |
|
29 | 29 | |
30 | 30 | // Item name. |
31 | - if ( 'name' == $column ) { |
|
31 | + if ('name' == $column) { |
|
32 | 32 | |
33 | 33 | // Display the name. |
34 | - echo '<div class="wpinv_email_cart_item_title">' . esc_html( $item->get_name() ) . '</div>'; |
|
34 | + echo '<div class="wpinv_email_cart_item_title">' . esc_html($item->get_name()) . '</div>'; |
|
35 | 35 | |
36 | 36 | // And an optional description. |
37 | 37 | $description = $item->get_description(); |
38 | 38 | |
39 | - if ( ! empty( $description ) ) { |
|
40 | - $description = wp_kses_post( $description ); |
|
39 | + if (!empty($description)) { |
|
40 | + $description = wp_kses_post($description); |
|
41 | 41 | echo "<p class='small'>$description</p>"; |
42 | 42 | } |
43 | 43 | |
44 | 44 | } |
45 | 45 | |
46 | 46 | // Item price. |
47 | - if ( 'price' == $column ) { |
|
47 | + if ('price' == $column) { |
|
48 | 48 | |
49 | 49 | // Display the item price (or recurring price if this is a renewal invoice) |
50 | 50 | $price = $invoice->is_renewal() ? $item->get_price() : $item->get_initial_price(); |
51 | - echo wpinv_price( $price, $invoice->get_currency() ); |
|
51 | + echo wpinv_price($price, $invoice->get_currency()); |
|
52 | 52 | |
53 | 53 | } |
54 | 54 | |
55 | 55 | // Item quantity. |
56 | - if ( 'quantity' == $column ) { |
|
56 | + if ('quantity' == $column) { |
|
57 | 57 | echo (float) $item->get_quantity(); |
58 | 58 | } |
59 | 59 | |
60 | 60 | // Tax rate. |
61 | - if ( 'tax_rate' == $column ) { |
|
62 | - echo round( getpaid_get_invoice_tax_rate( $invoice, $item ), 2 ) . '%'; |
|
61 | + if ('tax_rate' == $column) { |
|
62 | + echo round(getpaid_get_invoice_tax_rate($invoice, $item), 2) . '%'; |
|
63 | 63 | } |
64 | 64 | |
65 | 65 | // Item sub total. |
66 | - if ( 'subtotal' == $column ) { |
|
66 | + if ('subtotal' == $column) { |
|
67 | 67 | $subtotal = $invoice->is_renewal() ? $item->get_recurring_sub_total() : $item->get_sub_total(); |
68 | - echo wpinv_price( $subtotal, $invoice->get_currency() ); |
|
68 | + echo wpinv_price($subtotal, $invoice->get_currency()); |
|
69 | 69 | } |
70 | 70 | |
71 | 71 | // Fires when printing a line item column. |
72 | - do_action( "getpaid_email_line_item_$column", $item, $invoice ); |
|
72 | + do_action("getpaid_email_line_item_$column", $item, $invoice); |
|
73 | 73 | |
74 | 74 | ?> |
75 | 75 | |
@@ -79,4 +79,4 @@ discard block |
||
79 | 79 | |
80 | 80 | </tr> |
81 | 81 | |
82 | -<?php do_action( 'getpaid_after_email_line_item', $invoice, $item ); ?> |
|
82 | +<?php do_action('getpaid_after_email_line_item', $invoice, $item); ?> |
@@ -8,18 +8,18 @@ discard block |
||
8 | 8 | * @var WPInv_Invoice $invoice |
9 | 9 | */ |
10 | 10 | |
11 | -defined( 'ABSPATH' ) || exit; |
|
11 | +defined('ABSPATH') || exit; |
|
12 | 12 | |
13 | -$column_count = count( $columns ); |
|
13 | +$column_count = count($columns); |
|
14 | 14 | ?> |
15 | 15 | |
16 | -<?php do_action( 'wpinv_before_email_items', $invoice ); ?> |
|
16 | +<?php do_action('wpinv_before_email_items', $invoice); ?> |
|
17 | 17 | |
18 | 18 | |
19 | 19 | <div id="wpinv-email-items"> |
20 | 20 | |
21 | 21 | <h3 class="invoice-items-title"> |
22 | - <?php echo sprintf( esc_html__( '%s Items', 'invoicing' ), ucfirst( $invoice->get_invoice_quote_type() )); ?> |
|
22 | + <?php echo sprintf(esc_html__('%s Items', 'invoicing'), ucfirst($invoice->get_invoice_quote_type())); ?> |
|
23 | 23 | </h3> |
24 | 24 | |
25 | 25 | <table class="table table-bordered table-hover"> |
@@ -28,9 +28,9 @@ discard block |
||
28 | 28 | |
29 | 29 | <tr class="wpinv_cart_header_row"> |
30 | 30 | |
31 | - <?php foreach ( $columns as $key => $label ) : ?> |
|
32 | - <th class="<?php echo 'name' == $key ? 'text-left' : 'text-right' ?> wpinv_cart_item_<?php echo sanitize_html_class( $key ); ?>"> |
|
33 | - <?php echo esc_html( $label ); ?> |
|
31 | + <?php foreach ($columns as $key => $label) : ?> |
|
32 | + <th class="<?php echo 'name' == $key ? 'text-left' : 'text-right' ?> wpinv_cart_item_<?php echo sanitize_html_class($key); ?>"> |
|
33 | + <?php echo esc_html($label); ?> |
|
34 | 34 | </th> |
35 | 35 | <?php endforeach; ?> |
36 | 36 | |
@@ -43,13 +43,13 @@ discard block |
||
43 | 43 | <?php |
44 | 44 | |
45 | 45 | // Display the item totals. |
46 | - foreach ( $invoice->get_items() as $item ) { |
|
47 | - wpinv_get_template( 'emails/invoice-item.php', compact( 'invoice', 'item', 'columns' ) ); |
|
46 | + foreach ($invoice->get_items() as $item) { |
|
47 | + wpinv_get_template('emails/invoice-item.php', compact('invoice', 'item', 'columns')); |
|
48 | 48 | } |
49 | 49 | |
50 | 50 | // Display the fee totals. |
51 | - foreach ( $invoice->get_fees() as $fee ) { |
|
52 | - wpinv_get_template( 'emails/fee-item.php', compact( 'invoice', 'fee', 'columns' ) ); |
|
51 | + foreach ($invoice->get_fees() as $fee) { |
|
52 | + wpinv_get_template('emails/fee-item.php', compact('invoice', 'fee', 'columns')); |
|
53 | 53 | } |
54 | 54 | |
55 | 55 | ?> |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | </tbody> |
58 | 58 | |
59 | 59 | <tfoot> |
60 | - <?php wpinv_get_template( 'emails/invoice-totals.php', compact( 'invoice', 'column_count' ) ); ?> |
|
60 | + <?php wpinv_get_template('emails/invoice-totals.php', compact('invoice', 'column_count')); ?> |
|
61 | 61 | </tfoot> |
62 | 62 | |
63 | 63 | </table> |