function gmap_todim in GMap Module 6
Same name and namespace in other branches
- 5 gmap.module \gmap_todim()
- 6.2 gmap.module \gmap_todim()
- 7.2 gmap.module \gmap_todim()
- 7 gmap.module \gmap_todim()
Make sure a string is a valid css dimension.
2 calls to gmap_todim()
- GMapSimpleAPITest::testGMapToDim in tests/
gmap.test - Verify gmap_todim().
- gmap_dimension_validate in ./
gmap.module - Ensure a textfield is a valid css dimension string.
File
- ./
gmap.module, line 436 - 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;
}
}