템플릿 문법 중 attr에 대한 조건물이 여러개 있을때 생기는 path 오류 수정

git-svn-id: http://xe-core.googlecode.com/svn/sandbox@7957 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
zero 2010-12-07 02:24:13 +00:00
parent d659e16f77
commit 2709f387e4

View file

@ -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];
}
/**