Version Description
- Fixed the distance format always using km when you clicked the 'directions' text in the marker
- Fixed an issue where a CSS rule in some themes would place a background image on the active item in the dropdown list
- Added an option to disable the mouse cursor on pageload focusing on the location input field
- Added an option to add a 'More info' link to the store listings, which when clicked will open the infowindow in the marker on the map
Download this release
Release Info
Developer | tijmensmit |
Plugin | WP Store Locator |
Version | 1.2.11 |
Comparing to | |
See all releases |
Code changes from version 1.2.1 to 1.2.11
- admin/class-admin.php +28 -3
- admin/js/wpsl-admin.js +1 -1
- admin/templates/map-settings.php +13 -0
- css/styles.css +7 -2
- frontend/class-frontend.php +4 -0
- js/wpsl-gmap.js +63 -15
- readme.txt +7 -1
- wp-store-locator.php +6 -3
admin/class-admin.php
CHANGED
@@ -117,6 +117,28 @@ if ( !class_exists( 'WPSL_Admin' ) ) {
|
|
117 |
}
|
118 |
}
|
119 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
120 |
update_option( 'wpsl_version', WPSL_VERSION_NUM );
|
121 |
}
|
122 |
|
@@ -594,6 +616,8 @@ if ( !class_exists( 'WPSL_Admin' ) ) {
|
|
594 |
$output['reset_map'] = isset( $_POST['wpsl_design']['reset_map'] ) ? 1 : 0;
|
595 |
$output['store_below'] = isset( $_POST['wpsl_design']['store_below'] ) ? 1 : 0;
|
596 |
$output['direction_redirect'] = isset( $_POST['wpsl_design']['direction_redirect'] ) ? 1 : 0;
|
|
|
|
|
597 |
$output['start_marker'] = wp_filter_nohtml_kses( $_POST['wpsl_map']['start_marker'] );
|
598 |
$output['store_marker'] = wp_filter_nohtml_kses( $_POST['wpsl_map']['store_marker'] );
|
599 |
|
@@ -605,6 +629,7 @@ if ( !class_exists( 'WPSL_Admin' ) ) {
|
|
605 |
'radius',
|
606 |
'no_results',
|
607 |
'results',
|
|
|
608 |
'directions',
|
609 |
'error',
|
610 |
'phone',
|
@@ -616,7 +641,7 @@ if ( !class_exists( 'WPSL_Admin' ) ) {
|
|
616 |
|
617 |
/**
|
618 |
* Labels can never be empty, so we make sure they always contain data.
|
619 |
-
* If they are empty, we use the default value
|
620 |
*/
|
621 |
foreach ( $required_labels as $k => $label ) {
|
622 |
if ( !empty( $_POST['wpsl_label'][$label] ) ) {
|
@@ -1229,7 +1254,7 @@ if ( !class_exists( 'WPSL_Admin' ) ) {
|
|
1229 |
* @param $location The location
|
1230 |
* @return void
|
1231 |
*/
|
1232 |
-
private function check_icon_font_usage(
|
1233 |
|
1234 |
global $wp_version;
|
1235 |
|
@@ -1249,7 +1274,7 @@ if ( !class_exists( 'WPSL_Admin' ) ) {
|
|
1249 |
wp_enqueue_script( 'jquery-ui-dialog' );
|
1250 |
wp_enqueue_style( 'jquery-style', '//ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/themes/smoothness/jquery-ui.css' );
|
1251 |
wp_enqueue_style( 'wpsl-admin-css', plugins_url( '/css/style.css', __FILE__ ), false );
|
1252 |
-
$this->check_icon_font_usage(
|
1253 |
wp_enqueue_script( 'wpsl-gmap', ( "//maps.google.com/maps/api/js?sensor=false&libraries=places&language=" . $this->settings['api_language'] ), false ); // we set the language here to make sure the geocode response returns the country name in the correct language
|
1254 |
wp_enqueue_script( 'wpsl-admin-js', plugins_url( '/js/wpsl-admin.js', __FILE__ ), array( 'jquery' ), false );
|
1255 |
wp_enqueue_script( 'wpsl-queue', plugins_url( '/js/ajax-queue.js', __FILE__ ), array( 'jquery' ), false );
|
117 |
}
|
118 |
}
|
119 |
|
120 |
+
if ( version_compare( $current_version, '1.2.11', '<' ) ) {
|
121 |
+
if ( is_array( $this->settings ) ) {
|
122 |
+
/* Add the default value for the 'more info' link option */
|
123 |
+
if ( empty( $this->settings['more_info'] ) ) {
|
124 |
+
$this->settings['more_info'] = 0;
|
125 |
+
update_option( 'wpsl_settings', $this->settings );
|
126 |
+
}
|
127 |
+
|
128 |
+
/* Add the default value for the 'more info' label */
|
129 |
+
if ( empty( $this->settings['more_label'] ) ) {
|
130 |
+
$this->settings['more_label'] = 'More info';
|
131 |
+
update_option( 'wpsl_settings', $this->settings );
|
132 |
+
}
|
133 |
+
|
134 |
+
/* Add the default value mouse focus option */
|
135 |
+
if ( empty( $this->settings['mouse_focus'] ) ) {
|
136 |
+
$this->settings['mouse_focus'] = 1;
|
137 |
+
update_option( 'wpsl_settings', $this->settings );
|
138 |
+
}
|
139 |
+
}
|
140 |
+
}
|
141 |
+
|
142 |
update_option( 'wpsl_version', WPSL_VERSION_NUM );
|
143 |
}
|
144 |
|
616 |
$output['reset_map'] = isset( $_POST['wpsl_design']['reset_map'] ) ? 1 : 0;
|
617 |
$output['store_below'] = isset( $_POST['wpsl_design']['store_below'] ) ? 1 : 0;
|
618 |
$output['direction_redirect'] = isset( $_POST['wpsl_design']['direction_redirect'] ) ? 1 : 0;
|
619 |
+
$output['more_info'] = isset( $_POST['wpsl_design']['more_info'] ) ? 1 : 0;
|
620 |
+
$output['mouse_focus'] = isset( $_POST['wpsl_design']['mouse_focus'] ) ? 1 : 0;
|
621 |
$output['start_marker'] = wp_filter_nohtml_kses( $_POST['wpsl_map']['start_marker'] );
|
622 |
$output['store_marker'] = wp_filter_nohtml_kses( $_POST['wpsl_map']['store_marker'] );
|
623 |
|
629 |
'radius',
|
630 |
'no_results',
|
631 |
'results',
|
632 |
+
'more',
|
633 |
'directions',
|
634 |
'error',
|
635 |
'phone',
|
641 |
|
642 |
/**
|
643 |
* Labels can never be empty, so we make sure they always contain data.
|
644 |
+
* If they are empty, we use the default value. Otherwise we sanitize the text field
|
645 |
*/
|
646 |
foreach ( $required_labels as $k => $label ) {
|
647 |
if ( !empty( $_POST['wpsl_label'][$label] ) ) {
|
1254 |
* @param $location The location
|
1255 |
* @return void
|
1256 |
*/
|
1257 |
+
private function check_icon_font_usage() {
|
1258 |
|
1259 |
global $wp_version;
|
1260 |
|
1274 |
wp_enqueue_script( 'jquery-ui-dialog' );
|
1275 |
wp_enqueue_style( 'jquery-style', '//ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/themes/smoothness/jquery-ui.css' );
|
1276 |
wp_enqueue_style( 'wpsl-admin-css', plugins_url( '/css/style.css', __FILE__ ), false );
|
1277 |
+
$this->check_icon_font_usage();
|
1278 |
wp_enqueue_script( 'wpsl-gmap', ( "//maps.google.com/maps/api/js?sensor=false&libraries=places&language=" . $this->settings['api_language'] ), false ); // we set the language here to make sure the geocode response returns the country name in the correct language
|
1279 |
wp_enqueue_script( 'wpsl-admin-js', plugins_url( '/js/wpsl-admin.js', __FILE__ ), array( 'jquery' ), false );
|
1280 |
wp_enqueue_script( 'wpsl-queue', plugins_url( '/js/ajax-queue.js', __FILE__ ), array( 'jquery' ), false );
|
admin/js/wpsl-admin.js
CHANGED
@@ -378,7 +378,7 @@ $( ".wpsl-dismiss" ).click( function() {
|
|
378 |
|
379 |
$.post( ajaxurl, data );
|
380 |
|
381 |
-
$( "#message" ).remove();
|
382 |
|
383 |
return false;
|
384 |
});
|
378 |
|
379 |
$.post( ajaxurl, data );
|
380 |
|
381 |
+
$( "#wpbody-content #message.error" ).remove();
|
382 |
|
383 |
return false;
|
384 |
});
|
admin/templates/map-settings.php
CHANGED
@@ -167,8 +167,17 @@
|
|
167 |
<p>
|
168 |
<label for="wpsl-direction-redirect"><?php _e( 'When a user clicks on "Directions", open a new window and show the route on maps.google.com', 'wpsl' ); ?></label>
|
169 |
<input type="checkbox" value="" <?php checked( $this->settings['direction_redirect'] == '1', true ); ?> name="wpsl_design[direction_redirect]" id="wpsl-direction-redirect">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
170 |
</p>
|
171 |
<em><?php _e( '* This is the text that is placed before the search input and radius dropdown', 'wpsl' ); ?></em>
|
|
|
172 |
</div>
|
173 |
</div>
|
174 |
</div>
|
@@ -214,6 +223,10 @@
|
|
214 |
<label for="wpsl-results"><?php _e( 'Results:', 'wpsl' ); ?></label>
|
215 |
<input type="text" value="<?php echo esc_attr( stripslashes( $this->settings['results_label'] ) ); ?>" name="wpsl_label[results]" class="textinput" id="wpsl-results">
|
216 |
</p>
|
|
|
|
|
|
|
|
|
217 |
<p>
|
218 |
<label for="wpsl-phone"><?php _e( 'Phone:', 'wpsl' ); ?></label>
|
219 |
<input type="text" value="<?php echo esc_attr( stripslashes( $this->settings['phone_label'] ) ); ?>" name="wpsl_label[phone]" class="textinput" id="wpsl-phone">
|
167 |
<p>
|
168 |
<label for="wpsl-direction-redirect"><?php _e( 'When a user clicks on "Directions", open a new window and show the route on maps.google.com', 'wpsl' ); ?></label>
|
169 |
<input type="checkbox" value="" <?php checked( $this->settings['direction_redirect'] == '1', true ); ?> name="wpsl_design[direction_redirect]" id="wpsl-direction-redirect">
|
170 |
+
</p>
|
171 |
+
<p>
|
172 |
+
<label for="wpsl-more-info"><?php _e( 'Show a "More info" link in the store listings? If a user clicks the link the infowindow in the marker will open.', 'wpsl' ); ?></label>
|
173 |
+
<input type="checkbox" value="" <?php checked( $this->settings['more_info'] == '1', true ); ?> name="wpsl_design[more_info]" id="wpsl-more-info">
|
174 |
+
</p>
|
175 |
+
<p>
|
176 |
+
<label for="wpsl-mouse-focus"><?php _e( 'On pageload move the mousecursor to the input field. **', 'wpsl' ); ?></label>
|
177 |
+
<input type="checkbox" value="" <?php checked( $this->settings['mouse_focus'] == '1', true ); ?> name="wpsl_design[mouse_focus]" id="wpsl-mouse-focus">
|
178 |
</p>
|
179 |
<em><?php _e( '* This is the text that is placed before the search input and radius dropdown', 'wpsl' ); ?></em>
|
180 |
+
<em><?php _e( '** If the store locator is not placed at the top of the page, enabling this feature can result in the page sliding down.', 'wpsl' ); ?></em>
|
181 |
</div>
|
182 |
</div>
|
183 |
</div>
|
223 |
<label for="wpsl-results"><?php _e( 'Results:', 'wpsl' ); ?></label>
|
224 |
<input type="text" value="<?php echo esc_attr( stripslashes( $this->settings['results_label'] ) ); ?>" name="wpsl_label[results]" class="textinput" id="wpsl-results">
|
225 |
</p>
|
226 |
+
<p>
|
227 |
+
<label for="wpsl-more-info"><?php _e( 'More info:', 'wpsl' ); ?></label>
|
228 |
+
<input type="text" value="<?php echo esc_attr( stripslashes( $this->settings['more_label'] ) ); ?>" name="wpsl_label[more]" class="textinput" id="wpsl-more-info">
|
229 |
+
</p>
|
230 |
<p>
|
231 |
<label for="wpsl-phone"><?php _e( 'Phone:', 'wpsl' ); ?></label>
|
232 |
<input type="text" value="<?php echo esc_attr( stripslashes( $this->settings['phone_label'] ) ); ?>" name="wpsl_label[phone]" class="textinput" id="wpsl-phone">
|
css/styles.css
CHANGED
@@ -140,6 +140,10 @@ div elements, we disable it to prevent it from messing up the map
|
|
140 |
margin-bottom:10px;
|
141 |
}
|
142 |
|
|
|
|
|
|
|
|
|
143 |
#wpsl-result-list li {
|
144 |
padding: 10px;
|
145 |
border-bottom: 1px dotted #ccc;
|
@@ -453,7 +457,7 @@ wpsl-search-input.focus,
|
|
453 |
}
|
454 |
|
455 |
/* DROP DOWN LIST ITEMS */
|
456 |
-
.wpsl-dropdown li{
|
457 |
list-style: none;
|
458 |
padding: 8px 12px !important;
|
459 |
margin:0 !important;
|
@@ -468,8 +472,9 @@ wpsl-search-input.focus,
|
|
468 |
color: #000;
|
469 |
}
|
470 |
|
471 |
-
.wpsl-dropdown li.active{
|
472 |
font-weight: 700;
|
|
|
473 |
}
|
474 |
|
475 |
.clearfix:before,
|
140 |
margin-bottom:10px;
|
141 |
}
|
142 |
|
143 |
+
#wpsl-result-list a {
|
144 |
+
outline:none;
|
145 |
+
}
|
146 |
+
|
147 |
#wpsl-result-list li {
|
148 |
padding: 10px;
|
149 |
border-bottom: 1px dotted #ccc;
|
457 |
}
|
458 |
|
459 |
/* DROP DOWN LIST ITEMS */
|
460 |
+
#wpsl-wrap .wpsl-dropdown li{
|
461 |
list-style: none;
|
462 |
padding: 8px 12px !important;
|
463 |
margin:0 !important;
|
472 |
color: #000;
|
473 |
}
|
474 |
|
475 |
+
#wpsl-wrap .wpsl-dropdown li.active{
|
476 |
font-weight: 700;
|
477 |
+
background:none !important;
|
478 |
}
|
479 |
|
480 |
.clearfix:before,
|
frontend/class-frontend.php
CHANGED
@@ -189,6 +189,9 @@ if ( !class_exists( 'WPSL_Frontend' ) ) {
|
|
189 |
'newWindow' => $this->settings['new_window'],
|
190 |
'resetMap' => $this->settings['reset_map'],
|
191 |
'directionRedirect' => $this->settings['direction_redirect'],
|
|
|
|
|
|
|
192 |
'maxResults' => $dropdown_defaults['max_results'],
|
193 |
'searchRadius' => $dropdown_defaults['search_radius'],
|
194 |
'distanceUnit' => $this->settings['distance_unit'],
|
@@ -199,6 +202,7 @@ if ( !class_exists( 'WPSL_Frontend' ) ) {
|
|
199 |
$labels = array(
|
200 |
'preloader' => stripslashes( $this->settings['preloader_label'] ),
|
201 |
'noResults' => stripslashes( $this->settings['no_results_label'] ),
|
|
|
202 |
'generalError' => stripslashes( $this->settings['error_label'] ),
|
203 |
'queryLimit' => stripslashes( $this->settings['limit_label'] ),
|
204 |
'directions' => stripslashes( $this->settings['directions_label'] ),
|
189 |
'newWindow' => $this->settings['new_window'],
|
190 |
'resetMap' => $this->settings['reset_map'],
|
191 |
'directionRedirect' => $this->settings['direction_redirect'],
|
192 |
+
'moreInfo' => $this->settings['more_info'],
|
193 |
+
'mouseFocus' => $this->settings['mouse_focus'],
|
194 |
+
'storeBelow' => $this->settings['store_below'],
|
195 |
'maxResults' => $dropdown_defaults['max_results'],
|
196 |
'searchRadius' => $dropdown_defaults['search_radius'],
|
197 |
'distanceUnit' => $this->settings['distance_unit'],
|
202 |
$labels = array(
|
203 |
'preloader' => stripslashes( $this->settings['preloader_label'] ),
|
204 |
'noResults' => stripslashes( $this->settings['no_results_label'] ),
|
205 |
+
'moreInfo' => stripslashes( $this->settings['more_label'] ),
|
206 |
'generalError' => stripslashes( $this->settings['error_label'] ),
|
207 |
'queryLimit' => stripslashes( $this->settings['limit_label'] ),
|
208 |
'directions' => stripslashes( $this->settings['directions_label'] ),
|
js/wpsl-gmap.js
CHANGED
@@ -83,11 +83,13 @@ function initializeGmap() {
|
|
83 |
checkGeolocation();
|
84 |
} else {
|
85 |
showStores();
|
86 |
-
|
87 |
-
|
|
|
|
|
88 |
$("#wpsl-search-input").focus();
|
89 |
}
|
90 |
-
|
91 |
/* Style the dropdown menu */
|
92 |
$selects.easyDropDown({
|
93 |
cutOff: 10,
|
@@ -188,7 +190,6 @@ $( "#wpsl-reset-map" ).on( "click", function() {
|
|
188 |
handleGeolocationQuery( geolocationLatlng, resetMap );
|
189 |
} else {
|
190 |
showStores();
|
191 |
-
$("#wpsl-search-input").focus();
|
192 |
}
|
193 |
}
|
194 |
|
@@ -299,13 +300,22 @@ function letsBounce( storeId, status ) {
|
|
299 |
|
300 |
/* Show the directions on the map */
|
301 |
function calcRoute( start, end ) {
|
302 |
-
var legs, len, step, index, direction, i, j,
|
303 |
directionStops = "",
|
304 |
-
request = {
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
309 |
|
310 |
directionsService.route( request, function( response, status ) {
|
311 |
if ( status == google.maps.DirectionsStatus.OK ) {
|
@@ -420,6 +430,7 @@ function findFormattedAddress( latLng, callback ) {
|
|
420 |
}
|
421 |
});
|
422 |
}
|
|
|
423 |
function makeAjaxRequest( startLatLng, resetMap, autoLoad ) {
|
424 |
var location,
|
425 |
infoWindowData = {},
|
@@ -522,7 +533,11 @@ function makeAjaxRequest( startLatLng, resetMap, autoLoad ) {
|
|
522 |
}
|
523 |
}
|
524 |
});
|
525 |
-
|
|
|
|
|
|
|
|
|
526 |
}
|
527 |
|
528 |
/* Add a new marker to the map based on the provided location (latlng) */
|
@@ -571,7 +586,6 @@ function addMarker( location, storeId, infoWindowData, draggable ) {
|
|
571 |
|
572 |
if ( draggable ) {
|
573 |
google.maps.event.addListener( marker, "dragend", function( event ) {
|
574 |
-
//deleteOverlays();
|
575 |
map.setCenter( event.latLng );
|
576 |
reverseGeocode( event.latLng );
|
577 |
findStoreLocations( event.latLng, resetMap, autoLoad = false );
|
@@ -667,6 +681,8 @@ function createDirectionUrl( street, city, zip, country ) {
|
|
667 |
function storeHtml( response, url ) {
|
668 |
var html = "",
|
669 |
storeImg = "",
|
|
|
|
|
670 |
id = response.id,
|
671 |
store = response.store,
|
672 |
street = response.street,
|
@@ -676,16 +692,30 @@ function storeHtml( response, url ) {
|
|
676 |
thumb = response.thumb,
|
677 |
country = response.country,
|
678 |
distance = parseFloat( response.distance ).toFixed(1) + " " + wpslSettings.distanceUnit;
|
679 |
-
|
680 |
if ( ( typeof( thumb ) !== "undefined" ) && ( thumb !== "" ) ) {
|
681 |
storeImg = "<img class='wpsl-store-thumb' src='" + thumb + "' width='48' height='48' alt='" + store + "' />";
|
682 |
}
|
683 |
|
|
|
684 |
if ( wpslSettings.directionRedirect == 1 ) {
|
685 |
url = createDirectionUrl( street, city, zip, country );
|
686 |
}
|
687 |
|
688 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
689 |
|
690 |
return html;
|
691 |
}
|
@@ -747,12 +777,30 @@ function geocodeNotification( status ) {
|
|
747 |
/* Trigger the search when the user presses "enter" on the keyboard */
|
748 |
$( "#wpsl-search-input" ).keydown( function ( event ) {
|
749 |
var keypressed = event.keyCode || event.which;
|
|
|
750 |
if ( keypressed == 13 ) {
|
751 |
$( "#wpsl-search-btn" ).trigger( "click" );
|
752 |
}
|
753 |
});
|
754 |
|
755 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
756 |
google.maps.event.addDomListener( window, "load", initializeGmap );
|
757 |
}
|
758 |
|
83 |
checkGeolocation();
|
84 |
} else {
|
85 |
showStores();
|
86 |
+
}
|
87 |
+
|
88 |
+
/* Move the mousecursor to the store search field if the focus option is enabled */
|
89 |
+
if ( wpslSettings.mouseFocus == 1 ) {
|
90 |
$("#wpsl-search-input").focus();
|
91 |
}
|
92 |
+
|
93 |
/* Style the dropdown menu */
|
94 |
$selects.easyDropDown({
|
95 |
cutOff: 10,
|
190 |
handleGeolocationQuery( geolocationLatlng, resetMap );
|
191 |
} else {
|
192 |
showStores();
|
|
|
193 |
}
|
194 |
}
|
195 |
|
300 |
|
301 |
/* Show the directions on the map */
|
302 |
function calcRoute( start, end ) {
|
303 |
+
var legs, len, step, index, direction, i, j, distanceUnit,
|
304 |
directionStops = "",
|
305 |
+
request = {};
|
306 |
+
|
307 |
+
if ( wpslSettings.distanceUnit == 'km' ) {
|
308 |
+
distanceUnit = google.maps.UnitSystem.METRIC
|
309 |
+
} else {
|
310 |
+
distanceUnit = google.maps.UnitSystem.IMPERIAL
|
311 |
+
}
|
312 |
+
|
313 |
+
request = {
|
314 |
+
origin: start,
|
315 |
+
destination: end,
|
316 |
+
travelMode: google.maps.DirectionsTravelMode.DRIVING,
|
317 |
+
unitSystem: distanceUnit
|
318 |
+
};
|
319 |
|
320 |
directionsService.route( request, function( response, status ) {
|
321 |
if ( status == google.maps.DirectionsStatus.OK ) {
|
430 |
}
|
431 |
});
|
432 |
}
|
433 |
+
|
434 |
function makeAjaxRequest( startLatLng, resetMap, autoLoad ) {
|
435 |
var location,
|
436 |
infoWindowData = {},
|
533 |
}
|
534 |
}
|
535 |
});
|
536 |
+
|
537 |
+
/* Move the mousecursor to the store search field if the focus option is enabled */
|
538 |
+
if ( wpslSettings.mouseFocus == 1 ) {
|
539 |
+
$("#wpsl-search-input").focus();
|
540 |
+
}
|
541 |
}
|
542 |
|
543 |
/* Add a new marker to the map based on the provided location (latlng) */
|
586 |
|
587 |
if ( draggable ) {
|
588 |
google.maps.event.addListener( marker, "dragend", function( event ) {
|
|
|
589 |
map.setCenter( event.latLng );
|
590 |
reverseGeocode( event.latLng );
|
591 |
findStoreLocations( event.latLng, resetMap, autoLoad = false );
|
681 |
function storeHtml( response, url ) {
|
682 |
var html = "",
|
683 |
storeImg = "",
|
684 |
+
moreInfo = "",
|
685 |
+
moreInfoUrl = "#",
|
686 |
id = response.id,
|
687 |
store = response.store,
|
688 |
street = response.street,
|
692 |
thumb = response.thumb,
|
693 |
country = response.country,
|
694 |
distance = parseFloat( response.distance ).toFixed(1) + " " + wpslSettings.distanceUnit;
|
695 |
+
|
696 |
if ( ( typeof( thumb ) !== "undefined" ) && ( thumb !== "" ) ) {
|
697 |
storeImg = "<img class='wpsl-store-thumb' src='" + thumb + "' width='48' height='48' alt='" + store + "' />";
|
698 |
}
|
699 |
|
700 |
+
/* Check if we need to create an url that sends the user to maps.google.com for driving directions */
|
701 |
if ( wpslSettings.directionRedirect == 1 ) {
|
702 |
url = createDirectionUrl( street, city, zip, country );
|
703 |
}
|
704 |
|
705 |
+
/* Check if we need to show the 'more info' link in the store listings */
|
706 |
+
if ( wpslSettings.moreInfo == 1 ) {
|
707 |
+
|
708 |
+
/* If we show the store listings under the map, we do want to jump to the
|
709 |
+
* top of the map to focus on the opened infowindow
|
710 |
+
*/
|
711 |
+
if ( wpslSettings.storeBelow == 1 ) {
|
712 |
+
moreInfoUrl = '#wpsl-search-wrap';
|
713 |
+
}
|
714 |
+
|
715 |
+
moreInfo = "<p><a class='wpsl-store-details' data-store-id='" + id + "' href=" + moreInfoUrl + ">More info</a></p>";
|
716 |
+
}
|
717 |
+
|
718 |
+
html = "<li data-store-id='" + id + "'><div><p>" + storeImg + "<strong>" + store + "</strong><span class='wpsl-street'>" + street + "</span>" + city + " " + state + " " + zip + "<span class='wpsl-country'>" + country + "</p>" + moreInfo + "</div>" + distance + "<a class='wpsl-directions' " + url.target + " href='" + url.src + "'>" + wpslLabels.directions + "</a></li>";
|
719 |
|
720 |
return html;
|
721 |
}
|
777 |
/* Trigger the search when the user presses "enter" on the keyboard */
|
778 |
$( "#wpsl-search-input" ).keydown( function ( event ) {
|
779 |
var keypressed = event.keyCode || event.which;
|
780 |
+
|
781 |
if ( keypressed == 13 ) {
|
782 |
$( "#wpsl-search-btn" ).trigger( "click" );
|
783 |
}
|
784 |
});
|
785 |
|
786 |
+
$( "#wpsl-stores" ).on( "click", ".wpsl-store-details", function() {
|
787 |
+
var i, storeId = $( this ).data( "store-id" );
|
788 |
+
|
789 |
+
for ( i = 0, len = markersArray.length; i < len; i++ ) {
|
790 |
+
if ( markersArray[i].storeId == storeId ) {
|
791 |
+
google.maps.event.trigger( markersArray[i], "click" );
|
792 |
+
}
|
793 |
+
}
|
794 |
+
|
795 |
+
/* If we show the store listings under the map, we do want to jump to the
|
796 |
+
* top of the map to focus on the opened infowindow
|
797 |
+
*/
|
798 |
+
if ( wpslSettings.storeBelow != 1 ) {
|
799 |
+
return false;
|
800 |
+
}
|
801 |
+
});
|
802 |
+
|
803 |
+
if ( $( "#wpsl-gmap" ).length ) {
|
804 |
google.maps.event.addDomListener( window, "load", initializeGmap );
|
805 |
}
|
806 |
|
readme.txt
CHANGED
@@ -3,7 +3,7 @@ Contributors: tijmensmit
|
|
3 |
Tags: google maps, store locator, business locations, geocoding, stores, geo
|
4 |
Requires at least: 3.5
|
5 |
Tested up to: 3.8.1
|
6 |
-
Stable tag: 1.2.
|
7 |
License: GPLv3
|
8 |
License URI: http://www.gnu.org/licenses/gpl.html
|
9 |
|
@@ -65,6 +65,12 @@ Make sure you don't have any security plugins, or custom functions running that
|
|
65 |
|
66 |
== Changelog ==
|
67 |
|
|
|
|
|
|
|
|
|
|
|
|
|
68 |
= 1.2.1 =
|
69 |
* Added an option to show the store listings below the map instead of next to it
|
70 |
* Added an option to open the directions in a new window on maps.google.com itself
|
3 |
Tags: google maps, store locator, business locations, geocoding, stores, geo
|
4 |
Requires at least: 3.5
|
5 |
Tested up to: 3.8.1
|
6 |
+
Stable tag: 1.2.11
|
7 |
License: GPLv3
|
8 |
License URI: http://www.gnu.org/licenses/gpl.html
|
9 |
|
65 |
|
66 |
== Changelog ==
|
67 |
|
68 |
+
= 1.2.11 =
|
69 |
+
* Fixed the distance format always using km when you clicked the 'directions' text in the marker
|
70 |
+
* Fixed an issue where a CSS rule in some themes would place a background image on the active item in the dropdown list
|
71 |
+
* Added an option to disable the mouse cursor on pageload focusing on the location input field
|
72 |
+
* Added an option to add a 'More info' link to the store listings, which when clicked will open the infowindow in the marker on the map
|
73 |
+
|
74 |
= 1.2.1 =
|
75 |
* Added an option to show the store listings below the map instead of next to it
|
76 |
* Added an option to open the directions in a new window on maps.google.com itself
|
wp-store-locator.php
CHANGED
@@ -5,7 +5,7 @@ Plugin URI:
|
|
5 |
Description: An easy to use location management system that enables users to search for nearby physical stores
|
6 |
Author: Tijmen Smit
|
7 |
Author URI: http://tijmensmit.com/
|
8 |
-
Version: 1.2.
|
9 |
Text Domain: wpsl
|
10 |
Domain Path: /languages/
|
11 |
License: GPLv3
|
@@ -75,6 +75,8 @@ if ( !class_exists( 'WP_Store_locator' ) ) {
|
|
75 |
'reset_map' => '0',
|
76 |
'store_below' => '0',
|
77 |
'direction_redirect' => '0',
|
|
|
|
|
78 |
'start_marker' => 'red.png',
|
79 |
'store_marker' => 'blue.png',
|
80 |
'start_label' => 'Start location',
|
@@ -84,6 +86,7 @@ if ( !class_exists( 'WP_Store_locator' ) ) {
|
|
84 |
'radius_label' => 'Search radius',
|
85 |
'no_results_label' => 'No results found',
|
86 |
'results_label' => 'Results',
|
|
|
87 |
'directions_label' => 'Directions',
|
88 |
'error_label' => 'Something went wrong, please try again!',
|
89 |
'limit_label' => 'API usage limit reached',
|
@@ -122,8 +125,8 @@ if ( !class_exists( 'WP_Store_locator' ) ) {
|
|
122 |
*/
|
123 |
public function define_constants() {
|
124 |
|
125 |
-
if ( !defined( 'WPSL_VERSION_NUM' ) )
|
126 |
-
define( 'WPSL_VERSION_NUM', '1.2' );
|
127 |
|
128 |
if ( !defined( 'WPSL_URL' ) )
|
129 |
define( 'WPSL_URL', plugin_dir_url( __FILE__ ) );
|
5 |
Description: An easy to use location management system that enables users to search for nearby physical stores
|
6 |
Author: Tijmen Smit
|
7 |
Author URI: http://tijmensmit.com/
|
8 |
+
Version: 1.2.11
|
9 |
Text Domain: wpsl
|
10 |
Domain Path: /languages/
|
11 |
License: GPLv3
|
75 |
'reset_map' => '0',
|
76 |
'store_below' => '0',
|
77 |
'direction_redirect' => '0',
|
78 |
+
'more_info' => '0',
|
79 |
+
'mouse_focus' => '1',
|
80 |
'start_marker' => 'red.png',
|
81 |
'store_marker' => 'blue.png',
|
82 |
'start_label' => 'Start location',
|
86 |
'radius_label' => 'Search radius',
|
87 |
'no_results_label' => 'No results found',
|
88 |
'results_label' => 'Results',
|
89 |
+
'more_label' => 'More info',
|
90 |
'directions_label' => 'Directions',
|
91 |
'error_label' => 'Something went wrong, please try again!',
|
92 |
'limit_label' => 'API usage limit reached',
|
125 |
*/
|
126 |
public function define_constants() {
|
127 |
|
128 |
+
if ( !defined( 'WPSL_VERSION_NUM' ) )
|
129 |
+
define( 'WPSL_VERSION_NUM', '1.2.11' );
|
130 |
|
131 |
if ( !defined( 'WPSL_URL' ) )
|
132 |
define( 'WPSL_URL', plugin_dir_url( __FILE__ ) );
|