ComingSoonGuard
Corex\Config\Operations\ComingSoonGuard · class · Config layer
The public behaviour of Coming soon mode (spec 101): the launch page at the home URL with a 200, a temporary redirect to it from every other front-end address, and the real site for the people building it. This class does two things and decides neither. It gathers the facts about the request — it is the only class in the feature that asks WordPress who is signed in or what was asked for — and it carries out what {@see ComingSoonDecision} answers. The rules themselves are that class’s table, which is why they can be read, and tested, without a request. It is not {@see MaintenanceGuard} with a second mode. Maintenance answers 503 with a fixed card and admits administrators only; this answers 200 with the client’s own page, redirects, and admits anybody who can edit posts. Exactly one mode is in force, so the two never both act.
Public API
Section titled “Public API”__construct(OperationsModeStore $store, ComingSoonTemplate $template, ComingSoonSitemap $sitemap, PreviewAccess $preview)
Section titled “__construct(OperationsModeStore $store, ComingSoonTemplate $template, ComingSoonSitemap $sitemap, PreviewAccess $preview)”register(): void
Section titled “register(): void”handle(): void
Section titled “handle(): void”enqueuePageAssets(): void
Section titled “enqueuePageAssets(): void”The wp_enqueue_scripts callback for the served page: hands the moment on to whoever has assets for this page in particular.
servedBodyClasses(mixed $classes): array
Section titled “servedBodyClasses(mixed $classes): array”The body_class callback for the served page. It is marked as the coming-soon page, for a theme to scope its styles to; and it is not marked as a signed-in one, because a visitor’s page is not, and a theme may style by that mark.
decision(): ComingSoonDecision
Section titled “decision(): ComingSoonDecision”What this request gets. Sends nothing and ends nothing, so it is what the tests ask.
serve(mixed $chosen): string
Section titled “serve(mixed $chosen): string”The template_include callback for the serve outcome: the coming-soon template in place of whatever WordPress chose for the request, or the self-contained page when the active theme has no block templates to render one with (FR-009).
isHome(string $requestUri, string $homeUrl, array $queryVars): bool
Section titled “isHome(string $requestUri, string $homeUrl, array $queryVars): bool”Whether an address is the home URL: the home URL’s own path, with nothing in it that WordPress acts on. The path is what the visitor asked for, which is_front_page() is not — that answers for the query WordPress resolved, and a static or redirecting front page is one of the cases this has to survive. The query variables are the other half: /?feed=rss2, /?p=12 and /?s=launch all have the home path, and WordPress renders a feed before any template is chosen. A campaign tag is not a query variable WordPress knows, so it changes nothing.