WP Store Locator - Version 1.2

Version Description

  • Added an option to show the store listings below the map instead of next to it
  • Added an option to open the directions in a new window on maps.google.com itself
  • Fixed a 'too much recursion' js error that showed up when no start location was defined
  • Fixed the auto loading of stores not being ordered by distance
  • Fixed a problem with the input fields not always aligning in Chrome
  • Improved the handling of thumbnails. If the thumbnail format is disabled in the theme, it will look for the medium or full format instead
  • Several other small code improvements
Download this release

Release Info

Developer tijmensmit
Plugin Icon 128x128 WP Store Locator
Version 1.2
Comparing to
See all releases

Code changes from version 1.1 to 1.2

admin/class-admin.php CHANGED
@@ -32,11 +32,12 @@ if ( !class_exists( 'WPSL_Admin' ) ) {
32
  */
33
  function __construct() {
34
  add_action( 'init', array( $this, 'output_buffer' ) );
 
 
 
35
  add_action( 'admin_init', array( $this, 'admin_init' ) );
36
  add_action( 'wp_loaded', array( $this, 'init' ) );
37
  add_action( 'wp_ajax_delete_store', array( $this, 'delete_store_ajax' ) );
38
-
39
- $this->settings = $this->get_settings();
40
  }
41
 
42
  public function output_buffer() {
@@ -44,14 +45,80 @@ if ( !class_exists( 'WPSL_Admin' ) ) {
44
  }
45
 
46
  /**
47
- * Register a callback function for the settings page
48
  *
49
  * @since 1.0
50
  * @return void
51
  */
52
  public function admin_init() {
53
- register_setting( 'wpsl_settings', 'wpsl_settings', array( $this, 'sanitize_settings' ) );
 
 
 
 
 
 
 
 
 
 
 
 
54
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
55
 
56
  /**
57
  * Add the admin menu and enqueue the admin scripts
@@ -212,7 +279,7 @@ if ( !class_exists( 'WPSL_Admin' ) ) {
212
  $this->store_data['street'],
213
  $this->store_data['city'],
214
  $this->store_data['state'],
215
- strtoupper ( $this->store_data['zip'] ),
216
  $this->store_data['country'],
217
  $this->store_data['country-iso'],
218
  $this->store_data['latlng']['lat'],
@@ -380,6 +447,37 @@ if ( !class_exists( 'WPSL_Admin' ) ) {
380
 
381
  add_settings_error ( 'setting-errors', esc_attr( 'settings_fail' ), $error_msg, 'error' );
382
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
383
 
384
  /**
385
  * Sanitize the submitted plugin settings
@@ -491,11 +589,13 @@ if ( !class_exists( 'WPSL_Admin' ) ) {
491
  $output['label_width'] = $this->get_default_setting( 'label_width' );
492
  }
493
 
494
- $output['results_dropdown'] = isset( $_POST['wpsl_design']['design_results'] ) ? 1 : 0;
495
- $output['new_window'] = isset( $_POST['wpsl_design']['new_window'] ) ? 1 : 0;
496
- $output['reset_map'] = isset( $_POST['wpsl_design']['reset_map'] ) ? 1 : 0;
497
- $output['start_marker'] = wp_filter_nohtml_kses( $_POST['wpsl_map']['start_marker'] );
498
- $output['store_marker'] = wp_filter_nohtml_kses( $_POST['wpsl_map']['store_marker'] );
 
 
499
 
500
  $missing_labels = false;
501
  $required_labels = array(
@@ -574,7 +674,6 @@ if ( !class_exists( 'WPSL_Admin' ) ) {
574
  );
575
 
576
  return $response;
577
- break;
578
  case 'ZERO_RESULTS':
579
  $msg = __( 'The Google Geocoding API returned no results for the store location. Please change the location and try again.', 'wpsl' );
580
  break;
@@ -653,7 +752,7 @@ if ( !class_exists( 'WPSL_Admin' ) ) {
653
  */
654
  public function show_marker_options() {
655
 
656
- $marker_list;
657
  $marker_images = $this->get_available_markers();
658
  $marker_locations = array(
659
  "start",
32
  */
33
  function __construct() {
34
  add_action( 'init', array( $this, 'output_buffer' ) );
35
+
36
+ $this->settings = $this->get_settings();
37
+
38
  add_action( 'admin_init', array( $this, 'admin_init' ) );
39
  add_action( 'wp_loaded', array( $this, 'init' ) );
40
  add_action( 'wp_ajax_delete_store', array( $this, 'delete_store_ajax' ) );
 
 
41
  }
42
 
43
  public function output_buffer() {
45
  }
46
 
47
  /**
48
+ * Register a callback function for the settings page and check if we need to show the "missing start point" warning.
49
  *
50
  * @since 1.0
51
  * @return void
52
  */
53
  public function admin_init() {
54
+
55
+ global $current_user;
56
+
57
+ $this->check_upgrade();
58
+
59
+ if ( ( current_user_can( 'install_plugins' ) ) && is_admin() ) {
60
+ if ( ( empty( $this->settings['zoom_latlng'] ) && !get_user_meta( $current_user->ID, 'wpsl_disable_location_warning' ) ) ) {
61
+ add_action( 'wp_ajax_disable_location_warning', array( $this, 'disable_location_warning_ajax' ) );
62
+ add_action( 'admin_footer', array( $this, 'show_location_warning' ) );
63
+ }
64
+ }
65
+
66
+ register_setting( 'wpsl_settings', 'wpsl_settings', array( $this, 'sanitize_settings' ) );
67
  }
68
+
69
+ /**
70
+ * If the db doesn't hold the current version, run the upgrade procedure
71
+ *
72
+ * @since 1.2
73
+ * @return void
74
+ */
75
+ public function check_upgrade() {
76
+
77
+ $current_version = get_option( 'wpsl_version' );
78
+
79
+ if ( version_compare( $current_version, WPSL_VERSION_NUM, '===' ) )
80
+ return;
81
+
82
+ if ( version_compare( $current_version, '1.1', '<' ) ) {
83
+ if ( is_array( $this->settings ) ) {
84
+ /* Add the default value for the reset map option */
85
+ if ( empty( $this->settings['reset_map'] ) ) {
86
+ $this->settings['reset_map'] = 0;
87
+ update_option( 'wpsl_settings', $this->settings );
88
+ }
89
+
90
+ /* Add the default value for the way the store listings are shown, either below or next to the map */
91
+ if ( empty( $this->settings['auto_load'] ) ) {
92
+ $this->settings['auto_load'] = 1;
93
+ update_option( 'wpsl_settings', $this->settings );
94
+ }
95
+
96
+ /* Add the default value for the route redirect */
97
+ if ( empty( $this->settings['new_window'] ) ) {
98
+ $this->settings['new_window'] = 0;
99
+ update_option( 'wpsl_settings', $this->settings );
100
+ }
101
+ }
102
+ }
103
+
104
+ if ( version_compare( $current_version, '1.2', '<' ) ) {
105
+ if ( is_array( $this->settings ) ) {
106
+ /* Add the default value for the way the store listings are shown, either below or next to the map */
107
+ if ( empty( $this->settings['store_below'] ) ) {
108
+ $this->settings['store_below'] = 0;
109
+ update_option( 'wpsl_settings', $this->settings );
110
+ }
111
+
112
+ /* Add the default value for the route redirect */
113
+ if ( empty( $this->settings['direction_redirect'] ) ) {
114
+ $this->settings['direction_redirect'] = 0;
115
+ update_option( 'wpsl_settings', $this->settings );
116
+ }
117
+ }
118
+ }
119
+
120
+ update_option( 'wpsl_version', WPSL_VERSION_NUM );
121
+ }
122
 
123
  /**
124
  * Add the admin menu and enqueue the admin scripts
279
  $this->store_data['street'],
280
  $this->store_data['city'],
281
  $this->store_data['state'],
282
+ strtoupper( $this->store_data['zip'] ),
283
  $this->store_data['country'],
284
  $this->store_data['country-iso'],
285
  $this->store_data['latlng']['lat'],
447
 
448
  add_settings_error ( 'setting-errors', esc_attr( 'settings_fail' ), $error_msg, 'error' );
449
  }
450
+
451
+ /**
452
+ * Display an error message when no start location is defined, and the warning hasn't been disabled
453
+ *
454
+ * @since 1.2
455
+ * @return void
456
+ */
457
+ public function show_location_warning() {
458
+ if ( $_GET['page'] !== 'wpsl_settings' ) {
459
+ echo "<div id='message' class='error'><p><strong>" . sprintf( __( "Before adding the [wpsl] shortcode to a page, please don't forget to define a start point on the %ssettings%s page.", "wpsl" ), "<a href='" . admin_url( 'admin.php?page=wpsl_settings' ) . "'>", "</a>" ) . " <a class='wpsl-dismiss' data-nonce='" . wp_create_nonce( 'wpsl-dismiss' ) . "' href='#'>" . __( "Dismiss", "wpsl" ) . "</a></p></div>";
460
+ }
461
+ }
462
+
463
+ /**
464
+ * Disable the missing start location warning
465
+ *
466
+ * @since 1.2
467
+ * @return void
468
+ */
469
+ public function disable_location_warning_ajax() {
470
+
471
+ global $current_user;
472
+
473
+ if ( !current_user_can( 'manage_options' ) )
474
+ die( '-1' );
475
+ check_ajax_referer( 'wpsl-dismiss' );
476
+
477
+ $update_id = add_user_meta( $current_user->ID, 'wpsl_disable_location_warning', 'true', true );
478
+
479
+ die();
480
+ }
481
 
482
  /**
483
  * Sanitize the submitted plugin settings
589
  $output['label_width'] = $this->get_default_setting( 'label_width' );
590
  }
591
 
592
+ $output['results_dropdown'] = isset( $_POST['wpsl_design']['design_results'] ) ? 1 : 0;
593
+ $output['new_window'] = isset( $_POST['wpsl_design']['new_window'] ) ? 1 : 0;
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
 
600
  $missing_labels = false;
601
  $required_labels = array(
674
  );
675
 
676
  return $response;
 
677
  case 'ZERO_RESULTS':
678
  $msg = __( 'The Google Geocoding API returned no results for the store location. Please change the location and try again.', 'wpsl' );
679
  break;
752
  */
753
  public function show_marker_options() {
754
 
755
+ $marker_list = '';
756
  $marker_images = $this->get_available_markers();
757
  $marker_locations = array(
758
  "start",
admin/class-store-overview.php CHANGED
@@ -282,7 +282,7 @@ class WPSL_Store_Overview extends WP_List_Table {
282
  );
283
  } else {
284
  /* Order params */
285
- $orderby = !empty ( $_GET["orderby"] ) ? mysql_real_escape_string ( $_GET["orderby"] ) : 'wpsl_id';
286
  $order = !empty ( $_GET["order"] ) ? mysql_real_escape_string ( $_GET["order"] ) : 'ASC';
287
  $order_sql = $orderby.' '.$order;
288
 
282
  );
283
  } else {
284
  /* Order params */
285
+ $orderby = !empty ( $_GET["orderby"] ) ? mysql_real_escape_string ( $_GET["orderby"] ) : 'store';
286
  $order = !empty ( $_GET["order"] ) ? mysql_real_escape_string ( $_GET["order"] ) : 'ASC';
287
  $order_sql = $orderby.' '.$order;
288
 
admin/js/wpsl-admin.js CHANGED
@@ -4,8 +4,7 @@ var map, geocoder, uploadFrame,
4
 
5
  /* Load the Google Maps */
6
  function initializeGmap() {
7
- var draggable, alt,
8
- myOptions = {
9
  zoom: 2,
10
  center: new google.maps.LatLng( "52.378153", "4.899363" ),
11
  mapTypeId: google.maps.MapTypeId.ROADMAP,
@@ -252,8 +251,18 @@ $( "#wpsl-thumb-wrap" ).on( "click", "#wpsl-media-upload", function( e ) {
252
  });
253
 
254
  uploadFrame.on( "select", function() {
255
- var media_attachment = uploadFrame.state().get( "selection" ).first().toJSON();
256
- setLocationThumb( media_attachment.sizes.thumbnail.url, media_attachment.id );
 
 
 
 
 
 
 
 
 
 
257
  });
258
 
259
  uploadFrame.open();
@@ -287,8 +296,7 @@ $( "#wpsl-store-overview" ).on( "click", ".wpsl-delete-store-btn", function() {
287
  var elem = $(this),
288
  dialogBox = $( "#wpsl-delete-confirmation" ),
289
  cancelBtn = dialogBox.find( ".button-secondary" ),
290
- submitBtn = dialogBox.find( ".button-primary" ),
291
- storeId = $(this).next( "input[name='wpsl_store_id']" ).val();
292
 
293
  dialogBox.dialog({
294
  width: 325,
@@ -348,18 +356,33 @@ function deleteStore( elem ) {
348
  });
349
  }
350
 
351
- $( ".wpsl-marker-list input[type=radio]" ).click( function(){
352
  $(this).parents( ".wpsl-marker-list" ).find( "li" ).removeClass();
353
  $(this).parent( "li" ).addClass( "wpsl-active-marker" );
354
  });
355
 
356
- $( ".wpsl-marker-list li" ).click( function(){
357
  $(this).parents( ".wpsl-marker-list" ).find( "input" ).prop( "checked", false );
358
  $(this).find( "input" ).prop( "checked", true );
359
  $(this).siblings().removeClass();
360
  $(this).addClass( "wpsl-active-marker" );
361
  });
362
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
363
  /* Insert the preloader after the button */
364
  function showPreloader( elem ) {
365
  if ( !elem.parent().find( ".wpsl-preloader" ).length ) {
4
 
5
  /* Load the Google Maps */
6
  function initializeGmap() {
7
+ var myOptions = {
 
8
  zoom: 2,
9
  center: new google.maps.LatLng( "52.378153", "4.899363" ),
10
  mapTypeId: google.maps.MapTypeId.ROADMAP,
251
  });
252
 
253
  uploadFrame.on( "select", function() {
254
+ var thumbUrl,
255
+ media_attachment = uploadFrame.state().get( "selection" ).first().toJSON();
256
+
257
+ if ( typeof( media_attachment.sizes.thumbnail ) !== 'undefined' ) {
258
+ thumbUrl = media_attachment.sizes.thumbnail.url;
259
+ } else if ( typeof( media_attachment.sizes.medium ) !== 'undefined' ) {
260
+ thumbUrl = media_attachment.sizes.medium.url;
261
+ } else if ( typeof( media_attachment.sizes.full ) !== 'undefined' ) {
262
+ thumbUrl = media_attachment.sizes.full.url;
263
+ }
264
+
265
+ setLocationThumb( thumbUrl, media_attachment.id );
266
  });
267
 
268
  uploadFrame.open();
296
  var elem = $(this),
297
  dialogBox = $( "#wpsl-delete-confirmation" ),
298
  cancelBtn = dialogBox.find( ".button-secondary" ),
299
+ submitBtn = dialogBox.find( ".button-primary" );
 
300
 
301
  dialogBox.dialog({
302
  width: 325,
356
  });
357
  }
358
 
359
+ $( ".wpsl-marker-list input[type=radio]" ).click( function() {
360
  $(this).parents( ".wpsl-marker-list" ).find( "li" ).removeClass();
361
  $(this).parent( "li" ).addClass( "wpsl-active-marker" );
362
  });
363
 
364
+ $( ".wpsl-marker-list li" ).click( function() {
365
  $(this).parents( ".wpsl-marker-list" ).find( "input" ).prop( "checked", false );
366
  $(this).find( "input" ).prop( "checked", true );
367
  $(this).siblings().removeClass();
368
  $(this).addClass( "wpsl-active-marker" );
369
  });
370
 
371
+ /* Handle a click on the dismiss button. So that the warning msg that no starting point is set is disabled */
372
+ $( ".wpsl-dismiss" ).click( function() {
373
+ var $link = $(this),
374
+ data = {
375
+ action: "disable_location_warning",
376
+ _ajax_nonce: $link.attr( "data-nonce" )
377
+ };
378
+
379
+ $.post( ajaxurl, data );
380
+
381
+ $( "#message" ).remove();
382
+
383
+ return false;
384
+ });
385
+
386
  /* Insert the preloader after the button */
387
  function showPreloader( elem ) {
388
  if ( !elem.parent().find( ".wpsl-preloader" ).length ) {
admin/templates/faq.php CHANGED
@@ -6,5 +6,13 @@
6
  <dt>How do I show the store locator on my page?</dt>
7
  <dd>Add this shortcode <code>[wpsl]</code> to the page where you want to show the store locator.</dd>
8
  </dl>
 
 
 
 
 
 
 
 
9
  </div>
10
- </div>
6
  <dt>How do I show the store locator on my page?</dt>
7
  <dd>Add this shortcode <code>[wpsl]</code> to the page where you want to show the store locator.</dd>
8
  </dl>
9
+ <dl>
10
+ <dt>The map doesn't display properly. It's either broken in half or doesn't load at all.</dt>
11
+ <dd>Make sure you have defined a start point for the map under settings -> map settings.</dd>
12
+ </dl>
13
+ <dl>
14
+ <dt>I get an error saying the 'sensor' parameter specified in the request must be set to either 'true' or 'false'.</dt>
15
+ <dd>Make sure you don't have any security plugins, or custom functions running that strip away version numbers from file paths.</dd>
16
+ </dl>
17
  </div>
18
+ </div>
admin/templates/map-settings.php CHANGED
@@ -160,6 +160,14 @@
160
  <label for="wpsl-reset-map"><?php _e( 'Show a reset map button?', 'wpsl' ); ?></label>
161
  <input type="checkbox" value="" <?php checked( $this->settings['reset_map'] == '1', true ); ?> name="wpsl_design[reset_map]" id="wpsl-reset-map">
162
  </p>
 
 
 
 
 
 
 
 
163
  <em><?php _e( '* This is the text that is placed before the search input and radius dropdown', 'wpsl' ); ?></em>
164
  </div>
165
  </div>
@@ -184,55 +192,55 @@
184
  <div class="inside">
185
  <p>
186
  <label for="wpsl-search"><?php _e( 'Your location:', 'wpsl' ); ?></label>
187
- <input type="text" value="<?php echo esc_attr( $this->settings['search_label'] ); ?>" name="wpsl_label[search]" class="textinput" id="wpsl-search">
188
  </p>
189
  <p>
190
  <label for="wpsl-search-radius"><?php _e( 'Search radius:', 'wpsl' ); ?></label>
191
- <input type="text" value="<?php echo esc_attr( $this->settings['radius_label'] ); ?>" name="wpsl_label[radius]" class="textinput" id="wpsl-search-radius">
192
  </p>
193
  <p>
194
  <label for="wpsl-no-results"><?php _e( 'No results found:', 'wpsl' ); ?></label>
195
- <input type="text" value="<?php echo esc_attr( $this->settings['no_results_label'] ); ?>" name="wpsl_label[no_results]" class="textinput" id="wpsl-no-results">
196
  </p>
197
  <p>
198
  <label for="wpsl-search-btn"><?php _e( 'Search:', 'wpsl' ); ?></label>
199
- <input type="text" value="<?php echo esc_attr( $this->settings['search_btn_label'] ); ?>" name="wpsl_label[search_btn]" class="textinput" id="wpsl-search-btn">
200
  </p>
201
  <p>
202
  <label for="wpsl-preloader"><?php _e( 'Searching (preloader text):', 'wpsl' ); ?></label>
203
- <input type="text" value="<?php echo esc_attr( $this->settings['preloader_label'] ); ?>" name="wpsl_label[preloader]" class="textinput" id="wpsl-preloader">
204
  </p>
205
  <p>
206
  <label for="wpsl-results"><?php _e( 'Results:', 'wpsl' ); ?></label>
207
- <input type="text" value="<?php echo esc_attr( $this->settings['results_label'] ); ?>" name="wpsl_label[results]" class="textinput" id="wpsl-results">
208
  </p>
209
  <p>
210
  <label for="wpsl-phone"><?php _e( 'Phone:', 'wpsl' ); ?></label>
211
- <input type="text" value="<?php echo esc_attr( $this->settings['phone_label'] ); ?>" name="wpsl_label[phone]" class="textinput" id="wpsl-phone">
212
  </p>
213
  <p>
214
  <label for="wpsl-fax"><?php _e( 'Fax:', 'wpsl' ); ?></label>
215
- <input type="text" value="<?php echo esc_attr( $this->settings['fax_label'] ); ?>" name="wpsl_label[fax]" class="textinput" id="wpsl-fax">
216
  </p>
217
  <p>
218
  <label for="wpsl-hours"><?php _e( 'Hours:', 'wpsl' ); ?></label>
219
- <input type="text" value="<?php echo esc_attr( $this->settings['hours_label'] ); ?>" name="wpsl_label[hours]" class="textinput" id="wpsl-hours">
220
  </p>
221
  <p>
222
  <label for="wpsl-start"><?php _e( 'Start location:', 'wpsl' ); ?></label>
223
- <input type="text" value="<?php echo esc_attr( $this->settings['start_label'] ); ?>" name="wpsl_label[start]" class="textinput" id="wpsl-start">
224
  </p>
225
  <p>
226
  <label for="wpsl-directions"><?php _e( 'Get directions:', 'wpsl' ); ?></label>
227
- <input type="text" value="<?php echo esc_attr( $this->settings['directions_label'] ); ?>" name="wpsl_label[directions]" class="textinput" id="wpsl-directions">
228
  </p>
229
  <p>
230
  <label for="wpsl-error"><?php _e( 'General error:', 'wpsl' ); ?></label>
231
- <input type="text" value="<?php echo esc_attr( $this->settings['error_label'] ); ?>" name="wpsl_label[error]" class="textinput" id="wpsl-error">
232
  </p>
233
  <p>
234
  <label for="wpsl-limit"><?php _e( 'Query limit error:', 'wpsl' ); ?> *</label>
235
- <input type="text" value="<?php echo esc_attr( $this->settings['limit_label'] ); ?>" name="wpsl_label[limit]" class="textinput" id="wpsl-limit">
236
  </p>
237
  <em><?php _e( '* You can raise the <a href="https://developers.google.com/maps/documentation/javascript/usage#usage_limits">usage limit</a> by obtaining an API <a href="https://developers.google.com/maps/documentation/javascript/tutorial#api_key">key</a>, <br> and fill in the "API key" field at the top of this page.', 'wpsl' ); ?></em>
238
  </div>
160
  <label for="wpsl-reset-map"><?php _e( 'Show a reset map button?', 'wpsl' ); ?></label>
161
  <input type="checkbox" value="" <?php checked( $this->settings['reset_map'] == '1', true ); ?> name="wpsl_design[reset_map]" id="wpsl-reset-map">
162
  </p>
163
+ <p>
164
+ <label for="wpsl-store-below"><?php _e( 'Show the store listings below the map?', 'wpsl' ); ?></label>
165
+ <input type="checkbox" value="" <?php checked( $this->settings['store_below'] == '1', true ); ?> name="wpsl_design[store_below]" id="wpsl-store-below">
166
+ </p>
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>
192
  <div class="inside">
193
  <p>
194
  <label for="wpsl-search"><?php _e( 'Your location:', 'wpsl' ); ?></label>
195
+ <input type="text" value="<?php echo esc_attr( stripslashes( $this->settings['search_label'] ) ); ?>" name="wpsl_label[search]" class="textinput" id="wpsl-search">
196
  </p>
197
  <p>
198
  <label for="wpsl-search-radius"><?php _e( 'Search radius:', 'wpsl' ); ?></label>
199
+ <input type="text" value="<?php echo esc_attr( stripslashes( $this->settings['radius_label'] ) ); ?>" name="wpsl_label[radius]" class="textinput" id="wpsl-search-radius">
200
  </p>
201
  <p>
202
  <label for="wpsl-no-results"><?php _e( 'No results found:', 'wpsl' ); ?></label>
203
+ <input type="text" value="<?php echo esc_attr( stripslashes( $this->settings['no_results_label'] ) ); ?>" name="wpsl_label[no_results]" class="textinput" id="wpsl-no-results">
204
  </p>
205
  <p>
206
  <label for="wpsl-search-btn"><?php _e( 'Search:', 'wpsl' ); ?></label>
207
+ <input type="text" value="<?php echo esc_attr( stripslashes( $this->settings['search_btn_label'] ) ); ?>" name="wpsl_label[search_btn]" class="textinput" id="wpsl-search-btn">
208
  </p>
209
  <p>
210
  <label for="wpsl-preloader"><?php _e( 'Searching (preloader text):', 'wpsl' ); ?></label>
211
+ <input type="text" value="<?php echo esc_attr( stripslashes( $this->settings['preloader_label'] ) ); ?>" name="wpsl_label[preloader]" class="textinput" id="wpsl-preloader">
212
  </p>
213
  <p>
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">
220
  </p>
221
  <p>
222
  <label for="wpsl-fax"><?php _e( 'Fax:', 'wpsl' ); ?></label>
223
+ <input type="text" value="<?php echo esc_attr( stripslashes( $this->settings['fax_label'] ) ); ?>" name="wpsl_label[fax]" class="textinput" id="wpsl-fax">
224
  </p>
225
  <p>
226
  <label for="wpsl-hours"><?php _e( 'Hours:', 'wpsl' ); ?></label>
227
+ <input type="text" value="<?php echo esc_attr( stripslashes( $this->settings['hours_label'] ) ); ?>" name="wpsl_label[hours]" class="textinput" id="wpsl-hours">
228
  </p>
229
  <p>
230
  <label for="wpsl-start"><?php _e( 'Start location:', 'wpsl' ); ?></label>
231
+ <input type="text" value="<?php echo esc_attr( stripslashes( $this->settings['start_label'] ) ); ?>" name="wpsl_label[start]" class="textinput" id="wpsl-start">
232
  </p>
233
  <p>
234
  <label for="wpsl-directions"><?php _e( 'Get directions:', 'wpsl' ); ?></label>
235
+ <input type="text" value="<?php echo esc_attr( stripslashes( $this->settings['directions_label'] ) ); ?>" name="wpsl_label[directions]" class="textinput" id="wpsl-directions">
236
  </p>
237
  <p>
238
  <label for="wpsl-error"><?php _e( 'General error:', 'wpsl' ); ?></label>
239
+ <input type="text" value="<?php echo esc_attr( stripslashes( $this->settings['error_label'] ) ); ?>" name="wpsl_label[error]" class="textinput" id="wpsl-error">
240
  </p>
241
  <p>
242
  <label for="wpsl-limit"><?php _e( 'Query limit error:', 'wpsl' ); ?> *</label>
243
+ <input type="text" value="<?php echo esc_attr( stripslashes( $this->settings['limit_label'] ) ); ?>" name="wpsl_label[limit]" class="textinput" id="wpsl-limit">
244
  </p>
245
  <em><?php _e( '* You can raise the <a href="https://developers.google.com/maps/documentation/javascript/usage#usage_limits">usage limit</a> by obtaining an API <a href="https://developers.google.com/maps/documentation/javascript/tutorial#api_key">key</a>, <br> and fill in the "API key" field at the top of this page.', 'wpsl' ); ?></em>
246
  </div>
css/styles.css CHANGED
@@ -8,6 +8,11 @@
8
  height:350px;
9
  }
10
 
 
 
 
 
 
11
  /* Map reset button */
12
  #wpsl-reset-map {
13
  position:absolute;
@@ -17,12 +22,13 @@
17
  background:#fff;
18
  box-shadow:0 1px 2px rgba(64, 64, 64, 0.3);
19
  border-radius: 3px;
20
- z-index:9999;
21
  display:none;
22
  }
23
  #wpsl-reset-map:hover {
24
  cursor: pointer;
25
  }
 
26
  /*
27
  Some themes set a box-shadow or max-width for all image /
28
  div elements, we disable it to prevent it from messing up the map
@@ -38,14 +44,39 @@ div elements, we disable it to prevent it from messing up the map
38
  width:100%;
39
  overflow:hidden;
40
  clear:both;
 
41
  }
42
  #wpsl-search-wrap {
43
  float:left;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
44
  }
45
  #wpsl-search-input {
46
  width:179px;
47
  padding: 7px 12px;
48
  font-size: 100%;
 
49
  /* padding: 3% 12px;*/
50
  }
51
  #wpsl-search-wrap input,
@@ -84,6 +115,11 @@ div elements, we disable it to prevent it from messing up the map
84
  width:33%;
85
  margin-right:0.5%;
86
  }
 
 
 
 
 
87
 
88
  #wpsl-stores,
89
  #wpsl-direction-details {
@@ -95,6 +131,10 @@ div elements, we disable it to prevent it from messing up the map
95
  #wpsl-result-list p {
96
  padding-left:10px;
97
  }
 
 
 
 
98
  #wpsl-result-list p a {
99
  display:block;
100
  margin-bottom:10px;
@@ -107,6 +147,10 @@ div elements, we disable it to prevent it from messing up the map
107
  overflow: hidden;
108
  list-style: none outside none !important
109
  }
 
 
 
 
110
  #wpsl-result-list li p {
111
  padding-left:0;
112
  margin-bottom:20px;
@@ -165,13 +209,17 @@ div elements, we disable it to prevent it from messing up the map
165
  #wpsl-search-btn {
166
  margin-right:10px;
167
  float:left;
168
- /* height:32px;*/
 
 
 
 
 
 
 
169
  }
170
 
171
  #wpsl-radius {margin-right:10px;}
172
- /*#wpsl-search-wrap #wpsl-results {
173
- margin-right: 0;
174
- }*/
175
  #wpsl-search-btn:hover {
176
  cursor: pointer;
177
  }
@@ -184,7 +232,6 @@ div elements, we disable it to prevent it from messing up the map
184
  #wpsl-search-wrap div label {
185
  float:left;
186
  margin-right:10px;
187
- /* margin-top: 4px;*/
188
  line-height: 32px;
189
  }
190
 
@@ -204,6 +251,11 @@ div elements, we disable it to prevent it from messing up the map
204
  .wpsl-info-window span {
205
  display:block;
206
  }
 
 
 
 
 
207
  .wpsl-info-window p {
208
  margin-bottom:10px;
209
  }
@@ -460,7 +512,8 @@ wpsl-search-input.focus,
460
 
461
  .wpsl-input label,
462
  #wpsl-radius label {
463
- min-width: 100px;
 
464
  }
465
  }
466
 
@@ -491,7 +544,7 @@ wpsl-search-input.focus,
491
  @media (max-width: 675px) {
492
  #wpsl-search-wrap #wpsl-search-btn {
493
  float:left;
494
- margin:0 5px 5px 0;
495
  }
496
 
497
  .wpsl-dropdown {
@@ -534,6 +587,9 @@ wpsl-search-input.focus,
534
  }
535
 
536
  @media (max-width: 570px) {
 
 
 
537
  #wpsl-search-input {
538
  width: 277px;
539
  }
@@ -611,7 +667,7 @@ wpsl-search-input.focus,
611
 
612
  @media (max-width: 375px) {
613
  #wpsl-search-input {
614
- width:88%;
615
  }
616
  .wpsl-no-results #wpsl-search-input {
617
  width:200px !important;
8
  height:350px;
9
  }
