API Documentation

Service/Akismet.php

Includes Classes 
category
Zend
copyright
Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
license
http://framework.zend.com/license/new-bsd New BSD License
package
Zend_Service
subpackage
Akismet
version
$Id: Akismet.php 20096 2010-01-06 02:05:09Z bkarwin $
Classes
Zend_Service_Akismet

Description

Zend Framework

LICENSE

This source file is subject to the new BSD license that is bundled with this package in the file LICENSE.txt. It is also available through the world-wide-web at this URL: http://framework.zend.com/license/new-bsd If you did not receive a copy of the license and are unable to obtain it through the world-wide-web, please send an email to license@zend.com so we can send you a copy immediately.

Zend_Service_Akismet

Extends from
Zend_Service_Abstract
category
Zend
copyright
Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
license
http://framework.zend.com/license/new-bsd New BSD License
package
Zend_Service
subpackage
Akismet
uses
Zend_Service_Abstract
Properties
$_apiKey
$_blogUrl
$_charset
$_port
$_userAgent
Methods
__construct
getBlogUrl
setBlogUrl
getApiKey
setApiKey
getCharset
setCharset
getPort
setPort
getUserAgent
setUserAgent
_post
verifyKey
_makeApiCall
isSpam
submitSpam
submitHam

Description

Akismet REST service implementation

Properties

$_apiKey

string $_apiKey = ''

Akismet API key

Details

$_apiKey
string
visibility
protected
default
final
false
static
false

$_blogUrl

string $_blogUrl = ''

Blog URL

Details

$_blogUrl
string
visibility
protected
default
final
false
static
false

$_charset

string $_charset = 'UTF-8'

Charset used for encoding

Details

$_charset
string
visibility
protected
default
UTF-8
final
false
static
false

$_port

int $_port = '80'

TCP/IP port to use in requests

Details

$_port
int
visibility
protected
default
80
final
false
static
false

$_userAgent

string $_userAgent = ''

User Agent string to send in requests

Details

$_userAgent
string
visibility
protected
default
final
false
static
false

Methods

__construct

__construct( string $apiKey, string $blog ) : void

Constructor

Arguments
$apiKey
string
Akismet API key
$blog
string
Blog URL
Details
visibility
public
final
false
static
false

_makeApiCall

_makeApiCall( string $path, array $params ) : Zend_Http_Response

Perform an API call

Arguments
$path
string
$params
array
Details
visibility
protected
final
false
static
false
throws
if missing user_ip or user_agent fields

_post

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

Post a request

Arguments
$host
string
$path
string
$params
array
Output
mixed
Details
visibility
protected
final
false
static
false

getApiKey

getApiKey( ) : string

Retrieve API key

Output
string
Details
visibility
public
final
false
static
false

getBlogUrl

getBlogUrl( ) : string

Retrieve blog URL

Output
string
Details
visibility
public
final
false
static
false

getCharset

getCharset( ) : string

Retrieve charset

Output
string
Details
visibility
public
final
false
static
false

getPort

getPort( ) : int

Retrieve TCP/IP port

Output
int
Details
visibility
public
final
false
static
false

getUserAgent

getUserAgent( ) : string

Retrieve User Agent string

Output
string
Details
visibility
public
final
false
static
false

isSpam

isSpam( array $params ) : boolean

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 {@link 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.

Arguments
$params
array
Output
boolean
Details
visibility
public
final
false
static
false
throws
with invalid API key

setApiKey

setApiKey( string $apiKey ) : Zend_Service_Akismet

Set API key

Arguments
$apiKey
string
Details
visibility
public
final
false
static
false

setBlogUrl

setBlogUrl( string $blogUrl ) : Zend_Service_Akismet

Set blog URL

Arguments
$blogUrl
string
Details
visibility
public
final
false
static
false
throws
if invalid URL provided

setCharset

setCharset( string $charset ) : Zend_Service_Akismet

Set charset

Arguments
$charset
string
Details
visibility
public
final
false
static
false

setPort

setPort( int $port ) : Zend_Service_Akismet

Set TCP/IP port

Arguments
$port
int
Details
visibility
public
final
false
static
false
throws
if non-integer value provided

setUserAgent

setUserAgent( string $userAgent ) : Zend_Service_Akismet

Set User Agent

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

Arguments
$userAgent
string
Details
visibility
public
final
false
static
false
throws
with invalid user agent string

submitHam

submitHam( array $params ) : void

Submit ham

Takes the same arguments as {@link 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 {@link submitSpam()} and {@link 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.

Arguments
$params
array
Details
visibility
public
final
false
static
false

submitSpam

submitSpam( array $params ) : void

Submit spam

Takes the same arguments as {@link isSpam()}.

Submits known spam content to Akismet to help train it.

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

Arguments
$params
array
Details
visibility
public
final
false
static
false
throws
with invalid API key

verifyKey

verifyKey( string $key = null, string $blog = null ) : boolean

Verify an API key

Arguments
$key
string
Optional; API key to verify
$blog
string
Optional; blog URL against which to verify key
Output
boolean
Details
visibility
public
final
false
static
false
Documentation was generated by DocBlox.