Functions - Source Excerpt 01
Summary
This source excerpt preserves a bounded section of Anti-Christ.org/wp-content/themes/antichrist-engine/functions.php so readers can inspect the evidence without opening the full source file.
**Source path:** Anti-Christ.org/wp-content/themes/antichrist-engine/functions.php
<?php
/**
* Theme setup and asset loading.
*
* @package Antichrist_Engine
*/
if (!defined('ABSPATH')) {
exit;
}
if (!function_exists('str_contains')) {
function str_contains($haystack, $needle)
{
return '' === $needle || false !== strpos((string) $haystack, (string) $needle);
}
}
if (!function_exists('str_starts_with')) {
function str_starts_with($haystack, $needle)
{
$needle = (string) $needle;
return '' === $needle || 0 === strpos((string) $haystack, $needle);
}
}
if (!function_exists('str_ends_with')) {
function str_ends_with($haystack, $needle)
{
$haystack = (string) $haystack;
$needle = (string) $needle;
return '' === $needle || substr($haystack, -strlen($needle)) === $needle;
}
}
require_once get_template_directory() . '/inc/template-tags.php';
/**
* Returns the theme's required application plugins.
*
* @return array<string, string>
*/
function antichrist_engine_required_plugins()
{
return array(
'fftac-foundation-core' => __('FFTAC Foundation Core', 'antichrist-engine'),
'fftac-ai-engine' => __('FFTAC AI Engine', 'antichrist-engine'),
'fftac-membership' => __('FFTAC Membership', 'antichrist-engine'),
);
}
/**
* Checks whether the required application plugin functions are loaded.
*
* @return bool
*/
function antichrist_engine_required_plugins_are_loaded()
{
return function_exists('antichrist_engine_foundation_identity')
&& function_exists('antichrist_engine_foundation_ai_get_api_key')
&& function_exists('antichrist_engine_membership_get_page_url');
}
/**
* Warns administrators when the split application plugins are not active.
*
* @return void
*/
function antichrist_engine_required_plugins_admin_notice()
{
if (antichrist_engine_required_plugins_are_loaded()) {
return;
}
echo '<div class="notice notice-error"><p>';
echo esc_html__('The Antichrist Engine theme now requires these active plugins: FFTAC Foundation Core, FFTAC AI Engine, and FFTAC Membership.', 'antichrist-engine');
echo '</p></div>';
}
add_action('admin_notices', 'antichrist_engine_required_plugins_admin_notice');
if (!antichrist_engine_required_plugins_are_loaded()) {
/**
* Stops front-end rendering before templates call plugin-owned functions.
*
* @return void
*/
function antichrist_engine_required_plugins_frontend_stop()
{
wp_die(
esc_html__('The Antichrist Engine theme requires the FFTAC Foundation Core, FFTAC AI Engine, and FFTAC Membership plugins to be active.', 'antichrist-engine'),
esc_html__('Required plugins inactive', 'antichrist-engine'),
array('response' => 503)
);
}
add_action('template_redirect', 'antichrist_engine_required_plugins_frontend_stop', 0);
return;
}
/**
* Sets up theme defaults and registers support for various WordPress features.
*
* @return void
*/
function antichrist_engine_setup()
{
load_theme_textdomain('antichrist-engine', get_template_directory() . '/languages');
add_theme_support('title-tag');
add_theme_support('post-thumbnails');
add_theme_support('automatic-feed-links');
add_theme_support('responsive-embeds');
add_theme_support('wp-block-styles');
add_theme_support('align-wide');
add_theme_support('custom-line-height');
add_theme_support('custom-spacing');
add_theme_support('editor-styles');
add_theme_support('html5', array(
'search-form',
'comment-form',
'comment-list',
'gallery',
'caption',
'style',
'script',
'navigation-widgets',
));
add_theme_support('custom-logo', array(
'height' => 96,
'width' => 96,
'flex-height' => true,
'flex-width' => true,
));
add_editor_style('assets/css/theme.css');
register_nav_menus(array(
'primary' => __('Primary Menu', 'antichrist-engine'),
'footer' => __('Footer Menu', 'antichrist-engine'),
));
}
add_action('after_setup_theme', 'antichrist_engine_setup');
/**
* Registers widget areas.
*
* @return void
*/
function antichrist_engine_widgets_init()
{
register_sidebar(array(
'name' => __('Sidebar', 'antichrist-engine'),
'id' => 'sidebar-1',
'description' => __('Add widgets here.', 'antichrist-engine'),
'before_widget' => '<section id="%1$s" class="widget card %2$s">',
'after_widget' => '</section>',
'before_title' => '<h2 class="widget-title">',
'after_title' => '</h2>',
));
}
add_action('widgets_init', 'antichrist_engine_widgets_init');
/**
* Enqueues theme assets.
*
* @return void
*/
function antichrist_engine_enqueue_assets()
{
$theme_version = wp_get_theme()->get('Version');
$theme_css_path = get_template_directory() . '/assets/css/theme.css';
$theme_js_path = get_template_directory() . '/assets/js/theme.js';
$theme_css_version = file_exists($theme_css_path) ? (string) filemtime($theme_css_path) : $theme_version;
$theme_js_version = file_exists($theme_js_path) ? (string) filemtime($theme_js_path) : $theme_version;
$navigator_items = array_map(static function ($item) {
return array(
'id' => (string) ($item['id'] ?? ''),
'title' => (string) ($item['title'] ?? ''),
'summary' => (string) ($item['summary'] ?? ''),
'url' => (string) ($item['url'] ?? ''),
'type' => (string) ($item['type'] ?? ''),
'group' => (string) ($item['group'] ?? ''),
'meta' => (string) ($item['meta'] ?? ''),
'keywords'=> (string) ($item['keywords'] ?? ''),
);
}, antichrist_engine_foundation_get_navigator_index());
wp_enqueue_style(
'antichrist-engine-style',
get_template_directory_uri() . '/assets/css/theme.css',
array(),
$theme_css_version
);
wp_enqueue_script(
'antichrist-engine-script',
get_template_directory_uri() . '/assets/js/theme.js',
array(),
$theme_js_version,
array(
'strategy' => 'defer',
'in_footer' => true,
)
);
wp_localize_script('antichrist-engine-script', 'antichristEngineConfig', array(
'expandLabel' => __('Menu', 'antichrist-engine'),
'collapseLabel' => __('Close menu', 'antichrist-engine'),
'topicMapOpen' => __('Topics', 'antichrist-engine'),
'topicMapClose' => __('Close topics', 'antichrist-engine'),
'listenLabel' => __('Listen to summary', 'antichrist-engine'),
'stopLabel' => __('Stop summary', 'antichrist-engine'),
'speechUnsupported' => __('Audio summaries are not available in this browser.', 'antichrist-engine'),
'exampleLoaded' => __('Example loaded into the prompt field.', 'antichrist-engine'),
'quizIncomplete' => __('Choose one answer for each question to see your current lens.', 'antichrist-engine'),
'navigatorOpenLabel' => __('Open research navigator', 'antichrist-engine'),
'navigatorCloseLabel' => __('Close research navigator', 'antichrist-engine'),
'navigatorSearchLabel' => __('Search pages, claims, sources, programs, and publications', 'antichrist-engine'),
'navigatorPlaceholder' => __('Try "verified research", "ai engine", or "gospel of thomas"', 'antichrist-engine'),
'navigatorEmptyLabel' => __('No direct navigator matches yet. Open the full search results to scan everything WordPress found.', 'antichrist-engine'),
'navigatorResultsLabel' => __('Navigator matches', 'antichrist-engine'),
'navigatorFullResultsLabel' => __('Open full search results', 'antichrist-engine'),
'navigatorDefaultCountLabel' => __('Showing curated paths across the site.', 'antichrist-engine'),
'navigatorCountSingular' => __('navigator match', 'antichrist-engine'),
'navigatorCountPlural' => __('navigator matches', 'antichrist-engine'),
'navigatorKeyboardHint' => __('Keyboard: Ctrl + K to open, Esc to close', 'antichrist-engine'),
'navigatorShortcut' => __('Ctrl + K', 'antichrist-engine'),
'ajaxUrl' => admin_url('admin-ajax.php'),
'aiNonce' => wp_create_nonce('antichrist_engine_ai'),
'aiSendingLabel' => __('Asking the engine...', 'antichrist-engine'),
'aiResponseLabel' => __('Response received.', 'antichrist-engine'),
'aiErrorLabel' => __('The AI request could not be completed.', 'antichrist-engine'),
'aiEmptyPromptLabel' => __('Enter a prompt before sending.', 'antichrist-engine'),