vBulletin 5.6.5 API

vB_Library_Style extends vB_Library
in package

vB_Library_Style

Tags
access

public

Table of Contents

ATTR_DEFAULT  = 3
ATTR_PROTECTED  = 0
ATTR_READ  = 2
ATTR_WRITE  = 1
$forcedStyles  : array<string|int, mixed>
Contains styles that were forced in a channel
$instance  : mixed
$stylecache  : mixed
$stylesById  : mixed
$stylevarcache  : mixed
$ts_arraycache  : mixed
__serialize()  : mixed
__sleep()  : mixed
__unserialize()  : mixed
__wakeup()  : mixed
buildAllStyles()  : mixed
Builds all data from the template table into the fields in the style table
buildStyle()  : mixed
Converts all data from the template table for a style into the style table
buildStyleDatastore()  : mixed
Rebuild the style datastore.
buildTemplateIdCache()  : mixed
Fetches a list of template IDs for the specified style
checkStyleReadProtection()  : bool
Returns true if style is not read-protected and can be viewed.
checkStyleWriteProtection()  : mixed
clearCache()  : mixed
clearStyleCache()  : mixed
Clear style in class cache.
deleteOrphanStylevars()  : nothing
Removes orphaned stylevars
fetchStyleByID()  : array<string|int, mixed>
Fetch style information by its ID.
fetchStyleRecord()  : array<string|int, mixed>
Loads style information (selected style and style vars)
fetchStyles()  : array<string|int, mixed>
Fetch All styles
fetchTemplateParentlist()  : array<string|int, mixed>
Returns an array of all styles that are parents to the style specified
getContentInstance()  : mixed
getCssFileDate()  : mixed
Gets the date that the css for this style was last updated
getStyleById()  : array<string|int, mixed>
Fetch style information by its ID.
getValidStyleFromPreference()  : int
Returns a valid style to be used from the candidates
importStyleFromServer()  : mixed
Import style from Server File
importStyleFromXML()  : mixed
Import style from XML Data
insertStyle()  : int
Insert style
instance()  : vB_PageCache
Returns singleton instance of self.
internalCacheClear()  : mixed
Only used internally by the adminfunctions_template's build_style() to force in-memory cache clears.
monitorWords()  : mixed
Checks if the text contains monitored words, and if so, sends notifications to admins and moderators if the setting is on.
resetForcedStyles()  : mixed
This is intended to be used in tests, to be able to refresh the cache
setCssDate()  : mixed
Resets the css cachebuster date.
setCssFileDate()  : mixed
Resets/sets the css file cachebuster date. Used when storing css as files
switchCssStyle()  : mixed
Switch the style for rendering This really should be part of the bootstrap code except: 1) We don't actually load the bootstrap in the admincp 2) There is a lot to the style load that isn't easy to redo (header/footer templates for example)
updateStyle()  : mixed
Update style
useCssFiles()  : bool
Determine if we should use on disk files for this style based on the following rules
validStyle()  : bool
Checks if a styleid is valid
__construct()  : mixed
addStylevars()  : mixed
Adds missing stylevars to a style array
getLibraryClassNameInternal()  : mixed
getStylevars()  : mixed
preCacheStylevars()  : array<string|int, mixed>
This preloads a list of stylevars, and returns a list of those not found
removeReadProtectedStyles()  : mixed
setStylevars()  : mixed
Update various caches with the stylevar data for a style
addThemeData()  : mixed
Adds theme data (GUID, icon, preview image) to a style if in debug mode. (used by update & insert)
buildStyleInternal()  : mixed
Internal function to handle the recursion for buildStyle.
cacheStyles()  : none
Builds the $stylecache array
loadForcedStyles()  : mixed
replaceStyleInDatastore()  : mixed

Constants

ATTR_DEFAULT

public mixed ATTR_DEFAULT = 3

ATTR_PROTECTED

public mixed ATTR_PROTECTED = ""

ATTR_READ

public mixed ATTR_READ = 2

ATTR_WRITE

public mixed ATTR_WRITE = 1

Properties

$forcedStyles

Contains styles that were forced in a channel

protected array<string|int, mixed> $forcedStyles = ull

$instance

protected static mixed $instance = array()

$stylecache

private mixed $stylecache = []

$stylesById

private mixed $stylesById = []

$stylevarcache

private mixed $stylevarcache = []

