From 6e034567539d12c17759577f5392e86c3aca2fa6 Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Wed, 3 Nov 2010 13:10:42 -0700 Subject: [PATCH] Migrate some more code from manually constructing "fullname (nickname)" to using Profile->getFancyName(). Encapsulates common logic and allows for localization of the parens. --- actions/oembed.php | 6 +----- actions/shownotice.php | 6 +----- lib/noticelist.php | 2 +- plugins/Mapstraction/allmap.php | 7 +------ plugins/Mapstraction/usermap.php | 7 +------ 5 files changed, 5 insertions(+), 23 deletions(-) diff --git a/actions/oembed.php b/actions/oembed.php index e25e4cb259..da3aa0c716 100644 --- a/actions/oembed.php +++ b/actions/oembed.php @@ -79,11 +79,7 @@ class OembedAction extends Action if (empty($profile)) { $this->serverError(_('Notice has no profile.'), 500); } - if (!empty($profile->fullname)) { - $authorname = $profile->fullname . ' (' . $profile->nickname . ')'; - } else { - $authorname = $profile->nickname; - } + $authorname = $profile->getFancyName(); $oembed['title'] = sprintf(_('%1$s\'s status on %2$s'), $authorname, common_exact_date($notice->created)); diff --git a/actions/shownotice.php b/actions/shownotice.php index 5fc863486c..7cc6c54243 100644 --- a/actions/shownotice.php +++ b/actions/shownotice.php @@ -167,11 +167,7 @@ class ShownoticeAction extends OwnerDesignAction function title() { - if (!empty($this->profile->fullname)) { - $base = $this->profile->fullname . ' (' . $this->profile->nickname . ')'; - } else { - $base = $this->profile->nickname; - } + $base = $this->profile->getFancyName(); return sprintf(_('%1$s\'s status on %2$s'), $base, diff --git a/lib/noticelist.php b/lib/noticelist.php index df1533980a..bdf2530b34 100644 --- a/lib/noticelist.php +++ b/lib/noticelist.php @@ -306,7 +306,7 @@ class NoticeListItem extends Widget $attrs = array('href' => $this->profile->profileurl, 'class' => 'url'); if (!empty($this->profile->fullname)) { - $attrs['title'] = $this->profile->fullname . ' (' . $this->profile->nickname . ')'; + $attrs['title'] = $this->profile->getFancyName(); } $this->out->elementStart('a', $attrs); $this->showAvatar(); diff --git a/plugins/Mapstraction/allmap.php b/plugins/Mapstraction/allmap.php index 6e2e1d1228..62d8d04458 100644 --- a/plugins/Mapstraction/allmap.php +++ b/plugins/Mapstraction/allmap.php @@ -61,12 +61,7 @@ class AllmapAction extends MapAction function title() { - if (!empty($this->profile->fullname)) { - // @todo FIXME: Bad i18n. Should be "%1$s (%2$s)". - $base = $this->profile->fullname . ' (' . $this->user->nickname . ') '; - } else { - $base = $this->user->nickname; - } + $base = $this->profile->getFancyName(); if ($this->page == 1) { // TRANS: Page title. diff --git a/plugins/Mapstraction/usermap.php b/plugins/Mapstraction/usermap.php index 0ee956159c..54412146ee 100644 --- a/plugins/Mapstraction/usermap.php +++ b/plugins/Mapstraction/usermap.php @@ -58,12 +58,7 @@ class UsermapAction extends MapAction function title() { - if (!empty($this->profile->fullname)) { - // @todo FIXME: Bad i18n. Should be '%1$s (%2$s)' - $base = $this->profile->fullname . ' (' . $this->user->nickname . ')'; - } else { - $base = $this->user->nickname; - } + $base = $this->profile->getFancyName(); if ($this->page == 1) { // @todo CHECKME: inconsisten with paged variant below. " map" missing. -- 2.39.5