mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-05-22 05:15:29 +09:00
TemplateHandler에서 치환시 PHP함수나 클래스의 method가 아님에도 무조건 변환을 하여 php syntax 오류가 생기는 것을 수정
git-svn-id: http://xe-core.googlecode.com/svn/sandbox@6299 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
1b4c6c3b6f
commit
57ec3dc213
1 changed files with 20 additions and 2 deletions
|
|
@ -138,11 +138,29 @@
|
||||||
**/
|
**/
|
||||||
function _compileVarToContext($matches) {
|
function _compileVarToContext($matches) {
|
||||||
$str = trim(substr($matches[0],1,strlen($matches[0])-2));
|
$str = trim(substr($matches[0],1,strlen($matches[0])-2));
|
||||||
return '<?php print('.preg_replace('/\$([a-zA-Z0-9\_\-\>]+)/i','$__Context->\\1', $str).');?>';
|
if(!$str) return $matches[0];
|
||||||
|
if(!in_array(substr($str,0,1),array('(','$'))) {
|
||||||
|
if(preg_match('/^([^\( \.]+)(\(| \.)/i',$str,$m)) {
|
||||||
|
$func = trim(strtolower($m[1]));
|
||||||
|
if(strpos($func,'::')===false) {
|
||||||
|
if(!function_exists($func)) {
|
||||||
|
return $matches[0];
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
list($class, $method) = explode('::',$func);
|
||||||
|
if(!class_exists($class) || !in_array($method, get_class_methods($class))) {
|
||||||
|
return $matches[0];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if(!defined($str)) return $matches[0];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return '<?php @print('.preg_replace('/\$([a-zA-Z0-9\_\-\>]+)/i','$__Context->\\1', $str).');?>';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief {$와 } 안의 $... 변수를 Context::get(...) 으로 변경
|
* @brief 이미지의 경로를 변경
|
||||||
**/
|
**/
|
||||||
function _compileImgPath($matches) {
|
function _compileImgPath($matches) {
|
||||||
static $real_path = null;
|
static $real_path = null;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue