mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-05-01 00:02:21 +09:00
Template Compile, CSS/JS Optimizer, 결과물 출력시 이미지등의 경로를 정상적으로 출력하도록 수정.
path/../ 의 경우 ..를 이전 Path로 이동하도록 하고 rewrite mod 사용시 주소에 따라서 동일한 리소스가 다른 url로 호출되어 트래픽 낭비가 생기는 문제 수정 git-svn-id: http://xe-core.googlecode.com/svn/sandbox@6105 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
38ea8b89ae
commit
2868b62e2b
4 changed files with 56 additions and 23 deletions
|
|
@ -71,8 +71,19 @@
|
|||
$files = $this->_getOptimizedRemoved($files);
|
||||
if(!count($files)) return $files;
|
||||
|
||||
$url_info = parse_url(Context::getRequestUri());
|
||||
$abpath = $url_info['path'];
|
||||
|
||||
foreach($files as $key => $val) {
|
||||
if(substr($val['file'],0,2)=='./') $files[$key]['file'] = Context::getRequestUri().substr($val['file'],2);
|
||||
$file = $val['file'];
|
||||
|
||||
if(substr($file,0,1)=='/' || strpos($file,'://')!==false) continue;
|
||||
if(substr($file,0,2)=='./') $file = substr($file,2);
|
||||
$file = $abpath.$file;
|
||||
while(strpos($file,'/../')!==false) {
|
||||
$file = preg_replace('/\/([^\/]+)\/\.\.\//','/',$file);
|
||||
}
|
||||
$files[$key]['file'] = $file;
|
||||
}
|
||||
return $files;
|
||||
}
|
||||
|
|
@ -222,9 +233,14 @@ if(!$cached) {
|
|||
$abpath = $url_info['path'];
|
||||
}
|
||||
$path = str_replace(array('"',"'"),'',$matches[1]);
|
||||
if(preg_match('/^http|^\//i', $path) || preg_match('/\.htc$/i',$path) ) return $matches[0];
|
||||
if(substr($path,0,1)=='/' || strpos($path,'://')!==false || strpos($path,'.htc')!==false) return 'url("'.$path.'")';
|
||||
if(substr($path,0,2)=='./') $path = substr($path,2);
|
||||
$target = $abpath.$this->tmp_css_path.$path;
|
||||
while(strpos($target,'/../')!==false) {
|
||||
$target = preg_replace('/\/([^\/]+)\/\.\.\//','/',$target);
|
||||
}
|
||||
|
||||
return 'url("'.$abpath.$this->tmp_css_path.$path.'")';
|
||||
return 'url("'.$target.'")';
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue