changed git call from https to git readonly
[atutor.git] / mods / phpdoc2 / PhpDocumentor / phpDocumentor / Smarty-2.6.0 / libs / core / core.run_insert_handler.php
1 <?php\r
2 /**\r
3  * Smarty plugin\r
4  * @package Smarty\r
5  * @subpackage plugins\r
6  */\r
7 \r
8 /**\r
9  * Handle insert tags\r
10  *\r
11  * @param array $args\r
12  * @return string\r
13  */\r
14 function smarty_core_run_insert_handler($params, &$smarty)\r
15 {\r
16 \r
17     require_once(SMARTY_DIR . 'core' . DIRECTORY_SEPARATOR . 'core.get_microtime.php');\r
18     if ($smarty->debugging) {\r
19         $_params = array();\r
20         $_debug_start_time = smarty_core_get_microtime($_params, $smarty);\r
21     }\r
22 \r
23     if ($smarty->caching) {\r
24         $_arg_string = serialize($params['args']);\r
25         $_name = $params['args']['name'];\r
26         if (!isset($smarty->_cache_info['insert_tags'][$_name])) {\r
27             $smarty->_cache_info['insert_tags'][$_name] = array('insert',\r
28                                                              $_name,\r
29                                                              $smarty->_plugins['insert'][$_name][1],\r
30                                                              $smarty->_plugins['insert'][$_name][2],\r
31                                                              !empty($params['args']['script']) ? true : false);\r
32         }\r
33         return $smarty->_smarty_md5."{insert_cache $_arg_string}".$smarty->_smarty_md5;\r
34     } else {\r
35         if (isset($params['args']['script'])) {\r
36             $_params = array('resource_name' => $smarty->_dequote($params['args']['script']));\r
37             require_once(SMARTY_DIR . 'core' . DIRECTORY_SEPARATOR . 'core.get_php_resource.php');\r
38             if(!smarty_core_get_php_resource($_params, $smarty)) {\r
39                 return false;\r
40             }\r
41 \r
42             if ($_params['resource_type'] == 'file') {\r
43                 $smarty->_include($_params['php_resource'], true);\r
44             } else {\r
45                 $smarty->_eval($_params['php_resource']);\r
46             }\r
47             unset($params['args']['script']);\r
48         }\r
49 \r
50         $_funcname = $smarty->_plugins['insert'][$params['args']['name']][0];\r
51         $_content = $_funcname($params['args'], $smarty);\r
52         if ($smarty->debugging) {\r
53             $_params = array();\r
54             require_once(SMARTY_DIR . 'core' . DIRECTORY_SEPARATOR . 'core.get_microtime.php');\r
55             $smarty->_smarty_debug_info[] = array('type'      => 'insert',\r
56                                                 'filename'  => 'insert_'.$params['args']['name'],\r
57                                                 'depth'     => $smarty->_inclusion_depth,\r
58                                                 'exec_time' => smarty_core_get_microtime($_params, $smarty) - $_debug_start_time);\r
59         }\r
60 \r
61         if (!empty($params['args']["assign"])) {\r
62             $smarty->assign($params['args']["assign"], $_content);\r
63         } else {\r
64             return $_content;\r
65         }\r
66     }\r
67 }\r
68 \r
69 /* vim: set expandtab: */\r
70 \r
71 ?>\r