Foundation - Source Excerpt 18
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
'usb=()',
)),
);
if (is_ssl()) {
$headers['Strict-Transport-Security'] = 'max-age=31536000';
}
return (array) apply_filters('antichrist_engine_security_headers', $headers);
}
/**
* Sends baseline theme-owned security headers.
*
* @return void
*/
function antichrist_engine_foundation_send_security_headers()
{
if (headers_sent()) {
return;
}
foreach (antichrist_engine_foundation_get_security_headers() as $name => $value) {
$name = trim((string) $name);
$value = trim((string) $value);
if ('' === $name || '' === $value || preg_match('/[\r\n:]/', $name) || preg_match('/[\r\n]/', $value)) {
continue;
}
header($name . ': ' . $value, true);
}
}
add_action('send_headers', 'antichrist_engine_foundation_send_security_headers', 7);
/**
* Determines whether the current view should be eligible for indexing.
*
* @return bool
*/
function antichrist_engine_foundation_should_index_current_view()
{
if (!antichrist_engine_foundation_allows_public_indexing()) {
return false;
}
if (is_search() || is_404() || is_preview() || is_feed()) {
return false;
}
if (antichrist_engine_foundation_has_noindex_query_state()) {
return false;
}
return true;
}
/**
* Returns public query keys that create duplicate or transient page states.
*
* Focused research records are the exception: a valid record query is allowed
* to index because it resolves to a canonical, citable atlas record.
*
* @return string[]
*/
function antichrist_engine_foundation_get_noindex_query_keys()
{
return array(
'claim_q',
'claim_category',
'claim_verdict',
'timeline_category',
'projection_q',
'projection_category',
'map_q',
'map_kind',
'map_category',
'record',
'signals_status',
'contact_status',
'program_status',
'membership_status',
'ai_status',
);
}
/**
* Determines whether the current request is a duplicate/transient query view.
*
* @return bool
*/
function antichrist_engine_foundation_has_noindex_query_state()
{
if (empty($_GET) || antichrist_engine_foundation_get_active_research_record()) {
return false;
}
$noindex_keys = antichrist_engine_foundation_get_noindex_query_keys();
foreach (array_keys($_GET) as $key) {
if (in_array(sanitize_key((string) $key), $noindex_keys, true)) {
return true;
}
}
return false;
}
/**
* Determines whether robots should be allowed to follow links on noindex views.
*
* @return bool
*/
function antichrist_engine_foundation_should_follow_current_view()
{
$status = antichrist_engine_foundation_get_launch_visibility_status();
if ('private' === $status['mode'] || !$status['blog_public']) {
return false;
}
return true;
}
/**
* Adds theme-level robots directives without overriding stricter rules.
*
* @param array<string, mixed> $robots Robots directives.
* @return array<string, mixed>
*/
function antichrist_engine_foundation_filter_wp_robots($robots)
{
$robots['max-image-preview'] = 'large';
$robots['max-snippet'] = -1;
$robots['max-video-preview'] = -1;
if (!antichrist_engine_foundation_should_index_current_view()) {
unset($robots['index']);
$robots['noindex'] = true;
if (antichrist_engine_foundation_should_follow_current_view()) {
unset($robots['nofollow']);
$robots['follow'] = true;
} else {
unset($robots['follow']);
$robots['nofollow'] = true;
}
}
return $robots;
}
add_filter('wp_robots', 'antichrist_engine_foundation_filter_wp_robots');
/**
* Sends an X-Robots-Tag header for preview/private launch states.
*
* @return void
*/
function antichrist_engine_foundation_send_launch_visibility_headers()
{
if (antichrist_engine_foundation_should_index_current_view() || headers_sent()) {
return;
}
$follow_directive = antichrist_engine_foundation_should_follow_current_view() ? 'follow' : 'nofollow';
header('X-Robots-Tag: noindex, ' . $follow_directive, true);
}
add_action('send_headers', 'antichrist_engine_foundation_send_launch_visibility_headers', 8);
/**
* Shows administrators when the launch visibility gate is still blocking indexing.
*
* @return void
*/
function antichrist_engine_foundation_admin_launch_visibility_notice()
{
if (!current_user_can('manage_options') || antichrist_engine_foundation_allows_public_indexing()) {
return;
}
$status = antichrist_engine_foundation_get_launch_visibility_status();
$mode = (string) ($status['mode'] ?? 'preview');
echo '<div class="notice notice-warning"><p>';
echo esc_html(sprintf(
/* translators: %s is the current launch visibility mode. */
__('FFTAC launch visibility is "%s"; public indexing is blocked until the mode is set to "public" and WordPress search visibility is enabled.', 'antichrist-engine'),
$mode
));
echo '</p></div>';
}
add_action('admin_notices', 'antichrist_engine_foundation_admin_launch_visibility_notice');
/**
* Returns the private intake sources owned by the theme.
*
* @return array<string, array<string, string>>
*/
function antichrist_engine_foundation_get_intake_sources()
{
return array(
'signals' => array(
'post_type' => 'fftac_signal_signup',
'label' => __('Signals Briefing', 'antichrist-engine'),
'plural_label' => __('Signals signups', 'antichrist-engine'),
'description' => __('Email signups for the public Signals Briefing and publication-track notices.', 'antichrist-engine'),
),
'contact' => array(
'post_type' => 'fftac_contact_message',
'label' => __('Contact Desk', 'antichrist-engine'),
'plural_label' => __('Contact messages', 'antichrist-engine'),
'description' => __('Routed public correspondence for editorial, research, recovery, media, and launch operations.', 'antichrist-engine'),
),
'programs' => array(
'post_type' => 'fftac_program_interest',
'label' => __('Program Intake', 'antichrist-engine'),
'plural_label' => __('Program inquiries', 'antichrist-engine'),
'description' => __('Cohort, summit, verified research, and partnership interest records.', 'antichrist-engine'),
),
);
}
/**
* Normalizes an intake source key or post type into an export source key.
*
* @param string $source Intake source key, post type, or "all".
* @return string
*/
function antichrist_engine_foundation_normalize_intake_source_key($source)
{
$source = sanitize_key((string) $source);
if ('all' === $source || '' === $source) {
return 'all';
}
$sources = antichrist_engine_foundation_get_intake_sources();
if (isset($sources[$source])) {
return $source;
}
foreach ($sources as $key => $definition) {
if ($source === sanitize_key((string) ($definition['post_type'] ?? ''))) {
return $key;
}
}
return 'all';
}
/**
* Returns CSV columns for the internal intake export.
*
* @return string[]
*/
function antichrist_engine_foundation_get_intake_export_columns()
{
return array(
'intake_source',
'post_id',
'post_status',
'submitted_at',
'name',
'email',
'lane',
'context',
'subject',
'message',
'notes',
);
}
/**
* Returns publication-track labels used by Signals Briefing exports.
*
* @return array<string, string>
*/
function antichrist_engine_foundation_get_signal_interest_labels()
{
$labels = array();
foreach (antichrist_engine_foundation_publication_series() as $slug => $series) {
$labels[$slug] = (string) ($series['name'] ?? $slug);
}
return $labels;
}
/**
* Returns a safe option label for an intake value.
*
* @param string $value Raw stored value.
* @param array<string, mixed> $options Option definitions.
* @param string $label_key Label key.
* @return string
*/
function antichrist_engine_foundation_get_intake_option_label($value, $options, $label_key = 'label')
{
$value = sanitize_key((string) $value);
if (!$value || !isset($options[$value])) {
return $value;
}
$option = $options[$value];
if (is_array($option)) {