SilverWare\SpamGuard\Fields\SimpleSpamGuardField
An extension of the form field class for preventing spam using a honeypot.
- Author: Colin Tucker <colin@praxis.net.au>
- Copyright: 2017 Praxis Interactive
- License: https://opensource.org/licenses/BSD-3-Clause BSD-3-Clause
Synopsis
class SimpleSpamGuardField
extends FormField
{
- // members
- protected TextField $honeypot;
- protected HiddenField $timestamp;
- protected integer $timeLimit = 5;
- // methods
- public void __construct()
- public $this setTimeLimit()
- public integer getTimeLimit()
- public $this setForm()
- public TextField getHoneypotField()
- public HiddenField getTimestampField()
- public string Type()
- public DBHTMLText Field()
- public $this setValue()
- public boolean tooSoon()
- public boolean validate()
Hierarchy
Extends
- SilverStripe\Forms\FormField
Members
protected
- $honeypot
—
SilverStripe\Forms\TextField
A form field instance for the honeypot. - $timeLimit
—
integer
How many seconds must pass before the form can be submitted. - $timestamp
—
SilverStripe\Forms\HiddenField
A form field instance for the timestamp.
Methods
public
- __construct() — Constructs the object upon instantiation.
- Field() — Renders the field for the template.
- Type() — Answers the field type for the template.
- getHoneypotField() — Answers the honeypot form field instance.
- getTimeLimit() — Answers the value of the timeLimit attribute.
- getTimestampField() — Answers the timestamp form field instance.
- setForm() — Defines the form instance for the receiver.
- setTimeLimit() — Defines the value of the timeLimit attribute.
- setValue() — Defines the field value.
- tooSoon() — Answers true if the form was submitted too soon.
- validate() — Answers true if the value is valid for the receiver.