54 $this->regex =
'/' . Parser::MARKER_PREFIX .
"([^\x7f<>&'\"]+)" . Parser::MARKER_SUFFIX .
'/';
55 $this->circularRefGuard = [];
58 if ( isset( $options[
'depthLimit'] ) ) {
59 $this->depthLimit = $options[
'depthLimit'];
61 if ( isset( $options[
'sizeLimit'] ) ) {
62 $this->sizeLimit = $options[
'sizeLimit'];
72 $this->
addItem(
'nowiki', $marker, $value );
80 $this->
addItem(
'general', $marker, $value );
90 if ( !preg_match( $this->regex, $marker, $m ) ) {
94 $this->data[
$type][$m[1]] = $value;
130 if ( !count( $this->data[
$type] ) ) {
134 $callback =
function ( $m ) use (
$type ) {
136 if ( isset( $this->data[
$type][$marker] ) ) {
137 if ( isset( $this->circularRefGuard[$marker] ) ) {
138 return $this->
getWarning(
'parser-unstrip-loop-warning' );
141 if ( $this->depth > $this->highestDepth ) {
142 $this->highestDepth = $this->depth;
144 if ( $this->depth >= $this->depthLimit ) {
148 $value = $this->data[
$type][$marker];
149 if ( $value instanceof Closure ) {
153 $this->expandSize += strlen( $value );
154 if ( $this->expandSize > $this->sizeLimit ) {
158 $this->circularRefGuard[$marker] =
true;
162 unset( $this->circularRefGuard[$marker] );
170 $text = preg_replace_callback( $this->regex, $callback, $text );
182 if ( $this->parser ) {
183 $this->parser->limitationWarn(
$type, $max );
185 return $this->
getWarning(
"$type-warning", $max );
196 return '<span class="error">' .
198 ->numParams( $max )->inContentLanguage()->text() .
210 [
'limitreport-unstrip-depth',
216 [
'limitreport-unstrip-size',
232 return preg_replace( $this->regex,
'', $text );
wfMessage( $key,... $params)
This is the function for getting translated interface messages.
PHP Parser - Processes wiki markup (which uses a more user-friendly syntax, such as "[[link]]" for ma...
addNoWiki( $marker, $value)
Add a nowiki strip item.
getLimitReport()
Get an array of parameters to pass to ParserOutput::setLimitReportData()
unstripType( $type, $text)
addGeneral( $marker, $value)
getWarning( $message, $max='')
Get warning HTML.
killMarkers( $text)
Remove any strip markers found in the given text.
getLimitationWarning( $type, $max='')
Get warning HTML and register a limitation warning with the parser.
addItem( $type, $marker, $value)
__construct(Parser $parser=null, $options=[])
Stable to call.