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

Class: Services_Akismet2_Comment

Source Location: /Services_Akismet2-0.3.1/Services/Akismet2/Comment.php

Class Overview


Akismet comment


Author(s):

Copyright:

  • 2007-2008 Bret Kuhns, 2008 silverorange

Variables

Methods


Inherited Variables

Inherited Methods


Class Details

[line 86]
Akismet comment

Example usage using initial array of values:

  1.  $comment = new Services_Akismet2_Comment(array(
  2.      'comment_author'       => 'Test Author',
  3.      'comment_author_email' => 'test@example.com',
  4.      'comment_author_url'   => 'http://example.com/',
  5.      'comment_content'      => 'Hello, World!'
  6.  ));
  7.  
  8.  echo $comment;

Example usage using fluent interface:

  1.  $comment = new Services_Akismet2_Comment();
  2.  $comment->setAuthor('Test Author')
  3.          ->setAuthorEmail('test@example.com')
  4.          ->setAuthorUri('http://example.com/')
  5.          ->setContent('Hello, World!');
  6.  ));
  7.  
  8.  echo $comment;



[ Top ]


Class Variables

$fields = array()

[line 97]

Fields of this comment
  • See: comment-check
  • Access: protected

Type:   array


[ Top ]



Method Detail

__construct (Constructor)   [line 211]

Services_Akismet2_Comment __construct( [array $fields = array()])

Creates a new comment

Comments can be initialized from an array of named values. Available names are:

  • string comment_author - the name of the comment author.
  • string comment_author_email - the email address of the comment author.
  • string comment_author_url - a link provided by the comment author.
  • string comment_content - the content of the comment.
  • string comment_type - the comment type. Either comment, trackback, pingback, or a a made-up value.
  • string permalink - permalink of the article to which the comment is being added.
  • string referrer - HTTP referrer. If not specified, the HTTP referrer of the current request is used.
  • string user_ip - IP address from which the comment was submitted. If not specified the remote IP address of the current request is used.
  • string user_agent - the HTTP user agent used to submit the comment. If not specified, the user agent of the current request is used.
If not specified, the user_ip, user_agent and referrer fields are defaulted to the current request values if possible. They may be changed either by specifying them here or by using the appropriate setter method.

Field names not included in the above list are allowed. The Akismet API can make use of any extra identifying information provided.

  • See: comment-check
  • Access: public

Parameters:

array   $fields   —  optional. An array of initial fields.

[ Top ]

getPostParameters   [line 284]

array getPostParameters( [boolean $autoSetServerFields = false])

Gets the fields of this comment as an array of name-value pairs for use in an Akismet API method
  • Return: the fields of this comment as an array of name-value pairs suitable for usage in an Akismet API method.
  • See: comment-check
  • Throws: Services_Akismet2_InvalidCommentException if this comment is missing required fields.
  • Access: public

Parameters:

boolean   $autoSetServerFields   —  optional. Whether or not to automatically set server-related fields. Defaults to false.

[ Top ]

setAuthor   [line 385]

Services_Akismet2_Comment setAuthor( string $author)

Sets the author of this comment
  • Return: the comment object.
  • Access: public

Parameters:

string   $author   —  the author of this comment.

[ Top ]

setAuthorEmail   [line 400]

Services_Akismet2_Comment setAuthorEmail( string $email)

Sets the email address of the author of this comment
  • Return: the comment object.
  • Access: public

Parameters:

string   $email   —  the email address of the author of this comment.

[ Top ]

setAuthorUrl   [line 415]

Services_Akismet2_Comment setAuthorUrl( string $url)

Sets the URI of the author of this comment
  • Return: the comment object.
  • Access: public

Parameters:

string   $url   —  the URI of the author of this comment.

[ Top ]

setContent   [line 430]

Services_Akismet2_Comment setContent( string $content)

Sets the content of this comment
  • Return: the comment object.
  • Access: public

Parameters:

string   $content   —  the content of this comment.

[ Top ]

setField   [line 327]

Services_Akismet2_Comment setField( string $name, string $value)

Sets a field of this comment

Common fields as described in the Akismet API have setter methods provided. This method may be used to set custom fields not covered by the common field setter methods.

  • Return: the comment object.
  • Access: public

Parameters:

string   $name   —  the name of the field.
string   $value   —  the value of the field.

[ Top ]

setFields   [line 351]

Services_Akismet2_Comment setFields( array $fields)

Sets multiple fields of this comment

Note: Common fields as described in the Akismet API have setter methods provided. The setter methods may be optionally used instead.

  • Return: the comment object.
  • Access: public

Parameters:

array   $fields   —  an associative array of name-value pairs. The field name is the array key and the field value is the array value. See Services_Akismet2_Comment::__construct() for a list of common field names.

[ Top ]

setHttpReferrer   [line 514]

Services_Akismet2_Comment setHttpReferrer( string $httpReferrer)

Sets the HTTP referer of the user posting this comment

The HTTP referer is automatically set to the HTTP referer from the current page request when this comment is created. Use this method to set the HTTP referer to something different or if the current request does not have a HTTP referer set.

  • Return: the comment object.
  • Access: public

Parameters:

string   $httpReferrer   —  the HTTP referer of the user posting this comment.

[ Top ]

setPostPermalink   [line 451]

Services_Akismet2_Comment setPostPermalink( string $url)

Sets the permalink of the post to which this comment is being added

A permalink is a URI that points to a specific weblog post and does not change over time. Permalinks are intended to prevent link rot. Akismet does not require the permalink field but can use it to improve spam detection accuracy.

  • Return: the comment object.
  • Access: public

Parameters:

string   $url   —  the permalink of the post to which this comment is being added.

[ Top ]

setType   [line 370]

Services_Akismet2_Comment setType( string $type)

Sets the type of this comment
  • Return: the comment object.
  • Access: public

Parameters:

string   $type   —  the type of this comment.

[ Top ]

setUserAgent   [line 493]

Services_Akismet2_Comment setUserAgent( string $userAgent)

Sets the user agent of the user posting this comment

The user agent is automatically set to the user agent from the current page request when this comment is created. Use this method to set the user agent to something different or if the current request does not have a user agent set.

  • Return: the comment object.
  • Access: public

Parameters:

string   $userAgent   —  the user agent of the user posting this comment.

[ Top ]

setUserIp   [line 472]

Services_Akismet2_Comment setUserIp( string $ipAddress)

Sets the IP address of the user posting this comment

The IP address is automatically set to the IP address from the current page request when this comment is created. Use this method to set the IP address to something different or if the current request does not have an IP address set.

  • Return: the comment object.
  • Access: public

Parameters:

string   $ipAddress   —  the IP address of the user posting this comment.

[ Top ]

__toString   [line 241]

string __toString( )

Gets a string representation of this comment

This is useful for debugging. All the set fields of this comment are returned.

  • Return: a string representation of this comment.
  • Access: public

[ Top ]


Documentation generated on Mon, 11 Mar 2019 15:40:49 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.