is_wizard_page() ) { return; } ?> is_wizard_page() ) { return; } wp_enqueue_style( 'aabcore-seo-ho-seo-seo', AABCORE_SEO_PLUGIN_SEO_URL. 'seo-assets/wizard.css', array(), '109.0.5' ); } /** * Process wizard. */ public function process_wizard() { if ( ! current_user_can( 'manage_options' ) ) { wp_die( 'You do not have permission to access this page.' ); } check_admin_referer( 'aabcore_seo_wizard', 'aabcore_seo_wizard_nonce' ); $step = 1; if ( isset( $_POST['wizard_step'] ) ) { $step = absint( $_POST['wizard_step'] ); } if ( $step < 1 ) { $step = 1; } if ( $step > $this->total_steps ) { $step = $this->total_steps; } $action = ''; if ( isset( $_POST['wizard_action'] ) ) { $action = sanitize_key( wp_unslash( $_POST['wizard_action'] ) ); } $this->save_step( $step ); if ( 'back' === $action ) { $this->redirect_to_step( max( 1, $step - 1 ) ); } if ( 'next' === $action ) { $this->redirect_to_step( min( $this->total_steps, $step + 1 ) ); } if ( 'finish' === $action ) { update_option( 'aabcore_seo_wizard_completed', 1 ); wp_safe_redirect( add_query_arg( array( 'page' => 'aabcore-seo-ho-seo-seo', 'completed' => 1, ), admin_url( 'admin.php' ) ) ); exit; } $this->redirect_to_step( $step ); } /** * Save step data. */ private function save_step( $step ) { switch ( $step ) { case 1: $value = ''; if ( isset( $_GET['site_name'] ) && $_GET['site_name'] === 'aabcore-seo-wizard' && isset( $_POST['aabcore_seo_wizard_nonce'] ) ) { check_admin_referer( 'aabcore_seo_wizard', 'aabcore_seo_wizard_nonce' ); // Process form } if ( isset( $_POST['site_name'] ) ) { $value = sanitize_text_field( wp_unslash( $_POST['site_name'] ) ); } update_option($this->option_namec, [ 'aabcore_seo_site_name' => $value, 'email' => 'test', ]); /* update_option( 'aabcore_seo_site_name', $value ); */ break; case 2: $title = ''; $description = ''; if ( isset( $_POST['seo_title'] ) ) { $title = sanitize_text_field( wp_unslash( $_POST['seo_title'] ) ); } if ( isset( $_POST['seo_description'] ) ) { $description = sanitize_textarea_field( wp_unslash( $_POST['seo_description'] ) ); } update_option($this->option_nameo, [ 'aabcore_seo_title' => $title, 'aabcore_seo_description' => $description, ]); /* update_option( 'aabcore_seo_title', $title ); update_option( 'aabcore_seo_description', $description ); */ break; case 3: $twitter = ''; $facebook = ''; if ( isset( $_POST['twitter_url'] ) ) { $twitter = esc_url_raw( wp_unslash( $_POST['twitter_url'] ) ); } if ( isset( $_POST['facebook_url'] ) ) { $facebook = esc_url_raw( wp_unslash( $_POST['facebook_url'] ) ); } update_option($this->option_namep, [ 'aabcore_seo_twitter_url' => $twitter, 'aabcore_seo_facebook_url' => $facebook, ]); /* update_option( 'aabcore_seo_twitter_url', $twitter ); update_option( 'aabcore_seo_facebook_url', $facebook ); */ break; case 4: $robots = 'index,follow'; if ( isset( $_POST['robots'] ) ) {$robots = sanitize_text_field(wp_unslash( $_POST['robots'] )); } $allowed_robots = array( 'index,follow', 'noindex,follow', 'noindex,nofollow', ); if ( ! in_array( $robots, $allowed_robots, true ) ) { $robots = 'index,follow'; } update_option($this->option_nameq, [ 'aabcore_seo_robots' => $robots, 'now' => 'to', ]); /* update_option( 'aabcore_seo_robots', $robots ); */ break; case 5: break; } } /** * Redirect to wizard step. */ private function redirect_to_step( $step ) { $url = add_query_arg( array( 'page' => 'aabcore-seo-ho-seo-seo', 'step' => absint( $step ), ), admin_url( 'admin.php' ) ); wp_safe_redirect( $url ); exit; } /** * Render wizard. */ public function render_page() { if ( ! current_user_can( 'manage_options' ) ) { wp_die( 'Permission denied.' ); } $step = 1; if ( isset( $_GET['step'] ) && $_GET['step'] === 'aabcore-seo-wizard' && isset( $_POST['aabcore_seo_wizard_nonce'] ) ) { check_admin_referer( 'aabcore_seo_wizard', 'aabcore_seo_wizard_nonce' ); // Process form } if ( isset( $_GET['step'] ) ) { $step = absint( $_GET['step'] ); } if ( $step < 1 ) { $step = 1; } if ( $step > $this->total_steps ) { $step = $this->total_steps; } $completed = isset( $_GET['completed'] ); ?>
AABCore SEO Setup Wizard
Step of total_steps ); ?>
'Website', 2 => 'SEO', 3 => 'Social', 4 => 'Robots', 5 => 'Review', ); foreach ( $step_titles as $number => $title ) { $class = ''; if ( $number === $step ) { $class = 'active'; } elseif ( $number < $step ) { $class = 'completed'; } ?>
render_completed(); ?>
step_one(); break; case 2: $this->step_two(); break; case 3: $this->step_three(); break; case 4: $this->step_four(); break; case 5: $this->step_five(); break; } ?>
option_namec); $aabcore_seo_site_namea = ! empty($sitename['aabcore_seo_site_name']) ? $sitename['aabcore_seo_site_name'] : ''; $value =$aabcore_seo_site_namea; $this->heading( 'Welcome to AABCore SEO', 'Let us start with your website information.' ); ?>