10
 
11
+ .wpsl-store-below #wpsl-gmap {
12
+ float:none;
13
+ width:100%;
14
+ }
15
+
16
  /* Map reset button */
17
  #wpsl-reset-map {
18
  position:absolute;
22
  background:#fff;
23
  box-shadow:0 1px 2px rgba(64, 64, 64, 0.3);
24
  border-radius: 3px;
25
+ z-index:3;
26
  display:none;
27
  }
28
  #wpsl-reset-map:hover {
29
  cursor: pointer;
30
  }
31
+
32
  /*
33
  Some themes set a box-shadow or max-width for all image /
34
  div elements, we disable it to prevent it from messing up the map
44
  width:100%;
45
  overflow:hidden;
46
  clear:both;
47
+ margin-bottom:20px;
48
  }
49
  #wpsl-search-wrap {
50
  float:left;
51
+ width:100%;
52
+ }
53
+
54
+ /* Possible fix for vertical text issue in IE9? */
55
+ .gm-style-cc {
56
+ word-wrap:normal;
57
+ }
58
+
59
+ #wpsl-search-wrap .wpsl-input,
60
+ #wpsl-search-wrap .wpsl-select-wrap {
61
+ display:table;
62
+ }
63
+
64
+ #wpsl-search-wrap .wpsl-input label,
65
+ #wpsl-search-wrap .wpsl-input input,
66
+ #wpsl-search-wrap .wpsl-select-wrap #wpsl-radius,
67
+ #wpsl-search-wrap .wpsl-select-wrap #wpsl-results,
68
+ #wpsl-search-btn {
69
+ display:table-cell;
70
+ }
71
+
72
+ #wpsl-search-wrap label {
73
+ margin-bottom:0;
74
  }
