Passed
Push — master ( c5d98b...02cd26 )
by Stiofan
04:53
created
includes/wpinv-tax-functions.php 3 patches
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -256,8 +256,9 @@
 block discarded – undo
256 256
 }
257 257
 
258 258
 function wpinv_cart_needs_tax_address_fields() {
259
-    if( !wpinv_is_cart_taxed() )
260
-        return false;
259
+    if( !wpinv_is_cart_taxed() ) {
260
+            return false;
261
+    }
261 262
 
262 263
     return ! did_action( 'wpinv_after_cc_fields', 'wpinv_default_cc_address_fields' );
263 264
 }
Please login to merge, or discard this patch.
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -215,16 +215,16 @@  discard block
 block discarded – undo
215 215
 function getpaid_prepare_item_tax( $item, $tax_name, $tax_amount, $recurring_tax_amount ) {
216 216
 
217 217
     $initial_tax   = $tax_amount;
218
-	$recurring_tax = 0;
218
+    $recurring_tax = 0;
219 219
 
220 220
     if ( $item->is_recurring() ) {
221
-		$recurring_tax = $recurring_tax_amount;
222
-	}
221
+        $recurring_tax = $recurring_tax_amount;
222
+    }
223 223
 
224
-	return array(
225
-		'name'          => sanitize_text_field( $tax_name ),
226
-		'initial_tax'   => $initial_tax,
227
-		'recurring_tax' => $recurring_tax,
224
+    return array(
225
+        'name'          => sanitize_text_field( $tax_name ),
226
+        'initial_tax'   => $initial_tax,
227
+        'recurring_tax' => $recurring_tax,
228 228
     );
229 229
 
230 230
 }
@@ -328,7 +328,7 @@  discard block
 block discarded – undo
328 328
  */
329 329
 function wpinv_should_validate_vat_number() {
330 330
     $validate = wpinv_get_option( 'validate_vat_number' );
331
-	return ! empty( $validate );
331
+    return ! empty( $validate );
332 332
 }
333 333
 
