MediaWiki REL1_33
LinkHolderArray Class Reference
Collaboration diagram for LinkHolderArray:

Public Member Functions

 __construct ( $parent)
 
 __destruct ()
 Reduce memory usage to reduce the impact of circular references.
 
 __sleep ()
 Don't serialize the parent object, it is big, and not needed when it is a parameter to mergeForeign(), which is the only application of serializing at present.
 
 __wakeup ()
 Recreate the Title objects.
 
 clear ()
 Clear all stored link holders.
 
 getSubArray ( $text)
 Get a subset of the current LinkHolderArray which is sufficient to interpret the given text.
 
 isBig ()
 Returns true if the memory requirements of this object are getting large.
 
 makeHolder ( $nt, $text='', $query=[], $trail='', $prefix='')
 Make a link placeholder.
 
 merge ( $other)
 Merge another LinkHolderArray into this one.
 
 mergeForeign ( $other, $texts)
 Merge a LinkHolderArray from another parser instance into this one.
 
 replace (&$text)
 Replace link placeholders with actual links, in the buffer.
 
 replaceText ( $text)
 Replace link placeholders with plain text of links (not HTML-formatted).
 
 replaceTextCallback ( $matches)
 Callback for replaceText()
 

Public Attributes

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

Protected Member Functions

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

Protected Attributes

 $tempIdOffset
 

Detailed Description

Definition at line 29 of file LinkHolderArray.php.

Constructor & Destructor Documentation

◆ __construct()

LinkHolderArray::__construct ( $parent)
Parameters
Parser$parent

Definition at line 43 of file LinkHolderArray.php.

References $parent.

◆ __destruct()

LinkHolderArray::__destruct ( )

Reduce memory usage to reduce the impact of circular references.

Definition at line 50 of file LinkHolderArray.php.

References $value, and and().

Member Function Documentation

◆ __sleep()

LinkHolderArray::__sleep ( )

Don't serialize the parent object, it is big, and not needed when it is a parameter to mergeForeign(), which is the only application of serializing at present.

Compact the titles, only serialize the text form.

Returns
array

Definition at line 64 of file LinkHolderArray.php.

References and().

◆ __wakeup()

LinkHolderArray::__wakeup ( )

Recreate the Title objects.

Definition at line 84 of file LinkHolderArray.php.

References and().

◆ 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 214 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 454 of file LinkHolderArray.php.

References $colours, $dbr, $linkRenderer, $output, $s, and(), DB_REPLICA, list, NS_CATEGORY, NS_SPECIAL, and wfGetDB().

Referenced by replaceInternal().

◆ getSubArray()

LinkHolderArray::getSubArray ( $text)

Get a subset of the current LinkHolderArray which is sufficient to interpret the given text.

Parameters
string$text
Returns
LinkHolderArray

Definition at line 171 of file LinkHolderArray.php.

References and().

◆ isBig()

LinkHolderArray::isBig ( )

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

Returns
bool

Definition at line 205 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 233 of file LinkHolderArray.php.

References $query, and(), list, and Linker\splitTrail().

◆ merge()

LinkHolderArray::merge ( $other)

Merge another LinkHolderArray into this one.

Parameters
LinkHolderArray$other

Definition at line 103 of file LinkHolderArray.php.

References and().

◆ mergeForeign()

LinkHolderArray::mergeForeign ( $other,
$texts )

Merge a LinkHolderArray from another parser instance into this one.

The keys will not be preserved. Any text which went with the old LinkHolderArray and needs to work with the new one should be passed in the $texts array. The strings in this array will have their link holders converted for use in the destination link holder. The resulting array of strings will be returned.

Parameters
LinkHolderArray$other
array$textsArray of strings
Returns
array

Definition at line 127 of file LinkHolderArray.php.

References and().

◆ mergeForeignCallback()

LinkHolderArray::mergeForeignCallback ( $m)
protected
Parameters
array$m
Returns
string

Definition at line 161 of file LinkHolderArray.php.

References $tempIdOffset.

◆ replace()

LinkHolderArray::replace ( & $text)

Replace link placeholders with actual links, in the buffer.

Parameters
string&$text

Definition at line 271 of file LinkHolderArray.php.

References replaceInternal(), and replaceInterwiki().

◆ replaceInternal()

LinkHolderArray::replaceInternal ( & $text)
protected

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

Parameters
string&$text

Definition at line 281 of file LinkHolderArray.php.

References $attribs, $colours, $dbr, $link, $linkRenderer, $matches, $output, $query, $res, $s, and(), array(), DB_REPLICA, doVariants(), Linker\makeSelfLinkObj(), NS_SPECIAL, and wfGetDB().

Referenced by replace().

◆ replaceInterwiki()

LinkHolderArray::replaceInterwiki ( & $text)
protected

Replace interwiki links.

Parameters
string&$text@suppress SecurityCheck-XSS Gets confused with $this->interwikis['pdbk']

Definition at line 424 of file LinkHolderArray.php.

References $link, $linkRenderer, $matches, $output, and(), and array().

Referenced by replace().

◆ replaceText()

LinkHolderArray::replaceText ( $text)

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

Parameters
string$text
Returns
string

Definition at line 618 of file LinkHolderArray.php.

References and().

◆ replaceTextCallback()

LinkHolderArray::replaceTextCallback ( $matches)

Callback for replaceText()

Parameters
array$matches
Returns
string
Access:\n private

Definition at line 634 of file LinkHolderArray.php.

References $matches, $type, and(), and list.

Member Data Documentation

◆ $internals

LinkHolderArray::$internals = []

Definition at line 30 of file LinkHolderArray.php.

◆ $interwikis

LinkHolderArray::$interwikis = []

Definition at line 31 of file LinkHolderArray.php.

◆ $parent

Parser LinkHolderArray::$parent

Definition at line 37 of file LinkHolderArray.php.

Referenced by __construct().

◆ $size

LinkHolderArray::$size = 0

Definition at line 32 of file LinkHolderArray.php.

◆ $tempIdOffset

LinkHolderArray::$tempIdOffset
protected

Definition at line 38 of file LinkHolderArray.php.

Referenced by mergeForeignCallback().


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