__construct()
addFetchOptionJoin()
addPositionLimit()
appendPhrasesAddOnXml()
assertValidCutOffOperator()
buildPhraseMap()
buildPhraseMapForLanguageTree()
canImportPhrasesFromDevelopment()
canModifyPhraseInLanguage()
compileAllPhrases()
compileAllPhrasesInLanguage()
compileAndInsertEffectivePhrases()
compileAndInsertParsedPhrase()
compileMappedPhrasesInLanguageTree()
compileNamedPhraseInLanguageTree()
compilePhraseInLanguageTree()
countEffectivePhrasesInLanguage()
create()
deleteMasterPhrase()
deleteMasterPhrases()
deletePhrasesForAddOn()
fetchAllKeyed()
findPhraseMapUpdates()
getAllEffectivePhrasesInLanguage()
getAllPhrasesInLanguage()
getConditionsForClause()
getContentTypeField()
getContentTypesWithField()
getEffectivePhraseByMapId()
getEffectivePhraseByTitle()
getEffectivePhraseListForLanguage()
getEffectivePhraseValuesInAllLanguages()
getEffectivePhrasesByMapIds()
getGlobalPhraseCacheTitles()
getMappedPhrasesByPhraseId()
getMasterPhraseValue()
getMasterPhrasesInAddOn()
getModelFromCache()
getOrderByClause()
getOutdatedPhrases()
getParentMappedPhraseByTitle()
getPhraseById()
getPhraseDevelopmentDirectory()
getPhraseIdInLanguagesByTitle()
getPhraseInLanguageByTitle()
getPhrasesDevelopmentXml()
getPhrasesInLanguageByTitles()
getPhrasesMatchingSearchTextWithConstrainedTitles()
importPhrasesAddOnXml()
importPhrasesFromDevelopment()
importPhrasesXml()
insertOrUpdateMasterPhrase()
insertOrUpdateMasterPhrases()
insertPhraseMapForLanguages()
limitQueryResults()
mapUnhandledPhrases()
prepareLimitFetchOptions()
preparePhraseConditions()
prepareStateLimitFromConditions()
renameMasterPhrase()
renameMasterPhrases()
resetLocalCacheData()
setAllowCachedRead()
setLocalCacheData()
standardizeNodePermissionsAndUserId()
standardizePermissionCombinationIdAndUserId()
standardizePermissionsAndUserId()
standardizeViewingUserReference()
standardizeViewingUserReferenceForNode()
unserializePermissionsInList()
_buildPhraseMapForLanguageTree()
_getCache()
_getDataRegistryModel()
_getDb()
_getLanguageModel()
_getLocalCacheData()
$_allowCachedRead
$_cache
$_db
$_localCacheData
$_modelCache
Model for phrases
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_Phrase |
---|
__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 neededappendPhrasesAddOnXml(\DOMElement $rootNode, string $addOnId)
assertValidCutOffOperator(string $operator)
inherited_from | \XenForo_Model::assertValidCutOffOperator() |
---|
string
buildPhraseMap(string $title, array $data)
string
Title of the phrase being build
array
Injectable data. Supports languageTree and languagePhraseMap.
buildPhraseMapForLanguageTree(integer $languageId) : array
integer
Starting language. This language and all children will be built.
array
Format: [language id][title] => phrase idcanImportPhrasesFromDevelopment() : boolean
boolean
canModifyPhraseInLanguage(integer $languageId) : boolean
If debug mode is not enabled, users can't modify phrases in the master language.
integer
boolean
compileAllPhrases($maxExecution, $startLanguage, $startPhrase)
compileAllPhrasesInLanguage($languageId)
compileAndInsertEffectivePhrases(array $phrases)
array
Array of effective phrase info
compileAndInsertParsedPhrase(integer $phraseMapId, string | array $parsedPhrase, string $title, integer $compileLanguageId)
integer
The map ID of the phrase being compiled (for includes)
string
array
Parsed form of the phrase
string
Title of the phrase
integer
Language ID of the phrase
compileMappedPhrasesInLanguageTree(integer | array $phraseMapIds) : array
integer
array
One map ID as a scaler or many as an array
array
A list of phrase map IDs that were compiledcompileNamedPhraseInLanguageTree(string $title, integer $languageId) : array
Any child phrases that use this phrase will be recompiled as well.
string
integer
array
A list of phrase map IDs that were compiledcompilePhraseInLanguageTree(array $parsedRecord) : array
This compiles this phrase in any language that is actually using this phrase.
array
Full phrase information
array
List of phrase map IDs that were compiledcountEffectivePhrasesInLanguage($languageId, array $conditions)
create(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
deleteMasterPhrase(string $title, array $options)
string
array
deleteMasterPhrases(array $phraseTitles, array $options)
array
Phrase titles
array
deletePhrasesForAddOn(string $addOnId)
string
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
findPhraseMapUpdates(integer $parentId, array $languageTree, array $languagePhraseMap, integer $defaultPhraseId) : array
If {$defaultPhraseId} is non-0, a return entry will be inserted for {$parentId}.
integer
Parent of the language sub-tree to search.
array
Tree of languages
array
List of languageId => phraseId pairs for the places where this phrase has been customized.
integer
The default phrase ID that non-customized phrase in the sub-tree should get.
array
Format: [language id] => [effective phrase id]getAllEffectivePhrasesInLanguage(integer $languageId) : array
"Effective" means a merged/flattened system where every valid phrase has a record.
integer
array
Format: [] => (array) effective phrase infogetAllPhrasesInLanguage(integer $languageId) : array
integer
Language ID
array
Format: [title] => (array) languagegetConditionsForClause(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 valuegetEffectivePhraseByMapId(integer $phraseMapId) : array | false
Returns all phrase information and the map ID.
integer
array
false
Effective phrase info.getEffectivePhraseByTitle(string $title, integer $languageId) : array | false
This includes all phrase information and the map ID.
string
integer
array
false
Effective phrase info.getEffectivePhraseListForLanguage($languageId, array $conditions, array $fetchOptions) : array
"Effective" means a merged/flattened system where every valid phrase has a record.
This only returns data appropriate for a list view (map id, phrase id, title). phrase_state is also calculated based on whether this phrase has been customized. State options: default, custom, inherited.
array
Format: [] => (array) phrase list infogetEffectivePhraseValuesInAllLanguages(array $phraseList) : array
array
List of phrases to fetch
array
Format: [language id][title] => valuegetEffectivePhrasesByMapIds(\integery | array $phraseMapIds) : array
Returns all phrase information and the map ID.
\integery
array
Either one map ID as a scalar or any array of map IDs
array
Format: [] => (array) effective phrase infogetGlobalPhraseCacheTitles() : array
array
List of titlesgetMappedPhrasesByPhraseId(integer $phraseId) : array
integer
array
Format: [] => (array) phrase map infogetMasterPhraseValue(string $title) : string
string
string
Empty string if phrase is valuegetMasterPhrasesInAddOn(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 stringgetOutdatedPhrases() : array
Does not include contents of phrase.
array
[phrase id] => phrase info, including master_version_stringgetParentMappedPhraseByTitle(string $title, integer $languageId) : array | false
If the named language is 0 (or invalid), returns false.
string
integer
array
false
getPhraseById(integer $phraseId) : array | false
integer
phrase ID
array
false
phrasegetPhraseDevelopmentDirectory() : string
string
Path to development directorygetPhraseIdInLanguagesByTitle(string $phraseTitle) : array
string
array
Format: [language_id] => phrase_idgetPhraseInLanguageByTitle(string $title, integer $languageId) : array
Note that if a version of the requested phrase does not exist in the specified language, nothing will be returned.
string
Title
integer
language ID (defaults to master language)
array
getPhrasesInLanguageByTitles(array $titles, integer $languageId) : array
Note that if a version of the requested phrase does not exist in the specified language, nothing will be returned for that phrase.
array
List of titles
integer
language ID (defaults to master language)
array
Format: [title] => infogetPhrasesMatchingSearchTextWithConstrainedTitles(string $textSearch, string | array $titleConstraint, integer $maxResults, integer | null $languageId, array $viewingUser) : array
string
Text to find in phrase
string
array
Either a string to be LIKE lr quoted, or an array containing 0 => search text including wild card, 1 => wild card character
integer
Max results to return
integer
null
Language in which to search
array
Viewing user array
array
[title => text]importPhrasesAddOnXml(\SimpleXMLElement $xml, string $addOnId, integer $maxExecution, integer $offset) : boolean | integer
\SimpleXMLElement
string
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 valueimportPhrasesFromDevelopment()
importPhrasesXml(\SimpleXMLElement $xml, integer $languageId, string | null $addOnId, array $existingPhrases, integer $maxExecution, integer $offset)
This does not remove any phrases that may conflict; that is the responsibility of the caller.
integer
Target language ID
string
null
Add-on the phrases belong to; if null, read from xml
array
Existing phrases; used to detect and resolve conflicts
integer
Maximum run time in seconds
integer
Number of elements to skip
insertOrUpdateMasterPhrase(string $title, string $text, string $addOnId, array $extra, array $options)
Errors will be silently ignored.
string
string
string
array
Extra fields to set
array
insertOrUpdateMasterPhrases(array $phrases, string $addOnId, array $extra, array $options)
Errors will be silently ignored.
array
array
Key-value pairs of phrases to insert/update
string
Add-on all phrases belong to
array
Extra fields to set
array
insertPhraseMapForLanguages(array $languageMapList, boolean $truncate)
array
Format: [language id][title] => phrase id
boolean
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 necessarymapUnhandledPhrases()
prepareLimitFetchOptions(array $fetchOptions) : array
Includes: limit, offset, page, and perPage.
inherited_from | \XenForo_Model::prepareLimitFetchOptions() |
---|
array
Unprepared options
array
Limit options; keys: limit, offsetpreparePhraseConditions(array $conditions, array $fetchOptions)
prepareStateLimitFromConditions(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 staterenameMasterPhrase(string $oldName, string $newName, array $options)
If you get a conflict, it will be silently ignored.
string
string
array
renameMasterPhrases(array $phraseMap, array $options)
If you get a conflict, it will be silently ignored.
array
Format: [old name] => [new name]
array
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 unserialized_buildPhraseMapForLanguageTree(integer $languageId, array $map, array $languages, array $languageTree) : array
Calls itself recursively.
integer
Language to build (builds children automatically)
array
Base phrase map data. Format: [title] => phrase id
array
List of languages
array
Language tree
array
Format: [language id][title] => phrase 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 |
---|