Jake Vanderwerf
2 hours ago ffd41931fa4517d66fe9764b91d445769bc43acf
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
<?php
/*
Plugin Name: Madi Mori Extension
Plugin URI: https://madimori.ca/
Description: An Extension of JakeVan Base, for Tatty Soap.
Author: Jake Vanderwerf
Version: 1.0.0
Author URI: https://jakevan.ca/
Textdomain: atat
*/
 
if (!defined('ABSPATH')) {
    exit;
}
 
use JVBase\base\Site;
use JVBase\managers\CacheManager;
 
add_filter('jvb_base', function () {
    return 'atat_';
});
 
 
const ATAT_DIR = WP_PLUGIN_DIR . '/atatty';
define('ATAT_URL', plugin_dir_url(__FILE__));
 
 
add_filter('jvbChildDir', function() { return ATAT_DIR; });
add_filter('jvbChildUrl', function() { return ATAT_URL; });
 
require(ATAT_DIR . '/content/_setup.php');
require(ATAT_DIR . '/dashboard/_setup.php');
require(ATAT_DIR . '/email/_setup.php');
require(ATAT_DIR . '/forms/_setup.php');
require(ATAT_DIR . '/login/_setup.php');
require(ATAT_DIR . '/taxonomies/_setup.php');
require(ATAT_DIR . '/users/_setup.php');
require(ATAT_DIR . '/blocks/_setup.php');
require(ATAT_DIR . '/seo.php');
//require(ATAT_DIR . '/files/fileManagement.php');
 
add_action('plugins_loaded', 'atat_siteDefinition', 2);
add_action('jvbLoadDefinitions', 'atat_siteDefinition');
function atat_siteDefinition():void
{
    if (!class_exists('JVBase\base\Site')) {
        return;
    }
    $site = Site::getInstance();
    $site->set('icons', 'light');
    $site->setAll([
//        'has_map',
//        'referrals',
    ]);
    $site->setIntegrations([
        'cloudflare',
        'facebook',
        'gmb',
        'helcim',
        'postmark',
        'instagram',
        'umami'
    ]);
}
/**
 * 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', 'atat_setup_site');
function atat_setup_site():array
{
    return [
        'icons'               => 'light',
        'is_directory'        => false,        //as in, a membership directory
        'has_membership'      => false,
        'has_map'             => true,
        'dashboard'           => true,
        'referrals'           => true,
        'magicLink'           => true,
        'support'         => false,
        'feed_block'      => false,
        'email_notifications' => false,
        'integrations'  => [
            'bluesky'     => false,
            'cloudflare'  => true,
            'facebook'    => true,
            'maps'        => true,
            'gmb'         => true,
            'helcim'      => true,
            'postmark'    => 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', 'atat_setup_membership');
//function atat_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', 'atat_loading_quips');
//function atat_loading_quips(array $quips):array
//{
//    return [];
//}
 
 
add_filter('jvbBelowHeader', 'atat_header');
function atat_header(string $header):string
{
    return '<p>FREE LOCAL PICKUP at <a href="https://legacytattooremoval.ca/?ref=madimori">Legacy Tattoo Removal</a>.</p>';
}
 
 
 
add_filter('jvbMenuExtra', 'atat_contact_nav', 10, 3);
function atat_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 = sprintf(
            '<li class="call"><a href="%s" title="Call Us">'.jvbIcon('phone').'<span class="screen-reader-text">Call Us</span></a></li>',
            jvbPhoneLink(7802899915),
        );
        $text = sprintf(
            '<li><a href="%s" title="Text Us">%s<span class="hide-small">780.289.9915</span></a></li>',
            jvbTextLink(7802899915),
            jvbIcon('chat')
        );
        $email = sprintf(
            '<li><a href="%s" title="Email Us">%s<span class="hide-small">info@madimori.ca</span></a></li>',
            jvbMailToLink(
                'info@madimori.ca',
                'Contact from Our Website'
            ),
            jvbIcon('envelope')
        );
 
        return $call.$text.$email;
    }
    if (array_key_exists('attrs', $block)
        && array_key_exists('className', $block['attrs'])
        && $block['attrs']['className'] === 'is-style-floating'
    ) {
        return sprintf(
            '%s<li><ul class="socials">
            <li>
                <a href="https://www.facebook.com/madebymadimori/" target="_blank" rel="nofollow" title="Find us on Facebook">
                    %s
                    <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">
                    %s
                    <span class="screen-reader-text">
                        Find us on Instagram
                    </span>
                </a>
            </li>
        </ul></li>',
            $nav,
            jvbIcon('facebook-logo'),
            jvbIcon('instagram-logo')
        );
    }
 
    return $nav;
}
 
add_filter('jvbBeforeFooter', 'alyns_acknowledgement');
function alyns_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>';
}
 
 
add_action('jvbBlockStyles', 'atat_blockStyles');
function atat_blockStyles()
{
    register_block_style(
        'core/list',
        [
            'name'=>'blocky',
            'label' => __('Blocky', 'atat')
        ]
    );
    register_block_style(
        'core/group',
        [
            'name'=>'triangle',
            'label' => __('Triangle', 'atat')
        ]
    );
}
 
 
add_filter('jvbRandomFooterText', 'atat_footer_text');
function atat_footer_text(string $text):string
{
    $privacy = get_privacy_policy_url();
    $privacy = ($privacy === '') ? '' : ' | <a href="'.$privacy.'">Privacy Policy</a>';
    return '<p class="font-small">©'.date('Y').' <a href="https://madimori.ca/">Madi Mori</a>'.$privacy.'</p><p class="font-small">Built with ♡ by <a href="https://jakevan.ca/?ref=madimori">Jake Van</a></p>';
}
 
add_filter('jvbRegisterCustomIcons', 'atat_custom_icons');
function atat_custom_icons(array $icons):array
{
    $icons['background'] = ATAT_DIR . '/assets/icons/background.svg';
//    $icons['logo-jakevan'] = ATAT_DIR . '/assets/icons/logo-concentric-jakevan.svg';
//    $icons['logo-right'] = ATAT_DIR . '/assets/icons/logo-right-aligned.svg';
//    $icons['logo-right-jakevan'] = ATAT_DIR . '/assets/icons/logo-right-aligned-jakevan.svg';
//    $icons['jakevan'] = ATAT_DIR . '/assets/icons/jakevan.svg';
//    $icons['loading'] = ATAT_DIR . '/assets/icons/loading.svg';
    return $icons;
}