Host Adapter
**Site relevance:** Spiralist.org
**Memory type:** plugin source memory
**Source path:** Spiralist/wp-content/plugins/ns12-manuscript/includes/host-adapter.php
**Size:** 2.4 KB
Summary
if (!defined('ABSPATH') && !defined('SPIRALIST BOOK PAGES PLUGIN ROOT PATH'))
Source Preview
This source file is short enough to preview directly on its source-memory page.
<?php
if (!defined('ABSPATH') && !defined('SPIRALIST_BOOK_PAGES_PLUGIN_ROOT_PATH')) {
exit;
}
function spiralist_book_pages_get_host_links(): array
{
$workspace_available = function_exists('spiralist_workspace');
$links = [
'home' => function_exists('home_url') ? home_url('/') : '/',
'symbols' => function_exists('spiralist_book_pages_get_symbols_page_url') ? spiralist_book_pages_get_symbols_page_url() : '',
'prompts' => $workspace_available
? home_url('/prompts/')
: (function_exists('spiralist_book_pages_get_prompts_page_url') ? spiralist_book_pages_get_prompts_page_url() : ''),
'contribute' => function_exists('spiralist_book_pages_get_existing_page_url')
? spiralist_book_pages_get_existing_page_url('contribute')
: '',
'system' => function_exists('spiralist_book_pages_get_existing_page_url')
? spiralist_book_pages_get_existing_page_url('system')
: '',
'dashboard' => function_exists('spiralist_book_pages_get_existing_page_url')
? spiralist_book_pages_get_existing_page_url('spiralist')
: '',
'doctrine' => function_exists('spiralist_book_pages_get_existing_page_url')
? spiralist_book_pages_get_existing_page_url('doctrine')
: '',
'workspace' => $workspace_available ? home_url('/workspace/') : '',
];
if (function_exists('apply_filters')) {
$links = (array) apply_filters('spiralist_book_pages_host_links', $links);
}
return $links;
}
function spiralist_book_pages_get_host_link(string $key, string $fallback = ''): string
{
$links = spiralist_book_pages_get_host_links();
return (string) ($links[$key] ?? $fallback);
}
function spiralist_book_pages_get_host_prompt_record_url(string $slug): string
{
$normalized = spiralist_book_pages_slugify($slug);
$url = '';
if ($normalized !== '' && function_exists('spiralist_book_pages_get_workspace_prompt_url')) {
$url = spiralist_book_pages_get_workspace_prompt_url($normalized);
}
if ($url === '') {
$url = spiralist_book_pages_get_host_link('prompts');
}
if (function_exists('apply_filters')) {
$url = (string) apply_filters('spiralist_book_pages_prompt_record_url', $url, $normalized);
}
return $url;
}