From 343cd6f20577c44487eae4e90ec10bfd954980e3 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Fri, 6 Feb 2009 03:13:08 -0500 Subject: Move common_avatar_* functions to Avatar Moved the common_avatar_* functions to the Avatar class. Typically either as methods on the object or as static methods. Replaced all the uses of the functions in other modules. --- actions/avatarbynickname.php | 4 ++-- actions/avatarsettings.php | 8 ++++---- actions/grouplogo.php | 8 ++++---- actions/noticesearch.php | 2 +- actions/showstream.php | 2 +- actions/tagother.php | 2 +- actions/twittersettings.php | 4 ++-- 7 files changed, 15 insertions(+), 15 deletions(-) (limited to 'actions') diff --git a/actions/avatarbynickname.php b/actions/avatarbynickname.php index 9bbdecefa..ca58c9653 100644 --- a/actions/avatarbynickname.php +++ b/actions/avatarbynickname.php @@ -90,9 +90,9 @@ class AvatarbynicknameAction extends Action $url = $avatar->url; } else { if ($size == 'original') { - $url = common_default_avatar(AVATAR_PROFILE_SIZE); + $url = Avatar::defaultImage(AVATAR_PROFILE_SIZE); } else { - $url = common_default_avatar($size+0); + $url = Avatar::defaultImage($size+0); } } common_redirect($url, 302); diff --git a/actions/avatarsettings.php b/actions/avatarsettings.php index 3f50ca24c..a0be5d8f8 100644 --- a/actions/avatarsettings.php +++ b/actions/avatarsettings.php @@ -200,7 +200,7 @@ class AvatarsettingsAction extends AccountSettingsAction 'class' => 'avatar_view')); $this->element('h2', null, _("Original")); $this->elementStart('div', array('id'=>'avatar_original_view')); - $this->element('img', array('src' => common_avatar_url($this->filedata['filename']), + $this->element('img', array('src' => Avatar::url($this->filedata['filename']), 'width' => $this->filedata['width'], 'height' => $this->filedata['height'], 'alt' => $user->nickname)); @@ -212,7 +212,7 @@ class AvatarsettingsAction extends AccountSettingsAction 'class' => 'avatar_view')); $this->element('h2', null, _("Preview")); $this->elementStart('div', array('id'=>'avatar_preview_view')); - $this->element('img', array('src' => common_avatar_url($this->filedata['filename']), + $this->element('img', array('src' => Avatar::url($this->filedata['filename']), 'width' => AVATAR_PROFILE_SIZE, 'height' => AVATAR_PROFILE_SIZE, 'alt' => $user->nickname)); @@ -281,12 +281,12 @@ class AvatarsettingsAction extends AccountSettingsAction $cur = common_current_user(); - $filename = common_avatar_filename($cur->id, + $filename = Avatar::filename($cur->id, image_type_to_extension($imagefile->type), null, 'tmp'.common_timestamp()); - $filepath = common_avatar_path($filename); + $filepath = Avatar::path($filename); move_uploaded_file($imagefile->filepath, $filepath); diff --git a/actions/grouplogo.php b/actions/grouplogo.php index 7cf198dc7..650c95255 100644 --- a/actions/grouplogo.php +++ b/actions/grouplogo.php @@ -263,7 +263,7 @@ class GrouplogoAction extends Action 'class' => 'avatar_view')); $this->element('h2', null, _("Original")); $this->elementStart('div', array('id'=>'avatar_original_view')); - $this->element('img', array('src' => common_avatar_url($this->filedata['filename']), + $this->element('img', array('src' => Avatar::url($this->filedata['filename']), 'width' => $this->filedata['width'], 'height' => $this->filedata['height'], 'alt' => $this->group->nickname)); @@ -275,7 +275,7 @@ class GrouplogoAction extends Action 'class' => 'avatar_view')); $this->element('h2', null, _("Preview")); $this->elementStart('div', array('id'=>'avatar_preview_view')); - $this->element('img', array('src' => common_avatar_url($this->filedata['filename']), + $this->element('img', array('src' => Avatar::url($this->filedata['filename']), 'width' => AVATAR_PROFILE_SIZE, 'height' => AVATAR_PROFILE_SIZE, 'alt' => $this->group->nickname)); @@ -343,12 +343,12 @@ class GrouplogoAction extends Action return; } - $filename = common_avatar_filename($this->group->id, + $filename = Avatar::filename($this->group->id, image_type_to_extension($imagefile->type), null, 'group-temp-'.common_timestamp()); - $filepath = common_avatar_path($filename); + $filepath = Avatar::path($filename); move_uploaded_file($imagefile->filepath, $filepath); diff --git a/actions/noticesearch.php b/actions/noticesearch.php index c0c238120..a5f01350c 100644 --- a/actions/noticesearch.php +++ b/actions/noticesearch.php @@ -166,7 +166,7 @@ class NoticesearchAction extends SearchAction $avatar = $profile->getAvatar(AVATAR_STREAM_SIZE); $this->elementStart('a', array('href' => $profile->profileurl, 'class' => 'url')); - $this->element('img', array('src' => ($avatar) ? common_avatar_display_url($avatar) : common_default_avatar(AVATAR_STREAM_SIZE), + $this->element('img', array('src' => ($avatar) ? $avatar->displayUrl() : Avatar::defaultImage(AVATAR_STREAM_SIZE), 'class' => 'avatar photo', 'width' => AVATAR_STREAM_SIZE, 'height' => AVATAR_STREAM_SIZE, diff --git a/actions/showstream.php b/actions/showstream.php index 224bbce9f..28bb8453f 100644 --- a/actions/showstream.php +++ b/actions/showstream.php @@ -242,7 +242,7 @@ class ShowstreamAction extends Action $this->elementStart('dl', 'entity_depiction'); $this->element('dt', null, _('Photo')); $this->elementStart('dd'); - $this->element('img', array('src' => ($avatar) ? common_avatar_display_url($avatar) : common_default_avatar(AVATAR_PROFILE_SIZE), + $this->element('img', array('src' => ($avatar) ? $avatar->displayUrl() : Avatar::defaultImage(AVATAR_PROFILE_SIZE), 'class' => 'photo avatar', 'width' => AVATAR_PROFILE_SIZE, 'height' => AVATAR_PROFILE_SIZE, diff --git a/actions/tagother.php b/actions/tagother.php index cbace5b6b..3e8a12fd6 100644 --- a/actions/tagother.php +++ b/actions/tagother.php @@ -80,7 +80,7 @@ class TagotherAction extends Action $this->elementStart('dl', 'entity_depiction'); $this->element('dt', null, _('Photo')); $this->elementStart('dd'); - $this->element('img', array('src' => ($avatar) ? common_avatar_display_url($avatar) : common_default_avatar(AVATAR_PROFILE_SIZE), + $this->element('img', array('src' => ($avatar) ? $avatar->displayUrl() : Avatar::defaultImage(AVATAR_PROFILE_SIZE), 'class' => 'photo avatar', 'width' => AVATAR_PROFILE_SIZE, 'height' => AVATAR_PROFILE_SIZE, diff --git a/actions/twittersettings.php b/actions/twittersettings.php index b3bf67dc3..2d41469bb 100644 --- a/actions/twittersettings.php +++ b/actions/twittersettings.php @@ -250,8 +250,8 @@ class TwittersettingsAction extends ConnectSettingsAction $avatar = $other->getAvatar(AVATAR_MINI_SIZE); $avatar_url = ($avatar) ? - common_avatar_display_url($avatar) : - common_default_avatar(AVATAR_MINI_SIZE); + $avatar->displayUrl() : + Avatar::defaultImage(AVATAR_MINI_SIZE); $this->element('img', array('src' => $avatar_url, 'width' => AVATAR_MINI_SIZE, -- cgit v1.2.3-54-g00ecf