35 $result->addValue(
null,
'version',
'1.0' );
36 $result->addValue(
null,
'xmlns',
'http://archipelago.phrasewise.com/rsd' );
40 'engineName' =>
'MediaWiki',
41 'engineLink' =>
'https://www.mediawiki.org/',
42 'homePageLink' => Title::newMainPage()->getCanonicalURL(),
45 ApiResult::setSubelementsList( $service, [
'engineName',
'engineLink',
'homePageLink' ] );
46 ApiResult::setIndexedTagName( $service[
'apis'],
'api' );
48 $result->addValue(
null,
'service', $service );
58 =>
'apihelp-rsd-example-simple',
90 'docs' =>
'https://www.mediawiki.org/wiki/Special:MyLanguage/API',
118 foreach ( $apis as $name => $info ) {
121 'preferred' =>
wfBoolToStr( $name ==
'MediaWiki' ),
122 'apiLink' => $info[
'apiLink'],
123 'blogID' => $info[
'blogID'] ??
'',
126 if ( isset( $info[
'docs'] ) ) {
127 $settings[
'docs'] = $info[
'docs'];
128 ApiResult::setSubelementsList( $settings,
'docs' );
130 if ( isset( $info[
'settings'] ) ) {
131 foreach ( $info[
'settings'] as $setting => $val ) {
132 if ( is_bool( $val ) ) {
137 $setting = [
'name' => $setting ];
138 ApiResult::setContentValue( $setting,
'value', $xmlVal );
139 $settings[] = $setting;
142 if ( count( $settings ) ) {
143 ApiResult::setIndexedTagName( $settings,
'setting' );
144 $data[
'settings'] = $settings;
146 $outputData[] = $data;
wfExpandUrl( $url, $defaultProto=PROTO_CURRENT)
Expand a potentially local URL to a fully-qualified URL.
wfScript( $script='index')
Get the path to a specified script file, respecting file extensions; this is a wrapper around $wgScri...
wfBoolToStr( $value)
Convenience function converts boolean values into "true" or "false" (string) values.
This abstract class implements many basic API functions, and is the base of all API classes.
getMain()
Get the main module.
getResult()
Get the result object.
getHookRunner()
Get an ApiHookRunner for running core API hooks.
API module for sending out RSD information.
isReadMode()
Indicates whether this module requires read rights.
formatRsdApiList()
Formats the internal list of exposed APIs into an array suitable to pass to the API's XML formatter.
getExamplesMessages()
Returns usage examples for this module.
getRsdApiList()
Builds an internal list of APIs to expose information about.
execute()
Evaluates the parameters, performs the requested query, and sets up the result.
getCustomPrinter()
If the module may only be used with a certain format module, it should override this method to return...