true, // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- read-only check of WordPress' own bulk-activation marker. 'bulk' => isset( $_GET['activate-multi'] ), 'network' => is_network_admin(), 'ajax' => wp_doing_ajax(), 'rest' => defined( 'REST_REQUEST' ) && REST_REQUEST, 'cli' => defined( 'WP_CLI' ) && WP_CLI, 'canManage' => current_user_can( 'manage_options' ), 'status' => $state->exists() ? $state->status() : null, 'hasActiveForm' => false, ); if ( $context['status'] === null ) { $context['hasActiveForm'] = self::hasActiveForm(); } if ( ! self::shouldRedirect( $context ) ) { return; } $state->initialize(); wp_safe_redirect( admin_url( self::TARGET ) ); exit; } /** * Whether any form of any available integration has Double Opt-In on. */ private static function hasActiveForm(): bool { if ( ! class_exists( FormIntegrationRegistry::class ) ) { return false; } foreach ( FormIntegrationRegistry::getInstance()->getAvailable() as $integration ) { foreach ( $integration->getForms() as $form ) { if ( ! empty( $form['enabled'] ) ) { return true; } } } return false; } }