- Patch #334030 by justinrandell: replace module_list with module_implements when calling a hook.
parent
10104ba94a
commit
97fdc49191
|
|
@ -1220,19 +1220,18 @@ function menu_get_active_help() {
|
|||
$arg = drupal_help_arg(arg(NULL));
|
||||
$empty_arg = drupal_help_arg();
|
||||
|
||||
foreach (module_list() as $name) {
|
||||
if (module_hook($name, 'help')) {
|
||||
foreach (module_implements('help') as $module) {
|
||||
$function = $module . '_help';
|
||||
// Lookup help for this path.
|
||||
if ($help = module_invoke($name, 'help', $router_path, $arg)) {
|
||||
if ($help = $function($router_path, $arg)) {
|
||||
$output .= $help . "\n";
|
||||
}
|
||||
// Add "more help" link on admin pages if the module provides a
|
||||
// standalone help page.
|
||||
if ($arg[0] == "admin" && module_exists('help') && module_invoke($name, 'help', 'admin/help#' . $arg[2], $empty_arg) && $help) {
|
||||
if ($arg[0] == "admin" && module_exists('help') && $function('admin/help#' . $arg[2], $empty_arg) && $help) {
|
||||
$output .= theme("more_help_link", url('admin/help/' . $arg[2]));
|
||||
}
|
||||
}
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1945,8 +1945,8 @@ function _comment_update_node_statistics($nid) {
|
|||
*/
|
||||
function comment_invoke_comment(&$comment, $op) {
|
||||
$return = array();
|
||||
foreach (module_implements('comment') as $name) {
|
||||
$function = $name . '_comment';
|
||||
foreach (module_implements('comment') as $module) {
|
||||
$function = $module . '_comment';
|
||||
$result = $function($comment, $op);
|
||||
if (isset($result) && is_array($result)) {
|
||||
$return = array_merge($return, $result);
|
||||
|
|
|
|||
|
|
@ -326,8 +326,9 @@ function filter_formats($index = NULL) {
|
|||
function filter_list_all() {
|
||||
$filters = array();
|
||||
|
||||
foreach (module_list() as $module) {
|
||||
$list = module_invoke($module, 'filter', 'list');
|
||||
foreach (module_implements('filter') as $module) {
|
||||
$function = $module . '_filter';
|
||||
$list = $function('list');
|
||||
if (isset($list) && is_array($list)) {
|
||||
foreach ($list as $delta => $name) {
|
||||
$filters[$module . '/' . $delta] = (object)array('module' => $module, 'delta' => $delta, 'name' => $name);
|
||||
|
|
|
|||
|
|
@ -716,8 +716,8 @@ function node_invoke(&$node, $hook, $a2 = NULL, $a3 = NULL, $a4 = NULL) {
|
|||
function node_invoke_nodeapi(&$node, $op, $a3 = NULL, $a4 = NULL) {
|
||||
$return = array();
|
||||
$hook = 'nodeapi_' . $op;
|
||||
foreach (module_implements($hook) as $name) {
|
||||
$function = $name . '_' . $hook;
|
||||
foreach (module_implements($hook) as $module) {
|
||||
$function = $module . '_' . $hook;
|
||||
$result = $function($node, $a3, $a4);
|
||||
if (isset($result) && is_array($result)) {
|
||||
$return = array_merge($return, $result);
|
||||
|
|
|
|||
|
|
@ -37,13 +37,12 @@ function search_admin_settings() {
|
|||
// Collect some stats
|
||||
$remaining = 0;
|
||||
$total = 0;
|
||||
foreach (module_list() as $module) {
|
||||
if (module_hook($module, 'search')) {
|
||||
$status = module_invoke($module, 'search', 'status');
|
||||
foreach (module_implements('search') as $module) {
|
||||
$function = $module . '_search';
|
||||
$status = $function('status');
|
||||
$remaining += $status['remaining'];
|
||||
$total += $status['total'];
|
||||
}
|
||||
}
|
||||
$count = format_plural($remaining, 'There is 1 item left to index.', 'There are @count items left to index.');
|
||||
$percentage = ((int)min(100, 100 * ($total - $remaining) / max(1, $total))) . '%';
|
||||
$status = '<p><strong>' . t('%percentage of the site has been indexed.', array('%percentage' => $percentage)) . ' ' . $count . '</strong></p>';
|
||||
|
|
|
|||
|
|
@ -208,14 +208,14 @@ function search_menu() {
|
|||
'file path' => drupal_get_path('module', 'dblog'),
|
||||
);
|
||||
|
||||
foreach (module_implements('search') as $name) {
|
||||
$items['search/' . $name . '/%menu_tail'] = array(
|
||||
foreach (module_implements('search') as $module) {
|
||||
$items['search/' . $module . '/%menu_tail'] = array(
|
||||
'title callback' => 'module_invoke',
|
||||
'title arguments' => array($name, 'search', 'name', TRUE),
|
||||
'title arguments' => array($module, 'search', 'name', TRUE),
|
||||
'page callback' => 'search_view',
|
||||
'page arguments' => array($name),
|
||||
'page arguments' => array($module),
|
||||
'access callback' => '_search_menu',
|
||||
'access arguments' => array($name),
|
||||
'access arguments' => array($module),
|
||||
'type' => MENU_LOCAL_TASK,
|
||||
'parent' => 'search',
|
||||
);
|
||||
|
|
@ -277,8 +277,9 @@ function search_cron() {
|
|||
register_shutdown_function('search_update_totals');
|
||||
|
||||
// Update word index
|
||||
foreach (module_list() as $module) {
|
||||
module_invoke($module, 'update_index');
|
||||
foreach (module_implements('update_index') as $module) {
|
||||
$function = $module . '_update_index';
|
||||
$function();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -23,13 +23,11 @@ define('EMAIL_MAX_LENGTH', 64);
|
|||
* be passed by reference.
|
||||
*/
|
||||
function user_module_invoke($type, &$array, &$user, $category = NULL) {
|
||||
foreach (module_list() as $module) {
|
||||
foreach (module_implements('user_' . $type) as $module) {
|
||||
$function = $module . '_user_' . $type;
|
||||
if (function_exists($function)) {
|
||||
$function($array, $user, $category);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Implementation of hook_theme().
|
||||
|
|
@ -1952,8 +1950,9 @@ function user_filters() {
|
|||
}
|
||||
|
||||
$options = array();
|
||||
foreach (module_list() as $module) {
|
||||
if ($permissions = module_invoke($module, 'perm')) {
|
||||
foreach (module_implements('perm') as $module) {
|
||||
$function = $module . '_perm';
|
||||
if ($permissions = $function('perm')) {
|
||||
asort($permissions);
|
||||
foreach ($permissions as $permission => $description) {
|
||||
$options[t('@module module', array('@module' => $module))][$permission] = t($permission);
|
||||
|
|
@ -2437,8 +2436,9 @@ function user_register_validate($form, &$form_state) {
|
|||
*/
|
||||
function _user_forms(&$edit, $account, $category, $hook = 'form') {
|
||||
$groups = array();
|
||||
foreach (module_list() as $module) {
|
||||
if ($data = module_invoke($module, 'user_' . $hook, $edit, $account, $category)) {
|
||||
foreach (module_implements('user_' . $hook) as $module) {
|
||||
$function = $module . '_user_' . $hook;
|
||||
if ($data = $function($edit, $account, $category)) {
|
||||
$groups = array_merge_recursive($data, $groups);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue