aboutsummaryrefslogtreecommitdiff
path: root/bootstrap/Functions.php
blob: 6e28cbc2ec1f4709e00d963d8d2e21e7e252d65c (plain)
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
<?php

/**
 * Helper Functions
 */

function featherIcon(string $name)
{
    echo file_get_contents(
        $_SERVER['DOCUMENT_ROOT']
        . '/..' . '/public/css/fonts/feather-icons/' . $name . '.svg'
    );
}

function base64(string $path)
{
    echo base64_encode(
        file_get_contents($_SERVER['DOCUMENT_ROOT'] . '/..' . $path)
    );
}


function fetch(string $path, string $field)
{
    $config = include $_SERVER['DOCUMENT_ROOT'] . '/..' . '/AppConfig.php';
    $json = file_get_contents(
        $_SERVER['REQUEST_SCHEME'] . '://' . $_SERVER['SERVER_NAME']
        .  $path . '?token=' . $config['cms']['token']
    );
    $data = json_decode($json, true);
    echo $data[$field];
}