function compileTemplate($template, $ignore) { $tp = new CBTProcessor($template, $this, $ignore); $tp->mFunctionCache = $this->mFunctionCache; $this->mCompiling = true; $compiled = $tp->compile(); $this->mCompiling = false; if ($tp->getLastError()) { // If there was a compile error, don't save the template // Instead just print the error and exit echo $compiled; wfErrorExit(); } $this->mFunctionCache = $tp->mFunctionCache; return $compiled; }
/** If the value is a template, execute it */ function execute(&$processor) { if ($this->mIsTemplate) { $myProcessor = new CBTProcessor($this->mText, $processor->mFunctionObj, $processor->mIgnorableDeps); $myProcessor->mCompiling = $processor->mCompiling; $val = $myProcessor->doText(0, strlen($this->mText)); if ($myProcessor->getLastError()) { $processor->error($myProcessor->getLastError()); $this->mText = ''; } else { $this->mText = $val->mText; $this->addDeps($val); } if (!$processor->mCompiling) { $this->mIsTemplate = false; } } }