vB_Xml_Import_Theme
extends vB_Xml_Import
in package
Table of Contents
- DEFAULT_GRANDPARENT_GUID = 'vbulletin-theme-parent-readonly-5660da3dd0cc42.92747689'
- DEFAULT_PARENT_GUID = 'vbulletin-theme-parent-53516be9caa311.54941284'
- DEFAULT_THEME_GUID = 'vbulletin-theme-default-ead8b80bfd72e5257178b41f45c64178'
- OPTION_ADDSPECIFICWIDGETS = 32
- OPTION_ADDWIDGETS = 8
- OPTION_IGNOREMISSINGPARENTS = 4
- OPTION_IGNOREMISSINGROUTES = 2
- OPTION_OVERWRITE = 1
- OPTION_OVERWRITECOLUMN = 16
- TYPE_CHANNEL = 'channels'
- TYPE_PAGE = 'pages'
- TYPE_PAGETEMPLATE = 'pageTemplates'
- TYPE_ROUTE = 'routes'
- TYPE_SCREENLAYOUT = 'screenLayouts'
- TYPE_THEME = 'themes'
- TYPE_WIDGET = 'widgets'
- $db : vB_dB_Assertor
- $importedElements : array<string|int, mixed>
- $options : int
- $overwriteColumn : string
- Column to overwrite, if OPTION_OVERWRITECOLUMN is set
- $parsedXML : array<string|int, mixed>
- $productid : mixed
- $themeGrandParent : mixed
- $themeParent : mixed
- __construct() : mixed
- __serialize() : mixed
- __sleep() : mixed
- __unserialize() : mixed
- __wakeup() : mixed
- getDefaultGrandParentTheme() : mixed
- getDefaultParentTheme() : mixed
- getImportedId() : int
- Returns the id for an imported element
- importAdminCP() : mixed
- importFromFile() : mixed
- Imports objects from the specified filepath
- importFromParsedXML() : mixed
- Imports objects from parsed XML starting at the base of the relevant objects.
- importThemes() : mixed
- parseFile() : mixed
- setOptions() : mixed
- setOverwriteColumn() : mixed
- Sets the column to overwrite, if OPTION_OVERWRITECOLUMN is set
- uploadThemeImageData() : int|bool
- Uploads a theme image (icon or preview image) from the image data
- doInsertTheme() : mixed
- getXmlList() : The
- Get a list from the parsed xml array
- import() : mixed
- Import objects
- replacePhrasePlaceholdersInArray() : array<string|int, mixed>
- If an array value is of the form "phrase:<phrasevarname>" replace it with the actual phrase.
- setImportedId() : mixed
- Stores an imported element with the new id
- uploadImageStreamStringToFiledata() : mixed
- uploadThemeImage() : int|bool
- Uploads a theme image (icon or preview image)
- addChild() : mixed
Constants
DEFAULT_GRANDPARENT_GUID
public
mixed
DEFAULT_GRANDPARENT_GUID
= 'vbulletin-theme-parent-readonly-5660da3dd0cc42.92747689'
DEFAULT_PARENT_GUID
public
mixed
DEFAULT_PARENT_GUID
= 'vbulletin-theme-parent-53516be9caa311.54941284'
DEFAULT_THEME_GUID
public
mixed
DEFAULT_THEME_GUID
= 'vbulletin-theme-default-ead8b80bfd72e5257178b41f45c64178'
OPTION_ADDSPECIFICWIDGETS
public
mixed
OPTION_ADDSPECIFICWIDGETS
= 32
OPTION_ADDWIDGETS
public
mixed
OPTION_ADDWIDGETS
= 8
OPTION_IGNOREMISSINGPARENTS
public
mixed
OPTION_IGNOREMISSINGPARENTS
= 4
OPTION_IGNOREMISSINGROUTES
public
mixed
OPTION_IGNOREMISSINGROUTES
= 2
OPTION_OVERWRITE
public
mixed
OPTION_OVERWRITE
= 1
OPTION_OVERWRITECOLUMN
public
mixed
OPTION_OVERWRITECOLUMN
= 16
TYPE_CHANNEL
public
mixed
TYPE_CHANNEL
= 'channels'
TYPE_PAGE
public
mixed
TYPE_PAGE
= 'pages'
TYPE_PAGETEMPLATE
public
mixed
TYPE_PAGETEMPLATE
= 'pageTemplates'
TYPE_ROUTE
public
mixed
TYPE_ROUTE
= 'routes'
TYPE_SCREENLAYOUT
public
mixed
TYPE_SCREENLAYOUT
= 'screenLayouts'
TYPE_THEME
public
mixed
TYPE_THEME
= 'themes'
TYPE_WIDGET
public
mixed
TYPE_WIDGET
= 'widgets'
Properties
$db
protected
vB_dB_Assertor
$db
$importedElements
protected
static array<string|int, mixed>
$importedElements
$options
protected
int
$options
$overwriteColumn
Column to overwrite, if OPTION_OVERWRITECOLUMN is set
protected
string
$overwriteColumn
= ''
$parsedXML
protected
array<string|int, mixed>
$parsedXML
$productid
protected
mixed
$productid
$themeGrandParent
protected
static mixed
$themeGrandParent
$themeParent
protected
static mixed
$themeParent
Methods
__construct()
public
__construct([mixed $productid = 'vbulletin' ][, mixed $options = 9 ]) : mixed
Parameters
- $productid : mixed = 'vbulletin'
- $options : mixed = 9
Return values
mixed —__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 —getDefaultGrandParentTheme()
public
getDefaultGrandParentTheme() : mixed
Return values
mixed —getDefaultParentTheme()
public
getDefaultParentTheme() : mixed
Return values
mixed —getImportedId()
Returns the id for an imported element
public
static getImportedId(string $type[, string $guid = NULL ]) : int
Parameters
- $type : string
- $guid : string = NULL
Return values
int —importAdminCP()
public
importAdminCP(mixed $parsedXML, mixed $startat[, mixed $perpage = 1 ][, mixed $overwrite = false ][, mixed $styleid = -1 ][, mixed $anyversion = false ][, mixed $extra = array() ]) : mixed
Parameters
- $parsedXML : mixed
- $startat : mixed
- $perpage : mixed = 1
- $overwrite : mixed = false
- $styleid : mixed = -1
- $anyversion : mixed = false
- $extra : mixed = array()
Return values
mixed —importFromFile()
Imports objects from the specified filepath
public
importFromFile(string $filepath[, string $guid = false ]) : mixed
Parameters
- $filepath : string
- $guid : string = false
-
Only import the record associated with this guid
Return values
mixed —importFromParsedXML()
Imports objects from parsed XML starting at the base of the relevant objects.
public
importFromParsedXML(array<string|int, mixed> $parsedXML) : mixed
Parameters
- $parsedXML : array<string|int, mixed>
Return values
mixed —importThemes()
public
importThemes([mixed $perpage = 1 ][, mixed $overwrite = false ]) : mixed
Parameters
- $perpage : mixed = 1
- $overwrite : mixed = false
Return values
mixed —parseFile()
public
static parseFile(mixed $filepath) : mixed
Parameters
- $filepath : mixed
Return values
mixed —setOptions()
public
setOptions(mixed $options) : mixed
Parameters
- $options : mixed
Return values
mixed —setOverwriteColumn()
Sets the column to overwrite, if OPTION_OVERWRITECOLUMN is set
public
setOverwriteColumn(mixed $column) : mixed
Parameters
- $column : mixed
Return values
mixed —uploadThemeImageData()
Uploads a theme image (icon or preview image) from the image data
public
uploadThemeImageData(mixed $imageData) : int|bool
Parameters
- $imageData : mixed
Return values
int|bool —Filedataid for the image or false if the image could not be uploaded.
doInsertTheme()
protected
doInsertTheme(mixed $title, mixed $parentid, mixed $userselect, mixed $displayorder, mixed $guid[, mixed $icon = '' ][, mixed $previewImage = '' ][, mixed $styleattributes = vB_Library_Style::ATTR_DEFAULT ][, mixed $dateline = null ]) : mixed
Parameters
- $title : mixed
- $parentid : mixed
- $userselect : mixed
- $displayorder : mixed
- $guid : mixed
- $icon : mixed = ''
- $previewImage : mixed = ''
- $styleattributes : mixed = vB_Library_Style::ATTR_DEFAULT
- $dateline : mixed = null
Return values
mixed —getXmlList()
Get a list from the parsed xml array
protected
getXmlList(array<string|int, mixed> $parentxml, string $listname) : The
A common way to format lists in xml is
The problem is a single item is ambiguous
It could be a one element list or it could be a scalar child -- we only know from the context of the data, which the parser doesn't know. Our parser assumes that it is a scalar value unless there are multiple tags with the same name. Therefor so the first is rendered as:
tag['subtag'] = [0 => $element, 1 => $element]
While the second is:
tag['subtag'] = $element.
Rather than handle each list element as a special case if there is only one item in the xml, this function will examine the element passed and if it isn't a 0 indexed array as expect will wrap the single element in an array() call. The first case is not affected and the second is converted to tag['subtag'] = array(0 => $element), which is what we'd actually expect.
This is why we should use JSON.
Parameters
- $parentxml : array<string|int, mixed>
-
-- The parsed XML array containing the list. This must be the direct parent of the lsit
- $listname : string
-
-- The tag name for the list values
Return values
The —list properly regularized to a numerically indexed array.
import()
Import objects
protected
import(mixed $startat[, mixed $perpage = 1 ][, mixed $overwrite = false ][, mixed $styleid = -1 ][, mixed $anyversion = false ][, mixed $extra = [] ]) : mixed
Parameters
- $startat : mixed
- $perpage : mixed = 1
- $overwrite : mixed = false
- $styleid : mixed = -1
- $anyversion : mixed = false
- $extra : mixed = []
Return values
mixed —replacePhrasePlaceholdersInArray()
If an array value is of the form "phrase:<phrasevarname>" replace it with the actual phrase.
protected
replacePhrasePlaceholdersInArray(array<string|int, mixed> $array) : array<string|int, mixed>
Parameters
- $array : array<string|int, mixed>
Return values
array<string|int, mixed> —The array with phrases replaced.
setImportedId()
Stores an imported element with the new id
protected
static setImportedId(string $type, string $guid, mixed $newid) : mixed
Parameters
- $type : string
- $guid : string
- $newid : mixed
Return values
mixed —uploadImageStreamStringToFiledata()
protected
uploadImageStreamStringToFiledata(mixed $imageContent[, mixed $prefix = 'vb_' ]) : mixed
Parameters
- $imageContent : mixed
- $prefix : mixed = 'vb_'
Return values
mixed —uploadThemeImage()
Uploads a theme image (icon or preview image)
protected
uploadThemeImage(mixed $encodedImageData) : int|bool
Parameters
- $encodedImageData : mixed
Return values
int|bool —Filedataid for the image or false if the image could not be uploaded.
addChild()
private
addChild(mixed $guid) : mixed
Parameters
- $guid : mixed