Passed
Push — master ( 67b901...21baf9 )
by Brian
12:43
created
templates/payment-forms/cart-totals.php 2 patches
Indentation   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -11,26 +11,26 @@  discard block
 block discarded – undo
11 11
 
12 12
 // Totals rows.
13 13
 $cart_totals = apply_filters(
14
-	'getpaid_payment_form_cart_table_totals',
15
-	array(
16
-		'subtotal' => __( 'Subtotal', 'invoicing' ),
17
-		'tax'      => __( 'Tax', 'invoicing' ),
18
-		'fees'     => __( 'Fee', 'invoicing' ),
19
-		'discount' => __( 'Discount', 'invoicing' ),
20
-		'total'    => __( 'Total', 'invoicing' ),
21
-	),
22
-	$form
14
+    'getpaid_payment_form_cart_table_totals',
15
+    array(
16
+        'subtotal' => __( 'Subtotal', 'invoicing' ),
17
+        'tax'      => __( 'Tax', 'invoicing' ),
18
+        'fees'     => __( 'Fee', 'invoicing' ),
19
+        'discount' => __( 'Discount', 'invoicing' ),
20
+        'total'    => __( 'Total', 'invoicing' ),
21
+    ),
22
+    $form
23 23
 );
24 24
 
25 25
 $currency = $form->get_currency();
26 26
 $country  = wpinv_get_default_country();
27 27
 
28 28
 if ( ! empty( $form->invoice ) ) {
29
-	$country  = $form->invoice->get_country();
29
+    $country  = $form->invoice->get_country();
30 30
 }
31 31
 
32 32
 if ( ! wpinv_use_taxes() && isset( $cart_totals['tax'] ) ) {
33
-	unset( $cart_totals['tax'] );
33
+    unset( $cart_totals['tax'] );
34 34
 }
35 35
 
36 36
 do_action( 'getpaid_before_payment_form_cart_totals', $form, $cart_totals );
@@ -61,13 +61,13 @@  discard block
 block discarded – undo
61 61
 
62 62
 							<?php
63 63
 
64
-								// Total tax.
65
-								if ( in_array( $key, array( 'tax', 'discount', 'subtotal', 'total', 'fees' ), true ) ) {
66
-									wpinv_the_price( 0, $currency );
67
-								}
64
+                                // Total tax.
65
+                                if ( in_array( $key, array( 'tax', 'discount', 'subtotal', 'total', 'fees' ), true ) ) {
66
+                                    wpinv_the_price( 0, $currency );
67
+                                }
68 68
 
69
-								do_action( "getpaid_payment_form_cart_totals_$key", $form );
70
-							?>
69
+                                do_action( "getpaid_payment_form_cart_totals_$key", $form );
70
+                            ?>
71 71
 
72 72
 						</div>
73 73
 
