Index: branches/unlabeled/unlabeled-1.155.2/core/kernel/application.php =================================================================== diff -u -N -r5506 -r5629 --- branches/unlabeled/unlabeled-1.155.2/core/kernel/application.php (.../application.php) (revision 5506) +++ branches/unlabeled/unlabeled-1.155.2/core/kernel/application.php (.../application.php) (revision 5629) @@ -189,6 +189,8 @@ { if($this->InitDone) return false; + ob_start(); // collect any output from method (other then tags) into buffer + if(defined('DEBUG_MODE') && $this->isDebugMode() && constOn('DBG_PROFILE_MEMORY')) { $this->Debugger->appendMemoryUsage('Application before Init:'); } @@ -258,7 +260,12 @@ $this->HandleEvent( new kEvent('visits:OnRegisterVisit') ); $this->ValidateLogin(); - + + if ($this->UseOutputCompression()) { + header('Content-Encoding: gzip'); + safeDefine('DBG_COMPRESS_OUTPUT', 1); + } + if($this->isDebugMode()) { $this->Debugger->profileFinish('kernel4_startup'); } @@ -676,8 +683,14 @@ } //eval("?".">".$this->HTML); - - echo $this->HTML; + + $this->HTML = ob_get_clean().$this->HTML; + if ($this->isDebugMode()) { + $this->HTML .= $this->Debugger->printReport(true); + } + + echo $this->UseOutputCompression() ? gzencode($this->HTML) : $this->HTML; + $this->UpdateCache(); flush(); @@ -695,6 +708,17 @@ //$this->SaveBlocksCache(); } + /** + * Checks if output compression options is available + * + * @return string + */ + function UseOutputCompression() + { +// return false; + return $this->ConfigValue('UseOutputCompression') && function_exists('gzencode') && strstr($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip'); + } + function SaveBlocksCache() { /*if (constOn('EXPERIMENTAL_PRE_PARSE')) {