本文整理汇总了PHP中Akismet::check_spam方法的典型用法代码示例。如果您正苦于以下问题:PHP Akismet::check_spam方法的具体用法?PHP Akismet::check_spam怎么用?PHP Akismet::check_spam使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Akismet
的用法示例。
在下文中一共展示了Akismet::check_spam方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Akismet
function akismet_check()
{
global $base_url, $akismet_key;
if (!@$akismet_key) {
return;
}
$ak = new Akismet($akismet_key);
$params = array("user_ip" => $this->ip_addr, "user_agent" => $this->user_agent, "referrer" => $this->referrer, "permalink" => "{$base_url}/content.php?cid=" . $this->content_id, "comment_type" => "comment", "comment_author" => $this->name, "comment_author_email" => $this->email, "comment_author_url" => $this->homepage, "comment_content" => $this->comment);
if ($this->user_id > 0) {
$user = new User();
$user->load((int) $this->user_id);
$params['comment_author'] = $user->get_name();
$params['comment_author_email'] = $user->email;
$params['comment_author_url'] = "{$base_url}/user.php?uid={$this->user_id}";
}
$akismet_decision = $ak->check_spam($base_url, $params);
switch ($akismet_decision) {
case 'true':
$this->akismet_spam = 1;
break;
case 'false':
$this->akismet_spam = 0;
break;
default:
// akismet couldn't make up its mind - probably we didn't give it enough data.
return;
}
$sql = "";
if ($this->akismet_spam) {
$this->spam_state = SPAM_STATE_AKISMET;
$this->is_active = 0;
$sql .= ", spam_state={$this->spam_state}, is_active={$this->is_active}";
}
Dal::query("UPDATE comments SET akismet_spam=? {$sql} WHERE comment_id=?", array($this->akismet_spam, $this->comment_id));
}