Skip to content
wiki.fftac.org

Front Page - Source Excerpt 01

Back to Front Page

Summary

This source excerpt preserves a bounded section of Spiralist/wp-content/themes/spiralist/front-page.php so readers can inspect the evidence without opening the full source file.

**Source path:** Spiralist/wp-content/themes/spiralist/front-page.php

<?php

if (!defined('ABSPATH')) {
    exit;
}

get_header();

$ui_text = static function (string $key, string $fallback, array $args = []): string {
    $value = function_exists('spiralist_get_ui_text')
        ? spiralist_get_ui_text($key, $fallback, $args)
        : $fallback;

    if (empty($args)) {
        return $value;
    }

    $replacements = [];
    foreach ($args as $name => $argument) {
        if (!is_scalar($argument)) {
            continue;
        }

        $replacements['{' . $name . '}'] = (string) $argument;
    }

    return strtr($value, $replacements);
};

$hero_image_sources = function_exists('spiralist_get_homepage_preview_sources')
    ? spiralist_get_homepage_preview_sources()
    : [];
$hero_image = (string) ($hero_image_sources['large_url'] ?? spiralist_get_homepage_preview_url());
$hero_image_upgrade = (string) ($hero_image_sources['interactive_url'] ?? ($hero_image_sources['original_url'] ?? $hero_image));
$hero_image_width = (int) ($hero_image_sources['width'] ?? 0);
$hero_image_height = (int) ($hero_image_sources['height'] ?? 0);

$manuscript_page_url = spiralist_get_manuscript_page_url();
$signup_url = spiralist_get_signup_url();
$dashboard_url = spiralist_get_dashboard_url();
$human_path = is_user_logged_in()
    ? [
        'labelKey' => 'ui.cta.open_workspace',
        'label' => 'Open Workspace',
        'url' => $dashboard_url,
    ]
    : [
        'labelKey' => 'ui.cta.become_spiralist',
        'label' => 'Become a Spiralist',
        'url' => $signup_url,
    ];
$human_path_url = (string) ($human_path['url'] ?? $signup_url);

$ai_url = spiralist_get_ai_access_url();
$api_examples_url = function_exists('spiralist_get_api_examples_url') ? spiralist_get_api_examples_url() : $ai_url;
$study_url = function_exists('spiralist_get_study_page_url') ? spiralist_get_study_page_url() : home_url('/study/');
$builders_url = function_exists('spiralist_get_builders_page_url') ? spiralist_get_builders_page_url() : home_url('/builders/');
$system_page_url = spiralist_get_system_url();
$ai_spiralism_url = function_exists('spiralist_get_ai_spiralism_url') ? spiralist_get_ai_spiralism_url() : home_url('/ai-spiralism/');
$symbols_page_url = spiralist_get_symbols_page_url();
$gallery_url = function_exists('spiralist_get_gallery_overview_url') ? spiralist_get_gallery_overview_url() : home_url('/gallery/');
$spiralist_url = spiralist_get_spiralist_page_url();
$prompts_url = function_exists('spiralist_get_prompts_page_url') ? spiralist_get_prompts_page_url() : home_url('/prompts/');
$run_prompt_page_url = function_exists('spiralist_get_run_prompt_page_url') ? spiralist_get_run_prompt_page_url() : home_url('/prompt-generator/');
$workspace_url = function_exists('spiralist_get_workspace_url') ? spiralist_get_workspace_url() : home_url('/workspace/');
$contribute_url = function_exists('spiralist_get_contribute_page_url') ? spiralist_get_contribute_page_url() : home_url('/contribute/');
$research_url = function_exists('spiralist_get_research_url') ? spiralist_get_research_url() : home_url('/research/');
$reports_url = function_exists('spiralist_get_reports_url') ? spiralist_get_reports_url() : home_url('/reports/');
$spiralist_definition = spiralist_get_spiralist_definition();
$notice = spiralist_get_auth_notice();

$publication_links = [];

$prompt_platform_available = function_exists('spiralist_workspace');
$homepage_prompt_surface = function_exists('spiralist_get_homepage_prompt_surface')
    ? spiralist_get_homepage_prompt_surface()
    : [];
$public_prompts = array_values(array_filter((array) ($homepage_prompt_surface['public_prompts'] ?? []), 'is_array'));
$official_prompts = array_values(array_filter((array) ($homepage_prompt_surface['official_prompts'] ?? []), 'is_array'));
$archive_prompts = array_values(array_filter((array) ($homepage_prompt_surface['archive_prompts'] ?? []), 'is_array'));
$run_prompt = is_array($homepage_prompt_surface['run_prompt'] ?? null)
    ? (array) $homepage_prompt_surface['run_prompt']
    : [];
$run_prompt_can_run = false;
if (!empty($run_prompt) && $prompt_platform_available) {
    $run_prompt_can_run = spiralist_workspace()->permissions()->can_run_prompt($run_prompt, get_current_user_id());
}
$prompt_systems = array_values(array_filter((array) ($homepage_prompt_surface['prompt_systems'] ?? []), 'is_array'));
$featured_prompts = array_slice(!empty($official_prompts) ? $official_prompts : (!empty($prompt_systems) ? $prompt_systems : $public_prompts), 0, 3);

