http://www.mediawiki.org/wiki/Special:Code/MediaWiki/64855
Revision: 64855 Author: philip Date: 2010-04-10 06:27:27 +0000 (Sat, 10 Apr 2010) Log Message: ----------- Follow up r64851. Apply on REL1_16. Modified Paths: -------------- branches/REL1_16/phase3/includes/OutputPage.php branches/REL1_16/phase3/includes/parser/Parser.php branches/REL1_16/phase3/languages/LanguageConverter.php Modified: branches/REL1_16/phase3/includes/OutputPage.php =================================================================== --- branches/REL1_16/phase3/includes/OutputPage.php 2010-04-10 06:23:12 UTC (rev 64854) +++ branches/REL1_16/phase3/includes/OutputPage.php 2010-04-10 06:27:27 UTC (rev 64855) @@ -9,7 +9,7 @@ var $mMetatags = array(), $mKeywords = array(), $mLinktags = array(); var $mExtStyles = array(); var $mPagetitle = '', $mBodytext = '', $mDebugtext = ''; - var $mHTMLtitle = '', $mIsarticle = true, $mPrintable = false; + var $mHTMLtitle = '', $mHTMLtitleFromPagetitle = true, $mIsarticle = true, $mPrintable = false; var $mSubtitle = '', $mRedirect = '', $mStatusCode; var $mLastModified = '', $mETag = false; var $mCategoryLinks = array(), $mCategories = array(), $mLanguageLinks = array(); @@ -435,10 +435,19 @@ } /** - * "HTML title" means the contents of <title>. It is stored as plain, unescaped text and will be run through htmlspecialchars in the skin file. + * "HTML title" means the contents of <title>. + * It is stored as plain, unescaped text and will be run through htmlspecialchars in the skin file. + * If $name is from page title, it can only override names which are also from page title, + * but if it is not from page title, it can override all other names. */ - public function setHTMLTitle( $name ) { - $this->mHTMLtitle = $name; + public function setHTMLTitle( $name, $frompagetitle = false ) { + if ( $frompagetitle && $this->mHTMLtitleFromPagetitle ) { + $this->mHTMLtitle = $name; + } + elseif ( $this->mHTMLtitleFromPagetitle ) { + $this->mHTMLtitle = $name; + $this->mHTMLtitleFromPagetitle = false; + } } /** @@ -468,7 +477,7 @@ } # change "<i>foo&bar</i>" to "foo&bar" - $this->setHTMLTitle( wfMsg( 'pagetitle', Sanitizer::stripAllTags( $nameWithTags ) ) ); + $this->setHTMLTitle( wfMsg( 'pagetitle', Sanitizer::stripAllTags( $nameWithTags ) ), true ); } /** Modified: branches/REL1_16/phase3/includes/parser/Parser.php =================================================================== --- branches/REL1_16/phase3/includes/parser/Parser.php 2010-04-10 06:23:12 UTC (rev 64854) +++ branches/REL1_16/phase3/includes/parser/Parser.php 2010-04-10 06:27:27 UTC (rev 64855) @@ -388,7 +388,7 @@ if ( $convruletitle ) { $this->mOutput->setTitleText( $convruletitle ); } else { - $this->mOutput->setTitleText( $wgContLang->convert( $this->mOutput->getTitleText() ) ); + $wgOut->setPageTitle( $wgContLang->convert( $wgOut->getPageTitle(), true ) ); } } Modified: branches/REL1_16/phase3/languages/LanguageConverter.php =================================================================== --- branches/REL1_16/phase3/languages/LanguageConverter.php 2010-04-10 06:23:12 UTC (rev 64854) +++ branches/REL1_16/phase3/languages/LanguageConverter.php 2010-04-10 06:27:27 UTC (rev 64855) @@ -521,8 +521,8 @@ /** * Convert namespace. - * @param string $title the title included namespace - * @return array of string + * @param $title String: the title included namespace + * @return Array of string * @private */ function convertNamespace( $title, $variant ) { @@ -548,16 +548,19 @@ * -{flags|code1:text1;code2:text2;...}- or * -{text}- in which case no conversion should take place for text * - * @param string $text text to be converted - * @return string converted text - * @public + * @param $text String: text to be converted + * @return String: converted text */ - function convert( $text ) { + public function convert( $text, $istitle = false ) { global $wgDisableLangConversion; if ( $wgDisableLangConversion ) return $text; $variant = $this->getPreferredVariant(); + if( $istitle ) { + $text = $this->convertNamespace( $text, $variant ); + } + return $this->recursiveConvertTopLevel( $text, $variant ); } _______________________________________________ MediaWiki-CVS mailing list MediaWiki-CVS@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs