WP Store Locator - Version 1.2.12

Version Description

  • Added an option to choose where the 'More info' details is shown, either in the store listings or on the map
  • Added the 'back' and 'reset' text to the label fields on the settings page
  • Added the option to remove the scrollbar when the store listings are shown below the map
  • Improved the position of the reset button when the map controls are right aligned
  • Fixed the 'More info' translation not working
  • Fixed the start position marker disappearing when dragged
Download this release

Release Info

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

Code changes from version 1.2.11 to 1.2.12

admin/class-admin.php CHANGED
@@ -84,20 +84,19 @@ if ( !class_exists( 'WPSL_Admin' ) ) {
84
  /* Add the default value for the reset map option */
85
  if ( empty( $this->settings['reset_map'] ) ) {
86
  $this->settings['reset_map'] = 0;
87
- update_option( 'wpsl_settings', $this->settings );
88
  }
89
 
90
  /* Add the default value for the way the store listings are shown, either below or next to the map */
91
  if ( empty( $this->settings['auto_load'] ) ) {
92
  $this->settings['auto_load'] = 1;
93
- update_option( 'wpsl_settings', $this->settings );
94
  }
95
 
96
  /* Add the default value for the route redirect */
97
  if ( empty( $this->settings['new_window'] ) ) {
98
  $this->settings['new_window'] = 0;
99
- update_option( 'wpsl_settings', $this->settings );
100
- }
 
101
  }
102
  }
103
 
@@ -106,14 +105,14 @@ if ( !class_exists( 'WPSL_Admin' ) ) {
106
  /* Add the default value for the way the store listings are shown, either below or next to the map */
107
  if ( empty( $this->settings['store_below'] ) ) {
108
  $this->settings['store_below'] = 0;
109
- update_option( 'wpsl_settings', $this->settings );
110
  }
111
 
112
  /* Add the default value for the route redirect */
113
  if ( empty( $this->settings['direction_redirect'] ) ) {
114
  $this->settings['direction_redirect'] = 0;
115
- update_option( 'wpsl_settings', $this->settings );
116
- }
 
117
  }
118
  }
119
 
@@ -122,23 +121,48 @@ if ( !class_exists( 'WPSL_Admin' ) ) {
122
  /* Add the default value for the 'more info' link option */
123
  if ( empty( $this->settings['more_info'] ) ) {
124
  $this->settings['more_info'] = 0;
125
- update_option( 'wpsl_settings', $this->settings );
126
  }
127
 
128
  /* Add the default value for the 'more info' label */
129
  if ( empty( $this->settings['more_label'] ) ) {
130
  $this->settings['more_label'] = 'More info';
131
- update_option( 'wpsl_settings', $this->settings );
132
  }
133
 
134
  /* Add the default value mouse focus option */
135
  if ( empty( $this->settings['mouse_focus'] ) ) {
136
  $this->settings['mouse_focus'] = 1;
137
- update_option( 'wpsl_settings', $this->settings );
138
  }
 
 
139
  }
140
  }
141
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
142
  update_option( 'wpsl_version', WPSL_VERSION_NUM );
143
  }
144
 
