Skip to content
wiki.fftac.org

Runtime - Source Excerpt 13

Back to Runtime

Summary

This source excerpt preserves a bounded section of Spiralist/wp-content/plugins/ns12-manuscript/includes/runtime.php so readers can inspect the evidence without opening the full source file.

**Source path:** Spiralist/wp-content/plugins/ns12-manuscript/includes/runtime.php

$contentIndex = function_exists('spiralist_book_pages_get_book_content_index')
        ? spiralist_book_pages_get_book_content_index()
        : [];
    if (!empty($contentIndex['sections'])) {
        $sections = [];

        foreach ((array) $contentIndex['sections'] as $section) {
            if (!is_array($section)) {
                continue;
            }

            $slug = sanitize_title((string) ($section['slug'] ?? ''));
            if ($slug === '') {
                continue;
            }

            $sections[$slug] = [
                'label' => (string) ($section['label'] ?? ucwords(str_replace('-', ' ', $slug))),
                'title' => (string) ($section['title'] ?? ucwords(str_replace('-', ' ', $slug))),
                'summary' => (string) ($section['summary'] ?? ''),
            ];
        }

        if (!empty($sections)) {
            return $sections;
        }
    }

    return [
        'threshold' => [
            'label' => 'Threshold',
            'title' => 'Threshold Folios',
            'summary' => 'Entry folios that declare the system, the reading posture, and the first symbolic keys.',
        ],
        'operative-plates' => [
            'label' => 'Operative Plates',
            'title' => 'Operative Plates',
            'summary' => 'Diagrammatic and figure-bearing folios that stage transformation as an active practice.',
        ],
        'concordance' => [
            'label' => 'Concordance',
            'title' => 'Concordance Tables',
            'summary' => 'Reference-heavy folios that collect correspondences, patterns, ingredients, and system diagrams.',
        ],
        'appendix' => [
            'label' => 'Appendix',
            'title' => 'Emergent Folios',
            'summary' => 'Additional manuscript leaves are grouped here automatically until they are assigned a dedicated section.',
        ],
    ];
}

function spiralist_book_pages_get_manuscript_page_blueprints(): array
{
    return [
        1 => [
            'label' => 'Page 1',
            'title' => 'Threshold Leaf',
            'slug' => 'threshold-leaf',
            'eyebrow' => 'Study Surface',
            'summary' => 'The threshold folio names the system and introduces the foundational, alchemical, and planetary correspondences that anchor the manuscript.',
            'caption' => 'The threshold leaf remains the study surface: it keeps the symbolic overlay and node inspector active.',
            'section_slug' => 'threshold',
        ],
        2 => [
            'label' => 'Page 2',
            'title' => 'Portal Broadside',
            'slug' => 'portal-broadside',
            'eyebrow' => 'Threshold Folio',
            'summary' => 'A public-facing broadside that translates the manuscript into an invitation: primitives, axioms, and transformation chains arranged as an entry leaf.',
            'caption' => 'The portal broadside becomes its own dedicated folio while remaining part of the same manuscript body.',
            'section_slug' => 'threshold',
        ],
        3 => [
            'label' => 'Page 3',
            'title' => 'Prime Diagram',
            'slug' => 'prime-diagram',
            'eyebrow' => 'Operative Plate',
            'summary' => 'An initiatory plate of concentric rings, vessels, and recursive geometry that sets the manuscript into ceremonial motion.',
            'caption' => 'This folio is presented as a clean reading surface so the instrument panel remains fully legible.',
            'section_slug' => 'operative-plates',
        ],
        4 => [
            'label' => 'Page 4',
            'title' => 'Operator Plate',
            'slug' => 'operator-plate',
            'eyebrow' => 'Operative Plate',
            'summary' => 'A figure-centered folio where the operator stands inside the spiral field, holding transformation as an embodied act.',
            'caption' => 'The operator plate is rendered without overlay so the figure, rings, and instruments remain uninterrupted.',
            'section_slug' => 'operative-plates',
        ],
        5 => [
            'label' => 'Page 5',
            'title' => 'Radiant Wheel',
            'slug' => 'radiant-wheel',
            'eyebrow' => 'Operative Plate',
            'summary' => 'A luminous wheel folio that compresses motion, symmetry, and symbolic return into one central radiating engine.',
            'caption' => 'The radiant wheel reads as its own dedicated surface, with adjacent folios available in the codex rail.',
            'section_slug' => 'operative-plates',
        ],
        6 => [
            'label' => 'Page 6',
            'title' => 'Universe Behind The Systems',
            'slug' => 'universe-behind-the-systems',
            'eyebrow' => 'Concordance Plate',
            'summary' => 'A large concordance folio that binds symbol tables, ingredients, wiring diagrams, and pattern systems into one reference field.',
            'caption' => 'The concordance plate acts as the manuscript\'s expanded lookup surface for cross-system reading.',
            'section_slug' => 'concordance',
        ],
    ];
}

