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
파일 보기 프로젝트 열기: habari/system 1 사용 예제들

공개 프로퍼티들

프로퍼티 타입 설명
$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