![]() |
|
drAkismetPlugin - 0.3.2Interface for the Akismet spam detection web service |
|
![]() |
4
users
Sign-in
to change your status |
This plugin is a library on top of the Akismet spam detection API. It provides a convenient interface to communicate with the web service and includes a form validator. |
This plugin is a library on top of the Akismet API. It is a spam detection tool leveraged by a web service. Read their online documentation for more information on the available calls.
| Name | Status | |
|---|---|---|
|
|
lead | ln.tibeird <<ta>> crednas |
Copyright (c) 2011 Driebit BV, Amsterdam, The Netherlands
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
| Version | License | API | Released |
|---|---|---|---|
| 0.3.4beta | MIT license | 0.3.4beta | 06/07/2012 |
| 0.3.3beta | MIT license | 0.3.3beta | 12/04/2011 |
| 0.3.2beta | MIT license | 0.3.2beta | 01/04/2011 |
| 0.2.0beta | MIT license | 0.2.0beta | 29/03/2011 |
| Version | License | API | Released |
|---|---|---|---|
| 0.3.4beta | MIT license | 0.3.4beta | 06/07/2012 |
| 0.3.3beta | MIT license | 0.3.3beta | 12/04/2011 |
| 0.3.2beta | MIT license | 0.3.2beta | 01/04/2011 |
| Version | License | API | Released |
|---|---|---|---|
| 0.3.4beta | MIT license | 0.3.4beta | 06/07/2012 |
| 0.3.3beta | MIT license | 0.3.3beta | 12/04/2011 |
| 0.3.2beta | MIT license | 0.3.2beta | 01/04/2011 |
This ain't no April Fools' release (or is it...)
Minor bug fixes: * Changed include once to include in the configuration, so the plugin can be initialised more than once. * Fixed typo in drAkismetApiComment, changed setPermaLink() to setPermalink()
Minor bug fixes by Kevin Dew (kev <
This ain't no April Fools' release (or is it...)
First public (beta) release
This plugin is a library on top of the Akismet API. It is a spam detection tool leveraged by a web service. Read their online documentation for more information on the available calls.
ProjectConfiguration class (/config/ProjectConfiguration.class.php)akismet.ymlThe 1.1 API supports four methods:
Use a drAkismetApi instance to call theses methods:
$api = new drAkismetApi(); $verifyKey = $api->verifyKey() // or: new drAkismetApiVerifyKey(); ->setBlogUri('http://www.symfony-project.org/blog/'); $api->call($verifyKey); // returns a drAkismetApiReponse // or alternatively you can directly do: $api->verifyKey()->setBlogUri('http://www.symfony-project.org/blog/') ->isValid($api); // returns TRUE / FALSE
Or use the drAkismetApiComment helper class - which can be extended by your own comment class:
$api = new drAkismetApi(); $checkComment = new drAkismetCheckComment(); $comment = new drAkismetApiComment(); $comment->setAuthor('viagra-test-123') ->setAuthorEmail('foo@bar.net') ->setCommentContent('test'); $checkComment->setBlogUri('http://www.symfony-project.org/blog/') ->isSpam($api, $comment);
Calls to an API method return an instance of drAkismetApiReponse. The four provided methods return a subclass of said response class:
verifyKeyResponse has a method isValid (returned by verify-key)checkCommentResponse has a method isSpam (returned by comment-check)Use drAkismetValidatorSpam to validate comments directly from your forms. Of course, like any sfValidator, you can also use it outside your forms:
new drAkismetValidatorSpam(array( 'blog' => 'http://www.symfony-project.org/blog/', 'user_ip' => $_SERVER['REMOTE_ADDR'], 'comment_author' => 'viagra-test-123', 'comment_author_email' => 'foo@bar.net', 'comment_content' => 'test' ));
It is possible to create your own connection class (socket connection by default) or to override the request parameters (e.g. for testing purposes):
class myConnection implements drAkismetConnectionInterface { /* ... */ } $api = new drAkismetApi(); $api->setConnection(new myConnection()); $api->setHost('akismet-test.yourhost.com'); $api->setPort(8080);
The default connection class drAkismetApiSocketConnection sends two events that you can use to monitor server requests and responses:
$api = new drAkismetApi(); // drAkismetApiSocketConnection::EVENT_PRE_REQUEST $api->getConnection()->getEventDispatcher() ->connect('akismet.pre_request', array('listenToPreRequest')); // drAkismetApiSocketConnection::EVENT_RAW_RESPONSE $api->getConnection()->getEventDispatcher() ->connect('akismet.raw_response', array('listenToRawResponse'));
The defaults in the config directory of this plugin should suffice, but your are free to alter them.
For each host you can configure different API keys. You can also override the hostname that will be used when communicating with the Akismet service:
akismet:
api_keys:
www.yourhost.com: 123abc456def # the API key for said host
mydev.local:
host: www.yourhost.com # the hostname to use (instead of mydev.local)
key: 123abc456def
You can limit the available API methods by using the allow_calls key:
akismet:
allow_calls: [check-comment] # one or more of: verify-key, check-comment, submit-spam, submit-ham
