- //* DEBUG: */ $this->debugOutput(__METHOD__.':currGroup=' . $stack . ',idx=' . $index . ',currEntry=' . $currEntry['name'] . ',variableName=' . $variableName);
+ //* DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput(__METHOD__.':currGroup=' . $stack . ',idx=' . $index . ',currEntry=' . $currEntry['name'] . ',variableName=' . $variableName);
- //* DEBUG: */ $this->debugOutput(__METHOD__.': group=' . $stack . ',variableName=' . $variableName . ', content[' . gettype($content) . ']=' . $content);
+ //* DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput(__METHOD__.': group=' . $stack . ',variableName=' . $variableName . ', content[' . gettype($content) . ']=' . $content);
- //* DEBUG: */ $this->debugOutput(__METHOD__.': group=' . $this->currGroup . ', variableName=' . $variableName . ', value=' . $value);
+ //* DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput(__METHOD__.': group=' . $this->currGroup . ', variableName=' . $variableName . ', value=' . $value);
$this->addVariable($variableName, $value);
} elseif (!empty($value)) {
// Modify the stack entry
$this->addVariable($variableName, $value);
} elseif (!empty($value)) {
// Modify the stack entry
- //* DEBUG: */ $this->debugOutput(__METHOD__.': ' . strlen($rawTemplateData) . ' Bytes set.');
- //* DEBUG: */ $this->debugOutput(__METHOD__.': ' . $this->currGroup . ' variables: ' . count($this->getVarStack($this->currGroup)) . ', groups=' . count($this->varStack));
+ //* DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput(__METHOD__.': ' . strlen($rawTemplateData) . ' Bytes set.');
+ //* DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput(__METHOD__.': ' . $this->currGroup . ' variables: ' . count($this->getVarStack($this->currGroup)) . ', groups=' . count($this->varStack));
* @return $rawTemplateData The raw data from the template
*/
public final function getRawTemplateData () {
* @return $rawTemplateData The raw data from the template
*/
public final function getRawTemplateData () {
$ioInstance = $this->getFileIoInstance();
// Some debug code to look on the file which is being loaded
$ioInstance = $this->getFileIoInstance();
// Some debug code to look on the file which is being loaded
- //* NOISY-DEBUG: */ $this->debugOutput(__METHOD__ . ':rawData(' . strlen($rawData) . ')=' . $rawData . ',variableMatches=' . print_r($variableMatches, true));
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput(__METHOD__ . ':rawData(' . strlen($rawData) . ')=' . $rawData . ',variableMatches=' . print_r($variableMatches, true));
// Did we find some variables?
if ((is_array($variableMatches)) && (count($variableMatches) == 4) && (count($variableMatches[0]) > 0)) {
// Did we find some variables?
if ((is_array($variableMatches)) && (count($variableMatches) == 4) && (count($variableMatches[0]) > 0)) {
// RECURSIVE PROTECTION! BE CAREFUL HERE!
if ((!isset($this->loadedRawData[$template])) && (!in_array($template, $this->loadedTemplates))) {
// Debug message
// RECURSIVE PROTECTION! BE CAREFUL HERE!
if ((!isset($this->loadedRawData[$template])) && (!in_array($template, $this->loadedTemplates))) {
// Debug message
// Template not found, but maybe variable assigned?
if ($this->getVariableIndex($template, 'config') !== false) {
// Template not found, but maybe variable assigned?
if ($this->getVariableIndex($template, 'config') !== false) {
$this->assignVariable($var, $varMatches[3][$key]);
} elseif (!empty($varMatches[2][$key])) {
// @TODO Non-string found so we need some deeper analysis...
$this->assignVariable($var, $varMatches[3][$key]);
} elseif (!empty($varMatches[2][$key])) {
// @TODO Non-string found so we need some deeper analysis...
// Are some code-templates found which we need to compile?
if (count($this->loadedRawData) > 0) {
// Then compile all!
foreach ($this->loadedRawData as $template => $code) {
// Debug message
// Are some code-templates found which we need to compile?
if (count($this->loadedRawData) > 0) {
// Then compile all!
foreach ($this->loadedRawData as $template => $code) {
// Debug message
// Is this template already compiled?
if (in_array($template, $this->compiledTemplates)) {
// Then skip it
// Is this template already compiled?
if (in_array($template, $this->compiledTemplates)) {
// Then skip it
if (($foundIndex !== false) && (isset($templateMatches[3][$foundIndex]))) {
// Split it up with another reg. exp. into variable=value pairs
preg_match_all($this->regExpVarValue, $templateMatches[3][$foundIndex], $varMatches);
if (($foundIndex !== false) && (isset($templateMatches[3][$foundIndex]))) {
// Split it up with another reg. exp. into variable=value pairs
preg_match_all($this->regExpVarValue, $templateMatches[3][$foundIndex], $varMatches);
// Replace all [$var] or {?$var?} with the content
// @TODO Old behaviour, will become obsolete!
$content = str_replace('$content[' . $currEntry['name'] . ']', $currEntry['value'], $content);
// Replace all [$var] or {?$var?} with the content
// @TODO Old behaviour, will become obsolete!
$content = str_replace('$content[' . $currEntry['name'] . ']', $currEntry['value'], $content);
$this->setVariable('config', $variableName, $this->getConfigInstance()->getConfigEntry($variableName));
}
$this->setVariable('config', $variableName, $this->getConfigInstance()->getConfigEntry($variableName));
}
// Remove it from stack
$this->removeVariable($currVariable['name'], 'general');
// Re-assign the variable
// Remove it from stack
$this->removeVariable($currVariable['name'], 'general');
// Re-assign the variable
- //* DEBUG: */ $this->debugOutput(__METHOD__ . ': value='. $value . ',name=' . $currVariable['name'] . ',index=' . $index);
+ //* DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput(__METHOD__ . ': value='. $value . ',name=' . $currVariable['name'] . ',index=' . $index);
// Iterate through all general variables
foreach ($this->getVarStack('general') as $currVariable) {
// Transfer it's name/value combination to the $content array
// Iterate through all general variables
foreach ($this->getVarStack('general') as $currVariable) {
// Transfer it's name/value combination to the $content array
- $this->debugOutput(sprintf("Failed eval() code: <pre>%s</pre>", $this->markupCode($eval, true)), true);
+ self::createDebugInstance(__CLASS__)->debugOutput(sprintf("Failed eval() code: <pre>%s</pre>", $this->markupCode($eval, true)), true);
// Analyze the matches array
if ((is_array($templateMatches)) && (count($templateMatches) == 4) && (count($templateMatches[0]) > 0)) {
// Analyze the matches array
if ((is_array($templateMatches)) && (count($templateMatches) == 4) && (count($templateMatches[0]) > 0)) {
foreach ($varMatches[0] as $match) {
// Add variable tags around it
$varCode = '{?' . $match . '?}';
// Debug message
foreach ($varMatches[0] as $match) {
// Add variable tags around it
$varCode = '{?' . $match . '?}';
// Debug message
// Is the variable found in code? (safes some calls)
if (strpos($rawCode, $varCode) !== false) {
// Debug message
// Is the variable found in code? (safes some calls)
if (strpos($rawCode, $varCode) !== false) {
// Debug message