'admin/settings/util', 'title' => t('Utility module settings'), 'description' => t('Utility module settings'), 'callback' => 'drupal_get_form', 'callback arguments' => array('util_settings'), 'access' => user_access('administer util'), 'type' => MENU_NORMAL_ITEM, ); if(!$may_cache) { util_run_utilities(); } return $items; } /* * Run the utilities */ function util_run_utilities() { global $hook_files; $files = drupal_system_listing("\.inc", drupal_get_path('module', 'util') ."/utilities", 'name', 1); ksort($files); $hook_files = array(); $hooks = array(); foreach ($files as $file) { include $file->filename; $hooks = array_merge(call_user_func($file->name ."_util", "hook registry"), $hooks); $hook_files[$file->name] = call_user_func($file->name ."_util", "hook registry"); } /* * Functionality to be used in a future version - see 5.x-2.x-dev * Doesn't work yet - don't uncomment */ /* foreach ($hooks as $hook) { $call = ''; foreach($hook_files as $file => $hook_file) { foreach ($hook_file as $hook) { if(function_exists($file .'_util_'. $hook)) { $call .= 'call_user_func_array(\''.$file .'_util_'. $hook .'\', $args);'; } } } eval(" function util_". $hook ."() { \$args = func_get_args(); ". $call ." } "); } */ } function util_settings() { global $hook_files; $form = array(); foreach($hook_files as $file => $blank) { $form = array_merge(call_user_func($file .'_util', 'settings form'), $form); } return system_settings_form($form); } /** * Implementation of hook_form_alter(). */ function util_form_alter($form_id, &$form) { system_modules_util_form_alter($form_id, &$form); } /** * Implementation of hook_perm(). */ function util_perm() { return array('administer util'); }