/**
  * Renders page-level debugging output and replaces the original view content
  * with it. Alternatively, it could inject itself into the view content.
  *
  * @param string $originalContent Original, rendered view content
  *
  * @return string Replacement rendered view content
  */
 public function renderDebugOutput($originalContent)
 {
     $this->_response->clearHeaders();
     $this->_response->setHttpResponseCode(200);
     $this->_response->setHeader('Content-Type', 'text/html; charset=UTF-8', true);
     $this->_response->setHeader('Last-Modified', gmdate('D, d M Y H:i:s') . ' GMT', true);
     return XenForo_Debug::getDebugPageWrapperHtml(XenForo_Debug::getDebugHtml());
 }
Exemplo n.º 2
0
 /**
  * Send response to browser with json content type
  */
 public function sendResponse()
 {
     $this->_response = Mage::app()->getResponse();
     //check redirect
     if ($this->_response->isRedirect()) {
         $headers = $this->_response->getHeaders();
         $redirect = '';
         foreach ($headers as $header) {
             if ("Location" == $header["name"]) {
                 $redirect = $header["value"];
                 break;
             }
         }
         if ($redirect) {
             $this->setRedirect($redirect);
         }
     }
     $this->_response->clearHeaders();
     $this->_response->setHeader('Content-Type', 'application/json');
     $this->_response->clearBody();
     $this->_response->setBody($this->toJson());
     $this->_response->sendResponse();
     exit;
 }
Exemplo n.º 3
0
 protected function _sendResponse($httpCode, $code, $message)
 {
     // TODO Why is sometimes sending response twice??? :S
     if (self::$responseSent) {
         return;
     }
     if (!($response = Zend_Controller_Front::getInstance()->getResponse())) {
         $response = new Zend_Controller_Response_Http();
     }
     $response->setHttpResponseCode($httpCode);
     if (!$response->getBody()) {
         $body = array('code' => $code, 'message' => $message);
         $response->setBody(Zend_Json::encode($body));
     }
     if ($response->canSendHeaders()) {
         $response->clearHeaders();
         $response->setHeader('Content-Type', 'application/json');
         $response->sendResponse();
         self::$responseSent = true;
     }
     exit;
 }