Passed
Push — master ( 2d8bbf...270aff )
by Brian
05:20 queued 12s
created
includes/class-getpaid-tax.php 2 patches
Indentation   +192 added lines, -192 removed lines patch added patch discarded remove patch
@@ -13,199 +13,199 @@
 block discarded – undo
13 13
  */
14 14
 class GetPaid_Tax {
15 15
 
16
-	/**
17
-	 * Calculates tax for a line item.
18
-	 *
19
-	 * @param  float   $price              The price to calc tax on.
20
-	 * @param  array   $rates              The rates to apply.
21
-	 * @param  boolean $price_includes_tax Whether the passed price has taxes included.
22
-	 * @return array                       Array of tax name => tax amount.
23
-	 */
24
-	public static function calc_tax( $price, $rates, $price_includes_tax = false ) {
25
-
26
-		if ( $price_includes_tax ) {
27
-			$taxes = self::calc_inclusive_tax( $price, $rates );
28
-		} else {
29
-			$taxes = self::calc_exclusive_tax( $price, $rates );
30
-		}
31
-
32
-		return apply_filters( 'getpaid_calc_tax', $taxes, $price, $rates, $price_includes_tax );
33
-
34
-	}
35
-
36
-	/**
37
-	 * Calc tax from inclusive price.
38
-	 *
39
-	 * @param  float $price Price to calculate tax for.
40
-	 * @param  array $rates Array of tax rates.
41
-	 * @return array
42
-	 */
43
-	public static function calc_inclusive_tax( $price, $rates ) {
44
-		$taxes     = array();
45
-		$tax_rates = wp_list_pluck( $rates, 'rate', 'name' );
46
-
47
-		// Add tax rates.
48
-		$tax_rate  = 1 + ( array_sum( $tax_rates ) / 100 );
49
-
50
-		foreach ( $tax_rates as $name => $rate ) {
51
-			$the_rate       = ( $rate / 100 ) / $tax_rate;
52
-			$net_price      = $price - ( $the_rate * $price );
53
-			$tax_amount     = apply_filters( 'getpaid_price_inc_tax_amount', $price - $net_price, $name, $rate, $price );
54
-			$taxes[ $name ] = $tax_amount;
55
-		}
56
-
57
-		// Round all taxes to precision (4DP) before passing them back.
58
-		$taxes = array_map( array( __CLASS__, 'round' ), $taxes );
59
-
60
-		return $taxes;
61
-	}
62
-
63
-	/**
64
-	 * Calc tax from exclusive price.
65
-	 *
66
-	 * @param  float $price Price to calculate tax for.
67
-	 * @param  array $rates Array of tax rates.
68
-	 * @return array
69
-	 */
70
-	public static function calc_exclusive_tax( $price, $rates ) {
71
-		$taxes     = array();
72
-		$tax_rates = wp_list_pluck( $rates, 'rate', 'name' );
73
-
74
-		foreach ( $tax_rates as $name => $rate ) {
75
-
76
-			$tax_amount     = $price * ( $rate / 100 );
77
-			$taxes[ $name ] = apply_filters( 'getpaid_price_ex_tax_amount', $tax_amount, $name, $rate, $price );
78
-
79
-		}
80
-
81
-		// Round all taxes to precision (4DP) before passing them back.
82
-		$taxes = array_map( array( __CLASS__, 'round' ), $taxes );
83
-
84
-		return $taxes;
85
-	}
86
-
87
-	/**
88
-	 * Get's an array of all tax rates.
89
-	 *
90
-	 * @return array
91
-	 */
92
-	public static function get_all_tax_rates() {
93
-
94
-		$rates = get_option( 'wpinv_tax_rates', array() );
95
-
96
-		return apply_filters(
97
-			'getpaid_get_all_tax_rates',
98
-			array_filter( wpinv_parse_list( $rates ) )
99
-		);
100
-
101
-	}
102
-
103
-	/**
104
-	 * Get's an array of default tax rates.
105
-	 *
106
-	 * @return array
107
-	 */
108
-	public static function get_default_tax_rates() {
109
-
110
-		return apply_filters(
111
-			'getpaid_get_default_tax_rates',
112
-			array(
113
-				array(
114
-					'country' => wpinv_get_default_country(),
115
-					'state'   => wpinv_get_default_state(),
116
-					'global'  => true,
117
-					'rate'    => wpinv_get_default_tax_rate(),
118
-					'name'    => __( 'Base Tax', 'invoicing' ),
119
-				),
120
-			)
121
-		);
122
-
123
-	}
124
-
125
-	/**
126
-	 * Get's an array of all tax rules.
127
-	 *
128
-	 * @return array
129
-	 */
130
-	public static function get_all_tax_rules() {
131
-
132
-		$rules = get_option(
133
-			'wpinv_tax_rules',
134
-			array(
135
-				array(
136
-					'key'               => 'physical',
137
-					'label'             => __( 'Physical Item', 'invoicing' ),
138
-					'tax_base'          => wpinv_get_option( 'tax_base', 'billing' ),
139
-					'same_country_rule' => wpinv_get_option( 'vat_same_country_rule', 'vat_too' ),
140
-				),
141
-				array(
142
-					'key'               => 'digital',
143
-					'label'             => __( 'Digital Item', 'invoicing' ),
144
-					'tax_base'          => wpinv_get_option( 'tax_base', 'billing' ),
145
-					'same_country_rule' => wpinv_get_option( 'vat_same_country_rule', 'vat_too' ),
146
-				),
147
-        	)
148
-		);
149
-
150
-		return apply_filters(
151
-			'getpaid_tax_rules',
152
-			array_filter( array_values( wpinv_parse_list( $rules ) ) )
153
-		);
154
-
155
-	}
156
-
157
-	/**
158
-	 * Get's an array of tax rates for a given address.
159
-	 *
160
-	 * @param string $country
161
-	 * @param string $state
162
-	 * @return array
163
-	 */
164
-	public static function get_address_tax_rates( $country, $state ) {
165
-
166
-		$all_tax_rates  = self::get_all_tax_rates();
167
-		$matching_rates = array_merge(
168
-			wp_list_filter( $all_tax_rates, array( 'country' => $country ) ),
169
-			wp_list_filter( $all_tax_rates, array( 'country' => '' ) )
170
-		);
171
-
172
-		foreach ( $matching_rates as $i => $rate ) {
173
-
174
-			$states = array_filter( wpinv_clean( explode( ',', strtolower( $rate['state'] ) ) ) );
175
-			if ( empty( $rate['global'] ) && ! in_array( strtolower( $state ), $states ) ) {
176
-				unset( $matching_rates[ $i ] );
177
-			}
16
+    /**
17
+     * Calculates tax for a line item.
18
+     *
19
+     * @param  float   $price              The price to calc tax on.
20
+     * @param  array   $rates              The rates to apply.
21
+     * @param  boolean $price_includes_tax Whether the passed price has taxes included.
22
+     * @return array                       Array of tax name => tax amount.
23
+     */
24
+    public static function calc_tax( $price, $rates, $price_includes_tax = false ) {
25
+
26
+        if ( $price_includes_tax ) {
27
+            $taxes = self::calc_inclusive_tax( $price, $rates );
28
+        } else {
29
+            $taxes = self::calc_exclusive_tax( $price, $rates );
30
+        }
31
+
32
+        return apply_filters( 'getpaid_calc_tax', $taxes, $price, $rates, $price_includes_tax );
33
+
34
+    }
35
+
36
+    /**
37
+     * Calc tax from inclusive price.
38
+     *
39
+     * @param  float $price Price to calculate tax for.
40
+     * @param  array $rates Array of tax rates.
41
+     * @return array
42
+     */
43
+    public static function calc_inclusive_tax( $price, $rates ) {
44
+        $taxes     = array();
45
+        $tax_rates = wp_list_pluck( $rates, 'rate', 'name' );
46
+
47
+        // Add tax rates.
48
+        $tax_rate  = 1 + ( array_sum( $tax_rates ) / 100 );
49
+
50
+        foreach ( $tax_rates as $name => $rate ) {
51
+            $the_rate       = ( $rate / 100 ) / $tax_rate;
52
+            $net_price      = $price - ( $the_rate * $price );
53
+            $tax_amount     = apply_filters( 'getpaid_price_inc_tax_amount', $price - $net_price, $name, $rate, $price );
54
+            $taxes[ $name ] = $tax_amount;
55
+        }
56
+
57
+        // Round all taxes to precision (4DP) before passing them back.
58
+        $taxes = array_map( array( __CLASS__, 'round' ), $taxes );
59
+
60
+        return $taxes;
61
+    }
62
+
63
+    /**
64
+     * Calc tax from exclusive price.
65
+     *
66
+     * @param  float $price Price to calculate tax for.
67
+     * @param  array $rates Array of tax rates.
68
+     * @return array
69
+     */
70
+    public static function calc_exclusive_tax( $price, $rates ) {
71
+        $taxes     = array();
72
+        $tax_rates = wp_list_pluck( $rates, 'rate', 'name' );
73
+
74
+        foreach ( $tax_rates as $name => $rate ) {
75
+
76
+            $tax_amount     = $price * ( $rate / 100 );
77
+            $taxes[ $name ] = apply_filters( 'getpaid_price_ex_tax_amount', $tax_amount, $name, $rate, $price );
78
+
79
+        }
80
+
81
+        // Round all taxes to precision (4DP) before passing them back.
82
+        $taxes = array_map( array( __CLASS__, 'round' ), $taxes );
83
+
84
+        return $taxes;
85
+    }
86
+
87
+    /**
88
+     * Get's an array of all tax rates.
89
+     *
90
+     * @return array
91
+     */
92
+    public static function get_all_tax_rates() {
93
+
94
+        $rates = get_option( 'wpinv_tax_rates', array() );
95
+
96
+        return apply_filters(
97
+            'getpaid_get_all_tax_rates',
98
+            array_filter( wpinv_parse_list( $rates ) )
99
+        );
100
+
101
+    }
102
+
103
+    /**
104
+     * Get's an array of default tax rates.
105
+     *
106
+     * @return array
107
+     */
108
+    public static function get_default_tax_rates() {
109
+
110
+        return apply_filters(
111
+            'getpaid_get_default_tax_rates',
112
+            array(
113
+                array(
114
+                    'country' => wpinv_get_default_country(),
115
+                    'state'   => wpinv_get_default_state(),
116
+                    'global'  => true,
117
+                    'rate'    => wpinv_get_default_tax_rate(),
118
+                    'name'    => __( 'Base Tax', 'invoicing' ),
119
+                ),
120
+            )
121
+        );
122
+
123
+    }
124
+
125
+    /**
126
+     * Get's an array of all tax rules.
127
+     *
128
+     * @return array
129
+     */
130
+    public static function get_all_tax_rules() {
131
+
132
+        $rules = get_option(
133
+            'wpinv_tax_rules',
134
+            array(
135
+                array(
136
+                    'key'               => 'physical',
137
+                    'label'             => __( 'Physical Item', 'invoicing' ),
138
+                    'tax_base'          => wpinv_get_option( 'tax_base', 'billing' ),
139
+                    'same_country_rule' => wpinv_get_option( 'vat_same_country_rule', 'vat_too' ),
140
+                ),
141
+                array(
142
+                    'key'               => 'digital',
143
+                    'label'             => __( 'Digital Item', 'invoicing' ),
144
+                    'tax_base'          => wpinv_get_option( 'tax_base', 'billing' ),
145
+                    'same_country_rule' => wpinv_get_option( 'vat_same_country_rule', 'vat_too' ),
146
+                ),
147
+            )
148
+        );
149
+
150
+        return apply_filters(
151
+            'getpaid_tax_rules',
152
+            array_filter( array_values( wpinv_parse_list( $rules ) ) )
153
+        );
154
+
155
+    }
156
+
157
+    /**
158
+     * Get's an array of tax rates for a given address.
159
+     *
160
+     * @param string $country
161
+     * @param string $state
162
+     * @return array
163
+     */
164
+    public static function get_address_tax_rates( $country, $state ) {
165
+
166
+        $all_tax_rates  = self::get_all_tax_rates();
167
+        $matching_rates = array_merge(
168
+            wp_list_filter( $all_tax_rates, array( 'country' => $country ) ),
169
+            wp_list_filter( $all_tax_rates, array( 'country' => '' ) )
170
+        );
171
+
172
+        foreach ( $matching_rates as $i => $rate ) {
173
+
174
+            $states = array_filter( wpinv_clean( explode( ',', strtolower( $rate['state'] ) ) ) );
175
+            if ( empty( $rate['global'] ) && ! in_array( strtolower( $state ), $states ) ) {
176
+                unset( $matching_rates[ $i ] );
177
+            }
178 178
 }
179 179
 
180
-		return apply_filters( 'getpaid_get_address_tax_rates', $matching_rates, $country, $state );
181
-
182
-	}
183
-
184
-	/**
185
-	 * Sums a set of taxes to form a single total. Result is rounded to precision.
186
-	 *
187
-	 * @param  array $taxes Array of taxes.
188
-	 * @return float
189
-	 */
190
-	public static function get_tax_total( $taxes ) {
191
-		return self::round( array_sum( $taxes ) );
192
-	}
193
-
194
-	/**
195
-	 * Round to precision.
196
-	 *
197
-	 * Filter example: to return rounding to .5 cents you'd use:
198
-	 *
199
-	 * function euro_5cent_rounding( $in ) {
200
-	 *      return round( $in / 5, 2 ) * 5;
201
-	 * }
202
-	 * add_filter( 'getpaid_tax_round', 'euro_5cent_rounding' );
203
-	 *
204
-	 * @param float|int $in Value to round.
205
-	 * @return float
206
-	 */
207
-	public static function round( $in ) {
208
-		return apply_filters( 'getpaid_tax_round', round( $in, 4 ), $in );
209
-	}
180
+        return apply_filters( 'getpaid_get_address_tax_rates', $matching_rates, $country, $state );
181
+
182
+    }
183
+
184
+    /**
185
+     * Sums a set of taxes to form a single total. Result is rounded to precision.
186
+     *
187
+     * @param  array $taxes Array of taxes.
188
+     * @return float
189
+     */
190
+    public static function get_tax_total( $taxes ) {
191
+        return self::round( array_sum( $taxes ) );
192
+    }
193
+
194
+    /**
195
+     * Round to precision.
196
+     *
197
+     * Filter example: to return rounding to .5 cents you'd use:
198
+     *
199
+     * function euro_5cent_rounding( $in ) {
200
+     *      return round( $in / 5, 2 ) * 5;
201
+     * }
202
+     * add_filter( 'getpaid_tax_round', 'euro_5cent_rounding' );
203
+     *
204
+     * @param float|int $in Value to round.
205
+     * @return float
206
+     */
207
+    public static function round( $in ) {
208
+        return apply_filters( 'getpaid_tax_round', round( $in, 4 ), $in );
209
+    }
210 210
 
211 211
 }
Please login to merge, or discard this patch.
Spacing   +43 added lines, -43 removed lines patch added patch discarded remove patch
@@ -5,7 +5,7 @@  discard block
 block discarded – undo
5 5
  *
6 6
  */
7 7
 
8
-defined( 'ABSPATH' ) || exit;
8
+defined('ABSPATH') || exit;
9 9
 
10 10
 /**
11 11
  * Class GetPaid_Tax
@@ -21,15 +21,15 @@  discard block
 block discarded – undo
21 21
 	 * @param  boolean $price_includes_tax Whether the passed price has taxes included.
22 22
 	 * @return array                       Array of tax name => tax amount.
23 23
 	 */
24
-	public static function calc_tax( $price, $rates, $price_includes_tax = false ) {
24
+	public static function calc_tax($price, $rates, $price_includes_tax = false) {
25 25
 
26
-		if ( $price_includes_tax ) {
27
-			$taxes = self::calc_inclusive_tax( $price, $rates );
26
+		if ($price_includes_tax) {
27
+			$taxes = self::calc_inclusive_tax($price, $rates);
28 28
 		} else {
29
-			$taxes = self::calc_exclusive_tax( $price, $rates );
29
+			$taxes = self::calc_exclusive_tax($price, $rates);
30 30
 		}
31 31
 
32
-		return apply_filters( 'getpaid_calc_tax', $taxes, $price, $rates, $price_includes_tax );
32
+		return apply_filters('getpaid_calc_tax', $taxes, $price, $rates, $price_includes_tax);
33 33
 
34 34
 	}
35 35
 
@@ -40,22 +40,22 @@  discard block
 block discarded – undo
40 40
 	 * @param  array $rates Array of tax rates.
41 41
 	 * @return array
42 42
 	 */
43
-	public static function calc_inclusive_tax( $price, $rates ) {
43
+	public static function calc_inclusive_tax($price, $rates) {
44 44
 		$taxes     = array();
45
-		$tax_rates = wp_list_pluck( $rates, 'rate', 'name' );
45
+		$tax_rates = wp_list_pluck($rates, 'rate', 'name');
46 46
 
47 47
 		// Add tax rates.
48
-		$tax_rate  = 1 + ( array_sum( $tax_rates ) / 100 );
48
+		$tax_rate  = 1 + (array_sum($tax_rates) / 100);
49 49
 
50
-		foreach ( $tax_rates as $name => $rate ) {
51
-			$the_rate       = ( $rate / 100 ) / $tax_rate;
52
-			$net_price      = $price - ( $the_rate * $price );
53
-			$tax_amount     = apply_filters( 'getpaid_price_inc_tax_amount', $price - $net_price, $name, $rate, $price );
54
-			$taxes[ $name ] = $tax_amount;
50
+		foreach ($tax_rates as $name => $rate) {
51
+			$the_rate       = ($rate / 100) / $tax_rate;
52
+			$net_price      = $price - ($the_rate * $price);
53
+			$tax_amount     = apply_filters('getpaid_price_inc_tax_amount', $price - $net_price, $name, $rate, $price);
54
+			$taxes[$name] = $tax_amount;
55 55
 		}
56 56
 
57 57
 		// Round all taxes to precision (4DP) before passing them back.
58
-		$taxes = array_map( array( __CLASS__, 'round' ), $taxes );
58
+		$taxes = array_map(array(__CLASS__, 'round'), $taxes);
59 59
 
60 60
 		return $taxes;
61 61
 	}
@@ -67,19 +67,19 @@  discard block
 block discarded – undo
67 67
 	 * @param  array $rates Array of tax rates.
68 68
 	 * @return array
69 69
 	 */
70
-	public static function calc_exclusive_tax( $price, $rates ) {
70
+	public static function calc_exclusive_tax($price, $rates) {
71 71
 		$taxes     = array();
72
-		$tax_rates = wp_list_pluck( $rates, 'rate', 'name' );
72
+		$tax_rates = wp_list_pluck($rates, 'rate', 'name');
73 73
 
74
-		foreach ( $tax_rates as $name => $rate ) {
74
+		foreach ($tax_rates as $name => $rate) {
75 75
 
76
-			$tax_amount     = $price * ( $rate / 100 );
77
-			$taxes[ $name ] = apply_filters( 'getpaid_price_ex_tax_amount', $tax_amount, $name, $rate, $price );
76
+			$tax_amount     = $price * ($rate / 100);
77
+			$taxes[$name] = apply_filters('getpaid_price_ex_tax_amount', $tax_amount, $name, $rate, $price);
78 78
 
79 79
 		}
80 80
 
81 81
 		// Round all taxes to precision (4DP) before passing them back.
82
-		$taxes = array_map( array( __CLASS__, 'round' ), $taxes );
82
+		$taxes = array_map(array(__CLASS__, 'round'), $taxes);
83 83
 
84 84
 		return $taxes;
85 85
 	}
@@ -91,11 +91,11 @@  discard block
 block discarded – undo
91 91
 	 */
92 92
 	public static function get_all_tax_rates() {
93 93
 
94
-		$rates = get_option( 'wpinv_tax_rates', array() );
94
+		$rates = get_option('wpinv_tax_rates', array());
95 95
 
96 96
 		return apply_filters(
97 97
 			'getpaid_get_all_tax_rates',
98
-			array_filter( wpinv_parse_list( $rates ) )
98
+			array_filter(wpinv_parse_list($rates))
99 99
 		);
100 100
 
101 101
 	}
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
 					'state'   => wpinv_get_default_state(),
116 116
 					'global'  => true,
117 117
 					'rate'    => wpinv_get_default_tax_rate(),
118
-					'name'    => __( 'Base Tax', 'invoicing' ),
118
+					'name'    => __('Base Tax', 'invoicing'),
119 119
 				),
120 120
 			)
121 121
 		);
@@ -134,22 +134,22 @@  discard block
 block discarded – undo
134 134
 			array(
135 135
 				array(
136 136
 					'key'               => 'physical',
137
-					'label'             => __( 'Physical Item', 'invoicing' ),
138
-					'tax_base'          => wpinv_get_option( 'tax_base', 'billing' ),
139
-					'same_country_rule' => wpinv_get_option( 'vat_same_country_rule', 'vat_too' ),
137
+					'label'             => __('Physical Item', 'invoicing'),
138
+					'tax_base'          => wpinv_get_option('tax_base', 'billing'),
139
+					'same_country_rule' => wpinv_get_option('vat_same_country_rule', 'vat_too'),
140 140
 				),
141 141
 				array(
142 142
 					'key'               => 'digital',
143
-					'label'             => __( 'Digital Item', 'invoicing' ),
144
-					'tax_base'          => wpinv_get_option( 'tax_base', 'billing' ),
145
-					'same_country_rule' => wpinv_get_option( 'vat_same_country_rule', 'vat_too' ),
143
+					'label'             => __('Digital Item', 'invoicing'),
144
+					'tax_base'          => wpinv_get_option('tax_base', 'billing'),
145
+					'same_country_rule' => wpinv_get_option('vat_same_country_rule', 'vat_too'),
146 146
 				),
147 147
         	)
148 148
 		);
149 149
 
150 150
 		return apply_filters(
151 151
 			'getpaid_tax_rules',
152
-			array_filter( array_values( wpinv_parse_list( $rules ) ) )
152
+			array_filter(array_values(wpinv_parse_list($rules)))
153 153
 		);
154 154
 
155 155
 	}
@@ -161,23 +161,23 @@  discard block
 block discarded – undo
161 161
 	 * @param string $state
162 162
 	 * @return array
163 163
 	 */
164
-	public static function get_address_tax_rates( $country, $state ) {
164
+	public static function get_address_tax_rates($country, $state) {
165 165
 
166 166
 		$all_tax_rates  = self::get_all_tax_rates();
167 167
 		$matching_rates = array_merge(
168
-			wp_list_filter( $all_tax_rates, array( 'country' => $country ) ),
169
-			wp_list_filter( $all_tax_rates, array( 'country' => '' ) )
168
+			wp_list_filter($all_tax_rates, array('country' => $country)),
169
+			wp_list_filter($all_tax_rates, array('country' => ''))
170 170
 		);
171 171
 
172
-		foreach ( $matching_rates as $i => $rate ) {
172
+		foreach ($matching_rates as $i => $rate) {
173 173
 
174
-			$states = array_filter( wpinv_clean( explode( ',', strtolower( $rate['state'] ) ) ) );
175
-			if ( empty( $rate['global'] ) && ! in_array( strtolower( $state ), $states ) ) {
176
-				unset( $matching_rates[ $i ] );
174
+			$states = array_filter(wpinv_clean(explode(',', strtolower($rate['state']))));
175
+			if (empty($rate['global']) && !in_array(strtolower($state), $states)) {
176
+				unset($matching_rates[$i]);
177 177
 			}
178 178
 }
179 179
 
180
-		return apply_filters( 'getpaid_get_address_tax_rates', $matching_rates, $country, $state );
180
+		return apply_filters('getpaid_get_address_tax_rates', $matching_rates, $country, $state);
181 181
 
182 182
 	}
183 183
 
@@ -187,8 +187,8 @@  discard block
 block discarded – undo
187 187
 	 * @param  array $taxes Array of taxes.
188 188
 	 * @return float
189 189
 	 */
190
-	public static function get_tax_total( $taxes ) {
191
-		return self::round( array_sum( $taxes ) );
190
+	public static function get_tax_total($taxes) {
191
+		return self::round(array_sum($taxes));
192 192
 	}
193 193
 
194 194
 	/**
@@ -204,8 +204,8 @@  discard block
 block discarded – undo
204 204
 	 * @param float|int $in Value to round.
205 205
 	 * @return float
206 206
 	 */
207
-	public static function round( $in ) {
208
-		return apply_filters( 'getpaid_tax_round', round( $in, 4 ), $in );
207
+	public static function round($in) {
208
+		return apply_filters('getpaid_tax_round', round($in, 4), $in);
209 209
 	}
210 210
 
211 211
 }
Please login to merge, or discard this patch.
includes/wpinv-tax-functions.php 1 patch
Spacing   +130 added lines, -130 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
  * Returns an array of eu states.
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
  * @return array
13 13
  */
14 14
 function getpaid_get_eu_states() {
15
-    return wpinv_get_data( 'eu-states' );
15
+    return wpinv_get_data('eu-states');
16 16
 }
17 17
 
18 18
 /**
@@ -20,8 +20,8 @@  discard block
 block discarded – undo
20 20
  *
21 21
  * @return bool
22 22
  */
23
-function getpaid_is_eu_state( $country ) {
24
-    return ! empty( $country ) && in_array( strtoupper( $country ), getpaid_get_eu_states() ) ? true : false;
23
+function getpaid_is_eu_state($country) {
24
+    return !empty($country) && in_array(strtoupper($country), getpaid_get_eu_states()) ? true : false;
25 25
 }
26 26
 
27 27
 /**
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
  * @return array
31 31
  */
32 32
 function getpaid_get_gst_states() {
33
-    return array( 'AU', 'NZ', 'CA', 'CN' );
33
+    return array('AU', 'NZ', 'CA', 'CN');
34 34
 }
35 35
 
36 36
 /**
@@ -38,8 +38,8 @@  discard block
 block discarded – undo
38 38
  *
39 39
  * @return bool
40 40
  */
41
-function getpaid_is_gst_country( $country ) {
42
-    return ! empty( $country ) && in_array( strtoupper( $country ), getpaid_get_gst_states() ) ? true : false;
41
+function getpaid_is_gst_country($country) {
42
+    return !empty($country) && in_array(strtoupper($country), getpaid_get_gst_states()) ? true : false;
43 43
 }
44 44
 
45 45
 /**
@@ -49,8 +49,8 @@  discard block
 block discarded – undo
49 49
  */
50 50
 function wpinv_use_taxes() {
51 51
 
52
-    $ret = wpinv_get_option( 'enable_taxes', false );
53
-    return (bool) apply_filters( 'wpinv_use_taxes', ! empty( $ret ) );
52
+    $ret = wpinv_get_option('enable_taxes', false);
53
+    return (bool) apply_filters('wpinv_use_taxes', !empty($ret));
54 54
 
55 55
 }
56 56
 
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
  * @param WPInv_Invoice $invoice
61 61
  * @return bool
62 62
  */
63
-function wpinv_is_invoice_taxable( $invoice ) {
63
+function wpinv_is_invoice_taxable($invoice) {
64 64
     return $invoice->is_taxable();
65 65
 }
66 66
 
@@ -70,11 +70,11 @@  discard block
 block discarded – undo
70 70
  * @param string $country
71 71
  * @return bool
72 72
  */
73
-function wpinv_is_country_taxable( $country ) {
74
-    $is_eu     = getpaid_is_eu_state( $country );
75
-    $is_exempt = ! $is_eu && wpinv_is_base_country( $country ) && wpinv_same_country_exempt_vat();
73
+function wpinv_is_country_taxable($country) {
74
+    $is_eu     = getpaid_is_eu_state($country);
75
+    $is_exempt = !$is_eu && wpinv_is_base_country($country) && wpinv_same_country_exempt_vat();
76 76
 
77
-    return (bool) apply_filters( 'wpinv_is_country_taxable', ! $is_exempt, $country );
77
+    return (bool) apply_filters('wpinv_is_country_taxable', !$is_exempt, $country);
78 78
 
79 79
 }
80 80
 
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
  * @param WPInv_Item|GetPaid_Form_Item $item
85 85
  * @return bool
86 86
  */
87
-function wpinv_is_item_taxable( $item ) {
87
+function wpinv_is_item_taxable($item) {
88 88
     return '_exempt' != $item->get_vat_rule();
89 89
 }
90 90
 
@@ -93,15 +93,15 @@  discard block
 block discarded – undo
93 93
  *
94 94
  * @return bool
95 95
  */
96
-function wpinv_use_store_address_as_tax_base( $tax_rule = false ) {
97
-    $use_base = wpinv_get_option( 'tax_base', 'billing' ) === 'base';
96
+function wpinv_use_store_address_as_tax_base($tax_rule = false) {
97
+    $use_base = wpinv_get_option('tax_base', 'billing') === 'base';
98 98
 
99
-    if ( $tax_rule ) {
100
-        $rules    = getpaid_get_tax_rules( 'tax_base' );
101
-        $use_base = isset( $rules[ $tax_rule ] ) ? 'base' === $rules[ $tax_rule ] : $use_base;
99
+    if ($tax_rule) {
100
+        $rules    = getpaid_get_tax_rules('tax_base');
101
+        $use_base = isset($rules[$tax_rule]) ? 'base' === $rules[$tax_rule] : $use_base;
102 102
     }
103 103
 
104
-    return (bool) apply_filters( 'wpinv_use_store_address_as_tax_base', $use_base, $tax_rule );
104
+    return (bool) apply_filters('wpinv_use_store_address_as_tax_base', $use_base, $tax_rule);
105 105
 }
106 106
 
107 107
 /**
@@ -109,15 +109,15 @@  discard block
 block discarded – undo
109 109
  *
110 110
  * @return bool
111 111
  */
112
-function wpinv_get_vat_same_country_rule( $tax_rule = false ) {
113
-    $rule = wpinv_get_option( 'vat_same_country_rule', 'vat_too' );
112
+function wpinv_get_vat_same_country_rule($tax_rule = false) {
113
+    $rule = wpinv_get_option('vat_same_country_rule', 'vat_too');
114 114
 
115
-    if ( $tax_rule ) {
116
-        $rules = getpaid_get_tax_rules( 'same_country_rule' );
117
-        $rule  = isset( $rules[ $tax_rule ] ) ? $rules[ $tax_rule ] : $rule;
115
+    if ($tax_rule) {
116
+        $rules = getpaid_get_tax_rules('same_country_rule');
117
+        $rule  = isset($rules[$tax_rule]) ? $rules[$tax_rule] : $rule;
118 118
     }
119 119
 
120
-    return (bool) apply_filters( 'wpinv_get_vat_same_country_rule', $rule, $tax_rule );
120
+    return (bool) apply_filters('wpinv_get_vat_same_country_rule', $rule, $tax_rule);
121 121
 }
122 122
 
123 123
 /**
@@ -126,8 +126,8 @@  discard block
 block discarded – undo
126 126
  * @return bool
127 127
  */
128 128
 function wpinv_prices_include_tax() {
129
-    $is_inclusive = wpinv_get_option( 'prices_include_tax', 'no' ) == 'yes';
130
-    return (bool) apply_filters( 'wpinv_prices_include_tax', $is_inclusive );
129
+    $is_inclusive = wpinv_get_option('prices_include_tax', 'no') == 'yes';
130
+    return (bool) apply_filters('wpinv_prices_include_tax', $is_inclusive);
131 131
 }
132 132
 
133 133
 /**
@@ -136,8 +136,8 @@  discard block
 block discarded – undo
136 136
  * @return bool
137 137
  */
138 138
 function wpinv_round_tax_per_tax_rate() {
139
-    $subtotal_rounding = wpinv_get_option( 'tax_subtotal_rounding', 1 );
140
-    return (bool) apply_filters( 'wpinv_round_tax_per_tax_rate', empty( $subtotal_rounding ) );
139
+    $subtotal_rounding = wpinv_get_option('tax_subtotal_rounding', 1);
140
+    return (bool) apply_filters('wpinv_round_tax_per_tax_rate', empty($subtotal_rounding));
141 141
 }
142 142
 
143 143
 /**
@@ -146,8 +146,8 @@  discard block
 block discarded – undo
146 146
  * @return bool
147 147
  */
148 148
 function wpinv_display_individual_tax_rates() {
149
-    $individual = wpinv_get_option( 'tax_display_totals', 'single' ) == 'individual';
150
-    return (bool) apply_filters( 'wpinv_display_individual_tax_rates', $individual );
149
+    $individual = wpinv_get_option('tax_display_totals', 'single') == 'individual';
150
+    return (bool) apply_filters('wpinv_display_individual_tax_rates', $individual);
151 151
 }
152 152
 
153 153
 /**
@@ -156,8 +156,8 @@  discard block
 block discarded – undo
156 156
  * @return float
157 157
  */
158 158
 function wpinv_get_default_tax_rate() {
159
-    $rate = wpinv_get_option( 'tax_rate', 0 );
160
-    return (float) apply_filters( 'wpinv_get_default_tax_rate', floatval( $rate ) );
159
+    $rate = wpinv_get_option('tax_rate', 0);
160
+    return (float) apply_filters('wpinv_get_default_tax_rate', floatval($rate));
161 161
 }
162 162
 
163 163
 /**
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
  * @return bool
167 167
  */
168 168
 function wpinv_same_country_exempt_vat() {
169
-    return 'no' == wpinv_get_option( 'vat_same_country_rule', 'vat_too' );
169
+    return 'no' == wpinv_get_option('vat_same_country_rule', 'vat_too');
170 170
 }
171 171
 
172 172
 /**
@@ -186,28 +186,28 @@  discard block
 block discarded – undo
186 186
  * @param string $state
187 187
  * @return array
188 188
  */
189
-function getpaid_get_item_tax_rates( $item, $country = '', $state = '' ) {
189
+function getpaid_get_item_tax_rates($item, $country = '', $state = '') {
190 190
 
191 191
     // Abort if the item is not taxable.
192
-    if ( ! wpinv_is_item_taxable( $item ) ) {
192
+    if (!wpinv_is_item_taxable($item)) {
193 193
         return array();
194 194
     }
195 195
 
196 196
     // Maybe use the store address.
197
-    if ( wpinv_use_store_address_as_tax_base( $item->get_vat_rule() ) ) {
197
+    if (wpinv_use_store_address_as_tax_base($item->get_vat_rule())) {
198 198
         $country = wpinv_get_default_country();
199 199
         $state   = wpinv_get_default_state();
200 200
     }
201 201
 
202 202
     // Retrieve tax rates.
203
-    $tax_rates = GetPaid_Tax::get_address_tax_rates( $country, $state );
203
+    $tax_rates = GetPaid_Tax::get_address_tax_rates($country, $state);
204 204
 
205 205
     // Fallback to the default tax rates if non were found.
206
-    if ( empty( $tax_rates ) ) {
206
+    if (empty($tax_rates)) {
207 207
         $tax_rates = GetPaid_Tax::get_default_tax_rates();
208 208
     }
209 209
 
210
-    return apply_filters( 'getpaid_get_item_tax_rates', $tax_rates, $item, $country, $state );
210
+    return apply_filters('getpaid_get_item_tax_rates', $tax_rates, $item, $country, $state);
211 211
 }
212 212
 
213 213
 /**
@@ -217,22 +217,22 @@  discard block
 block discarded – undo
217 217
  * @param array $rates
218 218
  * @return array
219 219
  */
220
-function getpaid_filter_item_tax_rates( $item, $rates ) {
220
+function getpaid_filter_item_tax_rates($item, $rates) {
221 221
 
222 222
     $tax_class = $item->get_vat_class();
223 223
 
224
-    foreach ( $rates as $i => $rate ) {
224
+    foreach ($rates as $i => $rate) {
225 225
 
226
-        if ( $tax_class == '_reduced' ) {
227
-            $rates[ $i ]['rate'] = empty( $rate['reduced_rate'] ) ? 0 : $rate['reduced_rate'];
226
+        if ($tax_class == '_reduced') {
227
+            $rates[$i]['rate'] = empty($rate['reduced_rate']) ? 0 : $rate['reduced_rate'];
228 228
         }
229 229
 
230
-        if ( $tax_class == '_exempt' ) {
231
-            $rates[ $i ]['rate'] = 0;
230
+        if ($tax_class == '_exempt') {
231
+            $rates[$i]['rate'] = 0;
232 232
         }
233 233
 }
234 234
 
235
-    return apply_filters( 'getpaid_filter_item_tax_rates', $rates, $item );
235
+    return apply_filters('getpaid_filter_item_tax_rates', $rates, $item);
236 236
 }
237 237
 
238 238
 /**
@@ -242,12 +242,12 @@  discard block
 block discarded – undo
242 242
  * @param array $rates
243 243
  * @return array
244 244
  */
245
-function getpaid_calculate_item_taxes( $amount, $rates ) {
245
+function getpaid_calculate_item_taxes($amount, $rates) {
246 246
 
247 247
     $is_inclusive = wpinv_prices_include_tax();
248
-    $taxes        = GetPaid_Tax::calc_tax( $amount, $rates, $is_inclusive );
248
+    $taxes        = GetPaid_Tax::calc_tax($amount, $rates, $is_inclusive);
249 249
 
250
-    return apply_filters( 'getpaid_calculate_taxes', $taxes, $amount, $rates );
250
+    return apply_filters('getpaid_calculate_taxes', $taxes, $amount, $rates);
251 251
 }
252 252
 
253 253
 /**
@@ -259,17 +259,17 @@  discard block
 block discarded – undo
259 259
  * @param float $recurring_tax_amount
260 260
  * @return array
261 261
  */
262
-function getpaid_prepare_item_tax( $item, $tax_name, $tax_amount, $recurring_tax_amount ) {
262
+function getpaid_prepare_item_tax($item, $tax_name, $tax_amount, $recurring_tax_amount) {
263 263
 
264
-    $initial_tax   = $tax_amount;
264
+    $initial_tax = $tax_amount;
265 265
 	$recurring_tax = 0;
266 266
 
267
-    if ( $item->is_recurring() ) {
267
+    if ($item->is_recurring()) {
268 268
 		$recurring_tax = $recurring_tax_amount;
269 269
 	}
270 270
 
271 271
 	return array(
272
-		'name'          => sanitize_text_field( $tax_name ),
272
+		'name'          => sanitize_text_field($tax_name),
273 273
 		'initial_tax'   => $initial_tax,
274 274
 		'recurring_tax' => $recurring_tax,
275 275
     );
@@ -282,8 +282,8 @@  discard block
 block discarded – undo
282 282
  * @param string $vat_number
283 283
  * @return string
284 284
  */
285
-function wpinv_sanitize_vat_number( $vat_number ) {
286
-    return str_replace( array( ' ', '.', '-', '_', ',' ), '', strtoupper( trim( $vat_number ) ) );
285
+function wpinv_sanitize_vat_number($vat_number) {
286
+    return str_replace(array(' ', '.', '-', '_', ','), '', strtoupper(trim($vat_number)));
287 287
 }
288 288
 
289 289
 /**
@@ -292,22 +292,22 @@  discard block
 block discarded – undo
292 292
  * @param string $vat_number
293 293
  * @return bool
294 294
  */
295
-function wpinv_regex_validate_vat_number( $vat_number ) {
295
+function wpinv_regex_validate_vat_number($vat_number) {
296 296
 
297
-    $country    = substr( $vat_number, 0, 2 );
298
-    $vatin      = substr( $vat_number, 2 );
299
-    $regexes    = wpinv_get_data( 'vat-number-regexes' );
297
+    $country    = substr($vat_number, 0, 2);
298
+    $vatin      = substr($vat_number, 2);
299
+    $regexes    = wpinv_get_data('vat-number-regexes');
300 300
 
301
-    if ( isset( $regexes[ $country ] ) ) {
301
+    if (isset($regexes[$country])) {
302 302
 
303
-        $regex = $regexes[ $country ];
303
+        $regex = $regexes[$country];
304 304
         $regex = '/^(?:' . $regex . ')$/';
305
-        return 1 === preg_match( $regex, $vatin );
305
+        return 1 === preg_match($regex, $vatin);
306 306
 
307 307
     }
308 308
 
309 309
     // Not an EU state, use filters to validate the number.
310
-    return apply_filters( 'wpinv_regex_validate_vat_number', true, $vat_number );
310
+    return apply_filters('wpinv_regex_validate_vat_number', true, $vat_number);
311 311
 }
312 312
 
313 313
 /**
@@ -316,29 +316,29 @@  discard block
 block discarded – undo
316 316
  * @param string $vat_number
317 317
  * @return bool
318 318
  */
319
-function wpinv_vies_validate_vat_number( $vat_number ) {
319
+function wpinv_vies_validate_vat_number($vat_number) {
320 320
 
321
-    $country    = substr( $vat_number, 0, 2 );
322
-    $vatin      = substr( $vat_number, 2 );
321
+    $country    = substr($vat_number, 0, 2);
322
+    $vatin      = substr($vat_number, 2);
323 323
 
324 324
     $url        = add_query_arg(
325 325
         array(
326
-            'ms'  => urlencode( $country ),
327
-            'iso' => urlencode( $country ),
328
-            'vat' => urlencode( $vatin ),
326
+            'ms'  => urlencode($country),
327
+            'iso' => urlencode($country),
328
+            'vat' => urlencode($vatin),
329 329
         ),
330 330
         'http://ec.europa.eu/taxation_customs/vies/viesquer.do'
331 331
     );
332 332
 
333
-    $response   = wp_remote_get( $url );
334
-    $response   = wp_remote_retrieve_body( $response );
333
+    $response   = wp_remote_get($url);
334
+    $response   = wp_remote_retrieve_body($response);
335 335
 
336 336
     // Fallback gracefully if the VIES website is down.
337
-    if ( empty( $response ) ) {
337
+    if (empty($response)) {
338 338
         return true;
339 339
     }
340 340
 
341
-    return 1 !== preg_match( '/invalid VAT number/i', $response );
341
+    return 1 !== preg_match('/invalid VAT number/i', $response);
342 342
 
343 343
 }
344 344
 
@@ -349,18 +349,18 @@  discard block
 block discarded – undo
349 349
  * @param string $country
350 350
  * @return bool
351 351
  */
352
-function wpinv_validate_vat_number( $vat_number, $country ) {
352
+function wpinv_validate_vat_number($vat_number, $country) {
353 353
 
354 354
     // In case the vat number does not have a country code...
355
-    $vat_number = wpinv_sanitize_vat_number( $vat_number );
356
-    $_country   = substr( $vat_number, 0, 2 );
357
-    $_country   = $_country == wpinv_country_name( $_country );
355
+    $vat_number = wpinv_sanitize_vat_number($vat_number);
356
+    $_country   = substr($vat_number, 0, 2);
357
+    $_country   = $_country == wpinv_country_name($_country);
358 358
 
359
-    if ( $_country ) {
360
-        $vat_number = strtoupper( $country ) . $vat_number;
359
+    if ($_country) {
360
+        $vat_number = strtoupper($country) . $vat_number;
361 361
     }
362 362
 
363
-    return wpinv_regex_validate_vat_number( $vat_number ) && wpinv_vies_validate_vat_number( $vat_number );
363
+    return wpinv_regex_validate_vat_number($vat_number) && wpinv_vies_validate_vat_number($vat_number);
364 364
 }
365 365
 
366 366
 /**
@@ -369,39 +369,39 @@  discard block
 block discarded – undo
369 369
  * @return bool
370 370
  */
371 371
 function wpinv_should_validate_vat_number() {
372
-    $validate = wpinv_get_option( 'validate_vat_number' );
373
-	return ! empty( $validate );
372
+    $validate = wpinv_get_option('validate_vat_number');
373
+	return !empty($validate);
374 374
 }
375 375
 
376
-function wpinv_sales_tax_for_year( $year = null ) {
377
-    return wpinv_price( wpinv_get_sales_tax_for_year( $year ) );
376
+function wpinv_sales_tax_for_year($year = null) {
377
+    return wpinv_price(wpinv_get_sales_tax_for_year($year));
378 378
 }
379 379
 
380
-function wpinv_get_sales_tax_for_year( $year = null ) {
380
+function wpinv_get_sales_tax_for_year($year = null) {
381 381
     global $wpdb;
382 382
 
383 383
     // Start at zero
384 384
     $tax = 0;
385 385
 
386
-    if ( ! empty( $year ) ) {
386
+    if (!empty($year)) {
387 387
         $args = array(
388 388
             'post_type'      => 'wpi_invoice',
389
-            'post_status'    => array( 'publish' ),
389
+            'post_status'    => array('publish'),
390 390
             'posts_per_page' => -1,
391 391
             'year'           => $year,
392 392
             'fields'         => 'ids',
393 393
         );
394 394
 
395
-        $payments    = get_posts( $args );
396
-        $payment_ids = implode( ',', $payments );
395
+        $payments    = get_posts($args);
396
+        $payment_ids = implode(',', $payments);
397 397
 
398
-        if ( count( $payments ) > 0 ) {
398
+        if (count($payments) > 0) {
399 399
             $sql = "SELECT SUM( meta_value ) FROM $wpdb->postmeta WHERE meta_key = '_wpinv_tax' AND post_id IN( $payment_ids )";
400
-            $tax = $wpdb->get_var( $sql );
400
+            $tax = $wpdb->get_var($sql);
401 401
         }
402 402
 }
403 403
 
404
-    return apply_filters( 'wpinv_get_sales_tax_for_year', $tax, $year );
404
+    return apply_filters('wpinv_get_sales_tax_for_year', $tax, $year);
405 405
 }
406 406
 
407 407
 function wpinv_is_cart_taxed() {
@@ -410,34 +410,34 @@  discard block
 block discarded – undo
410 410
 
411 411
 function wpinv_prices_show_tax_on_checkout() {
412 412
     return false; // TODO
413
-    $ret = ( wpinv_get_option( 'checkout_include_tax', false ) == 'yes' && wpinv_use_taxes() );
413
+    $ret = (wpinv_get_option('checkout_include_tax', false) == 'yes' && wpinv_use_taxes());
414 414
 
415
-    return apply_filters( 'wpinv_taxes_on_prices_on_checkout', $ret );
415
+    return apply_filters('wpinv_taxes_on_prices_on_checkout', $ret);
416 416
 }
417 417
 
418 418
 function wpinv_display_tax_rate() {
419
-    $ret = wpinv_use_taxes() && wpinv_get_option( 'display_tax_rate', false );
419
+    $ret = wpinv_use_taxes() && wpinv_get_option('display_tax_rate', false);
420 420
 
421
-    return apply_filters( 'wpinv_display_tax_rate', $ret );
421
+    return apply_filters('wpinv_display_tax_rate', $ret);
422 422
 }
423 423
 
424 424
 function wpinv_cart_needs_tax_address_fields() {
425
-    if ( ! wpinv_is_cart_taxed() ) {
425
+    if (!wpinv_is_cart_taxed()) {
426 426
         return false;
427 427
     }
428 428
 
429
-    return ! did_action( 'wpinv_after_cc_fields', 'wpinv_default_cc_address_fields' );
429
+    return !did_action('wpinv_after_cc_fields', 'wpinv_default_cc_address_fields');
430 430
 }
431 431
 
432
-function wpinv_item_is_tax_exclusive( $item_id = 0 ) {
433
-    $ret = (bool)get_post_meta( $item_id, '_wpinv_tax_exclusive', false );
434
-    return apply_filters( 'wpinv_is_tax_exclusive', $ret, $item_id );
432
+function wpinv_item_is_tax_exclusive($item_id = 0) {
433
+    $ret = (bool) get_post_meta($item_id, '_wpinv_tax_exclusive', false);
434
+    return apply_filters('wpinv_is_tax_exclusive', $ret, $item_id);
435 435
 }
436 436
 
437
-function wpinv_currency_decimal_filter( $decimals = 2 ) {
437
+function wpinv_currency_decimal_filter($decimals = 2) {
438 438
     $currency = wpinv_get_currency();
439 439
 
440
-    switch ( $currency ) {
440
+    switch ($currency) {
441 441
         case 'RIAL':
442 442
         case 'JPY':
443 443
         case 'TWD':
@@ -446,13 +446,13 @@  discard block
 block discarded – undo
446 446
             break;
447 447
     }
448 448
 
449
-    return apply_filters( 'wpinv_currency_decimal_count', $decimals, $currency );
449
+    return apply_filters('wpinv_currency_decimal_count', $decimals, $currency);
450 450
 }
451 451
 
452 452
 function wpinv_tax_amount() {
453 453
     $output = 0.00;
454 454
 
455
-    return apply_filters( 'wpinv_tax_amount', $output );
455
+    return apply_filters('wpinv_tax_amount', $output);
456 456
 }
457 457
 
458 458
 /**
@@ -460,25 +460,25 @@  discard block
 block discarded – undo
460 460
  *
461 461
  * @param string|bool|null $vat_rule
462 462
  */
463
-function getpaid_filter_vat_rule( $vat_rule ) {
463
+function getpaid_filter_vat_rule($vat_rule) {
464 464
 
465
-    if ( empty( $vat_rule ) ) {
465
+    if (empty($vat_rule)) {
466 466
         return 'digital';
467 467
     }
468 468
 
469 469
     return $vat_rule;
470 470
 }
471
-add_filter( 'wpinv_get_item_vat_rule', 'getpaid_filter_vat_rule' );
471
+add_filter('wpinv_get_item_vat_rule', 'getpaid_filter_vat_rule');
472 472
 
473 473
 /**
474 474
  * Filters the VAT class to ensure that each item has a VAT class.
475 475
  *
476 476
  * @param string|bool|null $vat_rule
477 477
  */
478
-function getpaid_filter_vat_class( $vat_class ) {
479
-    return empty( $vat_class ) ? '_standard' : $vat_class;
478
+function getpaid_filter_vat_class($vat_class) {
479
+    return empty($vat_class) ? '_standard' : $vat_class;
480 480
 }
481
-add_filter( 'wpinv_get_item_vat_class', 'getpaid_filter_vat_class' );
481
+add_filter('wpinv_get_item_vat_class', 'getpaid_filter_vat_class');
482 482
 
483 483
 /**
484 484
  * Returns a list of all tax classes.
@@ -490,9 +490,9 @@  discard block
 block discarded – undo
490 490
     return apply_filters(
491 491
         'getpaid_tax_classes',
492 492
         array(
493
-            '_standard' => __( 'Standard Tax Rate', 'invoicing' ),
494
-            '_reduced'  => __( 'Reduced Tax Rate', 'invoicing' ),
495
-            '_exempt'   => __( 'Tax Exempt', 'invoicing' ),
493
+            '_standard' => __('Standard Tax Rate', 'invoicing'),
494
+            '_reduced'  => __('Reduced Tax Rate', 'invoicing'),
495
+            '_exempt'   => __('Tax Exempt', 'invoicing'),
496 496
         )
497 497
     );
498 498
 
@@ -503,8 +503,8 @@  discard block
 block discarded – undo
503 503
  *
504 504
  * @return array
505 505
  */
506
-function getpaid_get_tax_rules( $return = 'label' ) {
507
-    return wp_list_pluck( GetPaid_Tax::get_all_tax_rules(), $return, 'key' );
506
+function getpaid_get_tax_rules($return = 'label') {
507
+    return wp_list_pluck(GetPaid_Tax::get_all_tax_rules(), $return, 'key');
508 508
 }
509 509
 
510 510
 /**
@@ -513,15 +513,15 @@  discard block
 block discarded – undo
513 513
  * @param string $tax_class
514 514
  * @return string
515 515
  */
516
-function getpaid_get_tax_class_label( $tax_class ) {
516
+function getpaid_get_tax_class_label($tax_class) {
517 517
 
518 518
     $classes = getpaid_get_tax_classes();
519 519
 
520
-    if ( isset( $classes[ $tax_class ] ) ) {
521
-        return sanitize_text_field( $classes[ $tax_class ] );
520
+    if (isset($classes[$tax_class])) {
521
+        return sanitize_text_field($classes[$tax_class]);
522 522
     }
523 523
 
524
-    return sanitize_text_field( $tax_class );
524
+    return sanitize_text_field($tax_class);
525 525
 
526 526
 }
527 527
 
@@ -531,15 +531,15 @@  discard block
 block discarded – undo
531 531
  * @param string $tax_rule
532 532
  * @return string
533 533
  */
534
-function getpaid_get_tax_rule_label( $tax_rule ) {
534
+function getpaid_get_tax_rule_label($tax_rule) {
535 535
 
536 536
     $rules = getpaid_get_tax_rules();
537 537
 
538
-    if ( isset( $rules[ $tax_rule ] ) ) {
539
-        return sanitize_text_field( $rules[ $tax_rule ] );
538
+    if (isset($rules[$tax_rule])) {
539
+        return sanitize_text_field($rules[$tax_rule]);
540 540
     }
541 541
 
542
-    return sanitize_text_field( $tax_rule );
542
+    return sanitize_text_field($tax_rule);
543 543
 
544 544
 }
545 545
 
@@ -550,11 +550,11 @@  discard block
 block discarded – undo
550 550
  * @param string $recurring
551 551
  * @return string
552 552
  */
553
-function getpaid_get_taxable_amount( $item, $recurring = false ) {
553
+function getpaid_get_taxable_amount($item, $recurring = false) {
554 554
 
555 555
     $taxable_amount  = $recurring ? $item->get_recurring_sub_total() : $item->get_sub_total();
556 556
     $taxable_amount -= $recurring ? $item->recurring_item_discount : $item->item_discount;
557
-    $taxable_amount  = max( 0, $taxable_amount );
558
-    return apply_filters( 'getpaid_taxable_amount', $taxable_amount, $item, $recurring );
557
+    $taxable_amount  = max(0, $taxable_amount);
558
+    return apply_filters('getpaid_taxable_amount', $taxable_amount, $item, $recurring);
559 559
 
560 560
 }
Please login to merge, or discard this patch.
includes/data/admin-settings.php 1 patch
Spacing   +174 added lines, -174 removed lines patch added patch discarded remove patch
@@ -8,40 +8,40 @@  discard block
 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
 $getpaid_pages = GetPaid_Installer::get_pages();
14
-$pages         = wpinv_get_pages( true );
14
+$pages         = wpinv_get_pages(true);
15 15
 
16 16
 $currencies = wpinv_get_currencies();
17 17
 
18 18
 $currency_code_options = array();
19
-foreach ( $currencies as $code => $name ) {
20
-    $currency_code_options[ $code ] = $code . ' - ' . $name . ' (' . wpinv_currency_symbol( $code ) . ')';
19
+foreach ($currencies as $code => $name) {
20
+    $currency_code_options[$code] = $code . ' - ' . $name . ' (' . wpinv_currency_symbol($code) . ')';
21 21
 }
22 22
 
23 23
 $invoice_number_padd_options = array();
24
-for ( $i = 0; $i <= 20; $i++ ) {
25
-    $invoice_number_padd_options[ $i ] = $i;
24
+for ($i = 0; $i <= 20; $i++) {
25
+    $invoice_number_padd_options[$i] = $i;
26 26
 }
27 27
 
28 28
 $currency_symbol = wpinv_currency_symbol();
29 29
 
30 30
 $last_number = $reset_number = '';
31
-if ( $last_invoice_number = get_option( 'wpinv_last_invoice_number' ) ) {
32
-    $last_invoice_number = preg_replace( '/[^0-9]/', '', $last_invoice_number );
31
+if ($last_invoice_number = get_option('wpinv_last_invoice_number')) {
32
+    $last_invoice_number = preg_replace('/[^0-9]/', '', $last_invoice_number);
33 33
 
34
-    if ( ! empty( $last_invoice_number ) ) {
35
-        $last_number = ' ' . wp_sprintf( __( "( Last Invoice's sequential number: <b>%s</b> )", 'invoicing' ), $last_invoice_number );
34
+    if (!empty($last_invoice_number)) {
35
+        $last_number = ' ' . wp_sprintf(__("( Last Invoice's sequential number: <b>%s</b> )", 'invoicing'), $last_invoice_number);
36 36
     }
37 37
 
38
-    $nonce = wp_create_nonce( 'reset_invoice_count' );
38
+    $nonce = wp_create_nonce('reset_invoice_count');
39 39
     $reset_number = '<a href="' . add_query_arg(
40 40
         array(
41 41
 			'reset_invoice_count' => 1,
42 42
 			'_nonce'              => $nonce,
43 43
         )
44
-    ) . '" class="btn button">' . __( 'Force Reset Sequence', 'invoicing' ) . '</a>';
44
+    ) . '" class="btn button">' . __('Force Reset Sequence', 'invoicing') . '</a>';
45 45
 }
46 46
 
47 47
 $alert_wrapper_start = '<p style="color: #F00">';
@@ -54,59 +54,59 @@  discard block
 block discarded – undo
54 54
             'main'             => array(
55 55
                 'location_settings' => array(
56 56
                     'id'   => 'location_settings',
57
-                    'name' => '<h3>' . __( 'Default Location', 'invoicing' ) . '</h3>',
57
+                    'name' => '<h3>' . __('Default Location', 'invoicing') . '</h3>',
58 58
                     'desc' => '',
59 59
                     'type' => 'header',
60 60
                 ),
61 61
                 'default_country'   => array(
62 62
                     'id'          => 'default_country',
63
-                    'name'        => __( 'Default Country', 'invoicing' ),
64
-                    'desc'        => __( 'Where does your store operate from?', 'invoicing' ),
63
+                    'name'        => __('Default Country', 'invoicing'),
64
+                    'desc'        => __('Where does your store operate from?', 'invoicing'),
65 65
                     'type'        => 'select',
66 66
                     'options'     => wpinv_get_country_list(),
67 67
                     'std'         => 'GB',
68 68
                     'class'       => 'wpi_select2',
69
-                    'placeholder' => __( 'Select a country', 'invoicing' ),
69
+                    'placeholder' => __('Select a country', 'invoicing'),
70 70
                 ),
71 71
                 'default_state'     => array(
72 72
                     'id'          => 'default_state',
73
-                    'name'        => __( 'Default State / Province', 'invoicing' ),
74
-                    'desc'        => __( 'What state / province does your store operate from?', 'invoicing' ),
73
+                    'name'        => __('Default State / Province', 'invoicing'),
74
+                    'desc'        => __('What state / province does your store operate from?', 'invoicing'),
75 75
                     'type'        => 'country_states',
76 76
                     'class'       => 'wpi_select2',
77
-                    'placeholder' => __( 'Select a state', 'invoicing' ),
77
+                    'placeholder' => __('Select a state', 'invoicing'),
78 78
                 ),
79 79
                 'store_name'        => array(
80 80
                     'id'   => 'store_name',
81
-                    'name' => __( 'Store Name', 'invoicing' ),
82
-                    'desc' => __( 'Store name to print on invoices.', 'invoicing' ),
83
-                    'std'  => get_option( 'blogname' ),
81
+                    'name' => __('Store Name', 'invoicing'),
82
+                    'desc' => __('Store name to print on invoices.', 'invoicing'),
83
+                    'std'  => get_option('blogname'),
84 84
                     'type' => 'text',
85 85
                 ),
86 86
                 'logo'              => array(
87 87
                     'id'   => 'logo',
88
-                    'name' => __( 'Logo URL', 'invoicing' ),
89
-                    'desc' => __( 'Store logo to print on invoices.', 'invoicing' ),
88
+                    'name' => __('Logo URL', 'invoicing'),
89
+                    'desc' => __('Store logo to print on invoices.', 'invoicing'),
90 90
                     'type' => 'text',
91 91
                 ),
92 92
                 'logo_width'        => array(
93 93
                     'id'          => 'logo_width',
94
-                    'name'        => __( 'Logo width', 'invoicing' ),
95
-                    'desc'        => __( 'Logo width to use in invoice image.', 'invoicing' ),
94
+                    'name'        => __('Logo width', 'invoicing'),
95
+                    'desc'        => __('Logo width to use in invoice image.', 'invoicing'),
96 96
                     'type'        => 'number',
97
-                    'placeholder' => __( 'Auto', 'invoicing' ),
97
+                    'placeholder' => __('Auto', 'invoicing'),
98 98
                 ),
99 99
                 'logo_height'       => array(
100 100
                     'id'          => 'logo_height',
101
-                    'name'        => __( 'Logo height', 'invoicing' ),
102
-                    'desc'        => __( 'Logo height to use in invoice image.', 'invoicing' ),
101
+                    'name'        => __('Logo height', 'invoicing'),
102
+                    'desc'        => __('Logo height to use in invoice image.', 'invoicing'),
103 103
                     'type'        => 'number',
104
-                    'placeholder' => __( 'Auto', 'invoicing' ),
104
+                    'placeholder' => __('Auto', 'invoicing'),
105 105
                 ),
106 106
                 'store_address'     => array(
107 107
                     'id'   => 'store_address',
108
-                    'name' => __( 'Store Address', 'invoicing' ),
109
-                    'desc' => __( 'Enter the store address to display on invoice', 'invoicing' ),
108
+                    'name' => __('Store Address', 'invoicing'),
109
+                    'desc' => __('Enter the store address to display on invoice', 'invoicing'),
110 110
                     'type' => 'textarea',
111 111
                 ),
112 112
 
@@ -114,114 +114,114 @@  discard block
 block discarded – undo
114 114
             'page_section'     => array(
115 115
                 'page_settings'             => array(
116 116
                     'id'   => 'page_settings',
117
-                    'name' => '<h3>' . __( 'Page Settings', 'invoicing' ) . '</h3>',
117
+                    'name' => '<h3>' . __('Page Settings', 'invoicing') . '</h3>',
118 118
                     'desc' => '',
119 119
                     'type' => 'header',
120 120
                 ),
121 121
                 'checkout_page'             => array(
122 122
                     'id'              => 'checkout_page',
123
-                    'name'            => __( 'Checkout Page', 'invoicing' ),
124
-                    'desc'            => __( 'This is the checkout page where buyers will complete their payments. The <b>[wpinv_checkout]</b> short code must be on this page.', 'invoicing' ),
123
+                    'name'            => __('Checkout Page', 'invoicing'),
124
+                    'desc'            => __('This is the checkout page where buyers will complete their payments. The <b>[wpinv_checkout]</b> short code must be on this page.', 'invoicing'),
125 125
                     'type'            => 'select',
126 126
                     'options'         => $pages,
127 127
                     'class'           => 'wpi_select2',
128
-                    'placeholder'     => __( 'Select a page', 'invoicing' ),
129
-                    'default_content' => empty( $getpaid_pages['checkout_page'] ) ? '' : $getpaid_pages['checkout_page']['content'],
128
+                    'placeholder'     => __('Select a page', 'invoicing'),
129
+                    'default_content' => empty($getpaid_pages['checkout_page']) ? '' : $getpaid_pages['checkout_page']['content'],
130 130
                     'help-tip'        => true,
131 131
                 ),
132 132
                 'success_page'              => array(
133 133
                     'id'              => 'success_page',
134
-                    'name'            => __( 'Success Page', 'invoicing' ),
135
-                    'desc'            => __( 'This is the page buyers are sent to after completing their payments. The <b>[wpinv_receipt]</b> short code should be on this page.', 'invoicing' ),
134
+                    'name'            => __('Success Page', 'invoicing'),
135
+                    'desc'            => __('This is the page buyers are sent to after completing their payments. The <b>[wpinv_receipt]</b> short code should be on this page.', 'invoicing'),
136 136
                     'type'            => 'select',
137 137
                     'options'         => $pages,
138 138
                     'class'           => 'wpi_select2',
139
-                    'placeholder'     => __( 'Select a page', 'invoicing' ),
140
-                    'default_content' => empty( $getpaid_pages['success_page'] ) ? '' : $getpaid_pages['success_page']['content'],
139
+                    'placeholder'     => __('Select a page', 'invoicing'),
140
+                    'default_content' => empty($getpaid_pages['success_page']) ? '' : $getpaid_pages['success_page']['content'],
141 141
                     'help-tip'        => true,
142 142
                 ),
143 143
                 'failure_page'              => array(
144 144
                     'id'              => 'failure_page',
145
-                    'name'            => __( 'Failed Transaction Page', 'invoicing' ),
146
-                    'desc'            => __( 'This is the page buyers are sent to if their transaction is cancelled or fails.', 'invoicing' ),
145
+                    'name'            => __('Failed Transaction Page', 'invoicing'),
146
+                    'desc'            => __('This is the page buyers are sent to if their transaction is cancelled or fails.', 'invoicing'),
147 147
                     'type'            => 'select',
148 148
                     'options'         => $pages,
149 149
                     'class'           => 'wpi_select2',
150
-                    'placeholder'     => __( 'Select a page', 'invoicing' ),
151
-                    'default_content' => empty( $getpaid_pages['failure_page'] ) ? '' : $getpaid_pages['failure_page']['content'],
150
+                    'placeholder'     => __('Select a page', 'invoicing'),
151
+                    'default_content' => empty($getpaid_pages['failure_page']) ? '' : $getpaid_pages['failure_page']['content'],
152 152
                     'help-tip'        => true,
153 153
                 ),
154 154
                 'invoice_history_page'      => array(
155 155
                     'id'              => 'invoice_history_page',
156
-                    'name'            => __( 'Invoice History Page', 'invoicing' ),
157
-                    'desc'            => __( 'This page shows an invoice history for the current user. The <b>[wpinv_history]</b> short code should be on this page.', 'invoicing' ),
156
+                    'name'            => __('Invoice History Page', 'invoicing'),
157
+                    'desc'            => __('This page shows an invoice history for the current user. The <b>[wpinv_history]</b> short code should be on this page.', 'invoicing'),
158 158
                     'type'            => 'select',
159 159
                     'options'         => $pages,
160 160
                     'class'           => 'wpi_select2',
161
-                    'placeholder'     => __( 'Select a page', 'invoicing' ),
162
-                    'default_content' => empty( $getpaid_pages['invoice_history_page'] ) ? '' : $getpaid_pages['invoice_history_page']['content'],
161
+                    'placeholder'     => __('Select a page', 'invoicing'),
162
+                    'default_content' => empty($getpaid_pages['invoice_history_page']) ? '' : $getpaid_pages['invoice_history_page']['content'],
163 163
                     'help-tip'        => true,
164 164
                 ),
165 165
                 'invoice_subscription_page' => array(
166 166
                     'id'              => 'invoice_subscription_page',
167
-                    'name'            => __( 'Invoice Subscriptions Page', 'invoicing' ),
168
-                    'desc'            => __( 'This page shows subscriptions history for the current user. The <b>[wpinv_subscriptions]</b> short code should be on this page.', 'invoicing' ),
167
+                    'name'            => __('Invoice Subscriptions Page', 'invoicing'),
168
+                    'desc'            => __('This page shows subscriptions history for the current user. The <b>[wpinv_subscriptions]</b> short code should be on this page.', 'invoicing'),
169 169
                     'type'            => 'select',
170 170
                     'options'         => $pages,
171 171
                     'class'           => 'wpi_select2',
172
-                    'placeholder'     => __( 'Select a page', 'invoicing' ),
173
-                    'default_content' => empty( $getpaid_pages['invoice_subscription_page'] ) ? '' : $getpaid_pages['invoice_subscription_page']['content'],
172
+                    'placeholder'     => __('Select a page', 'invoicing'),
173
+                    'default_content' => empty($getpaid_pages['invoice_subscription_page']) ? '' : $getpaid_pages['invoice_subscription_page']['content'],
174 174
                     'help-tip'        => true,
175 175
                 ),
176 176
             ),
177 177
             'currency_section' => array(
178 178
                 'currency_settings'   => array(
179 179
                     'id'   => 'currency_settings',
180
-                    'name' => '<h3>' . __( 'Currency Settings', 'invoicing' ) . '</h3>',
180
+                    'name' => '<h3>' . __('Currency Settings', 'invoicing') . '</h3>',
181 181
                     'desc' => '',
182 182
                     'type' => 'header',
183 183
                 ),
184 184
                 'currency'            => array(
185 185
                     'id'      => 'currency',
186
-                    'name'    => __( 'Currency', 'invoicing' ),
187
-                    'desc'    => __( 'Choose your currency. Note that some payment gateways have currency restrictions.', 'invoicing' ),
186
+                    'name'    => __('Currency', 'invoicing'),
187
+                    'desc'    => __('Choose your currency. Note that some payment gateways have currency restrictions.', 'invoicing'),
188 188
                     'type'    => 'select',
189 189
                     'class'   => 'wpi_select2',
190 190
                     'options' => $currency_code_options,
191 191
                 ),
192 192
                 'currency_position'   => array(
193 193
                     'id'      => 'currency_position',
194
-                    'name'    => __( 'Currency Position', 'invoicing' ),
195
-                    'desc'    => __( 'Choose the location of the currency sign.', 'invoicing' ),
194
+                    'name'    => __('Currency Position', 'invoicing'),
195
+                    'desc'    => __('Choose the location of the currency sign.', 'invoicing'),
196 196
                     'type'    => 'select',
197 197
                     'class'   => 'wpi_select2',
198 198
                     'options' => array(
199
-                        'left'        => __( 'Left', 'invoicing' ) . ' (' . $currency_symbol . wpinv_format_amount( '99.99' ) . ')',
200
-                        'right'       => __( 'Right', 'invoicing' ) . ' (' . wpinv_format_amount( '99.99' ) . $currency_symbol . ')',
201
-                        'left_space'  => __( 'Left with space', 'invoicing' ) . ' (' . $currency_symbol . ' ' . wpinv_format_amount( '99.99' ) . ')',
202
-                        'right_space' => __( 'Right with space', 'invoicing' ) . ' (' . wpinv_format_amount( '99.99' ) . ' ' . $currency_symbol . ')',
199
+                        'left'        => __('Left', 'invoicing') . ' (' . $currency_symbol . wpinv_format_amount('99.99') . ')',
200
+                        'right'       => __('Right', 'invoicing') . ' (' . wpinv_format_amount('99.99') . $currency_symbol . ')',
201
+                        'left_space'  => __('Left with space', 'invoicing') . ' (' . $currency_symbol . ' ' . wpinv_format_amount('99.99') . ')',
202
+                        'right_space' => __('Right with space', 'invoicing') . ' (' . wpinv_format_amount('99.99') . ' ' . $currency_symbol . ')',
203 203
                     ),
204 204
                 ),
205 205
                 'thousands_separator' => array(
206 206
                     'id'   => 'thousands_separator',
207
-                    'name' => __( 'Thousands Separator', 'invoicing' ),
208
-                    'desc' => __( 'The symbol (usually , or .) to separate thousands', 'invoicing' ),
207
+                    'name' => __('Thousands Separator', 'invoicing'),
208
+                    'desc' => __('The symbol (usually , or .) to separate thousands', 'invoicing'),
209 209
                     'type' => 'text',
210 210
                     'size' => 'small',
211 211
                     'std'  => ',',
212 212
                 ),
213 213
                 'decimal_separator'   => array(
214 214
                     'id'   => 'decimal_separator',
215
-                    'name' => __( 'Decimal Separator', 'invoicing' ),
216
-                    'desc' => __( 'The symbol (usually , or .) to separate decimal points', 'invoicing' ),
215
+                    'name' => __('Decimal Separator', 'invoicing'),
216
+                    'desc' => __('The symbol (usually , or .) to separate decimal points', 'invoicing'),
217 217
                     'type' => 'text',
218 218
                     'size' => 'small',
219 219
                     'std'  => '.',
220 220
                 ),
221 221
                 'decimals'            => array(
222 222
                     'id'   => 'decimals',
223
-                    'name' => __( 'Number of Decimals', 'invoicing' ),
224
-                    'desc' => __( 'This sets the number of decimal points shown in displayed prices.', 'invoicing' ),
223
+                    'name' => __('Number of Decimals', 'invoicing'),
224
+                    'desc' => __('This sets the number of decimal points shown in displayed prices.', 'invoicing'),
225 225
                     'type' => 'number',
226 226
                     'size' => 'small',
227 227
                     'std'  => '2',
@@ -233,21 +233,21 @@  discard block
 block discarded – undo
233 233
             'labels'           => array(
234 234
                 'labels'                   => array(
235 235
                     'id'   => 'labels_settings',
236
-                    'name' => '<h3>' . __( 'Invoice Labels', 'invoicing' ) . '</h3>',
236
+                    'name' => '<h3>' . __('Invoice Labels', 'invoicing') . '</h3>',
237 237
                     'desc' => '',
238 238
                     'type' => 'header',
239 239
                 ),
240 240
                 'vat_invoice_notice_label' => array(
241 241
                     'id'   => 'vat_invoice_notice_label',
242
-                    'name' => __( 'Invoice Notice Label', 'invoicing' ),
243
-                    'desc' => __( 'Use this to add an invoice notice section (label) to your invoices', 'invoicing' ),
242
+                    'name' => __('Invoice Notice Label', 'invoicing'),
243
+                    'desc' => __('Use this to add an invoice notice section (label) to your invoices', 'invoicing'),
244 244
                     'type' => 'text',
245 245
                     'size' => 'regular',
246 246
                 ),
247 247
                 'vat_invoice_notice'       => array(
248 248
                     'id'   => 'vat_invoice_notice',
249
-                    'name' => __( 'Invoice notice', 'invoicing' ),
250
-                    'desc' => __( 'Use this to add an invoice notice section (description) to your invoices', 'invoicing' ),
249
+                    'name' => __('Invoice notice', 'invoicing'),
250
+                    'desc' => __('Use this to add an invoice notice section (description) to your invoices', 'invoicing'),
251 251
                     'type' => 'text',
252 252
                     'size' => 'regular',
253 253
                 ),
@@ -260,22 +260,22 @@  discard block
 block discarded – undo
260 260
             'main' => array(
261 261
                 'gateway_settings' => array(
262 262
                     'id'   => 'api_header',
263
-                    'name' => '<h3>' . __( 'Gateway Settings', 'invoicing' ) . '</h3>',
263
+                    'name' => '<h3>' . __('Gateway Settings', 'invoicing') . '</h3>',
264 264
                     'desc' => '',
265 265
                     'type' => 'header',
266 266
                 ),
267 267
                 'gateways'         => array(
268 268
                     'id'      => 'gateways',
269
-                    'name'    => __( 'Payment Gateways', 'invoicing' ),
270
-                    'desc'    => __( 'Choose the payment gateways you want to enable.', 'invoicing' ),
269
+                    'name'    => __('Payment Gateways', 'invoicing'),
270
+                    'desc'    => __('Choose the payment gateways you want to enable.', 'invoicing'),
271 271
                     'type'    => 'gateways',
272
-                    'std'     => array( 'manual' => 1 ),
272
+                    'std'     => array('manual' => 1),
273 273
                     'options' => wpinv_get_payment_gateways(),
274 274
                 ),
275 275
                 'default_gateway'  => array(
276 276
                     'id'      => 'default_gateway',
277
-                    'name'    => __( 'Default Gateway', 'invoicing' ),
278
-                    'desc'    => __( 'This gateway will be loaded automatically with the checkout page.', 'invoicing' ),
277
+                    'name'    => __('Default Gateway', 'invoicing'),
278
+                    'desc'    => __('This gateway will be loaded automatically with the checkout page.', 'invoicing'),
279 279
                     'type'    => 'gateway_select',
280 280
                     'std'     => 'manual',
281 281
                     'class'   => 'wpi_select2',
@@ -291,32 +291,32 @@  discard block
 block discarded – undo
291 291
             'main'  => array(
292 292
                 'tax_settings'          => array(
293 293
                     'id'   => 'tax_settings',
294
-                    'name' => '<h3>' . __( 'Tax Settings', 'invoicing' ) . '</h3>',
294
+                    'name' => '<h3>' . __('Tax Settings', 'invoicing') . '</h3>',
295 295
                     'type' => 'header',
296 296
                 ),
297 297
 
298 298
                 'enable_taxes'          => array(
299 299
                     'id'   => 'enable_taxes',
300
-                    'name' => __( 'Enable Taxes', 'invoicing' ),
301
-                    'desc' => __( 'Enable tax rates and calculations.', 'invoicing' ),
300
+                    'name' => __('Enable Taxes', 'invoicing'),
301
+                    'desc' => __('Enable tax rates and calculations.', 'invoicing'),
302 302
                     'type' => 'checkbox',
303 303
                     'std'  => 0,
304 304
                 ),
305 305
 
306 306
                 'tax_subtotal_rounding' => array(
307 307
                     'id'   => 'tax_subtotal_rounding',
308
-                    'name' => __( 'Rounding', 'invoicing' ),
309
-                    'desc' => __( 'Round tax at subtotal level, instead of rounding per tax rate', 'invoicing' ),
308
+                    'name' => __('Rounding', 'invoicing'),
309
+                    'desc' => __('Round tax at subtotal level, instead of rounding per tax rate', 'invoicing'),
310 310
                     'type' => 'checkbox',
311 311
                     'std'  => 1,
312 312
                 ),
313 313
 
314 314
                 'prices_include_tax'    => array(
315 315
                     'id'      => 'prices_include_tax',
316
-                    'name'    => __( 'Prices entered with tax', 'invoicing' ),
316
+                    'name'    => __('Prices entered with tax', 'invoicing'),
317 317
                     'options' => array(
318
-                        'yes' => __( 'Yes, I will enter prices inclusive of tax', 'invoicing' ),
319
-                        'no'  => __( 'No, I will enter prices exclusive of tax', 'invoicing' ),
318
+                        'yes' => __('Yes, I will enter prices inclusive of tax', 'invoicing'),
319
+                        'no'  => __('No, I will enter prices exclusive of tax', 'invoicing'),
320 320
                     ),
321 321
                     'type'    => 'select',
322 322
                     'std'     => 'no',
@@ -324,10 +324,10 @@  discard block
 block discarded – undo
324 324
 
325 325
                 'tax_base'              => array(
326 326
                     'id'      => 'tax_base',
327
-                    'name'    => __( 'Calculate tax based on', 'invoicing' ),
327
+                    'name'    => __('Calculate tax based on', 'invoicing'),
328 328
                     'options' => array(
329
-                        'billing' => __( 'Customer billing address', 'invoicing' ),
330
-                        'base'    => __( 'Shop base address', 'invoicing' ),
329
+                        'billing' => __('Customer billing address', 'invoicing'),
330
+                        'base'    => __('Shop base address', 'invoicing'),
331 331
                     ),
332 332
                     'type'    => 'select',
333 333
                     'std'     => 'billing',
@@ -335,24 +335,24 @@  discard block
 block discarded – undo
335 335
 
336 336
                 'vat_same_country_rule'    => array(
337 337
                     'id'          => 'vat_same_country_rule',
338
-                    'name'        => __( 'Same country rule', 'invoicing' ),
339
-                    'desc'        => __( 'What should happen if a customer is from the same country as your business?', 'invoicing' ),
338
+                    'name'        => __('Same country rule', 'invoicing'),
339
+                    'desc'        => __('What should happen if a customer is from the same country as your business?', 'invoicing'),
340 340
                     'type'        => 'select',
341 341
                     'options'     => array(
342
-                        'no'      => __( 'Do not charge tax', 'invoicing' ),
343
-                        'always'  => __( 'Charge tax unless vat number is validated', 'invoicing' ),
344
-                        'vat_too' => __( 'Charge tax even if vat number is validated', 'invoicing' ),
342
+                        'no'      => __('Do not charge tax', 'invoicing'),
343
+                        'always'  => __('Charge tax unless vat number is validated', 'invoicing'),
344
+                        'vat_too' => __('Charge tax even if vat number is validated', 'invoicing'),
345 345
                     ),
346
-                    'placeholder' => __( 'Select an option', 'invoicing' ),
346
+                    'placeholder' => __('Select an option', 'invoicing'),
347 347
                     'std'         => 'vat_too',
348 348
                 ),
349 349
 
350 350
                 'tax_display_totals'    => array(
351 351
                     'id'      => 'tax_display_totals',
352
-                    'name'    => __( 'Display tax totals', 'invoicing' ),
352
+                    'name'    => __('Display tax totals', 'invoicing'),
353 353
                     'options' => array(
354
-                        'single'     => __( 'As a single total', 'invoicing' ),
355
-                        'individual' => __( 'As individual tax rates', 'invoicing' ),
354
+                        'single'     => __('As a single total', 'invoicing'),
355
+                        'individual' => __('As individual tax rates', 'invoicing'),
356 356
                     ),
357 357
                     'type'    => 'select',
358 358
                     'std'     => 'individual',
@@ -360,8 +360,8 @@  discard block
 block discarded – undo
360 360
 
361 361
                 'tax_rate'              => array(
362 362
                     'id'   => 'tax_rate',
363
-                    'name' => __( 'Fallback Tax Rate', 'invoicing' ),
364
-                    'desc' => __( 'Enter a percentage, such as 6.5. Customers not in a specific rate will be charged this rate.', 'invoicing' ),
363
+                    'name' => __('Fallback Tax Rate', 'invoicing'),
364
+                    'desc' => __('Enter a percentage, such as 6.5. Customers not in a specific rate will be charged this rate.', 'invoicing'),
365 365
                     'type' => 'number',
366 366
                     'size' => 'small',
367 367
                     'min'  => '0',
@@ -373,8 +373,8 @@  discard block
 block discarded – undo
373 373
             'rules' => array(
374 374
                 'tax_rules' => array(
375 375
                     'id'   => 'tax_rules',
376
-                    'name' => '<h3>' . __( 'Tax Rules', 'invoicing' ) . '</h3>',
377
-                    'desc' => __( 'Create/Update tax rules', 'invoicing' ),
376
+                    'name' => '<h3>' . __('Tax Rules', 'invoicing') . '</h3>',
377
+                    'desc' => __('Create/Update tax rules', 'invoicing'),
378 378
                     'type' => 'tax_rules',
379 379
                 ),
380 380
             ),
@@ -382,8 +382,8 @@  discard block
 block discarded – undo
382 382
             'rates' => array(
383 383
                 'tax_rates' => array(
384 384
                     'id'   => 'tax_rates',
385
-                    'name' => '<h3>' . __( 'Tax Rates', 'invoicing' ) . '</h3>',
386
-                    'desc' => __( 'Enter tax rates for specific regions.', 'invoicing' ),
385
+                    'name' => '<h3>' . __('Tax Rates', 'invoicing') . '</h3>',
386
+                    'desc' => __('Enter tax rates for specific regions.', 'invoicing'),
387 387
                     'type' => 'tax_rates',
388 388
                 ),
389 389
             ),
@@ -392,31 +392,31 @@  discard block
 block discarded – undo
392 392
 
393 393
                 'vat_company_name'         => array(
394 394
                     'id'   => 'vat_company_name',
395
-                    'name' => __( 'Company Name', 'invoicing' ),
396
-                    'desc' => wp_sprintf( __( 'Verify your company name and  VAT number on the %1$sEU VIES System.%2$s', 'invoicing' ), '<a href="http://ec.europa.eu/taxation_customs/vies/" target="_blank">', '</a>' ),
395
+                    'name' => __('Company Name', 'invoicing'),
396
+                    'desc' => wp_sprintf(__('Verify your company name and  VAT number on the %1$sEU VIES System.%2$s', 'invoicing'), '<a href="http://ec.europa.eu/taxation_customs/vies/" target="_blank">', '</a>'),
397 397
                     'type' => 'text',
398 398
                     'size' => 'regular',
399 399
                 ),
400 400
 
401 401
                 'vat_number'               => array(
402 402
                     'id'   => 'vat_number',
403
-                    'name' => __( 'VAT Number', 'invoicing' ),
404
-                    'desc' => __( 'Enter your VAT number including the country identifier, eg: GB123456789', 'invoicing' ),
403
+                    'name' => __('VAT Number', 'invoicing'),
404
+                    'desc' => __('Enter your VAT number including the country identifier, eg: GB123456789', 'invoicing'),
405 405
                     'type' => 'text',
406 406
                     'size' => 'regular',
407 407
                 ),
408 408
 
409 409
                 'vat_prevent_b2c_purchase' => array(
410 410
                     'id'   => 'vat_prevent_b2c_purchase',
411
-                    'name' => __( 'Prevent B2C Sales', 'invoicing' ),
412
-                    'desc' => __( 'Require everyone in the EU to provide a VAT number.', 'invoicing' ),
411
+                    'name' => __('Prevent B2C Sales', 'invoicing'),
412
+                    'desc' => __('Require everyone in the EU to provide a VAT number.', 'invoicing'),
413 413
                     'type' => 'checkbox',
414 414
                 ),
415 415
 
416 416
                 'validate_vat_number'      => array(
417 417
                     'id'   => 'validate_vat_number',
418
-                    'name' => __( 'Validate VAT Number', 'invoicing' ),
419
-                    'desc' => __( 'Validate VAT numbers with VIES.', 'invoicing' ),
418
+                    'name' => __('Validate VAT Number', 'invoicing'),
419
+                    'desc' => __('Validate VAT numbers with VIES.', 'invoicing'),
420 420
                     'type' => 'checkbox',
421 421
                 ),
422 422
 
@@ -431,66 +431,66 @@  discard block
 block discarded – undo
431 431
             'main' => array(
432 432
                 'email_settings_header'       => array(
433 433
                     'id'   => 'email_settings_header',
434
-                    'name' => '<h3>' . __( 'Email Sender Options', 'invoicing' ) . '</h3>',
434
+                    'name' => '<h3>' . __('Email Sender Options', 'invoicing') . '</h3>',
435 435
                     'type' => 'header',
436 436
                 ),
437 437
                 'email_from_name'             => array(
438 438
                     'id'   => 'email_from_name',
439
-                    'name' => __( 'From Name', 'invoicing' ),
440
-                    'desc' => __( 'Enter the sender\'s name appears in outgoing invoice emails. This should be your site name.', 'invoicing' ),
441
-                    'std'  => esc_attr( get_bloginfo( 'name', 'display' ) ),
439
+                    'name' => __('From Name', 'invoicing'),
440
+                    'desc' => __('Enter the sender\'s name appears in outgoing invoice emails. This should be your site name.', 'invoicing'),
441
+                    'std'  => esc_attr(get_bloginfo('name', 'display')),
442 442
                     'type' => 'text',
443 443
                 ),
444 444
                 'email_from'                  => array(
445 445
                     'id'   => 'email_from',
446
-                    'name' => __( 'From Email', 'invoicing' ),
447
-                    'desc' => sprintf( __( 'Email address to send invoice emails from. This will act as the "from" address. %1$s If emails are not being sent it may be that your hosting prevents emails being sent if the email domains do not match.%2$s', 'invoicing' ), $alert_wrapper_start, $alert_wrapper_close ),
448
-                    'std'  => get_option( 'admin_email' ),
446
+                    'name' => __('From Email', 'invoicing'),
447
+                    'desc' => sprintf(__('Email address to send invoice emails from. This will act as the "from" address. %1$s If emails are not being sent it may be that your hosting prevents emails being sent if the email domains do not match.%2$s', 'invoicing'), $alert_wrapper_start, $alert_wrapper_close),
448
+                    'std'  => get_option('admin_email'),
449 449
                     'type' => 'text',
450 450
                 ),
451 451
                 'admin_email'                 => array(
452 452
                     'id'   => 'admin_email',
453
-                    'name' => __( 'Admin Email', 'invoicing' ),
454
-                    'desc' => __( 'Where should we send admin notifications? This will is also act as the "reply-to" address for invoice emails', 'invoicing' ),
455
-                    'std'  => get_option( 'admin_email' ),
453
+                    'name' => __('Admin Email', 'invoicing'),
454
+                    'desc' => __('Where should we send admin notifications? This will is also act as the "reply-to" address for invoice emails', 'invoicing'),
455
+                    'std'  => get_option('admin_email'),
456 456
                     'type' => 'text',
457 457
                 ),
458 458
                 'skip_email_free_invoice'     => array(
459 459
                     'id'   => 'skip_email_free_invoice',
460
-                    'name' => __( 'Skip Free Invoices', 'invoicing' ),
461
-                    'desc' => __( 'Check this to disable sending emails for free invoices.', 'invoicing' ),
460
+                    'name' => __('Skip Free Invoices', 'invoicing'),
461
+                    'desc' => __('Check this to disable sending emails for free invoices.', 'invoicing'),
462 462
                     'type' => 'checkbox',
463 463
                     'std'  => false,
464 464
                 ),
465 465
                 'overdue_settings_header'     => array(
466 466
                     'id'   => 'overdue_settings_header',
467
-                    'name' => '<h3>' . __( 'Due Date Settings', 'invoicing' ) . '</h3>',
467
+                    'name' => '<h3>' . __('Due Date Settings', 'invoicing') . '</h3>',
468 468
                     'type' => 'header',
469 469
                 ),
470 470
                 'overdue_active'              => array(
471 471
                     'id'   => 'overdue_active',
472
-                    'name' => __( 'Enable Due Date', 'invoicing' ),
473
-                    'desc' => __( 'Check this to enable due date option for invoices.', 'invoicing' ),
472
+                    'name' => __('Enable Due Date', 'invoicing'),
473
+                    'desc' => __('Check this to enable due date option for invoices.', 'invoicing'),
474 474
                     'type' => 'checkbox',
475 475
                     'std'  => false,
476 476
                 ),
477 477
                 'email_template_header'       => array(
478 478
                     'id'   => 'email_template_header',
479
-                    'name' => '<h3>' . __( 'Email Template', 'invoicing' ) . '</h3>',
479
+                    'name' => '<h3>' . __('Email Template', 'invoicing') . '</h3>',
480 480
                     'type' => 'header',
481 481
                 ),
482 482
                 'email_header_image'          => array(
483 483
                     'id'   => 'email_header_image',
484
-                    'name' => __( 'Header Image', 'invoicing' ),
485
-                    'desc' => __( 'URL to an image you want to show in the email header. Upload images using the media uploader (Admin > Media).', 'invoicing' ),
484
+                    'name' => __('Header Image', 'invoicing'),
485
+                    'desc' => __('URL to an image you want to show in the email header. Upload images using the media uploader (Admin > Media).', 'invoicing'),
486 486
                     'std'  => '',
487 487
                     'type' => 'text',
488 488
                 ),
489 489
                 'email_footer_text'           => array(
490 490
                     'id'    => 'email_footer_text',
491
-                    'name'  => __( 'Footer Text', 'invoicing' ),
492
-                    'desc'  => __( 'The text to appear in the footer of all invoice emails.', 'invoicing' ),
493
-                    'std'   => get_bloginfo( 'name', 'display' ) . ' - ' . __( 'Powered by GetPaid', 'invoicing' ),
491
+                    'name'  => __('Footer Text', 'invoicing'),
492
+                    'desc'  => __('The text to appear in the footer of all invoice emails.', 'invoicing'),
493
+                    'std'   => get_bloginfo('name', 'display') . ' - ' . __('Powered by GetPaid', 'invoicing'),
494 494
                     'type'  => 'textarea',
495 495
                     'class' => 'regular-text',
496 496
                     'rows'  => 2,
@@ -498,29 +498,29 @@  discard block
 block discarded – undo
498 498
                 ),
499 499
                 'email_base_color'            => array(
500 500
                     'id'   => 'email_base_color',
501
-                    'name' => __( 'Base Color', 'invoicing' ),
502
-                    'desc' => __( 'The base color for invoice email template. Default <code>#557da2</code>.', 'invoicing' ),
501
+                    'name' => __('Base Color', 'invoicing'),
502
+                    'desc' => __('The base color for invoice email template. Default <code>#557da2</code>.', 'invoicing'),
503 503
                     'std'  => '#557da2',
504 504
                     'type' => 'color',
505 505
                 ),
506 506
                 'email_background_color'      => array(
507 507
                     'id'   => 'email_background_color',
508
-                    'name' => __( 'Background Color', 'invoicing' ),
509
-                    'desc' => __( 'The background color of email template. Default <code>#f5f5f5</code>.', 'invoicing' ),
508
+                    'name' => __('Background Color', 'invoicing'),
509
+                    'desc' => __('The background color of email template. Default <code>#f5f5f5</code>.', 'invoicing'),
510 510
                     'std'  => '#f5f5f5',
511 511
                     'type' => 'color',
512 512
                 ),
513 513
                 'email_body_background_color' => array(
514 514
                     'id'   => 'email_body_background_color',
515
-                    'name' => __( 'Body Background Color', 'invoicing' ),
516
-                    'desc' => __( 'The main body background color of email template. Default <code>#fdfdfd</code>.', 'invoicing' ),
515
+                    'name' => __('Body Background Color', 'invoicing'),
516
+                    'desc' => __('The main body background color of email template. Default <code>#fdfdfd</code>.', 'invoicing'),
517 517
                     'std'  => '#fdfdfd',
518 518
                     'type' => 'color',
519 519
                 ),
520 520
                 'email_text_color'            => array(
521 521
                     'id'   => 'email_text_color',
522
-                    'name' => __( 'Body Text Color', 'invoicing' ),
523
-                    'desc' => __( 'The main body text color. Default <code>#505050</code>.', 'invoicing' ),
522
+                    'name' => __('Body Text Color', 'invoicing'),
523
+                    'desc' => __('The main body text color. Default <code>#505050</code>.', 'invoicing'),
524 524
                     'std'  => '#505050',
525 525
                     'type' => 'color',
526 526
                 ),
@@ -535,7 +535,7 @@  discard block
 block discarded – undo
535 535
     ),
536 536
 
537 537
     // Integrations.
538
-    'integrations' => wp_list_pluck( getpaid_get_integration_settings(), 'settings', 'id' ),
538
+    'integrations' => wp_list_pluck(getpaid_get_integration_settings(), 'settings', 'id'),
539 539
 
540 540
     /** Privacy Settings */
541 541
     'privacy'      => apply_filters(
@@ -544,17 +544,17 @@  discard block
 block discarded – undo
544 544
             'main' => array(
545 545
                 'invoicing_privacy_policy_settings' => array(
546 546
                     'id'   => 'invoicing_privacy_policy_settings',
547
-                    'name' => '<h3>' . __( 'Privacy Policy', 'invoicing' ) . '</h3>',
547
+                    'name' => '<h3>' . __('Privacy Policy', 'invoicing') . '</h3>',
548 548
                     'type' => 'header',
549 549
                 ),
550 550
                 'privacy_page'                      => array(
551 551
                     'id'          => 'privacy_page',
552
-                    'name'        => __( 'Privacy Page', 'invoicing' ),
553
-                    'desc'        => __( 'If no privacy policy page set in Settings->Privacy default settings, this page will be used on checkout page.', 'invoicing' ),
552
+                    'name'        => __('Privacy Page', 'invoicing'),
553
+                    'desc'        => __('If no privacy policy page set in Settings->Privacy default settings, this page will be used on checkout page.', 'invoicing'),
554 554
                     'type'        => 'select',
555
-                    'options'     => wpinv_get_pages( true, __( 'Select a page', 'invoicing' ) ),
555
+                    'options'     => wpinv_get_pages(true, __('Select a page', 'invoicing')),
556 556
                     'class'       => 'wpi_select2',
557
-                    'placeholder' => __( 'Select a page', 'invoicing' ),
557
+                    'placeholder' => __('Select a page', 'invoicing'),
558 558
                 ),
559 559
             ),
560 560
         )
@@ -566,19 +566,19 @@  discard block
 block discarded – undo
566 566
             'main'       => array(
567 567
                 'invoice_number_format_settings' => array(
568 568
                     'id'   => 'invoice_number_format_settings',
569
-                    'name' => '<h3>' . __( 'Invoice Number', 'invoicing' ) . '</h3>',
569
+                    'name' => '<h3>' . __('Invoice Number', 'invoicing') . '</h3>',
570 570
                     'type' => 'header',
571 571
                 ),
572 572
                 'sequential_invoice_number'      => array(
573 573
                     'id'   => 'sequential_invoice_number',
574
-                    'name' => __( 'Sequential Invoice Numbers', 'invoicing' ),
575
-                    'desc' => __( 'Check this box to enable sequential invoice numbers.', 'invoicing' ) . $reset_number,
574
+                    'name' => __('Sequential Invoice Numbers', 'invoicing'),
575
+                    'desc' => __('Check this box to enable sequential invoice numbers.', 'invoicing') . $reset_number,
576 576
                     'type' => 'checkbox',
577 577
                 ),
578 578
                 'invoice_sequence_start'         => array(
579 579
                     'id'    => 'invoice_sequence_start',
580
-                    'name'  => __( 'Sequential Starting Number', 'invoicing' ),
581
-                    'desc'  => __( 'The number at which the invoice number sequence should begin.', 'invoicing' ) . $last_number,
580
+                    'name'  => __('Sequential Starting Number', 'invoicing'),
581
+                    'desc'  => __('The number at which the invoice number sequence should begin.', 'invoicing') . $last_number,
582 582
                     'type'  => 'number',
583 583
                     'size'  => 'small',
584 584
                     'std'   => '1',
@@ -586,8 +586,8 @@  discard block
 block discarded – undo
586 586
                 ),
587 587
                 'invoice_number_padd'            => array(
588 588
                     'id'      => 'invoice_number_padd',
589
-                    'name'    => __( 'Minimum Digits', 'invoicing' ),
590
-                    'desc'    => __( 'If the invoice number has less digits than this number, it is left padded with 0s. Ex: invoice number 108 will padded to 00108 if digits set to 5. The default 0 means no padding.', 'invoicing' ),
589
+                    'name'    => __('Minimum Digits', 'invoicing'),
590
+                    'desc'    => __('If the invoice number has less digits than this number, it is left padded with 0s. Ex: invoice number 108 will padded to 00108 if digits set to 5. The default 0 means no padding.', 'invoicing'),
591 591
                     'type'    => 'select',
592 592
                     'options' => $invoice_number_padd_options,
593 593
                     'std'     => 5,
@@ -595,8 +595,8 @@  discard block
 block discarded – undo
595 595
                 ),
596 596
                 'invoice_number_prefix'          => array(
597 597
                     'id'          => 'invoice_number_prefix',
598
-                    'name'        => __( 'Invoice Number Prefix', 'invoicing' ),
599
-                    'desc'        => __( 'Prefix for all invoice numbers. Ex: INV-', 'invoicing' ),
598
+                    'name'        => __('Invoice Number Prefix', 'invoicing'),
599
+                    'desc'        => __('Prefix for all invoice numbers. Ex: INV-', 'invoicing'),
600 600
                     'type'        => 'text',
601 601
                     'size'        => 'regular',
602 602
                     'std'         => 'INV-',
@@ -604,46 +604,46 @@  discard block
 block discarded – undo
604 604
                 ),
605 605
                 'invoice_number_postfix'         => array(
606 606
                     'id'   => 'invoice_number_postfix',
607
-                    'name' => __( 'Invoice Number Postfix', 'invoicing' ),
608
-                    'desc' => __( 'Postfix for all invoice numbers.', 'invoicing' ),
607
+                    'name' => __('Invoice Number Postfix', 'invoicing'),
608
+                    'desc' => __('Postfix for all invoice numbers.', 'invoicing'),
609 609
                     'type' => 'text',
610 610
                     'size' => 'regular',
611 611
                     'std'  => '',
612 612
                 ),
613 613
                 'checkout_settings'              => array(
614 614
                     'id'   => 'checkout_settings',
615
-                    'name' => '<h3>' . __( 'Checkout Settings', 'invoicing' ) . '</h3>',
615
+                    'name' => '<h3>' . __('Checkout Settings', 'invoicing') . '</h3>',
616 616
                     'type' => 'header',
617 617
                 ),
618 618
                 'disable_new_user_emails'        => array(
619 619
                     'id'   => 'disable_new_user_emails',
620
-                    'name' => __( 'Disable new user emails', 'invoicing' ),
621
-                    'desc' => __( 'Do not send an email to customers when a new user account is created for them.', 'invoicing' ),
620
+                    'name' => __('Disable new user emails', 'invoicing'),
621
+                    'desc' => __('Do not send an email to customers when a new user account is created for them.', 'invoicing'),
622 622
                     'type' => 'checkbox',
623 623
                 ),
624 624
                 'login_to_checkout'              => array(
625 625
                     'id'   => 'login_to_checkout',
626
-                    'name' => __( 'Require Login To Checkout', 'invoicing' ),
627
-                    'desc' => __( 'If ticked then user needs to be logged in to view or pay invoice, can only view or pay their own invoice. If unticked then anyone can view or pay the invoice.', 'invoicing' ),
626
+                    'name' => __('Require Login To Checkout', 'invoicing'),
627
+                    'desc' => __('If ticked then user needs to be logged in to view or pay invoice, can only view or pay their own invoice. If unticked then anyone can view or pay the invoice.', 'invoicing'),
628 628
                     'type' => 'checkbox',
629 629
                 ),
630 630
                 'maxmind_license_key'            => array(
631 631
                     'id'   => 'maxmind_license_key',
632
-                    'name' => __( 'MaxMind License Key', 'invoicing' ),
632
+                    'name' => __('MaxMind License Key', 'invoicing'),
633 633
                     'type' => 'text',
634 634
                     'size' => 'regular',
635
-                    'desc' => __( "Enter you license key if you would like to use MaxMind to automatically detect a customer's country.", 'invoicing' ) . ' <a href="https://support.maxmind.com/hc/en-us/articles/4407111582235-Generate-a-License-Key">' . __( 'How to generate a free license key.', 'invoicing' ) . '</a>',
635
+                    'desc' => __("Enter you license key if you would like to use MaxMind to automatically detect a customer's country.", 'invoicing') . ' <a href="https://support.maxmind.com/hc/en-us/articles/4407111582235-Generate-a-License-Key">' . __('How to generate a free license key.', 'invoicing') . '</a>',
636 636
                 ),
637 637
 
638 638
                 'uninstall_settings'             => array(
639 639
                     'id'   => 'uninstall_settings',
640
-                    'name' => '<h3>' . __( 'Uninstall Settings', 'invoicing' ) . '</h3>',
640
+                    'name' => '<h3>' . __('Uninstall Settings', 'invoicing') . '</h3>',
641 641
                     'type' => 'header',
642 642
                 ),
643 643
                 'remove_data_on_unistall'        => array(
644 644
                     'id'   => 'remove_data_on_unistall',
645
-                    'name' => __( 'Remove Data on Uninstall?', 'invoicing' ),
646
-                    'desc' => __( 'Check this box if you would like Invoicing plugin to completely remove all of its data when the plugin is deleted/uninstalled.', 'invoicing' ),
645
+                    'name' => __('Remove Data on Uninstall?', 'invoicing'),
646
+                    'desc' => __('Check this box if you would like Invoicing plugin to completely remove all of its data when the plugin is deleted/uninstalled.', 'invoicing'),
647 647
                     'type' => 'checkbox',
648 648
                     'std'  => '',
649 649
                 ),
@@ -652,13 +652,13 @@  discard block
 block discarded – undo
652 652
             'custom-css' => array(
653 653
                 'css_settings'        => array(
654 654
                     'id'   => 'css_settings',
655
-                    'name' => '<h3>' . __( 'Custom CSS', 'invoicing' ) . '</h3>',
655
+                    'name' => '<h3>' . __('Custom CSS', 'invoicing') . '</h3>',
656 656
                     'type' => 'header',
657 657
                 ),
658 658
                 'template_custom_css' => array(
659 659
                     'id'    => 'template_custom_css',
660
-                    'name'  => __( 'Invoice Template CSS', 'invoicing' ),
661
-                    'desc'  => __( 'Add CSS to modify appearance of the print invoice page.', 'invoicing' ),
660
+                    'name'  => __('Invoice Template CSS', 'invoicing'),
661
+                    'desc'  => __('Add CSS to modify appearance of the print invoice page.', 'invoicing'),
662 662
                     'type'  => 'textarea',
663 663
                     'class' => 'regular-text',
664 664
                     'rows'  => 10,
@@ -673,8 +673,8 @@  discard block
 block discarded – undo
673 673
             'main' => array(
674 674
                 'tool_settings' => array(
675 675
                     'id'   => 'tool_settings',
676
-                    'name' => '<h3>' . __( 'Diagnostic Tools', 'invoicing' ) . '</h3>',
677
-                    'desc' => __( 'Invoicing diagnostic tools', 'invoicing' ),
676
+                    'name' => '<h3>' . __('Diagnostic Tools', 'invoicing') . '</h3>',
677
+                    'desc' => __('Invoicing diagnostic tools', 'invoicing'),
678 678
                     'type' => 'tools',
679 679
                 ),
680 680
             ),
Please login to merge, or discard this patch.
includes/admin/views/html-tax-rule-edit.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -5,37 +5,37 @@
 block discarded – undo
5 5
  * @var array $tax_rule
6 6
  */
7 7
 
8
-defined( 'ABSPATH' ) || exit;
8
+defined('ABSPATH') || exit;
9 9
 
10 10
 ?>
11 11
 
12 12
 <tr>
13 13
 
14 14
     <td class="wpinv-tax-rule-key">
15
-        <input type="text" name="tax_rules[<?php echo esc_attr( $tax_rule['key'] ); ?>][key]" value="<?php echo esc_attr( $tax_rule['key'] ); ?>" required/>
15
+        <input type="text" name="tax_rules[<?php echo esc_attr($tax_rule['key']); ?>][key]" value="<?php echo esc_attr($tax_rule['key']); ?>" required/>
16 16
     </td>
17 17
 
18 18
     <td class="wpinv-tax-rule-label">
19
-        <input type="text" name="tax_rules[<?php echo esc_attr( $tax_rule['key'] ); ?>][label]" value="<?php echo esc_attr( $tax_rule['label'] ); ?>" required/>
19
+        <input type="text" name="tax_rules[<?php echo esc_attr($tax_rule['key']); ?>][label]" value="<?php echo esc_attr($tax_rule['label']); ?>" required/>
20 20
     </td>
21 21
 
22 22
     <td class="wpinv-tax-rule-base-address">
23
-        <select name="tax_rules[<?php echo esc_attr( $tax_rule['key'] ); ?>][tax_base]" class="getpaid-tax-rule-base-address" required>
24
-            <option value="billing" <?php selected( $tax_rule['tax_base'], 'billing' ); ?>><?php esc_html_e( 'Customer billing address', 'invoicing' ); ?></option>
25
-            <option value="base" <?php selected( $tax_rule['tax_base'], 'base' ); ?>><?php esc_html_e( 'Shop base address', 'invoicing' ); ?></option>
23
+        <select name="tax_rules[<?php echo esc_attr($tax_rule['key']); ?>][tax_base]" class="getpaid-tax-rule-base-address" required>
24
+            <option value="billing" <?php selected($tax_rule['tax_base'], 'billing'); ?>><?php esc_html_e('Customer billing address', 'invoicing'); ?></option>
25
+            <option value="base" <?php selected($tax_rule['tax_base'], 'base'); ?>><?php esc_html_e('Shop base address', 'invoicing'); ?></option>
26 26
         </select>
27 27
     </td>
28 28
 
29 29
     <td class="wpinv-tax-rule-same-country">
30
-        <select name="tax_rules[<?php echo esc_attr( $tax_rule['key'] ); ?>][same_country_rule]" class="getpaid-tax-rule-same-country" required>
31
-            <option value="no" <?php selected( $tax_rule['same_country_rule'], 'no' ); ?>><?php esc_html_e( 'Do not charge tax', 'invoicing' ); ?></option>
32
-            <option value="always" <?php selected( $tax_rule['same_country_rule'], 'always' ); ?>><?php esc_html_e( 'Charge tax unless vat number is validated', 'invoicing' ); ?></option>
33
-            <option value="vat_too" <?php selected( $tax_rule['same_country_rule'], 'vat_too' ); ?>><?php esc_html_e( 'Charge tax even if vat number is validated', 'invoicing' ); ?></option>
30
+        <select name="tax_rules[<?php echo esc_attr($tax_rule['key']); ?>][same_country_rule]" class="getpaid-tax-rule-same-country" required>
31
+            <option value="no" <?php selected($tax_rule['same_country_rule'], 'no'); ?>><?php esc_html_e('Do not charge tax', 'invoicing'); ?></option>
32
+            <option value="always" <?php selected($tax_rule['same_country_rule'], 'always'); ?>><?php esc_html_e('Charge tax unless vat number is validated', 'invoicing'); ?></option>
33
+            <option value="vat_too" <?php selected($tax_rule['same_country_rule'], 'vat_too'); ?>><?php esc_html_e('Charge tax even if vat number is validated', 'invoicing'); ?></option>
34 34
         </select>
35 35
     </td>
36 36
 
37 37
     <td class="wpinv_tax_remove">
38
-        <button type="button" class="close wpinv_remove_tax_rule" aria-label="<?php esc_attr_e( 'Delete', 'invoicing' ); ?>" title="<?php esc_attr_e( 'Delete', 'invoicing' ); ?>">
38
+        <button type="button" class="close wpinv_remove_tax_rule" aria-label="<?php esc_attr_e('Delete', 'invoicing'); ?>" title="<?php esc_attr_e('Delete', 'invoicing'); ?>">
39 39
             <span aria-hidden="true">&times;</span>
40 40
         </button>
41 41
     </td>
Please login to merge, or discard this patch.
includes/admin/views/html-tax-rules-edit.php 2 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -8,8 +8,8 @@
 block discarded – undo
8 8
 
9 9
 $dummy_rule = array(
10 10
     'key'               => 'TAX_RULE_KEY',
11
-	'label'             => __( 'New Tax Rule', 'invoicing' ),
12
-	'tax_base'          => wpinv_get_option( 'tax_base', 'billing' ),
11
+    'label'             => __( 'New Tax Rule', 'invoicing' ),
12
+    'tax_base'          => wpinv_get_option( 'tax_base', 'billing' ),
13 13
     'same_country_rule' => wpinv_get_option( 'vat_same_country_rule', 'vat_too' ),
14 14
 );
15 15
 
Please login to merge, or discard this patch.
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -4,40 +4,40 @@  discard block
 block discarded – undo
4 4
  *
5 5
  */
6 6
 
7
-defined( 'ABSPATH' ) || exit;
7
+defined('ABSPATH') || exit;
8 8
 
9 9
 $dummy_rule = array(
10 10
     'key'               => 'TAX_RULE_KEY',
11
-	'label'             => __( 'New Tax Rule', 'invoicing' ),
12
-	'tax_base'          => wpinv_get_option( 'tax_base', 'billing' ),
13
-    'same_country_rule' => wpinv_get_option( 'vat_same_country_rule', 'vat_too' ),
11
+	'label'             => __('New Tax Rule', 'invoicing'),
12
+	'tax_base'          => wpinv_get_option('tax_base', 'billing'),
13
+    'same_country_rule' => wpinv_get_option('vat_same_country_rule', 'vat_too'),
14 14
 );
15 15
 
16
-wp_nonce_field( 'wpinv_tax_rules', 'wpinv_tax_rules_nonce' );
16
+wp_nonce_field('wpinv_tax_rules', 'wpinv_tax_rules_nonce');
17 17
 
18 18
 ?>
19 19
 <div class="table-responsive">
20 20
     <table id="wpinv-tax-rules" class="widefat fixed table">
21
-        <caption><?php echo esc_html_e( 'You can use this section to create or edit your tax rules', 'invoicing' ); ?></caption>
21
+        <caption><?php echo esc_html_e('You can use this section to create or edit your tax rules', 'invoicing'); ?></caption>
22 22
 
23 23
         <thead>
24 24
             <tr class="table-light">
25 25
 
26 26
                 <th scope="col" class="border-bottom border-top">
27
-                    <?php esc_html_e( 'Unique Key', 'invoicing' ); ?>
27
+                    <?php esc_html_e('Unique Key', 'invoicing'); ?>
28 28
                 </th>
29 29
 
30 30
                 <th scope="col" class="border-bottom border-top">
31
-                    <?php esc_html_e( 'Label', 'invoicing' ); ?>
31
+                    <?php esc_html_e('Label', 'invoicing'); ?>
32 32
                 </th>
33 33
 
34 34
                 <th scope="col" class="border-bottom border-top">
35
-                    <?php esc_html_e( 'Calculate tax based on', 'invoicing' ); ?>
35
+                    <?php esc_html_e('Calculate tax based on', 'invoicing'); ?>
36 36
                 </th>
37 37
 
38 38
                 <th scope="col" class="border-bottom border-top">
39
-                    <?php esc_html_e( 'Same country rule', 'invoicing' ); ?>
40
-                    <?php getpaid_get_help_tip( __( 'What should happen if a customer is from the same country as your business?.', 'invoicing' ), 'position-static', true ); ?>
39
+                    <?php esc_html_e('Same country rule', 'invoicing'); ?>
40
+                    <?php getpaid_get_help_tip(__('What should happen if a customer is from the same country as your business?.', 'invoicing'), 'position-static', true); ?>
41 41
                 </th>
42 42
 
43 43
                 <th scope="col" class="border-bottom border-top" style="width:32px">&nbsp;</th>
@@ -46,8 +46,8 @@  discard block
 block discarded – undo
46 46
         </thead>
47 47
 
48 48
         <tbody>
49
-            <?php foreach ( GetPaid_Tax::get_all_tax_rules() as $tax_rule ) : ?>
50
-                <?php include plugin_dir_path( __FILE__ ) . 'html-tax-rule-edit.php'; ?>
49
+            <?php foreach (GetPaid_Tax::get_all_tax_rules() as $tax_rule) : ?>
50
+                <?php include plugin_dir_path(__FILE__) . 'html-tax-rule-edit.php'; ?>
51 51
             <?php endforeach; ?>
52 52
         </tbody>
53 53
 
@@ -55,8 +55,8 @@  discard block
 block discarded – undo
55 55
             <tr class="table-light">
56 56
                 <td colspan="4" class="border-top">
57 57
 
58
-                    <button type="button" class="button button-secondary wpinv_add_tax_rule" aria-label="<?php esc_attr_e( 'Add Tax Rule', 'invoicing' ); ?>">
59
-                        <span><?php esc_html_e( 'Add Tax Rule', 'invoicing' ); ?></span>
58
+                    <button type="button" class="button button-secondary wpinv_add_tax_rule" aria-label="<?php esc_attr_e('Add Tax Rule', 'invoicing'); ?>">
59
+                        <span><?php esc_html_e('Add Tax Rule', 'invoicing'); ?></span>
60 60
                     </button>
61 61
 
62 62
                 </td>
@@ -67,6 +67,6 @@  discard block
 block discarded – undo
67 67
 
68 68
 <script type="text/html" id="tmpl-wpinv-tax-rule-row">
69 69
     <?php $tax_rule = $dummy_rule; ?>
70
-    <?php include plugin_dir_path( __FILE__ ) . 'html-tax-rule-edit.php'; ?>
70
+    <?php include plugin_dir_path(__FILE__) . 'html-tax-rule-edit.php'; ?>
71 71
 </script>
72 72
 
Please login to merge, or discard this patch.
includes/admin/views/wizard-gateways.php 2 patches
Spacing   +18 added lines, -18 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
 
@@ -12,24 +12,24 @@  discard block
 block discarded – undo
12 12
 
13 13
     <form method="post" class="text-center card-body">
14 14
         <div class="gp-wizard-payments">
15
-            <h2 class="gd-settings-title h3 "><?php esc_html_e( 'Gateway Setup', 'invoicing' ); ?></h2>
16
-            <p><?php esc_html_e( 'Below are a few gateways that can be setup in a few seconds.', 'invoicing' ); ?>
15
+            <h2 class="gd-settings-title h3 "><?php esc_html_e('Gateway Setup', 'invoicing'); ?></h2>
16
+            <p><?php esc_html_e('Below are a few gateways that can be setup in a few seconds.', 'invoicing'); ?>
17 17
                 <br>
18
-                <?php esc_html_e( 'We have 20+ Gateways that can be setup later.', 'invoicing' ); ?>
18
+                <?php esc_html_e('We have 20+ Gateways that can be setup later.', 'invoicing'); ?>
19 19
             </p>
20 20
 
21 21
             <ul class="list-group">
22 22
 
23 23
 				<li class="list-group-item d-flex justify-content-between align-items-center">
24
-				    <span class="mr-auto"><img src="<?php echo esc_url( WPINV_PLUGIN_URL . 'assets/images/stripe-verified.svg' ); ?>" class="ml-n2" alt="Stripe"></span>
25
-				    <?php if ( false === wpinv_get_option( 'stripe_live_connect_account_id' ) ) : ?>
24
+				    <span class="mr-auto"><img src="<?php echo esc_url(WPINV_PLUGIN_URL . 'assets/images/stripe-verified.svg'); ?>" class="ml-n2" alt="Stripe"></span>
25
+				    <?php if (false === wpinv_get_option('stripe_live_connect_account_id')) : ?>
26 26
                         <a href="<?php
27
-                        echo esc_url( wp_nonce_url(
27
+                        echo esc_url(wp_nonce_url(
28 28
                             add_query_arg(
29 29
                                 array(
30 30
                                     'getpaid-admin-action' => 'connect_gateway',
31 31
                                     'plugin'               => 'stripe',
32
-                                    'redirect'             => urlencode( add_query_arg( 'step', 'payments' ) ),
32
+                                    'redirect'             => urlencode(add_query_arg('step', 'payments')),
33 33
                                 ),
34 34
                                 admin_url()
35 35
                             ),
@@ -37,31 +37,31 @@  discard block
 block discarded – undo
37 37
                             'getpaid-nonce'
38 38
                         ));
39 39
                         ?>"
40
-                        class="btn btn-sm btn-outline-primary"><?php esc_html_e( 'Connect', 'invoicing' ); ?></a>
40
+                        class="btn btn-sm btn-outline-primary"><?php esc_html_e('Connect', 'invoicing'); ?></a>
41 41
                     <?php else : ?>
42
-                        <span class="btn btn-sm btn-success"><?php esc_html_e( 'Connected', 'invoicing' ); ?></span>
42
+                        <span class="btn btn-sm btn-success"><?php esc_html_e('Connected', 'invoicing'); ?></span>
43 43
                     <?php endif; ?>
44 44
 				</li>
45 45
 
46 46
 				<li class="list-group-item">
47 47
                     <div class="d-flex justify-content-between align-items-center">
48 48
                         <span class="mr-auto">
49
-                            <img src="<?php echo esc_url( WPINV_PLUGIN_URL . 'assets/images/pp-logo-150px.webp' ); ?>" class="" alt="PayPal" height="25">
49
+                            <img src="<?php echo esc_url(WPINV_PLUGIN_URL . 'assets/images/pp-logo-150px.webp'); ?>" class="" alt="PayPal" height="25">
50 50
                         </span>
51 51
                         <a
52 52
                             href="#"
53 53
                             onclick="jQuery('.getpaid-setup-paypal-input').toggleClass('d-none'); return false;"
54
-                            class="getpaid-setup-paypal btn btn-sm btn-outline-primary"><?php esc_html_e( 'Set-up', 'invoicing' ); ?></a>
54
+                            class="getpaid-setup-paypal btn btn-sm btn-outline-primary"><?php esc_html_e('Set-up', 'invoicing'); ?></a>
55 55
                     </div>
56 56
                     <div class="mt-4 getpaid-setup-paypal-input d-none">
57
-                        <input type="text" placeholder="<?php esc_attr_e( 'PayPal Email', 'invoicing' ); ?>" name="paypal-email" class="form-control" value="<?php echo esc_attr( wpinv_get_option( 'paypal_email' ) ); ?>">
57
+                        <input type="text" placeholder="<?php esc_attr_e('PayPal Email', 'invoicing'); ?>" name="paypal-email" class="form-control" value="<?php echo esc_attr(wpinv_get_option('paypal_email')); ?>">
58 58
                     </div>
59 59
                 </li>
60 60
 
61 61
 				<li class="list-group-item d-flex justify-content-between align-items-center">
62
-				    <span class="mr-auto"><?php esc_html_e( 'Test Gateway', 'invoicing' ); ?></span>
62
+				    <span class="mr-auto"><?php esc_html_e('Test Gateway', 'invoicing'); ?></span>
63 63
 					<div class="custom-control custom-switch">
64
-						<input type="checkbox" name="enable-manual-gateway" class="custom-control-input" id="enable-manual-gateway" <?php checked( wpinv_is_gateway_active( 'manual' ) ); ?>>
64
+						<input type="checkbox" name="enable-manual-gateway" class="custom-control-input" id="enable-manual-gateway" <?php checked(wpinv_is_gateway_active('manual')); ?>>
65 65
 						<label class="custom-control-label" for="enable-manual-gateway"></label>
66 66
 					</div>
67 67
 				</li>
@@ -70,10 +70,10 @@  discard block
 block discarded – undo
70 70
         </div>
71 71
 
72 72
         <p class="gp-setup-actions step text-center mt-4">
73
-			<input type="submit" class="btn btn-primary" value="<?php esc_attr_e( 'Continue', 'invoicing' ); ?>" />
73
+			<input type="submit" class="btn btn-primary" value="<?php esc_attr_e('Continue', 'invoicing'); ?>" />
74 74
 		</p>
75 75
         
76
-        <?php getpaid_hidden_field( 'save_step', 1 ); ?>
77
-        <?php wp_nonce_field( 'getpaid-setup-wizard', 'getpaid-setup-wizard' ); ?>
76
+        <?php getpaid_hidden_field('save_step', 1); ?>
77
+        <?php wp_nonce_field('getpaid-setup-wizard', 'getpaid-setup-wizard'); ?>
78 78
     </form>
79 79
 </div>
Please login to merge, or discard this patch.
Braces   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -38,8 +38,11 @@
 block discarded – undo
38 38
                         ));
39 39
                         ?>"
40 40
                         class="btn btn-sm btn-outline-primary"><?php esc_html_e( 'Connect', 'invoicing' ); ?></a>
41
-                    <?php else : ?>
42
-                        <span class="btn btn-sm btn-success"><?php esc_html_e( 'Connected', 'invoicing' ); ?></span>
41
+                    <?php else {
42
+    : ?>
43
+                        <span class="btn btn-sm btn-success"><?php esc_html_e( 'Connected', 'invoicing' );
44
+}
45
+?></span>
43 46
                     <?php endif; ?>
44 47
 				</li>
45 48
 
Please login to merge, or discard this patch.
includes/user-functions.php 1 patch
Indentation   +73 added lines, -73 removed lines patch added patch discarded remove patch
@@ -34,11 +34,11 @@  discard block
 block discarded – undo
34 34
  */
35 35
 function wpinv_get_capability( $capalibilty = 'manage_invoicing' ) {
36 36
 
37
-	if ( current_user_can( 'manage_options' ) ) {
38
-		return 'manage_options';
39
-	};
37
+    if ( current_user_can( 'manage_options' ) ) {
38
+        return 'manage_options';
39
+    };
40 40
 
41
-	return $capalibilty;
41
+    return $capalibilty;
42 42
 }
43 43
 
44 44
 /**
@@ -62,10 +62,10 @@  discard block
 block discarded – undo
62 62
     // Prepare user values.
63 63
     $prefix = preg_replace( '/\s+/', '', $prefix );
64 64
     $prefix = empty( $prefix ) ? $email : $prefix;
65
-	$args   = array(
66
-		'user_login' => wpinv_generate_user_name( $prefix ),
67
-		'user_pass'  => wp_generate_password(),
68
-		'user_email' => $email,
65
+    $args   = array(
66
+        'user_login' => wpinv_generate_user_name( $prefix ),
67
+        'user_pass'  => wp_generate_password(),
68
+        'user_email' => $email,
69 69
         'role'       => 'subscriber',
70 70
     );
71 71
 
@@ -82,16 +82,16 @@  discard block
 block discarded – undo
82 82
 function wpinv_generate_user_name( $prefix = '' ) {
83 83
 
84 84
     // If prefix is an email, retrieve the part before the email.
85
-	$prefix = strtok( $prefix, '@' );
85
+    $prefix = strtok( $prefix, '@' );
86 86
     $prefix = trim( $prefix, '.' );
87 87
 
88
-	// Sanitize the username.
89
-	$prefix = sanitize_user( $prefix, true );
88
+    // Sanitize the username.
89
+    $prefix = sanitize_user( $prefix, true );
90 90
 
91
-	$illegal_logins = (array) apply_filters( 'illegal_user_logins', array() );
92
-	if ( empty( $prefix ) || in_array( strtolower( $prefix ), array_map( 'strtolower', $illegal_logins ), true ) ) {
93
-		$prefix = 'gtp_' . zeroise( wp_rand( 0, 9999 ), 4 );
94
-	}
91
+    $illegal_logins = (array) apply_filters( 'illegal_user_logins', array() );
92
+    if ( empty( $prefix ) || in_array( strtolower( $prefix ), array_map( 'strtolower', $illegal_logins ), true ) ) {
93
+        $prefix = 'gtp_' . zeroise( wp_rand( 0, 9999 ), 4 );
94
+    }
95 95
 
96 96
     $username = $prefix;
97 97
     $postfix  = 2;
@@ -220,43 +220,43 @@  discard block
 block discarded – undo
220 220
 
221 221
                     foreach ( getpaid_user_address_fields() as $key => $label ) {
222 222
 
223
-					// Display the country.
224
-					if ( 'country' == $key ) {
225
-
226
-						aui()->select(
227
-							array(
228
-								'options'     => wpinv_get_country_list(),
229
-								'name'        => 'getpaid_address[' . esc_attr( $key ) . ']',
230
-								'id'          => 'wpinv-' . sanitize_html_class( $key ),
231
-								'value'       => sanitize_text_field( getpaid_get_user_address_field( get_current_user_id(), $key ) ),
232
-								'placeholder' => $label,
233
-								'label'       => wp_kses_post( $label ),
234
-								'label_type'  => 'vertical',
235
-								'class'       => 'getpaid-address-field',
223
+                    // Display the country.
224
+                    if ( 'country' == $key ) {
225
+
226
+                        aui()->select(
227
+                            array(
228
+                                'options'     => wpinv_get_country_list(),
229
+                                'name'        => 'getpaid_address[' . esc_attr( $key ) . ']',
230
+                                'id'          => 'wpinv-' . sanitize_html_class( $key ),
231
+                                'value'       => sanitize_text_field( getpaid_get_user_address_field( get_current_user_id(), $key ) ),
232
+                                'placeholder' => $label,
233
+                                'label'       => wp_kses_post( $label ),
234
+                                'label_type'  => 'vertical',
235
+                                'class'       => 'getpaid-address-field',
236 236
                             ),
237 237
                             true
238
-						);
239
-
240
-					}
241
-
242
-					// Display the state.
243
-					elseif ( 'state' == $key ) {
244
-
245
-						getpaid_get_states_select_markup(
246
-							getpaid_get_user_address_field( get_current_user_id(), 'country' ),
247
-							getpaid_get_user_address_field( get_current_user_id(), 'state' ),
248
-							$label,
249
-							$label,
250
-							'',
251
-							false,
252
-							'',
253
-							'getpaid_address[' . esc_attr( $key ) . ']',
238
+                        );
239
+
240
+                    }
241
+
242
+                    // Display the state.
243
+                    elseif ( 'state' == $key ) {
244
+
245
+                        getpaid_get_states_select_markup(
246
+                            getpaid_get_user_address_field( get_current_user_id(), 'country' ),
247
+                            getpaid_get_user_address_field( get_current_user_id(), 'state' ),
248
+                            $label,
249
+                            $label,
250
+                            '',
251
+                            false,
252
+                            '',
253
+                            'getpaid_address[' . esc_attr( $key ) . ']',
254 254
                             true
255
-						);
255
+                        );
256 256
 
257 257
                         } else {
258 258
 
259
-						aui()->input(
259
+                        aui()->input(
260 260
                             array(
261 261
                                 'name'        => 'getpaid_address[' . esc_attr( $key ) . ']',
262 262
                                 'id'          => 'wpinv-' . sanitize_html_class( $key ),
@@ -268,7 +268,7 @@  discard block
 block discarded – undo
268 268
                                 'class'       => 'getpaid-address-field',
269 269
                             ),
270 270
                             true
271
-						);
271
+                        );
272 272
 
273 273
                         }
274 274
                     }
@@ -407,7 +407,7 @@  discard block
 block discarded – undo
407 407
 function getpaid_allowed_html() {
408 408
     $allowed_html = wp_kses_allowed_html( 'post' );
409 409
 
410
-	// form fields
410
+    // form fields
411 411
     $allowed_html['form'] = array(
412 412
         'action'         => true,
413 413
         'accept'         => true,
@@ -419,12 +419,12 @@  discard block
 block discarded – undo
419 419
     );
420 420
 
421 421
     // - input
422
-	$allowed_html['input'] = array(
423
-		'class'        => array(),
424
-		'id'           => array(),
425
-		'name'         => array(),
426
-		'value'        => array(),
427
-		'type'         => array(),
422
+    $allowed_html['input'] = array(
423
+        'class'        => array(),
424
+        'id'           => array(),
425
+        'name'         => array(),
426
+        'value'        => array(),
427
+        'type'         => array(),
428 428
         'placeholder'  => array(),
429 429
         'autocomplete' => array(),
430 430
         'autofocus'    => array(),
@@ -438,33 +438,33 @@  discard block
 block discarded – undo
438 438
         'max'          => array(),
439 439
         'step'         => array(),
440 440
         'size'         => array(),
441
-	);
441
+    );
442 442
 
443 443
     // - input
444
-	$allowed_html['textarea'] = array(
445
-		'class' => array(),
446
-		'id'    => array(),
447
-		'name'  => array(),
448
-		'value' => array(),
449
-	);
450
-
451
-	// select
452
-	$allowed_html['select'] = array(
453
-		'class'        => array(),
454
-		'id'           => array(),
455
-		'name'         => array(),
444
+    $allowed_html['textarea'] = array(
445
+        'class' => array(),
446
+        'id'    => array(),
447
+        'name'  => array(),
448
+        'value' => array(),
449
+    );
450
+
451
+    // select
452
+    $allowed_html['select'] = array(
453
+        'class'        => array(),
454
+        'id'           => array(),
455
+        'name'         => array(),
456 456
         'autocomplete' => array(),
457 457
         'multiple'     => array(),
458
-	);
458
+    );
459 459
 
460
-	// select options
461
-	$allowed_html['option'] = array(
462
-		'selected' => array(),
460
+    // select options
461
+    $allowed_html['option'] = array(
462
+        'selected' => array(),
463 463
         'disabled' => array(),
464 464
         'value'    => array(),
465
-	);
465
+    );
466 466
 
467
-	return $allowed_html;
467
+    return $allowed_html;
468 468
 
469 469
 }
470 470
 
Please login to merge, or discard this patch.