00001 <?php 00016 function smarty_core_write_compiled_include($params, &$smarty) 00017 { 00018 $_tag_start = 'if \(\$this->caching && \!\$this->_cache_including\)\: echo \'\{nocache\:('.$params['cache_serial'].')#(\d+)\}\'; endif;'; 00019 $_tag_end = 'if \(\$this->caching && \!\$this->_cache_including\)\: echo \'\{/nocache\:(\\2)#(\\3)\}\'; endif;'; 00020 00021 preg_match_all('!('.$_tag_start.'(.*)'.$_tag_end.')!Us', 00022 $params['compiled_content'], $_match_source, PREG_SET_ORDER); 00023 00024 // no nocache-parts found: done 00025 if (count($_match_source)==0) return; 00026 00027 // convert the matched php-code to functions 00028 $_include_compiled = "<?php /* Smarty version ".$smarty->_version.", created on ".strftime("%Y-%m-%d %H:%M:%S")."\n"; 00029 $_include_compiled .= " compiled from " . strtr(urlencode($params['resource_name']), array('%2F'=>'/', '%3A'=>':')) . " */\n\n"; 00030 00031 $_compile_path = $params['include_file_path']; 00032 00033 $smarty->_cache_serials[$_compile_path] = $params['cache_serial']; 00034 $_include_compiled .= "\$this->_cache_serials['".$_compile_path."'] = '".$params['cache_serial']."';\n\n?>"; 00035 00036 $_include_compiled .= $params['plugins_code']; 00037 $_include_compiled .= "<?php"; 00038 00039 $this_varname = ((double)phpversion() >= 5.0) ? '_smarty' : 'this'; 00040 for ($_i = 0, $_for_max = count($_match_source); $_i < $_for_max; $_i++) { 00041 $_match =& $_match_source[$_i]; 00042 $source = $_match[4]; 00043 if ($this_varname == '_smarty') { 00044 /* rename $this to $_smarty in the sourcecode */ 00045 $tokens = token_get_all('<?php ' . $_match[4]); 00046 00047 /* remove trailing <?php */ 00048 $open_tag = ''; 00049 while ($tokens) { 00050 $token = array_shift($tokens); 00051 if (is_array($token)) { 00052 $open_tag .= $token[1]; 00053 } else { 00054 $open_tag .= $token; 00055 } 00056 if ($open_tag == '<?php ') break; 00057 } 00058 00059 for ($i=0, $count = count($tokens); $i < $count; $i++) { 00060 if (is_array($tokens[$i])) { 00061 if ($tokens[$i][0] == T_VARIABLE && $tokens[$i][1] == '$this') { 00062 $tokens[$i] = '$' . $this_varname; 00063 } else { 00064 $tokens[$i] = $tokens[$i][1]; 00065 } 00066 } 00067 } 00068 $source = implode('', $tokens); 00069 } 00070 00071 /* add function to compiled include */ 00072 $_include_compiled .= " 00073 function _smarty_tplfunc_$_match[2]_$_match[3](&\$$this_varname) 00074 { 00075 $source 00076 } 00077 00078 "; 00079 } 00080 $_include_compiled .= "\n\n?>\n"; 00081 00082 $_params = array('filename' => $_compile_path, 00083 'contents' => $_include_compiled, 'create_dirs' => true); 00084 00085 require_once(SMARTY_CORE_DIR . 'core.write_file.php'); 00086 smarty_core_write_file($_params, $smarty); 00087 return true; 00088 } 00089 00090 00091 ?>
| Copyright © 2003 - 2009 MyOOS [Shopsystem]. All rights reserved. MyOOS [Shopsystem] is Free Software released under the GNU/GPL License. Webmaster: info@r23.de (Impressum) |
|
