formatting...

This commit is contained in:
Miles Lott 2001-12-24 05:24:57 +00:00
parent 573c7089d1
commit de3504fd20

View File

@ -21,23 +21,23 @@
/* if set, echo assignments */ /* if set, echo assignments */
var $debug = False; var $debug = False;
/* $file[handle] = "filename"; */ /* $file[handle] = 'filename'; */
var $file = array(); var $file = array();
/* relative filenames are relative to this pathname */ /* relative filenames are relative to this pathname */
var $root = ""; var $root = '';
/* $varkeys[key] = "key"; $varvals[key] = "value"; */ /* $varkeys[key] = 'key'; $varvals[key] = 'value'; */
var $varkeys = array(); var $varkeys = array();
var $varvals = array(); var $varvals = array();
/* "remove" => remove undefined variables /* 'remove' => remove undefined variables
* "comment" => replace undefined variables with comments * 'comment' => replace undefined variables with comments
* "keep" => keep undefined variables * 'keep' => keep undefined variables
*/ */
var $unknowns = 'remove'; var $unknowns = 'remove';
/* "yes" => halt, "report" => report error, continue, "no" => ignore error quietly */ /* 'yes' => halt, 'report' => report error, continue, 'no' => ignore error quietly */
var $halt_on_error = 'yes'; var $halt_on_error = 'yes';
/* last error message is retained here */ /* last error message is retained here */
@ -69,7 +69,7 @@
} }
/* public: set_unknowns(enum $unknowns) /* public: set_unknowns(enum $unknowns)
* unknowns: "remove", "comment", "keep" * unknowns: 'remove', 'comment', 'keep'
* *
*/ */
function set_unknowns($unknowns = 'keep') function set_unknowns($unknowns = 'keep')
@ -105,7 +105,7 @@
} }
} }
/* public: set_block(string $parent, string $handle, string $name = "") /* public: set_block(string $parent, string $handle, string $name = '')
* extract the template $handle from $parent, * extract the template $handle from $parent,
* place variable {$name} instead. * place variable {$name} instead.
*/ */
@ -324,13 +324,12 @@
{ {
switch ($this->unknowns) switch ($this->unknowns)
{ {
case "keep": case 'keep':
break; break;
case 'remove':
case "remove": $str = preg_replace('/{[^ \t\r\n}]+}/', '', $str);
$str = preg_replace('/{[^ \t\r\n}]+}/', "", $str);
break; break;
case "comment": case 'comment':
$str = preg_replace('/{([^ \t\r\n}]+)}/', "<!-- Template $handle: Variable \\1 undefined -->", $str); $str = preg_replace('/{([^ \t\r\n}]+)}/', "<!-- Template $handle: Variable \\1 undefined -->", $str);
break; break;
} }