Index: trunk/phase3/includes/api/ApiParse.php |
— | — | @@ -51,7 +51,7 @@ |
52 | 52 | } |
53 | 53 | $prop = array_flip( $params['prop'] ); |
54 | 54 | $revid = false; |
55 | | - |
| 55 | + |
56 | 56 | if ( isset( $params['section'] ) ) { |
57 | 57 | $this->section = $params['section']; |
58 | 58 | } else { |
— | — | @@ -211,6 +211,7 @@ |
212 | 212 | if ( isset( $prop['sections'] ) ) { |
213 | 213 | $result_array['sections'] = $p_result->getSections(); |
214 | 214 | } |
| 215 | + |
215 | 216 | if ( isset( $prop['displaytitle'] ) ) { |
216 | 217 | $result_array['displaytitle'] = $p_result->getDisplayTitle() ? |
217 | 218 | $p_result->getDisplayTitle() : |
— | — | @@ -238,6 +239,10 @@ |
239 | 240 | $result_array['headhtml'] = array(); |
240 | 241 | $result->setContent( $result_array['headhtml'], $out->headElement( $userSkin ) ); |
241 | 242 | } |
| 243 | + |
| 244 | + if ( isset( $prop['iwlinks'] ) ) { |
| 245 | + $result_array['iwlinks'] = $this->formatIWLinks( $p_result->getInterwikiLinks() ); |
| 246 | + } |
242 | 247 | |
243 | 248 | if ( !is_null( $oldid ) ) { |
244 | 249 | $result_array['revid'] = intval( $oldid ); |
— | — | @@ -251,6 +256,7 @@ |
252 | 257 | 'templates' => 'tl', |
253 | 258 | 'images' => 'img', |
254 | 259 | 'externallinks' => 'el', |
| 260 | + 'iwlinks' => 'iw', |
255 | 261 | 'sections' => 's', |
256 | 262 | 'headitems' => 'hi', |
257 | 263 | ); |
— | — | @@ -310,6 +316,19 @@ |
311 | 317 | return $result; |
312 | 318 | } |
313 | 319 | |
| 320 | + private function formatIWLinks( $iw ) { |
| 321 | + $result = array(); |
| 322 | + foreach ( $iw as $prefix => $titles ) { |
| 323 | + foreach ( $titles as $title => $id ) { |
| 324 | + $entry = array(); |
| 325 | + $entry['prefix'] = $prefix; |
| 326 | + $this->getResult()->setContent( $entry, Title::makeTitle( $ns, $title )->getFullText() ); |
| 327 | + $result[] = $entry; |
| 328 | + } |
| 329 | + } |
| 330 | + return $result; |
| 331 | + } |
| 332 | + |
314 | 333 | private function formatHeadItems( $headItems ) { |
315 | 334 | $result = array(); |
316 | 335 | foreach ( $headItems as $tag => $content ) { |
— | — | @@ -366,7 +385,8 @@ |
367 | 386 | 'revid', |
368 | 387 | 'displaytitle', |
369 | 388 | 'headitems', |
370 | | - 'headhtml' |
| 389 | + 'headhtml', |
| 390 | + 'iwlinks', |
371 | 391 | ) |
372 | 392 | ), |
373 | 393 | 'pst' => false, |