MediaWiki  1.34.0
Scribunto_LuaTitleLibrary Class Reference
Inheritance diagram for Scribunto_LuaTitleLibrary:
Collaboration diagram for Scribunto_LuaTitleLibrary:

Public Member Functions

 cascadingProtection ( $text)
 Handler for cascadingProtection. More...
 
 getContent ( $text)
 Handler for getContent. More...
 
 getExpensiveData ( $text)
 Extract expensive information from a Title object for return to Lua. More...
 
 getFileInfo ( $text)
 Handler for getFileInfo. More...
 
 getUrl ( $text, $which, $query=null, $proto=null)
 Get a URL referring to this title. More...
 
 makeTitle ( $ns, $text, $fragment=null, $interwiki=null)
 Handler for title.makeTitle. More...
 
 newTitle ( $text_or_id, $defaultNamespace=null)
 Handler for title.new. More...
 
 protectionLevels ( $text)
 Handler for protectionLevels. More...
 
 redirectTarget ( $text)
 Handler for redirectTarget. More...
 
 register ()
 Called to register the library. More...
 
- Public Member Functions inherited from Scribunto_LuaLibraryBase
 __construct (Scribunto_LuaEngine $engine)
 
 incrementExpensiveFunctionCount ()
 Increment the expensive function count, and throw if limit exceeded. More...
 

Private Member Functions

 checkNamespace ( $name, $argIdx, &$arg, $default=null)
 
 getContentInternal ( $text)
 Utility to get a Content object from a title. More...
 
 getInexpensiveTitleData (Title $title)
 Extract inexpensive information from a Title object for return to Lua. More...
 

Static Private Member Functions

static makeArrayOneBased ( $arr)
 

Private Attributes

 $idCache = [ 0 => null ]
 
 $titleCache = []
 

Additional Inherited Members

- Protected Member Functions inherited from Scribunto_LuaLibraryBase
 checkType ( $name, $argIdx, $arg, $expectType)
 Check the type of a variable. More...
 
 checkTypeOptional ( $name, $argIdx, &$arg, $expectType, $default)
 Check the type of a variable, with default if null. More...
 
 getEngine ()
 Get the engine. More...
 
 getInterpreter ()
 Get the interpreter. More...
 
 getLuaType ( $var)
 Get the Lua type corresponding to the type of the variable. More...
 
 getParser ()
 Get the parser. More...
 
 getParserOptions ()
 Get the parser options. More...
 
 getTitle ()
 Get the title. More...
 

Detailed Description

Definition at line 3 of file TitleLibrary.php.

Member Function Documentation

◆ cascadingProtection()

Scribunto_LuaTitleLibrary::cascadingProtection (   $text)

◆ checkNamespace()

Scribunto_LuaTitleLibrary::checkNamespace (   $name,
  $argIdx,
$arg,
  $default = null 
)
private

Definition at line 29 of file TitleLibrary.php.

References $wgContLang, Scribunto_LuaLibraryBase\checkType(), and MWNamespace\exists().

Referenced by makeTitle(), and newTitle().

◆ getContent()

Scribunto_LuaTitleLibrary::getContent (   $text)

Handler for getContent.

Definition at line 296 of file TitleLibrary.php.

References $content, Scribunto_LuaLibraryBase\checkType(), and getContentInternal().

◆ getContentInternal()

Scribunto_LuaTitleLibrary::getContentInternal (   $text)
private

Utility to get a Content object from a title.

The title is counted as a transclusion.

Parameters
$textstring Title text
Returns
Content|null The Content object of the title, null if missing

Definition at line 267 of file TitleLibrary.php.

References $title, Scribunto_LuaLibraryBase\getParser(), Title\newFromText(), and wfDebug().

Referenced by getContent(), and redirectTarget().

◆ getExpensiveData()

Scribunto_LuaTitleLibrary::getExpensiveData (   $text)

Extract expensive information from a Title object for return to Lua.

This records a link to this title in the current ParserOutput and caches the title for repeated lookups. It may call incrementExpensiveFunctionCount() if the title is not already cached.

Definition at line 95 of file TitleLibrary.php.

References $title, Scribunto_LuaLibraryBase\checkType(), SpecialPageFactory\exists(), Scribunto_LuaLibraryBase\getParser(), Scribunto_LuaLibraryBase\incrementExpensiveFunctionCount(), Title\newFromText(), and NS_SPECIAL.

◆ getFileInfo()

Scribunto_LuaTitleLibrary::getFileInfo (   $text)

◆ getInexpensiveTitleData()

Scribunto_LuaTitleLibrary::getInexpensiveTitleData ( Title  $title)
private

Extract inexpensive information from a Title object for return to Lua.

Parameters
Title$titleTitle to return
Returns
array Lua data

Definition at line 60 of file TitleLibrary.php.

References $title, Title\equals(), SpecialPageFactory\exists(), Scribunto_LuaLibraryBase\getParser(), NS_FILE, NS_MEDIA, and NS_SPECIAL.

Referenced by makeTitle(), newTitle(), redirectTarget(), and register().

◆ getUrl()

Scribunto_LuaTitleLibrary::getUrl (   $text,
  $which,
  $query = null,
  $proto = null 
)

◆ makeArrayOneBased()

static Scribunto_LuaTitleLibrary::makeArrayOneBased (   $arr)
staticprivate

Definition at line 352 of file TitleLibrary.php.

Referenced by cascadingProtection().

◆ makeTitle()

Scribunto_LuaTitleLibrary::makeTitle (   $ns,
  $text,
  $fragment = null,
  $interwiki = null 
)

◆ newTitle()

Scribunto_LuaTitleLibrary::newTitle (   $text_or_id,
  $defaultNamespace = null 
)

◆ protectionLevels()

Scribunto_LuaTitleLibrary::protectionLevels (   $text)

◆ redirectTarget()

Scribunto_LuaTitleLibrary::redirectTarget (   $text)

Handler for redirectTarget.

Definition at line 413 of file TitleLibrary.php.

References $content, Scribunto_LuaLibraryBase\checkType(), getContentInternal(), and getInexpensiveTitleData().

◆ register()

Scribunto_LuaTitleLibrary::register ( )

Called to register the library.

This should do any necessary setup and then call $this->getEngine()->registerInterface(). The value returned by that call should be returned from this function, and must be for 'deferLoad' libraries to work right.

Returns
array Lua package

Reimplemented from Scribunto_LuaLibraryBase.

Definition at line 11 of file TitleLibrary.php.

References Scribunto_LuaLibraryBase\getEngine(), getInexpensiveTitleData(), Scribunto_LuaLibraryBase\getTitle(), and NS_MEDIA.

Member Data Documentation

◆ $idCache

Scribunto_LuaTitleLibrary::$idCache = [ 0 => null ]
private

Definition at line 9 of file TitleLibrary.php.

◆ $titleCache

Scribunto_LuaTitleLibrary::$titleCache = []
private

Definition at line 8 of file TitleLibrary.php.


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