@@ -1,12 +1,12 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | // Exit if accessed directly |
| 3 | -if ( ! defined( 'ABSPATH' ) ) exit; |
|
| 3 | +if (!defined('ABSPATH')) exit; |
|
| 4 | 4 | |
| 5 | -add_action( 'wpinv_manual_cc_form', '__return_false' ); |
|
| 5 | +add_action('wpinv_manual_cc_form', '__return_false'); |
|
| 6 | 6 | |
| 7 | -function wpinv_process_manual_payment( $purchase_data ) { |
|
| 8 | - if( ! wp_verify_nonce( $purchase_data['gateway_nonce'], 'wpi-gateway' ) ) { |
|
| 9 | - wp_die( __( 'Nonce verification has failed', 'invoicing' ), __( 'Error', 'invoicing' ), array( 'response' => 403 ) ); |
|
| 7 | +function wpinv_process_manual_payment($purchase_data) { |
|
| 8 | + if (!wp_verify_nonce($purchase_data['gateway_nonce'], 'wpi-gateway')) { |
|
| 9 | + wp_die(__('Nonce verification has failed', 'invoicing'), __('Error', 'invoicing'), array('response' => 403)); |
|
| 10 | 10 | } |
| 11 | 11 | |
| 12 | 12 | /* |
@@ -41,20 +41,20 @@ discard block |
||
| 41 | 41 | ); |
| 42 | 42 | |
| 43 | 43 | // Record the pending payment |
| 44 | - $invoice = wpinv_get_invoice( $purchase_data['invoice_id'] ); |
|
| 44 | + $invoice = wpinv_get_invoice($purchase_data['invoice_id']); |
|
| 45 | 45 | |
| 46 | - if ( !empty( $invoice ) ) { |
|
| 47 | - wpinv_set_payment_transaction_id( $invoice->ID, $invoice->generate_key() ); |
|
| 48 | - wpinv_update_payment_status( $invoice, 'publish' ); |
|
| 46 | + if (!empty($invoice)) { |
|
| 47 | + wpinv_set_payment_transaction_id($invoice->ID, $invoice->generate_key()); |
|
| 48 | + wpinv_update_payment_status($invoice, 'publish'); |
|
| 49 | 49 | |
| 50 | 50 | // Empty the shopping cart |
| 51 | 51 | wpinv_empty_cart(); |
| 52 | 52 | |
| 53 | - wpinv_send_to_success_page( array( 'invoice_key' => $invoice->get_key() ) ); |
|
| 53 | + wpinv_send_to_success_page(array('invoice_key' => $invoice->get_key())); |
|
| 54 | 54 | } else { |
| 55 | - wpinv_record_gateway_error( __( 'Payment Error', 'invoicing' ), sprintf( __( 'Payment creation failed while processing a manual (free or test) purchase. Payment data: %s', 'invoicing' ), json_encode( $payment_data ) ), $invoice ); |
|
| 55 | + wpinv_record_gateway_error(__('Payment Error', 'invoicing'), sprintf(__('Payment creation failed while processing a manual (free or test) purchase. Payment data: %s', 'invoicing'), json_encode($payment_data)), $invoice); |
|
| 56 | 56 | // If errors are present, send the user back to the purchase page so they can be corrected |
| 57 | - wpinv_send_back_to_checkout( '?payment-mode=' . $purchase_data['post_data']['wpi-gateway'] ); |
|
| 57 | + wpinv_send_back_to_checkout('?payment-mode=' . $purchase_data['post_data']['wpi-gateway']); |
|
| 58 | 58 | } |
| 59 | 59 | } |
| 60 | -add_action( 'wpinv_gateway_manual', 'wpinv_process_manual_payment' ); |
|
| 61 | 60 | \ No newline at end of file |
| 61 | +add_action('wpinv_gateway_manual', 'wpinv_process_manual_payment'); |
|
| 62 | 62 | \ No newline at end of file |
@@ -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 | add_action( 'wpinv_manual_cc_form', '__return_false' ); |
| 6 | 8 | |
@@ -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 | add_action( 'wpinv_bank_transfer_cc_form', '__return_false' ); |
| 6 | 8 | |
@@ -1,12 +1,12 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | // Exit if accessed directly |
| 3 | -if ( ! defined( 'ABSPATH' ) ) exit; |
|
| 3 | +if (!defined('ABSPATH')) exit; |
|
| 4 | 4 | |
| 5 | -add_action( 'wpinv_bank_transfer_cc_form', '__return_false' ); |
|
| 5 | +add_action('wpinv_bank_transfer_cc_form', '__return_false'); |
|
| 6 | 6 | |
| 7 | -function wpinv_process_bank_transfer_payment( $purchase_data ) { |
|
| 8 | - if( ! wp_verify_nonce( $purchase_data['gateway_nonce'], 'wpi-gateway' ) ) { |
|
| 9 | - wp_die( __( 'Nonce verification has failed', 'invoicing' ), __( 'Error', 'invoicing' ), array( 'response' => 403 ) ); |
|
| 7 | +function wpinv_process_bank_transfer_payment($purchase_data) { |
|
| 8 | + if (!wp_verify_nonce($purchase_data['gateway_nonce'], 'wpi-gateway')) { |
|
| 9 | + wp_die(__('Nonce verification has failed', 'invoicing'), __('Error', 'invoicing'), array('response' => 403)); |
|
| 10 | 10 | } |
| 11 | 11 | |
| 12 | 12 | // Collect payment data |
@@ -24,37 +24,37 @@ discard block |
||
| 24 | 24 | ); |
| 25 | 25 | |
| 26 | 26 | // Record the pending payment |
| 27 | - $invoice = wpinv_get_invoice( $purchase_data['invoice_id'] ); |
|
| 27 | + $invoice = wpinv_get_invoice($purchase_data['invoice_id']); |
|
| 28 | 28 | |
| 29 | - if ( !empty( $invoice ) ) { |
|
| 30 | - wpinv_set_payment_transaction_id( $invoice->ID, $invoice->generate_key() ); |
|
| 31 | - wpinv_update_payment_status( $invoice, 'wpi-pending' ); |
|
| 29 | + if (!empty($invoice)) { |
|
| 30 | + wpinv_set_payment_transaction_id($invoice->ID, $invoice->generate_key()); |
|
| 31 | + wpinv_update_payment_status($invoice, 'wpi-pending'); |
|
| 32 | 32 | |
| 33 | 33 | // Empty the shopping cart |
| 34 | 34 | wpinv_empty_cart(); |
| 35 | 35 | |
| 36 | - wpinv_send_to_success_page( array( 'invoice_key' => $invoice->get_key() ) ); |
|
| 36 | + wpinv_send_to_success_page(array('invoice_key' => $invoice->get_key())); |
|
| 37 | 37 | } else { |
| 38 | - wpinv_record_gateway_error( __( 'Payment Error', 'invoicing' ), sprintf( __( 'Payment creation failed while processing a bank transfer payment. Payment data: %s', 'invoicing' ), json_encode( $payment_data ) ), $invoice ); |
|
| 38 | + wpinv_record_gateway_error(__('Payment Error', 'invoicing'), sprintf(__('Payment creation failed while processing a bank transfer payment. Payment data: %s', 'invoicing'), json_encode($payment_data)), $invoice); |
|
| 39 | 39 | // If errors are present, send the user back to the purchase page so they can be corrected |
| 40 | - wpinv_send_back_to_checkout( '?payment-mode=' . $purchase_data['post_data']['wpi-gateway'] ); |
|
| 40 | + wpinv_send_back_to_checkout('?payment-mode=' . $purchase_data['post_data']['wpi-gateway']); |
|
| 41 | 41 | } |
| 42 | 42 | } |
| 43 | -add_action( 'wpinv_gateway_bank_transfer', 'wpinv_process_bank_transfer_payment' ); |
|
| 43 | +add_action('wpinv_gateway_bank_transfer', 'wpinv_process_bank_transfer_payment'); |
|
| 44 | 44 | |
| 45 | -function wpinv_show_bank_info( $invoice ) { |
|
| 46 | - if ( !empty( $invoice ) && $invoice->gateway == 'bank_transfer' && $invoice->status == 'wpi-pending' ) { |
|
| 47 | - $bank_info = wpinv_get_bank_info( true ); |
|
| 45 | +function wpinv_show_bank_info($invoice) { |
|
| 46 | + if (!empty($invoice) && $invoice->gateway == 'bank_transfer' && $invoice->status == 'wpi-pending') { |
|
| 47 | + $bank_info = wpinv_get_bank_info(true); |
|
| 48 | 48 | ?> |
| 49 | 49 | <div class="wpinv-bank-details"> |
| 50 | - <?php if ( $instructions = wpinv_get_bank_instructions() ) { ?> |
|
| 51 | - <div class="alert bg-info"><?php echo wpautop( wp_kses_post( $instructions ) ); ?></div> |
|
| 50 | + <?php if ($instructions = wpinv_get_bank_instructions()) { ?> |
|
| 51 | + <div class="alert bg-info"><?php echo wpautop(wp_kses_post($instructions)); ?></div> |
|
| 52 | 52 | <?php } ?> |
| 53 | - <?php if ( !empty( $bank_info ) ) { ?> |
|
| 54 | - <h3 class="wpinv-bank-t"><?php echo apply_filters( 'wpinv_receipt_bank_details_title', __( 'Our Bank Details', 'invoicing' ) ); ?></h3> |
|
| 53 | + <?php if (!empty($bank_info)) { ?> |
|
| 54 | + <h3 class="wpinv-bank-t"><?php echo apply_filters('wpinv_receipt_bank_details_title', __('Our Bank Details', 'invoicing')); ?></h3> |
|
| 55 | 55 | <table class="table table-bordered table-sm wpi-bank-details"> |
| 56 | - <?php foreach ( $bank_info as $key => $info ) { ?> |
|
| 57 | - <tr class="wpi-<?php echo sanitize_html_class( $key );?>"><th class="text-left"><?php echo $info['label'] ;?></th><td><?php echo $info['value'] ;?></td></tr> |
|
| 56 | + <?php foreach ($bank_info as $key => $info) { ?> |
|
| 57 | + <tr class="wpi-<?php echo sanitize_html_class($key); ?>"><th class="text-left"><?php echo $info['label']; ?></th><td><?php echo $info['value']; ?></td></tr> |
|
| 58 | 58 | <?php } ?> |
| 59 | 59 | </table> |
| 60 | 60 | <?php } ?> |
@@ -62,15 +62,15 @@ discard block |
||
| 62 | 62 | <?php |
| 63 | 63 | } |
| 64 | 64 | } |
| 65 | -add_action( 'wpinv_before_receipt_details', 'wpinv_show_bank_info', 10, 1 ); |
|
| 65 | +add_action('wpinv_before_receipt_details', 'wpinv_show_bank_info', 10, 1); |
|
| 66 | 66 | |
| 67 | -function wpinv_invoice_print_bank_info( $invoice ) { |
|
| 68 | - if ( !empty( $invoice ) && $invoice->gateway == 'bank_transfer' && $invoice->status == 'wpi-pending' ) { |
|
| 67 | +function wpinv_invoice_print_bank_info($invoice) { |
|
| 68 | + if (!empty($invoice) && $invoice->gateway == 'bank_transfer' && $invoice->status == 'wpi-pending') { |
|
| 69 | 69 | ?> |
| 70 | 70 | <div class="row wpinv-bank-info"> |
| 71 | - <?php echo wpinv_show_bank_info( $invoice ); ?> |
|
| 71 | + <?php echo wpinv_show_bank_info($invoice); ?> |
|
| 72 | 72 | </div> |
| 73 | 73 | <?php |
| 74 | 74 | } |
| 75 | 75 | } |
| 76 | -add_action( 'wpinv_invoice_print_after_top_content', 'wpinv_invoice_print_bank_info', 10, 1 ); |
|
| 77 | 76 | \ No newline at end of file |
| 77 | +add_action('wpinv_invoice_print_after_top_content', 'wpinv_invoice_print_bank_info', 10, 1); |
|
| 78 | 78 | \ No newline at end of file |
@@ -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 | add_action( 'wpinv_paypal_cc_form', '__return_false' ); |
| 6 | 8 | add_filter( 'wpinv_paypal_support_subscription', '__return_true' ); |
@@ -307,8 +309,9 @@ discard block |
||
| 307 | 309 | } |
| 308 | 310 | |
| 309 | 311 | // Check if $post_data_array has been populated |
| 310 | - if ( !is_array( $encoded_data_array ) && !empty( $encoded_data_array ) ) |
|
| 311 | - return; |
|
| 312 | + if ( !is_array( $encoded_data_array ) && !empty( $encoded_data_array ) ) { |
|
| 313 | + return; |
|
| 314 | + } |
|
| 312 | 315 | |
| 313 | 316 | $defaults = array( |
| 314 | 317 | 'txn_type' => '', |
@@ -218,261 +218,261 @@ discard block |
||
| 218 | 218 | add_filter( 'wpinv_paypal_args', 'wpinv_get_paypal_recurring_args', 10, 3 ); |
| 219 | 219 | |
| 220 | 220 | function wpinv_process_paypal_ipn() { |
| 221 | - // Check the request method is POST |
|
| 222 | - if ( isset( $_SERVER['REQUEST_METHOD'] ) && $_SERVER['REQUEST_METHOD'] != 'POST' ) { |
|
| 223 | - return; |
|
| 224 | - } |
|
| 225 | - |
|
| 226 | - // Set initial post data to empty string |
|
| 227 | - $post_data = ''; |
|
| 228 | - |
|
| 229 | - // Fallback just in case post_max_size is lower than needed |
|
| 230 | - if ( ini_get( 'allow_url_fopen' ) ) { |
|
| 231 | - $post_data = file_get_contents( 'php://input' ); |
|
| 232 | - } else { |
|
| 233 | - // If allow_url_fopen is not enabled, then make sure that post_max_size is large enough |
|
| 234 | - ini_set( 'post_max_size', '12M' ); |
|
| 235 | - } |
|
| 236 | - // Start the encoded data collection with notification command |
|
| 237 | - $encoded_data = 'cmd=_notify-validate'; |
|
| 238 | - |
|
| 239 | - // Get current arg separator |
|
| 240 | - $arg_separator = wpinv_get_php_arg_separator_output(); |
|
| 241 | - |
|
| 242 | - // Verify there is a post_data |
|
| 243 | - if ( $post_data || strlen( $post_data ) > 0 ) { |
|
| 244 | - // Append the data |
|
| 245 | - $encoded_data .= $arg_separator.$post_data; |
|
| 246 | - } else { |
|
| 247 | - // Check if POST is empty |
|
| 248 | - if ( empty( $_POST ) ) { |
|
| 249 | - // Nothing to do |
|
| 250 | - return; |
|
| 251 | - } else { |
|
| 252 | - // Loop through each POST |
|
| 253 | - foreach ( $_POST as $key => $value ) { |
|
| 254 | - // Encode the value and append the data |
|
| 255 | - $encoded_data .= $arg_separator."$key=" . urlencode( $value ); |
|
| 256 | - } |
|
| 257 | - } |
|
| 258 | - } |
|
| 259 | - |
|
| 260 | - // Convert collected post data to an array |
|
| 261 | - parse_str( $encoded_data, $encoded_data_array ); |
|
| 262 | - |
|
| 263 | - foreach ( $encoded_data_array as $key => $value ) { |
|
| 264 | - if ( false !== strpos( $key, 'amp;' ) ) { |
|
| 265 | - $new_key = str_replace( '&', '&', $key ); |
|
| 266 | - $new_key = str_replace( 'amp;', '&' , $new_key ); |
|
| 267 | - |
|
| 268 | - unset( $encoded_data_array[ $key ] ); |
|
| 269 | - $encoded_data_array[ $new_key ] = $value; |
|
| 270 | - } |
|
| 271 | - } |
|
| 272 | - |
|
| 273 | - // Get the PayPal redirect uri |
|
| 274 | - $paypal_redirect = wpinv_get_paypal_redirect( true ); |
|
| 275 | - |
|
| 276 | - if ( !wpinv_get_option( 'disable_paypal_verification', false ) ) { |
|
| 277 | - // Validate the IPN |
|
| 278 | - |
|
| 279 | - $remote_post_vars = array( |
|
| 280 | - 'method' => 'POST', |
|
| 281 | - 'timeout' => 45, |
|
| 282 | - 'redirection' => 5, |
|
| 283 | - 'httpversion' => '1.1', |
|
| 284 | - 'blocking' => true, |
|
| 285 | - 'headers' => array( |
|
| 286 | - 'host' => 'www.paypal.com', |
|
| 287 | - 'connection' => 'close', |
|
| 288 | - 'content-type' => 'application/x-www-form-urlencoded', |
|
| 289 | - 'post' => '/cgi-bin/webscr HTTP/1.1', |
|
| 290 | - |
|
| 291 | - ), |
|
| 292 | - 'sslverify' => false, |
|
| 293 | - 'body' => $encoded_data_array |
|
| 294 | - ); |
|
| 295 | - |
|
| 296 | - // Get response |
|
| 297 | - $api_response = wp_remote_post( wpinv_get_paypal_redirect(), $remote_post_vars ); |
|
| 298 | - |
|
| 299 | - if ( is_wp_error( $api_response ) ) { |
|
| 300 | - wpinv_record_gateway_error( __( 'IPN Error', 'invoicing' ), sprintf( __( 'Invalid IPN verification response. IPN data: %s', 'invoicing' ), json_encode( $api_response ) ) ); |
|
| 301 | - return; // Something went wrong |
|
| 302 | - } |
|
| 303 | - |
|
| 304 | - if ( $api_response['body'] !== 'VERIFIED' && wpinv_get_option( 'disable_paypal_verification', false ) ) { |
|
| 305 | - wpinv_record_gateway_error( __( 'IPN Error', 'invoicing' ), sprintf( __( 'Invalid IPN verification response. IPN data: %s', 'invoicing' ), json_encode( $api_response ) ) ); |
|
| 306 | - return; // Response not okay |
|
| 307 | - } |
|
| 308 | - } |
|
| 309 | - |
|
| 310 | - // Check if $post_data_array has been populated |
|
| 311 | - if ( !is_array( $encoded_data_array ) && !empty( $encoded_data_array ) ) |
|
| 312 | - return; |
|
| 313 | - |
|
| 314 | - $defaults = array( |
|
| 315 | - 'txn_type' => '', |
|
| 316 | - 'payment_status' => '' |
|
| 317 | - ); |
|
| 318 | - |
|
| 319 | - $encoded_data_array = wp_parse_args( $encoded_data_array, $defaults ); |
|
| 320 | - |
|
| 321 | - $invoice_id = isset( $encoded_data_array['custom'] ) ? absint( $encoded_data_array['custom'] ) : 0; |
|
| 221 | + // Check the request method is POST |
|
| 222 | + if ( isset( $_SERVER['REQUEST_METHOD'] ) && $_SERVER['REQUEST_METHOD'] != 'POST' ) { |
|
| 223 | + return; |
|
| 224 | + } |
|
| 225 | + |
|
| 226 | + // Set initial post data to empty string |
|
| 227 | + $post_data = ''; |
|
| 228 | + |
|
| 229 | + // Fallback just in case post_max_size is lower than needed |
|
| 230 | + if ( ini_get( 'allow_url_fopen' ) ) { |
|
| 231 | + $post_data = file_get_contents( 'php://input' ); |
|
| 232 | + } else { |
|
| 233 | + // If allow_url_fopen is not enabled, then make sure that post_max_size is large enough |
|
| 234 | + ini_set( 'post_max_size', '12M' ); |
|
| 235 | + } |
|
| 236 | + // Start the encoded data collection with notification command |
|
| 237 | + $encoded_data = 'cmd=_notify-validate'; |
|
| 238 | + |
|
| 239 | + // Get current arg separator |
|
| 240 | + $arg_separator = wpinv_get_php_arg_separator_output(); |
|
| 241 | + |
|
| 242 | + // Verify there is a post_data |
|
| 243 | + if ( $post_data || strlen( $post_data ) > 0 ) { |
|
| 244 | + // Append the data |
|
| 245 | + $encoded_data .= $arg_separator.$post_data; |
|
| 246 | + } else { |
|
| 247 | + // Check if POST is empty |
|
| 248 | + if ( empty( $_POST ) ) { |
|
| 249 | + // Nothing to do |
|
| 250 | + return; |
|
| 251 | + } else { |
|
| 252 | + // Loop through each POST |
|
| 253 | + foreach ( $_POST as $key => $value ) { |
|
| 254 | + // Encode the value and append the data |
|
| 255 | + $encoded_data .= $arg_separator."$key=" . urlencode( $value ); |
|
| 256 | + } |
|
| 257 | + } |
|
| 258 | + } |
|
| 259 | + |
|
| 260 | + // Convert collected post data to an array |
|
| 261 | + parse_str( $encoded_data, $encoded_data_array ); |
|
| 262 | + |
|
| 263 | + foreach ( $encoded_data_array as $key => $value ) { |
|
| 264 | + if ( false !== strpos( $key, 'amp;' ) ) { |
|
| 265 | + $new_key = str_replace( '&', '&', $key ); |
|
| 266 | + $new_key = str_replace( 'amp;', '&' , $new_key ); |
|
| 267 | + |
|
| 268 | + unset( $encoded_data_array[ $key ] ); |
|
| 269 | + $encoded_data_array[ $new_key ] = $value; |
|
| 270 | + } |
|
| 271 | + } |
|
| 272 | + |
|
| 273 | + // Get the PayPal redirect uri |
|
| 274 | + $paypal_redirect = wpinv_get_paypal_redirect( true ); |
|
| 275 | + |
|
| 276 | + if ( !wpinv_get_option( 'disable_paypal_verification', false ) ) { |
|
| 277 | + // Validate the IPN |
|
| 278 | + |
|
| 279 | + $remote_post_vars = array( |
|
| 280 | + 'method' => 'POST', |
|
| 281 | + 'timeout' => 45, |
|
| 282 | + 'redirection' => 5, |
|
| 283 | + 'httpversion' => '1.1', |
|
| 284 | + 'blocking' => true, |
|
| 285 | + 'headers' => array( |
|
| 286 | + 'host' => 'www.paypal.com', |
|
| 287 | + 'connection' => 'close', |
|
| 288 | + 'content-type' => 'application/x-www-form-urlencoded', |
|
| 289 | + 'post' => '/cgi-bin/webscr HTTP/1.1', |
|
| 290 | + |
|
| 291 | + ), |
|
| 292 | + 'sslverify' => false, |
|
| 293 | + 'body' => $encoded_data_array |
|
| 294 | + ); |
|
| 295 | + |
|
| 296 | + // Get response |
|
| 297 | + $api_response = wp_remote_post( wpinv_get_paypal_redirect(), $remote_post_vars ); |
|
| 298 | + |
|
| 299 | + if ( is_wp_error( $api_response ) ) { |
|
| 300 | + wpinv_record_gateway_error( __( 'IPN Error', 'invoicing' ), sprintf( __( 'Invalid IPN verification response. IPN data: %s', 'invoicing' ), json_encode( $api_response ) ) ); |
|
| 301 | + return; // Something went wrong |
|
| 302 | + } |
|
| 303 | + |
|
| 304 | + if ( $api_response['body'] !== 'VERIFIED' && wpinv_get_option( 'disable_paypal_verification', false ) ) { |
|
| 305 | + wpinv_record_gateway_error( __( 'IPN Error', 'invoicing' ), sprintf( __( 'Invalid IPN verification response. IPN data: %s', 'invoicing' ), json_encode( $api_response ) ) ); |
|
| 306 | + return; // Response not okay |
|
| 307 | + } |
|
| 308 | + } |
|
| 309 | + |
|
| 310 | + // Check if $post_data_array has been populated |
|
| 311 | + if ( !is_array( $encoded_data_array ) && !empty( $encoded_data_array ) ) |
|
| 312 | + return; |
|
| 313 | + |
|
| 314 | + $defaults = array( |
|
| 315 | + 'txn_type' => '', |
|
| 316 | + 'payment_status' => '' |
|
| 317 | + ); |
|
| 318 | + |
|
| 319 | + $encoded_data_array = wp_parse_args( $encoded_data_array, $defaults ); |
|
| 320 | + |
|
| 321 | + $invoice_id = isset( $encoded_data_array['custom'] ) ? absint( $encoded_data_array['custom'] ) : 0; |
|
| 322 | 322 | |
| 323 | - wpinv_error_log( $encoded_data_array['txn_type'], 'PayPal txn_type', __FILE__, __LINE__ ); |
|
| 324 | - |
|
| 325 | - if ( has_action( 'wpinv_paypal_' . $encoded_data_array['txn_type'] ) ) { |
|
| 326 | - // Allow PayPal IPN types to be processed separately |
|
| 327 | - do_action( 'wpinv_paypal_' . $encoded_data_array['txn_type'], $encoded_data_array, $invoice_id ); |
|
| 328 | - } else { |
|
| 329 | - // Fallback to web accept just in case the txn_type isn't present |
|
| 330 | - do_action( 'wpinv_paypal_web_accept', $encoded_data_array, $invoice_id ); |
|
| 331 | - } |
|
| 332 | - exit; |
|
| 323 | + wpinv_error_log( $encoded_data_array['txn_type'], 'PayPal txn_type', __FILE__, __LINE__ ); |
|
| 324 | + |
|
| 325 | + if ( has_action( 'wpinv_paypal_' . $encoded_data_array['txn_type'] ) ) { |
|
| 326 | + // Allow PayPal IPN types to be processed separately |
|
| 327 | + do_action( 'wpinv_paypal_' . $encoded_data_array['txn_type'], $encoded_data_array, $invoice_id ); |
|
| 328 | + } else { |
|
| 329 | + // Fallback to web accept just in case the txn_type isn't present |
|
| 330 | + do_action( 'wpinv_paypal_web_accept', $encoded_data_array, $invoice_id ); |
|
| 331 | + } |
|
| 332 | + exit; |
|
| 333 | 333 | } |
| 334 | 334 | add_action( 'wpinv_verify_paypal_ipn', 'wpinv_process_paypal_ipn' ); |
| 335 | 335 | |
| 336 | 336 | function wpinv_process_paypal_web_accept_and_cart( $data, $invoice_id ) { |
| 337 | - if ( $data['txn_type'] != 'web_accept' && $data['txn_type'] != 'cart' && $data['payment_status'] != 'Refunded' ) { |
|
| 338 | - return; |
|
| 339 | - } |
|
| 340 | - |
|
| 341 | - if( empty( $invoice_id ) ) { |
|
| 342 | - return; |
|
| 343 | - } |
|
| 344 | - |
|
| 345 | - // Collect payment details |
|
| 346 | - $purchase_key = isset( $data['invoice'] ) ? $data['invoice'] : $data['item_number']; |
|
| 347 | - $paypal_amount = $data['mc_gross']; |
|
| 348 | - $payment_status = strtolower( $data['payment_status'] ); |
|
| 349 | - $currency_code = strtolower( $data['mc_currency'] ); |
|
| 350 | - $business_email = isset( $data['business'] ) && is_email( $data['business'] ) ? trim( $data['business'] ) : trim( $data['receiver_email'] ); |
|
| 351 | - $payment_meta = wpinv_get_invoice_meta( $invoice_id ); |
|
| 352 | - |
|
| 353 | - if ( wpinv_get_payment_gateway( $invoice_id ) != 'paypal' ) { |
|
| 354 | - return; // this isn't a PayPal standard IPN |
|
| 355 | - } |
|
| 356 | - |
|
| 357 | - // Verify payment recipient |
|
| 358 | - if ( strcasecmp( $business_email, trim( wpinv_get_option( 'paypal_email', false ) ) ) != 0 ) { |
|
| 359 | - wpinv_record_gateway_error( __( 'IPN Error', 'invoicing' ), sprintf( __( 'Invalid business email in IPN response. IPN data: %s', 'invoicing' ), json_encode( $data ) ), $invoice_id ); |
|
| 360 | - wpinv_update_payment_status( $invoice_id, 'wpi-failed' ); |
|
| 361 | - wpinv_insert_payment_note( $invoice_id, __( 'Payment failed due to invalid PayPal business email.', 'invoicing' ) ); |
|
| 362 | - return; |
|
| 363 | - } |
|
| 364 | - |
|
| 365 | - // Verify payment currency |
|
| 366 | - if ( $currency_code != strtolower( $payment_meta['currency'] ) ) { |
|
| 367 | - wpinv_record_gateway_error( __( 'IPN Error', 'invoicing' ), sprintf( __( 'Invalid currency in IPN response. IPN data: %s', 'invoicing' ), json_encode( $data ) ), $invoice_id ); |
|
| 368 | - wpinv_update_payment_status( $invoice_id, 'wpi-failed' ); |
|
| 369 | - wpinv_insert_payment_note( $invoice_id, __( 'Payment failed due to invalid currency in PayPal IPN.', 'invoicing' ) ); |
|
| 370 | - return; |
|
| 371 | - } |
|
| 372 | - |
|
| 373 | - if ( !wpinv_get_payment_user_email( $invoice_id ) ) { |
|
| 374 | - // This runs when a Buy Now purchase was made. It bypasses checkout so no personal info is collected until PayPal |
|
| 375 | - // No email associated with purchase, so store from PayPal |
|
| 376 | - wpinv_update_invoice_meta( $invoice_id, '_wpinv_email', $data['payer_email'] ); |
|
| 377 | - |
|
| 378 | - // Setup and store the customer's details |
|
| 379 | - $user_info = array( |
|
| 380 | - 'user_id' => '-1', |
|
| 381 | - 'email' => sanitize_text_field( $data['payer_email'] ), |
|
| 382 | - 'first_name' => sanitize_text_field( $data['first_name'] ), |
|
| 383 | - 'last_name' => sanitize_text_field( $data['last_name'] ), |
|
| 384 | - 'discount' => '', |
|
| 385 | - ); |
|
| 386 | - $user_info['address'] = ! empty( $data['address_street'] ) ? sanitize_text_field( $data['address_street'] ) : false; |
|
| 387 | - $user_info['city'] = ! empty( $data['address_city'] ) ? sanitize_text_field( $data['address_city'] ) : false; |
|
| 388 | - $user_info['state'] = ! empty( $data['address_state'] ) ? sanitize_text_field( $data['address_state'] ) : false; |
|
| 389 | - $user_info['country'] = ! empty( $data['address_country_code'] ) ? sanitize_text_field( $data['address_country_code'] ) : false; |
|
| 390 | - $user_info['zip'] = ! empty( $data['address_zip'] ) ? sanitize_text_field( $data['address_zip'] ) : false; |
|
| 391 | - |
|
| 392 | - $payment_meta['user_info'] = $user_info; |
|
| 393 | - wpinv_update_invoice_meta( $invoice_id, '_wpinv_payment_meta', $payment_meta ); |
|
| 394 | - } |
|
| 395 | - |
|
| 396 | - if ( $payment_status == 'refunded' || $payment_status == 'reversed' ) { |
|
| 397 | - // Process a refund |
|
| 398 | - wpinv_process_paypal_refund( $data, $invoice_id ); |
|
| 399 | - } else { |
|
| 400 | - if ( get_post_status( $invoice_id ) == 'publish' ) { |
|
| 401 | - return; // Only paid payments once |
|
| 402 | - } |
|
| 403 | - |
|
| 404 | - // Retrieve the total purchase amount (before PayPal) |
|
| 405 | - $payment_amount = wpinv_payment_total( $invoice_id ); |
|
| 406 | - |
|
| 407 | - if ( number_format( (float) $paypal_amount, 2 ) < number_format( (float) $payment_amount, 2 ) ) { |
|
| 408 | - // The prices don't match |
|
| 409 | - wpinv_record_gateway_error( __( 'IPN Error', 'invoicing' ), sprintf( __( 'Invalid payment amount in IPN response. IPN data: %s', 'invoicing' ), json_encode( $data ) ), $invoice_id ); |
|
| 410 | - wpinv_update_payment_status( $invoice_id, 'wpi-failed' ); |
|
| 411 | - wpinv_insert_payment_note( $invoice_id, __( 'Payment failed due to invalid amount in PayPal IPN.', 'invoicing' ) ); |
|
| 412 | - return; |
|
| 413 | - } |
|
| 414 | - if ( $purchase_key != wpinv_get_payment_key( $invoice_id ) ) { |
|
| 415 | - // Purchase keys don't match |
|
| 416 | - wpinv_record_gateway_error( __( 'IPN Error', 'invoicing' ), sprintf( __( 'Invalid purchase key in IPN response. IPN data: %s', 'invoicing' ), json_encode( $data ) ), $invoice_id ); |
|
| 417 | - wpinv_update_payment_status( $invoice_id, 'wpi-failed' ); |
|
| 418 | - wpinv_insert_payment_note( $invoice_id, __( 'Payment failed due to invalid purchase key in PayPal IPN.', 'invoicing' ) ); |
|
| 419 | - return; |
|
| 420 | - } |
|
| 421 | - |
|
| 422 | - if ( 'complete' == $payment_status || 'completed' == $payment_status || 'processed' == $payment_status || wpinv_is_test_mode( 'paypal' ) ) { |
|
| 423 | - wpinv_insert_payment_note( $invoice_id, sprintf( __( 'PayPal Transaction ID: %s', 'invoicing' ) , $data['txn_id'] ) ); |
|
| 424 | - wpinv_set_payment_transaction_id( $invoice_id, $data['txn_id'] ); |
|
| 425 | - wpinv_update_payment_status( $invoice_id, 'publish' ); |
|
| 426 | - } else if ( 'wpi-pending' == $payment_status && isset( $data['pending_reason'] ) ) { |
|
| 427 | - // Look for possible pending reasons, such as an echeck |
|
| 428 | - $note = ''; |
|
| 429 | - |
|
| 430 | - switch( strtolower( $data['pending_reason'] ) ) { |
|
| 431 | - case 'echeck' : |
|
| 432 | - $note = __( 'Payment made via eCheck and will clear automatically in 5-8 days', 'invoicing' ); |
|
| 433 | - break; |
|
| 337 | + if ( $data['txn_type'] != 'web_accept' && $data['txn_type'] != 'cart' && $data['payment_status'] != 'Refunded' ) { |
|
| 338 | + return; |
|
| 339 | + } |
|
| 340 | + |
|
| 341 | + if( empty( $invoice_id ) ) { |
|
| 342 | + return; |
|
| 343 | + } |
|
| 344 | + |
|
| 345 | + // Collect payment details |
|
| 346 | + $purchase_key = isset( $data['invoice'] ) ? $data['invoice'] : $data['item_number']; |
|
| 347 | + $paypal_amount = $data['mc_gross']; |
|
| 348 | + $payment_status = strtolower( $data['payment_status'] ); |
|
| 349 | + $currency_code = strtolower( $data['mc_currency'] ); |
|
| 350 | + $business_email = isset( $data['business'] ) && is_email( $data['business'] ) ? trim( $data['business'] ) : trim( $data['receiver_email'] ); |
|
| 351 | + $payment_meta = wpinv_get_invoice_meta( $invoice_id ); |
|
| 352 | + |
|
| 353 | + if ( wpinv_get_payment_gateway( $invoice_id ) != 'paypal' ) { |
|
| 354 | + return; // this isn't a PayPal standard IPN |
|
| 355 | + } |
|
| 356 | + |
|
| 357 | + // Verify payment recipient |
|
| 358 | + if ( strcasecmp( $business_email, trim( wpinv_get_option( 'paypal_email', false ) ) ) != 0 ) { |
|
| 359 | + wpinv_record_gateway_error( __( 'IPN Error', 'invoicing' ), sprintf( __( 'Invalid business email in IPN response. IPN data: %s', 'invoicing' ), json_encode( $data ) ), $invoice_id ); |
|
| 360 | + wpinv_update_payment_status( $invoice_id, 'wpi-failed' ); |
|
| 361 | + wpinv_insert_payment_note( $invoice_id, __( 'Payment failed due to invalid PayPal business email.', 'invoicing' ) ); |
|
| 362 | + return; |
|
| 363 | + } |
|
| 364 | + |
|
| 365 | + // Verify payment currency |
|
| 366 | + if ( $currency_code != strtolower( $payment_meta['currency'] ) ) { |
|
| 367 | + wpinv_record_gateway_error( __( 'IPN Error', 'invoicing' ), sprintf( __( 'Invalid currency in IPN response. IPN data: %s', 'invoicing' ), json_encode( $data ) ), $invoice_id ); |
|
| 368 | + wpinv_update_payment_status( $invoice_id, 'wpi-failed' ); |
|
| 369 | + wpinv_insert_payment_note( $invoice_id, __( 'Payment failed due to invalid currency in PayPal IPN.', 'invoicing' ) ); |
|
| 370 | + return; |
|
| 371 | + } |
|
| 372 | + |
|
| 373 | + if ( !wpinv_get_payment_user_email( $invoice_id ) ) { |
|
| 374 | + // This runs when a Buy Now purchase was made. It bypasses checkout so no personal info is collected until PayPal |
|
| 375 | + // No email associated with purchase, so store from PayPal |
|
| 376 | + wpinv_update_invoice_meta( $invoice_id, '_wpinv_email', $data['payer_email'] ); |
|
| 377 | + |
|
| 378 | + // Setup and store the customer's details |
|
| 379 | + $user_info = array( |
|
| 380 | + 'user_id' => '-1', |
|
| 381 | + 'email' => sanitize_text_field( $data['payer_email'] ), |
|
| 382 | + 'first_name' => sanitize_text_field( $data['first_name'] ), |
|
| 383 | + 'last_name' => sanitize_text_field( $data['last_name'] ), |
|
| 384 | + 'discount' => '', |
|
| 385 | + ); |
|
| 386 | + $user_info['address'] = ! empty( $data['address_street'] ) ? sanitize_text_field( $data['address_street'] ) : false; |
|
| 387 | + $user_info['city'] = ! empty( $data['address_city'] ) ? sanitize_text_field( $data['address_city'] ) : false; |
|
| 388 | + $user_info['state'] = ! empty( $data['address_state'] ) ? sanitize_text_field( $data['address_state'] ) : false; |
|
| 389 | + $user_info['country'] = ! empty( $data['address_country_code'] ) ? sanitize_text_field( $data['address_country_code'] ) : false; |
|
| 390 | + $user_info['zip'] = ! empty( $data['address_zip'] ) ? sanitize_text_field( $data['address_zip'] ) : false; |
|
| 391 | + |
|
| 392 | + $payment_meta['user_info'] = $user_info; |
|
| 393 | + wpinv_update_invoice_meta( $invoice_id, '_wpinv_payment_meta', $payment_meta ); |
|
| 394 | + } |
|
| 395 | + |
|
| 396 | + if ( $payment_status == 'refunded' || $payment_status == 'reversed' ) { |
|
| 397 | + // Process a refund |
|
| 398 | + wpinv_process_paypal_refund( $data, $invoice_id ); |
|
| 399 | + } else { |
|
| 400 | + if ( get_post_status( $invoice_id ) == 'publish' ) { |
|
| 401 | + return; // Only paid payments once |
|
| 402 | + } |
|
| 403 | + |
|
| 404 | + // Retrieve the total purchase amount (before PayPal) |
|
| 405 | + $payment_amount = wpinv_payment_total( $invoice_id ); |
|
| 406 | + |
|
| 407 | + if ( number_format( (float) $paypal_amount, 2 ) < number_format( (float) $payment_amount, 2 ) ) { |
|
| 408 | + // The prices don't match |
|
| 409 | + wpinv_record_gateway_error( __( 'IPN Error', 'invoicing' ), sprintf( __( 'Invalid payment amount in IPN response. IPN data: %s', 'invoicing' ), json_encode( $data ) ), $invoice_id ); |
|
| 410 | + wpinv_update_payment_status( $invoice_id, 'wpi-failed' ); |
|
| 411 | + wpinv_insert_payment_note( $invoice_id, __( 'Payment failed due to invalid amount in PayPal IPN.', 'invoicing' ) ); |
|
| 412 | + return; |
|
| 413 | + } |
|
| 414 | + if ( $purchase_key != wpinv_get_payment_key( $invoice_id ) ) { |
|
| 415 | + // Purchase keys don't match |
|
| 416 | + wpinv_record_gateway_error( __( 'IPN Error', 'invoicing' ), sprintf( __( 'Invalid purchase key in IPN response. IPN data: %s', 'invoicing' ), json_encode( $data ) ), $invoice_id ); |
|
| 417 | + wpinv_update_payment_status( $invoice_id, 'wpi-failed' ); |
|
| 418 | + wpinv_insert_payment_note( $invoice_id, __( 'Payment failed due to invalid purchase key in PayPal IPN.', 'invoicing' ) ); |
|
| 419 | + return; |
|
| 420 | + } |
|
| 421 | + |
|
| 422 | + if ( 'complete' == $payment_status || 'completed' == $payment_status || 'processed' == $payment_status || wpinv_is_test_mode( 'paypal' ) ) { |
|
| 423 | + wpinv_insert_payment_note( $invoice_id, sprintf( __( 'PayPal Transaction ID: %s', 'invoicing' ) , $data['txn_id'] ) ); |
|
| 424 | + wpinv_set_payment_transaction_id( $invoice_id, $data['txn_id'] ); |
|
| 425 | + wpinv_update_payment_status( $invoice_id, 'publish' ); |
|
| 426 | + } else if ( 'wpi-pending' == $payment_status && isset( $data['pending_reason'] ) ) { |
|
| 427 | + // Look for possible pending reasons, such as an echeck |
|
| 428 | + $note = ''; |
|
| 429 | + |
|
| 430 | + switch( strtolower( $data['pending_reason'] ) ) { |
|
| 431 | + case 'echeck' : |
|
| 432 | + $note = __( 'Payment made via eCheck and will clear automatically in 5-8 days', 'invoicing' ); |
|
| 433 | + break; |
|
| 434 | 434 | |
| 435 | 435 | case 'address' : |
| 436 | - $note = __( 'Payment requires a confirmed customer address and must be accepted manually through PayPal', 'invoicing' ); |
|
| 437 | - break; |
|
| 436 | + $note = __( 'Payment requires a confirmed customer address and must be accepted manually through PayPal', 'invoicing' ); |
|
| 437 | + break; |
|
| 438 | 438 | |
| 439 | 439 | case 'intl' : |
| 440 | - $note = __( 'Payment must be accepted manually through PayPal due to international account regulations', 'invoicing' ); |
|
| 441 | - break; |
|
| 440 | + $note = __( 'Payment must be accepted manually through PayPal due to international account regulations', 'invoicing' ); |
|
| 441 | + break; |
|
| 442 | 442 | |
| 443 | 443 | case 'multi-currency' : |
| 444 | - $note = __( 'Payment received in non-shop currency and must be accepted manually through PayPal', 'invoicing' ); |
|
| 445 | - break; |
|
| 444 | + $note = __( 'Payment received in non-shop currency and must be accepted manually through PayPal', 'invoicing' ); |
|
| 445 | + break; |
|
| 446 | 446 | |
| 447 | 447 | case 'paymentreview' : |
| 448 | 448 | case 'regulatory_review' : |
| 449 | - $note = __( 'Payment is being reviewed by PayPal staff as high-risk or in possible violation of government regulations', 'invoicing' ); |
|
| 450 | - break; |
|
| 449 | + $note = __( 'Payment is being reviewed by PayPal staff as high-risk or in possible violation of government regulations', 'invoicing' ); |
|
| 450 | + break; |
|
| 451 | 451 | |
| 452 | 452 | case 'unilateral' : |
| 453 | - $note = __( 'Payment was sent to non-confirmed or non-registered email address.', 'invoicing' ); |
|
| 454 | - break; |
|
| 453 | + $note = __( 'Payment was sent to non-confirmed or non-registered email address.', 'invoicing' ); |
|
| 454 | + break; |
|
| 455 | 455 | |
| 456 | 456 | case 'upgrade' : |
| 457 | - $note = __( 'PayPal account must be upgraded before this payment can be accepted', 'invoicing' ); |
|
| 458 | - break; |
|
| 457 | + $note = __( 'PayPal account must be upgraded before this payment can be accepted', 'invoicing' ); |
|
| 458 | + break; |
|
| 459 | 459 | |
| 460 | 460 | case 'verify' : |
| 461 | - $note = __( 'PayPal account is not verified. Verify account in order to accept this payment', 'invoicing' ); |
|
| 462 | - break; |
|
| 463 | - |
|
| 464 | - case 'other' : |
|
| 465 | - $note = __( 'Payment is pending for unknown reasons. Contact PayPal support for assistance', 'invoicing' ); |
|
| 466 | - break; |
|
| 467 | - } |
|
| 468 | - |
|
| 469 | - if ( ! empty( $note ) ) { |
|
| 470 | - wpinv_insert_payment_note( $invoice_id, $note ); |
|
| 471 | - } |
|
| 472 | - } else { |
|
| 473 | - wpinv_insert_payment_note( $invoice_id, wp_sprintf( __( 'PayPal IPN has been received with invalid payment status: %s', 'invoicing' ), $payment_status ) ); |
|
| 474 | - } |
|
| 475 | - } |
|
| 461 | + $note = __( 'PayPal account is not verified. Verify account in order to accept this payment', 'invoicing' ); |
|
| 462 | + break; |
|
| 463 | + |
|
| 464 | + case 'other' : |
|
| 465 | + $note = __( 'Payment is pending for unknown reasons. Contact PayPal support for assistance', 'invoicing' ); |
|
| 466 | + break; |
|
| 467 | + } |
|
| 468 | + |
|
| 469 | + if ( ! empty( $note ) ) { |
|
| 470 | + wpinv_insert_payment_note( $invoice_id, $note ); |
|
| 471 | + } |
|
| 472 | + } else { |
|
| 473 | + wpinv_insert_payment_note( $invoice_id, wp_sprintf( __( 'PayPal IPN has been received with invalid payment status: %s', 'invoicing' ), $payment_status ) ); |
|
| 474 | + } |
|
| 475 | + } |
|
| 476 | 476 | } |
| 477 | 477 | add_action( 'wpinv_paypal_web_accept', 'wpinv_process_paypal_web_accept_and_cart', 10, 2 ); |
| 478 | 478 | |
@@ -687,27 +687,27 @@ discard block |
||
| 687 | 687 | } |
| 688 | 688 | |
| 689 | 689 | function wpinv_process_paypal_refund( $data, $invoice_id = 0 ) { |
| 690 | - // Collect payment details |
|
| 690 | + // Collect payment details |
|
| 691 | 691 | |
| 692 | - if( empty( $invoice_id ) ) { |
|
| 693 | - return; |
|
| 694 | - } |
|
| 692 | + if( empty( $invoice_id ) ) { |
|
| 693 | + return; |
|
| 694 | + } |
|
| 695 | 695 | |
| 696 | - if ( get_post_status( $invoice_id ) == 'wpi-refunded' ) { |
|
| 697 | - return; // Only refund payments once |
|
| 698 | - } |
|
| 696 | + if ( get_post_status( $invoice_id ) == 'wpi-refunded' ) { |
|
| 697 | + return; // Only refund payments once |
|
| 698 | + } |
|
| 699 | 699 | |
| 700 | - $payment_amount = wpinv_payment_total( $invoice_id ); |
|
| 701 | - $refund_amount = $data['mc_gross'] * -1; |
|
| 700 | + $payment_amount = wpinv_payment_total( $invoice_id ); |
|
| 701 | + $refund_amount = $data['mc_gross'] * -1; |
|
| 702 | 702 | |
| 703 | - if ( number_format( (float) $refund_amount, 2 ) < number_format( (float) $payment_amount, 2 ) ) { |
|
| 704 | - wpinv_insert_payment_note( $invoice_id, sprintf( __( 'Partial PayPal refund processed: %s', 'invoicing' ), $data['parent_txn_id'] ) ); |
|
| 705 | - return; // This is a partial refund |
|
| 706 | - } |
|
| 703 | + if ( number_format( (float) $refund_amount, 2 ) < number_format( (float) $payment_amount, 2 ) ) { |
|
| 704 | + wpinv_insert_payment_note( $invoice_id, sprintf( __( 'Partial PayPal refund processed: %s', 'invoicing' ), $data['parent_txn_id'] ) ); |
|
| 705 | + return; // This is a partial refund |
|
| 706 | + } |
|
| 707 | 707 | |
| 708 | - wpinv_insert_payment_note( $invoice_id, sprintf( __( 'PayPal Payment #%s Refunded for reason: %s', 'invoicing' ), $data['parent_txn_id'], $data['reason_code'] ) ); |
|
| 709 | - wpinv_insert_payment_note( $invoice_id, sprintf( __( 'PayPal Refund Transaction ID: %s', 'invoicing' ), $data['txn_id'] ) ); |
|
| 710 | - wpinv_update_payment_status( $invoice_id, 'wpi-refunded' ); |
|
| 708 | + wpinv_insert_payment_note( $invoice_id, sprintf( __( 'PayPal Payment #%s Refunded for reason: %s', 'invoicing' ), $data['parent_txn_id'], $data['reason_code'] ) ); |
|
| 709 | + wpinv_insert_payment_note( $invoice_id, sprintf( __( 'PayPal Refund Transaction ID: %s', 'invoicing' ), $data['txn_id'] ) ); |
|
| 710 | + wpinv_update_payment_status( $invoice_id, 'wpi-refunded' ); |
|
| 711 | 711 | } |
| 712 | 712 | |
| 713 | 713 | function wpinv_get_paypal_redirect( $ssl_check = false ) { |
@@ -1,13 +1,13 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | // Exit if accessed directly |
| 3 | -if ( ! defined( 'ABSPATH' ) ) exit; |
|
| 3 | +if (!defined('ABSPATH')) exit; |
|
| 4 | 4 | |
| 5 | -add_action( 'wpinv_paypal_cc_form', '__return_false' ); |
|
| 6 | -add_filter( 'wpinv_paypal_support_subscription', '__return_true' ); |
|
| 5 | +add_action('wpinv_paypal_cc_form', '__return_false'); |
|
| 6 | +add_filter('wpinv_paypal_support_subscription', '__return_true'); |
|
| 7 | 7 | |
| 8 | -function wpinv_process_paypal_payment( $purchase_data ) { |
|
| 9 | - if( ! wp_verify_nonce( $purchase_data['gateway_nonce'], 'wpi-gateway' ) ) { |
|
| 10 | - wp_die( __( 'Nonce verification has failed', 'invoicing' ), __( 'Error', 'invoicing' ), array( 'response' => 403 ) ); |
|
| 8 | +function wpinv_process_paypal_payment($purchase_data) { |
|
| 9 | + if (!wp_verify_nonce($purchase_data['gateway_nonce'], 'wpi-gateway')) { |
|
| 10 | + wp_die(__('Nonce verification has failed', 'invoicing'), __('Error', 'invoicing'), array('response' => 403)); |
|
| 11 | 11 | } |
| 12 | 12 | |
| 13 | 13 | // Collect payment data |
@@ -25,30 +25,30 @@ discard block |
||
| 25 | 25 | ); |
| 26 | 26 | |
| 27 | 27 | // Record the pending payment |
| 28 | - $invoice = wpinv_get_invoice( $purchase_data['invoice_id'] ); |
|
| 28 | + $invoice = wpinv_get_invoice($purchase_data['invoice_id']); |
|
| 29 | 29 | |
| 30 | 30 | // Check payment |
| 31 | - if ( ! $invoice ) { |
|
| 31 | + if (!$invoice) { |
|
| 32 | 32 | // Record the error |
| 33 | - wpinv_record_gateway_error( __( 'Payment Error', 'invoicing' ), sprintf( __( 'Payment creation failed before sending buyer to PayPal. Payment data: %s', 'invoicing' ), json_encode( $payment_data ) ), $payment ); |
|
| 33 | + wpinv_record_gateway_error(__('Payment Error', 'invoicing'), sprintf(__('Payment creation failed before sending buyer to PayPal. Payment data: %s', 'invoicing'), json_encode($payment_data)), $payment); |
|
| 34 | 34 | // Problems? send back |
| 35 | - wpinv_send_back_to_checkout( '?payment-mode=' . $purchase_data['post_data']['wpi-gateway'] ); |
|
| 35 | + wpinv_send_back_to_checkout('?payment-mode=' . $purchase_data['post_data']['wpi-gateway']); |
|
| 36 | 36 | } else { |
| 37 | 37 | // Only send to PayPal if the pending payment is created successfully |
| 38 | - $listener_url = wpinv_get_ipn_url( 'paypal' ); |
|
| 38 | + $listener_url = wpinv_get_ipn_url('paypal'); |
|
| 39 | 39 | |
| 40 | 40 | // Get the success url |
| 41 | - $return_url = add_query_arg( array( |
|
| 41 | + $return_url = add_query_arg(array( |
|
| 42 | 42 | 'payment-confirm' => 'paypal', |
| 43 | 43 | 'invoice-id' => $invoice->ID |
| 44 | - ), get_permalink( wpinv_get_option( 'success_page', false ) ) ); |
|
| 44 | + ), get_permalink(wpinv_get_option('success_page', false))); |
|
| 45 | 45 | |
| 46 | 46 | // Get the PayPal redirect uri |
| 47 | - $paypal_redirect = trailingslashit( wpinv_get_paypal_redirect() ) . '?'; |
|
| 47 | + $paypal_redirect = trailingslashit(wpinv_get_paypal_redirect()) . '?'; |
|
| 48 | 48 | |
| 49 | 49 | // Setup PayPal arguments |
| 50 | 50 | $paypal_args = array( |
| 51 | - 'business' => wpinv_get_option( 'paypal_email', false ), |
|
| 51 | + 'business' => wpinv_get_option('paypal_email', false), |
|
| 52 | 52 | 'email' => $invoice->get_email(), |
| 53 | 53 | 'first_name' => $invoice->get_first_name(), |
| 54 | 54 | 'last_name' => $invoice->get_last_name(), |
@@ -57,16 +57,16 @@ discard block |
||
| 57 | 57 | 'shipping' => '0', |
| 58 | 58 | 'no_note' => '1', |
| 59 | 59 | 'currency_code' => wpinv_get_currency(), |
| 60 | - 'charset' => get_bloginfo( 'charset' ), |
|
| 60 | + 'charset' => get_bloginfo('charset'), |
|
| 61 | 61 | 'custom' => $invoice->ID, |
| 62 | 62 | 'rm' => '2', |
| 63 | 63 | 'return' => $return_url, |
| 64 | - 'cancel_return' => wpinv_get_failed_transaction_uri( '?invoice-id=' . $invoice->ID ), |
|
| 64 | + 'cancel_return' => wpinv_get_failed_transaction_uri('?invoice-id=' . $invoice->ID), |
|
| 65 | 65 | 'notify_url' => $listener_url, |
| 66 | - 'cbt' => get_bloginfo( 'name' ), |
|
| 66 | + 'cbt' => get_bloginfo('name'), |
|
| 67 | 67 | 'bn' => 'WPInvoicing_SP', |
| 68 | 68 | 'lc' => 'US', // this will force paypal site to english |
| 69 | - 'landing_page' => apply_filters( 'wpinv_paypal_standard_landing_page', 'billing', $invoice ), // 'login' or 'billing'. login - PayPal account login, billing - Non-PayPal account. |
|
| 69 | + 'landing_page' => apply_filters('wpinv_paypal_standard_landing_page', 'billing', $invoice), // 'login' or 'billing'. login - PayPal account login, billing - Non-PayPal account. |
|
| 70 | 70 | ); |
| 71 | 71 | |
| 72 | 72 | $paypal_args['address1'] = $invoice->get_address(); |
@@ -80,57 +80,57 @@ discard block |
||
| 80 | 80 | 'upload' => '1' |
| 81 | 81 | ); |
| 82 | 82 | |
| 83 | - $paypal_args = array_merge( $paypal_extra_args, $paypal_args ); |
|
| 83 | + $paypal_args = array_merge($paypal_extra_args, $paypal_args); |
|
| 84 | 84 | |
| 85 | 85 | // Add cart items |
| 86 | 86 | $i = 1; |
| 87 | - if( is_array( $purchase_data['cart_details'] ) && ! empty( $purchase_data['cart_details'] ) ) { |
|
| 88 | - foreach ( $purchase_data['cart_details'] as $item ) { |
|
| 87 | + if (is_array($purchase_data['cart_details']) && !empty($purchase_data['cart_details'])) { |
|
| 88 | + foreach ($purchase_data['cart_details'] as $item) { |
|
| 89 | 89 | $item['quantity'] = $item['quantity'] > 0 ? $item['quantity'] : 1; |
| 90 | - $item_amount = wpinv_sanitize_amount( $item['subtotal'] / $item['quantity'], 2 ); |
|
| 90 | + $item_amount = wpinv_sanitize_amount($item['subtotal'] / $item['quantity'], 2); |
|
| 91 | 91 | |
| 92 | - if ( $item_amount <= 0 ) { |
|
| 92 | + if ($item_amount <= 0) { |
|
| 93 | 93 | $item_amount = 0; |
| 94 | 94 | } |
| 95 | 95 | |
| 96 | - $paypal_args['item_number_' . $i ] = $item['id']; |
|
| 97 | - $paypal_args['item_name_' . $i ] = stripslashes_deep( html_entity_decode( wpinv_get_cart_item_name( $item ), ENT_COMPAT, 'UTF-8' ) ); |
|
| 98 | - $paypal_args['quantity_' . $i ] = $item['quantity']; |
|
| 99 | - $paypal_args['amount_' . $i ] = $item_amount; |
|
| 100 | - $paypal_args['discount_amount_' . $i ] = wpinv_sanitize_amount( $item['discount'], 2 ); |
|
| 96 | + $paypal_args['item_number_' . $i] = $item['id']; |
|
| 97 | + $paypal_args['item_name_' . $i] = stripslashes_deep(html_entity_decode(wpinv_get_cart_item_name($item), ENT_COMPAT, 'UTF-8')); |
|
| 98 | + $paypal_args['quantity_' . $i] = $item['quantity']; |
|
| 99 | + $paypal_args['amount_' . $i] = $item_amount; |
|
| 100 | + $paypal_args['discount_amount_' . $i] = wpinv_sanitize_amount($item['discount'], 2); |
|
| 101 | 101 | |
| 102 | 102 | $i++; |
| 103 | 103 | } |
| 104 | 104 | } |
| 105 | 105 | |
| 106 | 106 | // Add taxes to the cart |
| 107 | - if ( wpinv_use_taxes() ) { |
|
| 108 | - $paypal_args['tax_cart'] = wpinv_sanitize_amount( (float)$invoice->get_tax(), 2 ); |
|
| 107 | + if (wpinv_use_taxes()) { |
|
| 108 | + $paypal_args['tax_cart'] = wpinv_sanitize_amount((float)$invoice->get_tax(), 2); |
|
| 109 | 109 | } |
| 110 | 110 | |
| 111 | - $paypal_args = apply_filters( 'wpinv_paypal_args', $paypal_args, $purchase_data, $invoice ); |
|
| 111 | + $paypal_args = apply_filters('wpinv_paypal_args', $paypal_args, $purchase_data, $invoice); |
|
| 112 | 112 | |
| 113 | 113 | // Build query |
| 114 | - $paypal_redirect .= http_build_query( $paypal_args ); |
|
| 114 | + $paypal_redirect .= http_build_query($paypal_args); |
|
| 115 | 115 | |
| 116 | 116 | // Fix for some sites that encode the entities |
| 117 | - $paypal_redirect = str_replace( '&', '&', $paypal_redirect ); |
|
| 117 | + $paypal_redirect = str_replace('&', '&', $paypal_redirect); |
|
| 118 | 118 | |
| 119 | 119 | // Get rid of cart contents |
| 120 | 120 | wpinv_empty_cart(); |
| 121 | 121 | |
| 122 | 122 | // Redirect to PayPal |
| 123 | - wp_redirect( $paypal_redirect ); |
|
| 123 | + wp_redirect($paypal_redirect); |
|
| 124 | 124 | exit; |
| 125 | 125 | } |
| 126 | 126 | } |
| 127 | -add_action( 'wpinv_gateway_paypal', 'wpinv_process_paypal_payment' ); |
|
| 127 | +add_action('wpinv_gateway_paypal', 'wpinv_process_paypal_payment'); |
|
| 128 | 128 | |
| 129 | -function wpinv_get_paypal_recurring_args( $paypal_args, $purchase_data, $invoice ) { |
|
| 130 | - if ( $invoice->is_recurring() && $item_id = $invoice->get_recurring() ) { |
|
| 131 | - $item = new WPInv_Item( $item_id ); |
|
| 129 | +function wpinv_get_paypal_recurring_args($paypal_args, $purchase_data, $invoice) { |
|
| 130 | + if ($invoice->is_recurring() && $item_id = $invoice->get_recurring()) { |
|
| 131 | + $item = new WPInv_Item($item_id); |
|
| 132 | 132 | |
| 133 | - if ( empty( $item ) ) { |
|
| 133 | + if (empty($item)) { |
|
| 134 | 134 | return $paypal_args; |
| 135 | 135 | } |
| 136 | 136 | |
@@ -138,24 +138,24 @@ discard block |
||
| 138 | 138 | $interval = $item->get_recurring_interval(); |
| 139 | 139 | $bill_times = (int)$item->get_recurring_limit(); |
| 140 | 140 | |
| 141 | - $initial_amount = wpinv_sanitize_amount( $invoice->get_total(), 2 ); |
|
| 142 | - $recurring_amount = wpinv_sanitize_amount( $invoice->get_recurring_details( 'total' ), 2 ); |
|
| 141 | + $initial_amount = wpinv_sanitize_amount($invoice->get_total(), 2); |
|
| 142 | + $recurring_amount = wpinv_sanitize_amount($invoice->get_recurring_details('total'), 2); |
|
| 143 | 143 | |
| 144 | 144 | $paypal_args['cmd'] = '_xclick-subscriptions'; |
| 145 | 145 | $paypal_args['sra'] = '1'; |
| 146 | 146 | $paypal_args['src'] = '1'; |
| 147 | 147 | |
| 148 | 148 | // Set item description |
| 149 | - $paypal_args['item_name'] = stripslashes_deep( html_entity_decode( wpinv_get_cart_item_name( array( 'id' => $item->ID ) ), ENT_COMPAT, 'UTF-8' ) ); |
|
| 149 | + $paypal_args['item_name'] = stripslashes_deep(html_entity_decode(wpinv_get_cart_item_name(array('id' => $item->ID)), ENT_COMPAT, 'UTF-8')); |
|
| 150 | 150 | |
| 151 | - if ( $invoice->is_free_trial() && $item->has_free_trial() ) { |
|
| 151 | + if ($invoice->is_free_trial() && $item->has_free_trial()) { |
|
| 152 | 152 | $paypal_args['a1'] = $initial_amount; |
| 153 | 153 | $paypal_args['p1'] = $item->get_trial_interval(); |
| 154 | 154 | $paypal_args['t1'] = $item->get_trial_period(); |
| 155 | 155 | |
| 156 | 156 | // Set the recurring amount |
| 157 | 157 | $paypal_args['a3'] = $recurring_amount; |
| 158 | - } else if ( $initial_amount != $recurring_amount && $bill_times != 1 ) { |
|
| 158 | + } else if ($initial_amount != $recurring_amount && $bill_times != 1) { |
|
| 159 | 159 | $paypal_args['a1'] = $initial_amount; |
| 160 | 160 | $paypal_args['p1'] = $interval; |
| 161 | 161 | $paypal_args['t1'] = $period; |
@@ -163,63 +163,63 @@ discard block |
||
| 163 | 163 | // Set the recurring amount |
| 164 | 164 | $paypal_args['a3'] = $recurring_amount; |
| 165 | 165 | |
| 166 | - if ( $bill_times > 1 ) { |
|
| 166 | + if ($bill_times > 1) { |
|
| 167 | 167 | $bill_times--; |
| 168 | 168 | } |
| 169 | 169 | } else { |
| 170 | - $paypal_args['a3'] = $initial_amount; |
|
| 170 | + $paypal_args['a3'] = $initial_amount; |
|
| 171 | 171 | } |
| 172 | 172 | |
| 173 | 173 | $paypal_args['p3'] = $interval; |
| 174 | 174 | $paypal_args['t3'] = $period; |
| 175 | 175 | |
| 176 | - if ( $bill_times > 1 ) { |
|
| 176 | + if ($bill_times > 1) { |
|
| 177 | 177 | // Make sure it's not over the max of 52 |
| 178 | - $paypal_args['srt'] = ( $bill_times <= 52 ? absint( $bill_times ) : 52 ); |
|
| 178 | + $paypal_args['srt'] = ($bill_times <= 52 ? absint($bill_times) : 52); |
|
| 179 | 179 | } |
| 180 | 180 | |
| 181 | 181 | // Remove cart items |
| 182 | 182 | $i = 1; |
| 183 | - if( is_array( $purchase_data['cart_details'] ) && ! empty( $purchase_data['cart_details'] ) ) { |
|
| 184 | - foreach ( $purchase_data['cart_details'] as $item ) { |
|
| 185 | - if ( isset( $paypal_args['item_number_' . $i] ) ) { |
|
| 186 | - unset( $paypal_args['item_number_' . $i] ); |
|
| 183 | + if (is_array($purchase_data['cart_details']) && !empty($purchase_data['cart_details'])) { |
|
| 184 | + foreach ($purchase_data['cart_details'] as $item) { |
|
| 185 | + if (isset($paypal_args['item_number_' . $i])) { |
|
| 186 | + unset($paypal_args['item_number_' . $i]); |
|
| 187 | 187 | } |
| 188 | - if ( isset( $paypal_args['item_name_' . $i] ) ) { |
|
| 189 | - unset( $paypal_args['item_name_' . $i] ); |
|
| 188 | + if (isset($paypal_args['item_name_' . $i])) { |
|
| 189 | + unset($paypal_args['item_name_' . $i]); |
|
| 190 | 190 | } |
| 191 | - if ( isset( $paypal_args['quantity_' . $i] ) ) { |
|
| 192 | - unset( $paypal_args['quantity_' . $i] ); |
|
| 191 | + if (isset($paypal_args['quantity_' . $i])) { |
|
| 192 | + unset($paypal_args['quantity_' . $i]); |
|
| 193 | 193 | } |
| 194 | - if ( isset( $paypal_args['amount_' . $i] ) ) { |
|
| 195 | - unset( $paypal_args['amount_' . $i] ); |
|
| 194 | + if (isset($paypal_args['amount_' . $i])) { |
|
| 195 | + unset($paypal_args['amount_' . $i]); |
|
| 196 | 196 | } |
| 197 | - if ( isset( $paypal_args['discount_amount_' . $i] ) ) { |
|
| 198 | - unset( $paypal_args['discount_amount_' . $i] ); |
|
| 197 | + if (isset($paypal_args['discount_amount_' . $i])) { |
|
| 198 | + unset($paypal_args['discount_amount_' . $i]); |
|
| 199 | 199 | } |
| 200 | 200 | |
| 201 | 201 | $i++; |
| 202 | 202 | } |
| 203 | 203 | } |
| 204 | 204 | |
| 205 | - if ( isset( $paypal_args['tax_cart'] ) ) { |
|
| 206 | - unset( $paypal_args['tax_cart'] ); |
|
| 205 | + if (isset($paypal_args['tax_cart'])) { |
|
| 206 | + unset($paypal_args['tax_cart']); |
|
| 207 | 207 | } |
| 208 | 208 | |
| 209 | - if ( isset( $paypal_args['upload'] ) ) { |
|
| 210 | - unset( $paypal_args['upload'] ); |
|
| 209 | + if (isset($paypal_args['upload'])) { |
|
| 210 | + unset($paypal_args['upload']); |
|
| 211 | 211 | } |
| 212 | 212 | |
| 213 | - $paypal_args = apply_filters( 'wpinv_paypal_recurring_args', $paypal_args, $purchase_data, $invoice ); |
|
| 213 | + $paypal_args = apply_filters('wpinv_paypal_recurring_args', $paypal_args, $purchase_data, $invoice); |
|
| 214 | 214 | } |
| 215 | 215 | |
| 216 | 216 | return $paypal_args; |
| 217 | 217 | } |
| 218 | -add_filter( 'wpinv_paypal_args', 'wpinv_get_paypal_recurring_args', 10, 3 ); |
|
| 218 | +add_filter('wpinv_paypal_args', 'wpinv_get_paypal_recurring_args', 10, 3); |
|
| 219 | 219 | |
| 220 | 220 | function wpinv_process_paypal_ipn() { |
| 221 | 221 | // Check the request method is POST |
| 222 | - if ( isset( $_SERVER['REQUEST_METHOD'] ) && $_SERVER['REQUEST_METHOD'] != 'POST' ) { |
|
| 222 | + if (isset($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] != 'POST') { |
|
| 223 | 223 | return; |
| 224 | 224 | } |
| 225 | 225 | |
@@ -227,11 +227,11 @@ discard block |
||
| 227 | 227 | $post_data = ''; |
| 228 | 228 | |
| 229 | 229 | // Fallback just in case post_max_size is lower than needed |
| 230 | - if ( ini_get( 'allow_url_fopen' ) ) { |
|
| 231 | - $post_data = file_get_contents( 'php://input' ); |
|
| 230 | + if (ini_get('allow_url_fopen')) { |
|
| 231 | + $post_data = file_get_contents('php://input'); |
|
| 232 | 232 | } else { |
| 233 | 233 | // If allow_url_fopen is not enabled, then make sure that post_max_size is large enough |
| 234 | - ini_set( 'post_max_size', '12M' ); |
|
| 234 | + ini_set('post_max_size', '12M'); |
|
| 235 | 235 | } |
| 236 | 236 | // Start the encoded data collection with notification command |
| 237 | 237 | $encoded_data = 'cmd=_notify-validate'; |
@@ -240,43 +240,43 @@ discard block |
||
| 240 | 240 | $arg_separator = wpinv_get_php_arg_separator_output(); |
| 241 | 241 | |
| 242 | 242 | // Verify there is a post_data |
| 243 | - if ( $post_data || strlen( $post_data ) > 0 ) { |
|
| 243 | + if ($post_data || strlen($post_data) > 0) { |
|
| 244 | 244 | // Append the data |
| 245 | - $encoded_data .= $arg_separator.$post_data; |
|
| 245 | + $encoded_data .= $arg_separator . $post_data; |
|
| 246 | 246 | } else { |
| 247 | 247 | // Check if POST is empty |
| 248 | - if ( empty( $_POST ) ) { |
|
| 248 | + if (empty($_POST)) { |
|
| 249 | 249 | // Nothing to do |
| 250 | 250 | return; |
| 251 | 251 | } else { |
| 252 | 252 | // Loop through each POST |
| 253 | - foreach ( $_POST as $key => $value ) { |
|
| 253 | + foreach ($_POST as $key => $value) { |
|
| 254 | 254 | // Encode the value and append the data |
| 255 | - $encoded_data .= $arg_separator."$key=" . urlencode( $value ); |
|
| 255 | + $encoded_data .= $arg_separator . "$key=" . urlencode($value); |
|
| 256 | 256 | } |
| 257 | 257 | } |
| 258 | 258 | } |
| 259 | 259 | |
| 260 | 260 | // Convert collected post data to an array |
| 261 | - parse_str( $encoded_data, $encoded_data_array ); |
|
| 261 | + parse_str($encoded_data, $encoded_data_array); |
|
| 262 | 262 | |
| 263 | - foreach ( $encoded_data_array as $key => $value ) { |
|
| 264 | - if ( false !== strpos( $key, 'amp;' ) ) { |
|
| 265 | - $new_key = str_replace( '&', '&', $key ); |
|
| 266 | - $new_key = str_replace( 'amp;', '&' , $new_key ); |
|
| 263 | + foreach ($encoded_data_array as $key => $value) { |
|
| 264 | + if (false !== strpos($key, 'amp;')) { |
|
| 265 | + $new_key = str_replace('&', '&', $key); |
|
| 266 | + $new_key = str_replace('amp;', '&', $new_key); |
|
| 267 | 267 | |
| 268 | - unset( $encoded_data_array[ $key ] ); |
|
| 269 | - $encoded_data_array[ $new_key ] = $value; |
|
| 268 | + unset($encoded_data_array[$key]); |
|
| 269 | + $encoded_data_array[$new_key] = $value; |
|
| 270 | 270 | } |
| 271 | 271 | } |
| 272 | 272 | |
| 273 | 273 | // Get the PayPal redirect uri |
| 274 | - $paypal_redirect = wpinv_get_paypal_redirect( true ); |
|
| 274 | + $paypal_redirect = wpinv_get_paypal_redirect(true); |
|
| 275 | 275 | |
| 276 | - if ( !wpinv_get_option( 'disable_paypal_verification', false ) ) { |
|
| 276 | + if (!wpinv_get_option('disable_paypal_verification', false)) { |
|
| 277 | 277 | // Validate the IPN |
| 278 | 278 | |
| 279 | - $remote_post_vars = array( |
|
| 279 | + $remote_post_vars = array( |
|
| 280 | 280 | 'method' => 'POST', |
| 281 | 281 | 'timeout' => 45, |
| 282 | 282 | 'redirection' => 5, |
@@ -294,21 +294,21 @@ discard block |
||
| 294 | 294 | ); |
| 295 | 295 | |
| 296 | 296 | // Get response |
| 297 | - $api_response = wp_remote_post( wpinv_get_paypal_redirect(), $remote_post_vars ); |
|
| 297 | + $api_response = wp_remote_post(wpinv_get_paypal_redirect(), $remote_post_vars); |
|
| 298 | 298 | |
| 299 | - if ( is_wp_error( $api_response ) ) { |
|
| 300 | - wpinv_record_gateway_error( __( 'IPN Error', 'invoicing' ), sprintf( __( 'Invalid IPN verification response. IPN data: %s', 'invoicing' ), json_encode( $api_response ) ) ); |
|
| 299 | + if (is_wp_error($api_response)) { |
|
| 300 | + wpinv_record_gateway_error(__('IPN Error', 'invoicing'), sprintf(__('Invalid IPN verification response. IPN data: %s', 'invoicing'), json_encode($api_response))); |
|
| 301 | 301 | return; // Something went wrong |
| 302 | 302 | } |
| 303 | 303 | |
| 304 | - if ( $api_response['body'] !== 'VERIFIED' && wpinv_get_option( 'disable_paypal_verification', false ) ) { |
|
| 305 | - wpinv_record_gateway_error( __( 'IPN Error', 'invoicing' ), sprintf( __( 'Invalid IPN verification response. IPN data: %s', 'invoicing' ), json_encode( $api_response ) ) ); |
|
| 304 | + if ($api_response['body'] !== 'VERIFIED' && wpinv_get_option('disable_paypal_verification', false)) { |
|
| 305 | + wpinv_record_gateway_error(__('IPN Error', 'invoicing'), sprintf(__('Invalid IPN verification response. IPN data: %s', 'invoicing'), json_encode($api_response))); |
|
| 306 | 306 | return; // Response not okay |
| 307 | 307 | } |
| 308 | 308 | } |
| 309 | 309 | |
| 310 | 310 | // Check if $post_data_array has been populated |
| 311 | - if ( !is_array( $encoded_data_array ) && !empty( $encoded_data_array ) ) |
|
| 311 | + if (!is_array($encoded_data_array) && !empty($encoded_data_array)) |
|
| 312 | 312 | return; |
| 313 | 313 | |
| 314 | 314 | $defaults = array( |
@@ -316,215 +316,215 @@ discard block |
||
| 316 | 316 | 'payment_status' => '' |
| 317 | 317 | ); |
| 318 | 318 | |
| 319 | - $encoded_data_array = wp_parse_args( $encoded_data_array, $defaults ); |
|
| 319 | + $encoded_data_array = wp_parse_args($encoded_data_array, $defaults); |
|
| 320 | 320 | |
| 321 | - $invoice_id = isset( $encoded_data_array['custom'] ) ? absint( $encoded_data_array['custom'] ) : 0; |
|
| 321 | + $invoice_id = isset($encoded_data_array['custom']) ? absint($encoded_data_array['custom']) : 0; |
|
| 322 | 322 | |
| 323 | - wpinv_error_log( $encoded_data_array['txn_type'], 'PayPal txn_type', __FILE__, __LINE__ ); |
|
| 323 | + wpinv_error_log($encoded_data_array['txn_type'], 'PayPal txn_type', __FILE__, __LINE__); |
|
| 324 | 324 | |
| 325 | - if ( has_action( 'wpinv_paypal_' . $encoded_data_array['txn_type'] ) ) { |
|
| 325 | + if (has_action('wpinv_paypal_' . $encoded_data_array['txn_type'])) { |
|
| 326 | 326 | // Allow PayPal IPN types to be processed separately |
| 327 | - do_action( 'wpinv_paypal_' . $encoded_data_array['txn_type'], $encoded_data_array, $invoice_id ); |
|
| 327 | + do_action('wpinv_paypal_' . $encoded_data_array['txn_type'], $encoded_data_array, $invoice_id); |
|
| 328 | 328 | } else { |
| 329 | 329 | // Fallback to web accept just in case the txn_type isn't present |
| 330 | - do_action( 'wpinv_paypal_web_accept', $encoded_data_array, $invoice_id ); |
|
| 330 | + do_action('wpinv_paypal_web_accept', $encoded_data_array, $invoice_id); |
|
| 331 | 331 | } |
| 332 | 332 | exit; |
| 333 | 333 | } |
| 334 | -add_action( 'wpinv_verify_paypal_ipn', 'wpinv_process_paypal_ipn' ); |
|
| 334 | +add_action('wpinv_verify_paypal_ipn', 'wpinv_process_paypal_ipn'); |
|
| 335 | 335 | |
| 336 | -function wpinv_process_paypal_web_accept_and_cart( $data, $invoice_id ) { |
|
| 337 | - if ( $data['txn_type'] != 'web_accept' && $data['txn_type'] != 'cart' && $data['payment_status'] != 'Refunded' ) { |
|
| 336 | +function wpinv_process_paypal_web_accept_and_cart($data, $invoice_id) { |
|
| 337 | + if ($data['txn_type'] != 'web_accept' && $data['txn_type'] != 'cart' && $data['payment_status'] != 'Refunded') { |
|
| 338 | 338 | return; |
| 339 | 339 | } |
| 340 | 340 | |
| 341 | - if( empty( $invoice_id ) ) { |
|
| 341 | + if (empty($invoice_id)) { |
|
| 342 | 342 | return; |
| 343 | 343 | } |
| 344 | 344 | |
| 345 | 345 | // Collect payment details |
| 346 | - $purchase_key = isset( $data['invoice'] ) ? $data['invoice'] : $data['item_number']; |
|
| 346 | + $purchase_key = isset($data['invoice']) ? $data['invoice'] : $data['item_number']; |
|
| 347 | 347 | $paypal_amount = $data['mc_gross']; |
| 348 | - $payment_status = strtolower( $data['payment_status'] ); |
|
| 349 | - $currency_code = strtolower( $data['mc_currency'] ); |
|
| 350 | - $business_email = isset( $data['business'] ) && is_email( $data['business'] ) ? trim( $data['business'] ) : trim( $data['receiver_email'] ); |
|
| 351 | - $payment_meta = wpinv_get_invoice_meta( $invoice_id ); |
|
| 348 | + $payment_status = strtolower($data['payment_status']); |
|
| 349 | + $currency_code = strtolower($data['mc_currency']); |
|
| 350 | + $business_email = isset($data['business']) && is_email($data['business']) ? trim($data['business']) : trim($data['receiver_email']); |
|
| 351 | + $payment_meta = wpinv_get_invoice_meta($invoice_id); |
|
| 352 | 352 | |
| 353 | - if ( wpinv_get_payment_gateway( $invoice_id ) != 'paypal' ) { |
|
| 353 | + if (wpinv_get_payment_gateway($invoice_id) != 'paypal') { |
|
| 354 | 354 | return; // this isn't a PayPal standard IPN |
| 355 | 355 | } |
| 356 | 356 | |
| 357 | 357 | // Verify payment recipient |
| 358 | - if ( strcasecmp( $business_email, trim( wpinv_get_option( 'paypal_email', false ) ) ) != 0 ) { |
|
| 359 | - wpinv_record_gateway_error( __( 'IPN Error', 'invoicing' ), sprintf( __( 'Invalid business email in IPN response. IPN data: %s', 'invoicing' ), json_encode( $data ) ), $invoice_id ); |
|
| 360 | - wpinv_update_payment_status( $invoice_id, 'wpi-failed' ); |
|
| 361 | - wpinv_insert_payment_note( $invoice_id, __( 'Payment failed due to invalid PayPal business email.', 'invoicing' ) ); |
|
| 358 | + if (strcasecmp($business_email, trim(wpinv_get_option('paypal_email', false))) != 0) { |
|
| 359 | + wpinv_record_gateway_error(__('IPN Error', 'invoicing'), sprintf(__('Invalid business email in IPN response. IPN data: %s', 'invoicing'), json_encode($data)), $invoice_id); |
|
| 360 | + wpinv_update_payment_status($invoice_id, 'wpi-failed'); |
|
| 361 | + wpinv_insert_payment_note($invoice_id, __('Payment failed due to invalid PayPal business email.', 'invoicing')); |
|
| 362 | 362 | return; |
| 363 | 363 | } |
| 364 | 364 | |
| 365 | 365 | // Verify payment currency |
| 366 | - if ( $currency_code != strtolower( $payment_meta['currency'] ) ) { |
|
| 367 | - wpinv_record_gateway_error( __( 'IPN Error', 'invoicing' ), sprintf( __( 'Invalid currency in IPN response. IPN data: %s', 'invoicing' ), json_encode( $data ) ), $invoice_id ); |
|
| 368 | - wpinv_update_payment_status( $invoice_id, 'wpi-failed' ); |
|
| 369 | - wpinv_insert_payment_note( $invoice_id, __( 'Payment failed due to invalid currency in PayPal IPN.', 'invoicing' ) ); |
|
| 366 | + if ($currency_code != strtolower($payment_meta['currency'])) { |
|
| 367 | + wpinv_record_gateway_error(__('IPN Error', 'invoicing'), sprintf(__('Invalid currency in IPN response. IPN data: %s', 'invoicing'), json_encode($data)), $invoice_id); |
|
| 368 | + wpinv_update_payment_status($invoice_id, 'wpi-failed'); |
|
| 369 | + wpinv_insert_payment_note($invoice_id, __('Payment failed due to invalid currency in PayPal IPN.', 'invoicing')); |
|
| 370 | 370 | return; |
| 371 | 371 | } |
| 372 | 372 | |
| 373 | - if ( !wpinv_get_payment_user_email( $invoice_id ) ) { |
|
| 373 | + if (!wpinv_get_payment_user_email($invoice_id)) { |
|
| 374 | 374 | // This runs when a Buy Now purchase was made. It bypasses checkout so no personal info is collected until PayPal |
| 375 | 375 | // No email associated with purchase, so store from PayPal |
| 376 | - wpinv_update_invoice_meta( $invoice_id, '_wpinv_email', $data['payer_email'] ); |
|
| 376 | + wpinv_update_invoice_meta($invoice_id, '_wpinv_email', $data['payer_email']); |
|
| 377 | 377 | |
| 378 | 378 | // Setup and store the customer's details |
| 379 | 379 | $user_info = array( |
| 380 | 380 | 'user_id' => '-1', |
| 381 | - 'email' => sanitize_text_field( $data['payer_email'] ), |
|
| 382 | - 'first_name' => sanitize_text_field( $data['first_name'] ), |
|
| 383 | - 'last_name' => sanitize_text_field( $data['last_name'] ), |
|
| 381 | + 'email' => sanitize_text_field($data['payer_email']), |
|
| 382 | + 'first_name' => sanitize_text_field($data['first_name']), |
|
| 383 | + 'last_name' => sanitize_text_field($data['last_name']), |
|
| 384 | 384 | 'discount' => '', |
| 385 | 385 | ); |
| 386 | - $user_info['address'] = ! empty( $data['address_street'] ) ? sanitize_text_field( $data['address_street'] ) : false; |
|
| 387 | - $user_info['city'] = ! empty( $data['address_city'] ) ? sanitize_text_field( $data['address_city'] ) : false; |
|
| 388 | - $user_info['state'] = ! empty( $data['address_state'] ) ? sanitize_text_field( $data['address_state'] ) : false; |
|
| 389 | - $user_info['country'] = ! empty( $data['address_country_code'] ) ? sanitize_text_field( $data['address_country_code'] ) : false; |
|
| 390 | - $user_info['zip'] = ! empty( $data['address_zip'] ) ? sanitize_text_field( $data['address_zip'] ) : false; |
|
| 386 | + $user_info['address'] = !empty($data['address_street']) ? sanitize_text_field($data['address_street']) : false; |
|
| 387 | + $user_info['city'] = !empty($data['address_city']) ? sanitize_text_field($data['address_city']) : false; |
|
| 388 | + $user_info['state'] = !empty($data['address_state']) ? sanitize_text_field($data['address_state']) : false; |
|
| 389 | + $user_info['country'] = !empty($data['address_country_code']) ? sanitize_text_field($data['address_country_code']) : false; |
|
| 390 | + $user_info['zip'] = !empty($data['address_zip']) ? sanitize_text_field($data['address_zip']) : false; |
|
| 391 | 391 | |
| 392 | 392 | $payment_meta['user_info'] = $user_info; |
| 393 | - wpinv_update_invoice_meta( $invoice_id, '_wpinv_payment_meta', $payment_meta ); |
|
| 393 | + wpinv_update_invoice_meta($invoice_id, '_wpinv_payment_meta', $payment_meta); |
|
| 394 | 394 | } |
| 395 | 395 | |
| 396 | - if ( $payment_status == 'refunded' || $payment_status == 'reversed' ) { |
|
| 396 | + if ($payment_status == 'refunded' || $payment_status == 'reversed') { |
|
| 397 | 397 | // Process a refund |
| 398 | - wpinv_process_paypal_refund( $data, $invoice_id ); |
|
| 398 | + wpinv_process_paypal_refund($data, $invoice_id); |
|
| 399 | 399 | } else { |
| 400 | - if ( get_post_status( $invoice_id ) == 'publish' ) { |
|
| 400 | + if (get_post_status($invoice_id) == 'publish') { |
|
| 401 | 401 | return; // Only paid payments once |
| 402 | 402 | } |
| 403 | 403 | |
| 404 | 404 | // Retrieve the total purchase amount (before PayPal) |
| 405 | - $payment_amount = wpinv_payment_total( $invoice_id ); |
|
| 405 | + $payment_amount = wpinv_payment_total($invoice_id); |
|
| 406 | 406 | |
| 407 | - if ( number_format( (float) $paypal_amount, 2 ) < number_format( (float) $payment_amount, 2 ) ) { |
|
| 407 | + if (number_format((float)$paypal_amount, 2) < number_format((float)$payment_amount, 2)) { |
|
| 408 | 408 | // The prices don't match |
| 409 | - wpinv_record_gateway_error( __( 'IPN Error', 'invoicing' ), sprintf( __( 'Invalid payment amount in IPN response. IPN data: %s', 'invoicing' ), json_encode( $data ) ), $invoice_id ); |
|
| 410 | - wpinv_update_payment_status( $invoice_id, 'wpi-failed' ); |
|
| 411 | - wpinv_insert_payment_note( $invoice_id, __( 'Payment failed due to invalid amount in PayPal IPN.', 'invoicing' ) ); |
|
| 409 | + wpinv_record_gateway_error(__('IPN Error', 'invoicing'), sprintf(__('Invalid payment amount in IPN response. IPN data: %s', 'invoicing'), json_encode($data)), $invoice_id); |
|
| 410 | + wpinv_update_payment_status($invoice_id, 'wpi-failed'); |
|
| 411 | + wpinv_insert_payment_note($invoice_id, __('Payment failed due to invalid amount in PayPal IPN.', 'invoicing')); |
|
| 412 | 412 | return; |
| 413 | 413 | } |
| 414 | - if ( $purchase_key != wpinv_get_payment_key( $invoice_id ) ) { |
|
| 414 | + if ($purchase_key != wpinv_get_payment_key($invoice_id)) { |
|
| 415 | 415 | // Purchase keys don't match |
| 416 | - wpinv_record_gateway_error( __( 'IPN Error', 'invoicing' ), sprintf( __( 'Invalid purchase key in IPN response. IPN data: %s', 'invoicing' ), json_encode( $data ) ), $invoice_id ); |
|
| 417 | - wpinv_update_payment_status( $invoice_id, 'wpi-failed' ); |
|
| 418 | - wpinv_insert_payment_note( $invoice_id, __( 'Payment failed due to invalid purchase key in PayPal IPN.', 'invoicing' ) ); |
|
| 416 | + wpinv_record_gateway_error(__('IPN Error', 'invoicing'), sprintf(__('Invalid purchase key in IPN response. IPN data: %s', 'invoicing'), json_encode($data)), $invoice_id); |
|
| 417 | + wpinv_update_payment_status($invoice_id, 'wpi-failed'); |
|
| 418 | + wpinv_insert_payment_note($invoice_id, __('Payment failed due to invalid purchase key in PayPal IPN.', 'invoicing')); |
|
| 419 | 419 | return; |
| 420 | 420 | } |
| 421 | 421 | |
| 422 | - if ( 'complete' == $payment_status || 'completed' == $payment_status || 'processed' == $payment_status || wpinv_is_test_mode( 'paypal' ) ) { |
|
| 423 | - wpinv_insert_payment_note( $invoice_id, sprintf( __( 'PayPal Transaction ID: %s', 'invoicing' ) , $data['txn_id'] ) ); |
|
| 424 | - wpinv_set_payment_transaction_id( $invoice_id, $data['txn_id'] ); |
|
| 425 | - wpinv_update_payment_status( $invoice_id, 'publish' ); |
|
| 426 | - } else if ( 'wpi-pending' == $payment_status && isset( $data['pending_reason'] ) ) { |
|
| 422 | + if ('complete' == $payment_status || 'completed' == $payment_status || 'processed' == $payment_status || wpinv_is_test_mode('paypal')) { |
|
| 423 | + wpinv_insert_payment_note($invoice_id, sprintf(__('PayPal Transaction ID: %s', 'invoicing'), $data['txn_id'])); |
|
| 424 | + wpinv_set_payment_transaction_id($invoice_id, $data['txn_id']); |
|
| 425 | + wpinv_update_payment_status($invoice_id, 'publish'); |
|
| 426 | + } else if ('wpi-pending' == $payment_status && isset($data['pending_reason'])) { |
|
| 427 | 427 | // Look for possible pending reasons, such as an echeck |
| 428 | 428 | $note = ''; |
| 429 | 429 | |
| 430 | - switch( strtolower( $data['pending_reason'] ) ) { |
|
| 430 | + switch (strtolower($data['pending_reason'])) { |
|
| 431 | 431 | case 'echeck' : |
| 432 | - $note = __( 'Payment made via eCheck and will clear automatically in 5-8 days', 'invoicing' ); |
|
| 432 | + $note = __('Payment made via eCheck and will clear automatically in 5-8 days', 'invoicing'); |
|
| 433 | 433 | break; |
| 434 | 434 | |
| 435 | 435 | case 'address' : |
| 436 | - $note = __( 'Payment requires a confirmed customer address and must be accepted manually through PayPal', 'invoicing' ); |
|
| 436 | + $note = __('Payment requires a confirmed customer address and must be accepted manually through PayPal', 'invoicing'); |
|
| 437 | 437 | break; |
| 438 | 438 | |
| 439 | 439 | case 'intl' : |
| 440 | - $note = __( 'Payment must be accepted manually through PayPal due to international account regulations', 'invoicing' ); |
|
| 440 | + $note = __('Payment must be accepted manually through PayPal due to international account regulations', 'invoicing'); |
|
| 441 | 441 | break; |
| 442 | 442 | |
| 443 | 443 | case 'multi-currency' : |
| 444 | - $note = __( 'Payment received in non-shop currency and must be accepted manually through PayPal', 'invoicing' ); |
|
| 444 | + $note = __('Payment received in non-shop currency and must be accepted manually through PayPal', 'invoicing'); |
|
| 445 | 445 | break; |
| 446 | 446 | |
| 447 | 447 | case 'paymentreview' : |
| 448 | 448 | case 'regulatory_review' : |
| 449 | - $note = __( 'Payment is being reviewed by PayPal staff as high-risk or in possible violation of government regulations', 'invoicing' ); |
|
| 449 | + $note = __('Payment is being reviewed by PayPal staff as high-risk or in possible violation of government regulations', 'invoicing'); |
|
| 450 | 450 | break; |
| 451 | 451 | |
| 452 | 452 | case 'unilateral' : |
| 453 | - $note = __( 'Payment was sent to non-confirmed or non-registered email address.', 'invoicing' ); |
|
| 453 | + $note = __('Payment was sent to non-confirmed or non-registered email address.', 'invoicing'); |
|
| 454 | 454 | break; |
| 455 | 455 | |
| 456 | 456 | case 'upgrade' : |
| 457 | - $note = __( 'PayPal account must be upgraded before this payment can be accepted', 'invoicing' ); |
|
| 457 | + $note = __('PayPal account must be upgraded before this payment can be accepted', 'invoicing'); |
|
| 458 | 458 | break; |
| 459 | 459 | |
| 460 | 460 | case 'verify' : |
| 461 | - $note = __( 'PayPal account is not verified. Verify account in order to accept this payment', 'invoicing' ); |
|
| 461 | + $note = __('PayPal account is not verified. Verify account in order to accept this payment', 'invoicing'); |
|
| 462 | 462 | break; |
| 463 | 463 | |
| 464 | 464 | case 'other' : |
| 465 | - $note = __( 'Payment is pending for unknown reasons. Contact PayPal support for assistance', 'invoicing' ); |
|
| 465 | + $note = __('Payment is pending for unknown reasons. Contact PayPal support for assistance', 'invoicing'); |
|
| 466 | 466 | break; |
| 467 | 467 | } |
| 468 | 468 | |
| 469 | - if ( ! empty( $note ) ) { |
|
| 470 | - wpinv_insert_payment_note( $invoice_id, $note ); |
|
| 469 | + if (!empty($note)) { |
|
| 470 | + wpinv_insert_payment_note($invoice_id, $note); |
|
| 471 | 471 | } |
| 472 | 472 | } else { |
| 473 | - wpinv_insert_payment_note( $invoice_id, wp_sprintf( __( 'PayPal IPN has been received with invalid payment status: %s', 'invoicing' ), $payment_status ) ); |
|
| 473 | + wpinv_insert_payment_note($invoice_id, wp_sprintf(__('PayPal IPN has been received with invalid payment status: %s', 'invoicing'), $payment_status)); |
|
| 474 | 474 | } |
| 475 | 475 | } |
| 476 | 476 | } |
| 477 | -add_action( 'wpinv_paypal_web_accept', 'wpinv_process_paypal_web_accept_and_cart', 10, 2 ); |
|
| 477 | +add_action('wpinv_paypal_web_accept', 'wpinv_process_paypal_web_accept_and_cart', 10, 2); |
|
| 478 | 478 | |
| 479 | 479 | // Process PayPal subscription sign ups |
| 480 | -add_action( 'wpinv_paypal_subscr_signup', 'wpinv_process_paypal_subscr_signup' ); |
|
| 480 | +add_action('wpinv_paypal_subscr_signup', 'wpinv_process_paypal_subscr_signup'); |
|
| 481 | 481 | |
| 482 | 482 | // Process PayPal subscription payments |
| 483 | -add_action( 'wpinv_paypal_subscr_payment', 'wpinv_process_paypal_subscr_payment' ); |
|
| 483 | +add_action('wpinv_paypal_subscr_payment', 'wpinv_process_paypal_subscr_payment'); |
|
| 484 | 484 | |
| 485 | 485 | // Process PayPal subscription cancellations |
| 486 | -add_action( 'wpinv_paypal_subscr_cancel', 'wpinv_process_paypal_subscr_cancel' ); |
|
| 486 | +add_action('wpinv_paypal_subscr_cancel', 'wpinv_process_paypal_subscr_cancel'); |
|
| 487 | 487 | |
| 488 | 488 | // Process PayPal subscription end of term notices |
| 489 | -add_action( 'wpinv_paypal_subscr_eot', 'wpinv_process_paypal_subscr_eot' ); |
|
| 489 | +add_action('wpinv_paypal_subscr_eot', 'wpinv_process_paypal_subscr_eot'); |
|
| 490 | 490 | |
| 491 | 491 | // Process PayPal payment failed |
| 492 | -add_action( 'wpinv_paypal_subscr_failed', 'wpinv_process_paypal_subscr_failed' ); |
|
| 492 | +add_action('wpinv_paypal_subscr_failed', 'wpinv_process_paypal_subscr_failed'); |
|
| 493 | 493 | |
| 494 | 494 | |
| 495 | 495 | /** |
| 496 | 496 | * Process the subscription started IPN. |
| 497 | 497 | */ |
| 498 | -function wpinv_process_paypal_subscr_signup( $ipn_data ) { |
|
| 499 | - $parent_invoice_id = absint( $ipn_data['custom'] ); |
|
| 500 | - if( empty( $parent_invoice_id ) ) { |
|
| 498 | +function wpinv_process_paypal_subscr_signup($ipn_data) { |
|
| 499 | + $parent_invoice_id = absint($ipn_data['custom']); |
|
| 500 | + if (empty($parent_invoice_id)) { |
|
| 501 | 501 | return; |
| 502 | 502 | } |
| 503 | 503 | |
| 504 | - $invoice = wpinv_get_invoice( $parent_invoice_id ); |
|
| 505 | - if ( empty( $invoice ) ) { |
|
| 504 | + $invoice = wpinv_get_invoice($parent_invoice_id); |
|
| 505 | + if (empty($invoice)) { |
|
| 506 | 506 | return; |
| 507 | 507 | } |
| 508 | 508 | |
| 509 | - if ( $invoice->is_free_trial() && !empty( $ipn_data['invoice'] ) ) { |
|
| 510 | - wpinv_insert_payment_note( $parent_invoice_id, sprintf( __( 'PayPal Invoice ID: %s', 'invoicing' ) , $ipn_data['invoice'] ) ); |
|
| 511 | - wpinv_set_payment_transaction_id( $parent_invoice_id, $ipn_data['invoice'] ); |
|
| 509 | + if ($invoice->is_free_trial() && !empty($ipn_data['invoice'])) { |
|
| 510 | + wpinv_insert_payment_note($parent_invoice_id, sprintf(__('PayPal Invoice ID: %s', 'invoicing'), $ipn_data['invoice'])); |
|
| 511 | + wpinv_set_payment_transaction_id($parent_invoice_id, $ipn_data['invoice']); |
|
| 512 | 512 | } |
| 513 | 513 | |
| 514 | - wpinv_update_payment_status( $parent_invoice_id, 'publish' ); |
|
| 514 | + wpinv_update_payment_status($parent_invoice_id, 'publish'); |
|
| 515 | 515 | sleep(1); |
| 516 | - wpinv_insert_payment_note( $parent_invoice_id, sprintf( __( 'PayPal Subscription ID: %s', 'invoicing' ) , $ipn_data['subscr_id'] ) ); |
|
| 516 | + wpinv_insert_payment_note($parent_invoice_id, sprintf(__('PayPal Subscription ID: %s', 'invoicing'), $ipn_data['subscr_id'])); |
|
| 517 | 517 | |
| 518 | - $subscription = wpinv_get_paypal_subscription( $ipn_data ); |
|
| 519 | - if ( false === $subscription ) { |
|
| 518 | + $subscription = wpinv_get_paypal_subscription($ipn_data); |
|
| 519 | + if (false === $subscription) { |
|
| 520 | 520 | return; |
| 521 | 521 | } |
| 522 | 522 | |
| 523 | - $cart_details = $invoice->cart_details; |
|
| 523 | + $cart_details = $invoice->cart_details; |
|
| 524 | 524 | |
| 525 | - if ( !empty( $cart_details ) ) { |
|
| 526 | - foreach ( $cart_details as $cart_item ) { |
|
| 527 | - $item = new WPInv_Item( $cart_item['id'] ); |
|
| 525 | + if (!empty($cart_details)) { |
|
| 526 | + foreach ($cart_details as $cart_item) { |
|
| 527 | + $item = new WPInv_Item($cart_item['id']); |
|
| 528 | 528 | |
| 529 | 529 | $status = $invoice->is_free_trial() && $item->has_free_trial() ? 'trialing' : 'active'; |
| 530 | 530 | |
@@ -533,15 +533,15 @@ discard block |
||
| 533 | 533 | 'status' => $status, |
| 534 | 534 | 'period' => $item->get_recurring_period(), |
| 535 | 535 | 'initial_amount' => $invoice->get_total(), |
| 536 | - 'recurring_amount' => $invoice->get_recurring_details( 'total' ), |
|
| 536 | + 'recurring_amount' => $invoice->get_recurring_details('total'), |
|
| 537 | 537 | 'interval' => $item->get_recurring_interval(), |
| 538 | 538 | 'bill_times' => $item->get_recurring_limit(), |
| 539 | - 'expiration' => $invoice->get_new_expiration( $cart_item['id'] ), |
|
| 539 | + 'expiration' => $invoice->get_new_expiration($cart_item['id']), |
|
| 540 | 540 | 'profile_id' => $ipn_data['subscr_id'], |
| 541 | - 'created' => date_i18n( 'Y-m-d H:i:s', strtotime( $ipn_data['subscr_date'] ) ) |
|
| 541 | + 'created' => date_i18n('Y-m-d H:i:s', strtotime($ipn_data['subscr_date'])) |
|
| 542 | 542 | ); |
| 543 | 543 | |
| 544 | - if ( $item->has_free_trial() ) { |
|
| 544 | + if ($item->has_free_trial()) { |
|
| 545 | 545 | $args['trial_period'] = $item->get_trial_period(); |
| 546 | 546 | $args['trial_interval'] = $item->get_trial_interval(); |
| 547 | 547 | } else { |
@@ -550,7 +550,7 @@ discard block |
||
| 550 | 550 | } |
| 551 | 551 | |
| 552 | 552 | |
| 553 | - $subscription->update_subscription( $args ); |
|
| 553 | + $subscription->update_subscription($args); |
|
| 554 | 554 | } |
| 555 | 555 | } |
| 556 | 556 | } |
@@ -558,39 +558,39 @@ discard block |
||
| 558 | 558 | /** |
| 559 | 559 | * Process the subscription payment received IPN. |
| 560 | 560 | */ |
| 561 | -function wpinv_process_paypal_subscr_payment( $ipn_data ) { |
|
| 562 | - $parent_invoice_id = absint( $ipn_data['custom'] ); |
|
| 561 | +function wpinv_process_paypal_subscr_payment($ipn_data) { |
|
| 562 | + $parent_invoice_id = absint($ipn_data['custom']); |
|
| 563 | 563 | |
| 564 | - $subscription = wpinv_get_paypal_subscription( $ipn_data ); |
|
| 565 | - if ( false === $subscription ) { |
|
| 564 | + $subscription = wpinv_get_paypal_subscription($ipn_data); |
|
| 565 | + if (false === $subscription) { |
|
| 566 | 566 | return; |
| 567 | 567 | } |
| 568 | 568 | |
| 569 | - $transaction_id = wpinv_get_payment_transaction_id( $parent_invoice_id ); |
|
| 570 | - $signup_date = strtotime( $subscription->get_subscription_created() ); |
|
| 571 | - $today = date_i18n( 'Y-m-d', $signup_date ) == date_i18n( 'Y-m-d', strtotime( $ipn_data['payment_date'] ) ); |
|
| 569 | + $transaction_id = wpinv_get_payment_transaction_id($parent_invoice_id); |
|
| 570 | + $signup_date = strtotime($subscription->get_subscription_created()); |
|
| 571 | + $today = date_i18n('Y-m-d', $signup_date) == date_i18n('Y-m-d', strtotime($ipn_data['payment_date'])); |
|
| 572 | 572 | |
| 573 | 573 | // Look to see if payment is same day as signup and we have set the transaction ID on the parent payment yet. |
| 574 | - if ( $today && ( !$transaction_id || $transaction_id == $parent_invoice_id ) ) { |
|
| 575 | - wpinv_update_payment_status( $parent_invoice_id, 'publish' ); |
|
| 574 | + if ($today && (!$transaction_id || $transaction_id == $parent_invoice_id)) { |
|
| 575 | + wpinv_update_payment_status($parent_invoice_id, 'publish'); |
|
| 576 | 576 | sleep(1); |
| 577 | 577 | |
| 578 | 578 | // This is the very first payment |
| 579 | - wpinv_set_payment_transaction_id( $parent_invoice_id, $ipn_data['txn_id'] ); |
|
| 580 | - wpinv_insert_payment_note( $parent_invoice_id, sprintf( __( 'PayPal Transaction ID: %s', 'invoicing' ) , $ipn_data['txn_id'] ) ); |
|
| 579 | + wpinv_set_payment_transaction_id($parent_invoice_id, $ipn_data['txn_id']); |
|
| 580 | + wpinv_insert_payment_note($parent_invoice_id, sprintf(__('PayPal Transaction ID: %s', 'invoicing'), $ipn_data['txn_id'])); |
|
| 581 | 581 | return; |
| 582 | 582 | } |
| 583 | 583 | |
| 584 | - if ( wpinv_get_id_by_transaction_id( $ipn_data['txn_id'] ) ) { |
|
| 584 | + if (wpinv_get_id_by_transaction_id($ipn_data['txn_id'])) { |
|
| 585 | 585 | return; // Payment already recorded |
| 586 | 586 | } |
| 587 | 587 | |
| 588 | - $currency_code = strtolower( $ipn_data['mc_currency'] ); |
|
| 588 | + $currency_code = strtolower($ipn_data['mc_currency']); |
|
| 589 | 589 | |
| 590 | 590 | // verify details |
| 591 | - if ( $currency_code != strtolower( wpinv_get_currency() ) ) { |
|
| 591 | + if ($currency_code != strtolower(wpinv_get_currency())) { |
|
| 592 | 592 | // the currency code is invalid |
| 593 | - wpinv_record_gateway_error( __( 'IPN Error', 'invoicing' ), sprintf( __( 'Invalid currency in IPN response. IPN data: ', 'invoicing' ), json_encode( $ipn_data ) ) ); |
|
| 593 | + wpinv_record_gateway_error(__('IPN Error', 'invoicing'), sprintf(__('Invalid currency in IPN response. IPN data: ', 'invoicing'), json_encode($ipn_data))); |
|
| 594 | 594 | return; |
| 595 | 595 | } |
| 596 | 596 | |
@@ -599,11 +599,11 @@ discard block |
||
| 599 | 599 | 'transaction_id' => $ipn_data['txn_id'] |
| 600 | 600 | ); |
| 601 | 601 | |
| 602 | - $invoice = wpinv_recurring_add_subscription_payment( $parent_invoice_id, $args ); |
|
| 602 | + $invoice = wpinv_recurring_add_subscription_payment($parent_invoice_id, $args); |
|
| 603 | 603 | |
| 604 | - if ( !empty( $invoice ) ) { |
|
| 604 | + if (!empty($invoice)) { |
|
| 605 | 605 | sleep(1); |
| 606 | - wpinv_insert_payment_note( $invoice->ID, sprintf( __( 'PayPal Transaction ID: %s', 'invoicing' ) , $ipn_data['txn_id'] ) ); |
|
| 606 | + wpinv_insert_payment_note($invoice->ID, sprintf(__('PayPal Transaction ID: %s', 'invoicing'), $ipn_data['txn_id'])); |
|
| 607 | 607 | |
| 608 | 608 | $invoice->renew_subscription(); |
| 609 | 609 | } |
@@ -612,10 +612,10 @@ discard block |
||
| 612 | 612 | /** |
| 613 | 613 | * Process the subscription canceled IPN. |
| 614 | 614 | */ |
| 615 | -function wpinv_process_paypal_subscr_cancel( $ipn_data ) { |
|
| 616 | - $subscription = wpinv_get_paypal_subscription( $ipn_data ); |
|
| 615 | +function wpinv_process_paypal_subscr_cancel($ipn_data) { |
|
| 616 | + $subscription = wpinv_get_paypal_subscription($ipn_data); |
|
| 617 | 617 | |
| 618 | - if( false === $subscription ) { |
|
| 618 | + if (false === $subscription) { |
|
| 619 | 619 | return; |
| 620 | 620 | } |
| 621 | 621 | |
@@ -625,10 +625,10 @@ discard block |
||
| 625 | 625 | /** |
| 626 | 626 | * Process the subscription expired IPN. |
| 627 | 627 | */ |
| 628 | -function wpinv_process_paypal_subscr_eot( $ipn_data ) { |
|
| 629 | - $subscription = wpinv_get_paypal_subscription( $ipn_data ); |
|
| 628 | +function wpinv_process_paypal_subscr_eot($ipn_data) { |
|
| 629 | + $subscription = wpinv_get_paypal_subscription($ipn_data); |
|
| 630 | 630 | |
| 631 | - if( false === $subscription ) { |
|
| 631 | + if (false === $subscription) { |
|
| 632 | 632 | return; |
| 633 | 633 | } |
| 634 | 634 | |
@@ -638,45 +638,45 @@ discard block |
||
| 638 | 638 | /** |
| 639 | 639 | * Process the subscription payment failed IPN. |
| 640 | 640 | */ |
| 641 | -function wpinv_process_paypal_subscr_failed( $ipn_data ) { |
|
| 642 | - $subscription = wpinv_get_paypal_subscription( $ipn_data ); |
|
| 641 | +function wpinv_process_paypal_subscr_failed($ipn_data) { |
|
| 642 | + $subscription = wpinv_get_paypal_subscription($ipn_data); |
|
| 643 | 643 | |
| 644 | - if( false === $subscription ) { |
|
| 644 | + if (false === $subscription) { |
|
| 645 | 645 | return; |
| 646 | 646 | } |
| 647 | 647 | |
| 648 | 648 | $subscription->failing_subscription(); |
| 649 | 649 | |
| 650 | - do_action( 'wpinv_recurring_payment_failed', $subscription ); |
|
| 650 | + do_action('wpinv_recurring_payment_failed', $subscription); |
|
| 651 | 651 | } |
| 652 | 652 | |
| 653 | 653 | /** |
| 654 | 654 | * Retrieve the subscription this IPN notice is for. |
| 655 | 655 | */ |
| 656 | -function wpinv_get_paypal_subscription( $ipn_data = array() ) { |
|
| 657 | - $parent_invoice_id = absint( $ipn_data['custom'] ); |
|
| 656 | +function wpinv_get_paypal_subscription($ipn_data = array()) { |
|
| 657 | + $parent_invoice_id = absint($ipn_data['custom']); |
|
| 658 | 658 | |
| 659 | - if( empty( $parent_invoice_id ) ) { |
|
| 659 | + if (empty($parent_invoice_id)) { |
|
| 660 | 660 | return false; |
| 661 | 661 | } |
| 662 | 662 | |
| 663 | - $invoice = wpinv_get_invoice( $parent_invoice_id ); |
|
| 664 | - if ( empty( $invoice ) ) { |
|
| 663 | + $invoice = wpinv_get_invoice($parent_invoice_id); |
|
| 664 | + if (empty($invoice)) { |
|
| 665 | 665 | return false; |
| 666 | 666 | } |
| 667 | 667 | |
| 668 | - $subscription = wpinv_get_subscription( $ipn_data['subscr_id'], true ); |
|
| 668 | + $subscription = wpinv_get_subscription($ipn_data['subscr_id'], true); |
|
| 669 | 669 | |
| 670 | - if ( empty( $subscription ) ) { |
|
| 671 | - $subs = wpinv_get_subscriptions( array( 'parent_invoice_id' => $parent_invoice_id, 'numberposts' => 1 ) ); |
|
| 672 | - $subscription = reset( $subs ); |
|
| 670 | + if (empty($subscription)) { |
|
| 671 | + $subs = wpinv_get_subscriptions(array('parent_invoice_id' => $parent_invoice_id, 'numberposts' => 1)); |
|
| 672 | + $subscription = reset($subs); |
|
| 673 | 673 | |
| 674 | - if ( $subscription && $subscription->ID > 0 ) { |
|
| 674 | + if ($subscription && $subscription->ID > 0) { |
|
| 675 | 675 | // Update the profile ID so it is set for future renewals |
| 676 | - $subscription->update_subscription( array( 'profile_id' => sanitize_text_field( $ipn_data['subscr_id'] ) ) ); |
|
| 676 | + $subscription->update_subscription(array('profile_id' => sanitize_text_field($ipn_data['subscr_id']))); |
|
| 677 | 677 | } else { |
| 678 | 678 | $subscription = $invoice; |
| 679 | - $subscription->update_subscription( array( 'profile_id' => sanitize_text_field( $ipn_data['subscr_id'] ) ) ); |
|
| 679 | + $subscription->update_subscription(array('profile_id' => sanitize_text_field($ipn_data['subscr_id']))); |
|
| 680 | 680 | // No subscription found with a matching payment ID, bail |
| 681 | 681 | //return false; |
| 682 | 682 | } |
@@ -686,39 +686,39 @@ discard block |
||
| 686 | 686 | |
| 687 | 687 | } |
| 688 | 688 | |
| 689 | -function wpinv_process_paypal_refund( $data, $invoice_id = 0 ) { |
|
| 689 | +function wpinv_process_paypal_refund($data, $invoice_id = 0) { |
|
| 690 | 690 | // Collect payment details |
| 691 | 691 | |
| 692 | - if( empty( $invoice_id ) ) { |
|
| 692 | + if (empty($invoice_id)) { |
|
| 693 | 693 | return; |
| 694 | 694 | } |
| 695 | 695 | |
| 696 | - if ( get_post_status( $invoice_id ) == 'wpi-refunded' ) { |
|
| 696 | + if (get_post_status($invoice_id) == 'wpi-refunded') { |
|
| 697 | 697 | return; // Only refund payments once |
| 698 | 698 | } |
| 699 | 699 | |
| 700 | - $payment_amount = wpinv_payment_total( $invoice_id ); |
|
| 700 | + $payment_amount = wpinv_payment_total($invoice_id); |
|
| 701 | 701 | $refund_amount = $data['mc_gross'] * -1; |
| 702 | 702 | |
| 703 | - if ( number_format( (float) $refund_amount, 2 ) < number_format( (float) $payment_amount, 2 ) ) { |
|
| 704 | - wpinv_insert_payment_note( $invoice_id, sprintf( __( 'Partial PayPal refund processed: %s', 'invoicing' ), $data['parent_txn_id'] ) ); |
|
| 703 | + if (number_format((float)$refund_amount, 2) < number_format((float)$payment_amount, 2)) { |
|
| 704 | + wpinv_insert_payment_note($invoice_id, sprintf(__('Partial PayPal refund processed: %s', 'invoicing'), $data['parent_txn_id'])); |
|
| 705 | 705 | return; // This is a partial refund |
| 706 | 706 | } |
| 707 | 707 | |
| 708 | - wpinv_insert_payment_note( $invoice_id, sprintf( __( 'PayPal Payment #%s Refunded for reason: %s', 'invoicing' ), $data['parent_txn_id'], $data['reason_code'] ) ); |
|
| 709 | - wpinv_insert_payment_note( $invoice_id, sprintf( __( 'PayPal Refund Transaction ID: %s', 'invoicing' ), $data['txn_id'] ) ); |
|
| 710 | - wpinv_update_payment_status( $invoice_id, 'wpi-refunded' ); |
|
| 708 | + wpinv_insert_payment_note($invoice_id, sprintf(__('PayPal Payment #%s Refunded for reason: %s', 'invoicing'), $data['parent_txn_id'], $data['reason_code'])); |
|
| 709 | + wpinv_insert_payment_note($invoice_id, sprintf(__('PayPal Refund Transaction ID: %s', 'invoicing'), $data['txn_id'])); |
|
| 710 | + wpinv_update_payment_status($invoice_id, 'wpi-refunded'); |
|
| 711 | 711 | } |
| 712 | 712 | |
| 713 | -function wpinv_get_paypal_redirect( $ssl_check = false ) { |
|
| 714 | - if ( is_ssl() || ! $ssl_check ) { |
|
| 713 | +function wpinv_get_paypal_redirect($ssl_check = false) { |
|
| 714 | + if (is_ssl() || !$ssl_check) { |
|
| 715 | 715 | $protocol = 'https://'; |
| 716 | 716 | } else { |
| 717 | 717 | $protocol = 'http://'; |
| 718 | 718 | } |
| 719 | 719 | |
| 720 | 720 | // Check the current payment mode |
| 721 | - if ( wpinv_is_test_mode( 'paypal' ) ) { |
|
| 721 | + if (wpinv_is_test_mode('paypal')) { |
|
| 722 | 722 | // Test mode |
| 723 | 723 | $paypal_uri = $protocol . 'www.sandbox.paypal.com/cgi-bin/webscr'; |
| 724 | 724 | } else { |
@@ -726,67 +726,67 @@ discard block |
||
| 726 | 726 | $paypal_uri = $protocol . 'www.paypal.com/cgi-bin/webscr'; |
| 727 | 727 | } |
| 728 | 728 | |
| 729 | - return apply_filters( 'wpinv_paypal_uri', $paypal_uri ); |
|
| 729 | + return apply_filters('wpinv_paypal_uri', $paypal_uri); |
|
| 730 | 730 | } |
| 731 | 731 | |
| 732 | -function wpinv_paypal_success_page_content( $content ) { |
|
| 732 | +function wpinv_paypal_success_page_content($content) { |
|
| 733 | 733 | global $wpi_invoice; |
| 734 | 734 | |
| 735 | 735 | $session = wpinv_get_checkout_session(); |
| 736 | 736 | |
| 737 | - if ( empty( $_GET['invoice-id'] ) && empty( $session['invoice_key'] ) ) { |
|
| 737 | + if (empty($_GET['invoice-id']) && empty($session['invoice_key'])) { |
|
| 738 | 738 | return $content; |
| 739 | 739 | } |
| 740 | 740 | |
| 741 | - $invoice_id = !empty( $_GET['invoice-id'] ) ? absint( $_GET['invoice-id'] ) : wpinv_get_invoice_id_by_key( $session['invoice_key'] ); |
|
| 741 | + $invoice_id = !empty($_GET['invoice-id']) ? absint($_GET['invoice-id']) : wpinv_get_invoice_id_by_key($session['invoice_key']); |
|
| 742 | 742 | |
| 743 | - if ( empty( $invoice_id ) ) { |
|
| 743 | + if (empty($invoice_id)) { |
|
| 744 | 744 | return $content; |
| 745 | 745 | } |
| 746 | 746 | |
| 747 | - $wpi_invoice = wpinv_get_invoice( $invoice_id ); |
|
| 747 | + $wpi_invoice = wpinv_get_invoice($invoice_id); |
|
| 748 | 748 | |
| 749 | - if ( !empty( $wpi_invoice ) && 'wpi-pending' == $wpi_invoice->status ) { |
|
| 749 | + if (!empty($wpi_invoice) && 'wpi-pending' == $wpi_invoice->status) { |
|
| 750 | 750 | // Payment is still pending so show processing indicator to fix the Race Condition, issue # |
| 751 | 751 | ob_start(); |
| 752 | - wpinv_get_template_part( 'wpinv-payment-processing' ); |
|
| 752 | + wpinv_get_template_part('wpinv-payment-processing'); |
|
| 753 | 753 | $content = ob_get_clean(); |
| 754 | 754 | } |
| 755 | 755 | |
| 756 | 756 | return $content; |
| 757 | 757 | } |
| 758 | -add_filter( 'wpinv_payment_confirm_paypal', 'wpinv_paypal_success_page_content' ); |
|
| 758 | +add_filter('wpinv_payment_confirm_paypal', 'wpinv_paypal_success_page_content'); |
|
| 759 | 759 | |
| 760 | -function wpinv_paypal_get_transaction_id( $invoice_id ) { |
|
| 760 | +function wpinv_paypal_get_transaction_id($invoice_id) { |
|
| 761 | 761 | $transaction_id = ''; |
| 762 | - $notes = wpinv_get_invoice_notes( $invoice_id ); |
|
| 762 | + $notes = wpinv_get_invoice_notes($invoice_id); |
|
| 763 | 763 | |
| 764 | - foreach ( $notes as $note ) { |
|
| 765 | - if ( preg_match( '/^PayPal Transaction ID: ([^\s]+)/', $note->comment_content, $match ) ) { |
|
| 764 | + foreach ($notes as $note) { |
|
| 765 | + if (preg_match('/^PayPal Transaction ID: ([^\s]+)/', $note->comment_content, $match)) { |
|
| 766 | 766 | $transaction_id = $match[1]; |
| 767 | 767 | continue; |
| 768 | 768 | } |
| 769 | 769 | } |
| 770 | 770 | |
| 771 | - return apply_filters( 'wpinv_paypal_set_transaction_id', $transaction_id, $invoice_id ); |
|
| 771 | + return apply_filters('wpinv_paypal_set_transaction_id', $transaction_id, $invoice_id); |
|
| 772 | 772 | } |
| 773 | -add_filter( 'wpinv_payment_get_transaction_id-paypal', 'wpinv_paypal_get_transaction_id', 10, 1 ); |
|
| 773 | +add_filter('wpinv_payment_get_transaction_id-paypal', 'wpinv_paypal_get_transaction_id', 10, 1); |
|
| 774 | 774 | |
| 775 | -function wpinv_paypal_link_transaction_id( $transaction_id, $invoice_id, $invoice ) { |
|
| 776 | - if ( $invoice->is_free_trial() || $transaction_id == $invoice_id ) { // Free trial does not have transaction at PayPal. |
|
| 775 | +function wpinv_paypal_link_transaction_id($transaction_id, $invoice_id, $invoice) { |
|
| 776 | + if ($invoice->is_free_trial() || $transaction_id == $invoice_id) { // Free trial does not have transaction at PayPal. |
|
| 777 | 777 | $transaction_url = $invoice->get_view_url(); |
| 778 | 778 | } else { |
| 779 | - $sandbox = wpinv_is_test_mode( 'paypal' ) ? '.sandbox' : ''; |
|
| 779 | + $sandbox = wpinv_is_test_mode('paypal') ? '.sandbox' : ''; |
|
| 780 | 780 | $transaction_url = 'https://www' . $sandbox . '.paypal.com/cgi-bin/webscr?cmd=_view-a-trans&id=' . $transaction_id; |
| 781 | 781 | } |
| 782 | 782 | |
| 783 | - $transaction_link = '<a href="' . esc_url( $transaction_url ) . '" target="_blank">' . $transaction_id . '</a>'; |
|
| 783 | + $transaction_link = '<a href="' . esc_url($transaction_url) . '" target="_blank">' . $transaction_id . '</a>'; |
|
| 784 | 784 | |
| 785 | - return apply_filters( 'wpinv_paypal_link_payment_details_transaction_id', $transaction_link, $invoice ); |
|
| 785 | + return apply_filters('wpinv_paypal_link_payment_details_transaction_id', $transaction_link, $invoice); |
|
| 786 | 786 | } |
| 787 | -add_filter( 'wpinv_payment_details_transaction_id-paypal', 'wpinv_paypal_link_transaction_id', 10, 3 ); |
|
| 787 | +add_filter('wpinv_payment_details_transaction_id-paypal', 'wpinv_paypal_link_transaction_id', 10, 3); |
|
| 788 | 788 | |
| 789 | 789 | function wpinv_gateway_paypal_button_label($label) { |
| 790 | - return __( 'Proceed to PayPal', 'invoicing' ); |
|
| 790 | + return __('Proceed to PayPal', 'invoicing'); |
|
| 791 | 791 | } |
| 792 | -add_filter( 'wpinv_gateway_paypal_button_label', 'wpinv_gateway_paypal_button_label', 10, 1 ); |
|
| 793 | 792 | \ No newline at end of file |
| 793 | +add_filter('wpinv_gateway_paypal_button_label', 'wpinv_gateway_paypal_button_label', 10, 1); |
|
| 794 | 794 | \ No newline at end of file |
@@ -13,9 +13,9 @@ discard block |
||
| 13 | 13 | |
| 14 | 14 | |
| 15 | 15 | function wpinv_get_default_country() { |
| 16 | - $country = wpinv_get_option( 'default_country', 'UK' ); |
|
| 16 | + $country = wpinv_get_option( 'default_country', 'UK' ); |
|
| 17 | 17 | |
| 18 | - return apply_filters( 'wpinv_default_country', $country ); |
|
| 18 | + return apply_filters( 'wpinv_default_country', $country ); |
|
| 19 | 19 | } |
| 20 | 20 | |
| 21 | 21 | function wpinv_is_base_country( $country ) { |
@@ -40,9 +40,9 @@ discard block |
||
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | function wpinv_get_default_state() { |
| 43 | - $state = wpinv_get_option( 'default_state', false ); |
|
| 43 | + $state = wpinv_get_option( 'default_state', false ); |
|
| 44 | 44 | |
| 45 | - return apply_filters( 'wpinv_default_state', $state ); |
|
| 45 | + return apply_filters( 'wpinv_default_state', $state ); |
|
| 46 | 46 | } |
| 47 | 47 | |
| 48 | 48 | function wpinv_state_name( $state_code = '', $country_code = '' ) { |
@@ -115,260 +115,260 @@ discard block |
||
| 115 | 115 | } |
| 116 | 116 | |
| 117 | 117 | function wpinv_get_country_list( $first_empty = false ) { |
| 118 | - $countries = array( |
|
| 119 | - 'US' => __('United States', 'invoicing'), |
|
| 120 | - 'CA' => __('Canada', 'invoicing'), |
|
| 121 | - 'GB' => __('United Kingdom', 'invoicing'), |
|
| 122 | - 'AF' => __('Afghanistan', 'invoicing'), |
|
| 123 | - 'AX' => __('Aland Islands', 'invoicing'), |
|
| 124 | - 'AL' => __('Albania', 'invoicing'), |
|
| 125 | - 'DZ' => __('Algeria', 'invoicing'), |
|
| 126 | - 'AS' => __('American Samoa', 'invoicing'), |
|
| 127 | - 'AD' => __('Andorra', 'invoicing'), |
|
| 128 | - 'AO' => __('Angola', 'invoicing'), |
|
| 129 | - 'AI' => __('Anguilla', 'invoicing'), |
|
| 130 | - 'AQ' => __('Antarctica', 'invoicing'), |
|
| 131 | - 'AG' => __('Antigua and Barbuda', 'invoicing'), |
|
| 132 | - 'AR' => __('Argentina', 'invoicing'), |
|
| 133 | - 'AM' => __('Armenia', 'invoicing'), |
|
| 134 | - 'AW' => __('Aruba', 'invoicing'), |
|
| 135 | - 'AU' => __('Australia', 'invoicing'), |
|
| 136 | - 'AT' => __('Austria', 'invoicing'), |
|
| 137 | - 'AZ' => __('Azerbaijan', 'invoicing'), |
|
| 138 | - 'BS' => __('Bahamas', 'invoicing'), |
|
| 139 | - 'BH' => __('Bahrain', 'invoicing'), |
|
| 140 | - 'BD' => __('Bangladesh', 'invoicing'), |
|
| 141 | - 'BB' => __('Barbados', 'invoicing'), |
|
| 142 | - 'BY' => __('Belarus', 'invoicing'), |
|
| 143 | - 'BE' => __('Belgium', 'invoicing'), |
|
| 144 | - 'BZ' => __('Belize', 'invoicing'), |
|
| 145 | - 'BJ' => __('Benin', 'invoicing'), |
|
| 146 | - 'BM' => __('Bermuda', 'invoicing'), |
|
| 147 | - 'BT' => __('Bhutan', 'invoicing'), |
|
| 148 | - 'BO' => __('Bolivia', 'invoicing'), |
|
| 149 | - 'BQ' => __('Bonaire, Saint Eustatius and Saba', 'invoicing'), |
|
| 150 | - 'BA' => __('Bosnia and Herzegovina', 'invoicing'), |
|
| 151 | - 'BW' => __('Botswana', 'invoicing'), |
|
| 152 | - 'BV' => __('Bouvet Island', 'invoicing'), |
|
| 153 | - 'BR' => __('Brazil', 'invoicing'), |
|
| 154 | - 'IO' => __('British Indian Ocean Territory', 'invoicing'), |
|
| 155 | - 'BN' => __('Brunei Darrussalam', 'invoicing'), |
|
| 156 | - 'BG' => __('Bulgaria', 'invoicing'), |
|
| 157 | - 'BF' => __('Burkina Faso', 'invoicing'), |
|
| 158 | - 'BI' => __('Burundi', 'invoicing'), |
|
| 159 | - 'KH' => __('Cambodia', 'invoicing'), |
|
| 160 | - 'CM' => __('Cameroon', 'invoicing'), |
|
| 161 | - 'CV' => __('Cape Verde', 'invoicing'), |
|
| 162 | - 'KY' => __('Cayman Islands', 'invoicing'), |
|
| 163 | - 'CF' => __('Central African Republic', 'invoicing'), |
|
| 164 | - 'TD' => __('Chad', 'invoicing'), |
|
| 165 | - 'CL' => __('Chile', 'invoicing'), |
|
| 166 | - 'CN' => __('China', 'invoicing'), |
|
| 167 | - 'CX' => __('Christmas Island', 'invoicing'), |
|
| 168 | - 'CC' => __('Cocos Islands', 'invoicing'), |
|
| 169 | - 'CO' => __('Colombia', 'invoicing'), |
|
| 170 | - 'KM' => __('Comoros', 'invoicing'), |
|
| 171 | - 'CD' => __('Congo, Democratic People\'s Republic', 'invoicing'), |
|
| 172 | - 'CG' => __('Congo, Republic of', 'invoicing'), |
|
| 173 | - 'CK' => __('Cook Islands', 'invoicing'), |
|
| 174 | - 'CR' => __('Costa Rica', 'invoicing'), |
|
| 175 | - 'CI' => __('Cote d\'Ivoire', 'invoicing'), |
|
| 176 | - 'HR' => __('Croatia/Hrvatska', 'invoicing'), |
|
| 177 | - 'CU' => __('Cuba', 'invoicing'), |
|
| 178 | - 'CW' => __('CuraÇao', 'invoicing'), |
|
| 179 | - 'CY' => __('Cyprus', 'invoicing'), |
|
| 180 | - 'CZ' => __('Czech Republic', 'invoicing'), |
|
| 181 | - 'DK' => __('Denmark', 'invoicing'), |
|
| 182 | - 'DJ' => __('Djibouti', 'invoicing'), |
|
| 183 | - 'DM' => __('Dominica', 'invoicing'), |
|
| 184 | - 'DO' => __('Dominican Republic', 'invoicing'), |
|
| 185 | - 'TP' => __('East Timor', 'invoicing'), |
|
| 186 | - 'EC' => __('Ecuador', 'invoicing'), |
|
| 187 | - 'EG' => __('Egypt', 'invoicing'), |
|
| 188 | - 'GQ' => __('Equatorial Guinea', 'invoicing'), |
|
| 189 | - 'SV' => __('El Salvador', 'invoicing'), |
|
| 190 | - 'ER' => __('Eritrea', 'invoicing'), |
|
| 191 | - 'EE' => __('Estonia', 'invoicing'), |
|
| 192 | - 'ET' => __('Ethiopia', 'invoicing'), |
|
| 193 | - 'FK' => __('Falkland Islands', 'invoicing'), |
|
| 194 | - 'FO' => __('Faroe Islands', 'invoicing'), |
|
| 195 | - 'FJ' => __('Fiji', 'invoicing'), |
|
| 196 | - 'FI' => __('Finland', 'invoicing'), |
|
| 197 | - 'FR' => __('France', 'invoicing'), |
|
| 198 | - 'GF' => __('French Guiana', 'invoicing'), |
|
| 199 | - 'PF' => __('French Polynesia', 'invoicing'), |
|
| 200 | - 'TF' => __('French Southern Territories', 'invoicing'), |
|
| 201 | - 'GA' => __('Gabon', 'invoicing'), |
|
| 202 | - 'GM' => __('Gambia', 'invoicing'), |
|
| 203 | - 'GE' => __('Georgia', 'invoicing'), |
|
| 204 | - 'DE' => __('Germany', 'invoicing'), |
|
| 205 | - 'GR' => __('Greece', 'invoicing'), |
|
| 206 | - 'GH' => __('Ghana', 'invoicing'), |
|
| 207 | - 'GI' => __('Gibraltar', 'invoicing'), |
|
| 208 | - 'GL' => __('Greenland', 'invoicing'), |
|
| 209 | - 'GD' => __('Grenada', 'invoicing'), |
|
| 210 | - 'GP' => __('Guadeloupe', 'invoicing'), |
|
| 211 | - 'GU' => __('Guam', 'invoicing'), |
|
| 212 | - 'GT' => __('Guatemala', 'invoicing'), |
|
| 213 | - 'GG' => __('Guernsey', 'invoicing'), |
|
| 214 | - 'GN' => __('Guinea', 'invoicing'), |
|
| 215 | - 'GW' => __('Guinea-Bissau', 'invoicing'), |
|
| 216 | - 'GY' => __('Guyana', 'invoicing'), |
|
| 217 | - 'HT' => __('Haiti', 'invoicing'), |
|
| 218 | - 'HM' => __('Heard and McDonald Islands', 'invoicing'), |
|
| 219 | - 'VA' => __('Holy See (City Vatican State)', 'invoicing'), |
|
| 220 | - 'HN' => __('Honduras', 'invoicing'), |
|
| 221 | - 'HK' => __('Hong Kong', 'invoicing'), |
|
| 222 | - 'HU' => __('Hungary', 'invoicing'), |
|
| 223 | - 'IS' => __('Iceland', 'invoicing'), |
|
| 224 | - 'IN' => __('India', 'invoicing'), |
|
| 225 | - 'ID' => __('Indonesia', 'invoicing'), |
|
| 226 | - 'IR' => __('Iran', 'invoicing'), |
|
| 227 | - 'IQ' => __('Iraq', 'invoicing'), |
|
| 228 | - 'IE' => __('Ireland', 'invoicing'), |
|
| 229 | - 'IM' => __('Isle of Man', 'invoicing'), |
|
| 230 | - 'IL' => __('Israel', 'invoicing'), |
|
| 231 | - 'IT' => __('Italy', 'invoicing'), |
|
| 232 | - 'JM' => __('Jamaica', 'invoicing'), |
|
| 233 | - 'JP' => __('Japan', 'invoicing'), |
|
| 234 | - 'JE' => __('Jersey', 'invoicing'), |
|
| 235 | - 'JO' => __('Jordan', 'invoicing'), |
|
| 236 | - 'KZ' => __('Kazakhstan', 'invoicing'), |
|
| 237 | - 'KE' => __('Kenya', 'invoicing'), |
|
| 238 | - 'KI' => __('Kiribati', 'invoicing'), |
|
| 239 | - 'KW' => __('Kuwait', 'invoicing'), |
|
| 240 | - 'KG' => __('Kyrgyzstan', 'invoicing'), |
|
| 241 | - 'LA' => __('Lao People\'s Democratic Republic', 'invoicing'), |
|
| 242 | - 'LV' => __('Latvia', 'invoicing'), |
|
| 243 | - 'LB' => __('Lebanon', 'invoicing'), |
|
| 244 | - 'LS' => __('Lesotho', 'invoicing'), |
|
| 245 | - 'LR' => __('Liberia', 'invoicing'), |
|
| 246 | - 'LY' => __('Libyan Arab Jamahiriya', 'invoicing'), |
|
| 247 | - 'LI' => __('Liechtenstein', 'invoicing'), |
|
| 248 | - 'LT' => __('Lithuania', 'invoicing'), |
|
| 249 | - 'LU' => __('Luxembourg', 'invoicing'), |
|
| 250 | - 'MO' => __('Macau', 'invoicing'), |
|
| 251 | - 'MK' => __('Macedonia', 'invoicing'), |
|
| 252 | - 'MG' => __('Madagascar', 'invoicing'), |
|
| 253 | - 'MW' => __('Malawi', 'invoicing'), |
|
| 254 | - 'MY' => __('Malaysia', 'invoicing'), |
|
| 255 | - 'MV' => __('Maldives', 'invoicing'), |
|
| 256 | - 'ML' => __('Mali', 'invoicing'), |
|
| 257 | - 'MT' => __('Malta', 'invoicing'), |
|
| 258 | - 'MH' => __('Marshall Islands', 'invoicing'), |
|
| 259 | - 'MQ' => __('Martinique', 'invoicing'), |
|
| 260 | - 'MR' => __('Mauritania', 'invoicing'), |
|
| 261 | - 'MU' => __('Mauritius', 'invoicing'), |
|
| 262 | - 'YT' => __('Mayotte', 'invoicing'), |
|
| 263 | - 'MX' => __('Mexico', 'invoicing'), |
|
| 264 | - 'FM' => __('Micronesia', 'invoicing'), |
|
| 265 | - 'MD' => __('Moldova, Republic of', 'invoicing'), |
|
| 266 | - 'MC' => __('Monaco', 'invoicing'), |
|
| 267 | - 'MN' => __('Mongolia', 'invoicing'), |
|
| 268 | - 'ME' => __('Montenegro', 'invoicing'), |
|
| 269 | - 'MS' => __('Montserrat', 'invoicing'), |
|
| 270 | - 'MA' => __('Morocco', 'invoicing'), |
|
| 271 | - 'MZ' => __('Mozambique', 'invoicing'), |
|
| 272 | - 'MM' => __('Myanmar', 'invoicing'), |
|
| 273 | - 'NA' => __('Namibia', 'invoicing'), |
|
| 274 | - 'NR' => __('Nauru', 'invoicing'), |
|
| 275 | - 'NP' => __('Nepal', 'invoicing'), |
|
| 276 | - 'NL' => __('Netherlands', 'invoicing'), |
|
| 277 | - 'AN' => __('Netherlands Antilles', 'invoicing'), |
|
| 278 | - 'NC' => __('New Caledonia', 'invoicing'), |
|
| 279 | - 'NZ' => __('New Zealand', 'invoicing'), |
|
| 280 | - 'NI' => __('Nicaragua', 'invoicing'), |
|
| 281 | - 'NE' => __('Niger', 'invoicing'), |
|
| 282 | - 'NG' => __('Nigeria', 'invoicing'), |
|
| 283 | - 'NU' => __('Niue', 'invoicing'), |
|
| 284 | - 'NF' => __('Norfolk Island', 'invoicing'), |
|
| 285 | - 'KP' => __('North Korea', 'invoicing'), |
|
| 286 | - 'MP' => __('Northern Mariana Islands', 'invoicing'), |
|
| 287 | - 'NO' => __('Norway', 'invoicing'), |
|
| 288 | - 'OM' => __('Oman', 'invoicing'), |
|
| 289 | - 'PK' => __('Pakistan', 'invoicing'), |
|
| 290 | - 'PW' => __('Palau', 'invoicing'), |
|
| 291 | - 'PS' => __('Palestinian Territories', 'invoicing'), |
|
| 292 | - 'PA' => __('Panama', 'invoicing'), |
|
| 293 | - 'PG' => __('Papua New Guinea', 'invoicing'), |
|
| 294 | - 'PY' => __('Paraguay', 'invoicing'), |
|
| 295 | - 'PE' => __('Peru', 'invoicing'), |
|
| 296 | - 'PH' => __('Phillipines', 'invoicing'), |
|
| 297 | - 'PN' => __('Pitcairn Island', 'invoicing'), |
|
| 298 | - 'PL' => __('Poland', 'invoicing'), |
|
| 299 | - 'PT' => __('Portugal', 'invoicing'), |
|
| 300 | - 'PR' => __('Puerto Rico', 'invoicing'), |
|
| 301 | - 'QA' => __('Qatar', 'invoicing'), |
|
| 302 | - 'XK' => __('Republic of Kosovo', 'invoicing'), |
|
| 303 | - 'RE' => __('Reunion Island', 'invoicing'), |
|
| 304 | - 'RO' => __('Romania', 'invoicing'), |
|
| 305 | - 'RU' => __('Russian Federation', 'invoicing'), |
|
| 306 | - 'RW' => __('Rwanda', 'invoicing'), |
|
| 307 | - 'BL' => __('Saint Barthélemy', 'invoicing'), |
|
| 308 | - 'SH' => __('Saint Helena', 'invoicing'), |
|
| 309 | - 'KN' => __('Saint Kitts and Nevis', 'invoicing'), |
|
| 310 | - 'LC' => __('Saint Lucia', 'invoicing'), |
|
| 311 | - 'MF' => __('Saint Martin (French)', 'invoicing'), |
|
| 312 | - 'SX' => __('Saint Martin (Dutch)', 'invoicing'), |
|
| 313 | - 'PM' => __('Saint Pierre and Miquelon', 'invoicing'), |
|
| 314 | - 'VC' => __('Saint Vincent and the Grenadines', 'invoicing'), |
|
| 315 | - 'SM' => __('San Marino', 'invoicing'), |
|
| 316 | - 'ST' => __('São Tomé and Príncipe', 'invoicing'), |
|
| 317 | - 'SA' => __('Saudi Arabia', 'invoicing'), |
|
| 318 | - 'SN' => __('Senegal', 'invoicing'), |
|
| 319 | - 'RS' => __('Serbia', 'invoicing'), |
|
| 320 | - 'SC' => __('Seychelles', 'invoicing'), |
|
| 321 | - 'SL' => __('Sierra Leone', 'invoicing'), |
|
| 322 | - 'SG' => __('Singapore', 'invoicing'), |
|
| 323 | - 'SK' => __('Slovak Republic', 'invoicing'), |
|
| 324 | - 'SI' => __('Slovenia', 'invoicing'), |
|
| 325 | - 'SB' => __('Solomon Islands', 'invoicing'), |
|
| 326 | - 'SO' => __('Somalia', 'invoicing'), |
|
| 327 | - 'ZA' => __('South Africa', 'invoicing'), |
|
| 328 | - 'GS' => __('South Georgia', 'invoicing'), |
|
| 329 | - 'KR' => __('South Korea', 'invoicing'), |
|
| 330 | - 'SS' => __('South Sudan', 'invoicing'), |
|
| 331 | - 'ES' => __('Spain', 'invoicing'), |
|
| 332 | - 'LK' => __('Sri Lanka', 'invoicing'), |
|
| 333 | - 'SD' => __('Sudan', 'invoicing'), |
|
| 334 | - 'SR' => __('Suriname', 'invoicing'), |
|
| 335 | - 'SJ' => __('Svalbard and Jan Mayen Islands', 'invoicing'), |
|
| 336 | - 'SZ' => __('Swaziland', 'invoicing'), |
|
| 337 | - 'SE' => __('Sweden', 'invoicing'), |
|
| 338 | - 'CH' => __('Switzerland', 'invoicing'), |
|
| 339 | - 'SY' => __('Syrian Arab Republic', 'invoicing'), |
|
| 340 | - 'TW' => __('Taiwan', 'invoicing'), |
|
| 341 | - 'TJ' => __('Tajikistan', 'invoicing'), |
|
| 342 | - 'TZ' => __('Tanzania', 'invoicing'), |
|
| 343 | - 'TH' => __('Thailand', 'invoicing'), |
|
| 344 | - 'TL' => __('Timor-Leste', 'invoicing'), |
|
| 345 | - 'TG' => __('Togo', 'invoicing'), |
|
| 346 | - 'TK' => __('Tokelau', 'invoicing'), |
|
| 347 | - 'TO' => __('Tonga', 'invoicing'), |
|
| 348 | - 'TT' => __('Trinidad and Tobago', 'invoicing'), |
|
| 349 | - 'TN' => __('Tunisia', 'invoicing'), |
|
| 350 | - 'TR' => __('Turkey', 'invoicing'), |
|
| 351 | - 'TM' => __('Turkmenistan', 'invoicing'), |
|
| 352 | - 'TC' => __('Turks and Caicos Islands', 'invoicing'), |
|
| 353 | - 'TV' => __('Tuvalu', 'invoicing'), |
|
| 354 | - 'UG' => __('Uganda', 'invoicing'), |
|
| 355 | - 'UA' => __('Ukraine', 'invoicing'), |
|
| 356 | - 'AE' => __('United Arab Emirates', 'invoicing'), |
|
| 357 | - 'UY' => __('Uruguay', 'invoicing'), |
|
| 358 | - 'UM' => __('US Minor Outlying Islands', 'invoicing'), |
|
| 359 | - 'UZ' => __('Uzbekistan', 'invoicing'), |
|
| 360 | - 'VU' => __('Vanuatu', 'invoicing'), |
|
| 361 | - 'VE' => __('Venezuela', 'invoicing'), |
|
| 362 | - 'VN' => __('Vietnam', 'invoicing'), |
|
| 363 | - 'VG' => __('Virgin Islands (British)', 'invoicing'), |
|
| 364 | - 'VI' => __('Virgin Islands (USA)', 'invoicing'), |
|
| 365 | - 'WF' => __('Wallis and Futuna Islands', 'invoicing'), |
|
| 366 | - 'EH' => __('Western Sahara', 'invoicing'), |
|
| 367 | - 'WS' => __('Western Samoa', 'invoicing'), |
|
| 368 | - 'YE' => __('Yemen', 'invoicing'), |
|
| 369 | - 'ZM' => __('Zambia', 'invoicing'), |
|
| 370 | - 'ZW' => __('Zimbabwe', 'invoicing'), |
|
| 371 | - ); |
|
| 118 | + $countries = array( |
|
| 119 | + 'US' => __('United States', 'invoicing'), |
|
| 120 | + 'CA' => __('Canada', 'invoicing'), |
|
| 121 | + 'GB' => __('United Kingdom', 'invoicing'), |
|
| 122 | + 'AF' => __('Afghanistan', 'invoicing'), |
|
| 123 | + 'AX' => __('Aland Islands', 'invoicing'), |
|
| 124 | + 'AL' => __('Albania', 'invoicing'), |
|
| 125 | + 'DZ' => __('Algeria', 'invoicing'), |
|
| 126 | + 'AS' => __('American Samoa', 'invoicing'), |
|
| 127 | + 'AD' => __('Andorra', 'invoicing'), |
|
| 128 | + 'AO' => __('Angola', 'invoicing'), |
|
| 129 | + 'AI' => __('Anguilla', 'invoicing'), |
|
| 130 | + 'AQ' => __('Antarctica', 'invoicing'), |
|
| 131 | + 'AG' => __('Antigua and Barbuda', 'invoicing'), |
|
| 132 | + 'AR' => __('Argentina', 'invoicing'), |
|
| 133 | + 'AM' => __('Armenia', 'invoicing'), |
|
| 134 | + 'AW' => __('Aruba', 'invoicing'), |
|
| 135 | + 'AU' => __('Australia', 'invoicing'), |
|
| 136 | + 'AT' => __('Austria', 'invoicing'), |
|
| 137 | + 'AZ' => __('Azerbaijan', 'invoicing'), |
|
| 138 | + 'BS' => __('Bahamas', 'invoicing'), |
|
| 139 | + 'BH' => __('Bahrain', 'invoicing'), |
|
| 140 | + 'BD' => __('Bangladesh', 'invoicing'), |
|
| 141 | + 'BB' => __('Barbados', 'invoicing'), |
|
| 142 | + 'BY' => __('Belarus', 'invoicing'), |
|
| 143 | + 'BE' => __('Belgium', 'invoicing'), |
|
| 144 | + 'BZ' => __('Belize', 'invoicing'), |
|
| 145 | + 'BJ' => __('Benin', 'invoicing'), |
|
| 146 | + 'BM' => __('Bermuda', 'invoicing'), |
|
| 147 | + 'BT' => __('Bhutan', 'invoicing'), |
|
| 148 | + 'BO' => __('Bolivia', 'invoicing'), |
|
| 149 | + 'BQ' => __('Bonaire, Saint Eustatius and Saba', 'invoicing'), |
|
| 150 | + 'BA' => __('Bosnia and Herzegovina', 'invoicing'), |
|
| 151 | + 'BW' => __('Botswana', 'invoicing'), |
|
| 152 | + 'BV' => __('Bouvet Island', 'invoicing'), |
|
| 153 | + 'BR' => __('Brazil', 'invoicing'), |
|
| 154 | + 'IO' => __('British Indian Ocean Territory', 'invoicing'), |
|
| 155 | + 'BN' => __('Brunei Darrussalam', 'invoicing'), |
|
| 156 | + 'BG' => __('Bulgaria', 'invoicing'), |
|
| 157 | + 'BF' => __('Burkina Faso', 'invoicing'), |
|
| 158 | + 'BI' => __('Burundi', 'invoicing'), |
|
| 159 | + 'KH' => __('Cambodia', 'invoicing'), |
|
| 160 | + 'CM' => __('Cameroon', 'invoicing'), |
|
| 161 | + 'CV' => __('Cape Verde', 'invoicing'), |
|
| 162 | + 'KY' => __('Cayman Islands', 'invoicing'), |
|
| 163 | + 'CF' => __('Central African Republic', 'invoicing'), |
|
| 164 | + 'TD' => __('Chad', 'invoicing'), |
|
| 165 | + 'CL' => __('Chile', 'invoicing'), |
|
| 166 | + 'CN' => __('China', 'invoicing'), |
|
| 167 | + 'CX' => __('Christmas Island', 'invoicing'), |
|
| 168 | + 'CC' => __('Cocos Islands', 'invoicing'), |
|
| 169 | + 'CO' => __('Colombia', 'invoicing'), |
|
| 170 | + 'KM' => __('Comoros', 'invoicing'), |
|
| 171 | + 'CD' => __('Congo, Democratic People\'s Republic', 'invoicing'), |
|
| 172 | + 'CG' => __('Congo, Republic of', 'invoicing'), |
|
| 173 | + 'CK' => __('Cook Islands', 'invoicing'), |
|
| 174 | + 'CR' => __('Costa Rica', 'invoicing'), |
|
| 175 | + 'CI' => __('Cote d\'Ivoire', 'invoicing'), |
|
| 176 | + 'HR' => __('Croatia/Hrvatska', 'invoicing'), |
|
| 177 | + 'CU' => __('Cuba', 'invoicing'), |
|
| 178 | + 'CW' => __('CuraÇao', 'invoicing'), |
|
| 179 | + 'CY' => __('Cyprus', 'invoicing'), |
|
| 180 | + 'CZ' => __('Czech Republic', 'invoicing'), |
|
| 181 | + 'DK' => __('Denmark', 'invoicing'), |
|
| 182 | + 'DJ' => __('Djibouti', 'invoicing'), |
|
| 183 | + 'DM' => __('Dominica', 'invoicing'), |
|
| 184 | + 'DO' => __('Dominican Republic', 'invoicing'), |
|
| 185 | + 'TP' => __('East Timor', 'invoicing'), |
|
| 186 | + 'EC' => __('Ecuador', 'invoicing'), |
|
| 187 | + 'EG' => __('Egypt', 'invoicing'), |
|
| 188 | + 'GQ' => __('Equatorial Guinea', 'invoicing'), |
|
| 189 | + 'SV' => __('El Salvador', 'invoicing'), |
|
| 190 | + 'ER' => __('Eritrea', 'invoicing'), |
|
| 191 | + 'EE' => __('Estonia', 'invoicing'), |
|
| 192 | + 'ET' => __('Ethiopia', 'invoicing'), |
|
| 193 | + 'FK' => __('Falkland Islands', 'invoicing'), |
|
| 194 | + 'FO' => __('Faroe Islands', 'invoicing'), |
|
| 195 | + 'FJ' => __('Fiji', 'invoicing'), |
|
| 196 | + 'FI' => __('Finland', 'invoicing'), |
|
| 197 | + 'FR' => __('France', 'invoicing'), |
|
| 198 | + 'GF' => __('French Guiana', 'invoicing'), |
|
| 199 | + 'PF' => __('French Polynesia', 'invoicing'), |
|
| 200 | + 'TF' => __('French Southern Territories', 'invoicing'), |
|
| 201 | + 'GA' => __('Gabon', 'invoicing'), |
|
| 202 | + 'GM' => __('Gambia', 'invoicing'), |
|
| 203 | + 'GE' => __('Georgia', 'invoicing'), |
|
| 204 | + 'DE' => __('Germany', 'invoicing'), |
|
| 205 | + 'GR' => __('Greece', 'invoicing'), |
|
| 206 | + 'GH' => __('Ghana', 'invoicing'), |
|
| 207 | + 'GI' => __('Gibraltar', 'invoicing'), |
|
| 208 | + 'GL' => __('Greenland', 'invoicing'), |
|
| 209 | + 'GD' => __('Grenada', 'invoicing'), |
|
| 210 | + 'GP' => __('Guadeloupe', 'invoicing'), |
|
| 211 | + 'GU' => __('Guam', 'invoicing'), |
|
| 212 | + 'GT' => __('Guatemala', 'invoicing'), |
|
| 213 | + 'GG' => __('Guernsey', 'invoicing'), |
|
| 214 | + 'GN' => __('Guinea', 'invoicing'), |
|
| 215 | + 'GW' => __('Guinea-Bissau', 'invoicing'), |
|
| 216 | + 'GY' => __('Guyana', 'invoicing'), |
|
| 217 | + 'HT' => __('Haiti', 'invoicing'), |
|
| 218 | + 'HM' => __('Heard and McDonald Islands', 'invoicing'), |
|
| 219 | + 'VA' => __('Holy See (City Vatican State)', 'invoicing'), |
|
| 220 | + 'HN' => __('Honduras', 'invoicing'), |
|
| 221 | + 'HK' => __('Hong Kong', 'invoicing'), |
|
| 222 | + 'HU' => __('Hungary', 'invoicing'), |
|
| 223 | + 'IS' => __('Iceland', 'invoicing'), |
|
| 224 | + 'IN' => __('India', 'invoicing'), |
|
| 225 | + 'ID' => __('Indonesia', 'invoicing'), |
|
| 226 | + 'IR' => __('Iran', 'invoicing'), |
|
| 227 | + 'IQ' => __('Iraq', 'invoicing'), |
|
| 228 | + 'IE' => __('Ireland', 'invoicing'), |
|
| 229 | + 'IM' => __('Isle of Man', 'invoicing'), |
|
| 230 | + 'IL' => __('Israel', 'invoicing'), |
|
| 231 | + 'IT' => __('Italy', 'invoicing'), |
|
| 232 | + 'JM' => __('Jamaica', 'invoicing'), |
|
| 233 | + 'JP' => __('Japan', 'invoicing'), |
|
| 234 | + 'JE' => __('Jersey', 'invoicing'), |
|
| 235 | + 'JO' => __('Jordan', 'invoicing'), |
|
| 236 | + 'KZ' => __('Kazakhstan', 'invoicing'), |
|
| 237 | + 'KE' => __('Kenya', 'invoicing'), |
|
| 238 | + 'KI' => __('Kiribati', 'invoicing'), |
|
| 239 | + 'KW' => __('Kuwait', 'invoicing'), |
|
| 240 | + 'KG' => __('Kyrgyzstan', 'invoicing'), |
|
| 241 | + 'LA' => __('Lao People\'s Democratic Republic', 'invoicing'), |
|
| 242 | + 'LV' => __('Latvia', 'invoicing'), |
|
| 243 | + 'LB' => __('Lebanon', 'invoicing'), |
|
| 244 | + 'LS' => __('Lesotho', 'invoicing'), |
|
| 245 | + 'LR' => __('Liberia', 'invoicing'), |
|
| 246 | + 'LY' => __('Libyan Arab Jamahiriya', 'invoicing'), |
|
| 247 | + 'LI' => __('Liechtenstein', 'invoicing'), |
|
| 248 | + 'LT' => __('Lithuania', 'invoicing'), |
|
| 249 | + 'LU' => __('Luxembourg', 'invoicing'), |
|
| 250 | + 'MO' => __('Macau', 'invoicing'), |
|
| 251 | + 'MK' => __('Macedonia', 'invoicing'), |
|
| 252 | + 'MG' => __('Madagascar', 'invoicing'), |
|
| 253 | + 'MW' => __('Malawi', 'invoicing'), |
|
| 254 | + 'MY' => __('Malaysia', 'invoicing'), |
|
| 255 | + 'MV' => __('Maldives', 'invoicing'), |
|
| 256 | + 'ML' => __('Mali', 'invoicing'), |
|
| 257 | + 'MT' => __('Malta', 'invoicing'), |
|
| 258 | + 'MH' => __('Marshall Islands', 'invoicing'), |
|
| 259 | + 'MQ' => __('Martinique', 'invoicing'), |
|
| 260 | + 'MR' => __('Mauritania', 'invoicing'), |
|
| 261 | + 'MU' => __('Mauritius', 'invoicing'), |
|
| 262 | + 'YT' => __('Mayotte', 'invoicing'), |
|
| 263 | + 'MX' => __('Mexico', 'invoicing'), |
|
| 264 | + 'FM' => __('Micronesia', 'invoicing'), |
|
| 265 | + 'MD' => __('Moldova, Republic of', 'invoicing'), |
|
| 266 | + 'MC' => __('Monaco', 'invoicing'), |
|
| 267 | + 'MN' => __('Mongolia', 'invoicing'), |
|
| 268 | + 'ME' => __('Montenegro', 'invoicing'), |
|
| 269 | + 'MS' => __('Montserrat', 'invoicing'), |
|
| 270 | + 'MA' => __('Morocco', 'invoicing'), |
|
| 271 | + 'MZ' => __('Mozambique', 'invoicing'), |
|
| 272 | + 'MM' => __('Myanmar', 'invoicing'), |
|
| 273 | + 'NA' => __('Namibia', 'invoicing'), |
|
| 274 | + 'NR' => __('Nauru', 'invoicing'), |
|
| 275 | + 'NP' => __('Nepal', 'invoicing'), |
|
| 276 | + 'NL' => __('Netherlands', 'invoicing'), |
|
| 277 | + 'AN' => __('Netherlands Antilles', 'invoicing'), |
|
| 278 | + 'NC' => __('New Caledonia', 'invoicing'), |
|
| 279 | + 'NZ' => __('New Zealand', 'invoicing'), |
|
| 280 | + 'NI' => __('Nicaragua', 'invoicing'), |
|
| 281 | + 'NE' => __('Niger', 'invoicing'), |
|
| 282 | + 'NG' => __('Nigeria', 'invoicing'), |
|
| 283 | + 'NU' => __('Niue', 'invoicing'), |
|
| 284 | + 'NF' => __('Norfolk Island', 'invoicing'), |
|
| 285 | + 'KP' => __('North Korea', 'invoicing'), |
|
| 286 | + 'MP' => __('Northern Mariana Islands', 'invoicing'), |
|
| 287 | + 'NO' => __('Norway', 'invoicing'), |
|
| 288 | + 'OM' => __('Oman', 'invoicing'), |
|
| 289 | + 'PK' => __('Pakistan', 'invoicing'), |
|
| 290 | + 'PW' => __('Palau', 'invoicing'), |
|
| 291 | + 'PS' => __('Palestinian Territories', 'invoicing'), |
|
| 292 | + 'PA' => __('Panama', 'invoicing'), |
|
| 293 | + 'PG' => __('Papua New Guinea', 'invoicing'), |
|
| 294 | + 'PY' => __('Paraguay', 'invoicing'), |
|
| 295 | + 'PE' => __('Peru', 'invoicing'), |
|
| 296 | + 'PH' => __('Phillipines', 'invoicing'), |
|
| 297 | + 'PN' => __('Pitcairn Island', 'invoicing'), |
|
| 298 | + 'PL' => __('Poland', 'invoicing'), |
|
| 299 | + 'PT' => __('Portugal', 'invoicing'), |
|
| 300 | + 'PR' => __('Puerto Rico', 'invoicing'), |
|
| 301 | + 'QA' => __('Qatar', 'invoicing'), |
|
| 302 | + 'XK' => __('Republic of Kosovo', 'invoicing'), |
|
| 303 | + 'RE' => __('Reunion Island', 'invoicing'), |
|
| 304 | + 'RO' => __('Romania', 'invoicing'), |
|
| 305 | + 'RU' => __('Russian Federation', 'invoicing'), |
|
| 306 | + 'RW' => __('Rwanda', 'invoicing'), |
|
| 307 | + 'BL' => __('Saint Barthélemy', 'invoicing'), |
|
| 308 | + 'SH' => __('Saint Helena', 'invoicing'), |
|
| 309 | + 'KN' => __('Saint Kitts and Nevis', 'invoicing'), |
|
| 310 | + 'LC' => __('Saint Lucia', 'invoicing'), |
|
| 311 | + 'MF' => __('Saint Martin (French)', 'invoicing'), |
|
| 312 | + 'SX' => __('Saint Martin (Dutch)', 'invoicing'), |
|
| 313 | + 'PM' => __('Saint Pierre and Miquelon', 'invoicing'), |
|
| 314 | + 'VC' => __('Saint Vincent and the Grenadines', 'invoicing'), |
|
| 315 | + 'SM' => __('San Marino', 'invoicing'), |
|
| 316 | + 'ST' => __('São Tomé and Príncipe', 'invoicing'), |
|
| 317 | + 'SA' => __('Saudi Arabia', 'invoicing'), |
|
| 318 | + 'SN' => __('Senegal', 'invoicing'), |
|
| 319 | + 'RS' => __('Serbia', 'invoicing'), |
|
| 320 | + 'SC' => __('Seychelles', 'invoicing'), |
|
| 321 | + 'SL' => __('Sierra Leone', 'invoicing'), |
|
| 322 | + 'SG' => __('Singapore', 'invoicing'), |
|
| 323 | + 'SK' => __('Slovak Republic', 'invoicing'), |
|
| 324 | + 'SI' => __('Slovenia', 'invoicing'), |
|
| 325 | + 'SB' => __('Solomon Islands', 'invoicing'), |
|
| 326 | + 'SO' => __('Somalia', 'invoicing'), |
|
| 327 | + 'ZA' => __('South Africa', 'invoicing'), |
|
| 328 | + 'GS' => __('South Georgia', 'invoicing'), |
|
| 329 | + 'KR' => __('South Korea', 'invoicing'), |
|
| 330 | + 'SS' => __('South Sudan', 'invoicing'), |
|
| 331 | + 'ES' => __('Spain', 'invoicing'), |
|
| 332 | + 'LK' => __('Sri Lanka', 'invoicing'), |
|
| 333 | + 'SD' => __('Sudan', 'invoicing'), |
|
| 334 | + 'SR' => __('Suriname', 'invoicing'), |
|
| 335 | + 'SJ' => __('Svalbard and Jan Mayen Islands', 'invoicing'), |
|
| 336 | + 'SZ' => __('Swaziland', 'invoicing'), |
|
| 337 | + 'SE' => __('Sweden', 'invoicing'), |
|
| 338 | + 'CH' => __('Switzerland', 'invoicing'), |
|
| 339 | + 'SY' => __('Syrian Arab Republic', 'invoicing'), |
|
| 340 | + 'TW' => __('Taiwan', 'invoicing'), |
|
| 341 | + 'TJ' => __('Tajikistan', 'invoicing'), |
|
| 342 | + 'TZ' => __('Tanzania', 'invoicing'), |
|
| 343 | + 'TH' => __('Thailand', 'invoicing'), |
|
| 344 | + 'TL' => __('Timor-Leste', 'invoicing'), |
|
| 345 | + 'TG' => __('Togo', 'invoicing'), |
|
| 346 | + 'TK' => __('Tokelau', 'invoicing'), |
|
| 347 | + 'TO' => __('Tonga', 'invoicing'), |
|
| 348 | + 'TT' => __('Trinidad and Tobago', 'invoicing'), |
|
| 349 | + 'TN' => __('Tunisia', 'invoicing'), |
|
| 350 | + 'TR' => __('Turkey', 'invoicing'), |
|
| 351 | + 'TM' => __('Turkmenistan', 'invoicing'), |
|
| 352 | + 'TC' => __('Turks and Caicos Islands', 'invoicing'), |
|
| 353 | + 'TV' => __('Tuvalu', 'invoicing'), |
|
| 354 | + 'UG' => __('Uganda', 'invoicing'), |
|
| 355 | + 'UA' => __('Ukraine', 'invoicing'), |
|
| 356 | + 'AE' => __('United Arab Emirates', 'invoicing'), |
|
| 357 | + 'UY' => __('Uruguay', 'invoicing'), |
|
| 358 | + 'UM' => __('US Minor Outlying Islands', 'invoicing'), |
|
| 359 | + 'UZ' => __('Uzbekistan', 'invoicing'), |
|
| 360 | + 'VU' => __('Vanuatu', 'invoicing'), |
|
| 361 | + 'VE' => __('Venezuela', 'invoicing'), |
|
| 362 | + 'VN' => __('Vietnam', 'invoicing'), |
|
| 363 | + 'VG' => __('Virgin Islands (British)', 'invoicing'), |
|
| 364 | + 'VI' => __('Virgin Islands (USA)', 'invoicing'), |
|
| 365 | + 'WF' => __('Wallis and Futuna Islands', 'invoicing'), |
|
| 366 | + 'EH' => __('Western Sahara', 'invoicing'), |
|
| 367 | + 'WS' => __('Western Samoa', 'invoicing'), |
|
| 368 | + 'YE' => __('Yemen', 'invoicing'), |
|
| 369 | + 'ZM' => __('Zambia', 'invoicing'), |
|
| 370 | + 'ZW' => __('Zimbabwe', 'invoicing'), |
|
| 371 | + ); |
|
| 372 | 372 | |
| 373 | 373 | if ( $first_empty ) { |
| 374 | 374 | $countries = array_merge( array( '' => '' ), $countries ); |
@@ -1537,30 +1537,30 @@ discard block |
||
| 1537 | 1537 | } |
| 1538 | 1538 | |
| 1539 | 1539 | function wpinv_get_states_field() { |
| 1540 | - if( empty( $_POST['country'] ) ) { |
|
| 1541 | - $_POST['country'] = wpinv_get_default_country(); |
|
| 1542 | - } |
|
| 1543 | - $states = wpinv_get_country_states( sanitize_text_field( $_POST['country'] ) ); |
|
| 1540 | + if( empty( $_POST['country'] ) ) { |
|
| 1541 | + $_POST['country'] = wpinv_get_default_country(); |
|
| 1542 | + } |
|
| 1543 | + $states = wpinv_get_country_states( sanitize_text_field( $_POST['country'] ) ); |
|
| 1544 | 1544 | |
| 1545 | - if( !empty( $states ) ) { |
|
| 1546 | - $sanitized_field_name = sanitize_text_field( $_POST['field_name'] ); |
|
| 1545 | + if( !empty( $states ) ) { |
|
| 1546 | + $sanitized_field_name = sanitize_text_field( $_POST['field_name'] ); |
|
| 1547 | 1547 | |
| 1548 | 1548 | $args = array( |
| 1549 | - 'name' => $sanitized_field_name, |
|
| 1550 | - 'id' => $sanitized_field_name, |
|
| 1551 | - 'class' => $sanitized_field_name . ' wpinv-select', |
|
| 1552 | - 'options' => array_merge( array( '' => '' ), $states ), |
|
| 1553 | - 'show_option_all' => false, |
|
| 1554 | - 'show_option_none' => false |
|
| 1555 | - ); |
|
| 1556 | - |
|
| 1557 | - $response = wpinv_html_select( $args ); |
|
| 1558 | - |
|
| 1559 | - } else { |
|
| 1560 | - $response = 'nostates'; |
|
| 1561 | - } |
|
| 1549 | + 'name' => $sanitized_field_name, |
|
| 1550 | + 'id' => $sanitized_field_name, |
|
| 1551 | + 'class' => $sanitized_field_name . ' wpinv-select', |
|
| 1552 | + 'options' => array_merge( array( '' => '' ), $states ), |
|
| 1553 | + 'show_option_all' => false, |
|
| 1554 | + 'show_option_none' => false |
|
| 1555 | + ); |
|
| 1556 | + |
|
| 1557 | + $response = wpinv_html_select( $args ); |
|
| 1558 | + |
|
| 1559 | + } else { |
|
| 1560 | + $response = 'nostates'; |
|
| 1561 | + } |
|
| 1562 | 1562 | |
| 1563 | - return $response; |
|
| 1563 | + return $response; |
|
| 1564 | 1564 | } |
| 1565 | 1565 | |
| 1566 | 1566 | function wpinv_default_billing_country( $country = '', $user_id = 0 ) { |
@@ -7,67 +7,67 @@ discard block |
||
| 7 | 7 | */ |
| 8 | 8 | |
| 9 | 9 | // MUST have WordPress. |
| 10 | -if ( !defined( 'WPINC' ) ) { |
|
| 11 | - exit( 'Do NOT access this file directly: ' . basename( __FILE__ ) ); |
|
| 10 | +if (!defined('WPINC')) { |
|
| 11 | + exit('Do NOT access this file directly: ' . basename(__FILE__)); |
|
| 12 | 12 | } |
| 13 | 13 | |
| 14 | 14 | |
| 15 | 15 | function wpinv_get_default_country() { |
| 16 | - $country = wpinv_get_option( 'default_country', 'UK' ); |
|
| 16 | + $country = wpinv_get_option('default_country', 'UK'); |
|
| 17 | 17 | |
| 18 | - return apply_filters( 'wpinv_default_country', $country ); |
|
| 18 | + return apply_filters('wpinv_default_country', $country); |
|
| 19 | 19 | } |
| 20 | 20 | |
| 21 | -function wpinv_is_base_country( $country ) { |
|
| 21 | +function wpinv_is_base_country($country) { |
|
| 22 | 22 | $base_country = wpinv_get_default_country(); |
| 23 | 23 | |
| 24 | - if ( $base_country === 'UK' ) { |
|
| 24 | + if ($base_country === 'UK') { |
|
| 25 | 25 | $base_country = 'GB'; |
| 26 | 26 | } |
| 27 | - if ( $country == 'UK' ) { |
|
| 27 | + if ($country == 'UK') { |
|
| 28 | 28 | $country = 'GB'; |
| 29 | 29 | } |
| 30 | 30 | |
| 31 | - return ( $country && $country === $base_country ) ? true : false; |
|
| 31 | + return ($country && $country === $base_country) ? true : false; |
|
| 32 | 32 | } |
| 33 | 33 | |
| 34 | -function wpinv_country_name( $country_code = '' ) { |
|
| 34 | +function wpinv_country_name($country_code = '') { |
|
| 35 | 35 | $countries = wpinv_get_country_list(); |
| 36 | 36 | $country_code = $country_code == 'UK' ? 'GB' : $country_code; |
| 37 | - $country = isset( $countries[$country_code] ) ? $countries[$country_code] : $country_code; |
|
| 37 | + $country = isset($countries[$country_code]) ? $countries[$country_code] : $country_code; |
|
| 38 | 38 | |
| 39 | - return apply_filters( 'wpinv_country_name', $country, $country_code ); |
|
| 39 | + return apply_filters('wpinv_country_name', $country, $country_code); |
|
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | function wpinv_get_default_state() { |
| 43 | - $state = wpinv_get_option( 'default_state', false ); |
|
| 43 | + $state = wpinv_get_option('default_state', false); |
|
| 44 | 44 | |
| 45 | - return apply_filters( 'wpinv_default_state', $state ); |
|
| 45 | + return apply_filters('wpinv_default_state', $state); |
|
| 46 | 46 | } |
| 47 | 47 | |
| 48 | -function wpinv_state_name( $state_code = '', $country_code = '' ) { |
|
| 48 | +function wpinv_state_name($state_code = '', $country_code = '') { |
|
| 49 | 49 | $state = $state_code; |
| 50 | 50 | |
| 51 | - if ( !empty( $country_code ) ) { |
|
| 52 | - $states = wpinv_get_country_states( $country_code ); |
|
| 51 | + if (!empty($country_code)) { |
|
| 52 | + $states = wpinv_get_country_states($country_code); |
|
| 53 | 53 | |
| 54 | - $state = !empty( $states ) && isset( $states[$state_code] ) ? $states[$state_code] : $state; |
|
| 54 | + $state = !empty($states) && isset($states[$state_code]) ? $states[$state_code] : $state; |
|
| 55 | 55 | } |
| 56 | 56 | |
| 57 | - return apply_filters( 'wpinv_state_name', $state, $state_code, $country_code ); |
|
| 57 | + return apply_filters('wpinv_state_name', $state, $state_code, $country_code); |
|
| 58 | 58 | } |
| 59 | 59 | |
| 60 | 60 | function wpinv_store_address() { |
| 61 | - $address = wpinv_get_option( 'store_address', '' ); |
|
| 61 | + $address = wpinv_get_option('store_address', ''); |
|
| 62 | 62 | |
| 63 | - return apply_filters( 'wpinv_store_address', $address ); |
|
| 63 | + return apply_filters('wpinv_store_address', $address); |
|
| 64 | 64 | } |
| 65 | 65 | |
| 66 | -function wpinv_get_user_address( $user_id = 0, $with_default = true ) { |
|
| 66 | +function wpinv_get_user_address($user_id = 0, $with_default = true) { |
|
| 67 | 67 | global $wpi_userID; |
| 68 | 68 | |
| 69 | - if( empty( $user_id ) ) { |
|
| 70 | - $user_id = !empty( $wpi_userID ) ? $wpi_userID : get_current_user_id(); |
|
| 69 | + if (empty($user_id)) { |
|
| 70 | + $user_id = !empty($wpi_userID) ? $wpi_userID : get_current_user_id(); |
|
| 71 | 71 | } |
| 72 | 72 | |
| 73 | 73 | $address_fields = array( |
@@ -85,36 +85,36 @@ discard block |
||
| 85 | 85 | 'zip', |
| 86 | 86 | ); |
| 87 | 87 | |
| 88 | - $user_info = get_userdata( $user_id ); |
|
| 88 | + $user_info = get_userdata($user_id); |
|
| 89 | 89 | |
| 90 | 90 | $address = array(); |
| 91 | 91 | $address['user_id'] = $user_id; |
| 92 | - $address['email'] = !empty( $user_info ) ? $user_info->user_email : ''; |
|
| 93 | - foreach ( $address_fields as $field ) { |
|
| 94 | - $address[$field] = get_user_meta( $user_id, '_wpinv_' . $field, true ); |
|
| 92 | + $address['email'] = !empty($user_info) ? $user_info->user_email : ''; |
|
| 93 | + foreach ($address_fields as $field) { |
|
| 94 | + $address[$field] = get_user_meta($user_id, '_wpinv_' . $field, true); |
|
| 95 | 95 | } |
| 96 | 96 | |
| 97 | - if ( !empty( $user_info ) ) { |
|
| 98 | - if( empty( $address['first_name'] ) ) |
|
| 97 | + if (!empty($user_info)) { |
|
| 98 | + if (empty($address['first_name'])) |
|
| 99 | 99 | $address['first_name'] = $user_info->first_name; |
| 100 | 100 | |
| 101 | - if( empty( $address['last_name'] ) ) |
|
| 101 | + if (empty($address['last_name'])) |
|
| 102 | 102 | $address['last_name'] = $user_info->last_name; |
| 103 | 103 | } |
| 104 | 104 | |
| 105 | - $address['name'] = trim( trim( $address['first_name'] . ' ' . $address['last_name'] ), "," ); |
|
| 105 | + $address['name'] = trim(trim($address['first_name'] . ' ' . $address['last_name']), ","); |
|
| 106 | 106 | |
| 107 | - if( empty( $address['state'] ) && $with_default ) |
|
| 107 | + if (empty($address['state']) && $with_default) |
|
| 108 | 108 | $address['state'] = wpinv_get_default_state(); |
| 109 | 109 | |
| 110 | - if( empty( $address['country'] ) && $with_default ) |
|
| 110 | + if (empty($address['country']) && $with_default) |
|
| 111 | 111 | $address['country'] = wpinv_get_default_country(); |
| 112 | 112 | |
| 113 | 113 | |
| 114 | 114 | return $address; |
| 115 | 115 | } |
| 116 | 116 | |
| 117 | -function wpinv_get_country_list( $first_empty = false ) { |
|
| 117 | +function wpinv_get_country_list($first_empty = false) { |
|
| 118 | 118 | $countries = array( |
| 119 | 119 | 'US' => __('United States', 'invoicing'), |
| 120 | 120 | 'CA' => __('Canada', 'invoicing'), |
@@ -370,23 +370,23 @@ discard block |
||
| 370 | 370 | 'ZW' => __('Zimbabwe', 'invoicing'), |
| 371 | 371 | ); |
| 372 | 372 | |
| 373 | - if ( $first_empty ) { |
|
| 374 | - $countries = array_merge( array( '' => '' ), $countries ); |
|
| 373 | + if ($first_empty) { |
|
| 374 | + $countries = array_merge(array('' => ''), $countries); |
|
| 375 | 375 | } |
| 376 | 376 | |
| 377 | - $countries = apply_filters( 'wpinv_countries', $countries ); |
|
| 377 | + $countries = apply_filters('wpinv_countries', $countries); |
|
| 378 | 378 | |
| 379 | 379 | asort($countries); |
| 380 | 380 | |
| 381 | 381 | return $countries; |
| 382 | 382 | } |
| 383 | 383 | |
| 384 | -function wpinv_get_country_states( $country = null, $first_empty = false ) { |
|
| 385 | - if ( empty( $country ) ) { |
|
| 384 | +function wpinv_get_country_states($country = null, $first_empty = false) { |
|
| 385 | + if (empty($country)) { |
|
| 386 | 386 | $country = wpinv_get_default_country(); |
| 387 | 387 | } |
| 388 | 388 | |
| 389 | - switch( $country ) { |
|
| 389 | + switch ($country) { |
|
| 390 | 390 | case 'US' : |
| 391 | 391 | $states = wpinv_get_us_states_list(); |
| 392 | 392 | break; |
@@ -461,11 +461,11 @@ discard block |
||
| 461 | 461 | break; |
| 462 | 462 | } |
| 463 | 463 | |
| 464 | - if ( !empty( $states ) && $first_empty ) { |
|
| 465 | - $states = array_merge( array( '' => '' ), $states ); |
|
| 464 | + if (!empty($states) && $first_empty) { |
|
| 465 | + $states = array_merge(array('' => ''), $states); |
|
| 466 | 466 | } |
| 467 | 467 | |
| 468 | - $states = apply_filters( 'wpinv_country_states', $states, $country ); |
|
| 468 | + $states = apply_filters('wpinv_country_states', $states, $country); |
|
| 469 | 469 | |
| 470 | 470 | asort($states); |
| 471 | 471 | |
@@ -474,1087 +474,1087 @@ discard block |
||
| 474 | 474 | |
| 475 | 475 | function wpinv_get_us_states_list() { |
| 476 | 476 | $states = array( |
| 477 | - 'AL' => __( 'Alabama', 'invoicing' ), |
|
| 478 | - 'AK' => __( 'Alaska', 'invoicing' ), |
|
| 479 | - 'AZ' => __( 'Arizona', 'invoicing' ), |
|
| 480 | - 'AR' => __( 'Arkansas', 'invoicing' ), |
|
| 481 | - 'CA' => __( 'California', 'invoicing' ), |
|
| 482 | - 'CO' => __( 'Colorado', 'invoicing' ), |
|
| 483 | - 'CT' => __( 'Connecticut', 'invoicing' ), |
|
| 484 | - 'DE' => __( 'Delaware', 'invoicing' ), |
|
| 485 | - 'DC' => __( 'District of Columbia', 'invoicing' ), |
|
| 486 | - 'FL' => __( 'Florida', 'invoicing' ), |
|
| 487 | - 'GA' => __( 'Georgia', 'invoicing' ), |
|
| 488 | - 'HI' => __( 'Hawaii', 'invoicing' ), |
|
| 489 | - 'ID' => __( 'Idaho', 'invoicing' ), |
|
| 490 | - 'IL' => __( 'Illinois', 'invoicing' ), |
|
| 491 | - 'IN' => __( 'Indiana', 'invoicing' ), |
|
| 492 | - 'IA' => __( 'Iowa', 'invoicing' ), |
|
| 493 | - 'KS' => __( 'Kansas', 'invoicing' ), |
|
| 494 | - 'KY' => __( 'Kentucky', 'invoicing' ), |
|
| 495 | - 'LA' => __( 'Louisiana', 'invoicing' ), |
|
| 496 | - 'ME' => __( 'Maine', 'invoicing' ), |
|
| 497 | - 'MD' => __( 'Maryland', 'invoicing' ), |
|
| 498 | - 'MA' => __( 'Massachusetts', 'invoicing' ), |
|
| 499 | - 'MI' => __( 'Michigan', 'invoicing' ), |
|
| 500 | - 'MN' => __( 'Minnesota', 'invoicing' ), |
|
| 501 | - 'MS' => __( 'Mississippi', 'invoicing' ), |
|
| 502 | - 'MO' => __( 'Missouri', 'invoicing' ), |
|
| 503 | - 'MT' => __( 'Montana', 'invoicing' ), |
|
| 504 | - 'NE' => __( 'Nebraska', 'invoicing' ), |
|
| 505 | - 'NV' => __( 'Nevada', 'invoicing' ), |
|
| 506 | - 'NH' => __( 'New Hampshire', 'invoicing' ), |
|
| 507 | - 'NJ' => __( 'New Jersey', 'invoicing' ), |
|
| 508 | - 'NM' => __( 'New Mexico', 'invoicing' ), |
|
| 509 | - 'NY' => __( 'New York', 'invoicing' ), |
|
| 510 | - 'NC' => __( 'North Carolina', 'invoicing' ), |
|
| 511 | - 'ND' => __( 'North Dakota', 'invoicing' ), |
|
| 512 | - 'OH' => __( 'Ohio', 'invoicing' ), |
|
| 513 | - 'OK' => __( 'Oklahoma', 'invoicing' ), |
|
| 514 | - 'OR' => __( 'Oregon', 'invoicing' ), |
|
| 515 | - 'PA' => __( 'Pennsylvania', 'invoicing' ), |
|
| 516 | - 'RI' => __( 'Rhode Island', 'invoicing' ), |
|
| 517 | - 'SC' => __( 'South Carolina', 'invoicing' ), |
|
| 518 | - 'SD' => __( 'South Dakota', 'invoicing' ), |
|
| 519 | - 'TN' => __( 'Tennessee', 'invoicing' ), |
|
| 520 | - 'TX' => __( 'Texas', 'invoicing' ), |
|
| 521 | - 'UT' => __( 'Utah', 'invoicing' ), |
|
| 522 | - 'VT' => __( 'Vermont', 'invoicing' ), |
|
| 523 | - 'VA' => __( 'Virginia', 'invoicing' ), |
|
| 524 | - 'WA' => __( 'Washington', 'invoicing' ), |
|
| 525 | - 'WV' => __( 'West Virginia', 'invoicing' ), |
|
| 526 | - 'WI' => __( 'Wisconsin', 'invoicing' ), |
|
| 527 | - 'WY' => __( 'Wyoming', 'invoicing' ), |
|
| 528 | - 'AS' => __( 'American Samoa', 'invoicing' ), |
|
| 529 | - 'CZ' => __( 'Canal Zone', 'invoicing' ), |
|
| 530 | - 'CM' => __( 'Commonwealth of the Northern Mariana Islands', 'invoicing' ), |
|
| 531 | - 'FM' => __( 'Federated States of Micronesia', 'invoicing' ), |
|
| 532 | - 'GU' => __( 'Guam', 'invoicing' ), |
|
| 533 | - 'MH' => __( 'Marshall Islands', 'invoicing' ), |
|
| 534 | - 'MP' => __( 'Northern Mariana Islands', 'invoicing' ), |
|
| 535 | - 'PW' => __( 'Palau', 'invoicing' ), |
|
| 536 | - 'PI' => __( 'Philippine Islands', 'invoicing' ), |
|
| 537 | - 'PR' => __( 'Puerto Rico', 'invoicing' ), |
|
| 538 | - 'TT' => __( 'Trust Territory of the Pacific Islands', 'invoicing' ), |
|
| 539 | - 'VI' => __( 'Virgin Islands', 'invoicing' ), |
|
| 540 | - 'AA' => __( 'Armed Forces - Americas', 'invoicing' ), |
|
| 541 | - 'AE' => __( 'Armed Forces - Europe, Canada, Middle East, Africa', 'invoicing' ), |
|
| 542 | - 'AP' => __( 'Armed Forces - Pacific', 'invoicing' ) |
|
| 477 | + 'AL' => __('Alabama', 'invoicing'), |
|
| 478 | + 'AK' => __('Alaska', 'invoicing'), |
|
| 479 | + 'AZ' => __('Arizona', 'invoicing'), |
|
| 480 | + 'AR' => __('Arkansas', 'invoicing'), |
|
| 481 | + 'CA' => __('California', 'invoicing'), |
|
| 482 | + 'CO' => __('Colorado', 'invoicing'), |
|
| 483 | + 'CT' => __('Connecticut', 'invoicing'), |
|
| 484 | + 'DE' => __('Delaware', 'invoicing'), |
|
| 485 | + 'DC' => __('District of Columbia', 'invoicing'), |
|
| 486 | + 'FL' => __('Florida', 'invoicing'), |
|
| 487 | + 'GA' => __('Georgia', 'invoicing'), |
|
| 488 | + 'HI' => __('Hawaii', 'invoicing'), |
|
| 489 | + 'ID' => __('Idaho', 'invoicing'), |
|
| 490 | + 'IL' => __('Illinois', 'invoicing'), |
|
| 491 | + 'IN' => __('Indiana', 'invoicing'), |
|
| 492 | + 'IA' => __('Iowa', 'invoicing'), |
|
| 493 | + 'KS' => __('Kansas', 'invoicing'), |
|
| 494 | + 'KY' => __('Kentucky', 'invoicing'), |
|
| 495 | + 'LA' => __('Louisiana', 'invoicing'), |
|
| 496 | + 'ME' => __('Maine', 'invoicing'), |
|
| 497 | + 'MD' => __('Maryland', 'invoicing'), |
|
| 498 | + 'MA' => __('Massachusetts', 'invoicing'), |
|
| 499 | + 'MI' => __('Michigan', 'invoicing'), |
|
| 500 | + 'MN' => __('Minnesota', 'invoicing'), |
|
| 501 | + 'MS' => __('Mississippi', 'invoicing'), |
|
| 502 | + 'MO' => __('Missouri', 'invoicing'), |
|
| 503 | + 'MT' => __('Montana', 'invoicing'), |
|
| 504 | + 'NE' => __('Nebraska', 'invoicing'), |
|
| 505 | + 'NV' => __('Nevada', 'invoicing'), |
|
| 506 | + 'NH' => __('New Hampshire', 'invoicing'), |
|
| 507 | + 'NJ' => __('New Jersey', 'invoicing'), |
|
| 508 | + 'NM' => __('New Mexico', 'invoicing'), |
|
| 509 | + 'NY' => __('New York', 'invoicing'), |
|
| 510 | + 'NC' => __('North Carolina', 'invoicing'), |
|
| 511 | + 'ND' => __('North Dakota', 'invoicing'), |
|
| 512 | + 'OH' => __('Ohio', 'invoicing'), |
|
| 513 | + 'OK' => __('Oklahoma', 'invoicing'), |
|
| 514 | + 'OR' => __('Oregon', 'invoicing'), |
|
| 515 | + 'PA' => __('Pennsylvania', 'invoicing'), |
|
| 516 | + 'RI' => __('Rhode Island', 'invoicing'), |
|
| 517 | + 'SC' => __('South Carolina', 'invoicing'), |
|
| 518 | + 'SD' => __('South Dakota', 'invoicing'), |
|
| 519 | + 'TN' => __('Tennessee', 'invoicing'), |
|
| 520 | + 'TX' => __('Texas', 'invoicing'), |
|
| 521 | + 'UT' => __('Utah', 'invoicing'), |
|
| 522 | + 'VT' => __('Vermont', 'invoicing'), |
|
| 523 | + 'VA' => __('Virginia', 'invoicing'), |
|
| 524 | + 'WA' => __('Washington', 'invoicing'), |
|
| 525 | + 'WV' => __('West Virginia', 'invoicing'), |
|
| 526 | + 'WI' => __('Wisconsin', 'invoicing'), |
|
| 527 | + 'WY' => __('Wyoming', 'invoicing'), |
|
| 528 | + 'AS' => __('American Samoa', 'invoicing'), |
|
| 529 | + 'CZ' => __('Canal Zone', 'invoicing'), |
|
| 530 | + 'CM' => __('Commonwealth of the Northern Mariana Islands', 'invoicing'), |
|
| 531 | + 'FM' => __('Federated States of Micronesia', 'invoicing'), |
|
| 532 | + 'GU' => __('Guam', 'invoicing'), |
|
| 533 | + 'MH' => __('Marshall Islands', 'invoicing'), |
|
| 534 | + 'MP' => __('Northern Mariana Islands', 'invoicing'), |
|
| 535 | + 'PW' => __('Palau', 'invoicing'), |
|
| 536 | + 'PI' => __('Philippine Islands', 'invoicing'), |
|
| 537 | + 'PR' => __('Puerto Rico', 'invoicing'), |
|
| 538 | + 'TT' => __('Trust Territory of the Pacific Islands', 'invoicing'), |
|
| 539 | + 'VI' => __('Virgin Islands', 'invoicing'), |
|
| 540 | + 'AA' => __('Armed Forces - Americas', 'invoicing'), |
|
| 541 | + 'AE' => __('Armed Forces - Europe, Canada, Middle East, Africa', 'invoicing'), |
|
| 542 | + 'AP' => __('Armed Forces - Pacific', 'invoicing') |
|
| 543 | 543 | ); |
| 544 | 544 | |
| 545 | - return apply_filters( 'wpinv_us_states', $states ); |
|
| 545 | + return apply_filters('wpinv_us_states', $states); |
|
| 546 | 546 | } |
| 547 | 547 | |
| 548 | 548 | function wpinv_get_canada_states_list() { |
| 549 | 549 | $states = array( |
| 550 | - 'AB' => __( 'Alberta', 'invoicing' ), |
|
| 551 | - 'BC' => __( 'British Columbia', 'invoicing' ), |
|
| 552 | - 'MB' => __( 'Manitoba', 'invoicing' ), |
|
| 553 | - 'NB' => __( 'New Brunswick', 'invoicing' ), |
|
| 554 | - 'NL' => __( 'Newfoundland and Labrador', 'invoicing' ), |
|
| 555 | - 'NS' => __( 'Nova Scotia', 'invoicing' ), |
|
| 556 | - 'NT' => __( 'Northwest Territories', 'invoicing' ), |
|
| 557 | - 'NU' => __( 'Nunavut', 'invoicing' ), |
|
| 558 | - 'ON' => __( 'Ontario', 'invoicing' ), |
|
| 559 | - 'PE' => __( 'Prince Edward Island', 'invoicing' ), |
|
| 560 | - 'QC' => __( 'Quebec', 'invoicing' ), |
|
| 561 | - 'SK' => __( 'Saskatchewan', 'invoicing' ), |
|
| 562 | - 'YT' => __( 'Yukon', 'invoicing' ) |
|
| 550 | + 'AB' => __('Alberta', 'invoicing'), |
|
| 551 | + 'BC' => __('British Columbia', 'invoicing'), |
|
| 552 | + 'MB' => __('Manitoba', 'invoicing'), |
|
| 553 | + 'NB' => __('New Brunswick', 'invoicing'), |
|
| 554 | + 'NL' => __('Newfoundland and Labrador', 'invoicing'), |
|
| 555 | + 'NS' => __('Nova Scotia', 'invoicing'), |
|
| 556 | + 'NT' => __('Northwest Territories', 'invoicing'), |
|
| 557 | + 'NU' => __('Nunavut', 'invoicing'), |
|
| 558 | + 'ON' => __('Ontario', 'invoicing'), |
|
| 559 | + 'PE' => __('Prince Edward Island', 'invoicing'), |
|
| 560 | + 'QC' => __('Quebec', 'invoicing'), |
|
| 561 | + 'SK' => __('Saskatchewan', 'invoicing'), |
|
| 562 | + 'YT' => __('Yukon', 'invoicing') |
|
| 563 | 563 | ); |
| 564 | 564 | |
| 565 | - return apply_filters( 'wpinv_canada_provinces', $states ); |
|
| 565 | + return apply_filters('wpinv_canada_provinces', $states); |
|
| 566 | 566 | } |
| 567 | 567 | |
| 568 | 568 | function wpinv_get_australia_states_list() { |
| 569 | 569 | $states = array( |
| 570 | - 'ACT' => __( 'Australian Capital Territory', 'invoicing' ), |
|
| 571 | - 'NSW' => __( 'New South Wales', 'invoicing' ), |
|
| 572 | - 'NT' => __( 'Northern Territory', 'invoicing' ), |
|
| 573 | - 'QLD' => __( 'Queensland', 'invoicing' ), |
|
| 574 | - 'SA' => __( 'South Australia', 'invoicing' ), |
|
| 575 | - 'TAS' => __( 'Tasmania', 'invoicing' ), |
|
| 576 | - 'VIC' => __( 'Victoria', 'invoicing' ), |
|
| 577 | - 'WA' => __( 'Western Australia', 'invoicing' ) |
|
| 570 | + 'ACT' => __('Australian Capital Territory', 'invoicing'), |
|
| 571 | + 'NSW' => __('New South Wales', 'invoicing'), |
|
| 572 | + 'NT' => __('Northern Territory', 'invoicing'), |
|
| 573 | + 'QLD' => __('Queensland', 'invoicing'), |
|
| 574 | + 'SA' => __('South Australia', 'invoicing'), |
|
| 575 | + 'TAS' => __('Tasmania', 'invoicing'), |
|
| 576 | + 'VIC' => __('Victoria', 'invoicing'), |
|
| 577 | + 'WA' => __('Western Australia', 'invoicing') |
|
| 578 | 578 | ); |
| 579 | 579 | |
| 580 | - return apply_filters( 'wpinv_australia_states', $states ); |
|
| 580 | + return apply_filters('wpinv_australia_states', $states); |
|
| 581 | 581 | } |
| 582 | 582 | |
| 583 | 583 | function wpinv_get_bangladesh_states_list() { |
| 584 | 584 | $states = array( |
| 585 | - 'BAG' => __( 'Bagerhat', 'invoicing' ), |
|
| 586 | - 'BAN' => __( 'Bandarban', 'invoicing' ), |
|
| 587 | - 'BAR' => __( 'Barguna', 'invoicing' ), |
|
| 588 | - 'BARI'=> __( 'Barisal', 'invoicing' ), |
|
| 589 | - 'BHO' => __( 'Bhola', 'invoicing' ), |
|
| 590 | - 'BOG' => __( 'Bogra', 'invoicing' ), |
|
| 591 | - 'BRA' => __( 'Brahmanbaria', 'invoicing' ), |
|
| 592 | - 'CHA' => __( 'Chandpur', 'invoicing' ), |
|
| 593 | - 'CHI' => __( 'Chittagong', 'invoicing' ), |
|
| 594 | - 'CHU' => __( 'Chuadanga', 'invoicing' ), |
|
| 595 | - 'COM' => __( 'Comilla', 'invoicing' ), |
|
| 596 | - 'COX' => __( 'Cox\'s Bazar', 'invoicing' ), |
|
| 597 | - 'DHA' => __( 'Dhaka', 'invoicing' ), |
|
| 598 | - 'DIN' => __( 'Dinajpur', 'invoicing' ), |
|
| 599 | - 'FAR' => __( 'Faridpur', 'invoicing' ), |
|
| 600 | - 'FEN' => __( 'Feni', 'invoicing' ), |
|
| 601 | - 'GAI' => __( 'Gaibandha', 'invoicing' ), |
|
| 602 | - 'GAZI'=> __( 'Gazipur', 'invoicing' ), |
|
| 603 | - 'GOP' => __( 'Gopalganj', 'invoicing' ), |
|
| 604 | - 'HAB' => __( 'Habiganj', 'invoicing' ), |
|
| 605 | - 'JAM' => __( 'Jamalpur', 'invoicing' ), |
|
| 606 | - 'JES' => __( 'Jessore', 'invoicing' ), |
|
| 607 | - 'JHA' => __( 'Jhalokati', 'invoicing' ), |
|
| 608 | - 'JHE' => __( 'Jhenaidah', 'invoicing' ), |
|
| 609 | - 'JOY' => __( 'Joypurhat', 'invoicing' ), |
|
| 610 | - 'KHA' => __( 'Khagrachhari', 'invoicing' ), |
|
| 611 | - 'KHU' => __( 'Khulna', 'invoicing' ), |
|
| 612 | - 'KIS' => __( 'Kishoreganj', 'invoicing' ), |
|
| 613 | - 'KUR' => __( 'Kurigram', 'invoicing' ), |
|
| 614 | - 'KUS' => __( 'Kushtia', 'invoicing' ), |
|
| 615 | - 'LAK' => __( 'Lakshmipur', 'invoicing' ), |
|
| 616 | - 'LAL' => __( 'Lalmonirhat', 'invoicing' ), |
|
| 617 | - 'MAD' => __( 'Madaripur', 'invoicing' ), |
|
| 618 | - 'MAG' => __( 'Magura', 'invoicing' ), |
|
| 619 | - 'MAN' => __( 'Manikganj', 'invoicing' ), |
|
| 620 | - 'MEH' => __( 'Meherpur', 'invoicing' ), |
|
| 621 | - 'MOU' => __( 'Moulvibazar', 'invoicing' ), |
|
| 622 | - 'MUN' => __( 'Munshiganj', 'invoicing' ), |
|
| 623 | - 'MYM' => __( 'Mymensingh', 'invoicing' ), |
|
| 624 | - 'NAO' => __( 'Naogaon', 'invoicing' ), |
|
| 625 | - 'NAR' => __( 'Narail', 'invoicing' ), |
|
| 626 | - 'NARG'=> __( 'Narayanganj', 'invoicing' ), |
|
| 627 | - 'NARD'=> __( 'Narsingdi', 'invoicing' ), |
|
| 628 | - 'NAT' => __( 'Natore', 'invoicing' ), |
|
| 629 | - 'NAW' => __( 'Nawabganj', 'invoicing' ), |
|
| 630 | - 'NET' => __( 'Netrakona', 'invoicing' ), |
|
| 631 | - 'NIL' => __( 'Nilphamari', 'invoicing' ), |
|
| 632 | - 'NOA' => __( 'Noakhali', 'invoicing' ), |
|
| 633 | - 'PAB' => __( 'Pabna', 'invoicing' ), |
|
| 634 | - 'PAN' => __( 'Panchagarh', 'invoicing' ), |
|
| 635 | - 'PAT' => __( 'Patuakhali', 'invoicing' ), |
|
| 636 | - 'PIR' => __( 'Pirojpur', 'invoicing' ), |
|
| 637 | - 'RAJB'=> __( 'Rajbari', 'invoicing' ), |
|
| 638 | - 'RAJ' => __( 'Rajshahi', 'invoicing' ), |
|
| 639 | - 'RAN' => __( 'Rangamati', 'invoicing' ), |
|
| 640 | - 'RANP'=> __( 'Rangpur', 'invoicing' ), |
|
| 641 | - 'SAT' => __( 'Satkhira', 'invoicing' ), |
|
| 642 | - 'SHA' => __( 'Shariatpur', 'invoicing' ), |
|
| 643 | - 'SHE' => __( 'Sherpur', 'invoicing' ), |
|
| 644 | - 'SIR' => __( 'Sirajganj', 'invoicing' ), |
|
| 645 | - 'SUN' => __( 'Sunamganj', 'invoicing' ), |
|
| 646 | - 'SYL' => __( 'Sylhet', 'invoicing' ), |
|
| 647 | - 'TAN' => __( 'Tangail', 'invoicing' ), |
|
| 648 | - 'THA' => __( 'Thakurgaon', 'invoicing' ) |
|
| 585 | + 'BAG' => __('Bagerhat', 'invoicing'), |
|
| 586 | + 'BAN' => __('Bandarban', 'invoicing'), |
|
| 587 | + 'BAR' => __('Barguna', 'invoicing'), |
|
| 588 | + 'BARI'=> __('Barisal', 'invoicing'), |
|
| 589 | + 'BHO' => __('Bhola', 'invoicing'), |
|
| 590 | + 'BOG' => __('Bogra', 'invoicing'), |
|
| 591 | + 'BRA' => __('Brahmanbaria', 'invoicing'), |
|
| 592 | + 'CHA' => __('Chandpur', 'invoicing'), |
|
| 593 | + 'CHI' => __('Chittagong', 'invoicing'), |
|
| 594 | + 'CHU' => __('Chuadanga', 'invoicing'), |
|
| 595 | + 'COM' => __('Comilla', 'invoicing'), |
|
| 596 | + 'COX' => __('Cox\'s Bazar', 'invoicing'), |
|
| 597 | + 'DHA' => __('Dhaka', 'invoicing'), |
|
| 598 | + 'DIN' => __('Dinajpur', 'invoicing'), |
|
| 599 | + 'FAR' => __('Faridpur', 'invoicing'), |
|
| 600 | + 'FEN' => __('Feni', 'invoicing'), |
|
| 601 | + 'GAI' => __('Gaibandha', 'invoicing'), |
|
| 602 | + 'GAZI'=> __('Gazipur', 'invoicing'), |
|
| 603 | + 'GOP' => __('Gopalganj', 'invoicing'), |
|
| 604 | + 'HAB' => __('Habiganj', 'invoicing'), |
|
| 605 | + 'JAM' => __('Jamalpur', 'invoicing'), |
|
| 606 | + 'JES' => __('Jessore', 'invoicing'), |
|
| 607 | + 'JHA' => __('Jhalokati', 'invoicing'), |
|
| 608 | + 'JHE' => __('Jhenaidah', 'invoicing'), |
|
| 609 | + 'JOY' => __('Joypurhat', 'invoicing'), |
|
| 610 | + 'KHA' => __('Khagrachhari', 'invoicing'), |
|
| 611 | + 'KHU' => __('Khulna', 'invoicing'), |
|
| 612 | + 'KIS' => __('Kishoreganj', 'invoicing'), |
|
| 613 | + 'KUR' => __('Kurigram', 'invoicing'), |
|
| 614 | + 'KUS' => __('Kushtia', 'invoicing'), |
|
| 615 | + 'LAK' => __('Lakshmipur', 'invoicing'), |
|
| 616 | + 'LAL' => __('Lalmonirhat', 'invoicing'), |
|
| 617 | + 'MAD' => __('Madaripur', 'invoicing'), |
|
| 618 | + 'MAG' => __('Magura', 'invoicing'), |
|
| 619 | + 'MAN' => __('Manikganj', 'invoicing'), |
|
| 620 | + 'MEH' => __('Meherpur', 'invoicing'), |
|
| 621 | + 'MOU' => __('Moulvibazar', 'invoicing'), |
|
| 622 | + 'MUN' => __('Munshiganj', 'invoicing'), |
|
| 623 | + 'MYM' => __('Mymensingh', 'invoicing'), |
|
| 624 | + 'NAO' => __('Naogaon', 'invoicing'), |
|
| 625 | + 'NAR' => __('Narail', 'invoicing'), |
|
| 626 | + 'NARG'=> __('Narayanganj', 'invoicing'), |
|
| 627 | + 'NARD'=> __('Narsingdi', 'invoicing'), |
|
| 628 | + 'NAT' => __('Natore', 'invoicing'), |
|
| 629 | + 'NAW' => __('Nawabganj', 'invoicing'), |
|
| 630 | + 'NET' => __('Netrakona', 'invoicing'), |
|
| 631 | + 'NIL' => __('Nilphamari', 'invoicing'), |
|
| 632 | + 'NOA' => __('Noakhali', 'invoicing'), |
|
| 633 | + 'PAB' => __('Pabna', 'invoicing'), |
|
| 634 | + 'PAN' => __('Panchagarh', 'invoicing'), |
|
| 635 | + 'PAT' => __('Patuakhali', 'invoicing'), |
|
| 636 | + 'PIR' => __('Pirojpur', 'invoicing'), |
|
| 637 | + 'RAJB'=> __('Rajbari', 'invoicing'), |
|
| 638 | + 'RAJ' => __('Rajshahi', 'invoicing'), |
|
| 639 | + 'RAN' => __('Rangamati', 'invoicing'), |
|
| 640 | + 'RANP'=> __('Rangpur', 'invoicing'), |
|
| 641 | + 'SAT' => __('Satkhira', 'invoicing'), |
|
| 642 | + 'SHA' => __('Shariatpur', 'invoicing'), |
|
| 643 | + 'SHE' => __('Sherpur', 'invoicing'), |
|
| 644 | + 'SIR' => __('Sirajganj', 'invoicing'), |
|
| 645 | + 'SUN' => __('Sunamganj', 'invoicing'), |
|
| 646 | + 'SYL' => __('Sylhet', 'invoicing'), |
|
| 647 | + 'TAN' => __('Tangail', 'invoicing'), |
|
| 648 | + 'THA' => __('Thakurgaon', 'invoicing') |
|
| 649 | 649 | ); |
| 650 | 650 | |
| 651 | - return apply_filters( 'wpinv_bangladesh_states', $states ); |
|
| 651 | + return apply_filters('wpinv_bangladesh_states', $states); |
|
| 652 | 652 | } |
| 653 | 653 | |
| 654 | 654 | function wpinv_get_brazil_states_list() { |
| 655 | 655 | $states = array( |
| 656 | - 'AC' => __( 'Acre', 'invoicing' ), |
|
| 657 | - 'AL' => __( 'Alagoas', 'invoicing' ), |
|
| 658 | - 'AP' => __( 'Amapá', 'invoicing' ), |
|
| 659 | - 'AM' => __( 'Amazonas', 'invoicing' ), |
|
| 660 | - 'BA' => __( 'Bahia', 'invoicing' ), |
|
| 661 | - 'CE' => __( 'Ceará', 'invoicing' ), |
|
| 662 | - 'DF' => __( 'Distrito Federal', 'invoicing' ), |
|
| 663 | - 'ES' => __( 'Espírito Santo', 'invoicing' ), |
|
| 664 | - 'GO' => __( 'Goiás', 'invoicing' ), |
|
| 665 | - 'MA' => __( 'Maranhão', 'invoicing' ), |
|
| 666 | - 'MT' => __( 'Mato Grosso', 'invoicing' ), |
|
| 667 | - 'MS' => __( 'Mato Grosso do Sul', 'invoicing' ), |
|
| 668 | - 'MG' => __( 'Minas Gerais', 'invoicing' ), |
|
| 669 | - 'PA' => __( 'Pará', 'invoicing' ), |
|
| 670 | - 'PB' => __( 'Paraíba', 'invoicing' ), |
|
| 671 | - 'PR' => __( 'Paraná', 'invoicing' ), |
|
| 672 | - 'PE' => __( 'Pernambuco', 'invoicing' ), |
|
| 673 | - 'PI' => __( 'Piauí', 'invoicing' ), |
|
| 674 | - 'RJ' => __( 'Rio de Janeiro', 'invoicing' ), |
|
| 675 | - 'RN' => __( 'Rio Grande do Norte', 'invoicing' ), |
|
| 676 | - 'RS' => __( 'Rio Grande do Sul', 'invoicing' ), |
|
| 677 | - 'RO' => __( 'Rondônia', 'invoicing' ), |
|
| 678 | - 'RR' => __( 'Roraima', 'invoicing' ), |
|
| 679 | - 'SC' => __( 'Santa Catarina', 'invoicing' ), |
|
| 680 | - 'SP' => __( 'São Paulo', 'invoicing' ), |
|
| 681 | - 'SE' => __( 'Sergipe', 'invoicing' ), |
|
| 682 | - 'TO' => __( 'Tocantins', 'invoicing' ) |
|
| 656 | + 'AC' => __('Acre', 'invoicing'), |
|
| 657 | + 'AL' => __('Alagoas', 'invoicing'), |
|
| 658 | + 'AP' => __('Amapá', 'invoicing'), |
|
| 659 | + 'AM' => __('Amazonas', 'invoicing'), |
|
| 660 | + 'BA' => __('Bahia', 'invoicing'), |
|
| 661 | + 'CE' => __('Ceará', 'invoicing'), |
|
| 662 | + 'DF' => __('Distrito Federal', 'invoicing'), |
|
| 663 | + 'ES' => __('Espírito Santo', 'invoicing'), |
|
| 664 | + 'GO' => __('Goiás', 'invoicing'), |
|
| 665 | + 'MA' => __('Maranhão', 'invoicing'), |
|
| 666 | + 'MT' => __('Mato Grosso', 'invoicing'), |
|
| 667 | + 'MS' => __('Mato Grosso do Sul', 'invoicing'), |
|
| 668 | + 'MG' => __('Minas Gerais', 'invoicing'), |
|
| 669 | + 'PA' => __('Pará', 'invoicing'), |
|
| 670 | + 'PB' => __('Paraíba', 'invoicing'), |
|
| 671 | + 'PR' => __('Paraná', 'invoicing'), |
|
| 672 | + 'PE' => __('Pernambuco', 'invoicing'), |
|
| 673 | + 'PI' => __('Piauí', 'invoicing'), |
|
| 674 | + 'RJ' => __('Rio de Janeiro', 'invoicing'), |
|
| 675 | + 'RN' => __('Rio Grande do Norte', 'invoicing'), |
|
| 676 | + 'RS' => __('Rio Grande do Sul', 'invoicing'), |
|
| 677 | + 'RO' => __('Rondônia', 'invoicing'), |
|
| 678 | + 'RR' => __('Roraima', 'invoicing'), |
|
| 679 | + 'SC' => __('Santa Catarina', 'invoicing'), |
|
| 680 | + 'SP' => __('São Paulo', 'invoicing'), |
|
| 681 | + 'SE' => __('Sergipe', 'invoicing'), |
|
| 682 | + 'TO' => __('Tocantins', 'invoicing') |
|
| 683 | 683 | ); |
| 684 | 684 | |
| 685 | - return apply_filters( 'wpinv_brazil_states', $states ); |
|
| 685 | + return apply_filters('wpinv_brazil_states', $states); |
|
| 686 | 686 | } |
| 687 | 687 | |
| 688 | 688 | function wpinv_get_bulgaria_states_list() { |
| 689 | 689 | $states = array( |
| 690 | - 'BG-01' => __( 'Blagoevgrad', 'invoicing' ), |
|
| 691 | - 'BG-02' => __( 'Burgas', 'invoicing' ), |
|
| 692 | - 'BG-08' => __( 'Dobrich', 'invoicing' ), |
|
| 693 | - 'BG-07' => __( 'Gabrovo', 'invoicing' ), |
|
| 694 | - 'BG-26' => __( 'Haskovo', 'invoicing' ), |
|
| 695 | - 'BG-09' => __( 'Kardzhali', 'invoicing' ), |
|
| 696 | - 'BG-10' => __( 'Kyustendil', 'invoicing' ), |
|
| 697 | - 'BG-11' => __( 'Lovech', 'invoicing' ), |
|
| 698 | - 'BG-12' => __( 'Montana', 'invoicing' ), |
|
| 699 | - 'BG-13' => __( 'Pazardzhik', 'invoicing' ), |
|
| 700 | - 'BG-14' => __( 'Pernik', 'invoicing' ), |
|
| 701 | - 'BG-15' => __( 'Pleven', 'invoicing' ), |
|
| 702 | - 'BG-16' => __( 'Plovdiv', 'invoicing' ), |
|
| 703 | - 'BG-17' => __( 'Razgrad', 'invoicing' ), |
|
| 704 | - 'BG-18' => __( 'Ruse', 'invoicing' ), |
|
| 705 | - 'BG-27' => __( 'Shumen', 'invoicing' ), |
|
| 706 | - 'BG-19' => __( 'Silistra', 'invoicing' ), |
|
| 707 | - 'BG-20' => __( 'Sliven', 'invoicing' ), |
|
| 708 | - 'BG-21' => __( 'Smolyan', 'invoicing' ), |
|
| 709 | - 'BG-23' => __( 'Sofia', 'invoicing' ), |
|
| 710 | - 'BG-22' => __( 'Sofia-Grad', 'invoicing' ), |
|
| 711 | - 'BG-24' => __( 'Stara Zagora', 'invoicing' ), |
|
| 712 | - 'BG-25' => __( 'Targovishte', 'invoicing' ), |
|
| 713 | - 'BG-03' => __( 'Varna', 'invoicing' ), |
|
| 714 | - 'BG-04' => __( 'Veliko Tarnovo', 'invoicing' ), |
|
| 715 | - 'BG-05' => __( 'Vidin', 'invoicing' ), |
|
| 716 | - 'BG-06' => __( 'Vratsa', 'invoicing' ), |
|
| 717 | - 'BG-28' => __( 'Yambol', 'invoicing' ) |
|
| 690 | + 'BG-01' => __('Blagoevgrad', 'invoicing'), |
|
| 691 | + 'BG-02' => __('Burgas', 'invoicing'), |
|
| 692 | + 'BG-08' => __('Dobrich', 'invoicing'), |
|
| 693 | + 'BG-07' => __('Gabrovo', 'invoicing'), |
|
| 694 | + 'BG-26' => __('Haskovo', 'invoicing'), |
|
| 695 | + 'BG-09' => __('Kardzhali', 'invoicing'), |
|
| 696 | + 'BG-10' => __('Kyustendil', 'invoicing'), |
|
| 697 | + 'BG-11' => __('Lovech', 'invoicing'), |
|
| 698 | + 'BG-12' => __('Montana', 'invoicing'), |
|
| 699 | + 'BG-13' => __('Pazardzhik', 'invoicing'), |
|
| 700 | + 'BG-14' => __('Pernik', 'invoicing'), |
|
| 701 | + 'BG-15' => __('Pleven', 'invoicing'), |
|
| 702 | + 'BG-16' => __('Plovdiv', 'invoicing'), |
|
| 703 | + 'BG-17' => __('Razgrad', 'invoicing'), |
|
| 704 | + 'BG-18' => __('Ruse', 'invoicing'), |
|
| 705 | + 'BG-27' => __('Shumen', 'invoicing'), |
|
| 706 | + 'BG-19' => __('Silistra', 'invoicing'), |
|
| 707 | + 'BG-20' => __('Sliven', 'invoicing'), |
|
| 708 | + 'BG-21' => __('Smolyan', 'invoicing'), |
|
| 709 | + 'BG-23' => __('Sofia', 'invoicing'), |
|
| 710 | + 'BG-22' => __('Sofia-Grad', 'invoicing'), |
|
| 711 | + 'BG-24' => __('Stara Zagora', 'invoicing'), |
|
| 712 | + 'BG-25' => __('Targovishte', 'invoicing'), |
|
| 713 | + 'BG-03' => __('Varna', 'invoicing'), |
|
| 714 | + 'BG-04' => __('Veliko Tarnovo', 'invoicing'), |
|
| 715 | + 'BG-05' => __('Vidin', 'invoicing'), |
|
| 716 | + 'BG-06' => __('Vratsa', 'invoicing'), |
|
| 717 | + 'BG-28' => __('Yambol', 'invoicing') |
|
| 718 | 718 | ); |
| 719 | 719 | |
| 720 | - return apply_filters( 'wpinv_bulgaria_states', $states ); |
|
| 720 | + return apply_filters('wpinv_bulgaria_states', $states); |
|
| 721 | 721 | } |
| 722 | 722 | |
| 723 | 723 | function wpinv_get_hong_kong_states_list() { |
| 724 | 724 | $states = array( |
| 725 | - 'HONG KONG' => __( 'Hong Kong Island', 'invoicing' ), |
|
| 726 | - 'KOWLOON' => __( 'Kowloon', 'invoicing' ), |
|
| 727 | - 'NEW TERRITORIES' => __( 'New Territories', 'invoicing' ) |
|
| 725 | + 'HONG KONG' => __('Hong Kong Island', 'invoicing'), |
|
| 726 | + 'KOWLOON' => __('Kowloon', 'invoicing'), |
|
| 727 | + 'NEW TERRITORIES' => __('New Territories', 'invoicing') |
|
| 728 | 728 | ); |
| 729 | 729 | |
| 730 | - return apply_filters( 'wpinv_hong_kong_states', $states ); |
|
| 730 | + return apply_filters('wpinv_hong_kong_states', $states); |
|
| 731 | 731 | } |
| 732 | 732 | |
| 733 | 733 | function wpinv_get_hungary_states_list() { |
| 734 | 734 | $states = array( |
| 735 | - 'BK' => __( 'Bács-Kiskun', 'invoicing' ), |
|
| 736 | - 'BE' => __( 'Békés', 'invoicing' ), |
|
| 737 | - 'BA' => __( 'Baranya', 'invoicing' ), |
|
| 738 | - 'BZ' => __( 'Borsod-Abaúj-Zemplén', 'invoicing' ), |
|
| 739 | - 'BU' => __( 'Budapest', 'invoicing' ), |
|
| 740 | - 'CS' => __( 'Csongrád', 'invoicing' ), |
|
| 741 | - 'FE' => __( 'Fejér', 'invoicing' ), |
|
| 742 | - 'GS' => __( 'Győr-Moson-Sopron', 'invoicing' ), |
|
| 743 | - 'HB' => __( 'Hajdú-Bihar', 'invoicing' ), |
|
| 744 | - 'HE' => __( 'Heves', 'invoicing' ), |
|
| 745 | - 'JN' => __( 'Jász-Nagykun-Szolnok', 'invoicing' ), |
|
| 746 | - 'KE' => __( 'Komárom-Esztergom', 'invoicing' ), |
|
| 747 | - 'NO' => __( 'Nógrád', 'invoicing' ), |
|
| 748 | - 'PE' => __( 'Pest', 'invoicing' ), |
|
| 749 | - 'SO' => __( 'Somogy', 'invoicing' ), |
|
| 750 | - 'SZ' => __( 'Szabolcs-Szatmár-Bereg', 'invoicing' ), |
|
| 751 | - 'TO' => __( 'Tolna', 'invoicing' ), |
|
| 752 | - 'VA' => __( 'Vas', 'invoicing' ), |
|
| 753 | - 'VE' => __( 'Veszprém', 'invoicing' ), |
|
| 754 | - 'ZA' => __( 'Zala', 'invoicing' ) |
|
| 735 | + 'BK' => __('Bács-Kiskun', 'invoicing'), |
|
| 736 | + 'BE' => __('Békés', 'invoicing'), |
|
| 737 | + 'BA' => __('Baranya', 'invoicing'), |
|
| 738 | + 'BZ' => __('Borsod-Abaúj-Zemplén', 'invoicing'), |
|
| 739 | + 'BU' => __('Budapest', 'invoicing'), |
|
| 740 | + 'CS' => __('Csongrád', 'invoicing'), |
|
| 741 | + 'FE' => __('Fejér', 'invoicing'), |
|
| 742 | + 'GS' => __('Győr-Moson-Sopron', 'invoicing'), |
|
| 743 | + 'HB' => __('Hajdú-Bihar', 'invoicing'), |
|
| 744 | + 'HE' => __('Heves', 'invoicing'), |
|
| 745 | + 'JN' => __('Jász-Nagykun-Szolnok', 'invoicing'), |
|
| 746 | + 'KE' => __('Komárom-Esztergom', 'invoicing'), |
|
| 747 | + 'NO' => __('Nógrád', 'invoicing'), |
|
| 748 | + 'PE' => __('Pest', 'invoicing'), |
|
| 749 | + 'SO' => __('Somogy', 'invoicing'), |
|
| 750 | + 'SZ' => __('Szabolcs-Szatmár-Bereg', 'invoicing'), |
|
| 751 | + 'TO' => __('Tolna', 'invoicing'), |
|
| 752 | + 'VA' => __('Vas', 'invoicing'), |
|
| 753 | + 'VE' => __('Veszprém', 'invoicing'), |
|
| 754 | + 'ZA' => __('Zala', 'invoicing') |
|
| 755 | 755 | ); |
| 756 | 756 | |
| 757 | - return apply_filters( 'wpinv_hungary_states', $states ); |
|
| 757 | + return apply_filters('wpinv_hungary_states', $states); |
|
| 758 | 758 | } |
| 759 | 759 | |
| 760 | 760 | function wpinv_get_japan_states_list() { |
| 761 | 761 | $states = array( |
| 762 | - 'JP01' => __( 'Hokkaido', 'invoicing' ), |
|
| 763 | - 'JP02' => __( 'Aomori', 'invoicing' ), |
|
| 764 | - 'JP03' => __( 'Iwate', 'invoicing' ), |
|
| 765 | - 'JP04' => __( 'Miyagi', 'invoicing' ), |
|
| 766 | - 'JP05' => __( 'Akita', 'invoicing' ), |
|
| 767 | - 'JP06' => __( 'Yamagata', 'invoicing' ), |
|
| 768 | - 'JP07' => __( 'Fukushima', 'invoicing' ), |
|
| 769 | - 'JP08' => __( 'Ibaraki', 'invoicing' ), |
|
| 770 | - 'JP09' => __( 'Tochigi', 'invoicing' ), |
|
| 771 | - 'JP10' => __( 'Gunma', 'invoicing' ), |
|
| 772 | - 'JP11' => __( 'Saitama', 'invoicing' ), |
|
| 773 | - 'JP12' => __( 'Chiba', 'invoicing' ), |
|
| 774 | - 'JP13' => __( 'Tokyo', 'invoicing' ), |
|
| 775 | - 'JP14' => __( 'Kanagawa', 'invoicing' ), |
|
| 776 | - 'JP15' => __( 'Niigata', 'invoicing' ), |
|
| 777 | - 'JP16' => __( 'Toyama', 'invoicing' ), |
|
| 778 | - 'JP17' => __( 'Ishikawa', 'invoicing' ), |
|
| 779 | - 'JP18' => __( 'Fukui', 'invoicing' ), |
|
| 780 | - 'JP19' => __( 'Yamanashi', 'invoicing' ), |
|
| 781 | - 'JP20' => __( 'Nagano', 'invoicing' ), |
|
| 782 | - 'JP21' => __( 'Gifu', 'invoicing' ), |
|
| 783 | - 'JP22' => __( 'Shizuoka', 'invoicing' ), |
|
| 784 | - 'JP23' => __( 'Aichi', 'invoicing' ), |
|
| 785 | - 'JP24' => __( 'Mie', 'invoicing' ), |
|
| 786 | - 'JP25' => __( 'Shiga', 'invoicing' ), |
|
| 787 | - 'JP26' => __( 'Kyouto', 'invoicing' ), |
|
| 788 | - 'JP27' => __( 'Osaka', 'invoicing' ), |
|
| 789 | - 'JP28' => __( 'Hyougo', 'invoicing' ), |
|
| 790 | - 'JP29' => __( 'Nara', 'invoicing' ), |
|
| 791 | - 'JP30' => __( 'Wakayama', 'invoicing' ), |
|
| 792 | - 'JP31' => __( 'Tottori', 'invoicing' ), |
|
| 793 | - 'JP32' => __( 'Shimane', 'invoicing' ), |
|
| 794 | - 'JP33' => __( 'Okayama', 'invoicing' ), |
|
| 795 | - 'JP34' => __( 'Hiroshima', 'invoicing' ), |
|
| 796 | - 'JP35' => __( 'Yamaguchi', 'invoicing' ), |
|
| 797 | - 'JP36' => __( 'Tokushima', 'invoicing' ), |
|
| 798 | - 'JP37' => __( 'Kagawa', 'invoicing' ), |
|
| 799 | - 'JP38' => __( 'Ehime', 'invoicing' ), |
|
| 800 | - 'JP39' => __( 'Kochi', 'invoicing' ), |
|
| 801 | - 'JP40' => __( 'Fukuoka', 'invoicing' ), |
|
| 802 | - 'JP41' => __( 'Saga', 'invoicing' ), |
|
| 803 | - 'JP42' => __( 'Nagasaki', 'invoicing' ), |
|
| 804 | - 'JP43' => __( 'Kumamoto', 'invoicing' ), |
|
| 805 | - 'JP44' => __( 'Oita', 'invoicing' ), |
|
| 806 | - 'JP45' => __( 'Miyazaki', 'invoicing' ), |
|
| 807 | - 'JP46' => __( 'Kagoshima', 'invoicing' ), |
|
| 808 | - 'JP47' => __( 'Okinawa', 'invoicing' ) |
|
| 762 | + 'JP01' => __('Hokkaido', 'invoicing'), |
|
| 763 | + 'JP02' => __('Aomori', 'invoicing'), |
|
| 764 | + 'JP03' => __('Iwate', 'invoicing'), |
|
| 765 | + 'JP04' => __('Miyagi', 'invoicing'), |
|
| 766 | + 'JP05' => __('Akita', 'invoicing'), |
|
| 767 | + 'JP06' => __('Yamagata', 'invoicing'), |
|
| 768 | + 'JP07' => __('Fukushima', 'invoicing'), |
|
| 769 | + 'JP08' => __('Ibaraki', 'invoicing'), |
|
| 770 | + 'JP09' => __('Tochigi', 'invoicing'), |
|
| 771 | + 'JP10' => __('Gunma', 'invoicing'), |
|
| 772 | + 'JP11' => __('Saitama', 'invoicing'), |
|
| 773 | + 'JP12' => __('Chiba', 'invoicing'), |
|
| 774 | + 'JP13' => __('Tokyo', 'invoicing'), |
|
| 775 | + 'JP14' => __('Kanagawa', 'invoicing'), |
|
| 776 | + 'JP15' => __('Niigata', 'invoicing'), |
|
| 777 | + 'JP16' => __('Toyama', 'invoicing'), |
|
| 778 | + 'JP17' => __('Ishikawa', 'invoicing'), |
|
| 779 | + 'JP18' => __('Fukui', 'invoicing'), |
|
| 780 | + 'JP19' => __('Yamanashi', 'invoicing'), |
|
| 781 | + 'JP20' => __('Nagano', 'invoicing'), |
|
| 782 | + 'JP21' => __('Gifu', 'invoicing'), |
|
| 783 | + 'JP22' => __('Shizuoka', 'invoicing'), |
|
| 784 | + 'JP23' => __('Aichi', 'invoicing'), |
|
| 785 | + 'JP24' => __('Mie', 'invoicing'), |
|
| 786 | + 'JP25' => __('Shiga', 'invoicing'), |
|
| 787 | + 'JP26' => __('Kyouto', 'invoicing'), |
|
| 788 | + 'JP27' => __('Osaka', 'invoicing'), |
|
| 789 | + 'JP28' => __('Hyougo', 'invoicing'), |
|
| 790 | + 'JP29' => __('Nara', 'invoicing'), |
|
| 791 | + 'JP30' => __('Wakayama', 'invoicing'), |
|
| 792 | + 'JP31' => __('Tottori', 'invoicing'), |
|
| 793 | + 'JP32' => __('Shimane', 'invoicing'), |
|
| 794 | + 'JP33' => __('Okayama', 'invoicing'), |
|
| 795 | + 'JP34' => __('Hiroshima', 'invoicing'), |
|
| 796 | + 'JP35' => __('Yamaguchi', 'invoicing'), |
|
| 797 | + 'JP36' => __('Tokushima', 'invoicing'), |
|
| 798 | + 'JP37' => __('Kagawa', 'invoicing'), |
|
| 799 | + 'JP38' => __('Ehime', 'invoicing'), |
|
| 800 | + 'JP39' => __('Kochi', 'invoicing'), |
|
| 801 | + 'JP40' => __('Fukuoka', 'invoicing'), |
|
| 802 | + 'JP41' => __('Saga', 'invoicing'), |
|
| 803 | + 'JP42' => __('Nagasaki', 'invoicing'), |
|
| 804 | + 'JP43' => __('Kumamoto', 'invoicing'), |
|
| 805 | + 'JP44' => __('Oita', 'invoicing'), |
|
| 806 | + 'JP45' => __('Miyazaki', 'invoicing'), |
|
| 807 | + 'JP46' => __('Kagoshima', 'invoicing'), |
|
| 808 | + 'JP47' => __('Okinawa', 'invoicing') |
|
| 809 | 809 | ); |
| 810 | 810 | |
| 811 | - return apply_filters( 'wpinv_japan_states', $states ); |
|
| 811 | + return apply_filters('wpinv_japan_states', $states); |
|
| 812 | 812 | } |
| 813 | 813 | |
| 814 | 814 | function wpinv_get_china_states_list() { |
| 815 | 815 | $states = array( |
| 816 | - 'CN1' => __( 'Yunnan / 云南', 'invoicing' ), |
|
| 817 | - 'CN2' => __( 'Beijing / 北京', 'invoicing' ), |
|
| 818 | - 'CN3' => __( 'Tianjin / 天津', 'invoicing' ), |
|
| 819 | - 'CN4' => __( 'Hebei / 河北', 'invoicing' ), |
|
| 820 | - 'CN5' => __( 'Shanxi / 山西', 'invoicing' ), |
|
| 821 | - 'CN6' => __( 'Inner Mongolia / 內蒙古', 'invoicing' ), |
|
| 822 | - 'CN7' => __( 'Liaoning / 辽宁', 'invoicing' ), |
|
| 823 | - 'CN8' => __( 'Jilin / 吉林', 'invoicing' ), |
|
| 824 | - 'CN9' => __( 'Heilongjiang / 黑龙江', 'invoicing' ), |
|
| 825 | - 'CN10' => __( 'Shanghai / 上海', 'invoicing' ), |
|
| 826 | - 'CN11' => __( 'Jiangsu / 江苏', 'invoicing' ), |
|
| 827 | - 'CN12' => __( 'Zhejiang / 浙江', 'invoicing' ), |
|
| 828 | - 'CN13' => __( 'Anhui / 安徽', 'invoicing' ), |
|
| 829 | - 'CN14' => __( 'Fujian / 福建', 'invoicing' ), |
|
| 830 | - 'CN15' => __( 'Jiangxi / 江西', 'invoicing' ), |
|
| 831 | - 'CN16' => __( 'Shandong / 山东', 'invoicing' ), |
|
| 832 | - 'CN17' => __( 'Henan / 河南', 'invoicing' ), |
|
| 833 | - 'CN18' => __( 'Hubei / 湖北', 'invoicing' ), |
|
| 834 | - 'CN19' => __( 'Hunan / 湖南', 'invoicing' ), |
|
| 835 | - 'CN20' => __( 'Guangdong / 广东', 'invoicing' ), |
|
| 836 | - 'CN21' => __( 'Guangxi Zhuang / 广西壮族', 'invoicing' ), |
|
| 837 | - 'CN22' => __( 'Hainan / 海南', 'invoicing' ), |
|
| 838 | - 'CN23' => __( 'Chongqing / 重庆', 'invoicing' ), |
|
| 839 | - 'CN24' => __( 'Sichuan / 四川', 'invoicing' ), |
|
| 840 | - 'CN25' => __( 'Guizhou / 贵州', 'invoicing' ), |
|
| 841 | - 'CN26' => __( 'Shaanxi / 陕西', 'invoicing' ), |
|
| 842 | - 'CN27' => __( 'Gansu / 甘肃', 'invoicing' ), |
|
| 843 | - 'CN28' => __( 'Qinghai / 青海', 'invoicing' ), |
|
| 844 | - 'CN29' => __( 'Ningxia Hui / 宁夏', 'invoicing' ), |
|
| 845 | - 'CN30' => __( 'Macau / 澳门', 'invoicing' ), |
|
| 846 | - 'CN31' => __( 'Tibet / 西藏', 'invoicing' ), |
|
| 847 | - 'CN32' => __( 'Xinjiang / 新疆', 'invoicing' ) |
|
| 816 | + 'CN1' => __('Yunnan / 云南', 'invoicing'), |
|
| 817 | + 'CN2' => __('Beijing / 北京', 'invoicing'), |
|
| 818 | + 'CN3' => __('Tianjin / 天津', 'invoicing'), |
|
| 819 | + 'CN4' => __('Hebei / 河北', 'invoicing'), |
|
| 820 | + 'CN5' => __('Shanxi / 山西', 'invoicing'), |
|
| 821 | + 'CN6' => __('Inner Mongolia / 內蒙古', 'invoicing'), |
|
| 822 | + 'CN7' => __('Liaoning / 辽宁', 'invoicing'), |
|
| 823 | + 'CN8' => __('Jilin / 吉林', 'invoicing'), |
|
| 824 | + 'CN9' => __('Heilongjiang / 黑龙江', 'invoicing'), |
|
| 825 | + 'CN10' => __('Shanghai / 上海', 'invoicing'), |
|
| 826 | + 'CN11' => __('Jiangsu / 江苏', 'invoicing'), |
|
| 827 | + 'CN12' => __('Zhejiang / 浙江', 'invoicing'), |
|
| 828 | + 'CN13' => __('Anhui / 安徽', 'invoicing'), |
|
| 829 | + 'CN14' => __('Fujian / 福建', 'invoicing'), |
|
| 830 | + 'CN15' => __('Jiangxi / 江西', 'invoicing'), |
|
| 831 | + 'CN16' => __('Shandong / 山东', 'invoicing'), |
|
| 832 | + 'CN17' => __('Henan / 河南', 'invoicing'), |
|
| 833 | + 'CN18' => __('Hubei / 湖北', 'invoicing'), |
|
| 834 | + 'CN19' => __('Hunan / 湖南', 'invoicing'), |
|
| 835 | + 'CN20' => __('Guangdong / 广东', 'invoicing'), |
|
| 836 | + 'CN21' => __('Guangxi Zhuang / 广西壮族', 'invoicing'), |
|
| 837 | + 'CN22' => __('Hainan / 海南', 'invoicing'), |
|
| 838 | + 'CN23' => __('Chongqing / 重庆', 'invoicing'), |
|
| 839 | + 'CN24' => __('Sichuan / 四川', 'invoicing'), |
|
| 840 | + 'CN25' => __('Guizhou / 贵州', 'invoicing'), |
|
| 841 | + 'CN26' => __('Shaanxi / 陕西', 'invoicing'), |
|
| 842 | + 'CN27' => __('Gansu / 甘肃', 'invoicing'), |
|
| 843 | + 'CN28' => __('Qinghai / 青海', 'invoicing'), |
|
| 844 | + 'CN29' => __('Ningxia Hui / 宁夏', 'invoicing'), |
|
| 845 | + 'CN30' => __('Macau / 澳门', 'invoicing'), |
|
| 846 | + 'CN31' => __('Tibet / 西藏', 'invoicing'), |
|
| 847 | + 'CN32' => __('Xinjiang / 新疆', 'invoicing') |
|
| 848 | 848 | ); |
| 849 | 849 | |
| 850 | - return apply_filters( 'wpinv_china_states', $states ); |
|
| 850 | + return apply_filters('wpinv_china_states', $states); |
|
| 851 | 851 | } |
| 852 | 852 | |
| 853 | 853 | function wpinv_get_new_zealand_states_list() { |
| 854 | 854 | $states = array( |
| 855 | - 'AK' => __( 'Auckland', 'invoicing' ), |
|
| 856 | - 'BP' => __( 'Bay of Plenty', 'invoicing' ), |
|
| 857 | - 'CT' => __( 'Canterbury', 'invoicing' ), |
|
| 858 | - 'HB' => __( 'Hawke’s Bay', 'invoicing' ), |
|
| 859 | - 'MW' => __( 'Manawatu-Wanganui', 'invoicing' ), |
|
| 860 | - 'MB' => __( 'Marlborough', 'invoicing' ), |
|
| 861 | - 'NS' => __( 'Nelson', 'invoicing' ), |
|
| 862 | - 'NL' => __( 'Northland', 'invoicing' ), |
|
| 863 | - 'OT' => __( 'Otago', 'invoicing' ), |
|
| 864 | - 'SL' => __( 'Southland', 'invoicing' ), |
|
| 865 | - 'TK' => __( 'Taranaki', 'invoicing' ), |
|
| 866 | - 'TM' => __( 'Tasman', 'invoicing' ), |
|
| 867 | - 'WA' => __( 'Waikato', 'invoicing' ), |
|
| 868 | - 'WR' => __( 'Wairarapa', 'invoicing' ), |
|
| 869 | - 'WE' => __( 'Wellington', 'invoicing' ), |
|
| 870 | - 'WC' => __( 'West Coast', 'invoicing' ) |
|
| 855 | + 'AK' => __('Auckland', 'invoicing'), |
|
| 856 | + 'BP' => __('Bay of Plenty', 'invoicing'), |
|
| 857 | + 'CT' => __('Canterbury', 'invoicing'), |
|
| 858 | + 'HB' => __('Hawke’s Bay', 'invoicing'), |
|
| 859 | + 'MW' => __('Manawatu-Wanganui', 'invoicing'), |
|
| 860 | + 'MB' => __('Marlborough', 'invoicing'), |
|
| 861 | + 'NS' => __('Nelson', 'invoicing'), |
|
| 862 | + 'NL' => __('Northland', 'invoicing'), |
|
| 863 | + 'OT' => __('Otago', 'invoicing'), |
|
| 864 | + 'SL' => __('Southland', 'invoicing'), |
|
| 865 | + 'TK' => __('Taranaki', 'invoicing'), |
|
| 866 | + 'TM' => __('Tasman', 'invoicing'), |
|
| 867 | + 'WA' => __('Waikato', 'invoicing'), |
|
| 868 | + 'WR' => __('Wairarapa', 'invoicing'), |
|
| 869 | + 'WE' => __('Wellington', 'invoicing'), |
|
| 870 | + 'WC' => __('West Coast', 'invoicing') |
|
| 871 | 871 | ); |
| 872 | 872 | |
| 873 | - return apply_filters( 'wpinv_new_zealand_states', $states ); |
|
| 873 | + return apply_filters('wpinv_new_zealand_states', $states); |
|
| 874 | 874 | } |
| 875 | 875 | |
| 876 | 876 | function wpinv_get_peru_states_list() { |
| 877 | 877 | $states = array( |
| 878 | - 'CAL' => __( 'El Callao', 'invoicing' ), |
|
| 879 | - 'LMA' => __( 'Municipalidad Metropolitana de Lima', 'invoicing' ), |
|
| 880 | - 'AMA' => __( 'Amazonas', 'invoicing' ), |
|
| 881 | - 'ANC' => __( 'Ancash', 'invoicing' ), |
|
| 882 | - 'APU' => __( 'Apurímac', 'invoicing' ), |
|
| 883 | - 'ARE' => __( 'Arequipa', 'invoicing' ), |
|
| 884 | - 'AYA' => __( 'Ayacucho', 'invoicing' ), |
|
| 885 | - 'CAJ' => __( 'Cajamarca', 'invoicing' ), |
|
| 886 | - 'CUS' => __( 'Cusco', 'invoicing' ), |
|
| 887 | - 'HUV' => __( 'Huancavelica', 'invoicing' ), |
|
| 888 | - 'HUC' => __( 'Huánuco', 'invoicing' ), |
|
| 889 | - 'ICA' => __( 'Ica', 'invoicing' ), |
|
| 890 | - 'JUN' => __( 'Junín', 'invoicing' ), |
|
| 891 | - 'LAL' => __( 'La Libertad', 'invoicing' ), |
|
| 892 | - 'LAM' => __( 'Lambayeque', 'invoicing' ), |
|
| 893 | - 'LIM' => __( 'Lima', 'invoicing' ), |
|
| 894 | - 'LOR' => __( 'Loreto', 'invoicing' ), |
|
| 895 | - 'MDD' => __( 'Madre de Dios', 'invoicing' ), |
|
| 896 | - 'MOQ' => __( 'Moquegua', 'invoicing' ), |
|
| 897 | - 'PAS' => __( 'Pasco', 'invoicing' ), |
|
| 898 | - 'PIU' => __( 'Piura', 'invoicing' ), |
|
| 899 | - 'PUN' => __( 'Puno', 'invoicing' ), |
|
| 900 | - 'SAM' => __( 'San Martín', 'invoicing' ), |
|
| 901 | - 'TAC' => __( 'Tacna', 'invoicing' ), |
|
| 902 | - 'TUM' => __( 'Tumbes', 'invoicing' ), |
|
| 903 | - 'UCA' => __( 'Ucayali', 'invoicing' ) |
|
| 878 | + 'CAL' => __('El Callao', 'invoicing'), |
|
| 879 | + 'LMA' => __('Municipalidad Metropolitana de Lima', 'invoicing'), |
|
| 880 | + 'AMA' => __('Amazonas', 'invoicing'), |
|
| 881 | + 'ANC' => __('Ancash', 'invoicing'), |
|
| 882 | + 'APU' => __('Apurímac', 'invoicing'), |
|
| 883 | + 'ARE' => __('Arequipa', 'invoicing'), |
|
| 884 | + 'AYA' => __('Ayacucho', 'invoicing'), |
|
| 885 | + 'CAJ' => __('Cajamarca', 'invoicing'), |
|
| 886 | + 'CUS' => __('Cusco', 'invoicing'), |
|
| 887 | + 'HUV' => __('Huancavelica', 'invoicing'), |
|
| 888 | + 'HUC' => __('Huánuco', 'invoicing'), |
|
| 889 | + 'ICA' => __('Ica', 'invoicing'), |
|
| 890 | + 'JUN' => __('Junín', 'invoicing'), |
|
| 891 | + 'LAL' => __('La Libertad', 'invoicing'), |
|
| 892 | + 'LAM' => __('Lambayeque', 'invoicing'), |
|
| 893 | + 'LIM' => __('Lima', 'invoicing'), |
|
| 894 | + 'LOR' => __('Loreto', 'invoicing'), |
|
| 895 | + 'MDD' => __('Madre de Dios', 'invoicing'), |
|
| 896 | + 'MOQ' => __('Moquegua', 'invoicing'), |
|
| 897 | + 'PAS' => __('Pasco', 'invoicing'), |
|
| 898 | + 'PIU' => __('Piura', 'invoicing'), |
|
| 899 | + 'PUN' => __('Puno', 'invoicing'), |
|
| 900 | + 'SAM' => __('San Martín', 'invoicing'), |
|
| 901 | + 'TAC' => __('Tacna', 'invoicing'), |
|
| 902 | + 'TUM' => __('Tumbes', 'invoicing'), |
|
| 903 | + 'UCA' => __('Ucayali', 'invoicing') |
|
| 904 | 904 | ); |
| 905 | 905 | |
| 906 | - return apply_filters( 'wpinv_peru_states', $states ); |
|
| 906 | + return apply_filters('wpinv_peru_states', $states); |
|
| 907 | 907 | } |
| 908 | 908 | |
| 909 | 909 | function wpinv_get_indonesia_states_list() { |
| 910 | - $states = array( |
|
| 911 | - 'AC' => __( 'Daerah Istimewa Aceh', 'invoicing' ), |
|
| 912 | - 'SU' => __( 'Sumatera Utara', 'invoicing' ), |
|
| 913 | - 'SB' => __( 'Sumatera Barat', 'invoicing' ), |
|
| 914 | - 'RI' => __( 'Riau', 'invoicing' ), |
|
| 915 | - 'KR' => __( 'Kepulauan Riau', 'invoicing' ), |
|
| 916 | - 'JA' => __( 'Jambi', 'invoicing' ), |
|
| 917 | - 'SS' => __( 'Sumatera Selatan', 'invoicing' ), |
|
| 918 | - 'BB' => __( 'Bangka Belitung', 'invoicing' ), |
|
| 919 | - 'BE' => __( 'Bengkulu', 'invoicing' ), |
|
| 920 | - 'LA' => __( 'Lampung', 'invoicing' ), |
|
| 921 | - 'JK' => __( 'DKI Jakarta', 'invoicing' ), |
|
| 922 | - 'JB' => __( 'Jawa Barat', 'invoicing' ), |
|
| 923 | - 'BT' => __( 'Banten', 'invoicing' ), |
|
| 924 | - 'JT' => __( 'Jawa Tengah', 'invoicing' ), |
|
| 925 | - 'JI' => __( 'Jawa Timur', 'invoicing' ), |
|
| 926 | - 'YO' => __( 'Daerah Istimewa Yogyakarta', 'invoicing' ), |
|
| 927 | - 'BA' => __( 'Bali', 'invoicing' ), |
|
| 928 | - 'NB' => __( 'Nusa Tenggara Barat', 'invoicing' ), |
|
| 929 | - 'NT' => __( 'Nusa Tenggara Timur', 'invoicing' ), |
|
| 930 | - 'KB' => __( 'Kalimantan Barat', 'invoicing' ), |
|
| 931 | - 'KT' => __( 'Kalimantan Tengah', 'invoicing' ), |
|
| 932 | - 'KI' => __( 'Kalimantan Timur', 'invoicing' ), |
|
| 933 | - 'KS' => __( 'Kalimantan Selatan', 'invoicing' ), |
|
| 934 | - 'KU' => __( 'Kalimantan Utara', 'invoicing' ), |
|
| 935 | - 'SA' => __( 'Sulawesi Utara', 'invoicing' ), |
|
| 936 | - 'ST' => __( 'Sulawesi Tengah', 'invoicing' ), |
|
| 937 | - 'SG' => __( 'Sulawesi Tenggara', 'invoicing' ), |
|
| 938 | - 'SR' => __( 'Sulawesi Barat', 'invoicing' ), |
|
| 939 | - 'SN' => __( 'Sulawesi Selatan', 'invoicing' ), |
|
| 940 | - 'GO' => __( 'Gorontalo', 'invoicing' ), |
|
| 941 | - 'MA' => __( 'Maluku', 'invoicing' ), |
|
| 942 | - 'MU' => __( 'Maluku Utara', 'invoicing' ), |
|
| 943 | - 'PA' => __( 'Papua', 'invoicing' ), |
|
| 944 | - 'PB' => __( 'Papua Barat', 'invoicing' ) |
|
| 910 | + $states = array( |
|
| 911 | + 'AC' => __('Daerah Istimewa Aceh', 'invoicing'), |
|
| 912 | + 'SU' => __('Sumatera Utara', 'invoicing'), |
|
| 913 | + 'SB' => __('Sumatera Barat', 'invoicing'), |
|
| 914 | + 'RI' => __('Riau', 'invoicing'), |
|
| 915 | + 'KR' => __('Kepulauan Riau', 'invoicing'), |
|
| 916 | + 'JA' => __('Jambi', 'invoicing'), |
|
| 917 | + 'SS' => __('Sumatera Selatan', 'invoicing'), |
|
| 918 | + 'BB' => __('Bangka Belitung', 'invoicing'), |
|
| 919 | + 'BE' => __('Bengkulu', 'invoicing'), |
|
| 920 | + 'LA' => __('Lampung', 'invoicing'), |
|
| 921 | + 'JK' => __('DKI Jakarta', 'invoicing'), |
|
| 922 | + 'JB' => __('Jawa Barat', 'invoicing'), |
|
| 923 | + 'BT' => __('Banten', 'invoicing'), |
|
| 924 | + 'JT' => __('Jawa Tengah', 'invoicing'), |
|
| 925 | + 'JI' => __('Jawa Timur', 'invoicing'), |
|
| 926 | + 'YO' => __('Daerah Istimewa Yogyakarta', 'invoicing'), |
|
| 927 | + 'BA' => __('Bali', 'invoicing'), |
|
| 928 | + 'NB' => __('Nusa Tenggara Barat', 'invoicing'), |
|
| 929 | + 'NT' => __('Nusa Tenggara Timur', 'invoicing'), |
|
| 930 | + 'KB' => __('Kalimantan Barat', 'invoicing'), |
|
| 931 | + 'KT' => __('Kalimantan Tengah', 'invoicing'), |
|
| 932 | + 'KI' => __('Kalimantan Timur', 'invoicing'), |
|
| 933 | + 'KS' => __('Kalimantan Selatan', 'invoicing'), |
|
| 934 | + 'KU' => __('Kalimantan Utara', 'invoicing'), |
|
| 935 | + 'SA' => __('Sulawesi Utara', 'invoicing'), |
|
| 936 | + 'ST' => __('Sulawesi Tengah', 'invoicing'), |
|
| 937 | + 'SG' => __('Sulawesi Tenggara', 'invoicing'), |
|
| 938 | + 'SR' => __('Sulawesi Barat', 'invoicing'), |
|
| 939 | + 'SN' => __('Sulawesi Selatan', 'invoicing'), |
|
| 940 | + 'GO' => __('Gorontalo', 'invoicing'), |
|
| 941 | + 'MA' => __('Maluku', 'invoicing'), |
|
| 942 | + 'MU' => __('Maluku Utara', 'invoicing'), |
|
| 943 | + 'PA' => __('Papua', 'invoicing'), |
|
| 944 | + 'PB' => __('Papua Barat', 'invoicing') |
|
| 945 | 945 | ); |
| 946 | 946 | |
| 947 | - return apply_filters( 'wpinv_indonesia_states', $states ); |
|
| 947 | + return apply_filters('wpinv_indonesia_states', $states); |
|
| 948 | 948 | } |
| 949 | 949 | |
| 950 | 950 | function wpinv_get_india_states_list() { |
| 951 | 951 | $states = array( |
| 952 | - 'AP' => __( 'Andhra Pradesh', 'invoicing' ), |
|
| 953 | - 'AR' => __( 'Arunachal Pradesh', 'invoicing' ), |
|
| 954 | - 'AS' => __( 'Assam', 'invoicing' ), |
|
| 955 | - 'BR' => __( 'Bihar', 'invoicing' ), |
|
| 956 | - 'CT' => __( 'Chhattisgarh', 'invoicing' ), |
|
| 957 | - 'GA' => __( 'Goa', 'invoicing' ), |
|
| 958 | - 'GJ' => __( 'Gujarat', 'invoicing' ), |
|
| 959 | - 'HR' => __( 'Haryana', 'invoicing' ), |
|
| 960 | - 'HP' => __( 'Himachal Pradesh', 'invoicing' ), |
|
| 961 | - 'JK' => __( 'Jammu and Kashmir', 'invoicing' ), |
|
| 962 | - 'JH' => __( 'Jharkhand', 'invoicing' ), |
|
| 963 | - 'KA' => __( 'Karnataka', 'invoicing' ), |
|
| 964 | - 'KL' => __( 'Kerala', 'invoicing' ), |
|
| 965 | - 'MP' => __( 'Madhya Pradesh', 'invoicing' ), |
|
| 966 | - 'MH' => __( 'Maharashtra', 'invoicing' ), |
|
| 967 | - 'MN' => __( 'Manipur', 'invoicing' ), |
|
| 968 | - 'ML' => __( 'Meghalaya', 'invoicing' ), |
|
| 969 | - 'MZ' => __( 'Mizoram', 'invoicing' ), |
|
| 970 | - 'NL' => __( 'Nagaland', 'invoicing' ), |
|
| 971 | - 'OR' => __( 'Orissa', 'invoicing' ), |
|
| 972 | - 'PB' => __( 'Punjab', 'invoicing' ), |
|
| 973 | - 'RJ' => __( 'Rajasthan', 'invoicing' ), |
|
| 974 | - 'SK' => __( 'Sikkim', 'invoicing' ), |
|
| 975 | - 'TN' => __( 'Tamil Nadu', 'invoicing' ), |
|
| 976 | - 'TG' => __( 'Telangana', 'invoicing' ), |
|
| 977 | - 'TR' => __( 'Tripura', 'invoicing' ), |
|
| 978 | - 'UT' => __( 'Uttarakhand', 'invoicing' ), |
|
| 979 | - 'UP' => __( 'Uttar Pradesh', 'invoicing' ), |
|
| 980 | - 'WB' => __( 'West Bengal', 'invoicing' ), |
|
| 981 | - 'AN' => __( 'Andaman and Nicobar Islands', 'invoicing' ), |
|
| 982 | - 'CH' => __( 'Chandigarh', 'invoicing' ), |
|
| 983 | - 'DN' => __( 'Dadar and Nagar Haveli', 'invoicing' ), |
|
| 984 | - 'DD' => __( 'Daman and Diu', 'invoicing' ), |
|
| 985 | - 'DL' => __( 'Delhi', 'invoicing' ), |
|
| 986 | - 'LD' => __( 'Lakshadweep', 'invoicing' ), |
|
| 987 | - 'PY' => __( 'Pondicherry (Puducherry)', 'invoicing' ) |
|
| 952 | + 'AP' => __('Andhra Pradesh', 'invoicing'), |
|
| 953 | + 'AR' => __('Arunachal Pradesh', 'invoicing'), |
|
| 954 | + 'AS' => __('Assam', 'invoicing'), |
|
| 955 | + 'BR' => __('Bihar', 'invoicing'), |
|
| 956 | + 'CT' => __('Chhattisgarh', 'invoicing'), |
|
| 957 | + 'GA' => __('Goa', 'invoicing'), |
|
| 958 | + 'GJ' => __('Gujarat', 'invoicing'), |
|
| 959 | + 'HR' => __('Haryana', 'invoicing'), |
|
| 960 | + 'HP' => __('Himachal Pradesh', 'invoicing'), |
|
| 961 | + 'JK' => __('Jammu and Kashmir', 'invoicing'), |
|
| 962 | + 'JH' => __('Jharkhand', 'invoicing'), |
|
| 963 | + 'KA' => __('Karnataka', 'invoicing'), |
|
| 964 | + 'KL' => __('Kerala', 'invoicing'), |
|
| 965 | + 'MP' => __('Madhya Pradesh', 'invoicing'), |
|
| 966 | + 'MH' => __('Maharashtra', 'invoicing'), |
|
| 967 | + 'MN' => __('Manipur', 'invoicing'), |
|
| 968 | + 'ML' => __('Meghalaya', 'invoicing'), |
|
| 969 | + 'MZ' => __('Mizoram', 'invoicing'), |
|
| 970 | + 'NL' => __('Nagaland', 'invoicing'), |
|
| 971 | + 'OR' => __('Orissa', 'invoicing'), |
|
| 972 | + 'PB' => __('Punjab', 'invoicing'), |
|
| 973 | + 'RJ' => __('Rajasthan', 'invoicing'), |
|
| 974 | + 'SK' => __('Sikkim', 'invoicing'), |
|
| 975 | + 'TN' => __('Tamil Nadu', 'invoicing'), |
|
| 976 | + 'TG' => __('Telangana', 'invoicing'), |
|
| 977 | + 'TR' => __('Tripura', 'invoicing'), |
|
| 978 | + 'UT' => __('Uttarakhand', 'invoicing'), |
|
| 979 | + 'UP' => __('Uttar Pradesh', 'invoicing'), |
|
| 980 | + 'WB' => __('West Bengal', 'invoicing'), |
|
| 981 | + 'AN' => __('Andaman and Nicobar Islands', 'invoicing'), |
|
| 982 | + 'CH' => __('Chandigarh', 'invoicing'), |
|
| 983 | + 'DN' => __('Dadar and Nagar Haveli', 'invoicing'), |
|
| 984 | + 'DD' => __('Daman and Diu', 'invoicing'), |
|
| 985 | + 'DL' => __('Delhi', 'invoicing'), |
|
| 986 | + 'LD' => __('Lakshadweep', 'invoicing'), |
|
| 987 | + 'PY' => __('Pondicherry (Puducherry)', 'invoicing') |
|
| 988 | 988 | ); |
| 989 | 989 | |
| 990 | - return apply_filters( 'wpinv_india_states', $states ); |
|
| 990 | + return apply_filters('wpinv_india_states', $states); |
|
| 991 | 991 | } |
| 992 | 992 | |
| 993 | 993 | function wpinv_get_iran_states_list() { |
| 994 | 994 | $states = array( |
| 995 | - 'KHZ' => __( 'Khuzestan', 'invoicing' ), |
|
| 996 | - 'THR' => __( 'Tehran', 'invoicing' ), |
|
| 997 | - 'ILM' => __( 'Ilaam', 'invoicing' ), |
|
| 998 | - 'BHR' => __( 'Bushehr', 'invoicing' ), |
|
| 999 | - 'ADL' => __( 'Ardabil', 'invoicing' ), |
|
| 1000 | - 'ESF' => __( 'Isfahan', 'invoicing' ), |
|
| 1001 | - 'YZD' => __( 'Yazd', 'invoicing' ), |
|
| 1002 | - 'KRH' => __( 'Kermanshah', 'invoicing' ), |
|
| 1003 | - 'KRN' => __( 'Kerman', 'invoicing' ), |
|
| 1004 | - 'HDN' => __( 'Hamadan', 'invoicing' ), |
|
| 1005 | - 'GZN' => __( 'Ghazvin', 'invoicing' ), |
|
| 1006 | - 'ZJN' => __( 'Zanjan', 'invoicing' ), |
|
| 1007 | - 'LRS' => __( 'Luristan', 'invoicing' ), |
|
| 1008 | - 'ABZ' => __( 'Alborz', 'invoicing' ), |
|
| 1009 | - 'EAZ' => __( 'East Azerbaijan', 'invoicing' ), |
|
| 1010 | - 'WAZ' => __( 'West Azerbaijan', 'invoicing' ), |
|
| 1011 | - 'CHB' => __( 'Chaharmahal and Bakhtiari', 'invoicing' ), |
|
| 1012 | - 'SKH' => __( 'South Khorasan', 'invoicing' ), |
|
| 1013 | - 'RKH' => __( 'Razavi Khorasan', 'invoicing' ), |
|
| 1014 | - 'NKH' => __( 'North Khorasan', 'invoicing' ), |
|
| 1015 | - 'SMN' => __( 'Semnan', 'invoicing' ), |
|
| 1016 | - 'FRS' => __( 'Fars', 'invoicing' ), |
|
| 1017 | - 'QHM' => __( 'Qom', 'invoicing' ), |
|
| 1018 | - 'KRD' => __( 'Kurdistan', 'invoicing' ), |
|
| 1019 | - 'KBD' => __( 'Kohgiluyeh and BoyerAhmad', 'invoicing' ), |
|
| 1020 | - 'GLS' => __( 'Golestan', 'invoicing' ), |
|
| 1021 | - 'GIL' => __( 'Gilan', 'invoicing' ), |
|
| 1022 | - 'MZN' => __( 'Mazandaran', 'invoicing' ), |
|
| 1023 | - 'MKZ' => __( 'Markazi', 'invoicing' ), |
|
| 1024 | - 'HRZ' => __( 'Hormozgan', 'invoicing' ), |
|
| 1025 | - 'SBN' => __( 'Sistan and Baluchestan', 'invoicing' ) |
|
| 995 | + 'KHZ' => __('Khuzestan', 'invoicing'), |
|
| 996 | + 'THR' => __('Tehran', 'invoicing'), |
|
| 997 | + 'ILM' => __('Ilaam', 'invoicing'), |
|
| 998 | + 'BHR' => __('Bushehr', 'invoicing'), |
|
| 999 | + 'ADL' => __('Ardabil', 'invoicing'), |
|
| 1000 | + 'ESF' => __('Isfahan', 'invoicing'), |
|
| 1001 | + 'YZD' => __('Yazd', 'invoicing'), |
|
| 1002 | + 'KRH' => __('Kermanshah', 'invoicing'), |
|
| 1003 | + 'KRN' => __('Kerman', 'invoicing'), |
|
| 1004 | + 'HDN' => __('Hamadan', 'invoicing'), |
|
| 1005 | + 'GZN' => __('Ghazvin', 'invoicing'), |
|
| 1006 | + 'ZJN' => __('Zanjan', 'invoicing'), |
|
| 1007 | + 'LRS' => __('Luristan', 'invoicing'), |
|
| 1008 | + 'ABZ' => __('Alborz', 'invoicing'), |
|
| 1009 | + 'EAZ' => __('East Azerbaijan', 'invoicing'), |
|
| 1010 | + 'WAZ' => __('West Azerbaijan', 'invoicing'), |
|
| 1011 | + 'CHB' => __('Chaharmahal and Bakhtiari', 'invoicing'), |
|
| 1012 | + 'SKH' => __('South Khorasan', 'invoicing'), |
|
| 1013 | + 'RKH' => __('Razavi Khorasan', 'invoicing'), |
|
| 1014 | + 'NKH' => __('North Khorasan', 'invoicing'), |
|
| 1015 | + 'SMN' => __('Semnan', 'invoicing'), |
|
| 1016 | + 'FRS' => __('Fars', 'invoicing'), |
|
| 1017 | + 'QHM' => __('Qom', 'invoicing'), |
|
| 1018 | + 'KRD' => __('Kurdistan', 'invoicing'), |
|
| 1019 | + 'KBD' => __('Kohgiluyeh and BoyerAhmad', 'invoicing'), |
|
| 1020 | + 'GLS' => __('Golestan', 'invoicing'), |
|
| 1021 | + 'GIL' => __('Gilan', 'invoicing'), |
|
| 1022 | + 'MZN' => __('Mazandaran', 'invoicing'), |
|
| 1023 | + 'MKZ' => __('Markazi', 'invoicing'), |
|
| 1024 | + 'HRZ' => __('Hormozgan', 'invoicing'), |
|
| 1025 | + 'SBN' => __('Sistan and Baluchestan', 'invoicing') |
|
| 1026 | 1026 | ); |
| 1027 | 1027 | |
| 1028 | - return apply_filters( 'wpinv_iran_states', $states ); |
|
| 1028 | + return apply_filters('wpinv_iran_states', $states); |
|
| 1029 | 1029 | } |
| 1030 | 1030 | |
| 1031 | 1031 | function wpinv_get_italy_states_list() { |
| 1032 | 1032 | $states = array( |
| 1033 | - 'AG' => __( 'Agrigento', 'invoicing' ), |
|
| 1034 | - 'AL' => __( 'Alessandria', 'invoicing' ), |
|
| 1035 | - 'AN' => __( 'Ancona', 'invoicing' ), |
|
| 1036 | - 'AO' => __( 'Aosta', 'invoicing' ), |
|
| 1037 | - 'AR' => __( 'Arezzo', 'invoicing' ), |
|
| 1038 | - 'AP' => __( 'Ascoli Piceno', 'invoicing' ), |
|
| 1039 | - 'AT' => __( 'Asti', 'invoicing' ), |
|
| 1040 | - 'AV' => __( 'Avellino', 'invoicing' ), |
|
| 1041 | - 'BA' => __( 'Bari', 'invoicing' ), |
|
| 1042 | - 'BT' => __( 'Barletta-Andria-Trani', 'invoicing' ), |
|
| 1043 | - 'BL' => __( 'Belluno', 'invoicing' ), |
|
| 1044 | - 'BN' => __( 'Benevento', 'invoicing' ), |
|
| 1045 | - 'BG' => __( 'Bergamo', 'invoicing' ), |
|
| 1046 | - 'BI' => __( 'Biella', 'invoicing' ), |
|
| 1047 | - 'BO' => __( 'Bologna', 'invoicing' ), |
|
| 1048 | - 'BZ' => __( 'Bolzano', 'invoicing' ), |
|
| 1049 | - 'BS' => __( 'Brescia', 'invoicing' ), |
|
| 1050 | - 'BR' => __( 'Brindisi', 'invoicing' ), |
|
| 1051 | - 'CA' => __( 'Cagliari', 'invoicing' ), |
|
| 1052 | - 'CL' => __( 'Caltanissetta', 'invoicing' ), |
|
| 1053 | - 'CB' => __( 'Campobasso', 'invoicing' ), |
|
| 1054 | - 'CI' => __( 'Caltanissetta', 'invoicing' ), |
|
| 1055 | - 'CE' => __( 'Caserta', 'invoicing' ), |
|
| 1056 | - 'CT' => __( 'Catania', 'invoicing' ), |
|
| 1057 | - 'CZ' => __( 'Catanzaro', 'invoicing' ), |
|
| 1058 | - 'CH' => __( 'Chieti', 'invoicing' ), |
|
| 1059 | - 'CO' => __( 'Como', 'invoicing' ), |
|
| 1060 | - 'CS' => __( 'Cosenza', 'invoicing' ), |
|
| 1061 | - 'CR' => __( 'Cremona', 'invoicing' ), |
|
| 1062 | - 'KR' => __( 'Crotone', 'invoicing' ), |
|
| 1063 | - 'CN' => __( 'Cuneo', 'invoicing' ), |
|
| 1064 | - 'EN' => __( 'Enna', 'invoicing' ), |
|
| 1065 | - 'FM' => __( 'Fermo', 'invoicing' ), |
|
| 1066 | - 'FE' => __( 'Ferrara', 'invoicing' ), |
|
| 1067 | - 'FI' => __( 'Firenze', 'invoicing' ), |
|
| 1068 | - 'FG' => __( 'Foggia', 'invoicing' ), |
|
| 1069 | - 'FC' => __( 'Forli-Cesena', 'invoicing' ), |
|
| 1070 | - 'FR' => __( 'Frosinone', 'invoicing' ), |
|
| 1071 | - 'GE' => __( 'Genova', 'invoicing' ), |
|
| 1072 | - 'GO' => __( 'Gorizia', 'invoicing' ), |
|
| 1073 | - 'GR' => __( 'Grosseto', 'invoicing' ), |
|
| 1074 | - 'IM' => __( 'Imperia', 'invoicing' ), |
|
| 1075 | - 'IS' => __( 'Isernia', 'invoicing' ), |
|
| 1076 | - 'SP' => __( 'La Spezia', 'invoicing' ), |
|
| 1077 | - 'AQ' => __( 'L'Aquila', 'invoicing' ), |
|
| 1078 | - 'LT' => __( 'Latina', 'invoicing' ), |
|
| 1079 | - 'LE' => __( 'Lecce', 'invoicing' ), |
|
| 1080 | - 'LC' => __( 'Lecco', 'invoicing' ), |
|
| 1081 | - 'LI' => __( 'Livorno', 'invoicing' ), |
|
| 1082 | - 'LO' => __( 'Lodi', 'invoicing' ), |
|
| 1083 | - 'LU' => __( 'Lucca', 'invoicing' ), |
|
| 1084 | - 'MC' => __( 'Macerata', 'invoicing' ), |
|
| 1085 | - 'MN' => __( 'Mantova', 'invoicing' ), |
|
| 1086 | - 'MS' => __( 'Massa-Carrara', 'invoicing' ), |
|
| 1087 | - 'MT' => __( 'Matera', 'invoicing' ), |
|
| 1088 | - 'ME' => __( 'Messina', 'invoicing' ), |
|
| 1089 | - 'MI' => __( 'Milano', 'invoicing' ), |
|
| 1090 | - 'MO' => __( 'Modena', 'invoicing' ), |
|
| 1091 | - 'MB' => __( 'Monza e della Brianza', 'invoicing' ), |
|
| 1092 | - 'NA' => __( 'Napoli', 'invoicing' ), |
|
| 1093 | - 'NO' => __( 'Novara', 'invoicing' ), |
|
| 1094 | - 'NU' => __( 'Nuoro', 'invoicing' ), |
|
| 1095 | - 'OT' => __( 'Olbia-Tempio', 'invoicing' ), |
|
| 1096 | - 'OR' => __( 'Oristano', 'invoicing' ), |
|
| 1097 | - 'PD' => __( 'Padova', 'invoicing' ), |
|
| 1098 | - 'PA' => __( 'Palermo', 'invoicing' ), |
|
| 1099 | - 'PR' => __( 'Parma', 'invoicing' ), |
|
| 1100 | - 'PV' => __( 'Pavia', 'invoicing' ), |
|
| 1101 | - 'PG' => __( 'Perugia', 'invoicing' ), |
|
| 1102 | - 'PU' => __( 'Pesaro e Urbino', 'invoicing' ), |
|
| 1103 | - 'PE' => __( 'Pescara', 'invoicing' ), |
|
| 1104 | - 'PC' => __( 'Piacenza', 'invoicing' ), |
|
| 1105 | - 'PI' => __( 'Pisa', 'invoicing' ), |
|
| 1106 | - 'PT' => __( 'Pistoia', 'invoicing' ), |
|
| 1107 | - 'PN' => __( 'Pordenone', 'invoicing' ), |
|
| 1108 | - 'PZ' => __( 'Potenza', 'invoicing' ), |
|
| 1109 | - 'PO' => __( 'Prato', 'invoicing' ), |
|
| 1110 | - 'RG' => __( 'Ragusa', 'invoicing' ), |
|
| 1111 | - 'RA' => __( 'Ravenna', 'invoicing' ), |
|
| 1112 | - 'RC' => __( 'Reggio Calabria', 'invoicing' ), |
|
| 1113 | - 'RE' => __( 'Reggio Emilia', 'invoicing' ), |
|
| 1114 | - 'RI' => __( 'Rieti', 'invoicing' ), |
|
| 1115 | - 'RN' => __( 'Rimini', 'invoicing' ), |
|
| 1116 | - 'RM' => __( 'Roma', 'invoicing' ), |
|
| 1117 | - 'RO' => __( 'Rovigo', 'invoicing' ), |
|
| 1118 | - 'SA' => __( 'Salerno', 'invoicing' ), |
|
| 1119 | - 'VS' => __( 'Medio Campidano', 'invoicing' ), |
|
| 1120 | - 'SS' => __( 'Sassari', 'invoicing' ), |
|
| 1121 | - 'SV' => __( 'Savona', 'invoicing' ), |
|
| 1122 | - 'SI' => __( 'Siena', 'invoicing' ), |
|
| 1123 | - 'SR' => __( 'Siracusa', 'invoicing' ), |
|
| 1124 | - 'SO' => __( 'Sondrio', 'invoicing' ), |
|
| 1125 | - 'TA' => __( 'Taranto', 'invoicing' ), |
|
| 1126 | - 'TE' => __( 'Teramo', 'invoicing' ), |
|
| 1127 | - 'TR' => __( 'Terni', 'invoicing' ), |
|
| 1128 | - 'TO' => __( 'Torino', 'invoicing' ), |
|
| 1129 | - 'OG' => __( 'Ogliastra', 'invoicing' ), |
|
| 1130 | - 'TP' => __( 'Trapani', 'invoicing' ), |
|
| 1131 | - 'TN' => __( 'Trento', 'invoicing' ), |
|
| 1132 | - 'TV' => __( 'Treviso', 'invoicing' ), |
|
| 1133 | - 'TS' => __( 'Trieste', 'invoicing' ), |
|
| 1134 | - 'UD' => __( 'Udine', 'invoicing' ), |
|
| 1135 | - 'VA' => __( 'Varesa', 'invoicing' ), |
|
| 1136 | - 'VE' => __( 'Venezia', 'invoicing' ), |
|
| 1137 | - 'VB' => __( 'Verbano-Cusio-Ossola', 'invoicing' ), |
|
| 1138 | - 'VC' => __( 'Vercelli', 'invoicing' ), |
|
| 1139 | - 'VR' => __( 'Verona', 'invoicing' ), |
|
| 1140 | - 'VV' => __( 'Vibo Valentia', 'invoicing' ), |
|
| 1141 | - 'VI' => __( 'Vicenza', 'invoicing' ), |
|
| 1142 | - 'VT' => __( 'Viterbo', 'invoicing' ) |
|
| 1033 | + 'AG' => __('Agrigento', 'invoicing'), |
|
| 1034 | + 'AL' => __('Alessandria', 'invoicing'), |
|
| 1035 | + 'AN' => __('Ancona', 'invoicing'), |
|
| 1036 | + 'AO' => __('Aosta', 'invoicing'), |
|
| 1037 | + 'AR' => __('Arezzo', 'invoicing'), |
|
| 1038 | + 'AP' => __('Ascoli Piceno', 'invoicing'), |
|
| 1039 | + 'AT' => __('Asti', 'invoicing'), |
|
| 1040 | + 'AV' => __('Avellino', 'invoicing'), |
|
| 1041 | + 'BA' => __('Bari', 'invoicing'), |
|
| 1042 | + 'BT' => __('Barletta-Andria-Trani', 'invoicing'), |
|
| 1043 | + 'BL' => __('Belluno', 'invoicing'), |
|
| 1044 | + 'BN' => __('Benevento', 'invoicing'), |
|
| 1045 | + 'BG' => __('Bergamo', 'invoicing'), |
|
| 1046 | + 'BI' => __('Biella', 'invoicing'), |
|
| 1047 | + 'BO' => __('Bologna', 'invoicing'), |
|
| 1048 | + 'BZ' => __('Bolzano', 'invoicing'), |
|
| 1049 | + 'BS' => __('Brescia', 'invoicing'), |
|
| 1050 | + 'BR' => __('Brindisi', 'invoicing'), |
|
| 1051 | + 'CA' => __('Cagliari', 'invoicing'), |
|
| 1052 | + 'CL' => __('Caltanissetta', 'invoicing'), |
|
| 1053 | + 'CB' => __('Campobasso', 'invoicing'), |
|
| 1054 | + 'CI' => __('Caltanissetta', 'invoicing'), |
|
| 1055 | + 'CE' => __('Caserta', 'invoicing'), |
|
| 1056 | + 'CT' => __('Catania', 'invoicing'), |
|
| 1057 | + 'CZ' => __('Catanzaro', 'invoicing'), |
|
| 1058 | + 'CH' => __('Chieti', 'invoicing'), |
|
| 1059 | + 'CO' => __('Como', 'invoicing'), |
|
| 1060 | + 'CS' => __('Cosenza', 'invoicing'), |
|
| 1061 | + 'CR' => __('Cremona', 'invoicing'), |
|
| 1062 | + 'KR' => __('Crotone', 'invoicing'), |
|
| 1063 | + 'CN' => __('Cuneo', 'invoicing'), |
|
| 1064 | + 'EN' => __('Enna', 'invoicing'), |
|
| 1065 | + 'FM' => __('Fermo', 'invoicing'), |
|
| 1066 | + 'FE' => __('Ferrara', 'invoicing'), |
|
| 1067 | + 'FI' => __('Firenze', 'invoicing'), |
|
| 1068 | + 'FG' => __('Foggia', 'invoicing'), |
|
| 1069 | + 'FC' => __('Forli-Cesena', 'invoicing'), |
|
| 1070 | + 'FR' => __('Frosinone', 'invoicing'), |
|
| 1071 | + 'GE' => __('Genova', 'invoicing'), |
|
| 1072 | + 'GO' => __('Gorizia', 'invoicing'), |
|
| 1073 | + 'GR' => __('Grosseto', 'invoicing'), |
|
| 1074 | + 'IM' => __('Imperia', 'invoicing'), |
|
| 1075 | + 'IS' => __('Isernia', 'invoicing'), |
|
| 1076 | + 'SP' => __('La Spezia', 'invoicing'), |
|
| 1077 | + 'AQ' => __('L'Aquila', 'invoicing'), |
|
| 1078 | + 'LT' => __('Latina', 'invoicing'), |
|
| 1079 | + 'LE' => __('Lecce', 'invoicing'), |
|
| 1080 | + 'LC' => __('Lecco', 'invoicing'), |
|
| 1081 | + 'LI' => __('Livorno', 'invoicing'), |
|
| 1082 | + 'LO' => __('Lodi', 'invoicing'), |
|
| 1083 | + 'LU' => __('Lucca', 'invoicing'), |
|
| 1084 | + 'MC' => __('Macerata', 'invoicing'), |
|
| 1085 | + 'MN' => __('Mantova', 'invoicing'), |
|
| 1086 | + 'MS' => __('Massa-Carrara', 'invoicing'), |
|
| 1087 | + 'MT' => __('Matera', 'invoicing'), |
|
| 1088 | + 'ME' => __('Messina', 'invoicing'), |
|
| 1089 | + 'MI' => __('Milano', 'invoicing'), |
|
| 1090 | + 'MO' => __('Modena', 'invoicing'), |
|
| 1091 | + 'MB' => __('Monza e della Brianza', 'invoicing'), |
|
| 1092 | + 'NA' => __('Napoli', 'invoicing'), |
|
| 1093 | + 'NO' => __('Novara', 'invoicing'), |
|
| 1094 | + 'NU' => __('Nuoro', 'invoicing'), |
|
| 1095 | + 'OT' => __('Olbia-Tempio', 'invoicing'), |
|
| 1096 | + 'OR' => __('Oristano', 'invoicing'), |
|
| 1097 | + 'PD' => __('Padova', 'invoicing'), |
|
| 1098 | + 'PA' => __('Palermo', 'invoicing'), |
|
| 1099 | + 'PR' => __('Parma', 'invoicing'), |
|
| 1100 | + 'PV' => __('Pavia', 'invoicing'), |
|
| 1101 | + 'PG' => __('Perugia', 'invoicing'), |
|
| 1102 | + 'PU' => __('Pesaro e Urbino', 'invoicing'), |
|
| 1103 | + 'PE' => __('Pescara', 'invoicing'), |
|
| 1104 | + 'PC' => __('Piacenza', 'invoicing'), |
|
| 1105 | + 'PI' => __('Pisa', 'invoicing'), |
|
| 1106 | + 'PT' => __('Pistoia', 'invoicing'), |
|
| 1107 | + 'PN' => __('Pordenone', 'invoicing'), |
|
| 1108 | + 'PZ' => __('Potenza', 'invoicing'), |
|
| 1109 | + 'PO' => __('Prato', 'invoicing'), |
|
| 1110 | + 'RG' => __('Ragusa', 'invoicing'), |
|
| 1111 | + 'RA' => __('Ravenna', 'invoicing'), |
|
| 1112 | + 'RC' => __('Reggio Calabria', 'invoicing'), |
|
| 1113 | + 'RE' => __('Reggio Emilia', 'invoicing'), |
|
| 1114 | + 'RI' => __('Rieti', 'invoicing'), |
|
| 1115 | + 'RN' => __('Rimini', 'invoicing'), |
|
| 1116 | + 'RM' => __('Roma', 'invoicing'), |
|
| 1117 | + 'RO' => __('Rovigo', 'invoicing'), |
|
| 1118 | + 'SA' => __('Salerno', 'invoicing'), |
|
| 1119 | + 'VS' => __('Medio Campidano', 'invoicing'), |
|
| 1120 | + 'SS' => __('Sassari', 'invoicing'), |
|
| 1121 | + 'SV' => __('Savona', 'invoicing'), |
|
| 1122 | + 'SI' => __('Siena', 'invoicing'), |
|
| 1123 | + 'SR' => __('Siracusa', 'invoicing'), |
|
| 1124 | + 'SO' => __('Sondrio', 'invoicing'), |
|
| 1125 | + 'TA' => __('Taranto', 'invoicing'), |
|
| 1126 | + 'TE' => __('Teramo', 'invoicing'), |
|
| 1127 | + 'TR' => __('Terni', 'invoicing'), |
|
| 1128 | + 'TO' => __('Torino', 'invoicing'), |
|
| 1129 | + 'OG' => __('Ogliastra', 'invoicing'), |
|
| 1130 | + 'TP' => __('Trapani', 'invoicing'), |
|
| 1131 | + 'TN' => __('Trento', 'invoicing'), |
|
| 1132 | + 'TV' => __('Treviso', 'invoicing'), |
|
| 1133 | + 'TS' => __('Trieste', 'invoicing'), |
|
| 1134 | + 'UD' => __('Udine', 'invoicing'), |
|
| 1135 | + 'VA' => __('Varesa', 'invoicing'), |
|
| 1136 | + 'VE' => __('Venezia', 'invoicing'), |
|
| 1137 | + 'VB' => __('Verbano-Cusio-Ossola', 'invoicing'), |
|
| 1138 | + 'VC' => __('Vercelli', 'invoicing'), |
|
| 1139 | + 'VR' => __('Verona', 'invoicing'), |
|
| 1140 | + 'VV' => __('Vibo Valentia', 'invoicing'), |
|
| 1141 | + 'VI' => __('Vicenza', 'invoicing'), |
|
| 1142 | + 'VT' => __('Viterbo', 'invoicing') |
|
| 1143 | 1143 | ); |
| 1144 | 1144 | |
| 1145 | - return apply_filters( 'wpinv_italy_states', $states ); |
|
| 1145 | + return apply_filters('wpinv_italy_states', $states); |
|
| 1146 | 1146 | } |
| 1147 | 1147 | |
| 1148 | 1148 | function wpinv_get_malaysia_states_list() { |
| 1149 | 1149 | $states = array( |
| 1150 | - 'JHR' => __( 'Johor', 'invoicing' ), |
|
| 1151 | - 'KDH' => __( 'Kedah', 'invoicing' ), |
|
| 1152 | - 'KTN' => __( 'Kelantan', 'invoicing' ), |
|
| 1153 | - 'MLK' => __( 'Melaka', 'invoicing' ), |
|
| 1154 | - 'NSN' => __( 'Negeri Sembilan', 'invoicing' ), |
|
| 1155 | - 'PHG' => __( 'Pahang', 'invoicing' ), |
|
| 1156 | - 'PRK' => __( 'Perak', 'invoicing' ), |
|
| 1157 | - 'PLS' => __( 'Perlis', 'invoicing' ), |
|
| 1158 | - 'PNG' => __( 'Pulau Pinang', 'invoicing' ), |
|
| 1159 | - 'SBH' => __( 'Sabah', 'invoicing' ), |
|
| 1160 | - 'SWK' => __( 'Sarawak', 'invoicing' ), |
|
| 1161 | - 'SGR' => __( 'Selangor', 'invoicing' ), |
|
| 1162 | - 'TRG' => __( 'Terengganu', 'invoicing' ), |
|
| 1163 | - 'KUL' => __( 'W.P. Kuala Lumpur', 'invoicing' ), |
|
| 1164 | - 'LBN' => __( 'W.P. Labuan', 'invoicing' ), |
|
| 1165 | - 'PJY' => __( 'W.P. Putrajaya', 'invoicing' ) |
|
| 1150 | + 'JHR' => __('Johor', 'invoicing'), |
|
| 1151 | + 'KDH' => __('Kedah', 'invoicing'), |
|
| 1152 | + 'KTN' => __('Kelantan', 'invoicing'), |
|
| 1153 | + 'MLK' => __('Melaka', 'invoicing'), |
|
| 1154 | + 'NSN' => __('Negeri Sembilan', 'invoicing'), |
|
| 1155 | + 'PHG' => __('Pahang', 'invoicing'), |
|
| 1156 | + 'PRK' => __('Perak', 'invoicing'), |
|
| 1157 | + 'PLS' => __('Perlis', 'invoicing'), |
|
| 1158 | + 'PNG' => __('Pulau Pinang', 'invoicing'), |
|
| 1159 | + 'SBH' => __('Sabah', 'invoicing'), |
|
| 1160 | + 'SWK' => __('Sarawak', 'invoicing'), |
|
| 1161 | + 'SGR' => __('Selangor', 'invoicing'), |
|
| 1162 | + 'TRG' => __('Terengganu', 'invoicing'), |
|
| 1163 | + 'KUL' => __('W.P. Kuala Lumpur', 'invoicing'), |
|
| 1164 | + 'LBN' => __('W.P. Labuan', 'invoicing'), |
|
| 1165 | + 'PJY' => __('W.P. Putrajaya', 'invoicing') |
|
| 1166 | 1166 | ); |
| 1167 | 1167 | |
| 1168 | - return apply_filters( 'wpinv_malaysia_states', $states ); |
|
| 1168 | + return apply_filters('wpinv_malaysia_states', $states); |
|
| 1169 | 1169 | } |
| 1170 | 1170 | |
| 1171 | 1171 | function wpinv_get_mexico_states_list() { |
| 1172 | 1172 | $states = array( |
| 1173 | - 'DIF' => __( 'Distrito Federal', 'invoicing' ), |
|
| 1174 | - 'JAL' => __( 'Jalisco', 'invoicing' ), |
|
| 1175 | - 'NLE' => __( 'Nuevo León', 'invoicing' ), |
|
| 1176 | - 'AGU' => __( 'Aguascalientes', 'invoicing' ), |
|
| 1177 | - 'BCN' => __( 'Baja California Norte', 'invoicing' ), |
|
| 1178 | - 'BCS' => __( 'Baja California Sur', 'invoicing' ), |
|
| 1179 | - 'CAM' => __( 'Campeche', 'invoicing' ), |
|
| 1180 | - 'CHP' => __( 'Chiapas', 'invoicing' ), |
|
| 1181 | - 'CHH' => __( 'Chihuahua', 'invoicing' ), |
|
| 1182 | - 'COA' => __( 'Coahuila', 'invoicing' ), |
|
| 1183 | - 'COL' => __( 'Colima', 'invoicing' ), |
|
| 1184 | - 'DUR' => __( 'Durango', 'invoicing' ), |
|
| 1185 | - 'GUA' => __( 'Guanajuato', 'invoicing' ), |
|
| 1186 | - 'GRO' => __( 'Guerrero', 'invoicing' ), |
|
| 1187 | - 'HID' => __( 'Hidalgo', 'invoicing' ), |
|
| 1188 | - 'MEX' => __( 'Edo. de México', 'invoicing' ), |
|
| 1189 | - 'MIC' => __( 'Michoacán', 'invoicing' ), |
|
| 1190 | - 'MOR' => __( 'Morelos', 'invoicing' ), |
|
| 1191 | - 'NAY' => __( 'Nayarit', 'invoicing' ), |
|
| 1192 | - 'OAX' => __( 'Oaxaca', 'invoicing' ), |
|
| 1193 | - 'PUE' => __( 'Puebla', 'invoicing' ), |
|
| 1194 | - 'QUE' => __( 'Querétaro', 'invoicing' ), |
|
| 1195 | - 'ROO' => __( 'Quintana Roo', 'invoicing' ), |
|
| 1196 | - 'SLP' => __( 'San Luis Potosí', 'invoicing' ), |
|
| 1197 | - 'SIN' => __( 'Sinaloa', 'invoicing' ), |
|
| 1198 | - 'SON' => __( 'Sonora', 'invoicing' ), |
|
| 1199 | - 'TAB' => __( 'Tabasco', 'invoicing' ), |
|
| 1200 | - 'TAM' => __( 'Tamaulipas', 'invoicing' ), |
|
| 1201 | - 'TLA' => __( 'Tlaxcala', 'invoicing' ), |
|
| 1202 | - 'VER' => __( 'Veracruz', 'invoicing' ), |
|
| 1203 | - 'YUC' => __( 'Yucatán', 'invoicing' ), |
|
| 1204 | - 'ZAC' => __( 'Zacatecas', 'invoicing' ) |
|
| 1173 | + 'DIF' => __('Distrito Federal', 'invoicing'), |
|
| 1174 | + 'JAL' => __('Jalisco', 'invoicing'), |
|
| 1175 | + 'NLE' => __('Nuevo León', 'invoicing'), |
|
| 1176 | + 'AGU' => __('Aguascalientes', 'invoicing'), |
|
| 1177 | + 'BCN' => __('Baja California Norte', 'invoicing'), |
|
| 1178 | + 'BCS' => __('Baja California Sur', 'invoicing'), |
|
| 1179 | + 'CAM' => __('Campeche', 'invoicing'), |
|
| 1180 | + 'CHP' => __('Chiapas', 'invoicing'), |
|
| 1181 | + 'CHH' => __('Chihuahua', 'invoicing'), |
|
| 1182 | + 'COA' => __('Coahuila', 'invoicing'), |
|
| 1183 | + 'COL' => __('Colima', 'invoicing'), |
|
| 1184 | + 'DUR' => __('Durango', 'invoicing'), |
|
| 1185 | + 'GUA' => __('Guanajuato', 'invoicing'), |
|
| 1186 | + 'GRO' => __('Guerrero', 'invoicing'), |
|
| 1187 | + 'HID' => __('Hidalgo', 'invoicing'), |
|
| 1188 | + 'MEX' => __('Edo. de México', 'invoicing'), |
|
| 1189 | + 'MIC' => __('Michoacán', 'invoicing'), |
|
| 1190 | + 'MOR' => __('Morelos', 'invoicing'), |
|
| 1191 | + 'NAY' => __('Nayarit', 'invoicing'), |
|
| 1192 | + 'OAX' => __('Oaxaca', 'invoicing'), |
|
| 1193 | + 'PUE' => __('Puebla', 'invoicing'), |
|
| 1194 | + 'QUE' => __('Querétaro', 'invoicing'), |
|
| 1195 | + 'ROO' => __('Quintana Roo', 'invoicing'), |
|
| 1196 | + 'SLP' => __('San Luis Potosí', 'invoicing'), |
|
| 1197 | + 'SIN' => __('Sinaloa', 'invoicing'), |
|
| 1198 | + 'SON' => __('Sonora', 'invoicing'), |
|
| 1199 | + 'TAB' => __('Tabasco', 'invoicing'), |
|
| 1200 | + 'TAM' => __('Tamaulipas', 'invoicing'), |
|
| 1201 | + 'TLA' => __('Tlaxcala', 'invoicing'), |
|
| 1202 | + 'VER' => __('Veracruz', 'invoicing'), |
|
| 1203 | + 'YUC' => __('Yucatán', 'invoicing'), |
|
| 1204 | + 'ZAC' => __('Zacatecas', 'invoicing') |
|
| 1205 | 1205 | ); |
| 1206 | 1206 | |
| 1207 | - return apply_filters( 'wpinv_mexico_states', $states ); |
|
| 1207 | + return apply_filters('wpinv_mexico_states', $states); |
|
| 1208 | 1208 | } |
| 1209 | 1209 | |
| 1210 | 1210 | function wpinv_get_nepal_states_list() { |
| 1211 | 1211 | $states = array( |
| 1212 | - 'ILL' => __( 'Illam', 'invoicing' ), |
|
| 1213 | - 'JHA' => __( 'Jhapa', 'invoicing' ), |
|
| 1214 | - 'PAN' => __( 'Panchthar', 'invoicing' ), |
|
| 1215 | - 'TAP' => __( 'Taplejung', 'invoicing' ), |
|
| 1216 | - 'BHO' => __( 'Bhojpur', 'invoicing' ), |
|
| 1217 | - 'DKA' => __( 'Dhankuta', 'invoicing' ), |
|
| 1218 | - 'MOR' => __( 'Morang', 'invoicing' ), |
|
| 1219 | - 'SUN' => __( 'Sunsari', 'invoicing' ), |
|
| 1220 | - 'SAN' => __( 'Sankhuwa', 'invoicing' ), |
|
| 1221 | - 'TER' => __( 'Terhathum', 'invoicing' ), |
|
| 1222 | - 'KHO' => __( 'Khotang', 'invoicing' ), |
|
| 1223 | - 'OKH' => __( 'Okhaldhunga', 'invoicing' ), |
|
| 1224 | - 'SAP' => __( 'Saptari', 'invoicing' ), |
|
| 1225 | - 'SIR' => __( 'Siraha', 'invoicing' ), |
|
| 1226 | - 'SOL' => __( 'Solukhumbu', 'invoicing' ), |
|
| 1227 | - 'UDA' => __( 'Udayapur', 'invoicing' ), |
|
| 1228 | - 'DHA' => __( 'Dhanusa', 'invoicing' ), |
|
| 1229 | - 'DLK' => __( 'Dolakha', 'invoicing' ), |
|
| 1230 | - 'MOH' => __( 'Mohottari', 'invoicing' ), |
|
| 1231 | - 'RAM' => __( 'Ramechha', 'invoicing' ), |
|
| 1232 | - 'SAR' => __( 'Sarlahi', 'invoicing' ), |
|
| 1233 | - 'SIN' => __( 'Sindhuli', 'invoicing' ), |
|
| 1234 | - 'BHA' => __( 'Bhaktapur', 'invoicing' ), |
|
| 1235 | - 'DHD' => __( 'Dhading', 'invoicing' ), |
|
| 1236 | - 'KTM' => __( 'Kathmandu', 'invoicing' ), |
|
| 1237 | - 'KAV' => __( 'Kavrepalanchowk', 'invoicing' ), |
|
| 1238 | - 'LAL' => __( 'Lalitpur', 'invoicing' ), |
|
| 1239 | - 'NUW' => __( 'Nuwakot', 'invoicing' ), |
|
| 1240 | - 'RAS' => __( 'Rasuwa', 'invoicing' ), |
|
| 1241 | - 'SPC' => __( 'Sindhupalchowk', 'invoicing' ), |
|
| 1242 | - 'BAR' => __( 'Bara', 'invoicing' ), |
|
| 1243 | - 'CHI' => __( 'Chitwan', 'invoicing' ), |
|
| 1244 | - 'MAK' => __( 'Makwanpur', 'invoicing' ), |
|
| 1245 | - 'PAR' => __( 'Parsa', 'invoicing' ), |
|
| 1246 | - 'RAU' => __( 'Rautahat', 'invoicing' ), |
|
| 1247 | - 'GOR' => __( 'Gorkha', 'invoicing' ), |
|
| 1248 | - 'KAS' => __( 'Kaski', 'invoicing' ), |
|
| 1249 | - 'LAM' => __( 'Lamjung', 'invoicing' ), |
|
| 1250 | - 'MAN' => __( 'Manang', 'invoicing' ), |
|
| 1251 | - 'SYN' => __( 'Syangja', 'invoicing' ), |
|
| 1252 | - 'TAN' => __( 'Tanahun', 'invoicing' ), |
|
| 1253 | - 'BAG' => __( 'Baglung', 'invoicing' ), |
|
| 1254 | - 'PBT' => __( 'Parbat', 'invoicing' ), |
|
| 1255 | - 'MUS' => __( 'Mustang', 'invoicing' ), |
|
| 1256 | - 'MYG' => __( 'Myagdi', 'invoicing' ), |
|
| 1257 | - 'AGR' => __( 'Agrghakanchi', 'invoicing' ), |
|
| 1258 | - 'GUL' => __( 'Gulmi', 'invoicing' ), |
|
| 1259 | - 'KAP' => __( 'Kapilbastu', 'invoicing' ), |
|
| 1260 | - 'NAW' => __( 'Nawalparasi', 'invoicing' ), |
|
| 1261 | - 'PAL' => __( 'Palpa', 'invoicing' ), |
|
| 1262 | - 'RUP' => __( 'Rupandehi', 'invoicing' ), |
|
| 1263 | - 'DAN' => __( 'Dang', 'invoicing' ), |
|
| 1264 | - 'PYU' => __( 'Pyuthan', 'invoicing' ), |
|
| 1265 | - 'ROL' => __( 'Rolpa', 'invoicing' ), |
|
| 1266 | - 'RUK' => __( 'Rukum', 'invoicing' ), |
|
| 1267 | - 'SAL' => __( 'Salyan', 'invoicing' ), |
|
| 1268 | - 'BAN' => __( 'Banke', 'invoicing' ), |
|
| 1269 | - 'BDA' => __( 'Bardiya', 'invoicing' ), |
|
| 1270 | - 'DAI' => __( 'Dailekh', 'invoicing' ), |
|
| 1271 | - 'JAJ' => __( 'Jajarkot', 'invoicing' ), |
|
| 1272 | - 'SUR' => __( 'Surkhet', 'invoicing' ), |
|
| 1273 | - 'DOL' => __( 'Dolpa', 'invoicing' ), |
|
| 1274 | - 'HUM' => __( 'Humla', 'invoicing' ), |
|
| 1275 | - 'JUM' => __( 'Jumla', 'invoicing' ), |
|
| 1276 | - 'KAL' => __( 'Kalikot', 'invoicing' ), |
|
| 1277 | - 'MUG' => __( 'Mugu', 'invoicing' ), |
|
| 1278 | - 'ACH' => __( 'Achham', 'invoicing' ), |
|
| 1279 | - 'BJH' => __( 'Bajhang', 'invoicing' ), |
|
| 1280 | - 'BJU' => __( 'Bajura', 'invoicing' ), |
|
| 1281 | - 'DOT' => __( 'Doti', 'invoicing' ), |
|
| 1282 | - 'KAI' => __( 'Kailali', 'invoicing' ), |
|
| 1283 | - 'BAI' => __( 'Baitadi', 'invoicing' ), |
|
| 1284 | - 'DAD' => __( 'Dadeldhura', 'invoicing' ), |
|
| 1285 | - 'DAR' => __( 'Darchula', 'invoicing' ), |
|
| 1286 | - 'KAN' => __( 'Kanchanpur', 'invoicing' ) |
|
| 1212 | + 'ILL' => __('Illam', 'invoicing'), |
|
| 1213 | + 'JHA' => __('Jhapa', 'invoicing'), |
|
| 1214 | + 'PAN' => __('Panchthar', 'invoicing'), |
|
| 1215 | + 'TAP' => __('Taplejung', 'invoicing'), |
|
| 1216 | + 'BHO' => __('Bhojpur', 'invoicing'), |
|
| 1217 | + 'DKA' => __('Dhankuta', 'invoicing'), |
|
| 1218 | + 'MOR' => __('Morang', 'invoicing'), |
|
| 1219 | + 'SUN' => __('Sunsari', 'invoicing'), |
|
| 1220 | + 'SAN' => __('Sankhuwa', 'invoicing'), |
|
| 1221 | + 'TER' => __('Terhathum', 'invoicing'), |
|
| 1222 | + 'KHO' => __('Khotang', 'invoicing'), |
|
| 1223 | + 'OKH' => __('Okhaldhunga', 'invoicing'), |
|
| 1224 | + 'SAP' => __('Saptari', 'invoicing'), |
|
| 1225 | + 'SIR' => __('Siraha', 'invoicing'), |
|
| 1226 | + 'SOL' => __('Solukhumbu', 'invoicing'), |
|
| 1227 | + 'UDA' => __('Udayapur', 'invoicing'), |
|
| 1228 | + 'DHA' => __('Dhanusa', 'invoicing'), |
|
| 1229 | + 'DLK' => __('Dolakha', 'invoicing'), |
|
| 1230 | + 'MOH' => __('Mohottari', 'invoicing'), |
|
| 1231 | + 'RAM' => __('Ramechha', 'invoicing'), |
|
| 1232 | + 'SAR' => __('Sarlahi', 'invoicing'), |
|
| 1233 | + 'SIN' => __('Sindhuli', 'invoicing'), |
|
| 1234 | + 'BHA' => __('Bhaktapur', 'invoicing'), |
|
| 1235 | + 'DHD' => __('Dhading', 'invoicing'), |
|
| 1236 | + 'KTM' => __('Kathmandu', 'invoicing'), |
|
| 1237 | + 'KAV' => __('Kavrepalanchowk', 'invoicing'), |
|
| 1238 | + 'LAL' => __('Lalitpur', 'invoicing'), |
|
| 1239 | + 'NUW' => __('Nuwakot', 'invoicing'), |
|
| 1240 | + 'RAS' => __('Rasuwa', 'invoicing'), |
|
| 1241 | + 'SPC' => __('Sindhupalchowk', 'invoicing'), |
|
| 1242 | + 'BAR' => __('Bara', 'invoicing'), |
|
| 1243 | + 'CHI' => __('Chitwan', 'invoicing'), |
|
| 1244 | + 'MAK' => __('Makwanpur', 'invoicing'), |
|
| 1245 | + 'PAR' => __('Parsa', 'invoicing'), |
|
| 1246 | + 'RAU' => __('Rautahat', 'invoicing'), |
|
| 1247 | + 'GOR' => __('Gorkha', 'invoicing'), |
|
| 1248 | + 'KAS' => __('Kaski', 'invoicing'), |
|
| 1249 | + 'LAM' => __('Lamjung', 'invoicing'), |
|
| 1250 | + 'MAN' => __('Manang', 'invoicing'), |
|
| 1251 | + 'SYN' => __('Syangja', 'invoicing'), |
|
| 1252 | + 'TAN' => __('Tanahun', 'invoicing'), |
|
| 1253 | + 'BAG' => __('Baglung', 'invoicing'), |
|
| 1254 | + 'PBT' => __('Parbat', 'invoicing'), |
|
| 1255 | + 'MUS' => __('Mustang', 'invoicing'), |
|
| 1256 | + 'MYG' => __('Myagdi', 'invoicing'), |
|
| 1257 | + 'AGR' => __('Agrghakanchi', 'invoicing'), |
|
| 1258 | + 'GUL' => __('Gulmi', 'invoicing'), |
|
| 1259 | + 'KAP' => __('Kapilbastu', 'invoicing'), |
|
| 1260 | + 'NAW' => __('Nawalparasi', 'invoicing'), |
|
| 1261 | + 'PAL' => __('Palpa', 'invoicing'), |
|
| 1262 | + 'RUP' => __('Rupandehi', 'invoicing'), |
|
| 1263 | + 'DAN' => __('Dang', 'invoicing'), |
|
| 1264 | + 'PYU' => __('Pyuthan', 'invoicing'), |
|
| 1265 | + 'ROL' => __('Rolpa', 'invoicing'), |
|
| 1266 | + 'RUK' => __('Rukum', 'invoicing'), |
|
| 1267 | + 'SAL' => __('Salyan', 'invoicing'), |
|
| 1268 | + 'BAN' => __('Banke', 'invoicing'), |
|
| 1269 | + 'BDA' => __('Bardiya', 'invoicing'), |
|
| 1270 | + 'DAI' => __('Dailekh', 'invoicing'), |
|
| 1271 | + 'JAJ' => __('Jajarkot', 'invoicing'), |
|
| 1272 | + 'SUR' => __('Surkhet', 'invoicing'), |
|
| 1273 | + 'DOL' => __('Dolpa', 'invoicing'), |
|
| 1274 | + 'HUM' => __('Humla', 'invoicing'), |
|
| 1275 | + 'JUM' => __('Jumla', 'invoicing'), |
|
| 1276 | + 'KAL' => __('Kalikot', 'invoicing'), |
|
| 1277 | + 'MUG' => __('Mugu', 'invoicing'), |
|
| 1278 | + 'ACH' => __('Achham', 'invoicing'), |
|
| 1279 | + 'BJH' => __('Bajhang', 'invoicing'), |
|
| 1280 | + 'BJU' => __('Bajura', 'invoicing'), |
|
| 1281 | + 'DOT' => __('Doti', 'invoicing'), |
|
| 1282 | + 'KAI' => __('Kailali', 'invoicing'), |
|
| 1283 | + 'BAI' => __('Baitadi', 'invoicing'), |
|
| 1284 | + 'DAD' => __('Dadeldhura', 'invoicing'), |
|
| 1285 | + 'DAR' => __('Darchula', 'invoicing'), |
|
| 1286 | + 'KAN' => __('Kanchanpur', 'invoicing') |
|
| 1287 | 1287 | ); |
| 1288 | 1288 | |
| 1289 | - return apply_filters( 'wpinv_nepal_states', $states ); |
|
| 1289 | + return apply_filters('wpinv_nepal_states', $states); |
|
| 1290 | 1290 | } |
| 1291 | 1291 | |
| 1292 | 1292 | function wpinv_get_south_africa_states_list() { |
| 1293 | 1293 | $states = array( |
| 1294 | - 'EC' => __( 'Eastern Cape', 'invoicing' ), |
|
| 1295 | - 'FS' => __( 'Free State', 'invoicing' ), |
|
| 1296 | - 'GP' => __( 'Gauteng', 'invoicing' ), |
|
| 1297 | - 'KZN' => __( 'KwaZulu-Natal', 'invoicing' ), |
|
| 1298 | - 'LP' => __( 'Limpopo', 'invoicing' ), |
|
| 1299 | - 'MP' => __( 'Mpumalanga', 'invoicing' ), |
|
| 1300 | - 'NC' => __( 'Northern Cape', 'invoicing' ), |
|
| 1301 | - 'NW' => __( 'North West', 'invoicing' ), |
|
| 1302 | - 'WC' => __( 'Western Cape', 'invoicing' ) |
|
| 1294 | + 'EC' => __('Eastern Cape', 'invoicing'), |
|
| 1295 | + 'FS' => __('Free State', 'invoicing'), |
|
| 1296 | + 'GP' => __('Gauteng', 'invoicing'), |
|
| 1297 | + 'KZN' => __('KwaZulu-Natal', 'invoicing'), |
|
| 1298 | + 'LP' => __('Limpopo', 'invoicing'), |
|
| 1299 | + 'MP' => __('Mpumalanga', 'invoicing'), |
|
| 1300 | + 'NC' => __('Northern Cape', 'invoicing'), |
|
| 1301 | + 'NW' => __('North West', 'invoicing'), |
|
| 1302 | + 'WC' => __('Western Cape', 'invoicing') |
|
| 1303 | 1303 | ); |
| 1304 | 1304 | |
| 1305 | - return apply_filters( 'wpinv_south_africa_states', $states ); |
|
| 1305 | + return apply_filters('wpinv_south_africa_states', $states); |
|
| 1306 | 1306 | } |
| 1307 | 1307 | |
| 1308 | 1308 | function wpinv_get_thailand_states_list() { |
| 1309 | 1309 | $states = array( |
| 1310 | - 'TH-37' => __( 'Amnat Charoen (อำนาจเจริญ)', 'invoicing' ), |
|
| 1311 | - 'TH-15' => __( 'Ang Thong (อ่างทอง)', 'invoicing' ), |
|
| 1312 | - 'TH-14' => __( 'Ayutthaya (พระนครศรีอยุธยา)', 'invoicing' ), |
|
| 1313 | - 'TH-10' => __( 'Bangkok (กรุงเทพมหานคร)', 'invoicing' ), |
|
| 1314 | - 'TH-38' => __( 'Bueng Kan (บึงกาฬ)', 'invoicing' ), |
|
| 1315 | - 'TH-31' => __( 'Buri Ram (บุรีรัมย์)', 'invoicing' ), |
|
| 1316 | - 'TH-24' => __( 'Chachoengsao (ฉะเชิงเทรา)', 'invoicing' ), |
|
| 1317 | - 'TH-18' => __( 'Chai Nat (ชัยนาท)', 'invoicing' ), |
|
| 1318 | - 'TH-36' => __( 'Chaiyaphum (ชัยภูมิ)', 'invoicing' ), |
|
| 1319 | - 'TH-22' => __( 'Chanthaburi (จันทบุรี)', 'invoicing' ), |
|
| 1320 | - 'TH-50' => __( 'Chiang Mai (เชียงใหม่)', 'invoicing' ), |
|
| 1321 | - 'TH-57' => __( 'Chiang Rai (เชียงราย)', 'invoicing' ), |
|
| 1322 | - 'TH-20' => __( 'Chonburi (ชลบุรี)', 'invoicing' ), |
|
| 1323 | - 'TH-86' => __( 'Chumphon (ชุมพร)', 'invoicing' ), |
|
| 1324 | - 'TH-46' => __( 'Kalasin (กาฬสินธุ์)', 'invoicing' ), |
|
| 1325 | - 'TH-62' => __( 'Kamphaeng Phet (กำแพงเพชร)', 'invoicing' ), |
|
| 1326 | - 'TH-71' => __( 'Kanchanaburi (กาญจนบุรี)', 'invoicing' ), |
|
| 1327 | - 'TH-40' => __( 'Khon Kaen (ขอนแก่น)', 'invoicing' ), |
|
| 1328 | - 'TH-81' => __( 'Krabi (กระบี่)', 'invoicing' ), |
|
| 1329 | - 'TH-52' => __( 'Lampang (ลำปาง)', 'invoicing' ), |
|
| 1330 | - 'TH-51' => __( 'Lamphun (ลำพูน)', 'invoicing' ), |
|
| 1331 | - 'TH-42' => __( 'Loei (เลย)', 'invoicing' ), |
|
| 1332 | - 'TH-16' => __( 'Lopburi (ลพบุรี)', 'invoicing' ), |
|
| 1333 | - 'TH-58' => __( 'Mae Hong Son (แม่ฮ่องสอน)', 'invoicing' ), |
|
| 1334 | - 'TH-44' => __( 'Maha Sarakham (มหาสารคาม)', 'invoicing' ), |
|
| 1335 | - 'TH-49' => __( 'Mukdahan (มุกดาหาร)', 'invoicing' ), |
|
| 1336 | - 'TH-26' => __( 'Nakhon Nayok (นครนายก)', 'invoicing' ), |
|
| 1337 | - 'TH-73' => __( 'Nakhon Pathom (นครปฐม)', 'invoicing' ), |
|
| 1338 | - 'TH-48' => __( 'Nakhon Phanom (นครพนม)', 'invoicing' ), |
|
| 1339 | - 'TH-30' => __( 'Nakhon Ratchasima (นครราชสีมา)', 'invoicing' ), |
|
| 1340 | - 'TH-60' => __( 'Nakhon Sawan (นครสวรรค์)', 'invoicing' ), |
|
| 1341 | - 'TH-80' => __( 'Nakhon Si Thammarat (นครศรีธรรมราช)', 'invoicing' ), |
|
| 1342 | - 'TH-55' => __( 'Nan (น่าน)', 'invoicing' ), |
|
| 1343 | - 'TH-96' => __( 'Narathiwat (นราธิวาส)', 'invoicing' ), |
|
| 1344 | - 'TH-39' => __( 'Nong Bua Lam Phu (หนองบัวลำภู)', 'invoicing' ), |
|
| 1345 | - 'TH-43' => __( 'Nong Khai (หนองคาย)', 'invoicing' ), |
|
| 1346 | - 'TH-12' => __( 'Nonthaburi (นนทบุรี)', 'invoicing' ), |
|
| 1347 | - 'TH-13' => __( 'Pathum Thani (ปทุมธานี)', 'invoicing' ), |
|
| 1348 | - 'TH-94' => __( 'Pattani (ปัตตานี)', 'invoicing' ), |
|
| 1349 | - 'TH-82' => __( 'Phang Nga (พังงา)', 'invoicing' ), |
|
| 1350 | - 'TH-93' => __( 'Phatthalung (พัทลุง)', 'invoicing' ), |
|
| 1351 | - 'TH-56' => __( 'Phayao (พะเยา)', 'invoicing' ), |
|
| 1352 | - 'TH-67' => __( 'Phetchabun (เพชรบูรณ์)', 'invoicing' ), |
|
| 1353 | - 'TH-76' => __( 'Phetchaburi (เพชรบุรี)', 'invoicing' ), |
|
| 1354 | - 'TH-66' => __( 'Phichit (พิจิตร)', 'invoicing' ), |
|
| 1355 | - 'TH-65' => __( 'Phitsanulok (พิษณุโลก)', 'invoicing' ), |
|
| 1356 | - 'TH-54' => __( 'Phrae (แพร่)', 'invoicing' ), |
|
| 1357 | - 'TH-83' => __( 'Phuket (ภูเก็ต)', 'invoicing' ), |
|
| 1358 | - 'TH-25' => __( 'Prachin Buri (ปราจีนบุรี)', 'invoicing' ), |
|
| 1359 | - 'TH-77' => __( 'Prachuap Khiri Khan (ประจวบคีรีขันธ์)', 'invoicing' ), |
|
| 1360 | - 'TH-85' => __( 'Ranong (ระนอง)', 'invoicing' ), |
|
| 1361 | - 'TH-70' => __( 'Ratchaburi (ราชบุรี)', 'invoicing' ), |
|
| 1362 | - 'TH-21' => __( 'Rayong (ระยอง)', 'invoicing' ), |
|
| 1363 | - 'TH-45' => __( 'Roi Et (ร้อยเอ็ด)', 'invoicing' ), |
|
| 1364 | - 'TH-27' => __( 'Sa Kaeo (สระแก้ว)', 'invoicing' ), |
|
| 1365 | - 'TH-47' => __( 'Sakon Nakhon (สกลนคร)', 'invoicing' ), |
|
| 1366 | - 'TH-11' => __( 'Samut Prakan (สมุทรปราการ)', 'invoicing' ), |
|
| 1367 | - 'TH-74' => __( 'Samut Sakhon (สมุทรสาคร)', 'invoicing' ), |
|
| 1368 | - 'TH-75' => __( 'Samut Songkhram (สมุทรสงคราม)', 'invoicing' ), |
|
| 1369 | - 'TH-19' => __( 'Saraburi (สระบุรี)', 'invoicing' ), |
|
| 1370 | - 'TH-91' => __( 'Satun (สตูล)', 'invoicing' ), |
|
| 1371 | - 'TH-17' => __( 'Sing Buri (สิงห์บุรี)', 'invoicing' ), |
|
| 1372 | - 'TH-33' => __( 'Sisaket (ศรีสะเกษ)', 'invoicing' ), |
|
| 1373 | - 'TH-90' => __( 'Songkhla (สงขลา)', 'invoicing' ), |
|
| 1374 | - 'TH-64' => __( 'Sukhothai (สุโขทัย)', 'invoicing' ), |
|
| 1375 | - 'TH-72' => __( 'Suphan Buri (สุพรรณบุรี)', 'invoicing' ), |
|
| 1376 | - 'TH-84' => __( 'Surat Thani (สุราษฎร์ธานี)', 'invoicing' ), |
|
| 1377 | - 'TH-32' => __( 'Surin (สุรินทร์)', 'invoicing' ), |
|
| 1378 | - 'TH-63' => __( 'Tak (ตาก)', 'invoicing' ), |
|
| 1379 | - 'TH-92' => __( 'Trang (ตรัง)', 'invoicing' ), |
|
| 1380 | - 'TH-23' => __( 'Trat (ตราด)', 'invoicing' ), |
|
| 1381 | - 'TH-34' => __( 'Ubon Ratchathani (อุบลราชธานี)', 'invoicing' ), |
|
| 1382 | - 'TH-41' => __( 'Udon Thani (อุดรธานี)', 'invoicing' ), |
|
| 1383 | - 'TH-61' => __( 'Uthai Thani (อุทัยธานี)', 'invoicing' ), |
|
| 1384 | - 'TH-53' => __( 'Uttaradit (อุตรดิตถ์)', 'invoicing' ), |
|
| 1385 | - 'TH-95' => __( 'Yala (ยะลา)', 'invoicing' ), |
|
| 1386 | - 'TH-35' => __( 'Yasothon (ยโสธร)', 'invoicing' ) |
|
| 1310 | + 'TH-37' => __('Amnat Charoen (อำนาจเจริญ)', 'invoicing'), |
|
| 1311 | + 'TH-15' => __('Ang Thong (อ่างทอง)', 'invoicing'), |
|
| 1312 | + 'TH-14' => __('Ayutthaya (พระนครศรีอยุธยา)', 'invoicing'), |
|
| 1313 | + 'TH-10' => __('Bangkok (กรุงเทพมหานคร)', 'invoicing'), |
|
| 1314 | + 'TH-38' => __('Bueng Kan (บึงกาฬ)', 'invoicing'), |
|
| 1315 | + 'TH-31' => __('Buri Ram (บุรีรัมย์)', 'invoicing'), |
|
| 1316 | + 'TH-24' => __('Chachoengsao (ฉะเชิงเทรา)', 'invoicing'), |
|
| 1317 | + 'TH-18' => __('Chai Nat (ชัยนาท)', 'invoicing'), |
|
| 1318 | + 'TH-36' => __('Chaiyaphum (ชัยภูมิ)', 'invoicing'), |
|
| 1319 | + 'TH-22' => __('Chanthaburi (จันทบุรี)', 'invoicing'), |
|
| 1320 | + 'TH-50' => __('Chiang Mai (เชียงใหม่)', 'invoicing'), |
|
| 1321 | + 'TH-57' => __('Chiang Rai (เชียงราย)', 'invoicing'), |
|
| 1322 | + 'TH-20' => __('Chonburi (ชลบุรี)', 'invoicing'), |
|
| 1323 | + 'TH-86' => __('Chumphon (ชุมพร)', 'invoicing'), |
|
| 1324 | + 'TH-46' => __('Kalasin (กาฬสินธุ์)', 'invoicing'), |
|
| 1325 | + 'TH-62' => __('Kamphaeng Phet (กำแพงเพชร)', 'invoicing'), |
|
| 1326 | + 'TH-71' => __('Kanchanaburi (กาญจนบุรี)', 'invoicing'), |
|
| 1327 | + 'TH-40' => __('Khon Kaen (ขอนแก่น)', 'invoicing'), |
|
| 1328 | + 'TH-81' => __('Krabi (กระบี่)', 'invoicing'), |
|
| 1329 | + 'TH-52' => __('Lampang (ลำปาง)', 'invoicing'), |
|
| 1330 | + 'TH-51' => __('Lamphun (ลำพูน)', 'invoicing'), |
|
| 1331 | + 'TH-42' => __('Loei (เลย)', 'invoicing'), |
|
| 1332 | + 'TH-16' => __('Lopburi (ลพบุรี)', 'invoicing'), |
|
| 1333 | + 'TH-58' => __('Mae Hong Son (แม่ฮ่องสอน)', 'invoicing'), |
|
| 1334 | + 'TH-44' => __('Maha Sarakham (มหาสารคาม)', 'invoicing'), |
|
| 1335 | + 'TH-49' => __('Mukdahan (มุกดาหาร)', 'invoicing'), |
|
| 1336 | + 'TH-26' => __('Nakhon Nayok (นครนายก)', 'invoicing'), |
|
| 1337 | + 'TH-73' => __('Nakhon Pathom (นครปฐม)', 'invoicing'), |
|
| 1338 | + 'TH-48' => __('Nakhon Phanom (นครพนม)', 'invoicing'), |
|
| 1339 | + 'TH-30' => __('Nakhon Ratchasima (นครราชสีมา)', 'invoicing'), |
|
| 1340 | + 'TH-60' => __('Nakhon Sawan (นครสวรรค์)', 'invoicing'), |
|
| 1341 | + 'TH-80' => __('Nakhon Si Thammarat (นครศรีธรรมราช)', 'invoicing'), |
|
| 1342 | + 'TH-55' => __('Nan (น่าน)', 'invoicing'), |
|
| 1343 | + 'TH-96' => __('Narathiwat (นราธิวาส)', 'invoicing'), |
|
| 1344 | + 'TH-39' => __('Nong Bua Lam Phu (หนองบัวลำภู)', 'invoicing'), |
|
| 1345 | + 'TH-43' => __('Nong Khai (หนองคาย)', 'invoicing'), |
|
| 1346 | + 'TH-12' => __('Nonthaburi (นนทบุรี)', 'invoicing'), |
|
| 1347 | + 'TH-13' => __('Pathum Thani (ปทุมธานี)', 'invoicing'), |
|
| 1348 | + 'TH-94' => __('Pattani (ปัตตานี)', 'invoicing'), |
|
| 1349 | + 'TH-82' => __('Phang Nga (พังงา)', 'invoicing'), |
|
| 1350 | + 'TH-93' => __('Phatthalung (พัทลุง)', 'invoicing'), |
|
| 1351 | + 'TH-56' => __('Phayao (พะเยา)', 'invoicing'), |
|
| 1352 | + 'TH-67' => __('Phetchabun (เพชรบูรณ์)', 'invoicing'), |
|
| 1353 | + 'TH-76' => __('Phetchaburi (เพชรบุรี)', 'invoicing'), |
|
| 1354 | + 'TH-66' => __('Phichit (พิจิตร)', 'invoicing'), |
|
| 1355 | + 'TH-65' => __('Phitsanulok (พิษณุโลก)', 'invoicing'), |
|
| 1356 | + 'TH-54' => __('Phrae (แพร่)', 'invoicing'), |
|
| 1357 | + 'TH-83' => __('Phuket (ภูเก็ต)', 'invoicing'), |
|
| 1358 | + 'TH-25' => __('Prachin Buri (ปราจีนบุรี)', 'invoicing'), |
|
| 1359 | + 'TH-77' => __('Prachuap Khiri Khan (ประจวบคีรีขันธ์)', 'invoicing'), |
|
| 1360 | + 'TH-85' => __('Ranong (ระนอง)', 'invoicing'), |
|
| 1361 | + 'TH-70' => __('Ratchaburi (ราชบุรี)', 'invoicing'), |
|
| 1362 | + 'TH-21' => __('Rayong (ระยอง)', 'invoicing'), |
|
| 1363 | + 'TH-45' => __('Roi Et (ร้อยเอ็ด)', 'invoicing'), |
|
| 1364 | + 'TH-27' => __('Sa Kaeo (สระแก้ว)', 'invoicing'), |
|
| 1365 | + 'TH-47' => __('Sakon Nakhon (สกลนคร)', 'invoicing'), |
|
| 1366 | + 'TH-11' => __('Samut Prakan (สมุทรปราการ)', 'invoicing'), |
|
| 1367 | + 'TH-74' => __('Samut Sakhon (สมุทรสาคร)', 'invoicing'), |
|
| 1368 | + 'TH-75' => __('Samut Songkhram (สมุทรสงคราม)', 'invoicing'), |
|
| 1369 | + 'TH-19' => __('Saraburi (สระบุรี)', 'invoicing'), |
|
| 1370 | + 'TH-91' => __('Satun (สตูล)', 'invoicing'), |
|
| 1371 | + 'TH-17' => __('Sing Buri (สิงห์บุรี)', 'invoicing'), |
|
| 1372 | + 'TH-33' => __('Sisaket (ศรีสะเกษ)', 'invoicing'), |
|
| 1373 | + 'TH-90' => __('Songkhla (สงขลา)', 'invoicing'), |
|
| 1374 | + 'TH-64' => __('Sukhothai (สุโขทัย)', 'invoicing'), |
|
| 1375 | + 'TH-72' => __('Suphan Buri (สุพรรณบุรี)', 'invoicing'), |
|
| 1376 | + 'TH-84' => __('Surat Thani (สุราษฎร์ธานี)', 'invoicing'), |
|
| 1377 | + 'TH-32' => __('Surin (สุรินทร์)', 'invoicing'), |
|
| 1378 | + 'TH-63' => __('Tak (ตาก)', 'invoicing'), |
|
| 1379 | + 'TH-92' => __('Trang (ตรัง)', 'invoicing'), |
|
| 1380 | + 'TH-23' => __('Trat (ตราด)', 'invoicing'), |
|
| 1381 | + 'TH-34' => __('Ubon Ratchathani (อุบลราชธานี)', 'invoicing'), |
|
| 1382 | + 'TH-41' => __('Udon Thani (อุดรธานี)', 'invoicing'), |
|
| 1383 | + 'TH-61' => __('Uthai Thani (อุทัยธานี)', 'invoicing'), |
|
| 1384 | + 'TH-53' => __('Uttaradit (อุตรดิตถ์)', 'invoicing'), |
|
| 1385 | + 'TH-95' => __('Yala (ยะลา)', 'invoicing'), |
|
| 1386 | + 'TH-35' => __('Yasothon (ยโสธร)', 'invoicing') |
|
| 1387 | 1387 | ); |
| 1388 | 1388 | |
| 1389 | - return apply_filters( 'wpinv_thailand_states', $states ); |
|
| 1389 | + return apply_filters('wpinv_thailand_states', $states); |
|
| 1390 | 1390 | } |
| 1391 | 1391 | |
| 1392 | 1392 | function wpinv_get_turkey_states_list() { |
| 1393 | 1393 | $states = array( |
| 1394 | - 'TR01' => __( 'Adana', 'invoicing' ), |
|
| 1395 | - 'TR02' => __( 'Adıyaman', 'invoicing' ), |
|
| 1396 | - 'TR03' => __( 'Afyon', 'invoicing' ), |
|
| 1397 | - 'TR04' => __( 'Ağrı', 'invoicing' ), |
|
| 1398 | - 'TR05' => __( 'Amasya', 'invoicing' ), |
|
| 1399 | - 'TR06' => __( 'Ankara', 'invoicing' ), |
|
| 1400 | - 'TR07' => __( 'Antalya', 'invoicing' ), |
|
| 1401 | - 'TR08' => __( 'Artvin', 'invoicing' ), |
|
| 1402 | - 'TR09' => __( 'Aydın', 'invoicing' ), |
|
| 1403 | - 'TR10' => __( 'Balıkesir', 'invoicing' ), |
|
| 1404 | - 'TR11' => __( 'Bilecik', 'invoicing' ), |
|
| 1405 | - 'TR12' => __( 'Bingöl', 'invoicing' ), |
|
| 1406 | - 'TR13' => __( 'Bitlis', 'invoicing' ), |
|
| 1407 | - 'TR14' => __( 'Bolu', 'invoicing' ), |
|
| 1408 | - 'TR15' => __( 'Burdur', 'invoicing' ), |
|
| 1409 | - 'TR16' => __( 'Bursa', 'invoicing' ), |
|
| 1410 | - 'TR17' => __( 'Çanakkale', 'invoicing' ), |
|
| 1411 | - 'TR18' => __( 'Çankıkesir', 'invoicing' ), |
|
| 1412 | - 'TR19' => __( 'Çorum', 'invoicing' ), |
|
| 1413 | - 'TR20' => __( 'Denizli', 'invoicing' ), |
|
| 1414 | - 'TR21' => __( 'Diyarbakır', 'invoicing' ), |
|
| 1415 | - 'TR22' => __( 'Edirne', 'invoicing' ), |
|
| 1416 | - 'TR23' => __( 'Elazığ', 'invoicing' ), |
|
| 1417 | - 'TR24' => __( 'Erzincan', 'invoicing' ), |
|
| 1418 | - 'TR25' => __( 'Erzurum', 'invoicing' ), |
|
| 1419 | - 'TR26' => __( 'Eskişehir', 'invoicing' ), |
|
| 1420 | - 'TR27' => __( 'Gaziantep', 'invoicing' ), |
|
| 1421 | - 'TR28' => __( 'Giresun', 'invoicing' ), |
|
| 1422 | - 'TR29' => __( 'Gümüşhane', 'invoicing' ), |
|
| 1423 | - 'TR30' => __( 'Hakkari', 'invoicing' ), |
|
| 1424 | - 'TR31' => __( 'Hatay', 'invoicing' ), |
|
| 1425 | - 'TR32' => __( 'Isparta', 'invoicing' ), |
|
| 1426 | - 'TR33' => __( 'İçel', 'invoicing' ), |
|
| 1427 | - 'TR34' => __( 'İstanbul', 'invoicing' ), |
|
| 1428 | - 'TR35' => __( 'İzmir', 'invoicing' ), |
|
| 1429 | - 'TR36' => __( 'Kars', 'invoicing' ), |
|
| 1430 | - 'TR37' => __( 'Kastamonu', 'invoicing' ), |
|
| 1431 | - 'TR38' => __( 'Kayseri', 'invoicing' ), |
|
| 1432 | - 'TR39' => __( 'Kırklareli', 'invoicing' ), |
|
| 1433 | - 'TR40' => __( 'Kırşehir', 'invoicing' ), |
|
| 1434 | - 'TR41' => __( 'Kocaeli', 'invoicing' ), |
|
| 1435 | - 'TR42' => __( 'Konya', 'invoicing' ), |
|
| 1436 | - 'TR43' => __( 'Kütahya', 'invoicing' ), |
|
| 1437 | - 'TR44' => __( 'Malatya', 'invoicing' ), |
|
| 1438 | - 'TR45' => __( 'Manisa', 'invoicing' ), |
|
| 1439 | - 'TR46' => __( 'Kahramanmaraş', 'invoicing' ), |
|
| 1440 | - 'TR47' => __( 'Mardin', 'invoicing' ), |
|
| 1441 | - 'TR48' => __( 'Muğla', 'invoicing' ), |
|
| 1442 | - 'TR49' => __( 'Muş', 'invoicing' ), |
|
| 1443 | - 'TR50' => __( 'Nevşehir', 'invoicing' ), |
|
| 1444 | - 'TR51' => __( 'Niğde', 'invoicing' ), |
|
| 1445 | - 'TR52' => __( 'Ordu', 'invoicing' ), |
|
| 1446 | - 'TR53' => __( 'Rize', 'invoicing' ), |
|
| 1447 | - 'TR54' => __( 'Sakarya', 'invoicing' ), |
|
| 1448 | - 'TR55' => __( 'Samsun', 'invoicing' ), |
|
| 1449 | - 'TR56' => __( 'Siirt', 'invoicing' ), |
|
| 1450 | - 'TR57' => __( 'Sinop', 'invoicing' ), |
|
| 1451 | - 'TR58' => __( 'Sivas', 'invoicing' ), |
|
| 1452 | - 'TR59' => __( 'Tekirdağ', 'invoicing' ), |
|
| 1453 | - 'TR60' => __( 'Tokat', 'invoicing' ), |
|
| 1454 | - 'TR61' => __( 'Trabzon', 'invoicing' ), |
|
| 1455 | - 'TR62' => __( 'Tunceli', 'invoicing' ), |
|
| 1456 | - 'TR63' => __( 'Şanlıurfa', 'invoicing' ), |
|
| 1457 | - 'TR64' => __( 'Uşak', 'invoicing' ), |
|
| 1458 | - 'TR65' => __( 'Van', 'invoicing' ), |
|
| 1459 | - 'TR66' => __( 'Yozgat', 'invoicing' ), |
|
| 1460 | - 'TR67' => __( 'Zonguldak', 'invoicing' ), |
|
| 1461 | - 'TR68' => __( 'Aksaray', 'invoicing' ), |
|
| 1462 | - 'TR69' => __( 'Bayburt', 'invoicing' ), |
|
| 1463 | - 'TR70' => __( 'Karaman', 'invoicing' ), |
|
| 1464 | - 'TR71' => __( 'Kırıkkale', 'invoicing' ), |
|
| 1465 | - 'TR72' => __( 'Batman', 'invoicing' ), |
|
| 1466 | - 'TR73' => __( 'Şırnak', 'invoicing' ), |
|
| 1467 | - 'TR74' => __( 'Bartın', 'invoicing' ), |
|
| 1468 | - 'TR75' => __( 'Ardahan', 'invoicing' ), |
|
| 1469 | - 'TR76' => __( 'Iğdır', 'invoicing' ), |
|
| 1470 | - 'TR77' => __( 'Yalova', 'invoicing' ), |
|
| 1471 | - 'TR78' => __( 'Karabük', 'invoicing' ), |
|
| 1472 | - 'TR79' => __( 'Kilis', 'invoicing' ), |
|
| 1473 | - 'TR80' => __( 'Osmaniye', 'invoicing' ), |
|
| 1474 | - 'TR81' => __( 'Düzce', 'invoicing' ) |
|
| 1394 | + 'TR01' => __('Adana', 'invoicing'), |
|
| 1395 | + 'TR02' => __('Adıyaman', 'invoicing'), |
|
| 1396 | + 'TR03' => __('Afyon', 'invoicing'), |
|
| 1397 | + 'TR04' => __('Ağrı', 'invoicing'), |
|
| 1398 | + 'TR05' => __('Amasya', 'invoicing'), |
|
| 1399 | + 'TR06' => __('Ankara', 'invoicing'), |
|
| 1400 | + 'TR07' => __('Antalya', 'invoicing'), |
|
| 1401 | + 'TR08' => __('Artvin', 'invoicing'), |
|
| 1402 | + 'TR09' => __('Aydın', 'invoicing'), |
|
| 1403 | + 'TR10' => __('Balıkesir', 'invoicing'), |
|
| 1404 | + 'TR11' => __('Bilecik', 'invoicing'), |
|
| 1405 | + 'TR12' => __('Bingöl', 'invoicing'), |
|
| 1406 | + 'TR13' => __('Bitlis', 'invoicing'), |
|
| 1407 | + 'TR14' => __('Bolu', 'invoicing'), |
|
| 1408 | + 'TR15' => __('Burdur', 'invoicing'), |
|
| 1409 | + 'TR16' => __('Bursa', 'invoicing'), |
|
| 1410 | + 'TR17' => __('Çanakkale', 'invoicing'), |
|
| 1411 | + 'TR18' => __('Çankıkesir', 'invoicing'), |
|
| 1412 | + 'TR19' => __('Çorum', 'invoicing'), |
|
| 1413 | + 'TR20' => __('Denizli', 'invoicing'), |
|
| 1414 | + 'TR21' => __('Diyarbakır', 'invoicing'), |
|
| 1415 | + 'TR22' => __('Edirne', 'invoicing'), |
|
| 1416 | + 'TR23' => __('Elazığ', 'invoicing'), |
|
| 1417 | + 'TR24' => __('Erzincan', 'invoicing'), |
|
| 1418 | + 'TR25' => __('Erzurum', 'invoicing'), |
|
| 1419 | + 'TR26' => __('Eskişehir', 'invoicing'), |
|
| 1420 | + 'TR27' => __('Gaziantep', 'invoicing'), |
|
| 1421 | + 'TR28' => __('Giresun', 'invoicing'), |
|
| 1422 | + 'TR29' => __('Gümüşhane', 'invoicing'), |
|
| 1423 | + 'TR30' => __('Hakkari', 'invoicing'), |
|
| 1424 | + 'TR31' => __('Hatay', 'invoicing'), |
|
| 1425 | + 'TR32' => __('Isparta', 'invoicing'), |
|
| 1426 | + 'TR33' => __('İçel', 'invoicing'), |
|
| 1427 | + 'TR34' => __('İstanbul', 'invoicing'), |
|
| 1428 | + 'TR35' => __('İzmir', 'invoicing'), |
|
| 1429 | + 'TR36' => __('Kars', 'invoicing'), |
|
| 1430 | + 'TR37' => __('Kastamonu', 'invoicing'), |
|
| 1431 | + 'TR38' => __('Kayseri', 'invoicing'), |
|
| 1432 | + 'TR39' => __('Kırklareli', 'invoicing'), |
|
| 1433 | + 'TR40' => __('Kırşehir', 'invoicing'), |
|
| 1434 | + 'TR41' => __('Kocaeli', 'invoicing'), |
|
| 1435 | + 'TR42' => __('Konya', 'invoicing'), |
|
| 1436 | + 'TR43' => __('Kütahya', 'invoicing'), |
|
| 1437 | + 'TR44' => __('Malatya', 'invoicing'), |
|
| 1438 | + 'TR45' => __('Manisa', 'invoicing'), |
|
| 1439 | + 'TR46' => __('Kahramanmaraş', 'invoicing'), |
|
| 1440 | + 'TR47' => __('Mardin', 'invoicing'), |
|
| 1441 | + 'TR48' => __('Muğla', 'invoicing'), |
|
| 1442 | + 'TR49' => __('Muş', 'invoicing'), |
|
| 1443 | + 'TR50' => __('Nevşehir', 'invoicing'), |
|
| 1444 | + 'TR51' => __('Niğde', 'invoicing'), |
|
| 1445 | + 'TR52' => __('Ordu', 'invoicing'), |
|
| 1446 | + 'TR53' => __('Rize', 'invoicing'), |
|
| 1447 | + 'TR54' => __('Sakarya', 'invoicing'), |
|
| 1448 | + 'TR55' => __('Samsun', 'invoicing'), |
|
| 1449 | + 'TR56' => __('Siirt', 'invoicing'), |
|
| 1450 | + 'TR57' => __('Sinop', 'invoicing'), |
|
| 1451 | + 'TR58' => __('Sivas', 'invoicing'), |
|
| 1452 | + 'TR59' => __('Tekirdağ', 'invoicing'), |
|
| 1453 | + 'TR60' => __('Tokat', 'invoicing'), |
|
| 1454 | + 'TR61' => __('Trabzon', 'invoicing'), |
|
| 1455 | + 'TR62' => __('Tunceli', 'invoicing'), |
|
| 1456 | + 'TR63' => __('Şanlıurfa', 'invoicing'), |
|
| 1457 | + 'TR64' => __('Uşak', 'invoicing'), |
|
| 1458 | + 'TR65' => __('Van', 'invoicing'), |
|
| 1459 | + 'TR66' => __('Yozgat', 'invoicing'), |
|
| 1460 | + 'TR67' => __('Zonguldak', 'invoicing'), |
|
| 1461 | + 'TR68' => __('Aksaray', 'invoicing'), |
|
| 1462 | + 'TR69' => __('Bayburt', 'invoicing'), |
|
| 1463 | + 'TR70' => __('Karaman', 'invoicing'), |
|
| 1464 | + 'TR71' => __('Kırıkkale', 'invoicing'), |
|
| 1465 | + 'TR72' => __('Batman', 'invoicing'), |
|
| 1466 | + 'TR73' => __('Şırnak', 'invoicing'), |
|
| 1467 | + 'TR74' => __('Bartın', 'invoicing'), |
|
| 1468 | + 'TR75' => __('Ardahan', 'invoicing'), |
|
| 1469 | + 'TR76' => __('Iğdır', 'invoicing'), |
|
| 1470 | + 'TR77' => __('Yalova', 'invoicing'), |
|
| 1471 | + 'TR78' => __('Karabük', 'invoicing'), |
|
| 1472 | + 'TR79' => __('Kilis', 'invoicing'), |
|
| 1473 | + 'TR80' => __('Osmaniye', 'invoicing'), |
|
| 1474 | + 'TR81' => __('Düzce', 'invoicing') |
|
| 1475 | 1475 | ); |
| 1476 | 1476 | |
| 1477 | - return apply_filters( 'wpinv_turkey_states', $states ); |
|
| 1477 | + return apply_filters('wpinv_turkey_states', $states); |
|
| 1478 | 1478 | } |
| 1479 | 1479 | |
| 1480 | 1480 | function wpinv_get_spain_states_list() { |
| 1481 | 1481 | $states = array( |
| 1482 | - 'C' => __( 'A Coruña', 'invoicing' ), |
|
| 1483 | - 'VI' => __( 'Araba', 'invoicing' ), |
|
| 1484 | - 'AB' => __( 'Albacete', 'invoicing' ), |
|
| 1485 | - 'A' => __( 'Alicante', 'invoicing' ), |
|
| 1486 | - 'AL' => __( 'Almería', 'invoicing' ), |
|
| 1487 | - 'O' => __( 'Asturias', 'invoicing' ), |
|
| 1488 | - 'AV' => __( 'Ávila', 'invoicing' ), |
|
| 1489 | - 'BA' => __( 'Badajoz', 'invoicing' ), |
|
| 1490 | - 'PM' => __( 'Baleares', 'invoicing' ), |
|
| 1491 | - 'B' => __( 'Barcelona', 'invoicing' ), |
|
| 1492 | - 'BU' => __( 'Burgos', 'invoicing' ), |
|
| 1493 | - 'CC' => __( 'Cáceres', 'invoicing' ), |
|
| 1494 | - 'CA' => __( 'Cádiz', 'invoicing' ), |
|
| 1495 | - 'S' => __( 'Cantabria', 'invoicing' ), |
|
| 1496 | - 'CS' => __( 'Castellón', 'invoicing' ), |
|
| 1497 | - 'CE' => __( 'Ceuta', 'invoicing' ), |
|
| 1498 | - 'CR' => __( 'Ciudad Real', 'invoicing' ), |
|
| 1499 | - 'CO' => __( 'Córdoba', 'invoicing' ), |
|
| 1500 | - 'CU' => __( 'Cuenca', 'invoicing' ), |
|
| 1501 | - 'GI' => __( 'Girona', 'invoicing' ), |
|
| 1502 | - 'GR' => __( 'Granada', 'invoicing' ), |
|
| 1503 | - 'GU' => __( 'Guadalajara', 'invoicing' ), |
|
| 1504 | - 'SS' => __( 'Gipuzkoa', 'invoicing' ), |
|
| 1505 | - 'H' => __( 'Huelva', 'invoicing' ), |
|
| 1506 | - 'HU' => __( 'Huesca', 'invoicing' ), |
|
| 1507 | - 'J' => __( 'Jaén', 'invoicing' ), |
|
| 1508 | - 'LO' => __( 'La Rioja', 'invoicing' ), |
|
| 1509 | - 'GC' => __( 'Las Palmas', 'invoicing' ), |
|
| 1510 | - 'LE' => __( 'León', 'invoicing' ), |
|
| 1511 | - 'L' => __( 'Lleida', 'invoicing' ), |
|
| 1512 | - 'LU' => __( 'Lugo', 'invoicing' ), |
|
| 1513 | - 'M' => __( 'Madrid', 'invoicing' ), |
|
| 1514 | - 'MA' => __( 'Málaga', 'invoicing' ), |
|
| 1515 | - 'ML' => __( 'Melilla', 'invoicing' ), |
|
| 1516 | - 'MU' => __( 'Murcia', 'invoicing' ), |
|
| 1517 | - 'NA' => __( 'Navarra', 'invoicing' ), |
|
| 1518 | - 'OR' => __( 'Ourense', 'invoicing' ), |
|
| 1519 | - 'P' => __( 'Palencia', 'invoicing' ), |
|
| 1520 | - 'PO' => __( 'Pontevedra', 'invoicing' ), |
|
| 1521 | - 'SA' => __( 'Salamanca', 'invoicing' ), |
|
| 1522 | - 'TF' => __( 'Santa Cruz de Tenerife', 'invoicing' ), |
|
| 1523 | - 'SG' => __( 'Segovia', 'invoicing' ), |
|
| 1524 | - 'SE' => __( 'Sevilla', 'invoicing' ), |
|
| 1525 | - 'SO' => __( 'Soria', 'invoicing' ), |
|
| 1526 | - 'T' => __( 'Tarragona', 'invoicing' ), |
|
| 1527 | - 'TE' => __( 'Teruel', 'invoicing' ), |
|
| 1528 | - 'TO' => __( 'Toledo', 'invoicing' ), |
|
| 1529 | - 'V' => __( 'Valencia', 'invoicing' ), |
|
| 1530 | - 'VA' => __( 'Valladolid', 'invoicing' ), |
|
| 1531 | - 'BI' => __( 'Bizkaia', 'invoicing' ), |
|
| 1532 | - 'ZA' => __( 'Zamora', 'invoicing' ), |
|
| 1533 | - 'Z' => __( 'Zaragoza', 'invoicing' ) |
|
| 1482 | + 'C' => __('A Coruña', 'invoicing'), |
|
| 1483 | + 'VI' => __('Araba', 'invoicing'), |
|
| 1484 | + 'AB' => __('Albacete', 'invoicing'), |
|
| 1485 | + 'A' => __('Alicante', 'invoicing'), |
|
| 1486 | + 'AL' => __('Almería', 'invoicing'), |
|
| 1487 | + 'O' => __('Asturias', 'invoicing'), |
|
| 1488 | + 'AV' => __('Ávila', 'invoicing'), |
|
| 1489 | + 'BA' => __('Badajoz', 'invoicing'), |
|
| 1490 | + 'PM' => __('Baleares', 'invoicing'), |
|
| 1491 | + 'B' => __('Barcelona', 'invoicing'), |
|
| 1492 | + 'BU' => __('Burgos', 'invoicing'), |
|
| 1493 | + 'CC' => __('Cáceres', 'invoicing'), |
|
| 1494 | + 'CA' => __('Cádiz', 'invoicing'), |
|
| 1495 | + 'S' => __('Cantabria', 'invoicing'), |
|
| 1496 | + 'CS' => __('Castellón', 'invoicing'), |
|
| 1497 | + 'CE' => __('Ceuta', 'invoicing'), |
|
| 1498 | + 'CR' => __('Ciudad Real', 'invoicing'), |
|
| 1499 | + 'CO' => __('Córdoba', 'invoicing'), |
|
| 1500 | + 'CU' => __('Cuenca', 'invoicing'), |
|
| 1501 | + 'GI' => __('Girona', 'invoicing'), |
|
| 1502 | + 'GR' => __('Granada', 'invoicing'), |
|
| 1503 | + 'GU' => __('Guadalajara', 'invoicing'), |
|
| 1504 | + 'SS' => __('Gipuzkoa', 'invoicing'), |
|
| 1505 | + 'H' => __('Huelva', 'invoicing'), |
|
| 1506 | + 'HU' => __('Huesca', 'invoicing'), |
|
| 1507 | + 'J' => __('Jaén', 'invoicing'), |
|
| 1508 | + 'LO' => __('La Rioja', 'invoicing'), |
|
| 1509 | + 'GC' => __('Las Palmas', 'invoicing'), |
|
| 1510 | + 'LE' => __('León', 'invoicing'), |
|
| 1511 | + 'L' => __('Lleida', 'invoicing'), |
|
| 1512 | + 'LU' => __('Lugo', 'invoicing'), |
|
| 1513 | + 'M' => __('Madrid', 'invoicing'), |
|
| 1514 | + 'MA' => __('Málaga', 'invoicing'), |
|
| 1515 | + 'ML' => __('Melilla', 'invoicing'), |
|
| 1516 | + 'MU' => __('Murcia', 'invoicing'), |
|
| 1517 | + 'NA' => __('Navarra', 'invoicing'), |
|
| 1518 | + 'OR' => __('Ourense', 'invoicing'), |
|
| 1519 | + 'P' => __('Palencia', 'invoicing'), |
|
| 1520 | + 'PO' => __('Pontevedra', 'invoicing'), |
|
| 1521 | + 'SA' => __('Salamanca', 'invoicing'), |
|
| 1522 | + 'TF' => __('Santa Cruz de Tenerife', 'invoicing'), |
|
| 1523 | + 'SG' => __('Segovia', 'invoicing'), |
|
| 1524 | + 'SE' => __('Sevilla', 'invoicing'), |
|
| 1525 | + 'SO' => __('Soria', 'invoicing'), |
|
| 1526 | + 'T' => __('Tarragona', 'invoicing'), |
|
| 1527 | + 'TE' => __('Teruel', 'invoicing'), |
|
| 1528 | + 'TO' => __('Toledo', 'invoicing'), |
|
| 1529 | + 'V' => __('Valencia', 'invoicing'), |
|
| 1530 | + 'VA' => __('Valladolid', 'invoicing'), |
|
| 1531 | + 'BI' => __('Bizkaia', 'invoicing'), |
|
| 1532 | + 'ZA' => __('Zamora', 'invoicing'), |
|
| 1533 | + 'Z' => __('Zaragoza', 'invoicing') |
|
| 1534 | 1534 | ); |
| 1535 | 1535 | |
| 1536 | - return apply_filters( 'wpinv_spain_states', $states ); |
|
| 1536 | + return apply_filters('wpinv_spain_states', $states); |
|
| 1537 | 1537 | } |
| 1538 | 1538 | |
| 1539 | 1539 | function wpinv_get_states_field() { |
| 1540 | - if( empty( $_POST['country'] ) ) { |
|
| 1540 | + if (empty($_POST['country'])) { |
|
| 1541 | 1541 | $_POST['country'] = wpinv_get_default_country(); |
| 1542 | 1542 | } |
| 1543 | - $states = wpinv_get_country_states( sanitize_text_field( $_POST['country'] ) ); |
|
| 1543 | + $states = wpinv_get_country_states(sanitize_text_field($_POST['country'])); |
|
| 1544 | 1544 | |
| 1545 | - if( !empty( $states ) ) { |
|
| 1546 | - $sanitized_field_name = sanitize_text_field( $_POST['field_name'] ); |
|
| 1545 | + if (!empty($states)) { |
|
| 1546 | + $sanitized_field_name = sanitize_text_field($_POST['field_name']); |
|
| 1547 | 1547 | |
| 1548 | 1548 | $args = array( |
| 1549 | 1549 | 'name' => $sanitized_field_name, |
| 1550 | 1550 | 'id' => $sanitized_field_name, |
| 1551 | 1551 | 'class' => $sanitized_field_name . ' wpinv-select', |
| 1552 | - 'options' => array_merge( array( '' => '' ), $states ), |
|
| 1552 | + 'options' => array_merge(array('' => ''), $states), |
|
| 1553 | 1553 | 'show_option_all' => false, |
| 1554 | 1554 | 'show_option_none' => false |
| 1555 | 1555 | ); |
| 1556 | 1556 | |
| 1557 | - $response = wpinv_html_select( $args ); |
|
| 1557 | + $response = wpinv_html_select($args); |
|
| 1558 | 1558 | |
| 1559 | 1559 | } else { |
| 1560 | 1560 | $response = 'nostates'; |
@@ -1563,8 +1563,8 @@ discard block |
||
| 1563 | 1563 | return $response; |
| 1564 | 1564 | } |
| 1565 | 1565 | |
| 1566 | -function wpinv_default_billing_country( $country = '', $user_id = 0 ) { |
|
| 1567 | - $country = !empty( $country ) ? $country : wpinv_get_default_country(); |
|
| 1566 | +function wpinv_default_billing_country($country = '', $user_id = 0) { |
|
| 1567 | + $country = !empty($country) ? $country : wpinv_get_default_country(); |
|
| 1568 | 1568 | |
| 1569 | - return apply_filters( 'wpinv_default_billing_country', $country, $user_id ); |
|
| 1569 | + return apply_filters('wpinv_default_billing_country', $country, $user_id); |
|
| 1570 | 1570 | } |
| 1571 | 1571 | \ No newline at end of file |
@@ -95,20 +95,24 @@ |
||
| 95 | 95 | } |
| 96 | 96 | |
| 97 | 97 | if ( !empty( $user_info ) ) { |
| 98 | - if( empty( $address['first_name'] ) ) |
|
| 99 | - $address['first_name'] = $user_info->first_name; |
|
| 98 | + if( empty( $address['first_name'] ) ) { |
|
| 99 | + $address['first_name'] = $user_info->first_name; |
|
| 100 | + } |
|
| 100 | 101 | |
| 101 | - if( empty( $address['last_name'] ) ) |
|
| 102 | - $address['last_name'] = $user_info->last_name; |
|
| 102 | + if( empty( $address['last_name'] ) ) { |
|
| 103 | + $address['last_name'] = $user_info->last_name; |
|
| 104 | + } |
|
| 103 | 105 | } |
| 104 | 106 | |
| 105 | 107 | $address['name'] = trim( trim( $address['first_name'] . ' ' . $address['last_name'] ), "," ); |
| 106 | 108 | |
| 107 | - if( empty( $address['state'] ) && $with_default ) |
|
| 108 | - $address['state'] = wpinv_get_default_state(); |
|
| 109 | + if( empty( $address['state'] ) && $with_default ) { |
|
| 110 | + $address['state'] = wpinv_get_default_state(); |
|
| 111 | + } |
|
| 109 | 112 | |
| 110 | - if( empty( $address['country'] ) && $with_default ) |
|
| 111 | - $address['country'] = wpinv_get_default_country(); |
|
| 113 | + if( empty( $address['country'] ) && $with_default ) { |
|
| 114 | + $address['country'] = wpinv_get_default_country(); |
|
| 115 | + } |
|
| 112 | 116 | |
| 113 | 117 | |
| 114 | 118 | return $address; |
@@ -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_header', $email_heading, $invoice, $email_type, $sent_to_admin ); |
| 7 | 8 | |
@@ -1,18 +1,18 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | // don't load directly |
| 3 | -if ( !defined('ABSPATH') ) |
|
| 3 | +if (!defined('ABSPATH')) |
|
| 4 | 4 | die('-1'); |
| 5 | 5 | |
| 6 | -do_action( 'wpinv_email_header', $email_heading, $invoice, $email_type, $sent_to_admin ); |
|
| 6 | +do_action('wpinv_email_header', $email_heading, $invoice, $email_type, $sent_to_admin); |
|
| 7 | 7 | |
| 8 | -do_action( 'wpinv_email_before_note_details', $invoice, $email_type, $sent_to_admin, $customer_note ); |
|
| 8 | +do_action('wpinv_email_before_note_details', $invoice, $email_type, $sent_to_admin, $customer_note); |
|
| 9 | 9 | |
| 10 | -do_action( 'wpinv_email_invoice_details', $invoice, $email_type, $sent_to_admin ); |
|
| 10 | +do_action('wpinv_email_invoice_details', $invoice, $email_type, $sent_to_admin); |
|
| 11 | 11 | |
| 12 | -do_action( 'wpinv_email_invoice_items', $invoice, $email_type, $sent_to_admin ); |
|
| 12 | +do_action('wpinv_email_invoice_items', $invoice, $email_type, $sent_to_admin); |
|
| 13 | 13 | |
| 14 | -do_action( 'wpinv_email_billing_details', $invoice, $email_type, $sent_to_admin ); |
|
| 14 | +do_action('wpinv_email_billing_details', $invoice, $email_type, $sent_to_admin); |
|
| 15 | 15 | |
| 16 | -do_action( 'wpinv_email_after_note_details', $invoice, $email_type, $sent_to_admin, $customer_note ); |
|
| 16 | +do_action('wpinv_email_after_note_details', $invoice, $email_type, $sent_to_admin, $customer_note); |
|
| 17 | 17 | |
| 18 | -do_action( 'wpinv_email_footer', $invoice, $email_type, $sent_to_admin ); |
|
| 19 | 18 | \ No newline at end of file |
| 19 | +do_action('wpinv_email_footer', $invoice, $email_type, $sent_to_admin); |
|
| 20 | 20 | \ No newline at end of file |
@@ -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_header', $email_heading, $invoice, $email_type, $sent_to_admin ); |
| 7 | 8 | ?> |
@@ -1,18 +1,18 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | // don't load directly |
| 3 | -if ( !defined('ABSPATH') ) |
|
| 3 | +if (!defined('ABSPATH')) |
|
| 4 | 4 | die('-1'); |
| 5 | 5 | |
| 6 | -do_action( 'wpinv_email_header', $email_heading, $invoice, $email_type, $sent_to_admin ); |
|
| 6 | +do_action('wpinv_email_header', $email_heading, $invoice, $email_type, $sent_to_admin); |
|
| 7 | 7 | ?> |
| 8 | 8 | |
| 9 | -<p><?php printf( __( 'You have received payment from %s. The invoice is as follows:', 'invoicing' ), $invoice->get_user_full_name() ); ?></p> |
|
| 9 | +<p><?php printf(__('You have received payment from %s. The invoice is as follows:', 'invoicing'), $invoice->get_user_full_name()); ?></p> |
|
| 10 | 10 | |
| 11 | 11 | <?php |
| 12 | -do_action( 'wpinv_email_invoice_details', $invoice, $email_type, $sent_to_admin ); |
|
| 12 | +do_action('wpinv_email_invoice_details', $invoice, $email_type, $sent_to_admin); |
|
| 13 | 13 | |
| 14 | -do_action( 'wpinv_email_invoice_items', $invoice, $email_type, $sent_to_admin ); |
|
| 14 | +do_action('wpinv_email_invoice_items', $invoice, $email_type, $sent_to_admin); |
|
| 15 | 15 | |
| 16 | -do_action( 'wpinv_email_billing_details', $invoice, $email_type, $sent_to_admin ); |
|
| 16 | +do_action('wpinv_email_billing_details', $invoice, $email_type, $sent_to_admin); |
|
| 17 | 17 | |
| 18 | -do_action( 'wpinv_email_footer', $invoice, $email_type, $sent_to_admin ); |
|
| 19 | 18 | \ No newline at end of file |
| 19 | +do_action('wpinv_email_footer', $invoice, $email_type, $sent_to_admin); |
|
| 20 | 20 | \ No newline at end of file |
@@ -1,41 +1,41 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -if ( !defined('ABSPATH') ) { |
|
| 2 | +if (!defined('ABSPATH')) { |
|
| 3 | 3 | exit; |
| 4 | 4 | } |
| 5 | 5 | global $post; |
| 6 | 6 | $invoice_id = $post->ID; |
| 7 | -$invoice = wpinv_get_invoice( $invoice_id ); |
|
| 8 | -if ( empty( $invoice ) ) { |
|
| 7 | +$invoice = wpinv_get_invoice($invoice_id); |
|
| 8 | +if (empty($invoice)) { |
|
| 9 | 9 | exit; |
| 10 | 10 | } |
| 11 | -$type = $post->post_type == 'wpi_invoice' ? __( 'Invoice', 'invoicing' ): __( 'Quotation', 'invoicing' ); |
|
| 12 | -do_action( 'wpinv_invoice_print_before_display', $invoice ); ?><!DOCTYPE html> |
|
| 11 | +$type = $post->post_type == 'wpi_invoice' ? __('Invoice', 'invoicing') : __('Quotation', 'invoicing'); |
|
| 12 | +do_action('wpinv_invoice_print_before_display', $invoice); ?><!DOCTYPE html> |
|
| 13 | 13 | <html <?php language_attributes(); ?>> |
| 14 | 14 | <head> |
| 15 | 15 | <meta charset="UTF-8"> |
| 16 | 16 | <title><?php wp_title() ?></title> |
| 17 | - <meta charset="<?php bloginfo( 'charset' ); ?>" /> |
|
| 17 | + <meta charset="<?php bloginfo('charset'); ?>" /> |
|
| 18 | 18 | <meta name="viewport" content="width=device-width, initial-scale=1"> |
| 19 | 19 | <meta name="robots" content="noindex,nofollow"> |
| 20 | 20 | |
| 21 | - <?php do_action( 'wpinv_invoice_print_head', $invoice ); ?> |
|
| 21 | + <?php do_action('wpinv_invoice_print_head', $invoice); ?> |
|
| 22 | 22 | </head> |
| 23 | 23 | <body class="body wpinv wpinv-print"> |
| 24 | - <?php do_action( 'wpinv_invoice_print_body_start', $invoice ); ?> |
|
| 24 | + <?php do_action('wpinv_invoice_print_body_start', $invoice); ?> |
|
| 25 | 25 | <div class="container wpinv-wrap"> |
| 26 | - <?php if ( $watermark = wpinv_watermark( $invoice_id ) ) { ?> |
|
| 27 | - <div class="watermark no-print"><p><?php echo esc_html( $watermark ) ?></p></div> |
|
| 26 | + <?php if ($watermark = wpinv_watermark($invoice_id)) { ?> |
|
| 27 | + <div class="watermark no-print"><p><?php echo esc_html($watermark) ?></p></div> |
|
| 28 | 28 | <?php } ?> |
| 29 | 29 | <!-- ///// Start PDF header --> |
| 30 | 30 | <htmlpageheader name="wpinv-pdf-header"> |
| 31 | - <?php do_action( 'wpinv_invoice_print_before_header', $invoice ); ?> |
|
| 31 | + <?php do_action('wpinv_invoice_print_before_header', $invoice); ?> |
|
| 32 | 32 | <div class="row wpinv-header"> |
| 33 | 33 | <div class="col-xs-6 wpinv-business"> |
| 34 | - <a target="_blank" href="<?php echo esc_url( wpinv_get_business_website() ); ?>"> |
|
| 35 | - <?php if ( $logo = wpinv_get_business_logo() ) { ?> |
|
| 36 | - <img class="logo" src="<?php echo esc_url( $logo ); ?>"> |
|
| 34 | + <a target="_blank" href="<?php echo esc_url(wpinv_get_business_website()); ?>"> |
|
| 35 | + <?php if ($logo = wpinv_get_business_logo()) { ?> |
|
| 36 | + <img class="logo" src="<?php echo esc_url($logo); ?>"> |
|
| 37 | 37 | <?php } else { ?> |
| 38 | - <h1><?php echo esc_html( wpinv_get_business_name() ); ?></h1> |
|
| 38 | + <h1><?php echo esc_html(wpinv_get_business_name()); ?></h1> |
|
| 39 | 39 | <?php } ?> |
| 40 | 40 | </a> |
| 41 | 41 | </div> |
@@ -44,56 +44,56 @@ discard block |
||
| 44 | 44 | <h2><?php echo $type; ?></h2> |
| 45 | 45 | </div> |
| 46 | 46 | </div> |
| 47 | - <?php do_action( 'wpinv_invoice_print_after_header', $invoice ); ?> |
|
| 47 | + <?php do_action('wpinv_invoice_print_after_header', $invoice); ?> |
|
| 48 | 48 | </htmlpageheader> |
| 49 | 49 | <!-- End PDF header ///// --> |
| 50 | 50 | |
| 51 | - <?php do_action( 'wpinv_invoice_print_before_top_content', $invoice ); ?> |
|
| 51 | + <?php do_action('wpinv_invoice_print_before_top_content', $invoice); ?> |
|
| 52 | 52 | <div class="row wpinv-top-content"> |
| 53 | 53 | <div class="col-xs-12 col-sm-6 wpinv-addresses"> |
| 54 | 54 | <div class="col-xs-12 wpinv-address wpinv-from-address"> |
| 55 | 55 | <?php wpinv_display_from_address(); ?> |
| 56 | 56 | </div> |
| 57 | 57 | <div class="col-xs-12 wpinv-address wpinv-to-address"> |
| 58 | - <?php wpinv_display_to_address( $invoice_id ); ?> |
|
| 58 | + <?php wpinv_display_to_address($invoice_id); ?> |
|
| 59 | 59 | </div> |
| 60 | 60 | </div> |
| 61 | 61 | <div class="col-xs-12 col-sm-6 wpinv-details"> |
| 62 | 62 | <div class="col-xs-12 wpinv-line-details"> |
| 63 | - <?php do_action( 'wpinv_invoice_print_before_details', $invoice ); ?> |
|
| 64 | - <?php wpinv_display_invoice_details( $invoice ); ?> |
|
| 65 | - <?php do_action( 'wpinv_invoice_print_after_details', $invoice ); ?> |
|
| 63 | + <?php do_action('wpinv_invoice_print_before_details', $invoice); ?> |
|
| 64 | + <?php wpinv_display_invoice_details($invoice); ?> |
|
| 65 | + <?php do_action('wpinv_invoice_print_after_details', $invoice); ?> |
|
| 66 | 66 | </div> |
| 67 | 67 | </div> |
| 68 | 68 | </div> |
| 69 | - <?php do_action( 'wpinv_invoice_print_after_top_content', $invoice ); ?> |
|
| 69 | + <?php do_action('wpinv_invoice_print_after_top_content', $invoice); ?> |
|
| 70 | 70 | |
| 71 | - <?php do_action( 'wpinv_invoice_print_middle', $invoice ); ?> |
|
| 71 | + <?php do_action('wpinv_invoice_print_middle', $invoice); ?> |
|
| 72 | 72 | |
| 73 | - <?php do_action( 'wpinv_invoice_print_before_line_items', $invoice ); ?> |
|
| 73 | + <?php do_action('wpinv_invoice_print_before_line_items', $invoice); ?> |
|
| 74 | 74 | <div class="row wpinv-items"> |
| 75 | 75 | <div class="col-sm-12 wpinv-line-items"> |
| 76 | - <?php wpinv_display_line_items( $invoice_id ); ?> |
|
| 76 | + <?php wpinv_display_line_items($invoice_id); ?> |
|
| 77 | 77 | </div> |
| 78 | 78 | </div> |
| 79 | - <?php do_action( 'wpinv_invoice_print_after_line_items', $invoice ); ?> |
|
| 79 | + <?php do_action('wpinv_invoice_print_after_line_items', $invoice); ?> |
|
| 80 | 80 | |
| 81 | 81 | <!-- ///// Start PDF footer --> |
| 82 | 82 | <htmlpagefooter name="wpinv-pdf-footer"> |
| 83 | - <?php do_action( 'wpinv_invoice_print_before_footer', $invoice ); ?> |
|
| 83 | + <?php do_action('wpinv_invoice_print_before_footer', $invoice); ?> |
|
| 84 | 84 | <div class="row wpinv-footer"> |
| 85 | 85 | <div class="col-sm-12"> |
| 86 | - <?php if ( $term_text = wpinv_get_terms_text() ) { ?> |
|
| 87 | - <div class="terms-text"><?php echo wpautop( $term_text ); ?></div> |
|
| 86 | + <?php if ($term_text = wpinv_get_terms_text()) { ?> |
|
| 87 | + <div class="terms-text"><?php echo wpautop($term_text); ?></div> |
|
| 88 | 88 | <?php } ?> |
| 89 | 89 | <div class="footer-text"><?php echo wpinv_get_business_footer(); ?></div> |
| 90 | - <div class="print-only"><?php _e( 'Page ', 'invoicing' ) ?> {PAGENO}/{nbpg}</div> |
|
| 90 | + <div class="print-only"><?php _e('Page ', 'invoicing') ?> {PAGENO}/{nbpg}</div> |
|
| 91 | 91 | </div> |
| 92 | 92 | </div> |
| 93 | - <?php do_action( 'wpinv_invoice_print_after_footer', $invoice ); ?> |
|
| 93 | + <?php do_action('wpinv_invoice_print_after_footer', $invoice); ?> |
|
| 94 | 94 | </htmlpagefooter> |
| 95 | 95 | <!-- End PDF footer ///// --> |
| 96 | 96 | </div><!-- END wpinv-wrap --> |
| 97 | - <?php do_action( 'wpinv_invoice_print_body_end', $invoice ); ?> |
|
| 97 | + <?php do_action('wpinv_invoice_print_body_end', $invoice); ?> |
|
| 98 | 98 | </body> |
| 99 | 99 | </html> |
| 100 | 100 | \ No newline at end of file |
@@ -47,6 +47,9 @@ discard block |
||
| 47 | 47 | } |
| 48 | 48 | } |
| 49 | 49 | |
| 50 | + /** |
|
| 51 | + * @param integer $code |
|
| 52 | + */ |
|
| 50 | 53 | public function send_status( $code ) { |
| 51 | 54 | status_header( $code ); |
| 52 | 55 | } |
@@ -195,6 +198,11 @@ discard block |
||
| 195 | 198 | class WPInv_API_Exception extends Exception { |
| 196 | 199 | protected $error_code; |
| 197 | 200 | |
| 201 | + /** |
|
| 202 | + * @param string $error_code |
|
| 203 | + * @param string $error_message |
|
| 204 | + * @param integer $http_status_code |
|
| 205 | + */ |
|
| 198 | 206 | public function __construct( $error_code, $error_message, $http_status_code ) { |
| 199 | 207 | $this->error_code = $error_code; |
| 200 | 208 | parent::__construct( $error_message, $http_status_code ); |
@@ -7,51 +7,51 @@ discard block |
||
| 7 | 7 | */ |
| 8 | 8 | |
| 9 | 9 | // MUST have WordPress. |
| 10 | -if ( !defined( 'WPINC' ) ) { |
|
| 11 | - exit( 'Do NOT access this file directly: ' . basename( __FILE__ ) ); |
|
| 10 | +if (!defined('WPINC')) { |
|
| 11 | + exit('Do NOT access this file directly: ' . basename(__FILE__)); |
|
| 12 | 12 | } |
| 13 | 13 | |
| 14 | 14 | class WPInv_API { |
| 15 | 15 | protected $post_type = 'wpi_invoice'; |
| 16 | 16 | |
| 17 | - public function __construct( $params = array() ) { |
|
| 17 | + public function __construct($params = array()) { |
|
| 18 | 18 | } |
| 19 | - public function insert_invoice( $data ) { |
|
| 19 | + public function insert_invoice($data) { |
|
| 20 | 20 | global $wpdb; |
| 21 | 21 | //wpinv_transaction_query( 'start' ); |
| 22 | 22 | |
| 23 | 23 | try { |
| 24 | - if ( empty( $data['invoice'] ) ) { |
|
| 25 | - throw new WPInv_API_Exception( 'wpinv_api_missing_invoice_data', sprintf( __( 'No %1$s data specified to create %1$s', 'invoicing' ), 'invoice' ), 400 ); |
|
| 24 | + if (empty($data['invoice'])) { |
|
| 25 | + throw new WPInv_API_Exception('wpinv_api_missing_invoice_data', sprintf(__('No %1$s data specified to create %1$s', 'invoicing'), 'invoice'), 400); |
|
| 26 | 26 | } |
| 27 | 27 | |
| 28 | - $data = apply_filters( 'wpinv_api_create_invoice_data', $data['invoice'], $this ); |
|
| 28 | + $data = apply_filters('wpinv_api_create_invoice_data', $data['invoice'], $this); |
|
| 29 | 29 | |
| 30 | - $invoice = wpinv_insert_invoice( $data, true ); |
|
| 31 | - if ( empty( $invoice->ID ) || is_wp_error( $invoice ) ) { |
|
| 32 | - throw new WPInv_API_Exception( 'wpinv_api_cannot_create_invoice', sprintf( __( 'Cannot create invoice: %s', 'invoicing' ), implode( ', ', $invoice->get_error_messages() ) ), 400 ); |
|
| 30 | + $invoice = wpinv_insert_invoice($data, true); |
|
| 31 | + if (empty($invoice->ID) || is_wp_error($invoice)) { |
|
| 32 | + throw new WPInv_API_Exception('wpinv_api_cannot_create_invoice', sprintf(__('Cannot create invoice: %s', 'invoicing'), implode(', ', $invoice->get_error_messages())), 400); |
|
| 33 | 33 | } |
| 34 | 34 | |
| 35 | 35 | // HTTP 201 Created |
| 36 | - $this->send_status( 201 ); |
|
| 36 | + $this->send_status(201); |
|
| 37 | 37 | |
| 38 | - do_action( 'wpinv_api_create_invoice', $invoice->ID, $data, $this ); |
|
| 38 | + do_action('wpinv_api_create_invoice', $invoice->ID, $data, $this); |
|
| 39 | 39 | |
| 40 | 40 | //wpinv_transaction_query( 'commit' ); |
| 41 | 41 | |
| 42 | - return wpinv_get_invoice( $invoice->ID ); |
|
| 43 | - } catch ( WPInv_API_Exception $e ) { |
|
| 42 | + return wpinv_get_invoice($invoice->ID); |
|
| 43 | + } catch (WPInv_API_Exception $e) { |
|
| 44 | 44 | //wpinv_transaction_query( 'rollback' ); |
| 45 | 45 | |
| 46 | - return new WP_Error( $e->getErrorCode(), $e->getMessage(), array( 'status' => $e->getCode() ) ); |
|
| 46 | + return new WP_Error($e->getErrorCode(), $e->getMessage(), array('status' => $e->getCode())); |
|
| 47 | 47 | } |
| 48 | 48 | } |
| 49 | 49 | |
| 50 | - public function send_status( $code ) { |
|
| 51 | - status_header( $code ); |
|
| 50 | + public function send_status($code) { |
|
| 51 | + status_header($code); |
|
| 52 | 52 | } |
| 53 | 53 | |
| 54 | - protected function set_billing_details( $invoice, $data ) { |
|
| 54 | + protected function set_billing_details($invoice, $data) { |
|
| 55 | 55 | $address_fields = array( |
| 56 | 56 | 'user_id', |
| 57 | 57 | 'first_name', |
@@ -70,66 +70,66 @@ discard block |
||
| 70 | 70 | $billing_details = array(); |
| 71 | 71 | $user_id = $invoice->get_user_id(); |
| 72 | 72 | |
| 73 | - foreach ( $address_fields as $field ) { |
|
| 74 | - if ( isset( $data['billing_details'][ $field ] ) ) { |
|
| 75 | - $value = sanitize_text_field( $data['billing_details'][ $field ] ); |
|
| 73 | + foreach ($address_fields as $field) { |
|
| 74 | + if (isset($data['billing_details'][$field])) { |
|
| 75 | + $value = sanitize_text_field($data['billing_details'][$field]); |
|
| 76 | 76 | |
| 77 | - if ( $field == 'country' && empty( $value ) ) { |
|
| 78 | - if ( !empty( $invoice->country ) ) { |
|
| 77 | + if ($field == 'country' && empty($value)) { |
|
| 78 | + if (!empty($invoice->country)) { |
|
| 79 | 79 | $value = $invoice->country; |
| 80 | 80 | } else { |
| 81 | - $value = wpinv_default_billing_country( '', $user_id ); |
|
| 81 | + $value = wpinv_default_billing_country('', $user_id); |
|
| 82 | 82 | } |
| 83 | 83 | } |
| 84 | 84 | |
| 85 | - if ( $field == 'state' && empty( $value ) ) { |
|
| 86 | - if ( !empty( $invoice->state ) ) { |
|
| 85 | + if ($field == 'state' && empty($value)) { |
|
| 86 | + if (!empty($invoice->state)) { |
|
| 87 | 87 | $value = $invoice->state; |
| 88 | 88 | } else { |
| 89 | 89 | $value = wpinv_get_default_state(); |
| 90 | 90 | } |
| 91 | 91 | } |
| 92 | 92 | |
| 93 | - $invoice->set( $field, $value ); |
|
| 93 | + $invoice->set($field, $value); |
|
| 94 | 94 | |
| 95 | - update_post_meta( $invoice->ID, '_wpinv_' . $field, $value ); |
|
| 95 | + update_post_meta($invoice->ID, '_wpinv_' . $field, $value); |
|
| 96 | 96 | } |
| 97 | 97 | } |
| 98 | 98 | |
| 99 | 99 | return $invoice; |
| 100 | 100 | } |
| 101 | 101 | |
| 102 | - protected function set_discount( $invoice, $data ) { |
|
| 103 | - if ( isset( $data['discount'] ) ) { |
|
| 104 | - $invoice->set( 'discount', wpinv_round_amount( $data['discount'] ) ); |
|
| 102 | + protected function set_discount($invoice, $data) { |
|
| 103 | + if (isset($data['discount'])) { |
|
| 104 | + $invoice->set('discount', wpinv_round_amount($data['discount'])); |
|
| 105 | 105 | |
| 106 | - update_post_meta( $invoice->ID, '_wpinv_discount', wpinv_round_amount( $data['discount'] ) ); |
|
| 106 | + update_post_meta($invoice->ID, '_wpinv_discount', wpinv_round_amount($data['discount'])); |
|
| 107 | 107 | |
| 108 | - if ( isset( $data['discount_code'] ) ) { |
|
| 109 | - $invoice->set( 'discount_code', $data['discount_code'] ); |
|
| 108 | + if (isset($data['discount_code'])) { |
|
| 109 | + $invoice->set('discount_code', $data['discount_code']); |
|
| 110 | 110 | |
| 111 | - update_post_meta( $invoice->ID, '_wpinv_discount_code', $data['discount_code'] ); |
|
| 111 | + update_post_meta($invoice->ID, '_wpinv_discount_code', $data['discount_code']); |
|
| 112 | 112 | } |
| 113 | 113 | } |
| 114 | 114 | |
| 115 | 115 | return $invoice; |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | - protected function set_items( $invoice, $data ) { |
|
| 119 | - if ( !empty( $data['items'] ) && is_array( $data['items'] ) ) { |
|
| 118 | + protected function set_items($invoice, $data) { |
|
| 119 | + if (!empty($data['items']) && is_array($data['items'])) { |
|
| 120 | 120 | $items_array = array(); |
| 121 | 121 | |
| 122 | - if ( !empty( $invoice->country ) ) { |
|
| 122 | + if (!empty($invoice->country)) { |
|
| 123 | 123 | $country = $invoice->country; |
| 124 | - } else if ( !empty( $data['billing_details']['country'] ) ) { |
|
| 124 | + } else if (!empty($data['billing_details']['country'])) { |
|
| 125 | 125 | $country = $data['billing_details']['country']; |
| 126 | 126 | } else { |
| 127 | - $country = wpinv_default_billing_country( '', $invoice->get_user_id() ); |
|
| 127 | + $country = wpinv_default_billing_country('', $invoice->get_user_id()); |
|
| 128 | 128 | } |
| 129 | 129 | |
| 130 | - if ( !empty( $invoice->state ) ) { |
|
| 130 | + if (!empty($invoice->state)) { |
|
| 131 | 131 | $state = $invoice->state; |
| 132 | - } else if ( !empty( $data['billing_details']['state'] ) ) { |
|
| 132 | + } else if (!empty($data['billing_details']['state'])) { |
|
| 133 | 133 | $state = $data['billing_details']['state']; |
| 134 | 134 | } else { |
| 135 | 135 | $state = wpinv_get_default_state(); |
@@ -138,54 +138,54 @@ discard block |
||
| 138 | 138 | $_POST['country'] = $country; |
| 139 | 139 | $_POST['state'] = $state; |
| 140 | 140 | |
| 141 | - $rate = wpinv_get_tax_rate( $country, $state, 'global' ); |
|
| 141 | + $rate = wpinv_get_tax_rate($country, $state, 'global'); |
|
| 142 | 142 | |
| 143 | 143 | $total_tax = 0; |
| 144 | - foreach ( $data['items'] as $item ) { |
|
| 145 | - $id = isset( $item['id'] ) ? sanitize_text_field( $item['id'] ) : ''; |
|
| 146 | - $title = isset( $item['title'] ) ? sanitize_text_field( $item['title'] ) : ''; |
|
| 147 | - $desc = isset( $item['description'] ) ? sanitize_text_field( $item['description'] ) : ''; |
|
| 148 | - $amount = isset( $item['amount'] ) ? wpinv_round_amount( $item['amount'] ) : 0; |
|
| 144 | + foreach ($data['items'] as $item) { |
|
| 145 | + $id = isset($item['id']) ? sanitize_text_field($item['id']) : ''; |
|
| 146 | + $title = isset($item['title']) ? sanitize_text_field($item['title']) : ''; |
|
| 147 | + $desc = isset($item['description']) ? sanitize_text_field($item['description']) : ''; |
|
| 148 | + $amount = isset($item['amount']) ? wpinv_round_amount($item['amount']) : 0; |
|
| 149 | 149 | |
| 150 | - if ( !empty( $item['vat_rates_class'] ) ) { |
|
| 150 | + if (!empty($item['vat_rates_class'])) { |
|
| 151 | 151 | $vat_rates_class = $item['vat_rates_class']; |
| 152 | 152 | } else { |
| 153 | 153 | $vat_rates_class = '_standard'; |
| 154 | 154 | } |
| 155 | - $vat_rate = wpinv_get_tax_rate( $country, $state, $id ); |
|
| 155 | + $vat_rate = wpinv_get_tax_rate($country, $state, $id); |
|
| 156 | 156 | |
| 157 | - $tax = $amount > 0 ? ( $amount * 0.01 * (float)$vat_rate ) : 0; |
|
| 157 | + $tax = $amount > 0 ? ($amount * 0.01 * (float)$vat_rate) : 0; |
|
| 158 | 158 | $total_tax += $tax; |
| 159 | 159 | |
| 160 | 160 | $items_array[] = array( |
| 161 | 161 | 'id' => $id, |
| 162 | - 'title' => esc_html( $title ), |
|
| 163 | - 'description' => esc_html( $desc ), |
|
| 164 | - 'amount' => $amount > 0 ? wpinv_round_amount( $amount ) : 0, |
|
| 165 | - 'subtotal' => $amount > 0 ? wpinv_round_amount( $amount ) : 0, |
|
| 162 | + 'title' => esc_html($title), |
|
| 163 | + 'description' => esc_html($desc), |
|
| 164 | + 'amount' => $amount > 0 ? wpinv_round_amount($amount) : 0, |
|
| 165 | + 'subtotal' => $amount > 0 ? wpinv_round_amount($amount) : 0, |
|
| 166 | 166 | 'vat_rates_class' => $vat_rates_class, |
| 167 | 167 | 'vat_rate' => $vat_rate, |
| 168 | - 'tax' => $tax > 0 ? wpinv_round_amount( $tax ) : 0, |
|
| 168 | + 'tax' => $tax > 0 ? wpinv_round_amount($tax) : 0, |
|
| 169 | 169 | ); |
| 170 | 170 | } |
| 171 | 171 | |
| 172 | - update_post_meta( $invoice->ID, '_wpinv_tax', wpinv_round_amount( $total_tax ) ); |
|
| 173 | - $invoice->set( 'tax', wpinv_round_amount( $total_tax ) ); |
|
| 172 | + update_post_meta($invoice->ID, '_wpinv_tax', wpinv_round_amount($total_tax)); |
|
| 173 | + $invoice->set('tax', wpinv_round_amount($total_tax)); |
|
| 174 | 174 | |
| 175 | - $items_array = apply_filters( 'wpinv_save_invoice_items', $items_array, $data['items'], $invoice ); |
|
| 175 | + $items_array = apply_filters('wpinv_save_invoice_items', $items_array, $data['items'], $invoice); |
|
| 176 | 176 | |
| 177 | - $invoice->set( 'items', $items_array ); |
|
| 178 | - update_post_meta( $invoice->ID, '_wpinv_items', $items_array ); |
|
| 177 | + $invoice->set('items', $items_array); |
|
| 178 | + update_post_meta($invoice->ID, '_wpinv_items', $items_array); |
|
| 179 | 179 | } |
| 180 | 180 | |
| 181 | 181 | return $invoice; |
| 182 | 182 | } |
| 183 | 183 | |
| 184 | - protected function set_invoice_meta( $invoice_id, $invoice_meta ) { |
|
| 185 | - foreach ( $invoice_meta as $meta_key => $meta_value ) { |
|
| 184 | + protected function set_invoice_meta($invoice_id, $invoice_meta) { |
|
| 185 | + foreach ($invoice_meta as $meta_key => $meta_value) { |
|
| 186 | 186 | |
| 187 | - if ( is_string( $meta_key) && ! is_protected_meta( $meta_key ) && is_scalar( $meta_value ) ) { |
|
| 188 | - update_post_meta( $invoice_id, $meta_key, $meta_value ); |
|
| 187 | + if (is_string($meta_key) && !is_protected_meta($meta_key) && is_scalar($meta_value)) { |
|
| 188 | + update_post_meta($invoice_id, $meta_key, $meta_value); |
|
| 189 | 189 | } |
| 190 | 190 | } |
| 191 | 191 | } |
@@ -195,9 +195,9 @@ discard block |
||
| 195 | 195 | class WPInv_API_Exception extends Exception { |
| 196 | 196 | protected $error_code; |
| 197 | 197 | |
| 198 | - public function __construct( $error_code, $error_message, $http_status_code ) { |
|
| 198 | + public function __construct($error_code, $error_message, $http_status_code) { |
|
| 199 | 199 | $this->error_code = $error_code; |
| 200 | - parent::__construct( $error_message, $http_status_code ); |
|
| 200 | + parent::__construct($error_message, $http_status_code); |
|
| 201 | 201 | } |
| 202 | 202 | |
| 203 | 203 | public function getErrorCode() { |
@@ -1,5 +1,5 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 2 | +if (!defined('ABSPATH')) { |
|
| 3 | 3 | exit; // Exit if accessed directly |
| 4 | 4 | } |
| 5 | 5 | |
@@ -14,73 +14,73 @@ discard block |
||
| 14 | 14 | } |
| 15 | 15 | |
| 16 | 16 | public function init() { |
| 17 | - do_action( 'wpinv_class_notes_init', $this ); |
|
| 17 | + do_action('wpinv_class_notes_init', $this); |
|
| 18 | 18 | } |
| 19 | 19 | |
| 20 | 20 | public function includes() { |
| 21 | - do_action( 'wpinv_class_notes_includes', $this ); |
|
| 21 | + do_action('wpinv_class_notes_includes', $this); |
|
| 22 | 22 | } |
| 23 | 23 | |
| 24 | 24 | public function actions() { |
| 25 | 25 | // Secure inovice notes |
| 26 | - add_action( 'pre_get_comments', array( $this, 'set_invoice_note_type' ), 11, 1 ); |
|
| 26 | + add_action('pre_get_comments', array($this, 'set_invoice_note_type'), 11, 1); |
|
| 27 | 27 | |
| 28 | 28 | // Count comments |
| 29 | - add_filter( 'wp_count_comments', array( $this, 'wp_count_comments' ), 11, 2 ); |
|
| 29 | + add_filter('wp_count_comments', array($this, 'wp_count_comments'), 11, 2); |
|
| 30 | 30 | |
| 31 | 31 | // Delete comments count cache whenever there is a new comment or a comment status changes |
| 32 | - add_action( 'wp_insert_comment', array( $this, 'delete_comments_count_cache' ) ); |
|
| 33 | - add_action( 'wp_set_comment_status', array( $this, 'delete_comments_count_cache' ) ); |
|
| 32 | + add_action('wp_insert_comment', array($this, 'delete_comments_count_cache')); |
|
| 33 | + add_action('wp_set_comment_status', array($this, 'delete_comments_count_cache')); |
|
| 34 | 34 | |
| 35 | - do_action( 'wpinv_class_notes_actions', $this ); |
|
| 35 | + do_action('wpinv_class_notes_actions', $this); |
|
| 36 | 36 | } |
| 37 | 37 | |
| 38 | - public function set_invoice_note_type( $query ) { |
|
| 39 | - $post_ID = !empty( $query->query_vars['post_ID'] ) ? $query->query_vars['post_ID'] : $query->query_vars['post_id']; |
|
| 38 | + public function set_invoice_note_type($query) { |
|
| 39 | + $post_ID = !empty($query->query_vars['post_ID']) ? $query->query_vars['post_ID'] : $query->query_vars['post_id']; |
|
| 40 | 40 | |
| 41 | - if ( $post_ID && in_array(get_post_type( $post_ID ), array($this->invoice_post_type, 'wpi_quote' )) ) { |
|
| 41 | + if ($post_ID && in_array(get_post_type($post_ID), array($this->invoice_post_type, 'wpi_quote'))) { |
|
| 42 | 42 | $query->query_vars['type__in'] = $this->comment_type; |
| 43 | 43 | $query->query_vars['type__not_in'] = ''; |
| 44 | 44 | } else { |
| 45 | - if ( isset( $query->query_vars['type__in'] ) && $type_in = $query->query_vars['type__in'] ) { |
|
| 46 | - if ( is_array( $type_in ) && in_array( $this->comment_type, $type_in ) ) { |
|
| 47 | - $key = array_search( $this->comment_type, $type_in ); |
|
| 48 | - unset( $query->query_vars['type__in'][$key] ); |
|
| 49 | - } else if ( !is_array( $type_in ) && $type_in == $this->comment_type ) { |
|
| 45 | + if (isset($query->query_vars['type__in']) && $type_in = $query->query_vars['type__in']) { |
|
| 46 | + if (is_array($type_in) && in_array($this->comment_type, $type_in)) { |
|
| 47 | + $key = array_search($this->comment_type, $type_in); |
|
| 48 | + unset($query->query_vars['type__in'][$key]); |
|
| 49 | + } else if (!is_array($type_in) && $type_in == $this->comment_type) { |
|
| 50 | 50 | $query->query_vars['type__in'] = ''; |
| 51 | 51 | } |
| 52 | 52 | } |
| 53 | 53 | |
| 54 | - if ( isset( $query->query_vars['type__not_in'] ) && $type_not_in = $query->query_vars['type__not_in'] ) { |
|
| 55 | - if ( is_array( $type_not_in ) && !in_array( $this->comment_type, $type_not_in ) ) { |
|
| 54 | + if (isset($query->query_vars['type__not_in']) && $type_not_in = $query->query_vars['type__not_in']) { |
|
| 55 | + if (is_array($type_not_in) && !in_array($this->comment_type, $type_not_in)) { |
|
| 56 | 56 | $query->query_vars['type__not_in'][] = $this->comment_type; |
| 57 | - } else if ( !is_array( $type_not_in ) && $type_not_in != $this->comment_type ) { |
|
| 57 | + } else if (!is_array($type_not_in) && $type_not_in != $this->comment_type) { |
|
| 58 | 58 | $query->query_vars['type__not_in'] = (array)$query->query_vars['type__not_in']; |
| 59 | 59 | $query->query_vars['type__not_in'][] = $this->comment_type; |
| 60 | 60 | } |
| 61 | 61 | } else { |
| 62 | - $query->query_vars['type__not_in'] = $this->comment_type; |
|
| 62 | + $query->query_vars['type__not_in'] = $this->comment_type; |
|
| 63 | 63 | } |
| 64 | 64 | } |
| 65 | 65 | |
| 66 | 66 | return $query; |
| 67 | 67 | } |
| 68 | 68 | |
| 69 | - public function get_invoice_notes( $invoice_id = 0, $type = '' ) { |
|
| 69 | + public function get_invoice_notes($invoice_id = 0, $type = '') { |
|
| 70 | 70 | $args = array( |
| 71 | 71 | 'post_id' => $invoice_id, |
| 72 | 72 | 'orderby' => 'comment_ID', |
| 73 | 73 | 'order' => 'ASC', |
| 74 | 74 | ); |
| 75 | 75 | |
| 76 | - if ( $type == 'customer' ) { |
|
| 76 | + if ($type == 'customer') { |
|
| 77 | 77 | $args['meta_key'] = '_wpi_customer_note'; |
| 78 | 78 | $args['meta_value'] = 1; |
| 79 | 79 | } |
| 80 | 80 | |
| 81 | - $args = apply_filters( 'wpinv_invoice_notes_args', $args, $this, $invoice_id, $type ); |
|
| 81 | + $args = apply_filters('wpinv_invoice_notes_args', $args, $this, $invoice_id, $type); |
|
| 82 | 82 | |
| 83 | - return get_comments( $args ); |
|
| 83 | + return get_comments($args); |
|
| 84 | 84 | } |
| 85 | 85 | |
| 86 | 86 | /** |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | * @return void |
| 92 | 92 | */ |
| 93 | 93 | public function delete_comments_count_cache() { |
| 94 | - delete_transient( 'wpinv_count_comments' ); |
|
| 94 | + delete_transient('wpinv_count_comments'); |
|
| 95 | 95 | } |
| 96 | 96 | |
| 97 | 97 | /** |
@@ -102,16 +102,16 @@ discard block |
||
| 102 | 102 | * @param int $post_id Post ID. |
| 103 | 103 | * @return object |
| 104 | 104 | */ |
| 105 | - public function wp_count_comments( $stats, $post_id ) { |
|
| 105 | + public function wp_count_comments($stats, $post_id) { |
|
| 106 | 106 | global $wpdb; |
| 107 | 107 | |
| 108 | - if ( 0 === $post_id ) { |
|
| 109 | - $stats = get_transient( 'wpinv_count_comments' ); |
|
| 108 | + if (0 === $post_id) { |
|
| 109 | + $stats = get_transient('wpinv_count_comments'); |
|
| 110 | 110 | |
| 111 | - if ( ! $stats ) { |
|
| 111 | + if (!$stats) { |
|
| 112 | 112 | $stats = array(); |
| 113 | 113 | |
| 114 | - $count = $wpdb->get_results( "SELECT comment_approved, COUNT(*) AS num_comments FROM {$wpdb->comments} WHERE comment_type NOT IN ('" . $this->comment_type . "') GROUP BY comment_approved", ARRAY_A ); |
|
| 114 | + $count = $wpdb->get_results("SELECT comment_approved, COUNT(*) AS num_comments FROM {$wpdb->comments} WHERE comment_type NOT IN ('" . $this->comment_type . "') GROUP BY comment_approved", ARRAY_A); |
|
| 115 | 115 | |
| 116 | 116 | $total = 0; |
| 117 | 117 | $approved = array( |
@@ -122,26 +122,26 @@ discard block |
||
| 122 | 122 | 'post-trashed' => 'post-trashed', |
| 123 | 123 | ); |
| 124 | 124 | |
| 125 | - foreach ( (array) $count as $row ) { |
|
| 125 | + foreach ((array)$count as $row) { |
|
| 126 | 126 | // Do not count post-trashed toward totals. |
| 127 | - if ( 'post-trashed' !== $row['comment_approved'] && 'trash' !== $row['comment_approved'] ) { |
|
| 127 | + if ('post-trashed' !== $row['comment_approved'] && 'trash' !== $row['comment_approved']) { |
|
| 128 | 128 | $total += $row['num_comments']; |
| 129 | 129 | } |
| 130 | - if ( isset( $approved[ $row['comment_approved'] ] ) ) { |
|
| 131 | - $stats[ $approved[ $row['comment_approved'] ] ] = $row['num_comments']; |
|
| 130 | + if (isset($approved[$row['comment_approved']])) { |
|
| 131 | + $stats[$approved[$row['comment_approved']]] = $row['num_comments']; |
|
| 132 | 132 | } |
| 133 | 133 | } |
| 134 | 134 | |
| 135 | 135 | $stats['total_comments'] = $total; |
| 136 | 136 | $stats['all'] = $total; |
| 137 | - foreach ( $approved as $key ) { |
|
| 138 | - if ( empty( $stats[ $key ] ) ) { |
|
| 139 | - $stats[ $key ] = 0; |
|
| 137 | + foreach ($approved as $key) { |
|
| 138 | + if (empty($stats[$key])) { |
|
| 139 | + $stats[$key] = 0; |
|
| 140 | 140 | } |
| 141 | 141 | } |
| 142 | 142 | |
| 143 | - $stats = (object) $stats; |
|
| 144 | - set_transient( 'wpinv_count_comments', $stats ); |
|
| 143 | + $stats = (object)$stats; |
|
| 144 | + set_transient('wpinv_count_comments', $stats); |
|
| 145 | 145 | } |
| 146 | 146 | } |
| 147 | 147 | |