@@ -18,15 +18,15 @@ |
||
18 | 18 | } |
19 | 19 | |
20 | 20 | switch( $items_type ) { |
21 | - case 'radio': |
|
22 | - wpinv_get_template( 'payment-forms/variations/radio.php', compact( 'form', 'items_type' ) ); |
|
23 | - break; |
|
24 | - case 'checkbox': |
|
25 | - wpinv_get_template( 'payment-forms/variations/checkbox.php', compact( 'form', 'items_type' ) ); |
|
26 | - break; |
|
27 | - case 'select': |
|
28 | - wpinv_get_template( 'payment-forms/variations/select.php', compact( 'form', 'items_type' ) ); |
|
29 | - break; |
|
21 | + case 'radio': |
|
22 | + wpinv_get_template( 'payment-forms/variations/radio.php', compact( 'form', 'items_type' ) ); |
|
23 | + break; |
|
24 | + case 'checkbox': |
|
25 | + wpinv_get_template( 'payment-forms/variations/checkbox.php', compact( 'form', 'items_type' ) ); |
|
26 | + break; |
|
27 | + case 'select': |
|
28 | + wpinv_get_template( 'payment-forms/variations/select.php', compact( 'form', 'items_type' ) ); |
|
29 | + break; |
|
30 | 30 | } |
31 | 31 | |
32 | 32 | // Display the cart totals. |
@@ -7,36 +7,36 @@ |
||
7 | 7 | * @version 1.0.19 |
8 | 8 | */ |
9 | 9 | |
10 | -defined( 'ABSPATH' ) || exit; |
|
10 | +defined('ABSPATH') || exit; |
|
11 | 11 | |
12 | -if ( empty( $form->get_items() ) ) { |
|
12 | +if (empty($form->get_items())) { |
|
13 | 13 | return; |
14 | 14 | } |
15 | 15 | |
16 | -if ( empty( $items_type ) ) { |
|
16 | +if (empty($items_type)) { |
|
17 | 17 | $items_type = 'total'; |
18 | 18 | } |
19 | 19 | |
20 | -switch( $items_type ) { |
|
20 | +switch ($items_type) { |
|
21 | 21 | case 'radio': |
22 | - wpinv_get_template( 'payment-forms/variations/radio.php', compact( 'form', 'items_type' ) ); |
|
22 | + wpinv_get_template('payment-forms/variations/radio.php', compact('form', 'items_type')); |
|
23 | 23 | break; |
24 | 24 | case 'checkbox': |
25 | - wpinv_get_template( 'payment-forms/variations/checkbox.php', compact( 'form', 'items_type' ) ); |
|
25 | + wpinv_get_template('payment-forms/variations/checkbox.php', compact('form', 'items_type')); |
|
26 | 26 | break; |
27 | 27 | case 'select': |
28 | - wpinv_get_template( 'payment-forms/variations/select.php', compact( 'form', 'items_type' ) ); |
|
28 | + wpinv_get_template('payment-forms/variations/select.php', compact('form', 'items_type')); |
|
29 | 29 | break; |
30 | 30 | } |
31 | 31 | |
32 | 32 | // Display the cart totals. |
33 | -if ( ! empty( $hide_cart ) ) { |
|
33 | +if (!empty($hide_cart)) { |
|
34 | 34 | echo '<div class="d-none">'; |
35 | 35 | } |
36 | 36 | |
37 | 37 | // Display the cart totals. |
38 | -wpinv_get_template( 'payment-forms/cart.php', compact( 'form', 'items_type' ) ); |
|
38 | +wpinv_get_template('payment-forms/cart.php', compact('form', 'items_type')); |
|
39 | 39 | |
40 | -if ( ! empty( $hide_cart ) ) { |
|
40 | +if (!empty($hide_cart)) { |
|
41 | 41 | echo '</div>'; |
42 | 42 | } |
@@ -13,9 +13,9 @@ discard block |
||
13 | 13 | |
14 | 14 | |
15 | 15 | function wpinv_get_default_country() { |
16 | - $country = wpinv_get_option( 'default_country', 'UK' ); |
|
16 | + $country = wpinv_get_option( 'default_country', 'UK' ); |
|
17 | 17 | |
18 | - return apply_filters( 'wpinv_default_country', $country ); |
|
18 | + return apply_filters( 'wpinv_default_country', $country ); |
|
19 | 19 | } |
20 | 20 | |
21 | 21 | /** |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | */ |
27 | 27 | function wpinv_sanitize_country( $country ) { |
28 | 28 | |
29 | - // Enure the country is specified |
|
29 | + // Enure the country is specified |
|
30 | 30 | if ( empty( $country ) ) { |
31 | 31 | $country = wpinv_get_default_country(); |
32 | 32 | } |
@@ -56,9 +56,9 @@ discard block |
||
56 | 56 | } |
57 | 57 | |
58 | 58 | function wpinv_get_default_state() { |
59 | - $state = wpinv_get_option( 'default_state', false ); |
|
59 | + $state = wpinv_get_option( 'default_state', false ); |
|
60 | 60 | |
61 | - return apply_filters( 'wpinv_default_state', $state ); |
|
61 | + return apply_filters( 'wpinv_default_state', $state ); |
|
62 | 62 | } |
63 | 63 | |
64 | 64 | function wpinv_state_name( $state_code = '', $country_code = '' ) { |
@@ -166,11 +166,11 @@ discard block |
||
166 | 166 | |
167 | 167 | $country = wpinv_sanitize_country( $country ); |
168 | 168 | |
169 | - foreach ( wpinv_get_continents( 'countries' ) as $continent_code => $countries ) { |
|
170 | - if ( false !== array_search( $country, $countries, true ) ) { |
|
171 | - return $continent_code; |
|
172 | - } |
|
173 | - } |
|
169 | + foreach ( wpinv_get_continents( 'countries' ) as $continent_code => $countries ) { |
|
170 | + if ( false !== array_search( $country, $countries, true ) ) { |
|
171 | + return $continent_code; |
|
172 | + } |
|
173 | + } |
|
174 | 174 | |
175 | 175 | return ''; |
176 | 176 | |
@@ -462,30 +462,30 @@ discard block |
||
462 | 462 | } |
463 | 463 | |
464 | 464 | function wpinv_get_states_field() { |
465 | - if( empty( $_POST['country'] ) ) { |
|
466 | - $_POST['country'] = wpinv_get_default_country(); |
|
467 | - } |
|
468 | - $states = wpinv_get_country_states( sanitize_text_field( $_POST['country'] ) ); |
|
465 | + if( empty( $_POST['country'] ) ) { |
|
466 | + $_POST['country'] = wpinv_get_default_country(); |
|
467 | + } |
|
468 | + $states = wpinv_get_country_states( sanitize_text_field( $_POST['country'] ) ); |
|
469 | 469 | |
470 | - if( !empty( $states ) ) { |
|
471 | - $sanitized_field_name = sanitize_text_field( $_POST['field_name'] ); |
|
470 | + if( !empty( $states ) ) { |
|
471 | + $sanitized_field_name = sanitize_text_field( $_POST['field_name'] ); |
|
472 | 472 | |
473 | 473 | $args = array( |
474 | - 'name' => $sanitized_field_name, |
|
475 | - 'id' => $sanitized_field_name, |
|
476 | - 'class' => $sanitized_field_name . 'custom-select wpinv-select wpi_select2', |
|
477 | - 'options' => array_merge( array( '' => '' ), $states ), |
|
478 | - 'show_option_all' => false, |
|
479 | - 'show_option_none' => false |
|
480 | - ); |
|
481 | - |
|
482 | - $response = wpinv_html_select( $args ); |
|
483 | - |
|
484 | - } else { |
|
485 | - $response = 'nostates'; |
|
486 | - } |
|
474 | + 'name' => $sanitized_field_name, |
|
475 | + 'id' => $sanitized_field_name, |
|
476 | + 'class' => $sanitized_field_name . 'custom-select wpinv-select wpi_select2', |
|
477 | + 'options' => array_merge( array( '' => '' ), $states ), |
|
478 | + 'show_option_all' => false, |
|
479 | + 'show_option_none' => false |
|
480 | + ); |
|
481 | + |
|
482 | + $response = wpinv_html_select( $args ); |
|
483 | + |
|
484 | + } else { |
|
485 | + $response = 'nostates'; |
|
486 | + } |
|
487 | 487 | |
488 | - return $response; |
|
488 | + return $response; |
|
489 | 489 | } |
490 | 490 | |
491 | 491 | function wpinv_default_billing_country( $country = '', $user_id = 0 ) { |
@@ -503,46 +503,46 @@ discard block |
||
503 | 503 | */ |
504 | 504 | function wpinv_get_address_formats() { |
505 | 505 | |
506 | - return apply_filters( 'wpinv_localisation_address_formats', |
|
507 | - array( |
|
508 | - 'default' => "{{name}}\n{{company}}\n{{address}}\n{{city}}\n{{state}}\n{{zip}}\n{{country}}", |
|
509 | - 'AU' => "{{name}}\n{{company}}\n{{address}}\n{{city}}\n{{state}} {{zip}}\n{{country}}", |
|
510 | - 'AT' => "{{company}}\n{{name}}\n{{address}}\n{{zip}} {{city}}\n{{country}}", |
|
511 | - 'BE' => "{{company}}\n{{name}}\n{{address}}\n{{zip}} {{city}}\n{{country}}", |
|
512 | - 'CA' => "{{company}}\n{{name}}\n{{address}}\n{{city}} {{state_code}} {{zip}}\n{{country}}", |
|
513 | - 'CH' => "{{company}}\n{{name}}\n{{address}}\n{{zip}} {{city}}\n{{country}}", |
|
514 | - 'CL' => "{{company}}\n{{name}}\n{{address}}\n{{state}}\n{{zip}} {{city}}\n{{country}}", |
|
515 | - 'CN' => "{{country}} {{zip}}\n{{state}}, {{city}}, {{address}}\n{{company}}\n{{name}}", |
|
516 | - 'CZ' => "{{company}}\n{{name}}\n{{address}}\n{{zip}} {{city}}\n{{country}}", |
|
517 | - 'DE' => "{{company}}\n{{name}}\n{{address}}\n{{zip}} {{city}}\n{{country}}", |
|
518 | - 'EE' => "{{company}}\n{{name}}\n{{address}}\n{{zip}} {{city}}\n{{country}}", |
|
519 | - 'FI' => "{{company}}\n{{name}}\n{{address}}\n{{zip}} {{city}}\n{{country}}", |
|
520 | - 'DK' => "{{company}}\n{{name}}\n{{address}}\n{{zip}} {{city}}\n{{country}}", |
|
521 | - 'FR' => "{{company}}\n{{name}}\n{{address}}\n{{zip}} {{city_upper}}\n{{country}}", |
|
522 | - 'HK' => "{{company}}\n{{first_name}} {{last_name_upper}}\n{{address}}\n{{city_upper}}\n{{state_upper}}\n{{country}}", |
|
523 | - 'HU' => "{{name}}\n{{company}}\n{{city}}\n{{address}}\n{{zip}}\n{{country}}", |
|
524 | - 'IN' => "{{company}}\n{{name}}\n{{address}}\n{{city}} {{zip}}\n{{state}}, {{country}}", |
|
525 | - 'IS' => "{{company}}\n{{name}}\n{{address}}\n{{zip}} {{city}}\n{{country}}", |
|
526 | - 'IT' => "{{company}}\n{{name}}\n{{address}}\n{{zip}}\n{{city}}\n{{state_upper}}\n{{country}}", |
|
527 | - 'JP' => "{{zip}}\n{{state}} {{city}} {{address}}\n{{company}}\n{{last_name}} {{first_name}}\n{{country}}", |
|
528 | - 'TW' => "{{company}}\n{{last_name}} {{first_name}}\n{{address}}\n{{state}}, {{city}} {{zip}}\n{{country}}", |
|
529 | - 'LI' => "{{company}}\n{{name}}\n{{address}}\n{{zip}} {{city}}\n{{country}}", |
|
530 | - 'NL' => "{{company}}\n{{name}}\n{{address}}\n{{zip}} {{city}}\n{{country}}", |
|
531 | - 'NZ' => "{{name}}\n{{company}}\n{{address}}\n{{city}} {{zip}}\n{{country}}", |
|
532 | - 'NO' => "{{company}}\n{{name}}\n{{address}}\n{{zip}} {{city}}\n{{country}}", |
|
533 | - 'PL' => "{{company}}\n{{name}}\n{{address}}\n{{zip}} {{city}}\n{{country}}", |
|
534 | - 'PT' => "{{company}}\n{{name}}\n{{address}}\n{{zip}} {{city}}\n{{country}}", |
|
535 | - 'SK' => "{{company}}\n{{name}}\n{{address}}\n{{zip}} {{city}}\n{{country}}", |
|
536 | - 'RS' => "{{name}}\n{{company}}\n{{address}}\n{{zip}} {{city}}\n{{country}}", |
|
537 | - 'SI' => "{{company}}\n{{name}}\n{{address}}\n{{zip}} {{city}}\n{{country}}", |
|
538 | - 'ES' => "{{name}}\n{{company}}\n{{address}}\n{{zip}} {{city}}\n{{state}}\n{{country}}", |
|
539 | - 'SE' => "{{company}}\n{{name}}\n{{address}}\n{{zip}} {{city}}\n{{country}}", |
|
540 | - 'TR' => "{{name}}\n{{company}}\n{{address}}\n{{zip}} {{city}} {{state}}\n{{country}}", |
|
541 | - 'UG' => "{{name}}\n{{company}}\n{{address}}\n{{city}}\n{{state}}, {{country}}", |
|
542 | - 'US' => "{{name}}\n{{company}}\n{{address}}\n{{city}}, {{state_code}} {{zip}}\n{{country}}", |
|
543 | - 'VN' => "{{name}}\n{{company}}\n{{address}}\n{{city}}\n{{country}}", |
|
544 | - ) |
|
545 | - ); |
|
506 | + return apply_filters( 'wpinv_localisation_address_formats', |
|
507 | + array( |
|
508 | + 'default' => "{{name}}\n{{company}}\n{{address}}\n{{city}}\n{{state}}\n{{zip}}\n{{country}}", |
|
509 | + 'AU' => "{{name}}\n{{company}}\n{{address}}\n{{city}}\n{{state}} {{zip}}\n{{country}}", |
|
510 | + 'AT' => "{{company}}\n{{name}}\n{{address}}\n{{zip}} {{city}}\n{{country}}", |
|
511 | + 'BE' => "{{company}}\n{{name}}\n{{address}}\n{{zip}} {{city}}\n{{country}}", |
|
512 | + 'CA' => "{{company}}\n{{name}}\n{{address}}\n{{city}} {{state_code}} {{zip}}\n{{country}}", |
|
513 | + 'CH' => "{{company}}\n{{name}}\n{{address}}\n{{zip}} {{city}}\n{{country}}", |
|
514 | + 'CL' => "{{company}}\n{{name}}\n{{address}}\n{{state}}\n{{zip}} {{city}}\n{{country}}", |
|
515 | + 'CN' => "{{country}} {{zip}}\n{{state}}, {{city}}, {{address}}\n{{company}}\n{{name}}", |
|
516 | + 'CZ' => "{{company}}\n{{name}}\n{{address}}\n{{zip}} {{city}}\n{{country}}", |
|
517 | + 'DE' => "{{company}}\n{{name}}\n{{address}}\n{{zip}} {{city}}\n{{country}}", |
|
518 | + 'EE' => "{{company}}\n{{name}}\n{{address}}\n{{zip}} {{city}}\n{{country}}", |
|
519 | + 'FI' => "{{company}}\n{{name}}\n{{address}}\n{{zip}} {{city}}\n{{country}}", |
|
520 | + 'DK' => "{{company}}\n{{name}}\n{{address}}\n{{zip}} {{city}}\n{{country}}", |
|
521 | + 'FR' => "{{company}}\n{{name}}\n{{address}}\n{{zip}} {{city_upper}}\n{{country}}", |
|
522 | + 'HK' => "{{company}}\n{{first_name}} {{last_name_upper}}\n{{address}}\n{{city_upper}}\n{{state_upper}}\n{{country}}", |
|
523 | + 'HU' => "{{name}}\n{{company}}\n{{city}}\n{{address}}\n{{zip}}\n{{country}}", |
|
524 | + 'IN' => "{{company}}\n{{name}}\n{{address}}\n{{city}} {{zip}}\n{{state}}, {{country}}", |
|
525 | + 'IS' => "{{company}}\n{{name}}\n{{address}}\n{{zip}} {{city}}\n{{country}}", |
|
526 | + 'IT' => "{{company}}\n{{name}}\n{{address}}\n{{zip}}\n{{city}}\n{{state_upper}}\n{{country}}", |
|
527 | + 'JP' => "{{zip}}\n{{state}} {{city}} {{address}}\n{{company}}\n{{last_name}} {{first_name}}\n{{country}}", |
|
528 | + 'TW' => "{{company}}\n{{last_name}} {{first_name}}\n{{address}}\n{{state}}, {{city}} {{zip}}\n{{country}}", |
|
529 | + 'LI' => "{{company}}\n{{name}}\n{{address}}\n{{zip}} {{city}}\n{{country}}", |
|
530 | + 'NL' => "{{company}}\n{{name}}\n{{address}}\n{{zip}} {{city}}\n{{country}}", |
|
531 | + 'NZ' => "{{name}}\n{{company}}\n{{address}}\n{{city}} {{zip}}\n{{country}}", |
|
532 | + 'NO' => "{{company}}\n{{name}}\n{{address}}\n{{zip}} {{city}}\n{{country}}", |
|
533 | + 'PL' => "{{company}}\n{{name}}\n{{address}}\n{{zip}} {{city}}\n{{country}}", |
|
534 | + 'PT' => "{{company}}\n{{name}}\n{{address}}\n{{zip}} {{city}}\n{{country}}", |
|
535 | + 'SK' => "{{company}}\n{{name}}\n{{address}}\n{{zip}} {{city}}\n{{country}}", |
|
536 | + 'RS' => "{{name}}\n{{company}}\n{{address}}\n{{zip}} {{city}}\n{{country}}", |
|
537 | + 'SI' => "{{company}}\n{{name}}\n{{address}}\n{{zip}} {{city}}\n{{country}}", |
|
538 | + 'ES' => "{{name}}\n{{company}}\n{{address}}\n{{zip}} {{city}}\n{{state}}\n{{country}}", |
|
539 | + 'SE' => "{{company}}\n{{name}}\n{{address}}\n{{zip}} {{city}}\n{{country}}", |
|
540 | + 'TR' => "{{name}}\n{{company}}\n{{address}}\n{{zip}} {{city}} {{state}}\n{{country}}", |
|
541 | + 'UG' => "{{name}}\n{{company}}\n{{address}}\n{{city}}\n{{state}}, {{country}}", |
|
542 | + 'US' => "{{name}}\n{{company}}\n{{address}}\n{{city}}, {{state_code}} {{zip}}\n{{country}}", |
|
543 | + 'VN' => "{{name}}\n{{company}}\n{{address}}\n{{city}}\n{{country}}", |
|
544 | + ) |
|
545 | + ); |
|
546 | 546 | } |
547 | 547 | |
548 | 548 | /** |
@@ -559,21 +559,21 @@ discard block |
||
559 | 559 | } |
560 | 560 | |
561 | 561 | // Get all formats. |
562 | - $formats = wpinv_get_address_formats(); |
|
562 | + $formats = wpinv_get_address_formats(); |
|
563 | 563 | |
564 | - // Get format for the specified country. |
|
565 | - $format = ( $country && isset( $formats[ $country ] ) ) ? $formats[ $country ] : $formats['default']; |
|
564 | + // Get format for the specified country. |
|
565 | + $format = ( $country && isset( $formats[ $country ] ) ) ? $formats[ $country ] : $formats['default']; |
|
566 | 566 | |
567 | 567 | /** |
568 | - * Filters the address format to use on Invoices. |
|
568 | + * Filters the address format to use on Invoices. |
|
569 | 569 | * |
570 | 570 | * New lines will be replaced by a `br` element. Double new lines will be replaced by a paragraph. HTML tags are allowed. |
571 | - * |
|
572 | - * @since 1.0.13 |
|
573 | - * |
|
574 | - * @param string $format The address format to use. |
|
571 | + * |
|
572 | + * @since 1.0.13 |
|
573 | + * |
|
574 | + * @param string $format The address format to use. |
|
575 | 575 | * @param string $country The country who's address format is being retrieved. |
576 | - */ |
|
576 | + */ |
|
577 | 577 | return apply_filters( 'wpinv_get_full_address_format', $format, $country ); |
578 | 578 | } |
579 | 579 | |
@@ -594,8 +594,8 @@ discard block |
||
594 | 594 | 'country' => '', |
595 | 595 | 'zip' => '', |
596 | 596 | 'first_name' => '', |
597 | - 'last_name' => '', |
|
598 | - 'company' => '', |
|
597 | + 'last_name' => '', |
|
598 | + 'company' => '', |
|
599 | 599 | ); |
600 | 600 | |
601 | 601 | $args = map_deep( wp_parse_args( $billing_details, $default_args ), 'trim' ); |
@@ -616,14 +616,14 @@ discard block |
||
616 | 616 | $args['country_code']= $country; |
617 | 617 | |
618 | 618 | /** |
619 | - * Filters the address format replacements to use on Invoices. |
|
619 | + * Filters the address format replacements to use on Invoices. |
|
620 | 620 | * |
621 | - * |
|
622 | - * @since 1.0.13 |
|
623 | - * |
|
624 | - * @param array $replacements The address replacements to use. |
|
621 | + * |
|
622 | + * @since 1.0.13 |
|
623 | + * |
|
624 | + * @param array $replacements The address replacements to use. |
|
625 | 625 | * @param array $billing_details The billing details to use. |
626 | - */ |
|
626 | + */ |
|
627 | 627 | $replacements = apply_filters( 'wpinv_get_invoice_address_replacements', $args, $billing_details ); |
628 | 628 | |
629 | 629 | $return = array(); |
@@ -646,5 +646,5 @@ discard block |
||
646 | 646 | * @return string |
647 | 647 | */ |
648 | 648 | function wpinv_trim_formatted_address_line( $line ) { |
649 | - return trim( $line, ', ' ); |
|
649 | + return trim( $line, ', ' ); |
|
650 | 650 | } |
651 | 651 | \ No newline at end of file |
@@ -7,15 +7,15 @@ discard block |
||
7 | 7 | */ |
8 | 8 | |
9 | 9 | // MUST have WordPress. |
10 | -if ( !defined( 'WPINC' ) ) { |
|
11 | - exit( 'Do NOT access this file directly: ' . basename( __FILE__ ) ); |
|
10 | +if (!defined('WPINC')) { |
|
11 | + exit('Do NOT access this file directly: ' . basename(__FILE__)); |
|
12 | 12 | } |
13 | 13 | |
14 | 14 | |
15 | 15 | function wpinv_get_default_country() { |
16 | - $country = wpinv_get_option( 'default_country', 'UK' ); |
|
16 | + $country = wpinv_get_option('default_country', 'UK'); |
|
17 | 17 | |
18 | - return apply_filters( 'wpinv_default_country', $country ); |
|
18 | + return apply_filters('wpinv_default_country', $country); |
|
19 | 19 | } |
20 | 20 | |
21 | 21 | /** |
@@ -24,59 +24,59 @@ discard block |
||
24 | 24 | * @param string $country The country code to sanitize |
25 | 25 | * @return array |
26 | 26 | */ |
27 | -function wpinv_sanitize_country( $country ) { |
|
27 | +function wpinv_sanitize_country($country) { |
|
28 | 28 | |
29 | 29 | // Enure the country is specified |
30 | - if ( empty( $country ) ) { |
|
30 | + if (empty($country)) { |
|
31 | 31 | $country = wpinv_get_default_country(); |
32 | 32 | } |
33 | - return trim( wpinv_utf8_strtoupper( $country ) ); |
|
33 | + return trim(wpinv_utf8_strtoupper($country)); |
|
34 | 34 | |
35 | 35 | } |
36 | 36 | |
37 | -function wpinv_is_base_country( $country ) { |
|
37 | +function wpinv_is_base_country($country) { |
|
38 | 38 | $base_country = wpinv_get_default_country(); |
39 | 39 | |
40 | - if ( $base_country === 'UK' ) { |
|
40 | + if ($base_country === 'UK') { |
|
41 | 41 | $base_country = 'GB'; |
42 | 42 | } |
43 | - if ( $country == 'UK' ) { |
|
43 | + if ($country == 'UK') { |
|
44 | 44 | $country = 'GB'; |
45 | 45 | } |
46 | 46 | |
47 | - return ( $country && $country === $base_country ) ? true : false; |
|
47 | + return ($country && $country === $base_country) ? true : false; |
|
48 | 48 | } |
49 | 49 | |
50 | -function wpinv_country_name( $country_code = '' ) { |
|
50 | +function wpinv_country_name($country_code = '') { |
|
51 | 51 | $countries = wpinv_get_country_list(); |
52 | 52 | $country_code = $country_code == 'UK' ? 'GB' : $country_code; |
53 | - $country = isset( $countries[$country_code] ) ? $countries[$country_code] : $country_code; |
|
53 | + $country = isset($countries[$country_code]) ? $countries[$country_code] : $country_code; |
|
54 | 54 | |
55 | - return apply_filters( 'wpinv_country_name', $country, $country_code ); |
|
55 | + return apply_filters('wpinv_country_name', $country, $country_code); |
|
56 | 56 | } |
57 | 57 | |
58 | 58 | function wpinv_get_default_state() { |
59 | - $state = wpinv_get_option( 'default_state', false ); |
|
59 | + $state = wpinv_get_option('default_state', false); |
|
60 | 60 | |
61 | - return apply_filters( 'wpinv_default_state', $state ); |
|
61 | + return apply_filters('wpinv_default_state', $state); |
|
62 | 62 | } |
63 | 63 | |
64 | -function wpinv_state_name( $state_code = '', $country_code = '' ) { |
|
64 | +function wpinv_state_name($state_code = '', $country_code = '') { |
|
65 | 65 | $state = $state_code; |
66 | 66 | |
67 | - if ( !empty( $country_code ) ) { |
|
68 | - $states = wpinv_get_country_states( $country_code ); |
|
67 | + if (!empty($country_code)) { |
|
68 | + $states = wpinv_get_country_states($country_code); |
|
69 | 69 | |
70 | - $state = !empty( $states ) && isset( $states[$state_code] ) ? $states[$state_code] : $state; |
|
70 | + $state = !empty($states) && isset($states[$state_code]) ? $states[$state_code] : $state; |
|
71 | 71 | } |
72 | 72 | |
73 | - return apply_filters( 'wpinv_state_name', $state, $state_code, $country_code ); |
|
73 | + return apply_filters('wpinv_state_name', $state, $state_code, $country_code); |
|
74 | 74 | } |
75 | 75 | |
76 | 76 | function wpinv_store_address() { |
77 | - $address = wpinv_get_option( 'store_address', '' ); |
|
77 | + $address = wpinv_get_option('store_address', ''); |
|
78 | 78 | |
79 | - return apply_filters( 'wpinv_store_address', $address ); |
|
79 | + return apply_filters('wpinv_store_address', $address); |
|
80 | 80 | } |
81 | 81 | |
82 | 82 | /** |
@@ -84,24 +84,24 @@ discard block |
||
84 | 84 | * |
85 | 85 | * @param WPInv_Invoice $invoice |
86 | 86 | */ |
87 | -function getpaid_maybe_add_default_address( &$invoice ) { |
|
87 | +function getpaid_maybe_add_default_address(&$invoice) { |
|
88 | 88 | |
89 | 89 | $user_id = $invoice->get_user_id(); |
90 | 90 | |
91 | 91 | // Abort if the invoice belongs to no one. |
92 | - if ( empty( $user_id ) ) { |
|
92 | + if (empty($user_id)) { |
|
93 | 93 | return; |
94 | 94 | } |
95 | 95 | |
96 | 96 | // Fill in defaults whenever necessary. |
97 | - foreach ( wpinv_get_user_address( $user_id ) as $key => $value ) { |
|
97 | + foreach (wpinv_get_user_address($user_id) as $key => $value) { |
|
98 | 98 | |
99 | - if ( is_callable( $invoice, "get_$key" ) ) { |
|
100 | - $current = call_user_func( array( $invoice, "get_$key" ) ); |
|
99 | + if (is_callable($invoice, "get_$key")) { |
|
100 | + $current = call_user_func(array($invoice, "get_$key")); |
|
101 | 101 | |
102 | - if ( empty( $current ) ) { |
|
102 | + if (empty($current)) { |
|
103 | 103 | $method = "set_$key"; |
104 | - $invoice->$method( $value ); |
|
104 | + $invoice->$method($value); |
|
105 | 105 | } |
106 | 106 | |
107 | 107 | } |
@@ -140,24 +140,24 @@ discard block |
||
140 | 140 | * |
141 | 141 | * @param WPInv_Invoice $invoice |
142 | 142 | */ |
143 | -function getpaid_save_invoice_user_address( $invoice ) { |
|
143 | +function getpaid_save_invoice_user_address($invoice) { |
|
144 | 144 | |
145 | 145 | // Retrieve the invoice. |
146 | - $invoice = wpinv_get_invoice( $invoice ); |
|
146 | + $invoice = wpinv_get_invoice($invoice); |
|
147 | 147 | |
148 | 148 | // Abort if it does not exist. |
149 | - if ( empty( $invoice ) ) { |
|
149 | + if (empty($invoice)) { |
|
150 | 150 | return; |
151 | 151 | } |
152 | 152 | |
153 | - foreach ( getpaid_user_address_fields() as $field ) { |
|
153 | + foreach (getpaid_user_address_fields() as $field) { |
|
154 | 154 | |
155 | - if ( is_callable( array( $invoice, "get_$field" ) ) ) { |
|
156 | - $value = call_user_func( array( $invoice, "get_$field" ) ); |
|
155 | + if (is_callable(array($invoice, "get_$field"))) { |
|
156 | + $value = call_user_func(array($invoice, "get_$field")); |
|
157 | 157 | |
158 | 158 | // Only save if it is not empty. |
159 | - if ( ! empty( $value ) ) { |
|
160 | - update_user_meta( $invoice->get_user_id(), '_wpinv_' . $field, $value ); |
|
159 | + if (!empty($value)) { |
|
160 | + update_user_meta($invoice->get_user_id(), '_wpinv_' . $field, $value); |
|
161 | 161 | } |
162 | 162 | |
163 | 163 | } |
@@ -165,8 +165,8 @@ discard block |
||
165 | 165 | } |
166 | 166 | |
167 | 167 | } |
168 | -add_action( 'getpaid_new_invoice', 'getpaid_save_invoice_user_address' ); |
|
169 | -add_action( 'getpaid_update_invoice', 'getpaid_save_invoice_user_address' ); |
|
168 | +add_action('getpaid_new_invoice', 'getpaid_save_invoice_user_address'); |
|
169 | +add_action('getpaid_update_invoice', 'getpaid_save_invoice_user_address'); |
|
170 | 170 | |
171 | 171 | /** |
172 | 172 | * Retrieves a saved user address. |
@@ -175,14 +175,14 @@ discard block |
||
175 | 175 | * @param bool $with_default Whether or not we should use the default country and state. |
176 | 176 | * @return array |
177 | 177 | */ |
178 | -function wpinv_get_user_address( $user_id = 0, $with_default = true ) { |
|
178 | +function wpinv_get_user_address($user_id = 0, $with_default = true) { |
|
179 | 179 | |
180 | 180 | // Prepare the user id. |
181 | - $user_id = empty( $user_id ) ? get_current_user_id() : $user_id; |
|
182 | - $user_info = get_userdata( $user_id ); |
|
181 | + $user_id = empty($user_id) ? get_current_user_id() : $user_id; |
|
182 | + $user_info = get_userdata($user_id); |
|
183 | 183 | |
184 | 184 | // Abort if non exists. |
185 | - if ( empty( $user_info ) ) { |
|
185 | + if (empty($user_info)) { |
|
186 | 186 | return array(); |
187 | 187 | } |
188 | 188 | |
@@ -192,27 +192,27 @@ discard block |
||
192 | 192 | 'email' => $user_info->user_email, |
193 | 193 | ); |
194 | 194 | |
195 | - foreach ( getpaid_user_address_fields() as $field ) { |
|
196 | - $address[$field] = getpaid_get_user_address_field( $user_id, $field ); |
|
195 | + foreach (getpaid_user_address_fields() as $field) { |
|
196 | + $address[$field] = getpaid_get_user_address_field($user_id, $field); |
|
197 | 197 | } |
198 | 198 | |
199 | - if ( ! $with_default ) { |
|
199 | + if (!$with_default) { |
|
200 | 200 | return $address; |
201 | 201 | } |
202 | 202 | |
203 | - if ( isset( $address['first_name'] ) && empty( $address['first_name'] ) ) { |
|
203 | + if (isset($address['first_name']) && empty($address['first_name'])) { |
|
204 | 204 | $address['first_name'] = $user_info->first_name; |
205 | 205 | } |
206 | 206 | |
207 | - if ( isset( $address['last_name'] ) && empty( $address['last_name'] ) ) { |
|
207 | + if (isset($address['last_name']) && empty($address['last_name'])) { |
|
208 | 208 | $address['last_name'] = $user_info->last_name; |
209 | 209 | } |
210 | 210 | |
211 | - if ( isset( $address['state'] ) && empty( $address['state'] ) ) { |
|
211 | + if (isset($address['state']) && empty($address['state'])) { |
|
212 | 212 | $address['state'] = wpinv_get_default_state(); |
213 | 213 | } |
214 | 214 | |
215 | - if ( isset( $address['country'] ) && empty( $address['country'] ) ) { |
|
215 | + if (isset($address['country']) && empty($address['country'])) { |
|
216 | 216 | $address['country'] = wpinv_get_default_country(); |
217 | 217 | } |
218 | 218 | |
@@ -226,7 +226,7 @@ discard block |
||
226 | 226 | * @param string $field The field to use. |
227 | 227 | * @return string|null |
228 | 228 | */ |
229 | -function getpaid_get_user_address_field( $user_id, $field ) { |
|
229 | +function getpaid_get_user_address_field($user_id, $field) { |
|
230 | 230 | |
231 | 231 | $prefixes = array( |
232 | 232 | '_wpinv_', |
@@ -234,15 +234,15 @@ discard block |
||
234 | 234 | '' |
235 | 235 | ); |
236 | 236 | |
237 | - foreach ( $prefixes as $prefix ) { |
|
237 | + foreach ($prefixes as $prefix) { |
|
238 | 238 | |
239 | 239 | // Meta table. |
240 | - $value = get_user_meta( $user_id, $prefix . $field, true ); |
|
240 | + $value = get_user_meta($user_id, $prefix . $field, true); |
|
241 | 241 | |
242 | 242 | // UWP table. |
243 | - $value = ( empty( $value ) && function_exists( 'uwp_get_usermeta' ) ) ? uwp_get_usermeta( $user_id, $prefix . $field ) : $value; |
|
243 | + $value = (empty($value) && function_exists('uwp_get_usermeta')) ? uwp_get_usermeta($user_id, $prefix . $field) : $value; |
|
244 | 244 | |
245 | - if ( ! empty( $value ) ) { |
|
245 | + if (!empty($value)) { |
|
246 | 246 | return $value; |
247 | 247 | } |
248 | 248 | |
@@ -259,16 +259,16 @@ discard block |
||
259 | 259 | * @param string $return What to return. |
260 | 260 | * @return array |
261 | 261 | */ |
262 | -function wpinv_get_continents( $return = 'all' ) { |
|
262 | +function wpinv_get_continents($return = 'all') { |
|
263 | 263 | |
264 | - $continents = wpinv_get_data( 'continents' ); |
|
264 | + $continents = wpinv_get_data('continents'); |
|
265 | 265 | |
266 | - switch( $return ) { |
|
266 | + switch ($return) { |
|
267 | 267 | case 'name' : |
268 | - return wp_list_pluck( $continents, 'name' ); |
|
268 | + return wp_list_pluck($continents, 'name'); |
|
269 | 269 | break; |
270 | 270 | case 'countries' : |
271 | - return wp_list_pluck( $continents, 'countries' ); |
|
271 | + return wp_list_pluck($continents, 'countries'); |
|
272 | 272 | break; |
273 | 273 | default : |
274 | 274 | return $continents; |
@@ -284,12 +284,12 @@ discard block |
||
284 | 284 | * @param string $country Country code. If no code is specified, defaults to the default country. |
285 | 285 | * @return string |
286 | 286 | */ |
287 | -function wpinv_get_continent_code_for_country( $country = false ) { |
|
287 | +function wpinv_get_continent_code_for_country($country = false) { |
|
288 | 288 | |
289 | - $country = wpinv_sanitize_country( $country ); |
|
289 | + $country = wpinv_sanitize_country($country); |
|
290 | 290 | |
291 | - foreach ( wpinv_get_continents( 'countries' ) as $continent_code => $countries ) { |
|
292 | - if ( false !== array_search( $country, $countries, true ) ) { |
|
291 | + foreach (wpinv_get_continents('countries') as $continent_code => $countries) { |
|
292 | + if (false !== array_search($country, $countries, true)) { |
|
293 | 293 | return $continent_code; |
294 | 294 | } |
295 | 295 | } |
@@ -305,13 +305,13 @@ discard block |
||
305 | 305 | * @param string $country Country code. If no code is specified, defaults to the default country. |
306 | 306 | * @return array |
307 | 307 | */ |
308 | -function wpinv_get_country_calling_code( $country = null) { |
|
308 | +function wpinv_get_country_calling_code($country = null) { |
|
309 | 309 | |
310 | - $country = wpinv_sanitize_country( $country ); |
|
311 | - $codes = wpinv_get_data( 'phone-codes' ); |
|
312 | - $code = isset( $codes[ $country ] ) ? $codes[ $country ] : ''; |
|
310 | + $country = wpinv_sanitize_country($country); |
|
311 | + $codes = wpinv_get_data('phone-codes'); |
|
312 | + $code = isset($codes[$country]) ? $codes[$country] : ''; |
|
313 | 313 | |
314 | - if ( is_array( $code ) ) { |
|
314 | + if (is_array($code)) { |
|
315 | 315 | return $code[0]; |
316 | 316 | } |
317 | 317 | return $code; |
@@ -324,8 +324,8 @@ discard block |
||
324 | 324 | * @param bool $first_empty Whether or not the first item in the list should be empty |
325 | 325 | * @return array |
326 | 326 | */ |
327 | -function wpinv_get_country_list( $first_empty = false ) { |
|
328 | - return wpinv_maybe_add_empty_option( apply_filters( 'wpinv_countries', wpinv_get_data( 'countries' ) ), $first_empty ); |
|
327 | +function wpinv_get_country_list($first_empty = false) { |
|
328 | + return wpinv_maybe_add_empty_option(apply_filters('wpinv_countries', wpinv_get_data('countries')), $first_empty); |
|
329 | 329 | } |
330 | 330 | |
331 | 331 | /** |
@@ -335,22 +335,22 @@ discard block |
||
335 | 335 | * @param bool $first_empty Whether or not the first item in the list should be empty |
336 | 336 | * @return array |
337 | 337 | */ |
338 | -function wpinv_get_country_states( $country = null, $first_empty = false ) { |
|
338 | +function wpinv_get_country_states($country = null, $first_empty = false) { |
|
339 | 339 | |
340 | 340 | // Prepare the country. |
341 | - $country = wpinv_sanitize_country( $country ); |
|
341 | + $country = wpinv_sanitize_country($country); |
|
342 | 342 | |
343 | 343 | // Fetch all states. |
344 | - $all_states = wpinv_get_data( 'states' ); |
|
344 | + $all_states = wpinv_get_data('states'); |
|
345 | 345 | |
346 | 346 | // Fetch the specified country's states. |
347 | - $states = isset( $all_states[ $country ] ) ? $all_states[ $country ] : array() ; |
|
348 | - $states = apply_filters( "wpinv_{$country}_states", $states ); |
|
349 | - $states = apply_filters( 'wpinv_country_states', $states, $country ); |
|
347 | + $states = isset($all_states[$country]) ? $all_states[$country] : array(); |
|
348 | + $states = apply_filters("wpinv_{$country}_states", $states); |
|
349 | + $states = apply_filters('wpinv_country_states', $states, $country); |
|
350 | 350 | |
351 | - asort( $states ); |
|
351 | + asort($states); |
|
352 | 352 | |
353 | - return wpinv_maybe_add_empty_option( $states, $first_empty ); |
|
353 | + return wpinv_maybe_add_empty_option($states, $first_empty); |
|
354 | 354 | } |
355 | 355 | |
356 | 356 | /** |
@@ -360,7 +360,7 @@ discard block |
||
360 | 360 | * @return array |
361 | 361 | */ |
362 | 362 | function wpinv_get_us_states_list() { |
363 | - return apply_filters( 'wpinv_usa_states', wpinv_get_country_states( 'US' ) ); |
|
363 | + return apply_filters('wpinv_usa_states', wpinv_get_country_states('US')); |
|
364 | 364 | } |
365 | 365 | |
366 | 366 | /** |
@@ -370,7 +370,7 @@ discard block |
||
370 | 370 | * @return array |
371 | 371 | */ |
372 | 372 | function wpinv_get_canada_states_list() { |
373 | - return apply_filters( 'wpinv_canada_provinces', wpinv_get_country_states( 'CA' ) ); |
|
373 | + return apply_filters('wpinv_canada_provinces', wpinv_get_country_states('CA')); |
|
374 | 374 | } |
375 | 375 | |
376 | 376 | /** |
@@ -380,7 +380,7 @@ discard block |
||
380 | 380 | * @return array |
381 | 381 | */ |
382 | 382 | function wpinv_get_australia_states_list() { |
383 | - return apply_filters( 'wpinv_australia_states', wpinv_get_country_states( 'AU' ) ); |
|
383 | + return apply_filters('wpinv_australia_states', wpinv_get_country_states('AU')); |
|
384 | 384 | } |
385 | 385 | |
386 | 386 | /** |
@@ -390,7 +390,7 @@ discard block |
||
390 | 390 | * @return array |
391 | 391 | */ |
392 | 392 | function wpinv_get_bangladesh_states_list() { |
393 | - return apply_filters( 'wpinv_bangladesh_states', wpinv_get_country_states( 'BD' ) ); |
|
393 | + return apply_filters('wpinv_bangladesh_states', wpinv_get_country_states('BD')); |
|
394 | 394 | } |
395 | 395 | |
396 | 396 | /** |
@@ -400,7 +400,7 @@ discard block |
||
400 | 400 | * @return array |
401 | 401 | */ |
402 | 402 | function wpinv_get_brazil_states_list() { |
403 | - return apply_filters( 'wpinv_brazil_states', wpinv_get_country_states( 'BR' ) ); |
|
403 | + return apply_filters('wpinv_brazil_states', wpinv_get_country_states('BR')); |
|
404 | 404 | } |
405 | 405 | |
406 | 406 | /** |
@@ -410,7 +410,7 @@ discard block |
||
410 | 410 | * @return array |
411 | 411 | */ |
412 | 412 | function wpinv_get_bulgaria_states_list() { |
413 | - return apply_filters( 'wpinv_bulgaria_states', wpinv_get_country_states( 'BG' ) ); |
|
413 | + return apply_filters('wpinv_bulgaria_states', wpinv_get_country_states('BG')); |
|
414 | 414 | } |
415 | 415 | |
416 | 416 | /** |
@@ -420,7 +420,7 @@ discard block |
||
420 | 420 | * @return array |
421 | 421 | */ |
422 | 422 | function wpinv_get_hong_kong_states_list() { |
423 | - return apply_filters( 'wpinv_hong_kong_states', wpinv_get_country_states( 'HK' ) ); |
|
423 | + return apply_filters('wpinv_hong_kong_states', wpinv_get_country_states('HK')); |
|
424 | 424 | } |
425 | 425 | |
426 | 426 | /** |
@@ -430,7 +430,7 @@ discard block |
||
430 | 430 | * @return array |
431 | 431 | */ |
432 | 432 | function wpinv_get_hungary_states_list() { |
433 | - return apply_filters( 'wpinv_hungary_states', wpinv_get_country_states( 'HU' ) ); |
|
433 | + return apply_filters('wpinv_hungary_states', wpinv_get_country_states('HU')); |
|
434 | 434 | } |
435 | 435 | |
436 | 436 | /** |
@@ -440,7 +440,7 @@ discard block |
||
440 | 440 | * @return array |
441 | 441 | */ |
442 | 442 | function wpinv_get_japan_states_list() { |
443 | - return apply_filters( 'wpinv_japan_states', wpinv_get_country_states( 'JP' ) ); |
|
443 | + return apply_filters('wpinv_japan_states', wpinv_get_country_states('JP')); |
|
444 | 444 | } |
445 | 445 | |
446 | 446 | /** |
@@ -450,7 +450,7 @@ discard block |
||
450 | 450 | * @return array |
451 | 451 | */ |
452 | 452 | function wpinv_get_china_states_list() { |
453 | - return apply_filters( 'wpinv_china_states', wpinv_get_country_states( 'CN' ) ); |
|
453 | + return apply_filters('wpinv_china_states', wpinv_get_country_states('CN')); |
|
454 | 454 | } |
455 | 455 | |
456 | 456 | /** |
@@ -460,7 +460,7 @@ discard block |
||
460 | 460 | * @return array |
461 | 461 | */ |
462 | 462 | function wpinv_get_new_zealand_states_list() { |
463 | - return apply_filters( 'wpinv_new_zealand_states', wpinv_get_country_states( 'NZ' ) ); |
|
463 | + return apply_filters('wpinv_new_zealand_states', wpinv_get_country_states('NZ')); |
|
464 | 464 | } |
465 | 465 | |
466 | 466 | /** |
@@ -470,7 +470,7 @@ discard block |
||
470 | 470 | * @return array |
471 | 471 | */ |
472 | 472 | function wpinv_get_peru_states_list() { |
473 | - return apply_filters( 'wpinv_peru_states', wpinv_get_country_states( 'PE' ) ); |
|
473 | + return apply_filters('wpinv_peru_states', wpinv_get_country_states('PE')); |
|
474 | 474 | } |
475 | 475 | |
476 | 476 | /** |
@@ -480,7 +480,7 @@ discard block |
||
480 | 480 | * @return array |
481 | 481 | */ |
482 | 482 | function wpinv_get_indonesia_states_list() { |
483 | - return apply_filters( 'wpinv_indonesia_states', wpinv_get_country_states( 'ID' ) ); |
|
483 | + return apply_filters('wpinv_indonesia_states', wpinv_get_country_states('ID')); |
|
484 | 484 | } |
485 | 485 | |
486 | 486 | /** |
@@ -490,7 +490,7 @@ discard block |
||
490 | 490 | * @return array |
491 | 491 | */ |
492 | 492 | function wpinv_get_india_states_list() { |
493 | - return apply_filters( 'wpinv_india_states', wpinv_get_country_states( 'IN' ) ); |
|
493 | + return apply_filters('wpinv_india_states', wpinv_get_country_states('IN')); |
|
494 | 494 | } |
495 | 495 | |
496 | 496 | /** |
@@ -500,7 +500,7 @@ discard block |
||
500 | 500 | * @return array |
501 | 501 | */ |
502 | 502 | function wpinv_get_iran_states_list() { |
503 | - return apply_filters( 'wpinv_iran_states', wpinv_get_country_states( 'IR' ) ); |
|
503 | + return apply_filters('wpinv_iran_states', wpinv_get_country_states('IR')); |
|
504 | 504 | } |
505 | 505 | |
506 | 506 | /** |
@@ -510,7 +510,7 @@ discard block |
||
510 | 510 | * @return array |
511 | 511 | */ |
512 | 512 | function wpinv_get_italy_states_list() { |
513 | - return apply_filters( 'wpinv_italy_states', wpinv_get_country_states( 'IT' ) ); |
|
513 | + return apply_filters('wpinv_italy_states', wpinv_get_country_states('IT')); |
|
514 | 514 | } |
515 | 515 | |
516 | 516 | /** |
@@ -520,7 +520,7 @@ discard block |
||
520 | 520 | * @return array |
521 | 521 | */ |
522 | 522 | function wpinv_get_malaysia_states_list() { |
523 | - return apply_filters( 'wpinv_malaysia_states', wpinv_get_country_states( 'MY' ) ); |
|
523 | + return apply_filters('wpinv_malaysia_states', wpinv_get_country_states('MY')); |
|
524 | 524 | } |
525 | 525 | |
526 | 526 | /** |
@@ -530,7 +530,7 @@ discard block |
||
530 | 530 | * @return array |
531 | 531 | */ |
532 | 532 | function wpinv_get_mexico_states_list() { |
533 | - return apply_filters( 'wpinv_mexico_states', wpinv_get_country_states( 'MX' ) ); |
|
533 | + return apply_filters('wpinv_mexico_states', wpinv_get_country_states('MX')); |
|
534 | 534 | } |
535 | 535 | |
536 | 536 | /** |
@@ -540,7 +540,7 @@ discard block |
||
540 | 540 | * @return array |
541 | 541 | */ |
542 | 542 | function wpinv_get_nepal_states_list() { |
543 | - return apply_filters( 'wpinv_nepal_states', wpinv_get_country_states( 'NP' ) ); |
|
543 | + return apply_filters('wpinv_nepal_states', wpinv_get_country_states('NP')); |
|
544 | 544 | } |
545 | 545 | |
546 | 546 | /** |
@@ -550,7 +550,7 @@ discard block |
||
550 | 550 | * @return array |
551 | 551 | */ |
552 | 552 | function wpinv_get_south_africa_states_list() { |
553 | - return apply_filters( 'wpinv_south_africa_states', wpinv_get_country_states( 'ZA' ) ); |
|
553 | + return apply_filters('wpinv_south_africa_states', wpinv_get_country_states('ZA')); |
|
554 | 554 | } |
555 | 555 | |
556 | 556 | /** |
@@ -560,7 +560,7 @@ discard block |
||
560 | 560 | * @return array |
561 | 561 | */ |
562 | 562 | function wpinv_get_thailand_states_list() { |
563 | - return apply_filters( 'wpinv_thailand_states', wpinv_get_country_states( 'TH' ) ); |
|
563 | + return apply_filters('wpinv_thailand_states', wpinv_get_country_states('TH')); |
|
564 | 564 | } |
565 | 565 | |
566 | 566 | /** |
@@ -570,7 +570,7 @@ discard block |
||
570 | 570 | * @return array |
571 | 571 | */ |
572 | 572 | function wpinv_get_turkey_states_list() { |
573 | - return apply_filters( 'wpinv_turkey_states', wpinv_get_country_states( 'TR' ) ); |
|
573 | + return apply_filters('wpinv_turkey_states', wpinv_get_country_states('TR')); |
|
574 | 574 | } |
575 | 575 | |
576 | 576 | /** |
@@ -580,28 +580,28 @@ discard block |
||
580 | 580 | * @return array |
581 | 581 | */ |
582 | 582 | function wpinv_get_spain_states_list() { |
583 | - return apply_filters( 'wpinv_spain_states', wpinv_get_country_states( 'ES' ) ); |
|
583 | + return apply_filters('wpinv_spain_states', wpinv_get_country_states('ES')); |
|
584 | 584 | } |
585 | 585 | |
586 | 586 | function wpinv_get_states_field() { |
587 | - if( empty( $_POST['country'] ) ) { |
|
587 | + if (empty($_POST['country'])) { |
|
588 | 588 | $_POST['country'] = wpinv_get_default_country(); |
589 | 589 | } |
590 | - $states = wpinv_get_country_states( sanitize_text_field( $_POST['country'] ) ); |
|
590 | + $states = wpinv_get_country_states(sanitize_text_field($_POST['country'])); |
|
591 | 591 | |
592 | - if( !empty( $states ) ) { |
|
593 | - $sanitized_field_name = sanitize_text_field( $_POST['field_name'] ); |
|
592 | + if (!empty($states)) { |
|
593 | + $sanitized_field_name = sanitize_text_field($_POST['field_name']); |
|
594 | 594 | |
595 | 595 | $args = array( |
596 | 596 | 'name' => $sanitized_field_name, |
597 | 597 | 'id' => $sanitized_field_name, |
598 | 598 | 'class' => $sanitized_field_name . 'custom-select wpinv-select wpi_select2', |
599 | - 'options' => array_merge( array( '' => '' ), $states ), |
|
599 | + 'options' => array_merge(array('' => ''), $states), |
|
600 | 600 | 'show_option_all' => false, |
601 | 601 | 'show_option_none' => false |
602 | 602 | ); |
603 | 603 | |
604 | - $response = wpinv_html_select( $args ); |
|
604 | + $response = wpinv_html_select($args); |
|
605 | 605 | |
606 | 606 | } else { |
607 | 607 | $response = 'nostates'; |
@@ -610,10 +610,10 @@ discard block |
||
610 | 610 | return $response; |
611 | 611 | } |
612 | 612 | |
613 | -function wpinv_default_billing_country( $country = '', $user_id = 0 ) { |
|
614 | - $country = !empty( $country ) ? $country : wpinv_get_default_country(); |
|
613 | +function wpinv_default_billing_country($country = '', $user_id = 0) { |
|
614 | + $country = !empty($country) ? $country : wpinv_get_default_country(); |
|
615 | 615 | |
616 | - return apply_filters( 'wpinv_default_billing_country', $country, $user_id ); |
|
616 | + return apply_filters('wpinv_default_billing_country', $country, $user_id); |
|
617 | 617 | } |
618 | 618 | |
619 | 619 | /** |
@@ -625,7 +625,7 @@ discard block |
||
625 | 625 | */ |
626 | 626 | function wpinv_get_address_formats() { |
627 | 627 | |
628 | - return apply_filters( 'wpinv_localisation_address_formats', |
|
628 | + return apply_filters('wpinv_localisation_address_formats', |
|
629 | 629 | array( |
630 | 630 | 'default' => "{{name}}\n{{company}}\n{{address}}\n{{city}}\n{{state}}\n{{zip}}\n{{country}}", |
631 | 631 | 'AU' => "{{name}}\n{{company}}\n{{address}}\n{{city}}\n{{state}} {{zip}}\n{{country}}", |
@@ -674,9 +674,9 @@ discard block |
||
674 | 674 | * @see `wpinv_get_invoice_address_replacements` |
675 | 675 | * @return string |
676 | 676 | */ |
677 | -function wpinv_get_full_address_format( $country = false) { |
|
677 | +function wpinv_get_full_address_format($country = false) { |
|
678 | 678 | |
679 | - if( empty( $country ) ) { |
|
679 | + if (empty($country)) { |
|
680 | 680 | $country = wpinv_get_default_country(); |
681 | 681 | } |
682 | 682 | |
@@ -684,7 +684,7 @@ discard block |
||
684 | 684 | $formats = wpinv_get_address_formats(); |
685 | 685 | |
686 | 686 | // Get format for the specified country. |
687 | - $format = ( $country && isset( $formats[ $country ] ) ) ? $formats[ $country ] : $formats['default']; |
|
687 | + $format = ($country && isset($formats[$country])) ? $formats[$country] : $formats['default']; |
|
688 | 688 | |
689 | 689 | /** |
690 | 690 | * Filters the address format to use on Invoices. |
@@ -696,7 +696,7 @@ discard block |
||
696 | 696 | * @param string $format The address format to use. |
697 | 697 | * @param string $country The country who's address format is being retrieved. |
698 | 698 | */ |
699 | - return apply_filters( 'wpinv_get_full_address_format', $format, $country ); |
|
699 | + return apply_filters('wpinv_get_full_address_format', $format, $country); |
|
700 | 700 | } |
701 | 701 | |
702 | 702 | /** |
@@ -707,7 +707,7 @@ discard block |
||
707 | 707 | * @param array $billing_details customer's billing details |
708 | 708 | * @return array |
709 | 709 | */ |
710 | -function wpinv_get_invoice_address_replacements( $billing_details ) { |
|
710 | +function wpinv_get_invoice_address_replacements($billing_details) { |
|
711 | 711 | |
712 | 712 | $default_args = array( |
713 | 713 | 'address' => '', |
@@ -720,22 +720,22 @@ discard block |
||
720 | 720 | 'company' => '', |
721 | 721 | ); |
722 | 722 | |
723 | - $args = map_deep( wp_parse_args( $billing_details, $default_args ), 'trim' ); |
|
723 | + $args = map_deep(wp_parse_args($billing_details, $default_args), 'trim'); |
|
724 | 724 | $state = $args['state']; |
725 | 725 | $country = $args['country']; |
726 | 726 | |
727 | 727 | // Handle full country name. |
728 | - $full_country = empty( $country ) ? $country : wpinv_country_name( $country ); |
|
728 | + $full_country = empty($country) ? $country : wpinv_country_name($country); |
|
729 | 729 | |
730 | 730 | // Handle full state name. |
731 | - $full_state = ( $country && $state ) ? wpinv_state_name( $state, $country ) : $state; |
|
731 | + $full_state = ($country && $state) ? wpinv_state_name($state, $country) : $state; |
|
732 | 732 | |
733 | 733 | $args['postcode'] = $args['zip']; |
734 | 734 | $args['name'] = $args['first_name'] . ' ' . $args['last_name']; |
735 | 735 | $args['state'] = $full_state; |
736 | 736 | $args['state_code'] = $state; |
737 | 737 | $args['country'] = $full_country; |
738 | - $args['country_code']= $country; |
|
738 | + $args['country_code'] = $country; |
|
739 | 739 | |
740 | 740 | /** |
741 | 741 | * Filters the address format replacements to use on Invoices. |
@@ -746,14 +746,14 @@ discard block |
||
746 | 746 | * @param array $replacements The address replacements to use. |
747 | 747 | * @param array $billing_details The billing details to use. |
748 | 748 | */ |
749 | - $replacements = apply_filters( 'wpinv_get_invoice_address_replacements', $args, $billing_details ); |
|
749 | + $replacements = apply_filters('wpinv_get_invoice_address_replacements', $args, $billing_details); |
|
750 | 750 | |
751 | 751 | $return = array(); |
752 | 752 | |
753 | - foreach( $replacements as $key => $value ) { |
|
754 | - $value = is_scalar( $value ) ? trim( sanitize_text_field( $value ) ) : ''; |
|
753 | + foreach ($replacements as $key => $value) { |
|
754 | + $value = is_scalar($value) ? trim(sanitize_text_field($value)) : ''; |
|
755 | 755 | $return['{{' . $key . '}}'] = $value; |
756 | - $return['{{' . $key . '_upper}}'] = wpinv_utf8_strtoupper( $value ); |
|
756 | + $return['{{' . $key . '_upper}}'] = wpinv_utf8_strtoupper($value); |
|
757 | 757 | } |
758 | 758 | |
759 | 759 | return $return; |
@@ -767,6 +767,6 @@ discard block |
||
767 | 767 | * @since 1.0.14 |
768 | 768 | * @return string |
769 | 769 | */ |
770 | -function wpinv_trim_formatted_address_line( $line ) { |
|
771 | - return trim( $line, ', ' ); |
|
770 | +function wpinv_trim_formatted_address_line($line) { |
|
771 | + return trim($line, ', '); |
|
772 | 772 | } |
773 | 773 | \ No newline at end of file |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | */ |
9 | 9 | |
10 | 10 | if ( ! defined( 'ABSPATH' ) ) { |
11 | - exit; // Exit if accessed directly |
|
11 | + exit; // Exit if accessed directly |
|
12 | 12 | } |
13 | 13 | |
14 | 14 | /** |
@@ -17,10 +17,10 @@ discard block |
||
17 | 17 | class GetPaid_Meta_Box_Invoice_Items { |
18 | 18 | |
19 | 19 | /** |
20 | - * Output the metabox. |
|
21 | - * |
|
22 | - * @param WP_Post $post |
|
23 | - */ |
|
20 | + * Output the metabox. |
|
21 | + * |
|
22 | + * @param WP_Post $post |
|
23 | + */ |
|
24 | 24 | public static function output( $post ) { |
25 | 25 | |
26 | 26 | // Prepare the invoice. |
@@ -7,7 +7,7 @@ discard block |
||
7 | 7 | * |
8 | 8 | */ |
9 | 9 | |
10 | -if ( ! defined( 'ABSPATH' ) ) { |
|
10 | +if (!defined('ABSPATH')) { |
|
11 | 11 | exit; // Exit if accessed directly |
12 | 12 | } |
13 | 13 | |
@@ -21,51 +21,51 @@ discard block |
||
21 | 21 | * |
22 | 22 | * @param WP_Post $post |
23 | 23 | */ |
24 | - public static function output( $post ) { |
|
24 | + public static function output($post) { |
|
25 | 25 | |
26 | 26 | // Prepare the invoice. |
27 | - $invoice = new WPInv_Invoice( $post ); |
|
27 | + $invoice = new WPInv_Invoice($post); |
|
28 | 28 | |
29 | 29 | // Invoice items. |
30 | 30 | $items = $invoice->get_items(); |
31 | 31 | |
32 | 32 | // New item url. |
33 | - $new_item = admin_url( 'post-new.php?post_type=wpi_item' ); |
|
33 | + $new_item = admin_url('post-new.php?post_type=wpi_item'); |
|
34 | 34 | |
35 | 35 | // Totals. |
36 | - $total = wpinv_price( wpinv_format_amount( $invoice->get_total() ), $invoice->get_currency() ); |
|
36 | + $total = wpinv_price(wpinv_format_amount($invoice->get_total()), $invoice->get_currency()); |
|
37 | 37 | |
38 | - if ( $invoice->is_recurring() && $invoice->is_parent() && $invoice->get_total() != $invoice->get_recurring_total() ) { |
|
39 | - $recurring_total = wpinv_price( wpinv_format_amount( $invoice->get_recurring_total() ), $invoice->get_currency() ); |
|
40 | - $total .= '<small class="form-text text-muted">' . sprintf( __( 'Recurring Price: %s', 'invoicing' ), $recurring_total ) . '</small>'; |
|
38 | + if ($invoice->is_recurring() && $invoice->is_parent() && $invoice->get_total() != $invoice->get_recurring_total()) { |
|
39 | + $recurring_total = wpinv_price(wpinv_format_amount($invoice->get_recurring_total()), $invoice->get_currency()); |
|
40 | + $total .= '<small class="form-text text-muted">' . sprintf(__('Recurring Price: %s', 'invoicing'), $recurring_total) . '</small>'; |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | $totals = array( |
44 | 44 | |
45 | 45 | 'subtotal' => array( |
46 | - 'label' => __( 'Items Subtotal', 'invoicing' ), |
|
47 | - 'value' => wpinv_price( wpinv_format_amount( $invoice->get_subtotal() ), $invoice->get_currency() ), |
|
46 | + 'label' => __('Items Subtotal', 'invoicing'), |
|
47 | + 'value' => wpinv_price(wpinv_format_amount($invoice->get_subtotal()), $invoice->get_currency()), |
|
48 | 48 | ), |
49 | 49 | |
50 | 50 | 'discount' => array( |
51 | - 'label' => __( 'Total Discount', 'invoicing' ), |
|
52 | - 'value' => wpinv_price( wpinv_format_amount( $invoice->get_total_discount() ), $invoice->get_currency() ), |
|
51 | + 'label' => __('Total Discount', 'invoicing'), |
|
52 | + 'value' => wpinv_price(wpinv_format_amount($invoice->get_total_discount()), $invoice->get_currency()), |
|
53 | 53 | ), |
54 | 54 | |
55 | 55 | 'tax' => array( |
56 | - 'label' => __( 'Total Tax', 'invoicing' ), |
|
57 | - 'value' => wpinv_price( wpinv_format_amount( $invoice->get_total_tax() ), $invoice->get_currency() ), |
|
56 | + 'label' => __('Total Tax', 'invoicing'), |
|
57 | + 'value' => wpinv_price(wpinv_format_amount($invoice->get_total_tax()), $invoice->get_currency()), |
|
58 | 58 | ), |
59 | 59 | |
60 | 60 | 'total' => array( |
61 | - 'label' => __( 'Invoice Total', 'invoicing' ), |
|
61 | + 'label' => __('Invoice Total', 'invoicing'), |
|
62 | 62 | 'value' => $total, |
63 | 63 | ) |
64 | 64 | ); |
65 | 65 | |
66 | 66 | |
67 | - if ( ! wpinv_use_taxes() ) { |
|
68 | - unset( $totals['tax'] ); |
|
67 | + if (!wpinv_use_taxes()) { |
|
68 | + unset($totals['tax']); |
|
69 | 69 | } |
70 | 70 | ?> |
71 | 71 | |
@@ -81,10 +81,10 @@ discard block |
||
81 | 81 | } |
82 | 82 | </style> |
83 | 83 | |
84 | - <div class="bsui getpaid-invoice-items-inner <?php echo sanitize_html_class( $invoice->get_template( 'edit' ) ); ?> <?php echo empty( $items ) ? 'no-items' : 'has-items'; ?> <?php echo $invoice->is_paid() || $invoice->is_refunded() ? 'not-editable' : 'editable'; ?>" style="margin-top: 1.5rem"> |
|
84 | + <div class="bsui getpaid-invoice-items-inner <?php echo sanitize_html_class($invoice->get_template('edit')); ?> <?php echo empty($items) ? 'no-items' : 'has-items'; ?> <?php echo $invoice->is_paid() || $invoice->is_refunded() ? 'not-editable' : 'editable'; ?>" style="margin-top: 1.5rem"> |
|
85 | 85 | |
86 | - <?php if ( ! $invoice->is_paid() && ! $invoice->is_refunded() ) : ?> |
|
87 | - <?php do_action( 'wpinv_meta_box_before_invoice_template_row', $invoice->get_id() ); ?> |
|
86 | + <?php if (!$invoice->is_paid() && !$invoice->is_refunded()) : ?> |
|
87 | + <?php do_action('wpinv_meta_box_before_invoice_template_row', $invoice->get_id()); ?> |
|
88 | 88 | |
89 | 89 | <div class="row"> |
90 | 90 | <div class="col-12 col-sm-6"> |
@@ -93,15 +93,15 @@ discard block |
||
93 | 93 | array( |
94 | 94 | 'id' => 'wpinv_template', |
95 | 95 | 'name' => 'wpinv_template', |
96 | - 'label' => __( 'Template', 'invoicing' ), |
|
96 | + 'label' => __('Template', 'invoicing'), |
|
97 | 97 | 'label_type' => 'vertical', |
98 | - 'placeholder' => __( 'Choose a template', 'invoicing' ), |
|
98 | + 'placeholder' => __('Choose a template', 'invoicing'), |
|
99 | 99 | 'class' => 'form-control-sm', |
100 | - 'value' => $invoice->get_template( 'edit' ), |
|
100 | + 'value' => $invoice->get_template('edit'), |
|
101 | 101 | 'options' => array( |
102 | - 'quantity' => __( 'Quantity', 'invoicing' ), |
|
103 | - 'hours' => __( 'Hours', 'invoicing' ), |
|
104 | - 'amount' => __( 'Amount Only', 'invoicing' ), |
|
102 | + 'quantity' => __('Quantity', 'invoicing'), |
|
103 | + 'hours' => __('Hours', 'invoicing'), |
|
104 | + 'amount' => __('Amount Only', 'invoicing'), |
|
105 | 105 | ), |
106 | 106 | 'data-allow-clear' => 'false', |
107 | 107 | 'select2' => true, |
@@ -117,11 +117,11 @@ discard block |
||
117 | 117 | array( |
118 | 118 | 'id' => 'wpinv_currency', |
119 | 119 | 'name' => 'wpinv_currency', |
120 | - 'label' => __( 'Currency', 'invoicing' ), |
|
120 | + 'label' => __('Currency', 'invoicing'), |
|
121 | 121 | 'label_type' => 'vertical', |
122 | - 'placeholder' => __( 'Select Invoice Currency', 'invoicing' ), |
|
122 | + 'placeholder' => __('Select Invoice Currency', 'invoicing'), |
|
123 | 123 | 'class' => 'form-control-sm', |
124 | - 'value' => $invoice->get_currency( 'edit' ), |
|
124 | + 'value' => $invoice->get_currency('edit'), |
|
125 | 125 | 'required' => false, |
126 | 126 | 'data-allow-clear' => 'false', |
127 | 127 | 'select2' => true, |
@@ -133,24 +133,24 @@ discard block |
||
133 | 133 | </div> |
134 | 134 | </div> |
135 | 135 | |
136 | - <?php do_action( 'wpinv_meta_box_invoice_template_row', $invoice->get_id() ); ?> |
|
136 | + <?php do_action('wpinv_meta_box_invoice_template_row', $invoice->get_id()); ?> |
|
137 | 137 | <?php endif; ?> |
138 | 138 | |
139 | 139 | <table cellpadding="0" cellspacing="0" class="getpaid_invoice_items"> |
140 | 140 | <thead> |
141 | 141 | <tr> |
142 | - <th class="getpaid-item" colspan="2"><?php _e( 'Item', 'invoicing' ) ?></th> |
|
142 | + <th class="getpaid-item" colspan="2"><?php _e('Item', 'invoicing') ?></th> |
|
143 | 143 | <th class="getpaid-quantity hide-if-amount text-right"> |
144 | - <span class="getpaid-hide-if-hours"><?php _e( 'Quantity', 'invoicing' ) ?></span> |
|
145 | - <span class="getpaid-hide-if-quantity"><?php _e( 'Hours', 'invoicing' ) ?></span> |
|
144 | + <span class="getpaid-hide-if-hours"><?php _e('Quantity', 'invoicing') ?></span> |
|
145 | + <span class="getpaid-hide-if-quantity"><?php _e('Hours', 'invoicing') ?></span> |
|
146 | 146 | </th> |
147 | 147 | <th class="getpaid-price hide-if-amount text-right"> |
148 | - <span class="getpaid-hide-if-hours"><?php _e( 'Price', 'invoicing' ) ?></span> |
|
149 | - <span class="getpaid-hide-if-quantity"><?php _e( 'Rate', 'invoicing' ) ?></span> |
|
148 | + <span class="getpaid-hide-if-hours"><?php _e('Price', 'invoicing') ?></span> |
|
149 | + <span class="getpaid-hide-if-quantity"><?php _e('Rate', 'invoicing') ?></span> |
|
150 | 150 | </th> |
151 | 151 | <th class="getpaid-item-subtotal text-right"> |
152 | - <span class="getpaid-hide-if-hours getpaid-hide-if-quantity"><?php _e( 'Amount', 'invoicing' ) ?></span> |
|
153 | - <span class="hide-if-amount"><?php _e( 'Total', 'invoicing' ) ?></span> |
|
152 | + <span class="getpaid-hide-if-hours getpaid-hide-if-quantity"><?php _e('Amount', 'invoicing') ?></span> |
|
153 | + <span class="hide-if-amount"><?php _e('Total', 'invoicing') ?></span> |
|
154 | 154 | </th> |
155 | 155 | <th class="getpaid-item-actions hide-if-not-editable" width="70px"> </th> |
156 | 156 | </tr> |
@@ -158,8 +158,8 @@ discard block |
||
158 | 158 | <tbody class="getpaid_invoice_line_items"> |
159 | 159 | <tr class="hide-if-has-items hide-if-not-editable"> |
160 | 160 | <td colspan="2" class="pt-4 pb-4"> |
161 | - <button type="button" class="button button-primary add-invoice-item" data-toggle="modal" data-target="#getpaid-add-items-to-invoice"><?php _e( 'Add Existing Items', 'invoicing' ) ?></button> |
|
162 | - <a href="<?php echo esc_url( $new_item ); ?>" target="_blank" class="button button-secondary"><?php _e( 'Create New Item', 'invoicing' ) ?></a> |
|
161 | + <button type="button" class="button button-primary add-invoice-item" data-toggle="modal" data-target="#getpaid-add-items-to-invoice"><?php _e('Add Existing Items', 'invoicing') ?></button> |
|
162 | + <a href="<?php echo esc_url($new_item); ?>" target="_blank" class="button button-secondary"><?php _e('Create New Item', 'invoicing') ?></a> |
|
163 | 163 | </td> |
164 | 164 | <td class="hide-if-amount"> </th> |
165 | 165 | <td class="hide-if-amount"> </th> |
@@ -191,11 +191,11 @@ discard block |
||
191 | 191 | <div class="col-12 col-sm-6 offset-sm-6"> |
192 | 192 | <table class="getpaid-invoice-totals text-right w-100"> |
193 | 193 | <tbody> |
194 | - <?php foreach ( apply_filters( 'getpaid_invoice_subtotal_rows', $totals, $invoice ) as $key => $data ) : ?> |
|
195 | - <tr class="getpaid-totals-<?php echo sanitize_html_class( $key ); ?>"> |
|
196 | - <td class="label"><?php echo sanitize_text_field( $data['label'] ) ?>:</td> |
|
194 | + <?php foreach (apply_filters('getpaid_invoice_subtotal_rows', $totals, $invoice) as $key => $data) : ?> |
|
195 | + <tr class="getpaid-totals-<?php echo sanitize_html_class($key); ?>"> |
|
196 | + <td class="label"><?php echo sanitize_text_field($data['label']) ?>:</td> |
|
197 | 197 | <td width="1%"></td> |
198 | - <td class="value"><?php echo wp_kses_post( $data['value'] ) ?></td> |
|
198 | + <td class="value"><?php echo wp_kses_post($data['value']) ?></td> |
|
199 | 199 | </tr> |
200 | 200 | <?php endforeach; ?> |
201 | 201 | </tbody> |
@@ -208,18 +208,18 @@ discard block |
||
208 | 208 | <div class="getpaid-invoice-item-actions hide-if-no-items hide-if-not-editable"> |
209 | 209 | <div class="row"> |
210 | 210 | <div class="text-left col-12 col-sm-8"> |
211 | - <button type="button" class="button add-invoice-item" data-toggle="modal" data-target="#getpaid-add-items-to-invoice"><?php _e( 'Add Existing Item', 'invoicing' ) ?></button> |
|
212 | - <a href="<?php echo esc_url( $new_item ); ?>" target="_blank" class="button button-secondary"><?php _e( 'Create New Item', 'invoicing' ) ?></a> |
|
213 | - <?php do_action( 'getpaid-invoice-items-actions', $invoice ); ?> |
|
211 | + <button type="button" class="button add-invoice-item" data-toggle="modal" data-target="#getpaid-add-items-to-invoice"><?php _e('Add Existing Item', 'invoicing') ?></button> |
|
212 | + <a href="<?php echo esc_url($new_item); ?>" target="_blank" class="button button-secondary"><?php _e('Create New Item', 'invoicing') ?></a> |
|
213 | + <?php do_action('getpaid-invoice-items-actions', $invoice); ?> |
|
214 | 214 | </div> |
215 | 215 | <div class="text-right col-12 col-sm-4"> |
216 | - <button type="button" class="button button-primary recalculate-totals-button"><?php _e( 'Recalculate Totals', 'invoicing' ) ?></button> |
|
216 | + <button type="button" class="button button-primary recalculate-totals-button"><?php _e('Recalculate Totals', 'invoicing') ?></button> |
|
217 | 217 | </div> |
218 | 218 | </div> |
219 | 219 | </div> |
220 | 220 | |
221 | 221 | <div class="getpaid-invoice-item-actions hide-if-editable"> |
222 | - <p class="description m-2 text-right text-muted"><?php _e( 'This invoice is no longer editable', 'invoicing' ); ?></p> |
|
222 | + <p class="description m-2 text-right text-muted"><?php _e('This invoice is no longer editable', 'invoicing'); ?></p> |
|
223 | 223 | </div> |
224 | 224 | |
225 | 225 | <!-- Add items to an invoice --> |
@@ -227,8 +227,8 @@ discard block |
||
227 | 227 | <div class="modal-dialog modal-dialog-centered" role="document"> |
228 | 228 | <div class="modal-content"> |
229 | 229 | <div class="modal-header"> |
230 | - <h5 class="modal-title" id="getpaid-add-item-to-invoice-label"><?php _e( "Add Item(s)", 'invoicing' ); ?></h5> |
|
231 | - <button type="button" class="close" data-dismiss="modal" aria-label="<?php _e( "Close", 'invoicing' ); ?>"> |
|
230 | + <h5 class="modal-title" id="getpaid-add-item-to-invoice-label"><?php _e("Add Item(s)", 'invoicing'); ?></h5> |
|
231 | + <button type="button" class="close" data-dismiss="modal" aria-label="<?php _e("Close", 'invoicing'); ?>"> |
|
232 | 232 | <span aria-hidden="true">×</span> |
233 | 233 | </button> |
234 | 234 | </div> |
@@ -236,17 +236,17 @@ discard block |
||
236 | 236 | <table class="widefat"> |
237 | 237 | <thead> |
238 | 238 | <tr> |
239 | - <th class="pl-0 text-left"><?php _e( 'Item', 'invoicing' ) ?></th> |
|
239 | + <th class="pl-0 text-left"><?php _e('Item', 'invoicing') ?></th> |
|
240 | 240 | <th class="pr-0 text-right hide-if-amount"> |
241 | - <span class="getpaid-hide-if-hours"><?php _e( 'Quantity', 'invoicing' ) ?></span> |
|
242 | - <span class="getpaid-hide-if-quantity"><?php _e( 'Hours', 'invoicing' ) ?></span> |
|
241 | + <span class="getpaid-hide-if-hours"><?php _e('Quantity', 'invoicing') ?></span> |
|
242 | + <span class="getpaid-hide-if-quantity"><?php _e('Hours', 'invoicing') ?></span> |
|
243 | 243 | </th> |
244 | 244 | </tr> |
245 | 245 | </thead> |
246 | 246 | <tbody> |
247 | 247 | <tr> |
248 | 248 | <td class="pl-0 text-left"> |
249 | - <select class="getpaid-item-search regular-text" data-placeholder="<?php esc_attr_e( 'Search for an item…', 'invoicing' ); ?>"></select> |
|
249 | + <select class="getpaid-item-search regular-text" data-placeholder="<?php esc_attr_e('Search for an item…', 'invoicing'); ?>"></select> |
|
250 | 250 | </td> |
251 | 251 | <td class="pr-0 text-right hide-if-amount"> |
252 | 252 | <input type="number" class="w100" step="1" min="1" autocomplete="off" value="1" placeholder="1"> |
@@ -256,8 +256,8 @@ discard block |
||
256 | 256 | </table> |
257 | 257 | </div> |
258 | 258 | <div class="modal-footer"> |
259 | - <button type="button" class="btn btn-secondary getpaid-cancel" data-dismiss="modal"><?php _e( 'Cancel', 'invoicing' ); ?></button> |
|
260 | - <button type="button" class="btn btn-primary getpaid-add" data-dismiss="modal"><?php _e( 'Add', 'invoicing' ); ?></button> |
|
259 | + <button type="button" class="btn btn-secondary getpaid-cancel" data-dismiss="modal"><?php _e('Cancel', 'invoicing'); ?></button> |
|
260 | + <button type="button" class="btn btn-primary getpaid-add" data-dismiss="modal"><?php _e('Add', 'invoicing'); ?></button> |
|
261 | 261 | </div> |
262 | 262 | </div> |
263 | 263 | </div> |
@@ -268,8 +268,8 @@ discard block |
||
268 | 268 | <div class="modal-dialog modal-dialog-centered" role="document"> |
269 | 269 | <div class="modal-content"> |
270 | 270 | <div class="modal-header"> |
271 | - <h5 class="modal-title" id="getpaid-edit-invoice-item-label"><?php _e( "Edit Item", 'invoicing' ); ?></h5> |
|
272 | - <button type="button" class="close" data-dismiss="modal" aria-label="<?php _e( "Close", 'invoicing' ); ?>"> |
|
271 | + <h5 class="modal-title" id="getpaid-edit-invoice-item-label"><?php _e("Edit Item", 'invoicing'); ?></h5> |
|
272 | + <button type="button" class="close" data-dismiss="modal" aria-label="<?php _e("Close", 'invoicing'); ?>"> |
|
273 | 273 | <span aria-hidden="true">×</span> |
274 | 274 | </button> |
275 | 275 | </div> |
@@ -277,27 +277,27 @@ discard block |
||
277 | 277 | <div class="getpaid-edit-item-div"> |
278 | 278 | <input type="hidden" name="id" class="form-control form-control-sm item-id"> |
279 | 279 | <label class="form-group w-100"> |
280 | - <span><?php _e( 'Name', 'invoicing' ); ?></span> |
|
281 | - <input type="text" name="name" placeholder="<?php esc_attr_e( 'Item Name', 'invoicing' ); ?>" class="form-control form-control-sm item-name"> |
|
280 | + <span><?php _e('Name', 'invoicing'); ?></span> |
|
281 | + <input type="text" name="name" placeholder="<?php esc_attr_e('Item Name', 'invoicing'); ?>" class="form-control form-control-sm item-name"> |
|
282 | 282 | </label> |
283 | 283 | <label class="form-group w-100"> |
284 | - <span class="getpaid-hide-if-hours getpaid-hide-if-quantity item-price"><?php _e( 'Amount', 'invoicing' ); ?></span> |
|
285 | - <span class="hide-if-amount"><?php _e( 'Price', 'invoicing' ); ?></span> |
|
286 | - <input type="text" name="price" placeholder="<?php wpinv_sanitize_amount( 0 ); ?>" class="form-control form-control-sm item-price"> |
|
284 | + <span class="getpaid-hide-if-hours getpaid-hide-if-quantity item-price"><?php _e('Amount', 'invoicing'); ?></span> |
|
285 | + <span class="hide-if-amount"><?php _e('Price', 'invoicing'); ?></span> |
|
286 | + <input type="text" name="price" placeholder="<?php wpinv_sanitize_amount(0); ?>" class="form-control form-control-sm item-price"> |
|
287 | 287 | </label> |
288 | 288 | <label class="form-group w-100 hide-if-amount"> |
289 | - <span><?php _e( 'Quantity', 'invoicing' ); ?></span> |
|
289 | + <span><?php _e('Quantity', 'invoicing'); ?></span> |
|
290 | 290 | <input type="number" name="quantity" placeholder="1" class="form-control form-control-sm item-quantity"> |
291 | 291 | </label> |
292 | 292 | <label class="form-group w-100"> |
293 | - <span><?php _e( 'Item Description', 'invoicing' ); ?></span> |
|
294 | - <textarea name="description" placeholder="<?php esc_attr_e( 'Enter a description for this item', 'invoicing' ); ?>" class="form-control item-description"></textarea> |
|
293 | + <span><?php _e('Item Description', 'invoicing'); ?></span> |
|
294 | + <textarea name="description" placeholder="<?php esc_attr_e('Enter a description for this item', 'invoicing'); ?>" class="form-control item-description"></textarea> |
|
295 | 295 | </label> |
296 | 296 | </div> |
297 | 297 | </div> |
298 | 298 | <div class="modal-footer"> |
299 | - <button type="button" class="btn btn-secondary getpaid-cancel" data-dismiss="modal"><?php _e( 'Cancel', 'invoicing' ); ?></button> |
|
300 | - <button type="button" class="btn btn-primary getpaid-save" data-dismiss="modal"><?php _e( 'Save', 'invoicing' ); ?></button> |
|
299 | + <button type="button" class="btn btn-secondary getpaid-cancel" data-dismiss="modal"><?php _e('Cancel', 'invoicing'); ?></button> |
|
300 | + <button type="button" class="btn btn-primary getpaid-save" data-dismiss="modal"><?php _e('Save', 'invoicing'); ?></button> |
|
301 | 301 | </div> |
302 | 302 | </div> |
303 | 303 | </div> |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | */ |
9 | 9 | |
10 | 10 | if ( ! defined( 'ABSPATH' ) ) { |
11 | - exit; // Exit if accessed directly |
|
11 | + exit; // Exit if accessed directly |
|
12 | 12 | } |
13 | 13 | |
14 | 14 | /** |
@@ -17,10 +17,10 @@ discard block |
||
17 | 17 | class GetPaid_Meta_Box_Invoice_Payment_Meta { |
18 | 18 | |
19 | 19 | /** |
20 | - * Output the metabox. |
|
21 | - * |
|
22 | - * @param WP_Post $post |
|
23 | - */ |
|
20 | + * Output the metabox. |
|
21 | + * |
|
22 | + * @param WP_Post $post |
|
23 | + */ |
|
24 | 24 | public static function output( $post ) { |
25 | 25 | |
26 | 26 | // Prepare the invoice. |
@@ -7,7 +7,7 @@ discard block |
||
7 | 7 | * |
8 | 8 | */ |
9 | 9 | |
10 | -if ( ! defined( 'ABSPATH' ) ) { |
|
10 | +if (!defined('ABSPATH')) { |
|
11 | 11 | exit; // Exit if accessed directly |
12 | 12 | } |
13 | 13 | |
@@ -21,10 +21,10 @@ discard block |
||
21 | 21 | * |
22 | 22 | * @param WP_Post $post |
23 | 23 | */ |
24 | - public static function output( $post ) { |
|
24 | + public static function output($post) { |
|
25 | 25 | |
26 | 26 | // Prepare the invoice. |
27 | - $invoice = new WPInv_Invoice( $post ); |
|
27 | + $invoice = new WPInv_Invoice($post); |
|
28 | 28 | |
29 | 29 | ?> |
30 | 30 | |
@@ -46,10 +46,10 @@ discard block |
||
46 | 46 | 'type' => 'text', |
47 | 47 | 'id' => 'wpinv_key', |
48 | 48 | 'name' => 'wpinv_key', |
49 | - 'label' => __( 'Invoice Key:', 'invoicing' ), |
|
49 | + 'label' => __('Invoice Key:', 'invoicing'), |
|
50 | 50 | 'label_type' => 'vertical', |
51 | 51 | 'class' => 'form-control-sm', |
52 | - 'value' => $invoice->get_key( 'edit' ), |
|
52 | + 'value' => $invoice->get_key('edit'), |
|
53 | 53 | 'extra_attributes' => array( |
54 | 54 | 'onclick' => 'this.select();', |
55 | 55 | 'readonly' => 'true', |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | 'type' => 'text', |
64 | 64 | 'id' => 'wpinv_view_url', |
65 | 65 | 'name' => 'wpinv_view_url', |
66 | - 'label' => __( 'Invoice URL:', 'invoicing' ), |
|
66 | + 'label' => __('Invoice URL:', 'invoicing'), |
|
67 | 67 | 'label_type' => 'vertical', |
68 | 68 | 'class' => 'form-control-sm', |
69 | 69 | 'value' => $invoice->get_view_url(), |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | ); |
76 | 76 | |
77 | 77 | // If the invoice is paid... |
78 | - if ( $invoice->is_paid() || $invoice->is_refunded() ) { |
|
78 | + if ($invoice->is_paid() || $invoice->is_refunded()) { |
|
79 | 79 | |
80 | 80 | // Payment date. |
81 | 81 | echo aui()->input( |
@@ -83,11 +83,11 @@ discard block |
||
83 | 83 | 'type' => 'datepicker', |
84 | 84 | 'id' => 'wpinv_date_completed', |
85 | 85 | 'name' => 'date_completed', |
86 | - 'label' => __( 'Payment Date:', 'invoicing' ), |
|
86 | + 'label' => __('Payment Date:', 'invoicing'), |
|
87 | 87 | 'label_type' => 'vertical', |
88 | 88 | 'placeholder' => 'YYYY-MM-DD 00:00', |
89 | 89 | 'class' => 'form-control-sm', |
90 | - 'value' => $invoice->get_date_completed( 'edit' ), |
|
90 | + 'value' => $invoice->get_date_completed('edit'), |
|
91 | 91 | 'extra_attributes' => array( |
92 | 92 | 'data-enable-time' => 'true', |
93 | 93 | 'data-time_24hr' => 'true', |
@@ -102,10 +102,10 @@ discard block |
||
102 | 102 | 'type' => 'text', |
103 | 103 | 'id' => 'wpinv_gateway', |
104 | 104 | 'name' => 'wpinv_gateway', |
105 | - 'label' => __( 'Gateway:', 'invoicing' ), |
|
105 | + 'label' => __('Gateway:', 'invoicing'), |
|
106 | 106 | 'label_type' => 'vertical', |
107 | 107 | 'class' => 'form-control-sm', |
108 | - 'value' => wpinv_get_gateway_admin_label( $invoice->get_gateway( 'edit' ) ), |
|
108 | + 'value' => wpinv_get_gateway_admin_label($invoice->get_gateway('edit')), |
|
109 | 109 | 'extra_attributes' => array( |
110 | 110 | 'onclick' => 'this.select();', |
111 | 111 | 'readonly' => 'true', |
@@ -119,11 +119,11 @@ discard block |
||
119 | 119 | 'type' => 'text', |
120 | 120 | 'id' => 'wpinv_transaction_id', |
121 | 121 | 'name' => 'wpinv_transaction_id', |
122 | - 'label' => __( 'Transaction ID:', 'invoicing' ), |
|
122 | + 'label' => __('Transaction ID:', 'invoicing'), |
|
123 | 123 | 'label_type' => 'vertical', |
124 | 124 | 'class' => 'form-control-sm', |
125 | - 'value' => $invoice->get_transaction_id( 'edit' ), |
|
126 | - 'help_text' => apply_filters( 'wpinv_invoice_transaction_link_' . $invoice->get_gateway( 'edit' ), '', $invoice->get_transaction_id(), $invoice ), |
|
125 | + 'value' => $invoice->get_transaction_id('edit'), |
|
126 | + 'help_text' => apply_filters('wpinv_invoice_transaction_link_' . $invoice->get_gateway('edit'), '', $invoice->get_transaction_id(), $invoice), |
|
127 | 127 | 'extra_attributes' => array( |
128 | 128 | 'onclick' => 'this.select();', |
129 | 129 | 'readonly' => 'true', |
@@ -137,10 +137,10 @@ discard block |
||
137 | 137 | 'type' => 'text', |
138 | 138 | 'id' => 'wpinv_currency', |
139 | 139 | 'name' => 'wpinv_currency', |
140 | - 'label' => __( 'Currency:', 'invoicing' ), |
|
140 | + 'label' => __('Currency:', 'invoicing'), |
|
141 | 141 | 'label_type' => 'vertical', |
142 | 142 | 'class' => 'form-control-sm', |
143 | - 'value' => $invoice->get_currency( 'edit' ), |
|
143 | + 'value' => $invoice->get_currency('edit'), |
|
144 | 144 | 'extra_attributes' => array( |
145 | 145 | 'onclick' => 'this.select();', |
146 | 146 | 'readonly' => 'true', |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | 'type' => 'text', |
157 | 157 | 'id' => 'wpinv_payment_url', |
158 | 158 | 'name' => 'wpinv_payment_url', |
159 | - 'label' => __( 'Payment URL:', 'invoicing' ), |
|
159 | + 'label' => __('Payment URL:', 'invoicing'), |
|
160 | 160 | 'label_type' => 'vertical', |
161 | 161 | 'class' => 'form-control-sm', |
162 | 162 | 'value' => $invoice->get_checkout_payment_url(), |
@@ -172,13 +172,13 @@ discard block |
||
172 | 172 | array( |
173 | 173 | 'id' => 'wpinv_gateway', |
174 | 174 | 'name' => 'wpinv_gateway', |
175 | - 'label' => __( 'Gateway:', 'invoicing' ), |
|
175 | + 'label' => __('Gateway:', 'invoicing'), |
|
176 | 176 | 'label_type' => 'vertical', |
177 | - 'placeholder' => __( 'Select Gateway', 'invoicing' ), |
|
178 | - 'value' => $invoice->get_gateway( 'edit' ), |
|
177 | + 'placeholder' => __('Select Gateway', 'invoicing'), |
|
178 | + 'value' => $invoice->get_gateway('edit'), |
|
179 | 179 | 'select2' => true, |
180 | 180 | 'data-allow-clear' => 'false', |
181 | - 'options' => wp_list_pluck( wpinv_get_enabled_payment_gateways( true ), 'admin_label' ), |
|
181 | + 'options' => wp_list_pluck(wpinv_get_enabled_payment_gateways(true), 'admin_label'), |
|
182 | 182 | ) |
183 | 183 | ); |
184 | 184 |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | */ |
9 | 9 | |
10 | 10 | if ( ! defined( 'ABSPATH' ) ) { |
11 | - exit; // Exit if accessed directly |
|
11 | + exit; // Exit if accessed directly |
|
12 | 12 | } |
13 | 13 | |
14 | 14 | /** |
@@ -17,10 +17,10 @@ discard block |
||
17 | 17 | class GetPaid_Meta_Box_Invoice_Details { |
18 | 18 | |
19 | 19 | /** |
20 | - * Output the metabox. |
|
21 | - * |
|
22 | - * @param WP_Post $post |
|
23 | - */ |
|
20 | + * Output the metabox. |
|
21 | + * |
|
22 | + * @param WP_Post $post |
|
23 | + */ |
|
24 | 24 | public static function output( $post ) { |
25 | 25 | |
26 | 26 | // Prepare the invoice. |
@@ -7,7 +7,7 @@ discard block |
||
7 | 7 | * |
8 | 8 | */ |
9 | 9 | |
10 | -if ( ! defined( 'ABSPATH' ) ) { |
|
10 | +if (!defined('ABSPATH')) { |
|
11 | 11 | exit; // Exit if accessed directly |
12 | 12 | } |
13 | 13 | |
@@ -21,13 +21,13 @@ discard block |
||
21 | 21 | * |
22 | 22 | * @param WP_Post $post |
23 | 23 | */ |
24 | - public static function output( $post ) { |
|
24 | + public static function output($post) { |
|
25 | 25 | |
26 | 26 | // Prepare the invoice. |
27 | - $invoice = new WPInv_Invoice( $post ); |
|
27 | + $invoice = new WPInv_Invoice($post); |
|
28 | 28 | |
29 | 29 | // Nonce field. |
30 | - wp_nonce_field( 'wpinv_details', 'wpinv_details_nonce' ) ; |
|
30 | + wp_nonce_field('wpinv_details', 'wpinv_details_nonce'); |
|
31 | 31 | |
32 | 32 | |
33 | 33 | ?> |
@@ -46,10 +46,10 @@ discard block |
||
46 | 46 | |
47 | 47 | <div class="bsui" style="margin-top: 1.5rem" id="gdmbx2-metabox-wpinv_details"> |
48 | 48 | |
49 | - <?php if ( ! $invoice->is_draft() ) : ?> |
|
49 | + <?php if (!$invoice->is_draft()) : ?> |
|
50 | 50 | <div class="form-group"> |
51 | - <strong><?php _e( 'Viewed by Customer:', 'invoicing' );?></strong> |
|
52 | - <?php ( $invoice->get_is_viewed() ) ? _e( 'Yes', 'invoicing' ) : _e( 'No', 'invoicing' ); ?> |
|
51 | + <strong><?php _e('Viewed by Customer:', 'invoicing'); ?></strong> |
|
52 | + <?php ($invoice->get_is_viewed()) ? _e('Yes', 'invoicing') : _e('No', 'invoicing'); ?> |
|
53 | 53 | </div> |
54 | 54 | <?php endif; ?> |
55 | 55 | |
@@ -61,11 +61,11 @@ discard block |
||
61 | 61 | 'type' => 'datepicker', |
62 | 62 | 'id' => 'wpinv_date_created', |
63 | 63 | 'name' => 'date_created', |
64 | - 'label' => __( 'Invoice Date:', 'invoicing' ) . getpaid_get_help_tip( __( 'The date this invoice was created. This allows you to backdate an invoice.', 'invoicing' ) ), |
|
64 | + 'label' => __('Invoice Date:', 'invoicing') . getpaid_get_help_tip(__('The date this invoice was created. This allows you to backdate an invoice.', 'invoicing')), |
|
65 | 65 | 'label_type' => 'vertical', |
66 | 66 | 'placeholder' => 'YYYY-MM-DD 00:00', |
67 | 67 | 'class' => 'form-control-sm', |
68 | - 'value' => $invoice->get_date_created( 'edit' ), |
|
68 | + 'value' => $invoice->get_date_created('edit'), |
|
69 | 69 | 'extra_attributes' => array( |
70 | 70 | 'data-enable-time' => 'true', |
71 | 71 | 'data-time_24hr' => 'true', |
@@ -76,37 +76,37 @@ discard block |
||
76 | 76 | ); |
77 | 77 | |
78 | 78 | // Due date. |
79 | - if ( $invoice->is_type( 'invoice' ) && wpinv_get_option( 'overdue_active' ) && ( $invoice->needs_payment() || $invoice->is_draft() ) ) { |
|
79 | + if ($invoice->is_type('invoice') && wpinv_get_option('overdue_active') && ($invoice->needs_payment() || $invoice->is_draft())) { |
|
80 | 80 | |
81 | 81 | echo aui()->input( |
82 | 82 | array( |
83 | 83 | 'type' => 'text', |
84 | 84 | 'id' => 'wpinv_due_date', |
85 | 85 | 'name' => 'wpinv_due_date', |
86 | - 'label' => __( 'Due Date:', 'invoicing' ) . getpaid_get_help_tip( __( 'Leave blank to disable automated reminder emails for this invoice.', 'invoicing' ) ), |
|
86 | + 'label' => __('Due Date:', 'invoicing') . getpaid_get_help_tip(__('Leave blank to disable automated reminder emails for this invoice.', 'invoicing')), |
|
87 | 87 | 'label_type' => 'vertical', |
88 | - 'placeholder' => __( 'No due date', 'invoicing' ), |
|
88 | + 'placeholder' => __('No due date', 'invoicing'), |
|
89 | 89 | 'class' => 'form-control-sm', |
90 | - 'value' => $invoice->get_due_date( 'edit' ), |
|
90 | + 'value' => $invoice->get_due_date('edit'), |
|
91 | 91 | ) |
92 | 92 | ); |
93 | 93 | |
94 | 94 | } |
95 | 95 | |
96 | - do_action( 'wpinv_meta_box_details_after_due_date', $invoice->get_id() ); |
|
96 | + do_action('wpinv_meta_box_details_after_due_date', $invoice->get_id()); |
|
97 | 97 | |
98 | 98 | // Status. |
99 | 99 | echo aui()->select( |
100 | 100 | array( |
101 | 101 | 'id' => 'wpinv_status', |
102 | 102 | 'name' => 'wpinv_status', |
103 | - 'label' => __( 'Invoice Status:', 'invoicing' ), |
|
103 | + 'label' => __('Invoice Status:', 'invoicing'), |
|
104 | 104 | 'label_type' => 'vertical', |
105 | - 'placeholder' => __( 'Select Status', 'invoicing' ), |
|
106 | - 'value' => $invoice->get_status( 'edit' ), |
|
105 | + 'placeholder' => __('Select Status', 'invoicing'), |
|
106 | + 'value' => $invoice->get_status('edit'), |
|
107 | 107 | 'select2' => true, |
108 | 108 | 'data-allow-clear' => 'false', |
109 | - 'options' => wpinv_get_invoice_statuses( true ) |
|
109 | + 'options' => wpinv_get_invoice_statuses(true) |
|
110 | 110 | ) |
111 | 111 | ); |
112 | 112 | |
@@ -116,11 +116,11 @@ discard block |
||
116 | 116 | 'type' => 'text', |
117 | 117 | 'id' => 'wpinv_number', |
118 | 118 | 'name' => 'wpinv_number', |
119 | - 'label' => __( 'Invoice Number:', 'invoicing' ) . getpaid_get_help_tip( __( 'Each invoice number must be unique.', 'invoicing' ) ), |
|
119 | + 'label' => __('Invoice Number:', 'invoicing') . getpaid_get_help_tip(__('Each invoice number must be unique.', 'invoicing')), |
|
120 | 120 | 'label_type' => 'vertical', |
121 | - 'placeholder' => __( 'Autogenerate', 'invoicing' ), |
|
121 | + 'placeholder' => __('Autogenerate', 'invoicing'), |
|
122 | 122 | 'class' => 'form-control-sm', |
123 | - 'value' => $invoice->get_number( 'edit' ), |
|
123 | + 'value' => $invoice->get_number('edit'), |
|
124 | 124 | ) |
125 | 125 | ); |
126 | 126 | |
@@ -130,25 +130,25 @@ discard block |
||
130 | 130 | 'type' => 'text', |
131 | 131 | 'id' => 'wpinv_cc', |
132 | 132 | 'name' => 'wpinv_cc', |
133 | - 'label' => __( 'Email CC:', 'invoicing' ) . getpaid_get_help_tip( __( 'Enter a comma separated list of other emails that should be notified about the invoice.', 'invoicing' ) ), |
|
133 | + 'label' => __('Email CC:', 'invoicing') . getpaid_get_help_tip(__('Enter a comma separated list of other emails that should be notified about the invoice.', 'invoicing')), |
|
134 | 134 | 'label_type' => 'vertical', |
135 | - 'placeholder' => __( '[email protected], [email protected]', 'invoicing' ), |
|
135 | + 'placeholder' => __('[email protected], [email protected]', 'invoicing'), |
|
136 | 136 | 'class' => 'form-control-sm', |
137 | - 'value' => $invoice->get_email_cc( 'edit' ), |
|
137 | + 'value' => $invoice->get_email_cc('edit'), |
|
138 | 138 | ) |
139 | 139 | ); |
140 | 140 | |
141 | - do_action( 'wpinv_meta_box_details_inner', $invoice->get_id() ); |
|
141 | + do_action('wpinv_meta_box_details_inner', $invoice->get_id()); |
|
142 | 142 | |
143 | 143 | // Disable taxes. |
144 | - if ( wpinv_use_taxes() && ! ( $invoice->is_paid() || $invoice->is_refunded() ) ) { |
|
144 | + if (wpinv_use_taxes() && !($invoice->is_paid() || $invoice->is_refunded())) { |
|
145 | 145 | |
146 | 146 | echo aui()->input( |
147 | 147 | array( |
148 | 148 | 'id' => 'wpinv_taxable', |
149 | 149 | 'name' => 'disable_taxes', |
150 | 150 | 'type' => 'checkbox', |
151 | - 'label' => __( 'Disable taxes', 'invoicing' ), |
|
151 | + 'label' => __('Disable taxes', 'invoicing'), |
|
152 | 152 | 'value' => '1', |
153 | 153 | 'checked' => (bool) $invoice->get_disable_taxes(), |
154 | 154 | ) |
@@ -157,17 +157,17 @@ discard block |
||
157 | 157 | } |
158 | 158 | |
159 | 159 | // Apply a discount. |
160 | - if ( $invoice->get_discount_code( 'edit' ) ) { |
|
160 | + if ($invoice->get_discount_code('edit')) { |
|
161 | 161 | |
162 | 162 | echo aui()->input( |
163 | 163 | array( |
164 | 164 | 'type' => 'text', |
165 | 165 | 'id' => 'wpinv_discount_code', |
166 | 166 | 'name' => 'wpinv_discount_code', |
167 | - 'label' => __( 'Discount Code:', 'invoicing' ), |
|
167 | + 'label' => __('Discount Code:', 'invoicing'), |
|
168 | 168 | 'label_type' => 'vertical', |
169 | 169 | 'class' => 'form-control-sm', |
170 | - 'value' => $invoice->get_discount_code( 'edit' ), |
|
170 | + 'value' => $invoice->get_discount_code('edit'), |
|
171 | 171 | 'extra_attributes' => array( |
172 | 172 | 'onclick' => 'this.select();', |
173 | 173 | 'readonly' => 'true', |
@@ -6,7 +6,7 @@ discard block |
||
6 | 6 | */ |
7 | 7 | |
8 | 8 | if ( ! defined( 'ABSPATH' ) ) { |
9 | - exit; // Exit if accessed directly |
|
9 | + exit; // Exit if accessed directly |
|
10 | 10 | } |
11 | 11 | |
12 | 12 | /** |
@@ -15,10 +15,10 @@ discard block |
||
15 | 15 | class GetPaid_Meta_Box_Resend_Invoice { |
16 | 16 | |
17 | 17 | /** |
18 | - * Output the metabox. |
|
19 | - * |
|
20 | - * @param WP_Post $post |
|
21 | - */ |
|
18 | + * Output the metabox. |
|
19 | + * |
|
20 | + * @param WP_Post $post |
|
21 | + */ |
|
22 | 22 | public static function output( $post ) { |
23 | 23 | |
24 | 24 | // Fetch the invoice. |
@@ -5,7 +5,7 @@ discard block |
||
5 | 5 | * |
6 | 6 | */ |
7 | 7 | |
8 | -if ( ! defined( 'ABSPATH' ) ) { |
|
8 | +if (!defined('ABSPATH')) { |
|
9 | 9 | exit; // Exit if accessed directly |
10 | 10 | } |
11 | 11 | |
@@ -19,12 +19,12 @@ discard block |
||
19 | 19 | * |
20 | 20 | * @param WP_Post $post |
21 | 21 | */ |
22 | - public static function output( $post ) { |
|
22 | + public static function output($post) { |
|
23 | 23 | |
24 | 24 | // Fetch the invoice. |
25 | - $invoice = new WPInv_Invoice( $post ); |
|
25 | + $invoice = new WPInv_Invoice($post); |
|
26 | 26 | |
27 | - do_action( 'wpinv_metabox_resend_invoice_before', $invoice ); |
|
27 | + do_action('wpinv_metabox_resend_invoice_before', $invoice); |
|
28 | 28 | |
29 | 29 | $email_url = esc_url( |
30 | 30 | add_query_arg( |
@@ -50,12 +50,12 @@ discard block |
||
50 | 50 | ); |
51 | 51 | |
52 | 52 | ?> |
53 | - <p class="wpi-meta-row wpi-resend-info"><?php _e( "This will send a copy of the invoice to the customer's email address.", 'invoicing' ); ?></p> |
|
54 | - <p class="wpi-meta-row wpi-resend-email"><a href="<?php echo $email_url; ?>" class="button button-secondary"><?php _e( 'Resend Invoice', 'invoicing' ); ?></a></p> |
|
55 | - <p class="wpi-meta-row wpi-send-reminder"><a title="<?php esc_attr_e( 'Send overdue reminder notification to customer', 'invoicing' ); ?>" href="<?php echo $reminder_url; ?>" class="button button-secondary"><?php esc_attr_e( 'Send Reminder', 'invoicing' ); ?></a></p> |
|
53 | + <p class="wpi-meta-row wpi-resend-info"><?php _e("This will send a copy of the invoice to the customer's email address.", 'invoicing'); ?></p> |
|
54 | + <p class="wpi-meta-row wpi-resend-email"><a href="<?php echo $email_url; ?>" class="button button-secondary"><?php _e('Resend Invoice', 'invoicing'); ?></a></p> |
|
55 | + <p class="wpi-meta-row wpi-send-reminder"><a title="<?php esc_attr_e('Send overdue reminder notification to customer', 'invoicing'); ?>" href="<?php echo $reminder_url; ?>" class="button button-secondary"><?php esc_attr_e('Send Reminder', 'invoicing'); ?></a></p> |
|
56 | 56 | <?php |
57 | 57 | |
58 | - do_action( 'wpinv_metabox_resend_invoice_after', $invoice ); |
|
58 | + do_action('wpinv_metabox_resend_invoice_after', $invoice); |
|
59 | 59 | |
60 | 60 | } |
61 | 61 |
@@ -1,39 +1,39 @@ |
||
1 | 1 | <?php |
2 | 2 | // MUST have WordPress. |
3 | -if ( !defined( 'WPINC' ) ) { |
|
4 | - exit( 'Do NOT access this file directly: ' . basename( __FILE__ ) ); |
|
3 | +if (!defined('WPINC')) { |
|
4 | + exit('Do NOT access this file directly: ' . basename(__FILE__)); |
|
5 | 5 | } |
6 | 6 | |
7 | 7 | class WPInv_Meta_Box_Notes { |
8 | - public static function output( $post ) { |
|
8 | + public static function output($post) { |
|
9 | 9 | global $post; |
10 | 10 | |
11 | - $notes = wpinv_get_invoice_notes( $post->ID ); |
|
11 | + $notes = wpinv_get_invoice_notes($post->ID); |
|
12 | 12 | |
13 | 13 | echo '<ul class="invoice_notes">'; |
14 | 14 | |
15 | - if ( $notes ) { |
|
16 | - foreach( $notes as $note ) { |
|
17 | - wpinv_get_invoice_note_line_item( $note ); |
|
15 | + if ($notes) { |
|
16 | + foreach ($notes as $note) { |
|
17 | + wpinv_get_invoice_note_line_item($note); |
|
18 | 18 | } |
19 | 19 | |
20 | 20 | } else { |
21 | - echo '<li>' . __( 'There are no notes yet.', 'invoicing' ) . '</li>'; |
|
21 | + echo '<li>' . __('There are no notes yet.', 'invoicing') . '</li>'; |
|
22 | 22 | } |
23 | 23 | |
24 | 24 | echo '</ul>'; |
25 | 25 | ?> |
26 | 26 | <div class="add_note"> |
27 | - <h4><?php _e( 'Add note', 'invoicing' ); ?></h4> |
|
27 | + <h4><?php _e('Add note', 'invoicing'); ?></h4> |
|
28 | 28 | <p> |
29 | 29 | <textarea type="text" name="invoice_note" id="add_invoice_note" class="input-text" cols="20" rows="5"></textarea> |
30 | 30 | </p> |
31 | 31 | <p> |
32 | 32 | <select name="invoice_note_type" id="invoice_note_type" class="regular-text"> |
33 | - <option value=""><?php _e( 'Private note', 'invoicing' ); ?></option> |
|
34 | - <option value="customer"><?php _e( 'Note to customer', 'invoicing' ); ?></option> |
|
33 | + <option value=""><?php _e('Private note', 'invoicing'); ?></option> |
|
34 | + <option value="customer"><?php _e('Note to customer', 'invoicing'); ?></option> |
|
35 | 35 | </select> |
36 | - <a href="#" class="add_note button"><?php _e( 'Add', 'invoicing' ); ?></a> <span class="description"><?php _e( 'Add a note for your reference, or add a customer note (the user will be notified).', 'invoicing' ); ?></span> |
|
36 | + <a href="#" class="add_note button"><?php _e('Add', 'invoicing'); ?></a> <span class="description"><?php _e('Add a note for your reference, or add a customer note (the user will be notified).', 'invoicing'); ?></span> |
|
37 | 37 | </p> |
38 | 38 | </div> |
39 | 39 | <?php |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | */ |
9 | 9 | |
10 | 10 | if ( ! defined( 'ABSPATH' ) ) { |
11 | - exit; // Exit if accessed directly |
|
11 | + exit; // Exit if accessed directly |
|
12 | 12 | } |
13 | 13 | |
14 | 14 | /** |
@@ -17,10 +17,10 @@ discard block |
||
17 | 17 | class GetPaid_Meta_Box_Item_Details { |
18 | 18 | |
19 | 19 | /** |
20 | - * Output the metabox. |
|
21 | - * |
|
22 | - * @param WP_Post $post |
|
23 | - */ |
|
20 | + * Output the metabox. |
|
21 | + * |
|
22 | + * @param WP_Post $post |
|
23 | + */ |
|
24 | 24 | public static function output( $post ) { |
25 | 25 | |
26 | 26 | // Prepare the item. |
@@ -289,35 +289,35 @@ discard block |
||
289 | 289 | } |
290 | 290 | |
291 | 291 | /** |
292 | - * Save meta box data. |
|
293 | - * |
|
294 | - * @param int $post_id |
|
295 | - */ |
|
296 | - public static function save( $post_id ) { |
|
292 | + * Save meta box data. |
|
293 | + * |
|
294 | + * @param int $post_id |
|
295 | + */ |
|
296 | + public static function save( $post_id ) { |
|
297 | 297 | |
298 | 298 | // Prepare the item. |
299 | 299 | $item = new WPInv_Item( $post_id ); |
300 | 300 | |
301 | 301 | // Load new data. |
302 | 302 | $item->set_props( |
303 | - array( |
|
304 | - 'price' => isset( $_POST['wpinv_item_price'] ) ? (float) $_POST['wpinv_item_price'] : null, |
|
305 | - 'vat_rule' => isset( $_POST['wpinv_vat_rules'] ) ? wpinv_clean( $_POST['wpinv_vat_rules'] ) : null, |
|
306 | - 'vat_class' => isset( $_POST['wpinv_vat_class'] ) ? wpinv_clean( $_POST['wpinv_vat_class'] ) : null, |
|
307 | - 'type' => isset( $_POST['wpinv_item_type'] ) ? wpinv_clean( $_POST['wpinv_item_type'] ) : null, |
|
308 | - 'is_dynamic_pricing' => isset( $_POST['wpinv_name_your_price'] ), |
|
303 | + array( |
|
304 | + 'price' => isset( $_POST['wpinv_item_price'] ) ? (float) $_POST['wpinv_item_price'] : null, |
|
305 | + 'vat_rule' => isset( $_POST['wpinv_vat_rules'] ) ? wpinv_clean( $_POST['wpinv_vat_rules'] ) : null, |
|
306 | + 'vat_class' => isset( $_POST['wpinv_vat_class'] ) ? wpinv_clean( $_POST['wpinv_vat_class'] ) : null, |
|
307 | + 'type' => isset( $_POST['wpinv_item_type'] ) ? wpinv_clean( $_POST['wpinv_item_type'] ) : null, |
|
308 | + 'is_dynamic_pricing' => isset( $_POST['wpinv_name_your_price'] ), |
|
309 | 309 | 'minimum_price' => isset( $_POST['wpinv_minimum_price'] ) ? (float) $_POST['wpinv_minimum_price'] : null, |
310 | - 'is_recurring' => isset( $_POST['wpinv_is_recurring'] ), |
|
311 | - 'recurring_period' => isset( $_POST['wpinv_recurring_period'] ) ? wpinv_clean( $_POST['wpinv_recurring_period'] ) : null, |
|
312 | - 'recurring_interval' => isset( $_POST['wpinv_recurring_interval'] ) ? (int) $_POST['wpinv_recurring_interval'] : null, |
|
313 | - 'recurring_limit' => isset( $_POST['wpinv_recurring_limit'] ) ? (int) $_POST['wpinv_recurring_limit'] : null, |
|
314 | - 'is_free_trial' => isset( $_POST['wpinv_trial_interval'] ) ? ( 0 != (int) $_POST['wpinv_trial_interval'] ) : null, |
|
315 | - 'trial_period' => isset( $_POST['wpinv_trial_period'] ) ? wpinv_clean( $_POST['wpinv_trial_period'] ) : null, |
|
316 | - 'trial_interval' => isset( $_POST['wpinv_trial_interval'] ) ? (int) $_POST['wpinv_trial_interval'] : null, |
|
317 | - ) |
|
310 | + 'is_recurring' => isset( $_POST['wpinv_is_recurring'] ), |
|
311 | + 'recurring_period' => isset( $_POST['wpinv_recurring_period'] ) ? wpinv_clean( $_POST['wpinv_recurring_period'] ) : null, |
|
312 | + 'recurring_interval' => isset( $_POST['wpinv_recurring_interval'] ) ? (int) $_POST['wpinv_recurring_interval'] : null, |
|
313 | + 'recurring_limit' => isset( $_POST['wpinv_recurring_limit'] ) ? (int) $_POST['wpinv_recurring_limit'] : null, |
|
314 | + 'is_free_trial' => isset( $_POST['wpinv_trial_interval'] ) ? ( 0 != (int) $_POST['wpinv_trial_interval'] ) : null, |
|
315 | + 'trial_period' => isset( $_POST['wpinv_trial_period'] ) ? wpinv_clean( $_POST['wpinv_trial_period'] ) : null, |
|
316 | + 'trial_interval' => isset( $_POST['wpinv_trial_interval'] ) ? (int) $_POST['wpinv_trial_interval'] : null, |
|
317 | + ) |
|
318 | 318 | ); |
319 | 319 | |
320 | - $item->save(); |
|
321 | - do_action( 'getpaid_item_metabox_save', $post_id, $item ); |
|
322 | - } |
|
320 | + $item->save(); |
|
321 | + do_action( 'getpaid_item_metabox_save', $post_id, $item ); |
|
322 | + } |
|
323 | 323 | } |
@@ -7,7 +7,7 @@ discard block |
||
7 | 7 | * |
8 | 8 | */ |
9 | 9 | |
10 | -if ( ! defined( 'ABSPATH' ) ) { |
|
10 | +if (!defined('ABSPATH')) { |
|
11 | 11 | exit; // Exit if accessed directly |
12 | 12 | } |
13 | 13 | |
@@ -21,27 +21,27 @@ discard block |
||
21 | 21 | * |
22 | 22 | * @param WP_Post $post |
23 | 23 | */ |
24 | - public static function output( $post ) { |
|
24 | + public static function output($post) { |
|
25 | 25 | |
26 | 26 | // Prepare the item. |
27 | - $item = new WPInv_Item( $post ); |
|
27 | + $item = new WPInv_Item($post); |
|
28 | 28 | |
29 | 29 | // Nonce field. |
30 | - wp_nonce_field( 'getpaid_meta_nonce', 'getpaid_meta_nonce' ); |
|
30 | + wp_nonce_field('getpaid_meta_nonce', 'getpaid_meta_nonce'); |
|
31 | 31 | |
32 | 32 | // Set the currency position. |
33 | 33 | $position = wpinv_currency_position(); |
34 | 34 | |
35 | - if ( $position == 'left_space' ) { |
|
35 | + if ($position == 'left_space') { |
|
36 | 36 | $position = 'left'; |
37 | 37 | } |
38 | 38 | |
39 | - if ( $position == 'right_space' ) { |
|
39 | + if ($position == 'right_space') { |
|
40 | 40 | $position = 'right'; |
41 | 41 | } |
42 | 42 | |
43 | 43 | ?> |
44 | - <input type="hidden" id="_wpi_current_type" value="<?php echo esc_attr( $item->get_type( 'edit' ) ); ?>" /> |
|
44 | + <input type="hidden" id="_wpi_current_type" value="<?php echo esc_attr($item->get_type('edit')); ?>" /> |
|
45 | 45 | <input type="hidden" id="_wpi_is_editable" value="<?php echo (int) $item->is_editable(); ?>" /> |
46 | 46 | <style> |
47 | 47 | #poststuff .input-group-text, |
@@ -51,21 +51,21 @@ discard block |
||
51 | 51 | </style> |
52 | 52 | <div class='bsui' style='max-width: 600px;padding-top: 10px; max-width: 820px;'> |
53 | 53 | |
54 | - <?php do_action( 'wpinv_item_details_metabox_before_price', $item ); ?> |
|
54 | + <?php do_action('wpinv_item_details_metabox_before_price', $item); ?> |
|
55 | 55 | <div class="form-group row"> |
56 | - <label class="col-sm-3 col-form-label" for="wpinv_item_price"><span><?php _e( 'Item Price', 'invoicing' )?></span></label> |
|
56 | + <label class="col-sm-3 col-form-label" for="wpinv_item_price"><span><?php _e('Item Price', 'invoicing')?></span></label> |
|
57 | 57 | <div class="col-sm-8"> |
58 | 58 | <div class="row"> |
59 | 59 | <div class="col-sm-4 getpaid-price-input"> |
60 | 60 | <div class="input-group input-group-sm"> |
61 | - <?php if( 'left' == $position ) : ?> |
|
61 | + <?php if ('left' == $position) : ?> |
|
62 | 62 | <div class="input-group-prepend"> |
63 | 63 | <span class="input-group-text" id="wpinv_item_price_symbol"><?php echo wpinv_currency_symbol(); ?></span> |
64 | 64 | </div> |
65 | 65 | <?php endif; ?> |
66 | - <input type="text" name="wpinv_item_price" id="wpinv_item_price" value="<?php echo esc_attr( $item->get_price( 'edit' ) ); ?>" placeholder="<?php echo esc_attr( wpinv_sanitize_amount( 0 ) ); ?>" class="form-control"> |
|
66 | + <input type="text" name="wpinv_item_price" id="wpinv_item_price" value="<?php echo esc_attr($item->get_price('edit')); ?>" placeholder="<?php echo esc_attr(wpinv_sanitize_amount(0)); ?>" class="form-control"> |
|
67 | 67 | |
68 | - <?php if( 'left' != $position ) : ?> |
|
68 | + <?php if ('left' != $position) : ?> |
|
69 | 69 | <div class="input-group-append"> |
70 | 70 | <span class="input-group-text" id="wpinv_item_price_symbol"><?php echo wpinv_currency_symbol(); ?></span> |
71 | 71 | </div> |
@@ -79,25 +79,25 @@ discard block |
||
79 | 79 | array( |
80 | 80 | 'id' => 'wpinv_recurring_interval', |
81 | 81 | 'name' => 'wpinv_recurring_interval', |
82 | - 'label' => __( 'Interval', 'invoicing' ), |
|
83 | - 'placeholder' => __( 'Select Interval', 'invoicing' ), |
|
84 | - 'value' => $item->get_recurring_interval( 'edit' ), |
|
82 | + 'label' => __('Interval', 'invoicing'), |
|
83 | + 'placeholder' => __('Select Interval', 'invoicing'), |
|
84 | + 'value' => $item->get_recurring_interval('edit'), |
|
85 | 85 | 'select2' => true, |
86 | 86 | 'data-allow-clear' => 'false', |
87 | 87 | 'options' => array( |
88 | - '1' => __( 'every', 'invoicing' ), |
|
89 | - '2' => __( 'every 2nd', 'invoicing' ), |
|
90 | - '3' => __( 'every 3rd', 'invoicing' ), |
|
91 | - '4' => __( 'every 4th', 'invoicing' ), |
|
92 | - '5' => __( 'every 5th', 'invoicing' ), |
|
93 | - '6' => __( 'every 6th', 'invoicing' ), |
|
94 | - '8' => __( 'every 8th', 'invoicing' ), |
|
95 | - '9' => __( 'every 9th', 'invoicing' ), |
|
96 | - '10' => __( 'every 10th', 'invoicing' ), |
|
97 | - '11' => __( 'every 11th', 'invoicing' ), |
|
98 | - '12' => __( 'every 12th', 'invoicing' ), |
|
99 | - '13' => __( 'every 13th', 'invoicing' ), |
|
100 | - '14' => __( 'every 14th', 'invoicing' ), |
|
88 | + '1' => __('every', 'invoicing'), |
|
89 | + '2' => __('every 2nd', 'invoicing'), |
|
90 | + '3' => __('every 3rd', 'invoicing'), |
|
91 | + '4' => __('every 4th', 'invoicing'), |
|
92 | + '5' => __('every 5th', 'invoicing'), |
|
93 | + '6' => __('every 6th', 'invoicing'), |
|
94 | + '8' => __('every 8th', 'invoicing'), |
|
95 | + '9' => __('every 9th', 'invoicing'), |
|
96 | + '10' => __('every 10th', 'invoicing'), |
|
97 | + '11' => __('every 11th', 'invoicing'), |
|
98 | + '12' => __('every 12th', 'invoicing'), |
|
99 | + '13' => __('every 13th', 'invoicing'), |
|
100 | + '14' => __('every 14th', 'invoicing'), |
|
101 | 101 | ) |
102 | 102 | ) |
103 | 103 | ); |
@@ -109,16 +109,16 @@ discard block |
||
109 | 109 | array( |
110 | 110 | 'id' => 'wpinv_recurring_period', |
111 | 111 | 'name' => 'wpinv_recurring_period', |
112 | - 'label' => __( 'Period', 'invoicing' ), |
|
113 | - 'placeholder' => __( 'Select Period', 'invoicing' ), |
|
114 | - 'value' => $item->get_recurring_period( 'edit' ), |
|
112 | + 'label' => __('Period', 'invoicing'), |
|
113 | + 'placeholder' => __('Select Period', 'invoicing'), |
|
114 | + 'value' => $item->get_recurring_period('edit'), |
|
115 | 115 | 'select2' => true, |
116 | 116 | 'data-allow-clear' => 'false', |
117 | 117 | 'options' => array( |
118 | - 'D' => __( 'day', 'invoicing' ), |
|
119 | - 'W' => __( 'week', 'invoicing' ), |
|
120 | - 'M' => __( 'month', 'invoicing' ), |
|
121 | - 'Y' => __( 'year', 'invoicing' ), |
|
118 | + 'D' => __('day', 'invoicing'), |
|
119 | + 'W' => __('week', 'invoicing'), |
|
120 | + 'M' => __('month', 'invoicing'), |
|
121 | + 'Y' => __('year', 'invoicing'), |
|
122 | 122 | ) |
123 | 123 | ) |
124 | 124 | ); |
@@ -130,9 +130,9 @@ discard block |
||
130 | 130 | <?php |
131 | 131 | |
132 | 132 | // Dynamic pricing. |
133 | - if( $item->supports_dynamic_pricing() ) { |
|
133 | + if ($item->supports_dynamic_pricing()) { |
|
134 | 134 | |
135 | - do_action( 'wpinv_item_details_metabox_before_dynamic_pricing_checkbox', $item ); |
|
135 | + do_action('wpinv_item_details_metabox_before_dynamic_pricing_checkbox', $item); |
|
136 | 136 | |
137 | 137 | // NYP toggle. |
138 | 138 | echo aui()->input( |
@@ -140,31 +140,31 @@ discard block |
||
140 | 140 | 'id' => 'wpinv_name_your_price', |
141 | 141 | 'name' => 'wpinv_name_your_price', |
142 | 142 | 'type' => 'checkbox', |
143 | - 'label' => apply_filters( 'wpinv_name_your_price_toggle_text', __( 'Let customers name their price', 'invoicing' ) ), |
|
143 | + 'label' => apply_filters('wpinv_name_your_price_toggle_text', __('Let customers name their price', 'invoicing')), |
|
144 | 144 | 'value' => '1', |
145 | 145 | 'checked' => $item->user_can_set_their_price(), |
146 | 146 | 'no_wrap' => true, |
147 | 147 | ) |
148 | 148 | ); |
149 | 149 | |
150 | - do_action( 'wpinv_item_details_metabox_dynamic_pricing_checkbox', $item ); |
|
150 | + do_action('wpinv_item_details_metabox_dynamic_pricing_checkbox', $item); |
|
151 | 151 | |
152 | 152 | } |
153 | 153 | |
154 | 154 | // Subscriptions. |
155 | - do_action( 'wpinv_item_details_metabox_before_subscription_checkbox', $item ); |
|
155 | + do_action('wpinv_item_details_metabox_before_subscription_checkbox', $item); |
|
156 | 156 | echo aui()->input( |
157 | 157 | array( |
158 | 158 | 'id' => 'wpinv_is_recurring', |
159 | 159 | 'name' => 'wpinv_is_recurring', |
160 | 160 | 'type' => 'checkbox', |
161 | - 'label' => apply_filters( 'wpinv_is_recurring_toggle_text', __( 'Charge customers a recurring amount for this item', 'invoicing' ) ), |
|
161 | + 'label' => apply_filters('wpinv_is_recurring_toggle_text', __('Charge customers a recurring amount for this item', 'invoicing')), |
|
162 | 162 | 'value' => '1', |
163 | 163 | 'checked' => $item->is_recurring(), |
164 | 164 | 'no_wrap' => true, |
165 | 165 | ) |
166 | 166 | ); |
167 | - do_action( 'wpinv_item_details_metabox_subscription_checkbox', $item ); |
|
167 | + do_action('wpinv_item_details_metabox_subscription_checkbox', $item); |
|
168 | 168 | |
169 | 169 | ?> |
170 | 170 | <div class="wpinv_show_if_recurring"> |
@@ -174,30 +174,30 @@ discard block |
||
174 | 174 | </div> |
175 | 175 | </div> |
176 | 176 | <div class="col-sm-1 pt-2 pl-0"> |
177 | - <span class="wpi-help-tip dashicons dashicons-editor-help wpinv_show_if_recurring" title="<?php esc_attr_e( 'Set the subscription price, billing interval and period.', 'invoicing' ); ?>"></span> |
|
177 | + <span class="wpi-help-tip dashicons dashicons-editor-help wpinv_show_if_recurring" title="<?php esc_attr_e('Set the subscription price, billing interval and period.', 'invoicing'); ?>"></span> |
|
178 | 178 | </div> |
179 | 179 | </div> |
180 | - <?php do_action( 'wpinv_item_details_metabox_after_price', $item ); ?> |
|
180 | + <?php do_action('wpinv_item_details_metabox_after_price', $item); ?> |
|
181 | 181 | |
182 | - <?php if( $item->supports_dynamic_pricing() ) : ?> |
|
183 | - <?php do_action( 'wpinv_item_details_metabox_before_minimum_price', $item ); ?> |
|
182 | + <?php if ($item->supports_dynamic_pricing()) : ?> |
|
183 | + <?php do_action('wpinv_item_details_metabox_before_minimum_price', $item); ?> |
|
184 | 184 | <div class="wpinv_show_if_dynamic wpinv_minimum_price"> |
185 | 185 | |
186 | 186 | <div class="form-group row"> |
187 | 187 | <label for="wpinv_minimum_price" class="col-sm-3 col-form-label"> |
188 | - <?php _e( 'Minimum Price', 'invoicing' );?> |
|
188 | + <?php _e('Minimum Price', 'invoicing'); ?> |
|
189 | 189 | </label> |
190 | 190 | <div class="col-sm-8"> |
191 | 191 | <div class="input-group input-group-sm"> |
192 | - <?php if( 'left' == $position ) : ?> |
|
192 | + <?php if ('left' == $position) : ?> |
|
193 | 193 | <div class="input-group-prepend"> |
194 | 194 | <span class="input-group-text" id="wpinv_item_minimum_price_symbol"><?php echo wpinv_currency_symbol(); ?></span> |
195 | 195 | </div> |
196 | 196 | <?php endif; ?> |
197 | 197 | |
198 | - <input type="text" name="wpinv_minimum_price" id="wpinv_minimum_price" value="<?php echo esc_attr( $item->get_minimum_price( 'edit' ) ); ?>" placeholder="<?php echo esc_attr( wpinv_sanitize_amount( 0 ) ); ?>" class="form-control"> |
|
198 | + <input type="text" name="wpinv_minimum_price" id="wpinv_minimum_price" value="<?php echo esc_attr($item->get_minimum_price('edit')); ?>" placeholder="<?php echo esc_attr(wpinv_sanitize_amount(0)); ?>" class="form-control"> |
|
199 | 199 | |
200 | - <?php if( 'left' != $position ) : ?> |
|
200 | + <?php if ('left' != $position) : ?> |
|
201 | 201 | <div class="input-group-append"> |
202 | 202 | <span class="input-group-text" id="wpinv_item_minimum_price_symbol"><?php echo wpinv_currency_symbol(); ?></span> |
203 | 203 | </div> |
@@ -206,45 +206,45 @@ discard block |
||
206 | 206 | </div> |
207 | 207 | |
208 | 208 | <div class="col-sm-1 pt-2 pl-0"> |
209 | - <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e( 'Enter the minimum amount that users are allowed to set', 'invoicing' ); ?>"></span> |
|
209 | + <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e('Enter the minimum amount that users are allowed to set', 'invoicing'); ?>"></span> |
|
210 | 210 | </div> |
211 | 211 | </div> |
212 | 212 | |
213 | 213 | </div> |
214 | - <?php do_action( 'wpinv_item_details_metabox_minimum_price', $item ); ?> |
|
214 | + <?php do_action('wpinv_item_details_metabox_minimum_price', $item); ?> |
|
215 | 215 | <?php endif; ?> |
216 | 216 | |
217 | - <?php do_action( 'wpinv_item_details_metabox_before_maximum_renewals', $item ); ?> |
|
217 | + <?php do_action('wpinv_item_details_metabox_before_maximum_renewals', $item); ?> |
|
218 | 218 | <div class="wpinv_show_if_recurring wpinv_maximum_renewals"> |
219 | 219 | |
220 | 220 | <div class="form-group row"> |
221 | 221 | <label for="wpinv_recurring_limit" class="col-sm-3 col-form-label"> |
222 | - <?php _e( 'Maximum Renewals', 'invoicing' );?> |
|
222 | + <?php _e('Maximum Renewals', 'invoicing'); ?> |
|
223 | 223 | </label> |
224 | 224 | <div class="col-sm-8"> |
225 | - <input type="number" value="<?php echo esc_attr( $item->get_recurring_limit( 'edit' ) ); ?>" placeholder="0" name="wpinv_recurring_limit" id="wpinv_recurring_limit" style="width: 100%;" /> |
|
225 | + <input type="number" value="<?php echo esc_attr($item->get_recurring_limit('edit')); ?>" placeholder="0" name="wpinv_recurring_limit" id="wpinv_recurring_limit" style="width: 100%;" /> |
|
226 | 226 | </div> |
227 | 227 | <div class="col-sm-1 pt-2 pl-0"> |
228 | - <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e( 'Leave empty if you want the subscription to renew until it is cancelled.', 'invoicing' ); ?>"></span> |
|
228 | + <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e('Leave empty if you want the subscription to renew until it is cancelled.', 'invoicing'); ?>"></span> |
|
229 | 229 | </div> |
230 | 230 | </div> |
231 | 231 | |
232 | 232 | </div> |
233 | - <?php do_action( 'wpinv_item_details_metabox_maximum_renewals', $item ); ?> |
|
233 | + <?php do_action('wpinv_item_details_metabox_maximum_renewals', $item); ?> |
|
234 | 234 | |
235 | - <?php do_action( 'wpinv_item_details_metabox_before_free_trial', $item ); ?> |
|
235 | + <?php do_action('wpinv_item_details_metabox_before_free_trial', $item); ?> |
|
236 | 236 | <div class="wpinv_show_if_recurring wpinv_free_trial"> |
237 | 237 | |
238 | 238 | <div class="form-group row"> |
239 | - <label class="col-sm-3 col-form-label" for="wpinv_trial_interval"><?php _e( 'Free Trial', 'invoicing' )?></label> |
|
239 | + <label class="col-sm-3 col-form-label" for="wpinv_trial_interval"><?php _e('Free Trial', 'invoicing')?></label> |
|
240 | 240 | |
241 | 241 | <div class="col-sm-8"> |
242 | 242 | <div class="row"> |
243 | 243 | <div class="col-sm-6"> |
244 | - <?php $value = $item->has_free_trial() ? $item->get_trial_interval( 'edit' ) : 0;?> |
|
244 | + <?php $value = $item->has_free_trial() ? $item->get_trial_interval('edit') : 0; ?> |
|
245 | 245 | |
246 | 246 | <div> |
247 | - <input type="number" name="wpinv_trial_interval" style="width: 100%;" placeholder="0" id="wpinv_trial_interval" value="<?php echo esc_attr( $value ); ?>" > |
|
247 | + <input type="number" name="wpinv_trial_interval" style="width: 100%;" placeholder="0" id="wpinv_trial_interval" value="<?php echo esc_attr($value); ?>" > |
|
248 | 248 | </div> |
249 | 249 | </div> |
250 | 250 | <div class="col-sm-6"> |
@@ -253,17 +253,17 @@ discard block |
||
253 | 253 | array( |
254 | 254 | 'id' => 'wpinv_trial_period', |
255 | 255 | 'name' => 'wpinv_trial_period', |
256 | - 'label' => __( 'Trial Period', 'invoicing' ), |
|
257 | - 'placeholder' => __( 'Trial Period', 'invoicing' ), |
|
258 | - 'value' => $item->get_recurring_period( 'edit' ), |
|
256 | + 'label' => __('Trial Period', 'invoicing'), |
|
257 | + 'placeholder' => __('Trial Period', 'invoicing'), |
|
258 | + 'value' => $item->get_recurring_period('edit'), |
|
259 | 259 | 'select2' => true, |
260 | 260 | 'data-allow-clear' => 'false', |
261 | 261 | 'no_wrap' => true, |
262 | 262 | 'options' => array( |
263 | - 'D' => __( 'day(s)', 'invoicing' ), |
|
264 | - 'W' => __( 'week(s)', 'invoicing' ), |
|
265 | - 'M' => __( 'month(s)', 'invoicing' ), |
|
266 | - 'Y' => __( 'year(s)', 'invoicing' ), |
|
263 | + 'D' => __('day(s)', 'invoicing'), |
|
264 | + 'W' => __('week(s)', 'invoicing'), |
|
265 | + 'M' => __('month(s)', 'invoicing'), |
|
266 | + 'Y' => __('year(s)', 'invoicing'), |
|
267 | 267 | ) |
268 | 268 | ) |
269 | 269 | ); |
@@ -274,15 +274,15 @@ discard block |
||
274 | 274 | </div> |
275 | 275 | |
276 | 276 | <div class="col-sm-1 pt-2 pl-0"> |
277 | - <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e( 'An optional period of time to wait before charging the first recurring payment.', 'invoicing' ); ?>"></span> |
|
277 | + <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e('An optional period of time to wait before charging the first recurring payment.', 'invoicing'); ?>"></span> |
|
278 | 278 | </div> |
279 | 279 | |
280 | 280 | </div> |
281 | 281 | |
282 | 282 | </div> |
283 | - <?php do_action( 'wpinv_item_details_metabox__free_trial', $item ); ?> |
|
283 | + <?php do_action('wpinv_item_details_metabox__free_trial', $item); ?> |
|
284 | 284 | |
285 | - <?php do_action( 'wpinv_item_details_metabox_item_details', $item ); ?> |
|
285 | + <?php do_action('wpinv_item_details_metabox_item_details', $item); ?> |
|
286 | 286 | </div> |
287 | 287 | <?php |
288 | 288 | |
@@ -293,31 +293,31 @@ discard block |
||
293 | 293 | * |
294 | 294 | * @param int $post_id |
295 | 295 | */ |
296 | - public static function save( $post_id ) { |
|
296 | + public static function save($post_id) { |
|
297 | 297 | |
298 | 298 | // Prepare the item. |
299 | - $item = new WPInv_Item( $post_id ); |
|
299 | + $item = new WPInv_Item($post_id); |
|
300 | 300 | |
301 | 301 | // Load new data. |
302 | 302 | $item->set_props( |
303 | 303 | array( |
304 | - 'price' => isset( $_POST['wpinv_item_price'] ) ? (float) $_POST['wpinv_item_price'] : null, |
|
305 | - 'vat_rule' => isset( $_POST['wpinv_vat_rules'] ) ? wpinv_clean( $_POST['wpinv_vat_rules'] ) : null, |
|
306 | - 'vat_class' => isset( $_POST['wpinv_vat_class'] ) ? wpinv_clean( $_POST['wpinv_vat_class'] ) : null, |
|
307 | - 'type' => isset( $_POST['wpinv_item_type'] ) ? wpinv_clean( $_POST['wpinv_item_type'] ) : null, |
|
308 | - 'is_dynamic_pricing' => isset( $_POST['wpinv_name_your_price'] ), |
|
309 | - 'minimum_price' => isset( $_POST['wpinv_minimum_price'] ) ? (float) $_POST['wpinv_minimum_price'] : null, |
|
310 | - 'is_recurring' => isset( $_POST['wpinv_is_recurring'] ), |
|
311 | - 'recurring_period' => isset( $_POST['wpinv_recurring_period'] ) ? wpinv_clean( $_POST['wpinv_recurring_period'] ) : null, |
|
312 | - 'recurring_interval' => isset( $_POST['wpinv_recurring_interval'] ) ? (int) $_POST['wpinv_recurring_interval'] : null, |
|
313 | - 'recurring_limit' => isset( $_POST['wpinv_recurring_limit'] ) ? (int) $_POST['wpinv_recurring_limit'] : null, |
|
314 | - 'is_free_trial' => isset( $_POST['wpinv_trial_interval'] ) ? ( 0 != (int) $_POST['wpinv_trial_interval'] ) : null, |
|
315 | - 'trial_period' => isset( $_POST['wpinv_trial_period'] ) ? wpinv_clean( $_POST['wpinv_trial_period'] ) : null, |
|
316 | - 'trial_interval' => isset( $_POST['wpinv_trial_interval'] ) ? (int) $_POST['wpinv_trial_interval'] : null, |
|
304 | + 'price' => isset($_POST['wpinv_item_price']) ? (float) $_POST['wpinv_item_price'] : null, |
|
305 | + 'vat_rule' => isset($_POST['wpinv_vat_rules']) ? wpinv_clean($_POST['wpinv_vat_rules']) : null, |
|
306 | + 'vat_class' => isset($_POST['wpinv_vat_class']) ? wpinv_clean($_POST['wpinv_vat_class']) : null, |
|
307 | + 'type' => isset($_POST['wpinv_item_type']) ? wpinv_clean($_POST['wpinv_item_type']) : null, |
|
308 | + 'is_dynamic_pricing' => isset($_POST['wpinv_name_your_price']), |
|
309 | + 'minimum_price' => isset($_POST['wpinv_minimum_price']) ? (float) $_POST['wpinv_minimum_price'] : null, |
|
310 | + 'is_recurring' => isset($_POST['wpinv_is_recurring']), |
|
311 | + 'recurring_period' => isset($_POST['wpinv_recurring_period']) ? wpinv_clean($_POST['wpinv_recurring_period']) : null, |
|
312 | + 'recurring_interval' => isset($_POST['wpinv_recurring_interval']) ? (int) $_POST['wpinv_recurring_interval'] : null, |
|
313 | + 'recurring_limit' => isset($_POST['wpinv_recurring_limit']) ? (int) $_POST['wpinv_recurring_limit'] : null, |
|
314 | + 'is_free_trial' => isset($_POST['wpinv_trial_interval']) ? (0 != (int) $_POST['wpinv_trial_interval']) : null, |
|
315 | + 'trial_period' => isset($_POST['wpinv_trial_period']) ? wpinv_clean($_POST['wpinv_trial_period']) : null, |
|
316 | + 'trial_interval' => isset($_POST['wpinv_trial_interval']) ? (int) $_POST['wpinv_trial_interval'] : null, |
|
317 | 317 | ) |
318 | 318 | ); |
319 | 319 | |
320 | 320 | $item->save(); |
321 | - do_action( 'getpaid_item_metabox_save', $post_id, $item ); |
|
321 | + do_action('getpaid_item_metabox_save', $post_id, $item); |
|
322 | 322 | } |
323 | 323 | } |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | */ |
9 | 9 | |
10 | 10 | if ( ! defined( 'ABSPATH' ) ) { |
11 | - exit; // Exit if accessed directly |
|
11 | + exit; // Exit if accessed directly |
|
12 | 12 | } |
13 | 13 | |
14 | 14 | /** |
@@ -17,10 +17,10 @@ discard block |
||
17 | 17 | class GetPaid_Meta_Box_Invoice_Address { |
18 | 18 | |
19 | 19 | /** |
20 | - * Output the metabox. |
|
21 | - * |
|
22 | - * @param WP_Post $post |
|
23 | - */ |
|
20 | + * Output the metabox. |
|
21 | + * |
|
22 | + * @param WP_Post $post |
|
23 | + */ |
|
24 | 24 | public static function output( $post ) { |
25 | 25 | |
26 | 26 | // Prepare the invoice. |
@@ -300,18 +300,18 @@ discard block |
||
300 | 300 | } |
301 | 301 | |
302 | 302 | /** |
303 | - * Save meta box data. |
|
304 | - * |
|
305 | - * @param int $post_id |
|
306 | - */ |
|
307 | - public static function save( $post_id ) { |
|
303 | + * Save meta box data. |
|
304 | + * |
|
305 | + * @param int $post_id |
|
306 | + */ |
|
307 | + public static function save( $post_id ) { |
|
308 | 308 | |
309 | 309 | // Prepare the invoice. |
310 | 310 | $invoice = new WPInv_Invoice( $post_id ); |
311 | 311 | |
312 | 312 | // Load new data. |
313 | 313 | $invoice->set_props( |
314 | - array( |
|
314 | + array( |
|
315 | 315 | 'template' => isset( $_POST['wpinv_template'] ) ? wpinv_clean( $_POST['wpinv_template'] ) : null, |
316 | 316 | 'email_cc' => isset( $_POST['wpinv_cc'] ) ? wpinv_clean( $_POST['wpinv_cc'] ) : null, |
317 | 317 | 'disable_taxes' => isset( $_POST['disable_taxes'] ), |
@@ -332,7 +332,7 @@ discard block |
||
332 | 332 | 'due_date' => isset( $_POST['wpinv_due_date'] ) ? wpinv_clean( $_POST['wpinv_due_date'] ) : null, |
333 | 333 | 'number' => isset( $_POST['wpinv_number'] ) ? wpinv_clean( $_POST['wpinv_number'] ) : null, |
334 | 334 | 'status' => isset( $_POST['wpinv_status'] ) ? wpinv_clean( $_POST['wpinv_status'] ) : null, |
335 | - ) |
|
335 | + ) |
|
336 | 336 | ); |
337 | 337 | |
338 | 338 | // Recalculate totals. |
@@ -362,6 +362,6 @@ discard block |
||
362 | 362 | } |
363 | 363 | |
364 | 364 | // Fires after an invoice is saved. |
365 | - do_action( 'wpinv_invoice_metabox_saved', $invoice ); |
|
366 | - } |
|
365 | + do_action( 'wpinv_invoice_metabox_saved', $invoice ); |
|
366 | + } |
|
367 | 367 | } |
@@ -7,7 +7,7 @@ discard block |
||
7 | 7 | * |
8 | 8 | */ |
9 | 9 | |
10 | -if ( ! defined( 'ABSPATH' ) ) { |
|
10 | +if (!defined('ABSPATH')) { |
|
11 | 11 | exit; // Exit if accessed directly |
12 | 12 | } |
13 | 13 | |
@@ -21,12 +21,12 @@ discard block |
||
21 | 21 | * |
22 | 22 | * @param WP_Post $post |
23 | 23 | */ |
24 | - public static function output( $post ) { |
|
24 | + public static function output($post) { |
|
25 | 25 | |
26 | 26 | // Prepare the invoice. |
27 | - $invoice = new WPInv_Invoice( $post ); |
|
27 | + $invoice = new WPInv_Invoice($post); |
|
28 | 28 | |
29 | - wp_nonce_field( 'getpaid_meta_nonce', 'getpaid_meta_nonce' ); |
|
29 | + wp_nonce_field('getpaid_meta_nonce', 'getpaid_meta_nonce'); |
|
30 | 30 | |
31 | 31 | ?> |
32 | 32 | |
@@ -42,13 +42,13 @@ discard block |
||
42 | 42 | <div class="col-12 col-sm-6"> |
43 | 43 | <div id="getpaid-invoice-user-id-wrapper" class="form-group"> |
44 | 44 | <div> |
45 | - <label for="post_author_override"><?php _e( 'Customer', 'invoicing' );?></label> |
|
45 | + <label for="post_author_override"><?php _e('Customer', 'invoicing'); ?></label> |
|
46 | 46 | </div> |
47 | 47 | <?php |
48 | 48 | wpinv_dropdown_users( |
49 | 49 | array( |
50 | 50 | 'name' => 'post_author_override', |
51 | - 'selected' => $invoice->get_id() ? $invoice->get_user_id( 'edit' ) : get_current_user_id(), |
|
51 | + 'selected' => $invoice->get_id() ? $invoice->get_user_id('edit') : get_current_user_id(), |
|
52 | 52 | 'include_selected' => true, |
53 | 53 | 'show' => 'display_name_with_email', |
54 | 54 | 'orderby' => 'user_email', |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | 'type' => 'text', |
67 | 67 | 'id' => 'getpaid-invoice-new-user-email', |
68 | 68 | 'name' => 'wpinv_email', |
69 | - 'label' => __( 'Email', 'invoicing' ) . '<span class="required">*</span>', |
|
69 | + 'label' => __('Email', 'invoicing') . '<span class="required">*</span>', |
|
70 | 70 | 'label_type' => 'vertical', |
71 | 71 | 'placeholder' => '[email protected]', |
72 | 72 | 'class' => 'form-control-sm', |
@@ -76,18 +76,18 @@ discard block |
||
76 | 76 | </div> |
77 | 77 | </div> |
78 | 78 | <div class="col-12 col-sm-6 form-group mt-sm-4"> |
79 | - <?php if ( ! $invoice->is_paid() && ! $invoice->is_refunded() ) : ?> |
|
79 | + <?php if (!$invoice->is_paid() && !$invoice->is_refunded()) : ?> |
|
80 | 80 | <a id="getpaid-invoice-fill-user-details" class="button button-small button-secondary" href="javascript:void(0)"> |
81 | 81 | <i aria-hidden="true" class="fa fa-refresh"></i> |
82 | - <?php _e( 'Fill User Details', 'invoicing' );?> |
|
82 | + <?php _e('Fill User Details', 'invoicing'); ?> |
|
83 | 83 | </a> |
84 | 84 | <a id="getpaid-invoice-create-new-user-button" class="button button-small button-secondary" href="javascript:void(0)"> |
85 | 85 | <i aria-hidden="true" class="fa fa-plus"></i> |
86 | - <?php _e( 'Add New User', 'invoicing' );?> |
|
86 | + <?php _e('Add New User', 'invoicing'); ?> |
|
87 | 87 | </a> |
88 | 88 | <a id="getpaid-invoice-cancel-create-new-user" class="button button-small button-secondary d-none" href="javascript:void(0)"> |
89 | 89 | <i aria-hidden="true" class="fa fa-close"></i> |
90 | - <?php _e( 'Cancel', 'invoicing' );?> |
|
90 | + <?php _e('Cancel', 'invoicing'); ?> |
|
91 | 91 | </a> |
92 | 92 | <?php endif; ?> |
93 | 93 | </div> |
@@ -100,11 +100,11 @@ discard block |
||
100 | 100 | 'type' => 'text', |
101 | 101 | 'id' => 'wpinv_first_name', |
102 | 102 | 'name' => 'wpinv_first_name', |
103 | - 'label' => __( 'First Name', 'invoicing' ), |
|
103 | + 'label' => __('First Name', 'invoicing'), |
|
104 | 104 | 'label_type' => 'vertical', |
105 | 105 | 'placeholder' => 'Jane', |
106 | 106 | 'class' => 'form-control-sm', |
107 | - 'value' => $invoice->get_first_name( 'edit' ), |
|
107 | + 'value' => $invoice->get_first_name('edit'), |
|
108 | 108 | ) |
109 | 109 | ); |
110 | 110 | ?> |
@@ -116,11 +116,11 @@ discard block |
||
116 | 116 | 'type' => 'text', |
117 | 117 | 'id' => 'wpinv_last_name', |
118 | 118 | 'name' => 'wpinv_last_name', |
119 | - 'label' => __( 'Last Name', 'invoicing' ), |
|
119 | + 'label' => __('Last Name', 'invoicing'), |
|
120 | 120 | 'label_type' => 'vertical', |
121 | 121 | 'placeholder' => 'Doe', |
122 | 122 | 'class' => 'form-control-sm', |
123 | - 'value' => $invoice->get_last_name( 'edit' ), |
|
123 | + 'value' => $invoice->get_last_name('edit'), |
|
124 | 124 | ) |
125 | 125 | ); |
126 | 126 | ?> |
@@ -135,11 +135,11 @@ discard block |
||
135 | 135 | 'type' => 'text', |
136 | 136 | 'id' => 'wpinv_company', |
137 | 137 | 'name' => 'wpinv_company', |
138 | - 'label' => __( 'Company', 'invoicing' ), |
|
138 | + 'label' => __('Company', 'invoicing'), |
|
139 | 139 | 'label_type' => 'vertical', |
140 | 140 | 'placeholder' => 'Acme Corporation', |
141 | 141 | 'class' => 'form-control-sm', |
142 | - 'value' => $invoice->get_company( 'edit' ), |
|
142 | + 'value' => $invoice->get_company('edit'), |
|
143 | 143 | ) |
144 | 144 | ); |
145 | 145 | ?> |
@@ -151,11 +151,11 @@ discard block |
||
151 | 151 | 'type' => 'text', |
152 | 152 | 'id' => 'wpinv_vat_number', |
153 | 153 | 'name' => 'wpinv_vat_number', |
154 | - 'label' => __( 'Vat Number', 'invoicing' ), |
|
154 | + 'label' => __('Vat Number', 'invoicing'), |
|
155 | 155 | 'label_type' => 'vertical', |
156 | 156 | 'placeholder' => '1234567890', |
157 | 157 | 'class' => 'form-control-sm', |
158 | - 'value' => $invoice->get_vat_number( 'edit' ), |
|
158 | + 'value' => $invoice->get_vat_number('edit'), |
|
159 | 159 | ) |
160 | 160 | ); |
161 | 161 | ?> |
@@ -170,11 +170,11 @@ discard block |
||
170 | 170 | 'type' => 'text', |
171 | 171 | 'id' => 'wpinv_address', |
172 | 172 | 'name' => 'wpinv_address', |
173 | - 'label' => __( 'Address', 'invoicing' ), |
|
173 | + 'label' => __('Address', 'invoicing'), |
|
174 | 174 | 'label_type' => 'vertical', |
175 | 175 | 'placeholder' => 'Blekersdijk 295', |
176 | 176 | 'class' => 'form-control-sm', |
177 | - 'value' => $invoice->get_address( 'edit' ), |
|
177 | + 'value' => $invoice->get_address('edit'), |
|
178 | 178 | ) |
179 | 179 | ); |
180 | 180 | ?> |
@@ -186,11 +186,11 @@ discard block |
||
186 | 186 | 'type' => 'text', |
187 | 187 | 'id' => 'wpinv_city', |
188 | 188 | 'name' => 'wpinv_city', |
189 | - 'label' => __( 'City', 'invoicing' ), |
|
189 | + 'label' => __('City', 'invoicing'), |
|
190 | 190 | 'label_type' => 'vertical', |
191 | 191 | 'placeholder' => 'Dolembreux', |
192 | 192 | 'class' => 'form-control-sm', |
193 | - 'value' => $invoice->get_vat_number( 'edit' ), |
|
193 | + 'value' => $invoice->get_vat_number('edit'), |
|
194 | 194 | ) |
195 | 195 | ); |
196 | 196 | ?> |
@@ -204,11 +204,11 @@ discard block |
||
204 | 204 | array( |
205 | 205 | 'id' => 'wpinv_country', |
206 | 206 | 'name' => 'wpinv_country', |
207 | - 'label' => __( 'Country', 'invoicing' ), |
|
207 | + 'label' => __('Country', 'invoicing'), |
|
208 | 208 | 'label_type' => 'vertical', |
209 | - 'placeholder' => __( 'Choose a country', 'invoicing' ), |
|
209 | + 'placeholder' => __('Choose a country', 'invoicing'), |
|
210 | 210 | 'class' => 'form-control-sm', |
211 | - 'value' => $invoice->get_country( 'edit' ), |
|
211 | + 'value' => $invoice->get_country('edit'), |
|
212 | 212 | 'options' => wpinv_get_country_list(), |
213 | 213 | 'data-allow-clear' => 'false', |
214 | 214 | 'select2' => true, |
@@ -219,20 +219,20 @@ discard block |
||
219 | 219 | <div class="col-12 col-sm-6"> |
220 | 220 | <?php |
221 | 221 | |
222 | - $states = wpinv_get_country_states( $invoice->get_country( 'edit' ) ); |
|
222 | + $states = wpinv_get_country_states($invoice->get_country('edit')); |
|
223 | 223 | |
224 | - if ( empty( $states ) ) { |
|
224 | + if (empty($states)) { |
|
225 | 225 | |
226 | 226 | echo aui()->input( |
227 | 227 | array( |
228 | 228 | 'type' => 'text', |
229 | 229 | 'id' => 'wpinv_state', |
230 | 230 | 'name' => 'wpinv_state', |
231 | - 'label' => __( 'State', 'invoicing' ), |
|
231 | + 'label' => __('State', 'invoicing'), |
|
232 | 232 | 'label_type' => 'vertical', |
233 | 233 | 'placeholder' => 'Liège', |
234 | 234 | 'class' => 'form-control-sm', |
235 | - 'value' => $invoice->get_state( 'edit' ), |
|
235 | + 'value' => $invoice->get_state('edit'), |
|
236 | 236 | ) |
237 | 237 | ); |
238 | 238 | |
@@ -242,11 +242,11 @@ discard block |
||
242 | 242 | array( |
243 | 243 | 'id' => 'wpinv_state', |
244 | 244 | 'name' => 'wpinv_state', |
245 | - 'label' => __( 'State', 'invoicing' ), |
|
245 | + 'label' => __('State', 'invoicing'), |
|
246 | 246 | 'label_type' => 'vertical', |
247 | - 'placeholder' => __( 'Select a state', 'invoicing' ), |
|
247 | + 'placeholder' => __('Select a state', 'invoicing'), |
|
248 | 248 | 'class' => 'form-control-sm', |
249 | - 'value' => $invoice->get_state( 'edit' ), |
|
249 | + 'value' => $invoice->get_state('edit'), |
|
250 | 250 | 'options' => $states, |
251 | 251 | 'data-allow-clear' => 'false', |
252 | 252 | 'select2' => true, |
@@ -267,11 +267,11 @@ discard block |
||
267 | 267 | 'type' => 'text', |
268 | 268 | 'id' => 'wpinv_zip', |
269 | 269 | 'name' => 'wpinv_zip', |
270 | - 'label' => __( 'Zip / Postal Code', 'invoicing' ), |
|
270 | + 'label' => __('Zip / Postal Code', 'invoicing'), |
|
271 | 271 | 'label_type' => 'vertical', |
272 | 272 | 'placeholder' => '4140', |
273 | 273 | 'class' => 'form-control-sm', |
274 | - 'value' => $invoice->get_zip( 'edit' ), |
|
274 | + 'value' => $invoice->get_zip('edit'), |
|
275 | 275 | ) |
276 | 276 | ); |
277 | 277 | ?> |
@@ -283,11 +283,11 @@ discard block |
||
283 | 283 | 'type' => 'text', |
284 | 284 | 'id' => 'wpinv_phone', |
285 | 285 | 'name' => 'wpinv_phone', |
286 | - 'label' => __( 'Phone', 'invoicing' ), |
|
286 | + 'label' => __('Phone', 'invoicing'), |
|
287 | 287 | 'label_type' => 'vertical', |
288 | 288 | 'placeholder' => '0493 18 45822', |
289 | 289 | 'class' => 'form-control-sm', |
290 | - 'value' => $invoice->get_phone( 'edit' ), |
|
290 | + 'value' => $invoice->get_phone('edit'), |
|
291 | 291 | ) |
292 | 292 | ); |
293 | 293 | ?> |
@@ -304,34 +304,34 @@ discard block |
||
304 | 304 | * |
305 | 305 | * @param int $post_id |
306 | 306 | */ |
307 | - public static function save( $post_id ) { |
|
307 | + public static function save($post_id) { |
|
308 | 308 | |
309 | 309 | // Prepare the invoice. |
310 | - $invoice = new WPInv_Invoice( $post_id ); |
|
310 | + $invoice = new WPInv_Invoice($post_id); |
|
311 | 311 | |
312 | 312 | // Load new data. |
313 | 313 | $invoice->set_props( |
314 | 314 | array( |
315 | - 'template' => isset( $_POST['wpinv_template'] ) ? wpinv_clean( $_POST['wpinv_template'] ) : null, |
|
316 | - 'email_cc' => isset( $_POST['wpinv_cc'] ) ? wpinv_clean( $_POST['wpinv_cc'] ) : null, |
|
317 | - 'disable_taxes' => isset( $_POST['disable_taxes'] ), |
|
318 | - 'currency' => isset( $_POST['wpinv_currency'] ) ? wpinv_clean( $_POST['wpinv_currency'] ) : null, |
|
319 | - 'gateway' => isset( $_POST['wpinv_gateway'] ) ? wpinv_clean( $_POST['wpinv_gateway'] ) : null, |
|
320 | - 'address' => isset( $_POST['wpinv_address'] ) ? wpinv_clean( $_POST['wpinv_address'] ) : null, |
|
321 | - 'vat_number' => isset( $_POST['wpinv_vat_number'] ) ? wpinv_clean( $_POST['wpinv_vat_number'] ) : null, |
|
322 | - 'company' => isset( $_POST['wpinv_company'] ) ? wpinv_clean( $_POST['wpinv_company'] ) : null, |
|
323 | - 'zip' => isset( $_POST['wpinv_zip'] ) ? wpinv_clean( $_POST['wpinv_zip'] ) : null, |
|
324 | - 'state' => isset( $_POST['wpinv_state'] ) ? wpinv_clean( $_POST['wpinv_state'] ) : null, |
|
325 | - 'city' => isset( $_POST['wpinv_city'] ) ? wpinv_clean( $_POST['wpinv_city'] ) : null, |
|
326 | - 'country' => isset( $_POST['wpinv_country'] ) ? wpinv_clean( $_POST['wpinv_country'] ) : null, |
|
327 | - 'phone' => isset( $_POST['wpinv_phone'] ) ? wpinv_clean( $_POST['wpinv_phone'] ) : null, |
|
328 | - 'first_name' => isset( $_POST['wpinv_first_name'] ) ? wpinv_clean( $_POST['wpinv_first_name'] ) : null, |
|
329 | - 'last_name' => isset( $_POST['wpinv_last_name'] ) ? wpinv_clean( $_POST['wpinv_last_name'] ) : null, |
|
330 | - 'author' => isset( $_POST['post_author_override'] ) ? wpinv_clean( $_POST['post_author_override'] ) : null, |
|
331 | - 'date_created' => isset( $_POST['date_created'] ) ? wpinv_clean( $_POST['date_created'] ) : null, |
|
332 | - 'due_date' => isset( $_POST['wpinv_due_date'] ) ? wpinv_clean( $_POST['wpinv_due_date'] ) : null, |
|
333 | - 'number' => isset( $_POST['wpinv_number'] ) ? wpinv_clean( $_POST['wpinv_number'] ) : null, |
|
334 | - 'status' => isset( $_POST['wpinv_status'] ) ? wpinv_clean( $_POST['wpinv_status'] ) : null, |
|
315 | + 'template' => isset($_POST['wpinv_template']) ? wpinv_clean($_POST['wpinv_template']) : null, |
|
316 | + 'email_cc' => isset($_POST['wpinv_cc']) ? wpinv_clean($_POST['wpinv_cc']) : null, |
|
317 | + 'disable_taxes' => isset($_POST['disable_taxes']), |
|
318 | + 'currency' => isset($_POST['wpinv_currency']) ? wpinv_clean($_POST['wpinv_currency']) : null, |
|
319 | + 'gateway' => isset($_POST['wpinv_gateway']) ? wpinv_clean($_POST['wpinv_gateway']) : null, |
|
320 | + 'address' => isset($_POST['wpinv_address']) ? wpinv_clean($_POST['wpinv_address']) : null, |
|
321 | + 'vat_number' => isset($_POST['wpinv_vat_number']) ? wpinv_clean($_POST['wpinv_vat_number']) : null, |
|
322 | + 'company' => isset($_POST['wpinv_company']) ? wpinv_clean($_POST['wpinv_company']) : null, |
|
323 | + 'zip' => isset($_POST['wpinv_zip']) ? wpinv_clean($_POST['wpinv_zip']) : null, |
|
324 | + 'state' => isset($_POST['wpinv_state']) ? wpinv_clean($_POST['wpinv_state']) : null, |
|
325 | + 'city' => isset($_POST['wpinv_city']) ? wpinv_clean($_POST['wpinv_city']) : null, |
|
326 | + 'country' => isset($_POST['wpinv_country']) ? wpinv_clean($_POST['wpinv_country']) : null, |
|
327 | + 'phone' => isset($_POST['wpinv_phone']) ? wpinv_clean($_POST['wpinv_phone']) : null, |
|
328 | + 'first_name' => isset($_POST['wpinv_first_name']) ? wpinv_clean($_POST['wpinv_first_name']) : null, |
|
329 | + 'last_name' => isset($_POST['wpinv_last_name']) ? wpinv_clean($_POST['wpinv_last_name']) : null, |
|
330 | + 'author' => isset($_POST['post_author_override']) ? wpinv_clean($_POST['post_author_override']) : null, |
|
331 | + 'date_created' => isset($_POST['date_created']) ? wpinv_clean($_POST['date_created']) : null, |
|
332 | + 'due_date' => isset($_POST['wpinv_due_date']) ? wpinv_clean($_POST['wpinv_due_date']) : null, |
|
333 | + 'number' => isset($_POST['wpinv_number']) ? wpinv_clean($_POST['wpinv_number']) : null, |
|
334 | + 'status' => isset($_POST['wpinv_status']) ? wpinv_clean($_POST['wpinv_status']) : null, |
|
335 | 335 | ) |
336 | 336 | ); |
337 | 337 | |
@@ -339,17 +339,17 @@ discard block |
||
339 | 339 | $invoice->recalculate_total(); |
340 | 340 | |
341 | 341 | // If we're creating a new user... |
342 | - if ( ! empty( $_POST['wpinv_new_user'] ) && is_email( $_POST['wpinv_email'] ) ) { |
|
342 | + if (!empty($_POST['wpinv_new_user']) && is_email($_POST['wpinv_email'])) { |
|
343 | 343 | |
344 | 344 | // Attempt to create the user. |
345 | - $user = wpinv_create_user( sanitize_email( $_POST['wpinv_email'] ) ); |
|
345 | + $user = wpinv_create_user(sanitize_email($_POST['wpinv_email'])); |
|
346 | 346 | |
347 | 347 | |
348 | 348 | // If successful, update the invoice author. |
349 | - if ( is_numeric( $user ) ) { |
|
350 | - $invoice->set_author( $user ); |
|
349 | + if (is_numeric($user)) { |
|
350 | + $invoice->set_author($user); |
|
351 | 351 | } else { |
352 | - wpinv_error_log( $user->get_error_message(), __( 'Invoice add new user', 'invoicing' ), __FILE__, __LINE__ ); |
|
352 | + wpinv_error_log($user->get_error_message(), __('Invoice add new user', 'invoicing'), __FILE__, __LINE__); |
|
353 | 353 | } |
354 | 354 | } |
355 | 355 | |
@@ -357,11 +357,11 @@ discard block |
||
357 | 357 | $invoice->save(); |
358 | 358 | |
359 | 359 | // (Maybe) send new user notification. |
360 | - if ( ! empty( $user ) && is_numeric( $user ) && apply_filters( 'getpaid_send_new_user_notification', true ) ) { |
|
361 | - wp_send_new_user_notifications( $user, 'user' ); |
|
360 | + if (!empty($user) && is_numeric($user) && apply_filters('getpaid_send_new_user_notification', true)) { |
|
361 | + wp_send_new_user_notifications($user, 'user'); |
|
362 | 362 | } |
363 | 363 | |
364 | 364 | // Fires after an invoice is saved. |
365 | - do_action( 'wpinv_invoice_metabox_saved', $invoice ); |
|
365 | + do_action('wpinv_invoice_metabox_saved', $invoice); |
|
366 | 366 | } |
367 | 367 | } |