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