@@ -508,7 +532,6 @@ if ( !class_exists( 'WPSL_Admin' ) ) {
508
  * @return array $output The setting values
509
  */
510
  public function sanitize_settings() {
511
-
512
  $map_types = array(
513
  'roadmap',
514
  'satellite',
@@ -523,6 +546,10 @@ if ( !class_exists( 'WPSL_Admin' ) ) {
523
  'km',
524
  'mi'
525
  );
 
 
 
 
526
 
527
  $output['api_key'] = sanitize_text_field( $_POST['wpsl_api']['key'] );
528
  $output['api_language'] = wp_filter_nohtml_kses( $_POST['wpsl_api']['language'] );
@@ -615,11 +642,20 @@ if ( !class_exists( 'WPSL_Admin' ) ) {
615
  $output['new_window'] = isset( $_POST['wpsl_design']['new_window'] ) ? 1 : 0;
616
  $output['reset_map'] = isset( $_POST['wpsl_design']['reset_map'] ) ? 1 : 0;
617
  $output['store_below'] = isset( $_POST['wpsl_design']['store_below'] ) ? 1 : 0;
 
618
  $output['direction_redirect'] = isset( $_POST['wpsl_design']['direction_redirect'] ) ? 1 : 0;
619
  $output['more_info'] = isset( $_POST['wpsl_design']['more_info'] ) ? 1 : 0;
620
- $output['mouse_focus'] = isset( $_POST['wpsl_design']['mouse_focus'] ) ? 1 : 0;
621
- $output['start_marker'] = wp_filter_nohtml_kses( $_POST['wpsl_map']['start_marker'] );
622
- $output['store_marker'] = wp_filter_nohtml_kses( $_POST['wpsl_map']['store_marker'] );
 
 
 
 
 
 
 
 
623
 
624
  $missing_labels = false;
625
  $required_labels = array(
@@ -631,6 +667,8 @@ if ( !class_exists( 'WPSL_Admin' ) ) {
631
  'results',
632
  'more',
633
  'directions',
 
 
634
  'error',
635
  'phone',
636
  'fax',
@@ -870,7 +908,10 @@ if ( !class_exists( 'WPSL_Admin' ) ) {
870
  */
871
  public function show_distance_units() {
872
 
873
- $items = array( 'km', 'mi' );
 
 
 
874
  $dropdown = '<select id="wpsl-distance-unit" name="wpsl_search[distance_unit]">';
875
 
876
  foreach ( $items as $item => $value ) {
@@ -943,6 +984,30 @@ if ( !class_exists( 'WPSL_Admin' ) ) {
943
 
944
  return $dropdown;
945
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
946
 
947
  /**
948
  * Options for the language and region list
84
  /* Add the default value for the reset map option */
85
  if ( empty( $this->settings['reset_map'] ) ) {
86
  $this->settings['reset_map'] = 0;
 
87
  }
88
 
89
  /* Add the default value for the way the store listings are shown, either below or next to the map */
90
  if ( empty( $this->settings['auto_load'] ) ) {
91
  $this->settings['auto_load'] = 1;
 
92
  }
93
 
94
  /* Add the default value for the route redirect */
95
  if ( empty( $this->settings['new_window'] ) ) {
96
  $this->settings['new_window'] = 0;
97
+ }
98
+
99
+ update_option( 'wpsl_settings', $this->settings );
100
  }
101
  }
102
 
105
  /* Add the default value for the way the store listings are shown, either below or next to the map */
106
  if ( empty( $this->settings['store_below'] ) ) {
107
  $this->settings['store_below'] = 0;
 
108
  }
109
 
110
  /* Add the default value for the route redirect */
111
  if ( empty( $this->settings['direction_redirect'] ) ) {
112
  $this->settings['direction_redirect'] = 0;
113
+ }
114
+
115
+ update_option( 'wpsl_settings', $this->settings );
116
  }
117
  }
118
 
121
  /* Add the default value for the 'more info' link option */
122
  if ( empty( $this->settings['more_info'] ) ) {
123
  $this->settings['more_info'] = 0;
 
124
  }
125
 
126
  /* Add the default value for the 'more info' label */
127
  if ( empty( $this->settings['more_label'] ) ) {
128
  $this->settings['more_label'] = 'More info';
 
129
  }
130
 
131
  /* Add the default value mouse focus option */
132
  if ( empty( $this->settings['mouse_focus'] ) ) {
133
  $this->settings['mouse_focus'] = 1;
 
134
  }
135
+
136
+ update_option( 'wpsl_settings', $this->settings );
137
  }
138
  }
139
 
140
+ if ( version_compare( $current_version, '1.2.12', '<' ) ) {
141
+ if ( is_array( $this->settings ) ) {
142
+ /* Add the default value for the 'more info link' link option */
143
+ if ( empty( $this->settings['more_info_location'] ) ) {
144
+ $this->settings['more_info_location'] = 'info window';
145
+ }
146
+
147
+ /* Add the default value for the back label */
148
+ if ( empty( $this->settings['back_label'] ) ) {
149
+ $this->settings['back_label'] = 'Back';
150
+ }
151
+
152
+ /* Add the default value for the reset label */
153
+ if ( empty( $this->settings['reset_label'] ) ) {
154
+ $this->settings['reset_label'] = 'Reset';
155
+ }
156
+
157
+ /* Add the default value for removing the scroll bar when the store listing is shown below the map */
158
+ if ( empty( $this->settings['store_below_scroll'] ) ) {
159
+ $this->settings['store_below_scroll'] = '0';
160
+ }
161
+
162
+ update_option( 'wpsl_settings', $this->settings );
163
+ }
164
+ }
165
+
166
  update_option( 'wpsl_version', WPSL_VERSION_NUM );
167
  }
168
 
532
  * @return array $output The setting values
533
  */
534
  public function sanitize_settings() {
 
535
  $map_types = array(
536
  'roadmap',
537
  'satellite',
546
  'km',
547
  'mi'
548
  );
549
+ $more_info_locations = array(
550
+ 'store listings',
551
+ 'info window'
552
+ );
553
 
554
  $output['api_key'] = sanitize_text_field( $_POST['wpsl_api']['key'] );
555
  $output['api_language'] = wp_filter_nohtml_kses( $_POST['wpsl_api']['language'] );
642
  $output['new_window'] = isset( $_POST['wpsl_design']['new_window'] ) ? 1 : 0;
643
  $output['reset_map'] = isset( $_POST['wpsl_design']['reset_map'] ) ? 1 : 0;
644
  $output['store_below'] = isset( $_POST['wpsl_design']['store_below'] ) ? 1 : 0;
645
+ $output['store_below_scroll'] = isset( $_POST['wpsl_design']['store_below_scroll'] ) ? 1 : 0;
646
  $output['direction_redirect'] = isset( $_POST['wpsl_design']['direction_redirect'] ) ? 1 : 0;
647
  $output['more_info'] = isset( $_POST['wpsl_design']['more_info'] ) ? 1 : 0;
648
+
649
+ /* Check if we have a valid 'more info' location */
650
+ if ( in_array( $_POST['wpsl_design']['more_info_location'], $more_info_locations ) ) {
651
+ $output['more_info_location'] = $_POST['wpsl_design']['more_info_location'];
652
+ } else {
653
+ $output['more_info_location'] = $this->get_default_setting( 'more_info_location' );
654
+ }
655
+
656
+ $output['mouse_focus'] = isset( $_POST['wpsl_design']['mouse_focus'] ) ? 1 : 0;
657
+ $output['start_marker'] = wp_filter_nohtml_kses( $_POST['wpsl_map']['start_marker'] );
658
+ $output['store_marker'] = wp_filter_nohtml_kses( $_POST['wpsl_map']['store_marker'] );
659
 
660
  $missing_labels = false;
661
  $required_labels = array(
667
  'results',
668
  'more',
669
  'directions',
670
+ 'back',
671
+ 'reset',
672
  'error',
673
  'phone',
674
  'fax',
908
  */
909
  public function show_distance_units() {
910
 
911
+ $items = array(
912
+ 'km',
913
+ 'mi'
914
+ );
915
  $dropdown = '<select id="wpsl-distance-unit" name="wpsl_search[distance_unit]">';
916
 
917
  foreach ( $items as $item => $value ) {
984
 
985
  return $dropdown;
986
  }
987
+
988
+ /**
989
+ * Create a dropdown where users can select location where the 'more info' data is shown
990
+ *
991
+ * @since 1.2.12
992
+ * @return string $dropdown The html for the more info options list
993
+ */
994
+ public function show_more_info_options() {
995
+
996
+ $items = array(
997
+ 'store listings' => 'In the store listings',
998
+ 'info window' => 'In the info window on the map'
999
+ );
1000
+ $dropdown = '<select id="wpsl-more-info-list" name="wpsl_design[more_info_location]">';
1001
+
1002
+ foreach ( $items as $item => $value ) {
1003
+ $selected = ( $this->settings['more_info_location'] == $item ) ? 'selected="selected"' : '';
1004
+ $dropdown .= "<option value='$item' $selected>" . $value . "</option>";
1005
+ }
1006
+
1007
+ $dropdown .= "</select>";
1008
+
1009
+ return $dropdown;
1010
+ }
1011
 
1012
  /**
1013
  * Options for the language and region list
admin/js/wpsl-admin.js CHANGED
@@ -181,7 +181,7 @@ function filterApiResponse( response ) {
181
  country = {
182
  long_name : response[0].address_components[i].long_name,
183
  short_name : response[0].address_components[i].short_name
184
- }
185
  }
186
 
187
  /* filter out the postal code */
@@ -390,6 +390,18 @@ function showPreloader( elem ) {
390
  }
391
  }
392
 
 
 
 
 
 
 
 
 
 
 
 
 
393
  /* Load the map */
394
  if ( $( "#wpsl-gmap-wrap" ).length ) {
395
  google.maps.event.addDomListener( window, "load", initializeGmap );
181
  country = {
182
  long_name : response[0].address_components[i].long_name,
183
  short_name : response[0].address_components[i].short_name
184
+ };
185
  }
186
 
187
  /* filter out the postal code */
390
  }
391
  }
392
 
393
+ /* Detect changes for the 'More info' option on the settings page */
394
+ $( "#wpsl-more-info" ).on( "change", function() {
395
+ $( "#wpsl-more-info-options" ).toggle();
396
+ });
397
+
398
+ /* Detect changes for the store listings display option, either show below the map or not.
399
+ * If so, then show the option to remove the scrollbar
400
+ */
401
+ $( "#wpsl-store-below" ).on( "change", function() {
402
+ $( "#wpsl-store-below-scroll" ).toggle();
403
+ });
404
+
405
  /* Load the map */
406
  if ( $( "#wpsl-gmap-wrap" ).length ) {
407
  google.maps.event.addDomListener( window, "load", initializeGmap );
admin/templates/map-settings.php CHANGED
@@ -2,7 +2,7 @@
2
  <h2>WP Store Locator: <?php _e( 'Settings', 'wpsl' ); ?></h2>
3
 
4
  <?php global $wpdb; ?>
5
-
6
  <?php settings_errors(); ?>
7
  <ul id="wpsl-mainnav" class="nav-tab-wrapper">
8
  <li><a class="nav-tab" href="<?php echo admin_url( 'admin.php?page=wpsl_store_editor' ); ?>"><?php _e( 'Current Stores', 'wpsl' ); ?></a></li>
@@ -18,7 +18,7 @@
18
  <div class="inside">
19
  <p>
20
  <label for="wpsl-api-key"><?php _e( 'API key:', 'wpsl' ); ?> *</label>
21
- <input type="text" value="<?php echo esc_attr( $this->settings['api_key'] ); ?>" name="wpsl_api[key]" placeholder="<?php _e( 'Optional', 'wpsl' ) ?>" class="textinput" id="wpsl-api-key">
22
  </p>
23
  <p>
24
  <label for="wpsl-api-language"><?php _e( 'Map language:', 'wpsl' ); ?></label>
@@ -164,14 +164,22 @@
164
  <label for="wpsl-store-below"><?php _e( 'Show the store listings below the map?', 'wpsl' ); ?></label>
165
  <input type="checkbox" value="" <?php checked( $this->settings['store_below'] == '1', true ); ?> name="wpsl_design[store_below]" id="wpsl-store-below">
166
  </p>
 
 
 
 
167
  <p>
168
  <label for="wpsl-direction-redirect"><?php _e( 'When a user clicks on "Directions", open a new window and show the route on maps.google.com', 'wpsl' ); ?></label>
169
  <input type="checkbox" value="" <?php checked( $this->settings['direction_redirect'] == '1', true ); ?> name="wpsl_design[direction_redirect]" id="wpsl-direction-redirect">
170
  </p>
171
  <p>
172
- <label for="wpsl-more-info"><?php _e( 'Show a "More info" link in the store listings? If a user clicks the link the infowindow in the marker will open.', 'wpsl' ); ?></label>
173
  <input type="checkbox" value="" <?php checked( $this->settings['more_info'] == '1', true ); ?> name="wpsl_design[more_info]" id="wpsl-more-info">
174
  </p>
 
 
 
 
175
  <p>
176
  <label for="wpsl-mouse-focus"><?php _e( 'On pageload move the mousecursor to the input field. **', 'wpsl' ); ?></label>
177
  <input type="checkbox" value="" <?php checked( $this->settings['mouse_focus'] == '1', true ); ?> name="wpsl_design[mouse_focus]" id="wpsl-mouse-focus">
@@ -247,6 +255,14 @@
247
  <label for="wpsl-directions"><?php _e( 'Get directions:', 'wpsl' ); ?></label>
248
  <input type="text" value="<?php echo esc_attr( stripslashes( $this->settings['directions_label'] ) ); ?>" name="wpsl_label[directions]" class="textinput" id="wpsl-directions">
249
  </p>
 
 
 
 
 
 
 
 
250
  <p>
251
  <label for="wpsl-error"><?php _e( 'General error:', 'wpsl' ); ?></label>
252
  <input type="text" value="<?php echo esc_attr( stripslashes( $this->settings['error_label'] ) ); ?>" name="wpsl_label[error]" class="textinput" id="wpsl-error">
2
  <h2>WP Store Locator: <?php _e( 'Settings', 'wpsl' ); ?></h2>
3
 
4
  <?php global $wpdb; ?>
5
+
6
  <?php settings_errors(); ?>
7
  <ul id="wpsl-mainnav" class="nav-tab-wrapper">
8
  <li><a class="nav-tab" href="<?php echo admin_url( 'admin.php?page=wpsl_store_editor' ); ?>"><?php _e( 'Current Stores', 'wpsl' ); ?></a></li>
18
  <div class="inside">
19
  <p>
20
  <label for="wpsl-api-key"><?php _e( 'API key:', 'wpsl' ); ?> *</label>
21
+ <input type="text" value="<?php echo esc_attr( $this->settings['api_key'] ); ?>" name="wpsl_api[key]" placeholder="<?php _e( 'Optional', 'wpsl' ); ?>" class="textinput" id="wpsl-api-key">
22
  </p>
23
  <p>
24
  <label for="wpsl-api-language"><?php _e( 'Map language:', 'wpsl' ); ?></label>
164
  <label for="wpsl-store-below"><?php _e( 'Show the store listings below the map?', 'wpsl' ); ?></label>
165
  <input type="checkbox" value="" <?php checked( $this->settings['store_below'] == '1', true ); ?> name="wpsl_design[store_below]" id="wpsl-store-below">
166
  </p>
167
+ <p id="wpsl-store-below-scroll" <?php if ( $this->settings['store_below'] == '0' ) { echo 'style="display:none;"'; } ?>>
168
+ <label for="wpsl-more-info-list"><?php _e( 'Hide the scrollbar?', 'wpsl' ); ?></label>
169
+ <input type="checkbox" value="" <?php checked( $this->settings['store_below_scroll'] == '1', true ); ?> name="wpsl_design[store_below_scroll]" id="wpsl-store-below-scroll">
170
+ </p>
171
  <p>
172
  <label for="wpsl-direction-redirect"><?php _e( 'When a user clicks on "Directions", open a new window and show the route on maps.google.com', 'wpsl' ); ?></label>
173
  <input type="checkbox" value="" <?php checked( $this->settings['direction_redirect'] == '1', true ); ?> name="wpsl_design[direction_redirect]" id="wpsl-direction-redirect">
174
  </p>
175
  <p>
176
+ <label for="wpsl-more-info"><?php _e( 'Show a "More info" link in the store listings?', 'wpsl' ); ?></label>
177
  <input type="checkbox" value="" <?php checked( $this->settings['more_info'] == '1', true ); ?> name="wpsl_design[more_info]" id="wpsl-more-info">
178
  </p>
179
+ <p id="wpsl-more-info-options" <?php if ( $this->settings['more_info'] == '0' ) { echo 'style="display:none;"'; } ?>>
180
+ <label for="wpsl-more-info-list"><?php _e( 'Where do you want to show the "More info" details?', 'wpsl' ); ?></label>
181
+ <?php echo $this->show_more_info_options(); ?>
182
+ </p>
183
  <p>
184
  <label for="wpsl-mouse-focus"><?php _e( 'On pageload move the mousecursor to the input field. **', 'wpsl' ); ?></label>
185
  <input type="checkbox" value="" <?php checked( $this->settings['mouse_focus'] == '1', true ); ?> name="wpsl_design[mouse_focus]" id="wpsl-mouse-focus">
255
  <label for="wpsl-directions"><?php _e( 'Get directions:', 'wpsl' ); ?></label>
256
  <input type="text" value="<?php echo esc_attr( stripslashes( $this->settings['directions_label'] ) ); ?>" name="wpsl_label[directions]" class="textinput" id="wpsl-directions">
257
  </p>
258
+ <p>
259
+ <label for="wpsl-back"><?php _e( 'Back:', 'wpsl' ); ?></label>
260
+ <input type="text" value="<?php echo esc_attr( stripslashes( $this->settings['back_label'] ) ); ?>" name="wpsl_label[back]" class="textinput" id="wpsl-back">
261
+ </p>
262
+ <p>
263
+ <label for="wpsl-reset"><?php _e( 'Reset:', 'wpsl' ); ?></label>
264
+ <input type="text" value="<?php echo esc_attr( stripslashes( $this->settings['reset_label'] ) ); ?>" name="wpsl_label[reset]" class="textinput" id="wpsl-reset">
265
+ </p>
266
  <p>
267
  <label for="wpsl-error"><?php _e( 'General error:', 'wpsl' ); ?></label>
268
  <input type="text" value="<?php echo esc_attr( stripslashes( $this->settings['error_label'] ) ); ?>" name="wpsl_label[error]" class="textinput" id="wpsl-error">
css/styles.css CHANGED
@@ -29,6 +29,10 @@
29
  cursor: pointer;
30
  }
31
 
 
 
 
 
32
  /*
33
  Some themes set a box-shadow or max-width for all image /
34
  div elements, we disable it to prevent it from messing up the map
@@ -110,6 +114,10 @@ div elements, we disable it to prevent it from messing up the map
110
  }
111
 
112
  /* Result list */
 
 
 
 
113
  #wpsl-result-list {
114
  float:left;
115
  width:33%;
@@ -136,7 +144,6 @@ div elements, we disable it to prevent it from messing up the map
136
  }
137
 
138
  #wpsl-result-list p a {
139
- display:block;
140
  margin-bottom:10px;
141
  }
142
 
@@ -159,6 +166,29 @@ div elements, we disable it to prevent it from messing up the map
159
  padding-left:0;
160
  margin-bottom:20px;
161
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
162
  #wpsl-stores .wpsl-store-thumb {
163
  float:right;
164
  border-radius:3px;
@@ -252,10 +282,17 @@ div elements, we disable it to prevent it from messing up the map
252
  #wpsl-gmap .wpsl-info-window {
253
  max-width:225px;
254
  }
 
 
