Some enhancements for flags (#1471)

* Some enhancements for flags

* Update CHANGELOG.md
This commit is contained in:
Roman Kelesidis 2024-05-06 00:03:52 +07:00 committed by GitHub
commit 08fb1e3f7c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 6 additions and 4 deletions

View file

@ -1186,9 +1186,10 @@ function get_user_torrent_client(string $peer_id): string
* Returns country flag by country code
*
* @param string $code
* @param bool $showName
* @return string
*/
function render_flag(string $code): string
function render_flag(string $code, bool $showName = true): string
{
global $lang;
static $iconExtension = '.svg';
@ -1199,7 +1200,8 @@ function render_flag(string $code): string
} else {
$flagIconPath = BB_ROOT . 'styles/images/flags/' . $code . $iconExtension;
if (is_file($flagIconPath)) {
return '<img src="' . $flagIconPath . '" class="poster-flag" alt="' . $code . '" title="' . $lang['COUNTRIES'][$code] . '">';
$countryName = $showName ? str_short($lang['COUNTRIES'][$code], 20) : '';
return '<img src="' . $flagIconPath . '" class="poster-flag" alt="' . $code . '" title="' . $lang['COUNTRIES'][$code] . '">' . $countryName;
}
}
}