PHP Класс 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
Наследование: extends WireData
Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
$defaults

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

Метод Описание
__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)

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

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

Construct comment stars
public __construct ( )

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

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
Результат string

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

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.
Результат string

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

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

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

$defaults защищенное статическое свойство

protected static $defaults