From a58285fd06c8113c45377c655dd43cef6337e815 Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Thu, 11 Jan 2007 19:06:07 +0000 Subject: Aktualisierung auf MediaWiki 1.9.0 --- includes/api/ApiFormatJson.php | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) (limited to 'includes/api/ApiFormatJson.php') diff --git a/includes/api/ApiFormatJson.php b/includes/api/ApiFormatJson.php index fdc29cf2..45c735c8 100644 --- a/includes/api/ApiFormatJson.php +++ b/includes/api/ApiFormatJson.php @@ -31,26 +31,39 @@ if (!defined('MEDIAWIKI')) { class ApiFormatJson extends ApiFormatBase { + private $mIsRaw; + public function __construct($main, $format) { parent :: __construct($main, $format); + $this->mIsRaw = ($format === 'rawfm'); } public function getMimeType() { return 'application/json'; } + public function getNeedsRawData() { + return $this->mIsRaw; + } + public function execute() { - require ('ApiFormatJson_json.php'); - $json = new Services_JSON(); - $this->printText($json->encode($this->getResultData(), true)); + if (!function_exists('json_encode') || $this->getIsHtml()) { + $json = new Services_JSON(); + $this->printText($json->encode($this->getResultData(), $this->getIsHtml())); + } else { + $this->printText(json_encode($this->getResultData())); + } } protected function getDescription() { - return 'Output data in JSON format'; + if ($this->mIsRaw) + return 'Output data with the debuging elements in JSON format' . parent :: getDescription(); + else + return 'Output data in JSON format' . parent :: getDescription(); } public function getVersion() { - return __CLASS__ . ': $Id: ApiFormatJson.php 16725 2006-10-01 21:20:55Z yurik $'; + return __CLASS__ . ': $Id: ApiFormatJson.php 17374 2006-11-03 06:53:47Z yurik $'; } } ?> \ No newline at end of file -- cgit v1.2.3-54-g00ecf