Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed some config file property expansion issues. #51

Merged
merged 2 commits into from
Feb 7, 2012
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/config/GlobalConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,15 +122,15 @@ protected function runResolver($ctx) {
}
}

foreach($ctx->query('*[not(name()="property")]/@*') as $attr) {
foreach($ctx->query('//*[not(name()="property")]/@*') as $attr) {
$attr->nodeValue = $this->resolveValue($attr->nodeValue, $vars);
}

return $ctx;
}

protected function resolveValue($value, Array $vars) {
return preg_replace_callback('/\${(.*)}/', function($matches) use ($vars) { var_dump($matches); return isset($vars[$matches[1]]) ? $vars[$matches[1]] : $matches[0]; }, $value);
return preg_replace_callback('/\${(.*?)}/', function($matches) use ($vars) { return isset($vars[$matches[1]]) ? $vars[$matches[1]] : $matches[0]; }, $value);
}

}
Expand All @@ -141,4 +141,4 @@ class ConfigException extends \Exception {
const NoCollectorSection = 2;
const NoGeneratorSection = 3;
}
}
}