WP Store Locator - Version 2.1.1

Version Description

Download this release

Release Info

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

Code changes from version 2.1.0 to 2.1.1

admin/class-admin.php CHANGED
@@ -55,7 +55,7 @@ if ( !class_exists( 'WPSL_Admin' ) ) {
55
  add_action( 'wp_trash_post', array( $this, 'maybe_delete_autoload_transient' ) );
56
  add_action( 'untrash_post', array( $this, 'maybe_delete_autoload_transient' ) );
57
  add_action( 'admin_enqueue_scripts', array( $this, 'admin_scripts' ) );
58
-
59
  add_filter( 'plugin_action_links_' . WPSL_BASENAME, array( $this, 'add_action_links' ), 10, 2 );
60
  add_filter( 'admin_footer_text', array( $this, 'admin_footer_text' ), 1 );
61
  }
@@ -410,7 +410,7 @@ if ( !class_exists( 'WPSL_Admin' ) ) {
410
  }
411
 
412
  /**
413
- * Add action links to the plugin row.
414
  *
415
  * @since 2.0.0
416
  * @param array $links The existing action links
@@ -420,16 +420,35 @@ if ( !class_exists( 'WPSL_Admin' ) ) {
420
  public function add_action_links( $links, $file ) {
421
 
422
  if ( strpos( $file, 'wp-store-locator.php' ) !== false ) {
423
- $documentation = '<a href="https://wpstorelocator.co/documentation" target="_blank">'. __( 'Documentation', 'wpsl' ).'</a>';
424
- array_unshift( $links, $documentation );
425
-
426
- $settings_link = '<a href="' . admin_url( 'edit.php?post_type=wpsl_stores&page=wpsl_settings' ) . '">' . __( 'General Settings', 'wpsl' ) . '</a>';
427
  array_unshift( $links, $settings_link );
428
  }
429
 
430
  return $links;
431
  }
432
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
433
  /**
434
  * Change the footer text on the settings page.
435
  *
55
  add_action( 'wp_trash_post', array( $this, 'maybe_delete_autoload_transient' ) );
56
  add_action( 'untrash_post', array( $this, 'maybe_delete_autoload_transient' ) );
57
  add_action( 'admin_enqueue_scripts', array( $this, 'admin_scripts' ) );
58
+ add_filter( 'plugin_row_meta', array( $this, 'add_plugin_meta_row' ), 10, 2 );
59
  add_filter( 'plugin_action_links_' . WPSL_BASENAME, array( $this, 'add_action_links' ), 10, 2 );
60
  add_filter( 'admin_footer_text', array( $this, 'admin_footer_text' ), 1 );
61
  }
410
  }
411
 
412
  /**
413
+ * Add link to the plugin action row.
414
  *
415
  * @since 2.0.0
416
  * @param array $links The existing action links
420
  public function add_action_links( $links, $file ) {
421
 
422
  if ( strpos( $file, 'wp-store-locator.php' ) !== false ) {
423
+ $settings_link = '<a href="' . admin_url( 'edit.php?post_type=wpsl_stores&page=wpsl_settings' ) . '" title="View WP Store Locator Settings">' . __( 'Settings', 'wpsl' ) . '</a>';
 
 
 
424
  array_unshift( $links, $settings_link );
425
  }
426
 
427
  return $links;
428
  }
429
 
430
+ /**
431
+ * Add links to the plugin meta row.
432
+ *
433
+ * @since 2.1.1
434
+ * @param array $links The existing meta links
435
+ * @param string $file The file path of the current plugin
436
+ * @return array $links The modified meta links
437
+ */
438
+ public function add_plugin_meta_row( $links, $file ) {
439
+
440
+ if ( strpos( $file, 'wp-store-locator.php' ) !== false ) {
441
+ $new_links = array(
442
+ '<a href="https://wpstorelocator.co/documentation/" title="View Documentation">'. __( 'Documentation', 'wpsl' ).'</a>',
443
+ '<a href="https://wpstorelocator.co/add-ons/" title="View Add-Ons">'. __( 'Add-Ons', 'wpsl' ).'</a>'
444
+ );
445
+
446
+ $links = array_merge( $links, $new_links );
447
+ }
448
+
449
+ return $links;
450
+ }
451
+
452
  /**
453
  * Change the footer text on the settings page.
454
  *
admin/class-geocode.php CHANGED
@@ -32,7 +32,12 @@ if ( !class_exists( 'WPSL_Geocode' ) ) {
32
 
33
  // If we don't have a valid latlng value, we geocode the supplied address to get one.
34
  if ( !$latlng ) {
35
- $response = $this->geocode_location( $post_id, $store_data );
 
 
 
 
 
36
  $location_data['country_iso'] = $response['country_iso'];
37
  $location_data['latlng'] = $response['latlng'];
38
  } else {
@@ -122,8 +127,7 @@ if ( !class_exists( 'WPSL_Geocode' ) ) {
122
  public function get_latlng( $store_data ) {
123
 
124
  $address = $this->create_geocode_address( $store_data );
125
- $url = 'https://maps.googleapis.com/maps/api/geocode/json?address=' . urlencode( $address ) . wpsl_get_gmap_api_params( true );
126
- $response = wp_remote_get( $url );
127
 
128
  if ( is_wp_error( $response ) ) {
129
  $geo_response = sprintf( __( 'Something went wrong connecting to the Google Geocode API: %s %s Please try again later.', 'wpsl' ), $response->get_error_message(), '<br><br>' );
32
 
33
  // If we don't have a valid latlng value, we geocode the supplied address to get one.
34
  if ( !$latlng ) {
35
+ $response = $this->geocode_location( $post_id, $store_data );
36
+
37
+ if ( empty( $response ) ) {
38
+ return;
39
+ }
40
+
41
  $location_data['country_iso'] = $response['country_iso'];
42
  $location_data['latlng'] = $response['latlng'];
43
  } else {
127
  public function get_latlng( $store_data ) {
128
 
129
  $address = $this->create_geocode_address( $store_data );
130
+ $response = wpsl_call_geocode_api( $address );
 
131
 
132
  if ( is_wp_error( $response ) ) {
133
  $geo_response = sprintf( __( 'Something went wrong connecting to the Google Geocode API: %s %s Please try again later.', 'wpsl' ), $response->get_error_message(), '<br><br>' );
admin/class-metaboxes.php CHANGED
@@ -331,6 +331,26 @@ if ( !class_exists( 'WPSL_Metaboxes' ) ) {
331
  <?php
332
  }
333
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
334
  /**
335
  * Create a checkbox field.
336
  *
@@ -647,6 +667,7 @@ if ( !class_exists( 'WPSL_Metaboxes' ) ) {
647
  $checkbox_val = ( isset( $this->store_data[ $field_key ] ) ) ? 1 : 0;
648
  update_post_meta( $post_id, 'wpsl_' . $field_key, $checkbox_val );
649
  break;
 
650
  case 'textarea':
651
  update_post_meta( $post_id, 'wpsl_' . $field_key, wp_kses_post( trim( stripslashes( $this->store_data[ $field_key ] ) ) ) );
652
  break;
331
  <?php
332
  }
333
 
334
+ /**
335
+ * Create a wp editor field.
336
+ *
337
+ * @since 2.1.1
338
+ * @param array $args The wp editor name and label
339
+ * @return void
340
+ */
341
+ public function wp_editor_input( $args ) {
342
+
343
+ $saved_value = $this->get_store_meta( $args['key'] );
344
+ ?>
345
+
346
+ <p>
347
+ <label for="wpsl-<?php echo esc_attr( $args['key'] ); ?>"><?php echo esc_html( $args['data']['label'] ) . ': ' . $this->is_required_field( $args['data'] ); ?></label>
348
+ <?php wp_editor( $saved_value, 'wpsleditor', $settings = array('textarea_name' => 'wpsl['. esc_attr( $args['key'] ).']') ); ?>
349
+ </p>
350
+
351
+ <?php
352
+ }
353
+
354
  /**
355
  * Create a checkbox field.
356
  *
667
  $checkbox_val = ( isset( $this->store_data[ $field_key ] ) ) ? 1 : 0;
668
  update_post_meta( $post_id, 'wpsl_' . $field_key, $checkbox_val );
669
  break;
670
+ case 'wp_editor':
671
  case 'textarea':
672
  update_post_meta( $post_id, 'wpsl_' . $field_key, wp_kses_post( trim( stripslashes( $this->store_data[ $field_key ] ) ) ) );
673
  break;
admin/templates/map-settings.php CHANGED
@@ -11,10 +11,10 @@ global $wpdb, $wpsl, $wpsl_admin, $wp_version, $wpsl_settings;
11
  <h2>WP Store Locator <?php _e( 'Settings', 'wpsl' ); ?></h2>
12
  <?php
13
  settings_errors();
14
-
15
  $current_tab = isset( $_GET['tab'] ) ? $_GET['tab'] : '';
16
  $wpsl_licenses = apply_filters( 'wpsl_license_settings', array() );
17
-
18
  if ( $wpsl_licenses ) {
19
  $tabs = array( 'general', 'licenses' );
20
 
@@ -81,6 +81,7 @@ global $wpdb, $wpsl, $wpsl_admin, $wp_version, $wpsl_settings;
81
  </form>
82
  <?php
83
  } else {
 
84
  ?>
85
 
86
  <div id="general">
11
  <h2>WP Store Locator <?php _e( 'Settings', 'wpsl' ); ?></h2>
12
  <?php
13
  settings_errors();
14
+
15
  $current_tab = isset( $_GET['tab'] ) ? $_GET['tab'] : '';
16
  $wpsl_licenses = apply_filters( 'wpsl_license_settings', array() );
17
+
18
  if ( $wpsl_licenses ) {
19
  $tabs = array( 'general', 'licenses' );
20
 
81
  </form>
82
  <?php
83
  } else {
84
+ //@todo add server / browser key fields for the Geocode API.
85
  ?>
86
 
87
  <div id="general">
css/styles.css CHANGED
@@ -312,6 +312,21 @@ div elements, we disable it to prevent it from messing up the map
312
  text-indent: 0;
313
  }
314
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
315
  #wpsl-wrap.wpsl-store-below #wpsl-result-list li {
316
  padding: 10px 10px 10px 0;
317
  }
312
  text-indent: 0;
313
  }
314
 
315
+ #wpsl-wrap #wpsl-result-list li li {
316
+ padding: 0;
317
+ border-bottom: 0;
318
+ margin-left: 14px;
319
+ overflow: visible;
320
+ }
321
+
322
+ #wpsl-wrap #wpsl-result-list ul li {
323
+ list-style: disc !important;
324
+ }
325
+
326
+ #wpsl-wrap #wpsl-result-list ol li {
327
+ list-style: decimal !important;
328
+ }
329
+
330
  #wpsl-wrap.wpsl-store-below #wpsl-result-list li {
331
  padding: 10px 10px 10px 0;
332
  }
css/styles.min.css CHANGED
@@ -1 +1 @@
1
- #wpsl-wrap,.wpsl-gmap-canvas{margin-bottom:20px;width:100%}#wpsl-result-list a,#wpsl-wrap [class*=" wpsl-icon-"]:focus,#wpsl-wrap [class^=wpsl-icon-]:active{outline:0}#wpsl-map-controls div:hover,#wpsl-reset-map:hover,#wpsl-search-btn:hover,.wpsl-dropdown{cursor:pointer}#wpsl-wrap,.wpsl-clearfix:after,.wpsl-contact-details{clear:both}@font-face{font-family:wpsl-fontello;src:url(../font/fontello.eot?28897909);src:url(../font/fontello.eot?28897909#iefix) format('embedded-opentype'),url(../font/fontello.woff?28897909) format('woff'),url(../font/fontello.ttf?28897909) format('truetype'),url(../font/fontello.svg?28897909#fontello) format('svg');font-weight:400;font-style:normal}#wpsl-gmap{float:right;width:66.5%;height:350px;margin-bottom:0}.wpsl-store-below #wpsl-gmap{float:none;width:100%}.wpsl-gmap-canvas{height:300px}.gm-style-mtc,.gmnoprint{z-index:9999!important}#wpsl-gmap div,#wpsl-gmap img,.wpsl-gmap-canvas div,.wpsl-gmap-canvas img{box-shadow:none!important;max-width:none!important;background:0 0}#wpsl-gmap img,.wpsl-gmap-canvas img{display:inline!important;opacity:1!important;max-height:none!important}#wpsl-wrap{overflow:hidden}#wpsl-search-wrap{float:left;width:100%}#wpsl-gmap #wpsl-map-controls{position:absolute;height:28px;right:10px;bottom:24px;border-radius:2px;z-index:3;font-size:11px;white-space:nowrap;overflow:hidden}#wpsl-gmap #wpsl-map-controls.wpsl-street-view-exists{right:48px}#wpsl-map-controls .wpsl-direction-preloader{margin:5px 5px 0}#wpsl-map-controls div{float:left;background:#fff;border-radius:2px}#wpsl-wrap [class*=" wpsl-icon-"],#wpsl-wrap [class^=wpsl-icon-]{position:relative;float:left;padding:7px 9px 7px 8px;display:inline-block;font-family:wpsl-fontello;font-style:normal;font-weight:400;font-size:1.3em;color:#737373;speak:none;text-decoration:inherit;text-align:center;font-variant:normal;text-transform:none;line-height:1em;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}#wpsl-map-controls span{font-family:inherit;font-size:inherit}#wpsl-wrap .wpsl-ie [class*=" wpsl-icon-"],#wpsl-wrap .wpsl-ie [class^=wpsl-icon-]{padding:9px 8px 4px}#wpsl-wrap.wpsl-mobile [class*=" wpsl-icon-"],#wpsl-wrap.wpsl-mobile [class^=wpsl-icon-]{padding:8px 10px}#wpsl-wrap .wpsl-icon-reset{border-radius:2px 0 0 2px;z-index:2;padding-left:9px;padding-right:4px}#wpsl-wrap .wpsl-icon-direction{z-index:1}#wpsl-map-controls.wpsl-reset-exists .wpsl-icon-direction{border-radius:0 2px 2px 0}#wpsl-wrap .wpsl-active-icon,#wpsl-wrap [class*=" wpsl-icon-"]:hover,#wpsl-wrap [class^=wpsl-icon-]:hover{color:#000}#wpsl-wrap .wpsl-in-progress,#wpsl-wrap .wpsl-in-progress:hover{color:#c6c6c6}#wpsl-gmap #wpsl-reset-map{position:absolute;display:none;right:37px;top:37px;padding:6px 14px;background:#fff!important;background-clip:padding-box;border:1px solid rgba(0,0,0,.15);border-radius:2px;z-index:3}.gm-style-cc{word-wrap:normal}#wpsl-search-wrap .wpsl-input,#wpsl-search-wrap .wpsl-select-wrap{display:table}#wpsl-search-btn,#wpsl-search-wrap #wpsl-radius,#wpsl-search-wrap #wpsl-results,#wpsl-search-wrap .wpsl-input input,#wpsl-search-wrap .wpsl-input label{display:table-cell}#wpsl-search-wrap label{margin-bottom:0}#wpsl-search-input{width:179px;height:auto;padding:7px 12px;font-size:100%;margin:0}#wpsl-search-btn,#wpsl-search-wrap input{border:1px solid #d2d2d2;border-radius:3px}#wpsl-search-btn{padding:7px 10px;line-height:1.428571429;font-weight:400;color:#7c7c7c;background-color:#e6e6e6;background-repeat:repeat-x;background-image:-moz-linear-gradient(top,#f4f4f4,#e6e6e6);background-image:-ms-linear-gradient(top,#f4f4f4,#e6e6e6);background-image:-webkit-linear-gradient(top,#f4f4f4,#e6e6e6);background-image:-o-linear-gradient(top,#f4f4f4,#e6e6e6);background-image:linear-gradient(top,#f4f4f4,#e6e6e6);box-shadow:0 1px 2px rgba(64,64,64,.1);text-transform:none!important}#wpsl-search-input.wpsl-error{border:1px solid #bd0028!important}.wpsl-search{margin-bottom:12px;padding:12px 12px 0;background:#f4f3f3}.wpsl-back{display:inline-block}#wpsl-result-list{width:33%;margin-right:.5%}.wpsl-store-below #wpsl-result-list{width:100%;margin:12px 0 0}#wpsl-direction-details,#wpsl-stores{height:350px;overflow-y:auto}#wpsl-direction-details,.wpsl-hide{display:none}#wpsl-result-list p{padding-left:10px}.wpsl-store-below #wpsl-result-list p{padding-left:0}.wpsl-direction-before{margin:14px 0 21px;padding-left:10px}.wpsl-store-below .wpsl-direction-before{padding-left:0}.wpsl-direction-before div{margin-top:10px}#wpsl-wrap #wpsl-result-list li{padding:10px;border-bottom:1px dotted #ccc;margin-left:0;overflow:hidden;list-style:none!important;text-indent:0}#wpsl-wrap.wpsl-store-below #wpsl-result-list li{padding:10px 10px 10px 0}#wpsl-result-list li p{padding-left:0;margin:0 0 20px}.wpsl-store-details.wpsl-store-listing{position:relative;padding-right:20px}.wpsl-store-details.wpsl-store-listing.wpsl-active-details:before,.wpsl-store-details.wpsl-store-listing:before{position:absolute;content:'';bottom:6px;right:0;border-top:5px solid #000;border-left:6px solid transparent;border-right:6px solid transparent}.wpsl-store-details.wpsl-store-listing.wpsl-active-details:before{border-bottom:5px solid #000;border-top:none;border-left:6px solid transparent;border-right:6px solid transparent}#wpsl-stores .wpsl-store-thumb{float:right;border-radius:3px;margin:7px 0 0 10px;padding:0;border:none}.wpsl-direction-index{float:left;width:8%;margin:0 5% 0 0}.wpsl-direction-txt{float:left;width:62%}.wpsl-direction-distance{float:left;width:20%;margin:0 0 0 5%}.wpsl-direction-txt span{display:block;margin-top:10px}.wpsl-country,.wpsl-directions,.wpsl-street{display:block;border-bottom:none!important}#wpsl-wrap #wpsl-result-list li.wpsl-preloader{position:relative;border-bottom:none;padding:10px 10px 10px 35px}.wpsl-preloader img{position:absolute;left:10px;top:50%;margin-top:-8px;box-shadow:none!important;border:none!important}.wpsl-preloader span{float:left;margin:-5px 0 0 11px}#wpsl-search-btn,#wpsl-search-wrap div{margin-right:10px;float:left}#wpsl-search-wrap .wpsl-select-wrap{position:relative;z-index:2;margin-right:0}#wpsl-search-wrap .wpsl-input-field{position:relative}#wpsl-radius,#wpsl-results{float:left;margin-right:15px;display:inline}#wpsl-category{z-index:1;clear:both}#wpsl-search-wrap .wpsl-dropdown div{position:absolute;float:none;margin:-1px 0 0;top:100%;left:-1px;right:-1px;border:1px solid #ccc;background:#fff;border-top:1px solid #eee;border-radius:0 0 3px 3px;opacity:0;overflow:hidden;-webkit-transition:all 150ms ease-in-out;-moz-transition:all 150ms ease-in-out;-ms-transition:all 150ms ease-in-out;transition:all 150ms ease-in-out}#wpsl-search-wrap .wpsl-dropdown.wpsl-active div{opacity:1}#wpsl-search-wrap .wpsl-input label{margin-right:0}#wpsl-radius{margin-right:10px}#wpsl-search select,#wpsl-search-wrap select,.wpsl-direction-details{display:none}#wpsl-search-wrap div label{float:left;margin-right:10px;line-height:32px}#wpsl-results label{width:auto}#wpsl-result-list ul{list-style:none;margin:0;padding:0}#wpsl-gmap .wpsl-info-window,.wpsl-gmap-canvas .wpsl-info-window{max-width:225px}.wpsl-info-window span,.wpsl-more-info-listings span{display:block}.wpsl-info-window .wpsl-no-margin{margin:0}.wpsl-more-info-listings{display:none}.wpsl-info-window span span{display:inline!important}#wpsl-wrap .wpsl-info-window p{margin:0 0 10px}.wpsl-store-hours{margin-top:10px}.wpsl-store-hours strong{display:block}#wpsl-gmap .wpsl-info-actions{display:block;margin:10px 0!important}.wpsl-info-actions a{float:left;margin-right:7px}.wpsl-info-actions .wpsl-zoom-here{margin-right:0}.wpsl-dropdown{position:relative;width:90px;border:1px solid #ccc;background:#fff;border-radius:3px;-webkit-user-select:none;-moz-user-select:none;user-select:none;margin-right:0!important;z-index:2}#wpsl-results .wpsl-dropdown{width:70px}.wpsl-dropdown ul{position:absolute;left:0;width:100%;height:100%;padding:0!important;margin:0!important;list-style:none;overflow:hidden}.wpsl-dropdown:hover{box-shadow:0 0 5px rgba(0,0,0,.15)}.wpsl-dropdown .wpsl-selected-item,.wpsl-dropdown li{position:relative;display:block;line-height:1;color:#000;overflow:hidden;white-space:nowrap}.wpsl-selected-item:after{position:absolute;content:"";right:12px;top:50%;margin-top:-4px;border:6px solid transparent;border-top:8px solid #000}.wpsl-active .wpsl-selected-item:after{margin-top:-10px;border:6px solid transparent;border-bottom:8px solid #000}.wpsl-dropdown li:hover{background:#f8f9f8;position:relative;z-index:3;color:#000}.wpsl-dropdown .wpsl-selected-item,.wpsl-dropdown li,.wpsl-selected-item{list-style:none;padding:9px 12px!important;margin:0!important}.wpsl-selected-dropdown{font-weight:700}.wpsl-clearfix:after,.wpsl-clearfix:before{content:" ";display:table}#wpsl-wrap .wpsl-selected-item{position:static;padding-right:35px!important}#wpsl-category,.wpsl-input,.wpsl-select-wrap{position:relative;margin-bottom:10px}.wpsl-provided-by{float:right;padding:5px 0;text-align:right;font-size:12px;width:100%}#wpsl-wrap .wpsl-results-only label{width:auto}.wpsl-contact-details,.wpsl-location-address,.wpsl-locations-details{margin-bottom:15px}table.wpsl-opening-hours td{vertical-align:top;padding:0 15px 0 0;text-align:left}table.wpsl-opening-hours time{display:block}table.wpsl-opening-hours{width:auto!important;font-size:100%!important}table.wpsl-opening-hours,table.wpsl-opening-hours td{border:none!important}.wpsl-gmap-canvas .wpsl-infobox{min-width:155px;max-width:350px!important;padding:10px;border-radius:4px;font-size:13px;font-weight:300;border:1px solid #ccc;background:#fff!important}.wpsl-gmap-canvas .wpsl-infobox:after,.wpsl-gmap-canvas .wpsl-infobox:before{position:absolute;content:"";left:40px;bottom:-11px}.wpsl-gmap-canvas .wpsl-infobox:after{border-left:11px solid transparent;border-right:11px solid transparent;border-top:11px solid #fff}.wpsl-gmap-canvas .wpsl-infobox:before{border-left:13px solid transparent;border-right:13px solid transparent;border-top:13px solid #ccc;bottom:-13px;left:38px}@media (max-width:825px){#wpsl-search-input{width:348px}.wpsl-results-only #wpsl-search-wrap .wpsl-dropdown{width:70px}#wpsl-search-wrap .wpsl-input{width:100%;margin-bottom:10px}#wpsl-category label,#wpsl-radius label,.wpsl-cat-results-filter #wpsl-search-wrap .wpsl-input,.wpsl-input label,.wpsl-no-filters #wpsl-search-wrap .wpsl-input,.wpsl-results-only #wpsl-search-wrap .wpsl-input{width:auto}}@media (max-width:720px){#wpsl-search-wrap .wpsl-dropdown{width:114px}}@media (max-width:675px){#wpsl-search-wrap #wpsl-search-btn{float:left;margin:0 5px 0 0}.wpsl-dropdown,.wpsl-results-only #wpsl-search-wrap .wpsl-input{width:100%}.wpsl-search{padding:2%}#wpsl-result-list p,#wpsl-wrap #wpsl-result-list li,.wpsl-direction-before{padding-left:0}.wpsl-input{margin-right:0}#wpsl-gmap,#wpsl-result-list{float:none;width:100%}#wpsl-gmap{margin-bottom:15px;margin-top:10px}#wpsl-result-list,.wpsl-cat-results-filter .wpsl-select-wrap,.wpsl-filter .wpsl-select-wrap{margin-bottom:10px}#wpsl-wrap #wpsl-result-list li.wpsl-preloader{padding-left:25px}.wpsl-preloader img{left:0}#wpsl-stores.wpsl-not-loaded{height:25px}#wpsl-reset-map{top:25px}#wpsl-category,#wpsl-search-btn,.wpsl-input,.wpsl-no-filters #wpsl-search-wrap .wpsl-input,.wpsl-select-wrap{margin-bottom:0}#wpsl-stores.wpsl-no-autoload{height:auto!important}}@media (max-width:570px){#wpsl-search-wrap #wpsl-search-btn{margin-bottom:5px}.wpsl-search{padding:4%}#wpsl-search-input{width:98%!important}.wpsl-cat-results-filter #wpsl-search-input,.wpsl-cat-results-filter #wpsl-search-wrap .wpsl-input,.wpsl-no-results #wpsl-search-input,.wpsl-results-only #wpsl-search-input{width:100%!important}.wpsl-search-btn-wrap{margin-top:15px;clear:both}#wpsl-search-btn,#wpsl-search-wrap div{margin-right:0}#wpsl-search-wrap div label{display:block;width:100%}.wpsl-select-wrap{width:100%}#wpsl-radius,#wpsl-results{width:50%}#wpsl-radius{margin-right:4%}#wpsl-search-wrap .wpsl-dropdown{width:96%!important}.wpsl-no-filters #wpsl-search-input,.wpsl-no-filters #wpsl-search-wrap .wpsl-input{width:100%!important}}
1
+ #wpsl-wrap,.wpsl-gmap-canvas{margin-bottom:20px;width:100%}#wpsl-result-list a,#wpsl-wrap [class*=" wpsl-icon-"]:focus,#wpsl-wrap [class^=wpsl-icon-]:active{outline:0}#wpsl-map-controls div:hover,#wpsl-reset-map:hover,#wpsl-search-btn:hover,.wpsl-dropdown{cursor:pointer}#wpsl-wrap,.wpsl-clearfix:after,.wpsl-contact-details{clear:both}@font-face{font-family:wpsl-fontello;src:url(../font/fontello.eot?28897909);src:url(../font/fontello.eot?28897909#iefix) format('embedded-opentype'),url(../font/fontello.woff?28897909) format('woff'),url(../font/fontello.ttf?28897909) format('truetype'),url(../font/fontello.svg?28897909#fontello) format('svg');font-weight:400;font-style:normal}#wpsl-gmap{float:right;width:66.5%;height:350px;margin-bottom:0}.wpsl-store-below #wpsl-gmap{float:none;width:100%}.wpsl-gmap-canvas{height:300px}.gm-style-mtc,.gmnoprint{z-index:9999!important}#wpsl-gmap div,#wpsl-gmap img,.wpsl-gmap-canvas div,.wpsl-gmap-canvas img{box-shadow:none!important;max-width:none!important;background:0 0}#wpsl-gmap img,.wpsl-gmap-canvas img{display:inline!important;opacity:1!important;max-height:none!important}#wpsl-wrap{overflow:hidden}#wpsl-search-wrap{float:left;width:100%}#wpsl-gmap #wpsl-map-controls{position:absolute;height:28px;right:10px;bottom:24px;border-radius:2px;z-index:3;font-size:11px;white-space:nowrap;overflow:hidden}#wpsl-gmap #wpsl-map-controls.wpsl-street-view-exists{right:48px}#wpsl-map-controls .wpsl-direction-preloader{margin:5px 5px 0}#wpsl-map-controls div{float:left;background:#fff;border-radius:2px}#wpsl-wrap [class*=" wpsl-icon-"],#wpsl-wrap [class^=wpsl-icon-]{position:relative;float:left;padding:7px 9px 7px 8px;display:inline-block;font-family:wpsl-fontello;font-style:normal;font-weight:400;font-size:1.3em;color:#737373;speak:none;text-decoration:inherit;text-align:center;font-variant:normal;text-transform:none;line-height:1em;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}#wpsl-map-controls span{font-family:inherit;font-size:inherit}#wpsl-wrap .wpsl-ie [class*=" wpsl-icon-"],#wpsl-wrap .wpsl-ie [class^=wpsl-icon-]{padding:9px 8px 4px}#wpsl-wrap.wpsl-mobile [class*=" wpsl-icon-"],#wpsl-wrap.wpsl-mobile [class^=wpsl-icon-]{padding:8px 10px}#wpsl-wrap .wpsl-icon-reset{border-radius:2px 0 0 2px;z-index:2;padding-left:9px;padding-right:4px}#wpsl-wrap .wpsl-icon-direction{z-index:1}#wpsl-map-controls.wpsl-reset-exists .wpsl-icon-direction{border-radius:0 2px 2px 0}#wpsl-wrap .wpsl-active-icon,#wpsl-wrap [class*=" wpsl-icon-"]:hover,#wpsl-wrap [class^=wpsl-icon-]:hover{color:#000}#wpsl-wrap .wpsl-in-progress,#wpsl-wrap .wpsl-in-progress:hover{color:#c6c6c6}#wpsl-gmap #wpsl-reset-map{position:absolute;display:none;right:37px;top:37px;padding:6px 14px;background:#fff!important;background-clip:padding-box;border:1px solid rgba(0,0,0,.15);border-radius:2px;z-index:3}.gm-style-cc{word-wrap:normal}#wpsl-search-wrap .wpsl-input,#wpsl-search-wrap .wpsl-select-wrap{display:table}#wpsl-search-btn,#wpsl-search-wrap #wpsl-radius,#wpsl-search-wrap #wpsl-results,#wpsl-search-wrap .wpsl-input input,#wpsl-search-wrap .wpsl-input label{display:table-cell}#wpsl-search-wrap label{margin-bottom:0}#wpsl-search-input{width:179px;height:auto;padding:7px 12px;font-size:100%;margin:0}#wpsl-search-btn,#wpsl-search-wrap input{border:1px solid #d2d2d2;border-radius:3px}#wpsl-search-btn{padding:7px 10px;line-height:1.428571429;font-weight:400;color:#7c7c7c;background-color:#e6e6e6;background-repeat:repeat-x;background-image:-moz-linear-gradient(top,#f4f4f4,#e6e6e6);background-image:-ms-linear-gradient(top,#f4f4f4,#e6e6e6);background-image:-webkit-linear-gradient(top,#f4f4f4,#e6e6e6);background-image:-o-linear-gradient(top,#f4f4f4,#e6e6e6);background-image:linear-gradient(top,#f4f4f4,#e6e6e6);box-shadow:0 1px 2px rgba(64,64,64,.1);text-transform:none!important}#wpsl-search-input.wpsl-error{border:1px solid #bd0028!important}.wpsl-search{margin-bottom:12px;padding:12px 12px 0;background:#f4f3f3}.wpsl-back{display:inline-block}#wpsl-result-list{width:33%;margin-right:.5%}.wpsl-store-below #wpsl-result-list{width:100%;margin:12px 0 0}#wpsl-direction-details,#wpsl-stores{height:350px;overflow-y:auto}#wpsl-direction-details,.wpsl-hide{display:none}#wpsl-result-list p{padding-left:10px}.wpsl-store-below #wpsl-result-list p{padding-left:0}.wpsl-direction-before{margin:14px 0 21px;padding-left:10px}.wpsl-store-below .wpsl-direction-before{padding-left:0}.wpsl-direction-before div{margin-top:10px}#wpsl-wrap #wpsl-result-list li{padding:10px;border-bottom:1px dotted #ccc;margin-left:0;overflow:hidden;list-style:none!important;text-indent:0}#wpsl-wrap #wpsl-result-list li li{padding:0;border-bottom:0;margin-left:14px;overflow:visible}#wpsl-wrap #wpsl-result-list ul li{list-style:disc!important}#wpsl-wrap #wpsl-result-list ol li{list-style:decimal!important}#wpsl-wrap.wpsl-store-below #wpsl-result-list li{padding:10px 10px 10px 0}#wpsl-result-list li p{padding-left:0;margin:0 0 20px}.wpsl-store-details.wpsl-store-listing{position:relative;padding-right:20px}.wpsl-store-details.wpsl-store-listing.wpsl-active-details:before,.wpsl-store-details.wpsl-store-listing:before{position:absolute;content:'';bottom:6px;right:0;border-top:5px solid #000;border-left:6px solid transparent;border-right:6px solid transparent}.wpsl-store-details.wpsl-store-listing.wpsl-active-details:before{border-bottom:5px solid #000;border-top:none;border-left:6px solid transparent;border-right:6px solid transparent}#wpsl-stores .wpsl-store-thumb{float:right;border-radius:3px;margin:7px 0 0 10px;padding:0;border:none}.wpsl-direction-index{float:left;width:8%;margin:0 5% 0 0}.wpsl-direction-txt{float:left;width:62%}.wpsl-direction-distance{float:left;width:20%;margin:0 0 0 5%}.wpsl-direction-txt span{display:block;margin-top:10px}.wpsl-country,.wpsl-directions,.wpsl-street{display:block;border-bottom:none!important}#wpsl-wrap #wpsl-result-list li.wpsl-preloader{position:relative;border-bottom:none;padding:10px 10px 10px 35px}.wpsl-preloader img{position:absolute;left:10px;top:50%;margin-top:-8px;box-shadow:none!important;border:none!important}.wpsl-preloader span{float:left;margin:-5px 0 0 11px}#wpsl-search-btn,#wpsl-search-wrap div{margin-right:10px;float:left}#wpsl-search-wrap .wpsl-select-wrap{position:relative;z-index:2;margin-right:0}#wpsl-search-wrap .wpsl-input-field{position:relative}#wpsl-radius,#wpsl-results{float:left;margin-right:15px;display:inline}#wpsl-category{z-index:1;clear:both}#wpsl-search-wrap .wpsl-dropdown div{position:absolute;float:none;margin:-1px 0 0;top:100%;left:-1px;right:-1px;border:1px solid #ccc;background:#fff;border-top:1px solid #eee;border-radius:0 0 3px 3px;opacity:0;overflow:hidden;-webkit-transition:all 150ms ease-in-out;-moz-transition:all 150ms ease-in-out;-ms-transition:all 150ms ease-in-out;transition:all 150ms ease-in-out}#wpsl-search-wrap .wpsl-dropdown.wpsl-active div{opacity:1}#wpsl-search-wrap .wpsl-input label{margin-right:0}#wpsl-radius{margin-right:10px}#wpsl-search select,#wpsl-search-wrap select,.wpsl-direction-details{display:none}#wpsl-search-wrap div label{float:left;margin-right:10px;line-height:32px}#wpsl-results label{width:auto}#wpsl-result-list ul{list-style:none;margin:0;padding:0}#wpsl-gmap .wpsl-info-window,.wpsl-gmap-canvas .wpsl-info-window{max-width:225px}.wpsl-info-window span,.wpsl-more-info-listings span{display:block}.wpsl-info-window .wpsl-no-margin{margin:0}.wpsl-more-info-listings{display:none}.wpsl-info-window span span{display:inline!important}#wpsl-wrap .wpsl-info-window p{margin:0 0 10px}.wpsl-store-hours{margin-top:10px}.wpsl-store-hours strong{display:block}#wpsl-gmap .wpsl-info-actions{display:block;margin:10px 0!important}.wpsl-info-actions a{float:left;margin-right:7px}.wpsl-info-actions .wpsl-zoom-here{margin-right:0}.wpsl-dropdown{position:relative;width:90px;border:1px solid #ccc;background:#fff;border-radius:3px;-webkit-user-select:none;-moz-user-select:none;user-select:none;margin-right:0!important;z-index:2}#wpsl-results .wpsl-dropdown{width:70px}.wpsl-dropdown ul{position:absolute;left:0;width:100%;height:100%;padding:0!important;margin:0!important;list-style:none;overflow:hidden}.wpsl-dropdown:hover{box-shadow:0 0 5px rgba(0,0,0,.15)}.wpsl-dropdown .wpsl-selected-item,.wpsl-dropdown li{position:relative;display:block;line-height:1;color:#000;overflow:hidden;white-space:nowrap}.wpsl-selected-item:after{position:absolute;content:"";right:12px;top:50%;margin-top:-4px;border:6px solid transparent;border-top:8px solid #000}.wpsl-active .wpsl-selected-item:after{margin-top:-10px;border:6px solid transparent;border-bottom:8px solid #000}.wpsl-dropdown li:hover{background:#f8f9f8;position:relative;z-index:3;color:#000}.wpsl-dropdown .wpsl-selected-item,.wpsl-dropdown li,.wpsl-selected-item{list-style:none;padding:9px 12px!important;margin:0!important}.wpsl-selected-dropdown{font-weight:700}.wpsl-clearfix:after,.wpsl-clearfix:before{content:" ";display:table}#wpsl-wrap .wpsl-selected-item{position:static;padding-right:35px!important}#wpsl-category,.wpsl-input,.wpsl-select-wrap{position:relative;margin-bottom:10px}.wpsl-provided-by{float:right;padding:5px 0;text-align:right;font-size:12px;width:100%}#wpsl-wrap .wpsl-results-only label{width:auto}.wpsl-contact-details,.wpsl-location-address,.wpsl-locations-details{margin-bottom:15px}table.wpsl-opening-hours td{vertical-align:top;padding:0 15px 0 0;text-align:left}table.wpsl-opening-hours time{display:block}table.wpsl-opening-hours{width:auto!important;font-size:100%!important}table.wpsl-opening-hours,table.wpsl-opening-hours td{border:none!important}.wpsl-gmap-canvas .wpsl-infobox{min-width:155px;max-width:350px!important;padding:10px;border-radius:4px;font-size:13px;font-weight:300;border:1px solid #ccc;background:#fff!important}.wpsl-gmap-canvas .wpsl-infobox:after,.wpsl-gmap-canvas .wpsl-infobox:before{position:absolute;content:"";left:40px;bottom:-11px}.wpsl-gmap-canvas .wpsl-infobox:after{border-left:11px solid transparent;border-right:11px solid transparent;border-top:11px solid #fff}.wpsl-gmap-canvas .wpsl-infobox:before{border-left:13px solid transparent;border-right:13px solid transparent;border-top:13px solid #ccc;bottom:-13px;left:38px}@media (max-width:825px){#wpsl-search-input{width:348px}.wpsl-results-only #wpsl-search-wrap .wpsl-dropdown{width:70px}#wpsl-search-wrap .wpsl-input{width:100%;margin-bottom:10px}#wpsl-category label,#wpsl-radius label,.wpsl-cat-results-filter #wpsl-search-wrap .wpsl-input,.wpsl-input label,.wpsl-no-filters #wpsl-search-wrap .wpsl-input,.wpsl-results-only #wpsl-search-wrap .wpsl-input{width:auto}}@media (max-width:720px){#wpsl-search-wrap .wpsl-dropdown{width:114px}}@media (max-width:675px){#wpsl-search-wrap #wpsl-search-btn{float:left;margin:0 5px 0 0}.wpsl-dropdown,.wpsl-results-only #wpsl-search-wrap .wpsl-input{width:100%}.wpsl-search{padding:2%}#wpsl-result-list p,#wpsl-wrap #wpsl-result-list li,.wpsl-direction-before{padding-left:0}.wpsl-input{margin-right:0}#wpsl-gmap,#wpsl-result-list{float:none;width:100%}#wpsl-gmap{margin-bottom:15px;margin-top:10px}#wpsl-result-list,.wpsl-cat-results-filter .wpsl-select-wrap,.wpsl-filter .wpsl-select-wrap{margin-bottom:10px}#wpsl-wrap #wpsl-result-list li.wpsl-preloader{padding-left:25px}.wpsl-preloader img{left:0}#wpsl-stores.wpsl-not-loaded{height:25px}#wpsl-reset-map{top:25px}#wpsl-category,#wpsl-search-btn,.wpsl-input,.wpsl-no-filters #wpsl-search-wrap .wpsl-input,.wpsl-select-wrap{margin-bottom:0}#wpsl-stores.wpsl-no-autoload{height:auto!important}}@media (max-width:570px){#wpsl-search-wrap #wpsl-search-btn{margin-bottom:5px}.wpsl-search{padding:4%}#wpsl-search-input{width:98%!important}.wpsl-cat-results-filter #wpsl-search-input,.wpsl-cat-results-filter #wpsl-search-wrap .wpsl-input,.wpsl-no-results #wpsl-search-input,.wpsl-results-only #wpsl-search-input{width:100%!important}.wpsl-search-btn-wrap{margin-top:15px;clear:both}#wpsl-search-btn,#wpsl-search-wrap div{margin-right:0}#wpsl-search-wrap div label{display:block;width:100%}.wpsl-select-wrap{width:100%}#wpsl-radius,#wpsl-results{width:50%}#wpsl-radius{margin-right:4%}#wpsl-search-wrap .wpsl-dropdown{width:96%!important}.wpsl-no-filters #wpsl-search-input,.wpsl-no-filters #wpsl-search-wrap .wpsl-input{width:100%!important}}
frontend/class-frontend.php CHANGED
@@ -16,7 +16,7 @@ if ( !class_exists( 'WPSL_Frontend' ) ) {
16
  * @since 1.0.0
17
  */
