Skip to content
wiki.fftac.org

Foundation - Source Excerpt 34

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

function antichrist_engine_foundation_get_research_record_id($prefix, $sequence)
{
    $prefix = strtoupper((string) preg_replace('/[^a-z0-9]/i', '', (string) $prefix));

    return sprintf('FFTAC-%s-%03d', $prefix, max(1, (int) $sequence));
}

/**
 * Extracts durable keyword terms for claim relationship matching.
 *
 * @param array<string, mixed> $claim Claim data.
 * @return array<int, string>
 */
function antichrist_engine_foundation_get_claim_keyword_terms($claim)
{
    $search_text = antichrist_engine_foundation_normalize_search_text(implode(' ', array(
        $claim['title'] ?? '',
        $claim['keywords'] ?? '',
        $claim['summary'] ?? '',
    )));

    return array_values(array_unique(array_filter(explode(' ', $search_text), static function ($term) {
        return strlen((string) $term) >= 4;
    })));
}

/**
 * Returns timeline data enriched with stable record IDs and URLs.
 *
 * @return array<int, array<string, mixed>>
 */
function antichrist_engine_foundation_get_enriched_timeline_entries()
{
    static $entries = null;

    if (null !== $entries) {
        return $entries;
    }

    $entries = array();

    foreach (antichrist_engine_foundation_antichrist_timeline() as $index => $entry) {
        $anchor            = 'timeline-' . sanitize_title((string) (($entry['year'] ?? '') . ' ' . ($entry['title'] ?? 'timeline')));
        $record_id         = antichrist_engine_foundation_get_research_record_id('TML', $index + 1);
        $record_request_url = antichrist_engine_foundation_get_research_record_request_url($record_id);

        $entries[] = array_merge($entry, array(
            'sequence'     => $index + 1,
            'record_id'    => $record_id,
            'anchor'       => $anchor,
            'atlas_url'    => antichrist_engine_foundation_build_target_url('research', array(), $anchor),
            'research_url' => antichrist_engine_foundation_build_target_url('research', array(), $anchor),
            'record_request_url' => $record_request_url,
            'record_url'   => $record_request_url . '#research-record',
            'record_type'  => 'timeline',
            'type_label'   => antichrist_engine_foundation_get_research_record_type_labels()['timeline'],
            'tag_count'    => count($entry['tags'] ?? array()),
        ));
    }

    return $entries;
}

/**
 * Returns briefing data enriched with stable record IDs and URLs.
 *
 * @return array<int, array<string, mixed>>
 */
function antichrist_engine_foundation_get_enriched_briefings()
{
    static $briefings = null;

    if (null !== $briefings) {
        return $briefings;
    }

    $briefings = array();

    foreach (antichrist_engine_foundation_executive_briefings() as $index => $briefing) {
        $anchor             = (string) ($briefing['anchor'] ?? 'executive-briefings');
        $record_id          = antichrist_engine_foundation_get_research_record_id('BRF', $index + 1);
        $record_request_url = antichrist_engine_foundation_get_research_record_request_url($record_id);

        $briefings[] = array_merge($briefing, array(
            'sequence'     => $index + 1,
            'record_id'    => $record_id,
            'atlas_url'    => antichrist_engine_foundation_build_target_url('research', array(), $anchor),
            'research_url' => antichrist_engine_foundation_build_target_url('research', array(), $anchor),
            'record_request_url' => $record_request_url,
            'record_url'   => $record_request_url . '#research-record',
            'record_type'  => 'briefing',
            'type_label'   => antichrist_engine_foundation_get_research_record_type_labels()['briefing'],
        ));
    }

    return $briefings;
}

/**
 * Returns source-library data enriched with record IDs, anchors, and claim references.
 *
 * @return array<string, array<string, mixed>>
 */
