MapPress Easy Google Maps - Version 2.52

Version Description

  • Fixed: prevent enter press in map list search from publishing post
  • Changed: updated map editor search/filter function
  • Changed: internal function Mappress::ssl() renamed Mappress::is_ssl() - please update any custom directions.php or search.php to use the new name
Download this release

Release Info

Developer chrisvrichardson
Plugin Icon 128x128 MapPress Easy Google Maps
Version 2.52
Comparing to
See all releases

Code changes from version 2.50.10 to 2.52

forms/{map_editor.php → editor.php} RENAMED
File without changes
forms/{map_media.php → media.php} RENAMED
@@ -9,7 +9,8 @@
9
  <option value='post'><?php _e('This post', 'mappress-google-maps-for-wordpress');?></option>
10
  <option value='all'><?php _e('All posts', 'mappress-google-maps-for-wordpress');?></option>
11
  </select>
12
- <input type='text' size="15" class='mapp-media-search' placeholder='<?php _e('Search post title', 'mappress-google-maps-for-wordpress');?>'>
 
13
  </div>
14
  <div class='mapp-list mapp-media-list'></div>
15
  </div>
@@ -49,13 +50,13 @@
49
  <input data-mapp-media='cancel' class='button' type='button' value='<?php esc_attr_e('Cancel', 'mappress-google-maps-for-wordpress'); ?>' />
50
  <input data-mapp-media='insert' class='button' type='button' value='<?php esc_attr_e('Insert into post', 'mappress-google-maps-for-wordpress'); ?>' />
51
  </div>
52
- <?php require Mappress::$basedir . "/forms/map_editor.php"; ?>
53
  </div>
54
  </div>
55
 
56
  <script type='text/template' id='mapp-tmpl-media-list'>
57
  <div class='mapp-items'>
58
- <# _.forEach(list.items, function(item, i) { #>
59
  <div class='mapp-item' data-mapp-media='edit' data-mapp-mapid='{{ item.mapid }}'>
60
 
61
  <# if (type == 'all') { #>
@@ -74,13 +75,10 @@
74
  <# }); #>
75
  </div>
76
  <div class='mapp-list-footer'>
77
- <# if (list.items.length == 0) { #>
78
  <?php _e('No maps found', 'mappress-google-maps-for-wordpress');?>
79
  <# } #>
80
- <# if (list.page < list.pages) { #>
81
- <input type='button' class='button' data-mapp-media='more' value='<?php _e('Load More', 'mappress-google-maps-for-wordpress');?>'>
82
- <span class='spinner'></span>
83
- <# } #>
84
  </div>
85
  </div>
86
  </script>
9
  <option value='post'><?php _e('This post', 'mappress-google-maps-for-wordpress');?></option>
10
  <option value='all'><?php _e('All posts', 'mappress-google-maps-for-wordpress');?></option>
11
  </select>
12
+ <input type='text' size="15" class='mapp-media-search' placeholder='<?php _e('Filter by title', 'mappress-google-maps-for-wordpress');?>'>
13
+ <span class='spinner'></span>
14
  </div>
15
  <div class='mapp-list mapp-media-list'></div>
16
  </div>
50
  <input data-mapp-media='cancel' class='button' type='button' value='<?php esc_attr_e('Cancel', 'mappress-google-maps-for-wordpress'); ?>' />
51
  <input data-mapp-media='insert' class='button' type='button' value='<?php esc_attr_e('Insert into post', 'mappress-google-maps-for-wordpress'); ?>' />
52
  </div>
53
+ <?php require Mappress::$basedir . "/forms/editor.php"; ?>
54
  </div>
55
  </div>
56
 
57
  <script type='text/template' id='mapp-tmpl-media-list'>
58
  <div class='mapp-items'>
59
+ <# _.forEach(items, function(item, i) { #>
60
  <div class='mapp-item' data-mapp-media='edit' data-mapp-mapid='{{ item.mapid }}'>
61
 
62
  <# if (type == 'all') { #>
75
  <# }); #>
76
  </div>
77
  <div class='mapp-list-footer'>
78
+ <# if (items.length == 0) { #>
79
  <?php _e('No maps found', 'mappress-google-maps-for-wordpress');?>
80
  <# } #>
81
+ {{{more}}}
 
 
 
82
  </div>
83
  </div>
84
  </script>
