From: Philip Tzou Date: Thu, 29 Jan 2009 10:09:19 +0000 (+0000) Subject: mTables' element must not be left blank, to ensure the translate() function could... X-Git-Tag: 1.31.0-rc.0~43138 X-Git-Url: https://git.cyclocoop.org/%27.%24link.%27?a=commitdiff_plain;h=9d431a4d45eec30256499eddd9b8c6778f6be05c;p=lhc%2Fweb%2Fwiklou.git mTables' element must not be left blank, to ensure the translate() function could always return a string. --- diff --git a/languages/LanguageConverter.php b/languages/LanguageConverter.php index 9c38d2fa59..32edfa78de 100644 --- a/languages/LanguageConverter.php +++ b/languages/LanguageConverter.php @@ -208,10 +208,10 @@ class LanguageConverter { * @private */ function captionConvert( $matches ) { - // we convert captions except URL $toVariant = $this->getPreferredVariant(); $title = $matches[1]; $text = $matches[2]; + // we convert captions except URL if( !strpos( $text, '://' ) ) $text = $this->translate($text, $toVariant); return " $title=\"$text\""; @@ -372,12 +372,19 @@ class LanguageConverter { if( !in_array($v,$this->mVariants) )continue; if( $action=="add" ) { foreach($t as $from=>$to) { - // more efficient than array_merge(), about 2.5 times. - $this->mManualAddTables[$v][$from] = $to; + // to ensure that $from and $to not be left blank + // so $this->translate() could always return a string + if ($from || $to) + // more efficient than array_merge(), about 2.5 times. + $this->mManualAddTables[$v][$from] = $to; + } + } + elseif ( $action=="remove" ) { + foreach($t as $from=>$to) { + if ($from || $to) + $this->mManualRemoveTables[$v][$from] = $to; } } - elseif ( $action=="remove" ) - $this->mManualRemoveTables[$v] = array_merge($this->mManualRemoveTables[$v], $t); } }