WP Store Locator - Version 2.0.1

Version Description

  • Fixed: Prevented other plugins that use underscore or backbone from breaking the JavaScript templates, via fatman49 and zurf.
  • Fixed: Street view not showing the correct location after using it more then once, via marijke_25.
Download this release

Release Info

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

Code changes from version 2.0 to 2.0.1

admin/class-store-overview.php DELETED
@@ -1,437 +0,0 @@
1
- <?php
2
- if ( !class_exists( 'WP_List_Table' ) ) {
3
- require_once( ABSPATH . 'wp-admin/includes/class-wp-list-table.php' );
4
- }
5
-
6
- /**
7
- * Class to create the table layout
8
- *
9
- * @package WordPress
10
- * @subpackage List_Table
11
- * @since 1.0
12
- */
13
- class WPSL_Store_Overview extends WP_List_Table {
14
-
15
- /**
16
- * Set the amount of stores that are shown on each page
17
- * @since 1.0
18
- * @var string
19
- */
20
- private $_per_page;
21
-
22
- /**
23
- * Class constructor
24
- */
25
- function __construct() {
26
-
27
- global $status, $page;
28
-
29
- parent::__construct( array(
30
- 'singular' => __( 'Store', 'wpsl' ),
31
- 'plural' => __( 'Stores', 'wpsl' ),
32
- 'ajax' => true
33
- ) );
34
-
35
- $this->_per_page = $this->get_per_page();
36
- }
37
-
38
- /**
39
- * Get the per_page value from the option table
40
- *
41
- * @since 1.2.20
42
- * @return string $per_page The amount of stores to show per page
43
- */
44
- function get_per_page() {
45
-
46
- $user = get_current_user_id();
47
- $screen = get_current_screen();
48
- $option = $screen->get_option( 'per_page', 'option' );
49
- $per_page = get_user_meta( $user, $option, true );
50
-
51
- if ( empty( $per_page ) || $per_page < 1 ) {
52
- $per_page = $screen->get_option( 'per_page', 'default' );
53
- }
54
-
55
- return $per_page;
56
- }
57
-
58
- /**
59
- * The default message that is shown when no store data exists
60
- *
61
- * @since 1.0
62
- * @return void
63
- */
64
- function no_items() {
65
- _e( 'No stores found', 'wpsl' );
66
- }
67
-
68
- /**
69
- * Set the default values for each column
70
- *
71
- * @since 1.0
72
- * @param array $item Data for a single column row
73
- * @param array $column_name The name of the column
74
- * @return mixed The value for each column
75
- */
76
- function column_default( $item, $column_name ) {
77
-
78
- switch( $column_name ) {
79
- case 'wpsl_id':
80
- case 'store':
81
- case 'address':
82
- case 'city':
83
- case 'state':
84
- case 'zip':
85
- return $item[$column_name];
86
- case 'thumb':
87
- if ( $item['thumb'] !== '0' ) {
88
- $thumb = '<img src="' . $item['thumb'] . '" width="36" height="36" />';
89
- } else {
90
- $thumb = '';
91
- }
92
-
93
- return $thumb;
94
- case 'active':
95
- return ( $item['active'] ) ? __( 'Active', 'wpsl' ) : __( 'Inactive', 'wpsl' );
96
- case 'action':
97
- return '<a class="button" href="' . admin_url( 'admin.php?page=wpsl_store_editor&action=edit_store&store_id=' . $item['wpsl_id'] ) . '">' . __( 'Edit', 'wpsl' ) . '</a><input type="button" class="button wpsl-delete-store-btn" name="text" value="' . __( 'Delete', 'wpsl' ) . '"><input name="wpsl_store_id" type="hidden" value="' . $item['wpsl_id'] . '" /><input name="wpsl_delete_nonce" type="hidden" value="' . wp_create_nonce( 'wpsl_delete_nonce_'.$item['wpsl_id'] ) . '" />';
98
- default:
99
- return 'wpsl_id';
100
- }
101
- }
102
-
103
- /**
104
- * Define which columns should be sortable
105
- *
106
- * @since 1.0
107
- * @return array $sortable_columns The list of sortable scolumns
108
- */
109
- function get_sortable_columns() {
110
-
111
- $sortable_columns = array(
112
- 'wpsl_id' => array( 'wpsl_id', true ), //true = already sorted ( default )
113
- 'thumb' => array( 'thumb', false ),
114
- 'store' => array( 'store', false ),
115
- 'address' => array( 'address', false ),
116
- 'city' => array( 'city', false ),
117
- 'state' => array( 'state', false ),
118
- 'zip' => array( 'zip', false ),
119
- 'active' => array( 'active', false )
120
- );
121
-
122
- return $sortable_columns;
123
- }
124
-
125
- /**
126
- * Get the list of columns
127
- *
128
- * @since 1.0
129
- * @return array $columns The list of columns
130
- */
131
- function get_columns() {
132
-
133
- $columns = array(
134
- 'cb' => '<input type="checkbox" />',
135
- 'wpsl_id' => __( 'ID', 'wpsl' ),
136
- 'thumb' => __( 'Thumbnail', 'wpsl' ),
137
- 'store' => __( 'Name', 'wpsl' ),
138
- 'address' => __( 'Address', 'wpsl' ),
139
- 'city' => __( 'City', 'wpsl' ),
140
- 'state' => __( 'State', 'wpsl' ),
141
- 'zip' => __( 'Zip', 'wpsl' ),
142
- 'active' => __( 'Status', 'wpsl' ),
143
- 'action' => __( 'Actions', 'wpsl' )
144
- );
145
-
146
- return $columns;
147
- }
148
-
149
- /**
150
- * Set the data for a checkbox column
151
- *
152
- * @since 1.0
153
- * @param array $item The store data for this table row
154
- * @return string The html for the checkbox with the correct value set
155
- */
156
- function column_cb( $item ) {
157
- return sprintf(
158
- '<input type="checkbox" name="store[]" value="%s" />', $item['wpsl_id']
159
- );
160
- }
161
-
162
- /**
163
- * Get the list of available bulk actions
164
- *
165
- * @since 1.0
166
- * @return array $actions The list of bulk actions
167
- */
168
- function get_bulk_actions() {
169
-
170
- $actions = array(
171
- 'delete' => __( 'Delete', 'wpsl' ),
172
- 'activate' => __( 'Activate', 'wpsl' ),
173
- 'deactivate' => __( 'Deactivate', 'wpsl' )
174
- );
175
-
176
- return $actions;
177
- }
178
-
179
- /**
180
- * Change the store status into either active or inactive
181
- *
182
- * @since 1.0
183
- * @param string $store_ids The list of store ids
184
- * @param string $status Is set to either activate or deactivate
185
- * @return void
186
- */
187
- function update_store_status( $store_ids, $status ) {
188
-
189
- global $wpdb;
190
-
191
- if ( $status === 'deactivate' ) {
192
- $active_status = 0;
193
- $success_action_desc = __( 'deactivated', 'wpsl' );
194
- $fail_action_desc = __( 'deactivating', 'wpsl' );
195
- } else {
196
- $active_status = 1;
197
- $success_action_desc = __( 'activated', 'wpsl' );
198
- $fail_action_desc = __( 'activating', 'wpsl' );
199
- }
200
-
201
- $result = $wpdb->query( $wpdb->prepare( "UPDATE $wpdb->wpsl_stores SET active = %d WHERE wpsl_id IN ( $store_ids )", $active_status ) );
202
-
203
- if ( $result === false ) {
204
- $state = 'error';
205
- $msg = sprintf( __( 'There was a problem %s the store(s), please try again.', 'wpsl' ), $fail_action_desc );
206
-
207
- } else {
208
- $state = 'updated';
209
- $msg = sprintf( __( 'Store(s) successfully %s.', 'wpsl' ), $success_action_desc );
210
- }
211
-
212
- add_settings_error ( 'bulk-state', esc_attr( 'bulk-state' ), $msg, $state );
213
- }
214
-
215
- /**
216
- * Remove the selected stores from the db
217
- *
218
- * @since 1.0
219
- * @param string $store_ids The list of store ids that should be deleted.
220
- * @return void
221
- */
222
- function remove_stores( $store_ids ) {
223
-
224
- global $wpdb;
225
-
226
- $result = $wpdb->query( "DELETE FROM $wpdb->wpsl_stores WHERE wpsl_id IN ( $store_ids )" );
227
-
228
- if ( $result === false ) {
229
- $state = 'error';
230
- $msg = __( 'There was a problem removing the store(s), please try again.', 'wpsl' );
231
- } else {
232
- $state = 'updated';
233
- $msg = __( 'Store(s) successfully removed.' , 'wpsl' );
234
- }
235
-
236
- add_settings_error ( 'bulk-remove', esc_attr( 'bulk-remove' ), $msg, $state );
237
- }
238
-
239
- /**
240
- * Process the bulk actions
241
- *
242
- * @since 1.0
243
- * @return void
244
- */
245
- function process_bulk_action() {
246
-
247
- if ( !current_user_can( apply_filters( 'wpsl_capability', 'manage_options' ) ) )
248
- die( '-1' );
249
-
250
- if ( isset( $_POST['_wpnonce'] ) && ! empty( $_POST['_wpnonce'] ) ) {
251
- $nonce = filter_input( INPUT_POST, '_wpnonce', FILTER_SANITIZE_STRING );
252
- $action = 'bulk-' . $this->_args['plural'];
253
-
254
- if ( !wp_verify_nonce( $nonce, $action ) )
255
- wp_die( 'Nope! Security check failed!' );
256
-
257
- $action = $this->current_action();
258
-
259
- /* If an action is set continue, otherwise reload the page */
260
- if ( !empty( $action ) ) {
261
- $id_list = array();
262
-
263
- foreach ( $_POST['store'] as $store_id ) {
264
- $id_list[] = $store_id;
265
- }
266
-
267
- /* Before checking which type of bulk action to run, we make sure we actually have some ids to process */
268
- if ( !empty( $id_list ) ) {
269
- $store_ids = esc_sql( implode( ',', wp_parse_id_list( $id_list ) ) );
270
-
271
- switch ( $action ) {
272
- case 'activate':
273
- $this->update_store_status( $store_ids, 'activate' );
274
- break;
275
- case 'deactivate':
276
- $this->update_store_status( $store_ids, 'deactivate' );
277
- break;
278
- case 'delete':
279
- $this->remove_stores( $store_ids );
280
- break;
281
- }
282
- }
283
- }
284
- }
285
- }
286
-
287
- /**
288
- * Get the required store data for the table list
289
- *
290
- * @since 1.0
291
- * @return array $response The required store data
292
- */
293
- function get_store_list() {
294
-
295
- global $wpdb;
296
-
297
- $total_items = 0;
298
-
299
- /* Check if we need to run the search query or just show all the data */
300
- if ( isset( $_POST['s'] ) && ( !empty( $_POST['s'] ) ) ) {
301
- $search = trim( $_POST['s'] );
302
- $result = $wpdb->get_results(
303
- $wpdb->prepare( "SELECT wpsl_id, store, address, city, state, zip, thumb_id AS thumb, active
304
- FROM $wpdb->wpsl_stores
305
- WHERE store LIKE %s OR address LIKE %s OR city LIKE %s OR state LIKE %s OR zip LIKE %s",
306
- '%' . like_escape( $search ). '%', '%' . like_escape( $search ). '%', '%' . like_escape( $search ). '%', '%' . like_escape( $search ). '%', '%' . like_escape( $search ). '%'
307
- ), ARRAY_A
308
- );
309
- } else {
310
- /* Order params */
311
- $orderby = !empty ( $_GET["orderby"] ) ? esc_sql( $_GET["orderby"] ) : 'store';
312
- $order = !empty ( $_GET["order"] ) ? esc_sql( $_GET["order"] ) : 'ASC';
313
- $order_sql = $orderby.' '.$order;
314
-
315
- /* Pagination parameters */
316
- $total_items = $wpdb->get_var( "SELECT COUNT(*) AS count FROM $wpdb->wpsl_stores" );
317
- $paged = !empty ( $_GET["paged"] ) ? esc_sql( $_GET["paged"] ) : '';
318
-
319
- if ( empty( $paged ) || !is_numeric( $paged ) || $paged <= 0 ) {
320
- $paged = 1;
321
- }
322
-
323
- $totalpages = ceil( $total_items / $this->_per_page );
324
-
325
- if ( !empty( $paged ) && !empty( $this->_per_page ) ){
326
- $offset = ( $paged - 1 ) * $this->_per_page;
327
- $limit_sql = (int)$offset.',' . (int)$this->_per_page;
328
- }
329
-
330
- $result = $wpdb->get_results( "SELECT wpsl_id, store, address, city, state, zip, thumb_id AS thumb, active FROM $wpdb->wpsl_stores ORDER BY $order_sql LIMIT $limit_sql", ARRAY_A );
331
- }
332
-
333
- $i = 0;
334
- foreach ( $result as $k => $store_details ) {
335
-
336
- /* Check for thumbnails */
337
- if ( absint ( $store_details["thumb"] ) ) {
338
- $thumb_src = wp_get_attachment_image_src( $store_details["thumb"] );
339
- $result[$i]["thumb"] = $thumb_src[0];
340
- }
341
-
342
- $i++;
343
- }
344
-
345
- $response = array(
346
- "data" => stripslashes_deep( $result ),
347
- "count" => $total_items
348
- );
349
-
350
- return $response;
351
- }
352
-
353
- /**
354
- * Prepares the list of items for displaying.
355
- *
356
- * @since 1.0
357
- * @uses WP_List_Table::set_pagination_args()
358
- * @return void
359
- */
360
- function prepare_items() {
361
-
362
- $columns = $this->get_columns();
363
- $hidden = array();
364
- $sortable = $this->get_sortable_columns();
365
-
366
- $this->process_bulk_action();
367
- $response = $this->get_store_list();
368
-
369
- $current_page = $this->get_pagenum();
370
- $total_items = $response['count'];
371
-
372
- $this->set_pagination_args( array(
373
- 'total_items' => $total_items,
374
- 'per_page' => $this->_per_page,
375
- 'total_pages' => ceil( $total_items / $this->_per_page )
376
- ) );
377
-
378
- $this->items = $response['data'];
379
- $this->_column_headers = array( $columns, $hidden, $sortable );
380
- }
381
-
382
- /**
383
- * Display the table with the store list
384
- *
385
- * @since 1.0
386
- * @uses WP_List_Table::display_tablenav()
387
- * @uses WP_List_Table::get_table_classes()
388
- * @uses WP_List_Table::print_column_headers()
389
- * @uses WP_List_Table::display_rows_or_placeholder()
390
- * @return void
391
- */
392
- function display() {
393
- $singular = $this->_args['singular'];
394
-
395
- $this->display_tablenav( 'top' );
396
- ?>
397
- <table class="wp-list-table <?php echo implode( ' ', $this->get_table_classes() ); ?>" cellspacing="0">
398
- <thead>
399
- <tr>
400
- <?php $this->print_column_headers(); ?>
401
- </tr>
402
- </thead>
403
-
404
- <tfoot>
405
- <tr>
406
- <?php $this->print_column_headers( false ); ?>
407
- </tr>
408
- </tfoot>
409
-
410
- <tbody id="the-list"<?php if ( $singular ) echo " data-wp-lists='list:$singular'"; ?>>
411
- <?php $this->display_rows_or_placeholder(); ?>
412
- </tbody>
413
- </table>
414
- <div id="wpsl-delete-confirmation">
415
- <p><?php _e( 'Are you sure you want to delete this store?', 'wpsl' ); ?></p>
416
- <p>
417
- <input class="button-primary" type="submit" name="delete" value="<?php _e( 'Delete', 'wpsl' ); ?>" />
418
- <input class="button-secondary dialog-cancel" type="reset" value="<?php _e( 'Cancel', 'wpsl' ); ?>" />
419
- </p>
420
- </div>
421
- <?php
422
- $this->display_tablenav( 'bottom' );
423
- }
424
-
425
- /**
426
- * Send required variables to JavaScript land
427
- */
428
- function _js_vars() {
429
-
430
- $args = array(
431
- 'url' => WPSL_URL
432
- );
433
-
434
- printf( "<script type='text/javascript'>var wpsl_data = %s;</script>\n", json_encode( $args ) );
435
- }
436
-
437
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
admin/js/retina-1.1.0.js DELETED
@@ -1,152 +0,0 @@
1
- /*!
2
- * Retina.js v1.1.0
3
- *
4
- * Copyright 2013 Imulus, LLC
5
- * Released under the MIT license
6
- *
7
- * Retina.js is an open source script that makes it easy to serve
8
- * high-resolution images to devices with retina displays.
9
- */
10
- (function() {
11
-
12
- var root = (typeof exports == 'undefined' ? window : exports);
13
-
14
- var config = {
15
- // Ensure Content-Type is an image before trying to load @2x image
16
- // https://github.com/imulus/retinajs/pull/45)
17
- check_mime_type: true
18
- };
19
-
20
-
21
-
22
- root.Retina = Retina;
23
-
24
- function Retina() {}
25
-
26
- Retina.configure = function(options) {
27
- if (options == null) options = {};
28
- for (var prop in options) config[prop] = options[prop];
29
- };
30
-
31
- Retina.init = function(context) {
32
- if (context == null) context = root;
33
-
34
- var existing_onload = context.onload || new Function;
35
-
36
- context.onload = function() {
37
- var images = document.getElementsByTagName("img"), retinaImages = [], i, image;
38
- for (i = 0; i < images.length; i++) {
39
- image = images[i];
40
- retinaImages.push(new RetinaImage(image));
41
- }
42
- existing_onload();
43
- }
44
- };
45
-
46
- Retina.isRetina = function(){
47
- var mediaQuery = "(-webkit-min-device-pixel-ratio: 1.5),\
48
- (min--moz-device-pixel-ratio: 1.5),\
49
- (-o-min-device-pixel-ratio: 3/2),\
50
- (min-resolution: 1.5dppx)";
51
-
52
- if (root.devicePixelRatio > 1)
53
- return true;
54
-
55
- if (root.matchMedia && root.matchMedia(mediaQuery).matches)
56
- return true;
57
-
58
- return false;
59
- };
60
-
61
-
62
- root.RetinaImagePath = RetinaImagePath;
63
-
64
- function RetinaImagePath(path, at_2x_path) {
65
- this.path = path;
66
- if (typeof at_2x_path !== "undefined" && at_2x_path !== null) {
67
- this.at_2x_path = at_2x_path;
68
- this.perform_check = false;
69
- } else {
70
- this.at_2x_path = path.replace(/\.\w+$/, function(match) { return "@2x" + match; });
71
- this.perform_check = true;
72
- }
73
- }
74
-
75
- RetinaImagePath.confirmed_paths = [];
76
-
77
- RetinaImagePath.prototype.is_external = function() {
78
- return !!(this.path.match(/^https?\:/i) && !this.path.match('//' + document.domain) )
79
- }
80
-
81
- RetinaImagePath.prototype.check_2x_variant = function(callback) {
82
- var http, that = this;
83
- if (this.is_external()) {
84
- return callback(false);
85
- } else if (!this.perform_check && typeof this.at_2x_path !== "undefined" && this.at_2x_path !== null) {
86
- return callback(true);
87
- } else if (this.at_2x_path in RetinaImagePath.confirmed_paths) {
88
- return callback(true);
89
- } else {
90
- http = new XMLHttpRequest;
91
- http.open('HEAD', this.at_2x_path);
92
- http.onreadystatechange = function() {
93
- if (http.readyState != 4) {
94
- return callback(false);
95
- }
96
-
97
- if (http.status >= 200 && http.status <= 399) {
98
- if (config.check_mime_type) {
99
- var type = http.getResponseHeader('Content-Type');
100
- if (type == null || !type.match(/^image/i)) {
101
- return callback(false);
102
- }
103
- }
104
-
105
- RetinaImagePath.confirmed_paths.push(that.at_2x_path);
106
- return callback(true);
107
- } else {
108
- return callback(false);
109
- }
110
- }
111
- http.send();
112
- }
113
- }
114
-
115
-
116
-
117
- function RetinaImage(el) {
118
- this.el = el;
119
- this.path = new RetinaImagePath(this.el.getAttribute('src'), this.el.getAttribute('data-at2x'));
120
- var that = this;
121
- this.path.check_2x_variant(function(hasVariant) {
122
- if (hasVariant) that.swap();
123
- });
124
- }
125
-
126
- root.RetinaImage = RetinaImage;
127
-
128
- RetinaImage.prototype.swap = function(path) {
129
- if (typeof path == 'undefined') path = this.path.at_2x_path;
130
-
131
- var that = this;
132
- function load() {
133
- if (! that.el.complete) {
134
- setTimeout(load, 5);
135
- } else {
136
- that.el.setAttribute('width', that.el.offsetWidth);
137
- that.el.setAttribute('height', that.el.offsetHeight);
138
- that.el.setAttribute('src', path);
139
- }
140
- }
141
- load();
142
- }
143
-
144
-
145
-
146
-
147
- if (Retina.isRetina()) {
148
- Retina.init(root);
149
- }
150
-
151
- })();
152
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
admin/misc-functions.php DELETED
@@ -1,30 +0,0 @@
1
- <?php
2
- add_action( 'plugins_loaded', 'add_wpsl_screen_filter' );
3
-
4
- /**
5
- * Add the filter to save the visible store value
6
- *
7
- * @since 1.2.20
8
- * @return void
9
- */
10
- function add_wpsl_screen_filter() {
11
- add_filter( 'set-screen-option', 'set_wpsl_screen_option', 10, 3 );
12
- }
13
-
14
- /**
15
- * Save the wpsl screen options
16
- *
17
- * Users can define the amount of visible stores
18
- *
19
- * @since 1.2.20
20
- * @param bool|int $status Screen option value. Default false to skip.
21
- * @param string $option The option name.
22
- * @param int $value The number of rows to use.
23
- * @return bool|int $value|$status
24
- */
25
- function set_wpsl_screen_option( $status, $option, $value ) {
26
-
27
- if ( 'wpsl_stores_per_page' == $option ) return $value;
28
-
29
- return $status;
30
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
admin/templates/add-store.php DELETED
@@ -1,111 +0,0 @@
1
- <div id="wpsl-wrap" class="wrap wpsl-add-stores">
2
- <h2>WP Store Locator</h2>
3
- <?php settings_errors(); ?>
4
-
5
- <?php echo $this->create_menu(); ?>
6
-
7
- <form method="post" action="" accept-charset="utf-8">
8
- <input type="hidden" name="wpsl_actions" value="add_new_store" />
9
- <?php wp_nonce_field( 'wpsl_add_new_store' ); ?>
10
- <div class="wpsl-add-store">
11
- <div class="metabox-holder">
12
- <div class="postbox">
13
- <h3><span><?php _e( 'Store details', 'wpsl' ); ?></span></h3>
14
- <div class="inside">
15
- <p>
16
- <label for="wpsl-store-name"><?php _e( 'Store Name:', 'wpsl' ); ?></label>
17
- <input id="wpsl-store-name" name="wpsl[store]" type="text" class="textinput <?php if ( isset( $_POST['wpsl'] ) && empty( $_POST['wpsl']['store'] ) ) { echo 'wpsl-error'; } ?>" value="<?php if ( !empty( $_POST['wpsl']['store'] ) ) { echo esc_attr( stripslashes( $_POST['wpsl']['store'] ) ); } ?>" />
18
- </p>
19
- <p>
20
- <label for="wpsl-store-address"><?php _e( 'Address:', 'wpsl' ); ?></label>
21
- <input id="wpsl-store-address" name="wpsl[address]" type="text" class="textinput <?php if ( isset( $_POST['wpsl'] ) && empty( $_POST['wpsl']['address'] ) ) { echo 'wpsl-error'; } ?>" value="<?php if ( !empty( $_POST['wpsl']['address'] ) ) { echo esc_attr( stripslashes( $_POST['wpsl']['address'] ) ); } ?>" />
22
- </p>
23
- <p>
24
- <label for="wpsl-store-address2"><?php _e( 'Address 2:', 'wpsl' ); ?></label>
25
- <input id="wpsl-store-address2" name="wpsl[address2]" type="text" class="textinput" value="<?php if ( !empty( $_POST['wpsl']['address2'] ) ) { echo esc_attr( stripslashes( $_POST['wpsl']['address2'] ) ); } ?>" />
26
- </p>
27
- <p>
28
- <label for="wpsl-store-city"><?php _e( 'City:', 'wpsl' ); ?></label>
29
- <input id="wpsl-store-city" name="wpsl[city]" type="text" class="textinput <?php if ( isset( $_POST['wpsl'] ) && empty( $_POST['wpsl']['city'] ) ) { echo 'wpsl-error'; } ?>" value="<?php if ( !empty( $_POST['wpsl']['city'] ) ) { echo esc_attr( stripslashes( $_POST['wpsl']['city'] ) ); } ?>" />
30
- </p>
31
- <p>
32
- <label for="wpsl-store-state"><?php _e( 'State / Province:', 'wpsl' ); ?></label>
33
- <input id="wpsl-store-state" name="wpsl[state]" type="text" class="textinput" value="<?php if ( !empty( $_POST['wpsl']['state'] ) ) { echo esc_attr( stripslashes( $_POST['wpsl']['state'] ) ); } ?>" />
34
- </p>
35
- <p>
36
- <label for="wpsl-store-zip"><?php _e( 'Zip Code:', 'wpsl' ); ?></label>
37
- <input id="wpsl-store-zip" name="wpsl[zip]" type="text" class="textinput" value="<?php if ( !empty( $_POST['wpsl']['zip'] ) ) { echo esc_attr( stripslashes( $_POST['wpsl']['zip'] ) ); } ?>" />
38
- </p>
39
- <p>
40
- <label for="wpsl-store-country"><?php _e( 'Country:', 'wpsl' ); ?></label>
41
- <input id="wpsl-store-country" name="wpsl[country]" type="text" class="textinput <?php if ( isset( $_POST['wpsl'] ) && empty( $_POST['wpsl']['country'] ) ) { echo 'wpsl-error'; } ?>" value="<?php if ( !empty( $_POST['wpsl']['country'] ) ) { echo esc_attr( stripslashes( $_POST['wpsl']['country'] ) ); } else { echo esc_attr( stripslashes( $this->settings['editor_country'] ) ); } ?>" />
42
- <input id="wpsl-country-iso" type="hidden" name="wpsl[country-iso]" value="<?php if ( !empty( $_POST['wpsl']['country-iso'] ) ) { echo esc_attr( $_POST['wpsl']['country-iso'] ); } ?>" />
43
- </p>
44
- <p>
45
- <label for="wpsl-store-lat"><?php _e( 'Latitude:', 'wpsl' ); ?></label>
46
- <input id="wpsl-store-lat" name="wpsl[lat]" type="text" class="textinput" value="<?php if ( !empty( $_POST['wpsl']['lat'] ) ) { echo esc_attr( $_POST['wpsl']['lat'] ); } ?>" />
47
- </p>
48
- <p>
49
- <label for="wpsl-store-lng"><?php _e( 'Longitude:', 'wpsl' ); ?></label>
50
- <input id="wpsl-store-lng" name="wpsl[lng]" type="text" class="textinput" value="<?php if ( !empty( $_POST['wpsl']['lng'] ) ) { echo esc_attr( $_POST['wpsl']['lng'] ); } ?>" />
51
- </p>
52
- <p class="wpsl-submit-wrap">
53
- <input id="wpsl-lookup-location" type="submit" name="wpsl-lookup-location" class="button-primary" value="<?php _e( 'Preview location on the map', 'wpsl' ); ?>" />
54
- <em class="nwm-desc"><?php _e( 'You can adjust the location by dragging the marker around', 'wpsl' ); ?></em>
55
- </p>
56
- </div>
57
- </div>
58
- </div>
59
-
60
- <div id="wpsl-gmap-wrap"></div>
61
- </div>
62
-
63
- <div class="metabox-holder">
64
- <div class="postbox">
65
- <h3><span><?php _e( 'Extra details', 'wpsl' ); ?></span></h3>
66
- <div class="inside">
67
- <p>
68
- <label for="wpsl-store-phone"><?php _e( 'Phone:', 'wpsl' ); ?></label>
69
- <input id="wpsl-store-phone" name="wpsl[phone]" type="text" class="textinput" value="<?php if ( !empty( $_POST['wpsl']['phone'] ) ) { echo esc_attr( $_POST['wpsl']['phone'] ); } ?>">
70
- </p>
71
- <p>
72
- <label for="wpsl-store-fax"><?php _e( 'Fax:', 'wpsl' ); ?></label>
73
- <input id="wpsl-store-fax" name="wpsl[fax]" type="text" class="textinput" value="<?php if ( !empty( $_POST['wpsl']['fax'] ) ) { echo esc_attr( $_POST['wpsl']['fax'] ); } ?>">
74
- </p>
75
- <p>
76
- <label for="wpsl-store-email"><?php _e( 'Email:', 'wpsl' ); ?></label>
77
- <input id="wpsl-store-email" name="wpsl[email]" type="email" class="textinput" value="<?php if ( !empty( $_POST['wpsl']['email'] ) ) { echo esc_attr( $_POST['wpsl']['email'] ); } ?>">
78
- </p>
79
- <p>
80
- <label for="wpsl-store-url"><?php _e( 'Url:', 'wpsl' ); ?></label>
81
- <input id="wpsl-store-url" name="wpsl[url]" type="url" class="textinput" value="<?php if ( !empty( $_POST['wpsl']['url'] ) ) { echo esc_url( $_POST['wpsl']['url'] ); } ?>">
82
- </p>
83
- <p>
84
- <label for="wpsl-store-desc"><?php _e( 'Description:', 'wpsl' ); ?></label>
85
- <textarea id="wpsl-store-desc" name="wpsl[desc]" cols="5" rows="5"><?php if ( !empty( $_POST['wpsl']['desc'] ) ) { echo esc_textarea( stripslashes( $_POST['wpsl']['desc'] ) ); } ?></textarea>
86
- </p>
87
- <p>
88
- <label for="wpsl-store-hours"><?php _e( 'Operation Hours:', 'wpsl' ); ?></label>
89
- <textarea id="wpsl-store-hours" name="wpsl[hours]" cols="5" rows="5"><?php if ( !empty( $_POST['wpsl']['hours'] ) ) { echo esc_textarea( stripslashes( $_POST['wpsl']['hours'] ) ); } ?></textarea>
90
- </p>
91
- <?php if ( current_user_can( 'upload_files' ) ) { ?>
92
- <div id="wpsl-thumb-wrap">
93
- <p>
94
- <label><?php _e( 'Thumbnail:', 'wpsl' ); ?></label>
95
- <span class="wpsl-thumb-placeholder"></span>
96
- </p>
97
- <div>
98
- <input id="wpsl-media-upload" class="button-primary" type="button" name="text" value="<?php _e( 'Change thumbnail', 'wpsl' ); ?>" />
99
- <input id="wpsl-remove-thumb" class="button-primary" type="button" name="text" value="<?php _e( 'Remove', 'wpsl' ); ?>" />
100
- <input type="hidden" id="wpsl-thumb-id" name="wpsl[thumb-id]" value="" />
101
- </div>
102
- </div>
103
- <?php } ?>
104
- </div>
105
- </div>
106
-
107
- <p><input id="wpsl-add-store" type="submit" name="wpsl-add-store" class="button-primary" value="<?php _e( 'Add Store', 'wpsl' ); ?>" /></p>
108
- </div>
109
- </form>
110
-
111
- </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
admin/templates/edit-store.php DELETED
@@ -1,140 +0,0 @@
1
- <?php
2
- $store_id = absint( $_GET['store_id'] );
3
- $thumb = '';
4
-
5
- if ( $store_id ) {
6
- $store_details = $this->get_store_data( $store_id );
7
-
8
- if ( $store_details['thumb_id'] ) {
9
- $thumb = wp_get_attachment_image_src( $store_details['thumb_id'], 'thumbnail' );
10
- }
11
- }
12
- ?>
13
- <div id="wpsl-wrap" class="wrap wpsl-add-stores">
14
- <h2 class="wpsl-edit-header"><?php _e( 'Edit ', 'wpsl' ); if ( isset( $_POST['wpsl'] ) && empty( $_POST['wpsl']['store'] ) ) { echo esc_attr( stripslashes( $_POST['wpsl']['store'] ) ); } else { echo esc_attr( stripslashes( $store_details['store'] ) ); } ?></h2>
15
- <?php settings_errors(); ?>
16
-
17
- <form method="post" action="" accept-charset="utf-8">
18
- <input type="hidden" name="wpsl_actions" value="update_store" />
19
- <?php wp_nonce_field( 'wpsl_update_store' ); ?>
20
- <div class="wpsl-add-store">
21
- <div class="metabox-holder">
22
- <div class="postbox">
23
- <h3><span><?php _e( 'Store details', 'wpsl' ); ?></span></h3>
24
- <div class="inside">
25
- <p>
26
- <label for="wpsl-store-status"><?php _e( 'Status:', 'wpsl' ); ?></label>
27
- <span class="wpsl-radioboxes">
28
- <input id="wpsl-store-active" type="radio" name="wpsl[active]" <?php checked( '1', $store_details['active'], true ); ?> value="1" />
29
- <label for="wpsl-store-active"><?php _e( 'active', 'wpsl' ); ?></label>
30
- <input id="wpsl-store-inactive" type="radio" name="wpsl[active]" <?php checked( '0', $store_details['active'], true ); ?> value="0" />
31
- <label for="wpsl-store-inactive"><?php _e( 'inactive', 'wpsl' ); ?></label>
32
- </span>
33
- </p>
34
- <p>
35
- <label for="wpsl-store-name"><?php _e( 'Store Name:', 'wpsl' ); ?></label>
36
- <input id="wpsl-store-name" name="wpsl[store]" type="text" class="textinput <?php if ( isset( $_POST['wpsl'] ) && empty( $_POST['wpsl']['store'] ) ) { echo 'wpsl-error'; } ?>" value="<?php if ( isset( $_POST['wpsl'] ) && empty( $_POST['wpsl']['store'] ) ) { echo esc_attr( stripslashes( $_POST['wpsl']['store'] ) ); } else { echo esc_attr( stripslashes( $store_details['store'] ) ); } ?>" />
37
- </p>
38
- <p>
39
- <label for="wpsl-store-address"><?php _e( 'Address:', 'wpsl' ); ?></label>
40
- <input id="wpsl-store-address" name="wpsl[address]" type="text" class="textinput <?php if ( isset( $_POST['wpsl'] ) && empty( $_POST['wpsl']['address'] ) ) { echo 'wpsl-error'; } ?>" value="<?php if ( isset( $_POST['wpsl'] ) && empty( $_POST['wpsl']['address'] ) ) { echo esc_attr( stripslashes( $_POST['wpsl']['address'] ) ); } else { echo esc_attr( stripslashes( $store_details['address'] ) ); } ?>" />
41
- </p>
42
- <p>
43
- <label for="wpsl-store-address2"><?php _e( 'Address 2:', 'wpsl' ); ?></label>
44
- <input id="wpsl-store-address2" name="wpsl[address2]" type="text" class="textinput" value="<?php if ( isset( $_POST['wpsl'] ) && empty( $_POST['wpsl']['address2'] ) ) { echo esc_attr( stripslashes( $_POST['wpsl']['address2'] ) ); } else { echo esc_attr( stripslashes( $store_details['address2'] ) ); } ?>" />
45
- </p>
46
- <p>
47
- <label for="wpsl-store-city"><?php _e( 'City:', 'wpsl' ); ?></label>
48
- <input id="wpsl-store-city" name="wpsl[city]" type="text" class="textinput <?php if ( isset( $_POST['wpsl'] ) && empty( $_POST['wpsl']['city'] ) ) { echo 'wpsl-error'; } ?>" value="<?php if ( isset( $_POST['wpsl'] ) && empty( $_POST['wpsl']['city'] ) ) { echo esc_attr( stripslashes( $_POST['wpsl']['city'] ) ); } else { echo esc_attr( stripslashes( $store_details['city'] ) ); } ?>" />
49
- </p>
50
- <p>
51
- <label for="wpsl-store-state"><?php _e( 'State / Province:', 'wpsl' ); ?></label>
52
- <input id="wpsl-store-state" name="wpsl[state]" type="text" class="textinput" value="<?php if ( isset( $_POST['wpsl'] ) && empty( $_POST['wpsl']['state'] ) ) { echo esc_attr( stripslashes( $_POST['wpsl']['state'] ) ); } else { echo esc_attr( stripslashes( $store_details['state'] ) ); } ?>" />
53
- </p>
54
- <p>
55
- <label for="wpsl-store-zip"><?php _e( 'Zip Code:', 'wpsl' ); ?></label>
56
- <input id="wpsl-store-zip" name="wpsl[zip]" type="text" class="textinput" value="<?php if ( isset( $_POST['wpsl'] ) && empty( $_POST['wpsl']['zip'] ) ) { echo esc_attr( stripslashes( $_POST['wpsl']['zip'] ) ); } else { echo esc_attr( stripslashes( $store_details['zip'] ) ); } ?>" />
57
- </p>
58
- <p>
59
- <label for="wpsl-store-country"><?php _e( 'Country:', 'wpsl' ); ?></label>
60
- <input id="wpsl-store-country" name="wpsl[country]" type="text" class="textinput <?php if ( isset( $_POST['wpsl'] ) && empty( $_POST['wpsl']['country'] ) ) { echo 'wpsl-error'; } ?>" value="<?php if ( isset( $_POST['wpsl'] ) && empty( $_POST['wpsl']['country'] ) ) { echo esc_attr( stripslashes( $_POST['wpsl']['country'] ) ); } else { echo esc_attr( stripslashes( $store_details['country'] ) ); } ?>" />
61
- <input id="wpsl-country-iso" type="hidden" name="wpsl[country-iso]" value="<?php echo esc_attr( $store_details['country_iso'] ); ?>" />
62
- </p>
63
- <p>
64
- <label for="wpsl-store-lat"><?php _e( 'Latitude:', 'wpsl' ); ?></label>
65
- <input id="wpsl-store-lat" name="wpsl[lat]" type="text" class="textinput" value="<?php if ( isset( $_POST['wpsl'] ) && empty( $_POST['wpsl']['lat'] ) ) { echo esc_attr( $_POST['wpsl']['lat'] ); } else { echo esc_attr( $store_details['lat'] ); } ?>" />
66
- </p>
67
- <p>
68
- <label for="wpsl-store-lng"><?php _e( 'Longitude:', 'wpsl' ); ?></label>
69
- <input id="wpsl-store-lng" name="wpsl[lng]" type="text" class="textinput" value="<?php if ( isset( $_POST['wpsl'] ) && empty( $_POST['wpsl']['lng'] ) ) { echo esc_attr( $_POST['wpsl']['lng'] ); } else { echo esc_attr( $store_details['lng'] ); } ?>" />
70
- </p>
71
- <p class="wpsl-submit-wrap">
72
- <input id="wpsl-lookup-location" type="submit" name="wpsl-lookup-location" class="button-primary" value="<?php _e( 'Preview location on the map', 'wpsl' ); ?>" />
73
- <em class="nwm-desc"><?php _e( 'You can adjust the location by dragging the marker around', 'nwm' ); ?></em>
74
- </p>
75
- </div>
76
- </div>
77
- </div>
78
-
79
- <div id="wpsl-gmap-wrap"></div>
80
- </div>
81
-
82
- <div class="metabox-holder">
83
- <div class="postbox">
84
- <h3><span><?php _e( 'Extra details', 'wpsl' ); ?></span></h3>
85
- <div class="inside">
86
- <p>
87
- <label for="wpsl-store-phone"><?php _e( 'Phone:', 'wpsl' ); ?></label>
88
- <input id="wpsl-store-phone" name="wpsl[phone]" type="text" class="textinput" value="<?php if ( isset( $_POST['wpsl']['phone'] ) ) { echo esc_attr( $_POST['wpsl']['phone'] ); } else { echo esc_attr( $store_details['phone'] ); } ?>">
89
- </p>
90
- <p>
91
- <label for="wpsl-store-fax"><?php _e( 'Fax:', 'wpsl' ); ?></label>
92
- <input id="wpsl-store-fax" name="wpsl[fax]" type="text" class="textinput" value="<?php if ( isset( $_POST['wpsl']['fax'] ) ) { echo esc_attr( $_POST['wpsl']['fax'] ); } else { echo esc_attr( $store_details['fax'] ); } ?>">
93
- </p>
94
- <p>
95
- <label for="wpsl-store-email"><?php _e( 'Email:', 'wpsl' ); ?></label>
96
- <input id="wpsl-store-email" name="wpsl[email]" type="email" class="textinput" value="<?php if ( isset( $_POST['wpsl']['email'] ) ) { echo esc_attr( $_POST['wpsl']['email'] ); } else { echo esc_attr( $store_details['email'] ); } ?>">
97
- </p>
98
- <p>
99
- <label for="wpsl-store-url"><?php _e( 'Url:', 'wpsl' ); ?></label>
100
- <input id="wpsl-store-url" name="wpsl[url]" type="url" class="textinput" value="<?php if ( isset( $_POST['wpsl']['url'] ) ) { echo esc_url( $_POST['wpsl']['url'] ); } else { echo esc_url( $store_details['url'] ); } ?>">
101
- </p>
102
- <p>
103
- <label for="wpsl-store-desc"><?php _e( 'Description:', 'wpsl' ); ?></label>
104
- <textarea id="wpsl-store-desc" name="wpsl[desc]" cols="5" rows="5"><?php if ( isset( $_POST['wpsl']['desc'] ) ) { echo esc_textarea( stripslashes( $_POST['wpsl']['desc'] ) ); } else { echo esc_textarea( stripslashes( $store_details['description'] ) ); } ?></textarea>
105
- </p>
106
- <p>
107
- <label for="wpsl-store-hours"><?php _e( 'Operation Hours:', 'wpsl' ); ?></label>
108
- <textarea id="wpsl-store-hours" name="wpsl[hours]" cols="5" rows="5"><?php if ( isset( $_POST['wpsl']['hours'] ) ) { echo esc_textarea( stripslashes( $_POST['wpsl']['hours'] ) ); } else { echo esc_textarea( stripslashes( $store_details['hours'] ) ); } ?></textarea>
109
- </p>
110
- <?php if ( current_user_can( 'upload_files' ) ) { ?>
111
- <div id="wpsl-thumb-wrap">
112
- <p>
113
- <label><?php _e( 'Thumbnail:', 'wpsl' ); ?></label>
114
- <?php
115
- if ( !empty( $thumb ) ) {
116
- echo '<img class="wpsl-curve" src=" ' . esc_url ( $thumb[0] ) . '" width="85" height="85">';
117
- } else {
118
- ?>
119
- <span class="wpsl-thumb-placeholder"></span>
120
- <?php
121
- }
122
- ?>
123
- </p>
124
- <div>
125
- <input id="wpsl-media-upload" class="button-primary" type="button" name="text" value="<?php _e( 'Change thumbnail', 'wpsl' ); ?>" />
126
- <input id="wpsl-remove-thumb" class="button-primary" type="button" name="text" value="<?php _e( 'Remove', 'wpsl' ); ?>" />
127
- <input type="hidden" id="wpsl-thumb-id" name="wpsl[thumb-id]" value="<?php echo esc_attr( $store_details['thumb_id'] ); ?>" />
128
- </div>
129
- </div>
130
- <?php } ?>
131
- </div>
132
- </div>
133
-
134
- <p>
135
- <input id="wpsl-update-store" type="submit" name="wpsl-update-store" class="button-primary" value="<?php _e( 'Update Store', 'wpsl' ); ?>" />
136
- </p>
137
- </div>
138
- </form>
139
-
140
- </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
admin/templates/faq.php DELETED
@@ -1,38 +0,0 @@
1
- <div id="wpsl-wrap" class="wrap wpsl-settings">
2
- <h2>WP Store Locator: <?php _e( 'FAQ', 'wpsl' ); ?></h2>
3
-
4
- <div id="wpsl-faq">
5
- <dl>
6
- <dt><?php _e( 'How do I show the store locator on my page?', 'wpsl' ); ?></dt>
7
- <dd>
8
- <p><?php _e( 'Add this shortcode <code>[wpsl]</code> to the page where you want to show the store locator.', 'wpsl' ); ?></p>
9
- </dd>
10
- </dl>
11
- <dl>
12
- <dt><?php _e( 'The map doesn\'t display properly. It\'s either broken in half or doesn\'t load at all.', 'wpsl'); ?></dt>
13
- <dd>
14
- <p><?php _e( 'Make sure you have defined a start point for the map under settings -> map settings.', 'wpsl'); ?></p>
15
- </dd>
16
- </dl>
17
- <dl>
18
- <dt><?php _e( 'I get an error saying the "sensor" parameter specified in the request must be set to either "true" or "false".', 'wpsl'); ?></dt>
19
- <dd>
20
- <p><?php _e( 'Make sure you don\'t have any security plugins, or custom functions running that strip away version numbers from file paths.', 'wpsl'); ?></p>
21
- </dd>
22
- </dl>
23
- <dl>
24
- <dt><?php _e( 'The store locator doesn\'t load, it only shows the number 1?', 'wpsl' ); ?></dt>
25
- <dd>
26
- <p><?php _e( 'This is most likely caused by your theme using ajax navigation ( the loading of content without reloading the page ), or a conflict with another plugin. Try to disable the ajax navigation in the theme settings, or deactivate the plugin that enables it to see if that solves the problem.', 'wpsl' ); ?></p>
27
- <p><?php _e( 'If you don\'t use ajax navigation, but do see the number 1 it\'s probably a conflict with another plugin. Try to disable the plugins one by one to see if one of them is causing a conflict.', 'wpsl' ); ?></p>
28
- <p><?php echo sprintf( __( 'If you find a plugin or theme that causes a conflict, please report it on the <a href="%s">support page</a>.', 'wpsl' ), 'http://wordpress.org/support/plugin/wp-store-locator' ); ?></p>
29
- </dd>
30
- </dl>
31
- <dl>
32
- <dt><?php _e( 'Why does it show the location I searched for in the wrong country?', 'wpsl' ); ?></dt>
33
- <dd>
34
- <p><?php _e( 'Some location names exist in more then one country, and Google will guess which one you mean. This can be fixed by setting the correct "Map Region" on the settings page -> "API Settings".', 'wpsl' ); ?></p>
35
- </dd>
36
- </dl>
37
- </div>
38
- </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
admin/templates/stores-overview.php DELETED
@@ -1,20 +0,0 @@
1
- <?php
2
- require_once WPSL_PLUGIN_DIR . 'admin/class-store-overview.php';
3
-
4
- $store_overview = new WPSL_Store_Overview();
5
- $store_overview->prepare_items();
6
- ?>
7
-
8
- <div id="wpsl-store-overview" class="wrap">
9
- <h2>WP Store Locator</h2>
10
- <?php settings_errors(); ?>
11
-
12
- <?php echo $this->create_menu(); ?>
13
-
14
- <form method="post">
15
- <?php
16
- $store_overview->search_box( 'search', 'search_id' );
17
- $store_overview->display();
18
- ?>
19
- </form>
20
- </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
frontend/wpsl-ajax-functions.php DELETED
@@ -1,124 +0,0 @@
1
- <?php
2
- add_action( 'wp_ajax_store_search', 'wpsl_store_search' );
3
- add_action( 'wp_ajax_nopriv_store_search', 'wpsl_store_search' );
4
-
5
- /**
6
- * Handle the ajax store search on the frontend.
7
- *
8
- * Search for stores that fall within the selected distance range.
9
- * This happens by calculating the distance between the latlng of the starting point
10
- * and the latlng from the stores.
11
- *
12
- * @since 1.0
13
- * @return json The list of stores in $store_results that matches with the request or false if the query returns no results
14
- */
15
- function wpsl_store_search() {
16
-
17
- global $wpdb;
18
-
19
- $options = get_option( 'wpsl_settings' );
20
- $distance_unit = ( $options['distance_unit'] == 'km' ) ? '6371' : '3959';
21
-
22
- /* Check if we need to include the distance and radius limit in the sql query.
23
- * If autoload is enabled we load all stores, so no limits required.
24
- */
25
- if ( isset( $_GET['autoload'] ) && ( $_GET['autoload'] == 1 ) ) {
26
- $sql_part = ' ORDER BY distance';
27
- $placeholders = array(
28
- $_GET["lat"],
29
- $_GET["lng"],
30
- $_GET["lat"]
31
- );
32
- } else {
33
- $max_results = ( isset( $_GET['max_results'] ) ) ? $_GET['max_results'] : '';
34
-
35
- if ( ( $max_results == 'NaN' ) || ( !$max_results ) ) {
36
- $max_results = get_default_list_value( $type = 'max_results' );
37
- }
38
-
39
- $sql_part = ' HAVING distance < %d ORDER BY distance LIMIT 0, %d';
40
- $placeholders = array(
41
- $_GET["lat"],
42
- $_GET["lng"],
43
- $_GET["lat"],
44
- $_GET["radius"],
45
- $max_results
46
- );
47
- }
48
-
49
- $result = $wpdb->get_results(
50
- $wpdb->prepare( "
51
- SELECT *, ( $distance_unit * acos( cos( radians( %s ) ) * cos( radians( lat ) ) * cos( radians( lng ) - radians( %s ) ) + sin( radians( %s ) ) * sin( radians( lat ) ) ) )
52
- AS distance FROM $wpdb->wpsl_stores WHERE active = 1
53
- $sql_part
54
- ",
55
- $placeholders
56
- )
57
- );
58
-
59
- if ( $result === false ) {
60
- wp_send_json_error();
61
- } else {
62
- $store_results = array();
63
-
64
- foreach ( $result as $k => $v ) {
65
- /* If we have a valid thumb id, get the src */
66
- if ( absint ( $result[$k]->thumb_id ) ) {
67
- $thumb_src = wp_get_attachment_image_src( $result[$k]->thumb_id );
68
- $result[$k]->thumb_src = $thumb_src[0];
69
- } else {
70
- $result[$k]->thumb_src = '';
71
- }
72
-
73
- /* Sanitize the results before they are returned */
74
- $store_results[] = array (
75
- 'id' => absint( $result[$k]->wpsl_id ),
76
- 'store' => sanitize_text_field( stripslashes( $result[$k]->store ) ),
77
- 'address' => sanitize_text_field( stripslashes( $result[$k]->address ) ),
78
- 'address2' => sanitize_text_field( stripslashes( $result[$k]->address2 ) ),
79
- 'city' => sanitize_text_field( stripslashes( $result[$k]->city ) ),
80
- 'state' => sanitize_text_field( stripslashes( $result[$k]->state ) ),
81
- 'zip' => sanitize_text_field( stripslashes( $result[$k]->zip ) ),
82
- 'country' => sanitize_text_field( stripslashes( $result[$k]->country ) ),
83
- 'distance' => $result[$k]->distance,
84
- 'lat' => $result[$k]->lat,
85
- 'lng' => $result[$k]->lng,
86
- 'description' => wpautop( strip_tags( stripslashes( $result[$k]->description ) ) ),
87
- 'phone' => sanitize_text_field( stripslashes( $result[$k]->phone ) ),
88
- 'fax' => sanitize_text_field( stripslashes( $result[$k]->fax ) ),
89
- 'email' => sanitize_email( $result[$k]->email ),
90
- 'hours' => wpautop( strip_tags( stripslashes( $result[$k]->hours ) ) ),
91
- 'url' => esc_url( $result[$k]->url ),
92
- 'thumb' => esc_url( $result[$k]->thumb_src )
93
- );
94
- }
95
-
96
- wp_send_json( $store_results );
97
- }
98
-
99
- die();
100
- }
101
-
102
- /**
103
- * Get the default selected value for a dropdown
104
- *
105
- * @since 1.0
106
- * @param string $type The request list type
107
- * @return string $response The default list value
108
- */
109
- function get_default_list_value( $type ) {
110
-
111
- $settings = get_option( 'wpsl_settings' );
112
- $list_values = explode( ',', $settings[$type] );
113
-
114
- foreach ( $list_values as $k => $list_value ) {
115
-
116
- /* The default radius has a () wrapped around it, so we check for that and filter out the () */
117
- if ( strpos( $list_value, '(' ) !== false ) {
118
- $response = filter_var( $list_value, FILTER_SANITIZE_NUMBER_INT );
119
- break;
120
- }
121
- }
122
-
123
- return $response;
124
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
js/wpsl-gmap.js CHANGED
@@ -8,6 +8,22 @@ var geocoder, map, directionsDisplay, directionsService, geolocationLatlng,
8
  resetMap = false,
9
  streetViewAvailable = false,
10
  autoLoad = ( typeof wpslSettings !== "undefined" ) ? wpslSettings.autoLoad : "";
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11
 
12
  /* Only continue if a map is present */
13
  if ( $( ".wpsl-gmap-canvas" ).length ) {
@@ -1206,7 +1222,7 @@ function checkMarkerClusters() {
1206
  * @param {object} latLng The coordinates
1207
  * @param {number} storeId The store id
1208
  * @param {object} infoWindowData The data we need to show in the info window
1209
- * @param {boolean} draggable Should me marker be draggable
1210
  * @param {object} infoWindow The infoWindow object
1211
  * @return {void}
1212
  */
@@ -1256,10 +1272,12 @@ function addMarker( latLng, storeId, infoWindowData, draggable, infoWindow ) {
1256
  }
1257
  } else {
1258
  setInfoWindowContent( marker, wpslLabels.startPoint, infoWindow, currentMap );
1259
- }
1260
 
1261
- google.maps.event.addListener( infoWindow, "domready", function() {
1262
- infoWindowClickActions( marker, latLng, currentMap );
 
 
1263
  checkMaxZoomLevel();
1264
  });
1265
  };
@@ -1363,16 +1381,15 @@ function setInfoWindowContent( marker, infoWindowContent, infoWindow, currentMap
1363
  *
1364
  * @since 1.2.20
1365
  * @param {object} marker Holds the marker data
1366
- * @param {object} activelatLng The latlng of the clicked marker
1367
  * @param {object} currentMap The map object
1368
  * @returns {void}
1369
  */
1370
- function infoWindowClickActions( marker, activelatLng, currentMap ) {
1371
  $( ".wpsl-info-actions a" ).on( "click", function( e ) {
1372
  var maxZoom = Number( wpslSettings.autoZoomLevel );
1373
 
1374
  e.stopImmediatePropagation();
1375
-
1376
  if ( $( this ).hasClass( "wpsl-directions" ) ) {
1377
 
1378
  /* Check if we need to show the direction on the map
@@ -1386,7 +1403,7 @@ function infoWindowClickActions( marker, activelatLng, currentMap ) {
1386
  } else if ( $( this ).hasClass( "wpsl-streetview" ) ) {
1387
  activateStreetView( marker, currentMap );
1388
  } else if ( $( this ).hasClass( "wpsl-zoom-here" ) ) {
1389
- currentMap.setCenter( activelatLng );
1390
  currentMap.setZoom( maxZoom );
1391
  }
1392
 
@@ -1425,7 +1442,7 @@ function activateStreetView( marker, currentMap ) {
1425
  var panorama = currentMap.getStreetView();
1426
  panorama.setPosition( marker.getPosition() );
1427
  panorama.setVisible( true );
1428
-
1429
  $( "#wpsl-map-controls" ).hide();
1430
 
1431
  StreetViewListener( panorama, currentMap );
8
  resetMap = false,
9
  streetViewAvailable = false,
10
  autoLoad = ( typeof wpslSettings !== "undefined" ) ? wpslSettings.autoLoad : "";
11
+
12
+ /**
13
+ * Set the underscore template settings
14
+ *
15
+ * Defining them here prevents other plugins
16
+ * that also use underscore / backbone, and defined a
17
+ * different _.templateSettings from breaking the
18
+ * rendering of the store locator template.
19
+ *
20
+ * @see http://underscorejs.org/#template
21
+ */
22
+ _.templateSettings = {
23
+ evaluate: /\<\%(.+?)\%\>/g,
24
+ interpolate: /\<\%=(.+?)\%\>/g,
25
+ escape: /\<\%-(.+?)\%\>/g
26
+ };
27
 
28
  /* Only continue if a map is present */
29
  if ( $( ".wpsl-gmap-canvas" ).length ) {
1222
  * @param {object} latLng The coordinates
1223
  * @param {number} storeId The store id
1224
  * @param {object} infoWindowData The data we need to show in the info window
1225
+ * @param {boolean} draggable Should the marker be draggable
1226
  * @param {object} infoWindow The infoWindow object
1227
  * @return {void}
1228
  */
1272
  }
1273
  } else {
1274
  setInfoWindowContent( marker, wpslLabels.startPoint, infoWindow, currentMap );
1275
+ }
1276
 
1277
+ google.maps.event.clearListeners( infoWindow, "domready" );
1278
+
1279
+ google.maps.event.addListener( infoWindow, "domready", function() {
1280
+ infoWindowClickActions( marker, currentMap );
1281
  checkMaxZoomLevel();
1282
  });
1283
  };
1381
  *
1382
  * @since 1.2.20
1383
  * @param {object} marker Holds the marker data
 
1384
  * @param {object} currentMap The map object
1385
  * @returns {void}
1386
  */
1387
+ function infoWindowClickActions( marker, currentMap ) {
1388
  $( ".wpsl-info-actions a" ).on( "click", function( e ) {
1389
  var maxZoom = Number( wpslSettings.autoZoomLevel );
1390
 
1391
  e.stopImmediatePropagation();
1392
+
1393
  if ( $( this ).hasClass( "wpsl-directions" ) ) {
1394
 
1395
  /* Check if we need to show the direction on the map
1403
  } else if ( $( this ).hasClass( "wpsl-streetview" ) ) {
1404
  activateStreetView( marker, currentMap );
1405
  } else if ( $( this ).hasClass( "wpsl-zoom-here" ) ) {
1406
+ currentMap.setCenter( marker.getPosition() );
1407
  currentMap.setZoom( maxZoom );
1408
  }
1409
 
1442
  var panorama = currentMap.getStreetView();
1443
  panorama.setPosition( marker.getPosition() );
1444
  panorama.setVisible( true );
1445
+
1446
  $( "#wpsl-map-controls" ).hide();
1447
 
1448
  StreetViewListener( panorama, currentMap );
js/wpsl-gmap.min.js CHANGED
@@ -1 +1 @@
1
- jQuery(document).ready(function(e){function t(t,n){var a,c,w,u,m,h,v,S=Number(wpslSettings.autoZoomLevel);c=o(n),w=l(),G=new google.maps.Geocoder,K=new google.maps.DirectionsRenderer,F=new google.maps.DirectionsService,a={zoom:Number(c.zoomLevel),center:c.startLatLng,mapTypeId:google.maps.MapTypeId[c.mapType.toUpperCase()],mapTypeControl:Number(c.mapTypeControl)?!0:!1,panControl:Number(c.panControls)?!0:!1,scrollwheel:Number(c.scrollWheel)?!0:!1,streetViewControl:Number(c.streetView)?!0:!1,zoomControlOptions:{style:google.maps.ZoomControlStyle[c.controlStyle.toUpperCase()],position:google.maps.ControlPosition[c.controlPosition.toUpperCase()+"_TOP"]}},j=new google.maps.Map(document.getElementById(t),a),i(c.mapStyle),"undefined"!=typeof window["wpslMap_"+n]&&"undefined"!=typeof window["wpslMap_"+n].locations&&(m=new google.maps.LatLngBounds,h=window["wpslMap_"+n].locations,v=h.length,e.each(h,function(e){u=new google.maps.LatLng(h[e].lat,h[e].lng),N(u,h[e].id,h[e],!1,w),m.extend(u)}),j.fitBounds(m),google.maps.event.addListenerOnce(j,"bounds_changed",function(e){return function(){e.getZoom()>S&&e.setZoom(S)}}(j))),e("#wpsl-gmap").length&&(!p()&&e(".wpsl-dropdown").length?A():(e("#wpsl-search-wrap select").show(),e("#wpsl-wrap").addClass("wpsl-mobile")),1==wpslSettings.autoLocate?d(c.startLatLng,w):1==wpslSettings.autoLoad&&r(c.startLatLng,w),1!=wpslSettings.mouseFocus||p()||e("#wpsl-search-input").focus(),g(w),f(c,j,w)),s()}function s(){"undefined"!=typeof wpslSettings.markerZoomTo&&1==wpslSettings.markerZoomTo&&google.maps.event.addListener(j,"zoom_changed",function(){R()})}function o(e){var t,s,o,l=["zoomLevel","mapType","mapTypeControl","mapStyle","streetView","panControls","scrollWheel","controlPosition","controlStyle"],i={zoomLevel:wpslSettings.zoomLevel,mapType:wpslSettings.mapType,mapTypeControl:wpslSettings.mapTypeControl,mapStyle:wpslSettings.mapStyle,streetView:wpslSettings.streetView,panControls:wpslSettings.panControls,scrollWheel:wpslSettings.scrollWheel,controlPosition:wpslSettings.controlPosition,controlStyle:wpslSettings.controlStyle};if("undefined"!=typeof window["wpslMap_"+e]&&"undefined"!=typeof window["wpslMap_"+e].shortCode)for(t=0,s=l.length;s>t;t++)o=window["wpslMap_"+e].shortCode[l[t]],"undefined"!=typeof o&&(i[l[t]]=o);return i.startLatLng=n(e),i}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 l(){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)},q=new InfoBox(s)):q=new google.maps.InfoWindow,q}function i(e){e=a(e),e&&j.setOptions({styles:e})}function a(e){try{var t=JSON.parse(e);if(t&&"object"==typeof t&&null!==t)return t}catch(s){}return!1}function r(e,t){var s={store:wpslLabels.startPoint};N(e,0,s,!0,t),I(e,nt,it,t)}function p(){return/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)}function d(t,s){if(navigator.geolocation){var o,n,l=!1,i=Number(wpslSettings.geoLocationTimout);o=setInterval(function(){e(".wpsl-icon-direction").toggleClass("wpsl-active-icon")},600),n=setTimeout(function(){c(o),r(t,s)},i),navigator.geolocation.getCurrentPosition(function(e){c(o),clearTimeout(n),U(l),w(t,e,nt,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),r(t,s)},{maximumAge:6e4,timeout:i,enableHighAccuracy:!0})}else alert(wpslGeolocationErrors.unavailable),r(t,s)}function c(t){clearInterval(t),e(".wpsl-icon-direction").removeClass("wpsl-active-icon")}function w(e,t,s,o){if("undefined"==typeof t)r(e,o);else{var n=new google.maps.LatLng(t.coords.latitude,t.coords.longitude);H=t,C(n),j.setCenter(n),N(n,0,"",!0),I(n,s,it,o)}}function g(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(),nt=!1,u(),U(s),h(),y(t)):e("#wpsl-search-input").addClass("wpsl-error").focus()})}function u(){"undefined"!=typeof wpslSettings.infoWindowStyle&&"infobox"==wpslSettings.infoWindowStyle&&"undefined"!=typeof et[0]&&et[0].close()}function f(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&&(m(t.startLatLng,o),e(".wpsl-icon-reset").hide()),e(".wpsl-icon-direction").on("click",function(){e(this).addClass("wpsl-user-activated"),d(t.startLatLng,o)})})}function m(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&&(it=1),(j.getCenter().lat()!==ot.centerLatlng.lat()||j.getCenter().lng()!==ot.centerLatlng.lng()||j.getZoom()!==ot.zoomLevel)&&(U(o),e("#wpsl-search-input").val("").removeClass(),e(".wpsl-icon-reset").addClass("wpsl-in-progress"),Y&&Y.clearMarkers(),h(),v(),1==wpslSettings.autoLocate?w(t,H,n,s):r(t,s)),e("#wpsl-stores").show(),e("#wpsl-direction-details").hide())})}function h(){"undefined"!=typeof J&&""!==J&&(J.setMap(null),J="")}function v(){var t,s,o,n,l=[wpslSettings.searchRadius+" "+wpslSettings.distanceUnit,wpslSettings.maxResults],i=["wpsl-radius","wpsl-results"];for(t=0,s=i.length;s>t;t++)e("#"+i[t]+" select").val(parseInt(l[t])),e("#"+i[t]+" li").removeClass(),"wpsl-radius"==i[t]?o=wpslSettings.searchRadius:"wpsl-results"==i[t]&&(o=wpslSettings.maxResults),e("#"+i[t]+" li").each(function(){e(this).text()===l[t]&&(e(this).addClass("wpsl-selected-dropdown"),e("#"+i[t]+" .wpsl-selected-item").html(l[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 S(t){var s,o,n,l,i;for(u(),i=t.parents("li").length>0?t.parents("li").data("store-id"):t.parents(".wpsl-info-window").data("store-id"),"undefined"!=typeof J&&""!==J&&(o=J.getPosition()),st={centerLatlng:j.getCenter(),zoomLevel:j.getZoom()},s=0,l=tt.length;l>s;s++)0!=tt[s].storeId||"undefined"!=typeof o&&""!==o?tt[s].storeId==i&&(n=tt[s].getPosition()):o=tt[s].getPosition();o&&n?(e("#wpsl-direction-details ul").empty(),e(".wpsl-direction-before, .wpsl-direction-after").remove(),b(o,n)):alert(wpslLabels.generalError)}function L(e,t){var s,o,n;for(s=0,o=tt.length;o>s;s++)tt[s].storeId==e&&(n=tt[s],n.setAnimation("start"==t?google.maps.Animation.BOUNCE:null))}function b(t,s){var o,n,l,i,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]},F.route(g,function(t,s){if(s==google.maps.DirectionsStatus.OK){if(K.setMap(j),K.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++)l=o.steps[p],i=p+1,w=w+"<li><div class='wpsl-direction-index'>"+i+"</div><div class='wpsl-direction-txt'>"+l.instructions+"</div><div class='wpsl-direction-distance'>"+l.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=tt.length;n>r;r++)tt[r].setMap(null);Y&&Y.clearMarkers(),"undefined"!=typeof J&&""!==J&&J.setMap(null),e("#wpsl-stores").hide(),1==wpslSettings.templateId&&(c=e("#wpsl-gmap").offset(),e(window).scrollTop(c.top))}}else W(s)})}function y(t){var s,o=!1,n=!1,l=e("#wpsl-search-input").val();G.geocode({address:l},function(e,l){l==google.maps.GeocoderStatus.OK?(s=e[0].geometry.location,U(n),N(s,0,"",!0,t),I(s,nt,o,t)):$(l)})}function C(t){var s;G.geocode({latLng:t},function(t,o){o==google.maps.GeocoderStatus.OK?(s=k(t),""!==s&&e("#wpsl-search-input").val(s)):$(o)})}function k(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 I(e,t,s,o){1==wpslSettings.directionRedirect?x(e,function(){E(e,t,s,o)}):E(e,t,s,o)}function x(e,t){G.geocode({latLng:e},function(e,s){s==google.maps.GeocoderStatus.OK?(X=e[0].formatted_address,t()):$(s)})}function E(t,s,o,n){var l,i,a,r="",d="",c=!1,w=e("#wpsl-wrap").hasClass("wpsl-mobile"),g=e("#wpsl-listing-template").html(),u=e("#wpsl-stores ul"),f=wpslSettings.path+"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?(i=parseInt(e("#wpsl-results .wpsl-dropdown").val()),a=parseInt(e("#wpsl-radius .wpsl-dropdown").val())):(i=parseInt(e("#wpsl-results .wpsl-selected-item").attr("data-value")),a=parseInt(e("#wpsl-radius .wpsl-selected-item").attr("data-value"))),m.max_results=isNaN(i)?wpslSettings.maxResults:i,m.radius=isNaN(a)?wpslSettings.searchRadius:a,e("#wpsl-category").length>0&&(d=parseInt(w?e("#wpsl-category .wpsl-dropdown").val():e("#wpsl-category .wpsl-selected-item").attr("data-value")),isNaN(d)||0===d||(m.filter=d))),1==o&&(m.autoload=1,"undefined"!=typeof H&&(m.skip_cache=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.success!==!1?t.length>0?(e.each(t,function(e){_.extend(t[e],wt),l=new google.maps.LatLng(t[e].lat,t[e].lng),N(l,t[e].id,t[e],c,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?(S(e(this)),!1):void 0}),M(),B(),e("#wpsl-result-list p:empty").remove()):u.html("<li class='no-results'>"+wpslLabels.noResults+"</li>"):alert(wpslLabels.generalError),1==wpslSettings.resetMap&&(e.isEmptyObject(ot)&&google.maps.event.addListenerOnce(j,"tilesloaded",function(){ot={centerLatlng:j.getCenter(),zoomLevel:j.getZoom()},e(".wpsl-icon-direction").addClass("wpsl-reset-exists"),e(".wpsl-icon-reset, #wpsl-reset-map").show()}),e(".wpsl-icon-reset").removeClass("wpsl-in-progress"))}),1!=wpslSettings.mouseFocus||p()||e("#wpsl-search-input").focus()}function M(){if(1==wpslSettings.markerClusters){var e=Number(wpslSettings.clusterZoom),t=Number(wpslSettings.clusterSize);isNaN(e)&&(e=""),isNaN(t)&&(t=""),Y=new MarkerClusterer(j,tt,{gridSize:t,maxZoom:e})}}function N(e,t,s,o,n){var l,i,a,r=!0;l=0===t?wpslSettings.path+"img/markers/"+wpslSettings.startMarker:wpslSettings.path+"img/markers/"+wpslSettings.storeMarker,i={url:l,scaledSize:new google.maps.Size(24,35),origin:new google.maps.Point(0,0),anchor:new google.maps.Point(12,35)},a=new google.maps.Marker({position:e,map:j,optimized:!1,title:s.store,draggable:o,storeId:t,icon:i}),tt.push(a),google.maps.event.addListener(a,"click",function(o){return function(){0!=t?"undefined"!=typeof wpslSettings.markerStreetView&&1==wpslSettings.markerStreetView?Z(e,function(){P(a,V(s),n,o)}):P(a,V(s),n,o):P(a,wpslLabels.startPoint,n,o),google.maps.event.addListener(n,"domready",function(){O(a,e,o),R()})}}(j)),o&&google.maps.event.addListener(a,"dragend",function(e){U(r),j.setCenter(e.latLng),C(e.latLng),I(e.latLng,nt,it=!1,n)})}function P(e,t,s,o){et.length=0,s.setContent(t),s.open(o,e),et.push(s),"undefined"!=typeof wpslSettings.infoWindowStyle&&"infobox"==wpslSettings.infoWindowStyle&&1==wpslSettings.markerClusters&&(Q=e.storeId,s.setVisible(!0))}function O(t,s,o){e(".wpsl-info-actions a").on("click",function(n){var l=Number(wpslSettings.autoZoomLevel);if(n.stopImmediatePropagation(),e(this).hasClass("wpsl-directions")){if(1==wpslSettings.directionRedirect)return!0;S(e(this))}else e(this).hasClass("wpsl-streetview")?T(t,o):e(this).hasClass("wpsl-zoom-here")&&(o.setCenter(s),o.setZoom(l));return!1})}function R(){var t=j.getZoom();t>=wpslSettings.autoZoomLevel?e(".wpsl-zoom-here").hide():e(".wpsl-zoom-here").show()}function T(t,s){var o=s.getStreetView();o.setPosition(t.getPosition()),o.setVisible(!0),e("#wpsl-map-controls").hide(),z(o,s)}function z(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 Z(e,t){var s=new google.maps.StreetViewService;s.getPanoramaByLocation(e,50,function(e,s){lt=s==google.maps.StreetViewStatus.OK?!0:!1,t()})}function V(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 B(){var e,t,s=Number(wpslSettings.autoZoomLevel),o=new google.maps.LatLngBounds;for(google.maps.event.addListenerOnce(j,"bounds_changed",function(){this.getZoom()>s&&this.setZoom(s)}),e=0,t=tt.length;t>e;e++)o.extend(tt[e].position);j.fitBounds(o)}function U(e){var t,s;if(K.setMap(null),tt){for(s=0,t=tt.length;t>s;s++)e?1!=tt[s].draggable?tt[s].setMap(null):J=tt[s]:tt[s].setMap(null);tt.length=0}Y&&Y.clearMarkers()}function $(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 W(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 A(){e(".wpsl-dropdown").each(function(){var t,s,o=e(this);o.$dropdownWrap=o.wrap("<div class='wpsl-dropdown'></div>").parent(),o.$selectedVal=o.val(),o.$dropdownElem=e("<div><ul/></div>").appendTo(o.$dropdownWrap),o.$dropdown=o.$dropdownElem.find("ul"),o.$options=o.$dropdownWrap.find("option"),o.hide().removeClass("wpsl-dropdown"),e.each(o.$options,function(){t=e(this).val()==o.$selectedVal?'class="wpsl-selected-dropdown"':"",o.$dropdown.append("<li data-value="+e(this).val()+" "+t+">"+e(this).text()+"</li>")}),o.$dropdownElem.before("<span data-value="+o.find(":selected").val()+" class='wpsl-selected-item'>"+o.find(":selected").text()+"</span>"),o.$dropdownItem=o.$dropdownElem.find("li"),o.$dropdownWrap.on("click",function(t){D(),e(this).toggleClass("wpsl-active"),s=0,e(this).hasClass("wpsl-active")?(o.$dropdownItem.each(function(){s+=e(this).outerHeight()}),o.$dropdownElem.css("height",s+2+"px")):o.$dropdownElem.css("height",0),t.stopPropagation()}),o.$dropdownItem.on("click",function(t){o.$dropdownWrap.find(e(".wpsl-selected-item")).html(e(this).text()).attr("data-value",e(this).attr("data-value")),o.$dropdownItem.removeClass("wpsl-selected-dropdown"),e(this).addClass("wpsl-selected-dropdown"),D(),t.stopPropagation()})}),e(document).click(function(){D()})}function D(){e(".wpsl-dropdown").removeClass("wpsl-active"),e(".wpsl-dropdown div").css("height",0)}var G,j,K,F,H,Q,q,Y,J,X,et=[],tt=[],st={},ot={},nt=!1,lt=!1,it="undefined"!=typeof wpslSettings?wpslSettings.autoLoad:"";if(e(".wpsl-gmap-canvas").length&&(e("<img />").attr("src",wpslSettings.path+"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(K.setMap(null),t=0,s=tt.length;s>t;t++)tt[t].setMap(j);return"undefined"!=typeof J&&""!==J&&J.setMap(j),Y&&M(),j.setCenter(st.centerLatlng),j.setZoom(st.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=tt.length;s>t;t++)tt[t].storeId==e(this).data("store-id")&&(google.maps.event.trigger(tt[t],"click"),j.setCenter(tt[t].position))})),"undefined"!=typeof wpslSettings.infoWindowStyle&&"infobox"==wpslSettings.infoWindowStyle&&1==wpslSettings.markerClusters){var at,rt,pt,dt,ct;google.maps.event.addListener(j,"zoom_changed",function(){google.maps.event.addListenerOnce(j,"idle",function(){if("undefined"!=typeof Y&&(at=Y.clusters_,at.length))for(dt=0,rt=at.length;rt>dt;dt++)for(ct=0,pt=at[dt].markers_.length;pt>ct;ct++)if(at[dt].markers_[ct].storeId==Q){q.getVisible()&&null===at[dt].markers_[ct].map?q.setVisible(!1):q.getVisible()||null===at[dt].markers_[ct].map||q.setVisible(!0);break}})})}var wt={formatPhoneNumber:function(e){return 1==wpslSettings.phoneUrl&&p()&&(e="<a href='tel:"+wt.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&&(lt&&(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'>"+wt.createDirectionUrl(t)+o+n+"</div>"),s},createDirectionUrl:function(t){var s,o,n,l={};return 1==wpslSettings.directionRedirect?("undefined"==typeof X&&(X=""),l.target="target='_blank'","undefined"!=typeof t?l.src=e("[data-store-id="+t+"] .wpsl-directions").attr("href"):(n=this.zip?this.zip+", ":"",o=this.address+", "+this.city+", "+n+this.country,l.src="https://maps.google.com/maps?saddr="+wt.rfc3986EncodeURIComponent(X)+"&daddr="+wt.rfc3986EncodeURIComponent(o))):l={src:"#",target:""},s="<a class='wpsl-directions' "+l.target+" href='"+l.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=tt.length;s>t;t++)tt[t].storeId==n&&google.maps.event.trigger(tt[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='#wpsl-map-tab']").length){var gt,ut,ft=e("a[href='#wpsl-map-tab']");ft.on("click",function(){return setTimeout(function(){gt=j.getZoom(),ut=j.getCenter(),google.maps.event.trigger(j,"resize"),j.setZoom(gt),j.setCenter(ut),B()},50),!1})}});
1
+ jQuery(document).ready(function(e){function t(t,n){var a,c,w,u,m,h,v,S=Number(wpslSettings.autoZoomLevel);c=o(n),w=l(),G=new google.maps.Geocoder,K=new google.maps.DirectionsRenderer,F=new google.maps.DirectionsService,a={zoom:Number(c.zoomLevel),center:c.startLatLng,mapTypeId:google.maps.MapTypeId[c.mapType.toUpperCase()],mapTypeControl:Number(c.mapTypeControl)?!0:!1,panControl:Number(c.panControls)?!0:!1,scrollwheel:Number(c.scrollWheel)?!0:!1,streetViewControl:Number(c.streetView)?!0:!1,zoomControlOptions:{style:google.maps.ZoomControlStyle[c.controlStyle.toUpperCase()],position:google.maps.ControlPosition[c.controlPosition.toUpperCase()+"_TOP"]}},j=new google.maps.Map(document.getElementById(t),a),i(c.mapStyle),"undefined"!=typeof window["wpslMap_"+n]&&"undefined"!=typeof window["wpslMap_"+n].locations&&(m=new google.maps.LatLngBounds,h=window["wpslMap_"+n].locations,v=h.length,e.each(h,function(e){u=new google.maps.LatLng(h[e].lat,h[e].lng),N(u,h[e].id,h[e],!1,w),m.extend(u)}),j.fitBounds(m),google.maps.event.addListenerOnce(j,"bounds_changed",function(e){return function(){e.getZoom()>S&&e.setZoom(S)}}(j))),e("#wpsl-gmap").length&&(!p()&&e(".wpsl-dropdown").length?A():(e("#wpsl-search-wrap select").show(),e("#wpsl-wrap").addClass("wpsl-mobile")),1==wpslSettings.autoLocate?d(c.startLatLng,w):1==wpslSettings.autoLoad&&r(c.startLatLng,w),1!=wpslSettings.mouseFocus||p()||e("#wpsl-search-input").focus(),g(w),f(c,j,w)),s()}function s(){"undefined"!=typeof wpslSettings.markerZoomTo&&1==wpslSettings.markerZoomTo&&google.maps.event.addListener(j,"zoom_changed",function(){R()})}function o(e){var t,s,o,l=["zoomLevel","mapType","mapTypeControl","mapStyle","streetView","panControls","scrollWheel","controlPosition","controlStyle"],i={zoomLevel:wpslSettings.zoomLevel,mapType:wpslSettings.mapType,mapTypeControl:wpslSettings.mapTypeControl,mapStyle:wpslSettings.mapStyle,streetView:wpslSettings.streetView,panControls:wpslSettings.panControls,scrollWheel:wpslSettings.scrollWheel,controlPosition:wpslSettings.controlPosition,controlStyle:wpslSettings.controlStyle};if("undefined"!=typeof window["wpslMap_"+e]&&"undefined"!=typeof window["wpslMap_"+e].shortCode)for(t=0,s=l.length;s>t;t++)o=window["wpslMap_"+e].shortCode[l[t]],"undefined"!=typeof o&&(i[l[t]]=o);return i.startLatLng=n(e),i}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 l(){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)},q=new InfoBox(s)):q=new google.maps.InfoWindow,q}function i(e){e=a(e),e&&j.setOptions({styles:e})}function a(e){try{var t=JSON.parse(e);if(t&&"object"==typeof t&&null!==t)return t}catch(s){}return!1}function r(e,t){var s={store:wpslLabels.startPoint};N(e,0,s,!0,t),I(e,nt,it,t)}function p(){return/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)}function d(t,s){if(navigator.geolocation){var o,n,l=!1,i=Number(wpslSettings.geoLocationTimout);o=setInterval(function(){e(".wpsl-icon-direction").toggleClass("wpsl-active-icon")},600),n=setTimeout(function(){c(o),r(t,s)},i),navigator.geolocation.getCurrentPosition(function(e){c(o),clearTimeout(n),U(l),w(t,e,nt,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),r(t,s)},{maximumAge:6e4,timeout:i,enableHighAccuracy:!0})}else alert(wpslGeolocationErrors.unavailable),r(t,s)}function c(t){clearInterval(t),e(".wpsl-icon-direction").removeClass("wpsl-active-icon")}function w(e,t,s,o){if("undefined"==typeof t)r(e,o);else{var n=new google.maps.LatLng(t.coords.latitude,t.coords.longitude);H=t,C(n),j.setCenter(n),N(n,0,"",!0),I(n,s,it,o)}}function g(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(),nt=!1,u(),U(s),h(),y(t)):e("#wpsl-search-input").addClass("wpsl-error").focus()})}function u(){"undefined"!=typeof wpslSettings.infoWindowStyle&&"infobox"==wpslSettings.infoWindowStyle&&"undefined"!=typeof et[0]&&et[0].close()}function f(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&&(m(t.startLatLng,o),e(".wpsl-icon-reset").hide()),e(".wpsl-icon-direction").on("click",function(){e(this).addClass("wpsl-user-activated"),d(t.startLatLng,o)})})}function m(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&&(it=1),(j.getCenter().lat()!==ot.centerLatlng.lat()||j.getCenter().lng()!==ot.centerLatlng.lng()||j.getZoom()!==ot.zoomLevel)&&(U(o),e("#wpsl-search-input").val("").removeClass(),e(".wpsl-icon-reset").addClass("wpsl-in-progress"),Y&&Y.clearMarkers(),h(),v(),1==wpslSettings.autoLocate?w(t,H,n,s):r(t,s)),e("#wpsl-stores").show(),e("#wpsl-direction-details").hide())})}function h(){"undefined"!=typeof J&&""!==J&&(J.setMap(null),J="")}function v(){var t,s,o,n,l=[wpslSettings.searchRadius+" "+wpslSettings.distanceUnit,wpslSettings.maxResults],i=["wpsl-radius","wpsl-results"];for(t=0,s=i.length;s>t;t++)e("#"+i[t]+" select").val(parseInt(l[t])),e("#"+i[t]+" li").removeClass(),"wpsl-radius"==i[t]?o=wpslSettings.searchRadius:"wpsl-results"==i[t]&&(o=wpslSettings.maxResults),e("#"+i[t]+" li").each(function(){e(this).text()===l[t]&&(e(this).addClass("wpsl-selected-dropdown"),e("#"+i[t]+" .wpsl-selected-item").html(l[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 S(t){var s,o,n,l,i;for(u(),i=t.parents("li").length>0?t.parents("li").data("store-id"):t.parents(".wpsl-info-window").data("store-id"),"undefined"!=typeof J&&""!==J&&(o=J.getPosition()),st={centerLatlng:j.getCenter(),zoomLevel:j.getZoom()},s=0,l=tt.length;l>s;s++)0!=tt[s].storeId||"undefined"!=typeof o&&""!==o?tt[s].storeId==i&&(n=tt[s].getPosition()):o=tt[s].getPosition();o&&n?(e("#wpsl-direction-details ul").empty(),e(".wpsl-direction-before, .wpsl-direction-after").remove(),b(o,n)):alert(wpslLabels.generalError)}function L(e,t){var s,o,n;for(s=0,o=tt.length;o>s;s++)tt[s].storeId==e&&(n=tt[s],n.setAnimation("start"==t?google.maps.Animation.BOUNCE:null))}function b(t,s){var o,n,l,i,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]},F.route(g,function(t,s){if(s==google.maps.DirectionsStatus.OK){if(K.setMap(j),K.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++)l=o.steps[p],i=p+1,w=w+"<li><div class='wpsl-direction-index'>"+i+"</div><div class='wpsl-direction-txt'>"+l.instructions+"</div><div class='wpsl-direction-distance'>"+l.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=tt.length;n>r;r++)tt[r].setMap(null);Y&&Y.clearMarkers(),"undefined"!=typeof J&&""!==J&&J.setMap(null),e("#wpsl-stores").hide(),1==wpslSettings.templateId&&(c=e("#wpsl-gmap").offset(),e(window).scrollTop(c.top))}}else W(s)})}function y(t){var s,o=!1,n=!1,l=e("#wpsl-search-input").val();G.geocode({address:l},function(e,l){l==google.maps.GeocoderStatus.OK?(s=e[0].geometry.location,U(n),N(s,0,"",!0,t),I(s,nt,o,t)):$(l)})}function C(t){var s;G.geocode({latLng:t},function(t,o){o==google.maps.GeocoderStatus.OK?(s=k(t),""!==s&&e("#wpsl-search-input").val(s)):$(o)})}function k(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 I(e,t,s,o){1==wpslSettings.directionRedirect?x(e,function(){E(e,t,s,o)}):E(e,t,s,o)}function x(e,t){G.geocode({latLng:e},function(e,s){s==google.maps.GeocoderStatus.OK?(X=e[0].formatted_address,t()):$(s)})}function E(t,s,o,n){var l,i,a,r="",d="",c=!1,w=e("#wpsl-wrap").hasClass("wpsl-mobile"),g=e("#wpsl-listing-template").html(),u=e("#wpsl-stores ul"),f=wpslSettings.path+"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?(i=parseInt(e("#wpsl-results .wpsl-dropdown").val()),a=parseInt(e("#wpsl-radius .wpsl-dropdown").val())):(i=parseInt(e("#wpsl-results .wpsl-selected-item").attr("data-value")),a=parseInt(e("#wpsl-radius .wpsl-selected-item").attr("data-value"))),m.max_results=isNaN(i)?wpslSettings.maxResults:i,m.radius=isNaN(a)?wpslSettings.searchRadius:a,e("#wpsl-category").length>0&&(d=parseInt(w?e("#wpsl-category .wpsl-dropdown").val():e("#wpsl-category .wpsl-selected-item").attr("data-value")),isNaN(d)||0===d||(m.filter=d))),1==o&&(m.autoload=1,"undefined"!=typeof H&&(m.skip_cache=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.success!==!1?t.length>0?(e.each(t,function(e){_.extend(t[e],wt),l=new google.maps.LatLng(t[e].lat,t[e].lng),N(l,t[e].id,t[e],c,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?(S(e(this)),!1):void 0}),M(),B(),e("#wpsl-result-list p:empty").remove()):u.html("<li class='no-results'>"+wpslLabels.noResults+"</li>"):alert(wpslLabels.generalError),1==wpslSettings.resetMap&&(e.isEmptyObject(ot)&&google.maps.event.addListenerOnce(j,"tilesloaded",function(){ot={centerLatlng:j.getCenter(),zoomLevel:j.getZoom()},e(".wpsl-icon-direction").addClass("wpsl-reset-exists"),e(".wpsl-icon-reset, #wpsl-reset-map").show()}),e(".wpsl-icon-reset").removeClass("wpsl-in-progress"))}),1!=wpslSettings.mouseFocus||p()||e("#wpsl-search-input").focus()}function M(){if(1==wpslSettings.markerClusters){var e=Number(wpslSettings.clusterZoom),t=Number(wpslSettings.clusterSize);isNaN(e)&&(e=""),isNaN(t)&&(t=""),Y=new MarkerClusterer(j,tt,{gridSize:t,maxZoom:e})}}function N(e,t,s,o,n){var l,i,a,r=!0;l=0===t?wpslSettings.path+"img/markers/"+wpslSettings.startMarker:wpslSettings.path+"img/markers/"+wpslSettings.storeMarker,i={url:l,scaledSize:new google.maps.Size(24,35),origin:new google.maps.Point(0,0),anchor:new google.maps.Point(12,35)},a=new google.maps.Marker({position:e,map:j,optimized:!1,title:s.store,draggable:o,storeId:t,icon:i}),tt.push(a),google.maps.event.addListener(a,"click",function(o){return function(){0!=t?"undefined"!=typeof wpslSettings.markerStreetView&&1==wpslSettings.markerStreetView?Z(e,function(){P(a,V(s),n,o)}):P(a,V(s),n,o):P(a,wpslLabels.startPoint,n,o),google.maps.event.clearListeners(n,"domready"),google.maps.event.addListener(n,"domready",function(){O(a,o),R()})}}(j)),o&&google.maps.event.addListener(a,"dragend",function(e){U(r),j.setCenter(e.latLng),C(e.latLng),I(e.latLng,nt,it=!1,n)})}function P(e,t,s,o){et.length=0,s.setContent(t),s.open(o,e),et.push(s),"undefined"!=typeof wpslSettings.infoWindowStyle&&"infobox"==wpslSettings.infoWindowStyle&&1==wpslSettings.markerClusters&&(Q=e.storeId,s.setVisible(!0))}function O(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;S(e(this))}else e(this).hasClass("wpsl-streetview")?T(t,s):e(this).hasClass("wpsl-zoom-here")&&(s.setCenter(t.getPosition()),s.setZoom(n));return!1})}function R(){var t=j.getZoom();t>=wpslSettings.autoZoomLevel?e(".wpsl-zoom-here").hide():e(".wpsl-zoom-here").show()}function T(t,s){var o=s.getStreetView();o.setPosition(t.getPosition()),o.setVisible(!0),e("#wpsl-map-controls").hide(),z(o,s)}function z(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 Z(e,t){var s=new google.maps.StreetViewService;s.getPanoramaByLocation(e,50,function(e,s){lt=s==google.maps.StreetViewStatus.OK?!0:!1,t()})}function V(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 B(){var e,t,s=Number(wpslSettings.autoZoomLevel),o=new google.maps.LatLngBounds;for(google.maps.event.addListenerOnce(j,"bounds_changed",function(){this.getZoom()>s&&this.setZoom(s)}),e=0,t=tt.length;t>e;e++)o.extend(tt[e].position);j.fitBounds(o)}function U(e){var t,s;if(K.setMap(null),tt){for(s=0,t=tt.length;t>s;s++)e?1!=tt[s].draggable?tt[s].setMap(null):J=tt[s]:tt[s].setMap(null);tt.length=0}Y&&Y.clearMarkers()}function $(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 W(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 A(){e(".wpsl-dropdown").each(function(){var t,s,o=e(this);o.$dropdownWrap=o.wrap("<div class='wpsl-dropdown'></div>").parent(),o.$selectedVal=o.val(),o.$dropdownElem=e("<div><ul/></div>").appendTo(o.$dropdownWrap),o.$dropdown=o.$dropdownElem.find("ul"),o.$options=o.$dropdownWrap.find("option"),o.hide().removeClass("wpsl-dropdown"),e.each(o.$options,function(){t=e(this).val()==o.$selectedVal?'class="wpsl-selected-dropdown"':"",o.$dropdown.append("<li data-value="+e(this).val()+" "+t+">"+e(this).text()+"</li>")}),o.$dropdownElem.before("<span data-value="+o.find(":selected").val()+" class='wpsl-selected-item'>"+o.find(":selected").text()+"</span>"),o.$dropdownItem=o.$dropdownElem.find("li"),o.$dropdownWrap.on("click",function(t){D(),e(this).toggleClass("wpsl-active"),s=0,e(this).hasClass("wpsl-active")?(o.$dropdownItem.each(function(){s+=e(this).outerHeight()}),o.$dropdownElem.css("height",s+2+"px")):o.$dropdownElem.css("height",0),t.stopPropagation()}),o.$dropdownItem.on("click",function(t){o.$dropdownWrap.find(e(".wpsl-selected-item")).html(e(this).text()).attr("data-value",e(this).attr("data-value")),o.$dropdownItem.removeClass("wpsl-selected-dropdown"),e(this).addClass("wpsl-selected-dropdown"),D(),t.stopPropagation()})}),e(document).click(function(){D()})}function D(){e(".wpsl-dropdown").removeClass("wpsl-active"),e(".wpsl-dropdown div").css("height",0)}var G,j,K,F,H,Q,q,Y,J,X,et=[],tt=[],st={},ot={},nt=!1,lt=!1,it="undefined"!=typeof wpslSettings?wpslSettings.autoLoad:"";if(_.templateSettings={evaluate:/\<\%(.+?)\%\>/g,interpolate:/\<\%=(.+?)\%\>/g,escape:/\<\%-(.+?)\%\>/g},e(".wpsl-gmap-canvas").length&&(e("<img />").attr("src",wpslSettings.path+"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(K.setMap(null),t=0,s=tt.length;s>t;t++)tt[t].setMap(j);return"undefined"!=typeof J&&""!==J&&J.setMap(j),Y&&M(),j.setCenter(st.centerLatlng),j.setZoom(st.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=tt.length;s>t;t++)tt[t].storeId==e(this).data("store-id")&&(google.maps.event.trigger(tt[t],"click"),j.setCenter(tt[t].position))})),"undefined"!=typeof wpslSettings.infoWindowStyle&&"infobox"==wpslSettings.infoWindowStyle&&1==wpslSettings.markerClusters){var at,rt,pt,dt,ct;google.maps.event.addListener(j,"zoom_changed",function(){google.maps.event.addListenerOnce(j,"idle",function(){if("undefined"!=typeof Y&&(at=Y.clusters_,at.length))for(dt=0,rt=at.length;rt>dt;dt++)for(ct=0,pt=at[dt].markers_.length;pt>ct;ct++)if(at[dt].markers_[ct].storeId==Q){q.getVisible()&&null===at[dt].markers_[ct].map?q.setVisible(!1):q.getVisible()||null===at[dt].markers_[ct].map||q.setVisible(!0);break}})})}var wt={formatPhoneNumber:function(e){return 1==wpslSettings.phoneUrl&&p()&&(e="<a href='tel:"+wt.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&&(lt&&(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'>"+wt.createDirectionUrl(t)+o+n+"</div>"),s},createDirectionUrl:function(t){var s,o,n,l={};return 1==wpslSettings.directionRedirect?("undefined"==typeof X&&(X=""),l.target="target='_blank'","undefined"!=typeof t?l.src=e("[data-store-id="+t+"] .wpsl-directions").attr("href"):(n=this.zip?this.zip+", ":"",o=this.address+", "+this.city+", "+n+this.country,l.src="https://maps.google.com/maps?saddr="+wt.rfc3986EncodeURIComponent(X)+"&daddr="+wt.rfc3986EncodeURIComponent(o))):l={src:"#",target:""},s="<a class='wpsl-directions' "+l.target+" href='"+l.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=tt.length;s>t;t++)tt[t].storeId==n&&google.maps.event.trigger(tt[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='#wpsl-map-tab']").length){var gt,ut,ft=e("a[href='#wpsl-map-tab']");ft.on("click",function(){return setTimeout(function(){gt=j.getZoom(),ut=j.getCenter(),google.maps.event.trigger(j,"resize"),j.setZoom(gt),j.setCenter(ut),B()},50),!1})}});
readme.txt CHANGED
@@ -1,10 +1,10 @@
1
- === WP Store Locator ===
2
  Plugin URI: http://wpstorelocator.co
3
  Contributors: tijmensmit
4
  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
5
  Requires at least: 3.7
6
  Tested up to: 4.3
7
- Stable tag: 2.0
8
  License: GPLv3
9
  License URI: http://www.gnu.org/licenses/gpl.html
10
 
@@ -106,6 +106,10 @@ If you find a plugin or theme that causes a conflict, please report it on the [s
106
 
107
  == Changelog ==
108
 
 
 
 
 
109
  = 2.0 =
110
  * New: Moved away from a custom db table, the store locations are now registered as custom post types.
111
  * Note: The upgrade procedure will ask you to convert the current store locations to custom post types. This takes around 1 minute for every 1000 store locations.
1
+ === WP Store Locator ===
2
  Plugin URI: http://wpstorelocator.co
3
  Contributors: tijmensmit
4
  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
5
  Requires at least: 3.7
6
  Tested up to: 4.3
7
+ Stable tag: 2.0.1
8
  License: GPLv3
9
  License URI: http://www.gnu.org/licenses/gpl.html
10
 
106
 
107
  == Changelog ==
108
 
109
+ = 2.0.1 =
110
+ * Fixed: Prevented other plugins that use [underscore](http://underscorejs.org/) or [backbone](http://backbonejs.org/) from breaking the JavaScript templates, via [fatman49](https://profiles.wordpress.org/fatman49/) and [zurf](https://profiles.wordpress.org/zurf/).
111
+ * Fixed: Street view not showing the correct location after using it more then once, via [marijke_25](https://profiles.wordpress.org/marijke_25/).
112
+
113
  = 2.0 =
114
  * New: Moved away from a custom db table, the store locations are now registered as custom post types.
115
  * Note: The upgrade procedure will ask you to convert the current store locations to custom post types. This takes around 1 minute for every 1000 store locations.
screenshot-1.jpg DELETED
Binary file
screenshot-2.jpg DELETED
Binary file
screenshot-3.jpg DELETED
Binary file
screenshot-4.jpg DELETED
Binary file
screenshot-5.jpg DELETED
Binary file
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: http://wpstorelocator.co/
7
- Version: 2.0
8
  Text Domain: wpsl
9
  Domain Path: /languages/
10
  License: GPL v3
@@ -59,7 +59,7 @@ if ( !class_exists( 'WP_Store_locator' ) ) {
59
  public function define_constants() {
60
 
61
  if ( !defined( 'WPSL_VERSION_NUM' ) )
62
- define( 'WPSL_VERSION_NUM', '2.0' );
63
 
64
  if ( !defined( 'WPSL_URL' ) )
65
  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: http://wpstorelocator.co/
7
+ Version: 2.0.1
8
  Text Domain: wpsl
9
  Domain Path: /languages/
10
  License: GPL v3
59
  public function define_constants() {
60
 
61
  if ( !defined( 'WPSL_VERSION_NUM' ) )
62
+ define( 'WPSL_VERSION_NUM', '2.0.1' );
63
 
64
  if ( !defined( 'WPSL_URL' ) )
65
  define( 'WPSL_URL', plugin_dir_url( __FILE__ ) );