Skip to content
wiki.fftac.org

Foundation - Source Excerpt 21

Back to Foundation

Summary

This source excerpt preserves a bounded section of Anti-Christ.org/wp-content/plugins/fftac-foundation-core/inc/foundation.php so readers can inspect the evidence without opening the full source file.

**Source path:** Anti-Christ.org/wp-content/plugins/fftac-foundation-core/inc/foundation.php

? sprintf(
                /* translators: %d is the number of missing provisioned pages. */
                _n('%d provisioned page is missing an ID.', '%d provisioned pages are missing IDs.', count($missing_pages), 'antichrist-engine'),
                count($missing_pages)
            )
            : __('All provisioned Foundation pages have stored IDs.', 'antichrist-engine'),
        'action' => $missing_pages
            ? implode(', ', array_slice($missing_pages, 0, 6))
            : __('No action needed unless page slugs or templates change.', 'antichrist-engine'),
    );

    $checks[] = array(
        'id' => 'form-storage',
        'label' => __('Private form storage', 'antichrist-engine'),
        'status' => $missing_post_types ? 'blocked' : 'ready',
        'summary' => $missing_post_types
            ? __('One or more private intake post types are not registered.', 'antichrist-engine')
            : __('Signals, contact, and program-intake storage post types are registered.', 'antichrist-engine'),
        'action' => $missing_post_types ? implode(', ', $missing_post_types) : __('No action needed.', 'antichrist-engine'),
    );

    $checks[] = array(
        'id' => 'intake-exports',
        'label' => __('Launch intake exports', 'antichrist-engine'),
        'status' => $missing_post_types ? 'blocked' : 'ready',
        'summary' => sprintf(
            /* translators: %d is the total number of stored private intake records. */
            _n('%d private intake record is export-ready.', '%d private intake records are export-ready.', $intake_total, 'antichrist-engine'),
            $intake_total
        ),
        'action' => __('Use the intake export buttons on this page before migrating records into external newsletter, support, or program tooling.', 'antichrist-engine'),
    );

    if (function_exists('antichrist_engine_foundation_participants_database_get_readiness_check')) {
        $checks[] = antichrist_engine_foundation_participants_database_get_readiness_check();
    }

    $checks[] = array(
        'id' => 'research-data',
        'label' => __('Research API and exports', 'antichrist-engine'),
        'status' => (count($api_routes) >= 10 && count($download_routes) >= 6) ? 'ready' : 'attention',
        'summary' => sprintf(
            /* translators: 1: endpoint count, 2: download route count. */
            __('%1$d API routes and %2$d generated download routes are mapped.', 'antichrist-engine'),
            count($api_routes),
            count($download_routes)
        ),
        'action' => __('Verify the REST namespace and export links after the production domain is final.', 'antichrist-engine'),
    );

    $checks[] = array(
        'id' => 'security-headers',
        'label' => __('Security headers', 'antichrist-engine'),
        'status' => count($security_headers) >= 5 ? 'ready' : 'attention',
        'summary' => sprintf(
            /* translators: %d is the number of configured security headers. */
            _n('%d baseline security header is configured.', '%d baseline security headers are configured.', count($security_headers), 'antichrist-engine'),
            count($security_headers)
        ),
        'action' => __('Host-level TLS, WAF, bot protection, and caching still need production review.', 'antichrist-engine'),
    );

    $checks[] = array(
        'id' => 'support-destination',
        'label' => __('Support destination', 'antichrist-engine'),
        'status' => !empty($support_destination['is_live']) ? 'ready' : 'attention',
        'summary' => !empty($support_destination['is_live'])
            ? __('A live support URL is configured.', 'antichrist-engine')
            : __('Support currently routes through the contact desk fallback.', 'antichrist-engine'),
        'action' => __('Configure a live support URL only when external payment or donation tooling is ready.', 'antichrist-engine'),
    );

    $checks[] = array(
        'id' => 'ai-engine',
        'label' => __('AI Engine key', 'antichrist-engine'),
        'status' => $ai_engine_loaded ? ($ai_key ? 'ready' : 'attention') : 'blocked',
        'summary' => $ai_engine_loaded
            ? ($ai_key
                ? __('A limited Foundation OpenAI API key is available for short signed-in AI prompts.', 'antichrist-engine')
                : __('No Foundation OpenAI API key is configured; signed-in users can still save a personal key for live responses.', 'antichrist-engine'))
            : __('The FFTAC AI Engine plugin is not active, so live AI routes and key handling are unavailable.', 'antichrist-engine'),
        'action' => $ai_engine_loaded
            ? __('Add a Foundation key in Settings -> Reading or set OPENAI_API_KEY in hosting with provider-side budgets and alerts; larger user requests should use personal keys.', 'antichrist-engine')
            : __('Activate FFTAC AI Engine after FFTAC Foundation Core.', 'antichrist-engine'),
    );

    $checks[] = array(
        'id' => 'analytics-events',
        'label' => __('Analytics event hooks', 'antichrist-engine'),
        'status' => 'ready',
        'summary' => __('Theme JavaScript dispatches antichrist:analytics events and dataLayer payloads.', 'antichrist-engine'),
        'action' => __('Connect the selected privacy-aware analytics provider when the external stack is chosen.', 'antichrist-engine'),
    );

    return (array) apply_filters('antichrist_engine_launch_readiness_checks', $checks);
}

