@@ -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 | /** |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | */ |
| 37 | 37 | function wpinv_sanitize_country( $country ) { |
| 38 | 38 | |
| 39 | - // Enure the country is specified |
|
| 39 | + // Enure the country is specified |
|
| 40 | 40 | if ( empty( $country ) ) { |
| 41 | 41 | $country = wpinv_get_default_country(); |
| 42 | 42 | } |
@@ -66,9 +66,9 @@ discard block |
||
| 66 | 66 | } |
| 67 | 67 | |
| 68 | 68 | function wpinv_get_default_state() { |
| 69 | - $state = wpinv_get_option( 'default_state', '' ); |
|
| 69 | + $state = wpinv_get_option( 'default_state', '' ); |
|
| 70 | 70 | |
| 71 | - return apply_filters( 'wpinv_default_state', $state ); |
|
| 71 | + return apply_filters( 'wpinv_default_state', $state ); |
|
| 72 | 72 | } |
| 73 | 73 | |
| 74 | 74 | function wpinv_state_name( $state_code = '', $country_code = '' ) { |
@@ -305,11 +305,11 @@ discard block |
||
| 305 | 305 | |
| 306 | 306 | $country = wpinv_sanitize_country( $country ); |
| 307 | 307 | |
| 308 | - foreach ( wpinv_get_continents( 'countries' ) as $continent_code => $countries ) { |
|
| 309 | - if ( false !== array_search( $country, $countries, true ) ) { |
|
| 310 | - return $continent_code; |
|
| 311 | - } |
|
| 312 | - } |
|
| 308 | + foreach ( wpinv_get_continents( 'countries' ) as $continent_code => $countries ) { |
|
| 309 | + if ( false !== array_search( $country, $countries, true ) ) { |
|
| 310 | + return $continent_code; |
|
| 311 | + } |
|
| 312 | + } |
|
| 313 | 313 | |
| 314 | 314 | return ''; |
| 315 | 315 | |
@@ -601,33 +601,33 @@ discard block |
||
| 601 | 601 | } |
| 602 | 602 | |
| 603 | 603 | function wpinv_get_states_field() { |
| 604 | - if( empty( $_POST['country'] ) ) { |
|
| 605 | - $_POST['country'] = wpinv_get_default_country(); |
|
| 606 | - } |
|
| 607 | - $states = wpinv_get_country_states( sanitize_text_field( $_POST['country'] ) ); |
|
| 604 | + if( empty( $_POST['country'] ) ) { |
|
| 605 | + $_POST['country'] = wpinv_get_default_country(); |
|
| 606 | + } |
|
| 607 | + $states = wpinv_get_country_states( sanitize_text_field( $_POST['country'] ) ); |
|
| 608 | 608 | |
| 609 | - if( !empty( $states ) ) { |
|
| 610 | - $sanitized_field_name = sanitize_text_field( $_POST['field_name'] ); |
|
| 609 | + if( !empty( $states ) ) { |
|
| 610 | + $sanitized_field_name = sanitize_text_field( $_POST['field_name'] ); |
|
| 611 | 611 | |
| 612 | 612 | $class = isset( $_POST['class'] ) ? esc_attr( $_POST['class'] ) : ''; |
| 613 | 613 | $class .= " $sanitized_field_name getpaid_js_field-state custom-select wpinv-select wpi_select2"; |
| 614 | 614 | |
| 615 | 615 | $args = array( |
| 616 | - 'name' => $sanitized_field_name, |
|
| 617 | - 'id' => $sanitized_field_name, |
|
| 618 | - 'class' => implode( ' ', array_unique( explode( ' ', $class ) ) ), |
|
| 619 | - 'options' => array_merge( array( '' => '' ), $states ), |
|
| 620 | - 'show_option_all' => false, |
|
| 621 | - 'show_option_none' => false |
|
| 622 | - ); |
|
| 623 | - |
|
| 624 | - $response = wpinv_html_select( $args ); |
|
| 625 | - |
|
| 626 | - } else { |
|
| 627 | - $response = 'nostates'; |
|
| 628 | - } |
|
| 616 | + 'name' => $sanitized_field_name, |
|
| 617 | + 'id' => $sanitized_field_name, |
|
| 618 | + 'class' => implode( ' ', array_unique( explode( ' ', $class ) ) ), |
|
| 619 | + 'options' => array_merge( array( '' => '' ), $states ), |
|
| 620 | + 'show_option_all' => false, |
|
| 621 | + 'show_option_none' => false |
|
| 622 | + ); |
|
| 623 | + |
|
| 624 | + $response = wpinv_html_select( $args ); |
|
| 625 | + |
|
| 626 | + } else { |
|
| 627 | + $response = 'nostates'; |
|
| 628 | + } |
|
| 629 | 629 | |
| 630 | - return $response; |
|
| 630 | + return $response; |
|
| 631 | 631 | } |
| 632 | 632 | |
| 633 | 633 | function wpinv_default_billing_country( $country = '', $user_id = 0 ) { |
@@ -645,46 +645,46 @@ discard block |
||
| 645 | 645 | */ |
| 646 | 646 | function wpinv_get_address_formats() { |
| 647 | 647 | |
| 648 | - return apply_filters( 'wpinv_localisation_address_formats', |
|
| 649 | - array( |
|
| 650 | - 'default' => "{{name}}\n{{company}}\n{{address}}\n{{city}}\n{{state}}\n{{zip}}\n{{country}}", |
|
| 651 | - 'AU' => "{{name}}\n{{company}}\n{{address}}\n{{city}}\n{{state}} {{zip}}\n{{country}}", |
|
| 652 | - 'AT' => "{{company}}\n{{name}}\n{{address}}\n{{zip}} {{city}}\n{{country}}", |
|
| 653 | - 'BE' => "{{company}}\n{{name}}\n{{address}}\n{{zip}} {{city}}\n{{country}}", |
|
| 654 | - 'CA' => "{{company}}\n{{name}}\n{{address}}\n{{city}} {{state_code}} {{zip}}\n{{country}}", |
|
| 655 | - 'CH' => "{{company}}\n{{name}}\n{{address}}\n{{zip}} {{city}}\n{{country}}", |
|
| 656 | - 'CL' => "{{company}}\n{{name}}\n{{address}}\n{{state}}\n{{zip}} {{city}}\n{{country}}", |
|
| 657 | - 'CN' => "{{country}} {{zip}}\n{{state}}, {{city}}, {{address}}\n{{company}}\n{{name}}", |
|
| 658 | - 'CZ' => "{{company}}\n{{name}}\n{{address}}\n{{zip}} {{city}}\n{{country}}", |
|
| 659 | - 'DE' => "{{company}}\n{{name}}\n{{address}}\n{{zip}} {{city}}\n{{country}}", |
|
| 660 | - 'EE' => "{{company}}\n{{name}}\n{{address}}\n{{zip}} {{city}}\n{{country}}", |
|
| 661 | - 'FI' => "{{company}}\n{{name}}\n{{address}}\n{{zip}} {{city}}\n{{country}}", |
|
| 662 | - 'DK' => "{{company}}\n{{name}}\n{{address}}\n{{zip}} {{city}}\n{{country}}", |
|
| 663 | - 'FR' => "{{company}}\n{{name}}\n{{address}}\n{{zip}} {{city_upper}}\n{{country}}", |
|
| 664 | - 'HK' => "{{company}}\n{{first_name}} {{last_name_upper}}\n{{address}}\n{{city_upper}}\n{{state_upper}}\n{{country}}", |
|
| 665 | - 'HU' => "{{name}}\n{{company}}\n{{city}}\n{{address}}\n{{zip}}\n{{country}}", |
|
| 666 | - 'IN' => "{{company}}\n{{name}}\n{{address}}\n{{city}} {{zip}}\n{{state}}, {{country}}", |
|
| 667 | - 'IS' => "{{company}}\n{{name}}\n{{address}}\n{{zip}} {{city}}\n{{country}}", |
|
| 668 | - 'IT' => "{{company}}\n{{name}}\n{{address}}\n{{zip}}\n{{city}}\n{{state_upper}}\n{{country}}", |
|
| 669 | - 'JP' => "{{zip}}\n{{state}} {{city}} {{address}}\n{{company}}\n{{last_name}} {{first_name}}\n{{country}}", |
|
| 670 | - 'TW' => "{{company}}\n{{last_name}} {{first_name}}\n{{address}}\n{{state}}, {{city}} {{zip}}\n{{country}}", |
|
| 671 | - 'LI' => "{{company}}\n{{name}}\n{{address}}\n{{zip}} {{city}}\n{{country}}", |
|
| 672 | - 'NL' => "{{company}}\n{{name}}\n{{address}}\n{{zip}} {{city}}\n{{country}}", |
|
| 673 | - 'NZ' => "{{name}}\n{{company}}\n{{address}}\n{{city}} {{zip}}\n{{country}}", |
|
| 674 | - 'NO' => "{{company}}\n{{name}}\n{{address}}\n{{zip}} {{city}}\n{{country}}", |
|
| 675 | - 'PL' => "{{company}}\n{{name}}\n{{address}}\n{{zip}} {{city}}\n{{country}}", |
|
| 676 | - 'PT' => "{{company}}\n{{name}}\n{{address}}\n{{zip}} {{city}}\n{{country}}", |
|
| 677 | - 'SK' => "{{company}}\n{{name}}\n{{address}}\n{{zip}} {{city}}\n{{country}}", |
|
| 678 | - 'RS' => "{{name}}\n{{company}}\n{{address}}\n{{zip}} {{city}}\n{{country}}", |
|
| 679 | - 'SI' => "{{company}}\n{{name}}\n{{address}}\n{{zip}} {{city}}\n{{country}}", |
|
| 680 | - 'ES' => "{{name}}\n{{company}}\n{{address}}\n{{zip}} {{city}}\n{{state}}\n{{country}}", |
|
| 681 | - 'SE' => "{{company}}\n{{name}}\n{{address}}\n{{zip}} {{city}}\n{{country}}", |
|
| 682 | - 'TR' => "{{name}}\n{{company}}\n{{address}}\n{{zip}} {{city}} {{state}}\n{{country}}", |
|
| 683 | - 'UG' => "{{name}}\n{{company}}\n{{address}}\n{{city}}\n{{state}}, {{country}}", |
|
| 684 | - 'US' => "{{name}}\n{{company}}\n{{address}}\n{{city}}, {{state_code}} {{zip}}\n{{country}}", |
|
| 685 | - 'VN' => "{{name}}\n{{company}}\n{{address}}\n{{city}}\n{{country}}", |
|
| 686 | - ) |
|
| 687 | - ); |
|
| 648 | + return apply_filters( 'wpinv_localisation_address_formats', |
|
| 649 | + array( |
|
| 650 | + 'default' => "{{name}}\n{{company}}\n{{address}}\n{{city}}\n{{state}}\n{{zip}}\n{{country}}", |
|
| 651 | + 'AU' => "{{name}}\n{{company}}\n{{address}}\n{{city}}\n{{state}} {{zip}}\n{{country}}", |
|
| 652 | + 'AT' => "{{company}}\n{{name}}\n{{address}}\n{{zip}} {{city}}\n{{country}}", |
|
| 653 | + 'BE' => "{{company}}\n{{name}}\n{{address}}\n{{zip}} {{city}}\n{{country}}", |
|
| 654 | + 'CA' => "{{company}}\n{{name}}\n{{address}}\n{{city}} {{state_code}} {{zip}}\n{{country}}", |
|
| 655 | + 'CH' => "{{company}}\n{{name}}\n{{address}}\n{{zip}} {{city}}\n{{country}}", |
|
| 656 | + 'CL' => "{{company}}\n{{name}}\n{{address}}\n{{state}}\n{{zip}} {{city}}\n{{country}}", |
|
| 657 | + 'CN' => "{{country}} {{zip}}\n{{state}}, {{city}}, {{address}}\n{{company}}\n{{name}}", |
|
| 658 | + 'CZ' => "{{company}}\n{{name}}\n{{address}}\n{{zip}} {{city}}\n{{country}}", |
|
| 659 | + 'DE' => "{{company}}\n{{name}}\n{{address}}\n{{zip}} {{city}}\n{{country}}", |
|
| 660 | + 'EE' => "{{company}}\n{{name}}\n{{address}}\n{{zip}} {{city}}\n{{country}}", |
|
| 661 | + 'FI' => "{{company}}\n{{name}}\n{{address}}\n{{zip}} {{city}}\n{{country}}", |
|
| 662 | + 'DK' => "{{company}}\n{{name}}\n{{address}}\n{{zip}} {{city}}\n{{country}}", |
|
| 663 | + 'FR' => "{{company}}\n{{name}}\n{{address}}\n{{zip}} {{city_upper}}\n{{country}}", |
|
| 664 | + 'HK' => "{{company}}\n{{first_name}} {{last_name_upper}}\n{{address}}\n{{city_upper}}\n{{state_upper}}\n{{country}}", |
|
| 665 | + 'HU' => "{{name}}\n{{company}}\n{{city}}\n{{address}}\n{{zip}}\n{{country}}", |
|
| 666 | + 'IN' => "{{company}}\n{{name}}\n{{address}}\n{{city}} {{zip}}\n{{state}}, {{country}}", |
|
| 667 | + 'IS' => "{{company}}\n{{name}}\n{{address}}\n{{zip}} {{city}}\n{{country}}", |
|
| 668 | + 'IT' => "{{company}}\n{{name}}\n{{address}}\n{{zip}}\n{{city}}\n{{state_upper}}\n{{country}}", |
|
| 669 | + 'JP' => "{{zip}}\n{{state}} {{city}} {{address}}\n{{company}}\n{{last_name}} {{first_name}}\n{{country}}", |
|
| 670 | + 'TW' => "{{company}}\n{{last_name}} {{first_name}}\n{{address}}\n{{state}}, {{city}} {{zip}}\n{{country}}", |
|
| 671 | + 'LI' => "{{company}}\n{{name}}\n{{address}}\n{{zip}} {{city}}\n{{country}}", |
|
| 672 | + 'NL' => "{{company}}\n{{name}}\n{{address}}\n{{zip}} {{city}}\n{{country}}", |
|
| 673 | + 'NZ' => "{{name}}\n{{company}}\n{{address}}\n{{city}} {{zip}}\n{{country}}", |
|
| 674 | + 'NO' => "{{company}}\n{{name}}\n{{address}}\n{{zip}} {{city}}\n{{country}}", |
|
| 675 | + 'PL' => "{{company}}\n{{name}}\n{{address}}\n{{zip}} {{city}}\n{{country}}", |
|
| 676 | + 'PT' => "{{company}}\n{{name}}\n{{address}}\n{{zip}} {{city}}\n{{country}}", |
|
| 677 | + 'SK' => "{{company}}\n{{name}}\n{{address}}\n{{zip}} {{city}}\n{{country}}", |
|
| 678 | + 'RS' => "{{name}}\n{{company}}\n{{address}}\n{{zip}} {{city}}\n{{country}}", |
|
| 679 | + 'SI' => "{{company}}\n{{name}}\n{{address}}\n{{zip}} {{city}}\n{{country}}", |
|
| 680 | + 'ES' => "{{name}}\n{{company}}\n{{address}}\n{{zip}} {{city}}\n{{state}}\n{{country}}", |
|
| 681 | + 'SE' => "{{company}}\n{{name}}\n{{address}}\n{{zip}} {{city}}\n{{country}}", |
|
| 682 | + 'TR' => "{{name}}\n{{company}}\n{{address}}\n{{zip}} {{city}} {{state}}\n{{country}}", |
|
| 683 | + 'UG' => "{{name}}\n{{company}}\n{{address}}\n{{city}}\n{{state}}, {{country}}", |
|
| 684 | + 'US' => "{{name}}\n{{company}}\n{{address}}\n{{city}}, {{state_code}} {{zip}}\n{{country}}", |
|
| 685 | + 'VN' => "{{name}}\n{{company}}\n{{address}}\n{{city}}\n{{country}}", |
|
| 686 | + ) |
|
| 687 | + ); |
|
| 688 | 688 | } |
| 689 | 689 | |
| 690 | 690 | /** |
@@ -701,21 +701,21 @@ discard block |
||
| 701 | 701 | } |
| 702 | 702 | |
| 703 | 703 | // Get all formats. |
| 704 | - $formats = wpinv_get_address_formats(); |
|
| 704 | + $formats = wpinv_get_address_formats(); |
|
| 705 | 705 | |
| 706 | - // Get format for the specified country. |
|
| 707 | - $format = ( $country && isset( $formats[ $country ] ) ) ? $formats[ $country ] : $formats['default']; |
|
| 706 | + // Get format for the specified country. |
|
| 707 | + $format = ( $country && isset( $formats[ $country ] ) ) ? $formats[ $country ] : $formats['default']; |
|
| 708 | 708 | |
| 709 | 709 | /** |
| 710 | - * Filters the address format to use on Invoices. |
|
| 710 | + * Filters the address format to use on Invoices. |
|
| 711 | 711 | * |
| 712 | 712 | * New lines will be replaced by a `br` element. Double new lines will be replaced by a paragraph. HTML tags are allowed. |
| 713 | - * |
|
| 714 | - * @since 1.0.13 |
|
| 715 | - * |
|
| 716 | - * @param string $format The address format to use. |
|
| 713 | + * |
|
| 714 | + * @since 1.0.13 |
|
| 715 | + * |
|
| 716 | + * @param string $format The address format to use. |
|
| 717 | 717 | * @param string $country The country who's address format is being retrieved. |
| 718 | - */ |
|
| 718 | + */ |
|
| 719 | 719 | return apply_filters( 'wpinv_get_full_address_format', $format, $country ); |
| 720 | 720 | } |
| 721 | 721 | |
@@ -736,8 +736,8 @@ discard block |
||
| 736 | 736 | 'country' => '', |
| 737 | 737 | 'zip' => '', |
| 738 | 738 | 'first_name' => '', |
| 739 | - 'last_name' => '', |
|
| 740 | - 'company' => '', |
|
| 739 | + 'last_name' => '', |
|
| 740 | + 'company' => '', |
|
| 741 | 741 | ); |
| 742 | 742 | |
| 743 | 743 | $args = map_deep( wp_parse_args( $billing_details, $default_args ), 'trim' ); |
@@ -758,14 +758,14 @@ discard block |
||
| 758 | 758 | $args['country_code']= $country; |
| 759 | 759 | |
| 760 | 760 | /** |
| 761 | - * Filters the address format replacements to use on Invoices. |
|
| 761 | + * Filters the address format replacements to use on Invoices. |
|
| 762 | 762 | * |
| 763 | - * |
|
| 764 | - * @since 1.0.13 |
|
| 765 | - * |
|
| 766 | - * @param array $replacements The address replacements to use. |
|
| 763 | + * |
|
| 764 | + * @since 1.0.13 |
|
| 765 | + * |
|
| 766 | + * @param array $replacements The address replacements to use. |
|
| 767 | 767 | * @param array $billing_details The billing details to use. |
| 768 | - */ |
|
| 768 | + */ |
|
| 769 | 769 | $replacements = apply_filters( 'wpinv_get_invoice_address_replacements', $args, $billing_details ); |
| 770 | 770 | |
| 771 | 771 | $return = array(); |
@@ -788,5 +788,5 @@ discard block |
||
| 788 | 788 | * @return string |
| 789 | 789 | */ |
| 790 | 790 | function wpinv_trim_formatted_address_line( $line ) { |
| 791 | - return trim( $line, ', ' ); |
|
| 791 | + return trim( $line, ', ' ); |
|
| 792 | 792 | } |
| 793 | 793 | \ 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 | /** |
@@ -23,8 +23,8 @@ discard block |
||
| 23 | 23 | * |
| 24 | 24 | * @return string |
| 25 | 25 | */ |
| 26 | -function getpaid_get_ip_country( $ip_address = '' ) { |
|
| 27 | - $country = GetPaid_Geolocation::geolocate_ip( $ip_address, true ); |
|
| 26 | +function getpaid_get_ip_country($ip_address = '') { |
|
| 27 | + $country = GetPaid_Geolocation::geolocate_ip($ip_address, true); |
|
| 28 | 28 | return $country['country']; |
| 29 | 29 | } |
| 30 | 30 | |
@@ -34,59 +34,59 @@ discard block |
||
| 34 | 34 | * @param string $country The country code to sanitize |
| 35 | 35 | * @return array |
| 36 | 36 | */ |
| 37 | -function wpinv_sanitize_country( $country ) { |
|
| 37 | +function wpinv_sanitize_country($country) { |
|
| 38 | 38 | |
| 39 | 39 | // Enure the country is specified |
| 40 | - if ( empty( $country ) ) { |
|
| 40 | + if (empty($country)) { |
|
| 41 | 41 | $country = wpinv_get_default_country(); |
| 42 | 42 | } |
| 43 | - return trim( wpinv_utf8_strtoupper( $country ) ); |
|
| 43 | + return trim(wpinv_utf8_strtoupper($country)); |
|
| 44 | 44 | |
| 45 | 45 | } |
| 46 | 46 | |
| 47 | -function wpinv_is_base_country( $country ) { |
|
| 47 | +function wpinv_is_base_country($country) { |
|
| 48 | 48 | $base_country = wpinv_get_default_country(); |
| 49 | 49 | |
| 50 | - if ( $base_country === 'UK' ) { |
|
| 50 | + if ($base_country === 'UK') { |
|
| 51 | 51 | $base_country = 'GB'; |
| 52 | 52 | } |
| 53 | - if ( $country == 'UK' ) { |
|
| 53 | + if ($country == 'UK') { |
|
| 54 | 54 | $country = 'GB'; |
| 55 | 55 | } |
| 56 | 56 | |
| 57 | - return ( $country && $country === $base_country ) ? true : false; |
|
| 57 | + return ($country && $country === $base_country) ? true : false; |
|
| 58 | 58 | } |
| 59 | 59 | |
| 60 | -function wpinv_country_name( $country_code = '' ) { |
|
| 60 | +function wpinv_country_name($country_code = '') { |
|
| 61 | 61 | $countries = wpinv_get_country_list(); |
| 62 | 62 | $country_code = $country_code == 'UK' ? 'GB' : $country_code; |
| 63 | - $country = isset( $countries[$country_code] ) ? $countries[$country_code] : $country_code; |
|
| 63 | + $country = isset($countries[$country_code]) ? $countries[$country_code] : $country_code; |
|
| 64 | 64 | |
| 65 | - return apply_filters( 'wpinv_country_name', $country, $country_code ); |
|
| 65 | + return apply_filters('wpinv_country_name', $country, $country_code); |
|
| 66 | 66 | } |
| 67 | 67 | |
| 68 | 68 | function wpinv_get_default_state() { |
| 69 | - $state = wpinv_get_option( 'default_state', '' ); |
|
| 69 | + $state = wpinv_get_option('default_state', ''); |
|
| 70 | 70 | |
| 71 | - return apply_filters( 'wpinv_default_state', $state ); |
|
| 71 | + return apply_filters('wpinv_default_state', $state); |
|
| 72 | 72 | } |
| 73 | 73 | |
| 74 | -function wpinv_state_name( $state_code = '', $country_code = '' ) { |
|
| 74 | +function wpinv_state_name($state_code = '', $country_code = '') { |
|
| 75 | 75 | $state = $state_code; |
| 76 | 76 | |
| 77 | - if ( !empty( $country_code ) ) { |
|
| 78 | - $states = wpinv_get_country_states( $country_code ); |
|
| 77 | + if (!empty($country_code)) { |
|
| 78 | + $states = wpinv_get_country_states($country_code); |
|
| 79 | 79 | |
| 80 | - $state = !empty( $states ) && isset( $states[$state_code] ) ? $states[$state_code] : $state; |
|
| 80 | + $state = !empty($states) && isset($states[$state_code]) ? $states[$state_code] : $state; |
|
| 81 | 81 | } |
| 82 | 82 | |
| 83 | - return apply_filters( 'wpinv_state_name', $state, $state_code, $country_code ); |
|
| 83 | + return apply_filters('wpinv_state_name', $state, $state_code, $country_code); |
|
| 84 | 84 | } |
| 85 | 85 | |
| 86 | 86 | function wpinv_store_address() { |
| 87 | - $address = wpinv_get_option( 'store_address', '' ); |
|
| 87 | + $address = wpinv_get_option('store_address', ''); |
|
| 88 | 88 | |
| 89 | - return apply_filters( 'wpinv_store_address', $address ); |
|
| 89 | + return apply_filters('wpinv_store_address', $address); |
|
| 90 | 90 | } |
| 91 | 91 | |
| 92 | 92 | /** |
@@ -94,24 +94,24 @@ discard block |
||
| 94 | 94 | * |
| 95 | 95 | * @param WPInv_Invoice $invoice |
| 96 | 96 | */ |
| 97 | -function getpaid_maybe_add_default_address( &$invoice ) { |
|
| 97 | +function getpaid_maybe_add_default_address(&$invoice) { |
|
| 98 | 98 | |
| 99 | 99 | $user_id = $invoice->get_user_id(); |
| 100 | 100 | |
| 101 | 101 | // Abort if the invoice belongs to no one. |
| 102 | - if ( empty( $user_id ) ) { |
|
| 102 | + if (empty($user_id)) { |
|
| 103 | 103 | return; |
| 104 | 104 | } |
| 105 | 105 | |
| 106 | 106 | // Fill in defaults whenever necessary. |
| 107 | - foreach ( wpinv_get_user_address( $user_id ) as $key => $value ) { |
|
| 107 | + foreach (wpinv_get_user_address($user_id) as $key => $value) { |
|
| 108 | 108 | |
| 109 | - if ( is_callable( $invoice, "get_$key" ) ) { |
|
| 110 | - $current = call_user_func( array( $invoice, "get_$key" ) ); |
|
| 109 | + if (is_callable($invoice, "get_$key")) { |
|
| 110 | + $current = call_user_func(array($invoice, "get_$key")); |
|
| 111 | 111 | |
| 112 | - if ( empty( $current ) ) { |
|
| 112 | + if (empty($current)) { |
|
| 113 | 113 | $method = "set_$key"; |
| 114 | - $invoice->$method( $value ); |
|
| 114 | + $invoice->$method($value); |
|
| 115 | 115 | } |
| 116 | 116 | |
| 117 | 117 | } |
@@ -130,21 +130,21 @@ discard block |
||
| 130 | 130 | $address_fields = apply_filters( |
| 131 | 131 | 'getpaid_user_address_fields', |
| 132 | 132 | array( |
| 133 | - 'first_name' => __( 'First Name', 'invoicing' ), |
|
| 134 | - 'last_name' => __( 'Last Name', 'invoicing' ), |
|
| 135 | - 'address' => __( 'Address', 'invoicing' ), |
|
| 136 | - 'city' => __( 'City', 'invoicing' ), |
|
| 137 | - 'country' => __( 'Country', 'invoicing' ), |
|
| 138 | - 'state' => __( 'State', 'invoicing' ), |
|
| 139 | - 'zip' => __( 'Zip/Postal Code', 'invoicing' ), |
|
| 140 | - 'phone' => __( 'Phone Number', 'invoicing' ), |
|
| 141 | - 'company' => __( 'Company', 'invoicing' ), |
|
| 142 | - 'vat_number' => __( 'VAT Number', 'invoicing' ), |
|
| 133 | + 'first_name' => __('First Name', 'invoicing'), |
|
| 134 | + 'last_name' => __('Last Name', 'invoicing'), |
|
| 135 | + 'address' => __('Address', 'invoicing'), |
|
| 136 | + 'city' => __('City', 'invoicing'), |
|
| 137 | + 'country' => __('Country', 'invoicing'), |
|
| 138 | + 'state' => __('State', 'invoicing'), |
|
| 139 | + 'zip' => __('Zip/Postal Code', 'invoicing'), |
|
| 140 | + 'phone' => __('Phone Number', 'invoicing'), |
|
| 141 | + 'company' => __('Company', 'invoicing'), |
|
| 142 | + 'vat_number' => __('VAT Number', 'invoicing'), |
|
| 143 | 143 | ) |
| 144 | 144 | ); |
| 145 | 145 | |
| 146 | - if ( ! wpinv_use_taxes() && isset( $address_fields['vat_number'] ) ) { |
|
| 147 | - unset( $address_fields['vat_number'] ); |
|
| 146 | + if (!wpinv_use_taxes() && isset($address_fields['vat_number'])) { |
|
| 147 | + unset($address_fields['vat_number']); |
|
| 148 | 148 | } |
| 149 | 149 | |
| 150 | 150 | return $address_fields; |
@@ -155,8 +155,8 @@ discard block |
||
| 155 | 155 | * |
| 156 | 156 | * @return bool |
| 157 | 157 | */ |
| 158 | -function getpaid_is_address_field_whitelisted( $key ) { |
|
| 159 | - return array_key_exists( $key, getpaid_user_address_fields() ); |
|
| 158 | +function getpaid_is_address_field_whitelisted($key) { |
|
| 159 | + return array_key_exists($key, getpaid_user_address_fields()); |
|
| 160 | 160 | } |
| 161 | 161 | |
| 162 | 162 | /** |
@@ -166,24 +166,24 @@ discard block |
||
| 166 | 166 | * |
| 167 | 167 | * @param WPInv_Invoice $invoice |
| 168 | 168 | */ |
| 169 | -function getpaid_save_invoice_user_address( $invoice ) { |
|
| 169 | +function getpaid_save_invoice_user_address($invoice) { |
|
| 170 | 170 | |
| 171 | 171 | // Retrieve the invoice. |
| 172 | - $invoice = wpinv_get_invoice( $invoice ); |
|
| 172 | + $invoice = wpinv_get_invoice($invoice); |
|
| 173 | 173 | |
| 174 | 174 | // Abort if it does not exist. |
| 175 | - if ( empty( $invoice ) || $invoice->is_renewal() ) { |
|
| 175 | + if (empty($invoice) || $invoice->is_renewal()) { |
|
| 176 | 176 | return; |
| 177 | 177 | } |
| 178 | 178 | |
| 179 | - foreach ( array_keys( getpaid_user_address_fields() ) as $field ) { |
|
| 179 | + foreach (array_keys(getpaid_user_address_fields()) as $field) { |
|
| 180 | 180 | |
| 181 | - if ( is_callable( array( $invoice, "get_$field" ) ) ) { |
|
| 182 | - $value = call_user_func( array( $invoice, "get_$field" ) ); |
|
| 181 | + if (is_callable(array($invoice, "get_$field"))) { |
|
| 182 | + $value = call_user_func(array($invoice, "get_$field")); |
|
| 183 | 183 | |
| 184 | 184 | // Only save if it is not empty. |
| 185 | - if ( ! empty( $value ) ) { |
|
| 186 | - update_user_meta( $invoice->get_user_id(), '_wpinv_' . $field, $value ); |
|
| 185 | + if (!empty($value)) { |
|
| 186 | + update_user_meta($invoice->get_user_id(), '_wpinv_' . $field, $value); |
|
| 187 | 187 | } |
| 188 | 188 | |
| 189 | 189 | } |
@@ -191,7 +191,7 @@ discard block |
||
| 191 | 191 | } |
| 192 | 192 | |
| 193 | 193 | } |
| 194 | -add_action( 'getpaid_checkout_invoice_updated', 'getpaid_save_invoice_user_address' ); |
|
| 194 | +add_action('getpaid_checkout_invoice_updated', 'getpaid_save_invoice_user_address'); |
|
| 195 | 195 | |
| 196 | 196 | /** |
| 197 | 197 | * Retrieves a saved user address. |
@@ -200,14 +200,14 @@ discard block |
||
| 200 | 200 | * @param bool $with_default Whether or not we should use the default country and state. |
| 201 | 201 | * @return array |
| 202 | 202 | */ |
| 203 | -function wpinv_get_user_address( $user_id = 0, $with_default = true ) { |
|
| 203 | +function wpinv_get_user_address($user_id = 0, $with_default = true) { |
|
| 204 | 204 | |
| 205 | 205 | // Prepare the user id. |
| 206 | - $user_id = empty( $user_id ) ? get_current_user_id() : $user_id; |
|
| 207 | - $user_info = get_userdata( $user_id ); |
|
| 206 | + $user_id = empty($user_id) ? get_current_user_id() : $user_id; |
|
| 207 | + $user_info = get_userdata($user_id); |
|
| 208 | 208 | |
| 209 | 209 | // Abort if non exists. |
| 210 | - if ( empty( $user_info ) ) { |
|
| 210 | + if (empty($user_info)) { |
|
| 211 | 211 | return array(); |
| 212 | 212 | } |
| 213 | 213 | |
@@ -217,11 +217,11 @@ discard block |
||
| 217 | 217 | 'email' => $user_info->user_email, |
| 218 | 218 | ); |
| 219 | 219 | |
| 220 | - foreach ( array_keys( getpaid_user_address_fields() ) as $field ) { |
|
| 221 | - $address[$field] = getpaid_get_user_address_field( $user_id, $field ); |
|
| 220 | + foreach (array_keys(getpaid_user_address_fields()) as $field) { |
|
| 221 | + $address[$field] = getpaid_get_user_address_field($user_id, $field); |
|
| 222 | 222 | } |
| 223 | 223 | |
| 224 | - if ( ! $with_default ) { |
|
| 224 | + if (!$with_default) { |
|
| 225 | 225 | return $address; |
| 226 | 226 | } |
| 227 | 227 | |
@@ -232,7 +232,7 @@ discard block |
||
| 232 | 232 | 'country' => wpinv_get_default_country(), |
| 233 | 233 | ); |
| 234 | 234 | |
| 235 | - return getpaid_array_merge_if_empty( $address, $defaults ); |
|
| 235 | + return getpaid_array_merge_if_empty($address, $defaults); |
|
| 236 | 236 | |
| 237 | 237 | } |
| 238 | 238 | |
@@ -243,7 +243,7 @@ discard block |
||
| 243 | 243 | * @param string $field The field to use. |
| 244 | 244 | * @return string|null |
| 245 | 245 | */ |
| 246 | -function getpaid_get_user_address_field( $user_id, $field ) { |
|
| 246 | +function getpaid_get_user_address_field($user_id, $field) { |
|
| 247 | 247 | |
| 248 | 248 | $prefixes = array( |
| 249 | 249 | '_wpinv_', |
@@ -251,15 +251,15 @@ discard block |
||
| 251 | 251 | '' |
| 252 | 252 | ); |
| 253 | 253 | |
| 254 | - foreach ( $prefixes as $prefix ) { |
|
| 254 | + foreach ($prefixes as $prefix) { |
|
| 255 | 255 | |
| 256 | 256 | // Meta table. |
| 257 | - $value = get_user_meta( $user_id, $prefix . $field, true ); |
|
| 257 | + $value = get_user_meta($user_id, $prefix . $field, true); |
|
| 258 | 258 | |
| 259 | 259 | // UWP table. |
| 260 | - $value = ( empty( $value ) && function_exists( 'uwp_get_usermeta' ) ) ? uwp_get_usermeta( $user_id, $prefix . $field ) : $value; |
|
| 260 | + $value = (empty($value) && function_exists('uwp_get_usermeta')) ? uwp_get_usermeta($user_id, $prefix . $field) : $value; |
|
| 261 | 261 | |
| 262 | - if ( ! empty( $value ) ) { |
|
| 262 | + if (!empty($value)) { |
|
| 263 | 263 | return $value; |
| 264 | 264 | } |
| 265 | 265 | |
@@ -276,16 +276,16 @@ discard block |
||
| 276 | 276 | * @param string $return What to return. |
| 277 | 277 | * @return array |
| 278 | 278 | */ |
| 279 | -function wpinv_get_continents( $return = 'all' ) { |
|
| 279 | +function wpinv_get_continents($return = 'all') { |
|
| 280 | 280 | |
| 281 | - $continents = wpinv_get_data( 'continents' ); |
|
| 281 | + $continents = wpinv_get_data('continents'); |
|
| 282 | 282 | |
| 283 | - switch( $return ) { |
|
| 283 | + switch ($return) { |
|
| 284 | 284 | case 'name' : |
| 285 | - return wp_list_pluck( $continents, 'name' ); |
|
| 285 | + return wp_list_pluck($continents, 'name'); |
|
| 286 | 286 | break; |
| 287 | 287 | case 'countries' : |
| 288 | - return wp_list_pluck( $continents, 'countries' ); |
|
| 288 | + return wp_list_pluck($continents, 'countries'); |
|
| 289 | 289 | break; |
| 290 | 290 | default : |
| 291 | 291 | return $continents; |
@@ -301,12 +301,12 @@ discard block |
||
| 301 | 301 | * @param string $country Country code. If no code is specified, defaults to the default country. |
| 302 | 302 | * @return string |
| 303 | 303 | */ |
| 304 | -function wpinv_get_continent_code_for_country( $country = false ) { |
|
| 304 | +function wpinv_get_continent_code_for_country($country = false) { |
|
| 305 | 305 | |
| 306 | - $country = wpinv_sanitize_country( $country ); |
|
| 306 | + $country = wpinv_sanitize_country($country); |
|
| 307 | 307 | |
| 308 | - foreach ( wpinv_get_continents( 'countries' ) as $continent_code => $countries ) { |
|
| 309 | - if ( false !== array_search( $country, $countries, true ) ) { |
|
| 308 | + foreach (wpinv_get_continents('countries') as $continent_code => $countries) { |
|
| 309 | + if (false !== array_search($country, $countries, true)) { |
|
| 310 | 310 | return $continent_code; |
| 311 | 311 | } |
| 312 | 312 | } |
@@ -322,13 +322,13 @@ discard block |
||
| 322 | 322 | * @param string $country Country code. If no code is specified, defaults to the default country. |
| 323 | 323 | * @return array |
| 324 | 324 | */ |
| 325 | -function wpinv_get_country_calling_code( $country = null) { |
|
| 325 | +function wpinv_get_country_calling_code($country = null) { |
|
| 326 | 326 | |
| 327 | - $country = wpinv_sanitize_country( $country ); |
|
| 328 | - $codes = wpinv_get_data( 'phone-codes' ); |
|
| 329 | - $code = isset( $codes[ $country ] ) ? $codes[ $country ] : ''; |
|
| 327 | + $country = wpinv_sanitize_country($country); |
|
| 328 | + $codes = wpinv_get_data('phone-codes'); |
|
| 329 | + $code = isset($codes[$country]) ? $codes[$country] : ''; |
|
| 330 | 330 | |
| 331 | - if ( is_array( $code ) ) { |
|
| 331 | + if (is_array($code)) { |
|
| 332 | 332 | return $code[0]; |
| 333 | 333 | } |
| 334 | 334 | return $code; |
@@ -341,8 +341,8 @@ discard block |
||
| 341 | 341 | * @param bool $first_empty Whether or not the first item in the list should be empty |
| 342 | 342 | * @return array |
| 343 | 343 | */ |
| 344 | -function wpinv_get_country_list( $first_empty = false ) { |
|
| 345 | - return wpinv_maybe_add_empty_option( apply_filters( 'wpinv_countries', wpinv_get_data( 'countries' ) ), $first_empty ); |
|
| 344 | +function wpinv_get_country_list($first_empty = false) { |
|
| 345 | + return wpinv_maybe_add_empty_option(apply_filters('wpinv_countries', wpinv_get_data('countries')), $first_empty); |
|
| 346 | 346 | } |
| 347 | 347 | |
| 348 | 348 | /** |
@@ -352,22 +352,22 @@ discard block |
||
| 352 | 352 | * @param bool $first_empty Whether or not the first item in the list should be empty |
| 353 | 353 | * @return array |
| 354 | 354 | */ |
| 355 | -function wpinv_get_country_states( $country = null, $first_empty = false ) { |
|
| 355 | +function wpinv_get_country_states($country = null, $first_empty = false) { |
|
| 356 | 356 | |
| 357 | 357 | // Prepare the country. |
| 358 | - $country = wpinv_sanitize_country( $country ); |
|
| 358 | + $country = wpinv_sanitize_country($country); |
|
| 359 | 359 | |
| 360 | 360 | // Fetch all states. |
| 361 | - $all_states = wpinv_get_data( 'states' ); |
|
| 361 | + $all_states = wpinv_get_data('states'); |
|
| 362 | 362 | |
| 363 | 363 | // Fetch the specified country's states. |
| 364 | - $states = isset( $all_states[ $country ] ) ? $all_states[ $country ] : array() ; |
|
| 365 | - $states = apply_filters( "wpinv_{$country}_states", $states ); |
|
| 366 | - $states = apply_filters( 'wpinv_country_states', $states, $country ); |
|
| 364 | + $states = isset($all_states[$country]) ? $all_states[$country] : array(); |
|
| 365 | + $states = apply_filters("wpinv_{$country}_states", $states); |
|
| 366 | + $states = apply_filters('wpinv_country_states', $states, $country); |
|
| 367 | 367 | |
| 368 | - asort( $states ); |
|
| 368 | + asort($states); |
|
| 369 | 369 | |
| 370 | - return wpinv_maybe_add_empty_option( $states, $first_empty ); |
|
| 370 | + return wpinv_maybe_add_empty_option($states, $first_empty); |
|
| 371 | 371 | } |
| 372 | 372 | |
| 373 | 373 | /** |
@@ -377,7 +377,7 @@ discard block |
||
| 377 | 377 | * @return array |
| 378 | 378 | */ |
| 379 | 379 | function wpinv_get_us_states_list() { |
| 380 | - return apply_filters( 'wpinv_usa_states', wpinv_get_country_states( 'US' ) ); |
|
| 380 | + return apply_filters('wpinv_usa_states', wpinv_get_country_states('US')); |
|
| 381 | 381 | } |
| 382 | 382 | |
| 383 | 383 | /** |
@@ -387,7 +387,7 @@ discard block |
||
| 387 | 387 | * @return array |
| 388 | 388 | */ |
| 389 | 389 | function wpinv_get_canada_states_list() { |
| 390 | - return apply_filters( 'wpinv_canada_provinces', wpinv_get_country_states( 'CA' ) ); |
|
| 390 | + return apply_filters('wpinv_canada_provinces', wpinv_get_country_states('CA')); |
|
| 391 | 391 | } |
| 392 | 392 | |
| 393 | 393 | /** |
@@ -397,7 +397,7 @@ discard block |
||
| 397 | 397 | * @return array |
| 398 | 398 | */ |
| 399 | 399 | function wpinv_get_australia_states_list() { |
| 400 | - return apply_filters( 'wpinv_australia_states', wpinv_get_country_states( 'AU' ) ); |
|
| 400 | + return apply_filters('wpinv_australia_states', wpinv_get_country_states('AU')); |
|
| 401 | 401 | } |
| 402 | 402 | |
| 403 | 403 | /** |
@@ -407,7 +407,7 @@ discard block |
||
| 407 | 407 | * @return array |
| 408 | 408 | */ |
| 409 | 409 | function wpinv_get_bangladesh_states_list() { |
| 410 | - return apply_filters( 'wpinv_bangladesh_states', wpinv_get_country_states( 'BD' ) ); |
|
| 410 | + return apply_filters('wpinv_bangladesh_states', wpinv_get_country_states('BD')); |
|
| 411 | 411 | } |
| 412 | 412 | |
| 413 | 413 | /** |
@@ -417,7 +417,7 @@ discard block |
||
| 417 | 417 | * @return array |
| 418 | 418 | */ |
| 419 | 419 | function wpinv_get_brazil_states_list() { |
| 420 | - return apply_filters( 'wpinv_brazil_states', wpinv_get_country_states( 'BR' ) ); |
|
| 420 | + return apply_filters('wpinv_brazil_states', wpinv_get_country_states('BR')); |
|
| 421 | 421 | } |
| 422 | 422 | |
| 423 | 423 | /** |
@@ -427,7 +427,7 @@ discard block |
||
| 427 | 427 | * @return array |
| 428 | 428 | */ |
| 429 | 429 | function wpinv_get_bulgaria_states_list() { |
| 430 | - return apply_filters( 'wpinv_bulgaria_states', wpinv_get_country_states( 'BG' ) ); |
|
| 430 | + return apply_filters('wpinv_bulgaria_states', wpinv_get_country_states('BG')); |
|
| 431 | 431 | } |
| 432 | 432 | |
| 433 | 433 | /** |
@@ -437,7 +437,7 @@ discard block |
||
| 437 | 437 | * @return array |
| 438 | 438 | */ |
| 439 | 439 | function wpinv_get_hong_kong_states_list() { |
| 440 | - return apply_filters( 'wpinv_hong_kong_states', wpinv_get_country_states( 'HK' ) ); |
|
| 440 | + return apply_filters('wpinv_hong_kong_states', wpinv_get_country_states('HK')); |
|
| 441 | 441 | } |
| 442 | 442 | |
| 443 | 443 | /** |
@@ -447,7 +447,7 @@ discard block |
||
| 447 | 447 | * @return array |
| 448 | 448 | */ |
| 449 | 449 | function wpinv_get_hungary_states_list() { |
| 450 | - return apply_filters( 'wpinv_hungary_states', wpinv_get_country_states( 'HU' ) ); |
|
| 450 | + return apply_filters('wpinv_hungary_states', wpinv_get_country_states('HU')); |
|
| 451 | 451 | } |
| 452 | 452 | |
| 453 | 453 | /** |
@@ -457,7 +457,7 @@ discard block |
||
| 457 | 457 | * @return array |
| 458 | 458 | */ |
| 459 | 459 | function wpinv_get_japan_states_list() { |
| 460 | - return apply_filters( 'wpinv_japan_states', wpinv_get_country_states( 'JP' ) ); |
|
| 460 | + return apply_filters('wpinv_japan_states', wpinv_get_country_states('JP')); |
|
| 461 | 461 | } |
| 462 | 462 | |
| 463 | 463 | /** |
@@ -467,7 +467,7 @@ discard block |
||
| 467 | 467 | * @return array |
| 468 | 468 | */ |
| 469 | 469 | function wpinv_get_china_states_list() { |
| 470 | - return apply_filters( 'wpinv_china_states', wpinv_get_country_states( 'CN' ) ); |
|
| 470 | + return apply_filters('wpinv_china_states', wpinv_get_country_states('CN')); |
|
| 471 | 471 | } |
| 472 | 472 | |
| 473 | 473 | /** |
@@ -477,7 +477,7 @@ discard block |
||
| 477 | 477 | * @return array |
| 478 | 478 | */ |
| 479 | 479 | function wpinv_get_new_zealand_states_list() { |
| 480 | - return apply_filters( 'wpinv_new_zealand_states', wpinv_get_country_states( 'NZ' ) ); |
|
| 480 | + return apply_filters('wpinv_new_zealand_states', wpinv_get_country_states('NZ')); |
|
| 481 | 481 | } |
| 482 | 482 | |
| 483 | 483 | /** |
@@ -487,7 +487,7 @@ discard block |
||
| 487 | 487 | * @return array |
| 488 | 488 | */ |
| 489 | 489 | function wpinv_get_peru_states_list() { |
| 490 | - return apply_filters( 'wpinv_peru_states', wpinv_get_country_states( 'PE' ) ); |
|
| 490 | + return apply_filters('wpinv_peru_states', wpinv_get_country_states('PE')); |
|
| 491 | 491 | } |
| 492 | 492 | |
| 493 | 493 | /** |
@@ -497,7 +497,7 @@ discard block |
||
| 497 | 497 | * @return array |
| 498 | 498 | */ |
| 499 | 499 | function wpinv_get_indonesia_states_list() { |
| 500 | - return apply_filters( 'wpinv_indonesia_states', wpinv_get_country_states( 'ID' ) ); |
|
| 500 | + return apply_filters('wpinv_indonesia_states', wpinv_get_country_states('ID')); |
|
| 501 | 501 | } |
| 502 | 502 | |
| 503 | 503 | /** |
@@ -507,7 +507,7 @@ discard block |
||
| 507 | 507 | * @return array |
| 508 | 508 | */ |
| 509 | 509 | function wpinv_get_india_states_list() { |
| 510 | - return apply_filters( 'wpinv_india_states', wpinv_get_country_states( 'IN' ) ); |
|
| 510 | + return apply_filters('wpinv_india_states', wpinv_get_country_states('IN')); |
|
| 511 | 511 | } |
| 512 | 512 | |
| 513 | 513 | /** |
@@ -517,7 +517,7 @@ discard block |
||
| 517 | 517 | * @return array |
| 518 | 518 | */ |
| 519 | 519 | function wpinv_get_iran_states_list() { |
| 520 | - return apply_filters( 'wpinv_iran_states', wpinv_get_country_states( 'IR' ) ); |
|
| 520 | + return apply_filters('wpinv_iran_states', wpinv_get_country_states('IR')); |
|
| 521 | 521 | } |
| 522 | 522 | |
| 523 | 523 | /** |
@@ -527,7 +527,7 @@ discard block |
||
| 527 | 527 | * @return array |
| 528 | 528 | */ |
| 529 | 529 | function wpinv_get_italy_states_list() { |
| 530 | - return apply_filters( 'wpinv_italy_states', wpinv_get_country_states( 'IT' ) ); |
|
| 530 | + return apply_filters('wpinv_italy_states', wpinv_get_country_states('IT')); |
|
| 531 | 531 | } |
| 532 | 532 | |
| 533 | 533 | /** |
@@ -537,7 +537,7 @@ discard block |
||
| 537 | 537 | * @return array |
| 538 | 538 | */ |
| 539 | 539 | function wpinv_get_malaysia_states_list() { |
| 540 | - return apply_filters( 'wpinv_malaysia_states', wpinv_get_country_states( 'MY' ) ); |
|
| 540 | + return apply_filters('wpinv_malaysia_states', wpinv_get_country_states('MY')); |
|
| 541 | 541 | } |
| 542 | 542 | |
| 543 | 543 | /** |
@@ -547,7 +547,7 @@ discard block |
||
| 547 | 547 | * @return array |
| 548 | 548 | */ |
| 549 | 549 | function wpinv_get_mexico_states_list() { |
| 550 | - return apply_filters( 'wpinv_mexico_states', wpinv_get_country_states( 'MX' ) ); |
|
| 550 | + return apply_filters('wpinv_mexico_states', wpinv_get_country_states('MX')); |
|
| 551 | 551 | } |
| 552 | 552 | |
| 553 | 553 | /** |
@@ -557,7 +557,7 @@ discard block |
||
| 557 | 557 | * @return array |
| 558 | 558 | */ |
| 559 | 559 | function wpinv_get_nepal_states_list() { |
| 560 | - return apply_filters( 'wpinv_nepal_states', wpinv_get_country_states( 'NP' ) ); |
|
| 560 | + return apply_filters('wpinv_nepal_states', wpinv_get_country_states('NP')); |
|
| 561 | 561 | } |
| 562 | 562 | |
| 563 | 563 | /** |
@@ -567,7 +567,7 @@ discard block |
||
| 567 | 567 | * @return array |
| 568 | 568 | */ |
| 569 | 569 | function wpinv_get_south_africa_states_list() { |
| 570 | - return apply_filters( 'wpinv_south_africa_states', wpinv_get_country_states( 'ZA' ) ); |
|
| 570 | + return apply_filters('wpinv_south_africa_states', wpinv_get_country_states('ZA')); |
|
| 571 | 571 | } |
| 572 | 572 | |
| 573 | 573 | /** |
@@ -577,7 +577,7 @@ discard block |
||
| 577 | 577 | * @return array |
| 578 | 578 | */ |
| 579 | 579 | function wpinv_get_thailand_states_list() { |
| 580 | - return apply_filters( 'wpinv_thailand_states', wpinv_get_country_states( 'TH' ) ); |
|
| 580 | + return apply_filters('wpinv_thailand_states', wpinv_get_country_states('TH')); |
|
| 581 | 581 | } |
| 582 | 582 | |
| 583 | 583 | /** |
@@ -587,7 +587,7 @@ discard block |
||
| 587 | 587 | * @return array |
| 588 | 588 | */ |
| 589 | 589 | function wpinv_get_turkey_states_list() { |
| 590 | - return apply_filters( 'wpinv_turkey_states', wpinv_get_country_states( 'TR' ) ); |
|
| 590 | + return apply_filters('wpinv_turkey_states', wpinv_get_country_states('TR')); |
|
| 591 | 591 | } |
| 592 | 592 | |
| 593 | 593 | /** |
@@ -597,31 +597,31 @@ discard block |
||
| 597 | 597 | * @return array |
| 598 | 598 | */ |
| 599 | 599 | function wpinv_get_spain_states_list() { |
| 600 | - return apply_filters( 'wpinv_spain_states', wpinv_get_country_states( 'ES' ) ); |
|
| 600 | + return apply_filters('wpinv_spain_states', wpinv_get_country_states('ES')); |
|
| 601 | 601 | } |
| 602 | 602 | |
| 603 | 603 | function wpinv_get_states_field() { |
| 604 | - if( empty( $_POST['country'] ) ) { |
|
| 604 | + if (empty($_POST['country'])) { |
|
| 605 | 605 | $_POST['country'] = wpinv_get_default_country(); |
| 606 | 606 | } |
| 607 | - $states = wpinv_get_country_states( sanitize_text_field( $_POST['country'] ) ); |
|
| 607 | + $states = wpinv_get_country_states(sanitize_text_field($_POST['country'])); |
|
| 608 | 608 | |
| 609 | - if( !empty( $states ) ) { |
|
| 610 | - $sanitized_field_name = sanitize_text_field( $_POST['field_name'] ); |
|
| 609 | + if (!empty($states)) { |
|
| 610 | + $sanitized_field_name = sanitize_text_field($_POST['field_name']); |
|
| 611 | 611 | |
| 612 | - $class = isset( $_POST['class'] ) ? esc_attr( $_POST['class'] ) : ''; |
|
| 612 | + $class = isset($_POST['class']) ? esc_attr($_POST['class']) : ''; |
|
| 613 | 613 | $class .= " $sanitized_field_name getpaid_js_field-state custom-select wpinv-select wpi_select2"; |
| 614 | 614 | |
| 615 | - $args = array( |
|
| 615 | + $args = array( |
|
| 616 | 616 | 'name' => $sanitized_field_name, |
| 617 | 617 | 'id' => $sanitized_field_name, |
| 618 | - 'class' => implode( ' ', array_unique( explode( ' ', $class ) ) ), |
|
| 619 | - 'options' => array_merge( array( '' => '' ), $states ), |
|
| 618 | + 'class' => implode(' ', array_unique(explode(' ', $class))), |
|
| 619 | + 'options' => array_merge(array('' => ''), $states), |
|
| 620 | 620 | 'show_option_all' => false, |
| 621 | 621 | 'show_option_none' => false |
| 622 | 622 | ); |
| 623 | 623 | |
| 624 | - $response = wpinv_html_select( $args ); |
|
| 624 | + $response = wpinv_html_select($args); |
|
| 625 | 625 | |
| 626 | 626 | } else { |
| 627 | 627 | $response = 'nostates'; |
@@ -630,10 +630,10 @@ discard block |
||
| 630 | 630 | return $response; |
| 631 | 631 | } |
| 632 | 632 | |
| 633 | -function wpinv_default_billing_country( $country = '', $user_id = 0 ) { |
|
| 634 | - $country = !empty( $country ) ? $country : wpinv_get_default_country(); |
|
| 633 | +function wpinv_default_billing_country($country = '', $user_id = 0) { |
|
| 634 | + $country = !empty($country) ? $country : wpinv_get_default_country(); |
|
| 635 | 635 | |
| 636 | - return apply_filters( 'wpinv_default_billing_country', $country, $user_id ); |
|
| 636 | + return apply_filters('wpinv_default_billing_country', $country, $user_id); |
|
| 637 | 637 | } |
| 638 | 638 | |
| 639 | 639 | /** |
@@ -645,7 +645,7 @@ discard block |
||
| 645 | 645 | */ |
| 646 | 646 | function wpinv_get_address_formats() { |
| 647 | 647 | |
| 648 | - return apply_filters( 'wpinv_localisation_address_formats', |
|
| 648 | + return apply_filters('wpinv_localisation_address_formats', |
|
| 649 | 649 | array( |
| 650 | 650 | 'default' => "{{name}}\n{{company}}\n{{address}}\n{{city}}\n{{state}}\n{{zip}}\n{{country}}", |
| 651 | 651 | 'AU' => "{{name}}\n{{company}}\n{{address}}\n{{city}}\n{{state}} {{zip}}\n{{country}}", |
@@ -694,9 +694,9 @@ discard block |
||
| 694 | 694 | * @see `wpinv_get_invoice_address_replacements` |
| 695 | 695 | * @return string |
| 696 | 696 | */ |
| 697 | -function wpinv_get_full_address_format( $country = false) { |
|
| 697 | +function wpinv_get_full_address_format($country = false) { |
|
| 698 | 698 | |
| 699 | - if( empty( $country ) ) { |
|
| 699 | + if (empty($country)) { |
|
| 700 | 700 | $country = wpinv_get_default_country(); |
| 701 | 701 | } |
| 702 | 702 | |
@@ -704,7 +704,7 @@ discard block |
||
| 704 | 704 | $formats = wpinv_get_address_formats(); |
| 705 | 705 | |
| 706 | 706 | // Get format for the specified country. |
| 707 | - $format = ( $country && isset( $formats[ $country ] ) ) ? $formats[ $country ] : $formats['default']; |
|
| 707 | + $format = ($country && isset($formats[$country])) ? $formats[$country] : $formats['default']; |
|
| 708 | 708 | |
| 709 | 709 | /** |
| 710 | 710 | * Filters the address format to use on Invoices. |
@@ -716,7 +716,7 @@ discard block |
||
| 716 | 716 | * @param string $format The address format to use. |
| 717 | 717 | * @param string $country The country who's address format is being retrieved. |
| 718 | 718 | */ |
| 719 | - return apply_filters( 'wpinv_get_full_address_format', $format, $country ); |
|
| 719 | + return apply_filters('wpinv_get_full_address_format', $format, $country); |
|
| 720 | 720 | } |
| 721 | 721 | |
| 722 | 722 | /** |
@@ -727,7 +727,7 @@ discard block |
||
| 727 | 727 | * @param array $billing_details customer's billing details |
| 728 | 728 | * @return array |
| 729 | 729 | */ |
| 730 | -function wpinv_get_invoice_address_replacements( $billing_details ) { |
|
| 730 | +function wpinv_get_invoice_address_replacements($billing_details) { |
|
| 731 | 731 | |
| 732 | 732 | $default_args = array( |
| 733 | 733 | 'address' => '', |
@@ -740,22 +740,22 @@ discard block |
||
| 740 | 740 | 'company' => '', |
| 741 | 741 | ); |
| 742 | 742 | |
| 743 | - $args = map_deep( wp_parse_args( $billing_details, $default_args ), 'trim' ); |
|
| 743 | + $args = map_deep(wp_parse_args($billing_details, $default_args), 'trim'); |
|
| 744 | 744 | $state = $args['state']; |
| 745 | 745 | $country = $args['country']; |
| 746 | 746 | |
| 747 | 747 | // Handle full country name. |
| 748 | - $full_country = empty( $country ) ? $country : wpinv_country_name( $country ); |
|
| 748 | + $full_country = empty($country) ? $country : wpinv_country_name($country); |
|
| 749 | 749 | |
| 750 | 750 | // Handle full state name. |
| 751 | - $full_state = ( $country && $state ) ? wpinv_state_name( $state, $country ) : $state; |
|
| 751 | + $full_state = ($country && $state) ? wpinv_state_name($state, $country) : $state; |
|
| 752 | 752 | |
| 753 | 753 | $args['postcode'] = $args['zip']; |
| 754 | 754 | $args['name'] = $args['first_name'] . ' ' . $args['last_name']; |
| 755 | 755 | $args['state'] = $full_state; |
| 756 | 756 | $args['state_code'] = $state; |
| 757 | 757 | $args['country'] = $full_country; |
| 758 | - $args['country_code']= $country; |
|
| 758 | + $args['country_code'] = $country; |
|
| 759 | 759 | |
| 760 | 760 | /** |
| 761 | 761 | * Filters the address format replacements to use on Invoices. |
@@ -766,14 +766,14 @@ discard block |
||
| 766 | 766 | * @param array $replacements The address replacements to use. |
| 767 | 767 | * @param array $billing_details The billing details to use. |
| 768 | 768 | */ |
| 769 | - $replacements = apply_filters( 'wpinv_get_invoice_address_replacements', $args, $billing_details ); |
|
| 769 | + $replacements = apply_filters('wpinv_get_invoice_address_replacements', $args, $billing_details); |
|
| 770 | 770 | |
| 771 | 771 | $return = array(); |
| 772 | 772 | |
| 773 | - foreach( $replacements as $key => $value ) { |
|
| 774 | - $value = is_scalar( $value ) ? trim( sanitize_text_field( $value ) ) : ''; |
|
| 773 | + foreach ($replacements as $key => $value) { |
|
| 774 | + $value = is_scalar($value) ? trim(sanitize_text_field($value)) : ''; |
|
| 775 | 775 | $return['{{' . $key . '}}'] = $value; |
| 776 | - $return['{{' . $key . '_upper}}'] = wpinv_utf8_strtoupper( $value ); |
|
| 776 | + $return['{{' . $key . '_upper}}'] = wpinv_utf8_strtoupper($value); |
|
| 777 | 777 | } |
| 778 | 778 | |
| 779 | 779 | return $return; |
@@ -787,6 +787,6 @@ discard block |
||
| 787 | 787 | * @since 1.0.14 |
| 788 | 788 | * @return string |
| 789 | 789 | */ |
| 790 | -function wpinv_trim_formatted_address_line( $line ) { |
|
| 791 | - return trim( $line, ', ' ); |
|
| 790 | +function wpinv_trim_formatted_address_line($line) { |
|
| 791 | + return trim($line, ', '); |
|
| 792 | 792 | } |
| 793 | 793 | \ No newline at end of file |
@@ -11,7 +11,7 @@ discard block |
||
| 11 | 11 | * @info GetPaid Setup Wizard. |
| 12 | 12 | */ |
| 13 | 13 | if ( ! defined( 'ABSPATH' ) ) { |
| 14 | - exit; |
|
| 14 | + exit; |
|
| 15 | 15 | } |
| 16 | 16 | |
| 17 | 17 | /** |
@@ -19,85 +19,85 @@ discard block |
||
| 19 | 19 | */ |
| 20 | 20 | class GetPaid_Admin_Setup_Wizard { |
| 21 | 21 | |
| 22 | - /** @var string Current Step */ |
|
| 23 | - private $step = ''; |
|
| 24 | - |
|
| 25 | - /** @var array Steps for the setup wizard */ |
|
| 26 | - private $steps = array(); |
|
| 27 | - |
|
| 28 | - /** |
|
| 29 | - * Hook in tabs. |
|
| 30 | - */ |
|
| 31 | - public function __construct() { |
|
| 32 | - if ( apply_filters( 'getpaid_enable_setup_wizard', true ) && current_user_can( 'manage_options' ) ) { |
|
| 33 | - add_action( 'admin_menu', array( $this, 'admin_menus' ) ); |
|
| 34 | - add_action( 'current_screen', array( $this, 'setup_wizard' ) ); |
|
| 35 | - |
|
| 36 | - // add default content action |
|
| 37 | - add_action( 'geodir_wizard_content_dummy_data', array( __CLASS__, 'content_dummy_data' ) ); |
|
| 38 | - add_action( 'geodir_wizard_content_sidebars', array( __CLASS__, 'content_sidebars' ) ); |
|
| 39 | - add_action( 'geodir_wizard_content_menus', array( __CLASS__, 'content_menus' ) ); |
|
| 40 | - } |
|
| 41 | - } |
|
| 42 | - |
|
| 43 | - /** |
|
| 44 | - * Add admin menus/screens. |
|
| 45 | - */ |
|
| 46 | - public function admin_menus() { |
|
| 47 | - add_dashboard_page( '', '', 'manage_options', 'gp-setup', '' ); |
|
| 48 | - } |
|
| 49 | - |
|
| 50 | - /** |
|
| 51 | - * Show the setup wizard. |
|
| 52 | - * |
|
| 53 | - * @since 2.0.0 |
|
| 54 | - */ |
|
| 55 | - public function setup_wizard() { |
|
| 56 | - if ( empty( $_GET['page'] ) || 'gp-setup' !== $_GET['page'] ) { |
|
| 57 | - return; |
|
| 58 | - } |
|
| 59 | - $default_steps = array( |
|
| 60 | - 'introduction' => array( |
|
| 61 | - 'name' => __( 'Introduction', 'invoicing' ), |
|
| 62 | - 'view' => array( $this, 'setup_introduction' ), |
|
| 63 | - 'handler' => '', |
|
| 64 | - ), |
|
| 65 | - 'business_details' => array( |
|
| 66 | - 'name' => __( "Business Details", 'invoicing' ), |
|
| 67 | - 'view' => array( $this, 'setup_business' ), |
|
| 68 | - 'handler' => array( $this, 'setup_business_save' ), |
|
| 69 | - ), |
|
| 70 | - 'currency' => array( |
|
| 71 | - 'name' => __( 'Currency', 'invoicing' ), |
|
| 72 | - 'view' => array( $this, 'setup_currency' ), |
|
| 73 | - 'handler' => array( $this, 'setup_currency_save' ), |
|
| 74 | - ), |
|
| 75 | - 'payments' => array( |
|
| 76 | - 'name' => __( 'Payment Gateways', 'invoicing' ), |
|
| 77 | - 'view' => array( $this, 'setup_payments' ), |
|
| 78 | - 'handler' => array( $this, 'setup_payments_save' ), |
|
| 79 | - ), |
|
| 80 | - 'recommend' => array( |
|
| 81 | - 'name' => __( 'Recommend', 'invoicing' ), |
|
| 82 | - 'view' => array( $this, 'setup_recommend' ), |
|
| 83 | - 'handler' => array( $this, 'setup_recommend_save' ), |
|
| 84 | - ), |
|
| 85 | - 'next_steps' => array( |
|
| 86 | - 'name' => __( 'Get Paid', 'invoicing' ), |
|
| 87 | - 'view' => array( $this, 'setup_ready' ), |
|
| 88 | - 'handler' => '', |
|
| 89 | - ), |
|
| 90 | - ); |
|
| 91 | - |
|
| 92 | - $this->steps = apply_filters( 'getpaid_setup_wizard_steps', $default_steps ); |
|
| 93 | - $this->step = isset( $_GET['step'] ) ? sanitize_key( $_GET['step'] ) : current( array_keys( $this->steps ) ); |
|
| 94 | - |
|
| 95 | - |
|
| 96 | - // enqueue the script |
|
| 97 | - $aui_settings = AyeCode_UI_Settings::instance(); |
|
| 98 | - $aui_settings->enqueue_scripts(); |
|
| 99 | - $aui_settings->enqueue_style(); |
|
| 100 | - getpaid_admin()->enqeue_scripts(); |
|
| 22 | + /** @var string Current Step */ |
|
| 23 | + private $step = ''; |
|
| 24 | + |
|
| 25 | + /** @var array Steps for the setup wizard */ |
|
| 26 | + private $steps = array(); |
|
| 27 | + |
|
| 28 | + /** |
|
| 29 | + * Hook in tabs. |
|
| 30 | + */ |
|
| 31 | + public function __construct() { |
|
| 32 | + if ( apply_filters( 'getpaid_enable_setup_wizard', true ) && current_user_can( 'manage_options' ) ) { |
|
| 33 | + add_action( 'admin_menu', array( $this, 'admin_menus' ) ); |
|
| 34 | + add_action( 'current_screen', array( $this, 'setup_wizard' ) ); |
|
| 35 | + |
|
| 36 | + // add default content action |
|
| 37 | + add_action( 'geodir_wizard_content_dummy_data', array( __CLASS__, 'content_dummy_data' ) ); |
|
| 38 | + add_action( 'geodir_wizard_content_sidebars', array( __CLASS__, 'content_sidebars' ) ); |
|
| 39 | + add_action( 'geodir_wizard_content_menus', array( __CLASS__, 'content_menus' ) ); |
|
| 40 | + } |
|
| 41 | + } |
|
| 42 | + |
|
| 43 | + /** |
|
| 44 | + * Add admin menus/screens. |
|
| 45 | + */ |
|
| 46 | + public function admin_menus() { |
|
| 47 | + add_dashboard_page( '', '', 'manage_options', 'gp-setup', '' ); |
|
| 48 | + } |
|
| 49 | + |
|
| 50 | + /** |
|
| 51 | + * Show the setup wizard. |
|
| 52 | + * |
|
| 53 | + * @since 2.0.0 |
|
| 54 | + */ |
|
| 55 | + public function setup_wizard() { |
|
| 56 | + if ( empty( $_GET['page'] ) || 'gp-setup' !== $_GET['page'] ) { |
|
| 57 | + return; |
|
| 58 | + } |
|
| 59 | + $default_steps = array( |
|
| 60 | + 'introduction' => array( |
|
| 61 | + 'name' => __( 'Introduction', 'invoicing' ), |
|
| 62 | + 'view' => array( $this, 'setup_introduction' ), |
|
| 63 | + 'handler' => '', |
|
| 64 | + ), |
|
| 65 | + 'business_details' => array( |
|
| 66 | + 'name' => __( "Business Details", 'invoicing' ), |
|
| 67 | + 'view' => array( $this, 'setup_business' ), |
|
| 68 | + 'handler' => array( $this, 'setup_business_save' ), |
|
| 69 | + ), |
|
| 70 | + 'currency' => array( |
|
| 71 | + 'name' => __( 'Currency', 'invoicing' ), |
|
| 72 | + 'view' => array( $this, 'setup_currency' ), |
|
| 73 | + 'handler' => array( $this, 'setup_currency_save' ), |
|
| 74 | + ), |
|
| 75 | + 'payments' => array( |
|
| 76 | + 'name' => __( 'Payment Gateways', 'invoicing' ), |
|
| 77 | + 'view' => array( $this, 'setup_payments' ), |
|
| 78 | + 'handler' => array( $this, 'setup_payments_save' ), |
|
| 79 | + ), |
|
| 80 | + 'recommend' => array( |
|
| 81 | + 'name' => __( 'Recommend', 'invoicing' ), |
|
| 82 | + 'view' => array( $this, 'setup_recommend' ), |
|
| 83 | + 'handler' => array( $this, 'setup_recommend_save' ), |
|
| 84 | + ), |
|
| 85 | + 'next_steps' => array( |
|
| 86 | + 'name' => __( 'Get Paid', 'invoicing' ), |
|
| 87 | + 'view' => array( $this, 'setup_ready' ), |
|
| 88 | + 'handler' => '', |
|
| 89 | + ), |
|
| 90 | + ); |
|
| 91 | + |
|
| 92 | + $this->steps = apply_filters( 'getpaid_setup_wizard_steps', $default_steps ); |
|
| 93 | + $this->step = isset( $_GET['step'] ) ? sanitize_key( $_GET['step'] ) : current( array_keys( $this->steps ) ); |
|
| 94 | + |
|
| 95 | + |
|
| 96 | + // enqueue the script |
|
| 97 | + $aui_settings = AyeCode_UI_Settings::instance(); |
|
| 98 | + $aui_settings->enqueue_scripts(); |
|
| 99 | + $aui_settings->enqueue_style(); |
|
| 100 | + getpaid_admin()->enqeue_scripts(); |
|
| 101 | 101 | |
| 102 | 102 | |
| 103 | 103 | // if ( ! empty( $_POST['save_step'] ) && isset( $this->steps[ $this->step ]['handler'] ) ) { |
@@ -108,21 +108,21 @@ discard block |
||
| 108 | 108 | // call_user_func( $this->steps[ $this->step ]['handler'], $this ); |
| 109 | 109 | // } |
| 110 | 110 | |
| 111 | - ob_start(); |
|
| 112 | - $this->setup_wizard_header(); |
|
| 111 | + ob_start(); |
|
| 112 | + $this->setup_wizard_header(); |
|
| 113 | 113 | // $this->setup_wizard_steps(); |
| 114 | - $this->setup_wizard_content(); |
|
| 115 | - $this->setup_wizard_footer(); |
|
| 116 | - exit; |
|
| 117 | - } |
|
| 118 | - |
|
| 119 | - /** |
|
| 120 | - * Setup Wizard Header. |
|
| 121 | - * |
|
| 122 | - * @since 2.0.0 |
|
| 123 | - */ |
|
| 114 | + $this->setup_wizard_content(); |
|
| 115 | + $this->setup_wizard_footer(); |
|
| 116 | + exit; |
|
| 117 | + } |
|
| 118 | + |
|
| 119 | + /** |
|
| 120 | + * Setup Wizard Header. |
|
| 121 | + * |
|
| 122 | + * @since 2.0.0 |
|
| 123 | + */ |
|
| 124 | 124 | public function setup_wizard_header() { |
| 125 | - ?> |
|
| 125 | + ?> |
|
| 126 | 126 | <!DOCTYPE html> |
| 127 | 127 | <html <?php language_attributes(); ?> class="bsui"> |
| 128 | 128 | <head> |
@@ -131,13 +131,13 @@ discard block |
||
| 131 | 131 | <title><?php esc_html_e( 'GetPaid › Setup Wizard', 'invoicing' ); ?></title> |
| 132 | 132 | <?php |
| 133 | 133 | |
| 134 | - wp_register_style( 'font-awesome', 'https://use.fontawesome.com/releases/v5.13.0/css/all.css', array( ), WPINV_VERSION ); |
|
| 135 | - wp_enqueue_style( 'font-awesome' ); |
|
| 136 | - do_action( 'admin_print_styles' ); |
|
| 137 | - wp_print_styles( 'select2' ); |
|
| 138 | - wp_print_scripts( 'wpinv-admin-script' ); |
|
| 139 | - wp_print_scripts( 'select2' ); |
|
| 140 | - ?> |
|
| 134 | + wp_register_style( 'font-awesome', 'https://use.fontawesome.com/releases/v5.13.0/css/all.css', array( ), WPINV_VERSION ); |
|
| 135 | + wp_enqueue_style( 'font-awesome' ); |
|
| 136 | + do_action( 'admin_print_styles' ); |
|
| 137 | + wp_print_styles( 'select2' ); |
|
| 138 | + wp_print_scripts( 'wpinv-admin-script' ); |
|
| 139 | + wp_print_scripts( 'select2' ); |
|
| 140 | + ?> |
|
| 141 | 141 | <?php do_action( 'admin_head' ); ?> |
| 142 | 142 | <style> |
| 143 | 143 | body,p{ |
@@ -146,22 +146,22 @@ discard block |
||
| 146 | 146 | } |
| 147 | 147 | |
| 148 | 148 | <?php |
| 149 | - $aui_settings = AyeCode_UI_Settings::instance(); |
|
| 150 | - echo $aui_settings::css_primary('#009874',true); |
|
| 151 | - ?> |
|
| 149 | + $aui_settings = AyeCode_UI_Settings::instance(); |
|
| 150 | + echo $aui_settings::css_primary('#009874',true); |
|
| 151 | + ?> |
|
| 152 | 152 | |
| 153 | 153 | |
| 154 | 154 | </style> |
| 155 | 155 | </head> |
| 156 | 156 | <body class="gp-setup wp-core-ui bg-lightx mx-auto text-dark scrollbars-ios" style="background: #f3f6ff;"> |
| 157 | 157 | <?php |
| 158 | - if(isset($_REQUEST['step'])){ |
|
| 159 | - $this->setup_wizard_steps(); |
|
| 160 | - }else{ |
|
| 161 | - echo "<div class='mb-3'> </div>"; |
|
| 162 | - } |
|
| 158 | + if(isset($_REQUEST['step'])){ |
|
| 159 | + $this->setup_wizard_steps(); |
|
| 160 | + }else{ |
|
| 161 | + echo "<div class='mb-3'> </div>"; |
|
| 162 | + } |
|
| 163 | 163 | |
| 164 | - ?> |
|
| 164 | + ?> |
|
| 165 | 165 | <h1 class="h2 text-center pb-3"> |
| 166 | 166 | <a class=" text-decoration-none" href="https://wpgetpaid.com/"> |
| 167 | 167 | <span class="text-black-50"> |
@@ -170,61 +170,61 @@ discard block |
||
| 170 | 170 | </a> |
| 171 | 171 | </h1> |
| 172 | 172 | <?php |
| 173 | - } |
|
| 174 | - |
|
| 175 | - /** |
|
| 176 | - * Output the steps. |
|
| 177 | - * |
|
| 178 | - * @since 2.0.0 |
|
| 179 | - */ |
|
| 180 | - public function setup_wizard_steps() { |
|
| 181 | - $ouput_steps = $this->steps; |
|
| 182 | - array_shift( $ouput_steps ); |
|
| 183 | - ?> |
|
| 173 | + } |
|
| 174 | + |
|
| 175 | + /** |
|
| 176 | + * Output the steps. |
|
| 177 | + * |
|
| 178 | + * @since 2.0.0 |
|
| 179 | + */ |
|
| 180 | + public function setup_wizard_steps() { |
|
| 181 | + $ouput_steps = $this->steps; |
|
| 182 | + array_shift( $ouput_steps ); |
|
| 183 | + ?> |
|
| 184 | 184 | <ol class="gp-setup-steps mb-0 pb-4 mw-100 list-group list-group-horizontal text-center"> |
| 185 | 185 | <?php |
| 186 | - $current = ''; |
|
| 187 | - foreach ( $ouput_steps as $step_key => $step ) : ?> |
|
| 186 | + $current = ''; |
|
| 187 | + foreach ( $ouput_steps as $step_key => $step ) : ?> |
|
| 188 | 188 | <li class="list-group-item flex-fill rounded-0 <?php |
| 189 | - $maybe_hide = 'd-none'; |
|
| 190 | - if ( $step_key === $this->step ) { |
|
| 191 | - $current = $this->step; |
|
| 192 | - echo 'active'; |
|
| 193 | - $maybe_hide = ''; |
|
| 194 | - } elseif ( array_search( $this->step, array_keys( $this->steps ) ) > array_search( $step_key, array_keys( $this->steps ) ) ) { |
|
| 195 | - echo 'done '; |
|
| 196 | - } |
|
| 197 | - |
|
| 198 | - echo ' '.$maybe_hide. ' d-md-block '; |
|
| 199 | - $done = !$current ? 'text-success' : ''; |
|
| 200 | - ?>"><i class="far fa-check-circle <?php echo $done ;?>"></i> <?php echo esc_html( $step['name'] ); ?></li> |
|
| 189 | + $maybe_hide = 'd-none'; |
|
| 190 | + if ( $step_key === $this->step ) { |
|
| 191 | + $current = $this->step; |
|
| 192 | + echo 'active'; |
|
| 193 | + $maybe_hide = ''; |
|
| 194 | + } elseif ( array_search( $this->step, array_keys( $this->steps ) ) > array_search( $step_key, array_keys( $this->steps ) ) ) { |
|
| 195 | + echo 'done '; |
|
| 196 | + } |
|
| 197 | + |
|
| 198 | + echo ' '.$maybe_hide. ' d-md-block '; |
|
| 199 | + $done = !$current ? 'text-success' : ''; |
|
| 200 | + ?>"><i class="far fa-check-circle <?php echo $done ;?>"></i> <?php echo esc_html( $step['name'] ); ?></li> |
|
| 201 | 201 | <?php endforeach; ?> |
| 202 | 202 | </ol> |
| 203 | 203 | <?php |
| 204 | - } |
|
| 205 | - |
|
| 206 | - /** |
|
| 207 | - * Output the content for the current step. |
|
| 208 | - * |
|
| 209 | - * @since 2.0.0 |
|
| 210 | - */ |
|
| 211 | - public function setup_wizard_content() { |
|
| 212 | - echo '<div class="gp-setup-content rowx mw-100 text-center mb-3">'; |
|
| 213 | - echo '<div class="col-12 col-md-5 m-auto">'; |
|
| 214 | - echo '<div class="card shadow-sm">'; |
|
| 215 | - call_user_func( $this->steps[ $this->step ]['view'], $this ); |
|
| 216 | - echo '</div>'; |
|
| 217 | - echo '</div>'; |
|
| 218 | - echo '</div>'; |
|
| 219 | - } |
|
| 220 | - |
|
| 221 | - /** |
|
| 222 | - * Setup Wizard Footer. |
|
| 223 | - * |
|
| 224 | - * @since 2.0.0 |
|
| 225 | - */ |
|
| 226 | - public function setup_wizard_footer() { |
|
| 227 | - ?> |
|
| 204 | + } |
|
| 205 | + |
|
| 206 | + /** |
|
| 207 | + * Output the content for the current step. |
|
| 208 | + * |
|
| 209 | + * @since 2.0.0 |
|
| 210 | + */ |
|
| 211 | + public function setup_wizard_content() { |
|
| 212 | + echo '<div class="gp-setup-content rowx mw-100 text-center mb-3">'; |
|
| 213 | + echo '<div class="col-12 col-md-5 m-auto">'; |
|
| 214 | + echo '<div class="card shadow-sm">'; |
|
| 215 | + call_user_func( $this->steps[ $this->step ]['view'], $this ); |
|
| 216 | + echo '</div>'; |
|
| 217 | + echo '</div>'; |
|
| 218 | + echo '</div>'; |
|
| 219 | + } |
|
| 220 | + |
|
| 221 | + /** |
|
| 222 | + * Setup Wizard Footer. |
|
| 223 | + * |
|
| 224 | + * @since 2.0.0 |
|
| 225 | + */ |
|
| 226 | + public function setup_wizard_footer() { |
|
| 227 | + ?> |
|
| 228 | 228 | <?php if ( 'next_steps' === $this->step ){ ?> |
| 229 | 229 | <p class="gd-return-to-dashboard-wrap"><a class="gd-return-to-dashboard btn btn-link d-block text-muted" |
| 230 | 230 | href="<?php echo esc_url( admin_url() ); ?>"><?php esc_html_e( 'Return to the WordPress Dashboard', 'invoicing' ); ?></a> |
@@ -238,13 +238,13 @@ discard block |
||
| 238 | 238 | <?php |
| 239 | 239 | } |
| 240 | 240 | |
| 241 | - /** |
|
| 242 | - * Introduction step. |
|
| 243 | - * |
|
| 244 | - * @since 2.0.0 |
|
| 245 | - */ |
|
| 246 | - public function setup_introduction() { |
|
| 247 | - ?> |
|
| 241 | + /** |
|
| 242 | + * Introduction step. |
|
| 243 | + * |
|
| 244 | + * @since 2.0.0 |
|
| 245 | + */ |
|
| 246 | + public function setup_introduction() { |
|
| 247 | + ?> |
|
| 248 | 248 | <h1 class="h4 card-header bg-white border-bottom-0 pt-4 pb-1"><?php esc_html_e( 'Welcome to GetPaid!', 'invoicing' ); ?></h1> |
| 249 | 249 | <div class="card-body text-muted "> |
| 250 | 250 | <p class=""><?php _e( 'Thank you for choosing GetPaid - The most Powerful Payments Plugin for WordPress', 'invoicing' ); ?></p> |
@@ -350,50 +350,50 @@ discard block |
||
| 350 | 350 | class="btn btn-link d-block mt-2 "><?php esc_html_e( 'Not right now', 'invoicing' ); ?></a> |
| 351 | 351 | </div> |
| 352 | 352 | <?php |
| 353 | - } |
|
| 354 | - |
|
| 355 | - /** |
|
| 356 | - * Get the URL for the next step's screen. |
|
| 357 | - * |
|
| 358 | - * @param string step slug (default: current step) |
|
| 359 | - * |
|
| 360 | - * @return string URL for next step if a next step exists. |
|
| 361 | - * Admin URL if it's the last step. |
|
| 362 | - * Empty string on failure. |
|
| 363 | - * @since 3.0.0 |
|
| 364 | - */ |
|
| 365 | - public function get_next_step_link( $step = '' ) { |
|
| 366 | - if ( ! $step ) { |
|
| 367 | - $step = $this->step; |
|
| 368 | - } |
|
| 369 | - |
|
| 370 | - $keys = array_keys( $this->steps ); |
|
| 371 | - if ( end( $keys ) === $step ) { |
|
| 372 | - return admin_url(); |
|
| 373 | - } |
|
| 374 | - |
|
| 375 | - $step_index = array_search( $step, $keys ); |
|
| 376 | - if ( false === $step_index ) { |
|
| 377 | - return ''; |
|
| 378 | - } |
|
| 379 | - |
|
| 380 | - return remove_query_arg('settings-updated', add_query_arg( 'step', $keys[ $step_index + 1 ] )); |
|
| 381 | - } |
|
| 382 | - |
|
| 383 | - /** |
|
| 384 | - * Setup maps api. |
|
| 385 | - * |
|
| 386 | - * @since 2.0.0 |
|
| 387 | - */ |
|
| 388 | - public function setup_business() { |
|
| 389 | - ?> |
|
| 353 | + } |
|
| 354 | + |
|
| 355 | + /** |
|
| 356 | + * Get the URL for the next step's screen. |
|
| 357 | + * |
|
| 358 | + * @param string step slug (default: current step) |
|
| 359 | + * |
|
| 360 | + * @return string URL for next step if a next step exists. |
|
| 361 | + * Admin URL if it's the last step. |
|
| 362 | + * Empty string on failure. |
|
| 363 | + * @since 3.0.0 |
|
| 364 | + */ |
|
| 365 | + public function get_next_step_link( $step = '' ) { |
|
| 366 | + if ( ! $step ) { |
|
| 367 | + $step = $this->step; |
|
| 368 | + } |
|
| 369 | + |
|
| 370 | + $keys = array_keys( $this->steps ); |
|
| 371 | + if ( end( $keys ) === $step ) { |
|
| 372 | + return admin_url(); |
|
| 373 | + } |
|
| 374 | + |
|
| 375 | + $step_index = array_search( $step, $keys ); |
|
| 376 | + if ( false === $step_index ) { |
|
| 377 | + return ''; |
|
| 378 | + } |
|
| 379 | + |
|
| 380 | + return remove_query_arg('settings-updated', add_query_arg( 'step', $keys[ $step_index + 1 ] )); |
|
| 381 | + } |
|
| 382 | + |
|
| 383 | + /** |
|
| 384 | + * Setup maps api. |
|
| 385 | + * |
|
| 386 | + * @since 2.0.0 |
|
| 387 | + */ |
|
| 388 | + public function setup_business() { |
|
| 389 | + ?> |
|
| 390 | 390 | <form method="post" class="text-left card-body" action="options.php"> |
| 391 | 391 | <?php |
| 392 | 392 | |
| 393 | - settings_fields( 'wpinv_settings' ); |
|
| 393 | + settings_fields( 'wpinv_settings' ); |
|
| 394 | 394 | |
| 395 | - // override http referer to make it send back to the next step |
|
| 396 | - ?> |
|
| 395 | + // override http referer to make it send back to the next step |
|
| 396 | + ?> |
|
| 397 | 397 | <input type="hidden" name="_wp_http_referer" value="<?php echo esc_url( $this->get_next_step_link() ); ?>"> |
| 398 | 398 | |
| 399 | 399 | <table class="gp-setup-maps w-100 " cellspacing="0"> |
@@ -402,21 +402,21 @@ discard block |
||
| 402 | 402 | |
| 403 | 403 | <?php |
| 404 | 404 | |
| 405 | - global $wp_settings_fields; |
|
| 405 | + global $wp_settings_fields; |
|
| 406 | 406 | |
| 407 | - $page = 'wpinv_settings_general_main'; |
|
| 408 | - $section = 'wpinv_settings_general_main'; |
|
| 409 | - if ( ! isset( $wp_settings_fields[ $page ][ $section ] ) ) { |
|
| 410 | - return; |
|
| 411 | - } |
|
| 407 | + $page = 'wpinv_settings_general_main'; |
|
| 408 | + $section = 'wpinv_settings_general_main'; |
|
| 409 | + if ( ! isset( $wp_settings_fields[ $page ][ $section ] ) ) { |
|
| 410 | + return; |
|
| 411 | + } |
|
| 412 | 412 | |
| 413 | - $settings = $wp_settings_fields[ $page ][ $section ]; |
|
| 413 | + $settings = $wp_settings_fields[ $page ][ $section ]; |
|
| 414 | 414 | |
| 415 | - // unset title |
|
| 416 | - unset($settings["wpinv_settings[location_settings]"]); |
|
| 415 | + // unset title |
|
| 416 | + unset($settings["wpinv_settings[location_settings]"]); |
|
| 417 | 417 | |
| 418 | - $this->output_fields($settings); |
|
| 419 | - ?> |
|
| 418 | + $this->output_fields($settings); |
|
| 419 | + ?> |
|
| 420 | 420 | |
| 421 | 421 | |
| 422 | 422 | </tbody> |
@@ -429,64 +429,64 @@ discard block |
||
| 429 | 429 | </p> |
| 430 | 430 | </form> |
| 431 | 431 | <?php |
| 432 | - } |
|
| 432 | + } |
|
| 433 | 433 | |
| 434 | - public function output_fields($settings){ |
|
| 434 | + public function output_fields($settings){ |
|
| 435 | 435 | |
| 436 | - if ( empty($settings)) { |
|
| 437 | - return; |
|
| 438 | - } |
|
| 436 | + if ( empty($settings)) { |
|
| 437 | + return; |
|
| 438 | + } |
|
| 439 | 439 | |
| 440 | 440 | //print_r($settings); |
| 441 | - foreach ( (array) $settings as $key => $field ) { |
|
| 441 | + foreach ( (array) $settings as $key => $field ) { |
|
| 442 | 442 | |
| 443 | 443 | |
| 444 | - $class = ''; |
|
| 444 | + $class = ''; |
|
| 445 | 445 | |
| 446 | - if ( ! empty( $field['args']['class'] ) ) { |
|
| 447 | - $class = esc_attr( $field['args']['class'] ); |
|
| 448 | - } |
|
| 446 | + if ( ! empty( $field['args']['class'] ) ) { |
|
| 447 | + $class = esc_attr( $field['args']['class'] ); |
|
| 448 | + } |
|
| 449 | 449 | |
| 450 | - // echo '<div class="form-group '.$class.'">'; |
|
| 450 | + // echo '<div class="form-group '.$class.'">'; |
|
| 451 | 451 | |
| 452 | 452 | |
| 453 | - if ( ! empty( $field['args']['label_for'] ) ) { |
|
| 454 | - $for = ' for="' . esc_attr( $field['args']['label_for'] ) . '" '; |
|
| 455 | - } else { |
|
| 456 | - $for = ''; |
|
| 457 | - } |
|
| 453 | + if ( ! empty( $field['args']['label_for'] ) ) { |
|
| 454 | + $for = ' for="' . esc_attr( $field['args']['label_for'] ) . '" '; |
|
| 455 | + } else { |
|
| 456 | + $for = ''; |
|
| 457 | + } |
|
| 458 | 458 | |
| 459 | - $value = isset( $field['args']['std'] ) ? $field['args']['std'] : ''; |
|
| 460 | - $value = wpinv_get_option( $field['args']['id'], $value ); |
|
| 459 | + $value = isset( $field['args']['std'] ) ? $field['args']['std'] : ''; |
|
| 460 | + $value = wpinv_get_option( $field['args']['id'], $value ); |
|
| 461 | 461 | |
| 462 | - if($field['callback'] == 'wpinv_text_callback' || $field['callback'] == 'wpinv_number_callback' ){ |
|
| 462 | + if($field['callback'] == 'wpinv_text_callback' || $field['callback'] == 'wpinv_number_callback' ){ |
|
| 463 | 463 | |
| 464 | 464 | |
| 465 | - // hide the logo inputs, we need to set them as hidden so they don't blank the current values. |
|
| 466 | - $help_text = isset($field['args']['desc']) ? esc_attr($field['args']['desc']) : ''; |
|
| 467 | - $type = $field['callback'] == 'wpinv_number_callback' ? 'number' : 'text'; |
|
| 468 | - $label = isset($field['args']['name']) ? esc_attr($field['args']['name']) : ''; |
|
| 465 | + // hide the logo inputs, we need to set them as hidden so they don't blank the current values. |
|
| 466 | + $help_text = isset($field['args']['desc']) ? esc_attr($field['args']['desc']) : ''; |
|
| 467 | + $type = $field['callback'] == 'wpinv_number_callback' ? 'number' : 'text'; |
|
| 468 | + $label = isset($field['args']['name']) ? esc_attr($field['args']['name']) : ''; |
|
| 469 | 469 | |
| 470 | - if(in_array($field['id'],array('wpinv_settings[logo]','wpinv_settings[logo_width]','wpinv_settings[logo_height]'))){ |
|
| 471 | - $type = 'hidden'; |
|
| 472 | - $help_text = ''; |
|
| 473 | - $label = ''; |
|
| 474 | - } |
|
| 470 | + if(in_array($field['id'],array('wpinv_settings[logo]','wpinv_settings[logo_width]','wpinv_settings[logo_height]'))){ |
|
| 471 | + $type = 'hidden'; |
|
| 472 | + $help_text = ''; |
|
| 473 | + $label = ''; |
|
| 474 | + } |
|
| 475 | 475 | |
| 476 | - echo aui()->input(array( |
|
| 477 | - 'type' => $type, |
|
| 478 | - 'id' => isset($field['args']['id']) ? esc_attr($field['args']['id']) : '', |
|
| 479 | - 'name' => isset($field['id']) ? esc_attr($field['id']) : '', |
|
| 480 | - 'value' => is_scalar( $value ) ? esc_attr( $value ) : '', |
|
| 481 | - 'required' => false, |
|
| 482 | - 'help_text' => $help_text, |
|
| 483 | - 'label' => $label, |
|
| 484 | - 'label_type' => 'floating' |
|
| 485 | - )); |
|
| 486 | - }elseif($field['callback'] == 'wpinv_select_callback' || $field['callback'] == 'wpinv_country_states_callback'){ |
|
| 476 | + echo aui()->input(array( |
|
| 477 | + 'type' => $type, |
|
| 478 | + 'id' => isset($field['args']['id']) ? esc_attr($field['args']['id']) : '', |
|
| 479 | + 'name' => isset($field['id']) ? esc_attr($field['id']) : '', |
|
| 480 | + 'value' => is_scalar( $value ) ? esc_attr( $value ) : '', |
|
| 481 | + 'required' => false, |
|
| 482 | + 'help_text' => $help_text, |
|
| 483 | + 'label' => $label, |
|
| 484 | + 'label_type' => 'floating' |
|
| 485 | + )); |
|
| 486 | + }elseif($field['callback'] == 'wpinv_select_callback' || $field['callback'] == 'wpinv_country_states_callback'){ |
|
| 487 | 487 | |
| 488 | 488 | if($field['id']=='wpinv_settings[default_state]'){ |
| 489 | - $country_value = wpinv_get_option( 'wpinv_settings[default_country]', 'US'); |
|
| 489 | + $country_value = wpinv_get_option( 'wpinv_settings[default_country]', 'US'); |
|
| 490 | 490 | $options = wpinv_get_country_states($country_value);//echo $value .'###'.$country_value; |
| 491 | 491 | $class = 'getpaid_js_field-state'; |
| 492 | 492 | }else{ |
@@ -496,79 +496,79 @@ discard block |
||
| 496 | 496 | |
| 497 | 497 | //print_r($options );echo '###'; |
| 498 | 498 | |
| 499 | - echo aui()->select( array( |
|
| 500 | - 'id' => isset($field['args']['id']) ? esc_attr($field['args']['id']) : '', |
|
| 501 | - 'name' => isset($field['id']) ? esc_attr($field['id']) : '', |
|
| 502 | - 'placeholder' => '', |
|
| 499 | + echo aui()->select( array( |
|
| 500 | + 'id' => isset($field['args']['id']) ? esc_attr($field['args']['id']) : '', |
|
| 501 | + 'name' => isset($field['id']) ? esc_attr($field['id']) : '', |
|
| 502 | + 'placeholder' => '', |
|
| 503 | 503 | // 'title' => $site_title, |
| 504 | - 'value' => is_scalar( $value ) ? esc_attr( $value ) : '', |
|
| 505 | - 'required' => false, |
|
| 506 | - 'help_text' => isset($field['args']['desc']) ? esc_attr($field['args']['desc']) : '', |
|
| 507 | - 'label' => isset($field['args']['name']) ? esc_attr($field['args']['name']) : '', |
|
| 508 | - 'options' => $options, |
|
| 509 | - 'select2' => true, |
|
| 510 | - 'label_type' => 'floating', |
|
| 511 | - 'class' => $class, |
|
| 504 | + 'value' => is_scalar( $value ) ? esc_attr( $value ) : '', |
|
| 505 | + 'required' => false, |
|
| 506 | + 'help_text' => isset($field['args']['desc']) ? esc_attr($field['args']['desc']) : '', |
|
| 507 | + 'label' => isset($field['args']['name']) ? esc_attr($field['args']['name']) : '', |
|
| 508 | + 'options' => $options, |
|
| 509 | + 'select2' => true, |
|
| 510 | + 'label_type' => 'floating', |
|
| 511 | + 'class' => $class, |
|
| 512 | 512 | // 'wrap_class' => isset( $field->css_class ) ? $field->css_class : '', |
| 513 | - ) ); |
|
| 514 | - }elseif($field['callback'] == 'wpinv_textarea_callback'){ |
|
| 515 | - $textarea = aui()->textarea( array( |
|
| 516 | - 'id' => isset($field['args']['id']) ? esc_attr($field['args']['id']) : '', |
|
| 517 | - 'name' => isset($field['id']) ? esc_attr($field['id']) : '', |
|
| 518 | - 'placeholder' => '', |
|
| 513 | + ) ); |
|
| 514 | + }elseif($field['callback'] == 'wpinv_textarea_callback'){ |
|
| 515 | + $textarea = aui()->textarea( array( |
|
| 516 | + 'id' => isset($field['args']['id']) ? esc_attr($field['args']['id']) : '', |
|
| 517 | + 'name' => isset($field['id']) ? esc_attr($field['id']) : '', |
|
| 518 | + 'placeholder' => '', |
|
| 519 | 519 | // 'title' => $site_title, |
| 520 | - 'value' => is_scalar( $value ) ? esc_attr( $value ) : '', |
|
| 521 | - 'required' => false, |
|
| 522 | - 'help_text' => isset($field['args']['desc']) ? esc_attr($field['args']['desc']) : '', |
|
| 523 | - 'label' => isset($field['args']['name']) ? esc_attr($field['args']['name']) : '', |
|
| 524 | - 'rows' => '4', |
|
| 525 | - 'label_type' => 'floating' |
|
| 520 | + 'value' => is_scalar( $value ) ? esc_attr( $value ) : '', |
|
| 521 | + 'required' => false, |
|
| 522 | + 'help_text' => isset($field['args']['desc']) ? esc_attr($field['args']['desc']) : '', |
|
| 523 | + 'label' => isset($field['args']['name']) ? esc_attr($field['args']['name']) : '', |
|
| 524 | + 'rows' => '4', |
|
| 525 | + 'label_type' => 'floating' |
|
| 526 | 526 | // 'wrap_class' => isset( $field->css_class ) ? $field->css_class : '', |
| 527 | - ) ); |
|
| 527 | + ) ); |
|
| 528 | 528 | |
| 529 | - // bug fixed in AUI 0.1.51 for name stripping [] |
|
| 530 | - $textarea = str_replace(sanitize_html_class($field['args']['id']),esc_attr($field['args']['id']),$textarea ); |
|
| 529 | + // bug fixed in AUI 0.1.51 for name stripping [] |
|
| 530 | + $textarea = str_replace(sanitize_html_class($field['args']['id']),esc_attr($field['args']['id']),$textarea ); |
|
| 531 | 531 | |
| 532 | - echo $textarea; |
|
| 533 | - } |
|
| 532 | + echo $textarea; |
|
| 533 | + } |
|
| 534 | 534 | |
| 535 | - //echo "<div>"; |
|
| 535 | + //echo "<div>"; |
|
| 536 | 536 | |
| 537 | - } |
|
| 538 | - } |
|
| 537 | + } |
|
| 538 | + } |
|
| 539 | 539 | |
| 540 | - /** |
|
| 541 | - * Save Maps Settings. |
|
| 542 | - * |
|
| 543 | - * @since 2.0.0 |
|
| 544 | - */ |
|
| 545 | - public function setup_business_save() { |
|
| 540 | + /** |
|
| 541 | + * Save Maps Settings. |
|
| 542 | + * |
|
| 543 | + * @since 2.0.0 |
|
| 544 | + */ |
|
| 545 | + public function setup_business_save() { |
|
| 546 | 546 | |
| 547 | - // nothing required here as options.php will send to next step |
|
| 548 | - //check_admin_referer( 'gp-setup' ); |
|
| 547 | + // nothing required here as options.php will send to next step |
|
| 548 | + //check_admin_referer( 'gp-setup' ); |
|
| 549 | 549 | |
| 550 | 550 | //print_r($_POST);exit; |
| 551 | 551 | // wp_redirect( esc_url_raw( $this->get_next_step_link() ) ); |
| 552 | 552 | // exit; |
| 553 | - } |
|
| 553 | + } |
|
| 554 | 554 | |
| 555 | - /** |
|
| 556 | - * Default Location settings. |
|
| 557 | - * |
|
| 558 | - * @since 2.0.0 |
|
| 559 | - */ |
|
| 560 | - public function setup_currency() { |
|
| 555 | + /** |
|
| 556 | + * Default Location settings. |
|
| 557 | + * |
|
| 558 | + * @since 2.0.0 |
|
| 559 | + */ |
|
| 560 | + public function setup_currency() { |
|
| 561 | 561 | |
| 562 | - ?> |
|
| 562 | + ?> |
|
| 563 | 563 | |
| 564 | 564 | <form method="post" class="text-left card-body" action="options.php"> |
| 565 | 565 | <?php |
| 566 | 566 | |
| 567 | 567 | |
| 568 | - settings_fields( 'wpinv_settings' ); |
|
| 568 | + settings_fields( 'wpinv_settings' ); |
|
| 569 | 569 | |
| 570 | - // override http referer to make it send back to the next step |
|
| 571 | - ?> |
|
| 570 | + // override http referer to make it send back to the next step |
|
| 571 | + ?> |
|
| 572 | 572 | <input type="hidden" name="_wp_http_referer" value="<?php echo esc_url( $this->get_next_step_link() ); ?>"> |
| 573 | 573 | |
| 574 | 574 | <table class="gp-setup-maps w-100 " cellspacing="0"> |
@@ -577,20 +577,20 @@ discard block |
||
| 577 | 577 | |
| 578 | 578 | <?php |
| 579 | 579 | |
| 580 | - global $wp_settings_fields; |
|
| 580 | + global $wp_settings_fields; |
|
| 581 | 581 | |
| 582 | - $page = 'wpinv_settings_general_currency_section'; |
|
| 583 | - $section = 'wpinv_settings_general_currency_section'; |
|
| 584 | - if ( ! isset( $wp_settings_fields[ $page ][ $section ] ) ) { |
|
| 585 | - return; |
|
| 586 | - } |
|
| 582 | + $page = 'wpinv_settings_general_currency_section'; |
|
| 583 | + $section = 'wpinv_settings_general_currency_section'; |
|
| 584 | + if ( ! isset( $wp_settings_fields[ $page ][ $section ] ) ) { |
|
| 585 | + return; |
|
| 586 | + } |
|
| 587 | 587 | |
| 588 | - $settings = $wp_settings_fields[ $page ][ $section ]; |
|
| 588 | + $settings = $wp_settings_fields[ $page ][ $section ]; |
|
| 589 | 589 | |
| 590 | 590 | // print_r($settings);exit; |
| 591 | 591 | |
| 592 | - $this->output_fields($settings); |
|
| 593 | - ?> |
|
| 592 | + $this->output_fields($settings); |
|
| 593 | + ?> |
|
| 594 | 594 | |
| 595 | 595 | |
| 596 | 596 | </tbody> |
@@ -604,35 +604,35 @@ discard block |
||
| 604 | 604 | </form> |
| 605 | 605 | |
| 606 | 606 | <?php |
| 607 | - } |
|
| 607 | + } |
|
| 608 | 608 | |
| 609 | 609 | |
| 610 | - /** |
|
| 611 | - * Save Default Location Settings. |
|
| 612 | - * |
|
| 613 | - * @since 2.0.0 |
|
| 614 | - */ |
|
| 615 | - public function setup_currency_save() { |
|
| 616 | - check_admin_referer( 'gp-setup' ); |
|
| 610 | + /** |
|
| 611 | + * Save Default Location Settings. |
|
| 612 | + * |
|
| 613 | + * @since 2.0.0 |
|
| 614 | + */ |
|
| 615 | + public function setup_currency_save() { |
|
| 616 | + check_admin_referer( 'gp-setup' ); |
|
| 617 | 617 | |
| 618 | - $generalSettings = new GeoDir_Settings_General(); |
|
| 619 | - $settings = $generalSettings->get_settings( 'location' ); |
|
| 620 | - GeoDir_Admin_Settings::save_fields( $settings ); |
|
| 618 | + $generalSettings = new GeoDir_Settings_General(); |
|
| 619 | + $settings = $generalSettings->get_settings( 'location' ); |
|
| 620 | + GeoDir_Admin_Settings::save_fields( $settings ); |
|
| 621 | 621 | |
| 622 | - do_action( 'geodir_setup_wizard_default_location_saved', $settings ); |
|
| 622 | + do_action( 'geodir_setup_wizard_default_location_saved', $settings ); |
|
| 623 | 623 | |
| 624 | - wp_redirect( esc_url_raw( $this->get_next_step_link() ) ); |
|
| 625 | - exit; |
|
| 626 | - } |
|
| 624 | + wp_redirect( esc_url_raw( $this->get_next_step_link() ) ); |
|
| 625 | + exit; |
|
| 626 | + } |
|
| 627 | 627 | |
| 628 | - /** |
|
| 629 | - * Dummy Data setup. |
|
| 630 | - * |
|
| 631 | - * @since 2.0.0 |
|
| 632 | - */ |
|
| 633 | - public function setup_recommend() { |
|
| 628 | + /** |
|
| 629 | + * Dummy Data setup. |
|
| 630 | + * |
|
| 631 | + * @since 2.0.0 |
|
| 632 | + */ |
|
| 633 | + public function setup_recommend() { |
|
| 634 | 634 | |
| 635 | - ?> |
|
| 635 | + ?> |
|
| 636 | 636 | <form method="post" class="text-center card-body"> |
| 637 | 637 | <div class="gd-wizard-recommend"> |
| 638 | 638 | |
@@ -643,22 +643,22 @@ discard block |
||
| 643 | 643 | |
| 644 | 644 | <?php |
| 645 | 645 | |
| 646 | - include_once( ABSPATH . 'wp-admin/includes/plugin-install.php' ); //for plugins_api.. |
|
| 646 | + include_once( ABSPATH . 'wp-admin/includes/plugin-install.php' ); //for plugins_api.. |
|
| 647 | 647 | |
| 648 | - $recommend_wp_plugins = self::get_recommend_wp_plugins(); |
|
| 648 | + $recommend_wp_plugins = self::get_recommend_wp_plugins(); |
|
| 649 | 649 | |
| 650 | - // $status = install_plugin_install_status( array("slug"=>"two-factor","version"=>"")); |
|
| 651 | - // print_r($status); |
|
| 650 | + // $status = install_plugin_install_status( array("slug"=>"two-factor","version"=>"")); |
|
| 651 | + // print_r($status); |
|
| 652 | 652 | |
| 653 | - if ( ! empty( $recommend_wp_plugins ) ) { |
|
| 653 | + if ( ! empty( $recommend_wp_plugins ) ) { |
|
| 654 | 654 | |
| 655 | - ?> |
|
| 655 | + ?> |
|
| 656 | 656 | <ul class="list-group"> |
| 657 | 657 | <?php |
| 658 | - foreach ( $recommend_wp_plugins as $plugin ) { |
|
| 659 | - $status = install_plugin_install_status( array( "slug" => $plugin['slug'], "version" => "" ) ); |
|
| 660 | - $plugin_status = isset( $status['status'] ) ? $status['status'] : ''; |
|
| 661 | - ?> |
|
| 658 | + foreach ( $recommend_wp_plugins as $plugin ) { |
|
| 659 | + $status = install_plugin_install_status( array( "slug" => $plugin['slug'], "version" => "" ) ); |
|
| 660 | + $plugin_status = isset( $status['status'] ) ? $status['status'] : ''; |
|
| 661 | + ?> |
|
| 662 | 662 | <li class="list-group-item d-flex justify-content-between align-items-center flex-wrap text-left"> |
| 663 | 663 | <span class="mr-auto"><?php echo esc_attr($plugin['name']); ?></span> |
| 664 | 664 | <div class="spinner-border spinner-border-sm mr-2 d-none text-muted" role="status"> |
@@ -671,16 +671,16 @@ discard block |
||
| 671 | 671 | <small class="w-100"><?php echo esc_attr($plugin['desc'] );?></small> |
| 672 | 672 | </li> |
| 673 | 673 | <?php |
| 674 | - } |
|
| 674 | + } |
|
| 675 | 675 | ?> |
| 676 | 676 | </ul> |
| 677 | 677 | <?php |
| 678 | 678 | |
| 679 | - } |
|
| 679 | + } |
|
| 680 | 680 | |
| 681 | 681 | |
| 682 | 682 | |
| 683 | - ?> |
|
| 683 | + ?> |
|
| 684 | 684 | |
| 685 | 685 | |
| 686 | 686 | |
@@ -691,57 +691,57 @@ discard block |
||
| 691 | 691 | </p> |
| 692 | 692 | </form> |
| 693 | 693 | <?php |
| 694 | - } |
|
| 695 | - |
|
| 696 | - /** |
|
| 697 | - * A list of recommended wp.org plugins. |
|
| 698 | - * @return array |
|
| 699 | - */ |
|
| 700 | - public static function get_recommend_wp_plugins(){ |
|
| 701 | - $plugins = array( |
|
| 702 | - 'ayecode-connect' => array( |
|
| 703 | - 'url' => 'https://wordpress.org/plugins/ayecode-connect/', |
|
| 704 | - 'slug' => 'ayecode-connect', |
|
| 705 | - 'name' => 'AyeCode Connect', |
|
| 706 | - 'desc' => __( 'Documentation and Support from within your WordPress admin.', 'geodirectory' ), |
|
| 707 | - ), |
|
| 708 | - 'ninja-forms' => array( |
|
| 709 | - 'url' => 'https://wordpress.org/plugins/invoicing-quotes/', |
|
| 710 | - 'slug' => 'invoicing-quotes', |
|
| 711 | - 'name' => 'Customer Quotes', |
|
| 712 | - 'desc' => __('Create & Send Quotes to Customers and have them accept and pay.','geodirectory'), |
|
| 713 | - ), |
|
| 714 | - 'userswp' => array( |
|
| 715 | - 'url' => 'https://wordpress.org/plugins/userswp/', |
|
| 716 | - 'slug' => 'userswp', |
|
| 717 | - 'name' => 'UsersWP', |
|
| 718 | - 'desc' => __('Frontend user login and registration as well as slick profile pages.','geodirectory'), |
|
| 719 | - ), |
|
| 720 | - ); |
|
| 721 | - |
|
| 722 | - return $plugins; |
|
| 723 | - } |
|
| 724 | - |
|
| 725 | - /** |
|
| 726 | - * Dummy data save. |
|
| 727 | - * |
|
| 728 | - * This is done via ajax so we just pass onto the next step. |
|
| 729 | - * |
|
| 730 | - * @since 2.0.0 |
|
| 731 | - */ |
|
| 732 | - public function setup_recommend_save() { |
|
| 733 | - check_admin_referer( 'gp-setup' ); |
|
| 734 | - wp_redirect( esc_url_raw( $this->get_next_step_link() ) ); |
|
| 735 | - exit; |
|
| 736 | - } |
|
| 737 | - |
|
| 738 | - /** |
|
| 739 | - * Dummy Data setup. |
|
| 740 | - * |
|
| 741 | - * @since 2.0.0 |
|
| 742 | - */ |
|
| 743 | - public function setup_payments() { |
|
| 744 | - ?> |
|
| 694 | + } |
|
| 695 | + |
|
| 696 | + /** |
|
| 697 | + * A list of recommended wp.org plugins. |
|
| 698 | + * @return array |
|
| 699 | + */ |
|
| 700 | + public static function get_recommend_wp_plugins(){ |
|
| 701 | + $plugins = array( |
|
| 702 | + 'ayecode-connect' => array( |
|
| 703 | + 'url' => 'https://wordpress.org/plugins/ayecode-connect/', |
|
| 704 | + 'slug' => 'ayecode-connect', |
|
| 705 | + 'name' => 'AyeCode Connect', |
|
| 706 | + 'desc' => __( 'Documentation and Support from within your WordPress admin.', 'geodirectory' ), |
|
| 707 | + ), |
|
| 708 | + 'ninja-forms' => array( |
|
| 709 | + 'url' => 'https://wordpress.org/plugins/invoicing-quotes/', |
|
| 710 | + 'slug' => 'invoicing-quotes', |
|
| 711 | + 'name' => 'Customer Quotes', |
|
| 712 | + 'desc' => __('Create & Send Quotes to Customers and have them accept and pay.','geodirectory'), |
|
| 713 | + ), |
|
| 714 | + 'userswp' => array( |
|
| 715 | + 'url' => 'https://wordpress.org/plugins/userswp/', |
|
| 716 | + 'slug' => 'userswp', |
|
| 717 | + 'name' => 'UsersWP', |
|
| 718 | + 'desc' => __('Frontend user login and registration as well as slick profile pages.','geodirectory'), |
|
| 719 | + ), |
|
| 720 | + ); |
|
| 721 | + |
|
| 722 | + return $plugins; |
|
| 723 | + } |
|
| 724 | + |
|
| 725 | + /** |
|
| 726 | + * Dummy data save. |
|
| 727 | + * |
|
| 728 | + * This is done via ajax so we just pass onto the next step. |
|
| 729 | + * |
|
| 730 | + * @since 2.0.0 |
|
| 731 | + */ |
|
| 732 | + public function setup_recommend_save() { |
|
| 733 | + check_admin_referer( 'gp-setup' ); |
|
| 734 | + wp_redirect( esc_url_raw( $this->get_next_step_link() ) ); |
|
| 735 | + exit; |
|
| 736 | + } |
|
| 737 | + |
|
| 738 | + /** |
|
| 739 | + * Dummy Data setup. |
|
| 740 | + * |
|
| 741 | + * @since 2.0.0 |
|
| 742 | + */ |
|
| 743 | + public function setup_payments() { |
|
| 744 | + ?> |
|
| 745 | 745 | <form method="post" class="text-center card-body"> |
| 746 | 746 | <div class="gp-wizard-payments"> |
| 747 | 747 | |
@@ -782,7 +782,7 @@ discard block |
||
| 782 | 782 | |
| 783 | 783 | |
| 784 | 784 | |
| 785 | - ?> |
|
| 785 | + ?> |
|
| 786 | 786 | |
| 787 | 787 | |
| 788 | 788 | </div> |
@@ -792,29 +792,29 @@ discard block |
||
| 792 | 792 | </p> |
| 793 | 793 | </form> |
| 794 | 794 | <?php |
| 795 | - } |
|
| 796 | - |
|
| 797 | - /** |
|
| 798 | - * Dummy data save. |
|
| 799 | - * |
|
| 800 | - * This is done via ajax so we just pass onto the next step. |
|
| 801 | - * |
|
| 802 | - * @since 2.0.0 |
|
| 803 | - */ |
|
| 804 | - public function setup_payments_save() { |
|
| 805 | - check_admin_referer( 'gp-setup' ); |
|
| 806 | - wp_redirect( esc_url_raw( $this->get_next_step_link() ) ); |
|
| 807 | - exit; |
|
| 808 | - } |
|
| 809 | - |
|
| 810 | - /** |
|
| 811 | - * Final step. |
|
| 812 | - * |
|
| 813 | - * @since 2.0.0 |
|
| 814 | - */ |
|
| 815 | - public function setup_ready() { |
|
| 816 | - $this->setup_ready_actions(); |
|
| 817 | - ?> |
|
| 795 | + } |
|
| 796 | + |
|
| 797 | + /** |
|
| 798 | + * Dummy data save. |
|
| 799 | + * |
|
| 800 | + * This is done via ajax so we just pass onto the next step. |
|
| 801 | + * |
|
| 802 | + * @since 2.0.0 |
|
| 803 | + */ |
|
| 804 | + public function setup_payments_save() { |
|
| 805 | + check_admin_referer( 'gp-setup' ); |
|
| 806 | + wp_redirect( esc_url_raw( $this->get_next_step_link() ) ); |
|
| 807 | + exit; |
|
| 808 | + } |
|
| 809 | + |
|
| 810 | + /** |
|
| 811 | + * Final step. |
|
| 812 | + * |
|
| 813 | + * @since 2.0.0 |
|
| 814 | + */ |
|
| 815 | + public function setup_ready() { |
|
| 816 | + $this->setup_ready_actions(); |
|
| 817 | + ?> |
|
| 818 | 818 | |
| 819 | 819 | <div class="text-center card-body"> |
| 820 | 820 | <h1 class="h3"><?php esc_html_e( 'Awesome, you are ready to GetPaid', 'invoicing' ); ?></h1> |
@@ -855,24 +855,24 @@ discard block |
||
| 855 | 855 | </div> |
| 856 | 856 | </div> |
| 857 | 857 | <?php |
| 858 | - } |
|
| 859 | - |
|
| 860 | - /** |
|
| 861 | - * Actions on the final step. |
|
| 862 | - * |
|
| 863 | - * @since 2.0.0 |
|
| 864 | - */ |
|
| 865 | - private function setup_ready_actions() { |
|
| 866 | - GeoDir_Admin_Notices::remove_notice( 'install' ); |
|
| 867 | - |
|
| 868 | - if ( isset( $_GET['gd_tracker_optin'] ) && isset( $_GET['gd_tracker_nonce'] ) && wp_verify_nonce( $_GET['gd_tracker_nonce'], 'gd_tracker_optin' ) ) { |
|
| 869 | - geodir_update_option( 'usage_tracking', true ); |
|
| 870 | - GeoDir_Admin_Tracker::send_tracking_data( true ); |
|
| 871 | - |
|
| 872 | - } elseif ( isset( $_GET['gd_tracker_optout'] ) && isset( $_GET['gd_tracker_nonce'] ) && wp_verify_nonce( $_GET['gd_tracker_nonce'], 'gd_tracker_optout' ) ) { |
|
| 873 | - geodir_update_option( 'usage_tracking', false ); |
|
| 874 | - } |
|
| 875 | - } |
|
| 858 | + } |
|
| 859 | + |
|
| 860 | + /** |
|
| 861 | + * Actions on the final step. |
|
| 862 | + * |
|
| 863 | + * @since 2.0.0 |
|
| 864 | + */ |
|
| 865 | + private function setup_ready_actions() { |
|
| 866 | + GeoDir_Admin_Notices::remove_notice( 'install' ); |
|
| 867 | + |
|
| 868 | + if ( isset( $_GET['gd_tracker_optin'] ) && isset( $_GET['gd_tracker_nonce'] ) && wp_verify_nonce( $_GET['gd_tracker_nonce'], 'gd_tracker_optin' ) ) { |
|
| 869 | + geodir_update_option( 'usage_tracking', true ); |
|
| 870 | + GeoDir_Admin_Tracker::send_tracking_data( true ); |
|
| 871 | + |
|
| 872 | + } elseif ( isset( $_GET['gd_tracker_optout'] ) && isset( $_GET['gd_tracker_nonce'] ) && wp_verify_nonce( $_GET['gd_tracker_nonce'], 'gd_tracker_optout' ) ) { |
|
| 873 | + geodir_update_option( 'usage_tracking', false ); |
|
| 874 | + } |
|
| 875 | + } |
|
| 876 | 876 | |
| 877 | 877 | |
| 878 | 878 | } |
@@ -10,7 +10,7 @@ discard block |
||
| 10 | 10 | * @version 2.4.0 |
| 11 | 11 | * @info GetPaid Setup Wizard. |
| 12 | 12 | */ |
| 13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 13 | +if (!defined('ABSPATH')) { |
|
| 14 | 14 | exit; |
| 15 | 15 | } |
| 16 | 16 | |
@@ -29,14 +29,14 @@ discard block |
||
| 29 | 29 | * Hook in tabs. |
| 30 | 30 | */ |
| 31 | 31 | public function __construct() { |
| 32 | - if ( apply_filters( 'getpaid_enable_setup_wizard', true ) && current_user_can( 'manage_options' ) ) { |
|
| 33 | - add_action( 'admin_menu', array( $this, 'admin_menus' ) ); |
|
| 34 | - add_action( 'current_screen', array( $this, 'setup_wizard' ) ); |
|
| 32 | + if (apply_filters('getpaid_enable_setup_wizard', true) && current_user_can('manage_options')) { |
|
| 33 | + add_action('admin_menu', array($this, 'admin_menus')); |
|
| 34 | + add_action('current_screen', array($this, 'setup_wizard')); |
|
| 35 | 35 | |
| 36 | 36 | // add default content action |
| 37 | - add_action( 'geodir_wizard_content_dummy_data', array( __CLASS__, 'content_dummy_data' ) ); |
|
| 38 | - add_action( 'geodir_wizard_content_sidebars', array( __CLASS__, 'content_sidebars' ) ); |
|
| 39 | - add_action( 'geodir_wizard_content_menus', array( __CLASS__, 'content_menus' ) ); |
|
| 37 | + add_action('geodir_wizard_content_dummy_data', array(__CLASS__, 'content_dummy_data')); |
|
| 38 | + add_action('geodir_wizard_content_sidebars', array(__CLASS__, 'content_sidebars')); |
|
| 39 | + add_action('geodir_wizard_content_menus', array(__CLASS__, 'content_menus')); |
|
| 40 | 40 | } |
| 41 | 41 | } |
| 42 | 42 | |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | * Add admin menus/screens. |
| 45 | 45 | */ |
| 46 | 46 | public function admin_menus() { |
| 47 | - add_dashboard_page( '', '', 'manage_options', 'gp-setup', '' ); |
|
| 47 | + add_dashboard_page('', '', 'manage_options', 'gp-setup', ''); |
|
| 48 | 48 | } |
| 49 | 49 | |
| 50 | 50 | /** |
@@ -53,44 +53,44 @@ discard block |
||
| 53 | 53 | * @since 2.0.0 |
| 54 | 54 | */ |
| 55 | 55 | public function setup_wizard() { |
| 56 | - if ( empty( $_GET['page'] ) || 'gp-setup' !== $_GET['page'] ) { |
|
| 56 | + if (empty($_GET['page']) || 'gp-setup' !== $_GET['page']) { |
|
| 57 | 57 | return; |
| 58 | 58 | } |
| 59 | 59 | $default_steps = array( |
| 60 | 60 | 'introduction' => array( |
| 61 | - 'name' => __( 'Introduction', 'invoicing' ), |
|
| 62 | - 'view' => array( $this, 'setup_introduction' ), |
|
| 61 | + 'name' => __('Introduction', 'invoicing'), |
|
| 62 | + 'view' => array($this, 'setup_introduction'), |
|
| 63 | 63 | 'handler' => '', |
| 64 | 64 | ), |
| 65 | 65 | 'business_details' => array( |
| 66 | - 'name' => __( "Business Details", 'invoicing' ), |
|
| 67 | - 'view' => array( $this, 'setup_business' ), |
|
| 68 | - 'handler' => array( $this, 'setup_business_save' ), |
|
| 66 | + 'name' => __("Business Details", 'invoicing'), |
|
| 67 | + 'view' => array($this, 'setup_business'), |
|
| 68 | + 'handler' => array($this, 'setup_business_save'), |
|
| 69 | 69 | ), |
| 70 | 70 | 'currency' => array( |
| 71 | - 'name' => __( 'Currency', 'invoicing' ), |
|
| 72 | - 'view' => array( $this, 'setup_currency' ), |
|
| 73 | - 'handler' => array( $this, 'setup_currency_save' ), |
|
| 71 | + 'name' => __('Currency', 'invoicing'), |
|
| 72 | + 'view' => array($this, 'setup_currency'), |
|
| 73 | + 'handler' => array($this, 'setup_currency_save'), |
|
| 74 | 74 | ), |
| 75 | 75 | 'payments' => array( |
| 76 | - 'name' => __( 'Payment Gateways', 'invoicing' ), |
|
| 77 | - 'view' => array( $this, 'setup_payments' ), |
|
| 78 | - 'handler' => array( $this, 'setup_payments_save' ), |
|
| 76 | + 'name' => __('Payment Gateways', 'invoicing'), |
|
| 77 | + 'view' => array($this, 'setup_payments'), |
|
| 78 | + 'handler' => array($this, 'setup_payments_save'), |
|
| 79 | 79 | ), |
| 80 | 80 | 'recommend' => array( |
| 81 | - 'name' => __( 'Recommend', 'invoicing' ), |
|
| 82 | - 'view' => array( $this, 'setup_recommend' ), |
|
| 83 | - 'handler' => array( $this, 'setup_recommend_save' ), |
|
| 81 | + 'name' => __('Recommend', 'invoicing'), |
|
| 82 | + 'view' => array($this, 'setup_recommend'), |
|
| 83 | + 'handler' => array($this, 'setup_recommend_save'), |
|
| 84 | 84 | ), |
| 85 | 85 | 'next_steps' => array( |
| 86 | - 'name' => __( 'Get Paid', 'invoicing' ), |
|
| 87 | - 'view' => array( $this, 'setup_ready' ), |
|
| 86 | + 'name' => __('Get Paid', 'invoicing'), |
|
| 87 | + 'view' => array($this, 'setup_ready'), |
|
| 88 | 88 | 'handler' => '', |
| 89 | 89 | ), |
| 90 | 90 | ); |
| 91 | 91 | |
| 92 | - $this->steps = apply_filters( 'getpaid_setup_wizard_steps', $default_steps ); |
|
| 93 | - $this->step = isset( $_GET['step'] ) ? sanitize_key( $_GET['step'] ) : current( array_keys( $this->steps ) ); |
|
| 92 | + $this->steps = apply_filters('getpaid_setup_wizard_steps', $default_steps); |
|
| 93 | + $this->step = isset($_GET['step']) ? sanitize_key($_GET['step']) : current(array_keys($this->steps)); |
|
| 94 | 94 | |
| 95 | 95 | |
| 96 | 96 | // enqueue the script |
@@ -128,17 +128,17 @@ discard block |
||
| 128 | 128 | <head> |
| 129 | 129 | <meta name="viewport" content="width=device-width"/> |
| 130 | 130 | <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> |
| 131 | - <title><?php esc_html_e( 'GetPaid › Setup Wizard', 'invoicing' ); ?></title> |
|
| 131 | + <title><?php esc_html_e('GetPaid › Setup Wizard', 'invoicing'); ?></title> |
|
| 132 | 132 | <?php |
| 133 | 133 | |
| 134 | - wp_register_style( 'font-awesome', 'https://use.fontawesome.com/releases/v5.13.0/css/all.css', array( ), WPINV_VERSION ); |
|
| 135 | - wp_enqueue_style( 'font-awesome' ); |
|
| 136 | - do_action( 'admin_print_styles' ); |
|
| 137 | - wp_print_styles( 'select2' ); |
|
| 138 | - wp_print_scripts( 'wpinv-admin-script' ); |
|
| 139 | - wp_print_scripts( 'select2' ); |
|
| 134 | + wp_register_style('font-awesome', 'https://use.fontawesome.com/releases/v5.13.0/css/all.css', array( ), WPINV_VERSION); |
|
| 135 | + wp_enqueue_style('font-awesome'); |
|
| 136 | + do_action('admin_print_styles'); |
|
| 137 | + wp_print_styles('select2'); |
|
| 138 | + wp_print_scripts('wpinv-admin-script'); |
|
| 139 | + wp_print_scripts('select2'); |
|
| 140 | 140 | ?> |
| 141 | - <?php do_action( 'admin_head' ); ?> |
|
| 141 | + <?php do_action('admin_head'); ?> |
|
| 142 | 142 | <style> |
| 143 | 143 | body,p{ |
| 144 | 144 | font-size: 16px; |
@@ -147,7 +147,7 @@ discard block |
||
| 147 | 147 | |
| 148 | 148 | <?php |
| 149 | 149 | $aui_settings = AyeCode_UI_Settings::instance(); |
| 150 | - echo $aui_settings::css_primary('#009874',true); |
|
| 150 | + echo $aui_settings::css_primary('#009874', true); |
|
| 151 | 151 | ?> |
| 152 | 152 | |
| 153 | 153 | |
@@ -155,9 +155,9 @@ discard block |
||
| 155 | 155 | </head> |
| 156 | 156 | <body class="gp-setup wp-core-ui bg-lightx mx-auto text-dark scrollbars-ios" style="background: #f3f6ff;"> |
| 157 | 157 | <?php |
| 158 | - if(isset($_REQUEST['step'])){ |
|
| 158 | + if (isset($_REQUEST['step'])) { |
|
| 159 | 159 | $this->setup_wizard_steps(); |
| 160 | - }else{ |
|
| 160 | + } else { |
|
| 161 | 161 | echo "<div class='mb-3'> </div>"; |
| 162 | 162 | } |
| 163 | 163 | |
@@ -165,7 +165,7 @@ discard block |
||
| 165 | 165 | <h1 class="h2 text-center pb-3"> |
| 166 | 166 | <a class=" text-decoration-none" href="https://wpgetpaid.com/"> |
| 167 | 167 | <span class="text-black-50"> |
| 168 | - <img class="ml-n3x" src="<?php echo WPINV_PLUGIN_URL . 'assets/images/getpaid-logo.png';?>" /> |
|
| 168 | + <img class="ml-n3x" src="<?php echo WPINV_PLUGIN_URL . 'assets/images/getpaid-logo.png'; ?>" /> |
|
| 169 | 169 | </span> |
| 170 | 170 | </a> |
| 171 | 171 | </h1> |
@@ -179,25 +179,25 @@ discard block |
||
| 179 | 179 | */ |
| 180 | 180 | public function setup_wizard_steps() { |
| 181 | 181 | $ouput_steps = $this->steps; |
| 182 | - array_shift( $ouput_steps ); |
|
| 182 | + array_shift($ouput_steps); |
|
| 183 | 183 | ?> |
| 184 | 184 | <ol class="gp-setup-steps mb-0 pb-4 mw-100 list-group list-group-horizontal text-center"> |
| 185 | 185 | <?php |
| 186 | 186 | $current = ''; |
| 187 | - foreach ( $ouput_steps as $step_key => $step ) : ?> |
|
| 187 | + foreach ($ouput_steps as $step_key => $step) : ?> |
|
| 188 | 188 | <li class="list-group-item flex-fill rounded-0 <?php |
| 189 | 189 | $maybe_hide = 'd-none'; |
| 190 | - if ( $step_key === $this->step ) { |
|
| 190 | + if ($step_key === $this->step) { |
|
| 191 | 191 | $current = $this->step; |
| 192 | 192 | echo 'active'; |
| 193 | 193 | $maybe_hide = ''; |
| 194 | - } elseif ( array_search( $this->step, array_keys( $this->steps ) ) > array_search( $step_key, array_keys( $this->steps ) ) ) { |
|
| 194 | + } elseif (array_search($this->step, array_keys($this->steps)) > array_search($step_key, array_keys($this->steps))) { |
|
| 195 | 195 | echo 'done '; |
| 196 | 196 | } |
| 197 | 197 | |
| 198 | - echo ' '.$maybe_hide. ' d-md-block '; |
|
| 198 | + echo ' ' . $maybe_hide . ' d-md-block '; |
|
| 199 | 199 | $done = !$current ? 'text-success' : ''; |
| 200 | - ?>"><i class="far fa-check-circle <?php echo $done ;?>"></i> <?php echo esc_html( $step['name'] ); ?></li> |
|
| 200 | + ?>"><i class="far fa-check-circle <?php echo $done; ?>"></i> <?php echo esc_html($step['name']); ?></li> |
|
| 201 | 201 | <?php endforeach; ?> |
| 202 | 202 | </ol> |
| 203 | 203 | <?php |
@@ -212,7 +212,7 @@ discard block |
||
| 212 | 212 | echo '<div class="gp-setup-content rowx mw-100 text-center mb-3">'; |
| 213 | 213 | echo '<div class="col-12 col-md-5 m-auto">'; |
| 214 | 214 | echo '<div class="card shadow-sm">'; |
| 215 | - call_user_func( $this->steps[ $this->step ]['view'], $this ); |
|
| 215 | + call_user_func($this->steps[$this->step]['view'], $this); |
|
| 216 | 216 | echo '</div>'; |
| 217 | 217 | echo '</div>'; |
| 218 | 218 | echo '</div>'; |
@@ -225,13 +225,13 @@ discard block |
||
| 225 | 225 | */ |
| 226 | 226 | public function setup_wizard_footer() { |
| 227 | 227 | ?> |
| 228 | - <?php if ( 'next_steps' === $this->step ){ ?> |
|
| 228 | + <?php if ('next_steps' === $this->step) { ?> |
|
| 229 | 229 | <p class="gd-return-to-dashboard-wrap"><a class="gd-return-to-dashboard btn btn-link d-block text-muted" |
| 230 | - href="<?php echo esc_url( admin_url() ); ?>"><?php esc_html_e( 'Return to the WordPress Dashboard', 'invoicing' ); ?></a> |
|
| 230 | + href="<?php echo esc_url(admin_url()); ?>"><?php esc_html_e('Return to the WordPress Dashboard', 'invoicing'); ?></a> |
|
| 231 | 231 | </p> |
| 232 | - <?php }else{ ?> |
|
| 233 | - <p class="gd-return-to-dashboard-wrap"><a href="<?php echo esc_url( $this->get_next_step_link() ); ?>" |
|
| 234 | - class="btn btn-link d-block text-muted"><?php esc_html_e( 'Skip this step', 'invoicing' ); ?></a></p> |
|
| 232 | + <?php } else { ?> |
|
| 233 | + <p class="gd-return-to-dashboard-wrap"><a href="<?php echo esc_url($this->get_next_step_link()); ?>" |
|
| 234 | + class="btn btn-link d-block text-muted"><?php esc_html_e('Skip this step', 'invoicing'); ?></a></p> |
|
| 235 | 235 | <?php } ?> |
| 236 | 236 | </body> |
| 237 | 237 | </html> |
@@ -245,61 +245,61 @@ discard block |
||
| 245 | 245 | */ |
| 246 | 246 | public function setup_introduction() { |
| 247 | 247 | ?> |
| 248 | - <h1 class="h4 card-header bg-white border-bottom-0 pt-4 pb-1"><?php esc_html_e( 'Welcome to GetPaid!', 'invoicing' ); ?></h1> |
|
| 248 | + <h1 class="h4 card-header bg-white border-bottom-0 pt-4 pb-1"><?php esc_html_e('Welcome to GetPaid!', 'invoicing'); ?></h1> |
|
| 249 | 249 | <div class="card-body text-muted "> |
| 250 | - <p class=""><?php _e( 'Thank you for choosing GetPaid - The most Powerful Payments Plugin for WordPress', 'invoicing' ); ?></p> |
|
| 250 | + <p class=""><?php _e('Thank you for choosing GetPaid - The most Powerful Payments Plugin for WordPress', 'invoicing'); ?></p> |
|
| 251 | 251 | <hr class="mt-4 pt-3 pb-0" /> |
| 252 | - <p class="small"><?php _e( 'This quick setup wizard will help you <b>configure the basic settings</b>. It’s <b>completely optional</b> and shouldn’t take longer than <b>five minutes<b/>.', 'invoicing' ); ?></p> |
|
| 252 | + <p class="small"><?php _e('This quick setup wizard will help you <b>configure the basic settings</b>. It’s <b>completely optional</b> and shouldn’t take longer than <b>five minutes<b/>.', 'invoicing'); ?></p> |
|
| 253 | 253 | </div> |
| 254 | 254 | <div class="card-footer mb-0 bg-white gp-setup-actions step border-top-0"> |
| 255 | - <a href="<?php echo esc_url( $this->get_next_step_link() ); ?>" |
|
| 256 | - class="btn btn-primary button-next"><?php esc_html_e( 'Let\'s go!', 'invoicing' ); ?></a> |
|
| 257 | - <a href="<?php echo esc_url( admin_url() ); ?>" |
|
| 258 | - class="btn btn-link d-block mt-2 "><?php esc_html_e( 'Not right now', 'invoicing' ); ?></a> |
|
| 255 | + <a href="<?php echo esc_url($this->get_next_step_link()); ?>" |
|
| 256 | + class="btn btn-primary button-next"><?php esc_html_e('Let\'s go!', 'invoicing'); ?></a> |
|
| 257 | + <a href="<?php echo esc_url(admin_url()); ?>" |
|
| 258 | + class="btn btn-link d-block mt-2 "><?php esc_html_e('Not right now', 'invoicing'); ?></a> |
|
| 259 | 259 | </div> |
| 260 | 260 | |
| 261 | 261 | |
| 262 | 262 | </div> |
| 263 | 263 | <div class="card shadow-sm my-5"> |
| 264 | - <h1 class="h4 card-header bg-white border-bottom-0 pt-4 pb-1"><?php esc_html_e( 'GetPaid Features & Addons!', 'invoicing' ); ?></h1> |
|
| 264 | + <h1 class="h4 card-header bg-white border-bottom-0 pt-4 pb-1"><?php esc_html_e('GetPaid Features & Addons!', 'invoicing'); ?></h1> |
|
| 265 | 265 | <div class="card-body text-muted overflow-hidden"> |
| 266 | - <p class=""><?php _e( 'Collect one time & recurring payments online within minutes. No complex setup required.', 'invoicing' ); ?></p> |
|
| 266 | + <p class=""><?php _e('Collect one time & recurring payments online within minutes. No complex setup required.', 'invoicing'); ?></p> |
|
| 267 | 267 | <hr class=""> |
| 268 | 268 | |
| 269 | 269 | <div class="row row row-cols-2 text-left"> |
| 270 | 270 | <div class="col mt-3"> |
| 271 | 271 | <div class="media"> |
| 272 | - <img src="<?php echo WPINV_PLUGIN_URL . 'assets/images/buy.svg';?>" class="mr-3" alt="..."> |
|
| 272 | + <img src="<?php echo WPINV_PLUGIN_URL . 'assets/images/buy.svg'; ?>" class="mr-3" alt="..."> |
|
| 273 | 273 | <div class="media-body"> |
| 274 | - <h6 class="mt-0 font-weight-bold"><?php _e('GetPaid via Buy Now Buttons','invoicing');?></h6> |
|
| 275 | - <small><?php _e('Sell via buy now buttons anywhere on your site','invoicing');?></small> |
|
| 274 | + <h6 class="mt-0 font-weight-bold"><?php _e('GetPaid via Buy Now Buttons', 'invoicing'); ?></h6> |
|
| 275 | + <small><?php _e('Sell via buy now buttons anywhere on your site', 'invoicing'); ?></small> |
|
| 276 | 276 | </div> |
| 277 | 277 | </div> |
| 278 | 278 | </div> |
| 279 | 279 | <div class="col mt-3"> |
| 280 | 280 | <div class="media"> |
| 281 | - <img src="<?php echo WPINV_PLUGIN_URL . 'assets/images/report.svg';?>" class="mr-3" alt="..."> |
|
| 281 | + <img src="<?php echo WPINV_PLUGIN_URL . 'assets/images/report.svg'; ?>" class="mr-3" alt="..."> |
|
| 282 | 282 | <div class="media-body"> |
| 283 | - <h6 class="mt-0 font-weight-bold"><?php _e('GetPaid via payment form','invoicing');?></h6> |
|
| 284 | - <small><?php _e('Payment forms are conversion-optimized checkout forms','invoicing');?></small> |
|
| 283 | + <h6 class="mt-0 font-weight-bold"><?php _e('GetPaid via payment form', 'invoicing'); ?></h6> |
|
| 284 | + <small><?php _e('Payment forms are conversion-optimized checkout forms', 'invoicing'); ?></small> |
|
| 285 | 285 | </div> |
| 286 | 286 | </div> |
| 287 | 287 | </div> |
| 288 | 288 | <div class="col mt-3"> |
| 289 | 289 | <div class="media"> |
| 290 | - <img src="<?php echo WPINV_PLUGIN_URL . 'assets/images/invoices.svg';?>" class="mr-3" alt="..."> |
|
| 290 | + <img src="<?php echo WPINV_PLUGIN_URL . 'assets/images/invoices.svg'; ?>" class="mr-3" alt="..."> |
|
| 291 | 291 | <div class="media-body"> |
| 292 | - <h6 class="mt-0 font-weight-bold"><?php _e('GetPaid via Invoice','invoicing');?></h6> |
|
| 293 | - <small><?php _e('Create and send invoices for just about anything from the WOrdPress dashboard','invoicing');?></small> |
|
| 292 | + <h6 class="mt-0 font-weight-bold"><?php _e('GetPaid via Invoice', 'invoicing'); ?></h6> |
|
| 293 | + <small><?php _e('Create and send invoices for just about anything from the WOrdPress dashboard', 'invoicing'); ?></small> |
|
| 294 | 294 | </div> |
| 295 | 295 | </div> |
| 296 | 296 | </div> |
| 297 | 297 | <div class="col mt-3"> |
| 298 | 298 | <div class="media"> |
| 299 | - <img src="<?php echo WPINV_PLUGIN_URL . 'assets/images/payment.svg';?>" class="mr-3" alt="..."> |
|
| 299 | + <img src="<?php echo WPINV_PLUGIN_URL . 'assets/images/payment.svg'; ?>" class="mr-3" alt="..."> |
|
| 300 | 300 | <div class="media-body"> |
| 301 | - <h6 class="mt-0 font-weight-bold"><?php _e('Affordable payment gateways','invoicing');?></h6> |
|
| 302 | - <small><?php _e('On average our gateways are over 66% cheaper than our competition','invoicing');?></small> |
|
| 301 | + <h6 class="mt-0 font-weight-bold"><?php _e('Affordable payment gateways', 'invoicing'); ?></h6> |
|
| 302 | + <small><?php _e('On average our gateways are over 66% cheaper than our competition', 'invoicing'); ?></small> |
|
| 303 | 303 | </div> |
| 304 | 304 | </div> |
| 305 | 305 | </div> |
@@ -307,10 +307,10 @@ discard block |
||
| 307 | 307 | |
| 308 | 308 | <div class="mt-5"> |
| 309 | 309 | <a href="https://wpgetpaid.com/features-list/" |
| 310 | - class="btn btn-primary"><?php esc_html_e( 'View All Features!', 'invoicing' ); ?></a> |
|
| 310 | + class="btn btn-primary"><?php esc_html_e('View All Features!', 'invoicing'); ?></a> |
|
| 311 | 311 | </div> |
| 312 | 312 | <div class="mt-5 mx-n4 py-4" style="background:#eafaf6;"> |
| 313 | - <h4 class="mt-0 font-weight-bold text-dark mb-4"><?php _e('More with Membership!','invoicing');?></h4> |
|
| 313 | + <h4 class="mt-0 font-weight-bold text-dark mb-4"><?php _e('More with Membership!', 'invoicing'); ?></h4> |
|
| 314 | 314 | <div class="row row-cols-2 text-left px-5"> |
| 315 | 315 | <div class="col"> |
| 316 | 316 | <ul class="list-unstyled"> |
@@ -329,12 +329,12 @@ discard block |
||
| 329 | 329 | </div> |
| 330 | 330 | </div> |
| 331 | 331 | |
| 332 | - <h5 class="mt-4 font-weight-bold text-dark mb-3"><?php _e('Membership Starts From','invoicing');?></h5> |
|
| 332 | + <h5 class="mt-4 font-weight-bold text-dark mb-3"><?php _e('Membership Starts From', 'invoicing'); ?></h5> |
|
| 333 | 333 | <h1 class="mt-0 font-weight-bold text-dark mb-4 display-3">$49</h1> |
| 334 | 334 | |
| 335 | 335 | <div class="mt-2"> |
| 336 | 336 | <a href="https://wpgetpaid.com/downloads/membership/" |
| 337 | - class="btn btn-primary"><?php esc_html_e( 'Buy Membership Now!', 'invoicing' ); ?></a> |
|
| 337 | + class="btn btn-primary"><?php esc_html_e('Buy Membership Now!', 'invoicing'); ?></a> |
|
| 338 | 338 | </div> |
| 339 | 339 | |
| 340 | 340 | |
@@ -342,12 +342,12 @@ discard block |
||
| 342 | 342 | |
| 343 | 343 | </div> |
| 344 | 344 | <div class="card-footer mb-0 bg-white gp-setup-actions step border-top-0"> |
| 345 | - <a href="<?php echo esc_url( $this->get_next_step_link() ); ?>" |
|
| 346 | - class="btn btn-outline-primary button-next"><?php esc_html_e( 'Launch the Setup Wizard!', 'invoicing' ); ?></a> |
|
| 345 | + <a href="<?php echo esc_url($this->get_next_step_link()); ?>" |
|
| 346 | + class="btn btn-outline-primary button-next"><?php esc_html_e('Launch the Setup Wizard!', 'invoicing'); ?></a> |
|
| 347 | 347 | <a href="https://docs.wpgetpaid.com/" |
| 348 | - class="btn btn-outline-primary ml-4"><?php esc_html_e( 'Documentation', 'invoicing' ); ?></a> |
|
| 349 | - <a href="<?php echo esc_url( admin_url() ); ?>" |
|
| 350 | - class="btn btn-link d-block mt-2 "><?php esc_html_e( 'Not right now', 'invoicing' ); ?></a> |
|
| 348 | + class="btn btn-outline-primary ml-4"><?php esc_html_e('Documentation', 'invoicing'); ?></a> |
|
| 349 | + <a href="<?php echo esc_url(admin_url()); ?>" |
|
| 350 | + class="btn btn-link d-block mt-2 "><?php esc_html_e('Not right now', 'invoicing'); ?></a> |
|
| 351 | 351 | </div> |
| 352 | 352 | <?php |
| 353 | 353 | } |
@@ -362,22 +362,22 @@ discard block |
||
| 362 | 362 | * Empty string on failure. |
| 363 | 363 | * @since 3.0.0 |
| 364 | 364 | */ |
| 365 | - public function get_next_step_link( $step = '' ) { |
|
| 366 | - if ( ! $step ) { |
|
| 365 | + public function get_next_step_link($step = '') { |
|
| 366 | + if (!$step) { |
|
| 367 | 367 | $step = $this->step; |
| 368 | 368 | } |
| 369 | 369 | |
| 370 | - $keys = array_keys( $this->steps ); |
|
| 371 | - if ( end( $keys ) === $step ) { |
|
| 370 | + $keys = array_keys($this->steps); |
|
| 371 | + if (end($keys) === $step) { |
|
| 372 | 372 | return admin_url(); |
| 373 | 373 | } |
| 374 | 374 | |
| 375 | - $step_index = array_search( $step, $keys ); |
|
| 376 | - if ( false === $step_index ) { |
|
| 375 | + $step_index = array_search($step, $keys); |
|
| 376 | + if (false === $step_index) { |
|
| 377 | 377 | return ''; |
| 378 | 378 | } |
| 379 | 379 | |
| 380 | - return remove_query_arg('settings-updated', add_query_arg( 'step', $keys[ $step_index + 1 ] )); |
|
| 380 | + return remove_query_arg('settings-updated', add_query_arg('step', $keys[$step_index + 1])); |
|
| 381 | 381 | } |
| 382 | 382 | |
| 383 | 383 | /** |
@@ -390,11 +390,11 @@ discard block |
||
| 390 | 390 | <form method="post" class="text-left card-body" action="options.php"> |
| 391 | 391 | <?php |
| 392 | 392 | |
| 393 | - settings_fields( 'wpinv_settings' ); |
|
| 393 | + settings_fields('wpinv_settings'); |
|
| 394 | 394 | |
| 395 | 395 | // override http referer to make it send back to the next step |
| 396 | 396 | ?> |
| 397 | - <input type="hidden" name="_wp_http_referer" value="<?php echo esc_url( $this->get_next_step_link() ); ?>"> |
|
| 397 | + <input type="hidden" name="_wp_http_referer" value="<?php echo esc_url($this->get_next_step_link()); ?>"> |
|
| 398 | 398 | |
| 399 | 399 | <table class="gp-setup-maps w-100 " cellspacing="0"> |
| 400 | 400 | |
@@ -406,11 +406,11 @@ discard block |
||
| 406 | 406 | |
| 407 | 407 | $page = 'wpinv_settings_general_main'; |
| 408 | 408 | $section = 'wpinv_settings_general_main'; |
| 409 | - if ( ! isset( $wp_settings_fields[ $page ][ $section ] ) ) { |
|
| 409 | + if (!isset($wp_settings_fields[$page][$section])) { |
|
| 410 | 410 | return; |
| 411 | 411 | } |
| 412 | 412 | |
| 413 | - $settings = $wp_settings_fields[ $page ][ $section ]; |
|
| 413 | + $settings = $wp_settings_fields[$page][$section]; |
|
| 414 | 414 | |
| 415 | 415 | // unset title |
| 416 | 416 | unset($settings["wpinv_settings[location_settings]"]); |
@@ -425,49 +425,49 @@ discard block |
||
| 425 | 425 | |
| 426 | 426 | <p class="gp-setup-actions step text-center mt-4"> |
| 427 | 427 | <input type="submit" class="btn btn-primary button-next" |
| 428 | - value="<?php esc_attr_e( 'Continue', 'invoicing' ); ?>" name="save_step"/> |
|
| 428 | + value="<?php esc_attr_e('Continue', 'invoicing'); ?>" name="save_step"/> |
|
| 429 | 429 | </p> |
| 430 | 430 | </form> |
| 431 | 431 | <?php |
| 432 | 432 | } |
| 433 | 433 | |
| 434 | - public function output_fields($settings){ |
|
| 434 | + public function output_fields($settings) { |
|
| 435 | 435 | |
| 436 | - if ( empty($settings)) { |
|
| 436 | + if (empty($settings)) { |
|
| 437 | 437 | return; |
| 438 | 438 | } |
| 439 | 439 | |
| 440 | 440 | //print_r($settings); |
| 441 | - foreach ( (array) $settings as $key => $field ) { |
|
| 441 | + foreach ((array) $settings as $key => $field) { |
|
| 442 | 442 | |
| 443 | 443 | |
| 444 | 444 | $class = ''; |
| 445 | 445 | |
| 446 | - if ( ! empty( $field['args']['class'] ) ) { |
|
| 447 | - $class = esc_attr( $field['args']['class'] ); |
|
| 446 | + if (!empty($field['args']['class'])) { |
|
| 447 | + $class = esc_attr($field['args']['class']); |
|
| 448 | 448 | } |
| 449 | 449 | |
| 450 | 450 | // echo '<div class="form-group '.$class.'">'; |
| 451 | 451 | |
| 452 | 452 | |
| 453 | - if ( ! empty( $field['args']['label_for'] ) ) { |
|
| 454 | - $for = ' for="' . esc_attr( $field['args']['label_for'] ) . '" '; |
|
| 453 | + if (!empty($field['args']['label_for'])) { |
|
| 454 | + $for = ' for="' . esc_attr($field['args']['label_for']) . '" '; |
|
| 455 | 455 | } else { |
| 456 | 456 | $for = ''; |
| 457 | 457 | } |
| 458 | 458 | |
| 459 | - $value = isset( $field['args']['std'] ) ? $field['args']['std'] : ''; |
|
| 460 | - $value = wpinv_get_option( $field['args']['id'], $value ); |
|
| 459 | + $value = isset($field['args']['std']) ? $field['args']['std'] : ''; |
|
| 460 | + $value = wpinv_get_option($field['args']['id'], $value); |
|
| 461 | 461 | |
| 462 | - if($field['callback'] == 'wpinv_text_callback' || $field['callback'] == 'wpinv_number_callback' ){ |
|
| 462 | + if ($field['callback'] == 'wpinv_text_callback' || $field['callback'] == 'wpinv_number_callback') { |
|
| 463 | 463 | |
| 464 | 464 | |
| 465 | 465 | // hide the logo inputs, we need to set them as hidden so they don't blank the current values. |
| 466 | 466 | $help_text = isset($field['args']['desc']) ? esc_attr($field['args']['desc']) : ''; |
| 467 | - $type = $field['callback'] == 'wpinv_number_callback' ? 'number' : 'text'; |
|
| 467 | + $type = $field['callback'] == 'wpinv_number_callback' ? 'number' : 'text'; |
|
| 468 | 468 | $label = isset($field['args']['name']) ? esc_attr($field['args']['name']) : ''; |
| 469 | 469 | |
| 470 | - if(in_array($field['id'],array('wpinv_settings[logo]','wpinv_settings[logo_width]','wpinv_settings[logo_height]'))){ |
|
| 470 | + if (in_array($field['id'], array('wpinv_settings[logo]', 'wpinv_settings[logo_width]', 'wpinv_settings[logo_height]'))) { |
|
| 471 | 471 | $type = 'hidden'; |
| 472 | 472 | $help_text = ''; |
| 473 | 473 | $label = ''; |
@@ -477,31 +477,31 @@ discard block |
||
| 477 | 477 | 'type' => $type, |
| 478 | 478 | 'id' => isset($field['args']['id']) ? esc_attr($field['args']['id']) : '', |
| 479 | 479 | 'name' => isset($field['id']) ? esc_attr($field['id']) : '', |
| 480 | - 'value' => is_scalar( $value ) ? esc_attr( $value ) : '', |
|
| 480 | + 'value' => is_scalar($value) ? esc_attr($value) : '', |
|
| 481 | 481 | 'required' => false, |
| 482 | 482 | 'help_text' => $help_text, |
| 483 | 483 | 'label' => $label, |
| 484 | 484 | 'label_type' => 'floating' |
| 485 | 485 | )); |
| 486 | - }elseif($field['callback'] == 'wpinv_select_callback' || $field['callback'] == 'wpinv_country_states_callback'){ |
|
| 486 | + }elseif ($field['callback'] == 'wpinv_select_callback' || $field['callback'] == 'wpinv_country_states_callback') { |
|
| 487 | 487 | |
| 488 | -if($field['id']=='wpinv_settings[default_state]'){ |
|
| 489 | - $country_value = wpinv_get_option( 'wpinv_settings[default_country]', 'US'); |
|
| 490 | -$options = wpinv_get_country_states($country_value);//echo $value .'###'.$country_value; |
|
| 488 | +if ($field['id'] == 'wpinv_settings[default_state]') { |
|
| 489 | + $country_value = wpinv_get_option('wpinv_settings[default_country]', 'US'); |
|
| 490 | +$options = wpinv_get_country_states($country_value); //echo $value .'###'.$country_value; |
|
| 491 | 491 | $class = 'getpaid_js_field-state'; |
| 492 | -}else{ |
|
| 492 | +} else { |
|
| 493 | 493 | $options = isset($field['args']['options']) ? $field['args']['options'] : array(); |
| 494 | 494 | $class = 'getpaid_js_field-country'; |
| 495 | 495 | } |
| 496 | 496 | |
| 497 | 497 | //print_r($options );echo '###'; |
| 498 | 498 | |
| 499 | - echo aui()->select( array( |
|
| 499 | + echo aui()->select(array( |
|
| 500 | 500 | 'id' => isset($field['args']['id']) ? esc_attr($field['args']['id']) : '', |
| 501 | 501 | 'name' => isset($field['id']) ? esc_attr($field['id']) : '', |
| 502 | 502 | 'placeholder' => '', |
| 503 | 503 | // 'title' => $site_title, |
| 504 | - 'value' => is_scalar( $value ) ? esc_attr( $value ) : '', |
|
| 504 | + 'value' => is_scalar($value) ? esc_attr($value) : '', |
|
| 505 | 505 | 'required' => false, |
| 506 | 506 | 'help_text' => isset($field['args']['desc']) ? esc_attr($field['args']['desc']) : '', |
| 507 | 507 | 'label' => isset($field['args']['name']) ? esc_attr($field['args']['name']) : '', |
@@ -510,24 +510,24 @@ discard block |
||
| 510 | 510 | 'label_type' => 'floating', |
| 511 | 511 | 'class' => $class, |
| 512 | 512 | // 'wrap_class' => isset( $field->css_class ) ? $field->css_class : '', |
| 513 | - ) ); |
|
| 514 | - }elseif($field['callback'] == 'wpinv_textarea_callback'){ |
|
| 515 | - $textarea = aui()->textarea( array( |
|
| 513 | + )); |
|
| 514 | + }elseif ($field['callback'] == 'wpinv_textarea_callback') { |
|
| 515 | + $textarea = aui()->textarea(array( |
|
| 516 | 516 | 'id' => isset($field['args']['id']) ? esc_attr($field['args']['id']) : '', |
| 517 | 517 | 'name' => isset($field['id']) ? esc_attr($field['id']) : '', |
| 518 | 518 | 'placeholder' => '', |
| 519 | 519 | // 'title' => $site_title, |
| 520 | - 'value' => is_scalar( $value ) ? esc_attr( $value ) : '', |
|
| 520 | + 'value' => is_scalar($value) ? esc_attr($value) : '', |
|
| 521 | 521 | 'required' => false, |
| 522 | 522 | 'help_text' => isset($field['args']['desc']) ? esc_attr($field['args']['desc']) : '', |
| 523 | 523 | 'label' => isset($field['args']['name']) ? esc_attr($field['args']['name']) : '', |
| 524 | 524 | 'rows' => '4', |
| 525 | 525 | 'label_type' => 'floating' |
| 526 | 526 | // 'wrap_class' => isset( $field->css_class ) ? $field->css_class : '', |
| 527 | - ) ); |
|
| 527 | + )); |
|
| 528 | 528 | |
| 529 | 529 | // bug fixed in AUI 0.1.51 for name stripping [] |
| 530 | - $textarea = str_replace(sanitize_html_class($field['args']['id']),esc_attr($field['args']['id']),$textarea ); |
|
| 530 | + $textarea = str_replace(sanitize_html_class($field['args']['id']), esc_attr($field['args']['id']), $textarea); |
|
| 531 | 531 | |
| 532 | 532 | echo $textarea; |
| 533 | 533 | } |
@@ -565,11 +565,11 @@ discard block |
||
| 565 | 565 | <?php |
| 566 | 566 | |
| 567 | 567 | |
| 568 | - settings_fields( 'wpinv_settings' ); |
|
| 568 | + settings_fields('wpinv_settings'); |
|
| 569 | 569 | |
| 570 | 570 | // override http referer to make it send back to the next step |
| 571 | 571 | ?> |
| 572 | - <input type="hidden" name="_wp_http_referer" value="<?php echo esc_url( $this->get_next_step_link() ); ?>"> |
|
| 572 | + <input type="hidden" name="_wp_http_referer" value="<?php echo esc_url($this->get_next_step_link()); ?>"> |
|
| 573 | 573 | |
| 574 | 574 | <table class="gp-setup-maps w-100 " cellspacing="0"> |
| 575 | 575 | |
@@ -581,11 +581,11 @@ discard block |
||
| 581 | 581 | |
| 582 | 582 | $page = 'wpinv_settings_general_currency_section'; |
| 583 | 583 | $section = 'wpinv_settings_general_currency_section'; |
| 584 | - if ( ! isset( $wp_settings_fields[ $page ][ $section ] ) ) { |
|
| 584 | + if (!isset($wp_settings_fields[$page][$section])) { |
|
| 585 | 585 | return; |
| 586 | 586 | } |
| 587 | 587 | |
| 588 | - $settings = $wp_settings_fields[ $page ][ $section ]; |
|
| 588 | + $settings = $wp_settings_fields[$page][$section]; |
|
| 589 | 589 | |
| 590 | 590 | // print_r($settings);exit; |
| 591 | 591 | |
@@ -599,7 +599,7 @@ discard block |
||
| 599 | 599 | |
| 600 | 600 | <p class="gp-setup-actions step text-center mt-4"> |
| 601 | 601 | <input type="submit" class="btn btn-primary" |
| 602 | - value="<?php esc_attr_e( 'Continue', 'invoicing' ); ?>" name="save_step"/> |
|
| 602 | + value="<?php esc_attr_e('Continue', 'invoicing'); ?>" name="save_step"/> |
|
| 603 | 603 | </p> |
| 604 | 604 | </form> |
| 605 | 605 | |
@@ -613,15 +613,15 @@ discard block |
||
| 613 | 613 | * @since 2.0.0 |
| 614 | 614 | */ |
| 615 | 615 | public function setup_currency_save() { |
| 616 | - check_admin_referer( 'gp-setup' ); |
|
| 616 | + check_admin_referer('gp-setup'); |
|
| 617 | 617 | |
| 618 | 618 | $generalSettings = new GeoDir_Settings_General(); |
| 619 | - $settings = $generalSettings->get_settings( 'location' ); |
|
| 620 | - GeoDir_Admin_Settings::save_fields( $settings ); |
|
| 619 | + $settings = $generalSettings->get_settings('location'); |
|
| 620 | + GeoDir_Admin_Settings::save_fields($settings); |
|
| 621 | 621 | |
| 622 | - do_action( 'geodir_setup_wizard_default_location_saved', $settings ); |
|
| 622 | + do_action('geodir_setup_wizard_default_location_saved', $settings); |
|
| 623 | 623 | |
| 624 | - wp_redirect( esc_url_raw( $this->get_next_step_link() ) ); |
|
| 624 | + wp_redirect(esc_url_raw($this->get_next_step_link())); |
|
| 625 | 625 | exit; |
| 626 | 626 | } |
| 627 | 627 | |
@@ -636,28 +636,28 @@ discard block |
||
| 636 | 636 | <form method="post" class="text-center card-body"> |
| 637 | 637 | <div class="gd-wizard-recommend"> |
| 638 | 638 | |
| 639 | - <h2 class="gd-settings-title h3 "><?php _e( "Recommend Plugins", "geodirectory" ); ?></h2> |
|
| 639 | + <h2 class="gd-settings-title h3 "><?php _e("Recommend Plugins", "geodirectory"); ?></h2> |
|
| 640 | 640 | |
| 641 | - <p><?php _e( "Below are a few of our own plugins that may help you.", "geodirectory" ); ?></p> |
|
| 641 | + <p><?php _e("Below are a few of our own plugins that may help you.", "geodirectory"); ?></p> |
|
| 642 | 642 | |
| 643 | 643 | |
| 644 | 644 | <?php |
| 645 | 645 | |
| 646 | - include_once( ABSPATH . 'wp-admin/includes/plugin-install.php' ); //for plugins_api.. |
|
| 646 | + include_once(ABSPATH . 'wp-admin/includes/plugin-install.php'); //for plugins_api.. |
|
| 647 | 647 | |
| 648 | 648 | $recommend_wp_plugins = self::get_recommend_wp_plugins(); |
| 649 | 649 | |
| 650 | 650 | // $status = install_plugin_install_status( array("slug"=>"two-factor","version"=>"")); |
| 651 | 651 | // print_r($status); |
| 652 | 652 | |
| 653 | - if ( ! empty( $recommend_wp_plugins ) ) { |
|
| 653 | + if (!empty($recommend_wp_plugins)) { |
|
| 654 | 654 | |
| 655 | 655 | ?> |
| 656 | 656 | <ul class="list-group"> |
| 657 | 657 | <?php |
| 658 | - foreach ( $recommend_wp_plugins as $plugin ) { |
|
| 659 | - $status = install_plugin_install_status( array( "slug" => $plugin['slug'], "version" => "" ) ); |
|
| 660 | - $plugin_status = isset( $status['status'] ) ? $status['status'] : ''; |
|
| 658 | + foreach ($recommend_wp_plugins as $plugin) { |
|
| 659 | + $status = install_plugin_install_status(array("slug" => $plugin['slug'], "version" => "")); |
|
| 660 | + $plugin_status = isset($status['status']) ? $status['status'] : ''; |
|
| 661 | 661 | ?> |
| 662 | 662 | <li class="list-group-item d-flex justify-content-between align-items-center flex-wrap text-left"> |
| 663 | 663 | <span class="mr-auto"><?php echo esc_attr($plugin['name']); ?></span> |
@@ -665,10 +665,10 @@ discard block |
||
| 665 | 665 | <span class="sr-only">Loading...</span> |
| 666 | 666 | </div> |
| 667 | 667 | <div class="custom-control custom-switch mr-n2"> |
| 668 | - <input type="checkbox" class="custom-control-input" <?php if( is_plugin_active( $plugin['slug'] ) ){echo "checked";} ?> onclick="if(jQuery(this).is(':checked')){}else{}"> |
|
| 668 | + <input type="checkbox" class="custom-control-input" <?php if (is_plugin_active($plugin['slug'])) {echo "checked"; } ?> onclick="if(jQuery(this).is(':checked')){}else{}"> |
|
| 669 | 669 | <label class="custom-control-label" for="ac-setting-updates"></label> |
| 670 | 670 | </div> |
| 671 | - <small class="w-100"><?php echo esc_attr($plugin['desc'] );?></small> |
|
| 671 | + <small class="w-100"><?php echo esc_attr($plugin['desc']); ?></small> |
|
| 672 | 672 | </li> |
| 673 | 673 | <?php |
| 674 | 674 | } |
@@ -687,7 +687,7 @@ discard block |
||
| 687 | 687 | </div> |
| 688 | 688 | |
| 689 | 689 | <p class="gp-setup-actions step text-center mt-4"> |
| 690 | - <a href="<?php echo esc_url( $this->get_next_step_link() ); ?>" class="btn btn-primary"><?php esc_attr_e( 'Continue', 'invoicing' ); ?></a> |
|
| 690 | + <a href="<?php echo esc_url($this->get_next_step_link()); ?>" class="btn btn-primary"><?php esc_attr_e('Continue', 'invoicing'); ?></a> |
|
| 691 | 691 | </p> |
| 692 | 692 | </form> |
| 693 | 693 | <?php |
@@ -697,25 +697,25 @@ discard block |
||
| 697 | 697 | * A list of recommended wp.org plugins. |
| 698 | 698 | * @return array |
| 699 | 699 | */ |
| 700 | - public static function get_recommend_wp_plugins(){ |
|
| 700 | + public static function get_recommend_wp_plugins() { |
|
| 701 | 701 | $plugins = array( |
| 702 | 702 | 'ayecode-connect' => array( |
| 703 | 703 | 'url' => 'https://wordpress.org/plugins/ayecode-connect/', |
| 704 | 704 | 'slug' => 'ayecode-connect', |
| 705 | 705 | 'name' => 'AyeCode Connect', |
| 706 | - 'desc' => __( 'Documentation and Support from within your WordPress admin.', 'geodirectory' ), |
|
| 706 | + 'desc' => __('Documentation and Support from within your WordPress admin.', 'geodirectory'), |
|
| 707 | 707 | ), |
| 708 | 708 | 'ninja-forms' => array( |
| 709 | 709 | 'url' => 'https://wordpress.org/plugins/invoicing-quotes/', |
| 710 | 710 | 'slug' => 'invoicing-quotes', |
| 711 | 711 | 'name' => 'Customer Quotes', |
| 712 | - 'desc' => __('Create & Send Quotes to Customers and have them accept and pay.','geodirectory'), |
|
| 712 | + 'desc' => __('Create & Send Quotes to Customers and have them accept and pay.', 'geodirectory'), |
|
| 713 | 713 | ), |
| 714 | 714 | 'userswp' => array( |
| 715 | 715 | 'url' => 'https://wordpress.org/plugins/userswp/', |
| 716 | 716 | 'slug' => 'userswp', |
| 717 | 717 | 'name' => 'UsersWP', |
| 718 | - 'desc' => __('Frontend user login and registration as well as slick profile pages.','geodirectory'), |
|
| 718 | + 'desc' => __('Frontend user login and registration as well as slick profile pages.', 'geodirectory'), |
|
| 719 | 719 | ), |
| 720 | 720 | ); |
| 721 | 721 | |
@@ -730,8 +730,8 @@ discard block |
||
| 730 | 730 | * @since 2.0.0 |
| 731 | 731 | */ |
| 732 | 732 | public function setup_recommend_save() { |
| 733 | - check_admin_referer( 'gp-setup' ); |
|
| 734 | - wp_redirect( esc_url_raw( $this->get_next_step_link() ) ); |
|
| 733 | + check_admin_referer('gp-setup'); |
|
| 734 | + wp_redirect(esc_url_raw($this->get_next_step_link())); |
|
| 735 | 735 | exit; |
| 736 | 736 | } |
| 737 | 737 | |
@@ -745,20 +745,20 @@ discard block |
||
| 745 | 745 | <form method="post" class="text-center card-body"> |
| 746 | 746 | <div class="gp-wizard-payments"> |
| 747 | 747 | |
| 748 | - <h2 class="gd-settings-title h3 "><?php _e( "Gateway Setup", "geodirectory" ); ?></h2> |
|
| 748 | + <h2 class="gd-settings-title h3 "><?php _e("Gateway Setup", "geodirectory"); ?></h2> |
|
| 749 | 749 | |
| 750 | - <p><?php _e( "Below are a few gateways that can be setup in a few seconds.", "geodirectory" ); ?><br><?php _e( "We have 20+ Gateways that can be setup later.", "geodirectory" ); ?></p> |
|
| 750 | + <p><?php _e("Below are a few gateways that can be setup in a few seconds.", "geodirectory"); ?><br><?php _e("We have 20+ Gateways that can be setup later.", "geodirectory"); ?></p> |
|
| 751 | 751 | |
| 752 | 752 | <ul class="list-group"> |
| 753 | 753 | <li class="list-group-item d-flex justify-content-between align-items-center"> |
| 754 | - <span class="mr-auto"><img src="<?php echo WPINV_PLUGIN_URL . 'assets/images/stripe-verified.svg';?>" class="ml-n2" alt="Stripe"></span> |
|
| 754 | + <span class="mr-auto"><img src="<?php echo WPINV_PLUGIN_URL . 'assets/images/stripe-verified.svg'; ?>" class="ml-n2" alt="Stripe"></span> |
|
| 755 | 755 | <div class="spinner-border spinner-border-sm mr-2 d-none text-muted" role="status"> |
| 756 | 756 | <span class="sr-only">Loading...</span> |
| 757 | 757 | </div> |
| 758 | 758 | <span class="btn btn-sm btn-outline-primary">Connect</span> |
| 759 | 759 | </li> |
| 760 | 760 | <li class="list-group-item d-flex justify-content-between align-items-center"> |
| 761 | - <span class="mr-auto"><img src="<?php echo WPINV_PLUGIN_URL . 'assets/images/pp-logo-150px.webp';?>" class="" alt="PayPal" height="25"></span> |
|
| 761 | + <span class="mr-auto"><img src="<?php echo WPINV_PLUGIN_URL . 'assets/images/pp-logo-150px.webp'; ?>" class="" alt="PayPal" height="25"></span> |
|
| 762 | 762 | <div class="spinner-border spinner-border-sm mr-2 d-none text-muted" role="status"> |
| 763 | 763 | <span class="sr-only">Loading...</span> |
| 764 | 764 | </div> |
@@ -788,7 +788,7 @@ discard block |
||
| 788 | 788 | </div> |
| 789 | 789 | |
| 790 | 790 | <p class="gp-setup-actions step text-center mt-4"> |
| 791 | - <a href="<?php echo esc_url( $this->get_next_step_link() ); ?>" class="btn btn-primary"><?php esc_attr_e( 'Continue', 'invoicing' ); ?></a> |
|
| 791 | + <a href="<?php echo esc_url($this->get_next_step_link()); ?>" class="btn btn-primary"><?php esc_attr_e('Continue', 'invoicing'); ?></a> |
|
| 792 | 792 | </p> |
| 793 | 793 | </form> |
| 794 | 794 | <?php |
@@ -802,8 +802,8 @@ discard block |
||
| 802 | 802 | * @since 2.0.0 |
| 803 | 803 | */ |
| 804 | 804 | public function setup_payments_save() { |
| 805 | - check_admin_referer( 'gp-setup' ); |
|
| 806 | - wp_redirect( esc_url_raw( $this->get_next_step_link() ) ); |
|
| 805 | + check_admin_referer('gp-setup'); |
|
| 806 | + wp_redirect(esc_url_raw($this->get_next_step_link())); |
|
| 807 | 807 | exit; |
| 808 | 808 | } |
| 809 | 809 | |
@@ -817,40 +817,40 @@ discard block |
||
| 817 | 817 | ?> |
| 818 | 818 | |
| 819 | 819 | <div class="text-center card-body"> |
| 820 | - <h1 class="h3"><?php esc_html_e( 'Awesome, you are ready to GetPaid', 'invoicing' ); ?></h1> |
|
| 820 | + <h1 class="h3"><?php esc_html_e('Awesome, you are ready to GetPaid', 'invoicing'); ?></h1> |
|
| 821 | 821 | |
| 822 | 822 | |
| 823 | 823 | <div class="geodirectory-message geodirectory-tracker"> |
| 824 | - <p><?php _e( 'Thank you for choosing GetPaid!', 'invoicing' ); ?> <i class="far fa-smile-beam"></i></p> |
|
| 824 | + <p><?php _e('Thank you for choosing GetPaid!', 'invoicing'); ?> <i class="far fa-smile-beam"></i></p> |
|
| 825 | 825 | </div> |
| 826 | 826 | |
| 827 | 827 | <div class="gp-setup-next-steps"> |
| 828 | 828 | <div class="gp-setup-next-steps-first mb-4"> |
| 829 | - <h2 class="h3"><?php esc_html_e( 'Next steps', 'invoicing' ); ?></h2> |
|
| 829 | + <h2 class="h3"><?php esc_html_e('Next steps', 'invoicing'); ?></h2> |
|
| 830 | 830 | <a class="btn btn-primary btn-sm" |
| 831 | - href="<?php echo esc_url( admin_url( 'post-new.php?post_type=wpi_item' ) ); ?>"><?php esc_html_e( 'Create your first Item!', 'invoicing' ); ?></a> |
|
| 831 | + href="<?php echo esc_url(admin_url('post-new.php?post_type=wpi_item')); ?>"><?php esc_html_e('Create your first Item!', 'invoicing'); ?></a> |
|
| 832 | 832 | </div> |
| 833 | 833 | <div class="gp-setup-next-steps-first mb-4"> |
| 834 | - <h2 class="h3"><?php esc_html_e( 'Examples', 'invoicing' ); ?></h2> |
|
| 834 | + <h2 class="h3"><?php esc_html_e('Examples', 'invoicing'); ?></h2> |
|
| 835 | 835 | <a class="btn btn-primary btn-sm" |
| 836 | - target="_blank" href="https://demos.ayecode.io/getpaid/"><?php esc_html_e( "View What's Possible", 'invoicing' ); ?></a> |
|
| 836 | + target="_blank" href="https://demos.ayecode.io/getpaid/"><?php esc_html_e("View What's Possible", 'invoicing'); ?></a> |
|
| 837 | 837 | |
| 838 | 838 | <a class="btn btn-outline-primary btn-sm" |
| 839 | - target="_blank" href="https://demos.ayecode.io/getpaid/"><?php esc_html_e( "View What's Possible", 'invoicing' ); ?></a> |
|
| 839 | + target="_blank" href="https://demos.ayecode.io/getpaid/"><?php esc_html_e("View What's Possible", 'invoicing'); ?></a> |
|
| 840 | 840 | </div> |
| 841 | 841 | <div class="gp-setup-next-steps-last"> |
| 842 | - <h2 class="h3"><?php _e( 'Learn more', 'invoicing' ); ?></h2> |
|
| 842 | + <h2 class="h3"><?php _e('Learn more', 'invoicing'); ?></h2> |
|
| 843 | 843 | <a class="btn btn-outline-primary btn-sm" href="https://docs.wpgetpaid.com/collection/114-getting-started?utm_source=setupwizard&utm_medium=product&utm_content=getting-started&utm_campaign=invoicingplugin" |
| 844 | - target="_blank"><?php esc_html_e( 'Getting Started', 'invoicing' ); ?></a> |
|
| 844 | + target="_blank"><?php esc_html_e('Getting Started', 'invoicing'); ?></a> |
|
| 845 | 845 | <a class="btn btn-outline-primary btn-sm" |
| 846 | 846 | href="https://docs.wpgetpaid.com/?utm_source=setupwizard&utm_medium=product&utm_content=docs&utm_campaign=invoicingplugin" |
| 847 | - target="_blank"><?php esc_html_e( 'Documentation', 'invoicing' ); ?></a> |
|
| 847 | + target="_blank"><?php esc_html_e('Documentation', 'invoicing'); ?></a> |
|
| 848 | 848 | <a class="btn btn-outline-primary btn-sm" |
| 849 | 849 | href="https://wpgetpaid.com/support/?utm_source=setupwizard&utm_medium=product&utm_content=docs&utm_campaign=invoicingyplugin" |
| 850 | - target="_blank"><?php esc_html_e( 'Support', 'invoicing' ); ?></a> |
|
| 850 | + target="_blank"><?php esc_html_e('Support', 'invoicing'); ?></a> |
|
| 851 | 851 | <a class="btn btn-outline-primary btn-sm" |
| 852 | 852 | href="https://demos.ayecode.io/getpaid/?utm_source=setupwizard&utm_medium=product&utm_content=demos&utm_campaign=invoicingyplugin" |
| 853 | - target="_blank"><?php esc_html_e( 'Demos', 'invoicing' ); ?></a> |
|
| 853 | + target="_blank"><?php esc_html_e('Demos', 'invoicing'); ?></a> |
|
| 854 | 854 | </div> |
| 855 | 855 | </div> |
| 856 | 856 | </div> |
@@ -863,14 +863,14 @@ discard block |
||
| 863 | 863 | * @since 2.0.0 |
| 864 | 864 | */ |
| 865 | 865 | private function setup_ready_actions() { |
| 866 | - GeoDir_Admin_Notices::remove_notice( 'install' ); |
|
| 866 | + GeoDir_Admin_Notices::remove_notice('install'); |
|
| 867 | 867 | |
| 868 | - if ( isset( $_GET['gd_tracker_optin'] ) && isset( $_GET['gd_tracker_nonce'] ) && wp_verify_nonce( $_GET['gd_tracker_nonce'], 'gd_tracker_optin' ) ) { |
|
| 869 | - geodir_update_option( 'usage_tracking', true ); |
|
| 870 | - GeoDir_Admin_Tracker::send_tracking_data( true ); |
|
| 868 | + if (isset($_GET['gd_tracker_optin']) && isset($_GET['gd_tracker_nonce']) && wp_verify_nonce($_GET['gd_tracker_nonce'], 'gd_tracker_optin')) { |
|
| 869 | + geodir_update_option('usage_tracking', true); |
|
| 870 | + GeoDir_Admin_Tracker::send_tracking_data(true); |
|
| 871 | 871 | |
| 872 | - } elseif ( isset( $_GET['gd_tracker_optout'] ) && isset( $_GET['gd_tracker_nonce'] ) && wp_verify_nonce( $_GET['gd_tracker_nonce'], 'gd_tracker_optout' ) ) { |
|
| 873 | - geodir_update_option( 'usage_tracking', false ); |
|
| 872 | + } elseif (isset($_GET['gd_tracker_optout']) && isset($_GET['gd_tracker_nonce']) && wp_verify_nonce($_GET['gd_tracker_nonce'], 'gd_tracker_optout')) { |
|
| 873 | + geodir_update_option('usage_tracking', false); |
|
| 874 | 874 | } |
| 875 | 875 | } |
| 876 | 876 | |
@@ -157,7 +157,7 @@ discard block |
||
| 157 | 157 | <?php |
| 158 | 158 | if(isset($_REQUEST['step'])){ |
| 159 | 159 | $this->setup_wizard_steps(); |
| 160 | - }else{ |
|
| 160 | + } else{ |
|
| 161 | 161 | echo "<div class='mb-3'> </div>"; |
| 162 | 162 | } |
| 163 | 163 | |
@@ -229,7 +229,7 @@ discard block |
||
| 229 | 229 | <p class="gd-return-to-dashboard-wrap"><a class="gd-return-to-dashboard btn btn-link d-block text-muted" |
| 230 | 230 | href="<?php echo esc_url( admin_url() ); ?>"><?php esc_html_e( 'Return to the WordPress Dashboard', 'invoicing' ); ?></a> |
| 231 | 231 | </p> |
| 232 | - <?php }else{ ?> |
|
| 232 | + <?php } else{ ?> |
|
| 233 | 233 | <p class="gd-return-to-dashboard-wrap"><a href="<?php echo esc_url( $this->get_next_step_link() ); ?>" |
| 234 | 234 | class="btn btn-link d-block text-muted"><?php esc_html_e( 'Skip this step', 'invoicing' ); ?></a></p> |
| 235 | 235 | <?php } ?> |
@@ -483,13 +483,13 @@ discard block |
||
| 483 | 483 | 'label' => $label, |
| 484 | 484 | 'label_type' => 'floating' |
| 485 | 485 | )); |
| 486 | - }elseif($field['callback'] == 'wpinv_select_callback' || $field['callback'] == 'wpinv_country_states_callback'){ |
|
| 486 | + } elseif($field['callback'] == 'wpinv_select_callback' || $field['callback'] == 'wpinv_country_states_callback'){ |
|
| 487 | 487 | |
| 488 | 488 | if($field['id']=='wpinv_settings[default_state]'){ |
| 489 | 489 | $country_value = wpinv_get_option( 'wpinv_settings[default_country]', 'US'); |
| 490 | 490 | $options = wpinv_get_country_states($country_value);//echo $value .'###'.$country_value; |
| 491 | 491 | $class = 'getpaid_js_field-state'; |
| 492 | -}else{ |
|
| 492 | +} else{ |
|
| 493 | 493 | $options = isset($field['args']['options']) ? $field['args']['options'] : array(); |
| 494 | 494 | $class = 'getpaid_js_field-country'; |
| 495 | 495 | } |
@@ -511,7 +511,7 @@ discard block |
||
| 511 | 511 | 'class' => $class, |
| 512 | 512 | // 'wrap_class' => isset( $field->css_class ) ? $field->css_class : '', |
| 513 | 513 | ) ); |
| 514 | - }elseif($field['callback'] == 'wpinv_textarea_callback'){ |
|
| 514 | + } elseif($field['callback'] == 'wpinv_textarea_callback'){ |
|
| 515 | 515 | $textarea = aui()->textarea( array( |
| 516 | 516 | 'id' => isset($field['args']['id']) ? esc_attr($field['args']['id']) : '', |
| 517 | 517 | 'name' => isset($field['id']) ? esc_attr($field['id']) : '', |
@@ -4,7 +4,7 @@ discard block |
||
| 4 | 4 | * |
| 5 | 5 | */ |
| 6 | 6 | |
| 7 | -defined( 'ABSPATH' ) || exit; |
|
| 7 | +defined('ABSPATH') || exit; |
|
| 8 | 8 | |
| 9 | 9 | /** |
| 10 | 10 | * The main admin class. |
@@ -37,13 +37,13 @@ discard block |
||
| 37 | 37 | /** |
| 38 | 38 | * Class constructor. |
| 39 | 39 | */ |
| 40 | - public function __construct(){ |
|
| 40 | + public function __construct() { |
|
| 41 | 41 | |
| 42 | - $this->admin_path = plugin_dir_path( __FILE__ ); |
|
| 43 | - $this->admin_url = plugins_url( '/', __FILE__ ); |
|
| 42 | + $this->admin_path = plugin_dir_path(__FILE__); |
|
| 43 | + $this->admin_url = plugins_url('/', __FILE__); |
|
| 44 | 44 | $this->reports = new GetPaid_Reports(); |
| 45 | 45 | |
| 46 | - if ( is_admin() ) { |
|
| 46 | + if (is_admin()) { |
|
| 47 | 47 | $this->init_admin_hooks(); |
| 48 | 48 | } |
| 49 | 49 | |
@@ -54,29 +54,29 @@ discard block |
||
| 54 | 54 | * |
| 55 | 55 | */ |
| 56 | 56 | private function init_admin_hooks() { |
| 57 | - add_action( 'admin_enqueue_scripts', array( $this, 'enqeue_scripts' ) ); |
|
| 58 | - add_filter( 'admin_body_class', array( $this, 'admin_body_class' ) ); |
|
| 59 | - add_action( 'admin_init', array( $this, 'init_ayecode_connect_helper' ) ); |
|
| 60 | - add_action( 'admin_init', array( $this, 'activation_redirect') ); |
|
| 61 | - add_action( 'admin_init', array( $this, 'maybe_do_admin_action') ); |
|
| 62 | - add_action( 'admin_notices', array( $this, 'show_notices' ) ); |
|
| 63 | - add_action( 'getpaid_authenticated_admin_action_rate_plugin', array( $this, 'redirect_to_wordpress_rating_page' ) ); |
|
| 64 | - add_action( 'getpaid_authenticated_admin_action_send_invoice', array( $this, 'send_customer_invoice' ) ); |
|
| 65 | - add_action( 'getpaid_authenticated_admin_action_send_invoice_reminder', array( $this, 'send_customer_payment_reminder' ) ); |
|
| 66 | - add_action( 'getpaid_authenticated_admin_action_reset_tax_rates', array( $this, 'admin_reset_tax_rates' ) ); |
|
| 67 | - add_action( 'getpaid_authenticated_admin_action_create_missing_pages', array( $this, 'admin_create_missing_pages' ) ); |
|
| 68 | - add_action( 'getpaid_authenticated_admin_action_create_missing_tables', array( $this, 'admin_create_missing_tables' ) ); |
|
| 69 | - add_action( 'getpaid_authenticated_admin_action_migrate_old_invoices', array( $this, 'admin_migrate_old_invoices' ) ); |
|
| 70 | - add_action( 'getpaid_authenticated_admin_action_download_customers', array( $this, 'admin_download_customers' ) ); |
|
| 71 | - add_action( 'getpaid_authenticated_admin_action_recalculate_discounts', array( $this, 'admin_recalculate_discounts' ) ); |
|
| 72 | - add_filter( 'admin_footer_text', array( $this, 'admin_footer_text' ) ); |
|
| 73 | - do_action( 'getpaid_init_admin_hooks', $this ); |
|
| 57 | + add_action('admin_enqueue_scripts', array($this, 'enqeue_scripts')); |
|
| 58 | + add_filter('admin_body_class', array($this, 'admin_body_class')); |
|
| 59 | + add_action('admin_init', array($this, 'init_ayecode_connect_helper')); |
|
| 60 | + add_action('admin_init', array($this, 'activation_redirect')); |
|
| 61 | + add_action('admin_init', array($this, 'maybe_do_admin_action')); |
|
| 62 | + add_action('admin_notices', array($this, 'show_notices')); |
|
| 63 | + add_action('getpaid_authenticated_admin_action_rate_plugin', array($this, 'redirect_to_wordpress_rating_page')); |
|
| 64 | + add_action('getpaid_authenticated_admin_action_send_invoice', array($this, 'send_customer_invoice')); |
|
| 65 | + add_action('getpaid_authenticated_admin_action_send_invoice_reminder', array($this, 'send_customer_payment_reminder')); |
|
| 66 | + add_action('getpaid_authenticated_admin_action_reset_tax_rates', array($this, 'admin_reset_tax_rates')); |
|
| 67 | + add_action('getpaid_authenticated_admin_action_create_missing_pages', array($this, 'admin_create_missing_pages')); |
|
| 68 | + add_action('getpaid_authenticated_admin_action_create_missing_tables', array($this, 'admin_create_missing_tables')); |
|
| 69 | + add_action('getpaid_authenticated_admin_action_migrate_old_invoices', array($this, 'admin_migrate_old_invoices')); |
|
| 70 | + add_action('getpaid_authenticated_admin_action_download_customers', array($this, 'admin_download_customers')); |
|
| 71 | + add_action('getpaid_authenticated_admin_action_recalculate_discounts', array($this, 'admin_recalculate_discounts')); |
|
| 72 | + add_filter('admin_footer_text', array($this, 'admin_footer_text')); |
|
| 73 | + do_action('getpaid_init_admin_hooks', $this); |
|
| 74 | 74 | |
| 75 | 75 | // Setup/welcome |
| 76 | - if ( ! empty( $_GET['page'] ) ) { |
|
| 77 | - switch ( $_GET['page'] ) { |
|
| 76 | + if (!empty($_GET['page'])) { |
|
| 77 | + switch ($_GET['page']) { |
|
| 78 | 78 | case 'gp-setup' : |
| 79 | - include_once( dirname( __FILE__ ) . '/class-getpaid-admin-setup-wizard.php' ); |
|
| 79 | + include_once(dirname(__FILE__) . '/class-getpaid-admin-setup-wizard.php'); |
|
| 80 | 80 | break; |
| 81 | 81 | } |
| 82 | 82 | } |
@@ -90,37 +90,37 @@ discard block |
||
| 90 | 90 | public function enqeue_scripts() { |
| 91 | 91 | global $current_screen, $pagenow; |
| 92 | 92 | |
| 93 | - $page = isset( $_GET['page'] ) ? $_GET['page'] : ''; |
|
| 93 | + $page = isset($_GET['page']) ? $_GET['page'] : ''; |
|
| 94 | 94 | $editing = $pagenow == 'post.php' || $pagenow == 'post-new.php'; |
| 95 | 95 | |
| 96 | - if ( ! empty( $current_screen->post_type ) ) { |
|
| 96 | + if (!empty($current_screen->post_type)) { |
|
| 97 | 97 | $page = $current_screen->post_type; |
| 98 | 98 | } |
| 99 | 99 | |
| 100 | 100 | // General styles. |
| 101 | - if ( false !== stripos( $page, 'wpi' ) || 'gp-setup' == $page ) { |
|
| 101 | + if (false !== stripos($page, 'wpi') || 'gp-setup' == $page) { |
|
| 102 | 102 | |
| 103 | 103 | // Styles. |
| 104 | - $version = filemtime( WPINV_PLUGIN_DIR . 'assets/css/admin.css' ); |
|
| 105 | - wp_enqueue_style( 'wpinv_admin_style', WPINV_PLUGIN_URL . 'assets/css/admin.css', array( 'wp-color-picker' ), $version ); |
|
| 106 | - wp_enqueue_style( 'select2', WPINV_PLUGIN_URL . 'assets/css/select2/select2.min.css', array(), '4.0.13', 'all' ); |
|
| 104 | + $version = filemtime(WPINV_PLUGIN_DIR . 'assets/css/admin.css'); |
|
| 105 | + wp_enqueue_style('wpinv_admin_style', WPINV_PLUGIN_URL . 'assets/css/admin.css', array('wp-color-picker'), $version); |
|
| 106 | + wp_enqueue_style('select2', WPINV_PLUGIN_URL . 'assets/css/select2/select2.min.css', array(), '4.0.13', 'all'); |
|
| 107 | 107 | |
| 108 | 108 | // Scripts. |
| 109 | - wp_enqueue_script('select2', WPINV_PLUGIN_URL . 'assets/js/select2/select2.full.min.js', array( 'jquery' ), WPINV_VERSION ); |
|
| 109 | + wp_enqueue_script('select2', WPINV_PLUGIN_URL . 'assets/js/select2/select2.full.min.js', array('jquery'), WPINV_VERSION); |
|
| 110 | 110 | |
| 111 | - $version = filemtime( WPINV_PLUGIN_DIR . 'assets/js/admin.js' ); |
|
| 112 | - wp_enqueue_script( 'wpinv-admin-script', WPINV_PLUGIN_URL . 'assets/js/admin.js', array( 'jquery', 'wp-color-picker' ), $version ); |
|
| 113 | - wp_localize_script( 'wpinv-admin-script', 'WPInv_Admin', apply_filters( 'wpinv_admin_js_localize', $this->get_admin_i18() ) ); |
|
| 111 | + $version = filemtime(WPINV_PLUGIN_DIR . 'assets/js/admin.js'); |
|
| 112 | + wp_enqueue_script('wpinv-admin-script', WPINV_PLUGIN_URL . 'assets/js/admin.js', array('jquery', 'wp-color-picker'), $version); |
|
| 113 | + wp_localize_script('wpinv-admin-script', 'WPInv_Admin', apply_filters('wpinv_admin_js_localize', $this->get_admin_i18())); |
|
| 114 | 114 | |
| 115 | 115 | } |
| 116 | 116 | |
| 117 | 117 | // Payment form scripts. |
| 118 | - if ( 'wpi_payment_form' == $page && $editing ) { |
|
| 118 | + if ('wpi_payment_form' == $page && $editing) { |
|
| 119 | 119 | $this->load_payment_form_scripts(); |
| 120 | 120 | } |
| 121 | 121 | |
| 122 | - if ( $page == 'wpinv-subscriptions' ) { |
|
| 123 | - wp_enqueue_script( 'postbox' ); |
|
| 122 | + if ($page == 'wpinv-subscriptions') { |
|
| 123 | + wp_enqueue_script('postbox'); |
|
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | } |
@@ -133,32 +133,32 @@ discard block |
||
| 133 | 133 | global $post; |
| 134 | 134 | |
| 135 | 135 | $date_range = array( |
| 136 | - 'period' => isset( $_GET['date_range'] ) ? sanitize_text_field( $_GET['date_range'] ) : '7_days' |
|
| 136 | + 'period' => isset($_GET['date_range']) ? sanitize_text_field($_GET['date_range']) : '7_days' |
|
| 137 | 137 | ); |
| 138 | 138 | |
| 139 | - if ( $date_range['period'] == 'custom' ) { |
|
| 139 | + if ($date_range['period'] == 'custom') { |
|
| 140 | 140 | |
| 141 | - if ( isset( $_GET['from'] ) ) { |
|
| 142 | - $date_range[ 'after' ] = date( 'Y-m-d', strtotime( sanitize_text_field( $_GET['from'] ), current_time( 'timestamp' ) ) - DAY_IN_SECONDS ); |
|
| 141 | + if (isset($_GET['from'])) { |
|
| 142 | + $date_range['after'] = date('Y-m-d', strtotime(sanitize_text_field($_GET['from']), current_time('timestamp')) - DAY_IN_SECONDS); |
|
| 143 | 143 | } |
| 144 | 144 | |
| 145 | - if ( isset( $_GET['to'] ) ) { |
|
| 146 | - $date_range[ 'before' ] = date( 'Y-m-d', strtotime( sanitize_text_field( $_GET['to'] ), current_time( 'timestamp' ) ) + DAY_IN_SECONDS ); |
|
| 145 | + if (isset($_GET['to'])) { |
|
| 146 | + $date_range['before'] = date('Y-m-d', strtotime(sanitize_text_field($_GET['to']), current_time('timestamp')) + DAY_IN_SECONDS); |
|
| 147 | 147 | } |
| 148 | 148 | |
| 149 | 149 | } |
| 150 | 150 | |
| 151 | 151 | $i18n = array( |
| 152 | - 'ajax_url' => admin_url( 'admin-ajax.php' ), |
|
| 153 | - 'post_ID' => isset( $post->ID ) ? $post->ID : '', |
|
| 154 | - 'wpinv_nonce' => wp_create_nonce( 'wpinv-nonce' ), |
|
| 155 | - 'rest_nonce' => wp_create_nonce( 'wp_rest' ), |
|
| 156 | - 'rest_root' => esc_url_raw( rest_url() ), |
|
| 152 | + 'ajax_url' => admin_url('admin-ajax.php'), |
|
| 153 | + 'post_ID' => isset($post->ID) ? $post->ID : '', |
|
| 154 | + 'wpinv_nonce' => wp_create_nonce('wpinv-nonce'), |
|
| 155 | + 'rest_nonce' => wp_create_nonce('wp_rest'), |
|
| 156 | + 'rest_root' => esc_url_raw(rest_url()), |
|
| 157 | 157 | 'date_range' => $date_range, |
| 158 | - 'add_invoice_note_nonce' => wp_create_nonce( 'add-invoice-note' ), |
|
| 159 | - 'delete_invoice_note_nonce' => wp_create_nonce( 'delete-invoice-note' ), |
|
| 160 | - 'invoice_item_nonce' => wp_create_nonce( 'invoice-item' ), |
|
| 161 | - 'billing_details_nonce' => wp_create_nonce( 'get-billing-details' ), |
|
| 158 | + 'add_invoice_note_nonce' => wp_create_nonce('add-invoice-note'), |
|
| 159 | + 'delete_invoice_note_nonce' => wp_create_nonce('delete-invoice-note'), |
|
| 160 | + 'invoice_item_nonce' => wp_create_nonce('invoice-item'), |
|
| 161 | + 'billing_details_nonce' => wp_create_nonce('get-billing-details'), |
|
| 162 | 162 | 'tax' => wpinv_tax_amount(), |
| 163 | 163 | 'discount' => 0, |
| 164 | 164 | 'currency_symbol' => wpinv_currency_symbol(), |
@@ -167,38 +167,38 @@ discard block |
||
| 167 | 167 | 'thousand_sep' => wpinv_thousands_separator(), |
| 168 | 168 | 'decimal_sep' => wpinv_decimal_separator(), |
| 169 | 169 | 'decimals' => wpinv_decimals(), |
| 170 | - 'save_invoice' => __( 'Save Invoice', 'invoicing' ), |
|
| 171 | - 'status_publish' => wpinv_status_nicename( 'publish' ), |
|
| 172 | - 'status_pending' => wpinv_status_nicename( 'wpi-pending' ), |
|
| 173 | - 'delete_tax_rate' => __( 'Are you sure you wish to delete this tax rate?', 'invoicing' ), |
|
| 174 | - 'status_pending' => wpinv_status_nicename( 'wpi-pending' ), |
|
| 175 | - 'FillBillingDetails' => __( 'Fill the user\'s billing information? This will remove any currently entered billing information', 'invoicing' ), |
|
| 176 | - 'confirmCalcTotals' => __( 'Recalculate totals? This will recalculate totals based on the user billing country. If no billing country is set it will use the base country.', 'invoicing' ), |
|
| 177 | - 'AreYouSure' => __( 'Are you sure?', 'invoicing' ), |
|
| 178 | - 'errDeleteItem' => __( 'This item is in use! Before delete this item, you need to delete all the invoice(s) using this item.', 'invoicing' ), |
|
| 179 | - 'delete_subscription' => __( 'Are you sure you want to delete this subscription?', 'invoicing' ), |
|
| 180 | - 'action_edit' => __( 'Edit', 'invoicing' ), |
|
| 181 | - 'action_cancel' => __( 'Cancel', 'invoicing' ), |
|
| 182 | - 'item_description' => __( 'Item Description', 'invoicing' ), |
|
| 183 | - 'invoice_description' => __( 'Invoice Description', 'invoicing' ), |
|
| 184 | - 'discount_description' => __( 'Discount Description', 'invoicing' ), |
|
| 185 | - 'searching' => __( 'Searching', 'invoicing' ), |
|
| 186 | - 'loading' => __( 'Loading...', 'invoicing' ), |
|
| 187 | - 'search_customers' => __( 'Enter customer name or email', 'invoicing' ), |
|
| 188 | - 'search_items' => __( 'Enter item name', 'invoicing' ), |
|
| 170 | + 'save_invoice' => __('Save Invoice', 'invoicing'), |
|
| 171 | + 'status_publish' => wpinv_status_nicename('publish'), |
|
| 172 | + 'status_pending' => wpinv_status_nicename('wpi-pending'), |
|
| 173 | + 'delete_tax_rate' => __('Are you sure you wish to delete this tax rate?', 'invoicing'), |
|
| 174 | + 'status_pending' => wpinv_status_nicename('wpi-pending'), |
|
| 175 | + 'FillBillingDetails' => __('Fill the user\'s billing information? This will remove any currently entered billing information', 'invoicing'), |
|
| 176 | + 'confirmCalcTotals' => __('Recalculate totals? This will recalculate totals based on the user billing country. If no billing country is set it will use the base country.', 'invoicing'), |
|
| 177 | + 'AreYouSure' => __('Are you sure?', 'invoicing'), |
|
| 178 | + 'errDeleteItem' => __('This item is in use! Before delete this item, you need to delete all the invoice(s) using this item.', 'invoicing'), |
|
| 179 | + 'delete_subscription' => __('Are you sure you want to delete this subscription?', 'invoicing'), |
|
| 180 | + 'action_edit' => __('Edit', 'invoicing'), |
|
| 181 | + 'action_cancel' => __('Cancel', 'invoicing'), |
|
| 182 | + 'item_description' => __('Item Description', 'invoicing'), |
|
| 183 | + 'invoice_description' => __('Invoice Description', 'invoicing'), |
|
| 184 | + 'discount_description' => __('Discount Description', 'invoicing'), |
|
| 185 | + 'searching' => __('Searching', 'invoicing'), |
|
| 186 | + 'loading' => __('Loading...', 'invoicing'), |
|
| 187 | + 'search_customers' => __('Enter customer name or email', 'invoicing'), |
|
| 188 | + 'search_items' => __('Enter item name', 'invoicing'), |
|
| 189 | 189 | ); |
| 190 | 190 | |
| 191 | - if ( ! empty( $post ) && getpaid_is_invoice_post_type( $post->post_type ) ) { |
|
| 191 | + if (!empty($post) && getpaid_is_invoice_post_type($post->post_type)) { |
|
| 192 | 192 | |
| 193 | - $invoice = new WPInv_Invoice( $post ); |
|
| 193 | + $invoice = new WPInv_Invoice($post); |
|
| 194 | 194 | $i18n['save_invoice'] = sprintf( |
| 195 | - __( 'Save %s', 'invoicing' ), |
|
| 196 | - ucfirst( $invoice->get_invoice_quote_type() ) |
|
| 195 | + __('Save %s', 'invoicing'), |
|
| 196 | + ucfirst($invoice->get_invoice_quote_type()) |
|
| 197 | 197 | ); |
| 198 | 198 | |
| 199 | 199 | $i18n['invoice_description'] = sprintf( |
| 200 | - __( '%s Description', 'invoicing' ), |
|
| 201 | - ucfirst( $invoice->get_invoice_quote_type() ) |
|
| 200 | + __('%s Description', 'invoicing'), |
|
| 201 | + ucfirst($invoice->get_invoice_quote_type()) |
|
| 202 | 202 | ); |
| 203 | 203 | |
| 204 | 204 | } |
@@ -212,24 +212,24 @@ discard block |
||
| 212 | 212 | * @param string $footer_text |
| 213 | 213 | * @return string |
| 214 | 214 | */ |
| 215 | - public function admin_footer_text( $footer_text ) { |
|
| 215 | + public function admin_footer_text($footer_text) { |
|
| 216 | 216 | global $current_screen; |
| 217 | 217 | |
| 218 | - $page = isset( $_GET['page'] ) ? $_GET['page'] : ''; |
|
| 218 | + $page = isset($_GET['page']) ? $_GET['page'] : ''; |
|
| 219 | 219 | |
| 220 | - if ( ! empty( $current_screen->post_type ) ) { |
|
| 220 | + if (!empty($current_screen->post_type)) { |
|
| 221 | 221 | $page = $current_screen->post_type; |
| 222 | 222 | } |
| 223 | 223 | |
| 224 | 224 | // General styles. |
| 225 | - if ( apply_filters( 'getpaid_display_admin_footer_text', wpinv_current_user_can_manage_invoicing() ) && false !== stripos( $page, 'wpi' ) ) { |
|
| 225 | + if (apply_filters('getpaid_display_admin_footer_text', wpinv_current_user_can_manage_invoicing()) && false !== stripos($page, 'wpi')) { |
|
| 226 | 226 | |
| 227 | 227 | // Change the footer text |
| 228 | - if ( ! get_user_meta( get_current_user_id(), 'getpaid_admin_footer_text_rated', true ) ) { |
|
| 228 | + if (!get_user_meta(get_current_user_id(), 'getpaid_admin_footer_text_rated', true)) { |
|
| 229 | 229 | |
| 230 | - $rating_url = esc_url( |
|
| 230 | + $rating_url = esc_url( |
|
| 231 | 231 | wp_nonce_url( |
| 232 | - admin_url( 'admin.php?page=wpinv-reports&getpaid-admin-action=rate_plugin' ), |
|
| 232 | + admin_url('admin.php?page=wpinv-reports&getpaid-admin-action=rate_plugin'), |
|
| 233 | 233 | 'getpaid-nonce', |
| 234 | 234 | 'getpaid-nonce' |
| 235 | 235 | ) |
@@ -237,7 +237,7 @@ discard block |
||
| 237 | 237 | |
| 238 | 238 | $footer_text = sprintf( |
| 239 | 239 | /* translators: %s: five stars */ |
| 240 | - __( 'If you like <strong>GetPaid</strong>, please leave us a %s rating. A huge thanks in advance!', 'invoicing' ), |
|
| 240 | + __('If you like <strong>GetPaid</strong>, please leave us a %s rating. A huge thanks in advance!', 'invoicing'), |
|
| 241 | 241 | "<a href='$rating_url'>★★★★★</a>" |
| 242 | 242 | ); |
| 243 | 243 | |
@@ -245,7 +245,7 @@ discard block |
||
| 245 | 245 | |
| 246 | 246 | $footer_text = sprintf( |
| 247 | 247 | /* translators: %s: GetPaid */ |
| 248 | - __( 'Thank you for using %s!', 'invoicing' ), |
|
| 248 | + __('Thank you for using %s!', 'invoicing'), |
|
| 249 | 249 | "<a href='https://wpgetpaid.com/' target='_blank'><strong>GetPaid</strong></a>" |
| 250 | 250 | ); |
| 251 | 251 | |
@@ -262,8 +262,8 @@ discard block |
||
| 262 | 262 | * @since 2.0.0 |
| 263 | 263 | */ |
| 264 | 264 | public function redirect_to_wordpress_rating_page() { |
| 265 | - update_user_meta( get_current_user_id(), 'getpaid_admin_footer_text_rated', 1 ); |
|
| 266 | - wp_redirect( 'https://wordpress.org/support/plugin/invoicing/reviews?rate=5#new-post' ); |
|
| 265 | + update_user_meta(get_current_user_id(), 'getpaid_admin_footer_text_rated', 1); |
|
| 266 | + wp_redirect('https://wordpress.org/support/plugin/invoicing/reviews?rate=5#new-post'); |
|
| 267 | 267 | exit; |
| 268 | 268 | } |
| 269 | 269 | |
@@ -274,30 +274,30 @@ discard block |
||
| 274 | 274 | protected function load_payment_form_scripts() { |
| 275 | 275 | global $post; |
| 276 | 276 | |
| 277 | - wp_enqueue_script( 'vue', WPINV_PLUGIN_URL . 'assets/js/vue/vue.js', array(), WPINV_VERSION ); |
|
| 278 | - wp_enqueue_script( 'sortable', WPINV_PLUGIN_URL . 'assets/js/sortable.min.js', array(), WPINV_VERSION ); |
|
| 279 | - wp_enqueue_script( 'vue_draggable', WPINV_PLUGIN_URL . 'assets/js/vue/vuedraggable.min.js', array( 'sortable', 'vue' ), WPINV_VERSION ); |
|
| 277 | + wp_enqueue_script('vue', WPINV_PLUGIN_URL . 'assets/js/vue/vue.js', array(), WPINV_VERSION); |
|
| 278 | + wp_enqueue_script('sortable', WPINV_PLUGIN_URL . 'assets/js/sortable.min.js', array(), WPINV_VERSION); |
|
| 279 | + wp_enqueue_script('vue_draggable', WPINV_PLUGIN_URL . 'assets/js/vue/vuedraggable.min.js', array('sortable', 'vue'), WPINV_VERSION); |
|
| 280 | 280 | |
| 281 | - $version = filemtime( WPINV_PLUGIN_DIR . 'assets/js/admin-payment-forms.js' ); |
|
| 282 | - wp_register_script( 'wpinv-admin-payment-form-script', WPINV_PLUGIN_URL . 'assets/js/admin-payment-forms.js', array( 'wpinv-admin-script', 'vue_draggable' ), $version ); |
|
| 281 | + $version = filemtime(WPINV_PLUGIN_DIR . 'assets/js/admin-payment-forms.js'); |
|
| 282 | + wp_register_script('wpinv-admin-payment-form-script', WPINV_PLUGIN_URL . 'assets/js/admin-payment-forms.js', array('wpinv-admin-script', 'vue_draggable'), $version); |
|
| 283 | 283 | |
| 284 | 284 | wp_localize_script( |
| 285 | 285 | 'wpinv-admin-payment-form-script', |
| 286 | 286 | 'wpinvPaymentFormAdmin', |
| 287 | 287 | array( |
| 288 | - 'elements' => wpinv_get_data( 'payment-form-elements' ), |
|
| 289 | - 'form_elements' => getpaid_get_payment_form_elements( $post->ID ), |
|
| 288 | + 'elements' => wpinv_get_data('payment-form-elements'), |
|
| 289 | + 'form_elements' => getpaid_get_payment_form_elements($post->ID), |
|
| 290 | 290 | 'currency' => wpinv_currency_symbol(), |
| 291 | 291 | 'position' => wpinv_currency_position(), |
| 292 | 292 | 'decimals' => (int) wpinv_decimals(), |
| 293 | 293 | 'thousands_sep' => wpinv_thousands_separator(), |
| 294 | 294 | 'decimals_sep' => wpinv_decimal_separator(), |
| 295 | - 'form_items' => gepaid_get_form_items( $post->ID ), |
|
| 295 | + 'form_items' => gepaid_get_form_items($post->ID), |
|
| 296 | 296 | 'is_default' => $post->ID == wpinv_get_default_payment_form(), |
| 297 | 297 | ) |
| 298 | 298 | ); |
| 299 | 299 | |
| 300 | - wp_enqueue_script( 'wpinv-admin-payment-form-script' ); |
|
| 300 | + wp_enqueue_script('wpinv-admin-payment-form-script'); |
|
| 301 | 301 | |
| 302 | 302 | } |
| 303 | 303 | |
@@ -308,25 +308,25 @@ discard block |
||
| 308 | 308 | * @return string |
| 309 | 309 | * |
| 310 | 310 | */ |
| 311 | - public function admin_body_class( $classes ) { |
|
| 311 | + public function admin_body_class($classes) { |
|
| 312 | 312 | global $pagenow, $post, $current_screen; |
| 313 | 313 | |
| 314 | 314 | |
| 315 | - $page = isset( $_GET['page'] ) ? $_GET['page'] : ''; |
|
| 315 | + $page = isset($_GET['page']) ? $_GET['page'] : ''; |
|
| 316 | 316 | |
| 317 | - if ( ! empty( $current_screen->post_type ) ) { |
|
| 317 | + if (!empty($current_screen->post_type)) { |
|
| 318 | 318 | $page = $current_screen->post_type; |
| 319 | 319 | } |
| 320 | 320 | |
| 321 | - if ( false !== stripos( $page, 'wpi' ) ) { |
|
| 322 | - $classes .= ' wpi-' . sanitize_key( $page ); |
|
| 321 | + if (false !== stripos($page, 'wpi')) { |
|
| 322 | + $classes .= ' wpi-' . sanitize_key($page); |
|
| 323 | 323 | } |
| 324 | 324 | |
| 325 | - if ( in_array( $page, wpinv_parse_list( 'wpi_invoice wpi_payment_form wpi_quote' ) ) ) { |
|
| 325 | + if (in_array($page, wpinv_parse_list('wpi_invoice wpi_payment_form wpi_quote'))) { |
|
| 326 | 326 | $classes .= ' wpinv-cpt wpinv'; |
| 327 | 327 | } |
| 328 | 328 | |
| 329 | - if ( getpaid_is_invoice_post_type( $page ) ) { |
|
| 329 | + if (getpaid_is_invoice_post_type($page)) { |
|
| 330 | 330 | $classes .= ' getpaid-is-invoice-cpt'; |
| 331 | 331 | } |
| 332 | 332 | |
@@ -336,19 +336,19 @@ discard block |
||
| 336 | 336 | /** |
| 337 | 337 | * Maybe show the AyeCode Connect Notice. |
| 338 | 338 | */ |
| 339 | - public function init_ayecode_connect_helper(){ |
|
| 339 | + public function init_ayecode_connect_helper() { |
|
| 340 | 340 | |
| 341 | 341 | new AyeCode_Connect_Helper( |
| 342 | 342 | array( |
| 343 | - 'connect_title' => __("WP Invoicing - an AyeCode product!","invoicing"), |
|
| 344 | - 'connect_external' => __( "Please confirm you wish to connect your site?","invoicing" ), |
|
| 345 | - 'connect' => sprintf( __( "<strong>Have a license?</strong> Forget about entering license keys or downloading zip files, connect your site for instant access. %slearn more%s","invoicing" ),"<a href='https://ayecode.io/introducing-ayecode-connect/' target='_blank'>","</a>" ), |
|
| 346 | - 'connect_button' => __("Connect Site","invoicing"), |
|
| 347 | - 'connecting_button' => __("Connecting...","invoicing"), |
|
| 348 | - 'error_localhost' => __( "This service will only work with a live domain, not a localhost.","invoicing" ), |
|
| 349 | - 'error' => __( "Something went wrong, please refresh and try again.","invoicing" ), |
|
| 343 | + 'connect_title' => __("WP Invoicing - an AyeCode product!", "invoicing"), |
|
| 344 | + 'connect_external' => __("Please confirm you wish to connect your site?", "invoicing"), |
|
| 345 | + 'connect' => sprintf(__("<strong>Have a license?</strong> Forget about entering license keys or downloading zip files, connect your site for instant access. %slearn more%s", "invoicing"), "<a href='https://ayecode.io/introducing-ayecode-connect/' target='_blank'>", "</a>"), |
|
| 346 | + 'connect_button' => __("Connect Site", "invoicing"), |
|
| 347 | + 'connecting_button' => __("Connecting...", "invoicing"), |
|
| 348 | + 'error_localhost' => __("This service will only work with a live domain, not a localhost.", "invoicing"), |
|
| 349 | + 'error' => __("Something went wrong, please refresh and try again.", "invoicing"), |
|
| 350 | 350 | ), |
| 351 | - array( 'wpi-addons' ) |
|
| 351 | + array('wpi-addons') |
|
| 352 | 352 | ); |
| 353 | 353 | |
| 354 | 354 | } |
@@ -360,20 +360,20 @@ discard block |
||
| 360 | 360 | */ |
| 361 | 361 | public function activation_redirect() { |
| 362 | 362 | |
| 363 | - $redirected = get_option( 'wpinv_redirected_to_settings' ); |
|
| 363 | + $redirected = get_option('wpinv_redirected_to_settings'); |
|
| 364 | 364 | |
| 365 | - if ( ! empty( $redirected ) || wp_doing_ajax() || ! current_user_can( 'manage_options' ) ) { |
|
| 365 | + if (!empty($redirected) || wp_doing_ajax() || !current_user_can('manage_options')) { |
|
| 366 | 366 | return; |
| 367 | 367 | } |
| 368 | 368 | |
| 369 | 369 | // Bail if activating from network, or bulk |
| 370 | - if ( is_network_admin() || isset( $_GET['activate-multi'] ) ) { |
|
| 370 | + if (is_network_admin() || isset($_GET['activate-multi'])) { |
|
| 371 | 371 | return; |
| 372 | 372 | } |
| 373 | 373 | |
| 374 | - update_option( 'wpinv_redirected_to_settings', 1 ); |
|
| 374 | + update_option('wpinv_redirected_to_settings', 1); |
|
| 375 | 375 | |
| 376 | - wp_safe_redirect( admin_url( 'admin.php?page=wpinv-settings&tab=general' ) ); |
|
| 376 | + wp_safe_redirect(admin_url('admin.php?page=wpinv-settings&tab=general')); |
|
| 377 | 377 | exit; |
| 378 | 378 | |
| 379 | 379 | } |
@@ -383,9 +383,9 @@ discard block |
||
| 383 | 383 | */ |
| 384 | 384 | public function maybe_do_admin_action() { |
| 385 | 385 | |
| 386 | - if ( wpinv_current_user_can_manage_invoicing() && isset( $_REQUEST['getpaid-admin-action'] ) && isset( $_REQUEST['getpaid-nonce'] ) && wp_verify_nonce( $_REQUEST['getpaid-nonce'], 'getpaid-nonce' ) ) { |
|
| 387 | - $key = sanitize_key( $_REQUEST['getpaid-admin-action'] ); |
|
| 388 | - do_action( "getpaid_authenticated_admin_action_$key", $_REQUEST ); |
|
| 386 | + if (wpinv_current_user_can_manage_invoicing() && isset($_REQUEST['getpaid-admin-action']) && isset($_REQUEST['getpaid-nonce']) && wp_verify_nonce($_REQUEST['getpaid-nonce'], 'getpaid-nonce')) { |
|
| 387 | + $key = sanitize_key($_REQUEST['getpaid-admin-action']); |
|
| 388 | + do_action("getpaid_authenticated_admin_action_$key", $_REQUEST); |
|
| 389 | 389 | } |
| 390 | 390 | |
| 391 | 391 | } |
@@ -395,16 +395,16 @@ discard block |
||
| 395 | 395 | * |
| 396 | 396 | * @param array $args |
| 397 | 397 | */ |
| 398 | - public function send_customer_invoice( $args ) { |
|
| 399 | - $sent = getpaid()->get( 'invoice_emails' )->user_invoice( new WPInv_Invoice( $args['invoice_id'] ), true ); |
|
| 398 | + public function send_customer_invoice($args) { |
|
| 399 | + $sent = getpaid()->get('invoice_emails')->user_invoice(new WPInv_Invoice($args['invoice_id']), true); |
|
| 400 | 400 | |
| 401 | - if ( $sent ) { |
|
| 402 | - $this->show_success( __( 'Invoice was successfully sent to the customer', 'invoicing' ) ); |
|
| 401 | + if ($sent) { |
|
| 402 | + $this->show_success(__('Invoice was successfully sent to the customer', 'invoicing')); |
|
| 403 | 403 | } else { |
| 404 | - $this->show_error( __( 'Could not send the invoice to the customer', 'invoicing' ) ); |
|
| 404 | + $this->show_error(__('Could not send the invoice to the customer', 'invoicing')); |
|
| 405 | 405 | } |
| 406 | 406 | |
| 407 | - wp_safe_redirect( remove_query_arg( array( 'getpaid-admin-action', 'getpaid-nonce', 'invoice_id' ) ) ); |
|
| 407 | + wp_safe_redirect(remove_query_arg(array('getpaid-admin-action', 'getpaid-nonce', 'invoice_id'))); |
|
| 408 | 408 | exit; |
| 409 | 409 | } |
| 410 | 410 | |
@@ -413,16 +413,16 @@ discard block |
||
| 413 | 413 | * |
| 414 | 414 | * @param array $args |
| 415 | 415 | */ |
| 416 | - public function send_customer_payment_reminder( $args ) { |
|
| 417 | - $sent = getpaid()->get( 'invoice_emails' )->force_send_overdue_notice( new WPInv_Invoice( $args['invoice_id'] ) ); |
|
| 416 | + public function send_customer_payment_reminder($args) { |
|
| 417 | + $sent = getpaid()->get('invoice_emails')->force_send_overdue_notice(new WPInv_Invoice($args['invoice_id'])); |
|
| 418 | 418 | |
| 419 | - if ( $sent ) { |
|
| 420 | - $this->show_success( __( 'Payment reminder was successfully sent to the customer', 'invoicing' ) ); |
|
| 419 | + if ($sent) { |
|
| 420 | + $this->show_success(__('Payment reminder was successfully sent to the customer', 'invoicing')); |
|
| 421 | 421 | } else { |
| 422 | - $this->show_error( __( 'Could not sent payment reminder to the customer', 'invoicing' ) ); |
|
| 422 | + $this->show_error(__('Could not sent payment reminder to the customer', 'invoicing')); |
|
| 423 | 423 | } |
| 424 | 424 | |
| 425 | - wp_safe_redirect( remove_query_arg( array( 'getpaid-admin-action', 'getpaid-nonce', 'invoice_id' ) ) ); |
|
| 425 | + wp_safe_redirect(remove_query_arg(array('getpaid-admin-action', 'getpaid-nonce', 'invoice_id'))); |
|
| 426 | 426 | exit; |
| 427 | 427 | } |
| 428 | 428 | |
@@ -432,8 +432,8 @@ discard block |
||
| 432 | 432 | */ |
| 433 | 433 | public function admin_reset_tax_rates() { |
| 434 | 434 | |
| 435 | - update_option( 'wpinv_tax_rates', wpinv_get_data( 'tax-rates' ) ); |
|
| 436 | - wp_safe_redirect( remove_query_arg( array( 'getpaid-admin-action', 'getpaid-nonce' ) ) ); |
|
| 435 | + update_option('wpinv_tax_rates', wpinv_get_data('tax-rates')); |
|
| 436 | + wp_safe_redirect(remove_query_arg(array('getpaid-admin-action', 'getpaid-nonce'))); |
|
| 437 | 437 | exit; |
| 438 | 438 | |
| 439 | 439 | } |
@@ -445,8 +445,8 @@ discard block |
||
| 445 | 445 | public function admin_create_missing_pages() { |
| 446 | 446 | $installer = new GetPaid_Installer(); |
| 447 | 447 | $installer->create_pages(); |
| 448 | - $this->show_success( __( 'GetPaid pages updated.', 'invoicing' ) ); |
|
| 449 | - wp_safe_redirect( remove_query_arg( array( 'getpaid-admin-action', 'getpaid-nonce' ) ) ); |
|
| 448 | + $this->show_success(__('GetPaid pages updated.', 'invoicing')); |
|
| 449 | + wp_safe_redirect(remove_query_arg(array('getpaid-admin-action', 'getpaid-nonce'))); |
|
| 450 | 450 | exit; |
| 451 | 451 | } |
| 452 | 452 | |
@@ -458,35 +458,35 @@ discard block |
||
| 458 | 458 | global $wpdb; |
| 459 | 459 | $installer = new GetPaid_Installer(); |
| 460 | 460 | |
| 461 | - if ( $wpdb->get_var( "SHOW TABLES LIKE '{$wpdb->prefix}wpinv_subscriptions'" ) != $wpdb->prefix . 'wpinv_subscriptions' ) { |
|
| 461 | + if ($wpdb->get_var("SHOW TABLES LIKE '{$wpdb->prefix}wpinv_subscriptions'") != $wpdb->prefix . 'wpinv_subscriptions') { |
|
| 462 | 462 | $installer->create_subscriptions_table(); |
| 463 | 463 | |
| 464 | - if ( $wpdb->last_error !== '' ) { |
|
| 465 | - $this->show_error( __( 'Your GetPaid tables have been updated:', 'invoicing' ) . ' ' . $wpdb->last_error ); |
|
| 464 | + if ($wpdb->last_error !== '') { |
|
| 465 | + $this->show_error(__('Your GetPaid tables have been updated:', 'invoicing') . ' ' . $wpdb->last_error); |
|
| 466 | 466 | } |
| 467 | 467 | } |
| 468 | 468 | |
| 469 | - if ( $wpdb->get_var( "SHOW TABLES LIKE '{$wpdb->prefix}getpaid_invoices'" ) != $wpdb->prefix . 'getpaid_invoices' ) { |
|
| 469 | + if ($wpdb->get_var("SHOW TABLES LIKE '{$wpdb->prefix}getpaid_invoices'") != $wpdb->prefix . 'getpaid_invoices') { |
|
| 470 | 470 | $installer->create_invoices_table(); |
| 471 | 471 | |
| 472 | - if ( $wpdb->last_error !== '' ) { |
|
| 473 | - $this->show_error( __( 'Your GetPaid tables have been updated:', 'invoicing' ) . ' ' . $wpdb->last_error ); |
|
| 472 | + if ($wpdb->last_error !== '') { |
|
| 473 | + $this->show_error(__('Your GetPaid tables have been updated:', 'invoicing') . ' ' . $wpdb->last_error); |
|
| 474 | 474 | } |
| 475 | 475 | } |
| 476 | 476 | |
| 477 | - if ( $wpdb->get_var( "SHOW TABLES LIKE '{$wpdb->prefix}getpaid_invoice_items'" ) != $wpdb->prefix . 'getpaid_invoice_items' ) { |
|
| 477 | + if ($wpdb->get_var("SHOW TABLES LIKE '{$wpdb->prefix}getpaid_invoice_items'") != $wpdb->prefix . 'getpaid_invoice_items') { |
|
| 478 | 478 | $installer->create_invoice_items_table(); |
| 479 | 479 | |
| 480 | - if ( $wpdb->last_error !== '' ) { |
|
| 481 | - $this->show_error( __( 'Your GetPaid tables have been updated:', 'invoicing' ) . ' ' . $wpdb->last_error ); |
|
| 480 | + if ($wpdb->last_error !== '') { |
|
| 481 | + $this->show_error(__('Your GetPaid tables have been updated:', 'invoicing') . ' ' . $wpdb->last_error); |
|
| 482 | 482 | } |
| 483 | 483 | } |
| 484 | 484 | |
| 485 | - if ( ! $this->has_notices() ) { |
|
| 486 | - $this->show_success( __( 'Your GetPaid tables have been updated.', 'invoicing' ) ); |
|
| 485 | + if (!$this->has_notices()) { |
|
| 486 | + $this->show_success(__('Your GetPaid tables have been updated.', 'invoicing')); |
|
| 487 | 487 | } |
| 488 | 488 | |
| 489 | - wp_safe_redirect( remove_query_arg( array( 'getpaid-admin-action', 'getpaid-nonce' ) ) ); |
|
| 489 | + wp_safe_redirect(remove_query_arg(array('getpaid-admin-action', 'getpaid-nonce'))); |
|
| 490 | 490 | exit; |
| 491 | 491 | } |
| 492 | 492 | |
@@ -501,10 +501,10 @@ discard block |
||
| 501 | 501 | $installer->migrate_old_invoices(); |
| 502 | 502 | |
| 503 | 503 | // Show an admin message. |
| 504 | - $this->show_success( __( 'Your invoices have been migrated.', 'invoicing' ) ); |
|
| 504 | + $this->show_success(__('Your invoices have been migrated.', 'invoicing')); |
|
| 505 | 505 | |
| 506 | 506 | // Redirect the admin. |
| 507 | - wp_safe_redirect( remove_query_arg( array( 'getpaid-admin-action', 'getpaid-nonce' ) ) ); |
|
| 507 | + wp_safe_redirect(remove_query_arg(array('getpaid-admin-action', 'getpaid-nonce'))); |
|
| 508 | 508 | exit; |
| 509 | 509 | |
| 510 | 510 | } |
@@ -516,18 +516,18 @@ discard block |
||
| 516 | 516 | public function admin_download_customers() { |
| 517 | 517 | global $wpdb; |
| 518 | 518 | |
| 519 | - $output = fopen( 'php://output', 'w' ) or die( __( 'Unsupported server', 'invoicing' ) ); |
|
| 519 | + $output = fopen('php://output', 'w') or die(__('Unsupported server', 'invoicing')); |
|
| 520 | 520 | |
| 521 | - header( "Content-Type:text/csv" ); |
|
| 522 | - header( "Content-Disposition:attachment;filename=customers.csv" ); |
|
| 521 | + header("Content-Type:text/csv"); |
|
| 522 | + header("Content-Disposition:attachment;filename=customers.csv"); |
|
| 523 | 523 | |
| 524 | 524 | $post_types = ''; |
| 525 | 525 | |
| 526 | - foreach ( array_keys( getpaid_get_invoice_post_types() ) as $post_type ) { |
|
| 527 | - $post_types .= $wpdb->prepare( "post_type=%s OR ", $post_type ); |
|
| 526 | + foreach (array_keys(getpaid_get_invoice_post_types()) as $post_type) { |
|
| 527 | + $post_types .= $wpdb->prepare("post_type=%s OR ", $post_type); |
|
| 528 | 528 | } |
| 529 | 529 | |
| 530 | - $post_types = rtrim( $post_types, ' OR' ); |
|
| 530 | + $post_types = rtrim($post_types, ' OR'); |
|
| 531 | 531 | |
| 532 | 532 | $customers = $wpdb->get_col( |
| 533 | 533 | $wpdb->prepare( |
@@ -536,57 +536,57 @@ discard block |
||
| 536 | 536 | ); |
| 537 | 537 | |
| 538 | 538 | $columns = array( |
| 539 | - 'name' => __( 'Name', 'invoicing' ), |
|
| 540 | - 'email' => __( 'Email', 'invoicing' ), |
|
| 541 | - 'country' => __( 'Country', 'invoicing' ), |
|
| 542 | - 'state' => __( 'State', 'invoicing' ), |
|
| 543 | - 'city' => __( 'City', 'invoicing' ), |
|
| 544 | - 'zip' => __( 'ZIP', 'invoicing' ), |
|
| 545 | - 'address' => __( 'Address', 'invoicing' ), |
|
| 546 | - 'phone' => __( 'Phone', 'invoicing' ), |
|
| 547 | - 'company' => __( 'Company', 'invoicing' ), |
|
| 548 | - 'invoices' => __( 'Invoices', 'invoicing' ), |
|
| 549 | - 'total' => __( 'Total Spend', 'invoicing' ), |
|
| 550 | - 'signup' => __( 'Date created', 'invoicing' ), |
|
| 539 | + 'name' => __('Name', 'invoicing'), |
|
| 540 | + 'email' => __('Email', 'invoicing'), |
|
| 541 | + 'country' => __('Country', 'invoicing'), |
|
| 542 | + 'state' => __('State', 'invoicing'), |
|
| 543 | + 'city' => __('City', 'invoicing'), |
|
| 544 | + 'zip' => __('ZIP', 'invoicing'), |
|
| 545 | + 'address' => __('Address', 'invoicing'), |
|
| 546 | + 'phone' => __('Phone', 'invoicing'), |
|
| 547 | + 'company' => __('Company', 'invoicing'), |
|
| 548 | + 'invoices' => __('Invoices', 'invoicing'), |
|
| 549 | + 'total' => __('Total Spend', 'invoicing'), |
|
| 550 | + 'signup' => __('Date created', 'invoicing'), |
|
| 551 | 551 | ); |
| 552 | 552 | |
| 553 | 553 | // Output the csv column headers. |
| 554 | - fputcsv( $output, array_values( $columns ) ); |
|
| 554 | + fputcsv($output, array_values($columns)); |
|
| 555 | 555 | |
| 556 | 556 | // Loop through |
| 557 | 557 | $table = new WPInv_Customers_Table(); |
| 558 | - foreach ( $customers as $customer_id ) { |
|
| 558 | + foreach ($customers as $customer_id) { |
|
| 559 | 559 | |
| 560 | - $user = get_user_by( 'id', $customer_id ); |
|
| 560 | + $user = get_user_by('id', $customer_id); |
|
| 561 | 561 | $row = array(); |
| 562 | - if ( empty( $user ) ) { |
|
| 562 | + if (empty($user)) { |
|
| 563 | 563 | continue; |
| 564 | 564 | } |
| 565 | 565 | |
| 566 | - foreach ( array_keys( $columns ) as $column ) { |
|
| 566 | + foreach (array_keys($columns) as $column) { |
|
| 567 | 567 | |
| 568 | 568 | $method = 'column_' . $column; |
| 569 | 569 | |
| 570 | - if ( 'name' == $column ) { |
|
| 571 | - $value = sanitize_text_field( $user->display_name ); |
|
| 572 | - } else if( 'email' == $column ) { |
|
| 573 | - $value = sanitize_email( $user->user_email ); |
|
| 574 | - } else if ( is_callable( array( $table, $method ) ) ) { |
|
| 575 | - $value = strip_tags( $table->$method( $user ) ); |
|
| 570 | + if ('name' == $column) { |
|
| 571 | + $value = sanitize_text_field($user->display_name); |
|
| 572 | + } else if ('email' == $column) { |
|
| 573 | + $value = sanitize_email($user->user_email); |
|
| 574 | + } else if (is_callable(array($table, $method))) { |
|
| 575 | + $value = strip_tags($table->$method($user)); |
|
| 576 | 576 | } |
| 577 | 577 | |
| 578 | - if ( empty( $value ) ) { |
|
| 579 | - $value = sanitize_text_field( get_user_meta( $user->ID, '_wpinv_' . $column, true ) ); |
|
| 578 | + if (empty($value)) { |
|
| 579 | + $value = sanitize_text_field(get_user_meta($user->ID, '_wpinv_' . $column, true)); |
|
| 580 | 580 | } |
| 581 | 581 | |
| 582 | 582 | $row[] = $value; |
| 583 | 583 | |
| 584 | 584 | } |
| 585 | 585 | |
| 586 | - fputcsv( $output, $row ); |
|
| 586 | + fputcsv($output, $row); |
|
| 587 | 587 | } |
| 588 | 588 | |
| 589 | - fclose( $output ); |
|
| 589 | + fclose($output); |
|
| 590 | 590 | exit; |
| 591 | 591 | |
| 592 | 592 | } |
@@ -600,36 +600,36 @@ discard block |
||
| 600 | 600 | |
| 601 | 601 | // Fetch all invoices that have discount codes. |
| 602 | 602 | $table = $wpdb->prefix . 'getpaid_invoices'; |
| 603 | - $invoices = $wpdb->get_col( "SELECT `post_id` FROM `$table` WHERE `discount` = 0 && `discount_code` <> ''" ); |
|
| 603 | + $invoices = $wpdb->get_col("SELECT `post_id` FROM `$table` WHERE `discount` = 0 && `discount_code` <> ''"); |
|
| 604 | 604 | |
| 605 | - foreach ( $invoices as $invoice ) { |
|
| 605 | + foreach ($invoices as $invoice) { |
|
| 606 | 606 | |
| 607 | - $invoice = new WPInv_Invoice( $invoice ); |
|
| 607 | + $invoice = new WPInv_Invoice($invoice); |
|
| 608 | 608 | |
| 609 | - if ( ! $invoice->exists() ) { |
|
| 609 | + if (!$invoice->exists()) { |
|
| 610 | 610 | continue; |
| 611 | 611 | } |
| 612 | 612 | |
| 613 | 613 | // Abort if the discount does not exist or does not apply here. |
| 614 | - $discount = new WPInv_Discount( $invoice->get_discount_code() ); |
|
| 615 | - if ( ! $discount->exists() ) { |
|
| 614 | + $discount = new WPInv_Discount($invoice->get_discount_code()); |
|
| 615 | + if (!$discount->exists()) { |
|
| 616 | 616 | continue; |
| 617 | 617 | } |
| 618 | 618 | |
| 619 | - $invoice->add_discount( getpaid_calculate_invoice_discount( $invoice, $discount ) ); |
|
| 619 | + $invoice->add_discount(getpaid_calculate_invoice_discount($invoice, $discount)); |
|
| 620 | 620 | $invoice->recalculate_total(); |
| 621 | 621 | |
| 622 | - if ( $invoice->get_total_discount() > 0 ) { |
|
| 622 | + if ($invoice->get_total_discount() > 0) { |
|
| 623 | 623 | $invoice->save(); |
| 624 | 624 | } |
| 625 | 625 | |
| 626 | 626 | } |
| 627 | 627 | |
| 628 | 628 | // Show an admin message. |
| 629 | - $this->show_success( __( 'Discounts have been recalculated.', 'invoicing' ) ); |
|
| 629 | + $this->show_success(__('Discounts have been recalculated.', 'invoicing')); |
|
| 630 | 630 | |
| 631 | 631 | // Redirect the admin. |
| 632 | - wp_safe_redirect( remove_query_arg( array( 'getpaid-admin-action', 'getpaid-nonce' ) ) ); |
|
| 632 | + wp_safe_redirect(remove_query_arg(array('getpaid-admin-action', 'getpaid-nonce'))); |
|
| 633 | 633 | exit; |
| 634 | 634 | |
| 635 | 635 | } |
@@ -641,8 +641,8 @@ discard block |
||
| 641 | 641 | * @return array |
| 642 | 642 | */ |
| 643 | 643 | public function get_notices() { |
| 644 | - $notices = get_option( 'wpinv_admin_notices' ); |
|
| 645 | - return is_array( $notices ) ? $notices : array(); |
|
| 644 | + $notices = get_option('wpinv_admin_notices'); |
|
| 645 | + return is_array($notices) ? $notices : array(); |
|
| 646 | 646 | } |
| 647 | 647 | |
| 648 | 648 | /** |
@@ -652,7 +652,7 @@ discard block |
||
| 652 | 652 | * @return array |
| 653 | 653 | */ |
| 654 | 654 | public function has_notices() { |
| 655 | - return count( $this->get_notices() ) > 0; |
|
| 655 | + return count($this->get_notices()) > 0; |
|
| 656 | 656 | } |
| 657 | 657 | |
| 658 | 658 | /** |
@@ -662,7 +662,7 @@ discard block |
||
| 662 | 662 | * @since 1.0.19 |
| 663 | 663 | */ |
| 664 | 664 | public function clear_notices() { |
| 665 | - delete_option( 'wpinv_admin_notices' ); |
|
| 665 | + delete_option('wpinv_admin_notices'); |
|
| 666 | 666 | } |
| 667 | 667 | |
| 668 | 668 | /** |
@@ -671,16 +671,16 @@ discard block |
||
| 671 | 671 | * @access public |
| 672 | 672 | * @since 1.0.19 |
| 673 | 673 | */ |
| 674 | - public function save_notice( $type, $message ) { |
|
| 674 | + public function save_notice($type, $message) { |
|
| 675 | 675 | $notices = $this->get_notices(); |
| 676 | 676 | |
| 677 | - if ( empty( $notices[ $type ] ) || ! is_array( $notices[ $type ]) ) { |
|
| 678 | - $notices[ $type ] = array(); |
|
| 677 | + if (empty($notices[$type]) || !is_array($notices[$type])) { |
|
| 678 | + $notices[$type] = array(); |
|
| 679 | 679 | } |
| 680 | 680 | |
| 681 | - $notices[ $type ][] = $message; |
|
| 681 | + $notices[$type][] = $message; |
|
| 682 | 682 | |
| 683 | - update_option( 'wpinv_admin_notices', $notices ); |
|
| 683 | + update_option('wpinv_admin_notices', $notices); |
|
| 684 | 684 | } |
| 685 | 685 | |
| 686 | 686 | /** |
@@ -690,8 +690,8 @@ discard block |
||
| 690 | 690 | * @access public |
| 691 | 691 | * @since 1.0.19 |
| 692 | 692 | */ |
| 693 | - public function show_success( $msg ) { |
|
| 694 | - $this->save_notice( 'success', $msg ); |
|
| 693 | + public function show_success($msg) { |
|
| 694 | + $this->save_notice('success', $msg); |
|
| 695 | 695 | } |
| 696 | 696 | |
| 697 | 697 | /** |
@@ -701,8 +701,8 @@ discard block |
||
| 701 | 701 | * @param string $msg The message to qeue. |
| 702 | 702 | * @since 1.0.19 |
| 703 | 703 | */ |
| 704 | - public function show_error( $msg ) { |
|
| 705 | - $this->save_notice( 'error', $msg ); |
|
| 704 | + public function show_error($msg) { |
|
| 705 | + $this->save_notice('error', $msg); |
|
| 706 | 706 | } |
| 707 | 707 | |
| 708 | 708 | /** |
@@ -712,8 +712,8 @@ discard block |
||
| 712 | 712 | * @param string $msg The message to qeue. |
| 713 | 713 | * @since 1.0.19 |
| 714 | 714 | */ |
| 715 | - public function show_warning( $msg ) { |
|
| 716 | - $this->save_notice( 'warning', $msg ); |
|
| 715 | + public function show_warning($msg) { |
|
| 716 | + $this->save_notice('warning', $msg); |
|
| 717 | 717 | } |
| 718 | 718 | |
| 719 | 719 | /** |
@@ -723,8 +723,8 @@ discard block |
||
| 723 | 723 | * @param string $msg The message to qeue. |
| 724 | 724 | * @since 1.0.19 |
| 725 | 725 | */ |
| 726 | - public function show_info( $msg ) { |
|
| 727 | - $this->save_notice( 'info', $msg ); |
|
| 726 | + public function show_info($msg) { |
|
| 727 | + $this->save_notice('info', $msg); |
|
| 728 | 728 | } |
| 729 | 729 | |
| 730 | 730 | /** |
@@ -738,30 +738,30 @@ discard block |
||
| 738 | 738 | $notices = $this->get_notices(); |
| 739 | 739 | $this->clear_notices(); |
| 740 | 740 | |
| 741 | - foreach ( $notices as $type => $messages ) { |
|
| 741 | + foreach ($notices as $type => $messages) { |
|
| 742 | 742 | |
| 743 | - if ( ! is_array( $messages ) ) { |
|
| 743 | + if (!is_array($messages)) { |
|
| 744 | 744 | continue; |
| 745 | 745 | } |
| 746 | 746 | |
| 747 | - $type = sanitize_key( $type ); |
|
| 748 | - foreach ( $messages as $message ) { |
|
| 749 | - $message = wp_kses_post( $message ); |
|
| 747 | + $type = sanitize_key($type); |
|
| 748 | + foreach ($messages as $message) { |
|
| 749 | + $message = wp_kses_post($message); |
|
| 750 | 750 | echo "<div class='notice notice-$type is-dismissible'><p>$message</p></div>"; |
| 751 | 751 | } |
| 752 | 752 | |
| 753 | 753 | } |
| 754 | 754 | |
| 755 | - foreach ( array( 'checkout_page', 'invoice_history_page', 'success_page', 'failure_page', 'invoice_subscription_page' ) as $page ) { |
|
| 755 | + foreach (array('checkout_page', 'invoice_history_page', 'success_page', 'failure_page', 'invoice_subscription_page') as $page) { |
|
| 756 | 756 | |
| 757 | - if ( ! is_numeric( wpinv_get_option( $page, false ) ) ) { |
|
| 758 | - $url = wp_nonce_url( |
|
| 759 | - add_query_arg( 'getpaid-admin-action', 'create_missing_pages' ), |
|
| 757 | + if (!is_numeric(wpinv_get_option($page, false))) { |
|
| 758 | + $url = wp_nonce_url( |
|
| 759 | + add_query_arg('getpaid-admin-action', 'create_missing_pages'), |
|
| 760 | 760 | 'getpaid-nonce', |
| 761 | 761 | 'getpaid-nonce' |
| 762 | 762 | ); |
| 763 | - $message = __( 'Some GetPaid pages are missing. To use GetPaid without any issues, click the button below to generate the missing pages.', 'invoicing' ); |
|
| 764 | - $message2 = __( 'Generate Pages', 'invoicing' ); |
|
| 763 | + $message = __('Some GetPaid pages are missing. To use GetPaid without any issues, click the button below to generate the missing pages.', 'invoicing'); |
|
| 764 | + $message2 = __('Generate Pages', 'invoicing'); |
|
| 765 | 765 | echo "<div class='notice notice-warning is-dismissible'><p>$message<br><br><a href='$url' class='button button-primary'>$message2</a></p></div>"; |
| 766 | 766 | break; |
| 767 | 767 | } |