From 39f43e415d772dce9bcfcf30db25ddd59b3cc727 Mon Sep 17 00:00:00 2001 From: Mikael Nordfeldth Date: Wed, 2 Oct 2013 15:01:11 +0200 Subject: [PATCH] Do not name anything getOriginal (because DB_DataObject calls that) Avatar->getOriginal has been renamed getUploaded Notice->getOriginal has been renamed getParent --- actions/avatarbynickname.php | 2 +- actions/avatarsettings.php | 2 +- actions/foaf.php | 2 +- classes/Avatar.php | 8 ++++---- classes/Notice.php | 18 +++++++++--------- lib/activityobject.php | 2 +- plugins/TwitterBridge/lib/twitterimport.php | 2 +- 7 files changed, 18 insertions(+), 18 deletions(-) diff --git a/actions/avatarbynickname.php b/actions/avatarbynickname.php index dc80ec952e..0922bd47ec 100644 --- a/actions/avatarbynickname.php +++ b/actions/avatarbynickname.php @@ -73,7 +73,7 @@ class AvatarbynicknameAction extends Action if ($size === 'original') { try { - $avatar = Avatar::getOriginal($profile); + $avatar = Avatar::getUploaded($profile); $url = $avatar->displayUrl(); } catch (Exception $e) { $url = Avatar::defaultImage(AVATAR_PROFILE_SIZE); diff --git a/actions/avatarsettings.php b/actions/avatarsettings.php index 401c78a0f5..bc671c621b 100644 --- a/actions/avatarsettings.php +++ b/actions/avatarsettings.php @@ -123,7 +123,7 @@ class AvatarsettingsAction extends SettingsAction if (Event::handle('StartAvatarFormData', array($this))) { $this->elementStart('ul', 'form_data'); try { - $original = Avatar::getOriginal($profile); + $original = Avatar::getUploaded($profile); $this->elementStart('li', array('id' => 'avatar_original', 'class' => 'avatar_view')); diff --git a/actions/foaf.php b/actions/foaf.php index 94ada859d9..9bb1df61c6 100644 --- a/actions/foaf.php +++ b/actions/foaf.php @@ -142,7 +142,7 @@ class FoafAction extends Action } try { - $avatar = Avatar::getOriginal($this->profile); + $avatar = Avatar::getUploaded($this->profile); $this->elementStart('img'); $this->elementStart('Image', array('rdf:about' => $avatar->displayUrl())); foreach (array(AVATAR_PROFILE_SIZE, AVATAR_STREAM_SIZE, AVATAR_MINI_SIZE) as $size) { diff --git a/classes/Avatar.php b/classes/Avatar.php index 9c5d97ebbf..d498df56d2 100644 --- a/classes/Avatar.php +++ b/classes/Avatar.php @@ -81,7 +81,7 @@ class Avatar extends Managed_DataObject return true; } - public static function getOriginal(Profile $target) + public static function getUploaded(Profile $target) { $avatar = new Avatar(); $avatar->profile_id = $target->id; @@ -92,9 +92,9 @@ class Avatar extends Managed_DataObject return $avatar; } - public static function hasOriginal(Profile $profile) { + public static function hasUploaded(Profile $profile) { try { - $avatar = Avatar::getOriginal($profile); + $avatar = Avatar::getUploaded($profile); } catch (NoResultException $e) { return false; } @@ -192,7 +192,7 @@ class Avatar extends Managed_DataObject throw new Exception(_m('Avatar size too large')); } - $original = Avatar::getOriginal($target); + $original = Avatar::getUploaded($target); $imagefile = new ImageFile($target->id, Avatar::path($original->filename)); $filename = $imagefile->resize($size); diff --git a/classes/Notice.php b/classes/Notice.php index f6b9587c87..f10146300c 100644 --- a/classes/Notice.php +++ b/classes/Notice.php @@ -924,7 +924,7 @@ class Notice extends Managed_DataObject $last = $this; do { - $parent = $last->getOriginal(); + $parent = $last->getParent(); if (!empty($parent) && $parent->inScope($profile)) { $last = $parent; continue; @@ -1304,7 +1304,7 @@ class Notice extends Managed_DataObject // If it's a reply, save for the replied-to author if (!empty($this->reply_to)) { - $original = $this->getOriginal(); + $original = $this->getParent(); if (!empty($original)) { // that'd be weird $author = $original->getProfile(); if (!empty($author)) { @@ -2528,18 +2528,18 @@ class Notice extends Managed_DataObject return $groups; } - protected $_original = -1; + protected $_parent = -1; - function getOriginal() + public function getParent() { - if (is_int($this->_original) && $this->_original == -1) { + if (is_int($this->_parent) && $this->_parent == -1) { if (empty($this->reply_to)) { - $this->_original = null; + $this->_parent = null; } else { - $this->_original = Notice::getKV('id', $this->reply_to); + $this->_parent = Notice::getKV('id', $this->reply_to); } } - return $this->_original; + return $this->_parent; } /** @@ -2555,7 +2555,7 @@ class Notice extends Managed_DataObject function __sleep() { $vars = parent::__sleep(); - $skip = array('_original', '_profile', '_groups', '_attachments', '_faves', '_replies', '_repeats'); + $skip = array('_parent', '_profile', '_groups', '_attachments', '_faves', '_replies', '_repeats'); return array_diff($vars, $skip); } diff --git a/lib/activityobject.php b/lib/activityobject.php index b45a8e6e78..a4fa62fb96 100644 --- a/lib/activityobject.php +++ b/lib/activityobject.php @@ -460,7 +460,7 @@ class ActivityObject $object->link = $profile->profileurl; try { - $orig = Avatar::getOriginal($profile); + $orig = Avatar::getUploaded($profile); $object->avatarLinks[] = AvatarLink::fromAvatar($orig); } catch (Exception $e) { // Could not find an original avatar to link diff --git a/plugins/TwitterBridge/lib/twitterimport.php b/plugins/TwitterBridge/lib/twitterimport.php index 780fa8f926..4d6bdc0de6 100644 --- a/plugins/TwitterBridge/lib/twitterimport.php +++ b/plugins/TwitterBridge/lib/twitterimport.php @@ -358,7 +358,7 @@ class TwitterImport $this->updateAvatars($twitter_user, $profile); } - if (Avatar::hasOriginal($profile)) { + if (Avatar::hasUploaded($profile)) { common_debug($this->name() . ' - Twitter user ' . $profile->nickname . ' is missing one or more local avatars.');