PHP Класс Habari\Comment

Includes an instance of the CommentInfo class; for holding inforecords about the comment If the Comment object describes an existing user; use the internal info object to get, set, unset and test for existence (isset) of info records $this->info = new CommentInfo ( 1 ); // Info records of comment with id = 1 $this->info->browser_ua= "Netscape 2.0"; // set info record with name "browser_ua" to value "Netscape 2.0" $info_value= $this->info->browser_ua; // get value of info record with name "browser_ua" into variable $info_value if ( isset ($this->info->browser_ua) ) // test for existence of "browser_ua" unset ( $this->info->browser_ua ); // delete "browser_ua" info record
Наследование: extends QueryRecord, implements IsContent
Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
$comment_status_actions
$comment_status_list static variables to hold comment status and comment type values
$comment_type_list

Открытые методы

Метод Описание
__construct ( array $paramarray = [] ) Constructor for the Comment class.
__get ( string $name ) : mixed Overrides QueryRecord __get to implement custom object properties
__isset ( string $name ) : boolean Overrides QueryRecord __isset to implement custom object properties
__set ( string $name, mixed $value ) : mixed Overrides QueryRecord __set to implement custom object properties
__static ( ) Register plugin hooks
add_status ( string $status, boolean $internal = false ) : integer Register a new comment status
add_type ( string $type ) : integer Register a new comment type
content_type ( ) : string Return the content type of this object
create ( array $paramarray ) : Comment Creates a comment and saves it
css_class ( string | array $append = [] ) : string Returns a list of CSS classes for the comment
default_fields ( ) : array Returns the defined database columns for a comment
delete ( ) : boolean Deletes this comment
filter_comment_status_display_4 ( string $status ) : string How to display the built-in comment statuses.
filter_comment_type_display_4 ( string $type, string $foruse ) : string How to display the built-in comment types.
get ( integer $id ) : array static function get Returns a single comment, by ID
get_access ( User $user = null ) : Bitmask 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.
insert ( ) : integer | boolean Saves a new comment to the comments table
list_comment_statuses ( boolean $refresh = false ) : array Obtain an associative array of comment statuses
list_comment_types ( boolean $refresh = false ) : array Obtain an associative array of comment types
remove_status ( integer | string $status, null | integer | string $newstatus = null ) Remove a comment type from the database
remove_type ( integer | string $type, boolean $delete = false ) Remove a comment type from the database
status ( string | integer $name ) : integer | boolean Obtain the integer value of the specified comment status, or false
status_action ( integer | string $status ) : string Obtain the action name of the comment status
status_name ( integer | string $status ) : string Obtain the friendly name of a comment status
type ( integer | string $name ) : mixed Obtain the integer value of the specified comment type, or false
type_name ( $type ) : string Obtain the friendly name of a comment type, or null
update ( ) : boolean Updates an existing comment in the comments table

Приватные методы

Метод Описание
get_editlink ( ) : string Returns a URL for the ->editlink property of this class.
get_info ( ) : CommentInfo Gets the info object for this comment, which contains data from the commentinfo table related to this comment.
get_post ( boolean $use_cache = true ) : Post Obtain the Post object for the post of this comment

Описание методов

__construct() публичный Метод

Constructor for the Comment class.
public __construct ( array $paramarray = [] )
$paramarray array an associative array of initial Post field values.

__get() публичный Метод

Overrides QueryRecord __get to implement custom object properties
public __get ( string $name ) : mixed
$name string Name of property to return
Результат mixed The requested field value

__isset() публичный Метод

Overrides QueryRecord __isset to implement custom object properties
public __isset ( string $name ) : boolean
$name string Name of property to return
Результат boolean true if var is set and not NULL, false otherwise

__set() публичный Метод

Overrides QueryRecord __set to implement custom object properties
public __set ( string $name, mixed $value ) : mixed
$name string Name of property to set
$value mixed Value of the property
Результат mixed The set field value

__static() публичный статический Метод

Register plugin hooks
public static __static ( )

add_status() публичный статический Метод

Register a new comment status
public static add_status ( string $status, boolean $internal = false ) : integer
$status string The name of the new comment status
$internal boolean True if the status is one that was added by core
Результат integer The id of the new comment type

