PHP Класс PromotedContentModule, vanilla

- Posted by a certain role - Reached bestof status - Latest from a certain category
С версии: 2.0.17.9
Автор: Tim Gunter ([email protected])
Наследование: extends Gdn_Module
Показать файл Открыть проект Примеры использования класса

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

Свойство Тип Описание
$BodyLimit How many chars of Body to return.
$ContentType What type of content to fetch. One of: all, discussions, comments.
$Expiry How long do we cache in seconds.
$Group How often should we encapsulate content in groups. Groups of: n.
$Limit How much content should be fetched.
$Properties Whitelist of accepted parameters.
$Selection Parameters for the selector method.
$Selector How should we choose the content? - role Author's Role - rank Author's Rank - category Content's Category - score Content's Score - promoted
$TitleLimit How many chars of Title to return.

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

Метод Описание
__construct ( )
assetTarget ( ) : string Default asset target for this module.
getData ( ) Get data based on class properties.
load ( array $Parameters = [] ) Set class properties.
showComments ( ) : boolean Whether to display promoted comments.
showDiscussions ( ) : boolean Whether to display promoted discussions.
toString ( ) : string Render.
validate ( array $Parameters = [] ) : string | true Validate data to be used as class properties.

Защищенные методы

Метод Описание
condense ( array &$Content, array $Limit ) Condense an interleaved content list down to the required size
joinCategory ( array &$Comments ) Attach CategoryID to Comments
processContent ( Array &$content ) Pre-process content into a uniform format for output
security ( array &$Content ) Strip out content that this user is not allowed to see
securityFilter ( $ContentItem ) : boolean Determine if we have permission to view this content.
selectByCategory ( array | integer $Parameters ) : array | false Select content based on its CategoryID.
selectByPromoted ( array $Parameters ) : array | false Selected content that passed the Promoted threshold.
selectByRank ( array | integer $Parameters ) : array | false Select content based on author RankID.
selectByRole ( array | integer $Parameters ) : array | false Select content based on author RoleID.
selectByScore ( array | integer $Parameters ) : array | false Select content based on its Score.
union ( string $Field, array $Sections ) : array Interleave two or more result arrays by a common field

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

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

public __construct ( )

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

Default asset target for this module.
public assetTarget ( ) : string
Результат string

condense() защищенный Метод

Condense an interleaved content list down to the required size
protected condense ( array &$Content, array $Limit )
$Content array
$Limit array

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

Get data based on class properties.
public getData ( )

joinCategory() защищенный Метод

Attach CategoryID to Comments
protected joinCategory ( array &$Comments )
$Comments array

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

Set class properties.
public load ( array $Parameters = [] )
$Parameters array Use lowercase key names that map to class properties.

processContent() защищенный Метод

Pre-process content into a uniform format for output
protected processContent ( Array &$content )
$content Array By reference

security() защищенный Метод

Strip out content that this user is not allowed to see
protected security ( array &$Content )
$Content array Content array, by reference

securityFilter() защищенный Метод

Determine if we have permission to view this content.
protected securityFilter ( $ContentItem ) : boolean
$ContentItem
Результат boolean

selectByCategory() защищенный Метод

Select content based on its CategoryID.
protected selectByCategory ( array | integer $Parameters ) : array | false
$Parameters array | integer
Результат array | false

selectByPromoted() защищенный Метод

This uses the Reactions caching system & options.
protected selectByPromoted ( array $Parameters ) : array | false
$Parameters array Not used.
Результат array | false $Content

selectByRank() защищенный Метод

Select content based on author RankID.
protected selectByRank ( array | integer $Parameters ) : array | false
$Parameters array | integer
Результат array | false

selectByRole() защищенный Метод

Select content based on author RoleID.
protected selectByRole ( array | integer $Parameters ) : array | false
$Parameters array | integer
Результат array | false

selectByScore() защищенный Метод

Select content based on its Score.
protected selectByScore ( array | integer $Parameters ) : array | false
$Parameters array | integer
Результат array | false

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

Whether to display promoted comments.
public showComments ( ) : boolean
Результат boolean

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

Whether to display promoted discussions.
public showDiscussions ( ) : boolean
Результат boolean

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

Render.
public toString ( ) : string
Результат string

union() защищенный Метод

Interleave two or more result arrays by a common field
protected union ( string $Field, array $Sections ) : array
$Field string
$Sections array Array of result arrays
Результат array

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

Validate data to be used as class properties.
public validate ( array $Parameters = [] ) : string | true
$Parameters array .
Результат string | true True on success or string (message) on error.

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

$BodyLimit публичное свойство

How many chars of Body to return.
public $BodyLimit

$ContentType публичное свойство

What type of content to fetch. One of: all, discussions, comments.
public $ContentType

$Expiry публичное свойство

How long do we cache in seconds.
public $Expiry

$Group публичное свойство

How often should we encapsulate content in groups. Groups of: n.
public $Group

$Limit публичное свойство

How much content should be fetched.
public $Limit

$Properties публичное свойство

Whitelist of accepted parameters.
public $Properties

$Selection публичное свойство

Parameters for the selector method.
public $Selection

$Selector публичное свойство

How should we choose the content? - role Author's Role - rank Author's Rank - category Content's Category - score Content's Score - promoted
public $Selector

$TitleLimit публичное свойство

How many chars of Title to return.
public $TitleLimit