[wp-hackers] Improvements to the WordPress l10n framework
omry at yadan.net
Sun May 13 06:29:27 GMT 2007
Now that you understood what I meant, take another look at the file
the current version does not require that the user specifies the domain
when registering the action.
The stack solution will only work if the plugins does not directly call
each-other, but through actions.
Generally, we should also consider how functions 'overridden' by plugins
will maintain the context.
I`ll try to hack a solution with the stack soon, which should allow one
plugin to call do_action('...') and continue to maintain the context
Jamie Talbot wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> Omry Yadan wrote:
>> Nikolay Bachiyski wrote:
>>> 2007/5/12, Omry Yadan <omry at yadan.net>:
>>>> the idea is the code that initializes the plugins initialize a global
>>>> called $plugin_id before calling the plugin init code.
>>>> when the plugin adds an action, it will pass that global to the
>>>> add_action function, that will use it to re-obtain context when calling
>>>> the actions.
>>> We cannot do this. What happens if the plugin function calls a core
>>> function and then it calls other plugin function? It is possible that
>>> either core strings are being searched for in the plugin domain or,
>>> worse, one plugin\s string is being looked for in other plugin's
>> Good point.
>> it can be solved (I think) by using a stack.
>> instead of setting and unsetting the current plugin_id, push it and pop
>> it from a global stack.
> Now that I've seen some code and understand how context will be retained, this isn't necessarily a
> bad idea. You are of course, swapping the need to specify a domain on each string to specifying a
> domain on each filter/action, but in the majority of cases there will be a lot fewer. If a
> stack-based implementation can be worked out, this might work well - I suspect this will be more
> difficult than it sounds, however. And, instead of using a speculative plugin domain, why not let
> plugin authors decide their own? The suggestion I made on Trac for specifying a plugin domain in
> the plugin header would be ideal for this.
> Your mechanism of adding domains to filters would also incidentally allow improvements to did_action
> which I'd really like to see, but which we have no current way of doing. In fact, it's exactly what
> I wished we already had!
>  http://trac.wordpress.org/ticket/3089#comment:8
>  http://trac.wordpress.org/ticket/4235#comment:3
> - --
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.2.5 (MingW32)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
> -----END PGP SIGNATURE-----
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
More information about the wp-hackers