Foundation - Source Excerpt 33
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
if (!headers_sent()) {
header('Content-Type: ' . (string) ($payload['content_type'] ?? 'text/plain; charset=utf-8'));
header('Content-Disposition: attachment; filename="' . $filename . '"');
header('X-Robots-Tag: noindex, nofollow', true);
header('Cache-Control: no-store, no-cache, must-revalidate, max-age=0');
}
echo (string) ($payload['content'] ?? '');
exit;
}
add_action('template_redirect', 'antichrist_engine_foundation_handle_research_export_download_request', 1);
/**
* Returns machine-readable route items for the sitemap and discovery pages.
*
* @return array<int, array<string, string>>
*/
function antichrist_engine_foundation_get_machine_readable_route_items()
{
$items = array(
array(
'title' => __('XML Sitemap', 'antichrist-engine'),
'summary' => __('Crawler-facing sitemap exposed through WordPress for search engine discovery and indexing.', 'antichrist-engine'),
'url' => home_url('/wp-sitemap.xml'),
'meta' => '/wp-sitemap.xml',
),
);
foreach (antichrist_engine_foundation_get_research_api_endpoint_items() as $endpoint) {
$items[] = array(
'title' => (string) ($endpoint['label'] ?? ''),
'summary' => (string) ($endpoint['description'] ?? ''),
'url' => (string) ($endpoint['url'] ?? ''),
'meta' => '/wp-json/antichrist-engine/v1/' . ltrim((string) ($endpoint['path'] ?? ''), '/'),
);
}
foreach (antichrist_engine_foundation_get_research_export_downloads() as $download) {
$items[] = array(
'title' => (string) ($download['title'] ?? ''),
'summary' => (string) ($download['summary'] ?? ''),
'url' => (string) ($download['url'] ?? ''),
'meta' => (string) ($download['format_label'] ?? __('Export', 'antichrist-engine')) . ' / ' . (string) ($download['meta'] ?? ''),
);
}
$review_notice_route = antichrist_engine_foundation_get_review_notice_route_item();
$items[] = array(
'title' => (string) ($review_notice_route['label'] ?? ''),
'summary' => (string) ($review_notice_route['description'] ?? ''),
'url' => (string) ($review_notice_route['url'] ?? ''),
'meta' => '/wp-json/antichrist-engine/v1/' . ltrim((string) ($review_notice_route['path'] ?? ''), '/'),
);
return $items;
}
/**
* Returns focused research-record items for the human-readable sitemap.
*
* @return array<int, array<string, string>>
*/
function antichrist_engine_foundation_get_research_record_sitemap_items()
{
$verdicts = antichrist_engine_foundation_claim_verdicts();
$items = array();
foreach (antichrist_engine_foundation_get_research_record_lookup() as $record) {
$type = (string) ($record['record_type'] ?? '');
$type_label= (string) ($record['type_label'] ?? __('Research Record', 'antichrist-engine'));
$meta = array($type_label, (string) ($record['record_id'] ?? ''));
if ('claim' === $type && !empty($record['verdict']) && isset($verdicts[$record['verdict']])) {
$meta[] = (string) $verdicts[$record['verdict']]['label'];
} elseif ('projection' === $type) {
$meta[] = (string) ($record['claim_record_id'] ?? '');
$meta[] = (string) ($record['period'] ?? '');
} elseif ('timeline' === $type && !empty($record['year'])) {
$meta[] = (string) $record['year'];
} elseif ('source' === $type && !empty($record['publisher'])) {
$meta[] = (string) $record['publisher'];
} elseif ('briefing' === $type && !empty($record['duration'])) {
$meta[] = (string) $record['duration'];
}
$items[] = array(
'title' => (string) ($record['title'] ?? ''),
'summary' => (string) ($record['summary'] ?? $record['note'] ?? ''),
'url' => (string) ($record['record_url'] ?? $record['record_request_url'] ?? ''),
'meta' => implode(' / ', array_filter($meta)),
);
}
usort($items, static function ($left, $right) {
return strcasecmp((string) ($left['meta'] ?? '') . ' ' . (string) ($left['title'] ?? ''), (string) ($right['meta'] ?? '') . ' ' . (string) ($right['title'] ?? ''));
});
return $items;
}
/**
* Returns publication-series data as a list with slugs included.
*
* @return array<int, array<string, string>>
*/
function antichrist_engine_foundation_get_research_api_series()
{
$series = array();
foreach (antichrist_engine_foundation_publication_series() as $slug => $track) {
$series[] = array_merge(array('slug' => $slug), $track);
}
return $series;
}
/**
* Returns program-option data as a list with slugs included.
*
* @return array<int, array<string, mixed>>
*/
function antichrist_engine_foundation_get_research_api_programs()
{
$programs = array();
foreach (antichrist_engine_foundation_program_interest_options() as $slug => $program) {
$programs[] = array_merge(array('slug' => $slug), $program);
}
return $programs;
}
/**
* Returns source-library data as a list with keys included.
*
* @return array<int, array<string, mixed>>
*/
function antichrist_engine_foundation_get_research_api_sources()
{
return array_values(antichrist_engine_foundation_get_research_source_lookup());
}
/**
* Returns enriched source-library records for the requested source keys.
*
* @param array<int, string> $source_keys Source keys.
* @return array<int, array<string, mixed>>
*/
function antichrist_engine_foundation_get_research_sources_by_keys($source_keys)
{
$lookup = antichrist_engine_foundation_get_research_source_lookup();
$sources = array();
foreach ((array) $source_keys as $source_key) {
$source_key = (string) $source_key;
if (isset($lookup[$source_key])) {
$sources[] = $lookup[$source_key];
}
}
return $sources;
}
/**
* Determines whether the current request is the research page.
*
* @return bool
*/
function antichrist_engine_foundation_is_research_page_request()
{
return is_page() && 'research' === antichrist_engine_foundation_get_page_key_by_id(get_queried_object_id());
}
/**
* Sanitizes a public research-record query value.
*
* @param mixed $value Raw record query value.
* @return string
*/
function antichrist_engine_foundation_clean_record_query($value)
{
if (!is_scalar($value)) {
return '';
}
$cleaned = strtoupper(trim(wp_unslash((string) $value)));
$cleaned = preg_replace('/[^A-Z0-9-]/', '', $cleaned);
if (preg_match('/FFTAC-[A-Z0-9]+-\d{2,4}/', (string) $cleaned, $matches)) {
return (string) ($matches[0] ?? '');
}
return substr((string) $cleaned, 0, 40);
}
/**
* Gets labels for public research-record types.
*
* @return array<string, string>
*/
function antichrist_engine_foundation_get_research_record_type_labels()
{
return array(
'claim' => __('Claim Dossier', 'antichrist-engine'),
'source' => __('Source Record', 'antichrist-engine'),
'timeline' => __('Timeline Entry', 'antichrist-engine'),
'projection' => __('Projection Ledger Entry', 'antichrist-engine'),
'briefing' => __('Executive Briefing', 'antichrist-engine'),
);
}
/**
* Builds a canonical request URL for a focused research record.
*
* @param string $record_id Stable research record ID.
* @return string
*/
function antichrist_engine_foundation_get_research_record_request_url($record_id)
{
$record_id = antichrist_engine_foundation_clean_record_query($record_id);
if ('' === $record_id) {
return antichrist_engine_foundation_get_page_url('research');
}
return add_query_arg('record', $record_id, antichrist_engine_foundation_get_page_url('research'));
}
/**
* Builds a shareable in-page URL for a focused research record.
*
* @param string $record_id Stable research record ID.
* @return string
*/
function antichrist_engine_foundation_get_research_record_url($record_id)
{
$record_id = antichrist_engine_foundation_clean_record_query($record_id);
if ('' === $record_id) {
return antichrist_engine_foundation_build_target_url('research', array(), 'research-record');
}
return antichrist_engine_foundation_build_target_url('research', array(
'record' => $record_id,
), 'research-record');
}
/**
* Builds a stable research-record identifier.
*
* @param string $prefix Record prefix.
* @param int $sequence Stable sequence number.
* @return string
*/