name * @param $hook * The name of the hook being invoked. */ function _advanced_forum_process_plugin($module, $identifier, $path, $hook) { $function = $identifier . '_' . $hook; if (!function_exists($function)) { return NULL; } $result = $function(); if (!isset($result) || !is_array($result)) { return NULL; } // Fill in defaults. foreach ($result as $name => $plugin) { if (!is_dir($path . '/' . $plugin['directory'])) { unset($result[$name]); continue; } $result[$name] += array( 'module' => $module, 'name' => $name, 'path' => $path . '/' . $plugin['directory'], ); } return !empty($result) ? $result : NULL; }