summaryrefslogtreecommitdiff
path: root/includes/api/ApiRsd.php
diff options
context:
space:
mode:
Diffstat (limited to 'includes/api/ApiRsd.php')
-rw-r--r--includes/api/ApiRsd.php44
1 files changed, 21 insertions, 23 deletions
diff --git a/includes/api/ApiRsd.php b/includes/api/ApiRsd.php
index a2771a0c..d4661125 100644
--- a/includes/api/ApiRsd.php
+++ b/includes/api/ApiRsd.php
@@ -37,12 +37,15 @@ class ApiRsd extends ApiBase {
$result->addValue( null, 'version', '1.0' );
$result->addValue( null, 'xmlns', 'http://archipelago.phrasewise.com/rsd' );
- $service = array( 'apis' => $this->formatRsdApiList() );
- ApiResult::setContent( $service, 'MediaWiki', 'engineName' );
- ApiResult::setContent( $service, 'https://www.mediawiki.org/', 'engineLink' );
- ApiResult::setContent( $service, Title::newMainPage()->getCanonicalURL(), 'homePageLink' );
+ $service = array(
+ 'apis' => $this->formatRsdApiList(),
+ 'engineName' => 'MediaWiki',
+ 'engineLink' => 'https://www.mediawiki.org/',
+ 'homePageLink' => Title::newMainPage()->getCanonicalURL(),
+ );
- $result->setIndexedTagName( $service['apis'], 'api' );
+ ApiResult::setSubelementsList( $service, array( 'engineName', 'engineLink', 'homePageLink' ) );
+ ApiResult::setIndexedTagName( $service['apis'], 'api' );
$result->addValue( null, 'service', $service );
}
@@ -51,21 +54,10 @@ class ApiRsd extends ApiBase {
return new ApiFormatXmlRsd( $this->getMain(), 'xml' );
}
- public function getAllowedParams() {
- return array();
- }
-
- public function getParamDescription() {
- return array();
- }
-
- public function getDescription() {
- return 'Export an RSD (Really Simple Discovery) schema.';
- }
-
- public function getExamples() {
+ protected function getExamplesMessages() {
return array(
- 'api.php?action=rsd'
+ 'action=rsd'
+ => 'apihelp-rsd-example-simple',
);
}
@@ -110,7 +102,7 @@ class ApiRsd extends ApiBase {
)
),
);
- wfRunHooks( 'ApiRsdServiceApis', array( &$apis ) );
+ Hooks::run( 'ApiRsdServiceApis', array( &$apis ) );
return $apis;
}
@@ -134,7 +126,8 @@ class ApiRsd extends ApiBase {
);
$settings = array();
if ( isset( $info['docs'] ) ) {
- ApiResult::setContent( $settings, $info['docs'], 'docs' );
+ $settings['docs'] = $info['docs'];
+ ApiResult::setSubelementsList( $settings, 'docs' );
}
if ( isset( $info['settings'] ) ) {
foreach ( $info['settings'] as $setting => $val ) {
@@ -144,12 +137,12 @@ class ApiRsd extends ApiBase {
$xmlVal = $val;
}
$setting = array( 'name' => $setting );
- ApiResult::setContent( $setting, $xmlVal );
+ ApiResult::setContentValue( $setting, 'value', $xmlVal );
$settings[] = $setting;
}
}
if ( count( $settings ) ) {
- $this->getResult()->setIndexedTagName( $settings, 'setting' );
+ ApiResult::setIndexedTagName( $settings, 'setting' );
$data['settings'] = $settings;
}
$outputData[] = $data;
@@ -168,4 +161,9 @@ class ApiFormatXmlRsd extends ApiFormatXml {
public function getMimeType() {
return 'application/rsd+xml';
}
+
+ public static function recXmlPrint( $name, $value, $indent, $attributes = array() ) {
+ unset( $attributes['_idx'] );
+ return parent::recXmlPrint( $name, $value, $indent, $attributes );
+ }
}