18
  class WPSL_Frontend {
19
-
20
  /**
21
  * Keep track which scripts we need to load
22
  *
@@ -30,9 +30,20 @@ if ( !class_exists( 'WPSL_Frontend' ) ) {
30
  * @since 2.0.0
31
  */
32
  private static $map_count = 0;
33
-
 
 
 
 
 
 
 
 
 
 
34
  private $store_map_data = array();
35
 
 
36
  /**
37
  * Class constructor
38
  */
@@ -71,7 +82,7 @@ if ( !class_exists( 'WPSL_Frontend' ) ) {
71
  */
72
  public function store_search() {
73
 
74
- global $wpsl, $wpsl_settings;
75
 
76
  /*
77
  * Check if auto loading the locations on page load is enabled.
@@ -80,28 +91,17 @@ if ( !class_exists( 'WPSL_Frontend' ) ) {
80
  * in case a large amount of locations need to be displayed.
81
  *
82
  * The SQL query that selects nearby locations doesn't take that long,
83
- * but collecting all the store meta data in get_store_meta_data() for hunderds,
84
  * or thousands of stores can make it really slow.
85
  */
86
  if ( $wpsl_settings['autoload'] && isset( $_GET['autoload'] ) && $_GET['autoload'] && !$wpsl_settings['debug'] && !isset( $_GET['skip_cache'] ) ) {
87
-
88
- /*
89
- * If a multilingual plugin ( WPML or qTranslate X ) is active then we have
90
- * to make sure each language has his own unique transient. We do this by
91
- * including the lang code in the transient name.
92
- *
93
- * Otherwise if the language is for example set to German on page load,
94
- * and the user switches to Spanish, then he would get the incorrect
95
- * permalink structure ( /de/.. instead or /es/.. ) and translated
96
- * store details.
97
- */
98
- $lang_code = $wpsl->i18n->check_multilingual_code();
99
-
100
- if ( false === ( $store_data = get_transient( 'wpsl_autoload_' . $wpsl_settings['autoload_limit'] . $lang_code ) ) ) {
101
  $store_data = $this->find_nearby_locations();
102
-
103
  if ( $store_data ) {
104
- set_transient( 'wpsl_autoload_' . $wpsl_settings['autoload_limit'] . $lang_code, $store_data, 0 );
105
  }
106
  }
107
  } else {
@@ -112,6 +112,55 @@ if ( !class_exists( 'WPSL_Frontend' ) ) {
112
 
113
  exit();
114
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
115
 
116
  /**
117
  * Find store locations that are located within the selected search radius.
@@ -145,16 +194,15 @@ if ( !class_exists( 'WPSL_Frontend' ) ) {
145
 
146
  // Check if we need to filter the results by category.
147
  if ( isset( $_GET['filter'] ) && $_GET['filter'] ) {
148
- $placeholder_values[] = $_GET['filter'];
149
-
150
  $cat_filter = "INNER JOIN $wpdb->term_relationships AS term_rel ON posts.ID = term_rel.object_id
151
  INNER JOIN $wpdb->term_taxonomy AS term_tax ON term_rel.term_taxonomy_id = term_tax.term_taxonomy_id
152
  AND term_tax.taxonomy = 'wpsl_store_category'
153
- AND term_tax.term_id = %d";
154
  } else {
155
  $cat_filter = '';
156
  }
157
-
158
  /*
159
  * If WPML is active we include 'GROUP BY lat' in the sql query
160
  * to prevent duplicate locations from showing up in the results.
@@ -278,6 +326,7 @@ if ( !class_exists( 'WPSL_Frontend' ) ) {
278
  case 'hours':
279
  $meta_data = $this->get_opening_hours( $custom_fields[$meta_key][0], $hide_closed = false );
280
  break;
 
281
  case 'textarea':
282
  $meta_data = wp_kses_post( wpautop( $custom_fields[$meta_key][0] ) );
283
  break;
@@ -531,6 +580,67 @@ if ( !class_exists( 'WPSL_Frontend' ) ) {
531
  return $content;
532
  }
533
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
534
  /**
535
  * Handle the [wpsl] shortcode.
536
  *
@@ -542,11 +652,14 @@ if ( !class_exists( 'WPSL_Frontend' ) ) {
542
 
543
  global $wpsl_settings;
544
 
545
- // Accept a 'template' attribute to specify the template ID e.g. "default" or "below_map".
546
  $atts = shortcode_atts( array(
547
- 'template' => $wpsl_settings['template_id']
 
 
548
  ), $atts );
549
-
 
 
550
  // Make sure the required scripts are included for the wpsl shortcode.
551
  array_push( $this->load_scripts, 'wpsl_store_locator' );
552
 
@@ -778,7 +891,7 @@ if ( !class_exists( 'WPSL_Frontend' ) ) {
778
  ) ), $atts );
779
 
780
  array_push( $this->load_scripts, 'wpsl_base' );
781
-
782
  if ( get_post_type() == 'wpsl_stores' ) {
783
  if ( empty( $atts['id'] ) ) {
784
  if ( isset( $post->ID ) ) {
@@ -807,11 +920,19 @@ if ( !class_exists( 'WPSL_Frontend' ) ) {
807
  ) );
808
  } else {
809
  $store_ids = array_map( 'absint', explode( ',', $atts['id'] ) );
 
 
 
 
 
 
 
 
810
  }
811
 
812
  $store_meta = array();
813
  $i = 0;
814
-
815
  foreach ( $store_ids as $store_id ) {
816
  $lat = get_post_meta( $store_id, 'wpsl_lat', true );
817
  $lng = get_post_meta( $store_id, 'wpsl_lng', true );
@@ -827,20 +948,29 @@ if ( !class_exists( 'WPSL_Frontend' ) ) {
827
  'zip' => get_post_meta( $store_id, 'wpsl_zip', true ),
828
  'country' => get_post_meta( $store_id, 'wpsl_country', true )
829
  ), $store_id );
830
-
 
 
 
 
 
 
 
 
 
831
  $store_meta[$i]['lat'] = $lat;
832
  $store_meta[$i]['lng'] = $lng;
833
  $store_meta[$i]['id'] = $store_id;
834
-
835
  $i++;
836
  }
837
  }
838
-
839
  $output = '<div id="wpsl-base-gmap_' . self::$map_count . '" class="wpsl-gmap-canvas"></div>' . "\r\n";
840
-
841
  // Make sure the shortcode attributes are valid.
842
  $map_styles = $this->check_map_shortcode_atts( $atts );
843
-
844
  if ( $map_styles ) {
845
  if ( isset( $map_styles['css'] ) && !empty( $map_styles['css'] ) ) {
846
  $output .= '<style>' . $map_styles['css'] . '</style>' . "\r\n";
@@ -851,11 +981,11 @@ if ( !class_exists( 'WPSL_Frontend' ) ) {
851
  $store_data['shortCode'] = $map_styles;
852
  }
853
  }
854
-
855
  $store_data['locations'] = $store_meta;
856
 
857
  $this->store_map_data[self::$map_count] = $store_data;
858
-
859
  self::$map_count++;
860
 
861
  return $output;
@@ -1109,7 +1239,7 @@ if ( !class_exists( 'WPSL_Frontend' ) ) {
1109
 
1110
  return $dropdown_list;
1111
  }
1112
-
1113
  /**
1114
  * Create the category filter.
1115
  *
@@ -1117,9 +1247,17 @@ if ( !class_exists( 'WPSL_Frontend' ) ) {
1117
  * @return string|void $category The HTML for the category dropdown, or nothing if no terms exist.
1118
  */
1119
  public function create_category_filter() {
1120
-
1121
  global $wpsl;
1122
-
 
 
 
 
 
 
 
 
1123
  $terms = get_terms( 'wpsl_store_category' );
1124
 
1125
  if ( count( $terms ) > 0 ) {
@@ -1329,13 +1467,14 @@ if ( !class_exists( 'WPSL_Frontend' ) ) {
1329
  'mapType' => $wpsl_settings['map_type'],
1330
  'mapTypeControl' => $wpsl_settings['type_control'],
1331
  'zoomLevel' => $wpsl_settings['zoom_level'],
1332
- 'zoomLatlng' => $wpsl_settings['zoom_latlng'],
1333
  'autoZoomLevel' => $wpsl_settings['auto_zoom_level'],
1334
  'scrollWheel' => $wpsl_settings['scrollwheel'],
1335
  'controlPosition' => $wpsl_settings['control_position'],
1336
  'url' => WPSL_URL,
1337
  'markerIconProps' => $this->get_marker_props(),
1338
- 'draggable' => $this->maybe_draggable()
 
1339
  );
1340
 
1341
  $locator_map_settings = array(
@@ -1351,7 +1490,6 @@ if ( !class_exists( 'WPSL_Frontend' ) ) {
1351
  'resetMap' => $wpsl_settings['reset_map'],
1352
  'directionRedirect' => $wpsl_settings['direction_redirect'],
1353
  'phoneUrl' => $wpsl_settings['phone_url'],
1354
- 'storeUrl' => $wpsl_settings['store_url'],
1355
  'moreInfoLocation' => $wpsl_settings['more_info_location'],
1356
  'mouseFocus' => $wpsl_settings['mouse_focus'],
1357
  'templateId' => $wpsl_settings['template_id'],
@@ -1424,6 +1562,13 @@ if ( !class_exists( 'WPSL_Frontend' ) ) {
1424
  $settings = $base_settings;
1425
  }
1426
 
 
 
 
 
 
 
 
1427
  wp_localize_script( 'wpsl-js', 'wpslSettings', $settings );
1428
 
1429
  wpsl_create_underscore_templates( $template );
16
  * @since 1.0.0
17
  */
18
  class WPSL_Frontend {
19
+
20
  /**
21
  * Keep track which scripts we need to load
22
  *
30
  * @since 2.0.0
31
  */
32
  private static $map_count = 0;
33
+
34
+ /*
35
+ * Holds the shortcode atts for the [wpsl] shortcode.
36
+ *
37
+ * Used to overwrite the settings just before
38
+ * they are send to wp_localize_script.
39
+ *
40
+ * @since 2.1.1
41
+ */
42
+ public $sl_shortcode_atts;
43
+
44
  private $store_map_data = array();
45
 
46
+
47
  /**
48
  * Class constructor
49
  */
82
  */
83
  public function store_search() {
84
 
85
+ global $wpsl_settings;
86
 
87
  /*
88
  * Check if auto loading the locations on page load is enabled.
91
  * in case a large amount of locations need to be displayed.
92
  *
93
  * The SQL query that selects nearby locations doesn't take that long,
94
+ * but collecting all the store meta data in get_store_meta_data() for hunderds,
95
  * or thousands of stores can make it really slow.
96
  */
97
  if ( $wpsl_settings['autoload'] && isset( $_GET['autoload'] ) && $_GET['autoload'] && !$wpsl_settings['debug'] && !isset( $_GET['skip_cache'] ) ) {
98
+ $transient_name = $this->create_transient_name();
99
+
100
+ if ( false === ( $store_data = get_transient( 'wpsl_autoload_' . $transient_name ) ) ) {
 
 
 
 
 
 
 
 
 
 
 
101
  $store_data = $this->find_nearby_locations();
102
+
103
  if ( $store_data ) {
104
+ set_transient( 'wpsl_autoload_' . $transient_name, $store_data, 0 );
105
  }
106
  }
107
  } else {
112
 
113
  exit();
114
  }
115
+
116
+ /**
117
+ * Create the name used in the wpsl autoload transient.
118
+ *
119
+ * @since 2.1.1
120
+ * @return string $transient_name The transient name.
121
+ */
122
+ public function create_transient_name() {
123
+
124
+ global $wpsl, $wpsl_settings;
125
+
126
+ // Include the set autoload limit.
127
+ $name_section = array( $wpsl_settings['autoload_limit'] );
128
+
129
+ /*
130
+ * Check if we need to include the cat id(s) in the transient name.
131
+ *
132
+ * This can only happen if the user used the
133
+ * 'category' attr on the wpsl shortcode.
134
+ */
135
+ if ( isset( $_GET['filter'] ) && $_GET['filter'] ) {
136
+ $name_section[] = absint( str_replace( ',', '', $_GET['filter'] ) );
137
+ }
138
+
139
+ // Include the lat value from the start location.
140
+ if ( isset( $_GET['lat'] ) && $_GET['lat'] ) {
141
+ $name_section[] = absint( str_replace( '.', '', $_GET['lat'] ) );
142
+ }
143
+
144
+ /*
145
+ * If a multilingual plugin ( WPML or qTranslate X ) is active then we have
146
+ * to make sure each language has his own unique transient. We do this by
147
+ * including the lang code in the transient name.
148
+ *
149
+ * Otherwise if the language is for example set to German on page load,
150
+ * and the user switches to Spanish, then he would get the incorrect
151
+ * permalink structure ( /de/.. instead or /es/.. ) and translated
152
+ * store details.
153
+ */
154
+ $lang_code = $wpsl->i18n->check_multilingual_code();
155
+
156
+ if ( $lang_code ) {
157
+ $name_section[] = $lang_code;
158
+ }
159
+
160
+ $transient_name = implode( '_', $name_section );
161
+
162
+ return $transient_name;
163
+ }
164
 
165
  /**
166
  * Find store locations that are located within the selected search radius.
194
 
195
  // Check if we need to filter the results by category.
196
  if ( isset( $_GET['filter'] ) && $_GET['filter'] ) {
197
+ $filter_ids = array_map( 'absint', explode( ',', $_GET['filter'] ) );
 
198
  $cat_filter = "INNER JOIN $wpdb->term_relationships AS term_rel ON posts.ID = term_rel.object_id
199
  INNER JOIN $wpdb->term_taxonomy AS term_tax ON term_rel.term_taxonomy_id = term_tax.term_taxonomy_id
200
  AND term_tax.taxonomy = 'wpsl_store_category'
201
+ AND term_tax.term_id IN (" . implode( ',', $filter_ids ) . ")";
202
  } else {
203
  $cat_filter = '';
204
  }
205
+
206
  /*
207
  * If WPML is active we include 'GROUP BY lat' in the sql query
208
  * to prevent duplicate locations from showing up in the results.
326
  case 'hours':
327
  $meta_data = $this->get_opening_hours( $custom_fields[$meta_key][0], $hide_closed = false );
328
  break;
329
+ case 'wp_editor':
330
  case 'textarea':
331
  $meta_data = wp_kses_post( wpautop( $custom_fields[$meta_key][0] ) );
332
  break;
580
  return $content;
581
  }
582
 
583
+ /**
584
+ * Handle the [wpsl] shortcode attributes.
585
+ *
586
+ * @since 2.1.1
587
+ * @param array $atts Shortcode attributes
588
+ */
589
+ public function check_sl_shortcode_atts( $atts ) {
590
+
591
+ // Change the category slugs into category ids.
592
+ if ( isset( $atts['category'] ) && $atts['category'] ) {
593
+ $term_ids = array();
594
+ $cats = explode( ',', $atts['category'] );
595
+
596
+ foreach ( $cats as $key => $cat_slug ) {
597
+ $term_data = get_term_by( 'slug', $cat_slug, 'wpsl_store_category' );
598
+
599
+ if ( isset( $term_data->term_id ) && $term_data->term_id ) {
600
+ $term_ids[] = $term_data->term_id;
601
+ }
602
+ }
603
+
604
+ if ( $term_ids ) {
605
+ $this->sl_shortcode_atts['categoryIds'] = implode( ',', $term_ids );
606
+ }
607
+ }
608
+
609
+ /*
610
+ * Use a custom start location?
611
+ *
612
+ * If the provided location fails to geocode,
613
+ * then the start location from the settings page is used.
614
+ */
615
+ if ( isset( $atts['start_location'] ) && $atts['start_location'] ) {
616
+ $name_section = explode( ',', $atts['start_location'] );
617
+ $transient_name = 'wpsl_' . trim( strtolower( $name_section[0] ) ) . '_latlng';
618
+
619
+ /*
620
+ * Check if we still need to geocode the start location,
621
+ * or if a transient with the start latlng already exists.
622
+ */
623
+ if ( false === ( $start_latlng = get_transient( $transient_name ) ) ) {
624
+ $response = wpsl_call_geocode_api( $atts['start_location'] );
625
+
626
+ if ( !is_wp_error( $response ) ) {
627
+ $response = json_decode( $response['body'], true );
628
+
629
+ if ( $response['status'] == 'OK' ) {
630
+ $start_latlng = $response['results'][0]['geometry']['location']['lat'] . ',' . $response['results'][0]['geometry']['location']['lng'];
631
+
632
+ set_transient( $transient_name, $start_latlng, 0 );
633
+ }
634
+ }
635
+ }
636
+
637
+ if ( isset( $start_latlng ) && $start_latlng ) {
638
+ // @todo change the name of zoomLatLng into something that makes more sense like startLatLng in the JS / settings code!
639
+ $this->sl_shortcode_atts['zoomLatlng'] = $start_latlng;
640
+ }
641
+ }
642
+ }
643
+
644
  /**
645
  * Handle the [wpsl] shortcode.
646
  *
652
 
653
  global $wpsl_settings;
654
 
 
655
  $atts = shortcode_atts( array(
656
+ 'template' => $wpsl_settings['template_id'],
657
+ 'category' => '',
658
+ 'start_location' => ''
659
  ), $atts );
660
+
661
+ $this->check_sl_shortcode_atts( $atts );
662
+
663
  // Make sure the required scripts are included for the wpsl shortcode.
664
  array_push( $this->load_scripts, 'wpsl_store_locator' );
665
 
891
  ) ), $atts );
892
 
893
  array_push( $this->load_scripts, 'wpsl_base' );
894
+
895
  if ( get_post_type() == 'wpsl_stores' ) {
896
  if ( empty( $atts['id'] ) ) {
897
  if ( isset( $post->ID ) ) {
920
  ) );
921
  } else {
922
  $store_ids = array_map( 'absint', explode( ',', $atts['id'] ) );
923
+ $id_count = count( $store_ids );
924
+ }
925
+
926
+ // If we have multiple ids, or the category attr is set, then we include the permalink / url.
927
+ if ( $atts['category'] || isset( $id_count ) && $id_count > 1 ) {
928
+ $incl_url = true;
929
+ } else {
930
+ $incl_url = false;
931
  }
932
 
933
  $store_meta = array();
934
  $i = 0;
935
+
936
  foreach ( $store_ids as $store_id ) {
937
  $lat = get_post_meta( $store_id, 'wpsl_lat', true );
938
  $lng = get_post_meta( $store_id, 'wpsl_lng', true );
948
  'zip' => get_post_meta( $store_id, 'wpsl_zip', true ),
949
  'country' => get_post_meta( $store_id, 'wpsl_country', true )
950
  ), $store_id );
951
+
952
+ // Grab the permalink / url if necessary.
953
+ if ( $incl_url ) {
954
+ if ( $wpsl_settings['permalinks'] ) {
955
+ $store_meta[$i]['permalink'] = get_permalink( $store_id );
956
+ } else {
957
+ $store_meta[$i]['url'] = get_post_meta( $store_id, 'wpsl_url', true );
958
+ }
959
+ }
960
+
961
  $store_meta[$i]['lat'] = $lat;
962
  $store_meta[$i]['lng'] = $lng;
963
  $store_meta[$i]['id'] = $store_id;
964
+
965
  $i++;
966
  }
967
  }
968
+
969
  $output = '<div id="wpsl-base-gmap_' . self::$map_count . '" class="wpsl-gmap-canvas"></div>' . "\r\n";
970
+
971
  // Make sure the shortcode attributes are valid.
972
  $map_styles = $this->check_map_shortcode_atts( $atts );
973
+
974
  if ( $map_styles ) {
975
  if ( isset( $map_styles['css'] ) && !empty( $map_styles['css'] ) ) {
976
  $output .= '<style>' . $map_styles['css'] . '</style>' . "\r\n";
981
  $store_data['shortCode'] = $map_styles;
982
  }
983
  }
984
+
985
  $store_data['locations'] = $store_meta;
986
 
987
  $this->store_map_data[self::$map_count] = $store_data;
988
+
989
  self::$map_count++;
990
 
991
  return $output;
1239
 
1240
  return $dropdown_list;
1241
  }
1242
+
1243
  /**
1244
  * Create the category filter.
1245
  *
1247
  * @return string|void $category The HTML for the category dropdown, or nothing if no terms exist.
1248
  */
1249
  public function create_category_filter() {
1250
+
1251
  global $wpsl;
1252
+
1253
+ /*
1254
+ * If the category attr is set on the wpsl shortcode, then
1255
+ * there is no need to ouput an extra category dropdown.
1256
+ */
1257
+ if ( isset( $this->sl_shortcode_atts['categoryIds'] ) ) {
1258
+ return;
1259
+ }
1260
+
1261
  $terms = get_terms( 'wpsl_store_category' );
1262
 
1263
  if ( count( $terms ) > 0 ) {
1467
  'mapType' => $wpsl_settings['map_type'],
1468
  'mapTypeControl' => $wpsl_settings['type_control'],
1469
  'zoomLevel' => $wpsl_settings['zoom_level'],
1470
+ 'zoomLatlng' => $wpsl_settings['zoom_latlng'], // @todo change name into startLatlng
1471
  'autoZoomLevel' => $wpsl_settings['auto_zoom_level'],
1472
  'scrollWheel' => $wpsl_settings['scrollwheel'],
1473
  'controlPosition' => $wpsl_settings['control_position'],
1474
  'url' => WPSL_URL,
1475
  'markerIconProps' => $this->get_marker_props(),
1476
+ 'draggable' => $this->maybe_draggable(),
1477
+ 'storeUrl' => $wpsl_settings['store_url']
1478
  );
1479
 
1480
  $locator_map_settings = array(
1490
  'resetMap' => $wpsl_settings['reset_map'],
1491
  'directionRedirect' => $wpsl_settings['direction_redirect'],
1492
  'phoneUrl' => $wpsl_settings['phone_url'],
 
1493
  'moreInfoLocation' => $wpsl_settings['more_info_location'],
1494
  'mouseFocus' => $wpsl_settings['mouse_focus'],
1495
  'templateId' => $wpsl_settings['template_id'],
1562
  $settings = $base_settings;
1563
  }
1564
 
1565
+ // Check if we need to overwrite settings that are set through the [wpsl] shortcode.
1566
+ if ( $this->sl_shortcode_atts ) {
1567
+ foreach ( $this->sl_shortcode_atts as $shortcode_key => $shortcode_val ) {
1568
+ $settings[$shortcode_key] = $shortcode_val;
1569
+ }
1570
+ }
1571
+
1572
  wp_localize_script( 'wpsl-js', 'wpslSettings', $settings );
1573
 
1574
  wpsl_create_underscore_templates( $template );
frontend/underscore-functions.php CHANGED
@@ -2,7 +2,7 @@
2
  /**
3
  * Create the store data templates.
4
  *
5
- * The template is created in JS with _.template, see http://underscorejs.org/#template
6
  *
7
  * @since 2.0.0
8
  * @param string $template The type of template we need to create
@@ -75,7 +75,7 @@ function wpsl_create_underscore_templates( $template ) {
75
  <?php
76
  $cpt_info_window_template = '<div class="wpsl-info-window">' . "\r\n";
77
  $cpt_info_window_template .= "\t\t" . '<p class="wpsl-no-margin">' . "\r\n";
78
- $cpt_info_window_template .= "\t\t\t" . '<strong><%= store %></strong>' . "\r\n";
79
  $cpt_info_window_template .= "\t\t\t" . '<span><%= address %></span>' . "\r\n";
80
  $cpt_info_window_template .= "\t\t\t" . '<% if ( address2 ) { %>' . "\r\n";
81
  $cpt_info_window_template .= "\t\t\t" . '<span><%= address2 %></span>' . "\r\n";
2
  /**
3
  * Create the store data templates.
4
  *
5
+ * The templates are created in JS with _.template, see http://underscorejs.org/#template
6
  *
7
  * @since 2.0.0
8
  * @param string $template The type of template we need to create
75
  <?php
76
  $cpt_info_window_template = '<div class="wpsl-info-window">' . "\r\n";
77
  $cpt_info_window_template .= "\t\t" . '<p class="wpsl-no-margin">' . "\r\n";
78
+ $cpt_info_window_template .= "\t\t\t" . wpsl_store_header_template() . "\r\n";
79
  $cpt_info_window_template .= "\t\t\t" . '<span><%= address %></span>' . "\r\n";
80
  $cpt_info_window_template .= "\t\t\t" . '<% if ( address2 ) { %>' . "\r\n";
81
  $cpt_info_window_template .= "\t\t\t" . '<span><%= address2 %></span>' . "\r\n";
inc/wpsl-functions.php CHANGED
@@ -412,4 +412,17 @@ function wpsl_is_multi_array( $array ) {
412
  }
413
 
414
  return false;
 
 
 
 
 
 
 
 
 
 
 
 
 
415
  }
412
  }
413
 
414
  return false;
415
+ }
416
+
417
+ /**
418
+ * @since 2.1.1
419
+ * @param string $address The address to geocode
420
+ * @return array $response Either a WP_Error or the response from the Geocode API.
421
+ */
422
+ function wpsl_call_geocode_api( $address ) {
423
+
424
+ $url = 'https://maps.googleapis.com/maps/api/geocode/json?address=' . urlencode( $address ) . wpsl_get_gmap_api_params( true );
425
+ $response = wp_remote_get( $url );
426
+
427
+ return $response;
428
  }
js/wpsl-gmap.js CHANGED
@@ -1151,8 +1151,13 @@ function makeAjaxRequest( startLatLng, resetMap, autoLoad, infoWindow ) {
1151
  ajaxData.radius = radius;
1152
  }
1153
 
1154
- // If the category dropdown exist get the id.
1155
- if ( $( "#wpsl-category" ).length > 0 ) {
 
 
 
 
 
1156
  if ( isMobile ) {
1157
  categoryId = parseInt( $( "#wpsl-category .wpsl-dropdown" ).val() );
1158
  } else {
@@ -1187,8 +1192,16 @@ function makeAjaxRequest( startLatLng, resetMap, autoLoad, infoWindow ) {
1187
  ajaxData.skip_cache = 1;
1188
  } else {
1189
  ajaxData.autoload = 1;
 
 
 
 
 
 
 
 
1190
  }
1191
- }
1192
 
1193
  // Add the preloader.
1194
  $storeList.empty().append( "<li class='wpsl-preloader'><img src='" + preloader + "'/>" + wpslLabels.preloader + "</li>" );
@@ -1330,7 +1343,7 @@ function addMarker( latLng, storeId, infoWindowData, draggable, infoWindow ) {
1330
  } else {
1331
  url = markerSettings.url + wpslSettings.storeMarker;
1332
  }
1333
-
1334
  mapIcon = {
1335
  url: url,
1336
  scaledSize: new google.maps.Size( Number( markerSettings.scaledSize[0] ), Number( markerSettings.scaledSize[1] ) ), //retina format
@@ -1347,7 +1360,7 @@ function addMarker( latLng, storeId, infoWindowData, draggable, infoWindow ) {
1347
  storeId: storeId,
1348
  icon: mapIcon
1349
  });
1350
-
1351
  // Store the marker for later use.
1352
  markersArray.push( marker );
1353
 
1151
  ajaxData.radius = radius;
1152
  }
1153
 
1154
+ /*
1155
+ * If category ids are set through the wpsl shortcode, then we always need to include them.
1156
+ * Otherwise check if the category dropdown exist, and if so get the id.
1157
+ */
1158
+ if ( typeof wpslSettings.categoryIds !== "undefined" ) {
1159
+ ajaxData.filter = wpslSettings.categoryIds;
1160
+ } else if ( $( "#wpsl-category" ).length > 0 ) {
1161
  if ( isMobile ) {
1162
  categoryId = parseInt( $( "#wpsl-category .wpsl-dropdown" ).val() );
1163
  } else {
1192
  ajaxData.skip_cache = 1;
1193
  } else {
1194
  ajaxData.autoload = 1;
1195
+
1196
+ /*
1197
+ * If the user set the 'category' attr on the wpsl shortcode, then include the cat ids
1198
+ * to make sure only locations from the set categories are loaded on autoload.
1199
+ */
1200
+ if ( typeof wpslSettings.categoryIds !== "undefined" ) {
1201
+ ajaxData.filter = wpslSettings.categoryIds;
1202
+ }
1203
  }
1204
+ }
1205
 
1206
  // Add the preloader.
1207
  $storeList.empty().append( "<li class='wpsl-preloader'><img src='" + preloader + "'/>" + wpslLabels.preloader + "</li>" );
1343
  } else {
1344
  url = markerSettings.url + wpslSettings.storeMarker;
1345
  }
1346
+
1347
  mapIcon = {
1348
  url: url,
1349
  scaledSize: new google.maps.Size( Number( markerSettings.scaledSize[0] ), Number( markerSettings.scaledSize[1] ) ), //retina format
1360
  storeId: storeId,
1361
  icon: mapIcon
1362
  });
1363
+
1364
  // Store the marker for later use.
1365
  markersArray.push( marker );
1366
 
js/wpsl-gmap.min.js CHANGED
@@ -1 +1 @@
1
- jQuery(document).ready(function(e){function t(t,n){var p,g,u,m,v,S,b,L=Number(wpslSettings.autoZoomLevel);g=o(n),u=i(),H=new google.maps.Geocoder,q=new google.maps.DirectionsRenderer,Y=new google.maps.DirectionsService,p={zoom:Number(g.zoomLevel),center:g.startLatLng,mapTypeId:google.maps.MapTypeId[g.mapType.toUpperCase()],mapTypeControl:Number(g.mapTypeControl)?!0:!1,scrollwheel:Number(g.scrollWheel)?!0:!1,streetViewControl:Number(g.streetView)?!0:!1,zoomControlOptions:{position:google.maps.ControlPosition[g.controlPosition.toUpperCase()+"_TOP"]}},le=a(),Q=new google.maps.Map(document.getElementById(t),p),l(Q),r(g.mapStyle),"undefined"!=typeof window["wpslMap_"+n]&&"undefined"!=typeof window["wpslMap_"+n].locations&&(v=new google.maps.LatLngBounds,S=window["wpslMap_"+n].locations,b=S.length,e.each(S,function(e){m=new google.maps.LatLng(S[e].lat,S[e].lng),O(m,S[e].id,S[e],!1,u),v.extend(m)}),Q.fitBounds(v),google.maps.event.addListenerOnce(Q,"bounds_changed",function(e){return function(){e.getZoom()>L&&e.setZoom(L)}}(Q))),e("#wpsl-gmap").length&&(!c()&&e(".wpsl-dropdown").length?j():(e("#wpsl-search-wrap select").show(),e("#wpsl-wrap").addClass("wpsl-mobile")),e(".wpsl-search").hasClass("wpsl-widget")||(1==wpslSettings.autoLocate?w(g.startLatLng,u):1==wpslSettings.autoLoad&&d(g.startLatLng,u)),1!=wpslSettings.mouseFocus||c()||e("#wpsl-search-input").focus(),f(u),h(g,Q,u),F()),s()}function s(){"undefined"!=typeof wpslSettings.markerZoomTo&&1==wpslSettings.markerZoomTo&&google.maps.event.addListener(Q,"zoom_changed",function(){Z()})}function o(e){var t,s,o,i=["zoomLevel","mapType","mapTypeControl","mapStyle","streetView","scrollWheel","controlPosition"],l={zoomLevel:wpslSettings.zoomLevel,mapType:wpslSettings.mapType,mapTypeControl:wpslSettings.mapTypeControl,mapStyle:wpslSettings.mapStyle,streetView:wpslSettings.streetView,scrollWheel:wpslSettings.scrollWheel,controlPosition:wpslSettings.controlPosition};if("undefined"!=typeof window["wpslMap_"+e]&&"undefined"!=typeof window["wpslMap_"+e].shortCode)for(t=0,s=i.length;s>t;t++)o=window["wpslMap_"+e].shortCode[i[t]],"undefined"!=typeof o&&(l[i[t]]=o);return l.startLatLng=n(e),l}function n(e){var t,s,o="";return"undefined"!=typeof window["wpslMap_"+e]&&"undefined"!=typeof window["wpslMap_"+e].locations&&(o=window["wpslMap_"+e].locations[0]),"undefined"!=typeof o&&"undefined"!=typeof o.lat&&"undefined"!=typeof o.lng?t=new google.maps.LatLng(o.lat,o.lng):""!==wpslSettings.zoomLatlng?(s=wpslSettings.zoomLatlng.split(","),t=new google.maps.LatLng(s[0],s[1])):t=new google.maps.LatLng(0,0),t}function i(){var e,t,s={};return"undefined"!=typeof wpslSettings.infoWindowStyle&&"infobox"==wpslSettings.infoWindowStyle?(e=wpslSettings.infoBoxClearance.split(","),t=wpslSettings.infoBoxPixelOffset.split(","),s={alignBottom:!0,boxClass:wpslSettings.infoBoxClass,closeBoxMargin:wpslSettings.infoBoxCloseMargin,closeBoxURL:wpslSettings.infoBoxCloseUrl,content:"",disableAutoPan:Number(wpslSettings.infoBoxDisableAutoPan)?!0:!1,enableEventPropagation:Number(wpslSettings.infoBoxEnableEventPropagation)?!0:!1,infoBoxClearance:new google.maps.Size(Number(e[0]),Number(e[1])),pixelOffset:new google.maps.Size(Number(t[0]),Number(t[1])),zIndex:Number(wpslSettings.infoBoxZindex)},ee=new InfoBox(s)):ee=new google.maps.InfoWindow,ee}function l(t){var s=parseInt(wpslSettings.draggable.disableRes),o={draggable:Boolean(wpslSettings.draggable.enabled)};"NaN"!==s&&o.draggable&&(o.draggable=e(document).width()>s?!0:!1),t.setOptions(o)}function a(){var e,t=wpslSettings.markerIconProps,s={};"undefined"!=typeof t.url?s.url=t.url:s.url=wpslSettings.url+"img/markers/";for(var o in t)t.hasOwnProperty(o)&&(e=t[o].split(","),2==e.length&&(s[o]=e));return s}function r(e){e=p(e),e&&Q.setOptions({styles:e})}function p(e){try{var t=JSON.parse(e);if(t&&"object"==typeof t&&null!==t)return t}catch(s){}return!1}function d(e,t){O(e,0,"",!0,t),N(e,pe,ce,t)}function c(){return/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)}function w(t,s){if(navigator.geolocation){var o,n,i=!1,l=Number(wpslSettings.geoLocationTimout);o=setInterval(function(){e(".wpsl-icon-direction").toggleClass("wpsl-active-icon")},600),n=setTimeout(function(){g(o),d(t,s)},l),navigator.geolocation.getCurrentPosition(function(e){g(o),clearTimeout(n),A(i),u(t,e,pe,s)},function(o){if(e(".wpsl-icon-direction").hasClass("wpsl-user-activated")){switch(o.code){case o.PERMISSION_DENIED:alert(wpslGeolocationErrors.denied);break;case o.POSITION_UNAVAILABLE:alert(wpslGeolocationErrors.unavailable);break;case o.TIMEOUT:alert(wpslGeolocationErrors.timeout);break;default:alert(wpslGeolocationErrors.generalError)}e(".wpsl-icon-direction").removeClass("wpsl-active-icon")}else clearTimeout(n),d(t,s)},{maximumAge:6e4,timeout:l,enableHighAccuracy:!0})}else alert(wpslGeolocationErrors.unavailable),d(t,s)}function g(t){clearInterval(t),e(".wpsl-icon-direction").removeClass("wpsl-active-icon")}function u(e,t,s,o){if("undefined"==typeof t)d(e,o);else{var n=new google.maps.LatLng(t.coords.latitude,t.coords.longitude);J=t,I(n),Q.setCenter(n),O(n,0,"",!0,o),N(n,s,ce,o)}}function f(t){e("#wpsl-search-btn").on("click",function(){var s=!1;e("#wpsl-search-input").removeClass(),e("#wpsl-search-input").val()?(e("#wpsl-result-list ul").empty(),e("#wpsl-stores").show(),e(".wpsl-direction-before, .wpsl-direction-after").remove(),e("#wpsl-direction-details").hide(),pe=!1,m(),A(s),S(),k(t)):e("#wpsl-search-input").addClass("wpsl-error").focus()})}function m(){"undefined"!=typeof wpslSettings.infoWindowStyle&&"infobox"==wpslSettings.infoWindowStyle&&"undefined"!=typeof ne[0]&&ne[0].close()}function h(t,s,o){google.maps.event.addListenerOnce(s,"tilesloaded",function(){e(".gm-style").append(wpslSettings.mapControls),e(".wpsl-icon-reset, #wpsl-reset-map").length>0&&(v(t.startLatLng,o),e(".wpsl-icon-reset").hide()),e(".wpsl-icon-direction").on("click",function(){e(this).addClass("wpsl-user-activated"),w(t.startLatLng,o)})})}function v(t,s){e(".wpsl-icon-reset, #wpsl-reset-map").on("click",function(){var o=!1,n=!0;e(this).hasClass("wpsl-in-progress")||(1==wpslSettings.autoLoad&&(ce=1),(Q.getCenter().lat()!==re.centerLatlng.lat()||Q.getCenter().lng()!==re.centerLatlng.lng()||Q.getZoom()!==re.zoomLevel)&&(A(o),e("#wpsl-search-input").val("").removeClass(),e(".wpsl-icon-reset").addClass("wpsl-in-progress"),te&&te.clearMarkers(),S(),b(),1==wpslSettings.autoLocate?u(t,J,n,s):d(t,s)),e("#wpsl-stores").show(),e("#wpsl-direction-details").hide())})}function S(){"undefined"!=typeof se&&""!==se&&(se.setMap(null),se="")}function b(){var t,s,o,n,i=[wpslSettings.searchRadius+" "+wpslSettings.distanceUnit,wpslSettings.maxResults],l=["wpsl-radius","wpsl-results"];for(t=0,s=l.length;s>t;t++)e("#"+l[t]+" select").val(parseInt(i[t])),e("#"+l[t]+" li").removeClass(),"wpsl-radius"==l[t]?o=wpslSettings.searchRadius:"wpsl-results"==l[t]&&(o=wpslSettings.maxResults),e("#"+l[t]+" li").each(function(){e(this).text()===i[t]&&(e(this).addClass("wpsl-selected-dropdown"),e("#"+l[t]+" .wpsl-selected-item").html(i[t]).attr("data-value",o))});e("#wpsl-category").length&&(e("#wpsl-category select").val(0),e("#wpsl-category li").removeClass(),e("#wpsl-category li:first-child").addClass("wpsl-selected-dropdown"),n=e("#wpsl-category li:first-child").text(),e("#wpsl-category .wpsl-selected-item").html(n).attr("data-value",0))}function L(t){var s,o,n,i,l;for(m(),l=t.parents("li").length>0?t.parents("li").data("store-id"):t.parents(".wpsl-info-window").data("store-id"),"undefined"!=typeof se&&""!==se&&(o=se.getPosition()),ae={centerLatlng:Q.getCenter(),zoomLevel:Q.getZoom()},s=0,i=ie.length;i>s;s++)0!=ie[s].storeId||"undefined"!=typeof o&&""!==o?ie[s].storeId==l&&(n=ie[s].getPosition()):o=ie[s].getPosition();o&&n?(e("#wpsl-direction-details ul").empty(),e(".wpsl-direction-before, .wpsl-direction-after").remove(),C(o,n)):alert(wpslLabels.generalError)}function y(e,t){var s,o,n;for(s=0,o=ie.length;o>s;s++)ie[s].storeId==e&&(n=ie[s],"start"==t?n.setAnimation(google.maps.Animation.BOUNCE):n.setAnimation(null))}function C(t,s){var o,n,i,l,a,r,p,d,c,w="",g={};d="km"==wpslSettings.distanceUnit?"METRIC":"IMPERIAL",g={origin:t,destination:s,travelMode:google.maps.DirectionsTravelMode.DRIVING,unitSystem:google.maps.UnitSystem[d]},Y.route(g,function(t,s){if(s==google.maps.DirectionsStatus.OK){if(q.setMap(Q),q.setDirections(t),t.routes.length>0){for(a=t.routes[0],r=0;r<a.legs.length;r++)for(o=a.legs[r],p=0,n=o.steps.length;n>p;p++)i=o.steps[p],l=p+1,w=w+"<li><div class='wpsl-direction-index'>"+l+"</div><div class='wpsl-direction-txt'>"+i.instructions+"</div><div class='wpsl-direction-distance'>"+i.distance.text+"</div></li>";for(e("#wpsl-direction-details ul").append(w).before("<div class='wpsl-direction-before'><a class='wpsl-back' id='wpsl-direction-start' href='#'>"+wpslLabels.back+"</a><div><span class='wpsl-total-distance'>"+a.legs[0].distance.text+"</span> - <span class='wpsl-total-durations'>"+a.legs[0].duration.text+"</span></div></div>").after("<p class='wpsl-direction-after'>"+t.routes[0].copyrights+"</p>"),e("#wpsl-direction-details").show(),r=0,n=ie.length;n>r;r++)ie[r].setMap(null);te&&te.clearMarkers(),"undefined"!=typeof se&&""!==se&&se.setMap(null),e("#wpsl-stores").hide(),1==wpslSettings.templateId&&(c=e("#wpsl-gmap").offset(),e(window).scrollTop(c.top))}}else G(s)})}function k(t){var s,o=!1,n=!1,i={address:e("#wpsl-search-input").val()};"undefined"==typeof wpslSettings.geocodeComponents||e.isEmptyObject(wpslSettings.geocodeComponents)||(i.componentRestrictions=wpslSettings.geocodeComponents),H.geocode(i,function(e,i){i==google.maps.GeocoderStatus.OK?(s=e[0].geometry.location,A(n),O(s,0,"",!0,t),N(s,pe,o,t)):D(i)})}function I(t){var s;H.geocode({latLng:t},function(t,o){o==google.maps.GeocoderStatus.OK?(s=x(t),""!==s&&e("#wpsl-search-input").val(s)):D(o)})}function x(e){var t,s,o,n=e[0].address_components.length;for(o=0;n>o;o++)s=e[0].address_components[o].types,(/^postal_code$/.test(s)||/^postal_code_prefix,postal_code$/.test(s))&&(t=e[0].address_components[o].long_name);return t}function N(e,t,s,o){1==wpslSettings.directionRedirect?E(e,function(){M(e,t,s,o)}):M(e,t,s,o)}function E(e,t){H.geocode({latLng:e},function(e,s){s==google.maps.GeocoderStatus.OK?(oe=e[0].formatted_address,t()):D(s)})}function M(t,s,o,n){var i,l,a,r="",p="",d=!1,w=e("#wpsl-wrap").hasClass("wpsl-mobile"),g=e("#wpsl-listing-template").html(),u=e("#wpsl-stores ul"),f=wpslSettings.url+"img/ajax-loader.gif",m={action:"store_search",lat:t.lat(),lng:t.lng()};s?(m.max_results=wpslSettings.maxResults,m.radius=wpslSettings.searchRadius):(w?(l=parseInt(e("#wpsl-results .wpsl-dropdown").val()),a=parseInt(e("#wpsl-radius .wpsl-dropdown").val())):(l=parseInt(e("#wpsl-results .wpsl-selected-item").attr("data-value")),a=parseInt(e("#wpsl-radius .wpsl-selected-item").attr("data-value"))),isNaN(l)?m.max_results=wpslSettings.maxResults:m.max_results=l,isNaN(a)?m.radius=wpslSettings.searchRadius:m.radius=a,e("#wpsl-category").length>0&&(p=w?parseInt(e("#wpsl-category .wpsl-dropdown").val()):parseInt(e("#wpsl-category .wpsl-selected-item").attr("data-value")),isNaN(p)||0===p||(m.filter=p))),1==o&&("undefined"!=typeof J?m.skip_cache=1:m.autoload=1),u.empty().append("<li class='wpsl-preloader'><img src='"+f+"'/>"+wpslLabels.preloader+"</li>"),e.get(wpslSettings.ajaxurl,m,function(t){e(".wpsl-preloader, .no-results").remove(),t.length>0?(e.each(t,function(e){_.extend(t[e],he),i=new google.maps.LatLng(t[e].lat,t[e].lng),O(i,t[e].id,t[e],d,n),r+=_.template(g,t[e])}),e("#wpsl-result-list").off("click",".wpsl-directions"),u.append(r),e("#wpsl-result-list").on("click",".wpsl-directions",function(){return 1!=wpslSettings.directionRedirect?(L(e(this)),!1):void 0}),P(),W(),e("#wpsl-result-list p:empty").remove()):u.html("<li class='no-results'>"+wpslLabels.noResults+"</li>"),1==wpslSettings.resetMap&&(e.isEmptyObject(re)&&google.maps.event.addListenerOnce(Q,"tilesloaded",function(){re={centerLatlng:Q.getCenter(),zoomLevel:Q.getZoom()},e("#wpsl-map-controls").addClass("wpsl-reset-exists"),e(".wpsl-icon-reset, #wpsl-reset-map").show()}),e(".wpsl-icon-reset").removeClass("wpsl-in-progress"))}),1!=wpslSettings.mouseFocus||c()||e("#wpsl-search-input").focus()}function P(){if(1==wpslSettings.markerClusters){var e=Number(wpslSettings.clusterZoom),t=Number(wpslSettings.clusterSize);isNaN(e)&&(e=""),isNaN(t)&&(t=""),te=new MarkerClusterer(Q,ie,{gridSize:t,maxZoom:e})}}function O(e,t,s,o,n){var i,l,a,r=!0;0===t?(s={store:wpslLabels.startPoint},i=le.url+wpslSettings.startMarker):i=le.url+wpslSettings.storeMarker,l={url:i,scaledSize:new google.maps.Size(Number(le.scaledSize[0]),Number(le.scaledSize[1])),origin:new google.maps.Point(Number(le.origin[0]),Number(le.origin[1])),anchor:new google.maps.Point(Number(le.anchor[0]),Number(le.anchor[1]))},a=new google.maps.Marker({position:e,map:Q,optimized:!1,title:R(s.store),draggable:o,storeId:t,icon:l}),ie.push(a),google.maps.event.addListener(a,"click",function(o){return function(){0!=t?"undefined"!=typeof wpslSettings.markerStreetView&&1==wpslSettings.markerStreetView?$(e,function(){T(a,U(s),n,o)}):T(a,U(s),n,o):T(a,wpslLabels.startPoint,n,o),google.maps.event.clearListeners(n,"domready"),google.maps.event.addListener(n,"domready",function(){z(a,o),Z()})}}(Q)),o&&google.maps.event.addListener(a,"dragend",function(e){A(r),Q.setCenter(e.latLng),I(e.latLng),N(e.latLng,pe,ce=!1,n)})}function R(e){return e?e.replace(/&#(\d+);/g,function(e,t){return String.fromCharCode(t)}):void 0}function T(e,t,s,o){ne.length=0,s.setContent(t),s.open(o,e),ne.push(s),"undefined"!=typeof wpslSettings.infoWindowStyle&&"infobox"==wpslSettings.infoWindowStyle&&1==wpslSettings.markerClusters&&(X=e.storeId,s.setVisible(!0))}function z(t,s){e(".wpsl-info-actions a").on("click",function(o){var n=Number(wpslSettings.autoZoomLevel);if(o.stopImmediatePropagation(),e(this).hasClass("wpsl-directions")){if(1==wpslSettings.directionRedirect)return!0;L(e(this))}else e(this).hasClass("wpsl-streetview")?B(t,s):e(this).hasClass("wpsl-zoom-here")&&(s.setCenter(t.getPosition()),s.setZoom(n));return!1})}function Z(){var t=Q.getZoom();t>=wpslSettings.autoZoomLevel?e(".wpsl-zoom-here").hide():e(".wpsl-zoom-here").show()}function B(t,s){var o=s.getStreetView();o.setPosition(t.getPosition()),o.setVisible(!0),e("#wpsl-map-controls").hide(),V(o,s)}function V(t,s){google.maps.event.addListener(t,"visible_changed",function(){if(!t.getVisible()){var o=s.getZoom();e("#wpsl-map-controls").show(),s.setZoom(o-1),s.setZoom(o)}})}function $(e,t){var s=new google.maps.StreetViewService;s.getPanoramaByLocation(e,50,function(e,s){de=s==google.maps.StreetViewStatus.OK?!0:!1,t()})}function U(t){var s,o;return o=e("#wpsl-base-gmap_0").length?e("#wpsl-cpt-info-window-template").html():e("#wpsl-info-window-template").html(),s=_.template(o,t)}function W(){var e,t,s=Number(wpslSettings.autoZoomLevel),o=new google.maps.LatLngBounds;for(google.maps.event.addListenerOnce(Q,"bounds_changed",function(e){this.getZoom()>s&&this.setZoom(s)}),e=0,t=ie.length;t>e;e++)o.extend(ie[e].position);Q.fitBounds(o)}function A(e){var t,s;if(q.setMap(null),ie){for(s=0,t=ie.length;t>s;s++)e?1!=ie[s].draggable?ie[s].setMap(null):se=ie[s]:ie[s].setMap(null);ie.length=0}te&&te.clearMarkers()}function D(e){var t;switch(e){case"ZERO_RESULTS":t=wpslLabels.noResults;break;case"OVER_QUERY_LIMIT":t=wpslLabels.queryLimit;break;default:t=wpslLabels.generalError}alert(t)}function G(e){var t;switch(e){case"NOT_FOUND":case"ZERO_RESULTS":t=wpslLabels.noDirectionsFound;break;case"OVER_QUERY_LIMIT":t=wpslLabels.queryLimit;break;default:t=wpslLabels.generalError}alert(t)}function j(){e(".wpsl-dropdown").each(function(t){var s,o,n=e(this);n.$dropdownWrap=n.wrap("<div class='wpsl-dropdown'></div>").parent(),n.$selectedVal=n.val(),n.$dropdownElem=e("<div><ul/></div>").appendTo(n.$dropdownWrap),n.$dropdown=n.$dropdownElem.find("ul"),n.$options=n.$dropdownWrap.find("option"),n.hide().removeClass("wpsl-dropdown"),e.each(n.$options,function(){s=e(this).val()==n.$selectedVal?'class="wpsl-selected-dropdown"':"",n.$dropdown.append("<li data-value="+e(this).val()+" "+s+">"+e(this).text()+"</li>")}),n.$dropdownElem.before("<span data-value="+n.find(":selected").val()+" class='wpsl-selected-item'>"+n.find(":selected").text()+"</span>"),n.$dropdownItem=n.$dropdownElem.find("li"),n.$dropdownWrap.on("click",function(t){K(),e(this).toggleClass("wpsl-active"),o=0,e(this).hasClass("wpsl-active")?(n.$dropdownItem.each(function(t){o+=e(this).outerHeight()}),n.$dropdownElem.css("height",o+2+"px")):n.$dropdownElem.css("height",0),t.stopPropagation()}),n.$dropdownItem.on("click",function(t){n.$dropdownWrap.find(e(".wpsl-selected-item")).html(e(this).text()).attr("data-value",e(this).attr("data-value")),n.$dropdownItem.removeClass("wpsl-selected-dropdown"),e(this).addClass("wpsl-selected-dropdown"),K(),t.stopPropagation()})}),e(document).click(function(){K()})}function K(){e(".wpsl-dropdown").removeClass("wpsl-active"),e(".wpsl-dropdown div").css("height",0)}function F(){e(".wpsl-search").hasClass("wpsl-widget")&&(e("#wpsl-search-btn").trigger("click"),e(".wpsl-search").removeClass("wpsl-widget"))}var H,Q,q,Y,J,X,ee,te,se,oe,ne=[],ie=[],le={},ae={},re={},pe=!1,de=!1,ce="undefined"!=typeof wpslSettings?wpslSettings.autoLoad:"";if(_.templateSettings={evaluate:/\<\%(.+?)\%\>/g,interpolate:/\<\%=(.+?)\%\>/g,escape:/\<\%-(.+?)\%\>/g},e(".wpsl-gmap-canvas").length&&(e("<img />").attr("src",wpslSettings.url+"img/ajax-loader.gif"),e(".wpsl-gmap-canvas").each(function(s){var o=e(this).attr("id");t(o,s)})),e("#wpsl-result-list").on("click",".wpsl-back",function(){var t,s;for(q.setMap(null),t=0,s=ie.length;s>t;t++)ie[t].setMap(Q);return"undefined"!=typeof se&&""!==se&&se.setMap(Q),te&&P(),Q.setCenter(ae.centerLatlng),Q.setZoom(ae.zoomLevel),e(".wpsl-direction-before, .wpsl-direction-after").remove(),e("#wpsl-stores").show(),e("#wpsl-direction-details").hide(),!1}),e("#wpsl-gmap").length&&("bounce"==wpslSettings.markerEffect?(e("#wpsl-stores").on("mouseenter","li",function(){y(e(this).data("store-id"),"start")}),e("#wpsl-stores").on("mouseleave","li",function(){y(e(this).data("store-id"),"stop")})):"info_window"==wpslSettings.markerEffect&&e("#wpsl-stores").on("mouseenter","li",function(){var t,s;for(t=0,s=ie.length;s>t;t++)ie[t].storeId==e(this).data("store-id")&&(google.maps.event.trigger(ie[t],"click"),Q.setCenter(ie[t].position))})),"undefined"!=typeof wpslSettings.infoWindowStyle&&"infobox"==wpslSettings.infoWindowStyle&&1==wpslSettings.markerClusters){var we,ge,ue,fe,me;google.maps.event.addListener(Q,"zoom_changed",function(){google.maps.event.addListenerOnce(Q,"idle",function(){if("undefined"!=typeof te&&(we=te.clusters_,we.length))for(fe=0,ge=we.length;ge>fe;fe++)for(me=0,ue=we[fe].markers_.length;ue>me;me++)if(we[fe].markers_[me].storeId==X){ee.getVisible()&&null===we[fe].markers_[me].map?ee.setVisible(!1):ee.getVisible()||null===we[fe].markers_[me].map||ee.setVisible(!0);break}})})}var he={formatPhoneNumber:function(e){return 1==wpslSettings.phoneUrl&&c()&&(e="<a href='tel:"+he.formatClickablePhoneNumber(e)+"'>"+e+"</a>"),e},formatClickablePhoneNumber:function(e){return-1!=e.indexOf("+")&&-1!=e.indexOf("(0)")&&(e=e.replace("(0)","")),e.replace(/(-| |\(|\)|\.|)/g,"")},createInfoWindowActions:function(t){var s,o="",n="";return e("#wpsl-gmap").length&&(de&&(o="<a class='wpsl-streetview' href='#'>"+wpslLabels.streetView+"</a>"),1==wpslSettings.markerZoomTo&&(n="<a class='wpsl-zoom-here' href='#'>"+wpslLabels.zoomHere+"</a>"),s="<div class='wpsl-info-actions'>"+he.createDirectionUrl(t)+o+n+"</div>"),s},createDirectionUrl:function(t){var s,o,n,i={};return 1==wpslSettings.directionRedirect?("undefined"==typeof oe&&(oe=""),i.target="target='_blank'","undefined"!=typeof t?i.src=e("[data-store-id="+t+"] .wpsl-directions").attr("href"):(n=this.zip?this.zip+", ":"",o=this.address+", "+this.city+", "+n+this.country,i.src="https://maps.google.com/maps?saddr="+he.rfc3986EncodeURIComponent(oe)+"&daddr="+he.rfc3986EncodeURIComponent(o))):i={src:"#",target:""},s="<a class='wpsl-directions' "+i.target+" href='"+i.src+"'>"+wpslLabels.directions+"</a>"},rfc3986EncodeURIComponent:function(e){return encodeURIComponent(e).replace(/[!'()*]/g,escape)}};if(e("#wpsl-search-input").keydown(function(t){var s=t.keyCode||t.which;13==s&&e("#wpsl-search-btn").trigger("click")}),e("#wpsl-stores").on("click",".wpsl-store-details",function(){var t,s,o=e(this).parents("li"),n=o.data("store-id");if("info window"==wpslSettings.moreInfoLocation)for(t=0,s=ie.length;s>t;t++)ie[t].storeId==n&&google.maps.event.trigger(ie[t],"click");else o.find(".wpsl-more-info-listings").is(":visible")?e(this).removeClass("wpsl-active-details"):e(this).addClass("wpsl-active-details"),o.siblings().find(".wpsl-store-details").removeClass("wpsl-active-details"),o.siblings().find(".wpsl-more-info-listings").hide(),o.find(".wpsl-more-info-listings").toggle();return"default"!=wpslSettings.templateId||"store listings"==wpslSettings.moreInfoLocation?!1:void 0}),e("a[href='#"+wpslSettings.mapTabAnchor+"']").length){var ve,Se,be=e("a[href='#"+wpslSettings.mapTabAnchor+"']");be.on("click",function(){return setTimeout(function(){ve=Q.getZoom(),Se=Q.getCenter(),google.maps.event.trigger(Q,"resize"),Q.setZoom(ve),Q.setCenter(Se),W()},50),!1})}});
1
+ jQuery(document).ready(function(e){function t(t,n){var p,g,u,m,v,S,b,y=Number(wpslSettings.autoZoomLevel);g=o(n),u=i(),H=new google.maps.Geocoder,q=new google.maps.DirectionsRenderer,Y=new google.maps.DirectionsService,p={zoom:Number(g.zoomLevel),center:g.startLatLng,mapTypeId:google.maps.MapTypeId[g.mapType.toUpperCase()],mapTypeControl:Number(g.mapTypeControl)?!0:!1,scrollwheel:Number(g.scrollWheel)?!0:!1,streetViewControl:Number(g.streetView)?!0:!1,zoomControlOptions:{position:google.maps.ControlPosition[g.controlPosition.toUpperCase()+"_TOP"]}},le=a(),Q=new google.maps.Map(document.getElementById(t),p),l(Q),r(g.mapStyle),"undefined"!=typeof window["wpslMap_"+n]&&"undefined"!=typeof window["wpslMap_"+n].locations&&(v=new google.maps.LatLngBounds,S=window["wpslMap_"+n].locations,b=S.length,e.each(S,function(e){m=new google.maps.LatLng(S[e].lat,S[e].lng),O(m,S[e].id,S[e],!1,u),v.extend(m)}),Q.fitBounds(v),google.maps.event.addListenerOnce(Q,"bounds_changed",function(e){return function(){e.getZoom()>y&&e.setZoom(y)}}(Q))),e("#wpsl-gmap").length&&(!c()&&e(".wpsl-dropdown").length?j():(e("#wpsl-search-wrap select").show(),e("#wpsl-wrap").addClass("wpsl-mobile")),e(".wpsl-search").hasClass("wpsl-widget")||(1==wpslSettings.autoLocate?w(g.startLatLng,u):1==wpslSettings.autoLoad&&d(g.startLatLng,u)),1!=wpslSettings.mouseFocus||c()||e("#wpsl-search-input").focus(),f(u),h(g,Q,u),F()),s()}function s(){"undefined"!=typeof wpslSettings.markerZoomTo&&1==wpslSettings.markerZoomTo&&google.maps.event.addListener(Q,"zoom_changed",function(){Z()})}function o(e){var t,s,o,i=["zoomLevel","mapType","mapTypeControl","mapStyle","streetView","scrollWheel","controlPosition"],l={zoomLevel:wpslSettings.zoomLevel,mapType:wpslSettings.mapType,mapTypeControl:wpslSettings.mapTypeControl,mapStyle:wpslSettings.mapStyle,streetView:wpslSettings.streetView,scrollWheel:wpslSettings.scrollWheel,controlPosition:wpslSettings.controlPosition};if("undefined"!=typeof window["wpslMap_"+e]&&"undefined"!=typeof window["wpslMap_"+e].shortCode)for(t=0,s=i.length;s>t;t++)o=window["wpslMap_"+e].shortCode[i[t]],"undefined"!=typeof o&&(l[i[t]]=o);return l.startLatLng=n(e),l}function n(e){var t,s,o="";return"undefined"!=typeof window["wpslMap_"+e]&&"undefined"!=typeof window["wpslMap_"+e].locations&&(o=window["wpslMap_"+e].locations[0]),"undefined"!=typeof o&&"undefined"!=typeof o.lat&&"undefined"!=typeof o.lng?t=new google.maps.LatLng(o.lat,o.lng):""!==wpslSettings.zoomLatlng?(s=wpslSettings.zoomLatlng.split(","),t=new google.maps.LatLng(s[0],s[1])):t=new google.maps.LatLng(0,0),t}function i(){var e,t,s={};return"undefined"!=typeof wpslSettings.infoWindowStyle&&"infobox"==wpslSettings.infoWindowStyle?(e=wpslSettings.infoBoxClearance.split(","),t=wpslSettings.infoBoxPixelOffset.split(","),s={alignBottom:!0,boxClass:wpslSettings.infoBoxClass,closeBoxMargin:wpslSettings.infoBoxCloseMargin,closeBoxURL:wpslSettings.infoBoxCloseUrl,content:"",disableAutoPan:Number(wpslSettings.infoBoxDisableAutoPan)?!0:!1,enableEventPropagation:Number(wpslSettings.infoBoxEnableEventPropagation)?!0:!1,infoBoxClearance:new google.maps.Size(Number(e[0]),Number(e[1])),pixelOffset:new google.maps.Size(Number(t[0]),Number(t[1])),zIndex:Number(wpslSettings.infoBoxZindex)},ee=new InfoBox(s)):ee=new google.maps.InfoWindow,ee}function l(t){var s=parseInt(wpslSettings.draggable.disableRes),o={draggable:Boolean(wpslSettings.draggable.enabled)};"NaN"!==s&&o.draggable&&(o.draggable=e(document).width()>s?!0:!1),t.setOptions(o)}function a(){var e,t=wpslSettings.markerIconProps,s={};"undefined"!=typeof t.url?s.url=t.url:s.url=wpslSettings.url+"img/markers/";for(var o in t)t.hasOwnProperty(o)&&(e=t[o].split(","),2==e.length&&(s[o]=e));return s}function r(e){e=p(e),e&&Q.setOptions({styles:e})}function p(e){try{var t=JSON.parse(e);if(t&&"object"==typeof t&&null!==t)return t}catch(s){}return!1}function d(e,t){O(e,0,"",!0,t),N(e,pe,ce,t)}function c(){return/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)}function w(t,s){if(navigator.geolocation){var o,n,i=!1,l=Number(wpslSettings.geoLocationTimout);o=setInterval(function(){e(".wpsl-icon-direction").toggleClass("wpsl-active-icon")},600),n=setTimeout(function(){g(o),d(t,s)},l),navigator.geolocation.getCurrentPosition(function(e){g(o),clearTimeout(n),A(i),u(t,e,pe,s)},function(o){if(e(".wpsl-icon-direction").hasClass("wpsl-user-activated")){switch(o.code){case o.PERMISSION_DENIED:alert(wpslGeolocationErrors.denied);break;case o.POSITION_UNAVAILABLE:alert(wpslGeolocationErrors.unavailable);break;case o.TIMEOUT:alert(wpslGeolocationErrors.timeout);break;default:alert(wpslGeolocationErrors.generalError)}e(".wpsl-icon-direction").removeClass("wpsl-active-icon")}else clearTimeout(n),d(t,s)},{maximumAge:6e4,timeout:l,enableHighAccuracy:!0})}else alert(wpslGeolocationErrors.unavailable),d(t,s)}function g(t){clearInterval(t),e(".wpsl-icon-direction").removeClass("wpsl-active-icon")}function u(e,t,s,o){if("undefined"==typeof t)d(e,o);else{var n=new google.maps.LatLng(t.coords.latitude,t.coords.longitude);J=t,k(n),Q.setCenter(n),O(n,0,"",!0,o),N(n,s,ce,o)}}function f(t){e("#wpsl-search-btn").on("click",function(){var s=!1;e("#wpsl-search-input").removeClass(),e("#wpsl-search-input").val()?(e("#wpsl-result-list ul").empty(),e("#wpsl-stores").show(),e(".wpsl-direction-before, .wpsl-direction-after").remove(),e("#wpsl-direction-details").hide(),pe=!1,m(),A(s),S(),I(t)):e("#wpsl-search-input").addClass("wpsl-error").focus()})}function m(){"undefined"!=typeof wpslSettings.infoWindowStyle&&"infobox"==wpslSettings.infoWindowStyle&&"undefined"!=typeof ne[0]&&ne[0].close()}function h(t,s,o){google.maps.event.addListenerOnce(s,"tilesloaded",function(){e(".gm-style").append(wpslSettings.mapControls),e(".wpsl-icon-reset, #wpsl-reset-map").length>0&&(v(t.startLatLng,o),e(".wpsl-icon-reset").hide()),e(".wpsl-icon-direction").on("click",function(){e(this).addClass("wpsl-user-activated"),w(t.startLatLng,o)})})}function v(t,s){e(".wpsl-icon-reset, #wpsl-reset-map").on("click",function(){var o=!1,n=!0;e(this).hasClass("wpsl-in-progress")||(1==wpslSettings.autoLoad&&(ce=1),(Q.getCenter().lat()!==re.centerLatlng.lat()||Q.getCenter().lng()!==re.centerLatlng.lng()||Q.getZoom()!==re.zoomLevel)&&(A(o),e("#wpsl-search-input").val("").removeClass(),e(".wpsl-icon-reset").addClass("wpsl-in-progress"),te&&te.clearMarkers(),S(),b(),1==wpslSettings.autoLocate?u(t,J,n,s):d(t,s)),e("#wpsl-stores").show(),e("#wpsl-direction-details").hide())})}function S(){"undefined"!=typeof se&&""!==se&&(se.setMap(null),se="")}function b(){var t,s,o,n,i=[wpslSettings.searchRadius+" "+wpslSettings.distanceUnit,wpslSettings.maxResults],l=["wpsl-radius","wpsl-results"];for(t=0,s=l.length;s>t;t++)e("#"+l[t]+" select").val(parseInt(i[t])),e("#"+l[t]+" li").removeClass(),"wpsl-radius"==l[t]?o=wpslSettings.searchRadius:"wpsl-results"==l[t]&&(o=wpslSettings.maxResults),e("#"+l[t]+" li").each(function(){e(this).text()===i[t]&&(e(this).addClass("wpsl-selected-dropdown"),e("#"+l[t]+" .wpsl-selected-item").html(i[t]).attr("data-value",o))});e("#wpsl-category").length&&(e("#wpsl-category select").val(0),e("#wpsl-category li").removeClass(),e("#wpsl-category li:first-child").addClass("wpsl-selected-dropdown"),n=e("#wpsl-category li:first-child").text(),e("#wpsl-category .wpsl-selected-item").html(n).attr("data-value",0))}function y(t){var s,o,n,i,l;for(m(),l=t.parents("li").length>0?t.parents("li").data("store-id"):t.parents(".wpsl-info-window").data("store-id"),"undefined"!=typeof se&&""!==se&&(o=se.getPosition()),ae={centerLatlng:Q.getCenter(),zoomLevel:Q.getZoom()},s=0,i=ie.length;i>s;s++)0!=ie[s].storeId||"undefined"!=typeof o&&""!==o?ie[s].storeId==l&&(n=ie[s].getPosition()):o=ie[s].getPosition();o&&n?(e("#wpsl-direction-details ul").empty(),e(".wpsl-direction-before, .wpsl-direction-after").remove(),C(o,n)):alert(wpslLabels.generalError)}function L(e,t){var s,o,n;for(s=0,o=ie.length;o>s;s++)ie[s].storeId==e&&(n=ie[s],"start"==t?n.setAnimation(google.maps.Animation.BOUNCE):n.setAnimation(null))}function C(t,s){var o,n,i,l,a,r,p,d,c,w="",g={};d="km"==wpslSettings.distanceUnit?"METRIC":"IMPERIAL",g={origin:t,destination:s,travelMode:google.maps.DirectionsTravelMode.DRIVING,unitSystem:google.maps.UnitSystem[d]},Y.route(g,function(t,s){if(s==google.maps.DirectionsStatus.OK){if(q.setMap(Q),q.setDirections(t),t.routes.length>0){for(a=t.routes[0],r=0;r<a.legs.length;r++)for(o=a.legs[r],p=0,n=o.steps.length;n>p;p++)i=o.steps[p],l=p+1,w=w+"<li><div class='wpsl-direction-index'>"+l+"</div><div class='wpsl-direction-txt'>"+i.instructions+"</div><div class='wpsl-direction-distance'>"+i.distance.text+"</div></li>";for(e("#wpsl-direction-details ul").append(w).before("<div class='wpsl-direction-before'><a class='wpsl-back' id='wpsl-direction-start' href='#'>"+wpslLabels.back+"</a><div><span class='wpsl-total-distance'>"+a.legs[0].distance.text+"</span> - <span class='wpsl-total-durations'>"+a.legs[0].duration.text+"</span></div></div>").after("<p class='wpsl-direction-after'>"+t.routes[0].copyrights+"</p>"),e("#wpsl-direction-details").show(),r=0,n=ie.length;n>r;r++)ie[r].setMap(null);te&&te.clearMarkers(),"undefined"!=typeof se&&""!==se&&se.setMap(null),e("#wpsl-stores").hide(),1==wpslSettings.templateId&&(c=e("#wpsl-gmap").offset(),e(window).scrollTop(c.top))}}else G(s)})}function I(t){var s,o=!1,n=!1,i={address:e("#wpsl-search-input").val()};"undefined"==typeof wpslSettings.geocodeComponents||e.isEmptyObject(wpslSettings.geocodeComponents)||(i.componentRestrictions=wpslSettings.geocodeComponents),H.geocode(i,function(e,i){i==google.maps.GeocoderStatus.OK?(s=e[0].geometry.location,A(n),O(s,0,"",!0,t),N(s,pe,o,t)):D(i)})}function k(t){var s;H.geocode({latLng:t},function(t,o){o==google.maps.GeocoderStatus.OK?(s=x(t),""!==s&&e("#wpsl-search-input").val(s)):D(o)})}function x(e){var t,s,o,n=e[0].address_components.length;for(o=0;n>o;o++)s=e[0].address_components[o].types,(/^postal_code$/.test(s)||/^postal_code_prefix,postal_code$/.test(s))&&(t=e[0].address_components[o].long_name);return t}function N(e,t,s,o){1==wpslSettings.directionRedirect?E(e,function(){M(e,t,s,o)}):M(e,t,s,o)}function E(e,t){H.geocode({latLng:e},function(e,s){s==google.maps.GeocoderStatus.OK?(oe=e[0].formatted_address,t()):D(s)})}function M(t,s,o,n){var i,l,a,r="",p="",d=!1,w=e("#wpsl-wrap").hasClass("wpsl-mobile"),g=e("#wpsl-listing-template").html(),u=e("#wpsl-stores ul"),f=wpslSettings.url+"img/ajax-loader.gif",m={action:"store_search",lat:t.lat(),lng:t.lng()};s?(m.max_results=wpslSettings.maxResults,m.radius=wpslSettings.searchRadius):(w?(l=parseInt(e("#wpsl-results .wpsl-dropdown").val()),a=parseInt(e("#wpsl-radius .wpsl-dropdown").val())):(l=parseInt(e("#wpsl-results .wpsl-selected-item").attr("data-value")),a=parseInt(e("#wpsl-radius .wpsl-selected-item").attr("data-value"))),isNaN(l)?m.max_results=wpslSettings.maxResults:m.max_results=l,isNaN(a)?m.radius=wpslSettings.searchRadius:m.radius=a,"undefined"!=typeof wpslSettings.categoryIds?m.filter=wpslSettings.categoryIds:e("#wpsl-category").length>0&&(p=w?parseInt(e("#wpsl-category .wpsl-dropdown").val()):parseInt(e("#wpsl-category .wpsl-selected-item").attr("data-value")),isNaN(p)||0===p||(m.filter=p))),1==o&&("undefined"!=typeof J?m.skip_cache=1:(m.autoload=1,"undefined"!=typeof wpslSettings.categoryIds&&(m.filter=wpslSettings.categoryIds))),u.empty().append("<li class='wpsl-preloader'><img src='"+f+"'/>"+wpslLabels.preloader+"</li>"),e.get(wpslSettings.ajaxurl,m,function(t){e(".wpsl-preloader, .no-results").remove(),t.length>0?(e.each(t,function(e){_.extend(t[e],he),i=new google.maps.LatLng(t[e].lat,t[e].lng),O(i,t[e].id,t[e],d,n),r+=_.template(g,t[e])}),e("#wpsl-result-list").off("click",".wpsl-directions"),u.append(r),e("#wpsl-result-list").on("click",".wpsl-directions",function(){return 1!=wpslSettings.directionRedirect?(y(e(this)),!1):void 0}),P(),W(),e("#wpsl-result-list p:empty").remove()):u.html("<li class='no-results'>"+wpslLabels.noResults+"</li>"),1==wpslSettings.resetMap&&(e.isEmptyObject(re)&&google.maps.event.addListenerOnce(Q,"tilesloaded",function(){re={centerLatlng:Q.getCenter(),zoomLevel:Q.getZoom()},e("#wpsl-map-controls").addClass("wpsl-reset-exists"),e(".wpsl-icon-reset, #wpsl-reset-map").show()}),e(".wpsl-icon-reset").removeClass("wpsl-in-progress"))}),1!=wpslSettings.mouseFocus||c()||e("#wpsl-search-input").focus()}function P(){if(1==wpslSettings.markerClusters){var e=Number(wpslSettings.clusterZoom),t=Number(wpslSettings.clusterSize);isNaN(e)&&(e=""),isNaN(t)&&(t=""),te=new MarkerClusterer(Q,ie,{gridSize:t,maxZoom:e})}}function O(e,t,s,o,n){var i,l,a,r=!0;0===t?(s={store:wpslLabels.startPoint},i=le.url+wpslSettings.startMarker):i=le.url+wpslSettings.storeMarker,l={url:i,scaledSize:new google.maps.Size(Number(le.scaledSize[0]),Number(le.scaledSize[1])),origin:new google.maps.Point(Number(le.origin[0]),Number(le.origin[1])),anchor:new google.maps.Point(Number(le.anchor[0]),Number(le.anchor[1]))},a=new google.maps.Marker({position:e,map:Q,optimized:!1,title:R(s.store),draggable:o,storeId:t,icon:l}),ie.push(a),google.maps.event.addListener(a,"click",function(o){return function(){0!=t?"undefined"!=typeof wpslSettings.markerStreetView&&1==wpslSettings.markerStreetView?$(e,function(){T(a,U(s),n,o)}):T(a,U(s),n,o):T(a,wpslLabels.startPoint,n,o),google.maps.event.clearListeners(n,"domready"),google.maps.event.addListener(n,"domready",function(){z(a,o),Z()})}}(Q)),o&&google.maps.event.addListener(a,"dragend",function(e){A(r),Q.setCenter(e.latLng),k(e.latLng),N(e.latLng,pe,ce=!1,n)})}function R(e){return e?e.replace(/&#(\d+);/g,function(e,t){return String.fromCharCode(t)}):void 0}function T(e,t,s,o){ne.length=0,s.setContent(t),s.open(o,e),ne.push(s),"undefined"!=typeof wpslSettings.infoWindowStyle&&"infobox"==wpslSettings.infoWindowStyle&&1==wpslSettings.markerClusters&&(X=e.storeId,s.setVisible(!0))}function z(t,s){e(".wpsl-info-actions a").on("click",function(o){var n=Number(wpslSettings.autoZoomLevel);if(o.stopImmediatePropagation(),e(this).hasClass("wpsl-directions")){if(1==wpslSettings.directionRedirect)return!0;y(e(this))}else e(this).hasClass("wpsl-streetview")?B(t,s):e(this).hasClass("wpsl-zoom-here")&&(s.setCenter(t.getPosition()),s.setZoom(n));return!1})}function Z(){var t=Q.getZoom();t>=wpslSettings.autoZoomLevel?e(".wpsl-zoom-here").hide():e(".wpsl-zoom-here").show()}function B(t,s){var o=s.getStreetView();o.setPosition(t.getPosition()),o.setVisible(!0),e("#wpsl-map-controls").hide(),V(o,s)}function V(t,s){google.maps.event.addListener(t,"visible_changed",function(){if(!t.getVisible()){var o=s.getZoom();e("#wpsl-map-controls").show(),s.setZoom(o-1),s.setZoom(o)}})}function $(e,t){var s=new google.maps.StreetViewService;s.getPanoramaByLocation(e,50,function(e,s){de=s==google.maps.StreetViewStatus.OK?!0:!1,t()})}function U(t){var s,o;return o=e("#wpsl-base-gmap_0").length?e("#wpsl-cpt-info-window-template").html():e("#wpsl-info-window-template").html(),s=_.template(o,t)}function W(){var e,t,s=Number(wpslSettings.autoZoomLevel),o=new google.maps.LatLngBounds;for(google.maps.event.addListenerOnce(Q,"bounds_changed",function(e){this.getZoom()>s&&this.setZoom(s)}),e=0,t=ie.length;t>e;e++)o.extend(ie[e].position);Q.fitBounds(o)}function A(e){var t,s;if(q.setMap(null),ie){for(s=0,t=ie.length;t>s;s++)e?1!=ie[s].draggable?ie[s].setMap(null):se=ie[s]:ie[s].setMap(null);ie.length=0}te&&te.clearMarkers()}function D(e){var t;switch(e){case"ZERO_RESULTS":t=wpslLabels.noResults;break;case"OVER_QUERY_LIMIT":t=wpslLabels.queryLimit;break;default:t=wpslLabels.generalError}alert(t)}function G(e){var t;switch(e){case"NOT_FOUND":case"ZERO_RESULTS":t=wpslLabels.noDirectionsFound;break;case"OVER_QUERY_LIMIT":t=wpslLabels.queryLimit;break;default:t=wpslLabels.generalError}alert(t)}function j(){e(".wpsl-dropdown").each(function(t){var s,o,n=e(this);n.$dropdownWrap=n.wrap("<div class='wpsl-dropdown'></div>").parent(),n.$selectedVal=n.val(),n.$dropdownElem=e("<div><ul/></div>").appendTo(n.$dropdownWrap),n.$dropdown=n.$dropdownElem.find("ul"),n.$options=n.$dropdownWrap.find("option"),n.hide().removeClass("wpsl-dropdown"),e.each(n.$options,function(){s=e(this).val()==n.$selectedVal?'class="wpsl-selected-dropdown"':"",n.$dropdown.append("<li data-value="+e(this).val()+" "+s+">"+e(this).text()+"</li>")}),n.$dropdownElem.before("<span data-value="+n.find(":selected").val()+" class='wpsl-selected-item'>"+n.find(":selected").text()+"</span>"),n.$dropdownItem=n.$dropdownElem.find("li"),n.$dropdownWrap.on("click",function(t){K(),e(this).toggleClass("wpsl-active"),o=0,e(this).hasClass("wpsl-active")?(n.$dropdownItem.each(function(t){o+=e(this).outerHeight()}),n.$dropdownElem.css("height",o+2+"px")):n.$dropdownElem.css("height",0),t.stopPropagation()}),n.$dropdownItem.on("click",function(t){n.$dropdownWrap.find(e(".wpsl-selected-item")).html(e(this).text()).attr("data-value",e(this).attr("data-value")),n.$dropdownItem.removeClass("wpsl-selected-dropdown"),e(this).addClass("wpsl-selected-dropdown"),K(),t.stopPropagation()})}),e(document).click(function(){K()})}function K(){e(".wpsl-dropdown").removeClass("wpsl-active"),e(".wpsl-dropdown div").css("height",0)}function F(){e(".wpsl-search").hasClass("wpsl-widget")&&(e("#wpsl-search-btn").trigger("click"),e(".wpsl-search").removeClass("wpsl-widget"))}var H,Q,q,Y,J,X,ee,te,se,oe,ne=[],ie=[],le={},ae={},re={},pe=!1,de=!1,ce="undefined"!=typeof wpslSettings?wpslSettings.autoLoad:"";if(_.templateSettings={evaluate:/\<\%(.+?)\%\>/g,interpolate:/\<\%=(.+?)\%\>/g,escape:/\<\%-(.+?)\%\>/g},e(".wpsl-gmap-canvas").length&&(e("<img />").attr("src",wpslSettings.url+"img/ajax-loader.gif"),e(".wpsl-gmap-canvas").each(function(s){var o=e(this).attr("id");t(o,s)})),e("#wpsl-result-list").on("click",".wpsl-back",function(){var t,s;for(q.setMap(null),t=0,s=ie.length;s>t;t++)ie[t].setMap(Q);return"undefined"!=typeof se&&""!==se&&se.setMap(Q),te&&P(),Q.setCenter(ae.centerLatlng),Q.setZoom(ae.zoomLevel),e(".wpsl-direction-before, .wpsl-direction-after").remove(),e("#wpsl-stores").show(),e("#wpsl-direction-details").hide(),!1}),e("#wpsl-gmap").length&&("bounce"==wpslSettings.markerEffect?(e("#wpsl-stores").on("mouseenter","li",function(){L(e(this).data("store-id"),"start")}),e("#wpsl-stores").on("mouseleave","li",function(){L(e(this).data("store-id"),"stop")})):"info_window"==wpslSettings.markerEffect&&e("#wpsl-stores").on("mouseenter","li",function(){var t,s;for(t=0,s=ie.length;s>t;t++)ie[t].storeId==e(this).data("store-id")&&(google.maps.event.trigger(ie[t],"click"),Q.setCenter(ie[t].position))})),"undefined"!=typeof wpslSettings.infoWindowStyle&&"infobox"==wpslSettings.infoWindowStyle&&1==wpslSettings.markerClusters){var we,ge,ue,fe,me;google.maps.event.addListener(Q,"zoom_changed",function(){google.maps.event.addListenerOnce(Q,"idle",function(){if("undefined"!=typeof te&&(we=te.clusters_,we.length))for(fe=0,ge=we.length;ge>fe;fe++)for(me=0,ue=we[fe].markers_.length;ue>me;me++)if(we[fe].markers_[me].storeId==X){ee.getVisible()&&null===we[fe].markers_[me].map?ee.setVisible(!1):ee.getVisible()||null===we[fe].markers_[me].map||ee.setVisible(!0);break}})})}var he={formatPhoneNumber:function(e){return 1==wpslSettings.phoneUrl&&c()&&(e="<a href='tel:"+he.formatClickablePhoneNumber(e)+"'>"+e+"</a>"),e},formatClickablePhoneNumber:function(e){return-1!=e.indexOf("+")&&-1!=e.indexOf("(0)")&&(e=e.replace("(0)","")),e.replace(/(-| |\(|\)|\.|)/g,"")},createInfoWindowActions:function(t){var s,o="",n="";return e("#wpsl-gmap").length&&(de&&(o="<a class='wpsl-streetview' href='#'>"+wpslLabels.streetView+"</a>"),1==wpslSettings.markerZoomTo&&(n="<a class='wpsl-zoom-here' href='#'>"+wpslLabels.zoomHere+"</a>"),s="<div class='wpsl-info-actions'>"+he.createDirectionUrl(t)+o+n+"</div>"),s},createDirectionUrl:function(t){var s,o,n,i={};return 1==wpslSettings.directionRedirect?("undefined"==typeof oe&&(oe=""),i.target="target='_blank'","undefined"!=typeof t?i.src=e("[data-store-id="+t+"] .wpsl-directions").attr("href"):(n=this.zip?this.zip+", ":"",o=this.address+", "+this.city+", "+n+this.country,i.src="https://maps.google.com/maps?saddr="+he.rfc3986EncodeURIComponent(oe)+"&daddr="+he.rfc3986EncodeURIComponent(o))):i={src:"#",target:""},s="<a class='wpsl-directions' "+i.target+" href='"+i.src+"'>"+wpslLabels.directions+"</a>"},rfc3986EncodeURIComponent:function(e){return encodeURIComponent(e).replace(/[!'()*]/g,escape)}};if(e("#wpsl-search-input").keydown(function(t){var s=t.keyCode||t.which;13==s&&e("#wpsl-search-btn").trigger("click")}),e("#wpsl-stores").on("click",".wpsl-store-details",function(){var t,s,o=e(this).parents("li"),n=o.data("store-id");if("info window"==wpslSettings.moreInfoLocation)for(t=0,s=ie.length;s>t;t++)ie[t].storeId==n&&google.maps.event.trigger(ie[t],"click");else o.find(".wpsl-more-info-listings").is(":visible")?e(this).removeClass("wpsl-active-details"):e(this).addClass("wpsl-active-details"),o.siblings().find(".wpsl-store-details").removeClass("wpsl-active-details"),o.siblings().find(".wpsl-more-info-listings").hide(),o.find(".wpsl-more-info-listings").toggle();return"default"!=wpslSettings.templateId||"store listings"==wpslSettings.moreInfoLocation?!1:void 0}),e("a[href='#"+wpslSettings.mapTabAnchor+"']").length){var ve,Se,be=e("a[href='#"+wpslSettings.mapTabAnchor+"']");be.on("click",function(){return setTimeout(function(){ve=Q.getZoom(),Se=Q.getCenter(),google.maps.event.trigger(Q,"resize"),Q.setZoom(ve),Q.setCenter(Se),W()},50),!1})}});
readme.txt CHANGED
@@ -4,8 +4,8 @@ Contributors: tijmensmit
4
  Donate link: https://www.paypal.me/tijmensmit
5
  Tags: google maps, store locator, business locations, geocoding, stores, geo, zipcode locator, dealer locater, geocode, gmaps, google map, google map plugin, location finder, map tools, shop locator, wp google map
6
  Requires at least: 3.7
7
- Tested up to: 4.4
8
- Stable tag: 2.1.0
9
  License: GPLv3
10
  License URI: http://www.gnu.org/licenses/gpl.html
11
 
@@ -48,7 +48,6 @@ Please take a look at the store locator [documentation](https://wpstorelocator.c
48
  * [Filters](https://wpstorelocator.co/documentation/filters/)
49
 
50
  = Premium Add-ons =
51
-
52
 
53
  **CSV Manager**
54
 
@@ -114,13 +113,21 @@ If you find a plugin or theme that causes a conflict, please report it on the [s
114
 
115
  == Changelog ==
116
 
 
 
 
 
 
 
 
 
117
  = 2.1.0, December 23, 2015 =
118
  * Added: You can now use the "category" attribute ( use the category slugs as values ) on the [wpsl_map] shortcode to show locations that belong to one or more categories.
119
  * Added: Support to load the marker images from a [different folder](https://wpstorelocator.co/document/use-custom-markers/).
120
  * Added: A [wpsl_marker_props](https://wpstorelocator.co/document/wpsl_marker_props) filter that enables you to change the default "anchor", "scaledSize" and "origin" for the [marker image](https://developers.google.com/maps/documentation/javascript/3.exp/reference#Icon).
121
  * Added: A [wpsl_geocode_components](https://wpstorelocator.co/document/wpsl_geocode_components) filter that enables you to restrict the returned geocode results by administrativeArea, country, locality, postalCode and route.
122
  * Added: A [wpsl_draggable](https://wpstorelocator.co/document/wpsl_draggable_map) filter that enables you to enable/disable the dragging of the map.
123
- * Added: Support for the upcoming [add-ons](https://wpstorelocator.co/add-ons/).
124
  * Note: Read [this](https://wpstorelocator.co/version-2-1-released/#widget-support) if you're using a custom template!
125
  * Changed: If you need to geocode the full address ( new store ), and a value for 'state' is provided it's now included in the geocode request.
126
  * Changed: If the Geocode API returns a REQUEST_DENIED status, then the returned error message is shown explaining why it failed.
4
  Donate link: https://www.paypal.me/tijmensmit
5
  Tags: google maps, store locator, business locations, geocoding, stores, geo, zipcode locator, dealer locater, geocode, gmaps, google map, google map plugin, location finder, map tools, shop locator, wp google map
6
  Requires at least: 3.7
7
+ Tested up to: 4.4.1
8
+ Stable tag: 2.1.1
9
  License: GPLv3
10
  License URI: http://www.gnu.org/licenses/gpl.html
11
 
48
  * [Filters](https://wpstorelocator.co/documentation/filters/)
49
 
50
  = Premium Add-ons =
 
51
 
52
  **CSV Manager**
53
 
113
 
114
  == Changelog ==
115
 
116
+ = 2.1.1, January 13, 2016 =
117
+ * Added: Restrict the search results to one or more categories by using the "category" attribute on the [wpsl] [shortcode](https://wpstorelocator.co/document/shortcodes/#store-locator).
118
+ * Added: A "start_location" attribute for the [wpsl] [shortcode](https://wpstorelocator.co/document/shortcodes/#store-locator).
119
+ * Added: Included a link to the add-ons page in the plugin meta row.
120
+ * Added: Support for the "wp_editor" type with the [wpsl_meta_box_fields](https://wpstorelocator.co/document/wpsl_meta_box_fields/) filter, this will render the default WP Editor. Via [Richard](http://ampersandstudio.uk/).
121
+ * Changed: Moved the documentation link from the plugin actions row to the plugin meta row.
122
+ * Changed: If you use the "category" attribute on the [wpsl_map] shortcode, then the store names in the marker info window will automatically link to the store page or custom url.
123
+
124
  = 2.1.0, December 23, 2015 =
125
  * Added: You can now use the "category" attribute ( use the category slugs as values ) on the [wpsl_map] shortcode to show locations that belong to one or more categories.
126
  * Added: Support to load the marker images from a [different folder](https://wpstorelocator.co/document/use-custom-markers/).
127
  * Added: A [wpsl_marker_props](https://wpstorelocator.co/document/wpsl_marker_props) filter that enables you to change the default "anchor", "scaledSize" and "origin" for the [marker image](https://developers.google.com/maps/documentation/javascript/3.exp/reference#Icon).
128
  * Added: A [wpsl_geocode_components](https://wpstorelocator.co/document/wpsl_geocode_components) filter that enables you to restrict the returned geocode results by administrativeArea, country, locality, postalCode and route.
129
  * Added: A [wpsl_draggable](https://wpstorelocator.co/document/wpsl_draggable_map) filter that enables you to enable/disable the dragging of the map.
130
+ * Added: Support for the upcoming add-ons.
131
  * Note: Read [this](https://wpstorelocator.co/version-2-1-released/#widget-support) if you're using a custom template!
132
  * Changed: If you need to geocode the full address ( new store ), and a value for 'state' is provided it's now included in the geocode request.
133
  * Changed: If the Geocode API returns a REQUEST_DENIED status, then the returned error message is shown explaining why it failed.
uninstall.php CHANGED
@@ -48,7 +48,7 @@ function wpsl_uninstall() {
48
  }
49
 
50
  delete_user_meta( $current_user->ID, 'wpsl_disable_location_warning' );
51
- delete_user_meta( $current_user->ID, 'wpsl_stores_per_page' );
52
 
53
  // Disable the time limit before we start removing all the store location posts.
54
  @set_time_limit( 0 );
48
  }
49
 
50
  delete_user_meta( $current_user->ID, 'wpsl_disable_location_warning' );
51
+ delete_user_meta( $current_user->ID, 'wpsl_stores_per_page' ); // Not used in 2.x, but was used in 1.x
52
 
53
  // Disable the time limit before we start removing all the store location posts.
54
  @set_time_limit( 0 );
wp-store-locator.php CHANGED
@@ -4,7 +4,7 @@ Plugin Name: WP Store Locator
4
  Description: An easy to use location management system that enables users to search for nearby physical stores
5
  Author: Tijmen Smit
6
  Author URI: https://wpstorelocator.co/
7
- Version: 2.1.0
8
  Text Domain: wpsl
9
  Domain Path: /languages/
10
  License: GPL v3
@@ -58,7 +58,7 @@ if ( !class_exists( 'WP_Store_locator' ) ) {
58
  public function define_constants() {
59
 
60
  if ( !defined( 'WPSL_VERSION_NUM' ) )
61
- define( 'WPSL_VERSION_NUM', '2.1.0' );
62
 
63
  if ( !defined( 'WPSL_URL' ) )
64
  define( 'WPSL_URL', plugin_dir_url( __FILE__ ) );
4
  Description: An easy to use location management system that enables users to search for nearby physical stores
5
  Author: Tijmen Smit
6
  Author URI: https://wpstorelocator.co/
7
+ Version: 2.1.1
8
  Text Domain: wpsl
9
  Domain Path: /languages/
10
  License: GPL v3
58
  public function define_constants() {
59
 
60
  if ( !defined( 'WPSL_VERSION_NUM' ) )
61
+ define( 'WPSL_VERSION_NUM', '2.1.1' );
62
 
63
  if ( !defined( 'WPSL_URL' ) )
64
  define( 'WPSL_URL', plugin_dir_url( __FILE__ ) );