Make API documentation links language aware
[lhc/web/wiklou.git] / includes / api / ApiRsd.php
index d466112..fdc62a8 100644 (file)
@@ -37,14 +37,14 @@ class ApiRsd extends ApiBase {
                $result->addValue( null, 'version', '1.0' );
                $result->addValue( null, 'xmlns', 'http://archipelago.phrasewise.com/rsd' );
 
-               $service = array(
+               $service = [
                        'apis' => $this->formatRsdApiList(),
                        'engineName' => 'MediaWiki',
                        'engineLink' => 'https://www.mediawiki.org/',
                        'homePageLink' => Title::newMainPage()->getCanonicalURL(),
-               );
+               ];
 
-               ApiResult::setSubelementsList( $service, array( 'engineName', 'engineLink', 'homePageLink' ) );
+               ApiResult::setSubelementsList( $service, [ 'engineName', 'engineLink', 'homePageLink' ] );
                ApiResult::setIndexedTagName( $service['apis'], 'api' );
 
                $result->addValue( null, 'service', $service );
@@ -55,10 +55,10 @@ class ApiRsd extends ApiBase {
        }
 
        protected function getExamplesMessages() {
-               return array(
+               return [
                        'action=rsd'
                                => 'apihelp-rsd-example-simple',
-               );
+               ];
        }
 
        public function isReadMode() {
@@ -75,7 +75,7 @@ class ApiRsd extends ApiBase {
         * compatible APIs, by hooking 'ApiRsdServiceApis' and adding more
         * elements to the array.
         *
-        * See http://cyber.law.harvard.edu/blogs/gems/tech/rsd.html for
+        * See https://cyber.harvard.edu/blogs/gems/tech/rsd.html for
         * the base RSD spec, and check WordPress and StatusNet sites for
         * in-production examples listing several blogging and micrblogging
         * APIs.
@@ -83,26 +83,26 @@ class ApiRsd extends ApiBase {
         * @return array
         */
        protected function getRsdApiList() {
-               $apis = array(
-                       'MediaWiki' => array(
+               $apis = [
+                       'MediaWiki' => [
                                // The API link is required for all RSD API entries.
                                'apiLink' => wfExpandUrl( wfScript( 'api' ), PROTO_CURRENT ),
 
                                // Docs link is optional, but recommended.
-                               'docs' => 'https://www.mediawiki.org/wiki/API',
+                               'docs' => 'https://www.mediawiki.org/wiki/Special:MyLanguage/API',
 
                                // Some APIs may need a blog ID, but it may be left blank.
                                'blogID' => '',
 
                                // Additional settings are optional.
-                               'settings' => array(
+                               'settings' => [
                                        // Change this to true in the future as an aid to
                                        // machine discovery of OAuth for API access.
                                        'OAuth' => false,
-                               )
-                       ),
-               );
-               Hooks::run( 'ApiRsdServiceApis', array( &$apis ) );
+                               ]
+                       ],
+               ];
+               Hooks::run( 'ApiRsdServiceApis', [ &$apis ] );
 
                return $apis;
        }
@@ -116,15 +116,15 @@ class ApiRsd extends ApiBase {
        protected function formatRsdApiList() {
                $apis = $this->getRsdApiList();
 
-               $outputData = array();
+               $outputData = [];
                foreach ( $apis as $name => $info ) {
-                       $data = array(
+                       $data = [
                                'name' => $name,
                                'preferred' => wfBoolToStr( $name == 'MediaWiki' ),
                                'apiLink' => $info['apiLink'],
                                'blogID' => isset( $info['blogID'] ) ? $info['blogID'] : '',
-                       );
-                       $settings = array();
+                       ];
+                       $settings = [];
                        if ( isset( $info['docs'] ) ) {
                                $settings['docs'] = $info['docs'];
                                ApiResult::setSubelementsList( $settings, 'docs' );
@@ -136,7 +136,7 @@ class ApiRsd extends ApiBase {
                                        } else {
                                                $xmlVal = $val;
                                        }
-                                       $setting = array( 'name' => $setting );
+                                       $setting = [ 'name' => $setting ];
                                        ApiResult::setContentValue( $setting, 'value', $xmlVal );
                                        $settings[] = $setting;
                                }
@@ -162,7 +162,7 @@ class ApiFormatXmlRsd extends ApiFormatXml {
                return 'application/rsd+xml';
        }
 
-       public static function recXmlPrint( $name, $value, $indent, $attributes = array() ) {
+       public static function recXmlPrint( $name, $value, $indent, $attributes = [] ) {
                unset( $attributes['_idx'] );
                return parent::recXmlPrint( $name, $value, $indent, $attributes );
        }