cleantalk/yii-antispam

CleanTalk提供的反垃圾邮件yii扩展,具有防止垃圾邮件爬虫和人工垃圾邮件的功能。

安装次数: 1,434

依赖关系: 0

建议者: 0

安全: 0

星标: 15

关注者: 6

分支: 4

开放问题: 0

类型:yii-extension

1.1.0 2015-08-30 11:42 UTC

This package is auto-updated.

Last update: 2024-09-12 09:54:44 UTC


README

## Yii-antispam CleanTalk提供的反垃圾邮件扩展,具有防止垃圾邮件爬虫和人工垃圾邮件的功能。

无需验证码、无需回答问题、无需计数动物、无需解谜、无需数学计算。

Build Status

要求

##使用方法

  1. http://cleantalk.org/register?platform=yii获取访问密钥

  2. 将存档中的内容提取到protected/extensions/yii-antispam目录下

  3. 打开您的应用程序配置文件protected/config/main.php并修改components部分

// application components
'components'=>array(
    ...
        'cleanTalk'=>array(
            'class'=>'ext.yii-antispam.CleanTalkApi',
            'apiKey'=>'*****',
        ),
    ...
),
  1. 在您的模型中添加验证器,例如ContactForm
class ContactForm extends CFormModel
{
    public $name;
    public $email;
    public $body;
    ...
    public function rules()
    {
        return array(
            ...
            array('body', 
                    'ext.yii-antispam.CleanTalkValidator', 
                    'check'=>'message', /* Check type message or user */
                    'emailAttribute'=>'email',  
                    'nickNameAttribute'=>'name',
                    /*'on'=>'insert' if ActiveRecord using */),
            ...
        );
    }
    ...
}
  1. 在表单视图中添加特殊隐藏元素
<?php $form=$this->beginWidget('CActiveForm', array(
    ...
    <?php echo Yii::app()->cleanTalk->checkJsHiddenField()?>
    ...
    <?php echo CHtml::submitButton('Submit'); ?>
    ...
<?php $this->endWidget(); ?>

##许可证 GNU通用公共许可证

##资源