function getlocations_get_circle_settings in Get Locations 7
Same name and namespace in other branches
- 7.2 getlocations.module \getlocations_get_circle_settings()
Function
Return value
Returns
2 calls to getlocations_get_circle_settings()
- getlocations_js_settings_do in ./
getlocations.module - Function sets up javascript settings
- getlocations_leaflet_map_settings_do in modules/
getlocations_leaflet/ getlocations_leaflet.module - Function
File
- ./
getlocations.module, line 5566 - getlocations.module @author Bob Hutchinson http://drupal.org/user/52366 @copyright GNU GPL
Code
function getlocations_get_circle_settings($defaults) {
$coords = preg_replace("/\r/", '', $defaults['circles_coords']);
$coords_arr = preg_split("/\n/", $coords);
$lla = array();
$circles = array();
$ct = 0;
if (!preg_match("/^#/", $defaults['circles_strokecolor'])) {
$defaults['circles_strokecolor'] = '#' . $defaults['circles_strokecolor'];
}
if (!preg_match("/^#/", $defaults['circles_fillcolor'])) {
$defaults['circles_fillcolor'] = '#' . $defaults['circles_fillcolor'];
}
foreach ($coords_arr as $line) {
$lla = array();
// set defaults
$circles['circles'][$ct]['strokeColor'] = $defaults['circles_strokecolor'];
$circles['circles'][$ct]['strokeOpacity'] = $defaults['circles_strokeopacity'];
$circles['circles'][$ct]['strokeWeight'] = $defaults['circles_strokeweight'];
$circles['circles'][$ct]['fillColor'] = $defaults['circles_fillcolor'];
$circles['circles'][$ct]['fillOpacity'] = $defaults['circles_fillopacity'];
$circles['circles'][$ct]['clickable'] = $defaults['circles_clickable'];
$circles['circles'][$ct]['message'] = $defaults['circles_message'];
$circles['circles'][$ct]['radius'] = $defaults['circles_radius'];
$linebits = explode("|", $line);
foreach ($linebits as $linebit) {
if ($latlon = getlocations_latlon_check($linebit)) {
$lla[] = $latlon;
}
else {
// not a latlon so could be a setting
if (preg_match("/strokeColor:(.*)/", $linebit, $match)) {
$m = $match[1];
$circles['circles'][$ct]['strokeColor'] = trim($m);
}
elseif (preg_match("/strokeOpacity:(.*)/", $linebit, $match)) {
$m = $match[1];
$circles['circles'][$ct]['strokeOpacity'] = trim($m);
}
elseif (preg_match("/strokeWeight:(.*)/", $linebit, $match)) {
$m = $match[1];
$circles['circles'][$ct]['strokeWeight'] = trim($m);
}
elseif (preg_match("/fillColor:(.*)/", $linebit, $match)) {
$m = $match[1];
$circles['circles'][$ct]['fillColor'] = trim($m);
}
elseif (preg_match("/fillOpacity:(.*)/", $linebit, $match)) {
$m = $match[1];
$circles['circles'][$ct]['fillOpacity'] = trim($m);
}
elseif (preg_match("/clickable:(.*)/", $linebit, $match)) {
$m = $match[1];
$circles['circles'][$ct]['clickable'] = trim($m);
}
elseif (preg_match("/message:(.*)/", $linebit, $match)) {
$m = $match[1];
$circles['circles'][$ct]['message'] = trim($m);
}
elseif (preg_match("/radius:(.*)/", $linebit, $match)) {
$m = $match[1];
$circles['circles'][$ct]['radius'] = trim($m);
}
}
}
if (count($lla) == 1) {
$circles['circles'][$ct]['coords'] = $lla;
}
$ct++;
}
return $circles;
}