function _location_us_geocoder_oneline in Location 5
Same name and namespace in other branches
- 5.3 supported/location.us.inc \_location_us_geocoder_oneline()
- 6.3 supported/location.us.inc \_location_us_geocoder_oneline()
- 7.5 supported/location.us.inc \_location_us_geocoder_oneline()
- 7.3 supported/location.us.inc \_location_us_geocoder_oneline()
- 7.4 supported/location.us.inc \_location_us_geocoder_oneline()
File
- supported/
location.us.inc, line 421
Code
function _location_us_geocoder_oneline($location = array()) {
$line = '';
$line .= $location['street'] . ', ';
if (strlen($location['city']) && strlen($location['province']) && strlen($location['postal_code'])) {
$line .= $location['city'] . ', ' . $location['province'] . ' ' . $location['postal_code'];
}
elseif (strlen($location['city']) && strlen($location['province'])) {
$line .= $location['city'] . ', ' . $location['state'];
}
elseif (strlen($location['postal_code'])) {
if (strlen($location['city']) || strlen($location['state'])) {
if (strlen($location['city'])) {
$line .= $location['city'] . ', ' . $location['postal_code'];
}
else {
$line .= $location['state'] . ', ' . $location['postal_code'];
}
}
else {
$line .= $location['postal_code'];
}
}
// DEBUG: commented code is for testing/debugging purposes
//print '_location_us_geocoder_oneline() RETURNING '. $line ."<br/>\n";
return $line;
}