Example #1
0
 /**
  * Set whether we are in nano
  * @param boolean $inNano
  */
 public static function setInNano($inNano = false)
 {
     if ($inNano) {
         self::$_inNano = true;
     } else {
         self::$_inNano = false;
     }
 }
Example #2
0
 function evaluateExpression($expression, $data, &$parent)
 {
     //echo "<br>Cache ". $this->token." is set to [" . htmlspecialchars($this->parsedExpression) . "]";
     // check expression cache
     if (is_null($this->parsedExpression)) {
         //echo "<br>evaluateExpression[" . htmlspecialchars($expression) . "]";
         $expr = $this->parseExpression($expression, $data);
         if ($this->error) {
             return $this->error;
         }
         //echo "Expression is [" . htmlspecialchars($expr) . "]";
         $dummy;
         //echo " global \$condition; \$condition = ($expr);";
         $this->parsedExpression = $expr;
         //echo "<br>Caching ". $this->token."[<pre>" . htmlspecialchars($expr) . "</pre>]";
         //			echo "<br>Cache ". $this->token." is now set to [<pre>" . htmlspecialchars($this->parsedExpression) . "</pre>]";
     } else {
         //echo "Using cached expression";
         $expr = $this->parsedExpression;
         //			echo "Expression is [" . htmlspecialchars($expr) . "]";
     }
     $catcher = rand(1, pow(10, 8));
     $condition = $catcher;
     try {
         global $debugNsExpression, $debugNsExpressionError, $debugNsData;
         $debugNsData = $data;
         $debugNsExpressionError = false;
         $debugNsExpression = array($expr, $this->location, $this->lineNumber);
         One_Script_Error::set_error_handler();
         One_Script_Error::setInNano(true);
         @eval("\$condition = ({$expr});");
         One_Script_Error::setInNano(false);
         //		if ($debugNsExpressionError) exit;
         $debugNsData = null;
     } catch (Exception $e) {
         echo 'Caught exception: ', $e->getMessage(), "\n";
         echo 'during eval of ', $expr;
     }
     //		if ($debugNsExpressionError) exit;
     if (!is_object($condition) && $condition == $catcher) {
         $condition = "Expression evaluation failed when evaluating '" . htmlspecialchars($expression) . "'";
         //echo $condition;
         $condition .= " into '" . htmlspecialchars($expr) . "'" . " ({$this->location} : {$this->lineNumber})";
     }
     //		print "<br>EXPRESSION = ($expr) and it is " . $condition;
     return $condition;
 }