From: Laury GvR Date: Wed, 7 Aug 2019 23:16:41 +0000 (-0400) Subject: POI route, added default values for latlon parameters X-Git-Url: http://cvs2.gaslightmedia.com/gitweb/index.cgi?a=commitdiff_plain;h=f92d4d6252777caad20ebb1ffb3c481c7e20e452;p=WP-Plugins%2Fglm-member-db-rest-api.git POI route, added default values for latlon parameters --- diff --git a/setup/routes/pointsOfInterest.php b/setup/routes/pointsOfInterest.php index 5d33fc9..5e90390 100644 --- a/setup/routes/pointsOfInterest.php +++ b/setup/routes/pointsOfInterest.php @@ -61,29 +61,26 @@ class GLMA_POI_Rest_Controller 'callback' => function( $request ) { // Defaults - $limit = 1; - // Parameter collection & assignment $this->params = $request->get_params(); - $latMin = $this->params['latMin']; + $addons = explode( ",", $this->params['addons'] ); + + $latMin = $this->params['latMin'] ?? -90.0; $lastLatMin = $this->params['lastLatMin']; - $latMax = $this->params['latMax']; + $latMax = $this->params['latMax'] ?? 90.0; $lastLatMax = $this->params['lastLatMax']; - $lonMin = $this->params['lonMin']; + $lonMin = $this->params['lonMin'] ?? -180.0; $lastLonMin = $this->params['lastLonMin']; - $lonMax = $this->params['lonMax']; + $lonMax = $this->params['lonMax'] ?? 180.0; $lastLonMax = $this->params['lastLonMax']; - $poiRequest = $this->params['poiRequest']; + $poiRequest = $this->params['poiRequest'] ?? "Anywhere"; - $addons = explode( ",", $this->params['addons'] ); $searchText = "test"; - if (isset($this->params['limit'])) { - $limit = $this->params['limit']; - } + $limit = $this->params['limit'] ?? 5; //$mapItems = $MapItems->modelAction($data['request'], $data['area'], $data['filter']);