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


PHP NewsModel::markSpam方法代码示例

本文整理汇总了PHP中NewsModel::markSpam方法的典型用法代码示例。如果您正苦于以下问题:PHP NewsModel::markSpam方法的具体用法?PHP NewsModel::markSpam怎么用?PHP NewsModel::markSpam使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在NewsModel的用法示例。


在下文中一共展示了NewsModel::markSpam方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: recheckSpamAction

 public function recheckSpamAction()
 {
     $id = $this->intVal(3);
     if ($id == 0) {
         header("location:/homeadmin/comments/");
     }
     $newsModel = new NewsModel();
     $akismet = new Akismet();
     $akismet->key = "5a3c4dc9f909";
     $akismet->blog = "http://tiny4cocoa.org/home/";
     if (!$akismet->verifyKey()) {
         die("akismet verify error");
     }
     $comment = $newsModel->commentById($id);
     if (!$comment) {
         die("can not find comment");
     }
     $data = array('blog' => 'http://tiny4cocoa.org/home/', 'user_ip' => $comment["ip"], 'user_agent' => $comment["useragent"], 'referrer' => $comment["referrer"], 'permalink' => "http://tiny4cocoa.org/home/s/{$comment['newsid']}", 'comment_type' => 'comment', 'comment_author' => $comment["poster"], 'comment_author_email' => '', 'comment_author_url' => '', 'comment_content' => $comment["content"]);
     $ret = $akismet->commentCheck($data);
     if ($ret) {
         $newsModel->markSpam($comment["id"], 1);
         //echo "comment # $comment[id] is spam!\r\n";
     } else {
         $newsModel->markSpam($comment["id"], 0);
         //echo "comment # $comment[id] is not spam.\r\n";
     }
     header("location:/homeadmin/comments/");
 }
开发者ID:lilhorse,项目名称:cocoa,代码行数:28,代码来源:HomeadminController.php

示例2: checkSpamAction

 public function checkSpamAction()
 {
     $newModel = new NewsModel();
     $comments = $newModel->commentToCheck();
     if (count($comments) == 0) {
         die("no comments");
     }
     $akismet = new Akismet();
     $akismet->key = "5a3c4dc9f909";
     $akismet->blog = "http://tiny4cocoa.org/home/";
     if (!$akismet->verifyKey()) {
         die("akismet verify error");
     }
     foreach ($comments as $comment) {
         $data = array('blog' => 'http://tiny4cocoa.org/home/', 'user_ip' => $comment["ip"], 'user_agent' => $comment["useragent"], 'referrer' => $comment["referrer"], 'permalink' => "http://tiny4cocoa.org/home/s/{$comment['newsid']}", 'comment_type' => 'comment', 'comment_author' => $comment["poster"], 'comment_author_email' => '', 'comment_author_url' => '', 'comment_content' => $comment["content"]);
         //var_dump($data);
         $ret = $akismet->commentCheck($data);
         if ($ret) {
             $newModel->markSpam($comment["id"], 1);
             echo "comment # {$comment['id']} is spam!\r\n";
         } else {
             $newModel->markSpam($comment["id"], 0);
             echo "comment # {$comment['id']} is not spam.\r\n";
         }
     }
 }
开发者ID:lilhorse,项目名称:cocoa,代码行数:26,代码来源:HomeController.php


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