Foundation - Source Excerpt 24
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
echo '</tbody></table>';
if (function_exists('antichrist_engine_foundation_participants_database_render_admin_panel')) {
antichrist_engine_foundation_participants_database_render_admin_panel();
}
echo '<h2>' . esc_html__('Theme Security Headers', 'antichrist-engine') . '</h2>';
echo '<table class="widefat striped"><thead><tr>';
echo '<th>' . esc_html__('Header', 'antichrist-engine') . '</th>';
echo '<th>' . esc_html__('Value', 'antichrist-engine') . '</th>';
echo '</tr></thead><tbody>';
foreach ($security_headers as $name => $value) {
echo '<tr><td><code>' . esc_html((string) $name) . '</code></td><td><code>' . esc_html((string) $value) . '</code></td></tr>';
}
echo '</tbody></table>';
echo '</div>';
}
/**
* Gets a theme-owned canonical URL for views WordPress core does not cover.
*
* WordPress core already prints singular canonicals, so this intentionally
* avoids duplicating canonical tags on posts and pages.
*
* @return string
*/
function antichrist_engine_foundation_get_theme_canonical_url()
{
if (is_singular() || !antichrist_engine_foundation_should_index_current_view()) {
return '';
}
return antichrist_engine_foundation_get_current_request_url();
}
/**
* Keeps canonical URLs aligned for focused research-record views.
*
* @param string $canonical_url Canonical URL from WordPress core.
* @param WP_Post|int $post Current post object or ID.
* @return string
*/
function antichrist_engine_foundation_filter_canonical_url($canonical_url, $post)
{
$active_record = antichrist_engine_foundation_get_active_research_record();
if (!$active_record) {
return $canonical_url;
}
return (string) ($active_record['record_request_url'] ?? $canonical_url);
}
add_filter('get_canonical_url', 'antichrist_engine_foundation_filter_canonical_url', 10, 2);
/**
* Prevents canonical redirects from stripping focused research-record query state.
*
* @param string|false $redirect_url Redirect URL.
* @param string $requested_url Requested URL.
* @return string|false
*/
function antichrist_engine_foundation_filter_redirect_canonical($redirect_url, $requested_url)
{
if (antichrist_engine_foundation_get_active_research_record()) {
return false;
}
return $redirect_url;
}
add_filter('redirect_canonical', 'antichrist_engine_foundation_filter_redirect_canonical', 10, 2);
/**
* Returns the default social-share image for theme-owned metadata.
*
* @return string
*/
function antichrist_engine_foundation_get_social_share_image_url()
{
$asset = antichrist_engine_foundation_get_social_share_image_asset();
return (string) ($asset['url'] ?? '');
}
/**
* Prints theme-owned SEO metadata.
*
* @return void
*/
function antichrist_engine_foundation_print_head_metadata()
{
$page_key = is_page() ? antichrist_engine_foundation_get_page_key_by_id(get_queried_object_id()) : '';
$image_asset = antichrist_engine_foundation_get_social_share_image_asset($page_key);
$description = antichrist_engine_foundation_get_meta_description();
$canonical = antichrist_engine_foundation_get_theme_canonical_url();
$title = antichrist_engine_foundation_get_contextual_document_title(wp_get_document_title());
$url = antichrist_engine_foundation_get_current_request_url();
$type = is_singular('post') ? 'article' : 'website';
$image = (string) ($image_asset['url'] ?? '');
$image_alt = (string) ($image_asset['alt'] ?? (antichrist_engine_foundation_get_site_name() . ' social preview'));
$locale = function_exists('get_locale') ? str_replace('-', '_', (string) get_locale()) : 'en_US';
if ($description) {
echo '<meta name="description" content="' . esc_attr($description) . '">' . "\n";
echo '<meta property="og:description" content="' . esc_attr($description) . '">' . "\n";
echo '<meta name="twitter:description" content="' . esc_attr($description) . '">' . "\n";
}
if ($canonical) {
echo '<link rel="canonical" href="' . esc_url($canonical) . '">' . "\n";
}
echo '<meta property="og:site_name" content="' . esc_attr(antichrist_engine_foundation_get_site_name()) . '">' . "\n";
echo '<meta property="og:locale" content="' . esc_attr($locale) . '">' . "\n";
echo '<meta property="og:title" content="' . esc_attr($title) . '">' . "\n";
echo '<meta property="og:type" content="' . esc_attr($type) . '">' . "\n";
echo '<meta property="og:url" content="' . esc_url($url) . '">' . "\n";
if ($image) {
echo '<meta property="og:image" content="' . esc_url($image) . '">' . "\n";
echo '<meta property="og:image:alt" content="' . esc_attr($image_alt) . '">' . "\n";
if (!empty($image_asset['width']) && !empty($image_asset['height'])) {
echo '<meta property="og:image:width" content="' . esc_attr((string) $image_asset['width']) . '">' . "\n";
echo '<meta property="og:image:height" content="' . esc_attr((string) $image_asset['height']) . '">' . "\n";
}
if (!empty($image_asset['type'])) {
echo '<meta property="og:image:type" content="' . esc_attr((string) $image_asset['type']) . '">' . "\n";
}
echo '<meta name="twitter:image" content="' . esc_url($image) . '">' . "\n";
echo '<meta name="twitter:image:alt" content="' . esc_attr($image_alt) . '">' . "\n";
}
echo '<meta name="twitter:card" content="' . esc_attr($image ? 'summary_large_image' : 'summary') . '">' . "\n";
echo '<meta name="twitter:title" content="' . esc_attr($title) . '">' . "\n";
if (is_singular('post')) {
$author_id = (int) get_post_field('post_author', get_the_ID());
$author = get_the_author_meta('display_name', $author_id);
echo '<meta property="article:published_time" content="' . esc_attr(get_post_time(DATE_W3C, true, get_the_ID())) . '">' . "\n";
echo '<meta property="article:modified_time" content="' . esc_attr(get_post_modified_time(DATE_W3C, true, get_the_ID())) . '">' . "\n";
if ($author) {
echo '<meta property="article:author" content="' . esc_attr($author) . '">' . "\n";
}
$categories = get_the_category(get_the_ID());
if (!empty($categories[0]->name)) {
echo '<meta property="article:section" content="' . esc_attr((string) $categories[0]->name) . '">' . "\n";
}
}
}
add_action('wp_head', 'antichrist_engine_foundation_print_head_metadata', 4);
/**
* Adds sitemap discovery to the virtual WordPress robots.txt response.
*
* @param string $output Robots.txt output.
* @param bool $public Whether the site is public.
* @return string
*/
function antichrist_engine_foundation_filter_robots_txt($output, $public)
{
if (!antichrist_engine_foundation_allows_public_indexing()) {
return "User-agent: *\nDisallow: /\n";
}
if (!$public) {
return $output;
}
$sitemap = home_url('/wp-sitemap.xml');
if (false !== strpos((string) $output, $sitemap)) {
return $output;
}
return rtrim((string) $output) . "\n\nSitemap: " . $sitemap . "\n";
}
add_filter('robots_txt', 'antichrist_engine_foundation_filter_robots_txt', 10, 2);
/**
* Returns XML sitemap entries for focused research-record URLs.
*
* These entries expose canonical `?record=FFTAC-*` URLs without the in-page
* `#research-record` fragment used by human-facing links.
*
* @param int $page_num Sitemap page number.
* @return array<int, array<string, string>>
*/
function antichrist_engine_foundation_get_research_record_sitemap_url_entries($page_num = 1)
{
if (!antichrist_engine_foundation_allows_public_indexing()) {
return array();
}
$records = array_values(antichrist_engine_foundation_get_research_record_lookup());
$max_urls = function_exists('wp_sitemaps_get_max_urls') ? (int) wp_sitemaps_get_max_urls('fftac-research-record') : 2000;
$max_urls = max(1, $max_urls);
$offset = max(0, ((int) $page_num - 1) * $max_urls);
$entries = array();
$lastmod = '';
$research_page_id = antichrist_engine_foundation_get_page_id('research');
if ($research_page_id) {
$lastmod = (string) get_post_modified_time(DATE_W3C, true, $research_page_id);
}
usort($records, static function ($left, $right) {
return strcasecmp((string) ($left['record_id'] ?? ''), (string) ($right['record_id'] ?? ''));
});
foreach (array_slice($records, $offset, $max_urls) as $record) {
$loc = trim((string) ($record['record_request_url'] ?? ''));
if ('' === $loc) {
continue;
}
$entry = array(