Index: branches/REL1_16/phase3/includes/parser/Parser.php |
— | — | @@ -388,7 +388,7 @@ |
389 | 389 | if ( $convruletitle ) { |
390 | 390 | $this->mOutput->setTitleText( $convruletitle ); |
391 | 391 | } else { |
392 | | - $this->mOutput->setTitleText( $wgContLang->convert( $this->mOutput->getTitleText() ) ); |
| 392 | + $wgOut->setPageTitle( $wgContLang->convert( $wgOut->getPageTitle(), true ) ); |
393 | 393 | } |
394 | 394 | } |
395 | 395 | |
Index: branches/REL1_16/phase3/includes/OutputPage.php |
— | — | @@ -9,7 +9,7 @@ |
10 | 10 | var $mMetatags = array(), $mKeywords = array(), $mLinktags = array(); |
11 | 11 | var $mExtStyles = array(); |
12 | 12 | var $mPagetitle = '', $mBodytext = '', $mDebugtext = ''; |
13 | | - var $mHTMLtitle = '', $mIsarticle = true, $mPrintable = false; |
| 13 | + var $mHTMLtitle = '', $mHTMLtitleFromPagetitle = true, $mIsarticle = true, $mPrintable = false; |
14 | 14 | var $mSubtitle = '', $mRedirect = '', $mStatusCode; |
15 | 15 | var $mLastModified = '', $mETag = false; |
16 | 16 | var $mCategoryLinks = array(), $mCategories = array(), $mLanguageLinks = array(); |
— | — | @@ -435,10 +435,19 @@ |
436 | 436 | } |
437 | 437 | |
438 | 438 | /** |
439 | | - * "HTML title" means the contents of <title>. It is stored as plain, unescaped text and will be run through htmlspecialchars in the skin file. |
| 439 | + * "HTML title" means the contents of <title>. |
| 440 | + * It is stored as plain, unescaped text and will be run through htmlspecialchars in the skin file. |
| 441 | + * If $name is from page title, it can only override names which are also from page title, |
| 442 | + * but if it is not from page title, it can override all other names. |
440 | 443 | */ |
441 | | - public function setHTMLTitle( $name ) { |
442 | | - $this->mHTMLtitle = $name; |
| 444 | + public function setHTMLTitle( $name, $frompagetitle = false ) { |
| 445 | + if ( $frompagetitle && $this->mHTMLtitleFromPagetitle ) { |
| 446 | + $this->mHTMLtitle = $name; |
| 447 | + } |
| 448 | + elseif ( $this->mHTMLtitleFromPagetitle ) { |
| 449 | + $this->mHTMLtitle = $name; |
| 450 | + $this->mHTMLtitleFromPagetitle = false; |
| 451 | + } |
443 | 452 | } |
444 | 453 | |
445 | 454 | /** |
— | — | @@ -468,7 +477,7 @@ |
469 | 478 | } |
470 | 479 | |
471 | 480 | # change "<i>foo&bar</i>" to "foo&bar" |
472 | | - $this->setHTMLTitle( wfMsg( 'pagetitle', Sanitizer::stripAllTags( $nameWithTags ) ) ); |
| 481 | + $this->setHTMLTitle( wfMsg( 'pagetitle', Sanitizer::stripAllTags( $nameWithTags ) ), true ); |
473 | 482 | } |
474 | 483 | |
475 | 484 | /** |
Index: branches/REL1_16/phase3/languages/LanguageConverter.php |
— | — | @@ -521,8 +521,8 @@ |
522 | 522 | |
523 | 523 | /** |
524 | 524 | * Convert namespace. |
525 | | - * @param string $title the title included namespace |
526 | | - * @return array of string |
| 525 | + * @param $title String: the title included namespace |
| 526 | + * @return Array of string |
527 | 527 | * @private |
528 | 528 | */ |
529 | 529 | function convertNamespace( $title, $variant ) { |
— | — | @@ -548,16 +548,19 @@ |
549 | 549 | * -{flags|code1:text1;code2:text2;...}- or |
550 | 550 | * -{text}- in which case no conversion should take place for text |
551 | 551 | * |
552 | | - * @param string $text text to be converted |
553 | | - * @return string converted text |
554 | | - * @public |
| 552 | + * @param $text String: text to be converted |
| 553 | + * @return String: converted text |
555 | 554 | */ |
556 | | - function convert( $text ) { |
| 555 | + public function convert( $text, $istitle = false ) { |
557 | 556 | global $wgDisableLangConversion; |
558 | 557 | if ( $wgDisableLangConversion ) return $text; |
559 | 558 | |
560 | 559 | $variant = $this->getPreferredVariant(); |
561 | 560 | |
| 561 | + if( $istitle ) { |
| 562 | + $text = $this->convertNamespace( $text, $variant ); |
| 563 | + } |
| 564 | + |
562 | 565 | return $this->recursiveConvertTopLevel( $text, $variant ); |
563 | 566 | } |
564 | 567 | |