<commit_before><?php
use_helper('Mobile');

if (!isset($has_geom))
{
    $has_geom = (boolean)($document->get('geom_wkt'));
}
if (!$has_geom && $document->module == 'routes')
{
    foreach (array('summits', 'parkings', 'huts') as $type)
    {
        if (!isset($document->$type)) continue;
        foreach ($document->$type as $associated_doc)
        {
            if (!empty($associated_doc['pointwkt']))
            {
                $has_geom = true;
                break 2;
            }
        }
    }
}

if (!isset($show_map))
{
    $show_map = false;
}
if ($has_geom || $show_map)
{
    if (!isset($section_title))
    {
        $section_title = 'Static map';
    }
    
    echo start_section_tag($section_title, 'map_container', 'opened', true, false, false, false);
    echo '<div class="section" id="map_container_section_container">';

    $map_url = 'http://maps.google.com/maps/api/staticmap?size=310x310&amp;maptype=terrain&amp;mobile=true&amp;sensor=false&amp;key='
               . sfConfig::get('app_google_api_key') . '&amp;';

    $map_options = array();
    
    $module = $document->module;
    if ($module == 'summits' || $module == 'parkings' || $module == 'sites' ||
        $module == 'huts' || $module == 'products' || $module == 'users' || $module == 'images')
    {
        $map_options[] = 'markers=shadow:false|icon:'._marker_url($module).'|'.$document['lat'].','.$document['lon'];
        $map_options[] = 'zoom=12';
    }
    elseif ($document->get('geom_wkt') && ($module == 'outings' || $module == 'routes'))
    {
        $tolerance = _compute_tolerance(gisQuery::getBox2d($document->id, $module), true);
        $enc_polyline = _polyline_encode(gisQuery::getEWKT($document->id, true, $module, null, $tolerance));
        $map_options[] = 'path=weight:2|color:0xffff00cc|enc:'.$enc_polyline;
    }
    elseif ($document->get('geom_wkt') && ($module == 'maps' || $module == 'areas'))
    {
        $tolerance = _compute_tolerance(gisQuery::getBox2d($document->id, $module));
        $geoms = gisQuery::getEWKT($document->id, true, $module, null, $tolerance);
        $geoms = explode(')),((', $geoms);
        foreach($geoms as $geom) {
            $map_options[] = 'path=weight:2|color:0xffff00cc|fillcolor:0xffff0033|enc:'.
                             _polyline_encode(str_replace(array('(', ')'), '', $geom));
        }
    }<commit_msg>static maps api base url<commit_after><?php
use_helper('Mobile');

if (!isset($has_geom))
{
    $has_geom = (boolean)($document->get('geom_wkt'));
}
if (!$has_geom && $document->module == 'routes')
{
    foreach (array('summits', 'parkings', 'huts') as $type)
    {
        if (!isset($document->$type)) continue;
        foreach ($document->$type as $associated_doc)
        {
            if (!empty($associated_doc['pointwkt']))
            {
                $has_geom = true;
                break 2;
            }
        }
    }
}

if (!isset($show_map))
{
    $show_map = false;
}
if ($has_geom || $show_map)
{
    if (!isset($section_title))
    {
        $section_title = 'Static map';
    }
    
    echo start_section_tag($section_title, 'map_container', 'opened', true, false, false, false);
    echo '<div class="section" id="map_container_section_container">';

    $map_url = 'http://maps.googleapis.com/maps/api/staticmap?size=310x310&amp;maptype=terrain&amp;mobile=true&amp;sensor=false&amp;key='
               . sfConfig::get('app_google_api_key') . '&amp;';

    $map_options = array();
    
    $module = $document->module;
    if ($module == 'summits' || $module == 'parkings' || $module == 'sites' ||
        $module == 'huts' || $module == 'products' || $module == 'users' || $module == 'images')
    {
        $map_options[] = 'markers=shadow:false|icon:'._marker_url($module).'|'.$document['lat'].','.$document['lon'];
        $map_options[] = 'zoom=12';
    }
    elseif ($document->get('geom_wkt') && ($module == 'outings' || $module == 'routes'))
    {
        $tolerance = _compute_tolerance(gisQuery::getBox2d($document->id, $module), true);
        $enc_polyline = _polyline_encode(gisQuery::getEWKT($document->id, true, $module, null, $tolerance));
        $map_options[] = 'path=weight:2|color:0xffff00cc|enc:'.$enc_polyline;
    }
    elseif ($document->get('geom_wkt') && ($module == 'maps' || $module == 'areas'))
    {
        $tolerance = _compute_tolerance(gisQuery::getBox2d($document->id, $module));
        $geoms = gisQuery::getEWKT($document->id, true, $module, null, $tolerance);
        $geoms = explode(')),((', $geoms);
        foreach($geoms as $geom) {
            $map_options[] = 'path=weight:2|color:0xffff00cc|fillcolor:0xffff0033|enc:'.
                             _polyline_encode(str_replace(array('(', ')'), '', $geom));
        }
    }
{'fraction_non_alphanumeric': 0.20230366492146598, 'fraction_numerical': 0.010052356020942408, 'mean_word_length': 3.17117903930131, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 27, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2496492', 'n_tokens_mistral': 1676, 'n_tokens_neox': 1633, 'n_words': 250}