r64855 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r64854‎ | r64855 | r64856 >
Date:06:27, 10 April 2010
Author:philip
Status:deferred
Tags:
Comment:
Follow up r64851. Apply on REL1_16.
Modified paths:
  • /branches/REL1_16/phase3/includes/OutputPage.php (modified) (history)
  • /branches/REL1_16/phase3/includes/parser/Parser.php (modified) (history)
  • /branches/REL1_16/phase3/languages/LanguageConverter.php (modified) (history)

Diff [purge]

Index: branches/REL1_16/phase3/includes/parser/Parser.php
@@ -388,7 +388,7 @@
389389 if ( $convruletitle ) {
390390 $this->mOutput->setTitleText( $convruletitle );
391391 } else {
392 - $this->mOutput->setTitleText( $wgContLang->convert( $this->mOutput->getTitleText() ) );
 392+ $wgOut->setPageTitle( $wgContLang->convert( $wgOut->getPageTitle(), true ) );
393393 }
394394 }
395395
Index: branches/REL1_16/phase3/includes/OutputPage.php
@@ -9,7 +9,7 @@
1010 var $mMetatags = array(), $mKeywords = array(), $mLinktags = array();
1111 var $mExtStyles = array();
1212 var $mPagetitle = '', $mBodytext = '', $mDebugtext = '';
13 - var $mHTMLtitle = '', $mIsarticle = true, $mPrintable = false;
 13+ var $mHTMLtitle = '', $mHTMLtitleFromPagetitle = true, $mIsarticle = true, $mPrintable = false;
1414 var $mSubtitle = '', $mRedirect = '', $mStatusCode;
1515 var $mLastModified = '', $mETag = false;
1616 var $mCategoryLinks = array(), $mCategories = array(), $mLanguageLinks = array();
@@ -435,10 +435,19 @@
436436 }
437437
438438 /**
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.
440443 */
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+ }
443452 }
444453
445454 /**
@@ -468,7 +477,7 @@
469478 }
470479
471480 # change "<i>foo&amp;bar</i>" to "foo&bar"
472 - $this->setHTMLTitle( wfMsg( 'pagetitle', Sanitizer::stripAllTags( $nameWithTags ) ) );
 481+ $this->setHTMLTitle( wfMsg( 'pagetitle', Sanitizer::stripAllTags( $nameWithTags ) ), true );
473482 }
474483
475484 /**
Index: branches/REL1_16/phase3/languages/LanguageConverter.php
@@ -521,8 +521,8 @@
522522
523523 /**
524524 * 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
527527 * @private
528528 */
529529 function convertNamespace( $title, $variant ) {
@@ -548,16 +548,19 @@
549549 * -{flags|code1:text1;code2:text2;...}- or
550550 * -{text}- in which case no conversion should take place for text
551551 *
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
555554 */
556 - function convert( $text ) {
 555+ public function convert( $text, $istitle = false ) {
557556 global $wgDisableLangConversion;
558557 if ( $wgDisableLangConversion ) return $text;
559558
560559 $variant = $this->getPreferredVariant();
561560
 561+ if( $istitle ) {
 562+ $text = $this->convertNamespace( $text, $variant );
 563+ }
 564+
562565 return $this->recursiveConvertTopLevel( $text, $variant );
563566 }
564567

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r64851Fix bug 23115 again. Follow up r64821, r64823 and r64827. Rewrite the convert...philip05:46, 10 April 2010

Status & tagging log