[ class tree: plugins ] [ index: plugins ] [ all elements ]

Class: Akismet

Source Location: /plugins/spamfilters/akismet.php

Class Akismet

Class Overview

01.26.2006 12:29:28est

Akismet PHP4 class

Base class to assist in error handling between Akismet classes

Usage

  1.     $comment array(
  2.            'author'    => 'viagra-test-123',
  3.            'email'     => 'test@example.com',
  4.            'website'   => 'http://www.example.com/',
  5.            'body'      => 'This is a test comment',
  6.            'permalink' => 'http://yourdomain.com/yourblogpost.url',
  7.         );
  8.  
  9.     $akismet new Akismet('http://www.yourdomain.com/''YOUR_WORDPRESS_API_KEY'$comment);
  10.  
  11.     if($akismet->isError()) {
  12.         echo"Couldn't connected to Akismet server!";
  13.     else {
  14.         if($akismet->isSpam()) {
  15.             echo"Spam detected";
  16.         else {
  17.             echo"yay, no spam!";
  18.         }
  19.     }

Located in /plugins/spamfilters/akismet.php [line 295]

AkismetObject
   |
   --Akismet
Author(s):
  • Bret Kuhns www.miphp.net
Information Tags:
Version:  0.3.3

Properties

Methods

[ Top ]
Inherited Properties, Constants, and Methods
Inherited Properties Inherited Methods Inherited Constants

Inherited From AkismetObject

AkismetObject::$errors

Inherited From AkismetObject

AkismetObject::errorsExist()
Check if any errors exist
AkismetObject::getError()
Return a specific error message from the errors array
AkismetObject::getErrors()
Return all errors in the object
AkismetObject::isError()
Check if a certain error exists
AkismetObject::setError()
Add a new error to the errors array in the object

[ Top ]
Property Summary
mixed   $akismetServer  
mixed   $akismetVersion  
mixed   $apiKey  
mixed   $apiPort  
mixed   $blogUrl  
mixed   $comment  
mixed   $http  
mixed   $ignore  

[ Top ]
Method Summary
Akismet   Akismet()   Constructor
boolean   isSpam()   Query the Akismet and determine if the comment is spam or not
void   submitHam()   Submit a false-positive comment as "ham" to the Akismet server
void   submitSpam()   Submit this comment as an unchecked spam to the Akismet server
void   _formatCommentArray()   Format the comment array in accordance to the Akismet API
String   _getQueryString()   Build a query string for use with HTTP requests
boolean   _isValidApiKey()   Check with the Akismet server to determine if the API key is valid

[ Top ]
Properties
mixed   $akismetServer = 'rest.akismet.com' [line 297]

[ Top ]
mixed   $akismetVersion = '1.1' [line 298]

[ Top ]
mixed   $apiKey = "" [line 318]

[ Top ]
mixed   $apiPort = 80 [line 296]

[ Top ]
mixed   $blogUrl = "" [line 317]

[ Top ]
mixed   $comment = array() [line 319]

[ Top ]
mixed   $http [line 299]

[ Top ]
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'
)
[line 301]

[ Top ]
Methods
Constructor Akismet  [line 331]

  Akismet Akismet( String $blogUrl, String $apiKey, String[] $comment  )

Constructor

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

Parameters:
String   $blogUrl:  The URL to your own blog
String   $apiKey:  Your wordpress API key
String[]   $comment:  A formatted comment array to be examined by the Akismet service


[ Top ]
isSpam  [line 368]

  boolean isSpam( )

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



[ Top ]
submitHam  [line 390]

  void submitHam( )

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



[ Top ]
submitSpam  [line 380]

  void submitSpam( )

Submit this comment as an unchecked spam to the Akismet server



[ Top ]
_formatCommentArray  [line 415]

  void _formatCommentArray( )

Format the comment array in accordance to the Akismet API


API Tags:
Access:  protected


[ Top ]
_getQueryString  [line 439]

  String _getQueryString( )

Build a query string for use with HTTP requests


API Tags:
Access:  protected


[ Top ]
_isValidApiKey  [line 402]

  boolean _isValidApiKey( String $key  )

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

Parameters:
String   $key:  The Wordpress API key passed from the constructor argument

API Tags:
Access:  protected


[ Top ]

Documentation generated on Tue, 30 Sep 2008 20:23:10 +0200 by phpDocumentor 1.4.1