Textpattern PHP Cross Reference Content Management Systems

Summary: /textpattern/publish/comment.php - 702 lines - 18714 bytes - Source - Print

Description: Collection of comment tools.

Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

comment_evaluation:: (11 methods):
__construct()
add_estimate()
get_result()
get_result_message()
write_trace()
get_comment_evaluator()
checkNonce()
checkCommentsAllowed()
comments_help()
mail_comment()
input()

Defines 11 functions

fetchComments()
getNextNonce()
getNextSecret()
setCookies()
destroyCookies()
getComment()
saveComment()
checkCommentRequired()

Class: comment_evaluation

Comment evaluator.

Validates and filters comments. Keeps out spam.

__construct()  line: 361
Constructor.

add_estimate($type = SPAM, $probability = 0.75, $msg = '')  line: 394
Adds an estimate about the comment's status.

param: int    $type        The status, either SPAM, MODERATE, VISIBLE or  RELOAD
param: float  $probability Estimates probability - throughout 0 to 1, e.g. 0.75
param: string $msg         The error or success message shown to the user
get_result($result_type = 'numeric')  line: 423
Gets resulting estimated status.

return: int|string
param: string $result_type If 'numeric' returns the ID of the status, a localised label otherwise
get_result_message()  line: 449
Gets resulting success or error message.

return: array
write_trace()  line: 463
Writes a debug log.

get_comment_evaluator()  line: 493
Gets a comment evaluator instance.

return: comment_evaluation
checkNonce($nonce line: 511
Verifies a given nonce.

This function will also do clean up and deletes expired nonces.

return: bool TRUE if the nonce is valid
param: string $nonce The nonce
checkCommentsAllowed($id line: 534
Checks if comments are open for the given article.

return: bool FALSE if comments are closed
param: int $id The article.
comments_help()  line: 583
Renders a Textile help link.

return: string HTML
mail_comment($message, $cname, $cemail, $cweb, $parentid, $discussid line: 594
Emails a new comment to the article's author.

This function can only be executed directly after a comment was sent,
otherwise it will not run properly.

Will not send comments flagged as spam, and follows site's
comment preferences.

param: string $message   The comment message
param: string $cname     The comment name
param: string $cemail    The comment email
param: string $cweb      The comment website
param: int    $parentid  The article ID
param: int    $discussid The comment ID
input($type, $name, $val, $size = '', $class = '', $tab = '', $chkd = '')  line: 668
Renders a HTML input.

Deprecated, use fInput() instead.

return: string
param: string $type
param: string $name
param: string $val
param: int    $size
param: string $class
param: int    $tab
param: bool   $chkd

Functions

Functions that are not part of a class:

fetchComments($id line: 30
Gets comments as an array from the given article.

return: array|null An array of comments, or NULL on error
param: int $id The article ID
getNextNonce($check_only = false)  line: 55
Gets next nonce.

return: string A random MD5 hash
param: bool $check_only
getNextSecret($check_only = false)  line: 73
Gets next secret.

return: string A random MD5 hash
param: bool $check_only
setCookies($name, $email, $web line: 91
Remembers comment form values.

Creates a HTTP cookie for each value.

param: string $name  The name
param: string $email The email address
param: string $web   The website
destroyCookies()  line: 112
Deletes HTTP cookies created by the comment form.

getComment($obfuscated = false)  line: 127
Gets the received comment.

Comment spam filter plugins should call this function to fetch
comment contents.

return: array
saveComment()  line: 181
Saves a comment.

checkCommentRequired($comment line: 294
Checks if all required comment fields are filled out.

To be used only by TXP itself

param: array comment fields (from getComment())

title

Body