You are here

function _location_au_yahoo_csz_get_field in Location 7.3

Same name and namespace in other branches
  1. 5.3 supported/location.au.inc \_location_au_yahoo_csz_get_field()
  2. 6.3 supported/location.au.inc \_location_au_yahoo_csz_get_field()
  3. 7.5 supported/location.au.inc \_location_au_yahoo_csz_get_field()
  4. 7.4 supported/location.au.inc \_location_au_yahoo_csz_get_field()

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_au_yahoo_csz_get_field()
location_map_link_au_yahoo in supported/location.au.inc
Yahoo link.
_location_driving_directions_link_au_yahoo in supported/location.au.inc
Directions link.

File

supported/location.au.inc, line 464
Australia.

Code

function _location_au_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 '';
}