Index: branches/priyanka-wmf-fixes/includes/api/ApiParse.php |
— | — | @@ -152,8 +152,18 @@ |
153 | 153 | |
154 | 154 | if ( isset( $prop['langlinks'] ) ) |
155 | 155 | $result_array['langlinks'] = $this->formatLangLinks( $p_result->getLanguageLinks() ); |
| 156 | + if ( isset( $prop['languageshtml'] ) ) { |
| 157 | + $languagesHtml = $this->languagesHtml( $p_result->getLanguageLinks() ); |
| 158 | + $result_array['languageshtml'] = array(); |
| 159 | + $result->setContent( $result_array['languageshtml'], $languagesHtml ); |
| 160 | + } |
156 | 161 | if ( isset( $prop['categories'] ) ) |
157 | 162 | $result_array['categories'] = $this->formatCategoryLinks( $p_result->getCategories() ); |
| 163 | + if ( isset( $prop['categorieshtml'] ) ) { |
| 164 | + $categoriesHtml = $this->categoriesHtml( $p_result->getCategories() ); |
| 165 | + $result_array['categorieshtml'] = array(); |
| 166 | + $result->setContent( $result_array['categorieshtml'], $categoriesHtml ); |
| 167 | + } |
158 | 168 | if ( isset( $prop['links'] ) ) |
159 | 169 | $result_array['links'] = $this->formatLinks( $p_result->getLinks() ); |
160 | 170 | if ( isset( $prop['templates'] ) ) |
— | — | @@ -220,6 +230,20 @@ |
221 | 231 | return $result; |
222 | 232 | } |
223 | 233 | |
| 234 | + private function categoriesHtml( $categories ) { |
| 235 | + global $wgOut, $wgUser; |
| 236 | + $wgOut->addCategoryLinks( $categories ); |
| 237 | + $sk = $wgUser->getSkin(); |
| 238 | + return $sk->getCategories(); |
| 239 | + } |
| 240 | + |
| 241 | + private function languagesHtml( $languages ) { |
| 242 | + global $wgOut, $wgUser; |
| 243 | + $wgOut->setLanguageLinks( $languages ); |
| 244 | + $sk = $wgUser->getSkin(); |
| 245 | + return $sk->otherLanguages(); |
| 246 | + } |
| 247 | + |
224 | 248 | private function formatLinks( $links ) { |
225 | 249 | $result = array(); |
226 | 250 | foreach ( $links as $ns => $nslinks ) { |
— | — | @@ -269,7 +293,9 @@ |
270 | 294 | ApiBase :: PARAM_TYPE => array( |
271 | 295 | 'text', |
272 | 296 | 'langlinks', |
| 297 | + 'languageshtml', |
273 | 298 | 'categories', |
| 299 | + 'categorieshtml', |
274 | 300 | 'links', |
275 | 301 | 'templates', |
276 | 302 | 'images', |