Index: trunk/phase3/includes/api/ApiQueryAllmessages.php |
— | — | @@ -35,8 +35,8 @@ |
36 | 36 | */ |
37 | 37 | class ApiQueryAllmessages extends ApiQueryBase { |
38 | 38 | |
39 | | - public function __construct( $query, $moduleName ) { |
40 | | - parent :: __construct( $query, $moduleName, 'am' ); |
| 39 | + public function __construct( $query, $moduleName) { |
| 40 | + parent :: __construct( $query, $moduleName, 'am'); |
41 | 41 | } |
42 | 42 | |
43 | 43 | public function execute() { |
— | — | @@ -82,7 +82,20 @@ |
83 | 83 | |
84 | 84 | if ( !$skip ) { |
85 | 85 | $a = array( 'name' => $message ); |
86 | | - $msg = wfMsgGetKey( $message, true, false, false ); |
| 86 | + $args = null; |
| 87 | + if ( isset( $params['args'] ) && count( $params['args'] ) != 0 ) { |
| 88 | + $args = $params['args']; |
| 89 | + } |
| 90 | + // Check if the parser is enabled: |
| 91 | + if ( $params[ 'enableparser' ] ){ |
| 92 | + $msg = wfMsgExt( $message, array( 'parsemag' ), $args ); |
| 93 | + } else if ( $args ) { |
| 94 | + $msgString = wfMsgGetKey( $message, true, false, false ); |
| 95 | + $msg = wfMsgReplaceArgs( $msgString, $args ); |
| 96 | + } else { |
| 97 | + $msg = wfMsgGetKey( $message, true, false, false ); |
| 98 | + } |
| 99 | + |
87 | 100 | if ( wfEmptyMsg( $message, $msg ) ) |
88 | 101 | $a['missing'] = ''; |
89 | 102 | else { |
— | — | @@ -119,6 +132,10 @@ |
120 | 133 | 'default' |
121 | 134 | ) |
122 | 135 | ), |
| 136 | + 'enableparser' => false, |
| 137 | + 'args' => array( |
| 138 | + ApiBase :: PARAM_ISMULTI => true |
| 139 | + ), |
123 | 140 | 'filter' => array(), |
124 | 141 | 'lang' => null, |
125 | 142 | 'from' => null, |
— | — | @@ -129,6 +146,9 @@ |
130 | 147 | return array ( |
131 | 148 | 'messages' => 'Which messages to output. "*" means all messages', |
132 | 149 | 'prop' => 'Which properties to get', |
| 150 | + 'enableparser' => array('Set to enable parser, will parses the wikitext of message', |
| 151 | + 'Will substitute magic words, handle templates etc'), |
| 152 | + 'args' => 'Arguments to be substituted into message', |
133 | 153 | 'filter' => 'Return only messages that contain this string', |
134 | 154 | 'lang' => 'Return messages in this language', |
135 | 155 | 'from' => 'Return messages starting at this message', |