@@ -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 | } |
@@ -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 | } |
@@ -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. |