$ts_arraycache

private mixed $ts_arraycache = []

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

buildAllStyles()

Builds all data from the template table into the fields in the style table

public buildAllStyles(mixed $renumber, mixed $install[, mixed $resetcache = false ]) : mixed
Parameters
$renumber : mixed
$install : mixed
$resetcache : mixed = false
Return values
mixed

buildStyle()

Converts all data from the template table for a style into the style table

public buildStyle(int $styleid, string $title, array<string|int, mixed> $actions[, bool $resetcache = false ][, bool $updateChildren = true ]) : mixed
Parameters
$styleid : int

-- Use -1 to rebuild all styles.

$title : string

(unused)

$actions : array<string|int, mixed>

--Array of actions set to true/false: dostylevars/doreplacements/doposteditor

$resetcache : bool = false

-- Reset the master cache

$updateChildren : bool = true

-- if false does not recurse the rebuild. If called incorrectly without child rebuilds, then the children may not display properly

Return values
mixed

buildStyleDatastore()

Rebuild the style datastore.

public buildStyleDatastore() : mixed
Return values
mixed

buildTemplateIdCache()

Fetches a list of template IDs for the specified style

public buildTemplateIdCache(mixed $styleid[, mixed $doreturn = false ][, mixed $parentids = false ]) : mixed
Parameters
$styleid : mixed
$doreturn : mixed = false
$parentids : mixed = false
Tags
deprecated
Return values
mixed

Either the list of template ids, or nothing

checkStyleReadProtection()

Returns true if style is not read-protected and can be viewed.

public checkStyleReadProtection([int $styleid = null ][, array<string|int, mixed> $style = array() ][, mixed $ignore_debug = false ]) : bool
Parameters
$styleid : int = null

If style being checked exists, its styleid. Alternatively, provide the style array as $style

$style : array<string|int, mixed> = array()

(Optional) Style array with 'styleattributes' field. If not provided, function will only use $styleid.

$ignore_debug : mixed = false
Return values
bool

Style can be viewed

checkStyleWriteProtection()

public checkStyleWriteProtection(mixed $styleid) : mixed
Parameters
$styleid : mixed
Return values
mixed

clearCache()

public static clearCache() : mixed
Return values
mixed

clearStyleCache()

Clear style in class cache.

public clearStyleCache() : mixed

Needed for unit testing

Return values
mixed

deleteOrphanStylevars()

Removes orphaned stylevars

public deleteOrphanStylevars([mixed $echo = false ]) : nothing
Parameters
$echo : mixed = false
Return values
nothing

fetchStyleByID()

Fetch style information by its ID.

public fetchStyleByID(int $styleid[, mixed $abort = true ]) : array<string|int, mixed>
Parameters
$styleid : int

Style ID.

$abort : mixed = true
Tags
deprecated

use getStyleById

Return values
array<string|int, mixed>

Style information. --styleid int --title string --parentid int --parentlist string -- comma seperated list of ancestors styles (includes this style) --templatelist array -- templatename => templateid for this style (might include templates from ancestors) --newstylevars string -- serialized stylevar array --replacements -- replacement vars? --editorstyles ??? --userselect int -- is this style user selectable? (0/1) --displayorder int -- order to display this style in --dateline --guid string -- unique id for theme styles (styles with a guid are considered themes and have special handling) --filedataid int ??? --previewfiledataid int -- the fileid for the theme preview image --styleattributes ???

fetchStyleRecord()

Loads style information (selected style and style vars)

public fetchStyleRecord(int $styleid[, mixed $nopermissioncheck = false ]) : array<string|int, mixed>

This is different from fetchStyleByID(). The style fetched by this method may not be the style specified in $styleid parameter.

If the style with $styleid doesn't allow user to use (The user isn't admin either), default style specified in vBulletin Settings will be returned.

Parameters
$styleid : int
$nopermissioncheck : mixed = false
Return values
array<string|int, mixed>

Style information. -- See fetchStyleByID

fetchStyles()

Fetch All styles

public fetchStyles([bool $nocache = false ][, bool $fetchStylevars = true ][, mixed $options = array() ]) : array<string|int, mixed>
Parameters
$nocache : bool = false

Refresh Styles from database

$fetchStylevars : bool = true

if true it will return stylevars for each style

$options : mixed = array()

array of options: currently only understands "themes":false - exclude themes, "skipReadCheck":true - include protected styles