add_type() публичный статический Метод

Register a new comment type
public static add_type ( string $type ) : integer
$type string The name of the new comment type
Результат integer The id of the new comment type

content_type() публичный Метод

Return the content type of this object
См. также: IsContent
public content_type ( ) : string
Результат string The content type of this object

create() статический публичный Метод

Creates a comment and saves it
static public create ( array $paramarray ) : Comment
$paramarray array An associative array of comment fields $return Comment The comment object that was created
Результат Comment The new comment

css_class() публичный Метод

Returns a list of CSS classes for the comment
public css_class ( string | array $append = [] ) : string
$append string | array Additional classes that should be added to the ones generated
Результат string The resultant classes

default_fields() публичный статический Метод

Returns the defined database columns for a comment
public static default_fields ( ) : array
Результат array The requested array

delete() публичный Метод

Deletes this comment
public delete ( ) : boolean
Результат boolean True on success, false if not

filter_comment_status_display_4() публичный статический Метод

How to display the built-in comment statuses.
public static filter_comment_status_display_4 ( string $status ) : string
$status string The name of the status we want to translate
Результат string The translated status name. This is always lowercase. It is up to the caller to uppercase it.

filter_comment_type_display_4() публичный статический Метод

How to display the built-in comment types.
public static filter_comment_type_display_4 ( string $type, string $foruse ) : string
$type string The type of comment
$foruse string Can be 'singular' or 'plural'
Результат string The translated type name. This is always lowercase. It is up to the caller to uppercase it

get() статический публичный Метод

$post = Post::get( 10 );
static public get ( integer $id ) : array
$id integer An ID
Результат array A single Comment object

get_access() публичный Метод

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.
public get_access ( User $user = null ) : Bitmask
$user User The user mask to fetch
Результат Bitmask

insert() публичный Метод

Saves a new comment to the comments table
public insert ( ) : integer | boolean
Результат integer | boolean The inserted record id on success, false if not

list_comment_statuses() публичный статический Метод

Obtain an associative array of comment statuses
public static list_comment_statuses ( boolean $refresh = false ) : array
$refresh boolean Whether to force a refresh of the cached values
Результат array An array mapping comment statuses names to interger values

list_comment_types() публичный статический Метод

Obtain an associative array of comment types
public static list_comment_types ( boolean $refresh = false ) : array
$refresh boolean Whether to force a refresh of the cached values
Результат array An array mapping comment type names to integer values

remove_status() публичный статический Метод

Remove a comment type from the database
public static remove_status ( integer | string $status, null | integer | string $newstatus = null )
$status integer | string The type of the comment
$newstatus null | integer | string If provided, the new status to change all of the comments with the deleted status to

remove_type() публичный статический Метод

Remove a comment type from the database
public static remove_type ( integer | string $type, boolean $delete = false )
$type integer | string The type of the comment
$delete boolean If true, delete the type and all comments of that type instead of deactivating it

status() публичный статический Метод

Obtain the integer value of the specified comment status, or false
public static status ( string | integer $name ) : integer | boolean
$name string | integer A comment status name or value
Результат integer | boolean The valid integer status value or false if there was no match

status_action() публичный статический Метод

Obtain the action name of the comment status
public static status_action ( integer | string $status ) : string
$status integer | string A comment status value, or name
Результат string A string of the status action, or null

status_name() публичный статический Метод

Obtain the friendly name of a comment status
public static status_name ( integer | string $status ) : string
$status integer | string A comment status value or name
Результат string The status name, or null

type() публичный статический Метод

Obtain the integer value of the specified comment type, or false
public static type ( integer | string $name ) : mixed
$name integer | string a comment type name or number
Результат mixed an integer or boolean false

type_name() публичный статический Метод

Obtain the friendly name of a comment type, or null
public static type_name ( $type ) : string
Результат string A string of the comment type, or emptystring

update() публичный Метод

Updates an existing comment in the comments table
public update ( ) : boolean
Результат boolean True on success, false if not

Описание свойств

$comment_status_actions статическое публичное свойство

static public $comment_status_actions

$comment_status_list статическое публичное свойство

static variables to hold comment status and comment type values
static public $comment_status_list

$comment_type_list статическое публичное свойство

static public $comment_type_list