steps = array( 'welcome' => array( 'name' => __( 'Welcome', 'astra-theme' ), 'view' => array( $this, 'ast_setup_welcome' ), 'handler' => '', ), 'child_theme' => array( 'name' => __( 'Child Theme', 'astra-theme' ), 'view' => array( $this, 'ast_child_theme_demo' ), 'handler' => array( $this, 'ast_child_theme_demo_save' ), ), 'site_identity' => array( 'name' => __( 'Site Identity', 'astra-theme' ), 'view' => array( $this, 'site_identity_demo' ), 'handler' => array( $this, 'site_identity_demo_save' ), ), 'theme_config' => array( 'name' => __( 'Theme Configuration', 'astra-theme' ), 'view' => array( $this, 'ast_theme_config' ), 'handler' => array( $this, 'ast_theme_config_save' ), ), 'support' => array( 'name' => __( 'Support', 'astra-theme' ), 'view' => array( $this, 'support' ), 'handler' => array( $this, 'support_save' ), ), 'setup_ready' => array( 'name' => __( 'Ready!', 'astra-theme' ), 'view' => array( $this, 'ast_setup_ready' ), 'handler' => '', ), ); $this->step = isset( $_GET['step'] ) ? sanitize_key( $_GET['step'] ) : current( array_keys( $this->steps ) ); $admin_asset_uri = AST_THEME_URI . 'admin/assets/'; $suffix = ''; wp_enqueue_style( 'wp-color-picker' ); wp_enqueue_style( 'ast-setup', $admin_asset_uri . 'ast-setup-wizard.css', array( 'dashicons', 'install' ), AST_THEME_VERSION ); wp_register_script( 'iris', admin_url( 'js/iris.min.js' ),array( 'jquery-ui-draggable', 'jquery-ui-slider', 'jquery-touch-punch' ), false, 1 ); wp_register_script( 'wp-color-picker', admin_url( 'js/color-picker.min.js' ), array( 'iris' ), false,1 ); $colorpicker_l10n = array( 'clear' => __( 'Clear', 'astra-theme' ), 'defaultString' => __( 'Default', 'astra-theme' ), 'pick' => __( 'Select Color', 'astra-theme' ), ); wp_localize_script( 'wp-color-picker', 'wpColorPickerL10n', $colorpicker_l10n ); wp_enqueue_media(); wp_register_script( 'ast-setup', $admin_asset_uri . 'ast-setup-wizard.js', array( 'jquery' ), AST_THEME_VERSION, true ); if ( ! empty( $_POST['save_step'] ) && isset( $this->steps[ $this->step ]['handler'] ) ) { call_user_func( $this->steps[ $this->step ]['handler'] ); } ob_start(); $this->setup_wizard_header(); $this->setup_wizard_steps(); $this->setup_wizard_content(); $this->setup_wizard_footer(); exit; } /** * Get next step link */ public function get_next_step_link() { $keys = array_keys( $this->steps ); return add_query_arg( 'step', $keys[ array_search( $this->step, array_keys( $this->steps ) ) + 1 ] ); } /** * Setup Wizard Header. */ public function setup_wizard_header() { ?>
steps; array_shift( $ouput_steps ); ?> '; call_user_func( $this->steps[ $this->step ]['view'] ); echo ''; } /** * Introduction step. */ public function ast_setup_welcome() { ?>It\' completely optional and shouldn\'t take longer than five minutes.', 'astra-theme' ); ?>
get_next_step_link() ) ); exit; } /** * Child Theme Title. */ public function ast_child_theme_demo_save() { // check_admin_referer( 'ast-setup' ). wp_redirect( esc_url_raw( $this->get_next_step_link() ) ); exit; } /** * Locale settings */ public function ast_theme_config() { $text_color = ast_get_option( 'text-color' ); $link_color = ast_get_option( 'link-color' ); $link_hover_color = ast_get_option( 'link-h-color' ); $site_sidebar = ast_get_option( 'site-sidebar-layout' ); $defaults = Ast_Theme_Options::defaults(); $default_text_color = $defaults['text-color']; $default_link_color = $defaults['link-color']; $default_link_hover_color = $defaults['link-h-color']; ?> get_next_step_link() ) ); exit; } /** * Save Locale Settings. */ public function ast_theme_config_save() { check_admin_referer( 'ast-setup' ); $text_color = sanitize_text_field( $_POST['text-color'] ); $link_color = sanitize_text_field( $_POST['link-color'] ); $link_hover_color = sanitize_text_field( $_POST['link-h-color'] ); $site_sidebar = sanitize_text_field( $_POST['site-sidebar-layout'] ); $theme_options = Ast_Theme_Options::get_options(); $theme_options['text-color'] = $text_color; $theme_options['link-color'] = $link_color; $theme_options['link-h-color'] = $link_hover_color; $theme_options['site-sidebar-layout'] = $site_sidebar; update_option( 'ast-settings', $theme_options ); // Refresh Options. Ast_Theme_Options::refresh(); do_action( 'ast_onboarding_step_theme_confing' ); wp_redirect( esc_url_raw( $this->get_next_step_link() ) ); exit; } /** * Final step. */ public function ast_setup_ready() { ?>