forms/{template_editor.php → settings.php} RENAMED
File without changes
js/mappress.min.js CHANGED
@@ -1 +1 @@
1
- var mapp=window.mapp||{};+function(n){mapp.Map=function(n,t){this.defaults={center:null,editable:null,height:null,initialOpenDirections:null,initialOpenInfo:null,layers:null,mapid:null,mapTypeId:null,metaKey:null,mapOpts:null,name:null,pois:null,postid:null,query:null,title:null,width:null,zoom:null};this.highlight=null;this.iw=null;this.places=null;this.poi=null;this.settings=t?t:{};this.templates=null;this.dir_=null;this.div={};this.layers_={};this.map_=null;this.pois_=[];this.xhr_;this.zindex_=0;_.extend(this,this.defaults,_.pick(n,_.keys(this.defaults)),_.pick(this.settings,_.keys(this.defaults)))};mapp.Map.prototype={display:function(){var t=this,i;if(this.div.layout=n("#"+this.name+"-layout"),n.each(["canvas","controls","dialog","directions","filters","iw","list","menu","search"],function(i,r){t.div[r]=n(".mapp-"+r,t.div.layout)}),this.sanity()===!0){this.templates=this.editable?{loop:"edit-loop",item:"edit-item",popup:"edit-popup"}:this.query?{loop:"map-loop",item:"mashup-item",popup:"mashup-popup"}:{loop:"map-loop",item:"map-item",popup:"map-popup"};mappl10n.options.engine=="leaflet"?(i=_.extend({attribution:'Map data © <a href="https://openstreetmap.org">OpenStreetMap<\/a>',minZoom:0,scrollWheelZoom:!1,worldCopyJump:!0,zoomControl:null},this.mapOpts),i.minZoom=isNaN(parseInt(i.minZoom))?0:parseInt(i.minZoom),this.map_=new L.Map(this.div.canvas.get(0),i),L.control.zoom({position:"bottomright",zoomInTitle:"",zoomOutTitle:""}).addTo(this.map_),this.iw=L.popup(),this.iw.setContent(this.div.iw.get(0))):(this.map_=new google.maps.Map(this.div.canvas.get(0),{mapTypeId:"roadmap",zoom:1}),i=_.extend({backgroundColor:"transparent",clickableIcons:!1,fullscreenControl:!1,keyboardShortcuts:!1,mapTypeControl:!0,mapTypeControlOptions:{position:google.maps.ControlPosition.TOP_RIGHT,style:google.maps.MapTypeControlStyle.DROPDOWN_MENU},minZoom:0,scaleControl:!0,scrollwheel:!1,streetViewControl:!this.editable&&!this.query},this.mapOpts),i.minZoom=isNaN(parseInt(i.minZoom))?0:parseInt(i.minZoom),this.map_.setOptions(i),this.toggleMapTypeId(this.mapTypeId,!0),this.iw=mappl10n.options.iwType=="ib"||this.editable?new mapp.InfoBox(this):new google.maps.InfoWindow,this.iw.setContent(this.div.iw.get(0)),this.addLayers());this.addStyles();this.addControls();this.addMenu();this.places=new mapp.Places(n(".mapp-places",this.div.search),{map:t});n(this.places).on("search.mapp",function(n,i){t.search(i)});this.addEvents("click drag",function(){t.close()});this.query&&mappl10n.options.search&&!this.editable&&this.addSearchMove();this.toggleView("mini",this.div.layout.width()<mappl10n.options.mini);this.div.layout.on("click","[data-mapp-action]",function(i){var r=n(this).attr("data-mapp-action");i.preventDefault();t.action(r,n(this).attr("data-mapp-"+r),n(this))});this.div.filters.on("change",function(){t.ajaxQuery(t.getBounds())});n(window).resize(function(){t.resize()});this.query||this.setPois(this.pois);this.places.parse(this.center,function(n){t.query?n?t.search(n):t.ajaxQuery():(n&&n.geometry&&n.geometry.location&&(t.center=n.geometry.location),t.recenter())});mappl10n.options.engine=="leaflet"?this.initialOpen():mapp.event.addListenerOnce(this.map_,"idle",function(){t.initialOpen()})}},initialOpen:function(){var n=this.pois_.length?this.pois_[0]:null;this.initialOpenDirections?this.openDirections(null,n):n&&this.initialOpenInfo&&n.open()},search:function(n){var i=n.geometry.location?n.geometry.location:null,t=n.geometry.viewport?n.geometry.viewport:null,f,u,r;mappl10n.options.engine=="leaflet"?(f=new L.LatLng(i.lat,i.lng),r=f.toBounds(mappl10n.options.radius*1e3)):(u=new google.maps.Circle({center:i,radius:mappl10n.options.radius*1e3}),r=t?new google.maps.LatLngBounds(new google.maps.LatLng(t.sw.lat,t.sw.lng),new google.maps.LatLng(t.ne.lat,t.ne.lng)).union(u.getBounds()):u.getBounds());this.fitBounds(r);this.setView(i);this.ajaxQuery(r)},load:function(n){_.extend(this,this.defaults,n,this.settings);this.toggleMapTypeId(this.mapTypeId,!0);this.toggleView("menu",!1);this.toggleLayer();this.close();this.setPois(this.pois_);this.places.set("")},action:function(t,i,r){var f=this,u;switch(t){case"center":this.toggleView("menu",!1);this.close();this.recenter();break;case"dir":this.openDirections(null,this.poi);break;case"dir-from":this.openDirections(this.poi,null);break;case"filters-reset":this.div.filters.find(":input").each(function(){this.type=="checkbox"||this.type=="radio"?n(this).prop("checked",!1):n(this).val("")});this.ajaxQuery(this.getBounds());break;case"filters-toggle":this.toggleView("filters");break;case"geolocate":this.places.geolocate(function(n){f.search(n)});break;case"layer":this.toggleLayer(i);this.toggleView("menu",!1);break;case"menu-toggle":this.toggleView("menu");break;case"open":u=r.attr("data-mapp-poi");this.open(this.pois_[u]);break;case"show":this.div.layout.show();this.resize();this.initCenter();break;case"view-map":this.toggleView("list",!1);break;case"view-list":this.toggleView("list",!0);break;default:return!0}},dialog:function(n,t){var i=this;n?(this.div.dialog.html(n),this.div.dialog.show(),t&&(clearTimeout(this.dialog.fade),this.dialog.fade=setTimeout(function(){i.dialog(null)},4e3))):this.div.dialog.hide()},addEvents:function(n,t){n=n.split(" ");for(var i=0;i<n.length;i++)mapp.event.addListener(this.map_,n[i],t)},close:function(){mappl10n.options.engine=="leaflet"?this.map_.closePopup():this.iw.close();this.select(null);n(this).triggerHandler("mapp.close")},openDirections:function(n,t){var i=n?n.getAddress():"",r=t?t.getAddress():"";this.dir_||(this.dir_=new mapp.Directions(this.div.directions,this));this.dir_.open(i,r)},sanity:function(){if(!this.div.canvas.length)return mapp.lib.log("MapPress: Missing map name or container for map: "+this.name);if(mappl10n.options.autoupdate==="tc")return mapp.lib.log("Maps API missing (800001)");if(typeof _=="undefined")return mapp.lib.alert("ERROR: underscore.js not loaded. Check cacheing / optimizing plugins.");if(mappl10n.options.engine=="leaflet"){if(typeof L=="undefined")return mapp.lib.alert("ERROR: Unable to load Leaflet")}else{if(typeof google=="undefined")return mapp.lib.alert("ERROR: Google Maps API not loaded");n(document).ready(function(){n('script[src*="https://maps.googleapis.com/maps/api/js?v=3"]').length>1&&mapp.lib.alert("ERROR: Google Maps API key loaded multiple times, please see MapPress FAQ.")})}return!0},select:function(t){if(n("[data-mapp-poi]",this.div.list).removeClass("mapp-selected"),t){var r=n.inArray(t,this.pois_),i=n('[data-mapp-poi="'+r+'"]',this.div.list);i.addClass("mapp-selected");mapp.lib.scrollTo(this.div.list,i);t.setZIndex(++this.zindex_)}this.poi=t},setHighlight:function(n){this.highlight&&(mappl10n.options.engine=="leaflet"?this.highlight.remove():this.highlight.setMap(null));n&&(mappl10n.options.engine=="leaflet"?this.highlight=new L.Marker(n.getPosition()).addTo(this.map_):(this.highlight=new google.maps.Marker({position:n.getPosition()}),this.highlight.setMap(this.map_)))},getMap:function(){return this.map_},renderList:function(){var i=this.getBounds(),r=0,u=this,t;if(!this.editable)for(t=0;t<this.pois_.length;t++)this.pois_[t].visible=this.pois_[t].type!="kml",this.query&&i&&!i.contains(this.pois_[t].getPosition())&&(this.pois_[t].visible=!1),r+=this.pois_[t].visible;this.div.list.html(mapp.lib.template(this.templates.loop,{map:this,pois:this.pois_,count:r}));this.editable&&n(".mapp-items",u.sel).sortable({axis:"y",cursor:"move",delay:200,update:function(){u.sortPois(n(this).sortable("toArray",{attribute:"data-mapp-poi"}))}})},getPois:function(){return this.pois_},insertPoi:function(n){var t=this;this.pois_.unshift(n);n.setMap(this);t.renderList();this.select(n)},removePoi:function(t){var r=this,i=n.inArray(t,this.pois_);i!=-1&&(this.pois_[i].setMap(null),this.pois_.splice(i,1),r.renderList())},resetPois:function(){for(i=0;i<this.pois_.length;i++)this.pois_[i].setMap(null);this.pois_=[];this.zindex_=0},setPois:function(n){var t,i;if(this.resetPois(),n){for(t=0;t<n.length;t++)i=new mapp.Poi(n[t]),this.pois_.push(i),i.id=this.pois_.length-1,i.setMap(this),i.setZIndex(this.zindex_+n.length-1-t);this.zindex_+=n.length-1}this.renderList()},sortPois:function(n){for(var r,t=Array(),i=0;i<n.length;i++){if(r=parseInt(n[i]),isNaN(r))return!1;t.push(this.pois_[r])}if(t.length!=this.pois_.length)return!1;this.pois_=t;this.renderList()},open:function(t,i){if(this.close(),this.select(t),mappl10n.options.mashupClick!="poi"&&t.postid&&t.url){window.open(t.url);return}if(this.toggleView("list",!1),this.div.iw.html(t.render("popup")),mappl10n.options.engine=="leaflet")this.iw.setLatLng(t.getPosition()),this.iw.options.offset=t.getAnchorPoint(),this.map_.openPopup(this.iw);else{var r=new google.maps.MVCObject;r.setValues({position:t.getPosition(i),anchorPoint:t.getAnchorPoint(i)});this.iw.open(this.map_,r)}n(this).triggerHandler("mapp.open",t)},renderMenu:function(){var t=this;for(layer in this.layers_)this.layers_[layer].getMap()&&n('[data-mapp-layer="'+layer+'"]',this.div.layout).addClass("mapp-active")},addStyles:function(){var e=this,i,o,s,l,a,u,t,h,f;if(mappl10n.options.engine=="leaflet"){for(i=[],o=L.control.layers(),t=0;t<mappl10n.options.baseLayers.length;t++)s=mappl10n.options.baseLayers[t],l=mappl10n.options.providers[s.provider],i.push(n.extend({},l,s));for(a=mappl10n.options.style&&!this.editable&&this.mapTypeId=="streets"?mappl10n.options.style:this.mapTypeId,u=_.findIndex(i,{name:a}),u=u>=0?u:0,t=0;t<i.length;t++)h=L.tileLayer(i[t].url,i[t]),o.addBaseLayer(h,i[t].label),t==u&&h.addTo(this.map_);this.editable&&i.length>1&&o.addTo(this.map_);this.map_.on("baselayerchange",function(n){e.mapTypeId=n.layer.options.name})}else{var r=mappl10n.options.styles?mappl10n.options.styles:[],c=mappl10n.options.style,v=["roadmap","satellite","terrain","hybrid"];if(c&&typeof r[c]!="undefined"&&this.map_.setOptions({styles:r[c]}),this.editable){for(f in r)this.map_.mapTypes.set(f,new google.maps.StyledMapType(r[f],{name:f})),v.push(f);this.map_.setOptions({mapTypeControlOptions:{mapTypeIds:v,position:google.maps.ControlPosition.TOP_RIGHT,style:google.maps.MapTypeControlStyle.DROPDOWN_MENU}})}else this.mapTypeId&&typeof r[this.mapTypeId]!="undefined"&&this.map_.setOptions({styles:r[this.mapTypeId]});mapp.event.addListener(this.map_,"maptypeid_changed",function(){e.mapTypeId=e.map_.getMapTypeId()})}},addControls:function(){var n=this;this.div.controls.html(mapp.lib.template("map-controls",{map:this}))},addLayers:function(){var u,i,t,r;for(this.layers_={traffic:new google.maps.TrafficLayer,bicycling:new google.maps.BicyclingLayer,transit:new google.maps.TransitLayer},u=n.makeArray(this.layers),i=0;i<u.length;i++)t=n.trim(u[i]),r=t.split(".").pop(),this.layers_[t]?this.toggleLayer(t):r=="kml"||r=="kmz"?this.layers_[t]=new google.maps.KmlLayer({map:this.map_,preserveViewport:!0,url:t}):r=="json"&&(this.layers_[t]=new google.maps.Data({map:this.map_}).loadGeoJson(t))},addMenu:function(){var t=this;n("body").on("click",function(i){var r=n(i.target),u=r.attr("data-mapp-action");r==t.div.filters||u=="filters-toggle"||r.closest(t.div.filters).length||t.toggleView("filters",!1);r==t.div.menu||u=="menu-toggle"||r.closest(t.div.menu).length||t.toggleView("menu",!1)})},toggleLayer:function(t,i){var r=this;i=typeof i!="undefined"?i:this.layers_[t].getMap()==null;n.each(["traffic","bicycling","transit"],function(n,t){r.layers_[t].setMap(null)});i&&this.layers_[t].setMap(this.map_)},toggleMapTypeId:function(t,i){var u=this,r=n.inArray(t,["roadmap","satellite","terrain","hybrid"])!=-1;i=typeof i!="undefined"?i:!(this.getMapTypeId()==t);t=u.editable?i&&(r||typeof mappl10n.options.styles[t]!="undefined")?t:"roadmap":r?t:"roadmap";this.map_.setMapTypeId(t)},togglePois:function(n){n=!!n;for(var t=0;t<this.pois_.length;t++)this.pois_[t].setVisible(n)},toggleView:function(n,t){t=typeof t=="undefined"?!this.div.layout.hasClass("mapp-view-"+n):t;this.div.layout.toggleClass("mapp-view-"+n,t);n=="menu"&&t&&this.renderMenu();n=="directions"&&(this.close(),this.resize())},resize:function(){var n=this.getCenter();this.toggleView("mini",this.div.layout.width()<mappl10n.options.mini);mappl10n.options.engine=="leaflet"?this.map_.invalidateSize():mapp.event.trigger(this.map_,"resize");n&&this.setView(n)},recenter:function(){var r=this.center&&this.center.lat&&this.center.lng?this.center:null,n=this.zoom&&parseInt(this.zoom)?parseInt(this.zoom):null,t,i;if(r){this.setView(r,n?n:1);return}if(this.pois_.length==0){this.setView({lat:0,lng:0},n?n:1);return}if(this.pois_.length==1){this.pois_[0].center(n);return}for(bounds=mappl10n.options.engine=="leaflet"?new L.LatLngBounds:new google.maps.LatLngBounds,t=0;t<this.pois_.length;t++)i=this.pois_[t].getBounds(),bounds=i?mappl10n.options.engine=="leaflet"?bounds.extend(i):bounds.union(i):bounds.extend(this.pois_[t].getPosition());n?this.setView(bounds.getCenter().toJSON(),n):this.fitBounds(bounds)},toJSON:function(){var n;for(this.pois=[],n=0;n<this.pois_.length;n++)this.pois.push(this.pois_[n].toJSON());return{center:this.center,height:this.height,mapid:this.mapid,mapTypeId:this.mapTypeId,metaKey:this.metaKey,pois:this.pois,title:this.title,width:this.width,zoom:this.zoom}},ajaxSave:function(n){var t=this,i=JSON.stringify(this),r=!this.mapid||!this.postid?mappl10n.options.postid:this.postid;mapp.lib.ajax({type:"POST",data:{action:"mapp_save",map:i,postid:r},callback:function(i){i.status=="OK"&&(t.mapid=i.data.mapid,n(i.data))}})},fitBounds:function(n,t){var t=mappl10n.options.engine=="leaflet"&&t?{paddingTopLeft:[t.left,t.top],paddingBottomRight:[t.right,t.bottom]}:t;return this.map_.fitBounds(n,t)},getBounds:function(){try{return this.map_.getBounds()}catch(n){return null}},getCenter:function(){try{return this.map_.getCenter()}catch(n){return null}},getMapTypeId:function(n){return mappl10n.options.engine=="leaflet"?"roadmap":this.map_.getMapTypeId(n)},setView:function(n,t,i){mappl10n.options.engine=="leaflet"?(t==null&&(t=this.map_.getZoom()?this.map_.getZoom():0),this.map_.setView(n,t,i)):(n&&this.map_.setCenter(n),t&&this.map_.setZoom(t))}};mapp.Map.ajaxGet=function(n,t,i){mapp.lib.ajax({type:"GET",data:{action:"mapp_get",mapid:n},callback:function(n){if(n.status=="OK"){var r=new mapp.Map(n.data.map,t);i(r)}}})};mapp.Map.ajaxDelete=function(n,t){mapp.lib.ajax({type:"POST",data:{action:"mapp_delete",mapid:n},callback:function(n){n.status=="OK"&&t&&t()}})}}(jQuery);mapp=window.mapp||{};+function(n){mapp.Directions=function(t,i){this.sel=n(t);this.map=i;this.directionsRenderer=null;this.directionsService=null;this.placesService=null;var r=this;this.sel.on("keydown",function(n){n.which==13?(r.getDirections(),n.preventDefault()):n.which==27&&r.close()});this.sel.on("click","[data-mapp-action]",function(t){var i=n(this).attr("data-mapp-action"),u=n(".mapp-dir-daddr",r.sel).val(),f=n(".mapp-dir-saddr",r.sel).val();t.preventDefault();switch(i){case"dir-cancel":r.close();break;case"dir-get":r.getDirections();break;case"dir-myloc":r.map.places.geolocate(function(t){n(".mapp-dir-saddr",r.sel).val(t.name);r.getDirections()});break;case"dir-swap":n(".mapp-dir-saddr",r.sel).val(u);n(".mapp-dir-daddr",r.sel).val(f);r.getDirections()}});this.open=function(t,i){if(mappl10n.options.directions=="google"){this.openGoogle(t,i);return}this.map.toggleView("directions",!0);n(".mapp-dir-addr",this.sel).removeClass("mapp-error");n(".mapp-dir-saddr",this.sel).val(t);n(".mapp-dir-daddr",this.sel).val(i);n(".mapp-dir-get",this.sel).focus();n(".mapp-dir-saddr",this.sel).focus()};this.close=function(){this.map.toggleView("directions",!1);this.directionsRenderer&&(this.directionsRenderer.setPanel(null),this.directionsRenderer.getMap()&&(this.directionsRenderer.setMap(null),this.map.togglePois(!0)))};this.getDirections=function(){this.map.close();this.openGoogle(n(".mapp-dir-saddr",this.sel).val(),n(".mapp-dir-daddr",this.sel).val());return};this.openGoogle=function(n,t){var i=mappl10n.options.directionsServer;i.toLowerCase().indexOf("http")==-1&&(i="https://"+i);i+="?saddr="+encodeURIComponent(n);i+="&daddr="+encodeURIComponent(t);window.open(i)}}}(jQuery);mapp=window.mapp||{};mapp.geocoders={};+function(){mapp.geocoders.Algolia=function(n){this.map=n;this.places=algoliasearch.initPlaces()};mapp.geocoders.Algolia.prototype={geocode:function(n,t){var i=this;this.getPredictions(n,function(i){i&&i.hits.length?t({formatted_address:i.hits[0].locale_names[0],name:n,geometry:{location:{lat:i.hits[0]._geoloc.lat,lng:i.hits[0]._geoloc.lng}}}):t(null)})},getDetails:function(n,t){t({formatted_address:n.value,name:n.name,geometry:{location:n.latlng}})},getPredictions:function(n,t){this.places.search({query:n,language:mappl10n.options.language},function(n,i){n||!i?t(null):t(i)})}}}(jQuery);+function(n){mapp.geocoders.Google=function(t){this.map=t;this.token=null;this.types=this.map.editable?null:["geocode"];var i=n('<div style="display:none">').appendTo("body");this.placesService=new google.maps.places.PlacesService(i.get(0));this.autocompleteService=new google.maps.places.AutocompleteService;i.remove()};mapp.geocoders.Google.prototype={geocode:function(t,i){var r=this;this.getPredictions(t,function(t){t&&n.isArray(t)?r.getDetails(t[0],function(n){i(n)}):i(null)})},getDetails:function(n,t){this.token=this.token?this.token:new google.maps.places.AutocompleteSessionToken;this.token=null;var i={placeId:n.place_id,sessionToken:this.token};this.placesService.getDetails(i,function(n,i){if(i=="OK"&&n&&n.geometry){if(n.geometry.location&&(n.geometry.location=n.geometry.location.toJSON()),n.geometry.viewport){var r=n.geometry.viewport.toJSON();n.geometry.viewport={sw:{lat:r.south,lng:r.west},ne:{lat:r.north,lng:r.east}}}t(n)}else t(null)})},getPredictions:function(n,t){var i,r;this.token=this.token?this.token:new google.maps.places.AutocompleteSessionToken;i=this.map.getMap().getBounds();i=i?i:new google.maps.LatLngBounds(new google.maps.LatLng(85,-180),new google.maps.LatLng(-85,180));r={input:n,bounds:i,sessionToken:this.token,types:this.types};this.autocompleteService.getPlacePredictions(r,function(n,i){i=="OK"&&n&&n.length?t(n):(i==google.maps.places.PlacesServiceStatus.REQUEST_DENIED?alert("Google Maps API Key error: please enable the Places API in the Google Developer Console."):i==google.maps.places.PlacesServiceStatus.OVER_QUERY_LIMIT&&alert("Google Maps API Key has exceeded its query limit"),t(null))})}}}(jQuery);mapp=window.mapp||{};mapp.Icons={};mapp.Icons.get=function(){var n="https://maps.google.com/intl/en_us/mapfiles/ms/micons/red-dot.png";return mappl10n.options.engine=="leaflet"?L.icon({iconUrl:n,iconAnchor:[16,32],iconSize:[32,32],popupAnchor:[0,-32]}):{url:n}};mapp.Icons.getUrl=function(){return"https://maps.google.com/intl/en_us/mapfiles/ms/micons/red-dot.png"};mapp=window.mapp||{};+function(n){mapp.InfoBox=function(t,i){var f=n.extend({border:20},i),u=null,r=null,o,e=this;r=n('<div class="mapp-ib-wrapper" tabindex="0"><div class="mapp-ib" tabindex="0"><\/div><div class="mapp-ib-tip"><\/div><\/div>').appendTo(t.getMap().getDiv());jQuery(window).resize(function(){e.close()});r.on("keydown",function(n){n.which==27&&e.close()});r.on("click",".mapp-close",function(){e.close()});this.getContent=function(){return n(".mapp-ib",r)};this.setContent=function(t){n(".mapp-ib",r).empty().append(t)};this.open=function(n,t){u=t;this.setMap(n)};this.onAdd=function(){o=!1;var t=n(":input",r);r.show();t.length?t.first().focus():r.focus();google.maps.event.trigger(e,"domready")};this.draw=function(){var l=this.getMap(),a=n(".mapp-ib-body",r),s=this.getProjection().fromLatLngToContainerPixel(u.position),t,h,c,i,e;o||(o=!0,t={width:n(":first-child",l.getDiv()).width(),height:n(":first-child",l.getDiv()).height()},r.css({"max-height":"9999px",left:0,bottom:0,top:"auto",right:"auto"}),h=r.outerWidth(!0),c=r.outerHeight(!0),c>t.height+u.anchorPoint.y-2*f.border&&(c=t.height+u.anchorPoint.y-2*f.border,r.css({"max-height":c+2})),i=s.x,e=s.y,i+h/2>t.width&&(i=t.width-h/2),i-h/2<0&&(i=h/2),e-c+u.anchorPoint.y<f.border&&(e=c-u.anchorPoint.y+f.border),e>t.height&&(e=t.height),(s.x-i||s.y-e)&&l.panBy(s.x-i,s.y-e),r.css({left:i-h/2,bottom:t.height-e-u.anchorPoint.y}))};this.close=function(){r.is(":visible")&&(this.setMap(null),google.maps.event.trigger(this,"closed"))};this.onRemove=function(){r.hide()}};mappl10n.options.engine!="leaflet"&&(mapp.InfoBox.prototype=new google.maps.OverlayView)}(jQuery);mapp=window.mapp||{};+function(n){mapp.lib={ajax:function(t){var r=this,u,i;if(n.extend({type:"GET",cache:!1,data:null,spinner:null,callback:n.noop},t),t.cache)for(typeof mapp.lib.ajax.cache=="undefined"&&(mapp.lib.ajax.cache=[]),u=JSON.stringify(t.data),i=0;i<mapp.lib.ajax.cache.length;i++)if(mapp.lib.ajax.cache[i].hash==u){t.callback(mapp.lib.ajax.cache[i].response);return}return t.spinner&&t.spinner.show(),n.ajax({type:t.type,cache:!1,url:mappl10n.options.ajaxurl,data:t.data,success:function(n,i,u){if(t.spinner&&t.spinner.hide(),n.output){r.alert("AJAX Error\r\n"+n.output);return}if(n.status=="OK"){t.cache&&mapp.lib.ajax.cache.push({hash:JSON.stringify(t.data),response:n});t.callback&&t.callback(n,u);return}var f=typeof n=="object"?n.status:n;r.alert("AJAX ERROR\r\nResponse="+f+" TextStatus="+i+"\r\nResponseText="+u.responseText)},error:function(n,i,u){(t.spinner&&t.spinner.hide(),i!="cancel")&&typeof u!="undefined"&&u!=""&&r.alert("AJAX ERROR\r\nTextStatus="+i+"\r\nError="+u+"\r\nResponseText="+n.responseText)}})},alert:function(n){mappl10n.options.admin||mappl10n.options.debug?alert(n):window.console&&console.error(n)},jqVersionCheck:function(t){if(typeof n=="undefined"||typeof t=="undefined")return!1;for(t=t.split("."),v=n.fn.jquery.split("."),i=0;i<t.length;i++){var r=parseInt(t[i]),u=typeof v[i]!="undefined"?parseInt(v[i]):0;if(u!=r)return u>r}return!0},log:function(n){window.console&&console.error(n)},scrollTo:function(n,t){if(n&&t&&n.length&&t.length){var i=n.scrollTop(),u=n.height(),r=i+t.position().top,f=r+t.outerHeight(!0);r<i?n.scrollTop(r):f>i+u&&n.scrollTop(f-u)}},template:function(t,i){if(mapp.lib.templates=mapp.lib.templates?mapp.lib.templates:{},!mapp.lib.templates[t]){var r=mappl10n.options.templates?mappl10n.options.template[t]:n("#mapp-tmpl-"+t).html();if(r)mapp.lib.templates[t]=_.template(r.replace(/[\n\r\t]/g,""),null,{evaluate:/<#([\s\S]+?)#>/g,interpolate:/\{\{\{([\s\S]+?)\}\}\}/g,escape:/\{\{([^\}]+?)\}\}(?!\})/g});else return""}return mapp.lib.templates[t](i)}};mapp.lib.jqVersionCheck("1.7")||mapp.lib.alert("jQuery version is too old: "+n.fn.jquery);n("body").on("tabsactivate tabsshow",function(t,i){var r=i.newPanel?i.newPanel:i.panel;r&&n(".mapp-layout",r).each(function(){var i=n(this).find(".mapp-canvas").attr("id"),t=window[i];t.resize();t.recenter()})})}(jQuery);+function(){mappl10n.options.engine=="leaflet"&&(L.LatLng.prototype.toJSON=function(){return{lat:this.lat,lng:this.lng}},L.LatLngBounds.prototype.toJSON=function(){return{south:this.getSouth(),west:this.getWest(),north:this.getNorth(),east:this.getEast()}},L.LatLng.prototype.toUrlValue=function(){return Math.round(this.lat*1e6)/1e6+", "+Math.round(this.lng*1e6)/1e6});mapp.event={addListener:function(n,t,i){if(mappl10n.options.engine=="leaflet")n.on(t,i);else google.maps.event.addListener(n,t,i)},addListenerOnce:function(n,t,i){if(mappl10n.options.engine=="leaflet")n.once(t,i);else google.maps.event.addListenerOnce(n,t,i)},clearInstanceListeners:function(n){mappl10n.options.engine=="leaflet"?n.off():google.maps.event.clearInstanceListeners(n)},clearListeners:function(n,t){mappl10n.options.engine=="leaflet"?n.off(t):google.maps.event.clearListeners(n,"rightclick")},trigger:function(n,t,i){mappl10n.options.engine=="leaflet"?n.fire(t,i):google.maps.event.trigger(n,t,i)}}}(jQuery);mapp=window.mapp||{};jQuery.fn.AlgoliaAutocomplete=jQuery.fn.autocomplete.noConflict();+function(n){mapp.Places=function(t,i){var r=this;this.sel=n(t);this.opts=n.extend({map:null},i);this.geocoder=mappl10n.options.engine=="leaflet"?new mapp.geocoders.Algolia(this.opts.map):new mapp.geocoders.Google(this.opts.map);this.sel.on("keydown",function(t){if(t.which==13){t.preventDefault();var i=r.parseLatLng(r.sel.val());i&&(n(r).triggerHandler("search.mapp",i),r.sel.AlgoliaAutocomplete("close"),t.stopImmediatePropagation())}});this.autocomplete();this.sel.focus()};mapp.Places.prototype={parse:function(t,i){var f=this,u=t&&t.name?n.trim(t.name):n.trim(t),r;if(!u){i(null);return}if(u=="user"){this.geolocate(function(n){i(n)});return}if(t&&t.geometry){i(t);return}if(r=this.parseLatLng(t),r){i(r);return}this.geocoder.geocode(t,function(n){i(n)})},parseLatLng:function(t){var i,e,r,u,f;return t.lat&&t.lng?i=t:(e=t&&t.name?n.trim(t.name):n.trim(t),r=e.split(","),r.length==2&&(u=parseFloat(r[0]),f=parseFloat(r[1]),isNaN(u)||isNaN(f)||(i={lat:u,lng:f}))),i?{name:i.lat+", "+i.lng,geometry:{location:i}}:null},geolocate:function(n){var t=this;if(!navigator||!navigator.geolocation){alert(mappl10n.no_geolocate);return}navigator.geolocation.getCurrentPosition(function(t){var i={lat:t.coords.latitude,lng:t.coords.longitude};n({name:i.lat+", "+i.lng,geometry:{location:i}})},function(t){var i=t&&t.message?" : "+t.message:"";alert(mappl10n.no_geolocate+i);n(null)},{timeout:15e3,enableHighAccuracy:!0,maximumAge:3e4})},autocomplete:function(){var t=this,r,i,u;this.sel.on("autocomplete:selected",function(i,r){t.geocoder.getDetails(r,function(i){t.parse(i,function(i){i&&n(t).triggerHandler("search.mapp",i)})})});r={empty:'<div class="list-group search-results-dropdown"><div class="list-group-item">'+mappl10n.no_results+"<\/div><\/div>",header:'<div class="list-group search-results-dropdown">'};mappl10n.options.engine=="leaflet"?(i={algoliasearch:algoliasearch,templates:r},mappl10n.options.country&&(i.countries=[mappl10n.options.country]),mappl10n.options.language&&(i.language=mappl10n.options.language),u=placesAutocompleteDataset(i)):u={display:"description",source:function(n,i){t.geocoder.getPredictions(n,function(n){matches=n;i(matches)})},templates:r};this.sel.AlgoliaAutocomplete({autoselect:!0,cssClasses:{prefix:"mapp-aa"},debug:!1,hint:!0,highlight:!0,minLength:1},u)}}}(jQuery);mapp=window.mapp||{};+function(n){mapp.Poi=function(t){var u,f,r,o,i,e,h,s;if(this.defaults={address:null,body:null,iconid:null,kml:null,map:null,overlay:null,postid:null,title:"",url:null,type:null,viewport:null},n.extend(this,this.defaults,t),t&&t.correctedAddress&&(this.address=t.correctedAddress),mappl10n.options.engine=="leaflet"&&this.isPoly()&&(this.type=null),t.viewport&&t.viewport.sw&&t.viewport.ne&&(u=t.viewport.sw,f=t.viewport.ne,this.viewport=mappl10n.options.engine=="leaflet"?new L.LatLngBounds(L.latLng(u.lat,u.lng),L.latLng(f.lat,f.lng)):new google.maps.LatLngBounds(new google.maps.LatLng(u.lat,u.lng),new google.maps.LatLng(f.lat,f.lng))),r=[],o=[],!t.overlay)switch(this.type){case"polygon":if(t.poly&&t.poly.paths)for(i=0;i<t.poly.paths.length;i++){for(r=[],e=0;e<t.poly.paths[i].length;e++)r.push(new google.maps.LatLng(t.poly.paths[i][e].lat,t.poly.paths[i][e].lng));o.push(new google.maps.MVCArray(r))}this.overlay=new google.maps.Polygon({paths:new google.maps.MVCArray(o)});this.setColors(t.poly);break;case"polyline":if(t.poly&&t.poly.path)for(i=0;i<t.poly.path.length;i++)r.push(new google.maps.LatLng(t.poly.path[i].lat,t.poly.path[i].lng));this.overlay=new google.maps.Polyline({path:new google.maps.MVCArray(r)});this.setColors(t.poly);break;case"circle":h=new google.maps.LatLng(t.point.lat,t.point.lng);this.overlay=new google.maps.Circle({center:h,radius:parseFloat(t.poly.radius)});this.setColors(t.poly);break;case"rectangle":this.overlay=new google.maps.Rectangle({bounds:this.viewport});this.setColors(t.poly);break;case"kml":s=t.kml&&t.kml.url?t.kml.url:"";this.overlay=mappl10n.options.engine=="leaflet"?omnivore.kml(s):new google.maps.KmlLayer(s,{preserveViewport:!0,suppressInfoWindows:!0});break;case"":default:this.overlay=mappl10n.options.engine=="leaflet"?L.marker([t.point.lat,t.point.lng]):new google.maps.Marker({position:new google.maps.LatLng(t.point.lat,t.point.lng)})}t.type||this.setIcon(t.iconid)};mapp.Poi.prototype={toJSON:function(){var n={address:this.address,body:this.body,correctedAddress:this.address,iconid:this.iconid,point:null,poly:null,title:this.title,type:this.type,viewport:null},u=this.getPosition(),i,t,r;if(n.point=u.toJSON(),i=this.viewport?this.viewport:this.getBounds(),i&&(t=i.toJSON(),n.viewport={sw:{lat:t.south,lng:t.west},ne:{lat:t.north,lng:t.east}}),this.type=="kml"&&(n.kml=this.kml),this.isPoly()){n.poly=this.getColors();switch(this.type){case"circle":n.poly.radius=this.overlay.getRadius();break;case"polyline":n.poly.path=[];this.overlay.getPath().forEach(function(t){n.poly.path.push(t.toJSON())});break;case"polygon":n.poly.paths=[];this.overlay.getPaths().forEach(function(t){var i=[];t.forEach(function(n){i.push(n.toJSON())});n.poly.paths.push(i)});break;case"rectangle":r=this.overlay.getBounds();n.viewport={sw:r.getSouthWest().toJSON(),ne:r.getNorthEast().toJSON()}}}return n},setMap:function(t){var i=this;if(this.map=t,mapp.event.clearInstanceListeners(this.overlay),t==null){mappl10n.options.engine=="leaflet"?this.overlay.remove():this.overlay.setMap(null);return}this.type=="kml"&&(mappl10n.options.engine=="leaflet"?(mapp.event.addListenerOnce(this.overlay,"ready",function(){i.viewport=i.overlay.getBounds()}),mapp.event.addListenerOnce(this.overlay,"error",function(){alert(mappl10n.kml_error)})):(mapp.event.addListener(this.overlay,"defaultviewport_changed",function(){i.viewport=i.overlay.getDefaultViewport()}),mapp.event.addListener(this.overlay,"status_changed",function(){var n=i.overlay.getStatus();n!="OK"&&mappl10n.ajaxErrors&&alert(mappl10n.kml_error+":"+n)})));mapp.event.addListener(this.overlay,"click",function(n){i.open(n)});this.setTitle(n("<div>").html(this.title).text());this.setEditable(this.map.editable);mappl10n.options.engine=="leaflet"?this.overlay.addTo(t.getMap()):this.overlay.setMap(t.getMap())},setEditable:function(n){var t=this;this.type!="kml"&&(mappl10n.options.engine=="leaflet"?this.overlay.options.draggable=n:this.overlay.setDraggable(n),this.isPoly()&&this.overlay.setEditable(n),mapp.event.clearListeners(this.overlay,"rightclick"),mapp.event.clearListeners(this.overlay,"dragstart"),n&&(mapp.event.addListener(this.overlay,"dragstart",function(){t.viewport=null;t.map.close()}),(this.type=="polygon"||this.type=="polyline")&&mapp.event.addListener(this.overlay,"rightclick",function(n){n.vertex!=null&&t.overlay.getPath().getLength()>2&&t.overlay.getPath().removeAt(n.vertex)})))},setTitle:function(n){this.type||(mappl10n.options.engine=="leaflet"?this.overlay.title=n:this.overlay.setTitle(n))},setZIndex:function(n){mappl10n.options.engine=="leaflet"?this.type||this.overlay.setZIndexOffset(n):this.overlay.set("zIndex",n)},setIcon:function(n){this.type||typeof mapp.Icons=="undefined"||(this.iconid=n,mappl10n.options.engine=="leaflet"?this.overlay.setIcon(mapp.Icons.get(n)):(this.overlay.setIcon(null),this.overlay.setIcon(mapp.Icons.get(n))))},setVisible:function(n){typeof this.overlay.setVisible!="undefined"&&this.overlay.setVisible(n)},setColors:function(n){var i={};for(var t in{strokeColor:"",strokeOpacity:"",strokeWeight:"",fillColor:"",fillOpacity:""})n&&typeof n[t]!="undefined"&&(i[t]=n[t]);this.overlay.setOptions(i)},setTemplateColors:function(n,t,i){var r=this.type=="polyline"?{strokeColor:n,strokeOpacity:t/100,strokeWeight:i}:{fillColor:n,fillOpacity:t/100,strokeColor:n,strokeWeight:i,strokeOpacity:1};this.setColors(r)},getColors:function(){var t={};for(var n in{strokeColor:"",strokeOpacity:"",strokeWeight:"",fillColor:"",fillOpacity:""})typeof this.overlay[n]!="undefined"&&(t[n]=this.overlay[n]);return t},getTemplateColors:function(){var n=this.getColors();return this.type=="polyline"?{color:n.strokeColor,opacity:n.strokeOpacity*100,weight:n.strokeWeight}:{color:n.fillColor,opacity:n.fillOpacity*100,weight:n.strokeWeight}},center:function(n){var t=this.getBounds();if(typeof n=="number"){this.map.setView(this.getPosition(),n);return}if(!t){this.map.setView(this.getPosition(),parseInt(mappl10n.options.poiZoom));return}this.map.fitBounds(t);this.map.setView(this.getPosition(),n)},open:function(n){this.map.open(this,n)},isPoly:function(){return jQuery.inArray(this.type,["polyline","polygon","circle","rectangle"])!=-1},getBounds:function(){var n;switch(this.type){case"polyline":n=new google.maps.LatLngBounds;this.overlay.getPath().forEach(function(t){n.extend(t)});break;case"polygon":n=new google.maps.LatLngBounds;this.overlay.getPaths().forEach(function(t){t.forEach(function(t){n.extend(t)})});break;case"rectangle":case"circle":n=this.overlay.getBounds();break;case"kml":n=mappl10n.options.engine=="leaflet"?this.overlay.getBounds().isValid()?this.overlay.getBounds():null:this.overlay.getDefaultViewport();n=n?n:this.viewport;break;default:return this.viewport}return n},getPosition:function(n){if(!this.type)return mappl10n.options.engine=="leaflet"?this.overlay.getLatLng():this.overlay.getPosition();if(this.type=="kml"&&n&&n.latLng)return n.latLng;var t=this.getBounds();return t?t.getCenter():mappl10n.options.engine=="leaflet"?new L.latLng(0,0):new google.maps.LatLng(0,0)},getAddress:function(){return this.address?this.address:this.type=="kml"?this.kml.url:this.getPosition().toUrlValue()},getAnchorPoint:function(n){var t=this.isPoly()?"poly":this.type;switch(t){case"kml":return mappl10n.options.engine=="leaflet"?[0,0]:n&&n.pixelOffset?new google.maps.Point(n.pixelOffset.width,n.pixelOffset.height):new google.maps.Point(0,0);case"poly":return mappl10n.options.engine=="leaflet"?[0,0]:new google.maps.Point(0,0);default:return mappl10n.options.engine=="leaflet"?this.overlay.options.icon.options.popupAnchor?this.overlay.options.icon.options.popupAnchor:[0,-32]:typeof this.overlay.anchorPoint!="undefined"?this.overlay.anchorPoint:new google.maps.Point(0,-32)}},render:function(n){return this.icon=mapp.Icons.getUrl(this.iconid),mapp.lib.template(this.map.templates[n],{poi:this,colors:this.getTemplateColors()})}}}(jQuery);mapp=window.mapp||{};mapp.widgets={};+function(n){mapp.widgets.Grid=function(t,i){this.el=n(t);this.options=jQuery.extend({action:null,sortable:!1},i);var r=this;this.table=n("table",this.el);this.template=n("script",this.el).html().replace(new RegExp("'","g"),'"');this.el.on("click",function(t){var u=n(t.target),i=u.attr("data-mapp-action");i&&(r[i](t),t.preventDefault())})};mapp.widgets.Grid.prototype={add:function(){this.table.show();var t=n(this.template).appendTo(this.table);n(":input:eq(0)",t).focus()},remove:function(t){var i=n(t.target).closest("tr").remove();n("tbody > tr",this.table).length||this.table.hide()}}}(jQuery);+function(n){mapp.widgets.Popup=function(t,i){var r,u;if(this.activeToggle=null,this.content=t,this.el=null,r=this,this.options=n.extend({max:!1,modal:!1,position:null,toggle:null},i),this.options.modal?this.el=this.content.addClass("mapp-popup-fixed"):(this.el=n('<div class="mapp-popup">'),this.setContent(t)),this.el.attr("tabindex",0),this.options.max&&this.el.addClass("mapp-popup-max"),this.el.hide(),!this.options.modal)n(document).on("click.mapp.popup",function(t){n.contains(r.el.get(0),t.target)||r.el.get(0)==t.target||r.close()});if(this.options.toggle){u=typeof this.options.toggle=="string"?this.options.toggle:this.options.toggle.selector;n(document).on("click",u,function(t){r.activeToggle=n(this);r.open();t.stopPropagation()})}this.el.on("click",".mapp-close",function(){r.close()});this.el.on("keydown",function(n){n.which==27&&r.close()});return this};mapp.widgets.Popup.prototype={close:function(){this.el&&this.el.is(":visible")&&(this.backdrop&&(this.backdrop.remove(),n("body").removeClass("mapp-popup-modal")),this.el.hide(),this.activeToggle&&this.activeToggle.focus(),this.el.trigger("closed.mapp.popup"))},open:function(){var t=this;this.options.modal||this.el.parent().length||this.el.appendTo("body");this.el.show();this.options.modal?(this.backdrop=n('<div class="mapp-popup-backdrop"><\/div>'),this.el.after(this.backdrop),n("body").addClass("mapp-popup-modal")):this.el.position(n.extend({my:"center bottom",at:"center top-5",of:this.activeToggle,collision:"flipfit"},this.options.position));this.el.focus();this.el.trigger("open.mapp.popup")},setContent:function(n){this.el.empty();this.el.append('<span class="mapp-close">').append(n)},toggle:function(){this.el.is(":visible")?this.close():this.open()}}}(jQuery);+function(){mapp.load=function(){if(typeof mapp!="undefined"&&mapp.data)while(mapp.data.length){var n=mapp.data.pop();window[n.name]=new mapp.Map(n);window[n.name].display()}}}(jQuery);typeof mapp.Media!="undefined"?window.mappEditor=new mapp.Media:mapp.load()
1
+ var mapp=window.mapp||{};+function(n){mapp.Map=function(n,t){this.defaults={center:null,editable:null,height:null,initialOpenDirections:null,initialOpenInfo:null,layers:null,mapid:null,mapTypeId:null,metaKey:null,mapOpts:null,name:null,pois:null,postid:null,query:null,sel:null,title:null,width:null,zoom:null};this.highlight=null;this.iw=null;this.places=null;this.poi=null;this.settings=t?t:{};this.templates=null;this.dir_=null;this.div={};this.layers_={};this.map_=null;this.pois_=[];this.xhr_;this.zindex_=0;_.extend(this,this.defaults,n,this.settings)};mapp.Map.prototype={display:function(){var t=this,i;if(this.div.layout=this.sel?n(".mapp-layout",this.sel):n("#"+this.name+"-layout"),n.each(["canvas","controls","dialog","directions","filters","iw","list","menu","search"],function(i,r){t.div[r]=n(".mapp-"+r,t.div.layout)}),this.sanity()===!0){this.templates=this.editable?{loop:"edit-loop",item:"edit-item",popup:"edit-popup"}:this.query?{loop:"map-loop",item:"mashup-item",popup:"mashup-popup"}:{loop:"map-loop",item:"map-item",popup:"map-popup"};mappl10n.options.engine=="leaflet"?(i=_.extend({attribution:'Map data © <a href="https://openstreetmap.org">OpenStreetMap<\/a>',minZoom:0,scrollWheelZoom:!1,worldCopyJump:!0,zoomControl:null},this.mapOpts),i.minZoom=isNaN(parseInt(i.minZoom))?0:parseInt(i.minZoom),this.map_=new L.Map(this.div.canvas.get(0),i),L.control.zoom({position:"bottomright",zoomInTitle:"",zoomOutTitle:""}).addTo(this.map_),this.iw=L.popup(),this.iw.setContent(this.div.iw.get(0))):(this.map_=new google.maps.Map(this.div.canvas.get(0),{mapTypeId:"roadmap",zoom:1}),i=_.extend({backgroundColor:"transparent",clickableIcons:!1,fullscreenControl:!1,keyboardShortcuts:!1,mapTypeControl:!0,mapTypeControlOptions:{position:google.maps.ControlPosition.TOP_RIGHT,style:google.maps.MapTypeControlStyle.DROPDOWN_MENU},minZoom:0,scaleControl:!0,scrollwheel:!1,streetViewControl:!this.editable&&!this.query},this.mapOpts),i.minZoom=isNaN(parseInt(i.minZoom))?0:parseInt(i.minZoom),this.map_.setOptions(i),this.iw=mappl10n.options.iwType=="ib"||this.editable?new mapp.InfoBox(this):new google.maps.InfoWindow,this.iw.setContent(this.div.iw.get(0)),this.addLayers());this.addStyles();this.addControls();this.addMenu();this.setMapTypeId(this.mapTypeId,!0);this.places=new mapp.Places(n(".mapp-places",this.div.search),{map:t});n(this.places).on("search.mapp",function(n,i){t.search(i)});this.addEvents("click drag",function(){t.close()});this.toggleView("mini",this.div.layout.width()<mappl10n.options.mini);this.div.layout.on("click","[data-mapp-action]",function(i){var r=n(this).attr("data-mapp-action");i.preventDefault();t.action(r,n(this).attr("data-mapp-"+r),n(this))});this.div.filters.on("change",function(){t.ajaxQuery()});n(window).resize(function(){t.resize()});this.places.parse(this.center,function(n){t.center=n&&n.geometry&&n.geometry.location?{lat:n.geometry.location.lat,lng:n.geometry.location.lng}:null;t.query?t.ajaxQuery(function(){t.initCenter()}):(t.setPois(t.pois),t.initCenter())})}},initCenter:function(){var n=this;this.recenter();this.renderList();this.query&&mappl10n.options.search&&!this.editable&&this.addSearchMove();mappl10n.options.engine=="leaflet"?this.initOpen():mapp.event.addListenerOnce(n.map_,"idle",function(){n.initOpen()})},initOpen:function(){var n=this.pois_.length?this.pois_[0]:null;this.initialOpenDirections?this.openDirections(null,n):n&&this.initialOpenInfo&&n.open()},search:function(n){var i,t,f,u,r;n&&n.geometry&&(i=n.geometry.location?n.geometry.location:null,t=n.geometry.viewport?n.geometry.viewport:null,mappl10n.options.engine=="leaflet"?(f=new L.LatLng(i.lat,i.lng),r=f.toBounds(mappl10n.options.radius*1e3)):(u=new google.maps.Circle({center:i,radius:mappl10n.options.radius*1e3}),r=t?new google.maps.LatLngBounds(new google.maps.LatLng(t.sw.lat,t.sw.lng),new google.maps.LatLng(t.ne.lat,t.ne.lng)).union(u.getBounds()):u.getBounds()),this.fitBounds(r),this.setView(i))},load:function(n){_.extend(this,this.defaults,n,this.settings);this.setMapTypeId(this.mapTypeId,!0);this.setPois(this.pois);this.recenter()},action:function(t,i,r){var f=this,u;switch(t){case"center":this.toggleView("menu",!1);this.close();this.recenter();break;case"dir":this.openDirections(null,this.poi);break;case"dir-from":this.openDirections(this.poi,null);break;case"filters-reset":this.div.filters.find(":input").each(function(){this.type=="checkbox"||this.type=="radio"?n(this).prop("checked",!1):n(this).val("")});this.ajaxQuery();break;case"filters-toggle":this.toggleView("filters");break;case"geolocate":this.places.geolocate(function(n){f.search(n)});break;case"layer":this.toggleLayer(i);this.toggleView("menu",!1);break;case"menu-toggle":this.toggleView("menu");break;case"open":u=r.attr("data-mapp-poi");this.open(this.pois_[u]);break;case"show":this.div.layout.show();this.resize();this.initCenter();break;case"view-map":this.toggleView("list",!1);break;case"view-list":this.toggleView("list",!0);break;default:return!0}},dialog:function(n,t){var i=this;n?(this.div.dialog.html(n),this.div.dialog.show(),t&&(clearTimeout(this.dialog.fade),this.dialog.fade=setTimeout(function(){i.dialog(null)},4e3))):this.div.dialog.hide()},addEvents:function(n,t){n=n.split(" ");for(var i=0;i<n.length;i++)mapp.event.addListener(this.map_,n[i],t)},close:function(){mappl10n.options.engine=="leaflet"?this.map_.closePopup():this.iw.close();this.select(null);n(this).triggerHandler("mapp.close")},openDirections:function(n,t){var i=n?n.getAddress():"",r=t?t.getAddress():"";this.dir_||(this.dir_=new mapp.Directions(this.div.directions,this));this.dir_.open(i,r)},sanity:function(){if(!this.div.canvas.length)return mapp.lib.log("MapPress: Missing map name or container for map: "+this.name);if(mappl10n.options.autoupdate==="tc")return mapp.lib.log("Maps API missing (800001)");if(typeof _=="undefined")return mapp.lib.alert("ERROR: underscore.js not loaded. Check cacheing / optimizing plugins.");if(mappl10n.options.engine=="leaflet"){if(typeof L=="undefined")return mapp.lib.alert("ERROR: Unable to load Leaflet")}else{if(typeof google=="undefined")return mapp.lib.alert("ERROR: Google Maps API not loaded");n(document).ready(function(){n('script[src*="https://maps.googleapis.com/maps/api/js?v=3"]').length>1&&mapp.lib.alert("ERROR: Google Maps API key loaded multiple times, please see MapPress FAQ.")})}return!0},select:function(t){if(n("[data-mapp-poi]",this.div.list).removeClass("mapp-selected"),t){var r=n.inArray(t,this.pois_),i=n('[data-mapp-poi="'+r+'"]',this.div.list);i.addClass("mapp-selected");mapp.lib.scrollTo(this.div.list,i);t.setZIndex(++this.zindex_)}this.poi=t},setHighlight:function(n){this.highlight&&(mappl10n.options.engine=="leaflet"?this.highlight.remove():this.highlight.setMap(null));n&&(mappl10n.options.engine=="leaflet"?this.highlight=new L.Marker(n.getPosition()).addTo(this.map_):(this.highlight=new google.maps.Marker({position:n.getPosition()}),this.highlight.setMap(this.map_)))},getMap:function(){return this.map_},renderList:function(){var i=this.getBounds(),r=0,u=this,t;if(!this.editable)for(t=0;t<this.pois_.length;t++)this.pois_[t].visible=this.pois_[t].type!="kml",this.query&&i&&!i.contains(this.pois_[t].getPosition())&&(this.pois_[t].visible=!1),r+=this.pois_[t].visible;this.div.list.html(mapp.lib.template(this.templates.loop,{map:this,pois:this.pois_,count:r}));this.editable&&n(".mapp-items",u.sel).sortable({axis:"y",cursor:"move",delay:200,update:function(){u.sortPois(n(this).sortable("toArray",{attribute:"data-mapp-poi"}))}})},getPois:function(){return this.pois_},insertPoi:function(n){var t=this;this.pois_.unshift(n);n.setMap(this);t.renderList();this.select(n)},removePoi:function(t){var r=this,i=n.inArray(t,this.pois_);i!=-1&&(this.pois_[i].setMap(null),this.pois_.splice(i,1),r.renderList())},resetPois:function(){for(i=0;i<this.pois_.length;i++)this.pois_[i].setMap(null);this.pois_=[];this.zindex_=0},setPois:function(n){var t,i;if(this.resetPois(),n){for(t=0;t<n.length;t++)i=new mapp.Poi(n[t]),this.pois_.push(i),i.id=this.pois_.length-1,i.setMap(this),i.setZIndex(this.zindex_+n.length-1-t);this.zindex_+=n.length-1}this.renderList()},sortPois:function(n){for(var r,t=Array(),i=0;i<n.length;i++){if(r=parseInt(n[i]),isNaN(r))return!1;t.push(this.pois_[r])}if(t.length!=this.pois_.length)return!1;this.pois_=t;this.renderList()},open:function(t,i){var r=null,u;if(this.close(),this.select(t),mappl10n.options.mashupClick!="poi"&&t.postid&&t.url){window.open(t.url);return}this.toggleView("list",!1);i&&i.featureData?r=i.featureData:i&&i.propagatedFrom&&i.propagatedFrom.feature&&i.propagatedFrom.feature.properties&&(r=i.propagatedFrom.feature.properties);this.div.iw.html(t.render("popup",r));mappl10n.options.engine=="leaflet"?(this.iw.setLatLng(t.getPosition()),this.iw.options.offset=t.getAnchorPoint(),this.map_.openPopup(this.iw)):(u=new google.maps.MVCObject,u.setValues({position:t.getPosition(i),anchorPoint:t.getAnchorPoint(i)}),this.iw.open(this.map_,u));n(this).triggerHandler("mapp.open",t)},renderMenu:function(){var t=this;for(layer in this.layers_)this.layers_[layer].getMap()&&n('[data-mapp-layer="'+layer+'"]',this.div.layout).addClass("mapp-active")},addStyles:function(){var u=this,l,f,r,i;if(mappl10n.options.engine=="leaflet"){if(this.editable){for(l=[],f=L.control.layers(),r=0;r<mappl10n.options.baseLayers.length;r++){var o=mappl10n.options.baseLayers[r],s=mappl10n.options.providers[o.provider],h=n.extend({},s,o);f.addBaseLayer(L.tileLayer(s.url,h),h.label)}mappl10n.options.baseLayers.length>1&&f.addTo(this.map_)}this.map_.on("baselayerchange",function(n){u.mapTypeId=n.layer.options.name})}else{var t=mappl10n.options.styles?mappl10n.options.styles:[],e=mappl10n.options.style,c=["roadmap","satellite","terrain","hybrid"];if(e&&typeof t[e]!="undefined"&&this.map_.setOptions({styles:t[e]}),this.editable){for(i in t)this.map_.mapTypes.set(i,new google.maps.StyledMapType(t[i],{name:i})),c.push(i);this.map_.setOptions({mapTypeControlOptions:{mapTypeIds:c,position:google.maps.ControlPosition.TOP_RIGHT,style:google.maps.MapTypeControlStyle.DROPDOWN_MENU}})}else this.mapTypeId&&typeof t[this.mapTypeId]!="undefined"&&this.map_.setOptions({styles:t[this.mapTypeId]});mapp.event.addListener(this.map_,"maptypeid_changed",function(){u.mapTypeId=u.map_.getMapTypeId()})}},addControls:function(){var n=this;this.div.controls.html(mapp.lib.template("map-controls",{map:this}))},addLayers:function(){var u,i,t,r;for(this.layers_={traffic:new google.maps.TrafficLayer,bicycling:new google.maps.BicyclingLayer,transit:new google.maps.TransitLayer},u=n.makeArray(this.layers),i=0;i<u.length;i++)t=n.trim(u[i]),r=t.split(".").pop(),this.layers_[t]?this.toggleLayer(t):r=="kml"||r=="kmz"?this.layers_[t]=new google.maps.KmlLayer({map:this.map_,preserveViewport:!0,url:t}):r=="json"&&(this.layers_[t]=new google.maps.Data({map:this.map_}).loadGeoJson(t))},addMenu:function(){var t=this;n("body").on("click",function(i){var r=n(i.target),u=r.attr("data-mapp-action");r==t.div.filters||u=="filters-toggle"||r.closest(t.div.filters).length||t.toggleView("filters",!1);r==t.div.menu||u=="menu-toggle"||r.closest(t.div.menu).length||t.toggleView("menu",!1)})},toggleLayer:function(t,i){var r=this;i=typeof i!="undefined"?i:this.layers_[t].getMap()==null;n.each(["traffic","bicycling","transit"],function(n,t){r.layers_[t].setMap(null)});i&&this.layers_[t].setMap(this.map_)},togglePois:function(n){n=!!n;for(var t=0;t<this.pois_.length;t++)this.pois_[t].setVisible(n)},toggleView:function(n,t){t=typeof t=="undefined"?!this.div.layout.hasClass("mapp-view-"+n):t;this.div.layout.toggleClass("mapp-view-"+n,t);n=="menu"&&t&&this.renderMenu();n=="directions"&&(this.close(),this.resize())},resize:function(){var n=this.getCenter();this.toggleView("mini",this.div.layout.width()<mappl10n.options.mini);mappl10n.options.engine=="leaflet"?this.map_.invalidateSize():mapp.event.trigger(this.map_,"resize");n&&this.setView(n)},recenter:function(){var t=this.center&&this.center.lat&&this.center.lng?this.center:null,n=this.zoom&&parseInt(this.zoom)?parseInt(this.zoom):null,i,r;if(t&&!n&&this.query){this.search({geometry:{location:{lat:t.lat,lng:t.lng}}});return}if(t){this.setView(t,n?n:1);return}if(this.pois_.length==0){this.setView({lat:0,lng:0},n?n:1);return}if(this.pois_.length==1){this.pois_[0].center(n);return}for(bounds=mappl10n.options.engine=="leaflet"?new L.LatLngBounds:new google.maps.LatLngBounds,i=0;i<this.pois_.length;i++)r=this.pois_[i].getBounds(),bounds=r?mappl10n.options.engine=="leaflet"?bounds.extend(r):bounds.union(r):bounds.extend(this.pois_[i].getPosition());n?this.setView(bounds.getCenter().toJSON(),n):this.fitBounds(bounds)},toJSON:function(){var n;for(this.pois=[],n=0;n<this.pois_.length;n++)this.pois.push(this.pois_[n].toJSON());return{center:this.center,height:this.height,mapid:this.mapid,mapTypeId:this.mapTypeId,metaKey:this.metaKey,pois:this.pois,title:this.title,width:this.width,zoom:this.zoom}},ajaxSave:function(n){var t=this,i=JSON.stringify(this),r=!this.mapid||!this.postid?mappl10n.options.postid:this.postid;mapp.lib.ajax({type:"POST",data:{action:"mapp_save",map:i,postid:r},callback:function(i){i.status=="OK"&&(t.mapid||(t.mapid=i.data.mapid),n())}})},fitBounds:function(n,t){var t=mappl10n.options.engine=="leaflet"&&t?{paddingTopLeft:[t.left,t.top],paddingBottomRight:[t.right,t.bottom]}:t;return this.map_.fitBounds(n,t)},getBounds:function(){try{return this.map_.getBounds()}catch(n){return null}},getCenter:function(){try{return this.map_.getCenter()}catch(n){return null}},getMapTypeId:function(n){return mappl10n.options.engine=="leaflet"?"roadmap":this.map_.getMapTypeId(n)},setMapTypeId:function(t){var s=this,i,r,e,u,o,f;if(mappl10n.options.engine=="leaflet")for(this.map_.eachLayer(function(n){s.map_.removeLayer(n)}),t=!this.editable&&mappl10n.options.style&&t=="streets"?mappl10n.options.style:t,t=_.findIndex(mappl10n.options.baseLayers,{name:t})>=0?t:mappl10n.options.baseLayers[0].name,i=0;i<mappl10n.options.baseLayers.length;i++)r=mappl10n.options.baseLayers[i],e=mappl10n.options.providers[r.provider],r.name==t&&(u=n.extend({},e,r),o=L.tileLayer(u.url,u),o.addTo(this.map_));else f=n.inArray(t,["roadmap","satellite","terrain","hybrid"])!=-1,t=this.editable?f||typeof mappl10n.options.styles[t]!="undefined"?t:"roadmap":f?t:"roadmap",this.map_.setMapTypeId(t)},setView:function(n,t,i){mappl10n.options.engine=="leaflet"?(t==null&&(t=this.map_.getZoom()?this.map_.getZoom():0),this.map_.setView(n,t,i)):(n&&this.map_.setCenter(n),t&&this.map_.setZoom(parseInt(t)))}};mapp.Map.ajaxGet=function(n,t,i){mapp.lib.ajax({type:"GET",data:{action:"mapp_get",mapid:n},callback:function(n){if(n.status=="OK"){var r=new mapp.Map(n.data.map,t);i(r)}}})};mapp.Map.ajaxDelete=function(n,t){mapp.lib.ajax({type:"POST",data:{action:"mapp_delete",mapid:n},callback:function(n){n.status=="OK"&&t&&t()}})}}(jQuery);mapp=window.mapp||{};+function(n){mapp.Directions=function(t,i){this.sel=n(t);this.map=i;this.directionsRenderer=null;this.directionsService=null;this.placesService=null;var r=this;this.sel.on("keydown",function(n){n.which==13?(r.getDirections(),n.preventDefault()):n.which==27&&r.close()});this.sel.on("click","[data-mapp-action]",function(t){var i=n(this).attr("data-mapp-action"),u=n(".mapp-dir-daddr",r.sel).val(),f=n(".mapp-dir-saddr",r.sel).val();t.preventDefault();switch(i){case"dir-cancel":r.close();break;case"dir-get":r.getDirections();break;case"dir-myloc":r.map.places.geolocate(function(t){n(".mapp-dir-saddr",r.sel).val(t.name);r.getDirections()});break;case"dir-swap":n(".mapp-dir-saddr",r.sel).val(u);n(".mapp-dir-daddr",r.sel).val(f);r.getDirections()}});this.open=function(t,i){if(mappl10n.options.directions=="google"){this.openGoogle(t,i);return}this.map.toggleView("directions",!0);n(".mapp-dir-addr",this.sel).removeClass("mapp-error");n(".mapp-dir-saddr",this.sel).val(t);n(".mapp-dir-daddr",this.sel).val(i);n(".mapp-dir-get",this.sel).focus();n(".mapp-dir-saddr",this.sel).focus()};this.close=function(){this.map.toggleView("directions",!1);this.directionsRenderer&&(this.directionsRenderer.setPanel(null),this.directionsRenderer.getMap()&&(this.directionsRenderer.setMap(null),this.map.togglePois(!0)))};this.getDirections=function(){this.map.close();this.openGoogle(n(".mapp-dir-saddr",this.sel).val(),n(".mapp-dir-daddr",this.sel).val());return};this.openGoogle=function(n,t){var i=mappl10n.options.directionsServer;i.toLowerCase().indexOf("http")==-1&&(i="https://"+i);i+="?saddr="+encodeURIComponent(n);i+="&daddr="+encodeURIComponent(t);window.open(i)}}}(jQuery);mapp=window.mapp||{};mapp.geocoders={};+function(){mapp.geocoders.Algolia=function(n){this.map=n;this.places=algoliasearch.initPlaces()};mapp.geocoders.Algolia.prototype={geocode:function(n,t){var i=this;this.getPredictions(n,function(i){i&&i.hits.length?t({formatted_address:i.hits[0].locale_names[0],name:n,geometry:{location:{lat:i.hits[0]._geoloc.lat,lng:i.hits[0]._geoloc.lng}}}):t(null)})},getDetails:function(n,t){t({formatted_address:n.value,name:n.name,geometry:{location:n.latlng}})},getPredictions:function(n,t){this.places.search({query:n,language:mappl10n.options.language},function(n,i){n||!i?t(null):t(i)})}}}(jQuery);+function(n){mapp.geocoders.Google=function(t){this.map=t;this.token=null;this.types=this.map.editable?null:["geocode"];var i=n('<div style="display:none">').appendTo("body");this.placesService=new google.maps.places.PlacesService(i.get(0));this.autocompleteService=new google.maps.places.AutocompleteService;i.remove()};mapp.geocoders.Google.prototype={geocode:function(t,i){var r=this;this.getPredictions(t,function(t){t&&n.isArray(t)?r.getDetails(t[0],function(n){i(n)}):i(null)})},getDetails:function(n,t){this.token=this.token?this.token:new google.maps.places.AutocompleteSessionToken;this.token=null;var i={placeId:n.place_id,sessionToken:this.token};this.placesService.getDetails(i,function(n,i){if(i=="OK"&&n&&n.geometry){if(n.geometry.location&&(n.geometry.location=n.geometry.location.toJSON()),n.geometry.viewport){var r=n.geometry.viewport.toJSON();n.geometry.viewport={sw:{lat:r.south,lng:r.west},ne:{lat:r.north,lng:r.east}}}t(n)}else t(null)})},getPredictions:function(n,t){var i,r;this.token=this.token?this.token:new google.maps.places.AutocompleteSessionToken;i=this.map.getMap().getBounds();i=i?i:new google.maps.LatLngBounds(new google.maps.LatLng(85,-180),new google.maps.LatLng(-85,180));r={input:n,bounds:i,sessionToken:this.token,types:this.types};this.autocompleteService.getPlacePredictions(r,function(n,i){i=="OK"&&n&&n.length?t(n):(i==google.maps.places.PlacesServiceStatus.REQUEST_DENIED?alert("Google Maps API Key error: please enable the Places API in the Google Developer Console."):i==google.maps.places.PlacesServiceStatus.OVER_QUERY_LIMIT&&alert("Google Maps API Key has exceeded its query limit"),t(null))})}}}(jQuery);mapp=window.mapp||{};mapp.Icons={};mapp.Icons.get=function(){var n="https://maps.google.com/intl/en_us/mapfiles/ms/micons/red-dot.png";return mappl10n.options.engine=="leaflet"?L.icon({iconUrl:n,iconAnchor:[16,32],iconSize:[32,32],popupAnchor:[0,-32]}):{url:n}};mapp.Icons.getUrl=function(){return"https://maps.google.com/intl/en_us/mapfiles/ms/micons/red-dot.png"};mapp=window.mapp||{};+function(n){mapp.InfoBox=function(t,i){var f=n.extend({border:20},i),u=null,r=null,o,e=this;r=n('<div class="mapp-ib-wrapper" tabindex="0"><div class="mapp-ib" tabindex="0"><\/div><div class="mapp-ib-tip"><\/div><\/div>').appendTo(t.getMap().getDiv());jQuery(window).resize(function(){e.close()});r.on("keydown",function(n){n.which==27&&e.close()});r.on("click",".mapp-close",function(){e.close()});this.getContent=function(){return n(".mapp-ib",r)};this.setContent=function(t){n(".mapp-ib",r).empty().append(t)};this.open=function(n,t){u=t;this.setMap(n)};this.onAdd=function(){o=!1;var t=n(":input",r);r.show();t.length?t.first().focus():r.focus();google.maps.event.trigger(e,"domready")};this.draw=function(){var l=this.getMap(),a=n(".mapp-ib-body",r),s=this.getProjection().fromLatLngToContainerPixel(u.position),t,h,c,i,e;o||(o=!0,t={width:n(":first-child",l.getDiv()).width(),height:n(":first-child",l.getDiv()).height()},r.css({"max-height":"9999px",left:0,bottom:0,top:"auto",right:"auto"}),h=r.outerWidth(!0),c=r.outerHeight(!0),c>t.height+u.anchorPoint.y-2*f.border&&(c=t.height+u.anchorPoint.y-2*f.border,r.css({"max-height":c+2})),i=s.x,e=s.y,i+h/2>t.width&&(i=t.width-h/2),i-h/2<0&&(i=h/2),e-c+u.anchorPoint.y<f.border&&(e=c-u.anchorPoint.y+f.border),e>t.height&&(e=t.height),(s.x-i||s.y-e)&&l.panBy(s.x-i,s.y-e),r.css({left:i-h/2,bottom:t.height-e-u.anchorPoint.y}))};this.close=function(){r.is(":visible")&&(this.setMap(null),google.maps.event.trigger(this,"closed"))};this.onRemove=function(){r.hide()}};mappl10n.options.engine!="leaflet"&&(mapp.InfoBox.prototype=new google.maps.OverlayView)}(jQuery);mapp=window.mapp||{};+function(n){mapp.lib={ajax:function(t){var i=this;return n.extend({type:"GET",data:null,spinner:null,callback:n.noop},t),t.spinner&&t.spinner.show(),n.ajax({type:t.type,url:mappl10n.options.ajaxurl,data:t.data,success:function(n,r,u){if(t.spinner&&t.spinner.hide(),n.output){i.alert("AJAX Error\r\n"+n.output);return}if(n.status!="OK"){var f=typeof n=="object"?n.status:n;i.alert("AJAX ERROR\r\nResponse="+f+" TextStatus="+r+"\r\nResponseText="+u.responseText)}t.callback&&t.callback(n,u)},error:function(n,r,u){(t.spinner&&t.spinner.hide(),r!="cancel")&&typeof u!="undefined"&&u!=""&&i.alert("AJAX ERROR\r\nTextStatus="+r+"\r\nError="+u+"\r\nResponseText="+n.responseText)}})},alert:function(n){mappl10n.options.admin||mappl10n.options.debug?alert(n):window.console&&console.error(n)},jqVersionCheck:function(t){if(typeof n=="undefined"||typeof t=="undefined")return!1;for(t=t.split("."),v=n.fn.jquery.split("."),i=0;i<t.length;i++){var r=parseInt(t[i]),u=typeof v[i]!="undefined"?parseInt(v[i]):0;if(u!=r)return u>r}return!0},log:function(n){window.console&&console.error(n)},scrollTo:function(n,t){if(n&&t&&n.length&&t.length){var i=n.scrollTop(),u=n.height(),r=i+t.position().top,f=r+t.outerHeight(!0);r<i?n.scrollTop(r):f>i+u&&n.scrollTop(f-u)}},template:function(t,i){if(mapp.lib.templates=mapp.lib.templates?mapp.lib.templates:{},!mapp.lib.templates[t]){var r=mappl10n.options.templates?mappl10n.options.template[t]:n("#mapp-tmpl-"+t).html();if(r)mapp.lib.templates[t]=_.template(r.replace(/[\n\r\t]/g,""),null,{evaluate:/<#([\s\S]+?)#>/g,interpolate:/\{\{\{([\s\S]+?)\}\}\}/g,escape:/\{\{([^\}]+?)\}\}(?!\})/g});else return""}return mapp.lib.templates[t](i)}};mapp.lib.jqVersionCheck("1.7")||mapp.lib.alert("jQuery version is too old: "+n.fn.jquery);n("body").on("tabsactivate tabsshow",function(t,i){var r=i.newPanel?i.newPanel:i.panel;r&&n(".mapp-layout",r).each(function(){var i=n(this).find(".mapp-canvas").attr("id"),t=window[i];t.resize();t.recenter()})})}(jQuery);+function(){mappl10n.options.engine=="leaflet"&&(L.LatLng.prototype.toJSON=function(){return{lat:this.lat,lng:this.lng}},L.LatLngBounds.prototype.toJSON=function(){return{south:this.getSouth(),west:this.getWest(),north:this.getNorth(),east:this.getEast()}},L.LatLng.prototype.toUrlValue=function(){return Math.round(this.lat*1e6)/1e6+", "+Math.round(this.lng*1e6)/1e6});mapp.event={addListener:function(n,t,i){if(mappl10n.options.engine=="leaflet")n.on(t,i);else google.maps.event.addListener(n,t,i)},addListenerOnce:function(n,t,i){if(mappl10n.options.engine=="leaflet")n.once(t,i);else google.maps.event.addListenerOnce(n,t,i)},clearInstanceListeners:function(n){mappl10n.options.engine=="leaflet"?n.off():google.maps.event.clearInstanceListeners(n)},clearListeners:function(n,t){mappl10n.options.engine=="leaflet"?n.off(t):google.maps.event.clearListeners(n,"rightclick")},trigger:function(n,t,i){mappl10n.options.engine=="leaflet"?n.fire(t,i):google.maps.event.trigger(n,t,i)}}}(jQuery);mapp=window.mapp||{};jQuery.fn.AlgoliaAutocomplete=jQuery.fn.autocomplete.noConflict();+function(n){mapp.Places=function(t,i){var r=this;this.sel=n(t);this.opts=n.extend({map:null},i);this.geocoder=mappl10n.options.engine=="leaflet"?new mapp.geocoders.Algolia(this.opts.map):new mapp.geocoders.Google(this.opts.map);this.sel.on("keydown",function(t){if(t.which==13){t.preventDefault();var i=r.parseLatLng(r.sel.val());i&&(n(r).triggerHandler("search.mapp",i),r.sel.AlgoliaAutocomplete("close"),t.stopImmediatePropagation());r.sel.val().substring(0,4)=="http"&&(n(r).triggerHandler("search.mapp",r.sel.val()),r.sel.AlgoliaAutocomplete("close"),t.stopImmediatePropagation())}});this.autocomplete();this.sel.focus()};mapp.Places.prototype={parse:function(t,i){var f=this,u=t&&t.name?n.trim(t.name):n.trim(t),r;if(!u){i(null);return}if(u=="user"){this.geolocate(function(n){i(n)});return}if(t&&t.geometry){i(t);return}if(r=this.parseLatLng(t),r){i(r);return}this.geocoder.geocode(t,function(n){i(n)})},parseLatLng:function(t){var i,e,r,u,f;return t.lat&&t.lng?i=t:(e=t&&t.name?n.trim(t.name):n.trim(t),r=e.split(","),r.length==2&&(u=parseFloat(r[0]),f=parseFloat(r[1]),isNaN(u)||isNaN(f)||(i={lat:u,lng:f}))),i?{name:i.lat+", "+i.lng,geometry:{location:i}}:null},geolocate:function(n){var t=this;if(!navigator||!navigator.geolocation){alert(mappl10n.no_geolocate);return}navigator.geolocation.getCurrentPosition(function(t){var i={lat:t.coords.latitude,lng:t.coords.longitude};n({name:i.lat+", "+i.lng,geometry:{location:i}})},function(t){var i=t&&t.message?" : "+t.message:"";alert(mappl10n.no_geolocate+i);n(null)},{timeout:15e3,enableHighAccuracy:!0,maximumAge:3e4})},autocomplete:function(){var t=this,r,i,u;this.sel.on("autocomplete:selected",function(i,r){t.geocoder.getDetails(r,function(i){t.parse(i,function(i){i&&n(t).triggerHandler("search.mapp",i)})})});r={empty:'<div class="list-group search-results-dropdown"><div class="list-group-item">'+mappl10n.no_results+"<\/div><\/div>",header:'<div class="list-group search-results-dropdown">'};mappl10n.options.engine=="leaflet"?(i={algoliasearch:algoliasearch,templates:r},mappl10n.options.country&&(i.countries=[mappl10n.options.country]),mappl10n.options.language&&(i.language=mappl10n.options.language),u=placesAutocompleteDataset(i)):u={display:"description",source:function(n,i){t.geocoder.getPredictions(n,function(n){matches=n;i(matches)})},templates:r};this.sel.AlgoliaAutocomplete({autoselect:!0,cssClasses:{prefix:"mapp-aa"},debug:!1,hint:!0,highlight:!0,minLength:1},u)}}}(jQuery);mapp=window.mapp||{};+function(n){mapp.Poi=function(t){var u,f,r,o,i,e,h,s;if(this.defaults={address:null,body:null,iconid:null,kml:null,map:null,overlay:null,postid:null,props:null,title:"",url:null,type:null,viewport:null},n.extend(this,this.defaults,t),t&&t.correctedAddress&&(this.address=t.correctedAddress),mappl10n.options.engine=="leaflet"&&this.isPoly()&&(this.type=null),t.viewport&&t.viewport.sw&&t.viewport.ne&&(u=t.viewport.sw,f=t.viewport.ne,this.viewport=mappl10n.options.engine=="leaflet"?new L.LatLngBounds(L.latLng(u.lat,u.lng),L.latLng(f.lat,f.lng)):new google.maps.LatLngBounds(new google.maps.LatLng(u.lat,u.lng),new google.maps.LatLng(f.lat,f.lng))),r=[],o=[],!t.overlay)switch(this.type){case"polygon":if(t.poly&&t.poly.paths)for(i=0;i<t.poly.paths.length;i++){for(r=[],e=0;e<t.poly.paths[i].length;e++)r.push(new google.maps.LatLng(t.poly.paths[i][e].lat,t.poly.paths[i][e].lng));o.push(new google.maps.MVCArray(r))}this.overlay=new google.maps.Polygon({paths:new google.maps.MVCArray(o)});this.setColors(t.poly);break;case"polyline":if(t.poly&&t.poly.path)for(i=0;i<t.poly.path.length;i++)r.push(new google.maps.LatLng(t.poly.path[i].lat,t.poly.path[i].lng));this.overlay=new google.maps.Polyline({path:new google.maps.MVCArray(r)});this.setColors(t.poly);break;case"circle":h=new google.maps.LatLng(t.point.lat,t.point.lng);this.overlay=new google.maps.Circle({center:h,radius:parseFloat(t.poly.radius)});this.setColors(t.poly);break;case"rectangle":this.overlay=new google.maps.Rectangle({bounds:this.viewport});this.setColors(t.poly);break;case"kml":s=t.kml&&t.kml.url?t.kml.url:"";this.overlay=mappl10n.options.engine=="leaflet"?omnivore.kml(s):new google.maps.KmlLayer(s,{preserveViewport:!0,suppressInfoWindows:!0});break;case"":default:this.overlay=mappl10n.options.engine=="leaflet"?L.marker([t.point.lat,t.point.lng],{title:t.title}):new google.maps.Marker({position:new google.maps.LatLng(t.point.lat,t.point.lng),title:t.title})}t.type||this.setIcon(t.iconid)};mapp.Poi.prototype={toJSON:function(){var n={address:this.address,body:this.body,correctedAddress:this.address,iconid:this.iconid,point:null,poly:null,title:this.title,type:this.type,viewport:null},u=this.getPosition(),i,t,r;if(n.point=u.toJSON(),i=this.viewport?this.viewport:this.getBounds(),i&&(t=i.toJSON(),n.viewport={sw:{lat:t.south,lng:t.west},ne:{lat:t.north,lng:t.east}}),this.type=="kml"&&(n.kml=this.kml),this.isPoly()){n.poly=this.getColors();switch(this.type){case"circle":n.poly.radius=this.overlay.getRadius();break;case"polyline":n.poly.path=[];this.overlay.getPath().forEach(function(t){n.poly.path.push(t.toJSON())});break;case"polygon":n.poly.paths=[];this.overlay.getPaths().forEach(function(t){var i=[];t.forEach(function(n){i.push(n.toJSON())});n.poly.paths.push(i)});break;case"rectangle":r=this.overlay.getBounds();n.viewport={sw:r.getSouthWest().toJSON(),ne:r.getNorthEast().toJSON()}}}return n},setMap:function(n){var t=this;if(this.map=n,mapp.event.clearInstanceListeners(this.overlay),n==null){mappl10n.options.engine=="leaflet"?this.overlay.remove():this.overlay.setMap(null);return}this.type=="kml"&&(mappl10n.options.engine=="leaflet"?(mapp.event.addListenerOnce(this.overlay,"ready",function(){t.viewport=t.overlay.getBounds()}),mapp.event.addListenerOnce(this.overlay,"error",function(){alert(mappl10n.kml_error)})):(mapp.event.addListener(this.overlay,"defaultviewport_changed",function(){t.viewport=t.overlay.getDefaultViewport()}),mapp.event.addListener(this.overlay,"status_changed",function(){var n=t.overlay.getStatus();n!="OK"&&mappl10n.ajaxErrors&&alert(mappl10n.kml_error+":"+n)})));mapp.event.addListener(this.overlay,"click",function(n){t.open(n)});this.setEditable(this.map.editable);mappl10n.options.engine=="leaflet"?this.overlay.addTo(n.getMap()):this.overlay.setMap(n.getMap())},setEditable:function(n){var t=this;this.type!="kml"&&(mappl10n.options.engine=="leaflet"?this.overlay.options.draggable=n:this.overlay.setDraggable(n),this.isPoly()&&this.overlay.setEditable(n),mapp.event.clearListeners(this.overlay,"rightclick"),mapp.event.clearListeners(this.overlay,"dragstart"),n&&(mapp.event.addListener(this.overlay,"dragstart",function(){t.viewport=null;t.map.close()}),(this.type=="polygon"||this.type=="polyline")&&mapp.event.addListener(this.overlay,"rightclick",function(n){n.vertex!=null&&t.overlay.getPath().getLength()>2&&t.overlay.getPath().removeAt(n.vertex)})))},setZIndex:function(n){mappl10n.options.engine=="leaflet"?this.type||this.overlay.setZIndexOffset(n):this.overlay.set("zIndex",n)},setIcon:function(n){this.type||typeof mapp.Icons=="undefined"||(this.iconid=n,mappl10n.options.engine=="leaflet"?this.overlay.setIcon(mapp.Icons.get(n)):(this.overlay.setIcon(null),this.overlay.setIcon(mapp.Icons.get(n))))},setVisible:function(n){typeof this.overlay.setVisible!="undefined"&&this.overlay.setVisible(n)},setColors:function(n){var i={};for(var t in{strokeColor:"",strokeOpacity:"",strokeWeight:"",fillColor:"",fillOpacity:""})n&&typeof n[t]!="undefined"&&(i[t]=n[t]);this.overlay.setOptions(i)},setTemplateColors:function(n,t,i){var r=this.type=="polyline"?{strokeColor:n,strokeOpacity:t/100,strokeWeight:i}:{fillColor:n,fillOpacity:t/100,strokeColor:n,strokeWeight:i,strokeOpacity:1};this.setColors(r)},getColors:function(){var t={};for(var n in{strokeColor:"",strokeOpacity:"",strokeWeight:"",fillColor:"",fillOpacity:""})typeof this.overlay[n]!="undefined"&&(t[n]=this.overlay[n]);return t},getTemplateColors:function(){var n=this.getColors();return this.type=="polyline"?{color:n.strokeColor,opacity:n.strokeOpacity*100,weight:n.strokeWeight}:{color:n.fillColor,opacity:n.fillOpacity*100,weight:n.strokeWeight}},center:function(n){var t=this.getBounds();if(typeof n=="number"){this.map.setView(this.getPosition(),n);return}if(!t){this.map.setView(this.getPosition(),parseInt(mappl10n.options.poiZoom));return}this.map.fitBounds(t);this.map.setView(this.getPosition(),n)},open:function(n){this.map.open(this,n)},isPoly:function(){return jQuery.inArray(this.type,["polyline","polygon","circle","rectangle"])!=-1},getBounds:function(){var n;switch(this.type){case"polyline":n=new google.maps.LatLngBounds;this.overlay.getPath().forEach(function(t){n.extend(t)});break;case"polygon":n=new google.maps.LatLngBounds;this.overlay.getPaths().forEach(function(t){t.forEach(function(t){n.extend(t)})});break;case"rectangle":case"circle":n=this.overlay.getBounds();break;case"kml":n=mappl10n.options.engine=="leaflet"?this.overlay.getBounds().isValid()?this.overlay.getBounds():null:this.overlay.getDefaultViewport();n=n?n:this.viewport;break;default:return this.viewport}return n},getPosition:function(n){if(!this.type)return mappl10n.options.engine=="leaflet"?this.overlay.getLatLng():this.overlay.getPosition();if(this.type=="kml"&&n&&n.latLng)return n.latLng;var t=this.getBounds();return t?t.getCenter():mappl10n.options.engine=="leaflet"?new L.latLng(0,0):new google.maps.LatLng(0,0)},getAddress:function(){return this.address?this.address:this.getPosition().toUrlValue()},getAnchorPoint:function(n){var t=this.isPoly()?"poly":this.type;switch(t){case"kml":return mappl10n.options.engine=="leaflet"?[0,0]:n&&n.pixelOffset?new google.maps.Point(n.pixelOffset.width,n.pixelOffset.height):new google.maps.Point(0,0);case"poly":return mappl10n.options.engine=="leaflet"?[0,0]:new google.maps.Point(0,0);default:return mappl10n.options.engine=="leaflet"?this.overlay.options.icon.options.popupAnchor?this.overlay.options.icon.options.popupAnchor:[0,-32]:typeof this.overlay.anchorPoint!="undefined"?this.overlay.anchorPoint:new google.maps.Point(0,-32)}},render:function(n,t){var i=_.extend(this,{icon:mapp.Icons.getUrl(this.iconid)});return t&&(i.body=t.description,i.title=t.name),mapp.lib.template(this.map.templates[n],{poi:i,colors:this.getTemplateColors()})}}}(jQuery);mapp=window.mapp||{};mapp.widgets={};+function(n){mapp.widgets.Grid=function(t,i){this.el=n(t);this.options=jQuery.extend({action:null,sortable:!1},i);var r=this;this.table=n("table",this.el);this.template=n("script",this.el).html().replace(new RegExp("'","g"),'"');this.el.on("click",function(t){var u=n(t.target),i=u.attr("data-mapp-action");i&&(r[i](t),t.preventDefault())})};mapp.widgets.Grid.prototype={add:function(){this.table.show();var t=n(this.template).appendTo(this.table);n(":input:eq(0)",t).focus()},remove:function(t){var i=n(t.target).closest("tr").remove();n("tbody > tr",this.table).length||this.table.hide()}}}(jQuery);+function(n){mapp.widgets.Popup=function(t,i){var r,u;if(this.activeToggle=null,this.content=t,this.el=null,r=this,this.options=n.extend({max:!1,modal:!1,position:null,toggle:null},i),this.options.modal?this.el=this.content.addClass("mapp-popup-fixed"):(this.el=n('<div class="mapp-popup">'),this.setContent(t)),this.el.attr("tabindex",0),this.options.max&&this.el.addClass("mapp-popup-max"),this.el.hide(),!this.options.modal)n(document).on("click.mapp.popup",function(t){n.contains(r.el.get(0),t.target)||r.el.get(0)==t.target||r.close()});if(this.options.toggle){u=typeof this.options.toggle=="string"?this.options.toggle:this.options.toggle.selector;n(document).on("click",u,function(t){r.activeToggle=n(this);r.open();t.stopPropagation()})}this.el.on("click",".mapp-close",function(){r.close()});this.el.on("keydown",function(n){n.which==27&&r.close()});return this};mapp.widgets.Popup.prototype={close:function(){this.el&&this.el.is(":visible")&&(this.backdrop&&(this.backdrop.remove(),n("body").removeClass("mapp-popup-modal")),this.el.hide(),this.activeToggle&&this.activeToggle.focus(),this.el.trigger("closed.mapp.popup"))},open:function(){var t=this;this.options.modal||this.el.parent().length||this.el.appendTo("body");this.el.show();this.options.modal?(this.backdrop=n('<div class="mapp-popup-backdrop"><\/div>'),this.el.after(this.backdrop),n("body").addClass("mapp-popup-modal")):this.el.position(n.extend({my:"center bottom",at:"center top-5",of:this.activeToggle,collision:"flipfit"},this.options.position));this.el.focus();this.el.trigger("open.mapp.popup")},setContent:function(n){this.el.empty();this.el.append('<span class="mapp-close">').append(n)},toggle:function(){this.el.is(":visible")?this.close():this.open()}}}(jQuery);+function(){mapp.load=function(){if(typeof mapp!="undefined"&&mapp.data)while(mapp.data.length){var n=mapp.data.pop();window[n.name]=new mapp.Map(n);window[n.name].display()}}}(jQuery);typeof mapp.Media!="undefined"?window.mappEditor=new mapp.Media:mapp.load()
js/mappress_editor.min.js CHANGED
@@ -1 +1 @@
1
- var mapp=window.mapp||{};+function(n){mapp.Media=function(){this.editor=null;this.map=null;this.settings=null;this.tplEditor=null;this.sel=n(".mapp-media");this.list=[];var t=this;this.initialize=function(){this.find();n(".mapp-media-list-type",this.sel).on("change",function(){var i=n(".mapp-media-list-type",this.sel).val();n(".mapp-media-search").val("");n(".mapp-media-search").toggle(i=="all");t.find()});var i=_.debounce(function(){t.find()});n(".mapp-media-search").keydown(function(){i()});this.settings={editable:!0,name:"mapp0"};this.sel.on("click","[data-mapp-media]",function(i){i.preventDefault();var r=n(this).attr("data-mapp-media");t[r]()});n(".mapp-media-list .mapp-item",this.sel).on("click",function(){n(".mapp-media-list .mapp-item",this.sel).removeClass("mapp-active");n(this).addClass("mapp-active")});n(".mapp-media-list",this.sel).on("click","[data-mapp-media]",function(i){i.preventDefault();var r=n(this).attr("data-mapp-media"),u=n(this).closest(".mapp-item"),f=u.attr("data-mapp-mapid");return t[r](f),!1});this.sel.on("change",".mapp-media-viewport",function(){n(this).is(":checked")||(t.map.center=t.map.zoom=null,t.map.recenter())});n(".mapp-media-size").click(function(t){var i=n(this).data("width"),r=n(this).data("height");n(".mapp-media-width").val(i);n(".mapp-media-height").val(r);t.preventDefault()});n("#publish, #post-preview").click(function(){t.save()});n(".mapp-media-title").keydown(function(n){n.which==13&&(n.preventDefault(),t.save())})};this.add=function(){var n=new mapp.Map(this.settings);n.width=mappl10n.options.sizes[mappl10n.options.size].width;n.height=mappl10n.options.sizes[mappl10n.options.size].height;t.open(n)};this.cancel=function(){t.closeEditor()};this.closeEditor=function(){this.editor.close();this.map=null;this.editor=null;n(".mapp-media-edit-panel").hide();n(".mapp-media-list-panel").show()};this.edit=function(n){mapp.Map.ajaxGet(n,this.settings,function(n){t.open(n)})};this.find=function(t){var i=this,r=n(".mapp-media-list-type",this.sel).val(),u=n(".mapp-media-search").val();n(".spinner",this.sel).css("visibility","visible");mapp.lib.ajax({type:"GET",data:{action:"mapp_find",type:r,page:t,postid:mappl10n.options.postid,search:u},callback:function(t){t.status=="OK"&&(n(".spinner",this.sel).css("visibility","hidden"),i.list=t.data,i.renderList())}})};this.insert=function(n){n=n?n:this.map.mapid;var t='[mappress mapid="'+n+'"]';send_to_editor(t)};this.open=function(t){this.map=t;n(".mapp-edit",this.sel).html(mapp.lib.template("edit-map"));var i=this.map.mapid;i?n(".mapp-media-mapid").text(i):n(".mapp-media-mapid").text("");n(".mapp-media-title").val(this.map.title);n(".mapp-media-width").val(this.map.width);n(".mapp-media-height").val(this.map.height);n(".mapp-media-viewport").prop("checked",!!(this.map.center&&this.map.zoom));n(".mapp-media-edit-panel").show();n(".mapp-media-list-panel").hide();this.editor=new mapp.Editor(this.map)};this.remove=function(n){if(confirm(mappl10n.delete_map_prompt)){var t=_.findIndex(this.list.items,{mapid:n});t>-1&&(this.list.items.splice(t,1),mapp.Map.ajaxDelete(n),this.renderList())}};this.renderList=function(){var t=n(".mapp-media-list-type",this.sel).val();n(".mapp-media-list",this.sel).html(mapp.lib.template("media-list",{list:this.list,type:t}))};this.save=function(){var t=this;this.map&&(this.map.title=n.trim(n(".mapp-media-title").val()),this.map.width=n(".mapp-media-width").val(),this.map.height=n(".mapp-media-height").val(),n(".mapp-media-viewport").prop("checked")?(this.map.center=this.map.getMap().getCenter().toJSON(),this.map.zoom=this.map.getMap().getZoom()):(this.map.center=null,this.map.zoom=null),this.map.ajaxSave(function(n){var i=_.findIndex(t.list.items,{mapid:t.map.mapid});i==-1?t.list.items.unshift(n):t.list.items[i]=n;t.renderList();t.closeEditor()}))};this.initialize.apply(this)}}(jQuery);+function(n){mapp.Editor=function(t){this.drawingManager=null;this.map=t;this.poiEditor=null;this.sel=n(".mapp-edit");var i=this;this.initialize=function(){this.map.display();this.poiEditor=new mapp.PoiEditor(this.map);this.initDrawingManager();n(this.map.places).off("search.mapp");n(this.map.places).on("search.mapp",function(n,t){i.insertPoi(t)});this.sel.on("click","[data-mapp-editor]",function(t){t.preventDefault();var r=n(this).attr("data-mapp-editor");i[r]()})};this.close=function(){this.map.close()};this.insertPoi=function(n){var t;if(n)if(this.drawingManager&&this.drawingManager.setDrawingMode(null),this.map.close(),n.geometry){var i=n.formatted_address?n.formatted_address.replace(/, United States of America/i,"").replace(/, United States/i,"").replace(/, USA/i,""):null,r=n.name==i?"":i,t=new mapp.Poi({address:i,body:r,iconid:this.poiEditor.lastIcon,point:n.geometry.location,title:n.name,viewport:n.geometry.viewport?n.geometry.viewport:null});this.map.insertPoi(t);t.center()}else n.overlay&&(t=new mapp.Poi({body:"",iconid:n.type=="marker"?null:"poly",overlay:n.overlay,title:n.type=="marker"?n.overlay.getPosition().toUrlValue(6):mappl10n.shape,type:n.type=="marker"?null:n.type}),this.map.insertPoi(t))};this.initDrawingManager=function(){};this.layer=function(){var n=window.prompt(mappl10n.layer);n&&i.insertPoi(n)};this.initialize.apply(this)};mapp.PoiEditor=function(t){this.map=t;this.poi=null;this.sel=null;this.lastIcon=null;var i=this;this.initialize=function(){this.sel=n(this.map.iw.getContent());n(this.map).on("mapp.open",function(n,t){i.render(t)});n(this.map).on("mapp.close",function(){i.mce(!1)});this.sel.on("click","[data-mapp-poi]",function(t){t.preventDefault();var r=n(this).attr("data-mapp-poi");i[r]()});this.sel.on("click",".mapp-poi-visual, .mapp-poi-html",function(){var t=n(this).hasClass("mapp-poi-visual");i.mce(t)});this.sel.on("keydown",function(t){t.which==13&&t.target!=n("#mapp-poi-body")&&(t.preventDefault(),i.save())});this.sel.on("change","[data-mapp-iconpicker]",function(){i.poi.setIcon(n("[data-mapp-iconpicker]").attr("data-mapp-iconid"));i.lastIcon=i.poi.iconid;i.map.renderList()});this.sel.on("change","[data-mapp-colorpicker]",function(){i.poi.setTemplateColors(n("[data-mapp-colorpicker]").attr("data-mapp-color"),n("[data-mapp-colorpicker]").attr("data-mapp-opacity"),n("[data-mapp-colorpicker]").attr("data-mapp-weight"));i.map.renderList()})};this.cancel=function(){this.map.close()};this.initMCE=function(){var n,t,i;typeof tinyMCE!="undefined"&&typeof tinyMCE.init!="undefined"&&(n="en",typeof tinyMCEPreInit!="undefined"&&typeof window.tinyMCEPreInit.mceInit!="undefined"&&typeof window.tinyMCEPreInit.mceInit.content!="undefined"&&(t=window.tinyMCEPreInit.mceInit.content,n=typeof t.language!="undefined"?t.language:"en"),i={mode:"none",height:"75px",convert_urls:!1,language:n,menubar:!1,plugins:"wordpress,paste,wplink,textcolor,image",relative_urls:!1,remove_script_host:!1,statusbar:!1,theme:"modern",toolbar1:"bold,italic,link,unlink,image",toolbar2:"",toolbar3:"",toolbar4:""},tinyMCE.init(i),this.mce(!0))};this.mce=function(t){var r=t?"mceAddEditor":"mceRemoveEditor";typeof tinyMCE!="undefined"&&tinyMCE.execCommand(r,!1,"mapp-poi-body");n(".mapp-poi-visual, .mapp-poi-html",i.sel).removeClass("mapp-active");t?n(".mapp-poi-visual",i.sel).addClass("mapp-active"):n(".mapp-poi-html",i.sel).addClass("mapp-active")};this.remove=function(){confirm(mappl10n.delete_prompt)&&(this.map.close(),this.map.removePoi(this.poi))};this.render=function(t){this.poi=t;n("[data-mapp-iconpicker]").trigger("refresh");n("[data-mapp-colorpicker]").trigger("refresh");this.initMCE()};this.save=function(){typeof tinyMCE!="undefined"&&tinyMCE.get("mapp-poi-body")&&tinyMCE.get("mapp-poi-body").save();this.poi.title=n(".mapp-poi-title").val();this.poi.body=n(".mapp-poi-body").val();this.map.renderList();this.map.close()};this.initialize.apply(this)}}(jQuery)
1
+ var mapp=window.mapp||{};+function(n){mapp.Media=function(){this.editor=null;this.map=null;this.settings=null;this.sel=n(".mapp-media");this.items=null;var t=this;this.initialize=function(){this.find();this.sel.on("change",".mapp-media-list-type",function(){var i=n(".mapp-media-list-type",this.sel).val();n(".mapp-media-search").val("");n(".mapp-media-search").toggle(i=="all");t.find()});this.sel.on("keydown",".mapp-media-search",function(n){if(n.which==13)return!1});this.sel.on("input",".mapp-media-search",function(){t.find()});this.settings={editable:!0,name:"mapp0"};this.sel.on("click","[data-mapp-media]",function(i){i.preventDefault();var r=n(this).attr("data-mapp-media");t[r]()});this.sel.on("click",".mapp-media-list .mapp-item",function(){n(".mapp-media-list .mapp-item",this.sel).removeClass("mapp-active");n(this).addClass("mapp-active")});this.sel.on("click",".mapp-media-list [data-mapp-media]",function(i){i.preventDefault();var r=n(this).attr("data-mapp-media"),u=n(this).closest(".mapp-item"),f=u.attr("data-mapp-mapid");return t[r](f),!1});this.sel.on("change",".mapp-media-viewport",function(){n(this).is(":checked")||(t.map.center=t.map.zoom=null,t.map.recenter())});n(".mapp-media-size").click(function(t){var i=n(this).data("width"),r=n(this).data("height");n(".mapp-media-width").val(i);n(".mapp-media-height").val(r);t.preventDefault()});n("#publish, #post-preview").click(function(){t.save()});n(".mapp-media-title").keydown(function(n){n.which==13&&(n.preventDefault(),t.save())})};this.add=function(){var n=new mapp.Map(this.settings);n.width=mappl10n.options.sizes[mappl10n.options.size].width;n.height=mappl10n.options.sizes[mappl10n.options.size].height;t.open(n)};this.cancel=function(){t.closeEditor()};this.closeEditor=function(){this.editor.close();this.map=null;this.editor=null;n(".mapp-media-edit-panel").hide();n(".mapp-media-list-panel").show()};this.edit=function(n){mapp.Map.ajaxGet(n,this.settings,function(n){t.open(n)})};this.find=function(){var t=this;this.items!==null?this.renderList():(n(".spinner",this.sel).css("visibility","visible"),mapp.lib.ajax({type:"GET",data:{action:"mapp_find"},callback:function(i){i.status=="OK"&&(n(".spinner",this.sel).css("visibility","hidden"),t.items=_.sortBy(i.data,"post_title"),t.renderList())}}))};this.insert=function(n){n=n?n:this.map.mapid;var t='[mappress mapid="'+n+'"]';send_to_editor(t)};this.open=function(t){this.map=t;n(".mapp-edit",this.sel).html(mapp.lib.template("edit-map"));var i=this.map.mapid;i?n(".mapp-media-mapid").text(i):n(".mapp-media-mapid").text("");n(".mapp-media-title").val(this.map.title);n(".mapp-media-width").val(this.map.width);n(".mapp-media-height").val(this.map.height);n(".mapp-media-viewport").prop("checked",!!(this.map.center&&this.map.zoom));n(".mapp-media-edit-panel").show();n(".mapp-media-list-panel").hide();this.editor=new mapp.Editor(this.map)};this.remove=function(n){if(confirm(mappl10n.delete_map_prompt)){var t=_.findIndex(this.items,{mapid:n});t>-1&&(this.items.splice(t,1),mapp.Map.ajaxDelete(n),this.renderList())}};this.renderList=function(){var t=null,i=400,r=null,u=n(".mapp-media-list-type",this.sel).val(),f=n(".mapp-media-search",this.sel).val().toLowerCase();t=u=="all"?_.filter(this.items,function(n){return n.post_title&&n.post_title.toLowerCase().indexOf(f)!=-1||n.map_title&&n.map_title.toLowerCase().indexOf(f)!=-1}):_.filter(this.items,function(n){return n.postid==mappl10n.options.postid});t.length>i?(r=mappl10n.more.replace("%d",i).replace("%d",t.length),t=t.slice(0,i)):r="";n(".mapp-media-list",this.sel).html(mapp.lib.template("media-list",{items:t,type:u,more:r}))};this.save=function(){var t=this;this.map&&(this.map.title=n.trim(n(".mapp-media-title").val()),this.map.width=n(".mapp-media-width").val(),this.map.height=n(".mapp-media-height").val(),n(".mapp-media-viewport").prop("checked")?(this.map.center=this.map.getMap().getCenter().toJSON(),this.map.zoom=this.map.getMap().getZoom()):(this.map.center=null,this.map.zoom=null),this.map.ajaxSave(function(){var i=t.map.mapid?t.map.mapid.toString():null,r=_.findIndex(t.items,function(n){return n.mapid==i});r==-1?t.items.unshift({mapid:i,map_title:t.map.title,postid:mappl10n.options.postid,post_title:n("#title").val()||n("#post-title-0").val()}):t.items[r].map_title=t.map.title;t.renderList();t.closeEditor()}))};this.initialize.apply(this)}}(jQuery);+function(n){mapp.Editor=function(t){this.drawingManager=null;this.map=t;this.poiEditor=null;this.sel=n(".mapp-edit");var i=this;this.initialize=function(){this.map.display();this.poiEditor=new mapp.PoiEditor(this.map);this.initDrawingManager();n(this.map.places).off("search.mapp");n(this.map.places).on("search.mapp",function(n,t){i.insertPoi(t)});this.sel.on("click","[data-mapp-editor]",function(t){t.preventDefault();var r=n(this).attr("data-mapp-editor");i[r]()})};this.close=function(){this.map.close()};this.insertPoi=function(n){var t;if(n)if(this.drawingManager&&this.drawingManager.setDrawingMode(null),this.map.close(),n.geometry){var i=n.formatted_address?n.formatted_address.replace(/, United States of America/i,"").replace(/, United States/i,"").replace(/, USA/i,""):null,r=n.name==i?"":i,t=new mapp.Poi({address:i,body:r,iconid:this.poiEditor.lastIcon,point:n.geometry.location,title:n.name,viewport:n.geometry.viewport?n.geometry.viewport:null});this.map.insertPoi(t);t.center()}else n.overlay&&(t=new mapp.Poi({body:"",iconid:n.type=="marker"?null:"poly",overlay:n.overlay,title:n.type=="marker"?n.overlay.getPosition().toUrlValue(6):mappl10n.shape,type:n.type=="marker"?null:n.type}),this.map.insertPoi(t))};this.initDrawingManager=function(){};this.layer=function(){var n=window.prompt(mappl10n.layer);n&&i.insertPoi(n)};this.initialize.apply(this)};mapp.PoiEditor=function(t){this.map=t;this.poi=null;this.sel=null;this.lastIcon=null;var i=this;this.initialize=function(){this.sel=n(this.map.iw.getContent());n(this.map).on("mapp.open",function(n,t){i.render(t)});n(this.map).on("mapp.close",function(){i.mce(!1)});this.sel.on("click","[data-mapp-poi]",function(t){t.preventDefault();var r=n(this).attr("data-mapp-poi");i[r]()});this.sel.on("click",".mapp-poi-visual, .mapp-poi-html",function(){var t=n(this).hasClass("mapp-poi-visual");i.mce(t)});this.sel.on("keydown",function(t){t.which==13&&t.target!=n("#mapp-poi-body")&&(t.preventDefault(),i.save())});this.sel.on("change","[data-mapp-iconpicker]",function(){i.poi.setIcon(n("[data-mapp-iconpicker]").attr("data-mapp-iconid"));i.lastIcon=i.poi.iconid;i.map.renderList()});this.sel.on("change","[data-mapp-colorpicker]",function(){i.poi.setTemplateColors(n("[data-mapp-colorpicker]").attr("data-mapp-color"),n("[data-mapp-colorpicker]").attr("data-mapp-opacity"),n("[data-mapp-colorpicker]").attr("data-mapp-weight"));i.map.renderList()})};this.cancel=function(){this.map.close()};this.initMCE=function(){var n,t,i;typeof tinyMCE!="undefined"&&typeof tinyMCE.init!="undefined"&&(n="en",typeof tinyMCEPreInit!="undefined"&&typeof window.tinyMCEPreInit.mceInit!="undefined"&&typeof window.tinyMCEPreInit.mceInit.content!="undefined"&&(t=window.tinyMCEPreInit.mceInit.content,n=typeof t.language!="undefined"?t.language:"en"),i={mode:"none",height:"75px",convert_urls:!1,language:n,menubar:!1,plugins:"wordpress,paste,wplink,textcolor,image",relative_urls:!1,remove_script_host:!1,statusbar:!1,theme:"modern",toolbar1:"bold,italic,link,unlink,image",toolbar2:"",toolbar3:"",toolbar4:""},tinyMCE.init(i),this.mce(!0))};this.mce=function(t){var r=t?"mceAddEditor":"mceRemoveEditor";typeof tinyMCE!="undefined"&&tinyMCE.execCommand(r,!1,"mapp-poi-body");n(".mapp-poi-visual, .mapp-poi-html",i.sel).removeClass("mapp-active");t?n(".mapp-poi-visual",i.sel).addClass("mapp-active"):n(".mapp-poi-html",i.sel).addClass("mapp-active")};this.remove=function(){confirm(mappl10n.delete_prompt)&&(this.map.close(),this.map.removePoi(this.poi))};this.render=function(t){this.poi=t;n("[data-mapp-iconpicker]").trigger("refresh");n("[data-mapp-colorpicker]").trigger("refresh");this.initMCE()};this.save=function(){typeof tinyMCE!="undefined"&&tinyMCE.get("mapp-poi-body")&&tinyMCE.get("mapp-poi-body").save();this.poi.title=n(".mapp-poi-title").val();this.poi.body=n(".mapp-poi-body").val();mappl10n.options.engine!="leaflet"&&this.poi.overlay.setTitle(this.poi.title);this.map.renderList();this.map.close()};this.initialize.apply(this)}}(jQuery)
languages/mappress-google-maps-for-wordpress.pot CHANGED
@@ -1,245 +1,243 @@
1
- # Copyright (C) 2018 MapPress Maps for WordPress
2
  # This file is distributed under the same license as the MapPress Maps for WordPress package.
3
  msgid ""
4
  msgstr ""
5
- "Project-Id-Version: MapPress Maps for WordPress 2.50.10\n"
6
  "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/mappress-google-maps-for-wordpress\n"
7
- "POT-Creation-Date: 2018-11-06 18:26:12+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=UTF-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
11
- "PO-Revision-Date: 2018-MO-DA HO:MI+ZONE\n"
12
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
13
  "Language-Team: LANGUAGE <LL@li.org>\n"
14
 
15
- #: forms/map_editor.php:11
16
  msgid "Add KML"
17
  msgstr ""
18
 
19
- #: forms/map_editor.php:47
20
  msgid "Visual"
21
  msgstr ""
22
 
23
- #: forms/map_editor.php:47
24
  msgid "HTML"
25
  msgstr ""
26
 
27
- #: forms/map_editor.php:53 forms/map_media.php:48 forms/template_editor.php:41
28
  msgid "Save"
29
  msgstr ""
30
 
31
- #: forms/map_editor.php:54 forms/map_media.php:49 forms/template_editor.php:42
32
  msgid "Cancel"
33
  msgstr ""
34
 
35
- #: forms/map_editor.php:55 forms/map_media.php:71 forms/template_editor.php:44
36
  #: mappress_controls.php:102
37
  msgid "Delete"
38
  msgstr ""
39
 
40
- #: forms/map_media.php:7
41
  msgid "New Map"
42
  msgstr ""
43
 
44
- #: forms/map_media.php:9
45
  msgid "This post"
46
  msgstr ""
47
 
48
- #: forms/map_media.php:10 pro/mappress_widget.php:84
49
  msgid "All posts"
50
  msgstr ""
51
 
52
- #: forms/map_media.php:12
53
- msgid "Search post title"
54
  msgstr ""
55
 
56
- #: forms/map_media.php:20
57
  msgid "Map ID"
58
  msgstr ""
59
 
60
- #: forms/map_media.php:25
61
  msgid "Map Title"
62
  msgstr ""
63
 
64
- #: forms/map_media.php:26 forms/map_media.php:62 forms/map_media.php:66
65
- #: mappress.php:631
66
  msgid "Untitled"
67
  msgstr ""
68
 
69
- #: forms/map_media.php:30
70
  msgid "Display Size"
71
  msgstr ""
72
 
73
- #: forms/map_media.php:43
74
  msgid "Save center / zoom"
75
  msgstr ""
76
 
77
- #: forms/map_media.php:50 forms/map_media.php:70
78
  msgid "Insert into post"
79
  msgstr ""
80
 
81
- #: forms/map_media.php:69 forms/template_editor.php:4
82
- #: forms/template_editor.php:18
83
  msgid "Edit"
84
  msgstr ""
85
 
86
- #: forms/map_media.php:78
87
  msgid "No maps found"
88
  msgstr ""
89
 
90
- #: forms/map_media.php:81
91
- msgid "Load More"
92
- msgstr ""
93
-
94
- #: forms/template_editor.php:24
95
  msgid "New"
96
  msgstr ""
97
 
98
- #: forms/template_editor.php:24
99
  msgid "Custom"
100
  msgstr ""
101
 
102
- #: forms/template_editor.php:27
103
  msgid "Editor"
104
  msgstr ""
105
 
106
- #: forms/template_editor.php:28 mappress_settings.php:182
107
  msgid "Default"
108
  msgstr ""
109
 
110
  #: mappress.php:153
111
- msgid "Settings"
112
- msgstr ""
113
-
114
- #: mappress.php:159
115
- msgid "Version"
116
  msgstr ""
117
 
118
- #: mappress.php:167
119
- msgid "Documentation"
120
  msgstr ""
121
 
122
- #: mappress.php:168
123
- msgid "Support"
124
  msgstr ""
125
 
126
- #: mappress.php:170
127
- msgid "Upgrade to MapPress Pro"
128
  msgstr ""
129
 
130
- #: mappress.php:453
131
- msgid "MapPress database tables are missing. Please deactivate the plugin and activate it again to fix this."
132
  msgstr ""
133
 
134
- #: mappress.php:458
135
- msgid "WARNING: MapPress is not compatible with the WP-Geo plugin. Please deactivate or uninstall WP-Geo before using MapPress."
136
  msgstr ""
137
 
138
- #: mappress.php:463
139
- msgid "A Google Maps API key is required"
140
  msgstr ""
141
 
142
- #: mappress.php:463
143
- msgid "Please update your"
144
  msgstr ""
145
 
146
- #: mappress.php:463
147
- msgid "MapPress Settings"
148
  msgstr ""
149
 
150
- #: mappress.php:621
151
  msgid "Are you sure you want to delete?"
152
  msgstr ""
153
 
154
- #: mappress.php:622
155
  msgid "Delete this map?"
156
  msgstr ""
157
 
158
- #: mappress.php:623
159
  msgid "Google cannot return directions between those addresses. There is no route between them or the routing information is not available."
160
  msgstr ""
161
 
162
- #: mappress.php:624
163
  msgid "Error reading KML file"
164
  msgstr ""
165
 
166
- #: mappress.php:625
167
  msgid "URL for KML file"
168
  msgstr ""
169
 
170
- #: mappress.php:626
171
  msgid "Loading"
172
  msgstr ""
173
 
174
- #: mappress.php:627
 
 
 
 
175
  msgid "Unable to get your location"
176
  msgstr ""
177
 
178
- #: mappress.php:628
179
  msgid "No results"
180
  msgstr ""
181
 
182
- #: mappress.php:629
183
  msgid "Save changes?"
184
  msgstr ""
185
 
186
- #: mappress.php:630
187
  msgid "Shape"
188
  msgstr ""
189
 
190
- #: mappress.php:655
191
  msgid "Improve this map"
192
  msgstr ""
193
 
194
- #: mappress.php:671 mappress.php:689
195
  msgid "Streets"
196
  msgstr ""
197
 
198
- #: mappress.php:672
199
  msgid "Outdoors"
200
  msgstr ""
201
 
202
- #: mappress.php:673
203
  msgid "Light"
204
  msgstr ""
205
 
206
- #: mappress.php:674
207
  msgid "Dark"
208
  msgstr ""
209
 
210
- #: mappress.php:675
211
  msgid "Satellite"
212
  msgstr ""
213
 
214
- #: mappress.php:676
215
  msgid "Satellite Streets"
216
  msgstr ""
217
 
 
 
 
 
218
  #: mappress_controls.php:93
219
  msgid "Add"
220
  msgstr ""
221
 
222
- #: mappress_map.php:92 mappress_settings.php:306
223
  msgid "MapPress"
224
  msgstr ""
225
 
226
- #: mappress_map.php:183
227
  msgid "Map not found"
228
  msgstr ""
229
 
230
- #: mappress_map.php:441 pro/mappress_pro_settings.php:33
231
  msgid "Filter"
232
  msgstr ""
233
 
234
- #: mappress_map.php:474
235
  msgid "Show map"
236
  msgstr ""
237
 
238
- #: mappress_map.php:478
239
  msgid "Map"
240
  msgstr ""
241
 
242
- #: mappress_map.php:479
243
  msgid "List"
244
  msgstr ""
245
 
1
+ # Copyright (C) 2019 MapPress Maps for WordPress
2
  # This file is distributed under the same license as the MapPress Maps for WordPress package.
3
  msgid ""
4
  msgstr ""
5
+ "Project-Id-Version: MapPress Maps for WordPress 2.52\n"
6
  "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/mappress-google-maps-for-wordpress\n"
7
+ "POT-Creation-Date: 2019-02-04 19:26:27+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=UTF-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
11
+ "PO-Revision-Date: 2019-MO-DA HO:MI+ZONE\n"
12
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
13
  "Language-Team: LANGUAGE <LL@li.org>\n"
14
 
15
+ #: forms/editor.php:11
16
  msgid "Add KML"
17
  msgstr ""
18
 
19
+ #: forms/editor.php:47
20
  msgid "Visual"
21
  msgstr ""
22
 
23
+ #: forms/editor.php:47
24
  msgid "HTML"
25
  msgstr ""
26
 
27
+ #: forms/editor.php:53 forms/media.php:49 forms/settings.php:41
28
  msgid "Save"
29
  msgstr ""
30
 
31
+ #: forms/editor.php:54 forms/media.php:50 forms/settings.php:42
32
  msgid "Cancel"
33
  msgstr ""
34
 
35
+ #: forms/editor.php:55 forms/media.php:72 forms/settings.php:44
36
  #: mappress_controls.php:102
37
  msgid "Delete"
38
  msgstr ""
39
 
40
+ #: forms/media.php:7
41
  msgid "New Map"
42
  msgstr ""
43
 
44
+ #: forms/media.php:9
45
  msgid "This post"
46
  msgstr ""
47
 
48
+ #: forms/media.php:10 pro/mappress_widget.php:84
49
  msgid "All posts"
50
  msgstr ""
51
 
52
+ #: forms/media.php:12
53
+ msgid "Filter by title"
54
  msgstr ""
55
 
56
+ #: forms/media.php:21
57
  msgid "Map ID"
58
  msgstr ""
59
 
60
+ #: forms/media.php:26
61
  msgid "Map Title"
62
  msgstr ""
63
 
64
+ #: forms/media.php:27 forms/media.php:63 forms/media.php:67 mappress.php:414
 
65
  msgid "Untitled"
66
  msgstr ""
67
 
68
+ #: forms/media.php:31
69
  msgid "Display Size"
70
  msgstr ""
71
 
72
+ #: forms/media.php:44
73
  msgid "Save center / zoom"
74
  msgstr ""
75
 
76
+ #: forms/media.php:51 forms/media.php:71
77
  msgid "Insert into post"
78
  msgstr ""
79
 
80
+ #: forms/media.php:70 forms/settings.php:4 forms/settings.php:18
 
81
  msgid "Edit"
82
  msgstr ""
83
 
84
+ #: forms/media.php:79
85
  msgid "No maps found"
86
  msgstr ""
87
 
88
+ #: forms/settings.php:24
 
 
 
 
89
  msgid "New"
90
  msgstr ""
91
 
92
+ #: forms/settings.php:24
93
  msgid "Custom"
94
  msgstr ""
95
 
96
+ #: forms/settings.php:27
97
  msgid "Editor"
98
  msgstr ""
99
 
100
+ #: forms/settings.php:28 mappress_settings.php:182
101
  msgid "Default"
102
  msgstr ""
103
 
104
  #: mappress.php:153
105
+ msgid "MapPress database tables are missing. Please deactivate the plugin and activate it again to fix this."
 
 
 
 
106
  msgstr ""
107
 
108
+ #: mappress.php:158
109
+ msgid "WARNING: MapPress is not compatible with the WP-Geo plugin. Please deactivate or uninstall WP-Geo before using MapPress."
110
  msgstr ""
111
 
112
+ #: mappress.php:163
113
+ msgid "A Google Maps API key is required"
114
  msgstr ""
115
 
116
+ #: mappress.php:163
117
+ msgid "Please update your"
118
  msgstr ""
119
 
120
+ #: mappress.php:163
121
+ msgid "MapPress Settings"
122
  msgstr ""
123
 
124
+ #: mappress.php:315 mappress.php:770
125
+ msgid "Version"
126
  msgstr ""
127
 
128
+ #: mappress.php:316
129
+ msgid "Documentation"
130
  msgstr ""
131
 
132
+ #: mappress.php:317
133
+ msgid "Support"
134
  msgstr ""
135
 
136
+ #: mappress.php:319
137
+ msgid "Upgrade to MapPress Pro"
138
  msgstr ""
139
 
140
+ #: mappress.php:403
141
  msgid "Are you sure you want to delete?"
142
  msgstr ""
143
 
144
+ #: mappress.php:404
145
  msgid "Delete this map?"
146
  msgstr ""
147
 
148
+ #: mappress.php:405
149
  msgid "Google cannot return directions between those addresses. There is no route between them or the routing information is not available."
150
  msgstr ""
151
 
152
+ #: mappress.php:406
153
  msgid "Error reading KML file"
154
  msgstr ""
155
 
156
+ #: mappress.php:407
157
  msgid "URL for KML file"
158
  msgstr ""
159
 
160
+ #: mappress.php:408
161
  msgid "Loading"
162
  msgstr ""
163
 
164
+ #: mappress.php:409
165
+ msgid "%d of %d shown"
166
+ msgstr ""
167
+
168
+ #: mappress.php:410
169
  msgid "Unable to get your location"
170
  msgstr ""
171
 
172
+ #: mappress.php:411
173
  msgid "No results"
174
  msgstr ""
175
 
176
+ #: mappress.php:412
177
  msgid "Save changes?"
178
  msgstr ""
179
 
180
+ #: mappress.php:413
181
  msgid "Shape"
182
  msgstr ""
183
 
184
+ #: mappress.php:438
185
  msgid "Improve this map"
186
  msgstr ""
187
 
188
+ #: mappress.php:454 mappress.php:472
189
  msgid "Streets"
190
  msgstr ""
191
 
192
+ #: mappress.php:455
193
  msgid "Outdoors"
194
  msgstr ""
195
 
196
+ #: mappress.php:456
197
  msgid "Light"
198
  msgstr ""
199
 
200
+ #: mappress.php:457
201
  msgid "Dark"
202
  msgstr ""
203
 
204
+ #: mappress.php:458
205
  msgid "Satellite"
206
  msgstr ""
207
 
208
+ #: mappress.php:459
209
  msgid "Satellite Streets"
210
  msgstr ""
211
 
212
+ #: mappress.php:546
213
+ msgid "Settings"
214
+ msgstr ""
215
+
216
  #: mappress_controls.php:93
217
  msgid "Add"
218
  msgstr ""
219
 
220
+ #: mappress_map.php:91 mappress_settings.php:306
221
  msgid "MapPress"
222
  msgstr ""
223
 
224
+ #: mappress_map.php:163
225
  msgid "Map not found"
226
  msgstr ""
227
 
228
+ #: mappress_map.php:420 pro/mappress_pro_settings.php:33
229
  msgid "Filter"
230
  msgstr ""
231
 
232
+ #: mappress_map.php:453
233
  msgid "Show map"
234
  msgstr ""
235
 
236
+ #: mappress_map.php:457
237
  msgid "Map"
238
  msgstr ""
239
 
240
+ #: mappress_map.php:458
241
  msgid "List"
242
  msgstr ""
243
 
languages/texts.php CHANGED
@@ -8,7 +8,7 @@ __("Delete");
8
  __("New Map");
9
  __("This post");
10
  __("All posts");
11
- __("Search post title");
12
  __("Map ID");
13
  __("Map Title");
14
  __("Untitled");
@@ -17,27 +17,26 @@ __("Save center / zoom");
17
  __("Insert into post");
18
  __("Edit");
19
  __("No maps found");
20
- __("Load More");
21
  __("New");
22
  __("Custom");
23
  __("Editor");
24
  __("Default");
25
- __("Settings");
26
- __("Version");
27
- __("Documentation");
28
- __("Support");
29
- __("Upgrade to MapPress Pro");
30
  __("MapPress database tables are missing. Please deactivate the plugin and activate it again to fix this.");
31
  __("WARNING: MapPress is not compatible with the WP-Geo plugin. Please deactivate or uninstall WP-Geo before using MapPress.");
32
  __("A Google Maps API key is required");
33
  __("Please update your");
34
  __("MapPress Settings");
 
 
 
 
35
  __("Are you sure you want to delete?");
36
  __("Delete this map?");
37
  __("Google cannot return directions between those addresses. There is no route between them or the routing information is not available.");
38
  __("Error reading KML file");
39
  __("URL for KML file");
40
  __("Loading");
 
41
  __("Unable to get your location");
42
  __("No results");
43
  __("Save changes?");
@@ -49,6 +48,7 @@ __("Light");
49
  __("Dark");
50
  __("Satellite");
51
  __("Satellite Streets");
 
52
  __("Add");
53
  __("MapPress");
54
  __("Map not found");
8
  __("New Map");
9
  __("This post");
10
  __("All posts");
11
+ __("Filter by title");
12
  __("Map ID");
13
  __("Map Title");
14
  __("Untitled");
17
  __("Insert into post");
18
  __("Edit");
19
  __("No maps found");
 
20
  __("New");
21
  __("Custom");
22
  __("Editor");
23
  __("Default");
 
 
 
 
 
24
  __("MapPress database tables are missing. Please deactivate the plugin and activate it again to fix this.");
25
  __("WARNING: MapPress is not compatible with the WP-Geo plugin. Please deactivate or uninstall WP-Geo before using MapPress.");
26
  __("A Google Maps API key is required");
27
  __("Please update your");
28
  __("MapPress Settings");
29
+ __("Version");
30
+ __("Documentation");
31
+ __("Support");
32
+ __("Upgrade to MapPress Pro");
33
  __("Are you sure you want to delete?");
34
  __("Delete this map?");
35
  __("Google cannot return directions between those addresses. There is no route between them or the routing information is not available.");
36
  __("Error reading KML file");
37
  __("URL for KML file");
38
  __("Loading");
39
+ __("%d of %d shown");
40
  __("Unable to get your location");
41
  __("No results");
42
  __("Save changes?");
48
  __("Dark");
49
  __("Satellite");
50
  __("Satellite Streets");
51
+ __("Settings");
52
  __("Add");
53
  __("MapPress");
54
  __("Map not found");
mappress.php CHANGED
@@ -4,7 +4,7 @@ Plugin Name: MapPress Maps for WordPress
4
  Plugin URI: https://www.mappresspro.com/mappress
5
  Author URI: https://www.mappresspro.com/chris-contact
6
  Description: MapPress makes it easy to add Google and Leaflet Maps to WordPress
7
- Version: 2.50.10
8
  Author: Chris Richardson
9
  Text Domain: mappress-google-maps-for-wordpress
10
  Thanks to all the translators and to Matthias Stasiak for his wonderful icons (http://code.google.com/p/google-maps-icons/)
@@ -35,7 +35,7 @@ if (is_dir(dirname( __FILE__ ) . '/pro')) {
35
  }
36
 
37
  class Mappress {
38
- const VERSION = '2.50.10';
39
 
40
  static
41
  $baseurl,
@@ -43,11 +43,11 @@ class Mappress {
43
  $basedir,
44
  $debug,
45
  $loaded,
46
- $notices,
47
  $options,
48
  $pages,
49
  $pro,
50
- $updater
 
51
  ;
52
 
53
  function __construct() {
@@ -56,6 +56,9 @@ class Mappress {
56
  self::$baseurl = plugins_url('', __FILE__);
57
  self::$options = Mappress_Options::get();
58
  self::$pro = is_dir(dirname( __FILE__ ) . '/pro');
 
 
 
59
  self::debugging();
60
 
61
  // Pro updater
@@ -101,27 +104,111 @@ class Mappress {
101
  add_filter( 'heartbeat_settings', array(__CLASS__, 'heartbeat_settings'));
102
  }
103
 
104
- static function deregister() {
105
- if (self::$loaded) {
106
- $wps = wp_scripts();
107
- foreach($wps->registered as $registered) {
108
- if (stripos($registered->src, 'maps.googleapis.com') !== false && stripos($registered->handle, 'mappress') === false) {
109
- $registered->src = self::$baseurl . '/forms/dummy.js';
110
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
111
  }
112
  }
113
  }
114
 
115
- static function heartbeat_settings( $settings ) {
116
- $settings['minimalInterval'] = 600;
117
- return $settings;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
118
  }
119
 
120
  static function debugging() {
121
  global $wpdb;
122
 
123
  if (isset($_GET['mp_info'])) {
124
- echo "<b>Plugin version</b> " . self::get_version_string();
125
  $posts_table = $wpdb->prefix . 'mappress_posts';
126
  $results = $wpdb->get_results("SELECT postid, mapid FROM $posts_table");
127
  echo "<br/>postid => mapid";
@@ -149,152 +236,45 @@ class Mappress {
149
  }
150
  }
151
 
152
- static function plugin_action_links($links, $file) {
153
- $settings_link = "<a href='" . admin_url("admin.php?page=mappress") . "'>" . __('Settings', 'mappress-google-maps-for-wordpress') . "</a>";
154
- array_unshift( $links, $settings_link );
155
- return $links;
156
- }
157
-
158
- static function get_version_string() {
159
- $version = __('Version', 'mappress-google-maps-for-wordpress') . ":" . self::VERSION;
160
- if (self::$pro)
161
- $version .= " PRO";
162
- return $version;
163
- }
164
-
165
- static function get_support_links($title = 'MapPress') {
166
- $html = "<div class='mapp-support'>" . self::get_version_string();
167
- $html .= " | <a target='_blank' href='https://mappresspro.com/mappress/mappress-documentation'>" . __('Documentation', 'mappress-google-maps-for-wordpress') . "</a>";
168
- $html .= " | <a target='_blank' href='https://mappresspro.com/chris-contact'>" . __('Support', 'mappress-google-maps-for-wordpress') . "</a>";
169
- if (!self::$pro)
170
- $html .= "<a class='button button-primary' href='https://mappresspro.com/mappress' target='_blank'>" . __('Upgrade to MapPress Pro', 'mappress-google-maps-for-wordpress') . "</a>";
171
- $html .= "</div>";
172
- echo $html;
173
- }
174
-
175
- static function ajax_response($status, $data=null, $gzip = false) {
176
- $output = trim(ob_get_clean()); // Ignore whitespace, any other output is an error
177
- header( "Content-Type: application/json" );
178
-
179
- if ($gzip && (!ini_get('zlib.output_compression')) && (!in_array('ob_gzhandler', ob_list_handlers())) && function_exists('ob_gzhandler'))
180
- ob_start('ob_gzhandler');
181
- else
182
- ob_start();
183
-
184
- $response = json_encode(array('status' => $status, 'output' => $output, 'data' => $data));
185
- die ($response);
186
  }
187
 
188
- static function admin_menu() {
189
- // Settings
190
- $settings = (self::$pro) ? new Mappress_Pro_Settings() : new Mappress_Settings();
191
- self::$pages[] = add_menu_page('MapPress', 'MapPress', 'manage_options', 'mappress', array(&$settings, 'options_page'), 'dashicons-location');
 
 
 
 
 
192
  }
193
 
194
  /**
195
- * Automatic map display.
196
- * If set, the [mappress] shortcode will be prepended/appended to the post body, once for each map
197
- * The shortcode is used so it can be filtered - for example WordPress will remove it in excerpts by default.
198
  *
199
- * @param mixed $content
200
  */
201
- static function the_content($content="") {
202
- global $post;
203
- global $wp_current_filter;
204
-
205
- $autodisplay = self::$options->autodisplay;
206
-
207
- // No auto display
208
- if (!$autodisplay || $autodisplay == 'none')
209
- return $content;
210
-
211
- // Check if in the loop, to prevent conflicts with JetPack - see http://wordpress.org/support/topic/easy-adsense-lite-and-jetpack
212
- if (!in_the_loop())
213
- return $content;
214
-
215
- // Don't add the shortcode for feeds or admin screens
216
- if (is_feed() || self::is_admin())
217
- return $content;
218
-
219
- // No shortcode if post is password protected
220
- if (post_password_required())
221
- return $content;
222
-
223
- // If this is an excerpt don't attempt to add the map to it
224
- if (in_array('get_the_excerpt', $wp_current_filter))
225
- return $content;
226
-
227
- // Don't auto display if the post already contains a MapPress shortcode
228
- if (stristr($content, '[mappress') !== false || stristr($content, '[mashup') !== false)
229
- return $content;
230
-
231
- // Get maps associated with post
232
- $mapids = Mappress_Map::get_list($post->ID, 'ids');
233
- if (empty($mapids))
234
- return $content;
235
 
236
- // Add the shortcode once for each map
237
- $shortcodes = "";
238
- foreach($mapids as $mapid)
239
- $shortcodes .= '<p>[mappress mapid="' . $mapid . '"]</p>';
240
 
241
- if ($autodisplay == 'top')
242
- return $shortcodes . $content;
243
  else
244
- return $content . $shortcodes;
245
- }
246
-
247
- /**
248
- * Map a shortcode in a post.
249
- *
250
- * @param mixed $atts - shortcode attributes
251
- */
252
- static function shortcode_map($atts='') {
253
- global $post;
254
-
255
- // No feeds
256
- if (is_feed())
257
- return;
258
-
259
- // Try to protect against calls to do_shortcode() in the post editor...
260
- if (self::is_admin())
261
- return;
262
-
263
- $atts = self::scrub_atts($atts);
264
-
265
- // Determine what to show
266
- $mapid = (isset($atts['mapid'])) ? $atts['mapid'] : null;
267
-
268
- if ($mapid) {
269
- // Show map by mapid
270
- $map = Mappress_Map::get($mapid);
271
- } else {
272
- // Get the first map attached to the post
273
- $maps = Mappress_Map::get_list($post->ID);
274
- $map = (isset ($maps[0]) ? $maps[0] : false);
275
- }
276
-
277
- if (!$map)
278
- return;
279
-
280
- return $map->display($atts);
281
- }
282
-
283
- /**
284
- * Process the mashup shortcode
285
- *
286
- */
287
- static function shortcode_mashup($atts='') {
288
- // No feeds
289
- if (is_feed())
290
- return;
291
-
292
- // Prevent do_shortcode() in the post editor, but allow for AJAX calls from other plugins (which run as admin)
293
- if (self::is_admin())
294
- return;
295
 
296
- $atts = self::scrub_atts($atts);
297
- return self::get_mashup($atts);
298
  }
299
 
300
  /**
@@ -331,73 +311,21 @@ class Mappress {
331
  return $mashup->display();
332
  }
333
 
334
- static function wp_head() {
335
- echo "\r\n<!-- MapPress Easy Google Maps " . self::get_version_string() . " (http://www.mappresspro.com/mappress) -->\r\n";
336
- echo "<script type='text/javascript'>mapp = window.mapp || {}; mapp.data = [];</script>\r\n";
337
- }
338
-
339
- /**
340
- * Scripts & styles for frontend
341
- * CSS is loaded from: child theme, theme, or plugin directory
342
- */
343
- static function wp_enqueue_scripts() {
344
- // Leaflet CSS
345
- if (self::$options->engine == 'leaflet')
346
- wp_enqueue_style('mappress-leaflet', self::$baseurl . '/css/leaflet/leaflet.css', null, '1.3.1');
347
-
348
- // Mappress CSS from plugin directory
349
- wp_enqueue_style('mappress', self::$baseurl . '/css/mappress.css', null, self::VERSION);
350
-
351
- // Mappress CSS from theme directory
352
- if ( @file_exists( get_stylesheet_directory() . '/mappress.css' ) )
353
- $file = get_stylesheet_directory_uri() . '/mappress.css';
354
- elseif ( @file_exists( get_template_directory() . '/mappress.css' ) )
355
- $file = get_template_directory_uri() . '/mappress.css';
356
-
357
- if (isset($file))
358
- wp_enqueue_style('mappress-custom', $file, array('mappress'), self::VERSION);
359
-
360
- // Load scripts in header
361
- if (!self::footer())
362
- self::load();
363
- }
364
-
365
- // Scripts & styles for admin
366
- // CSS is always loaded from the plugin directory
367
- static function admin_enqueue_scripts($hook) {
368
- // Some plugins call this without setting $hook
369
- if (empty($hook))
370
- return;
371
-
372
- // Network admin has no pages
373
- if (empty(self::$pages))
374
- return;
375
-
376
- $editing = in_array($hook, array('edit.php', 'post.php', 'post-new.php'));
377
-
378
- // Settings scripts
379
- if ($hook == self::$pages[0]) {
380
- self::load('settings');
381
- if (function_exists('wp_enqueue_code_editor'))
382
- wp_enqueue_code_editor(array( 'type' => 'php' ));
383
- }
384
-
385
- // Leaflet CSS
386
- if (self::$options->engine == 'leaflet')
387
- wp_enqueue_style('mappress-leaflet', self::$baseurl . "/css/leaflet/leaflet.css", null, '1.3.1');
388
-
389
- // Mappress CSS
390
- if (in_array($hook, self::$pages) || $editing) {
391
- wp_enqueue_style('mappress', self::$baseurl . '/css/mappress.css', null, self::VERSION);
392
- wp_enqueue_style('mappress-admin', self::$baseurl . '/css/mappress_admin.css', null, self::VERSION);
393
- }
394
  }
395
 
396
- static function plugins_loaded() {
397
- load_plugin_textdomain('mappress-google-maps-for-wordpress', false, dirname(self::$basename) . '/languages');
 
398
  }
399
 
400
-
401
  /**
402
  * There are several WP bugs that prevent correct activation in multisitie:
403
  * http://core.trac.wordpress.org/ticket/14170
@@ -440,178 +368,32 @@ class Mappress {
440
  update_option('mappress_version', self::VERSION);
441
  }
442
 
443
- // Sanity checks via notices
444
- static function admin_notices() {
445
- global $wpdb;
446
- $notices = array();
447
-
448
- $error = "<div class='notice error'><p>%s</p></div>";
449
- $map_table = $wpdb->prefix . "mappress_maps";
450
- $exists = $wpdb->get_var("show tables like '$map_table'");
451
-
452
- if (!$exists) {
453
- printf($error, __("MapPress database tables are missing. Please deactivate the plugin and activate it again to fix this.", 'mappress-google-maps-for-wordpress'));
454
- return;
455
- }
456
-
457
- if (class_exists('WPGeo')) {
458
- printf($error, __("WARNING: MapPress is not compatible with the WP-Geo plugin. Please deactivate or uninstall WP-Geo before using MapPress.", 'mappress-google-maps-for-wordpress'));
459
- return;
460
- }
461
-
462
- if (self::$options->engine != 'leaflet' && !self::get_api_keys()->browser)
463
- printf($error, sprintf("%s. %s <a href='%s'>%s</a>.", __("A Google Maps API key is required", 'mappress-google-maps-for-wordpress'), __("Please update your", 'mappress-google-maps-for-wordpress'), admin_url('admin.php?page=mappress'), __('MapPress Settings', 'mappress-google-maps-for-wordpress')));
464
-
465
- // Print notices
466
- if (is_super_admin()) {
467
- $dismissed = get_user_meta(get_current_user_id(), 'mappress-notices', true);
468
- $dismissed = (is_array($dismissed)) ? $dismissed : array();
469
- $notices = array_diff_key($notices, $dismissed);
470
- foreach($notices as $key => $msg)
471
- echo "<div class='notice error is-dismissible' data-mapp-dismiss='$key'><p>$msg</p></div>";
472
-
473
- if ($notices) {
474
- echo Mappress::script("jQuery('[data-mapp-dismiss]').on('click', '.notice-dismiss', function(e) {
475
- jQuery.post(ajaxurl, { action : 'mapp_dismiss', key : jQuery(this).closest('.notice').attr('data-mapp-dismiss') });
476
- });");
477
- }
478
- }
479
- }
480
-
481
- static function ajax_dismiss() {
482
- $key = (isset($_POST['key'])) ? $_POST['key'] : null;
483
- if ($key) {
484
- $user_id = get_current_user_id();
485
- $dismissed = get_user_meta($user_id, 'mappress-notices', true);
486
- $dismissed = (is_array($dismissed)) ? $dismissed : array();
487
- $dismissed[$key] = true;
488
- update_user_meta($user_id, 'mappress-notices', $dismissed);
489
- }
490
- }
491
-
492
- /**
493
- * Scrub attributes
494
- * The WordPress shortcode API passes shortcode attributes in lowercase and with boolean values as strings (e.g. "true")
495
- * Converts atts to lowercase, replaces boolean strings with booleans, and creates arrays from comma-separated attributes
496
- *
497
- * Returns empty array if $atts is empty or not an array
498
- */
499
- static function scrub_atts($atts=null) {
500
- if (!$atts || !is_array($atts))
501
- return array();
502
-
503
- $atts = self::string_to_boolean($atts);
504
-
505
- // Shortcode attributes are lowercase so convert everything to lowercase
506
- $atts = array_change_key_case($atts);
507
-
508
- // Map options - includes both leaflet and Google
509
- foreach(array('disableDefaultUI', 'disableDoubleClickZoom', 'draggable', 'fullscreenControl', 'keyboardShortcuts', 'mapTypeControl', 'maxZoom', 'minZoom', 'panControl', 'rotateControl', 'scaleControl', 'scrollwheel', 'scrollWheelZoom', 'streetViewControl', 'zoomControl') as $opt) {
510
- $lcopt = strtolower($opt);
511
- if (isset($atts[$lcopt])) {
512
- $atts['mapopts'][$opt] = $atts[$lcopt];
513
- unset($atts[$lcopt]);
514
- }
515
- }
516
-
517
- // Explode layers
518
- if (isset($atts['layers'])) {
519
- $atts['layers'] = explode(',', $atts['layers']);
520
- foreach($atts['layers'] as &$layer)
521
- $layer = trim($layer);
522
- }
523
-
524
- // Search = 'post', replace with post's location
525
- if (isset($atts['search']) && $atts['search'] == 'post') {
526
- global $post;
527
- $maps = Mappress_Map::get_list($post->ID, 'ids');
528
- $map = ($maps) ? Mappress_Map::get($maps[0]) : null;
529
- $atts['center'] = ($map && $map->pois) ? $map->pois[0]->point['lat'] . ',' . $map->pois[0]->point['lng'] : null;
530
- }
531
-
532
- return $atts;
533
- }
534
-
535
- static function string_to_boolean($data) {
536
- if ($data === 'false')
537
- return false;
538
-
539
- if ($data === 'true')
540
- return true;
541
-
542
- if (is_array($data)) {
543
- foreach($data as &$datum)
544
- $datum = self::string_to_boolean($datum);
545
- }
546
-
547
- return $data;
548
  }
549
 
550
- static function load($type = null) {
551
- if (self::$loaded)
552
- return;
 
 
553
  else
554
- self::$loaded = true;
555
-
556
- $dev = self::dev();
557
- $version = (self::$pro) ? self::VERSION . 'PRO' : self::VERSION;
558
- $footer = self::footer();
559
-
560
- // Directories
561
- $min = ($dev) ? "" : ".min";
562
- $js = ($dev) ? "http://localhost/$dev/wp-content/plugins/mappress-google-maps-for-wordpress/src" : self::$baseurl . '/js';
563
-
564
- if (self::$options->engine == 'leaflet') {
565
- wp_enqueue_script("mappress-leaflet", $js . "/leaflet/leaflet.js", null, '1.3.1', $footer);
566
- wp_enqueue_script("mappress-omnivore", $js . "/leaflet/leaflet-omnivore.min.js", null, '0.3.1', $footer);
567
- wp_enqueue_script("mappress-algolia-places", $js . "/algolia/placesAutocompleteDataset.min.js", null, '1.7.2', $footer);
568
- wp_enqueue_script("mappress-algolia-search", $js . "/algolia/algoliasearchLite.min.js", null, '3', $footer);
569
-
570
- } else {
571
- $language = self::get_language();
572
- $language = ($language) ? "&language=$language" : '';
573
- $apiversion = ($dev) ? 'v=3.exp' : 'v=3';
574
- $apikey = "&key=" . self::get_api_keys()->browser;
575
- $libs = ($type == 'editor') ? '&libraries=places,drawing' : '&libraries=places';
576
- wp_enqueue_script("mappress-gmaps", "https://maps.googleapis.com/maps/api/js?{$apiversion}{$language}{$libs}{$apikey}", null, null, $footer);
577
- }
578
-
579
- if ($type == 'editor')
580
- wp_enqueue_script('mappress_editor', $js . "/mappress_editor$min.js", array('jquery', 'jquery-ui-position', 'jquery-ui-sortable'), $version, $footer);
581
-
582
- if ($type == 'settings')
583
- wp_enqueue_script('mappress_settings', $js . "/mappress_settings$min.js", array('postbox', 'jquery', 'jquery-ui-position', 'jquery-ui-sortable'), $version, $footer);
584
-
585
- // Autocomplete
586
- wp_enqueue_script('mappress-algolia-autocomplete', $js . "/algolia/autocomplete.jquery.min.js", array('jquery'), $version, $footer);
587
-
588
- // mappress.js includes loader, so must come after editor
589
- wp_enqueue_script('mappress', $js . "/mappress$min.js", array('underscore', 'jquery'), $version, $footer);
590
-
591
- if ($dev) {
592
- foreach(array('directions', 'geocoding', 'icons', 'infobox', 'lib', 'places', 'poi', 'widgets', 'loader') as $script)
593
- wp_enqueue_script($script, $js . "/mappress_{$script}.js", null, $version, $footer);
594
- }
595
-
596
- wp_localize_script('mappress', 'mappl10n', self::l10n());
597
-
598
- // Templates
599
- if ($type != 'editor')
600
- Mappress_Template::load($footer);
601
  }
602
 
603
- static function footer() {
604
  $infinite = class_exists( 'Jetpack' ) && Jetpack::is_module_active( 'infinite-scroll' );
605
  return (is_admin() || self::$options->footer && !$infinite);
606
  }
607
 
608
- static function dev() {
609
- if (defined('MAPPRESS_DEV') && MAPPRESS_DEV)
610
- return MAPPRESS_DEV;
611
- else if (isset($_REQUEST['mp_dev']))
612
- return ($_REQUEST['mp_dev']) ? $_REQUEST['mp_dev'] : 'dev';
613
- else
614
- return false;
615
  }
616
 
617
  static function l10n() {
@@ -624,6 +406,7 @@ class Mappress {
624
  'kml_error' => __('Error reading KML file', 'mappress-google-maps-for-wordpress'),
625
  'layer' => __('URL for KML file', 'mappress-google-maps-for-wordpress'),
626
  'loading' => "<span class='mapp-spinner'></span>" . __('Loading', 'mappress-google-maps-for-wordpress'),
 
627
  'no_geolocate' => __('Unable to get your location', 'mappress-google-maps-for-wordpress'),
628
  'no_results' => __('No results', 'mappress-google-maps-for-wordpress'),
629
  'save' => __('Save changes?', 'mappress-google-maps-for-wordpress'),
@@ -635,12 +418,12 @@ class Mappress {
635
  $l10n['options'] = array(
636
  'admin' => current_user_can('administrator'),
637
  'ajaxurl' => admin_url('admin-ajax.php'),
638
- 'debug' => Mappress::$debug,
639
  'iconsUrl' => (self::$pro) ? Mappress_Icons::$icons_url : null,
640
  'language' => self::get_language(),
641
  'mapbox' => self::get_api_keys()->mapbox,
642
- 'mini' => 350,
643
- 'postid' => ($post) ? $post->ID : null,
644
  'pro' => self::$pro,
645
  'siteUrl' => site_url(),
646
  'standardIconsUrl' => (self::$pro) ? Mappress_Icons::$standard_icons_url : null
@@ -658,7 +441,7 @@ class Mappress {
658
  'zoomOffset' => 0
659
  ),
660
  'osm' => array(
661
- 'attribution' => 'Map data ©<a href="https://openstreetmap.org">OpenStreetMap</a>',
662
  'url' => 'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png'
663
  )
664
  );
@@ -707,23 +490,122 @@ class Mappress {
707
  return $l10n;
708
  }
709
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
710
  /**
711
- * Get language using settings/WPML/qTrans
 
 
712
  *
 
713
  */
714
- static function get_language() {
715
- // WPML
716
- if (defined('ICL_LANGUAGE_CODE'))
717
- $lang = ICL_LANGUAGE_CODE;
718
 
719
- // qTranslate
720
- else if (function_exists('qtrans_getLanguage'))
721
- $lang = qtrans_getLanguage();
722
 
723
- else
724
- $lang = self::$options->language;
725
 
726
- return ($lang) ? $lang : null;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
727
  }
728
 
729
  /**
@@ -737,44 +619,158 @@ class Mappress {
737
  }
738
  }
739
 
740
- static function get_api_keys() {
741
- $results = (object) array('browser' => self::$options->apiKey, 'server' => self::$options->apiKeyServer, 'mapbox' => self::$options->mapbox);
742
- if (empty($results->browser) && defined('MAPPRESS_APIKEY'))
743
- $results->browser = MAPPRESS_APIKEY;
744
- if (empty($results->server) && defined('MAPPRESS_APIKEY_SERVER'))
745
- $results->server = MAPPRESS_APIKEY_SERVER;
746
- if (empty($results->mapbox) && defined('MAPPRESS_APIKEY_MAPBOX'))
747
- $result->mapbox = MAPPRESS_APIKEY_MAPBOX;
748
- return $results;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
749
  }
750
 
751
- static function script($script, $ready = false) {
752
- $html = "\r\n<script type='text/javascript'>\r\n";
753
- $html .= ($ready) ? "jQuery(document).ready(function() { $script });" : $script;
754
- $html .= "\r\n</script>";
755
- return $html;
 
 
 
 
 
 
 
 
 
 
756
  }
757
 
758
- static function script_template($template, $id = null) {
759
- $id = ($id) ? "id='mapp-tmpl-{$id}'" : '';
760
- $html = "\r\n<script type='text/template' $id>\r\n{$template}\r\n</script>\r\n";
761
- return $html;
 
 
 
 
 
 
 
 
 
762
  }
763
 
764
- static function ssl() {
765
- return (is_ssl() || !filter_var($_SERVER['REMOTE_ADDR'], FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
766
  }
767
 
768
- static function is_localhost() {
769
- return !filter_var($_SERVER['SERVER_ADDR'], FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
770
  }
771
 
772
- // WP returns is_admin() = true during AJAX calls, this one returns false in that case
773
- static function is_admin() {
774
- $ajax = defined('DOING_AJAX') && DOING_AJAX;
775
- return is_admin() && !$ajax;
776
  }
777
- } // End Mappress class
778
 
779
  $mappress = new Mappress();
780
  ?>
4
  Plugin URI: https://www.mappresspro.com/mappress
5
  Author URI: https://www.mappresspro.com/chris-contact
6
  Description: MapPress makes it easy to add Google and Leaflet Maps to WordPress
7
+ Version: 2.52
8
  Author: Chris Richardson
9
  Text Domain: mappress-google-maps-for-wordpress
10
  Thanks to all the translators and to Matthias Stasiak for his wonderful icons (http://code.google.com/p/google-maps-icons/)
35
  }
36
 
37
  class Mappress {
38
+ const VERSION = '2.52';
39
 
40
  static
41
  $baseurl,
43
  $basedir,
44
  $debug,
45
  $loaded,
 
46
  $options,
47
  $pages,
48
  $pro,
49
+ $updater,
50
+ $version
51
  ;
52
 
53
  function __construct() {
56
  self::$baseurl = plugins_url('', __FILE__);
57
  self::$options = Mappress_Options::get();
58
  self::$pro = is_dir(dirname( __FILE__ ) . '/pro');
59
+ self::$version = (self::$pro) ? self::VERSION . " PRO" : self::VERSION;
60
+ self::$version = (defined('MAPPRESS_DEV') && MAPPRESS_DEV) ? self::$version . '-' . rand(0,99999) : self::$version;
61
+
62
  self::debugging();
63
 
64
  // Pro updater
104
  add_filter( 'heartbeat_settings', array(__CLASS__, 'heartbeat_settings'));
105
  }
106
 
107
+ // Scripts & styles for admin
108
+ // CSS is always loaded from the plugin directory
109
+ static function admin_enqueue_scripts($hook) {
110
+ // Some plugins call this without setting $hook
111
+ if (empty($hook))
112
+ return;
113
+
114
+ // Network admin has no pages
115
+ if (empty(self::$pages))
116
+ return;
117
+
118
+ $editing = in_array($hook, array('edit.php', 'post.php', 'post-new.php'));
119
+
120
+ // Settings scripts
121
+ if ($hook == self::$pages[0]) {
122
+ self::load('settings');
123
+ if (function_exists('wp_enqueue_code_editor'))
124
+ wp_enqueue_code_editor(array( 'type' => 'php' ));
125
+ }
126
+
127
+ // Leaflet CSS
128
+ if (self::$options->engine == 'leaflet')
129
+ wp_enqueue_style('mappress-leaflet', self::$baseurl . "/css/leaflet/leaflet.css", null, '1.3.1');
130
+
131
+ // Mappress CSS
132
+ if (in_array($hook, self::$pages) || $editing) {
133
+ wp_enqueue_style('mappress', self::$baseurl . '/css/mappress.css', null, self::$version);
134
+ wp_enqueue_style('mappress-admin', self::$baseurl . '/css/mappress_admin.css', null, self::$version);
135
+ }
136
+ }
137
+
138
+ static function admin_menu() {
139
+ // Settings
140
+ $settings = (self::$pro) ? new Mappress_Pro_Settings() : new Mappress_Settings();
141
+ self::$pages[] = add_menu_page('MapPress', 'MapPress', 'manage_options', 'mappress', array(&$settings, 'options_page'), 'dashicons-location');
142
+ }
143
+
144
+ static function admin_notices() {
145
+ global $wpdb;
146
+ $notices = array();
147
+
148
+ $error = "<div class='notice error'><p>%s</p></div>";
149
+ $map_table = $wpdb->prefix . "mappress_maps";
150
+ $exists = $wpdb->get_var("show tables like '$map_table'");
151
+
152
+ if (!$exists) {
153
+ printf($error, __("MapPress database tables are missing. Please deactivate the plugin and activate it again to fix this.", 'mappress-google-maps-for-wordpress'));
154
+ return;
155
+ }
156
+
157
+ if (class_exists('WPGeo')) {
158
+ printf($error, __("WARNING: MapPress is not compatible with the WP-Geo plugin. Please deactivate or uninstall WP-Geo before using MapPress.", 'mappress-google-maps-for-wordpress'));
159
+ return;
160
+ }
161
+
162
+ if (self::$options->engine != 'leaflet' && !self::get_api_keys()->browser)
163
+ printf($error, sprintf("%s. %s <a href='%s'>%s</a>.", __("A Google Maps API key is required", 'mappress-google-maps-for-wordpress'), __("Please update your", 'mappress-google-maps-for-wordpress'), admin_url('admin.php?page=mappress'), __('MapPress Settings', 'mappress-google-maps-for-wordpress')));
164
+
165
+ // Print notices
166
+ if (is_super_admin()) {
167
+ $dismissed = get_user_meta(get_current_user_id(), 'mappress-dismissed', true);
168
+ $dismissed = (is_array($dismissed)) ? $dismissed : array();
169
+
170
+ // Print notices
171
+ $notices = array_diff_key($notices, $dismissed);
172
+ foreach($notices as $key => $msg)
173
+ echo "<div class='notice error is-dismissible' data-mapp-dismiss='$key'><p>$msg</p></div>";
174
+
175
+ if ($notices) {
176
+ echo Mappress::script("jQuery('[data-mapp-dismiss]').on('click', '.notice-dismiss', function(e) {
177
+ jQuery.post(ajaxurl, { action : 'mapp_dismiss', key : jQuery(this).closest('.notice').attr('data-mapp-dismiss') });
178
+ });");
179
  }
180
  }
181
  }
182
 
183
+ static function ajax_dismiss() {
184
+ $key = (isset($_POST['key'])) ? $_POST['key'] : null;
185
+ if ($key) {
186
+ $user_id = get_current_user_id();
187
+ $dismissed = get_user_meta($user_id, 'mappress-dismissed', true);
188
+ $dismissed = (is_array($dismissed)) ? $dismissed : array();
189
+ $dismissed[$key] = true;
190
+ update_user_meta($user_id, 'mappress-dismissed', $dismissed);
191
+ }
192
+ }
193
+
194
+ static function ajax_response($status, $data=null, $gzip = false) {
195
+ $output = trim(ob_get_clean()); // Ignore whitespace, any other output is an error
196
+ header( "Content-Type: application/json" );
197
+
198
+ if ($gzip && get_site_option('can_compress_scripts'))
199
+ ob_start('ob_gzhandler');
200
+ else
201
+ ob_start();
202
+
203
+ $response = json_encode(array('status' => $status, 'output' => $output, 'data' => $data));
204
+ die ($response);
205
  }
206
 
207
  static function debugging() {
208
  global $wpdb;
209
 
210
  if (isset($_GET['mp_info'])) {
211
+ echo "<b>Plugin</b> " . self::$version;
212
  $posts_table = $wpdb->prefix . 'mappress_posts';
213
  $results = $wpdb->get_results("SELECT postid, mapid FROM $posts_table");
214
  echo "<br/>postid => mapid";
236
  }
237
  }
238
 
239
+ static function deregister() {
240
+ if (self::$loaded) {
241
+ $wps = wp_scripts();
242
+ foreach($wps->registered as $registered) {
243
+ if (stripos($registered->src, 'maps.googleapis.com') !== false && stripos($registered->handle, 'mappress') === false) {
244
+ $registered->src = self::$baseurl . '/forms/dummy.js';
245
+ }
246
+ }
247
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
248
  }
249
 
250
+ static function get_api_keys() {
251
+ $results = (object) array('browser' => self::$options->apiKey, 'server' => self::$options->apiKeyServer, 'mapbox' => self::$options->mapbox);
252
+ if (empty($results->browser) && defined('MAPPRESS_APIKEY'))
253
+ $results->browser = MAPPRESS_APIKEY;
254
+ if (empty($results->server) && defined('MAPPRESS_APIKEY_SERVER'))
255
+ $results->server = MAPPRESS_APIKEY_SERVER;
256
+ if (empty($results->mapbox) && defined('MAPPRESS_APIKEY_MAPBOX'))
257
+ $result->mapbox = MAPPRESS_APIKEY_MAPBOX;
258
+ return $results;
259
  }
260
 
261
  /**
262
+ * Get language using settings/WPML/qTrans
 
 
263
  *
 
264
  */
265
+ static function get_language() {
266
+ // WPML
267
+ if (defined('ICL_LANGUAGE_CODE'))
268
+ $lang = ICL_LANGUAGE_CODE;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
269
 
270
+ // qTranslate
271
+ else if (function_exists('qtrans_getLanguage'))
272
+ $lang = qtrans_getLanguage();
 
273
 
 
 
274
  else
275
+ $lang = self::$options->language;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
276
 
277
+ return ($lang) ? $lang : null;
 
278
  }
279
 
280
  /**
311
  return $mashup->display();
312
  }
313
 
314
+ static function get_support_links($title = 'MapPress') {
315
+ $html = "<div class='mapp-support'>" . __('Version', 'mappress-google-maps-for-wordpress') . ':' . self::$version;
316
+ $html .= " | <a target='_blank' href='https://mappresspro.com/mappress/mappress-documentation'>" . __('Documentation', 'mappress-google-maps-for-wordpress') . "</a>";
317
+ $html .= " | <a target='_blank' href='https://mappresspro.com/chris-contact'>" . __('Support', 'mappress-google-maps-for-wordpress') . "</a>";
318
+ if (!self::$pro)
319
+ $html .= "<a class='button button-primary' href='https://mappresspro.com/mappress' target='_blank'>" . __('Upgrade to MapPress Pro', 'mappress-google-maps-for-wordpress') . "</a>";
320
+ $html .= "</div>";
321
+ echo $html;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
322
  }
323
 
324
+ static function heartbeat_settings( $settings ) {
325
+ $settings['minimalInterval'] = 600;
326
+ return $settings;
327
  }
328
 
 
329
  /**
330
  * There are several WP bugs that prevent correct activation in multisitie:
331
  * http://core.trac.wordpress.org/ticket/14170
368
  update_option('mappress_version', self::VERSION);
369
  }
370
 
371
+ // WP returns is_admin() = true during AJAX calls, this one returns false in that case
372
+ static function is_admin() {
373
+ $ajax = defined('DOING_AJAX') && DOING_AJAX;
374
+ return is_admin() && !$ajax;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
375
  }
376
 
377
+ static function is_dev() {
378
+ if (defined('MAPPRESS_DEV') && MAPPRESS_DEV)
379
+ return MAPPRESS_DEV;
380
+ else if (isset($_REQUEST['mp_dev']))
381
+ return ($_REQUEST['mp_dev']) ? $_REQUEST['mp_dev'] : 'dev';
382
  else
383
+ return false;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
384
  }
385
 
386
+ static function is_footer() {
387
  $infinite = class_exists( 'Jetpack' ) && Jetpack::is_module_active( 'infinite-scroll' );
388
  return (is_admin() || self::$options->footer && !$infinite);
389
  }
390
 
391
+ static function is_localhost() {
392
+ return !filter_var($_SERVER['SERVER_ADDR'], FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE);
393
+ }
394
+
395
+ static function is_ssl() {
396
+ return (is_ssl() || !filter_var($_SERVER['REMOTE_ADDR'], FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE));
 
397
  }
398
 
399
  static function l10n() {
406
  'kml_error' => __('Error reading KML file', 'mappress-google-maps-for-wordpress'),
407
  'layer' => __('URL for KML file', 'mappress-google-maps-for-wordpress'),
408
  'loading' => "<span class='mapp-spinner'></span>" . __('Loading', 'mappress-google-maps-for-wordpress'),
409
+ 'more' => __('%d of %d shown', 'mappress-google-maps-for-wordpress'),
410
  'no_geolocate' => __('Unable to get your location', 'mappress-google-maps-for-wordpress'),
411
  'no_results' => __('No results', 'mappress-google-maps-for-wordpress'),
412
  'save' => __('Save changes?', 'mappress-google-maps-for-wordpress'),
418
  $l10n['options'] = array(
419
  'admin' => current_user_can('administrator'),
420
  'ajaxurl' => admin_url('admin-ajax.php'),
421
+ 'debug' => self::$debug,
422
  'iconsUrl' => (self::$pro) ? Mappress_Icons::$icons_url : null,
423
  'language' => self::get_language(),
424
  'mapbox' => self::get_api_keys()->mapbox,
425
+ 'mini' => 400,
426
+ 'postid' => ($post) ? $post->ID : null, // Note: GT => numeric, classic => string
427
  'pro' => self::$pro,
428
  'siteUrl' => site_url(),
429
  'standardIconsUrl' => (self::$pro) ? Mappress_Icons::$standard_icons_url : null
441
  'zoomOffset' => 0
442
  ),
443
  'osm' => array(
444
+ 'attribution' => 'Map data (c)<a href="https://openstreetmap.org">OpenStreetMap</a>',
445
  'url' => 'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png'
446
  )
447
  );
490
  return $l10n;
491
  }
492
 
493
+ static function load($type = null) {
494
+ if (self::$loaded)
495
+ return;
496
+ else
497
+ self::$loaded = true;
498
+
499
+ $dev = self::is_dev();
500
+ $footer = self::is_footer();
501
+
502
+ // Directories
503
+ $min = ($dev) ? "" : ".min";
504
+ $js = ($dev) ? "http://localhost/$dev/wp-content/plugins/mappress-google-maps-for-wordpress/src" : self::$baseurl . '/js';
505
+
506
+ if (self::$options->engine == 'leaflet') {
507
+ wp_enqueue_script("mappress-leaflet", $js . "/leaflet/leaflet.js", null, '1.3.1', $footer);
508
+ wp_enqueue_script("mappress-omnivore", $js . "/leaflet/leaflet-omnivore.min.js", null, '0.3.1', $footer);
509
+ wp_enqueue_script("mappress-algolia-places", $js . "/algolia/placesAutocompleteDataset.min.js", null, '1.7.2', $footer);
510
+ wp_enqueue_script("mappress-algolia-search", $js . "/algolia/algoliasearchLite.min.js", null, '3', $footer);
511
+
512
+ } else {
513
+ $language = self::get_language();
514
+ $language = ($language) ? "&language=$language" : '';
515
+ $apiversion = ($dev) ? 'v=3.exp' : 'v=3';
516
+ $apikey = "&key=" . self::get_api_keys()->browser;
517
+ $libs = ($type == 'editor') ? '&libraries=places,drawing' : '&libraries=places';
518
+ wp_enqueue_script("mappress-gmaps", "https://maps.googleapis.com/maps/api/js?{$apiversion}{$language}{$libs}{$apikey}", null, null, $footer);
519
+ }
520
+
521
+ if ($type == 'editor')
522
+ wp_enqueue_script('mappress_editor', $js . "/mappress_editor$min.js", array('jquery', 'jquery-ui-position', 'jquery-ui-sortable'), self::$version, $footer);
523
+
524
+ if ($type == 'settings')
525
+ wp_enqueue_script('mappress_settings', $js . "/mappress_settings$min.js", array('postbox', 'jquery', 'jquery-ui-position', 'jquery-ui-sortable'), self::$version, $footer);
526
+
527
+ // Autocomplete
528
+ wp_enqueue_script('mappress-algolia-autocomplete', $js . "/algolia/autocomplete.jquery.min.js", array('jquery'), self::$version, $footer);
529
+
530
+ // mappress.js includes loader, so must come after editor
531
+ wp_enqueue_script('mappress', $js . "/mappress$min.js", array('underscore', 'jquery'), self::$version, $footer);
532
+
533
+ if ($dev) {
534
+ foreach(array('directions', 'geocoding', 'icons', 'infobox', 'lib', 'places', 'poi', 'widgets', 'loader') as $script)
535
+ wp_enqueue_script($script, $js . "/mappress_{$script}.js", null, self::$version, $footer);
536
+ }
537
+
538
+ wp_localize_script('mappress', 'mappl10n', self::l10n());
539
+
540
+ // Templates
541
+ if ($type != 'editor')
542
+ Mappress_Template::load($footer);
543
+ }
544
+
545
+ static function plugin_action_links($links, $file) {
546
+ $settings_link = "<a href='" . admin_url("admin.php?page=mappress") . "'>" . __('Settings', 'mappress-google-maps-for-wordpress') . "</a>";
547
+ array_unshift( $links, $settings_link );
548
+ return $links;
549
+ }
550
+
551
+ static function plugins_loaded() {
552
+ load_plugin_textdomain('mappress-google-maps-for-wordpress', false, dirname(self::$basename) . '/languages');
553
+ }
554
+
555
+ static function script($script, $ready = false) {
556
+ $html = "\r\n<script type='text/javascript'>\r\n";
557
+ $html .= ($ready) ? "jQuery(function() { $script });" : $script;
558
+ $html .= "\r\n</script>";
559
+ return $html;
560
+ }
561
+
562
+ static function script_template($template, $id = null) {
563
+ $id = ($id) ? "id='mapp-tmpl-{$id}'" : '';
564
+ $html = "\r\n<script type='text/template' $id>\r\n{$template}\r\n</script>\r\n";
565
+ return $html;
566
+ }
567
+
568
  /**
569
+ * Scrub attributes
570
+ * The WordPress shortcode API passes shortcode attributes in lowercase and with boolean values as strings (e.g. "true")
571
+ * Converts atts to lowercase, replaces boolean strings with booleans, and creates arrays from comma-separated attributes
572
  *
573
+ * Returns empty array if $atts is empty or not an array
574
  */
575
+ static function scrub_atts($atts=null) {
576
+ if (!$atts || !is_array($atts))
577
+ return array();
 
578
 
579
+ $atts = self::string_to_boolean($atts);
 
 
580
 
581
+ // Shortcode attributes are lowercase so convert everything to lowercase
582
+ $atts = array_change_key_case($atts);
583
 
584
+ // Map options - includes both leaflet and Google
585
+ foreach(array('disableDefaultUI', 'disableDoubleClickZoom', 'draggable', 'fullscreenControl', 'keyboardShortcuts', 'mapTypeControl', 'maxZoom', 'minZoom', 'panControl', 'rotateControl', 'scaleControl', 'scrollwheel', 'scrollWheelZoom', 'streetViewControl', 'zoomControl') as $opt) {
586
+ $lcopt = strtolower($opt);
587
+ if (isset($atts[$lcopt])) {
588
+ $atts['mapopts'][$opt] = $atts[$lcopt];
589
+ unset($atts[$lcopt]);
590
+ }
591
+ }
592
+
593
+ // Explode layers
594
+ if (isset($atts['layers'])) {
595
+ $atts['layers'] = explode(',', $atts['layers']);
596
+ foreach($atts['layers'] as &$layer)
597
+ $layer = trim($layer);
598
+ }
599
+
600
+ // Search = 'post', replace with post's location
601
+ if (isset($atts['center']) && $atts['center'] == 'post') {
602
+ global $post;
603
+ $maps = Mappress_Map::get_list($post->ID, 'ids');
604
+ $map = ($maps) ? Mappress_Map::get($maps[0]) : null;
605
+ $atts['center'] = ($map && $map->pois) ? $map->pois[0]->point['lat'] . ',' . $map->pois[0]->point['lng'] : null;
606
+ }
607
+
608
+ return $atts;
609
  }
610
 
611
  /**
619
  }
620
  }
621
 
622
+ /**
623
+ * Map a shortcode in a post.
624
+ *
625
+ * @param mixed $atts - shortcode attributes
626
+ */
627
+ static function shortcode_map($atts='') {
628
+ global $post;
629
+
630
+ // No feeds
631
+ if (is_feed())
632
+ return;
633
+
634
+ // Try to protect against calls to do_shortcode() in the post editor...
635
+ if (self::is_admin())
636
+ return;
637
+
638
+ $atts = self::scrub_atts($atts);
639
+
640
+ // Determine what to show
641
+ $mapid = (isset($atts['mapid'])) ? $atts['mapid'] : null;
642
+
643
+ if ($mapid) {
644
+ // Show map by mapid
645
+ $map = Mappress_Map::get($mapid);
646
+ } else {
647
+ // Get the first map attached to the post
648
+ $maps = Mappress_Map::get_list($post->ID);
649
+ $map = (isset ($maps[0]) ? $maps[0] : false);
650
+ }
651
+
652
+ if (!$map)
653
+ return;
654
+
655
+ return $map->display($atts);
656
  }
657
 
658
+ /**
659
+ * Process the mashup shortcode
660
+ *
661
+ */
662
+ static function shortcode_mashup($atts='') {
663
+ // No feeds
664
+ if (is_feed())
665
+ return;
666
+
667
+ // Prevent do_shortcode() in the post editor, but allow for AJAX calls from other plugins (which run as admin)
668
+ if (self::is_admin())
669
+ return;
670
+
671
+ $atts = self::scrub_atts($atts);
672
+ return self::get_mashup($atts);
673
  }
674
 
675
+ static function string_to_boolean($data) {
676
+ if ($data === 'false')
677
+ return false;
678
+
679
+ if ($data === 'true')
680
+ return true;
681
+
682
+ if (is_array($data)) {
683
+ foreach($data as &$datum)
684
+ $datum = self::string_to_boolean($datum);
685
+ }
686
+
687
+ return $data;
688
  }
689
 
690
+ /**
691
+ * Automatic map display.
692
+ * If set, the [mappress] shortcode will be prepended/appended to the post body, once for each map
693
+ * The shortcode is used so it can be filtered - for example WordPress will remove it in excerpts by default.
694
+ *
695
+ * @param mixed $content
696
+ */
697
+ static function the_content($content="") {
698
+ global $post;
699
+ global $wp_current_filter;
700
+
701
+ $autodisplay = self::$options->autodisplay;
702
+
703
+ // No auto display
704
+ if (!$autodisplay || $autodisplay == 'none')
705
+ return $content;
706
+
707
+ // Check if in the loop, to prevent conflicts with JetPack - see http://wordpress.org/support/topic/easy-adsense-lite-and-jetpack
708
+ if (!in_the_loop())
709
+ return $content;
710
+
711
+ // Don't add the shortcode for feeds or admin screens
712
+ if (is_feed() || self::is_admin())
713
+ return $content;
714
+
715
+ // No shortcode if post is password protected
716
+ if (post_password_required())
717
+ return $content;
718
+
719
+ // If this is an excerpt don't attempt to add the map to it
720
+ if (in_array('get_the_excerpt', $wp_current_filter))
721
+ return $content;
722
+
723
+ // Don't auto display if the post already contains a MapPress shortcode
724
+ if (stristr($content, '[mappress') !== false || stristr($content, '[mashup') !== false)
725
+ return $content;
726
+
727
+ // Get maps associated with post
728
+ $mapids = Mappress_Map::get_list($post->ID, 'ids');
729
+ if (empty($mapids))
730
+ return $content;
731
+
732
+ // Add the shortcode once for each map
733
+ $shortcodes = "";
734
+ foreach($mapids as $mapid)
735
+ $shortcodes .= '<p>[mappress mapid="' . $mapid . '"]</p>';
736
+
737
+ if ($autodisplay == 'top')
738
+ return $shortcodes . $content;
739
+ else
740
+ return $content . $shortcodes;
741
  }
742
 
743
+ /**
744
+ * Scripts & styles for frontend
745
+ * CSS is loaded from: child theme, theme, or plugin directory
746
+ */
747
+ static function wp_enqueue_scripts() {
748
+ // Leaflet CSS
749
+ if (self::$options->engine == 'leaflet')
750
+ wp_enqueue_style('mappress-leaflet', self::$baseurl . '/css/leaflet/leaflet.css', null, '1.3.1');
751
+
752
+ // Mappress CSS from plugin directory
753
+ wp_enqueue_style('mappress', self::$baseurl . '/css/mappress.css', null, self::$version);
754
+
755
+ // Mappress CSS from theme directory
756
+ if ( @file_exists( get_stylesheet_directory() . '/mappress.css' ) )
757
+ $file = get_stylesheet_directory_uri() . '/mappress.css';
758
+ elseif ( @file_exists( get_template_directory() . '/mappress.css' ) )
759
+ $file = get_template_directory_uri() . '/mappress.css';
760
+
761
+ if (isset($file))
762
+ wp_enqueue_style('mappress-custom', $file, array('mappress'), self::$version);
763
+
764
+ // Load scripts in header
765
+ if (!self::is_footer())
766
+ self::load();
767
  }
768
 
769
+ static function wp_head() {
770
+ echo "\r\n<!-- MapPress Easy Google Maps " . __('Version', 'mappress-google-maps-for-wordpress') . ':' . self::$version . " (http://www.mappresspro.com/mappress) -->\r\n";
771
+ echo "<script type='text/javascript'>mapp = window.mapp || {}; mapp.data = [];</script>\r\n";
 
772
  }
773
+ }
774
 
775
  $mappress = new Mappress();
776
  ?>
mappress_map.php CHANGED
@@ -49,7 +49,6 @@ class Mappress_Map extends Mappress_Obj {
49
  static function register() {
50
  global $wpdb;
51
 
52
- // Ajax
53
  add_action('deleted_post', array(__CLASS__, 'delete_post_map'));
54
 
55
  add_action('wp_ajax_mapp_delete', array(__CLASS__, 'ajax_delete'));
@@ -86,9 +85,9 @@ class Mappress_Map extends Mappress_Obj {
86
  $wpdb->show_errors(false);
87
  }
88
 
89
- static function media_button($editor_id) {
90
  if ($editor_id == 'content') {
91
- echo '<button type="button" class="button" id="mapp-pick-button">';
92
  echo '<span class="wp-media-buttons-icon dashicons dashicons-location"></span> ' . __('MapPress', 'mappress-google-maps-for-wordpress') . '</button>';
93
  }
94
  }
@@ -101,38 +100,34 @@ class Mappress_Map extends Mappress_Obj {
101
  static function meta_box($post) {
102
  Mappress::load('editor');
103
  $map = new Mappress_Map(array('editable' => true, 'layout' => 'left', 'name' => 'mapp0', 'poiList' => true));
104
- require(Mappress::$basedir . '/forms/map_media.php');
105
  }
106
 
107
  static function find($args) {
108
  global $wpdb;
109
- $posts_table = $wpdb->prefix . 'mappress_posts';
110
- $args = (object) wp_parse_args($args, array('type' => 'post', 'output' => 'names', 'page' => 1, 'page_size' => 20, 'postid' => null, 'search' => null));
111
-
112
- $where = array();
113
- if ($args->type == 'post')
114
- $where[] = $wpdb->prepare("postid=%d", $args->postid);
115
-
116
- // Note: $wpdb->prepare uses tokens on % like queries
117
- if ($args->type == 'all' && $args->search)
118
- $where[] = $wpdb->prepare("$wpdb->posts.post_title LIKE %s", '%' . $args->search . '%');
119
 
120
- $where = ($where) ? " WHERE " . implode(' AND ', $where) : '';
121
-
122
- //$limit = sprintf(" LIMIT %d, %d", ($args->page - 1) * $args->page_size, $args->page_size);
123
- $limit = '';
124
- $sql = "SELECT SQL_CALC_FOUND_ROWS $posts_table.mapid FROM $posts_table INNER JOIN $wpdb->posts ON ($wpdb->posts.ID = $posts_table.postid) $where $limit";
125
 
 
 
 
 
 
126
  $results = $wpdb->get_results($sql);
127
- $found = $wpdb->get_var('SELECT FOUND_ROWS()');
128
 
129
  $items = array();
130
- foreach($results as $result)
131
- $items[] = self::get($result->mapid, 'list');
 
 
 
 
 
 
 
132
 
133
- $pages = (int) ceil($found / $args->page_size);
134
- $page = (int) min($args->page, $pages);
135
- return (object) array('items' => $items, 'page' => $page, 'pages' => $pages);
136
  }
137
 
138
  static function ajax_find() {
@@ -142,7 +137,7 @@ class Mappress_Map extends Mappress_Obj {
142
  /**
143
  * Get a map. Output is 'raw' or 'object'
144
  */
145
- static function get($mapid, $output = 'object') {
146
  global $wpdb;
147
  $maps_table = $wpdb->prefix . 'mappress_maps';
148
  $posts_table = $wpdb->prefix . 'mappress_posts';
@@ -157,22 +152,7 @@ class Mappress_Map extends Mappress_Obj {
157
  $mapdata = unserialize($result->obj);
158
  $mapdata->postid = $result->postid;
159
  $mapdata->mapid = $result->mapid;
160
-
161
- // Return an object
162
- if ($output == 'object')
163
- return new Mappress_Map($mapdata);
164
-
165
- // Return list item (with post data)
166
- if ($output == 'list') {
167
- $post = get_post($result->postid);
168
- return array(
169
- 'mapid' => $mapdata->mapid,
170
- 'map_title' => $mapdata->title,
171
- 'postid' => $mapdata->postid,
172
- 'post_title' => ($post) ? $post->post_title : null,
173
- 'can_edit' => current_user_can('edit_post', $mapdata->postid)
174
- );
175
- }
176
  }
177
 
178
  static function ajax_get() {
@@ -223,7 +203,6 @@ class Mappress_Map extends Mappress_Obj {
223
  foreach($this->pois as &$poi)
224
  $poi->body = wpautop($poi->body);
225
 
226
-
227
  $map = serialize($this);
228
 
229
  // Update map
@@ -267,8 +246,8 @@ class Mappress_Map extends Mappress_Obj {
267
 
268
  do_action('mappress_map_save', $mapid); // Use for your own developments
269
 
270
- // Re-read updated object and return it in response
271
- Mappress::ajax_response('OK', self::get($mapid, 'list'));
272
  }
273
 
274
  /**
49
  static function register() {
50
  global $wpdb;
51
 
 
52
  add_action('deleted_post', array(__CLASS__, 'delete_post_map'));
53
 
54
  add_action('wp_ajax_mapp_delete', array(__CLASS__, 'ajax_delete'));
85
  $wpdb->show_errors(false);
86
  }
87
 
88
+ static function media_buttons($editor_id) {
89
  if ($editor_id == 'content') {
90
+ echo '<button type="button" class="button mapp-media-button">';
91
  echo '<span class="wp-media-buttons-icon dashicons dashicons-location"></span> ' . __('MapPress', 'mappress-google-maps-for-wordpress') . '</button>';
92
  }
93
  }
100
  static function meta_box($post) {
101
  Mappress::load('editor');
102
  $map = new Mappress_Map(array('editable' => true, 'layout' => 'left', 'name' => 'mapp0', 'poiList' => true));
103
+ require(Mappress::$basedir . '/forms/media.php');
104
  }
105
 
106
  static function find($args) {
107
  global $wpdb;
 
 
 
 
 
 
 
 
 
 
108
 
109
+ $maps_table = $wpdb->prefix . 'mappress_maps';
110
+ $posts_table = $wpdb->prefix . 'mappress_posts';
 
 
 
111
 
112
+ $sql = "SELECT SQL_CALC_FOUND_ROWS $maps_table.mapid, $maps_table.obj, $posts_table.postid, $wpdb->posts.post_title "
113
+ . " FROM $maps_table "
114
+ . " INNER JOIN $posts_table ON ($posts_table.mapid = $maps_table.mapid)"
115
+ . " INNER JOIN $wpdb->posts ON ($wpdb->posts.ID = $posts_table.postid)"
116
+ ;
117
  $results = $wpdb->get_results($sql);
 
118
 
119
  $items = array();
120
+ foreach($results as $result) {
121
+ $mapdata = unserialize($result->obj);
122
+ $items[] = array(
123
+ 'mapid' => $result->mapid,
124
+ 'map_title' => $mapdata->title,
125
+ 'postid' => $result->postid,
126
+ 'post_title' => $result->post_title
127
+ );
128
+ }
129
 
130
+ return $items;
 
 
131
  }
132
 
133
  static function ajax_find() {
137
  /**
138
  * Get a map. Output is 'raw' or 'object'
139
  */
140
+ static function get($mapid) {
141
  global $wpdb;
142
  $maps_table = $wpdb->prefix . 'mappress_maps';
143
  $posts_table = $wpdb->prefix . 'mappress_posts';
152
  $mapdata = unserialize($result->obj);
153
  $mapdata->postid = $result->postid;
154
  $mapdata->mapid = $result->mapid;
155
+ return new Mappress_Map($mapdata);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
156
  }
157
 
158
  static function ajax_get() {
203
  foreach($this->pois as &$poi)
204
  $poi->body = wpautop($poi->body);
205
 
 
206
  $map = serialize($this);
207
 
208
  // Update map
246
 
247
  do_action('mappress_map_save', $mapid); // Use for your own developments
248
 
249
+ // Return saved mapid
250
+ Mappress::ajax_response('OK', array('mapid' => $mapid));
251
  }
252
 
253
  /**
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: chrisvrichardson
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=4339298
4
  Tags: leaflet, openstreetmap, osm, mapbox, map box, google maps,google,map,maps,easy,poi,mapping,mapper,gps,lat,lon,latitude,longitude,geocoder,geocoding,georss,geo rss,geo,v3,marker,mashup,mash,api,v3,buddypress,mashup,geo,wp-geo,geo mashup,simplemap,simple,wpml
5
  Requires at least: 4.5
6
- Tested up to: 4.9
7
- Stable tag: 2.50.10
8
 
9
  == Description ==
10
  MapPress adds beautiful, interactive Google or Leaflet maps to WordPress.
@@ -86,6 +86,18 @@ Please see the plugin documentation pages:
86
 
87
  == Changelog ==
88
 
 
 
 
 
 
 
 
 
 
 
 
 
89
  = 2.50.10 =
90
  * Fixed: PHP 7.2 notice on widgets_init
91
  * Fixed: blank map when initial centering for mashups using Google engine
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=4339298
4
  Tags: leaflet, openstreetmap, osm, mapbox, map box, google maps,google,map,maps,easy,poi,mapping,mapper,gps,lat,lon,latitude,longitude,geocoder,geocoding,georss,geo rss,geo,v3,marker,mashup,mash,api,v3,buddypress,mashup,geo,wp-geo,geo mashup,simplemap,simple,wpml
5
  Requires at least: 4.5
6
+ Tested up to: 5.3
7
+ Stable tag: 2.52
8
 
9
  == Description ==
10
  MapPress adds beautiful, interactive Google or Leaflet maps to WordPress.
86
 
87
  == Changelog ==
88
 
89
+ = 2.52 =
90
+ * Fixed: prevent enter press in map list search from publishing post
91
+ * Changed: updated map editor search/filter function
92
+ * Changed: internal function Mappress::ssl() renamed Mappress::is_ssl() - please update any custom directions.php or search.php to use the new name
93
+
94
+ = 2.51 =
95
+ * Added: mashups with a center but no zoom will perform a radius search
96
+ * Fixed: KML markers showing POI text instead of text from KML file
97
+ * Fixed: mashup initial center and zoom have been improved
98
+ * Fixed: mashups not displaying on some servers; updated gzip detection
99
+ * Changed: internal mashup query and layers control changes
100
+
101
  = 2.50.10 =
102
  * Fixed: PHP 7.2 notice on widgets_init
103
  * Fixed: blank map when initial centering for mashups using Google engine
templates/map-directions.php CHANGED
@@ -1,6 +1,6 @@
1
  <div class='mapp-directions'>
2
  <span class='mapp-close' data-mapp-action='dir-cancel'></span>
3
- <?php if (Mappress::ssl()) : ?>
4
  <a href='#' class='mapp-myloc' data-mapp-action='dir-myloc'><?php _e('My location', 'mappress-google-maps-for-wordpress'); ?></a>
5
  <?php endif; ?>
6
  <div>
1
  <div class='mapp-directions'>
2
  <span class='mapp-close' data-mapp-action='dir-cancel'></span>
3
+ <?php if (Mappress::is_ssl()) : ?>
4
  <a href='#' class='mapp-myloc' data-mapp-action='dir-myloc'><?php _e('My location', 'mappress-google-maps-for-wordpress'); ?></a>
5
  <?php endif; ?>
6
  <div>
templates/map-search.php CHANGED
@@ -1,6 +1,6 @@
1
  <div class='mapp-search'>
2
  <input class='mapp-places' type='text' placeholder='<?php _e('Search', 'mappress-google-maps-for-wordpress'); ?>'/>
3
- <?php if (Mappress::ssl()) : ?>
4
  <div class='mapp-geolocate' data-mapp-action='geolocate' title='<?php _e('Your Location', 'mappress-google-maps-for-wordpress');?>'></div>
5
  <?php endif; ?>
6
  </div>
1
  <div class='mapp-search'>
2
  <input class='mapp-places' type='text' placeholder='<?php _e('Search', 'mappress-google-maps-for-wordpress'); ?>'/>
3
+ <?php if (Mappress::is_ssl()) : ?>
4
  <div class='mapp-geolocate' data-mapp-action='geolocate' title='<?php _e('Your Location', 'mappress-google-maps-for-wordpress');?>'></div>
5
  <?php endif; ?>
6
  </div>