vBulletin v6.0.4

vB_Library_Style extends vB_Library
in package

vB_Library_Style

Table of Contents

Constants

ATTR_DEFAULT  = 3
ATTR_PROTECTED  = 0
ATTR_READ  = 2
ATTR_WRITE  = 1

Methods

__serialize()  : array<string|int, mixed>
__sleep()  : array<string|int, mixed>
__unserialize()  : void
__wakeup()  : void
addStylevarOverrides()  : array<string|int, mixed>
Fetch any stylevar customizations from styles in $parentlist, override root stylevars & return the updated list.
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()  : void
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
fetchStyleVars()  : mixed
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
getCssStyleDirectory()  : string
Gets the directory for the css on the filestystem
getCssStyleUrlPath()  : string
Gets the directory for the css on the filestystem as a url relative to the site root.
getRootStylevars()  : array<string|int, mixed>
Return stylevars for styleid = -1 WITHOUT resolving styleid to forum default styleid.
getSpriteUrl()  : string
Gets the directory for the css on the filestystem as a url relative to the site root.
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()  : static
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

Constants

ATTR_DEFAULT

public mixed ATTR_DEFAULT = 3

ATTR_PROTECTED

public mixed ATTR_PROTECTED = 0

ATTR_READ

public mixed ATTR_READ = 2

ATTR_WRITE

public mixed ATTR_WRITE = 1

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>

addStylevarOverrides()

Fetch any stylevar customizations from styles in $parentlist, override root stylevars & return the updated list.

public addStylevarOverrides(string $parentlist, array<string|int, mixed> $root_stylevar_cache) : array<string|int, mixed>

Customizations closest to the lowest level style (left-most in $parentlist) will take precedence. Also includes the 'datatype' from stylevardfn, as long as it's provided in $root_stylevar_cache. Note, this is public for use by adminfunctions_template.php, but really should be considered private.

Parameters
$parentlist : string
$root_stylevar_cache : array<string|int, mixed>
Return values
array<string|int, mixed>

buildAllStyles()

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

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

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

buildStyleDatastore()

Rebuild the style datastore.

public buildStyleDatastore() : 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 = [] ][, 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> = []

(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

clearCache()

public static clearCache() : mixed

clearStyleCache()

Clear style in class cache.

public clearStyleCache() : mixed

Needed for unit testing

deleteOrphanStylevars()

Removes orphaned stylevars

public deleteOrphanStylevars([mixed $echo = false ]) : void
Parameters
$echo : mixed = false

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 ][, array<string|int, mixed> $options = [] ]) : 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 : array<string|int, mixed> = []

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

Return values
array<string|int, mixed>

All styles' information

fetchStyleVars()

public fetchStyleVars(mixed $stylePreference[, mixed $resolveStyleid = true ]) : mixed
Parameters
$stylePreference : mixed
$resolveStyleid : mixed = true

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

getCssFileDate()

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

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

getCssStyleDirectory()

Gets the directory for the css on the filestystem

public getCssStyleDirectory(int $styleid, string $textdir) : string
Parameters
$styleid : int
$textdir : string

-- either 'ltr' or 'rtl' (unknown values treated as 'rtl')

Return values
string

-- the full directory path without a trailing slash

getCssStyleUrlPath()

Gets the directory for the css on the filestystem as a url relative to the site root.

public getCssStyleUrlPath(int $styleid, string $textdir) : string
Parameters
$styleid : int
$textdir : string

-- either 'ltr' or 'rtl' (unknown values treated as 'rtl')

Return values
string

-- the full directory path without a trailing slash

getRootStylevars()

Return stylevars for styleid = -1 WITHOUT resolving styleid to forum default styleid.

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

getSpriteUrl()

Gets the directory for the css on the filestystem as a url relative to the site root.

public getSpriteUrl(string $filename, int $styleid, string $textdir) : string
Parameters
$filename : string
$styleid : int
$textdir : string

-- either 'ltr' or 'rtl' (unknown values treated as 'rtl')

Return values
string

-- the full directory path without a trailing slash

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.

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

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) : static
Parameters
$class : mixed
Return values
static
  • Reference to singleton instance of the requested library class

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

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.

resetForcedStyles()

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

public resetForcedStyles() : mixed

setCssDate()

Resets the css cachebuster date.

public setCssDate() : 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.

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

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)

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

        
On this page

Search results