On Fri, Jul 22, 2016 at 1:31 AM, Michael Vostrikov <
[email protected]> wrote:
>
> > The trick with the magic class name and namespace aliasing is neat, but
> feels likely to confuse a lot of users
>
> Yes, I have to agree. Maybe more better way is to make it similar to
> set_error_handler() - not for context as it is in RFC, but for 'escape'
> callable.
>
> <?php
>
> // somewhere in application
>
> set_escape_handler(function($string, $context = 'html'){
> ...
> });
>
> // or
>
> set_escape_handler([$this, 'escape']);
> ?>
>
> <?* $myValue, $myContext ?>
>
Which begs the question, if you can verify that the call to
set_escape_handler comes before the template, then can you also be sure
that a function definition will come before it, and just call a function
directly?