Class Zend_Service_Akismet

Description

Akismet REST service implementation

Located in /Service/Akismet.php (line 45)

Zend_Service_Abstract
   |
   --Zend_Service_Akismet
Variable Summary
 string $_apiKey
 string $_blogUrl
 string $_charset
 int $_port
 string $_userAgent
Method Summary
 void __construct (string $apiKey, string $blog)
 string getApiKey ()
 string getBlogUrl ()
 string getCharset ()
 int getPort ()
 string getUserAgent ()
 boolean isSpam (array $params)
 Zend_Service_Akismet setApiKey (string $apiKey)
 Zend_Service_Akismet setBlogUrl (string $blogUrl)
 Zend_Service_Akismet setCharset (string $charset)
 Zend_Service_Akismet setUserAgent (string $userAgent)
 void submitHam (array $params)
 void submitSpam (array $params)
 boolean verifyKey ([string $key = null], [string $blog = null])
 Zend_Http_Response _makeApiCall (string $path, array $params)
 mixed _post (string $host, string $path,  $params)
Variables
string $_apiKey (line 51)

Akismet API key

  • access: protected
string $_blogUrl (line 57)

Blog URL

  • access: protected
string $_charset = 'UTF-8' (line 63)

Charset used for encoding

  • access: protected
int $_port = 80 (line 69)

TCP/IP port to use in requests

  • access: protected
string $_userAgent (line 75)

User Agent string to send in requests

  • access: protected

Inherited Variables

Inherited from Zend_Service_Abstract

Zend_Service_Abstract::$_httpClient
Methods
Constructor __construct (line 84)

Constructor

  • access: public
void __construct (string $apiKey, string $blog)
  • string $apiKey: Akismet API key
  • string $blog: Blog URL
getApiKey (line 125)

Retrieve API key

  • access: public
string getApiKey ()
getBlogUrl (line 96)

Retrieve blog URL

  • access: public
string getBlogUrl ()
getCharset (line 147)

Retrieve charset

  • access: public
string getCharset ()
getPort (line 169)

Retrieve TCP/IP port

  • access: public
int getPort ()
getUserAgent (line 197)

Retrieve User Agent string

  • access: public
string getUserAgent ()
isSpam (line 324)

Check a comment for spam

Checks a comment to see if it is spam. $params should be an associative array with one or more of the following keys (unless noted, all keys are optional):

  • blog: URL of the blog. If not provided, uses value returned by getBlogUrl()
  • user_ip (required): IP address of comment submitter
  • user_agent (required): User Agent used by comment submitter
  • referrer: contents of HTTP_REFERER header
  • permalink: location of the entry to which the comment was submitted
  • comment_type: typically, one of 'blank', 'comment', 'trackback', or 'pingback', but may be any value
  • comment_author: name submitted with the content
  • comment_author_email: email submitted with the content
  • comment_author_url: URL submitted with the content
  • comment_content: actual content
Additionally, Akismet suggests returning the key/value pairs in the $_SERVER array, and these may be included in the $params.

This method implements the Akismet comment-check REST method.

  • throws: Zend_Service_Exception with invalid API key
  • access: public
boolean isSpam (array $params)
  • array $params
setApiKey (line 136)

Set API key

  • access: public
Zend_Service_Akismet setApiKey (string $apiKey)
  • string $apiKey
setBlogUrl (line 108)

Set blog URL

  • throws: Zend_Service_Exception if invalid URL provided
  • access: public
Zend_Service_Akismet setBlogUrl (string $blogUrl)
  • string $blogUrl
setCharset (line 158)

Set charset

  • access: public
Zend_Service_Akismet setCharset (string $charset)
  • string $charset
setPort (line 181)

Set TCP/IP port

  • throws: Zend_Service_Exception if non-integer value provided
  • access: public
Zend_Service_Akismet setPort (int $port)
  • int $port
setUserAgent (line 211)

Set User Agent

Should be of form "Some user agent/version | Akismet/version"

  • throws: Zend_Service_Exception with invalid user agent string
  • access: public
Zend_Service_Akismet setUserAgent (string $userAgent)
  • string $userAgent
submitHam (line 383)

Submit ham

Takes the same arguments as isSpam().

Submits a comment that has been falsely categorized as spam by Akismet as a false positive, telling Akismet's filters not to filter such comments as spam in the future.

Unlike submitSpam() and isSpam(), a valid API key is never necessary; as a result, this method never throws an exception (unless an exception happens with the HTTP client layer).

this method implements Akismet's submit-ham REST method.

  • access: public
void submitHam (array $params)
  • array $params
submitSpam (line 355)

Submit spam

Takes the same arguments as isSpam().

Submits known spam content to Akismet to help train it.

This method implements Akismet's submit-spam REST method.

  • throws: Zend_Service_Exception with invalid API key
  • access: public
void submitSpam (array $params)
  • array $params
verifyKey (line 258)

Verify an API key

  • access: public
boolean verifyKey ([string $key = null], [string $blog = null])
  • string $key: Optional; API key to verify
  • string $blog: Optional; blog URL against which to verify key
_makeApiCall (line 284)

Perform an API call

  • throws: Zend_Service_Exception if missing user_ip or user_agent fields
  • access: protected
Zend_Http_Response _makeApiCall (string $path, array $params)
  • string $path
  • array $params
_post (line 232)

Post a request

  • access: protected
mixed _post (string $host, string $path,  $params)
  • string $host
  • string $path
  • array $params

Inherited Methods

Inherited From Zend_Service_Abstract

 Zend_Service_Abstract::getHttpClient()
 Zend_Service_Abstract::setHttpClient()

Documentation generated on Mon, 21 Jun 2010 15:06:56 -0400 by phpDocumentor 1.4.3