@@ -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 | $email_footer = apply_filters( 'wpinv_email_footer_text', wpinv_get_option( 'email_footer_text' ) ); |
| 7 | 8 | $email_footer = $email_footer ? wpautop( wp_kses_post( wptexturize( $email_footer ) ) ) : ''; |
@@ -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 | if ( !isset( $email_heading ) ) { |
| 7 | 8 | global $email_heading; |
@@ -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 | // Load colours |
| 7 | 8 | $bg = wpinv_get_option( 'email_background_color', '#f5f5f5' ); |
@@ -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_before_billing_details', $invoice ); ?> |
| 7 | 8 | <div id="wpinv-email-billing"> |
@@ -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 | global $wpinv_euvat; |
| 7 | 8 | |
@@ -348,7 +348,7 @@ |
||
| 348 | 348 | |
| 349 | 349 | $query_args = array( 'user' => $user_id, 'page' => $this->pag_page, 'limit' => $this->pag_num, 'return' => 'self', 'paginate' => true ); |
| 350 | 350 | if ( !empty( $status ) && $status != 'all' ) { |
| 351 | - $query_args['status'] = $status; |
|
| 351 | + $query_args['status'] = $status; |
|
| 352 | 352 | } |
| 353 | 353 | $invoices = wpinv_get_invoices( apply_filters( 'wpinv_bp_user_invoices_query', $query_args ) ); |
| 354 | 354 | |
@@ -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 | } |
@@ -286,26 +286,26 @@ discard block |
||
| 286 | 286 | } |
| 287 | 287 | |
| 288 | 288 | function wpinv_get_chosen_gateway( $invoice_id = 0 ) { |
| 289 | - $gateways = array_keys( wpinv_get_enabled_payment_gateways() ); |
|
| 289 | + $gateways = array_keys( wpinv_get_enabled_payment_gateways() ); |
|
| 290 | 290 | |
| 291 | 291 | $chosen = false; |
| 292 | 292 | if ( $invoice_id > 0 && $invoice = wpinv_get_invoice( $invoice_id ) ) { |
| 293 | 293 | $chosen = $invoice->get_gateway(); |
| 294 | 294 | } |
| 295 | 295 | |
| 296 | - $chosen = isset( $_REQUEST['payment-mode'] ) ? sanitize_text_field( $_REQUEST['payment-mode'] ) : $chosen; |
|
| 296 | + $chosen = isset( $_REQUEST['payment-mode'] ) ? sanitize_text_field( $_REQUEST['payment-mode'] ) : $chosen; |
|
| 297 | 297 | |
| 298 | - if ( false !== $chosen ) { |
|
| 299 | - $chosen = preg_replace('/[^a-zA-Z0-9-_]+/', '', $chosen ); |
|
| 300 | - } |
|
| 298 | + if ( false !== $chosen ) { |
|
| 299 | + $chosen = preg_replace('/[^a-zA-Z0-9-_]+/', '', $chosen ); |
|
| 300 | + } |
|
| 301 | 301 | |
| 302 | - if ( ! empty ( $chosen ) ) { |
|
| 303 | - $enabled_gateway = urldecode( $chosen ); |
|
| 304 | - } else if ( !empty( $invoice ) && (float)$invoice->get_subtotal() <= 0 ) { |
|
| 305 | - $enabled_gateway = 'manual'; |
|
| 306 | - } else { |
|
| 307 | - $enabled_gateway = wpinv_get_default_gateway(); |
|
| 308 | - } |
|
| 302 | + if ( ! empty ( $chosen ) ) { |
|
| 303 | + $enabled_gateway = urldecode( $chosen ); |
|
| 304 | + } else if ( !empty( $invoice ) && (float)$invoice->get_subtotal() <= 0 ) { |
|
| 305 | + $enabled_gateway = 'manual'; |
|
| 306 | + } else { |
|
| 307 | + $enabled_gateway = wpinv_get_default_gateway(); |
|
| 308 | + } |
|
| 309 | 309 | |
| 310 | 310 | if ( !wpinv_is_gateway_active( $enabled_gateway ) && !empty( $gateways ) ) { |
| 311 | 311 | if(wpinv_is_gateway_active( wpinv_get_default_gateway()) ){ |
@@ -316,7 +316,7 @@ discard block |
||
| 316 | 316 | |
| 317 | 317 | } |
| 318 | 318 | |
| 319 | - return apply_filters( 'wpinv_chosen_gateway', $enabled_gateway ); |
|
| 319 | + return apply_filters( 'wpinv_chosen_gateway', $enabled_gateway ); |
|
| 320 | 320 | } |
| 321 | 321 | |
| 322 | 322 | function wpinv_record_gateway_error( $title = '', $message = '', $parent = 0 ) { |
@@ -324,21 +324,21 @@ discard block |
||
| 324 | 324 | } |
| 325 | 325 | |
| 326 | 326 | function wpinv_count_sales_by_gateway( $gateway_id = 'paypal', $status = 'publish' ) { |
| 327 | - $ret = 0; |
|
| 328 | - $args = array( |
|
| 329 | - 'meta_key' => '_wpinv_gateway', |
|
| 330 | - 'meta_value' => $gateway_id, |
|
| 331 | - 'nopaging' => true, |
|
| 332 | - 'post_type' => 'wpi_invoice', |
|
| 333 | - 'post_status' => $status, |
|
| 334 | - 'fields' => 'ids' |
|
| 335 | - ); |
|
| 336 | - |
|
| 337 | - $payments = new WP_Query( $args ); |
|
| 338 | - |
|
| 339 | - if( $payments ) |
|
| 340 | - $ret = $payments->post_count; |
|
| 341 | - return $ret; |
|
| 327 | + $ret = 0; |
|
| 328 | + $args = array( |
|
| 329 | + 'meta_key' => '_wpinv_gateway', |
|
| 330 | + 'meta_value' => $gateway_id, |
|
| 331 | + 'nopaging' => true, |
|
| 332 | + 'post_type' => 'wpi_invoice', |
|
| 333 | + 'post_status' => $status, |
|
| 334 | + 'fields' => 'ids' |
|
| 335 | + ); |
|
| 336 | + |
|
| 337 | + $payments = new WP_Query( $args ); |
|
| 338 | + |
|
| 339 | + if( $payments ) |
|
| 340 | + $ret = $payments->post_count; |
|
| 341 | + return $ret; |
|
| 342 | 342 | } |
| 343 | 343 | |
| 344 | 344 | function wpinv_settings_update_gateways( $input ) { |
@@ -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 | |
@@ -887,8 +887,8 @@ |
||
| 887 | 887 | if ( !empty( $data ) && isset( $data['cart_discounts'] ) ) { |
| 888 | 888 | unset( $data['cart_discounts'] ); |
| 889 | 889 | |
| 890 | - wpinv_set_checkout_session( $data ); |
|
| 891 | - return true; |
|
| 890 | + wpinv_set_checkout_session( $data ); |
|
| 891 | + return true; |
|
| 892 | 892 | } |
| 893 | 893 | |
| 894 | 894 | return false; |