Static Public Member Functions | |
static | hungryDelimiterReplace ($startDelim, $endDelim, $replace, $subject) |
Perform an operation equivalent to. | |
static | delimiterReplaceCallback ($startDelim, $endDelim, $callback, $subject, $flags= '') |
Perform an operation equivalent to. | |
static | delimiterReplace ($startDelim, $endDelim, $replace, $subject, $flags= '') |
static | explodeMarkup ($separator, $text) |
More or less "markup-safe" explode() Ignores any instances of the separator inside <. | |
static | escapeRegexReplacement ($string) |
Escape a string to make it suitable for inclusion in a preg_replace() replacement parameter. | |
static | explode ($separator, $subject) |
Workalike for explode() with limited memory usage. |
Definition at line 5 of file StringUtils.php.
static StringUtils::delimiterReplace | ( | $ | startDelim, | |
$ | endDelim, | |||
$ | replace, | |||
$ | subject, | |||
$ | flags = '' | |||
) | [static] |
Definition at line 126 of file StringUtils.php.
References $flags, and delimiterReplaceCallback().
Referenced by Parser::guessSectionNameFromWikiText(), Parser::renderPreTag(), and Parser::stripSectionName().
static StringUtils::delimiterReplaceCallback | ( | $ | startDelim, | |
$ | endDelim, | |||
$ | callback, | |||
$ | subject, | |||
$ | flags = '' | |||
) | [static] |
Perform an operation equivalent to.
preg_replace_callback( "!$startDelim(.*)$endDelim!s$flags", $callback, $subject )
This implementation is slower than hungryDelimiterReplace but uses far less memory. The delimiters are literal strings, not regular expressions.
string | $flags Regular expression flags |
Definition at line 46 of file StringUtils.php.
Referenced by delimiterReplace(), LinkMarkerReplacer::expand(), and explodeMarkup().
static StringUtils::escapeRegexReplacement | ( | $ | string | ) | [static] |
Escape a string to make it suitable for inclusion in a preg_replace() replacement parameter.
string | $string |
Definition at line 165 of file StringUtils.php.
Referenced by Linker::formatLinksInCommentCallback(), MagicWord::replace(), and wfRegexReplacement().
static StringUtils::explode | ( | $ | separator, | |
$ | subject | |||
) | [static] |
Workalike for explode() with limited memory usage.
Returns an Iterator
Definition at line 175 of file StringUtils.php.
Referenced by LanguageConverter::convert(), Parser::doAllQuotes(), Parser::doBlockLevels(), explodeMarkup(), hungryDelimiterReplace(), Parser::makeImage(), Parser::renderImageGallery(), and Parser::replaceInternalLinks2().
static StringUtils::explodeMarkup | ( | $ | separator, | |
$ | text | |||
) | [static] |
More or less "markup-safe" explode() Ignores any instances of the separator inside <.
..>
string | $separator | |
string | $text |
Definition at line 139 of file StringUtils.php.
References $i, $text, delimiterReplaceCallback(), and explode().
Referenced by wfExplodeMarkup().
static StringUtils::hungryDelimiterReplace | ( | $ | startDelim, | |
$ | endDelim, | |||
$ | replace, | |||
$ | subject | |||
) | [static] |
Perform an operation equivalent to.
preg_replace( "!$startDelim(.*?)$endDelim!", $replace, $subject );
except that it's worst-case O(N) instead of O(N^2)
Compared to delimiterReplace(), this implementation is fast but memory- hungry and inflexible. The memory requirements are such that I don't recommend using it on anything but guaranteed small chunks of text.
Definition at line 17 of file StringUtils.php.