255
  .wpsl-info-window span {
256
  display:block;
257
  }
258
 
 
 
 
 
 
259
  /* Fix for Google Voice breaking the phone numbers */
260
  .wpsl-info-window span span {
261
  display:inline !important;
29
  cursor: pointer;
30
  }
31
 
32
+ #wpsl-reset-map.wpsl-right-controls {
33
+ right:42px;
34
+ }
35
+
36
  /*
37
  Some themes set a box-shadow or max-width for all image /
38
  div elements, we disable it to prevent it from messing up the map
114
  }
115
 
116
  /* Result list */
117
+ .wpsl-back {
118
+ display:block;
119
+ }
120
+
121
  #wpsl-result-list {
122
  float:left;
123
  width:33%;
144
  }
145
 
146
  #wpsl-result-list p a {
 
147
  margin-bottom:10px;
148
  }
149
 
166
  padding-left:0;
167
  margin-bottom:20px;
168
  }
169
+
170
+ .wpsl-store-details.wpsl-store-listing {
171
+ position:relative;
172
+ padding-right:20px;
173
+ }
174
+ .wpsl-store-details.wpsl-store-listing:before,
175
+ .wpsl-store-details.wpsl-store-listing.wpsl-active-details:before {
176
+ position: absolute;
177
+ content: '';
178
+ bottom:6px;
179
+ right:0;
180
+ border-top: 5px solid #000000;
181
+ border-left: 6px solid rgba(0, 0, 0, 0);
182
+ border-right: 6px solid rgba(0, 0, 0, 0);
183
+ }
184
+
185
+ .wpsl-store-details.wpsl-store-listing.wpsl-active-details:before {
186
+ border-bottom: 5px solid #000000;
187
+ border-top:none;
188
+ border-left: 6px solid rgba(0, 0, 0, 0);
189
+ border-right: 6px solid rgba(0, 0, 0, 0);
190
+ }
191
+
192
  #wpsl-stores .wpsl-store-thumb {
