@@ -310,7 +310,7 @@ discard block |
||
310 | 310 | if ( !wpinv_is_gateway_active( $enabled_gateway ) && !empty( $gateways ) ) { |
311 | 311 | if(wpinv_is_gateway_active( wpinv_get_default_gateway()) ){ |
312 | 312 | $enabled_gateway = wpinv_get_default_gateway(); |
313 | - }else{ |
|
313 | + } else{ |
|
314 | 314 | $enabled_gateway = $gateways[0]; |
315 | 315 | } |
316 | 316 | |
@@ -336,8 +336,9 @@ discard block |
||
336 | 336 | |
337 | 337 | $payments = new WP_Query( $args ); |
338 | 338 | |
339 | - if( $payments ) |
|
340 | - $ret = $payments->post_count; |
|
339 | + if( $payments ) { |
|
340 | + $ret = $payments->post_count; |
|
341 | + } |
|
341 | 342 | return $ret; |
342 | 343 | } |
343 | 344 |
@@ -512,7 +512,7 @@ |
||
512 | 512 | |
513 | 513 | $response['success'] = true; |
514 | 514 | $response['msg'] = __( 'Discount has been applied successfully.', 'invoicing' ); |
515 | - } else { |
|
515 | + } else { |
|
516 | 516 | $errors = wpinv_get_errors(); |
517 | 517 | if ( !empty( $errors['wpinv-discount-error'] ) ) { |
518 | 518 | $response['msg'] = $errors['wpinv-discount-error']; |
@@ -70,8 +70,9 @@ discard block |
||
70 | 70 | if( !empty( $tax_rates ) ) { |
71 | 71 | // Locate the tax rate for this country / state, if it exists |
72 | 72 | foreach( $tax_rates as $key => $tax_rate ) { |
73 | - if( $country != $tax_rate['country'] ) |
|
74 | - continue; |
|
73 | + if( $country != $tax_rate['country'] ) { |
|
74 | + continue; |
|
75 | + } |
|
75 | 76 | |
76 | 77 | if( !empty( $tax_rate['global'] ) ) { |
77 | 78 | if( !empty( $tax_rate['rate'] ) ) { |
@@ -79,8 +80,9 @@ discard block |
||
79 | 80 | } |
80 | 81 | } else { |
81 | 82 | |
82 | - if( empty( $tax_rate['state'] ) || strtolower( $state ) != strtolower( $tax_rate['state'] ) ) |
|
83 | - continue; |
|
83 | + if( empty( $tax_rate['state'] ) || strtolower( $state ) != strtolower( $tax_rate['state'] ) ) { |
|
84 | + continue; |
|
85 | + } |
|
84 | 86 | |
85 | 87 | $state_rate = $tax_rate['rate']; |
86 | 88 | if( 0 !== $state_rate || !empty( $state_rate ) ) { |
@@ -183,8 +185,9 @@ discard block |
||
183 | 185 | } |
184 | 186 | |
185 | 187 | function wpinv_cart_needs_tax_address_fields() { |
186 | - if( !wpinv_is_cart_taxed() ) |
|
187 | - return false; |
|
188 | + if( !wpinv_is_cart_taxed() ) { |
|
189 | + return false; |
|
190 | + } |
|
188 | 191 | |
189 | 192 | return ! did_action( 'wpinv_after_cc_fields', 'wpinv_default_cc_address_fields' ); |
190 | 193 | } |
@@ -1,6 +1,8 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | // Exit if accessed directly |
3 | -if ( ! defined( 'ABSPATH' ) ) exit; |
|
3 | +if ( ! defined( 'ABSPATH' ) ) { |
|
4 | + exit; |
|
5 | +} |
|
4 | 6 | |
5 | 7 | function wpinv_user_invoices( $current_page = 1 ) { |
6 | 8 | global $current_page; |
@@ -19,12 +21,13 @@ discard block |
||
19 | 21 | $status = $status === 'complete' ? 'publish' : $status; |
20 | 22 | |
21 | 23 | if ( $pagination ) { |
22 | - if ( get_query_var( 'paged' ) ) |
|
23 | - $paged = get_query_var('paged'); |
|
24 | - else if ( get_query_var( 'page' ) ) |
|
25 | - $paged = get_query_var( 'page' ); |
|
26 | - else |
|
27 | - $paged = 1; |
|
24 | + if ( get_query_var( 'paged' ) ) { |
|
25 | + $paged = get_query_var('paged'); |
|
26 | + } else if ( get_query_var( 'page' ) ) { |
|
27 | + $paged = get_query_var( 'page' ); |
|
28 | + } else { |
|
29 | + $paged = 1; |
|
30 | + } |
|
28 | 31 | } |
29 | 32 | |
30 | 33 | $args = array( |
@@ -39,8 +42,9 @@ discard block |
||
39 | 42 | $invoices = get_posts( $args ); |
40 | 43 | |
41 | 44 | // No invoices |
42 | - if ( ! $invoices ) |
|
43 | - return false; |
|
45 | + if ( ! $invoices ) { |
|
46 | + return false; |
|
47 | + } |
|
44 | 48 | |
45 | 49 | return $invoices; |
46 | 50 | } |
@@ -173,8 +173,9 @@ discard block |
||
173 | 173 | |
174 | 174 | // Setup possible parts |
175 | 175 | $templates = array(); |
176 | - if ( isset( $name ) ) |
|
177 | - $templates[] = $slug . '-' . $name . '.php'; |
|
176 | + if ( isset( $name ) ) { |
|
177 | + $templates[] = $slug . '-' . $name . '.php'; |
|
178 | + } |
|
178 | 179 | $templates[] = $slug . '.php'; |
179 | 180 | |
180 | 181 | // Allow template parts to be filtered |
@@ -192,8 +193,9 @@ discard block |
||
192 | 193 | foreach ( (array)$template_names as $template_name ) { |
193 | 194 | |
194 | 195 | // Continue if template is empty |
195 | - if ( empty( $template_name ) ) |
|
196 | - continue; |
|
196 | + if ( empty( $template_name ) ) { |
|
197 | + continue; |
|
198 | + } |
|
197 | 199 | |
198 | 200 | // Trim off any slashes from the template name |
199 | 201 | $template_name = ltrim( $template_name, '/' ); |
@@ -212,8 +214,9 @@ discard block |
||
212 | 214 | } |
213 | 215 | } |
214 | 216 | |
215 | - if ( ( true == $load ) && ! empty( $located ) ) |
|
216 | - load_template( $located, $require_once ); |
|
217 | + if ( ( true == $load ) && ! empty( $located ) ) { |
|
218 | + load_template( $located, $require_once ); |
|
219 | + } |
|
217 | 220 | |
218 | 221 | return $located; |
219 | 222 | } |
@@ -289,8 +292,9 @@ discard block |
||
289 | 292 | function wpinv_html_dropdown( $name = 'wpinv_discounts', $selected = 0, $status = '' ) { |
290 | 293 | $args = array( 'nopaging' => true ); |
291 | 294 | |
292 | - if ( ! empty( $status ) ) |
|
293 | - $args['post_status'] = $status; |
|
295 | + if ( ! empty( $status ) ) { |
|
296 | + $args['post_status'] = $status; |
|
297 | + } |
|
294 | 298 | |
295 | 299 | $discounts = wpinv_get_discounts( $args ); |
296 | 300 | $options = array(); |
@@ -1457,17 +1461,19 @@ discard block |
||
1457 | 1461 | add_action( 'wpinv_cart_empty', 'wpinv_empty_checkout_cart' ); |
1458 | 1462 | |
1459 | 1463 | function wpinv_save_cart_button() { |
1460 | - if ( wpinv_is_cart_saving_disabled() ) |
|
1461 | - return; |
|
1462 | -?> |
|
1464 | + if ( wpinv_is_cart_saving_disabled() ) { |
|
1465 | + return; |
|
1466 | + } |
|
1467 | + ?> |
|
1463 | 1468 | <a class="wpinv-cart-saving-button wpinv-submit button" id="wpinv-save-cart-button" href="<?php echo esc_url( add_query_arg( 'wpi_action', 'save_cart' ) ); ?>"><?php _e( 'Save Cart', 'invoicing' ); ?></a> |
1464 | 1469 | <?php |
1465 | 1470 | } |
1466 | 1471 | |
1467 | 1472 | function wpinv_update_cart_button() { |
1468 | - if ( !wpinv_item_quantities_enabled() ) |
|
1469 | - return; |
|
1470 | -?> |
|
1473 | + if ( !wpinv_item_quantities_enabled() ) { |
|
1474 | + return; |
|
1475 | + } |
|
1476 | + ?> |
|
1471 | 1477 | <input type="submit" name="wpinv_update_cart_submit" class="wpinv-submit wpinv-no-js button" value="<?php _e( 'Update Cart', 'invoicing' ); ?>"/> |
1472 | 1478 | <input type="hidden" name="wpi_action" value="update_cart"/> |
1473 | 1479 | <?php |
@@ -1606,7 +1612,7 @@ discard block |
||
1606 | 1612 | </div> |
1607 | 1613 | <?php |
1608 | 1614 | } |
1609 | - }else{ |
|
1615 | + } else{ |
|
1610 | 1616 | echo '<div class="alert alert-warning">'. __('No payment gateway active','invoicing') .'</div>'; |
1611 | 1617 | } |
1612 | 1618 |
@@ -971,8 +971,9 @@ |
||
971 | 971 | return false; |
972 | 972 | } |
973 | 973 | |
974 | - if ( empty( $this->ID ) ) |
|
975 | - return false; |
|
974 | + if ( empty( $this->ID ) ) { |
|
975 | + return false; |
|
976 | + } |
|
976 | 977 | |
977 | 978 | if ( ( ( is_user_logged_in() && current_user_can( 'manage_options' ) ) || $added_by_user ) && !$system ) { |
978 | 979 | $user = get_user_by( 'id', get_current_user_id() ); |
@@ -1,6 +1,8 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | // Exit if accessed directly. |
3 | -if (!defined( 'ABSPATH' ) ) exit; |
|
3 | +if (!defined( 'ABSPATH' ) ) { |
|
4 | + exit; |
|
5 | +} |
|
4 | 6 | |
5 | 7 | class WPInv_EUVat { |
6 | 8 | private static $is_ajax = false; |
@@ -1445,16 +1447,18 @@ discard block |
||
1445 | 1447 | |
1446 | 1448 | if ( !empty( $tax_rates ) ) { |
1447 | 1449 | foreach ( $tax_rates as $key => $tax_rate ) { |
1448 | - if ( $country != $tax_rate['country'] ) |
|
1449 | - continue; |
|
1450 | + if ( $country != $tax_rate['country'] ) { |
|
1451 | + continue; |
|
1452 | + } |
|
1450 | 1453 | |
1451 | 1454 | if ( !empty( $tax_rate['global'] ) ) { |
1452 | 1455 | if ( 0 !== $tax_rate['rate'] || !empty( $tax_rate['rate'] ) ) { |
1453 | 1456 | $rate = number_format( $tax_rate['rate'], 4 ); |
1454 | 1457 | } |
1455 | 1458 | } else { |
1456 | - if ( empty( $tax_rate['state'] ) || strtolower( $state ) != strtolower( $tax_rate['state'] ) ) |
|
1457 | - continue; |
|
1459 | + if ( empty( $tax_rate['state'] ) || strtolower( $state ) != strtolower( $tax_rate['state'] ) ) { |
|
1460 | + continue; |
|
1461 | + } |
|
1458 | 1462 | |
1459 | 1463 | $state_rate = $tax_rate['rate']; |
1460 | 1464 | if ( 0 !== $state_rate || !empty( $state_rate ) ) { |
@@ -1,6 +1,8 @@ |
||
1 | 1 | <?php |
2 | 2 | // Exit if accessed directly. |
3 | -if (!defined( 'ABSPATH' ) ) exit; |
|
3 | +if (!defined( 'ABSPATH' ) ) { |
|
4 | + exit; |
|
5 | +} |
|
4 | 6 | |
5 | 7 | /** |
6 | 8 | * WPInv_Session Class. |
@@ -1,6 +1,8 @@ |
||
1 | 1 | <?php |
2 | 2 | // Exit if accessed directly |
3 | -if ( ! defined( 'ABSPATH' ) ) exit; |
|
3 | +if ( ! defined( 'ABSPATH' ) ) { |
|
4 | + exit; |
|
5 | +} |
|
4 | 6 | |
5 | 7 | class WPInv_Item { |
6 | 8 | public $ID = 0; |