BlueSpice MediaWiki master
 All Classes Namespaces Files Functions Variables Groups Pages
LinkHolderArray Class Reference

Public Member Functions

 __construct ($parent)
 
 __destruct ()
 
 __sleep ()
 
 __wakeup ()
 
 merge ($other)
 
 mergeForeign ($other, $texts)
 
 getSubArray ($text)
 
 isBig ()
 
 clear ()
 
 makeHolder ($nt, $text= '', $query=[], $trail= '', $prefix= '')
 
 replace (&$text)
 
 replaceText ($text)
 
 replaceTextCallback ($matches)
 

Public Attributes

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

Protected Member Functions

 mergeForeignCallback ($m)
 
 replaceInterwiki (&$text)
 

Protected Attributes

 $tempIdOffset
 

Constructor & Destructor Documentation

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

Reduce memory usage to reduce the impact of circular references

Member Function Documentation

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
LinkHolderArray::__wakeup ( )

Recreate the Title objects

LinkHolderArray::clear ( )

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

LinkHolderArray::getSubArray (   $text)

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

Parameters
string$text
Returns
LinkHolderArray
LinkHolderArray::isBig ( )

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

Returns
bool
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
LinkHolderArray::merge (   $other)

Merge another LinkHolderArray into this one

Parameters
LinkHolderArray$other
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
LinkHolderArray::mergeForeignCallback (   $m)
protected
Parameters
array$m
Returns
string
LinkHolderArray::replace ( $text)

Replace link placeholders with actual links, in the buffer

Parameters
string&$text
LinkHolderArray::replaceInterwiki ( $text)
protected

Replace interwiki links

Parameters
string&$text
LinkHolderArray::replaceText (   $text)

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

Parameters
string$text
Returns
string
LinkHolderArray::replaceTextCallback (   $matches)

Callback for replaceText()

Parameters
array$matches
Returns
string

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