Poprawki API i panelu admina

This commit is contained in:
2026-05-29 16:27:23 +02:00
parent 583021915a
commit 9b15131461
12 changed files with 390 additions and 58 deletions

View File

@@ -0,0 +1,20 @@
<?php
/**
* Normalizuje komunikat kolejki do zwykłego tekstu (wiersze = \n w JSON).
* Starsze wpisy HTML (<br>, tagi) są konwertowane na plain text.
*/
function normalizeQueueMessageText(string $text): string
{
$text = trim($text);
if ($text === '') {
return '';
}
$text = preg_replace('/<br\s*\/?>/i', "\n", $text) ?? $text;
$text = html_entity_decode(strip_tags($text), ENT_QUOTES | ENT_HTML5, 'UTF-8');
$text = str_replace(["\r\n", "\r"], "\n", $text);
$text = preg_replace("/\n{3,}/", "\n\n", $text) ?? $text;
return trim($text);
}