From: Mikael Nordfeldth Date: Thu, 7 Jan 2016 22:23:37 +0000 (+0100) Subject: common_find_attentions to populate activities from content text X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=801ca3531b26f7994728b8a4017884550e87a66b;p=quix0rs-gnu-social.git common_find_attentions to populate activities from content text --- diff --git a/lib/util.php b/lib/util.php index 30ad757f75..62cd13af4a 100644 --- a/lib/util.php +++ b/lib/util.php @@ -681,6 +681,18 @@ function common_linkify_mention(array $mention) return $output; } +function common_find_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->isGroup() ? ActivityObject::GROUP : 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