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

Public Member Functions

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

Private Member Functions

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

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.
 
 checkTypeOptional ( $name, $argIdx, &$arg, $expectType, $default)
 Check the type of a variable, with default if null.
 
 getEngine ()
 Get the engine.
 
 getInterpreter ()
 Get the interpreter.
 
 getLuaType ( $var)
 Get the Lua type corresponding to the type of the variable.
 
 getParser ()
 Get the parser.
 
 getParserOptions ()
 Get the parser options.
 
 getTitle ()
 Get the title.
 

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(), 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(), Scribunto_LuaLibraryBase\getParser(), Scribunto_LuaLibraryBase\incrementExpensiveFunctionCount(), 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(), Scribunto_LuaLibraryBase\getParser(), Scribunto_LuaLibraryBase\getTitle(), 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 )

Handler for title.makeTitle.

Calls Title::makeTitleSafe.

Definition at line 197 of file TitleLibrary.php.

References $title, checkNamespace(), Scribunto_LuaLibraryBase\checkType(), Scribunto_LuaLibraryBase\checkTypeOptional(), and getInexpensiveTitleData().

◆ newTitle()

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

Handler for title.new.

Calls Title::newFromID or Title::newFromTitle as appropriate for the arguments.

Definition at line 148 of file TitleLibrary.php.

References $title, $type, checkNamespace(), Scribunto_LuaLibraryBase\checkType(), getInexpensiveTitleData(), Scribunto_LuaLibraryBase\getLuaType(), Scribunto_LuaLibraryBase\getParser(), Scribunto_LuaLibraryBase\incrementExpensiveFunctionCount(), and NS_MAIN.

◆ protectionLevels()

Scribunto_LuaTitleLibrary::protectionLevels ( $text)

Handler for protectionLevels.

Definition at line 365 of file TitleLibrary.php.

References $title, Scribunto_LuaLibraryBase\checkType(), and Scribunto_LuaLibraryBase\incrementExpensiveFunctionCount().

◆ 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: