diff options
author | Luke Shumaker <lukeshu@sbcglobal.net> | 2016-05-01 15:32:59 -0400 |
---|---|---|
committer | Luke Shumaker <lukeshu@sbcglobal.net> | 2016-05-01 15:32:59 -0400 |
commit | 6dc1997577fab2c366781fd7048144935afa0012 (patch) | |
tree | 8918d28c7ab4342f0738985e37af1dfc42d0e93a /includes/api/ApiFormatBase.php | |
parent | 150f94f051128f367bc89f6b7e5f57eb2a69fc62 (diff) | |
parent | fa89acd685cb09cdbe1c64cbb721ec64975bbbc1 (diff) |
Merge commit 'fa89acd'
# Conflicts:
# .gitignore
# extensions/ArchInterWiki.sql
Diffstat (limited to 'includes/api/ApiFormatBase.php')
-rw-r--r-- | includes/api/ApiFormatBase.php | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/includes/api/ApiFormatBase.php b/includes/api/ApiFormatBase.php index d078dc45..e522d709 100644 --- a/includes/api/ApiFormatBase.php +++ b/includes/api/ApiFormatBase.php @@ -173,6 +173,7 @@ abstract class ApiFormatBase extends ApiBase { $mime = $this->getMimeType(); if ( $this->getIsHtml() && $mime !== null ) { $format = $this->getFormat(); + $lcformat = strtolower( $format ); $result = $this->getBuffer(); $context = new DerivativeContext( $this->getMain() ); @@ -181,12 +182,17 @@ abstract class ApiFormatBase extends ApiBase { $out = new OutputPage( $context ); $context->setOutput( $out ); - $out->addModules( 'mediawiki.apipretty' ); + $out->addModuleStyles( 'mediawiki.apipretty' ); $out->setPageTitle( $context->msg( 'api-format-title' ) ); - $header = $context->msg( 'api-format-prettyprint-header' ) - ->params( $format, strtolower( $format ) ) - ->parseAsBlock(); + // 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 ); + } else { + $msg = $context->msg( 'api-format-prettyprint-header-only-html' )->params( $format ); + } + + $header = $msg->parseAsBlock(); $out->addHTML( Html::rawElement( 'div', array( 'class' => 'api-pretty-header' ), ApiHelp::fixHelpLinks( $header ) @@ -240,7 +246,7 @@ abstract class ApiFormatBase extends ApiBase { } /** - * To avoid code duplication with the deprecation of dbg, dump, txt, wddx, + * To avoid code duplication with the deprecation of dbg, txt * and yaml, this method is added to do the necessary work. It should be * removed when those deprecated formats are removed. */ @@ -306,7 +312,7 @@ abstract class ApiFormatBase extends ApiBase { // Escape everything first for full coverage $text = htmlspecialchars( $text ); - if ( $this->mFormat === 'XML' || $this->mFormat === 'WDDX' ) { + if ( $this->mFormat === 'XML' ) { // encode all comments or tags as safe blue strings $text = str_replace( '<', '<span style="color:blue;"><', $text ); $text = str_replace( '>', '></span>', $text ); @@ -381,10 +387,11 @@ abstract class ApiFormatBase extends ApiBase { * are required to ignore it or filter it out. * * @deprecated since 1.25 - * @return bool + * @return bool Always true */ public function getNeedsRawData() { - return false; + wfDeprecated( __METHOD__, '1.25' ); + return true; } /**@}*/ |