Escaping issues per comment http://www.mediawiki.org/wiki/Special:Code/MediaWiki/45181#c1046
} else {
# Use the title defined by DISPLAYTITLE magic word when present
if ( isset( $this->mParserOutput )
- && ( $displayTitle = $this->mParserOutput->getDisplayTitle() ) !== false )
- {
- $wgOut->setPageTitle( wfMsg( 'editing', $this->mParserOutput->getDisplayTitleH1() ) );
- # Override the HTML that setPageTitle slated for inclusion in the <title>
- $wgOut->setHTMLTitle( wfMsg( 'pagetitle', wfMsg( 'editing', $displayTitle ) ) );
+ && ( $dt = $this->mParserOutput->getDisplayTitle() ) !== false ) {
+ $title = $dt;
} else {
- $wgOut->setPageTitle( wfMsg( 'editing', $wgTitle->getPrefixedText() ) );
+ $title = $wgTitle->getPrefixedText();
}
+ $wgOut->setPageTitle( wfMsg( 'editing', $title ) );
}
}
}
}
- # "HTML title" means <title>
- public function setHTMLTitle( $name ) { $this->mHTMLtitle = $name; }
-
- # "Page title" means <h1>
+ public function setHTMLTitle( $name ) {$this->mHTMLtitle = $name; }
public function setPageTitle( $name ) {
global $action, $wgContLang;
$name = $wgContLang->convert($name, true);
$name .= ' - '.$taction;
}
}
-
+
$this->setHTMLTitle( wfMsg( 'pagetitle', $name ) );
}
public function getHTMLTitle() { return $this->mHTMLtitle; }
}
}
// Display title
- if( ( $displayTitleText = $parserOutput->getDisplayTitle() ) !== false ) {
- $this->setPageTitle( $parserOutput->getDisplayTitleH1() );
- $this->setHTMLTitle( wfMsg( 'pagetitle', $displayTitleText ) ); #override the HTML that setPageTitle slated for inclusion in the <title>
- }
+ if( ( $dt = $parserOutput->getDisplayTitle() ) !== false )
+ $this->setPageTitle( $dt );
// Hooks registered in the object
global $wgParserOutputHooks;
* @param string $text Desired title text
* @return string
*/
- static function displaytitle( $parser, $displayTitleH1 = '' ) {
+ static function displaytitle( $parser, $text = '' ) {
global $wgRestrictDisplayTitle;
-
- $titleHTML = Sanitizer::removeHTMLtags( $displayTitleH1 ); #escape the bad tags
- $titleText = trim( Sanitizer::stripAllTags( $titleHTML ) ); #remove the good tags, leaving the bad tags escaped, and trim it to make sure it comes out pretty
-
+ $text = trim( Sanitizer::decodeCharReferences( $text ) );
+
if ( !$wgRestrictDisplayTitle ) {
- $parser->mOutput->setDisplayTitleH1( $titleHTML );
- $parser->mOutput->setDisplayTitle( $titleText );
+ $parser->mOutput->setDisplayTitle( $text );
} else {
- # Only requested titles that normalize to the actual title are allowed through
- $title = Title::newFromText( $titleText );
- if ( $title != null && $title->getFragment() == '' && $title->equals( $parser->mTitle ) ) {
- $parser->mOutput->setDisplayTitleH1( $titleHTML );
- $parser->mOutput->setDisplayTitle( $titleText ); #put the stripped contents of <h1> into <title>
- }
+ $title = Title::newFromText( $text );
+ if( $title instanceof Title && $title->getFragment() == '' && $title->equals( $parser->mTitle ) )
+ $parser->mOutput->setDisplayTitle( $text );
}
-
return '';
}
/**
* Overridden title for display
*/
- private $displayTitle = false; #for use in the <title> tag
- private $displayTitleH1 = false; #for use in the <h1> tag, may contain further HTML tags
+ private $displayTitle = false;
function ParserOutput( $text = '', $languageLinks = array(), $categoryLinks = array(),
$containsOldMagic = false, $titletext = '' )
}
}
- /**
- * Get the title to be used for display
- *
- * @return string
- */
- public function getDisplayTitle() {
- return $this->displayTitle;
- }
-
/**
* Override the title to be used for display
* -- this is assumed to have been validated
public function setDisplayTitle( $text ) {
$this->displayTitle = $text;
}
-
- public function getDisplayTitleH1() {
- return $this->displayTitleH1;
- }
-
- public function setDisplayTitleH1( $html ) {
- $this->displayTitleH1 = $html;
+
+ /**
+ * Get the title to be used for display
+ *
+ * @return string
+ */
+ public function getDisplayTitle() {
+ return $this->displayTitle;
}
/**
class="mediawiki <?php $this->text('dir') ?> <?php $this->text('pageclass') ?> <?php $this->text('skinnameclass') ?>">
<!-- heading -->
- <div id="mw_header"><h1 id="firstHeading"><?php $this->html('title') ?></h1></div>
+ <div id="mw_header"><h1 id="firstHeading"><?php $this->data['displaytitle']!=""?$this->html('title'):$this->text('title') ?></h1></div>
<div id="mw_main">
<div id="mw_contentwrapper">
<div id="content">
<a name="top" id="top"></a>
<?php if($this->data['sitenotice']) { ?><div id="siteNotice"><?php $this->html('sitenotice') ?></div><?php } ?>
- <h1 class="firstHeading"><?php $this->html('title'); ?></h1>
+ <h1 class="firstHeading"><?php $this->data['displaytitle']!=""?$this->html('title'):$this->text('title') ?></h1>
<div id="bodyContent">
<h3 id="siteSub"><?php $this->msg('tagline') ?></h3>
<div id="contentSub"><?php $this->html('subtitle') ?></div>
} // end of class
-