Go to the documentation of this file.00001 <?php
00002
00007 class oxOutput extends oxSuperCfg
00008 {
00009 const OUTPUT_FORMAT_HTML = 'html';
00010 const OUTPUT_FORMAT_JSON = 'json';
00011
00017 protected $_blSearchEngine = false;
00018
00024 protected $_sCharset = null;
00025
00031 protected $_sOutputFormat = self::OUTPUT_FORMAT_HTML;
00032
00038 protected $_aBuffer = array();
00039
00045 public function __construct()
00046 {
00047 $this->setIsSearchEngine( oxRegistry::getUtils()->isSearchEngine() );
00048 }
00049
00057 public function setIsSearchEngine( $blOn )
00058 {
00059 $this->_blSearchEngine = $blOn;
00060 }
00061
00071 public function process( $sValue, $sClassName )
00072 {
00073 $myConfig = $this->getConfig();
00074
00075
00076 if ( !$myConfig->getConfigParam( 'blSkipEuroReplace' ) && !$myConfig->isUtf() ) {
00077 $sValue = str_replace( '�', '€', $sValue );
00078 }
00079
00080 return $sValue;
00081 }
00082
00090 final public function addVersionTags( $sOutput )
00091 {
00092
00093 $sVersion = $this->getConfig()->getVersion();
00094 $sEdition = $this->getConfig()->getFullEdition();
00095 $sCurYear = date("Y");
00096 $sShopMode = "";
00097
00098
00099 $aVersion = explode('.', $sVersion);
00100 $sMajorVersion = reset($aVersion);
00101
00102
00103
00104 $sSearch = "</head>";
00105 $sReplace = "</head>\n <!-- OXID eShop {$sEdition}, Version {$sMajorVersion}{$sShopMode}, Shopping Cart System (c) OXID eSales AG 2003 - {$sCurYear} - http://www.oxid-esales.com -->";
00106
00107 $sOutput = ltrim($sOutput);
00108 if ( ($pos = stripos( $sOutput, $sSearch )) !== false) {
00109 $sOutput = substr_replace($sOutput, $sReplace, $pos, strlen($sSearch));
00110 }
00111
00112 return $sOutput;
00113 }
00114
00124 public function processViewArray($aViewData, $sClassName)
00125 {
00126 return $aViewData;
00127 }
00128
00136 public function processEmail( & $oEmail)
00137 {
00138
00139
00140
00141 }
00142
00143
00151 public function setCharset($sCharset)
00152 {
00153 $this->_sCharset = $sCharset;
00154 }
00155
00163 public function setOutputFormat($sFormat)
00164 {
00165 $this->_sOutputFormat = $sFormat;
00166 }
00167
00176 public function output($sName, $output)
00177 {
00178 switch ($this->_sOutputFormat) {
00179 case self::OUTPUT_FORMAT_JSON:
00180 $this->_aBuffer[$sName] = $output;
00181 break;
00182 case self::OUTPUT_FORMAT_HTML:
00183 default:
00184 echo $output;
00185 break;
00186 }
00187 }
00188
00194 public function flushOutput()
00195 {
00196 switch ($this->_sOutputFormat) {
00197 case self::OUTPUT_FORMAT_JSON:
00198 echo getStr()->jsonEncode($this->_aBuffer);
00199 break;
00200 case self::OUTPUT_FORMAT_HTML:
00201 default:
00202 break;
00203 }
00204 }
00205
00211 public function sendHeaders()
00212 {
00213 switch ($this->_sOutputFormat) {
00214 case self::OUTPUT_FORMAT_JSON:
00215 oxRegistry::getUtils()->setHeader( "Content-Type: application/json; charset=".$this->_sCharset );
00216 break;
00217 case self::OUTPUT_FORMAT_HTML:
00218 default:
00219 oxRegistry::getUtils()->setHeader( "Content-Type: text/html; charset=".$this->_sCharset );
00220 break;
00221 }
00222 }
00223 }