@@ -4,7 +4,7 @@ discard block |
||
4 | 4 | * |
5 | 5 | */ |
6 | 6 | |
7 | -defined( 'ABSPATH' ) || exit; |
|
7 | +defined('ABSPATH') || exit; |
|
8 | 8 | |
9 | 9 | class WPInv_EUVat { |
10 | 10 | |
@@ -28,35 +28,35 @@ discard block |
||
28 | 28 | */ |
29 | 29 | public static function section_vat_settings() {} |
30 | 30 | |
31 | - public static function get_eu_states( $sort = true ) { |
|
32 | - $eu_states = array( 'AT', 'BE', 'BG', 'HR', 'CY', 'CZ', 'DK', 'EE', 'FI', 'FR', 'DE', 'GB', 'GR', 'HU', 'IE', 'IT', 'LV', 'LT', 'LU', 'MT', 'NL', 'PL', 'PT', 'RO', 'SK', 'SI', 'ES', 'SE' ); |
|
33 | - if ( $sort ) { |
|
34 | - $sort = sort( $eu_states ); |
|
31 | + public static function get_eu_states($sort = true) { |
|
32 | + $eu_states = array('AT', 'BE', 'BG', 'HR', 'CY', 'CZ', 'DK', 'EE', 'FI', 'FR', 'DE', 'GB', 'GR', 'HU', 'IE', 'IT', 'LV', 'LT', 'LU', 'MT', 'NL', 'PL', 'PT', 'RO', 'SK', 'SI', 'ES', 'SE'); |
|
33 | + if ($sort) { |
|
34 | + $sort = sort($eu_states); |
|
35 | 35 | } |
36 | 36 | |
37 | - return apply_filters( 'wpinv_get_eu_states', $eu_states, $sort ); |
|
37 | + return apply_filters('wpinv_get_eu_states', $eu_states, $sort); |
|
38 | 38 | } |
39 | 39 | |
40 | - public static function get_gst_countries( $sort = true ) { |
|
41 | - $gst_countries = array( 'AU', 'NZ', 'CA', 'CN' ); |
|
40 | + public static function get_gst_countries($sort = true) { |
|
41 | + $gst_countries = array('AU', 'NZ', 'CA', 'CN'); |
|
42 | 42 | |
43 | - if ( $sort ) { |
|
44 | - $sort = sort( $gst_countries ); |
|
43 | + if ($sort) { |
|
44 | + $sort = sort($gst_countries); |
|
45 | 45 | } |
46 | 46 | |
47 | - return apply_filters( 'wpinv_get_gst_countries', $gst_countries, $sort ); |
|
47 | + return apply_filters('wpinv_get_gst_countries', $gst_countries, $sort); |
|
48 | 48 | } |
49 | 49 | |
50 | - public static function is_eu_state( $country_code ) { |
|
51 | - $return = !empty( $country_code ) && in_array( strtoupper( $country_code ), self::get_eu_states() ) ? true : false; |
|
50 | + public static function is_eu_state($country_code) { |
|
51 | + $return = !empty($country_code) && in_array(strtoupper($country_code), self::get_eu_states()) ? true : false; |
|
52 | 52 | |
53 | - return apply_filters( 'wpinv_is_eu_state', $return, $country_code ); |
|
53 | + return apply_filters('wpinv_is_eu_state', $return, $country_code); |
|
54 | 54 | } |
55 | 55 | |
56 | - public static function is_gst_country( $country_code ) { |
|
57 | - $return = !empty( $country_code ) && in_array( strtoupper( $country_code ), self::get_gst_countries() ) ? true : false; |
|
56 | + public static function is_gst_country($country_code) { |
|
57 | + $return = !empty($country_code) && in_array(strtoupper($country_code), self::get_gst_countries()) ? true : false; |
|
58 | 58 | |
59 | - return apply_filters( 'wpinv_is_gst_country', $return, $country_code ); |
|
59 | + return apply_filters('wpinv_is_gst_country', $return, $country_code); |
|
60 | 60 | } |
61 | 61 | |
62 | 62 | /** |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | /** |
68 | 68 | * @deprecated |
69 | 69 | */ |
70 | - public function load_vat_scripts(){} |
|
70 | + public function load_vat_scripts() {} |
|
71 | 71 | |
72 | 72 | /** |
73 | 73 | * @deprecated |
@@ -207,26 +207,26 @@ discard block |
||
207 | 207 | * Retrieves the vat name. |
208 | 208 | */ |
209 | 209 | public function get_vat_name() { |
210 | - $vat_name = wpinv_get_option( 'vat_name' ); |
|
211 | - return empty( $vat_name ) ? __( 'VAT', 'invoicing' ) : sanitize_text_field( $vat_name ); |
|
210 | + $vat_name = wpinv_get_option('vat_name'); |
|
211 | + return empty($vat_name) ? __('VAT', 'invoicing') : sanitize_text_field($vat_name); |
|
212 | 212 | } |
213 | 213 | |
214 | 214 | public static function get_company_name() { |
215 | - $company_name = wpinv_get_option( 'vat_company_name' ); |
|
215 | + $company_name = wpinv_get_option('vat_company_name'); |
|
216 | 216 | |
217 | - return apply_filters( 'wpinv_get_owner_company_name', $company_name ); |
|
217 | + return apply_filters('wpinv_get_owner_company_name', $company_name); |
|
218 | 218 | } |
219 | 219 | |
220 | 220 | public static function get_vat_number() { |
221 | - $vat_number = wpinv_get_option( 'vat_number' ); |
|
221 | + $vat_number = wpinv_get_option('vat_number'); |
|
222 | 222 | |
223 | - return apply_filters( 'wpinv_get_owner_vat_number', $vat_number ); |
|
223 | + return apply_filters('wpinv_get_owner_vat_number', $vat_number); |
|
224 | 224 | } |
225 | 225 | |
226 | 226 | public static function is_vat_validated() { |
227 | - $validated = self::get_vat_number() && wpinv_get_option( 'vat_valid' ); |
|
227 | + $validated = self::get_vat_number() && wpinv_get_option('vat_valid'); |
|
228 | 228 | |
229 | - return apply_filters( 'wpinv_is_owner_vat_validated', $validated ); |
|
229 | + return apply_filters('wpinv_is_owner_vat_validated', $validated); |
|
230 | 230 | } |
231 | 231 | |
232 | 232 | /** |
@@ -237,8 +237,8 @@ discard block |
||
237 | 237 | /** |
238 | 238 | * @deprecated |
239 | 239 | */ |
240 | - public static function offline_check( $vat_number ) { |
|
241 | - return wpinv_regex_validate_vat_number( $vat_number ); |
|
240 | + public static function offline_check($vat_number) { |
|
241 | + return wpinv_regex_validate_vat_number($vat_number); |
|
242 | 242 | } |
243 | 243 | |
244 | 244 | /** |
@@ -269,7 +269,7 @@ discard block |
||
269 | 269 | public static function tax_label() {} |
270 | 270 | |
271 | 271 | public static function standard_rates_label() { |
272 | - return __( 'Standard Rates', 'invoicing' ); |
|
272 | + return __('Standard Rates', 'invoicing'); |
|
273 | 273 | } |
274 | 274 | |
275 | 275 | /** |
@@ -300,11 +300,11 @@ discard block |
||
300 | 300 | |
301 | 301 | public static function get_rules() { |
302 | 302 | $vat_rules = array( |
303 | - 'digital' => __( 'Digital Product', 'invoicing' ), |
|
304 | - 'physical' => __( 'Physical Product', 'invoicing' ), |
|
305 | - '_exempt' => __( 'Tax-Free Product', 'invoicing' ), |
|
303 | + 'digital' => __('Digital Product', 'invoicing'), |
|
304 | + 'physical' => __('Physical Product', 'invoicing'), |
|
305 | + '_exempt' => __('Tax-Free Product', 'invoicing'), |
|
306 | 306 | ); |
307 | - return apply_filters( 'wpinv_get_vat_rules', $vat_rules ); |
|
307 | + return apply_filters('wpinv_get_vat_rules', $vat_rules); |
|
308 | 308 | } |
309 | 309 | |
310 | 310 | /** |
@@ -338,8 +338,8 @@ discard block |
||
338 | 338 | /** |
339 | 339 | * @deprecated |
340 | 340 | */ |
341 | - public static function get_item_class( $postID ) { |
|
342 | - return get_post_meta( $postID, '_wpinv_vat_class', true ); |
|
341 | + public static function get_item_class($postID) { |
|
342 | + return get_post_meta($postID, '_wpinv_vat_class', true); |
|
343 | 343 | } |
344 | 344 | |
345 | 345 | /** |
@@ -352,8 +352,8 @@ discard block |
||
352 | 352 | /** |
353 | 353 | * @deprecated |
354 | 354 | */ |
355 | - public static function get_item_rule( $postID ) { |
|
356 | - return get_post_meta( $postID, '_wpinv_vat_rule', true ); |
|
355 | + public static function get_item_rule($postID) { |
|
356 | + return get_post_meta($postID, '_wpinv_vat_rule', true); |
|
357 | 357 | } |
358 | 358 | |
359 | 359 | /** |