From 08aa4418c30cfc18ccc69a0f0f9cb9e17be6c196 Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Mon, 12 Aug 2013 09:28:15 +0200 Subject: Update to MediaWiki 1.21.1 --- includes/api/ApiFormatJson.php | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'includes/api/ApiFormatJson.php') diff --git a/includes/api/ApiFormatJson.php b/includes/api/ApiFormatJson.php index acbc7d3b..abb63480 100644 --- a/includes/api/ApiFormatJson.php +++ b/includes/api/ApiFormatJson.php @@ -85,13 +85,9 @@ class ApiFormatJson extends ApiFormatBase { public function getDescription() { if ( $this->mIsRaw ) { - return 'Output data with the debuging elements in JSON format' . parent::getDescription(); + return 'Output data with the debugging elements in JSON format' . parent::getDescription(); } else { return 'Output data in JSON format' . parent::getDescription(); } } - - public function getVersion() { - return __CLASS__ . ': $Id$'; - } } -- cgit v1.2.2 From 4ac9fa081a7c045f6a9f1cfc529d82423f485b2e Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Sun, 8 Dec 2013 09:55:49 +0100 Subject: Update to MediaWiki 1.22.0 --- includes/api/ApiFormatJson.php | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) (limited to 'includes/api/ApiFormatJson.php') diff --git a/includes/api/ApiFormatJson.php b/includes/api/ApiFormatJson.php index abb63480..342a580f 100644 --- a/includes/api/ApiFormatJson.php +++ b/includes/api/ApiFormatJson.php @@ -56,30 +56,32 @@ class ApiFormatJson extends ApiFormatBase { } public function execute() { - $prefix = $suffix = ''; - $params = $this->extractRequestParams(); + $json = FormatJson::encode( + $this->getResultData(), + $this->getIsHtml(), + $params['utf8'] ? FormatJson::ALL_OK : FormatJson::XMLMETA_OK + ); $callback = $params['callback']; - if ( !is_null( $callback ) ) { - $prefix = preg_replace( "/[^][.\\'\\\"_A-Za-z0-9]/", '', $callback ) . '('; - $suffix = ')'; + if ( $callback !== null ) { + $callback = preg_replace( "/[^][.\\'\\\"_A-Za-z0-9]/", '', $callback ); + $this->printText( "$callback($json)" ); + } else { + $this->printText( $json ); } - $this->printText( - $prefix . - FormatJson::encode( $this->getResultData(), $this->getIsHtml() ) . - $suffix - ); } public function getAllowedParams() { return array( - 'callback' => null, + 'callback' => null, + 'utf8' => false, ); } 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.', ); } -- cgit v1.2.2