Wikibase
MediaWiki Wikibase extension
Loading...
Searching...
No Matches
Wikibase\Client\DataAccess\Scribunto\WikibaseLibrary Class Reference

Registers and defines functions to access Wikibase through the Scribunto extension. More...

+ Inheritance diagram for Wikibase\Client\DataAccess\Scribunto\WikibaseLibrary:
+ Collaboration diagram for Wikibase\Client\DataAccess\Scribunto\WikibaseLibrary:

Public Member Functions

 getUsageAccumulator ()
 
 register ()
 Register mw.wikibase.lua library.
 
 getEntity (string $prefixedEntityId)
 Wrapper for getEntity in EntityAccessor.
 
 getReferencedEntityId (string $prefixedFromEntityId, string $prefixedPropertyId, array $prefixedToIds)
 Wrapper for getReferencedEntityId in WikibaseLanguageIndependentLuaBindings.
 
 entityExists (string $prefixedEntityId)
 Wrapper for entityExists in EntityAccessor.
 
 getEntityStatements (string $prefixedEntityId, string $propertyId, string $rank)
 Wrapper for getEntityStatements in EntityAccessor.
 
 getEntityId (string $pageTitle, ?string $globalSiteId=null)
 Wrapper for getEntityId in WikibaseLanguageIndependentLuaBindings.
 
 getEntityUrl (string $entityIdSerialization)
 
 setRepoLinker (RepoLinker $repoLinker)
 
 getLabel (string $prefixedEntityId)
 Wrapper for getLabel in WikibaseLanguageDependentLuaBindings.
 
 getLabelByLanguage (string $prefixedEntityId, string $languageCode)
 Wrapper for getLabelByLanguage in WikibaseLanguageIndependentLuaBindings.
 
 getDescription (string $prefixedEntityId)
 Wrapper for getDescription in WikibaseLanguageDependentLuaBindings.
 
 getDescriptionByLanguage (string $prefixedEntityId, string $languageCode)
 Wrapper for getDescriptionByLanguage in WikibaseLanguageIndependentLuaBindings.
 
 getSiteLinkPageName (string $prefixedItemId, ?string $globalSiteId)
 Wrapper for getSiteLinkPageName in WikibaseLanguageIndependentLuaBindings.
 
 getBadges (string $prefixedEntityId, ?string $globalSiteId)
 Wrapper for getBadges in WikibaseLanguageIndependentLuaBindings.
 
 isValidEntityId (string $entityIdSerialization)
 Wrapper for WikibaseLanguageIndependentLuaBindings::isValidEntityId.
 
 renderSnak (array $snakSerialization)
 Wrapper for SnakSerializationRenderer::renderSnak, set to output wikitext escaped plain text.
 
 formatValue (array $snakSerialization)
 Wrapper for SnakSerializationRenderer::renderSnak, set to output rich wikitext.
 
 renderSnaks (array $snaksSerialization)
 Wrapper for SnakSerializationRenderer::renderSnaks, set to output wikitext escaped plain text.
 
 formatValues (array $snaksSerialization)
 Wrapper for SnakSerializationRenderer::renderSnaks, set to output rich wikitext.
 
 resolvePropertyId (string $propertyLabelOrId)
 Wrapper for PropertyIdResolver.
 
 orderProperties (array $propertyIds)
 
 getPropertyOrder ()
 Return the order of properties as provided by the PropertyOrderProvider.
 
 incrementStatsKey (string $key)
 Increment the given stats key.
 
 getEntityModuleName (string $prefixedEntityId)
 Get the entity module name to use for the entity with this ID.
 
 setPropertyOrderProvider (PropertyOrderProvider $propertyOrderProvider)
 
 getParserOutput ()
 

Private Member Functions

 getLanguageIndependentLuaBindings ()
 
 getLanguageDependentLuaBindings ()
 
 getEntityAccessor ()
 
 getSnakSerializationRenderer (string $type)
 
 getLanguageFallbackChain ()
 
 getPropertyIdResolver ()
 
 getLanguage ()
 Returns the language to use.
 
 getLuaFunctionCallTracker ()
 
 allowDataAccessInUserLanguage ()
 
 newEntityAccessor ()
 
 newSnakSerializationRenderer (string $type)
 
 newLanguageDependentLuaBindings ()
 
 newLanguageIndependentLuaBindings ()
 
 getEntityIdParser ()
 
 parseUserGivenEntityId (string $idSerialization)
 
 getRepoLinker ()
 
 getPropertyOrderProvider ()
 
 getLuaEntityModules ()
 

