You are here

function getlocations_fields_handler_argument_bbox::_convert_bbox_coords in Get Locations 7.2

Same name and namespace in other branches
  1. 7 modules/getlocations_fields/handlers/getlocations_fields_handler_argument_bbox.inc \getlocations_fields_handler_argument_bbox::_convert_bbox_coords()

Split BBOX string into {left, bottom, right, top}

1 call to getlocations_fields_handler_argument_bbox::_convert_bbox_coords()
getlocations_fields_handler_argument_bbox::query in modules/getlocations_fields/handlers/getlocations_fields_handler_argument_bbox.inc
Use the filter to modify the query.

File

modules/getlocations_fields/handlers/getlocations_fields_handler_argument_bbox.inc, line 36
getlocations_fields_handler_argument_bbox.inc @author Bob Hutchinson http://drupal.org/user/52366 @copyright GNU GPL

Class

getlocations_fields_handler_argument_bbox
Argument handler to accept bbox

Code

function _convert_bbox_coords($bbox_coords_str) {
  $bbox_coords = explode(',', $bbox_coords_str);
  $bbox = array();
  if (count($bbox_coords) == 4) {
    $left = $bbox_coords[0];
    $bottom = $bbox_coords[1];
    $right = $bbox_coords[2];
    $top = $bbox_coords[3];
    $left = trim($left);
    $bottom = trim($bottom);
    $right = trim($right);
    $top = trim($top);
    if (is_numeric($left) && is_numeric($bottom) && is_numeric($right) && is_numeric($top)) {
      $bbox['left'] = floatval(getlocations_normalizelng($left));
      $bbox['bottom'] = floatval(getlocations_normalizelat($bottom));
      $bbox['right'] = floatval(getlocations_normalizelng($right));
      $bbox['top'] = floatval(getlocations_normalizelat($top));
      return $bbox;
    }
  }
  return FALSE;
}