function _location_nz_yahoo_csz_get_field in Location 7.3
Don't mess with this function unless you understand its logic.
It has to do with the question of "to comma or not to comma?
2 calls to _location_nz_yahoo_csz_get_field()
- location_map_link_nz_yahoo in supported/
location.nz.inc - Return a Yahoo! map URL.
- _location_driving_directions_link_nz_yahoo in supported/
location.nz.inc - Yahoo link.
File
- supported/
location.nz.inc, line 555 - New Zealand.
Code
function _location_nz_yahoo_csz_get_field($location) {
// For some reasons, to the end of pinpointing a location, Yahoo! Maps and Driving Directions
// do better a better job with retrieving info based strictly on a Canadian city/province
// than on a Canadian postal code.
if ($location['country'] = 'ca') {
if (strlen($location['city']) && strlen($location['province'])) {
return urlencode($location['city'] . ', ' . $location['province']);
}
if (strlen($location['postal_code'])) {
return urlencode($location['postal_code']);
}
}
else {
if (strlen($location['postal_code'])) {
return urlencode($location['postal_code']);
}
if (strlen($location['city']) && strlen($location['province'])) {
return urlencode($location['city'] . ', ' . $location['province']);
}
}
if (strlen($location['city']) || strlen($location['state'])) {
if (strlen($location['city'])) {
return urlencode($location['city']);
}
else {
return urlencode($location['state']);
}
}
return '';
}