[ Index ] |
PHP Cross Reference of MediaWiki-1.24.0 |
[Source view] [Print] [Project Stats]
File for magic words. See docs/magicword.txt.
File Size: | 998 lines (22 kb) |
Included or required: | 0 times |
Referenced: | 2 times |
Includes or requires: | 0 files |
MagicWord:: (33 methods):
__construct()
get()
getVariableIDs()
getSubstIDs()
getCacheTTL()
getDoubleUnderscoreArray()
clearCache()
load()
initRegex()
compareStringLength()
getRegex()
getRegexCase()
getRegexStart()
getRegexStartToEnd()
getBaseRegex()
match()
matchStart()
matchStartToEnd()
matchVariableStartToEnd()
matchAndRemove()
matchStartAndRemove()
pregRemoveAndRecord()
replace()
substituteCallback()
getVariableRegex()
getVariableStartToEndRegex()
getSynonym()
getSynonyms()
getWasModified()
replaceMultiple()
addToArray()
isCaseSensitive()
getId()
MagicWordArray:: (15 methods):
__construct()
add()
addArray()
getHash()
getBaseRegex()
getRegex()
getVariableRegex()
getRegexStart()
getVariableStartToEndRegex()
getNames()
parseMatch()
matchVariableStartToEnd()
matchStartToEnd()
matchAndRemove()
matchStartAndRemove()
__construct( $id = 0, $syn = array() X-Ref |
No description |
get( $id ) X-Ref |
Factory: creates an object representing an ID param: int $id return: MagicWord |
getVariableIDs() X-Ref |
Get an array of parser variable IDs return: array |
getSubstIDs() X-Ref |
Get an array of parser substitution modifier IDs return: array |
getCacheTTL( $id ) X-Ref |
Allow external reads of TTL array param: int $id return: int |
getDoubleUnderscoreArray() X-Ref |
Get a MagicWordArray of double-underscore entities return: MagicWordArray |
clearCache() X-Ref |
Clear the self::$mObjects variable For use in parser tests |
load( $id ) X-Ref |
Initialises this object with an ID param: int $id |
initRegex() X-Ref |
Preliminary initialisation |
compareStringLength( $s1, $s2 ) X-Ref |
A comparison function that returns -1, 0 or 1 depending on whether the first string is longer, the same length or shorter than the second string. param: string $s1 param: string $s2 return: int |
getRegex() X-Ref |
Gets a regex representing matching the word return: string |
getRegexCase() X-Ref |
Gets the regexp case modifier to use, i.e. i or nothing, to be used if one is using MagicWord::getBaseRegex(), otherwise it'll be included in the complete expression return: string |
getRegexStart() X-Ref |
Gets a regex matching the word, if it is at the string start return: string |
getRegexStartToEnd() X-Ref |
Gets a regex matching the word from start to end of a string return: string |
getBaseRegex() X-Ref |
regex without the slashes and what not return: string |
match( $text ) X-Ref |
Returns true if the text contains the word param: string $text return: bool |
matchStart( $text ) X-Ref |
Returns true if the text starts with the word param: string $text return: bool |
matchStartToEnd( $text ) X-Ref |
Returns true if the text matched the word param: string $text return: bool |
matchVariableStartToEnd( $text ) X-Ref |
Returns NULL if there's no match, the value of $1 otherwise The return code is the matched string, if there's no variable part in the regex and the matched variable part ($1) if there is one. param: string $text return: string |
matchAndRemove( &$text ) X-Ref |
Returns true if the text matches the word, and alters the input string, removing all instances of the word param: string $text return: bool |
matchStartAndRemove( &$text ) X-Ref |
param: string $text return: bool |
pregRemoveAndRecord() X-Ref |
Used in matchAndRemove() return: string |
replace( $replacement, $subject, $limit = -1 ) X-Ref |
Replaces the word with something else param: string $replacement param: string $subject param: int $limit return: string |
substituteCallback( $text, $callback ) X-Ref |
Variable handling: {{SUBST:xxx}} style words Calls back a function to determine what to replace xxx with Input word must contain $1 param: string $text param: callable $callback return: string |
getVariableRegex() X-Ref |
Matches the word, where $1 is a wildcard return: string |
getVariableStartToEndRegex() X-Ref |
Matches the entire string, where $1 is a wildcard return: string |
getSynonym( $i ) X-Ref |
Accesses the synonym list directly param: int $i return: string |
getSynonyms() X-Ref |
return: array |
getWasModified() X-Ref |
Returns true if the last call to replace() or substituteCallback() returned a modified text, otherwise false. return: bool |
replaceMultiple( $magicarr, $subject, &$result ) X-Ref |
$magicarr is an associative array of (magic word ID => replacement) This method uses the php feature to do several replacements at the same time, thereby gaining some efficiency. The result is placed in the out variable $result. The return value is true if something was replaced. param: array $magicarr param: string $subject param: string $result return: bool |
addToArray( &$array, $value ) X-Ref |
Adds all the synonyms of this MagicWord to an array, to allow quick lookup in a list of magic words param: array $array param: string $value |
isCaseSensitive() X-Ref |
return: bool |
getId() X-Ref |
return: int |
Class: MagicWordArray - X-Ref
Class for handling an array of magic words__construct( $names = array() X-Ref |
param: array $names |
add( $name ) X-Ref |
Add a magic word by name param: string $name |
addArray( $names ) X-Ref |
Add a number of magic words by name param: array $names |
getHash() X-Ref |
Get a 2-d hashtable for this array return: array |
getBaseRegex() X-Ref |
Get the base regex return: array |
getRegex() X-Ref |
Get an unanchored regex that does not match parameters return: array |
getVariableRegex() X-Ref |
Get a regex for matching variables with parameters return: string |
getRegexStart() X-Ref |
Get a regex anchored to the start of the string that does not match parameters return: array |
getVariableStartToEndRegex() X-Ref |
Get an anchored regex for matching variables with parameters return: array |
getNames() X-Ref |
return: array |
parseMatch( $m ) X-Ref |
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. param: array $m return: array |
matchVariableStartToEnd( $text ) X-Ref |
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. param: string $text return: array |
matchStartToEnd( $text ) X-Ref |
Match some text, without parameter capture Returns the magic word name, or false if there was no capture param: string $text return: string|bool False on failure |
matchAndRemove( &$text ) X-Ref |
Returns an associative array, ID => param value, for all items that match Removes the matched items from the input string (passed by reference) param: string $text return: array |
matchStartAndRemove( &$text ) X-Ref |
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. param: string $text return: int|bool False on failure |
Generated: Fri Nov 28 14:03:12 2014 | Cross-referenced by PHPXref 0.7.1 |