本文整理匯總了PHP中Akismet::commentCheck方法的典型用法代碼示例。如果您正苦於以下問題:PHP Akismet::commentCheck方法的具體用法?PHP Akismet::commentCheck怎麽用?PHP Akismet::commentCheck使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Akismet
的用法示例。
在下文中一共展示了Akismet::commentCheck方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: saveComment
public function saveComment()
{
$data["newsid"] = $_POST["newsid"];
if (empty($_POST["nonamecheck"])) {
$data["hidename"] = 0;
} else {
$data["hidename"] = 1;
}
$data["content"] = $_POST["content"];
$data["posterid"] = $_POST["posterid"];
$data["poster"] = $_POST["poster"];
if ($data["posterid"] > 0 && $data["hidename"] == 0) {
$data["poster"] = $this->usernameById($data["posterid"]);
}
$data["createtime"] = time();
$data["ip"] = ToolModel::getRealIpAddr();
$data["useragent"] = $_SERVER['HTTP_USER_AGENT'];
$data["referrer"] = $_SERVER['HTTP_REFERER'];
$id = $this->select("cocoacms_comments")->insert($data);
$akismet = new Akismet();
$comment = $data;
$comment["id"] = $id;
$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) {
$this->markSpam($comment["id"], 1);
}
$this->updateCommentsCount($comment["newsid"]);
//header("location:/home/s/$comment[newsid]/");
}
示例2: 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/");
}
示例3: 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";
}
}
}