url()나 url("")로 css에 작성한 경우 경로를 제대로 변환하지 못하는 문제해결

git-svn-id: http://xe-core.googlecode.com/svn/sandbox@2678 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
venister 2007-10-04 09:01:05 +00:00
parent 7cc9aafb2b
commit 86e08b2039

View file

@ -131,7 +131,7 @@ EndOfBuff;
**/
function replaceCssPath($file, $str) {
$this->tmp_css_path = Context::getRequestUri().ereg_replace("^\.\/","",dirname($file))."/";
$str = preg_replace_callback('!url\(("|\'){0,1}([^\)]+)("|\'){0,1}\)!is', array($this, '_replaceCssPath'), $str);
$str = preg_replace_callback('!url\(("|\')?([^\)]+)("|\')?\)!is', array($this, '_replaceCssPath'), $str);
$str = preg_replace('!\/([^\/]*)\/\.\.\/!is','/', $str);
@ -141,7 +141,7 @@ EndOfBuff;
function _replaceCssPath($matches) {
if(eregi("^http",$matches[2])) return $matches[0];
if(eregi("^\.\/common\/",$matches[2])) return $matches[0];
return sprintf('url(%s)', $this->tmp_css_path.$matches[2]);
return sprintf('url(%s%s)', $matches[1], $this->tmp_css_path.$matches[2]);
}
}