Private Attributes

 $languageIndependentLuaBindings = null
 
 $languageDependentLuaBindings = null
 
 $entityAccessor = null
 
 $snakSerializationRenderers = []
 
 $termFallbackChain = null
 
 $usageAccumulator = null
 
 $propertyIdResolver = null
 
 $propertyOrderProvider = null
 
 $entityIdParser = null
 
 $repoLinker = null
 
 $luaFunctionCallTracker = null
 
 $luaEntityModules = null
 

Detailed Description

Registers and defines functions to access Wikibase through the Scribunto extension.

Member Function Documentation

◆ allowDataAccessInUserLanguage()

Wikibase\Client\DataAccess\Scribunto\WikibaseLibrary::allowDataAccessInUserLanguage ( )
private

◆ entityExists()

Wikibase\Client\DataAccess\Scribunto\WikibaseLibrary::entityExists ( string $prefixedEntityId)

Wrapper for entityExists in EntityAccessor.

Exceptions
ScribuntoException
Returns
bool[]

◆ formatValue()

Wikibase\Client\DataAccess\Scribunto\WikibaseLibrary::formatValue ( array $snakSerialization)

Wrapper for SnakSerializationRenderer::renderSnak, set to output rich wikitext.

Exceptions
ScribuntoException
Returns
string[] Wikitext

◆ formatValues()

Wikibase\Client\DataAccess\Scribunto\WikibaseLibrary::formatValues ( array $snaksSerialization)

Wrapper for SnakSerializationRenderer::renderSnaks, set to output rich wikitext.

Parameters
array[]$snaksSerialization
Exceptions
ScribuntoException
Returns
string[] Wikitext

◆ getBadges()

Wikibase\Client\DataAccess\Scribunto\WikibaseLibrary::getBadges ( string $prefixedEntityId,
?string $globalSiteId )

Wrapper for getBadges in WikibaseLanguageIndependentLuaBindings.

Returns
string[][]

◆ getDescription()

Wikibase\Client\DataAccess\Scribunto\WikibaseLibrary::getDescription ( string $prefixedEntityId)

Wrapper for getDescription in WikibaseLanguageDependentLuaBindings.

Returns
string[]|null[]

◆ getDescriptionByLanguage()

Wikibase\Client\DataAccess\Scribunto\WikibaseLibrary::getDescriptionByLanguage ( string $prefixedEntityId,
string $languageCode )

Wrapper for getDescriptionByLanguage in WikibaseLanguageIndependentLuaBindings.

Returns
string[]|null[]

◆ getEntity()

Wikibase\Client\DataAccess\Scribunto\WikibaseLibrary::getEntity ( string $prefixedEntityId)

Wrapper for getEntity in EntityAccessor.

Exceptions
ScribuntoException

◆ getEntityAccessor()

Wikibase\Client\DataAccess\Scribunto\WikibaseLibrary::getEntityAccessor ( )
private

◆ getEntityId()

Wikibase\Client\DataAccess\Scribunto\WikibaseLibrary::getEntityId ( string $pageTitle,
?string $globalSiteId = null )

Wrapper for getEntityId in WikibaseLanguageIndependentLuaBindings.

◆ getEntityIdParser()

Wikibase\Client\DataAccess\Scribunto\WikibaseLibrary::getEntityIdParser ( )
private

◆ getEntityModuleName()

Wikibase\Client\DataAccess\Scribunto\WikibaseLibrary::getEntityModuleName ( string $prefixedEntityId)

Get the entity module name to use for the entity with this ID.

Returns
string[]

◆ getEntityStatements()

Wikibase\Client\DataAccess\Scribunto\WikibaseLibrary::getEntityStatements ( string $prefixedEntityId,
string $propertyId,
string $rank )

Wrapper for getEntityStatements in EntityAccessor.

Parameters
string$prefixedEntityId
string$propertyId
string$rankWhich statements to include. Either "best" or "all".
Exceptions
ScribuntoException

◆ getEntityUrl()

Wikibase\Client\DataAccess\Scribunto\WikibaseLibrary::getEntityUrl ( string $entityIdSerialization)
Parameters
string$entityIdSerializationentity ID serialization
Returns
string[]|null[]

◆ getLabel()

Wikibase\Client\DataAccess\Scribunto\WikibaseLibrary::getLabel ( string $prefixedEntityId)

