summaryrefslogtreecommitdiff
path: root/includes/content/MessageContent.php
diff options
context:
space:
mode:
Diffstat (limited to 'includes/content/MessageContent.php')
-rw-r--r--includes/content/MessageContent.php54
1 files changed, 35 insertions, 19 deletions
diff --git a/includes/content/MessageContent.php b/includes/content/MessageContent.php
index b36b670c..5b84657f 100644
--- a/includes/content/MessageContent.php
+++ b/includes/content/MessageContent.php
@@ -29,7 +29,7 @@
* Wrapper allowing us to handle a system message as a Content object.
* Note that this is generally *not* used to represent content from the
* MediaWiki namespace, and that there is no MessageContentHandler.
- * MessageContent is just intended as glue for wrapping a message programatically.
+ * MessageContent is just intended as glue for wrapping a message programmatically.
*
* @ingroup Content
*/
@@ -41,8 +41,8 @@ class MessageContent extends AbstractContent {
protected $mMessage;
/**
- * @param Message|String $msg A Message object, or a message key
- * @param array|null $params An optional array of message parameters
+ * @param Message|string $msg A Message object, or a message key.
+ * @param string[] $params An optional array of message parameters.
*/
public function __construct( $msg, $params = null ) {
# XXX: messages may be wikitext, html or plain text! and maybe even something else entirely.
@@ -60,18 +60,18 @@ class MessageContent extends AbstractContent {
}
/**
- * Returns the message as rendered HTML
+ * Fully parse the text from wikitext to HTML.
*
- * @return string The message text, parsed into html
+ * @return string Parsed HTML.
*/
public function getHtml() {
return $this->mMessage->parse();
}
/**
- * Returns the message as rendered HTML
+ * Returns the message text. {{-transformation is done.
*
- * @return string The message text, parsed into html
+ * @return string Unescaped message text.
*/
public function getWikitext() {
return $this->mMessage->text();
@@ -88,6 +88,8 @@ class MessageContent extends AbstractContent {
}
/**
+ * @return string
+ *
* @see Content::getTextForSearchIndex
*/
public function getTextForSearchIndex() {
@@ -95,6 +97,8 @@ class MessageContent extends AbstractContent {
}
/**
+ * @return string
+ *
* @see Content::getWikitextForTransclusion
*/
public function getWikitextForTransclusion() {
@@ -102,6 +106,10 @@ class MessageContent extends AbstractContent {
}
/**
+ * @param int $maxlength Maximum length of the summary text, defaults to 250.
+ *
+ * @return string The summary text.
+ *
* @see Content::getTextForSummary
*/
public function getTextForSummary( $maxlength = 250 ) {
@@ -109,18 +117,18 @@ class MessageContent extends AbstractContent {
}
/**
- * @see Content::getSize
- *
* @return int
+ *
+ * @see Content::getSize
*/
public function getSize() {
return strlen( $this->mMessage->plain() );
}
/**
- * @see Content::copy
+ * @return Content A copy of this object
*
- * @return Content. A copy of this object
+ * @see Content::copy
*/
public function copy() {
// MessageContent is immutable (because getNativeData() returns a clone of the Message object)
@@ -128,24 +136,28 @@ class MessageContent extends AbstractContent {
}
/**
- * @see Content::isCountable
+ * @param bool $hasLinks
+ *
+ * @return bool Always false.
*
- * @return bool false
+ * @see Content::isCountable
*/
public function isCountable( $hasLinks = null ) {
return false;
}
/**
- * @see Content::getParserOutput
+ * @param Title $title Unused.
+ * @param int $revId Unused.
+ * @param ParserOptions $options Unused.
+ * @param bool $generateHtml Whether to generate HTML (default: true).
*
* @return ParserOutput
+ *
+ * @see Content::getParserOutput
*/
- public function getParserOutput(
- Title $title, $revId = null,
- ParserOptions $options = null, $generateHtml = true
- ) {
-
+ public function getParserOutput( Title $title, $revId = null,
+ ParserOptions $options = null, $generateHtml = true ) {
if ( $generateHtml ) {
$html = $this->getHtml();
} else {
@@ -153,6 +165,10 @@ class MessageContent extends AbstractContent {
}
$po = new ParserOutput( $html );
+ // Message objects are in the user language.
+ $po->recordOption( 'userlang' );
+
return $po;
}
+
}