protected function showNoticeContent(Notice $stored, HTMLOutputter $out, Profile $scoped = null) { if ($stored->object_type == self::POLL_RESPONSE_OBJECT) { parent::showNoticeContent($stored, $out, $scoped); return; } // If the stored notice is a POLL_OBJECT $poll = Poll::getByNotice($stored); if ($poll instanceof Poll) { if (!$scoped instanceof Profile || $poll->getResponse($scoped) instanceof Poll_response) { // Either the user is not logged in or it has already responded; show the results. $form = new PollResultForm($poll, $out); } else { $form = new PollResponseForm($poll, $out); } $form->show(); } else { // TRANS: Error text displayed if no poll data could be found. $out->text(_m('Poll data is missing')); } }
protected function showNoticeContent(Notice $stored, HTMLOutputter $out, Profile $scoped = null) { $nb = Bookmark::getByNotice($stored); if (empty($nb)) { common_log(LOG_ERR, "No bookmark for notice {$stored->id}"); parent::showContent(); return; } else { if (empty($nb->url)) { common_log(LOG_ERR, "No url for bookmark {$nb->id} for notice {$stored->id}"); parent::showContent(); return; } } $profile = $stored->getProfile(); // Whether to nofollow $attrs = array('href' => $nb->url, 'class' => 'bookmark-title'); $nf = common_config('nofollow', 'external'); if ($nf == 'never' || ($nf == 'sometimes' and $out instanceof ShowstreamAction)) { $attrs['rel'] = 'external'; } else { $attrs['rel'] = 'nofollow external'; } $out->elementStart('h3'); $out->element('a', $attrs, $nb->title); $out->elementEnd('h3'); // Replies look like "for:" tags $replies = $stored->getReplies(); $tags = $stored->getTags(); if (!empty($nb->description)) { $out->element('p', array('class' => 'bookmark-description'), $nb->description); } if (!empty($replies) || !empty($tags)) { $out->elementStart('ul', array('class' => 'bookmark-tags')); foreach ($replies as $reply) { $other = Profile::getKV('id', $reply); if (!empty($other)) { $out->elementStart('li'); $out->element('a', array('rel' => 'tag', 'href' => $other->profileurl, 'title' => $other->getBestName()), sprintf('for:%s', $other->nickname)); $out->elementEnd('li'); $out->text(' '); } } foreach ($tags as $tag) { $tag = trim($tag); if (!empty($tag)) { $out->elementStart('li'); $out->element('a', array('rel' => 'tag', 'href' => Notice_tag::url($tag)), $tag); $out->elementEnd('li'); $out->text(' '); } } $out->elementEnd('ul'); } }