Wrapper for getLabel in WikibaseLanguageDependentLuaBindings.

Returns
string[]|null[]

◆ getLabelByLanguage()

Wikibase\Client\DataAccess\Scribunto\WikibaseLibrary::getLabelByLanguage ( string $prefixedEntityId,
string $languageCode )

Wrapper for getLabelByLanguage in WikibaseLanguageIndependentLuaBindings.

Returns
string[]|null[]

◆ getLanguage()

Wikibase\Client\DataAccess\Scribunto\WikibaseLibrary::getLanguage ( )
private

Returns the language to use.

If we are on a multilingual wiki (allowDataAccessInUserLanguage is true) this will be the user's interface language, otherwise it will be the content language. In a perfect world, this would equal Parser::getTargetLanguage.

This can probably be removed after T114640 has been implemented.

Please note, that this splits the parser cache by user language, if allowDataAccessInUserLanguage is true.

◆ getLanguageDependentLuaBindings()

Wikibase\Client\DataAccess\Scribunto\WikibaseLibrary::getLanguageDependentLuaBindings ( )
private

◆ getLanguageFallbackChain()

Wikibase\Client\DataAccess\Scribunto\WikibaseLibrary::getLanguageFallbackChain ( )
private

◆ getLanguageIndependentLuaBindings()

Wikibase\Client\DataAccess\Scribunto\WikibaseLibrary::getLanguageIndependentLuaBindings ( )
private

◆ getLuaEntityModules()

Wikibase\Client\DataAccess\Scribunto\WikibaseLibrary::getLuaEntityModules ( )
private

◆ getLuaFunctionCallTracker()

Wikibase\Client\DataAccess\Scribunto\WikibaseLibrary::getLuaFunctionCallTracker ( )
private

◆ getParserOutput()

Wikibase\Client\DataAccess\Scribunto\WikibaseLibrary::getParserOutput ( )

◆ getPropertyIdResolver()

Wikibase\Client\DataAccess\Scribunto\WikibaseLibrary::getPropertyIdResolver ( )
private

◆ getPropertyOrder()

Wikibase\Client\DataAccess\Scribunto\WikibaseLibrary::getPropertyOrder ( )

Return the order of properties as provided by the PropertyOrderProvider.

Returns
array[] either int[][] or null[][]

◆ getPropertyOrderProvider()

Wikibase\Client\DataAccess\Scribunto\WikibaseLibrary::getPropertyOrderProvider ( )
private

◆ getReferencedEntityId()

Wikibase\Client\DataAccess\Scribunto\WikibaseLibrary::getReferencedEntityId ( string $prefixedFromEntityId,
string $prefixedPropertyId,
array $prefixedToIds )

Wrapper for getReferencedEntityId in WikibaseLanguageIndependentLuaBindings.

Parameters
string$prefixedFromEntityId
string$prefixedPropertyId
string[]$prefixedToIds
Exceptions
ScribuntoException

◆ getRepoLinker()

Wikibase\Client\DataAccess\Scribunto\WikibaseLibrary::getRepoLinker ( )
private

◆ getSiteLinkPageName()

Wikibase\Client\DataAccess\Scribunto\WikibaseLibrary::getSiteLinkPageName ( string $prefixedItemId,
?string $globalSiteId )

Wrapper for getSiteLinkPageName in WikibaseLanguageIndependentLuaBindings.

Returns
string[]

◆ getSnakSerializationRenderer()

Wikibase\Client\DataAccess\Scribunto\WikibaseLibrary::getSnakSerializationRenderer ( string $type)
private
Parameters
string$typeOne of DataAccessSnakFormatterFactory::TYPE_*

◆ getUsageAccumulator()

Wikibase\Client\DataAccess\Scribunto\WikibaseLibrary::getUsageAccumulator ( )

◆ incrementStatsKey()

Wikibase\Client\DataAccess\Scribunto\WikibaseLibrary::incrementStatsKey ( string $key)

Increment the given stats key.

◆ isValidEntityId()

Wikibase\Client\DataAccess\Scribunto\WikibaseLibrary::isValidEntityId ( string $entityIdSerialization)

Wrapper for WikibaseLanguageIndependentLuaBindings::isValidEntityId.

Exceptions
ScribuntoException
Returns
bool[] One bool telling whether the entity id is valid (parseable).

◆ newEntityAccessor()

