Index: trunk/phase3/languages/LanguageConverter.php |
— | — | @@ -357,10 +357,10 @@ |
358 | 358 | * prepare manual conversion table |
359 | 359 | * @private |
360 | 360 | */ |
361 | | - function prepareManualConv($convRule){ |
| 361 | + function prepareManualConv( $convRule ){ |
362 | 362 | // use syntax -{T|zh:TitleZh;zh-tw:TitleTw}- for custom conversion in title |
363 | 363 | $title = $convRule->getTitle(); |
364 | | - if($title){ |
| 364 | + if( $title ){ |
365 | 365 | $this->mTitleFromFlag = true; |
366 | 366 | $this->mTitleDisplay = $title; |
367 | 367 | } |
— | — | @@ -368,20 +368,20 @@ |
369 | 369 | //apply manual conversion table to global table |
370 | 370 | $convTable = $convRule->getConvTable(); |
371 | 371 | $action = $convRule->getRulesAction(); |
372 | | - foreach($convTable as $v=>$t) { |
373 | | - if( !in_array($v,$this->mVariants) )continue; |
| 372 | + foreach( $convTable as $v => $t ) { |
| 373 | + if( !in_array( $v, $this->mVariants ) )continue; |
374 | 374 | if( $action=="add" ) { |
375 | | - foreach($t as $from=>$to) { |
| 375 | + foreach( $t as $from => $to ) { |
376 | 376 | // to ensure that $from and $to not be left blank |
377 | 377 | // so $this->translate() could always return a string |
378 | | - if ($from || $to) |
| 378 | + if ( $from || $to ) |
379 | 379 | // more efficient than array_merge(), about 2.5 times. |
380 | 380 | $this->mManualAddTables[$v][$from] = $to; |
381 | 381 | } |
382 | 382 | } |
383 | | - elseif ( $action=="remove" ) { |
384 | | - foreach($t as $from=>$to) { |
385 | | - if ($from || $to) |
| 383 | + elseif ( $action == "remove" ) { |
| 384 | + foreach ( $t as $from=>$to ) { |
| 385 | + if ( $from || $to ) |
386 | 386 | $this->mManualRemoveTables[$v][$from] = $to; |
387 | 387 | } |
388 | 388 | } |
— | — | @@ -416,11 +416,13 @@ |
417 | 417 | return $text; |
418 | 418 | } |
419 | 419 | |
420 | | - if($wgDisableLangConversion) |
| 420 | + if ( $wgDisableLangConversion ) |
421 | 421 | return $text; |
422 | 422 | |
423 | 423 | $text = $this->convert( $text ); |
424 | | - $parser->mOutput->setTitleText( $this->mTitleDisplay ); |
| 424 | + |
| 425 | + if ( $this->mTitleFromFlag ) |
| 426 | + $parser->mOutput->setTitleText( $this->mTitleDisplay ); |
425 | 427 | return $text; |
426 | 428 | } |
427 | 429 | |
— | — | @@ -428,7 +430,7 @@ |
429 | 431 | * convert title |
430 | 432 | * @private |
431 | 433 | */ |
432 | | - function convertTitle($text){ |
| 434 | + function convertTitle( $text ){ |
433 | 435 | global $wgDisableTitleConversion, $wgUser; |
434 | 436 | |
435 | 437 | // check for global param and __NOTC__ tag |
— | — | @@ -438,7 +440,7 @@ |
439 | 441 | } |
440 | 442 | |
441 | 443 | // use the title from the T flag if any |
442 | | - if($this->mTitleFromFlag){ |
| 444 | + if( $this->mTitleFromFlag ){ |
443 | 445 | $this->mTitleFromFlag = false; |
444 | 446 | return $this->mTitleDisplay; |
445 | 447 | } |
— | — | @@ -471,7 +473,7 @@ |
472 | 474 | * @return string converted text |
473 | 475 | * @public |
474 | 476 | */ |
475 | | - function convert( $text , $isTitle=false) { |
| 477 | + function convert( $text, $isTitle = false ) { |
476 | 478 | |
477 | 479 | $mw =& MagicWord::get( 'notitleconvert' ); |
478 | 480 | if( $mw->matchAndRemove( $text ) ) |
— | — | @@ -483,36 +485,36 @@ |
484 | 486 | |
485 | 487 | // no conversion if redirecting |
486 | 488 | $mw =& MagicWord::get( 'redirect' ); |
487 | | - if( $mw->matchStart( $text )) |
| 489 | + if( $mw->matchStart( $text ) ) |
488 | 490 | return $text; |
489 | 491 | |
490 | 492 | // for title convertion |
491 | | - if ($isTitle) return $this->convertTitle($text); |
| 493 | + if ( $isTitle ) return $this->convertTitle( $text ); |
492 | 494 | |
493 | 495 | $plang = $this->getPreferredVariant(); |
494 | | - $tarray = StringUtils::explode($this->mMarkup['end'], $text); |
| 496 | + $tarray = StringUtils::explode( $this->mMarkup['end'], $text ); |
495 | 497 | $text = ''; |
496 | 498 | |
497 | 499 | $marks = array(); |
498 | | - foreach($tarray as $txt) { |
499 | | - $marked = explode($this->mMarkup['begin'], $txt, 2); |
500 | | - if (array_key_exists(1, $marked)) { |
| 500 | + foreach ( $tarray as $txt ) { |
| 501 | + $marked = explode( $this->mMarkup['begin'], $txt, 2 ); |
| 502 | + if ( array_key_exists( 1, $marked ) ) { |
501 | 503 | $crule = new ConverterRule($marked[1], $this); |
502 | | - $crule->parse($plang); |
| 504 | + $crule->parse( $plang ); |
503 | 505 | $marked[1] = $crule->getDisplay(); |
504 | | - $this->prepareManualConv($crule); |
| 506 | + $this->prepareManualConv( $crule ); |
505 | 507 | } |
506 | 508 | else |
507 | 509 | $marked[0] .= $this->mMarkup['end']; |
508 | | - array_push($marks, $marked); |
| 510 | + array_push( $marks, $marked ); |
509 | 511 | } |
510 | 512 | $this->applyManualConv(); |
511 | | - foreach ($marks as $marked) { |
| 513 | + foreach ( $marks as $marked ) { |
512 | 514 | if( $this->mDoContentConvert ) |
513 | | - $text .= $this->autoConvert($marked[0],$plang); |
| 515 | + $text .= $this->autoConvert( $marked[0], $plang ); |
514 | 516 | else |
515 | 517 | $text .= $marked[0]; |
516 | | - if( array_key_exists(1, $marked) ) |
| 518 | + if( array_key_exists( 1, $marked ) ) |
517 | 519 | $text .= $marked[1]; |
518 | 520 | } |
519 | 521 | // Remove the last delimiter (wasn't real) |
Index: trunk/phase3/RELEASE-NOTES |
— | — | @@ -137,6 +137,8 @@ |
138 | 138 | * (bug 17283) Remove double URL escaping in show/hide links for log entries |
139 | 139 | and RevisionDeleteForm::__construct |
140 | 140 | * (bug 17105) Numeric table sorting broken |
| 141 | +* (bug 17231) Transcluding special pages on wikis using language conversion no |
| 142 | + longer affects the page title |
141 | 143 | |
142 | 144 | == API changes in 1.15 == |
143 | 145 | * (bug 16858) Revamped list=deletedrevs to make listing deleted contributions |