From eeaee2baaefc41260aa054923c1ac8e5f4232099 Mon Sep 17 00:00:00 2001 From: Kazhnuz Date: Sun, 13 Jul 2025 19:19:21 +0200 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20Add=20descriptions?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes #88 --- bl-kernel/helpers/theme.class.php | 55 +++++++++++++++++++++++++++++++ bl-languages/en.json | 8 ++++- bl-languages/fr_FR.json | 7 +++- 3 files changed, 68 insertions(+), 2 deletions(-) diff --git a/bl-kernel/helpers/theme.class.php b/bl-kernel/helpers/theme.class.php index 2835b4e1..cde99cf0 100644 --- a/bl-kernel/helpers/theme.class.php +++ b/bl-kernel/helpers/theme.class.php @@ -108,6 +108,7 @@ class Theme global $categories; global $WHERE_AM_I; global $page; + global $L; if ($WHERE_AM_I == 'page') { return $page->title(); @@ -142,6 +143,60 @@ class Theme } catch (Exception $e) { // Author doesn't exist } + } elseif ($WHERE_AM_I == 'home') { + return $L->get("Latest articles"); + } + + return null; + } + + public static function locationDescription() + { + global $url; + global $site; + global $tags; + global $archives; + global $authors; + global $categories; + global $WHERE_AM_I; + global $page; + global $L; + + if ($WHERE_AM_I == 'page') { + return $page->description(); + } elseif ($WHERE_AM_I == 'tag') { + try { + $tagKey = $url->slug(); + $tag = new Tag($tagKey); + return $L->get('all-post-tags') . " \"" . $tag->name() . "\""; + } catch (Exception $e) { + // Tag doesn't exist + } + } elseif ($WHERE_AM_I == 'category') { + try { + $categoryKey = $url->slug(); + $category = new Category($categoryKey); + return $category->description(); + } catch (Exception $e) { + // Category doesn't exist + } + } elseif ($WHERE_AM_I == 'archive') { + try { + $archiveKey = $url->slug(); + return $L->get('all-post-archive') . Date::prettyArchiveDate($archiveKey); + } catch (Exception $e) { + // Archive doesn't exist + } + } elseif ($WHERE_AM_I == 'author') { + try { + $authorKey = $url->slug(); + $user = new User($authorKey); + return $L->get('all-post-author') . $user->displayName(); + } catch (Exception $e) { + // Author doesn't exist + } + } elseif ($WHERE_AM_I == 'home') { + return $L->get("all-post"); } return null; diff --git a/bl-languages/en.json b/bl-languages/en.json index 77065591..aad959d8 100644 --- a/bl-languages/en.json +++ b/bl-languages/en.json @@ -415,5 +415,11 @@ "insert-thumbnail": "Insert thumbnail", "insert-linked-thumbnail": "Insert linked thumbnail", "more-infos": "More infos", - "base-infos": "Base infos" + "base-infos": "Base infos", + "latest-articles": "Latest articles", + "all-post-tags": "All posts with the tag", + "all-post-archive": "All posts written in", + "all-post-author": "All posts written by", + "all-post": "All the latest posts written on the blog" + } diff --git a/bl-languages/fr_FR.json b/bl-languages/fr_FR.json index 2708b2af..3bcdce49 100644 --- a/bl-languages/fr_FR.json +++ b/bl-languages/fr_FR.json @@ -426,5 +426,10 @@ "base-infos": "Infos de bases", "source-link": "Lien source", "the-external-link-you-refer-to-in-the-post":"Le lien externe auquel vous vous referrez dans le contenu", - "powered-by":"Propulsé par" + "powered-by":"Propulsé par", + "latest-articles": "Derniers articles", + "all-post-tags": "Tous les articles avec le tag", + "all-post-archive": "Tous les articles écrits en", + "all-post-author": "Tous les articles écrits par", + "all-post": "Tout les articles écrits récemment sur le blog" } \ No newline at end of file