Re: plugin interface
| From: | Hans-Peter Oeri | Date: | Tue, 09 Oct 2001 19:18:18 +0000 |
| Subject: | Re: plugin interface | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-1655@lists.php.net to get a copy of this message | ||
Hi!
On Tue, 9 Oct 2001, Monte Ohrt wrote:
> 1) If the function is built-in ({if ...}, {include ...}, etc.), process
> function normally
> 2) If a PHP function exists of the name 'smarty_func_myfunc()', use this
> function
> 3) If the file exists 'plugins/smarty_func_myfunc.php', include and use
> smarty_func_myfunc() (function must be defined in here!)
> 4) If none of the above exist, use built-in default function (which may
> trigger error or whatever)
Great, but please don't forget the case of NO plugin directory (let's say:
plugin directory attribut empty).
Why not create the same procedure for compiler functions? (adapted step 4,
of course)
> * plugins only work with functions and modifiers, nothing fancy like
> your own {myfunc}{/myfunc} kind of things
We could define some sort of "standard" parameter for this kind of call:
as soon as there is a closing tag, the content is in parameter "content".
Of course, the output of the function itself should be re-evaluated, but
not really a problem of plugins, is it?
> * functions that are mapped directly to php funcs must be written as a
> wrapper (IMHO, this is how it should be anyways)
it should be!
> * must stat() plugin directory file for each plugin called in templates,
> may be a performance issue? maybe we can put "core" plugins in one file
> to alleviate this (leave in addons file)
I can require the respective files beforehand. addons should be included
by default -> no more stat for core functions.
> Q's:
> * do we keep function/modifier registration around for backward
> compatability? If so, it will be added to above steps.
We probably need to, as long as we are in the same major version...
But why not rewrite the register functions such that they create
appropriate wrappers? (and deleting them with the next major revision)
> * how does this affect template security?
The possibility to restrict - if really needed - could be included by a
list of allowed functions: I restrict the allowed functions and have them
defined before parsing -> no more inclusions.
Don't conform!
IkKampfCaspar75