Comments: on this page. Click to read or post your own.

Class Akismet

Description

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:

  1.     $akismet new Akismet('http://www.example.com/blog/''aoeu1aoue');
  2.     $akismet->setCommentAuthor($name);
  3.     $akismet->setCommentAuthorEmail($email);
  4.     $akismet->setCommentAuthorURL($url);
  5.     $akismet->setCommentContent($comment);
  6.     $akismet->setPermalink('http://www.example.com/blog/alex/someurl/');
  7.     if($akismet->isCommentSpam())
  8.       // store the comment but mark it as spam (in case of a mis-diagnosis)
  9.     else
  10.       // store the comment normally

Located in /cms/code/sitefeatures/Akismet.php (line 53)


	
			
Direct descendents
Class Description
SSAkismet
Method Summary
Akismet __construct (string $blogURL,  $wordPressAPIKey)
bool isCommentSpam ()
void setAkismetServer ( $akismetServer)
void setAkismetVersion ( $akismetVersion)
void setAPIPort ( $apiPort)
void setCommentAuthor ( $commentAuthor)
void setCommentAuthorEmail ( $authorEmail)
void setCommentAuthorURL ( $authorURL)
void setCommentContent ( $commentBody)
void setCommentType ( $commentType)
void setPermalink (string $permalink)
void setReferrer (string $referrer)
void setUserIP (string $userip)
void submitHam ()
void submitSpam ()
Methods
Constructor __construct (line 83)
  • throws: Exception An exception is thrown if your API key is invalid.
  • access: public
Akismet __construct (string $blogURL,  $wordPressAPIKey)
  • string $blogURL: Your WordPress API key.
  • $wordPressAPIKey

Redefined in descendants as:
isCommentSpam (line 167)

Tests for spam.

Uses the web service provided by Akismet to see whether or not the submitted comment is spam. Returns a boolean value.

  • return: True if the comment is spam, false if not
  • access: public
bool isCommentSpam ()
setAkismetServer (line 279)

Defaults to rest.akismet.com

  • access: public
void setAkismetServer ( $akismetServer)
  • $akismetServer
setAkismetVersion (line 287)

Defaults to '1.1'

  • access: public
void setAkismetVersion ( $akismetVersion)
  • $akismetVersion
setAPIPort (line 271)

Defaults to 80

  • access: public
void setAPIPort ( $apiPort)
  • $apiPort
setCommentAuthor (line 237)

The name that the author submitted with the comment.

  • access: public
void setCommentAuthor ( $commentAuthor)
  • $commentAuthor
setCommentAuthorEmail (line 247)

The email address that the author submitted with the comment.

The address is assumed to be valid.

  • access: public
void setCommentAuthorEmail ( $authorEmail)
  • $authorEmail
setCommentAuthorURL (line 255)

The URL that the author submitted with the comment.

  • access: public
void setCommentAuthorURL ( $authorURL)
  • $authorURL
setCommentContent (line 263)

The comment's body text.

  • access: public
void setCommentContent ( $commentBody)
  • $commentBody
setCommentType (line 229)

The type of comment being submitted.

May be blank, comment, trackback, pingback, or a made up value like "registration" or "wiki".

  • access: public
void setCommentType ( $commentType)
  • $commentType
setPermalink (line 219)

A permanent URL referencing the blog post the comment was submitted to.

  • access: public
void setPermalink (string $permalink)
  • string $permalink: The URL. Optional.
setReferrer (line 209)

To override the referring page when submitting spam/ham later on

  • access: public
void setReferrer (string $referrer)
  • string $referrer: The referring page. Optional.
setUserIP (line 199)

To override the user IP address when submitting spam/ham later on

  • access: public
void setUserIP (string $userip)
  • string $userip: An IP address. Optional.
submitHam (line 189)

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.

  • access: public
void submitHam ()
submitSpam (line 179)

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.

  • access: public
void submitSpam ()
blog comments powered by Disqus

Documentation generated on Tue, 07 Oct 2008 15:54:31 +1300 by phpDocumentor 1.3.2