@ -32,7 +32,7 @@ function dec_to_dms($coord) {
*/
function dms_to_dec($ref, $deg, $min, $sec) {
$arrLatLong = array() ;
$arrLatLong = [] ;
$arrLatLong['N'] = 1;
$arrLatLong['E'] = 1;
$arrLatLong['S'] = -1;
@ -139,9 +139,9 @@ function critere_distancefrom_dist($idb, &$boucles, $crit) {
($id_table == 'gis' or isset($boucle->join['gis'])) // Soit depuis une boucle (GIS) soit un autre objet mais avec {gis}
and count($crit->param) == 3 // Il faut aussi qu'il y ait 3 critères obligatoires
) {
$point_reference = calculer_liste($crit->param[0], array() , $boucles, $boucles[$idb]->id_parent);
$operateur = calculer_liste($crit->param[1], array() , $boucles, $boucles[$idb]->id_parent);
$distance = calculer_liste($crit->param[2], array() , $boucles, $boucles[$idb]->id_parent);
$point_reference = calculer_liste($crit->param[0], [] , $boucles, $boucles[$idb]->id_parent);
$operateur = calculer_liste($crit->param[1], [] , $boucles, $boucles[$idb]->id_parent);
$distance = calculer_liste($crit->param[2], [] , $boucles, $boucles[$idb]->id_parent);
// Si le point de référence est un entier, on essaye de récupérer les coordonnées du point GIS
// Et si on a toujours pas de tableau correct, on met false
@ -179,7 +179,7 @@ function critere_gis_dist($idb, &$boucles, $crit) {
if ($id_table == 'gis') {
// exclure l'élément en cours des résultats
$id_gis = calculer_argument_precedent($idb, $primary, $boucles);
$boucle->where[] = array("'!='", "'$boucle->id_table." . "$primary'", $id_gis) ;
$boucle->where[] = ["'!='", "'$boucle->id_table." . "$primary'", $id_gis] ;
// récupérer les paramètres du critère
$op = '';
@ -192,7 +192,7 @@ function critere_gis_dist($idb, &$boucles, $crit) {
$op_val = $r[3];
}
if ($op) {
$boucle->having[] = array("'" . $op . "'", "'" . $type . "'",$op_val) ;
$boucle->having[] = ["'" . $op . "'", "'" . $type . "'",$op_val] ;
}
// récupérer lat/lon du point de la boucle englobante
@ -212,7 +212,7 @@ function critere_gis_dist($idb, &$boucles, $crit) {
if ($crit->not) {
$boucle->from['gis_liens'] = 'spip_gis_liens';
$boucle->from_type['gis_liens'] = 'LEFT';
$boucle->join['gis_liens'] = array( "'$id_table'","'id_objet'","'$primary'","'gis_liens.objet='.sql_quote('$objet')") ;
$boucle->join['gis_liens'] = [ "'$id_table'","'id_objet'","'$primary'","'gis_liens.objet='.sql_quote('$objet')"] ;
$boucle->where[] = "'gis_liens.id_gis IS NULL'";
/* Recherche d'objets AVEC point + ajout des champs GIS */
@ -230,15 +230,15 @@ function critere_gis_dist($idb, &$boucles, $crit) {
// cf plugin notation
// $boucle->join["surnom (as) table de liaison"] = array("surnom de la table a lier", "cle primaire de la table de liaison", "identifiant a lier", "type d'objet de l'identifiant");
$boucle->from['gis_liens'] = 'spip_gis_liens';
$boucle->join['gis_liens'] = array( "'$id_table'","'id_objet'","'$primary'","'gis_liens.objet='.sql_quote('$objet')") ;
$boucle->join['gis_liens'] = [ "'$id_table'","'id_objet'","'$primary'","'gis_liens.objet='.sql_quote('$objet')"] ;
$boucle->from['gis'] = 'spip_gis';
$boucle->join['gis'] = array("'gis_liens'","'id_gis'") ;
$boucle->join['gis'] = ["'gis_liens'","'id_gis'"] ;
// bien renvoyer tous les points qui son attachés à l'objet
// mais attention, si on trouve en amont un groupement portant sur un champ *de GIS*,
// alors cela signifie que la personne veut faire une opération de groupement sur les points donc là on n'ajoute pas id_gis
$tous_les_points = true;
foreach ($boucle->group as $champ) {
if (in_array($champ, array( 'ville', 'code_postal', 'pays', 'code_pays', 'region','departement') )) {
if (in_array($champ, [ 'ville', 'code_postal', 'pays', 'code_pays', 'region','departement'] )) {
$tous_les_points = false;
}
}
@ -395,7 +395,7 @@ function gis_layer_defaut() {
* @return array
*/
function gis_modele_url_json_env($env) {
$contexte = array() ;
$contexte = [] ;
if (is_string($env)) {
$env = unserialize($env);
}
@ -409,7 +409,7 @@ function gis_modele_url_json_env($env) {
}
}
// puis cas particuliers et ceux ajoutés par le pipeline
$keys = pipeline('gis_modele_parametres_autorises', array( 'objet', 'id_objet', 'id_secteur', 'id_parent', 'media', 'recherche', 'mots', 'pays', 'code_pays', 'region', 'departement', 'ville', 'code_postal', 'adresse') );
$keys = pipeline('gis_modele_parametres_autorises', [ 'objet', 'id_objet', 'id_secteur', 'id_parent', 'media', 'recherche', 'mots', 'pays', 'code_pays', 'region', 'departement', 'ville', 'code_postal', 'adresse'] );
foreach ($keys as $key) {
if (isset($env[$key])) {
$contexte[$key] = is_array($env[$key]) ? $env[$key] : trim($env[$key]);
@ -493,24 +493,24 @@ function gis_icon_properties($img = '') {
if ($icon) {
$props .= ",\n\t\t\t\"icon\": " . json_encode(url_absolue($icon)) . ',';
list($h,$w) = taille_image($icon);
$props .= "\n\t\t\t\"icon_size\": " . json_encode(array($w,$h) ) . ',';
$props .= "\n\t\t\t\"icon_size\": " . json_encode([$w,$h] ) . ',';
/**
* Si l'icone est carrée, on considère que c'est soit un point soit un carré qui pointe un lieu et non une "goutte"
* On centre donc au milieu de l'icone
*/
if ($w == $h) {
$props .= "\n\t\t\t\"icon_anchor\": " . json_encode(array($w / 2, $h / 2) ) . ',';
$props .= "\n\t\t\t\"popup_anchor\": " . json_encode(array(0,0) );
$props .= "\n\t\t\t\"icon_anchor\": " . json_encode([$w / 2, $h / 2] ) . ',';
$props .= "\n\t\t\t\"popup_anchor\": " . json_encode([0,0] );
} else {
$props .= "\n\t\t\t\"icon_anchor\": " . json_encode(array($w / 2, $h) ) . ',';
$props .= "\n\t\t\t\"popup_anchor\": " . json_encode(array(1, -round($h / 1.2, 2)) );
$props .= "\n\t\t\t\"icon_anchor\": " . json_encode([$w / 2, $h] ) . ',';
$props .= "\n\t\t\t\"popup_anchor\": " . json_encode([1, -round($h / 1.2, 2)] );
}
}
if ($shadow = find_in_path('images/marker_defaut_shadow.png')) {
$props .= ",\n\t\t\t\"shadow\": " . json_encode(url_absolue($shadow));
list($h,$w) = taille_image($shadow);
$props .= ",\n\t\t\t\"shadow_size\": " . json_encode(array($w,$h) );
$props .= ",\n\t\t\t\"shadow_size\": " . json_encode([$w,$h] );
}
return $props;