Starting from line #556 there is google maps code. Is line 79 correct or should i do something in the code that starts from line 556??
The code starting from line 556 is this:
/* Google maps */
public static function googlemap($atts, $content = null){
extract(Shortcodes_Parser::instance()->atts(array(
'title' => '',
'iframe_src' => '',
'addr' => '',
'lat' => '',
'lng' => '',
'ratio' => '',
'width' => '',
'height' => ''
), $atts));
$googlemap = '';
$map_id = self::randomString(10);
if( $iframe_src==''){
$address = str_replace(' ', '+', $addr);
$jsonResponse = @file_get_contents('http://maps.googleapis.com/maps/api/geocode/json?address='.$address);
if ($jsonResponse) {
$jsonResponse = json_decode($jsonResponse);
$lat = $lat==''?$jsonResponse->results[0]->geometry->location->lat:$lat;
$lng = $lng==''?$jsonResponse->results[0]->geometry->location->lng:$lng;
}
}
$ratio = explode(':', $ratio);
$style = ' style="'.($width!=''?'width:'.$width.';':'').($height!=''?'height:'.$height.';':($ratio!=''?'padding-bottom:'.(($ratio[1]/$ratio[0])*100).'%;':'')).'"';
// $googlemap .= '<script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?language='.JFactory::getLanguage()->getTag().'"></script>';
$googlemap .= '<div class="embed-responsive"'.$style.'>';
if ($iframe_src!=''){
$googlemap .= '<iframe class="embed-responsive-item" src="'.$iframe_src.'" frameborder="0" style="border:0"></iframe>';
} else {
$googlemap .= '<div id="gmap_canvas'.$map_id.'" class="embed-responsive-item"></div>'
. '<style>#gmap_canvas'.$map_id.' img{max-width:none!important;background:none!important}</style>';
}
$googlemap .= '</div>';
if( $iframe_src==''){
$googlemap .= '<script type="text/javascript">'
. 'function init_map(){'
. 'var myOptions = {'
. 'zoom:16,'
. 'center:new google.maps.LatLng(' . $lat . ',' . $lng . '),'
. 'mapTypeId: google.maps.MapTypeId.ROADMAP'
. '};'
. 'map = new google.maps.Map(document.getElementById("gmap_canvas'.$map_id.'"), myOptions);'
. 'marker = new google.maps.Marker({'
. 'map: map,'
. 'position: new google.maps.LatLng(' . $lat . ',' . $lng . ')'
. '});'
. 'infowindow = new google.maps.InfoWindow({'
. 'content:"'. ($title!=''?'<b>'.$title.'</b><br/>':'').$addr.'"'
. '});'
. 'google.maps.event.addListener(marker, "click", function(){'
. 'infowindow.open(map,marker);'
. '});'
. 'infowindow.open(map,marker);'
. '}'
. 'google.maps.event.addDomListener(window, \'load\', init_map);'
. '</script>';
}
return $googlemap;
}