You are here

function getdirections_latlon_check in Get Directions 7.3

Same name and namespace in other branches
  1. 6.2 getdirections.module \getdirections_latlon_check()
  2. 7.2 getdirections.module \getdirections_latlon_check()

Function to check a lat,lon string

Parameters

string $latlon:

Return value

Returns true or false

8 calls to getdirections_latlon_check()
getdirections_entity_setlocation in ./getdirections.module
Function to setup the map
getdirections_entity_setlocations in ./getdirections.module
Function to setup the map
getdirections_entity_setlocations_via in ./getdirections.module
Function to setup the map to display waypoints
getdirections_fields_field_formatter_view in modules/getdirections_fields/getdirections_fields.module
Implements hook_field_formatter_view(). Build a renderable array for a field value.
getdirections_latlon in ./getdirections.module
Function to setup the map and form

... See full list

File

./getdirections.module, line 1597
Fetches google map directions.

Code

function getdirections_latlon_check($latlon) {
  if (!empty($latlon) && preg_match("/[0-9.\\-],[0-9.\\-]/", $latlon)) {
    $ll = explode(',', $latlon);
    if (isset($ll[0]) && is_numeric($ll[0]) && $ll[0] != 0 && isset($ll[1]) && is_numeric($ll[1]) && $ll[1] != 0) {
      return $latlon;
    }
  }
  return FALSE;
}