class vB_Library_Style extends vB_Library

vB_Library_Style

Traits

Constants

ATTR_WRITE

ATTR_READ

ATTR_PROTECTED

ATTR_DEFAULT

Properties

static protected $instance from vB_Library
protected array $forcedStyles Contains styles that were forced in a channel

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

resetForcedStyles()

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

addStylevars(array $styles, int $styleids = false)

Adds missing stylevars to a style array

array
preCacheStylevars(array $styleids, array $styles)

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

getStylevars($styleid)

No description

setStylevars(int $styleid, array $data, array $styles)

Update various caches with the stylevar data for a style

int
getValidStyleFromPreference(array $stylePreference)

Returns a valid style to be used from the candidates

nothing
deleteOrphanStylevars(bool $echo = false)

Removes orphaned stylevars

array
fetchStyleRecord($styleid, $nopermissioncheck = false)

Loads style information (selected style and style vars)

importStyleFromXML($xmldata, $title, $parentid, $overwritestyleid, $anyversion, $displayorder, $userselect, $scilent = false)

Import style from XML Data

importStyleFromServer(string $serverfile, string $title, integer $parentid, integer $overwritestyleid, boolean $anyversion, integer $displayorder, boolean $userselect)

Import style from Server File

array
fetchTemplateParentlist($styleid, $overwriteCache = false)

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

array
getStyleById($styleid)

Fetch style information by its ID.

array
fetchStyleByID(integer $styleid, bool $abort = true) deprecated

Fetch style information by its ID.

array
fetchStyles(bool $nocache = false, bool $fetchStylevars = true, mixed $options = array())

Fetch All styles

removeReadProtectedStyles($styles)

No description

bool
checkStyleReadProtection($styleid = null, $style = array(), $ignore_debug = false)

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

clearStyleCache()

Clear style in class cache.

bool
validStyle(int $styleid)

Checks if a styleid is valid

switchCssStyle($styleid, $templates)

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)

mixed
buildTemplateIdCache(integer $styleid, boolean $doreturn = false, mixed $parentids = false) deprecated

Fetches a list of template IDs for the specified style

setCssDate()

Resets the css cachebuster date.

setCssFileDate(int $styleid)

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

getCssFileDate(int $styleid)

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

buildStyleDatastore()

Rebuild the style datastore.

buildStyle(integer $styleid, string $title, array $actions, boolean $resetcache = false)

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

internalCacheClear($styleid)

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

buildAllStyles($renumber = 0, $install = 0, $resetcache = false)

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

checkStyleWriteProtection($styleid)

No description

Details

in vB_Trait_NoSerialize at line 15
__sleep()

in vB_Trait_NoSerialize at line 20
__wakeup()

at line 45
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 60
resetForcedStyles()

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

at line 70
protected addStylevars(array $styles, int $styleids = false)

Adds missing stylevars to a style array

Parameters

array $styles
int $styleids optional styleid needed

at line 153
protected array preCacheStylevars(array $styleids, array $styles)

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

Parameters

array $styleids array of style ids
array $styles &$styles array of cached styles which will be modified in place

Return Value

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

at line 193
protected getStylevars($styleid)

Parameters

$styleid

at line 223
protected setStylevars(int $styleid, array $data, array $styles)

Update various caches with the stylevar data for a style

Parameters

int $styleid
array $data -- The stylevar data for the style
array $styles -- The style cache to update the new stylvar data

at line 247
int getValidStyleFromPreference(array $stylePreference)

Returns a valid style to be used from the candidates

Parameters

array $stylePreference
  • Style candidates ordered by preference

Return Value

int

at line 332
nothing deleteOrphanStylevars(bool $echo = false)

Removes orphaned stylevars

Parameters

bool $echo echo progress comments

Return Value

nothing

at line 448
array fetchStyleRecord($styleid, $nopermissioncheck = false)

Loads style information (selected style and style vars)

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
$nopermissioncheck

Return Value

array Style information. -- See fetchStyleByID

at line 585
importStyleFromXML($xmldata, $title, $parentid, $overwritestyleid, $anyversion, $displayorder, $userselect, $scilent = false)

Import style from XML Data

Parameters

$xmldata
$title
$parentid
$overwritestyleid
$anyversion
$displayorder
$userselect
$scilent

at line 608
importStyleFromServer(string $serverfile, string $title, integer $parentid, integer $overwritestyleid, boolean $anyversion, integer $displayorder, boolean $userselect)

Import style from Server File

Parameters

string $serverfile Server file name to be imported.
string $title Style title.
integer $parentid Parent style ID.
integer $overwritestyleid Style ID to be overwritten.
boolean $anyversion Whether to ignore style version.
integer $displayorder Style display order.
boolean $userselect Whether the style allows user selection.

at line 631
array fetchTemplateParentlist($styleid, $overwriteCache = false)

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

Parameters

$styleid
$overwriteCache

Return Value

array

at line 675
array getStyleById($styleid)

Fetch style information by its ID.

Parameters

$styleid

Return Value

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

at line 710
array fetchStyleByID(integer $styleid, bool $abort = true) deprecated

deprecated use getStyleById

Fetch style information by its ID.

Parameters

integer $styleid Style ID.
bool $abort abort or return empty array ?

Return Value

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

at line 880
array fetchStyles(bool $nocache = false, bool $fetchStylevars = true, mixed $options = array())

Fetch All styles

Parameters

bool $nocache Refresh Styles from database
bool $fetchStylevars if true it will return stylevars for each style
mixed $options array of options: currently only understands "themes":false - exclude themes, "skipReadCheck":true - include protected styles

Return Value

array All styles' information

at line 929
protected removeReadProtectedStyles($styles)

Parameters

$styles

at line 972
bool checkStyleReadProtection($styleid = null, $style = array(), $ignore_debug = false)

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

Parameters

$styleid
$style
$ignore_debug

Return Value

bool Style can be viewed

at line 1007
clearStyleCache()

Clear style in class cache.

Needed for unit testing

at line 1020
bool validStyle(int $styleid)

Checks if a styleid is valid

Parameters

int $styleid

Return Value

bool

at line 1038
switchCssStyle($styleid, $templates)

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)

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
$templates

at line 1067
mixed buildTemplateIdCache(integer $styleid, boolean $doreturn = false, mixed $parentids = false) deprecated

deprecated

Fetches a list of template IDs for the specified style

Parameters

integer $styleid Style ID
boolean $doreturn If true, returns a list of template ids; if false, goes ahead and runs the update query
mixed $parentids A comma-separated list of style parent ids (if false, will query to fetch the list)

Return Value

mixed Either the list of template ids, or nothing

at line 1159
setCssDate()

Resets the css cachebuster date.

at line 1173
setCssFileDate(int $styleid)

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

Parameters

int $styleid 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.

at line 1204
getCssFileDate(int $styleid)

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

Parameters

int $styleid

at line 1220
buildStyleDatastore()

Rebuild the style datastore.

at line 1257
buildStyle(integer $styleid, string $title, array $actions, boolean $resetcache = false)

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

Parameters

integer $styleid -- Use -1 to rebuild all styles.
string $title
array $actions Array of actions set to true/false: docss/dostylevars/doreplacements/doposteditor
boolean $resetcache Reset the master cache

at line 1266
internalCacheClear($styleid)

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

Parameters

$styleid

at line 1544
buildAllStyles($renumber = 0, $install = 0, $resetcache = false)

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

Parameters

$renumber
$install
$resetcache

at line 1559
checkStyleWriteProtection($styleid)

Parameters

$styleid