16 preg_match_all(
'!'.$smarty->_smarty_md5.
'{insert_cache (.*)}'.$smarty->_smarty_md5.
'!Uis',
17 $params[
'results'], $match);
18 list($cached_inserts, $insert_args) = $match;
20 for (
$i = 0, $for_max = count($cached_inserts);
$i < $for_max;
$i++) {
21 if ($smarty->debugging) {
23 require_once(SMARTY_CORE_DIR .
'core.get_microtime.php');
27 $args = unserialize($insert_args[
$i]);
28 $name = $args[
'name'];
30 if (isset($args[
'script'])) {
31 $_params = array(
'resource_name' => $smarty->_dequote($args[
'script']));
32 require_once(SMARTY_CORE_DIR .
'core.get_php_resource.php');
36 $resource_type = $_params[
'resource_type'];
37 $php_resource = $_params[
'php_resource'];
40 if ($resource_type ==
'file') {
41 $smarty->_include($php_resource,
true);
43 $smarty->_eval($php_resource);
47 $function_name = $smarty->_plugins[
'insert'][$name][0];
48 if (empty($args[
'assign'])) {
49 $replace = $function_name($args, $smarty);
51 $smarty->assign($args[
'assign'], $function_name($args, $smarty));
55 $params[
'results'] = substr_replace($params[
'results'], $replace, strpos($params[
'results'], $cached_inserts[$i]), strlen($cached_inserts[$i]));
56 if ($smarty->debugging) {
58 require_once(SMARTY_CORE_DIR .
'core.get_microtime.php');
59 $smarty->_smarty_debug_info[] = array(
'type' =>
'insert',
60 'filename' =>
'insert_'.$name,
61 'depth' => $smarty->_inclusion_depth,
66 return $params[
'results'];