[wp-trac] [WordPress Trac] #4235: Improve did_action to show
information on callers.
WordPress Trac
wp-trac at lists.automattic.com
Tue May 8 01:49:58 GMT 2007
#4235: Improve did_action to show information on callers.
-------------------------+--------------------------------------------------
Reporter: majelbstoat | Owner: anonymous
Type: enhancement | Status: new
Priority: normal | Milestone: 2.3
Component: General | Version: 2.2
Severity: trivial | Keywords: did_action caller filters
-------------------------+--------------------------------------------------
I'd like to propose a small extension to did_action. Currently,
wp_actions looks like an array full of actions/filters that have been
called:
{{{
// Equivalent to this
$wp_actions = array('locale');
}}}
I'd like the internal structure to be changed to something like this:
{{{
$wp_actions['locale'] = array('plugin1_internal_name',
'plugin2_internal_name');
}}}
This would allow plugins to determine what other plugins had called a
filter. Many plugins are incorrectly localised, calling
load_plugin_textdomain() before the init hook. Making this change would
allow multilingual plugins (including mine, Gengo) to report back which
plugins were broken and would significantly lower the support burden.
Obtaining the count would be the same, with:
{{{
count($wp_actions[$tag]);
}}}
So as not to break backwards compat, I propose adding a second argument to
did_actions, a passed by reference array, that will be filled with the
array of plugins that have called the specified filter. Similar to the
$matches argument of preg_match().
{{{
did_actions('locale', $callers);
function did_actions($tag, & $callers) {
...
}
}}}
As $wp_actions is an internal variable, with API provided for accessing
it, changing the internal structure shouldn't cause any problems. If
there are no objections, I'll work up a patch.
Cheers,
Jamie.
--
Ticket URL: <http://trac.wordpress.org/ticket/4235>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list