function antispam_link in AntiSpam 6
Implementation of hook_link().
File
- ./
antispam.module, line 614
Code
function antispam_link($type, $content = 0, $main = 0) {
$links = array();
if ($type == 'node' && antispam_is_spam_moderator($content->type)) {
if (variable_get('antispam_node_publish_links', 0)) {
if ($content->status) {
$links['antispam_node_unpublish'] = array(
'title' => t('Unpublish'),
'href' => 'antispam/node/' . $content->nid . '/unpublish',
);
}
else {
$links['antispam_node_publish'] = array(
'title' => t('Publish'),
'href' => 'antispam/node/' . $content->nid . '/publish',
);
}
}
if (variable_get('antispam_node_spam_links', 0)) {
if (antispam_content_is_spam('node', $content->nid)) {
$links['antispam_node_ham'] = array(
'title' => variable_get('antispam_connection_enabled', 1) ? t('Submit ham') : t('Mark as ham'),
'href' => 'antispam/node/' . $content->nid . '/submit-ham',
);
}
else {
$links['antispam_node_spam'] = array(
'title' => variable_get('antispam_connection_enabled', 1) ? t('Submit spam') : t('Mark as spam'),
'href' => 'antispam/node/' . $content->nid . '/submit-spam',
);
}
}
}
else {
if ($type == 'comment' && antispam_is_spam_moderator('comments')) {
if (variable_get('antispam_comment_publish_links', 1)) {
if ($content->status == COMMENT_PUBLISHED) {
$links['antispam_comment_unpublish'] = array(
'title' => t('Unpublish'),
'href' => 'antispam/comment/' . $content->cid . '/unpublish',
);
}
else {
if ($content->status == COMMENT_NOT_PUBLISHED) {
$links['antispam_comment_publish'] = array(
'title' => t('Publish'),
'href' => 'antispam/comment/' . $content->cid . '/publish',
);
}
}
}
if (variable_get('antispam_comment_spam_links', 1)) {
if (antispam_content_is_spam('comment', $content->cid)) {
$links['antispam_comment_ham'] = array(
'title' => variable_get('antispam_connection_enabled', 1) ? t('Submit ham') : t('Mark as ham'),
'href' => 'antispam/comment/' . $content->cid . '/submit-ham',
);
}
else {
$links['antispam_comment_spam'] = array(
'title' => variable_get('antispam_connection_enabled', 1) ? t('Submit spam') : t('Mark as spam'),
'href' => 'antispam/comment/' . $content->cid . '/submit-spam',
);
}
}
}
}
return $links;
}