75
  #wpsl-search-input {
76
  width:179px;
77
  padding: 7px 12px;
78
  font-size: 100%;
79
+ margin:0;
80
  /* padding: 3% 12px;*/
81
  }
82
  #wpsl-search-wrap input,
115
  width:33%;
116
  margin-right:0.5%;
117
  }
118
+ .wpsl-store-below #wpsl-result-list {
119
+ float:none;
120
+ width:100%;
121
+ margin:12px 0 0 0;
122
+ }
123
 
124
  #wpsl-stores,
125
  #wpsl-direction-details {
131
  #wpsl-result-list p {
132
  padding-left:10px;
133
  }
134
+ .wpsl-store-below #wpsl-result-list p {
135
+ padding-left: 0;
136
+ }
137
+
138
  #wpsl-result-list p a {
139
  display:block;
140
  margin-bottom:10px;
147
  overflow: hidden;
148
  list-style: none outside none !important
149
  }
150
+ .wpsl-store-below #wpsl-result-list li {
151
+ padding: 10px 10px 10px 0;
152
+ }
153
+
154
  #wpsl-result-list li p {
155
  padding-left:0;
156
  margin-bottom:20px;
209
  #wpsl-search-btn {
210
  margin-right:10px;
211
  float:left;
212
+ }
213
+
214
+ #wpsl-search-wrap .wpsl-input label {
215
+ margin-right:0;
216
+ }
217
+
218
+ #wpsl-radius, #wpsl-results {
219
+ display:inline;
220
  }
