}
function read_config_file ($file) {
- $sections = parse_ini_file ($file, true) ;
- foreach ($sections as $section => $options) {
- if (!isset (self::$instance->settings[$section]))
- continue ;
- foreach ($options as $var => $value) {
- if (!isset (self::$instance->settings[$section][$var]))
- continue ;
- self::$instance->settings[$section][$var] = $value ;
+ if (file_exists($file)) {
+ $sections = parse_ini_file ($file, true) ;
+ if(is_array($is)) {
+ foreach ($sections as $section => $options) {
+ if (!isset (self::$instance->settings[$section]))
+ continue ;
+ foreach ($options as $var => $value) {
+ if (!isset (self::$instance->settings[$section][$var]))
+ continue ;
+ self::$instance->settings[$section][$var] = $value ;
+ }
+ }
}
}
return ;
$fusionforge_config = new FusionForgeConfig () ;
}
-function forge_get_config ($var, $section = NULL) {
+function forge_get_config ($var, $section = 'core') {
$c = FusionForgeConfig::get_instance () ;
-
- if ($section == NULL) {
- $section = 'core' ;
- }
-
return $c->get_value ($section, $var) ;
}
return $ret ;
}
-function fusionforge_set_vars_from_config () {
+function forge_set_vars_from_config () {
$c = FusionForgeConfig::get_instance () ;
foreach (func_get_args() as $item) {
- $section = NULL ;
if (is_array ($item)) {
$var = $item[0] ;
$x = $var ;
if (isset ($item[1])) {
$section = $item[1] ;
$x = $section.'__'.$var ;
+ $value = forge_get_config ($var, $section) ;
}
} else {
$var = $item ;
$x = $item ;
+ $value = forge_get_config ($var) ;
}
global $$x ;
- $$x = forge_get_config ($var, $section) ;
+ $$x = $value ;
}
}
-function fusionforge_define_config_item ($var, $section, $default) {
+function forge_define_config_item ($var, $section, $default) {
$c = FusionForgeConfig::get_instance () ;
return $c->set_value ($section, $var, $default) ;
}
-function fusionforge_read_config_file ($file) {
+function forge_read_config_file ($file) {
$c = FusionForgeConfig::get_instance () ;
return $c->read_config_file ($file) ;