mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-07 02:31:40 +09:00
템플릿 문법 중 attr에 대한 조건물이 여러개 있을때 생기는 path 오류 수정
git-svn-id: http://xe-core.googlecode.com/svn/sandbox@7957 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
d659e16f77
commit
2709f387e4
1 changed files with 13 additions and 10 deletions
|
|
@ -229,17 +229,20 @@
|
|||
**/
|
||||
function _replacePath($matches)
|
||||
{
|
||||
$path = trim($matches[3]);
|
||||
|
||||
if(substr($path,0,1)=='/' || substr($path,0,1)=='{' || strpos($path,'://')!==false) return $matches[0];
|
||||
|
||||
if(substr($path,0,2)=='./') $path = substr($path,2);
|
||||
$target = $this->web_path.$path;
|
||||
while(strpos($target,'/../')!==false)
|
||||
{
|
||||
$target = preg_replace('/\/([^\/]+)\/\.\.\//','/',$target);
|
||||
preg_match_all('/src="([^"]*?)"/is', $matches[0], $m);
|
||||
for($i=0,$c=count($m[0]);$i<$c;$i++) {
|
||||
$path = trim($m[1][$i]);
|
||||
if(substr($path,0,1)=='/' || substr($path,0,1)=='{' || strpos($path,'://')!==false) continue;
|
||||
if(substr($path,0,2)=='./') $path = substr($path,2);
|
||||
$target = $this->web_path.$path;
|
||||
while(strpos($target,'/../')!==false)
|
||||
{
|
||||
$target = preg_replace('/\/([^\/]+)\/\.\.\//','/',$target);
|
||||
}
|
||||
$target = str_replace('/./','/',$target);
|
||||
$matches[0] = str_replace($m[0][$i], 'src="'.$target.'"', $matches[0]);
|
||||
}
|
||||
return '<'.$matches[1].$matches[2].'src="'.$target.'"';
|
||||
return $matches[0];
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue