コード例 #1
0
ファイル: View.php プロジェクト: laiello/crindigan
 /**
  * Outputs the page to the browser.
  * 
  * @todo In the future, have multiple output formats? XML, JSON, etc.
  */
 public function render()
 {
     // set the styles/css/javascript, and render to $output
     $output = $this->getLayout()->set(array('styleSheets' => $this->_styleSheets, 'inlineCss' => $this->_inlineCss, 'scriptFiles' => $this->_scriptFiles, 'inlineScript' => $this->_inlineScript, 'navigation' => $this->_navigation, 'subNavigation' => $this->_subNavigation, 'navbits' => $this->_navbits))->render();
     $gzworked = false;
     // gzip the output if we can.
     // headers can't be sent or else we won't be able to set content-encoding.
     // only gzipping if output is >1kb, make this configurable?
     if (RPG::config('usegzip') and !RPG::isRegistered('nogzip') and isset($_SERVER['HTTP_ACCEPT_ENCODING']) and strpos($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip') !== false and !headers_sent() and strlen($output) > 1024) {
         $output = $this->getGzippedText($output, $gzworked);
     }
     if (!headers_sent()) {
         // send encoding headers if gzip worked
         if ($gzworked) {
             header('Content-Encoding: gzip');
             header('Vary: Accept-Encoding', false);
         }
         header('Content-Length: ' . strlen($output));
         header('Cache-Control: private');
         header('Pragma: private');
     }
     echo $output;
 }