Wrap Operator

UNIX name Owner Status
wrap_operator Brookins Consulting stable
Version Compatible with
1.0.1 4.0+
This is a simple wrap ('wrapper') operator to directly call any system and user-defined functions in template.

Useful for calling string formatting functions that are missing in ez from php and adding your own functions without need to code extra extensions.

This solution is also very useful for turning poorly performing tpl code into fast tpl code by moving performance intensive operations into php code.

Essentially, this is a simple wrapper operator to directly call any system and user-defined functions in template.

It does not concern me much if doing so is good idea or ' pfui' as someone said once on the #ezpublish irc channel.

Undoubtedly care has to be taken to avoid security and caching problems, etc.

But it makes life a lot easier for me because I don't have to re-implement / write existing text processing functions in template language and do not need to set up separate extension to every small operator I need.

It's a swiss army knife - you can cut your hand but no one is forcing you to :)

Thoughts

I am not sure exactly what datatypes can be passed to functions from template like this.

Should work ok for integers, strings and boolean I think. If you are more informed about ez internals, please comment.

Using wrap_user_func with return_output=true() should enable easy embedding of existing php applications in templates, called through the user function. I have tested just simple test case but maybe someone can think of something more useful and post specific instructions..

No news yet.

This project has no reviews yet. Be the first one to review it!