diff options
author | Alexandre Emsenhuber <ialex@users.mediawiki.org> | 2011-02-09 15:19:45 +0000 |
---|---|---|
committer | Alexandre Emsenhuber <ialex@users.mediawiki.org> | 2011-02-09 15:19:45 +0000 |
commit | 195eafd6ef664c2f7a238eb553f5653fd04a246e (patch) | |
tree | e426e28181e94107ec5373e8b779fc04e7de447e /includes/api/ApiQueryAllmessages.php | |
parent | 4abff2596654626d04a13fb3c59d1db9f8ed93cd (diff) | |
download | mediawikicore-195eafd6ef664c2f7a238eb553f5653fd04a246e.tar.gz mediawikicore-195eafd6ef664c2f7a238eb553f5653fd04a246e.zip |
* 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"
Notes
Notes:
http://mediawiki.org/wiki/Special:Code/MediaWiki/81816
Diffstat (limited to 'includes/api/ApiQueryAllmessages.php')
-rw-r--r-- | includes/api/ApiQueryAllmessages.php | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/includes/api/ApiQueryAllmessages.php b/includes/api/ApiQueryAllmessages.php index 9799c2c325c0..709f1f90012d 100644 --- a/includes/api/ApiQueryAllmessages.php +++ b/includes/api/ApiQueryAllmessages.php @@ -50,6 +50,17 @@ class ApiQueryAllmessages extends ApiQueryBase { $langObj = Language::factory( $params['lang'] ); } + if ( $params['enableparser'] ) { + if ( !is_null( $params['title'] ) ) { + $title = Title::newFromText( $params['title'] ); + if ( !$title ) { + $this->dieUsageMsg( array( 'invalidtitle', $params['title'] ) ); + } + } else { + $title = Title::newFromText( 'API' ); + } + } + $prop = array_flip( (array)$params['prop'] ); // Determine which messages should we print @@ -101,7 +112,7 @@ class ApiQueryAllmessages extends ApiQueryBase { } else { // Check if the parser is enabled: if ( $params['enableparser'] ) { - $msgString = $msg->text(); + $msgString = $msg->title( $title )->text(); } else { $msgString = $msg->plain(); } @@ -158,6 +169,7 @@ class ApiQueryAllmessages extends ApiQueryBase { 'lang' => null, 'from' => null, 'to' => null, + 'title' => null, ); } @@ -167,6 +179,7 @@ class ApiQueryAllmessages extends ApiQueryBase { 'prop' => 'Which properties to get', 'enableparser' => array( 'Set to enable parser, will preprocess the wikitext of message', 'Will substitute magic words, handle templates etc.' ), + 'title' => 'Page name to use as context when parsing message (for enableparser option)', 'args' => 'Arguments to be substituted into message', 'filter' => 'Return only messages that contain this string', 'lang' => 'Return messages in this language', |