r77943 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r77942‎ | r77943 | r77944 >
Date:01:17, 7 December 2010
Author:pdhanda
Status:ok (Comments)
Tags:
Comment:
Merged r7789 from trunk - Part of fix/workaround to bug 26163. API calls to get language links and categories as html
Modified paths:
  • /branches/priyanka-wmf-fixes/includes/api/ApiParse.php (modified) (history)

Diff [purge]

Index: branches/priyanka-wmf-fixes/includes/api/ApiParse.php
@@ -152,8 +152,18 @@
153153
154154 if ( isset( $prop['langlinks'] ) )
155155 $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+ }
156161 if ( isset( $prop['categories'] ) )
157162 $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+ }
158168 if ( isset( $prop['links'] ) )
159169 $result_array['links'] = $this->formatLinks( $p_result->getLinks() );
160170 if ( isset( $prop['templates'] ) )
@@ -220,6 +230,20 @@
221231 return $result;
222232 }
223233
 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+
224248 private function formatLinks( $links ) {
225249 $result = array();
226250 foreach ( $links as $ns => $nslinks ) {
@@ -269,7 +293,9 @@
270294 ApiBase :: PARAM_TYPE => array(
271295 'text',
272296 'langlinks',
 297+ 'languageshtml',
273298 'categories',
 299+ 'categorieshtml',
274300 'links',
275301 'templates',
276302 'images',

Follow-up revisions

RevisionCommit summaryAuthorDate
r77944Merged r77897 and r77930 from trunk - Part of fix/workaround to bug 26163 ...pdhanda01:21, 7 December 2010

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r7789support remote logging over a TCP connectionkateturner20:22, 20 March 2005
r77516Fixes bug 26163 - Missing categories and iw links on diff pages.pdhanda00:12, 1 December 2010
r77896Part of fix/workaround to bug 26163. API calls to get language links and cat...pdhanda18:31, 6 December 2010
r77897Part of fix/workaround to bug 26163. Get the categories and languagelinks as...pdhanda19:47, 6 December 2010

Comments

#Comment by Pdhanda (talk | contribs)   23:53, 13 December 2010

correction: Merged r77896 from trunk

Status & tagging log