* @return String: HTML
*/
public function toString() {
- $string = $this->getMessageText();
+ $string = $this->fetchMessage();
+
+ if ( $string === false ) {
+ $key = htmlspecialchars( is_array( $this->key ) ? $this->key[0] : $this->key );
+ if ( $this->format === 'plain' ) {
+ return '<' . $key . '>';
+ }
+ return '<' . $key . '>';
+ }
# Replace parameters before text parsing
$string = $this->replaceParameters( $string, 'before' );
return MessageCache::singleton()->transform( $string, $this->interface, $this->language, $this->title );
}
- /**
- * Returns the textual value for the message.
- * @return Message contents or placeholder
- */
- protected function getMessageText() {
- $message = $this->fetchMessage();
- if ( $message === false ) {
- return '<' . htmlspecialchars( is_array($this->key) ? $this->key[0] : $this->key ) . '>';
- } else {
- return $message;
- }
- }
-
/**
* Wrapper for what ever method we use to get message contents
*