[ 'title' => 'Your Site', 'desc' => 'Your site and social data', 'fn' => '\SiteSEO\Settings\OnBoarding::site_page', ], 'indexing' => [ 'title' => 'Indexing', 'desc' => 'Select post type indexing', 'fn' => '\SiteSEO\Settings\OnBoarding::indexing_page', ], 'advanced' => [ 'title' => 'Advanced', 'desc' => 'URL configuration', 'fn' => '\SiteSEO\Settings\OnBoarding::advanced_page', ], 'ready' => [ 'title' => 'Ready', 'desc' => 'All set now!', 'fn' => '\SiteSEO\Settings\OnBoarding::ready_page', ], ]; $active_plugins = get_option('active_plugins', []); $importable_plugins = Util::importable_plugins(); $importable_plugins = array_keys($importable_plugins); $importable_found = array_intersect($active_plugins, $importable_plugins); if(!empty($importable_found)){ $import_step = [ 'import' => [ 'title' => 'Import', 'desc' => 'Importing meta data', 'fn' => '\SiteSEO\Settings\OnBoarding::import_page', ] ]; self::$steps = array_merge($import_step, self::$steps); self::$import_options = $importable_found; } self::$current_step = !empty($_REQUEST['step']) ? sanitize_text_field(wp_unslash($_REQUEST['step'])) : ''; remove_all_actions('admin_notices'); remove_all_actions('all_admin_notices'); remove_all_actions('network_admin_notices'); add_action('admin_menu', '\SiteSEO\Settings\OnBoarding::add_to_menu'); add_action('admin_init', '\SiteSEO\Settings\OnBoarding::page'); } static function enqueue_assets(){ wp_enqueue_media(); wp_enqueue_script('siteseo-onboarding', SITESEO_ASSETS_URL . '/js/onboarding.js', ['jquery'], SITESEO_VERSION, true); wp_enqueue_style('siteseo-onboarding' , SITESEO_ASSETS_URL . '/css/onboarding.css', [], SITESEO_VERSION); wp_add_inline_script('siteseo-onboarding', "let siteseo_onboarding = ".wp_json_encode([ 'nonce' => wp_create_nonce('siteseo_admin_nonce'), 'ajax_url' => admin_url('admin-ajax.php'), ])); } static function add_to_menu(){ add_submenu_page('', __('SiteSEO Onboarding', 'siteseo'), 'Onboarding', 'siteseo_manage', 'siteseo-onboarding', 'SiteSEO\Settings\Onboarding::wizard'); } static function page(){ self::enqueue_assets(); ob_start(); ?> > '.esc_html__('SiteSEO OnBoarding', 'siteseo').''; wp_print_head_scripts(); wp_print_styles('siteseo-onboarding'); echo ' '; self::wizard(); if(function_exists('wp_print_media_templates')){ wp_print_media_templates(); } wp_print_footer_scripts(); wp_print_scripts('siteseo-onboarding'); echo ' '; die(); } static function wizard(){ echo '
'; self::welcome_page(); foreach(self::$steps as $step){ call_user_func($step['fn']); self::$current_step_no++; // increasing the step number after we have rendered the step page. } echo '
'; } static function welcome_page(){ $is_active = empty(self::$current_step) ? 'siteseo-step-active' : ''; echo '

'.esc_html__('Welcome to the SiteSEO Setup Wizard', 'siteseo').'

'.esc_html__('This wizard will guide you through setting up SiteSEO and help you get started in no time.', 'siteseo').'

'; } static function import_page(){ $is_active = !empty(self::$current_step) && self::$current_step == 'import' ? 'siteseo-step-active' : ''; echo '
Step '.esc_html(self::$current_step_no).' of '.count(self::$steps).'

'.esc_html__('Import data from your current SEO plugin', 'siteseo').'

'.esc_html__('SiteSEO has detected the presence of other SEO plugins. To ensure a smooth transition, please select the plugins you wish to import SEO data from', 'siteseo').'

'; $importable_plugins = Util::importable_plugins(); echo '
'; foreach(self::$import_options as $plugin){ $id = strtolower(str_replace(' ', '-', $plugin)); echo ' '; } echo '
'.esc_html__('What will be imported?', 'siteseo').'
  • '. esc_html__('Title tags', 'siteseo') .'
  • '. esc_html__('Meta description', 'siteseo') .'
  • '. esc_html__('Facebook Open Graph tags (title, description and image thumbnail)', 'siteseo') .'
  • '. esc_html__('Twitter tags (title, description and image thumbnail)', 'siteseo') .'
  • '. esc_html__('Meta Robots (noindex, nofollow...)', 'siteseo') .'
  • '. esc_html__('Canonical URL', 'siteseo').'
  • '. esc_html__('Focus / target keywords', 'siteseo') .'

'; } static function site_page(){ $title_options = get_option('siteseo_titles_option_name', []); $social_options = get_option('siteseo_social_option_name', []); $site_name = !empty($title_options['titles_home_site_title']) ? $title_options['titles_home_site_title'] : '%%sitetitle%%'; $alt_site_name = !empty($title_options['titles_home_site_title_alt']) ? $title_options['titles_home_site_title_alt'] : ''; $site_type = !empty($social_options['social_knowledge_type']) ? $social_options['social_knowledge_type'] : ''; $org_name = !empty($social_options['social_knowledge_name']) ? $social_options['social_knowledge_name'] : ''; $org_img = !empty($social_options['social_knowledge_img']) ? $social_options['social_knowledge_img'] : ''; $fb_url = !empty($social_options['social_accounts_facebook']) ? $social_options['social_accounts_facebook'] : ''; $x_account = !empty($social_options['social_accounts_twitter']) ? $social_options['social_accounts_twitter'] : ''; $additional_url = !empty($social_options['social_accounts_additional']) ? implode("\n", $social_options['social_accounts_additional']) : ''; $is_active = !empty(self::$current_step) && self::$current_step == 'your-site' ? 'siteseo-step-active' : ''; echo '
Step '.esc_html(self::$current_step_no).' of '.count(self::$steps).'

Your Site: '.esc_html(get_bloginfo('name')).'

'.esc_html__('We need some basic information about your site, so we can built up the knowledge graph', 'siteseo').'

'.esc_html__('Enter the name of your site as it should appear in search results, %%sitetitle%% is a dynamic variable for your site title', 'siteseo').'

'.esc_html__('The website\'s alternate name, like a common acronym or shorter version, if applicable.', 'siteseo').'

