diff --git a/.gitignore b/.gitignore index f647804..1199e60 100644 --- a/.gitignore +++ b/.gitignore @@ -37,6 +37,7 @@ tools/items/mc-art-viewer/nbt.js *.url *.sqlite *.conf +*.pyc # Temporary articles/*.txt diff --git a/commons/composer.php b/commons/composer.php index 3a7096f..ec0760e 100644 --- a/commons/composer.php +++ b/commons/composer.php @@ -912,10 +912,10 @@ class ComposerElement { case ComposerElementTypes::GALLERY: if(!is_null($this->srTitle)) { - $htmlCode .= '
'; + $htmlCode .= '
'; $htmlCode .= ''; } else { - $htmlCode .= '
'; + $htmlCode .= '
'; } $htmlCode .= '
'; diff --git a/commons/langs.php b/commons/langs.php index a57be04..2cac543 100644 --- a/commons/langs.php +++ b/commons/langs.php @@ -15,6 +15,46 @@ $default_language = "en"; $user_language = "en"; $user_uri_language = ""; +$lang_compilation_date = "1970-01-01T00:00:00Z"; +//$lang_compilation_date = (new DateTime('2010-12-30 23:21:46'))->format(DateTimeInterface::ATOM); + +// Preparing a function for later +function process_lang_header(string $accepted_lang_header, bool $filter_unsupported = true, bool $simplify_entries = true): array { + $accepted_languages = []; + + foreach(explode(",", $accepted_lang_header) as $_client_lang_entry) { + $lang_entry_parts = explode(";", $_client_lang_entry); + + // Ignoring entries without a "q=" part + if(count($lang_entry_parts) != 2) { + continue; + } + + // Simplifying complex entries from "en-US" to "en". + // We'll ignore duplicates since it won't matter after sorting. + if($simplify_entries && strlen($lang_entry_parts[0]) > 2) { + $lang_entry_parts[0] = substr($lang_entry_parts[0], 0, 2); + } + + // Only allowing supported languages + if(!in_array($lang_entry_parts[0], ["en", "fr"]) && $filter_unsupported) { + continue; + } + + // Parsing the language's weight + $lang_entry_parts[1] = str_replace("q=", "", $lang_entry_parts[1]); + $lang_entry_weights = filter_var($lang_entry_parts[1], FILTER_VALIDATE_FLOAT); + if($lang_entry_weights === false || !is_float($lang_entry_weights)) { + continue; + } + + // Saving it for later + $accepted_languages[] = $lang_entry_parts; + } + + return $accepted_languages; +} + // Attempting to detect the language through the URI if(str_starts_with($_SERVER['REQUEST_URI'], "/en/")) { $user_language = "en"; @@ -24,31 +64,7 @@ if(str_starts_with($_SERVER['REQUEST_URI'], "/en/")) { $user_uri_language = "/".$user_language; } elseif(isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) { // Attempting to detect the language through the browser's headers. - $_client_languages = []; - - foreach(explode(",", $_SERVER["HTTP_ACCEPT_LANGUAGE"]) as $_client_lang_entry) { - $_client_lang_entry_parts = explode(";", $_client_lang_entry); - - // Ignoring "en-US" and similar entries - if(count($_client_lang_entry_parts) != 2) { - continue; - } - - // Only allowing supported languages - if(!in_array($_client_lang_entry_parts[0], ["en", "fr"])) { - continue; - } - - // Parsing the language's weight - $_client_lang_entry_parts[1] = str_replace("q=", "", $_client_lang_entry_parts[1]); - $_client_lang_entry_weight = filter_var($_client_lang_entry_parts[1], FILTER_VALIDATE_FLOAT); - if($_client_lang_entry_weight === false || !is_float($_client_lang_entry_weight)) { - continue; - } - - // Saving it for later - $_client_languages[] = $_client_lang_entry_parts; - } + $_client_languages = process_lang_header($_SERVER['HTTP_ACCEPT_LANGUAGE']); // Sorting based on weight and selecting the preferred one. if(count($_client_languages) > 0) { @@ -74,6 +90,10 @@ header("Content-Language: " . $user_language); $lang_json = file_get_contents(realpath($dir_commons . "/strings.json")); $lang_data = json_decode($lang_json, true); +if(array_key_exists("_compile_date", $lang_data)) { + $lang_compilation_date = $lang_data["_compile_date"]; +} + // Localization functions function localize_private(string $string_key, array $private_lang_data, bool $fallback_to_common = false, string $fallback_prefix = "fallback.unknown") : string { diff --git a/commons/strings/en/common.json b/commons/strings/en/common.json index 2dcd9f0..0b3b850 100644 --- a/commons/strings/en/common.json +++ b/commons/strings/en/common.json @@ -1,4 +1,10 @@ { "common.action.copy": "Copy", - "common.action.copied": "Copied" + "common.action.copied": "Copied", + + "common.undefined": "Undefined", + "common.na": "N/A", + + "common.yes": "Yes", + "common.no": "No" } \ No newline at end of file diff --git a/commons/strings/en/debug.json b/commons/strings/en/debug.json new file mode 100644 index 0000000..bfbcab6 --- /dev/null +++ b/commons/strings/en/debug.json @@ -0,0 +1,25 @@ +{ + "debug.head.title": "Debugger - NibblePoker", + "debug.head.description": "TODO: description", + "debug.og.title": "NibblePoker - Debugger", + "debug.og.description": "TODO: description", + "debug.header.title": "Debugger", + + "debug.tables.field": "Field", + "debug.tables.value": "Value", + + "debug.host.title": "Host Configuration", + "debug.host.requested": "Requested", + "debug.host.domain": "Domain", + "debug.host.uri": "URI", + "debug.host.tld": "TLD", + "debug.host.waffle": "Waffle Mode", + "debug.host.bouneschlupp": "Bouneschlupp Mode", + + "debug.lang.title": "Localization System (L10N)", + "debug.lang.compile-date": "Compilation date", + "debug.lang.default": "Default language", + "debug.lang.user": "Active language", + "debug.lang.header.raw": "Raw HTTP header", + "debug.lang.header.processed": "Processed HTTP header" +} \ No newline at end of file diff --git a/commons/strings/fr/common.json b/commons/strings/fr/common.json index 251765b..af7cef4 100644 --- a/commons/strings/fr/common.json +++ b/commons/strings/fr/common.json @@ -1,4 +1,10 @@ { "common.action.copy": "Copier", - "common.action.copied": "Copié" + "common.action.copied": "Copié", + + "common.undefined": "Indéfini(e)", + "common.na": "Non-applicable", + + "common.yes": "Oui", + "common.no": "Non" } \ No newline at end of file diff --git a/commons/strings/fr/debug.json b/commons/strings/fr/debug.json new file mode 100644 index 0000000..11aea77 --- /dev/null +++ b/commons/strings/fr/debug.json @@ -0,0 +1,25 @@ +{ + "debug.head.title": "Débogueur - NibblePoker", + "debug.head.description": "TODO: description", + "debug.og.title": "NibblePoker - Débogueur", + "debug.og.description": "TODO: description", + "debug.header.title": "Débogueur", + + "debug.tables.field": "Champ", + "debug.tables.value": "Valeur", + + "debug.host.title": "Configuration de l'hôte", + "debug.host.requested": "Demandé", + "debug.host.domain": "Domaine", + "debug.host.uri": "URI", + "debug.host.tld": "TLD", + "debug.host.waffle": "Mode gaufrier", + "debug.host.bouneschlupp": "Mode Bouneschlupp", + + "debug.lang.title": "Système de localisation (L10N)", + "debug.lang.compile-date": "Date de compilation", + "debug.lang.default": "Langue par défaut", + "debug.lang.user": "Langue active", + "debug.lang.header.raw": "En-tête HTTP brut", + "debug.lang.header.processed": "En-tête HTTP traité" +} \ No newline at end of file diff --git a/compress.bat b/compress.bat index 54f2648..398081c 100644 --- a/compress.bat +++ b/compress.bat @@ -27,7 +27,8 @@ set NP_ZIP_CONTENT= set NP_ZIP_CONTENT=%NP_ZIP_CONTENT% "about/" set NP_ZIP_CONTENT=%NP_ZIP_CONTENT% "commons/*.php" "commons/strings.json" "commons/DOM/" "commons/content/" set NP_ZIP_CONTENT=%NP_ZIP_CONTENT% "contact/" -set NP_ZIP_CONTENT=%NP_ZIP_CONTENT% "content/" +set NP_ZIP_CONTENT=%NP_ZIP_CONTENT% "content/*.*" +set NP_ZIP_CONTENT=%NP_ZIP_CONTENT% "content/items/" set NP_ZIP_CONTENT=%NP_ZIP_CONTENT% "contributors/" set NP_ZIP_CONTENT=%NP_ZIP_CONTENT% "links/" set NP_ZIP_CONTENT=%NP_ZIP_CONTENT% "privacy/" diff --git a/content-index-maker.py b/content-index-maker.py deleted file mode 100644 index e69de29..0000000 diff --git a/debug/index.php b/debug/index.php new file mode 100644 index 0000000..dc28c3f --- /dev/null +++ b/debug/index.php @@ -0,0 +1,138 @@ + + + + + + <?php print(localize('debug.head.title')); ?> + + + + + + + + + + + +
+

