vB_Xml_Import_Route
extends vB_Xml_Import
in package
Table of Contents
- 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
- __construct() : mixed
- __serialize() : mixed
- __sleep() : mixed
- __unserialize() : mixed
- __wakeup() : mixed
- getImportedId() : int
- Returns the id for an imported element
- importFromFile() : mixed
- Imports objects from the specified filepath
- importFromParsedXML() : mixed
- Imports objects from parsed XML starting at the base of the relevant objects.
- parseFile() : mixed
- setOptions() : mixed
- setOverwriteColumn() : mixed
- Sets the column to overwrite, if OPTION_OVERWRITECOLUMN is set
- 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
Constants
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
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 —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 —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 —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 —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 $onlyGuid = [] ]) : mixed
Parameters
- $onlyGuid : 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