class vB_Library_Template extends vB_Library

vB_Library_Template

Traits

Properties

static protected $instance from vB_Library

Methods

__sleep()

No description

__wakeup()

No description

__construct()

No description

static vB_PageCache
instance($class)

Returns singleton instance of self.

static 
getLibraryClassNameInternal($controller)

No description

static 
getContentInstance($contenttypeid)

No description

static 
clearCache()

No description

mixed
fetch($template_name, $styleid = -1, $nopermissioncheck = false)

Fetch one template based on its name and style ID.

array
fetchBulk($template_names, $styleid = -1, $type = 'compiled', $nopermissioncheck = false)

Fetches a bulk of templates from the database

cacheTemplates(array $templates, string|array $templateidlist, bool $skip_bbcode_style = false, bool $force_set = false)

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

saveAllTemplatesToFile()

Rewrites the file cache for the templates for all styles.

saveTemplatesToFile($templateids)

No description

deleteAllTemplateFiles()

No description

deleteTemplateFromFileSystem($templateid, $template_path)

No description

string
processReplacementVars(string $html, integer $styleid = -1)

Process the replacement variables.

integer
insert($dostyleid, $title, $content, $product = 'vbulletin', $savehistory = false, $histcomment = '', $forcesaveonerror = false, $extra = array())

Insert a new template

integer
insertReplacementVar(integer $dostyleid, string $findtext, string $replacetext)

Insert a replacement var

updateReplacementVar($replacevarid, $replacetext)

Update the replacement text for a replacement var

false|array
fetchReplacementVar(string $findtext, integer $dostyleid, boolean $inherit = false)

Find the replacement var by title & styleid

false|array
fetchReplacementVarById(integer $replacevarid)

Find the replacement var by templateid

compile($template, $forcesaveonerror)

Compile a template.

update($templateid, $title, $content, $product, $oldcontent, $savehistory, $histcomment, $forcesaveonerror = false, $additional = array())

Update a template

array
fetchByID(integer $templateid)

Fetch template by its ID

saveTemplate($title, $template, $content, $timenow, $username, $version, $product, $templateid, $hash, $styleid, $savehistory, $histcomment, $additional = array())

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)

getTemplateID($template_name, $styleid = -1)

Get template ID by its template name and style id

array
getTemplateIds(array $template_names, array $styleid = -1)

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

clearTemplateCache()

Clear the template cache

setTextonlyDS($templateid, $textonly)

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

rebuildTextonlyDS()

Rebuilds the textonly array();

getTemplateGroupPhrases()

No description

Details

in vB_Trait_NoSerialize at line 15
__sleep()

in vB_Trait_NoSerialize at line 20
__wakeup()

in vB_Library at line 25
protected __construct()

in vB_Library at line 35
static vB_PageCache instance($class)

Returns singleton instance of self.

Parameters

$class

Return Value

vB_PageCache
  • Reference to singleton instance of the cache handler

in vB_Library at line 52
static protected getLibraryClassNameInternal($controller)

Parameters

$controller

in vB_Library at line 91
static getContentInstance($contenttypeid)

Parameters

$contenttypeid

in vB_Library at line 99
static clearCache()

at line 31
mixed fetch($template_name, $styleid = -1, $nopermissioncheck = false)

Fetch one template based on its name and style ID.

Parameters

$template_name
$styleid
$nopermissioncheck

Return Value

mixed

at line 68
array fetchBulk($template_names, $styleid = -1, $type = 'compiled', $nopermissioncheck = false)

Fetches a bulk of templates from the database

Parameters

$template_names
$styleid
$type
$nopermissioncheck

Return Value

array Array of information about the imported style

at line 164
cacheTemplates(array $templates, string|array $templateidlist, bool $skip_bbcode_style = false, bool $force_set = false)

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

Parameters

array $templates List of template names to be fetched
string|array $templateidlist Serialized array or array of template name => template id pairs
bool $skip_bbcode_style Whether to skip adding the bbcode style refs
bool $force_set Whether to force setting the template

at line 210
saveAllTemplatesToFile()

Rewrites the file cache for the templates for all styles.

at line 231
saveTemplatesToFile($templateids)

Parameters

$templateids

at line 247
deleteAllTemplateFiles()

at line 329
deleteTemplateFromFileSystem($templateid, $template_path)

Parameters

$templateid
$template_path

at line 366
string processReplacementVars(string $html, integer $styleid = -1)

Process the replacement variables.

Parameters

string $html The html to be processed
integer $styleid The styleid to use.

Return Value

string The processed output

at line 402
integer insert($dostyleid, $title, $content, $product = 'vbulletin', $savehistory = false, $histcomment = '', $forcesaveonerror = false, $extra = array())

Insert a new template

Parameters

$dostyleid
$title
$content
$product
$savehistory
$histcomment
$forcesaveonerror
$extra

Return Value

integer New inserted template ID.

at line 539
integer insertReplacementVar(integer $dostyleid, string $findtext, string $replacetext)

Insert a replacement var

Parameters

integer $dostyleid
string $findtext
string $replacetext @param string $product The product ID which the replacement var belongs to.

Return Value

integer -- The id of the newly created replacement var

Exceptions

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.

at line 606
updateReplacementVar($replacevarid, $replacetext)

Update the replacement text for a replacement var

Parameters

$replacevarid
$replacetext

at line 659
false|array fetchReplacementVar(string $findtext, integer $dostyleid, boolean $inherit = false)

Find the replacement var by title & styleid

Parameters

string $findtext
integer $dostyleid
boolean $inherit -- do we check for variables in parent styles?

Return Value

false|array -- template record for the replacement variable string title integer styleid integer dateline string username string template string template_un string version

at line 707
false|array fetchReplacementVarById(integer $replacevarid)

Find the replacement var by templateid

Parameters

integer $replacevarid

Return Value

false|array -- template record for the replacement variable string title integer styleid integer dateline string username string template string template_un string version

at line 734
compile($template, $forcesaveonerror)

Compile a template.

Parameters

$template
$forcesaveonerror

at line 802
update($templateid, $title, $content, $product, $oldcontent, $savehistory, $histcomment, $forcesaveonerror = false, $additional = array())

Update a template

Parameters

$templateid
$title
$content
$product
$oldcontent
$savehistory
$histcomment
$forcesaveonerror
$additional

at line 935
array fetchByID(integer $templateid)

Fetch template by its ID

Parameters

integer $templateid Template ID.

Return Value

array Return template array if $templateid is valid.

at line 977
protected saveTemplate($title, $template, $content, $timenow, $username, $version, $product, $templateid, $hash, $styleid, $savehistory, $histcomment, $additional = array())

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)

Parameters

$title
$template
$content
$timenow
$username
$version
$product
$templateid
$hash
$styleid
$savehistory
$histcomment
$additional

at line 1111
getTemplateID($template_name, $styleid = -1)

Get template ID by its template name and style id

Parameters

$template_name the name of the template
$styleid

at line 1125
array getTemplateIds(array $template_names, array $styleid = -1)

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

Parameters

array $template_names -- a list of template names
array $styleid -- must be a style the user has access to. If not specified, the default style is used.

Return Value

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

at line 1154
clearTemplateCache()

Clear the template cache

Should only be called from unit test code.

at line 1165
setTextonlyDS($templateid, $textonly)

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

Parameters

$templateid
$textonly

at line 1184
rebuildTextonlyDS()

Rebuilds the textonly array();

at line 1200
getTemplateGroupPhrases()