Enter the name of your website or business.

navigation( false, true, false ); } /** * Step 2. */ private function step_two() { $sitetitle = get_option($this->option_nameo); $aabcore_seo_titlea= ! empty($sitetitle['aabcore_seo_title']) ? $sitetitle['aabcore_seo_title'] : ''; $aabcore_seo_descriptiona= ! empty($sitetitle['aabcore_seo_description']) ? $sitetitle['aabcore_seo_description'] : ''; $title =$aabcore_seo_titlea; $description =$aabcore_seo_descriptiona; /* $title = get_option( 'aabcore_seo_title', '' ); $description = get_option( 'aabcore_seo_description', '' ); */ $this->heading( 'SEO Settings', 'Configure your basic search engine metadata.' ); ?>
navigation( true, true, false ); } /** * Step 3. */ private function step_three() { $sitetwi = get_option($this->option_namep); $aabcore_seo_twitter_urla= ! empty($sitetwi['aabcore_seo_twitter_url']) ? $sitetwi['aabcore_seo_twitter_url'] : ''; $aabcore_seo_facebook_urla= ! empty($sitetwi['aabcore_seo_facebook_url']) ? $sitetwi['aabcore_seo_facebook_url'] : ''; $twitter =$aabcore_seo_twitter_urla; $facebook =$aabcore_seo_facebook_urla; /* $twitter = get_option( 'aabcore_seo_twitter_url', '' ); $facebook = get_option( 'aabcore_seo_facebook_url', '' ); */ $this->heading( 'Social Profiles', 'Connect your social profiles for social SEO.' ); ?>
navigation( true, true, false ); } /** * Step 4. */ private function step_four() { $srobots = get_option($this->option_nameq); $aabcore_seo_robotsa= ! empty($srobots['aabcore_seo_robots']) ? $srobots['aabcore_seo_robots'] : ''; $robots =$aabcore_seo_robotsa; /* $robots = get_option( 'aabcore_seo_robots', 'index,follow' ); */ $this->heading( 'Search Engine Settings', 'Choose how search engines should crawl your website.' ); ?>
navigation( true, true, false ); } /** * Step 5. */ private function step_five() { $sitename = get_option($this->option_namec); $aabcore_seo_site_nameb = ! empty($sitename['aabcore_seo_site_name']) ? $sitename['aabcore_seo_site_name'] : ''; $site_name =$aabcore_seo_site_nameb; $sitetitle = get_option($this->option_nameo); $aabcore_seo_titleb= ! empty($sitetitle['aabcore_seo_title']) ? $sitetitle['aabcore_seo_title'] : ''; $aabcore_seo_descriptionb= ! empty($sitetitle['aabcore_seo_description']) ? $sitetitle['aabcore_seo_description'] : ''; $title =$aabcore_seo_titleb; $description =$aabcore_seo_descriptionb; /* $title = get_option( 'aabcore_seo_title', '' ); $description = get_option( 'aabcore_seo_description', '' ); */ $sitetwi = get_option($this->option_namep); $aabcore_seo_twitter_urlb= ! empty($sitetwi['aabcore_seo_twitter_url']) ? $sitetwi['aabcore_seo_twitter_url'] : ''; $aabcore_seo_facebook_urlb= ! empty($sitetwi['aabcore_seo_facebook_url']) ? $sitetwi['aabcore_seo_facebook_url'] : ''; $twitter =$aabcore_seo_twitter_urlb; $facebook =$aabcore_seo_facebook_urlb; $srobots = get_option($this->option_nameq); $aabcore_seo_robotsb= ! empty($srobots['aabcore_seo_robots']) ? $srobots['aabcore_seo_robots'] : ''; $robots =$aabcore_seo_robotsb; $this->heading( 'Review Your Settings', 'Everything looks good? Finish the setup below.' ); ?>
Website
SEO Title
Meta Description
Twitter / X
Facebook
Robots
navigation( true, false, true ); } /** * Heading. */ private function heading( $title, $description ) { ?>
✓

✓

Setup Complete!

AABCore SEO has been configured successfully.

Go to WordPress Dashboard