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
<?php
 
function ami_prerender_core_site_logo(array $block, ?string $content):?string
{
    $open = $close = '';
 
    if (!is_home() && !is_front_page()) {
        $open = '<a href="'.get_home_url().'" rel="home">';
        $close = '</a>';
    }
    $cache = (class_exists('JVBase\managers\Cache')) ? JVBase\managers\Cache::for('full-icons') : false;
 
    if (array_key_exists('attrs', $block) && array_key_exists('className', $block['attrs'])) {
        $logo = false;
        if (str_contains($block['attrs']['className'], 'is-text')) {
            if ($cache) {
                $martian = $cache->remember('martian', function() {
                    return file_get_contents(AMI_DIR . '/assets/icons/martian infotech logo.svg');
                });
                $text = $cache->remember('text', function() {
                    return file_get_contents(AMI_DIR . '/assets/icons/martian infotech.svg');
                });
            }else {
                $martian = file_get_contents(AMI_DIR . '/assets/icons/martian infotech logo.svg');
                $text = file_get_contents(AMI_DIR . '/assets/icons/martian infotech.svg');
            }
 
            $logo = '<div class="logo">'.$martian.$text.'</div>';
        }else if (array_key_exists('attrs', $block) && str_contains($block['attrs']['className'], 'is-full')) {
            if ($cache) {
                $logo = $cache->remember('logo', function() {
                    return file_get_contents(AMI_DIR . '/assets/icons/full-logo.svg');
                });
            }else {
                $logo = file_get_contents(AMI_DIR . '/assets/icons/full-logo.svg');
            }
 
        }
        if ($logo) {
            return $open.$logo.$close;
        }
    }
 
    return JVB()->blocks()->prerender_core_site_logo($block, $content);
}