Return values
array<string|int, mixed>

All styles' information

fetchTemplateParentlist()

Returns an array of all styles that are parents to the style specified

public fetchTemplateParentlist(mixed $styleid[, mixed $overwriteCache = false ]) : array<string|int, mixed>
Parameters
$styleid : mixed
$overwriteCache : mixed = false
Return values
array<string|int, mixed>

getContentInstance()

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

getCssFileDate()

Gets the date that the css for this style was last updated

public getCssFileDate(int $styleid) : mixed
Parameters
$styleid : int
Return values
mixed

getStyleById()

Fetch style information by its ID.

public getStyleById(int $styleid) : array<string|int, mixed>
Parameters
$styleid : int

Style ID.

Return values
array<string|int, mixed>

Style information. Same as fetchStyleByID except --newstylevars array -- stylevar array --userselect bool -- is this style user selectable?

getValidStyleFromPreference()

Returns a valid style to be used from the candidates

public getValidStyleFromPreference(array<string|int, mixed> $stylePreference) : int
Parameters
$stylePreference : array<string|int, mixed>
  • Style candidates ordered by preference
Return values
int

importStyleFromServer()

Import style from Server File

public importStyleFromServer(string $serverfile, string $title, int $parentid, int $overwritestyleid, bool $anyversion, int $displayorder, bool $userselect) : mixed
Parameters
$serverfile : string

Server file name to be imported.

$title : string

Style title.

$parentid : int

Parent style ID.

$overwritestyleid : int

Style ID to be overwritten.

$anyversion : bool

Whether to ignore style version.

$displayorder : int

Style display order.

$userselect : bool

Whether the style allows user selection.

Return values
mixed

importStyleFromXML()

Import style from XML Data

public importStyleFromXML(string $xmldata, string $title, int $parentid, int $overwritestyleid, bool $anyversion, int $displayorder, bool $userselect[, mixed $scilent = false ]) : mixed
Parameters
$xmldata : string

XML Data to be imported as style.

$title : string

Style title.

$parentid : int

Parent style ID.

$overwritestyleid : int

Style ID to be overwritten.

$anyversion : bool

Whether to ignore style version.

$displayorder : int

Style display order.

$userselect : bool

Whether the style allows user selection.

$scilent : mixed = false
Return values
mixed

insertStyle()

Insert style

public insertStyle(string $title, int $parentid, bool $userselect, int $displayorder[, string $guid = '' ][, binary $icon = '' ][, binary $previewImage = '' ][, mixed $styleattributes = vB_Library_Style::ATTR_DEFAULT ][, mixed $dateline = null ]) : int
Parameters
$title : string

Style title

$parentid : int

New parent style ID for the style.

$userselect : bool

Whether user is able to choose the style.

$displayorder : int

Display order.

$guid : string = ''

Theme GUID

$icon : binary = ''

Theme icon

$previewImage : binary = ''

Theme preview image

$styleattributes : mixed = vB_Library_Style::ATTR_DEFAULT
$dateline : mixed = null
Return values
int

The new styleid

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

internalCacheClear()

Only used internally by the adminfunctions_template's build_style() to force in-memory cache clears.

public internalCacheClear(mixed $styleid) : mixed
Parameters
$styleid : mixed
Return values
mixed

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

resetForcedStyles()

This is intended to be used in tests, to be able to refresh the cache

public resetForcedStyles() : mixed
Return values
mixed

setCssDate()

Resets the css cachebuster date.

public setCssDate() : mixed
Return values
mixed

setCssFileDate()

Resets/sets the css file cachebuster date. Used when storing css as files

public setCssFileDate(int $styleid) : mixed
Parameters
$styleid : int

The style to set the date for. Each style has its own date to prevent us from needing to rebuild the css for every style any time something changes.

Return values
mixed

switchCssStyle()

Switch the style for rendering This really should be part of the bootstrap code except: 1) We don't actually load the bootstrap in the admincp 2) There is a lot to the style load that isn't easy to redo (header/footer templates for example)

public switchCssStyle(mixed $styleid, mixed $templates) : mixed

This handles the stylevars and template lists -- including reloading the template cache. This is enough to handle the css template rendering, but probably won't work for anything more complicated.

Parameters
$styleid : mixed
$templates : mixed
Return values
mixed

updateStyle()

