Revamped layout, Added lang selection, Added auto lang detection, Removed trash, Other minor improvements
Update .htaccess, body-1.php, and 50 more files...
This commit is contained in:
@@ -1,8 +0,0 @@
|
||||
<?php
|
||||
// Making sure the file is included and not accessed directly.
|
||||
if(basename(__FILE__) == basename($_SERVER["SCRIPT_FILENAME"])) {
|
||||
header('HTTP/1.1 403 Forbidden');
|
||||
die();
|
||||
}
|
||||
?>
|
||||
<table class="container-root"><tr><td>
|
||||
@@ -1,8 +0,0 @@
|
||||
<?php
|
||||
// Making sure the file is included and not accessed directly.
|
||||
if(basename(__FILE__) == basename($_SERVER["SCRIPT_FILENAME"])) {
|
||||
header('HTTP/1.1 403 Forbidden');
|
||||
die();
|
||||
}
|
||||
?>
|
||||
</td><td class="w-full h-full"><table class="w-full h-full"><tr><td>
|
||||
@@ -1,8 +0,0 @@
|
||||
<?php
|
||||
// Making sure the file is included and not accessed directly.
|
||||
if(basename(__FILE__) == basename($_SERVER["SCRIPT_FILENAME"])) {
|
||||
header('HTTP/1.1 403 Forbidden');
|
||||
die();
|
||||
}
|
||||
?>
|
||||
</td></tr><tr class="h-full"><td class="h-full"><div class="fluid-container">
|
||||
@@ -1,8 +0,0 @@
|
||||
<?php
|
||||
// Making sure the file is included and not accessed directly.
|
||||
if(basename(__FILE__) == basename($_SERVER["SCRIPT_FILENAME"])) {
|
||||
header('HTTP/1.1 403 Forbidden');
|
||||
die();
|
||||
}
|
||||
?>
|
||||
</div></td></tr></table></td></tr><tr><td colspan="2">
|
||||
@@ -1,8 +0,0 @@
|
||||
<?php
|
||||
// Making sure the file is included and not accessed directly.
|
||||
if(basename(__FILE__) == basename($_SERVER["SCRIPT_FILENAME"])) {
|
||||
header('HTTP/1.1 403 Forbidden');
|
||||
die();
|
||||
}
|
||||
?>
|
||||
</td></tr></table>
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
// Making sure the file is included and not accessed directly.
|
||||
if (basename(__FILE__) == basename($_SERVER["SCRIPT_FILENAME"])) {
|
||||
if(basename(__FILE__) == basename($_SERVER["SCRIPT_FILENAME"])) {
|
||||
header('HTTP/1.1 403 Forbidden');
|
||||
die();
|
||||
}
|
||||
@@ -18,6 +18,6 @@ include_once 'commons/langs.php';
|
||||
</p>
|
||||
<a href="<?php print(l10n_url_abs('/')); ?>">
|
||||
<img id="logo-footer" src="/resources/NibblePoker/images/logos/v2_full_unshaded_original.svg"
|
||||
alt="<?php echo(localize("footer.alt.logo")); ?>" draggable="false">
|
||||
alt="<?php echo(localize("footer.alt.logo")); ?>" draggable="false">
|
||||
</a>
|
||||
</footer>
|
||||
@@ -5,10 +5,10 @@ if(basename(__FILE__) == basename($_SERVER["SCRIPT_FILENAME"])) {
|
||||
die();
|
||||
}
|
||||
?>
|
||||
<meta charset="utf-8" />
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
|
||||
<meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" name="viewport" />
|
||||
<meta name="viewport" content="width=device-width" />
|
||||
<meta charset="utf-8"/>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
|
||||
<meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" name="viewport"/>
|
||||
<meta name="viewport" content="width=device-width"/>
|
||||
<!--<meta content="cache, store" http-equiv="Cache-Control">
|
||||
<meta content="cache, store" http-equiv="Pragma">
|
||||
<meta content="3600" http-equiv="Expires">-->
|
||||
@@ -22,9 +22,9 @@ if($enable_waffle_iron) {
|
||||
//echo("<link rel=\"stylesheet\" href=\"/resources/NibblePoker/css/waffle-day.min.css\">");
|
||||
}
|
||||
if($enable_code_highlight) {
|
||||
echo('<link href="/resources/HighlightJS/11.6.0/styles/atom-one-dark.min.css" rel="stylesheet" />');
|
||||
echo('<link href="/resources/HighlightJS/11.6.0/styles/atom-one-dark.min.css" rel="stylesheet"/>');
|
||||
}
|
||||
if($enable_glider) {
|
||||
echo('<link href="/resources/GliderJs/1.7.6/glider.min.css" rel="stylesheet" />');
|
||||
echo('<link href="/resources/GliderJs/1.7.6/glider.min.css" rel="stylesheet"/>');
|
||||
}
|
||||
?>
|
||||
|
||||
26
commons/DOM/header-lang.php
Normal file
26
commons/DOM/header-lang.php
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
// Making sure the file is included and not accessed directly.
|
||||
if(basename(__FILE__) == basename($_SERVER["SCRIPT_FILENAME"])) {
|
||||
header('HTTP/1.1 403 Forbidden');
|
||||
die();
|
||||
}
|
||||
?>
|
||||
<details id="lang-selector" class="border p-mxs px-s bkgd-blank-dark r-m">
|
||||
<summary>
|
||||
<i class="fad fa-language"></i>
|
||||
<span class="mobile-hide t-w-500"> <?php print(localize("lang.menu.title")); ?></span>
|
||||
<i class="fa fa-angle-down"></i>
|
||||
</summary>
|
||||
<div class="p-xs border bkgd-surround r-m t-w-500">
|
||||
<a href="<?php echo(l10n_url_switch('en')); ?>" class="bland-link">
|
||||
<p class="mb-s px-xxs"><?php print(localize("lang.english")); ?></p>
|
||||
</a>
|
||||
<a href="<?php echo(l10n_url_switch('fr')); ?>" class="bland-link">
|
||||
<p class="my-s px-xxs"><?php print(localize("lang.french")); ?></p>
|
||||
</a>
|
||||
<hr class="subtle m-0">
|
||||
<a href="<?php echo(l10n_url_switch(NULL)); ?>" class="bland-link">
|
||||
<p class="mt-xs px-xxs"><?php print(localize("lang.automatic")); ?></p>
|
||||
</a>
|
||||
</div>
|
||||
</details>
|
||||
@@ -1,63 +1,64 @@
|
||||
<?php
|
||||
// Making sure the file is included and not accessed directly.
|
||||
if (basename(__FILE__) == basename($_SERVER["SCRIPT_FILENAME"])) {
|
||||
if(basename(__FILE__) == basename($_SERVER["SCRIPT_FILENAME"])) {
|
||||
header('HTTP/1.1 403 Forbidden');
|
||||
die();
|
||||
}
|
||||
|
||||
include_once 'commons/langs.php';
|
||||
|
||||
if(!isset($SIDEBAR_ID)) {
|
||||
$SIDEBAR_ID = 'default';
|
||||
if(!isset($SIDEBAR_IDS)) {
|
||||
$SIDEBAR_IDS = [];
|
||||
}
|
||||
|
||||
function printSidebarEntry($url, $title, $icon) {
|
||||
echo('<a class="bland-link" href="' . $url . '"><p class="t-size-18 t-w-500 py-xs sidebar-entry">');
|
||||
function printSidebarEntry($url, $title, $icon, $activeId) {
|
||||
global $SIDEBAR_IDS;
|
||||
echo('<a class="' . (in_array($activeId, $SIDEBAR_IDS) ? 'text-link' : 'bland-link') . '" href="' . $url . '">');
|
||||
echo('<p class="t-size-18 t-w-500 py-xs sidebar-entry">');
|
||||
echo('<i class="' . $icon . ' pr-xs t-size-12 t-half-muted"></i><span class="t-size-12">' . $title . '</span></p></a>');
|
||||
}
|
||||
|
||||
?>
|
||||
<nav id="sidebar" class="sidebar p-m pt-l">
|
||||
<!-- TODO: Active link, and set it from content for projects -->
|
||||
<a href="<?php print(l10n_url_abs('/')); ?>" class="no-select">
|
||||
<img id="logo-sidebar" src="/resources/NibblePoker/images/logos/v2_full_unshaded_original.svg"
|
||||
alt="<?php echo(localize("sidebar.alt.logo")); ?>" draggable="false">
|
||||
alt="<?php echo(localize("sidebar.alt.logo")); ?>" draggable="false">
|
||||
</a>
|
||||
<p class="quantum t-logo-text mb-s mt-xs t-muted ucase">
|
||||
N<span class="t-super-muted">ibble</span>P<span class="t-super-muted">oker</span>
|
||||
</p>
|
||||
<hr class="subtle">
|
||||
<?php
|
||||
printSidebarEntry(l10n_url_abs('/'), localize("sidebar.text.home"), "fad fa-home");
|
||||
printSidebarEntry(l10n_url_abs('/'), localize("sidebar.text.home"), "fad fa-home", "home");
|
||||
?>
|
||||
<hr class="subtle">
|
||||
<?php
|
||||
printSidebarEntry(l10n_url_abs('/content/'), localize("sidebar.text.projects"), "fad fa-briefcase");
|
||||
printSidebarEntry(l10n_url_abs('/content/'), localize("sidebar.text.projects"), "fad fa-briefcase", "content");
|
||||
?>
|
||||
<div class="ml-m">
|
||||
<?php
|
||||
printSidebarEntry(l10n_url_abs('/content/?tags=application'), localize("sidebar.text.applications"),"fad fa-browser");
|
||||
printSidebarEntry(l10n_url_abs('/content/?tags=library'), localize("sidebar.text.libraries"), "fad fa-puzzle-piece");
|
||||
printSidebarEntry(l10n_url_abs('/content/?tags=electronic'), localize("sidebar.text.electronics"), "fad fa-microchip");
|
||||
?>
|
||||
</div>
|
||||
<hr class="subtle">
|
||||
<?php
|
||||
printSidebarEntry(l10n_url_abs('/tools/'), localize("sidebar.text.tools"), "fad fa-tools");
|
||||
?>
|
||||
<hr class="subtle">
|
||||
<?php
|
||||
printSidebarEntry(l10n_url_abs('/links/'), localize("sidebar.text.links"), "fad fa-link");
|
||||
?>
|
||||
<div class="ml-m">
|
||||
<?php
|
||||
printSidebarEntry("https://files.nibblepoker.lu/", localize("sidebar.text.downloads"),"fad fa-download");
|
||||
printSidebarEntry("https://git.nibblepoker.lu/", localize("sidebar.text.gitea"), "fad fa-code");
|
||||
printSidebarEntry(l10n_url_abs('/content/?tags=application'), localize("sidebar.text.applications"), "fad fa-browser", "application");
|
||||
printSidebarEntry(l10n_url_abs('/content/?tags=library'), localize("sidebar.text.libraries"), "fad fa-puzzle-piece", "library");
|
||||
printSidebarEntry(l10n_url_abs('/content/?tags=electronic'), localize("sidebar.text.electronics"), "fad fa-microchip", "electronic");
|
||||
?>
|
||||
</div>
|
||||
<hr class="subtle">
|
||||
<?php
|
||||
printSidebarEntry(l10n_url_abs('/about/'), localize("sidebar.text.about"), "fad fa-user");
|
||||
printSidebarEntry(l10n_url_abs('/contact/'), localize("sidebar.text.contact"),"fad fa-mailbox");
|
||||
printSidebarEntry(l10n_url_abs('/tools/'), localize("sidebar.text.tools"), "fad fa-tools", "tools");
|
||||
?>
|
||||
<hr class="subtle">
|
||||
<?php
|
||||
printSidebarEntry(l10n_url_abs('/links/'), localize("sidebar.text.links"), "fad fa-link", "links");
|
||||
?>
|
||||
<div class="ml-m">
|
||||
<?php
|
||||
printSidebarEntry("https://files.nibblepoker.lu/", localize("sidebar.text.downloads"), "fad fa-download", "");
|
||||
printSidebarEntry("https://git.nibblepoker.lu/", localize("sidebar.text.gitea"), "fad fa-code", "");
|
||||
?>
|
||||
</div>
|
||||
<hr class="subtle">
|
||||
<?php
|
||||
printSidebarEntry(l10n_url_abs('/about/'), localize("sidebar.text.about"), "fad fa-user", "about");
|
||||
printSidebarEntry(l10n_url_abs('/contact/'), localize("sidebar.text.contact"), "fad fa-mailbox", "contact");
|
||||
?>
|
||||
</nav>
|
||||
|
||||
@@ -33,7 +33,7 @@ function getMainHeader(string $text, ?string $iconId = null, ?string $rightText
|
||||
$htmlCode .= $text;
|
||||
|
||||
if(!is_null($rightText)) {
|
||||
$htmlCode .= '<span class="ml-auto ' . ($chungusMode ? "t-size-12 mr-xs" : "t-size-10 t-muted") . '">' . $rightText . '</span>';
|
||||
$htmlCode .= '<span class="ml-auto mobile-hide ' . ($chungusMode ? "t-size-12 mr-xs" : "t-size-10 t-muted") . '">' . $rightText . '</span>';
|
||||
}
|
||||
|
||||
$htmlCode .= '</h' . $hLevel . '></div>';
|
||||
|
||||
@@ -907,7 +907,7 @@ class ComposerElement {
|
||||
case ComposerElementTypes::VIDEO:
|
||||
// Composing the video element
|
||||
$htmlCode .= '<video ' . (is_null($this->source) ? '' : 'src="' . $this->source . '" ') .
|
||||
'class="' . $this->get_modifiers_classes() . '" ' .
|
||||
'class="' . $this->get_modifiers_classes() . ' r-l" ' .
|
||||
(is_null($this->thumbnail) ? '' : 'poster="' . $this->thumbnail . '" ') .
|
||||
'controls muted></video>';
|
||||
break;
|
||||
|
||||
@@ -20,15 +20,50 @@ if(str_starts_with($_SERVER['REQUEST_URI'], "/en/")) {
|
||||
} elseif(str_starts_with($_SERVER['REQUEST_URI'], "/fr/")) {
|
||||
$user_language = "fr";
|
||||
$user_uri_language = "/".$user_language;
|
||||
} elseif(str_starts_with($_SERVER['REQUEST_URI'], "/lb/")) {
|
||||
$user_language = "lb";
|
||||
$user_uri_language = "/".$user_language;
|
||||
} else {
|
||||
} elseif(isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
|
||||
// Attempting to detect the language through the browser's headers.
|
||||
// TODO: This !
|
||||
$user_uri_language = "";
|
||||
$_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;
|
||||
}
|
||||
|
||||
// Sorting based on weight and selecting the preferred one.
|
||||
if(count($_client_languages) > 0) {
|
||||
usort($_client_languages, function(array $a, array $b) {
|
||||
if($a[1] == $b[1]) {
|
||||
return 0;
|
||||
}
|
||||
return ($a[1] > $b[1]) ? -1 : 1;
|
||||
});
|
||||
|
||||
$user_language = $_client_languages[0][0];
|
||||
}
|
||||
}
|
||||
|
||||
// Setting headers
|
||||
header("Content-Language: " . $user_language);
|
||||
|
||||
// Reading and parsing the strings.json file
|
||||
$lang_json = file_get_contents(realpath($dir_commons . "/strings.json"));
|
||||
$lang_data = json_decode($lang_json, true);
|
||||
|
||||
File diff suppressed because one or more lines are too long
11
commons/strings/en/contact.json
Normal file
11
commons/strings/en/contact.json
Normal file
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"contact.head.title": "Contact - NibblePoker",
|
||||
"contact.head.description": "TODO: description",
|
||||
"contact.og.title": "NibblePoker - Contact",
|
||||
"contact.og.description": "TODO: description",
|
||||
"contact.header.title": "Contact",
|
||||
|
||||
"contact.twitter.title": "Twitter",
|
||||
"contact.twitter.compose": "Compose DM to @NibblePoker on Twitter"
|
||||
|
||||
}
|
||||
@@ -10,7 +10,7 @@
|
||||
"content.search.count.single": "result",
|
||||
"content.search.count.multiple": "results",
|
||||
|
||||
"content.header.base" : "Content",
|
||||
"content.header.base" : "Projects",
|
||||
"content.search.header" : "Search",
|
||||
"content.error.header" : "Error",
|
||||
"_content.item.header" : "",
|
||||
@@ -56,8 +56,8 @@
|
||||
"content.commons.version.old.single": "Old version",
|
||||
"content.commons.version.old.multiple": "Old versions",
|
||||
"content.commons.version.source": "Source code",
|
||||
"content.commons.cpu": "CPU <span class=\"hidden-xs-and-down\">Architecture</span>",
|
||||
"content.commons.cpu.responsive": "CPU <span class=\"hidden-xs-and-down\">Architecture</span>",
|
||||
"content.commons.cpu": "CPU <span class=\"mobile-hide\">Architecture</span>",
|
||||
"content.commons.cpu.responsive": "CPU <span class=\"mobile-hide\">Architecture</span>",
|
||||
"content.commons.cpu.any": "Any architecture",
|
||||
"content.commons.cpu.x64": "x64",
|
||||
"content.commons.cpu.x86": "x86",
|
||||
|
||||
7
commons/strings/en/links.json
Normal file
7
commons/strings/en/links.json
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"links.head.title": "Links - NibblePoker",
|
||||
"links.head.description": "TODO: description",
|
||||
"links.og.title": "NibblePoker - Links",
|
||||
"links.og.description": "TODO: description",
|
||||
"links.header.title": "Links"
|
||||
}
|
||||
11
commons/strings/fr/contact.json
Normal file
11
commons/strings/fr/contact.json
Normal file
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"contact.head.title": "Contact - NibblePoker",
|
||||
"contact.head.description": "TODO: description",
|
||||
"contact.og.title": "NibblePoker - Contact",
|
||||
"contact.og.description": "TODO: description",
|
||||
"contact.header.title": "Contact",
|
||||
|
||||
"contact.twitter.title": "Twitter",
|
||||
"contact.twitter.compose": "Composer un message privé pour @NibblePoker sur Twitter"
|
||||
|
||||
}
|
||||
@@ -10,6 +10,11 @@
|
||||
"content.search.count.single": "résultat",
|
||||
"content.search.count.multiple": "résultats",
|
||||
|
||||
"content.header.base" : "Projets",
|
||||
"content.search.header" : "Recherche",
|
||||
"content.error.header" : "Erreur",
|
||||
"_content.item.header" : "",
|
||||
|
||||
"content.error.head.title": "Erreur de contenu - NibblePoker",
|
||||
"_content.error.head.description": "Done via the '$content_error_message' variable",
|
||||
"content.error.og.title": "NibblePoker - Erreur de contenu",
|
||||
|
||||
7
commons/strings/fr/links.json
Normal file
7
commons/strings/fr/links.json
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"links.head.title": "Liens - NibblePoker",
|
||||
"links.head.description": "TODO: description",
|
||||
"links.og.title": "NibblePoker - Liens",
|
||||
"links.og.description": "TODO: description",
|
||||
"links.header.title": "Liens"
|
||||
}
|
||||
Reference in New Issue
Block a user