221
 
222
  #wpsl-radius {margin-right:10px;}
 
 
 
223
  #wpsl-search-btn:hover {
224
  cursor: pointer;
225
  }
232
  #wpsl-search-wrap div label {
233
  float:left;
234
  margin-right:10px;
 
235
  line-height: 32px;
236
  }
237
 
251
  .wpsl-info-window span {
252
  display:block;
253
  }
254
+
255
+ /* Fix for Google Voice breaking the phone numbers */
256
+ .wpsl-info-window span span {
257
+ display:inline !important;
258
+ }
259
  .wpsl-info-window p {
260
  margin-bottom:10px;
261
  }
512
 
513
  .wpsl-input label,
514
  #wpsl-radius label {
515
+ min-width: 100px !important;
516
+ width:auto;
517
  }
518
  }
519
 
544
  @media (max-width: 675px) {
545
  #wpsl-search-wrap #wpsl-search-btn {
546
  float:left;
547
+ margin:0 5px 0 0;
548
  }
549
 
550
  .wpsl-dropdown {
587
  }
588
 
589
  @media (max-width: 570px) {
590
+ #wpsl-search-wrap #wpsl-search-btn {
591
+ margin-bottom: 5px;
592
+ }
593
  #wpsl-search-input {
594
  width: 277px;
595
  }
667
 
668
  @media (max-width: 375px) {
669
  #wpsl-search-input {
670
+ width:auto !important;
671
  }
672
  .wpsl-no-results #wpsl-search-input {
673
  width:200px !important;
