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();
}
/**
- * "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;
+ }
}
/**
}
# change "<i>foo&bar</i>" to "foo&bar"
- $this->setHTMLTitle( wfMsg( 'pagetitle', Sanitizer::stripAllTags( $nameWithTags ) ) );
+ $this->setHTMLTitle( wfMsg( 'pagetitle', Sanitizer::stripAllTags( $nameWithTags ) ), true );
}
/**
* to internalParse() which does all the real work.
*/
- global $wgUseTidy, $wgAlwaysUseTidy, $wgContLang, $wgDisableLangConversion, $wgDisableTitleConversion, $wgUser, $wgRequest;
+ global $wgUseTidy, $wgAlwaysUseTidy, $wgContLang, $wgDisableLangConversion, $wgDisableTitleConversion, $wgUser, $wgRequest, $wgOut;
$fname = __METHOD__.'-' . wfGetCaller();
wfProfileIn( __METHOD__ );
wfProfileIn( $fname );
if ( $convruletitle ) {
$this->mOutput->setTitleText( $convruletitle );
} else {
- $this->mOutput->setTitleText( $wgContLang->convert( $this->mOutput->getTitleText() ) );
+ $wgOut->setPageTitle( $wgContLang->convert( $wgOut->getPageTitle(), true ) );
}
}
* @param $text String: text to be converted
* @return String: converted text
*/
- public 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 );
}