check for set variables

This commit is contained in:
Daniel Seifert 2018-07-19 20:31:47 +02:00
parent 50caa843f3
commit d73c036e5a

View File

@ -125,13 +125,16 @@ class d3DocumentRenderer implements BlockRendererInterface
$daux = new Daux(Daux::STATIC_MODE, $output); $daux = new Daux(Daux::STATIC_MODE, $output);
$daux->initializeConfiguration(); $daux->initializeConfiguration();
$variables = $daux->getParams()['variables']; $params = $daux->getParams();
if (isset($params['variables'])) {
$variables = $params['variables'];
if (isset($variables) && is_array($variables) && count($variables)) { if (isset($variables) && is_array($variables) && count($variables)) {
foreach ($variables as $varname => $varvalue) { foreach ($variables as $varname => $varvalue) {
$pattern = '/{\$'.$varname.'}/mU'; $pattern = '/{\$'.$varname.'}/mU';
$wholeDoc = preg_replace($pattern, $varvalue, $wholeDoc); $wholeDoc = preg_replace($pattern, $varvalue, $wholeDoc);
} }
} }
}
return $wholeDoc === '' ? '' : $wholeDoc . "\n"; return $wholeDoc === '' ? '' : $wholeDoc . "\n";
} }