Update functions.php

This commit is contained in:
slawkens
2025-10-15 15:50:25 +02:00
parent 38902c30d1
commit 12e40b2592

View File

@@ -1640,13 +1640,14 @@ function camelCaseToUnderscore($input)
return ltrim(strtolower(preg_replace('/[A-Z]([A-Z](?![a-z]))*/', '_$0', $input)), '_'); return ltrim(strtolower(preg_replace('/[A-Z]([A-Z](?![a-z]))*/', '_$0', $input)), '_');
} }
function removeIfFirstSlash(&$text) { function removeIfFirstSlash(&$text): void
{
if(strpos($text, '/') === 0) { if(strpos($text, '/') === 0) {
$text = str_replace_first('/', '', $text); $text = str_replace_first('/', '', $text);
} }
}; };
function escapeHtml($html) { function escapeHtml($html): string {
return htmlspecialchars($html); return htmlspecialchars($html);
} }
@@ -1660,7 +1661,7 @@ function getGuildNameById($id)
return false; return false;
} }
function getGuildLogoById($id) function getGuildLogoById($id): string
{ {
$logo = 'default.gif'; $logo = 'default.gif';
@@ -1676,7 +1677,8 @@ function getGuildLogoById($id)
return BASE_URL . GUILD_IMAGES_DIR . $logo; return BASE_URL . GUILD_IMAGES_DIR . $logo;
} }
function displayErrorBoxWithBackButton($errors, $action = null) { function displayErrorBoxWithBackButton($errors, $action = null): void
{
global $twig; global $twig;
$twig->display('error_box.html.twig', ['errors' => $errors]); $twig->display('error_box.html.twig', ['errors' => $errors]);
$twig->display('account.back_button.html.twig', [ $twig->display('account.back_button.html.twig', [