(bug 12998) Allow <sup>, <sub>, etc. in DISPLAYTITLE
[lhc/web/wiklou.git] / includes / parser / CoreParserFunctions.php
index f7368f3..fb50b46 100644 (file)
@@ -229,17 +229,15 @@ class CoreParserFunctions {
         * @param string $text Desired title text
         * @return string
         */
-       static function displaytitle( $parser, $text = '' ) {
-               global $wgRestrictDisplayTitle;
-               $text = trim( Sanitizer::decodeCharReferences( $text ) );
+       static function displaytitle( $parser, $displayTitle = '' ) {
+               #only requested titles that normalize to the actual title are allowed through
+               #mimic the escaping process that occurs in OutputPage::setPageTitle
+               $title = Title::newFromText( Sanitizer::stripAllTags( Sanitizer::normalizeCharReferences( Sanitizer::removeHTMLtags( $displayTitle ) ) ) );
 
-               if ( !$wgRestrictDisplayTitle ) {
-                       $parser->mOutput->setDisplayTitle( $text );
-               } else {
-                       $title = Title::newFromText( $text );
-                       if( $title instanceof Title && $title->getFragment() == '' && $title->equals( $parser->mTitle ) )
-                               $parser->mOutput->setDisplayTitle( $text );
+               if ( $title instanceof Title && $title->getFragment() == '' && $title->equals( $parser->mTitle ) ) {
+                       $parser->mOutput->setDisplayTitle( $displayTitle );
                }
+
                return '';
        }