Add 3 new functions to the PPTemplateFrames to allow extensions to efficiently extract the whole list of parameters (or only numbered or named) passed to the template they are nested inside of.

This commit is contained in:
Daniel Friesen 2008-08-09 06:08:54 +00:00
parent 05f398352c
commit 1cfcc40329
3 changed files with 53 additions and 0 deletions

View file

@ -8,6 +8,7 @@ following names for their contribution to the product.
* Brion Vibber
* Bryan Tong Minh
* Chad Horohoe
* Daniel Friesen
* Greg Sabino Mullane
* Hojjat
* Mohamed Magdy

View file

@ -1218,6 +1218,32 @@ class PPTemplateFrame_DOM extends PPFrame_DOM {
return !count( $this->numberedArgs ) && !count( $this->namedArgs );
}
function getArguments() {
$arguments = array();
foreach ( array_merge(
array_keys($this->numberedArgs),
array_keys($this->namedArgs)) as $key ) {
$arguments[$key] = $this->getArgument($key);
}
return $arguments;
}
function getNumberedArguments() {
$arguments = array();
foreach ( array_keys($this->numberedArgs) as $key ) {
$arguments[$key] = $this->getArgument($key);
}
return $arguments;
}
function getNamedArguments() {
$arguments = array();
foreach ( array_keys($this->namedArgs) as $key ) {
$arguments[$key] = $this->getArgument($key);
}
return $arguments;
}
function getNumberedArgument( $index ) {
if ( !isset( $this->numberedArgs[$index] ) ) {
return false;

View file

@ -1173,6 +1173,32 @@ class PPTemplateFrame_Hash extends PPFrame_Hash {
return !count( $this->numberedArgs ) && !count( $this->namedArgs );
}
function getArguments() {
$arguments = array();
foreach ( array_merge(
array_keys($this->numberedArgs),
array_keys($this->namedArgs)) as $key ) {
$arguments[$key] = $this->getArgument($key);
}
return $arguments;
}
function getNumberedArguments() {
$arguments = array();
foreach ( array_keys($this->numberedArgs) as $key ) {
$arguments[$key] = $this->getArgument($key);
}
return $arguments;
}
function getNamedArguments() {
$arguments = array();
foreach ( array_keys($this->namedArgs) as $key ) {
$arguments[$key] = $this->getArgument($key);
}
return $arguments;
}
function getNumberedArgument( $index ) {
if ( !isset( $this->numberedArgs[$index] ) ) {
return false;