+ +

+ +
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
' . htmlspecialchars($_SERVER['HTTP_ACCEPT_LANGUAGE']) . ''); + } else { + echo('' . localize("common.undefined") . ''); + } + ?>
0 ? ' class="mt-xs"' : '') . '>'); + echo('' . htmlspecialchars($_client_language[0]) . ''); + echo(' ➜ '); + echo('' . htmlspecialchars($_client_language[1]) . ''); + echo('

'); + $_i_client_language++; + } + } else { + echo('' . localize("common.na") . ''); + } + ?>
+
+
+ + + +"); +} +?> \ No newline at end of file diff --git a/resources/NibblePoker/scss/nibblepoker.scss b/resources/NibblePoker/scss/nibblepoker.scss index 205a76b..9fa89ef 100644 --- a/resources/NibblePoker/scss/nibblepoker.scss +++ b/resources/NibblePoker/scss/nibblepoker.scss @@ -1,10 +1,10 @@ /* * ----------------------------------------------------------------------------- * NibblePoker.lu CSS - * Version: 0.0.3 - * Copyright, 2023 Bozet Herwin + * Version: I'm not counting anymore + * Copyright, 2023-2024 Bozet Herwin * ----------------------------------------------------------------------------- - * Source: https://github.com/aziascreations/Web-NibblePoker + * Source: https://github.com/NibblePoker/Web-NibblePoker * ----------------------------------------------------------------------------- */ @@ -63,3 +63,4 @@ @import 'site/content'; // Uses fixed sizes and floats @import 'site/video'; @import 'site/modal'; +@import 'site/splide'; diff --git a/resources/NibblePoker/scss/site/image.scss b/resources/NibblePoker/scss/site/image.scss index 1399606..93d593e 100644 --- a/resources/NibblePoker/scss/site/image.scss +++ b/resources/NibblePoker/scss/site/image.scss @@ -62,14 +62,6 @@ } } -// Zoom-in effect for image galleries -.splide li { - transition: all 0.20s ease-in-out; -} -.splide li:hover { - transform: scale(1.05); -} - //.align-v-t #logo-sidebar { diff --git a/resources/NibblePoker/scss/site/splide.scss b/resources/NibblePoker/scss/site/splide.scss new file mode 100644 index 0000000..e71ccdc --- /dev/null +++ b/resources/NibblePoker/scss/site/splide.scss @@ -0,0 +1,16 @@ +// NibblePoker.lu CSS - (C) 2023 Bozet Herwin + +/* Splide Rules */ + +// Zoom-in effect for image galleries +.splide li { + transition: all 0.20s ease-in-out; +} +.splide li:hover { + transform: scale(1.05); +} + +// Generic max-height rule +.splide, .splide * { + max-height: 400px; +} diff --git a/resources/NibblePoker/scss/site/text.scss b/resources/NibblePoker/scss/site/text.scss index 7d13c53..bf5b226 100644 --- a/resources/NibblePoker/scss/site/text.scss +++ b/resources/NibblePoker/scss/site/text.scss @@ -4,7 +4,7 @@ /* Site > Text > Commons */ -p, a, h1, h2, h3, h4, h5, h6, td, th, .code, summary, label { +p, a, h1, h2, h3, h4, h5, h6, td, th, code, .code, summary, label { color: #{$color-text-regular-normal}; }