mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-04 01:01:41 +09:00
#109. HTML출력시 gzip compress로 출력할 수 있도록 환경 체크후 압축 출력
git-svn-id: http://xe-core.googlecode.com/svn/sandbox@2372 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
43bed51a9a
commit
d55b8ad94a
1 changed files with 11 additions and 1 deletions
|
|
@ -14,11 +14,16 @@
|
|||
|
||||
var $content_size = 0; ///< 출력하는 컨텐츠의 사이즈
|
||||
|
||||
var $gz_enabled = false; ///< gzip 압축하여 컨텐츠 호출할 것인지에 대한 flag변수
|
||||
|
||||
/**
|
||||
* @brief 모듈객체를 받아서 content 출력
|
||||
**/
|
||||
function printContent(&$oModule) {
|
||||
|
||||
// gzip encoding 지원 여부 체크
|
||||
if(strpos($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip')!==false && function_exists('ob_gzhandler') ) $this->gz_enabled = true;
|
||||
|
||||
// header 출력
|
||||
$this->_printHeader();
|
||||
|
||||
|
|
@ -86,7 +91,10 @@
|
|||
|
||||
// files로 시작되는 src나 href의 값을 절대경로로 변경
|
||||
$content = preg_replace('!(href|src)=("|\'){0,1}files!is', '\\1=\\2'.$path.'files', $content);
|
||||
print preg_replace('!(href|src)=("|\'){0,1}\.\/([a-zA-Z0-9\_^\/]+)\/!is', '\\1=\\2'.$path.'$3/', $content);
|
||||
$content = preg_replace('!(href|src)=("|\'){0,1}\.\/([a-zA-Z0-9\_^\/]+)\/!is', '\\1=\\2'.$path.'$3/', $content);
|
||||
|
||||
if($this->gz_enabled) print ob_gzhandler($content, 5);
|
||||
else print $content;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -208,6 +216,8 @@
|
|||
function _printHeader() {
|
||||
if(Context::getResponseMethod() != 'HTML') return $this->_printXMLHeader();
|
||||
else return $this->_printHTMLHeader();
|
||||
|
||||
if($this->gz_enabled) header("Content-Encoding: gzip");
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue