From b63f6e949cd4703b93bf667e08f110b26e895ba4 Mon Sep 17 00:00:00 2001 From: Mikael Nordfeldth Date: Wed, 2 Jul 2014 18:50:28 +0200 Subject: [PATCH] Converted all ActivityObject::fromProfile to $profile->asActivityObject --- classes/Group_member.php | 2 +- classes/Message.php | 2 +- classes/Notice.php | 2 +- classes/Subscription.php | 4 ++-- classes/User.php | 2 +- lib/activityobject.php | 5 ---- lib/atomusernoticefeed.php | 2 +- plugins/Activity/ActivityPlugin.php | 2 +- plugins/Favorite/classes/Fave.php | 2 +- plugins/OStatus/OStatusPlugin.php | 24 +++++++++---------- plugins/OStatus/classes/Ostatus_profile.php | 4 ++-- .../lib/offlinebackupqueuehandler.php | 2 +- 12 files changed, 24 insertions(+), 29 deletions(-) diff --git a/classes/Group_member.php b/classes/Group_member.php index 803f788835..14f417758d 100644 --- a/classes/Group_member.php +++ b/classes/Group_member.php @@ -168,7 +168,7 @@ class Group_member extends Managed_DataObject $act->id = $this->getURI(); - $act->actor = ActivityObject::fromProfile($member); + $act->actor = $member->asActivityObject(); $act->verb = ActivityVerb::JOIN; $act->objects[] = ActivityObject::fromGroup($group); diff --git a/classes/Message.php b/classes/Message.php index 211284ecec..bc25b1b0b3 100644 --- a/classes/Message.php +++ b/classes/Message.php @@ -183,7 +183,7 @@ class Message extends Managed_DataObject throw new Exception(sprintf("Sender profile not found: %d", $this->from_profile)); } - $act->actor = ActivityObject::fromProfile($profile); + $act->actor = $profile->asActivityObject(); $act->actor->extra[] = $profile->profileInfo(null); $act->verb = ActivityVerb::POST; diff --git a/classes/Notice.php b/classes/Notice.php index e71500145d..ebf874bffb 100644 --- a/classes/Notice.php +++ b/classes/Notice.php @@ -1782,7 +1782,7 @@ class Notice extends Managed_DataObject $profile = $this->getProfile(); - $act->actor = ActivityObject::fromProfile($profile); + $act->actor = $profile->asActivityObject(); $act->actor->extra[] = $profile->profileInfo($cur); $act->verb = $this->verb; diff --git a/classes/Subscription.php b/classes/Subscription.php index edee9950d8..4d7eb524dc 100644 --- a/classes/Subscription.php +++ b/classes/Subscription.php @@ -267,8 +267,8 @@ class Subscription extends Managed_DataObject $subscriber->getBestName(), $subscribed->getBestName()); - $act->actor = ActivityObject::fromProfile($subscriber); - $act->objects[] = ActivityObject::fromProfile($subscribed); + $act->actor = $subscriber->asActivityObject(); + $act->objects[] = $subscribed->asActivityObject(); $url = common_local_url('AtomPubShowSubscription', array('subscriber' => $subscriber->id, diff --git a/classes/User.php b/classes/User.php index c3ceb2646b..1c54affda7 100644 --- a/classes/User.php +++ b/classes/User.php @@ -990,7 +990,7 @@ class User extends Managed_DataObject $act = new Activity(); - $act->actor = ActivityObject::fromProfile($profile); + $act->actor = $profile->asActivityObject(); $act->verb = ActivityVerb::JOIN; $act->objects[] = $service; diff --git a/lib/activityobject.php b/lib/activityobject.php index bd525a68d0..b3940be824 100644 --- a/lib/activityobject.php +++ b/lib/activityobject.php @@ -457,11 +457,6 @@ class ActivityObject return $object; } - static function fromProfile(Profile $profile) - { - return $profile->asActivityObject(); - } - static function fromGroup(User_group $group) { $object = new ActivityObject(); diff --git a/lib/atomusernoticefeed.php b/lib/atomusernoticefeed.php index b899ecff4a..567045ee86 100644 --- a/lib/atomusernoticefeed.php +++ b/lib/atomusernoticefeed.php @@ -62,7 +62,7 @@ class AtomUserNoticeFeed extends AtomNoticeFeed $profile = $user->getProfile(); - $ao = ActivityObject::fromProfile($profile); + $ao = $profile->asActivityObject(); array_push($ao->extra, $profile->profileInfo($cur)); diff --git a/plugins/Activity/ActivityPlugin.php b/plugins/Activity/ActivityPlugin.php index 1b36e11fd4..ce6f114bfb 100644 --- a/plugins/Activity/ActivityPlugin.php +++ b/plugins/Activity/ActivityPlugin.php @@ -390,7 +390,7 @@ class ActivityPlugin extends Plugin if (!empty($sub)) { $profile = Profile::getKV('id', $sub->subscribed); if (!empty($profile)) { - $activity->objects = array(ActivityObject::fromProfile($profile)); + $activity->objects = array($profile->asActivityObject()); } } break; diff --git a/plugins/Favorite/classes/Fave.php b/plugins/Favorite/classes/Fave.php index 3ec5fadd7b..ceaa37022b 100644 --- a/plugins/Favorite/classes/Fave.php +++ b/plugins/Favorite/classes/Fave.php @@ -157,7 +157,7 @@ class Fave extends Managed_DataObject $profile->getBestName(), $notice->getUrl()); - $act->actor = ActivityObject::fromProfile($profile); + $act->actor = $profile->asActivityObject(); $act->objects[] = ActivityObject::fromNotice($notice); $url = common_local_url('AtomPubShowFavorite', diff --git a/plugins/OStatus/OStatusPlugin.php b/plugins/OStatus/OStatusPlugin.php index cebf5597d3..7b19e386e6 100644 --- a/plugins/OStatus/OStatusPlugin.php +++ b/plugins/OStatus/OStatusPlugin.php @@ -691,8 +691,8 @@ class OStatusPlugin extends Plugin $profile->getBestName(), $other->getBestName()); - $act->actor = ActivityObject::fromProfile($profile); - $act->object = ActivityObject::fromProfile($other); + $act->actor = $profile->asActivityObject(); + $act->object = $other->asActivityObject(); $oprofile->notifyActivity($act, $profile); @@ -728,7 +728,7 @@ class OStatusPlugin extends Plugin $group->id, common_date_iso8601(time())); - $act->actor = ActivityObject::fromProfile($profile); + $act->actor = $profile->asActivityObject(); $act->verb = ActivityVerb::JOIN; $act->object = $oprofile->asActivityObject(); @@ -782,7 +782,7 @@ class OStatusPlugin extends Plugin $group->id, common_date_iso8601(time())); - $act->actor = ActivityObject::fromProfile($member); + $act->actor = $member->asActivityObject(); $act->verb = ActivityVerb::LEAVE; $act->object = $oprofile->asActivityObject(); @@ -828,7 +828,7 @@ class OStatusPlugin extends Plugin $peopletag->id, common_date_iso8601(time())); - $act->actor = ActivityObject::fromProfile($sub); + $act->actor = $sub->asActivityObject(); $act->verb = ActivityVerb::FOLLOW; $act->object = $oprofile->asActivityObject(); @@ -880,7 +880,7 @@ class OStatusPlugin extends Plugin $peopletag->id, common_date_iso8601(time())); - $act->actor = ActivityObject::fromProfile($member); + $act->actor = $member->asActivityObject(); $act->verb = ActivityVerb::UNFOLLOW; $act->object = $oprofile->asActivityObject(); @@ -973,8 +973,8 @@ class OStatusPlugin extends Plugin $tagged->getBestName(), $plist->getBestName()); - $act->actor = ActivityObject::fromProfile($tagger); - $act->objects = array(ActivityObject::fromProfile($tagged)); + $act->actor = $tagger->asActivityObject(); + $act->objects = array($tagged->asActivityObject()); $act->target = ActivityObject::fromPeopletag($plist); $oprofile->notifyDeferred($act, $tagger); @@ -1024,8 +1024,8 @@ class OStatusPlugin extends Plugin $tagged->getBestName(), $plist->getBestName()); - $act->actor = ActivityObject::fromProfile($tagger); - $act->objects = array(ActivityObject::fromProfile($tagged)); + $act->actor = $tagger->asActivityObject(); + $act->objects = array($tagged->asActivityObject()); $act->target = ActivityObject::fromPeopletag($plist); $oprofile->notifyDeferred($act, $tagger); @@ -1073,7 +1073,7 @@ class OStatusPlugin extends Plugin $profile->getBestName(), $notice->getUrl()); - $act->actor = ActivityObject::fromProfile($profile); + $act->actor = $profile->asActivityObject(); $act->object = ActivityObject::fromNotice($notice); $oprofile->notifyActivity($act, $profile); @@ -1191,7 +1191,7 @@ class OStatusPlugin extends Plugin $act->content = sprintf(_m('%s has updated their profile page.'), $profile->getBestName()); - $act->actor = ActivityObject::fromProfile($profile); + $act->actor = $profile->asActivityObject(); $act->object = $act->actor; while ($oprofile->fetch()) { diff --git a/plugins/OStatus/classes/Ostatus_profile.php b/plugins/OStatus/classes/Ostatus_profile.php index 0629d73a75..e6db40c5a8 100644 --- a/plugins/OStatus/classes/Ostatus_profile.php +++ b/plugins/OStatus/classes/Ostatus_profile.php @@ -132,7 +132,7 @@ class Ostatus_profile extends Managed_DataObject } else if ($this->isPeopletag()) { return ActivityObject::fromPeopletag($this->localPeopletag()); } else { - return ActivityObject::fromProfile($this->localProfile()); + return $this->localProfile()->asActivityObject(); } } @@ -156,7 +156,7 @@ class Ostatus_profile extends Managed_DataObject $noun = ActivityObject::fromPeopletag($this->localPeopletag()); return $noun->asString('activity:' . $element); } else { - $noun = ActivityObject::fromProfile($this->localProfile()); + $noun = $this->localProfile()->asActivityObject(); return $noun->asString('activity:' . $element); } } diff --git a/plugins/OfflineBackup/lib/offlinebackupqueuehandler.php b/plugins/OfflineBackup/lib/offlinebackupqueuehandler.php index ba95912b3b..9f96193d95 100644 --- a/plugins/OfflineBackup/lib/offlinebackupqueuehandler.php +++ b/plugins/OfflineBackup/lib/offlinebackupqueuehandler.php @@ -294,7 +294,7 @@ class OfflineBackupQueueHandler extends QueueHandler $profile = $user->getProfile(); - $author = ActivityObject::fromProfile($profile); + $author = $profile->asActivityObject(); $xs = new XMLStringer(); $author->outputTo($xs, 'author'); -- 2.39.5