MediaWiki  REL1_24
MagicWordArray Class Reference

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

Collaboration diagram for MagicWordArray:

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

array $names = array()
 *

Private Attributes

 $baseRegex
array $hash
 *
 $matches
 $regex

Detailed Description

Class for handling an array of magic words.

Definition at line 703 of file MagicWord.php.


Constructor & Destructor Documentation

Parameters:
array$names

Definition at line 718 of file MagicWord.php.


Member Function Documentation

MagicWordArray::add ( name)

Add a magic word by name.

Parameters:
string$name

Definition at line 727 of file MagicWord.php.

References $names.

Add a number of magic words by name.

Parameters:
array$names

Definition at line 737 of file MagicWord.php.

Get the base regex.

Returns:
array

Definition at line 768 of file MagicWord.php.

Get a 2-d hashtable for this array.

Returns:
array

Definition at line 746 of file MagicWord.php.

Since:
1.20
Returns:
array

Definition at line 854 of file MagicWord.php.

Get an unanchored regex that does not match parameters.

Returns:
array

Definition at line 793 of file MagicWord.php.

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

Returns:
array

Definition at line 821 of file MagicWord.php.

Get a regex for matching variables with parameters.

Returns:
string

Definition at line 812 of file MagicWord.php.

Get an anchored regex for matching variables with parameters.

Returns:
array

Definition at line 838 of file MagicWord.php.

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

Parameters:
string$text
Returns:
array

Definition at line 940 of file MagicWord.php.

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:
string$text
Returns:
int|bool False on failure

Definition at line 967 of file MagicWord.php.

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

Parameters:
string$text
Returns:
string|bool False on failure

Definition at line 919 of file MagicWord.php.

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:
string$text
Returns:
array

Definition at line 898 of file MagicWord.php.

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:
array$m
Exceptions:
MWException
Returns:
array

Definition at line 868 of file MagicWord.php.


Member Data Documentation

MagicWordArray::$baseRegex [private]

Definition at line 708 of file MagicWord.php.

array MagicWordArray::$hash [private]

*

Definition at line 706 of file MagicWord.php.

MagicWordArray::$matches [private]
Todo:
Unused?

Definition at line 713 of file MagicWord.php.

array MagicWordArray::$names = array()

*

Definition at line 704 of file MagicWord.php.

Referenced by add().

MagicWordArray::$regex [private]

Definition at line 710 of file MagicWord.php.


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