Spam
in package
Helper for a simple mechanism to dissuade and annoy entry-level spammers.
For rigorous protection, use a CAPTCHA. @see Captcha
Table of Contents
Methods
- censor() : string
- Checks text for bad words, like 'tax' and 'capsicum'
- check() : bool
- Checks that the spam field was not submitted with the form
- checkOrDie() : void
- Checks that the spam field was not submitted with the form
- detect() : array<string|int, mixed>
- Looks at a block of text to see if it looks like spam.
- glue() : string
- Generates a div containing an input which should never be filled in, in order to trap spam bots.
Methods
censor()
Checks text for bad words, like 'tax' and 'capsicum'
public
static censor(string $text) : string
Parameters
- $text : string
-
The text to censor
Tags
Return values
string —The censored text, with disallowed sequences replaced with '*'
check()
Checks that the spam field was not submitted with the form
public
static check() : bool
Return values
bool —true on success, false otherwise
checkOrDie()
Checks that the spam field was not submitted with the form
public
static checkOrDie() : void
If the check fails the user will be redirected to the URL base ('/') along with a notification. Normal users will never encounter this scenario.
Tags
Return values
void —If the check succeeded.
detect()
Looks at a block of text to see if it looks like spam.
public
static detect(string $text) : array<string|int, mixed>
Parameters
- $text : string
-
The text to check for spam
Tags
Return values
array<string|int, mixed> —An array of errors. An empty array signals no unusual sequences were detected
glue()
Generates a div containing an input which should never be filled in, in order to trap spam bots.
public
static glue() : string
To be used with Spam::check
Return values
string —HTML