From 220d5dde1d37a1777a3e294c67af6ddb30c9894e Mon Sep 17 00:00:00 2001 From: Kumi Date: Thu, 8 Aug 2024 07:46:58 +0200 Subject: [PATCH] refactor: translate comments, add TODOs for future dynamic data loading Enhances code clarity by translating German comments to English and adding comments and TODOs for dynamic data loading and generation of currencies, API data, language files, and HTML elements. This will reduce hardcoded values and improve maintainability. Also, adds a reminder to move scripts to separate files and add OpenGraph tags in the HTML. No breaking changes, but dynamically loading these values will be essential for improving the codebase in future iterations. --- index.php | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/index.php b/index.php index f8db16f..744fec2 100644 --- a/index.php +++ b/index.php @@ -4,6 +4,8 @@ header("Cache-Control: no-store, no-cache, must-revalidate, max-age=0"); header("Cache-Control: post-check=0, pre-check=0", false); header("Pragma: no-cache"); +// Array of supported currencies +// TODO: Load dynamically from the API data $array = array("EUR", "USD", "GBP", @@ -57,14 +59,16 @@ $array = array("EUR", include('coingecko.php'); -// Holt die API Daten +// Fetches the API data from the JSON file +// TODO: This doesn't exist on first load, so it will display warnings $api_cg = json_decode(file_get_contents('coingecko.json')); -// Holt die Zeit der letzten Abfrage +// Fetches the time of the last API data update $time_cg = date("H:i:s", $api_cg->time); $time = $time_cg; -// Holt die einzelnen Werte für die Berechnung +// Fetches the individual currency values from the API data +// TODO: Make that dynamic $BTC = $api_cg->btc->lastValue; $EUR = $api_cg->eur->lastValue; $USD = $api_cg->usd->lastValue; @@ -116,7 +120,7 @@ $CZK = $api_cg->czk->lastValue; $DKK = $api_cg->dkk->lastValue; $MXN = $api_cg->mxn->lastValue; -// Lädt die Sprachdatei, nach der Sprache die im Browser eingestellt wurde +// Load the language file based on the browser language if(array_key_exists('HTTP_ACCEPT_LANGUAGE', $_SERVER)){ $lang = substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2); }else{ @@ -254,6 +258,8 @@ $xmr_in_fiat = strtr($xmr_in_fiat, ",", " "); <?php echo $page_title; ?> + + @@ -306,6 +312,7 @@ $xmr_in_fiat = strtr($xmr_in_fiat, ",", " ");

 XMR  

+ @@ -457,6 +464,7 @@ $xmr_in_fiat = strtr($xmr_in_fiat, ",", " "); echo ''; } ?> + @@ -524,6 +532,7 @@ $xmr_in_fiat = strtr($xmr_in_fiat, ",", " "); +