public static function runCallbacks($name, &$arguments = array(), $type = 'all', &$object = null, &$function = null, &$data = array()) {
    if (isset(Hook::$hooks['all'])) {
      foreach (Hook::$hooks['all'] as $curCallback) {
        if (($type == 'all' && $curCallback[0] != 0) || ($type == 'before' && $curCallback[0] < 0) || ($type == 'after' && $curCallback[0] > 0)) {
          call_user_func_array($curCallback[1], array(&$arguments, $name, &$object, &$function, &$data));
          if ($arguments === false) {
            return;
          }
        }
      }
    }
    if (isset(Hook::$hooks[$name])) {
      foreach (Hook::$hooks[$name] as $curCallback) {
        if (($type == 'all' && $curCallback[0] != 0) || ($type == 'before' && $curCallback[0] < 0) || ($type == 'after' && $curCallback[0] > 0)) {
          call_user_func_array($curCallback[1], array(&$arguments, $name, &$object, &$function, &$data));
          if ($arguments === false) {
            return;
          }
        }
      }
    }
  }