PHP Class PromotedContentModule, vanilla

- Posted by a certain role - Reached bestof status - Latest from a certain category
Since: 2.0.17.9
Author: Tim Gunter ([email protected])
Inheritance: extends Gdn_Module
Afficher le fichier Open project: vanilla/vanilla Class Usage Examples

Méthodes publiques

Свойство Type Description
$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.

Méthodes publiques

Méthode Description
__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.

Méthodes protégées

Méthode Description
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

Method Details

__construct() public méthode

public __construct ( )

assetTarget() public méthode

Default asset target for this module.
public assetTarget ( ) : string
Résultat string

condense() protected méthode

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

getData() public méthode

Get data based on class properties.
public getData ( )

joinCategory() protected méthode

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

load() public méthode

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

processContent() protected méthode

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

security() protected méthode

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

securityFilter() protected méthode

Determine if we have permission to view this content.
protected securityFilter ( $ContentItem ) : boolean
$ContentItem
Résultat boolean

selectByCategory() protected méthode

Select content based on its CategoryID.
protected selectByCategory ( array | integer $Parameters ) : array | false
$Parameters array | integer
Résultat array | false

selectByPromoted() protected méthode

This uses the Reactions caching system & options.
protected selectByPromoted ( array $Parameters ) : array | false
$Parameters array Not used.
Résultat array | false $Content

selectByRank() protected méthode

Select content based on author RankID.
protected selectByRank ( array | integer $Parameters ) : array | false
$Parameters array | integer
Résultat array | false

selectByRole() protected méthode

Select content based on author RoleID.
protected selectByRole ( array | integer $Parameters ) : array | false
$Parameters array | integer
Résultat array | false

selectByScore() protected méthode

Select content based on its Score.
protected selectByScore ( array | integer $Parameters ) : array | false
$Parameters array | integer
Résultat array | false

showComments() public méthode

Whether to display promoted comments.
public showComments ( ) : boolean
Résultat boolean

showDiscussions() public méthode

Whether to display promoted discussions.
public showDiscussions ( ) : boolean
Résultat boolean

toString() public méthode

Render.
public toString ( ) : string
Résultat string

union() protected méthode

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
Résultat array

validate() public méthode

Validate data to be used as class properties.
public validate ( array $Parameters = [] ) : string | true
$Parameters array .
Résultat string | true True on success or string (message) on error.

Property Details

$BodyLimit public_oe property

How many chars of Body to return.
public $BodyLimit

$ContentType public_oe property

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

$Expiry public_oe property

How long do we cache in seconds.
public $Expiry

$Group public_oe property

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

$Limit public_oe property

How much content should be fetched.
public $Limit

$Properties public_oe property

Whitelist of accepted parameters.
public $Properties

$Selection public_oe property

Parameters for the selector method.
public $Selection

$Selector public_oe property

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 public_oe property

How many chars of Title to return.
public $TitleLimit