EmbedGoogleMapNewHtmlBuilder

The Embed Google Map EmbedGoogleMapNewHtmlBuilder class.

Defined (1)

The class is defined in the following location(s).

/embed_google_map.php  
  1. class EmbedGoogleMapNewHtmlBuilder extends EmbedGoogleMapHtmlBuilder { 
  2.  
  3. private $baseUrl = "https://www.google.com/maps"; 
  4.  
  5. public function buildHtml(&$params) { 
  6. $url = parent::getUrl($params, $this->baseUrl); 
  7.  
  8. $html = parent::getIFrameBegin($params); 
  9.  
  10. if($params->isLink() == 0) { 
  11. $url .= "?q=".$params->getAddress(); 
  12.  
  13. if($params->isGoogleMapsEngine() == 0) { 
  14. $url .= "&z=".$params->getZoomLevel(); 
  15. $url .= "&t=".$this->getMapType($params->getMapType()); 
  16. if(strcmp($params->getLanguage(), '-') != 0) { 
  17. $url .= "&hl=".$params->getLanguage(); 
  18. $html .= "src='$url&output=embed'></iframe>\n"; 
  19.  
  20. if($params->getAddLink() == 1) { 
  21. if($params->isGoogleMapsEngine() == 1) { 
  22. $url = str_replace('/embed', '/viewer', $url); 
  23. } else if($params->isLink() == 0) { 
  24. $url = str_replace('/maps', '/maps/preview', $url); 
  25. $html .= parent::getLinkHtml($url, $params->getLinkLabel()); 
  26. return $html; 
  27.  
  28. private function getMapType($mapType) { 
  29. if(strcmp(strtolower($mapType), 'm') == 0 || strcmp(strtolower($mapType), 'k') == 0) { 
  30. return $mapType; 
  31. } else { 
  32. return 'm';