frontend/class-frontend.php CHANGED
@@ -34,8 +34,14 @@ if ( !class_exists( 'WPSL_Frontend' ) ) {
34
  * @return void
35
  */
36
  public function render_store_locator() {
37
- $output = require_once( WPSL_PLUGIN_DIR . 'frontend/templates/default.php' );
38
- $this->add_frontend_scripts();
 
 
 
 
 
 
39
 
40
  return $output;
41
  }
@@ -67,6 +73,7 @@ if ( !class_exists( 'WPSL_Frontend' ) ) {
67
  */
68
  public function get_dropdown_list( $list_type ) {
69
 
 
70
  $settings = explode( ',', $this->settings[$list_type] );
71
 
72
  /* Only show the distance unit when we are dealing with the search radius */
@@ -101,6 +108,7 @@ if ( !class_exists( 'WPSL_Frontend' ) ) {
101
  */
102
  public function get_gmap_api_attributes() {
103
 
 
104
  $api_attributes = array( 'language', 'key', 'region' );
105
 
106
  foreach ( $api_attributes as $api_key ) {
@@ -166,37 +174,38 @@ if ( !class_exists( 'WPSL_Frontend' ) ) {
166
  $dropdown_defaults = $this->get_dropdown_defaults();
167
 
168
  $settings = array(
169
- 'startMarker' => $this->create_retina_filename( $this->settings['start_marker'] ),
170
- 'storeMarker' => $this->create_retina_filename( $this->settings['store_marker'] ),
171
- 'autoLocate' => $this->settings['auto_locate'],
172
- 'autoLoad' => $this->settings['auto_load'],
173
- 'mapType' => $this->settings['map_type'],
174
- 'zoomLevel' => $this->settings['zoom_level'],
175
- 'zoomLatlng' => $this->settings['zoom_latlng'],
176
- 'streetView' => $this->settings['streetview'],
177
- 'panControls' => $this->settings['pan_controls'],
178
- 'controlPosition' => $this->settings['control_position'],
179
- 'controlStyle' => $this->settings['control_style'],
180
- 'markerBounce' => $this->settings['marker_bounce'],
181
- 'newWindow' => $this->settings['new_window'],
182
- 'resetMap' => $this->settings['reset_map'],
183
- 'maxResults' => $dropdown_defaults['max_results'],
184
- 'searchRadius' => $dropdown_defaults['search_radius'],
185
- 'distanceUnit' => $this->settings['distance_unit'],
186
- 'ajaxurl' => admin_url( 'admin-ajax.php' ),
187
- 'path' => WPSL_URL,
 
188
  );
189
 
190
  $labels = array(
191
- 'preloader' => $this->settings['preloader_label'],
192
- 'noResults' => $this->settings['no_results_label'],
193
- 'generalError' => $this->settings['error_label'],
194
- 'queryLimit' => $this->settings['limit_label'],
195
- 'directions' => $this->settings['directions_label'],
196
- 'phone' => $this->settings['phone_label'],
197
- 'fax' => $this->settings['fax_label'],
198
- 'hours' => $this->settings['hours_label'],
199
- 'startPoint' => $this->settings['start_label']
200
  );
201
 
202
  wp_localize_script( 'wpsl-js', 'wpslSettings', $settings );
34
  * @return void
35
  */
36
  public function render_store_locator() {
37
+
38
+ if ( $this->settings['store_below'] ) {
39
+ $output = require_once( WPSL_PLUGIN_DIR . 'frontend/templates/store-listings-below.php' );
40
+ } else {
41
+ $output = require_once( WPSL_PLUGIN_DIR . 'frontend/templates/default.php' );
42
+ }
43
+
44
+ $this->add_frontend_scripts();
45
 
46
  return $output;
47
  }
73
  */
74
  public function get_dropdown_list( $list_type ) {
75
 
76
+ $dropdown_list = '';
77
  $settings = explode( ',', $this->settings[$list_type] );
78
 
79
  /* Only show the distance unit when we are dealing with the search radius */
108
  */
109
  public function get_gmap_api_attributes() {
110
 
111
+ $api_data = '';
112
  $api_attributes = array( 'language', 'key', 'region' );
113
 
114
  foreach ( $api_attributes as $api_key ) {
174
  $dropdown_defaults = $this->get_dropdown_defaults();
175
 
176
  $settings = array(
177
+ 'startMarker' => $this->create_retina_filename( $this->settings['start_marker'] ),
178
+ 'storeMarker' => $this->create_retina_filename( $this->settings['store_marker'] ),
179
+ 'autoLocate' => $this->settings['auto_locate'],
180
+ 'autoLoad' => $this->settings['auto_load'],
181
+ 'mapType' => $this->settings['map_type'],
182
+ 'zoomLevel' => $this->settings['zoom_level'],
183
+ 'zoomLatlng' => $this->settings['zoom_latlng'],
184
+ 'streetView' => $this->settings['streetview'],
185
+ 'panControls' => $this->settings['pan_controls'],
186
+ 'controlPosition' => $this->settings['control_position'],
187
+ 'controlStyle' => $this->settings['control_style'],
188
+ 'markerBounce' => $this->settings['marker_bounce'],
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'],
195
+ 'ajaxurl' => admin_url( 'admin-ajax.php' ),
196
+ 'path' => WPSL_URL,
197
  );
198
 
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'] ),
205
+ 'phone' => stripslashes( $this->settings['phone_label'] ),
206
+ 'fax' => stripslashes( $this->settings['fax_label'] ),
207
+ 'hours' => stripslashes( $this->settings['hours_label'] ),
208
+ 'startPoint' => stripslashes( $this->settings['start_label'] )
209
  );
210
 
211
  wp_localize_script( 'wpsl-js', 'wpslSettings', $settings );
frontend/templates/default.php CHANGED
@@ -5,15 +5,15 @@ $show_results_filter = $this->settings['results_dropdown'];
5
  $results_filter_class = ( $show_results_filter ) ? '' : 'wpsl-no-results';
6
 
7
  $output .= '<div id="wpsl-wrap">' . "\r\n";
8
- $output .= '<div class="wpsl-search clearfix' . $results_filter_class . '">' . "\r\n";
9
  $output .= '<div id="wpsl-search-wrap">' . "\r\n";
10
  $output .= '<div class="wpsl-input">' . "\r\n";
11
- $output .= '<label for="wpsl-search-input">' . esc_attr( $this->settings['search_label'] ) . '</label>' . "\r\n";
12
  $output .= '<input autocomplete="off" id="wpsl-search-input" type="text" value="" name="wpsl-search-input" />' . "\r\n";
13
  $output .= '</div>' . "\r\n";
14
  $output .= '<div class="wpsl-select-wrap">' . "\r\n";
15
  $output .= '<div id="wpsl-radius">' . "\r\n";
16
- $output .= '<label for="wpsl-radius-label">' . esc_attr( $this->settings['radius_label'] ).'</label>' . "\r\n";
17
  $output .= '<select autocomplete="off" id="wpsl-radius-label" class="wpsl-dropdown" name="wpsl-radius">' . "\r\n";
18
  $output .= $this->get_dropdown_list( 'search_radius' );
19
  $output .= '</select>' . "\r\n";
@@ -21,14 +21,14 @@ $output .= '</div>' . "\r\n";
21
 
22
  if ( $show_results_filter ) {
23
  $output .= '<div id="wpsl-results">' . "\r\n";
24
- $output .= '<label for="wpsl-results-label">' . esc_attr( $this->settings['results_label'] ) . '</label>' . "\r\n";
25
  $output .= '<select autocomplete="off" id="wpsl-results-label" class="wpsl-dropdown" name="wpsl-results">' . "\r\n";
26
  $output .= $this->get_dropdown_list( 'max_results' );
27
  $output .= '</select>' . "\r\n";
28
  $output .= '</div>' . "\r\n";
29
  }
30
 
31
- $output .= '<input id="wpsl-search-btn" type="submit" value='. esc_attr( $this->settings['search_btn_label'] ) . '>' . "\r\n";
32
  $output .= '</div>' . "\r\n";
33
  $output .= '</div>' . "\r\n";
34
  $output .= '</div>' . "\r\n";
5
  $results_filter_class = ( $show_results_filter ) ? '' : 'wpsl-no-results';
6
 
7
  $output .= '<div id="wpsl-wrap">' . "\r\n";
8
+ $output .= '<div class="wpsl-search clearfix ' . $results_filter_class . '">' . "\r\n";
9
  $output .= '<div id="wpsl-search-wrap">' . "\r\n";
10
  $output .= '<div class="wpsl-input">' . "\r\n";
11
+ $output .= '<div><label for="wpsl-search-input">' . esc_html( stripslashes( $this->settings['search_label'] ) ) . '</label></div>' . "\r\n";
12
  $output .= '<input autocomplete="off" id="wpsl-search-input" type="text" value="" name="wpsl-search-input" />' . "\r\n";
13
  $output .= '</div>' . "\r\n";
14
  $output .= '<div class="wpsl-select-wrap">' . "\r\n";
15
  $output .= '<div id="wpsl-radius">' . "\r\n";
16
+ $output .= '<label for="wpsl-radius-label">' . esc_html( stripslashes( $this->settings['radius_label'] ) ) . '</label>' . "\r\n";
17
  $output .= '<select autocomplete="off" id="wpsl-radius-label" class="wpsl-dropdown" name="wpsl-radius">' . "\r\n";
18
  $output .= $this->get_dropdown_list( 'search_radius' );
19
  $output .= '</select>' . "\r\n";
21
 
22
  if ( $show_results_filter ) {
23
  $output .= '<div id="wpsl-results">' . "\r\n";
24
+ $output .= '<label for="wpsl-results-label">' . esc_html( stripslashes( $this->settings['results_label'] ) ) . '</label>' . "\r\n";
25
  $output .= '<select autocomplete="off" id="wpsl-results-label" class="wpsl-dropdown" name="wpsl-results">' . "\r\n";
26
  $output .= $this->get_dropdown_list( 'max_results' );
27
  $output .= '</select>' . "\r\n";
28
  $output .= '</div>' . "\r\n";
29
  }
30
 
31
+ $output .= '<div><input id="wpsl-search-btn" type="submit" value='. esc_attr( stripslashes( $this->settings['search_btn_label'] ) ) . '></div>' . "\r\n";
32
  $output .= '</div>' . "\r\n";
33
  $output .= '</div>' . "\r\n";
34
  $output .= '</div>' . "\r\n";
frontend/wpsl-ajax-functions.php CHANGED
@@ -18,7 +18,6 @@ function wpsl_store_search() {
18
 
19
  $options = get_option( 'wpsl_settings' );
20
  $distance_unit = ( $options['distance_unit'] == 'km' ) ? '6371' : '3959';
21
- $allowed_html = '';
22
 
23
  /* If no max results is set, we get the default value from the settings.
24
  * The only situation when it can be empty, is when the "Show the limit results dropdown"
@@ -43,7 +42,7 @@ function wpsl_store_search() {
43
  $max_results
44
  );
45
  } else {
46
- $sql_part = '';
47
  $placeholders = array(
48
  $_GET["lat"],
49
  $_GET["lng"],
@@ -78,20 +77,20 @@ function wpsl_store_search() {
78
  /* Sanitize the results before they are returned */
79
  $store_results[] = array (
80
  'id' => absint( $result[$k]->wpsl_id ),
81
- 'store' => wp_kses( stripslashes( $result[$k]->store ), $allowed_html ),
82
- 'street' => wp_kses( stripslashes( $result[$k]->street ), $allowed_html ),
83
- 'city' => wp_kses( stripslashes( $result[$k]->city ), $allowed_html ),
84
- 'state' => wp_kses( stripslashes( $result[$k]->state ), $allowed_html ),
85
- 'zip' => wp_kses( stripslashes( $result[$k]->zip ), $allowed_html ),
86
- 'country' => wp_kses( stripslashes( $result[$k]->country ), $allowed_html ),
87
  'distance' => $result[$k]->distance,
88
- 'lat' => wp_kses( $result[$k]->lat, $allowed_html ),
89
- 'lng' => wp_kses( $result[$k]->lng, $allowed_html ),
90
- 'description' => wpautop( wp_kses( stripslashes( $result[$k]->description ), $allowed_html ) ),
91
- 'phone' => wp_kses( stripslashes( $result[$k]->phone ), $allowed_html ),
92
- 'fax' => wp_kses( stripslashes( $result[$k]->fax ), $allowed_html ),
93
- 'email' => wp_kses( stripslashes( $result[$k]->email ), $allowed_html ),
94
- 'hours' => wpautop( wp_kses( stripslashes( $result[$k]->hours ), $allowed_html ) ),
95
  'url' => esc_url( $result[$k]->url ),
96
  'thumb' => esc_url( $result[$k]->thumb_src )
97
  );
18
 
19
  $options = get_option( 'wpsl_settings' );
20
  $distance_unit = ( $options['distance_unit'] == 'km' ) ? '6371' : '3959';
 
21
 
22
  /* If no max results is set, we get the default value from the settings.
23
  * The only situation when it can be empty, is when the "Show the limit results dropdown"
42
  $max_results
43
  );
44
  } else {
45
+ $sql_part = ' ORDER BY distance';
46
  $placeholders = array(
47
  $_GET["lat"],
48
  $_GET["lng"],
77
  /* Sanitize the results before they are returned */
78
  $store_results[] = array (
79
  'id' => absint( $result[$k]->wpsl_id ),
80
+ 'store' => sanitize_text_field( stripslashes( $result[$k]->store ) ),
81
+ 'street' => sanitize_text_field( stripslashes( $result[$k]->street ) ),
82
+ 'city' => sanitize_text_field( stripslashes( $result[$k]->city ) ),
83
+ 'state' => sanitize_text_field( stripslashes( $result[$k]->state ) ),
84
+ 'zip' => sanitize_text_field( stripslashes( $result[$k]->zip ) ),
85
+ 'country' => sanitize_text_field( stripslashes( $result[$k]->country ) ),
86
  'distance' => $result[$k]->distance,
87
+ 'lat' => $result[$k]->lat,
88
+ 'lng' => $result[$k]->lng,
89
+ 'description' => wpautop( strip_tags( stripslashes( $result[$k]->description ) ) ),
90
+ 'phone' => sanitize_text_field( stripslashes( $result[$k]->phone ) ),
91
+ 'fax' => sanitize_text_field( stripslashes( $result[$k]->fax ) ),
92
+ 'email' => sanitize_email( $result[$k]->email ),
93
+ 'hours' => wpautop( strip_tags( stripslashes( $result[$k]->hours ) ) ),
94
  'url' => esc_url( $result[$k]->url ),
95
  'thumb' => esc_url( $result[$k]->thumb_src )
96
  );
js/wpsl-gmap.js CHANGED
@@ -3,23 +3,24 @@ var geocoder, map, infowindow, directionsDisplay, directionsService, geolocation
3
  markersArray = [],
4
  mapDefaults = {},
5
  resetMap = false,
 
 
6
  autoLoad = wpslSettings.autoLoad,
7
  $selects = $( "#wpsl-search-wrap select" );
8
 
9
  /* Load Google Maps */
10
  function initializeGmap() {
11
  var myOptions, zoomControlPosition, zoomControlStyle,
12
- latLng, zoomTo, zoomLevel, mapType,
13
- startMarker = {},
14
  streetViewVisible = ( wpslSettings.streetView == 1 ) ? true : false;
15
 
16
  /* If no zoom location is defined, we show the entire world */
17
  if ( wpslSettings.zoomLatlng !== '' ) {
18
  latLng = wpslSettings.zoomLatlng.split( ',' );
19
- zoomTo = new google.maps.LatLng( latLng[0], latLng[1] );
20
  zoomLevel = parseInt( wpslSettings.zoomLevel );
21
  } else {
22
- zoomTo = new google.maps.LatLng( 0,0 );
23
  zoomLevel = 1;
24
  }
25
 
@@ -64,7 +65,7 @@ function initializeGmap() {
64
 
65
  myOptions = {
66
  zoom: zoomLevel,
67
- center: zoomTo,
68
  mapTypeId: mapType,
69
  mapTypeControl: false,
70
  panControl: false,
@@ -95,14 +96,12 @@ function initializeGmap() {
95
  }
96
 
97
  function showStores() {
98
- var latLng = wpslSettings.zoomLatlng.split( ',' ),
99
- zoomTo = new google.maps.LatLng( latLng[0], latLng[1] ),
100
- startMarker = {
101
  store: wpslLabels.startPoint
102
  };
103
 
104
- addMarker( zoomTo, 0, startMarker, true ); // This marker is the 'start location' marker. With a storeId of 0, no name and is draggable
105
- findStoreLocations( zoomTo, resetMap, autoLoad );
106
  }
107
 
108
  /* Check if Geolocation detection is supported. If there is an error / timeout with determining the users
@@ -168,9 +167,8 @@ $( "#wpsl-search-btn" ).on( "click", function() {
168
 
169
  /* Reset the map */
170
  $( "#wpsl-reset-map" ).on( "click", function() {
171
- var latLng;
172
- resetMap = true;
173
-
174
  /* When the start marker is dragged the autoload value is set to false.
175
  * So we need to check the correct value when the reset btn is pushed before reloading the stores.
176
  */
@@ -229,12 +227,7 @@ $( "#wpsl-result-list" ).on( "click", ".wpsl-back", function() {
229
  }
230
 
231
  fitBounds();
232
-
233
- /* After the markers are restored, the direction link has lost it's click handler. So we reinstate it. */
234
- $( ".wpsl-info-window" ).on( "click", ".wpsl-directions", function() {
235
- renderDirections( $(this) );
236
- return false;
237
- });
238
 
239
  $( ".wpsl-direction-before, .wpsl-direction-after" ).remove();
240
  $( "#wpsl-stores" ).show();
@@ -287,7 +280,7 @@ if ( wpslSettings.markerBounce == 1 ) {
287
 
288
  /* Let a single marker bounce */
289
  function letsBounce( storeId, status ) {
290
- var storeId, status, i, len, animation = '';
291
 
292
  if ( status == "start" ) {
293
  animation = google.maps.Animation.BOUNCE
@@ -371,7 +364,7 @@ function codeAddress() {
371
 
372
  /* Geocode the user input and set the returned zipcode in the input field */
373
  function reverseGeocode( latLng ) {
374
- var latLng, zipCode;
375
 
376
  geocoder.geocode( {'latLng': latLng}, function( response, status ) {
377
  if ( status == google.maps.GeocoderStatus.OK ) {
@@ -383,8 +376,8 @@ function reverseGeocode( latLng ) {
383
  } else {
384
  geocodeNotification( status );
385
  }
386
- }
387
- )};
388
 
389
  /* Filter out the zipcode from the response */
390
  function filterApiResponse( response ) {
@@ -405,8 +398,30 @@ function filterApiResponse( response ) {
405
  }
406
 
407
  function findStoreLocations( startLatLng, resetMap, autoLoad ) {
408
- var location,
409
- center = map.getCenter(),
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
410
  infoWindowData = {},
411
  storeData = "",
412
  draggable = false,
@@ -416,8 +431,12 @@ function findStoreLocations( startLatLng, resetMap, autoLoad ) {
416
  action: "store_search",
417
  lat: startLatLng.lat(),
418
  lng: startLatLng.lng()
 
 
 
 
419
  };
420
-
421
  /*
422
  * If we reset the map we use the default dropdown
423
  * values instead of the selected values
@@ -434,7 +453,7 @@ function findStoreLocations( startLatLng, resetMap, autoLoad ) {
434
  if ( autoLoad == 1 ) {
435
  ajaxData.autoload = 1 ;
436
  }
437
-
438
  /* Add the preloader */
439
  $storeList.empty().append( "<li class='wpsl-preloader'><img src='" + preloader + "'/><span>" + wpslLabels.preloader + "</span></li>" );
440
 
@@ -445,11 +464,13 @@ function findStoreLocations( startLatLng, resetMap, autoLoad ) {
445
 
446
  if ( response.success !== false ) {
447
  if ( response.length > 0 ) {
 
448
  $.each( response, function( index ) {
449
  infoWindowData = {
450
  store: response[index].store,
451
  street: response[index].street,
452
  city: response[index].city,
 
453
  state: response[index].state,
454
  zip: response[index].zip,
455
  description: response[index].description,
@@ -463,7 +484,7 @@ function findStoreLocations( startLatLng, resetMap, autoLoad ) {
463
 
464
  location = new google.maps.LatLng( response[index].lat, response[index].lng );
465
  addMarker( location, response[index].id, infoWindowData, draggable );
466
- storeData = storeData + storeHtml( response[index] );
467
  $("#wpsl-reset-map").show();
468
  });
469
 
@@ -471,15 +492,18 @@ function findStoreLocations( startLatLng, resetMap, autoLoad ) {
471
  $storeList.append( storeData );
472
 
473
  $( "#wpsl-result-list" ).on( "click", ".wpsl-directions", function() {
474
- renderDirections( $(this) );
475
- return false;
 
 
 
476
  });
477
-
 
478
  } else {
479
  $storeList.html( "<li class='no-results'>" + wpslLabels.noResults + "</li>" );
480
  }
481
 
482
- fitBounds();
483
  } else {
484
  alert( wpslLabels.generalError );
485
  }
@@ -496,9 +520,9 @@ function findStoreLocations( startLatLng, resetMap, autoLoad ) {
496
  zoomLevel : map.getZoom()
497
  };
498
  }
499
- }
500
-
501
- });
502
  }
503
 
504
  /* Add a new marker to the map based on the provided location (latlng) */
@@ -537,12 +561,9 @@ function addMarker( location, storeId, infoWindowData, draggable ) {
537
  } else {
538
  infowindow.setContent( wpslLabels.startPoint );
539
  }
540
- infowindow.open( map, marker );
541
 
542
- $( ".wpsl-info-window" ).on( "click", ".wpsl-directions", function() {
543
- renderDirections( $(this) );
544
- return false;
545
- });
546
  });
547
 
548
  /* Store the marker for later use */
@@ -558,10 +579,22 @@ function addMarker( location, storeId, infoWindowData, draggable ) {
558
  }
559
  }
560
 
 
 
 
 
 
 
 
 
 
 
 
561
  /* Create the data for the infowindows on Google Maps */
562
  function createInfoWindowHtml( infoWindowData, storeId ) {
563
- var storeHeader,
564
- newWindow = '',
 
565
  windowContent = "<div data-store-id='" + storeId + "' class='wpsl-info-window'>";
566
 
567
  /* Check if we need to turn the store name into a link or not */
@@ -597,15 +630,43 @@ function createInfoWindowHtml( infoWindowData, storeId ) {
597
  if ( ( typeof( infoWindowData.hours ) !== "undefined" ) && ( infoWindowData.hours !== "" ) ) {
598
  windowContent += "<div class='wpsl-store-hours'><strong>" + wpslLabels.hours + "</strong> " + infoWindowData.hours + "</div>";
599
  }
 
 
 
 
 
 
 
 
 
600
 
601
- windowContent += "<a class='wpsl-directions' href='#'>" + wpslLabels.directions + "</a>";
602
  windowContent += "</div>";
603
 
604
  return windowContent;
605
  }
606
 
607
- function storeHtml( response ) {
608
- var html, storeImg = "",
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
609
  id = response.id,
610
  store = response.store,
611
  street = response.street,
@@ -619,8 +680,12 @@ function storeHtml( response ) {
619
  if ( ( typeof( thumb ) !== "undefined" ) && ( thumb !== "" ) ) {
620
  storeImg = "<img class='wpsl-store-thumb' src='" + thumb + "' width='48' height='48' alt='" + store + "' />";
621
  }
622
-
623
- 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></div>" + distance + "<a class='wpsl-directions' href='#'>" + wpslLabels.directions + "</a></li>";
 
 
 
 
624
 
625
  return html;
626
  }
3
  markersArray = [],
4
  mapDefaults = {},
5
  resetMap = false,
6
+ startAddress,
7
+ startLatLng,
8
  autoLoad = wpslSettings.autoLoad,
9
  $selects = $( "#wpsl-search-wrap select" );
10
 
11
  /* Load Google Maps */
12
  function initializeGmap() {
13
  var myOptions, zoomControlPosition, zoomControlStyle,
14
+ latLng, zoomLevel, mapType,
 
15
  streetViewVisible = ( wpslSettings.streetView == 1 ) ? true : false;
16
 
17
  /* If no zoom location is defined, we show the entire world */
18
  if ( wpslSettings.zoomLatlng !== '' ) {
19
  latLng = wpslSettings.zoomLatlng.split( ',' );
20
+ startLatLng = new google.maps.LatLng( latLng[0], latLng[1] );
21
  zoomLevel = parseInt( wpslSettings.zoomLevel );
22
  } else {
23
+ startLatLng = new google.maps.LatLng( 0,0 );
24
  zoomLevel = 1;
25
  }
26
 
65
 
66
  myOptions = {
67
  zoom: zoomLevel,
68
+ center: startLatLng,
69
  mapTypeId: mapType,
70
  mapTypeControl: false,
71
  panControl: false,
96
  }
97
 
98
  function showStores() {
99
+ var startMarker = {
 
 
100
  store: wpslLabels.startPoint
101
  };
102
 
103
+ addMarker( startLatLng, 0, startMarker, true ); // This marker is the 'start location' marker. With a storeId of 0, no name and is draggable
104
+ findStoreLocations( startLatLng, resetMap, autoLoad );
105
  }
106
 
107
  /* Check if Geolocation detection is supported. If there is an error / timeout with determining the users
167
 
168
  /* Reset the map */
169
  $( "#wpsl-reset-map" ).on( "click", function() {
170
+ var resetMap = true;
171
+
 
172
  /* When the start marker is dragged the autoload value is set to false.
173
  * So we need to check the correct value when the reset btn is pushed before reloading the stores.
174
  */
227
  }
228
 
229
  fitBounds();
230
+ infoWindowDirectionButton();
 
 
 
 
 
231
 
232
  $( ".wpsl-direction-before, .wpsl-direction-after" ).remove();
233
  $( "#wpsl-stores" ).show();
280
 
281
  /* Let a single marker bounce */
282
  function letsBounce( storeId, status ) {
283
+ var i, len, animation = '';
284
 
285
  if ( status == "start" ) {
286
  animation = google.maps.Animation.BOUNCE
364
 
365
  /* Geocode the user input and set the returned zipcode in the input field */
366
  function reverseGeocode( latLng ) {
367
+ var zipCode;
368
 
369
  geocoder.geocode( {'latLng': latLng}, function( response, status ) {
370
  if ( status == google.maps.GeocoderStatus.OK ) {
376
  } else {
377
  geocodeNotification( status );
378
  }
379
+ });
380
+ }
381
 
382
  /* Filter out the zipcode from the response */
383
  function filterApiResponse( response ) {
398
  }
399
 
400
  function findStoreLocations( startLatLng, resetMap, autoLoad ) {
401
+
402
+ /* Check if we need to open a new window and show the route on the Google Maps site itself. */
403
+ if ( wpslSettings.directionRedirect == 1 ) {
404
+ findFormattedAddress( startLatLng, function() {
405
+ makeAjaxRequest( startLatLng, resetMap, autoLoad );
406
+ });
407
+ } else {
408
+ makeAjaxRequest( startLatLng, resetMap, autoLoad );
409
+ }
410
+ }
411
+
412
+ /* The formatted address is used to build the url for the driving direction and send the user to maps.google.com */
413
+ function findFormattedAddress( latLng, callback ) {
414
+ geocoder.geocode( {'latLng': latLng}, function( response, status ) {
415
+ if ( status == google.maps.GeocoderStatus.OK ) {
416
+ startAddress = response[0].formatted_address;
417
+ callback();
418
+ } else {
419
+ geocodeNotification( status );
420
+ }
421
+ });
422
+ }
423
+ function makeAjaxRequest( startLatLng, resetMap, autoLoad ) {
424
+ var location,
425
  infoWindowData = {},
426
  storeData = "",
427
  draggable = false,
431
  action: "store_search",
432
  lat: startLatLng.lat(),
433
  lng: startLatLng.lng()
434
+ },
435
+ url = {
436
+ src : "#",
437
+ target : ""
438
  };
439
+
440
  /*
441
  * If we reset the map we use the default dropdown
442
  * values instead of the selected values
453
  if ( autoLoad == 1 ) {
454
  ajaxData.autoload = 1 ;
455
  }
456
+
457
  /* Add the preloader */
458
  $storeList.empty().append( "<li class='wpsl-preloader'><img src='" + preloader + "'/><span>" + wpslLabels.preloader + "</span></li>" );
459
 
464
 
465
  if ( response.success !== false ) {
466
  if ( response.length > 0 ) {
467
+
468
  $.each( response, function( index ) {
469
  infoWindowData = {
470
  store: response[index].store,
471
  street: response[index].street,
472
  city: response[index].city,
473
+ country: response[index].country,
474
  state: response[index].state,
475
  zip: response[index].zip,
476
  description: response[index].description,
484
 
485
  location = new google.maps.LatLng( response[index].lat, response[index].lng );
486
  addMarker( location, response[index].id, infoWindowData, draggable );
487
+ storeData = storeData + storeHtml( response[index], url );
488
  $("#wpsl-reset-map").show();
489
  });
490
 
492
  $storeList.append( storeData );
493
 
494
  $( "#wpsl-result-list" ).on( "click", ".wpsl-directions", function() {
495
+ /* Check if we need to disable the rendering of the direction on the map or not. */
496
+ if ( wpslSettings.directionRedirect != 1 ) {
497
+ renderDirections( $(this) );
498
+ return false;
499
+ }
500
  });
501
+
502
+ fitBounds();
503
  } else {
504
  $storeList.html( "<li class='no-results'>" + wpslLabels.noResults + "</li>" );
505
  }
506
 
 
507
  } else {
508
  alert( wpslLabels.generalError );
509
  }
520
  zoomLevel : map.getZoom()
521
  };
522
  }
523
+ }
524
+ });
525
+
526
  }
527
 
528
  /* Add a new marker to the map based on the provided location (latlng) */
561
  } else {
562
  infowindow.setContent( wpslLabels.startPoint );
563
  }
 
564
 
565
+ infowindow.open( map, marker );
566
+ infoWindowDirectionButton();
 
 
567
  });
568
 
569
  /* Store the marker for later use */
579
  }
580
  }
581
 
582
+ /* Activate the click listener for the direction buttons */
583
+ function infoWindowDirectionButton() {
584
+ $( ".wpsl-info-window" ).on( "click", ".wpsl-directions", function() {
585
+ /* Check if we need to disable the rendering of the direction on the map or not. */
586
+ if ( wpslSettings.directionRedirect != 1 ) {
587
+ renderDirections( $(this) );
588
+ return false;
589
+ }
590
+ });
591
+ }
592
+
593
  /* Create the data for the infowindows on Google Maps */
594
  function createInfoWindowHtml( infoWindowData, storeId ) {
595
+ var storeHeader,
596
+ url,
597
+ newWindow = "",
598
  windowContent = "<div data-store-id='" + storeId + "' class='wpsl-info-window'>";
599
 
600
  /* Check if we need to turn the store name into a link or not */
630
  if ( ( typeof( infoWindowData.hours ) !== "undefined" ) && ( infoWindowData.hours !== "" ) ) {
631
  windowContent += "<div class='wpsl-store-hours'><strong>" + wpslLabels.hours + "</strong> " + infoWindowData.hours + "</div>";
632
  }
633
+
634
+ if ( wpslSettings.directionRedirect == 1 ) {
635
+ url = createDirectionUrl( infoWindowData.street, infoWindowData.city, infoWindowData.zip, infoWindowData.country );
636
+ } else {
637
+ url = {
638
+ src : "#",
639
+ target : ""
640
+ };
641
+ }
642
 
643
+ windowContent += "<a class='wpsl-directions' " + url.target + " href='" + url.src + "'>" + wpslLabels.directions + "</a>";
644
  windowContent += "</div>";
645
 
646
  return windowContent;
647
  }
648
 
649
+ function createDirectionUrl( street, city, zip, country ) {
650
+ var destinationAddress, url;
651
+
652
+ /* If we somehow failed to determine the start address, just set it to empty */
653
+ if ( typeof( startAddress ) === 'undefined' ) {
654
+ startAddress = '';
655
+ }
656
+
657
+ destinationAddress = street + ', ' + city + ', ' + zip + ', ' + country;
658
+
659
+ url = {
660
+ src : "https://maps.google.com/maps?saddr=" + encodeURIComponent( startAddress ) + "&daddr=" + encodeURIComponent( destinationAddress ) + "",
661
+ target : "target='_blank'"
662
+ };
663
+
664
+ return url;
665
+ }
666
+
667
+ function storeHtml( response, url ) {
668
+ var html = "",
669
+ storeImg = "",
670
  id = response.id,
671
  store = response.store,
672
  street = response.street,
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
+ 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></div>" + distance + "<a class='wpsl-directions' " + url.target + " href='" + url.src + "'>" + wpslLabels.directions + "</a></li>";
689
 
690
  return html;
691
  }
readme.txt CHANGED
@@ -2,8 +2,8 @@
2
  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
6
- Stable tag: 1.1
7
  License: GPLv3
8
  License URI: http://www.gnu.org/licenses/gpl.html
9
 
@@ -24,6 +24,7 @@ the language that is set in the admin panel.
24
  * You can drag the marker to the exact spot on the 'Add Store' page
25
  * Show the driving distances in either km or miles
26
  * Choose from nine retina ready marker icons
 
27
  * Show Google Maps in different languages, this also influences the language for the driving directions
28
  * Show the driving directions to the stores
29
  * Users can filter the returned results by radius or max results
@@ -45,6 +46,15 @@ the language that is set in the admin panel.
45
 
46
  Add this shortcode [wpsl] to the page where you want to display the store locator.
47
 
 
 
 
 
 
 
 
 
 
48
  == Screenshots ==
49
 
50
  1. Front-end of the plugin
@@ -55,6 +65,15 @@ Add this shortcode [wpsl] to the page where you want to display the store locato
55
 
56
  == Changelog ==
57
 
 
 
 
 
 
 
 
 
 
58
  = 1.1 =
59
  * Added the option to open a link in a new window
60
  * Added the option to show a reset button that will reset the map back to how it was on page load
2
  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
 
24
  * You can drag the marker to the exact spot on the 'Add Store' page
25
  * Show the driving distances in either km or miles
26
  * Choose from nine retina ready marker icons
27
+ * Show the store listings either underneath the map, or next to it
28
  * Show Google Maps in different languages, this also influences the language for the driving directions
29
  * Show the driving directions to the stores
30
  * Users can filter the returned results by radius or max results
46
 
47
  Add this shortcode [wpsl] to the page where you want to display the store locator.
48
 
49
+ = The map doesn't display properly. It's either broken in half or doesn't load at all. =
50
+
51
+ Make sure you have defined a start point for the map under settings -> map settings
52
+
53
+ = I get an error saying the 'sensor' parameter specified in the request must be set to either 'true' or 'false' =
54
+
55
+ Make sure you don't have any security plugins, or custom functions running that strip away version numbers from file paths.
56
+
57
+
58
  == Screenshots ==
59
 
60
  1. Front-end of the plugin
65
 
66
  == Changelog ==
67
 
68
+ = 1.2 =
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
71
+ * Fixed a 'too much recursion' js error that showed up when no start location was defined
72
+ * Fixed the auto loading of stores not being ordered by distance
73
+ * Fixed a problem with the input fields not always aligning in Chrome
74
+ * Improved the handling of thumbnails. If the thumbnail format is disabled in the theme, it will look for the medium or full format instead
75
+ * Several other small code improvements
76
+
77
  = 1.1 =
78
  * Added the option to open a link in a new window
79
  * Added the option to show a reset button that will reset the map back to how it was on page load
uninstall.php CHANGED
@@ -6,11 +6,14 @@ if ( !defined( 'ABSPATH' ) && !defined( 'WP_UNINSTALL_PLUGIN ') ) {
6
  function wpsl_uninstall() {
7
 
8
  global $wpdb;
9
-
 
10
  $wpdb->query( 'DROP TABLE IF EXISTS ' . $wpdb->prefix . 'wpsl_stores' );
11
 
12
  delete_option( 'wpsl_version' );
13
  delete_option( 'wpsl_settings' );
 
 
14
 
15
  }
16
 
6
  function wpsl_uninstall() {
7
 
8
  global $wpdb;
9
+ global $current_user;
10
+
11
  $wpdb->query( 'DROP TABLE IF EXISTS ' . $wpdb->prefix . 'wpsl_stores' );
12
 
13
  delete_option( 'wpsl_version' );
14
  delete_option( 'wpsl_settings' );
15
+
16
+ delete_user_meta( $current_user->ID, 'wpsl_disable_location_warning' );
17
 
18
  }
19
 
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.1
9
  Text Domain: wpsl
10
  Domain Path: /languages/
11
  License: GPLv3
@@ -49,45 +49,47 @@ if ( !class_exists( 'WP_Store_locator' ) ) {
49
  * @var array
50
  */
51
  public $default_settings = array(
52
- 'api_key' => '',
53
- 'api_language' => 'en',
54
- 'api_region' => '',
55
- 'distance_unit' => 'km',
56
- 'max_results' => '(25),50,75,100',
57
- 'search_radius' => '10,25,(50),100,200,500',
58
- 'marker_bounce' => '1',
59
- 'auto_locate' => '1',
60
- 'auto_load' => '1',
61
- 'zoom_level' => '3',
62
- 'zoom_name' => '',
63
- 'zoom_latlng' => '',
64
- 'height' => '350',
65
- 'map_type' => 'roadmap',
66
- 'pan_controls' => '0',
67
- 'streetview' => '0',
68
- 'results_dropdown' => '1',
69
- 'infowindow_width' => '225',
70
- 'search_width' => '179',
71
- 'label_width' => '95',
72
- 'control_position' => 'left',
73
- 'control_style' => 'small',
74
- 'new_window' => '0',
75
- 'reset_option' => '0',
76
- 'start_marker' => 'red.png',
77
- 'store_marker' => 'blue.png',
78
- 'start_label' => 'Start location',
79
- 'search_label' => 'Your location',
80
- 'search_btn_label' => 'Search',
81
- 'preloader_label' => 'Searching...',
82
- 'radius_label' => 'Search radius',
83
- 'no_results_label' => 'No results found',
84
- 'results_label' => 'Results',
85
- 'directions_label' => 'Directions',
86
- 'error_label' => 'Something went wrong, please try again!',
87
- 'limit_label' => 'API usage limit reached',
88
- 'phone_label' => 'Phone',
89
- 'fax_label' => 'Fax',
90
- 'hours_label' => 'Hours'
 
 
91
  );
92
 
93
  /**
@@ -121,7 +123,7 @@ if ( !class_exists( 'WP_Store_locator' ) ) {
121
  public function define_constants() {
122
 
123
  if ( !defined( 'WPSL_VERSION_NUM' ) )
124
- define( 'WPSL_VERSION_NUM', '1.0' );
125
 
126
  if ( !defined( 'WPSL_URL' ) )
127
  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
9
  Text Domain: wpsl
10
  Domain Path: /languages/
11
  License: GPLv3
49
  * @var array
50
  */
51
  public $default_settings = array(
52
+ 'api_key' => '',
53
+ 'api_language' => 'en',
54
+ 'api_region' => '',
55
+ 'distance_unit' => 'km',
56
+ 'max_results' => '(25),50,75,100',
57
+ 'search_radius' => '10,25,(50),100,200,500',
58
+ 'marker_bounce' => '1',
59
+ 'auto_locate' => '1',
60
+ 'auto_load' => '1',
61
+ 'zoom_level' => '3',
62
+ 'zoom_name' => '',
63
+ 'zoom_latlng' => '',
64
+ 'height' => '350',
65
+ 'map_type' => 'roadmap',
66
+ 'pan_controls' => '0',
67
+ 'streetview' => '0',
68
+ 'results_dropdown' => '1',
69
+ 'infowindow_width' => '225',
70
+ 'search_width' => '179',
71
+ 'label_width' => '95',
72
+ 'control_position' => 'left',
73
+ 'control_style' => 'small',
74
+ 'new_window' => '0',
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',
81
+ 'search_label' => 'Your location',
82
+ 'search_btn_label' => 'Search',
83
+ 'preloader_label' => 'Searching...',
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',
90
+ 'phone_label' => 'Phone',
91
+ 'fax_label' => 'Fax',
92
+ 'hours_label' => 'Hours'
93
  );
94
 
95
  /**
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__ ) );