mirror of
https://github.com/torrentpier/torrentpier
synced 2025-08-20 21:33:54 -07:00
Some enhancements for flags (#1471)
* Some enhancements for flags * Update CHANGELOG.md
This commit is contained in:
parent
b80fa8857d
commit
08fb1e3f7c
3 changed files with 6 additions and 4 deletions
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue