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