Wikibase
MediaWiki Wikibase extension
Wikibase\Client\DataAccess\Scribunto\Scribunto_LuaWikibaseEntityLibrary Class Reference

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

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

Public Member Functions

 getUsageAccumulator ()
 
 addStatementUsage ( $entityId, $propertyId)
 Add a statement usage (called once specific statements are accessed). More...
 
 addLabelUsage ( $entityId, $langCode)
 Add a label usage (called once specific labels are accessed). More...
 
 addDescriptionUsage ( $entityId, $langCode)
 Add a description usage (called once specific descriptions are accessed). More...
 
 addSiteLinksUsage ( $entityId)
 Add a sitelinks usage (called once specific sitelinks are accessed). More...
 
 addOtherUsage ( $entityId)
 Add an other (O) usage (called once the otherwise not covered aspect is used). More...
 
 register ()
 Register mw.wikibase.entity.lua library. More...
 
 getGlobalSiteId ()
 Wrapper for getGlobalSiteId in WikibaseLuaEntityBindings. More...
 
 getLanguageCode ()
 Wrapper for getLanguageCode in WikibaseLuaEntityBindings. More...
 
 formatPropertyValues ( $entityId, $propertyLabelOrId, array $acceptableRanks=null)
 Format the main Snaks belonging to a Statement (which is identified by a PropertyId or the label of a Property) as wikitext escaped plain text. More...
 
 formatStatements ( $entityId, $propertyLabelOrId, array $acceptableRanks=null)
 Format the main Snaks belonging to a Statement (which is identified by a PropertyId or the label of a Property) as rich wikitext. More...
 
 incrementStatsKey ( $key)
 Increment the given stats key. More...
 

Private Member Functions

 getImplementation ()
 
 newImplementation ()
 
 newRichWikitextSnakFormatter (DataAccessSnakFormatterFactory $snakFormatterFactory, Language $lang)
 
 getLuaFunctionCallTracker ()
 
 getLanguage ()
 Returns the language to use. More...
 
 allowDataAccessInUserLanguage ()
 

Private Attributes

 $wbLibrary
 
 $luaFunctionCallTracker = null
 

Detailed Description

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

Author
Marius Hoch < hoo@o.nosp@m.nlin.nosp@m.e.de >
Andrew Hall

Member Function Documentation

◆ addDescriptionUsage()

Wikibase\Client\DataAccess\Scribunto\Scribunto_LuaWikibaseEntityLibrary::addDescriptionUsage (   $entityId,
  $langCode 
)

Add a description usage (called once specific descriptions are accessed).

Parameters
string$entityIdThe Entity from which the descriptions were accessed.
string$langCodeLanguage code of the descriptions accessed.

◆ addLabelUsage()

Wikibase\Client\DataAccess\Scribunto\Scribunto_LuaWikibaseEntityLibrary::addLabelUsage (   $entityId,
  $langCode 
)

Add a label usage (called once specific labels are accessed).

Parameters
string$entityIdThe Entity from which the labels were accessed.
string$langCodeLanguage code of the labels accessed.

◆ addOtherUsage()

Wikibase\Client\DataAccess\Scribunto\Scribunto_LuaWikibaseEntityLibrary::addOtherUsage (   $entityId)

Add an other (O) usage (called once the otherwise not covered aspect is used).

Parameters
string$entityIdThe Entity from which something was accessed.

◆ addSiteLinksUsage()

Wikibase\Client\DataAccess\Scribunto\Scribunto_LuaWikibaseEntityLibrary::addSiteLinksUsage (   $entityId)

Add a sitelinks usage (called once specific sitelinks are accessed).

Parameters
string$entityIdThe Entity from which the sitelinks were accessed.

◆ addStatementUsage()

Wikibase\Client\DataAccess\Scribunto\Scribunto_LuaWikibaseEntityLibrary::addStatementUsage (   $entityId,
  $propertyId 
)

Add a statement usage (called once specific statements are accessed).

Parameters
string$entityIdThe Entity from which the statements were accessed.
string$propertyIdProperty id of the statements accessed.

◆ allowDataAccessInUserLanguage()

Wikibase\Client\DataAccess\Scribunto\Scribunto_LuaWikibaseEntityLibrary::allowDataAccessInUserLanguage ( )
private
Returns
bool

◆ formatPropertyValues()

Wikibase\Client\DataAccess\Scribunto\Scribunto_LuaWikibaseEntityLibrary::formatPropertyValues (   $entityId,
  $propertyLabelOrId,
array  $acceptableRanks = null 
)

Format the main Snaks belonging to a Statement (which is identified by a PropertyId or the label of a Property) as wikitext escaped plain text.

Parameters
string$entityId
string$propertyLabelOrId
int[] | null$acceptableRanks
Exceptions
ScribuntoException
Returns
string[]|null[]

◆ formatStatements()

Wikibase\Client\DataAccess\Scribunto\Scribunto_LuaWikibaseEntityLibrary::formatStatements (   $entityId,
  $propertyLabelOrId,
array  $acceptableRanks = null 
)

Format the main Snaks belonging to a Statement (which is identified by a PropertyId or the label of a Property) as rich wikitext.

Parameters
string$entityId
string$propertyLabelOrId
int[] | null$acceptableRanks
Exceptions
ScribuntoException
Returns
string[]|null[]

◆ getGlobalSiteId()

Wikibase\Client\DataAccess\Scribunto\Scribunto_LuaWikibaseEntityLibrary::getGlobalSiteId ( )

Wrapper for getGlobalSiteId in WikibaseLuaEntityBindings.

Returns
string[]

◆ getImplementation()

Wikibase\Client\DataAccess\Scribunto\Scribunto_LuaWikibaseEntityLibrary::getImplementation ( )
private

◆ getLanguage()

Wikibase\Client\DataAccess\Scribunto\Scribunto_LuaWikibaseEntityLibrary::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.

Returns
Language

◆ getLanguageCode()

Wikibase\Client\DataAccess\Scribunto\Scribunto_LuaWikibaseEntityLibrary::getLanguageCode ( )

Wrapper for getLanguageCode in WikibaseLuaEntityBindings.

Returns
string[]

◆ getLuaFunctionCallTracker()

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

◆ getUsageAccumulator()

Wikibase\Client\DataAccess\Scribunto\Scribunto_LuaWikibaseEntityLibrary::getUsageAccumulator ( )
Returns
ParserOutputUsageAccumulator

◆ incrementStatsKey()

Wikibase\Client\DataAccess\Scribunto\Scribunto_LuaWikibaseEntityLibrary::incrementStatsKey (   $key)

Increment the given stats key.

Parameters
string$key

◆ newImplementation()

Wikibase\Client\DataAccess\Scribunto\Scribunto_LuaWikibaseEntityLibrary::newImplementation ( )
private

◆ newRichWikitextSnakFormatter()

Wikibase\Client\DataAccess\Scribunto\Scribunto_LuaWikibaseEntityLibrary::newRichWikitextSnakFormatter ( DataAccessSnakFormatterFactory  $snakFormatterFactory,
Language  $lang 
)
private
Parameters
DataAccessSnakFormatterFactory$snakFormatterFactory
Language$lang
Returns
WikitextPreprocessingSnakFormatter

◆ register()

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

Register mw.wikibase.entity.lua library.

Returns
array

Member Data Documentation

◆ $luaFunctionCallTracker

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

◆ $wbLibrary

Wikibase\Client\DataAccess\Scribunto\Scribunto_LuaWikibaseEntityLibrary::$wbLibrary
private

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