/**
* @param array $values
* @return PPNode_DOM
+ * @throws MWException
*/
public function newPartNodeArray( $values ) {
//NOTE: DOM manipulation is slower than building & parsing XML! (or so Tim sais)
* @return PPNode_DOM
*/
public function preprocessToObj( $text, $flags = 0 ) {
- wfProfileIn( __METHOD__ );
global $wgMemc, $wgPreprocessorCacheThreshold;
$xml = false;
if ( $cacheable ) {
wfProfileOut( __METHOD__ . '-cacheable' );
}
- wfProfileOut( __METHOD__ );
throw new MWException( __METHOD__ . ': generated node count limit exceeded' );
}
wfProfileOut( __METHOD__ . '-cacheable' );
}
- wfProfileOut( __METHOD__ );
if ( !$result ) {
throw new MWException( __METHOD__ . ' generated invalid XML' );
* @return string
*/
public function preprocessToXml( $text, $flags = 0 ) {
- wfProfileIn( __METHOD__ );
$rules = array(
'{' => array(
'end' => '}',
$stack->rootAccum .= '</root>';
$xml = $stack->rootAccum;
- wfProfileOut( __METHOD__ );
return $xml;
}
if ( $arg instanceof PPNode ) {
$arg = $arg->node;
}
- if ( !$xpath ) {
+ if ( !$xpath || $xpath->document !== $arg->ownerDocument ) {
$xpath = new DOMXPath( $arg->ownerDocument );
}
// Numbered parameter
$index = $nameNodes->item( 0 )->attributes->getNamedItem( 'index' )->textContent;
$index = $index - $indexOffset;
+ if ( isset( $namedArgs[$index] ) || isset( $numberedArgs[$index] ) ) {
+ $this->parser->addTrackingCategory( 'duplicate-args-category' );
+ }
$numberedArgs[$index] = $value->item( 0 );
unset( $namedArgs[$index] );
} else {
// Named parameter
$name = trim( $this->expand( $nameNodes->item( 0 ), PPFrame::STRIP_COMMENTS ) );
+ if ( isset( $namedArgs[$name] ) || isset( $numberedArgs[$name] ) ) {
+ $this->parser->addTrackingCategory( 'duplicate-args-category' );
+ }
$namedArgs[$name] = $value->item( 0 );
unset( $numberedArgs[$name] );
}
);
return '<span class="error">Expansion depth limit exceeded</span>';
}
- wfProfileIn( __METHOD__ );
++$expansionDepth;
if ( $expansionDepth > $this->parser->mHighestExpansionDepth ) {
$this->parser->mHighestExpansionDepth = $expansionDepth;
$newIterator = $contextNode->childNodes;
}
} else {
- wfProfileOut( __METHOD__ );
throw new MWException( __METHOD__ . ': Invalid parameter type' );
}
}
}
--$expansionDepth;
- wfProfileOut( __METHOD__ );
return $outStack[0];
}
/**
* @param string $sep
* @param int $flags
+ * @param string|PPNode_DOM|DOMDocument $args,...
* @return string
*/
public function implodeWithFlags( $sep, $flags /*, ... */ ) {
* This previously called implodeWithFlags but has now been inlined to reduce stack depth
*
* @param string $sep
+ * @param string|PPNode_DOM|DOMDocument $args,...
* @return string
*/
public function implode( $sep /*, ... */ ) {
* with implode()
*
* @param string $sep
+ * @param string|PPNode_DOM|DOMDocument $args,...
* @return array
*/
public function virtualImplode( $sep /*, ... */ ) {
* @param string $start
* @param string $sep
* @param string $end
+ * @param string|PPNode_DOM|DOMDocument $args,...
* @return array
*/
public function virtualBracketedImplode( $start, $sep, $end /*, ... */ ) {