Finished base for new composer, Messed up old content index, Improved lang include

Update composer.php, content.php, and 6 more files...
This commit is contained in:
2022-06-24 18:43:31 +02:00
parent 099414d541
commit a44ddf3671
8 changed files with 783 additions and 147 deletions

View File

@@ -23,7 +23,7 @@
"fr": "Conteneur et application Python hautement configurable qui permet d'automatiquement archiver et télécharger des livestreams et vidéos depuis YouTube."
},
"image": "/resources/Azias/imgs/yaa/icon-final.png",
"tags": ["docker", "web", "python"]
"tags": ["docker", "application", "web", "python"]
},
{
"id": "excel-worksheet-password-remover",

View File

@@ -1,5 +1,5 @@
<?php
// Includes
// Importing required scripts.
set_include_path('../commons/');
include_once 'config.php';
include_once 'langs.php';
@@ -33,7 +33,7 @@ if($content_has_error) {
} else {
$_metaTitle = localize("error.content.data.no.title");
$_metaDescription = localize("error.content.data.no.description");
if($requested_content_display_type == ContentDisplayType::CONTENT) {
/*if($requested_content_display_type == ContentDisplayType::CONTENT) {
if(array_key_exists("meta", $requested_item_data)) {
if(array_key_exists("title", $requested_item_data["meta"])) {
$_metaTitle = getContentItemText($requested_item_data["meta"]["title"]);
@@ -45,8 +45,9 @@ if($content_has_error) {
} else {
$_metaTitle = localize("content.title.search.card");
$_metaDescription = "";
}
}/**/
}
//$content->metadata->title
// Printing the title, meta and opengraph tags.
echo('<title>'.$_metaTitle.' - Nibble Poker</title>');
@@ -71,21 +72,15 @@ if($content_has_error) {
<i class="fad fa-briefcase"></i>&nbsp;&nbsp;<?php
echo('<span class="hidden-xs-and-down">');
if($content_has_error) {
if(isset($_SERVER['HTTP_REFERER'])) {
echo('<a href="'.$_SERVER['HTTP_REFERER'].'">'.localize("content.title.content").'</a>');
} else {
//echo('<a class="js-set-previous-url" href="#">'.localize("content.title.content").'</a>');
echo(localize("content.title.content"));
}
echo('<span class="mx-10">❱</span>'.localize("content.title.error"));
echo(localize("content.title.content").'<span class="mx-10">❱</span>'.localize("content.title.error"));
} elseif($requested_content_display_type == ContentDisplayType::SEARCH) {
echo(localize("content.title.content").'<span class="mx-10">❱</span>'.localize("content.title.search.header"));
} elseif($requested_content_display_type == ContentDisplayType::CONTENT) {
$_nav_title_text = '<i>' . localize("error.content.data.no.title") . '</i>';
if (array_key_exists("page", $requested_item_data["title"])) {
$_nav_title_text = getContentItemText($requested_item_data["title"]["page"]);
}
//if (array_key_exists("page", $requested_item_data["title"])) {
// $_nav_title_text = getContentItemText($requested_item_data["title"]["page"]);
//}
echo(localize("content.title.content").'<span class="mx-10">❱</span></span>'.$_nav_title_text);
}
@@ -95,47 +90,12 @@ if($content_has_error) {
</div>
<div class="content mx-auto w-lg-p90">
<?php
if($SHOW_CONTENT_DEBUG_CARD) {
// ################
// Debugging card
// ################
echo('<div class="card p-0 mx-0">
<div class="px-card py-10 border-bottom px-20">
<div class="container-fluid">
<div class="row">
<h2 class="card-title font-size-18 m-0"><i class="fad fa-debug"></i>&nbsp;&nbsp;Debug</h2>
</div>
</div>
</div>
<div class="px-card py-20 bg-light-lm rounded-bottom px-20 bg-very-dark title-bkgd">');
echo('<p class="m-0 mb-5">REQUEST_URI: '.$_SERVER['REQUEST_URI'].'</p>');
echo('<p class="m-0 mb-5">$requested_content_display_type: '.$requested_content_display_type.'</p>');
echo('<p class="m-0 mb-5">$requested_tags: ['.implode(", ", $requested_tags).']</p>');
echo('<p class="m-0 mb-5">count($requested_tags): '.count($requested_tags).'</p>');
echo('<p class="m-0 mb-5">$content_has_error: '.$content_has_error.'</p>');
echo('<p class="m-0 mb-5">$content_error_message_key: '.$content_error_message_key.'</p>');
echo('<p class="m-0 mb-5">localize($content_error_message_key): '.localize($content_error_message_key).'</p>');
echo('<p class="m-0 mb-5">$content_error_message: '.$content_error_message.'</p>');
echo('<p class="m-0 mb-5">$raw_additional_tags: '.$raw_additional_tags.'</p>');
echo('<p class="m-0 mb-5">$filtered_content_index_data: ');
print_r($filtered_content_index_data);
echo('</p>');
echo('<p class="m-0 mb-5">$content_requested_url_part: '.$content_requested_url_part.'</p>');
if($requested_content_display_type == ContentDisplayType::CONTENT) {
echo('<hr class="subtle mb-10 mt-15">');
echo('<p class="m-0 mb-5">$requested_item_data: ');
print_r($requested_item_data);
echo('</p>');
}
echo('</div></div>');
}
// Checking if an error occurred.
if($content_error_code != 200) {
// #############
// Error card
// #############
startMainCard("fad fa-exclamation-triangle", localize('error.content.title.generic'), "");
start_content_card("fad fa-exclamation-triangle", localize('error.content.title.generic'), "");
echo('<div class="py-20 bg-light-lm rounded-bottom px-0 bg-very-dark title-bkgd">');
echo('<h3 class="m-0 font-size-20 text-center font-weight-semi-bold">'.$content_error_message.'</h3>');
echo('</div>');
@@ -143,7 +103,7 @@ if($content_has_error) {
'<p class="font-size-12 m-0 text-super-muted">'.
'Card footer here.'.
'</p></div>');
endMainCard();
end_content_card();
goto content_printing_end;
}
@@ -152,9 +112,7 @@ if($content_has_error) {
// #############
// Search page
// #############
// Creating the start of the card, only a "</div>" should be required afterward.
startMainCard(
start_content_card(
"fad fa-file-search",
localize("content.title.search.card"),
strval(count($filtered_content_index_data)) . " " .
@@ -198,70 +156,12 @@ if($content_has_error) {
'<p class="font-size-12 m-0 text-super-muted">'.
'Card footer here.'.
'</p></div>');
endMainCard();
end_content_card();
} elseif($requested_content_display_type == ContentDisplayType::CONTENT) {
// ##############
// Content page
// ##############
// Preparing soma variables for the icon, title and subtitle.
$_title_icon = "fad fa-question";
$_title_text_main = '<i>'.localize("error.content.data.no.title").'</i>';
$_title_text_sub = NULL;
// Attempting to read the card's icon, title and subtitle.
if (array_key_exists("title", $requested_item_data)) {
if (array_key_exists("icon", $requested_item_data["title"])) {
$_title_icon = $requested_item_data["title"]["icon"];
}
if (array_key_exists("card", $requested_item_data["title"])) {
if (array_key_exists("main", $requested_item_data["title"]["card"])) {
$_title_text_main = getContentItemText($requested_item_data["title"]["card"]["main"], true);
}
if (array_key_exists("sub", $requested_item_data["title"]["card"])) {
$_title_text_sub = getContentItemText($requested_item_data["title"]["card"]["sub"], true);
}
}
}
// Opening the card.
startMainCard($_title_icon, $_title_text_main, (is_null($_title_text_sub) ? "" : $_title_text_sub));
// Opening the content container.
echo('<article id="content-item-container" class="py-01 pb-0 bg-light-lm rounded-bottom px-0 bg-very-dark title-bkgd">');
// Adding elements defined in the JSON file.
if(array_key_exists("parts", $requested_item_data)) {
for ($i = 0; $i < count($requested_item_data["parts"]); $i++) {
createElementNode($requested_item_data["parts"][$i]);
}
} else {
echo('<h3 class="m-0 font-size-20 text-center text-danger font-weight-semi-bold">');
echo(localize("error.content.data.no.parts").'</h3>');
}
// New elements test zone. - START
// New elements test zone. - END
// Closing the content container.
echo('</article>');
// Printing the tags' section at the end of the card
echo('<div class="px-20 py-10 bg-light-lm bg-dark-dm rounded-bottom border-top">');
echo('<div class="content-tag-container"><i class="fad fa-tags"></i>');
if(array_key_exists("tags", $requested_item_data)) {
for($i = 0; $i < count($requested_item_data["tags"]); $i++) {
echo('<a href="'.l10n_url_abs("/content/?tags=".$requested_item_data["tags"][$i]).'" class="content-tag">#');
echo($requested_item_data["tags"][$i].'</a>');
}
} else {
echo('<i>'.localize("error.content.data.no.tags").'</i>');
}
echo('</div></div>');
// Closing the card.
endMainCard();
echo($content->get_html());
}
content_printing_end:

View File

@@ -4,7 +4,7 @@
"page": {"en": "PB-ListComPort", "fr": "PB-ListComPort"},
"card": {
"main": {"en": "PB-ListComPort", "fr": "PB-ListComPort"},
"sub": {"en": "CLI COM port enumerator", "fr": "Enumérateur de port COM pour invité de commande"}
"sub": {"en": "<a href=\"https://github.com/aziascreations/PB-ListComPort\"><i class=\"fab fa-github\"></i></a>"}
}
},
"meta": {
@@ -123,7 +123,7 @@
"type": "spacer", "size": 1
},{
"type": "container", "padding": 0,
"modifiers": ["no-bottom-padding", "no-top-margin", "card"],
"modifiers": ["no-bottom-padding", "no-top-margin", "card", "horizontal-scroll"],
"content": {
"parts": [{
"type": "table",
@@ -193,7 +193,7 @@
"type": "spacer", "size": 1
},{
"type": "container", "padding": 0,
"modifiers": ["no-bottom-padding", "no-top-margin", "card"],
"modifiers": ["no-bottom-padding", "no-top-margin", "card", "horizontal-scroll"],
"content": {
"parts": [{
"type": "table",
@@ -307,7 +307,7 @@
"type": "spacer", "size": 1
},{
"type": "container", "padding": 0,
"modifiers": ["no-bottom-padding", "no-top-margin", "card"],
"modifiers": ["no-bottom-padding", "no-top-margin", "card", "horizontal-scroll"],
"content": {
"parts": [{
"type": "table", "modifiers": ["striped", "inner-bordered"],

56
content/items/test2.json Normal file
View File

@@ -0,0 +1,56 @@
{
"strings": {
"en": {
"title.meta": "Test content",
"title.og": "Test content",
"title.article": "Test content",
"heading.1": "t1",
"text.1": "p1",
"hello.world": "Hello World !"
},
"fr": {
"title.meta": "Test content fr",
"title.og": "Test content fr",
"title.article": "Test content fr",
"heading.1": "t1 fr",
"text.1": "p1 fr",
"hello.world": "Bonjour le monde !"
}
},
"metadata": {
"title": "title.meta",
"template": "article",
"opengraph": {
"title": "title.og",
"description": "",
"type": "",
"url": null,
"image": "",
"imageType": ""
},
"article": {
"icon": "fad fa-terminal",
"title": "title.article",
"tags": ["fuck", "you"]
}
},
"elements": [
{
"type": "container",
"padding": 10,
"modifiers": ["no-bottom-padding", "no-top-margin"],
"parts": [
{
"type": "paragraph",
"modifiers": ["no-top-margin"],
"content": "hello.world"
},{
"type": "paragraph",
"modifiers": [],
"content": "Joe mama !",
"localize": false
}
]
}
]
}

View File

@@ -23,6 +23,6 @@
}
},
"tags": [
"docker", "web", "python"
"docker", "application", "web", "python"
]
}