heyday/silverstripe-honeypot

此包最新版本(3.0.0)没有可用的许可证信息。

安装量: 8,840

依赖者: 0

建议者: 0

安全性: 0

星标: 1

关注者: 2

分支: 14

类型:silverstripe-vendormodule

3.0.0 2019-08-13 22:49 UTC

This package is auto-updated.

Last update: 2024-09-16 12:11:59 UTC


README

camspiers/honeypot的SilverStripe 4.x兼容版本

安装(使用composer)

$ composer require heyday/silverstripe-honeypot

app/_config/spamprotection.yml 中设置默认的垃圾邮件防护程序

---
name: spamprotection
---
SilverStripe\SpamProtection\Extension\FormSpamProtectionExtension:
  default_spam_protector: Heyday\SilverStripe\HoneyPot\HoneyPotSpamProtector

或者,根据表单进行设置

use Heyday\SilverStripe\HoneyPot\HoneyPotField;
use SilverStripe\Forms\Form;
use SilverStripe\Control\Controller;
use SilverStripe\Forms\FieldList;

/**
 * Class SomeForm
 */
class SomeForm extends Form
{
    /**
     * @param Controller $controller
     */
    public function __construct(Controller $controller)
    {
        $fields = new FieldList();
        $fields->push(new HoneyPotField('Website')); // 'Website' here can be any old string
        ...
    }
}