file_version = defined('WP_DEBUG') && WP_DEBUG ? time() : BETTER_PAYMENT_VERSION; add_action('admin_enqueue_scripts', array($this, 'setup_wizard_scripts')); add_action('admin_menu', array($this, 'admin_menu')); add_action('wp_ajax_save_setup_wizard_data', [$this, 'save_setup_wizard_data']); add_action( 'wp_ajax_bp_quick_setup_save_tracking', [ $this, 'bp_quick_setup_save_tracking' ] ); add_action('in_admin_header', [$this, 'remove_notice'], 1000); } /** * Remove all notice in setup wizard page * * @since 0.0.2 */ public function remove_notice() { if (isset($_GET['page']) && $_GET['page'] == 'better-payment-setup-wizard') { remove_all_actions('admin_notices'); remove_all_actions('all_admin_notices'); } } /** * setup_wizard_scripts * @param $hook * @return array * * @since 0.0.2 */ public function setup_wizard_scripts($hook) { if (isset($hook) && $hook == 'admin_page_better-payment-setup-wizard') { // Determine the correct file extension based on debug mode $js_ext = file_exists(BETTER_PAYMENT_PATH . '/assets/admin/quick-setup/quick-setup.min.js') ? '.min.js' : '.js'; $css_ext = file_exists(BETTER_PAYMENT_PATH . '/assets/admin/quick-setup/quick-setup.min.css') ? '.min.css' : '.css'; // Enqueue React Quick Setup CSS wp_enqueue_style( 'bp-quick-setup-css', BETTER_PAYMENT_ASSETS . '/admin/quick-setup/quick-setup' . $css_ext, array(), $this->file_version ); // Enqueue React Quick Setup JS with WordPress dependencies wp_enqueue_script( 'bp-quick-setup-js', BETTER_PAYMENT_ASSETS . '/admin/quick-setup/quick-setup' . $js_ext, array('wp-element', 'wp-i18n'), $this->file_version, true ); // Localize script with necessary data wp_localize_script('bp-quick-setup-js', 'betterPaymentObjWizard', array( 'admin_nonce' => wp_create_nonce('better_payment_admin_nonce'), 'ajaxUrl' => admin_url('admin-ajax.php'), 'assetsUrl' => BETTER_PAYMENT_ASSETS . '/admin/quick-setup', 'success_image' => BETTER_PAYMENT_ASSETS . '/img/success.gif', 'settings' => DB::get_settings(), 'is_tracking' => get_option('better_payment_settings_opt_in') === 'yes' ? 1 : 0, 'currencies' => $this->get_currency_list(), 'is_pro' => defined('BETTER_PAYMENT_PRO_VERSION') && BETTER_PAYMENT_PRO_VERSION ? true : false, 'alerts' => [ 'confirm' => esc_html__('Are you sure?', 'better-payment'), 'confirm_description' => esc_html__("You won't be able to revert this!", 'better-payment'), 'yes' => esc_html__('Yes, delete it!', 'better-payment'), 'no' => esc_html__('No, cancel!', 'better-payment'), ], 'messages' => [ 'success' => esc_html__('Changes saved successfully!', 'better-payment'), 'error' => esc_html__('Opps! something went wrong!', 'better-payment'), 'no_action_taken' => esc_html__('No action taken!', 'better-payment'), ] )); } return []; } /** * Create admin menu for setup wizard * * @since 0.0.2 */ public function admin_menu() { add_submenu_page( "admin.php?page=better-payment-setup-wizard", esc_html__('Better Payment ', 'better-payment'), esc_html__('Better Payment ', 'better-payment'), 'manage_options', 'better-payment-setup-wizard', [$this, 'render_wizard'] ); } /** * Render tab step * * @since 0.0.2 */ public function tab_step() { $wizard_column = 'four'; ?> get_currency_list(); ?>

🎉

>

change_site_title(); // $this->tab_step(); // $this->tab_content($bp_admin_saved_settings); // $this->setup_wizard_footer(); include BETTER_PAYMENT_ADMIN_VIEWS_PATH . '/better-payment-quick-setup.php'; ?>
admin_url() ] ); // }else { wp_send_json_success( [ 'redirect_url' => admin_url( 'admin.php?page=better-payment-admin&tab=dashboard' ) ] ); // } }catch (\Exception $e) { wp_send_json_error($e->getMessage()); } die; } /** * WPIns process * * @since 0.0.1 */ public static function wpins_process(){ $plugin_name = basename( BETTER_PAYMENT_FILE, '.php' ); if ( class_exists( '\Better_Payment\Lite\Classes\Plugin_Usage_Tracker' ) ){ $tracker = Plugin_Usage_Tracker::get_instance( BETTER_PAYMENT_FILE, [ 'opt_in' => true, 'goodbye_form' => true, 'item_id' => '64e1f724b5e14edb343e' ] ); $tracker->set_is_tracking_allowed( true ); $tracker->do_tracking( true ); } } /** * Redirect * * @since 0.0.1 */ public static function redirect() { update_option('better_payment_setup_wizard', 'init'); wp_redirect(admin_url('admin.php?page=better-payment-setup-wizard')); } /** * Site title * * @since 0.0.1 */ public function change_site_title() { ?>