Textpattern PHP Cross Reference Content Management Systems

Summary: /textpattern/publish/comment.php - 687 lines - 18020 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: 363
Constructor.

add_estimate($type = SPAM, $probability = 0.75, $msg = '')  line: 396
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: 425
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: 451
Gets resulting success or error message.

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

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

return: comment_evaluation
checkNonce($nonce line: 513
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: 536
Checks if comments are open for the given article.

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

return: string HTML
mail_comment($message, $cname, $cemail, $cweb, $parentid, $discussid line: 596
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: 657
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: 31
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: 56
Gets next nonce.

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

return: string A random MD5 hash
param: bool $check_only
setCookies($name, $email, $web line: 92
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: 113
Deletes HTTP cookies created by the comment form.

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

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

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

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

To be used only by TXP itself

param: array comment fields (from getComment())

title

Body