diff options
author | Pierre Schmitz <pierre@archlinux.de> | 2007-01-11 19:06:07 +0000 |
---|---|---|
committer | Pierre Schmitz <pierre@archlinux.de> | 2007-01-11 19:06:07 +0000 |
commit | a58285fd06c8113c45377c655dd43cef6337e815 (patch) | |
tree | dfe31d3d12652352fe44890b4811eda0728faefb /includes/api/ApiFormatJson.php | |
parent | 20194986f6638233732ba1fc3e838f117d3cc9ea (diff) |
Aktualisierung auf MediaWiki 1.9.0
Diffstat (limited to 'includes/api/ApiFormatJson.php')
-rw-r--r-- | includes/api/ApiFormatJson.php | 23 |
1 files changed, 18 insertions, 5 deletions
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 |