geocode/geocode.module, line 5
- Versions
- 6
geocode($handler, $input, $return = 'point', $options = array())
The Geocode API call.
Code
<?php
function geocode($handler, $input, $return = 'point', $options = array()) {
static $handlers = array();
if (!isset($handlers[$handler])) {
$info = geocode_handler_info();
if ($h = $info[$handler]) {
// Load the geocoder's file.
$path = (isset($h['file path'])) ? $h['file path'] .'/' : '';
require_once $path . $h['file'];
// Instantiate a class for it.
$handlers[$handler] = New $handler($options);
}
}
if (!$handler = $handlers[$handler]) return FALSE;
if ($handler->geocode($input, $options)) {
list ($type, $item) = explode(':', $return);
return $handler->get_result($type, $item);
}
}
?> 