Merge pull request #7296 from MrPetovan/task/smilies-replace

Limit smilies replacement to BBCode::convert
This commit is contained in:
Michael Vogel 2019-06-24 22:05:37 +02:00 committed by GitHub
commit 26accbe3ef
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 13 additions and 12 deletions

View file

@ -267,17 +267,18 @@ class Smilies
* @return string HTML Output
*
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @todo : Rework because it doesn't work correctly
*/
private static function pregHeart($x)
{
if (strlen($x[1]) == 1) {
return $x[0];
}
$t = '';
for ($cnt = 0; $cnt < strlen($x[1]); $cnt ++) {
$t .= '<img class="smiley" src="' . System::baseUrl() . '/images/smiley-heart.gif" alt="&lt;3" />';
$t .= '';
}
$r = str_replace($x[0], $t, $x[0]);
return $r;
}

View file

@ -1395,6 +1395,7 @@ class BBCode extends BaseObject
// This is actually executed in Item::prepareBody()
$nosmile = strpos($text, '[nosmile]') !== false;
$text = str_replace('[nosmile]', '', $text);
// Check for font change text
@ -1572,7 +1573,7 @@ class BBCode extends BaseObject
}
// Replace non graphical smilies for external posts
if ($simple_html) {
if (!$nosmile && !$for_plaintext) {
$text = Smilies::replace($text);
}