getGroupName(); } if (!isset($this->_content[$groupName])) { $this->_content[$groupName] = array(); } array_unshift($this->_content[$groupName], new Qs_Doc_Item($item)); return $this; } public function response($code, $message = null) { $response = $message; if ($message && !Qs_Request::isXmlHttpRequest()) { $item = array( 'message' => $message, ); $this->assign('item', new Qs_Doc_Item($item)); $this->setLayoutTemplate('clean.tpl'); $this->sendHeaders(); $response = $this->fetch(); } Qs_Http::response($code, $response); } public function displayJson($data) { header('Cache-Control: no-store, no-cache, must-revalidate, private'); header('Pragma: no-cache'); header('Content-Type: application/x-javascript; charset=utf-8'); $json = json_encode($data); if ($this->_getCompressJson()) { header('Content-Encoding: gzip'); $json = gzencode($json, 9); } die($json); } protected function _getCompressJson() { if (null === $this->_compressJson) { if (strpos(Qs_Request::getHeader('ACCEPT-ENCODING'), 'gzip') === false) { $this->_setCompressJson(false); } else { $this->_setCompressJson(true); } } return $this->_compressJson; } protected function _setCompressJson($flag) { $this->_compressJson = (bool) $flag; return $this; } }