Changeset 3373940
- Timestamp:
- 10/06/2025 07:43:55 PM (5 months ago)
- Location:
- hivepress-geolocation
- Files:
-
- 71 added
- 2 deleted
- 18 edited
-
tags/1.3.8 (added)
-
tags/1.3.8/assets (added)
-
tags/1.3.8/assets/css (added)
-
tags/1.3.8/assets/css/backend.less (added)
-
tags/1.3.8/assets/css/backend.min.css (added)
-
tags/1.3.8/assets/css/common.less (added)
-
tags/1.3.8/assets/css/common.min.css (added)
-
tags/1.3.8/assets/css/frontend.less (added)
-
tags/1.3.8/assets/css/frontend.min.css (added)
-
tags/1.3.8/assets/images (added)
-
tags/1.3.8/assets/images/markerclustererplus (added)
-
tags/1.3.8/assets/images/markerclustererplus/m1.png (added)
-
tags/1.3.8/assets/images/markerclustererplus/m2.png (added)
-
tags/1.3.8/assets/images/markerclustererplus/m3.png (added)
-
tags/1.3.8/assets/images/markerclustererplus/m4.png (added)
-
tags/1.3.8/assets/images/markerclustererplus/m5.png (added)
-
tags/1.3.8/assets/js (added)
-
tags/1.3.8/assets/js/common.js (added)
-
tags/1.3.8/assets/js/common.min.js (added)
-
tags/1.3.8/assets/js/jquery.geocomplete.min.js (added)
-
tags/1.3.8/assets/js/markerclustererplus.min.js (added)
-
tags/1.3.8/assets/js/oms.min.js (added)
-
tags/1.3.8/hivepress-geolocation.php (added)
-
tags/1.3.8/includes (added)
-
tags/1.3.8/includes/blocks (added)
-
tags/1.3.8/includes/blocks/class-listing-map.php (added)
-
tags/1.3.8/includes/components (added)
-
tags/1.3.8/includes/components/class-geolocation.php (added)
-
tags/1.3.8/includes/configs (added)
-
tags/1.3.8/includes/configs/scripts.php (added)
-
tags/1.3.8/includes/configs/settings.php (added)
-
tags/1.3.8/includes/configs/styles.php (added)
-
tags/1.3.8/includes/controllers (added)
-
tags/1.3.8/includes/controllers/class-geolocation.php (added)
-
tags/1.3.8/includes/fields (added)
-
tags/1.3.8/includes/fields/class-latitude.php (added)
-
tags/1.3.8/includes/fields/class-location.php (added)
-
tags/1.3.8/includes/fields/class-longitude.php (added)
-
tags/1.3.8/includes/templates (added)
-
tags/1.3.8/includes/templates/class-listing-map-block.php (added)
-
tags/1.3.8/includes/templates/class-request-map-block.php (added)
-
tags/1.3.8/includes/templates/class-vendor-map-block.php (added)
-
tags/1.3.8/languages (added)
-
tags/1.3.8/languages/hivepress-geolocation.pot (added)
-
tags/1.3.8/license.txt (added)
-
tags/1.3.8/readme.txt (added)
-
tags/1.3.8/templates (added)
-
tags/1.3.8/templates/listing (added)
-
tags/1.3.8/templates/listing/view (added)
-
tags/1.3.8/templates/listing/view/listing-location.php (added)
-
tags/1.3.8/templates/request (added)
-
tags/1.3.8/templates/request/view (added)
-
tags/1.3.8/templates/request/view/request-location.php (added)
-
tags/1.3.8/templates/vendor (added)
-
tags/1.3.8/templates/vendor/view (added)
-
tags/1.3.8/templates/vendor/view/vendor-location.php (added)
-
tags/1.3.8/vendor (added)
-
tags/1.3.8/vendor/autoload.php (added)
-
tags/1.3.8/vendor/composer (added)
-
tags/1.3.8/vendor/composer/ClassLoader.php (added)
-
tags/1.3.8/vendor/composer/InstalledVersions.php (added)
-
tags/1.3.8/vendor/composer/LICENSE (added)
-
tags/1.3.8/vendor/composer/autoload_classmap.php (added)
-
tags/1.3.8/vendor/composer/autoload_namespaces.php (added)
-
tags/1.3.8/vendor/composer/autoload_psr4.php (added)
-
tags/1.3.8/vendor/composer/autoload_real.php (added)
-
tags/1.3.8/vendor/composer/autoload_static.php (added)
-
tags/1.3.8/vendor/composer/installed.json (added)
-
tags/1.3.8/vendor/composer/installed.php (added)
-
trunk/assets/css/backend.less (modified) (3 diffs)
-
trunk/assets/css/backend.min.css (modified) (1 diff)
-
trunk/assets/css/common.less (added)
-
trunk/assets/css/common.min.css (added)
-
trunk/assets/css/frontend.less (modified) (6 diffs)
-
trunk/assets/css/frontend.min.css (modified) (1 diff)
-
trunk/assets/js/common.js (modified) (18 diffs)
-
trunk/assets/js/common.min.js (modified) (1 diff)
-
trunk/assets/js/frontend.js (deleted)
-
trunk/assets/js/frontend.min.js (deleted)
-
trunk/hivepress-geolocation.php (modified) (1 diff)
-
trunk/includes/blocks/class-listing-map.php (modified) (1 diff)
-
trunk/includes/components/class-geolocation.php (modified) (19 diffs)
-
trunk/includes/configs/scripts.php (modified) (5 diffs)
-
trunk/includes/configs/settings.php (modified) (8 diffs)
-
trunk/includes/configs/styles.php (modified) (1 diff)
-
trunk/includes/fields/class-location.php (modified) (1 diff)
-
trunk/languages/hivepress-geolocation.pot (modified) (4 diffs)
-
trunk/readme.txt (modified) (1 diff)
-
trunk/vendor/autoload.php (modified) (1 diff)
-
trunk/vendor/composer/InstalledVersions.php (modified) (5 diffs)
-
trunk/vendor/composer/installed.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
hivepress-geolocation/trunk/assets/css/backend.less
r2703918 r3373940 1 1 .hp { 2 2 3 /*-------------------------------------------------------------- 3 4 Forms … … 28 29 } 29 30 } 31 30 32 /*-------------------------------------------------------------- 31 33 Mapbox … … 34 36 &-ctrl-geocoder { 35 37 width: auto !important; 36 max-width: none !important;37 box-shadow: none !important;38 min-width: auto !important;39 z-index: 2 !important;40 38 display: inline-block; 41 42 .suggestions-wrapper {43 li {44 margin-bottom: 0 !important;45 }46 47 a {48 margin-left: 0 !important;49 background-color: inherit !important;50 }51 }52 53 &--icon,54 &--pin-right {55 display: none !important;56 }57 39 } 58 40 } -
hivepress-geolocation/trunk/assets/css/backend.min.css
r2703918 r3373940 1 .hp-field--location input[type=text]{padding-right:30px}.hp-field--location a{margin-left:-24px;vertical-align:middle;color:#888;position:relative;z-index:3}.hp-field--location a:focus{box-shadow:none;outline:0}.hp-field--location a i{font-size:14px}.mapboxgl-ctrl-geocoder{width:auto!important; max-width:none!important;box-shadow:none!important;min-width:auto!important;z-index:2!important;display:inline-block}.mapboxgl-ctrl-geocoder .suggestions-wrapper li{margin-bottom:0!important}.mapboxgl-ctrl-geocoder .suggestions-wrapper a{margin-left:0!important;background-color:inherit!important}.mapboxgl-ctrl-geocoder--icon,.mapboxgl-ctrl-geocoder--pin-right{display:none!important}1 .hp-field--location input[type=text]{padding-right:30px}.hp-field--location a{margin-left:-24px;vertical-align:middle;color:#888;position:relative;z-index:3}.hp-field--location a:focus{box-shadow:none;outline:0}.hp-field--location a i{font-size:14px}.mapboxgl-ctrl-geocoder{width:auto!important;display:inline-block} -
hivepress-geolocation/trunk/assets/css/frontend.less
r2737732 r3373940 1 1 .hp { 2 2 3 /*-------------------------------------------------------------- 3 4 Forms … … 24 25 } 25 26 } 27 26 28 /*-------------------------------------------------------------- 27 29 Listings … … 46 48 } 47 49 } 50 48 51 /*-------------------------------------------------------------- 49 52 Vendors … … 56 59 } 57 60 } 61 58 62 /*-------------------------------------------------------------- 59 63 Maps … … 65 69 } 66 70 } 71 67 72 /*-------------------------------------------------------------- 68 73 Mapbox … … 71 76 &-ctrl-geocoder { 72 77 width: 100% !important; 73 max-width: none !important;74 box-shadow: none !important;75 min-width: auto !important;76 z-index: 2 !important;77 78 .suggestions-wrapper {79 li {80 margin-bottom: 0 !important;81 }82 83 a {84 margin-left: 0 !important;85 background-color: inherit !important;86 }87 }88 89 &--icon,90 &--pin-right {91 display: none !important;92 }93 78 } 94 79 } -
hivepress-geolocation/trunk/assets/css/frontend.min.css
r2737732 r3373940 1 .hp-field--location{display:flex}.hp-field--location input[type=text]{flex:1;padding-right:3rem}.hp-field--location a{flex:0 0 3rem;margin-left:-3rem;text-decoration:none;display:flex;justify-content:center;align-items:center;position:relative;z-index:3}.hp-listing__location{display:flex;align-items:center;max-width:100%}.hp-listing__location i{margin-right:.5rem}.hp-listing__location a{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;text-decoration:none;color:inherit}.hp-vendor__location:not(:last-child){margin-bottom:.5rem}.hp-map:not(:last-child){margin-bottom:2rem}.mapboxgl-ctrl-geocoder{width:100%!important ;max-width:none!important;box-shadow:none!important;min-width:auto!important;z-index:2!important}.mapboxgl-ctrl-geocoder .suggestions-wrapper li{margin-bottom:0!important}.mapboxgl-ctrl-geocoder .suggestions-wrapper a{margin-left:0!important;background-color:inherit!important}.mapboxgl-ctrl-geocoder--icon,.mapboxgl-ctrl-geocoder--pin-right{display:none!important}1 .hp-field--location{display:flex}.hp-field--location input[type=text]{flex:1;padding-right:3rem}.hp-field--location a{flex:0 0 3rem;margin-left:-3rem;text-decoration:none;display:flex;justify-content:center;align-items:center;position:relative;z-index:3}.hp-listing__location{display:flex;align-items:center;max-width:100%}.hp-listing__location i{margin-right:.5rem}.hp-listing__location a{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;text-decoration:none;color:inherit}.hp-vendor__location:not(:last-child){margin-bottom:.5rem}.hp-map:not(:last-child){margin-bottom:2rem}.mapboxgl-ctrl-geocoder{width:100%!important} -
hivepress-geolocation/trunk/assets/js/common.js
r3139907 r3373940 1 (function ($) {1 (function ($) { 2 2 'use strict'; 3 3 4 hivepress.initGeolocation = function (container) {4 hivepress.initGeolocation = function (container) { 5 5 6 6 // Location 7 container.find(hivepress.getSelector('location')).each(function () {7 container.find(hivepress.getSelector('location')).each(function () { 8 8 var container = $(this), 9 9 form = container.closest('form'), … … 12 12 longitudeField = form.find('input[data-coordinate=lng]'), 13 13 regionField = form.find('input[data-region]'), 14 regionTypes = [], 14 15 button = container.find('a'), 15 16 settings = {}; 17 18 if (field.data('region-types')) { 19 regionTypes = field.data('region-types'); 20 } 16 21 17 22 if (typeof mapboxData !== 'undefined') { … … 43 48 field = mapboxContainer.find('input[type=text]'); 44 49 45 $.each(fieldAttributes, function () {50 $.each(fieldAttributes, function () { 46 51 field.attr(this.name, this.value); 47 52 }); … … 50 55 51 56 // Set location 52 geocoder.on('result', function(result) { 53 var types = [ 54 'place', 55 'district', 56 'region', 57 'country', 58 ]; 57 geocoder.on('result', function (result) { 58 var types = regionTypes; 59 59 60 60 // Set region … … 71 71 latitudeField.val(result.result.geometry.coordinates[1]); 72 72 }); 73 } else {73 } else if ($.fn.geocomplete) { 74 74 settings = { 75 75 details: form, … … 93 93 94 94 // Set location 95 field.bind('geocode:result', function (event, result) {95 field.bind('geocode:result', function (event, result) { 96 96 var parts = [], 97 types = [ 98 'locality', 99 'administrative_area_level_2', 100 'administrative_area_level_1', 101 'country', 102 ]; 97 types = regionTypes; 103 98 104 99 // Set region … … 115 110 types.push('route'); 116 111 117 $.each(result.address_components, function (index, component) {112 $.each(result.address_components, function (index, component) { 118 113 if (component.types.filter(value => types.includes(value)).length) { 119 114 parts.push(component.long_name); … … 124 119 } 125 120 }); 121 } else { 122 settings = { 123 language: hivepressCoreData.language, 124 sessionToken: false, 125 }; 126 127 // Set countries 128 if (container.data('countries')) { 129 settings['includedRegionCodes'] = container.data('countries'); 130 } 131 132 // Set types 133 if (container.data('types')) { 134 settings['includedPrimaryTypes'] = container.data('types'); 135 } 136 137 // Create Geocoder 138 var geocoder = new google.maps.Geocoder(); 139 140 // Initialize Autocomplete 141 field.autocomplete({ 142 source: async function (request, response) { 143 var results = []; 144 145 if (!settings['sessionToken']) { 146 settings['sessionToken'] = new google.maps.places.AutocompleteSessionToken(); 147 } 148 149 const { suggestions } = await google.maps.places.AutocompleteSuggestion.fetchAutocompleteSuggestions($.extend(settings, { 150 input: request.term, 151 })); 152 153 for (let suggestion of suggestions) { 154 results.push({ 155 label: suggestion.placePrediction.text.toString(), 156 value: suggestion.placePrediction, 157 }); 158 } 159 160 response(results); 161 }, 162 select: async function (e, ui) { 163 e.preventDefault(); 164 165 const place = ui.item.value.toPlace(); 166 167 await place.fetchFields({ fields: ['location', 'addressComponents'] }); 168 169 settings['sessionToken'] = false; 170 171 field.val(ui.item.label); 172 latitudeField.val(place.location.lat); 173 longitudeField.val(place.location.lng); 174 175 var parts = [], 176 types = regionTypes; 177 178 // Set region 179 if (regionField.length) { 180 if (place.addressComponents[0].types.filter(value => types.includes(value)).length) { 181 regionField.val(place.id); 182 } else { 183 regionField.val(''); 184 } 185 } 186 187 // Set address 188 if (container.data('scatter')) { 189 types.push('route'); 190 191 $.each(place.addressComponents, function (index, component) { 192 if (component.types.filter(value => types.includes(value)).length) { 193 parts.push(component.longText); 194 } 195 }); 196 197 field.val(parts.join(', ')); 198 } 199 }, 200 open: function () { 201 var widget = $(this).autocomplete('widget'); 202 203 widget.addClass('pac-container pac-logo hdpi').removeClass('ui-menu ui-widget ui-widget-content ui-autocomplete ui-front'); 204 widget.find('li').children('span').removeClass('ui-menu-item-wrapper ui-state-active'); 205 206 widget.width(field.outerWidth()); 207 }, 208 }); 209 210 field.data('ui-autocomplete')._renderItem = function (ul, item) { 211 return $('<li>').addClass('pac-item').append('<span class="pac-item-query">' + item.label + '</span>').appendTo(ul); 212 }; 126 213 } 127 214 128 215 // Clear location 129 field.on('input', function () {130 if ( !field.val()) {216 field.on('input', function () { 217 if (field.val().length <= 1) { 131 218 form.find('input[data-coordinate]').val(''); 219 220 if (regionField.length) { 221 regionField.val(''); 222 } 223 } 224 }); 225 226 field.on('focusout', function () { 227 if (!latitudeField.val() || !longitudeField.val()) { 228 field.val(''); 132 229 } 133 230 }); … … 135 232 // Detect location 136 233 if (navigator.geolocation) { 137 button.on('click', function (e) {138 navigator.geolocation.getCurrentPosition(function (position) {234 button.on('click', function (e) { 235 navigator.geolocation.getCurrentPosition(function (position) { 139 236 if (typeof mapboxData !== 'undefined') { 140 237 geocoder.options.reverseGeocode = true; … … 145 242 geocoder.options.reverseGeocode = false; 146 243 geocoder.options.limit = 5; 244 } else if ($.fn.geocomplete) { 245 field.geocomplete('find', position.coords.latitude + ' ' + position.coords.longitude); 147 246 } else { 148 field.geocomplete('find', position.coords.latitude + ' ' + position.coords.longitude); 247 geocoder.geocode({ location: { lat: position.coords.latitude, lng: position.coords.longitude } }, (results, status) => { 248 if (status === 'OK' && results.length) { 249 field.val(results[0].formatted_address).focus().autocomplete('search'); 250 } 251 }); 149 252 } 150 253 }); … … 158 261 159 262 // Map 160 container.find(hivepress.getSelector('map')).each(function () {263 container.find(hivepress.getSelector('map')).each(function () { 161 264 var container = $(this), 162 265 height = container.width(), … … 192 295 193 296 // Add markers 194 $.each(container.data('markers'), function (index, data) {297 $.each(container.data('markers'), function (index, data) { 195 298 bounds.extend([data.longitude, data.latitude]); 196 299 … … 208 311 }); 209 312 210 var observer = new ResizeObserver(function () {313 var observer = new ResizeObserver(function () { 211 314 map.resize(); 212 315 … … 254 357 255 358 // Add markers 256 $.each(container.data('markers'), function (index, data) {359 $.each(container.data('markers'), function (index, data) { 257 360 var nextWindow = new google.maps.InfoWindow({ 258 content: data.content,259 }),361 content: data.content, 362 }), 260 363 markerSettings = { 261 364 title: data.title, … … 279 382 var marker = new google.maps.Marker(markerSettings); 280 383 281 marker.addListener('spider_click', function () {384 marker.addListener('spider_click', function () { 282 385 if (prevWindow) { 283 386 prevWindow.close(); … … 297 400 map.fitBounds(bounds); 298 401 299 var observer = new ResizeObserver(function () {402 var observer = new ResizeObserver(function () { 300 403 map.fitBounds(bounds); 301 404 }).observe(container.get(0)); … … 308 411 309 412 if (container.data('scatter')) { 310 map.addListener('zoom_changed', function () {413 map.addListener('zoom_changed', function () { 311 414 iconSettings['scale'] = Math.pow(1.3125, map.getZoom()); 312 415 313 $.each(markers, function (index, marker) {416 $.each(markers, function (index, marker) { 314 417 markers[index].setIcon(iconSettings); 315 418 }); … … 320 423 } 321 424 322 $(document).on('hivepress:init', function (event, container) {425 $(document).on('hivepress:init', function (event, container) { 323 426 hivepress.initGeolocation(container); 324 427 }); -
hivepress-geolocation/trunk/assets/js/common.min.js
r3139907 r3373940 1 (function(a){"use strict";hivepress.initGeolocation=function(b){b.find(hivepress.getSelector("location")).each(function(){var b=a(this),c=b.closest("form"),d=b.find("input[type=text]"), e=c.find("input[data-coordinate=lat]"),f=c.find("input[data-coordinate=lng]"),g=c.find("input[data-region]"),h=b.find("a"),i={};if("undefined"!=typeof mapboxData){i={accessToken:mapboxData.apiKey,language:hivepressCoreData.language},b.data("countries")&&(i.countries=b.data("countries").join(",")),b.data("types")&&(i.types=b.data("types").join(","));var j=new MapboxGeocoder(i);j.addTo(b.get(0));var k=b.children(".mapboxgl-ctrl"),l=d.prop("attributes");d.remove(),d=k.find("input[type=text]"),a.each(l,function(){d.attr(this.name,this.value)}),k.detach().prependTo(b),j.on("result",function(a){var b=["place","district","region","country"];g.length&&(a.result.place_type.filter(a=>b.includes(a)).length?g.val(a.result.id):g.val("")),f.val(a.result.geometry.coordinates[0]),e.val(a.result.geometry.coordinates[1])})}else i={details:c,detailsAttribute:"data-coordinate"},b.data("countries")&&(i.componentRestrictions={country:b.data("countries")}),b.data("types")&&(i.types=b.data("types")),d.geocomplete(i),d.bind("geocode:result",function(c,e){var f=[],h=["locality","administrative_area_level_2","administrative_area_level_1","country"];g.length&&(e.address_components[0].types.filter(a=>h.includes(a)).length?g.val(e.place_id):g.val("")),b.data("scatter")&&(h.push("route"),a.each(e.address_components,function(a,b){b.types.filter(a=>h.includes(a)).length&&f.push(b.long_name)}),d.val(f.join(", ")))});d.on("input",function(){d.val()||c.find("input[data-coordinate]").val("")}),navigator.geolocation?h.on("click",function(a){navigator.geolocation.getCurrentPosition(function(a){"undefined"==typeof mapboxData?d.geocomplete("find",a.coords.latitude+" "+a.coords.longitude):(j.options.reverseGeocode=!0,j.options.limit=1,j.query(a.coords.latitude+","+a.coords.longitude),j.options.reverseGeocode=!1,j.options.limit=5)}),a.preventDefault()}):h.hide()}),b.find(hivepress.getSelector("map")).each(function(){var b=a(this),c=b.width(),d=b.data("max-zoom"),e=b.data("marker");if(b.is("[data-height]")&&(c=b.data("height")),b.height(c),"undefined"!=typeof mapboxData){mapboxgl.accessToken=mapboxData.apiKey;var f=new mapboxgl.LngLatBounds,g=new mapboxgl.Map({container:b.get(0),style:"mapbox://styles/mapbox/streets-v11",center:[0,0],zoom:1});g.addControl(new mapboxgl.NavigationControl),g.addControl(new mapboxgl.FullscreenControl),g.addControl(new MapboxLanguage),a.each(b.data("markers"),function(a,b){f.extend([b.longitude,b.latitude]);new mapboxgl.Marker().setLngLat([b.longitude,b.latitude]).setPopup(new mapboxgl.Popup().setHTML(b.content)).addTo(g)}),g.fitBounds(f,{maxZoom:d-1,padding:50,duration:0});var h=new ResizeObserver(function(){g.resize(),g.fitBounds(f,{maxZoom:d-1,padding:50,duration:0})}).observe(b.get(0))}else{var i=!1,j=[],f=new google.maps.LatLngBounds,g=new google.maps.Map(b.get(0),{zoom:3,minZoom:2,maxZoom:d,mapTypeControl:!1,streetViewControl:!1,center:{lat:0,lng:0},styles:[{featureType:"poi",stylers:[{visibility:"off"}]}]}),k=new OverlappingMarkerSpiderfier(g,{markersWontMove:!0,markersWontHide:!0,basicFormatEvents:!0}),l={path:google.maps.SymbolPath.CIRCLE,fillColor:"#3a77ff",fillOpacity:.25,strokeColor:"#3a77ff",strokeWeight:1,strokeOpacity:.75,scale:10};a.each(b.data("markers"),function(a,c){var d=new google.maps.InfoWindow({content:c.content}),h={title:c.title,position:{lat:c.latitude,lng:c.longitude}};e&&(h.icon={url:e,scaledSize:new google.maps.Size(50,50)}),b.data("scatter")&&(h.icon=l);var m=new google.maps.Marker(h);m.addListener("spider_click",function(){i&&i.close(),i=d,d.open(g,m)}),j.push(m),k.addMarker(m),f.extend(m.getPosition())}),g.fitBounds(f);var h=new ResizeObserver(function(){g.fitBounds(f)}).observe(b.get(0)),m=new MarkerClusterer(g,j,{imagePath:hivepressGeolocationData.assetURL+"/images/markerclustererplus/m",maxZoom:d-1});b.data("scatter")&&g.addListener("zoom_changed",function(){var b=Math.pow;l.scale=b(1.3125,g.getZoom()),a.each(j,function(a){j[a].setIcon(l)})})}})},a(document).on("hivepress:init",function(a,b){hivepress.initGeolocation(b)})})(jQuery);1 (function(a){"use strict";hivepress.initGeolocation=function(b){b.find(hivepress.getSelector("location")).each(function(){var b=a(this),c=b.closest("form"),d=b.find("input[type=text]"),f=c.find("input[data-coordinate=lat]"),g=c.find("input[data-coordinate=lng]"),h=c.find("input[data-region]"),i=[],j=b.find("a"),k={};if(d.data("region-types")&&(i=d.data("region-types")),"undefined"!=typeof mapboxData){k={accessToken:mapboxData.apiKey,language:hivepressCoreData.language},b.data("countries")&&(k.countries=b.data("countries").join(",")),b.data("types")&&(k.types=b.data("types").join(","));var l=new MapboxGeocoder(k);l.addTo(b.get(0));var m=b.children(".mapboxgl-ctrl"),n=d.prop("attributes");d.remove(),d=m.find("input[type=text]"),a.each(n,function(){d.attr(this.name,this.value)}),m.detach().prependTo(b),l.on("result",function(a){var b=i;h.length&&(a.result.place_type.filter(a=>b.includes(a)).length?h.val(a.result.id):h.val("")),g.val(a.result.geometry.coordinates[0]),f.val(a.result.geometry.coordinates[1])})}else if(a.fn.geocomplete)k={details:c,detailsAttribute:"data-coordinate"},b.data("countries")&&(k.componentRestrictions={country:b.data("countries")}),b.data("types")&&(k.types=b.data("types")),d.geocomplete(k),d.bind("geocode:result",function(c,e){var f=[],g=i;h.length&&(e.address_components[0].types.filter(a=>g.includes(a)).length?h.val(e.place_id):h.val("")),b.data("scatter")&&(g.push("route"),a.each(e.address_components,function(a,b){b.types.filter(a=>g.includes(a)).length&&f.push(b.long_name)}),d.val(f.join(", ")))});else{k={language:hivepressCoreData.language,sessionToken:!1},b.data("countries")&&(k.includedRegionCodes=b.data("countries")),b.data("types")&&(k.includedPrimaryTypes=b.data("types"));var l=new google.maps.Geocoder;d.autocomplete({source:async function(b,c){var d=[];k.sessionToken||(k.sessionToken=new google.maps.places.AutocompleteSessionToken);const{suggestions:e}=await google.maps.places.AutocompleteSuggestion.fetchAutocompleteSuggestions(a.extend(k,{input:b.term}));for(let a of e)d.push({label:a.placePrediction.text.toString(),value:a.placePrediction});c(d)},select:async function(c,e){c.preventDefault();const j=e.item.value.toPlace();await j.fetchFields({fields:["location","addressComponents"]}),k.sessionToken=!1,d.val(e.item.label),f.val(j.location.lat),g.val(j.location.lng);var l=[],m=i;h.length&&(j.addressComponents[0].types.filter(a=>m.includes(a)).length?h.val(j.id):h.val("")),b.data("scatter")&&(m.push("route"),a.each(j.addressComponents,function(a,b){b.types.filter(a=>m.includes(a)).length&&l.push(b.longText)}),d.val(l.join(", ")))},open:function(){var b=a(this).autocomplete("widget");b.addClass("pac-container pac-logo hdpi").removeClass("ui-menu ui-widget ui-widget-content ui-autocomplete ui-front"),b.find("li").children("span").removeClass("ui-menu-item-wrapper ui-state-active"),b.width(d.outerWidth())}}),d.data("ui-autocomplete")._renderItem=function(b,c){return a("<li>").addClass("pac-item").append("<span class=\"pac-item-query\">"+c.label+"</span>").appendTo(b)}}d.on("input",function(){1>=d.val().length&&(c.find("input[data-coordinate]").val(""),h.length&&h.val(""))}),d.on("focusout",function(){f.val()&&g.val()||d.val("")}),navigator.geolocation?j.on("click",function(b){navigator.geolocation.getCurrentPosition(function(b){"undefined"==typeof mapboxData?a.fn.geocomplete?d.geocomplete("find",b.coords.latitude+" "+b.coords.longitude):l.geocode({location:{lat:b.coords.latitude,lng:b.coords.longitude}},(a,b)=>{"OK"===b&&a.length&&d.val(a[0].formatted_address).focus().autocomplete("search")}):(l.options.reverseGeocode=!0,l.options.limit=1,l.query(b.coords.latitude+","+b.coords.longitude),l.options.reverseGeocode=!1,l.options.limit=5)}),b.preventDefault()}):j.hide()}),b.find(hivepress.getSelector("map")).each(function(){var b=a(this),c=b.width(),d=b.data("max-zoom"),e=b.data("marker");if(b.is("[data-height]")&&(c=b.data("height")),b.height(c),"undefined"!=typeof mapboxData){mapboxgl.accessToken=mapboxData.apiKey;var f=new mapboxgl.LngLatBounds,g=new mapboxgl.Map({container:b.get(0),style:"mapbox://styles/mapbox/streets-v11",center:[0,0],zoom:1});g.addControl(new mapboxgl.NavigationControl),g.addControl(new mapboxgl.FullscreenControl),g.addControl(new MapboxLanguage),a.each(b.data("markers"),function(a,b){f.extend([b.longitude,b.latitude]);new mapboxgl.Marker().setLngLat([b.longitude,b.latitude]).setPopup(new mapboxgl.Popup().setHTML(b.content)).addTo(g)}),g.fitBounds(f,{maxZoom:d-1,padding:50,duration:0});var h=new ResizeObserver(function(){g.resize(),g.fitBounds(f,{maxZoom:d-1,padding:50,duration:0})}).observe(b.get(0))}else{var i=!1,j=[],f=new google.maps.LatLngBounds,g=new google.maps.Map(b.get(0),{zoom:3,minZoom:2,maxZoom:d,mapTypeControl:!1,streetViewControl:!1,center:{lat:0,lng:0},styles:[{featureType:"poi",stylers:[{visibility:"off"}]}]}),k=new OverlappingMarkerSpiderfier(g,{markersWontMove:!0,markersWontHide:!0,basicFormatEvents:!0}),l={path:google.maps.SymbolPath.CIRCLE,fillColor:"#3a77ff",fillOpacity:.25,strokeColor:"#3a77ff",strokeWeight:1,strokeOpacity:.75,scale:10};a.each(b.data("markers"),function(a,c){var d=new google.maps.InfoWindow({content:c.content}),h={title:c.title,position:{lat:c.latitude,lng:c.longitude}};e&&(h.icon={url:e,scaledSize:new google.maps.Size(50,50)}),b.data("scatter")&&(h.icon=l);var m=new google.maps.Marker(h);m.addListener("spider_click",function(){i&&i.close(),i=d,d.open(g,m)}),j.push(m),k.addMarker(m),f.extend(m.getPosition())}),g.fitBounds(f);var h=new ResizeObserver(function(){g.fitBounds(f)}).observe(b.get(0)),m=new MarkerClusterer(g,j,{imagePath:hivepressGeolocationData.assetURL+"/images/markerclustererplus/m",maxZoom:d-1});b.data("scatter")&&g.addListener("zoom_changed",function(){var b=Math.pow;l.scale=b(1.3125,g.getZoom()),a.each(j,function(a){j[a].setIcon(l)})})}})},a(document).on("hivepress:init",function(a,b){hivepress.initGeolocation(b)})})(jQuery); -
hivepress-geolocation/trunk/hivepress-geolocation.php
r2760896 r3373940 3 3 * Plugin Name: HivePress Geolocation 4 4 * Description: Allow users to search listings by location. 5 * Version: 1.3. 75 * Version: 1.3.8 6 6 * Author: HivePress 7 7 * Author URI: https://hivepress.io/ -
hivepress-geolocation/trunk/includes/blocks/class-listing-map.php
r2737732 r3373940 115 115 rewind_posts(); 116 116 117 while ( have_posts() ) { 118 the_post(); 117 if ( 'vendor' === $this->model ) { 119 118 120 119 // Add marker. 121 120 $markers[] = $this->get_marker( get_post() ); 121 } else { 122 while ( have_posts() ) { 123 the_post(); 124 125 // Add marker. 126 $markers[] = $this->get_marker( get_post() ); 127 } 128 129 rewind_posts(); 122 130 } 123 124 rewind_posts();125 131 126 132 // Render markers. -
hivepress-geolocation/trunk/includes/components/class-geolocation.php
r3139907 r3373940 91 91 92 92 /** 93 * Gets region types. 94 * 95 * @return array 96 */ 97 public function get_region_types() { 98 $types = (array) get_option( 'hp_geolocation_region_types', [ 'place', 'district', 'region', 'country' ] ); 99 100 if ( get_option( 'hp_geolocation_provider' ) !== 'mapbox' ) { 101 $types = array_values( 102 array_intersect_key( 103 [ 104 'postcode' => 'postal_code', 105 'locality' => 'sublocality', 106 'place' => 'locality', 107 'district' => 'administrative_area_level_2', 108 'region' => 'administrative_area_level_1', 109 'country' => 'country', 110 ], 111 array_flip( $types ) 112 ) 113 ); 114 } 115 116 return $types; 117 } 118 119 /** 93 120 * Adds model attributes. 94 121 * … … 97 124 */ 98 125 public function add_attributes( $attributes ) { 126 127 // Get model. 128 $model = explode( '/', current_filter() )[3]; 99 129 100 130 // Get countries. … … 108 138 } 109 139 110 return array_merge( 140 // Add attributes. 141 $attributes = array_merge( 111 142 $attributes, 112 143 [ … … 137 168 'edit_field' => [ 138 169 'label' => esc_html__( 'Latitude', 'hivepress-geolocation' ), 139 'type' => 'latitude',170 'type' => 'latitude', 140 171 ], 141 172 … … 152 183 'edit_field' => [ 153 184 'label' => esc_html__( 'Longitude', 'hivepress-geolocation' ), 154 'type' => 'longitude',185 'type' => 'longitude', 155 186 ], 156 187 … … 163 194 ] 164 195 ); 196 197 if ( get_option( 'hp_geolocation_generate_regions' ) ) { 198 $field_args = [ 199 'label' => esc_html__( 'Region', 'hivepress-geolocation' ), 200 'type' => 'select', 201 'options' => 'terms', 202 '_order' => 99, 203 204 'option_args' => [ 205 'taxonomy' => hp\prefix( $model . '_region' ), 206 ], 207 ]; 208 209 $attributes['region'] = [ 210 'protected' => true, 211 'filterable' => true, 212 213 'edit_field' => $field_args, 214 'search_field' => $field_args, 215 ]; 216 } 217 218 return $attributes; 165 219 } 166 220 … … 268 322 $scripts['geolocation']['deps'] = array_merge( 269 323 $scripts['geolocation']['deps'], 270 [ 'geocomplete', 'markerclustererplus', 'markerspiderfier' ] 271 ); 324 [ 'markerclustererplus', 'markerspiderfier' ] 325 ); 326 327 if ( get_option( 'hp_gmaps_use_legacy_api', true ) ) { 328 $scripts['geolocation']['deps'][] = 'geocomplete'; 329 } else { 330 $scripts['geolocation']['deps'][] = 'jquery-ui-autocomplete'; 331 332 unset( $scripts['geocomplete'] ); 333 } 272 334 } 273 335 … … 318 380 $request_url = 'https://api.mapbox.com/geocoding/v5/mapbox.places/' . rawurlencode( $longitude . ',' . $latitude ) . '.json?' . http_build_query( 319 381 [ 320 'access_token' => get_option( 'hp_mapbox_ api_key' ),382 'access_token' => get_option( 'hp_mapbox_secret_key' ) ? get_option( 'hp_mapbox_secret_key' ) : get_option( 'hp_mapbox_api_key' ), 321 383 'language' => hivepress()->translator->get_language(), 322 323 'types' => implode( 324 ',', 325 [ 326 'place', 327 'district', 328 'region', 329 'country', 330 ] 331 ), 384 'types' => implode( ',', $this->get_region_types() ), 332 385 ] 333 386 ); … … 338 391 'key' => get_option( 'hp_gmaps_secret_key' ) ? get_option( 'hp_gmaps_secret_key' ) : get_option( 'hp_gmaps_api_key' ), 339 392 'language' => hivepress()->translator->get_language(), 340 341 'result_type' => implode( 342 '|', 343 [ 344 'locality', 345 'administrative_area_level_2', 346 'administrative_area_level_1', 347 'country', 348 ] 349 ), 393 'result_type' => implode( '|', $this->get_region_types() ), 350 394 ] 351 395 ); … … 381 425 382 426 // Get region. 383 $region_args = term_exists( $region_name, $region_taxonomy, $region_id ); 427 $region_args = array_filter( 428 [ 429 'term_id' => hp\get_first_array_value( 430 get_terms( 431 [ 432 'taxonomy' => $region_taxonomy, 433 'fields' => 'ids', 434 'number' => 1, 435 'hide_empty' => false, 436 'meta_key' => 'hp_code', 437 'meta_value' => $region_code, 438 'parent' => $region_id, 439 ] 440 ) 441 ), 442 ] 443 ); 384 444 385 445 if ( ! $region_args ) { … … 421 481 if ( hivepress()->get_version( 'requests' ) ) { 422 482 $settings['geolocation']['sections']['restrictions']['fields']['geolocation_models']['options']['request'] = hivepress()->translator->get_string( 'requests' ); 483 } 484 485 if ( get_option( 'hp_installed_time' ) < strtotime( '2025-10-05' ) ) { 486 $settings['integrations']['sections']['gmaps']['fields']['gmaps_use_legacy_api']['default'] = true; 423 487 } 424 488 … … 591 655 $radius = absint( hp\get_array_value( $_GET, '_radius' ) ); 592 656 593 if ( $radius >= 1 && $radius <= 100) {657 if ( $radius >= 1 && $radius <= get_option( 'hp_geolocation_max_radius', 100 ) ) { 594 658 $value = $radius; 595 659 } … … 613 677 614 678 if ( get_option( 'hp_geolocation_generate_regions' ) ) { 679 680 // Remove region field. 681 unset( $form_args['fields']['region'] ); 615 682 616 683 // Add region field. … … 644 711 'type' => 'number', 645 712 'min_value' => 1, 646 'max_value' => 100,713 'max_value' => get_option( 'hp_geolocation_max_radius', 100 ), 647 714 'default' => get_option( 'hp_geolocation_radius' ), 648 715 '_order' => 15, … … 654 721 655 722 'attributes' => [ 656 'data- component' => 'radius-slider',723 'data-mode' => 'range', 657 724 ], 658 725 ]; … … 697 764 } 698 765 699 return h p\merge_trees(766 return hivepress()->template->merge_blocks( 700 767 $template_args, 701 768 [ 702 'blocks' => [ 703 $model . '_details_primary' => [ 704 'blocks' => [ 705 $model . '_location' => [ 706 'type' => 'part', 707 'path' => $model . '/view/' . $model . '-location', 708 '_order' => 5, 769 $model . '_details_primary' => [ 770 'blocks' => [ 771 $model . '_location' => [ 772 'type' => 'part', 773 'path' => $model . '/view/' . $model . '-location', 774 '_order' => 5, 775 ], 776 ], 777 ], 778 ] 779 ); 780 } 781 782 /** 783 * Alters model view page. 784 * 785 * @param array $template_args Template arguments. 786 * @param object $template Template object. 787 * @return array 788 */ 789 public function alter_model_view_page( $template_args, $template ) { 790 791 // Get model name. 792 $model = $template::get_meta( 'model' ); 793 794 if ( ! $model ) { 795 $model = 'listing'; 796 } 797 798 // Add map. 799 $template_args = hivepress()->template->merge_blocks( 800 $template_args, 801 [ 802 'page_sidebar' => [ 803 'blocks' => [ 804 $model . '_map' => [ 805 'type' => 'listing_map', 806 'model' => $model, 807 '_label' => esc_html__( 'Map', 'hivepress-geolocation' ), 808 '_order' => 25, 809 810 'attributes' => [ 811 'class' => [ 'hp-' . $model . '__map', 'hp-listing__map', 'widget' ], 709 812 ], 710 813 ], … … 713 816 ] 714 817 ); 715 } 716 717 /** 718 * Alters model view page. 818 819 return hivepress()->template->merge_blocks( 820 $template_args, 821 [ 822 $model . '_details_primary' => [ 823 'blocks' => [ 824 $model . '_location' => [ 825 'type' => 'part', 826 'path' => $model . '/view/' . $model . '-location', 827 '_label' => esc_html__( 'Location', 'hivepress-geolocation' ), 828 '_order' => 5, 829 ], 830 ], 831 ], 832 ] 833 ); 834 } 835 836 /** 837 * Alters models view page. 719 838 * 720 839 * @param array $template_args Template arguments. … … 722 841 * @return array 723 842 */ 724 public function alter_model _view_page( $template_args, $template ) {843 public function alter_models_view_page( $template_args, $template ) { 725 844 726 845 // Get model name. … … 731 850 } 732 851 733 // Get new blocks. 734 $blocks = [ 735 $model . '_details_primary' => [ 736 'blocks' => [ 737 $model . '_location' => [ 738 'type' => 'part', 739 'path' => $model . '/view/' . $model . '-location', 740 '_label' => esc_html__( 'Location', 'hivepress-geolocation' ), 741 '_order' => 5, 742 ], 743 ], 744 ], 745 ]; 746 747 if ( 'vendor' !== $model ) { 748 $blocks['page_sidebar'] = [ 749 'blocks' => [ 750 $model . '_map' => [ 751 'type' => 'listing_map', 752 'model' => $model, 753 '_label' => esc_html__( 'Map', 'hivepress-geolocation' ), 754 '_order' => 25, 755 756 'attributes' => [ 757 'class' => [ 'hp-' . $model . '__map', 'hp-listing__map', 'widget' ], 758 ], 759 ], 760 ], 761 ]; 762 } 763 764 return hp\merge_trees( 852 return hivepress()->template->merge_blocks( 765 853 $template_args, 766 854 [ 767 'blocks' => $blocks, 855 'page_sidebar' => [ 856 'blocks' => [ 857 $model . '_map' => [ 858 'type' => 'listing_map', 859 'model' => $model, 860 '_label' => esc_html__( 'Map', 'hivepress-geolocation' ), 861 '_order' => 15, 862 863 'attributes' => [ 864 'class' => [ 'widget' ], 865 ], 866 ], 867 ], 868 ], 768 869 ] 769 870 ); 770 871 } 771 772 /**773 * Alters models view page.774 *775 * @param array $template_args Template arguments.776 * @param object $template Template object.777 * @return array778 */779 public function alter_models_view_page( $template_args, $template ) {780 781 // Get model name.782 $model = $template::get_meta( 'model' );783 784 if ( ! $model ) {785 $model = 'listing';786 }787 788 return hp\merge_trees(789 $template_args,790 [791 'blocks' => [792 'page_sidebar' => [793 'blocks' => [794 $model . '_map' => [795 'type' => 'listing_map',796 'model' => $model,797 '_label' => esc_html__( 'Map', 'hivepress-geolocation' ),798 '_order' => 15,799 800 'attributes' => [801 'class' => [ 'widget' ],802 ],803 ],804 ],805 ],806 ],807 ]808 );809 }810 872 } -
hivepress-geolocation/trunk/includes/configs/scripts.php
r2703788 r3373940 12 12 13 13 return [ 14 'geocomplete' => [14 'geocomplete' => [ 15 15 'handle' => 'geocomplete', 16 16 'src' => hivepress()->get_url( 'geolocation' ) . '/assets/js/jquery.geocomplete.min.js', … … 20 20 ], 21 21 22 'markerclustererplus' => [22 'markerclustererplus' => [ 23 23 'handle' => 'markerclustererplus', 24 24 'src' => hivepress()->get_url( 'geolocation' ) . '/assets/js/markerclustererplus.min.js', … … 28 28 ], 29 29 30 'markerspiderfier' => [30 'markerspiderfier' => [ 31 31 'handle' => 'markerspiderfier', 32 32 'src' => hivepress()->get_url( 'geolocation' ) . '/assets/js/oms.min.js', … … 36 36 ], 37 37 38 'geolocation' => [38 'geolocation' => [ 39 39 'handle' => 'hivepress-geolocation', 40 40 'src' => hivepress()->get_url( 'geolocation' ) . '/assets/js/common.min.js', … … 47 47 ], 48 48 ], 49 50 'geolocation_frontend' => [51 'handle' => 'hivepress-geolocation-frontend',52 'src' => hivepress()->get_url( 'geolocation' ) . '/assets/js/frontend.min.js',53 'version' => hivepress()->get_version( 'geolocation' ),54 'deps' => [ 'hivepress-core' ],55 ],56 49 ]; -
hivepress-geolocation/trunk/includes/configs/settings.php
r2737732 r3373940 71 71 'geolocation_radius' => [ 72 72 'label' => esc_html__( 'Radius', 'hivepress-geolocation' ), 73 'description' => esc_html__( 'Set the radius that defines the location search area.', 'hivepress-geolocation' ),73 'description' => esc_html__( 'Set the default radius used for the location search.', 'hivepress-geolocation' ), 74 74 'type' => 'number', 75 75 'min_value' => 1, … … 79 79 ], 80 80 81 'geolocation_use_miles' => [ 82 'caption' => esc_html__( 'Use miles instead of kilometers', 'hivepress-geolocation' ), 81 'geolocation_max_radius' => [ 82 'label' => esc_html__( 'Maximum Radius', 'hivepress-geolocation' ), 83 'description' => esc_html__( 'Set the maximum radius allowed for the location search.', 'hivepress-geolocation' ), 84 'type' => 'number', 85 'min_value' => 1, 86 'default' => 100, 87 'required' => true, 88 '_parent' => 'geolocation_allow_radius', 89 '_order' => 55, 90 ], 91 92 'geolocation_allow_radius' => [ 93 'caption' => esc_html__( 'Allow users to adjust the radius', 'hivepress-geolocation' ), 83 94 'type' => 'checkbox', 84 95 '_order' => 60, 85 96 ], 86 97 87 'geolocation_ allow_radius'=> [88 'caption' => esc_html__( ' Allow users to change radius', 'hivepress-geolocation' ),98 'geolocation_use_miles' => [ 99 'caption' => esc_html__( 'Use miles instead of kilometers', 'hivepress-geolocation' ), 89 100 'type' => 'checkbox', 90 101 '_order' => 70, … … 93 104 'geolocation_generate_regions' => [ 94 105 'label' => esc_html__( 'Regions', 'hivepress-geolocation' ), 95 'description' => esc_html__( 'Check this option to create a page for each region.', 'hivepress-geolocation' ),106 'description' => esc_html__( 'Check this option to create pages for regions and enable region-specific search.', 'hivepress-geolocation' ), 96 107 'caption' => esc_html__( 'Generate regions from locations', 'hivepress-geolocation' ), 97 108 'type' => 'checkbox', … … 99 110 ], 100 111 112 'geolocation_region_types' => [ 113 'label' => esc_html__( 'Region Types', 'hivepress-geolocation' ), 114 'description' => esc_html__( 'Select which region types should have page creation and location search enabled.', 'hivepress-geolocation' ), 115 'type' => 'select', 116 'default' => [ 'place', 'district', 'region', 'country' ], 117 'multiple' => true, 118 'required' => true, 119 '_parent' => 'geolocation_generate_regions', 120 '_order' => 85, 121 122 'options' => [ 123 'country' => esc_html__( 'Country', 'hivepress-geolocation' ), 124 'region' => esc_html__( 'Region', 'hivepress-geolocation' ), 125 'district' => esc_html__( 'Subregion', 'hivepress-geolocation' ), 126 'place' => esc_html__( 'City', 'hivepress-geolocation' ), 127 'locality' => esc_html__( 'District', 'hivepress-geolocation' ), 128 'postcode' => esc_html__( 'Postcode', 'hivepress-geolocation' ), 129 ], 130 ], 131 101 132 'geolocation_hide_address' => [ 102 'label' => esc_html__( 'Address', 'hivepress-geolocation' ), 103 'caption' => esc_html__( 'Hide the exact address', 'hivepress-geolocation' ), 104 'type' => 'checkbox', 105 '_order' => 90, 133 'label' => esc_html__( 'Address', 'hivepress-geolocation' ), 134 'description' => esc_html__( 'Check this option to prevent displaying exact locations.', 'hivepress-geolocation' ), 135 'caption' => esc_html__( 'Hide the exact address', 'hivepress-geolocation' ), 136 'type' => 'checkbox', 137 '_order' => 90, 106 138 ], 107 139 ], … … 117 149 118 150 'fields' => [ 119 'gmaps_api_key' => [151 'gmaps_api_key' => [ 120 152 'label' => hivepress()->translator->get_string( 'api_key' ), 121 153 'type' => 'text', … … 124 156 ], 125 157 126 'gmaps_secret_key' => [158 'gmaps_secret_key' => [ 127 159 'label' => hivepress()->translator->get_string( 'secret_key' ), 128 160 'description' => esc_html__( 'Set the API key without HTTP restrictions used for generating regions from locations.', 'hivepress-geolocation' ), … … 130 162 'max_length' => 256, 131 163 '_order' => 20, 164 ], 165 166 'gmaps_use_legacy_api' => [ 167 'label' => hivepress()->translator->get_string( 'version' ), 168 'caption' => esc_html__( 'Use the legacy version of Places API', 'hivepress-geolocation' ), 169 'type' => 'checkbox', 170 '_order' => 30, 132 171 ], 133 172 ], … … 139 178 140 179 'fields' => [ 141 'mapbox_api_key' => [180 'mapbox_api_key' => [ 142 181 'label' => hivepress()->translator->get_string( 'api_key' ), 143 182 'type' => 'text', 144 183 'max_length' => 256, 145 184 '_order' => 10, 185 ], 186 187 'mapbox_secret_key' => [ 188 'label' => hivepress()->translator->get_string( 'secret_key' ), 189 'description' => esc_html__( 'Set the API key without HTTP restrictions used for generating regions from locations.', 'hivepress-geolocation' ), 190 'type' => 'text', 191 'max_length' => 256, 192 '_order' => 20, 146 193 ], 147 194 ], -
hivepress-geolocation/trunk/includes/configs/styles.php
r2233321 r3373940 12 12 13 13 return [ 14 'geolocation' => [ 15 'handle' => 'hivepress-geolocation', 16 'src' => hivepress()->get_url( 'geolocation' ) . '/assets/css/common.min.css', 17 'version' => hivepress()->get_version( 'geolocation' ), 18 'scope' => [ 'frontend', 'backend' ], 19 ], 20 14 21 'geolocation_backend' => [ 15 22 'handle' => 'hivepress-geolocation-backend', -
hivepress-geolocation/trunk/includes/fields/class-location.php
r2737732 r3373940 79 79 $attributes['data-countries'] = wp_json_encode( $this->countries ); 80 80 81 // Set region types. 82 $attributes['data-region-types'] = wp_json_encode( hivepress()->geolocation->get_region_types() ); 83 81 84 // Set component. 82 85 $attributes['data-component'] = 'location'; -
hivepress-geolocation/trunk/languages/hivepress-geolocation.pot
r3139907 r3373940 1 # Copyright (C) 202 4HivePress1 # Copyright (C) 2025 HivePress 2 2 # This file is distributed under the same license as the HivePress Geolocation plugin. 3 3 msgid "" 4 4 msgstr "" 5 "Project-Id-Version: HivePress Geolocation 1.3. 7\n"5 "Project-Id-Version: HivePress Geolocation 1.3.8\n" 6 6 "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/hivepress-geolocation\n" 7 7 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" … … 10 10 "Content-Type: text/plain; charset=UTF-8\n" 11 11 "Content-Transfer-Encoding: 8bit\n" 12 "POT-Creation-Date: 202 4-08-22T17:26:10+00:00\n"12 "POT-Creation-Date: 2025-10-06T19:21:35+00:00\n" 13 13 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" 14 "X-Generator: WP-CLI 2.1 1.0\n"14 "X-Generator: WP-CLI 2.12.0\n" 15 15 "X-Domain: hivepress-geolocation\n" 16 16 … … 35 35 msgstr "" 36 36 37 #: includes/components/class-geolocation.php:1 1838 #: includes/components/class-geolocation.php:1 2639 #: includes/components/class-geolocation.php: 74037 #: includes/components/class-geolocation.php:149 38 #: includes/components/class-geolocation.php:157 39 #: includes/components/class-geolocation.php:827 40 40 msgid "Location" 41 41 msgstr "" 42 42 43 #: includes/components/class-geolocation.php:1 3843 #: includes/components/class-geolocation.php:169 44 44 msgid "Latitude" 45 45 msgstr "" 46 46 47 #: includes/components/class-geolocation.php:1 5347 #: includes/components/class-geolocation.php:184 48 48 msgid "Longitude" 49 49 msgstr "" 50 50 51 #: includes/components/class-geolocation.php:184 52 #: includes/configs/settings.php:94 51 #: includes/components/class-geolocation.php:199 52 #: includes/components/class-geolocation.php:239 53 #: includes/configs/settings.php:124 54 msgid "Region" 55 msgstr "" 56 57 #: includes/components/class-geolocation.php:238 58 #: includes/configs/settings.php:105 53 59 msgid "Regions" 54 60 msgstr "" 55 61 56 #: includes/components/class-geolocation.php:185 57 msgid "Region" 58 msgstr "" 59 60 #: includes/components/class-geolocation.php:186 62 #: includes/components/class-geolocation.php:240 61 63 msgid "Add Region" 62 64 msgstr "" 63 65 64 #: includes/components/class-geolocation.php: 18766 #: includes/components/class-geolocation.php:241 65 67 msgid "Edit Region" 66 68 msgstr "" 67 69 68 #: includes/components/class-geolocation.php: 18870 #: includes/components/class-geolocation.php:242 69 71 msgid "Update Region" 70 72 msgstr "" 71 73 72 #: includes/components/class-geolocation.php: 18974 #: includes/components/class-geolocation.php:243 73 75 msgid "View Region" 74 76 msgstr "" 75 77 76 #: includes/components/class-geolocation.php: 19078 #: includes/components/class-geolocation.php:244 77 79 msgid "Parent Region" 78 80 msgstr "" 79 81 80 #: includes/components/class-geolocation.php: 19182 #: includes/components/class-geolocation.php:245 81 83 msgid "Search Regions" 82 84 msgstr "" 83 85 84 #: includes/components/class-geolocation.php: 19286 #: includes/components/class-geolocation.php:246 85 87 msgid "No regions found" 86 88 msgstr "" 87 89 88 #: includes/components/class-geolocation.php: 64390 #: includes/components/class-geolocation.php:710 89 91 #: includes/configs/settings.php:72 90 92 msgid "Radius" 91 93 msgstr "" 92 94 93 #: includes/components/class-geolocation.php: 65295 #: includes/components/class-geolocation.php:719 94 96 msgctxt "miles" 95 97 msgid "mi" 96 98 msgstr "" 97 99 98 #: includes/components/class-geolocation.php: 652100 #: includes/components/class-geolocation.php:719 99 101 msgctxt "kilometers" 100 102 msgid "km" 101 103 msgstr "" 102 104 103 #: includes/components/class-geolocation.php: 676105 #: includes/components/class-geolocation.php:743 104 106 msgctxt "sort order" 105 107 msgid "Distance" 106 108 msgstr "" 107 109 108 #: includes/components/class-geolocation.php: 753109 #: includes/components/class-geolocation.php: 797110 #: includes/components/class-geolocation.php:807 111 #: includes/components/class-geolocation.php:860 110 112 msgid "Map" 111 113 msgstr "" … … 148 150 149 151 #: includes/configs/settings.php:73 150 msgid "Set the radius that defines the location search area."152 msgid "Set the default radius used for the location search." 151 153 msgstr "" 152 154 153 155 #: includes/configs/settings.php:82 156 msgid "Maximum Radius" 157 msgstr "" 158 159 #: includes/configs/settings.php:83 160 msgid "Set the maximum radius allowed for the location search." 161 msgstr "" 162 163 #: includes/configs/settings.php:93 164 msgid "Allow users to adjust the radius" 165 msgstr "" 166 167 #: includes/configs/settings.php:99 154 168 msgid "Use miles instead of kilometers" 155 169 msgstr "" 156 170 157 #: includes/configs/settings.php:88 158 msgid "Allow users to change radius" 159 msgstr "" 160 161 #: includes/configs/settings.php:95 162 msgid "Check this option to create a page for each region." 163 msgstr "" 164 165 #: includes/configs/settings.php:96 171 #: includes/configs/settings.php:106 172 msgid "Check this option to create pages for regions and enable region-specific search." 173 msgstr "" 174 175 #: includes/configs/settings.php:107 166 176 msgid "Generate regions from locations" 167 177 msgstr "" 168 178 169 #: includes/configs/settings.php:102 179 #: includes/configs/settings.php:113 180 msgid "Region Types" 181 msgstr "" 182 183 #: includes/configs/settings.php:114 184 msgid "Select which region types should have page creation and location search enabled." 185 msgstr "" 186 187 #: includes/configs/settings.php:123 188 msgid "Country" 189 msgstr "" 190 191 #: includes/configs/settings.php:125 192 msgid "Subregion" 193 msgstr "" 194 195 #: includes/configs/settings.php:126 196 msgid "City" 197 msgstr "" 198 199 #: includes/configs/settings.php:127 200 msgid "District" 201 msgstr "" 202 203 #: includes/configs/settings.php:128 204 msgid "Postcode" 205 msgstr "" 206 207 #: includes/configs/settings.php:133 170 208 msgid "Address" 171 209 msgstr "" 172 210 173 #: includes/configs/settings.php:103 211 #: includes/configs/settings.php:134 212 msgid "Check this option to prevent displaying exact locations." 213 msgstr "" 214 215 #: includes/configs/settings.php:135 174 216 msgid "Hide the exact address" 175 217 msgstr "" 176 218 177 #: includes/configs/settings.php:128 219 #: includes/configs/settings.php:160 220 #: includes/configs/settings.php:189 178 221 msgid "Set the API key without HTTP restrictions used for generating regions from locations." 179 222 msgstr "" 180 223 181 #: includes/fields/class-location.php:113 224 #: includes/configs/settings.php:168 225 msgid "Use the legacy version of Places API" 226 msgstr "" 227 228 #: includes/fields/class-location.php:116 182 229 msgid "Locate Me" 183 230 msgstr "" -
hivepress-geolocation/trunk/readme.txt
r3279208 r3373940 5 5 Tested up to: 6.8 6 6 Requires PHP: 7.4 7 Stable tag: 1.3. 77 Stable tag: 1.3.8 8 8 License: GPLv3 9 9 License URI: https://www.gnu.org/licenses/gpl-3.0.html -
hivepress-geolocation/trunk/vendor/autoload.php
r3139907 r3373940 15 15 } 16 16 } 17 trigger_error( 18 $err, 19 E_USER_ERROR 20 ); 17 throw new RuntimeException($err); 21 18 } 22 19 -
hivepress-geolocation/trunk/vendor/composer/InstalledVersions.php
r3139907 r3373940 28 28 { 29 29 /** 30 * @var string|null if set (by reflection by Composer), this should be set to the path where this class is being copied to 31 * @internal 32 */ 33 private static $selfDir = null; 34 35 /** 30 36 * @var mixed[]|null 31 37 * @psalm-var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}|array{}|null 32 38 */ 33 39 private static $installed; 40 41 /** 42 * @var bool 43 */ 44 private static $installedIsLocalDir; 34 45 35 46 /** … … 310 321 self::$installed = $data; 311 322 self::$installedByVendor = array(); 323 324 // when using reload, we disable the duplicate protection to ensure that self::$installed data is 325 // always returned, but we cannot know whether it comes from the installed.php in __DIR__ or not, 326 // so we have to assume it does not, and that may result in duplicate data being returned when listing 327 // all installed packages for example 328 self::$installedIsLocalDir = false; 329 } 330 331 /** 332 * @return string 333 */ 334 private static function getSelfDir() 335 { 336 if (self::$selfDir === null) { 337 self::$selfDir = strtr(__DIR__, '\\', '/'); 338 } 339 340 return self::$selfDir; 312 341 } 313 342 … … 323 352 324 353 $installed = array(); 354 $copiedLocalDir = false; 325 355 326 356 if (self::$canGetVendors) { 357 $selfDir = self::getSelfDir(); 327 358 foreach (ClassLoader::getRegisteredLoaders() as $vendorDir => $loader) { 359 $vendorDir = strtr($vendorDir, '\\', '/'); 328 360 if (isset(self::$installedByVendor[$vendorDir])) { 329 361 $installed[] = self::$installedByVendor[$vendorDir]; … … 331 363 /** @var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>} $required */ 332 364 $required = require $vendorDir.'/composer/installed.php'; 333 $installed[] = self::$installedByVendor[$vendorDir] = $required; 334 if (null === self::$installed && strtr($vendorDir.'/composer', '\\', '/') === strtr(__DIR__, '\\', '/')) { 335 self::$installed = $installed[count($installed) - 1]; 365 self::$installedByVendor[$vendorDir] = $required; 366 $installed[] = $required; 367 if (self::$installed === null && $vendorDir.'/composer' === $selfDir) { 368 self::$installed = $required; 369 self::$installedIsLocalDir = true; 336 370 } 371 } 372 if (self::$installedIsLocalDir && $vendorDir.'/composer' === $selfDir) { 373 $copiedLocalDir = true; 337 374 } 338 375 } … … 351 388 } 352 389 353 if (self::$installed !== array() ) {390 if (self::$installed !== array() && !$copiedLocalDir) { 354 391 $installed[] = self::$installed; 355 392 } -
hivepress-geolocation/trunk/vendor/composer/installed.php
r3139907 r3373940 2 2 'root' => array( 3 3 'name' => '__root__', 4 'pretty_version' => '1.3. 7.4',5 'version' => '1.3. 7.4',6 'reference' => ' b88cc3882fd05c882ebc5c77f9b7943b5f1cbcfe',4 'pretty_version' => '1.3.8', 5 'version' => '1.3.8.0', 6 'reference' => 'cb1e33f70132325f74dc7bf1bbe4aeac9b10edd4', 7 7 'type' => 'library', 8 8 'install_path' => __DIR__ . '/../../', … … 12 12 'versions' => array( 13 13 '__root__' => array( 14 'pretty_version' => '1.3. 7.4',15 'version' => '1.3. 7.4',16 'reference' => ' b88cc3882fd05c882ebc5c77f9b7943b5f1cbcfe',14 'pretty_version' => '1.3.8', 15 'version' => '1.3.8.0', 16 'reference' => 'cb1e33f70132325f74dc7bf1bbe4aeac9b10edd4', 17 17 'type' => 'library', 18 18 'install_path' => __DIR__ . '/../../',
Note: See TracChangeset
for help on using the changeset viewer.