fixed unknowns="remove" to remove more strict (only variable names with letterns, numbers, underscore and dash), as it messes up json otherwise

This commit is contained in:
Ralf Becker 2011-06-02 13:30:21 +00:00
parent 423a1d9303
commit 8445199caf

View File

@ -3,8 +3,8 @@
* eGroupWare API - Template class *
* (C) Copyright 1999-2000 NetUSE GmbH Kristian Koehntopp *
* ------------------------------------------------------------------------ *
* This is not part of eGroupWare, but is used by eGroupWare. *
* http://www.egroupware.org/ *
* This is not part of eGroupWare, but is used by eGroupWare. *
* http://www.egroupware.org/ *
* ------------------------------------------------------------------------ *
* This program is free software; you can redistribute it and/or modify it *
* under the terms of the GNU Lesser General Public License as published *
@ -124,7 +124,7 @@
}
/* 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.
*/
function set_block($parent, $handle, $name = '')
@ -349,10 +349,10 @@
case 'keep':
break;
case 'remove':
$str = preg_replace('/{[^ \t\r\n}]+}/', '', $str);
$str = preg_replace('/{[a-z0-9_-]+}/i', '', $str);
break;
case 'comment':
$str = preg_replace('/{([^ \t\r\n}]+)}/', "<!-- Template $handle: Variable \\1 undefined -->", $str);
$str = preg_replace('/{([a-z0-9_-]+)}/i', "<!-- Template $handle: Variable \\1 undefined -->", $str);
break;
}