const RECOVER_ORIG = 27; // = 1|2|8|16 no constant expression support in PHP yet
+ /** This constant exists when $indexOffset is supported in newChild() */
+ const SUPPORTS_INDEX_OFFSET = 1;
+
/**
* Create a child frame
*
* @param $args array
* @param $title Title
+ * @param $indexOffset A number subtracted from the index attributes of the arguments
*
* @return PPFrame
*/
- function newChild( $args = false, $title = false );
+ function newChild( $args = false, $title = false, $indexOffset = 0 );
/**
* Expand a document tree node
*
* @return PPTemplateFrame_DOM
*/
- function newChild( $args = false, $title = false ) {
+ function newChild( $args = false, $title = false, $indexOffset = 0 ) {
$namedArgs = array();
$numberedArgs = array();
if ( $title === false ) {
$args = $args->node;
}
foreach ( $args as $arg ) {
+ if ( $arg instanceof PPNode ) {
+ $arg = $arg->node;
+ }
if ( !$xpath ) {
$xpath = new DOMXPath( $arg->ownerDocument );
}
if ( $nameNodes->item( 0 )->hasAttributes() ) {
// Numbered parameter
$index = $nameNodes->item( 0 )->attributes->getNamedItem( 'index' )->textContent;
+ $index = $index - $indexOffset;
$numberedArgs[$index] = $value->item( 0 );
unset( $namedArgs[$index] );
} else {
}
return $this->args[$index];
}
+
+ function getArguments() {
+ return $this->args;
+ }
}
/**
*
* @return PPTemplateFrame_Hash
*/
- function newChild( $args = false, $title = false ) {
+ function newChild( $args = false, $title = false, $indexOffset = 0 ) {
$namedArgs = array();
$numberedArgs = array();
if ( $title === false ) {
$bits = $arg->splitArg();
if ( $bits['index'] !== '' ) {
// Numbered parameter
- $numberedArgs[$bits['index']] = $bits['value'];
- unset( $namedArgs[$bits['index']] );
+ $index = $bits['index'] - $indexOffset;
+ $numberedArgs[$index] = $bits['value'];
+ unset( $namedArgs[$index] );
} else {
// Named parameter
$name = trim( $this->expand( $bits['name'], PPFrame::STRIP_COMMENTS ) );
}
return $this->args[$index];
}
+
+ function getArguments() {
+ return $this->args;
+ }
}
/**