From 69acc53db7c1d8e532d551723674012143cb393d Mon Sep 17 00:00:00 2001 From: vince Date: Fri, 24 Dec 2021 16:54:41 +0100 Subject: [PATCH] distingue le sous-titre du titre --- index.php | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/index.php b/index.php index 30235c3..64a1533 100644 --- a/index.php +++ b/index.php @@ -47,7 +47,8 @@ if ($hasSupplier) { $config[$supplier] = array_merge( [ - 'title' => '%supplier% %date%', + 'title' => '', + 'subtitle' => '%date%', 'description' => '', 'choices' => [], 'start' => 'now 00:00:00', @@ -79,7 +80,7 @@ if ($hasSupplier) { foreach (array_keys($config[$supplier]) as $key) if (isset($_REQUEST[$key])) - $config[$supplier][$key] = (!in_array($key, ['title', 'description']) ? filter_var($_REQUEST[$key], FILTER_SANITIZE_STRING) : $_REQUEST[$key]); + $config[$supplier][$key] = (!in_array($key, ['title', 'subtitle', 'description']) ? filter_var($_REQUEST[$key], FILTER_SANITIZE_STRING) : $_REQUEST[$key]); } if (empty($config[$supplier]['start'])) @@ -213,12 +214,17 @@ if (!$isConfig and $hasSupplier) { $date = (new \IntlDateFormatter('fr_FR.UTF8', \IntlDateFormatter::FULL, \IntlDateFormatter::NONE, 'Europe/Paris'))->format(new \DateTime($event)); - while (preg_match('/%([^%]+)%/i', $config[$supplier]['title'], $match)) - $config[$supplier]['title'] = str_replace( - $match[0], - ${$match[1]}, - $config[$supplier]['title'] - ); + foreach (['title', 'subtitle', 'description'] as $key) { + while (preg_match('/%([^%]+)%/i', $config[$supplier][$key], $match)) + $config[$supplier][$key] = str_replace( + $match[0], + ${$match[1]}, + $config[$supplier][$key] + ); + } + + if (empty($config[$supplier]['title'])) + $config[$supplier]['title'] = $supplier; $stats = []; foreach ($items as $item) @@ -232,7 +238,7 @@ if (!$isConfig and $hasSupplier) { - <?php echo strip_tags($config[$supplier]['title']); ?> + <?php echo strip_tags($config[$supplier]['title']); ?> — <?php echo strip_tags($config[$supplier]['subtitle']); ?> @@ -292,8 +298,8 @@ if (!$isConfig and $hasSupplier) {
- -
Le titre de la page. Où %supplier% est le fournisseur et %date% la date de l'événement.
+ +
Le titre de la page. Par défaut ce sera le nom du fournisseur
@@ -375,6 +381,7 @@ if (!$isConfig and $hasSupplier) {
+