334 334
 function wpinv_sales_tax_for_year( $year = null ) {
Please login to merge, or discard this patch.
Spacing   +120 added lines, -120 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 : false;
23
+function getpaid_is_eu_state($country) {
24
+    return !empty($country) && in_array(strtoupper($country), getpaid_get_eu_states()) ? 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 : false;
41
+function getpaid_is_gst_country($country) {
42
+    return !empty($country) && in_array(strtoupper($country), getpaid_get_gst_states()) ? 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
 
@@ -94,8 +94,8 @@  discard block
 block discarded – undo
94 94
  * @return bool
95 95
  */
96 96
 function wpinv_use_store_address_as_tax_base() {
97
-    $use_base = wpinv_get_option( 'tax_base', 'billing' ) == 'base';
98
-    return (bool) apply_filters( 'wpinv_use_store_address_as_tax_base', $use_base );
97
+    $use_base = wpinv_get_option('tax_base', 'billing') == 'base';
98
+    return (bool) apply_filters('wpinv_use_store_address_as_tax_base', $use_base);
99 99
 }
100 100
 
101 101
 /**
@@ -104,8 +104,8 @@  discard block
 block discarded – undo
104 104
  * @return bool
105 105
  */
106 106
 function wpinv_prices_include_tax() {
107
-    $is_inclusive = wpinv_get_option( 'prices_include_tax', 'no' ) == 'yes';
108
-    return (bool) apply_filters( 'wpinv_prices_include_tax', $is_inclusive );
107
+    $is_inclusive = wpinv_get_option('prices_include_tax', 'no') == 'yes';
108
+    return (bool) apply_filters('wpinv_prices_include_tax', $is_inclusive);
109 109
 }
110 110
 
111 111
 /**
@@ -114,8 +114,8 @@  discard block
 block discarded – undo
114 114
  * @return bool
115 115
  */
116 116
 function wpinv_round_tax_per_tax_rate() {
117
-    $subtotal_rounding = wpinv_get_option( 'tax_subtotal_rounding', 1 );
118
-    return (bool) apply_filters( 'wpinv_round_tax_per_tax_rate', empty( $subtotal_rounding ) );
117
+    $subtotal_rounding = wpinv_get_option('tax_subtotal_rounding', 1);
118
+    return (bool) apply_filters('wpinv_round_tax_per_tax_rate', empty($subtotal_rounding));
119 119
 }
120 120
 
121 121
 /**
@@ -124,8 +124,8 @@  discard block
 block discarded – undo
124 124
  * @return bool
125 125
  */
126 126
 function wpinv_display_individual_tax_rates() {
127
-    $individual = wpinv_get_option( 'tax_display_totals', 'single' ) == 'individual';
128
-    return (bool) apply_filters( 'wpinv_display_individual_tax_rates', $individual );
127
+    $individual = wpinv_get_option('tax_display_totals', 'single') == 'individual';
128
+    return (bool) apply_filters('wpinv_display_individual_tax_rates', $individual);
129 129
 }
130 130
 
131 131
 /**
@@ -134,8 +134,8 @@  discard block
 block discarded – undo
134 134
  * @return float
135 135
  */
136 136
 function wpinv_get_default_tax_rate() {
137
-    $rate = wpinv_get_option( 'tax_rate', 0 );
138
-    return (float) apply_filters( 'wpinv_get_default_tax_rate', floatval( $rate ) );
137
+    $rate = wpinv_get_option('tax_rate', 0);
138
+    return (float) apply_filters('wpinv_get_default_tax_rate', floatval($rate));
139 139
 }
140 140
 
141 141
 /**
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
  * @return bool
145 145
  */
146 146
 function wpinv_same_country_exempt_vat() {
147
-    return 'no' == wpinv_get_option( 'vat_same_country_rule', 'vat_too' );
147
+    return 'no' == wpinv_get_option('vat_same_country_rule', 'vat_too');
148 148
 }
149 149
 
150 150
 /**
@@ -164,28 +164,28 @@  discard block
 block discarded – undo
164 164
  * @param string $state
165 165
  * @return array
166 166
  */
167
-function getpaid_get_item_tax_rates( $item, $country = '', $state = '' ) {
167
+function getpaid_get_item_tax_rates($item, $country = '', $state = '') {
168 168
 
169 169
     // Abort if the item is not taxable.
170
-    if ( ! wpinv_is_item_taxable( $item ) ) {
170
+    if (!wpinv_is_item_taxable($item)) {
171 171
         return array();
172 172
     }
173 173
 
174 174
     // Maybe use the store address.
175
-    if ( wpinv_use_store_address_as_tax_base() ) {
175
+    if (wpinv_use_store_address_as_tax_base()) {
176 176
         $country = wpinv_get_default_country();
177 177
         $state   = wpinv_get_default_state();
178 178
     }
179 179
 
180 180
     // Retrieve tax rates.
181
-    $tax_rates = GetPaid_Tax::get_address_tax_rates( $country, $state );
181
+    $tax_rates = GetPaid_Tax::get_address_tax_rates($country, $state);
182 182
 
183 183
     // Fallback to the default tax rates if non were found.
184
-    if ( empty( $tax_rates ) ) {
184
+    if (empty($tax_rates)) {
185 185
         $tax_rates = GetPaid_Tax::get_default_tax_rates();
186 186
     }
187 187
 
188
-    return apply_filters( 'getpaid_get_item_tax_rates', $tax_rates, $item, $country, $state );
188
+    return apply_filters('getpaid_get_item_tax_rates', $tax_rates, $item, $country, $state);
189 189
 }
190 190
 
191 191
 /**
@@ -195,23 +195,23 @@  discard block
 block discarded – undo
195 195
  * @param array $rates
196 196
  * @return array
197 197
  */
198
-function getpaid_filter_item_tax_rates( $item, $rates ) {
198
+function getpaid_filter_item_tax_rates($item, $rates) {
199 199
 
200 200
     $tax_class = $item->get_vat_class();
201 201
 
202
-    foreach ( $rates as $i => $rate ) {
202
+    foreach ($rates as $i => $rate) {
203 203
 
204
-        if ( $tax_class == '_reduced' ) {
205
-            $rates[ $i ]['rate'] = empty( $rate['reduced_rate'] ) ? 0 : $rate['reduced_rate'];
204
+        if ($tax_class == '_reduced') {
205
+            $rates[$i]['rate'] = empty($rate['reduced_rate']) ? 0 : $rate['reduced_rate'];
206 206
         }
207 207
 
208
-        if ( $tax_class == '_exempt' ) {
209
-            $rates[ $i ]['rate'] = 0;
208
+        if ($tax_class == '_exempt') {
209
+            $rates[$i]['rate'] = 0;
210 210
         }
211 211
 
212 212
     }
213 213
 
214
-    return apply_filters( 'getpaid_filter_item_tax_rates', $rates, $item );
214
+    return apply_filters('getpaid_filter_item_tax_rates', $rates, $item);
215 215
 }
216 216
 
217 217
 /**
@@ -221,12 +221,12 @@  discard block
 block discarded – undo
221 221
  * @param array $rates
222 222
  * @return array
223 223
  */
224
-function getpaid_calculate_item_taxes( $amount, $rates ) {
224
+function getpaid_calculate_item_taxes($amount, $rates) {
225 225
 
226 226
     $is_inclusive = wpinv_prices_include_tax();
227
-    $taxes        = GetPaid_Tax::calc_tax( $amount, $rates, $is_inclusive );
227
+    $taxes        = GetPaid_Tax::calc_tax($amount, $rates, $is_inclusive);
228 228
 
229
-    return apply_filters( 'getpaid_calculate_taxes', $taxes, $amount, $rates );
229
+    return apply_filters('getpaid_calculate_taxes', $taxes, $amount, $rates);
230 230
 }
231 231
 
232 232
 /**
@@ -238,17 +238,17 @@  discard block
 block discarded – undo
238 238
  * @param float $recurring_tax_amount
239 239
  * @return array
240 240
  */
241
-function getpaid_prepare_item_tax( $item, $tax_name, $tax_amount, $recurring_tax_amount ) {
241
+function getpaid_prepare_item_tax($item, $tax_name, $tax_amount, $recurring_tax_amount) {
242 242
 
243
-    $initial_tax   = $tax_amount;
243
+    $initial_tax = $tax_amount;
244 244
 	$recurring_tax = 0;
245 245
 
246
-    if ( $item->is_recurring() ) {
246
+    if ($item->is_recurring()) {
247 247
 		$recurring_tax = $recurring_tax_amount;
248 248
 	}
249 249
 
250 250
 	return array(
251
-		'name'          => sanitize_text_field( $tax_name ),
251
+		'name'          => sanitize_text_field($tax_name),
252 252
 		'initial_tax'   => $initial_tax,
253 253
 		'recurring_tax' => $recurring_tax,
254 254
     );
@@ -261,8 +261,8 @@  discard block
 block discarded – undo
261 261
  * @param string $vat_number
262 262
  * @return string
263 263
  */
264
-function wpinv_sanitize_vat_number( $vat_number ) {
265
-    return str_replace( array(' ', '.', '-', '_', ',' ), '', strtoupper( trim( $vat_number ) ) );
264
+function wpinv_sanitize_vat_number($vat_number) {
265
+    return str_replace(array(' ', '.', '-', '_', ','), '', strtoupper(trim($vat_number)));
266 266
 }
267 267
 
268 268
 /**
@@ -271,22 +271,22 @@  discard block
 block discarded – undo
271 271
  * @param string $vat_number
272 272
  * @return bool
273 273
  */
274
-function wpinv_regex_validate_vat_number( $vat_number ) {
274
+function wpinv_regex_validate_vat_number($vat_number) {
275 275
 
276
-    $country    = substr( $vat_number, 0, 2 );
277
-    $vatin      = substr( $vat_number, 2 );
278
-    $regexes    = wpinv_get_data( 'vat-number-regexes' );
276
+    $country    = substr($vat_number, 0, 2);
277
+    $vatin      = substr($vat_number, 2);
278
+    $regexes    = wpinv_get_data('vat-number-regexes');
279 279
 
280
-    if ( isset( $regexes[ $country ] ) ) {
280
+    if (isset($regexes[$country])) {
281 281
 
282
-        $regex = $regexes[ $country ];
282
+        $regex = $regexes[$country];
283 283
         $regex = '/^(?:' . $regex . ')$/';
284
-        return 1 === preg_match( $regex, $vatin );
284
+        return 1 === preg_match($regex, $vatin);
285 285
 
286 286
     }
287 287
 
288 288
     // Not an EU state, use filters to validate the number.
289
-    return apply_filters( 'wpinv_regex_validate_vat_number', true, $vat_number );
289
+    return apply_filters('wpinv_regex_validate_vat_number', true, $vat_number);
290 290
 }
291 291
 
292 292
 /**
@@ -295,29 +295,29 @@  discard block
 block discarded – undo
295 295
  * @param string $vat_number
296 296
  * @return bool
297 297
  */
298
-function wpinv_vies_validate_vat_number( $vat_number ) {
298
+function wpinv_vies_validate_vat_number($vat_number) {
299 299
 
300
-    $country    = substr( $vat_number, 0, 2 );
301
-    $vatin      = substr( $vat_number, 2 );
300
+    $country    = substr($vat_number, 0, 2);
301
+    $vatin      = substr($vat_number, 2);
302 302
 
303 303
     $url        = add_query_arg(
304 304
         array(
305
-            'ms'  => urlencode( $country ),
306
-            'iso' => urlencode( $country ),
307
-            'vat' => urlencode( $vatin ),
305
+            'ms'  => urlencode($country),
306
+            'iso' => urlencode($country),
307
+            'vat' => urlencode($vatin),
308 308
         ),
309 309
         'http://ec.europa.eu/taxation_customs/vies/viesquer.do'
310 310
     );
311 311
 
312
-    $response   = wp_remote_get( $url );
313
-    $response   = wp_remote_retrieve_body( $response );
312
+    $response   = wp_remote_get($url);
313
+    $response   = wp_remote_retrieve_body($response);
314 314
 
315 315
     // Fallback gracefully if the VIES website is down.
316
-    if ( empty( $response ) ) {
316
+    if (empty($response)) {
317 317
         return true;
318 318
     }
319 319
 
320
-    return 1 !== preg_match( '/invalid VAT number/i', $response );
320
+    return 1 !== preg_match('/invalid VAT number/i', $response);
321 321
 
322 322
 }
323 323
 
@@ -328,18 +328,18 @@  discard block
 block discarded – undo
328 328
  * @param string $country
329 329
  * @return bool
330 330
  */
331
-function wpinv_validate_vat_number( $vat_number, $country ) {
331
+function wpinv_validate_vat_number($vat_number, $country) {
332 332
 
333 333
     // In case the vat number does not have a country code...
334
-    $vat_number = wpinv_sanitize_vat_number( $vat_number );
335
-    $_country   = substr( $vat_number, 0, 2 );
336
-    $_country   = $_country == wpinv_country_name( $_country );
334
+    $vat_number = wpinv_sanitize_vat_number($vat_number);
335
+    $_country   = substr($vat_number, 0, 2);
336
+    $_country   = $_country == wpinv_country_name($_country);
337 337
 
338
-    if ( $_country ) {
339
-        $vat_number = strtoupper( $country ) . $vat_number;
338
+    if ($_country) {
339
+        $vat_number = strtoupper($country) . $vat_number;
340 340
     }
341 341
 
342
-    return wpinv_regex_validate_vat_number( $vat_number ) && wpinv_vies_validate_vat_number( $vat_number );
342
+    return wpinv_regex_validate_vat_number($vat_number) && wpinv_vies_validate_vat_number($vat_number);
343 343
 }
344 344
 
345 345
 /**
@@ -348,40 +348,40 @@  discard block
 block discarded – undo
348 348
  * @return bool
349 349
  */
350 350
 function wpinv_should_validate_vat_number() {
351
-    $validate = wpinv_get_option( 'validate_vat_number' );
352
-	return ! empty( $validate );
351
+    $validate = wpinv_get_option('validate_vat_number');
352
+	return !empty($validate);
353 353
 }
354 354
 
355
-function wpinv_sales_tax_for_year( $year = null ) {
356
-    return wpinv_price( wpinv_get_sales_tax_for_year( $year ) );
355
+function wpinv_sales_tax_for_year($year = null) {
356
+    return wpinv_price(wpinv_get_sales_tax_for_year($year));
357 357
 }
358 358
 
359
-function wpinv_get_sales_tax_for_year( $year = null ) {
359
+function wpinv_get_sales_tax_for_year($year = null) {
360 360
     global $wpdb;
361 361
 
362 362
     // Start at zero
363 363
     $tax = 0;
364 364
 
365
-    if ( ! empty( $year ) ) {
365
+    if (!empty($year)) {
366 366
         $args = array(
367 367
             'post_type'      => 'wpi_invoice',
368
-            'post_status'    => array( 'publish' ),
368
+            'post_status'    => array('publish'),
369 369
             'posts_per_page' => -1,
370 370
             'year'           => $year,
371 371
             'fields'         => 'ids'
372 372
         );
373 373
 
374
-        $payments    = get_posts( $args );
375
-        $payment_ids = implode( ',', $payments );
374
+        $payments    = get_posts($args);
375
+        $payment_ids = implode(',', $payments);
376 376
 
377
-        if ( count( $payments ) > 0 ) {
377
+        if (count($payments) > 0) {
378 378
             $sql = "SELECT SUM( meta_value ) FROM $wpdb->postmeta WHERE meta_key = '_wpinv_tax' AND post_id IN( $payment_ids )";
379
-            $tax = $wpdb->get_var( $sql );
379
+            $tax = $wpdb->get_var($sql);
380 380
         }
381 381
 
382 382
     }
383 383
 
384
-    return apply_filters( 'wpinv_get_sales_tax_for_year', $tax, $year );
384
+    return apply_filters('wpinv_get_sales_tax_for_year', $tax, $year);
385 385
 }
386 386
 
387 387
 function wpinv_is_cart_taxed() {
@@ -390,33 +390,33 @@  discard block
 block discarded – undo
390 390
 
391 391
 function wpinv_prices_show_tax_on_checkout() {
392 392
     return false; // TODO
393
-    $ret = ( wpinv_get_option( 'checkout_include_tax', false ) == 'yes' && wpinv_use_taxes() );
393
+    $ret = (wpinv_get_option('checkout_include_tax', false) == 'yes' && wpinv_use_taxes());
394 394
 
395
-    return apply_filters( 'wpinv_taxes_on_prices_on_checkout', $ret );
395
+    return apply_filters('wpinv_taxes_on_prices_on_checkout', $ret);
396 396
 }
397 397
 
398 398
 function wpinv_display_tax_rate() {
399
-    $ret = wpinv_use_taxes() && wpinv_get_option( 'display_tax_rate', false );
399
+    $ret = wpinv_use_taxes() && wpinv_get_option('display_tax_rate', false);
400 400
 
401
-    return apply_filters( 'wpinv_display_tax_rate', $ret );
401
+    return apply_filters('wpinv_display_tax_rate', $ret);
402 402
 }
403 403
 
404 404
 function wpinv_cart_needs_tax_address_fields() {
405
-    if( !wpinv_is_cart_taxed() )
405
+    if (!wpinv_is_cart_taxed())
406 406
         return false;
407 407
 
408
-    return ! did_action( 'wpinv_after_cc_fields', 'wpinv_default_cc_address_fields' );
408
+    return !did_action('wpinv_after_cc_fields', 'wpinv_default_cc_address_fields');
409 409
 }
410 410
 
411
-function wpinv_item_is_tax_exclusive( $item_id = 0 ) {
412
-    $ret = (bool)get_post_meta( $item_id, '_wpinv_tax_exclusive', false );
413
-    return apply_filters( 'wpinv_is_tax_exclusive', $ret, $item_id );
411
+function wpinv_item_is_tax_exclusive($item_id = 0) {
412
+    $ret = (bool) get_post_meta($item_id, '_wpinv_tax_exclusive', false);
413
+    return apply_filters('wpinv_is_tax_exclusive', $ret, $item_id);
414 414
 }
415 415
 
416
-function wpinv_currency_decimal_filter( $decimals = 2 ) {
416
+function wpinv_currency_decimal_filter($decimals = 2) {
417 417
     $currency = wpinv_get_currency();
418 418
 
419
-    switch ( $currency ) {
419
+    switch ($currency) {
420 420
         case 'RIAL' :
421 421
         case 'JPY' :
422 422
         case 'TWD' :
@@ -425,13 +425,13 @@  discard block
 block discarded – undo
425 425
             break;
426 426
     }
427 427
 
428
-    return apply_filters( 'wpinv_currency_decimal_count', $decimals, $currency );
428
+    return apply_filters('wpinv_currency_decimal_count', $decimals, $currency);
429 429
 }
430 430
 
431 431
 function wpinv_tax_amount() {
432 432
     $output = 0.00;
433 433
     
434
-    return apply_filters( 'wpinv_tax_amount', $output );
434
+    return apply_filters('wpinv_tax_amount', $output);
435 435
 }
436 436
 
437 437
 /**
@@ -439,25 +439,25 @@  discard block
 block discarded – undo
439 439
  * 
440 440
  * @param string|bool|null $vat_rule
441 441
  */
442
-function getpaid_filter_vat_rule( $vat_rule ) {
442
+function getpaid_filter_vat_rule($vat_rule) {
443 443
 
444
-    if ( empty( $vat_rule ) ) {        
444
+    if (empty($vat_rule)) {        
445 445
         return 'digital';
446 446
     }
447 447
 
448 448
     return $vat_rule;
449 449
 }
450
-add_filter( 'wpinv_get_item_vat_rule', 'getpaid_filter_vat_rule' );
450
+add_filter('wpinv_get_item_vat_rule', 'getpaid_filter_vat_rule');
451 451
 
452 452
 /**
453 453
  * Filters the VAT class to ensure that each item has a VAT class.
454 454
  * 
455 455
  * @param string|bool|null $vat_rule
456 456
  */
457
-function getpaid_filter_vat_class( $vat_class ) {
458
-    return empty( $vat_class ) ? '_standard' : $vat_class;
457
+function getpaid_filter_vat_class($vat_class) {
458
+    return empty($vat_class) ? '_standard' : $vat_class;
459 459
 }
460
-add_filter( 'wpinv_get_item_vat_class', 'getpaid_filter_vat_class' );
460
+add_filter('wpinv_get_item_vat_class', 'getpaid_filter_vat_class');
461 461
 
462 462
 /**
463 463
  * Returns a list of all tax classes.
@@ -469,9 +469,9 @@  discard block
 block discarded – undo
469 469
     return apply_filters(
470 470
         'getpaid_tax_classes',
471 471
         array(
472
-            '_standard' => __( 'Standard Tax Rate', 'invoicing' ),
473
-            '_reduced'  => __( 'Reduced Tax Rate', 'invoicing' ),
474
-            '_exempt'   => __( 'Tax Exempt', 'invoicing' ),
472
+            '_standard' => __('Standard Tax Rate', 'invoicing'),
473
+            '_reduced'  => __('Reduced Tax Rate', 'invoicing'),
474
+            '_exempt'   => __('Tax Exempt', 'invoicing'),
475 475
         )
476 476
     );
477 477
 
@@ -487,8 +487,8 @@  discard block
 block discarded – undo
487 487
     return apply_filters(
488 488
         'getpaid_tax_rules',
489 489
         array(
490
-            'physical' => __( 'Physical Item', 'invoicing' ),
491
-            'digital'  => __( 'Digital Item', 'invoicing' ),
490
+            'physical' => __('Physical Item', 'invoicing'),
491
+            'digital'  => __('Digital Item', 'invoicing'),
492 492
         )
493 493
     );
494 494
 
@@ -500,15 +500,15 @@  discard block
 block discarded – undo
500 500
  * @param string $tax_class
501 501
  * @return string
502 502
  */
503
-function getpaid_get_tax_class_label( $tax_class ) {
503
+function getpaid_get_tax_class_label($tax_class) {
504 504
 
505 505
     $classes = getpaid_get_tax_classes();
506 506
 
507
-    if ( isset( $classes[ $tax_class ] ) ) {
508
-        return sanitize_text_field( $classes[ $tax_class ] );
507
+    if (isset($classes[$tax_class])) {
508
+        return sanitize_text_field($classes[$tax_class]);
509 509
     }
510 510
 
511
-    return sanitize_text_field( $tax_class );
511
+    return sanitize_text_field($tax_class);
512 512
 
513 513
 }
514 514
 
@@ -518,15 +518,15 @@  discard block
 block discarded – undo
518 518
  * @param string $tax_rule
519 519
  * @return string
520 520
  */
521
-function getpaid_get_tax_rule_label( $tax_rule ) {
521
+function getpaid_get_tax_rule_label($tax_rule) {
522 522
 
523 523
     $rules = getpaid_get_tax_rules();
524 524
 
525
-    if ( isset( $rules[ $tax_rule ] ) ) {
526
-        return sanitize_text_field( $rules[ $tax_rule ] );
525
+    if (isset($rules[$tax_rule])) {
526
+        return sanitize_text_field($rules[$tax_rule]);
527 527
     }
528 528
 
529
-    return sanitize_text_field( $tax_rule );
529
+    return sanitize_text_field($tax_rule);
530 530
 
531 531
 }
532 532
 
@@ -537,11 +537,11 @@  discard block
 block discarded – undo
537 537
  * @param string $recurring
538 538
  * @return string
539 539
  */
540
-function getpaid_get_taxable_amount( $item, $recurring = false ) {
540
+function getpaid_get_taxable_amount($item, $recurring = false) {
541 541
 
542 542
     $taxable_amount  = $recurring ? $item->get_recurring_sub_total() : $item->get_sub_total();
543 543
     $taxable_amount -= $recurring ? $item->recurring_item_discount : $item->item_discount;
544
-    $taxable_amount  = max( 0, $taxable_amount );
545
-    return apply_filters( 'getpaid_taxable_amount', $taxable_amount, $item, $recurring );
544
+    $taxable_amount  = max(0, $taxable_amount);
545
+    return apply_filters('getpaid_taxable_amount', $taxable_amount, $item, $recurring);
546 546
 
547 547
 }
Please login to merge, or discard this patch.
includes/reports/class-getpaid-invoice-exporter.php 2 patches
Indentation   +189 added lines, -189 removed lines patch added patch discarded remove patch
@@ -12,194 +12,194 @@
 block discarded – undo
12 12
  */
13 13
 class GetPaid_Invoice_Exporter extends GetPaid_Graph_Downloader {
14 14
 
15
-	/**
16
-	 * Retrieves invoices query args.
17
-	 * 
18
-	 * @param string $post_type post type to retrieve.
19
-	 * @param array $args Args to search for.
20
-	 * @return array
21
-	 */
22
-	public function get_invoice_query_args( $post_type, $args ) {
23
-
24
-		$query_args = array(
25
-			'post_type'              => $post_type,
26
-			'post_status'            => array_keys( wpinv_get_invoice_statuses( true, false, $post_type ) ),
27
-			'posts_per_page'         => -1,
28
-			'no_found_rows'          => true,
29
-			'update_post_term_cache' => false,
30
-			'fields'                 => 'ids',
31
-		);
32
-
33
-		if ( ! empty( $args['status'] ) && in_array( $args['status'], $query_args['post_status'], true ) ) {
34
-			$query_args['post_status'] = wpinv_clean( wpinv_parse_list( $args['status'] ) );
35
-		}
36
-
37
-		$date_query = array();
38
-		if ( ! empty( $args['to_date'] ) ) {
39
-			$date_query['before'] = wpinv_clean( $args['to_date'] );
40
-		}
41
-
42
-		if ( ! empty( $args['from_date'] ) ) {
43
-			$date_query['after'] = wpinv_clean( $args['from_date'] );
44
-		}
45
-
46
-		if ( ! empty( $date_query ) ) {
47
-			$date_query['inclusive']  = true;
48
-			$query_args['date_query'] = array( $date_query );
49
-		}
50
-
51
-		return $query_args;
52
-	}
53
-
54
-	/**
55
-	 * Retrieves invoices.
56
-	 * 
57
-	 * @param array $query_args WP_Query args.
58
-	 * @return WPInv_Invoice[]
59
-	 */
60
-	public function get_invoices( $query_args ) {
61
-
62
-		// Get invoices.
63
-		$invoices = new WP_Query( $query_args );
64
-
65
-		// Prepare the results.
66
-		return array_map( 'wpinv_get_invoice', $invoices->posts );
67
-
68
-	}
69
-
70
-	/**
71
-	 * Handles the actual download.
72
-	 *
73
-	 */
74
-	public function export( $post_type, $args ) {
75
-
76
-		$invoices  = $this->get_invoices( $this->get_invoice_query_args( $post_type, $args ) );
77
-		$stream    = $this->prepare_output();
78
-		$headers   = $this->get_export_fields( $post_type );
79
-		$file_type = $this->prepare_file_type( strtolower( getpaid_get_post_type_label( $post_type ) ) );
80
-
81
-		if ( 'csv' == $file_type ) {
82
-			$this->download_csv( $invoices, $stream, $headers );
83
-		} else if( 'xml' == $file_type ) {
84
-			$this->download_xml( $invoices, $stream, $headers );
85
-		} else {
86
-			$this->download_json( $invoices, $stream, $headers );
87
-		}
88
-
89
-		fclose( $stream );
90
-		exit;
91
-	}
92
-
93
-	/**
94
-	 * Prepares a single invoice for download.
95
-	 *
96
-	 * @param WPInv_Invoice $invoice The invoice to prepare..
97
-	 * @param array $fields The fields to stream.
98
-	 * @since       1.0.19
99
-	 * @return array
100
-	 */
101
-	public function prepare_row( $invoice, $fields ) {
102
-
103
-		$prepared      = array();
104
-		$amount_fields = $this->get_amount_fields( $invoice->get_post_type() );
105
-
106
-		foreach ( $fields as $field ) {
107
-
108
-			$value  = '';
109
-			$method = "get_$field";
110
-
111
-			if ( method_exists( $invoice, $method ) ) {
112
-				$value  = $invoice->$method();
113
-			}
114
-
115
-			if ( in_array( $field, $amount_fields ) ) {
116
-				$value  = wpinv_round_amount( wpinv_sanitize_amount( $value ) );
117
-			}
118
-
119
-			$prepared[ $field ] = wpinv_clean( $value );
120
-
121
-		}
122
-
123
-		return $prepared;
124
-	}
125
-
126
-	/**
127
-	 * Retrieves export fields.
128
-	 *
129
-	 * @param string $post_type
130
-	 * @since       1.0.19
131
-	 * @return array
132
-	 */
133
-	public function get_export_fields( $post_type ) {
134
-
135
-		$fields = array(
136
-			'id',
137
-			'parent_id',
138
-			'status',
139
-			'date_created',
140
-			'date_modified',
141
-			'date_due',
142
-			'date_completed',
143
-			'number',
144
-			'key',
145
-			'description',
146
-			'post_type',
147
-			'mode',
148
-			'customer_id',
149
-			'customer_first_name',
150
-			'customer_last_name',
151
-			'customer_phone',
152
-			'customer_email',
153
-			'customer_country',
154
-			'customer_city',
155
-			'customer_state',
156
-			'customer_zip',
157
-			'customer_company',
158
-			'customer_vat_number',
159
-			'customer_address',
160
-			'subtotal',
161
-			'total_discount',
162
-			'total_tax',
163
-			'total_fees',
164
-			'fees',
165
-			'discounts',
166
-			'taxes',
167
-			'cart_details',
168
-			'item_ids',
169
-			'payment_form',
170
-			'discount_code',
171
-			'gateway',
172
-			'transaction_id',
173
-			'currency',
174
-			'disable_taxes',
175
-			'subscription_id',
176
-			'remote_subscription_id',
177
-			'is_viewed',
178
-			'email_cc',
179
-			'template',
180
-			'created_via'
181
-    	);
182
-
183
-		return apply_filters( 'getpaid_invoice_exporter_get_fields', $fields, $post_type );
184
-	}
185
-
186
-	/**
187
-	 * Retrieves amount fields.
188
-	 *
189
-	 * @param string $post_type
190
-	 * @since       1.0.19
191
-	 * @return array
192
-	 */
193
-	public function get_amount_fields( $post_type ) {
194
-
195
-		$fields = array(
196
-			'subtotal',
197
-			'total_discount',
198
-			'total_tax',
199
-			'total_fees'
200
-    	);
201
-
202
-		return apply_filters( 'getpaid_invoice_exporter_get_amount_fields', $fields, $post_type );
203
-	}
15
+    /**
16
+     * Retrieves invoices query args.
17
+     * 
18
+     * @param string $post_type post type to retrieve.
19
+     * @param array $args Args to search for.
20
+     * @return array
21
+     */
22
+    public function get_invoice_query_args( $post_type, $args ) {
23
+
24
+        $query_args = array(
25
+            'post_type'              => $post_type,
26
+            'post_status'            => array_keys( wpinv_get_invoice_statuses( true, false, $post_type ) ),
27
+            'posts_per_page'         => -1,
28
+            'no_found_rows'          => true,
29
+            'update_post_term_cache' => false,
30
+            'fields'                 => 'ids',
31
+        );
32
+
33
+        if ( ! empty( $args['status'] ) && in_array( $args['status'], $query_args['post_status'], true ) ) {
34
+            $query_args['post_status'] = wpinv_clean( wpinv_parse_list( $args['status'] ) );
35
+        }
36
+
37
+        $date_query = array();
38
+        if ( ! empty( $args['to_date'] ) ) {
39
+            $date_query['before'] = wpinv_clean( $args['to_date'] );
40
+        }
41
+
42
+        if ( ! empty( $args['from_date'] ) ) {
43
+            $date_query['after'] = wpinv_clean( $args['from_date'] );
44
+        }
45
+
46
+        if ( ! empty( $date_query ) ) {
47
+            $date_query['inclusive']  = true;
48
+            $query_args['date_query'] = array( $date_query );
49
+        }
50
+
51
+        return $query_args;
52
+    }
53
+
54
+    /**
55
+     * Retrieves invoices.
56
+     * 
57
+     * @param array $query_args WP_Query args.
58
+     * @return WPInv_Invoice[]
59
+     */
60
+    public function get_invoices( $query_args ) {
61
+
62
+        // Get invoices.
63
+        $invoices = new WP_Query( $query_args );
64
+
65
+        // Prepare the results.
66
+        return array_map( 'wpinv_get_invoice', $invoices->posts );
67
+
68
+    }
69
+
70
+    /**
71
+     * Handles the actual download.
72
+     *
73
+     */
74
+    public function export( $post_type, $args ) {
75
+
76
+        $invoices  = $this->get_invoices( $this->get_invoice_query_args( $post_type, $args ) );
77
+        $stream    = $this->prepare_output();
78
+        $headers   = $this->get_export_fields( $post_type );
79
+        $file_type = $this->prepare_file_type( strtolower( getpaid_get_post_type_label( $post_type ) ) );
80
+
81
+        if ( 'csv' == $file_type ) {
82
+            $this->download_csv( $invoices, $stream, $headers );
83
+        } else if( 'xml' == $file_type ) {
84
+            $this->download_xml( $invoices, $stream, $headers );
85
+        } else {
86
+            $this->download_json( $invoices, $stream, $headers );
87
+        }
88
+
89
+        fclose( $stream );
90
+        exit;
91
+    }
92
+
93
+    /**
94
+     * Prepares a single invoice for download.
95
+     *
96
+     * @param WPInv_Invoice $invoice The invoice to prepare..
97
+     * @param array $fields The fields to stream.
98
+     * @since       1.0.19
99
+     * @return array
100
+     */
101
+    public function prepare_row( $invoice, $fields ) {
102
+
103
+        $prepared      = array();
104
+        $amount_fields = $this->get_amount_fields( $invoice->get_post_type() );
105
+
106
+        foreach ( $fields as $field ) {
107
+
108
+            $value  = '';
109
+            $method = "get_$field";
110
+
111
+            if ( method_exists( $invoice, $method ) ) {
112
+                $value  = $invoice->$method();
113
+            }
114
+
115
+            if ( in_array( $field, $amount_fields ) ) {
116
+                $value  = wpinv_round_amount( wpinv_sanitize_amount( $value ) );
117
+            }
118
+
119
+            $prepared[ $field ] = wpinv_clean( $value );
120
+
121
+        }
122
+
123
+        return $prepared;
124
+    }
125
+
126
+    /**
127
+     * Retrieves export fields.
128
+     *
129
+     * @param string $post_type
130
+     * @since       1.0.19
131
+     * @return array
132
+     */
133
+    public function get_export_fields( $post_type ) {
134
+
135
+        $fields = array(
136
+            'id',
137
+            'parent_id',
138
+            'status',
139
+            'date_created',
140
+            'date_modified',
141
+            'date_due',
142
+            'date_completed',
143
+            'number',
144
+            'key',
145
+            'description',
146
+            'post_type',
147
+            'mode',
148
+            'customer_id',
149
+            'customer_first_name',
150
+            'customer_last_name',
151
+            'customer_phone',
152
+            'customer_email',
153
+            'customer_country',
154
+            'customer_city',
155
+            'customer_state',
156
+            'customer_zip',
157
+            'customer_company',
158
+            'customer_vat_number',
159
+            'customer_address',
160
+            'subtotal',
161
+            'total_discount',
162
+            'total_tax',
163
+            'total_fees',
164
+            'fees',
165
+            'discounts',
166
+            'taxes',
167
+            'cart_details',
168
+            'item_ids',
169
+            'payment_form',
170
+            'discount_code',
171
+            'gateway',
172
+            'transaction_id',
173
+            'currency',
174
+            'disable_taxes',
175
+            'subscription_id',
176
+            'remote_subscription_id',
177
+            'is_viewed',
178
+            'email_cc',
179
+            'template',
180
+            'created_via'
181
+        );
182
+
183
+        return apply_filters( 'getpaid_invoice_exporter_get_fields', $fields, $post_type );
184
+    }
185
+
186
+    /**
187
+     * Retrieves amount fields.
188
+     *
189
+     * @param string $post_type
190
+     * @since       1.0.19
191
+     * @return array
192
+     */
193
+    public function get_amount_fields( $post_type ) {
194
+
195
+        $fields = array(
196
+            'subtotal',
197
+            'total_discount',
198
+            'total_tax',
199
+            'total_fees'
200
+        );
201
+
202
+        return apply_filters( 'getpaid_invoice_exporter_get_amount_fields', $fields, $post_type );
203
+    }
204 204
 
205 205
 }
Please login to merge, or discard this patch.
Spacing   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -5,7 +5,7 @@  discard block
 block discarded – undo
5 5
  *
6 6
  */
7 7
 
8
-defined( 'ABSPATH' ) || exit;
8
+defined('ABSPATH') || exit;
9 9
 
10 10
 /**
11 11
  * GetPaid_Invoice_Exporter Class.
@@ -19,33 +19,33 @@  discard block
 block discarded – undo
19 19
 	 * @param array $args Args to search for.
20 20
 	 * @return array
21 21
 	 */
22
-	public function get_invoice_query_args( $post_type, $args ) {
22
+	public function get_invoice_query_args($post_type, $args) {
23 23
 
24 24
 		$query_args = array(
25 25
 			'post_type'              => $post_type,
26
-			'post_status'            => array_keys( wpinv_get_invoice_statuses( true, false, $post_type ) ),
26
+			'post_status'            => array_keys(wpinv_get_invoice_statuses(true, false, $post_type)),
27 27
 			'posts_per_page'         => -1,
28 28
 			'no_found_rows'          => true,
29 29
 			'update_post_term_cache' => false,
30 30
 			'fields'                 => 'ids',
31 31
 		);
32 32
 
33
-		if ( ! empty( $args['status'] ) && in_array( $args['status'], $query_args['post_status'], true ) ) {
34
-			$query_args['post_status'] = wpinv_clean( wpinv_parse_list( $args['status'] ) );
33
+		if (!empty($args['status']) && in_array($args['status'], $query_args['post_status'], true)) {
34
+			$query_args['post_status'] = wpinv_clean(wpinv_parse_list($args['status']));
35 35
 		}
36 36
 
37 37
 		$date_query = array();
38
-		if ( ! empty( $args['to_date'] ) ) {
39
-			$date_query['before'] = wpinv_clean( $args['to_date'] );
38
+		if (!empty($args['to_date'])) {
39
+			$date_query['before'] = wpinv_clean($args['to_date']);
40 40
 		}
41 41
 
42
-		if ( ! empty( $args['from_date'] ) ) {
43
-			$date_query['after'] = wpinv_clean( $args['from_date'] );
42
+		if (!empty($args['from_date'])) {
43
+			$date_query['after'] = wpinv_clean($args['from_date']);
44 44
 		}
45 45
 
46
-		if ( ! empty( $date_query ) ) {
46
+		if (!empty($date_query)) {
47 47
 			$date_query['inclusive']  = true;
48
-			$query_args['date_query'] = array( $date_query );
48
+			$query_args['date_query'] = array($date_query);
49 49
 		}
50 50
 
51 51
 		return $query_args;
@@ -57,13 +57,13 @@  discard block
 block discarded – undo
57 57
 	 * @param array $query_args WP_Query args.
58 58
 	 * @return WPInv_Invoice[]
59 59
 	 */
60
-	public function get_invoices( $query_args ) {
60
+	public function get_invoices($query_args) {
61 61
 
62 62
 		// Get invoices.
63
-		$invoices = new WP_Query( $query_args );
63
+		$invoices = new WP_Query($query_args);
64 64
 
65 65
 		// Prepare the results.
66
-		return array_map( 'wpinv_get_invoice', $invoices->posts );
66
+		return array_map('wpinv_get_invoice', $invoices->posts);
67 67
 
68 68
 	}
69 69
 
@@ -71,22 +71,22 @@  discard block
 block discarded – undo
71 71
 	 * Handles the actual download.
72 72
 	 *
73 73
 	 */
74
-	public function export( $post_type, $args ) {
74
+	public function export($post_type, $args) {
75 75
 
76
-		$invoices  = $this->get_invoices( $this->get_invoice_query_args( $post_type, $args ) );
76
+		$invoices  = $this->get_invoices($this->get_invoice_query_args($post_type, $args));
77 77
 		$stream    = $this->prepare_output();
78
-		$headers   = $this->get_export_fields( $post_type );
79
-		$file_type = $this->prepare_file_type( strtolower( getpaid_get_post_type_label( $post_type ) ) );
78
+		$headers   = $this->get_export_fields($post_type);
79
+		$file_type = $this->prepare_file_type(strtolower(getpaid_get_post_type_label($post_type)));
80 80
 
81
-		if ( 'csv' == $file_type ) {
82
-			$this->download_csv( $invoices, $stream, $headers );
83
-		} else if( 'xml' == $file_type ) {
84
-			$this->download_xml( $invoices, $stream, $headers );
81
+		if ('csv' == $file_type) {
82
+			$this->download_csv($invoices, $stream, $headers);
83
+		} else if ('xml' == $file_type) {
84
+			$this->download_xml($invoices, $stream, $headers);
85 85
 		} else {
86
-			$this->download_json( $invoices, $stream, $headers );
86
+			$this->download_json($invoices, $stream, $headers);
87 87
 		}
88 88
 
89
-		fclose( $stream );
89
+		fclose($stream);
90 90
 		exit;
91 91
 	}
92 92
 
@@ -98,25 +98,25 @@  discard block
 block discarded – undo
98 98
 	 * @since       1.0.19
99 99
 	 * @return array
100 100
 	 */
101
-	public function prepare_row( $invoice, $fields ) {
101
+	public function prepare_row($invoice, $fields) {
102 102
 
103 103
 		$prepared      = array();
104
-		$amount_fields = $this->get_amount_fields( $invoice->get_post_type() );
104
+		$amount_fields = $this->get_amount_fields($invoice->get_post_type());
105 105
 
106
-		foreach ( $fields as $field ) {
106
+		foreach ($fields as $field) {
107 107
 
108 108
 			$value  = '';
109 109
 			$method = "get_$field";
110 110
 
111
-			if ( method_exists( $invoice, $method ) ) {
112
-				$value  = $invoice->$method();
111
+			if (method_exists($invoice, $method)) {
112
+				$value = $invoice->$method();
113 113
 			}
114 114
 
115
-			if ( in_array( $field, $amount_fields ) ) {
116
-				$value  = wpinv_round_amount( wpinv_sanitize_amount( $value ) );
115
+			if (in_array($field, $amount_fields)) {
116
+				$value = wpinv_round_amount(wpinv_sanitize_amount($value));
117 117
 			}
118 118
 
119
-			$prepared[ $field ] = wpinv_clean( $value );
119
+			$prepared[$field] = wpinv_clean($value);
120 120
 
121 121
 		}
122 122
 
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
 	 * @since       1.0.19
131 131
 	 * @return array
132 132
 	 */
133
-	public function get_export_fields( $post_type ) {
133
+	public function get_export_fields($post_type) {
134 134
 
135 135
 		$fields = array(
136 136
 			'id',
@@ -180,7 +180,7 @@  discard block
 block discarded – undo
180 180
 			'created_via'
181 181
     	);
182 182
 
183
-		return apply_filters( 'getpaid_invoice_exporter_get_fields', $fields, $post_type );
183
+		return apply_filters('getpaid_invoice_exporter_get_fields', $fields, $post_type);
184 184
 	}
185 185
 
186 186
 	/**
@@ -190,7 +190,7 @@  discard block
 block discarded – undo
190 190
 	 * @since       1.0.19
191 191
 	 * @return array
192 192
 	 */
193
-	public function get_amount_fields( $post_type ) {
193
+	public function get_amount_fields($post_type) {
194 194
 
195 195
 		$fields = array(
196 196
 			'subtotal',
@@ -199,7 +199,7 @@  discard block
 block discarded – undo
199 199
 			'total_fees'
200 200
     	);
201 201
 
202
-		return apply_filters( 'getpaid_invoice_exporter_get_amount_fields', $fields, $post_type );
202
+		return apply_filters('getpaid_invoice_exporter_get_amount_fields', $fields, $post_type);
203 203
 	}
204 204
 
205 205
 }
Please login to merge, or discard this patch.
includes/admin/views/html-tax-rates-edit.php 1 patch
Spacing   +20 added lines, -20 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
 $tax_rates  = GetPaid_Tax::get_all_tax_rates();
10 10
 $dummy_rate = array(
@@ -13,12 +13,12 @@  discard block
 block discarded – undo
13 13
     'global'       => true,
14 14
     'rate'         => wpinv_get_default_tax_rate(),
15 15
     'reduced_rate' => 5,
16
-    'name'         => __( 'VAT', 'invoicing' ),
16
+    'name'         => __('VAT', 'invoicing'),
17 17
 );
18 18
 
19 19
 $reset_url = esc_url(
20 20
     wp_nonce_url(
21
-        add_query_arg( 'getpaid-admin-action', 'reset_tax_rates' ),
21
+        add_query_arg('getpaid-admin-action', 'reset_tax_rates'),
22 22
         'getpaid-nonce',
23 23
         'getpaid-nonce'
24 24
     )
@@ -27,34 +27,34 @@  discard block
 block discarded – undo
27 27
 ?>
28 28
 <div class="table-responsive">
29 29
     <table id="wpinv_tax_rates" class="widefat fixed table">
30
-        <caption><?php echo esc_html_e( 'Enter tax rates for specific regions.', 'invoicing' ); ?></caption>
30
+        <caption><?php echo esc_html_e('Enter tax rates for specific regions.', 'invoicing'); ?></caption>
31 31
 
32 32
         <thead>
33 33
             <tr class="table-light">
34 34
 
35 35
                 <th scope="col" class="border-bottom border-top">
36
-                    <?php _e( 'Country', 'invoicing' ); ?>
37
-                    <?php echo getpaid_get_help_tip( __( 'Optionally limit this tax rate to a specific country.', 'invoicing' ), 'position-static' ); ?>
36
+                    <?php _e('Country', 'invoicing'); ?>
37
+                    <?php echo getpaid_get_help_tip(__('Optionally limit this tax rate to a specific country.', 'invoicing'), 'position-static'); ?>
38 38
                 </th>
39 39
 
40 40
                 <th scope="col" class="border-bottom border-top">
41
-                    <?php _e( 'State', 'invoicing' ); ?>
42
-                    <?php echo getpaid_get_help_tip( __( 'Separate state codes using a comma or leave blank to apply country wide.', 'invoicing' ), 'position-static' ); ?>
41
+                    <?php _e('State', 'invoicing'); ?>
42
+                    <?php echo getpaid_get_help_tip(__('Separate state codes using a comma or leave blank to apply country wide.', 'invoicing'), 'position-static'); ?>
43 43
                 </th>
44 44
 
45 45
                 <th scope="col" class="border-bottom border-top">
46
-                    <?php _e( 'Standard Rate %', 'invoicing' ); ?>
47
-                    <?php echo getpaid_get_help_tip( __( 'The tax rate (percentage) to charge on items that use the "Standard rate" tax class.', 'invoicing' ), 'position-static' ); ?>
46
+                    <?php _e('Standard Rate %', 'invoicing'); ?>
47
+                    <?php echo getpaid_get_help_tip(__('The tax rate (percentage) to charge on items that use the "Standard rate" tax class.', 'invoicing'), 'position-static'); ?>
48 48
                 </th>
49 49
 
50 50
                 <th scope="col" class="border-bottom border-top">
51
-                    <?php _e( 'Reduced Rate %', 'invoicing' ); ?>
52
-                    <?php echo getpaid_get_help_tip( __( 'The tax rate (percentage) to charge on items that use the "Reduced rate" tax class.', 'invoicing' ), 'position-static' ); ?>
51
+                    <?php _e('Reduced Rate %', 'invoicing'); ?>
52
+                    <?php echo getpaid_get_help_tip(__('The tax rate (percentage) to charge on items that use the "Reduced rate" tax class.', 'invoicing'), 'position-static'); ?>
53 53
                 </th>
54 54
 
55 55
                 <th scope="col" class="border-bottom border-top">
56
-                    <?php _e( 'Tax Name', 'invoicing' ); ?>
57
-                    <?php echo getpaid_get_help_tip( __( 'The name of this tax, e.g VAT.', 'invoicing' ), 'position-static' ); ?>
56
+                    <?php _e('Tax Name', 'invoicing'); ?>
57
+                    <?php echo getpaid_get_help_tip(__('The name of this tax, e.g VAT.', 'invoicing'), 'position-static'); ?>
58 58
                 </th>
59 59
 
60 60
                 <th scope="col" class="border-bottom border-top" style="width:32px">&nbsp;</th>
@@ -63,19 +63,19 @@  discard block
 block discarded – undo
63 63
         </thead>
64 64
 
65 65
         <tbody>
66
-            <?php array_walk( $tax_rates, 'wpinv_tax_rate_callback' ); ?>
66
+            <?php array_walk($tax_rates, 'wpinv_tax_rate_callback'); ?>
67 67
         </tbody>
68 68
 
69 69
         <tfoot>
70 70
             <tr class="table-light">
71 71
                 <td colspan="6" class="border-top">
72 72
 
73
-                    <button type="button" class="button button-secondary wpinv_add_tax_rate" aria-label="<?php esc_attr_e( 'Add Tax Rate', 'invoicing' ); ?>">
74
-                        <span><?php _e( 'Add Tax Rate', 'invoicing' ); ?></span>
73
+                    <button type="button" class="button button-secondary wpinv_add_tax_rate" aria-label="<?php esc_attr_e('Add Tax Rate', 'invoicing'); ?>">
74
+                        <span><?php _e('Add Tax Rate', 'invoicing'); ?></span>
75 75
                     </button>
76 76
 
77
-                    <a href="<?php echo $reset_url; ?>" class="button button-secondary wpinv_reset_tax_rates" aria-label="<?php esc_attr_e( 'Reset Tax Rates', 'invoicing' ); ?>">
78
-                        <span><?php _e( 'Reset Tax Rates', 'invoicing' ); ?></span>
77
+                    <a href="<?php echo $reset_url; ?>" class="button button-secondary wpinv_reset_tax_rates" aria-label="<?php esc_attr_e('Reset Tax Rates', 'invoicing'); ?>">
78
+                        <span><?php _e('Reset Tax Rates', 'invoicing'); ?></span>
79 79
                     </a>
80 80
                 </td>
81 81
             </tr>
@@ -84,6 +84,6 @@  discard block
 block discarded – undo
84 84
 </div>
85 85
 
86 86
 <script type="text/html" id="tmpl-wpinv-tax-rate-row">
87
-    <?php echo wpinv_tax_rate_callback( $dummy_rate, 0, false ); ?>
87
+    <?php echo wpinv_tax_rate_callback($dummy_rate, 0, false); ?>
88 88
 </script>
89 89
 
Please login to merge, or discard this patch.
includes/class-wpinv-subscriptions-db.php 1 patch
Spacing   +10 added lines, -10 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
  * The Subscriptions DB Class
@@ -72,8 +72,8 @@  discard block
 block discarded – undo
72 72
             'transaction_id'    => '',
73 73
             'parent_payment_id' => 0,
74 74
             'product_id'        => 0,
75
-            'created'           => date( 'Y-m-d H:i:s' ),
76
-            'expiration'        => date( 'Y-m-d H:i:s' ),
75
+            'created'           => date('Y-m-d H:i:s'),
76
+            'expiration'        => date('Y-m-d H:i:s'),
77 77
             'trial_period'      => '',
78 78
             'status'            => '',
79 79
             'profile_id'        => '',
@@ -86,8 +86,8 @@  discard block
 block discarded – undo
86 86
      * @access  public
87 87
      * @since   1.0.0
88 88
      */
89
-    public function get_subscriptions( $args = array() ) {
90
-        return getpaid_get_subscriptions( $args );
89
+    public function get_subscriptions($args = array()) {
90
+        return getpaid_get_subscriptions($args);
91 91
     }
92 92
 
93 93
     /**
@@ -96,8 +96,8 @@  discard block
 block discarded – undo
96 96
      * @access  public
97 97
      * @since   1.0.0
98 98
      */
99
-    public function count( $args = array() ) {
100
-        return getpaid_get_subscriptions( $args, 'count' );
99
+    public function count($args = array()) {
100
+        return getpaid_get_subscriptions($args, 'count');
101 101
     }
102 102
 
103 103
     /**
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
      */
109 109
     public function create_table() {
110 110
 
111
-        require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
111
+        require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
112 112
 
113 113
         $sql = "CREATE TABLE " . $this->table_name . " (
114 114
         id bigint(20) NOT NULL AUTO_INCREMENT,
@@ -133,9 +133,9 @@  discard block
 block discarded – undo
133 133
         KEY customer_and_status ( customer_id, status)
134 134
         ) CHARACTER SET utf8 COLLATE utf8_general_ci;";
135 135
 
136
-        dbDelta( $sql );
136
+        dbDelta($sql);
137 137
 
138
-        update_option( $this->table_name . '_db_version', $this->version );
138
+        update_option($this->table_name . '_db_version', $this->version);
139 139
     }
140 140
 
141 141
 }
142 142
\ No newline at end of file
Please login to merge, or discard this patch.
includes/admin/meta-boxes/class-getpaid-meta-box-item-vat.php 2 patches
Indentation   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
  */
9 9
 
10 10
 if ( ! defined( 'ABSPATH' ) ) {
11
-	exit; // Exit if accessed directly
11
+    exit; // Exit if accessed directly
12 12
 }
13 13
 
14 14
 /**
@@ -17,10 +17,10 @@  discard block
 block discarded – undo
17 17
 class GetPaid_Meta_Box_Item_VAT {
18 18
 
19 19
     /**
20
-	 * Output the metabox.
21
-	 *
22
-	 * @param WP_Post $post
23
-	 */
20
+     * Output the metabox.
21
+     *
22
+     * @param WP_Post $post
23
+     */
24 24
     public static function output( $post ) {
25 25
 
26 26
         // Prepare the item.
@@ -46,10 +46,10 @@  discard block
 block discarded – undo
46 46
     }
47 47
 
48 48
     /**
49
-	 * Output the VAT rules settings.
50
-	 *
51
-	 * @param WPInv_Item $item
52
-	 */
49
+     * Output the VAT rules settings.
50
+     *
51
+     * @param WPInv_Item $item
52
+     */
53 53
     public static function output_vat_rules( $item ) {
54 54
         ?>
55 55
 
@@ -87,10 +87,10 @@  discard block
 block discarded – undo
87 87
     }
88 88
 
89 89
     /**
90
-	 * Output the VAT class settings.
91
-	 *
92
-	 * @param WPInv_Item $item
93
-	 */
90
+     * Output the VAT class settings.
91
+     *
92
+     * @param WPInv_Item $item
93
+     */
94 94
     public static function output_vat_classes( $item ) {
95 95
         ?>
96 96
 
Please login to merge, or discard this patch.
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@  discard block
 block discarded – undo
7 7
  *
8 8
  */
9 9
 
10
-if ( ! defined( 'ABSPATH' ) ) {
10
+if (!defined('ABSPATH')) {
11 11
 	exit; // Exit if accessed directly
12 12
 }
13 13
 
@@ -21,26 +21,26 @@  discard block
 block discarded – undo
21 21
 	 *
22 22
 	 * @param WP_Post $post
23 23
 	 */
24
-    public static function output( $post ) {
24
+    public static function output($post) {
25 25
 
26 26
         // Prepare the item.
27
-        $item = new WPInv_Item( $post );
27
+        $item = new WPInv_Item($post);
28 28
 
29 29
         echo "<div class='bsui' style='max-width: 600px;padding-top: 10px;'>";
30 30
 
31
-        do_action( 'wpinv_item_before_vat_metabox', $item );
31
+        do_action('wpinv_item_before_vat_metabox', $item);
32 32
 
33 33
         // Output the vat rules settings.
34
-        do_action( 'wpinv_item_vat_metabox_before_vat_rules', $item );
35
-        self::output_vat_rules( $item );
36
-        do_action( 'wpinv_item_vat_metabox_vat_rules', $item );
34
+        do_action('wpinv_item_vat_metabox_before_vat_rules', $item);
35
+        self::output_vat_rules($item);
36
+        do_action('wpinv_item_vat_metabox_vat_rules', $item);
37 37
 
38 38
         // Output vat class settings.
39
-        do_action( 'wpinv_item_vat_metabox_before_vat_rules', $item );
40
-        self::output_vat_classes( $item );
41
-        do_action( 'wpinv_item_vat_metabox_vat_class', $item );
39
+        do_action('wpinv_item_vat_metabox_before_vat_rules', $item);
40
+        self::output_vat_classes($item);
41
+        do_action('wpinv_item_vat_metabox_vat_class', $item);
42 42
 
43
-        do_action( 'wpinv_item_vat_metabox', $item );
43
+        do_action('wpinv_item_vat_metabox', $item);
44 44
 
45 45
         echo '</div>';
46 46
     }
@@ -50,14 +50,14 @@  discard block
 block discarded – undo
50 50
 	 *
51 51
 	 * @param WPInv_Item $item
52 52
 	 */
53
-    public static function output_vat_rules( $item ) {
53
+    public static function output_vat_rules($item) {
54 54
         ?>
55 55
 
56 56
             <div class="wpinv_vat_rules">
57 57
 
58 58
                 <div class="form-group row">
59 59
                     <label for="wpinv_vat_rules" class="col-sm-3 col-form-label">
60
-                        <?php _e( 'Tax Rule', 'invoicing' );?>
60
+                        <?php _e('Tax Rule', 'invoicing'); ?>
61 61
                     </label>
62 62
                     <div class="col-sm-8">
63 63
                         <?php
@@ -65,8 +65,8 @@  discard block
 block discarded – undo
65 65
                                 array(
66 66
                                     'id'               => 'wpinv_vat_rules',
67 67
                                     'name'             => 'wpinv_vat_rules',
68
-                                    'placeholder'      => __( 'Select tax rule', 'invoicing' ),
69
-                                    'value'            => $item->get_vat_rule( 'edit' ),
68
+                                    'placeholder'      => __('Select tax rule', 'invoicing'),
69
+                                    'value'            => $item->get_vat_rule('edit'),
70 70
                                     'select2'          => true,
71 71
                                     'data-allow-clear' => 'false',
72 72
                                     'no_wrap'          => true,
@@ -88,14 +88,14 @@  discard block
 block discarded – undo
88 88
 	 *
89 89
 	 * @param WPInv_Item $item
90 90
 	 */
91
-    public static function output_vat_classes( $item ) {
91
+    public static function output_vat_classes($item) {
92 92
         ?>
93 93
 
94 94
             <div class="wpinv_vat_classes">
95 95
 
96 96
                 <div class="form-group row">
97 97
                     <label for="wpinv_vat_class" class="col-sm-3 col-form-label">
98
-                        <?php _e( 'Tax Class', 'invoicing' );?>
98
+                        <?php _e('Tax Class', 'invoicing'); ?>
99 99
                     </label>
100 100
                     <div class="col-sm-8">
101 101
                         <?php
@@ -103,8 +103,8 @@  discard block
 block discarded – undo
103 103
                                 array(
104 104
                                     'id'               => 'wpinv_vat_class',
105 105
                                     'name'             => 'wpinv_vat_class',
106
-                                    'placeholder'      => __( 'Select tax class', 'invoicing' ),
107
-                                    'value'            => $item->get_vat_class( 'edit' ),
106
+                                    'placeholder'      => __('Select tax class', 'invoicing'),
107
+                                    'value'            => $item->get_vat_class('edit'),
108 108
                                     'select2'          => true,
109 109
                                     'data-allow-clear' => 'false',
110 110
                                     'no_wrap'          => true,
Please login to merge, or discard this patch.
includes/class-wpinv-euvat.php 2 patches
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -55,27 +55,27 @@
 block discarded – undo
55 55
     public static function vat_rates_settings() {}
56 56
 
57 57
     /**
58
-	 *
59
-	 * @deprecated
60
-	 */
58
+     *
59
+     * @deprecated
60
+     */
61 61
     public static function vat_settings() {}
62 62
 
63 63
     /**
64
-	 *
65
-	 * @deprecated
66
-	 */
64
+     *
65
+     * @deprecated
66
+     */
67 67
     public static function maxmind_folder() {}
68 68
 
69 69
     /**
70
-	 *
71
-	 * @deprecated
72
-	 */
70
+     *
71
+     * @deprecated
72
+     */
73 73
     public static function geoip2_download_database() {}
74 74
 
75 75
     /**
76
-	 *
77
-	 * @deprecated
78
-	 */
76
+     *
77
+     * @deprecated
78
+     */
79 79
     public static function geoip2_download_file() {}
80 80
 
81 81
     /**
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 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
  * @deprecated
@@ -38,15 +38,15 @@  discard block
 block discarded – undo
38 38
     /**
39 39
      * @deprecated
40 40
      */
41
-    public static function is_eu_state( $country_code ) {
42
-        return getpaid_is_eu_state( $country_code );
41
+    public static function is_eu_state($country_code) {
42
+        return getpaid_is_eu_state($country_code);
43 43
     }
44 44
 
45 45
     /**
46 46
      * @deprecated
47 47
      */
48
-    public static function is_gst_country( $country_code ) {
49
-        return getpaid_is_gst_country( $country_code );
48
+    public static function is_gst_country($country_code) {
49
+        return getpaid_is_gst_country($country_code);
50 50
     }
51 51
 
52 52
     /**
Please login to merge, or discard this patch.
includes/data/eu-states.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@
 block discarded – undo
6 6
  * @version 1.0.19
7 7
  */
8 8
 
9
-defined( 'ABSPATH' ) || exit;
9
+defined('ABSPATH') || exit;
10 10
 
11 11
 return array(
12 12
 	'AT',
Please login to merge, or discard this patch.
Indentation   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -9,31 +9,31 @@
 block discarded – undo
9 9
 defined( 'ABSPATH' ) || exit;
10 10
 
11 11
 return array(
12
-	'AT',
13
-	'BE',
14
-	'BG',
15
-	'HR',
16
-	'CY',
17
-	'CZ',
18
-	'DK',
19
-	'EE',
20
-	'FI',
21
-	'FR',
22
-	'DE',
23
-	'GR',
24
-	'HU',
25
-	'IE',
26
-	'IT',
27
-	'LV',
28
-	'LT',
29
-	'LU',
30
-	'MT',
31
-	'NL',
32
-	'PL',
33
-	'PT',
34
-	'RO',
35
-	'SK',
36
-	'SI',
37
-	'ES',
38
-	'SE'
12
+    'AT',
13
+    'BE',
14
+    'BG',
15
+    'HR',
16
+    'CY',
17
+    'CZ',
18
+    'DK',
19
+    'EE',
20
+    'FI',
21
+    'FR',
22
+    'DE',
23
+    'GR',
24
+    'HU',
25
+    'IE',
26
+    'IT',
27
+    'LV',
28
+    'LT',
29
+    'LU',
30
+    'MT',
31
+    'NL',
32
+    'PL',
33
+    'PT',
34
+    'RO',
35
+    'SK',
36
+    'SI',
37
+    'ES',
38
+    'SE'
39 39
 );
Please login to merge, or discard this patch.
includes/data/item-schema.php 2 patches
Indentation   +228 added lines, -228 removed lines patch added patch discarded remove patch
@@ -13,233 +13,233 @@
 block discarded – undo
13 13
 
14 14
 return array(
15 15
 
16
-	'id'              => array(
17
-		'description' => __( 'Unique identifier for the item.', 'invoicing' ),
18
-		'type'        => 'integer',
19
-		'context'     => array( 'view', 'edit', 'embed' ),
20
-		'readonly'    => true,
21
-	),
22
-
23
-	'parent_id'       => array(
24
-		'description' => __( 'Parent item ID.', 'invoicing' ),
25
-		'type'        => 'integer',
26
-		'context'     => array( 'view', 'edit', 'embed' ),
27
-		'default'     => 0,
28
-	),
29
-
30
-	'status'          => array(
31
-		'description' => __( 'A named status for the item.', 'invoicing' ),
32
-		'type'        => 'string',
33
-		'enum'        => array( 'draft', 'pending', 'publish' ),
34
-		'context'     => array( 'view', 'edit', 'embed' ),
35
-		'default'     => 'draft',
36
-	),
37
-
38
-	'version'         => array(
39
-		'description' => __( 'Plugin version when the item was created.', 'invoicing' ),
40
-		'type'        => 'string',
41
-		'context'     => array( 'view', 'edit' ),
42
-		'readonly'    => true,
43
-	),
44
-
45
-	'date_created'    => array(
46
-		'description' => __( "The date the item was created, in the site's timezone.", 'invoicing' ),
47
-		'type'        => 'string',
48
-		'context'     => array( 'view', 'edit', 'embed' ),
49
-	),
50
-
51
-	'date_created_gmt'    => array(
52
-		'description' => __( 'The GMT date the item was created.', 'invoicing' ),
53
-		'type'        => 'string',
54
-		'context'     => array( 'view', 'edit', 'embed' ),
55
-		'readonly'    => true,
56
-	),
57
-
58
-	'date_modified'   => array(
59
-		'description' => __( "The date the item was last modified, in the site's timezone.", 'invoicing' ),
60
-		'type'        => 'string',
61
-		'context'     => array( 'view', 'edit', 'embed' ),
62
-		'readonly'    => true,
63
-	),
64
-
65
-	'date_modified_gmt'    => array(
66
-		'description' => __( 'The GMT date the item was last modified.', 'invoicing' ),
67
-		'type'        => 'string',
68
-		'context'     => array( 'view', 'edit', 'embed' ),
69
-		'readonly'    => true,
70
-	),
71
-
72
-	'name'			  => array(
73
-		'description' => __( "The item's name.", 'invoicing' ),
74
-		'type'        => 'string',
75
-		'context'     => array( 'view', 'edit', 'embed' ),
76
-		'required'    => true,
77
-	),
78
-
79
-	'description'     => array(
80
-		'description' => __( "The item's description.", 'invoicing' ),
81
-		'type'        => 'string',
82
-		'context'     => array( 'view', 'edit', 'embed' ),
83
-	),
84
-
85
-	'owner'           => array(
86
-		'description' => __( 'The owner of the item (user id).', 'invoicing' ),
87
-		'type'        => 'integer',
88
-		'context'     => array( 'view', 'edit', 'embed' ),
89
-	),
90
-
91
-	'price'           => array(
92
-		'description' => __( 'The price of the item.', 'invoicing' ),
93
-		'type'        => 'number',
94
-		'context'     => array( 'view', 'edit', 'embed' ),
95
-		'required'    => true,
96
-	),
97
-
98
-	'the_price'       => array(
99
-		'description' => __( 'The formatted price of the item.', 'invoicing' ),
100
-		'type'        => 'string',
101
-		'context'     => array( 'view', 'edit', 'embed' ),
102
-		'readonly'    => true,
103
-	),
104
-
105
-	'type'       => array(
106
-		'description' => __( 'The item type.', 'invoicing' ),
107
-		'type'        => 'string',
108
-		'enum'        => wpinv_item_types(),
109
-		'default'     => 'custom',
110
-		'context'     => array( 'view', 'edit', 'embed' ),
111
-	),
112
-
113
-	'vat_rule'       => array(
114
-		'description' => __( 'VAT rule applied to the item.', 'invoicing' ),
115
-		'type'        => 'string',
116
-		'enum'        => array_keys( getpaid_get_tax_rules() ),
117
-		'context'     => array( 'view', 'edit', 'embed' ),
118
-	),
119
-
120
-	'vat_class'       => array(
121
-		'description' => __( 'VAT class for the item.', 'invoicing' ),
122
-		'type'        => 'string',
123
-		'context'     => array( 'view', 'edit', 'embed' ),
124
-		'enum'        => array_keys( getpaid_get_tax_classes() ),
125
-	),
126
-
127
-	'custom_id'       => array(
128
-		'description' => __( 'Custom id for the item.', 'invoicing' ),
129
-		'type'        => 'string',
130
-		'context'     => array( 'view', 'edit', 'embed' ),
131
-	),
16
+    'id'              => array(
17
+        'description' => __( 'Unique identifier for the item.', 'invoicing' ),
18
+        'type'        => 'integer',
19
+        'context'     => array( 'view', 'edit', 'embed' ),
20
+        'readonly'    => true,
21
+    ),
22
+
23
+    'parent_id'       => array(
24
+        'description' => __( 'Parent item ID.', 'invoicing' ),
25
+        'type'        => 'integer',
26
+        'context'     => array( 'view', 'edit', 'embed' ),
27
+        'default'     => 0,
28
+    ),
29
+
30
+    'status'          => array(
31
+        'description' => __( 'A named status for the item.', 'invoicing' ),
32
+        'type'        => 'string',
33
+        'enum'        => array( 'draft', 'pending', 'publish' ),
34
+        'context'     => array( 'view', 'edit', 'embed' ),
35
+        'default'     => 'draft',
36
+    ),
37
+
38
+    'version'         => array(
39
+        'description' => __( 'Plugin version when the item was created.', 'invoicing' ),
40
+        'type'        => 'string',
41
+        'context'     => array( 'view', 'edit' ),
42
+        'readonly'    => true,
43
+    ),
44
+
45
+    'date_created'    => array(
46
+        'description' => __( "The date the item was created, in the site's timezone.", 'invoicing' ),
47
+        'type'        => 'string',
48
+        'context'     => array( 'view', 'edit', 'embed' ),
49
+    ),
50
+
51
+    'date_created_gmt'    => array(
52
+        'description' => __( 'The GMT date the item was created.', 'invoicing' ),
53
+        'type'        => 'string',
54
+        'context'     => array( 'view', 'edit', 'embed' ),
55
+        'readonly'    => true,
56
+    ),
57
+
58
+    'date_modified'   => array(
59
+        'description' => __( "The date the item was last modified, in the site's timezone.", 'invoicing' ),
60
+        'type'        => 'string',
61
+        'context'     => array( 'view', 'edit', 'embed' ),
62
+        'readonly'    => true,
63
+    ),
64
+
65
+    'date_modified_gmt'    => array(
66
+        'description' => __( 'The GMT date the item was last modified.', 'invoicing' ),
67
+        'type'        => 'string',
68
+        'context'     => array( 'view', 'edit', 'embed' ),
69
+        'readonly'    => true,
70
+    ),
71
+
72
+    'name'			  => array(
73
+        'description' => __( "The item's name.", 'invoicing' ),
74
+        'type'        => 'string',
75
+        'context'     => array( 'view', 'edit', 'embed' ),
76
+        'required'    => true,
77
+    ),
78
+
79
+    'description'     => array(
80
+        'description' => __( "The item's description.", 'invoicing' ),
81
+        'type'        => 'string',
82
+        'context'     => array( 'view', 'edit', 'embed' ),
83
+    ),
84
+
85
+    'owner'           => array(
86
+        'description' => __( 'The owner of the item (user id).', 'invoicing' ),
87
+        'type'        => 'integer',
88
+        'context'     => array( 'view', 'edit', 'embed' ),
89
+    ),
90
+
91
+    'price'           => array(
92
+        'description' => __( 'The price of the item.', 'invoicing' ),
93
+        'type'        => 'number',
94
+        'context'     => array( 'view', 'edit', 'embed' ),
95
+        'required'    => true,
96
+    ),
97
+
98
+    'the_price'       => array(
99
+        'description' => __( 'The formatted price of the item.', 'invoicing' ),
100
+        'type'        => 'string',
101
+        'context'     => array( 'view', 'edit', 'embed' ),
102
+        'readonly'    => true,
103
+    ),
104
+
105
+    'type'       => array(
106
+        'description' => __( 'The item type.', 'invoicing' ),
107
+        'type'        => 'string',
108
+        'enum'        => wpinv_item_types(),
109
+        'default'     => 'custom',
110
+        'context'     => array( 'view', 'edit', 'embed' ),
111
+    ),
112
+
113
+    'vat_rule'       => array(
114
+        'description' => __( 'VAT rule applied to the item.', 'invoicing' ),
115
+        'type'        => 'string',
116
+        'enum'        => array_keys( getpaid_get_tax_rules() ),
117
+        'context'     => array( 'view', 'edit', 'embed' ),
118
+    ),
119
+
120
+    'vat_class'       => array(
121
+        'description' => __( 'VAT class for the item.', 'invoicing' ),
122
+        'type'        => 'string',
123
+        'context'     => array( 'view', 'edit', 'embed' ),
124
+        'enum'        => array_keys( getpaid_get_tax_classes() ),
125
+    ),
126
+
127
+    'custom_id'       => array(
128
+        'description' => __( 'Custom id for the item.', 'invoicing' ),
129
+        'type'        => 'string',
130
+        'context'     => array( 'view', 'edit', 'embed' ),
131
+    ),
132 132
 	
133
-	'custom_name'       => array(
134
-		'description' => __( 'Custom name for the item.', 'invoicing' ),
135
-		'type'        => 'string',
136
-		'context'     => array( 'view', 'edit', 'embed' ),
137
-	),
138
-
139
-	'custom_singular_name'       => array(
140
-		'description' => __( 'Custom singular name for the item.', 'invoicing' ),
141
-		'type'        => 'string',
142
-		'context'     => array( 'view', 'edit', 'embed' ),
143
-	),
144
-
145
-	'is_dynamic_pricing'     => array(
146
-		'description' => __( 'Whether or not customers can enter their own prices when checking out.', 'invoicing' ),
147
-		'type'        => 'integer',
148
-		'enum'        => array( 0, 1 ),
149
-		'context'     => array( 'view', 'edit', 'embed' ),
150
-	),
151
-
152
-	'minimum_price'   => array(
153
-		'description' => __( 'For dynamic prices, this is the minimum price that a user can set.', 'invoicing' ),
154
-		'type'        => 'number',
155
-		'context'     => array( 'view', 'edit', 'embed' ),
156
-	),
157
-
158
-	'is_recurring'        => array(
159
-		'description' => __( 'Whether or not this is a subscription item.', 'invoicing' ),
160
-		'type'        => 'integer',
161
-		'enum'        => array( 0, 1 ),
162
-		'context'     => array( 'view', 'edit', 'embed' ),
163
-	),
164
-
165
-	'initial_price'   => array(
166
-		'description' => __( 'The initial price of the item.', 'invoicing' ),
167
-		'type'        => 'number',
168
-		'context'     => array( 'view', 'edit', 'embed' ),
169
-		'readonly'    => true,
170
-	),
171
-
172
-	'the_initial_price'       => array(
173
-		'description' => __( 'The formatted initial price of the item.', 'invoicing' ),
174
-		'type'        => 'string',
175
-		'context'     => array( 'view', 'edit', 'embed' ),
176
-		'readonly'    => true,
177
-	),
178
-
179
-	'recurring_price' => array(
180
-		'description' => __( 'The recurring price of the item.', 'invoicing' ),
181
-		'type'        => 'number',
182
-		'context'     => array( 'view', 'edit', 'embed' ),
183
-		'readonly'    => true,
184
-	),
185
-
186
-	'the_recurring_price'       => array(
187
-		'description' => __( 'The formatted recurring price of the item.', 'invoicing' ),
188
-		'type'        => 'string',
189
-		'context'     => array( 'view', 'edit', 'embed' ),
190
-		'readonly'    => true,
191
-	),
192
-
193
-	'recurring_period'        => array(
194
-		'description' => __( 'The recurring period for a recurring item.', 'invoicing' ),
195
-		'type'        => 'string',
196
-		'context'     => array( 'view', 'edit', 'embed' ),
197
-		'enum'        => array( 'D', 'W', 'M', 'Y' ),
198
-	),
199
-
200
-	'recurring_interval'        => array(
201
-		'description' => __( 'The recurring interval for a subscription item.', 'invoicing' ),
202
-		'type'        => 'integer',
203
-		'context'     => array( 'view', 'edit', 'embed' ),
204
-	),
205
-
206
-	'recurring_limit' => array(
207
-		'description' => __( 'The maximum number of renewals for a subscription item.', 'invoicing' ),
208
-		'type'        => 'integer',
209
-		'context'     => array( 'view', 'edit', 'embed' ),
210
-	),
211
-
212
-	'is_free_trial'   => array(
213
-		'description' => __( 'Whether the item has a free trial period.', 'invoicing' ),
214
-		'type'        => 'integer',
215
-		'enum'        => array( 0, 1 ),
216
-		'context'     => array( 'view', 'edit', 'embed' ),
217
-	),
218
-
219
-	'trial_period'    => array(
220
-		'description' => __( 'The trial period.', 'invoicing' ),
221
-		'type'        => 'string',
222
-		'context'     => array( 'view', 'edit', 'embed' ),
223
-		'enum'        => array( 'D', 'W', 'M', 'Y' ),
224
-	),
225
-
226
-	'trial_interval'  => array(
227
-		'description' => __( 'The trial interval.', 'invoicing' ),
228
-		'type'        => 'integer',
229
-		'context'     => array( 'view', 'edit', 'embed' ),
230
-	),
231
-
232
-	'first_renewal_date'       => array(
233
-		'description' => __( 'The first renewal date in case the item was to be bought today.', 'invoicing' ),
234
-		'type'        => 'string',
235
-		'context'     => array( 'view', 'edit', 'embed' ),
236
-		'readonly'    => true,
237
-	),
238
-
239
-	'edit_url'        => array(
240
-		'description' => __( 'The URL to edit an item.', 'invoicing' ),
241
-		'type'        => 'string',
242
-		'context'     => array( 'view', 'edit', 'embed' ),
243
-		'readonly'    => true,
244
-	),
133
+    'custom_name'       => array(
134
+        'description' => __( 'Custom name for the item.', 'invoicing' ),
135
+        'type'        => 'string',
136
+        'context'     => array( 'view', 'edit', 'embed' ),
137
+    ),
138
+
139
+    'custom_singular_name'       => array(
140
+        'description' => __( 'Custom singular name for the item.', 'invoicing' ),
141
+        'type'        => 'string',
142
+        'context'     => array( 'view', 'edit', 'embed' ),
143
+    ),
144
+
145
+    'is_dynamic_pricing'     => array(
146
+        'description' => __( 'Whether or not customers can enter their own prices when checking out.', 'invoicing' ),
147
+        'type'        => 'integer',
148
+        'enum'        => array( 0, 1 ),
149
+        'context'     => array( 'view', 'edit', 'embed' ),
150
+    ),
151
+
152
+    'minimum_price'   => array(
153
+        'description' => __( 'For dynamic prices, this is the minimum price that a user can set.', 'invoicing' ),
154
+        'type'        => 'number',
155
+        'context'     => array( 'view', 'edit', 'embed' ),
156
+    ),
157
+
158
+    'is_recurring'        => array(
159
+        'description' => __( 'Whether or not this is a subscription item.', 'invoicing' ),
160
+        'type'        => 'integer',
161
+        'enum'        => array( 0, 1 ),
162
+        'context'     => array( 'view', 'edit', 'embed' ),
163
+    ),
164
+
165
+    'initial_price'   => array(
166
+        'description' => __( 'The initial price of the item.', 'invoicing' ),
167
+        'type'        => 'number',
168
+        'context'     => array( 'view', 'edit', 'embed' ),
169
+        'readonly'    => true,
170
+    ),
171
+
172
+    'the_initial_price'       => array(
173
+        'description' => __( 'The formatted initial price of the item.', 'invoicing' ),
174
+        'type'        => 'string',
175
+        'context'     => array( 'view', 'edit', 'embed' ),
176
+        'readonly'    => true,
177
+    ),
178
+
179
+    'recurring_price' => array(
180
+        'description' => __( 'The recurring price of the item.', 'invoicing' ),
181
+        'type'        => 'number',
182
+        'context'     => array( 'view', 'edit', 'embed' ),
183
+        'readonly'    => true,
184
+    ),
185
+
186
+    'the_recurring_price'       => array(
187
+        'description' => __( 'The formatted recurring price of the item.', 'invoicing' ),
188
+        'type'        => 'string',
189
+        'context'     => array( 'view', 'edit', 'embed' ),
190
+        'readonly'    => true,
191
+    ),
192
+
193
+    'recurring_period'        => array(
194
+        'description' => __( 'The recurring period for a recurring item.', 'invoicing' ),
195
+        'type'        => 'string',
196
+        'context'     => array( 'view', 'edit', 'embed' ),
197
+        'enum'        => array( 'D', 'W', 'M', 'Y' ),
198
+    ),
199
+
200
+    'recurring_interval'        => array(
201
+        'description' => __( 'The recurring interval for a subscription item.', 'invoicing' ),
202
+        'type'        => 'integer',
203
+        'context'     => array( 'view', 'edit', 'embed' ),
204
+    ),
205
+
206
+    'recurring_limit' => array(
207
+        'description' => __( 'The maximum number of renewals for a subscription item.', 'invoicing' ),
208
+        'type'        => 'integer',
209
+        'context'     => array( 'view', 'edit', 'embed' ),
210
+    ),
211
+
212
+    'is_free_trial'   => array(
213
+        'description' => __( 'Whether the item has a free trial period.', 'invoicing' ),
214
+        'type'        => 'integer',
215
+        'enum'        => array( 0, 1 ),
216
+        'context'     => array( 'view', 'edit', 'embed' ),
217
+    ),
218
+
219
+    'trial_period'    => array(
220
+        'description' => __( 'The trial period.', 'invoicing' ),
221
+        'type'        => 'string',
222
+        'context'     => array( 'view', 'edit', 'embed' ),
223
+        'enum'        => array( 'D', 'W', 'M', 'Y' ),
224
+    ),
225
+
226
+    'trial_interval'  => array(
227
+        'description' => __( 'The trial interval.', 'invoicing' ),
228
+        'type'        => 'integer',
229
+        'context'     => array( 'view', 'edit', 'embed' ),
230
+    ),
231
+
232
+    'first_renewal_date'       => array(
233
+        'description' => __( 'The first renewal date in case the item was to be bought today.', 'invoicing' ),
234
+        'type'        => 'string',
235
+        'context'     => array( 'view', 'edit', 'embed' ),
236
+        'readonly'    => true,
237
+    ),
238
+
239
+    'edit_url'        => array(
240
+        'description' => __( 'The URL to edit an item.', 'invoicing' ),
241
+        'type'        => 'string',
242
+        'context'     => array( 'view', 'edit', 'embed' ),
243
+        'readonly'    => true,
244
+    ),
245 245
 );
Please login to merge, or discard this patch.
Spacing   +77 added lines, -77 removed lines patch added patch discarded remove patch
@@ -9,237 +9,237 @@
 block discarded – undo
9 9
  * @version 1.0.19
10 10
  */
11 11
 
12
-defined( 'ABSPATH' ) || exit;
12
+defined('ABSPATH') || exit;
13 13
 
14 14
 return array(
15 15
 
16 16
 	'id'              => array(
17
-		'description' => __( 'Unique identifier for the item.', 'invoicing' ),
17
+		'description' => __('Unique identifier for the item.', 'invoicing'),
18 18
 		'type'        => 'integer',
19
-		'context'     => array( 'view', 'edit', 'embed' ),
19
+		'context'     => array('view', 'edit', 'embed'),
20 20
 		'readonly'    => true,
21 21
 	),
22 22
 
23 23
 	'parent_id'       => array(
24
-		'description' => __( 'Parent item ID.', 'invoicing' ),
24
+		'description' => __('Parent item ID.', 'invoicing'),
25 25
 		'type'        => 'integer',
26
-		'context'     => array( 'view', 'edit', 'embed' ),
26
+		'context'     => array('view', 'edit', 'embed'),
27 27
 		'default'     => 0,
28 28
 	),
29 29
 
30 30
 	'status'          => array(
31
-		'description' => __( 'A named status for the item.', 'invoicing' ),
31
+		'description' => __('A named status for the item.', 'invoicing'),
32 32
 		'type'        => 'string',
33
-		'enum'        => array( 'draft', 'pending', 'publish' ),
34
-		'context'     => array( 'view', 'edit', 'embed' ),
33
+		'enum'        => array('draft', 'pending', 'publish'),
34
+		'context'     => array('view', 'edit', 'embed'),
35 35
 		'default'     => 'draft',
36 36
 	),
37 37
 
38 38
 	'version'         => array(
39
-		'description' => __( 'Plugin version when the item was created.', 'invoicing' ),
39
+		'description' => __('Plugin version when the item was created.', 'invoicing'),
40 40
 		'type'        => 'string',
41
-		'context'     => array( 'view', 'edit' ),
41
+		'context'     => array('view', 'edit'),
42 42
 		'readonly'    => true,
43 43
 	),
44 44
 
45 45
 	'date_created'    => array(
46
-		'description' => __( "The date the item was created, in the site's timezone.", 'invoicing' ),
46
+		'description' => __("The date the item was created, in the site's timezone.", 'invoicing'),
47 47
 		'type'        => 'string',
48
-		'context'     => array( 'view', 'edit', 'embed' ),
48
+		'context'     => array('view', 'edit', 'embed'),
49 49
 	),
50 50
 
51 51
 	'date_created_gmt'    => array(
52
-		'description' => __( 'The GMT date the item was created.', 'invoicing' ),
52
+		'description' => __('The GMT date the item was created.', 'invoicing'),
53 53
 		'type'        => 'string',
54
-		'context'     => array( 'view', 'edit', 'embed' ),
54
+		'context'     => array('view', 'edit', 'embed'),
55 55
 		'readonly'    => true,
56 56
 	),
57 57
 
58 58
 	'date_modified'   => array(
59
-		'description' => __( "The date the item was last modified, in the site's timezone.", 'invoicing' ),
59
+		'description' => __("The date the item was last modified, in the site's timezone.", 'invoicing'),
60 60
 		'type'        => 'string',
61
-		'context'     => array( 'view', 'edit', 'embed' ),
61
+		'context'     => array('view', 'edit', 'embed'),
62 62
 		'readonly'    => true,
63 63
 	),
64 64
 
65 65
 	'date_modified_gmt'    => array(
66
-		'description' => __( 'The GMT date the item was last modified.', 'invoicing' ),
66
+		'description' => __('The GMT date the item was last modified.', 'invoicing'),
67 67
 		'type'        => 'string',
68
-		'context'     => array( 'view', 'edit', 'embed' ),
68
+		'context'     => array('view', 'edit', 'embed'),
69 69
 		'readonly'    => true,
70 70
 	),
71 71
 
72 72
 	'name'			  => array(
73
-		'description' => __( "The item's name.", 'invoicing' ),
73
+		'description' => __("The item's name.", 'invoicing'),
74 74
 		'type'        => 'string',
75
-		'context'     => array( 'view', 'edit', 'embed' ),
75
+		'context'     => array('view', 'edit', 'embed'),
76 76
 		'required'    => true,
77 77
 	),
78 78
 
79 79
 	'description'     => array(
80
-		'description' => __( "The item's description.", 'invoicing' ),
80
+		'description' => __("The item's description.", 'invoicing'),
81 81
 		'type'        => 'string',
82
-		'context'     => array( 'view', 'edit', 'embed' ),
82
+		'context'     => array('view', 'edit', 'embed'),
83 83
 	),
84 84
 
85 85
 	'owner'           => array(
86
-		'description' => __( 'The owner of the item (user id).', 'invoicing' ),
86
+		'description' => __('The owner of the item (user id).', 'invoicing'),
87 87
 		'type'        => 'integer',
88
-		'context'     => array( 'view', 'edit', 'embed' ),
88
+		'context'     => array('view', 'edit', 'embed'),
89 89
 	),
90 90
 
91 91
 	'price'           => array(
92
-		'description' => __( 'The price of the item.', 'invoicing' ),
92
+		'description' => __('The price of the item.', 'invoicing'),
93 93
 		'type'        => 'number',
94
-		'context'     => array( 'view', 'edit', 'embed' ),
94
+		'context'     => array('view', 'edit', 'embed'),
95 95
 		'required'    => true,
96 96
 	),
97 97
 
98 98
 	'the_price'       => array(
99
-		'description' => __( 'The formatted price of the item.', 'invoicing' ),
99
+		'description' => __('The formatted price of the item.', 'invoicing'),
100 100
 		'type'        => 'string',
101
-		'context'     => array( 'view', 'edit', 'embed' ),
101
+		'context'     => array('view', 'edit', 'embed'),
102 102
 		'readonly'    => true,
103 103
 	),
104 104
 
105 105
 	'type'       => array(
106
-		'description' => __( 'The item type.', 'invoicing' ),
106
+		'description' => __('The item type.', 'invoicing'),
107 107
 		'type'        => 'string',
108 108
 		'enum'        => wpinv_item_types(),
109 109
 		'default'     => 'custom',
110
-		'context'     => array( 'view', 'edit', 'embed' ),
110
+		'context'     => array('view', 'edit', 'embed'),
111 111
 	),
112 112
 
113 113
 	'vat_rule'       => array(
114
-		'description' => __( 'VAT rule applied to the item.', 'invoicing' ),
114
+		'description' => __('VAT rule applied to the item.', 'invoicing'),
115 115
 		'type'        => 'string',
116
-		'enum'        => array_keys( getpaid_get_tax_rules() ),
117
-		'context'     => array( 'view', 'edit', 'embed' ),
116
+		'enum'        => array_keys(getpaid_get_tax_rules()),
117
+		'context'     => array('view', 'edit', 'embed'),
118 118
 	),
119 119
 
120 120
 	'vat_class'       => array(
121
-		'description' => __( 'VAT class for the item.', 'invoicing' ),
121
+		'description' => __('VAT class for the item.', 'invoicing'),
122 122
 		'type'        => 'string',
123
-		'context'     => array( 'view', 'edit', 'embed' ),
124
-		'enum'        => array_keys( getpaid_get_tax_classes() ),
123
+		'context'     => array('view', 'edit', 'embed'),
124
+		'enum'        => array_keys(getpaid_get_tax_classes()),
125 125
 	),
126 126
 
127 127
 	'custom_id'       => array(
128
-		'description' => __( 'Custom id for the item.', 'invoicing' ),
128
+		'description' => __('Custom id for the item.', 'invoicing'),
129 129
 		'type'        => 'string',
130
-		'context'     => array( 'view', 'edit', 'embed' ),
130
+		'context'     => array('view', 'edit', 'embed'),
131 131
 	),
132 132
 	
133 133
 	'custom_name'       => array(
134
-		'description' => __( 'Custom name for the item.', 'invoicing' ),
134
+		'description' => __('Custom name for the item.', 'invoicing'),
135 135
 		'type'        => 'string',
136
-		'context'     => array( 'view', 'edit', 'embed' ),
136
+		'context'     => array('view', 'edit', 'embed'),
137 137
 	),
138 138
 
139 139
 	'custom_singular_name'       => array(
140
-		'description' => __( 'Custom singular name for the item.', 'invoicing' ),
140
+		'description' => __('Custom singular name for the item.', 'invoicing'),
141 141
 		'type'        => 'string',
142
-		'context'     => array( 'view', 'edit', 'embed' ),
142
+		'context'     => array('view', 'edit', 'embed'),
143 143
 	),
144 144
 
145 145
 	'is_dynamic_pricing'     => array(
146
-		'description' => __( 'Whether or not customers can enter their own prices when checking out.', 'invoicing' ),
146
+		'description' => __('Whether or not customers can enter their own prices when checking out.', 'invoicing'),
147 147
 		'type'        => 'integer',
148
-		'enum'        => array( 0, 1 ),
149
-		'context'     => array( 'view', 'edit', 'embed' ),
148
+		'enum'        => array(0, 1),
149
+		'context'     => array('view', 'edit', 'embed'),
150 150
 	),
151 151
 
152 152
 	'minimum_price'   => array(
153
-		'description' => __( 'For dynamic prices, this is the minimum price that a user can set.', 'invoicing' ),
153
+		'description' => __('For dynamic prices, this is the minimum price that a user can set.', 'invoicing'),
154 154
 		'type'        => 'number',
155
-		'context'     => array( 'view', 'edit', 'embed' ),
155
+		'context'     => array('view', 'edit', 'embed'),
156 156
 	),
157 157
 
158 158
 	'is_recurring'        => array(
159
-		'description' => __( 'Whether or not this is a subscription item.', 'invoicing' ),
159
+		'description' => __('Whether or not this is a subscription item.', 'invoicing'),
160 160
 		'type'        => 'integer',
161
-		'enum'        => array( 0, 1 ),
162
-		'context'     => array( 'view', 'edit', 'embed' ),
161
+		'enum'        => array(0, 1),
162
+		'context'     => array('view', 'edit', 'embed'),
163 163
 	),
164 164
 
165 165
 	'initial_price'   => array(
166
-		'description' => __( 'The initial price of the item.', 'invoicing' ),
166
+		'description' => __('The initial price of the item.', 'invoicing'),
167 167
 		'type'        => 'number',
168
-		'context'     => array( 'view', 'edit', 'embed' ),
168
+		'context'     => array('view', 'edit', 'embed'),
169 169
 		'readonly'    => true,
170 170
 	),
171 171
 
172 172
 	'the_initial_price'       => array(
173
-		'description' => __( 'The formatted initial price of the item.', 'invoicing' ),
173
+		'description' => __('The formatted initial price of the item.', 'invoicing'),
174 174
 		'type'        => 'string',
175
-		'context'     => array( 'view', 'edit', 'embed' ),
175
+		'context'     => array('view', 'edit', 'embed'),
176 176
 		'readonly'    => true,
177 177
 	),
178 178
 
179 179
 	'recurring_price' => array(
180
-		'description' => __( 'The recurring price of the item.', 'invoicing' ),
180
+		'description' => __('The recurring price of the item.', 'invoicing'),
181 181
 		'type'        => 'number',
182
-		'context'     => array( 'view', 'edit', 'embed' ),
182
+		'context'     => array('view', 'edit', 'embed'),
183 183
 		'readonly'    => true,
184 184
 	),
185 185
 
186 186
 	'the_recurring_price'       => array(
187
-		'description' => __( 'The formatted recurring price of the item.', 'invoicing' ),
187
+		'description' => __('The formatted recurring price of the item.', 'invoicing'),
188 188
 		'type'        => 'string',
189
-		'context'     => array( 'view', 'edit', 'embed' ),
189
+		'context'     => array('view', 'edit', 'embed'),
190 190
 		'readonly'    => true,
191 191
 	),
192 192
 
193 193
 	'recurring_period'        => array(
194
-		'description' => __( 'The recurring period for a recurring item.', 'invoicing' ),
194
+		'description' => __('The recurring period for a recurring item.', 'invoicing'),
195 195
 		'type'        => 'string',
196
-		'context'     => array( 'view', 'edit', 'embed' ),
197
-		'enum'        => array( 'D', 'W', 'M', 'Y' ),
196
+		'context'     => array('view', 'edit', 'embed'),
197
+		'enum'        => array('D', 'W', 'M', 'Y'),
198 198
 	),
199 199
 
200 200
 	'recurring_interval'        => array(
201
-		'description' => __( 'The recurring interval for a subscription item.', 'invoicing' ),
201
+		'description' => __('The recurring interval for a subscription item.', 'invoicing'),
202 202
 		'type'        => 'integer',
203
-		'context'     => array( 'view', 'edit', 'embed' ),
203
+		'context'     => array('view', 'edit', 'embed'),
204 204
 	),
205 205
 
206 206
 	'recurring_limit' => array(
207
-		'description' => __( 'The maximum number of renewals for a subscription item.', 'invoicing' ),
207
+		'description' => __('The maximum number of renewals for a subscription item.', 'invoicing'),
208 208
 		'type'        => 'integer',
209
-		'context'     => array( 'view', 'edit', 'embed' ),
209
+		'context'     => array('view', 'edit', 'embed'),
210 210
 	),
211 211
 
212 212
 	'is_free_trial'   => array(
213
-		'description' => __( 'Whether the item has a free trial period.', 'invoicing' ),
213
+		'description' => __('Whether the item has a free trial period.', 'invoicing'),
214 214
 		'type'        => 'integer',
215
-		'enum'        => array( 0, 1 ),
216
-		'context'     => array( 'view', 'edit', 'embed' ),
215
+		'enum'        => array(0, 1),
216
+		'context'     => array('view', 'edit', 'embed'),
217 217
 	),
218 218
 
219 219
 	'trial_period'    => array(
220
-		'description' => __( 'The trial period.', 'invoicing' ),
220
+		'description' => __('The trial period.', 'invoicing'),
221 221
 		'type'        => 'string',
222
-		'context'     => array( 'view', 'edit', 'embed' ),
223
-		'enum'        => array( 'D', 'W', 'M', 'Y' ),
222
+		'context'     => array('view', 'edit', 'embed'),
223
+		'enum'        => array('D', 'W', 'M', 'Y'),
224 224
 	),
225 225
 
226 226
 	'trial_interval'  => array(
227
-		'description' => __( 'The trial interval.', 'invoicing' ),
227
+		'description' => __('The trial interval.', 'invoicing'),
228 228
 		'type'        => 'integer',
229
-		'context'     => array( 'view', 'edit', 'embed' ),
229
+		'context'     => array('view', 'edit', 'embed'),
230 230
 	),
231 231
 
232 232
 	'first_renewal_date'       => array(
233
-		'description' => __( 'The first renewal date in case the item was to be bought today.', 'invoicing' ),
233
+		'description' => __('The first renewal date in case the item was to be bought today.', 'invoicing'),
234 234
 		'type'        => 'string',
235
-		'context'     => array( 'view', 'edit', 'embed' ),
235
+		'context'     => array('view', 'edit', 'embed'),
236 236
 		'readonly'    => true,
237 237
 	),
238 238
 
239 239
 	'edit_url'        => array(
240
-		'description' => __( 'The URL to edit an item.', 'invoicing' ),
240
+		'description' => __('The URL to edit an item.', 'invoicing'),
241 241
 		'type'        => 'string',
242
-		'context'     => array( 'view', 'edit', 'embed' ),
242
+		'context'     => array('view', 'edit', 'embed'),
243 243
 		'readonly'    => true,
244 244
 	),
245 245
 );
Please login to merge, or discard this patch.
templates/invoice/header-left-actions.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -8,25 +8,25 @@
 block discarded – undo
8 8
  * @var WPInv_Invoice $invoice
9 9
  */
10 10
 
11
-defined( 'ABSPATH' ) || exit;
11
+defined('ABSPATH') || exit;
12 12
 
13 13
 ?>
14 14
 
15 15
         <div class="getpaid-header-left-actions">
16 16
 
17
-            <?php if ( $invoice->is_type( 'invoice' ) && $invoice->needs_payment() && ! $invoice->is_held() ): ?>
18
-                <a class="btn btn-sm btn-primary m-1 d-inline-block invoice-action-pay" href="<?php echo esc_url( $invoice->get_checkout_payment_url() ); ?>">
19
-                    <?php _e( 'Pay For Invoice', 'invoicing' ); ?>
17
+            <?php if ($invoice->is_type('invoice') && $invoice->needs_payment() && !$invoice->is_held()): ?>
18
+                <a class="btn btn-sm btn-primary m-1 d-inline-block invoice-action-pay" href="<?php echo esc_url($invoice->get_checkout_payment_url()); ?>">
19
+                    <?php _e('Pay For Invoice', 'invoicing'); ?>
20 20
                 </a>
21 21
             <?php endif; ?>
22 22
 
23
-            <?php if ( $invoice->is_type( 'invoice' ) && $invoice->is_paid() ): ?>
24
-                <a class="btn btn-sm btn-info m-1 d-inline-block invoice-action-receipt" href="<?php echo esc_url( $invoice->get_receipt_url() ); ?>">
25
-                    <?php _e( 'View Receipt', 'invoicing' ); ?>
23
+            <?php if ($invoice->is_type('invoice') && $invoice->is_paid()): ?>
24
+                <a class="btn btn-sm btn-info m-1 d-inline-block invoice-action-receipt" href="<?php echo esc_url($invoice->get_receipt_url()); ?>">
25
+                    <?php _e('View Receipt', 'invoicing'); ?>
26 26
                 </a>
27 27
             <?php endif; ?>
28 28
 
29
-            <?php do_action( 'wpinv_invoice_display_left_actions', $invoice ); ?>
29
+            <?php do_action('wpinv_invoice_display_left_actions', $invoice); ?>
30 30
 
31 31
         </div>
32 32
 
Please login to merge, or discard this patch.