From: Bryan Tong Minh Date: Sat, 6 Nov 2010 15:57:15 +0000 (+0000) Subject: Follow up r75621: Use setContent and setIndexedTagName methods X-Git-Tag: 1.31.0-rc.0~34042 X-Git-Url: http://git.cyclocoop.org/%28?a=commitdiff_plain;h=c1b843b22415278008f942c03af71bcc2d9a9076;p=lhc%2Fweb%2Fwiklou.git Follow up r75621: Use setContent and setIndexedTagName methods --- diff --git a/includes/api/ApiRsd.php b/includes/api/ApiRsd.php index c0c58d170a..1274c85cfd 100644 --- a/includes/api/ApiRsd.php +++ b/includes/api/ApiRsd.php @@ -45,15 +45,9 @@ class ApiRsd extends ApiBase { $result->addValue( null, 'version', '1.0' ); $result->addValue( null, 'xmlns', 'http://archipelago.phrasewise.com/rsd' ); - $service = array( - 'engineName' => array( - '*' => 'MediaWiki' - ), - 'engineLink' => array( - '*' => 'http://www.mediawiki.org/' - ), - 'apis' => $this->formatRsdApiList() - ); + $service = array( 'apis' => $this->formatRsdApiList() ); + ApiResult::setContent( $service, 'MediaWiki', 'engineName' ); + ApiResult::setContent( $service, 'http://www.mediawiki.org/', 'engineLink' ); $result->setIndexedTagName( $service['apis'], 'api' ); @@ -138,12 +132,11 @@ class ApiRsd extends ApiBase { 'name' => $name, 'preferred' => wfBoolToStr( $name == 'MediaWiki' ), 'apiLink' => $info['apiLink'], - 'blogID' => isset( $info['blogID'] ) ? $info['blogID'] : '' + 'blogID' => isset( $info['blogID'] ) ? $info['blogID'] : '', ); + $settings = array(); if ( isset( $info['docs'] ) ) { - $data['settings']['docs'] = array( - '*' => $info['docs'], - ); + ApiResult::setContent( $settings, $info['docs'], 'docs' ); } if ( isset( $info['settings'] ) ) { foreach ( $info['settings'] as $setting => $val ) { @@ -152,14 +145,14 @@ class ApiRsd extends ApiBase { } else { $xmlVal = $val; } - $data['settings'][] = array( - 'name' => $setting, - '*' => $xmlVal, - ); + $setting = array( 'name' => $setting ); + ApiResult::setContent( $setting, $xmlVal ); + $settings[] = $setting; } } - if ( isset( $data['settings'] ) ) { - $data['settings']['_element'] = 'setting'; + if ( count( $settings ) ) { + $this->getResult()->setIndexedTagName( $settings, 'setting' ); + $data['settings'] = $settings; } $outputData[] = $data; }