@@ -67,8 +67,9 @@ discard block |
||
67 | 67 | |
68 | 68 | if ( !empty( $args ) ) { |
69 | 69 | // Check for backward compatibility |
70 | - if ( is_string( $args ) ) |
|
71 | - $args = str_replace( '?', '', $args ); |
|
70 | + if ( is_string( $args ) ) { |
|
71 | + $args = str_replace( '?', '', $args ); |
|
72 | + } |
|
72 | 73 | |
73 | 74 | $args = wp_parse_args( $args ); |
74 | 75 | |
@@ -87,8 +88,9 @@ discard block |
||
87 | 88 | |
88 | 89 | if ( !empty( $args ) ) { |
89 | 90 | // Check for backward compatibility |
90 | - if ( is_string( $args ) ) |
|
91 | - $args = str_replace( '?', '', $args ); |
|
91 | + if ( is_string( $args ) ) { |
|
92 | + $args = str_replace( '?', '', $args ); |
|
93 | + } |
|
92 | 94 | |
93 | 95 | $args = wp_parse_args( $args ); |
94 | 96 | |
@@ -108,8 +110,9 @@ discard block |
||
108 | 110 | |
109 | 111 | if ( !empty( $args ) ) { |
110 | 112 | // Check for backward compatibility |
111 | - if ( is_string( $args ) ) |
|
112 | - $args = str_replace( '?', '', $args ); |
|
113 | + if ( is_string( $args ) ) { |
|
114 | + $args = str_replace( '?', '', $args ); |
|
115 | + } |
|
113 | 116 | |
114 | 117 | $args = wp_parse_args( $args ); |
115 | 118 | |
@@ -132,8 +135,9 @@ discard block |
||
132 | 135 | |
133 | 136 | if ( ! empty( $args ) ) { |
134 | 137 | // Check for backward compatibility |
135 | - if ( is_string( $args ) ) |
|
136 | - $args = str_replace( '?', '', $args ); |
|
138 | + if ( is_string( $args ) ) { |
|
139 | + $args = str_replace( '?', '', $args ); |
|
140 | + } |
|
137 | 141 | |
138 | 142 | $args = wp_parse_args( $args ); |
139 | 143 | |
@@ -148,8 +152,9 @@ discard block |
||
148 | 152 | $success_page = wpinv_get_option( 'success_page', 0 ); |
149 | 153 | $success_page = get_permalink( $success_page ); |
150 | 154 | |
151 | - if ( $query_string ) |
|
152 | - $success_page .= $query_string; |
|
155 | + if ( $query_string ) { |
|
156 | + $success_page .= $query_string; |
|
157 | + } |
|
153 | 158 | |
154 | 159 | return apply_filters( 'wpinv_success_page_url', $success_page ); |
155 | 160 | } |
@@ -158,8 +163,9 @@ discard block |
||
158 | 163 | $uri = wpinv_get_option( 'failure_page', '' ); |
159 | 164 | $uri = ! empty( $uri ) ? trailingslashit( get_permalink( $uri ) ) : home_url(); |
160 | 165 | |
161 | - if ( $extras ) |
|
162 | - $uri .= $extras; |
|
166 | + if ( $extras ) { |
|
167 | + $uri .= $extras; |
|
168 | + } |
|
163 | 169 | |
164 | 170 | return apply_filters( 'wpinv_get_failed_transaction_uri', $uri ); |
165 | 171 | } |
@@ -196,8 +196,9 @@ |
||
196 | 196 | foreach ( $types as $name => $type ) { |
197 | 197 | echo '<option value="' . esc_attr( $name ) . '"'; |
198 | 198 | |
199 | - if ( isset( $_GET['discount_type'] ) ) |
|
200 | - selected( $name, $_GET['discount_type'] ); |
|
199 | + if ( isset( $_GET['discount_type'] ) ) { |
|
200 | + selected( $name, $_GET['discount_type'] ); |
|
201 | + } |
|
201 | 202 | |
202 | 203 | echo '>' . esc_html__( $type, 'invoicing' ) . '</option>'; |
203 | 204 | } |
@@ -912,10 +912,11 @@ discard block |
||
912 | 912 | |
913 | 913 | $checked = false; |
914 | 914 | |
915 | - if ( isset( $wpinv_options[ $args['id'] ] ) && $wpinv_options[ $args['id'] ] == $key ) |
|
916 | - $checked = true; |
|
917 | - elseif( isset( $args['std'] ) && $args['std'] == $key && ! isset( $wpinv_options[ $args['id'] ] ) ) |
|
918 | - $checked = true; |
|
915 | + if ( isset( $wpinv_options[ $args['id'] ] ) && $wpinv_options[ $args['id'] ] == $key ) { |
|
916 | + $checked = true; |
|
917 | + } elseif( isset( $args['std'] ) && $args['std'] == $key && ! isset( $wpinv_options[ $args['id'] ] ) ) { |
|
918 | + $checked = true; |
|
919 | + } |
|
919 | 920 | |
920 | 921 | echo '<input name="wpinv_settings[' . $sanitize_id . ']" id="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" type="radio" value="' . $sanitize_key . '" ' . checked(true, $checked, false) . '/> '; |
921 | 922 | echo '<label for="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']">' . esc_html( $option ) . '</label><br/>'; |
@@ -932,10 +933,11 @@ discard block |
||
932 | 933 | foreach ( $args['options'] as $key => $option ) : |
933 | 934 | $sanitize_key = wpinv_sanitize_key( $key ); |
934 | 935 | |
935 | - if ( isset( $wpinv_options['gateways'][ $key ] ) ) |
|
936 | - $enabled = '1'; |
|
937 | - else |
|
938 | - $enabled = null; |
|
936 | + if ( isset( $wpinv_options['gateways'][ $key ] ) ) { |
|
937 | + $enabled = '1'; |
|
938 | + } else { |
|
939 | + $enabled = null; |
|
940 | + } |
|
939 | 941 | |
940 | 942 | echo '<input name="wpinv_settings[' . esc_attr( $args['id'] ) . '][' . $sanitize_key . ']" id="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" type="checkbox" value="1" ' . checked('1', $enabled, false) . '/> '; |
941 | 943 | echo '<label for="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']">' . esc_html( $option['admin_label'] ) . '</label><br/>'; |
@@ -1302,7 +1304,8 @@ discard block |
||
1302 | 1304 | <td class="wpinv_tax_action"><span class="wpinv_remove_tax_rate button-secondary"><?php _e( 'Remove Rate', 'invoicing' ); ?></span></td> |
1303 | 1305 | </tr> |
1304 | 1306 | <?php endforeach; ?> |
1305 | - <?php else : ?> |
|
1307 | + <?php else { |
|
1308 | + : ?> |
|
1306 | 1309 | <tr> |
1307 | 1310 | <td class="wpinv_tax_country"> |
1308 | 1311 | <?php |
@@ -1314,7 +1317,9 @@ discard block |
||
1314 | 1317 | 'class' => 'wpinv-tax-country', |
1315 | 1318 | 'chosen' => false, |
1316 | 1319 | 'placeholder' => __( 'Choose a country', 'invoicing' ) |
1317 | - ) ); ?> |
|
1320 | + ) ); |
|
1321 | +} |
|
1322 | +?> |
|
1318 | 1323 | </td> |
1319 | 1324 | <td class="wpinv_tax_state"> |
1320 | 1325 | <?php echo wpinv_html_text( array( |
@@ -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() ); |