Please login to merge, or discard this patch.
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -7,17 +7,17 @@  discard block
 block discarded – undo
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
 $cart_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
 block discarded – undo
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( $cart_totals['tax'] ) ) {
33
-	unset( $cart_totals['tax'] );
32
+if (!wpinv_use_taxes() && isset($cart_totals['tax'])) {
33
+	unset($cart_totals['tax']);
34 34
 }
35 35
 
36
-do_action( 'getpaid_before_payment_form_cart_totals', $form, $cart_totals );
36
+do_action('getpaid_before_payment_form_cart_totals', $form, $cart_totals);
37 37
 
38 38
 ?>
39 39
 <style>
@@ -47,26 +47,26 @@  discard block
 block discarded – undo
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 ( $cart_totals as $key => $label ) : ?>
50
+			<?php foreach ($cart_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 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' ), true ) ) {
66
-									wpinv_the_price( 0, $currency );
65
+								if (in_array($key, array('tax', 'discount', 'subtotal', 'total', 'fees'), true)) {
66
+									wpinv_the_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
 block discarded – undo
82 82
 </div>
83 83
 
84 84
 <?php
85
-do_action( 'getpaid_payment_form_cart_totals', $form, $cart_totals );
85
+do_action('getpaid_payment_form_cart_totals', $form, $cart_totals);
Please login to merge, or discard this patch.
templates/payment-forms/cart-item.php 1 patch
Spacing   +56 added lines, -56 removed lines patch added patch discarded remove patch
@@ -9,28 +9,28 @@  discard block
 block discarded – undo
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
-$max_qty  = wpinv_item_max_buyable_quantity( $item->get_id() );
17
+$max_qty  = wpinv_item_max_buyable_quantity($item->get_id());
18 18
 ?>
19 19
 <div class='getpaid-payment-form-items-cart-item getpaid-<?php echo $item->is_required() ? 'required' : 'selectable'; ?> item-<?php echo (int) $item->get_id(); ?> border-bottom py-2 px-3'>
20 20
 
21 21
 	<div class="form-row row align-items-center 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' ), true ) ) ? 'd-none d-sm-block' : ''; ?> position-relative getpaid-form-cart-item-<?php echo esc_attr( $key ); ?> getpaid-form-cart-item-<?php echo esc_attr( $key ); ?>-<?php echo (int) $item->get_id(); ?>">
25
+			<div class="<?php echo 'name' === $key ? 'col-6' : 'col'; ?> <?php echo (in_array($key, array('subtotal', 'quantity', 'tax_rate'), true)) ? 'd-none d-sm-block' : ''; ?> position-relative getpaid-form-cart-item-<?php echo esc_attr($key); ?> getpaid-form-cart-item-<?php echo esc_attr($key); ?>-<?php echo (int) $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
 
36 36
 						ob_start();
@@ -38,22 +38,22 @@  discard block
 block discarded – undo
38 38
 						// Add an optional description.
39 39
 						$description = $item->get_description();
40 40
 
41
-						if ( ! empty( $description ) ) {
42
-							echo "<small class='form-text text-muted pr-2 m-0'>" . wp_kses_post( $description ) . '</small>';
41
+						if (!empty($description)) {
42
+							echo "<small class='form-text text-muted pr-2 m-0'>" . wp_kses_post($description) . '</small>';
43 43
 						}
44 44
 
45 45
 						// Price help text.
46
-						$description = getpaid_item_recurring_price_help_text( $item, $currency );
47
-						if ( $description ) {
48
-							echo "<small class='getpaid-form-item-price-desc form-text text-muted font-italic pr-2 m-0'>" . wp_kses_post( $description ) . '</small>';
46
+						$description = getpaid_item_recurring_price_help_text($item, $currency);
47
+						if ($description) {
48
+							echo "<small class='getpaid-form-item-price-desc form-text text-muted font-italic pr-2 m-0'>" . wp_kses_post($description) . '</small>';
49 49
 						}
50 50
 
51
-						do_action( 'getpaid_payment_form_cart_item_description', $item, $form );
51
+						do_action('getpaid_payment_form_cart_item_description', $item, $form);
52 52
 
53
-						if ( wpinv_current_user_can_manage_invoicing() ) {
53
+						if (wpinv_current_user_can_manage_invoicing()) {
54 54
 
55 55
 							edit_post_link(
56
-								__( 'Edit this item.', 'invoicing' ),
56
+								__('Edit this item.', 'invoicing'),
57 57
 								'<small class="form-text text-muted">',
58 58
 								'</small>',
59 59
 								$item->get_id(),
@@ -65,30 +65,30 @@  discard block
 block discarded – undo
65 65
 						$description = ob_get_clean();
66 66
 
67 67
 						// Display the name.
68
-						$tootip = empty( $description ) ? '' : '&nbsp;<i class="fas fa-xs fa-info gp-tooltip d-sm-none text-muted"></i>';
68
+						$tootip = empty($description) ? '' : '&nbsp;<i class="fas fa-xs fa-info gp-tooltip d-sm-none text-muted"></i>';
69 69
 
70
-						$has_featured_image = has_post_thumbnail( $item->get_id() );
70
+						$has_featured_image = has_post_thumbnail($item->get_id());
71 71
 
72
-						if ( $has_featured_image ) {
72
+						if ($has_featured_image) {
73 73
 							echo '<div class="d-flex align-items-center getpaid-form-item-has-featured-image">';
74 74
 							echo '<div class="getpaid-form-item-image-container mr-2">';
75
-							echo get_the_post_thumbnail( $item->get_id(), 'thumbnail', array( 'class' => 'getpaid-form-item-image mb-0' ) );
75
+							echo get_the_post_thumbnail($item->get_id(), 'thumbnail', array('class' => 'getpaid-form-item-image mb-0'));
76 76
 							echo '</div>';
77 77
 							echo '<div class="getpaid-form-item-name-container">';
78 78
 						}
79 79
 
80
-						echo '<div class="mb-1 font-weight-bold">' . esc_html( $item->get_name() ) . wp_kses_post( $tootip ) . '</div>';
80
+						echo '<div class="mb-1 font-weight-bold">' . esc_html($item->get_name()) . wp_kses_post($tootip) . '</div>';
81 81
 
82
-						if ( ! empty( $description ) ) {
83
-							printf( '<span class="d-none d-sm-block getpaid-item-desc">%s</span>', wp_kses_post( $description ) );
82
+						if (!empty($description)) {
83
+							printf('<span class="d-none d-sm-block getpaid-item-desc">%s</span>', wp_kses_post($description));
84 84
 						}
85 85
 
86
-						if ( $item->allows_quantities() ) {
86
+						if ($item->allows_quantities()) {
87 87
 							printf(
88 88
 								'<small class="d-sm-none text-muted form-text">%s</small>',
89 89
 								sprintf(
90 90
 									// translators: %s is the item quantity.
91
-									esc_html__( 'Qty %s', 'invoicing' ),
91
+									esc_html__('Qty %s', 'invoicing'),
92 92
 									sprintf(
93 93
 										'<input
94 94
 											type="number"
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
 											max="%s"
101 101
 										>',
102 102
 										(float) $item->get_quantity() == 0 ? 1 : (float) $item->get_quantity(),
103
-										floatval( null !== $max_qty ? $max_qty : 1000000000000 )
103
+										floatval(null !== $max_qty ? $max_qty : 1000000000000)
104 104
 									)
105 105
 								)
106 106
 							);
@@ -109,85 +109,85 @@  discard block
 block discarded – undo
109 109
 								'<small class="d-sm-none text-muted form-text">%s</small>',
110 110
 								sprintf(
111 111
 									// translators: %s is the item quantity.
112
-									esc_html__( 'Qty %s', 'invoicing' ),
112
+									esc_html__('Qty %s', 'invoicing'),
113 113
 									(float) $item->get_quantity()
114 114
 								)
115 115
 							);
116 116
 						}
117 117
 
118
-						if ( $has_featured_image ) {
118
+						if ($has_featured_image) {
119 119
 							echo '</div>';
120 120
 							echo '</div>';
121 121
 						}
122 122
 					}
123 123
 
124 124
 					// Item price.
125
-					if ( 'price' === $key ) {
125
+					if ('price' === $key) {
126 126
 
127 127
 					// Set the currency position.
128 128
 					$position = wpinv_currency_position();
129 129
 
130
-					if ( 'left_space' === $position ) {
130
+					if ('left_space' === $position) {
131 131
 						$position = 'left';
132 132
 					}
133 133
 
134
-					if ( 'right_space' === $position ) {
134
+					if ('right_space' === $position) {
135 135
 						$position = 'right';
136 136
 					}
137 137
 
138
-					if ( $item->user_can_set_their_price() ) {
139
-						$price            = max( (float) $item->get_price(), (float) $item->get_minimum_price() );
138
+					if ($item->user_can_set_their_price()) {
139
+						$price            = max((float) $item->get_price(), (float) $item->get_minimum_price());
140 140
 						$minimum          = (float) $item->get_minimum_price();
141 141
 						$validate_minimum = '';
142 142
 						$class            = '';
143 143
 						$data_minimum     = '';
144 144
 
145
-						if ( $minimum > 0 ) {
145
+						if ($minimum > 0) {
146 146
 							$validate_minimum = sprintf(
147 147
 								// translators: %s is the minimum price.
148
-								esc_attr__( 'The minimum allowed amount is %s', 'invoicing' ),
149
-								wp_strip_all_tags( wpinv_price( $minimum, $currency ) )
148
+								esc_attr__('The minimum allowed amount is %s', 'invoicing'),
149
+								wp_strip_all_tags(wpinv_price($minimum, $currency))
150 150
 							);
151 151
 
152 152
 							$class = 'getpaid-validate-minimum-amount';
153 153
 
154
-							$data_minimum     = "data-minimum-amount='" . esc_attr( getpaid_unstandardize_amount( $minimum ) ) . "'";
154
+							$data_minimum = "data-minimum-amount='" . esc_attr(getpaid_unstandardize_amount($minimum)) . "'";
155 155
 						}
156 156
 
157 157
 						?>
158 158
 								<div class="input-group input-group-sm">
159
-									<?php if ( 'left' === $position ) : ?>
160
-										<?php if ( empty( $GLOBALS['aui_bs5'] ) ) : ?>
159
+									<?php if ('left' === $position) : ?>
160
+										<?php if (empty($GLOBALS['aui_bs5'])) : ?>
161 161
 											<div class="input-group-prepend ">
162 162
 												<span class="input-group-text">
163
-													<?php echo wp_kses_post( wpinv_currency_symbol( $currency ) ); ?></span>
163
+													<?php echo wp_kses_post(wpinv_currency_symbol($currency)); ?></span>
164 164
 												</span>
165 165
 											</div>
166 166
 										<?php else : ?>
167 167
 											<span class="input-group-text">
168
-												<?php echo wp_kses_post( wpinv_currency_symbol( $currency ) ); ?></span>
168
+												<?php echo wp_kses_post(wpinv_currency_symbol($currency)); ?></span>
169 169
 											</span>
170 170
 										<?php endif; ?>
171 171
 									<?php endif; ?>
172 172
 
173
-									<input type="number" step="0.01" <?php echo wp_kses_post( $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 esc_attr( $class ); ?>" style="width: 64px; line-height: 1; min-height: 35px;">
173
+									<input type="number" step="0.01" <?php echo wp_kses_post($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 esc_attr($class); ?>" style="width: 64px; line-height: 1; min-height: 35px;">
174 174
 
175
-								<?php if ( ! empty( $validate_minimum ) ) : ?>
175
+								<?php if (!empty($validate_minimum)) : ?>
176 176
 										<div class="invalid-tooltip">
177
-											<?php echo wp_kses_post( $validate_minimum ); ?>
177
+											<?php echo wp_kses_post($validate_minimum); ?>
178 178
 										</div>
179 179
 									<?php endif; ?>
180 180
 
181
-								<?php if ( 'left' !== $position ) : ?>
182
-									<?php if ( empty( $GLOBALS['aui_bs5'] ) ) : ?>
181
+								<?php if ('left' !== $position) : ?>
182
+									<?php if (empty($GLOBALS['aui_bs5'])) : ?>
183 183
 											<div class="input-group-append ">
184 184
 												<span class="input-group-text">
185
-													<?php echo wp_kses_post( wpinv_currency_symbol( $currency ) ); ?></span>
185
+													<?php echo wp_kses_post(wpinv_currency_symbol($currency)); ?></span>
186 186
 												</span>
187 187
 											</div>
188 188
 										<?php else : ?>
189 189
 											<span class="input-group-text">
190
-												<?php echo wp_kses_post( wpinv_currency_symbol( $currency ) ); ?></span>
190
+												<?php echo wp_kses_post(wpinv_currency_symbol($currency)); ?></span>
191 191
 											</span>
192 192
 										<?php endif; ?>
193 193
 									<?php endif; ?>
@@ -198,23 +198,23 @@  discard block
 block discarded – undo
198 198
 						} else {
199 199
 						?>
200 200
 							<span class="getpaid-items-<?php echo (int) $item->get_id(); ?>-view-price">
201
-								<?php echo wp_kses_post( wpinv_price( $item->get_price(), $currency ) ); ?>
201
+								<?php echo wp_kses_post(wpinv_price($item->get_price(), $currency)); ?>
202 202
 							</span>
203
-							<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() ); ?>'>
203
+							<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()); ?>'>
204 204
 						<?php
205 205
 						}
206 206
 
207 207
 					printf(
208 208
                         '<small class="d-sm-none text-muted form-text getpaid-mobile-item-subtotal">%s</small>',
209 209
 						// translators: %s is the item subtotal.
210
-                        sprintf( esc_html__( 'Subtotal: %s', 'invoicing' ), wp_kses_post( wpinv_price( $item->get_sub_total(), $currency ) ) )
210
+                        sprintf(esc_html__('Subtotal: %s', 'invoicing'), wp_kses_post(wpinv_price($item->get_sub_total(), $currency)))
211 211
                     );
212 212
 					}
213 213
 
214 214
 					// Item quantity.
215
-					if ( 'quantity' === $key ) {
215
+					if ('quantity' === $key) {
216 216
 
217
-					if ( $item->allows_quantities() ) {
217
+					if ($item->allows_quantities()) {
218 218
 						?>
219 219
 								<input name='getpaid-items[<?php echo (int) $item->get_id(); ?>][quantity]' type="number" step="any" 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' <?php echo null !== $max_qty ? 'max="' . (float) $max_qty . '"' : ''; ?> required>
220 220
 						<?php
@@ -229,11 +229,11 @@  discard block
 block discarded – undo
229 229
 }
230 230
 
231 231
 					// Item sub total.
232
-					if ( 'subtotal' === $key ) {
233
-					echo wp_kses_post( wpinv_price( $item->get_sub_total(), $currency ) );
232
+					if ('subtotal' === $key) {
233
+					echo wp_kses_post(wpinv_price($item->get_sub_total(), $currency));
234 234
 					}
235 235
 
236
-					do_action( "getpaid_payment_form_cart_item_$key", $item, $form );
236
+					do_action("getpaid_payment_form_cart_item_$key", $item, $form);
237 237
 				?>
238 238
 
239 239
 			</div>
@@ -244,4 +244,4 @@  discard block
 block discarded – undo
244 244
 
245 245
 </div>
246 246
 <?php
247
-do_action( 'getpaid_payment_form_cart_item', $form, $item );
247
+do_action('getpaid_payment_form_cart_item', $form, $item);
Please login to merge, or discard this patch.
includes/wpinv-tax-functions.php 1 patch
Spacing   +129 added lines, -129 removed lines patch added patch discarded remove patch
@@ -4,7 +4,7 @@  discard block
 block discarded – undo
4 4
  *
5 5
  */
6 6
 
7
-defined( 'ABSPATH' ) || exit;
7
+defined('ABSPATH') || exit;
8 8
 
9 9
 /**
10 10
  * Returns an array of eu states.
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
  * @return array
13 13
  */
14 14
 function getpaid_get_eu_states() {
15
-    return wpinv_get_data( 'eu-states' );
15
+    return wpinv_get_data('eu-states');
16 16
 }
17 17
 
18 18
 /**
@@ -20,8 +20,8 @@  discard block
 block discarded – undo
20 20
  *
21 21
  * @return bool
22 22
  */
23
-function getpaid_is_eu_state( $country ) {
24
-    return ! empty( $country ) && in_array( strtoupper( $country ), getpaid_get_eu_states(), true ) ? true : false;
23
+function getpaid_is_eu_state($country) {
24
+    return !empty($country) && in_array(strtoupper($country), getpaid_get_eu_states(), true) ? true : false;
25 25
 }
26 26
 
27 27
 /**
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
  * @return array
31 31
  */
32 32
 function getpaid_get_gst_states() {
33
-    return array( 'AU', 'NZ', 'CA', 'CN' );
33
+    return array('AU', 'NZ', 'CA', 'CN');
34 34
 }
35 35
 
36 36
 /**
@@ -38,8 +38,8 @@  discard block
 block discarded – undo
38 38
  *
39 39
  * @return bool
40 40
  */
41
-function getpaid_is_gst_country( $country ) {
42
-    return ! empty( $country ) && in_array( strtoupper( $country ), getpaid_get_gst_states(), true ) ? true : false;
41
+function getpaid_is_gst_country($country) {
42
+    return !empty($country) && in_array(strtoupper($country), getpaid_get_gst_states(), true) ? true : false;
43 43
 }
44 44
 
45 45
 /**
@@ -49,8 +49,8 @@  discard block
 block discarded – undo
49 49
  */
50 50
 function wpinv_use_taxes() {
51 51
 
52
-    $ret = wpinv_get_option( 'enable_taxes', false );
53
-    return (bool) apply_filters( 'wpinv_use_taxes', ! empty( $ret ) );
52
+    $ret = wpinv_get_option('enable_taxes', false);
53
+    return (bool) apply_filters('wpinv_use_taxes', !empty($ret));
54 54
 
55 55
 }
56 56
 
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
  * @param WPInv_Invoice $invoice
61 61
  * @return bool
62 62
  */
63
-function wpinv_is_invoice_taxable( $invoice ) {
63
+function wpinv_is_invoice_taxable($invoice) {
64 64
     return $invoice->is_taxable();
65 65
 }
66 66
 
@@ -70,11 +70,11 @@  discard block
 block discarded – undo
70 70
  * @param string $country
71 71
  * @return bool
72 72
  */
73
-function wpinv_is_country_taxable( $country ) {
74
-    $is_eu     = getpaid_is_eu_state( $country );
75
-    $is_exempt = ! $is_eu && wpinv_is_base_country( $country ) && wpinv_same_country_exempt_vat();
73
+function wpinv_is_country_taxable($country) {
74
+    $is_eu     = getpaid_is_eu_state($country);
75
+    $is_exempt = !$is_eu && wpinv_is_base_country($country) && wpinv_same_country_exempt_vat();
76 76
 
77
-    return (bool) apply_filters( 'wpinv_is_country_taxable', ! $is_exempt, $country );
77
+    return (bool) apply_filters('wpinv_is_country_taxable', !$is_exempt, $country);
78 78
 
79 79
 }
80 80
 
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
  * @param WPInv_Item|GetPaid_Form_Item $item
85 85
  * @return bool
86 86
  */
87
-function wpinv_is_item_taxable( $item ) {
87
+function wpinv_is_item_taxable($item) {
88 88
     return '_exempt' !== $item->get_vat_rule();
89 89
 }
90 90
 
@@ -93,15 +93,15 @@  discard block
 block discarded – undo
93 93
  *
94 94
  * @return bool
95 95
  */
96
-function wpinv_use_store_address_as_tax_base( $tax_rule = false ) {
97
-    $use_base = wpinv_get_option( 'tax_base', 'billing' ) === 'base';
96
+function wpinv_use_store_address_as_tax_base($tax_rule = false) {
97
+    $use_base = wpinv_get_option('tax_base', 'billing') === 'base';
98 98
 
99
-    if ( $tax_rule ) {
100
-        $rules    = getpaid_get_tax_rules( 'tax_base' );
101
-        $use_base = isset( $rules[ $tax_rule ] ) ? 'base' === $rules[ $tax_rule ] : $use_base;
99
+    if ($tax_rule) {
100
+        $rules    = getpaid_get_tax_rules('tax_base');
101
+        $use_base = isset($rules[$tax_rule]) ? 'base' === $rules[$tax_rule] : $use_base;
102 102
     }
103 103
 
104
-    return (bool) apply_filters( 'wpinv_use_store_address_as_tax_base', $use_base, $tax_rule );
104
+    return (bool) apply_filters('wpinv_use_store_address_as_tax_base', $use_base, $tax_rule);
105 105
 }
106 106
 
107 107
 /**
@@ -109,15 +109,15 @@  discard block
 block discarded – undo
109 109
  *
110 110
  * @return bool
111 111
  */
112
-function wpinv_get_vat_same_country_rule( $tax_rule = false ) {
113
-    $rule = wpinv_get_option( 'vat_same_country_rule', 'vat_too' );
112
+function wpinv_get_vat_same_country_rule($tax_rule = false) {
113
+    $rule = wpinv_get_option('vat_same_country_rule', 'vat_too');
114 114
 
115
-    if ( $tax_rule ) {
116
-        $rules = getpaid_get_tax_rules( 'same_country_rule' );
117
-        $rule  = isset( $rules[ $tax_rule ] ) ? $rules[ $tax_rule ] : $rule;
115
+    if ($tax_rule) {
116
+        $rules = getpaid_get_tax_rules('same_country_rule');
117
+        $rule  = isset($rules[$tax_rule]) ? $rules[$tax_rule] : $rule;
118 118
     }
119 119
 
120
-    return (bool) apply_filters( 'wpinv_get_vat_same_country_rule', $rule, $tax_rule );
120
+    return (bool) apply_filters('wpinv_get_vat_same_country_rule', $rule, $tax_rule);
121 121
 }
122 122
 
123 123
 /**
@@ -126,8 +126,8 @@  discard block
 block discarded – undo
126 126
  * @return bool
127 127
  */
128 128
 function wpinv_prices_include_tax() {
129
-    $is_inclusive = wpinv_get_option( 'prices_include_tax', 'no' ) === 'yes';
130
-    return (bool) apply_filters( 'wpinv_prices_include_tax', $is_inclusive );
129
+    $is_inclusive = wpinv_get_option('prices_include_tax', 'no') === 'yes';
130
+    return (bool) apply_filters('wpinv_prices_include_tax', $is_inclusive);
131 131
 }
132 132
 
133 133
 /**
@@ -136,8 +136,8 @@  discard block
 block discarded – undo
136 136
  * @return bool
137 137
  */
138 138
 function wpinv_round_tax_per_tax_rate() {
139
-    $subtotal_rounding = wpinv_get_option( 'tax_subtotal_rounding', 1 );
140
-    return (bool) apply_filters( 'wpinv_round_tax_per_tax_rate', empty( $subtotal_rounding ) );
139
+    $subtotal_rounding = wpinv_get_option('tax_subtotal_rounding', 1);
140
+    return (bool) apply_filters('wpinv_round_tax_per_tax_rate', empty($subtotal_rounding));
141 141
 }
142 142
 
143 143
 /**
@@ -146,8 +146,8 @@  discard block
 block discarded – undo
146 146
  * @return bool
147 147
  */
148 148
 function wpinv_display_individual_tax_rates() {
149
-    $individual = wpinv_get_option( 'tax_display_totals', 'single' ) === 'individual';
150
-    return (bool) apply_filters( 'wpinv_display_individual_tax_rates', $individual );
149
+    $individual = wpinv_get_option('tax_display_totals', 'single') === 'individual';
150
+    return (bool) apply_filters('wpinv_display_individual_tax_rates', $individual);
151 151
 }
152 152
 
153 153
 /**
@@ -156,8 +156,8 @@  discard block
 block discarded – undo
156 156
  * @return float
157 157
  */
158 158
 function wpinv_get_default_tax_rate() {
159
-    $rate = wpinv_get_option( 'tax_rate', 0 );
160
-    return (float) apply_filters( 'wpinv_get_default_tax_rate', floatval( $rate ) );
159
+    $rate = wpinv_get_option('tax_rate', 0);
160
+    return (float) apply_filters('wpinv_get_default_tax_rate', floatval($rate));
161 161
 }
162 162
 
163 163
 /**
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
  * @return bool
167 167
  */
168 168
 function wpinv_same_country_exempt_vat() {
169
-    return 'no' === wpinv_get_option( 'vat_same_country_rule', 'vat_too' );
169
+    return 'no' === wpinv_get_option('vat_same_country_rule', 'vat_too');
170 170
 }
171 171
 
172 172
 /**
@@ -186,28 +186,28 @@  discard block
 block discarded – undo
186 186
  * @param string $state
187 187
  * @return array
188 188
  */
189
-function getpaid_get_item_tax_rates( $item, $country = '', $state = '' ) {
189
+function getpaid_get_item_tax_rates($item, $country = '', $state = '') {
190 190
 
191 191
     // Abort if the item is not taxable.
192
-    if ( ! wpinv_is_item_taxable( $item ) ) {
192
+    if (!wpinv_is_item_taxable($item)) {
193 193
         return array();
194 194
     }
195 195
 
196 196
     // Maybe use the store address.
197
-    if ( wpinv_use_store_address_as_tax_base( $item->get_vat_rule() ) ) {
197
+    if (wpinv_use_store_address_as_tax_base($item->get_vat_rule())) {
198 198
         $country = wpinv_get_default_country();
199 199
         $state   = wpinv_get_default_state();
200 200
     }
201 201
 
202 202
     // Retrieve tax rates.
203
-    $tax_rates = GetPaid_Tax::get_address_tax_rates( $country, $state );
203
+    $tax_rates = GetPaid_Tax::get_address_tax_rates($country, $state);
204 204
 
205 205
     // Fallback to the default tax rates if non were found.
206
-    if ( empty( $tax_rates ) ) {
206
+    if (empty($tax_rates)) {
207 207
         $tax_rates = GetPaid_Tax::get_default_tax_rates();
208 208
     }
209 209
 
210
-    return apply_filters( 'getpaid_get_item_tax_rates', $tax_rates, $item, $country, $state );
210
+    return apply_filters('getpaid_get_item_tax_rates', $tax_rates, $item, $country, $state);
211 211
 }
212 212
 
213 213
 /**
@@ -217,22 +217,22 @@  discard block
 block discarded – undo
217 217
  * @param array $rates
218 218
  * @return array
219 219
  */
220
-function getpaid_filter_item_tax_rates( $item, $rates ) {
220
+function getpaid_filter_item_tax_rates($item, $rates) {
221 221
 
222 222
     $tax_class = $item->get_vat_class();
223 223
 
224
-    foreach ( $rates as $i => $rate ) {
224
+    foreach ($rates as $i => $rate) {
225 225
 
226
-        if ( '_reduced' === $tax_class ) {
227
-            $rates[ $i ]['rate'] = empty( $rate['reduced_rate'] ) ? 0 : $rate['reduced_rate'];
226
+        if ('_reduced' === $tax_class) {
227
+            $rates[$i]['rate'] = empty($rate['reduced_rate']) ? 0 : $rate['reduced_rate'];
228 228
         }
229 229
 
230
-        if ( '_exempt' === $tax_class ) {
231
-            $rates[ $i ]['rate'] = 0;
230
+        if ('_exempt' === $tax_class) {
231
+            $rates[$i]['rate'] = 0;
232 232
         }
233 233
     }
234 234
 
235
-    return apply_filters( 'getpaid_filter_item_tax_rates', $rates, $item );
235
+    return apply_filters('getpaid_filter_item_tax_rates', $rates, $item);
236 236
 }
237 237
 
238 238
 /**
@@ -242,12 +242,12 @@  discard block
 block discarded – undo
242 242
  * @param array $rates
243 243
  * @return array
244 244
  */
245
-function getpaid_calculate_item_taxes( $amount, $rates ) {
245
+function getpaid_calculate_item_taxes($amount, $rates) {
246 246
 
247 247
     $is_inclusive = wpinv_prices_include_tax();
248
-    $taxes        = GetPaid_Tax::calc_tax( $amount, $rates, $is_inclusive );
248
+    $taxes        = GetPaid_Tax::calc_tax($amount, $rates, $is_inclusive);
249 249
 
250
-    return apply_filters( 'getpaid_calculate_taxes', $taxes, $amount, $rates );
250
+    return apply_filters('getpaid_calculate_taxes', $taxes, $amount, $rates);
251 251
 }
252 252
 
253 253
 /**
@@ -259,17 +259,17 @@  discard block
 block discarded – undo
259 259
  * @param float $recurring_tax_amount
260 260
  * @return array
261 261
  */
262
-function getpaid_prepare_item_tax( $item, $tax_name, $tax_amount, $recurring_tax_amount ) {
262
+function getpaid_prepare_item_tax($item, $tax_name, $tax_amount, $recurring_tax_amount) {
263 263
 
264
-    $initial_tax   = $tax_amount;
264
+    $initial_tax = $tax_amount;
265 265
 	$recurring_tax = 0;
266 266
 
267
-    if ( $item->is_recurring() ) {
267
+    if ($item->is_recurring()) {
268 268
 		$recurring_tax = $recurring_tax_amount;
269 269
 	}
270 270
 
271 271
 	return array(
272
-		'name'          => sanitize_text_field( $tax_name ),
272
+		'name'          => sanitize_text_field($tax_name),
273 273
 		'initial_tax'   => $initial_tax,
274 274
 		'recurring_tax' => $recurring_tax,
275 275
     );
@@ -282,8 +282,8 @@  discard block
 block discarded – undo
282 282
  * @param string $vat_number
283 283
  * @return string
284 284
  */
285
-function wpinv_sanitize_vat_number( $vat_number ) {
286
-    return str_replace( array( ' ', '.', '-', '_', ',' ), '', strtoupper( trim( $vat_number ) ) );
285
+function wpinv_sanitize_vat_number($vat_number) {
286
+    return str_replace(array(' ', '.', '-', '_', ','), '', strtoupper(trim($vat_number)));
287 287
 }
288 288
 
289 289
 /**
@@ -292,22 +292,22 @@  discard block
 block discarded – undo
292 292
  * @param string $vat_number
293 293
  * @return bool
294 294
  */
295
-function wpinv_regex_validate_vat_number( $vat_number ) {
295
+function wpinv_regex_validate_vat_number($vat_number) {
296 296
 
297
-    $country    = substr( $vat_number, 0, 2 );
298
-    $vatin      = substr( $vat_number, 2 );
299
-    $regexes    = wpinv_get_data( 'vat-number-regexes' );
297
+    $country    = substr($vat_number, 0, 2);
298
+    $vatin      = substr($vat_number, 2);
299
+    $regexes    = wpinv_get_data('vat-number-regexes');
300 300
 
301
-    if ( isset( $regexes[ $country ] ) ) {
301
+    if (isset($regexes[$country])) {
302 302
 
303
-        $regex = $regexes[ $country ];
303
+        $regex = $regexes[$country];
304 304
         $regex = '/^(?:' . $regex . ')$/';
305
-        return 1 === preg_match( $regex, $vatin );
305
+        return 1 === preg_match($regex, $vatin);
306 306
 
307 307
     }
308 308
 
309 309
     // Not an EU state, use filters to validate the number.
310
-    return apply_filters( 'wpinv_regex_validate_vat_number', true, $vat_number );
310
+    return apply_filters('wpinv_regex_validate_vat_number', true, $vat_number);
311 311
 }
312 312
 
313 313
 /**
@@ -316,29 +316,29 @@  discard block
 block discarded – undo
316 316
  * @param string $vat_number
317 317
  * @return bool
318 318
  */
319
-function wpinv_vies_validate_vat_number( $vat_number ) {
319
+function wpinv_vies_validate_vat_number($vat_number) {
320 320
 
321
-    $country    = substr( $vat_number, 0, 2 );
322
-    $vatin      = substr( $vat_number, 2 );
321
+    $country    = substr($vat_number, 0, 2);
322
+    $vatin      = substr($vat_number, 2);
323 323
 
324 324
     $url        = add_query_arg(
325 325
         array(
326
-            'ms'  => rawurlencode( $country ),
327
-            'iso' => rawurlencode( $country ),
328
-            'vat' => rawurlencode( $vatin ),
326
+            'ms'  => rawurlencode($country),
327
+            'iso' => rawurlencode($country),
328
+            'vat' => rawurlencode($vatin),
329 329
         ),
330 330
         'http://ec.europa.eu/taxation_customs/vies/viesquer.do'
331 331
     );
332 332
 
333
-    $response   = wp_remote_get( $url );
334
-    $response   = wp_remote_retrieve_body( $response );
333
+    $response   = wp_remote_get($url);
334
+    $response   = wp_remote_retrieve_body($response);
335 335
 
336 336
     // Fallback gracefully if the VIES website is down.
337
-    if ( empty( $response ) ) {
337
+    if (empty($response)) {
338 338
         return true;
339 339
     }
340 340
 
341
-    return 1 !== preg_match( '/invalid VAT number/i', $response );
341
+    return 1 !== preg_match('/invalid VAT number/i', $response);
342 342
 
343 343
 }
344 344
 
@@ -349,17 +349,17 @@  discard block
 block discarded – undo
349 349
  * @param string $country
350 350
  * @return bool
351 351
  */
352
-function wpinv_validate_vat_number( $vat_number, $country ) {
352
+function wpinv_validate_vat_number($vat_number, $country) {
353 353
 
354 354
     // In case the vat number does not have a country code...
355
-    $vat_number = wpinv_sanitize_vat_number( $vat_number );
356
-    $_country   = substr( $vat_number, 0, 2 );
355
+    $vat_number = wpinv_sanitize_vat_number($vat_number);
356
+    $_country   = substr($vat_number, 0, 2);
357 357
 
358
-    if ( wpinv_country_name( $_country ) === $_country ) {
359
-        $vat_number = strtoupper( $country ) . $vat_number;
358
+    if (wpinv_country_name($_country) === $_country) {
359
+        $vat_number = strtoupper($country) . $vat_number;
360 360
     }
361 361
 
362
-    return wpinv_regex_validate_vat_number( $vat_number ) && wpinv_vies_validate_vat_number( $vat_number );
362
+    return wpinv_regex_validate_vat_number($vat_number) && wpinv_vies_validate_vat_number($vat_number);
363 363
 }
364 364
 
365 365
 /**
@@ -368,39 +368,39 @@  discard block
 block discarded – undo
368 368
  * @return bool
369 369
  */
370 370
 function wpinv_should_validate_vat_number() {
371
-    $validate = wpinv_get_option( 'validate_vat_number' );
372
-	return ! empty( $validate );
371
+    $validate = wpinv_get_option('validate_vat_number');
372
+	return !empty($validate);
373 373
 }
374 374
 
375
-function wpinv_sales_tax_for_year( $year = null ) {
376
-    return wpinv_price( wpinv_get_sales_tax_for_year( $year ) );
375
+function wpinv_sales_tax_for_year($year = null) {
376
+    return wpinv_price(wpinv_get_sales_tax_for_year($year));
377 377
 }
378 378
 
379
-function wpinv_get_sales_tax_for_year( $year = null ) {
379
+function wpinv_get_sales_tax_for_year($year = null) {
380 380
     global $wpdb;
381 381
 
382 382
     // Start at zero
383 383
     $tax = 0;
384 384
 
385
-    if ( ! empty( $year ) ) {
385
+    if (!empty($year)) {
386 386
         $args = array(
387 387
             'post_type'      => 'wpi_invoice',
388
-            'post_status'    => array( 'publish' ),
388
+            'post_status'    => array('publish'),
389 389
             'posts_per_page' => -1,
390 390
             'year'           => $year,
391 391
             'fields'         => 'ids',
392 392
         );
393 393
 
394
-        $payments    = get_posts( $args );
395
-        $payment_ids = implode( ',', $payments );
394
+        $payments    = get_posts($args);
395
+        $payment_ids = implode(',', $payments);
396 396
 
397
-        if ( count( $payments ) > 0 ) {
397
+        if (count($payments) > 0) {
398 398
             $sql = "SELECT SUM( meta_value ) FROM $wpdb->postmeta WHERE meta_key = '_wpinv_tax' AND post_id IN( $payment_ids )";
399
-            $tax = $wpdb->get_var( $sql );
399
+            $tax = $wpdb->get_var($sql);
400 400
         }
401 401
 }
402 402
 
403
-    return apply_filters( 'wpinv_get_sales_tax_for_year', $tax, $year );
403
+    return apply_filters('wpinv_get_sales_tax_for_year', $tax, $year);
404 404
 }
405 405
 
406 406
 function wpinv_is_cart_taxed() {
@@ -409,34 +409,34 @@  discard block
 block discarded – undo
409 409
 
410 410
 function wpinv_prices_show_tax_on_checkout() {
411 411
     return false; // TODO
412
-    $ret = ( wpinv_get_option( 'checkout_include_tax', false ) === 'yes' && wpinv_use_taxes() );
412
+    $ret = (wpinv_get_option('checkout_include_tax', false) === 'yes' && wpinv_use_taxes());
413 413
 
414
-    return apply_filters( 'wpinv_taxes_on_prices_on_checkout', $ret );
414
+    return apply_filters('wpinv_taxes_on_prices_on_checkout', $ret);
415 415
 }
416 416
 
417 417
 function wpinv_display_tax_rate() {
418
-    $ret = wpinv_use_taxes() && wpinv_get_option( 'display_tax_rate', false );
418
+    $ret = wpinv_use_taxes() && wpinv_get_option('display_tax_rate', false);
419 419
 
420
-    return apply_filters( 'wpinv_display_tax_rate', $ret );
420
+    return apply_filters('wpinv_display_tax_rate', $ret);
421 421
 }
422 422
 
423 423
 function wpinv_cart_needs_tax_address_fields() {
424
-    if ( ! wpinv_is_cart_taxed() ) {
424
+    if (!wpinv_is_cart_taxed()) {
425 425
         return false;
426 426
     }
427 427
 
428
-    return ! did_action( 'wpinv_after_cc_fields', 'wpinv_default_cc_address_fields' );
428
+    return !did_action('wpinv_after_cc_fields', 'wpinv_default_cc_address_fields');
429 429
 }
430 430
 
431
-function wpinv_item_is_tax_exclusive( $item_id = 0 ) {
432
-    $ret = (bool)get_post_meta( $item_id, '_wpinv_tax_exclusive', false );
433
-    return apply_filters( 'wpinv_is_tax_exclusive', $ret, $item_id );
431
+function wpinv_item_is_tax_exclusive($item_id = 0) {
432
+    $ret = (bool) get_post_meta($item_id, '_wpinv_tax_exclusive', false);
433
+    return apply_filters('wpinv_is_tax_exclusive', $ret, $item_id);
434 434
 }
435 435
 
436
-function wpinv_currency_decimal_filter( $decimals = 2 ) {
436
+function wpinv_currency_decimal_filter($decimals = 2) {
437 437
     $currency = wpinv_get_currency();
438 438
 
439
-    switch ( $currency ) {
439
+    switch ($currency) {
440 440
         case 'RIAL':
441 441
         case 'JPY':
442 442
         case 'TWD':
@@ -445,13 +445,13 @@  discard block
 block discarded – undo
445 445
             break;
446 446
     }
447 447
 
448
-    return apply_filters( 'wpinv_currency_decimal_count', $decimals, $currency );
448
+    return apply_filters('wpinv_currency_decimal_count', $decimals, $currency);
449 449
 }
450 450
 
451 451
 function wpinv_tax_amount() {
452 452
     $output = 0.00;
453 453
 
454
-    return apply_filters( 'wpinv_tax_amount', $output );
454
+    return apply_filters('wpinv_tax_amount', $output);
455 455
 }
456 456
 
457 457
 /**
@@ -459,25 +459,25 @@  discard block
 block discarded – undo
459 459
  *
460 460
  * @param string|bool|null $vat_rule
461 461
  */
462
-function getpaid_filter_vat_rule( $vat_rule ) {
462
+function getpaid_filter_vat_rule($vat_rule) {
463 463
 
464
-    if ( empty( $vat_rule ) ) {
464
+    if (empty($vat_rule)) {
465 465
         return 'digital';
466 466
     }
467 467
 
468 468
     return $vat_rule;
469 469
 }
470
-add_filter( 'wpinv_get_item_vat_rule', 'getpaid_filter_vat_rule' );
470
+add_filter('wpinv_get_item_vat_rule', 'getpaid_filter_vat_rule');
471 471
 
472 472
 /**
473 473
  * Filters the VAT class to ensure that each item has a VAT class.
474 474
  *
475 475
  * @param string|bool|null $vat_rule
476 476
  */
477
-function getpaid_filter_vat_class( $vat_class ) {
478
-    return empty( $vat_class ) ? '_standard' : $vat_class;
477
+function getpaid_filter_vat_class($vat_class) {
478
+    return empty($vat_class) ? '_standard' : $vat_class;
479 479
 }
480
-add_filter( 'wpinv_get_item_vat_class', 'getpaid_filter_vat_class' );
480
+add_filter('wpinv_get_item_vat_class', 'getpaid_filter_vat_class');
481 481
 
482 482
 /**
483 483
  * Returns a list of all tax classes.
@@ -489,9 +489,9 @@  discard block
 block discarded – undo
489 489
     return apply_filters(
490 490
         'getpaid_tax_classes',
491 491
         array(
492
-            '_standard' => __( 'Standard Tax Rate', 'invoicing' ),
493
-            '_reduced'  => __( 'Reduced Tax Rate', 'invoicing' ),
494
-            '_exempt'   => __( 'Tax Exempt', 'invoicing' ),
492
+            '_standard' => __('Standard Tax Rate', 'invoicing'),
493
+            '_reduced'  => __('Reduced Tax Rate', 'invoicing'),
494
+            '_exempt'   => __('Tax Exempt', 'invoicing'),
495 495
         )
496 496
     );
497 497
 
@@ -502,8 +502,8 @@  discard block
 block discarded – undo
502 502
  *
503 503
  * @return array
504 504
  */
505
-function getpaid_get_tax_rules( $return = 'label' ) {
506
-    return wp_list_pluck( GetPaid_Tax::get_all_tax_rules(), $return, 'key' );
505
+function getpaid_get_tax_rules($return = 'label') {
506
+    return wp_list_pluck(GetPaid_Tax::get_all_tax_rules(), $return, 'key');
507 507
 }
508 508
 
509 509
 /**
@@ -512,15 +512,15 @@  discard block
 block discarded – undo
512 512
  * @param string $tax_class
513 513
  * @return string
514 514
  */
515
-function getpaid_get_tax_class_label( $tax_class ) {
515
+function getpaid_get_tax_class_label($tax_class) {
516 516
 
517 517
     $classes = getpaid_get_tax_classes();
518 518
 
519
-    if ( isset( $classes[ $tax_class ] ) ) {
520
-        return sanitize_text_field( $classes[ $tax_class ] );
519
+    if (isset($classes[$tax_class])) {
520
+        return sanitize_text_field($classes[$tax_class]);
521 521
     }
522 522
 
523
-    return sanitize_text_field( $tax_class );
523
+    return sanitize_text_field($tax_class);
524 524
 
525 525
 }
526 526
 
@@ -530,15 +530,15 @@  discard block
 block discarded – undo
530 530
  * @param string $tax_rule
531 531
  * @return string
532 532
  */
533
-function getpaid_get_tax_rule_label( $tax_rule ) {
533
+function getpaid_get_tax_rule_label($tax_rule) {
534 534
 
535 535
     $rules = getpaid_get_tax_rules();
536 536
 
537
-    if ( isset( $rules[ $tax_rule ] ) ) {
538
-        return sanitize_text_field( $rules[ $tax_rule ] );
537
+    if (isset($rules[$tax_rule])) {
538
+        return sanitize_text_field($rules[$tax_rule]);
539 539
     }
540 540
 
541
-    return sanitize_text_field( $tax_rule );
541
+    return sanitize_text_field($tax_rule);
542 542
 
543 543
 }
544 544
 
@@ -549,11 +549,11 @@  discard block
 block discarded – undo
549 549
  * @param string $recurring
550 550
  * @return string
551 551
  */
552
-function getpaid_get_taxable_amount( $item, $recurring = false ) {
552
+function getpaid_get_taxable_amount($item, $recurring = false) {
553 553
 
554 554
     $taxable_amount  = $recurring ? $item->get_recurring_sub_total() : $item->get_sub_total();
555 555
     $taxable_amount -= $recurring ? $item->recurring_item_discount : $item->item_discount;
556
-    $taxable_amount  = max( 0, $taxable_amount );
557
-    return apply_filters( 'getpaid_taxable_amount', $taxable_amount, $item, $recurring );
556
+    $taxable_amount  = max(0, $taxable_amount);
557
+    return apply_filters('getpaid_taxable_amount', $taxable_amount, $item, $recurring);
558 558
 
559 559
 }
Please login to merge, or discard this patch.