function gmap_todim in GMap Module 5
Same name and namespace in other branches
- 6.2 gmap.module \gmap_todim()
- 6 gmap.module \gmap_todim()
- 7.2 gmap.module \gmap_todim()
- 7 gmap.module \gmap_todim()
Make sure a string is a valid css dimension.
1 call to gmap_todim()
- gmap_dimension_validate in ./
gmap.module - Ensure a textfield is a valid css dimension string.
File
- ./
gmap.module, line 403 - GMap -- Routines to use the Google Maps API in Drupal.
Code
function gmap_todim($instring) {
if (!is_string($instring)) {
return FALSE;
}
$s = strtolower(trim($instring));
$matches = array();
if (preg_match('/^([\\d.]+)\\s*(em|ex|px|in|cm|mm|pt|pc|%)$/', $s, $matches)) {
return $matches[1] . $matches[2];
}
else {
return FALSE;
}
}