MapPress Easy Google Maps - Version 2.48.3

Version Description

  • Added: dismissible notices
  • Fixed: incorrect sorting for mashups with 'orderby' clause in query
  • Fixed: incorrect CSS in settings screen
  • Changed: use gzip only for mashups, not for maps, added checks for PHP libraries
Download this release

Release Info

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

Code changes from version 2.48.2 to 2.48.3

css/mappress_admin.css CHANGED
@@ -154,6 +154,10 @@ tr:hover > td > .mapp-m-actions {
154
  max-width: 600px;
155
  }
156
 
 
 
 
 
157
  .mapp-settings-screen label {
158
  margin-right: 10px;
159
  white-space: nowrap;
154
  max-width: 600px;
155
  }
156
 
157
+ .mapp-settings-screen input.button {
158
+ vertical-align: middle !important;
159
+ }
160
+
161
  .mapp-settings-screen label {
162
  margin-right: 10px;
163
  white-space: nowrap;
js/mappress.min.js CHANGED
@@ -1 +1 @@
1
- var mapp=window.mapp||{};+function(n){mapp.Map=function(t,r){function a(n,t){n=n.split(" ");for(var i=0;i<n.length;i++)google.maps.event.addListener(u,n[i],t)}function y(){var i,t;n("[data-mapp-type]",f.menu).removeClass("mapp-active");n('[data-mapp-type="'+u.getMapTypeId()+'"]',f.menu).addClass("mapp-active");for(layer in s)i=!!s[layer].getMap(),n('[data-mapp-layer="'+layer+'"]',f.menu).toggleClass("mapp-active",i);t=!!(e.center&&e.zoom);n('[data-mapp-action="viewport-set"]',f.menu).toggle(!t);n('[data-mapp-action="viewport-reset"]',f.menu).toggle(t)}function p(){var n=mappl10n.options.styles,i=mappl10n.options.style,r=["roadmap","satellite","terrain","hybrid"],t;if(i&&typeof n[i]!="undefined"&&u.setOptions({styles:n[i]}),e.editable){for(t in n)u.mapTypes.set(t,new google.maps.StyledMapType(n[t],{name:t})),r.push(t);u.setOptions({mapTypeControlOptions:{mapTypeIds:r,position:google.maps.ControlPosition.TOP_RIGHT,style:google.maps.MapTypeControlStyle.DROPDOWN_MENU}})}else typeof n[e.mapTypeId]!="undefined"&&u.setOptions({styles:n[e.mapTypeId]})}function w(){f.controls.children("[data-mapp-position]").each(function(){var t=n(this).attr("data-mapp-position"),i;t=t?google.maps.ControlPosition[t]:google.maps.ControlPosition.TOP_RIGHT;i=n(this);i.get(0).index=0;u.controls[t].push(i.get(0))})}function b(){var f,i,t,r;for(s={traffic:new google.maps.TrafficLayer,bicycling:new google.maps.BicyclingLayer,transit:new google.maps.TransitLayer},f=n.makeArray(e.layers),i=0;i<f.length;i++)t=n.trim(f[i]),r=t.split(".").pop(),s[t]?l(t):r=="kml"||r=="kmz"?s[t]=new google.maps.KmlLayer({map:u,preserveViewport:!0,url:t}):r=="json"&&(s[t]=new google.maps.Data({map:u}).loadGeoJson(t))}function l(t,i){n.each(["traffic","bicycling","transit"],function(n,t){s[t].setMap(null)});t&&(i=typeof i=="undefined"?s[t].getMap()==null:i,s[t].setMap(i?u:null))}function v(t,i){var r=n.inArray(t,["roadmap","satellite","terrain","hybrid"])!=-1;i=typeof i!="undefined"?i:!(u.getMapTypeId()==t);t=e.editable?i&&(r||typeof mappl10n.options.styles[t]!="undefined")?t:"roadmap":r?t:"roadmap";u.setMapTypeId(t)}this.defaults={center:null,editable:null,height:null,initialOpenDirections:null,initialOpenInfo:null,layers:null,mapid:null,mapTypeId:null,metaKey:null,minZoom:null,name:null,pois:null,postid:null,query:null,title:null,width:null,zoom:null};this.iw=null;this.places=null;this.poi=null;this.settings=r?r:{};var e=this,h=null,f={},u=null,s={},o=[],c;_.extend(this,this.defaults,_.pick(t,_.keys(this.defaults)),_.pick(this.settings,_.keys(this.defaults)));this.display=function(){if(f.layout=n("#"+this.name),n.each(["canvas","controls","directions","filters","list","menu","search"],function(t,i){f[i]=n(".mapp-"+i,f.layout)}),!f.canvas.length)return mapp.lib.log("MapPress: Missing map name or container for map: "+this.name);u=new google.maps.Map(f.canvas.get(0),{mapTypeId:"roadmap",zoom:1});var t={backgroundColor:"transparent",clickableIcons:!1,fullscreenControl:!1,keyboardShortcuts:!1,mapTypeControl:!0,mapTypeControlOptions:{position:google.maps.ControlPosition.TOP_RIGHT,style:google.maps.MapTypeControlStyle.DROPDOWN_MENU},minZoom:this.minZoom?parseInt(this.minZoom):0,scaleControl:!0,scrollwheel:!1,streetViewControl:!this.editable&&!this.query};u.setOptions(t);p();w();b();v(this.mapTypeId,!0);this.toggleView("mini",f.layout.width()<450);this.places=new mapp.Places(n(".mapp-places",f.search),{map:e});e.editable||google.maps.event.addListener(this.places,"search",function(n){e.search(n)});f.layout.on("click","[data-mapp-action]",function(t){var i=n(this).attr("data-mapp-action");t.preventDefault();e.action(i,n(this).attr("data-mapp-"+i),n(this))});f.filters.on("change",function(){e.ajaxQuery(u.getBounds())});a("click drag",function(){e.closeInfoWindow()});n("body").on("click",function(t){var i=n(t.target),r=i.attr("data-mapp-action");i==f.filters||r=="filters-toggle"||i.closest(f.filters).length||e.toggleView("filters",!1);i==f.menu||r=="menu-toggle"||i.closest(f.menu).length||e.toggleView("menu",!1)});n(window).resize(_.debounce(function(){e.resize()},500));this.iw=mappl10n.options.iwType=="ib"||this.editable?new mapp.InfoBox(this):new google.maps.InfoWindow;google.maps.event.addListenerOnce(u,"idle",function(){var n=o.length?o[0]:null;e.initialOpenDirections?e.openDirections(null,n):n&&e.initialOpenInfo&&n.open()});mappl10n.options.search&&google.maps.event.addListenerOnce(u,"tilesloaded",function(){google.maps.event.addListenerOnce(u,"idle",function(){a("dragend zoom_changed",function(){e.ajaxQuery(u.getBounds())})})});this.setPois(this.pois);typeof this.center=="string"?this.places.parse(this.center):this.query?this.ajaxQuery():this.recenter()};this.load=function(n){_.extend(this,this.defaults,n,this.settings);v(this.mapTypeId,!0);this.toggleView("menu",!1);l();this.closeInfoWindow();this.setPois(this.pois);this.places.set("");google.maps.event.trigger(this,"load")};this.action=function(t,i,r){switch(t){case"center":this.toggleView("menu",!1);this.closeInfoWindow();this.recenter();break;case"dir":this.openDirections(null,this.poi);break;case"dir-from":this.openDirections(this.poi,null);break;case"filters-reset":f.filters.find(":input").each(function(){this.type=="checkbox"||this.type=="radio"?n(this).prop("checked",!1):n(this).val("")});this.ajaxQuery(u.getBounds());break;case"filters-toggle":this.toggleView("filters");break;case"geolocate":this.places.geolocate(function(n){e.search(n)});break;case"layer":l(i);this.toggleView("menu",!1);break;case"menu-toggle":this.toggleView("menu");break;case"open":var s=r.attr("data-mapp-poi");this.openInfoWindow(o[s]);break;case"show":f.layout.show();this.resize();this.initCenter();break;case"view-map":this.toggleView("list",!1);break;case"view-list":this.toggleView("list",!0);break;case"viewport-set":this.center=u.getCenter().toJSON();this.zoom=u.getZoom();this.toggleView("menu",!1);break;case"viewport-reset":this.center=null;this.zoom=null;this.toggleView("menu",!1);this.recenter();break;default:return!0}};this.search=function(n){var t=n.geometry.location?n.geometry.location:null,i=n.geometry.viewport?n.geometry.viewport:null,r=new google.maps.Circle({center:t,radius:mappl10n.options.radius*1e3}),f=i?i.union(r.getBounds()):r.getBounds();u.fitBounds(f,0);u.setCenter(t);this.query&&this.ajaxQuery(f)};this.dialog=function(t,i){t?(f.canvas.append("<div class='mapp-dialog'>"+t+"<\/div>"),i&&(clearTimeout(this.dialog.fade),this.dialog.fade=setTimeout(function(){e.dialog(null)},3e3))):n(".mapp-dialog",f.canvas).remove()};this.closeInfoWindow=function(){this.iw.close();this.poiSelect(null)};this.openDirections=function(n,t){var i=n?n.getAddress():"",r=t?t.getAddress():"";h||(h=new mapp.Directions(f.directions,e));h.open(i,r)};this.poiSelect=function(t){if(n("[data-mapp-poi]",f.list).removeClass("mapp-selected"),t){var r=n.inArray(t,o),i=n('[data-mapp-poi="'+r+'"]',f.list);i.addClass("mapp-selected");mapp.lib.scrollTo(f.list,i);t.setZIndex(++c)}this.poi=t};this.getMap=function(){return u};this.renderList=function(){this.editable&&(f.list.html(mapp.lib.template("poi-list",{pois:o})),google.maps.event.trigger(this,"render-list"))};this.getPois=function(){return o};this.addPoi=function(n){o.unshift(n);n.setMap(this);e.renderList();this.poiSelect(n)};this.removePoi=function(t){var i=n.inArray(t,o);i!=-1&&(o[i].setMap(null),o.splice(i,1),e.renderList())};this.resetPois=function(){for(i=0;i<o.length;i++)o[i].setMap(null);o=[];c=google.maps.Marker.MAX_ZINDEX};this.setPois=function(n){var t,i;if(this.resetPois(),n){for(t=0;t<n.length;t++)i=new mapp.Poi(n[t]),o.push(i),i.setMap(this),i.setZIndex(c+n.length-1-t);c+=n.length-1}this.renderList()};this.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(o[r])}if(t.length!=o.length)return!1;o=t;this.renderList()};this.openInfoWindow=function(n,t){if(h&&h.close(),this.iw.close(),this.poiSelect(n),mappl10n.options.mashupClick!="poi"&&n.postid&&n.url){window.open(n.url);return}this.toggleView("list",!1);this.editable||this.iw.setContent(n.html);google.maps.event.addListenerOnce(this.iw,"domready",function(){google.maps.event.trigger(e,"poidomready",n)});google.maps.event.trigger(e,"open",n);var i=new google.maps.MVCObject;i.setValues({position:n.getPosition(t),anchorPoint:n.getAnchorPoint(t)});this.iw.open(u,i)};this.togglePois=function(n){n=!!n;for(var t=0;t<o.length;t++)o[t].setVisible(n)};this.toggleView=function(n,t){t=typeof t=="undefined"?!f.layout.hasClass("mapp-view-"+n):t;f.layout.toggleClass("mapp-view-"+n,t);n=="menu"&&t&&y();n=="directions"&&this.resize()};this.resize=function(){var n=u.getCenter();this.toggleView("mini",f.layout.width()<450);google.maps.event.trigger(u,"resize");u.setCenter(n);return};this.recenter=function(){var i=!this.query&&this.center&&this.center.lat&&this.center.lng?new google.maps.LatLng(this.center.lat,this.center.lng):null,n=!this.query&&this.zoom&&parseInt(this.zoom)?parseInt(this.zoom):null,t,r;if(this.center&&this.center.lat==0&&this.center.lng==0&&(i=null),i){u.setCenter(i);u.setZoom(n?n:1);return}if(o.length==0){u.setCenter(new google.maps.LatLng(0,0));u.setZoom(n?n:1);return}if(o.length==1){o[0].center(n);return}for(bounds=new google.maps.LatLngBounds,t=0;t<o.length;t++)r=o[t].getBounds(),bounds=r?bounds.union(r):bounds.extend(o[t].getPosition());u.fitBounds(bounds,0)};this.toJSON=function(){var n;for(this.pois=[],n=0;n<o.length;n++)this.pois.push(o[n].toJSON());return{center:this.center,height:this.height,mapid:this.mapid,mapTypeId:u.getMapTypeId(),metaKey:this.metaKey,pois:this.pois,title:this.title,width:this.width,zoom:this.zoom}};this.ajaxSave=function(n){var t=JSON.stringify(this),i=!this.mapid||!this.postid?mappl10n.options.postid:this.postid;mapp.lib.ajax({type:"POST",data:{action:"mapp_save",map:t,postid:i},callback:function(t){t.status=="OK"&&(e.mapid=t.data.mapid,n(t.data),google.maps.event.trigger(e,"save"))}})}};mapp.Map.ajaxCreate=function(n,t){mapp.lib.ajax({type:"GET",data:{action:"mapp_create"},callback:function(i){if(i.status=="OK"){var r=new mapp.Map(i.data.map,n);t(r)}}})};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 f=n(this).attr("data-mapp-action"),i=n(".mapp-dir-daddr",r.sel).val(),u=n(".mapp-dir-saddr",r.sel).val();t.preventDefault();switch(f){case"dir-cancel":r.close();break;case"dir-get":r.getDirections();break;case"dir-google":r.openGoogle(u,i);r.close();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(i);n(".mapp-dir-daddr",r.sel).val(u);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(){var t;this.map.closeInfoWindow();n(".mapp-spinner",this.sel).css("visibility","visible");this.directionsService=this.directionsService?this.directionsService:new google.maps.DirectionsService;this.directionsRenderer=this.directionsRenderer?this.directionsRenderer:new google.maps.DirectionsRenderer({hideRouteList:!1,draggable:!0});this.placesService=this.placesService?this.placesService:new google.maps.places.PlacesService(this.map.getMap());n(".mapp-dir-renderer",this.sel).empty();t={travelMode:google.maps.DirectionsTravelMode.DRIVING,provideRouteAlternatives:!0,origin:n(".mapp-dir-saddr",this.sel).val(),destination:n(".mapp-dir-daddr",this.sel).val()};this.directionsService.route(t,function(t,i){(n(".mapp-spinner",r.sel).css("visibility","hidden"),n(".mapp-dir-addr",r.sel).removeClass("mapp-error"),n.each(t.geocoded_waypoints,function(t,i){n(".mapp-dir-addr",r.sel).eq(t).toggleClass("mapp-error",i.geocoder_status!="OK");i.place_id&&r.placesService.getDetails({placeId:i.place_id},function(i,u){if(u=="OK"){var f=i.formatted_address.replace(", USA","");f.indexOf(i.name)===-1&&(f=i.name+", "+f);n(".mapp-dir-addr",r.sel).eq(t).val(f)}})}),n(".mapp-dir-addr.mapp-error").length)||(i==google.maps.DirectionsStatus.OK?(r.map.togglePois(!1),r.directionsRenderer.setOptions({directions:t,map:r.map.getMap(),panel:n(".mapp-dir-renderer",r.sel).get(0)})):alert(mappl10n.dir_error+i))})};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.Geocoder=function(n){function r(n,t){jQuery(n).removeClass("mapp-error");jQuery(t).hide()}function u(n,t,i){jQuery(n).addClass("mapp-error");jQuery(t).html(i);jQuery(t).show()}var t,f,i=this;f=n;this.geocode=function(i,r){typeof i=="string"&&i.substring(0,1)=="("&&(split=i.replace(/\(|\)/g,"").split(","),i=new google.maps.LatLng(split[0],split[1]));var u=i instanceof google.maps.LatLng?{location:i}:{address:i,region:mappl10n.options.country,bounds:n.getBounds()};t||(t=new google.maps.Geocoder);t.geocode(u,function(n,t){if(n){for(var i=0;i<n.length;i++)n[i].formatted_address==""&&n.splice(i,1);r(n[0],t)}else r(null,t)})};this.geolocate=function(n){if(!navigator||!navigator.geolocation)return null;navigator.geolocation.getCurrentPosition(function(t){n(t)},function(){n(null)},{timeout:1e4,enableHighAccuracy:!0,maximumAge:3e4})};this.stringToLatLng=function(n){var t=n.split(",",2),i=Number(t[0]),r=Number(t[1]);return isNaN(i)||isNaN(r)?!1:new google.maps.LatLng(i,r)};this.geocodeField=function(n,t,i){r(n,t);checkAddress(n,t,jQuery(n).val(),function(r){if(!r){u(n,t,mappl10n.no_address);i(null);return}if(r&&r.formatted_address){jQuery(n).val(r.formatted_address);i(r.formatted_address);return}i(r);return})};this.autocompleteField=function(n,t,f,e,o){jQuery(n).keypress(function(i){i.which==13&&(checkAddress(n,t,jQuery(n).val(),o),i.preventDefault())});jQuery(f).click(function(){return checkAddress(n,t,jQuery(n).val(),o),!1});jQuery(e).click(function(){return r(n,t),i.geolocate(function(i){if(i){var r="("+i.coords.latitude+", "+i.coords.longitude+")";jQuery(n).val("");checkAddress(n,t,r,o)}else u(n,t,mappl10n.no_geolocate);return}),!1})};checkAddress=function(n,t,f,e){if(r(n,t),f=jQuery.trim(f),f==""){e(null);return}var o=i.stringToLatLng(f);if(o){e(o);return}if(f.substring(0,4)=="http"){e(f);return}i.geocode(f,function(i,r){if(!i||r!=google.maps.GeocoderStatus.OK){u(n,t,mappl10n.no_address);e(null);return}e(i);return})}};mapp.Geocoder.parseAddress=function(n){return!n||n==""?{firstLine:"",secondLine:""}:(n.lastIndexOf(", USA")>0||n.lastIndexOf(", United States")>0)&&(n.lastIndexOf(", USA")>0&&(n=n.slice(0,n.lastIndexOf(", USA"))),n.lastIndexOf(", United States")>0&&(n=n.slice(0,n.lastIndexOf(", United States"))),n.indexOf(",")==n.lastIndexOf(","))?{firstLine:n,secondLine:""}:n.indexOf(",")==-1?{firstLine:n,secondLine:""}:{firstLine:n.slice(0,n.indexOf(",")),secondLine:n.slice(n.indexOf(", ")+2)}};mapp=window.mapp||{};mapp.Icons={};mapp.Icons.get=function(){return"https://maps.google.com/intl/en_us/mapfiles/ms/micons/red-dot.png"};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,disableAutoPan:!1},i),u=null,r=null,e=null,o=this;r=n('<div class="mapp-ib" tabindex="0">').appendTo(t.getMap().getDiv());e=n('<div class="mapp-ib-tip">').appendTo(t.getMap().getDiv());jQuery(window).resize(function(){o.close()});r.on("keydown",function(n){n.which==27&&o.close()});r.on("click",".mapp-close",function(){o.close()});this.getContent=function(){return r};this.setContent=function(n){r.empty().append(n)};this.open=function(n,t){u=t;this.setMap(n)};this.onAdd=function(){r.show();e.show();var t=n(":input",r);t.length?t.first().focus():r.focus();google.maps.event.trigger(o,"domready")};this.draw=function(){var l=this.getMap(),c=this.getProjection().fromLatLngToContainerPixel(u.position),t={width:n(l.getDiv()).width(),height:n(l.getDiv()).height()},v=n(".mapp-ib-body",r);if(!f.disableAutoPan){r.css({"max-height":"9999px",left:0,bottom:0,top:"auto",right:"auto"});var s=r.outerWidth(!0),h=r.outerHeight(!0),a=e.outerHeight(!0),i=c.x,o=c.y;i+s/2>t.width&&(i=t.width-s/2);i-s/2<0&&(i=s/2);o-h+u.anchorPoint.y-a<f.border&&(o=h-u.anchorPoint.y+f.border+a);o>t.height&&(o=t.height);l.panBy(c.x-i,c.y-o);h>t.height+u.anchorPoint.y-2*f.border&&(h=t.height+u.anchorPoint.y-2*f.border,r.css({"max-height":h+2}));r.css({left:i-s/2,bottom:t.height-o-u.anchorPoint.y+a});e.css({left:i,bottom:t.height-o-u.anchorPoint.y})}};this.close=function(){r.is(":visible")&&(this.setMap(null),google.maps.event.trigger(this,"closed"))};this.onRemove=function(){r.empty();r.hide();e.hide()}};mapp.InfoBox.prototype=new google.maps.OverlayView}(jQuery);mapp=window.mapp||{};+function(n){if(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)}},typeof google=="undefined")return mapp.lib.alert("ERROR: Google Maps API not loaded");if(!mappl10n.options.apiKey)return mapp.lib.alert("ERROR: Google Maps API Key missing, please check MapPress settings and FAQ");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.")});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).attr("id"),t=window[i];t.resize();t.initCenter()})})}(jQuery);mapp=window.mapp||{};+function(n){mapp.Places=function(t,i){var u=this,r;if(this.sel=n(t),this.opts=n.extend({map:null,types:[]},i),r=n('<div style="display:none">').appendTo("body"),this.placesService=new google.maps.places.PlacesService(r.get(0)),this.autocompleteService=new google.maps.places.AutocompleteService,this.sel.length){this.autocomplete=new google.maps.places.Autocomplete(this.sel.get(0),{types:this.opts.types});this.autocomplete.bindTo("bounds",this.opts.map.getMap());this.sel.on("keydown",function(n){n.which==13&&n.preventDefault()});google.maps.event.addListener(this.autocomplete,"place_changed",function(){u.parse(this.getPlace())})}};mapp.Places.prototype={parse:function(t){var u,i=this,r,e,f;if(this.error(!1),r=t&&t.name?n.trim(t.name):n.trim(t),!r)return this.error(!0);if(r=="user"){this.geolocate(function(n){google.maps.event.trigger(i,"search",n)});return}if(r.substring(0,4)=="http"){google.maps.event.trigger(i,"search",r);return}if(t&&t.geometry){t.formatted_address&&this.set(t.formatted_address);google.maps.event.trigger(i,"search",t);return}if(e=this.parseLatLng(t),e){google.maps.event.trigger(i,"search",e);return}f=this.opts.map.getMap().getBounds();f=f?f:new google.maps.LatLngBounds(new google.maps.LatLng(85,-180),new google.maps.LatLng(-85,180));this.autocompleteService.getPlacePredictions({input:r,types:this.opts.types,bounds:f},function(n,t){if(t!="OK"||n==null||n.length==0)return i.error(!0);u=typeof n[0].description!="undefined"?n[0].description:null;i.placesService.getDetails({placeId:n[0].place_id},function(n,t){if(t!="OK"||!n||!n.geometry)return i.error(!0);u=u?u:n.formatted_address;i.set(u);google.maps.event.trigger(i,"search",n)})})},parseLatLng:function(t){var i,u,r;return t instanceof google.maps.LatLng?i=t:t&&t.lat&&t.lng?i=new google.maps.LatLng(t.lat,t.lng):(u=t&&t.name?n.trim(t.name):n.trim(t),r=u.split(","),r.length!=2||isNaN(r[0])||isNaN(r[1])||(i=new google.maps.LatLng(r[0],r[1]))),i?{name:i.toUrlValue(),geometry:{location:i}}:null},geolocate:function(n){var t=this;if(!navigator||!navigator.geolocation){alert(mappl10n.no_geolocate);return}navigator.geolocation.getCurrentPosition(function(i){t.set("");var r=new google.maps.LatLng(i.coords.latitude,i.coords.longitude);n({name:r.toUrlValue(),geometry:{location:r}})},function(n){var t=n&&n.message?" : "+n.message:"";alert(mappl10n.no_geolocate+t)},{timeout:15e3,enableHighAccuracy:!0,maximumAge:3e4})},set:function(n){n=n.replace(", United States of America","").replace(", USA","").replace(", United States","");this.sel.val(n);this.error(!1)},get:function(){return n.trim(this.sel.val())},focus:function(){this.sel.focus()},error:function(n){this.sel.toggleClass("mapp-error",!!n)},destroy:function(){this.autocomplete.unbindAll();google.maps.event.clearInstanceListeners(this.sel.get(0))}}}(jQuery);mapp=window.mapp||{};+function(n){mapp.Poi=function(t){var f,e,r,s,i,u,h,o;if(this.defaults={address:null,body:null,html: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),t.viewport&&t.viewport.sw&&t.viewport.ne&&(f=new google.maps.LatLng(t.viewport.sw.lat,t.viewport.sw.lng),e=new google.maps.LatLng(t.viewport.ne.lat,t.viewport.ne.lng),this.viewport=f.lat()==0&&f.lng()==0&&e.lat()==0&&e.lng()==0?null:new google.maps.LatLngBounds(f,e)),r=[],s=[],!t.overlay)switch(this.type){case"polygon":if(t.poly&&t.poly.paths)for(i=0;i<t.poly.paths.length;i++){for(r=[],u=0;u<t.poly.paths[i].length;u++)r.push(new google.maps.LatLng(t.poly.paths[i][u].lat,t.poly.paths[i][u].lng));s.push(new google.maps.MVCArray(r))}this.overlay=new google.maps.Polygon({paths:new google.maps.MVCArray(s)});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":o=new google.maps.LatLng(t.point.lat,t.point.lng);this.overlay=new google.maps.Circle({center:o,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":h=t.kml&&t.kml.url?t.kml.url:"";this.overlay=new google.maps.KmlLayer(h,{preserveViewport:!0,suppressInfoWindows:!0});break;case"":default:o=new google.maps.LatLng(t.point.lat,t.point.lng);this.overlay=new google.maps.Marker({position:o})}};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},r=this.getPosition(),t,i;if(n.point={lat:r.lat(),lng:r.lng()},t=this.viewport?this.viewport:this.getBounds(),t&&(n.viewport={sw:{lat:t.getSouthWest().lat(),lng:t.getSouthWest().lng()},ne:{lat:t.getNorthEast().lat(),lng:t.getNorthEast().lng()}}),this.type=="kml"&&(n.kml={url:this.overlay.getUrl()}),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({lat:t.lat(),lng:t.lng()})});break;case"polygon":n.poly.paths=[];this.overlay.getPaths().forEach(function(t){var i=[];t.forEach(function(n){i.push({lat:n.lat(),lng:n.lng()})});n.poly.paths.push(i)});break;case"rectangle":i=this.overlay.getBounds();n.viewport={sw:{lat:i.getSouthWest().lat(),lng:i.getSouthWest().lng()},ne:{lat:i.getNorthEast().lat(),lng:i.getNorthEast().lng()}}}}return n},setMap:function(t){var i=this;if(google.maps.event.clearInstanceListeners(this.overlay),t==null){this.overlay.setMap(null);return}this.type=="kml"&&(google.maps.event.addListener(this.overlay,"defaultviewport_changed",function(){i.viewport=i.overlay.getDefaultViewport()}),google.maps.event.addListener(this.overlay,"status_changed",function(){var n=i.overlay.getStatus();n!="OK"&&mappl10n.ajaxErrors&&alert(mappl10n.kml_error+":"+n)}));this.map=t;this.overlay.setMap(t.getMap());this.setEditable(this.map.editable);this.setIcon(this.iconid);this.type||this.overlay.setTitle(n("<div>").html(this.title).text());google.maps.event.addListener(this.overlay,"click",function(n){i.open(n)})},setEditable:function(n){var t=this;this.type!="kml"&&(this.overlay.setDraggable(n),this.isPoly()&&this.overlay.setEditable(n),google.maps.event.clearListeners(this.overlay,"rightclick"),google.maps.event.clearListeners(this.overlay,"dragstart"),n&&(google.maps.event.addListener(this.overlay,"dragstart",function(){t.viewport=null;t.map.closeInfoWindow()}),(this.type=="polygon"||this.type=="polyline")&&google.maps.event.addListener(this.overlay,"rightclick",function(n){n.vertex!=null&&t.overlay.getPath().getLength()>2&&t.overlay.getPath().removeAt(n.vertex)})))},setZIndex:function(n){this.overlay.set("zIndex",n)},select:function(){},setIcon:function(n){this.type||typeof mapp.Icons=="undefined"||(this.overlay.setIcon(null),this.overlay.setIcon(mapp.Icons.get(n)),this.iconid=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)},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},center:function(t){var i=this.map.getMap(),u=this.getBounds(),r,t;if(typeof t=="number"){i.setCenter(this.getPosition());i.setZoom(t);return}if(!u){i.setCenter(this.getPosition());i.setZoom(parseInt(mappl10n.options.poiZoom));return}r=u.getNorthEast().lng()-u.getSouthWest().lng();r<0&&(r+=360);t=Math.round(Math.log(n(i.getDiv()).width()*360/r/256)/Math.LN2);i.setCenter(this.getPosition());i.setZoom(t)},open:function(n){this.map.openInfoWindow(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=this.overlay.getDefaultViewport();n=n?n:this.viewport;break;default:return this.viewport}return n},getPosition:function(n){if(!this.type)return this.overlay.getPosition();if(this.type=="kml"&&n&&n.latLng)return n.latLng;var t=this.getBounds();return t?t.getCenter():new google.maps.LatLng(0,0)},click:function(){google.maps.event.trigger(this.overlay,"click")},getAddress:function(){return this.address?this.address:this.type=="kml"?this.kml.url:this.getPosition().toUrlValue()},getAnchorPoint:function(n){return this.type=="kml"?n&&n.pixelOffset?new google.maps.Point(n.pixelOffset.width,n.pixelOffset.height):new google.maps.Point(0,0):this.type?new google.maps.Point(0,0):typeof this.overlay.anchorPoint!="undefined"?this.overlay.anchorPoint:new google.maps.Point(0,-32)}}}(jQuery);mapp=window.mapp||{};mapp.widgets={};+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(t,r){function a(n,t){n=n.split(" ");for(var i=0;i<n.length;i++)google.maps.event.addListener(u,n[i],t)}function y(){var i,t;n("[data-mapp-type]",f.menu).removeClass("mapp-active");n('[data-mapp-type="'+u.getMapTypeId()+'"]',f.menu).addClass("mapp-active");for(layer in s)i=!!s[layer].getMap(),n('[data-mapp-layer="'+layer+'"]',f.menu).toggleClass("mapp-active",i);t=!!(e.center&&e.zoom);n('[data-mapp-action="viewport-set"]',f.menu).toggle(!t);n('[data-mapp-action="viewport-reset"]',f.menu).toggle(t)}function p(){var n=mappl10n.options.styles,i=mappl10n.options.style,r=["roadmap","satellite","terrain","hybrid"],t;if(i&&typeof n[i]!="undefined"&&u.setOptions({styles:n[i]}),e.editable){for(t in n)u.mapTypes.set(t,new google.maps.StyledMapType(n[t],{name:t})),r.push(t);u.setOptions({mapTypeControlOptions:{mapTypeIds:r,position:google.maps.ControlPosition.TOP_RIGHT,style:google.maps.MapTypeControlStyle.DROPDOWN_MENU}})}else typeof n[e.mapTypeId]!="undefined"&&u.setOptions({styles:n[e.mapTypeId]})}function w(){f.controls.children("[data-mapp-position]").each(function(){var t=n(this).attr("data-mapp-position"),i;t=t?google.maps.ControlPosition[t]:google.maps.ControlPosition.TOP_RIGHT;i=n(this);i.get(0).index=0;u.controls[t].push(i.get(0))})}function b(){var f,i,t,r;for(s={traffic:new google.maps.TrafficLayer,bicycling:new google.maps.BicyclingLayer,transit:new google.maps.TransitLayer},f=n.makeArray(e.layers),i=0;i<f.length;i++)t=n.trim(f[i]),r=t.split(".").pop(),s[t]?l(t):r=="kml"||r=="kmz"?s[t]=new google.maps.KmlLayer({map:u,preserveViewport:!0,url:t}):r=="json"&&(s[t]=new google.maps.Data({map:u}).loadGeoJson(t))}function l(t,i){n.each(["traffic","bicycling","transit"],function(n,t){s[t].setMap(null)});t&&(i=typeof i=="undefined"?s[t].getMap()==null:i,s[t].setMap(i?u:null))}function v(t,i){var r=n.inArray(t,["roadmap","satellite","terrain","hybrid"])!=-1;i=typeof i!="undefined"?i:!(u.getMapTypeId()==t);t=e.editable?i&&(r||typeof mappl10n.options.styles[t]!="undefined")?t:"roadmap":r?t:"roadmap";u.setMapTypeId(t)}this.defaults={center:null,editable:null,height:null,initialOpenDirections:null,initialOpenInfo:null,layers:null,mapid:null,mapTypeId:null,metaKey:null,minZoom:null,name:null,pois:null,postid:null,query:null,title:null,width:null,zoom:null};this.iw=null;this.places=null;this.poi=null;this.settings=r?r:{};var e=this,h=null,f={},u=null,s={},o=[],c;_.extend(this,this.defaults,_.pick(t,_.keys(this.defaults)),_.pick(this.settings,_.keys(this.defaults)));this.display=function(){if(f.layout=n("#"+this.name),n.each(["canvas","controls","directions","filters","list","menu","search"],function(t,i){f[i]=n(".mapp-"+i,f.layout)}),!f.canvas.length)return mapp.lib.log("MapPress: Missing map name or container for map: "+this.name);u=new google.maps.Map(f.canvas.get(0),{mapTypeId:"roadmap",zoom:1});var t={backgroundColor:"transparent",clickableIcons:!1,fullscreenControl:!1,keyboardShortcuts:!1,mapTypeControl:!0,mapTypeControlOptions:{position:google.maps.ControlPosition.TOP_RIGHT,style:google.maps.MapTypeControlStyle.DROPDOWN_MENU},minZoom:this.minZoom?parseInt(this.minZoom):0,scaleControl:!0,scrollwheel:!1,streetViewControl:!this.editable&&!this.query};u.setOptions(t);p();w();b();v(this.mapTypeId,!0);this.toggleView("mini",f.layout.width()<450);this.places=new mapp.Places(n(".mapp-places",f.search),{map:e});e.editable||google.maps.event.addListener(this.places,"search",function(n){e.search(n)});f.layout.on("click","[data-mapp-action]",function(t){var i=n(this).attr("data-mapp-action");t.preventDefault();e.action(i,n(this).attr("data-mapp-"+i),n(this))});f.filters.on("change",function(){e.ajaxQuery(u.getBounds())});a("click drag",function(){e.closeInfoWindow()});n("body").on("click",function(t){var i=n(t.target),r=i.attr("data-mapp-action");i==f.filters||r=="filters-toggle"||i.closest(f.filters).length||e.toggleView("filters",!1);i==f.menu||r=="menu-toggle"||i.closest(f.menu).length||e.toggleView("menu",!1)});n(window).resize(_.debounce(function(){e.resize()},500));this.iw=mappl10n.options.iwType=="ib"||this.editable?new mapp.InfoBox(this):new google.maps.InfoWindow;google.maps.event.addListenerOnce(u,"idle",function(){var n=o.length?o[0]:null;e.initialOpenDirections?e.openDirections(null,n):n&&e.initialOpenInfo&&n.open()});mappl10n.options.search&&google.maps.event.addListenerOnce(u,"tilesloaded",function(){google.maps.event.addListenerOnce(u,"idle",function(){a("dragend zoom_changed",function(){e.ajaxQuery(u.getBounds())})})});this.setPois(this.pois);typeof this.center=="string"?this.places.parse(this.center):this.query?this.ajaxQuery():this.recenter()};this.load=function(n){_.extend(this,this.defaults,n,this.settings);v(this.mapTypeId,!0);this.toggleView("menu",!1);l();this.closeInfoWindow();this.setPois(this.pois);this.places.set("");google.maps.event.trigger(this,"load")};this.action=function(t,i,r){switch(t){case"center":this.toggleView("menu",!1);this.closeInfoWindow();this.recenter();break;case"dir":this.openDirections(null,this.poi);break;case"dir-from":this.openDirections(this.poi,null);break;case"filters-reset":f.filters.find(":input").each(function(){this.type=="checkbox"||this.type=="radio"?n(this).prop("checked",!1):n(this).val("")});this.ajaxQuery(u.getBounds());break;case"filters-toggle":this.toggleView("filters");break;case"geolocate":this.places.geolocate(function(n){e.search(n)});break;case"layer":l(i);this.toggleView("menu",!1);break;case"menu-toggle":this.toggleView("menu");break;case"open":var s=r.attr("data-mapp-poi");this.openInfoWindow(o[s]);break;case"show":f.layout.show();this.resize();this.initCenter();break;case"view-map":this.toggleView("list",!1);break;case"view-list":this.toggleView("list",!0);break;case"viewport-set":this.center=u.getCenter().toJSON();this.zoom=u.getZoom();this.toggleView("menu",!1);break;case"viewport-reset":this.center=null;this.zoom=null;this.toggleView("menu",!1);this.recenter();break;default:return!0}};this.search=function(n){var t=n.geometry.location?n.geometry.location:null,i=n.geometry.viewport?n.geometry.viewport:null,r=new google.maps.Circle({center:t,radius:mappl10n.options.radius*1e3}),f=i?i.union(r.getBounds()):r.getBounds();u.fitBounds(f,0);u.setCenter(t);this.query&&this.ajaxQuery(f)};this.dialog=function(t,i){t?(f.canvas.append("<div class='mapp-dialog'>"+t+"<\/div>"),i&&(clearTimeout(this.dialog.fade),this.dialog.fade=setTimeout(function(){e.dialog(null)},3e3))):n(".mapp-dialog",f.canvas).remove()};this.closeInfoWindow=function(){this.iw.close();this.poiSelect(null)};this.openDirections=function(n,t){var i=n?n.getAddress():"",r=t?t.getAddress():"";h||(h=new mapp.Directions(f.directions,e));h.open(i,r)};this.poiSelect=function(t){if(n("[data-mapp-poi]",f.list).removeClass("mapp-selected"),t){var r=n.inArray(t,o),i=n('[data-mapp-poi="'+r+'"]',f.list);i.addClass("mapp-selected");mapp.lib.scrollTo(f.list,i);t.setZIndex(++c)}this.poi=t};this.getMap=function(){return u};this.renderList=function(){this.editable&&(f.list.html(mapp.lib.template("poi-list",{pois:o})),google.maps.event.trigger(this,"render-list"))};this.getPois=function(){return o};this.addPoi=function(n){o.unshift(n);n.setMap(this);e.renderList();this.poiSelect(n)};this.removePoi=function(t){var i=n.inArray(t,o);i!=-1&&(o[i].setMap(null),o.splice(i,1),e.renderList())};this.resetPois=function(){for(i=0;i<o.length;i++)o[i].setMap(null);o=[];c=google.maps.Marker.MAX_ZINDEX};this.setPois=function(n){var t,i;if(this.resetPois(),n){for(t=0;t<n.length;t++)i=new mapp.Poi(n[t]),o.push(i),i.setMap(this),i.setZIndex(c+n.length-1-t);c+=n.length-1}this.renderList()};this.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(o[r])}if(t.length!=o.length)return!1;o=t;this.renderList()};this.openInfoWindow=function(n,t){if(h&&h.close(),this.iw.close(),this.poiSelect(n),mappl10n.options.mashupClick!="poi"&&n.postid&&n.url){window.open(n.url);return}this.toggleView("list",!1);this.editable||this.iw.setContent(n.html);google.maps.event.addListenerOnce(this.iw,"domready",function(){google.maps.event.trigger(e,"poidomready",n)});google.maps.event.trigger(e,"open",n);var i=new google.maps.MVCObject;i.setValues({position:n.getPosition(t),anchorPoint:n.getAnchorPoint(t)});this.iw.open(u,i)};this.togglePois=function(n){n=!!n;for(var t=0;t<o.length;t++)o[t].setVisible(n)};this.toggleView=function(n,t){t=typeof t=="undefined"?!f.layout.hasClass("mapp-view-"+n):t;f.layout.toggleClass("mapp-view-"+n,t);n=="menu"&&t&&y();n=="directions"&&this.resize()};this.resize=function(){var n=u.getCenter();this.toggleView("mini",f.layout.width()<450);google.maps.event.trigger(u,"resize");u.setCenter(n);return};this.recenter=function(){var i=!this.query&&this.center&&this.center.lat&&this.center.lng?new google.maps.LatLng(this.center.lat,this.center.lng):null,n=!this.query&&this.zoom&&parseInt(this.zoom)?parseInt(this.zoom):null,t,r;if(this.center&&this.center.lat==0&&this.center.lng==0&&(i=null),i){u.setCenter(i);u.setZoom(n?n:1);return}if(o.length==0){u.setCenter(new google.maps.LatLng(0,0));u.setZoom(n?n:1);return}if(o.length==1){o[0].center(n);return}for(bounds=new google.maps.LatLngBounds,t=0;t<o.length;t++)r=o[t].getBounds(),bounds=r?bounds.union(r):bounds.extend(o[t].getPosition());u.fitBounds(bounds,0)};this.toJSON=function(){var n;for(this.pois=[],n=0;n<o.length;n++)this.pois.push(o[n].toJSON());return{center:this.center,height:this.height,mapid:this.mapid,mapTypeId:u.getMapTypeId(),metaKey:this.metaKey,pois:this.pois,title:this.title,width:this.width,zoom:this.zoom}};this.ajaxSave=function(n){var t=JSON.stringify(this),i=!this.mapid||!this.postid?mappl10n.options.postid:this.postid;mapp.lib.ajax({type:"POST",data:{action:"mapp_save",map:t,postid:i},callback:function(t){t.status=="OK"&&(e.mapid=t.data.mapid,n(t.data),google.maps.event.trigger(e,"save"))}})}};mapp.Map.ajaxCreate=function(n,t){mapp.lib.ajax({type:"GET",data:{action:"mapp_create"},callback:function(i){if(i.status=="OK"){var r=new mapp.Map(i.data.map,n);t(r)}}})};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 f=n(this).attr("data-mapp-action"),i=n(".mapp-dir-daddr",r.sel).val(),u=n(".mapp-dir-saddr",r.sel).val();t.preventDefault();switch(f){case"dir-cancel":r.close();break;case"dir-get":r.getDirections();break;case"dir-google":r.openGoogle(u,i);r.close();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(i);n(".mapp-dir-daddr",r.sel).val(u);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(){var t;this.map.closeInfoWindow();n(".mapp-spinner",this.sel).css("visibility","visible");this.directionsService=this.directionsService?this.directionsService:new google.maps.DirectionsService;this.directionsRenderer=this.directionsRenderer?this.directionsRenderer:new google.maps.DirectionsRenderer({hideRouteList:!1,draggable:!0});this.placesService=this.placesService?this.placesService:new google.maps.places.PlacesService(this.map.getMap());n(".mapp-dir-renderer",this.sel).empty();t={travelMode:google.maps.DirectionsTravelMode.DRIVING,provideRouteAlternatives:!0,origin:n(".mapp-dir-saddr",this.sel).val(),destination:n(".mapp-dir-daddr",this.sel).val()};this.directionsService.route(t,function(t,i){(n(".mapp-spinner",r.sel).css("visibility","hidden"),n(".mapp-dir-addr",r.sel).removeClass("mapp-error"),n.each(t.geocoded_waypoints,function(t,i){n(".mapp-dir-addr",r.sel).eq(t).toggleClass("mapp-error",i.geocoder_status!="OK");i.place_id&&r.placesService.getDetails({placeId:i.place_id},function(i,u){if(u=="OK"){var f=i.formatted_address.replace(", USA","");f.indexOf(i.name)===-1&&(f=i.name+", "+f);n(".mapp-dir-addr",r.sel).eq(t).val(f)}})}),n(".mapp-dir-addr.mapp-error").length)||(i==google.maps.DirectionsStatus.OK?(r.map.togglePois(!1),r.directionsRenderer.setOptions({directions:t,map:r.map.getMap(),panel:n(".mapp-dir-renderer",r.sel).get(0)})):alert(mappl10n.dir_error+i))})};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.Geocoder=function(n){function r(n,t){jQuery(n).removeClass("mapp-error");jQuery(t).hide()}function u(n,t,i){jQuery(n).addClass("mapp-error");jQuery(t).html(i);jQuery(t).show()}var t,f,i=this;f=n;this.geocode=function(i,r){typeof i=="string"&&i.substring(0,1)=="("&&(split=i.replace(/\(|\)/g,"").split(","),i=new google.maps.LatLng(split[0],split[1]));var u=i instanceof google.maps.LatLng?{location:i}:{address:i,region:mappl10n.options.country,bounds:n.getBounds()};t||(t=new google.maps.Geocoder);t.geocode(u,function(n,t){if(n){for(var i=0;i<n.length;i++)n[i].formatted_address==""&&n.splice(i,1);r(n[0],t)}else r(null,t)})};this.geolocate=function(n){if(!navigator||!navigator.geolocation)return null;navigator.geolocation.getCurrentPosition(function(t){n(t)},function(){n(null)},{timeout:1e4,enableHighAccuracy:!0,maximumAge:3e4})};this.stringToLatLng=function(n){var t=n.split(",",2),i=Number(t[0]),r=Number(t[1]);return isNaN(i)||isNaN(r)?!1:new google.maps.LatLng(i,r)};this.geocodeField=function(n,t,i){r(n,t);checkAddress(n,t,jQuery(n).val(),function(r){if(!r){u(n,t,mappl10n.no_address);i(null);return}if(r&&r.formatted_address){jQuery(n).val(r.formatted_address);i(r.formatted_address);return}i(r);return})};this.autocompleteField=function(n,t,f,e,o){jQuery(n).keypress(function(i){i.which==13&&(checkAddress(n,t,jQuery(n).val(),o),i.preventDefault())});jQuery(f).click(function(){return checkAddress(n,t,jQuery(n).val(),o),!1});jQuery(e).click(function(){return r(n,t),i.geolocate(function(i){if(i){var r="("+i.coords.latitude+", "+i.coords.longitude+")";jQuery(n).val("");checkAddress(n,t,r,o)}else u(n,t,mappl10n.no_geolocate);return}),!1})};checkAddress=function(n,t,f,e){if(r(n,t),f=jQuery.trim(f),f==""){e(null);return}var o=i.stringToLatLng(f);if(o){e(o);return}if(f.substring(0,4)=="http"){e(f);return}i.geocode(f,function(i,r){if(!i||r!=google.maps.GeocoderStatus.OK){u(n,t,mappl10n.no_address);e(null);return}e(i);return})}};mapp.Geocoder.parseAddress=function(n){return!n||n==""?{firstLine:"",secondLine:""}:(n.lastIndexOf(", USA")>0||n.lastIndexOf(", United States")>0)&&(n.lastIndexOf(", USA")>0&&(n=n.slice(0,n.lastIndexOf(", USA"))),n.lastIndexOf(", United States")>0&&(n=n.slice(0,n.lastIndexOf(", United States"))),n.indexOf(",")==n.lastIndexOf(","))?{firstLine:n,secondLine:""}:n.indexOf(",")==-1?{firstLine:n,secondLine:""}:{firstLine:n.slice(0,n.indexOf(",")),secondLine:n.slice(n.indexOf(", ")+2)}};mapp=window.mapp||{};mapp.Icons={};mapp.Icons.get=function(){return"https://maps.google.com/intl/en_us/mapfiles/ms/micons/red-dot.png"};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,disableAutoPan:!1},i),u=null,r=null,e=null,o=this;r=n('<div class="mapp-ib" tabindex="0">').appendTo(t.getMap().getDiv());e=n('<div class="mapp-ib-tip">').appendTo(t.getMap().getDiv());jQuery(window).resize(function(){o.close()});r.on("keydown",function(n){n.which==27&&o.close()});r.on("click",".mapp-close",function(){o.close()});this.getContent=function(){return r};this.setContent=function(n){r.empty().append(n)};this.open=function(n,t){u=t;this.setMap(n)};this.onAdd=function(){r.show();e.show();var t=n(":input",r);t.length?t.first().focus():r.focus();google.maps.event.trigger(o,"domready")};this.draw=function(){var l=this.getMap(),c=this.getProjection().fromLatLngToContainerPixel(u.position),t={width:n(l.getDiv()).width(),height:n(l.getDiv()).height()},v=n(".mapp-ib-body",r);if(!f.disableAutoPan){r.css({"max-height":"9999px",left:0,bottom:0,top:"auto",right:"auto"});var s=r.outerWidth(!0),h=r.outerHeight(!0),a=e.outerHeight(!0),i=c.x,o=c.y;i+s/2>t.width&&(i=t.width-s/2);i-s/2<0&&(i=s/2);o-h+u.anchorPoint.y-a<f.border&&(o=h-u.anchorPoint.y+f.border+a);o>t.height&&(o=t.height);l.panBy(c.x-i,c.y-o);h>t.height+u.anchorPoint.y-2*f.border&&(h=t.height+u.anchorPoint.y-2*f.border,r.css({"max-height":h+2}));r.css({left:i-s/2,bottom:t.height-o-u.anchorPoint.y+a});e.css({left:i,bottom:t.height-o-u.anchorPoint.y})}};this.close=function(){r.is(":visible")&&(this.setMap(null),google.maps.event.trigger(this,"closed"))};this.onRemove=function(){r.empty();r.hide();e.hide()}};mapp.InfoBox.prototype=new google.maps.OverlayView}(jQuery);mapp=window.mapp||{};+function(n){if(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)}},typeof google=="undefined")return mapp.lib.alert("ERROR: Google Maps API not loaded");if(!mappl10n.options.apiKey)return mapp.lib.alert("ERROR: Google Maps API Key missing, please check MapPress settings and FAQ");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.")});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).attr("id"),t=window[i];t.resize();t.initCenter()})})}(jQuery);mapp=window.mapp||{};+function(n){mapp.Places=function(t,i){var u=this,r;if(this.sel=n(t),this.opts=n.extend({map:null,types:[]},i),r=n('<div style="display:none">').appendTo("body"),this.placesService=new google.maps.places.PlacesService(r.get(0)),this.autocompleteService=new google.maps.places.AutocompleteService,this.sel.length){this.autocomplete=new google.maps.places.Autocomplete(this.sel.get(0),{types:this.opts.types});this.autocomplete.bindTo("bounds",this.opts.map.getMap());this.sel.on("keydown",function(n){n.which==13&&n.preventDefault()});google.maps.event.addListener(this.autocomplete,"place_changed",function(){u.parse(this.getPlace())})}};mapp.Places.prototype={parse:function(t){var u,i=this,r,e,f;if(this.error(!1),r=t&&t.name?n.trim(t.name):n.trim(t),!r)return this.error(!0);if(r=="user"){this.geolocate(function(n){google.maps.event.trigger(i,"search",n)});return}if(r.substring(0,4)=="http"){google.maps.event.trigger(i,"search",r);return}if(t&&t.geometry){t.formatted_address&&this.set(t.formatted_address);google.maps.event.trigger(i,"search",t);return}if(e=this.parseLatLng(t),e){google.maps.event.trigger(i,"search",e);return}f=this.opts.map.getMap().getBounds();f=f?f:new google.maps.LatLngBounds(new google.maps.LatLng(85,-180),new google.maps.LatLng(-85,180));this.autocompleteService.getPlacePredictions({input:r,types:this.opts.types,bounds:f},function(n,t){if(t!="OK"||n==null||n.length==0)return i.error(!0);u=typeof n[0].description!="undefined"?n[0].description:null;i.placesService.getDetails({placeId:n[0].place_id},function(n,t){if(t!="OK"||!n||!n.geometry)return i.error(!0);u=u?u:n.formatted_address;i.set(u);google.maps.event.trigger(i,"search",n)})})},parseLatLng:function(t){var i,u,r;return t instanceof google.maps.LatLng?i=t:t&&t.lat&&t.lng?i=new google.maps.LatLng(t.lat,t.lng):(u=t&&t.name?n.trim(t.name):n.trim(t),r=u.split(","),r.length!=2||isNaN(r[0])||isNaN(r[1])||(i=new google.maps.LatLng(r[0],r[1]))),i?{name:i.toUrlValue(),geometry:{location:i}}:null},geolocate:function(n){var t=this;if(!navigator||!navigator.geolocation){alert(mappl10n.no_geolocate);return}navigator.geolocation.getCurrentPosition(function(i){t.set("");var r=new google.maps.LatLng(i.coords.latitude,i.coords.longitude);n({name:r.toUrlValue(),geometry:{location:r}})},function(n){var t=n&&n.message?" : "+n.message:"";alert(mappl10n.no_geolocate+t)},{timeout:15e3,enableHighAccuracy:!0,maximumAge:3e4})},set:function(n){n=n.replace(", United States of America","").replace(", USA","").replace(", United States","");this.sel.val(n);this.error(!1)},get:function(){return n.trim(this.sel.val())},focus:function(){this.sel.focus()},error:function(n){this.sel.toggleClass("mapp-error",!!n)},destroy:function(){this.autocomplete.unbindAll();google.maps.event.clearInstanceListeners(this.sel.get(0))}}}(jQuery);mapp=window.mapp||{};+function(n){mapp.Poi=function(t){var f,e,r,s,i,u,h,o;if(this.defaults={address:null,body:null,html: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),t.viewport&&t.viewport.sw&&t.viewport.ne&&(f=new google.maps.LatLng(t.viewport.sw.lat,t.viewport.sw.lng),e=new google.maps.LatLng(t.viewport.ne.lat,t.viewport.ne.lng),this.viewport=f.lat()==0&&f.lng()==0&&e.lat()==0&&e.lng()==0?null:new google.maps.LatLngBounds(f,e)),r=[],s=[],!t.overlay)switch(this.type){case"polygon":if(t.poly&&t.poly.paths)for(i=0;i<t.poly.paths.length;i++){for(r=[],u=0;u<t.poly.paths[i].length;u++)r.push(new google.maps.LatLng(t.poly.paths[i][u].lat,t.poly.paths[i][u].lng));s.push(new google.maps.MVCArray(r))}this.overlay=new google.maps.Polygon({paths:new google.maps.MVCArray(s)});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":o=new google.maps.LatLng(t.point.lat,t.point.lng);this.overlay=new google.maps.Circle({center:o,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":h=t.kml&&t.kml.url?t.kml.url:"";this.overlay=new google.maps.KmlLayer(h,{preserveViewport:!0,suppressInfoWindows:!0});break;case"":default:o=new google.maps.LatLng(t.point.lat,t.point.lng);this.overlay=new google.maps.Marker({position:o})}};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},r=this.getPosition(),t,i;if(n.point={lat:r.lat(),lng:r.lng()},t=this.viewport?this.viewport:this.getBounds(),t&&(n.viewport={sw:{lat:t.getSouthWest().lat(),lng:t.getSouthWest().lng()},ne:{lat:t.getNorthEast().lat(),lng:t.getNorthEast().lng()}}),this.type=="kml"&&(n.kml={url:this.overlay.getUrl()}),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({lat:t.lat(),lng:t.lng()})});break;case"polygon":n.poly.paths=[];this.overlay.getPaths().forEach(function(t){var i=[];t.forEach(function(n){i.push({lat:n.lat(),lng:n.lng()})});n.poly.paths.push(i)});break;case"rectangle":i=this.overlay.getBounds();n.viewport={sw:{lat:i.getSouthWest().lat(),lng:i.getSouthWest().lng()},ne:{lat:i.getNorthEast().lat(),lng:i.getNorthEast().lng()}}}}return n},setMap:function(t){var i=this;if(google.maps.event.clearInstanceListeners(this.overlay),t==null){this.overlay.setMap(null);return}this.type=="kml"&&(google.maps.event.addListener(this.overlay,"defaultviewport_changed",function(){i.viewport=i.overlay.getDefaultViewport()}),google.maps.event.addListener(this.overlay,"status_changed",function(){var n=i.overlay.getStatus();n!="OK"&&mappl10n.ajaxErrors&&alert(mappl10n.kml_error+":"+n)}));this.map=t;this.overlay.setMap(t.getMap());this.setEditable(this.map.editable);this.setIcon(this.iconid);this.type||this.overlay.setTitle(n("<div>").html(this.title).text());google.maps.event.addListener(this.overlay,"click",function(n){i.open(n)})},setEditable:function(n){var t=this;this.type!="kml"&&(this.overlay.setDraggable(n),this.isPoly()&&this.overlay.setEditable(n),google.maps.event.clearListeners(this.overlay,"rightclick"),google.maps.event.clearListeners(this.overlay,"dragstart"),n&&(google.maps.event.addListener(this.overlay,"dragstart",function(){t.viewport=null;t.map.closeInfoWindow()}),(this.type=="polygon"||this.type=="polyline")&&google.maps.event.addListener(this.overlay,"rightclick",function(n){n.vertex!=null&&t.overlay.getPath().getLength()>2&&t.overlay.getPath().removeAt(n.vertex)})))},setZIndex:function(n){this.overlay.set("zIndex",n)},select:function(){},setIcon:function(n){this.type||typeof mapp.Icons=="undefined"||(this.overlay.setIcon(null),this.overlay.setIcon(mapp.Icons.get(n)),this.iconid=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)},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},center:function(t){var i=this.map.getMap(),u=this.getBounds(),r,t;if(typeof t=="number"){i.setCenter(this.getPosition());i.setZoom(t);return}if(!u){i.setCenter(this.getPosition());i.setZoom(parseInt(mappl10n.options.poiZoom));return}r=u.getNorthEast().lng()-u.getSouthWest().lng();r<0&&(r+=360);t=Math.round(Math.log(n(i.getDiv()).width()*360/r/256)/Math.LN2);i.setCenter(this.getPosition());i.setZoom(t)},open:function(n){this.map.openInfoWindow(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=this.overlay.getDefaultViewport();n=n?n:this.viewport;break;default:return this.viewport}return n},getPosition:function(n){if(!this.type)return this.overlay.getPosition();if(this.type=="kml"&&n&&n.latLng)return n.latLng;var t=this.getBounds();return t?t.getCenter():new google.maps.LatLng(0,0)},click:function(){google.maps.event.trigger(this.overlay,"click")},getAddress:function(){return this.address?this.address:this.type=="kml"?this.kml.url:this.getPosition().toUrlValue()},getAnchorPoint:function(n){return this.type=="kml"?n&&n.pixelOffset?new google.maps.Point(n.pixelOffset.width,n.pixelOffset.height):new google.maps.Point(0,0):this.type?new google.maps.Point(0,0):typeof this.overlay.anchorPoint!="undefined"?this.overlay.anchorPoint:new google.maps.Point(0,-32)}}}(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){this.options=n.extend({destroy:!1,fullscreen:!1,modal:!1,position:null,toggle:null},i);this.activeToggle=null;var r=this;this.el=n('<div class="mapp-popup" tabindex="-1">').appendTo("body").hide();this.setContent(t);this.el.on("focusout",function(t){n.contains(r.el.get(0),t.relatedTarget)||r.el.get(0)==t.relatedTarget||r.close()});if(this.options.toggle)n(document).on("click",this.options.toggle,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.is(":visible")&&(this.backdrop&&this.backdrop.remove(),n("body").removeClass("mapp-popup-open"),this.el.hide(),this.activeToggle.focus(),this.el.trigger("closed.mapp.popup"))},destroy:function(){this.el.remove();n(document).off("click.mapp.popup",function(){me.close()})},open:function(){var i=this,t;n(document).trigger("click.mapp.popup");this.el.trigger("open.mapp.popup");this.el.show();this.options.modal||this.el.position(n.extend({my:"center bottom",at:"center top-5",of:this.activeToggle,collision:"flipfit"},this.options.position));t=n(":input",this.el);t.length?t.first().focus():this.el.focus();this.options.modal&&(this.backdrop=n('<div class="mapp-backdrop"><\/div>'),this.el.after(this.backdrop),n("body").addClass("mapp-popup-open"))},setContent:function(n){this.el.empty();this.el.append('<span class="mapp-close">');this.el.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_settings.min.js CHANGED
@@ -1 +1 @@
1
- +function(n){function t(i){i=i?i:0;i==0&&n(".mapp-log").empty();mapp.lib.ajax({data:{action:"mapp_import"},callback:function(i){n(".mapp-log").append(i.data.log.join("<br/>"),"<br/>");i.data.start>=0?t(i.data.start):n(".mapp-spinner").hide()}})}n(document).ready(function(){n(document).on("focus",".mapp-expand",function(){n(this).parent().width("100%");n(this).attr("rows",20)});n(document).on("blur",".mapp-expand",function(){n(this).parent().width("auto");n(this).attr("rows",1)});n(".mapp-autoicons").on("change","#mapp-autoicons-key",function(){mapp.lib.ajax({data:{action:"mapp_autoicons_form",key:n(this).val()},callback:function(t){n(".mapp-autoicons").html(t.data);new mapp.widgets.Grid(n("[data-mapp-grid]",".mapp-autoicons"))}})});jQuery("#mapp-filters tbody").sortable({handle:".mapp-handle"});n(".mapp-confirm").on("change",function(){var t=n(".mapp-confirm").is(":checked");n(".mapp-import").prop("disabled",!t)});n(".mapp-import").on("click",function(){n(".mapp-confirm, .mapp-import").prop("disabled",!0);t()})})}(jQuery)
1
+ +function(n){function t(i){i=i?i:0;i==0&&n(".mapp-log").empty();mapp.lib.ajax({data:{action:"mapp_import"},callback:function(i){n(".mapp-log").append(i.data.log.join("<br/>"),"<br/>");i.data.start>=0?t(i.data.start):n(".mapp-spinner").hide()}})}n(document).ready(function(){n("[data-mapp-grid]").each(function(n,t){new mapp.widgets.Grid(t)});n(document).on("focus",".mapp-expand",function(){n(this).parent().width("100%");n(this).attr("rows",20)});n(document).on("blur",".mapp-expand",function(){n(this).parent().width("auto");n(this).attr("rows",1)});n(".mapp-autoicons").on("change","#mapp-autoicons-key",function(){mapp.lib.ajax({data:{action:"mapp_autoicons_form",key:n(this).val()},callback:function(t){n(".mapp-autoicons").html(t.data);new mapp.widgets.Grid(n("[data-mapp-grid]",".mapp-autoicons"))}})});n("#mapp-filters tbody").sortable({handle:".mapp-handle"});n(".mapp-confirm").on("change",function(){var t=n(".mapp-confirm").is(":checked");n(".mapp-import").prop("disabled",!t)});n(".mapp-import").on("click",function(){n(".mapp-confirm, .mapp-import").prop("disabled",!0);t()})})}(jQuery)
languages/mappress-google-maps-for-wordpress.pot CHANGED
@@ -2,9 +2,9 @@
2
  # This file is distributed under the same license as the MapPress Easy Google Maps package.
3
  msgid ""
4
  msgstr ""
5
- "Project-Id-Version: MapPress Easy Google Maps 2.48.2\n"
6
  "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/mappress-google-maps-for-wordpress\n"
7
- "POT-Creation-Date: 2018-03-09 18:56:06+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=UTF-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
@@ -57,7 +57,7 @@ msgstr ""
57
  msgid "Map Title"
58
  msgstr ""
59
 
60
- #: forms/map_media.php:20 languages/texts.php:51 mappress.php:583
61
  #: mappress_map.php:591
62
  msgid "Untitled"
63
  msgstr ""
@@ -98,43 +98,43 @@ msgstr ""
98
  msgid "Size"
99
  msgstr ""
100
 
101
- #: languages/texts.php:20 mappress.php:155
102
  msgid "Version"
103
  msgstr ""
104
 
105
- #: languages/texts.php:21 mappress.php:163
106
  msgid "Documentation"
107
  msgstr ""
108
 
109
- #: languages/texts.php:22 mappress.php:164
110
  msgid "Support"
111
  msgstr ""
112
 
113
- #: languages/texts.php:23 mappress.php:166
114
  msgid "Upgrade to MapPress Pro"
115
  msgstr ""
116
 
117
- #: languages/texts.php:24 mappress.php:437
118
  msgid "MapPress database tables are missing. Please deactivate the plugin and activate it again to fix this."
119
  msgstr ""
120
 
121
- #: languages/texts.php:25 mappress.php:442
122
  msgid "WARNING: MapPress now requires WordPress 3.2 or higher. Please upgrade before using MapPress."
123
  msgstr ""
124
 
125
- #: languages/texts.php:26 mappress.php:447
126
  msgid "WARNING: MapPress is not compfatible with the WP-Geo plugin. Please deactivate or uninstall WP-Geo before using MapPress."
127
  msgstr ""
128
 
129
- #: languages/texts.php:27 mappress.php:454
130
  msgid "A Google Maps API key is required"
131
  msgstr ""
132
 
133
- #: languages/texts.php:28 mappress.php:454
134
  msgid "Please update your"
135
  msgstr ""
136
 
137
- #: languages/texts.php:29 mappress.php:454
138
  msgid "MapPress Settings"
139
  msgstr ""
140
 
@@ -150,7 +150,7 @@ msgstr ""
150
  msgid "One of the addresses could not be found."
151
  msgstr ""
152
 
153
- #: languages/texts.php:33 mappress.php:574
154
  msgid "Google cannot return directions between those addresses. There is no route between them or the routing information is not available."
155
  msgstr ""
156
 
@@ -162,7 +162,7 @@ msgstr ""
162
  msgid "Directions"
163
  msgstr ""
164
 
165
- #: languages/texts.php:36 mappress.php:575
166
  msgid "Error reading KML file"
167
  msgstr ""
168
 
@@ -170,11 +170,11 @@ msgstr ""
170
  msgid "Loading..."
171
  msgstr ""
172
 
173
- #: languages/texts.php:38 mappress.php:578
174
  msgid "No matching address"
175
  msgstr ""
176
 
177
- #: languages/texts.php:39 mappress.php:579
178
  msgid "Unable to get your location"
179
  msgstr ""
180
 
@@ -203,11 +203,11 @@ msgstr ""
203
  msgid "Click to change"
204
  msgstr ""
205
 
206
- #: languages/texts.php:47 mappress.php:580
207
  msgid "Delete this POI?"
208
  msgstr ""
209
 
210
- #: languages/texts.php:48 mappress.php:581
211
  msgid "Delete this map?"
212
  msgstr ""
213
 
@@ -215,7 +215,7 @@ msgstr ""
215
  msgid "Please save the map first"
216
  msgstr ""
217
 
218
- #: languages/texts.php:50 mappress.php:582
219
  msgid "Shape"
220
  msgstr ""
221
 
@@ -255,7 +255,7 @@ msgstr ""
255
  msgid "Directions from"
256
  msgstr ""
257
 
258
- #: languages/texts.php:61 mappress_settings.php:83
259
  msgid "Basic Settings"
260
  msgstr ""
261
 
@@ -628,11 +628,11 @@ msgstr ""
628
  msgid "%s on WordPress.org"
629
  msgstr ""
630
 
631
- #: languages/texts.php:154 mappress_settings.php:281
632
  msgid "Thanks for your support!"
633
  msgstr ""
634
 
635
- #: languages/texts.php:155 mappress_settings.php:288
636
  msgid "Easy Google Maps"
637
  msgstr ""
638
 
@@ -640,19 +640,19 @@ msgstr ""
640
  msgid "Like this plugin?"
641
  msgstr ""
642
 
643
- #: languages/texts.php:157 mappress_settings.php:300
644
  msgid "Sample Map"
645
  msgstr ""
646
 
647
- #: languages/texts.php:158 mappress_settings.php:322
648
  msgid "Save Changes"
649
  msgstr ""
650
 
651
- #: languages/texts.php:159 mappress_settings.php:323
652
  msgid "Reset Defaults"
653
  msgstr ""
654
 
655
- #: languages/texts.php:160 mappress.php:149
656
  msgid "Settings"
657
  msgstr ""
658
 
@@ -1024,15 +1024,19 @@ msgstr ""
1024
  msgid "Chris Richardson"
1025
  msgstr ""
1026
 
1027
- #: mappress.php:576
1028
  msgid "Loading"
1029
  msgstr ""
1030
 
1031
- #: mappress.php:577
1032
  msgid "%d results shown. Zoom in to see more."
1033
  msgstr ""
1034
 
1035
- #: mappress_map.php:93 mappress_settings.php:305
 
 
 
 
1036
  msgid "MapPress"
1037
  msgstr ""
1038
 
@@ -1044,12 +1048,12 @@ msgstr ""
1044
  msgid "List"
1045
  msgstr ""
1046
 
1047
- #: mappress_settings.php:81
1048
- msgid "License"
1049
  msgstr ""
1050
 
1051
  #: mappress_settings.php:84
1052
- msgid "Google API key"
1053
  msgstr ""
1054
 
1055
  #: mappress_settings.php:88
@@ -1092,14 +1096,6 @@ msgstr ""
1092
  msgid "Height (px)"
1093
  msgstr ""
1094
 
1095
- #: mappress_settings.php:278
1096
- msgid "rate it 5 Stars"
1097
- msgstr ""
1098
-
1099
- #: mappress_settings.php:280
1100
- msgid "Please %s on WordPress.org."
1101
- msgstr ""
1102
-
1103
  #: pro/mappress_filter.php:118
1104
  msgid "Taxonomy"
1105
  msgstr ""
2
  # This file is distributed under the same license as the MapPress Easy Google Maps package.
3
  msgid ""
4
  msgstr ""
5
+ "Project-Id-Version: MapPress Easy Google Maps 2.48.3\n"
6
  "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/mappress-google-maps-for-wordpress\n"
7
+ "POT-Creation-Date: 2018-03-16 23:13:04+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=UTF-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
57
  msgid "Map Title"
58
  msgstr ""
59
 
60
+ #: forms/map_media.php:20 languages/texts.php:51 mappress.php:611
61
  #: mappress_map.php:591
62
  msgid "Untitled"
63
  msgstr ""
98
  msgid "Size"
99
  msgstr ""
100
 
101
+ #: languages/texts.php:20 mappress.php:159
102
  msgid "Version"
103
  msgstr ""
104
 
105
+ #: languages/texts.php:21 mappress.php:167
106
  msgid "Documentation"
107
  msgstr ""
108
 
109
+ #: languages/texts.php:22 mappress.php:168
110
  msgid "Support"
111
  msgstr ""
112
 
113
+ #: languages/texts.php:23 mappress.php:170
114
  msgid "Upgrade to MapPress Pro"
115
  msgstr ""
116
 
117
+ #: languages/texts.php:24 mappress.php:449
118
  msgid "MapPress database tables are missing. Please deactivate the plugin and activate it again to fix this."
119
  msgstr ""
120
 
121
+ #: languages/texts.php:25 mappress.php:454
122
  msgid "WARNING: MapPress now requires WordPress 3.2 or higher. Please upgrade before using MapPress."
123
  msgstr ""
124
 
125
+ #: languages/texts.php:26 mappress.php:459
126
  msgid "WARNING: MapPress is not compfatible with the WP-Geo plugin. Please deactivate or uninstall WP-Geo before using MapPress."
127
  msgstr ""
128
 
129
+ #: languages/texts.php:27 mappress.php:464
130
  msgid "A Google Maps API key is required"
131
  msgstr ""
132
 
133
+ #: languages/texts.php:28 mappress.php:464
134
  msgid "Please update your"
135
  msgstr ""
136
 
137
+ #: languages/texts.php:29 mappress.php:464
138
  msgid "MapPress Settings"
139
  msgstr ""
140
 
150
  msgid "One of the addresses could not be found."
151
  msgstr ""
152
 
153
+ #: languages/texts.php:33 mappress.php:602
154
  msgid "Google cannot return directions between those addresses. There is no route between them or the routing information is not available."
155
  msgstr ""
156
 
162
  msgid "Directions"
163
  msgstr ""
164
 
165
+ #: languages/texts.php:36 mappress.php:603
166
  msgid "Error reading KML file"
167
  msgstr ""
168
 
170
  msgid "Loading..."
171
  msgstr ""
172
 
173
+ #: languages/texts.php:38 mappress.php:606
174
  msgid "No matching address"
175
  msgstr ""
176
 
177
+ #: languages/texts.php:39 mappress.php:607
178
  msgid "Unable to get your location"
179
  msgstr ""
180
 
203
  msgid "Click to change"
204
  msgstr ""
205
 
206
+ #: languages/texts.php:47
207
  msgid "Delete this POI?"
208
  msgstr ""
209
 
210
+ #: languages/texts.php:48 mappress.php:609
211
  msgid "Delete this map?"
212
  msgstr ""
213
 
215
  msgid "Please save the map first"
216
  msgstr ""
217
 
218
+ #: languages/texts.php:50 mappress.php:610
219
  msgid "Shape"
220
  msgstr ""
221
 
255
  msgid "Directions from"
256
  msgstr ""
257
 
258
+ #: languages/texts.php:61 mappress_settings.php:79
259
  msgid "Basic Settings"
260
  msgstr ""
261
 
628
  msgid "%s on WordPress.org"
629
  msgstr ""
630
 
631
+ #: languages/texts.php:154
632
  msgid "Thanks for your support!"
633
  msgstr ""
634
 
635
+ #: languages/texts.php:155 mappress_settings.php:280
636
  msgid "Easy Google Maps"
637
  msgstr ""
638
 
640
  msgid "Like this plugin?"
641
  msgstr ""
642
 
643
+ #: languages/texts.php:157 mappress_settings.php:292
644
  msgid "Sample Map"
645
  msgstr ""
646
 
647
+ #: languages/texts.php:158 mappress_settings.php:314
648
  msgid "Save Changes"
649
  msgstr ""
650
 
651
+ #: languages/texts.php:159 mappress_settings.php:315
652
  msgid "Reset Defaults"
653
  msgstr ""
654
 
655
+ #: languages/texts.php:160 mappress.php:153
656
  msgid "Settings"
657
  msgstr ""
658
 
1024
  msgid "Chris Richardson"
1025
  msgstr ""
1026
 
1027
+ #: mappress.php:604
1028
  msgid "Loading"
1029
  msgstr ""
1030
 
1031
+ #: mappress.php:605
1032
  msgid "%d results shown. Zoom in to see more."
1033
  msgstr ""
1034
 
1035
+ #: mappress.php:608
1036
+ msgid "Are you sure you want to delete?"
1037
+ msgstr ""
1038
+
1039
+ #: mappress_map.php:93 mappress_settings.php:297
1040
  msgid "MapPress"
1041
  msgstr ""
1042
 
1048
  msgid "List"
1049
  msgstr ""
1050
 
1051
+ #: mappress_settings.php:80
1052
+ msgid "Google API key"
1053
  msgstr ""
1054
 
1055
  #: mappress_settings.php:84
1056
+ msgid "License"
1057
  msgstr ""
1058
 
1059
  #: mappress_settings.php:88
1096
  msgid "Height (px)"
1097
  msgstr ""
1098
 
 
 
 
 
 
 
 
 
1099
  #: pro/mappress_filter.php:118
1100
  msgid "Taxonomy"
1101
  msgstr ""
languages/texts.php CHANGED
@@ -252,11 +252,12 @@ __("MapPress makes it easy to insert Google Maps in WordPress posts and pages.")
252
  __("Chris Richardson");
253
  __("Loading");
254
  __("%d results shown. Zoom in to see more.");
 
255
  __("MapPress");
256
  __("Filter");
257
  __("List");
258
- __("License");
259
  __("Google API key");
 
260
  __("Automatic display");
261
  __("Compatiblity");
262
  __("Country code");
@@ -267,8 +268,6 @@ __("disable if maps are output using AJAX");
267
  __("%s for map controls");
268
  __("Width (px or %)");
269
  __("Height (px)");
270
- __("rate it 5 Stars");
271
- __("Please %s on WordPress.org.");
272
  __("Taxonomy");
273
  __("Post field");
274
  __("MapPress license key");
252
  __("Chris Richardson");
253
  __("Loading");
254
  __("%d results shown. Zoom in to see more.");
255
+ __("Are you sure you want to delete?");
256
  __("MapPress");
257
  __("Filter");
258
  __("List");
 
259
  __("Google API key");
260
+ __("License");
261
  __("Automatic display");
262
  __("Compatiblity");
263
  __("Country code");
268
  __("%s for map controls");
269
  __("Width (px or %)");
270
  __("Height (px)");
 
 
271
  __("Taxonomy");
272
  __("Post field");
273
  __("MapPress license key");
mappress.php CHANGED
@@ -4,7 +4,7 @@ Plugin Name: MapPress Easy Google Maps
4
  Plugin URI: http://www.wphostreviews.com/mappress
5
  Author URI: http://www.wphostreviews.com/mappress
6
  Description: MapPress makes it easy to insert Google Maps in WordPress posts and pages.
7
- Version: 2.48.2
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/)
@@ -34,7 +34,7 @@ if (is_dir(dirname( __FILE__ ) . '/pro')) {
34
  }
35
 
36
  class Mappress {
37
- const VERSION = '2.48.2';
38
 
39
  static
40
  $baseurl,
@@ -42,6 +42,7 @@ class Mappress {
42
  $basedir,
43
  $debug,
44
  $loaded,
 
45
  $options,
46
  $pages,
47
  $pro,
@@ -92,6 +93,9 @@ class Mappress {
92
  add_action('wp_print_scripts', array(__CLASS__, 'deregister'), -1);
93
  }
94
 
 
 
 
95
  // Slow heartbeat
96
  if (self::$debug)
97
  add_filter( 'heartbeat_settings', array(__CLASS__, 'heartbeat_settings'));
@@ -168,10 +172,15 @@ class Mappress {
168
  echo $html;
169
  }
170
 
171
- static function ajax_response($status, $data=null) {
172
  $output = trim(ob_get_clean()); // Ignore whitespace, any other output is an error
173
  header( "Content-Type: application/json" );
174
- ob_start('ob_gzhandler');
 
 
 
 
 
175
  $response = json_encode(array('status' => $status, 'output' => $output, 'data' => $data));
176
  die ($response);
177
  }
@@ -364,8 +373,11 @@ class Mappress {
364
  $editing = in_array($hook, array('edit.php', 'post.php', 'post-new.php'));
365
 
366
  // Settings scripts
367
- if ($hook == self::$pages[0])
368
  self::load('settings');
 
 
 
369
 
370
  // CSS
371
  if (in_array($hook, self::$pages) || $editing) {
@@ -428,39 +440,55 @@ class Mappress {
428
  // Sanity checks via notices
429
  static function admin_notices() {
430
  global $wpdb;
431
- $error = "<div id='error' class='error'><p>%s</p></div>";
432
 
433
  $map_table = $wpdb->prefix . "mappress_maps";
434
  $exists = $wpdb->get_var("show tables like '$map_table'");
435
 
436
  if (!$exists) {
437
- echo sprintf($error, __("MapPress database tables are missing. Please deactivate the plugin and activate it again to fix this.", 'mappress-google-maps-for-wordpress'));
438
  return;
439
  }
440
 
441
  if (get_bloginfo('version') < "3.2") {
442
- echo sprintf($error, __("WARNING: MapPress now requires WordPress 3.2 or higher. Please upgrade before using MapPress.", 'mappress-google-maps-for-wordpress'));
443
  return;
444
  }
445
 
446
  if (class_exists('WPGeo')) {
447
- echo sprintf($error, __("WARNING: MapPress is not compfatible with the WP-Geo plugin. Please deactivate or uninstall WP-Geo before using MapPress.", 'mappress-google-maps-for-wordpress'));
448
  return;
449
  }
450
 
451
- // Dismissible notices
452
- $notices = array();
453
  if (!self::get_api_keys()->browser)
454
- $notices['apikey'] = 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'));
455
-
456
- foreach($notices as $notice => $msg)
457
- echo "<div class='notice error is-dismissible'><p>$msg</p></div>";
 
 
 
 
 
 
 
 
 
 
 
 
 
458
  }
459
 
460
- static function dismiss($notice) {
461
- $dismissed = get_option('mappress-dismissed');
 
 
 
462
  $dismissed = (is_array($dismissed)) ? $dismissed : array();
463
  $dismissed[$key] = true;
 
 
464
  }
465
 
466
  /**
@@ -555,7 +583,7 @@ class Mappress {
555
 
556
  static function footer() {
557
  $infinite = class_exists( 'Jetpack' ) && Jetpack::is_module_active( 'infinite-scroll' );
558
- return (is_admin() || self::$options->footer && !$infinite);
559
  }
560
 
561
  static function dev() {
@@ -577,7 +605,7 @@ class Mappress {
577
  'more' => __('%d results shown. Zoom in to see more.', 'mappress-google-maps-for-wordpress'),
578
  'no_address' => __('No matching address', 'mappress-google-maps-for-wordpress'),
579
  'no_geolocate' => __('Unable to get your location', 'mappress-google-maps-for-wordpress'),
580
- 'delete_prompt' => __('Delete this POI?', 'mappress-google-maps-for-wordpress'),
581
  'delete_map_prompt' => __('Delete this map?', 'mappress-google-maps-for-wordpress'),
582
  'shape' => __('Shape', 'mappress-google-maps-for-wordpress'),
583
  'untitled' => __('Untitled', 'mappress-google-maps-for-wordpress')
4
  Plugin URI: http://www.wphostreviews.com/mappress
5
  Author URI: http://www.wphostreviews.com/mappress
6
  Description: MapPress makes it easy to insert Google Maps in WordPress posts and pages.
7
+ Version: 2.48.3
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/)
34
  }
35
 
36
  class Mappress {
37
+ const VERSION = '2.48.3';
38
 
39
  static
40
  $baseurl,
42
  $basedir,
43
  $debug,
44
  $loaded,
45
+ $notices,
46
  $options,
47
  $pages,
48
  $pro,
93
  add_action('wp_print_scripts', array(__CLASS__, 'deregister'), -1);
94
  }
95
 
96
+ // Dismissible notices
97
+ add_action('wp_ajax_mapp_dismiss', array( __CLASS__, 'ajax_dismiss' ));
98
+
99
  // Slow heartbeat
100
  if (self::$debug)
101
  add_filter( 'heartbeat_settings', array(__CLASS__, 'heartbeat_settings'));
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
  }
373
  $editing = in_array($hook, array('edit.php', 'post.php', 'post-new.php'));
374
 
375
  // Settings scripts
376
+ if ($hook == self::$pages[0]) {
377
  self::load('settings');
378
+ if (function_exists('wp_enqueue_code_editor'))
379
+ wp_enqueue_code_editor(array( 'type' => 'php' ));
380
+ }
381
 
382
  // CSS
383
  if (in_array($hook, self::$pages) || $editing) {
440
  // Sanity checks via notices
441
  static function admin_notices() {
442
  global $wpdb;
443
+ $error = "<div class='notice error'><p>%s</p></div>";
444
 
445
  $map_table = $wpdb->prefix . "mappress_maps";
446
  $exists = $wpdb->get_var("show tables like '$map_table'");
447
 
448
  if (!$exists) {
449
+ printf($error, __("MapPress database tables are missing. Please deactivate the plugin and activate it again to fix this.", 'mappress-google-maps-for-wordpress'));
450
  return;
451
  }
452
 
453
  if (get_bloginfo('version') < "3.2") {
454
+ printf($error, __("WARNING: MapPress now requires WordPress 3.2 or higher. Please upgrade before using MapPress.", 'mappress-google-maps-for-wordpress'));
455
  return;
456
  }
457
 
458
  if (class_exists('WPGeo')) {
459
+ printf($error, __("WARNING: MapPress is not compfatible with the WP-Geo plugin. Please deactivate or uninstall WP-Geo before using MapPress.", 'mappress-google-maps-for-wordpress'));
460
  return;
461
  }
462
 
 
 
463
  if (!self::get_api_keys()->browser)
464
+ 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')));
465
+
466
+ // Dismissible notices - only for admins
467
+ if (is_super_admin()) {
468
+ $notices = array();
469
+ $dismissed = get_user_meta(get_current_user_id(), 'mappress-notices', true);
470
+ $dismissed = (is_array($dismissed)) ? $dismissed : array();
471
+ $notices = array_diff_key($notices, $dismissed);
472
+ foreach($notices as $key => $msg)
473
+ echo "<div class='notice error is-dismissible' data-mapp-dismiss='$key'><p>$msg</p></div>";
474
+
475
+ if ($notices) {
476
+ echo Mappress::script("jQuery(document).on('click', '[data-mapp-dismiss]', function() {
477
+ jQuery.post(ajaxurl, { action : 'mapp_dismiss', key : jQuery(this).attr('data-mapp-dismiss') });
478
+ });");
479
+ }
480
+ }
481
  }
482
 
483
+ static function ajax_dismiss() {
484
+ $key = (isset($_POST['key'])) ? $_POST['key'] : null;
485
+ if ($key) {
486
+ $user_id = get_current_user_id();
487
+ $dismissed = get_user_meta($user_id, 'mappress-notices', true);
488
  $dismissed = (is_array($dismissed)) ? $dismissed : array();
489
  $dismissed[$key] = true;
490
+ update_user_meta($user_id, 'mappress-notices', $dismissed);
491
+ }
492
  }
493
 
494
  /**
583
 
584
  static function footer() {
585
  $infinite = class_exists( 'Jetpack' ) && Jetpack::is_module_active( 'infinite-scroll' );
586
+ return (!is_admin() && self::$options->footer && !$infinite);
587
  }
588
 
589
  static function dev() {
605
  'more' => __('%d results shown. Zoom in to see more.', 'mappress-google-maps-for-wordpress'),
606
  'no_address' => __('No matching address', 'mappress-google-maps-for-wordpress'),
607
  'no_geolocate' => __('Unable to get your location', 'mappress-google-maps-for-wordpress'),
608
+ 'delete_prompt' => __('Are you sure you want to delete?', 'mappress-google-maps-for-wordpress'),
609
  'delete_map_prompt' => __('Delete this map?', 'mappress-google-maps-for-wordpress'),
610
  'shape' => __('Shape', 'mappress-google-maps-for-wordpress'),
611
  'untitled' => __('Untitled', 'mappress-google-maps-for-wordpress')
mappress_settings.php CHANGED
@@ -76,13 +76,13 @@ class Mappress_Settings {
76
  function admin_init() {
77
  register_setting('mappress', self::$basename, array($this, 'validate'));
78
 
 
 
 
79
  // License: single blogs, or main blog on multisite
80
  if (Mappress::$pro && $this->options->autoupdate && (!is_multisite() || (is_super_admin() && is_main_site())) )
81
  $this->add_section('license', __('License', 'mappress-google-maps-for-wordpress'));
82
 
83
- $this->add_section('basic', __('Basic Settings', 'mappress-google-maps-for-wordpress'));
84
- $this->add_field('apiKey', __('Google API key', 'mappress-google-maps-for-wordpress'), 'basic');
85
-
86
  $this->add_section('maps', __('Map Settings', 'mappress-google-maps-for-wordpress'));
87
  $this->add_field('postTypes', __('Post types', 'mappress-google-maps-for-wordpress'), 'maps');
88
  $this->add_field('autodisplay', __('Automatic display', 'mappress-google-maps-for-wordpress'), 'maps');
@@ -274,14 +274,6 @@ class Mappress_Settings {
274
  }
275
 
276
  function metabox_preview($object, $metabox) {
277
- if (!Mappress::$pro) {
278
- $link = "<a href='https://wordpress.org/plugins/mappress-google-maps-for-wordpress/'>" . __('rate it 5 Stars', 'mappress-google-maps-for-wordpress') . "</a>";
279
- echo "<div class='mappress-like' style='float:right; font-size: 14px; width: 45%'><h3>Like this plugin?</h3>";
280
- echo sprintf(__('Please %s on WordPress.org.', 'mappress-google-maps-for-wordpress'), $link);
281
- echo "<br/><hr/>" . __('Thanks for your support!', 'mappress-google-maps-for-wordpress');
282
- echo "</div>";
283
- }
284
-
285
  $poi = new Mappress_Poi(array(
286
  'correctedAddress' => 'San Francisco, CA',
287
  "title" => "MapPress",
@@ -289,7 +281,7 @@ class Mappress_Settings {
289
  "point" => array('lat' => 37.774095, 'lng' => -122.418731)
290
  ));
291
  $pois = array($poi);
292
- $map = new Mappress_Map(array('alignment' => 'default', 'width' => '100%', 'height' => 200, 'pois' => $pois, 'zoom' => 4));
293
  echo $map->display();
294
  }
295
 
76
  function admin_init() {
77
  register_setting('mappress', self::$basename, array($this, 'validate'));
78
 
79
+ $this->add_section('basic', __('Basic Settings', 'mappress-google-maps-for-wordpress'));
80
+ $this->add_field('apiKey', __('Google API key', 'mappress-google-maps-for-wordpress'), 'basic');
81
+
82
  // License: single blogs, or main blog on multisite
83
  if (Mappress::$pro && $this->options->autoupdate && (!is_multisite() || (is_super_admin() && is_main_site())) )
84
  $this->add_section('license', __('License', 'mappress-google-maps-for-wordpress'));
85
 
 
 
 
86
  $this->add_section('maps', __('Map Settings', 'mappress-google-maps-for-wordpress'));
87
  $this->add_field('postTypes', __('Post types', 'mappress-google-maps-for-wordpress'), 'maps');
88
  $this->add_field('autodisplay', __('Automatic display', 'mappress-google-maps-for-wordpress'), 'maps');
274
  }
275
 
276
  function metabox_preview($object, $metabox) {
 
 
 
 
 
 
 
 
277
  $poi = new Mappress_Poi(array(
278
  'correctedAddress' => 'San Francisco, CA',
279
  "title" => "MapPress",
281
  "point" => array('lat' => 37.774095, 'lng' => -122.418731)
282
  ));
283
  $pois = array($poi);
284
+ $map = new Mappress_Map(array('alignment' => 'default', 'width' => '95%', 'height' => 200, 'pois' => $pois, 'zoom' => 4));
285
  echo $map->display();
286
  }
287
 
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_i
4
  Tags: 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: 3.5
6
  Tested up to: 4.9
7
- Stable tag: 2.48.2
8
 
9
  MapPress is the most popular and easiest way to create great-looking Google Maps and driving directions in your blog.
10
 
@@ -86,6 +86,12 @@ Please see the plugin documentation pages:
86
 
87
  == Changelog ==
88
 
 
 
 
 
 
 
89
  = 2.48.2 =
90
  * Fixed: POI list was being hidden on small maps with 'inline' vertical layout
91
  * Fixed: empty 'ghost' link if post thumbnail is absent
4
  Tags: 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: 3.5
6
  Tested up to: 4.9
7
+ Stable tag: 2.48.3
8
 
9
  MapPress is the most popular and easiest way to create great-looking Google Maps and driving directions in your blog.
10
 
86
 
87
  == Changelog ==
88
 
89
+ = 2.48.3 =
90
+ * Added: dismissible notices
91
+ * Fixed: incorrect sorting for mashups with 'orderby' clause in query
92
+ * Fixed: incorrect CSS in settings screen
93
+ * Changed: use gzip only for mashups, not for maps, added checks for PHP libraries
94
+
95
  = 2.48.2 =
96
  * Fixed: POI list was being hidden on small maps with 'inline' vertical layout
97
  * Fixed: empty 'ghost' link if post thumbnail is absent