SimpleMachines/SMF2.1 — pull request #2021 by MissAllSunday (2014-07-03 15:47:47+00:00)
Title: Hooks stuff

While working on a small portal mod I realize the integrate_default_action hook could potentially end up calling multiple functions/method and will also end up calling BoardIndex, this is because call_integration_hook() will immediately call the function/method, then, if no returned value is given (which is the natural thing to assume), the code will proceed to call BoardIndex. If a return value is called smf_main() will call the function/method once again.

To avoid this we need to use $modSettings['integrate_default_action'] directly, this ensures that no multiple functions gets called as $call = call_helper($defaultAction, true); is not actually gonna execute the function/method, it will just format it and return a callable string that smf_main() will return.

It also makes sure that only one call from integrate_default_action gets called, in this case, the very first one who got registered since there is no priority system, this hook will only be used by portals so its really not a big deal.

Lastly, it removes the check to load a file from call_integration_hook() and makes it a separate function (load_file()), this way it can be used by call_helper() too