mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-05-12 05:22:35 +09:00
#356 switch 구문 지원 추가
git-svn-id: http://xe-core.googlecode.com/svn/sandbox@4341 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
c4fdd3fc47
commit
b0cd9370c6
1 changed files with 24 additions and 10 deletions
|
|
@ -55,13 +55,13 @@
|
||||||
|
|
||||||
// 일단 컴파일
|
// 일단 컴파일
|
||||||
$buff = $this->_compile($tpl_file, $compiled_tpl_file);
|
$buff = $this->_compile($tpl_file, $compiled_tpl_file);
|
||||||
|
|
||||||
// Context와 compiled_tpl_file로 컨텐츠 생성
|
// Context와 compiled_tpl_file로 컨텐츠 생성
|
||||||
$output = $this->_fetch($compiled_tpl_file, $buff, $tpl_path);
|
$output = $this->_fetch($compiled_tpl_file, $buff, $tpl_path);
|
||||||
|
|
||||||
if(__DEBUG__==3 ) $GLOBALS['__template_elapsed__'] += getMicroTime() - $start;
|
if(__DEBUG__==3 ) $GLOBALS['__template_elapsed__'] += getMicroTime() - $start;
|
||||||
|
|
||||||
return $output;
|
return $output;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -103,7 +103,7 @@
|
||||||
// include 변경 <!--#include($filename)-->
|
// include 변경 <!--#include($filename)-->
|
||||||
//$buff = preg_replace_callback('!<\!--#include\(([^\)]*?)\)-->!is', array($this, '_compileIncludeToCode'), $buff);
|
//$buff = preg_replace_callback('!<\!--#include\(([^\)]*?)\)-->!is', array($this, '_compileIncludeToCode'), $buff);
|
||||||
|
|
||||||
// 이미지 태그 img의 src의 값이 http:// 나 / 로 시작하지 않으면 제로보드의 root경로부터 시작하도록 변경
|
// 이미지 태그 img의 src의 값이 http:// 나 / 로 시작하지 않으면 제로보드의 root경로부터 시작하도록 변경
|
||||||
$buff = preg_replace_callback('/(img|input)([^>]*)src=[\'"]{1}(?!http)(.*?)[\'"]{1}/is', array($this, '_compileImgPath'), $buff);
|
$buff = preg_replace_callback('/(img|input)([^>]*)src=[\'"]{1}(?!http)(.*?)[\'"]{1}/is', array($this, '_compileImgPath'), $buff);
|
||||||
|
|
||||||
// 변수를 변경
|
// 변수를 변경
|
||||||
|
|
@ -176,19 +176,33 @@
|
||||||
case 'endif' :
|
case 'endif' :
|
||||||
case 'endfor' :
|
case 'endfor' :
|
||||||
case 'endforeach' :
|
case 'endforeach' :
|
||||||
|
case 'endswitch' :
|
||||||
$output = '}';
|
$output = '}';
|
||||||
break;
|
break;
|
||||||
|
case 'break' :
|
||||||
|
$output = 'break;';
|
||||||
|
break;
|
||||||
|
case 'default' :
|
||||||
|
$output = 'default :';
|
||||||
|
break;
|
||||||
default :
|
default :
|
||||||
if(substr($code,0,4)=='else') {
|
$suffix = '{';
|
||||||
|
|
||||||
|
if(substr($code, 0, 4) == 'else') {
|
||||||
$code = '}'.$code;
|
$code = '}'.$code;
|
||||||
} elseif(substr($code,0,7)=='foreach') {
|
} elseif(substr($code, 0, 7) == 'foreach') {
|
||||||
$tmp_str = substr($code,8);
|
$tmp_str = substr($code, 8);
|
||||||
$tmp_arr = explode(' ', $tmp_str);
|
$tmp_arr = explode(' ', $tmp_str);
|
||||||
$var_name = $tmp_arr[0];
|
$var_name = $tmp_arr[0];
|
||||||
if(substr($var_name,0,1)=='$') $prefix = sprintf('if(count($__Context->%s)) ', substr($var_name,1));
|
if(substr($var_name, 0, 1) == '$') {
|
||||||
else $prefix = sprintf('if(count(%s)) ', $var_name);
|
$prefix = sprintf('if(count($__Context->%s)) ', substr($var_name, 1));
|
||||||
}
|
} else {
|
||||||
$output = preg_replace('/\$([a-zA-Z0-9\_\-]+)/i','$__Context->\\1', $code).'{';
|
$prefix = sprintf('if(count(%s)) ', $var_name);
|
||||||
|
}
|
||||||
|
} elseif(substr($code, 0, 4) == 'case') {
|
||||||
|
$suffix = ':';
|
||||||
|
}
|
||||||
|
$output = preg_replace('/\$([a-zA-Z0-9\_\-]+)/i', '$__Context->\\1', $code.$suffix);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue