MediaWiki  REL1_19
MagicWordArray Class Reference

Class for handling an array of magic words. More...

List of all members.

Public Member Functions

 __construct ($names=array())
 add ($name)
 Add a magic word by name.
 addArray ($names)
 Add a number of magic words by name.
 getBaseRegex ()
 Get the base regex.
 getHash ()
 Get a 2-d hashtable for this array.
 getRegex ()
 Get an unanchored regex that does not match parameters.
 getRegexStart ()
 Get a regex anchored to the start of the string that does not match parameters.
 getVariableRegex ()
 Get a regex for matching variables with parameters.
 getVariableStartToEndRegex ()
 Get an anchored regex for matching variables with parameters.
 matchAndRemove (&$text)
 Returns an associative array, ID => param value, for all items that match Removes the matched items from the input string (passed by reference)
 matchStartAndRemove (&$text)
 Return the ID of the magic word at the start of $text, and remove the prefix from $text.
 matchStartToEnd ($text)
 Match some text, without parameter capture Returns the magic word name, or false if there was no capture.
 matchVariableStartToEnd ($text)
 Match some text, with parameter capture Returns an array with the magic word name in the first element and the parameter in the second element.
 parseMatch ($m)
 Parse a match array from preg_match Returns array(magic word ID, parameter value) If there is no parameter value, that element will be false.

Public Attributes

 $baseRegex
 $hash
 $matches
 $names = array()
 $regex

Detailed Description

Class for handling an array of magic words.

Definition at line 625 of file MagicWord.php.


Constructor & Destructor Documentation

MagicWordArray::__construct ( names = array())

Definition at line 631 of file MagicWord.php.

References $names.


Member Function Documentation

MagicWordArray::add ( name)

Add a magic word by name.

Parameters:
$namestring

Definition at line 640 of file MagicWord.php.

Add a number of magic words by name.

Parameters:
$namesarray

Definition at line 650 of file MagicWord.php.

References $names.

Get the base regex.

Definition at line 679 of file MagicWord.php.

References MagicWord\get().

Referenced by getRegex(), getRegexStart(), and getVariableStartToEndRegex().

Here is the call graph for this function:

Here is the caller graph for this function:

Get a 2-d hashtable for this array.

Definition at line 658 of file MagicWord.php.

References $wgContLang, and MagicWord\get().

Referenced by matchStartToEnd().

Here is the call graph for this function:

Here is the caller graph for this function:

Get an unanchored regex that does not match parameters.

Definition at line 703 of file MagicWord.php.

References getBaseRegex().

Referenced by getVariableRegex(), and matchAndRemove().

Here is the call graph for this function:

Here is the caller graph for this function:

Get a regex anchored to the start of the string that does not match parameters.

Returns:
array

Definition at line 731 of file MagicWord.php.

References getBaseRegex().

Referenced by matchStartAndRemove().

Here is the call graph for this function:

Here is the caller graph for this function:

Get a regex for matching variables with parameters.

Returns:
string

Definition at line 722 of file MagicWord.php.

References getRegex().

Here is the call graph for this function:

Get an anchored regex for matching variables with parameters.

Returns:
array

Definition at line 748 of file MagicWord.php.

References getBaseRegex().

Referenced by matchVariableStartToEnd().

Here is the call graph for this function:

Here is the caller graph for this function:

Returns an associative array, ID => param value, for all items that match Removes the matched items from the input string (passed by reference)

Parameters:
$textstring
Returns:
array

Definition at line 841 of file MagicWord.php.

References $matches, $regex, getRegex(), and parseMatch().

Here is the call graph for this function:

Return the ID of the magic word at the start of $text, and remove the prefix from $text.

Return false if no match found and $text is not modified. Does not match parameters.

Parameters:
$textstring
Returns:
int|false

Definition at line 868 of file MagicWord.php.

References $regex, getRegexStart(), and parseMatch().

Here is the call graph for this function:

Match some text, without parameter capture Returns the magic word name, or false if there was no capture.

Parameters:
$textstring
Returns:
string|false

Definition at line 820 of file MagicWord.php.

References $hash, $wgContLang, and getHash().

Here is the call graph for this function:

Match some text, with parameter capture Returns an array with the magic word name in the first element and the parameter in the second element.

Both elements are false if there was no match.

Parameters:
$textstring
Returns:
array

Definition at line 799 of file MagicWord.php.

References $regex, getVariableStartToEndRegex(), and parseMatch().

Here is the call graph for this function:

Parse a match array from preg_match Returns array(magic word ID, parameter value) If there is no parameter value, that element will be false.

Parameters:
$marray
Returns:
array

Definition at line 769 of file MagicWord.php.

Referenced by matchAndRemove(), matchStartAndRemove(), and matchVariableStartToEnd().

Here is the caller graph for this function:


Member Data Documentation

MagicWordArray::$baseRegex

Definition at line 628 of file MagicWord.php.

MagicWordArray::$hash

Definition at line 627 of file MagicWord.php.

Referenced by matchStartToEnd().

MagicWordArray::$matches

Definition at line 629 of file MagicWord.php.

Referenced by matchAndRemove().

MagicWordArray::$names = array()

Definition at line 626 of file MagicWord.php.

Referenced by __construct(), and addArray().

MagicWordArray::$regex

Definition at line 628 of file MagicWord.php.

Referenced by matchAndRemove(), matchStartAndRemove(), and matchVariableStartToEnd().


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