Template Downloads - Source Excerpt 01
Summary
This source excerpt preserves a bounded section of Anti-Christ.org/wp-content/themes/antichrist-engine/template-downloads.php so readers can inspect the evidence without opening the full source file.
**Source path:** Anti-Christ.org/wp-content/themes/antichrist-engine/template-downloads.php
<?php
/**
* Template Name: Downloads
* Template Post Type: page
*
* @package Antichrist_Engine
*/
get_header();
the_post();
$identity = antichrist_engine_foundation_identity();
$document_profile = antichrist_engine_foundation_document_profile('downloads');
$downloads_copy = antichrist_engine_foundation_download_interface_copy();
$download_routes = antichrist_engine_foundation_download_room_routes();
$download_packets = antichrist_engine_foundation_download_briefing_packets();
$reference_links = antichrist_engine_foundation_get_reference_links('downloads');
$assurances = antichrist_engine_foundation_public_assurances();
$collections = antichrist_engine_foundation_download_collections();
$quick_links = array();
$unique_files = array();
$describe_asset = static function ($relative_path) {
return antichrist_engine_foundation_describe_download_asset($relative_path);
};
$collection_has_available_assets = static function ($collection) use ($describe_asset) {
if (!empty($collection['requires'])) {
$required_asset = $describe_asset($collection['requires']);
return !empty($required_asset['exists']);
}
foreach ((array) ($collection['items'] ?? array()) as $item) {
if (!empty($item['preview']) && !empty($describe_asset($item['preview'])['exists'])) {
return true;
}
foreach ((array) ($item['actions'] ?? array()) as $action) {
if (!empty($action['url'])) {
return true;
}
if (!empty($action['path']) && !empty($describe_asset($action['path'])['exists'])) {
return true;
}
}
}
return false;
};
$resolve_download_action = static function ($action) use ($describe_asset) {
$resolved = array(
'label' => (string) ($action['label'] ?? ''),
'mode' => (string) ($action['mode'] ?? 'view'),
'url' => '',
'meta_label' => '',
'download_name' => '',
'should_open_blank' => false,
);
if (!empty($action['path'])) {
$asset = $describe_asset($action['path']);
if (!$asset['exists']) {
return array();
}
$resolved['url'] = $asset['url'];
$resolved['meta_label'] = $asset['meta_label'];
$resolved['download_name'] = 'download' === $resolved['mode'] ? wp_basename($asset['path']) : '';
$resolved['should_open_blank'] = 'download' !== $resolved['mode'];
return $resolved;
}
if (!empty($action['url'])) {
$resolved['url'] = (string) $action['url'];
$resolved['meta_label'] = (string) ($action['meta_label'] ?? '');
$resolved['download_name'] = 'download' === $resolved['mode'] ? (string) ($action['download'] ?? '') : '';
$resolved['should_open_blank'] = 'download' !== $resolved['mode'];
return $resolved;
}
return array();
};
$build_viewer_meta = static function ($pairs) {
$items = array_values(array_filter((array) $pairs, static function ($pair) {
return !empty($pair['value']);
}));
return esc_attr(wp_json_encode($items, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE));
};
$collections = array_values(array_filter($collections, $collection_has_available_assets));
foreach ($collections as $collection) {
$quick_links[$collection['anchor']] = $collection['title'];
foreach ($collection['items'] as $item) {
foreach ($item['actions'] as $action) {
$unique_key = (string) ($action['path'] ?? $action['url'] ?? $action['label'] ?? '');
if ('' !== $unique_key) {
$unique_files[$unique_key] = true;
}
}
}
}
$quick_links = array_merge(
array(
'media-room' => $downloads_copy['routes_title'],
'briefing-packets' => $downloads_copy['packets_title'],
),
$quick_links
);
$collection_count = count($collections);
$download_count = count($unique_files);
$artwork_collection = array_values(array_filter($collections, static function ($collection) {
return 'poster-files' === ($collection['anchor'] ?? '');
}));
$artifact_collection = array_values(array_filter($collections, static function ($collection) {
return 'artifact-studies' === ($collection['anchor'] ?? '');
}));
$artwork_sets = isset($artwork_collection[0]['items']) ? count((array) $artwork_collection[0]['items']) : 0;
$artifact_study_count = isset($artifact_collection[0]['items']) ? count((array) $artifact_collection[0]['items']) : 0;
$research_export_collection = array_values(array_filter($collections, static function ($collection) {
return 'research-data-exports' === ($collection['anchor'] ?? '');
}));
$research_export_count = isset($research_export_collection[0]['items']) ? count((array) $research_export_collection[0]['items']) : 0;
$press_kit_asset = $describe_asset('assets/downloads/bundles/fftac-press-kit.zip');
$site_guide_asset = $describe_asset('assets/downloads/documents/fftac-site-link-guide.txt');
$seal_asset = $describe_asset('assets/downloads/seal/fftac-seal-1024.png');
?>
<section class="hero hero--foundation">
<div class="container hero__grid hero__grid--foundation">
<div class="hero__content">
<p class="eyebrow"><?php esc_html_e('Public Downloads', 'antichrist-engine'); ?></p>
<h1><?php the_title(); ?></h1>
<p class="hero__lead"><?php echo esc_html($downloads_copy['hero_lead']); ?></p>
<p><?php echo esc_html($downloads_copy['hero_summary']); ?></p>
<ul class="hero__meta" aria-label="<?php esc_attr_e('Downloads profile', 'antichrist-engine'); ?>">
<li>
<span><?php esc_html_e('Collections', 'antichrist-engine'); ?></span>
<strong><?php echo esc_html(number_format_i18n($collection_count)); ?></strong>
</li>
<li>
<span><?php esc_html_e('Files', 'antichrist-engine'); ?></span>
<strong><?php echo esc_html(number_format_i18n($download_count)); ?></strong>
</li>
<li>
<span><?php esc_html_e('Access', 'antichrist-engine'); ?></span>
<strong><?php echo esc_html($document_profile['access']); ?></strong>
</li>
</ul>
<div class="hero__actions">
<?php if ($press_kit_asset['exists']) : ?>
<a class="button" href="<?php echo esc_url($press_kit_asset['url']); ?>" download="<?php echo esc_attr(wp_basename($press_kit_asset['path'])); ?>"><?php esc_html_e('Download Press Kit', 'antichrist-engine'); ?></a>
<?php endif; ?>
<?php if (isset($quick_links['artifact-studies'])) : ?>
<a class="button button--ghost" href="#artifact-studies"><?php esc_html_e('Open Symbol Studies', 'antichrist-engine'); ?></a>
<?php endif; ?>
<?php if ($site_guide_asset['exists']) : ?>
<a class="button button--ghost" href="<?php echo esc_url($site_guide_asset['url']); ?>" target="_blank" rel="noopener"><?php esc_html_e('View Site Link Guide', 'antichrist-engine'); ?></a>
<?php endif; ?>
<?php if (isset($quick_links['research-data-exports'])) : ?>
<a class="button button--ghost" href="#research-data-exports"><?php esc_html_e('Open Research Exports', 'antichrist-engine'); ?></a>
<?php endif; ?>
<a class="button button--ghost" href="#seal-pack"><?php esc_html_e('Open Seal Pack', 'antichrist-engine'); ?></a>
</div>
</div>
<div class="hero__visual card foundation-panel foundation-panel--official">
<p class="eyebrow"><?php esc_html_e('Asset Dossier', 'antichrist-engine'); ?></p>
<h2><?php echo esc_html($document_profile['record_id']); ?></h2>
<div class="foundation-kv">
<div class="foundation-kv__item">
<span><?php esc_html_e('Authority', 'antichrist-engine'); ?></span>
<strong><?php echo esc_html($document_profile['authority']); ?></strong>
</div>
<div class="foundation-kv__item">
<span><?php esc_html_e('Artwork Sets', 'antichrist-engine'); ?></span>
<strong><?php echo esc_html(number_format_i18n($artwork_sets)); ?></strong>
</div>
<div class="foundation-kv__item">
<span><?php esc_html_e('Press Kit', 'antichrist-engine'); ?></span>