Browse Source

distingue le sous-titre du titre

master
vince vince 1 year ago
parent
commit
69acc53db7
1 changed files with 18 additions and 11 deletions
  1. +18
    -11
      index.php

+ 18
- 11
index.php View File

@ -47,7 +47,8 @@ if ($hasSupplier) {
$config[$supplier] = array_merge(
[
'title' => '%supplier% <small class="text-muted text-nowrap d-block d-sm-inline">%date%</small>',
'title' => '',
'subtitle' => '<small class="text-muted text-nowrap d-block d-sm-inline">%date%</small>',
'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) {
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title><?php echo strip_tags($config[$supplier]['title']); ?></title>
<title><?php echo strip_tags($config[$supplier]['title']); ?> — <?php echo strip_tags($config[$supplier]['subtitle']); ?></title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous">
</head>
<body>
@ -292,8 +298,8 @@ if (!$isConfig and $hasSupplier) {
<div class="row mb-3">
<label for="title" class="col-sm-2 col-form-label">Titre</label>
<div class="col-sm-10">
<input class="form-control" type="text" name="title" value="<?php echo htmlspecialchars($config[$supplier]['title']); ?>" />
<div class="form-text">Le titre de la page. <kbd>%supplier%</kbd> est le fournisseur et <kbd>%date%</kbd> la date de l'événement.</div>
<input class="form-control" type="text" name="title" value="<?php echo htmlspecialchars($config[$supplier]['title']); ?>" placeholder="<?php echo $supplier; ?>" />
<div class="form-text">Le titre de la page. Par défaut ce sera le nom du fournisseur </div>
</div>
</div>
<div class="row mb-3">
@ -375,6 +381,7 @@ if (!$isConfig and $hasSupplier) {
<?php endif; ?>
</div>
<?php echo $config[$supplier]['title']; ?>
<?php echo $config[$supplier]['subtitle']; ?>
</h1>
<?php if (!empty($config[$supplier]['description'])) : ?>
<p class="lead"><?php echo $config[$supplier]['description']; ?></p>


Loading…
Cancel
Save