46 wfDeprecated( __METHOD__ .
' with called with $prefix argument' .
47 ' (call with no arguments instead)',
'1.26' );
53 $this->regex =
'/' . Parser::MARKER_PREFIX .
"([^\x7f<>&'\"]+)" . Parser::MARKER_SUFFIX .
'/';
54 $this->circularRefGuard = [];
81 if ( !preg_match( $this->regex, $marker, $m ) ) {
126 $this->tempType =
$type;
127 $text = preg_replace_callback( $this->regex, [ $this,
'unstripCallback' ], $text );
128 $this->tempType = $oldType;
138 if ( isset( $this->
data[$this->tempType][$marker] ) ) {
139 if ( isset( $this->circularRefGuard[$marker] ) ) {
140 return '<span class="error">'
141 .
wfMessage(
'parser-unstrip-loop-warning' )->inContentLanguage()->text()
144 if ( $this->recursionLevel >= self::UNSTRIP_RECURSION_LIMIT ) {
145 return '<span class="error">' .
146 wfMessage(
'parser-unstrip-recursion-limit' )
147 ->numParams( self::UNSTRIP_RECURSION_LIMIT )->inContentLanguage()->text() .
150 $this->circularRefGuard[$marker] =
true;
151 $this->recursionLevel++;
153 if (
$value instanceof Closure ) {
157 $this->recursionLevel--;
158 unset( $this->circularRefGuard[$marker] );
177 $startPos = strpos( $text, Parser::MARKER_PREFIX, $pos );
178 $endPos = strpos( $text, Parser::MARKER_SUFFIX, $pos );
179 if ( $startPos ===
false || $endPos ===
false ) {
183 $endPos += strlen( Parser::MARKER_SUFFIX );
184 $marker = substr( $text, $startPos, $endPos - $startPos );
185 if ( !preg_match( $this->regex, $marker, $m ) ) {
190 if ( isset( $this->
data[
'nowiki'][$key] ) ) {
191 $subState->data[
'nowiki'][$key] = $this->
data[
'nowiki'][$key];
192 } elseif ( isset( $this->
data[
'general'][$key] ) ) {
193 $subState->data[
'general'][$key] = $this->
data[
'general'][$key];
209 public function merge( $otherState, $texts ) {
212 foreach ( $otherState->data
as $type => $items ) {
213 foreach ( $items
as $key =>
$value ) {
218 $this->tempMergePrefix = $mergePrefix;
219 $texts = preg_replace_callback( $otherState->regex, [ $this,
'mergeCallback' ], $texts );
220 $this->tempMergePrefix =
null;
230 return Parser::MARKER_PREFIX . $this->tempMergePrefix .
'-' . $key . Parser::MARKER_SUFFIX;
240 return preg_replace( $this->regex,
'', $text );