function _gmap_compress_icon_def in GMap Module 6
Same name and namespace in other branches
- 5 gmap_markerinfo.inc \_gmap_compress_icon_def()
- 6.2 gmap_markerinfo.inc \_gmap_compress_icon_def()
- 7.2 gmap_markerinfo.inc \_gmap_compress_icon_def()
- 7 gmap_markerinfo.inc \_gmap_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 _gmap_compress_icon_def()
- _gmap_get_icondata in ./
gmap_markerinfo.inc - Get marker icon data for constructing json object.
File
- ./
gmap_markerinfo.inc, line 164 - GMap marker information routines.
Code
function _gmap_compress_icon_def($iconset) {
$order = array(
'key',
'name',
'sequence',
'anchorX',
'anchorY',
'infoX',
'infoY',
'shadow',
'printImage',
'mozPrintImage',
'printShadow',
'transparent',
);
$ints = array(
3 => TRUE,
4 => TRUE,
5 => TRUE,
6 => TRUE,
);
$nulls = array(
'',
'',
array(),
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;
}
_gmap_compress_array($a[$c0]);
}
for ($c0--; $c0 >= 0; $c0--) {
if ($a[$c0] === array(
$nulls[$c0],
)) {
unset($a[$c0]);
}
else {
break;
}
}
return $a;
}