From 1f9024763d9224c4cd9a181bac27e6b9f12ad672 Mon Sep 17 00:00:00 2001 From: Freya Murphy Date: Wed, 18 Sep 2024 14:14:53 -0400 Subject: refactor --- src/web/core/core.php | 85 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) create mode 100644 src/web/core/core.php (limited to 'src/web/core/core.php') diff --git a/src/web/core/core.php b/src/web/core/core.php new file mode 100644 index 0000000..d71870e --- /dev/null +++ b/src/web/core/core.php @@ -0,0 +1,85 @@ +'; + } + + /** + * Loads a css html link + * @param string $path - the path to the css file + */ + public static function embed_css(string $path): string + { + $file = PUBLIC_ROOT . '/' . $path; + if (file_exists($file)) { + $text = file_get_contents($file); + return ""; + } else { + return ""; + } + } + + /** + * Formats a ISO date + * @param $iso_date the ISO date + */ + public static function format_date(string $iso_date): string + { + return date("Y-m-d D H:m", strtotime($iso_date)); + } +} -- cgit v1.2.3-freya