vBulletin v6.0.4

vB_Library_Template extends vB_Library
in package

vB_Library_Template

Tags
access

public

Table of Contents

Methods

__serialize()  : array<string|int, mixed>
__sleep()  : array<string|int, mixed>
__unserialize()  : void
__wakeup()  : void
cacheTemplates()  : mixed
Fetches a number of templates from the database and puts them into the templatecache
clearCache()  : mixed
clearTemplateCache()  : mixed
Clear the template cache
compile()  : mixed
Compile a template.
deleteAllTemplateFiles()  : mixed
deleteTemplateFromFileSystem()  : mixed
fetch()  : mixed
Fetch one template based on its name and style ID.
fetchBulk()  : array<string|int, mixed>
Fetches a bulk of templates from the database
fetchByID()  : array<string|int, mixed>
Fetch template by its ID
fetchReplacementVar()  : false|array<string|int, mixed>
Find the replacement var by title & styleid
fetchReplacementVarById()  : false|array<string|int, mixed>
Find the replacement var by templateid
getContentInstance()  : mixed
getTemplateGroupPhrases()  : mixed
getTemplateID()  : mixed
Get template ID by its template name and style id
getTemplateIds()  : array<string|int, mixed>
Get a list of template IDs by thier template names and style id
getTextonlyDS()  : mixed
insert()  : int
Insert a new template
insertReplacementVar()  : int
Insert a replacement var
instance()  : static
Returns singleton instance of self.
monitorWords()  : mixed
Checks if the text contains monitored words, and if so, sends notifications to admins and moderators if the setting is on.
processReplacementVars()  : string
Process the replacement variables.
rebuildTextonlyDS()  : mixed
Rebuilds the textonly array;
saveAllTemplatesToFile()  : mixed
Rewrites the file cache for the templates for all styles.
saveTemplatesToFile()  : mixed
setTextonlyDS()  : mixed
This updates the datastore list of templates that have textonly and therefore are not rendered.
update()  : mixed
Update a template
updateReplacementVar()  : mixed
Update the replacement text for a replacement var

Methods

__serialize()

public __serialize() : array<string|int, mixed>
Return values
array<string|int, mixed>

__sleep()

public __sleep() : array<string|int, mixed>
Return values
array<string|int, mixed>

__unserialize()

public __unserialize(array<string|int, mixed> $serialized) : void
Parameters
$serialized : array<string|int, mixed>

cacheTemplates()

Fetches a number of templates from the database and puts them into the templatecache

public cacheTemplates(mixed $templates, mixed $templateidlist[, mixed $skip_bbcode_style = false ][, mixed $force_set = false ]) : mixed
Parameters
$templates : mixed
$templateidlist : mixed
$skip_bbcode_style : mixed = false
$force_set : mixed = false

clearCache()

public static clearCache() : mixed

clearTemplateCache()

Clear the template cache

public clearTemplateCache() : mixed

Should only be called from unit test code.

compile()

Compile a template.

public compile(mixed $template, mixed $forcesaveonerror) : mixed
Parameters
$template : mixed
$forcesaveonerror : mixed

deleteAllTemplateFiles()

public deleteAllTemplateFiles() : mixed

deleteTemplateFromFileSystem()

public deleteTemplateFromFileSystem(mixed $templateid, mixed $template_path) : mixed
Parameters
$templateid : mixed
$template_path : mixed

fetch()

Fetch one template based on its name and style ID.

public fetch(string $template_name[, int $styleid = -1 ][, mixed $nopermissioncheck = false ]) : mixed
Parameters
$template_name : string

Template name.

$styleid : int = -1

Style ID. If empty, this method will fetch template from default style.

$nopermissioncheck : mixed = false

fetchBulk()

Fetches a bulk of templates from the database

public fetchBulk(array<string|int, mixed> $template_names[, int $styleid = -1 ][, mixed $type = 'compiled' ][, mixed $nopermissioncheck = false ]) : array<string|int, mixed>
Parameters
$template_names : array<string|int, mixed>

List of template names to be fetched.

$styleid : int = -1

Style ID. If empty, this method will fetch template from default style.

$type : mixed = 'compiled'
$nopermissioncheck : mixed = false
Return values
array<string|int, mixed>

Array of information about the imported style

fetchByID()

Fetch template by its ID

public fetchByID(int $templateid) : array<string|int, mixed>
Parameters
$templateid : int

Template ID.

Return values
array<string|int, mixed>

Return template array if $templateid is valid.

fetchReplacementVar()

Find the replacement var by title & styleid

public fetchReplacementVar(string $findtext, int $dostyleid[, bool $inherit = false ]) : false|array<string|int, mixed>
Parameters
$findtext : string
$dostyleid : int
$inherit : bool = false

-- do we check for variables in parent styles?

Return values
false|array<string|int, mixed>

-- template record for the replacement variable integer templateid string title integer styleid integer dateline string username string template string template_un string version

fetchReplacementVarById()

Find the replacement var by templateid

public fetchReplacementVarById(int $replacevarid) : false|array<string|int, mixed>
Parameters
$replacevarid : int
Return values
false|array<string|int, mixed>

