Helpers - Source Excerpt 26
Summary
This source excerpt preserves a bounded section of Spiralist/wp-content/themes/spiralist/inc/helpers.php so readers can inspect the evidence without opening the full source file.
**Source path:** Spiralist/wp-content/themes/spiralist/inc/helpers.php
'summary' => 'Additional manuscript leaves are grouped here automatically until they are assigned a dedicated section.',
],
];
}
function spiralist_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_get_manuscript_page_blueprints_by_filename(): array
{
$records = [];
foreach (spiralist_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_get_manuscript_overview_url(): string
{
$url = spiralist_get_manuscript_page_url();
$language = function_exists('spiralist_get_current_language_slug')
? spiralist_get_current_language_slug()
: '';
if ($language !== '') {
return spiralist_get_language_prefixed_url($url, $language);
}
return $url;
}
function spiralist_get_manuscript_folio_url($page): string
{
$slug = '';
if (is_array($page)) {
$slug = (string) ($page['slug'] ?? '');
} elseif (is_numeric($page)) {
$asset = spiralist_get_manuscript_page_asset_by_sequence((int) $page);
$slug = (string) ($asset['slug'] ?? '');
} else {
$slug = sanitize_title((string) $page);
$asset = spiralist_get_manuscript_page_asset_by_slug($slug);
if (!empty($asset['slug'])) {
$slug = (string) $asset['slug'];
}
}
if ($slug === '') {
return spiralist_get_manuscript_overview_url();
}
$url = trailingslashit(spiralist_get_manuscript_page_url()) . 'folio/' . rawurlencode($slug) . '/';
$language = function_exists('spiralist_get_current_language_slug')
? spiralist_get_current_language_slug()
: '';
if ($language !== '') {
return spiralist_get_language_prefixed_url($url, $language);
}
return $url;
}
function spiralist_get_manuscript_section_url(string $section_slug): string
{
$normalized = sanitize_title($section_slug);
if ($normalized === '') {
return spiralist_get_manuscript_overview_url();
}
$url = trailingslashit(spiralist_get_manuscript_page_url()) . 'section/' . rawurlencode($normalized) . '/';
$language = function_exists('spiralist_get_current_language_slug')
? spiralist_get_current_language_slug()
: '';
if ($language !== '') {
return spiralist_get_language_prefixed_url($url, $language);
}
return $url;
}
function spiralist_get_manuscript_page_assets(): array
{
static $pages = null;
if (is_array($pages)) {
return $pages;
}
$pages = [];
$used_slugs = [];
$section_blueprints = spiralist_get_manuscript_section_blueprints();
$page_blueprints = spiralist_get_manuscript_page_blueprints();
$filename_blueprints = spiralist_get_manuscript_page_blueprints_by_filename();
$build_page = static function (array $asset, int $sequence) use (&$used_slugs, $section_blueprints, $page_blueprints, $filename_blueprints): array {
$filename_key = strtolower((string) ($asset['filename'] ?? ''));
$blueprint = $filename_blueprints[$filename_key] ?? ($page_blueprints[$sequence] ?? []);
$is_study_surface = !empty($blueprint['is_study_surface']);
$title = trim((string) ($blueprint['title'] ?? spiralist_humanize_asset_label((string) ($asset['filename'] ?? 'Manuscript Folio'))));
if ($title === '') {
$title = 'Manuscript Folio ' . $sequence;
}
$slug = sanitize_title((string) ($blueprint['slug'] ?? $title));
if ($slug === '') {
$slug = 'folio-' . $sequence;
}
if (isset($used_slugs[$slug])) {
$slug .= '-' . $sequence;
}
$used_slugs[$slug] = true;
$section_slug = sanitize_title((string) ($blueprint['section_slug'] ?? 'appendix'));
if (!isset($section_blueprints[$section_slug])) {
$section_slug = 'appendix';
}
$section = $section_blueprints[$section_slug];
$label = trim((string) ($blueprint['label'] ?? ''));
if ($label === '' || preg_match('/^page\s+\d+$/i', $label) === 1) {
$label = 'Page ' . $sequence;
}
$eyebrow = trim((string) ($blueprint['eyebrow'] ?? ($is_study_surface ? 'Study Surface' : 'Continuation Folio')));
$summary = trim((string) ($blueprint['summary'] ?? ($is_study_surface
? 'The primary manuscript page used for the study overlay and symbolic field inspection.'
: 'Continuation page presented as a direct manuscript reading surface without overlay.')));
$caption = trim((string) ($blueprint['caption'] ?? ($is_study_surface
? 'The primary folio remains the active study surface for symbolic inspection.'
: 'This folio remains available as a direct artifact surface without overlay.')));
return array_merge(
$asset,
[
'sequence' => $sequence,
'label' => $label,
'title' => $title,
'slug' => $slug,
'eyebrow' => $eyebrow,
'summary' => $summary,
'caption' => $caption,
'section_slug' => $section_slug,
'section_label' => (string) ($section['label'] ?? 'Section'),
'section_title' => (string) ($section['title'] ?? 'Section'),
'section_summary' => (string) ($section['summary'] ?? ''),