Optimizer 사용시 특정 서버마다 배경 이미지등이 나타나지 않는 문제 해결

git-svn-id: http://xe-core.googlecode.com/svn/sandbox@3732 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
zero 2008-02-20 03:24:47 +00:00
parent aba0dbe595
commit 472b39b70c
2 changed files with 7 additions and 5 deletions

View file

@ -379,6 +379,7 @@
if($val && iconv($charset,$charset,$val)!=$val) $flag = false;
}
if($flag == true) {
if($charset == 'UTF-8') return $obj;
foreach($obj as $key => $val) $obj->{$key} = iconv($charset,'UTF-8',$val);
return $obj;
}

View file

@ -178,11 +178,10 @@ if(!$cached) {
**/
function replaceCssPath($file, $str) {
// css 파일의 위치를 구함
$this->tmp_css_path = './'.preg_replace("/^\.\//is","",dirname($file))."/";
$this->tmp_css_path = preg_replace("/^\.\//is","",dirname($file))."/";
// url() 로 되어 있는 css 파일의 경로를 변경
$str = preg_replace_callback('!url\(("|\')?([^\)]+)("|\')?\)!is', array($this, '_replaceCssPath'), $str);
$str = preg_replace('!\/([^\/]*)\/\.\.\/!is','/', $str);
$str = preg_replace_callback('/url\(([^\)]*)\)/is', array($this, '_replaceCssPath'), $str);
// charset 지정 문구를 제거
$str = preg_replace('!@charset([^;]*?);!is','',$str);
@ -191,8 +190,10 @@ if(!$cached) {
}
function _replaceCssPath($matches) {
if(preg_match("/^(http|\/|\.\/common\/)/is",$matches[2])) return $matches[0];
return sprintf('url(%s%s)', $matches[1], $this->tmp_css_path.$matches[2]);
$path = str_replace(array('"',"'"),'',$matches[1]);
if(preg_match('/^http/i', $path) || preg_match('/\.htc$/i',$path) ) return $matches[0];
return 'url("../../../../'.$this->tmp_css_path.$path.'")';
}
}