cvs: smarty / NEWS /libs/plugins function.config_load.php
"Messju Mohr" <[email protected]>
| Newsgroups | gmane.comp.php.cvs.smarty |
|---|---|
| Message-ID | <cvsmessju1074705687@cvsserver> |
messju Wed Jan 21 12:21:27 2004 EDT
Modified files:
/smarty NEWS
/smarty/libs/plugins function.config_load.php
Log:
added handling of resources for {config_load}
http://cvs.php.net/diff.php/smarty/NEWS?r1=1.429&r2=1.430&ty=u
Index: smarty/NEWS
diff -u smarty/NEWS:1.429 smarty/NEWS:1.430
--- smarty/NEWS:1.429 Mon Jan 19 07:47:59 2004
+++ smarty/NEWS Wed Jan 21 12:21:26 2004
@@ -1,3 +1,4 @@
+ - add handling of resources for {config_load} (messju)
- fix bug when using arrays with tr_attr and td_attr in {html_table} (messju)
- add unit testing to cvs core (Monte)
http://cvs.php.net/diff.php/smarty/libs/plugins/function.config_load.php?r1=1.19&r2=1.20&ty=u
Index: smarty/libs/plugins/function.config_load.php
diff -u smarty/libs/plugins/function.config_load.php:1.19 smarty/libs/plugins/function.config_load.php:1.20
--- smarty/libs/plugins/function.config_load.php:1.19 Fri Dec 12 14:45:11 2003
+++ smarty/libs/plugins/function.config_load.php Wed Jan 21 12:21:26 2004
@@ -53,17 +53,9 @@
}
}
- if(@is_dir($smarty->config_dir)) {
- $_config_dir = $smarty->config_dir;
- } else {
- // config_dir not found, try include_path
- $_params = array('file_path' => $smarty->config_dir);
- require_once(SMARTY_DIR . 'core' . DIRECTORY_SEPARATOR . 'core.get_include_path.php');
- smarty_core_get_include_path($_params, $smarty);
- $_config_dir = $_params['new_file_path'];
- }
-
- $_file_path = $_config_dir . DIRECTORY_SEPARATOR . $_file;
+ $_params = array('resource_name' => $_file, 'resource_base_path' => $smarty->config_dir);
+ $smarty->_parse_resource_name($_params);
+ $_file_path = $_params['resource_type'] . ':' . $_params['resource_name'];
if (isset($_section))
$_compile_file = $smarty->_get_compile_path($_file_path.'|'.$_section);
else
@@ -76,13 +68,15 @@
// compile config file
if(!is_object($smarty->_conf_obj)) {
require_once SMARTY_DIR . $smarty->config_class . '.class.php';
- $smarty->_conf_obj = new $smarty->config_class($_config_dir);
+ $smarty->_conf_obj = new $smarty->config_class();
$smarty->_conf_obj->overwrite = $smarty->config_overwrite;
$smarty->_conf_obj->booleanize = $smarty->config_booleanize;
$smarty->_conf_obj->read_hidden = $smarty->config_read_hidden;
$smarty->_conf_obj->fix_newlines = $smarty->config_fix_newlines;
}
- $smarty->_conf_obj->set_path($_config_dir);
+ $_params = array('resource_name' => $_file, 'resource_base_path' => $smarty->config_dir);
+ $smarty->_fetch_resource_info($_params);
+ $smarty->_conf_obj->set_file_contents($_file, $_params['source_content']);
$_config_vars = array_merge($smarty->_conf_obj->get($_file),
$smarty->_conf_obj->get($_file, $_section));
if(function_exists('var_export')) {
@@ -90,7 +84,7 @@
} else {
$_output = '<?php $_config_vars = unserialize(\'' . strtr(serialize($_config_vars),array('\''=>'\\\'', '\\'=>'\\\\')) . '\'); ?>';
}
- $_params = (array('compile_path' => $_compile_file, 'compiled_content' => $_output, 'resource_timestamp' => filemtime($_file_path)));
+ $_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');
smarty_core_write_compiled_resource($_params, $smarty);
} else {
--
Smarty CVS Mailing List (http://cvs.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php