Wikibase\Client\DataAccess\Scribunto\WikibaseLibrary::newEntityAccessor ( )
private

◆ newLanguageDependentLuaBindings()

Wikibase\Client\DataAccess\Scribunto\WikibaseLibrary::newLanguageDependentLuaBindings ( )
private

◆ newLanguageIndependentLuaBindings()

Wikibase\Client\DataAccess\Scribunto\WikibaseLibrary::newLanguageIndependentLuaBindings ( )
private

◆ newSnakSerializationRenderer()

Wikibase\Client\DataAccess\Scribunto\WikibaseLibrary::newSnakSerializationRenderer ( string $type)
private
Parameters
string$typeOne of DataAccessSnakFormatterFactory::TYPE_*

◆ orderProperties()

Wikibase\Client\DataAccess\Scribunto\WikibaseLibrary::orderProperties ( array $propertyIds)
Parameters
string[]$propertyIds
Returns
array[]

◆ parseUserGivenEntityId()

Wikibase\Client\DataAccess\Scribunto\WikibaseLibrary::parseUserGivenEntityId ( string $idSerialization)
private
Exceptions
ScribuntoException

◆ register()

Wikibase\Client\DataAccess\Scribunto\WikibaseLibrary::register ( )

Register mw.wikibase.lua library.

Returns
array

◆ renderSnak()

Wikibase\Client\DataAccess\Scribunto\WikibaseLibrary::renderSnak ( array $snakSerialization)

Wrapper for SnakSerializationRenderer::renderSnak, set to output wikitext escaped plain text.

Exceptions
ScribuntoException
Returns
string[] Wikitext

◆ renderSnaks()

Wikibase\Client\DataAccess\Scribunto\WikibaseLibrary::renderSnaks ( array $snaksSerialization)

Wrapper for SnakSerializationRenderer::renderSnaks, set to output wikitext escaped plain text.

Parameters
array[]$snaksSerialization
Exceptions
ScribuntoException
Returns
string[] Wikitext

◆ resolvePropertyId()

Wikibase\Client\DataAccess\Scribunto\WikibaseLibrary::resolvePropertyId ( string $propertyLabelOrId)

Wrapper for PropertyIdResolver.

Returns
string[]|null[]

◆ setPropertyOrderProvider()

Wikibase\Client\DataAccess\Scribunto\WikibaseLibrary::setPropertyOrderProvider ( PropertyOrderProvider $propertyOrderProvider)

◆ setRepoLinker()

Wikibase\Client\DataAccess\Scribunto\WikibaseLibrary::setRepoLinker ( RepoLinker $repoLinker)

Member Data Documentation

◆ $entityAccessor

Wikibase\Client\DataAccess\Scribunto\WikibaseLibrary::$entityAccessor = null
private

◆ $entityIdParser

Wikibase\Client\DataAccess\Scribunto\WikibaseLibrary::$entityIdParser = null
private

◆ $languageDependentLuaBindings

Wikibase\Client\DataAccess\Scribunto\WikibaseLibrary::$languageDependentLuaBindings = null
private

◆ $languageIndependentLuaBindings

Wikibase\Client\DataAccess\Scribunto\WikibaseLibrary::$languageIndependentLuaBindings = null
private

◆ $luaEntityModules

Wikibase\Client\DataAccess\Scribunto\WikibaseLibrary::$luaEntityModules = null
private

◆ $luaFunctionCallTracker

Wikibase\Client\DataAccess\Scribunto\WikibaseLibrary::$luaFunctionCallTracker = null
private

◆ $propertyIdResolver

Wikibase\Client\DataAccess\Scribunto\WikibaseLibrary::$propertyIdResolver = null
private

◆ $propertyOrderProvider

Wikibase\Client\DataAccess\Scribunto\WikibaseLibrary::$propertyOrderProvider = null
private

◆ $repoLinker

Wikibase\Client\DataAccess\Scribunto\WikibaseLibrary::$repoLinker = null
private

◆ $snakSerializationRenderers

Wikibase\Client\DataAccess\Scribunto\WikibaseLibrary::$snakSerializationRenderers = []
private

◆ $termFallbackChain

Wikibase\Client\DataAccess\Scribunto\WikibaseLibrary::$termFallbackChain = null
private

◆ $usageAccumulator

Wikibase\Client\DataAccess\Scribunto\WikibaseLibrary::$usageAccumulator = null
private

The documentation for this class was generated from the following file: