You are here

function getlocations_dim_check in Get Locations 7.2

Same name and namespace in other branches
  1. 7 getlocations.module \getlocations_dim_check()

Function

Return value

Returns

10 calls to getlocations_dim_check()
getlocations_element_validate_dim in ./getlocations.module
Function
getlocations_fields_plugin_style_streetview::options_validate in modules/getlocations_fields/views/getlocations_fields_plugin_style_streetview.inc
Validate the options form.
getlocations_fields_settings_validate in modules/getlocations_fields/getlocations_fields.admin.inc
Validation function
getlocations_leaflet_plugin_style::options_validate in modules/getlocations_leaflet/views/getlocations_leaflet_plugin_style.inc
Validate the options form.
getlocations_leaflet_settings_validate in modules/getlocations_leaflet/getlocations_leaflet.module

... See full list

File

./getlocations.module, line 5694
getlocations.module @author Bob Hutchinson http://drupal.org/user/52366 @copyright GNU GPL

Code

function getlocations_dim_check($string) {
  if (!is_string($string) || empty($string)) {
    return FALSE;
  }
  $s = strtolower(trim($string));
  $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;
  }
}