diff options
author | Thedro Neely <thedroneely@gmail.com> | 2020-01-05 01:58:52 -0500 |
---|---|---|
committer | Thedro Neely <thedroneely@gmail.com> | 2020-01-05 01:58:52 -0500 |
commit | 37c674cedb90a9e93ca4b84506f9fa0aa492aebc (patch) | |
tree | fd7e33a9372ab2bfbdac37f8e0c4f6254909f9ed /bootstrap/Helpers.php | |
parent | d67d4c0351747554afcf42fa5df002b093d2c6d5 (diff) | |
download | thedroneely.com-37c674cedb90a9e93ca4b84506f9fa0aa492aebc.tar.gz thedroneely.com-37c674cedb90a9e93ca4b84506f9fa0aa492aebc.tar.bz2 thedroneely.com-37c674cedb90a9e93ca4b84506f9fa0aa492aebc.zip |
bootstrap/Bootstrap: Add new helpers
Diffstat (limited to 'bootstrap/Helpers.php')
-rw-r--r-- | bootstrap/Helpers.php | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/bootstrap/Helpers.php b/bootstrap/Helpers.php new file mode 100644 index 0000000..e92f3ac --- /dev/null +++ b/bootstrap/Helpers.php @@ -0,0 +1,39 @@ +<?php + +/** + * Helper Functions + */ + +function featherIcon(string $name, string $class = null) +{ + return str_replace( + '<svg', '<svg class="' . $class . '" ', + 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 views(string $folder, string $name) +{ + return $_SERVER['DOCUMENT_ROOT'] . '/..' . '/app/views/' . $folder . '/' . $name .'.php'; +} + +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]; +} |