#18581867 공백 제거 옵션 추가

git-svn-id: http://xe-core.googlecode.com/svn/sandbox@7093 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
misol 2010-01-02 17:09:46 +00:00
parent 840c55e770
commit 9dfe775c0e
6 changed files with 41 additions and 5 deletions

View file

@ -14,7 +14,7 @@
var $cache_path = "./files/cache/optimized/";
/**
* @brief optimizer에서 캐싱파일을 저장할 곳을 찾아서 없으면
* @brief optimizer에서 캐싱파일을 저장할 곳을 찾아서 없으면
**/
function Optimizer() {
if(!is_dir($this->cache_path)) {
@ -103,7 +103,7 @@
function getOptimizedInfo($files) {
// 개별 요소들 또는 Optimizer.class.php파일이 갱신되었으면 새로 옵티마이징
$count = count($files);
$last_modified = 0;
$last_modified = filemtime(_XE_PATH_.'classes/optimizer/Optimizer.class.php');
for($i=0;$i<$count;$i++) {
$mtime = filemtime($files[$i]['file']);
if($last_modified < $mtime) $last_modified = $mtime;
@ -157,7 +157,8 @@
unset($str);
}
$str_to_write = $this->doCompressCode($str_to_write, $type);
$db_info = Context::getDBInfo();
if($db_info->use_spaceremover != N) $str_to_write = $this->doCompressCode($str_to_write, $db_info->use_spaceremover);
$file_object->write($str_to_write);
$file_object->close();
@ -251,7 +252,11 @@ if(!$cached) {
return 'url("'.$target.'")';
}
function doCompressCode($str_code, $type) {
function doCompressCode($str_code, $condition = 'Y') {
if($condition == 'N' || ($condition != 'P' && $condition != 'Y')) return $str_code;
if($condition == 'P' && ((int)date('H') < 1 || 5 < (int)date('H'))) return $str_code;
$str_code = str_replace("\r", "\n", $str_code);
$str_code = preg_replace("!^([ \t]+)!m", '', $str_code);
$str_code = preg_replace("!([ \t]+)$!m", '', $str_code);