当前位置: 首页>>代码示例>>PHP>>正文


PHP Akismet::check_spam方法代码示例

本文整理汇总了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));
 }
开发者ID:CivicCommons,项目名称:oldBellCaPA,代码行数:35,代码来源:Comment.php


注:本文中的Akismet::check_spam方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。