Plugin Directory

Changeset 3373940


Ignore:
Timestamp:
10/06/2025 07:43:55 PM (5 months ago)
Author:
hivepress
Message:

Release version 1.3.8

Location:
hivepress-geolocation
Files:
71 added
2 deleted
18 edited

Legend:

Unmodified
Added
Removed
  • hivepress-geolocation/trunk/assets/css/backend.less

    r2703918 r3373940  
    11.hp {
     2
    23    /*--------------------------------------------------------------
    34    Forms
     
    2829    }
    2930}
     31
    3032/*--------------------------------------------------------------
    3133Mapbox
     
    3436    &-ctrl-geocoder {
    3537        width: auto !important;
    36         max-width: none !important;
    37         box-shadow: none !important;
    38         min-width: auto !important;
    39         z-index: 2 !important;
    4038        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         }
    5739    }
    5840}
  • 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  
    11.hp {
     2
    23    /*--------------------------------------------------------------
    34    Forms
     
    2425        }
    2526    }
     27
    2628    /*--------------------------------------------------------------
    2729    Listings
     
    4648        }
    4749    }
     50
    4851    /*--------------------------------------------------------------
    4952    Vendors
     
    5659        }
    5760    }
     61
    5862    /*--------------------------------------------------------------
    5963    Maps
     
    6569    }
    6670}
     71
    6772/*--------------------------------------------------------------
    6873Mapbox
     
    7176    &-ctrl-geocoder {
    7277        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         }
    9378    }
    9479}
  • 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 ($) {
    22    'use strict';
    33
    4     hivepress.initGeolocation = function(container) {
     4    hivepress.initGeolocation = function (container) {
    55
    66        // Location
    7         container.find(hivepress.getSelector('location')).each(function() {
     7        container.find(hivepress.getSelector('location')).each(function () {
    88            var container = $(this),
    99                form = container.closest('form'),
     
    1212                longitudeField = form.find('input[data-coordinate=lng]'),
    1313                regionField = form.find('input[data-region]'),
     14                regionTypes = [],
    1415                button = container.find('a'),
    1516                settings = {};
     17
     18            if (field.data('region-types')) {
     19                regionTypes = field.data('region-types');
     20            }
    1621
    1722            if (typeof mapboxData !== 'undefined') {
     
    4348                field = mapboxContainer.find('input[type=text]');
    4449
    45                 $.each(fieldAttributes, function() {
     50                $.each(fieldAttributes, function () {
    4651                    field.attr(this.name, this.value);
    4752                });
     
    5055
    5156                // 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;
    5959
    6060                    // Set region
     
    7171                    latitudeField.val(result.result.geometry.coordinates[1]);
    7272                });
    73             } else {
     73            } else if ($.fn.geocomplete) {
    7474                settings = {
    7575                    details: form,
     
    9393
    9494                // Set location
    95                 field.bind('geocode:result', function(event, result) {
     95                field.bind('geocode:result', function (event, result) {
    9696                    var parts = [],
    97                         types = [
    98                             'locality',
    99                             'administrative_area_level_2',
    100                             'administrative_area_level_1',
    101                             'country',
    102                         ];
     97                        types = regionTypes;
    10398
    10499                    // Set region
     
    115110                        types.push('route');
    116111
    117                         $.each(result.address_components, function(index, component) {
     112                        $.each(result.address_components, function (index, component) {
    118113                            if (component.types.filter(value => types.includes(value)).length) {
    119114                                parts.push(component.long_name);
     
    124119                    }
    125120                });
     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                };
    126213            }
    127214
    128215            // Clear location
    129             field.on('input', function() {
    130                 if (!field.val()) {
     216            field.on('input', function () {
     217                if (field.val().length <= 1) {
    131218                    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('');
    132229                }
    133230            });
     
    135232            // Detect location
    136233            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) {
    139236                        if (typeof mapboxData !== 'undefined') {
    140237                            geocoder.options.reverseGeocode = true;
     
    145242                            geocoder.options.reverseGeocode = false;
    146243                            geocoder.options.limit = 5;
     244                        } else if ($.fn.geocomplete) {
     245                            field.geocomplete('find', position.coords.latitude + ' ' + position.coords.longitude);
    147246                        } 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                            });
    149252                        }
    150253                    });
     
    158261
    159262        // Map
    160         container.find(hivepress.getSelector('map')).each(function() {
     263        container.find(hivepress.getSelector('map')).each(function () {
    161264            var container = $(this),
    162265                height = container.width(),
     
    192295
    193296                // Add markers
    194                 $.each(container.data('markers'), function(index, data) {
     297                $.each(container.data('markers'), function (index, data) {
    195298                    bounds.extend([data.longitude, data.latitude]);
    196299
     
    208311                });
    209312
    210                 var observer = new ResizeObserver(function() {
     313                var observer = new ResizeObserver(function () {
    211314                    map.resize();
    212315
     
    254357
    255358                // Add markers
    256                 $.each(container.data('markers'), function(index, data) {
     359                $.each(container.data('markers'), function (index, data) {
    257360                    var nextWindow = new google.maps.InfoWindow({
    258                             content: data.content,
    259                         }),
     361                        content: data.content,
     362                    }),
    260363                        markerSettings = {
    261364                            title: data.title,
     
    279382                    var marker = new google.maps.Marker(markerSettings);
    280383
    281                     marker.addListener('spider_click', function() {
     384                    marker.addListener('spider_click', function () {
    282385                        if (prevWindow) {
    283386                            prevWindow.close();
     
    297400                map.fitBounds(bounds);
    298401
    299                 var observer = new ResizeObserver(function() {
     402                var observer = new ResizeObserver(function () {
    300403                    map.fitBounds(bounds);
    301404                }).observe(container.get(0));
     
    308411
    309412                if (container.data('scatter')) {
    310                     map.addListener('zoom_changed', function() {
     413                    map.addListener('zoom_changed', function () {
    311414                        iconSettings['scale'] = Math.pow(1.3125, map.getZoom());
    312415
    313                         $.each(markers, function(index, marker) {
     416                        $.each(markers, function (index, marker) {
    314417                            markers[index].setIcon(iconSettings);
    315418                        });
     
    320423    }
    321424
    322     $(document).on('hivepress:init', function(event, container) {
     425    $(document).on('hivepress:init', function (event, container) {
    323426        hivepress.initGeolocation(container);
    324427    });
  • 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  
    33 * Plugin Name: HivePress Geolocation
    44 * Description: Allow users to search listings by location.
    5  * Version: 1.3.7
     5 * Version: 1.3.8
    66 * Author: HivePress
    77 * Author URI: https://hivepress.io/
  • hivepress-geolocation/trunk/includes/blocks/class-listing-map.php

    r2737732 r3373940  
    115115        rewind_posts();
    116116
    117         while ( have_posts() ) {
    118             the_post();
     117        if ( 'vendor' === $this->model ) {
    119118
    120119            // Add marker.
    121120            $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();
    122130        }
    123 
    124         rewind_posts();
    125131
    126132        // Render markers.
  • hivepress-geolocation/trunk/includes/components/class-geolocation.php

    r3139907 r3373940  
    9191
    9292    /**
     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    /**
    93120     * Adds model attributes.
    94121     *
     
    97124     */
    98125    public function add_attributes( $attributes ) {
     126
     127        // Get model.
     128        $model = explode( '/', current_filter() )[3];
    99129
    100130        // Get countries.
     
    108138        }
    109139
    110         return array_merge(
     140        // Add attributes.
     141        $attributes = array_merge(
    111142            $attributes,
    112143            [
     
    137168                    'edit_field'   => [
    138169                        'label' => esc_html__( 'Latitude', 'hivepress-geolocation' ),
    139                         'type' => 'latitude',
     170                        'type'  => 'latitude',
    140171                    ],
    141172
     
    152183                    'edit_field'   => [
    153184                        'label' => esc_html__( 'Longitude', 'hivepress-geolocation' ),
    154                         'type' => 'longitude',
     185                        'type'  => 'longitude',
    155186                    ],
    156187
     
    163194            ]
    164195        );
     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;
    165219    }
    166220
     
    268322            $scripts['geolocation']['deps'] = array_merge(
    269323                $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            }
    272334        }
    273335
     
    318380            $request_url = 'https://api.mapbox.com/geocoding/v5/mapbox.places/' . rawurlencode( $longitude . ',' . $latitude ) . '.json?' . http_build_query(
    319381                [
    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' ),
    321383                    '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() ),
    332385                ]
    333386            );
     
    338391                    'key'         => get_option( 'hp_gmaps_secret_key' ) ? get_option( 'hp_gmaps_secret_key' ) : get_option( 'hp_gmaps_api_key' ),
    339392                    '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() ),
    350394                ]
    351395            );
     
    381425
    382426            // 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            );
    384444
    385445            if ( ! $region_args ) {
     
    421481        if ( hivepress()->get_version( 'requests' ) ) {
    422482            $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;
    423487        }
    424488
     
    591655            $radius = absint( hp\get_array_value( $_GET, '_radius' ) );
    592656
    593             if ( $radius >= 1 && $radius <= 100 ) {
     657            if ( $radius >= 1 && $radius <= get_option( 'hp_geolocation_max_radius', 100 ) ) {
    594658                $value = $radius;
    595659            }
     
    613677
    614678        if ( get_option( 'hp_geolocation_generate_regions' ) ) {
     679
     680            // Remove region field.
     681            unset( $form_args['fields']['region'] );
    615682
    616683            // Add region field.
     
    644711                'type'       => 'number',
    645712                'min_value'  => 1,
    646                 'max_value'  => 100,
     713                'max_value'  => get_option( 'hp_geolocation_max_radius', 100 ),
    647714                'default'    => get_option( 'hp_geolocation_radius' ),
    648715                '_order'     => 15,
     
    654721
    655722                'attributes' => [
    656                     'data-component' => 'radius-slider',
     723                    'data-mode' => 'range',
    657724                ],
    658725            ];
     
    697764        }
    698765
    699         return hp\merge_trees(
     766        return hivepress()->template->merge_blocks(
    700767            $template_args,
    701768            [
    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' ],
    709812                            ],
    710813                        ],
     
    713816            ]
    714817        );
    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.
    719838     *
    720839     * @param array  $template_args Template arguments.
     
    722841     * @return array
    723842     */
    724     public function alter_model_view_page( $template_args, $template ) {
     843    public function alter_models_view_page( $template_args, $template ) {
    725844
    726845        // Get model name.
     
    731850        }
    732851
    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(
    765853            $template_args,
    766854            [
    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                ],
    768869            ]
    769870        );
    770871    }
    771 
    772     /**
    773      * Alters models view page.
    774      *
    775      * @param array  $template_args Template arguments.
    776      * @param object $template Template object.
    777      * @return array
    778      */
    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     }
    810872}
  • hivepress-geolocation/trunk/includes/configs/scripts.php

    r2703788 r3373940  
    1212
    1313return [
    14     'geocomplete'          => [
     14    'geocomplete'         => [
    1515        'handle'  => 'geocomplete',
    1616        'src'     => hivepress()->get_url( 'geolocation' ) . '/assets/js/jquery.geocomplete.min.js',
     
    2020    ],
    2121
    22     'markerclustererplus'  => [
     22    'markerclustererplus' => [
    2323        'handle'  => 'markerclustererplus',
    2424        'src'     => hivepress()->get_url( 'geolocation' ) . '/assets/js/markerclustererplus.min.js',
     
    2828    ],
    2929
    30     'markerspiderfier'     => [
     30    'markerspiderfier'    => [
    3131        'handle'  => 'markerspiderfier',
    3232        'src'     => hivepress()->get_url( 'geolocation' ) . '/assets/js/oms.min.js',
     
    3636    ],
    3737
    38     'geolocation'          => [
     38    'geolocation'         => [
    3939        'handle'  => 'hivepress-geolocation',
    4040        'src'     => hivepress()->get_url( 'geolocation' ) . '/assets/js/common.min.js',
     
    4747        ],
    4848    ],
    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     ],
    5649];
  • hivepress-geolocation/trunk/includes/configs/settings.php

    r2737732 r3373940  
    7171                    'geolocation_radius'           => [
    7272                        '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' ),
    7474                        'type'        => 'number',
    7575                        'min_value'   => 1,
     
    7979                    ],
    8080
    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' ),
    8394                        'type'    => 'checkbox',
    8495                        '_order'  => 60,
    8596                    ],
    8697
    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' ),
    89100                        'type'    => 'checkbox',
    90101                        '_order'  => 70,
     
    93104                    'geolocation_generate_regions' => [
    94105                        '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' ),
    96107                        'caption'     => esc_html__( 'Generate regions from locations', 'hivepress-geolocation' ),
    97108                        'type'        => 'checkbox',
     
    99110                    ],
    100111
     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
    101132                    '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,
    106138                    ],
    107139                ],
     
    117149
    118150                'fields' => [
    119                     'gmaps_api_key'    => [
     151                    'gmaps_api_key'        => [
    120152                        'label'      => hivepress()->translator->get_string( 'api_key' ),
    121153                        'type'       => 'text',
     
    124156                    ],
    125157
    126                     'gmaps_secret_key' => [
     158                    'gmaps_secret_key'     => [
    127159                        'label'       => hivepress()->translator->get_string( 'secret_key' ),
    128160                        'description' => esc_html__( 'Set the API key without HTTP restrictions used for generating regions from locations.', 'hivepress-geolocation' ),
     
    130162                        'max_length'  => 256,
    131163                        '_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,
    132171                    ],
    133172                ],
     
    139178
    140179                'fields' => [
    141                     'mapbox_api_key' => [
     180                    'mapbox_api_key'    => [
    142181                        'label'      => hivepress()->translator->get_string( 'api_key' ),
    143182                        'type'       => 'text',
    144183                        'max_length' => 256,
    145184                        '_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,
    146193                    ],
    147194                ],
  • hivepress-geolocation/trunk/includes/configs/styles.php

    r2233321 r3373940  
    1212
    1313return [
     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
    1421    'geolocation_backend'  => [
    1522        'handle'  => 'hivepress-geolocation-backend',
  • hivepress-geolocation/trunk/includes/fields/class-location.php

    r2737732 r3373940  
    7979        $attributes['data-countries'] = wp_json_encode( $this->countries );
    8080
     81        // Set region types.
     82        $attributes['data-region-types'] = wp_json_encode( hivepress()->geolocation->get_region_types() );
     83
    8184        // Set component.
    8285        $attributes['data-component'] = 'location';
  • hivepress-geolocation/trunk/languages/hivepress-geolocation.pot

    r3139907 r3373940  
    1 # Copyright (C) 2024 HivePress
     1# Copyright (C) 2025 HivePress
    22# This file is distributed under the same license as the HivePress Geolocation plugin.
    33msgid ""
    44msgstr ""
    5 "Project-Id-Version: HivePress Geolocation 1.3.7\n"
     5"Project-Id-Version: HivePress Geolocation 1.3.8\n"
    66"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/hivepress-geolocation\n"
    77"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
     
    1010"Content-Type: text/plain; charset=UTF-8\n"
    1111"Content-Transfer-Encoding: 8bit\n"
    12 "POT-Creation-Date: 2024-08-22T17:26:10+00:00\n"
     12"POT-Creation-Date: 2025-10-06T19:21:35+00:00\n"
    1313"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
    14 "X-Generator: WP-CLI 2.11.0\n"
     14"X-Generator: WP-CLI 2.12.0\n"
    1515"X-Domain: hivepress-geolocation\n"
    1616
     
    3535msgstr ""
    3636
    37 #: includes/components/class-geolocation.php:118
    38 #: includes/components/class-geolocation.php:126
    39 #: includes/components/class-geolocation.php:740
     37#: includes/components/class-geolocation.php:149
     38#: includes/components/class-geolocation.php:157
     39#: includes/components/class-geolocation.php:827
    4040msgid "Location"
    4141msgstr ""
    4242
    43 #: includes/components/class-geolocation.php:138
     43#: includes/components/class-geolocation.php:169
    4444msgid "Latitude"
    4545msgstr ""
    4646
    47 #: includes/components/class-geolocation.php:153
     47#: includes/components/class-geolocation.php:184
    4848msgid "Longitude"
    4949msgstr ""
    5050
    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
     54msgid "Region"
     55msgstr ""
     56
     57#: includes/components/class-geolocation.php:238
     58#: includes/configs/settings.php:105
    5359msgid "Regions"
    5460msgstr ""
    5561
    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
    6163msgid "Add Region"
    6264msgstr ""
    6365
    64 #: includes/components/class-geolocation.php:187
     66#: includes/components/class-geolocation.php:241
    6567msgid "Edit Region"
    6668msgstr ""
    6769
    68 #: includes/components/class-geolocation.php:188
     70#: includes/components/class-geolocation.php:242
    6971msgid "Update Region"
    7072msgstr ""
    7173
    72 #: includes/components/class-geolocation.php:189
     74#: includes/components/class-geolocation.php:243
    7375msgid "View Region"
    7476msgstr ""
    7577
    76 #: includes/components/class-geolocation.php:190
     78#: includes/components/class-geolocation.php:244
    7779msgid "Parent Region"
    7880msgstr ""
    7981
    80 #: includes/components/class-geolocation.php:191
     82#: includes/components/class-geolocation.php:245
    8183msgid "Search Regions"
    8284msgstr ""
    8385
    84 #: includes/components/class-geolocation.php:192
     86#: includes/components/class-geolocation.php:246
    8587msgid "No regions found"
    8688msgstr ""
    8789
    88 #: includes/components/class-geolocation.php:643
     90#: includes/components/class-geolocation.php:710
    8991#: includes/configs/settings.php:72
    9092msgid "Radius"
    9193msgstr ""
    9294
    93 #: includes/components/class-geolocation.php:652
     95#: includes/components/class-geolocation.php:719
    9496msgctxt "miles"
    9597msgid "mi"
    9698msgstr ""
    9799
    98 #: includes/components/class-geolocation.php:652
     100#: includes/components/class-geolocation.php:719
    99101msgctxt "kilometers"
    100102msgid "km"
    101103msgstr ""
    102104
    103 #: includes/components/class-geolocation.php:676
     105#: includes/components/class-geolocation.php:743
    104106msgctxt "sort order"
    105107msgid "Distance"
    106108msgstr ""
    107109
    108 #: includes/components/class-geolocation.php:753
    109 #: includes/components/class-geolocation.php:797
     110#: includes/components/class-geolocation.php:807
     111#: includes/components/class-geolocation.php:860
    110112msgid "Map"
    111113msgstr ""
     
    148150
    149151#: includes/configs/settings.php:73
    150 msgid "Set the radius that defines the location search area."
     152msgid "Set the default radius used for the location search."
    151153msgstr ""
    152154
    153155#: includes/configs/settings.php:82
     156msgid "Maximum Radius"
     157msgstr ""
     158
     159#: includes/configs/settings.php:83
     160msgid "Set the maximum radius allowed for the location search."
     161msgstr ""
     162
     163#: includes/configs/settings.php:93
     164msgid "Allow users to adjust the radius"
     165msgstr ""
     166
     167#: includes/configs/settings.php:99
    154168msgid "Use miles instead of kilometers"
    155169msgstr ""
    156170
    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
     172msgid "Check this option to create pages for regions and enable region-specific search."
     173msgstr ""
     174
     175#: includes/configs/settings.php:107
    166176msgid "Generate regions from locations"
    167177msgstr ""
    168178
    169 #: includes/configs/settings.php:102
     179#: includes/configs/settings.php:113
     180msgid "Region Types"
     181msgstr ""
     182
     183#: includes/configs/settings.php:114
     184msgid "Select which region types should have page creation and location search enabled."
     185msgstr ""
     186
     187#: includes/configs/settings.php:123
     188msgid "Country"
     189msgstr ""
     190
     191#: includes/configs/settings.php:125
     192msgid "Subregion"
     193msgstr ""
     194
     195#: includes/configs/settings.php:126
     196msgid "City"
     197msgstr ""
     198
     199#: includes/configs/settings.php:127
     200msgid "District"
     201msgstr ""
     202
     203#: includes/configs/settings.php:128
     204msgid "Postcode"
     205msgstr ""
     206
     207#: includes/configs/settings.php:133
    170208msgid "Address"
    171209msgstr ""
    172210
    173 #: includes/configs/settings.php:103
     211#: includes/configs/settings.php:134
     212msgid "Check this option to prevent displaying exact locations."
     213msgstr ""
     214
     215#: includes/configs/settings.php:135
    174216msgid "Hide the exact address"
    175217msgstr ""
    176218
    177 #: includes/configs/settings.php:128
     219#: includes/configs/settings.php:160
     220#: includes/configs/settings.php:189
    178221msgid "Set the API key without HTTP restrictions used for generating regions from locations."
    179222msgstr ""
    180223
    181 #: includes/fields/class-location.php:113
     224#: includes/configs/settings.php:168
     225msgid "Use the legacy version of Places API"
     226msgstr ""
     227
     228#: includes/fields/class-location.php:116
    182229msgid "Locate Me"
    183230msgstr ""
  • hivepress-geolocation/trunk/readme.txt

    r3279208 r3373940  
    55Tested up to: 6.8
    66Requires PHP: 7.4
    7 Stable tag: 1.3.7
     7Stable tag: 1.3.8
    88License: GPLv3
    99License URI: https://www.gnu.org/licenses/gpl-3.0.html
  • hivepress-geolocation/trunk/vendor/autoload.php

    r3139907 r3373940  
    1515        }
    1616    }
    17     trigger_error(
    18         $err,
    19         E_USER_ERROR
    20     );
     17    throw new RuntimeException($err);
    2118}
    2219
  • hivepress-geolocation/trunk/vendor/composer/InstalledVersions.php

    r3139907 r3373940  
    2828{
    2929    /**
     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    /**
    3036     * @var mixed[]|null
    3137     * @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
    3238     */
    3339    private static $installed;
     40
     41    /**
     42     * @var bool
     43     */
     44    private static $installedIsLocalDir;
    3445
    3546    /**
     
    310321        self::$installed = $data;
    311322        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;
    312341    }
    313342
     
    323352
    324353        $installed = array();
     354        $copiedLocalDir = false;
    325355
    326356        if (self::$canGetVendors) {
     357            $selfDir = self::getSelfDir();
    327358            foreach (ClassLoader::getRegisteredLoaders() as $vendorDir => $loader) {
     359                $vendorDir = strtr($vendorDir, '\\', '/');
    328360                if (isset(self::$installedByVendor[$vendorDir])) {
    329361                    $installed[] = self::$installedByVendor[$vendorDir];
     
    331363                    /** @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 */
    332364                    $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;
    336370                    }
     371                }
     372                if (self::$installedIsLocalDir && $vendorDir.'/composer' === $selfDir) {
     373                    $copiedLocalDir = true;
    337374                }
    338375            }
     
    351388        }
    352389
    353         if (self::$installed !== array()) {
     390        if (self::$installed !== array() && !$copiedLocalDir) {
    354391            $installed[] = self::$installed;
    355392        }
  • hivepress-geolocation/trunk/vendor/composer/installed.php

    r3139907 r3373940  
    22    'root' => array(
    33        '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',
    77        'type' => 'library',
    88        'install_path' => __DIR__ . '/../../',
     
    1212    'versions' => array(
    1313        '__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',
    1717            'type' => 'library',
    1818            'install_path' => __DIR__ . '/../../',
Note: See TracChangeset for help on using the changeset viewer.