}
# 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();
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.
*/
public $mTitleText;
/**
* 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.)
*
+ * @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 ) {
}
/**
- * 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.
*
- * @return string
+ * @return string HTML
*/
public function getDisplayTitle() {
$t = $this->getTitleText();