__construct()
addFetchOptionJoin()
addPositionLimit()
appendTemplatesAddOnXml()
appendTemplatesStyleXml()
assertValidCutOffOperator()
buildTemplateMap()
buildTemplateMapForStyleTree()
canImportTemplatesFromDevelopment()
canModifyTemplateInStyle()
compileAllTemplates()
compileAndInsertEffectiveTemplates()
compileAndInsertParsedTemplate()
compileMappedTemplatesInStyleTree()
compileNamedTemplateInStyleTree()
compileTemplateInStyleTree()
compileTemplatesThatIncludePhrase()
create()
deleteTemplateFiles()
deleteTemplatesForAddOn()
deleteTemplatesInStyle()
fetchAllKeyed()
findTemplateMapUpdates()
getAllEffectiveTemplatesInStyle()
getAllTemplatesInStyle()
getConditionsForClause()
getContentTypeField()
getContentTypesWithField()
getEffectiveTemplateByMapId()
getEffectiveTemplateByTitle()
getEffectiveTemplateListForStyle()
getEffectiveTemplatesByMapIds()
getEffectiveTemplatesByTitles()
getIncludingTemplateMapIds()
getMappedTemplatesByTemplateId()
getMasterTemplatesInAddOn()
getModelFromCache()
getOrderByClause()
getOutdatedTemplates()
getParentMappedTemplateByTitle()
getTemplateById()
getTemplateDevelopmentDirectory()
getTemplateIdInStylesByTitle()
getTemplateInStyleByTitle()
getTemplateMapIdsThatIncludePhrase()
getTemplatesByIds()
getTemplatesDevelopmentXml()
getTemplatesInStyleByTitles()
importTemplatesAddOnXml()
importTemplatesFromDevelopment()
importTemplatesStyleXml()
insertTemplateMapForStyles()
limitQueryResults()
prepareLimitFetchOptions()
prepareStateLimitFromConditions()
prepareTemplateConditions()
replaceIncludesWithLinkRel()
replaceLinkRelWithIncludes()
resetLocalCacheData()
setAllowCachedRead()
setLocalCacheData()
standardizeNodePermissionsAndUserId()
standardizePermissionCombinationIdAndUserId()
standardizePermissionsAndUserId()
standardizeViewingUserReference()
standardizeViewingUserReferenceForNode()
unserializePermissionsInList()
writeTemplateFiles()
_buildTemplateMapForStyleTree()
_getCache()
_getDataRegistryModel()
_getDb()
_getLocalCacheData()
$_allowCachedRead
$_cache
$_db
$_localCacheData
$_modelCache
Model for templates
Models don't share that much, so most implementations will be adding methods onto this class. This class simply provides helper methods for common actions.
package | XenForo_Templates |
---|
__construct()
Use create() statically unless you know what you're doing.
inherited_from | \XenForo_Model::__construct() |
---|
addFetchOptionJoin(array $fetchOptions, integer $join)
Join should be one of the constants.
inherited_from | \XenForo_Model::addFetchOptionJoin() |
---|
array
integer
addPositionLimit(string $table, integer $limit, integer $offset, string $column) : string
It no limit value is specified, nothing will be returned.
This must be added within a WHERE clause. If a clause is required, it will begin with "AND", so ensure there is a condition before it.
inherited_from | \XenForo_Model::addPositionLimit() |
---|
string
Name of the table alias to prefix. May be blank for no table reference.
integer
Number of records to limit to; ignored if <= 0
integer
Offset from the start of the records. 0+
string
Name of the column that is storing the position
string
Position limit clause if neededappendTemplatesAddOnXml(\DOMElement $rootNode, string $addOnId)
string
Add-on ID to be exported
appendTemplatesStyleXml(\DOMElement $rootNode, integer $styleId)
assertValidCutOffOperator(string $operator)
inherited_from | \XenForo_Model::assertValidCutOffOperator() |
---|
string
buildTemplateMap(string $title, array $data)
string
Title of the template being build
array
Injectable data. Supports styleTree and styleTemplateMap.
buildTemplateMapForStyleTree(integer $styleId) : array
integer
Starting style. This style and all children will be built.
array
Format: [style id][title] => template idcanImportTemplatesFromDevelopment() : boolean
boolean
canModifyTemplateInStyle(integer $styleId) : boolean
If debug mode is not enabled, users can't modify templates in the master style.
integer
boolean
compileAllTemplates(integer $maxExecution, integer $startStyle, integer $startTemplate) : boolean | array
integer
The approx maximum length of time this function will run for
integer
The ID of the style to start with
integer
The number of the template to start with in that style (not ID, just counter)
boolean
array
True if completed successfull, otherwise array of where to restart (values start style ID, start template counter)compileAndInsertEffectiveTemplates(array $templates)
array
Array of effective template info
compileAndInsertParsedTemplate(integer $templateMapId, string | array $parsedTemplate, string $title, integer $compileStyleId)
integer
The map ID of the template being compiled (for includes)
string
array
Parsed form of the template
string
Title of the template
integer
Style ID of the template
compileMappedTemplatesInStyleTree(integer | array $templateMapIds) : array
integer
array
One map ID as a scalar or many as an array
array
A list of template map IDs that were compiledcompileNamedTemplateInStyleTree(string $title, integer $styleId) : array
Any child templates that use this template will be recompiled as well.
string
integer
array
A list of template map IDs that were compiledcompileTemplateInStyleTree(array $parsedRecord) : array
This compiles this template in any style that is actually using this template.
array
Full template information
array
List of template map IDs that were compiledcompileTemplatesThatIncludePhrase(string $phraseTitle) : array
string
array
List of template map IDs that were compiledcreate(string $class) : \XenForo_Model
The class must exist or be autoloadable or an exception will be thrown.
inherited_from | \XenForo_Model::create() |
---|
string
Class to load
deleteTemplateFiles()
deleteTemplatesForAddOn(string $addOnId)
string
deleteTemplatesInStyle($styleId)
fetchAllKeyed(string $sql, string $key, mixed $bind, string $nullPrefix) : array
The 'key' parameter provides the column name with which to key the result. For example, calling fetchAllKeyed('SELECT item_id, title, date FROM table', 'item_id') would result in an array keyed by item_id: [$itemId] => array('item_id' => $itemId, 'title' => $title, 'date' => $date)
Note that the specified key must exist in the query result, or it will be ignored.
inherited_from | \XenForo_Model::fetchAllKeyed() |
---|
string
SQL to execute
string
Column with which to key the results array
mixed
Parameters for the SQL
string
If the key is null, prefix the counter with this
array
findTemplateMapUpdates(integer $parentId, array $styleTree, array $styleTemplateMap, integer $defaultTemplateId) : array
If {$defaultTemplateId} is non-0, a return entry will be inserted for {$parentId}.
integer
Parent of the style sub-tree to search.
array
Tree of styles
array
List of styleId => templateId pairs for the places where this template has been customized.
integer
The default template ID that non-customized template in the sub-tree should get.
array
Format: [style id] => [effective template id]getAllEffectiveTemplatesInStyle(integer $styleId) : array
"Effective" means a merged/flattened system where every valid template has a record.
integer
array
Format: [] => (array) effective template infogetAllTemplatesInStyle(integer $styleId, boolean $basicData) : array
integer
Style ID
boolean
If true, gets basic data only
array
Format: [] => (array) templategetConditionsForClause(array $sqlConditions) : string
This always returns a value that can be used in a clause such as WHERE.
inherited_from | \XenForo_Model::getConditionsForClause() |
---|
array
string
getContentTypeField(string $contentType, string $fieldName) : string | false
inherited_from | \XenForo_Model::getContentTypeField() |
---|
string
string
string
false
getContentTypesWithField(string $fieldName) : array
inherited_from | \XenForo_Model::getContentTypesWithField() |
---|
string
array
Format: [content type] => field valuegetEffectiveTemplateByMapId(integer $templateMapId) : array | false
Returns all template information and the map ID.
integer
array
false
Effective template info.getEffectiveTemplateByTitle(string $title, integer $styleId) : array | false
This includes all template information and the map ID.
string
integer
array
false
Effective template info.getEffectiveTemplateListForStyle(integer $styleId, array $conditions, $fetchOptions) : array
"Effective" means a merged/flattened system where every valid template has a record.
This only returns data appropriate for a list view (map id, template id, title). Template_state is also calculated based on whether this template has been customized. State options: default, custom, inherited.
integer
array
Format: [] => (array) template list infogetEffectiveTemplatesByMapIds(\integery | array $templateMapIds) : array
Returns all template information and the map ID.
\integery
array
Either one map ID as a scalar or any array of map IDs
array
Format: [] => (array) effective template infogetEffectiveTemplatesByTitles(array $titles, integer $styleId) : array | false
array
integer
array
false
Effective template infogetIncludingTemplateMapIds(integer | array $mapIds) : array
For example, this would pass in the map ID of _header and get the map ID of the PAGE_CONTAINER.
integer
array
One map ID as a scalar or an array of many.
array
Array of map IDsgetMappedTemplatesByTemplateId(integer $templateId) : array
integer
array
Format: [] => (array) template map infogetMasterTemplatesInAddOn(string $addOnId) : array
string
array
Format: [title] => infogetModelFromCache(string $class) : \XenForo_Model
If it does not exist, it will be instantiated.
inherited_from | \XenForo_Model::getModelFromCache() |
---|
string
Name of the class to load
getOrderByClause(array $choices, array $fetchOptions, string $defaultOrderSql) : string
inherited_from | \XenForo_Model::getOrderByClause() |
---|
array
array
string
string
Order by clause or empty stringgetOutdatedTemplates() : array
Does not include contents of template.
array
[template id] => template info, including master_version_stringgetParentMappedTemplateByTitle(string $title, integer $styleId) : array | false
If the named style is 0 (or invalid), returns false.
string
integer
array
false
getTemplateById(integer $templateId) : array | false
integer
Template ID
array
false
TemplategetTemplateDevelopmentDirectory() : string
string
Path to templates directorygetTemplateIdInStylesByTitle(string $templateTitle) : array
string
array
Format: [style_id] => template_idgetTemplateInStyleByTitle(string $title, integer $styleId) : array
Note that if a version of the requested template does not exist in the specified style, nothing will be returned.
string
Title
integer
Style ID (defaults to master style)
array
getTemplateMapIdsThatIncludePhrase(string $phraseTitle) : array
string
array
List of template map IDsgetTemplatesByIds(array $templateIds) : array
array
array
getTemplatesInStyleByTitles(array $titles, integer $styleId) : array
Note that if a version of the requested template does not exist in the specified style, nothing will be returned for it.
array
List of titles
integer
Style ID (defaults to master style)
array
Format: [title] => infoimportTemplatesAddOnXml(\SimpleXMLElement $xml, string $addOnId, integer $maxExecution, integer $offset) : boolean | integer
string
Add-on to import for
integer
Maximum run time in seconds
integer
Number of elements to skip
boolean
integer
True on completion; false if the XML isn't correct; integer otherwise with new offset valueimportTemplatesFromDevelopment()
importTemplatesStyleXml(\SimpleXMLElement $xml, integer $styleId)
Note that this assumes the style is already empty. It does not check for conflicts.
\SimpleXMLElement
integer
insertTemplateMapForStyles(array $styleMapList, \bolean $truncate)
array
Format: [style id][title] => template id
\bolean
If true, all map data is truncated (quicker that way)
limitQueryResults(string $query, integer $limit, integer $offset) : string
If the limit value is 0 or less, no clause is applied.
inherited_from | \XenForo_Model::limitQueryResults() |
---|
string
SQL query to run
integer
Number of records to limit to; ignored if <= 0
integer
Offset from the start of the records. 0+
string
Query with limit applied if necessaryprepareLimitFetchOptions(array $fetchOptions) : array
Includes: limit, offset, page, and perPage.
inherited_from | \XenForo_Model::prepareLimitFetchOptions() |
---|
array
Unprepared options
array
Limit options; keys: limit, offsetprepareStateLimitFromConditions(array $fetchOptions, string $table, string $stateField, string $userField) : string
Looks for keys "deleted" and "moderated".
inherited_from | \XenForo_Model::prepareStateLimitFromConditions() |
---|
array
string
Name of the table to prefix the state and user fields with
string
Name of the field that holds the state
string
Name of the field that holds the user ID
string
SQL condition to limit stateprepareTemplateConditions(array $conditions, array $fetchOptions) : string
Often, this search will be done on an effective template set (using the map). Some conditions may require this.
array
array
string
SQL conditionsreplaceIncludesWithLinkRel(string $templateText) : string
string
string
replaceLinkRelWithIncludes(string $templateText) : string
string
string
resetLocalCacheData($name)
This can be used if you know when some cached data has expired.
inherited_from | \XenForo_Model::resetLocalCacheData() |
---|
setAllowCachedRead($allowCachedRead)
This may be controllable on an individual level basis, if the implementation allows it.
inherited_from | \XenForo_Model::setAllowCachedRead() |
---|
boolean
setLocalCacheData(string $name, $value)
This should only be used if you know what you're doing or for testing purposes!
Note that you cannot get the existing data via the public interface. If you think you need the set data, use a new object. It defaults to empty. :)
inherited_from | \XenForo_Model::setLocalCacheData() |
---|
string
standardizeNodePermissionsAndUserId(integer $nodeId, array | null $permissions, integer | null $userId)
If an invalid permission set or user ID is provided, the current visitor's will be used.
inherited_from | \XenForo_Model::standardizeNodePermissionsAndUserId() |
---|
integer
Node permissions are for
array
null
Permissions for node or null to use current visitor's permissions
integer
null
User permissions belong to or null to use current visitor
standardizePermissionCombinationIdAndUserId(integer | null $permissionCombinationId, integer | null $userId)
If null, users current visitor's values.
inherited_from | \XenForo_Model::standardizePermissionCombinationIdAndUserId() |
---|
integer
null
Permission combination ID or null to use current visitor
integer
null
User permissions belong to or null to use current visitor
standardizePermissionsAndUserId(array | null $permissions, integer | null $userId)
If an invalid permission set or user ID is provided, the current visitor's will be used.
inherited_from | \XenForo_Model::standardizePermissionsAndUserId() |
---|
array
null
Global pPermissions or null to use current visitor's permissions
integer
null
User permissions belong to or null to use current visitor
standardizeViewingUserReference(array $viewingUser)
This array must contain all basic user info (preferably all user info) and include global permissions in a "permissions" key. If not an array or missing a user_id, the visitor's values will be used.
inherited_from | \XenForo_Model::standardizeViewingUserReference() |
---|
array
null
standardizeViewingUserReferenceForNode(integer $nodeId, array $viewingUser, array $nodePermissions)
inherited_from | \XenForo_Model::standardizeViewingUserReferenceForNode() |
---|
integer
array
null
Viewing user; if null, use visitor
array
null
Permissions for this node; if null, use visitor's
unserializePermissionsInList(array $items, string $serializedKey, string $targetKey) : array
inherited_from | \XenForo_Model::unserializePermissionsInList() |
---|
array
List of items
string
Key where serialized permissions are
string
Key where unserialized permissions will go
array
List of items with permissions unserializedwriteTemplateFiles(boolean $enable, boolean $handleOptions)
boolean
Enable the templateFiles option after completion.
boolean
Manipulate the option values to ensure failsafe operation.
_buildTemplateMapForStyleTree(integer $styleId, array $map, array $styles, array $styleTree) : array
Calls itself recursively.
integer
Style to build (builds children automatically)
array
Base template map data. Format: [title] => template id
array
List of styles
array
Style tree
array
Format: [style id][title] => template id_getCache(boolean $forceCachedRead) : \Zend_Cache_Core | \Zend_Cache_Frontend | false
If cache reads are disabled, this will return false.
inherited_from | \XenForo_Model::_getCache() |
---|
boolean
If true, the global "allow cached read" value is ignored
\Zend_Cache_Core
\Zend_Cache_Frontend
false
_getDb() : \Zend_Db_Adapter_Abstract
inherited_from | \XenForo_Model::_getDb() |
---|
\Zend_Db_Adapter_Abstract
_getLocalCacheData(string $name) : mixed
inherited_from | \XenForo_Model::_getLocalCacheData() |
---|
string
mixed
$_allowCachedRead : boolean
If not, it should be retrieved from the source.
inherited_from | \XenForo_Model::$$_allowCachedRead |
---|
$_cache : \Zend_Cache_Core | \Zend_Cache_Frontend
inherited_from | \XenForo_Model::$$_cache |
---|
$_db : \Zend_Db_Adapter_Abstract
inherited_from | \XenForo_Model::$$_db |
---|
$_localCacheData : array
This data is generally treated as canonical, even if {$_allowCachedRead} is false.
inherited_from | \XenForo_Model::$$_localCacheData |
---|
$_modelCache : array
inherited_from | \XenForo_Model::$$_modelCache |
---|