X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=CRM%2FUtils%2FGeocode%2FYahoo.php;h=f5b22f92bd2581c4e3add68f9a2ec218e7bca310;hb=61fa74bdc01c239e020556bd948f4acc3b8332e4;hp=7dd1e82692fb1d3bcbec71ad30957d429a0ad0a1;hpb=d44a51e500618f1d9abfad4cc6de65cf20226c10;p=civicrm-core.git diff --git a/CRM/Utils/Geocode/Yahoo.php b/CRM/Utils/Geocode/Yahoo.php index 7dd1e82692..f5b22f92bd 100644 --- a/CRM/Utils/Geocode/Yahoo.php +++ b/CRM/Utils/Geocode/Yahoo.php @@ -3,7 +3,7 @@ +--------------------------------------------------------------------+ | CiviCRM version 4.6 | +--------------------------------------------------------------------+ - | Copyright CiviCRM LLC (c) 2004-2014 | + | Copyright CiviCRM LLC (c) 2004-2015 | +--------------------------------------------------------------------+ | This file is a part of CiviCRM. | | | @@ -23,12 +23,12 @@ | GNU Affero General Public License or the licensing of CiviCRM, | | see the CiviCRM license FAQ at http://civicrm.org/licensing | +--------------------------------------------------------------------+ -*/ + */ /** * * @package CRM - * @copyright CiviCRM LLC (c) 2004-2014 + * @copyright CiviCRM LLC (c) 2004-2015 * $Id$ * */ @@ -43,15 +43,13 @@ class CRM_Utils_Geocode_Yahoo { * Server to retrieve the lat/long * * @var string - * @static */ static protected $_server = 'query.yahooapis.com'; /** - * Uri of service + * Uri of service. * * @var string - * @static */ static protected $_uri = '/v1/public/yql'; @@ -60,11 +58,13 @@ class CRM_Utils_Geocode_Yahoo { * and postal code for this address. Note that at a later stage, we could * make this function also clean up the address into a more valid format * - * @param array $values associative array of address data: country, street_address, city, state_province, postal code - * @param boolean $stateName this parameter currently has no function + * @param array $values + * Associative array of address data: country, street_address, city, state_province, postal code. + * @param bool $stateName + * This parameter currently has no function. * - * @return boolean true if we modified the address, false otherwise - * @static + * @return bool + * true if we modified the address, false otherwise */ public static function format(&$values, $stateName = FALSE) { CRM_Utils_System::checkPHPVersion(5, TRUE); @@ -118,7 +118,7 @@ class CRM_Utils_Geocode_Yahoo { $add = 'q=' . urlencode('select * from geo.placefinder where '); - $add .= join(urlencode(' and '), $whereComponents); + $add .= implode(urlencode(' and '), $whereComponents); $add .= "&appid=" . urlencode($config->mapAPIKey); @@ -172,7 +172,7 @@ class CRM_Utils_Geocode_Yahoo { if (CRM_Utils_System::isUserLoggedIn()) { $msg = ts('The Yahoo Geocoding system returned a different postal code (%1) than the one you entered (%2). If you want the Yahoo value, please delete the current postal code and save again.', array( 1 => $ret['postal'], - 2 => $current_pc_suffix ? "$current_pc-$current_pc_suffix" : $current_pc + 2 => $current_pc_suffix ? "$current_pc-$current_pc_suffix" : $current_pc, )); CRM_Core_Session::setStatus($msg, ts('Postal Code Mismatch'), 'error'); @@ -185,11 +185,11 @@ class CRM_Utils_Geocode_Yahoo { $values['postal_code'] = $ret['postal']; /* the following logic to split the string was borrowed from - CRM/Core/BAO/Address.php -- CRM_Core_BAO_Address::fixAddress. - This is actually the function that calls the geocoding - script to begin with, but the postal code business takes - place before geocoding gets called. - */ + CRM/Core/BAO/Address.php -- CRM_Core_BAO_Address::fixAddress. + This is actually the function that calls the geocoding + script to begin with, but the postal code business takes + place before geocoding gets called. + */ if (preg_match('/^(\d{4,5})[+-](\d{4})$/', $ret['postal'], @@ -208,4 +208,5 @@ class CRM_Utils_Geocode_Yahoo { $values['geo_code_1'] = $values['geo_code_2'] = 'null'; return FALSE; } + }