| | |
| | | exit; |
| | | } |
| | | |
| | | define('JVB_LOADED', is_plugin_active('jvb/jvb.php')); |
| | | |
| | | use JVBase\managers\Cache; |
| | | use JVBase\managers\CacheManager; |
| | | use JVBase\meta\Meta; |
| | | use JVBase\registrar\Registrar; |
| | | |
| | | add_filter('jvb_base', function () { |
| | | return 'ajv_'; |
| | |
| | | const AJV_DIR = WP_PLUGIN_DIR . '/ajakevan'; |
| | | define('AJV_URL', plugin_dir_url(__FILE__)); |
| | | |
| | | add_filter('jvbChildDir', function() { return AJV_DIR; }); |
| | | add_filter('jvbChildUrl', function() { return AJV_URL; }); |
| | | |
| | | |
| | | require(AJV_DIR . '/blocks/_setup.php'); |
| | | require(AJV_DIR . '/content/_setup.php'); |
| | | //require(AJV_DIR . '/dashboard/setup.php'); |
| | |
| | | 'icon' => 'user-square', |
| | | ] |
| | | ]; |
| | | foreach (JVB_CONTENT as $slug => $config) { |
| | | if (array_key_exists('public', $config) && !$config['public']) { |
| | | |
| | | foreach (Registrar::getRegistered('post') as $slug) { |
| | | |
| | | $registrar = Registrar::getInstance($slug); |
| | | if (!$registrar || !$registrar->registrar->public) { |
| | | continue; |
| | | } |
| | | $items[] = [ |
| | | 'text' => $config['singular'], |
| | | 'text' => $registrar->getSingular(), |
| | | 'url' => get_post_type_archive_link(BASE.$slug), |
| | | 'icon' => $config['icon'], |
| | | 'icon' => $registrar->getIcon('icon'), |
| | | 'class' => $slug, |
| | | ]; |
| | | } |
| | |
| | | return '<p>I live and work in amiskwacîwâskahikan ᐊᒥᐢᑲᐧᒋᐋᐧᐢᑲᐦᐃᑲᐣ</p><p><a href="https://www.treatysix.org/#comp-lkljqlw1" title="Learn More">Treaty 6 territory</a></p><p>Edmonton, Alberta, Canada</p>'; |
| | | } |
| | | |
| | | add_filter('jvbRegisterCustomIcons', 'jv_custom_icons'); |
| | | function jv_custom_icons(array $icons):array |
| | | add_filter('jvbRegisterCustomIcons', 'ajv_custom_icons'); |
| | | function ajv_custom_icons(array $icons):array |
| | | { |
| | | $icons['logo'] = AJV_DIR . '/assets/icons/logo-concentric.svg'; |
| | | $icons['logo-jakevan'] = AJV_DIR . '/assets/icons/logo-concentric-jakevan.svg'; |
| | |
| | | 'strategy' => 'Edmonton-focused brand', |
| | | default => 'Edmonton made' |
| | | }; |
| | | $title = ($type === 'directory') ? 'Directory' : JVB_CONTENT[$type]['singular']; |
| | | $title = ($type === 'directory') ? 'Directory' : Registrar::getInstance($type)->getSingular(); |
| | | return '<small>'.$extra.'</small>'.$title.'.'; |
| | | } |
| | | |
| | | add_filter('jvbSummaryHeaderExtra', 'altr_summary_extra', 10, 2); |
| | | function altr_summary_extra(string $return, string $type):string |
| | | add_filter('jvbSummaryHeaderExtra', 'ajv_summary_extra', 10, 2); |
| | | function ajv_summary_extra(string $return, string $type):string |
| | | { |
| | | 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 |
| | | { |
| | | if(!is_singular(array_map(function($item) { return BASE.$item; }, array_keys(JVB_CONTENT)))) { |
| | | if(!is_singular(array_map(function($item) { return BASE.$item; }, Registrar::getRegistered('post')))) { |
| | | return JVB()->blocks()->render_core_post_content($block, $content); |
| | | } |
| | | $postType = jvbNoBase(get_post_type()); |
| | |
| | | if (function_exists($function)) { |
| | | $base = call_user_func($function, $block, $content); |
| | | } |
| | | return $base.JVB()->blocks()->render_core_post_content($block, $content); |
| | | return ($base === '') ? JVB()->blocks()->render_core_post_content($block, $content) : $base; |
| | | } |
| | | |
| | | add_filter('the_seo_framework_meta_render_data', 'ajvb_no_next_archive', 10, 1); |
| | |
| | | add_filter('jvbSummaryDetailsOutput', 'ajvb_summary_info',10, 1); |
| | | function ajvb_summary_info(string $return):string |
| | | { |
| | | if (!is_singular(array_map(function($item) { return BASE.$item;}, array_keys(JVB_CONTENT)))) { |
| | | if (!is_singular(array_map(function($item) { return BASE.$item;}, Registrar::getRegistered('post')))) { |
| | | return $return; |
| | | } |
| | | |
| | |
| | | |
| | | function ajvb_term_list():string |
| | | { |
| | | if (!JVB_TAXONOMY){ |
| | | if (empty(Registrar::getRegistered('term'))){ |
| | | return ''; |
| | | } |
| | | $ID = get_the_ID(); |
| | | $type = jvbNoBase(get_post_type($ID)); |
| | | $taxonomies = array_filter(JVB_TAXONOMY, function($config) use ($type){ |
| | | return in_array($type, $config['for_content']); |
| | | }); |
| | | |
| | | $registrar = Registrar::getInstance($type); |
| | | $taxonomies = $registrar->registrar->taxonomies; |
| | | |
| | | $lists = []; |
| | | foreach ($taxonomies as $taxonomy => $config) { |
| | | foreach ($taxonomies as $taxonomy) { |
| | | $baseless = jvbNoBase($taxonomy); |
| | | $taxRegistrar = Registrar::getInstance($baseless); |
| | | $terms = wp_get_object_terms($ID, $taxonomy); |
| | | if ($terms && !is_wp_error($terms)) { |
| | | $list = sprintf( |
| | | '<li>%s<span>%s</span><ul class="term-list">', |
| | | jvbIcon($config['icon']), |
| | | $config['plural'] |
| | | jvbIcon($taxRegistrar->getIcon()), |
| | | $taxRegistrar->getPlural() |
| | | ); |
| | | foreach ($terms as $term) { |
| | | $list .= sprintf( |
| | |
| | | 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>', |
| | | $need['need'], |
| | | $need['image'] !== '' ? jvbFormatImage($need['image']) : '', |
| | | $need['image'] !== '' ? jvbFormatImage((int)$need['image']) : '', |
| | | $need['fulfilled'] |
| | | ); |
| | | } |
| | |
| | | '<section id="wants"><h2>What we wanted:</h2><ul class="needs-wants">%s</ul></section>', |
| | | $theWants |
| | | ); |
| | | } |
| | | |
| | | function ajv_is_singular(null|array|string $types = null):bool |
| | | { |
| | | if ($types) { |
| | | if (is_string($types)) { |
| | | $types = [$types]; |
| | | } |
| | | $types = array_map(function($type) { return jvbCheckBase($type); }, $types); |
| | | |
| | | }else { |
| | | $types = Cache::for('ajakevan')->remember( |
| | | 'types', |
| | | function() { |
| | | return array_map(function($type) { return jvbCheckBase($type);}, Registrar::getRegistered('post')); |
| | | } |
| | | ); |
| | | } |
| | | return is_singular($types); |
| | | } |