18 $_tag_start =
'if \(\$this->caching && \!\$this->_cache_including\)\: echo \'\{nocache\:('.$params[
'cache_serial'].
')#(\d+)\}\'; endif;';
19 $_tag_end =
'if \(\$this->caching && \!\$this->_cache_including\)\: echo \'\{/nocache\:(\\2)#(\\3)\}\'; endif;';
21 preg_match_all(
'!('.$_tag_start.
'(.*)'.$_tag_end.
')!Us',
22 $params[
'compiled_content'], $_match_source, PREG_SET_ORDER);
25 if (count($_match_source)==0)
return;
28 $_include_compiled =
"<?php /* Smarty version ".$smarty->_version.
", created on ".strftime(
"%Y-%m-%d %H:%M:%S").
"\n";
29 $_include_compiled .=
" compiled from " . strtr(urlencode($params[
'resource_name']), array(
'%2F'=>
'/',
'%3A'=>
':')) .
" */\n\n";
31 $_compile_path = $params[
'include_file_path'];
33 $smarty->_cache_serials[$_compile_path] = $params[
'cache_serial'];
34 $_include_compiled .=
"\$this->_cache_serials['".$_compile_path.
"'] = '".$params[
'cache_serial'].
"';\n\n?>";
36 $_include_compiled .= $params[
'plugins_code'];
37 $_include_compiled .=
"<?php";
39 $this_varname = ((double)phpversion() >= 5.0) ?
'_smarty' :
'this';
40 for ($_i = 0, $_for_max = count($_match_source); $_i < $_for_max; $_i++) {
41 $_match =& $_match_source[$_i];
43 if ($this_varname ==
'_smarty') {
45 $tokens = token_get_all(
'<?php ' . $_match[4]);
50 $token = array_shift($tokens);
56 if ($open_tag ==
'<?php ')
break;
59 for (
$i=0, $count = count($tokens);
$i < $count;
$i++) {
60 if (is_array($tokens[
$i])) {
61 if ($tokens[$i][0] == T_VARIABLE && $tokens[$i][1] ==
'$this') {
62 $tokens[
$i] =
'$' . $this_varname;
64 $tokens[
$i] = $tokens[
$i][1];
68 $source = implode(
'', $tokens);
72 $_include_compiled .=
"
73 function _smarty_tplfunc_$_match[2]_$_match[3](&\$$this_varname)
80 $_include_compiled .=
"\n\n?>\n";
82 $_params = array(
'filename' => $_compile_path,
83 'contents' => $_include_compiled,
'create_dirs' =>
true);
85 require_once(SMARTY_CORE_DIR .
'core.write_file.php');