'.esc_html__('A square image is preferred, with a minimum size of 112x112 pixels.', 'siteseo').'

Social Details

'.esc_html__('Enter 1 URL per line.', 'siteseo').'

'; } static function indexing_page(){ $is_active = !empty(self::$current_step) && self::$current_step == 'indexing' ? 'siteseo-step-active' : ''; $post_types = get_post_types(['public' => true, 'show_ui' => true], 'objects', 'and'); unset($post_types['attachment']); $taxonomies = get_taxonomies(['public' => true, 'show_ui' => true], 'objects', 'and'); echo '
Step '.esc_html(self::$current_step_no).' of '.count(self::$steps).'

Indexing

'.esc_html__('Let us know which parts of your website you’d like to be crawled.', 'siteseo').'

'.esc_html__('If your site is under construction then Search Engines will be discouraged to crawl your site by adding noindex metatag attribute and sitemap will be disabled.', 'siteseo').'

'.esc_html__('Choose items to exclude from search results', 'siteseo').'

'; if(!empty($post_types)){ foreach($post_types as $post){ echo '
'; } echo '

'.esc_html__('Discourage search engines from indexing these post types.', 'siteseo').'

'; } else { echo '

'.esc_html__('No post type found.', 'siteseo').'

'; } //TODO:: Will need to add options for Archive as well echo '
'; if(!empty($taxonomies)){ foreach($taxonomies as $taxonomy){ echo '
'; } echo '

'.esc_html__('Discourage search engines from indexing these taxonomies.', 'siteseo').'

'.esc_html__('Note: We strongly recommend disabling the indexing of tags to avoid potential duplicate content issues that could negatively impact your site\'s SEO.', 'siteseo').'

'; } else { echo '

'.esc_html__('No taxonomy found.', 'siteseo').'

'; } echo '
'; } static function advanced_page(){ $is_active = !empty(self::$current_step) && self::$current_step == 'advanced' ? 'siteseo-step-active' : ''; echo '
Step '.esc_html(self::$current_step_no).' of '.count(self::$steps).'

Advanced Options

'.esc_html__('We\'re nearly there—just a few final optimizations left!', 'siteseo').'

'.esc_html__('Universal metabox makes SiteSEO on page content SEO helper compatible with every Page Builder, so if you are not using Gutenberg then this is a must.', 'siteseo').'

'.esc_html__('Recommended: Enable this option if you are the sole author of the site to prevent duplicate content on author archive pages.', 'siteseo').'

'.esc_html__('By default SiteSEO redirects to the parent post.', 'siteseo').'

'.esc_html__('This reduces the length of the URL.', 'siteseo').'

'; } static function ready_page(){ $is_active = !empty(self::$current_step) && self::$current_step == 'ready' ? 'siteseo-step-active' : ''; echo '
Step '.esc_html(self::$current_step_no).' of '.count(self::$steps).'

Done! 🎉

'.esc_html__('We are done with the setup, now you can start making content and submit the Sitemap to the search engines.', 'siteseo').'

'.esc_html__('What Next?', 'siteseo').'

  1. '.esc_html__('Configure your Sitemap', 'siteseo').'
  2. '.esc_html__('Submit yours sitemap to search engines', 'siteseo').'

'.esc_html__('You can also, subscribe to our newletter', 'siteseo').'

'.esc_html__('You will get', 'siteseo').' '.esc_html__('Subscribe', 'siteseo').'
'; } }