X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fapi%2FApiFormatJson.php;h=966e82dc6aaed240b05159467e4fdb161d46adf4;hb=6d9946294737f21d939c1addf81496ed679beb24;hp=6c5ad38e556259c022956ab30bee6ec305949d54;hpb=b74456fca841445a1c9f356fc8e53551eea14dd4;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/api/ApiFormatJson.php b/includes/api/ApiFormatJson.php index 6c5ad38e55..966e82dc6a 100644 --- a/includes/api/ApiFormatJson.php +++ b/includes/api/ApiFormatJson.php @@ -51,7 +51,11 @@ class ApiFormatJson extends ApiFormatBase { return $this->mIsRaw; } + /** + * @deprecated since 1.25 + */ public function getWantsHelp() { + wfDeprecated( __METHOD__, '1.25' ); // Help is always ugly in JSON return false; } @@ -63,6 +67,16 @@ class ApiFormatJson extends ApiFormatBase { $this->getIsHtml(), $params['utf8'] ? FormatJson::ALL_OK : FormatJson::XMLMETA_OK ); + + // Bug 66776: 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 ) ) { + $json = preg_replace( + '/\<(\s*cross-domain-policy\s*)\>/i', '\\u003C$1\\u003E', $json + ); + } + $callback = $params['callback']; if ( $callback !== null ) { $callback = preg_replace( "/[^][.\\'\\\"_A-Za-z0-9]/", '', $callback ); @@ -76,25 +90,13 @@ class ApiFormatJson extends ApiFormatBase { public function getAllowedParams() { return array( - 'callback' => null, - 'utf8' => false, + 'callback' => array( + ApiBase::PARAM_HELP_MSG => 'apihelp-json-param-callback', + ), + 'utf8' => array( + ApiBase::PARAM_DFLT => false, + ApiBase::PARAM_HELP_MSG => 'apihelp-json-param-utf8', + ), ); } - - public function getParamDescription() { - return array( - 'callback' => 'If specified, wraps the output into a given function ' . - 'call. For safety, all user-specific data will be restricted.', - 'utf8' => 'If specified, encodes most (but not all) non-ASCII ' . - 'characters as UTF-8 instead of replacing them with hexadecimal escape sequences.', - ); - } - - public function getDescription() { - if ( $this->mIsRaw ) { - return 'Output data with the debugging elements in JSON format' . parent::getDescription(); - } - - return 'Output data in JSON format' . parent::getDescription(); - } }