Beispiel #1
0
 protected function set_latlng()
 {
     $this->latitude = NULL;
     $this->longitude = NULL;
     $google = Google::geocode("address", "{$this->address} {$this->zip}");
     if (is_null($google->latitude) and is_null($google->longitude)) {
         $google = Google::geocode("address", "{$this->zip}");
     }
     if (!is_null($google->latitude) and !is_null($google->longitude)) {
         $this->latitude = (double) $google->latitude;
         $this->longitude = (double) $google->longitude;
     }
 }
Beispiel #2
0
 protected function setLatLng()
 {
     $this->latitude = null;
     $this->longitude = null;
     $google = Google::geocode('address', "{$this->address} {$this->zip}");
     if (is_null($google->latitude) && is_null($google->longitude)) {
         $google = Google::geocode("address", "{$this->zip}");
     }
     if (!is_null($google->latitude) && !is_null($google->longitude)) {
         $this->latitude = (double) $google->latitude;
         $this->longitude = (double) $google->longitude;
     }
 }
Beispiel #3
0
 function google()
 {
     $this->set('title', 'Google');
     $this->expect(is_null($this->get('ERROR')), 'No errors expected at this point', 'ERROR variable is set: ' . $this->get('ERROR.text'));
     $this->expect(extension_loaded('sockets'), 'Sockets extension available', 'Sockets extension is not active - unable to continue');
     if (extension_loaded('sockets')) {
         $this->expect(TRUE, 'Google map<br/><img src="/google/map" alt="Google Map"/>');
         $search = Google::search('google');
         $this->set('QUIET', TRUE);
         $this->expect(is_array($search), 'Google search generated the following results:<br/>' . implode('<br/>', $this->pick($search['results'], 'url')), 'Google search failure: ' . var_export($search, TRUE));
         $this->set('QUIET', FALSE);
         $geocode = Google::geocode('1600 Amphitheatre Pkwy, Mountain View, CA 94043, USA');
         $this->set('QUIET', TRUE);
         $this->expect(is_array($geocode), 'Geocode API call success', 'Geocode API call failure: ' . var_export($geocode, TRUE));
         $this->set('QUIET', FALSE);
     }
     echo $this->render('basic/results.htm');
 }