Index: trunk/phase3/languages/LanguageConverter.php |
— | — | @@ -173,7 +173,7 @@ |
174 | 174 | } |
175 | 175 | |
176 | 176 | // get language variant preference from logged in users |
177 | | - // Don't call this on stub objects because that causes infinite |
| 177 | + // Don't call this on stub objects because that causes infinite |
178 | 178 | // recursion during initialisation |
179 | 179 | if ( $fromUser && $wgUser->isLoggedIn() ) { |
180 | 180 | $this->mPreferredVariant = $wgUser->getOption( 'variant' ); |
— | — | @@ -197,7 +197,7 @@ |
198 | 198 | if ( $fromHeader && $acceptLanguage ) { |
199 | 199 | // explode by comma |
200 | 200 | $result = explode( ',', strtolower( $acceptLanguage ) ); |
201 | | - |
| 201 | + |
202 | 202 | $languages = array(); |
203 | 203 | |
204 | 204 | foreach ( $result as $elem ) { |
— | — | @@ -242,7 +242,7 @@ |
243 | 243 | } |
244 | 244 | return $this->mMainLanguageCode; |
245 | 245 | } |
246 | | - |
| 246 | + |
247 | 247 | /** |
248 | 248 | * Caption convert, base on preg_replace_callback. |
249 | 249 | * |
— | — | @@ -318,11 +318,11 @@ |
319 | 319 | |
320 | 320 | $ret = $this->translate( $m[0], $toVariant ); |
321 | 321 | $mstart = $m[1] + strlen( $m[0] ); |
322 | | - |
| 322 | + |
323 | 323 | // enable convertsion of '<img alt="xxxx" ... ' |
324 | 324 | // or '<span title="xxxx" ... ' |
325 | 325 | $captionpattern = '/\s(title|alt)\s*=\s*"([\s\S]*?)"/'; |
326 | | - |
| 326 | + |
327 | 327 | $trtext = ''; |
328 | 328 | $trtextmark = "\0"; |
329 | 329 | $notrtext = array(); |
— | — | @@ -425,12 +425,12 @@ |
426 | 426 | $ret[$variant] .= $this->translate( $marked[1], $variant ); |
427 | 427 | } |
428 | 428 | } |
429 | | - |
| 429 | + |
430 | 430 | } |
431 | 431 | |
432 | 432 | return $ret; |
433 | 433 | } |
434 | | - |
| 434 | + |
435 | 435 | /** |
436 | 436 | * Prepare manual conversion table. |
437 | 437 | * @private |
— | — | @@ -491,7 +491,7 @@ |
492 | 492 | |
493 | 493 | return $text; |
494 | 494 | } |
495 | | - |
| 495 | + |
496 | 496 | /** |
497 | 497 | * Convert namespace. |
498 | 498 | * @param string $title the title included namespace |
— | — | @@ -517,7 +517,7 @@ |
518 | 518 | */ |
519 | 519 | function preConvertTitle( $text, $variant ) { |
520 | 520 | $this->mTitleOriginal = $text; |
521 | | - |
| 521 | + |
522 | 522 | $text = $this->convertNamespace( $text, $variant ); |
523 | 523 | $this->mTitleDisplay = $this->convert( $text ); |
524 | 524 | } |
— | — | @@ -647,7 +647,7 @@ |
648 | 648 | $ns = NS_MAIN; |
649 | 649 | |
650 | 650 | if ( $disableLinkConversion || |
651 | | - ( !$ignoreOtherCond && |
| 651 | + ( !$ignoreOtherCond && |
652 | 652 | ( $isredir == 'no' |
653 | 653 | || $action == 'edit' |
654 | 654 | || $action == 'submit' |
— | — | @@ -750,7 +750,7 @@ |
751 | 751 | |
752 | 752 | $this->postLoadTables(); |
753 | 753 | $this->mTables[self::CACHE_VERSION_KEY] = true; |
754 | | - |
| 754 | + |
755 | 755 | $wgMemc->set( $this->mCacheKey, $this->mTables, 43200 ); |
756 | 756 | wfProfileOut( __METHOD__ . '-recache' ); |
757 | 757 | } |
— | — | @@ -851,7 +851,7 @@ |
852 | 852 | $ret = array(); |
853 | 853 | foreach ( $blocks as $block ) { |
854 | 854 | $mappings = explode( $this->mMarkup['end'], $block, 2 ); |
855 | | - $stripped = str_replace( array( "'", '"', '*', '#' ), '', |
| 855 | + $stripped = str_replace( array( "'", '"', '*', '#' ), '', |
856 | 856 | $mappings[0] ); |
857 | 857 | $table = explode( ';', $stripped ); |
858 | 858 | foreach ( $table as $t ) { |
— | — | @@ -930,7 +930,7 @@ |
931 | 931 | return true; |
932 | 932 | } |
933 | 933 | |
934 | | - /** |
| 934 | + /** |
935 | 935 | * Armour rendered math against conversion. |
936 | 936 | * Wrap math into rawoutput -{R| math }- syntax. |
937 | 937 | * @public |
— | — | @@ -951,7 +951,7 @@ |
952 | 952 | */ |
953 | 953 | class ConverterRule { |
954 | 954 | var $mText; // original text in -{text}- |
955 | | - var $mConverter; // LanguageConverter object |
| 955 | + var $mConverter; // LanguageConverter object |
956 | 956 | var $mManualCodeError = '<strong class="error">code error!</strong>'; |
957 | 957 | var $mRuleDisplay = ''; |
958 | 958 | var $mRuleTitle = false; |
— | — | @@ -966,7 +966,7 @@ |
967 | 967 | * Constructor |
968 | 968 | * |
969 | 969 | * @param string $text the text between -{ and }- |
970 | | - * @param object $converter a LanguageConverter object |
| 970 | + * @param object $converter a LanguageConverter object |
971 | 971 | * @access public |
972 | 972 | */ |
973 | 973 | function __construct( $text, $converter ) { |
— | — | @@ -998,7 +998,7 @@ |
999 | 999 | } |
1000 | 1000 | return false; |
1001 | 1001 | } |
1002 | | - |
| 1002 | + |
1003 | 1003 | /** |
1004 | 1004 | * Parse flags with syntax -{FLAG| ... }- |
1005 | 1005 | * @private |
— | — | @@ -1075,7 +1075,7 @@ |
1076 | 1076 | $this->mRules = $rules; |
1077 | 1077 | $this->mFlags = $flags; |
1078 | 1078 | } |
1079 | | - |
| 1079 | + |
1080 | 1080 | /** |
1081 | 1081 | * Generate conversion table. |
1082 | 1082 | * @private |
— | — | @@ -1175,7 +1175,7 @@ |
1176 | 1176 | |
1177 | 1177 | if ( count( $bidtable ) + count( $unidtable ) == 0 ) { |
1178 | 1178 | return $this->mRules; |
1179 | | - } elseif ( $doConvert ) { // the text converted |
| 1179 | + } elseif ( $doConvert ) { // the text converted |
1180 | 1180 | // display current variant in bidirectional array |
1181 | 1181 | $disp = $this->getTextInBidtable( $variant ); |
1182 | 1182 | // or display current variant in fallbacks |
— | — | @@ -1222,7 +1222,7 @@ |
1223 | 1223 | fill in the missing variants, if any, |
1224 | 1224 | with fallbacks */ |
1225 | 1225 | if ( !array_key_exists( $v, $bidtable ) ) { |
1226 | | - $variantFallbacks = |
| 1226 | + $variantFallbacks = |
1227 | 1227 | $this->mConverter->getVariantFallbacks( $v ); |
1228 | 1228 | $vf = $this->getTextInBidtable( $variantFallbacks ); |
1229 | 1229 | if ( $vf ) { |
— | — | @@ -1232,11 +1232,11 @@ |
1233 | 1233 | |
1234 | 1234 | if ( array_key_exists( $v, $bidtable ) ) { |
1235 | 1235 | foreach ( $vmarked as $vo ) { |
1236 | | - // use syntax: -{A|zh:WordZh;zh-tw:WordTw}- |
1237 | | - // or -{H|zh:WordZh;zh-tw:WordTw}- |
| 1236 | + // use syntax: -{A|zh:WordZh;zh-tw:WordTw}- |
| 1237 | + // or -{H|zh:WordZh;zh-tw:WordTw}- |
1238 | 1238 | // or -{-|zh:WordZh;zh-tw:WordTw}- |
1239 | 1239 | // to introduce a custom mapping between |
1240 | | - // words WordZh and WordTw in the whole text |
| 1240 | + // words WordZh and WordTw in the whole text |
1241 | 1241 | if ( $manLevel[$v] == 'bidirectional' ) { |
1242 | 1242 | $this->mConvTable[$v][$bidtable[$vo]] = $bidtable[$v]; |
1243 | 1243 | } |
— | — | @@ -1271,7 +1271,7 @@ |
1272 | 1272 | |
1273 | 1273 | // convert to specified variant |
1274 | 1274 | // syntax: -{zh-hans;zh-hant[;...]|<text to convert>}- |
1275 | | - if ( count( array_diff( $flags, $variants ) ) == 0 |
| 1275 | + if ( count( array_diff( $flags, $variants ) ) == 0 |
1276 | 1276 | and count( $flags ) != 0 ) { |
1277 | 1277 | // check if current variant in flags |
1278 | 1278 | if ( in_array( $variant, $flags ) ) { |
— | — | @@ -1297,7 +1297,7 @@ |
1298 | 1298 | } |
1299 | 1299 | |
1300 | 1300 | if ( !in_array( 'R', $flags ) || !in_array( 'N', $flags ) ) { |
1301 | | - // decode => HTML entities modified by Sanitizer::removeHTMLtags |
| 1301 | + // decode => HTML entities modified by Sanitizer::removeHTMLtags |
1302 | 1302 | $this->mRules = str_replace( '=>', '=>', $this->mRules ); |
1303 | 1303 | |
1304 | 1304 | $this->parseRules(); |
— | — | @@ -1321,7 +1321,7 @@ |
1322 | 1322 | $this->mRuleDisplay = $rules; |
1323 | 1323 | } elseif ( in_array( 'N', $flags ) ) { |
1324 | 1324 | // proces N flag: output current variant name |
1325 | | - $this->mRuleDisplay = |
| 1325 | + $this->mRuleDisplay = |
1326 | 1326 | $this->mConverter->mVariantNames[ trim( $rules ) ]; |
1327 | 1327 | } elseif ( in_array( 'D', $flags ) ) { |
1328 | 1328 | // proces D flag: output rules description |
— | — | @@ -1347,10 +1347,10 @@ |
1348 | 1348 | if ( in_array( '+', $flags ) ) { |
1349 | 1349 | $this->mRulesAction = 'add'; |
1350 | 1350 | } |
1351 | | - |
| 1351 | + |
1352 | 1352 | $this->generateConvTable(); |
1353 | 1353 | } |
1354 | | - |
| 1354 | + |
1355 | 1355 | /** |
1356 | 1356 | * @public |
1357 | 1357 | */ |