function location_map_link_us_google in Location 6.3
Same name and namespace in other branches
- 5.3 supported/location.us.inc \location_map_link_us_google()
- 5 supported/location.us.inc \location_map_link_us_google()
- 7.5 supported/location.us.inc \location_map_link_us_google()
- 7.3 supported/location.us.inc \location_map_link_us_google()
- 7.4 supported/location.us.inc \location_map_link_us_google()
File
- supported/
location.us.inc, line 146
Code
function location_map_link_us_google($location = array()) {
$query_params = array();
$q = NULL;
foreach (array(
'street',
'city',
'province',
'postal_code',
'country',
) as $field) {
if (isset($location[$field])) {
$query_params[] = $location[$field];
}
}
if (location_has_coordinates($location)) {
$q = urlencode($location['latitude'] . ' ' . $location['longitude'] . ' (' . implode(', ', $query_params) . ')');
}
else {
if (count($query_params) > 0) {
$q = urlencode(implode(", ", $query_params));
}
}
if ($q != NULL) {
return 'http://maps.google.com?q=' . $q;
}
else {
return NULL;
}
}