$image_src = get_post_meta(get_the_ID(), '_thumbnail_id', true);
    $image_src = wp_get_attachment_image_src($image_src, 'full');
    $image_src = $image_src[0];
    wp_localize_script('mapasdevista', 'mapinfo', array('image_src' => $image_src, 'api' => $mapinfo['api'], 'ajaxurl' => admin_url('admin-ajax.php'), 'page_id' => get_the_ID(), 'baseurl' => mapasdevista_get_baseurl(), 'search' => $_GET['mapasdevista_search']));
} else {
    $min_zoom = isset($mapinfo['min_zoom']) && is_numeric($mapinfo['min_zoom']) ? $mapinfo['min_zoom'] : 0;
    $max_zoom = isset($mapinfo['max_zoom']) && is_numeric($mapinfo['max_zoom']) ? $mapinfo['max_zoom'] : 0;
    $sw_lng = isset($mapinfo['south_west']['lng']) && is_numeric($mapinfo['south_west']['lng']) ? $mapinfo['south_west']['lng'] : 0;
    $sw_lat = isset($mapinfo['south_west']['lat']) && is_numeric($mapinfo['south_west']['lat']) ? $mapinfo['south_west']['lat'] : 0;
    $ne_lng = isset($mapinfo['north_east']['lng']) && is_numeric($mapinfo['north_east']['lng']) ? $mapinfo['north_east']['lng'] : 0;
    $ne_lat = isset($mapinfo['north_east']['lat']) && is_numeric($mapinfo['north_east']['lat']) ? $mapinfo['north_east']['lat'] : 0;
    $mapinfovars = array('api' => $mapinfo['api'], 'lat' => $mapinfo['coord']['lat'], 'lng' => $mapinfo['coord']['lng'], 'zoom' => $mapinfo['zoom'], 'type' => $mapinfo['type'], 'ajaxurl' => admin_url('admin-ajax.php'), 'page_id' => get_the_ID(), 'baseurl' => mapasdevista_get_baseurl(), 'min_zoom' => $min_zoom, 'max_zoom' => $max_zoom, 'sw_lng' => $sw_lng, 'sw_lat' => $sw_lat, 'ne_lng' => $ne_lng, 'ne_lat' => $ne_lat, 'control_zoom' => $mapinfo['control'] && $mapinfo['control']['zoom'] != 'none' ? $mapinfo['control']['zoom'] : 'false', 'control_pan' => $mapinfo['control'] && $mapinfo['control']['pan'] ? 'true' : 'false', 'control_map_type' => $mapinfo['control'] && $mapinfo['control']['map_type'] ? 'true' : 'false');
    if (isset($_GET['mapasdevista_search']) && $_GET['mapasdevista_search'] != '') {
        $mapinfovars['search'] = $_GET['mapasdevista_search'];
    }
    wp_localize_script('mapasdevista', 'mapinfo', $mapinfovars);
}
wp_enqueue_script('mapstraction', mapasdevista_get_baseurl('template_directory') . '/js/mxn/mxn-min.js');
wp_enqueue_script('mapstraction-core', mapasdevista_get_baseurl('template_directory') . '/js/mxn/mxn.core-min.js');
if ($mapinfo['api'] == 'openlayers') {
    wp_enqueue_script('openlayers', 'http://openlayers.org/api/OpenLayers.js');
    wp_enqueue_script('mapstraction-openlayers', mapasdevista_get_baseurl('template_directory') . '/js/mxn/mxn.openlayers.core-min.js');
} elseif ($mapinfo['api'] == 'googlev3') {
    $googleapikey = get_theme_option('google_key');
    $googleapikey = $googleapikey ? "&key={$googleapikey}" : '';
    wp_enqueue_script('google-maps-v3', 'http://maps.google.com/maps/api/js?sensor=false' . $googleapikey);
    wp_enqueue_script('mapstraction-googlev3', mapasdevista_get_baseurl('template_directory') . '/js/mxn/mxn.googlev3.core-min.js');
    wp_enqueue_script('google-infobox', mapasdevista_get_baseurl('template_directory') . '/js/mxn/infobox_packed.js', array('mapstraction-googlev3'));
} elseif ($mapinfo['api'] == 'image') {
    wp_enqueue_script('mapstraction-image', mapasdevista_get_baseurl('template_directory') . '/js/mxn/mxn.image.core.js');
}
function mapasdevista_get_image($name)
{
    return mapasdevista_get_baseurl() . '/img/' . $name;
}
function get_theme_default_options()
{
    return array('bg_opacity' => 80, 'header_image' => mapasdevista_get_baseurl() . '/img/mapas-de-vista.png', 'theme_color' => array('r' => 0, 'g' => 174, 'b' => 239), 'bg_color' => array('r' => 34, 'g' => 34, 'b' => 34), 'font_color' => array('r' => 255, 'g' => 255, 'b' => 255));
}
Exemple #4
0
 public function javascript()
 {
     if (function_exists('mapasdevista_enqueue_scripts') && get_query_var(self::NEW_EMREDE_PAGE) == true) {
         mapasdevista_enqueue_scripts();
         wp_enqueue_script('metabox', mapasdevista_get_baseurl() . '/admin/metabox.js', array('jquery', 'jquery-ui-resizable', 'jquery-ui-dialog'));
         $data = array('options' => get_option('mapasdevista'));
         wp_localize_script('metabox', 'mapasdevista_options', $data);
     }
 }
#commentform label { display:block; }
#commentform input[type="text"] { border:none; padding:6px; width:150px; }
#commentform textarea#comment { border:none; clear:both; height:80px; width:660px; }

a.comment-reply-link { background:<?php 
echo $themeColor;
?>
; color:<?php 
echo $fontColor;
?>
; padding:3px 6px; text-decoration:none; }
.comment { border-bottom:2px solid <?php 
echo $bgColor;
?>
; padding-bottom:9px; margin-bottom:18px; }
img.avatar { margin:3px 10px 9px 0px; }

#mapasdevista-gallery-image {max-width: 80%; max-height: 80%; padding:11px; background: <?php 
echo $bgColor;
?>
;}

#mapasdevista-gallery-image #mapasdevista-gallery-close { float:right; cursor:pointer; width:27px; height:27px; background:url(<?php 
echo mapasdevista_get_baseurl() . '/img/close.png';
?>
);}
#mapasdevista-gallery-image #mapasdevista-gallery-close:hover {background-color: <?php 
echo $themeColor;
?>
}