menu_execute_active_handler
includes/menu.inc, строка 385
- Версии
- 5
menu_execute_active_handler()
- 6
menu_execute_active_handler($path = NULL)
Запускает обработчик связанный с активизированным пунктом меню.
Вызывается во время запроса страницы. The active menu item is at this point determined exclusively by the URL. The handler that is called here may, as a side effect, change the active menu item so that later menu functions (that display the menus and breadcrumbs, for example) act as if the user were in a different location on the site.
Связанные темы
Код
<?php
function menu_execute_active_handler() {
if (_menu_site_is_offline()) {
return MENU_SITE_OFFLINE;
}
$menu = menu_get_menu();
// Determine the menu item containing the callback.
$path = $_GET['q'];
while ($path && !isset($menu['callbacks'][$path])) {
$path = substr($path, 0, strrpos($path, '/'));
}
if ($path === '' || !isset($menu['callbacks'][$path])) {
return MENU_NOT_FOUND;
}
if (!function_exists($menu['callbacks'][$path]['callback'])) {
return MENU_NOT_FOUND;
}
if (!_menu_item_is_accessible(menu_get_active_item())) {
return MENU_ACCESS_DENIED;
}
// We found one, and are allowed to execute it.
$arguments = isset($menu['callbacks'][$path]['callback arguments']) ? $menu['callbacks'][$path]['callback arguments'] : array();
$arg = substr($_GET['q'], strlen($path) + 1);
if (strlen($arg)) {
$arguments = array_merge($arguments, explode('/', $arg));
}
return call_user_func_array($menu['callbacks'][$path]['callback'], $arguments);
}
?>
Войдите или зарегистрируйтесь, чтобы получить возможность отправлять комментарии