@@ -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 |
@@ -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 | } |