Commit c2c191ba authored by metzlerd's avatar metzlerd
Browse files

Added improved support for defining custom SQL query builders.

parent cd29b34a
......@@ -4,8 +4,10 @@
* General Forena Reporting Class
*/
define('FRX_TOKEN_EXP', '/\{[^\n^\r^}]+}/');
define('FRX_SQL_REWRITE_EXP', '/\[[^\n^\r^\]]+\]/');
define('FRX_SQL_TOKEN', '/(?<!(:|[a-zA-Z]|[0-9]|[_\.])):[a-zA-Z]([a-zA-Z]|[0-9]|[_\.])+/');
class Frx {
......
......@@ -11,18 +11,27 @@
class FrxSyntaxEngine {
private $tpattern;
private $trim_chars;
private $data; // Data object for current context.
private $formatter; // Object used to format the data
/**
* Class for doing syntax replacements;
* @param $regexp
* @param $trim Trim characgers
* @param $data Data object to be used for resolving contexts.
* @return unknown_type
*/
public function __construct($regexp, $trim, $formatter=NULL) {
public function __construct($regexp, $trim, $formatter=NULL, $data=NULL) {
$this->tpattern = $regexp;
$this->trim_chars = $trim;
if (is_object($formatter)) {
$this->formatter=$formatter;
}
if ($data) {
$this->data = $data;
}
else {
$this->data = Frx::Data();
}
}
......@@ -63,7 +72,7 @@ class FrxSyntaxEngine {
$o = Frx::Context($context);
}
else {
$o = Frx::Data();
$o = $this->data;
}
$value = $o->getValue($key, $context);
if (!$raw && $this->formatter) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment