pear/services_akismet2

提供对Akismet REST API的对象接口。Akismet API用于检测和过滤垃圾邮件。

0.3.1 2014-02-21 08:53 UTC

This package is auto-updated.

Last update: 2024-08-29 04:42:50 UTC


README

本包提供了对Akismet REST API的对象接口。Akismet API用于检测和过滤在博客上发布的垃圾邮件评论。

有多个使用Akismet API的反垃圾邮件服务提供商。要使用该API,您需要一个此类提供商的API密钥。例如提供商包括WordpressTypePad

Services_Akismet2已从PEAR SVN迁移。

文档

快速示例

<?php

require_once 'Services/Akismet2.php';
require_once 'Services/Akismet2/Comment.php';

$comment = new Services_Akismet2_Comment(
    array(
        'comment_author'       => 'Test Author',
        'comment_author_email' => 'test@example.com',
        'comment_author_url'   => 'http://example.com/',
        'comment_content'      => 'Hello, World!'
    )
);

$apiKey  = 'AABBCCDDEEFF';
$akismet = new Services_Akismet2('http://blog.example.com/', $apiKey);
if ($akismet->isSpam($comment)) {
    // rather than simply ignoring the spam comment, it is recommended
    // to save the comment and mark it as spam in case the comment is a
    // false positive.
} else {
    // save comment as normal comment
}

?>

更多文档

错误和问题

请通过PEAR错误跟踪器报告所有新问题。

请提交您的错误报告的拉取请求!

测试

要测试,请运行 $ phpunit tests/ 或 $ pear run-tests -r

构建

要构建,只需运行 $ pear package

安装

从头开始安装,请运行 $ pear install package.xml

升级,请运行 $ pear upgrade -f package.xml