Jake Vanderwerf
3 hours ago a17c578433ef543e220697813a9367a260df83e1
ajakevan.php
@@ -45,6 +45,7 @@
define('JVB_LOADED', is_plugin_active('jvb/jvb.php'));
use JVBase\base\Site;
use JVBase\managers\Cache;
use JVBase\managers\CacheManager;
use JVBase\meta\Meta;
@@ -73,6 +74,43 @@
//require(AJV_DIR . '/files/fileManagement.php');
require(AJV_DIR . '/seo.php');
add_action('plugins_loaded', 'ajv_siteDefinition', 2);
add_action('jvbLoadDefinitions', 'ajv_siteDefinition');
function ajv_siteDefinition():void
{
    if (!class_exists('JVBase\base\Site')) {
        return;
    }
    $site = Site::getInstance();
    $site->set('icons', 'light');
    $site->setAll([
        'is_directory',
        'dashboard',
        'magic_link',
        'feed_block',
        'support',
//        'faq',
        'referrals'
//        'has_map',
//        'referrals',
    ]);
    $site->setIntegrations([
        'cloudflare',
//        'facebook',
        'gmb',
        'maps',
        'helcim',
        'postmark',
//        'instagram',
        'umami'
    ]);
    $login = $site->login();
    $site->setDirectorySingular('List');
    $site->setDirectoryPlural('Lists');
}
/**
 * Defines base options like:
@@ -90,7 +128,7 @@
 *         - rewrite rules
 *         - archive title
 */
add_filter('jvb_site', 'ajv_setup_site');
//add_filter('jvb_site', 'ajv_setup_site');
function ajv_setup_site():array
{
    return [
@@ -184,7 +222,7 @@
        $items[] = [
            'text'  => $registrar->getSingular(),
            'url'   => get_post_type_archive_link(BASE.$slug),
            'icon'  => $registrar->getIcon('icon'),
            'icon'  => $registrar->getIcon(),
            'class' => $slug,
        ];
    }
@@ -217,6 +255,12 @@
    $icons['logo-right-jakevan'] = AJV_DIR . '/assets/icons/logo-right-aligned-jakevan.svg';
    $icons['jakevan'] = AJV_DIR . '/assets/icons/jakevan.svg';
    $icons['loading'] = AJV_DIR . '/assets/icons/loading.svg';
//    $icons['art'] = AJV_DIR . '/assets/icons/jakevan-does-art.svg';
//    $icons['design'] = AJV_DIR . '/assets/icons/jakevan-does-design.svg';
//    $icons['development'] = AJV_DIR . '/assets/icons/jakevan-does-development.svg';
//    $icons['project'] = AJV_DIR . '/assets/icons/jakevan-does-project.svg';
//    $icons['strategy'] = AJV_DIR . '/assets/icons/jakevan-does-strategy.svg';
//    $icons['writing'] = AJV_DIR . '/assets/icons/jakevan-does-writing.svg';
    return $icons;
}
@@ -229,11 +273,20 @@
        && array_key_exists('className', $block['attrs'])
        && $block['attrs']['className'] === 'is-style-fixed'
        && $nav === '') {
        $text = '<li><a href="'.jvbTextLink(8258239916,'I have an idea - can you help bring it to life?').'" title="Text Me">'.jvbIcon('chat').'<span class="hide-small">825.823.9916</span></a></li>';
        $email = '<li><a href="'.jvbMailToLink(
        $text = sprintf(
            '<li><a href="%s" title="Text Me">%s<span class="hide-small">825.823.9916</span></a></li>',
            jvbTextLink(8258239916,'I have an idea - can you help bring it to life?'),
            jvbIcon('chat')
        );
        $email = sprintf(
            '<li><a href="%s" title="Email Me">%s<span class="hide-small">get@jakevan.ca</span></a></li>',
            jvbMailToLink(
                'get@jakevan.ca',
                '[JakeVan] I have an idea - can you help bring it to life?','Be sure to as much detail as possible, including what your idea is about, when you need it done by, and budget.'
            ).'" title="Email Me">'.jvbIcon('envelope').'<span class="hide-small">get@jakevan.ca</span></a></li>';
            ),
            jvbIcon('envelope')
        );
        return $text.$email;
    }
@@ -255,6 +308,7 @@
{
    $extra = match($type) {
        'strategy'  => 'Edmonton-focused brand',
        'project'   => 'Edmonton-based',
        default => 'Edmonton made'
    };
    $title = ($type === 'directory') ? 'Directory' : Registrar::getInstance($type)->getSingular();
@@ -267,18 +321,21 @@
    return ($type === 'directory') ? '' : '<p>Or see <a href="'.JVB()->directories()->getDirectoryList()[$type]['url'].'">alphabetical list</a>.</p>';
}
function ajv_render_core_post_content(array $block, string $content = ''):string
function ajv_prerender_core_post_content(array $block, ?string $content, ?WP_Block $parent):?string
{
    if(!is_singular(array_map(function($item) { return BASE.$item; }, Registrar::getRegistered('post')))) {
        return JVB()->blocks()->render_core_post_content($block, $content);
        return null;
    }
    $postType = jvbNoBase(get_post_type());
    $function = "ajv_render_{$postType}_content";
    $function = "ajv_prerender_{$postType}_content";
    $base = '';
    if (function_exists($function)) {
        $base = call_user_func($function, $block, $content);
        $base = $function($block,$content,$parent);
    }
    return ($base === '') ? JVB()->blocks()->render_core_post_content($block, $content) : $base;
    return $base;
//    return $base.JVB()->blocks()->prerender_core_post_content($block, $content, $parent);
}
add_filter('the_seo_framework_meta_render_data', 'ajvb_no_next_archive', 10, 1);
@@ -366,7 +423,6 @@
function ajvb_format_needs(array $needs):string
{
    $theNeeds = '';
    jvbDump($needs);
    foreach ($needs as $need) {
        $theNeeds .= sprintf(
            '<li><h3>%s</h3>%s<div class="info">%s</div></li>',