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
00050 if ( isset( $data['error'] ) )
00051 return $this->mErrorFallback->getMimeType();
00052
00053 if ( !isset( $data['mime'] ) )
00054 ApiBase::dieDebug( __METHOD__, "No MIME type set for raw formatter" );
00055
00056 return $data['mime'];
00057 }
00058
00059 public function execute() {
00060 $data = $this->getResultData();
00061 if ( isset( $data['error'] ) )
00062 {
00063 $this->mErrorFallback->execute();
00064 return;
00065 }
00066
00067 if ( !isset( $data['text'] ) )
00068 ApiBase::dieDebug( __METHOD__, "No text given for raw formatter" );
00069 $this->printText( $data['text'] );
00070 }
00071
00072 public function getVersion() {
00073 return __CLASS__ . ': $Id: ApiFormatRaw.php 61437 2010-01-23 22:26:40Z reedy $';
00074 }
00075 }