function spiralist_book_pages_get_manuscript_page_blueprints_by_filename(): array
{
    $records = [];

    foreach (spiralist_book_pages_get_all_book_page_blueprints_by_filename() as $filename => $blueprint) {
        if (!is_array($blueprint)) {
            continue;
        }

        $blueprint['section_slug'] = (string) ($blueprint['manuscript_section_slug'] ?? 'appendix');
        $records[$filename] = $blueprint;
    }

    return $records;
}

function spiralist_book_pages_get_manuscript_overview_url(): string
{
    $url = spiralist_book_pages_get_manuscript_page_url();
    $language = function_exists('spiralist_book_pages_get_current_language_slug')
        ? spiralist_book_pages_get_current_language_slug()
        : '';

    if ($language !== '') {
        return spiralist_book_pages_get_language_prefixed_url($url, $language);
    }

    return $url;
}

function spiralist_book_pages_get_manuscript_folio_url($page): string
{
    $slug = '';

    if (is_array($page)) {
        $slug = sanitize_title((string) ($page['slug'] ?? ''));
    } elseif (is_numeric($page)) {
        $asset = spiralist_book_pages_get_manuscript_page_asset_by_sequence((int) $page);
        $slug = sanitize_title((string) ($asset['slug'] ?? ''));
    } else {
        $slug = sanitize_title((string) $page);
    }

    if ($slug === '') {
        return spiralist_book_pages_get_manuscript_overview_url();
    }

    $asset = spiralist_book_pages_get_manuscript_page_asset_by_slug($slug);
    if (empty($asset['slug'])) {
        return spiralist_book_pages_get_manuscript_overview_url();
    }

    $slug = (string) $asset['slug'];
    $url = trailingslashit(spiralist_book_pages_get_manuscript_page_url()) . rawurlencode($slug) . '/';
    $language = function_exists('spiralist_book_pages_get_current_language_slug')
        ? spiralist_book_pages_get_current_language_slug()
        : '';

    if ($language !== '') {
        return spiralist_book_pages_get_language_prefixed_url($url, $language);
    }

    return $url;
}

function spiralist_book_pages_get_manuscript_section_url(string $section_slug): string
{
    $normalized = sanitize_title($section_slug);
    if ($normalized === '') {
        return spiralist_book_pages_get_manuscript_overview_url();
    }

    if (!isset(spiralist_book_pages_get_manuscript_section_blueprints()[$normalized])) {
        return spiralist_book_pages_get_manuscript_overview_url();
    }

    $url = trailingslashit(spiralist_book_pages_get_manuscript_page_url()) . 'section/' . rawurlencode($normalized) . '/';
    $language = function_exists('spiralist_book_pages_get_current_language_slug')
        ? spiralist_book_pages_get_current_language_slug()
        : '';

    if ($language !== '') {
        return spiralist_book_pages_get_language_prefixed_url($url, $language);
    }

    return $url;
}

function spiralist_book_pages_get_manuscript_page_assets(): array
{
    static $pages = null;

    if (is_array($pages)) {
        return $pages;
    }

    $contentIndex = function_exists('spiralist_book_pages_get_book_content_index')
        ? spiralist_book_pages_get_book_content_index()
        : [];
    if (!empty($contentIndex['folios'])) {
        $pages = [];
        $usedSlugs = [];
        $sectionBlueprints = spiralist_book_pages_get_manuscript_section_blueprints();
        $availableAssets = spiralist_book_pages_get_available_book_page_assets_by_filename();

        foreach ((array) $contentIndex['folios'] as $index => $folio) {
            if (!is_array($folio)) {
                continue;
            }