MediaWiki  master
LinkHolderArray Class Reference
Collaboration diagram for LinkHolderArray:

Public Member Functions

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

Public Attributes

array[][] $internals = []
 
array[] $interwikis = []
 
Parser $parent
 
int $size = 0
 

Protected Member Functions

 doVariants (&$colours)
 Modify $this->internals and $colours according to language variant linking rules. More...
 
 replaceInternal (&$text)
 Replace internal links SecurityCheck-XSS Gets confused with $entry['pdbk']. More...
 
 replaceInterwiki (&$text)
 Replace interwiki links. More...
 

Protected Attributes

 $tempIdOffset
 

Private Attributes

ILanguageConverter $languageConverter
 Current language converter. More...
 

Detailed Description

Definition at line 31 of file LinkHolderArray.php.

Constructor & Destructor Documentation

◆ __construct()

LinkHolderArray::__construct (   $parent,
ILanguageConverter  $languageConverter = null 
)
Parameters
Parser$parent
ILanguageConverter | null$languageConverter

Definition at line 55 of file LinkHolderArray.php.

References $languageConverter, $parent, and newArgumentWithDeprecation().

◆ __destruct()

LinkHolderArray::__destruct ( )

Reduce memory usage to reduce the impact of circular references.

Definition at line 72 of file LinkHolderArray.php.

Member Function Documentation

◆ clear()

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()

LinkHolderArray::doVariants ( $colours)
protected

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

Parameters
array&$colours

Definition at line 348 of file LinkHolderArray.php.

References $dbr, $s, $title, DB_REPLICA, LinkCache\getSelectFields(), Title\makeTitle(), Title\makeTitleSafe(), NS_CATEGORY, NS_SPECIAL, Hooks\run(), and wfGetDB().

Referenced by replaceInternal().

◆ isBig()

LinkHolderArray::isBig ( )

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

Returns
bool

Definition at line 99 of file LinkHolderArray.php.

References $wgLinkHolderBatchSize.

◆ makeHolder()

LinkHolderArray::makeHolder (   $nt,
  $text = '',
  $query = [],
  $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
array$query[optional]
string$trail[optional]
string$prefix[optional]
Returns
string

Definition at line 127 of file LinkHolderArray.php.

References Linker\splitTrail().

◆ merge()

LinkHolderArray::merge (   $other)

Merge another LinkHolderArray into this one.

Parameters
LinkHolderArray$other

Definition at line 83 of file LinkHolderArray.php.

◆ replace()

LinkHolderArray::replace ( $text)

Replace link placeholders with actual links, in the buffer.

Parameters
string&$text

Definition at line 165 of file LinkHolderArray.php.

References replaceInternal(), and replaceInterwiki().

◆ replaceInternal()

LinkHolderArray::replaceInternal ( $text)
protected

Replace internal links SecurityCheck-XSS Gets confused with $entry['pdbk'].

Parameters
string&$text

Definition at line 175 of file LinkHolderArray.php.

References $dbr, $matches, $res, $s, $title, DB_REPLICA, doVariants(), LinkCache\getSelectFields(), Linker\makeSelfLinkObj(), Title\makeTitle(), NS_SPECIAL, Hooks\run(), and wfGetDB().

Referenced by replace().

◆ replaceInterwiki()

LinkHolderArray::replaceInterwiki ( $text)
protected

Replace interwiki links.

Parameters
string&$textSecurityCheck-XSS Gets confused with $this->interwikis['pdbk']

Definition at line 318 of file LinkHolderArray.php.

References $matches.

Referenced by replace().

◆ replaceText()

LinkHolderArray::replaceText (   $text)

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

Parameters
string$text
Returns
string

Definition at line 512 of file LinkHolderArray.php.

References $matches.

Member Data Documentation

◆ $internals

array [][] LinkHolderArray::$internals = []

Definition at line 33 of file LinkHolderArray.php.

◆ $interwikis

array [] LinkHolderArray::$interwikis = []

Definition at line 35 of file LinkHolderArray.php.

◆ $languageConverter

ILanguageConverter LinkHolderArray::$languageConverter
private

Current language converter.

Definition at line 49 of file LinkHolderArray.php.

Referenced by __construct().

◆ $parent

Parser LinkHolderArray::$parent

Definition at line 42 of file LinkHolderArray.php.

Referenced by __construct().

◆ $size

int LinkHolderArray::$size = 0

Definition at line 37 of file LinkHolderArray.php.

◆ $tempIdOffset

LinkHolderArray::$tempIdOffset
protected

Definition at line 43 of file LinkHolderArray.php.


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