style : formatage PHP-CS-Fixer sur le wizard

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-14 21:48:33 +02:00
parent 6895a3bf65
commit c503f1dd66
8 changed files with 62 additions and 25 deletions
+1 -1
View File
File diff suppressed because one or more lines are too long
+50 -14
View File
@@ -544,7 +544,10 @@ switch ($action) {
break; break;
case 2: case 2:
if ($draft === null) { header('Location: /new'); exit; } if ($draft === null) {
header('Location: /new');
exit;
}
if ($_SERVER['REQUEST_METHOD'] === 'POST') { if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$articles->updatePartialMeta($uuid, [ $articles->updatePartialMeta($uuid, [
'published' => isset($_POST['published']) && $_POST['published'] !== '', 'published' => isset($_POST['published']) && $_POST['published'] !== '',
@@ -559,7 +562,10 @@ switch ($action) {
break; break;
case 3: case 3:
if ($draft === null) { header('Location: /new'); exit; } if ($draft === null) {
header('Location: /new');
exit;
}
if ($_SERVER['REQUEST_METHOD'] === 'POST') { if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$articles->updatePartialMeta($uuid, ['category' => trim($_POST['category'] ?? '')]); $articles->updatePartialMeta($uuid, ['category' => trim($_POST['category'] ?? '')]);
header('Location: /new/' . rawurlencode($uuid) . '/4'); header('Location: /new/' . rawurlencode($uuid) . '/4');
@@ -572,7 +578,10 @@ switch ($action) {
break; break;
case 4: case 4:
if ($draft === null) { header('Location: /new'); exit; } if ($draft === null) {
header('Location: /new');
exit;
}
if ($_SERVER['REQUEST_METHOD'] === 'POST') { if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$_vals = array_values(array_filter(array_map('trim', explode(',', (string)($_POST['tags_flat'] ?? ''))), fn ($_v) => $_v !== '')); $_vals = array_values(array_filter(array_map('trim', explode(',', (string)($_POST['tags_flat'] ?? ''))), fn ($_v) => $_v !== ''));
$articles->updatePartialMeta($uuid, ['tags' => $_vals !== [] ? ['tags' => $_vals] : []]); $articles->updatePartialMeta($uuid, ['tags' => $_vals !== [] ? ['tags' => $_vals] : []]);
@@ -582,14 +591,22 @@ switch ($action) {
$_tagTypes = $articles->getTagTypes(); $_tagTypes = $articles->getTagTypes();
$flatTagValues = []; $flatTagValues = [];
foreach ($_tagTypes as $_tk => $_) { foreach ($_tagTypes as $_tk => $_) {
foreach ($articles->getAllTagValues($_tk) as $_v) { $flatTagValues[$_v] = true; } foreach ($articles->getAllTagValues($_tk) as $_v) {
$flatTagValues[$_v] = true;
}
}
foreach ($articles->getAllTagValues('tags') as $_v) {
$flatTagValues[$_v] = true;
} }
foreach ($articles->getAllTagValues('tags') as $_v) { $flatTagValues[$_v] = true; }
ksort($flatTagValues); ksort($flatTagValues);
$flatTagValues = array_keys($flatTagValues); $flatTagValues = array_keys($flatTagValues);
$flatArticleTags = []; $flatArticleTags = [];
foreach (($draft['tags'] ?? []) as $_tagVals) { foreach (($draft['tags'] ?? []) as $_tagVals) {
foreach ((array)$_tagVals as $_v) { if (!in_array($_v, $flatArticleTags, true)) $flatArticleTags[] = $_v; } foreach ((array)$_tagVals as $_v) {
if (!in_array($_v, $flatArticleTags, true)) {
$flatArticleTags[] = $_v;
}
}
} }
$draftContent = (string)($draft['content'] ?? ''); $draftContent = (string)($draft['content'] ?? '');
require_once BASE_PATH . '/src/TagSuggester.php'; require_once BASE_PATH . '/src/TagSuggester.php';
@@ -597,7 +614,10 @@ switch ($action) {
break; break;
case 5: case 5:
if ($draft === null) { header('Location: /new'); exit; } if ($draft === null) {
header('Location: /new');
exit;
}
require_once BASE_PATH . '/src/Parsedown.php'; require_once BASE_PATH . '/src/Parsedown.php';
$_pd = new Parsedown(); $_pd = new Parsedown();
$autoSeoDesc = mb_strimwidth(trim((string)preg_replace('/\s+/', ' ', strip_tags($_pd->text((string)($draft['content'] ?? ''))))), 0, 155, '…'); $autoSeoDesc = mb_strimwidth(trim((string)preg_replace('/\s+/', ' ', strip_tags($_pd->text((string)($draft['content'] ?? ''))))), 0, 155, '…');
@@ -903,14 +923,22 @@ switch ($action) {
$_tagTypes = $articles->getTagTypes(); $_tagTypes = $articles->getTagTypes();
$flatTagValues = []; $flatTagValues = [];
foreach ($_tagTypes as $_tk => $_) { foreach ($_tagTypes as $_tk => $_) {
foreach ($articles->getAllTagValues($_tk) as $_v) { $flatTagValues[$_v] = true; } foreach ($articles->getAllTagValues($_tk) as $_v) {
$flatTagValues[$_v] = true;
}
}
foreach ($articles->getAllTagValues('tags') as $_v) {
$flatTagValues[$_v] = true;
} }
foreach ($articles->getAllTagValues('tags') as $_v) { $flatTagValues[$_v] = true; }
ksort($flatTagValues); ksort($flatTagValues);
$flatTagValues = array_keys($flatTagValues); $flatTagValues = array_keys($flatTagValues);
$flatArticleTags = []; $flatArticleTags = [];
foreach (($draft['tags'] ?? []) as $_tagVals) { foreach (($draft['tags'] ?? []) as $_tagVals) {
foreach ((array)$_tagVals as $_v) { if (!in_array($_v, $flatArticleTags, true)) $flatArticleTags[] = $_v; } foreach ((array)$_tagVals as $_v) {
if (!in_array($_v, $flatArticleTags, true)) {
$flatArticleTags[] = $_v;
}
}
} }
$draftContent = (string)($draft['content'] ?? ''); $draftContent = (string)($draft['content'] ?? '');
require_once BASE_PATH . '/src/TagSuggester.php'; require_once BASE_PATH . '/src/TagSuggester.php';
@@ -962,10 +990,18 @@ switch ($action) {
$autoSlug = slugify($draftData['title'] ?? ''); $autoSlug = slugify($draftData['title'] ?? '');
$postSlug = $draftData['slug'] ?? $article['slug']; $postSlug = $draftData['slug'] ?? $article['slug'];
$changes = []; $changes = [];
if ($titleChanged) { $changes[] = 'titre modifié'; } if ($titleChanged) {
if (($draftData['category'] ?? '') !== ($article['category'] ?? '')) { $changes[] = 'catégorie modifiée'; } $changes[] = 'titre modifié';
if (($draftData['tags'] ?? []) !== ($article['tags'] ?? [])) { $changes[] = 'tags modifiés'; } }
if (($draftData['content'] ?? '') !== ($article['content'] ?? '')) { $changes[] = 'contenu modifié'; } if (($draftData['category'] ?? '') !== ($article['category'] ?? '')) {
$changes[] = 'catégorie modifiée';
}
if (($draftData['tags'] ?? []) !== ($article['tags'] ?? [])) {
$changes[] = 'tags modifiés';
}
if (($draftData['content'] ?? '') !== ($article['content'] ?? '')) {
$changes[] = 'contenu modifié';
}
if ((bool)($draftData['published'] ?? false) !== (bool)($article['published'] ?? false)) { if ((bool)($draftData['published'] ?? false) !== (bool)($article['published'] ?? false)) {
$changes[] = ($draftData['published'] ?? false) ? 'article publié' : 'article dépublié'; $changes[] = ($draftData['published'] ?? false) ? 'article publié' : 'article dépublié';
} }
+2 -1
View File
@@ -73,7 +73,8 @@ $_slugFinal = ($titleChanged && $autoSlug !== $postSlug) ? $autoSlug : $postSlu
<?php if (!isset($show[$i])): ?> <?php if (!isset($show[$i])): ?>
<?php if (!$inEllipsis): $inEllipsis = true; ?> <?php if (!$inEllipsis): $inEllipsis = true; ?>
<div class="diff-ellipsis text-muted px-2">⋯</div> <div class="diff-ellipsis text-muted px-2">⋯</div>
<?php endif; continue; ?> <?php endif;
continue; ?>
<?php else: $inEllipsis = false; endif; ?> <?php else: $inEllipsis = false; endif; ?>
<?php if ($op === '-'): ?> <?php if ($op === '-'): ?>
<div class="diff-del px-2">&nbsp;<?= htmlspecialchars($line) ?></div> <div class="diff-del px-2">&nbsp;<?= htmlspecialchars($line) ?></div>