Index: trunk/phase3/includes/parser/Parser.php |
— | — | @@ -303,7 +303,7 @@ |
304 | 304 | * to internalParse() which does all the real work. |
305 | 305 | */ |
306 | 306 | |
307 | | - global $wgUseTidy, $wgAlwaysUseTidy, $wgContLang, $wgDisableLangConversion, $wgDisableTitleConversion, $wgUser, $wgRequest; |
| 307 | + global $wgUseTidy, $wgAlwaysUseTidy, $wgContLang, $wgDisableLangConversion, $wgDisableTitleConversion, $wgUser, $wgRequest, $wgOut; |
308 | 308 | $fname = __METHOD__.'-' . wfGetCaller(); |
309 | 309 | wfProfileIn( __METHOD__ ); |
310 | 310 | wfProfileIn( $fname ); |
— | — | @@ -386,7 +386,7 @@ |
387 | 387 | if ( $convruletitle ) { |
388 | 388 | $this->mOutput->setTitleText( $convruletitle ); |
389 | 389 | } else { |
390 | | - $this->mOutput->setTitleText( $wgContLang->convert( $this->mOutput->getTitleText() ) ); |
| 390 | + $wgOut->setPageTitle( $wgContLang->convert( $wgOut->getPageTitle(), true ) ); |
391 | 391 | } |
392 | 392 | } |
393 | 393 | |
Index: trunk/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(); |
— | — | @@ -445,10 +445,19 @@ |
446 | 446 | } |
447 | 447 | |
448 | 448 | /** |
449 | | - * "HTML title" means the contents of <title>. It is stored as plain, unescaped text and will be run through htmlspecialchars in the skin file. |
| 449 | + * "HTML title" means the contents of <title>. |
| 450 | + * It is stored as plain, unescaped text and will be run through htmlspecialchars in the skin file. |
| 451 | + * If $name is from page title, it can only override names which are also from page title, |
| 452 | + * but if it is not from page title, it can override all other names. |
450 | 453 | */ |
451 | | - public function setHTMLTitle( $name ) { |
452 | | - $this->mHTMLtitle = $name; |
| 454 | + public function setHTMLTitle( $name, $frompagetitle = false ) { |
| 455 | + if ( $frompagetitle && $this->mHTMLtitleFromPagetitle ) { |
| 456 | + $this->mHTMLtitle = $name; |
| 457 | + } |
| 458 | + elseif ( $this->mHTMLtitleFromPagetitle ) { |
| 459 | + $this->mHTMLtitle = $name; |
| 460 | + $this->mHTMLtitleFromPagetitle = false; |
| 461 | + } |
453 | 462 | } |
454 | 463 | |
455 | 464 | /** |
— | — | @@ -478,7 +487,7 @@ |
479 | 488 | } |
480 | 489 | |
481 | 490 | # change "<i>foo&bar</i>" to "foo&bar" |
482 | | - $this->setHTMLTitle( wfMsg( 'pagetitle', Sanitizer::stripAllTags( $nameWithTags ) ) ); |
| 491 | + $this->setHTMLTitle( wfMsg( 'pagetitle', Sanitizer::stripAllTags( $nameWithTags ) ), true ); |
483 | 492 | } |
484 | 493 | |
485 | 494 | /** |
Index: trunk/phase3/languages/LanguageConverter.php |
— | — | @@ -547,12 +547,16 @@ |
548 | 548 | * @param $text String: text to be converted |
549 | 549 | * @return String: converted text |
550 | 550 | */ |
551 | | - public function convert( $text ) { |
| 551 | + public function convert( $text, $istitle = false ) { |
552 | 552 | global $wgDisableLangConversion; |
553 | 553 | if ( $wgDisableLangConversion ) return $text; |
554 | 554 | |
555 | 555 | $variant = $this->getPreferredVariant(); |
556 | 556 | |
| 557 | + if( $istitle ) { |
| 558 | + $text = $this->convertNamespace( $text, $variant ); |
| 559 | + } |
| 560 | + |
557 | 561 | return $this->recursiveConvertTopLevel( $text, $variant ); |
558 | 562 | } |
559 | 563 | |