available_pages = array( 'welcome' => esc_html__( 'Welcome', 'woodmart' ), 'activation' => esc_html__( 'Activation', 'woodmart' ), 'child-theme' => esc_html__( 'Child theme', 'woodmart' ), 'page-builder' => esc_html__( 'Page builder', 'woodmart' ), 'plugins' => esc_html__( 'Plugins', 'woodmart' ), 'prebuilt-websites' => esc_html__( 'Prebuilt websites', 'woodmart' ), 'done' => esc_html__( 'Done', 'woodmart' ), ); if ( isset( $_GET['skip_setup'] ) ) { update_option( 'woodmart_setup_status', 'done' ); } if ( 'done' !== get_option( 'woodmart_setup_status' ) ) { // phpcs:ignore add_action( 'admin_init', array( $this, 'prevent_plugins_redirect' ), 1 ); do_action( 'woodmart_setup_wizard' ); } if ( defined( 'DOING_AJAX' ) || isset( $_GET['page'] ) && ( 'xts_dashboard' === $_GET['page'] || 'tgmpa-install-plugins' === $_GET['page'] ) ) { add_action( 'admin_init', array( $this, 'prevent_plugins_redirect' ), 1 ); } add_action( 'admin_init', array( $this, 'theme_activation_redirect' ) ); add_filter( 'leadin_impact_code', array( $this, 'get_hubspot_affiliate_code' ) ); } /** * Prevent plugins redirect. */ public function prevent_plugins_redirect() { delete_transient( '_revslider_welcome_screen_activation_redirect' ); delete_transient( '_vc_page_welcome_redirect' ); delete_transient( 'elementor_activation_redirect' ); add_filter( 'woocommerce_enable_setup_wizard', '__return_false' ); remove_action( 'admin_menu', 'vc_menu_page_build' ); remove_action( 'network_admin_menu', 'vc_network_menu_page_build' ); remove_action( 'vc_activation_hook', 'vc_page_welcome_set_redirect' ); remove_action( 'admin_init', 'vc_page_welcome_redirect' ); } /** * Hubspot affiliate. */ public function get_hubspot_affiliate_code() { return '7m0A9V'; } /** * Redirect to setup wizard after theme activated. */ public function theme_activation_redirect() { if ( 'done' === get_option( 'woodmart_setup_status' ) ) { return; } global $pagenow; $args = array( 'page' => 'xts_dashboard', 'tab' => 'wizard', ); if ( 'themes.php' === $pagenow && is_admin() && isset( $_GET['activated'] ) ) { // phpcs:ignore wp_safe_redirect( esc_url_raw( add_query_arg( $args, admin_url( 'admin.php' ) ) ) ); } } /** * Template. */ public function setup_wizard_template() { if ( 'done' === get_option( 'woodmart_setup_status' ) ) { return; } wp_enqueue_script( 'wd-setup-wizard', WOODMART_ASSETS . '/js/wizard.js', array(), WOODMART_VERSION, true ); $page = 'welcome'; if ( isset( $_GET['step'] ) && ! empty( $_GET['step'] ) ) { // phpcs:ignore $page = trim( wp_unslash( $_GET['step'] ) ); // phpcs:ignore } $this->show_page( $page ); } /** * Show page. * * @param string $name Template file name. */ public function show_page( $name ) { ?>
show_part( 'sidebar' ); ?>
show_part( $name ); ?>
get_page_url( $page ); if ( 'elementor' === $builder ) { $classes .= ' xts-elementor xts-shown'; $url .= '&wd_builder=elementor'; } elseif ( 'wpb' === $builder ) { $classes .= ' xts-wpb xts-hidden'; $url .= '&wd_builder=wpb'; } if ( $disabled ) { $classes .= ' xts-disabled'; } ?>