core->cache->get( 'activation_redirect' ) ) { return; } // If we are redirecting, clear the transient so it only happens once. aioseo()->core->cache->delete( 'activation_redirect' ); // Check option to disable welcome redirect. if ( get_option( 'aioseo_activation_redirect', false ) ) { return; } // Only do this for single site installs. if ( isset( $_GET['activate-multi'] ) || is_network_admin() ) { // phpcs:ignore HM.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Recommended return; } wp_safe_redirect( admin_url( 'index.php?page=aioseo-setup-wizard' ) ); exit; } /** * Adds a dashboard page for our setup wizard. * * @since 4.0.0 * * @return void */ public function addDashboardPage() { add_dashboard_page( '', '', aioseo()->admin->getPageRequiredCapability( 'aioseo-setup-wizard' ), 'aioseo-setup-wizard', '' ); } /** * Hide the dashboard page from the menu. * * @since 4.1.5 * * @return void */ public function hideDashboardPageFromMenu() { remove_submenu_page( 'index.php', 'aioseo-setup-wizard' ); } /** * Checks to see if we should load the setup wizard. * * @since 4.0.0 * * @return void */ public function maybeLoadOnboardingWizard() { // Don't load the interface if doing an ajax call. if ( wp_doing_ajax() || wp_doing_cron() ) { return; } // Check for wizard-specific parameter // Allow plugins to disable the setup wizard // Check if current user is allowed to save settings. if ( // phpcs:disable HM.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Recommended ! isset( $_GET['page'] ) || 'aioseo-setup-wizard' !== sanitize_text_field( wp_unslash( $_GET['page'] ) ) || // phpcs:enable ! current_user_can( aioseo()->admin->getPageRequiredCapability( 'aioseo-setup-wizard' ) ) ) { return; } set_current_screen(); // Remove an action in the Gutenberg plugin ( not core Gutenberg ) which throws an error. remove_action( 'admin_print_styles', 'gutenberg_block_editor_admin_print_styles' ); // If we are redirecting, clear the transient so it only happens once. aioseo()->core->cache->delete( 'activation_redirect' ); $this->loadOnboardingWizard(); } /** * Load the Onboarding Wizard template. * * @since 4.0.0 * * @return void */ private function loadOnboardingWizard() { $this->enqueueScripts(); $this->setupWizardHeader(); $this->setupWizardContent(); $this->setupWizardFooter(); exit; } /** * Enqueue's scripts for the setup wizard. * * @since 4.0.0 * * @return void */ public function enqueueScripts() { // We don't want any plugin adding notices to our screens. Let's clear them out here. remove_all_actions( 'admin_notices' ); remove_all_actions( 'network_admin_notices' ); remove_all_actions( 'all_admin_notices' ); aioseo()->core->assets->load( 'src/vue/standalone/setup-wizard/main.js', [], aioseo()->helpers->getVueData( 'setup-wizard' ) ); aioseo()->main->enqueueTranslations(); wp_enqueue_style( 'common' ); wp_enqueue_media(); } /** * Outputs the simplified header used for the Onboarding Wizard. * * @since 4.0.0 * * @return void */ public function setupWizardHeader() { ?> >