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

Class: Services_Akismet2_Comment

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

Class Overview


Akismet comment


Author(s):

Copyright:

  • 2007-2008 Bret Kuhns, 2008 silverorange

Methods


Inherited Variables

Inherited Methods


Class Details

[line 73]
Akismet comment

Example usage using initial array of values:

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



[ Top ]


Method Detail

__construct (Constructor)   [line 180]

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 author - the name of the author.
  • string authorEmail - the email addedd of the author.
  • string authorUri - a link provided by the comment author.
  • string content - the content of the comment.
  • string permalink - permalink of the post to which the comment is being added.
  • string referrer - HTTP referrer. If not specified, the HTTP referrer of the current request is used.
  • string type - the comment type.
  • string userIp - IP address from which the comment was submitted. If not specified the remote IP address of the current request is used.
  • string userAgent - the HTTP user agent used to post the comment. If not specified, the user agent of the current request is used.
If not specified, the 'userIp', 'userAgent' and 'referrer' fields are defaulted to the current request values if possible. They may be changed by calling the appropriate setter method.

  • Access: public

Parameters:

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

[ Top ]

getPostParameters   [line 276]

array getPostParameters( )

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

[ Top ]

setAuthor   [line 332]

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 353]

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 ]

setAuthorUri   [line 374]

Services_Akismet2_Comment setAuthorUri( string $uri)

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

Parameters:

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

[ Top ]

setContent   [line 395]

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 ]

setHttpReferer   [line 503]

Services_Akismet2_Comment setHttpReferer( string $httpReferer)

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   $httpReferer   —  the HTTP referer of the user posting this comment.

[ Top ]

setPostPermalink   [line 422]

Services_Akismet2_Comment setPostPermalink( string $uri)

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   $uri   —  the permalink of the post to which this comment is being added.

[ Top ]

setType   [line 311]

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 476]

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 449]

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 245]

string __toString( )

Gets a string representation of this comment

This is useful for debugging. All the set fields of this comment are returned as well as the results of Services_Akismet2_Comment::getPostData().

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

[ Top ]


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