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) {
-