Update style

public updateStyle(int $dostyleid, string $title, int $parentid, bool $userselect, int $displayorder[, string $guid = '' ][, binary $icon = '' ][, bool $iconRemove = false ][, binary $previewImage = '' ][, bool $previewImageRemove = false ]) : mixed
Parameters
$dostyleid : int

Style ID to be updated.

$title : string

Style title.

$parentid : int

New parent style ID for the style.

$userselect : bool

Whether user is able to choose the style.

$displayorder : int

Display order of the style.

$guid : string = ''

Theme GUID

$icon : binary = ''

Theme icon

$iconRemove : bool = false

Whether to remove the current icon (if there is one, and we're not uploading a new one)

$previewImage : binary = ''

Theme preview image

$previewImageRemove : bool = false

Whether to remove the current preview image (if there is one, and we're not uploading a new one)

Return values
mixed

useCssFiles()

Determine if we should use on disk files for this style based on the following rules

public useCssFiles(int $styleid) : bool
  1. We have storecssasfile enabled
  2. The style user selectable and/or a "force" style used for specific channels
  3. The style is readable (not a hidden them style).
Parameters
$styleid : int
Return values
bool

validStyle()

Checks if a styleid is valid

public validStyle(int $styleid) : bool
Parameters
$styleid : int
Return values
bool

__construct()

protected __construct() : mixed
Return values
mixed

addStylevars()

Adds missing stylevars to a style array

protected addStylevars(array<string|int, mixed> &$styles[, mixed $styleids = false ]) : mixed
Parameters
$styles : array<string|int, mixed>
$styleids : mixed = false
Return values
mixed

getLibraryClassNameInternal()

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

getStylevars()

protected getStylevars(mixed $styleid) : mixed
Parameters
$styleid : mixed
Return values
mixed

preCacheStylevars()

This preloads a list of stylevars, and returns a list of those not found

protected preCacheStylevars(array<string|int, mixed> $styleids, array<string|int, mixed> &$styles) : array<string|int, mixed>
Parameters
$styleids : array<string|int, mixed>

array of style ids

$styles : array<string|int, mixed>

array of cached styles which will be modified in place

Return values
array<string|int, mixed>

array of integers, which may be empty- those styles that must be queried.

removeReadProtectedStyles()

protected removeReadProtectedStyles(mixed $styles) : mixed
Parameters
$styles : mixed
Return values
mixed

setStylevars()

Update various caches with the stylevar data for a style

protected setStylevars(int $styleid, array<string|int, mixed> $data, array<string|int, mixed> &$styles) : mixed
Parameters
$styleid : int
$data : array<string|int, mixed>

-- The stylevar data for the style

$styles : array<string|int, mixed>

-- The style cache to update the new stylvar data

Return values
mixed

addThemeData()

Adds theme data (GUID, icon, preview image) to a style if in debug mode. (used by update & insert)

private addThemeData(mixed $dostyleid, string $guid, binary $icon, bool $iconRemove, binary $previewImage, bool $previewImageRemove) : mixed
Parameters
$dostyleid : mixed
$guid : string

Theme GUID

$icon : binary

Theme icon

$iconRemove : bool

Whether to remove the current icon (if there is one, and we're not uploading a new one)

$previewImage : binary

Theme preview image

$previewImageRemove : bool

Whether to remove the current preview image (if there is one, and we're not uploading a new one)

Return values
mixed

buildStyleInternal()

Internal function to handle the recursion for buildStyle.

private buildStyleInternal(mixed $styleid, mixed $title, mixed $actions, mixed $parentlist, mixed $resetcache, mixed $updateChildren) : mixed
Parameters
$styleid : mixed
$title : mixed
$actions : mixed
$parentlist : mixed
$resetcache : mixed
$updateChildren : mixed
Return values
mixed

cacheStyles()

Builds the $stylecache array

private cacheStyles([bool $styleid = -1 ], int $depth) : none

This is a recursive function - call it with no arguments

Parameters
$styleid : bool = -1

Style ID to start with

$depth : int

Current depth

Return values
none

loadForcedStyles()

private loadForcedStyles() : mixed
Return values
mixed

replaceStyleInDatastore()

private replaceStyleInDatastore(mixed $datastore, mixed $styleid) : mixed
Parameters
$datastore : mixed
$styleid : mixed
Return values
mixed

Search results