Localisation updates from https://translatewiki.net.
[lhc/web/wiklou.git] / includes / api / ApiFormatBase.php
index 7a08ed7..7bbd968 100644 (file)
@@ -155,28 +155,32 @@ abstract class ApiFormatBase extends ApiBase {
                        $result = $this->getBuffer();
 
                        $context = new DerivativeContext( $this->getMain() );
-                       $context->setUser( new User ); // anon to avoid caching issues
                        $context->setSkin( SkinFactory::getDefaultInstance()->makeSkin( 'apioutput' ) );
+                       $context->setTitle( SpecialPage::getTitleFor( 'ApiHelp' ) );
                        $out = new OutputPage( $context );
+                       $context->setOutput( $out );
+
                        $out->addModules( 'mediawiki.apipretty' );
                        $out->setPageTitle( $context->msg( 'api-format-title' ) );
-                       $context->setOutput( $out );
 
                        $header = $context->msg( 'api-format-prettyprint-header' )
-                          ->params( $format, strtolower( $format ) )
-                          ->parseAsBlock();
+                               ->params( $format, strtolower( $format ) )
+                               ->parseAsBlock();
                        $out->addHTML(
                                Html::rawElement( 'div', array( 'class' => 'api-pretty-header' ),
                                        ApiHelp::fixHelpLinks( $header )
                                )
                        );
 
-                       if ( wfRunHooks( 'ApiFormatHighlight', array( $context, $result, $mime, $format ) ) ) {
+                       if ( Hooks::run( 'ApiFormatHighlight', array( $context, $result, $mime, $format ) ) ) {
                                $out->addHTML(
                                        Html::element( 'pre', array( 'class' => 'api-pretty-content' ), $result )
                                );
                        }
 
+                       // API handles its own clickjacking protection.
+                       // Note, that $wgBreakFrames will still override $wgApiFrameOptions for format mode.
+                       $out->allowClickJacking();
                        $out->output();
                } else {
                        // For non-HTML output, clear all errors that might have been
@@ -203,7 +207,7 @@ abstract class ApiFormatBase extends ApiBase {
                return $this->mBuffer;
        }
 
-       public function getExamplesMessages() {
+       protected function getExamplesMessages() {
                return array(
                        'action=query&meta=siteinfo&siprop=namespaces&format=' . $this->getModuleName()
                                => array( 'apihelp-format-example-generic', $this->getFormat() )