Yoast\WP\SEO\Dashboard\User_Interface\Setup

Setup_Url_Interceptor::intercept_site_kit_setup_url_redirect()publicYoast 1.0

Checks if we are trying to reach a site kit setup url and sets the needed transient in between.

Метод класса: Setup_Url_Interceptor{}

Хуков нет.

Возвращает

null. Ничего (null).

Использование

$Setup_Url_Interceptor = new Setup_Url_Interceptor();
$Setup_Url_Interceptor->intercept_site_kit_setup_url_redirect();

Код Setup_Url_Interceptor::intercept_site_kit_setup_url_redirect() Yoast 25.1

public function intercept_site_kit_setup_url_redirect() {
	$allowed_setup_links = [
		$this->site_kit_configuration->get_install_url(),
		$this->site_kit_configuration->get_activate_url(),
		$this->site_kit_configuration->get_setup_url(),
		$this->site_kit_configuration->get_update_url(),
	];

	// Are we on the in-between page?
	if ( $this->current_page_helper->get_current_yoast_seo_page() === self::PAGE ) {
		// Check if parameter is there and is valid.
		// phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Reason: We are not processing form information.
		if ( isset( $_GET['redirect_setup_url'] ) && \in_array( \wp_unslash( $_GET['redirect_setup_url'] ), $allowed_setup_links, true ) ) {
			// We overwrite the transient for each time this redirect is hit to keep refreshing the time.
			\set_transient( self::SITE_KIT_SETUP_TRANSIENT, 1, ( \MINUTE_IN_SECONDS * 15 ) );
			// phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized -- Reason: Only allowed pre verified links can end up here.
			$redirect_url = \wp_unslash( $_GET['redirect_setup_url'] );
			$this->redirect_helper->do_safe_redirect( $redirect_url, 302, 'Yoast SEO' );

		}
		else {
			$this->redirect_helper->do_safe_redirect( \self_admin_url( 'admin.php?page=wpseo_dashboard' ), 302, 'Yoast SEO' );
		}
	}
}