mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-04-28 23:03:25 +09:00
#17143608 외부페이지에서 css, js에 대해서 상대 또는 절대경로로 import 문법을 이용시에 ./files/cache/opage/경로 라는 이상한 path가 설정되는 것을 수정.
수정된 방법은 대상 외부페이지 파일의 위치로 import 구문의 경로를 바꾸어서 직접 호출되도록 수정하는 방법을 사용. git-svn-id: http://xe-core.googlecode.com/svn/sandbox@6323 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
2fab7c2b7e
commit
ca413d3c90
3 changed files with 51 additions and 32 deletions
|
|
@ -312,18 +312,14 @@
|
|||
**/
|
||||
function _compileImportCode($matches) {
|
||||
// 현재 tpl 파일의 위치를 구해서 $base_path에 저장하여 적용하려는 xml file을 찾음
|
||||
//$base_path = dirname($this->tpl_file).'/';
|
||||
$base_path = $this->tpl_path;
|
||||
$given_file = trim($matches[1]);
|
||||
if(!$given_file) return;
|
||||
if(isset($matches[3]))
|
||||
$optimized = strtolower(trim($matches[3]));
|
||||
if(isset($matches[3])) $optimized = strtolower(trim($matches[3]));
|
||||
if(!$optimized) $optimized = 'true';
|
||||
if(isset($matches[5]))
|
||||
$media = trim($matches[5]);
|
||||
if(isset($matches[5])) $media = trim($matches[5]);
|
||||
if(!$media) $media = 'all';
|
||||
if(isset($matches[7]))
|
||||
$targetie = trim($matches[7]);
|
||||
if(isset($matches[7])) $targetie = trim($matches[7]);
|
||||
if(!$targetie) $targetie = '';
|
||||
else $optimized = 'false';
|
||||
|
||||
|
|
@ -335,10 +331,11 @@
|
|||
|
||||
// load lang이 아니라면 xml, css, js파일을 읽도록 시도
|
||||
} else {
|
||||
$filename = sprintf("%s%s",$base_path, $given_file);
|
||||
if(substr($given_file,0,1)!='/') $source_filename = sprintf("%s%s",$base_path, $given_file);
|
||||
else $source_filename = $given_file;
|
||||
|
||||
// path와 파일이름을 구함
|
||||
$tmp_arr = explode("/",$filename);
|
||||
$tmp_arr = explode("/",$source_filename);
|
||||
$filename = array_pop($tmp_arr);
|
||||
|
||||
$base_path = implode("/",$tmp_arr)."/";
|
||||
|
|
@ -369,18 +366,26 @@
|
|||
break;
|
||||
// css file
|
||||
case 'css' :
|
||||
$meta_file = sprintf('%s%s', $base_path, $filename);
|
||||
$output = sprintf('<?php Context::addCSSFile("%s%s", %s, "%s", "%s"); ?>', $base_path, $filename, $optimized, $media, $targetie);
|
||||
if(preg_match('/^(http|\/)/i',$source_filename)) {
|
||||
$output = sprintf('<?php Context::addCSSFile("%s", %s, "%s", "%s"); ?>', $source_filename, 'false', $media, $targetie);
|
||||
} else {
|
||||
$meta_file = sprintf('%s%s', $base_path, $filename);
|
||||
$output = sprintf('<?php Context::addCSSFile("%s%s", %s, "%s", "%s"); ?>', $base_path, $filename, $optimized, $media, $targetie);
|
||||
}
|
||||
break;
|
||||
// js file
|
||||
case 'js' :
|
||||
$meta_file = sprintf('%s%s', $base_path, $filename);
|
||||
$output = sprintf('<?php Context::addJsFile("%s%s", %s, "%s"); ?>', $base_path, $filename, $optimized, $targetie);
|
||||
if(preg_match('/^(http|\/)/i',$source_filename)) {
|
||||
$output = sprintf('<?php Context::addJsFile("%s", %s, "%s"); ?>', $source_filename, 'false', $targetie);
|
||||
} else {
|
||||
$meta_file = sprintf('%s%s', $base_path, $filename);
|
||||
$output = sprintf('<?php Context::addJsFile("%s%s", %s, "%s"); ?>', $base_path, $filename, $optimized, $targetie);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$output = '<!--Meta:'.$meta_file.'-->'.$output;
|
||||
if($meta_file) $output = '<!--Meta:'.$meta_file.'-->'.$output;
|
||||
return $output;
|
||||
}
|
||||
|
||||
|
|
@ -399,25 +404,22 @@
|
|||
**/
|
||||
function _compileUnloadCode($matches) {
|
||||
// 현재 tpl 파일의 위치를 구해서 $base_path에 저장하여 적용하려는 xml file을 찾음
|
||||
//$base_path = dirname($this->tpl_file).'/';
|
||||
$base_path = $this->tpl_path;
|
||||
$given_file = trim($matches[1]);
|
||||
if(!$given_file) return;
|
||||
if(isset($matches[3]))
|
||||
$optimized = strtolower(trim($matches[3]));
|
||||
if(isset($matches[3])) $optimized = strtolower(trim($matches[3]));
|
||||
if(!$optimized) $optimized = 'true';
|
||||
if(isset($matches[5]))
|
||||
$media = trim($matches[5]);
|
||||
if(isset($matches[5])) $media = trim($matches[5]);
|
||||
if(!$media) $media = 'all';
|
||||
if(isset($matches[7]))
|
||||
$targetie = trim($matches[7]);
|
||||
if(isset($matches[7])) $targetie = trim($matches[7]);
|
||||
if(!$targetie) $targetie = '';
|
||||
else $optimized = 'false';
|
||||
|
||||
$filename = sprintf("%s%s",$base_path, $given_file);
|
||||
if(substr($given_file,0,1)!='/') $source_filename = sprintf("%s%s",$base_path, $given_file);
|
||||
else $source_filename = $given_file;
|
||||
|
||||
// path와 파일이름을 구함
|
||||
$tmp_arr = explode("/",$filename);
|
||||
$tmp_arr = explode("/",$source_filename);
|
||||
$filename = array_pop($tmp_arr);
|
||||
|
||||
$base_path = implode("/",$tmp_arr)."/";
|
||||
|
|
@ -430,13 +432,21 @@
|
|||
switch($ext) {
|
||||
// css file
|
||||
case 'css' :
|
||||
$meta_file = sprintf('%s%s', $base_path, $filename);
|
||||
$output = sprintf('<?php Context::unloadCSSFile("%s%s", %s, "%s", "%s"); ?>', $base_path, $filename, $optimized, $media, $targetie);
|
||||
if(preg_match('/^(http|\/)/i',$source_filename)) {
|
||||
$output = sprintf('<?php Context::unloadCSSFile("%s", %s, "%s", "%s"); ?>', $source_filename, 'false', $media, $targetie);
|
||||
} else {
|
||||
$meta_file = sprintf('%s%s', $base_path, $filename);
|
||||
$output = sprintf('<?php Context::unloadCSSFile("%s%s", %s, "%s", "%s"); ?>', $base_path, $filename, $optimized, $media, $targetie);
|
||||
}
|
||||
break;
|
||||
// js file
|
||||
case 'js' :
|
||||
$meta_file = sprintf('%s%s', $base_path, $filename);
|
||||
$output = sprintf('<?php Context::unloadJsFile("%s%s", %s, "%s"); ?>', $base_path, $filename, $optimized, $targetie);
|
||||
if(preg_match('/^(http|\/)/i',$source_filename)) {
|
||||
$output = sprintf('<?php Context::unloadJsFile("%s", %s, "%s"); ?>', $source_filename, 'false', $targetie);
|
||||
} else {
|
||||
$meta_file = sprintf('%s%s', $base_path, $filename);
|
||||
$output = sprintf('<?php Context::unloadJsFile("%s%s", %s, "%s"); ?>', $base_path, $filename, $optimized, $targetie);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue