AkismetComment

open class AkismetComment(val userIp: String, val userAgent: String)

A comment to send to Akismet.

Most everything is optional. Performance can drop dramatically if you choose to exclude data points. The more data you send Akismet about each comment, the greater the accuracy. They recommend erring on the side of including too much data.

See the Akismet API for more details.

Parameters

userIp

IP address of the comment submitter.

userAgent

User agent string of the web browser submitting the comment.

Constructors

Link copied to clipboard
fun AkismetComment(request: HttpServletRequest)

Creates a new instance extracting the userIp, userAgent, referrer and serverEnv environment variables from a Servlet request.

Link copied to clipboard
fun AkismetComment(userIp: String, userAgent: String)

Creates a new instance.

Types

Link copied to clipboard
object Companion

Functions

Link copied to clipboard
open operator override fun equals(other: Any?): Boolean

Indicates whether some other object is equal to this one.

Link copied to clipboard
open override fun hashCode(): Int

Returns a hash code value for the object.

Link copied to clipboard
fun toJson(): String

Returns a JSON representation of the comment.

Link copied to clipboard
open override fun toString(): String

Returns a JSON representation of the comment.

Properties

Link copied to clipboard
var author: String?

Name submitted with the comment.

Link copied to clipboard
var authorEmail: String?

Email address submitted with the comment.

Link copied to clipboard
var authorUrl: String?

URL submitted with comment.

Link copied to clipboard
var blogCharset: String?

The character encoding for the form values included in comment parameters, such as UTF-8 or ISO-8859-1

Link copied to clipboard
var blogLang: String?

Indicates the language(s) in use on the blog or site, in ISO 639-1 format, comma-separated.

Link copied to clipboard
var content: String?

The content that was submitted.

Link copied to clipboard
var dateGmt: String?

The UTC timestamp of the creation of the comment, in ISO 8601 format.

Link copied to clipboard
var isTest: Boolean = false

This is an optional parameter. You can use it when submitting test queries to Akismet.

Link copied to clipboard
var permalink: String?

The full permanent URL of the entry the comment was submitted to.

Link copied to clipboard
var postModifiedGmt: String?

The UTC timestamp of the publication time for the post, page or thread on which the comment was posted.

Link copied to clipboard
var recheckReason: String?

If you are sending content to Akismet to be rechecked, such as a post that has been edited or old pending comments that you'd like to recheck, include this parameter with a string describing why the content is being rechecked.

Link copied to clipboard
var referrer: String?

The content of the referer header should be set here.

Link copied to clipboard
var serverEnv: Map<String, String>

In PHP, there is an array of environmental variables called $_SERVER that contains information about the Web server itself as well as a key/value for every HTTP header sent with the request. This data is highly useful to Akismet.

Link copied to clipboard
var type: String?

A string that describes the type of content being sent, such as:

Link copied to clipboard
val userAgent: String
Link copied to clipboard
val userIp: String
Link copied to clipboard
var userRole: String?

The user role of the user who submitted the comment. This is an optional parameter.

Sources

Link copied to clipboard