Version: current

# Class Akismet

The Akismet PHP5 Class

This class takes the functionality from the Akismet WordPress plugin written by Matt Mullenweg and allows it to be integrated into any PHP5 application or website.
The original plugin is available on the Akismet website.
Usage:

      $akismet = new Akismet('http://www.example.com/blog/', 'aoeu1aoue');
      $akismet->setCommentAuthor($name);
      $akismet->setCommentAuthorEmail($email);
      $akismet->setCommentAuthorURL($url);
      $akismet->setCommentContent($comment);
      $akismet->setPermalink('http://www.example.com/blog/alex/someurl/');
      if($akismet->isCommentSpam())
        // store the comment but mark it as spam (in case of a mis-diagnosis)
      else
        // store the comment normally

### Direct known subclasses

`SSAkismet`

Package: cms\comments
Copyright: Alex Potsides, http://www.achingbrain.net
License: GNU General Public License
Author: Alex Potsides
Version: 0.2
Link: http://www.achingbrain.net/
Located at cms/code/sitefeatures/Akismet.php

## Methods summary

`public` | # `__construct( string $blogURL, string $wordPressAPIKey )` #### Parameters $blogURL string Your WordPress API key. $wordPressAPIKey string $blogURL The URL of your blog. #### Throws ``Exception`` An exception is thrown if your API key is invalid.
`public boolean` | # `isCommentSpam( )` Tests for spam. Tests for spam. Uses the web service provided by Akismet to see whether or not the submitted comment is spam. Returns a boolean value. #### Returns `boolean` True if the comment is spam, false if not
`public` | # `submitSpam( )` Submit spam that is incorrectly tagged as ham. Submit spam that is incorrectly tagged as ham. Using this function will make you a good citizen as it helps Akismet to learn from its mistakes. This will improve the service for everybody.
`public` | # `submitHam( )` Submit ham that is incorrectly tagged as spam. Submit ham that is incorrectly tagged as spam. Using this function will make you a good citizen as it helps Akismet to learn from its mistakes. This will improve the service for everybody.
`public` | # `setUserIP( string $userip )` To override the user IP address when submitting spam/ham later on To override the user IP address when submitting spam/ham later on #### Parameters $userip string $userip An IP address. Optional.
`public` | # `setReferrer( string $referrer )` To override the referring page when submitting spam/ham later on To override the referring page when submitting spam/ham later on #### Parameters $referrer string $referrer The referring page. Optional.
`public` | # `setPermalink( string $permalink )` A permanent URL referencing the blog post the comment was submitted to. A permanent URL referencing the blog post the comment was submitted to. #### Parameters $permalink string $permalink The URL. Optional.
`public` | # `setCommentType( mixed $commentType )` The type of comment being submitted. The type of comment being submitted. May be blank, comment, trackback, pingback, or a made up value like "registration" or "wiki".
`public` | # `setCommentAuthor( mixed $commentAuthor )` The name that the author submitted with the comment. The name that the author submitted with the comment.
`public` | # `setCommentAuthorEmail( mixed $authorEmail )` The email address that the author submitted with the comment. The email address that the author submitted with the comment. The address is assumed to be valid.
`public` | # `setCommentAuthorURL( mixed $authorURL )` The URL that the author submitted with the comment. The URL that the author submitted with the comment.
`public` | # `setCommentContent( mixed $commentBody )` The comment's body text. The comment's body text.
`public` | # `setAPIPort( mixed $apiPort )` Defaults to 80 Defaults to 80
`public` | # `setAkismetServer( mixed $akismetServer )` Defaults to rest.akismet.com Defaults to rest.akismet.com
`public` | # `setAkismetVersion( mixed $akismetVersion )` Defaults to '1.1' Defaults to '1.1'

### Magic methods summary

[Raise a SilverStripe Framework issue/bug](https://github.com/silverstripe/silverstripe-framework/issues/new)
- [Raise a SilverStripe CMS issue/bug](https://github.com/silverstripe/silverstripe-cms/issues/new)
- Please use the Silverstripe Forums to ask development related questions. -