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

@ -13,7 +13,7 @@
- Some enhancements [\#1445](https://github.com/torrentpier/torrentpier/pull/1445) ([belomaxorka](https://github.com/belomaxorka))
- Guests can view polls [\#1464](https://github.com/torrentpier/torrentpier/pull/1464) ([belomaxorka](https://github.com/belomaxorka))
- Improved app debug [\#1438](https://github.com/torrentpier/torrentpier/pull/1438) ([belomaxorka](https://github.com/belomaxorka))
- Some enhancements for flags [\#1470](https://github.com/torrentpier/torrentpier/pull/1470) ([belomaxorka](https://github.com/belomaxorka))
- Some enhancements for flags [\#1470](https://github.com/torrentpier/torrentpier/pull/1470), [\#1471](https://github.com/torrentpier/torrentpier/pull/1471) ([belomaxorka](https://github.com/belomaxorka))
- Fixed quote selection for smiles [\#1457](https://github.com/torrentpier/torrentpier/pull/1457) ([belomaxorka](https://github.com/belomaxorka))
- Demo mode: Allow registering torrents by default [\#1440](https://github.com/torrentpier/torrentpier/pull/1440) ([belomaxorka](https://github.com/belomaxorka))
- Temp: Removed showing forum description in `viewforum.php` [\#1465](https://github.com/torrentpier/torrentpier/pull/1465) ([belomaxorka](https://github.com/belomaxorka))

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;
}
}
}

View file

@ -673,7 +673,7 @@ for ($i = 0; $i < $total_posts; $i++) {
'POSTER_JOINED_DATE' => $poster_joined,
'POSTER_POSTS' => ($bb_cfg['show_poster_posts'] && $poster_posts) ? '<a href="search.php?search_author=1&amp;uid=' . $poster_id . '" target="_blank">' . $poster_posts . '</a>' : '',
'POSTER_FROM' => $bb_cfg['show_poster_from'] ? render_flag($poster_from) : '',
'POSTER_FROM' => $bb_cfg['show_poster_from'] ? render_flag($poster_from, false) : '',
'POSTER_BOT' => $poster_bot,
'POSTER_GUEST' => $poster_guest,
'POSTER_ID' => $poster_id,