function _google_geocode_flatten in Location 7.3
Same name and namespace in other branches
- 5.3 geocoding/google.inc \_google_geocode_flatten()
- 6.3 geocoding/google.inc \_google_geocode_flatten()
- 7.5 geocoding/google.inc \_google_geocode_flatten()
- 7.4 geocoding/google.inc \_google_geocode_flatten()
Returns address.
1 call to _google_geocode_flatten()
- google_geocode_location in geocoding/
google.inc - Perform a geocode on a location array.
File
- geocoding/
google.inc, line 168 - Google geocoder.
Code
function _google_geocode_flatten($location = array()) {
// Check if its a valid address.
if (empty($location)) {
return '';
}
$address = '';
if (!empty($location['street'])) {
$address .= $location['street'];
}
if (!empty($location['city'])) {
if (!empty($address)) {
$address .= ', ';
}
$address .= $location['city'];
}
// Using province short code regularlyy gives no results.
if (!empty($location['province_name'])) {
if (!empty($address)) {
$address .= ', ';
}
$address .= $location['province_name'];
}
if (!empty($location['postal_code'])) {
if (!empty($address)) {
$address .= ', ';
}
$address .= $location['postal_code'];
}
if (!empty($location['country'])) {
if (!empty($address)) {
$address .= ', ';
}
$address .= $location['country'];
}
return $address;
}