Skip to content
wiki.fftac.org

Functions - Source Excerpt 02

Back to Functions

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

'aiHistoryClearedLabel' => __('Conversation history cleared in this browser.', 'antichrist-engine'),
        'aiKeySavedLabel' => __('Personal API key saved securely.', 'antichrist-engine'),
        'aiKeyRemovedLabel' => __('Personal API key removed.', 'antichrist-engine'),
        'aiFullscreenExpandLabel' => __('Full screen', 'antichrist-engine'),
        'aiFullscreenCollapseLabel' => __('Exit full screen', 'antichrist-engine'),
        'aiCopyOutputLabel' => __('Copy', 'antichrist-engine'),
        'aiOutputCopiedLabel' => __('Output copied.', 'antichrist-engine'),
        'aiCopyCodeLabel' => __('Copy code', 'antichrist-engine'),
        'aiCodeCopiedLabel' => __('Code copied.', 'antichrist-engine'),
        'aiDeepenOutputLabel' => __('Drill deeper', 'antichrist-engine'),
        'aiDeepenLoadedLabel' => __('Counterclaim drill loaded into the prompt field.', 'antichrist-engine'),
        'aiResearchDraftLabel' => __('Research handoff', 'antichrist-engine'),
        'aiResearchDraftLoadedLabel' => __('Research handoff loaded into the prompt field.', 'antichrist-engine'),
        'aiPublicDraftLabel' => __('Public note', 'antichrist-engine'),
        'aiPublicDraftLoadedLabel' => __('Public-note forge loaded into the prompt field.', 'antichrist-engine'),
        'aiPromptLaneLoadedLabel' => __('Prompt lane loaded.', 'antichrist-engine'),
        'aiProtocolLoadedLabel' => __('Inquiry protocol selected.', 'antichrist-engine'),
        'aiCopyFailedLabel' => __('Copy is not available in this browser.', 'antichrist-engine'),
        'aiShareOutputLabel' => __('Share', 'antichrist-engine'),
        'aiShareReadyLabel' => __('Output ready to share.', 'antichrist-engine'),
        'aiShareMissingLabel' => __('Choose an AI output before sharing.', 'antichrist-engine'),
        'aiShareSendingLabel' => __('Sharing output...', 'antichrist-engine'),
        'aiShareSavedLabel' => __('AI output shared.', 'antichrist-engine'),
        'aiShareErrorLabel' => __('The AI output could not be shared.', 'antichrist-engine'),
        'aiOpenSharedLabel' => __('Open post', 'antichrist-engine'),
        'aiTranscriptEmptyLabel' => __('No transcript yet. Send a prompt first.', 'antichrist-engine'),
        'aiTranscriptExportedLabel' => __('Transcript exported from this browser.', 'antichrist-engine'),
        'aiTranscriptMarkdownExportedLabel' => __('Markdown transcript exported from this browser.', 'antichrist-engine'),
        'aiTranscriptCopiedLabel' => __('Transcript copied.', 'antichrist-engine'),
        'aiTranscriptImportedLabel' => __('Transcript imported into this browser.', 'antichrist-engine'),
        'aiTranscriptImportFailedLabel' => __('That transcript file could not be imported.', 'antichrist-engine'),
        'aiTranscriptImportReadingLabel' => __('Reading transcript file...', 'antichrist-engine'),
        'aiWorkspaceBriefSavedLabel' => __('Workspace brief saved in this browser.', 'antichrist-engine'),
        'aiWorkspaceBriefAppliedLabel' => __('Workspace brief added to the prompt field.', 'antichrist-engine'),
        'aiWorkspaceBriefClearedLabel' => __('Workspace brief cleared from this browser.', 'antichrist-engine'),
        'aiWorkspaceBriefEmptyLabel' => __('Add a workspace brief first.', 'antichrist-engine'),
        'aiSessionSnapshotSavedLabel' => __('Local session snapshot saved.', 'antichrist-engine'),
        'aiSessionSnapshotRestoredLabel' => __('Local session snapshot restored.', 'antichrist-engine'),
        'aiSessionSnapshotDeletedLabel' => __('Local session snapshot deleted.', 'antichrist-engine'),
        'aiSessionSnapshotEmptyLabel' => __('Add a prompt or transcript before saving a snapshot.', 'antichrist-engine'),
        'aiSessionSnapshotMissingLabel' => __('Choose a saved snapshot first.', 'antichrist-engine'),
        'aiSessionSavedEmptyLabel' => __('No saved snapshots yet', 'antichrist-engine'),
        'searchUrl' => antichrist_engine_foundation_get_search_url(),
        'searchQuery' => get_search_query(),
        'navigatorItems' => array_values($navigator_items),
        'analyticsEnabled' => true,
        'launchVisibilityMode' => antichrist_engine_foundation_get_launch_visibility_mode(),
    ));
}
add_action('wp_enqueue_scripts', 'antichrist_engine_enqueue_assets');

