Yii 1.1: yii-antispam

Yii antispam extension for user messages and registrations
3 followers

Yii-antispam

Anti-spam by CleanTalk extension with protection against spam bots and manual spam.

No Captcha, no questions, no counting animals, no puzzles, no math.

Requirements

Yii 1.1 or above

Usage

1) Get access key on Cleantalk.org

2) Extract content from archive under protected/extensions/yii-antispam

3) Open your application configuration in protected/config/main.php and modify components section:

// application components
'components'=>array(
    ...
        'cleanTalk'=>array(
            'class'=>'ext.yii-antispam.CleanTalkApi',
            'apiKey'=>'*****',
        ),
    ...
),

4) Add validator in your model, for example 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'),
            ...
        );
    }
    ...
}

5) In form view add special hidden element

<?php $form=$this->beginWidget('CActiveForm', array(
    ...
    <?php echo Yii::app()->cleanTalk->checkJsHiddenField()?>
    ...
    <?php echo CHtml::submitButton('Submit'); ?>
    ...
<?php $this->endWidget(); ?>

License

GNU General Public License

Resources

Total 4 comments

#19421 report it
rustik at 2015/06/30 02:16pm
Yii2

Released version for Yii2

http://www.yiiframework.com/extension/yii2-antispam/

#19254 report it
rustik at 2015/04/29 01:17am
Yii 2

In the near future we implement extension for Yii2.

#19247 report it
mem at 2015/04/27 09:15am
Yii 2

Any plans for upgrading this for Yii 2?

#17458 report it
Petr.Grishin at 2014/06/16 03:53pm
_

Great!

Leave a comment

Please to leave your comment.

Create extension