';
if($info->isDynamic()) {
$content .= sprintf('
', esc_attr(json_encode($info)));
$content .= sprintf('
', $info->width, $info->height);
$content .= sprintf('

', self::getStaticMapUrl($info));
$content .= sprintf('
');
} else {
$content .= sprintf('

', self::getStaticMapUrl($info));
}
$content .= '
';
return $content;
}
//////////////////////////////////////////////////
/**
* Render an Google Maps for the current global post
*
* @param mixed $arguments
*/
public static function render($arguments = array()) {
$defaults = array(
'width' => self::$defaultWidth ,
'height' => self::$defaultHeight ,
'static' => false ,
'label' => null ,
'color' => null ,
'echo' => true ,
'marker_options' => array(
) ,
'map_options' => array(
)
);
$arguments = wp_parse_args($arguments, $defaults);
$options = Pronamic_Google_Maps::getOptions();
$pgm = Pronamic_Google_Maps::getMetaData();
$activeTypes = $options['active'];
global $post;
$active = isset($activeTypes[$post->post_type]) && $activeTypes[$post->post_type];
if($active && $pgm->active) {
$info = new Pronamic_Google_Maps_Info();
$info->title = $pgm->title;
$info->description = $pgm->description;
$info->latitude = $pgm->latitude;
$info->longitude = $pgm->longitude;
$info->width = $arguments['width'];
$info->height = $arguments['height'];
$info->static = filter_var($arguments['static'], FILTER_VALIDATE_BOOLEAN);
$info->label = $arguments['label'];
$info->color = $arguments['color'];
// Marker options
foreach($arguments['marker_options'] as $key => $value) {
$value = apply_filters('pronamic_google_maps_marker_options_' . $key, $value);
$info->markerOptions->$key = $value;
}
// Map options
$info->mapOptions->mapTypeId = $pgm->mapType;
$info->mapOptions->zoom = $pgm->zoom;
foreach($arguments['map_options'] as $key => $value) {
$value = apply_filters('pronamic_google_maps_map_options_' . $key, $value);
$info->mapOptions->$key = $value;
}
$html = self::getMapHtml($info);
if($info->isDynamic()) {
Pronamic_Google_Maps_Site::$printScripts = true;
}
if($arguments['echo']) {
echo $html;
} else {
return $html;
}
}
}
}