Merge pull request #135 from creative-commoners/pulls/1/null-spam-protector

NEW Add NullSpamProtector
This commit is contained in:
Guy Sartorelli 2023-01-18 15:32:25 +13:00 committed by GitHub
commit e847f79e27
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 33 additions and 0 deletions

View File

@ -0,0 +1,5 @@
---
name: frameworktest-spamprotection
---
SilverStripe\SpamProtection\Extension\FormSpamProtectionExtension:
default_spam_protector: SilverStripe\FrameworkTest\NullSpamProtector\NullSpamProtector

View 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
}
}