Merge pull request #8654 from annando/annando/issue8458

Issue 8458: Display big emojis
This commit is contained in:
Hypolite Petovan 2020-05-17 14:00:23 -04:00 committed by GitHub
commit 78793894fc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 16 additions and 1 deletions

View File

@ -1724,7 +1724,15 @@ class BBCode
// Replace non graphical smilies for external posts
if (!$nosmile && !$for_plaintext) {
$text = Smilies::replace($text);
$oldtext = $text;
$text = Smilies::replace($text);
if (DI::config()->get('system', 'big_emojis') && ($simple_html != self::DIASPORA) && ($oldtext != $text)) {
$conv = html_entity_decode(str_replace([' ', "\n", "\r"], '', $text));
// Emojis are always 4 byte Unicode characters
if (strlen($conv) / mb_strlen($conv) == 4) {
$text = '<span style="font-size: xx-large; line-height: initial;">' . $text . '</span>';
}
}
}
if (!$for_plaintext) {

View File

@ -103,6 +103,10 @@ return [
// chose "Remember me" when logging in is considered logged out.
'auth_cookie_lifetime' => 7,
// big_emojis (Boolean)
// Display "Emoji Only" posts in big.
'big_emojis' => false,
// block_local_dir (Boolean)
// Deny public access to the local user directory.
'block_local_dir' => false,

View File

@ -58,6 +58,9 @@ class BBCodeTest extends MockedTest
$this->configMock->shouldReceive('get')
->with('system', 'no_smilies')
->andReturn(false);
$this->configMock->shouldReceive('get')
->with('system', 'big_emojis')
->andReturn(false);
$l10nMock = \Mockery::mock(L10n::class);
$l10nMock->shouldReceive('t')->withAnyArgs()->andReturnUsing(function ($args) { return $args; });