function antichrist_engine_foundation_get_research_source_lookup()
{
    static $sources = null;

    if (null !== $sources) {
        return $sources;
    }

    $sources = array();
    $claims  = antichrist_engine_foundation_claim_dossiers();

    foreach (antichrist_engine_foundation_research_sources() as $source_key => $source) {
        $sequence         = count($sources) + 1;
        $anchor           = 'source-' . $source_key;
        $claim_references = array();

        foreach ($claims as $claim_index => $claim) {
            if (!in_array($source_key, (array) ($claim['source_keys'] ?? array()), true)) {
                continue;
            }

            $claim_anchor             = 'claim-' . sanitize_title((string) ($claim['title'] ?? 'claim'));
            $claim_record_id          = antichrist_engine_foundation_get_research_record_id('CLM', $claim_index + 1);
            $claim_record_request_url = antichrist_engine_foundation_get_research_record_request_url($claim_record_id);

            $claim_references[] = array(
                'record_id'    => $claim_record_id,
                'title'        => (string) ($claim['title'] ?? ''),
                'anchor'       => $claim_anchor,
                'atlas_url'    => antichrist_engine_foundation_build_target_url('research', array(), $claim_anchor),
                'research_url' => antichrist_engine_foundation_build_target_url('research', array(), $claim_anchor),
                'record_request_url' => $claim_record_request_url,
                'record_url'   => $claim_record_request_url . '#research-record',
                'category'     => (string) ($claim['category'] ?? ''),
            );
        }

        $record_id          = antichrist_engine_foundation_get_research_record_id('SRC', $sequence);
        $record_request_url = antichrist_engine_foundation_get_research_record_request_url($record_id);

        $sources[$source_key] = array_merge(array(
            'key'            => $source_key,
            'sequence'       => $sequence,
            'record_id'      => $record_id,
            'anchor'         => $anchor,
            'atlas_url'      => antichrist_engine_foundation_build_target_url('research', array(), $anchor),
            'research_url'   => antichrist_engine_foundation_build_target_url('research', array(), $anchor),
            'record_request_url' => $record_request_url,
            'record_url'     => $record_request_url . '#research-record',
            'record_type'    => 'source',
            'type_label'     => antichrist_engine_foundation_get_research_record_type_labels()['source'],
            'citation_count' => count($claim_references),
            'claim_references' => $claim_references,
        ), $source);
    }

    return $sources;
}

/**
 * Returns claim dossiers enriched with stable IDs, source references, and dossier relationships.
 *
 * @return array<int, array<string, mixed>>
 */
function antichrist_engine_foundation_get_enriched_claim_dossiers()
{
    static $claims = null;

    if (null !== $claims) {
        return $claims;
    }

    $source_lookup = antichrist_engine_foundation_get_research_source_lookup();
    $base_claims   = array();

    foreach (antichrist_engine_foundation_claim_dossiers() as $index => $claim) {
        $anchor            = 'claim-' . sanitize_title((string) ($claim['title'] ?? 'claim'));
        $source_references = array();
        $record_id         = antichrist_engine_foundation_get_research_record_id('CLM', $index + 1);
        $record_request_url = antichrist_engine_foundation_get_research_record_request_url($record_id);

        foreach ((array) ($claim['source_keys'] ?? array()) as $source_key) {
            if (!isset($source_lookup[$source_key])) {
                continue;
            }

            $source_references[] = array(
                'key'            => (string) $source_lookup[$source_key]['key'],
                'record_id'      => (string) $source_lookup[$source_key]['record_id'],
                'title'          => (string) $source_lookup[$source_key]['title'],
                'publisher'      => (string) $source_lookup[$source_key]['publisher'],
                'anchor'         => (string) $source_lookup[$source_key]['anchor'],
                'atlas_url'      => (string) $source_lookup[$source_key]['atlas_url'],
                'research_url'   => (string) $source_lookup[$source_key]['research_url'],
                'record_request_url' => (string) $source_lookup[$source_key]['record_request_url'],
                'record_url'     => (string) $source_lookup[$source_key]['record_url'],
                'citation_count' => (int) $source_lookup[$source_key]['citation_count'],
            );
        }

        $base_claims[] = array_merge($claim, array(
            'sequence'          => $index + 1,
            'slug'              => sanitize_title((string) ($claim['title'] ?? 'claim')),