| @@ -9,7 +9,6 @@ | ||
| 9 | 9 | use GeoIp2\Exception\InvalidRequestException; | 
| 10 | 10 | use GeoIp2\Exception\OutOfQueriesException; | 
| 11 | 11 | use GeoIp2\ProviderInterface; | 
| 12 | -use MaxMind\Exception\InvalidInputException; | |
| 13 | 12 | use MaxMind\WebService\Client as WsClient; | 
| 14 | 13 | |
| 15 | 14 | /** | 
| @@ -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 | |
| @@ -13,9 +13,9 @@ | ||
| 13 | 13 | ) ); | 
| 14 | 14 | echo '<div class="' . implode( ' ', $classes ) . '">'; | 
| 15 | 15 | // Loop error codes and display errors | 
| 16 | -           foreach ( $errors as $error_id => $error ) { | |
| 16 | +            foreach ( $errors as $error_id => $error ) { | |
| 17 | 17 | echo '<p class="wpinv_error" id="wpinv_error_' . $error_id . '"><strong>' . __( 'Error', 'invoicing' ) . '</strong>: ' . $error . '</p>'; | 
| 18 | - } | |
| 18 | + } | |
| 19 | 19 | echo '</div>'; | 
| 20 | 20 | wpinv_clear_errors(); | 
| 21 | 21 | } | 
| @@ -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 ) { | 
| @@ -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; | 
| @@ -140,8 +140,8 @@ discard block | ||
| 140 | 140 | |
| 141 | 141 |  function wpinv_get_default_labels() { | 
| 142 | 142 | $defaults = array( | 
| 143 | - 'singular' => __( 'Invoice', 'invoicing' ), | |
| 144 | - 'plural' => __( 'Invoices', 'invoicing' ) | |
| 143 | + 'singular' => __( 'Invoice', 'invoicing' ), | |
| 144 | + 'plural' => __( 'Invoices', 'invoicing' ) | |
| 145 | 145 | ); | 
| 146 | 146 | |
| 147 | 147 | return apply_filters( 'wpinv_default_invoices_name', $defaults ); | 
| @@ -160,20 +160,20 @@ discard block | ||
| 160 | 160 | } | 
| 161 | 161 | |
| 162 | 162 |  function wpinv_change_default_title( $title ) { | 
| 163 | -     if ( !is_admin() ) { | |
| 163 | +        if ( !is_admin() ) { | |
| 164 | 164 | $label = wpinv_get_label_singular(); | 
| 165 | 165 | $title = sprintf( __( 'Enter %s name here', 'invoicing' ), $label ); | 
| 166 | 166 | return $title; | 
| 167 | - } | |
| 167 | + } | |
| 168 | 168 | |
| 169 | - $screen = get_current_screen(); | |
| 169 | + $screen = get_current_screen(); | |
| 170 | 170 | |
| 171 | -     if ( 'wpi_invoice' == $screen->post_type ) { | |
| 171 | +        if ( 'wpi_invoice' == $screen->post_type ) { | |
| 172 | 172 | $label = wpinv_get_label_singular(); | 
| 173 | 173 | $title = sprintf( __( 'Enter %s name here', 'invoicing' ), $label ); | 
| 174 | - } | |
| 174 | + } | |
| 175 | 175 | |
| 176 | - return $title; | |
| 176 | + return $title; | |
| 177 | 177 | } | 
| 178 | 178 | add_filter( 'enter_title_here', 'wpinv_change_default_title' ); | 
| 179 | 179 | |
| @@ -166,13 +166,13 @@ | ||
| 166 | 166 | $is_writeable = $is_dir && is_writeable( $this->export_dir ); | 
| 167 | 167 | |
| 168 | 168 |              if ( $is_dir && $is_writeable ) { | 
| 169 | - return true; | |
| 169 | + return true; | |
| 170 | 170 |              } else if ( $is_dir && !$is_writeable ) { | 
| 171 | -               if ( !$this->wp_filesystem->chmod( $this->export_dir, FS_CHMOD_DIR ) ) { | |
| 172 | - return wp_sprintf( __( 'Filesystem ERROR: Export location %s is not writable, check your file permissions.', 'invoicing' ), $this->export_dir ); | |
| 173 | - } | |
| 171 | +                if ( !$this->wp_filesystem->chmod( $this->export_dir, FS_CHMOD_DIR ) ) { | |
| 172 | + return wp_sprintf( __( 'Filesystem ERROR: Export location %s is not writable, check your file permissions.', 'invoicing' ), $this->export_dir ); | |
| 173 | + } | |
| 174 | 174 | |
| 175 | - return true; | |
| 175 | + return true; | |
| 176 | 176 |              } else { | 
| 177 | 177 |                  if ( !$this->wp_filesystem->mkdir( $this->export_dir, FS_CHMOD_DIR ) ) { | 
| 178 | 178 | return wp_sprintf( __( 'Filesystem ERROR: Could not create directory %s. This is usually due to inconsistent file permissions.', 'invoicing' ), $this->export_dir ); | 
| @@ -437,7 +437,7 @@ | ||
| 437 | 437 | } | 
| 438 | 438 | |
| 439 | 439 |  function wpinv_get_php_arg_separator_output() { | 
| 440 | - return ini_get( 'arg_separator.output' ); | |
| 440 | + return ini_get( 'arg_separator.output' ); | |
| 441 | 441 | } | 
| 442 | 442 | |
| 443 | 443 |  function wpinv_rgb_from_hex( $color ) { | 
| @@ -5,12 +5,12 @@ | ||
| 5 | 5 | // @codingStandardsIgnoreFile | 
| 6 | 6 | |
| 7 | 7 | /** | 
| 8 | - * This interface exists to provide backwards compatibility with PHP 5.3 | |
| 9 | - * | |
| 10 | - * This should _not_ be used by any third-party code. | |
| 11 | - * | |
| 12 | - * @ignore | |
| 13 | - */ | |
| 8 | + * This interface exists to provide backwards compatibility with PHP 5.3 | |
| 9 | + * | |
| 10 | + * This should _not_ be used by any third-party code. | |
| 11 | + * | |
| 12 | + * @ignore | |
| 13 | + */ | |
| 14 | 14 |  if (interface_exists('JsonSerializable')) { | 
| 15 | 15 | interface JsonSerializable extends \JsonSerializable | 
| 16 | 16 |      { |