This change only improves documentation, it does not touch code.
For reference:
* CoreParserFunctions::displaytitle generates HTML, with &, < and so on
property escaped. OutputPage::setPageTitle() treats the input as wikitext,
which works for both plain text and HTML.
* Wikibase calls ParserOutput::setDisplayTitle() with HTML including <span>
structures.
In the API action=query&prop=pageprops returns HTML. There doesn't seem to
be a good place to document that fact, though.
Change-Id: I043b26b82f066abe2830a81d3bc073543b3748d8
}
# Use the title defined by DISPLAYTITLE magic word when present
}
# Use the title defined by DISPLAYTITLE magic word when present
+ # NOTE: getDisplayTitle() returns HTML while getPrefixedText() returns plain text.
+ # setPageTitle() treats the input as wikitext, which should be safe in either case.
$displayTitle = isset( $this->mParserOutput ) ? $this->mParserOutput->getDisplayTitle() : false;
if ( $displayTitle === false ) {
$displayTitle = $contextTitle->getPrefixedText();
$displayTitle = isset( $this->mParserOutput ) ? $this->mParserOutput->getDisplayTitle() : false;
if ( $displayTitle === false ) {
$displayTitle = $contextTitle->getPrefixedText();
public $mIndicators = array();
/**
public $mIndicators = array();
/**
- * @var string $mTitleText Title text of the chosen language variant
+ * @var string $mTitleText Title text of the chosen language variant, as HTML.
/**
* Override the title to be used for display
/**
* Override the title to be used for display
- * -- this is assumed to have been validated
+ *
+ * @note this is assumed to have been validated
* (check equal normalisation, etc.)
*
* (check equal normalisation, etc.)
*
+ * @note this is expected to be safe HTML,
+ * ready to be served to the client.
+ *
* @param string $text Desired title text
*/
public function setDisplayTitle( $text ) {
* @param string $text Desired title text
*/
public function setDisplayTitle( $text ) {
- * Get the title to be used for display
+ * Get the title to be used for display.
+ *
+ * As per the contract of setDisplayTitle(), this is safe HTML,
+ * ready to be served to the client.
*/
public function getDisplayTitle() {
$t = $this->getTitleText();
*/
public function getDisplayTitle() {
$t = $this->getTitleText();