/**
 * Summarizes launch-readiness statuses.
 *
 * @param array<int, array<string, string>>|null $checks Optional checks.
 * @return array<string, int>
 */
function antichrist_engine_foundation_get_launch_readiness_summary($checks = null)
{
    $summary = array(
        'ready' => 0,
        'attention' => 0,
        'blocked' => 0,
    );

    foreach ((array) ($checks ?: antichrist_engine_foundation_get_launch_readiness_checks()) as $check) {
        $status = sanitize_key((string) ($check['status'] ?? 'attention'));

        if (!isset($summary[$status])) {
            $summary[$status] = 0;
        }

        $summary[$status]++;
    }

    return $summary;
}

/**
 * Returns the current theme-owned go-live operations checklist.
 *
 * This intentionally includes human/external tasks so operators can see what
 * is ready in theme code and what still needs a launch owner outside code.
 *
 * @return array<int, array<string, mixed>>
 */
function antichrist_engine_foundation_get_launch_operations_checklist()
{
    $checks = antichrist_engine_foundation_get_launch_readiness_checks();
    $summary = antichrist_engine_foundation_get_launch_readiness_summary($checks);
    $visibility = antichrist_engine_foundation_get_launch_visibility_status();
    $intake_summary = antichrist_engine_foundation_get_intake_operations_summary();
    $research_counts = (array) (antichrist_engine_foundation_get_research_api_overview()['counts'] ?? array());
    $download_routes = antichrist_engine_foundation_get_research_export_download_route_map();
    $support_destination = antichrist_engine_foundation_get_support_destination();
    $proof_gates = antichrist_engine_foundation_launch_proof_gates();
    $site_state = !empty($summary['blocked'])
        ? 'blocked'
        : (!empty($summary['attention']) ? 'attention' : 'ready');

    return array(
        array(
            'id'      => 'theme-state',
            'label'   => __('Theme readiness state', 'antichrist-engine'),
            'status'  => $site_state,
            'summary' => sprintf(
                /* translators: 1: ready count, 2: attention count, 3: blocked count. */
                __('%1$d checks ready, %2$d need attention, %3$d blocked.', 'antichrist-engine'),
                (int) ($summary['ready'] ?? 0),
                (int) ($summary['attention'] ?? 0),
                (int) ($summary['blocked'] ?? 0)
            ),
            'actions' => array(
                __('Resolve any blocked checks before promotion.', 'antichrist-engine'),
                __('Run the local theme test sweep before building a release package.', 'antichrist-engine'),
            ),
        ),
        array(
            'id'      => 'indexing-switch',
            'label'   => __('Indexing switch', 'antichrist-engine'),
            'status'  => !empty($visibility['allows_indexing']) ? 'ready' : 'attention',
            'summary' => !empty($visibility['allows_indexing'])
                ? __('Eligible public views may be indexed.', 'antichrist-engine')
                : sprintf(
                    /* translators: %s is the launch visibility mode. */
                    __('Launch visibility is "%s"; indexing remains blocked until the mode is public and WordPress search visibility allows indexing.', 'antichrist-engine'),