Skip to content
wiki.fftac.org

Template Research - Source Excerpt 01

Back to Template Research

Summary

This source excerpt preserves a bounded section of Anti-Christ.org/wp-content/themes/antichrist-engine/template-research.php so readers can inspect the evidence without opening the full source file.

**Source path:** Anti-Christ.org/wp-content/themes/antichrist-engine/template-research.php

<?php
/**
 * Template Name: Research Program
 * Template Post Type: page
 *
 * @package Antichrist_Engine
 */

get_header();

the_post();

$identity          = antichrist_engine_foundation_identity();
$document_profile  = antichrist_engine_foundation_document_profile('research');
$reference_links   = antichrist_engine_foundation_get_reference_links('research');
$assurances        = antichrist_engine_foundation_public_assurances();
$labs              = antichrist_engine_foundation_research_labs();
$frameworks        = antichrist_engine_foundation_antichrist_frameworks();
$timeline          = antichrist_engine_foundation_get_enriched_timeline_entries();
$claims            = antichrist_engine_foundation_get_enriched_claim_dossiers();
$projection_ledger = antichrist_engine_foundation_get_projection_ledger_entries();
$verdicts          = antichrist_engine_foundation_claim_verdicts();
$evidence_levels   = antichrist_engine_foundation_claim_evidence_levels();
$fact_check        = antichrist_engine_foundation_get_research_fact_check_summary();
$sources           = antichrist_engine_foundation_get_research_source_lookup();
$briefings         = antichrist_engine_foundation_get_enriched_briefings();
$network_map       = antichrist_engine_foundation_get_research_connection_map();
$paths             = antichrist_engine_foundation_deconstruction_paths();
$signals           = antichrist_engine_foundation_contemporary_signals();
$quiz              = antichrist_engine_foundation_research_quiz();
$api_copy          = antichrist_engine_foundation_research_api_copy();
$api_routes        = antichrist_engine_foundation_get_research_api_route_map();
$api_endpoint_items = antichrist_engine_foundation_get_research_api_endpoint_items();
$export_downloads = antichrist_engine_foundation_get_research_export_downloads();
$research_command_copy = antichrist_engine_foundation_research_command_copy();
$research_command_presets = antichrist_engine_foundation_research_command_presets();
$research_url      = antichrist_engine_foundation_get_page_url('research');
$record_clear_url  = antichrist_engine_foundation_build_target_url('research', array(), 'research-command');
$source_groups     = array();

foreach ($sources as $source_key => $source) {
    $group = (string) ($source['group'] ?? __('Sources', 'antichrist-engine'));

    if (!isset($source_groups[$group])) {
        $source_groups[$group] = array();
    }

    $source_groups[$group][$source_key] = $source;
}

$timeline_filters  = antichrist_engine_foundation_get_timeline_categories();
$claim_filters     = antichrist_engine_foundation_get_claim_categories();
$claim_verdict_filters = antichrist_engine_foundation_get_claim_verdict_keys();
$timeline_labels   = antichrist_engine_foundation_get_timeline_category_labels();
$claim_labels      = antichrist_engine_foundation_get_claim_category_labels();
$quick_links       = array(
    'research-command'      => __('Research Command', 'antichrist-engine'),
    'executive-briefings'  => __('Executive Briefings', 'antichrist-engine'),
    'research-lenses'      => __('Research Lenses', 'antichrist-engine'),
    'framework-map'        => __('Framework Map', 'antichrist-engine'),
    'historical-timeline'  => __('Historical Timeline', 'antichrist-engine'),
    'projection-ledger'    => __('Projection Ledger', 'antichrist-engine'),
    'fact-check-board'     => __('Fact-Check Board', 'antichrist-engine'),
    'research-network'     => __('Research Network', 'antichrist-engine'),
    'claim-index'          => __('Claim Index', 'antichrist-engine'),
    'source-library'       => __('Source Library', 'antichrist-engine'),
    'deconstruction-guide' => __('Deconstruction Guide', 'antichrist-engine'),
    'framework-self-test'  => __('Lens Self-Test', 'antichrist-engine'),
    'contemporary-signals' => __('Contemporary Signals', 'antichrist-engine'),
    'research-api'         => __('Research API', 'antichrist-engine'),
    'export-desk'          => __('Export Desk', 'antichrist-engine'),
);
$research_filters  = antichrist_engine_foundation_get_research_filter_state();
$active_record     = antichrist_engine_foundation_get_active_research_record($research_filters);
$active_record_id  = (string) ($active_record['record_id'] ?? '');
$record_not_found  = !empty($research_filters['record']) && empty($active_record);
$timeline_total    = count($timeline);
$claim_total       = count($claims);
$projection_total  = count($projection_ledger);
$timeline_visibility = array();
$claim_visibility  = array();
$projection_visibility = array();
$claim_anchors     = array();
$claim_search_indices = array();
$timeline_filter_label = '';
$claim_filter_label    = '';
$claim_verdict_label   = '';
$projection_filter_label = '';
$network_kind_label    = '';
$network_category_label = '';
$timeline_visible_count = 0;
$claim_visible_count    = 0;
$projection_visible_count = 0;
$network_visible_count  = 0;
$claim_query            = (string) $research_filters['claim_q_normalized'];
$projection_query       = (string) $research_filters['projection_q_normalized'];
$network_query          = (string) $research_filters['map_q_normalized'];
$network_total          = count((array) ($network_map['source_hubs'] ?? array())) + count((array) ($network_map['claim_bridges'] ?? array())) + count((array) ($network_map['claim_lanes'] ?? array()));
$network_kind_filters   = array(
    'all'    => __('All map items', 'antichrist-engine'),
    'source' => __('Source hubs', 'antichrist-engine'),
    'bridge' => __('Dossier bridges', 'antichrist-engine'),
    'lane'   => __('Claim lanes', 'antichrist-engine'),
);
$network_source_visibility = array();
$network_source_search_indices = array();
$network_bridge_visibility = array();
$network_bridge_search_indices = array();
$network_lane_visibility = array();
$network_lane_search_indices = array();

