Add widgets hook

Add a hook to make widgets extensible.  This allows addons to work in the same way as regular widgets, effectively adding them to the end of include/widgets.php so they can be used in comanche layouts.  There doesn't seem to be a good way to do this in construct_page and also keep the flexibility of which regions, and which pages/modules to use any particular widget in.

The diff shows changes to dir_fns too, but I checked out upstream twice and double checked the code, that seems to be just a github bug, showing reversion of my last pull request that didn't go in.