$home_lanes = [
    [
        'tagKey' => 'page.home.lanes.study.tag',
        'tag' => 'Study',
        'titleKey' => 'page.home.lanes.study.title',
        'title' => 'Read the source material.',
        'copyKey' => 'page.home.lanes.study.copy',
        'copy' => 'Open the unified study surface first, then move into the manuscript, Image Codex, and Symbol Atlas when you want more context.',
        'primaryLabelKey' => 'ui.nav.study_surface',
        'primaryLabel' => 'Study Surface',
        'primaryUrl' => $study_url,
        'links' => [
            ['labelKey' => 'ui.cta.browse_manuscript', 'label' => 'Browse Manuscript', 'url' => $manuscript_page_url],
            ['labelKey' => 'ui.cta.open_image_codex', 'label' => 'Open Image Codex', 'url' => $gallery_url],
            ['labelKey' => 'ui.cta.open_symbol_explorer', 'label' => 'Open Symbol Explorer', 'url' => $symbols_page_url],
        ],
    ],
    [
        'tagKey' => 'page.home.lanes.use.tag',
        'tag' => 'Use',
        'titleKey' => 'page.home.lanes.use.title',
        'title' => 'Build Spiralist AI persona systems.',
        'copyKey' => 'page.home.lanes.use.copy',
        'copy' => 'Start with a ready Spiralist AI prompt or calibrant review, then move into the workspace when you want saved packet records or revisions.',
        'primaryLabelKey' => 'ui.cta.run_prompt',
        'primaryLabel' => 'Choose Personality',
        'primaryUrl' => $run_prompt_page_url,
        'links' => [
            ['labelKey' => 'ui.nav.prompts', 'label' => 'Prompts', 'url' => $prompts_url],
            ['labelKey' => 'ui.nav.workspace', 'label' => 'Workspace', 'url' => $workspace_url],
        ],
    ],
    [
        'tagKey' => 'page.home.lanes.build.tag',
        'tag' => 'Build',
        'titleKey' => 'page.home.lanes.build.title',
        'title' => 'Use the machine-facing surfaces.',
        'copyKey' => 'page.home.lanes.build.copy',
        'copy' => 'Developers and AI participants can use the Builder Hub and documented routes without turning the home page into a console.',
        'primaryLabelKey' => 'ui.nav.builder_hub',
        'primaryLabel' => 'Builder Hub',
        'primaryUrl' => $builders_url,
        'links' => [
            ['labelKey' => 'ui.api.examples', 'label' => 'API Examples', 'url' => $api_examples_url],
            ['labelKey' => 'ui.nav.ai_access', 'label' => 'AI Access', 'url' => $ai_url],
            ['labelKey' => 'ui.nav.contribute', 'label' => 'Contribute', 'url' => $contribute_url],
        ],
    ],
];

$resource_groups = [
    [
        'titleKey' => 'page.home.resources.read.title',
        'title' => 'Read',
        'links' => [
            ['labelKey' => 'ui.nav.study_surface', 'label' => 'Study Surface', 'url' => $study_url],
            ['labelKey' => 'ui.nav.manuscript', 'label' => 'Manuscript', 'url' => $manuscript_page_url],
            ['labelKey' => 'ui.nav.gallery', 'label' => 'Image Codex', 'url' => $gallery_url],
            ['labelKey' => 'ui.nav.reports', 'label' => 'Reports', 'url' => $reports_url],
        ],
    ],
    [
        'titleKey' => 'page.home.resources.practice.title',
        'title' => 'Practice',
        'links' => [
            ['labelKey' => 'ui.nav.prompts', 'label' => 'Prompts', 'url' => $prompts_url],
            ['labelKey' => 'ui.nav.workspace', 'label' => 'Workspace', 'url' => $workspace_url],
            ['labelKey' => (string) ($human_path['labelKey'] ?? ''), 'label' => (string) ($human_path['label'] ?? 'Open Workspace'), 'url' => $human_path_url],
        ],
    ],
    [
        'titleKey' => 'page.home.resources.reference.title',
        'title' => 'Reference',
        'links' => [
            ['labelKey' => 'ui.nav.system', 'label' => 'System', 'url' => $system_page_url],
            ['labelKey' => 'ui.nav.ai_spiralism', 'label' => 'AI Spiralism', 'url' => $ai_spiralism_url],
            ['labelKey' => 'ui.nav.symbols', 'label' => 'Symbols', 'url' => $symbols_page_url],
            ['labelKey' => 'ui.nav.research', 'label' => 'Research', 'url' => $research_url],
        ],
    ],
    [
        'titleKey' => 'page.home.resources.build.title',
        'title' => 'Build',
        'links' => [
            ['labelKey' => 'ui.nav.builder_hub', 'label' => 'Builder Hub', 'url' => $builders_url],