<?php
|
/*
|
Plugin Name: Edmonton Ink Extension
|
Plugin URI: https://edmonton.ink/
|
Description: An Extension of JakeVan Base, for Edmonton ink.
|
Author: Jake Vanderwerf
|
Version: 1.0.0
|
Author URI: https://jakevan.ca/
|
Textdomain: aei
|
*/
|
|
if (!defined('ABSPATH')) {
|
exit;
|
}
|
|
use JVBase\base\Site;
|
use JVBase\managers\CacheManager;
|
|
add_filter('jvb_base', function () {
|
return 'aei_';
|
});
|
|
|
const AEI_DIR = WP_PLUGIN_DIR . '/edmontonink';
|
define('AEI_URL', plugin_dir_url(__FILE__));
|
|
|
add_filter('jvbChildDir', function() { return AEI_DIR; });
|
add_filter('jvbChildUrl', function() { return AEI_URL; });
|
|
require(AEI_DIR . '/content/_setup.php');
|
require(AEI_DIR . '/dashboard/_setup.php');
|
require(AEI_DIR . '/email/_setup.php');
|
require(AEI_DIR . '/forms/_setup.php');
|
require(AEI_DIR . '/login/_setup.php');
|
require(AEI_DIR . '/taxonomies/_setup.php');
|
require(AEI_DIR . '/users/_setup.php');
|
require(AEI_DIR . '/blocks/_setup.php');
|
require(AEI_DIR . '/seo.php');
|
//require(AEI_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', 'regular');
|
$site->setAll([
|
'is_directory',
|
'membership',
|
'dashboard',
|
'magic_link',
|
'feed_block',
|
'favourites',
|
'help_menu'
|
// 'has_map',
|
// 'referrals',
|
]);
|
$site->setIntegrations([
|
'cloudflare',
|
'facebook',
|
'gmb',
|
'maps',
|
'helcim',
|
'postmark',
|
'instagram',
|
'umami'
|
]);
|
|
$login = $site->login();
|
|
}
|
|
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']);
|
}
|
|
|
//add_filter('jvbBelowHeader', 'aei_header');
|
//function aei_header(string $header):string
|
//{
|
// return '<p>FREE LOCAL PICKUP at <a href="https://legacytattooremoval.ca/">Legacy Tattoo Removal</a>.</p>';
|
//}
|
|
|
|
add_filter('jvbMenuExtra', 'aei_contact_nav', 10, 3);
|
function aei_contact_nav(string $nav, string $menuName, array $block):string
|
{
|
if (array_key_exists('attrs', $block)
|
&& array_key_exists('className', $block['attrs'])
|
&& $block['attrs']['className'] === 'is-style-fixed'
|
&& $nav === '') {
|
$call = '<li class="call"><a href="'.jvbPhoneLink(8259257398).'" title="Call Us">'.jvbIcon('phone').'<span class="screen-reader-text">Call Us</span></a></li>';
|
$text = '<li><a href="'.jvbTextLink(8259257398).'" title="Text Us">'.jvbIcon('chat').'<span class="hide-small">825.925.7398</span><sup class="hide-small">PEWU</sup></a></li>';
|
$email = '<li><a href="'.jvbMailToLink(
|
'info@legacytattooremoval.ca',
|
'Contact from Our Website'
|
).'" title="Email Us">'.jvbIcon('envelope').'<span class="hide-small">info@legacytattooremoval.ca</span></a></li>';
|
|
return $call.$text.$email;
|
}
|
if (array_key_exists('attrs', $block)
|
&& array_key_exists('className', $block['attrs'])
|
&& $block['attrs']['className'] === 'is-style-floating'
|
) {
|
return $nav.'<li><ul class="socials">
|
<li>
|
<a href="https://www.facebook.com/madebymadimori/" target="_blank" rel="nofollow" title="Find us on Facebook">
|
'.jvbIcon('facebook-logo').'
|
<span class="screen-reader-text">
|
Find us on Facebook
|
</span>
|
</a>
|
</li>
|
<li>
|
<a href="https://www.instagram.com/madebymadimori" target="_blank" rel="nofollow" title="Find us on Instagram">
|
'.jvbIcon('instagram-logo').'
|
<span class="screen-reader-text">
|
Find us on Instagram
|
</span>
|
</a>
|
</li>
|
</ul></li>';
|
}
|
|
return $nav;
|
}
|
|
add_filter('jvbBeforeFooter', 'alyns_acknowledgement');
|
function alyns_acknowledgement():string
|
{
|
|
return '<p class="text-center">Respectfully, this land was <a href="https://edmonton.ink/amiskwaciwaskahikan/" data-type="page" data-id="4659">Amiskwaciwâskahikan</a> before it was ever Edmonton.</p>';
|
}
|
|
|
add_action('jvbBlockStyles', 'aei_blockStyles');
|
function aei_blockStyles()
|
{
|
register_block_style(
|
'core/list',
|
[
|
'name'=>'blocky',
|
'label' => __('Blocky', 'aei')
|
]
|
);
|
register_block_style(
|
'core/group',
|
[
|
'name'=>'triangle',
|
'label' => __('Triangle', 'aei')
|
]
|
);
|
}
|
|
|
add_filter('jvbRandomFooterText', 'aei_footer_text');
|
function aei_footer_text(string $text):string
|
{
|
$aOpen = '<a href="https://legacytattooremoval.ca" title="Learn more about Legacy Tattoo Removal">';
|
$options = array(
|
[
|
'text' => 'Built with ♡ by '.$aOpen.'your friendly neighbourhood laser nerds</a>.',
|
'weight' => 25
|
],
|
[
|
'text' => 'Built with ♡ by your friends at '.$aOpen.'Legacy Tattoo Removal</a>.',
|
'weight' => 15
|
],
|
[
|
'text' => 'Your friendly '.$aOpen.'Edmonton tattoo removal</a> crew.',
|
'weight' => 15
|
],
|
[
|
'text' => $aOpen.'tattoo removal with ♡</a>',
|
'weight' => 15
|
],
|
[
|
'text' => 'From '.$aOpen.'cover ups to fresh starts</a> - we\'re the laser nerds with ♡.',
|
'weight' => 10
|
],
|
[
|
'text' => $aOpen.'See the difference at Legacy Tattoo Removal</a>',
|
'weight' => 10
|
],
|
[
|
'text' => 'Make space for your next tattoo at '.$aOpen.'Legacy Tattoo Removal</a>.',
|
'weight' => 10
|
],
|
[
|
'text' => $aOpen.'We\'re your artist\'s secret weapon</a>.',
|
'weight' => 15
|
]
|
);
|
$totalWeight = 0;
|
foreach ($options as $option) {
|
$totalWeight += (int)$option['weight'];
|
}
|
|
$randomNumber = mt_rand(1, $totalWeight);
|
$weightSum = 0;
|
|
foreach ($options as $option) {
|
$weightSum += (int)$option['weight'];
|
if ($randomNumber <= $weightSum) {
|
return '<p>'.$option['text'].'</p>';
|
}
|
}
|
|
return '<p>'.$options[0]['text'].'</p>';
|
}
|
|
add_filter('jvbRegisterCustomIcons', 'aei_custom_icons');
|
function aei_custom_icons(array $icons):array
|
{
|
$icons['logo'] = AEI_DIR . '/assets/icons/edmonton-ink-logo.svg';
|
$icons['logo-text'] = AEI_DIR . '/assets/icons/edmonton-ink-circle.svg';
|
return $icons;
|
}
|
add_filter('jvbMapIcons', 'aei_icons_map');
|
function aei_icons_map(array $icons):array
|
{
|
return array_merge($icons, [
|
'tattoo' => 'drop-simple',
|
'event' => 'calendar',
|
'piercing' => 'needle',
|
'artwork' => 'palette',
|
'artform' => 'shapes',
|
'city' => 'map-pin',
|
'piercing-type' => 'nut',
|
'theme' => 'folder-open',
|
'style' => 'hash',
|
'colour' => 'drop',
|
'placement' => 'person-arms-spread',
|
'media' => 'squares-four',
|
'artist' => 'user',
|
'artists' => 'users-three',
|
'partner' => 'currency-circle-dollar',
|
'shop' => 'storefront',
|
'past' => 'clock-counter-clockwise',
|
'future' => 'clock-clockwise',
|
'offer' => 'hand-heart',
|
]);
|
}
|