Missing hooks in the "Developer's Plugin Hook List"

By ITI - August 7, 2011 - edited: August 7, 2011

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.

Re: [ITI] Missing hooks in the "Developer's Plugin Hook List"

By Jason - August 8, 2011

Hi Glen,

Thank you for posting. We'll look into this and see about getting it fixed for a future release.

Thanks
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

Re: [Chris] Missing hooks in the "Developer's Plugin Hook List"

By ITI - August 9, 2011 - edited: August 9, 2011

Hi Chris

There are at least two reason why I like the numbers.

The main one is as an additional reference when collaborating with colleagues.

The other, a side from knowing how many there are it gives you a sense of where you are in the list.

I realize that they will change with every new CMS update and with changes to or additions of plugins. But here again it gives you an idea what the net affect the update, change or addition has made.
Glen







http://www.CanadianDomainRegistry.ca







ITI Internetworking Technologies Inc.