diff --git a/NEWS b/NEWS index eda4125c..48d3373a 100644 --- a/NEWS +++ b/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) diff --git a/libs/Smarty.class.php b/libs/Smarty.class.php index a15452d5..445db0f1 100644 --- a/libs/Smarty.class.php +++ b/libs/Smarty.class.php @@ -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; } diff --git a/libs/Smarty_Compiler.class.php b/libs/Smarty_Compiler.class.php index 21d997f1..989b4f9f 100644 --- a/libs/Smarty_Compiler.class.php +++ b/libs/Smarty_Compiler.class.php @@ -353,15 +353,13 @@ class Smarty_Compiler extends Smarty { } } $_plugins_params .= '))'; - $_plugin_filepath = $this->_get_plugin_filepath('core', 'load_plugins'); - $plugins_code = "\n"; + $plugins_code = "\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 .= "\n"; + $template_header .= "\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 "\n"; + return "\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 "\n"; + return "\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); } } } diff --git a/libs/plugins/core.assign_smarty_interface.php b/libs/core/core.assign_smarty_interface.php similarity index 100% rename from libs/plugins/core.assign_smarty_interface.php rename to libs/core/core.assign_smarty_interface.php diff --git a/libs/plugins/core.create_dir_structure.php b/libs/core/core.create_dir_structure.php similarity index 100% rename from libs/plugins/core.create_dir_structure.php rename to libs/core/core.create_dir_structure.php diff --git a/libs/plugins/core.display_debug_console.php b/libs/core/core.display_debug_console.php similarity index 100% rename from libs/plugins/core.display_debug_console.php rename to libs/core/core.display_debug_console.php diff --git a/libs/plugins/core.fetch_template_info.php b/libs/core/core.fetch_template_info.php similarity index 92% rename from libs/plugins/core.fetch_template_info.php rename to libs/core/core.fetch_template_info.php index 1ab546df..59c1ad19 100644 --- a/libs/plugins/core.fetch_template_info.php +++ b/libs/core/core.fetch_template_info.php @@ -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; diff --git a/libs/plugins/core.get_include_path.php b/libs/core/core.get_include_path.php similarity index 100% rename from libs/plugins/core.get_include_path.php rename to libs/core/core.get_include_path.php diff --git a/libs/plugins/core.get_microtime.php b/libs/core/core.get_microtime.php similarity index 100% rename from libs/plugins/core.get_microtime.php rename to libs/core/core.get_microtime.php diff --git a/libs/plugins/core.get_php_resource.php b/libs/core/core.get_php_resource.php similarity index 85% rename from libs/plugins/core.get_php_resource.php rename to libs/core/core.get_php_resource.php index c3694f88..f0541be7 100644 --- a/libs/plugins/core.get_php_resource.php +++ b/libs/core/core.get_php_resource.php @@ -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; } diff --git a/libs/plugins/core.is_secure.php b/libs/core/core.is_secure.php similarity index 100% rename from libs/plugins/core.is_secure.php rename to libs/core/core.is_secure.php diff --git a/libs/plugins/core.is_trusted.php b/libs/core/core.is_trusted.php similarity index 100% rename from libs/plugins/core.is_trusted.php rename to libs/core/core.is_trusted.php diff --git a/libs/plugins/core.load_plugins.php b/libs/core/core.load_plugins.php similarity index 100% rename from libs/plugins/core.load_plugins.php rename to libs/core/core.load_plugins.php diff --git a/libs/plugins/core.load_resource_plugin.php b/libs/core/core.load_resource_plugin.php similarity index 100% rename from libs/plugins/core.load_resource_plugin.php rename to libs/core/core.load_resource_plugin.php diff --git a/libs/plugins/core.parse_file_path.php b/libs/core/core.parse_file_path.php similarity index 89% rename from libs/plugins/core.parse_file_path.php rename to libs/core/core.parse_file_path.php index 7ef59d97..c4ea6e1b 100644 --- a/libs/plugins/core.parse_file_path.php +++ b/libs/core/core.parse_file_path.php @@ -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; diff --git a/libs/plugins/core.process_cached_inserts.php b/libs/core/core.process_cached_inserts.php similarity index 78% rename from libs/plugins/core.process_cached_inserts.php rename to libs/core/core.process_cached_inserts.php index ba12dad6..7ebfdfd9 100644 --- a/libs/plugins/core.process_cached_inserts.php +++ b/libs/core/core.process_cached_inserts.php @@ -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); } } diff --git a/libs/plugins/core.read_cache_file.php b/libs/core/core.read_cache_file.php similarity index 96% rename from libs/plugins/core.read_cache_file.php rename to libs/core/core.read_cache_file.php index cc136a73..be02d714 100644 --- a/libs/plugins/core.read_cache_file.php +++ b/libs/core/core.read_cache_file.php @@ -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; diff --git a/libs/plugins/core.rm_auto.php b/libs/core/core.rm_auto.php similarity index 87% rename from libs/plugins/core.rm_auto.php rename to libs/core/core.rm_auto.php index 0efb6750..31b5dc05 100644 --- a/libs/plugins/core.rm_auto.php +++ b/libs/core/core.rm_auto.php @@ -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']); diff --git a/libs/plugins/core.rmdir.php b/libs/core/core.rmdir.php similarity index 93% rename from libs/plugins/core.rmdir.php rename to libs/core/core.rmdir.php index 23fcb6eb..cea9199e 100644 --- a/libs/plugins/core.rmdir.php +++ b/libs/core/core.rmdir.php @@ -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']); diff --git a/libs/plugins/core.run_insert_handler.php b/libs/core/core.run_insert_handler.php similarity index 82% rename from libs/plugins/core.run_insert_handler.php rename to libs/core/core.run_insert_handler.php index 5cacaa89..5c32f9a3 100644 --- a/libs/plugins/core.run_insert_handler.php +++ b/libs/core/core.run_insert_handler.php @@ -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"])) { diff --git a/libs/plugins/core.smarty_include.php b/libs/core/core.smarty_include.php similarity index 86% rename from libs/plugins/core.smarty_include.php rename to libs/core/core.smarty_include.php index e9d6930b..c8f78314 100644 --- a/libs/plugins/core.smarty_include.php +++ b/libs/core/core.smarty_include.php @@ -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) { diff --git a/libs/plugins/core.smarty_include_php.php b/libs/core/core.smarty_include_php.php similarity index 93% rename from libs/plugins/core.smarty_include_php.php rename to libs/core/core.smarty_include_php.php index c8d551af..66436f95 100644 --- a/libs/plugins/core.smarty_include_php.php +++ b/libs/core/core.smarty_include_php.php @@ -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']; diff --git a/libs/plugins/core.write_cache_file.php b/libs/core/core.write_cache_file.php similarity index 95% rename from libs/plugins/core.write_cache_file.php rename to libs/core/core.write_cache_file.php index a99555e6..ea95dcac 100644 --- a/libs/plugins/core.write_cache_file.php +++ b/libs/core/core.write_cache_file.php @@ -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; } } diff --git a/libs/plugins/core.write_compiled_template.php b/libs/core/core.write_compiled_template.php similarity index 91% rename from libs/plugins/core.write_compiled_template.php rename to libs/core/core.write_compiled_template.php index e5d983ff..60527ade 100644 --- a/libs/plugins/core.write_compiled_template.php +++ b/libs/core/core.write_compiled_template.php @@ -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; } diff --git a/libs/plugins/core.write_file.php b/libs/core/core.write_file.php similarity index 89% rename from libs/plugins/core.write_file.php rename to libs/core/core.write_file.php index b3a8c603..c706be1c 100644 --- a/libs/plugins/core.write_file.php +++ b/libs/core/core.write_file.php @@ -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