r96747 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r96746‎ | r96747 | r96748 >
Date:21:35, 10 September 2011
Author:roberthl
Status:ok
Tags:
Comment:
Babel: Use strtr instead of a foreach and str_replace.
Modified paths:
  • /trunk/extensions/Babel/Babel.class.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Babel/Babel.class.php
@@ -301,14 +301,11 @@
302302 */
303303 protected static function mReplaceCategoryVariables( $category, $code ) {
304304 global $wgLanguageCode;
305 - $vars = array(
 305+ $category = strtr( $category, array(
306306 '%code%' => $code,
307307 '%wikiname%' => BabelLanguageCodes::getName( $code, $wgLanguageCode ),
308308 '%nativename%' => BabelLanguageCodes::getName( $code )
309 - );
310 - foreach ( $vars as $find => $replace ) {
311 - $category = str_replace( $find, $replace, $category );
312 - }
 309+ ) );
313310 return $category;
314311 }
315312

Status & tagging log