Merge "RCFilters: Add 'views' concept and a namespace view to RCFilters"
[lhc/web/wiklou.git] / includes / api / ApiFormatBase.php
index 67f54a8..36247dd 100644 (file)
@@ -186,7 +186,7 @@ abstract class ApiFormatBase extends ApiBase {
 
                $this->getMain()->getRequest()->response()->header( "Content-Type: $mime; charset=utf-8" );
 
-               // Set X-Frame-Options API results (bug 39180)
+               // Set X-Frame-Options API results (T41180)
                $apiFrameOptions = $this->getConfig()->get( 'ApiFrameOptions' );
                if ( $apiFrameOptions ) {
                        $this->getMain()->getRequest()->response()->header( "X-Frame-Options: $apiFrameOptions" );
@@ -219,7 +219,14 @@ abstract class ApiFormatBase extends ApiBase {
                        if ( !$this->getIsWrappedHtml() ) {
                                // When the format without suffix 'fm' is defined, there is a non-html version
                                if ( $this->getMain()->getModuleManager()->isDefined( $lcformat, 'format' ) ) {
-                                       $msg = $context->msg( 'api-format-prettyprint-header' )->params( $format, $lcformat );
+                                       if ( !$this->getRequest()->wasPosted() ) {
+                                               $nonHtmlUrl = strtok( $this->getRequest()->getFullRequestURL(), '?' )
+                                                       . '?' . $this->getRequest()->appendQueryValue( 'format', $lcformat );
+                                               $msg = $context->msg( 'api-format-prettyprint-header-hyperlinked' )
+                                                       ->params( $format, $lcformat, $nonHtmlUrl );
+                                       } else {
+                                               $msg = $context->msg( 'api-format-prettyprint-header' )->params( $format, $lcformat );
+                                       }
                                } else {
                                        $msg = $context->msg( 'api-format-prettyprint-header-only-html' )->params( $format );
                                }
@@ -269,7 +276,7 @@ abstract class ApiFormatBase extends ApiBase {
                                        false, FormatJson::ALL_OK
                                );
 
-                               // Bug 66776: wfMangleFlashPolicy() is needed to avoid a nasty bug in
+                               // T68776: wfMangleFlashPolicy() is needed to avoid a nasty bug in
                                // Flash, but what it does isn't friendly for the API, so we need to
                                // work around it.
                                if ( preg_match( '/\<\s*cross-domain-policy\s*\>/i', $json ) ) {
@@ -330,7 +337,7 @@ abstract class ApiFormatBase extends ApiBase {
        }
 
        public function getHelpUrls() {
-               return 'https://www.mediawiki.org/wiki/API:Data_formats';
+               return 'https://www.mediawiki.org/wiki/Special:MyLanguage/API:Data_formats';
        }
 
 }