* Call a Horde hook, handling all of the necessary lookups and parsing
* of the hook code.
*
+ * WARNING: Throwing exceptions is expensive, so use callHook() with care
+ * and cache the results if you going to use the results more than once.
+ *
* @param string $hook The function to call.
* @param array $args An array of any arguments to pass to the hook
* function.
$error = false;
$hook_class = $app . '_Hooks';
- if (empty(self::$_hooksLoaded[$app]) && !class_exists($hook_class, false)) {
+ if (empty(self::$_hooksLoaded[$app]) &&
+ !class_exists($hook_class, false)) {
try {
self::loadConfiguration('hooks.php', null, $app);
} catch (Horde_Exception $e) {}
When throwing a Horde_Exception the error message provided should not be
localized.
+Throwing exceptions is expensive, so use them carefully for logic flow. You
+should cache results of Horde::callHook() calls for example, if you expect them
+to not exist.
+
Existence checking
==================