+ // Prepare the eval() command for comiling the template
+ $eval = sprintf("\$result = \"%s\";",
+ addslashes($this->getRawTemplateData())
+ );
+
+ // This loop does remove the backslashes (\) in PHP parameters
+ /* @TODO Make this some nicer... */
+ while (strpos($eval, "<?") !== false) {
+ // Get left part before "<?"
+ $evalLeft = substr($eval, 0, strpos($eval, "<?"));
+
+ // Get all from right of "<?"
+ $evalRight = substr($eval, (strpos($eval, "<?") + 2));
+
+ // Is this a full PHP tag?
+ if (substr(strtolower($evalRight), 0, 3) == "php") {
+ // Remove "php" string from full PHP tag
+ $evalRight = substr($evalRight, 3);
+ } // END - if
+
+ // Cut middle part out and remove escapes
+ $evalMiddle = trim(substr($evalRight, 0, strpos($evalRight, "?>")));
+ $evalMiddle = stripslashes($evalMiddle);
+
+ // Remove the middle part from right one
+ $evalRight = substr($evalRight, (strpos($evalRight, "?>") + 2));
+
+ // And put all together
+ $eval = sprintf("%s<%%php %s %%>%s", $evalLeft, $evalMiddle, $evalRight);
+ } // END - while
+
+ // Prepare PHP code for eval() command
+ $evalLength = strlen($eval);
+ $eval = str_replace(
+ "<%php", "\";",
+ str_replace(
+ "%>", "\n\$result .= \"", $eval
+ )
+ );
+
+ // Did something change?
+ if (strlen($eval) != $eval) {
+ // Run the constructed command. This will "compile" all variables in
+ @eval($eval);
+ } // END - if
+
+ // Goes something wrong?
+ if (!isset($result)) {
+ // Output eval command
+ $this->debugOutput(sprintf("Failed eval() code: <pre>%s</pre>", $this->markupCode($eval, true)), true);