$args = func_get_args();
array_shift( $args );
return wfMsgReplaceArgs(
- MessageCache::singleton()->parse( wfMsgGetKey( $key, true ), null, /* can't be set to false */ true )->getText(),
+ MessageCache::singleton()->parse( wfMsgGetKey( $key, true ), $key, /* can't be set to false */ true )->getText(),
$args );
}
$messageCache = MessageCache::singleton();
if( in_array( 'parse', $options, true ) ) {
- $string = $messageCache->parse( $string, null, true, !$forContent, $langCodeObj )->getText();
+ $string = $messageCache->parse( $string, $key, true, !$forContent, $langCodeObj )->getText();
} elseif ( in_array( 'parseinline', $options, true ) ) {
- $string = $messageCache->parse( $string, null, true, !$forContent, $langCodeObj )->getText();
+ $string = $messageCache->parse( $string, $key, true, !$forContent, $langCodeObj )->getText();
$m = array();
if( preg_match( '/^<p>(.*)\n?<\/p>\n?$/sU', $string, $m ) ) {
$string = $m[1];
* @return string Wikitext parsed into HTML
*/
protected function parseText( $string ) {
- return MessageCache::singleton()->parse( $string, null, /*linestart*/true, $this->interface, $this->language )->getText();
+ return MessageCache::singleton()->parse( $string, $this->key, /*linestart*/true, $this->interface, $this->language )->getText();
}
/**
/**
* @param $text string
- * @param $title Title
+ * @param $string Title|string
* @param $interface bool
* @param $linestart bool
* @param $language
* @return ParserOutput
*/
- public function parse( $text, $title = null, $linestart = true, $interface = false, $language = null ) {
+ public function parse( $text, $key, $linestart = true, $interface = false, $language = null ) {
if ( $this->mInParser ) {
return htmlspecialchars( $text );
}
$popts->setTargetLanguage( $language );
}
+ if ( !($key instanceof Title) ) {
+ $title = Title::newFromText( $key, NS_MEDIAWIKI );
+ }
$this->mInParser = true;
$res = $parser->parse( $text, $title, $popts, $linestart );
$this->mInParser = false;