From 958a68292191d8a4c9024ca2f1f658135ab6f704 Mon Sep 17 00:00:00 2001 From: Minteck Date: Thu, 21 Apr 2022 14:37:44 +0200 Subject: WIP projects page --- includes/functions.php | 49 ++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 46 insertions(+), 3 deletions(-) (limited to 'includes/functions.php') diff --git a/includes/functions.php b/includes/functions.php index defa152..38dda54 100644 --- a/includes/functions.php +++ b/includes/functions.php @@ -1,6 +1,6 @@ = 0) { + return $tense = 'just now'; + } elseif ($difference > 0) { + $tense = 'ago'; + } else { + $tense = 'later'; + } + + for ($j = 0; $difference >= $lengths[$j] && $j < count($lengths)-1; $j++) { + $difference /= $lengths[$j]; + } + + $difference = round($difference); + + $period = $periods[$j] . ($difference >1 ? 's' :''); + return "{$difference} {$period} {$tense} "; +} + +require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/Parsedown.php"; +global $Parsedown; +$Parsedown = new Parsedown(); \ No newline at end of file -- cgit