if ($active_record || $record_not_found) {
    $quick_links = array('research-record' => __('Record Desk', 'antichrist-engine')) + $quick_links;
}

foreach ($timeline as $timeline_index => $entry) {
    $is_visible = 'all' === $research_filters['timeline_category'] || (string) ($entry['category'] ?? '') === $research_filters['timeline_category'];
    $timeline_visibility[$timeline_index] = $is_visible;

    if ($is_visible) {
        $timeline_visible_count++;
    }
}

foreach ($claims as $claim_index => $claim) {
    $episode_index = array();
    $source_index  = array();

    foreach (($claim['episodes'] ?? array()) as $episode) {
        if (!is_array($episode)) {
            continue;
        }

        $episode_index[] = implode(' ', array_map('strval', $episode));
    }

    foreach (($claim['source_references'] ?? array()) as $source_reference) {
        if (!is_array($source_reference)) {
            continue;
        }

        $source_index[] = implode(' ', array(
            $source_reference['record_id'] ?? '',
            $source_reference['title'] ?? '',
            $source_reference['publisher'] ?? '',
        ));
    }

    $claim_anchor = (string) ($claim['anchor'] ?? ('claim-' . sanitize_title((string) ($claim['title'] ?? 'claim'))));
    $search_index = implode(' ', array(
        $claim['record_id'] ?? '',
        $claim['title'],
        $claim['summary'],
        $claim['history'],
        $claim['diagnostic'],
        $claim['keywords'],
        $claim['status'],
        $verdicts[$claim['verdict'] ?? '']['label'] ?? '',
        $evidence_levels[$claim['evidence'] ?? '']['label'] ?? '',
        implode(' ', $episode_index),
        implode(' ', $source_index),
    ));
    $normalized_search = antichrist_engine_foundation_normalize_search_text($search_index);
    $matches_category  = 'all' === $research_filters['claim_category'] || (string) ($claim['category'] ?? '') === $research_filters['claim_category'];
    $matches_verdict   = 'all' === $research_filters['claim_verdict'] || (string) ($claim['verdict'] ?? '') === $research_filters['claim_verdict'];
    $matches_query     = '' === $claim_query || false !== strpos($normalized_search, $claim_query);
    $is_visible        = $matches_category && $matches_verdict && $matches_query;

    $claim_anchors[$claim_index] = $claim_anchor;
    $claim_search_indices[$claim_index] = $normalized_search;
    $claim_visibility[$claim_index] = $is_visible;

    if ($is_visible) {
        $claim_visible_count++;
    }
}

foreach ($projection_ledger as $projection_index => $projection_entry) {
    $matches_category = 'all' === $research_filters['projection_category'] || (string) ($projection_entry['claim_category'] ?? '') === $research_filters['projection_category'];
    $matches_query    = '' === $projection_query || false !== strpos((string) ($projection_entry['searchable'] ?? ''), $projection_query);