class AkismetSpamProtector implements SpamProtector (View source)

Spam protector for Akismet

Properties

protected static string $_api_key

Overridden API key

Methods

public static 
set_api_key(string $key)

Set the API key

protected static 
string
get_api_key()

Get the API key

public static 
api()

Retrieves Akismet API object singleton, or null if not configured

public
getFormField(string $name = null, string $title = null, mixed $value = null, $form = null, $rightTitle = null)

Return the FormField associated with this protector.

public
setFieldMapping(array $fieldMapping)

Set the fields to map spam protection too

Details

static set_api_key(string $key)

Set the API key

Parameters

string $key

static protected string get_api_key()

Get the API key

Return Value

string

static AkismetService api()

Retrieves Akismet API object singleton, or null if not configured

Return Value

AkismetService

FormField getFormField(string $name = null, string $title = null, mixed $value = null, $form = null, $rightTitle = null)

Return the FormField associated with this protector.

Most spam methods will simply return a piece of HTML to be injected at the end of the form. If a spam method needs to inject more than one form field (i.e a hidden field and a text field) then return a FieldGroup from this method to include both.

Parameters

string $name
string $title
mixed $value
$form
$rightTitle

Return Value

FormField

The resulting field

setFieldMapping(array $fieldMapping)

Set the fields to map spam protection too

Parameters

array $fieldMapping

array of Field Names, where the indexes of the array are the field names of the form and the values are the standard spamprotection fields used by the protector