\ContactFormSpamProtector
An abstract class that defines a spam protection plugin to the {@link ContactForm} class.
Each decendent should define a isSpam() method to check the form data and determine if the
input is spammy.
- Author: Aaron Carlino <aaron@bluehousegroup.com>
Synopsis
class ContactFormSpamProtector
extends Object
{
- // members
- protected static boolean $log_spam_failures = true;
- protected static integer $spam_failure_limit = 10;
- // methods
- public static void set_log_spam_failures()
- public static void set_spam_failure_limit()
- public static boolean ip_is_locked()
- public boolean isSpam()
- public string getMessage()
- public void initialize()
- public ContactFormSpamAttempt createSpamAttempt()
- public void logSpamAttempt()
Hierarchy
Extends
- Object
Members
protected
- $log_spam_failures — boolean
- $spam_failure_limit — int
Methods
public
- createSpamAttempt() — Creates a failed spam attempt object witht the user's info
- getMessage() — Gets the message to return to the form when the spam question is failed
- initialize() — Initialize the spam protector, e.g. add fields to the form, load any requirements
- ip_is_locked() — Determine if an IP address is blocked by looking it up in the database and comparing to $spam_failure_limit
- isSpam() — Determine if the form data is spammy
- logSpamAttempt() — Logs a spam attempt to the database
- set_log_spam_failures() — If true, log the spam failures to the database
- set_spam_failure_limit() — Sets the number of tolerable spam failures before the form stops being rendered