aboutsummaryrefslogtreecommitdiff
path: root/bootstrap/Functions.php
diff options
context:
space:
mode:
Diffstat (limited to 'bootstrap/Functions.php')
-rw-r--r--bootstrap/Functions.php34
1 files changed, 23 insertions, 11 deletions
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];
}