All pastes #334981 Raw Edit

Anonymous

public text v1 · immutable
·published 2007-02-01 01:20 UTC
rendered paste body
function _menu_access($item, &$map) {
  if ($item->replacements) {
    $replacements = unserialize($item->replacements);
    foreach ($replacements as $index => $value) {
      if (is_array($value)) {
        $function = $value[0];
        $return = $function(MENU_INCOMING, $value[1], $map[$index]);
        if ($return === FALSE) {
          return FALSE;
        }
        $map[$index] = $return;
      }
    }
  }
  $callback = $item->access_callback;
  if (is_numeric($callback)) {
    return $callback;
  }
  $arguments = menu_unserialize($item->access_arguments, $map);
  // As call_user_func_array is quite slow and user_access is a very common
  // callback, it is worth making a special case for it.
  if ($callback == 'user_access') {
    return (count($arguments) == 1) ? user_access($arguments[0]) : user_access($arguments[0], $arguments[1]);
  }
  return call_user_func_array($callback, $arguments);
}

function _menu_access_temp($item, &$map, &$path) {
  if ($item->replacements) {
    $replacements = unserialize($item->replacements);
    $path_map = $map;
    foreach ($replacements as $index => $value) {
      if (is_array($value)) {
        $function = $value[0];
        $path_map[$index] = $function(MENU_OUTGOING, $value[1], $map[$index]);
        $return = $function(MENU_INCOMING, $value[1], $path_map[$index]);
        if ($return === FALSE) {
          return FALSE;
        }
        $map[$index] = $return;
      }
    }
    $path = implode('/', $path_map);
  }
  $callback = $item->access_callback;
  if (is_numeric($callback)) {
    return $callback;
  }
  $arguments = menu_unserialize($item->access_arguments, $map);
  // As call_user_func_array is quite slow and user_access is a very common
  // callback, it is worth making a special case for it.
  if ($callback == 'user_access') {
    return (count($arguments) == 1) ? user_access($arguments[0]) : user_access($arguments[0], $arguments[1]);
  }
  return call_user_func_array($callback, $arguments);
}