Index: trunk/phase3/includes/api/ApiParse.php |
— | — | @@ -219,9 +219,19 @@ |
220 | 220 | if ( isset( $prop['langlinks'] ) ) { |
221 | 221 | $result_array['langlinks'] = $this->formatLangLinks( $p_result->getLanguageLinks() ); |
222 | 222 | } |
| 223 | + if ( isset( $prop['languageshtml'] ) ) { |
| 224 | + $languagesHtml = $this->languagesHtml( $p_result->getLanguageLinks() ); |
| 225 | + $result_array['languageshtml'] = array(); |
| 226 | + $result->setContent( $result_array['languageshtml'], $languagesHtml ); |
| 227 | + } |
223 | 228 | if ( isset( $prop['categories'] ) ) { |
224 | 229 | $result_array['categories'] = $this->formatCategoryLinks( $p_result->getCategories() ); |
225 | 230 | } |
| 231 | + if ( isset( $prop['categorieshtml'] ) ) { |
| 232 | + $categoriesHtml = $this->categoriesHtml( $p_result->getCategories() ); |
| 233 | + $result_array['categorieshtml'] = array(); |
| 234 | + $result->setContent( $result_array['categorieshtml'], $categoriesHtml ); |
| 235 | + } |
226 | 236 | if ( isset( $prop['links'] ) ) { |
227 | 237 | $result_array['links'] = $this->formatLinks( $p_result->getLinks() ); |
228 | 238 | } |
— | — | @@ -326,6 +336,20 @@ |
327 | 337 | return $result; |
328 | 338 | } |
329 | 339 | |
| 340 | + private function categoriesHtml( $categories ) { |
| 341 | + global $wgOut, $wgUser; |
| 342 | + $wgOut->addCategoryLinks( $categories ); |
| 343 | + $sk = $wgUser->getSkin(); |
| 344 | + return $sk->getCategories(); |
| 345 | + } |
| 346 | + |
| 347 | + private function languagesHtml( $languages ) { |
| 348 | + global $wgOut, $wgUser; |
| 349 | + $wgOut->setLanguageLinks( $languages ); |
| 350 | + $sk = $wgUser->getSkin(); |
| 351 | + return $sk->otherLanguages(); |
| 352 | + } |
| 353 | + |
330 | 354 | private function formatLinks( $links ) { |
331 | 355 | $result = array(); |
332 | 356 | foreach ( $links as $ns => $nslinks ) { |
— | — | @@ -408,7 +432,9 @@ |
409 | 433 | ApiBase::PARAM_TYPE => array( |
410 | 434 | 'text', |
411 | 435 | 'langlinks', |
| 436 | + 'languageshtml', |
412 | 437 | 'categories', |
| 438 | + 'categorieshtml', |
413 | 439 | 'links', |
414 | 440 | 'templates', |
415 | 441 | 'images', |
— | — | @@ -444,6 +470,8 @@ |
445 | 471 | ' text - Gives the parsed text of the wikitext', |
446 | 472 | ' langlinks - Gives the langlinks the parsed wikitext', |
447 | 473 | ' categories - Gives the categories of the parsed wikitext', |
| 474 | + ' categorieshtml - Gives the html version of the categories', |
| 475 | + ' languageshtml - Gives the html version of the languagelinks', |
448 | 476 | ' links - Gives the internal links in the parsed wikitext', |
449 | 477 | ' templates - Gives the templates in the parsed wikitext', |
450 | 478 | ' images - Gives the images in the parsed wikitext', |