Do not name anything getOriginal (because DB_DataObject calls that)

Avatar->getOriginal has been renamed getUploaded
Notice->getOriginal has been renamed getParent
This commit is contained in:
Mikael Nordfeldth 2013-10-02 15:01:11 +02:00
parent 7979918ba9
commit 39f43e415d
7 changed files with 18 additions and 18 deletions

View File

@ -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);

View File

@ -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'));

View File

@ -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) {

View File

@ -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);

View File

@ -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);
}

View File

@ -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

View File

@ -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.');