Adds option to not sanitize messages

main
Yasen Pramatarov 2025-01-15 18:22:49 +02:00
parent 0cf4795fc7
commit 378ecb8a14
2 changed files with 3 additions and 3 deletions

View File

@ -125,7 +125,7 @@ class Messages {
* Render message HTML * Render message HTML
*/ */
// Usage: echo Messages::render('LOGIN', 'LOGIN_SUCCESS', 'custom message [or null]', true [for dismissible; or null], true [for small; or omit]); // Usage: echo Messages::render('LOGIN', 'LOGIN_SUCCESS', 'custom message [or null]', true [for dismissible; or null], true [for small; or omit]);
public static function render($category, $key, $customMessage = null, $dismissible = null, $small = false) { public static function render($category, $key, $customMessage = null, $dismissible = null, $small = false, $sanitize = true) {
$config = self::get($category, $key); $config = self::get($category, $key);
if (!$config) return ''; if (!$config) return '';
@ -140,7 +140,7 @@ class Messages {
$config['type'], $config['type'],
$dismissClass, $dismissClass,
$smallClass, $smallClass,
htmlspecialchars($message), $sanitize ? htmlspecialchars($message) : $message,
$dismissButton $dismissButton
); );
} }

View File

@ -95,7 +95,7 @@ try {
// Show configured login message if any // Show configured login message if any
if (!empty($config['login_message'])) { if (!empty($config['login_message'])) {
echo Messages::render('NOTICE', 'DEFAULT', $config['login_message'], false); echo Messages::render('NOTICE', 'DEFAULT', $config['login_message'], false, false, false);
} }
// Get any new messages // Get any new messages