function httpbl_views_data in http:BL 7
Same name and namespace in other branches
- 6.2 views/httpbl.views.inc \httpbl_views_data()
Version 7.x-dev Contact: Bryan Lewellen (bryrock) (http://drupal.org/user/346823)
Feel free to improve this module, but please contact the authors with any changes you make so they can be implemented into the 'official' version.
File
- views/
httpbl.views.inc, line 29 - Views exposure of http:BL for Drupal. Provides easy monitoring of IPs greylisted or blacklisted through http:BL and linking to honeypot to review why these IPs have been blocked.
Code
function httpbl_views_data() {
// Thanks to Lullabot's clear and concise API docs at
// http://api.lullabot.com/group/views_hooks
//
// The 'group' index will be used as a prefix in the UI for any of this
// table's fields, sort criteria, etc. so it's easy to tell where they came
// from.
$data['httpbl']['table']['group'] = t('HttpBL');
// Define this as a base table.
$data['httpbl']['table']['base'] = array(
'field' => 'hostname',
'title' => t('HttpBL'),
'help' => t("Cache table of IP addresses successfully blocked by HttpBL (and ProjectHoneypot.org)."),
'weight' => -10,
);
// Next, describe each of the individual fields in this table to Views. For
// each field, you may define what field, sort, argument, and/or filter
// handlers it supports. This will determine where in the Views interface you
// may use the field.
// Hostname field.
$data['httpbl']['hostname'] = array(
'title' => t('Hostname'),
'help' => t('Host IP in plain text.'),
'field' => array(
'handler' => 'views_handler_field',
'click sortable' => TRUE,
),
'sort' => array(
'handler' => 'views_handler_sort',
),
'filter' => array(
'handler' => 'views_handler_filter_string',
),
'argument' => array(
'handler' => 'views_handler_argument_string',
),
);
// Status field.
$data['httpbl']['status'] = array(
'title' => t('Status'),
'help' => t('Status in a numeric field.'),
'field' => array(
'handler' => 'views_handler_field_numeric',
'click sortable' => TRUE,
),
'filter' => array(
'handler' => 'views_handler_filter_numeric',
),
'sort' => array(
'handler' => 'views_handler_sort',
),
);
// Expires timestamp field.
$data['httpbl']['expire'] = array(
'title' => t('Expires'),
'help' => t('Expiration date for this item in a timestamp field.'),
'field' => array(
'handler' => 'views_handler_field_date',
'click sortable' => TRUE,
),
'sort' => array(
'handler' => 'views_handler_sort_date',
),
'filter' => array(
'handler' => 'views_handler_filter_date',
),
);
return $data;
}