function _getlocations_compress_icon_def in Get Locations 7
Same name and namespace in other branches
- 6.2 getlocations.markerinfo.inc \_getlocations_compress_icon_def()
- 6 getlocations.markerinfo.inc \_getlocations_compress_icon_def()
- 7.2 getlocations.markerinfo.inc \_getlocations_compress_icon_def()
Make a compressed definition. A series of arrays with trailing holes allowed. Any missing values at the end of subarrays are equal to the last defined value.
1 call to _getlocations_compress_icon_def()
- _getlocations_get_icondata in ./
getlocations.markerinfo.inc - Get marker icon data for constructing json object.
File
- ./
getlocations.markerinfo.inc, line 173 - getlocations.markerinfo.inc @author Bob Hutchinson http://drupal.org/user/52366 @copyright GNU GPL
Code
function _getlocations_compress_icon_def($iconset) {
$order = array(
'key',
'name',
'sequence',
'imagepoint1X',
'imagepoint1Y',
'imagepoint2X',
'imagepoint2Y',
'shadow',
'shadowpoint1X',
'shadowpoint1Y',
'shadowpoint2X',
'shadowpoint2Y',
'shapecoords',
'shapetype',
);
$ints = array(
3 => TRUE,
4 => TRUE,
5 => TRUE,
6 => TRUE,
8 => TRUE,
9 => TRUE,
10 => TRUE,
11 => TRUE,
);
$nulls = array(
'',
'',
array(),
0,
0,
0,
0,
'',
0,
0,
0,
0,
'',
'',
);
$a = array();
for ($c0 = 0; $c0 < count($order); $c0++) {
$a[$c0] = array();
for ($c1 = 0; $c1 < count($iconset); $c1++) {
$temp = isset($iconset[$c1][$order[$c0]]) ? $iconset[$c1][$order[$c0]] : $nulls[$c0];
// Ensure that numeric quantities are encoded as ints, not strings.
if (isset($ints[$c0])) {
$temp = (int) $temp;
}
$a[$c0][$c1] = $temp;
}
_getlocations_compress_array($a[$c0]);
}
for ($c0--; $c0 >= 0; $c0--) {
if ($a[$c0] === array(
$nulls[$c0],
)) {
unset($a[$c0]);
}
else {
break;
}
}
return $a;
}