MediaWiki  1.23.2
LinkHolderArray Class Reference

Public Member Functions

 __construct ( $parent)
 
 __destruct ()
 Reduce memory usage to reduce the impact of circular references. More...
 
 __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. More...
 
 __wakeup ()
 Recreate the Title objects. More...
 
 clear ()
 Clear all stored link holders. More...
 
 getSubArray ( $text)
 Get a subset of the current LinkHolderArray which is sufficient to interpret the given text. More...
 
 isBig ()
 Returns true if the memory requirements of this object are getting large. More...
 
 makeHolder ( $nt, $text='', $query=array(), $trail='', $prefix='')
 Make a link placeholder. More...
 
 merge ( $other)
 Merge another LinkHolderArray into this one. More...
 
 mergeForeign ( $other, $texts)
 Merge a LinkHolderArray from another parser instance into this one. More...
 
 replace (&$text)
 Replace link placeholders with actual links, in the buffer. More...
 
 replaceText ( $text)
 Replace link placeholders with plain text of links (not HTML-formatted). More...
 
 replaceTextCallback ( $matches)
 Callback for replaceText() More...
 

Public Attributes

 $internals = array()
 
 $interwikis = array()
 
 $parent
 
 $size = 0
 

Protected Member Functions

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

Protected Attributes

 $tempIdOffset
 

Detailed Description

Definition at line 27 of file LinkHolderArray.php.

Constructor & Destructor Documentation

◆ __construct()

LinkHolderArray::__construct (   $parent)

Definition at line 33 of file LinkHolderArray.php.

References $parent.

◆ __destruct()

LinkHolderArray::__destruct ( )

Reduce memory usage to reduce the impact of circular references.

Definition at line 40 of file LinkHolderArray.php.

References $name, $value, and as.

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 54 of file LinkHolderArray.php.

References array(), and as.

◆ __wakeup()

LinkHolderArray::__wakeup ( )

Recreate the Title objects.

Definition at line 74 of file LinkHolderArray.php.

References as, and Title\newFromText().

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

References array().

◆ doVariants()

LinkHolderArray::doVariants ( $colours)
protected

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

Definition at line 447 of file LinkHolderArray.php.

References $colours, $dbr, $output, $s, $title, $wgContLang, array(), as, DB_SLAVE, Linker\getLinkColour(), global, list, Title\makeTitle(), Title\makeTitleSafe(), NS_CATEGORY, NS_SPECIAL, LinkCache\singleton(), wfGetDB(), and wfRunHooks().

Referenced by replaceInternal().

◆ getSubArray()

LinkHolderArray::getSubArray (   $text)

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

Returns
LinkHolderArray

Definition at line 156 of file LinkHolderArray.php.

◆ isBig()

LinkHolderArray::isBig ( )

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

Returns
bool

Definition at line 190 of file LinkHolderArray.php.

References global.

◆ makeHolder()

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

Definition at line 218 of file LinkHolderArray.php.

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

◆ merge()

LinkHolderArray::merge (   $other)

Merge another LinkHolderArray into this one.

Parameters
$otherLinkHolderArray

Definition at line 93 of file LinkHolderArray.php.

References as.

◆ 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
$otherLinkHolderArray
array$textsof strings
Returns
Array

Definition at line 117 of file LinkHolderArray.php.

References array(), and as.

◆ mergeForeignCallback()

LinkHolderArray::mergeForeignCallback (   $m)
protected

Definition at line 147 of file LinkHolderArray.php.

References $tempIdOffset.

◆ replace()

LinkHolderArray::replace ( $text)

Replace link placeholders with actual links, in the buffer.

Returns
array of link CSS classes, indexed by PDBK.

Definition at line 258 of file LinkHolderArray.php.

References $colours, replaceInternal(), replaceInterwiki(), wfProfileIn(), and wfProfileOut().

◆ replaceInternal()

◆ replaceInterwiki()

LinkHolderArray::replaceInterwiki ( $text)
protected

Replace interwiki links.

Definition at line 422 of file LinkHolderArray.php.

References $link, $output, array(), as, Linker\link(), wfProfileIn(), and wfProfileOut().

Referenced by replace().

◆ replaceText()

LinkHolderArray::replaceText (   $text)

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

Parameters
$textString
Returns
String

Definition at line 612 of file LinkHolderArray.php.

References array(), wfProfileIn(), and wfProfileOut().

◆ replaceTextCallback()

LinkHolderArray::replaceTextCallback (   $matches)

Callback for replaceText()

Parameters
$matchesArray
Returns
string
Access:\n private

Definition at line 631 of file LinkHolderArray.php.

References $matches, $type, and list.

Member Data Documentation

◆ $internals

LinkHolderArray::$internals = array()

Definition at line 28 of file LinkHolderArray.php.

◆ $interwikis

LinkHolderArray::$interwikis = array()

Definition at line 28 of file LinkHolderArray.php.

◆ $parent

LinkHolderArray::$parent

Definition at line 30 of file LinkHolderArray.php.

Referenced by __construct().

◆ $size

LinkHolderArray::$size = 0

Definition at line 29 of file LinkHolderArray.php.

◆ $tempIdOffset

LinkHolderArray::$tempIdOffset
protected

Definition at line 31 of file LinkHolderArray.php.

Referenced by mergeForeignCallback().


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