* Support named arguments to wfMsg* like wfMsg( 'msg', array( 'foo' => 'bar' ) )
This commit is contained in:
parent
4e3d724dfa
commit
0fec84c81c
1 changed files with 8 additions and 4 deletions
|
|
@ -408,13 +408,17 @@ function wfMsgReplaceArgs( $message, $args ) {
|
|||
# Some messages are split with explode("\n", $msg)
|
||||
$message = str_replace( "\r", '', $message );
|
||||
|
||||
# Replace arguments
|
||||
if( count( $args ) ) {
|
||||
foreach( $args as $n => $param ) {
|
||||
// Replace arguments
|
||||
if ( count( $args ) )
|
||||
if ( is_array( $args[0] ) )
|
||||
foreach ( $args[0] as $key => $val )
|
||||
$message = str_replace( '$' . $key, $val, $message );
|
||||
else {
|
||||
foreach( $args as $n => $param )
|
||||
$replacementKeys['$' . ($n + 1)] = $param;
|
||||
}
|
||||
$message = strtr( $message, $replacementKeys );
|
||||
}
|
||||
|
||||
return $message;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue