]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - lib/util.php
Don't trust local HTML either
[quix0rs-gnu-social.git] / lib / util.php
index 30ad757f75fcb2f1f9fffb86a62f62f169c91d9d..7ebbf42cf601f58feed5b75ed3af1e3f3486ece1 100644 (file)
@@ -681,6 +681,23 @@ function common_linkify_mention(array $mention)
     return $output;
 }
 
+function common_get_attentions($text, Profile $sender, Notice $parent=null)
+{
+    $mentions = common_find_mentions($text, $sender, $parent);
+    $atts = array();
+    foreach ($mentions as $mention) {
+        foreach ($mention['mentioned'] as $mentioned) {
+            $atts[$mentioned->getUri()] = $mentioned->getObjectType();
+        }
+    }
+    if ($parent instanceof Notice) {
+        $parentAuthor = $parent->getProfile();
+        // afaik groups can't be authors
+        $atts[$parentAuthor->getUri()] = ActivityObject::PERSON;
+    }
+    return $atts;
+}
+
 /**
  * Find @-mentions in the given text, using the given notice object as context.
  * References will be resolved with common_relative_profile() against the user