* This version has been taken from Drupal's location module: http://drupal.org/project/location
*/
+ /**
+ * @var string
+ */
static protected $_earthFlattening;
static protected $_earthRadiusSemiMinor;
static protected $_earthRadiusSemiMajor;
$y = ($radius + $height) * $cosLat * $sinLong;
$z = ($radius * (1 - self::$_earthEccentricitySQ) + $height) * $sinLat;
- return array($x, $y, $z);
+ return [$x, $y, $z];
}
/**
$maxLong = $maxLong - pi() * 2;
}
- return array(
+ return [
rad2deg($minLong),
rad2deg($maxLong),
- );
+ ];
}
/**
$maxLat = $rightangle;
}
- return array(
+ return [
rad2deg($minLat),
rad2deg($maxLat),
- );
+ ];
}
/**
public static function where($latitude, $longitude, $distance, $tablePrefix = 'civicrm_address') {
self::initialize();
- $params = array();
- $clause = array();
+ $params = [];
+ $clause = [];
list($minLongitude, $maxLongitude) = self::earthLongitudeRange($longitude, $latitude, $distance);
list($minLatitude, $maxLatitude) = self::earthLatitudeRange($longitude, $latitude, $distance);
// DONT consider NAN values (which is returned by rad2deg php function)
// for checking BETWEEN geo_code's criteria as it throws obvious 'NAN' field not found DB: Error
- $geoCodeWhere = array();
+ $geoCodeWhere = [];
if (!is_nan($minLatitude)) {
$geoCodeWhere[] = "{$tablePrefix}.geo_code_1 >= $minLatitude ";
}
list($name, $op, $distance, $grouping, $wildcard) = $values;
// also get values array for all address related info
- $proximityVars = array(
+ $proximityVars = [
'street_address' => 1,
'city' => 1,
'postal_code' => 1,
'distance_unit' => 0,
'geo_code_1' => 0,
'geo_code_2' => 0,
- );
+ ];
- $proximityAddress = array();
- $qill = array();
+ $proximityAddress = [];
+ $qill = [];
foreach ($proximityVars as $var => $recordQill) {
$proximityValues = $query->getWhereValues("prox_{$var}", $grouping);
if (!empty($proximityValues) &&
}
$qill = ts('Proximity search to a distance of %1 from %2',
- array(
+ [
1 => $qillUnits,
2 => implode(', ', $qill),
- )
+ ]
);
$query->_tables['civicrm_address'] = $query->_whereTables['civicrm_address'] = 1;
foreach ($input as $param) {
if (CRM_Utils_Array::value('0', $param) == 'prox_distance') {
// add prox_ prefix to these
- $param_alter = array('street_address', 'city', 'postal_code', 'state_province', 'country');
+ $param_alter = ['street_address', 'city', 'postal_code', 'state_province', 'country'];
foreach ($input as $key => $_param) {
if (in_array($_param[0], $param_alter)) {