MediaWiki
REL1_19
|
Class for handling an array of magic words. More...
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 |
Class for handling an array of magic words.
Definition at line 625 of file MagicWord.php.
MagicWordArray::__construct | ( | $ | names = array() | ) |
Definition at line 631 of file MagicWord.php.
References $names.
MagicWordArray::add | ( | $ | name | ) |
MagicWordArray::addArray | ( | $ | names | ) |
Add a number of magic words by name.
$names | array |
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().
Get a 2-d hashtable for this array.
Definition at line 658 of file MagicWord.php.
References $wgContLang, and MagicWord\get().
Referenced by matchStartToEnd().
Get an unanchored regex that does not match parameters.
Definition at line 703 of file MagicWord.php.
References getBaseRegex().
Referenced by getVariableRegex(), and matchAndRemove().
Get a regex anchored to the start of the string that does not match parameters.
Definition at line 731 of file MagicWord.php.
References getBaseRegex().
Referenced by matchStartAndRemove().
Get a regex for matching variables with parameters.
Definition at line 722 of file MagicWord.php.
References getRegex().
Get an anchored regex for matching variables with parameters.
Definition at line 748 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)
$text | string |
Definition at line 841 of file MagicWord.php.
References $matches, $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.
$text | string |
Definition at line 868 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.
$text | string |
Definition at line 820 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.
$text | string |
Definition at line 799 of file MagicWord.php.
References $regex, 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.
$m | array |
Definition at line 769 of file MagicWord.php.
Referenced by matchAndRemove(), matchStartAndRemove(), and matchVariableStartToEnd().
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().