MediaWiki master
MediaWiki\Parser\LinkHolderArray Class Reference

Public Member Functions

 __construct (Parser $parent, ILanguageConverter $languageConverter, HookContainer $hookContainer)
 
 __destruct ()
 Reduce memory usage to reduce the impact of circular references.
 
 clear ()
 Clear all stored link holders.
 
 isBig ()
 Returns true if the memory requirements of this object are getting large.
 
 makeHolder (Title $nt, $text='', $trail='', $prefix='')
 Make a link placeholder.
 
 merge ( $other)
 Merge another LinkHolderArray into this one.
 
 replace (&$text)
 Replace link placeholders with actual links, in the buffer.
 
 replaceText ( $text)
 Replace and link placeholders with plain text of links (not HTML-formatted).
 

Protected Member Functions

 doVariants (&$classes)
 Modify $this->internals and $classes according to language variant linking rules.
 
 replaceInternal (&$text)
 Replace internal links.
 
 replaceInterwiki (&$text)
 Replace interwiki links.
 

Detailed Description

Access: internal
for using in Parser only.

Definition at line 41 of file LinkHolderArray.php.

Constructor & Destructor Documentation

◆ __construct()

MediaWiki\Parser\LinkHolderArray::__construct ( Parser $parent,
ILanguageConverter $languageConverter,
HookContainer $hookContainer )
Parameters
Parser$parent
ILanguageConverter$languageConverter
HookContainer$hookContainer

Definition at line 60 of file LinkHolderArray.php.

◆ __destruct()

MediaWiki\Parser\LinkHolderArray::__destruct ( )

Reduce memory usage to reduce the impact of circular references.

Definition at line 71 of file LinkHolderArray.php.

Member Function Documentation

◆ clear()

MediaWiki\Parser\LinkHolderArray::clear ( )

Clear all stored link holders.

Make sure you don't have any text left using these link holders, before you call this

Definition at line 108 of file LinkHolderArray.php.

◆ doVariants()

MediaWiki\Parser\LinkHolderArray::doVariants ( & $classes)
protected

Modify $this->internals and $classes according to language variant linking rules.

Parameters
string[]&$classes

Definition at line 318 of file LinkHolderArray.php.

References MediaWiki\MediaWikiServices\getInstance(), MediaWiki\Title\Title\getNamespace(), NS_CATEGORY, and NS_SPECIAL.

Referenced by MediaWiki\Parser\LinkHolderArray\replaceInternal().

◆ isBig()

MediaWiki\Parser\LinkHolderArray::isBig ( )

Returns true if the memory requirements of this object are getting large.

Returns
bool

Definition at line 98 of file LinkHolderArray.php.

References MediaWiki\MediaWikiServices\getInstance(), and MediaWiki\MainConfigNames\LinkHolderBatchSize.

◆ makeHolder()

MediaWiki\Parser\LinkHolderArray::makeHolder ( Title $nt,
$text = '',
$trail = '',
$prefix = '' )

Make a link placeholder.

The text returned can be later resolved to a real link with replaceLinkHolders(). This is done for two reasons: firstly to avoid further parsing of interwiki links, and secondly to allow all existence checks and article length checks (for stub links) to be bundled into a single query.

Parameters
Title$nt
string$text
string$trail[optional]
string$prefix[optional]
Returns
string

Definition at line 126 of file LinkHolderArray.php.

References MediaWiki\Title\Title\getNamespace(), MediaWiki\Title\Title\getPrefixedDBkey(), and MediaWiki\Linker\LinkTarget\isExternal().

◆ merge()

MediaWiki\Parser\LinkHolderArray::merge ( $other)

Merge another LinkHolderArray into this one.

Parameters
LinkHolderArray$other

Definition at line 82 of file LinkHolderArray.php.

◆ replace()

MediaWiki\Parser\LinkHolderArray::replace ( & $text)

Replace link placeholders with actual links, in the buffer.

Parameters
string&$text

Definition at line 154 of file LinkHolderArray.php.

References MediaWiki\Parser\LinkHolderArray\replaceInternal(), and MediaWiki\Parser\LinkHolderArray\replaceInterwiki().

◆ replaceInternal()

MediaWiki\Parser\LinkHolderArray::replaceInternal ( & $text)
protected

◆ replaceInterwiki()

MediaWiki\Parser\LinkHolderArray::replaceInterwiki ( & $text)
protected

Replace interwiki links.

Parameters
string&$text

Definition at line 291 of file LinkHolderArray.php.

References $matches.

Referenced by MediaWiki\Parser\LinkHolderArray\replace().

◆ replaceText()

MediaWiki\Parser\LinkHolderArray::replaceText ( $text)

Replace and link placeholders with plain text of links (not HTML-formatted).

Parameters
string$text
Returns
string

Definition at line 483 of file LinkHolderArray.php.

References $matches.


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