48 $this->regex =
"/{$this->prefix}([^\x7f]+)" . Parser::MARKER_SUFFIX .
'/';
49 $this->circularRefGuard =
array();
76 if ( !preg_match( $this->regex, $marker, $m ) ) {
122 $this->tempType =
$type;
123 $text = preg_replace_callback( $this->regex,
array( $this,
'unstripCallback' ), $text );
124 $this->tempType = $oldType;
135 if ( isset( $this->
data[$this->tempType][$marker] ) ) {
136 if ( isset( $this->circularRefGuard[$marker] ) ) {
137 return '<span class="error">'
138 .
wfMessage(
'parser-unstrip-loop-warning' )->inContentLanguage()->text()
141 if ( $this->recursionLevel >= self::UNSTRIP_RECURSION_LIMIT ) {
142 return '<span class="error">' .
143 wfMessage(
'parser-unstrip-recursion-limit' )
144 ->numParams( self::UNSTRIP_RECURSION_LIMIT )->inContentLanguage()->text() .
147 $this->circularRefGuard[$marker] =
true;
148 $this->recursionLevel++;
150 $this->recursionLevel--;
151 unset( $this->circularRefGuard[$marker] );
170 $startPos = strpos( $text, $this->prefix, $pos );
171 $endPos = strpos( $text, Parser::MARKER_SUFFIX, $pos );
172 if ( $startPos ===
false || $endPos ===
false ) {
176 $endPos += strlen( Parser::MARKER_SUFFIX );
177 $marker = substr( $text, $startPos, $endPos - $startPos );
178 if ( !preg_match( $this->regex, $marker, $m ) ) {
183 if ( isset( $this->
data[
'nowiki'][$key] ) ) {
184 $subState->data[
'nowiki'][$key] = $this->
data[
'nowiki'][$key];
185 } elseif ( isset( $this->
data[
'general'][$key] ) ) {
186 $subState->data[
'general'][$key] = $this->
data[
'general'][$key];
202 function merge( $otherState, $texts ) {
203 $mergePrefix = Parser::getRandomString();
205 foreach ( $otherState->data
as $type => $items ) {
206 foreach ( $items
as $key =>
$value ) {
211 $this->tempMergePrefix = $mergePrefix;
212 $texts = preg_replace_callback( $otherState->regex,
array( $this,
'mergeCallback' ), $texts );
213 $this->tempMergePrefix =
null;
223 return "{$this->prefix}{$this->tempMergePrefix}-$key" . Parser::MARKER_SUFFIX;
233 return preg_replace( $this->regex,
'', $text );