Upgraded to latest version of Smarty 2.6.9

This commit is contained in:
thepurpleblob
2005-04-19 09:52:16 +00:00
parent f55a672eea
commit c38950b11b
49 changed files with 678 additions and 510 deletions
+25 -11
View File
@@ -8,8 +8,8 @@
/**
* Smarty {config_load} function plugin
*
* Type: function<br />
* Name: config_load<br />
* Type: function<br>
* Name: config_load<br>
* Purpose: load config file vars
* @link http://smarty.php.net/manual/en/language.function.config.load.php {config_load}
* (Smarty online manual)
@@ -26,7 +26,7 @@ function smarty_function_config_load($params, &$smarty)
{
if ($smarty->debugging) {
$_params = array();
require_once(SMARTY_DIR . 'core' . DIRECTORY_SEPARATOR . 'core.get_microtime.php');
require_once(SMARTY_CORE_DIR . 'core.get_microtime.php');
$_debug_start_time = smarty_core_get_microtime($_params, $smarty);
}
@@ -53,7 +53,9 @@ function smarty_function_config_load($params, &$smarty)
}
}
$_params = array('resource_name' => $_file, 'resource_base_path' => $smarty->config_dir);
$_params = array('resource_name' => $_file,
'resource_base_path' => $smarty->config_dir,
'get_source' => false);
$smarty->_parse_resource_name($_params);
$_file_path = $_params['resource_type'] . ':' . $_params['resource_name'];
if (isset($_section))
@@ -61,10 +63,19 @@ function smarty_function_config_load($params, &$smarty)
else
$_compile_file = $smarty->_get_compile_path($_file_path);
if($smarty->force_compile
|| !file_exists($_compile_file)
|| ($smarty->compile_check
&& !$smarty->_is_compiled($_file_path, $_compile_file))) {
if($smarty->force_compile || !file_exists($_compile_file)) {
$_compile = true;
} elseif ($smarty->compile_check) {
$_params = array('resource_name' => $_file,
'resource_base_path' => $smarty->config_dir,
'get_source' => false);
$_compile = $smarty->_fetch_resource_info($_params) &&
$_params['resource_timestamp'] > filemtime($_compile_file);
} else {
$_compile = false;
}
if($_compile) {
// compile config file
if(!is_object($smarty->_conf_obj)) {
require_once SMARTY_DIR . $smarty->config_class . '.class.php';
@@ -74,7 +85,10 @@ function smarty_function_config_load($params, &$smarty)
$smarty->_conf_obj->read_hidden = $smarty->config_read_hidden;
$smarty->_conf_obj->fix_newlines = $smarty->config_fix_newlines;
}
$_params = array('resource_name' => $_file, 'resource_base_path' => $smarty->config_dir);
$_params = array('resource_name' => $_file,
'resource_base_path' => $smarty->config_dir,
$_params['get_source'] = true);
if (!$smarty->_fetch_resource_info($_params)) {
return;
}
@@ -87,7 +101,7 @@ function smarty_function_config_load($params, &$smarty)
$_output = '<?php $_config_vars = unserialize(\'' . strtr(serialize($_config_vars),array('\''=>'\\\'', '\\'=>'\\\\')) . '\'); ?>';
}
$_params = (array('compile_path' => $_compile_file, 'compiled_content' => $_output, 'resource_timestamp' => $_params['resource_timestamp']));
require_once(SMARTY_DIR . 'core' . DIRECTORY_SEPARATOR . 'core.write_compiled_resource.php');
require_once(SMARTY_CORE_DIR . 'core.write_compiled_resource.php');
smarty_core_write_compiled_resource($_params, $smarty);
} else {
include($_compile_file);
@@ -112,7 +126,7 @@ function smarty_function_config_load($params, &$smarty)
if ($smarty->debugging) {
$_params = array();
require_once(SMARTY_DIR . 'core' . DIRECTORY_SEPARATOR . 'core.get_microtime.php');
require_once(SMARTY_CORE_DIR . 'core.get_microtime.php');
$smarty->_smarty_debug_info[] = array('type' => 'config',
'filename' => $_file.' ['.$_section.'] '.$_scope,
'depth' => $smarty->_inclusion_depth,