15 static function configLoad($obj, $config_file, $sections = null, $scope =
'local')
17 $smarty = isset($obj->smarty) ? $obj->smarty : $obj;
18 $confObj =
new $smarty->template_class($config_file, $smarty, $obj);
21 $confObj->source->config_sections = $sections;
22 $confObj->source->scope = $scope;
24 if ($confObj->smarty->debugging) {
27 $confObj->compiled->render($confObj);
28 if ($confObj->smarty->debugging) {
32 $obj->properties[
'file_dependency'][$confObj->source->uid] = array($confObj->source->filepath, $confObj->source->timestamp, $confObj->source->type);
46 $scope = $_template->source->scope;
48 $scope_ptr = $_template->parent;
49 if ($scope ==
'parent') {
50 if (isset($_template->parent->parent)) {
51 $scope_ptr = $_template->parent->parent;
53 } elseif ($scope ==
'root' || $scope ==
'global') {
54 while (isset($scope_ptr->parent)) {
55 $scope_ptr = $scope_ptr->parent;
59 foreach ($_config_vars[
'vars'] as $variable => $value) {
60 if ($_template->smarty->config_overwrite || !isset($scope_ptr->config_vars[$variable])) {
61 $scope_ptr->config_vars[$variable] = $value;
63 $scope_ptr->config_vars[$variable] = array_merge((array) $scope_ptr->config_vars[$variable], (array) $value);
67 $sections = $_template->source->config_sections;
68 if (!empty($sections)) {
69 foreach ((array) $sections as $_template_section) {
70 if (isset($_config_vars[
'sections'][$_template_section])) {
71 foreach ($_config_vars[
'sections'][$_template_section][
'vars'] as $variable => $value) {
72 if ($_template->smarty->config_overwrite || !isset($scope_ptr->config_vars[$variable])) {
73 $scope_ptr->config_vars[$variable] = $value;
75 $scope_ptr->config_vars[$variable] = array_merge((array) $scope_ptr->config_vars[$variable], (array) $value);
91 static function getConfigVars($obj, $varname = null, $search_parents =
true)
95 while ($_ptr !== null) {
96 if (isset($varname)) {
97 if (isset($_ptr->config_vars[$varname])) {
98 return $_ptr->config_vars[$varname];
101 $var_array = array_merge($_ptr->config_vars, $var_array);
104 if ($search_parents) {
105 $_ptr = $_ptr->parent;
110 if (isset($varname)) {
128 while ($_ptr !== null) {
129 if (isset($_ptr->config_vars[$variable])) {
131 return $_ptr->config_vars[$variable];
134 $_ptr = $_ptr->parent;
136 if ($obj->error_unassigned && $error_enable) {
154 unset($obj->config_vars[$name]);
156 $obj->config_vars = array();