misc(render_flag): Hide names for specified ($nameIgnoreList) flags (#1862)

This commit is contained in:
Roman Kelesidis 2025-03-22 16:19:29 +07:00 committed by GitHub
commit 83e42bc5db
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1184,14 +1184,21 @@ function render_flag(string $code, bool $showName = true): string
global $lang;
static $iconExtension = '.svg';
$nameIgnoreList = [
'WBW',
'PACE',
'LGBT'
];
if (isset($lang['COUNTRIES'][$code])) {
if ($code === '0') {
return ''; // No selected
} else {
$flagIconPath = BB_ROOT . 'styles/images/flags/' . $code . $iconExtension;
if (is_file($flagIconPath)) {
$countryName = $showName ? ' ' . str_short($lang['COUNTRIES'][$code], 20) : '';
return '<span title="' . $lang['COUNTRIES'][$code] . '"><img src="' . $flagIconPath . '" class="poster-flag" alt="' . $code . '">' . $countryName . '</span>';
$langName = $lang['COUNTRIES'][$code];
$countryName = ($showName && !in_array($code, $nameIgnoreList)) ? '&nbsp;' . str_short($langName, 20) : '';
return '<span title="' . $langName . '"><img src="' . $flagIconPath . '" class="poster-flag" alt="' . $code . '">' . $countryName . '</span>';
}
}
}