r38981 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r38980‎ | r38981 | r38982 >
Date:06:08, 9 August 2008
Author:dantman
Status:old
Tags:
Comment:
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.
Modified paths:
  • /trunk/phase3/CREDITS (modified) (history)
  • /trunk/phase3/includes/parser/Preprocessor_DOM.php (modified) (history)
  • /trunk/phase3/includes/parser/Preprocessor_Hash.php (modified) (history)

Diff [purge]

Index: trunk/phase3/CREDITS
@@ -8,6 +8,7 @@
99 * Brion Vibber
1010 * Bryan Tong Minh
1111 * Chad Horohoe
 12+* Daniel Friesen
1213 * Greg Sabino Mullane
1314 * Hojjat
1415 * Mohamed Magdy
Index: trunk/phase3/includes/parser/Preprocessor_Hash.php
@@ -1173,6 +1173,32 @@
11741174 return !count( $this->numberedArgs ) && !count( $this->namedArgs );
11751175 }
11761176
 1177+ function getArguments() {
 1178+ $arguments = array();
 1179+ foreach ( array_merge(
 1180+ array_keys($this->numberedArgs),
 1181+ array_keys($this->namedArgs)) as $key ) {
 1182+ $arguments[$key] = $this->getArgument($key);
 1183+ }
 1184+ return $arguments;
 1185+ }
 1186+
 1187+ function getNumberedArguments() {
 1188+ $arguments = array();
 1189+ foreach ( array_keys($this->numberedArgs) as $key ) {
 1190+ $arguments[$key] = $this->getArgument($key);
 1191+ }
 1192+ return $arguments;
 1193+ }
 1194+
 1195+ function getNamedArguments() {
 1196+ $arguments = array();
 1197+ foreach ( array_keys($this->namedArgs) as $key ) {
 1198+ $arguments[$key] = $this->getArgument($key);
 1199+ }
 1200+ return $arguments;
 1201+ }
 1202+
11771203 function getNumberedArgument( $index ) {
11781204 if ( !isset( $this->numberedArgs[$index] ) ) {
11791205 return false;
Index: trunk/phase3/includes/parser/Preprocessor_DOM.php
@@ -1218,6 +1218,32 @@
12191219 return !count( $this->numberedArgs ) && !count( $this->namedArgs );
12201220 }
12211221
 1222+ function getArguments() {
 1223+ $arguments = array();
 1224+ foreach ( array_merge(
 1225+ array_keys($this->numberedArgs),
 1226+ array_keys($this->namedArgs)) as $key ) {
 1227+ $arguments[$key] = $this->getArgument($key);
 1228+ }
 1229+ return $arguments;
 1230+ }
 1231+
 1232+ function getNumberedArguments() {
 1233+ $arguments = array();
 1234+ foreach ( array_keys($this->numberedArgs) as $key ) {
 1235+ $arguments[$key] = $this->getArgument($key);
 1236+ }
 1237+ return $arguments;
 1238+ }
 1239+
 1240+ function getNamedArguments() {
 1241+ $arguments = array();
 1242+ foreach ( array_keys($this->namedArgs) as $key ) {
 1243+ $arguments[$key] = $this->getArgument($key);
 1244+ }
 1245+ return $arguments;
 1246+ }
 1247+
12221248 function getNumberedArgument( $index ) {
12231249 if ( !isset( $this->numberedArgs[$index] ) ) {
12241250 return false;

Status & tagging log