$profile = Profile::staticGet('id', $action->notice->profile_id);
- if ($this->hasCommenting($profile)) {
+ if ($this->isAllowedRichEdit($profile)) {
$attrs = array();
$attrs['id'] = 'disqus_thread';
$action->elementStart('div', $attrs);
$action->elementStart('noscript');
+ // TRANS: User notification that JavaScript is required for Disqus comment display.
$noScriptMsg = sprintf(_m("Please enable JavaScript to view the [comments powered by Disqus](http://disqus.com/?ref_noscript=%s)."), $this->shortname);
$output = common_markup_to_html($noScriptMsg);
$action->raw($output);
$action->elementEnd('noscript');
$action->elementStart('a', array('href' => 'http://disqus.com', 'class' => 'dsq-brlink'));
+ // TRANS: This message is followed by a Disqus logo. Alt text is "Disqus".
$action->raw(_m('Comments powered by '));
$action->element('span', array('class' => 'logo-disqus'), 'Disqus');
$action->elementEnd('a');
}
/**
- * Override the default Notice display to add Disqus comments link
+ * Tack on a Disqus comments link to the notice options stanza
* (the link displays the total number of comments for each notice)
*
* @param NoticeListItem $noticeListItem
*
- * @return boolean override
*/
- function onStartShowNoticeItem($noticeListItem)
+ function onEndShowNoticeInfo($noticeListItem)
{
// Don't enable commenting for remote notices
if (empty($noticeListItem->notice->is_local)) {
- return true;
+ return;
}
$profile = Profile::staticGet('id', $noticeListItem->notice->profile_id);
if ($this->isAllowedRichEdit($profile)) {
-
- // @todo Refactor individual notice display to have its own event hooks
-
- $noticeListItem->showNotice();
- $noticeListItem->showNoticeInfo();
-
$noticeUrl = $noticeListItem->notice->bestUrl();
$noticeUrl .= '#disqus_thread';
$noticeListItem->out->element(
'a',
array('href' => $noticeUrl, 'class' => 'disqus_count'),
+ // TRANS: Plugin supplied feature for Disqus comments to notices.
_m('Comments')
);
-
- $noticeListItem->showNoticeOptions();
- Event::handle('EndShowNoticeItem', array($noticeListItem));
-
- return false;
- } else {
- return true;
}
}
'author' => 'Zach Copley',
'homepage' => 'http://status.net/wiki/Plugin:Disqus',
'rawdescription' =>
+ // TRANS: Plugin description.
_m('Use <a href="http://disqus.com/">Disqus</a>'.
' to add commenting to notice pages.'));
return true;