Пример #1
0
function geopress_post_map($width = "", $height = "", $controls = true, $overlay = "")
{
    global $post, $geopress_map_index;
    $geopress_marker = get_settings('_geopress_marker', true);
    $geo = GeoPress::get_geo($post->ID);
    if ($geo) {
        if (!is_feed()) {
            if ($height == "" || $width == "") {
                $height = get_settings('_geopress_mapheight', true);
                $width = get_settings('_geopress_mapwidth', true);
            }
            $map_id = $post->ID . $geopress_map_index;
            $coords = split(" ", $geo->coord);
            $map_controls = $controls ? GeoPress::mapstraction_map_controls() : "false";
            $output = '<div id="geo_map' . $map_id . '" class="mapstraction" style="height: ' . $height . 'px; width: ' . $width . 'px;"></div>';
            $output .= '<!-- GeoPress Map --><script type="text/javascript">';
            // $output .= " //<![CDATA[ ";
            $output .= 'geopress_addEvent(window,"load", function() { geopress_makemap(' . $map_id . ',"' . $geo->name . '",' . $coords[0] . ',' . $coords[1] . ',"' . GeoPress::mapstraction_map_format($geo->map_format) . '",' . GeoPress::mapstraction_map_type($geo->map_type) . ', ' . $map_controls . ',' . GeoPress::mapstraction_map_zoom($geo->map_zoom) . ', "' . $geopress_marker . '") }); ';
            if ($url != "") {
                $output .= 'geo_map' . $map_id . '.addOverlay("' . $url . '");';
            }
            $output .= "</script><!-- end GeoPress Map -->";
        } else {
            $output = '<img src="' . $geo->mapurl . '" title="GeoPress map of ' . $geo->name . '"/>';
        }
        $geopress_map_index++;
    }
    return $output;
}