00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 if (!defined('MEDIAWIKI')) {
00027
00028 require_once ('ApiFormatBase.php');
00029 }
00030
00035 class ApiFormatRaw extends ApiFormatBase {
00036
00042 public function __construct($main, $errorFallback) {
00043 parent :: __construct($main, 'raw');
00044 $this->mErrorFallback = $errorFallback;
00045 }
00046
00047 public function getMimeType() {
00048 $data = $this->getResultData();
00049 if(isset($data['error']))
00050 return $this->mErrorFallback->getMimeType();
00051 if(!isset($data['mime']))
00052 ApiBase::dieDebug(__METHOD__, "No MIME type set for raw formatter");
00053 return $data['mime'];
00054 }
00055
00056 public function execute() {
00057 $data = $this->getResultData();
00058 if(isset($data['error']))
00059 {
00060 $this->mErrorFallback->execute();
00061 return;
00062 }
00063 if(!isset($data['text']))
00064 ApiBase::dieDebug(__METHOD__, "No text given for raw formatter");
00065 $this->printText($data['text']);
00066 }
00067
00068 public function getVersion() {
00069 return __CLASS__ . ': $Id: ApiFormatRaw.php 48629 2009-03-20 11:40:54Z catrope $';
00070 }
00071 }