X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=lib%2Fnoticelist.php;h=837cb90faa13bb29a9fdfe0f5734c569995c0650;hb=3cb6b1670bd7e3860fdca217e4075f51378fe5e0;hp=2165222eec4e5b398eca14b2f3f09f42ce0b770e;hpb=27d0e8f0a411488cd2a09009759078501102c7a1;p=quix0rs-gnu-social.git diff --git a/lib/noticelist.php b/lib/noticelist.php index 2165222eec..837cb90faa 100644 --- a/lib/noticelist.php +++ b/lib/noticelist.php @@ -191,6 +191,14 @@ class NoticeListItem extends Widget function show() { + if (empty($this->notice)) { + common_log(LOG_WARNING, "Trying to show missing notice; skipping."); + return; + } else if (empty($this->profile)) { + common_log(LOG_WARNING, "Trying to show missing profile (" . $this->notice->profile_id . "); skipping."); + return; + } + $this->showStart(); if (Event::handle('StartShowNoticeItem', array($this))) { $this->showNotice(); @@ -286,6 +294,7 @@ class NoticeListItem extends Widget } $this->out->elementStart('a', $attrs); $this->showAvatar(); + $this->out->text(' '); $this->showNickname(); $this->out->elementEnd('a'); $this->out->elementEnd('span'); @@ -371,7 +380,7 @@ class NoticeListItem extends Widget function showNoticeLink() { - if($this->notice->is_local){ + if($this->notice->is_local == Notice::LOCAL_PUBLIC || $this->notice->is_local == Notice::LOCAL_NONPUBLIC){ $noticeurl = common_local_url('shownotice', array('notice' => $this->notice->id)); }else{ @@ -424,8 +433,10 @@ class NoticeListItem extends Widget $url = $location->getUrl(); + $this->out->text(' '); $this->out->elementStart('span', array('class' => 'location')); $this->out->text(_('at')); + $this->out->text(' '); if (empty($url)) { $this->out->element('span', array('class' => 'geo', 'title' => $latlon), @@ -465,9 +476,11 @@ class NoticeListItem extends Widget function showNoticeSource() { if ($this->notice->source) { + $this->out->text(' '); $this->out->elementStart('span', 'source'); $this->out->text(_('from')); $source_name = _($this->notice->source); + $this->out->text(' '); switch ($this->notice->source) { case 'web': case 'xmpp': @@ -478,15 +491,35 @@ class NoticeListItem extends Widget $this->out->element('span', 'device', $source_name); break; default: - $ns = Notice_source::staticGet($this->notice->source); - if ($ns) { + + $name = $source_name; + $url = null; + + if (Event::handle('StartNoticeSourceLink', array($this->notice, &$name, &$url, &$title))) { + $ns = Notice_source::staticGet($this->notice->source); + + if ($ns) { + $name = $ns->name; + $url = $ns->url; + } else { + $app = Oauth_application::staticGet('name', $this->notice->source); + if ($app) { + $name = $app->name; + $url = $app->source_url; + } + } + } + Event::handle('EndNoticeSourceLink', array($this->notice, &$name, &$url, &$title)); + + if (!empty($name) && !empty($url)) { $this->out->elementStart('span', 'device'); - $this->out->element('a', array('href' => $ns->url, - 'rel' => 'external'), - $ns->name); + $this->out->element('a', array('href' => $url, + 'rel' => 'external', + 'title' => $title), + $name); $this->out->elementEnd('span'); } else { - $this->out->element('span', 'device', $source_name); + $this->out->element('span', 'device', $name); } break; } @@ -516,6 +549,7 @@ class NoticeListItem extends Widget } } if ($hasConversation){ + $this->out->text(' '); $convurl = common_local_url('conversation', array('id' => $this->notice->conversation)); $this->out->element('a', array('href' => $convurl.'#notice-'.$this->notice->id, @@ -547,22 +581,8 @@ class NoticeListItem extends Widget $this->out->raw(_('Repeated by')); - $avatar = $repeater->getAvatar(AVATAR_MINI_SIZE); - $this->out->elementStart('a', $attrs); - - $this->out->element('img', array('src' => ($avatar) ? - $avatar->displayUrl() : - Avatar::defaultImage(AVATAR_MINI_SIZE), - 'class' => 'avatar photo', - 'width' => AVATAR_MINI_SIZE, - 'height' => AVATAR_MINI_SIZE, - 'alt' => - ($repeater->fullname) ? - $repeater->fullname : - $repeater->nickname)); - - $this->out->element('span', 'nickname', $repeater->nickname); + $this->out->element('span', 'fn nickname', $repeater->nickname); $this->out->elementEnd('a'); $this->out->elementEnd('span'); @@ -581,12 +601,14 @@ class NoticeListItem extends Widget function showReplyLink() { if (common_logged_in()) { + $this->out->text(' '); $reply_url = common_local_url('newnotice', array('replyto' => $this->profile->nickname, 'inreplyto' => $this->notice->id)); $this->out->elementStart('a', array('href' => $reply_url, 'class' => 'notice_reply', 'title' => _('Reply to this notice'))); $this->out->text(_('Reply')); + $this->out->text(' '); $this->out->element('span', 'notice_id', $this->notice->id); $this->out->elementEnd('a'); } @@ -606,7 +628,7 @@ class NoticeListItem extends Widget if (!empty($user) && ($todel->profile_id == $user->id || $user->hasRight(Right::DELETEOTHERSNOTICE))) { - + $this->out->text(' '); $deleteurl = common_local_url('deletenotice', array('notice' => $todel->id)); $this->out->element('a', array('href' => $deleteurl, @@ -625,6 +647,7 @@ class NoticeListItem extends Widget { $user = common_current_user(); if ($user && $user->id != $this->notice->profile_id) { + $this->out->text(' '); $profile = $user->getProfile(); if ($profile->hasRepeated($this->notice->id)) { $this->out->element('span', array('class' => 'repeated',