menu_execute_active_handler($path = NULL, $deliver = TRUE)Execute the page callback associated with the current path.
$path The drupal path whose handler is to be be executed. If set to NULL, then the current path is used.
$deliver (optional) A boolean to indicate whether the content should be sent to the browser using the appropriate delivery callback (TRUE) or whether to return the result to the caller (FALSE).
includes/menu.inc, line 445
<?php
function menu_execute_active_handler($path = NULL, $deliver = TRUE) {
if (_menu_site_is_offline()) {
$page_callback_result = MENU_SITE_OFFLINE;
}
else {
// Rebuild if we know it's needed, or if the menu masks are missing which
// occurs rarely, likely due to a race condition of multiple rebuilds.
if (variable_get('menu_rebuild_needed', FALSE) || !variable_get('menu_masks', array())) {
menu_rebuild();
}
if ($router_item = menu_get_item($path)) {
// hook_menu_alter() lets modules control menu router information that
// doesn't depend on the details of a particular page request.
// Here, we want to give modules a chance to use request-time information
// to make alterations just for this request.
drupal_alter('menu_active_handler', $router_item, $path);
if ($router_item['access']) {
if ($router_item['file']) {
require_once DRUPAL_ROOT . '/' . $router_item['file'];
}
$page_callback_result = call_user_func_array($router_item['page_callback'], $router_item['page_arguments']);
}
else {
$page_callback_result = MENU_ACCESS_DENIED;
}
}
else {
$page_callback_result = MENU_NOT_FOUND;
}
}
// Deliver the result of the page callback to the browser, or if requested,
// return it raw, so calling code can do more processing.
if ($deliver) {
$default_delivery_callback = (isset($router_item) && $router_item) ? $router_item['delivery_callback'] : NULL;
drupal_deliver_page($page_callback_result, $default_delivery_callback);
}
else {
return $page_callback_result;
}
}
?>