Foundation - Source Excerpt 11
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
'meta' => (string) ($impact['eyebrow'] ?? __('Support impact', 'antichrist-engine')),
'keywords' => $keywords,
'searchable' => antichrist_engine_foundation_normalize_search_text($keywords),
);
}
$support_destination = antichrist_engine_foundation_get_support_destination();
foreach (antichrist_engine_foundation_support_paths() as $index => $path) {
$route = (string) ($path['route'] ?? '');
$url = '';
if ('support_destination' === $route) {
$url = (string) ($support_destination['url'] ?? '');
} elseif ('' !== $route) {
$url = antichrist_engine_foundation_build_target_url(
$route,
(array) ($path['args'] ?? array()),
(string) ($path['anchor'] ?? '')
);
}
$keywords = implode(' ', array(
$path['eyebrow'] ?? '',
$path['title'] ?? '',
$path['summary'] ?? '',
$path['fit'] ?? '',
$path['keywords'] ?? '',
$path['proof_cta'] ?? '',
'support lane donation underwriting contribution giving path',
));
$items[] = array(
'id' => 'support-lane-' . ($index + 1),
'title' => (string) ($path['title'] ?? __('Support lane', 'antichrist-engine')),
'summary' => (string) ($path['summary'] ?? ''),
'url' => $url,
'type' => 'Support Lane',
'group' => 'Support',
'meta' => trim(implode(' / ', array_filter(array(
$path['eyebrow'] ?? __('Support lane', 'antichrist-engine'),
$path['fit'] ?? '',
)))),
'keywords' => $keywords,
'searchable' => antichrist_engine_foundation_normalize_search_text($keywords),
);
}
$recent_posts = get_posts(antichrist_engine_foundation_get_publication_query_args(array(
'posts_per_page' => 18,
)));
foreach ($recent_posts as $post) {
if (antichrist_engine_foundation_is_placeholder_publication($post)) {
continue;
}
$series = antichrist_engine_post_series($post->ID);
$record_id = antichrist_engine_post_record_id($post->ID);
$summary = has_excerpt($post) ? $post->post_excerpt : wp_trim_words(wp_strip_all_tags($post->post_content), 22);
$keywords = implode(' ', array(
$post->post_title,
$summary,
$record_id,
$series['name'] ?? '',
));
$items[] = array(
'id' => 'post-' . $post->ID,
'title' => (string) $post->post_title,
'summary' => (string) $summary,
'url' => get_permalink($post),
'type' => 'Publication',
'group' => $series['name'] ?? 'Journal',
'meta' => $record_id,
'keywords' => $keywords,
'searchable' => antichrist_engine_foundation_normalize_search_text($keywords),
);
}
return $items;
}
/**
* Searches the curated navigator index.
*
* @param string $query Search query.
* @param int $limit Optional result limit.
* @return array<int, array<string, string>>
*/
function antichrist_engine_foundation_search_navigator($query, $limit = 12)
{
$query = antichrist_engine_foundation_normalize_search_text($query);
$terms = antichrist_engine_foundation_get_search_terms($query);
if ('' === $query) {
return array_slice(antichrist_engine_foundation_get_navigator_index(), 0, max(1, (int) $limit));
}
$matches = array();
foreach (antichrist_engine_foundation_get_navigator_index() as $item) {
$score = 0;
$title = antichrist_engine_foundation_normalize_search_text($item['title'] ?? '');
$summary = antichrist_engine_foundation_normalize_search_text($item['summary'] ?? '');
$keywords = antichrist_engine_foundation_normalize_search_text($item['keywords'] ?? '');
$searchable = (string) ($item['searchable'] ?? '');
if ('' === $searchable) {
continue;
}
$matched_terms = 0;
foreach ($terms as $term) {
if (false !== strpos($searchable, $term)) {
$matched_terms++;
}
}
$has_phrase_match = false !== strpos($searchable, $query);
$requires_phrase = count($terms) > 1 && !$has_phrase_match;
if ($requires_phrase && $matched_terms < count($terms)) {
continue;
}
if (!$has_phrase_match && 0 === $matched_terms) {
continue;
}
if (0 === strpos($title, $query)) {
$score += 120;
} elseif (false !== strpos($title, $query)) {
$score += 80;
}
if (false !== strpos($keywords, $query)) {
$score += 40;
}
if (false !== strpos($summary, $query)) {
$score += 20;
}
foreach ($terms as $term) {
if (0 === strpos($title, $term)) {
$score += 32;
} elseif (false !== strpos($title, $term)) {
$score += 20;
}
if (false !== strpos($keywords, $term)) {
$score += 10;
}
if (false !== strpos($summary, $term)) {
$score += 6;
}
}
if ($has_phrase_match) {
$score += 18;
}
if (count($terms) > 1 && $matched_terms === count($terms)) {
$score += 24;
}
$item['score'] = (string) $score;
$matches[] = $item;
}
usort($matches, static function ($left, $right) {
return ((int) ($right['score'] ?? 0)) <=> ((int) ($left['score'] ?? 0));
});
return array_slice($matches, 0, max(1, (int) $limit));
}
/**
* Returns the most specific schema page type for a foundation page.
*
* @param string $page_key Foundation page key.
* @param string $default Default page type.
* @return string
*/
function antichrist_engine_foundation_get_page_webpage_type($page_key, $default = 'WebPage')
{
$page_key = (string) $page_key;
$types = array(
'about' => 'AboutPage',
'contact' => 'ContactPage',
'downloads' => 'CollectionPage',
'join' => 'CollectionPage',
'journal' => 'CollectionPage',
'research' => 'CollectionPage',
'review_notices' => 'CollectionPage',
'sitemap' => 'CollectionPage',
'support' => 'CollectionPage',
'symbols' => 'CollectionPage',
'texts' => 'CollectionPage',
);
return (string) ($types[$page_key] ?? $default);
}
/**
* Returns the primary structured-data entity ID for a foundation page.
*
* @param string $page_key Foundation page key.
* @param string $current_url Current request URL.
* @param string $organization_id Organization graph ID.
* @return string
*/
function antichrist_engine_foundation_get_page_main_entity_id($page_key, $current_url, $organization_id)
{
$page_key = (string) $page_key;
if ('about' === $page_key) {
return (string) $organization_id;
}
$suffixes = array(
'charter' => '#governance-map',
'community' => '#governance-map',
'contact' => '#contact-routes',
'downloads' => '#downloads-library',
'join' => '#programs',
'journal' => '#publication-tracks',
'privacy' => '#governance-map',
'research' => '#research-dataset',
'review_notices' => '#review-notices',
'sitemap' => '#sitemap-sections',
'support' => '#support-lanes',
'symbols' => '#symbols-lab-items',
'terms' => '#governance-map',
'texts' => '#texts-lab-items',
);
return isset($suffixes[$page_key]) ? (string) $current_url . $suffixes[$page_key] : '';
}
/**
* Builds a reusable ItemList graph for structured data output.
*
* @param string $graph_id Structured-data graph ID.
* @param string $name Human-readable list name.
* @param string $description List description.
* @param array<int, array<string, mixed>> $items Source list items.
* @param string $current_url Current request URL.
* @param string $website_id WebSite graph ID.