-- template record for the replacement variable integer templateid string title integer styleid integer dateline string username string template string template_un string version

getContentInstance()

public static getContentInstance(mixed $contenttypeid) : mixed
Parameters
$contenttypeid : mixed

getTemplateGroupPhrases()

public getTemplateGroupPhrases() : mixed

getTemplateID()

Get template ID by its template name and style id

public getTemplateID( $template_name[,  $styleid = -1 ]) : mixed
Parameters
$template_name :

the name of the template

$styleid : = -1

getTemplateIds()

Get a list of template IDs by thier template names and style id

public getTemplateIds(array<string|int, mixed> $template_names[, array<string|int, mixed> $styleid = -1 ]) : array<string|int, mixed>
Parameters
$template_names : array<string|int, mixed>

-- a list of template names

$styleid : array<string|int, mixed> = -1

-- must be a style the user has access to. If not specified, the default style is used.

Return values
array<string|int, mixed>

['ids' => $ids] where $ids is a map of names to the template id for that name. If the name is not found, the entry for that name in the map will be false.

getTextonlyDS()

public getTextonlyDS() : mixed

insert()

Insert a new template

public insert(int $dostyleid, string $title, string $content[, string $product = 'vbulletin' ][, bool $savehistory = false ][, string $histcomment = '' ][, mixed $forcesaveonerror = false ][, array<string|int, mixed> $extra = [] ]) : int
Parameters
$dostyleid : int

Style ID which the new template belongs to.

$title : string

Template name.

$content : string

Template content.

$product : string = 'vbulletin'

The product ID which the template belongs to.

$savehistory : bool = false

Whether to save the change in template history.

$histcomment : string = ''

Comment of the change to be saved to template history.

$forcesaveonerror : mixed = false
$extra : array<string|int, mixed> = []

extra parameters for the function. Actually uses params: forcenotextonly which bypasses the canadmintemplate permission textonly which sets template text only setting

Return values
int

New inserted template ID.

insertReplacementVar()

Insert a replacement var

public insertReplacementVar(int $dostyleid, string $findtext, string $replacetext) : int
Parameters
$dostyleid : int
$findtext : string
$replacetext : string

@param string $product The product ID which the replacement var belongs to.

Tags
throws
vB_Exception_Api

'replacement_x_exists' -- var with that title & styleid already exists 'replacmentvar_template_x_exists' -- the title matches the title of a non stylevar template which can cause potential conflicts.

Return values
int

-- The id of the newly created replacement var

instance()

Returns singleton instance of self.

public static instance(mixed $class) : static
Parameters
$class : mixed
Return values
static
  • Reference to singleton instance of the requested library class

monitorWords()

Checks if the text contains monitored words, and if so, sends notifications to admins and moderators if the setting is on.

public monitorWords(mixed $text, mixed $type, mixed $nodeid[, mixed $userid = null ][, mixed $insertNotifications = true ][, mixed $currentuserid = 0 ]) : mixed
Parameters
$text : mixed
$type : mixed
$nodeid : mixed
$userid : mixed = null
$insertNotifications : mixed = true
$currentuserid : mixed = 0
Tags
deprecated

use the functions from the notification library directly.

processReplacementVars()

Process the replacement variables.

public processReplacementVars(mixed $html[, mixed $styleid = -1 ]) : string
Parameters
$html : mixed
$styleid : mixed = -1
Return values
string

The processed output

rebuildTextonlyDS()

Rebuilds the textonly array;

public rebuildTextonlyDS() : mixed

saveAllTemplatesToFile()

Rewrites the file cache for the templates for all styles.

public saveAllTemplatesToFile() : mixed

saveTemplatesToFile()

public saveTemplatesToFile(mixed $templateids) : mixed
Parameters
$templateids : mixed

setTextonlyDS()

This updates the datastore list of templates that have textonly and therefore are not rendered.

public setTextonlyDS(mixed $templateid, bool $textonly) : mixed
Parameters
$templateid : mixed
$textonly : bool

update()

Update a template

public update(int $templateid, string $title, string $content, string $product, string $oldcontent, bool $savehistory, string $histcomment[, bool $forcesaveonerror = false ][, mixed $additional = array() ]) : mixed
Parameters
$templateid : int

Template ID to be updated

$title : string

Template name.

$content : string

Template content.

$product : string

The product ID which the template belongs to.

$oldcontent : string

The content of the template at the time it was loaded. This is used to prevent cases where the template was changed while editing. Pass false to force an update.

$savehistory : bool

Whether to save the change in template history.

$histcomment : string

Comment of the change to be saved to template history.

$forcesaveonerror : bool = false

save the template even though there are errors.

$additional : mixed = array()

updateReplacementVar()

Update the replacement text for a replacement var

public updateReplacementVar(int $replacevarid, mixed $replacetext) : mixed
Parameters
$replacevarid : int

-- template id for the replace var

$replacetext : mixed
Tags
paramstring

$replacetext

@return boolean


        
On this page

Search results