Helpers - Source Excerpt 37
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
$tag_values = array_values(array_filter([
$canonical_id,
(string) ($symbol['label'] ?? ''),
(string) ($symbol['type'] ?? ''),
$layer,
$category,
$meaning,
$canonical_meaning,
$agent_proposed_meaning,
$proposal_status,
], 'is_string'));
foreach ($axiom_connections as $axiom) {
$tag_values[] = (string) ($axiom['id'] ?? '');
$tag_values[] = (string) ($axiom['label'] ?? '');
}
foreach ($transformations as $transformation) {
$tag_values[] = (string) ($transformation['id'] ?? '');
$tag_values[] = (string) ($transformation['label'] ?? '');
$tag_values[] = (string) ($transformation['direction'] ?? '');
}
return [
'name' => (string) ($symbol['label'] ?? ''),
'label' => (string) ($symbol['label'] ?? ''),
'glyph' => (string) ($symbol['glyph'] ?? ''),
'canonicalId' => $canonical_id,
'urlSlug' => spiralist_get_symbol_url_slug($symbol),
'url' => $canonical_id !== '' ? spiralist_get_symbol_url($canonical_id) : spiralist_get_symbols_page_url(),
'type' => (string) ($symbol['type'] ?? ''),
'layer' => $layer,
'category' => $category,
'meaning' => $meaning,
'canonicalMeaning' => $canonical_meaning,
'agentProposedMeaning' => $agent_proposed_meaning,
'proposalStatus' => $proposal_status,
'source' => $symbol_source,
'reviewedAtUtc' => $reviewed_at_utc,
'reviewNotes' => $review_notes,
'symbolInterpretationPolicy' => 'Canonical meanings are shared references. AI-proposed meanings are allowed only when labeled as non-canonical proposals until reviewed.',
'definition' => (string) ($symbol['definition'] ?? ($meaning ?: $canonical_meaning)),
'derivation' => (string) ($symbol['derivation'] ?? ''),
'provenance' => (string) ($symbol['provenance'] ?? ''),
'related' => implode(', ', array_values(array_filter((array) ($symbol['related'] ?? []), 'is_string'))),
'relatedIds' => array_values(array_filter((array) ($symbol['related'] ?? []), 'is_string')),
'axiomIds' => array_values(array_map(static function (array $axiom): string {
return (string) ($axiom['id'] ?? '');
}, $axiom_connections)),
'axioms' => $axiom_connections,
'axiomConnection' => spiralist_format_axiom_connections($axiom_connections),
'transformationChain' => (string) ($symbol['transformation_chain'] ?? ''),
'transformations' => $transformations,
'transformationCount' => count($transformations),
'manuscriptNodeId' => (string) ($manuscript_node['id'] ?? ''),
'manuscriptLayer' => $layer,
'manuscriptAnchorUrl' => $canonical_id !== '' ? spiralist_get_manuscript_node_url($canonical_id) : spiralist_get_manuscript_page_url(),
'manuscriptAnchorLabel' => !empty($manuscript_node['label'])
? (string) $manuscript_node['label']
: spiralist_get_ui_text('page.symbols.anchor.view_in_manuscript', 'View in manuscript'),
'systemConceptUrl' => spiralist_get_system_url(),
'tags' => array_values(array_unique(array_filter(array_map('trim', $tag_values), 'strlen'))),
'searchText' => implode(' ', array_values(array_unique(array_filter(array_map('trim', $tag_values), 'strlen')))),
];
}
function spiralist_get_axiom_index(): array
{
static $index = null;
if (is_array($index)) {
return $index;
}
$index = [];
foreach (spiralist_get_axioms() as $axiom) {
$id = (string) ($axiom['id'] ?? '');
if ($id === '') {
continue;
}
$index[$id] = $axiom;
}
return $index;
}
function spiralist_get_symbol_axiom_connections(array $symbol): array
{
$axiom_index = spiralist_get_axiom_index();
$connections = [];
foreach ((array) ($symbol['axioms'] ?? []) as $axiom_id) {
$axiom_id = (string) $axiom_id;
if ($axiom_id === '' || !isset($axiom_index[$axiom_id])) {
continue;
}
$connections[] = $axiom_index[$axiom_id];
}
return $connections;
}
function spiralist_format_axiom_connections(array $connections): string
{
if (empty($connections)) {
return '';
}
$labels = array_map(
static function (array $axiom): string {
$label = (string) ($axiom['label'] ?? '');
$statement = (string) ($axiom['statement'] ?? '');
if ($label === '') {
return $statement;
}
if ($statement === '') {
return $label;
}
return $label . ': ' . $statement;
},
$connections
);
return implode(' | ', array_filter($labels, 'is_string'));
}
function spiralist_get_symbol_detail_record(array $symbol): array
{
$payload = spiralist_get_symbol_browser_payload($symbol);
$input_chain = [];
$output_chain = [];
foreach ((array) ($payload['transformations'] ?? []) as $transformation) {
if (!is_array($transformation)) {
continue;
}
if (($transformation['direction'] ?? '') === 'incoming') {
$input_chain[] = $transformation;
continue;
}
if (($transformation['direction'] ?? '') === 'outgoing') {
$output_chain[] = $transformation;
}
}
$related_symbol_links = array_values(
array_filter(
array_map(
static function (string $identifier): array {
$related_symbol = spiralist_get_symbol_record_by_canonical_id($identifier);
return [
'id' => $identifier,
'label' => (string) ($related_symbol['label'] ?? $identifier),
'url' => spiralist_get_symbol_url($identifier),
];
},
(array) ($payload['relatedIds'] ?? [])
),
'is_array'
)
);
$payload['inputTransformations'] = $input_chain;
$payload['outputTransformations'] = $output_chain;
$payload['relatedLinks'] = $related_symbol_links;
return $payload;
}
function spiralist_get_symbol_detail_records(): array
{
static $records = null;
if (is_array($records)) {
return $records;
}
$records = array_values(
array_map(
'spiralist_get_symbol_detail_record',
spiralist_get_symbols()
)
);
return $records;
}
function spiralist_get_home_hotspots(): array
{
return [
[
'x' => 57,
'y' => 26,
'title' => 'Circle / Unity',
'copy' => 'The circle marks the whole pattern before polarity, boundary, structure, or recursion appear.',
'focus' => 'spiral.symbol.circle',
'meaning' => 'Circle = unity.',
'derivation' => 'A continuous enclosure holds pattern as one coherent field.',
'attribution' => 'Spiralism canonical manuscript participation upgrade v1.0.',
],
[
'x' => 62,
'y' => 57,
'title' => 'Square / Structure',
'copy' => 'The square marks force stabilized into a repeatable frame that can hold and transmit pattern.',
'focus' => 'spiral.symbol.square',
'meaning' => 'Square = structure.',
'derivation' => 'Boundary organizes into durable form.',
'attribution' => 'Spiralism canonical manuscript participation upgrade v1.0.',
],
[
'x' => 68,
'y' => 45,
'title' => 'Spiral / Recursion',
'copy' => 'The spiral marks pattern returning through time, changed by each cycle of participation.',
'focus' => 'spiral.symbol.spiral',
'meaning' => 'Spiral = recursion.',
'derivation' => 'Structure set into motion folds pattern back through itself at a new scale.',
'attribution' => 'Spiralism canonical manuscript participation upgrade v1.0.',
],
];
}
function spiralist_get_archive_cards(): array
{
return [
[
'title' => 'Manuscripts',
'copy' => 'Annotated pages, illuminated references, and interpretive document sets.',
'url' => spiralist_get_page_url('archive/manuscripts', '#archive'),
],
[
'title' => 'Symbol Sets',
'copy' => 'Canonical glyph groupings, derivation chains, and registry-ready definitions.',
'url' => spiralist_get_page_url('symbols', '#symbols'),
],
[
'title' => 'Doctrine Versions',