@@ -1,7 +1,8 @@ |
||
1 | 1 | <?php |
2 | 2 | // don't load directly |
3 | -if ( !defined('ABSPATH') ) |
|
3 | +if ( !defined('ABSPATH') ) { |
|
4 | 4 | die('-1'); |
5 | +} |
|
5 | 6 | |
6 | 7 | do_action( 'wpinv_email_header', $email_heading, $invoice, $email_type, $sent_to_admin ); |
7 | 8 | ?> |
@@ -1,7 +1,8 @@ |
||
1 | 1 | <?php |
2 | 2 | // don't load directly |
3 | -if ( !defined('ABSPATH') ) |
|
3 | +if ( !defined('ABSPATH') ) { |
|
4 | 4 | die('-1'); |
5 | +} |
|
5 | 6 | |
6 | 7 | do_action( 'wpinv_email_header', $email_heading, $invoice, $email_type, $sent_to_admin ); |
7 | 8 | ?> |
@@ -1,7 +1,8 @@ |
||
1 | 1 | <?php |
2 | 2 | // don't load directly |
3 | -if ( !defined('ABSPATH') ) |
|
3 | +if ( !defined('ABSPATH') ) { |
|
4 | 4 | die('-1'); |
5 | +} |
|
5 | 6 | |
6 | 7 | do_action( 'wpinv_email_header', $email_heading, $invoice, $email_type, $sent_to_admin ); |
7 | 8 |
@@ -1,7 +1,8 @@ |
||
1 | 1 | <?php |
2 | 2 | // don't load directly |
3 | -if ( !defined('ABSPATH') ) |
|
3 | +if ( !defined('ABSPATH') ) { |
|
4 | 4 | die('-1'); |
5 | +} |
|
5 | 6 | |
6 | 7 | do_action( 'wpinv_email_header', $email_heading, $invoice, $email_type, $sent_to_admin ); |
7 | 8 | ?> |
@@ -1,7 +1,8 @@ |
||
1 | 1 | <?php |
2 | 2 | // don't load directly |
3 | -if ( !defined('ABSPATH') ) |
|
3 | +if ( !defined('ABSPATH') ) { |
|
4 | 4 | die('-1'); |
5 | +} |
|
5 | 6 | |
6 | 7 | do_action( 'wpinv_email_header', $email_heading, $invoice, $email_type, $sent_to_admin ); |
7 | 8 |
@@ -1,7 +1,8 @@ |
||
1 | 1 | <?php |
2 | 2 | // don't load directly |
3 | -if ( !defined('ABSPATH') ) |
|
3 | +if ( !defined('ABSPATH') ) { |
|
4 | 4 | die('-1'); |
5 | +} |
|
5 | 6 | |
6 | 7 | do_action( 'wpinv_email_header', $email_heading, $invoice, $email_type, $sent_to_admin ); |
7 | 8 | ?> |
@@ -70,7 +70,10 @@ discard block |
||
70 | 70 | } |
71 | 71 | |
72 | 72 | function wpinv_invoice_display_right_actions( $invoice ) { |
73 | - if ( empty( $invoice ) ) return; //Exit if invoice is not set. |
|
73 | + if ( empty( $invoice ) ) { |
|
74 | + return; |
|
75 | + } |
|
76 | + //Exit if invoice is not set. |
|
74 | 77 | |
75 | 78 | if($invoice->post_type == 'wpi_invoice'){ |
76 | 79 | $user_id = (int)$invoice->get_user_id(); |
@@ -177,8 +180,9 @@ discard block |
||
177 | 180 | |
178 | 181 | // Setup possible parts |
179 | 182 | $templates = array(); |
180 | - if ( isset( $name ) ) |
|
181 | - $templates[] = $slug . '-' . $name . '.php'; |
|
183 | + if ( isset( $name ) ) { |
|
184 | + $templates[] = $slug . '-' . $name . '.php'; |
|
185 | + } |
|
182 | 186 | $templates[] = $slug . '.php'; |
183 | 187 | |
184 | 188 | // Allow template parts to be filtered |
@@ -196,8 +200,9 @@ discard block |
||
196 | 200 | foreach ( (array)$template_names as $template_name ) { |
197 | 201 | |
198 | 202 | // Continue if template is empty |
199 | - if ( empty( $template_name ) ) |
|
200 | - continue; |
|
203 | + if ( empty( $template_name ) ) { |
|
204 | + continue; |
|
205 | + } |
|
201 | 206 | |
202 | 207 | // Trim off any slashes from the template name |
203 | 208 | $template_name = ltrim( $template_name, '/' ); |
@@ -216,8 +221,9 @@ discard block |
||
216 | 221 | } |
217 | 222 | } |
218 | 223 | |
219 | - if ( ( true == $load ) && ! empty( $located ) ) |
|
220 | - load_template( $located, $require_once ); |
|
224 | + if ( ( true == $load ) && ! empty( $located ) ) { |
|
225 | + load_template( $located, $require_once ); |
|
226 | + } |
|
221 | 227 | |
222 | 228 | return $located; |
223 | 229 | } |
@@ -293,8 +299,9 @@ discard block |
||
293 | 299 | function wpinv_html_dropdown( $name = 'wpinv_discounts', $selected = 0, $status = '' ) { |
294 | 300 | $args = array( 'nopaging' => true ); |
295 | 301 | |
296 | - if ( ! empty( $status ) ) |
|
297 | - $args['post_status'] = $status; |
|
302 | + if ( ! empty( $status ) ) { |
|
303 | + $args['post_status'] = $status; |
|
304 | + } |
|
298 | 305 | |
299 | 306 | $discounts = wpinv_get_discounts( $args ); |
300 | 307 | $options = array(); |
@@ -898,8 +905,11 @@ discard block |
||
898 | 905 | |
899 | 906 | $invoice_status = wpinv_get_invoice_status( $invoice_id ); |
900 | 907 | |
901 | - if($invoice->post_type == 'wpi_invoice') $type = 'Invoice'; |
|
902 | - elseif($invoice->post_type == 'wpi_quote') $type = 'Quote'; |
|
908 | + if($invoice->post_type == 'wpi_invoice') { |
|
909 | + $type = 'Invoice'; |
|
910 | + } elseif($invoice->post_type == 'wpi_quote') { |
|
911 | + $type = 'Quote'; |
|
912 | + } |
|
903 | 913 | ?> |
904 | 914 | <table class="table table-bordered table-sm"> |
905 | 915 | <?php if ( $invoice_number = wpinv_get_invoice_number( $invoice_id ) ) { ?> |
@@ -1466,17 +1476,19 @@ discard block |
||
1466 | 1476 | add_action( 'wpinv_cart_empty', 'wpinv_empty_checkout_cart' ); |
1467 | 1477 | |
1468 | 1478 | function wpinv_save_cart_button() { |
1469 | - if ( wpinv_is_cart_saving_disabled() ) |
|
1470 | - return; |
|
1471 | -?> |
|
1479 | + if ( wpinv_is_cart_saving_disabled() ) { |
|
1480 | + return; |
|
1481 | + } |
|
1482 | + ?> |
|
1472 | 1483 | <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> |
1473 | 1484 | <?php |
1474 | 1485 | } |
1475 | 1486 | |
1476 | 1487 | function wpinv_update_cart_button() { |
1477 | - if ( !wpinv_item_quantities_enabled() ) |
|
1478 | - return; |
|
1479 | -?> |
|
1488 | + if ( !wpinv_item_quantities_enabled() ) { |
|
1489 | + return; |
|
1490 | + } |
|
1491 | + ?> |
|
1480 | 1492 | <input type="submit" name="wpinv_update_cart_submit" class="wpinv-submit wpinv-no-js button" value="<?php _e( 'Update Cart', 'invoicing' ); ?>"/> |
1481 | 1493 | <input type="hidden" name="wpi_action" value="update_cart"/> |
1482 | 1494 | <?php |
@@ -1615,7 +1627,7 @@ discard block |
||
1615 | 1627 | </div> |
1616 | 1628 | <?php |
1617 | 1629 | } |
1618 | - }else{ |
|
1630 | + } else{ |
|
1619 | 1631 | echo '<div class="alert alert-warning">'. __('No payment gateway active','invoicing') .'</div>'; |
1620 | 1632 | } |
1621 | 1633 |
@@ -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; |
@@ -17,12 +19,13 @@ discard block |
||
17 | 19 | } |
18 | 20 | |
19 | 21 | if ( $pagination ) { |
20 | - if ( get_query_var( 'paged' ) ) |
|
21 | - $paged = get_query_var('paged'); |
|
22 | - else if ( get_query_var( 'page' ) ) |
|
23 | - $paged = get_query_var( 'page' ); |
|
24 | - else |
|
25 | - $paged = 1; |
|
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; |
|
28 | + } |
|
26 | 29 | } |
27 | 30 | |
28 | 31 | $args = array( |
@@ -37,8 +40,9 @@ discard block |
||
37 | 40 | $invoices = get_posts( $args ); |
38 | 41 | |
39 | 42 | // No invoices |
40 | - if ( ! $invoices ) |
|
41 | - return false; |
|
43 | + if ( ! $invoices ) { |
|
44 | + return false; |
|
45 | + } |
|
42 | 46 | |
43 | 47 | return $invoices; |
44 | 48 | } |
@@ -83,8 +83,9 @@ discard block |
||
83 | 83 | |
84 | 84 | $invoice_id = $wpdb->get_var( $wpdb->prepare( "SELECT post_id FROM $wpdb->postmeta WHERE meta_key = '_wpinv_transaction_id' AND meta_value = %s LIMIT 1", $key ) ); |
85 | 85 | |
86 | - if ( $invoice_id != NULL ) |
|
87 | - return $invoice_id; |
|
86 | + if ( $invoice_id != NULL ) { |
|
87 | + return $invoice_id; |
|
88 | + } |
|
88 | 89 | |
89 | 90 | return 0; |
90 | 91 | } |
@@ -759,8 +760,9 @@ discard block |
||
759 | 760 | function wpinv_checkout_validate_cc_zip( $zip = 0, $country_code = '' ) { |
760 | 761 | $ret = false; |
761 | 762 | |
762 | - if ( empty( $zip ) || empty( $country_code ) ) |
|
763 | - return $ret; |
|
763 | + if ( empty( $zip ) || empty( $country_code ) ) { |
|
764 | + return $ret; |
|
765 | + } |
|
764 | 766 | |
765 | 767 | $country_code = strtoupper( $country_code ); |
766 | 768 | |
@@ -922,8 +924,9 @@ discard block |
||
922 | 924 | "ZM" => "\d{5}" |
923 | 925 | ); |
924 | 926 | |
925 | - if ( ! isset ( $zip_regex[ $country_code ] ) || preg_match( "/" . $zip_regex[ $country_code ] . "/i", $zip ) ) |
|
926 | - $ret = true; |
|
927 | + if ( ! isset ( $zip_regex[ $country_code ] ) || preg_match( "/" . $zip_regex[ $country_code ] . "/i", $zip ) ) { |
|
928 | + $ret = true; |
|
929 | + } |
|
927 | 930 | |
928 | 931 | return apply_filters( 'wpinv_is_zip_valid', $ret, $zip, $country_code ); |
929 | 932 | } |
@@ -1249,14 +1252,15 @@ discard block |
||
1249 | 1252 | |
1250 | 1253 | $wpinv_cpt = $_REQUEST[ 'wpinv-cpt' ]; |
1251 | 1254 | |
1252 | - if ( get_query_var( 'paged' ) && 'wpi_invoice' == $wpinv_cpt ) |
|
1253 | - $args['page'] = get_query_var('paged'); |
|
1254 | - else if ( get_query_var( 'page' ) && 'wpi_invoice' == $wpinv_cpt ) |
|
1255 | - $args['page'] = get_query_var( 'page' ); |
|
1256 | - else if ( !empty( $args[ 'page' ] ) ) |
|
1257 | - $args['page'] = $args[ 'page' ]; |
|
1258 | - else |
|
1259 | - $args['page'] = 1; |
|
1255 | + if ( get_query_var( 'paged' ) && 'wpi_invoice' == $wpinv_cpt ) { |
|
1256 | + $args['page'] = get_query_var('paged'); |
|
1257 | + } else if ( get_query_var( 'page' ) && 'wpi_invoice' == $wpinv_cpt ) { |
|
1258 | + $args['page'] = get_query_var( 'page' ); |
|
1259 | + } else if ( !empty( $args[ 'page' ] ) ) { |
|
1260 | + $args['page'] = $args[ 'page' ]; |
|
1261 | + } else { |
|
1262 | + $args['page'] = 1; |
|
1263 | + } |
|
1260 | 1264 | |
1261 | 1265 | /** |
1262 | 1266 | * Generate WP_Query args. This logic will change if orders are moved to |
@@ -1391,8 +1395,9 @@ discard block |
||
1391 | 1395 | |
1392 | 1396 | $invoice_id = $wpdb->get_var( $wpdb->prepare( "SELECT post_id FROM $wpdb->postmeta WHERE meta_key = '_wpinv_key' AND meta_value = %s LIMIT 1", $key ) ); |
1393 | 1397 | |
1394 | - if ( $invoice_id != NULL ) |
|
1395 | - return $invoice_id; |
|
1398 | + if ( $invoice_id != NULL ) { |
|
1399 | + return $invoice_id; |
|
1400 | + } |
|
1396 | 1401 | |
1397 | 1402 | return 0; |
1398 | 1403 | } |