function smart_ip_token_info in Smart IP 7.2
Same name and namespace in other branches
- 7 smart_ip.module \smart_ip_token_info()
Implements hook_token_info().
File
- ./
smart_ip.module, line 289 - Determines country, geo location (longitude/latitude), region, city and postal code of the user, based on IP address
Code
function smart_ip_token_info() {
$type = array(
'name' => t('Smart IP'),
'description' => t('Tokens related to Smart IP geolocation info'),
);
$tokens = array(
'country',
'country_code',
'region',
'region_code',
'city',
'zip',
'latitude',
'longitude',
'locality',
'time_zone',
);
foreach ($tokens as $name) {
$label = ucfirst(str_replace('_', ' ', $name));
$smart_ip[$name] = array(
'name' => $label,
);
$smart_ip[$name]['description'] = t('Smart IP @label', array(
'@label' => $label,
));
}
return array(
'types' => array(
'smart_ip' => $type,
),
'tokens' => array(
'smart_ip' => $smart_ip,
),
);
}