PHP Class Comment, ProcessWire

Inheritance: extends DatabaseObject
Mostrar archivo Open project: ryancramerdesign/ProcessWire Class Usage Examples

Protected Properties

Property Type Description
$_parent null Cached parent from parent() method
$field null | Field Field this comment is for
$loaded boolean Is this comment finished loading?
$page null | Page Page this comment lives on
$prevStatus integer | null Previous Comment status, when it has been changed

Public Methods

Method Description
__construct ( ) Construct a Comment and set defaults
__toString ( ) String value of a Comment is it's database ID
children ( ) : CommentArray Return children comments, if applicable
cleanCommentString ( $str ) Clean a comment string by issuing several filters
get ( $key )
getField ( )
getFormatted ( $key ) : mixed | null | Page | string Same as get() but with output formatting applied
getGravatar ( string $email, string $rating = 'g', string $imageset = 'mm', integer $size = 80 ) : string Returns a URL to this user's gravatar image (static version, use non-static gravatar() function unless you specifically need static)
getPage ( )
gravatar ( string $rating = 'g', string $imageset = 'mm', integer $size = 80 ) : string Returns a URL to this user's gravatar image
isApproved ( ) Returns true if the comment is approved and thus appearing on the site
parent ( ) : Comment | null Return the parent comment, if applicable
renderStars ( array $options = [] ) : string Render stars markup
set ( $key, $value )
setField ( Field $field )
setIsLoaded ( $loaded )
setPage ( Page $page )

Method Details

__construct() public method

Construct a Comment and set defaults
public __construct ( )

__toString() public method

String value of a Comment is it's database ID
public __toString ( )

children() public method

Return children comments, if applicable
public children ( ) : CommentArray
return CommentArray

cleanCommentString() public method

Clean a comment string by issuing several filters
public cleanCommentString ( $str )

get() public method

public get ( $key )

getField() public method

public getField ( )

getFormatted() public method

Note that we won't apply this to get() when $page->outputFormatting is active in order for backwards compatibility with older installations.
public getFormatted ( $key ) : mixed | null | Page | string
$key
return mixed | null | Page | string

getGravatar() public static method

Returns a URL to this user's gravatar image (static version, use non-static gravatar() function unless you specifically need static)
public static getGravatar ( string $email, string $rating = 'g', string $imageset = 'mm', integer $size = 80 ) : string
$email string
$rating string Gravatar rating, one of [ g | pg | r | x ], default is g.
$imageset string Gravatar default imageset, one of [ 404 | mm | identicon | monsterid | wavatar | retro | blank ], default is mm.
$size integer Gravatar image size, default is 80.
return string

getPage() public method

public getPage ( )

gravatar() public method

Returns a URL to this user's gravatar image
public gravatar ( string $rating = 'g', string $imageset = 'mm', integer $size = 80 ) : string
$rating string Gravatar rating, one of [ g | pg | r | x ], default is g.
$imageset string Gravatar default imageset, one of [ 404 | mm | identicon | monsterid | wavatar | retro | blank ], default is mm.
$size integer Gravatar image size, default is 80.
return string

isApproved() public method

Returns true if the comment is approved and thus appearing on the site
public isApproved ( )

parent() public method

Return the parent comment, if applicable
public parent ( ) : Comment | null
return Comment | null

renderStars() public method

Render stars markup
public renderStars ( array $options = [] ) : string
$options array See CommentArray::renderStars for $options
return string

set() public method

public set ( $key, $value )

setField() public method

public setField ( Field $field )
$field Field

setIsLoaded() public method

public setIsLoaded ( $loaded )

setPage() public method

public setPage ( Page $page )
$page Page

Property Details

$_parent protected_oe property

Cached parent from parent() method
protected null $_parent
return null

$field protected_oe property

Field this comment is for
protected null|Field $field
return null | Field

$loaded protected_oe property

Is this comment finished loading?
protected bool $loaded
return boolean

$page protected_oe property

Page this comment lives on
protected null|Page $page
return null | Page

$prevStatus protected_oe property

Previous Comment status, when it has been changed
protected int|null $prevStatus
return integer | null