193
  float:right;
194
  border-radius:3px;
282
  #wpsl-gmap .wpsl-info-window {
283
  max-width:225px;
284
  }
285
+
286
+ .wpsl-more-info-listings span,
287
  .wpsl-info-window span {
288
  display:block;
289
  }
290
 
291
+ /* More info details in the store listings */
292
+ .wpsl-more-info-listings {
293
+ display:none;
294
+ }
295
+
296
  /* Fix for Google Voice breaking the phone numbers */
297
  .wpsl-info-window span span {
298
  display:inline !important;
frontend/class-frontend.php CHANGED
@@ -54,7 +54,14 @@ if ( !class_exists( 'WPSL_Frontend' ) ) {
54
  */
55
  public function get_custom_css() {
56
  $css = '<style>' . "\r\n";
57
- $css .= "#wpsl-stores, #wpsl-direction-details, #wpsl-gmap {height:" . esc_attr( $this->settings['height'] ) . "px !important;}" . "\r\n";
 
 
 
 
 
 
 
58
  $css .= "#wpsl-gmap .wpsl-info-window {max-width:" . esc_attr( $this->settings['infowindow_width'] ) . "px !important;}" . "\r\n";
59
  $css .= ".wpsl-input label, #wpsl-radius label {width:" . esc_attr( $this->settings['label_width'] ) . "px;}" . "\r\n";
60
  $css .= "#wpsl-search-input {width:" . esc_attr( $this->settings['search_width'] ) . "px !important;}" . "\r\n";
@@ -190,6 +197,7 @@ if ( !class_exists( 'WPSL_Frontend' ) ) {
190
  'resetMap' => $this->settings['reset_map'],
191
  'directionRedirect' => $this->settings['direction_redirect'],
192
  'moreInfo' => $this->settings['more_info'],
 
193
  'mouseFocus' => $this->settings['mouse_focus'],
194
  'storeBelow' => $this->settings['store_below'],
195
  'maxResults' => $dropdown_defaults['max_results'],
@@ -209,7 +217,8 @@ if ( !class_exists( 'WPSL_Frontend' ) ) {
209
  'phone' => stripslashes( $this->settings['phone_label'] ),
210
  'fax' => stripslashes( $this->settings['fax_label'] ),
211
  'hours' => stripslashes( $this->settings['hours_label'] ),
212
- 'startPoint' => stripslashes( $this->settings['start_label'] )
 
213
  );
214
 
215
  wp_localize_script( 'wpsl-js', 'wpslSettings', $settings );
54
  */
55
  public function get_custom_css() {
56
  $css = '<style>' . "\r\n";
57
+
58
+ if ( ( $this->settings['store_below'] == '1' ) && ( $this->settings['store_below_scroll'] == '1' ) ) {
59
+ $css .= "#wpsl-gmap {height:" . esc_attr( $this->settings['height'] ) . "px !important;}" . "\r\n";
60
+ $css .= "#wpsl-stores, #wpsl-direction-details {height:auto !important;}";
61
+ } else {
62
+ $css .= "#wpsl-stores, #wpsl-direction-details, #wpsl-gmap {height:" . esc_attr( $this->settings['height'] ) . "px !important;}" . "\r\n";
63
+ }
64
+
65
  $css .= "#wpsl-gmap .wpsl-info-window {max-width:" . esc_attr( $this->settings['infowindow_width'] ) . "px !important;}" . "\r\n";
66
  $css .= ".wpsl-input label, #wpsl-radius label {width:" . esc_attr( $this->settings['label_width'] ) . "px;}" . "\r\n";
67
  $css .= "#wpsl-search-input {width:" . esc_attr( $this->settings['search_width'] ) . "px !important;}" . "\r\n";
197
  'resetMap' => $this->settings['reset_map'],
198
  'directionRedirect' => $this->settings['direction_redirect'],
199
  'moreInfo' => $this->settings['more_info'],
200
+ 'moreInfoLocation' => $this->settings['more_info_location'],
201
  'mouseFocus' => $this->settings['mouse_focus'],
202
  'storeBelow' => $this->settings['store_below'],
203
  'maxResults' => $dropdown_defaults['max_results'],
217
  'phone' => stripslashes( $this->settings['phone_label'] ),
218
  'fax' => stripslashes( $this->settings['fax_label'] ),
219
  'hours' => stripslashes( $this->settings['hours_label'] ),
220
+ 'startPoint' => stripslashes( $this->settings['start_label'] ),
221
+ 'back' => stripslashes( $this->settings['back_label'] )
222
  );
223
 
224
  wp_localize_script( 'wpsl-js', 'wpslSettings', $settings );
frontend/templates/default.php CHANGED
@@ -43,8 +43,16 @@ $output .= '</div>' . "\r\n";
43
  $output .= '</div>' . "\r\n";
44
 
45
  if ( $this->settings['reset_map'] ) {
 
 
 
 
 
 
 
 
46
  $output .= '<div class="wpsl-gmap-wrap">' . "\r\n";
47
- $output .= '<div id="wpsl-reset-map">Reset</div>' . "\r\n";
48
  $output .= '<div id="wpsl-gmap"></div>' . "\r\n";
49
  $output .= '</div>' . "\r\n";
50
  } else {
43
  $output .= '</div>' . "\r\n";
44
 
45
  if ( $this->settings['reset_map'] ) {
46
+
47
+ /* If the control position is set to right, we need to adjust to right space to make sure it doesn't cover map controls. */
48
+ if ( $this->settings['control_position'] == 'right' ) {
49
+ $align_class = 'class="wpsl-right-controls"';
50
+ } else {
51
+ $align_class = '';
52
+ }
53
+
54
  $output .= '<div class="wpsl-gmap-wrap">' . "\r\n";
55
+ $output .= '<div id="wpsl-reset-map" ' . $align_class . '>' . stripslashes( $this->settings['reset_label'] ) . '</div>' . "\r\n";
56
  $output .= '<div id="wpsl-gmap"></div>' . "\r\n";
57
  $output .= '</div>' . "\r\n";
58
  } else {
frontend/templates/store-listings-below.php CHANGED
@@ -34,8 +34,16 @@ $output .= '</div>' . "\r\n";
34
  $output .= '</div>' . "\r\n";
35
 
36
  if ( $this->settings['reset_map'] ) {
 
 
 
 
 
 
 
 
37
  $output .= '<div class="wpsl-gmap-wrap">' . "\r\n";
38
- $output .= '<div id="wpsl-reset-map">Reset</div>' . "\r\n";
39
  $output .= '<div id="wpsl-gmap"></div>' . "\r\n";
40
  $output .= '</div>' . "\r\n";
41
  } else {
34
  $output .= '</div>' . "\r\n";
35
 
36
  if ( $this->settings['reset_map'] ) {
37
+
38
+ /* If the control position is set to right, we need to adjust to right space to make sure it doesn't cover map controls. */
39
+ if ( $this->settings['control_position'] == 'right' ) {
40
+ $align_class = 'class="wpsl-right-controls"';
41
+ } else {
42
+ $align_class = '';
43
+ }
44
+
45
  $output .= '<div class="wpsl-gmap-wrap">' . "\r\n";
46
+ $output .= '<div id="wpsl-reset-map" ' . $align_class . '>' . stripslashes( $this->settings['reset_label'] ) . '</div>' . "\r\n";
47
  $output .= '<div id="wpsl-gmap"></div>' . "\r\n";
48
  $output .= '</div>' . "\r\n";
49
  } else {
js/wpsl-gmap.js CHANGED
@@ -3,6 +3,7 @@ var geocoder, map, infowindow, directionsDisplay, directionsService, geolocation
3
  markersArray = [],
4
  mapDefaults = {},
5
  resetMap = false,
 
6
  startAddress,
7
  startLatLng,
8
  autoLoad = wpslSettings.autoLoad,
@@ -87,7 +88,7 @@ function initializeGmap() {
87
 
88
  /* Move the mousecursor to the store search field if the focus option is enabled */
89
  if ( wpslSettings.mouseFocus == 1 ) {
90
- $("#wpsl-search-input").focus();
91
  }
92
 
93
  /* Style the dropdown menu */
@@ -111,7 +112,8 @@ function showStores() {
111
  */
112
  function checkGeolocation() {
113
  if ( navigator.geolocation ) {
114
- var locationTimeout = setTimeout( showStores, 3000 );
 
115
 
116
  navigator.geolocation.getCurrentPosition( function( position ) {
117
  clearTimeout( locationTimeout );
@@ -119,7 +121,7 @@ function checkGeolocation() {
119
  /* If the timeout is triggerd, and the user later decides to enable the gelocation detection,
120
  * it gets messy with multiple start markers. So we first clear the map before adding new ones.
121
  */
122
- deleteOverlays();
123
  handleGeolocationQuery( position, resetMap );
124
  }, function( error ) {
125
  clearTimeout( locationTimeout );
@@ -131,7 +133,6 @@ function checkGeolocation() {
131
  };
132
 
133
  function handleGeolocationQuery( position, resetMap ) {
134
-
135
  if ( typeof( position ) === "undefined" ) {
136
  showStores();
137
  } else {
@@ -151,7 +152,7 @@ function handleGeolocationQuery( position, resetMap ) {
151
 
152
  /* Handle clicks on the search button */
153
  $( "#wpsl-search-btn" ).on( "click", function() {
154
-
155
  $( "#wpsl-search-input" ).removeClass();
156
 
157
  if ( !$( "#wpsl-search-input" ).val() ) {
@@ -162,17 +163,19 @@ $( "#wpsl-search-btn" ).on( "click", function() {
162
  $( ".wpsl-direction-before, .wpsl-direction-after" ).remove();
163
  $( "#wpsl-direction-details" ).hide();
164
  resetMap = false;
165
- deleteOverlays();
 
166
  codeAddress();
167
  }
168
  });
169
 
170
  /* Reset the map */
171
  $( "#wpsl-reset-map" ).on( "click", function() {
172
- var resetMap = true;
 
173
 
174
  /* When the start marker is dragged the autoload value is set to false.
175
- * So we need to check the correct value when the reset btn is pushed before reloading the stores.
176
  */
177
  if ( wpslSettings.autoLoad == 1) {
178
  autoLoad = 1;
@@ -180,8 +183,11 @@ $( "#wpsl-reset-map" ).on( "click", function() {
180
 
181
  /* Check if the latlng or zoom has changed since pageload, if so there is something to reset */
182
  if ( ( ( ( map.getCenter().lat() !== mapDefaults.centerLatlng.lat() ) || ( map.getCenter().lng() !== mapDefaults.centerLatlng.lng() ) || ( map.getZoom() !== mapDefaults.zoomLevel ) ) ) ) {
183
- deleteOverlays();
184
  $( "#wpsl-search-input" ).val('').removeClass();
 
 
 
185
 
186
  /* Reset the dropdown values */
187
  resetDropdowns();
@@ -197,6 +203,14 @@ $( "#wpsl-reset-map" ).on( "click", function() {
197
  $( "#wpsl-direction-details" ).hide();
198
  });
199
 
 
 
 
 
 
 
 
 
200
  /* Reset the dropdown values after the "reset" button is triggerd */
201
  function resetDropdowns() {
202
  var i, arrayLength,
@@ -222,10 +236,15 @@ $( "#wpsl-result-list" ).on( "click", ".wpsl-back", function() {
222
  /* Remove the directions from the map */
223
  directionsDisplay.setMap( null );
224
 
225
- /* Restore all markers on the map */
226
  for ( i = 0, len = markersArray.length; i < len; i++ ) {
227
  markersArray[i].setMap( map );
228
  }
 
 
 
 
 
229
 
230
  fitBounds();
231
  infoWindowDirectionButton();
@@ -249,16 +268,23 @@ function renderDirections( e ) {
249
  } else {
250
  storeId = e.parent( ".wpsl-info-window" ).data( "store-id" );
251
  }
252
-
 
 
 
 
 
253
  /* Find the latlng that belongs to the start and end point */
254
  for ( i = 0, len = markersArray.length; i < len; i++ ) {
255
- if ( markersArray[i].storeId == 0 ) {
 
 
256
  start = markersArray[i].getPosition();
257
  } else if ( markersArray[i].storeId == storeId ) {
258
  end = markersArray[i].getPosition();
259
  }
260
  }
261
-
262
  if ( start && end ) {
263
  $( "#wpsl-direction-details ul" ).empty();
264
  $( ".wpsl-direction-before, .wpsl-direction-after" ).remove();
@@ -300,7 +326,7 @@ function letsBounce( storeId, status ) {
300
 
301
  /* Show the directions on the map */
302
  function calcRoute( start, end ) {
303
- var legs, len, step, index, direction, i, j, distanceUnit,
304
  directionStops = "",
305
  request = {};
306
 
@@ -336,15 +362,26 @@ function calcRoute( start, end ) {
336
  }
337
  }
338
 
339
- $( "#wpsl-direction-details ul" ).append( directionStops ).before( "<p class='wpsl-direction-before'><a class='wpsl-back' href='#'>Back</a>" + direction.legs[0].distance.text + " - " + direction.legs[0].duration.text + "</p>" ).after( "<p class='wpsl-direction-after'>" + response.routes[0].copyrights + "</p>" );
340
  $( "#wpsl-direction-details" ).show();
341
 
342
  /* Remove all other markers from the map */
343
  for ( i = 0, len = markersArray.length; i < len; i++ ) {
344
  markersArray[i].setMap( null );
345
  }
 
 
 
 
 
346
 
347
  $( "#wpsl-stores" ).hide();
 
 
 
 
 
 
348
  }
349
  }
350
  });
@@ -354,6 +391,7 @@ function calcRoute( start, end ) {
354
  function codeAddress() {
355
  var latLng,
356
  autoLoad = false,
 
357
  address = $( "#wpsl-search-input" ).val();
358
 
359
  geocoder.geocode( { 'address': address}, function( response, status ) {
@@ -361,7 +399,7 @@ function codeAddress() {
361
  latLng = response[0].geometry.location;
362
 
363
  /* Remove any previous markers and add a new one */
364
- deleteOverlays();
365
  addMarker( latLng, 0, '', true ); // This marker is the 'start location' marker. With a storeId of 0, no name and is draggable
366
 
367
  /* Try to find stores that match the radius, location criteria */
@@ -391,7 +429,7 @@ function reverseGeocode( latLng ) {
391
 
392
  /* Filter out the zipcode from the response */
393
  function filterApiResponse( response ) {
394
- var zipcode, responseType,
395
  addressLength = response[0].address_components.length;
396
 
397
  /* Loop over the API response */
@@ -444,7 +482,7 @@ function makeAjaxRequest( startLatLng, resetMap, autoLoad ) {
444
  lng: startLatLng.lng()
445
  },
446
  url = {
447
- src : "#",
448
  target : ""
449
  };
450
 
@@ -456,8 +494,8 @@ function makeAjaxRequest( startLatLng, resetMap, autoLoad ) {
456
  ajaxData.max_results = wpslSettings.maxResults;
457
  ajaxData.radius = wpslSettings.searchRadius;
458
  } else {
459
- ajaxData.max_results = $( "#wpsl-results select" ).val();
460
- ajaxData.radius = $( "#wpsl-radius select" ).val();
461
  }
462
 
463
  /* Check if autoload all stores is enabled */
@@ -542,7 +580,7 @@ function makeAjaxRequest( startLatLng, resetMap, autoLoad ) {
542
 
543
  /* Add a new marker to the map based on the provided location (latlng) */
544
  function addMarker( location, storeId, infoWindowData, draggable ) {
545
- var markerPath, mapIcon;
546
 
547
  if ( storeId === 0 ) {
548
  markerPath = wpslSettings.path + "img/markers/" + wpslSettings.startMarker;
@@ -586,6 +624,7 @@ function addMarker( location, storeId, infoWindowData, draggable ) {
586
 
587
  if ( draggable ) {
588
  google.maps.event.addListener( marker, "dragend", function( event ) {
 
589
  map.setCenter( event.latLng );
590
  reverseGeocode( event.latLng );
591
  findStoreLocations( event.latLng, resetMap, autoLoad = false );
@@ -660,6 +699,48 @@ function createInfoWindowHtml( infoWindowData, storeId ) {
660
  return windowContent;
661
  }
662
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
663
  function createDirectionUrl( street, city, zip, country ) {
664
  var destinationAddress, url;
665
 
@@ -680,6 +761,7 @@ function createDirectionUrl( street, city, zip, country ) {
680
 
681
  function storeHtml( response, url ) {
682
  var html = "",
 
683
  storeImg = "",
684
  moreInfo = "",
685
  moreInfoUrl = "#",
@@ -708,13 +790,26 @@ function storeHtml( response, url ) {
708
  /* If we show the store listings under the map, we do want to jump to the
709
  * top of the map to focus on the opened infowindow
710
  */
711
- if ( wpslSettings.storeBelow == 1 ) {
712
  moreInfoUrl = '#wpsl-search-wrap';
713
  }
714
 
715
- moreInfo = "<p><a class='wpsl-store-details' data-store-id='" + id + "' href=" + moreInfoUrl + ">More info</a></p>";
 
 
 
 
 
 
 
 
 
 
 
 
 
716
  }
717
-
718
  html = "<li data-store-id='" + id + "'><div><p>" + storeImg + "<strong>" + store + "</strong><span class='wpsl-street'>" + street + "</span>" + city + " " + state + " " + zip + "<span class='wpsl-country'>" + country + "</p>" + moreInfo + "</div>" + distance + "<a class='wpsl-directions' " + url.target + " href='" + url.src + "'>" + wpslLabels.directions + "</a></li>";
719
 
720
  return html;
@@ -741,14 +836,23 @@ function fitBounds() {
741
  }
742
 
743
  /* Remove all existing markers and route lines from the map */
744
- function deleteOverlays() {
745
  var markerLen, i;
746
  directionsDisplay.setMap( null );
747
-
748
  /* Remove all the markers from the map, and empty the array */
749
  if ( markersArray ) {
750
- for ( i = 0, markerLen = markersArray.length; i < markerLen; i++ ) {
751
- markersArray[i].setMap( null );
 
 
 
 
 
 
 
 
 
752
  }
753
 
754
  markersArray.length = 0;
@@ -783,19 +887,37 @@ $( "#wpsl-search-input" ).keydown( function ( event ) {
783
  }
784
  });
785
 
 
786
  $( "#wpsl-stores" ).on( "click", ".wpsl-store-details", function() {
787
- var i, storeId = $( this ).data( "store-id" );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
788
 
789
- for ( i = 0, len = markersArray.length; i < len; i++ ) {
790
- if ( markersArray[i].storeId == storeId ) {
791
- google.maps.event.trigger( markersArray[i], "click" );
792
- }
793
- }
794
-
795
  /* If we show the store listings under the map, we do want to jump to the
796
  * top of the map to focus on the opened infowindow
797
  */
798
- if ( wpslSettings.storeBelow != 1 ) {
799
  return false;
800
  }
801
  });
3
  markersArray = [],
4
  mapDefaults = {},
5
  resetMap = false,
6
+ startMarkerData,
7
  startAddress,
8
  startLatLng,
9
  autoLoad = wpslSettings.autoLoad,
88
 
89
  /* Move the mousecursor to the store search field if the focus option is enabled */
90
  if ( wpslSettings.mouseFocus == 1 ) {
91
+ $( "#wpsl-search-input" ).focus();
92
  }
93
 
94
  /* Style the dropdown menu */
112
  */
113
  function checkGeolocation() {
114
  if ( navigator.geolocation ) {
115
+ var keepStartMarker = false,
116
+ locationTimeout = setTimeout( showStores, 3000 );
117
 
118
  navigator.geolocation.getCurrentPosition( function( position ) {
119
  clearTimeout( locationTimeout );
121
  /* If the timeout is triggerd, and the user later decides to enable the gelocation detection,
122
  * it gets messy with multiple start markers. So we first clear the map before adding new ones.
123
  */
124
+ deleteOverlays( keepStartMarker );
125
  handleGeolocationQuery( position, resetMap );
126
  }, function( error ) {
127
  clearTimeout( locationTimeout );
133
  };
134
 
135
  function handleGeolocationQuery( position, resetMap ) {
 
136
  if ( typeof( position ) === "undefined" ) {
137
  showStores();
138
  } else {
152
 
153
  /* Handle clicks on the search button */
154
  $( "#wpsl-search-btn" ).on( "click", function() {
155
+ var keepStartMarker = false;
156
  $( "#wpsl-search-input" ).removeClass();
157
 
158
  if ( !$( "#wpsl-search-input" ).val() ) {
163
  $( ".wpsl-direction-before, .wpsl-direction-after" ).remove();
164
  $( "#wpsl-direction-details" ).hide();
165
  resetMap = false;
166
+ deleteOverlays( keepStartMarker );
167
+ deleteStartMarker();
168
  codeAddress();
169
  }
170
  });
171
 
172
  /* Reset the map */
173
  $( "#wpsl-reset-map" ).on( "click", function() {
174
+ var keepStartMarker = false,
175
+ resetMap = true;
176
 
177
  /* When the start marker is dragged the autoload value is set to false.
178
+ * So we need to check the correct value when the reset button is pushed before reloading the stores.
179
  */
180
  if ( wpslSettings.autoLoad == 1) {
181
  autoLoad = 1;
183
 
184
  /* Check if the latlng or zoom has changed since pageload, if so there is something to reset */
185
  if ( ( ( ( map.getCenter().lat() !== mapDefaults.centerLatlng.lat() ) || ( map.getCenter().lng() !== mapDefaults.centerLatlng.lng() ) || ( map.getZoom() !== mapDefaults.zoomLevel ) ) ) ) {
186
+ deleteOverlays( keepStartMarker );
187
  $( "#wpsl-search-input" ).val('').removeClass();
188
+
189
+ /* Remove the start marker */
190
+ deleteStartMarker();
191
 
192
  /* Reset the dropdown values */
193
  resetDropdowns();
203
  $( "#wpsl-direction-details" ).hide();
204
  });
205
 
206
+ /* Remove the start marker from the map and empty the var */
207
+ function deleteStartMarker() {
208
+ if ( ( typeof( startMarkerData ) !== "undefined" ) && ( startMarkerData !== "" ) ) {
209
+ startMarkerData.setMap( null );
210
+ startMarkerData = '';
211
+ }
212
+ }
213
+
214
  /* Reset the dropdown values after the "reset" button is triggerd */
215
  function resetDropdowns() {
216
  var i, arrayLength,
236
  /* Remove the directions from the map */
237
  directionsDisplay.setMap( null );
238
 
239
+ /* Restore the store markers on the map */
240
  for ( i = 0, len = markersArray.length; i < len; i++ ) {
241
  markersArray[i].setMap( map );
242
  }
243
+
244
+ /* Restore the start marker on the map */
245
+ if ( ( typeof( startMarkerData ) !== "undefined" ) && ( startMarkerData !== "" ) ) {
246
+ startMarkerData.setMap( map );
247
+ }
248
 
249
  fitBounds();
250
  infoWindowDirectionButton();
268
  } else {
269
  storeId = e.parent( ".wpsl-info-window" ).data( "store-id" );
270
  }
271
+
272
+ /* Check if we need get the start point from a dragged marker */
273
+ if ( ( typeof( startMarkerData ) !== "undefined" ) && ( startMarkerData !== "" ) ) {
274
+ start = startMarkerData.getPosition();
275
+ }
276
+
277
  /* Find the latlng that belongs to the start and end point */
278
  for ( i = 0, len = markersArray.length; i < len; i++ ) {
279
+
280
+ /* Only continue if the start data is still empty or undefined */
281
+ if ( ( markersArray[i].storeId == 0 ) && ( ( typeof( start ) === "undefined" ) || ( start === "" ) ) ) {
282
  start = markersArray[i].getPosition();
283
  } else if ( markersArray[i].storeId == storeId ) {
284
  end = markersArray[i].getPosition();
285
  }
286
  }
287
+
288
  if ( start && end ) {
289
  $( "#wpsl-direction-details ul" ).empty();
290
  $( ".wpsl-direction-before, .wpsl-direction-after" ).remove();
326
 
327
  /* Show the directions on the map */
328
  function calcRoute( start, end ) {
329
+ var legs, len, step, index, direction, i, j, distanceUnit, directionOffset,
330
  directionStops = "",
331
  request = {};
332
 
362
  }
363
  }
364
 
365
+ $( "#wpsl-direction-details ul" ).append( directionStops ).before( "<p class='wpsl-direction-before'><a class='wpsl-back' id='wpsl-direction-start' href='#'>" + wpslLabels.back + "</a>" + direction.legs[0].distance.text + " - " + direction.legs[0].duration.text + "</p>" ).after( "<p class='wpsl-direction-after'>" + response.routes[0].copyrights + "</p>" );
366
  $( "#wpsl-direction-details" ).show();
367
 
368
  /* Remove all other markers from the map */
369
  for ( i = 0, len = markersArray.length; i < len; i++ ) {
370
  markersArray[i].setMap( null );
371
  }
372
+
373
+ /* Remove the start marker from the map */
374
+ if ( ( typeof( startMarkerData ) !== "undefined" ) && ( startMarkerData !== "" ) ) {
375
+ startMarkerData.setMap( null );
376
+ }
377
 
378
  $( "#wpsl-stores" ).hide();
379
+
380
+ /* Make sure the start of the route directions are visible if the store listings are shown below the map */
381
+ if ( wpslSettings.storeBelow == 1 ) {
382
+ directionOffset = $( "#wpsl-gmap" ).offset();
383
+ $( window ).scrollTop( directionOffset.top );
384
+ }
385
  }
386
  }
387
  });
391
  function codeAddress() {
392
  var latLng,
393
  autoLoad = false,
394
+ keepStartMarker = false,
395
  address = $( "#wpsl-search-input" ).val();
396
 
397
  geocoder.geocode( { 'address': address}, function( response, status ) {
399
  latLng = response[0].geometry.location;
400
 
401
  /* Remove any previous markers and add a new one */
402
+ deleteOverlays( keepStartMarker );
403
  addMarker( latLng, 0, '', true ); // This marker is the 'start location' marker. With a storeId of 0, no name and is draggable
404
 
405
  /* Try to find stores that match the radius, location criteria */
429
 
430
  /* Filter out the zipcode from the response */
431
  function filterApiResponse( response ) {
432
+ var zipcode, responseType, i,
433
  addressLength = response[0].address_components.length;
434
 
435
  /* Loop over the API response */
482
  lng: startLatLng.lng()
483
  },
484
  url = {
485
+ src : "#wpsl-direction-start",
486
  target : ""
487
  };
488
 
494
  ajaxData.max_results = wpslSettings.maxResults;
495
  ajaxData.radius = wpslSettings.searchRadius;
496
  } else {
497
+ ajaxData.max_results = parseInt( $( "#wpsl-results .wpsl-dropdown .selected" ).text() );
498
+ ajaxData.radius = parseInt( $( "#wpsl-radius .wpsl-dropdown .selected" ).text() );
499
  }
500
 
501
  /* Check if autoload all stores is enabled */
580
 
581
  /* Add a new marker to the map based on the provided location (latlng) */
582
  function addMarker( location, storeId, infoWindowData, draggable ) {
583
+ var markerPath, mapIcon, keepStartMarker = true;
584
 
585
  if ( storeId === 0 ) {
586
  markerPath = wpslSettings.path + "img/markers/" + wpslSettings.startMarker;
624
 
625
  if ( draggable ) {
626
  google.maps.event.addListener( marker, "dragend", function( event ) {
627
+ deleteOverlays( keepStartMarker );
628
  map.setCenter( event.latLng );
629
  reverseGeocode( event.latLng );
630
  findStoreLocations( event.latLng, resetMap, autoLoad = false );
699
  return windowContent;
700
  }
701
 
702
+ function createMoreInfoListing( storeData ) {
703
+ var newWindow = "",
704
+ moreInfoContent = "<div id='wpsl-id-" + storeData.id + "' class='wpsl-more-info-listings'>";
705
+
706
+ if ( ( typeof( storeData.description ) !== "undefined" ) && ( storeData.description !== "" ) ) {
707
+ moreInfoContent += "<p>" + storeData.description + "</p>";
708
+ }
709
+
710
+ moreInfoContent += "<p>";
711
+
712
+ /* If no data exist for either the phone / fax / email then just don't show them */
713
+ if ( ( typeof( storeData.phone ) !== "undefined" ) && ( storeData.phone !== "" ) ) {
714
+ moreInfoContent += "<span><strong>" + wpslLabels.phone + "</strong>: " + storeData.phone + "</span>";
715
+ }
716
+
717
+ if ( ( typeof( storeData.fax ) !== "undefined" ) && ( storeData.fax !== "" ) ) {
718
+ moreInfoContent += "<span><strong>" + wpslLabels.fax + "</strong>: " + storeData.fax + "</span>";
719
+ }
720
+
721
+ if ( ( typeof( storeData.email ) !== "undefined" ) && ( storeData.email !== "" ) ) {
722
+ moreInfoContent += "<span><strong>Email</strong>: " + storeData.email + "</span>";
723
+ }
724
+
725
+ if ( ( typeof( storeData.url ) !== "undefined" ) && ( storeData.url !== "" ) ) {
726
+ if ( wpslSettings.newWindow == 1 ) {
727
+ newWindow = "target='_blank'";
728
+ }
729
+
730
+ moreInfoContent += "<span><strong>Url</strong>: <a " + newWindow + " href=" + storeData.url + ">" + storeData.url + "</a></span>";
731
+ }
732
+
733
+ moreInfoContent += "</p>";
734
+
735
+ if ( ( typeof( storeData.hours ) !== "undefined" ) && ( storeData.hours !== "" ) ) {
736
+ moreInfoContent += "<div class='wpsl-store-hours'><strong>" + wpslLabels.hours + "</strong> " + storeData.hours + "</div>";
737
+ }
738
+
739
+ moreInfoContent += "</div>";
740
+
741
+ return moreInfoContent;
742
+ }
743
+
744
  function createDirectionUrl( street, city, zip, country ) {
745
  var destinationAddress, url;
746
 
761
 
762
  function storeHtml( response, url ) {
763
  var html = "",
764
+ moreInfoData,
765
  storeImg = "",
766
  moreInfo = "",
767
  moreInfoUrl = "#",
790
  /* If we show the store listings under the map, we do want to jump to the
791
  * top of the map to focus on the opened infowindow
792
  */
793
+ if ( ( wpslSettings.storeBelow == 1 ) && ( wpslSettings.moreInfoLocation == 'info window' ) ) {
794
  moreInfoUrl = '#wpsl-search-wrap';
795
  }
796
 
797
+ if ( wpslSettings.moreInfoLocation == "store listings" ) {
798
+
799
+ /* Only create the 'more info' link if there is data to show */
800
+ if ( ( ( typeof( response.description ) !== "undefined" ) && ( response.description !== "" ) ) ||
801
+ ( ( typeof( response.phone ) !== "undefined" ) && ( response.phone !== "" ) ) ||
802
+ ( ( typeof( response.fax ) !== "undefined" ) && ( response.fax !== "" ) ) ||
803
+ ( ( typeof( response.email ) !== "undefined" ) && ( response.email !== "" ) ) ||
804
+ ( ( typeof( response.hours ) !== "undefined" ) && ( response.hours !== "" ) ) ) {
805
+ moreInfoData = createMoreInfoListing( response );
806
+ moreInfo = "<p><a class='wpsl-store-details wpsl-store-listing' href=" + moreInfoUrl + "wpsl-id-" + id + ">" + wpslLabels.moreInfo + "</a>" + moreInfoData + "</p>";
807
+ }
808
+ } else {
809
+ moreInfo = "<p><a class='wpsl-store-details' href=" + moreInfoUrl + ">" + wpslLabels.moreInfo + "</a></p>";
810
+ }
811
  }
812
+
813
  html = "<li data-store-id='" + id + "'><div><p>" + storeImg + "<strong>" + store + "</strong><span class='wpsl-street'>" + street + "</span>" + city + " " + state + " " + zip + "<span class='wpsl-country'>" + country + "</p>" + moreInfo + "</div>" + distance + "<a class='wpsl-directions' " + url.target + " href='" + url.src + "'>" + wpslLabels.directions + "</a></li>";
814
 
815
  return html;
836
  }
837
 
838
  /* Remove all existing markers and route lines from the map */
839
+ function deleteOverlays( keepStartMarker ) {
840
  var markerLen, i;
841
  directionsDisplay.setMap( null );
842
+
843
  /* Remove all the markers from the map, and empty the array */
844
  if ( markersArray ) {
845
+ for ( i = 0, markerLen = markersArray.length; i < markerLen; i++ ) {
846
+ /* Check if we need to keep the start marker, or remove everything */
847
+ if ( keepStartMarker ) {
848
+ if ( markersArray[i].draggable != true ) {
849
+ markersArray[i].setMap( null );
850
+ } else {
851
+ startMarkerData = markersArray[i];
852
+ }
853
+ } else {
854
+ markersArray[i].setMap( null );
855
+ }
856
  }
857
 
858
  markersArray.length = 0;
887
  }
888
  });
889
 
890
+ /* Handle clicks on the store details link */
891
  $( "#wpsl-stores" ).on( "click", ".wpsl-store-details", function() {
892
+ var i, len,
893
+ $parentLi = $( this ).parents( "li" ),
894
+ storeId = $parentLi.data( "store-id" );
895
+
896
+ /* Check if we should show the 'more info' details */
897
+ if ( wpslSettings.moreInfoLocation == "info window" ) {
898
+ for ( i = 0, len = markersArray.length; i < len; i++ ) {
899
+ if ( markersArray[i].storeId == storeId ) {
900
+ google.maps.event.trigger( markersArray[i], "click" );
901
+ }
902
+ }
903
+ } else {
904
+
905
+ /* Check if we should set the 'more info' item to active or not */
906
+ if ( $parentLi.find( ".wpsl-more-info-listings" ).is( ":visible" ) ) {
907
+ $( this ).removeClass( "wpsl-active-details" );
908
+ } else {
909
+ $( this ).addClass( "wpsl-active-details" );
910
+ }
911
+
912
+ $parentLi.siblings().find( ".wpsl-store-details" ).removeClass( "wpsl-active-details" );
913
+ $parentLi.siblings().find( ".wpsl-more-info-listings" ).hide();
914
+ $parentLi.find( ".wpsl-more-info-listings" ).toggle();
915
+ }
916
 
 
 
 
 
 
 
917
  /* If we show the store listings under the map, we do want to jump to the
918
  * top of the map to focus on the opened infowindow
919
  */
920
+ if ( wpslSettings.storeBelow != 1 || wpslSettings.moreInfoLocation == "store listings" ) {
921
  return false;
922
  }
923
  });
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: tijmensmit
3
  Tags: google maps, store locator, business locations, geocoding, stores, geo
4
  Requires at least: 3.5
5
  Tested up to: 3.8.1
6
- Stable tag: 1.2.11
7
  License: GPLv3
8
  License URI: http://www.gnu.org/licenses/gpl.html
9
 
@@ -65,11 +65,19 @@ Make sure you don't have any security plugins, or custom functions running that
65
 
66
  == Changelog ==
67
 
 
 
 
 
 
 
 
 
68
  = 1.2.11 =
69
- * Fixed the distance format always using km when you clicked the 'directions' text in the marker
70
  * Fixed an issue where a CSS rule in some themes would place a background image on the active item in the dropdown list
71
  * Added an option to disable the mouse cursor on pageload focusing on the location input field
72
- * Added an option to add a 'More info' link to the store listings, which when clicked will open the infowindow in the marker on the map
73
 
74
  = 1.2.1 =
75
  * Added an option to show the store listings below the map instead of next to it
3
  Tags: google maps, store locator, business locations, geocoding, stores, geo
4
  Requires at least: 3.5
5
  Tested up to: 3.8.1
6
+ Stable tag: 1.2.12
7
  License: GPLv3
8
  License URI: http://www.gnu.org/licenses/gpl.html
9
 
65
 
66
  == Changelog ==
67
 
68
+ = 1.2.12 =
69
+ * Added an option to choose where the 'More info' details is shown, either in the store listings or on the map
70
+ * Added the 'back' and 'reset' text to the label fields on the settings page
71
+ * Added the option to remove the scrollbar when the store listings are shown below the map
72
+ * Improved the position of the reset button when the map controls are right aligned
73
+ * Fixed the 'More info' translation not working
74
+ * Fixed the start position marker disappearing when dragged
75
+
76
  = 1.2.11 =
77
+ * Fixed the distance format always using km when you click the 'directions' text in the marker
78
  * Fixed an issue where a CSS rule in some themes would place a background image on the active item in the dropdown list
79
  * Added an option to disable the mouse cursor on pageload focusing on the location input field
80
+ * Added an option to add a 'More info' link to the store listings, which when clicked will open the info window in the marker on the map
81
 
82
  = 1.2.1 =
83
  * Added an option to show the store listings below the map instead of next to it
wp-store-locator.php CHANGED
@@ -5,7 +5,7 @@ Plugin URI:
5
  Description: An easy to use location management system that enables users to search for nearby physical stores
6
  Author: Tijmen Smit
7
  Author URI: http://tijmensmit.com/
8
- Version: 1.2.11
9
  Text Domain: wpsl
10
  Domain Path: /languages/
11
  License: GPLv3
@@ -74,8 +74,10 @@ if ( !class_exists( 'WP_Store_locator' ) ) {
74
  'new_window' => '0',
75
  'reset_map' => '0',
76
  'store_below' => '0',
 
77
  'direction_redirect' => '0',
78
  'more_info' => '0',
 
79
  'mouse_focus' => '1',
80
  'start_marker' => 'red.png',
81
  'store_marker' => 'blue.png',
@@ -88,6 +90,8 @@ if ( !class_exists( 'WP_Store_locator' ) ) {
88
  'results_label' => 'Results',
89
  'more_label' => 'More info',
90
  'directions_label' => 'Directions',
 
 
91
  'error_label' => 'Something went wrong, please try again!',
92
  'limit_label' => 'API usage limit reached',
93
  'phone_label' => 'Phone',
@@ -126,7 +130,7 @@ if ( !class_exists( 'WP_Store_locator' ) ) {
126
  public function define_constants() {
127
 
128
  if ( !defined( 'WPSL_VERSION_NUM' ) )
129
- define( 'WPSL_VERSION_NUM', '1.2.11' );
130
 
131
  if ( !defined( 'WPSL_URL' ) )
132
  define( 'WPSL_URL', plugin_dir_url( __FILE__ ) );
5
  Description: An easy to use location management system that enables users to search for nearby physical stores
6
  Author: Tijmen Smit
7
  Author URI: http://tijmensmit.com/
8
+ Version: 1.2.12
9
  Text Domain: wpsl
10
  Domain Path: /languages/
11
  License: GPLv3
74
  'new_window' => '0',
75
  'reset_map' => '0',
76
  'store_below' => '0',
77
+ 'store_below_scroll' => '0',
78
  'direction_redirect' => '0',
79
  'more_info' => '0',
80
+ 'more_info_location' => 'info window',
81
  'mouse_focus' => '1',
82
  'start_marker' => 'red.png',
83
  'store_marker' => 'blue.png',
90
  'results_label' => 'Results',
91
  'more_label' => 'More info',
92
  'directions_label' => 'Directions',
93
+ 'back_label' => 'Back',
94
+ 'reset_label' => 'Reset',
95
  'error_label' => 'Something went wrong, please try again!',
96
  'limit_label' => 'API usage limit reached',
97
  'phone_label' => 'Phone',
130
  public function define_constants() {
131
 
132
  if ( !defined( 'WPSL_VERSION_NUM' ) )
133
+ define( 'WPSL_VERSION_NUM', '1.2.12' );
134
 
135
  if ( !defined( 'WPSL_URL' ) )
136
  define( 'WPSL_URL', plugin_dir_url( __FILE__ ) );