<?php
/*
+--------------------------------------------------------------------+
- | CiviCRM version 5 |
- +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2019 |
- +--------------------------------------------------------------------+
- | This file is a part of CiviCRM. |
- | |
- | CiviCRM is free software; you can copy, modify, and distribute it |
- | under the terms of the GNU Affero General Public License |
- | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
+ | Copyright CiviCRM LLC. All rights reserved. |
| |
- | CiviCRM is distributed in the hope that it will be useful, but |
- | WITHOUT ANY WARRANTY; without even the implied warranty of |
- | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
- | See the GNU Affero General Public License for more details. |
- | |
- | You should have received a copy of the GNU Affero General Public |
- | License and the CiviCRM Licensing Exception along |
- | with this program; if not, contact CiviCRM LLC |
- | at info[AT]civicrm[DOT]org. If you have questions about the |
- | GNU Affero General Public License or the licensing of CiviCRM, |
- | see the CiviCRM license FAQ at http://civicrm.org/licensing |
+ | This work is published under the GNU AGPLv3 license with some |
+ | permitted exceptions and without any warranty. For full license |
+ | and copyright information, see https://civicrm.org/licensing |
+--------------------------------------------------------------------+
*/
/**
*
* @package CRM
- * @copyright CiviCRM LLC (c) 2004-2019
+ * @copyright CiviCRM LLC https://civicrm.org/licensing
*/
class CRM_Contact_BAO_ProximityQuery {
* 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)) {