MediaWiki
REL1_24
|
00001 <?php 00031 class ApiFormatRaw extends ApiFormatBase { 00032 00037 public function __construct( ApiMain $main, ApiFormatBase $errorFallback ) { 00038 parent::__construct( $main, 'raw' ); 00039 $this->mErrorFallback = $errorFallback; 00040 } 00041 00042 public function getMimeType() { 00043 $data = $this->getResultData(); 00044 00045 if ( isset( $data['error'] ) ) { 00046 return $this->mErrorFallback->getMimeType(); 00047 } 00048 00049 if ( !isset( $data['mime'] ) ) { 00050 ApiBase::dieDebug( __METHOD__, 'No MIME type set for raw formatter' ); 00051 } 00052 00053 return $data['mime']; 00054 } 00055 00056 public function execute() { 00057 $data = $this->getResultData(); 00058 if ( isset( $data['error'] ) ) { 00059 $this->mErrorFallback->execute(); 00060 00061 return; 00062 } 00063 00064 if ( !isset( $data['text'] ) ) { 00065 ApiBase::dieDebug( __METHOD__, 'No text given for raw formatter' ); 00066 } 00067 $this->printText( $data['text'] ); 00068 } 00069 }