* Added option to install to MyISAM
* (bug 9250) Remove hardcoded minimum image name length of three characters
* (bug 10338) Enforce signature length limit in Unicode characters instead of bytes
-
+* Fixed DISPLAYTITLE behaviour to reject titles which don't normalise to the
+ same title as the current page, and enabled per default
== Bugfixes since 1.10 ==
return $parser->getFunctionLang()->convertPlural( $text, $arg0, $arg1, $arg2, $arg3, $arg4 );
}
- static function displaytitle( $parser, $param = '' ) {
- $parserOptions = new ParserOptions;
- $local_parser = clone $parser;
- $t2 = $local_parser->parse ( $param, $parser->mTitle, $parserOptions, false );
- $parser->mOutput->mHTMLtitle = $t2->GetText();
-
- # Add subtitle
- $t = $parser->mTitle->getPrefixedText();
- $parser->mOutput->mSubtitle .= wfMsg('displaytitle', $t);
+ /**
+ * Override the title of the page when viewed,
+ * provided we've been given a title which
+ * will normalise to the canonical title
+ *
+ * @param Parser $parser Parent parser
+ * @param string $text Desired title text
+ * @return string
+ */
+ static function displaytitle( $parser, $text = '' ) {
+ $text = trim( $text );
+ $title = Title::newFromText( $text );
+ if( $title instanceof Title && $title->equals( $parser->mTitle ) )
+ $parser->mOutput->setDisplayTitle( $text );
return '';
}
/**
* Allow DISPLAYTITLE to change title display
*/
-$wgAllowDisplayTitle = false ;
+$wgAllowDisplayTitle = true;
/**
* Array of usernames which may not be registered or logged in from
if ( $parserOutput->getCacheTime() == -1 ) {
$this->enableClientCache( false );
}
- if ( $parserOutput->mHTMLtitle != "" ) {
- $this->mPagetitle = $parserOutput->mHTMLtitle ;
- }
- if ( $parserOutput->mSubtitle != '' ) {
- $this->mSubtitle .= $parserOutput->mSubtitle ;
- }
$this->mNoGallery = $parserOutput->getNoGallery();
$this->mHeadItems = array_merge( $this->mHeadItems, (array)$parserOutput->mHeadItems );
// Versioning...
$this->mTemplateIds += (array)$parserOutput->mTemplateIds;
+ # Display title
+ if( ( $dt = $parserOutput->getDisplayTitle() ) !== false )
+ $this->setPageTitle( $dt );
+
wfRunHooks( 'OutputPageParserOutput', array( &$this, $parserOutput ) );
}
* changes in an incompatible way, so the parser cache
* can automatically discard old data.
*/
-define( 'MW_PARSER_VERSION', '1.6.1' );
+define( 'MW_PARSER_VERSION', '1.6.2' );
define( 'RLH_FOR_UPDATE', 1 );
$mTemplateIds, # 2-D map of NS/DBK to rev ID for the template references. ID=zero for broken.
$mImages, # DB keys of the images used, in the array key only
$mExternalLinks, # External link URLs, in the key only
- $mHTMLtitle, # Display HTML title
- $mSubtitle, # Additional subtitle
$mNewSection, # Show a new section link?
$mNoGallery, # No gallery on category page? (__NOGALLERY__)
$mHeadItems; # Items to put in the <head> section
+
+ /**
+ * Overridden title for display
+ */
+ private $displayTitle = false;
function ParserOutput( $text = '', $languageLinks = array(), $categoryLinks = array(),
$containsOldMagic = false, $titletext = '' )
$this->mTemplates = array();
$this->mImages = array();
$this->mExternalLinks = array();
- $this->mHTMLtitle = "" ;
- $this->mSubtitle = "" ;
$this->mNewSection = false;
$this->mNoGallery = false;
$this->mHeadItems = array();
function setContainsOldMagic( $com ) { return wfSetVar( $this->mContainsOldMagic, $com ); }
function setCacheTime( $t ) { return wfSetVar( $this->mCacheTime, $t ); }
function setTitleText( $t ) { return wfSetVar($this->mTitleText, $t); }
- function setSubtitle( $st ) { return wfSetVar( $this->mSubtitle, $st ); }
function addCategory( $c, $sort ) { $this->mCategories[$c] = $sort; }
function addLanguageLink( $t ) { $this->mLanguageLinks[] = $t; }
$this->mHeadItems[] = $section;
}
}
+
+ /**
+ * Override the title to be used for display
+ * -- this is assumed to have been validated
+ * (check equal normalisation, etc.)
+ *
+ * @param string $text Desired title text
+ */
+ public function setDisplayTitle( $text ) {
+ $this->displayTitle = $text;
+ }
+
+ /**
+ * Get the title to be used for display
+ *
+ * @return string
+ */
+ public function getDisplayTitle() {
+ return $this->displayTitle;
+ }
+
}
?>