]> git.mxchange.org Git - friendica.git/blobdiff - src/Protocol/ActivityPub/Processor.php
Merge pull request #9262 from nupplaphil/phpmailer_fix
[friendica.git] / src / Protocol / ActivityPub / Processor.php
index c94a82a9ea8486cd6243a1f6b18b5ffe507f6bde..95eecabca215af7c42e7158df1815e4e0f33750a 100644 (file)
@@ -43,6 +43,7 @@ use Friendica\Protocol\ActivityPub;
 use Friendica\Util\DateTimeFormat;
 use Friendica\Util\JsonLD;
 use Friendica\Util\Strings;
+use Text_LanguageDetect;
 
 /**
  * ActivityPub Processor Protocol class
@@ -845,7 +846,7 @@ class Processor
                        }
                }
 
-               $content = mb_strtolower(JsonLD::fetchElement($activity['as:object'], 'as:content', '@value'));
+               $content = mb_strtolower(BBCode::toPlaintext(HTML::toBBCode(JsonLD::fetchElement($activity['as:object'], 'as:content', '@value')), false));
 
                $tagList = array_unique(array_merge($systemTags, $userTags));
                foreach ($messageTags as $tag) {
@@ -855,7 +856,7 @@ class Processor
                        }
                        // We check with "strpos" for performance issues. Only when this is true, the regular expression check is used
                        // RegExp is taken from here: https://medium.com/@shiba1014/regex-word-boundaries-with-unicode-207794f6e7ed
-                       if ((strpos($content, $tag) !== false) && preg_match('/(?<=[\s,.:;"\']|^)' . $tag . '(?=[\s,.:;"\']|$)/', $content)) {
+                       if ((strpos($content, $tag) !== false) && preg_match('/(?<=[\s,.:;"\']|^)' . preg_quote($tag, '/') . '(?=[\s,.:;"\']|$)/', $content)) {
                                Logger::info('Subscribed hashtag found in content - accepted', ['id' => $id, 'hashtag' => $tag]);
                                return true;
                        }