| | |
| | | exit; |
| | | } |
| | | |
| | | use JVBase\managers\CacheManager; |
| | | use JVBase\base\Site; |
| | | use JVBase\registrar\Registrar; |
| | | |
| | | add_filter('jvb_base', function () { |
| | | return 'altr_'; |
| | |
| | | const AJV_DIR = WP_PLUGIN_DIR . '/alegacy'; |
| | | define('AJV_URL', plugin_dir_url(__FILE__)); |
| | | |
| | | add_filter('jvbChildDir', function() { |
| | | return AJV_DIR; |
| | | }); |
| | | add_filter('jvbChildUrl', function() { |
| | | return AJV_URL; |
| | | }); |
| | | |
| | | require(AJV_DIR . '/content/_setup.php'); |
| | | require(AJV_DIR . '/dashboard/_setup.php'); |
| | | require(AJV_DIR . '/email/_setup.php'); |
| | |
| | | require(AJV_DIR . '/login/_setup.php'); |
| | | require(AJV_DIR . '/taxonomies/_setup.php'); |
| | | require(AJV_DIR . '/users/_setup.php'); |
| | | require(AJV_DIR . '/blocks/_setup.php'); |
| | | require(AJV_DIR . '/seo.php'); |
| | | //require(AJV_DIR . '/files/fileManagement.php'); |
| | | |
| | | |
| | | add_action('plugins_loaded', 'aei_siteDefinition', 2); |
| | | add_action('jvbLoadDefinitions', 'aei_siteDefinition'); |
| | | function aei_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', |
| | | // 'faq', |
| | | 'referrals' |
| | | // 'has_map', |
| | | // 'referrals', |
| | | ]); |
| | | $site->setIntegrations([ |
| | | 'cloudflare', |
| | | 'facebook', |
| | | 'gmb', |
| | | 'maps', |
| | | 'helcim', |
| | | 'postmark', |
| | | 'instagram', |
| | | 'umami' |
| | | ]); |
| | | |
| | | $login = $site->login(); |
| | | $site->setDirectorySingular('List'); |
| | | $site->setDirectoryPlural('Lists'); |
| | | |
| | | |
| | | } |
| | | |
| | | //add_action('plugins_loaded', 'aei_membership_settings', 10); |
| | | //function aei_membership_settings():void |
| | | //{ |
| | | // if (!class_exists('JVBase\base\Site')) { |
| | | // return; |
| | | // } |
| | | // $site = Site::getInstance(); |
| | | // $membership = $site->membership(); |
| | | // $membership->setAll([ |
| | | // 'invitable', |
| | | // 'term_approval', |
| | | // 'member_verified' |
| | | // ]); |
| | | // |
| | | // $membership->setInvitable([ |
| | | // 'artist' => ['artist', 'enthusiast'], |
| | | // 'enthusiast' => ['enthusiast'] |
| | | // ]); |
| | | // |
| | | // $membership->setApprovers(['artist']); |
| | | // $membership->setCanSeeForum(['artist']); |
| | | //} |
| | | |
| | | /** |
| | | * Defines base options like: |
| | | * - directory & Membership |
| | |
| | | * - rewrite rules |
| | | * - archive title |
| | | */ |
| | | add_filter('jvb_site', 'altr_setup_site'); |
| | | //add_filter('jvb_site', 'altr_setup_site'); |
| | | function altr_setup_site():array |
| | | { |
| | | return [ |
| | | 'icons' => 'light', |
| | | 'is_directory' => true, //as in, a membership directory |
| | | 'directory_label' => ['List', 'Lists'], |
| | | 'has_membership' => false, |
| | | 'has_map' => true, |
| | | 'dashboard' => true, |
| | | 'faq' => true, |
| | | 'referrals' => true, |
| | | 'magicLink' => true, |
| | | 'support' => false, |
| | | 'feed_block' => true, |
| | | 'email_notifications' => false, |
| | | 'email_notifications' => true, |
| | | 'integrations' => [ |
| | | 'bluesky' => true, |
| | | 'cloudflare' => true, |
| | |
| | | add_filter('jvbAboveHeader', 'altr_legacy_header'); |
| | | function altr_legacy_header(string $header):string |
| | | { |
| | | return '<p><b>WED - SUN</b> <span class="hide-small"> </span>10<span class="hide-small">:00</span>AM - 6<span class="hide-small">:00</span>PM</p><p>By Appointment<span class="hide-small"> Only</span></p>'; |
| | | return '<p><b>WED - SUN</b> <span class="hide-small"> </span>11<span class="hide-small">:00</span>AM - 6<span class="hide-small">:00</span>PM</p><p>By Appointment<span class="hide-small"> Only</span></p>'; |
| | | } |
| | | |
| | | |
| | |
| | | </a> |
| | | </li> |
| | | <li> |
| | | <a href="https://bsky.app/profile/legacyrebrand.test" target="_blank" rel="nofollow" title="Find us on Bluesky"> |
| | | <a href="https://bsky.app/profile/legacytattooremoval.ca" target="_blank" rel="nofollow" title="Find us on Bluesky"> |
| | | '.jvbIcon('butterfly').' |
| | | <span class="screen-reader-text"> |
| | | Find us on Bluesky |
| | |
| | | return $nav; |
| | | } |
| | | |
| | | add_filter('jvbBeforeFooter', 'alyns_acknowledgement'); |
| | | function alyns_acknowledgement():string |
| | | add_filter('jvbBeforeFooter', 'altr_acknowledgement'); |
| | | function altr_acknowledgement():string |
| | | { |
| | | |
| | | return '<p>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>'; |
| | |
| | | |
| | | |
| | | |
| | | function altr_render_core_post_excerpt(array $block, string $content) |
| | | { |
| | | |
| | | global $post; |
| | | if (!has_excerpt($post)) { |
| | | return ''; |
| | | } |
| | | $excerpt = $post->post_excerpt; |
| | | |
| | | $before = is_singular() ? '<span class="tldr" title="Too Long, Didn\'t Read">TLDR:</span>' : ''; |
| | | $excerpt = $before.$excerpt; |
| | | return '<div class="excerpt">'.apply_filters('the_content', $excerpt).'</div>'; |
| | | } |
| | | |
| | | add_action( 'init', 'altr_add_excerpts_to_pages' ); |
| | | function altr_add_excerpts_to_pages() { |
| | | add_post_type_support( 'page', 'excerpt' ); |
| | | } |
| | | |
| | | add_filter('jvbRegisterCustomIcons', 'altr_custom_icons'); |
| | | function altr_custom_icons(array $icons):array |
| | | { |
| | | $icons['logo-triangle'] = AJV_DIR . '/assets/icons/triangle.svg'; |
| | | $icons['logo-triangle-fill'] = AJV_DIR . '/assets/icons/triangle-fill.svg'; |
| | | $icons['logo-text'] = AJV_DIR . '/assets/icons/text.svg'; |
| | | $icons['logo-text-only'] = AJV_DIR . '/assets/icons/text-only.svg'; |
| | | $icons['logo-complete'] = AJV_DIR . '/assets/icons/triangle text back.svg'; |
| | | return $icons; |
| | | } |
| | | |
| | | add_filter('jvbLoadingIcon', 'altr_loading_icon'); |
| | | function altr_loading_icon():string |
| | | { |
| | | return 'logo-triangle'; |
| | | } |
| | | |
| | | function altr_title_generator(?string $type = null):string |
| | | { |
| | | if (!$type) { |
| | | $obj = get_queried_object(); |
| | | |
| | | if (is_tax()) { |
| | | $type = $obj->taxonomy; |
| | | } elseif (is_post_type_archive()) { |
| | | $type = $obj->name; |
| | | } elseif (is_singular()) { |
| | | $type = $obj->post_type; |
| | | } else { |
| | | error_log('Could not determine type: '.print_r($obj, true)); |
| | | return ''; |
| | | } |
| | | } |
| | | |
| | | |
| | | $registrar = Registrar::getInstance($type); |
| | | if (!$registrar) { |
| | | error_log('Could not find registrar for '.$type); |
| | | return ''; |
| | | } |
| | | |
| | | switch($registrar->getSlug()) { |
| | | case 'progress': |
| | | return $registrar->getPlural(); |
| | | case 'skin_type': |
| | | $name = get_queried_object()->name; |
| | | $basic = match($name) { |
| | | 'i','ii','iii','iv type 1' => 'Lighter Skin', |
| | | 'iv type 2', 'v', 'vi' => 'Darker Skin' |
| | | }; |
| | | return '<small>How We Remove Tattoos On </small> '.$basic.' <small>(FitzPatrick Skin Type '.$name.')</small>'; |
| | | case 'age': |
| | | $name = strtolower(get_queried_object()->name); |
| | | if (str_contains($name, 'years')) { |
| | | $name = str_replace('years', 'year', $name); |
| | | } |
| | | if (str_contains($name, 'months')) { |
| | | $name = str_replace('months', 'month', $name); |
| | | } |
| | | if (str_contains($name, 'weeks')) { |
| | | $name = str_replace('weeks', 'week', $name); |
| | | } |
| | | return '<small>How We Remove </small>'.ucwords($name).' Old<small> Tattoos</small>'; |
| | | |
| | | case 'timeline': |
| | | $name = strtolower(get_queried_object()->name); |
| | | return '<small>Laser Tattoo Removal </small>'.ucwords($name).' Later'; |
| | | case 'goal': |
| | | $name = get_queried_object()->name; |
| | | $name = match($name) { |
| | | 'Complete Removal' => 'Completely Remove Tattoos', |
| | | 'Cover Up Tattoo' => 'Fade Tattoos for a Cover Up', |
| | | default => 'Clean Up Tattoo Blowout' |
| | | }; |
| | | return '<small>How we </small>'.$name; |
| | | case 'style': |
| | | case 'body_part': |
| | | case 'theme': |
| | | $name = get_queried_object()->name; |
| | | return '<small>How We Remove </small>'.ucwords($name).' Tattoos'; |
| | | default: |
| | | error_log('No title preset found for '.$registrar->getSlug()); |
| | | return ''; |
| | | } |
| | | } |
| | | |
| | | add_filter('get_the_archive_title', 'altr_archive_title', 10, 1); |
| | | function altr_archive_title(string $title):string |
| | | { |
| | | return altr_title_generator(); |
| | | } |
| | | |
| | | add_filter('the_seo_framework_title_from_generation', 'altr_title_filter', 10, 2); |
| | | function altr_title_filter(string $title, $args):string |
| | | { |
| | | $newTitle = ''; |
| | | |
| | | $tsf = tsf(); |
| | | |
| | | $type = null; |
| | | if (null === $args) { |
| | | // We're in the loop |
| | | if ($tsf->query()->is_tax()) { |
| | | $type = $tsf->query()->get_current_taxonomy(); |
| | | } |
| | | } else { |
| | | if (!empty($args['taxonomy']??'')) { |
| | | $type = $args['taxonomy']; |
| | | } |
| | | } |
| | | |
| | | if ($type) { |
| | | $newTitle = altr_title_generator(jvbNoBase($type)); |
| | | } |
| | | |
| | | return empty($newTitle) ? $title : wp_strip_all_tags($newTitle); |
| | | } |
| | | |
| | | |
| | | //add_filter('jvbSummaryHeader', 'altr_progress_summary_header', 10, 2); |
| | | // |
| | | //function altr_progress_summary_header(string $title, string $type):string |
| | | //{ |
| | | // $pre = $singular = ''; |
| | | // $registrar = Registrar::getInstance($type); |
| | | // |
| | | // switch ($type) { |
| | | // |
| | | // |
| | | // } |
| | | // $pre = 'Before & After Laser Tattoo Removal'; |
| | | // if (is_tax()) { |
| | | // return '<small>Before & After </small>'.get_queried_object()->name.'<small> Tattoo Removal</small>'; |
| | | // } elseif (is_post_type_archive()) { |
| | | // $singular = Registrar::getInstance($type)->getSingular(); |
| | | // } elseif (is_singular()) { |
| | | // global $post; |
| | | // $singular = $post->post_title; |
| | | // } |
| | | // return '<small>Before & After Laser Tattoo Removal</small>'.$singular; |
| | | //} |
| | | add_filter('jvbSummaryHeaderExtra', 'altr_progress_summary_header_extra', 10, 2); |
| | | |
| | | function altr_progress_summary_header_extra(string $title, string $type):string |
| | | { |
| | | switch ($type) { |
| | | case 'progress': |
| | | return '<p>See real results of tattoos before and after laser tattoo removal.</p><p>Filter results by number of treatments, age of original tattoo, location on body, fading goal, skin type, timeline between treatments, tattoo style, or tattoo subject matter.</p>'; |
| | | } |
| | | return $title; |
| | | } |
| | | |
| | | //add_filter('jvbSummaryDetails', 'altr_summary_details', 10, 2); |
| | | //function altr_summary_details(array $sections, string $type):array |
| | | //{ |
| | | // switch ($type) { |
| | | // case 'progress': |
| | | // $sections = [ |
| | | // 'summary' => '<p>We recommend spacing treatments out at least 12 weeks apart for best results.</p><p>See the difference at Legacy.</p>' |
| | | // ]; |
| | | // break; |
| | | // } |
| | | // return $sections; |
| | | //} |
| | | |
| | | add_filter('the_seo_framework_meta_render_data', 'altr_no_next_archive', 10, 1); |
| | | function altr_no_next_archive($tags) { |
| | | if (is_tax() || is_post_type_archive('altr_progress') || is_post_type_archive('altr_terms') || is_post_type_archive('altr_faq')) { |
| | | if (array_key_exists('next', $tags)) { |
| | | unset($tags['next']); |
| | | } |
| | | } |
| | | return $tags; // Keep the link for other pages |
| | | } |
| | | |
| | | add_filter('jvb_referral_booking_url', 'altr_consult_link'); |
| | | function altr_consult_link(string $link):string |
| | | { |
| | | return 'https://legacytattooremoval.janeapp.com/#/staff_member/2/treatment/15/'; |
| | | } |
| | | |
| | | add_filter('jvb_referral_estimate_url', 'altr_estimate_link'); |
| | | function altr_estimate_link(string $link):string |
| | | { |
| | | return 'https://legacytattooremoval.ca/get-an-estimate/'; |
| | | } |
| | | |
| | | add_filter('jvbLogoIcon', 'altr_logostring'); |
| | | function altr_logostring():string |
| | | { |
| | | return 'logo-triangle'; |
| | | } |
| | | |
| | | add_filter('jvbDefaultIcon', 'altr_default_icon'); |
| | | function altr_default_icon():string |
| | | { |
| | | return 'triangle'; |
| | | } |
| | | |
| | | add_action('init', 'altr_RegisterScripts', 5); |
| | | |
| | | function altr_RegisterScripts() { |
| | | wp_enqueue_script( |
| | | 'altr-base', |
| | | AJV_URL.'assets/js/legacy.js', |
| | | [], |
| | | '1.0', |
| | | [ |
| | | 'strategy' => 'defer', |
| | | 'in_footer' => true |
| | | ] |
| | | ); |
| | | } |