From 195eafd6ef664c2f7a238eb553f5653fd04a246e Mon Sep 17 00:00:00 2001 From: Alexandre Emsenhuber Date: Wed, 9 Feb 2011 15:19:45 +0000 Subject: * Add a amtitle param to meta=allmessages Only used used when amenableparser is passed; the user can now define the page used for {{PAGENAME}} and related stuff instead of being hardcoded to "API" --- includes/Message.php | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'includes/Message.php') diff --git a/includes/Message.php b/includes/Message.php index 57cee6862f72..7dd14e15c478 100644 --- a/includes/Message.php +++ b/includes/Message.php @@ -94,6 +94,11 @@ class Message { */ protected $useDatabase = true; + /** + * Title object to use as context + */ + protected $title = null; + /** * Constructor. * @param $key: message key, or array of message keys to try and use the first non-empty message for @@ -238,6 +243,17 @@ class Message { return $this; } + /** + * Set the Title object to use as context when transforming the message + * + * @param $title Title object + * @return Message: $this + */ + public function title( $title ) { + $this->title = $title; + return $this; + } + /** * Returns the message parsed from wikitext to HTML. * TODO: in PHP >= 5.2.0, we can make this a magic method, @@ -395,7 +411,7 @@ class Message { * @return Wikitext with {{-constructs replaced with their values. */ protected function transformText( $string ) { - return MessageCache::singleton()->transform( $string, $this->interface, $this->language ); + return MessageCache::singleton()->transform( $string, $this->interface, $this->language, $this->title ); } /** -- cgit v1.2.3