Skip to content

Commit

Permalink
Add HoneyPotSpamProtector.php
Browse files Browse the repository at this point in the history
This allows for HoneyPotField to be used with UserForms.
  • Loading branch information
muskie9 committed May 1, 2015
1 parent 86b54d1 commit 2ab5aa7
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
8 changes: 8 additions & 0 deletions README.md
Expand Up @@ -5,3 +5,11 @@ For a SilverStripe `2.4` compatible version use the branch `1.0`
## Installation (with composer)

$ composer require camspiers/honeypot

Set the default spam protector in *mysite/_config/spamprotection.yml*

---
name: spamprotection
---
FormSpamProtectionExtension:
default_spam_protector: HoneyPotSpamProtector
23 changes: 23 additions & 0 deletions code/HoneyPotSpamProtector.php
@@ -0,0 +1,23 @@
<?php

/**
* @package honeypot
*/

class HoneyPotSpamProtector implements SpamProtector {

/**
* Returns the {@link HoneyPotField} associated with this protector
*
* @return HoneyPotField
*/
public function getFormField($name = null, $title = null, $value = null) {
return new HoneyPotField($name, $title, $value);
}

/**
* Not used by HoneyPotSpamProtector
*/
public function setFieldMapping($fieldMapping) {}

}

0 comments on commit 2ab5aa7

Please sign in to comment.