From 00e758ec48e4aeea7fbd109477304cb709ad1688 Mon Sep 17 00:00:00 2001 From: Thedro Neely Date: Sun, 22 Dec 2019 03:45:39 -0500 Subject: app/views/index: Move introduction to singleton --- bootstrap/Functions.php | 34 +++++++++++++++++++++++----------- 1 file changed, 23 insertions(+), 11 deletions(-) (limited to 'bootstrap') diff --git a/bootstrap/Functions.php b/bootstrap/Functions.php index 252b522..a515402 100644 --- a/bootstrap/Functions.php +++ b/bootstrap/Functions.php @@ -4,17 +4,29 @@ * Helper Functions */ -function featherIcon($name) { - echo file_get_contents( - $_SERVER['DOCUMENT_ROOT'] - . '/..' . '/public/css/fonts/feather-icons/' . $name . '.svg' - ); +function featherIcon(string $name) +{ + echo file_get_contents( + $_SERVER['DOCUMENT_ROOT'] + . '/..' . '/public/css/fonts/feather-icons/' . $name . '.svg' + ); } -function base64($path) { - echo base64_encode( - file_get_contents($_SERVER['DOCUMENT_ROOT'] - . '/..' . $path - ) - ); +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( + 'http://' . $_SERVER['SERVER_NAME'] + . $path . '?token=' . $config['cms']['token'] + ); + $data = json_decode($json, true); + echo $data[$field]; } -- cgit v1.2.3