function testTextResponse() { $objResponse = new xajaxCustomResponse('text/plain'); $objResponse->append('text data'); return $objResponse; // return text data directly to the custom response handler function return 'text data'; }
function processRequest() { if ($this->canProcessRequest()) { $aSections =& $this->_getSections($this->sRequest); // echo "<!--" . print_r($aSections, true) . "-->"; // validate the hash $sHash = md5(implode($aSections)); if (false == $this->bValidateHash || $sHash == $this->sHash) { $sType = 'text/javascript'; if ('style' == $this->sRequest) { $sType = 'text/css'; } $objResponse = new xajaxCustomResponse($sType); foreach ($aSections as $sSection) { $objResponse->append($sSection . "\n"); } $objResponseManager =& xajaxResponseManager::getInstance(); $objResponseManager->append($objResponse); header('Expires: ' . gmdate('D, d M Y H:i:s', time() + 60 * 60 * 24) . ' GMT'); return true; } return 'Invalid script or style request.'; trigger_error('Hash mismatch: ' . $this->sRequest . ': ' . $sHash . ' <==> ' . $this->sHash, E_USER_ERROR); } }