<?php
|
/*
|
Plugin Name: Martian Infotech Extension
|
Plugin URI: https://martianit.ca/
|
Description: An Extension of JakeVan Base, for Martian Infotech.
|
Author: Jake Vanderwerf
|
Version: 1.0.0
|
Author URI: https://jakevan.ca/
|
Textdomain: ami
|
*/
|
|
//PLUGIN STRUCTURE
|
// /content/
|
// art.php
|
// design.php
|
// development.php
|
// setup.php
|
// strategy.php
|
// writing.php
|
// /dashboard/
|
// setup.php
|
// /files/
|
// fileManagement.php
|
// /forms/
|
// setup.php
|
// /login/
|
// setup.php
|
// /taxonomies/
|
// city.php
|
// form.php
|
// media.php
|
// progress.php
|
// setup.php
|
// style.php
|
// target.php
|
// theme.php
|
// /users/
|
// client.php
|
// setup.php
|
// ajakevan.php <-- main plugin file
|
|
use JVBase\base\Site;
|
|
if (!defined('ABSPATH')) {
|
exit;
|
}
|
|
//use JVBase\managers\CacheManager;
|
|
add_filter('jvb_base', function () {
|
return 'ami_';
|
});
|
|
|
const AMI_DIR = WP_PLUGIN_DIR . '/amartianit';
|
define('AMI_URL', plugin_dir_url(__FILE__));
|
|
add_filter('jvbChildDir', function() { return AMI_DIR; });
|
add_filter('jvbChildUrl', function() { return AMI_URL; });
|
require(AMI_DIR . '/content/_setup.php');
|
//require(AMI_DIR . '/dashboard/_setup.php');
|
require(AMI_DIR . '/forms/_setup.php');
|
require(AMI_DIR . '/login/_setup.php');
|
require(AMI_DIR . '/taxonomies/_setup.php');
|
//require(AMI_DIR . '/users/setup.php');
|
require(AMI_DIR . '/blocks/_setup.php');
|
require(AMI_DIR . '/seo.php');
|
//require(AMI_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([
|
'dashboard',
|
'is_directory',
|
'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');
|
}
|
/**
|
* Defines base options like:
|
* - directory & Membership
|
* - dashboard
|
* - membership settings (JVB_MEMBERSHIP)
|
* - post types (JVB_CONTENT)
|
* - taxonomies (JVB_TAXONOMY)
|
* - User Roles (JVB_USER)
|
* - enthusiast = (bool) short form for a subscriber-like user that can collect content for reference
|
* - forum = (bool) create a forum
|
* - member_only = (bool) if forum and this is true, creates a member-only forum in the custom dashboard
|
*
|
* as well as central filters for
|
* - rewrite rules
|
* - archive title
|
*/
|
//add_filter('jvb_site', 'ami_setup_site');
|
function ami_setup_site():array
|
{
|
return [
|
'icons' => 'light',
|
'is_directory' => false, //as in, a membership directory
|
'has_membership' => false,
|
'has_map' => false,
|
'dashboard' => true,
|
'support' => true,
|
'feed_block' => true,
|
'email_notifications' => true,
|
'integrations' => [
|
'bluesky' => true,
|
'cloudflare' => true,
|
'facebook' => true,
|
'maps' => true,
|
'gmb' => true,
|
'helcim' => true,
|
'instagram' => true,
|
'square' => false,
|
'umami' => true,
|
],
|
'is_restaurant' => false,
|
'limit_hours' => false,
|
'enthusiast' => false,
|
'favourites' => false, //optional flag to allow enthusiasts, but not favourites
|
];
|
}
|
/**
|
* JVB_MEMBERSHIP defines the structure of the directory
|
* Options include:
|
* - membership_expires = useful if members pay a yearly membership fee
|
* - hide_expired = removes users once membership expired; only used if membership_expires is true
|
* - clip_expired = keeps users once membership expires, but limits the information shown; only used if membership_expires is true
|
* - membership_approval = verified users can approve other users
|
* - term_approval = (bool) verified users can create new terms, but needs approval
|
* - member_only = (array) if empty, open to any registered user. otherwise an array of registered user roles
|
*/
|
//add_filter('jvb_membership', 'ami_setup_membership');
|
//function ami_setup_membership():array
|
//{
|
// return [
|
// 'member_content' => true,
|
// 'can_invite' => ['artist' => ['artist']],
|
// 'member_verified' => true,
|
// 'notifications' => true,
|
// 'forum' => true,
|
// 'member_only' => [ 'artist' ],
|
// 'member_expires' => false,
|
// 'hide_expired' => false,
|
// 'clip_expired' => false,
|
// 'term_approval' => true,
|
// 'can_approve' => [ 'artist' ]
|
// ];
|
//}
|
//
|
//add_filter('jvbLoadingQuips', 'ami_loading_quips');
|
//function ami_loading_quips(array $quips):array
|
//{
|
// return [];
|
//}
|
|
//add_filter('jvbBeforeFooter', 'ami_acknowledgement');
|
function ami_acknowledgement():string
|
{
|
|
return '<p>I live and work in Tk’emlúps te Secwe̓pemc territory.</p><p>The <a href="https://stkemlups.ca/" title="Learn More">unceded ancestral lands of Stk’emlúpsemc te Secwépemc Nation.</a></p><p>Kamloops, British Columbia, Canada</p>';
|
}
|
add_filter('jvbSeparatorLogo', 'ami_logo_separator');
|
function ami_logo_separator(string $logo):string
|
{
|
return 'logo-alien-shadow';
|
}
|
|
add_filter('jvbRegisterCustomIcons', 'ami_custom_icons');
|
function ami_custom_icons(array $icons):array
|
{
|
$icons['logo'] = AMI_DIR . '/assets/icons/full-logo.svg';
|
$icons['logo-text'] = AMI_DIR . '/assets/icons/martian infotech.svg';
|
$icons['logo-alien'] = AMI_DIR . '/assets/icons/martian infotech logo.svg';
|
$icons['logo-alien-shadow'] = AMI_DIR . '/assets/icons/martian logo shadow.svg';
|
return $icons;
|
}
|
|
add_filter('jvbLoadingIcon', 'ami_loading_icon', 999999);
|
function ami_loading_icon():string
|
{
|
return 'logo-alien';
|
}
|
|
|
add_filter('jvbMenuExtra', 'ami_contact_nav', 10, 3);
|
function ami_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 === '') {
|
$text = '<li><a href="tel:+17808008354" title="Call Me">'.jvbIcon('phone').'<span class="hide-small">780-800-8354</span></a></li>';
|
$email = '<li><a href="'.jvbMailToLink(
|
'myron@martianit.ca',
|
'[Martian Infotech] Website Inquiry','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">myron@martianit.ca</span></a></li>';
|
|
return $text.$email;
|
}
|
|
if (array_key_exists('attrs', $block)
|
&& array_key_exists('className', $block['attrs'])
|
&& $block['attrs']['className'] === 'is-style-floating'
|
) {
|
return $nav.'<li>'.ami_socials_nav().'</li>';
|
}
|
|
return $nav;
|
}
|
|
function ami_socials_nav():string
|
{
|
return '<ul class="socials row right">
|
<li>
|
<a href="https://www.facebook.com/MartianIT/" 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://x.com/martianinfotech" target="_blank" rel="nofollow" title="Find us on X, previously known as Twitter">
|
'.jvbIcon('x-logo').'
|
<span class="screen-reader-text">
|
Find us on X
|
</span>
|
</a>
|
</li>
|
<li>
|
<a href="https://www.instagram.com/martianinfotech/" target="_blank" rel="nofollow" title="Find me on Instagram">
|
'.jvbIcon('instagram-logo').'
|
<span class="screen-reader-text">
|
Find me on Instagram
|
</span>
|
</a>
|
</li>
|
<li>
|
<a href="https://ca.linkedin.com/in/mlewitski" target="_blank" rel="nofollow" title="Find us on LinkedIn">
|
'.jvbIcon('linkedin-logo').'
|
<span class="screen-reader-text">
|
Find me on LinkedIn
|
</span>
|
</a>
|
</li>
|
</ul>';
|
}
|
|
|
add_filter('jvbAboveHeader', 'ami_above_header');
|
function ami_above_header(string $header):string
|
{
|
return ami_socials_nav();
|
}
|
add_filter('jvbBelowHeader', 'ami_below_header');
|
function ami_below_header(string $header):string
|
{
|
return '<p>'.get_bloginfo('description').'</p>';
|
}
|
|
|
|
add_filter('the_seo_framework_meta_render_data', 'ami_no_next_archive', 10, 1);
|
function ami_no_next_archive($tags) {
|
if (is_tax() || is_post_type_archive()) {
|
if (array_key_exists('next', $tags)) {
|
unset($tags['next']);
|
}
|
}
|
return $tags; // Keep the link for other pages
|
}
|