/**
 * Removes WordPress emoji shims from public pages.
 *
 * Native emoji rendering still works in modern browsers; this avoids an
 * extra inline detection script, stylesheet, and feed/mail image conversion.
 *
 * @return void
 */
function antichrist_engine_disable_emoji_assets()
{
    if (is_admin()) {
        return;
    }

    remove_action('wp_head', 'print_emoji_detection_script', 7);
    remove_action('wp_print_styles', 'print_emoji_styles');
    remove_filter('the_content_feed', 'wp_staticize_emoji');
    remove_filter('comment_text_rss', 'wp_staticize_emoji');
    remove_filter('wp_mail', 'wp_staticize_emoji_for_email');

    add_filter('emoji_svg_url', '__return_false');
}
add_action('init', 'antichrist_engine_disable_emoji_assets', 1);

/**
 * Prints theme-owned favicon links when WordPress has no uploaded site icon.
 *
 * @return void
 */
function antichrist_engine_print_theme_favicons()
{
    if (function_exists('has_site_icon') && has_site_icon()) {
        return;
    }

    $images_uri = trailingslashit(get_template_directory_uri()) . 'assets/images/';

    echo '<link rel="icon" href="' . esc_url($images_uri . 'favicon.ico') . '" sizes="any">' . "\n";
    echo '<link rel="icon" type="image/png" sizes="32x32" href="' . esc_url($images_uri . 'favicon-32x32.png') . '">' . "\n";
    echo '<link rel="icon" type="image/png" sizes="16x16" href="' . esc_url($images_uri . 'favicon-16x16.png') . '">' . "\n";
    echo '<link rel="icon" type="image/png" sizes="192x192" href="' . esc_url($images_uri . 'site-icon-192.png') . '">' . "\n";
    echo '<link rel="icon" type="image/png" sizes="512x512" href="' . esc_url($images_uri . 'site-icon-512.png') . '">' . "\n";
    echo '<link rel="apple-touch-icon" sizes="180x180" href="' . esc_url($images_uri . 'apple-touch-icon.png') . '">' . "\n";
}
add_action('wp_head', 'antichrist_engine_print_theme_favicons', 2);

/**
 * Builds consistent image loading attributes for theme-owned markup.
 *
 * @param array<string, mixed> $args Attribute arguments.
 * @return array<string, string>
 */
function antichrist_engine_get_image_loading_attributes($args = array())
{
    $args = is_array($args) ? $args : array();
    $priority = !empty($args['priority']);
    $loading = array_key_exists('loading', $args) ? (string) $args['loading'] : ($priority ? 'eager' : 'lazy');
    $decoding = array_key_exists('decoding', $args) ? (string) $args['decoding'] : 'async';
    $fetchpriority = array_key_exists('fetchpriority', $args) ? (string) $args['fetchpriority'] : ($priority ? 'high' : '');
    $attributes = array();

    if (in_array($loading, array('lazy', 'eager'), true)) {
        $attributes['loading'] = $loading;
    }

    if (in_array($decoding, array('async', 'sync', 'auto'), true)) {
        $attributes['decoding'] = $decoding;
    }

    if (in_array($fetchpriority, array('high', 'low', 'auto'), true)) {
        $attributes['fetchpriority'] = $fetchpriority;
    }

    return $attributes;
}

/**
 * Serializes safe HTML attributes for theme-owned image markup.
 *
 * @param array<string, mixed> $attributes Attributes to render.
 * @return string
 */
function antichrist_engine_get_image_attribute_markup($attributes)
{
    $pairs = array();

    foreach ((array) $attributes as $name => $value) {
        if (false === $value || null === $value || '' === $value) {
            continue;
        }

        $name = (string) $name;

        if (!preg_match('/^[A-Za-z_:][A-Za-z0-9_:\-\.]*$/', $name)) {
            continue;
        }

        if (true === $value) {
            $pairs[] = $name;
            continue;
        }

        $pairs[] = $name . '="' . esc_attr((string) $value) . '"';
    }

    return implode(' ', $pairs);
}

/**
 * Adds decoding and lazy-loading defaults to WordPress attachment images.
 *
 * @param array<string, string> $attr Attachment image attributes.
 * @return array<string, string>
 */
function antichrist_engine_filter_attachment_image_attributes($attr, $attachment = null, $size = null)
{
    unset($attachment, $size);

    if (!is_array($attr)) {
        return $attr;
    }

    $defaults = antichrist_engine_get_image_loading_attributes(array(
        'priority' => isset($attr['fetchpriority']) && 'high' === $attr['fetchpriority'],
    ));

    return array_merge($defaults, $attr);
}
add_filter('wp_get_attachment_image_attributes', 'antichrist_engine_filter_attachment_image_attributes', 10, 3);

/**
 * Adds a body class for pages using a featured image.
 *