
ITI
User
Aug 7, 2011, 9:27 AM
Post #1 of 4
(2181 views)
Shortcut
|
|
Missing hooks in the "Developer's Plugin Hook List"
|
Can't Post
|
|
Item 1. The "Developer's Plugin Hook List" only lists actions and filters that have been enclosed in "single quotes". eg. The following will appear in the list
addAction('admin_postlogin','_admin_postlogin'); where as this will not appear in the list:
addAction("admin_postlogin","_admin_postlogin"); The reason is that your array of hookTypes is only looking for single quotes.
// top of lib/menus/admin/pluginHooks.php $hookTypes = array( 'filter' => array( 'callerRegex' => "|applyFilters\(\s*'(.*?)'|", 'pluginRegex' => "|addAction\('(.*?)'|" ), << in wrong array 'action' => array( 'callerRegex' => "|doAction\(\s*'(.*?)'|", 'pluginRegex' => "|addFilter\('(.*?)'|" ), << in wrong array ); The following modification will find either single or double quotes and add the correct "type" to custom hooks:
$hookTypes = array( 'filter' => array( 'callerRegex' => "|applyFilters\(\s*['\"](.*?)['\"]|", 'pluginRegex' => "|addFilter\(['\"](.*?)['\"]|" ), 'action' => array( 'callerRegex' => "|doAction\(\s*['\"](.*?)['\"]|", 'pluginRegex' => "|addAction\(['\"](.*?)['\"]|" ), ); This feature is very useful and I can't imagine having to edit all existing plugins just to have them appear in the list. Item 2. While your at it, could you add the counter value to the beginning of the line since the $counter variable is set anyway.
//Line 126 in cmsb ver 2.11: <?php echo htmlspecialchars($hookName); ?> // changed to this; <?php echo htmlspecialchars("[".$counter."] ".$hookName); ?> And would appear as: Hook Name ..... [1] admin_footer [2] admin_head [3] admin_postlogin ... etc It would make references to hooks a little easier since the list can be quite lengthy. Glen http://www.CanadianDomainRegistry.ca ITI Internetworking Technologies Inc.
(This post was edited by ITI on Aug 7, 2011, 8:16 PM)
|