Passed
Push — master ( 9f060d...75dadc )
by Brian
04:41
created
widgets/invoice-receipt.php 2 patches
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -44,15 +44,15 @@
 block discarded – undo
44 44
         parent::__construct( $options );
45 45
     }
46 46
 
47
-	/**
48
-	 * The Super block output function.
49
-	 *
50
-	 * @param array $args
51
-	 * @param array $widget_args
52
-	 * @param string $content
53
-	 *
54
-	 * @return mixed|string|bool
55
-	 */
47
+    /**
48
+     * The Super block output function.
49
+     *
50
+     * @param array $args
51
+     * @param array $widget_args
52
+     * @param string $content
53
+     *
54
+     * @return mixed|string|bool
55
+     */
56 56
     public function output( $args = array(), $widget_args = array(), $content = '' ) {
57 57
         return wpinv_payment_receipt();
58 58
     }
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if ( ! defined( 'ABSPATH' ) ) {
2
+if (!defined('ABSPATH')) {
3 3
     exit;
4 4
 }
5 5
 
@@ -22,15 +22,15 @@  discard block
 block discarded – undo
22 22
             'block-keywords'=> "['invoicing','receipt']",
23 23
             'class_name'     => __CLASS__,
24 24
             'base_id'       => 'wpinv_receipt',
25
-            'name'          => __('GetPaid > Invoice Receipt','invoicing'),
25
+            'name'          => __('GetPaid > Invoice Receipt', 'invoicing'),
26 26
             'widget_ops'    => array(
27 27
                 'classname'   => 'wpinv-receipt-class bsui',
28
-                'description' => esc_html__('Displays invoice receipt after checkout.','invoicing'),
28
+                'description' => esc_html__('Displays invoice receipt after checkout.', 'invoicing'),
29 29
             ),
30 30
             'arguments'     => array(
31 31
                 'title'  => array(
32
-                    'title'       => __( 'Widget title', 'invoicing' ),
33
-                    'desc'        => __( 'Enter widget title.', 'invoicing' ),
32
+                    'title'       => __('Widget title', 'invoicing'),
33
+                    'desc'        => __('Enter widget title.', 'invoicing'),
34 34
                     'type'        => 'text',
35 35
                     'desc_tip'    => true,
36 36
                     'default'     => '',
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
         );
42 42
 
43 43
 
44
-        parent::__construct( $options );
44
+        parent::__construct($options);
45 45
     }
46 46
 
47 47
 	/**
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
 	 *
54 54
 	 * @return mixed|string|bool
55 55
 	 */
56
-    public function output( $args = array(), $widget_args = array(), $content = '' ) {
56
+    public function output($args = array(), $widget_args = array(), $content = '') {
57 57
         return wpinv_payment_receipt();
58 58
     }
59 59
 
Please login to merge, or discard this patch.
includes/libraries/wpinv-euvat/class-wpinv-euvat.php 3 patches
Indentation   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -394,15 +394,15 @@  discard block
 block discarded – undo
394 394
     }
395 395
 
396 396
     /**
397
-	 * Fetches the database from the MaxMind service.
398
-	 *
399
-	 * @param string $license_key The license key to be used when downloading the database.
400
-	 */
397
+     * Fetches the database from the MaxMind service.
398
+     *
399
+     * @param string $license_key The license key to be used when downloading the database.
400
+     */
401 401
     public static function geoip2_download_database() {
402 402
 
403 403
         // Allow us to easily interact with the filesystem.
404 404
         require_once ABSPATH . 'wp-admin/includes/file.php';
405
-		WP_Filesystem();
405
+        WP_Filesystem();
406 406
         global $wp_filesystem;
407 407
 
408 408
         $license_key = wpinv_get_option( 'maxmind_license_key' );
@@ -433,7 +433,7 @@  discard block
 block discarded – undo
433 433
             }
434 434
 
435 435
             // Move the new database into position.
436
-		    $wp_filesystem->move( $database_path, $target_path, true );
436
+            $wp_filesystem->move( $database_path, $target_path, true );
437 437
             $wp_filesystem->delete( dirname( $database_path ) );
438 438
 
439 439
             wpinv_update_option( 'wpinv_geoip2_date_updated', current_time( 'timestamp' ) );
@@ -452,16 +452,16 @@  discard block
 block discarded – undo
452 452
 
453 453
         // The download URI of the database.
454 454
         $source_url = add_query_arg(
455
-			array(
455
+            array(
456 456
                 'license_key' => urlencode( sanitize_text_field( $license_key ) ),
457 457
                 'edition_id'  => $database,
458
-				'suffix'      => 'tar.gz',
459
-			),
460
-			'https://download.maxmind.com/app/geoip_download'
458
+                'suffix'      => 'tar.gz',
459
+            ),
460
+            'https://download.maxmind.com/app/geoip_download'
461 461
         );
462 462
 
463 463
         // Needed for the download_url call right below.
464
-		require_once ABSPATH . 'wp-admin/includes/file.php';
464
+        require_once ABSPATH . 'wp-admin/includes/file.php';
465 465
 
466 466
         // Download the file.
467 467
         $tmp_archive_path = download_url( esc_url_raw( $source_url ) );
@@ -470,16 +470,16 @@  discard block
 block discarded – undo
470 470
         if ( is_wp_error( $tmp_archive_path ) ) {
471 471
 
472 472
             // Transform the error into something more informative.
473
-			$error_data = $tmp_archive_path->get_error_data();
474
-			if ( isset( $error_data['code'] ) ) {
475
-				switch ( $error_data['code'] ) {
476
-					case 401:
477
-						return new WP_Error(
478
-							'invoicing_maxmind_geolocation_database_license_key',
479
-							__( 'The MaxMind license key is invalid. If you have recently created this key, you may need to wait for it to become active.', 'invoicing' )
480
-						);
481
-				}
482
-			}
473
+            $error_data = $tmp_archive_path->get_error_data();
474
+            if ( isset( $error_data['code'] ) ) {
475
+                switch ( $error_data['code'] ) {
476
+                    case 401:
477
+                        return new WP_Error(
478
+                            'invoicing_maxmind_geolocation_database_license_key',
479
+                            __( 'The MaxMind license key is invalid. If you have recently created this key, you may need to wait for it to become active.', 'invoicing' )
480
+                        );
481
+                }
482
+            }
483 483
 
484 484
             return new WP_Error( 'invoicing_maxmind_geolocation_database_download', __( 'Failed to download the MaxMind database.', 'invoicing' ) );
485 485
 
@@ -487,19 +487,19 @@  discard block
 block discarded – undo
487 487
 
488 488
         // Extract the database from the archive.
489 489
         try {
490
-			$file      = new PharData( $tmp_archive_path );
490
+            $file      = new PharData( $tmp_archive_path );
491 491
             $file_path = trailingslashit( dirname( $tmp_archive_path ) ) . trailingslashit( $file->current()->getFilename() ) . $database . '.mmdb';
492 492
 
493
-			$file->extractTo(
494
-				dirname( $tmp_archive_path ),
495
-				trailingslashit( $file->current()->getFilename() ) . $database . '.mmdb',
496
-				true
493
+            $file->extractTo(
494
+                dirname( $tmp_archive_path ),
495
+                trailingslashit( $file->current()->getFilename() ) . $database . '.mmdb',
496
+                true
497 497
             );
498 498
 
499
-		} catch ( Exception $exception ) {
500
-			return new WP_Error( 'invoicing_maxmind_geolocation_database_archive', $exception->getMessage() );
501
-		} finally {
502
-			// Remove the archive since we only care about a single file in it.
499
+        } catch ( Exception $exception ) {
500
+            return new WP_Error( 'invoicing_maxmind_geolocation_database_archive', $exception->getMessage() );
501
+        } finally {
502
+            // Remove the archive since we only care about a single file in it.
503 503
             unlink( $tmp_archive_path );
504 504
         }
505 505
 
@@ -1862,7 +1862,7 @@  discard block
 block discarded – undo
1862 1862
         $valid_company = $vies_company && $company && ( $vies_company == '---' || strcasecmp( trim( $vies_company ), trim( $company ) ) == 0 ) ? true : false;
1863 1863
 
1864 1864
         if ( ! $valid_company && ! empty( $wpinv_options['vat_disable_company_name_check'] ) ) {
1865
-           return wp_sprintf(
1865
+            return wp_sprintf(
1866 1866
                 __( 'The company name associated with the %s number provided is not the same as the company name provided.', 'invoicing' ),
1867 1867
                 getpaid_vat_name()
1868 1868
             );
Please login to merge, or discard this patch.
Braces   +7 added lines, -5 removed lines patch added patch discarded remove patch
@@ -712,7 +712,7 @@  discard block
 block discarded – undo
712 712
                 if ( !empty( $load_xml ) && !empty( $load_xml->geoplugin_countryCode ) ) {
713 713
                     $wpinv_ip_address_country = (string)$load_xml->geoplugin_countryCode;
714 714
                 }
715
-            }elseif(!empty( $ip )){
715
+            } elseif(!empty( $ip )){
716 716
                 $url = 'http://ip-api.com/json/' . $ip;
717 717
                 $response = wp_remote_get($url);
718 718
 
@@ -1513,16 +1513,18 @@  discard block
 block discarded – undo
1513 1513
 
1514 1514
         if ( !empty( $tax_rates ) ) {
1515 1515
             foreach ( $tax_rates as $key => $tax_rate ) {
1516
-                if ( $country != $tax_rate['country'] )
1517
-                    continue;
1516
+                if ( $country != $tax_rate['country'] ) {
1517
+                                    continue;
1518
+                }
1518 1519
 
1519 1520
                 if ( !empty( $tax_rate['global'] ) ) {
1520 1521
                     if ( 0 !== $tax_rate['rate'] || !empty( $tax_rate['rate'] ) ) {
1521 1522
                         $rate = number_format( $tax_rate['rate'], 4 );
1522 1523
                     }
1523 1524
                 } else {
1524
-                    if ( empty( $tax_rate['state'] ) || strtolower( $state ) != strtolower( $tax_rate['state'] ) )
1525
-                        continue;
1525
+                    if ( empty( $tax_rate['state'] ) || strtolower( $state ) != strtolower( $tax_rate['state'] ) ) {
1526
+                                            continue;
1527
+                    }
1526 1528
 
1527 1529
                     $state_rate = $tax_rate['rate'];
1528 1530
                     if ( 0 !== $state_rate || !empty( $state_rate ) ) {
Please login to merge, or discard this patch.
Spacing   +624 added lines, -624 removed lines patch added patch discarded remove patch
@@ -4,7 +4,7 @@  discard block
 block discarded – undo
4 4
  *
5 5
  */
6 6
 
7
-defined( 'ABSPATH' ) || exit;
7
+defined('ABSPATH') || exit;
8 8
 
9 9
 class WPInv_EUVat {
10 10
 
@@ -24,128 +24,128 @@  discard block
 block discarded – undo
24 24
     public function init() {
25 25
 
26 26
         // If this is an admin page...
27
-        if ( is_admin() ) {
27
+        if (is_admin()) {
28 28
 
29 29
             // Register our scripts.
30
-            add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_admin_scripts' ) );
31
-            add_action( 'wpinv_settings_sections_taxes', array( $this, 'section_vat_settings' ) );
32
-            add_action( 'wpinv_settings_taxes', array( $this, 'vat_settings' ) );
33
-            add_filter( 'wpinv_settings_taxes-vat_sanitize', array( $this, 'sanitize_vat_settings' ) );
34
-            add_filter( 'wpinv_settings_taxes-vat_rates_sanitize', array( $this, 'sanitize_vat_rates' ) );
35
-            add_action( 'wp_ajax_wpinv_add_vat_class', array( $this, 'add_class' ) );
36
-            add_action( 'wp_ajax_nopriv_wpinv_add_vat_class', array( $this, 'add_class' ) );
37
-            add_action( 'wp_ajax_wpinv_delete_vat_class', array( $this, 'delete_class' ) );
38
-            add_action( 'wp_ajax_nopriv_wpinv_delete_vat_class', array( $this, 'delete_class' ) );
39
-            add_action( 'wp_ajax_wpinv_update_vat_rates', array( $this, 'update_eu_rates' ) );
40
-            add_action( 'wp_ajax_nopriv_wpinv_update_vat_rates', array( $this, 'update_eu_rates' ) );
41
-            add_action( 'wp_ajax_wpinv_geoip2', array( $this, 'geoip2_download_database' ) );
42
-            add_action( 'wp_ajax_nopriv_wpinv_geoip2', array( $this, 'geoip2_download_database' ) );
30
+            add_action('admin_enqueue_scripts', array($this, 'enqueue_admin_scripts'));
31
+            add_action('wpinv_settings_sections_taxes', array($this, 'section_vat_settings'));
32
+            add_action('wpinv_settings_taxes', array($this, 'vat_settings'));
33
+            add_filter('wpinv_settings_taxes-vat_sanitize', array($this, 'sanitize_vat_settings'));
34
+            add_filter('wpinv_settings_taxes-vat_rates_sanitize', array($this, 'sanitize_vat_rates'));
35
+            add_action('wp_ajax_wpinv_add_vat_class', array($this, 'add_class'));
36
+            add_action('wp_ajax_nopriv_wpinv_add_vat_class', array($this, 'add_class'));
37
+            add_action('wp_ajax_wpinv_delete_vat_class', array($this, 'delete_class'));
38
+            add_action('wp_ajax_nopriv_wpinv_delete_vat_class', array($this, 'delete_class'));
39
+            add_action('wp_ajax_wpinv_update_vat_rates', array($this, 'update_eu_rates'));
40
+            add_action('wp_ajax_nopriv_wpinv_update_vat_rates', array($this, 'update_eu_rates'));
41
+            add_action('wp_ajax_wpinv_geoip2', array($this, 'geoip2_download_database'));
42
+            add_action('wp_ajax_nopriv_wpinv_geoip2', array($this, 'geoip2_download_database'));
43 43
         }
44 44
 
45
-        add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_vat_scripts' ) );
46
-        add_filter( 'wpinv_default_billing_country', array( $this, 'get_user_country' ), 10 );
47
-        add_filter( 'wpinv_get_user_country', array( $this, 'set_user_country' ), 10 );
48
-        add_action( 'wp_ajax_wpinv_vat_validate', array( $this, 'ajax_vat_validate' ) );
49
-        add_action( 'wp_ajax_nopriv_wpinv_vat_validate', array( $this, 'ajax_vat_validate' ) );
45
+        add_action('wp_enqueue_scripts', array($this, 'enqueue_vat_scripts'));
46
+        add_filter('wpinv_default_billing_country', array($this, 'get_user_country'), 10);
47
+        add_filter('wpinv_get_user_country', array($this, 'set_user_country'), 10);
48
+        add_action('wp_ajax_wpinv_vat_validate', array($this, 'ajax_vat_validate'));
49
+        add_action('wp_ajax_nopriv_wpinv_vat_validate', array($this, 'ajax_vat_validate'));
50 50
 
51
-        if ( wpinv_use_taxes() && self::allow_vat_rules() ) {
52
-            add_filter( 'wpinv_tax_rate', array( $this, 'get_rate' ), 10, 4 );
51
+        if (wpinv_use_taxes() && self::allow_vat_rules()) {
52
+            add_filter('wpinv_tax_rate', array($this, 'get_rate'), 10, 4);
53 53
         }
54 54
     }
55 55
 
56
-    public static function get_eu_states( $sort = true ) {
57
-        $eu_states = array( 'AT', 'BE', 'BG', 'HR', 'CY', 'CZ', 'DK', 'EE', 'FI', 'FR', 'DE', 'GB', 'GR', 'HU', 'IE', 'IT', 'LV', 'LT', 'LU', 'MT', 'NL', 'PL', 'PT', 'RO', 'SK', 'SI', 'ES', 'SE' );
58
-        if ( $sort ) {
59
-            $sort = sort( $eu_states );
56
+    public static function get_eu_states($sort = true) {
57
+        $eu_states = array('AT', 'BE', 'BG', 'HR', 'CY', 'CZ', 'DK', 'EE', 'FI', 'FR', 'DE', 'GB', 'GR', 'HU', 'IE', 'IT', 'LV', 'LT', 'LU', 'MT', 'NL', 'PL', 'PT', 'RO', 'SK', 'SI', 'ES', 'SE');
58
+        if ($sort) {
59
+            $sort = sort($eu_states);
60 60
         }
61 61
 
62
-        return apply_filters( 'wpinv_get_eu_states', $eu_states, $sort );
62
+        return apply_filters('wpinv_get_eu_states', $eu_states, $sort);
63 63
     }
64 64
 
65
-    public static function get_gst_countries( $sort = true ) {
66
-        $gst_countries  = array( 'AU', 'NZ', 'CA', 'CN' );
65
+    public static function get_gst_countries($sort = true) {
66
+        $gst_countries = array('AU', 'NZ', 'CA', 'CN');
67 67
 
68
-        if ( $sort ) {
69
-            $sort = sort( $gst_countries );
68
+        if ($sort) {
69
+            $sort = sort($gst_countries);
70 70
         }
71 71
 
72
-        return apply_filters( 'wpinv_get_gst_countries', $gst_countries, $sort );
72
+        return apply_filters('wpinv_get_gst_countries', $gst_countries, $sort);
73 73
     }
74 74
 
75
-    public static function is_eu_state( $country_code ) {
76
-        $return = !empty( $country_code ) && in_array( strtoupper( $country_code ), self::get_eu_states() ) ? true : false;
75
+    public static function is_eu_state($country_code) {
76
+        $return = !empty($country_code) && in_array(strtoupper($country_code), self::get_eu_states()) ? true : false;
77 77
 
78
-        return apply_filters( 'wpinv_is_eu_state', $return, $country_code );
78
+        return apply_filters('wpinv_is_eu_state', $return, $country_code);
79 79
     }
80 80
 
81
-    public static function is_gst_country( $country_code ) {
82
-        $return = !empty( $country_code ) && in_array( strtoupper( $country_code ), self::get_gst_countries() ) ? true : false;
81
+    public static function is_gst_country($country_code) {
82
+        $return = !empty($country_code) && in_array(strtoupper($country_code), self::get_gst_countries()) ? true : false;
83 83
 
84
-        return apply_filters( 'wpinv_is_gst_country', $return, $country_code );
84
+        return apply_filters('wpinv_is_gst_country', $return, $country_code);
85 85
     }
86 86
 
87 87
     public function enqueue_vat_scripts() {
88
-        if( wpinv_use_taxes() && wpinv_get_option( 'apply_vat_rules' ) ) {
88
+        if (wpinv_use_taxes() && wpinv_get_option('apply_vat_rules')) {
89 89
             $this->load_vat_scripts();
90 90
         }
91 91
     }
92 92
 
93
-    public function load_vat_scripts(){
94
-        $suffix     = '';//defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
93
+    public function load_vat_scripts() {
94
+        $suffix = ''; //defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
95 95
 
96
-        wp_register_script( 'wpinv-vat-validation-script', WPINV_PLUGIN_URL . 'assets/js/jsvat' . $suffix . '.js', array( 'jquery' ),  WPINV_VERSION );
97
-        wp_register_script( 'wpinv-vat-script', WPINV_PLUGIN_URL . 'assets/js/euvat' . $suffix . '.js', array( 'jquery' ),  WPINV_VERSION );
96
+        wp_register_script('wpinv-vat-validation-script', WPINV_PLUGIN_URL . 'assets/js/jsvat' . $suffix . '.js', array('jquery'), WPINV_VERSION);
97
+        wp_register_script('wpinv-vat-script', WPINV_PLUGIN_URL . 'assets/js/euvat' . $suffix . '.js', array('jquery'), WPINV_VERSION);
98 98
 
99
-        $vat_name   = $this->get_vat_name();
99
+        $vat_name = $this->get_vat_name();
100 100
 
101 101
         $vars = array();
102 102
         $vars['UseTaxes'] = wpinv_use_taxes();
103 103
         $vars['EUStates'] = self::get_eu_states();
104
-        $vars['NoRateSet'] = __( 'You have not set a rate. Do you want to continue?', 'invoicing' );
105
-        $vars['EmptyCompany'] = __( 'Please enter your registered company name!', 'invoicing' );
106
-        $vars['EmptyVAT'] = wp_sprintf( __( 'Please enter your %s number!', 'invoicing' ), $vat_name );
107
-        $vars['TotalsRefreshed'] = wp_sprintf( __( 'The invoice totals will be refreshed to update the %s.', 'invoicing' ), $vat_name );
108
-        $vars['ErrValidateVAT'] = wp_sprintf( __( 'Fail to validate the %s number!', 'invoicing' ), $vat_name );
109
-        $vars['ErrResetVAT'] = wp_sprintf( __( 'Fail to reset the %s number!', 'invoicing' ), $vat_name );
110
-        $vars['ErrInvalidVat'] = wp_sprintf( __( 'The %s number supplied does not have a valid format!', 'invoicing' ), $vat_name );
111
-        $vars['ErrInvalidResponse'] = __( 'An invalid response has been received from the server!', 'invoicing' );
104
+        $vars['NoRateSet'] = __('You have not set a rate. Do you want to continue?', 'invoicing');
105
+        $vars['EmptyCompany'] = __('Please enter your registered company name!', 'invoicing');
106
+        $vars['EmptyVAT'] = wp_sprintf(__('Please enter your %s number!', 'invoicing'), $vat_name);
107
+        $vars['TotalsRefreshed'] = wp_sprintf(__('The invoice totals will be refreshed to update the %s.', 'invoicing'), $vat_name);
108
+        $vars['ErrValidateVAT'] = wp_sprintf(__('Fail to validate the %s number!', 'invoicing'), $vat_name);
109
+        $vars['ErrResetVAT'] = wp_sprintf(__('Fail to reset the %s number!', 'invoicing'), $vat_name);
110
+        $vars['ErrInvalidVat'] = wp_sprintf(__('The %s number supplied does not have a valid format!', 'invoicing'), $vat_name);
111
+        $vars['ErrInvalidResponse'] = __('An invalid response has been received from the server!', 'invoicing');
112 112
         $vars['ApplyVATRules'] = $vars['UseTaxes'] ? self::allow_vat_rules() : false;
113 113
         $vars['HideVatFields'] = $vars['ApplyVATRules'] ? self::hide_vat_fields() : true;
114
-        $vars['ErrResponse'] = __( 'The request response is invalid!', 'invoicing' );
115
-        $vars['ErrRateResponse'] = __( 'The get rate request response is invalid', 'invoicing' );
116
-        $vars['PageRefresh'] = __( 'The page will be refreshed in 10 seconds to show the new options.', 'invoicing' );
117
-        $vars['RequestResponseNotValidJSON'] = __( 'The get rate request response is not valid JSON', 'invoicing' );
118
-        $vars['GetRateRequestFailed'] = __( 'The get rate request failed: ', 'invoicing' );
119
-        $vars['NoRateInformationInResponse'] = __( 'The get rate request response does not contain any rate information', 'invoicing' );
120
-        $vars['RatesUpdated'] = __( 'The rates have been updated. Press the save button to record these new rates.', 'invoicing' );
121
-        $vars['IPAddressInformation'] = __( 'IP Address Information', 'invoicing' );
122
-        $vars['VatValidating'] = wp_sprintf( __( 'Validating %s number...', 'invoicing' ), $vat_name );
123
-        $vars['VatReseting'] = __( 'Reseting...', 'invoicing' );
124
-        $vars['VatValidated'] = wp_sprintf( __( '%s number validated', 'invoicing' ), $vat_name );
125
-        $vars['VatNotValidated'] = wp_sprintf( __( '%s number not validated', 'invoicing' ), $vat_name );
126
-        $vars['ConfirmDeleteClass'] = __( 'Are you sure you wish to delete this rates class?', 'invoicing' );
114
+        $vars['ErrResponse'] = __('The request response is invalid!', 'invoicing');
115
+        $vars['ErrRateResponse'] = __('The get rate request response is invalid', 'invoicing');
116
+        $vars['PageRefresh'] = __('The page will be refreshed in 10 seconds to show the new options.', 'invoicing');
117
+        $vars['RequestResponseNotValidJSON'] = __('The get rate request response is not valid JSON', 'invoicing');
118
+        $vars['GetRateRequestFailed'] = __('The get rate request failed: ', 'invoicing');
119
+        $vars['NoRateInformationInResponse'] = __('The get rate request response does not contain any rate information', 'invoicing');
120
+        $vars['RatesUpdated'] = __('The rates have been updated. Press the save button to record these new rates.', 'invoicing');
121
+        $vars['IPAddressInformation'] = __('IP Address Information', 'invoicing');
122
+        $vars['VatValidating'] = wp_sprintf(__('Validating %s number...', 'invoicing'), $vat_name);
123
+        $vars['VatReseting'] = __('Reseting...', 'invoicing');
124
+        $vars['VatValidated'] = wp_sprintf(__('%s number validated', 'invoicing'), $vat_name);
125
+        $vars['VatNotValidated'] = wp_sprintf(__('%s number not validated', 'invoicing'), $vat_name);
126
+        $vars['ConfirmDeleteClass'] = __('Are you sure you wish to delete this rates class?', 'invoicing');
127 127
         $vars['isFront'] = is_admin() ? false : true;
128 128
         $vars['baseCountry'] = wpinv_get_default_country();
129
-        $vars['disableVATSameCountry'] = ( self::same_country_rule() == 'no' ? true : false );
130
-        $vars['disableVATSimpleCheck'] = wpinv_get_option( 'vat_offline_check' ) ? true : false;
129
+        $vars['disableVATSameCountry'] = (self::same_country_rule() == 'no' ? true : false);
130
+        $vars['disableVATSimpleCheck'] = wpinv_get_option('vat_offline_check') ? true : false;
131 131
 
132
-        wp_enqueue_script( 'wpinv-vat-validation-script' );
133
-        wp_enqueue_script( 'wpinv-vat-script' );
134
-        wp_localize_script( 'wpinv-vat-script', 'WPInv_VAT_Vars', $vars );
132
+        wp_enqueue_script('wpinv-vat-validation-script');
133
+        wp_enqueue_script('wpinv-vat-script');
134
+        wp_localize_script('wpinv-vat-script', 'WPInv_VAT_Vars', $vars);
135 135
     }
136 136
 
137 137
     public static function enqueue_admin_scripts() {
138
-        if( isset( $_GET['page'] ) && 'wpinv-settings' == $_GET['page'] ) {
138
+        if (isset($_GET['page']) && 'wpinv-settings' == $_GET['page']) {
139 139
             self::load_vat_scripts();
140 140
         }
141 141
     }
142 142
 
143
-    public static function section_vat_settings( $sections ) {
144
-        if ( !empty( $sections ) ) {
145
-            $sections['vat'] = __( 'EU VAT Settings', 'invoicing' );
143
+    public static function section_vat_settings($sections) {
144
+        if (!empty($sections)) {
145
+            $sections['vat'] = __('EU VAT Settings', 'invoicing');
146 146
 
147
-            if ( self::allow_vat_classes() ) {
148
-                $sections['vat_rates'] = __( 'EU VAT Rates', 'invoicing' );
147
+            if (self::allow_vat_classes()) {
148
+                $sections['vat_rates'] = __('EU VAT Rates', 'invoicing');
149 149
             }
150 150
         }
151 151
         return $sections;
@@ -154,52 +154,52 @@  discard block
 block discarded – undo
154 154
     public static function vat_rates_settings() {
155 155
         $vat_classes = self::get_rate_classes();
156 156
         $vat_rates = array();
157
-        $vat_class = isset( $_REQUEST['wpi_sub'] ) && $_REQUEST['wpi_sub'] !== '' && isset( $vat_classes[$_REQUEST['wpi_sub']] )? sanitize_text_field( $_REQUEST['wpi_sub'] ) : '_new';
158
-        $current_url = remove_query_arg( 'wpi_sub' );
157
+        $vat_class = isset($_REQUEST['wpi_sub']) && $_REQUEST['wpi_sub'] !== '' && isset($vat_classes[$_REQUEST['wpi_sub']]) ? sanitize_text_field($_REQUEST['wpi_sub']) : '_new';
158
+        $current_url = remove_query_arg('wpi_sub');
159 159
 
160 160
         $vat_rates['vat_rates_header'] = array(
161 161
             'id' => 'vat_rates_header',
162
-            'name' => '<h3>' . __( 'Manage VAT Rates', 'invoicing' ) . '</h3>',
162
+            'name' => '<h3>' . __('Manage VAT Rates', 'invoicing') . '</h3>',
163 163
             'desc' => '',
164 164
             'type' => 'header',
165 165
             'size' => 'regular'
166 166
         );
167 167
         $vat_rates['vat_rates_class'] = array(
168 168
             'id'          => 'vat_rates_class',
169
-            'name'        => __( 'Edit VAT Rates', 'invoicing' ),
170
-            'desc'        => __( 'The standard rate will apply where no explicit rate is provided.', 'invoicing' ),
169
+            'name'        => __('Edit VAT Rates', 'invoicing'),
170
+            'desc'        => __('The standard rate will apply where no explicit rate is provided.', 'invoicing'),
171 171
             'type'        => 'select',
172
-            'options'     => array_merge( $vat_classes, array( '_new' => __( 'Add New Rate Class', 'invoicing' ) ) ),
173
-            'placeholder' => __( 'Select a VAT Rate', 'invoicing' ),
172
+            'options'     => array_merge($vat_classes, array('_new' => __('Add New Rate Class', 'invoicing'))),
173
+            'placeholder' => __('Select a VAT Rate', 'invoicing'),
174 174
             'selected'    => $vat_class,
175 175
             'class'       => 'wpi_select2',
176 176
             'onchange'    => 'document.location.href="' . $current_url . '&wpi_sub=" + this.value;',
177 177
         );
178 178
 
179
-        if ( $vat_class != '_standard' && $vat_class != '_new' ) {
179
+        if ($vat_class != '_standard' && $vat_class != '_new') {
180 180
             $vat_rates['vat_rate_delete'] = array(
181 181
                 'id'   => 'vat_rate_delete',
182 182
                 'type' => 'vat_rate_delete',
183 183
             );
184 184
         }
185 185
 
186
-        if ( $vat_class == '_new' ) {
186
+        if ($vat_class == '_new') {
187 187
             $vat_rates['vat_rates_settings'] = array(
188 188
                 'id' => 'vat_rates_settings',
189
-                'name' => '<h3>' . __( 'Add New Rate Class', 'invoicing' ) . '</h3>',
189
+                'name' => '<h3>' . __('Add New Rate Class', 'invoicing') . '</h3>',
190 190
                 'type' => 'header',
191 191
             );
192 192
             $vat_rates['vat_rate_name'] = array(
193 193
                 'id'   => 'vat_rate_name',
194
-                'name' => __( 'Name', 'invoicing' ),
195
-                'desc' => __( 'A short name for the new VAT Rate class', 'invoicing' ),
194
+                'name' => __('Name', 'invoicing'),
195
+                'desc' => __('A short name for the new VAT Rate class', 'invoicing'),
196 196
                 'type' => 'text',
197 197
                 'size' => 'regular',
198 198
             );
199 199
             $vat_rates['vat_rate_desc'] = array(
200 200
                 'id'   => 'vat_rate_desc',
201
-                'name' => __( 'Description', 'invoicing' ),
202
-                'desc' => __( 'Manage VAT Rate class', 'invoicing' ),
201
+                'name' => __('Description', 'invoicing'),
202
+                'desc' => __('Manage VAT Rate class', 'invoicing'),
203 203
                 'type' => 'text',
204 204
                 'size' => 'regular',
205 205
             );
@@ -211,7 +211,7 @@  discard block
 block discarded – undo
211 211
             $vat_rates['vat_rates'] = array(
212 212
                 'id'   => 'vat_rates',
213 213
                 'name' => '<h3>' . $vat_classes[$vat_class] . '</h3>',
214
-                'desc' => self::get_class_desc( $vat_class ),
214
+                'desc' => self::get_class_desc($vat_class),
215 215
                 'type' => 'vat_rates',
216 216
             );
217 217
         }
@@ -219,12 +219,12 @@  discard block
 block discarded – undo
219 219
         return $vat_rates;
220 220
     }
221 221
 
222
-    public static function vat_settings( $settings ) {
223
-        if ( !empty( $settings ) ) {
222
+    public static function vat_settings($settings) {
223
+        if (!empty($settings)) {
224 224
             $vat_settings = array();
225 225
             $vat_settings['vat_company_title'] = array(
226 226
                 'id' => 'vat_company_title',
227
-                'name' => '<h3>' . __( 'Your Company Details', 'invoicing' ) . '</h3>',
227
+                'name' => '<h3>' . __('Your Company Details', 'invoicing') . '</h3>',
228 228
                 'desc' => '',
229 229
                 'type' => 'header',
230 230
                 'size' => 'regular'
@@ -232,22 +232,22 @@  discard block
 block discarded – undo
232 232
 
233 233
             $vat_settings['vat_company_name'] = array(
234 234
                 'id' => 'vat_company_name',
235
-                'name' => __( 'Your Company Name', 'invoicing' ),
236
-                'desc' => wp_sprintf(__( 'Your company name as it appears on your VAT return, you can verify it via your VAT ID on the %sEU VIES System.%s', 'invoicing' ), '<a href="http://ec.europa.eu/taxation_customs/vies/" target="_blank">', '</a>' ),
235
+                'name' => __('Your Company Name', 'invoicing'),
236
+                'desc' => wp_sprintf(__('Your company name as it appears on your VAT return, you can verify it via your VAT ID on the %sEU VIES System.%s', 'invoicing'), '<a href="http://ec.europa.eu/taxation_customs/vies/" target="_blank">', '</a>'),
237 237
                 'type' => 'text',
238 238
                 'size' => 'regular',
239 239
             );
240 240
 
241 241
             $vat_settings['vat_number'] = array(
242 242
                 'id'   => 'vat_number',
243
-                'name' => __( 'Your VAT Number', 'invoicing' ),
243
+                'name' => __('Your VAT Number', 'invoicing'),
244 244
                 'type' => 'vat_number',
245 245
                 'size' => 'regular',
246 246
             );
247 247
 
248 248
             $vat_settings['vat_settings_title'] = array(
249 249
                 'id' => 'vat_settings_title',
250
-                'name' => '<h3>' . __( 'Apply VAT Settings', 'invoicing' ) . '</h3>',
250
+                'name' => '<h3>' . __('Apply VAT Settings', 'invoicing') . '</h3>',
251 251
                 'desc' => '',
252 252
                 'type' => 'header',
253 253
                 'size' => 'regular'
@@ -255,8 +255,8 @@  discard block
 block discarded – undo
255 255
 
256 256
             $vat_settings['apply_vat_rules'] = array(
257 257
                 'id' => 'apply_vat_rules',
258
-                'name' => __( 'Enable VAT Rules', 'invoicing' ),
259
-                'desc' => __( 'Apply VAT to consumer sales from IP addresses within the EU, even if the billing address is outside the EU.', 'invoicing' ) . '<br><font style="color:red">' . __( 'Do not disable unless you know what you are doing.', 'invoicing' ) . '</font>',
258
+                'name' => __('Enable VAT Rules', 'invoicing'),
259
+                'desc' => __('Apply VAT to consumer sales from IP addresses within the EU, even if the billing address is outside the EU.', 'invoicing') . '<br><font style="color:red">' . __('Do not disable unless you know what you are doing.', 'invoicing') . '</font>',
260 260
                 'type' => 'checkbox',
261 261
                 'std' => '1'
262 262
             );
@@ -272,8 +272,8 @@  discard block
 block discarded – undo
272 272
 
273 273
             $vat_settings['vat_prevent_b2c_purchase'] = array(
274 274
                 'id' => 'vat_prevent_b2c_purchase',
275
-                'name' => __( 'Prevent EU B2C Sales', 'invoicing' ),
276
-                'desc' => __( 'Enable this option if you are not registered for VAT in the EU.', 'invoicing' ),
275
+                'name' => __('Prevent EU B2C Sales', 'invoicing'),
276
+                'desc' => __('Enable this option if you are not registered for VAT in the EU.', 'invoicing'),
277 277
                 'type' => 'checkbox'
278 278
             );
279 279
 
@@ -281,22 +281,22 @@  discard block
 block discarded – undo
281 281
 
282 282
             $vat_settings['vat_same_country_rule'] = array(
283 283
                 'id'          => 'vat_same_country_rule',
284
-                'name'        => __( 'Same Country Rule', 'invoicing' ),
285
-                'desc'        => __( 'Select how you want to handle VAT charge if sales are in the same country as the base country.', 'invoicing' ),
284
+                'name'        => __('Same Country Rule', 'invoicing'),
285
+                'desc'        => __('Select how you want to handle VAT charge if sales are in the same country as the base country.', 'invoicing'),
286 286
                 'type'        => 'select',
287 287
                 'options'     => array(
288
-                    ''          => __( 'Normal', 'invoicing' ),
289
-                    'no'        => __( 'No VAT', 'invoicing' ),
290
-                    'always'    => __( 'Always apply VAT', 'invoicing' ),
288
+                    ''          => __('Normal', 'invoicing'),
289
+                    'no'        => __('No VAT', 'invoicing'),
290
+                    'always'    => __('Always apply VAT', 'invoicing'),
291 291
                 ),
292
-                'placeholder' => __( 'Select an option', 'invoicing' ),
292
+                'placeholder' => __('Select an option', 'invoicing'),
293 293
                 'std'         => '',
294 294
                 'class'   => 'wpi_select2',
295 295
             );
296 296
 
297 297
             $vat_settings['vat_checkout_title'] = array(
298 298
                 'id' => 'vat_checkout_title',
299
-                'name' => '<h3>' . __( 'Checkout Fields', 'invoicing' ) . '</h3>',
299
+                'name' => '<h3>' . __('Checkout Fields', 'invoicing') . '</h3>',
300 300
                 'desc' => '',
301 301
                 'type' => 'header',
302 302
                 'size' => 'regular'
@@ -304,22 +304,22 @@  discard block
 block discarded – undo
304 304
 
305 305
             $vat_settings['vat_disable_fields'] = array(
306 306
                 'id' => 'vat_disable_fields',
307
-                'name' => __( 'Disable VAT Fields', 'invoicing' ),
308
-                'desc' => __( 'Disable VAT fields if Invoicing is being used for GST.', 'invoicing' ) . '<br><font style="color:red">' . __( 'Do not disable if you have enabled Prevent EU B2C sales, otherwise Prevent EU B2C sales setting will not work.', 'invoicing' ) . '</font>',
307
+                'name' => __('Disable VAT Fields', 'invoicing'),
308
+                'desc' => __('Disable VAT fields if Invoicing is being used for GST.', 'invoicing') . '<br><font style="color:red">' . __('Do not disable if you have enabled Prevent EU B2C sales, otherwise Prevent EU B2C sales setting will not work.', 'invoicing') . '</font>',
309 309
                 'type' => 'checkbox'
310 310
             );
311 311
 
312 312
             $vat_settings['maxmind_license_key'] = array(
313 313
                 'id'   => 'maxmind_license_key',
314
-                'name' => __( 'MaxMind License Key', 'invoicing' ),
314
+                'name' => __('MaxMind License Key', 'invoicing'),
315 315
                 'type' => 'text',
316 316
                 'size' => 'regular',
317
-                'desc' => '<a href="https://support.maxmind.com/account-faq/license-keys/how-do-i-generate-a-license-key/">' . __( 'The key that will be used when dealing with MaxMind Geolocation services.', 'invoicing' ) . '</a>',
317
+                'desc' => '<a href="https://support.maxmind.com/account-faq/license-keys/how-do-i-generate-a-license-key/">' . __('The key that will be used when dealing with MaxMind Geolocation services.', 'invoicing') . '</a>',
318 318
             );
319 319
 
320 320
             $vat_settings['vat_ip_lookup'] = array(
321 321
                 'id'   => 'vat_ip_lookup',
322
-                'name' => __( 'IP Country Look-up', 'invoicing' ),
322
+                'name' => __('IP Country Look-up', 'invoicing'),
323 323
                 'type' => 'vat_ip_lookup',
324 324
                 'size' => 'regular',
325 325
                 'std' => 'default',
@@ -328,14 +328,14 @@  discard block
 block discarded – undo
328 328
 
329 329
             $vat_settings['vat_ip_country_default'] = array(
330 330
                 'id' => 'vat_ip_country_default',
331
-                'name' => __( 'Enable IP Country as Default', 'invoicing' ),
332
-                'desc' => __( 'Show the country of the users IP as the default country, otherwise the site default country will be used.', 'invoicing' ),
331
+                'name' => __('Enable IP Country as Default', 'invoicing'),
332
+                'desc' => __('Show the country of the users IP as the default country, otherwise the site default country will be used.', 'invoicing'),
333 333
                 'type' => 'checkbox'
334 334
             );
335 335
 
336 336
             $vat_settings['vies_validation_title'] = array(
337 337
                 'id' => 'vies_validation_title',
338
-                'name' => '<h3>' . __( 'VIES Validation', 'invoicing' ) . '</h3>',
338
+                'name' => '<h3>' . __('VIES Validation', 'invoicing') . '</h3>',
339 339
                 'desc' => '',
340 340
                 'type' => 'header',
341 341
                 'size' => 'regular'
@@ -343,37 +343,37 @@  discard block
 block discarded – undo
343 343
 
344 344
             $vat_settings['vat_vies_check'] = array(
345 345
                 'id' => 'vat_vies_check',
346
-                'name' => __( 'Disable VIES VAT ID Check', 'invoicing' ),
347
-                'desc' => wp_sprintf( __( 'Prevent VAT numbers from being validated by the %sEU VIES System.%s', 'invoicing' ), '<a href="http://ec.europa.eu/taxation_customs/vies/" target="_blank">', '</a>' ),
346
+                'name' => __('Disable VIES VAT ID Check', 'invoicing'),
347
+                'desc' => wp_sprintf(__('Prevent VAT numbers from being validated by the %sEU VIES System.%s', 'invoicing'), '<a href="http://ec.europa.eu/taxation_customs/vies/" target="_blank">', '</a>'),
348 348
                 'type' => 'checkbox'
349 349
             );
350 350
 
351 351
             $vat_settings['vat_disable_company_name_check'] = array(
352 352
                 'id' => 'vat_disable_company_name_check',
353
-                'name' => __( 'Disable VIES Name Check', 'invoicing' ),
354
-                'desc' => wp_sprintf( __( 'Prevent company name from being validated by the %sEU VIES System.%s', 'invoicing' ), '<a href="http://ec.europa.eu/taxation_customs/vies/" target="_blank">', '</a>' ),
353
+                'name' => __('Disable VIES Name Check', 'invoicing'),
354
+                'desc' => wp_sprintf(__('Prevent company name from being validated by the %sEU VIES System.%s', 'invoicing'), '<a href="http://ec.europa.eu/taxation_customs/vies/" target="_blank">', '</a>'),
355 355
                 'type' => 'checkbox'
356 356
             );
357 357
 
358 358
             $vat_settings['vat_offline_check'] = array(
359 359
                 'id' => 'vat_offline_check',
360
-                'name' => __( 'Disable Basic Checks', 'invoicing' ),
361
-                'desc' => __( 'Disable basic JS checks for correct format of VAT number. (Not Recommended)', 'invoicing' ),
360
+                'name' => __('Disable Basic Checks', 'invoicing'),
361
+                'desc' => __('Disable basic JS checks for correct format of VAT number. (Not Recommended)', 'invoicing'),
362 362
                 'type' => 'checkbox'
363 363
             );
364 364
 
365 365
 
366 366
             $settings['vat'] = $vat_settings;
367 367
 
368
-            if ( self::allow_vat_classes() ) {
368
+            if (self::allow_vat_classes()) {
369 369
                 $settings['vat_rates'] = self::vat_rates_settings();
370 370
             }
371 371
 
372 372
             $eu_fallback_rate = array(
373 373
                 'id'   => 'eu_fallback_rate',
374
-                'name' => '<h3>' . __( 'VAT rate for EU member states', 'invoicing' ) . '</h3>',
374
+                'name' => '<h3>' . __('VAT rate for EU member states', 'invoicing') . '</h3>',
375 375
                 'type' => 'eu_fallback_rate',
376
-                'desc' => __( 'Enter the VAT rate to be charged for EU member states. You can edit the rates for each member state when a country rate has been set up by pressing this button.', 'invoicing' ),
376
+                'desc' => __('Enter the VAT rate to be charged for EU member states. You can edit the rates for each member state when a country rate has been set up by pressing this button.', 'invoicing'),
377 377
                 'std'  => '20',
378 378
                 'size' => 'small'
379 379
             );
@@ -388,7 +388,7 @@  discard block
 block discarded – undo
388 388
      */
389 389
     public static function maxmind_folder() {
390 390
 
391
-        $upload_dir      = wp_upload_dir();
391
+        $upload_dir = wp_upload_dir();
392 392
         return $upload_dir['basedir'] . '/invoicing';
393 393
 
394 394
     }
@@ -405,39 +405,39 @@  discard block
 block discarded – undo
405 405
 		WP_Filesystem();
406 406
         global $wp_filesystem;
407 407
 
408
-        $license_key = wpinv_get_option( 'maxmind_license_key' );
408
+        $license_key = wpinv_get_option('maxmind_license_key');
409 409
 
410
-        if ( empty( $license_key ) ) {
411
-            echo __( 'Please enter your MaxMind license key then save the settings first before downloading the databases.', 'invoicing' );
410
+        if (empty($license_key)) {
411
+            echo __('Please enter your MaxMind license key then save the settings first before downloading the databases.', 'invoicing');
412 412
             exit;
413 413
         }
414 414
 
415 415
         // The database files that we will download.
416
-        $database_files     = array( 'GeoLite2-Country', 'GeoLite2-City' );
416
+        $database_files = array('GeoLite2-Country', 'GeoLite2-City');
417 417
 
418 418
         // The destination dir of all databases.
419 419
         $destination_dir = self::maxmind_folder();
420 420
 
421
-        if ( ! $wp_filesystem->is_dir( $destination_dir ) ) {
422
-            $wp_filesystem->mkdir( $destination_dir );
421
+        if (!$wp_filesystem->is_dir($destination_dir)) {
422
+            $wp_filesystem->mkdir($destination_dir);
423 423
         }
424 424
 
425
-        foreach( $database_files as $database ) {
425
+        foreach ($database_files as $database) {
426 426
 
427
-            $database_path = self::geoip2_download_file( $license_key, $database );
428
-            $target_path   = trailingslashit( $destination_dir ) .  $database . '.mmdb';
427
+            $database_path = self::geoip2_download_file($license_key, $database);
428
+            $target_path   = trailingslashit($destination_dir) . $database . '.mmdb';
429 429
 
430
-            if ( is_wp_error( $database_path ) ) {
430
+            if (is_wp_error($database_path)) {
431 431
                 echo $database_path->get_error_message();
432 432
                 exit;
433 433
             }
434 434
 
435 435
             // Move the new database into position.
436
-		    $wp_filesystem->move( $database_path, $target_path, true );
437
-            $wp_filesystem->delete( dirname( $database_path ) );
436
+		    $wp_filesystem->move($database_path, $target_path, true);
437
+            $wp_filesystem->delete(dirname($database_path));
438 438
 
439
-            wpinv_update_option( 'wpinv_geoip2_date_updated', current_time( 'timestamp' ) );
440
-            echo sprintf( __( 'GeoIP2 %s database updated successfully.', 'invoicing' ), $database ) . ' ';
439
+            wpinv_update_option('wpinv_geoip2_date_updated', current_time('timestamp'));
440
+            echo sprintf(__('GeoIP2 %s database updated successfully.', 'invoicing'), $database) . ' ';
441 441
         }
442 442
 
443 443
         exit;
@@ -448,12 +448,12 @@  discard block
 block discarded – undo
448 448
      *
449 449
      * @return string|WP_Error
450 450
      */
451
-    public static function geoip2_download_file( $license_key, $database ) {
451
+    public static function geoip2_download_file($license_key, $database) {
452 452
 
453 453
         // The download URI of the database.
454 454
         $source_url = add_query_arg(
455 455
 			array(
456
-                'license_key' => urlencode( sanitize_text_field( $license_key ) ),
456
+                'license_key' => urlencode(sanitize_text_field($license_key)),
457 457
                 'edition_id'  => $database,
458 458
 				'suffix'      => 'tar.gz',
459 459
 			),
@@ -464,54 +464,54 @@  discard block
 block discarded – undo
464 464
 		require_once ABSPATH . 'wp-admin/includes/file.php';
465 465
 
466 466
         // Download the file.
467
-        $tmp_archive_path = download_url( esc_url_raw( $source_url ) );
467
+        $tmp_archive_path = download_url(esc_url_raw($source_url));
468 468
 
469 469
         // Did we encounter an error?
470
-        if ( is_wp_error( $tmp_archive_path ) ) {
470
+        if (is_wp_error($tmp_archive_path)) {
471 471
 
472 472
             // Transform the error into something more informative.
473 473
 			$error_data = $tmp_archive_path->get_error_data();
474
-			if ( isset( $error_data['code'] ) ) {
475
-				switch ( $error_data['code'] ) {
474
+			if (isset($error_data['code'])) {
475
+				switch ($error_data['code']) {
476 476
 					case 401:
477 477
 						return new WP_Error(
478 478
 							'invoicing_maxmind_geolocation_database_license_key',
479
-							__( 'The MaxMind license key is invalid. If you have recently created this key, you may need to wait for it to become active.', 'invoicing' )
479
+							__('The MaxMind license key is invalid. If you have recently created this key, you may need to wait for it to become active.', 'invoicing')
480 480
 						);
481 481
 				}
482 482
 			}
483 483
 
484
-            return new WP_Error( 'invoicing_maxmind_geolocation_database_download', __( 'Failed to download the MaxMind database.', 'invoicing' ) );
484
+            return new WP_Error('invoicing_maxmind_geolocation_database_download', __('Failed to download the MaxMind database.', 'invoicing'));
485 485
 
486 486
         }
487 487
 
488 488
         // Extract the database from the archive.
489 489
         try {
490
-			$file      = new PharData( $tmp_archive_path );
491
-            $file_path = trailingslashit( dirname( $tmp_archive_path ) ) . trailingslashit( $file->current()->getFilename() ) . $database . '.mmdb';
490
+			$file = new PharData($tmp_archive_path);
491
+            $file_path = trailingslashit(dirname($tmp_archive_path)) . trailingslashit($file->current()->getFilename()) . $database . '.mmdb';
492 492
 
493 493
 			$file->extractTo(
494
-				dirname( $tmp_archive_path ),
495
-				trailingslashit( $file->current()->getFilename() ) . $database . '.mmdb',
494
+				dirname($tmp_archive_path),
495
+				trailingslashit($file->current()->getFilename()) . $database . '.mmdb',
496 496
 				true
497 497
             );
498 498
 
499
-		} catch ( Exception $exception ) {
500
-			return new WP_Error( 'invoicing_maxmind_geolocation_database_archive', $exception->getMessage() );
499
+		} catch (Exception $exception) {
500
+			return new WP_Error('invoicing_maxmind_geolocation_database_archive', $exception->getMessage());
501 501
 		} finally {
502 502
 			// Remove the archive since we only care about a single file in it.
503
-            unlink( $tmp_archive_path );
503
+            unlink($tmp_archive_path);
504 504
         }
505 505
 
506 506
         return $file_path;
507 507
     }
508 508
 
509 509
     public static function load_geoip2() {
510
-        if ( defined( 'WPINV_GEOIP2_LODDED' ) ) {
510
+        if (defined('WPINV_GEOIP2_LODDED')) {
511 511
             return;
512 512
         }
513 513
 
514
-        if ( !class_exists( '\MaxMind\Db\Reader' ) ) {
514
+        if (!class_exists('\MaxMind\Db\Reader')) {
515 515
             $maxmind_db_files = array(
516 516
                 'Reader/Decoder.php',
517 517
                 'Reader/InvalidDatabaseException.php',
@@ -520,12 +520,12 @@  discard block
 block discarded – undo
520 520
                 'Reader.php',
521 521
             );
522 522
 
523
-            foreach ( $maxmind_db_files as $key => $file ) {
524
-                require_once( WPINV_PLUGIN_DIR . 'includes/libraries/MaxMind/Db/' . $file );
523
+            foreach ($maxmind_db_files as $key => $file) {
524
+                require_once(WPINV_PLUGIN_DIR . 'includes/libraries/MaxMind/Db/' . $file);
525 525
             }
526 526
         }
527 527
 
528
-        if ( !class_exists( '\GeoIp2\Database\Reader' ) ) {
528
+        if (!class_exists('\GeoIp2\Database\Reader')) {
529 529
             $geoip2_files = array(
530 530
                 'ProviderInterface.php',
531 531
                 'Compat/JsonSerializable.php',
@@ -559,23 +559,23 @@  discard block
 block discarded – undo
559 559
                 'WebService/Client.php',
560 560
             );
561 561
 
562
-            foreach ( $geoip2_files as $key => $file ) {
563
-                require_once( WPINV_PLUGIN_DIR . 'includes/libraries/GeoIp2/' . $file );
562
+            foreach ($geoip2_files as $key => $file) {
563
+                require_once(WPINV_PLUGIN_DIR . 'includes/libraries/GeoIp2/' . $file);
564 564
             }
565 565
         }
566 566
 
567
-        define( 'WPINV_GEOIP2_LODDED', true );
567
+        define('WPINV_GEOIP2_LODDED', true);
568 568
     }
569 569
 
570 570
     public static function geoip2_country_dbfile() {
571 571
         $upload_dir = wp_upload_dir();
572 572
 
573
-        if ( !isset( $upload_dir['basedir'] ) ) {
573
+        if (!isset($upload_dir['basedir'])) {
574 574
             return false;
575 575
         }
576 576
 
577 577
         $filename = $upload_dir['basedir'] . '/invoicing/GeoLite2-Country.mmdb';
578
-        if ( !file_exists( $filename ) ) {
578
+        if (!file_exists($filename)) {
579 579
             return false;
580 580
         }
581 581
 
@@ -585,12 +585,12 @@  discard block
 block discarded – undo
585 585
     public static function geoip2_city_dbfile() {
586 586
         $upload_dir = wp_upload_dir();
587 587
 
588
-        if ( !isset( $upload_dir['basedir'] ) ) {
588
+        if (!isset($upload_dir['basedir'])) {
589 589
             return false;
590 590
         }
591 591
 
592 592
         $filename = $upload_dir['basedir'] . '/invoicing/GeoLite2-City.mmdb';
593
-        if ( !file_exists( $filename ) ) {
593
+        if (!file_exists($filename)) {
594 594
             return false;
595 595
         }
596 596
 
@@ -601,10 +601,10 @@  discard block
 block discarded – undo
601 601
         try {
602 602
             self::load_geoip2();
603 603
 
604
-            if ( $filename = self::geoip2_country_dbfile() ) {
605
-                return new \GeoIp2\Database\Reader( $filename );
604
+            if ($filename = self::geoip2_country_dbfile()) {
605
+                return new \GeoIp2\Database\Reader($filename);
606 606
             }
607
-        } catch( Exception $e ) {
607
+        } catch (Exception $e) {
608 608
             return false;
609 609
         }
610 610
 
@@ -615,183 +615,183 @@  discard block
 block discarded – undo
615 615
         try {
616 616
             self::load_geoip2();
617 617
 
618
-            if ( $filename = self::geoip2_city_dbfile() ) {
619
-                return new \GeoIp2\Database\Reader( $filename );
618
+            if ($filename = self::geoip2_city_dbfile()) {
619
+                return new \GeoIp2\Database\Reader($filename);
620 620
             }
621
-        } catch( Exception $e ) {
621
+        } catch (Exception $e) {
622 622
             return false;
623 623
         }
624 624
 
625 625
         return false;
626 626
     }
627 627
 
628
-    public static function geoip2_country_record( $ip_address ) {
628
+    public static function geoip2_country_record($ip_address) {
629 629
         try {
630 630
             $reader = self::geoip2_country_reader();
631 631
 
632
-            if ( $reader ) {
633
-                $record = $reader->country( $ip_address );
632
+            if ($reader) {
633
+                $record = $reader->country($ip_address);
634 634
 
635
-                if ( !empty( $record->country->isoCode ) ) {
635
+                if (!empty($record->country->isoCode)) {
636 636
                     return $record;
637 637
                 }
638 638
             }
639
-        } catch(\InvalidArgumentException $e) {
640
-            wpinv_error_log( $e->getMessage(), 'GeoIp2 Lookup( ' . $ip_address . ' )' );
639
+        } catch (\InvalidArgumentException $e) {
640
+            wpinv_error_log($e->getMessage(), 'GeoIp2 Lookup( ' . $ip_address . ' )');
641 641
 
642 642
             return false;
643
-        } catch(\GeoIp2\Exception\AddressNotFoundException $e) {
644
-            wpinv_error_log( $e->getMessage(), 'GeoIp2 Lookup( ' . $ip_address . ' )' );
643
+        } catch (\GeoIp2\Exception\AddressNotFoundException $e) {
644
+            wpinv_error_log($e->getMessage(), 'GeoIp2 Lookup( ' . $ip_address . ' )');
645 645
 
646 646
             return false;
647
-        } catch( Exception $e ) {
647
+        } catch (Exception $e) {
648 648
             return false;
649 649
         }
650 650
 
651 651
         return false;
652 652
     }
653 653
 
654
-    public static function geoip2_city_record( $ip_address ) {
654
+    public static function geoip2_city_record($ip_address) {
655 655
         try {
656 656
             $reader = self::geoip2_city_reader();
657 657
 
658
-            if ( $reader ) {
659
-                $record = $reader->city( $ip_address );
658
+            if ($reader) {
659
+                $record = $reader->city($ip_address);
660 660
 
661
-                if ( !empty( $record->country->isoCode ) ) {
661
+                if (!empty($record->country->isoCode)) {
662 662
                     return $record;
663 663
                 }
664 664
             }
665
-        } catch(\InvalidArgumentException $e) {
666
-            wpinv_error_log( $e->getMessage(), 'GeoIp2 Lookup( ' . $ip_address . ' )' );
665
+        } catch (\InvalidArgumentException $e) {
666
+            wpinv_error_log($e->getMessage(), 'GeoIp2 Lookup( ' . $ip_address . ' )');
667 667
 
668 668
             return false;
669
-        } catch(\GeoIp2\Exception\AddressNotFoundException $e) {
670
-            wpinv_error_log( $e->getMessage(), 'GeoIp2 Lookup( ' . $ip_address . ' )' );
669
+        } catch (\GeoIp2\Exception\AddressNotFoundException $e) {
670
+            wpinv_error_log($e->getMessage(), 'GeoIp2 Lookup( ' . $ip_address . ' )');
671 671
 
672 672
             return false;
673
-        } catch( Exception $e ) {
673
+        } catch (Exception $e) {
674 674
             return false;
675 675
         }
676 676
 
677 677
         return false;
678 678
     }
679 679
 
680
-    public static function geoip2_country_code( $ip_address ) {
681
-        $record = self::geoip2_country_record( $ip_address );
682
-        return !empty( $record->country->isoCode ) ? $record->country->isoCode : wpinv_get_default_country();
680
+    public static function geoip2_country_code($ip_address) {
681
+        $record = self::geoip2_country_record($ip_address);
682
+        return !empty($record->country->isoCode) ? $record->country->isoCode : wpinv_get_default_country();
683 683
     }
684 684
 
685 685
     // Find country by IP address.
686
-    public static function get_country_by_ip( $ip = '' ) {
686
+    public static function get_country_by_ip($ip = '') {
687 687
         global $wpinv_ip_address_country;
688 688
         return '';
689
-        if ( !empty( $wpinv_ip_address_country ) ) {
689
+        if (!empty($wpinv_ip_address_country)) {
690 690
             return $wpinv_ip_address_country;
691 691
         }
692 692
 
693
-        if ( empty( $ip ) ) {
693
+        if (empty($ip)) {
694 694
             $ip = wpinv_get_ip();
695 695
         }
696 696
 
697
-        $ip_country_service = wpinv_get_option( 'vat_ip_lookup' );
698
-        $is_default         = empty( $ip_country_service ) || $ip_country_service === 'default' ? true : false;
697
+        $ip_country_service = wpinv_get_option('vat_ip_lookup');
698
+        $is_default         = empty($ip_country_service) || $ip_country_service === 'default' ? true : false;
699 699
 
700
-        if ( !empty( $ip ) && $ip !== '127.0.0.1' ) { // For 127.0.0.1(localhost) use default country.
701
-            if ( function_exists( 'geoip_country_code_by_name') && ( $ip_country_service === 'geoip' || $is_default ) ) {
700
+        if (!empty($ip) && $ip !== '127.0.0.1') { // For 127.0.0.1(localhost) use default country.
701
+            if (function_exists('geoip_country_code_by_name') && ($ip_country_service === 'geoip' || $is_default)) {
702 702
                 try {
703
-                    $wpinv_ip_address_country = geoip_country_code_by_name( $ip );
704
-                } catch( Exception $e ) {
705
-                    wpinv_error_log( $e->getMessage(), 'GeoIP Lookup( ' . $ip . ' )' );
703
+                    $wpinv_ip_address_country = geoip_country_code_by_name($ip);
704
+                } catch (Exception $e) {
705
+                    wpinv_error_log($e->getMessage(), 'GeoIP Lookup( ' . $ip . ' )');
706 706
                 }
707
-            } else if ( self::geoip2_country_dbfile() && ( $ip_country_service === 'geoip2' || $is_default ) ) {
708
-                $wpinv_ip_address_country = self::geoip2_country_code( $ip );
709
-            } else if ( function_exists( 'simplexml_load_file' ) && ini_get('allow_url_fopen') && ( $ip_country_service === 'geoplugin' || $is_default ) ) {
710
-                $load_xml = simplexml_load_file( 'http://www.geoplugin.net/xml.gp?ip=' . $ip );
707
+            } else if (self::geoip2_country_dbfile() && ($ip_country_service === 'geoip2' || $is_default)) {
708
+                $wpinv_ip_address_country = self::geoip2_country_code($ip);
709
+            } else if (function_exists('simplexml_load_file') && ini_get('allow_url_fopen') && ($ip_country_service === 'geoplugin' || $is_default)) {
710
+                $load_xml = simplexml_load_file('http://www.geoplugin.net/xml.gp?ip=' . $ip);
711 711
 
712
-                if ( !empty( $load_xml ) && !empty( $load_xml->geoplugin_countryCode ) ) {
713
-                    $wpinv_ip_address_country = (string)$load_xml->geoplugin_countryCode;
712
+                if (!empty($load_xml) && !empty($load_xml->geoplugin_countryCode)) {
713
+                    $wpinv_ip_address_country = (string) $load_xml->geoplugin_countryCode;
714 714
                 }
715
-            }elseif(!empty( $ip )){
715
+            }elseif (!empty($ip)) {
716 716
                 $url = 'http://ip-api.com/json/' . $ip;
717 717
                 $response = wp_remote_get($url);
718 718
 
719
-                if ( is_array( $response ) && wp_remote_retrieve_response_code( $response ) == '200' ) {
720
-                    $data = json_decode(wp_remote_retrieve_body( $response ),true);
721
-                    if(!empty($data['countryCode'])){
722
-                        $wpinv_ip_address_country = (string)$data['countryCode'];
719
+                if (is_array($response) && wp_remote_retrieve_response_code($response) == '200') {
720
+                    $data = json_decode(wp_remote_retrieve_body($response), true);
721
+                    if (!empty($data['countryCode'])) {
722
+                        $wpinv_ip_address_country = (string) $data['countryCode'];
723 723
                     }
724 724
                 }
725 725
             }
726 726
         }
727 727
 
728
-        if ( empty( $wpinv_ip_address_country ) ) {
728
+        if (empty($wpinv_ip_address_country)) {
729 729
             $wpinv_ip_address_country = wpinv_get_default_country();
730 730
         }
731 731
 
732 732
         return $wpinv_ip_address_country;
733 733
     }
734 734
 
735
-    public static function sanitize_vat_settings( $input ) {
735
+    public static function sanitize_vat_settings($input) {
736 736
         global $wpinv_options;
737 737
 
738 738
         $valid      = false;
739 739
         $message    = '';
740 740
 
741
-        if ( !empty( $wpinv_options['vat_vies_check'] ) ) {
742
-            if ( empty( $wpinv_options['vat_offline_check'] ) ) {
743
-                $valid = self::offline_check( $input['vat_number'] );
741
+        if (!empty($wpinv_options['vat_vies_check'])) {
742
+            if (empty($wpinv_options['vat_offline_check'])) {
743
+                $valid = self::offline_check($input['vat_number']);
744 744
             } else {
745 745
                 $valid = true;
746 746
             }
747 747
 
748
-            $message = $valid ? '' : __( 'VAT number not validated', 'invoicing' );
748
+            $message = $valid ? '' : __('VAT number not validated', 'invoicing');
749 749
         } else {
750
-            $result = self::check_vat( $input['vat_number'] );
750
+            $result = self::check_vat($input['vat_number']);
751 751
 
752
-            if ( empty( $result['valid'] ) ) {
752
+            if (empty($result['valid'])) {
753 753
                 $valid      = false;
754 754
                 $message    = $result['message'];
755 755
             } else {
756
-                $valid      = ( isset( $result['company'] ) && ( $result['company'] == '---' || ( strcasecmp( trim( $result['company'] ), trim( $input['vat_company_name'] ) ) == 0 ) ) ) || !empty( $wpinv_options['vat_disable_company_name_check'] );
757
-                $message    = $valid ? '' : __( 'The company name associated with the VAT number provided is not the same as the company name provided.', 'invoicing' );
756
+                $valid      = (isset($result['company']) && ($result['company'] == '---' || (strcasecmp(trim($result['company']), trim($input['vat_company_name'])) == 0))) || !empty($wpinv_options['vat_disable_company_name_check']);
757
+                $message    = $valid ? '' : __('The company name associated with the VAT number provided is not the same as the company name provided.', 'invoicing');
758 758
             }
759 759
         }
760 760
 
761
-        if ( $message && self::is_vat_validated() != $valid ) {
762
-            add_settings_error( 'wpinv-notices', '', $message, ( $valid ? 'updated' : 'error' ) );
761
+        if ($message && self::is_vat_validated() != $valid) {
762
+            add_settings_error('wpinv-notices', '', $message, ($valid ? 'updated' : 'error'));
763 763
         }
764 764
 
765 765
         $input['vat_valid'] = $valid;
766 766
         return $input;
767 767
     }
768 768
 
769
-    public static function sanitize_vat_rates( $input ) {
770
-        if( !wpinv_current_user_can_manage_invoicing() ) {
771
-            add_settings_error( 'wpinv-notices', '', __( 'Your account does not have permission to add rate classes.', 'invoicing' ), 'error' );
769
+    public static function sanitize_vat_rates($input) {
770
+        if (!wpinv_current_user_can_manage_invoicing()) {
771
+            add_settings_error('wpinv-notices', '', __('Your account does not have permission to add rate classes.', 'invoicing'), 'error');
772 772
             return $input;
773 773
         }
774 774
 
775 775
         $vat_classes = self::get_rate_classes();
776
-        $vat_class = !empty( $_REQUEST['wpi_vat_class'] ) && isset( $vat_classes[$_REQUEST['wpi_vat_class']] )? sanitize_text_field( $_REQUEST['wpi_vat_class'] ) : '';
776
+        $vat_class = !empty($_REQUEST['wpi_vat_class']) && isset($vat_classes[$_REQUEST['wpi_vat_class']]) ? sanitize_text_field($_REQUEST['wpi_vat_class']) : '';
777 777
 
778
-        if ( empty( $vat_class ) ) {
779
-            add_settings_error( 'wpinv-notices', '', __( 'No valid VAT rates class contained in the request to save rates.', 'invoicing' ), 'error' );
778
+        if (empty($vat_class)) {
779
+            add_settings_error('wpinv-notices', '', __('No valid VAT rates class contained in the request to save rates.', 'invoicing'), 'error');
780 780
 
781 781
             return $input;
782 782
         }
783 783
 
784
-        $new_rates = ! empty( $_POST['vat_rates'] ) ? array_values( $_POST['vat_rates'] ) : array();
784
+        $new_rates = !empty($_POST['vat_rates']) ? array_values($_POST['vat_rates']) : array();
785 785
 
786
-        if ( $vat_class === '_standard' ) {
786
+        if ($vat_class === '_standard') {
787 787
             // Save the active rates in the invoice settings
788
-            update_option( 'wpinv_tax_rates', $new_rates );
788
+            update_option('wpinv_tax_rates', $new_rates);
789 789
         } else {
790 790
             // Get the existing set of rates
791 791
             $rates = self::get_non_standard_rates();
792 792
             $rates[$vat_class] = $new_rates;
793 793
 
794
-            update_option( 'wpinv_vat_rates', $rates );
794
+            update_option('wpinv_vat_rates', $rates);
795 795
         }
796 796
 
797 797
         return $input;
@@ -801,71 +801,71 @@  discard block
 block discarded – undo
801 801
         $response = array();
802 802
         $response['success'] = false;
803 803
 
804
-        if ( !wpinv_current_user_can_manage_invoicing() ) {
805
-            $response['error'] = __( 'Invalid access!', 'invoicing' );
806
-            wp_send_json( $response );
804
+        if (!wpinv_current_user_can_manage_invoicing()) {
805
+            $response['error'] = __('Invalid access!', 'invoicing');
806
+            wp_send_json($response);
807 807
         }
808 808
 
809
-        $vat_class_name = !empty( $_POST['name'] ) ? sanitize_text_field( $_POST['name'] ) : false;
810
-        $vat_class_desc = !empty( $_POST['desc'] ) ? sanitize_text_field( $_POST['desc'] ) : false;
809
+        $vat_class_name = !empty($_POST['name']) ? sanitize_text_field($_POST['name']) : false;
810
+        $vat_class_desc = !empty($_POST['desc']) ? sanitize_text_field($_POST['desc']) : false;
811 811
 
812
-        if ( empty( $vat_class_name ) ) {
813
-            $response['error'] = __( 'Select the VAT rate name', 'invoicing' );
814
-            wp_send_json( $response );
812
+        if (empty($vat_class_name)) {
813
+            $response['error'] = __('Select the VAT rate name', 'invoicing');
814
+            wp_send_json($response);
815 815
         }
816 816
 
817
-        $vat_classes = (array)self::get_rate_classes();
817
+        $vat_classes = (array) self::get_rate_classes();
818 818
 
819
-        if ( !empty( $vat_classes ) && in_array( strtolower( $vat_class_name ), array_map( 'strtolower', array_values( $vat_classes ) ) ) ) {
820
-            $response['error'] = wp_sprintf( __( 'A VAT Rate name "%s" already exists', 'invoicing' ), $vat_class_name );
821
-            wp_send_json( $response );
819
+        if (!empty($vat_classes) && in_array(strtolower($vat_class_name), array_map('strtolower', array_values($vat_classes)))) {
820
+            $response['error'] = wp_sprintf(__('A VAT Rate name "%s" already exists', 'invoicing'), $vat_class_name);
821
+            wp_send_json($response);
822 822
         }
823 823
 
824
-        $rate_class_key = normalize_whitespace( 'wpi-' . $vat_class_name );
825
-        $rate_class_key = sanitize_key( str_replace( " ", "-", $rate_class_key ) );
824
+        $rate_class_key = normalize_whitespace('wpi-' . $vat_class_name);
825
+        $rate_class_key = sanitize_key(str_replace(" ", "-", $rate_class_key));
826 826
 
827
-        $vat_classes = (array)self::get_rate_classes( true );
828
-        $vat_classes[$rate_class_key] = array( 'name' => $vat_class_name, 'desc' => $vat_class_desc );
827
+        $vat_classes = (array) self::get_rate_classes(true);
828
+        $vat_classes[$rate_class_key] = array('name' => $vat_class_name, 'desc' => $vat_class_desc);
829 829
 
830
-        update_option( '_wpinv_vat_rate_classes', $vat_classes );
830
+        update_option('_wpinv_vat_rate_classes', $vat_classes);
831 831
 
832 832
         $response['success'] = true;
833
-        $response['redirect'] = admin_url( 'admin.php?page=wpinv-settings&tab=taxes&section=vat_rates&wpi_sub=' . $rate_class_key );
833
+        $response['redirect'] = admin_url('admin.php?page=wpinv-settings&tab=taxes&section=vat_rates&wpi_sub=' . $rate_class_key);
834 834
 
835
-        wp_send_json( $response );
835
+        wp_send_json($response);
836 836
     }
837 837
 
838 838
     public static function delete_class() {
839 839
         $response = array();
840 840
         $response['success'] = false;
841 841
 
842
-        if ( !wpinv_current_user_can_manage_invoicing() || !isset( $_POST['class'] ) ) {
843
-            $response['error'] = __( 'Invalid access!', 'invoicing' );
844
-            wp_send_json( $response );
842
+        if (!wpinv_current_user_can_manage_invoicing() || !isset($_POST['class'])) {
843
+            $response['error'] = __('Invalid access!', 'invoicing');
844
+            wp_send_json($response);
845 845
         }
846 846
 
847
-        $vat_class = isset( $_POST['class'] ) && $_POST['class'] !== '' ? sanitize_text_field( $_POST['class'] ) : false;
848
-        $vat_classes = (array)self::get_rate_classes();
847
+        $vat_class = isset($_POST['class']) && $_POST['class'] !== '' ? sanitize_text_field($_POST['class']) : false;
848
+        $vat_classes = (array) self::get_rate_classes();
849 849
 
850
-        if ( !isset( $vat_classes[$vat_class] ) ) {
851
-            $response['error'] = __( 'Requested class does not exists', 'invoicing' );
852
-            wp_send_json( $response );
850
+        if (!isset($vat_classes[$vat_class])) {
851
+            $response['error'] = __('Requested class does not exists', 'invoicing');
852
+            wp_send_json($response);
853 853
         }
854 854
 
855
-        if ( $vat_class == '_new' || $vat_class == '_standard' ) {
856
-            $response['error'] = __( 'You can not delete standard rates class', 'invoicing' );
857
-            wp_send_json( $response );
855
+        if ($vat_class == '_new' || $vat_class == '_standard') {
856
+            $response['error'] = __('You can not delete standard rates class', 'invoicing');
857
+            wp_send_json($response);
858 858
         }
859 859
 
860
-        $vat_classes = (array)self::get_rate_classes( true );
861
-        unset( $vat_classes[$vat_class] );
860
+        $vat_classes = (array) self::get_rate_classes(true);
861
+        unset($vat_classes[$vat_class]);
862 862
 
863
-        update_option( '_wpinv_vat_rate_classes', $vat_classes );
863
+        update_option('_wpinv_vat_rate_classes', $vat_classes);
864 864
 
865 865
         $response['success'] = true;
866
-        $response['redirect'] = admin_url( 'admin.php?page=wpinv-settings&tab=taxes&section=vat_rates&wpi_sub=_new' );
866
+        $response['redirect'] = admin_url('admin.php?page=wpinv-settings&tab=taxes&section=vat_rates&wpi_sub=_new');
867 867
 
868
-        wp_send_json( $response );
868
+        wp_send_json($response);
869 869
     }
870 870
 
871 871
     public static function update_eu_rates() {
@@ -874,73 +874,73 @@  discard block
 block discarded – undo
874 874
         $response['error']      = null;
875 875
         $response['data']       = null;
876 876
 
877
-        if ( !wpinv_current_user_can_manage_invoicing() ) {
878
-            $response['error'] = __( 'Invalid access!', 'invoicing' );
879
-            wp_send_json( $response );
877
+        if (!wpinv_current_user_can_manage_invoicing()) {
878
+            $response['error'] = __('Invalid access!', 'invoicing');
879
+            wp_send_json($response);
880 880
         }
881 881
 
882
-        $group      = !empty( $_POST['group'] ) ? sanitize_text_field( $_POST['group'] ) : '';
883
-        $euvatrates = self::request_euvatrates( $group );
882
+        $group      = !empty($_POST['group']) ? sanitize_text_field($_POST['group']) : '';
883
+        $euvatrates = self::request_euvatrates($group);
884 884
 
885
-        if ( !empty( $euvatrates ) ) {
886
-            if ( !empty( $euvatrates['success'] ) && !empty( $euvatrates['rates'] ) ) {
885
+        if (!empty($euvatrates)) {
886
+            if (!empty($euvatrates['success']) && !empty($euvatrates['rates'])) {
887 887
                 $response['success']        = true;
888 888
                 $response['data']['rates']  = $euvatrates['rates'];
889
-            } else if ( !empty( $euvatrates['error'] ) ) {
889
+            } else if (!empty($euvatrates['error'])) {
890 890
                 $response['error']          = $euvatrates['error'];
891 891
             }
892 892
         }
893 893
 
894
-        wp_send_json( $response );
894
+        wp_send_json($response);
895 895
     }
896 896
 
897 897
     public static function hide_vat_fields() {
898
-        $hide = wpinv_get_option( 'vat_disable_fields' );
898
+        $hide = wpinv_get_option('vat_disable_fields');
899 899
 
900
-        return apply_filters( 'wpinv_hide_vat_fields', $hide );
900
+        return apply_filters('wpinv_hide_vat_fields', $hide);
901 901
     }
902 902
 
903 903
     public static function same_country_rule() {
904
-        $same_country_rule = wpinv_get_option( 'vat_same_country_rule' );
904
+        $same_country_rule = wpinv_get_option('vat_same_country_rule');
905 905
 
906
-        return apply_filters( 'wpinv_vat_same_country_rule', $same_country_rule );
906
+        return apply_filters('wpinv_vat_same_country_rule', $same_country_rule);
907 907
     }
908 908
 
909 909
     /**
910 910
      * Retrieves the vat name.
911 911
      */
912 912
     public function get_vat_name() {
913
-        $vat_name = wpinv_get_option( 'vat_name' );
914
-        return empty( $vat_name ) ? __( 'VAT', 'invoicing' ) : sanitize_text_field( $vat_name );
913
+        $vat_name = wpinv_get_option('vat_name');
914
+        return empty($vat_name) ? __('VAT', 'invoicing') : sanitize_text_field($vat_name);
915 915
     }
916 916
 
917 917
     public static function get_company_name() {
918
-        $company_name = wpinv_get_option( 'vat_company_name' );
918
+        $company_name = wpinv_get_option('vat_company_name');
919 919
 
920
-        return apply_filters( 'wpinv_get_owner_company_name', $company_name );
920
+        return apply_filters('wpinv_get_owner_company_name', $company_name);
921 921
     }
922 922
 
923 923
     public static function get_vat_number() {
924
-        $vat_number = wpinv_get_option( 'vat_number' );
924
+        $vat_number = wpinv_get_option('vat_number');
925 925
 
926
-        return apply_filters( 'wpinv_get_owner_vat_number', $vat_number );
926
+        return apply_filters('wpinv_get_owner_vat_number', $vat_number);
927 927
     }
928 928
 
929 929
     public static function is_vat_validated() {
930
-        $validated = self::get_vat_number() && wpinv_get_option( 'vat_valid' );
930
+        $validated = self::get_vat_number() && wpinv_get_option('vat_valid');
931 931
 
932
-        return apply_filters( 'wpinv_is_owner_vat_validated', $validated );
932
+        return apply_filters('wpinv_is_owner_vat_validated', $validated);
933 933
     }
934 934
 
935
-    public static function sanitize_vat( $vat_number, $country_code = '' ) {
936
-        $vat_number = str_replace( array(' ', '.', '-', '_', ',' ), '', strtoupper( trim( $vat_number ) ) );
935
+    public static function sanitize_vat($vat_number, $country_code = '') {
936
+        $vat_number = str_replace(array(' ', '.', '-', '_', ','), '', strtoupper(trim($vat_number)));
937 937
 
938
-        if ( empty( $country_code ) ) {
939
-            $country_code = substr( $vat_number, 0, 2 );
938
+        if (empty($country_code)) {
939
+            $country_code = substr($vat_number, 0, 2);
940 940
         }
941 941
 
942
-        if ( strpos( $vat_number , $country_code ) === 0 ) {
943
-            $vat = str_replace( $country_code, '', $vat_number );
942
+        if (strpos($vat_number, $country_code) === 0) {
943
+            $vat = str_replace($country_code, '', $vat_number);
944 944
         } else {
945 945
             $vat = $country_code . $vat_number;
946 946
         }
@@ -953,140 +953,140 @@  discard block
 block discarded – undo
953 953
         return $return;
954 954
     }
955 955
 
956
-    public static function offline_check( $vat_number, $country_code = '', $formatted = false ) {
957
-        $vat            = self::sanitize_vat( $vat_number, $country_code );
956
+    public static function offline_check($vat_number, $country_code = '', $formatted = false) {
957
+        $vat            = self::sanitize_vat($vat_number, $country_code);
958 958
         $vat_number     = $vat['vat_number'];
959 959
         $country_code   = $vat['iso'];
960 960
         $regex          = array();
961 961
 
962
-        switch ( $country_code ) {
962
+        switch ($country_code) {
963 963
             case 'AT':
964
-                $regex[] = '/^(AT)U(\d{8})$/';                           // Austria
964
+                $regex[] = '/^(AT)U(\d{8})$/'; // Austria
965 965
                 break;
966 966
             case 'BE':
967
-                $regex[] = '/^(BE)(0?\d{9})$/';                          // Belgium
967
+                $regex[] = '/^(BE)(0?\d{9})$/'; // Belgium
968 968
                 break;
969 969
             case 'BG':
970
-                $regex[] = '/^(BG)(\d{9,10})$/';                         // Bulgaria
970
+                $regex[] = '/^(BG)(\d{9,10})$/'; // Bulgaria
971 971
                 break;
972 972
             case 'CH':
973 973
             case 'CHE':
974
-                $regex[] = '/^(CHE)(\d{9})MWST$/';                       // Switzerland (Not EU)
974
+                $regex[] = '/^(CHE)(\d{9})MWST$/'; // Switzerland (Not EU)
975 975
                 break;
976 976
             case 'CY':
977
-                $regex[] = '/^(CY)([0-5|9]\d{7}[A-Z])$/';                // Cyprus
977
+                $regex[] = '/^(CY)([0-5|9]\d{7}[A-Z])$/'; // Cyprus
978 978
                 break;
979 979
             case 'CZ':
980
-                $regex[] = '/^(CZ)(\d{8,13})$/';                         // Czech Republic
980
+                $regex[] = '/^(CZ)(\d{8,13})$/'; // Czech Republic
981 981
                 break;
982 982
             case 'DE':
983
-                $regex[] = '/^(DE)([1-9]\d{8})$/';                       // Germany
983
+                $regex[] = '/^(DE)([1-9]\d{8})$/'; // Germany
984 984
                 break;
985 985
             case 'DK':
986
-                $regex[] = '/^(DK)(\d{8})$/';                            // Denmark
986
+                $regex[] = '/^(DK)(\d{8})$/'; // Denmark
987 987
                 break;
988 988
             case 'EE':
989
-                $regex[] = '/^(EE)(10\d{7})$/';                          // Estonia
989
+                $regex[] = '/^(EE)(10\d{7})$/'; // Estonia
990 990
                 break;
991 991
             case 'EL':
992
-                $regex[] = '/^(EL)(\d{9})$/';                            // Greece
992
+                $regex[] = '/^(EL)(\d{9})$/'; // Greece
993 993
                 break;
994 994
             case 'ES':
995
-                $regex[] = '/^(ES)([A-Z]\d{8})$/';                       // Spain (National juridical entities)
996
-                $regex[] = '/^(ES)([A-H|N-S|W]\d{7}[A-J])$/';            // Spain (Other juridical entities)
997
-                $regex[] = '/^(ES)([0-9|Y|Z]\d{7}[A-Z])$/';              // Spain (Personal entities type 1)
998
-                $regex[] = '/^(ES)([K|L|M|X]\d{7}[A-Z])$/';              // Spain (Personal entities type 2)
995
+                $regex[] = '/^(ES)([A-Z]\d{8})$/'; // Spain (National juridical entities)
996
+                $regex[] = '/^(ES)([A-H|N-S|W]\d{7}[A-J])$/'; // Spain (Other juridical entities)
997
+                $regex[] = '/^(ES)([0-9|Y|Z]\d{7}[A-Z])$/'; // Spain (Personal entities type 1)
998
+                $regex[] = '/^(ES)([K|L|M|X]\d{7}[A-Z])$/'; // Spain (Personal entities type 2)
999 999
                 break;
1000 1000
             case 'EU':
1001
-                $regex[] = '/^(EU)(\d{9})$/';                            // EU-type
1001
+                $regex[] = '/^(EU)(\d{9})$/'; // EU-type
1002 1002
                 break;
1003 1003
             case 'FI':
1004
-                $regex[] = '/^(FI)(\d{8})$/';                            // Finland
1004
+                $regex[] = '/^(FI)(\d{8})$/'; // Finland
1005 1005
                 break;
1006 1006
             case 'FR':
1007
-                $regex[] = '/^(FR)(\d{11})$/';                           // France (1)
1008
-                $regex[] = '/^(FR)[(A-H)|(J-N)|(P-Z)](\d{10})$/';        // France (2)
1009
-                $regex[] = '/^(FR)\d[(A-H)|(J-N)|(P-Z)](\d{9})$/';       // France (3)
1010
-                $regex[] = '/^(FR)[(A-H)|(J-N)|(P-Z)]{2}(\d{9})$/';      // France (4)
1007
+                $regex[] = '/^(FR)(\d{11})$/'; // France (1)
1008
+                $regex[] = '/^(FR)[(A-H)|(J-N)|(P-Z)](\d{10})$/'; // France (2)
1009
+                $regex[] = '/^(FR)\d[(A-H)|(J-N)|(P-Z)](\d{9})$/'; // France (3)
1010
+                $regex[] = '/^(FR)[(A-H)|(J-N)|(P-Z)]{2}(\d{9})$/'; // France (4)
1011 1011
                 break;
1012 1012
             case 'GB':
1013
-                $regex[] = '/^(GB)?(\d{9})$/';                           // UK (Standard)
1014
-                $regex[] = '/^(GB)?(\d{12})$/';                          // UK (Branches)
1015
-                $regex[] = '/^(GB)?(GD\d{3})$/';                         // UK (Government)
1016
-                $regex[] = '/^(GB)?(HA\d{3})$/';                         // UK (Health authority)
1013
+                $regex[] = '/^(GB)?(\d{9})$/'; // UK (Standard)
1014
+                $regex[] = '/^(GB)?(\d{12})$/'; // UK (Branches)
1015
+                $regex[] = '/^(GB)?(GD\d{3})$/'; // UK (Government)
1016
+                $regex[] = '/^(GB)?(HA\d{3})$/'; // UK (Health authority)
1017 1017
                 break;
1018 1018
             case 'GR':
1019
-                $regex[] = '/^(GR)(\d{8,9})$/';                          // Greece
1019
+                $regex[] = '/^(GR)(\d{8,9})$/'; // Greece
1020 1020
                 break;
1021 1021
             case 'HR':
1022
-                $regex[] = '/^(HR)(\d{11})$/';                           // Croatia
1022
+                $regex[] = '/^(HR)(\d{11})$/'; // Croatia
1023 1023
                 break;
1024 1024
             case 'HU':
1025
-                $regex[] = '/^(HU)(\d{8})$/';                            // Hungary
1025
+                $regex[] = '/^(HU)(\d{8})$/'; // Hungary
1026 1026
                 break;
1027 1027
             case 'IE':
1028
-                $regex[] = '/^(IE)(\d{7}[A-W])$/';                       // Ireland (1)
1029
-                $regex[] = '/^(IE)([7-9][A-Z\*\+)]\d{5}[A-W])$/';        // Ireland (2)
1030
-                $regex[] = '/^(IE)(\d{7}[A-Z][AH])$/';                   // Ireland (3) (new format from 1 Jan 2013)
1028
+                $regex[] = '/^(IE)(\d{7}[A-W])$/'; // Ireland (1)
1029
+                $regex[] = '/^(IE)([7-9][A-Z\*\+)]\d{5}[A-W])$/'; // Ireland (2)
1030
+                $regex[] = '/^(IE)(\d{7}[A-Z][AH])$/'; // Ireland (3) (new format from 1 Jan 2013)
1031 1031
                 break;
1032 1032
             case 'IT':
1033
-                $regex[] = '/^(IT)(\d{11})$/';                           // Italy
1033
+                $regex[] = '/^(IT)(\d{11})$/'; // Italy
1034 1034
                 break;
1035 1035
             case 'LV':
1036
-                $regex[] = '/^(LV)(\d{11})$/';                           // Latvia
1036
+                $regex[] = '/^(LV)(\d{11})$/'; // Latvia
1037 1037
                 break;
1038 1038
             case 'LT':
1039
-                $regex[] = '/^(LT)(\d{9}|\d{12})$/';                     // Lithuania
1039
+                $regex[] = '/^(LT)(\d{9}|\d{12})$/'; // Lithuania
1040 1040
                 break;
1041 1041
             case 'LU':
1042
-                $regex[] = '/^(LU)(\d{8})$/';                            // Luxembourg
1042
+                $regex[] = '/^(LU)(\d{8})$/'; // Luxembourg
1043 1043
                 break;
1044 1044
             case 'MT':
1045
-                $regex[] = '/^(MT)([1-9]\d{7})$/';                       // Malta
1045
+                $regex[] = '/^(MT)([1-9]\d{7})$/'; // Malta
1046 1046
                 break;
1047 1047
             case 'NL':
1048
-                $regex[] = '/^(NL)(\d{9})B\d{2}$/';                      // Netherlands
1048
+                $regex[] = '/^(NL)(\d{9})B\d{2}$/'; // Netherlands
1049 1049
                 break;
1050 1050
             case 'NO':
1051
-                $regex[] = '/^(NO)(\d{9})$/';                            // Norway (Not EU)
1051
+                $regex[] = '/^(NO)(\d{9})$/'; // Norway (Not EU)
1052 1052
                 break;
1053 1053
             case 'PL':
1054
-                $regex[] = '/^(PL)(\d{10})$/';                           // Poland
1054
+                $regex[] = '/^(PL)(\d{10})$/'; // Poland
1055 1055
                 break;
1056 1056
             case 'PT':
1057
-                $regex[] = '/^(PT)(\d{9})$/';                            // Portugal
1057
+                $regex[] = '/^(PT)(\d{9})$/'; // Portugal
1058 1058
                 break;
1059 1059
             case 'RO':
1060
-                $regex[] = '/^(RO)([1-9]\d{1,9})$/';                     // Romania
1060
+                $regex[] = '/^(RO)([1-9]\d{1,9})$/'; // Romania
1061 1061
                 break;
1062 1062
             case 'RS':
1063
-                $regex[] = '/^(RS)(\d{9})$/';                            // Serbia (Not EU)
1063
+                $regex[] = '/^(RS)(\d{9})$/'; // Serbia (Not EU)
1064 1064
                 break;
1065 1065
             case 'SI':
1066
-                $regex[] = '/^(SI)([1-9]\d{7})$/';                       // Slovenia
1066
+                $regex[] = '/^(SI)([1-9]\d{7})$/'; // Slovenia
1067 1067
                 break;
1068 1068
             case 'SK':
1069
-                $regex[] = '/^(SK)([1-9]\d[(2-4)|(6-9)]\d{7})$/';        // Slovakia Republic
1069
+                $regex[] = '/^(SK)([1-9]\d[(2-4)|(6-9)]\d{7})$/'; // Slovakia Republic
1070 1070
                 break;
1071 1071
             case 'SE':
1072
-                $regex[] = '/^(SE)(\d{10}01)$/';                         // Sweden
1072
+                $regex[] = '/^(SE)(\d{10}01)$/'; // Sweden
1073 1073
                 break;
1074 1074
             default:
1075 1075
                 $regex = array();
1076 1076
             break;
1077 1077
         }
1078 1078
 
1079
-        if ( empty( $regex ) ) {
1079
+        if (empty($regex)) {
1080 1080
             return false;
1081 1081
         }
1082 1082
 
1083
-        foreach ( $regex as $pattern ) {
1083
+        foreach ($regex as $pattern) {
1084 1084
             $matches = null;
1085
-            preg_match_all( $pattern, $vat_number, $matches );
1085
+            preg_match_all($pattern, $vat_number, $matches);
1086 1086
 
1087
-            if ( !empty( $matches[1][0] ) && !empty( $matches[2][0] ) ) {
1088
-                if ( $formatted ) {
1089
-                    return array( 'code' => $matches[1][0], 'number' => $matches[2][0] );
1087
+            if (!empty($matches[1][0]) && !empty($matches[2][0])) {
1088
+                if ($formatted) {
1089
+                    return array('code' => $matches[1][0], 'number' => $matches[2][0]);
1090 1090
                 } else {
1091 1091
                     return true;
1092 1092
                 }
@@ -1096,75 +1096,75 @@  discard block
 block discarded – undo
1096 1096
         return false;
1097 1097
     }
1098 1098
 
1099
-    public static function vies_check( $vat_number, $country_code = '', $result = false ) {
1100
-        $vat            = self::sanitize_vat( $vat_number, $country_code );
1099
+    public static function vies_check($vat_number, $country_code = '', $result = false) {
1100
+        $vat            = self::sanitize_vat($vat_number, $country_code);
1101 1101
         $vat_number     = $vat['vat'];
1102 1102
         $iso            = $vat['iso'];
1103 1103
 
1104
-        $url = 'http://ec.europa.eu/taxation_customs/vies/viesquer.do?ms=' . urlencode( $iso ) . '&iso=' . urlencode( $iso ) . '&vat=' . urlencode( $vat_number );
1104
+        $url = 'http://ec.europa.eu/taxation_customs/vies/viesquer.do?ms=' . urlencode($iso) . '&iso=' . urlencode($iso) . '&vat=' . urlencode($vat_number);
1105 1105
 
1106
-        if ( ini_get( 'allow_url_fopen' ) ) {
1107
-            $response = file_get_contents( $url );
1108
-        } else if ( function_exists( 'curl_init' ) ) {
1106
+        if (ini_get('allow_url_fopen')) {
1107
+            $response = file_get_contents($url);
1108
+        } else if (function_exists('curl_init')) {
1109 1109
             $ch = curl_init();
1110 1110
 
1111
-            curl_setopt( $ch, CURLOPT_URL, $url );
1112
-            curl_setopt( $ch, CURLOPT_CONNECTTIMEOUT, 30 );
1113
-            curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true );
1114
-            curl_setopt( $ch, CURLOPT_SSL_VERIFYHOST, 0 );
1115
-            curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, 0 );
1111
+            curl_setopt($ch, CURLOPT_URL, $url);
1112
+            curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 30);
1113
+            curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
1114
+            curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
1115
+            curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
1116 1116
 
1117
-            $response = curl_exec( $ch );
1117
+            $response = curl_exec($ch);
1118 1118
 
1119
-            if ( curl_errno( $ch ) ) {
1120
-                wpinv_error_log( curl_error( $ch ), 'VIES CHECK ERROR' );
1119
+            if (curl_errno($ch)) {
1120
+                wpinv_error_log(curl_error($ch), 'VIES CHECK ERROR');
1121 1121
                 $response = '';
1122 1122
             }
1123 1123
 
1124
-            curl_close( $ch );
1124
+            curl_close($ch);
1125 1125
         } else {
1126
-            wpinv_error_log( 'To use VIES CHECK you must have allow_url_fopen is ON or cURL installed & active on your server.', 'VIES CHECK ERROR' );
1126
+            wpinv_error_log('To use VIES CHECK you must have allow_url_fopen is ON or cURL installed & active on your server.', 'VIES CHECK ERROR');
1127 1127
         }
1128 1128
 
1129
-        if ( empty( $response ) ) {
1129
+        if (empty($response)) {
1130 1130
             return $result;
1131 1131
         }
1132 1132
 
1133
-        if ( preg_match( '/invalid VAT number/i', $response ) ) {
1133
+        if (preg_match('/invalid VAT number/i', $response)) {
1134 1134
             return false;
1135
-        } else if ( preg_match( '/valid VAT number/i', $response, $matches ) ) {
1136
-            $content = explode( "valid VAT number", htmlentities( $response ) );
1135
+        } else if (preg_match('/valid VAT number/i', $response, $matches)) {
1136
+            $content = explode("valid VAT number", htmlentities($response));
1137 1137
 
1138
-            if ( !empty( $content[1] ) ) {
1139
-                preg_match_all( '/<tr>(.*?)<td.*?>(.*?)<\/td>(.*?)<\/tr>/si', html_entity_decode( $content[1] ), $matches );
1138
+            if (!empty($content[1])) {
1139
+                preg_match_all('/<tr>(.*?)<td.*?>(.*?)<\/td>(.*?)<\/tr>/si', html_entity_decode($content[1]), $matches);
1140 1140
 
1141
-                if ( !empty( $matches[2] ) && $matches[3] ) {
1141
+                if (!empty($matches[2]) && $matches[3]) {
1142 1142
                     $return = array();
1143 1143
 
1144
-                    foreach ( $matches[2] as $key => $label ) {
1145
-                        $label = trim( $label );
1144
+                    foreach ($matches[2] as $key => $label) {
1145
+                        $label = trim($label);
1146 1146
 
1147
-                        switch ( strtolower( $label ) ) {
1147
+                        switch (strtolower($label)) {
1148 1148
                             case 'member state':
1149
-                                $return['state'] = trim( strip_tags( $matches[3][$key] ) );
1149
+                                $return['state'] = trim(strip_tags($matches[3][$key]));
1150 1150
                             break;
1151 1151
                             case 'vat number':
1152
-                                $return['number'] = trim( strip_tags( $matches[3][$key] ) );
1152
+                                $return['number'] = trim(strip_tags($matches[3][$key]));
1153 1153
                             break;
1154 1154
                             case 'name':
1155
-                                $return['company'] = trim( strip_tags( $matches[3][$key] ) );
1155
+                                $return['company'] = trim(strip_tags($matches[3][$key]));
1156 1156
                             break;
1157 1157
                             case 'address':
1158
-                                $address           = str_replace( array( "<br><br>", "<br /><br />", "<br/><br/>" ), "<br>", html_entity_decode( trim( $matches[3][$key] ) ) );
1159
-                                $return['address'] = trim( strip_tags( $address, '<br>' ) );
1158
+                                $address           = str_replace(array("<br><br>", "<br /><br />", "<br/><br/>"), "<br>", html_entity_decode(trim($matches[3][$key])));
1159
+                                $return['address'] = trim(strip_tags($address, '<br>'));
1160 1160
                             break;
1161 1161
                             case 'consultation number':
1162
-                                $return['consultation'] = trim( strip_tags( $matches[3][$key] ) );
1162
+                                $return['consultation'] = trim(strip_tags($matches[3][$key]));
1163 1163
                             break;
1164 1164
                         }
1165 1165
                     }
1166 1166
 
1167
-                    if ( !empty( $return ) ) {
1167
+                    if (!empty($return)) {
1168 1168
                         return $return;
1169 1169
                     }
1170 1170
                 }
@@ -1176,62 +1176,62 @@  discard block
 block discarded – undo
1176 1176
         }
1177 1177
     }
1178 1178
 
1179
-    public static function check_vat( $vat_number, $country_code = '' ) {
1179
+    public static function check_vat($vat_number, $country_code = '') {
1180 1180
         $vat_name           = getpaid_vat_name();
1181 1181
 
1182 1182
         $return             = array();
1183 1183
         $return['valid']    = false;
1184
-        $return['message']  = wp_sprintf( __( '%s number not validated', 'invoicing' ), $vat_name );
1184
+        $return['message']  = wp_sprintf(__('%s number not validated', 'invoicing'), $vat_name);
1185 1185
 
1186
-        if ( !wpinv_get_option( 'vat_offline_check' ) && !self::offline_check( $vat_number, $country_code ) ) {
1186
+        if (!wpinv_get_option('vat_offline_check') && !self::offline_check($vat_number, $country_code)) {
1187 1187
             return $return;
1188 1188
         }
1189 1189
 
1190
-        $response = self::vies_check( $vat_number, $country_code );
1190
+        $response = self::vies_check($vat_number, $country_code);
1191 1191
 
1192
-        if ( $response ) {
1193
-            $return['valid']    = true;
1192
+        if ($response) {
1193
+            $return['valid'] = true;
1194 1194
 
1195
-            if ( is_array( $response ) ) {
1196
-                $return['company'] = isset( $response['company'] ) ? $response['company'] : '';
1197
-                $return['address'] = isset( $response['address'] ) ? $response['address'] : '';
1195
+            if (is_array($response)) {
1196
+                $return['company'] = isset($response['company']) ? $response['company'] : '';
1197
+                $return['address'] = isset($response['address']) ? $response['address'] : '';
1198 1198
                 $return['message'] = $return['company'] . '<br/>' . $return['address'];
1199 1199
             }
1200 1200
         } else {
1201 1201
             $return['valid']    = false;
1202
-            $return['message']  = wp_sprintf( __( 'Fail to validate the %s number: EU Commission VAT server (VIES) check fails.', 'invoicing' ), $vat_name );
1202
+            $return['message']  = wp_sprintf(__('Fail to validate the %s number: EU Commission VAT server (VIES) check fails.', 'invoicing'), $vat_name);
1203 1203
         }
1204 1204
 
1205 1205
         return $return;
1206 1206
     }
1207 1207
 
1208
-    public static function request_euvatrates( $group ) {
1208
+    public static function request_euvatrates($group) {
1209 1209
         $response               = array();
1210 1210
         $response['success']    = false;
1211 1211
         $response['error']      = null;
1212 1212
         $response['eurates']    = null;
1213 1213
 
1214 1214
         $euvatrates_url = 'https://euvatrates.com/rates.json';
1215
-        $euvatrates_url = apply_filters( 'wpinv_euvatrates_url', $euvatrates_url );
1216
-        $api_response   = wp_remote_get( $euvatrates_url );
1215
+        $euvatrates_url = apply_filters('wpinv_euvatrates_url', $euvatrates_url);
1216
+        $api_response   = wp_remote_get($euvatrates_url);
1217 1217
 
1218 1218
         try {
1219
-            if ( is_wp_error( $api_response ) ) {
1220
-                $response['error']      = __( $api_response->get_error_message(), 'invoicing' );
1219
+            if (is_wp_error($api_response)) {
1220
+                $response['error'] = __($api_response->get_error_message(), 'invoicing');
1221 1221
             } else {
1222
-                $body = json_decode( $api_response['body'] );
1223
-                if ( isset( $body->rates ) ) {
1222
+                $body = json_decode($api_response['body']);
1223
+                if (isset($body->rates)) {
1224 1224
                     $rates = array();
1225 1225
 
1226
-                    foreach ( $body->rates as $country_code => $rate ) {
1226
+                    foreach ($body->rates as $country_code => $rate) {
1227 1227
                         $vat_rate = array();
1228 1228
                         $vat_rate['country']        = $rate->country;
1229
-                        $vat_rate['standard']       = (float)$rate->standard_rate;
1230
-                        $vat_rate['reduced']        = (float)$rate->reduced_rate;
1231
-                        $vat_rate['superreduced']   = (float)$rate->super_reduced_rate;
1232
-                        $vat_rate['parking']        = (float)$rate->parking_rate;
1229
+                        $vat_rate['standard']       = (float) $rate->standard_rate;
1230
+                        $vat_rate['reduced']        = (float) $rate->reduced_rate;
1231
+                        $vat_rate['superreduced']   = (float) $rate->super_reduced_rate;
1232
+                        $vat_rate['parking']        = (float) $rate->parking_rate;
1233 1233
 
1234
-                        if ( $group !== '' && in_array( $group, array( 'standard', 'reduced', 'superreduced', 'parking' ) ) ) {
1234
+                        if ($group !== '' && in_array($group, array('standard', 'reduced', 'superreduced', 'parking'))) {
1235 1235
                             $vat_rate_group = array();
1236 1236
                             $vat_rate_group['country'] = $rate->country;
1237 1237
                             $vat_rate_group[$group]    = $vat_rate[$group];
@@ -1243,79 +1243,79 @@  discard block
 block discarded – undo
1243 1243
                     }
1244 1244
 
1245 1245
                     $response['success']    = true;
1246
-                    $response['rates']      = apply_filters( 'wpinv_process_euvatrates', $rates, $api_response, $group );
1246
+                    $response['rates']      = apply_filters('wpinv_process_euvatrates', $rates, $api_response, $group);
1247 1247
                 } else {
1248
-                    $response['error']      = __( 'No EU rates found!', 'invoicing' );
1248
+                    $response['error']      = __('No EU rates found!', 'invoicing');
1249 1249
                 }
1250 1250
             }
1251
-        } catch ( Exception $e ) {
1252
-            $response['error'] = __( $e->getMessage(), 'invoicing' );
1251
+        } catch (Exception $e) {
1252
+            $response['error'] = __($e->getMessage(), 'invoicing');
1253 1253
         }
1254 1254
 
1255
-        return apply_filters( 'wpinv_response_euvatrates', $response, $group );
1255
+        return apply_filters('wpinv_response_euvatrates', $response, $group);
1256 1256
     }
1257 1257
 
1258
-    public static function requires_vat( $requires_vat = false, $user_id = 0, $is_digital = null ) {
1258
+    public static function requires_vat($requires_vat = false, $user_id = 0, $is_digital = null) {
1259 1259
         global $wpi_item_id, $wpi_country;
1260 1260
 
1261
-        if ( !empty( $_POST['wpinv_country'] ) ) {
1262
-            $country_code = trim( $_POST['wpinv_country'] );
1263
-        } else if ( !empty( $_POST['country'] ) ) {
1264
-            $country_code = trim( $_POST['country'] );
1265
-        } else if ( !empty( $wpi_country ) ) {
1261
+        if (!empty($_POST['wpinv_country'])) {
1262
+            $country_code = trim($_POST['wpinv_country']);
1263
+        } else if (!empty($_POST['country'])) {
1264
+            $country_code = trim($_POST['country']);
1265
+        } else if (!empty($wpi_country)) {
1266 1266
             $country_code = $wpi_country;
1267 1267
         } else {
1268
-            $country_code = self::get_user_country( '', $user_id );
1268
+            $country_code = self::get_user_country('', $user_id);
1269 1269
         }
1270 1270
 
1271
-        if ( $is_digital === null && $wpi_item_id ) {
1272
-            $is_digital = $wpi_item_id ? self::item_has_digital_rule( $wpi_item_id ) : self::allow_vat_rules();
1271
+        if ($is_digital === null && $wpi_item_id) {
1272
+            $is_digital = $wpi_item_id ? self::item_has_digital_rule($wpi_item_id) : self::allow_vat_rules();
1273 1273
         }
1274 1274
 
1275
-        if ( !empty( $country_code ) ) {
1276
-            $requires_vat = ( self::is_eu_state( $country_code ) && ( self::is_eu_state( wpinv_get_default_country() ) || $is_digital ) ) || ( self::is_gst_country( $country_code ) && self::is_gst_country( wpinv_get_default_country() ) );
1275
+        if (!empty($country_code)) {
1276
+            $requires_vat = (self::is_eu_state($country_code) && (self::is_eu_state(wpinv_get_default_country()) || $is_digital)) || (self::is_gst_country($country_code) && self::is_gst_country(wpinv_get_default_country()));
1277 1277
         }
1278 1278
 
1279
-        return apply_filters( 'wpinv_requires_vat', $requires_vat, $user_id );
1279
+        return apply_filters('wpinv_requires_vat', $requires_vat, $user_id);
1280 1280
     }
1281 1281
 
1282
-    public static function tax_label( $label = '' ) {
1282
+    public static function tax_label($label = '') {
1283 1283
         global $wpi_requires_vat;
1284 1284
 
1285
-        if ( !( $wpi_requires_vat !== 0 && $wpi_requires_vat ) ) {
1286
-            $wpi_requires_vat = self::requires_vat( 0, false );
1285
+        if (!($wpi_requires_vat !== 0 && $wpi_requires_vat)) {
1286
+            $wpi_requires_vat = self::requires_vat(0, false);
1287 1287
         }
1288 1288
 
1289
-        return $wpi_requires_vat ? __( self::get_vat_name(), 'invoicing' ) : ( $label ? $label : __( 'Tax', 'invoicing' ) );
1289
+        return $wpi_requires_vat ? __(self::get_vat_name(), 'invoicing') : ($label ? $label : __('Tax', 'invoicing'));
1290 1290
     }
1291 1291
 
1292 1292
     public static function standard_rates_label() {
1293
-        return __( 'Standard Rates', 'invoicing' );
1293
+        return __('Standard Rates', 'invoicing');
1294 1294
     }
1295 1295
 
1296
-    public static function get_rate_classes( $with_desc = false ) {
1297
-        $rate_classes_option = get_option( '_wpinv_vat_rate_classes', true );
1298
-        $classes = maybe_unserialize( $rate_classes_option );
1296
+    public static function get_rate_classes($with_desc = false) {
1297
+        $rate_classes_option = get_option('_wpinv_vat_rate_classes', true);
1298
+        $classes = maybe_unserialize($rate_classes_option);
1299 1299
 
1300
-        if ( empty( $classes ) || !is_array( $classes ) ) {
1300
+        if (empty($classes) || !is_array($classes)) {
1301 1301
             $classes = array();
1302 1302
         }
1303 1303
 
1304 1304
         $rate_classes = array();
1305
-        if ( !array_key_exists( '_standard', $classes ) ) {
1306
-            if ( $with_desc ) {
1307
-                $rate_classes['_standard'] = array( 'name' => self::standard_rates_label(), 'desc' => __( 'EU member states standard VAT rates', 'invoicing' ) );
1305
+        if (!array_key_exists('_standard', $classes)) {
1306
+            if ($with_desc) {
1307
+                $rate_classes['_standard'] = array('name' => self::standard_rates_label(), 'desc' => __('EU member states standard VAT rates', 'invoicing'));
1308 1308
             } else {
1309 1309
                 $rate_classes['_standard'] = self::standard_rates_label();
1310 1310
             }
1311 1311
         }
1312 1312
 
1313
-        foreach ( $classes as $key => $class ) {
1314
-            $name = !empty( $class['name'] ) ? __( $class['name'], 'invoicing' ) : $key;
1315
-            $desc = !empty( $class['desc'] ) ? __( $class['desc'], 'invoicing' ) : '';
1313
+        foreach ($classes as $key => $class) {
1314
+            $name = !empty($class['name']) ? __($class['name'], 'invoicing') : $key;
1315
+            $desc = !empty($class['desc']) ? __($class['desc'], 'invoicing') : '';
1316 1316
 
1317
-            if ( $with_desc ) {
1318
-                $rate_classes[$key] = array( 'name' => $name, 'desc' => $desc );
1317
+            if ($with_desc) {
1318
+                $rate_classes[$key] = array('name' => $name, 'desc' => $desc);
1319 1319
             } else {
1320 1320
                 $rate_classes[$key] = $name;
1321 1321
             }
@@ -1326,15 +1326,15 @@  discard block
 block discarded – undo
1326 1326
 
1327 1327
     public static function get_all_classes() {
1328 1328
         $classes            = self::get_rate_classes();
1329
-        $classes['_exempt'] = __( 'Exempt (0%)', 'invoicing' );
1329
+        $classes['_exempt'] = __('Exempt (0%)', 'invoicing');
1330 1330
 
1331
-        return apply_filters( 'wpinv_vat_get_all_classes', $classes );
1331
+        return apply_filters('wpinv_vat_get_all_classes', $classes);
1332 1332
     }
1333 1333
 
1334
-    public static function get_class_desc( $rate_class ) {
1335
-        $rate_classes = self::get_rate_classes( true );
1334
+    public static function get_class_desc($rate_class) {
1335
+        $rate_classes = self::get_rate_classes(true);
1336 1336
 
1337
-        if ( !empty( $rate_classes ) && isset( $rate_classes[$rate_class] ) && isset( $rate_classes[$rate_class]['desc'] ) ) {
1337
+        if (!empty($rate_classes) && isset($rate_classes[$rate_class]) && isset($rate_classes[$rate_class]['desc'])) {
1338 1338
             return $rate_classes[$rate_class]['desc'];
1339 1339
         }
1340 1340
 
@@ -1350,107 +1350,107 @@  discard block
 block discarded – undo
1350 1350
             'increased'     => 'Increased'
1351 1351
         );
1352 1352
 
1353
-        return apply_filters( 'wpinv_get_vat_groups', $vat_groups );
1353
+        return apply_filters('wpinv_get_vat_groups', $vat_groups);
1354 1354
     }
1355 1355
 
1356 1356
     public static function get_rules() {
1357 1357
         $vat_rules = array(
1358
-            'digital' => __( 'Digital Product', 'invoicing' ),
1359
-            'physical' => __( 'Physical Product', 'invoicing' ),
1360
-            '_exempt' => __( 'Tax-Free Product', 'invoicing' ),
1358
+            'digital' => __('Digital Product', 'invoicing'),
1359
+            'physical' => __('Physical Product', 'invoicing'),
1360
+            '_exempt' => __('Tax-Free Product', 'invoicing'),
1361 1361
         );
1362
-        return apply_filters( 'wpinv_get_vat_rules', $vat_rules );
1362
+        return apply_filters('wpinv_get_vat_rules', $vat_rules);
1363 1363
     }
1364 1364
 
1365
-    public static function get_vat_rates( $class ) {
1366
-        if ( $class === '_standard' ) {
1365
+    public static function get_vat_rates($class) {
1366
+        if ($class === '_standard') {
1367 1367
             return wpinv_get_tax_rates();
1368 1368
         }
1369 1369
 
1370 1370
         $rates = self::get_non_standard_rates();
1371 1371
 
1372
-        return array_key_exists( $class, $rates ) ? $rates[$class] : array();
1372
+        return array_key_exists($class, $rates) ? $rates[$class] : array();
1373 1373
     }
1374 1374
 
1375 1375
     public static function get_non_standard_rates() {
1376
-        $option = get_option( 'wpinv_vat_rates', array());
1377
-        return is_array( $option ) ? $option : array();
1376
+        $option = get_option('wpinv_vat_rates', array());
1377
+        return is_array($option) ? $option : array();
1378 1378
     }
1379 1379
 
1380 1380
     public static function allow_vat_rules() {
1381
-        return ( wpinv_use_taxes() && wpinv_get_option( 'apply_vat_rules' ) ? true : false );
1381
+        return (wpinv_use_taxes() && wpinv_get_option('apply_vat_rules') ? true : false);
1382 1382
     }
1383 1383
 
1384 1384
     public static function allow_vat_classes() {
1385 1385
         return false; // TODO
1386
-        return ( wpinv_get_option( 'vat_allow_classes' ) ? true : false );
1386
+        return (wpinv_get_option('vat_allow_classes') ? true : false);
1387 1387
     }
1388 1388
 
1389
-    public static function get_item_class( $postID ) {
1390
-        $class = get_post_meta( $postID, '_wpinv_vat_class', true );
1389
+    public static function get_item_class($postID) {
1390
+        $class = get_post_meta($postID, '_wpinv_vat_class', true);
1391 1391
 
1392
-        if ( empty( $class ) ) {
1392
+        if (empty($class)) {
1393 1393
             $class = '_standard';
1394 1394
         }
1395 1395
 
1396
-        return apply_filters( 'wpinv_get_item_vat_class', $class, $postID );
1396
+        return apply_filters('wpinv_get_item_vat_class', $class, $postID);
1397 1397
     }
1398 1398
 
1399
-    public static function item_class_label( $postID ) {
1399
+    public static function item_class_label($postID) {
1400 1400
         $vat_classes = self::get_all_classes();
1401 1401
 
1402
-        $class = self::get_item_class( $postID );
1403
-        $class = isset( $vat_classes[$class] ) ? $vat_classes[$class] : __( $class, 'invoicing' );
1402
+        $class = self::get_item_class($postID);
1403
+        $class = isset($vat_classes[$class]) ? $vat_classes[$class] : __($class, 'invoicing');
1404 1404
 
1405
-        return apply_filters( 'wpinv_item_class_label', $class, $postID );
1405
+        return apply_filters('wpinv_item_class_label', $class, $postID);
1406 1406
     }
1407 1407
 
1408
-    public static function get_item_rule( $postID ) {
1409
-        $rule_type = get_post_meta( $postID, '_wpinv_vat_rule', true );
1408
+    public static function get_item_rule($postID) {
1409
+        $rule_type = get_post_meta($postID, '_wpinv_vat_rule', true);
1410 1410
 
1411
-        if ( empty( $rule_type ) ) {
1411
+        if (empty($rule_type)) {
1412 1412
             $rule_type = self::allow_vat_rules() ? 'digital' : 'physical';
1413 1413
         }
1414 1414
 
1415
-        return apply_filters( 'wpinv_item_get_vat_rule', $rule_type, $postID );
1415
+        return apply_filters('wpinv_item_get_vat_rule', $rule_type, $postID);
1416 1416
     }
1417 1417
 
1418
-    public static function item_rule_label( $postID ) {
1418
+    public static function item_rule_label($postID) {
1419 1419
         $vat_rules  = self::get_rules();
1420
-        $vat_rule   = self::get_item_rule( $postID );
1421
-        $vat_rule   = isset( $vat_rules[$vat_rule] ) ? $vat_rules[$vat_rule] : $vat_rule;
1420
+        $vat_rule   = self::get_item_rule($postID);
1421
+        $vat_rule   = isset($vat_rules[$vat_rule]) ? $vat_rules[$vat_rule] : $vat_rule;
1422 1422
 
1423
-        return apply_filters( 'wpinv_item_rule_label', $vat_rule, $postID );
1423
+        return apply_filters('wpinv_item_rule_label', $vat_rule, $postID);
1424 1424
     }
1425 1425
 
1426
-    public static function item_has_digital_rule( $item_id = 0 ) {
1427
-        return self::get_item_rule( $item_id ) == 'digital' ? true : false;
1426
+    public static function item_has_digital_rule($item_id = 0) {
1427
+        return self::get_item_rule($item_id) == 'digital' ? true : false;
1428 1428
     }
1429 1429
 
1430
-    public static function invoice_has_digital_rule( $invoice = 0 ) {
1431
-        if ( !self::allow_vat_rules() ) {
1430
+    public static function invoice_has_digital_rule($invoice = 0) {
1431
+        if (!self::allow_vat_rules()) {
1432 1432
             return false;
1433 1433
         }
1434 1434
 
1435
-        if ( empty( $invoice ) ) {
1435
+        if (empty($invoice)) {
1436 1436
             return true;
1437 1437
         }
1438 1438
 
1439
-        if ( is_int( $invoice ) ) {
1440
-            $invoice = new WPInv_Invoice( $invoice );
1439
+        if (is_int($invoice)) {
1440
+            $invoice = new WPInv_Invoice($invoice);
1441 1441
         }
1442 1442
 
1443
-        if ( !( is_object( $invoice ) && is_a( $invoice, 'WPInv_Invoice' ) ) ) {
1443
+        if (!(is_object($invoice) && is_a($invoice, 'WPInv_Invoice'))) {
1444 1444
             return true;
1445 1445
         }
1446 1446
 
1447
-        $cart_items  = $invoice->get_cart_details();
1447
+        $cart_items = $invoice->get_cart_details();
1448 1448
 
1449
-        if ( !empty( $cart_items ) ) {
1449
+        if (!empty($cart_items)) {
1450 1450
             $has_digital_rule = false;
1451 1451
 
1452
-            foreach ( $cart_items as $key => $item ) {
1453
-                if ( self::item_has_digital_rule( $item['id'] ) ) {
1452
+            foreach ($cart_items as $key => $item) {
1453
+                if (self::item_has_digital_rule($item['id'])) {
1454 1454
                     $has_digital_rule = true;
1455 1455
                     break;
1456 1456
                 }
@@ -1462,71 +1462,71 @@  discard block
 block discarded – undo
1462 1462
         return $has_digital_rule;
1463 1463
     }
1464 1464
 
1465
-    public static function item_is_taxable( $item_id = 0, $country = false, $state = false ) {
1466
-        if ( !wpinv_use_taxes() ) {
1465
+    public static function item_is_taxable($item_id = 0, $country = false, $state = false) {
1466
+        if (!wpinv_use_taxes()) {
1467 1467
             return false;
1468 1468
         }
1469 1469
 
1470 1470
         $is_taxable = true;
1471 1471
 
1472
-        if ( !empty( $item_id ) && self::get_item_class( $item_id ) == '_exempt' ) {
1472
+        if (!empty($item_id) && self::get_item_class($item_id) == '_exempt') {
1473 1473
             $is_taxable = false;
1474 1474
         }
1475 1475
 
1476
-        if ( !empty( $item_id ) && self::get_item_rule( $item_id ) == '_exempt' ) {
1476
+        if (!empty($item_id) && self::get_item_rule($item_id) == '_exempt') {
1477 1477
             $is_taxable = false;
1478 1478
         }
1479 1479
 
1480
-        return apply_filters( 'wpinv_item_is_taxable', $is_taxable, $item_id, $country , $state );
1480
+        return apply_filters('wpinv_item_is_taxable', $is_taxable, $item_id, $country, $state);
1481 1481
     }
1482 1482
 
1483
-    public static function find_rate( $country, $state, $rate, $class ) {
1483
+    public static function find_rate($country, $state, $rate, $class) {
1484 1484
         global $wpi_zero_tax;
1485 1485
 
1486
-        if ( $class === '_exempt' || $wpi_zero_tax ) {
1486
+        if ($class === '_exempt' || $wpi_zero_tax) {
1487 1487
             return 0;
1488 1488
         }
1489 1489
 
1490
-        $tax_rates   = wpinv_get_tax_rates();
1490
+        $tax_rates = wpinv_get_tax_rates();
1491 1491
 
1492
-        if ( $class !== '_standard' ) {
1493
-            $class_rates = self::get_vat_rates( $class );
1492
+        if ($class !== '_standard') {
1493
+            $class_rates = self::get_vat_rates($class);
1494 1494
 
1495
-            if ( is_array( $class_rates ) ) {
1495
+            if (is_array($class_rates)) {
1496 1496
                 $indexed_class_rates = array();
1497 1497
 
1498
-                foreach ( $class_rates as $key => $cr ) {
1498
+                foreach ($class_rates as $key => $cr) {
1499 1499
                     $indexed_class_rates[$cr['country']] = $cr;
1500 1500
                 }
1501 1501
 
1502
-                $tax_rates = array_map( function( $tr ) use( $indexed_class_rates ) {
1502
+                $tax_rates = array_map(function($tr) use($indexed_class_rates) {
1503 1503
                     $tr_country = $tr['country'];
1504
-                    if ( !isset( $indexed_class_rates[$tr_country] ) ) {
1504
+                    if (!isset($indexed_class_rates[$tr_country])) {
1505 1505
                         return $tr;
1506 1506
                     }
1507 1507
                     $icr = $indexed_class_rates[$tr_country];
1508
-                    return ( empty( $icr['rate'] ) && $icr['rate'] !== '0' ) ? $tr : $icr;
1508
+                    return (empty($icr['rate']) && $icr['rate'] !== '0') ? $tr : $icr;
1509 1509
 
1510
-                }, $tax_rates, $class_rates );
1510
+                }, $tax_rates, $class_rates);
1511 1511
             }
1512 1512
         }
1513 1513
 
1514
-        if ( !empty( $tax_rates ) ) {
1515
-            foreach ( $tax_rates as $key => $tax_rate ) {
1516
-                if ( $country != $tax_rate['country'] )
1514
+        if (!empty($tax_rates)) {
1515
+            foreach ($tax_rates as $key => $tax_rate) {
1516
+                if ($country != $tax_rate['country'])
1517 1517
                     continue;
1518 1518
 
1519
-                if ( !empty( $tax_rate['global'] ) ) {
1520
-                    if ( 0 !== $tax_rate['rate'] || !empty( $tax_rate['rate'] ) ) {
1521
-                        $rate = number_format( $tax_rate['rate'], 4 );
1519
+                if (!empty($tax_rate['global'])) {
1520
+                    if (0 !== $tax_rate['rate'] || !empty($tax_rate['rate'])) {
1521
+                        $rate = number_format($tax_rate['rate'], 4);
1522 1522
                     }
1523 1523
                 } else {
1524
-                    if ( empty( $tax_rate['state'] ) || strtolower( $state ) != strtolower( $tax_rate['state'] ) )
1524
+                    if (empty($tax_rate['state']) || strtolower($state) != strtolower($tax_rate['state']))
1525 1525
                         continue;
1526 1526
 
1527 1527
                     $state_rate = $tax_rate['rate'];
1528
-                    if ( 0 !== $state_rate || !empty( $state_rate ) ) {
1529
-                        $rate = number_format( $state_rate, 4 );
1528
+                    if (0 !== $state_rate || !empty($state_rate)) {
1529
+                        $rate = number_format($state_rate, 4);
1530 1530
                     }
1531 1531
                 }
1532 1532
             }
@@ -1535,84 +1535,84 @@  discard block
 block discarded – undo
1535 1535
         return $rate;
1536 1536
     }
1537 1537
 
1538
-    public static function get_rate( $rate = 1, $country = '', $state = '', $item_id = 0 ) {
1538
+    public static function get_rate($rate = 1, $country = '', $state = '', $item_id = 0) {
1539 1539
         global $wpinv_options, $wpi_item_id, $wpi_zero_tax;
1540 1540
 
1541 1541
         $item_id = $item_id > 0 ? $item_id : $wpi_item_id;
1542 1542
         $allow_vat_classes = self::allow_vat_classes();
1543
-        $class = $item_id ? self::get_item_class( $item_id ) : '_standard';
1543
+        $class = $item_id ? self::get_item_class($item_id) : '_standard';
1544 1544
 
1545
-        if ( $class === '_exempt' || $wpi_zero_tax ) {
1545
+        if ($class === '_exempt' || $wpi_zero_tax) {
1546 1546
             return 0;
1547
-        } else if ( !$allow_vat_classes ) {
1547
+        } else if (!$allow_vat_classes) {
1548 1548
             $class = '_standard';
1549 1549
         }
1550 1550
 
1551
-        if( !empty( $_POST['wpinv_country'] ) ) {
1551
+        if (!empty($_POST['wpinv_country'])) {
1552 1552
             $post_country = $_POST['wpinv_country'];
1553
-        } elseif( !empty( $_POST['wpinv_country'] ) ) {
1553
+        } elseif (!empty($_POST['wpinv_country'])) {
1554 1554
             $post_country = $_POST['wpinv_country'];
1555
-        } elseif( !empty( $_POST['country'] ) ) {
1555
+        } elseif (!empty($_POST['country'])) {
1556 1556
             $post_country = $_POST['country'];
1557 1557
         } else {
1558 1558
             $post_country = '';
1559 1559
         }
1560 1560
 
1561
-        $country        = !empty( $post_country ) ? $post_country : wpinv_default_billing_country( $country );
1562
-        $base_country   = wpinv_is_base_country( $country );
1561
+        $country        = !empty($post_country) ? $post_country : wpinv_default_billing_country($country);
1562
+        $base_country   = wpinv_is_base_country($country);
1563 1563
 
1564
-        $requires_vat   = self::requires_vat( 0, false );
1565
-        $is_digital     = self::get_item_rule( $item_id ) == 'digital' ;
1566
-        $rate           = $requires_vat && isset( $wpinv_options['eu_fallback_rate'] ) ? $wpinv_options['eu_fallback_rate'] : $rate;
1564
+        $requires_vat   = self::requires_vat(0, false);
1565
+        $is_digital     = self::get_item_rule($item_id) == 'digital';
1566
+        $rate           = $requires_vat && isset($wpinv_options['eu_fallback_rate']) ? $wpinv_options['eu_fallback_rate'] : $rate;
1567 1567
 
1568
-        if ( self::same_country_rule() == 'no' && $base_country ) { // Disable VAT to same country
1568
+        if (self::same_country_rule() == 'no' && $base_country) { // Disable VAT to same country
1569 1569
             $rate = 0;
1570
-        } else if ( $requires_vat ) {
1571
-            $vat_number = self::get_user_vat_number( '', 0, true );
1570
+        } else if ($requires_vat) {
1571
+            $vat_number = self::get_user_vat_number('', 0, true);
1572 1572
             $vat_info   = self::current_vat_data();
1573 1573
 
1574
-            if ( is_array( $vat_info ) ) {
1575
-                $vat_number = isset( $vat_info['number'] ) && !empty( $vat_info['valid'] ) ? $vat_info['number'] : "";
1574
+            if (is_array($vat_info)) {
1575
+                $vat_number = isset($vat_info['number']) && !empty($vat_info['valid']) ? $vat_info['number'] : "";
1576 1576
             }
1577 1577
 
1578
-            if ( $country == 'UK' ) {
1578
+            if ($country == 'UK') {
1579 1579
                 $country = 'GB';
1580 1580
             }
1581 1581
 
1582
-            if ( !empty( $vat_number ) ) {
1582
+            if (!empty($vat_number)) {
1583 1583
                 $rate = 0;
1584 1584
             } else {
1585
-                $rate = self::find_rate( $country, $state, $rate, $class ); // Fix if there are no tax rated and you try to pay an invoice it does not add the fallback tax rate
1585
+                $rate = self::find_rate($country, $state, $rate, $class); // Fix if there are no tax rated and you try to pay an invoice it does not add the fallback tax rate
1586 1586
             }
1587 1587
 
1588
-            if ( empty( $vat_number ) && !$is_digital ) {
1589
-                if ( $base_country ) {
1590
-                    $rate = self::find_rate( $country, null, $rate, $class );
1588
+            if (empty($vat_number) && !$is_digital) {
1589
+                if ($base_country) {
1590
+                    $rate = self::find_rate($country, null, $rate, $class);
1591 1591
                 } else {
1592
-                    if ( empty( $country ) && isset( $wpinv_options['eu_fallback_rate'] ) ) {
1592
+                    if (empty($country) && isset($wpinv_options['eu_fallback_rate'])) {
1593 1593
                         $rate = $wpinv_options['eu_fallback_rate'];
1594
-                    } else if( !empty( $country ) ) {
1595
-                        $rate = self::find_rate( $country, $state, $rate, $class );
1594
+                    } else if (!empty($country)) {
1595
+                        $rate = self::find_rate($country, $state, $rate, $class);
1596 1596
                     }
1597 1597
                 }
1598
-            } else if ( empty( $vat_number ) || ( self::same_country_rule() == 'always' && $base_country ) ) {
1599
-                if ( empty( $country ) && isset( $wpinv_options['eu_fallback_rate'] ) ) {
1598
+            } else if (empty($vat_number) || (self::same_country_rule() == 'always' && $base_country)) {
1599
+                if (empty($country) && isset($wpinv_options['eu_fallback_rate'])) {
1600 1600
                     $rate = $wpinv_options['eu_fallback_rate'];
1601
-                } else if( !empty( $country ) ) {
1602
-                    $rate = self::find_rate( $country, $state, $rate, $class );
1601
+                } else if (!empty($country)) {
1602
+                    $rate = self::find_rate($country, $state, $rate, $class);
1603 1603
                 }
1604 1604
             }
1605 1605
         } else {
1606
-            if ( $is_digital ) {
1606
+            if ($is_digital) {
1607 1607
                 $ip_country_code = self::get_country_by_ip();
1608 1608
 
1609
-                if ( $ip_country_code && self::is_eu_state( $ip_country_code ) ) {
1610
-                    $rate = self::find_rate( $ip_country_code, '', 0, $class );
1609
+                if ($ip_country_code && self::is_eu_state($ip_country_code)) {
1610
+                    $rate = self::find_rate($ip_country_code, '', 0, $class);
1611 1611
                 } else {
1612
-                    $rate = self::find_rate( $country, $state, $rate, $class );
1612
+                    $rate = self::find_rate($country, $state, $rate, $class);
1613 1613
                 }
1614 1614
             } else {
1615
-                $rate = self::find_rate( $country, $state, $rate, $class );
1615
+                $rate = self::find_rate($country, $state, $rate, $class);
1616 1616
             }
1617 1617
         }
1618 1618
 
@@ -1620,48 +1620,48 @@  discard block
 block discarded – undo
1620 1620
     }
1621 1621
 
1622 1622
     public static function current_vat_data() {
1623
-        return getpaid_session()->get( 'user_vat_data' );
1623
+        return getpaid_session()->get('user_vat_data');
1624 1624
     }
1625 1625
 
1626
-    public static function get_user_country( $country = '', $user_id = 0 ) {
1627
-        $user_address = wpinv_get_user_address( $user_id, false );
1626
+    public static function get_user_country($country = '', $user_id = 0) {
1627
+        $user_address = wpinv_get_user_address($user_id, false);
1628 1628
 
1629
-        if ( wpinv_get_option( 'vat_ip_country_default' ) ) {
1629
+        if (wpinv_get_option('vat_ip_country_default')) {
1630 1630
             $country = '';
1631 1631
         }
1632 1632
 
1633
-        $country    = empty( $user_address ) || !isset( $user_address['country'] ) || empty( $user_address['country'] ) ? $country : $user_address['country'];
1634
-        $result     = apply_filters( 'wpinv_get_user_country', $country, $user_id );
1633
+        $country    = empty($user_address) || !isset($user_address['country']) || empty($user_address['country']) ? $country : $user_address['country'];
1634
+        $result     = apply_filters('wpinv_get_user_country', $country, $user_id);
1635 1635
 
1636
-        if ( empty( $result ) ) {
1636
+        if (empty($result)) {
1637 1637
             $result = self::get_country_by_ip();
1638 1638
         }
1639 1639
 
1640 1640
         return $result;
1641 1641
     }
1642 1642
 
1643
-    public static function set_user_country( $country = '', $user_id = 0 ) {
1643
+    public static function set_user_country($country = '', $user_id = 0) {
1644 1644
         global $wpi_userID;
1645 1645
 
1646
-        if ( empty($country) && !empty($wpi_userID) && get_current_user_id() != $wpi_userID ) {
1646
+        if (empty($country) && !empty($wpi_userID) && get_current_user_id() != $wpi_userID) {
1647 1647
             $country = wpinv_get_default_country();
1648 1648
         }
1649 1649
 
1650 1650
         return $country;
1651 1651
     }
1652 1652
 
1653
-    public static function get_user_vat_number( $vat_number = '', $user_id = 0, $is_valid = false ) {
1653
+    public static function get_user_vat_number($vat_number = '', $user_id = 0, $is_valid = false) {
1654 1654
         global $wpi_current_id, $wpi_userID;
1655 1655
 
1656
-        if ( !empty( $_POST['new_user'] ) ) {
1656
+        if (!empty($_POST['new_user'])) {
1657 1657
             return '';
1658 1658
         }
1659 1659
 
1660
-        if ( empty( $user_id ) ) {
1661
-            $user_id = !empty( $wpi_userID ) ? $wpi_userID : ( $wpi_current_id ? wpinv_get_user_id( $wpi_current_id ) : get_current_user_id() );
1660
+        if (empty($user_id)) {
1661
+            $user_id = !empty($wpi_userID) ? $wpi_userID : ($wpi_current_id ? wpinv_get_user_id($wpi_current_id) : get_current_user_id());
1662 1662
         }
1663 1663
 
1664
-        $vat_number = empty( $user_id ) ? '' : get_user_meta( $user_id, '_wpinv_vat_number', true );
1664
+        $vat_number = empty($user_id) ? '' : get_user_meta($user_id, '_wpinv_vat_number', true);
1665 1665
 
1666 1666
         /* TODO
1667 1667
         if ( $is_valid && $vat_number ) {
@@ -1672,38 +1672,38 @@  discard block
 block discarded – undo
1672 1672
         }
1673 1673
         */
1674 1674
 
1675
-        return apply_filters('wpinv_get_user_vat_number', $vat_number, $user_id, $is_valid );
1675
+        return apply_filters('wpinv_get_user_vat_number', $vat_number, $user_id, $is_valid);
1676 1676
     }
1677 1677
 
1678
-    public static function get_user_company( $company = '', $user_id = 0 ) {
1678
+    public static function get_user_company($company = '', $user_id = 0) {
1679 1679
         global $wpi_current_id, $wpi_userID;
1680 1680
 
1681
-        if ( empty( $user_id ) ) {
1682
-            $user_id = !empty( $wpi_userID ) ? $wpi_userID : ( $wpi_current_id ? wpinv_get_user_id( $wpi_current_id ) : get_current_user_id() );
1681
+        if (empty($user_id)) {
1682
+            $user_id = !empty($wpi_userID) ? $wpi_userID : ($wpi_current_id ? wpinv_get_user_id($wpi_current_id) : get_current_user_id());
1683 1683
         }
1684 1684
 
1685
-        $company = empty( $user_id ) ? "" : get_user_meta( $user_id, '_wpinv_company', true );
1685
+        $company = empty($user_id) ? "" : get_user_meta($user_id, '_wpinv_company', true);
1686 1686
 
1687
-        return apply_filters( 'wpinv_user_company', $company, $user_id );
1687
+        return apply_filters('wpinv_user_company', $company, $user_id);
1688 1688
     }
1689 1689
 
1690
-    public static function save_user_vat_details( $company = '', $vat_number = '' ) {
1691
-        $save = apply_filters( 'wpinv_allow_save_user_vat_details', true );
1690
+    public static function save_user_vat_details($company = '', $vat_number = '') {
1691
+        $save = apply_filters('wpinv_allow_save_user_vat_details', true);
1692 1692
 
1693
-        if ( is_user_logged_in() && $save ) {
1693
+        if (is_user_logged_in() && $save) {
1694 1694
             $user_id = get_current_user_id();
1695 1695
 
1696
-            if ( !empty( $vat_number ) ) {
1697
-                update_user_meta( $user_id, '_wpinv_vat_number', $vat_number );
1696
+            if (!empty($vat_number)) {
1697
+                update_user_meta($user_id, '_wpinv_vat_number', $vat_number);
1698 1698
             } else {
1699
-                delete_user_meta( $user_id, '_wpinv_vat_number');
1699
+                delete_user_meta($user_id, '_wpinv_vat_number');
1700 1700
             }
1701 1701
 
1702
-            if ( !empty( $company ) ) {
1703
-                update_user_meta( $user_id, '_wpinv_company', $company );
1702
+            if (!empty($company)) {
1703
+                update_user_meta($user_id, '_wpinv_company', $company);
1704 1704
             } else {
1705
-                delete_user_meta( $user_id, '_wpinv_company');
1706
-                delete_user_meta( $user_id, '_wpinv_vat_number');
1705
+                delete_user_meta($user_id, '_wpinv_company');
1706
+                delete_user_meta($user_id, '_wpinv_vat_number');
1707 1707
             }
1708 1708
         }
1709 1709
 
@@ -1716,74 +1716,74 @@  discard block
 block discarded – undo
1716 1716
         $response               = array();
1717 1717
         $response['success']    = false;
1718 1718
 
1719
-        if ( empty( $_REQUEST['_wpi_nonce'] ) || ( !empty( $_REQUEST['_wpi_nonce'] ) && !wp_verify_nonce( $_REQUEST['_wpi_nonce'], 'vat_validation' ) ) ) {
1720
-            $response['error'] = __( 'Invalid security nonce', 'invoicing' );
1721
-            wp_send_json( $response );
1719
+        if (empty($_REQUEST['_wpi_nonce']) || (!empty($_REQUEST['_wpi_nonce']) && !wp_verify_nonce($_REQUEST['_wpi_nonce'], 'vat_validation'))) {
1720
+            $response['error'] = __('Invalid security nonce', 'invoicing');
1721
+            wp_send_json($response);
1722 1722
         }
1723 1723
 
1724 1724
         $vat_name   = self::get_vat_name();
1725 1725
 
1726
-        $company    = !empty( $_POST['company'] ) ? sanitize_text_field( $_POST['company'] ) : '';
1727
-        $vat_number = !empty( $_POST['number'] ) ? sanitize_text_field( $_POST['number'] ) : '';
1726
+        $company    = !empty($_POST['company']) ? sanitize_text_field($_POST['company']) : '';
1727
+        $vat_number = !empty($_POST['number']) ? sanitize_text_field($_POST['number']) : '';
1728 1728
 
1729
-        $vat_info = getpaid_session()->get( 'user_vat_data' );
1730
-        if ( !is_array( $vat_info ) || empty( $vat_info ) ) {
1731
-            $vat_info = array( 'company'=> $company, 'number' => '', 'valid' => true );
1729
+        $vat_info = getpaid_session()->get('user_vat_data');
1730
+        if (!is_array($vat_info) || empty($vat_info)) {
1731
+            $vat_info = array('company'=> $company, 'number' => '', 'valid' => true);
1732 1732
         }
1733 1733
 
1734
-        if ( empty( $vat_number ) ) {
1735
-            $response['error'] = wp_sprintf( __( 'Please enter your %s number!', 'invoicing' ), $vat_name );
1734
+        if (empty($vat_number)) {
1735
+            $response['error'] = wp_sprintf(__('Please enter your %s number!', 'invoicing'), $vat_name);
1736 1736
             $vat_info['valid'] = false;
1737
-            getpaid_session()->set( 'user_vat_data', $vat_info );
1738
-            wp_send_json( $response );
1737
+            getpaid_session()->set('user_vat_data', $vat_info);
1738
+            wp_send_json($response);
1739 1739
         }
1740 1740
 
1741
-        if ( empty( $company ) ) {
1741
+        if (empty($company)) {
1742 1742
             $vat_info['valid'] = false;
1743
-            getpaid_session()->set( 'user_vat_data', $vat_info );
1743
+            getpaid_session()->set('user_vat_data', $vat_info);
1744 1744
 
1745
-            $response['error'] = __( 'Please enter your registered company name!', 'invoicing' );
1746
-            wp_send_json( $response );
1745
+            $response['error'] = __('Please enter your registered company name!', 'invoicing');
1746
+            wp_send_json($response);
1747 1747
         }
1748 1748
 
1749
-        if ( !empty( $wpinv_options['vat_vies_check'] ) ) {
1750
-            if ( empty( $wpinv_options['vat_offline_check'] ) && !self::offline_check( $vat_number ) ) {
1749
+        if (!empty($wpinv_options['vat_vies_check'])) {
1750
+            if (empty($wpinv_options['vat_offline_check']) && !self::offline_check($vat_number)) {
1751 1751
                 $vat_info['valid'] = false;
1752
-                getpaid_session()->set( 'user_vat_data', $vat_info );
1752
+                getpaid_session()->set('user_vat_data', $vat_info);
1753 1753
 
1754
-                $response['error'] = wp_sprintf( __( '%s number not validated', 'invoicing' ), $vat_name );
1755
-                wp_send_json( $response );
1754
+                $response['error'] = wp_sprintf(__('%s number not validated', 'invoicing'), $vat_name);
1755
+                wp_send_json($response);
1756 1756
             }
1757 1757
 
1758 1758
             $response['success'] = true;
1759
-            $response['message'] = wp_sprintf( __( '%s number validated', 'invoicing' ), $vat_name );
1759
+            $response['message'] = wp_sprintf(__('%s number validated', 'invoicing'), $vat_name);
1760 1760
         } else {
1761
-            $result = self::check_vat( $vat_number );
1761
+            $result = self::check_vat($vat_number);
1762 1762
 
1763
-            if ( empty( $result['valid'] ) ) {
1763
+            if (empty($result['valid'])) {
1764 1764
                 $response['error'] = $result['message'];
1765
-                wp_send_json( $response );
1765
+                wp_send_json($response);
1766 1766
             }
1767 1767
 
1768
-            $vies_company = !empty( $result['company'] ) ? $result['company'] : '';
1769
-            $vies_company = apply_filters( 'wpinv_vies_company_name', $vies_company );
1768
+            $vies_company = !empty($result['company']) ? $result['company'] : '';
1769
+            $vies_company = apply_filters('wpinv_vies_company_name', $vies_company);
1770 1770
 
1771
-            $valid_company = $vies_company && $company && ( $vies_company == '---' || strcasecmp( trim( $vies_company ), trim( $company ) ) == 0 ) ? true : false;
1771
+            $valid_company = $vies_company && $company && ($vies_company == '---' || strcasecmp(trim($vies_company), trim($company)) == 0) ? true : false;
1772 1772
 
1773
-            if ( !empty( $wpinv_options['vat_disable_company_name_check'] ) || $valid_company ) {
1773
+            if (!empty($wpinv_options['vat_disable_company_name_check']) || $valid_company) {
1774 1774
                 $response['success'] = true;
1775
-                $response['message'] = wp_sprintf( __( '%s number validated', 'invoicing' ), $vat_name );
1775
+                $response['message'] = wp_sprintf(__('%s number validated', 'invoicing'), $vat_name);
1776 1776
             } else {
1777 1777
                 $vat_info['valid'] = false;
1778
-                getpaid_session()->set( 'user_vat_data', $vat_info );
1778
+                getpaid_session()->set('user_vat_data', $vat_info);
1779 1779
 
1780 1780
                 $response['success'] = false;
1781
-                $response['message'] = wp_sprintf( __( 'The company name associated with the %s number provided is not the same as the company name provided.', 'invoicing' ), $vat_name );
1782
-                wp_send_json( $response );
1781
+                $response['message'] = wp_sprintf(__('The company name associated with the %s number provided is not the same as the company name provided.', 'invoicing'), $vat_name);
1782
+                wp_send_json($response);
1783 1783
             }
1784 1784
         }
1785 1785
 
1786
-        wp_send_json( $response );
1786
+        wp_send_json($response);
1787 1787
     }
1788 1788
 
1789 1789
     /**
@@ -1791,16 +1791,16 @@  discard block
 block discarded – undo
1791 1791
      * 
1792 1792
      * @return string
1793 1793
      */
1794
-    public static function validate_vat_number( $vat_number, $company, $country ) {
1794
+    public static function validate_vat_number($vat_number, $company, $country) {
1795 1795
         global $wpinv_options;
1796 1796
 
1797 1797
         // If we are not checking the vat number via view...
1798
-        if ( ! empty( $wpinv_options['vat_vies_check'] ) ) {
1798
+        if (!empty($wpinv_options['vat_vies_check'])) {
1799 1799
 
1800 1800
             // Try validating via regex.
1801
-            if ( empty( $wpinv_options['vat_offline_check'] ) && ! self::offline_check( $vat_number, $country ) ) {
1801
+            if (empty($wpinv_options['vat_offline_check']) && !self::offline_check($vat_number, $country)) {
1802 1802
                 return wp_sprintf(
1803
-                    __( 'Your %s number is invalid', 'invoicing' ),
1803
+                    __('Your %s number is invalid', 'invoicing'),
1804 1804
                     getpaid_vat_name()
1805 1805
                 );
1806 1806
             }
@@ -1809,23 +1809,23 @@  discard block
 block discarded – undo
1809 1809
         }
1810 1810
 
1811 1811
         // Validate the vat number.
1812
-        $result = self::check_vat( $vat_number, $country );
1812
+        $result = self::check_vat($vat_number, $country);
1813 1813
 
1814
-        if ( empty( $result['valid'] ) ) {
1814
+        if (empty($result['valid'])) {
1815 1815
             return wp_sprintf(
1816
-                __( 'Failed to validate the %s number via EU Commission VAT server (VIES).', 'invoicing' ),
1816
+                __('Failed to validate the %s number via EU Commission VAT server (VIES).', 'invoicing'),
1817 1817
                 getpaid_vat_name()
1818 1818
             );
1819 1819
         }
1820 1820
 
1821 1821
         // Validate the company.
1822
-        $vies_company  = ! empty( $result['company'] ) ? $result['company'] : '';
1823
-        $vies_company  = apply_filters( 'wpinv_vies_company_name', $vies_company );
1824
-        $valid_company = $vies_company && $company && ( $vies_company == '---' || strcasecmp( trim( $vies_company ), trim( $company ) ) == 0 ) ? true : false;
1822
+        $vies_company  = !empty($result['company']) ? $result['company'] : '';
1823
+        $vies_company  = apply_filters('wpinv_vies_company_name', $vies_company);
1824
+        $valid_company = $vies_company && $company && ($vies_company == '---' || strcasecmp(trim($vies_company), trim($company)) == 0) ? true : false;
1825 1825
 
1826
-        if ( ! $valid_company && ! empty( $wpinv_options['vat_disable_company_name_check'] ) ) {
1826
+        if (!$valid_company && !empty($wpinv_options['vat_disable_company_name_check'])) {
1827 1827
            return wp_sprintf(
1828
-                __( 'The company name associated with the %s number provided is not the same as the company name provided.', 'invoicing' ),
1828
+                __('The company name associated with the %s number provided is not the same as the company name provided.', 'invoicing'),
1829 1829
                 getpaid_vat_name()
1830 1830
             );
1831 1831
         }
Please login to merge, or discard this patch.
templates/payment-forms/elements/ip_address.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -7,17 +7,17 @@
 block discarded – undo
7 7
  * @version 1.0.19
8 8
  */
9 9
 
10
-defined( 'ABSPATH' ) || exit;
10
+defined('ABSPATH') || exit;
11 11
 
12
-if ( empty( $text ) ) {
13
-    $text = __( 'Your IP address is:', 'invoicing' );
12
+if (empty($text)) {
13
+    $text = __('Your IP address is:', 'invoicing');
14 14
 }
15 15
 
16
-$ip_address = sanitize_text_field( wpinv_get_ip() );
17
-$url        = esc_url( getpaid_ip_location_url( $ip_address ) );
16
+$ip_address = sanitize_text_field(wpinv_get_ip());
17
+$url        = esc_url(getpaid_ip_location_url($ip_address));
18 18
 
19 19
 ?>
20 20
 <div class="form-group getpaid-ip-info">
21
-    <span><?php echo wp_kses_post( $text ); ?></span>
21
+    <span><?php echo wp_kses_post($text); ?></span>
22 22
     <a target='_blank' href='<?php echo $url; ?>'><?php echo $ip_address; ?>&nbsp;&nbsp;<i class='fa fa-external-link-square' aria-hidden='true'></i></a>
23 23
 </div>
Please login to merge, or discard this patch.
templates/geolocation.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@  discard block
 block discarded – undo
7 7
  * @version 1.0.19
8 8
  */
9 9
 
10
-defined( 'ABSPATH' ) || exit;
10
+defined('ABSPATH') || exit;
11 11
 
12 12
 
13 13
 ?><!DOCTYPE html>
@@ -16,14 +16,14 @@  discard block
 block discarded – undo
16 16
 
17 17
     <head>
18 18
 
19
-		<meta charset="<?php bloginfo( 'charset' ); ?>">
19
+		<meta charset="<?php bloginfo('charset'); ?>">
20 20
         <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" >
21 21
 
22 22
         <meta name="robots" content="noindex,nofollow">
23 23
 
24 24
 		<link rel="profile" href="https://gmpg.org/xfn/11">
25 25
 
26
-        <title><?php _e( 'GetPaid GeoLocation', 'invoicing' ); ?></title>
26
+        <title><?php _e('GetPaid GeoLocation', 'invoicing'); ?></title>
27 27
 
28 28
         <link rel="stylesheet" href="https://unpkg.com/[email protected]/dist/leaflet.css" />
29 29
         <script src="https://unpkg.com/[email protected]/dist/leaflet.js"></script>
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
             var osmUrl = 'http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',
70 70
                 osmAttrib = '&copy; <a href="http://openstreetmap.org/copyright">OpenStreetMap</a> contributors',
71 71
                 osm = L.tileLayer( osmUrl, { maxZoom: 18, attribution: osmAttrib } ),
72
-                latlng = new L.LatLng( <?php echo sanitize_text_field( $latitude );?>, <?php echo sanitize_text_field( $longitude );?> );
72
+                latlng = new L.LatLng( <?php echo sanitize_text_field($latitude); ?>, <?php echo sanitize_text_field($longitude); ?> );
73 73
 
74 74
             var map = new L.Map( 'map', {center: latlng, zoom: 18, layers: [osm]});
75 75
 
@@ -77,11 +77,11 @@  discard block
 block discarded – undo
77 77
             map.addLayer(marker);
78 78
 
79 79
             marker
80
-                .bindPopup("<p><?php echo esc_attr( $address );?></p>")
80
+                .bindPopup("<p><?php echo esc_attr($address); ?></p>")
81 81
                 .openPopup();
82 82
         </script>
83 83
 
84
-        <div style="height:100px"><?php echo wp_kses_post( $content ); ?></div>
84
+        <div style="height:100px"><?php echo wp_kses_post($content); ?></div>
85 85
 
86 86
     </body>
87 87
 
Please login to merge, or discard this patch.
templates/payment-forms/cart-totals.php 1 patch
Spacing   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -7,16 +7,16 @@  discard block
 block discarded – undo
7 7
  * @version 1.0.19
8 8
  */
9 9
 
10
-defined( 'ABSPATH' ) || exit;
10
+defined('ABSPATH') || exit;
11 11
 
12 12
 // Totals rows.
13 13
 $totals = apply_filters(
14 14
     'getpaid_payment_form_cart_table_totals',
15 15
     array(
16
-        'subtotal' => __( 'Subtotal', 'invoicing' ),
17
-        'tax'      => __( 'Tax', 'invoicing' ),
18
-        'discount' => __( 'Discount', 'invoicing' ),
19
-        'total'    => __( 'Total', 'invoicing' ),
16
+        'subtotal' => __('Subtotal', 'invoicing'),
17
+        'tax'      => __('Tax', 'invoicing'),
18
+        'discount' => __('Discount', 'invoicing'),
19
+        'total'    => __('Total', 'invoicing'),
20 20
     ),
21 21
     $form
22 22
 );
@@ -24,15 +24,15 @@  discard block
 block discarded – undo
24 24
 $currency = $form->get_currency();
25 25
 $country  = wpinv_get_default_country();
26 26
 
27
-if ( ! empty( $form->invoice ) ) {
28
-    $country  = $form->invoice->get_country();
27
+if (!empty($form->invoice)) {
28
+    $country = $form->invoice->get_country();
29 29
 }
30 30
 
31
-if ( ! wpinv_use_taxes() && isset( $totals['tax'] ) ) {
32
-    unset( $totals['tax'] );
31
+if (!wpinv_use_taxes() && isset($totals['tax'])) {
32
+    unset($totals['tax']);
33 33
 }
34 34
 
35
-do_action( 'getpaid_before_payment_form_cart_totals', $form, $totals );
35
+do_action('getpaid_before_payment_form_cart_totals', $form, $totals);
36 36
 
37 37
 $tax       = 0;
38 38
 $sub_total = 0;
@@ -40,9 +40,9 @@  discard block
 block discarded – undo
40 40
 $discount  = 0;
41 41
 
42 42
 // Calculate totals.
43
-foreach ( $form->get_items() as $item ) {
43
+foreach ($form->get_items() as $item) {
44 44
 
45
-    if ( ! empty( $form->invoice ) && 'amount' == $form->invoice->get_template() ) {
45
+    if (!empty($form->invoice) && 'amount' == $form->invoice->get_template()) {
46 46
         $amount = $item->get_price();
47 47
     } else {
48 48
         $amount = $item->get_sub_total();
@@ -50,11 +50,11 @@  discard block
 block discarded – undo
50 50
 
51 51
 
52 52
     // Include the tax.
53
-    if ( wpinv_use_taxes() ) {
54
-        $rate = wpinv_get_tax_rate( $country, false, $item->get_id() );
53
+    if (wpinv_use_taxes()) {
54
+        $rate = wpinv_get_tax_rate($country, false, $item->get_id());
55 55
 
56
-        if ( wpinv_prices_include_tax() ) {
57
-            $pre_tax  = ( $amount - $amount * $rate * 0.01 );
56
+        if (wpinv_prices_include_tax()) {
57
+            $pre_tax  = ($amount - $amount * $rate * 0.01);
58 58
             $item_tax = $amount - $pre_tax;
59 59
         } else {
60 60
             $pre_tax  = $amount;
@@ -66,41 +66,41 @@  discard block
 block discarded – undo
66 66
         $total     = $sub_total + $tax;
67 67
 
68 68
     } else {
69
-        $total  = $total + $amount;
69
+        $total = $total + $amount;
70 70
     }
71 71
 
72 72
 }
73 73
 
74 74
 ?>
75 75
 <div class='border-top getpaid-payment-form-items-cart-totals'>
76
-    <?php foreach ( $totals as $key => $label ) : ?>
77
-        <div class="getpaid-form-cart-totals-col getpaid-form-cart-totals-<?php echo esc_attr( $key ); ?>">
76
+    <?php foreach ($totals as $key => $label) : ?>
77
+        <div class="getpaid-form-cart-totals-col getpaid-form-cart-totals-<?php echo esc_attr($key); ?>">
78 78
             <div class="row">
79 79
                 <div class="col-12 offset-sm-5 col-sm-4">
80
-                    <?php echo sanitize_text_field( $label ); ?>
80
+                    <?php echo sanitize_text_field($label); ?>
81 81
                 </div>
82
-                <div class="col-12 col-sm-3 getpaid-form-cart-totals-total-<?php echo esc_attr( $key ); ?>">
82
+                <div class="col-12 col-sm-3 getpaid-form-cart-totals-total-<?php echo esc_attr($key); ?>">
83 83
                     <?php
84
-                        do_action( "getpaid_payment_form_cart_totals_$key", $form );
84
+                        do_action("getpaid_payment_form_cart_totals_$key", $form);
85 85
 
86 86
                         // Total tax.
87
-                        if ( 'tax' == $key ) {
88
-                            echo wpinv_price( wpinv_format_amount( $tax ), $currency );
87
+                        if ('tax' == $key) {
88
+                            echo wpinv_price(wpinv_format_amount($tax), $currency);
89 89
                         }
90 90
 
91 91
                         // Total discount.
92
-                        if ( 'discount' == $key ) {
93
-                            echo wpinv_price( wpinv_format_amount( $discount ), $currency );
92
+                        if ('discount' == $key) {
93
+                            echo wpinv_price(wpinv_format_amount($discount), $currency);
94 94
                         }
95 95
 
96 96
                         // Sub total.
97
-                        if ( 'subtotal' == $key ) {
98
-                            echo wpinv_price( wpinv_format_amount( $sub_total ), $currency );
97
+                        if ('subtotal' == $key) {
98
+                            echo wpinv_price(wpinv_format_amount($sub_total), $currency);
99 99
                         }
100 100
 
101 101
                         // Total.
102
-                        if ( 'total' == $key ) {
103
-                            echo wpinv_price( wpinv_format_amount( $total ), $currency );
102
+                        if ('total' == $key) {
103
+                            echo wpinv_price(wpinv_format_amount($total), $currency);
104 104
                         }
105 105
                     ?>
106 106
                 </div>
@@ -110,4 +110,4 @@  discard block
 block discarded – undo
110 110
 </div>
111 111
 
112 112
 <?php
113
-do_action(  'getpaid_payment_form_cart_totals', $form, $totals );
113
+do_action('getpaid_payment_form_cart_totals', $form, $totals);
Please login to merge, or discard this patch.
includes/gateways/class-getpaid-bank-transfer-gateway.php 2 patches
Spacing   +66 added lines, -66 removed lines patch added patch discarded remove patch
@@ -4,7 +4,7 @@  discard block
 block discarded – undo
4 4
  *
5 5
  */
6 6
 
7
-defined( 'ABSPATH' ) || exit;
7
+defined('ABSPATH') || exit;
8 8
 
9 9
 /**
10 10
  * Bank transfer Payment Gateway class.
@@ -32,14 +32,14 @@  discard block
 block discarded – undo
32 32
 	public function __construct() {
33 33
         parent::__construct();
34 34
 
35
-        $this->title                = __( 'Direct bank transfer', 'invoicing' );
36
-        $this->method_title         = __( 'Bank transfer', 'invoicing' );
37
-        $this->checkout_button_text = __( 'Proceed', 'invoicing' );
38
-        $this->instructions         = apply_filters( 'wpinv_bank_instructions', $this->get_option( 'info' ) );
35
+        $this->title                = __('Direct bank transfer', 'invoicing');
36
+        $this->method_title         = __('Bank transfer', 'invoicing');
37
+        $this->checkout_button_text = __('Proceed', 'invoicing');
38
+        $this->instructions         = apply_filters('wpinv_bank_instructions', $this->get_option('info'));
39 39
 
40
-		add_action( 'wpinv_receipt_end', array( $this, 'thankyou_page' ) );
41
-		add_action( 'getpaid_invoice_line_items', array( $this, 'thankyou_page' ), 40 );
42
-		add_action( 'wpinv_email_invoice_details', array( $this, 'email_instructions' ), 10, 3 );
40
+		add_action('wpinv_receipt_end', array($this, 'thankyou_page'));
41
+		add_action('getpaid_invoice_line_items', array($this, 'thankyou_page'), 40);
42
+		add_action('wpinv_email_invoice_details', array($this, 'email_instructions'), 10, 3);
43 43
 
44 44
     }
45 45
 
@@ -52,23 +52,23 @@  discard block
 block discarded – undo
52 52
 	 * @param GetPaid_Payment_Form_Submission $submission Checkout submission.
53 53
 	 * @return array
54 54
 	 */
55
-	public function process_payment( $invoice, $submission_data, $submission ) {
55
+	public function process_payment($invoice, $submission_data, $submission) {
56 56
 
57 57
         // Add a transaction id.
58
-        $invoice->set_transaction_id( $invoice->generate_key('trans_') );
58
+        $invoice->set_transaction_id($invoice->generate_key('trans_'));
59 59
 
60 60
         // Set it as pending payment.
61
-        if ( ! $invoice->needs_payment() ) {
61
+        if (!$invoice->needs_payment()) {
62 62
             $invoice->mark_paid();
63
-        } else if ( ! $invoice->is_paid() ) {
64
-            $invoice->set_status( 'wpi-onhold' );
63
+        } else if (!$invoice->is_paid()) {
64
+            $invoice->set_status('wpi-onhold');
65 65
         }
66 66
 
67 67
         // Save it.
68 68
         $invoice->save();
69 69
 
70 70
         // Send to the success page.
71
-        wpinv_send_to_success_page( array( 'invoice_key' => $invoice->get_key() ) );
71
+        wpinv_send_to_success_page(array('invoice_key' => $invoice->get_key()));
72 72
 
73 73
     }
74 74
 
@@ -77,17 +77,17 @@  discard block
 block discarded – undo
77 77
 	 *
78 78
 	 * @param WPInv_Invoice $invoice Invoice.
79 79
 	 */
80
-	public function thankyou_page( $invoice ) {
80
+	public function thankyou_page($invoice) {
81 81
 
82
-        if ( 'bank_transfer' === $invoice->get_gateway() && $invoice->needs_payment() ) {
82
+        if ('bank_transfer' === $invoice->get_gateway() && $invoice->needs_payment()) {
83 83
 
84 84
 			echo '<div class="mt-4 mb-2 getpaid-bank-transfer-details">' . PHP_EOL;
85 85
 
86
-            if ( ! empty( $this->instructions ) ) {
87
-                echo wp_kses_post( wpautop( wptexturize( $this->instructions ) ) );
86
+            if (!empty($this->instructions)) {
87
+                echo wp_kses_post(wpautop(wptexturize($this->instructions)));
88 88
 			}
89 89
 
90
-			$this->bank_details( $invoice );
90
+			$this->bank_details($invoice);
91 91
 			
92 92
 			echo '</div>';
93 93
         
@@ -102,17 +102,17 @@  discard block
 block discarded – undo
102 102
 	 * @param string     $email_type Email format: plain text or HTML.
103 103
 	 * @param bool     $sent_to_admin Sent to admin.
104 104
 	 */
105
-	public function email_instructions( $invoice, $email_type, $sent_to_admin ) {
105
+	public function email_instructions($invoice, $email_type, $sent_to_admin) {
106 106
 
107
-		if ( ! $sent_to_admin && 'bank_transfer' === $invoice->get_gateway() && $invoice->needs_payment() ) {
107
+		if (!$sent_to_admin && 'bank_transfer' === $invoice->get_gateway() && $invoice->needs_payment()) {
108 108
 
109 109
 			echo '<div class="wpi-email-row getpaid-bank-transfer-details">';
110 110
 
111
-			if ( $this->instructions ) {
112
-				echo wp_kses_post( wpautop( wptexturize( $this->instructions ) ) . PHP_EOL );
111
+			if ($this->instructions) {
112
+				echo wp_kses_post(wpautop(wptexturize($this->instructions)) . PHP_EOL);
113 113
             }
114 114
 
115
-			$this->bank_details( $invoice );
115
+			$this->bank_details($invoice);
116 116
 			
117 117
 			echo '</div>';
118 118
 
@@ -125,51 +125,51 @@  discard block
 block discarded – undo
125 125
 	 *
126 126
 	 * @param WPInv_Invoice $invoice Invoice.
127 127
 	 */
128
-	protected function bank_details( $invoice ) {
128
+	protected function bank_details($invoice) {
129 129
 
130 130
 		// Get the invoice country and country $locale.
131 131
 		$country = $invoice->get_country();
132 132
 		$locale  = $this->get_country_locale();
133 133
 
134 134
 		// Get sortcode label in the $locale array and use appropriate one.
135
-		$sortcode = isset( $locale[ $country ]['sortcode']['label'] ) ? $locale[ $country ]['sortcode']['label'] : __( 'Sort code', 'invoicing' );
135
+		$sortcode = isset($locale[$country]['sortcode']['label']) ? $locale[$country]['sortcode']['label'] : __('Sort code', 'invoicing');
136 136
 
137 137
         $bank_fields = array(
138
-            'ac_name'     => __( 'Account Name', 'invoicing' ),
139
-            'ac_no'       => __( 'Account Number', 'invoicing' ),
140
-            'bank_name'   => __( 'Bank Name', 'invoicing' ),
141
-            'ifsc'        => __( 'IFSC code', 'invoicing' ),
142
-            'iban'        => __( 'IBAN', 'invoicing' ),
143
-            'bic'         => __( 'BIC/Swift code', 'invoicing' ),
138
+            'ac_name'     => __('Account Name', 'invoicing'),
139
+            'ac_no'       => __('Account Number', 'invoicing'),
140
+            'bank_name'   => __('Bank Name', 'invoicing'),
141
+            'ifsc'        => __('IFSC code', 'invoicing'),
142
+            'iban'        => __('IBAN', 'invoicing'),
143
+            'bic'         => __('BIC/Swift code', 'invoicing'),
144 144
             'sort_code'   => $sortcode,
145 145
         );
146 146
 
147 147
         $bank_info = array();
148 148
 
149
-        foreach ( $bank_fields as $field => $label ) {
150
-            $value = $this->get_option( $field );
149
+        foreach ($bank_fields as $field => $label) {
150
+            $value = $this->get_option($field);
151 151
 
152
-            if ( ! empty( $value ) ) {
153
-                $bank_info[$field] = array( 'label' => $label, 'value' => $value );
152
+            if (!empty($value)) {
153
+                $bank_info[$field] = array('label' => $label, 'value' => $value);
154 154
             }
155 155
 
156 156
         }
157 157
 
158
-        $bank_info = apply_filters( 'wpinv_bank_info', $bank_info );
158
+        $bank_info = apply_filters('wpinv_bank_info', $bank_info);
159 159
 
160
-        if ( empty( $bank_info ) ) {
160
+        if (empty($bank_info)) {
161 161
             return;
162 162
         }
163 163
 
164
-		echo '<h3 class="getpaid-bank-transfer-title"> ' . apply_filters( 'wpinv_receipt_bank_details_title', __( 'Bank Details', 'invoicing' ) ) . '</h3>' . PHP_EOL;
164
+		echo '<h3 class="getpaid-bank-transfer-title"> ' . apply_filters('wpinv_receipt_bank_details_title', __('Bank Details', 'invoicing')) . '</h3>' . PHP_EOL;
165 165
 
166 166
 		echo '<table class="table table-bordered getpaid-bank-transfer-details">' . PHP_EOL;
167 167
 
168
-		foreach ( $bank_info as $key => $data ) {
168
+		foreach ($bank_info as $key => $data) {
169 169
 
170
-			$key   = sanitize_html_class( $key );
171
-			$label = wp_kses_post( $data['label'] );
172
-			$value = wp_kses_post( wptexturize( $data['value'] ) );
170
+			$key   = sanitize_html_class($key);
171
+			$label = wp_kses_post($data['label']);
172
+			$value = wp_kses_post(wptexturize($data['value']));
173 173
 
174 174
 			echo "<tr class='getpaid-bank-transfer-$key'><th>$label</th><td>$value</td></tr>" . PHP_EOL;
175 175
 		}
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
 	 */
186 186
 	public function get_country_locale() {
187 187
 
188
-		if ( empty( $this->locale ) ) {
188
+		if (empty($this->locale)) {
189 189
 
190 190
 			// Locale information to be used - only those that are not 'Sort Code'.
191 191
 			$this->locale = apply_filters(
@@ -193,42 +193,42 @@  discard block
 block discarded – undo
193 193
 				array(
194 194
 					'AU' => array(
195 195
 						'sortcode' => array(
196
-							'label' => __( 'BSB', 'invoicing' ),
196
+							'label' => __('BSB', 'invoicing'),
197 197
 						),
198 198
 					),
199 199
 					'CA' => array(
200 200
 						'sortcode' => array(
201
-							'label' => __( 'Bank transit number', 'invoicing' ),
201
+							'label' => __('Bank transit number', 'invoicing'),
202 202
 						),
203 203
 					),
204 204
 					'IN' => array(
205 205
 						'sortcode' => array(
206
-							'label' => __( 'IFSC', 'invoicing' ),
206
+							'label' => __('IFSC', 'invoicing'),
207 207
 						),
208 208
 					),
209 209
 					'IT' => array(
210 210
 						'sortcode' => array(
211
-							'label' => __( 'Branch sort', 'invoicing' ),
211
+							'label' => __('Branch sort', 'invoicing'),
212 212
 						),
213 213
 					),
214 214
 					'NZ' => array(
215 215
 						'sortcode' => array(
216
-							'label' => __( 'Bank code', 'invoicing' ),
216
+							'label' => __('Bank code', 'invoicing'),
217 217
 						),
218 218
 					),
219 219
 					'SE' => array(
220 220
 						'sortcode' => array(
221
-							'label' => __( 'Bank code', 'invoicing' ),
221
+							'label' => __('Bank code', 'invoicing'),
222 222
 						),
223 223
 					),
224 224
 					'US' => array(
225 225
 						'sortcode' => array(
226
-							'label' => __( 'Routing number', 'invoicing' ),
226
+							'label' => __('Routing number', 'invoicing'),
227 227
 						),
228 228
 					),
229 229
 					'ZA' => array(
230 230
 						'sortcode' => array(
231
-							'label' => __( 'Branch code', 'invoicing' ),
231
+							'label' => __('Branch code', 'invoicing'),
232 232
 						),
233 233
 					),
234 234
 				)
@@ -245,51 +245,51 @@  discard block
 block discarded – undo
245 245
 	 * 
246 246
 	 * @param array $admin_settings
247 247
 	 */
248
-	public function admin_settings( $admin_settings ) {
248
+	public function admin_settings($admin_settings) {
249 249
 
250
-        $admin_settings['worldpay_desc']['std']    = __( "Make your payment directly into our bank account. Please use your Invoice Number as the payment reference. Your invoice won't be processed until the funds have cleared in our account.", 'invoicing' );
251
-		$admin_settings['worldpay_active']['desc'] = __( 'Enable bank transfer', 'invoicing' );
250
+        $admin_settings['worldpay_desc']['std'] = __("Make your payment directly into our bank account. Please use your Invoice Number as the payment reference. Your invoice won't be processed until the funds have cleared in our account.", 'invoicing');
251
+		$admin_settings['worldpay_active']['desc'] = __('Enable bank transfer', 'invoicing');
252 252
 
253
-		$locale  = $this->get_country_locale();
253
+		$locale = $this->get_country_locale();
254 254
 
255 255
 		// Get sortcode label in the $locale array and use appropriate one.
256 256
 		$country  = wpinv_default_billing_country();
257
-		$sortcode = isset( $locale[ $country ]['sortcode']['label'] ) ? $locale[ $country ]['sortcode']['label'] : __( 'Sort code', 'invoicing' );
257
+		$sortcode = isset($locale[$country]['sortcode']['label']) ? $locale[$country]['sortcode']['label'] : __('Sort code', 'invoicing');
258 258
 
259 259
 		$admin_settings['bank_transfer_ac_name'] = array(
260 260
             'type' => 'text',
261 261
             'id'   => 'bank_transfer_ac_name',
262
-            'name' => __( 'Account Name', 'invoicing' ),
262
+            'name' => __('Account Name', 'invoicing'),
263 263
 		);
264 264
 		
265 265
 		$admin_settings['bank_transfer_ac_no'] = array(
266 266
             'type' => 'text',
267 267
             'id'   => 'bank_transfer_ac_no',
268
-            'name' => __( 'Account Number', 'invoicing' ),
268
+            'name' => __('Account Number', 'invoicing'),
269 269
 		);
270 270
 		
271 271
 		$admin_settings['bank_transfer_bank_name'] = array(
272 272
             'type' => 'text',
273 273
             'id'   => 'bank_transfer_bank_name',
274
-            'name' => __( 'Bank Name', 'invoicing' ),
274
+            'name' => __('Bank Name', 'invoicing'),
275 275
 		);
276 276
 
277 277
 		$admin_settings['bank_transfer_ifsc'] = array(
278 278
             'type' => 'text',
279 279
             'id'   => 'bank_transfer_ifsc',
280
-            'name' => __( 'IFSC Code', 'invoicing' ),
280
+            'name' => __('IFSC Code', 'invoicing'),
281 281
 		);
282 282
 
283 283
 		$admin_settings['bank_transfer_iban'] = array(
284 284
             'type' => 'text',
285 285
             'id'   => 'bank_transfer_iban',
286
-            'name' => __( 'IBAN', 'invoicing' ),
286
+            'name' => __('IBAN', 'invoicing'),
287 287
 		);
288 288
 
289 289
 		$admin_settings['bank_transfer_bic'] = array(
290 290
             'type' => 'text',
291 291
             'id'   => 'bank_transfer_bic',
292
-            'name' => __( 'BIC/Swift Code', 'invoicing' ),
292
+            'name' => __('BIC/Swift Code', 'invoicing'),
293 293
 		);
294 294
 		
295 295
 		$admin_settings['bank_transfer_sort_code'] = array(
@@ -300,10 +300,10 @@  discard block
 block discarded – undo
300 300
 
301 301
 		$admin_settings['bank_transfer_info'] = array(
302 302
             'id'   => 'bank_transfer_info',
303
-            'name' => __( 'Instructions', 'invoicing' ),
304
-            'desc' => __( 'Instructions that will be added to the thank you page and emails.', 'invoicing' ),
303
+            'name' => __('Instructions', 'invoicing'),
304
+            'desc' => __('Instructions that will be added to the thank you page and emails.', 'invoicing'),
305 305
             'type' => 'textarea',
306
-            'std'  => __( "Make your payment directly into our bank account. Please use your Invoice Number as the payment reference. Your invoice won't be processed until the funds have cleared in our account.", 'invoicing' ),
306
+            'std'  => __("Make your payment directly into our bank account. Please use your Invoice Number as the payment reference. Your invoice won't be processed until the funds have cleared in our account.", 'invoicing'),
307 307
             'cols' => 50,
308 308
             'rows' => 5
309 309
         );
Please login to merge, or discard this patch.
Indentation   +159 added lines, -159 removed lines patch added patch discarded remove patch
@@ -13,23 +13,23 @@  discard block
 block discarded – undo
13 13
 class GetPaid_Bank_Transfer_Gateway extends GetPaid_Payment_Gateway {
14 14
 
15 15
     /**
16
-	 * Payment method id.
17
-	 *
18
-	 * @var string
19
-	 */
16
+     * Payment method id.
17
+     *
18
+     * @var string
19
+     */
20 20
     public $id = 'bank_transfer';
21 21
 
22 22
     /**
23
-	 * Payment method order.
24
-	 *
25
-	 * @var int
26
-	 */
27
-	public $order = 8;
23
+     * Payment method order.
24
+     *
25
+     * @var int
26
+     */
27
+    public $order = 8;
28 28
     
29 29
     /**
30
-	 * Class constructor.
31
-	 */
32
-	public function __construct() {
30
+     * Class constructor.
31
+     */
32
+    public function __construct() {
33 33
         parent::__construct();
34 34
 
35 35
         $this->title                = __( 'Direct bank transfer', 'invoicing' );
@@ -37,22 +37,22 @@  discard block
 block discarded – undo
37 37
         $this->checkout_button_text = __( 'Proceed', 'invoicing' );
38 38
         $this->instructions         = apply_filters( 'wpinv_bank_instructions', $this->get_option( 'info' ) );
39 39
 
40
-		add_action( 'wpinv_receipt_end', array( $this, 'thankyou_page' ) );
41
-		add_action( 'getpaid_invoice_line_items', array( $this, 'thankyou_page' ), 40 );
42
-		add_action( 'wpinv_email_invoice_details', array( $this, 'email_instructions' ), 10, 3 );
40
+        add_action( 'wpinv_receipt_end', array( $this, 'thankyou_page' ) );
41
+        add_action( 'getpaid_invoice_line_items', array( $this, 'thankyou_page' ), 40 );
42
+        add_action( 'wpinv_email_invoice_details', array( $this, 'email_instructions' ), 10, 3 );
43 43
 
44 44
     }
45 45
 
46 46
     /**
47
-	 * Process Payment.
48
-	 *
49
-	 *
50
-	 * @param WPInv_Invoice $invoice Invoice.
51
-	 * @param array $submission_data Posted checkout fields.
52
-	 * @param GetPaid_Payment_Form_Submission $submission Checkout submission.
53
-	 * @return array
54
-	 */
55
-	public function process_payment( $invoice, $submission_data, $submission ) {
47
+     * Process Payment.
48
+     *
49
+     *
50
+     * @param WPInv_Invoice $invoice Invoice.
51
+     * @param array $submission_data Posted checkout fields.
52
+     * @param GetPaid_Payment_Form_Submission $submission Checkout submission.
53
+     * @return array
54
+     */
55
+    public function process_payment( $invoice, $submission_data, $submission ) {
56 56
 
57 57
         // Add a transaction id.
58 58
         $invoice->set_transaction_id( $invoice->generate_key('trans_') );
@@ -73,66 +73,66 @@  discard block
 block discarded – undo
73 73
     }
74 74
 
75 75
     /**
76
-	 * Output for the order received page.
77
-	 *
78
-	 * @param WPInv_Invoice $invoice Invoice.
79
-	 */
80
-	public function thankyou_page( $invoice ) {
76
+     * Output for the order received page.
77
+     *
78
+     * @param WPInv_Invoice $invoice Invoice.
79
+     */
80
+    public function thankyou_page( $invoice ) {
81 81
 
82 82
         if ( 'bank_transfer' === $invoice->get_gateway() && $invoice->needs_payment() ) {
83 83
 
84
-			echo '<div class="mt-4 mb-2 getpaid-bank-transfer-details">' . PHP_EOL;
84
+            echo '<div class="mt-4 mb-2 getpaid-bank-transfer-details">' . PHP_EOL;
85 85
 
86 86
             if ( ! empty( $this->instructions ) ) {
87 87
                 echo wp_kses_post( wpautop( wptexturize( $this->instructions ) ) );
88
-			}
88
+            }
89 89
 
90
-			$this->bank_details( $invoice );
90
+            $this->bank_details( $invoice );
91 91
 			
92
-			echo '</div>';
92
+            echo '</div>';
93 93
         
94 94
         }
95 95
 
96
-	}
96
+    }
97 97
     
98 98
     /**
99
-	 * Add content to the WPI emails.
100
-	 *
101
-	 * @param WPInv_Invoice $invoice Invoice.
102
-	 * @param string     $email_type Email format: plain text or HTML.
103
-	 * @param bool     $sent_to_admin Sent to admin.
104
-	 */
105
-	public function email_instructions( $invoice, $email_type, $sent_to_admin ) {
99
+     * Add content to the WPI emails.
100
+     *
101
+     * @param WPInv_Invoice $invoice Invoice.
102
+     * @param string     $email_type Email format: plain text or HTML.
103
+     * @param bool     $sent_to_admin Sent to admin.
104
+     */
105
+    public function email_instructions( $invoice, $email_type, $sent_to_admin ) {
106 106
 
107
-		if ( ! $sent_to_admin && 'bank_transfer' === $invoice->get_gateway() && $invoice->needs_payment() ) {
107
+        if ( ! $sent_to_admin && 'bank_transfer' === $invoice->get_gateway() && $invoice->needs_payment() ) {
108 108
 
109
-			echo '<div class="wpi-email-row getpaid-bank-transfer-details">';
109
+            echo '<div class="wpi-email-row getpaid-bank-transfer-details">';
110 110
 
111
-			if ( $this->instructions ) {
112
-				echo wp_kses_post( wpautop( wptexturize( $this->instructions ) ) . PHP_EOL );
111
+            if ( $this->instructions ) {
112
+                echo wp_kses_post( wpautop( wptexturize( $this->instructions ) ) . PHP_EOL );
113 113
             }
114 114
 
115
-			$this->bank_details( $invoice );
115
+            $this->bank_details( $invoice );
116 116
 			
117
-			echo '</div>';
117
+            echo '</div>';
118 118
 
119
-		}
119
+        }
120 120
 
121 121
     }
122 122
     
123 123
     /**
124
-	 * Get bank details and place into a list format.
125
-	 *
126
-	 * @param WPInv_Invoice $invoice Invoice.
127
-	 */
128
-	protected function bank_details( $invoice ) {
124
+     * Get bank details and place into a list format.
125
+     *
126
+     * @param WPInv_Invoice $invoice Invoice.
127
+     */
128
+    protected function bank_details( $invoice ) {
129 129
 
130
-		// Get the invoice country and country $locale.
131
-		$country = $invoice->get_country();
132
-		$locale  = $this->get_country_locale();
130
+        // Get the invoice country and country $locale.
131
+        $country = $invoice->get_country();
132
+        $locale  = $this->get_country_locale();
133 133
 
134
-		// Get sortcode label in the $locale array and use appropriate one.
135
-		$sortcode = isset( $locale[ $country ]['sortcode']['label'] ) ? $locale[ $country ]['sortcode']['label'] : __( 'Sort code', 'invoicing' );
134
+        // Get sortcode label in the $locale array and use appropriate one.
135
+        $sortcode = isset( $locale[ $country ]['sortcode']['label'] ) ? $locale[ $country ]['sortcode']['label'] : __( 'Sort code', 'invoicing' );
136 136
 
137 137
         $bank_fields = array(
138 138
             'ac_name'     => __( 'Account Name', 'invoicing' ),
@@ -161,144 +161,144 @@  discard block
 block discarded – undo
161 161
             return;
162 162
         }
163 163
 
164
-		echo '<h3 class="getpaid-bank-transfer-title"> ' . apply_filters( 'wpinv_receipt_bank_details_title', __( 'Bank Details', 'invoicing' ) ) . '</h3>' . PHP_EOL;
164
+        echo '<h3 class="getpaid-bank-transfer-title"> ' . apply_filters( 'wpinv_receipt_bank_details_title', __( 'Bank Details', 'invoicing' ) ) . '</h3>' . PHP_EOL;
165 165
 
166
-		echo '<table class="table table-bordered getpaid-bank-transfer-details">' . PHP_EOL;
166
+        echo '<table class="table table-bordered getpaid-bank-transfer-details">' . PHP_EOL;
167 167
 
168
-		foreach ( $bank_info as $key => $data ) {
168
+        foreach ( $bank_info as $key => $data ) {
169 169
 
170
-			$key   = sanitize_html_class( $key );
171
-			$label = wp_kses_post( $data['label'] );
172
-			$value = wp_kses_post( wptexturize( $data['value'] ) );
170
+            $key   = sanitize_html_class( $key );
171
+            $label = wp_kses_post( $data['label'] );
172
+            $value = wp_kses_post( wptexturize( $data['value'] ) );
173 173
 
174
-			echo "<tr class='getpaid-bank-transfer-$key'><th>$label</th><td>$value</td></tr>" . PHP_EOL;
175
-		}
174
+            echo "<tr class='getpaid-bank-transfer-$key'><th>$label</th><td>$value</td></tr>" . PHP_EOL;
175
+        }
176 176
 
177
-		echo '</table>';
177
+        echo '</table>';
178 178
 
179 179
     }
180 180
     
181 181
     /**
182
-	 * Get country locale if localized.
183
-	 *
184
-	 * @return array
185
-	 */
186
-	public function get_country_locale() {
187
-
188
-		if ( empty( $this->locale ) ) {
189
-
190
-			// Locale information to be used - only those that are not 'Sort Code'.
191
-			$this->locale = apply_filters(
192
-				'getpaid_get_bank_transfer_locale',
193
-				array(
194
-					'AU' => array(
195
-						'sortcode' => array(
196
-							'label' => __( 'BSB', 'invoicing' ),
197
-						),
198
-					),
199
-					'CA' => array(
200
-						'sortcode' => array(
201
-							'label' => __( 'Bank transit number', 'invoicing' ),
202
-						),
203
-					),
204
-					'IN' => array(
205
-						'sortcode' => array(
206
-							'label' => __( 'IFSC', 'invoicing' ),
207
-						),
208
-					),
209
-					'IT' => array(
210
-						'sortcode' => array(
211
-							'label' => __( 'Branch sort', 'invoicing' ),
212
-						),
213
-					),
214
-					'NZ' => array(
215
-						'sortcode' => array(
216
-							'label' => __( 'Bank code', 'invoicing' ),
217
-						),
218
-					),
219
-					'SE' => array(
220
-						'sortcode' => array(
221
-							'label' => __( 'Bank code', 'invoicing' ),
222
-						),
223
-					),
224
-					'US' => array(
225
-						'sortcode' => array(
226
-							'label' => __( 'Routing number', 'invoicing' ),
227
-						),
228
-					),
229
-					'ZA' => array(
230
-						'sortcode' => array(
231
-							'label' => __( 'Branch code', 'invoicing' ),
232
-						),
233
-					),
234
-				)
235
-			);
236
-
237
-		}
238
-
239
-		return $this->locale;
240
-
241
-	}
242
-
243
-	/**
244
-	 * Filters the gateway settings.
245
-	 * 
246
-	 * @param array $admin_settings
247
-	 */
248
-	public function admin_settings( $admin_settings ) {
182
+     * Get country locale if localized.
183
+     *
184
+     * @return array
185
+     */
186
+    public function get_country_locale() {
187
+
188
+        if ( empty( $this->locale ) ) {
189
+
190
+            // Locale information to be used - only those that are not 'Sort Code'.
191
+            $this->locale = apply_filters(
192
+                'getpaid_get_bank_transfer_locale',
193
+                array(
194
+                    'AU' => array(
195
+                        'sortcode' => array(
196
+                            'label' => __( 'BSB', 'invoicing' ),
197
+                        ),
198
+                    ),
199
+                    'CA' => array(
200
+                        'sortcode' => array(
201
+                            'label' => __( 'Bank transit number', 'invoicing' ),
202
+                        ),
203
+                    ),
204
+                    'IN' => array(
205
+                        'sortcode' => array(
206
+                            'label' => __( 'IFSC', 'invoicing' ),
207
+                        ),
208
+                    ),
209
+                    'IT' => array(
210
+                        'sortcode' => array(
211
+                            'label' => __( 'Branch sort', 'invoicing' ),
212
+                        ),
213
+                    ),
214
+                    'NZ' => array(
215
+                        'sortcode' => array(
216
+                            'label' => __( 'Bank code', 'invoicing' ),
217
+                        ),
218
+                    ),
219
+                    'SE' => array(
220
+                        'sortcode' => array(
221
+                            'label' => __( 'Bank code', 'invoicing' ),
222
+                        ),
223
+                    ),
224
+                    'US' => array(
225
+                        'sortcode' => array(
226
+                            'label' => __( 'Routing number', 'invoicing' ),
227
+                        ),
228
+                    ),
229
+                    'ZA' => array(
230
+                        'sortcode' => array(
231
+                            'label' => __( 'Branch code', 'invoicing' ),
232
+                        ),
233
+                    ),
234
+                )
235
+            );
236
+
237
+        }
238
+
239
+        return $this->locale;
240
+
241
+    }
242
+
243
+    /**
244
+     * Filters the gateway settings.
245
+     * 
246
+     * @param array $admin_settings
247
+     */
248
+    public function admin_settings( $admin_settings ) {
249 249
 
250 250
         $admin_settings['worldpay_desc']['std']    = __( "Make your payment directly into our bank account. Please use your Invoice Number as the payment reference. Your invoice won't be processed until the funds have cleared in our account.", 'invoicing' );
251
-		$admin_settings['worldpay_active']['desc'] = __( 'Enable bank transfer', 'invoicing' );
251
+        $admin_settings['worldpay_active']['desc'] = __( 'Enable bank transfer', 'invoicing' );
252 252
 
253
-		$locale  = $this->get_country_locale();
253
+        $locale  = $this->get_country_locale();
254 254
 
255
-		// Get sortcode label in the $locale array and use appropriate one.
256
-		$country  = wpinv_default_billing_country();
257
-		$sortcode = isset( $locale[ $country ]['sortcode']['label'] ) ? $locale[ $country ]['sortcode']['label'] : __( 'Sort code', 'invoicing' );
255
+        // Get sortcode label in the $locale array and use appropriate one.
256
+        $country  = wpinv_default_billing_country();
257
+        $sortcode = isset( $locale[ $country ]['sortcode']['label'] ) ? $locale[ $country ]['sortcode']['label'] : __( 'Sort code', 'invoicing' );
258 258
 
259
-		$admin_settings['bank_transfer_ac_name'] = array(
259
+        $admin_settings['bank_transfer_ac_name'] = array(
260 260
             'type' => 'text',
261 261
             'id'   => 'bank_transfer_ac_name',
262 262
             'name' => __( 'Account Name', 'invoicing' ),
263
-		);
263
+        );
264 264
 		
265
-		$admin_settings['bank_transfer_ac_no'] = array(
265
+        $admin_settings['bank_transfer_ac_no'] = array(
266 266
             'type' => 'text',
267 267
             'id'   => 'bank_transfer_ac_no',
268 268
             'name' => __( 'Account Number', 'invoicing' ),
269
-		);
269
+        );
270 270
 		
271
-		$admin_settings['bank_transfer_bank_name'] = array(
271
+        $admin_settings['bank_transfer_bank_name'] = array(
272 272
             'type' => 'text',
273 273
             'id'   => 'bank_transfer_bank_name',
274 274
             'name' => __( 'Bank Name', 'invoicing' ),
275
-		);
275
+        );
276 276
 
277
-		$admin_settings['bank_transfer_ifsc'] = array(
277
+        $admin_settings['bank_transfer_ifsc'] = array(
278 278
             'type' => 'text',
279 279
             'id'   => 'bank_transfer_ifsc',
280 280
             'name' => __( 'IFSC Code', 'invoicing' ),
281
-		);
281
+        );
282 282
 
283
-		$admin_settings['bank_transfer_iban'] = array(
283
+        $admin_settings['bank_transfer_iban'] = array(
284 284
             'type' => 'text',
285 285
             'id'   => 'bank_transfer_iban',
286 286
             'name' => __( 'IBAN', 'invoicing' ),
287
-		);
287
+        );
288 288
 
289
-		$admin_settings['bank_transfer_bic'] = array(
289
+        $admin_settings['bank_transfer_bic'] = array(
290 290
             'type' => 'text',
291 291
             'id'   => 'bank_transfer_bic',
292 292
             'name' => __( 'BIC/Swift Code', 'invoicing' ),
293
-		);
293
+        );
294 294
 		
295
-		$admin_settings['bank_transfer_sort_code'] = array(
296
-			'type' => 'text',
297
-			'id'   => 'bank_transfer_sort_code',
298
-			'name' => $sortcode,
299
-		);
295
+        $admin_settings['bank_transfer_sort_code'] = array(
296
+            'type' => 'text',
297
+            'id'   => 'bank_transfer_sort_code',
298
+            'name' => $sortcode,
299
+        );
300 300
 
301
-		$admin_settings['bank_transfer_info'] = array(
301
+        $admin_settings['bank_transfer_info'] = array(
302 302
             'id'   => 'bank_transfer_info',
303 303
             'name' => __( 'Instructions', 'invoicing' ),
304 304
             'desc' => __( 'Instructions that will be added to the thank you page and emails.', 'invoicing' ),
@@ -308,7 +308,7 @@  discard block
 block discarded – undo
308 308
             'rows' => 5
309 309
         );
310 310
 
311
-		return $admin_settings;
312
-	}
311
+        return $admin_settings;
312
+    }
313 313
 
314 314
 }
Please login to merge, or discard this patch.
includes/gateways/class-getpaid-worldpay-gateway.php 2 patches
Indentation   +94 added lines, -94 removed lines patch added patch discarded remove patch
@@ -13,65 +13,65 @@  discard block
 block discarded – undo
13 13
 class GetPaid_Worldpay_Gateway extends GetPaid_Payment_Gateway {
14 14
 
15 15
     /**
16
-	 * Payment method id.
17
-	 *
18
-	 * @var string
19
-	 */
16
+     * Payment method id.
17
+     *
18
+     * @var string
19
+     */
20 20
     public $id = 'worldpay';
21 21
 
22 22
     /**
23
-	 * Payment method order.
24
-	 *
25
-	 * @var int
26
-	 */
23
+     * Payment method order.
24
+     *
25
+     * @var int
26
+     */
27 27
     public $order = 5;
28 28
 
29 29
     /**
30
-	 * Endpoint for requests from Worldpay.
31
-	 *
32
-	 * @var string
33
-	 */
34
-	protected $notify_url;
35
-
36
-	/**
37
-	 * Endpoint for requests to Worldpay.
38
-	 *
39
-	 * @var string
40
-	 */
30
+     * Endpoint for requests from Worldpay.
31
+     *
32
+     * @var string
33
+     */
34
+    protected $notify_url;
35
+
36
+    /**
37
+     * Endpoint for requests to Worldpay.
38
+     *
39
+     * @var string
40
+     */
41 41
     protected $endpoint;
42 42
 
43 43
     /**
44
-	 * An array of features that this gateway supports.
45
-	 *
46
-	 * @var array
47
-	 */
44
+     * An array of features that this gateway supports.
45
+     *
46
+     * @var array
47
+     */
48 48
     protected $supports = array( 'sandbox' );
49 49
     
50 50
     /**
51
-	 * Currencies this gateway is allowed for.
52
-	 *
53
-	 * @var array
54
-	 */
55
-	public $currencies = array( 'AUD', 'ARS', 'CAD', 'CHF', 'DKK', 'EUR', 'HKD', 'MYR', 'GBP', 'NZD', 'NOK', 'SGD', 'LKR', 'SEK', 'TRY', 'USD', 'ZAR' );
51
+     * Currencies this gateway is allowed for.
52
+     *
53
+     * @var array
54
+     */
55
+    public $currencies = array( 'AUD', 'ARS', 'CAD', 'CHF', 'DKK', 'EUR', 'HKD', 'MYR', 'GBP', 'NZD', 'NOK', 'SGD', 'LKR', 'SEK', 'TRY', 'USD', 'ZAR' );
56 56
 
57 57
     /**
58
-	 * URL to view a transaction.
59
-	 *
60
-	 * @var string
61
-	 */
58
+     * URL to view a transaction.
59
+     *
60
+     * @var string
61
+     */
62 62
     public $view_transaction_url = 'https://www.{sandbox}paypal.com/activity/payment/%s';
63 63
 
64 64
     /**
65
-	 * URL to view a subscription.
66
-	 *
67
-	 * @var string
68
-	 */
69
-	public $view_subscription_url = 'https://www.{sandbox}paypal.com/cgi-bin/webscr?cmd=_profile-recurring-payments&encrypted_profile_id=%s';
65
+     * URL to view a subscription.
66
+     *
67
+     * @var string
68
+     */
69
+    public $view_subscription_url = 'https://www.{sandbox}paypal.com/cgi-bin/webscr?cmd=_profile-recurring-payments&encrypted_profile_id=%s';
70 70
 
71 71
     /**
72
-	 * Class constructor.
73
-	 */
74
-	public function __construct() {
72
+     * Class constructor.
73
+     */
74
+    public function __construct() {
75 75
 
76 76
         $this->method_title         = __( 'Worldpay', 'invoicing' );
77 77
         $this->title                = __( 'Worldpay - Credit Card / Debit Card', 'invoicing' );
@@ -85,15 +85,15 @@  discard block
 block discarded – undo
85 85
     }
86 86
 
87 87
     /**
88
-	 * Process Payment.
89
-	 *
90
-	 *
91
-	 * @param WPInv_Invoice $invoice Invoice.
92
-	 * @param array $submission_data Posted checkout fields.
93
-	 * @param GetPaid_Payment_Form_Submission $submission Checkout submission.
94
-	 * @return array
95
-	 */
96
-	public function process_payment( $invoice, $submission_data, $submission ) {
88
+     * Process Payment.
89
+     *
90
+     *
91
+     * @param WPInv_Invoice $invoice Invoice.
92
+     * @param array $submission_data Posted checkout fields.
93
+     * @param GetPaid_Payment_Form_Submission $submission Checkout submission.
94
+     * @return array
95
+     */
96
+    public function process_payment( $invoice, $submission_data, $submission ) {
97 97
 
98 98
         // Get redirect url.
99 99
         $worldpay_redirect = esc_url( $this->get_request_url( $invoice ) );
@@ -128,31 +128,31 @@  discard block
 block discarded – undo
128 128
     }
129 129
 
130 130
     /**
131
-	 * Get the Worldpay request URL for an invoice.
132
-	 *
133
-	 * @param  WPInv_Invoice $invoice Invoice object.
134
-	 * @return string
135
-	 */
136
-	public function get_request_url( $invoice ) {
131
+     * Get the Worldpay request URL for an invoice.
132
+     *
133
+     * @param  WPInv_Invoice $invoice Invoice object.
134
+     * @return string
135
+     */
136
+    public function get_request_url( $invoice ) {
137 137
 
138 138
         // Endpoint for this request
139
-		$this->endpoint = $this->is_sandbox( $invoice ) ? 'https://secure-test.worldpay.com/wcc/purchase' : 'https://secure.worldpay.com/wcc/purchase';
139
+        $this->endpoint = $this->is_sandbox( $invoice ) ? 'https://secure-test.worldpay.com/wcc/purchase' : 'https://secure.worldpay.com/wcc/purchase';
140 140
 
141 141
         return $this->endpoint;
142 142
 
143
-	}
143
+    }
144 144
 
145 145
     /**
146
-	 * Get Worldpay Args for passing to Worldpay.
147
-	 *
148
-	 * @param  WPInv_Invoice $invoice Invoice object.
149
-	 * @return array
150
-	 */
151
-	protected function get_worldpay_args( $invoice ) {
152
-
153
-		return apply_filters(
154
-			'getpaid_worldpay_args',
155
-			array(
146
+     * Get Worldpay Args for passing to Worldpay.
147
+     *
148
+     * @param  WPInv_Invoice $invoice Invoice object.
149
+     * @return array
150
+     */
151
+    protected function get_worldpay_args( $invoice ) {
152
+
153
+        return apply_filters(
154
+            'getpaid_worldpay_args',
155
+            array(
156 156
                 'amount'         => wpinv_sanitize_amount( $invoice->get_total() ), // mandatory
157 157
                 'cartId'         => wpinv_clean( $invoice->get_number() ), // mandatory reference for the item purchased
158 158
                 'currency'       => wpinv_clean( $invoice->get_currency() ), // mandatory
@@ -177,18 +177,18 @@  discard block
 block discarded – undo
177 177
                 'countryString'  => wpinv_clean( wpinv_country_name( $invoice->get_country() ) ),
178 178
                 'compName'       => wpinv_clean( $invoice->get_company() ),
179 179
             ),
180
-			$invoice
181
-		);
180
+            $invoice
181
+        );
182 182
 
183 183
     }
184 184
 
185 185
     /**
186
-	 * Secures worldpay args with an md5 hash.
187
-	 *
188
-	 * @param  array $args Gateway args.
189
-	 * @return array
190
-	 */
191
-	public function hash_args( $args ) {
186
+     * Secures worldpay args with an md5 hash.
187
+     *
188
+     * @param  array $args Gateway args.
189
+     * @return array
190
+     */
191
+    public function hash_args( $args ) {
192 192
 
193 193
         $md5_secret = $this->get_option( 'md5_secret' );
194 194
 
@@ -204,16 +204,16 @@  discard block
 block discarded – undo
204 204
     }
205 205
 
206 206
     /**
207
-	 * Processes ipns and marks payments as complete.
208
-	 *
209
-	 * @return void
210
-	 */
211
-	public function verify_ipn() {
207
+     * Processes ipns and marks payments as complete.
208
+     *
209
+     * @return void
210
+     */
211
+    public function verify_ipn() {
212 212
 
213 213
         // Validate the IPN.
214 214
         if ( empty( $_POST ) || ! $this->validate_ipn() ) {
215
-		    wp_die( 'Worldpay IPN Request Failure', 'Worldpay IPN', array( 'response' => 500 ) );
216
-		}
215
+            wp_die( 'Worldpay IPN Request Failure', 'Worldpay IPN', array( 'response' => 500 ) );
216
+        }
217 217
 
218 218
         // Process the IPN.
219 219
         $posted  = wp_unslash( $_POST );
@@ -229,8 +229,8 @@  discard block
 block discarded – undo
229 229
                 $invoice->set_transaction_id( wpinv_clean( $posted['transId'] ) );
230 230
             }
231 231
 
232
-             // Update the ip address.
233
-             if ( ! empty( $posted['ipAddress'] ) ) {
232
+                // Update the ip address.
233
+                if ( ! empty( $posted['ipAddress'] ) ) {
234 234
                 $invoice->set_ip( wpinv_clean( $posted['ipAddress'] ) );
235 235
             }
236 236
 
@@ -257,9 +257,9 @@  discard block
 block discarded – undo
257 257
     }
258 258
 
259 259
     /**
260
-	 * Check Worldpay IPN validity.
261
-	 */
262
-	public function validate_ipn() {
260
+     * Check Worldpay IPN validity.
261
+     */
262
+    public function validate_ipn() {
263 263
 
264 264
         wpinv_error_log( 'Validating Worldpay IPN response' );
265 265
 
@@ -305,11 +305,11 @@  discard block
 block discarded – undo
305 305
     }
306 306
 
307 307
     /**
308
-	 * Filters the gateway settings.
309
-	 * 
310
-	 * @param array $admin_settings
311
-	 */
312
-	public function admin_settings( $admin_settings ) {
308
+     * Filters the gateway settings.
309
+     * 
310
+     * @param array $admin_settings
311
+     */
312
+    public function admin_settings( $admin_settings ) {
313 313
 
314 314
         $currencies = sprintf(
315 315
             __( 'Supported Currencies: %s', 'invoicing' ),
@@ -350,7 +350,7 @@  discard block
 block discarded – undo
350 350
             'readonly' => true
351 351
         );
352 352
 
353
-		return $admin_settings;
354
-	}
353
+        return $admin_settings;
354
+    }
355 355
 
356 356
 }
Please login to merge, or discard this patch.
Spacing   +86 added lines, -86 removed lines patch added patch discarded remove patch
@@ -4,7 +4,7 @@  discard block
 block discarded – undo
4 4
  *
5 5
  */
6 6
 
7
-defined( 'ABSPATH' ) || exit;
7
+defined('ABSPATH') || exit;
8 8
 
9 9
 /**
10 10
  * Worldpay Payment Gateway class.
@@ -45,14 +45,14 @@  discard block
 block discarded – undo
45 45
 	 *
46 46
 	 * @var array
47 47
 	 */
48
-    protected $supports = array( 'sandbox' );
48
+    protected $supports = array('sandbox');
49 49
     
50 50
     /**
51 51
 	 * Currencies this gateway is allowed for.
52 52
 	 *
53 53
 	 * @var array
54 54
 	 */
55
-	public $currencies = array( 'AUD', 'ARS', 'CAD', 'CHF', 'DKK', 'EUR', 'HKD', 'MYR', 'GBP', 'NZD', 'NOK', 'SGD', 'LKR', 'SEK', 'TRY', 'USD', 'ZAR' );
55
+	public $currencies = array('AUD', 'ARS', 'CAD', 'CHF', 'DKK', 'EUR', 'HKD', 'MYR', 'GBP', 'NZD', 'NOK', 'SGD', 'LKR', 'SEK', 'TRY', 'USD', 'ZAR');
56 56
 
57 57
     /**
58 58
 	 * URL to view a transaction.
@@ -73,13 +73,13 @@  discard block
 block discarded – undo
73 73
 	 */
74 74
 	public function __construct() {
75 75
 
76
-        $this->method_title         = __( 'Worldpay', 'invoicing' );
77
-        $this->title                = __( 'Worldpay - Credit Card / Debit Card', 'invoicing' );
78
-        $this->checkout_button_text = __( 'Proceed to Worldpay', 'invoicing' );
79
-        $this->notify_url           = wpinv_get_ipn_url( $this->id );
76
+        $this->method_title         = __('Worldpay', 'invoicing');
77
+        $this->title                = __('Worldpay - Credit Card / Debit Card', 'invoicing');
78
+        $this->checkout_button_text = __('Proceed to Worldpay', 'invoicing');
79
+        $this->notify_url           = wpinv_get_ipn_url($this->id);
80 80
 
81
-        add_filter( 'wpinv_gateway_description', array( $this, 'sandbox_notice' ), 10, 2 );
82
-        add_filter( 'getpaid_worldpay_args', array( $this, 'hash_args' ) );
81
+        add_filter('wpinv_gateway_description', array($this, 'sandbox_notice'), 10, 2);
82
+        add_filter('getpaid_worldpay_args', array($this, 'hash_args'));
83 83
 
84 84
         parent::__construct();
85 85
     }
@@ -93,24 +93,24 @@  discard block
 block discarded – undo
93 93
 	 * @param GetPaid_Payment_Form_Submission $submission Checkout submission.
94 94
 	 * @return array
95 95
 	 */
96
-	public function process_payment( $invoice, $submission_data, $submission ) {
96
+	public function process_payment($invoice, $submission_data, $submission) {
97 97
 
98 98
         // Get redirect url.
99
-        $worldpay_redirect = esc_url( $this->get_request_url( $invoice ) );
99
+        $worldpay_redirect = esc_url($this->get_request_url($invoice));
100 100
 
101 101
         // Get submission args.
102
-        $worldpay_args     = $this->get_worldpay_args( $invoice );
102
+        $worldpay_args     = $this->get_worldpay_args($invoice);
103 103
 
104 104
         $form = "<form action='$worldpay_redirect' name='wpi_worldpay_form' method='POST'>";
105 105
 
106
-        foreach ( $worldpay_args as $key => $value ) {
106
+        foreach ($worldpay_args as $key => $value) {
107 107
 
108
-            if ( false === $value || '' === trim( $value ) ) {
108
+            if (false === $value || '' === trim($value)) {
109 109
                 continue;
110 110
             }
111 111
 
112
-            $value = esc_attr( $value );
113
-            $key   = wpinv_clean( $key );
112
+            $value = esc_attr($value);
113
+            $key   = wpinv_clean($key);
114 114
             $form .= "<input type='hidden' name='$key' value='$value'>";
115 115
         }
116 116
 
@@ -133,10 +133,10 @@  discard block
 block discarded – undo
133 133
 	 * @param  WPInv_Invoice $invoice Invoice object.
134 134
 	 * @return string
135 135
 	 */
136
-	public function get_request_url( $invoice ) {
136
+	public function get_request_url($invoice) {
137 137
 
138 138
         // Endpoint for this request
139
-		$this->endpoint = $this->is_sandbox( $invoice ) ? 'https://secure-test.worldpay.com/wcc/purchase' : 'https://secure.worldpay.com/wcc/purchase';
139
+		$this->endpoint = $this->is_sandbox($invoice) ? 'https://secure-test.worldpay.com/wcc/purchase' : 'https://secure.worldpay.com/wcc/purchase';
140 140
 
141 141
         return $this->endpoint;
142 142
 
@@ -148,34 +148,34 @@  discard block
 block discarded – undo
148 148
 	 * @param  WPInv_Invoice $invoice Invoice object.
149 149
 	 * @return array
150 150
 	 */
151
-	protected function get_worldpay_args( $invoice ) {
151
+	protected function get_worldpay_args($invoice) {
152 152
 
153 153
 		return apply_filters(
154 154
 			'getpaid_worldpay_args',
155 155
 			array(
156
-                'amount'         => wpinv_sanitize_amount( $invoice->get_total() ), // mandatory
157
-                'cartId'         => wpinv_clean( $invoice->get_number() ), // mandatory reference for the item purchased
158
-                'currency'       => wpinv_clean( $invoice->get_currency() ), // mandatory
159
-                'instId'         => wpinv_clean( $this->get_option( 'instId', '' ) ), // mandatory
160
-                'testMode'       => $this->is_sandbox( $invoice ) ? 100 : 0, // mandatory
161
-                'name'           => wpinv_clean( $invoice->get_full_name() ),
162
-                'address'        => wpinv_clean( $invoice->get_address() ),
163
-                'postcode'       => wpinv_clean( $invoice->get_zip() ),
164
-                'tel'            => wpinv_clean( $invoice->get_phone() ),
165
-                'email'          => sanitize_email( $invoice->get_email() ),
166
-                'country'        => wpinv_clean( $invoice->get_country() ),
167
-                'desc'           => sprintf( __( 'Payment for invoice %s.', 'invoicing' ), wpinv_clean( $invoice->get_number() ) ),
168
-                'MC_description' => sprintf( __( 'Payment for invoice %s.', 'invoicing' ), wpinv_clean( $invoice->get_number() ) ),
169
-                'MC_callback'    => esc_url_raw( $this->notify_url ),
170
-                'resultfile'     => esc_url_raw( $this->get_return_url( $invoice ) ),
171
-                'MC_key'         => wpinv_clean( $invoice->get_key() ),
156
+                'amount'         => wpinv_sanitize_amount($invoice->get_total()), // mandatory
157
+                'cartId'         => wpinv_clean($invoice->get_number()), // mandatory reference for the item purchased
158
+                'currency'       => wpinv_clean($invoice->get_currency()), // mandatory
159
+                'instId'         => wpinv_clean($this->get_option('instId', '')), // mandatory
160
+                'testMode'       => $this->is_sandbox($invoice) ? 100 : 0, // mandatory
161
+                'name'           => wpinv_clean($invoice->get_full_name()),
162
+                'address'        => wpinv_clean($invoice->get_address()),
163
+                'postcode'       => wpinv_clean($invoice->get_zip()),
164
+                'tel'            => wpinv_clean($invoice->get_phone()),
165
+                'email'          => sanitize_email($invoice->get_email()),
166
+                'country'        => wpinv_clean($invoice->get_country()),
167
+                'desc'           => sprintf(__('Payment for invoice %s.', 'invoicing'), wpinv_clean($invoice->get_number())),
168
+                'MC_description' => sprintf(__('Payment for invoice %s.', 'invoicing'), wpinv_clean($invoice->get_number())),
169
+                'MC_callback'    => esc_url_raw($this->notify_url),
170
+                'resultfile'     => esc_url_raw($this->get_return_url($invoice)),
171
+                'MC_key'         => wpinv_clean($invoice->get_key()),
172 172
                 'MC_invoice_id'  => $invoice->get_id(),
173
-                'address1'       => wpinv_clean( $invoice->get_address() ),
174
-                'town'           => wpinv_clean( $invoice->get_city() ),
175
-                'region'         => wpinv_clean( $invoice->get_state() ),
176
-                'amountString'   => wpinv_price( wpinv_format_amount( $invoice->get_total() ), $invoice->get_currency() ),
177
-                'countryString'  => wpinv_clean( wpinv_country_name( $invoice->get_country() ) ),
178
-                'compName'       => wpinv_clean( $invoice->get_company() ),
173
+                'address1'       => wpinv_clean($invoice->get_address()),
174
+                'town'           => wpinv_clean($invoice->get_city()),
175
+                'region'         => wpinv_clean($invoice->get_state()),
176
+                'amountString'   => wpinv_price(wpinv_format_amount($invoice->get_total()), $invoice->get_currency()),
177
+                'countryString'  => wpinv_clean(wpinv_country_name($invoice->get_country())),
178
+                'compName'       => wpinv_clean($invoice->get_company()),
179 179
             ),
180 180
 			$invoice
181 181
 		);
@@ -188,17 +188,17 @@  discard block
 block discarded – undo
188 188
 	 * @param  array $args Gateway args.
189 189
 	 * @return array
190 190
 	 */
191
-	public function hash_args( $args ) {
191
+	public function hash_args($args) {
192 192
 
193
-        $md5_secret = $this->get_option( 'md5_secret' );
193
+        $md5_secret = $this->get_option('md5_secret');
194 194
 
195 195
         // Abort if there is no secret.
196
-        if ( empty( $md5_secret ) ) {
196
+        if (empty($md5_secret)) {
197 197
             return $args;
198 198
         }
199 199
 
200 200
         // Hash the args.
201
-        $args['signature'] = md5( "$md5_secret:{$args['instId']}:{$args['amount']}:{$args['currency']}:{$args['cartId']}" );
201
+        $args['signature'] = md5("$md5_secret:{$args['instId']}:{$args['amount']}:{$args['currency']}:{$args['cartId']}");
202 202
 
203 203
         return $args;
204 204
     }
@@ -211,43 +211,43 @@  discard block
 block discarded – undo
211 211
 	public function verify_ipn() {
212 212
 
213 213
         // Validate the IPN.
214
-        if ( empty( $_POST ) || ! $this->validate_ipn() ) {
215
-		    wp_die( 'Worldpay IPN Request Failure', 'Worldpay IPN', array( 'response' => 500 ) );
214
+        if (empty($_POST) || !$this->validate_ipn()) {
215
+		    wp_die('Worldpay IPN Request Failure', 'Worldpay IPN', array('response' => 500));
216 216
 		}
217 217
 
218 218
         // Process the IPN.
219
-        $posted  = wp_unslash( $_POST );
220
-        $invoice = wpinv_get_invoice( $posted['MC_invoice_id'] );
219
+        $posted  = wp_unslash($_POST);
220
+        $invoice = wpinv_get_invoice($posted['MC_invoice_id']);
221 221
 
222
-        if ( $invoice && $this->id == $invoice->get_gateway() ) {
222
+        if ($invoice && $this->id == $invoice->get_gateway()) {
223 223
 
224
-            wpinv_error_log( 'Found invoice #' . $invoice->get_number() );
225
-            wpinv_error_log( 'Payment status:' . $posted['transStatus'] );
224
+            wpinv_error_log('Found invoice #' . $invoice->get_number());
225
+            wpinv_error_log('Payment status:' . $posted['transStatus']);
226 226
 
227 227
             // Update the transaction id.
228
-            if ( ! empty( $posted['transId'] ) ) {
229
-                $invoice->set_transaction_id( wpinv_clean( $posted['transId'] ) );
228
+            if (!empty($posted['transId'])) {
229
+                $invoice->set_transaction_id(wpinv_clean($posted['transId']));
230 230
             }
231 231
 
232 232
              // Update the ip address.
233
-             if ( ! empty( $posted['ipAddress'] ) ) {
234
-                $invoice->set_ip( wpinv_clean( $posted['ipAddress'] ) );
233
+             if (!empty($posted['ipAddress'])) {
234
+                $invoice->set_ip(wpinv_clean($posted['ipAddress']));
235 235
             }
236 236
 
237
-            if ( $posted['transStatus'] == 'Y' ) {
238
-                $invoice->set_completed_date( date( 'Y-m-d H:i:s', $posted['transTime'] ) );
237
+            if ($posted['transStatus'] == 'Y') {
238
+                $invoice->set_completed_date(date('Y-m-d H:i:s', $posted['transTime']));
239 239
                 $invoice->mark_paid();
240 240
                 return;
241 241
             }
242 242
 
243
-            if ( $posted['transStatus'] == 'C' ) {
244
-                $invoice->set_status( 'wpi-failed' );
245
-                $invoice->add_note( __( 'Payment transaction failed while processing Worldpay payment.', 'invoicing' ), false, false, true );
243
+            if ($posted['transStatus'] == 'C') {
244
+                $invoice->set_status('wpi-failed');
245
+                $invoice->add_note(__('Payment transaction failed while processing Worldpay payment.', 'invoicing'), false, false, true);
246 246
                 $invoice->save();
247 247
                 return;
248 248
             }
249 249
 
250
-            wpinv_error_log( 'Aborting, Invalid transaction status:' . $posted['transStatus'] );
250
+            wpinv_error_log('Aborting, Invalid transaction status:' . $posted['transStatus']);
251 251
             $invoice->save();
252 252
 
253 253
         }
@@ -261,27 +261,27 @@  discard block
 block discarded – undo
261 261
 	 */
262 262
 	public function validate_ipn() {
263 263
 
264
-        wpinv_error_log( 'Validating Worldpay IPN response' );
264
+        wpinv_error_log('Validating Worldpay IPN response');
265 265
 
266
-        $data = wp_unslash( $_POST );
266
+        $data = wp_unslash($_POST);
267 267
 
268 268
         // Verify installation.
269
-        if ( empty( $data['instId'] ) || $data['instId'] != wpinv_clean( $this->get_option( 'instId', '' ) ) ) {
270
-            wpinv_error_log( 'Received invalid installation ID from Worldpay IPN' );
269
+        if (empty($data['instId']) || $data['instId'] != wpinv_clean($this->get_option('instId', ''))) {
270
+            wpinv_error_log('Received invalid installation ID from Worldpay IPN');
271 271
             return false;
272 272
         }
273 273
 
274 274
         // Verify invoice.
275
-        if ( empty( $data['cartId'] ) || !  wpinv_get_id_by_invoice_number( $data['cartId'] ) ) {
276
-            wpinv_error_log( 'Received invalid invoice number from Worldpay IPN' );
275
+        if (empty($data['cartId']) || !wpinv_get_id_by_invoice_number($data['cartId'])) {
276
+            wpinv_error_log('Received invalid invoice number from Worldpay IPN');
277 277
             return false;
278 278
         }
279 279
         
280 280
         // (maybe) verify password.
281
-        $password = $this->get_option( 'callback_password' );
281
+        $password = $this->get_option('callback_password');
282 282
 
283
-        if ( ! empty( $password ) && ( empty( $data['callbackPW'] ) || $password != $data['callbackPW'] ) ) {
284
-            wpinv_error_log( 'Received invalid invoice number from Worldpay IPN' );
283
+        if (!empty($password) && (empty($data['callbackPW']) || $password != $data['callbackPW'])) {
284
+            wpinv_error_log('Received invalid invoice number from Worldpay IPN');
285 285
             return false;
286 286
         }
287 287
 
@@ -292,10 +292,10 @@  discard block
 block discarded – undo
292 292
     /**
293 293
      * Displays a notice on the checkout page if sandbox is enabled.
294 294
      */
295
-    public function sandbox_notice( $description, $gateway ) {
296
-        if ( 'worldpay' == $gateway && wpinv_is_test_mode( 'worldpay' ) ) {
295
+    public function sandbox_notice($description, $gateway) {
296
+        if ('worldpay' == $gateway && wpinv_is_test_mode('worldpay')) {
297 297
             $description .= '<br>' . sprintf(
298
-                __( 'SANDBOX ENABLED. See the %sWorldpay Sandbox Testing Guide%s for more details.', 'invoicing' ),
298
+                __('SANDBOX ENABLED. See the %sWorldpay Sandbox Testing Guide%s for more details.', 'invoicing'),
299 299
                 '<a href="https://developer.worldpay.com/docs/wpg/directintegration/abouttesting">',
300 300
                 '</a>'
301 301
             );
@@ -309,43 +309,43 @@  discard block
 block discarded – undo
309 309
 	 * 
310 310
 	 * @param array $admin_settings
311 311
 	 */
312
-	public function admin_settings( $admin_settings ) {
312
+	public function admin_settings($admin_settings) {
313 313
 
314 314
         $currencies = sprintf(
315
-            __( 'Supported Currencies: %s', 'invoicing' ),
316
-            implode( ', ', $this->currencies )
315
+            __('Supported Currencies: %s', 'invoicing'),
316
+            implode(', ', $this->currencies)
317 317
         );
318 318
 
319 319
         $admin_settings['worldpay_active']['desc'] = $admin_settings['worldpay_active']['desc'] . " ($currencies)";
320
-        $admin_settings['worldpay_desc']['std']    = __( 'Pay securely via Worldpay using your PayPal account, credit or debit card.', 'invoicing' );
320
+        $admin_settings['worldpay_desc']['std']    = __('Pay securely via Worldpay using your PayPal account, credit or debit card.', 'invoicing');
321 321
 
322 322
         $admin_settings['worldpay_instId'] = array(
323 323
             'type' => 'text',
324 324
             'id'   => 'worldpay_instId',
325
-            'name' => __( 'Installation Id', 'invoicing' ),
326
-            'desc' => __( 'Your installation id. Ex: 211616', 'invoicing' ),
325
+            'name' => __('Installation Id', 'invoicing'),
326
+            'desc' => __('Your installation id. Ex: 211616', 'invoicing'),
327 327
         );
328 328
 
329 329
         $admin_settings['worldpay_md5_secret'] = array(
330 330
             'type' => 'text',
331 331
             'id'   => 'worldpay_md5_secret',
332
-            'name' => __( 'MD5 secret', 'invoicing' ),
333
-            'desc' => __( 'Optionally enter your MD5 secret here. Next, open your installation settings and ensure that your SignatureFields parameter is set to ', 'invoicing' ) . '<code>instId:amount:currency:cartId</code>',
332
+            'name' => __('MD5 secret', 'invoicing'),
333
+            'desc' => __('Optionally enter your MD5 secret here. Next, open your installation settings and ensure that your SignatureFields parameter is set to ', 'invoicing') . '<code>instId:amount:currency:cartId</code>',
334 334
         );
335 335
 
336 336
         $admin_settings['worldpay_callbackPW'] = array(
337 337
             'type' => 'text',
338 338
             'id'   => 'worldpay_callbackPW',
339
-            'name' => __( 'Payment Response password', 'invoicing' ),
340
-            'desc' => __( 'Recommended. Enter your WorldPay response password to validate payment notifications.', 'invoicing' ),
339
+            'name' => __('Payment Response password', 'invoicing'),
340
+            'desc' => __('Recommended. Enter your WorldPay response password to validate payment notifications.', 'invoicing'),
341 341
         );
342 342
 
343 343
         $admin_settings['worldpay_ipn_url'] = array(
344 344
             'type'     => 'ipn_url',
345 345
             'id'       => 'worldpay_ipn_url',
346
-            'name'     => __( 'Payment Response URL', 'invoicing' ),
346
+            'name'     => __('Payment Response URL', 'invoicing'),
347 347
             'std'      => $this->notify_url,
348
-            'desc'     => __( 'Login to your Worldpay Merchant Interface then enable Payment Response & Shopper Response. Next, go to the Payment Response URL field and enter the above URL.', 'invoicing' ),
348
+            'desc'     => __('Login to your Worldpay Merchant Interface then enable Payment Response & Shopper Response. Next, go to the Payment Response URL field and enter the above URL.', 'invoicing'),
349 349
             'custom'   => 'worldpay',
350 350
             'readonly' => true
351 351
         );
Please login to merge, or discard this patch.
includes/data/invoice-schema.php 2 patches
Indentation   +621 added lines, -621 removed lines patch added patch discarded remove patch
@@ -13,629 +13,629 @@
 block discarded – undo
13 13
 
14 14
 return array(
15 15
 
16
-	'id'              => array(
17
-		'description' => __( 'Unique identifier for the invoice.', 'invoicing' ),
18
-		'type'        => 'integer',
19
-		'context'     => array( 'view', 'edit', 'embed' ),
20
-		'readonly'    => true,
21
-	),
22
-
23
-	'parent_id'       => array(
24
-		'description' => __( 'Parent invoice ID.', 'invoicing' ),
25
-		'type'        => 'integer',
26
-		'minimum'     => 0,
27
-		'default'     => 0,
28
-		'context'     => array( 'view', 'edit' ),
29
-	),
30
-
31
-	'key'			  => array(
32
-		'description' => __( 'A unique key for the invoice.', 'invoicing' ),
33
-		'type'        => 'string',
34
-		'context'     => array( 'view', 'edit' ),
35
-		'readonly'    => true,
36
-	),
37
-
38
-	'number'		  => array(
39
-		'description' => __( 'A unique number for the invoice.', 'invoicing' ),
40
-		'type'        => 'string',
41
-		'context'     => array( 'view', 'edit', 'embed' ),
42
-	),
43
-
44
-	'type'			  => array(
45
-		'description' => __( 'Get the invoice type (e.g invoice, quote etc).', 'invoicing' ),
46
-		'type'        => 'string',
47
-		'context'     => array( 'view', 'edit', 'embed' ),
48
-		'readonly'    => true,
49
-	),
50
-
51
-	'post_type'		  => array(
52
-		'description' => __( 'Get the invoice post type (e.g wpi_invoice, wpi_quote etc).', 'invoicing' ),
53
-		'type'        => 'string',
54
-		'context'     => array( 'view', 'edit', 'embed' ),
55
-		'readonly'    => true,
56
-	),
57
-
58
-	'version'         => array(
59
-		'description' => __( 'Version of GetPaid/Invoicing which last updated the invoice.', 'invoicing' ),
60
-		'type'        => 'integer',
61
-		'context'     => array( 'view', 'edit' ),
62
-		'readonly'    => true,
63
-	),
64
-
65
-	'template'        => array(
66
-		'description' => __( 'The invoice template.', 'invoicing' ),
67
-		'type'        => 'string',
68
-		'default'     => 'quantity',
69
-		'enum'        => array( 'quantity', 'hours', 'amount' ),
70
-		'context'     => array( 'view', 'edit', 'embed' ),
71
-	),
72
-
73
-	'status'          => array(
74
-		'description' => __( 'Invoice status.', 'invoicing' ),
75
-		'type'        => 'string',
76
-		'default'     => 'wpi-pending',
77
-		'enum'        => array_keys( wpinv_get_invoice_statuses( true ) ),
78
-		'context'     => array( 'view', 'edit', 'embed' ),
79
-	),
80
-
81
-	'status_nicename' => array(
82
-		'description' => __( 'A human readable name for the invoice status.', 'invoicing' ),
83
-		'type'        => 'string',
84
-		'context'     => array( 'view', 'edit', 'embed' ),
85
-		'readonly'    => true,
86
-	),
87
-
88
-	'currency'        => array(
89
-		'description' => __( 'The invoice currency in ISO format.', 'invoicing' ),
90
-		'type'        => 'string',
91
-		'default'     => wpinv_get_currency(),
92
-		'enum'        => array_keys( wpinv_get_currencies() ),
93
-		'context'     => array( 'view', 'edit', 'embed' ),
94
-	),
95
-
96
-	'date_created'    => array(
97
-		'description' => __( "The date the invoice was created, in the site's timezone.", 'invoicing' ),
98
-		'type'        => 'string',
99
-		'context'     => array( 'view', 'edit', 'embed' ),
100
-	),
101
-
102
-	'date_created_gmt'    => array(
103
-		'description' => __( 'The GMT date the invoice was created.', 'invoicing' ),
104
-		'type'        => 'string',
105
-		'context'     => array( 'view', 'edit', 'embed' ),
106
-		'readonly'    => true,
107
-	),
108
-
109
-	'date_modified'   => array(
110
-		'description' => __( "The date the invoice was last modified, in the site's timezone.", 'invoicing' ),
111
-		'type'        => 'string',
112
-		'context'     => array( 'view', 'edit', 'embed' ),
113
-		'readonly'    => true,
114
-	),
115
-
116
-	'date_modified_gmt'    => array(
117
-		'description' => __( 'The GMT date the invoice was last modified.', 'invoicing' ),
118
-		'type'        => 'string',
119
-		'context'     => array( 'view', 'edit', 'embed' ),
120
-		'readonly'    => true,
121
-	),
122
-
123
-	'due_date'        => array(
124
-		'description' => __( "The invoice's due date, in the site's timezone.", 'invoicing' ),
125
-		'type'        => 'string',
126
-		'context'     => array( 'view', 'edit', 'embed' ),
127
-	),
128
-
129
-	'due_date_gmt'    => array(
130
-		'description' => __( 'The GMT date the invoice is/was due.', 'invoicing' ),
131
-		'type'        => 'string',
132
-		'context'     => array( 'view', 'edit', 'embed' ),
133
-		'readonly'    => true,
134
-	),
135
-
136
-	'completed_date'  => array(
137
-		'description' => __( "The date the invoice was paid, in the site's timezone.", 'invoicing' ),
138
-		'type'        => 'string',
139
-		'context'     => array( 'view', 'edit', 'embed' ),
140
-		'readonly'    => true,
141
-	),
142
-
143
-	'completed_date_gmt'    => array(
144
-		'description' => __( 'The GMT date the invoice was paid.', 'invoicing' ),
145
-		'type'        => 'string',
146
-		'context'     => array( 'view', 'edit', 'embed' ),
147
-		'readonly'    => true,
148
-	),
149
-
150
-	'total_discount'   => array(
151
-		'description' => __( 'Total discount amount for the invoice.', 'invoicing' ),
152
-		'type'        => 'number',
153
-		'context'     => array( 'view', 'edit', 'embed' ),
154
-		'readonly'    => true,
155
-	),
156
-
157
-	'total_tax'       => array(
158
-		'description' => __( 'Total tax amount for the invoice.', 'invoicing' ),
159
-		'type'        => 'number',
160
-		'context'     => array( 'view', 'edit', 'embed' ),
161
-		'readonly'    => true,
162
-	),
163
-
164
-	'total_fees'      => array(
165
-		'description' => __( 'Total fees amount for the invoice.', 'invoicing' ),
166
-		'type'        => 'number',
167
-		'context'     => array( 'view', 'edit', 'embed' ),
168
-		'readonly'    => true,
169
-	),
170
-
171
-	'subtotal'        => array(
172
-		'description' => __( 'Invoice subtotal.', 'invoicing' ),
173
-		'type'        => 'number',
174
-		'context'     => array( 'view', 'edit', 'embed' ),
175
-		'readonly'    => true,
176
-	),
177
-
178
-	'total'           => array(
179
-		'description' => __( 'Grand total.', 'invoicing' ),
180
-		'type'        => 'number',
181
-		'context'     => array( 'view', 'edit', 'embed' ),
182
-		'readonly'    => true,
183
-	),
184
-
185
-	'initial_total'   => array(
186
-		'description' => __( 'Initial total (for recurring invoices).', 'invoicing' ),
187
-		'type'        => 'number',
188
-		'context'     => array( 'view', 'edit', 'embed' ),
189
-		'readonly'    => true,
190
-	),
191
-
192
-	'recurring_total'  => array(
193
-		'description' => __( 'Recurring total (for recurring invoices).', 'invoicing' ),
194
-		'type'        => 'number',
195
-		'context'     => array( 'view', 'edit', 'embed' ),
196
-		'readonly'    => true,
197
-	),
198
-
199
-	'totals'          => array(
200
-		'description' => __( 'Invoice totals.', 'invoicing' ),
201
-		'type'        => 'object',
202
-		'context'     => array( 'view', 'edit', 'embed' ),
203
-		'readonly'    => true,
204
-	),
205
-
206
-	'fees'            => array(
207
-		'description' => __( 'Invoice fees (Name => properties).', 'invoicing' ),
208
-		'type'        => 'object',
209
-		'context'     => array( 'view', 'edit', 'embed' ),
210
-		'items'       => array(
211
-			'type'                => 'object',
212
-			'required'            => array( 'amount' ),
213
-			'properties'          => array(
214
-				'amount'          => array(
215
-					'description' => __( 'Fee amount.', 'invoicing' ),
216
-					'type'        => 'string',
217
-					'context'     => array( 'view', 'edit', 'embed' ),
218
-				),
219
-				'recurring'       => array(
220
-					'description' => __( 'Whether this is a recurring or one-time fee.', 'invoicing' ),
221
-					'type'        => array( 'boolean', 'integer' ),
222
-					'context'     => array( 'view', 'edit', 'embed' ),
223
-				),
224
-			),
225
-		),
226
-	),
227
-
228
-	'discounts'       => array(
229
-		'description' => __( 'Invoice discounts (Name => properties).', 'invoicing' ),
230
-		'type'        => 'object',
231
-		'context'     => array( 'view', 'edit', 'embed' ),
232
-		'items'       => array(
233
-			'type'                => 'object',
234
-			'required'            => array( 'amount' ),
235
-			'properties'          => array(
236
-				'amount'          => array(
237
-					'description' => __( 'Fee amount.', 'invoicing' ),
238
-					'type'        => 'string',
239
-					'context'     => array( 'view', 'edit', 'embed' ),
240
-				),
241
-				'recurring'       => array(
242
-					'description' => __( 'Whether this is a recurring or one-time discount.', 'invoicing' ),
243
-					'type'        => array( 'boolean', 'integer' ),
244
-					'context'     => array( 'view', 'edit', 'embed' ),
245
-				),
246
-			),
247
-		),
248
-	),
249
-
250
-	'taxes'           => array(
251
-		'description' => __( 'Invoice taxes (Name => properties).', 'invoicing' ),
252
-		'type'        => 'object',
253
-		'context'     => array( 'view', 'edit', 'embed' ),
254
-		'items'       => array(
255
-			'type'                => 'object',
256
-			'required'            => array( 'amount' ),
257
-			'properties'          => array(
258
-				'amount'          => array(
259
-					'description' => __( 'Fee amount.', 'invoicing' ),
260
-					'type'        => 'string',
261
-					'context'     => array( 'view', 'edit', 'embed' ),
262
-				),
263
-				'recurring'       => array(
264
-					'description' => __( 'Whether this is a recurring or one-time tax.', 'invoicing' ),
265
-					'type'        => array( 'boolean', 'integer' ),
266
-					'context'     => array( 'view', 'edit', 'embed' ),
267
-				),
268
-			),
269
-		),
270
-	),
271
-
272
-	'items'           => array(
273
-		'description' => __( 'Invoice items.', 'invoicing' ),
274
-		'type'        => 'array',
275
-		'context'     => array( 'view', 'edit', 'embed' ),
276
-		'items'       => array(
277
-			'type'                => 'object',
278
-			'required'            => array( 'item_id' ),
279
-			'properties'          => array(
280
-				'item_id'         => array(
281
-					'description' => __( 'Item ID.', 'invoicing' ),
282
-					'type'        => 'integer',
283
-					'context'     => array( 'view', 'edit', 'embed' ),
284
-				),
285
-				'item_name'       => array(
286
-					'description' => __( 'Item Name.', 'invoicing' ),
287
-					'type'        => 'string',
288
-					'context'     => array( 'view', 'edit', 'embed' ),
289
-				),
290
-				'item_description' => array(
291
-					'description'  => __( 'Item Description.', 'invoicing' ),
292
-					'type'         => 'string',
293
-					'context'      => array( 'view', 'edit', 'embed' ),
294
-				),
295
-				'item_price'      => array(
296
-					'description' => __( 'Item Price.', 'invoicing' ),
297
-					'type'        => 'number',
298
-					'context'     => array( 'view', 'edit', 'embed' ),
299
-				),
300
-				'quantity'        => array(
301
-					'description' => __( 'Item Quantity.', 'invoicing' ),
302
-					'type'        => 'integer',
303
-					'context'     => array( 'view', 'edit', 'embed' ),
304
-				),
305
-				'subtotal'        => array(
306
-					'description' => __( 'Item Subtotal.', 'invoicing' ),
307
-					'type'        => 'number',
308
-					'context'     => array( 'view', 'edit', 'embed' ),
309
-					'readonly'    => true,
310
-				),
311
-				'meta'            => array(
312
-					'description' => __( 'Item Meta.', 'invoicing' ),
313
-					'type'        => 'object',
314
-					'context'     => array( 'view', 'edit', 'embed' ),
315
-				),
316
-			),
317
-		),
318
-	),
319
-
320
-	'mode'			  => array(
321
-		'description' => __( 'The invoice transaction mode.', 'invoicing' ),
322
-		'type'        => 'string',
323
-		'context'     => array( 'view', 'edit', 'embed' ),
324
-		'enum'        => array( 'live', 'test' ),
325
-		'readonly'    => true,
326
-	),
16
+    'id'              => array(
17
+        'description' => __( 'Unique identifier for the invoice.', 'invoicing' ),
18
+        'type'        => 'integer',
19
+        'context'     => array( 'view', 'edit', 'embed' ),
20
+        'readonly'    => true,
21
+    ),
22
+
23
+    'parent_id'       => array(
24
+        'description' => __( 'Parent invoice ID.', 'invoicing' ),
25
+        'type'        => 'integer',
26
+        'minimum'     => 0,
27
+        'default'     => 0,
28
+        'context'     => array( 'view', 'edit' ),
29
+    ),
30
+
31
+    'key'			  => array(
32
+        'description' => __( 'A unique key for the invoice.', 'invoicing' ),
33
+        'type'        => 'string',
34
+        'context'     => array( 'view', 'edit' ),
35
+        'readonly'    => true,
36
+    ),
37
+
38
+    'number'		  => array(
39
+        'description' => __( 'A unique number for the invoice.', 'invoicing' ),
40
+        'type'        => 'string',
41
+        'context'     => array( 'view', 'edit', 'embed' ),
42
+    ),
43
+
44
+    'type'			  => array(
45
+        'description' => __( 'Get the invoice type (e.g invoice, quote etc).', 'invoicing' ),
46
+        'type'        => 'string',
47
+        'context'     => array( 'view', 'edit', 'embed' ),
48
+        'readonly'    => true,
49
+    ),
50
+
51
+    'post_type'		  => array(
52
+        'description' => __( 'Get the invoice post type (e.g wpi_invoice, wpi_quote etc).', 'invoicing' ),
53
+        'type'        => 'string',
54
+        'context'     => array( 'view', 'edit', 'embed' ),
55
+        'readonly'    => true,
56
+    ),
57
+
58
+    'version'         => array(
59
+        'description' => __( 'Version of GetPaid/Invoicing which last updated the invoice.', 'invoicing' ),
60
+        'type'        => 'integer',
61
+        'context'     => array( 'view', 'edit' ),
62
+        'readonly'    => true,
63
+    ),
64
+
65
+    'template'        => array(
66
+        'description' => __( 'The invoice template.', 'invoicing' ),
67
+        'type'        => 'string',
68
+        'default'     => 'quantity',
69
+        'enum'        => array( 'quantity', 'hours', 'amount' ),
70
+        'context'     => array( 'view', 'edit', 'embed' ),
71
+    ),
72
+
73
+    'status'          => array(
74
+        'description' => __( 'Invoice status.', 'invoicing' ),
75
+        'type'        => 'string',
76
+        'default'     => 'wpi-pending',
77
+        'enum'        => array_keys( wpinv_get_invoice_statuses( true ) ),
78
+        'context'     => array( 'view', 'edit', 'embed' ),
79
+    ),
80
+
81
+    'status_nicename' => array(
82
+        'description' => __( 'A human readable name for the invoice status.', 'invoicing' ),
83
+        'type'        => 'string',
84
+        'context'     => array( 'view', 'edit', 'embed' ),
85
+        'readonly'    => true,
86
+    ),
87
+
88
+    'currency'        => array(
89
+        'description' => __( 'The invoice currency in ISO format.', 'invoicing' ),
90
+        'type'        => 'string',
91
+        'default'     => wpinv_get_currency(),
92
+        'enum'        => array_keys( wpinv_get_currencies() ),
93
+        'context'     => array( 'view', 'edit', 'embed' ),
94
+    ),
95
+
96
+    'date_created'    => array(
97
+        'description' => __( "The date the invoice was created, in the site's timezone.", 'invoicing' ),
98
+        'type'        => 'string',
99
+        'context'     => array( 'view', 'edit', 'embed' ),
100
+    ),
101
+
102
+    'date_created_gmt'    => array(
103
+        'description' => __( 'The GMT date the invoice was created.', 'invoicing' ),
104
+        'type'        => 'string',
105
+        'context'     => array( 'view', 'edit', 'embed' ),
106
+        'readonly'    => true,
107
+    ),
108
+
109
+    'date_modified'   => array(
110
+        'description' => __( "The date the invoice was last modified, in the site's timezone.", 'invoicing' ),
111
+        'type'        => 'string',
112
+        'context'     => array( 'view', 'edit', 'embed' ),
113
+        'readonly'    => true,
114
+    ),
115
+
116
+    'date_modified_gmt'    => array(
117
+        'description' => __( 'The GMT date the invoice was last modified.', 'invoicing' ),
118
+        'type'        => 'string',
119
+        'context'     => array( 'view', 'edit', 'embed' ),
120
+        'readonly'    => true,
121
+    ),
122
+
123
+    'due_date'        => array(
124
+        'description' => __( "The invoice's due date, in the site's timezone.", 'invoicing' ),
125
+        'type'        => 'string',
126
+        'context'     => array( 'view', 'edit', 'embed' ),
127
+    ),
128
+
129
+    'due_date_gmt'    => array(
130
+        'description' => __( 'The GMT date the invoice is/was due.', 'invoicing' ),
131
+        'type'        => 'string',
132
+        'context'     => array( 'view', 'edit', 'embed' ),
133
+        'readonly'    => true,
134
+    ),
135
+
136
+    'completed_date'  => array(
137
+        'description' => __( "The date the invoice was paid, in the site's timezone.", 'invoicing' ),
138
+        'type'        => 'string',
139
+        'context'     => array( 'view', 'edit', 'embed' ),
140
+        'readonly'    => true,
141
+    ),
142
+
143
+    'completed_date_gmt'    => array(
144
+        'description' => __( 'The GMT date the invoice was paid.', 'invoicing' ),
145
+        'type'        => 'string',
146
+        'context'     => array( 'view', 'edit', 'embed' ),
147
+        'readonly'    => true,
148
+    ),
149
+
150
+    'total_discount'   => array(
151
+        'description' => __( 'Total discount amount for the invoice.', 'invoicing' ),
152
+        'type'        => 'number',
153
+        'context'     => array( 'view', 'edit', 'embed' ),
154
+        'readonly'    => true,
155
+    ),
156
+
157
+    'total_tax'       => array(
158
+        'description' => __( 'Total tax amount for the invoice.', 'invoicing' ),
159
+        'type'        => 'number',
160
+        'context'     => array( 'view', 'edit', 'embed' ),
161
+        'readonly'    => true,
162
+    ),
163
+
164
+    'total_fees'      => array(
165
+        'description' => __( 'Total fees amount for the invoice.', 'invoicing' ),
166
+        'type'        => 'number',
167
+        'context'     => array( 'view', 'edit', 'embed' ),
168
+        'readonly'    => true,
169
+    ),
170
+
171
+    'subtotal'        => array(
172
+        'description' => __( 'Invoice subtotal.', 'invoicing' ),
173
+        'type'        => 'number',
174
+        'context'     => array( 'view', 'edit', 'embed' ),
175
+        'readonly'    => true,
176
+    ),
177
+
178
+    'total'           => array(
179
+        'description' => __( 'Grand total.', 'invoicing' ),
180
+        'type'        => 'number',
181
+        'context'     => array( 'view', 'edit', 'embed' ),
182
+        'readonly'    => true,
183
+    ),
184
+
185
+    'initial_total'   => array(
186
+        'description' => __( 'Initial total (for recurring invoices).', 'invoicing' ),
187
+        'type'        => 'number',
188
+        'context'     => array( 'view', 'edit', 'embed' ),
189
+        'readonly'    => true,
190
+    ),
191
+
192
+    'recurring_total'  => array(
193
+        'description' => __( 'Recurring total (for recurring invoices).', 'invoicing' ),
194
+        'type'        => 'number',
195
+        'context'     => array( 'view', 'edit', 'embed' ),
196
+        'readonly'    => true,
197
+    ),
198
+
199
+    'totals'          => array(
200
+        'description' => __( 'Invoice totals.', 'invoicing' ),
201
+        'type'        => 'object',
202
+        'context'     => array( 'view', 'edit', 'embed' ),
203
+        'readonly'    => true,
204
+    ),
205
+
206
+    'fees'            => array(
207
+        'description' => __( 'Invoice fees (Name => properties).', 'invoicing' ),
208
+        'type'        => 'object',
209
+        'context'     => array( 'view', 'edit', 'embed' ),
210
+        'items'       => array(
211
+            'type'                => 'object',
212
+            'required'            => array( 'amount' ),
213
+            'properties'          => array(
214
+                'amount'          => array(
215
+                    'description' => __( 'Fee amount.', 'invoicing' ),
216
+                    'type'        => 'string',
217
+                    'context'     => array( 'view', 'edit', 'embed' ),
218
+                ),
219
+                'recurring'       => array(
220
+                    'description' => __( 'Whether this is a recurring or one-time fee.', 'invoicing' ),
221
+                    'type'        => array( 'boolean', 'integer' ),
222
+                    'context'     => array( 'view', 'edit', 'embed' ),
223
+                ),
224
+            ),
225
+        ),
226
+    ),
227
+
228
+    'discounts'       => array(
229
+        'description' => __( 'Invoice discounts (Name => properties).', 'invoicing' ),
230
+        'type'        => 'object',
231
+        'context'     => array( 'view', 'edit', 'embed' ),
232
+        'items'       => array(
233
+            'type'                => 'object',
234
+            'required'            => array( 'amount' ),
235
+            'properties'          => array(
236
+                'amount'          => array(
237
+                    'description' => __( 'Fee amount.', 'invoicing' ),
238
+                    'type'        => 'string',
239
+                    'context'     => array( 'view', 'edit', 'embed' ),
240
+                ),
241
+                'recurring'       => array(
242
+                    'description' => __( 'Whether this is a recurring or one-time discount.', 'invoicing' ),
243
+                    'type'        => array( 'boolean', 'integer' ),
244
+                    'context'     => array( 'view', 'edit', 'embed' ),
245
+                ),
246
+            ),
247
+        ),
248
+    ),
249
+
250
+    'taxes'           => array(
251
+        'description' => __( 'Invoice taxes (Name => properties).', 'invoicing' ),
252
+        'type'        => 'object',
253
+        'context'     => array( 'view', 'edit', 'embed' ),
254
+        'items'       => array(
255
+            'type'                => 'object',
256
+            'required'            => array( 'amount' ),
257
+            'properties'          => array(
258
+                'amount'          => array(
259
+                    'description' => __( 'Fee amount.', 'invoicing' ),
260
+                    'type'        => 'string',
261
+                    'context'     => array( 'view', 'edit', 'embed' ),
262
+                ),
263
+                'recurring'       => array(
264
+                    'description' => __( 'Whether this is a recurring or one-time tax.', 'invoicing' ),
265
+                    'type'        => array( 'boolean', 'integer' ),
266
+                    'context'     => array( 'view', 'edit', 'embed' ),
267
+                ),
268
+            ),
269
+        ),
270
+    ),
271
+
272
+    'items'           => array(
273
+        'description' => __( 'Invoice items.', 'invoicing' ),
274
+        'type'        => 'array',
275
+        'context'     => array( 'view', 'edit', 'embed' ),
276
+        'items'       => array(
277
+            'type'                => 'object',
278
+            'required'            => array( 'item_id' ),
279
+            'properties'          => array(
280
+                'item_id'         => array(
281
+                    'description' => __( 'Item ID.', 'invoicing' ),
282
+                    'type'        => 'integer',
283
+                    'context'     => array( 'view', 'edit', 'embed' ),
284
+                ),
285
+                'item_name'       => array(
286
+                    'description' => __( 'Item Name.', 'invoicing' ),
287
+                    'type'        => 'string',
288
+                    'context'     => array( 'view', 'edit', 'embed' ),
289
+                ),
290
+                'item_description' => array(
291
+                    'description'  => __( 'Item Description.', 'invoicing' ),
292
+                    'type'         => 'string',
293
+                    'context'      => array( 'view', 'edit', 'embed' ),
294
+                ),
295
+                'item_price'      => array(
296
+                    'description' => __( 'Item Price.', 'invoicing' ),
297
+                    'type'        => 'number',
298
+                    'context'     => array( 'view', 'edit', 'embed' ),
299
+                ),
300
+                'quantity'        => array(
301
+                    'description' => __( 'Item Quantity.', 'invoicing' ),
302
+                    'type'        => 'integer',
303
+                    'context'     => array( 'view', 'edit', 'embed' ),
304
+                ),
305
+                'subtotal'        => array(
306
+                    'description' => __( 'Item Subtotal.', 'invoicing' ),
307
+                    'type'        => 'number',
308
+                    'context'     => array( 'view', 'edit', 'embed' ),
309
+                    'readonly'    => true,
310
+                ),
311
+                'meta'            => array(
312
+                    'description' => __( 'Item Meta.', 'invoicing' ),
313
+                    'type'        => 'object',
314
+                    'context'     => array( 'view', 'edit', 'embed' ),
315
+                ),
316
+            ),
317
+        ),
318
+    ),
319
+
320
+    'mode'			  => array(
321
+        'description' => __( 'The invoice transaction mode.', 'invoicing' ),
322
+        'type'        => 'string',
323
+        'context'     => array( 'view', 'edit', 'embed' ),
324
+        'enum'        => array( 'live', 'test' ),
325
+        'readonly'    => true,
326
+    ),
327 327
 	
328
-	'discount_code'   => array(
329
-		'description' => __( 'The discount code used on this invoice.', 'invoicing' ),
330
-		'type'        => 'string',
331
-		'context'     => array( 'view', 'edit', 'embed' ),
332
-	),
333
-
334
-	'gateway'         => array(
335
-		'description' => __( 'The gateway used to pay this invoice.', 'invoicing' ),
336
-		'type'        => 'string',
337
-		'context'     => array( 'view', 'edit', 'embed' ),
338
-	),
339
-
340
-	'gateway_title'   => array(
341
-		'description' => __( 'The title of the gateway used to pay this invoice.', 'invoicing' ),
342
-		'type'        => 'string',
343
-		'context'     => array( 'view', 'edit', 'embed' ),
344
-		'readonly'    => true,
345
-	),
346
-
347
-	'transaction_id'  => array(
348
-		'description' => __( 'The transaction id for this invoice.', 'invoicing' ),
349
-		'type'        => 'string',
350
-		'context'     => array( 'view', 'edit', 'embed' ),
351
-	),
328
+    'discount_code'   => array(
329
+        'description' => __( 'The discount code used on this invoice.', 'invoicing' ),
330
+        'type'        => 'string',
331
+        'context'     => array( 'view', 'edit', 'embed' ),
332
+    ),
333
+
334
+    'gateway'         => array(
335
+        'description' => __( 'The gateway used to pay this invoice.', 'invoicing' ),
336
+        'type'        => 'string',
337
+        'context'     => array( 'view', 'edit', 'embed' ),
338
+    ),
339
+
340
+    'gateway_title'   => array(
341
+        'description' => __( 'The title of the gateway used to pay this invoice.', 'invoicing' ),
342
+        'type'        => 'string',
343
+        'context'     => array( 'view', 'edit', 'embed' ),
344
+        'readonly'    => true,
345
+    ),
346
+
347
+    'transaction_id'  => array(
348
+        'description' => __( 'The transaction id for this invoice.', 'invoicing' ),
349
+        'type'        => 'string',
350
+        'context'     => array( 'view', 'edit', 'embed' ),
351
+    ),
352 352
 	
353
-	'disable_taxes'   => array(
354
-		'description' => __( 'Whether or not taxes should be disabled for this invoice.', 'invoicing' ),
355
-		'type'        => 'boolean ',
356
-		'context'     => array( 'view', 'edit', 'embed' ),
357
-	),
358
-
359
-	'is_viewed'       => array(
360
-		'description' => __( 'Whether or not this invoice has been viewed by the user.', 'invoicing' ),
361
-		'type'        => 'boolean ',
362
-		'context'     => array( 'view', 'edit', 'embed' ),
363
-		'readonly'    => true,
364
-	),
365
-
366
-	'email_cc'        => array(
367
-		'description' => __( 'A comma separated list of other emails that should receive communications for this invoice.', 'invoicing' ),
368
-		'type'        => 'string ',
369
-		'context'     => array( 'view', 'edit' ),
370
-	),
371
-
372
-	'subscription_id' => array(
373
-		'description' => __( 'The ID of the subscription associated with this invoice.', 'invoicing' ),
374
-		'type'        => 'string ',
375
-		'context'     => array( 'view', 'edit', 'embed' ),
376
-		'readonly'    => true,
377
-	),
378
-
379
-	'subscription_name' => array(
380
-		'description' => __( 'The name of the subscription associated with this invoice.', 'invoicing' ),
381
-		'type'        => 'string ',
382
-		'context'     => array( 'view', 'edit', 'embed' ),
383
-		'readonly'    => true,
384
-	),
385
-
386
-	'subscription_name' => array(
387
-		'description' => __( 'The name of the subscription associated with this invoice.', 'invoicing' ),
388
-		'type'        => 'string ',
389
-		'context'     => array( 'view', 'edit', 'embed' ),
390
-		'readonly'    => true,
391
-	),
392
-
393
-	'is_parent'		  => array(
394
-		'description' => __( 'Whether or not this is a parent invoice.', 'invoicing' ),
395
-		'type'        => 'boolean',
396
-		'context'     => array( 'view', 'edit', 'embed' ),
397
-		'readonly'    => true,
398
-	),
399
-
400
-	'is_renewal'      => array(
401
-		'description' => __( 'Whether or not this is a renewal invoice.', 'invoicing' ),
402
-		'type'        => 'boolean',
403
-		'context'     => array( 'view', 'edit', 'embed' ),
404
-		'readonly'    => true,
405
-	),
406
-
407
-	'is_recurring'    => array(
408
-		'description' => __( 'Whether or not this is a recurring invoice.', 'invoicing' ),
409
-		'type'        => 'boolean',
410
-		'context'     => array( 'view', 'edit', 'embed' ),
411
-		'readonly'    => true,
412
-	),
413
-
414
-	'is_free'         => array(
415
-		'description' => __( 'Whether or not this invoice is free.', 'invoicing' ),
416
-		'type'        => 'boolean',
417
-		'context'     => array( 'view', 'edit', 'embed' ),
418
-		'readonly'    => true,
419
-	),
420
-
421
-	'is_paid'         => array(
422
-		'description' => __( 'Whether or not this invoice has been paid.', 'invoicing' ),
423
-		'type'        => 'boolean',
424
-		'context'     => array( 'view', 'edit', 'embed' ),
425
-		'readonly'    => true,
426
-	),
427
-
428
-	'needs_payment'   => array(
429
-		'description' => __( 'Whether or not this invoice needs payment.', 'invoicing' ),
430
-		'type'        => 'boolean',
431
-		'context'     => array( 'view', 'edit', 'embed' ),
432
-		'readonly'    => true,
433
-	),
434
-
435
-	'is_refunded'     => array(
436
-		'description' => __( 'Whether or not this invoice was refunded.', 'invoicing' ),
437
-		'type'        => 'boolean',
438
-		'context'     => array( 'view', 'edit', 'embed' ),
439
-		'readonly'    => true,
440
-	),
441
-
442
-	'is_due'          => array(
443
-		'description' => __( 'Whether or not this invoice is due.', 'invoicing' ),
444
-		'type'        => 'boolean',
445
-		'context'     => array( 'view', 'edit', 'embed' ),
446
-		'readonly'    => true,
447
-	),
448
-
449
-	'is_held'         => array(
450
-		'description' => __( 'Whether or not this invoice has been held for payment confirmation.', 'invoicing' ),
451
-		'type'        => 'boolean',
452
-		'context'     => array( 'view', 'edit', 'embed' ),
453
-		'readonly'    => true,
454
-	),
455
-
456
-	'is_draft'        => array(
457
-		'description' => __( 'Whether or not this invoice is marked as draft (cannot be viewed on the frontend).', 'invoicing' ),
458
-		'type'        => 'boolean',
459
-		'context'     => array( 'view', 'edit', 'embed' ),
460
-		'readonly'    => true,
461
-	),
462
-
463
-	'path'			  => array(
464
-		'description' => __( 'The invoice path/slug/name.', 'invoicing' ),
465
-		'type'        => 'string',
466
-		'context'     => array( 'view', 'edit', 'embed' ),
467
-		'readonly'    => true,
468
-	),
469
-
470
-	'description'     => array(
471
-		'description' => __( 'The invoice description.', 'invoicing' ),
472
-		'type'        => 'string',
473
-		'context'     => array( 'view', 'edit', 'embed' ),
474
-	),
475
-
476
-	'payment_form'    => array(
477
-		'description' => __( 'The id of the payment form used to pay for this invoice.', 'invoicing' ),
478
-		'type'        => 'integer',
479
-		'context'     => array( 'view', 'edit' ),
480
-		'readonly'    => true,
481
-	),
482
-
483
-	'submission_id'   => array(
484
-		'description' => __( 'A uniques ID of the submission details used to pay for this invoice.', 'invoicing' ),
485
-		'type'        => 'string',
486
-		'context'     => array( 'view', 'edit' ),
487
-		'readonly'    => true,
488
-	),
489
-
490
-	'customer_id'     => array(
491
-		'description' => __( 'The customer id.', 'invoicing' ),
492
-		'type'        => 'integer',
493
-		'context'     => array( 'view', 'edit', 'embed' ),
494
-	),
495
-
496
-	'customer_ip'     => array(
497
-		'description' => __( "The customer's ip address.", 'invoicing' ),
498
-		'type'        => 'string',
499
-		'format'      => 'ip',
500
-		'context'     => array( 'view', 'edit', 'embed' ),
501
-	),
502
-
503
-	'first_name'     => array(
504
-		'description' => __( "The customer's first name.", 'invoicing' ),
505
-		'type'        => 'string',
506
-		'context'     => array( 'view', 'edit', 'embed' ),
507
-	),
508
-
509
-	'last_name'       => array(
510
-		'description' => __( "The customer's last name.", 'invoicing' ),
511
-		'type'        => 'string',
512
-		'context'     => array( 'view', 'edit', 'embed' ),
513
-	),
353
+    'disable_taxes'   => array(
354
+        'description' => __( 'Whether or not taxes should be disabled for this invoice.', 'invoicing' ),
355
+        'type'        => 'boolean ',
356
+        'context'     => array( 'view', 'edit', 'embed' ),
357
+    ),
358
+
359
+    'is_viewed'       => array(
360
+        'description' => __( 'Whether or not this invoice has been viewed by the user.', 'invoicing' ),
361
+        'type'        => 'boolean ',
362
+        'context'     => array( 'view', 'edit', 'embed' ),
363
+        'readonly'    => true,
364
+    ),
365
+
366
+    'email_cc'        => array(
367
+        'description' => __( 'A comma separated list of other emails that should receive communications for this invoice.', 'invoicing' ),
368
+        'type'        => 'string ',
369
+        'context'     => array( 'view', 'edit' ),
370
+    ),
371
+
372
+    'subscription_id' => array(
373
+        'description' => __( 'The ID of the subscription associated with this invoice.', 'invoicing' ),
374
+        'type'        => 'string ',
375
+        'context'     => array( 'view', 'edit', 'embed' ),
376
+        'readonly'    => true,
377
+    ),
378
+
379
+    'subscription_name' => array(
380
+        'description' => __( 'The name of the subscription associated with this invoice.', 'invoicing' ),
381
+        'type'        => 'string ',
382
+        'context'     => array( 'view', 'edit', 'embed' ),
383
+        'readonly'    => true,
384
+    ),
385
+
386
+    'subscription_name' => array(
387
+        'description' => __( 'The name of the subscription associated with this invoice.', 'invoicing' ),
388
+        'type'        => 'string ',
389
+        'context'     => array( 'view', 'edit', 'embed' ),
390
+        'readonly'    => true,
391
+    ),
392
+
393
+    'is_parent'		  => array(
394
+        'description' => __( 'Whether or not this is a parent invoice.', 'invoicing' ),
395
+        'type'        => 'boolean',
396
+        'context'     => array( 'view', 'edit', 'embed' ),
397
+        'readonly'    => true,
398
+    ),
399
+
400
+    'is_renewal'      => array(
401
+        'description' => __( 'Whether or not this is a renewal invoice.', 'invoicing' ),
402
+        'type'        => 'boolean',
403
+        'context'     => array( 'view', 'edit', 'embed' ),
404
+        'readonly'    => true,
405
+    ),
406
+
407
+    'is_recurring'    => array(
408
+        'description' => __( 'Whether or not this is a recurring invoice.', 'invoicing' ),
409
+        'type'        => 'boolean',
410
+        'context'     => array( 'view', 'edit', 'embed' ),
411
+        'readonly'    => true,
412
+    ),
413
+
414
+    'is_free'         => array(
415
+        'description' => __( 'Whether or not this invoice is free.', 'invoicing' ),
416
+        'type'        => 'boolean',
417
+        'context'     => array( 'view', 'edit', 'embed' ),
418
+        'readonly'    => true,
419
+    ),
420
+
421
+    'is_paid'         => array(
422
+        'description' => __( 'Whether or not this invoice has been paid.', 'invoicing' ),
423
+        'type'        => 'boolean',
424
+        'context'     => array( 'view', 'edit', 'embed' ),
425
+        'readonly'    => true,
426
+    ),
427
+
428
+    'needs_payment'   => array(
429
+        'description' => __( 'Whether or not this invoice needs payment.', 'invoicing' ),
430
+        'type'        => 'boolean',
431
+        'context'     => array( 'view', 'edit', 'embed' ),
432
+        'readonly'    => true,
433
+    ),
434
+
435
+    'is_refunded'     => array(
436
+        'description' => __( 'Whether or not this invoice was refunded.', 'invoicing' ),
437
+        'type'        => 'boolean',
438
+        'context'     => array( 'view', 'edit', 'embed' ),
439
+        'readonly'    => true,
440
+    ),
441
+
442
+    'is_due'          => array(
443
+        'description' => __( 'Whether or not this invoice is due.', 'invoicing' ),
444
+        'type'        => 'boolean',
445
+        'context'     => array( 'view', 'edit', 'embed' ),
446
+        'readonly'    => true,
447
+    ),
448
+
449
+    'is_held'         => array(
450
+        'description' => __( 'Whether or not this invoice has been held for payment confirmation.', 'invoicing' ),
451
+        'type'        => 'boolean',
452
+        'context'     => array( 'view', 'edit', 'embed' ),
453
+        'readonly'    => true,
454
+    ),
455
+
456
+    'is_draft'        => array(
457
+        'description' => __( 'Whether or not this invoice is marked as draft (cannot be viewed on the frontend).', 'invoicing' ),
458
+        'type'        => 'boolean',
459
+        'context'     => array( 'view', 'edit', 'embed' ),
460
+        'readonly'    => true,
461
+    ),
462
+
463
+    'path'			  => array(
464
+        'description' => __( 'The invoice path/slug/name.', 'invoicing' ),
465
+        'type'        => 'string',
466
+        'context'     => array( 'view', 'edit', 'embed' ),
467
+        'readonly'    => true,
468
+    ),
469
+
470
+    'description'     => array(
471
+        'description' => __( 'The invoice description.', 'invoicing' ),
472
+        'type'        => 'string',
473
+        'context'     => array( 'view', 'edit', 'embed' ),
474
+    ),
475
+
476
+    'payment_form'    => array(
477
+        'description' => __( 'The id of the payment form used to pay for this invoice.', 'invoicing' ),
478
+        'type'        => 'integer',
479
+        'context'     => array( 'view', 'edit' ),
480
+        'readonly'    => true,
481
+    ),
482
+
483
+    'submission_id'   => array(
484
+        'description' => __( 'A uniques ID of the submission details used to pay for this invoice.', 'invoicing' ),
485
+        'type'        => 'string',
486
+        'context'     => array( 'view', 'edit' ),
487
+        'readonly'    => true,
488
+    ),
489
+
490
+    'customer_id'     => array(
491
+        'description' => __( 'The customer id.', 'invoicing' ),
492
+        'type'        => 'integer',
493
+        'context'     => array( 'view', 'edit', 'embed' ),
494
+    ),
495
+
496
+    'customer_ip'     => array(
497
+        'description' => __( "The customer's ip address.", 'invoicing' ),
498
+        'type'        => 'string',
499
+        'format'      => 'ip',
500
+        'context'     => array( 'view', 'edit', 'embed' ),
501
+    ),
502
+
503
+    'first_name'     => array(
504
+        'description' => __( "The customer's first name.", 'invoicing' ),
505
+        'type'        => 'string',
506
+        'context'     => array( 'view', 'edit', 'embed' ),
507
+    ),
508
+
509
+    'last_name'       => array(
510
+        'description' => __( "The customer's last name.", 'invoicing' ),
511
+        'type'        => 'string',
512
+        'context'     => array( 'view', 'edit', 'embed' ),
513
+    ),
514 514
 	
515
-	'full_name'       => array(
516
-		'description' => __( "The customer's full name.", 'invoicing' ),
517
-		'type'        => 'string',
518
-		'context'     => array( 'view', 'edit', 'embed' ),
519
-		'readonly'    => true,
520
-	),
521
-
522
-	'phone_number'    => array(
523
-		'description' => __( "The customer's phone number.", 'invoicing' ),
524
-		'type'        => 'string',
525
-		'context'     => array( 'view', 'edit', 'embed' ),
526
-	),
527
-
528
-	'email_address'   => array(
529
-		'description' => __( "The customer's email address.", 'invoicing' ),
530
-		'type'        => 'string',
531
-		'context'     => array( 'view', 'edit', 'embed' ),
532
-		'readonly'    => true,
533
-	),
534
-
535
-	'customer_country'   => array(
536
-		'description'    => __( "The customer's country.", 'invoicing' ),
537
-		'type'           => 'string',
538
-		'context'        => array( 'view', 'edit', 'embed' ),
539
-		'default'        => wpinv_get_default_country(),
540
-	),
541
-
542
-	'customer_state'     => array(
543
-		'description'    => __( "The customer's state.", 'invoicing' ),
544
-		'type'           => 'string',
545
-		'context'        => array( 'view', 'edit', 'embed' ),
546
-	),
547
-
548
-	'customer_city'      => array(
549
-		'description'    => __( "The customer's city.", 'invoicing' ),
550
-		'type'           => 'string',
551
-		'context'        => array( 'view', 'edit', 'embed' ),
552
-	),
553
-
554
-	'customer_zip'       => array(
555
-		'description'    => __( "The customer's zip/postal code.", 'invoicing' ),
556
-		'type'           => 'string',
557
-		'context'        => array( 'view', 'edit', 'embed' ),
558
-	),
559
-
560
-	'customer_company'   => array(
561
-		'description'    => __( "The customer's company name.", 'invoicing' ),
562
-		'type'           => 'string',
563
-		'context'        => array( 'view', 'edit', 'embed' ),
564
-	),
565
-
566
-	'vat_number'         => array(
567
-		'description'    => __( "The customer's VAT number.", 'invoicing' ),
568
-		'type'           => 'string',
569
-		'context'        => array( 'view', 'edit', 'embed' ),
570
-	),
571
-
572
-	'vat_rate'           => array(
573
-		'description'    => __( "The customer's VAT rate.", 'invoicing' ),
574
-		'type'           => 'number',
575
-		'context'        => array( 'view', 'edit', 'embed' ),
576
-		'readonly'       => true,
577
-	),
578
-
579
-	'customer_address'   => array(
580
-		'description'    => __( "The customer's address.", 'invoicing' ),
581
-		'type'           => 'string',
582
-		'context'        => array( 'view', 'edit', 'embed' ),
583
-	),
584
-
585
-	'address_confirmed'  => array(
586
-		'description'    => __( "Whether or not the customer's address is confirmed.", 'invoicing' ),
587
-		'type'           => 'boolean',
588
-		'context'        => array( 'view', 'edit', 'embed' ),
589
-	),
590
-
591
-	'meta_data'       => array(
592
-		'description' => __( 'Invoice meta data.', 'invoicing' ),
593
-		'type'        => 'array',
594
-		'context'     => array( 'view', 'edit', 'embed' ),
595
-		'items'       => array(
596
-			'type'                => 'object',
597
-			'properties'          => array(
598
-				'id'              => array(
599
-					'description' => __( 'Meta ID.', 'invoicing' ),
600
-					'type'        => 'string',
601
-					'context'     => array( 'view', 'edit', 'embed' ),
602
-				),
603
-				'key'             => array(
604
-					'description' => __( 'Meta key.', 'invoicing' ),
605
-					'type'        => 'string',
606
-					'context'     => array( 'view', 'edit', 'embed' ),
607
-				),
608
-				'value'           => array(
609
-					'description' => __( 'Meta Value.', 'invoicing' ),
610
-					'type'        => array( 'string', 'array', 'object', 'integer', 'null' ),
611
-					'context'     => array( 'view', 'edit', 'embed' ),
612
-				),
613
-			),
614
-		),
615
-	),
616
-
617
-	'view_url'        => array(
618
-		'description' => __( 'URL to the invoice.', 'invoicing' ),
619
-		'type'        => 'string',
620
-		'format'      => 'uri',
621
-		'context'     => array( 'view', 'edit', 'embed' ),
622
-		'readonly'    => true,
623
-	),
624
-
625
-	'checkout_payment_url'         => array(
626
-		'description' => __( 'URL to the invoice checkout page.', 'invoicing' ),
627
-		'type'        => 'string',
628
-		'format'      => 'uri',
629
-		'context'     => array( 'view', 'edit', 'embed' ),
630
-		'readonly'    => true,
631
-	),
632
-
633
-	'receipt_url'     => array(
634
-		'description' => __( 'URL to the invoice receipt page.', 'invoicing' ),
635
-		'type'        => 'string',
636
-		'format'      => 'uri',
637
-		'context'     => array( 'view', 'edit', 'embed' ),
638
-		'readonly'    => true,
639
-	),
515
+    'full_name'       => array(
516
+        'description' => __( "The customer's full name.", 'invoicing' ),
517
+        'type'        => 'string',
518
+        'context'     => array( 'view', 'edit', 'embed' ),
519
+        'readonly'    => true,
520
+    ),
521
+
522
+    'phone_number'    => array(
523
+        'description' => __( "The customer's phone number.", 'invoicing' ),
524
+        'type'        => 'string',
525
+        'context'     => array( 'view', 'edit', 'embed' ),
526
+    ),
527
+
528
+    'email_address'   => array(
529
+        'description' => __( "The customer's email address.", 'invoicing' ),
530
+        'type'        => 'string',
531
+        'context'     => array( 'view', 'edit', 'embed' ),
532
+        'readonly'    => true,
533
+    ),
534
+
535
+    'customer_country'   => array(
536
+        'description'    => __( "The customer's country.", 'invoicing' ),
537
+        'type'           => 'string',
538
+        'context'        => array( 'view', 'edit', 'embed' ),
539
+        'default'        => wpinv_get_default_country(),
540
+    ),
541
+
542
+    'customer_state'     => array(
543
+        'description'    => __( "The customer's state.", 'invoicing' ),
544
+        'type'           => 'string',
545
+        'context'        => array( 'view', 'edit', 'embed' ),
546
+    ),
547
+
548
+    'customer_city'      => array(
549
+        'description'    => __( "The customer's city.", 'invoicing' ),
550
+        'type'           => 'string',
551
+        'context'        => array( 'view', 'edit', 'embed' ),
552
+    ),
553
+
554
+    'customer_zip'       => array(
555
+        'description'    => __( "The customer's zip/postal code.", 'invoicing' ),
556
+        'type'           => 'string',
557
+        'context'        => array( 'view', 'edit', 'embed' ),
558
+    ),
559
+
560
+    'customer_company'   => array(
561
+        'description'    => __( "The customer's company name.", 'invoicing' ),
562
+        'type'           => 'string',
563
+        'context'        => array( 'view', 'edit', 'embed' ),
564
+    ),
565
+
566
+    'vat_number'         => array(
567
+        'description'    => __( "The customer's VAT number.", 'invoicing' ),
568
+        'type'           => 'string',
569
+        'context'        => array( 'view', 'edit', 'embed' ),
570
+    ),
571
+
572
+    'vat_rate'           => array(
573
+        'description'    => __( "The customer's VAT rate.", 'invoicing' ),
574
+        'type'           => 'number',
575
+        'context'        => array( 'view', 'edit', 'embed' ),
576
+        'readonly'       => true,
577
+    ),
578
+
579
+    'customer_address'   => array(
580
+        'description'    => __( "The customer's address.", 'invoicing' ),
581
+        'type'           => 'string',
582
+        'context'        => array( 'view', 'edit', 'embed' ),
583
+    ),
584
+
585
+    'address_confirmed'  => array(
586
+        'description'    => __( "Whether or not the customer's address is confirmed.", 'invoicing' ),
587
+        'type'           => 'boolean',
588
+        'context'        => array( 'view', 'edit', 'embed' ),
589
+    ),
590
+
591
+    'meta_data'       => array(
592
+        'description' => __( 'Invoice meta data.', 'invoicing' ),
593
+        'type'        => 'array',
594
+        'context'     => array( 'view', 'edit', 'embed' ),
595
+        'items'       => array(
596
+            'type'                => 'object',
597
+            'properties'          => array(
598
+                'id'              => array(
599
+                    'description' => __( 'Meta ID.', 'invoicing' ),
600
+                    'type'        => 'string',
601
+                    'context'     => array( 'view', 'edit', 'embed' ),
602
+                ),
603
+                'key'             => array(
604
+                    'description' => __( 'Meta key.', 'invoicing' ),
605
+                    'type'        => 'string',
606
+                    'context'     => array( 'view', 'edit', 'embed' ),
607
+                ),
608
+                'value'           => array(
609
+                    'description' => __( 'Meta Value.', 'invoicing' ),
610
+                    'type'        => array( 'string', 'array', 'object', 'integer', 'null' ),
611
+                    'context'     => array( 'view', 'edit', 'embed' ),
612
+                ),
613
+            ),
614
+        ),
615
+    ),
616
+
617
+    'view_url'        => array(
618
+        'description' => __( 'URL to the invoice.', 'invoicing' ),
619
+        'type'        => 'string',
620
+        'format'      => 'uri',
621
+        'context'     => array( 'view', 'edit', 'embed' ),
622
+        'readonly'    => true,
623
+    ),
624
+
625
+    'checkout_payment_url'         => array(
626
+        'description' => __( 'URL to the invoice checkout page.', 'invoicing' ),
627
+        'type'        => 'string',
628
+        'format'      => 'uri',
629
+        'context'     => array( 'view', 'edit', 'embed' ),
630
+        'readonly'    => true,
631
+    ),
632
+
633
+    'receipt_url'     => array(
634
+        'description' => __( 'URL to the invoice receipt page.', 'invoicing' ),
635
+        'type'        => 'string',
636
+        'format'      => 'uri',
637
+        'context'     => array( 'view', 'edit', 'embed' ),
638
+        'readonly'    => true,
639
+    ),
640 640
 
641 641
 );
Please login to merge, or discard this patch.
Spacing   +197 added lines, -197 removed lines patch added patch discarded remove patch
@@ -9,632 +9,632 @@
 block discarded – undo
9 9
  * @version 1.0.19
10 10
  */
11 11
 
12
-defined( 'ABSPATH' ) || exit;
12
+defined('ABSPATH') || exit;
13 13
 
14 14
 return array(
15 15
 
16 16
 	'id'              => array(
17
-		'description' => __( 'Unique identifier for the invoice.', 'invoicing' ),
17
+		'description' => __('Unique identifier for the invoice.', 'invoicing'),
18 18
 		'type'        => 'integer',
19
-		'context'     => array( 'view', 'edit', 'embed' ),
19
+		'context'     => array('view', 'edit', 'embed'),
20 20
 		'readonly'    => true,
21 21
 	),
22 22
 
23 23
 	'parent_id'       => array(
24
-		'description' => __( 'Parent invoice ID.', 'invoicing' ),
24
+		'description' => __('Parent invoice ID.', 'invoicing'),
25 25
 		'type'        => 'integer',
26 26
 		'minimum'     => 0,
27 27
 		'default'     => 0,
28
-		'context'     => array( 'view', 'edit' ),
28
+		'context'     => array('view', 'edit'),
29 29
 	),
30 30
 
31 31
 	'key'			  => array(
32
-		'description' => __( 'A unique key for the invoice.', 'invoicing' ),
32
+		'description' => __('A unique key for the invoice.', 'invoicing'),
33 33
 		'type'        => 'string',
34
-		'context'     => array( 'view', 'edit' ),
34
+		'context'     => array('view', 'edit'),
35 35
 		'readonly'    => true,
36 36
 	),
37 37
 
38 38
 	'number'		  => array(
39
-		'description' => __( 'A unique number for the invoice.', 'invoicing' ),
39
+		'description' => __('A unique number for the invoice.', 'invoicing'),
40 40
 		'type'        => 'string',
41
-		'context'     => array( 'view', 'edit', 'embed' ),
41
+		'context'     => array('view', 'edit', 'embed'),
42 42
 	),
43 43
 
44 44
 	'type'			  => array(
45
-		'description' => __( 'Get the invoice type (e.g invoice, quote etc).', 'invoicing' ),
45
+		'description' => __('Get the invoice type (e.g invoice, quote etc).', 'invoicing'),
46 46
 		'type'        => 'string',
47
-		'context'     => array( 'view', 'edit', 'embed' ),
47
+		'context'     => array('view', 'edit', 'embed'),
48 48
 		'readonly'    => true,
49 49
 	),
50 50
 
51 51
 	'post_type'		  => array(
52
-		'description' => __( 'Get the invoice post type (e.g wpi_invoice, wpi_quote etc).', 'invoicing' ),
52
+		'description' => __('Get the invoice post type (e.g wpi_invoice, wpi_quote etc).', 'invoicing'),
53 53
 		'type'        => 'string',
54
-		'context'     => array( 'view', 'edit', 'embed' ),
54
+		'context'     => array('view', 'edit', 'embed'),
55 55
 		'readonly'    => true,
56 56
 	),
57 57
 
58 58
 	'version'         => array(
59
-		'description' => __( 'Version of GetPaid/Invoicing which last updated the invoice.', 'invoicing' ),
59
+		'description' => __('Version of GetPaid/Invoicing which last updated the invoice.', 'invoicing'),
60 60
 		'type'        => 'integer',
61
-		'context'     => array( 'view', 'edit' ),
61
+		'context'     => array('view', 'edit'),
62 62
 		'readonly'    => true,
63 63
 	),
64 64
 
65 65
 	'template'        => array(
66
-		'description' => __( 'The invoice template.', 'invoicing' ),
66
+		'description' => __('The invoice template.', 'invoicing'),
67 67
 		'type'        => 'string',
68 68
 		'default'     => 'quantity',
69
-		'enum'        => array( 'quantity', 'hours', 'amount' ),
70
-		'context'     => array( 'view', 'edit', 'embed' ),
69
+		'enum'        => array('quantity', 'hours', 'amount'),
70
+		'context'     => array('view', 'edit', 'embed'),
71 71
 	),
72 72
 
73 73
 	'status'          => array(
74
-		'description' => __( 'Invoice status.', 'invoicing' ),
74
+		'description' => __('Invoice status.', 'invoicing'),
75 75
 		'type'        => 'string',
76 76
 		'default'     => 'wpi-pending',
77
-		'enum'        => array_keys( wpinv_get_invoice_statuses( true ) ),
78
-		'context'     => array( 'view', 'edit', 'embed' ),
77
+		'enum'        => array_keys(wpinv_get_invoice_statuses(true)),
78
+		'context'     => array('view', 'edit', 'embed'),
79 79
 	),
80 80
 
81 81
 	'status_nicename' => array(
82
-		'description' => __( 'A human readable name for the invoice status.', 'invoicing' ),
82
+		'description' => __('A human readable name for the invoice status.', 'invoicing'),
83 83
 		'type'        => 'string',
84
-		'context'     => array( 'view', 'edit', 'embed' ),
84
+		'context'     => array('view', 'edit', 'embed'),
85 85
 		'readonly'    => true,
86 86
 	),
87 87
 
88 88
 	'currency'        => array(
89
-		'description' => __( 'The invoice currency in ISO format.', 'invoicing' ),
89
+		'description' => __('The invoice currency in ISO format.', 'invoicing'),
90 90
 		'type'        => 'string',
91 91
 		'default'     => wpinv_get_currency(),
92
-		'enum'        => array_keys( wpinv_get_currencies() ),
93
-		'context'     => array( 'view', 'edit', 'embed' ),
92
+		'enum'        => array_keys(wpinv_get_currencies()),
93
+		'context'     => array('view', 'edit', 'embed'),
94 94
 	),
95 95
 
96 96
 	'date_created'    => array(
97
-		'description' => __( "The date the invoice was created, in the site's timezone.", 'invoicing' ),
97
+		'description' => __("The date the invoice was created, in the site's timezone.", 'invoicing'),
98 98
 		'type'        => 'string',
99
-		'context'     => array( 'view', 'edit', 'embed' ),
99
+		'context'     => array('view', 'edit', 'embed'),
100 100
 	),
101 101
 
102 102
 	'date_created_gmt'    => array(
103
-		'description' => __( 'The GMT date the invoice was created.', 'invoicing' ),
103
+		'description' => __('The GMT date the invoice was created.', 'invoicing'),
104 104
 		'type'        => 'string',
105
-		'context'     => array( 'view', 'edit', 'embed' ),
105
+		'context'     => array('view', 'edit', 'embed'),
106 106
 		'readonly'    => true,
107 107
 	),
108 108
 
109 109
 	'date_modified'   => array(
110
-		'description' => __( "The date the invoice was last modified, in the site's timezone.", 'invoicing' ),
110
+		'description' => __("The date the invoice was last modified, in the site's timezone.", 'invoicing'),
111 111
 		'type'        => 'string',
112
-		'context'     => array( 'view', 'edit', 'embed' ),
112
+		'context'     => array('view', 'edit', 'embed'),
113 113
 		'readonly'    => true,
114 114
 	),
115 115
 
116 116
 	'date_modified_gmt'    => array(
117
-		'description' => __( 'The GMT date the invoice was last modified.', 'invoicing' ),
117
+		'description' => __('The GMT date the invoice was last modified.', 'invoicing'),
118 118
 		'type'        => 'string',
119
-		'context'     => array( 'view', 'edit', 'embed' ),
119
+		'context'     => array('view', 'edit', 'embed'),
120 120
 		'readonly'    => true,
121 121
 	),
122 122
 
123 123
 	'due_date'        => array(
124
-		'description' => __( "The invoice's due date, in the site's timezone.", 'invoicing' ),
124
+		'description' => __("The invoice's due date, in the site's timezone.", 'invoicing'),
125 125
 		'type'        => 'string',
126
-		'context'     => array( 'view', 'edit', 'embed' ),
126
+		'context'     => array('view', 'edit', 'embed'),
127 127
 	),
128 128
 
129 129
 	'due_date_gmt'    => array(
130
-		'description' => __( 'The GMT date the invoice is/was due.', 'invoicing' ),
130
+		'description' => __('The GMT date the invoice is/was due.', 'invoicing'),
131 131
 		'type'        => 'string',
132
-		'context'     => array( 'view', 'edit', 'embed' ),
132
+		'context'     => array('view', 'edit', 'embed'),
133 133
 		'readonly'    => true,
134 134
 	),
135 135
 
136 136
 	'completed_date'  => array(
137
-		'description' => __( "The date the invoice was paid, in the site's timezone.", 'invoicing' ),
137
+		'description' => __("The date the invoice was paid, in the site's timezone.", 'invoicing'),
138 138
 		'type'        => 'string',
139
-		'context'     => array( 'view', 'edit', 'embed' ),
139
+		'context'     => array('view', 'edit', 'embed'),
140 140
 		'readonly'    => true,
141 141
 	),
142 142
 
143 143
 	'completed_date_gmt'    => array(
144
-		'description' => __( 'The GMT date the invoice was paid.', 'invoicing' ),
144
+		'description' => __('The GMT date the invoice was paid.', 'invoicing'),
145 145
 		'type'        => 'string',
146
-		'context'     => array( 'view', 'edit', 'embed' ),
146
+		'context'     => array('view', 'edit', 'embed'),
147 147
 		'readonly'    => true,
148 148
 	),
149 149
 
150 150
 	'total_discount'   => array(
151
-		'description' => __( 'Total discount amount for the invoice.', 'invoicing' ),
151
+		'description' => __('Total discount amount for the invoice.', 'invoicing'),
152 152
 		'type'        => 'number',
153
-		'context'     => array( 'view', 'edit', 'embed' ),
153
+		'context'     => array('view', 'edit', 'embed'),
154 154
 		'readonly'    => true,
155 155
 	),
156 156
 
157 157
 	'total_tax'       => array(
158
-		'description' => __( 'Total tax amount for the invoice.', 'invoicing' ),
158
+		'description' => __('Total tax amount for the invoice.', 'invoicing'),
159 159
 		'type'        => 'number',
160
-		'context'     => array( 'view', 'edit', 'embed' ),
160
+		'context'     => array('view', 'edit', 'embed'),
161 161
 		'readonly'    => true,
162 162
 	),
163 163
 
164 164
 	'total_fees'      => array(
165
-		'description' => __( 'Total fees amount for the invoice.', 'invoicing' ),
165
+		'description' => __('Total fees amount for the invoice.', 'invoicing'),
166 166
 		'type'        => 'number',
167
-		'context'     => array( 'view', 'edit', 'embed' ),
167
+		'context'     => array('view', 'edit', 'embed'),
168 168
 		'readonly'    => true,
169 169
 	),
170 170
 
171 171
 	'subtotal'        => array(
172
-		'description' => __( 'Invoice subtotal.', 'invoicing' ),
172
+		'description' => __('Invoice subtotal.', 'invoicing'),
173 173
 		'type'        => 'number',
174
-		'context'     => array( 'view', 'edit', 'embed' ),
174
+		'context'     => array('view', 'edit', 'embed'),
175 175
 		'readonly'    => true,
176 176
 	),
177 177
 
178 178
 	'total'           => array(
179
-		'description' => __( 'Grand total.', 'invoicing' ),
179
+		'description' => __('Grand total.', 'invoicing'),
180 180
 		'type'        => 'number',
181
-		'context'     => array( 'view', 'edit', 'embed' ),
181
+		'context'     => array('view', 'edit', 'embed'),
182 182
 		'readonly'    => true,
183 183
 	),
184 184
 
185 185
 	'initial_total'   => array(
186
-		'description' => __( 'Initial total (for recurring invoices).', 'invoicing' ),
186
+		'description' => __('Initial total (for recurring invoices).', 'invoicing'),
187 187
 		'type'        => 'number',
188
-		'context'     => array( 'view', 'edit', 'embed' ),
188
+		'context'     => array('view', 'edit', 'embed'),
189 189
 		'readonly'    => true,
190 190
 	),
191 191
 
192 192
 	'recurring_total'  => array(
193
-		'description' => __( 'Recurring total (for recurring invoices).', 'invoicing' ),
193
+		'description' => __('Recurring total (for recurring invoices).', 'invoicing'),
194 194
 		'type'        => 'number',
195
-		'context'     => array( 'view', 'edit', 'embed' ),
195
+		'context'     => array('view', 'edit', 'embed'),
196 196
 		'readonly'    => true,
197 197
 	),
198 198
 
199 199
 	'totals'          => array(
200
-		'description' => __( 'Invoice totals.', 'invoicing' ),
200
+		'description' => __('Invoice totals.', 'invoicing'),
201 201
 		'type'        => 'object',
202
-		'context'     => array( 'view', 'edit', 'embed' ),
202
+		'context'     => array('view', 'edit', 'embed'),
203 203
 		'readonly'    => true,
204 204
 	),
205 205
 
206 206
 	'fees'            => array(
207
-		'description' => __( 'Invoice fees (Name => properties).', 'invoicing' ),
207
+		'description' => __('Invoice fees (Name => properties).', 'invoicing'),
208 208
 		'type'        => 'object',
209
-		'context'     => array( 'view', 'edit', 'embed' ),
209
+		'context'     => array('view', 'edit', 'embed'),
210 210
 		'items'       => array(
211 211
 			'type'                => 'object',
212
-			'required'            => array( 'amount' ),
212
+			'required'            => array('amount'),
213 213
 			'properties'          => array(
214 214
 				'amount'          => array(
215
-					'description' => __( 'Fee amount.', 'invoicing' ),
215
+					'description' => __('Fee amount.', 'invoicing'),
216 216
 					'type'        => 'string',
217
-					'context'     => array( 'view', 'edit', 'embed' ),
217
+					'context'     => array('view', 'edit', 'embed'),
218 218
 				),
219 219
 				'recurring'       => array(
220
-					'description' => __( 'Whether this is a recurring or one-time fee.', 'invoicing' ),
221
-					'type'        => array( 'boolean', 'integer' ),
222
-					'context'     => array( 'view', 'edit', 'embed' ),
220
+					'description' => __('Whether this is a recurring or one-time fee.', 'invoicing'),
221
+					'type'        => array('boolean', 'integer'),
222
+					'context'     => array('view', 'edit', 'embed'),
223 223
 				),
224 224
 			),
225 225
 		),
226 226
 	),
227 227
 
228 228
 	'discounts'       => array(
229
-		'description' => __( 'Invoice discounts (Name => properties).', 'invoicing' ),
229
+		'description' => __('Invoice discounts (Name => properties).', 'invoicing'),
230 230
 		'type'        => 'object',
231
-		'context'     => array( 'view', 'edit', 'embed' ),
231
+		'context'     => array('view', 'edit', 'embed'),
232 232
 		'items'       => array(
233 233
 			'type'                => 'object',
234
-			'required'            => array( 'amount' ),
234
+			'required'            => array('amount'),
235 235
 			'properties'          => array(
236 236
 				'amount'          => array(
237
-					'description' => __( 'Fee amount.', 'invoicing' ),
237
+					'description' => __('Fee amount.', 'invoicing'),
238 238
 					'type'        => 'string',
239
-					'context'     => array( 'view', 'edit', 'embed' ),
239
+					'context'     => array('view', 'edit', 'embed'),
240 240
 				),
241 241
 				'recurring'       => array(
242
-					'description' => __( 'Whether this is a recurring or one-time discount.', 'invoicing' ),
243
-					'type'        => array( 'boolean', 'integer' ),
244
-					'context'     => array( 'view', 'edit', 'embed' ),
242
+					'description' => __('Whether this is a recurring or one-time discount.', 'invoicing'),
243
+					'type'        => array('boolean', 'integer'),
244
+					'context'     => array('view', 'edit', 'embed'),
245 245
 				),
246 246
 			),
247 247
 		),
248 248
 	),
249 249
 
250 250
 	'taxes'           => array(
251
-		'description' => __( 'Invoice taxes (Name => properties).', 'invoicing' ),
251
+		'description' => __('Invoice taxes (Name => properties).', 'invoicing'),
252 252
 		'type'        => 'object',
253
-		'context'     => array( 'view', 'edit', 'embed' ),
253
+		'context'     => array('view', 'edit', 'embed'),
254 254
 		'items'       => array(
255 255
 			'type'                => 'object',
256
-			'required'            => array( 'amount' ),
256
+			'required'            => array('amount'),
257 257
 			'properties'          => array(
258 258
 				'amount'          => array(
259
-					'description' => __( 'Fee amount.', 'invoicing' ),
259
+					'description' => __('Fee amount.', 'invoicing'),
260 260
 					'type'        => 'string',
261
-					'context'     => array( 'view', 'edit', 'embed' ),
261
+					'context'     => array('view', 'edit', 'embed'),
262 262
 				),
263 263
 				'recurring'       => array(
264
-					'description' => __( 'Whether this is a recurring or one-time tax.', 'invoicing' ),
265
-					'type'        => array( 'boolean', 'integer' ),
266
-					'context'     => array( 'view', 'edit', 'embed' ),
264
+					'description' => __('Whether this is a recurring or one-time tax.', 'invoicing'),
265
+					'type'        => array('boolean', 'integer'),
266
+					'context'     => array('view', 'edit', 'embed'),
267 267
 				),
268 268
 			),
269 269
 		),
270 270
 	),
271 271
 
272 272
 	'items'           => array(
273
-		'description' => __( 'Invoice items.', 'invoicing' ),
273
+		'description' => __('Invoice items.', 'invoicing'),
274 274
 		'type'        => 'array',
275
-		'context'     => array( 'view', 'edit', 'embed' ),
275
+		'context'     => array('view', 'edit', 'embed'),
276 276
 		'items'       => array(
277 277
 			'type'                => 'object',
278
-			'required'            => array( 'item_id' ),
278
+			'required'            => array('item_id'),
279 279
 			'properties'          => array(
280 280
 				'item_id'         => array(
281
-					'description' => __( 'Item ID.', 'invoicing' ),
281
+					'description' => __('Item ID.', 'invoicing'),
282 282
 					'type'        => 'integer',
283
-					'context'     => array( 'view', 'edit', 'embed' ),
283
+					'context'     => array('view', 'edit', 'embed'),
284 284
 				),
285 285
 				'item_name'       => array(
286
-					'description' => __( 'Item Name.', 'invoicing' ),
286
+					'description' => __('Item Name.', 'invoicing'),
287 287
 					'type'        => 'string',
288
-					'context'     => array( 'view', 'edit', 'embed' ),
288
+					'context'     => array('view', 'edit', 'embed'),
289 289
 				),
290 290
 				'item_description' => array(
291
-					'description'  => __( 'Item Description.', 'invoicing' ),
291
+					'description'  => __('Item Description.', 'invoicing'),
292 292
 					'type'         => 'string',
293
-					'context'      => array( 'view', 'edit', 'embed' ),
293
+					'context'      => array('view', 'edit', 'embed'),
294 294
 				),
295 295
 				'item_price'      => array(
296
-					'description' => __( 'Item Price.', 'invoicing' ),
296
+					'description' => __('Item Price.', 'invoicing'),
297 297
 					'type'        => 'number',
298
-					'context'     => array( 'view', 'edit', 'embed' ),
298
+					'context'     => array('view', 'edit', 'embed'),
299 299
 				),
300 300
 				'quantity'        => array(
301
-					'description' => __( 'Item Quantity.', 'invoicing' ),
301
+					'description' => __('Item Quantity.', 'invoicing'),
302 302
 					'type'        => 'integer',
303
-					'context'     => array( 'view', 'edit', 'embed' ),
303
+					'context'     => array('view', 'edit', 'embed'),
304 304
 				),
305 305
 				'subtotal'        => array(
306
-					'description' => __( 'Item Subtotal.', 'invoicing' ),
306
+					'description' => __('Item Subtotal.', 'invoicing'),
307 307
 					'type'        => 'number',
308
-					'context'     => array( 'view', 'edit', 'embed' ),
308
+					'context'     => array('view', 'edit', 'embed'),
309 309
 					'readonly'    => true,
310 310
 				),
311 311
 				'meta'            => array(
312
-					'description' => __( 'Item Meta.', 'invoicing' ),
312
+					'description' => __('Item Meta.', 'invoicing'),
313 313
 					'type'        => 'object',
314
-					'context'     => array( 'view', 'edit', 'embed' ),
314
+					'context'     => array('view', 'edit', 'embed'),
315 315
 				),
316 316
 			),
317 317
 		),
318 318
 	),
319 319
 
320 320
 	'mode'			  => array(
321
-		'description' => __( 'The invoice transaction mode.', 'invoicing' ),
321
+		'description' => __('The invoice transaction mode.', 'invoicing'),
322 322
 		'type'        => 'string',
323
-		'context'     => array( 'view', 'edit', 'embed' ),
324
-		'enum'        => array( 'live', 'test' ),
323
+		'context'     => array('view', 'edit', 'embed'),
324
+		'enum'        => array('live', 'test'),
325 325
 		'readonly'    => true,
326 326
 	),
327 327
 	
328 328
 	'discount_code'   => array(
329
-		'description' => __( 'The discount code used on this invoice.', 'invoicing' ),
329
+		'description' => __('The discount code used on this invoice.', 'invoicing'),
330 330
 		'type'        => 'string',
331
-		'context'     => array( 'view', 'edit', 'embed' ),
331
+		'context'     => array('view', 'edit', 'embed'),
332 332
 	),
333 333
 
334 334
 	'gateway'         => array(
335
-		'description' => __( 'The gateway used to pay this invoice.', 'invoicing' ),
335
+		'description' => __('The gateway used to pay this invoice.', 'invoicing'),
336 336
 		'type'        => 'string',
337
-		'context'     => array( 'view', 'edit', 'embed' ),
337
+		'context'     => array('view', 'edit', 'embed'),
338 338
 	),
339 339
 
340 340
 	'gateway_title'   => array(
341
-		'description' => __( 'The title of the gateway used to pay this invoice.', 'invoicing' ),
341
+		'description' => __('The title of the gateway used to pay this invoice.', 'invoicing'),
342 342
 		'type'        => 'string',
343
-		'context'     => array( 'view', 'edit', 'embed' ),
343
+		'context'     => array('view', 'edit', 'embed'),
344 344
 		'readonly'    => true,
345 345
 	),
346 346
 
347 347
 	'transaction_id'  => array(
348
-		'description' => __( 'The transaction id for this invoice.', 'invoicing' ),
348
+		'description' => __('The transaction id for this invoice.', 'invoicing'),
349 349
 		'type'        => 'string',
350
-		'context'     => array( 'view', 'edit', 'embed' ),
350
+		'context'     => array('view', 'edit', 'embed'),
351 351
 	),
352 352
 	
353 353
 	'disable_taxes'   => array(
354
-		'description' => __( 'Whether or not taxes should be disabled for this invoice.', 'invoicing' ),
354
+		'description' => __('Whether or not taxes should be disabled for this invoice.', 'invoicing'),
355 355
 		'type'        => 'boolean ',
356
-		'context'     => array( 'view', 'edit', 'embed' ),
356
+		'context'     => array('view', 'edit', 'embed'),
357 357
 	),
358 358
 
359 359
 	'is_viewed'       => array(
360
-		'description' => __( 'Whether or not this invoice has been viewed by the user.', 'invoicing' ),
360
+		'description' => __('Whether or not this invoice has been viewed by the user.', 'invoicing'),
361 361
 		'type'        => 'boolean ',
362
-		'context'     => array( 'view', 'edit', 'embed' ),
362
+		'context'     => array('view', 'edit', 'embed'),
363 363
 		'readonly'    => true,
364 364
 	),
365 365
 
366 366
 	'email_cc'        => array(
367
-		'description' => __( 'A comma separated list of other emails that should receive communications for this invoice.', 'invoicing' ),
367
+		'description' => __('A comma separated list of other emails that should receive communications for this invoice.', 'invoicing'),
368 368
 		'type'        => 'string ',
369
-		'context'     => array( 'view', 'edit' ),
369
+		'context'     => array('view', 'edit'),
370 370
 	),
371 371
 
372 372
 	'subscription_id' => array(
373
-		'description' => __( 'The ID of the subscription associated with this invoice.', 'invoicing' ),
373
+		'description' => __('The ID of the subscription associated with this invoice.', 'invoicing'),
374 374
 		'type'        => 'string ',
375
-		'context'     => array( 'view', 'edit', 'embed' ),
375
+		'context'     => array('view', 'edit', 'embed'),
376 376
 		'readonly'    => true,
377 377
 	),
378 378
 
379 379
 	'subscription_name' => array(
380
-		'description' => __( 'The name of the subscription associated with this invoice.', 'invoicing' ),
380
+		'description' => __('The name of the subscription associated with this invoice.', 'invoicing'),
381 381
 		'type'        => 'string ',
382
-		'context'     => array( 'view', 'edit', 'embed' ),
382
+		'context'     => array('view', 'edit', 'embed'),
383 383
 		'readonly'    => true,
384 384
 	),
385 385
 
386 386
 	'subscription_name' => array(
387
-		'description' => __( 'The name of the subscription associated with this invoice.', 'invoicing' ),
387
+		'description' => __('The name of the subscription associated with this invoice.', 'invoicing'),
388 388
 		'type'        => 'string ',
389
-		'context'     => array( 'view', 'edit', 'embed' ),
389
+		'context'     => array('view', 'edit', 'embed'),
390 390
 		'readonly'    => true,
391 391
 	),
392 392
 
393 393
 	'is_parent'		  => array(
394
-		'description' => __( 'Whether or not this is a parent invoice.', 'invoicing' ),
394
+		'description' => __('Whether or not this is a parent invoice.', 'invoicing'),
395 395
 		'type'        => 'boolean',
396
-		'context'     => array( 'view', 'edit', 'embed' ),
396
+		'context'     => array('view', 'edit', 'embed'),
397 397
 		'readonly'    => true,
398 398
 	),
399 399
 
400 400
 	'is_renewal'      => array(
401
-		'description' => __( 'Whether or not this is a renewal invoice.', 'invoicing' ),
401
+		'description' => __('Whether or not this is a renewal invoice.', 'invoicing'),
402 402
 		'type'        => 'boolean',
403
-		'context'     => array( 'view', 'edit', 'embed' ),
403
+		'context'     => array('view', 'edit', 'embed'),
404 404
 		'readonly'    => true,
405 405
 	),
406 406
 
407 407
 	'is_recurring'    => array(
408
-		'description' => __( 'Whether or not this is a recurring invoice.', 'invoicing' ),
408
+		'description' => __('Whether or not this is a recurring invoice.', 'invoicing'),
409 409
 		'type'        => 'boolean',
410
-		'context'     => array( 'view', 'edit', 'embed' ),
410
+		'context'     => array('view', 'edit', 'embed'),
411 411
 		'readonly'    => true,
412 412
 	),
413 413
 
414 414
 	'is_free'         => array(
415
-		'description' => __( 'Whether or not this invoice is free.', 'invoicing' ),
415
+		'description' => __('Whether or not this invoice is free.', 'invoicing'),
416 416
 		'type'        => 'boolean',
417
-		'context'     => array( 'view', 'edit', 'embed' ),
417
+		'context'     => array('view', 'edit', 'embed'),
418 418
 		'readonly'    => true,
419 419
 	),
420 420
 
421 421
 	'is_paid'         => array(
422
-		'description' => __( 'Whether or not this invoice has been paid.', 'invoicing' ),
422
+		'description' => __('Whether or not this invoice has been paid.', 'invoicing'),
423 423
 		'type'        => 'boolean',
424
-		'context'     => array( 'view', 'edit', 'embed' ),
424
+		'context'     => array('view', 'edit', 'embed'),
425 425
 		'readonly'    => true,
426 426
 	),
427 427
 
428 428
 	'needs_payment'   => array(
429
-		'description' => __( 'Whether or not this invoice needs payment.', 'invoicing' ),
429
+		'description' => __('Whether or not this invoice needs payment.', 'invoicing'),
430 430
 		'type'        => 'boolean',
431
-		'context'     => array( 'view', 'edit', 'embed' ),
431
+		'context'     => array('view', 'edit', 'embed'),
432 432
 		'readonly'    => true,
433 433
 	),
434 434
 
435 435
 	'is_refunded'     => array(
436
-		'description' => __( 'Whether or not this invoice was refunded.', 'invoicing' ),
436
+		'description' => __('Whether or not this invoice was refunded.', 'invoicing'),
437 437
 		'type'        => 'boolean',
438
-		'context'     => array( 'view', 'edit', 'embed' ),
438
+		'context'     => array('view', 'edit', 'embed'),
439 439
 		'readonly'    => true,
440 440
 	),
441 441
 
442 442
 	'is_due'          => array(
443
-		'description' => __( 'Whether or not this invoice is due.', 'invoicing' ),
443
+		'description' => __('Whether or not this invoice is due.', 'invoicing'),
444 444
 		'type'        => 'boolean',
445
-		'context'     => array( 'view', 'edit', 'embed' ),
445
+		'context'     => array('view', 'edit', 'embed'),
446 446
 		'readonly'    => true,
447 447
 	),
448 448
 
449 449
 	'is_held'         => array(
450
-		'description' => __( 'Whether or not this invoice has been held for payment confirmation.', 'invoicing' ),
450
+		'description' => __('Whether or not this invoice has been held for payment confirmation.', 'invoicing'),
451 451
 		'type'        => 'boolean',
452
-		'context'     => array( 'view', 'edit', 'embed' ),
452
+		'context'     => array('view', 'edit', 'embed'),
453 453
 		'readonly'    => true,
454 454
 	),
455 455
 
456 456
 	'is_draft'        => array(
457
-		'description' => __( 'Whether or not this invoice is marked as draft (cannot be viewed on the frontend).', 'invoicing' ),
457
+		'description' => __('Whether or not this invoice is marked as draft (cannot be viewed on the frontend).', 'invoicing'),
458 458
 		'type'        => 'boolean',
459
-		'context'     => array( 'view', 'edit', 'embed' ),
459
+		'context'     => array('view', 'edit', 'embed'),
460 460
 		'readonly'    => true,
461 461
 	),
462 462
 
463 463
 	'path'			  => array(
464
-		'description' => __( 'The invoice path/slug/name.', 'invoicing' ),
464
+		'description' => __('The invoice path/slug/name.', 'invoicing'),
465 465
 		'type'        => 'string',
466
-		'context'     => array( 'view', 'edit', 'embed' ),
466
+		'context'     => array('view', 'edit', 'embed'),
467 467
 		'readonly'    => true,
468 468
 	),
469 469
 
470 470
 	'description'     => array(
471
-		'description' => __( 'The invoice description.', 'invoicing' ),
471
+		'description' => __('The invoice description.', 'invoicing'),
472 472
 		'type'        => 'string',
473
-		'context'     => array( 'view', 'edit', 'embed' ),
473
+		'context'     => array('view', 'edit', 'embed'),
474 474
 	),
475 475
 
476 476
 	'payment_form'    => array(
477
-		'description' => __( 'The id of the payment form used to pay for this invoice.', 'invoicing' ),
477
+		'description' => __('The id of the payment form used to pay for this invoice.', 'invoicing'),
478 478
 		'type'        => 'integer',
479
-		'context'     => array( 'view', 'edit' ),
479
+		'context'     => array('view', 'edit'),
480 480
 		'readonly'    => true,
481 481
 	),
482 482
 
483 483
 	'submission_id'   => array(
484
-		'description' => __( 'A uniques ID of the submission details used to pay for this invoice.', 'invoicing' ),
484
+		'description' => __('A uniques ID of the submission details used to pay for this invoice.', 'invoicing'),
485 485
 		'type'        => 'string',
486
-		'context'     => array( 'view', 'edit' ),
486
+		'context'     => array('view', 'edit'),
487 487
 		'readonly'    => true,
488 488
 	),
489 489
 
490 490
 	'customer_id'     => array(
491
-		'description' => __( 'The customer id.', 'invoicing' ),
491
+		'description' => __('The customer id.', 'invoicing'),
492 492
 		'type'        => 'integer',
493
-		'context'     => array( 'view', 'edit', 'embed' ),
493
+		'context'     => array('view', 'edit', 'embed'),
494 494
 	),
495 495
 
496 496
 	'customer_ip'     => array(
497
-		'description' => __( "The customer's ip address.", 'invoicing' ),
497
+		'description' => __("The customer's ip address.", 'invoicing'),
498 498
 		'type'        => 'string',
499 499
 		'format'      => 'ip',
500
-		'context'     => array( 'view', 'edit', 'embed' ),
500
+		'context'     => array('view', 'edit', 'embed'),
501 501
 	),
502 502
 
503 503
 	'first_name'     => array(
504
-		'description' => __( "The customer's first name.", 'invoicing' ),
504
+		'description' => __("The customer's first name.", 'invoicing'),
505 505
 		'type'        => 'string',
506
-		'context'     => array( 'view', 'edit', 'embed' ),
506
+		'context'     => array('view', 'edit', 'embed'),
507 507
 	),
508 508
 
509 509
 	'last_name'       => array(
510
-		'description' => __( "The customer's last name.", 'invoicing' ),
510
+		'description' => __("The customer's last name.", 'invoicing'),
511 511
 		'type'        => 'string',
512
-		'context'     => array( 'view', 'edit', 'embed' ),
512
+		'context'     => array('view', 'edit', 'embed'),
513 513
 	),
514 514
 	
515 515
 	'full_name'       => array(
516
-		'description' => __( "The customer's full name.", 'invoicing' ),
516
+		'description' => __("The customer's full name.", 'invoicing'),
517 517
 		'type'        => 'string',
518
-		'context'     => array( 'view', 'edit', 'embed' ),
518
+		'context'     => array('view', 'edit', 'embed'),
519 519
 		'readonly'    => true,
520 520
 	),
521 521
 
522 522
 	'phone_number'    => array(
523
-		'description' => __( "The customer's phone number.", 'invoicing' ),
523
+		'description' => __("The customer's phone number.", 'invoicing'),
524 524
 		'type'        => 'string',
525
-		'context'     => array( 'view', 'edit', 'embed' ),
525
+		'context'     => array('view', 'edit', 'embed'),
526 526
 	),
527 527
 
528 528
 	'email_address'   => array(
529
-		'description' => __( "The customer's email address.", 'invoicing' ),
529
+		'description' => __("The customer's email address.", 'invoicing'),
530 530
 		'type'        => 'string',
531
-		'context'     => array( 'view', 'edit', 'embed' ),
531
+		'context'     => array('view', 'edit', 'embed'),
532 532
 		'readonly'    => true,
533 533
 	),
534 534
 
535 535
 	'customer_country'   => array(
536
-		'description'    => __( "The customer's country.", 'invoicing' ),
536
+		'description'    => __("The customer's country.", 'invoicing'),
537 537
 		'type'           => 'string',
538
-		'context'        => array( 'view', 'edit', 'embed' ),
538
+		'context'        => array('view', 'edit', 'embed'),
539 539
 		'default'        => wpinv_get_default_country(),
540 540
 	),
541 541
 
542 542
 	'customer_state'     => array(
543
-		'description'    => __( "The customer's state.", 'invoicing' ),
543
+		'description'    => __("The customer's state.", 'invoicing'),
544 544
 		'type'           => 'string',
545
-		'context'        => array( 'view', 'edit', 'embed' ),
545
+		'context'        => array('view', 'edit', 'embed'),
546 546
 	),
547 547
 
548 548
 	'customer_city'      => array(
549
-		'description'    => __( "The customer's city.", 'invoicing' ),
549
+		'description'    => __("The customer's city.", 'invoicing'),
550 550
 		'type'           => 'string',
551
-		'context'        => array( 'view', 'edit', 'embed' ),
551
+		'context'        => array('view', 'edit', 'embed'),
552 552
 	),
553 553
 
554 554
 	'customer_zip'       => array(
555
-		'description'    => __( "The customer's zip/postal code.", 'invoicing' ),
555
+		'description'    => __("The customer's zip/postal code.", 'invoicing'),
556 556
 		'type'           => 'string',
557
-		'context'        => array( 'view', 'edit', 'embed' ),
557
+		'context'        => array('view', 'edit', 'embed'),
558 558
 	),
559 559
 
560 560
 	'customer_company'   => array(
561
-		'description'    => __( "The customer's company name.", 'invoicing' ),
561
+		'description'    => __("The customer's company name.", 'invoicing'),
562 562
 		'type'           => 'string',
563
-		'context'        => array( 'view', 'edit', 'embed' ),
563
+		'context'        => array('view', 'edit', 'embed'),
564 564
 	),
565 565
 
566 566
 	'vat_number'         => array(
567
-		'description'    => __( "The customer's VAT number.", 'invoicing' ),
567
+		'description'    => __("The customer's VAT number.", 'invoicing'),
568 568
 		'type'           => 'string',
569
-		'context'        => array( 'view', 'edit', 'embed' ),
569
+		'context'        => array('view', 'edit', 'embed'),
570 570
 	),
571 571
 
572 572
 	'vat_rate'           => array(
573
-		'description'    => __( "The customer's VAT rate.", 'invoicing' ),
573
+		'description'    => __("The customer's VAT rate.", 'invoicing'),
574 574
 		'type'           => 'number',
575
-		'context'        => array( 'view', 'edit', 'embed' ),
575
+		'context'        => array('view', 'edit', 'embed'),
576 576
 		'readonly'       => true,
577 577
 	),
578 578
 
579 579
 	'customer_address'   => array(
580
-		'description'    => __( "The customer's address.", 'invoicing' ),
580
+		'description'    => __("The customer's address.", 'invoicing'),
581 581
 		'type'           => 'string',
582
-		'context'        => array( 'view', 'edit', 'embed' ),
582
+		'context'        => array('view', 'edit', 'embed'),
583 583
 	),
584 584
 
585 585
 	'address_confirmed'  => array(
586
-		'description'    => __( "Whether or not the customer's address is confirmed.", 'invoicing' ),
586
+		'description'    => __("Whether or not the customer's address is confirmed.", 'invoicing'),
587 587
 		'type'           => 'boolean',
588
-		'context'        => array( 'view', 'edit', 'embed' ),
588
+		'context'        => array('view', 'edit', 'embed'),
589 589
 	),
590 590
 
591 591
 	'meta_data'       => array(
592
-		'description' => __( 'Invoice meta data.', 'invoicing' ),
592
+		'description' => __('Invoice meta data.', 'invoicing'),
593 593
 		'type'        => 'array',
594
-		'context'     => array( 'view', 'edit', 'embed' ),
594
+		'context'     => array('view', 'edit', 'embed'),
595 595
 		'items'       => array(
596 596
 			'type'                => 'object',
597 597
 			'properties'          => array(
598 598
 				'id'              => array(
599
-					'description' => __( 'Meta ID.', 'invoicing' ),
599
+					'description' => __('Meta ID.', 'invoicing'),
600 600
 					'type'        => 'string',
601
-					'context'     => array( 'view', 'edit', 'embed' ),
601
+					'context'     => array('view', 'edit', 'embed'),
602 602
 				),
603 603
 				'key'             => array(
604
-					'description' => __( 'Meta key.', 'invoicing' ),
604
+					'description' => __('Meta key.', 'invoicing'),
605 605
 					'type'        => 'string',
606
-					'context'     => array( 'view', 'edit', 'embed' ),
606
+					'context'     => array('view', 'edit', 'embed'),
607 607
 				),
608 608
 				'value'           => array(
609
-					'description' => __( 'Meta Value.', 'invoicing' ),
610
-					'type'        => array( 'string', 'array', 'object', 'integer', 'null' ),
611
-					'context'     => array( 'view', 'edit', 'embed' ),
609
+					'description' => __('Meta Value.', 'invoicing'),
610
+					'type'        => array('string', 'array', 'object', 'integer', 'null'),
611
+					'context'     => array('view', 'edit', 'embed'),
612 612
 				),
613 613
 			),
614 614
 		),
615 615
 	),
616 616
 
617 617
 	'view_url'        => array(
618
-		'description' => __( 'URL to the invoice.', 'invoicing' ),
618
+		'description' => __('URL to the invoice.', 'invoicing'),
619 619
 		'type'        => 'string',
620 620
 		'format'      => 'uri',
621
-		'context'     => array( 'view', 'edit', 'embed' ),
621
+		'context'     => array('view', 'edit', 'embed'),
622 622
 		'readonly'    => true,
623 623
 	),
624 624
 
625 625
 	'checkout_payment_url'         => array(
626
-		'description' => __( 'URL to the invoice checkout page.', 'invoicing' ),
626
+		'description' => __('URL to the invoice checkout page.', 'invoicing'),
627 627
 		'type'        => 'string',
628 628
 		'format'      => 'uri',
629
-		'context'     => array( 'view', 'edit', 'embed' ),
629
+		'context'     => array('view', 'edit', 'embed'),
630 630
 		'readonly'    => true,
631 631
 	),
632 632
 
633 633
 	'receipt_url'     => array(
634
-		'description' => __( 'URL to the invoice receipt page.', 'invoicing' ),
634
+		'description' => __('URL to the invoice receipt page.', 'invoicing'),
635 635
 		'type'        => 'string',
636 636
 		'format'      => 'uri',
637
-		'context'     => array( 'view', 'edit', 'embed' ),
637
+		'context'     => array('view', 'edit', 'embed'),
638 638
 		'readonly'    => true,
639 639
 	),
640 640
 
Please login to merge, or discard this patch.
includes/data/currency-symbols.php 2 patches
Indentation   +162 added lines, -162 removed lines patch added patch discarded remove patch
@@ -11,166 +11,166 @@
 block discarded – undo
11 11
 defined( 'ABSPATH' ) || exit;
12 12
 
13 13
 return array(
14
-	'AED' => '&#x62f;.&#x625;',
15
-	'AFN' => '&#x60b;',
16
-	'ALL' => 'L',
17
-	'AMD' => 'AMD',
18
-	'ANG' => '&fnof;',
19
-	'AOA' => 'Kz',
20
-	'ARS' => '&#36;',
21
-	'AUD' => '&#36;',
22
-	'AWG' => '&fnof;',
23
-	'AZN' => 'AZN',
24
-	'BAM' => 'KM',
25
-	'BBD' => '&#36;',
26
-	'BDT' => '&#2547;',
27
-	'BGN' => '&#1083;&#1074;.',
28
-	'BHD' => '.&#x62f;.&#x628;',
29
-	'BIF' => 'Fr',
30
-	'BMD' => '&#36;',
31
-	'BND' => '&#36;',
32
-	'BOB' => 'Bs.',
33
-	'BRL' => '&#82;&#36;',
34
-	'BSD' => '&#36;',
35
-	'BTC' => '&#3647;',
36
-	'BTN' => 'Nu.',
37
-	'BWP' => 'P',
38
-	'BYN' => 'Br',
39
-	'BZD' => '&#36;',
40
-	'CAD' => '&#36;',
41
-	'CDF' => 'Fr',
42
-	'CHF' => '&#67;&#72;&#70;',
43
-	'CLP' => '&#36;',
44
-	'CNY' => '&yen;',
45
-	'COP' => '&#36;',
46
-	'CRC' => '&#x20a1;',
47
-	'CUC' => '&#36;',
48
-	'CUP' => '&#36;',
49
-	'CVE' => '&#36;',
50
-	'CZK' => '&#75;&#269;',
51
-	'DJF' => 'Fr',
52
-	'DKK' => 'DKK',
53
-	'DOP' => 'RD&#36;',
54
-	'DZD' => '&#x62f;.&#x62c;',
55
-	'EGP' => 'EGP',
56
-	'ERN' => 'Nfk',
57
-	'ETB' => 'Br',
58
-	'EUR' => '&euro;',
59
-	'FJD' => '&#36;',
60
-	'FKP' => '&pound;',
61
-	'GBP' => '&pound;',
62
-	'GEL' => '&#x10da;',
63
-	'GGP' => '&pound;',
64
-	'GHS' => '&#x20b5;',
65
-	'GIP' => '&pound;',
66
-	'GMD' => 'D',
67
-	'GNF' => 'Fr',
68
-	'GTQ' => 'Q',
69
-	'GYD' => '&#36;',
70
-	'HKD' => '&#36;',
71
-	'HNL' => 'L',
72
-	'HRK' => 'Kn',
73
-	'HTG' => 'G',
74
-	'HUF' => '&#70;&#116;',
75
-	'IDR' => 'Rp',
76
-	'ILS' => '&#8362;',
77
-	'IMP' => '&pound;',
78
-	'INR' => '&#8377;',
79
-	'IQD' => '&#x639;.&#x62f;',
80
-	'IRR' => '&#xfdfc;',
81
-	'IRT' => '&#x062A;&#x0648;&#x0645;&#x0627;&#x0646;',
82
-	'ISK' => 'kr.',
83
-	'JEP' => '&pound;',
84
-	'JMD' => '&#36;',
85
-	'JOD' => '&#x62f;.&#x627;',
86
-	'JPY' => '&yen;',
87
-	'KES' => 'KSh',
88
-	'KGS' => '&#x441;&#x43e;&#x43c;',
89
-	'KHR' => '&#x17db;',
90
-	'KMF' => 'Fr',
91
-	'KPW' => '&#x20a9;',
92
-	'KRW' => '&#8361;',
93
-	'KWD' => '&#x62f;.&#x643;',
94
-	'KYD' => '&#36;',
95
-	'KZT' => 'KZT',
96
-	'LAK' => '&#8365;',
97
-	'LBP' => '&#x644;.&#x644;',
98
-	'LKR' => '&#xdbb;&#xdd4;',
99
-	'LRD' => '&#36;',
100
-	'LSL' => 'L',
101
-	'LYD' => '&#x644;.&#x62f;',
102
-	'MAD' => '&#x62f;.&#x645;.',
103
-	'MDL' => 'MDL',
104
-	'MGA' => 'Ar',
105
-	'MKD' => '&#x434;&#x435;&#x43d;',
106
-	'MMK' => 'Ks',
107
-	'MNT' => '&#x20ae;',
108
-	'MOP' => 'P',
109
-	'MRO' => 'UM',
110
-	'MUR' => '&#x20a8;',
111
-	'MVR' => '.&#x783;',
112
-	'MWK' => 'MK',
113
-	'MXN' => '&#36;',
114
-	'MYR' => '&#82;&#77;',
115
-	'MZN' => 'MT',
116
-	'NAD' => '&#36;',
117
-	'NGN' => '&#8358;',
118
-	'NIO' => 'C&#36;',
119
-	'NOK' => '&#107;&#114;',
120
-	'NPR' => '&#8360;',
121
-	'NZD' => '&#36;',
122
-	'OMR' => '&#x631;.&#x639;.',
123
-	'PAB' => 'B/.',
124
-	'PEN' => 'S/.',
125
-	'PGK' => 'K',
126
-	'PHP' => '&#8369;',
127
-	'PKR' => '&#8360;',
128
-	'PLN' => '&#122;&#322;',
129
-	'PRB' => '&#x440;.',
130
-	'PYG' => '&#8370;',
131
-	'QAR' => '&#x631;.&#x642;',
132
-	'RMB' => '&yen;',
133
-	'RON' => 'lei',
134
-	'RSD' => '&#x434;&#x438;&#x43d;.',
135
-	'RUB' => '&#8381;',
136
-	'RWF' => 'Fr',
137
-	'SAR' => '&#x631;.&#x633;',
138
-	'SBD' => '&#36;',
139
-	'SCR' => '&#x20a8;',
140
-	'SDG' => '&#x62c;.&#x633;.',
141
-	'SEK' => '&#107;&#114;',
142
-	'SGD' => '&#36;',
143
-	'SHP' => '&pound;',
144
-	'SLL' => 'Le',
145
-	'SOS' => 'Sh',
146
-	'SRD' => '&#36;',
147
-	'SSP' => '&pound;',
148
-	'STD' => 'Db',
149
-	'SYP' => '&#x644;.&#x633;',
150
-	'SZL' => 'L',
151
-	'THB' => '&#3647;',
152
-	'TJS' => '&#x405;&#x41c;',
153
-	'TMT' => 'm',
154
-	'TND' => '&#x62f;.&#x62a;',
155
-	'TOP' => 'T&#36;',
156
-	'TRY' => '&#8378;',
157
-	'TTD' => '&#36;',
158
-	'TWD' => '&#78;&#84;&#36;',
159
-	'TZS' => 'Sh',
160
-	'UAH' => '&#8372;',
161
-	'UGX' => 'UGX',
162
-	'USD' => '&#36;',
163
-	'UYU' => '&#36;',
164
-	'UZS' => 'UZS',
165
-	'VEF' => 'Bs.',
166
-	'VND' => '&#8363;',
167
-	'VUV' => 'Vt',
168
-	'WST' => 'T',
169
-	'XAF' => 'Fr',
170
-	'XCD' => '&#36;',
171
-	'XOF' => 'Fr',
172
-	'XPF' => 'Fr',
173
-	'YER' => '&#xfdfc;',
174
-	'ZAR' => '&#82;',
175
-	'ZMW' => 'ZK',
14
+    'AED' => '&#x62f;.&#x625;',
15
+    'AFN' => '&#x60b;',
16
+    'ALL' => 'L',
17
+    'AMD' => 'AMD',
18
+    'ANG' => '&fnof;',
19
+    'AOA' => 'Kz',
20
+    'ARS' => '&#36;',
21
+    'AUD' => '&#36;',
22
+    'AWG' => '&fnof;',
23
+    'AZN' => 'AZN',
24
+    'BAM' => 'KM',
25
+    'BBD' => '&#36;',
26
+    'BDT' => '&#2547;',
27
+    'BGN' => '&#1083;&#1074;.',
28
+    'BHD' => '.&#x62f;.&#x628;',
29
+    'BIF' => 'Fr',
30
+    'BMD' => '&#36;',
31
+    'BND' => '&#36;',
32
+    'BOB' => 'Bs.',
33
+    'BRL' => '&#82;&#36;',
34
+    'BSD' => '&#36;',
35
+    'BTC' => '&#3647;',
36
+    'BTN' => 'Nu.',
37
+    'BWP' => 'P',
38
+    'BYN' => 'Br',
39
+    'BZD' => '&#36;',
40
+    'CAD' => '&#36;',
41
+    'CDF' => 'Fr',
42
+    'CHF' => '&#67;&#72;&#70;',
43
+    'CLP' => '&#36;',
44
+    'CNY' => '&yen;',
45
+    'COP' => '&#36;',
46
+    'CRC' => '&#x20a1;',
47
+    'CUC' => '&#36;',
48
+    'CUP' => '&#36;',
49
+    'CVE' => '&#36;',
50
+    'CZK' => '&#75;&#269;',
51
+    'DJF' => 'Fr',
52
+    'DKK' => 'DKK',
53
+    'DOP' => 'RD&#36;',
54
+    'DZD' => '&#x62f;.&#x62c;',
55
+    'EGP' => 'EGP',
56
+    'ERN' => 'Nfk',
57
+    'ETB' => 'Br',
58
+    'EUR' => '&euro;',
59
+    'FJD' => '&#36;',
60
+    'FKP' => '&pound;',
61
+    'GBP' => '&pound;',
62
+    'GEL' => '&#x10da;',
63
+    'GGP' => '&pound;',
64
+    'GHS' => '&#x20b5;',
65
+    'GIP' => '&pound;',
66
+    'GMD' => 'D',
67
+    'GNF' => 'Fr',
68
+    'GTQ' => 'Q',
69
+    'GYD' => '&#36;',
70
+    'HKD' => '&#36;',
71
+    'HNL' => 'L',
72
+    'HRK' => 'Kn',
73
+    'HTG' => 'G',
74
+    'HUF' => '&#70;&#116;',
75
+    'IDR' => 'Rp',
76
+    'ILS' => '&#8362;',
77
+    'IMP' => '&pound;',
78
+    'INR' => '&#8377;',
79
+    'IQD' => '&#x639;.&#x62f;',
80
+    'IRR' => '&#xfdfc;',
81
+    'IRT' => '&#x062A;&#x0648;&#x0645;&#x0627;&#x0646;',
82
+    'ISK' => 'kr.',
83
+    'JEP' => '&pound;',
84
+    'JMD' => '&#36;',
85
+    'JOD' => '&#x62f;.&#x627;',
86
+    'JPY' => '&yen;',
87
+    'KES' => 'KSh',
88
+    'KGS' => '&#x441;&#x43e;&#x43c;',
89
+    'KHR' => '&#x17db;',
90
+    'KMF' => 'Fr',
91
+    'KPW' => '&#x20a9;',
92
+    'KRW' => '&#8361;',
93
+    'KWD' => '&#x62f;.&#x643;',
94
+    'KYD' => '&#36;',
95
+    'KZT' => 'KZT',
96
+    'LAK' => '&#8365;',
97
+    'LBP' => '&#x644;.&#x644;',
98
+    'LKR' => '&#xdbb;&#xdd4;',
99
+    'LRD' => '&#36;',
100
+    'LSL' => 'L',
101
+    'LYD' => '&#x644;.&#x62f;',
102
+    'MAD' => '&#x62f;.&#x645;.',
103
+    'MDL' => 'MDL',
104
+    'MGA' => 'Ar',
105
+    'MKD' => '&#x434;&#x435;&#x43d;',
106
+    'MMK' => 'Ks',
107
+    'MNT' => '&#x20ae;',
108
+    'MOP' => 'P',
109
+    'MRO' => 'UM',
110
+    'MUR' => '&#x20a8;',
111
+    'MVR' => '.&#x783;',
112
+    'MWK' => 'MK',
113
+    'MXN' => '&#36;',
114
+    'MYR' => '&#82;&#77;',
115
+    'MZN' => 'MT',
116
+    'NAD' => '&#36;',
117
+    'NGN' => '&#8358;',
118
+    'NIO' => 'C&#36;',
119
+    'NOK' => '&#107;&#114;',
120
+    'NPR' => '&#8360;',
121
+    'NZD' => '&#36;',
122
+    'OMR' => '&#x631;.&#x639;.',
123
+    'PAB' => 'B/.',
124
+    'PEN' => 'S/.',
125
+    'PGK' => 'K',
126
+    'PHP' => '&#8369;',
127
+    'PKR' => '&#8360;',
128
+    'PLN' => '&#122;&#322;',
129
+    'PRB' => '&#x440;.',
130
+    'PYG' => '&#8370;',
131
+    'QAR' => '&#x631;.&#x642;',
132
+    'RMB' => '&yen;',
133
+    'RON' => 'lei',
134
+    'RSD' => '&#x434;&#x438;&#x43d;.',
135
+    'RUB' => '&#8381;',
136
+    'RWF' => 'Fr',
137
+    'SAR' => '&#x631;.&#x633;',
138
+    'SBD' => '&#36;',
139
+    'SCR' => '&#x20a8;',
140
+    'SDG' => '&#x62c;.&#x633;.',
141
+    'SEK' => '&#107;&#114;',
142
+    'SGD' => '&#36;',
143
+    'SHP' => '&pound;',
144
+    'SLL' => 'Le',
145
+    'SOS' => 'Sh',
146
+    'SRD' => '&#36;',
147
+    'SSP' => '&pound;',
148
+    'STD' => 'Db',
149
+    'SYP' => '&#x644;.&#x633;',
150
+    'SZL' => 'L',
151
+    'THB' => '&#3647;',
152
+    'TJS' => '&#x405;&#x41c;',
153
+    'TMT' => 'm',
154
+    'TND' => '&#x62f;.&#x62a;',
155
+    'TOP' => 'T&#36;',
156
+    'TRY' => '&#8378;',
157
+    'TTD' => '&#36;',
158
+    'TWD' => '&#78;&#84;&#36;',
159
+    'TZS' => 'Sh',
160
+    'UAH' => '&#8372;',
161
+    'UGX' => 'UGX',
162
+    'USD' => '&#36;',
163
+    'UYU' => '&#36;',
164
+    'UZS' => 'UZS',
165
+    'VEF' => 'Bs.',
166
+    'VND' => '&#8363;',
167
+    'VUV' => 'Vt',
168
+    'WST' => 'T',
169
+    'XAF' => 'Fr',
170
+    'XCD' => '&#36;',
171
+    'XOF' => 'Fr',
172
+    'XPF' => 'Fr',
173
+    'YER' => '&#xfdfc;',
174
+    'ZAR' => '&#82;',
175
+    'ZMW' => 'ZK',
176 176
 );
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@
 block discarded – undo
8 8
  * @version 1.0.19
9 9
  */
10 10
 
11
-defined( 'ABSPATH' ) || exit;
11
+defined('ABSPATH') || exit;
12 12
 
13 13
 return array(
14 14
 	'AED' => '&#x62f;.&#x625;',
Please login to merge, or discard this patch.