Documentation

Akismet extends AkismetObject
in package

Table of Contents

Properties

$akismetServer  : mixed
$akismetVersion  : mixed
$apiKey  : mixed
$apiPort  : mixed
$blogUrl  : mixed
$comment  : mixed
$errors  : mixed
$http  : mixed
$ignore  : mixed

Methods

__construct()  : Akismet
Constructor
_fillCommentValues()  : void
Fill any values not provided by the developer with available values.
_formatCommentArray()  : void
Format the comment array in accordance to the Akismet API
_getQueryString()  : string
Build a query string for use with HTTP requests
_isValidApiKey()  : bool
Check with the Akismet server to determine if the API key is valid
errorsExist()  : bool
Check if any errors exist
getComment()  : array<string|int, mixed>
Returns the current value of the object's comment array.
getError()  : mixed
Return a specific error message from the errors array
getErrors()  : array<string|int, string>
Return all errors in the object
isError()  : bool
Check if a certain error exists
isSpam()  : bool
Query the Akismet and determine if the comment is spam or not
setComment()  : void
Manually set the comment value of the instantiated object.
setError()  : void
Add a new error to the errors array in the object
submitHam()  : void
Submit a false-positive comment as "ham" to the Akismet server
submitSpam()  : void
Submit this comment as an unchecked spam to the Akismet server

Properties

$akismetServer

public mixed $akismetServer = 'rest.akismet.com'

$akismetVersion

public mixed $akismetVersion = '1.1'

$apiPort

public mixed $apiPort = 80

$blogUrl

public mixed $blogUrl = ""

$comment

public mixed $comment = array()

$errors

public mixed $errors = array()

$ignore

public mixed $ignore = array('HTTP_COOKIE', 'HTTP_X_FORWARDED_FOR', 'HTTP_X_FORWARDED_HOST', 'HTTP_MAX_FORWARDS', 'HTTP_X_FORWARDED_SERVER', 'REDIRECT_STATUS', 'SERVER_PORT', 'PATH', 'DOCUMENT_ROOT', 'SERVER_ADMIN', 'QUERY_STRING', 'PHP_SELF', 'argv')

Methods

__construct()

Constructor

public __construct(string $blogUrl, string $apiKey[, array<string|int, string> $comment = array() ]) : Akismet

Set instance variables, connect to Akismet, and check API key

Parameters
$blogUrl : string

The URL to your own blog

$apiKey : string

Your wordpress API key

$comment : array<string|int, string> = array()

A formatted comment array to be examined by the Akismet service

Return values
Akismet

_fillCommentValues()

Fill any values not provided by the developer with available values.

public _fillCommentValues() : void

_formatCommentArray()

Format the comment array in accordance to the Akismet API

public _formatCommentArray() : void
Tags
access

Protected

_getQueryString()

Build a query string for use with HTTP requests

public _getQueryString() : string
Tags
access

Protected

Return values
string

_isValidApiKey()

Check with the Akismet server to determine if the API key is valid

public _isValidApiKey(string $key) : bool
Parameters
$key : string

The Wordpress API key passed from the constructor argument

Tags
access

Protected

Return values
bool

errorsExist()

Check if any errors exist

public errorsExist() : bool
Return values
bool

getComment()

Returns the current value of the object's comment array.

public getComment() : array<string|int, mixed>
Return values
array<string|int, mixed>

getError()

Return a specific error message from the errors array

public getError(string $name) : mixed
Parameters
$name : string

The name of the error you want

Return values
mixed

Returns a String if the error exists, a false boolean if it does not exist

getErrors()

Return all errors in the object

public getErrors() : array<string|int, string>
Return values
array<string|int, string>

isError()

Check if a certain error exists

public isError(string $name) : bool
Parameters
$name : string

The name of the error you want

Return values
bool

isSpam()

Query the Akismet and determine if the comment is spam or not

public isSpam() : bool
Return values
bool

setComment()

Manually set the comment value of the instantiated object.

public setComment(array<string|int, mixed> $comment) : void
Parameters
$comment : array<string|int, mixed>

setError()

Add a new error to the errors array in the object

public setError(string $name, mixed $message) : void
Parameters
$name : string

A name (array key) for the error

$message : mixed

submitHam()

Submit a false-positive comment as "ham" to the Akismet server

public submitHam() : void

submitSpam()

Submit this comment as an unchecked spam to the Akismet server

public submitSpam() : void

        
On this page

Search results