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( oxUtils::getInstance()->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
00097
00098 $aVersion = explode('.', $sVersion);
00099 $sMajorVersion = reset($aVersion);
00100
00101
00102 $sOutput = str_ireplace("</head>", "</head>\n <!-- OXID eShop {$sEdition}, Version {$sMajorVersion}, Shopping Cart System (c) OXID eSales AG 2003 - {$sCurYear} - http://www.oxid-esales.com -->", ltrim($sOutput));
00103
00104 return $sOutput;
00105 }
00106
00116 public function processViewArray($aViewData, $sClassName)
00117 {
00118 return $aViewData;
00119 }
00120
00128 public function processEmail( & $oEmail)
00129 {
00130
00131
00132
00133 }
00134
00135
00143 public function setCharset($sCharset)
00144 {
00145 $this->_sCharset = $sCharset;
00146 }
00147
00155 public function setOutputFormat($sFormat)
00156 {
00157 $this->_sOutputFormat = $sFormat;
00158 }
00159
00168 public function output($sName, $output)
00169 {
00170 switch ($this->_sOutputFormat) {
00171 case self::OUTPUT_FORMAT_JSON:
00172 $this->_aBuffer[$sName] = $output;
00173 break;
00174 case self::OUTPUT_FORMAT_HTML:
00175 default:
00176 echo $output;
00177 break;
00178 }
00179 }
00180
00186 public function flushOutput()
00187 {
00188 switch ($this->_sOutputFormat) {
00189 case self::OUTPUT_FORMAT_JSON:
00190 echo getStr()->jsonEncode($this->_aBuffer);
00191 break;
00192 case self::OUTPUT_FORMAT_HTML:
00193 default:
00194 break;
00195 }
00196 }
00197
00203 public function sendHeaders()
00204 {
00205 switch ($this->_sOutputFormat) {
00206 case self::OUTPUT_FORMAT_JSON:
00207 oxUtils::getInstance()->setHeader( "Content-Type: application/json; charset=".$this->_sCharset );
00208 break;
00209 case self::OUTPUT_FORMAT_HTML:
00210 default:
00211 oxUtils::getInstance()->setHeader( "Content-Type: text/html; charset=".$this->_sCharset );
00212 break;
00213 }
00214 }
00215 }