mirror of
https://github.com/silverstripe/silverstripe-frameworktest
synced 2024-10-22 11:06:02 +02:00
NEW Add NullSpamProtector
This commit is contained in:
parent
83570153e8
commit
5afed61c5f
5
_config/spamprotection.yml
Normal file
5
_config/spamprotection.yml
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
name: frameworktest-spamprotection
|
||||||
|
---
|
||||||
|
SilverStripe\SpamProtection\Extension\FormSpamProtectionExtension:
|
||||||
|
default_spam_protector: SilverStripe\FrameworkTest\NullSpamProtector\NullSpamProtector
|
28
code/null-spam-protector/NullSpamProtector.php
Normal file
28
code/null-spam-protector/NullSpamProtector.php
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace SilverStripe\FrameworkTest\NullSpamProtector;
|
||||||
|
|
||||||
|
use SilverStripe\Forms\HiddenField;
|
||||||
|
use SilverStripe\SpamProtection\SpamProtector;
|
||||||
|
|
||||||
|
if (!interface_exists(SpamProtector::class)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This is a minimum implementation used in CI for silverstripe/spamprotector so there's a default_spam_protector
|
||||||
|
*
|
||||||
|
* This used to be done by silverstripe/akismet, but that's no longer being used in CMS 5
|
||||||
|
*/
|
||||||
|
class NullSpamProtector implements SpamProtector
|
||||||
|
{
|
||||||
|
public function getFormField($name = null, $title = null, $value = null)
|
||||||
|
{
|
||||||
|
return new HiddenField('NullSpamProtector');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setFieldMapping($fieldMapping)
|
||||||
|
{
|
||||||
|
// no-op
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user