vBulletin 5.6.5 API

vB_Library_Template extends vB_Library
in package

vB_Library_Template

Tags
access

public

Table of Contents

$instance  : mixed
$bbcode_style  : mixed
$templatecache  : mixed
__serialize()  : mixed
__sleep()  : mixed
__unserialize()  : mixed
__wakeup()  : mixed
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
insert()  : int
Insert a new template
insertReplacementVar()  : int
Insert a replacement var
instance()  : vB_PageCache
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
__construct()  : mixed
getLibraryClassNameInternal()  : mixed
saveTemplate()  : mixed
Save a template and handle all common operations between an insert and an update caller is responsible for determining if a update or an insert is needed (via providing the existing templateid for the record to be updated)
checkConflictError()  : string
Checks for problems with conflict resolution
checkEvalErrors()  : mixed
getConflictTextRe()  : string
Return regular expression to detect the blocks returned by format_conflict_text
getTemplateReturn()  : mixed
isAbsolutePath()  : mixed
saveTemplateToFileSystem()  : mixed

Properties

$instance

protected static mixed $instance = array()

$bbcode_style

private static mixed $bbcode_style = array('code' => -1, 'html' => -1, 'php' => -1, 'quote' => -1)

$templatecache

private static mixed $templatecache = array()

Methods

__serialize()

public __serialize() : mixed
Return values
mixed

__sleep()

public __sleep() : mixed
Return values
mixed

__unserialize()

public __unserialize(mixed $serialized) : mixed
Parameters
$serialized : mixed
Return values
mixed

__wakeup()

public __wakeup() : mixed
Return values
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
Return values
mixed

clearCache()

public static clearCache() : mixed
Return values
mixed

clearTemplateCache()

Clear the template cache

public clearTemplateCache() : mixed

Should only be called from unit test code.

Return values
mixed

compile()

Compile a template.

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

deleteAllTemplateFiles()

public deleteAllTemplateFiles() : mixed
Return values
mixed

deleteTemplateFromFileSystem()

public deleteTemplateFromFileSystem(mixed $templateid, mixed $template_path) : mixed
Parameters
$templateid : mixed
$template_path : mixed
Return values
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
Return values
mixed

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 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 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
Return values
mixed

getTemplateGroupPhrases()

public getTemplateGroupPhrases() : mixed
Return values
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
Return values
mixed

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>

array('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.

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) : vB_PageCache
Parameters
$class : mixed
Return values
vB_PageCache
  • Reference to singleton instance of the cache handler

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) : mixed
Parameters
$text : mixed
$type : mixed
$nodeid : mixed
$userid : mixed = null
$insertNotifications : mixed = true
$currentuserid : mixed
Return values
mixed

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
Return values
mixed

saveAllTemplatesToFile()

Rewrites the file cache for the templates for all styles.

public saveAllTemplatesToFile() : mixed
Return values
mixed

saveTemplatesToFile()

public saveTemplatesToFile(mixed $templateids) : mixed
Parameters
$templateids : mixed
Return values
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
Return values
mixed

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()
Return values
mixed

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

Return values
mixed

__construct()

protected __construct() : mixed
Return values
mixed

getLibraryClassNameInternal()

protected static getLibraryClassNameInternal(mixed $controller) : mixed
Parameters
$controller : mixed
Return values
mixed

saveTemplate()

Save a template and handle all common operations between an insert and an update caller is responsible for determining if a update or an insert is needed (via providing the existing templateid for the record to be updated)

protected saveTemplate( $title,  $template,  $content,  $timenow,  $username,  $version,  $product,  $templateid,  $hash,  $styleid,  $savehistory, mixed $histcomment[,  $additional = array() ]) : mixed
Parameters
$title :

string. The title of the template

$template :

string. Compiled template text

$content :

string. Uncompiled template text

$timenow :

int. Current time as a datestamp

$username :

string. Username of the user saving the template

$version :

string. The version of the product the template belongs to.

$product :

string. The product that the template belongs to.

$templateid :

int. The id of the template being saved, null if this is a new template

$hash :

string. The md5 hash of the original text of the template being updated. This is used to avoid conflicting edits. Null if this is a new template.

$styleid :

int. The ID of the style the template is being saved to.

$savehistory :

bool. Whether to save this edit to the template history -- valid for new templates

$histcomment : mixed
$additional : = array()

array. Extra paraeters for the function Actually uses params: forcenotextonly which bypasses the canadmintemplate permission textonly which sets template text only setting

Return values
mixed

checkConflictError()

Checks for problems with conflict resolution

private checkConflictError(mixed $compiled) : string
Parameters
$compiled : mixed
Return values
string

Error message detected or empty string if no error

checkEvalErrors()

private checkEvalErrors(mixed $compiled) : mixed
Parameters
$compiled : mixed
Return values
mixed

getConflictTextRe()

Return regular expression to detect the blocks returned by format_conflict_text

private getConflictTextRe() : string
Return values
string

-- value suitable for passing to preg_match as an re

getTemplateReturn()

private getTemplateReturn(mixed $template) : mixed
Parameters
$template : mixed
Return values
mixed

isAbsolutePath()

private isAbsolutePath(mixed $path) : mixed
Parameters
$path : mixed
Return values
mixed

saveTemplateToFileSystem()

private saveTemplateToFileSystem(mixed $templateid, mixed $compiled_template, mixed $template_path[, mixed $textonly = false ]) : mixed
Parameters
$templateid : mixed
$compiled_template : mixed
$template_path : mixed
$textonly : mixed = false
Return values
mixed

Search results