- 4. Programmer's Guide
4.8. Custom escaping functions - 4.7. Template inheritance
« Previous - 4.9. Internationalization
Next »
4.8. Custom escaping functions
Currently OPT sanitizes the script data placed in the templates with simple htmlspecialchars() function. However, we are aware of the fact it is not perfect. This part of the library will be extended in the future, but currently OPT provides the ability to use a custom function here. In order to to that, just register a new OPT function called escape:
$tpl->register(Opt_Class::PHP_FUNCTION, 'escape', 'myFilter');
The registered function must take exactly one argument - the text to be sanitized.
In case of this function, it is not allowed to use argument order manipulators like
#2,1,3#.
See also:
- 4.8. Custom escaping functions
4. Programmer's Guide - « Previous
4.7. Template inheritance - Next »
4.9. Internationalization