Public Member Functions | |
__construct ($names=array()) | |
add ($name) | |
Add a magic word by name. | |
addArray ($names) | |
Add a number of magic words by name. | |
getHash () | |
Get a 2-d hashtable for this array. | |
getBaseRegex () | |
Get the base regex. | |
getRegex () | |
Get an unanchored regex that does not match parameters. | |
getVariableRegex () | |
Get a regex for matching variables with parameters. | |
getRegexStart () | |
Get a regex anchored to the start of the string that does not match parameters. | |
getVariableStartToEndRegex () | |
Get an anchored regex for matching variables with parameters. | |
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. | |
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. | |
matchStartToEnd ($text) | |
Match some text, without parameter capture Returns the magic word name, or false if there was no capture. | |
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. | |
Public Attributes | |
$names = array() | |
$hash | |
$baseRegex | |
$regex | |
$matches |
Definition at line 502 of file MagicWord.php.
MagicWordArray::__construct | ( | $ | names = array() |
) |
MagicWordArray::add | ( | $ | name | ) |
Add a magic word by name.
Definition at line 515 of file MagicWord.php.
References $name, and $wgContLang.
MagicWordArray::addArray | ( | $ | names | ) |
Add a number of magic words by name.
Definition at line 524 of file MagicWord.php.
References $names.
MagicWordArray::getBaseRegex | ( | ) |
Get the base regex.
Definition at line 553 of file MagicWord.php.
References $i, $name, and MagicWord::get().
Referenced by getRegex(), getRegexStart(), and getVariableStartToEndRegex().
MagicWordArray::getHash | ( | ) |
Get a 2-d hashtable for this array.
Definition at line 532 of file MagicWord.php.
References $name, $wgContLang, and MagicWord::get().
Referenced by matchStartToEnd().
MagicWordArray::getRegex | ( | ) |
Get an unanchored regex that does not match parameters.
Definition at line 575 of file MagicWord.php.
References getBaseRegex().
Referenced by getVariableRegex(), and matchAndRemove().
MagicWordArray::getRegexStart | ( | ) |
Get a regex anchored to the start of the string that does not match parameters.
Definition at line 599 of file MagicWord.php.
References getBaseRegex().
Referenced by matchStartAndRemove().
MagicWordArray::getVariableRegex | ( | ) |
Get a regex for matching variables with parameters.
Definition at line 592 of file MagicWord.php.
References getRegex().
MagicWordArray::getVariableStartToEndRegex | ( | ) |
Get an anchored regex for matching variables with parameters.
Definition at line 614 of file MagicWord.php.
References getBaseRegex().
Referenced by matchVariableStartToEnd().
MagicWordArray::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).
Definition at line 693 of file MagicWord.php.
References $matches, $name, $regex, getRegex(), and parseMatch().
MagicWordArray::matchStartAndRemove | ( | &$ | text | ) |
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.
Definition at line 716 of file MagicWord.php.
References $regex, getRegexStart(), and parseMatch().
MagicWordArray::matchStartToEnd | ( | $ | text | ) |
Match some text, without parameter capture Returns the magic word name, or false if there was no capture.
Definition at line 676 of file MagicWord.php.
References $hash, $wgContLang, and getHash().
MagicWordArray::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.
Both elements are false if there was no match.
Definition at line 658 of file MagicWord.php.
References $regex, $wgContLang, getVariableStartToEndRegex(), and parseMatch().
MagicWordArray::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.
Definition at line 631 of file MagicWord.php.
Referenced by matchAndRemove(), matchStartAndRemove(), and matchVariableStartToEnd().
MagicWordArray::$baseRegex |
Definition at line 505 of file MagicWord.php.
MagicWordArray::$hash |
MagicWordArray::$matches |
MagicWordArray::$names = array() |
MagicWordArray::$regex |
Definition at line 505 of file MagicWord.php.
Referenced by matchAndRemove(), matchStartAndRemove(), and matchVariableStartToEnd().