Runtime - Source Excerpt 24
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
'extensions' => new stdClass(),
];
return wp_json_encode($shape, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);
}
function spiralist_book_pages_get_current_symbol_payload(): string
{
$symbols = spiralist_book_pages_get_symbols();
$first = $symbols[0];
$browser_payload = spiralist_book_pages_get_symbol_browser_payload($first);
$payload = [
'type' => 'symbol',
'id' => $browser_payload['canonicalId'],
'label' => $browser_payload['label'],
'meaning' => $browser_payload['meaning'],
'definition' => $browser_payload['definition'],
'axioms' => $browser_payload['axiomIds'],
'relations' => array_values(array_filter((array) ($first['related'] ?? []), 'is_string')),
'transformationChain' => $browser_payload['transformationChain'],
'provenance' => $browser_payload['provenance'],
];
return wp_json_encode($payload, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);
}
function spiralist_book_pages_get_editorial_excerpt(): string
{
if (!is_singular()) {
return '';
}
$post = get_queried_object();
if (!$post instanceof WP_Post) {
return '';
}
if (has_excerpt($post)) {
return get_the_excerpt($post);
}
$content = trim(wp_strip_all_tags($post->post_content));
if ($content === '') {
return '';
}
return wp_trim_words($content, 35);
}
function spiralist_book_pages_get_auth_notice(): array
{
$notice = sanitize_key((string) get_query_var('notice'));
if ($notice === '') {
$notice = sanitize_key((string) ($_GET['notice'] ?? ''));
}
$error = sanitize_key((string) ($_GET['auth_error'] ?? ''));
$messages = [
'registered' => ['type' => 'success', 'message' => 'Your participant account is active. Welcome to Spiralist.'],
'logged_in' => ['type' => 'success', 'message' => 'You are now signed in.'],
'logged_out' => ['type' => 'success', 'message' => 'You have been logged out.'],
'account_updated' => ['type' => 'success', 'message' => 'Your account details were updated.'],
'pattern_submitted' => ['type' => 'success', 'message' => 'Your pattern submission was recorded in the Spiralist system.'],
'invalid_request' => ['type' => 'error', 'message' => 'The request could not be verified. Please try again.'],
'missing_fields' => ['type' => 'error', 'message' => 'Please complete all required fields.'],
'invalid_email' => ['type' => 'error', 'message' => 'Enter a valid email address.'],
'password_short' => ['type' => 'error', 'message' => 'Use a password with at least 8 characters.'],
'terms_required' => ['type' => 'error', 'message' => 'Review the linked site policies and confirm agreement before continuing.'],
'age_confirmation_required' => ['type' => 'error', 'message' => 'Confirm that you meet the minimum age or guardian-permission requirement before continuing.'],
'username_exists' => ['type' => 'error', 'message' => 'That username is already in use.'],
'email_exists' => ['type' => 'error', 'message' => 'That email address is already registered.'],
'registration_failed' => ['type' => 'error', 'message' => 'Registration could not be completed. Please try again.'],
'invalid_credentials' => ['type' => 'error', 'message' => 'The username or password was not accepted.'],
'pattern_invalid' => ['type' => 'error', 'message' => 'Pattern submissions need at least a short title or a meaningful body of text.'],
'membership_pending' => ['type' => 'error', 'message' => 'This participant account is pending activation.'],
'membership_suspended' => ['type' => 'error', 'message' => 'This participant account is suspended.'],
'membership_cancelled' => ['type' => 'error', 'message' => 'This participant account has been cancelled.'],
'account_invalid_email' => ['type' => 'error', 'message' => 'Enter a valid account email address.'],
'account_email_exists' => ['type' => 'error', 'message' => 'That email address is already being used by another account.'],
'account_terms_required' => ['type' => 'error', 'message' => 'Review the linked site policies and confirm agreement before saving your account.'],
'account_age_confirmation_required' => ['type' => 'error', 'message' => 'Confirm that you meet the minimum age or guardian-permission requirement before saving your account.'],
'account_update_failed' => ['type' => 'error', 'message' => 'Your account could not be updated. Please try again.'],
];
if ($notice !== '' && isset($messages[$notice])) {
return $messages[$notice];
}
if ($error !== '' && isset($messages[$error])) {
return $messages[$error];
}
return [];
}