Jake Vanderwerf
2 hours ago cf7c6dae604a0bbd471afa156f82555a5a2e9ab7
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
<?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
}