mirror of
https://github.com/smarty-php/smarty.git
synced 2026-05-03 19:30:49 +02:00
extincting $this out of smarty_core_*-functions
This commit is contained in:
@@ -11,26 +11,26 @@
|
||||
* @param string $results
|
||||
* @return string
|
||||
*/
|
||||
function smarty_core_process_cached_inserts($params, &$this)
|
||||
function smarty_core_process_cached_inserts($params, &$smarty)
|
||||
{
|
||||
preg_match_all('!'.$this->_smarty_md5.'{insert_cache (.*)}'.$this->_smarty_md5.'!Uis',
|
||||
preg_match_all('!'.$smarty->_smarty_md5.'{insert_cache (.*)}'.$smarty->_smarty_md5.'!Uis',
|
||||
$params['results'], $match);
|
||||
list($cached_inserts, $insert_args) = $match;
|
||||
|
||||
for ($i = 0, $for_max = count($cached_inserts); $i < $for_max; $i++) {
|
||||
if ($this->debugging) {
|
||||
if ($smarty->debugging) {
|
||||
$_params = array();
|
||||
require_once(SMARTY_DIR . 'core' . DIRECTORY_SEPARATOR . 'core.get_microtime.php');
|
||||
$debug_start_time = smarty_core_get_microtime($_params, $this);
|
||||
$debug_start_time = smarty_core_get_microtime($_params, $smarty);
|
||||
}
|
||||
|
||||
$args = unserialize($insert_args[$i]);
|
||||
$name = $args['name'];
|
||||
|
||||
if (isset($args['script'])) {
|
||||
$_params = array('resource_name' => $this->_dequote($args['script']));
|
||||
$_params = array('resource_name' => $smarty->_dequote($args['script']));
|
||||
require_once(SMARTY_DIR . 'core' . DIRECTORY_SEPARATOR . 'core.get_php_resource.php');
|
||||
if(!smarty_core_get_php_resource($_params, $this)) {
|
||||
if(!smarty_core_get_php_resource($_params, $smarty)) {
|
||||
return false;
|
||||
}
|
||||
$resource_type = $_params['resource_type'];
|
||||
@@ -38,23 +38,23 @@ function smarty_core_process_cached_inserts($params, &$this)
|
||||
|
||||
|
||||
if ($resource_type == 'file') {
|
||||
include_once($php_resource);
|
||||
$smarty->smarty_include($php_resource, true);
|
||||
} else {
|
||||
eval($php_resource);
|
||||
$smarty->smarty_eval($php_resource);
|
||||
}
|
||||
}
|
||||
|
||||
$function_name = $this->_plugins['insert'][$name][0];
|
||||
$replace = $function_name($args, $this);
|
||||
$function_name = $smarty->_plugins['insert'][$name][0];
|
||||
$replace = $function_name($args, $smarty);
|
||||
|
||||
$params['results'] = str_replace($cached_inserts[$i], $replace, $params['results']);
|
||||
if ($this->debugging) {
|
||||
if ($smarty->debugging) {
|
||||
$_params = array();
|
||||
require_once(SMARTY_DIR . 'core' . DIRECTORY_SEPARATOR . 'core.get_microtime.php');
|
||||
$this->_smarty_debug_info[] = array('type' => 'insert',
|
||||
$smarty->_smarty_debug_info[] = array('type' => 'insert',
|
||||
'filename' => 'insert_'.$name,
|
||||
'depth' => $this->_inclusion_depth,
|
||||
'exec_time' => smarty_core_get_microtime($_params, $this) - $debug_start_time);
|
||||
'depth' => $smarty->_inclusion_depth,
|
||||
'exec_time' => smarty_core_get_microtime($_params, $smarty) - $debug_start_time);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user