You are here

function _location_ca_yahoo_csz_get_field in Location 7.4

Same name and namespace in other branches
  1. 5.3 supported/location.ca.inc \_location_ca_yahoo_csz_get_field()
  2. 5 supported/location.ca.inc \_location_ca_yahoo_csz_get_field()
  3. 6.3 supported/location.ca.inc \_location_ca_yahoo_csz_get_field()
  4. 7.5 supported/location.ca.inc \_location_ca_yahoo_csz_get_field()
  5. 7.3 supported/location.ca.inc \_location_ca_yahoo_csz_get_field()
2 calls to _location_ca_yahoo_csz_get_field()
location_map_link_ca_yahoo in supported/location.ca.inc
_location_driving_directions_link_ca_yahoo in supported/location.ca.inc
Parameters: Function that is called by location_driving_directions_link_ca() under assumption that it is the chosen function

File

supported/location.ca.inc, line 282

Code

function _location_ca_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['province'])) {
    if (strlen($location['city'])) {
      return urlencode($location['city']);
    }
    else {
      return urlencode($location['province']);
    }
  }
  return '';
}