// TRANS: Text for "started following" item in activity plugin.
// TRANS: %1$s is a profile URL, %2$s is a profile name,
// TRANS: %3$s is a profile URL, %4$s is a profile name.
- $rendered = sprintf(_m('<a href="%1$s">%2$s</a> started following <a href="%3$s">%4$s</a>.'),
+ $rendered = html_sprintf(_m('<a href="%1$s">%2$s</a> started following <a href="%3$s">%4$s</a>.'),
$profile->getUrl(),
$profile->getBestName(),
$other->getUrl(),
// TRANS: Text for "stopped following" item in activity plugin.
// TRANS: %1$s is a profile URL, %2$s is a profile name,
// TRANS: %3$s is a profile URL, %4$s is a profile name.
- $rendered = sprintf(_m('<a href="%1$s">%2$s</a> stopped following <a href="%3$s">%4$s</a>.'),
+ $rendered = html_sprintf(_m('<a href="%1$s">%2$s</a> stopped following <a href="%3$s">%4$s</a>.'),
$profile->getUrl(),
$profile->getBestName(),
$other->getUrl(),
// TRANS: Text for "stopped liking" item in activity plugin.
// TRANS: %1$s is a profile URL, %2$s is a profile name,
// TRANS: %3$s is a notice URL, %4$s is an author name.
- $rendered = sprintf(_m('<a href="%1$s">%2$s</a> stopped liking <a href="%3$s">%4$s\'s update</a>.'),
+ $rendered = html_sprintf(_m('<a href="%1$s">%2$s</a> stopped liking <a href="%3$s">%4$s\'s update</a>.'),
$profile->getUrl(),
$profile->getBestName(),
$notice->getUrl(),
'uri' => $uri,
'verb' => ActivityVerb::UNFAVORITE,
'object_type' => (($notice->verb == ActivityVerb::POST) ?
- $notice->object_type : ActivityObject::ACTIVITY)));
+ $notice->object_type : null)));
return true;
}
// TRANS: Text for "joined group" item in activity plugin.
// TRANS: %1$s is a profile URL, %2$s is a profile name,
// TRANS: %3$s is a group URL, %4$s is a group name.
- $rendered = sprintf(_m('<a href="%1$s">%2$s</a> joined the group <a href="%3$s">%4$s</a>.'),
+ $rendered = html_sprintf(_m('<a href="%1$s">%2$s</a> joined the group <a href="%3$s">%4$s</a>.'),
$profile->getUrl(),
$profile->getBestName(),
$group->homeUrl(),
// TRANS: Text for "left group" item in activity plugin.
// TRANS: %1$s is a profile URL, %2$s is a profile name,
// TRANS: %3$s is a group URL, %4$s is a group name.
- $rendered = sprintf(_m('<a href="%1$s">%2$s</a> left the group <a href="%3$s">%4$s</a>.'),
+ $rendered = html_sprintf(_m('<a href="%1$s">%2$s</a> left the group <a href="%3$s">%4$s</a>.'),
$profile->getUrl(),
$profile->getBestName(),
$group->homeUrl(),
return true;
}
- function onStartShowNoticeItem($nli)
+ function onStartShowNoticeItem(NoticeListItem $nli)
{
$notice = $nli->notice;
$adapter = null;
switch ($notice->verb) {
- case ActivityVerb::FAVORITE:
- case ActivityVerb::UNFAVORITE:
- $adapter = new SystemListItem($nli);
- break;
case ActivityVerb::JOIN:
$adapter = new JoinListItem($nli);
break;
case ActivityVerb::LEAVE:
- $adapter = new JoinListItem($nli);
+ $adapter = new LeaveListItem($nli);
break;
case ActivityVerb::FOLLOW:
$adapter = new FollowListItem($nli);
public function onEndNoticeAsActivity(Notice $stored, Activity $act, Profile $scoped=null)
{
switch ($stored->verb) {
- case ActivityVerb::FAVORITE:
- $fave = Fave::getKV('uri', $stored->uri);
- if (!empty($fave)) {
- $stored = Notice::getKV('id', $fave->notice_id);
- if (!empty($stored)) {
- $target = $stored->asActivity($scoped);
- if ($target->verb == ActivityVerb::POST) {
- // "I like the thing you posted"
- $act->objects = $target->objects;
- } else {
- // "I like that you did whatever you did"
- $act->objects = array($target);
- }
- }
- }
- break;
case ActivityVerb::UNFAVORITE:
// FIXME: do something here
break;
case ActivityVerb::JOIN:
- $mem = Group_member::getKV('uri', $stored->uri);
- if (!empty($mem)) {
+ $mem = Group_member::getKV('uri', $stored->getUri());
+ if ($mem instanceof Group_member) {
$group = $mem->getGroup();
+ $act->title = $stored->getTitle();
$act->objects = array(ActivityObject::fromGroup($group));
}
break;
break;
case ActivityVerb::FOLLOW:
$sub = Subscription::getKV('uri', $stored->uri);
- if (!empty($sub)) {
+ if ($sub instanceof Subscription) {
$profile = Profile::getKV('id', $sub->subscribed);
- if (!empty($profile)) {
+ if ($profile instanceof Profile) {
+ $act->title = $stored->getTitle();
$act->objects = array($profile->asActivityObject());
}
}
return true;
}
- function onPluginVersion(&$versions)
+ function onPluginVersion(array &$versions)
{
$versions[] = array('name' => 'Activity',
'version' => self::VERSION,