Ejemplo n.º 1
0
 public static function mapRenderer(Address $address)
 {
     static::setContentType('text/html');
     $formatter = new \Geocoder\Formatter\StringFormatter();
     $latitude = $address->getLatitude();
     $longitude = $address->getLongitude();
     $title = $formatter->format($address, "%L, %S, %n");
     $body = "\n\t\t\t<iframe \n\t\t\t\tframeborder='0'\n\t\t\t\tscrolling='no' \n\t\t\t\tmarginheight='0'\n\t\t\t\tmarginwidth='0'\n\t\t\t\twidth='300' \n\t\t\t\theight='300' \n\t\t\t\tsrc='https://maps.google.com/maps?hl=en&q={$latitude}, {$longitude}&ie=UTF8&t=m&z=19&iwloc=B&output=embed'>\n\t\t\t</iframe>\t\n\t\t";
     return static::htmlSerializer($body, static::$htmlMetadata, $title, null, self::GoogleAnalyticsSnippet(), true);
 }
Ejemplo n.º 2
0
 public function compare(\Geocoder\Geocoder $geocoder)
 {
     $data = new \stdClass();
     try {
         $time_pre = microtime(true);
         $address = $geocoder->limit(1)->geocode($this->query)->first();
         $time_post = microtime(true);
         $formatter = new \Geocoder\Formatter\StringFormatter();
         $data->address = $formatter->format($address, "%S %n, %z %L");
         $data->latitude = $address->getLatitude();
         $data->longitude = $address->getLongitude();
         $data->microtime = $time_post - $time_pre;
     } catch (\Exception $e) {
         $data = $e->getMessage();
     }
     $this->table[$geocoder->getName()] = $data;
     return $this;
 }
Ejemplo n.º 3
0
 /**
  * Format an address
  * @param \Geocoder\Model\Address $address
  * @param string $format
  * @return string
  */
 public static function formatAddress(\Geocoder\Model\Address $address, $format = null)
 {
     if ($format === null) {
         $format = self::config()->default_format;
     }
     $formatter = new \Geocoder\Formatter\StringFormatter();
     return $formatter->format($address, $format);
 }