mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-04 18:34:27 +02:00
move core files into their own directory under SMARTY_DIR,
remove abstraction function _execute_core_function
This commit is contained in:
1
NEWS
1
NEWS
@@ -1,3 +1,4 @@
|
||||
- fix newlines for tags without template output (Monte)
|
||||
- added config-option "request_use_auto_globals" to make auto-globals be
|
||||
used as request vars instead of HTTP_*_VARS (messju)
|
||||
- make config vars compile statically (Monte)
|
||||
|
@@ -934,7 +934,8 @@ reques * @var string
|
||||
switch ($type) {
|
||||
case 'output':
|
||||
$_params = array('plugins' => array(array($type . 'filter', $name, null, null, false)));
|
||||
$this->_execute_core_function('load_plugins', $_params);
|
||||
require_once(SMARTY_DIR . 'core/core.load_plugins.php');
|
||||
smarty_core_load_plugins($_params, $this);
|
||||
break;
|
||||
|
||||
case 'pre':
|
||||
@@ -973,7 +974,8 @@ reques * @var string
|
||||
'auto_source' => $tpl_file,
|
||||
'auto_id' => $_auto_id,
|
||||
'exp_time' => $exp_time);
|
||||
return $this->_execute_core_function('rm_auto', $_params);
|
||||
require_once(SMARTY_DIR . 'core/core.rm_auto.php');
|
||||
return smarty_core_rm_auto($_params, $this);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -995,7 +997,8 @@ reques * @var string
|
||||
'auto_source' => null,
|
||||
'auto_id' => null,
|
||||
'exp_time' => $exp_time);
|
||||
return $this->_execute_core_function('rm_auto', $_params);
|
||||
require_once(SMARTY_DIR . 'core/core.rm_auto.php');
|
||||
return smarty_core_rm_auto($_params, $this);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1021,7 +1024,8 @@ reques * @var string
|
||||
'cache_id' => $cache_id,
|
||||
'compile_id' => $compile_id
|
||||
);
|
||||
return $this->_execute_core_function('read_cache_file', $_params);
|
||||
require_once(SMARTY_DIR . 'core/core.read_cache_file.php');
|
||||
return smarty_core_read_cache_file($_params, $this);
|
||||
}
|
||||
|
||||
|
||||
@@ -1053,7 +1057,8 @@ reques * @var string
|
||||
'auto_source' => $tpl_file,
|
||||
'auto_id' => $compile_id,
|
||||
'exp_time' => $exp_time);
|
||||
return $this->_execute_core_function('rm_auto', $_params);
|
||||
require_once(SMARTY_DIR . 'core/core.rm_auto.php');
|
||||
return smarty_core_rm_auto($_params, $this);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1065,7 +1070,8 @@ reques * @var string
|
||||
function template_exists($tpl_file)
|
||||
{
|
||||
$_params = array('tpl_path' => $tpl_file);
|
||||
return $this->_execute_core_function('fetch_template_info', $_params);
|
||||
require_once(SMARTY_DIR . 'core/core.fetch_template_info.php');
|
||||
return smarty_core_fetch_template_info($_params, $this);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1153,7 +1159,8 @@ reques * @var string
|
||||
if ($this->debugging) {
|
||||
// capture time for debugging info
|
||||
$_params = array();
|
||||
$_debug_start_time = $this->_execute_core_function('get_microtime', $_params);
|
||||
require_once(SMARTY_DIR . 'core/core.get_microtime.php');
|
||||
$_debug_start_time = smarty_core_get_microtime($_params, $this);
|
||||
$this->_smarty_debug_info[] = array('type' => 'template',
|
||||
'filename' => $tpl_file,
|
||||
'depth' => 0);
|
||||
@@ -1177,21 +1184,26 @@ reques * @var string
|
||||
'compile_id' => $compile_id,
|
||||
'results' => null
|
||||
);
|
||||
if ($this->_execute_core_function('read_cache_file', $_params)) {
|
||||
require_once(SMARTY_DIR . 'core/core.read_cache_file.php');
|
||||
if (smarty_core_read_cache_file($_params, $this)) {
|
||||
$_smarty_results = $_params['results'];
|
||||
if (@count($this->_cache_info['insert_tags'])) {
|
||||
$_params = array('plugins' => $this->_cache_info['insert_tags']);
|
||||
$this->_execute_core_function('load_plugins', $_params);
|
||||
require_once(SMARTY_DIR . 'core/core.load_plugins.php');
|
||||
smarty_core_load_plugins($_params, $this);
|
||||
$_params = array('results' => $_smarty_results);
|
||||
$_smarty_results = $this->_execute_core_function('process_cached_inserts', $_params);
|
||||
require_once(SMARTY_DIR . 'core/core.process_cached_inserts.php');
|
||||
$_smarty_results = smarty_core_process_cached_inserts($_params, $this);
|
||||
}
|
||||
if ($display) {
|
||||
if ($this->debugging)
|
||||
{
|
||||
// capture time for debugging info
|
||||
$_params = array();
|
||||
$this->_smarty_debug_info[$_included_tpls_idx]['exec_time'] = $this->_execute_core_function('get_microtime', $_params) - $_debug_start_time;
|
||||
$_smarty_results .= $this->_execute_core_function('display_debug_console', $_params);
|
||||
require_once(SMARTY_DIR . 'core/core.get_microtime.php');
|
||||
$this->_smarty_debug_info[$_included_tpls_idx]['exec_time'] = smarty_core_get_microtime($_params, $this) - $_debug_start_time;
|
||||
require_once(SMARTY_DIR . 'core/core.display_debug_console.php');
|
||||
$_smarty_results .= smarty_core_display_debug_console($_params, $this);
|
||||
}
|
||||
if ($this->cache_modified_check) {
|
||||
$_last_modified_date = substr($GLOBALS['HTTP_SERVER_VARS']['HTTP_IF_MODIFIED_SINCE'], 0, strpos($GLOBALS['HTTP_SERVER_VARS']['HTTP_IF_MODIFIED_SINCE'], 'GMT') + 3);
|
||||
@@ -1261,8 +1273,10 @@ reques * @var string
|
||||
'cache_id' => $cache_id,
|
||||
'compile_id' => $compile_id,
|
||||
'results' => $_smarty_results);
|
||||
$this->_execute_core_function('write_cache_file', $_params);
|
||||
$_smarty_results = $this->_execute_core_function('process_cached_inserts', $_params);
|
||||
require_once(SMARTY_DIR . 'core/core.write_cache_file.php');
|
||||
smarty_core_write_cache_file($_params, $this);
|
||||
require_once(SMARTY_DIR . 'core/core.process_cached_inserts.php');
|
||||
$_smarty_results = smarty_core_process_cached_inserts($_params, $this);
|
||||
// restore initial cache_info
|
||||
$this->_cache_info = array_pop($_cache_info);
|
||||
}
|
||||
@@ -1272,8 +1286,10 @@ reques * @var string
|
||||
if ($this->debugging) {
|
||||
// capture time for debugging info
|
||||
$_params = array();
|
||||
$this->_smarty_debug_info[$_included_tpls_idx]['exec_time'] = ($this->_execute_core_function('get_microtime', $_params) - $_debug_start_time);
|
||||
echo $this->_execute_core_function('display_debug_console', $_params);
|
||||
require_once(SMARTY_DIR . 'core/core.get_microtime.php');
|
||||
$this->_smarty_debug_info[$_included_tpls_idx]['exec_time'] = (smarty_core_get_microtime($_params, $this) - $_debug_start_time);
|
||||
require_once(SMARTY_DIR . 'core/core.display_debug_console.php');
|
||||
echo smarty_core_display_debug_console($_params, $this);
|
||||
}
|
||||
error_reporting($_smarty_old_error_level);
|
||||
return;
|
||||
@@ -1338,17 +1354,6 @@ reques * @var string
|
||||
{
|
||||
return preg_replace('![\\$]\d!', '\\\\\\0', $string);
|
||||
}
|
||||
|
||||
/**
|
||||
* execute core function
|
||||
* @return mixed value of function return
|
||||
*/
|
||||
function _execute_core_function($funcname, &$params)
|
||||
{
|
||||
require_once($this->_get_plugin_filepath('core', $funcname));
|
||||
$_core_funcname = 'smarty_core_' . $funcname;
|
||||
return $_core_funcname($params, $this);
|
||||
}
|
||||
|
||||
/**
|
||||
* get filepath of requested plugin
|
||||
@@ -1386,7 +1391,8 @@ reques * @var string
|
||||
$_plugin_filepath = $_plugin_dir . DIRECTORY_SEPARATOR . $_plugin_filename;
|
||||
|
||||
$_params = array('file_path' => $_plugin_filepath);
|
||||
if($this->_execute_core_function('get_include_path', $_params)) {
|
||||
require_once(SMARTY_DIR . 'core/core.get_include_path.php');
|
||||
if(smarty_core_get_include_path($_params, $this)) {
|
||||
return $_params['new_file_path'];
|
||||
}
|
||||
}
|
||||
@@ -1411,7 +1417,8 @@ reques * @var string
|
||||
} else {
|
||||
// get template source and timestamp
|
||||
$_params = array('tpl_path' => $tpl_file);
|
||||
if (!$this->_execute_core_function('fetch_template_info', $_params)) {
|
||||
require_once(SMARTY_DIR . 'core/core.fetch_template_info.php');
|
||||
if (!smarty_core_fetch_template_info($_params, $this)) {
|
||||
return false;
|
||||
}
|
||||
$_template_source = $_params['template_source'];
|
||||
@@ -1423,21 +1430,24 @@ reques * @var string
|
||||
// compile template
|
||||
$this->_compile_template($tpl_file, $_template_source, $_template_compiled);
|
||||
$_params = array('compile_path' => $compile_path, 'template_compiled' => $_template_compiled, 'template_timestamp' => $_template_timestamp);
|
||||
$this->_execute_core_function('write_compiled_template', $_params);
|
||||
require_once(SMARTY_DIR . 'core/core.write_compiled_template.php');
|
||||
smarty_core_write_compiled_template($_params, $this);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// compiled template does not exist, or forced compile
|
||||
$_params = array('tpl_path' => $tpl_file);
|
||||
if (!$this->_execute_core_function('fetch_template_info', $_params)) {
|
||||
require_once(SMARTY_DIR . 'core/core.fetch_template_info.php');
|
||||
if (!smarty_core_fetch_template_info($_params, $this)) {
|
||||
return false;
|
||||
}
|
||||
$_template_source = $_params['template_source'];
|
||||
$_template_timestamp = $_params['template_timestamp'];
|
||||
$this->_compile_template($tpl_file, $_template_source, $_template_compiled);
|
||||
$_params = array('compile_path' => $compile_path, 'template_compiled' => $_template_compiled, 'template_timestamp' => $_template_timestamp);
|
||||
$this->_execute_core_function('write_compiled_template', $_params);
|
||||
require_once(SMARTY_DIR . 'core/core.write_compiled_template.php');
|
||||
smarty_core_write_compiled_template($_params, $this);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -1618,7 +1628,8 @@ reques * @var string
|
||||
} else {
|
||||
// auto_base not found, try include_path
|
||||
$_params = array('file_path' => $auto_base);
|
||||
$this->_execute_core_function('get_include_path', $_params);
|
||||
require_once(SMARTY_DIR . 'core/core.get_include_path.php');
|
||||
smarty_core_get_include_path($_params, $this);
|
||||
$_res = isset($_params['new_file_path']) ? $_params['new_file_path'] . DIRECTORY_SEPARATOR : null;
|
||||
}
|
||||
|
||||
|
@@ -353,15 +353,13 @@ class Smarty_Compiler extends Smarty {
|
||||
}
|
||||
}
|
||||
$_plugins_params .= '))';
|
||||
$_plugin_filepath = $this->_get_plugin_filepath('core', 'load_plugins');
|
||||
$plugins_code = "<?php require_once('$_plugin_filepath');\nsmarty_core_load_plugins($_plugins_params, \$this); ?>\n";
|
||||
$plugins_code = "<?php require_once(SMARTY_DIR . 'core/core.load_plugins.php');\nsmarty_core_load_plugins($_plugins_params, \$this); ?>\n";
|
||||
$template_header .= $plugins_code;
|
||||
$this->_plugin_info = array();
|
||||
}
|
||||
|
||||
if ($this->_init_smarty_vars) {
|
||||
$_plugin_filepath = $this->_get_plugin_filepath('core', 'assign_smarty_interface');
|
||||
$template_header .= "<?php require_once('$_plugin_filepath');\nsmarty_core_assign_smarty_interface(null, \$this); ?>\n";
|
||||
$template_header .= "<?php require_once(SMARTY_DIR . 'core/core.assign_smarty_interface.php');\nsmarty_core_assign_smarty_interface(null, \$this); ?>\n";
|
||||
$this->_init_smarty_vars = false;
|
||||
}
|
||||
|
||||
@@ -819,9 +817,8 @@ class Smarty_Compiler extends Smarty {
|
||||
$this->_add_plugin('insert', $name, $delayed_loading);
|
||||
|
||||
$_params = "array('args' => array(".implode(', ', (array)$arg_list)."))";
|
||||
$_plugin_filepath = $this->_get_plugin_filepath('core', 'run_insert_handler');
|
||||
|
||||
return "<?php require_once('$_plugin_filepath');\necho smarty_core_run_insert_handler($_params, \$this); ?>\n";
|
||||
return "<?php require_once(SMARTY_DIR . 'core/core.run_insert_handler.php');\necho smarty_core_run_insert_handler($_params, \$this); ?>\n";
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -863,9 +860,8 @@ class Smarty_Compiler extends Smarty {
|
||||
|
||||
|
||||
$_params = "array('smarty_include_tpl_file' => " . $include_file . ", 'smarty_include_vars' => array(".implode(',', (array)$arg_list)."))";
|
||||
$_plugin_filepath = $this->_get_plugin_filepath('core', 'smarty_include');
|
||||
|
||||
$output .= "require_once('$_plugin_filepath');\nsmarty_core_smarty_include($_params, \$this);\n" .
|
||||
$output .= "require_once(SMARTY_DIR . 'core/core.smarty_include.php');\nsmarty_core_smarty_include($_params, \$this);\n" .
|
||||
"\$this->_tpl_vars = \$_smarty_tpl_vars;\n" .
|
||||
"unset(\$_smarty_tpl_vars);\n";
|
||||
|
||||
@@ -905,9 +901,8 @@ class Smarty_Compiler extends Smarty {
|
||||
}
|
||||
|
||||
$_params = "array('smarty_file' => " . $attrs['file'] . ", 'smarty_assign' => '$assign_var', 'smarty_once' => $once_var, 'smarty_include_vars' => array(".implode(',', (array)$arg_list)."))";
|
||||
$_plugin_filepath = $this->_get_plugin_filepath('core', 'smarty_include_php');
|
||||
|
||||
return "<?php require_once('$_plugin_filepath');\nsmarty_core_smarty_include_php($_params, \$this); ?>\n";
|
||||
return "<?php require_once(SMARTY_DIR . 'core/core.smarty_include_php.php');\nsmarty_core_smarty_include_php($_params, \$this); ?>\n";
|
||||
}
|
||||
|
||||
|
||||
@@ -1713,7 +1708,8 @@ class Smarty_Compiler extends Smarty {
|
||||
}
|
||||
if(!isset($this->_plugins['modifier'][$_modifier_name])) {
|
||||
$_params = array('plugins' => array(array('modifier', $_modifier_name, null, null, false)));
|
||||
$this->_execute_core_function('load_plugins', $_params);
|
||||
require_once(SMARTY_DIR . 'core/core.load_plugins.php');
|
||||
smarty_core_load_plugins($_params, $this);
|
||||
}
|
||||
array_unshift($_modifier_args, $output);
|
||||
$output = $this->_run_mod_handler($_modifier_name, $_map_array, $_modifier_args);
|
||||
@@ -1890,7 +1886,8 @@ class Smarty_Compiler extends Smarty {
|
||||
if ($prefilter === false) {
|
||||
unset($this->_plugins['prefilter'][$filter_name]);
|
||||
$_params = array('plugins' => array(array('prefilter', $filter_name, null, null, false)));
|
||||
$this->_execute_core_function('load_plugins', $_params);
|
||||
require_once(SMARTY_DIR . 'core/core.load_plugins.php');
|
||||
smarty_core_load_plugins($_params, $this);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1899,7 +1896,8 @@ class Smarty_Compiler extends Smarty {
|
||||
if ($postfilter === false) {
|
||||
unset($this->_plugins['postfilter'][$filter_name]);
|
||||
$_params = array('plugins' => array(array('postfilter', $filter_name, null, null, false)));
|
||||
$this->_execute_core_function('load_plugins', $_params);
|
||||
require_once(SMARTY_DIR . 'core/core.load_plugins.php');
|
||||
smarty_core_load_plugins($_params, $this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -29,7 +29,8 @@ function smarty_core_fetch_template_info(&$params, &$this)
|
||||
$_return = false;
|
||||
$_params = array('file_base_path' => $this->template_dir,
|
||||
'file_path' => $params['tpl_path']) ;
|
||||
if ($this->_execute_core_function('parse_file_path', $_params)) {
|
||||
require_once(SMARTY_DIR . 'core/core.parse_file_path.php');
|
||||
if (smarty_core_parse_file_path($_params, $this)) {
|
||||
$_resource_type = $_params['resource_type'];
|
||||
$_resource_name = $_params['resource_name'];
|
||||
switch ($_resource_type) {
|
||||
@@ -73,11 +74,12 @@ function smarty_core_fetch_template_info(&$params, &$this)
|
||||
}
|
||||
}
|
||||
|
||||
require_once(SMARTY_DIR . 'core/core.is_secure.php');
|
||||
if (!$_return) {
|
||||
if (!$params['quiet']) {
|
||||
$this->trigger_error('unable to read template resource: "' . $params['tpl_path'] . '"');
|
||||
}
|
||||
} else if ($_return && $this->security && !$this->_execute_core_function('is_secure', $_params)) {
|
||||
} else if ($_return && $this->security && !smarty_core_is_secure($_params, $this)) {
|
||||
if (!$params['quiet'])
|
||||
$this->trigger_error('(secure mode) accessing "' . $params['tpl_path'] . '" is not allowed');
|
||||
$params['template_source'] = null;
|
@@ -19,7 +19,8 @@ function smarty_core_get_php_resource(&$params, &$this)
|
||||
{
|
||||
|
||||
$params['file_base_path'] = $this->trusted_dir;
|
||||
$this->_execute_core_function('parse_file_path', $params);
|
||||
require_once(SMARTY_DIR . 'core/core.parse_file_path.php');
|
||||
smarty_core_parse_file_path($params, $this);
|
||||
|
||||
/*
|
||||
* Find out if the resource exists.
|
||||
@@ -32,7 +33,8 @@ function smarty_core_get_php_resource(&$params, &$this)
|
||||
} else {
|
||||
// test for file in include_path
|
||||
$_params = array('file_path' => $params['resource_name']);
|
||||
if($this->_execute_core_function('get_include_path', $_params)) {
|
||||
require_once(SMARTY_DIR . 'core/core.get_include_path.php');
|
||||
if(smarty_core_get_include_path($_params, $this)) {
|
||||
$_include_path = $_params['new_file_path'];
|
||||
$_readable = true;
|
||||
}
|
||||
@@ -55,7 +57,8 @@ function smarty_core_get_php_resource(&$params, &$this)
|
||||
|
||||
if ($_readable) {
|
||||
if ($this->security) {
|
||||
if (!$this->_execute_core_function('is_trusted',$params)) {
|
||||
require_once(SMARTY_DIR . 'core/core.is_trusted.php');
|
||||
if (!smarty_core_is_trusted($params, $this)) {
|
||||
$this->$_error_funcc('(secure mode) ' . $params['resource_type'] . ':' . $params['resource_name'] . ' is not trusted');
|
||||
return false;
|
||||
}
|
@@ -52,7 +52,8 @@ function smarty_core_parse_file_path(&$params, &$this)
|
||||
}
|
||||
// didn't find the file, try include_path
|
||||
$_params = array('file_path' => $_fullpath);
|
||||
if($this->_execute_core_function('get_include_path', $_params)) {
|
||||
require_once(SMARTY_DIR . 'core/core.get_include_path.php');
|
||||
if(smarty_core_get_include_path($_params, $this)) {
|
||||
$params['resource_name'] = $_params['new_file_path'];
|
||||
return true;
|
||||
}
|
||||
@@ -61,7 +62,8 @@ function smarty_core_parse_file_path(&$params, &$this)
|
||||
}
|
||||
} else {
|
||||
$_params = array('type' => $params['resource_type']);
|
||||
$this->_execute_core_function('load_resource_plugin', $_params);
|
||||
require_once(SMARTY_DIR . 'core/core.load_resource_plugin.php');
|
||||
smarty_core_load_resource_plugin($_params, $this);
|
||||
}
|
||||
|
||||
return true;
|
@@ -20,7 +20,8 @@ function smarty_core_process_cached_inserts($params, &$this)
|
||||
for ($i = 0, $for_max = count($cached_inserts); $i < $for_max; $i++) {
|
||||
if ($this->debugging) {
|
||||
$_params = array();
|
||||
$debug_start_time = $this->_execute_core_function('get_microtime', $_params);
|
||||
require_once(SMARTY_DIR . 'core/core.get_microtime.php');
|
||||
$debug_start_time = smarty_core_get_microtime($_params, $this);
|
||||
}
|
||||
|
||||
$args = unserialize($insert_args[$i]);
|
||||
@@ -28,7 +29,8 @@ function smarty_core_process_cached_inserts($params, &$this)
|
||||
|
||||
if (isset($args['script'])) {
|
||||
$_params = array('file_path' => $this->_dequote($args['script']));
|
||||
if(!$this->_execute_core_function('get_php_resource', $_params)) {
|
||||
require_once(SMARTY_DIR . 'core/core.get_php_resource.php');
|
||||
if(!smarty_core_get_php_resource($_params, $this)) {
|
||||
return false;
|
||||
}
|
||||
$resource_type = $_params['resource_type'];
|
||||
@@ -48,10 +50,11 @@ function smarty_core_process_cached_inserts($params, &$this)
|
||||
$params['results'] = str_replace($cached_inserts[$i], $replace, $params['results']);
|
||||
if ($this->debugging) {
|
||||
$_params = array();
|
||||
require_once(SMARTY_DIR . 'core/core.get_microtime.php');
|
||||
$this->_smarty_debug_info[] = array('type' => 'insert',
|
||||
'filename' => 'insert_'.$name,
|
||||
'depth' => $this->_inclusion_depth,
|
||||
'exec_time' => $this->_execute_core_function('get_microtime', $_params) - $debug_start_time);
|
||||
'exec_time' => smarty_core_get_microtime($_params, $this) - $debug_start_time);
|
||||
}
|
||||
}
|
||||
|
@@ -70,7 +70,8 @@ function smarty_core_read_cache_file(&$params, &$this)
|
||||
if ($this->compile_check) {
|
||||
foreach (array_keys($this->_cache_info['template']) as $_template_dep) {
|
||||
$_params = array('tpl_path' => $_template_dep);
|
||||
$this->_execute_core_function('fetch_template_info', $_params);
|
||||
require_once(SMARTY_DIR . 'core/core.fetch_template_info.php');
|
||||
smarty_core_fetch_template_info($_params, $this);
|
||||
if ($this->_cache_info['timestamp'] < $_params['template_timestamp']) {
|
||||
// template file has changed, regenerate cache
|
||||
return false;
|
@@ -28,7 +28,8 @@ function smarty_core_rm_auto($params, &$this)
|
||||
'level' => 0,
|
||||
'exp_time' => $params['exp_time']
|
||||
);
|
||||
$_res = $this->_execute_core_function('rmdir', $_params);
|
||||
require_once(SMARTY_DIR . 'core/core.rmdir.php');
|
||||
$_res = smarty_core_rmdir($_params, $this);
|
||||
} else {
|
||||
$_tname = $this->_get_auto_filename($params['auto_base'], $params['auto_source'], $params['auto_id']);
|
||||
|
||||
@@ -40,7 +41,8 @@ function smarty_core_rm_auto($params, &$this)
|
||||
'level' => 1,
|
||||
'exp_time' => $params['exp_time']
|
||||
);
|
||||
$_res = $this->_execute_core_function('rmdir', $_params);
|
||||
require_once(SMARTY_DIR . 'core/core.rmdir.php');
|
||||
$_res = smarty_core_rmdir($_params, $this);
|
||||
} else {
|
||||
// remove matching file names
|
||||
$_handle = opendir($params['auto_base']);
|
@@ -32,7 +32,8 @@ function smarty_core_rmdir($params, &$this)
|
||||
'level' => $params['level'] + 1,
|
||||
'exp_time' => $params['exp_time']
|
||||
);
|
||||
$this->_execute_core_function('rmdir', $_params);
|
||||
require_once(SMARTY_DIR . 'core/core.rmdir.php');
|
||||
smarty_core_rmdir($_params, $this);
|
||||
}
|
||||
else {
|
||||
$this->_unlink($params['dirname'] . DIRECTORY_SEPARATOR . $_entry, $params['exp_time']);
|
@@ -14,9 +14,10 @@
|
||||
function smarty_core_run_insert_handler($params, &$this)
|
||||
{
|
||||
|
||||
require_once(SMARTY_DIR . 'core/core.get_microtime.php');
|
||||
if ($this->debugging) {
|
||||
$_params = array();
|
||||
$_debug_start_time = $this->_execute_core_function('get_microtime', $_params);
|
||||
$_debug_start_time = smarty_core_get_microtime($_params, $this);
|
||||
}
|
||||
|
||||
if ($this->caching) {
|
||||
@@ -33,7 +34,8 @@ function smarty_core_run_insert_handler($params, &$this)
|
||||
} else {
|
||||
if (isset($params['args']['script'])) {
|
||||
$_params = array('file_path' => $this->_dequote($params['args']['script']));
|
||||
if(!$this->_execute_core_function('get_php_resource', $_params)) {
|
||||
require_once(SMARTY_DIR . 'core/core.get_php_resource.php');
|
||||
if(!smarty_core_get_php_resource($_params, $this)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -49,10 +51,11 @@ function smarty_core_run_insert_handler($params, &$this)
|
||||
$_content = $_funcname($params['args'], $this);
|
||||
if ($this->debugging) {
|
||||
$_params = array();
|
||||
require_once(SMARTY_DIR . 'core/core.get_microtime.php');
|
||||
$this->_smarty_debug_info[] = array('type' => 'insert',
|
||||
'filename' => 'insert_'.$params['args']['name'],
|
||||
'depth' => $this->_inclusion_depth,
|
||||
'exec_time' => $this->_execute_core_function('get_microtime', $_params) - $_debug_start_time);
|
||||
'exec_time' => smarty_core_get_microtime($_params, $this) - $_debug_start_time);
|
||||
}
|
||||
|
||||
if (!empty($params['args']["assign"])) {
|
@@ -18,7 +18,8 @@ function smarty_core_smarty_include($params, &$this)
|
||||
{
|
||||
if ($this->debugging) {
|
||||
$_params = array();
|
||||
$debug_start_time = $this->_execute_core_function('get_microtime', $_params);
|
||||
require_once(SMARTY_DIR . 'core/core.get_microtime.php');
|
||||
$debug_start_time = smarty_core_get_microtime($_params, $this);
|
||||
$this->_smarty_debug_info[] = array('type' => 'template',
|
||||
'filename' => $params['smarty_include_tpl_file'],
|
||||
'depth' => ++$this->_inclusion_depth);
|
||||
@@ -45,7 +46,8 @@ function smarty_core_smarty_include($params, &$this)
|
||||
if ($this->debugging) {
|
||||
// capture time for debugging info
|
||||
$_params = array();
|
||||
$this->_smarty_debug_info[$included_tpls_idx]['exec_time'] = $this->_execute_core_function('get_microtime', $_params) - $debug_start_time;
|
||||
require_once(SMARTY_DIR . 'core/core.get_microtime.php');
|
||||
$this->_smarty_debug_info[$included_tpls_idx]['exec_time'] = smarty_core_get_microtime($_params, $this) - $debug_start_time;
|
||||
}
|
||||
|
||||
if ($this->caching) {
|
@@ -21,7 +21,8 @@
|
||||
function smarty_core_smarty_include_php($params, &$this)
|
||||
{
|
||||
$_params = array('file_path' => $params['smarty_file']);
|
||||
$this->_execute_core_function('get_php_resource', $_params);
|
||||
require_once(SMARTY_DIR . 'core/core.get_php_resource.php');
|
||||
smarty_core_get_php_resource($_params, $this);
|
||||
$_smarty_resource_type = $_params['resource_type'];
|
||||
$_smarty_php_resource = $_params['php_resource'];
|
||||
|
@@ -53,7 +53,8 @@ function smarty_core_write_cache_file($params, &$this)
|
||||
$_auto_id = $this->_get_auto_id($params['cache_id'], $params['compile_id']);
|
||||
$_cache_file = $this->_get_auto_filename($this->cache_dir, $params['tpl_file'], $_auto_id);
|
||||
$_params = array('filename' => $_cache_file, 'contents' => $params['results'], 'create_dirs' => true);
|
||||
$this->_execute_core_function('write_file', $_params);
|
||||
require_once(SMARTY_DIR . 'core/core.write_file.php');
|
||||
smarty_core_write_file($_params, $this);
|
||||
return true;
|
||||
}
|
||||
}
|
@@ -26,7 +26,8 @@ function smarty_core_write_compiled_template($params, &$this)
|
||||
}
|
||||
|
||||
$_params = array('filename' => $params['compile_path'], 'contents' => $params['template_compiled'], 'create_dirs' => true);
|
||||
$this->_execute_core_function('write_file', $_params);
|
||||
require_once(SMARTY_DIR . 'core/core.write_file.php');
|
||||
smarty_core_write_file($_params, $this);
|
||||
touch($params['compile_path'], $params['template_timestamp']);
|
||||
return true;
|
||||
}
|
@@ -19,7 +19,8 @@ function smarty_core_write_file($params, &$this)
|
||||
|
||||
if ($params['create_dirs']) {
|
||||
$_params = array('dir' => $_dirname);
|
||||
$this->_execute_core_function('create_dir_structure', $_params);
|
||||
require_once(SMARTY_DIR . 'core/core.create_dir_structure.php');
|
||||
smarty_core_create_dir_structure($_params, $this);
|
||||
}
|
||||
|
||||
// write to tmp file, then rename it to avoid
|
Reference in New Issue
Block a user