Public Member Functions | Static Public Member Functions | Static Public Attributes

Comment Class Reference

Inheritance diagram for Comment:
Collaboration diagram for Comment:

List of all members.

Public Member Functions

 __construct ($paramarray=array())
 insert ()
 update ()
 delete ()
 __get ($name)
 __set ($name, $value)
 content_type ()
 get_access ($user=null)
 css_class ($append=array())

Static Public Member Functions

static default_fields ()
static __static ()
static get ($id=0)
static create ($paramarray)
static add_type ($type)
static add_status ($status, $internal=false)
static remove_type ($type, $delete=false)
static remove_status ($status, $newstatus=null)
static list_comment_types ($refresh=false)
static list_comment_statuses ($refresh=false)
static status_action ($status)
static status ($name)
static status_name ($status)
static type ($name)
static type_name ($type)
static filter_comment_type_display_4 ($type, $foruse)
static filter_comment_status_display_4 ($status)

Static Public Attributes

static $comment_status_list = array()
static $comment_type_list = array()
static $comment_status_actions = array()

Detailed Description

Definition at line 35 of file comment.php.


Constructor & Destructor Documentation

Comment::__construct ( paramarray = array()  ) 

Constructor for the Comment class.

Parameters:
array $paramarray an associative array of initial Post field values.

Definition at line 70 of file comment.php.


Member Function Documentation

Comment::__get ( name  ) 

Overrides QueryRecord __get to implement custom object properties

Parameters:
string $name Name of property to return
Returns:
mixed The requested field value

Definition at line 290 of file comment.php.

Comment::__set ( name,
value 
)

Overrides QueryRecord __set to implement custom object properties

Parameters:
string $name Name of property to set
mixed $value Value of the property
Returns:
mixed The set field value

Definition at line 364 of file comment.php.

static Comment::__static (  )  [static]

Register plugin hooks

Definition at line 82 of file comment.php.

static Comment::add_status ( status,
internal = false 
) [static]

Register a new comment status

Parameters:
string $status The name of the new comment status
bool $internal True if the status is one that was added by core
Returns:
integer The id of the new comment type

Definition at line 167 of file comment.php.

static Comment::add_type ( type  )  [static]

Register a new comment type

Parameters:
string $type The name of the new comment type
Returns:
integer The id of the new comment type

Definition at line 149 of file comment.php.

Comment::content_type (  ) 

Return the content type of this object

Returns:
string The content type of this object
See also:
IsContent

Implements IsContent.

Definition at line 561 of file comment.php.

static Comment::create ( paramarray  )  [static]

Creates a comment and saves it

Parameters:
array $paramarray An associative array of comment fields $return Comment The comment object that was created
Returns:
The new comment

Definition at line 112 of file comment.php.

Referenced by __set().

Comment::css_class ( append = array()  ) 

Returns a list of CSS classes for the comment

Parameters:
string|array $append Additional classes that should be added to the ones generated
Returns:
string The resultant classes

Definition at line 636 of file comment.php.

static Comment::default_fields (  )  [static]

Returns the defined database columns for a comment

Returns:
array The requested array

Definition at line 50 of file comment.php.

Referenced by Comments::get().

Comment::delete (  ) 

Deletes this comment

Returns:
boolean True on success, false if not

Definition at line 268 of file comment.php.

Referenced by remove_status(), and remove_type().

static Comment::filter_comment_status_display_4 ( status  )  [static]

How to display the built-in comment statuses.

Parameters:
string $status The name of the status we want to translate
Returns:
string The translated status name. This is always lowercase. It is up to the caller to uppercase it.

Definition at line 685 of file comment.php.

static Comment::filter_comment_type_display_4 ( type,
foruse 
) [static]

How to display the built-in comment types.

Parameters:
string $type The type of comment
string $foruse Can be 'singular' or 'plural'
Returns:
string The translated type name. This is always lowercase. It is up to the caller to uppercase it

Definition at line 659 of file comment.php.

static Comment::get ( id = 0  )  [static]

static function get Returns a single comment, by ID

$post = Post::get( 10 );

Parameters:
int $id An ID
Returns:
array A single Comment object

