+++ /dev/null
-<?php\r
-/**\r
- * Smarty plugin\r
- * @package Smarty\r
- * @subpackage plugins\r
- */\r
-\r
-/**\r
- * Replace cached inserts with the actual results\r
- *\r
- * @param string $results\r
- * @return string\r
- */\r
-function smarty_core_process_cached_inserts($params, &$smarty)\r
-{\r
- preg_match_all('!'.$smarty->_smarty_md5.'{insert_cache (.*)}'.$smarty->_smarty_md5.'!Uis',\r
- $params['results'], $match);\r
- list($cached_inserts, $insert_args) = $match;\r
-\r
- for ($i = 0, $for_max = count($cached_inserts); $i < $for_max; $i++) {\r
- if ($smarty->debugging) {\r
- $_params = array();\r
- require_once(SMARTY_DIR . 'core' . DIRECTORY_SEPARATOR . 'core.get_microtime.php');\r
- $debug_start_time = smarty_core_get_microtime($_params, $smarty);\r
- }\r
-\r
- $args = unserialize($insert_args[$i]);\r
- $name = $args['name'];\r
-\r
- if (isset($args['script'])) {\r
- $_params = array('resource_name' => $smarty->_dequote($args['script']));\r
- require_once(SMARTY_DIR . 'core' . DIRECTORY_SEPARATOR . 'core.get_php_resource.php');\r
- if(!smarty_core_get_php_resource($_params, $smarty)) {\r
- return false;\r
- }\r
- $resource_type = $_params['resource_type'];\r
- $php_resource = $_params['php_resource'];\r
-\r
-\r
- if ($resource_type == 'file') {\r
- $smarty->_include($php_resource, true);\r
- } else {\r
- $smarty->_eval($php_resource);\r
- }\r
- }\r
-\r
- $function_name = $smarty->_plugins['insert'][$name][0];\r
- if (empty($args['assign'])) {\r
- $replace = $function_name($args, $smarty);\r
- } else {\r
- $smarty->assign($args['assign'], $function_name($args, $smarty));\r
- $replace = '';\r
- }\r
-\r
- $params['results'] = str_replace($cached_inserts[$i], $replace, $params['results']);\r
- if ($smarty->debugging) {\r
- $_params = array();\r
- require_once(SMARTY_DIR . 'core' . DIRECTORY_SEPARATOR . 'core.get_microtime.php');\r
- $smarty->_smarty_debug_info[] = array('type' => 'insert',\r
- 'filename' => 'insert_'.$name,\r
- 'depth' => $smarty->_inclusion_depth,\r
- 'exec_time' => smarty_core_get_microtime($_params, $smarty) - $debug_start_time);\r
- }\r
- }\r
-\r
- return $params['results'];\r
-}\r
-\r
-/* vim: set expandtab: */\r
-\r
-?>\r