/**
     * Render an GEO microformat for the specified latitude and longitude
     *
     * @param float $latitude
     * @param float $longitude
     */
    public static function render($arguments = array())
    {
        // Arguments
        $defaults = array('echo' => true);
        $arguments = wp_parse_args($arguments, $defaults);
        // Options
        $options = Pronamic_Google_Maps_Maps::getOptions();
        $pgm = Pronamic_Google_Maps_Maps::getMetaData();
        $activeTypes = $options['active'];
        global $post;
        $active = isset($activeTypes[$post->post_type]) && $activeTypes[$post->post_type];
        // Active
        if ($active && $pgm->active) {
            $content = sprintf('
				<div class="geo">
					<abbr class="latitude" title="%.6f">%s</abbr>
					<abbr class="longitude" title="%.6f">%s</abbr>
				</div>', $pgm->latitude, Pronamic_Google_Maps_LatLng::convertToDegMinSec($pgm->latitude, Pronamic_Google_Maps_LatLng::DIRECTION_LATITUDE), $pgm->longitude, Pronamic_Google_Maps_LatLng::convertToDegMinSec($pgm->longitude, Pronamic_Google_Maps_LatLng::DIRECTION_LONGITUDE));
            if ($arguments['echo']) {
                echo $content;
            } else {
                return $content;
            }
        }
    }
function pronamic_get_google_maps_meta()
{
    return Pronamic_Google_Maps_Maps::getMetaData();
}
 /**
  * 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_Maps::getOptions();
     $pgm = Pronamic_Google_Maps_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
         $marker_options = $arguments['marker_options'];
         $marker_options = apply_filters('pronamic_google_maps_marker_options', $marker_options);
         foreach ($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::requireSiteScript();
         }
         if ($arguments['echo']) {
             echo $html;
         } else {
             return $html;
         }
     }
 }
 public static function render($q = array(), $arguments = array())
 {
     Pronamic_Google_Maps_Site::requireSiteScript();
     $defaults = array('width' => Pronamic_Google_Maps_Maps::$defaultWidth, 'height' => Pronamic_Google_Maps_Maps::$defaultHeight, 'latitude' => 0, 'longitude' => 0, 'zoom' => Pronamic_Google_Maps_Maps::MAP_ZOOM_DEFAULT, 'map_type_id' => Pronamic_Google_Maps_Maps::MAP_TYPE_DEFAULT, 'hide_list' => true, 'fit_bounds' => true, 'center_client_location' => false, 'marker_options' => array(), 'map_options' => array(), 'marker_cluster_options' => array(), 'echo' => true);
     $arguments = wp_parse_args($arguments, $defaults);
     if ($q instanceof WP_Query) {
         $query = $q;
     } else {
         $query = new WP_Query($q);
     }
     $options = new stdClass();
     $options->width = $arguments['width'];
     if (is_numeric($options->width)) {
         $options->width = '' . $options->width . 'px';
     }
     $options->height = $arguments['height'];
     if (is_numeric($options->height)) {
         $options->height = '' . $options->height . 'px';
     }
     $options->center = new stdClass();
     $options->center->latitude = $arguments['latitude'];
     $options->center->longitude = $arguments['longitude'];
     $options->hideList = $arguments['hide_list'];
     $options->fitBounds = filter_var($arguments['fit_bounds'], FILTER_VALIDATE_BOOLEAN);
     $options->centerClientLocation = $arguments['center_client_location'];
     // Map options
     $options->mapOptions = new stdClass();
     $options->mapOptions->mapTypeId = $arguments['map_type_id'];
     $options->mapOptions->zoom = $arguments['zoom'];
     foreach ($arguments['map_options'] as $key => $value) {
         $value = apply_filters('pronamic_google_maps_map_options_' . $key, $value);
         $options->mapOptions->{$key} = $value;
     }
     // Marker cluster options
     if (!empty($arguments['marker_clusterer_options'])) {
         wp_enqueue_script('google-maps-markerclustererplus');
         $options->markerClustererOptions = new stdClass();
         foreach ($arguments['marker_clusterer_options'] as $key => $value) {
             $value = apply_filters('pronamic_google_maps_marker_clusterer_options_' . $key, $value);
             $options->markerClustererOptions->{$key} = $value;
         }
     }
     $options->markers = array();
     // HTML
     $items = '';
     while ($query->have_posts()) {
         $query->the_post();
         $pgm = Pronamic_Google_Maps_Maps::getMetaData();
         if ($pgm->active) {
             $description = sprintf('<a href="%s" title="%s" rel="bookmark">%s</a>', get_permalink(), sprintf(esc_attr__('Permalink to %s', 'pronamic_google_maps'), the_title_attribute('echo=0')), get_the_title());
             $description = apply_filters(Pronamic_Google_Maps_Filters::FILTER_MASHUP_ITEM, $description);
             $info = new Pronamic_Google_Maps_Info();
             $info->title = $pgm->title;
             $info->description = $pgm->description;
             $info->latitude = $pgm->latitude;
             $info->longitude = $pgm->longitude;
             $info->markerOptions = new stdClass();
             // Marker options
             $marker_options = $arguments['marker_options'];
             $marker_options = apply_filters('pronamic_google_maps_marker_options', $marker_options);
             foreach ($marker_options as $key => $value) {
                 $value = apply_filters('pronamic_google_maps_marker_options_' . $key, $value);
                 $info->markerOptions->{$key} = $value;
             }
             $marker = new stdClass();
             $marker->options = $info->markerOptions;
             $marker->lat = $pgm->latitude;
             $marker->lng = $pgm->longitude;
             $marker->title = $pgm->title;
             $marker->description = $description;
             $marker->post_id = get_the_ID();
             $options->markers[] = $marker;
             $items .= '<li>';
             $items .= sprintf('<input type="hidden" name="pgm-info" value="%s" />', esc_attr(json_encode($info)));
             $item = sprintf('<a href="%s" title="%s" rel="bookmark">%s</a>', get_permalink(), sprintf(esc_attr__('Permalink to %s', 'pronamic_google_maps'), the_title_attribute('echo=0')), get_the_title());
             $items .= apply_filters(Pronamic_Google_Maps_Filters::FILTER_MASHUP_ITEM, $item);
             $items .= '</li>';
         }
     }
     wp_reset_postdata();
     $content = '<div class="pgmm">';
     $content .= sprintf('<input type="hidden" name="pgmm-info" value="%s" />', esc_attr(json_encode($options)));
     $content .= sprintf('<div class="canvas" style="width: %s; height: %s;">', $options->width, $options->height);
     $content .= sprintf('</div>');
     if (!empty($items)) {
         $content .= '<noscript>';
         $content .= '<ul>';
         $content .= $items;
         $content .= '</ul>';
         $content .= '</noscript>';
     }
     $content .= '</div>';
     if ($arguments['echo']) {
         echo $content;
     } else {
         return $content;
     }
 }