mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-04 18:34:27 +02:00
moved _fetch_resource_info and _parse_resource_name back into Smarty.class.php
renamed smarty_include and smarty_eval wrappers to _include and _eval
This commit is contained in:
@@ -1099,8 +1099,7 @@ class Smarty
|
|||||||
function template_exists($tpl_file)
|
function template_exists($tpl_file)
|
||||||
{
|
{
|
||||||
$_params = array('resource_name' => $tpl_file);
|
$_params = array('resource_name' => $tpl_file);
|
||||||
require_once(SMARTY_DIR . 'core' . DIRECTORY_SEPARATOR . 'core.fetch_resource_info.php');
|
return $this->_fetch_resource_info($_params);
|
||||||
return smarty_core_fetch_resource_info($_params, $this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1460,9 +1459,8 @@ class Smarty
|
|||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
// get file source and timestamp
|
// get file source and timestamp
|
||||||
require_once(SMARTY_DIR . 'core' . DIRECTORY_SEPARATOR . 'core.fetch_resource_info.php');
|
|
||||||
$_params = array('resource_name' => $resource_name);
|
$_params = array('resource_name' => $resource_name);
|
||||||
if (!smarty_core_fetch_resource_info($_params, $this)) {
|
if (!$this->_fetch_resource_info($_params, $this)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if ($_params['resource_timestamp'] <= filemtime($compile_path)) {
|
if ($_params['resource_timestamp'] <= filemtime($compile_path)) {
|
||||||
@@ -1490,8 +1488,7 @@ class Smarty
|
|||||||
{
|
{
|
||||||
|
|
||||||
$_params = array('resource_name' => $resource_name);
|
$_params = array('resource_name' => $resource_name);
|
||||||
require_once(SMARTY_DIR . 'core' . DIRECTORY_SEPARATOR . 'core.fetch_resource_info.php');
|
if (!$this->_fetch_resource_info($_params)) {
|
||||||
if (!smarty_core_fetch_resource_info($_params, $this)) {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1595,6 +1592,153 @@ class Smarty
|
|||||||
$this->_compile_id) . '.php';
|
$this->_compile_id) . '.php';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* fetch the template info. Gets timestamp, and source
|
||||||
|
* if get_source is true
|
||||||
|
*
|
||||||
|
* sets $source_content to the source of the template, and
|
||||||
|
* $resource_timestamp to its time stamp
|
||||||
|
* @param string $resource_name
|
||||||
|
* @param string $source_content
|
||||||
|
* @param integer $resource_timestamp
|
||||||
|
* @param boolean $get_source
|
||||||
|
* @param boolean $quiet
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
|
||||||
|
function _fetch_resource_info(&$params)
|
||||||
|
{
|
||||||
|
|
||||||
|
if(!isset($params['get_source'])) { $params['get_source'] = true; }
|
||||||
|
if(!isset($params['quiet'])) { $params['quiet'] = false; }
|
||||||
|
|
||||||
|
$_return = false;
|
||||||
|
$_params = array('resource_name' => $params['resource_name']) ;
|
||||||
|
if ($this->_parse_resource_name($_params)) {
|
||||||
|
$_resource_type = $_params['resource_type'];
|
||||||
|
$_resource_name = $_params['resource_name'];
|
||||||
|
switch ($_resource_type) {
|
||||||
|
case 'file':
|
||||||
|
if ($params['get_source']) {
|
||||||
|
$params['source_content'] = $this->_read_file($_resource_name);
|
||||||
|
}
|
||||||
|
$params['resource_timestamp'] = filemtime($_resource_name);
|
||||||
|
$_return = true;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
// call resource functions to fetch the template source and timestamp
|
||||||
|
if ($params['get_source']) {
|
||||||
|
$_source_return = isset($this->_plugins['resource'][$_resource_type]) &&
|
||||||
|
call_user_func_array($this->_plugins['resource'][$_resource_type][0][0],
|
||||||
|
array($_resource_name, &$params['source_content'], &$this));
|
||||||
|
} else {
|
||||||
|
$_source_return = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
$_timestamp_return = isset($this->_plugins['resource'][$_resource_type]) &&
|
||||||
|
call_user_func_array($this->_plugins['resource'][$_resource_type][0][1],
|
||||||
|
array($_resource_name, &$params['resource_timestamp'], &$this));
|
||||||
|
|
||||||
|
$_return = $_source_return && $_timestamp_return;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$_return) {
|
||||||
|
// see if we can get a template with the default template handler
|
||||||
|
if (!empty($this->default_template_handler_func)) {
|
||||||
|
if (!$this->_plugin_implementation_exists($this->default_template_handler_func)) {
|
||||||
|
$this->trigger_error("default template handler function \"$this->default_template_handler_func\" doesn't exist.");
|
||||||
|
} else {
|
||||||
|
$_return = call_user_func_array(
|
||||||
|
$this->default_template_handler_func,
|
||||||
|
array($_resource_type, $_resource_name, &$params['source_content'], &$params['resource_timestamp'], &$this));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$_return) {
|
||||||
|
if (!$params['quiet']) {
|
||||||
|
$this->trigger_error('unable to read resource: "' . $params['resource_name'] . '"');
|
||||||
|
}
|
||||||
|
} else if ($_return && $this->security) {
|
||||||
|
require_once(SMARTY_DIR . 'core' . DIRECTORY_SEPARATOR . 'core.is_secure.php');
|
||||||
|
if (!smarty_core_is_secure($_params, $this)) {
|
||||||
|
if (!$params['quiet'])
|
||||||
|
$this->trigger_error('(secure mode) accessing "' . $params['resource_name'] . '" is not allowed');
|
||||||
|
$params['source_content'] = null;
|
||||||
|
$params['resource_timestamp'] = null;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $_return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* parse out the type and name from the resource
|
||||||
|
*
|
||||||
|
* @param string $resource_base_path
|
||||||
|
* @param string $resource_name
|
||||||
|
* @param string $resource_type
|
||||||
|
* @param string $resource_name
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
|
||||||
|
function _parse_resource_name(&$params)
|
||||||
|
{
|
||||||
|
|
||||||
|
// split tpl_path by the first colon
|
||||||
|
$_resource_name_parts = explode(':', $params['resource_name'], 2);
|
||||||
|
|
||||||
|
if (count($_resource_name_parts) == 1) {
|
||||||
|
// no resource type given
|
||||||
|
$params['resource_type'] = $this->default_resource_type;
|
||||||
|
$params['resource_name'] = $_resource_name_parts[0];
|
||||||
|
} else {
|
||||||
|
if(strlen($_resource_name_parts[0]) == 1) {
|
||||||
|
// 1 char is not resource type, but part of filepath
|
||||||
|
$params['resource_type'] = $this->default_resource_type;
|
||||||
|
$params['resource_name'] = $params['resource_name'];
|
||||||
|
} else {
|
||||||
|
$params['resource_type'] = $_resource_name_parts[0];
|
||||||
|
$params['resource_name'] = $_resource_name_parts[1];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($params['resource_type'] == 'file') {
|
||||||
|
if (!preg_match("/^([\/\\\\]|[a-zA-Z]:[\/\\\\])/", $params['resource_name'])) {
|
||||||
|
// relative pathname to $params['resource_base_path']
|
||||||
|
// use the first directory where the file is found
|
||||||
|
$_resource_base_path = isset($params['resource_base_path']) ? $params['resource_base_path'] : array($this->template_dir, '.');
|
||||||
|
settype($_resource_base_path, 'array');
|
||||||
|
foreach ($_resource_base_path as $_curr_path) {
|
||||||
|
$_fullpath = $_curr_path . DIRECTORY_SEPARATOR . $params['resource_name'];
|
||||||
|
if (file_exists($_fullpath) && is_file($_fullpath)) {
|
||||||
|
$params['resource_name'] = $_fullpath;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
// didn't find the file, try include_path
|
||||||
|
$_params = array('file_path' => $_fullpath);
|
||||||
|
require_once(SMARTY_DIR . 'core' . DIRECTORY_SEPARATOR . 'core.get_include_path.php');
|
||||||
|
if(smarty_core_get_include_path($_params, $smarty)) {
|
||||||
|
$params['resource_name'] = $_params['new_file_path'];
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$_params = array('type' => $params['resource_type']);
|
||||||
|
require_once(SMARTY_DIR . 'core' . DIRECTORY_SEPARATOR . 'core.load_resource_plugin.php');
|
||||||
|
smarty_core_load_resource_plugin($_params, $this);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle modifiers
|
* Handle modifiers
|
||||||
*
|
*
|
||||||
@@ -1800,7 +1944,7 @@ class Smarty
|
|||||||
* wrapper for include() retaining $this
|
* wrapper for include() retaining $this
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
function smarty_include($filename, $once=false)
|
function _include($filename, $once=false)
|
||||||
{
|
{
|
||||||
if ($once) {
|
if ($once) {
|
||||||
return include_once($filename);
|
return include_once($filename);
|
||||||
@@ -1814,7 +1958,7 @@ class Smarty
|
|||||||
* wrapper for eval() retaining $this
|
* wrapper for eval() retaining $this
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
function smarty_eval($code)
|
function _eval($code)
|
||||||
{
|
{
|
||||||
return eval($code);
|
return eval($code);
|
||||||
}
|
}
|
||||||
|
@@ -40,7 +40,7 @@ function smarty_core_display_debug_console($params, &$smarty)
|
|||||||
if ($smarty->_compile_resource($smarty->debug_tpl, $_compile_path))
|
if ($smarty->_compile_resource($smarty->debug_tpl, $_compile_path))
|
||||||
{
|
{
|
||||||
ob_start();
|
ob_start();
|
||||||
$smarty->smarty_include($_compile_path);
|
$smarty->_include($_compile_path);
|
||||||
$_results = ob_get_contents();
|
$_results = ob_get_contents();
|
||||||
ob_end_clean();
|
ob_end_clean();
|
||||||
} else {
|
} else {
|
||||||
|
@@ -1,93 +0,0 @@
|
|||||||
<?php
|
|
||||||
/**
|
|
||||||
* Smarty plugin
|
|
||||||
* @package Smarty
|
|
||||||
* @subpackage plugins
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* fetch the template info. Gets timestamp, and source
|
|
||||||
* if get_source is true
|
|
||||||
*
|
|
||||||
* sets $source_content to the source of the template, and
|
|
||||||
* $resource_timestamp to its time stamp
|
|
||||||
* @param string $resource_name
|
|
||||||
* @param string $source_content
|
|
||||||
* @param integer $resource_timestamp
|
|
||||||
* @param boolean $get_source
|
|
||||||
* @param boolean $quiet
|
|
||||||
* @return boolean
|
|
||||||
*/
|
|
||||||
|
|
||||||
function smarty_core_fetch_resource_info(&$params, &$smarty)
|
|
||||||
{
|
|
||||||
|
|
||||||
if(!isset($params['get_source'])) { $params['get_source'] = true; }
|
|
||||||
if(!isset($params['quiet'])) { $params['quiet'] = false; }
|
|
||||||
|
|
||||||
$_return = false;
|
|
||||||
$_params = array('resource_name' => $params['resource_name']) ;
|
|
||||||
require_once(SMARTY_DIR . 'core' . DIRECTORY_SEPARATOR . 'core.parse_resource_name.php');
|
|
||||||
if (smarty_core_parse_resource_name($_params, $smarty)) {
|
|
||||||
$_resource_type = $_params['resource_type'];
|
|
||||||
$_resource_name = $_params['resource_name'];
|
|
||||||
switch ($_resource_type) {
|
|
||||||
case 'file':
|
|
||||||
if ($params['get_source']) {
|
|
||||||
$params['source_content'] = $smarty->_read_file($_resource_name);
|
|
||||||
}
|
|
||||||
$params['resource_timestamp'] = filemtime($_resource_name);
|
|
||||||
$_return = true;
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
// call resource functions to fetch the template source and timestamp
|
|
||||||
if ($params['get_source']) {
|
|
||||||
$_source_return = isset($smarty->_plugins['resource'][$_resource_type]) &&
|
|
||||||
call_user_func_array($smarty->_plugins['resource'][$_resource_type][0][0],
|
|
||||||
array($_resource_name, &$params['source_content'], &$smarty));
|
|
||||||
} else {
|
|
||||||
$_source_return = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
$_timestamp_return = isset($smarty->_plugins['resource'][$_resource_type]) &&
|
|
||||||
call_user_func_array($smarty->_plugins['resource'][$_resource_type][0][1],
|
|
||||||
array($_resource_name, &$params['resource_timestamp'], &$smarty));
|
|
||||||
|
|
||||||
$_return = $_source_return && $_timestamp_return;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!$_return) {
|
|
||||||
// see if we can get a template with the default template handler
|
|
||||||
if (!empty($smarty->default_template_handler_func)) {
|
|
||||||
if (!$smarty->_plugin_implementation_exists($smarty->default_template_handler_func)) {
|
|
||||||
$smarty->trigger_error("default template handler function \"$smarty->default_template_handler_func\" doesn't exist.");
|
|
||||||
} else {
|
|
||||||
$_return = call_user_func_array(
|
|
||||||
$smarty->default_template_handler_func,
|
|
||||||
array($_resource_type, $_resource_name, &$params['source_content'], &$params['resource_timestamp'], &$smarty));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
require_once(SMARTY_DIR . 'core' . DIRECTORY_SEPARATOR . 'core.is_secure.php');
|
|
||||||
if (!$_return) {
|
|
||||||
if (!$params['quiet']) {
|
|
||||||
$smarty->trigger_error('unable to read resource: "' . $params['resource_name'] . '"');
|
|
||||||
}
|
|
||||||
} else if ($_return && $smarty->security && !smarty_core_is_secure($_params, $smarty)) {
|
|
||||||
if (!$params['quiet'])
|
|
||||||
$smarty->trigger_error('(secure mode) accessing "' . $params['resource_name'] . '" is not allowed');
|
|
||||||
$params['source_content'] = null;
|
|
||||||
$params['resource_timestamp'] = null;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return $_return;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* vim: set expandtab: */
|
|
||||||
|
|
||||||
?>
|
|
@@ -19,8 +19,7 @@ function smarty_core_get_php_resource(&$params, &$smarty)
|
|||||||
{
|
{
|
||||||
|
|
||||||
$params['resource_base_path'] = $smarty->trusted_dir;
|
$params['resource_base_path'] = $smarty->trusted_dir;
|
||||||
require_once(SMARTY_DIR . 'core' . DIRECTORY_SEPARATOR . 'core.parse_resource_name.php');
|
$smarty->_parse_resource_name($params, $smarty);
|
||||||
smarty_core_parse_resource_name($params, $smarty);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Find out if the resource exists.
|
* Find out if the resource exists.
|
||||||
|
@@ -1,74 +0,0 @@
|
|||||||
<?php
|
|
||||||
/**
|
|
||||||
* Smarty plugin
|
|
||||||
* @package Smarty
|
|
||||||
* @subpackage plugins
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* parse out the type and name from the resource
|
|
||||||
*
|
|
||||||
* @param string $resource_base_path
|
|
||||||
* @param string $resource_name
|
|
||||||
* @param string $resource_type
|
|
||||||
* @param string $resource_name
|
|
||||||
* @return boolean
|
|
||||||
*/
|
|
||||||
|
|
||||||
// $resource_base_path, $resource_name, &$resource_type, &$resource_name
|
|
||||||
|
|
||||||
function smarty_core_parse_resource_name(&$params, &$smarty)
|
|
||||||
{
|
|
||||||
|
|
||||||
// split tpl_path by the first colon
|
|
||||||
$_resource_name_parts = explode(':', $params['resource_name'], 2);
|
|
||||||
|
|
||||||
if (count($_resource_name_parts) == 1) {
|
|
||||||
// no resource type given
|
|
||||||
$params['resource_type'] = $smarty->default_resource_type;
|
|
||||||
$params['resource_name'] = $_resource_name_parts[0];
|
|
||||||
} else {
|
|
||||||
if(strlen($_resource_name_parts[0]) == 1) {
|
|
||||||
// 1 char is not resource type, but part of filepath
|
|
||||||
$params['resource_type'] = $smarty->default_resource_type;
|
|
||||||
$params['resource_name'] = $params['resource_name'];
|
|
||||||
} else {
|
|
||||||
$params['resource_type'] = $_resource_name_parts[0];
|
|
||||||
$params['resource_name'] = $_resource_name_parts[1];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($params['resource_type'] == 'file') {
|
|
||||||
if (!preg_match("/^([\/\\\\]|[a-zA-Z]:[\/\\\\])/", $params['resource_name'])) {
|
|
||||||
// relative pathname to $params['resource_base_path']
|
|
||||||
// use the first directory where the file is found
|
|
||||||
$_resource_base_path = isset($params['resource_base_path']) ? $params['resource_base_path'] : array($smarty->template_dir, '.');
|
|
||||||
settype($_resource_base_path, 'array');
|
|
||||||
foreach ($_resource_base_path as $_curr_path) {
|
|
||||||
$_fullpath = $_curr_path . DIRECTORY_SEPARATOR . $params['resource_name'];
|
|
||||||
if (file_exists($_fullpath) && is_file($_fullpath)) {
|
|
||||||
$params['resource_name'] = $_fullpath;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
// didn't find the file, try include_path
|
|
||||||
$_params = array('file_path' => $_fullpath);
|
|
||||||
require_once(SMARTY_DIR . 'core' . DIRECTORY_SEPARATOR . 'core.get_include_path.php');
|
|
||||||
if(smarty_core_get_include_path($_params, $smarty)) {
|
|
||||||
$params['resource_name'] = $_params['new_file_path'];
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
$_params = array('type' => $params['resource_type']);
|
|
||||||
require_once(SMARTY_DIR . 'core' . DIRECTORY_SEPARATOR . 'core.load_resource_plugin.php');
|
|
||||||
smarty_core_load_resource_plugin($_params, $smarty);
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* vim: set expandtab: */
|
|
||||||
|
|
||||||
?>
|
|
@@ -38,9 +38,9 @@ function smarty_core_process_cached_inserts($params, &$smarty)
|
|||||||
|
|
||||||
|
|
||||||
if ($resource_type == 'file') {
|
if ($resource_type == 'file') {
|
||||||
$smarty->smarty_include($php_resource, true);
|
$smarty->_include($php_resource, true);
|
||||||
} else {
|
} else {
|
||||||
$smarty->smarty_eval($php_resource);
|
$smarty->_eval($php_resource);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -68,10 +68,9 @@ function smarty_core_read_cache_file(&$params, &$smarty)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($smarty->compile_check) {
|
if ($smarty->compile_check) {
|
||||||
require_once(SMARTY_DIR . 'core' . DIRECTORY_SEPARATOR . 'core.fetch_resource_info.php');
|
|
||||||
foreach (array_keys($smarty->_cache_info['template']) as $_template_dep) {
|
foreach (array_keys($smarty->_cache_info['template']) as $_template_dep) {
|
||||||
$_params = array('resource_name' => $_template_dep);
|
$_params = array('resource_name' => $_template_dep);
|
||||||
smarty_core_fetch_resource_info($_params, $smarty);
|
$smarty->_fetch_resource_info($_params);
|
||||||
if ($smarty->_cache_info['timestamp'] < $_params['resource_timestamp']) {
|
if ($smarty->_cache_info['timestamp'] < $_params['resource_timestamp']) {
|
||||||
// template file has changed, regenerate cache
|
// template file has changed, regenerate cache
|
||||||
return false;
|
return false;
|
||||||
@@ -79,10 +78,9 @@ function smarty_core_read_cache_file(&$params, &$smarty)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (isset($smarty->_cache_info['config'])) {
|
if (isset($smarty->_cache_info['config'])) {
|
||||||
require_once(SMARTY_DIR . 'core' . DIRECTORY_SEPARATOR . 'core.fetch_resource_info.php');
|
|
||||||
foreach (array_keys($smarty->_cache_info['config']) as $_config_dep) {
|
foreach (array_keys($smarty->_cache_info['config']) as $_config_dep) {
|
||||||
$_params = array('resource_name' => $_config_dep);
|
$_params = array('resource_name' => $_config_dep);
|
||||||
smarty_core_fetch_resource_info($_params, $smarty);
|
$smarty->_fetch_resource_info($_params);
|
||||||
if ($smarty->_cache_info['timestamp'] < $_params['resource_timestamp']) {
|
if ($smarty->_cache_info['timestamp'] < $_params['resource_timestamp']) {
|
||||||
// config file has changed, regenerate cache
|
// config file has changed, regenerate cache
|
||||||
return false;
|
return false;
|
||||||
@@ -93,7 +91,7 @@ function smarty_core_read_cache_file(&$params, &$smarty)
|
|||||||
|
|
||||||
foreach ($smarty->_cache_info['cache_serials'] as $_include_file_path=>$_cache_serial) {
|
foreach ($smarty->_cache_info['cache_serials'] as $_include_file_path=>$_cache_serial) {
|
||||||
if (empty($smarty->_cache_serials[$_include_file_path])) {
|
if (empty($smarty->_cache_serials[$_include_file_path])) {
|
||||||
$smarty->smarty_include($_include_file_path, true);
|
$smarty->_include($_include_file_path, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($smarty->_cache_serials[$_include_file_path] != $_cache_serial) {
|
if ($smarty->_cache_serials[$_include_file_path] != $_cache_serial) {
|
||||||
|
@@ -40,9 +40,9 @@ function smarty_core_run_insert_handler($params, &$smarty)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($_params['resource_type'] == 'file') {
|
if ($_params['resource_type'] == 'file') {
|
||||||
$smarty->smarty_include_once($_params['php_resource']);
|
$smarty->_include($_params['php_resource'], true);
|
||||||
} else {
|
} else {
|
||||||
$smarty->smarty_eval($_params['php_resource']);
|
$smarty->_eval($_params['php_resource']);
|
||||||
}
|
}
|
||||||
unset($params['args']['script']);
|
unset($params['args']['script']);
|
||||||
}
|
}
|
||||||
|
@@ -38,7 +38,7 @@ function smarty_core_smarty_include($params, &$smarty)
|
|||||||
if ($smarty->_is_compiled($params['smarty_include_tpl_file'], $_smarty_compile_path)
|
if ($smarty->_is_compiled($params['smarty_include_tpl_file'], $_smarty_compile_path)
|
||||||
|| $smarty->_compile_resource($params['smarty_include_tpl_file'], $_smarty_compile_path))
|
|| $smarty->_compile_resource($params['smarty_include_tpl_file'], $_smarty_compile_path))
|
||||||
{
|
{
|
||||||
$smarty->smarty_include($_smarty_compile_path);
|
$smarty->_include($_smarty_compile_path);
|
||||||
}
|
}
|
||||||
|
|
||||||
// pop the local vars off the front of the stack
|
// pop the local vars off the front of the stack
|
||||||
|
@@ -31,17 +31,17 @@ function smarty_core_smarty_include_php($params, &$smarty)
|
|||||||
if (!empty($params['smarty_assign'])) {
|
if (!empty($params['smarty_assign'])) {
|
||||||
ob_start();
|
ob_start();
|
||||||
if ($_smarty_resource_type == 'file') {
|
if ($_smarty_resource_type == 'file') {
|
||||||
$smarty->smarty_include($_smarty_php_resource, $params['smarty_once']);
|
$smarty->_include($_smarty_php_resource, $params['smarty_once']);
|
||||||
} else {
|
} else {
|
||||||
$smarty->smarty_eval($_smarty_php_resource);
|
$smarty->_eval($_smarty_php_resource);
|
||||||
}
|
}
|
||||||
$smarty->assign($params['smarty_assign'], ob_get_contents());
|
$smarty->assign($params['smarty_assign'], ob_get_contents());
|
||||||
ob_end_clean();
|
ob_end_clean();
|
||||||
} else {
|
} else {
|
||||||
if ($_smarty_resource_type == 'file') {
|
if ($_smarty_resource_type == 'file') {
|
||||||
$smarty->smarty_include($_smarty_php_resource, $params['smarty_once']);
|
$smarty->_include($_smarty_php_resource, $params['smarty_once']);
|
||||||
} else {
|
} else {
|
||||||
$smarty->smarty_eval($_smarty_php_resource);
|
$smarty->_eval($_smarty_php_resource);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -32,7 +32,7 @@ function smarty_function_eval($params, &$smarty)
|
|||||||
$smarty->_compile_source('evaluated template', $params['var'], $_var_compiled);
|
$smarty->_compile_source('evaluated template', $params['var'], $_var_compiled);
|
||||||
|
|
||||||
ob_start();
|
ob_start();
|
||||||
$smarty->smarty_eval('?>' . $_var_compiled);
|
$smarty->_eval('?>' . $_var_compiled);
|
||||||
$_contents = ob_get_contents();
|
$_contents = ob_get_contents();
|
||||||
ob_end_clean();
|
ob_end_clean();
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user