Date: 12/28/99
- Previous message: kir: "[PHPLIB-DEV] cvs commit"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
From: tobias
Date: Tue Dec 28 14:38:05 1999
Modified files:
php-lib/php/template.inc
Log message:
eliminated some warnings occuring with a higher error reporting level; fixed typos in the code
Index: php-lib/php/template.inc
diff -u php-lib/php/template.inc:1.9 php-lib/php/template.inc:1.10
--- php-lib/php/template.inc:1.9 Mon Nov 1 06:52:11 1999
+++ php-lib/php/template.inc Tue Dec 28 14:38:04 1999
@@ -5,7 +5,7 @@
* (C) Copyright 1999 NetUSE GmbH
* Kristian Koehntopp
*
- * $Id: template.inc,v 1.9 1999/11/01 05:52:11 kk Exp $
+ * $Id: template.inc,v 1.10 1999/12/28 13:38:04 tobias Exp $
*
*/
@@ -34,6 +34,7 @@
/* "remove" => remove undefined variables
* "comment" => replace undefined variables with comments
* "keep" => keep undefined variables
+ */
var $unknowns = "remove";
/* "yes" => halt, "report" => report error, continue, "no" => ignore error quietly */
@@ -62,7 +63,7 @@
return false;
}
- $this->root[] = $root
+ $this->root[] = $root;
} else {
reset($root);
@@ -229,15 +230,15 @@
/* check for empty variable */
if (!isset($this->varkeys[$varname]) or empty($this->varvals[$varname])) {
/* if so, check if it should be loaded */
- if ($this->file[$varname])
+ if (isset($this->file[$varname]))
$this->loadfile($varname);
/* if so, check if it is a subblock of another variable */
- if ($this->block[$varname])
+ if (isset($this->block[$varname]))
$this->implode_block($varname);
}
if ($this->debug & 2)
printf ("<b>get_var</b> (with scalar) <b>%s</b> = *%s*<br>\n", $varname, htmlentities($this->varvals[$varname]));
- return $this->varvals[$varname];
+ return(isset($this->varvals[$varname]) ? $this->varvals[$varname] : "");
} else {
@@ -266,7 +267,7 @@
*/
function get_undefined($varname) {
$str = $this->get_var($varname);
- preg_match_all("/\{([^}]+)\}/", $str, $m);
+ preg_match_all("/\\{([^}]+)\\}/", $str, $m);
$m = $m[1];
if (!is_array($m))
return false;
@@ -287,16 +288,16 @@
* str: string to finish.
*/
function finish($str) {
- switch ($this->unkowns) {
+ switch ($this->unknowns) {
case "keep":
break;
case "remove":
- $str = preg_replace("/\{[^}]+\}/", "", $str);
+ $str = preg_replace("/\\{[^}]+\\}/", "", $str);
break;
case "comment":
- $str = preg_replace("/\{([^}]+)\}/", "<!-- Template $varname: Variable \\1 undefined -->", $str);
+ $str = preg_replace("/\\{([^}]+)\\}/", "<!-- Template $varname: Variable \\1 undefined -->", $str);
break;
}
@@ -382,7 +383,7 @@
$str = $this->get_var($parent);
/* find the subblock we are looking for and extract it */
- $reg = "/<!--\s+BEGIN $varname\s+-->(.*)<!--\s+END $varname\s+-->/sm";
+ $reg = "/<!--\\s+BEGIN $varname\\s+-->(.*)<!--\\s+END $varname\\s+-->/sm";
preg_match_all($reg, $str, $m);
/* implode the subblock to the requested alias */
-
PHPLIB Developers Mailing List. Send messages to <phplib-dev <email protected>>.
To unsubscribe, send "unsubscribe" to <phplib-dev-request <email protected>> in
the body, not the subject, of your message.
- Previous message: kir: "[PHPLIB-DEV] cvs commit"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

