PHP Class CommentStars, ProcessWire

Handles rendering of star ratings for comments. Additional code in comments.js and comments.css accompanies this. Copyright 2015 by Ryan Cramer for ProcessWire
Inheritance: extends WireData
Exibir arquivo Open project: ryancramerdesign/ProcessWire Class Usage Examples

Protected Properties

Property Type Description
$defaults

Public Methods

Method Description
__construct ( ) Construct comment stars
render ( integer | float | null $stars, boolean $allowInput = false ) : string Render stars
renderCount ( integer $count, float | integer $stars, string $schema = '' ) : string Render a count of ratings
setDefault ( $key, $value ) Change one of the defaults (see $defaults)

Method Details

__construct() public method

Construct comment stars
public __construct ( )

render() public method

If given a float for $stars, it will render partial stars. If given an int for $stars, it will only render whole stars.
public render ( integer | float | null $stars, boolean $allowInput = false ) : string
$stars integer | float | null Number of stars that are in active state
$allowInput boolean Whether to allow input of stars
return string

renderCount() public method

Render a count of ratings
public renderCount ( integer $count, float | integer $stars, string $schema = '' ) : string
$count integer
$stars float | integer
$schema string May be "rdfa" or "microdata" or blank (default) to omit.
return string

setDefault() public static method

Example: CommentStars::setDefault('star', '');
public static setDefault ( $key, $value )
$key
$value

Property Details

$defaults protected_oe static_oe property

protected static $defaults