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('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') { //Styles wp_register_style('jquery-ui', '//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.min.css'); wp_enqueue_style('jquery-ui'); wp_enqueue_style('bp-setup-wizard-style', BETTER_PAYMENT_ASSETS . '/css/setup-wizard.min.css', null, $this->file_version); wp_enqueue_style('bp-settings-style', BETTER_PAYMENT_ASSETS . '/css/style.min.css', null, $this->file_version); wp_enqueue_style('bp-icon-admin', BETTER_PAYMENT_ASSETS . '/icon/style.min.css'); wp_enqueue_style('sweetalert2-css', BETTER_PAYMENT_ASSETS . '/vendor/sweetalert2/css/sweetalert2.min.css'); //Scripts wp_enqueue_script('bp-setup-wizard-js', BETTER_PAYMENT_ASSETS . '/js/setup-wizard.min.js', null, $this->file_version); wp_localize_script('bp-setup-wizard-js', 'betterPaymentObjWizard', array( 'nonce' => wp_create_nonce('better_payment_admin_nonce'), 'success_image' => BETTER_PAYMENT_ASSETS . '/img/success.gif', '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'), ] )); wp_enqueue_script('bp-setup-wizard-localize'); wp_enqueue_script('sweetalert2-js', BETTER_PAYMENT_ASSETS . '/vendor/sweetalert2/js/sweetalert2.min.js', array('jquery'), BETTER_PAYMENT_VERSION, true); } return []; } /** * Create admin menu for setup wizard * * @since 0.0.2 */ public function admin_menu() { add_submenu_page( null, 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'; ?>