@@ -7,36 +7,36 @@ discard block |
||
7 | 7 | * @version 1.0.19 |
8 | 8 | */ |
9 | 9 | |
10 | -defined( 'ABSPATH' ) || exit; |
|
10 | +defined('ABSPATH') || exit; |
|
11 | 11 | |
12 | 12 | // Cart table columns. |
13 | 13 | $columns = array( |
14 | - 'name' => __( 'Item', 'invoicing' ), |
|
15 | - 'price' => __( 'Price', 'invoicing' ), |
|
16 | - 'quantity' => __( 'Qty', 'invoicing' ), |
|
17 | - 'subtotal' => __( 'Subtotal', 'invoicing' ), |
|
14 | + 'name' => __('Item', 'invoicing'), |
|
15 | + 'price' => __('Price', 'invoicing'), |
|
16 | + 'quantity' => __('Qty', 'invoicing'), |
|
17 | + 'subtotal' => __('Subtotal', 'invoicing'), |
|
18 | 18 | ); |
19 | 19 | |
20 | -if ( ! empty( $form->invoice ) ) { |
|
21 | - $columns = getpaid_invoice_item_columns( $form->invoice ); |
|
20 | +if (!empty($form->invoice)) { |
|
21 | + $columns = getpaid_invoice_item_columns($form->invoice); |
|
22 | 22 | } |
23 | 23 | |
24 | -if ( isset( $columns['tax_rate'] ) ) { |
|
25 | - unset( $columns['tax_rate'] ); |
|
24 | +if (isset($columns['tax_rate'])) { |
|
25 | + unset($columns['tax_rate']); |
|
26 | 26 | } |
27 | 27 | |
28 | -$columns = apply_filters( 'getpaid_payment_form_cart_table_columns', $columns, $form ); |
|
28 | +$columns = apply_filters('getpaid_payment_form_cart_table_columns', $columns, $form); |
|
29 | 29 | |
30 | -do_action( 'getpaid_before_payment_form_cart', $form ); |
|
30 | +do_action('getpaid_before_payment_form_cart', $form); |
|
31 | 31 | |
32 | 32 | ?> |
33 | 33 | <div class="getpaid-payment-form-items-cart border form-group"> |
34 | 34 | |
35 | 35 | <div class="getpaid-payment-form-items-cart-header font-weight-bold bg-light border-bottom py-2 px-3"> |
36 | 36 | <div class="form-row"> |
37 | - <?php foreach ( $columns as $key => $label ) : ?> |
|
38 | - <div class="<?php echo 'name' == $key ? 'col-6' : 'col' ?> <?php echo ( in_array( $key, array( 'subtotal', 'quantity', 'tax_rate' ) ) ) ? 'd-none d-sm-block' : '' ?> getpaid-form-cart-item-<?php echo sanitize_html_class( $key ); ?>"> |
|
39 | - <span><?php echo esc_html( $label ); ?></span> |
|
37 | + <?php foreach ($columns as $key => $label) : ?> |
|
38 | + <div class="<?php echo 'name' == $key ? 'col-6' : 'col' ?> <?php echo (in_array($key, array('subtotal', 'quantity', 'tax_rate'))) ? 'd-none d-sm-block' : '' ?> getpaid-form-cart-item-<?php echo sanitize_html_class($key); ?>"> |
|
39 | + <span><?php echo esc_html($label); ?></span> |
|
40 | 40 | </div> |
41 | 41 | <?php endforeach; ?> |
42 | 42 | </div> |
@@ -45,16 +45,16 @@ discard block |
||
45 | 45 | <?php |
46 | 46 | |
47 | 47 | // Display the item totals. |
48 | - foreach ( $form->get_items() as $item ) { |
|
49 | - wpinv_get_template( 'payment-forms/cart-item.php', compact( 'form', 'item', 'columns' ) ); |
|
48 | + foreach ($form->get_items() as $item) { |
|
49 | + wpinv_get_template('payment-forms/cart-item.php', compact('form', 'item', 'columns')); |
|
50 | 50 | } |
51 | 51 | |
52 | 52 | // Display the cart totals. |
53 | - wpinv_get_template( 'payment-forms/cart-totals.php', compact( 'form' ) ); |
|
53 | + wpinv_get_template('payment-forms/cart-totals.php', compact('form')); |
|
54 | 54 | |
55 | 55 | ?> |
56 | 56 | </div> |
57 | 57 | |
58 | 58 | <?php |
59 | 59 | |
60 | -do_action( 'getpaid_after_payment_form_cart', $form ); |
|
60 | +do_action('getpaid_after_payment_form_cart', $form); |
@@ -9,50 +9,50 @@ discard block |
||
9 | 9 | * @var GetPaid_Form_Item $item |
10 | 10 | */ |
11 | 11 | |
12 | -defined( 'ABSPATH' ) || exit; |
|
12 | +defined('ABSPATH') || exit; |
|
13 | 13 | |
14 | -do_action( 'getpaid_before_payment_form_cart_item', $form, $item ); |
|
14 | +do_action('getpaid_before_payment_form_cart_item', $form, $item); |
|
15 | 15 | |
16 | 16 | $currency = $form->get_currency(); |
17 | 17 | |
18 | 18 | ?> |
19 | -<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'> |
|
19 | +<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'> |
|
20 | 20 | |
21 | 21 | <div class="form-row needs-validation"> |
22 | 22 | |
23 | - <?php foreach ( array_keys( $columns ) as $key ) : ?> |
|
23 | + <?php foreach (array_keys($columns) as $key) : ?> |
|
24 | 24 | |
25 | - <div class="<?php echo 'name' == $key ? 'col-6' : 'col' ?> <?php echo ( in_array( $key, array( 'subtotal', 'quantity', 'tax_rate' ) ) ) ? 'd-none d-sm-block' : '' ?> 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(); ?>"> |
|
25 | + <div class="<?php echo 'name' == $key ? 'col-6' : 'col' ?> <?php echo (in_array($key, array('subtotal', 'quantity', 'tax_rate'))) ? 'd-none d-sm-block' : '' ?> 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(); ?>"> |
|
26 | 26 | |
27 | 27 | <?php |
28 | 28 | |
29 | 29 | // Fires before printing a line item column. |
30 | - do_action( "getpaid_form_cart_item_before_$key", $item, $form ); |
|
30 | + do_action("getpaid_form_cart_item_before_$key", $item, $form); |
|
31 | 31 | |
32 | 32 | // Item name. |
33 | - if ( 'name' == $key ) { |
|
33 | + if ('name' == $key) { |
|
34 | 34 | |
35 | 35 | ob_start(); |
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 | - do_action( 'getpaid_payment_form_cart_item_description', $item, $form ); |
|
50 | + do_action('getpaid_payment_form_cart_item_description', $item, $form); |
|
51 | 51 | |
52 | - if ( wpinv_current_user_can_manage_invoicing() ) { |
|
52 | + if (wpinv_current_user_can_manage_invoicing()) { |
|
53 | 53 | |
54 | 54 | edit_post_link( |
55 | - __( 'Edit this item.', 'invoicing' ), |
|
55 | + __('Edit this item.', 'invoicing'), |
|
56 | 56 | '<small class="form-text text-muted">', |
57 | 57 | '</small>', |
58 | 58 | $item->get_id(), |
@@ -64,18 +64,18 @@ discard block |
||
64 | 64 | $description = ob_get_clean(); |
65 | 65 | |
66 | 66 | // Display the name. |
67 | - $tootip = empty( $description ) ? '' : " " . '<i class="fas fa-xs fa-info gp-tooltip d-sm-none text-muted"></i>'; |
|
68 | - echo '<div class="mb-1">' . esc_html( $item->get_name() ) . $tootip . '</div>'; |
|
67 | + $tootip = empty($description) ? '' : " " . '<i class="fas fa-xs fa-info gp-tooltip d-sm-none text-muted"></i>'; |
|
68 | + echo '<div class="mb-1">' . esc_html($item->get_name()) . $tootip . '</div>'; |
|
69 | 69 | |
70 | - if ( ! empty( $description ) ) { |
|
71 | - printf( '<span class="d-none d-sm-block getpaid-item-desc">%s</span>', $description ); |
|
70 | + if (!empty($description)) { |
|
71 | + printf('<span class="d-none d-sm-block getpaid-item-desc">%s</span>', $description); |
|
72 | 72 | } |
73 | 73 | |
74 | - if ( $item->allows_quantities() ) { |
|
74 | + if ($item->allows_quantities()) { |
|
75 | 75 | printf( |
76 | 76 | '<small class="d-sm-none text-muted form-text">%s</small>', |
77 | 77 | sprintf( |
78 | - __( 'Qty %s', 'invoicing' ), |
|
78 | + __('Qty %s', 'invoicing'), |
|
79 | 79 | sprintf( |
80 | 80 | '<input |
81 | 81 | type="text" |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | printf( |
92 | 92 | '<small class="d-sm-none text-muted form-text">%s</small>', |
93 | 93 | sprintf( |
94 | - __( 'Qty %s', 'invoicing' ), |
|
94 | + __('Qty %s', 'invoicing'), |
|
95 | 95 | (float) $item->get_quantity() |
96 | 96 | ) |
97 | 97 | ); |
@@ -100,56 +100,56 @@ discard block |
||
100 | 100 | } |
101 | 101 | |
102 | 102 | // Item price. |
103 | - if ( 'price' == $key ) { |
|
103 | + if ('price' == $key) { |
|
104 | 104 | |
105 | 105 | // Set the currency position. |
106 | 106 | $position = wpinv_currency_position(); |
107 | 107 | |
108 | - if ( $position == 'left_space' ) { |
|
108 | + if ($position == 'left_space') { |
|
109 | 109 | $position = 'left'; |
110 | 110 | } |
111 | 111 | |
112 | - if ( $position == 'right_space' ) { |
|
112 | + if ($position == 'right_space') { |
|
113 | 113 | $position = 'right'; |
114 | 114 | } |
115 | 115 | |
116 | - if ( $item->user_can_set_their_price() ) { |
|
117 | - $price = max( (float) $item->get_price(), (float) $item->get_minimum_price() ); |
|
116 | + if ($item->user_can_set_their_price()) { |
|
117 | + $price = max((float) $item->get_price(), (float) $item->get_minimum_price()); |
|
118 | 118 | $minimum = (float) $item->get_minimum_price(); |
119 | 119 | $validate_minimum = ''; |
120 | 120 | $class = ''; |
121 | 121 | $data_minimum = ''; |
122 | 122 | |
123 | - if ( $minimum > 0 ) { |
|
123 | + if ($minimum > 0) { |
|
124 | 124 | $validate_minimum = sprintf( |
125 | - esc_attr__( 'The minimum allowed amount is %s', 'invoicing' ), |
|
126 | - strip_tags( wpinv_price( $minimum, $currency ) ) |
|
125 | + esc_attr__('The minimum allowed amount is %s', 'invoicing'), |
|
126 | + strip_tags(wpinv_price($minimum, $currency)) |
|
127 | 127 | ); |
128 | 128 | |
129 | 129 | $class = 'getpaid-validate-minimum-amount'; |
130 | 130 | |
131 | - $data_minimum = "data-minimum-amount='" . esc_attr( getpaid_unstandardize_amount( $minimum ) ) . "'"; |
|
131 | + $data_minimum = "data-minimum-amount='" . esc_attr(getpaid_unstandardize_amount($minimum)) . "'"; |
|
132 | 132 | } |
133 | 133 | |
134 | 134 | ?> |
135 | 135 | <div class="input-group input-group-sm"> |
136 | - <?php if( 'left' == $position ) : ?> |
|
136 | + <?php if ('left' == $position) : ?> |
|
137 | 137 | <div class="input-group-prepend"> |
138 | - <span class="input-group-text"><?php echo wpinv_currency_symbol( $currency ); ?></span> |
|
138 | + <span class="input-group-text"><?php echo wpinv_currency_symbol($currency); ?></span> |
|
139 | 139 | </div> |
140 | 140 | <?php endif; ?> |
141 | 141 | |
142 | - <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;"> |
|
142 | + <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;"> |
|
143 | 143 | |
144 | - <?php if ( ! empty( $validate_minimum ) ) : ?> |
|
144 | + <?php if (!empty($validate_minimum)) : ?> |
|
145 | 145 | <div class="invalid-tooltip"> |
146 | 146 | <?php echo $validate_minimum; ?> |
147 | 147 | </div> |
148 | 148 | <?php endif; ?> |
149 | 149 | |
150 | - <?php if( 'left' != $position ) : ?> |
|
150 | + <?php if ('left' != $position) : ?> |
|
151 | 151 | <div class="input-group-append"> |
152 | - <span class="input-group-text"><?php echo wpinv_currency_symbol( $currency ); ?></span> |
|
152 | + <span class="input-group-text"><?php echo wpinv_currency_symbol($currency); ?></span> |
|
153 | 153 | </div> |
154 | 154 | <?php endif; ?> |
155 | 155 | </div> |
@@ -157,23 +157,23 @@ discard block |
||
157 | 157 | <?php |
158 | 158 | |
159 | 159 | } else { |
160 | - echo wpinv_price( $item->get_price(), $currency ); |
|
160 | + echo wpinv_price($item->get_price(), $currency); |
|
161 | 161 | |
162 | 162 | ?> |
163 | - <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() ); ?>'> |
|
163 | + <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()); ?>'> |
|
164 | 164 | <?php |
165 | 165 | } |
166 | 166 | |
167 | 167 | printf( |
168 | 168 | '<small class="d-sm-none text-muted form-text getpaid-mobile-item-subtotal">%s</small>', |
169 | - sprintf( __( 'Subtotal: %s', 'invoicing' ), wpinv_price( $item->get_sub_total(), $currency ) ) |
|
169 | + sprintf(__('Subtotal: %s', 'invoicing'), wpinv_price($item->get_sub_total(), $currency)) |
|
170 | 170 | ); |
171 | 171 | } |
172 | 172 | |
173 | 173 | // Item quantity. |
174 | - if ( 'quantity' == $key ) { |
|
174 | + if ('quantity' == $key) { |
|
175 | 175 | |
176 | - if ( $item->allows_quantities() ) { |
|
176 | + if ($item->allows_quantities()) { |
|
177 | 177 | ?> |
178 | 178 | <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> |
179 | 179 | <?php |
@@ -188,11 +188,11 @@ discard block |
||
188 | 188 | } |
189 | 189 | |
190 | 190 | // Item sub total. |
191 | - if ( 'subtotal' == $key ) { |
|
192 | - echo wpinv_price( $item->get_sub_total(), $currency ); |
|
191 | + if ('subtotal' == $key) { |
|
192 | + echo wpinv_price($item->get_sub_total(), $currency); |
|
193 | 193 | } |
194 | 194 | |
195 | - do_action( "getpaid_payment_form_cart_item_$key", $item, $form ); |
|
195 | + do_action("getpaid_payment_form_cart_item_$key", $item, $form); |
|
196 | 196 | ?> |
197 | 197 | |
198 | 198 | </div> |
@@ -203,4 +203,4 @@ discard block |
||
203 | 203 | |
204 | 204 | </div> |
205 | 205 | <?php |
206 | -do_action( 'getpaid_payment_form_cart_item', $form, $item ); |
|
206 | +do_action('getpaid_payment_form_cart_item', $form, $item); |