r81527 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r81526‎ | r81527 | r81528 >
Date:16:47, 4 February 2011
Author:ialex
Status:ok
Tags:
Comment:
Allow parameter to be passed with an array in the first parameter (as other wfMsg*() functions)
Modified paths:
  • /trunk/phase3/includes/Message.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/Message.php
@@ -148,7 +148,11 @@
149149 * @return Message: $this
150150 */
151151 public function params( /*...*/ ) {
152 - $args_values = array_values( func_get_args() );
 152+ $args = func_get_args();
 153+ if ( isset( $args[0] ) && is_array( $args[0] ) ) {
 154+ $args = $args[0];
 155+ }
 156+ $args_values = array_values( $args );
153157 $this->parameters = array_merge( $this->parameters, $args_values );
154158 return $this;
155159 }
@@ -163,6 +167,9 @@
164168 */
165169 public function rawParams( /*...*/ ) {
166170 $params = func_get_args();
 171+ if ( isset( $params[0] ) && is_array( $params[0] ) ) {
 172+ $params = $params[0];
 173+ }
167174 foreach( $params as $param ) {
168175 $this->parameters[] = self::rawParam( $param );
169176 }
@@ -177,6 +184,9 @@
178185 */
179186 public function numParams( /*...*/ ) {
180187 $params = func_get_args();
 188+ if ( isset( $params[0] ) && is_array( $params[0] ) ) {
 189+ $params = $params[0];
 190+ }
181191 foreach( $params as $param ) {
182192 $this->parameters[] = self::numParam( $param );
183193 }

Status & tagging log