friendica/friendica — pull request #543 by fabrixxm (2012-12-14 15:20:59+00:00)
Title: template_processor: add filter support to variables

This commit should close bug [0000387: Strings are not escaped in templates](http://bugs.friendica.com/view.php?id=387)

Is possible to pass variable value trough filter before is printed on the page.
Filters are any function accessible at global level, also native php functions.

The syntax is:

$varname|filter1|filter2

or with square brakets

$[varname|filter1|filter2]

any number of filters can be chained
extra arguments can be passed to filter

$[varname|filter:arg1:arg2]

function "filter" is called like

filter("arg1", "arg2", $varvalue)

if filter function want $varvalue not in last position, use an "x" as argument:

$[varname|filter:arg1:x:arg2]

filter("arg1", $varvalue, "arg2");