function antispam_comment_view in AntiSpam 7
Implements hook_comment_view().
File
- ./
antispam.module, line 1081 - Primary hook implementations for the Antispam module.
Code
function antispam_comment_view($comment, $view_mode, $langcode) {
// $view_mode: 'full', 'teaser'
if (antispam_is_spam_moderator('comments')) {
$links = array();
if (variable_get('antispam_comment_publish_links', 1)) {
if ($comment->status == COMMENT_PUBLISHED) {
$links['antispam_comment_unpublish'] = array(
'title' => t('Unpublish'),
'href' => 'antispam/comment/' . $comment->cid . '/unpublish',
);
}
elseif ($comment->status == COMMENT_NOT_PUBLISHED) {
$links['antispam_comment_publish'] = array(
'title' => t('Publish'),
'href' => 'antispam/comment/' . $comment->cid . '/publish',
);
}
}
if (variable_get('antispam_comment_spam_links', 1)) {
if (antispam_content_is_spam('comment', $comment->cid)) {
$links['antispam_comment_ham'] = array(
'title' => t('Not Spam'),
'href' => 'antispam/comment/' . $comment->cid . '/submit-ham',
);
}
else {
$links['antispam_comment_spam'] = array(
'title' => t('Spam'),
'href' => 'antispam/comment/' . $comment->cid . '/submit-spam',
);
}
}
$comment->content['links']['comment']['#links'] = array_merge($comment->content['links']['comment']['#links'], $links);
}
}