|
|
|
@ -324,9 +324,7 @@ class cls_template |
|
|
|
} |
|
|
|
}*/ |
|
|
|
//return preg_replace("/{([^\}\{\n]*)}/e", "\$this->select('\\1');", $source); |
|
|
|
return preg_replace_callback("/{([^\}\{]*)}/", function($r) { return $this->select($r[1]); }, $source); |
|
|
|
|
|
|
|
|
|
|
|
return preg_replace_callback("/{([^\}\{\n]*)}/", function($r) { return $this->select($r[1]); }, $source); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
@ -525,7 +523,7 @@ class cls_template |
|
|
|
$t = $this->get_para(substr($tag, 7), false); |
|
|
|
|
|
|
|
//$out = "<?php \n" . '$k = ' . preg_replace("/(\'\\$[^,]+)/e" , "stripslashes(trim('\\1','\''));", var_export($t, true)) . ";\n";
|
|
|
|
$out = "<?php \n" . '$k = ' . preg_replace_callback("/(\'\\$[^,]+)/" , function($r) {return stripslashes(trim($r[1],'\''));}, var_export($t, true)) . ";\n"; |
|
|
|
$out = "<?php \n" . '$k = ' . preg_replace_callback("/(\'\\$[^,]+)/" , function($r) { return stripslashes(trim($r[1],'\'')); }, var_export($t, true)) . ";\n"; |
|
|
|
$out .= 'echo $this->_echash . $k[\'name\'] . \'|\' . serialize($k) . $this->_echash;' . "\n?>"; |
|
|
|
|
|
|
|
return $out; |
|
|
|
@ -585,7 +583,7 @@ class cls_template |
|
|
|
if (strrpos($val, '[') !== false) |
|
|
|
{ |
|
|
|
//$val = preg_replace("/\[([^\[\]]*)\]/eis", "'.'.str_replace('$','\$','\\1')", $val); |
|
|
|
$val = preg_replace_callback('/\[([^\[\]]*)\]/is',function ($matches) {return '.'.str_replace('$','\$',$matches[1]);},$val); |
|
|
|
$val = preg_replace_callback("/\[([^\[\]]*)\]/is", function($r) { return '.'.$r[1]; }, $val); |
|
|
|
} |
|
|
|
|
|
|
|
if (strrpos($val, '|') !== false) |
|
|
|
@ -1105,9 +1103,9 @@ class cls_template |
|
|
|
/*$pattern = '/<!--\s#BeginLibraryItem\s\"\/(.*?)\"\s-->.*?<!--\s#EndLibraryItem\s-->/se'; |
|
|
|
$replacement = "'{include file='.strtolower('\\1'). '}'"; |
|
|
|
$source = preg_replace($pattern, $replacement, $source);*/ |
|
|
|
$pattern = '/<!--\s#BeginLibraryItem\s\"\/(.*?)\"\s-->.*?<!--\s#EndLibraryItem\s-->/s'; |
|
|
|
$replacement = function($r){return '{include file='.strtolower($r[1]). '}';}; |
|
|
|
$source = preg_replace_callback($pattern, $replacement, $source); |
|
|
|
$pattern = '/<!--\s#BeginLibraryItem\s"\/(.*?)"\s-->.*?<!--\s#EndLibraryItem\s-->/s'; |
|
|
|
$replacement = function ($r) { return '{include file='.strtolower($r[1]). '}'; }; |
|
|
|
$source = preg_replace_callback($pattern, $replacement, $source); |
|
|
|
|
|
|
|
/* 检查有无动态库文件,如果有为其赋值 */ |
|
|
|
$dyna_libs = get_dyna_libs($GLOBALS['_CFG']['template'], $this->_current_file); |
|
|
|
|