$dom = $this->preprocessToDom( $text );
$flags = $argsOnly ? PPFrame::NO_TEMPLATES : 0;
- $text = $frame->expand( $dom, 0, $flags );
+ $text = $frame->expand( $dom, $flags );
wfProfileOut( $fname );
return $text;
# Just replace the arguments, not any double-brace items
# This is used for rendered interwiki transclusion
if ( $isDOM ) {
- $text = $newFrame->expand( $text, 0, PPFrame::NO_TEMPLATES );
+ $text = $newFrame->expand( $text, PPFrame::NO_TEMPLATES );
} else {
$text = $this->replaceVariables( $text, $newFrame, true );
}
$text = $frame->expand( $text );
}
} elseif ( $isDOM ) {
- $text = $frame->expand( $text, 0, PPFrame::NO_TEMPLATES | PPFrame::NO_ARGS );
+ $text = $frame->expand( $text, PPFrame::NO_TEMPLATES | PPFrame::NO_ARGS );
}
# Prune lower levels off the recursion check path
$curIndex++;
}
if ( $mode == 'replace' ) {
- $outText .= $frame->expand( $node, 0, PPFrame::RECOVER_ORIG );
+ $outText .= $frame->expand( $node, PPFrame::RECOVER_ORIG );
}
$node = $node->nextSibling;
}
}
}
if ( $mode == 'get' ) {
- $outText .= $frame->expand( $node, 0, PPFrame::RECOVER_ORIG );
+ $outText .= $frame->expand( $node, PPFrame::RECOVER_ORIG );
}
$node = $node->nextSibling;
} while ( $node );
// stripped by the editor, so we need both newlines to restore the paragraph gap
$outText .= $newText . "\n\n";
while ( $node ) {
- $outText .= $frame->expand( $node, 0, PPFrame::RECOVER_ORIG );
+ $outText .= $frame->expand( $node, PPFrame::RECOVER_ORIG );
$node = $node->nextSibling;
}
}
* using the current context
* @param $root the node
*/
- function expand( $root, $shallowFlags = 0, $deepFlags = 0 ) {
+ function expand( $root, $flags = 0 ) {
if ( is_string( $root ) ) {
return $root;
}
{
return $this->parser->insertStripItem( '<!-- node-count limit exceeded -->' );
}
- $flags = $shallowFlags | $deepFlags;
if ( is_array( $root ) ) {
$s = '';
foreach ( $root as $node ) {
- $s .= $this->expand( $node, 0, $deepFlags );
+ $s .= $this->expand( $node, $flags );
}
} elseif ( $root instanceof DOMNodeList ) {
$s = '';
foreach ( $root as $node ) {
- $s .= $this->expand( $node, 0, $deepFlags );
+ $s .= $this->expand( $node, $flags );
}
} elseif ( $root instanceof DOMNode ) {
if ( $root->nodeType == XML_TEXT_NODE ) {
$title = $titles->item( 0 );
$parts = $xpath->query( 'part', $root );
if ( $flags & self::NO_TEMPLATES ) {
- $s = '{{' . $this->implodeWithFlags( '|', 0, $deepFlags, $title, $parts ) . '}}';
+ $s = '{{' . $this->implodeWithFlags( '|', $flags, $title, $parts ) . '}}';
} else {
$lineStart = $root->getAttribute( 'lineStart' );
$params = array(
$title = $titles->item( 0 );
$parts = $xpath->query( 'part', $root );
if ( $flags & self::NO_ARGS || $this->parser->ot['msg'] ) {
- $s = '{{{' . $this->implode( '|', 0, $deepFlags, $title, $parts ) . '}}}';
+ $s = '{{{' . $this->implode( '|', $flags, $title, $parts ) . '}}}';
} else {
$params = array( 'title' => $title, 'parts' => $parts, 'text' => 'FIXME' );
$s = $this->parser->argSubstitution( $params, $this );
$s = $this->parser->extensionSubstitution( $params, $this );
} elseif ( $root->nodeName == 'h' ) {
# Heading
- $s = $this->expand( $root->childNodes, 0, $deepFlags );
+ $s = $this->expand( $root->childNodes, $flags );
if ( $this->parser->ot['html'] ) {
# Insert heading index marker
if ( $node->nodeType == XML_TEXT_NODE ) {
$s .= $node->nodeValue;
} elseif ( $node->nodeType == XML_ELEMENT_NODE ) {
- $s .= $this->expand( $node, 0, $deepFlags );
+ $s .= $this->expand( $node, $flags );
}
}
}
return $s;
}
- function implodeWithFlags( $sep, $shallowFlags, $deepFlags /*, ... */ ) {
- $args = array_slice( func_get_args(), 3 );
+ function implodeWithFlags( $sep, $flags /*, ... */ ) {
+ $args = array_slice( func_get_args(), 2 );
$first = true;
$s = '';
} else {
$s .= $sep;
}
- $s .= $this->expand( $node, $shallowFlags, $deepFlags );
+ $s .= $this->expand( $node, $flags );
}
}
return $s;
function implode( $sep /*, ... */ ) {
$args = func_get_args();
- $args = array_merge( array_slice( $args, 0, 1 ), array( 0, 0 ), array_slice( $args, 1 ) );
+ $args = array_merge( array_slice( $args, 0, 1 ), array( 0 ), array_slice( $args, 1 ) );
return call_user_func_array( array( $this, 'implodeWithFlags' ), $args );
}