Definition at line 98 of file comment.php.

Referenced by __set(), and AdminCommentsHandler::get_comment().

Comment::get_access ( user = null  ) 

Returns an access Bitmask for the given user on this comment. Read access is determined by the associated post. Update/delete is determined by the comment management tokens.

Parameters:
User $user The user mask to fetch
Returns:
Bitmask

Definition at line 572 of file comment.php.

Comment::insert (  ) 

Saves a new comment to the comments table

Returns:
integer|boolean The inserted record id on success, false if not

Definition at line 123 of file comment.php.

Referenced by add_status(), and add_type().

static Comment::list_comment_statuses ( refresh = false  )  [static]

Obtain an associative array of comment statuses

Parameters:
bool $refresh Whether to force a refresh of the cached values
Returns:
array An array mapping comment statuses names to interger values

Definition at line 448 of file comment.php.

Referenced by Comments::__get(), __get(), AdminCommentsHandler::form_comment(), AdminCommentsHandler::get_comment(), AdminCommentsHandler::post_comments(), Comments::search_to_get(), status(), and status_name().

static Comment::list_comment_types ( refresh = false  )  [static]

Obtain an associative array of comment types

Parameters:
boolean $refresh Whether to force a refresh of the cached values
Returns:
array An array mapping comment type names to integer values

Definition at line 434 of file comment.php.

Referenced by Comments::__get(), __get(), AdminCommentsHandler::post_comments(), Comments::search_to_get(), type(), and type_name().

static Comment::remove_status ( status,
newstatus = null 
) [static]

Remove a comment type from the database

Parameters:
integer|string $status The type of the comment
null|integer|string $newstatus If provided, the new status to change all of the comments with the deleted status to

Definition at line 216 of file comment.php.

static Comment::remove_type ( type,
delete = false 
) [static]

Remove a comment type from the database

Parameters:
integer|string $type The type of the comment
bool $delete If true, delete the type and all comments of that type instead of deactivating it

Definition at line 184 of file comment.php.

static Comment::status ( name  )  [static]

Obtain the integer value of the specified comment status, or false

Parameters:
string|integer $name A comment status name or value
Returns:
integer|boolean The valid integer status value or false if there was no match

Definition at line 488 of file comment.php.

Referenced by Comments::__get(), __get(), __set(), WPImport::action_auth_ajax_wp_import_comments(), CoreDashModules::action_block_content_latest_comments(), SpamChecker::action_comment_insert_before(), FeedbackHandler::add_comment(), Comments::delete_by_status(), Comments::get(), AtomHandler::get_comments(), AdminDashboardHandler::get_dashboard(), and remove_status().

static Comment::status_action ( status  )  [static]

Obtain the action name of the comment status

Parameters:
integer|string $status A comment status value, or name
Returns:
string A string of the status action, or null

Definition at line 462 of file comment.php.

static Comment::status_name ( status  )  [static]

Obtain the friendly name of a comment status

Parameters:
integer|string $status A comment status value or name
Returns:
string The status name, or null

Definition at line 506 of file comment.php.

Referenced by __get(), AdminCommentsHandler::form_comment(), AdminCommentsHandler::get_comment(), remove_status(), and status_action().

static Comment::type ( name  )  [static]

Obtain the integer value of the specified comment type, or false

Parameters:
integer|string $name a comment type name or number
Returns:
mixed an integer or boolean false

Definition at line 524 of file comment.php.

Referenced by __get(), WPImport::action_auth_ajax_wp_import_comments(), CoreDashModules::action_block_content_latest_comments(), FeedbackHandler::add_comment(), content_type(), Comments::get(), and remove_type().

static Comment::type_name ( type  )  [static]

Obtain the friendly name of a comment type, or null

Parameters:
string|integer A comment type number, or name
Returns:
string A string of the comment type, or emptystring

Definition at line 542 of file comment.php.

Referenced by __get(), content_type(), and remove_type().

Comment::update (  ) 

Updates an existing comment in the comments table

Returns:
boolean True on success, false if not

Definition at line 244 of file comment.php.

Referenced by remove_status(), and remove_type().


The documentation for this class was generated from the following file: