This is an ex-addon.
- This add-on has been discontinued, joined the choir invisible and therefore is no longer available.
Compatibility: | EE1, EE2 |
---|---|
Latest release: | 3.0.0 (released 2014-03-17) |
Licensing: | CC Attribution-Share Alike 3.0 |
Compatibility & Requirements
The download only contains the EE2 version. For the EE1 version, go to Github. You also will need an API key from Akismet (free for personal use) in order to use their service.
Installation
- Download and unzip Low NoSpam
- Copy the
ee2/third_party/low_nospam
folder to your/system/expressionengine/third_party/
directory - In your Control Panel, go to Add-Ons → Extensions and click the Install-link in the Low NoSpam row
- In the extension settings, select your NoSpam service and enter your API key, then save your settings
- All set!
Upgrade
Upgrading to version 3+ will remove all third party support in favour of offering an extensive API. Contact other add-on developers to update their add-ons to be compatible with Low NoSpam 3.
API
The Low NoSpam Library will be loaded on Sessions Start, so it will be available throughout EE using ee()->low_nospam
. The library stores an internal data array with data to send to the NoSpam service, which should contain the keys that are made available by the Akismet API. Available methods:
is_available()
Returns TRUE
if the service is available, FALSE
if not.
key_is_valid()
Returns TRUE
if the set API is valid.
get_member_groups()
Returns the member group IDs set by set_member_groups($ids)
.
get_service()
Currently selected service (array).
get_service_name()
Currently selected service short name (string).
get_services()
A nested array of available services. Currently only Akismet.
set_content_by_post($ignore = array())
Sets the content key of the internal data array to the contents in $_POST
, ignoring the keys given in $ignore
.
set_data($key, $value = FALSE)
Either sets a single value in the internal data array or (if $key
is an array) merges an entire array with the internal data array.
set_member_groups($ids)
Used to set member group IDs that were set by the user in the Extension Settings.
set_server_ignore($key, $force)
Add keys to the internal server_ignore array. Each of those keys of the $_SERVER
superglobal will not be sent along to the service. If a string is given, it will be added to the array. If an array is given, the whole array is added. If the $force
flag is set to TRUE
, the whole array will be replaced.
set_service($name, $key)
Tells the library which service to use, with which API key. Possible values for $name are the keys given in get_services.
Example
if (isset(ee()->low_nospam) AND
ee()->low_nospam->is_available() AND
ee()->low_nospam->key_is_valid())
{
ee()->low_nospam->set_data(array(
'comment_author' => ee()->session->userdata('username'),
'comment_author_email' => ee()->session->userdata('email'),
'comment_author_url' => ee()->session->userdata('url')
));
ee()->low_nospam->set_content_by_post(array('XID', 'csrf_token'));
if (ee()->low_nospam->is_spam())
{
ee()->output->show_user_error('submission', 'Computer says no');
}
}