public function parse($str = null, $initialVariables = null)
{
if (is_array($str)) {
$initialVariables = $str;
$str = null;
}
$oldVars = $this->registeredVars;
if ($initialVariables !== null) {
$this->setVariables($initialVariables);
}
if ($str == null) {
if (empty($this->_parseFile)) {
throw new exception("nothing to parse");
}
$out = $this->compileFile($this->_parseFile);
} else {
$out = $this->compile($str);
}
$this->registeredVars = $oldVars;
return $out;
}