common_find_attentions to populate activities from content text

This commit is contained in:
Mikael Nordfeldth 2016-01-07 23:23:37 +01:00
parent 3eebf2a353
commit 801ca3531b

View File

@ -681,6 +681,18 @@ function common_linkify_mention(array $mention)
return $output; 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. * Find @-mentions in the given text, using the given notice object as context.
* References will be resolved with common_relative_profile() against the user * References will be resolved with common_relative_profile() against the user