| 
									
										
										
										
											2003-05-08 20:21:16 +00:00
										 |  |  | <?php | 
					
						
							|  |  |  | /** | 
					
						
							|  |  |  |  * Smarty plugin | 
					
						
							|  |  |  |  * @package Smarty | 
					
						
							|  |  |  |  * @subpackage plugins | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /** | 
					
						
							|  |  |  |  * Handle insert tags | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * @param array $args | 
					
						
							|  |  |  |  * @return string | 
					
						
							| 
									
										
										
										
											2003-10-11 08:55:53 +00:00
										 |  |  |  */ | 
					
						
							| 
									
										
										
										
											2003-06-30 00:08:28 +00:00
										 |  |  | function smarty_core_run_insert_handler($params, &$smarty) | 
					
						
							| 
									
										
										
										
											2003-05-08 20:21:16 +00:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2003-10-11 08:55:53 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |     require_once(SMARTY_DIR . 'core' . DIRECTORY_SEPARATOR . 'core.get_microtime.php'); | 
					
						
							| 
									
										
										
										
											2003-06-30 00:08:28 +00:00
										 |  |  |     if ($smarty->debugging) { | 
					
						
							| 
									
										
										
										
											2003-10-11 08:55:53 +00:00
										 |  |  |         $_params = array(); | 
					
						
							| 
									
										
										
										
											2003-06-30 00:08:28 +00:00
										 |  |  |         $_debug_start_time = smarty_core_get_microtime($_params, $smarty); | 
					
						
							| 
									
										
										
										
											2003-05-08 20:21:16 +00:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2003-06-30 00:08:28 +00:00
										 |  |  |     if ($smarty->caching) { | 
					
						
							| 
									
										
										
										
											2003-05-08 20:21:16 +00:00
										 |  |  |         $_arg_string = serialize($params['args']); | 
					
						
							|  |  |  |         $_name = $params['args']['name']; | 
					
						
							| 
									
										
										
										
											2003-06-30 00:08:28 +00:00
										 |  |  |         if (!isset($smarty->_cache_info['insert_tags'][$_name])) { | 
					
						
							|  |  |  |             $smarty->_cache_info['insert_tags'][$_name] = array('insert', | 
					
						
							| 
									
										
										
										
											2003-05-08 20:21:16 +00:00
										 |  |  |                                                              $_name, | 
					
						
							| 
									
										
										
										
											2003-06-30 00:08:28 +00:00
										 |  |  |                                                              $smarty->_plugins['insert'][$_name][1], | 
					
						
							|  |  |  |                                                              $smarty->_plugins['insert'][$_name][2], | 
					
						
							| 
									
										
										
										
											2003-05-08 20:21:16 +00:00
										 |  |  |                                                              !empty($params['args']['script']) ? true : false); | 
					
						
							|  |  |  |         } | 
					
						
							| 
									
										
										
										
											2003-06-30 00:08:28 +00:00
										 |  |  |         return $smarty->_smarty_md5."{insert_cache $_arg_string}".$smarty->_smarty_md5; | 
					
						
							| 
									
										
										
										
											2003-05-08 20:21:16 +00:00
										 |  |  |     } else { | 
					
						
							| 
									
										
										
										
											2003-10-11 08:55:53 +00:00
										 |  |  |         if (isset($params['args']['script'])) { | 
					
						
							|  |  |  |             $_params = array('resource_name' => $smarty->_dequote($params['args']['script'])); | 
					
						
							|  |  |  |             require_once(SMARTY_DIR . 'core' . DIRECTORY_SEPARATOR . 'core.get_php_resource.php'); | 
					
						
							|  |  |  |             if(!smarty_core_get_php_resource($_params, $smarty)) { | 
					
						
							|  |  |  |                 return false; | 
					
						
							|  |  |  |             } | 
					
						
							| 
									
										
										
										
											2003-05-08 20:21:16 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |             if ($_params['resource_type'] == 'file') { | 
					
						
							| 
									
										
										
										
											2003-07-23 16:14:47 +00:00
										 |  |  |                 $smarty->_include($_params['php_resource'], true); | 
					
						
							| 
									
										
										
										
											2003-05-08 20:21:16 +00:00
										 |  |  |             } else { | 
					
						
							| 
									
										
										
										
											2003-07-23 16:14:47 +00:00
										 |  |  |                 $smarty->_eval($_params['php_resource']); | 
					
						
							| 
									
										
										
										
											2003-05-08 20:21:16 +00:00
										 |  |  |             } | 
					
						
							|  |  |  |             unset($params['args']['script']); | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2003-06-30 00:08:28 +00:00
										 |  |  |         $_funcname = $smarty->_plugins['insert'][$params['args']['name']][0]; | 
					
						
							|  |  |  |         $_content = $_funcname($params['args'], $smarty); | 
					
						
							|  |  |  |         if ($smarty->debugging) { | 
					
						
							| 
									
										
										
										
											2003-10-11 08:55:53 +00:00
										 |  |  |             $_params = array(); | 
					
						
							|  |  |  |             require_once(SMARTY_DIR . 'core' . DIRECTORY_SEPARATOR . 'core.get_microtime.php'); | 
					
						
							| 
									
										
										
										
											2003-06-30 00:08:28 +00:00
										 |  |  |             $smarty->_smarty_debug_info[] = array('type'      => 'insert', | 
					
						
							| 
									
										
										
										
											2003-05-08 20:21:16 +00:00
										 |  |  |                                                 'filename'  => 'insert_'.$params['args']['name'], | 
					
						
							| 
									
										
										
										
											2003-06-30 00:08:28 +00:00
										 |  |  |                                                 'depth'     => $smarty->_inclusion_depth, | 
					
						
							|  |  |  |                                                 'exec_time' => smarty_core_get_microtime($_params, $smarty) - $_debug_start_time); | 
					
						
							| 
									
										
										
										
											2003-05-08 20:21:16 +00:00
										 |  |  |         } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         if (!empty($params['args']["assign"])) { | 
					
						
							| 
									
										
										
										
											2003-06-30 00:08:28 +00:00
										 |  |  |             $smarty->assign($params['args']["assign"], $_content); | 
					
						
							| 
									
										
										
										
											2003-05-08 20:21:16 +00:00
										 |  |  |         } else { | 
					
						
							|  |  |  |             return $_content; | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /* vim: set expandtab: */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | ?>
 |