- static function delimiterReplaceCallback( $startDelim, $endDelim, $callback, $subject, $flags = '' ) {
+ static function delimiterReplaceCallback( $startDelim, $endDelim, $callback,
+ $subject, $flags = ''
+ ) {
- preg_match( "!($encStart)|($encEnd)!S$flags", $subject, $m, PREG_OFFSET_CAPTURE, $inputPos ) )
- {
+ preg_match( "!($encStart)|($encEnd)!S$flags", $subject, $m, PREG_OFFSET_CAPTURE, $inputPos )
+ ) {
- $strcmp( $endDelim, substr( $subject, $tokenOffset, $endLength ) ) == 0 )
- {
+ $strcmp( $endDelim, substr( $subject, $tokenOffset, $endLength ) ) == 0
+ ) {
$output .= call_user_func( $callback, array(
substr( $subject, $outputPos, $tokenOffset + $tokenLength - $outputPos ),
substr( $subject, $contentPos, $tokenOffset - $contentPos )
$output .= call_user_func( $callback, array(
substr( $subject, $outputPos, $tokenOffset + $tokenLength - $outputPos ),
substr( $subject, $contentPos, $tokenOffset - $contentPos )
if ( $outputPos < strlen( $subject ) ) {
$output .= substr( $subject, $outputPos );
}
if ( $outputPos < strlen( $subject ) ) {
$output .= substr( $subject, $outputPos );
}
*/
static function delimiterReplace( $startDelim, $endDelim, $replace, $subject, $flags = '' ) {
$replacer = new RegexlikeReplacer( $replace );
*/
static function delimiterReplace( $startDelim, $endDelim, $replace, $subject, $flags = '' ) {
$replacer = new RegexlikeReplacer( $replace );
return self::delimiterReplaceCallback( $startDelim, $endDelim,
$replacer->cb(), $subject, $flags );
}
return self::delimiterReplaceCallback( $startDelim, $endDelim,
$replacer->cb(), $subject, $flags );
}
static function escapeRegexReplacement( $string ) {
$string = str_replace( '\\', '\\\\', $string );
$string = str_replace( '$', '\\$', $string );
static function escapeRegexReplacement( $string ) {
$string = str_replace( '\\', '\\\\', $string );
$string = str_replace( '$', '\\$', $string );
* Class to replace regex matches with a string similar to that used in preg_replace()
*/
class RegexlikeReplacer extends Replacer {
* Class to replace regex matches with a string similar to that used in preg_replace()
*/
class RegexlikeReplacer extends Replacer {
}
/**
* Class to perform secondary replacement within each replacement string
*/
class DoubleReplacer extends Replacer {
}
/**
* Class to perform secondary replacement within each replacement string
*/
class DoubleReplacer extends Replacer {
* Class to perform replacement based on a simple hashtable lookup
*/
class HashtableReplacer extends Replacer {
* Class to perform replacement based on a simple hashtable lookup
*/
class HashtableReplacer extends Replacer {
$result = strtr( $subject, $this->data );
wfProfileOut( __METHOD__ . '-strtr' );
}
$result = strtr( $subject, $this->data );
wfProfileOut( __METHOD__ . '-strtr' );
}