]> git.mxchange.org Git - friendica.git/commitdiff
Limit smilies replacement to BBCode::convert
authorHypolite Petovan <hypolite@mrpetovan.com>
Thu, 20 Jun 2019 19:00:33 +0000 (15:00 -0400)
committerHypolite Petovan <hypolite@mrpetovan.com>
Sun, 23 Jun 2019 21:53:25 +0000 (17:53 -0400)
include/text.php
mod/message.php
src/Content/Text/BBCode.php

index e4227cd7d09f57632043bae8dda3cf4282c71450..052bdc4c3c3f76edc43de78f96436eea4ad3084d 100644 (file)
@@ -143,13 +143,9 @@ function redir_private_images($a, &$item)
  * @return string Formattet HTML.
  * @throws \Friendica\Network\HTTPException\InternalServerErrorException
  */
-function prepare_text($text) {
-       if (stristr($text, '[nosmile]')) {
-               $s = BBCode::convert($text);
-       } else {
-               $s = Smilies::replace(BBCode::convert($text));
-       }
-
+function prepare_text($text)
+{
+       $s = BBCode::convert($text);
        return trim($s);
 }
 
index 3ff84a1e6684478b2200d2c552451aad2d2401c3..fe4429e0008b8bf8741d5edde312e52e03be1015 100644 (file)
@@ -384,7 +384,7 @@ function message_content(App $a)
 
                        $from_name_e = $message['from-name'];
                        $subject_e = $message['title'];
-                       $body_e = Smilies::replace(BBCode::convert($message['body']));
+                       $body_e = BBCode::convert($message['body']);
                        $to_name_e = $message['name'];
 
                        $contact = Contact::getDetailsByURL($message['from-url']);
index e08d60579dde09d3f9a710d469868729ba0b386a..da09e13dd9b8dfc5a243a9480d4b3de5b9207186 100644 (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);
                }