Add 3 new functions to the PPTemplateFrames to allow extensions to efficiently extrac...
authorDaniel Friesen <dantman@users.mediawiki.org>
Sat, 9 Aug 2008 06:08:54 +0000 (06:08 +0000)
committerDaniel Friesen <dantman@users.mediawiki.org>
Sat, 9 Aug 2008 06:08:54 +0000 (06:08 +0000)
CREDITS
includes/parser/Preprocessor_DOM.php
includes/parser/Preprocessor_Hash.php

diff --git a/CREDITS b/CREDITS
index 5527e9f..2ecc30f 100644 (file)
--- a/CREDITS
+++ b/CREDITS
@@ -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
index 34d5896..a4a2674 100644 (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;
index b577524..867878d 100644 (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;