WP Store Locator - Version 2.2.6

Version Description

Download this release

Release Info

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

Code changes from version 2.2.5 to 2.2.6

admin/EDD_SL_Plugin_Updater.php CHANGED
@@ -1,339 +1,438 @@
1
- <?php
2
-
3
- // uncomment this line for testing
4
- //set_site_transient( 'update_plugins', null );
5
-
6
- // Exit if accessed directly
7
- if ( ! defined( 'ABSPATH' ) ) exit;
8
-
9
- /**
10
- * Allows plugins to use their own update API.
11
- *
12
- * @author Pippin Williamson
13
- * @version 1.6.2
14
- */
15
- class EDD_SL_Plugin_Updater {
16
- private $api_url = '';
17
- private $api_data = array();
18
- private $name = '';
19
- private $slug = '';
20
- private $version = '';
21
-
22
- /**
23
- * Class constructor.
24
- *
25
- * @uses plugin_basename()
26
- * @uses hook()
27
- *
28
- * @param string $_api_url The URL pointing to the custom API endpoint.
29
- * @param string $_plugin_file Path to the plugin file.
30
- * @param array $_api_data Optional data to send with API calls.
31
- */
32
- function __construct( $_api_url, $_plugin_file, $_api_data = null ) {
33
- $this->api_url = trailingslashit( $_api_url );
34
- $this->api_data = $_api_data;
35
- $this->name = plugin_basename( $_plugin_file );
36
- $this->slug = basename( $_plugin_file, '.php' );
37
- $this->version = $_api_data['version'];
38
-
39
- // Set up hooks.
40
- $this->init();
41
- add_action( 'admin_init', array( $this, 'show_changelog' ) );
42
-
43
- }
44
-
45
- /**
46
- * Set up WordPress filters to hook into WP's update process.
47
- *
48
- * @uses add_filter()
49
- *
50
- * @return void
51
- */
52
- public function init() {
53
- add_filter( 'pre_set_site_transient_update_plugins', array( $this, 'check_update' ) );
54
- add_filter( 'plugins_api', array( $this, 'plugins_api_filter' ), 10, 3 );
55
-
56
- remove_action( 'after_plugin_row_' . $this->name, 'wp_plugin_update_row', 10, 2 );
57
- add_action( 'after_plugin_row_' . $this->name, array( $this, 'show_update_notification' ), 10, 2 );
58
- }
59
-
60
- /**
61
- * Check for Updates at the defined API endpoint and modify the update array.
62
- *
63
- * This function dives into the update API just when WordPress creates its update array,
64
- * then adds a custom API call and injects the custom plugin data retrieved from the API.
65
- * It is reassembled from parts of the native WordPress plugin update code.
66
- * See wp-includes/update.php line 121 for the original wp_update_plugins() function.
67
- *
68
- * @uses api_request()
69
- *
70
- * @param array $_transient_data Update array build by WordPress.
71
- * @return array Modified update array with custom plugin data.
72
- */
73
- function check_update( $_transient_data ) {
74
-
75
- global $pagenow;
76
-
77
- if( ! is_object( $_transient_data ) ) {
78
- $_transient_data = new stdClass;
79
- }
80
-
81
- if( 'plugins.php' == $pagenow && is_multisite() ) {
82
- return $_transient_data;
83
- }
84
-
85
- if ( empty( $_transient_data->response ) || empty( $_transient_data->response[ $this->name ] ) ) {
86
-
87
- $version_info = $this->api_request( 'plugin_latest_version', array( 'slug' => $this->slug ) );
88
-
89
- if ( false !== $version_info && is_object( $version_info ) && isset( $version_info->new_version ) ) {
90
-
91
- if( version_compare( $this->version, $version_info->new_version, '<' ) ) {
92
-
93
- $_transient_data->response[ $this->name ] = $version_info;
94
-
95
- }
96
-
97
- $_transient_data->last_checked = time();
98
- $_transient_data->checked[ $this->name ] = $this->version;
99
-
100
- }
101
-
102
- }
103
-
104
- return $_transient_data;
105
- }
106
-
107
- /**
108
- * show update nofication row -- needed for multisite subsites, because WP won't tell you otherwise!
109
- *
110
- * @param string $file
111
- * @param array $plugin
112
- */
113
- public function show_update_notification( $file, $plugin ) {
114
-
115
- if( ! current_user_can( 'update_plugins' ) ) {
116
- return;
117
- }
118
-
119
- if( ! is_multisite() ) {
120
- return;
121
- }
122
-
123
- if ( $this->name != $file ) {
124
- return;
125
- }
126
-
127
- // Remove our filter on the site transient
128
- remove_filter( 'pre_set_site_transient_update_plugins', array( $this, 'check_update' ), 10 );
129
-
130
- $update_cache = get_site_transient( 'update_plugins' );
131
-
132
- $update_cache = is_object( $update_cache ) ? $update_cache : new stdClass();
133
-
134
- if ( empty( $update_cache->response ) || empty( $update_cache->response[ $this->name ] ) ) {
135
-
136
- $cache_key = md5( 'edd_plugin_' .sanitize_key( $this->name ) . '_version_info' );
137
- $version_info = get_transient( $cache_key );
138
-
139
- if( false === $version_info ) {
140
-
141
- $version_info = $this->api_request( 'plugin_latest_version', array( 'slug' => $this->slug ) );
142
-
143
- set_transient( $cache_key, $version_info, 3600 );
144
- }
145
-
146
-
147
- if( ! is_object( $version_info ) ) {
148
- return;
149
- }
150
-
151
- if( version_compare( $this->version, $version_info->new_version, '<' ) ) {
152
-
153
- $update_cache->response[ $this->name ] = $version_info;
154
-
155
- }
156
-
157
- $update_cache->last_checked = time();
158
- $update_cache->checked[ $this->name ] = $this->version;
159
-
160
- set_site_transient( 'update_plugins', $update_cache );
161
-
162
- } else {
163
-
164
- $version_info = $update_cache->response[ $this->name ];
165
-
166
- }
167
-
168
- // Restore our filter
169
- add_filter( 'pre_set_site_transient_update_plugins', array( $this, 'check_update' ) );
170
-
171
- if ( ! empty( $update_cache->response[ $this->name ] ) && version_compare( $this->version, $version_info->new_version, '<' ) ) {
172
-
173
- // build a plugin list row, with update notification
174
- $wp_list_table = _get_list_table( 'WP_Plugins_List_Table' );
175
- echo '<tr class="plugin-update-tr"><td colspan="' . $wp_list_table->get_column_count() . '" class="plugin-update colspanchange"><div class="update-message">';
176
-
177
- $changelog_link = self_admin_url( 'index.php?edd_sl_action=view_plugin_changelog&plugin=' . $this->name . '&slug=' . $this->slug . '&TB_iframe=true&width=772&height=911' );
178
-
179
- if ( empty( $version_info->download_link ) ) {
180
- printf(
181
- __( 'There is a new version of %1$s available. <a target="_blank" class="thickbox" href="%2$s">View version %3$s details</a>.', 'edd' ),
182
- esc_html( $version_info->name ),
183
- esc_url( $changelog_link ),
184
- esc_html( $version_info->new_version )
185
- );
186
- } else {
187
- printf(
188
- __( 'There is a new version of %1$s available. <a target="_blank" class="thickbox" href="%2$s">View version %3$s details</a> or <a href="%4$s">update now</a>.', 'edd' ),
189
- esc_html( $version_info->name ),
190
- esc_url( $changelog_link ),
191
- esc_html( $version_info->new_version ),
192
- esc_url( wp_nonce_url( self_admin_url( 'update.php?action=upgrade-plugin&plugin=' ) . $this->name, 'upgrade-plugin_' . $this->name ) )
193
- );
194
- }
195
-
196
- echo '</div></td></tr>';
197
- }
198
- }
199
-
200
-
201
- /**
202
- * Updates information on the "View version x.x details" page with custom data.
203
- *
204
- * @uses api_request()
205
- *
206
- * @param mixed $_data
207
- * @param string $_action
208
- * @param object $_args
209
- * @return object $_data
210
- */
211
- function plugins_api_filter( $_data, $_action = '', $_args = null ) {
212
-
213
-
214
- if ( $_action != 'plugin_information' ) {
215
-
216
- return $_data;
217
-
218
- }
219
-
220
- if ( ! isset( $_args->slug ) || ( $_args->slug != $this->slug ) ) {
221
-
222
- return $_data;
223
-
224
- }
225
-
226
- $to_send = array(
227
- 'slug' => $this->slug,
228
- 'is_ssl' => is_ssl(),
229
- 'fields' => array(
230
- 'banners' => false, // These will be supported soon hopefully
231
- 'reviews' => false
232
- )
233
- );
234
-
235
- $api_response = $this->api_request( 'plugin_information', $to_send );
236
-
237
- if ( false !== $api_response ) {
238
- $_data = $api_response;
239
- }
240
-
241
- return $_data;
242
- }
243
-
244
-
245
- /**
246
- * Disable SSL verification in order to prevent download update failures
247
- *
248
- * @param array $args
249
- * @param string $url
250
- * @return object $array
251
- */
252
- function http_request_args( $args, $url ) {
253
- // If it is an https request and we are performing a package download, disable ssl verification
254
- if ( strpos( $url, 'https://' ) !== false && strpos( $url, 'edd_action=package_download' ) ) {
255
- $args['sslverify'] = false;
256
- }
257
- return $args;
258
- }
259
-
260
- /**
261
- * Calls the API and, if successfull, returns the object delivered by the API.
262
- *
263
- * @uses get_bloginfo()
264
- * @uses wp_remote_post()
265
- * @uses is_wp_error()
266
- *
267
- * @param string $_action The requested action.
268
- * @param array $_data Parameters for the API action.
269
- * @return false|object
270
- */
271
- private function api_request( $_action, $_data ) {
272
-
273
- global $wp_version;
274
-
275
- $data = array_merge( $this->api_data, $_data );
276
-
277
- if ( $data['slug'] != $this->slug ) {
278
- return;
279
- }
280
-
281
- if( $this->api_url == home_url() ) {
282
- return false; // Don't allow a plugin to ping itself
283
- }
284
-
285
- $api_params = array(
286
- 'edd_action' => 'get_version',
287
- 'license' => ! empty( $data['license'] ) ? $data['license'] : '',
288
- 'item_name' => isset( $data['item_name'] ) ? $data['item_name'] : false,
289
- 'item_id' => isset( $data['item_id'] ) ? $data['item_id'] : false,
290
- 'slug' => $data['slug'],
291
- 'author' => $data['author'],
292
- 'url' => home_url()
293
- );
294
-
295
- $request = wp_remote_post( $this->api_url, array( 'timeout' => 15, 'sslverify' => false, 'body' => $api_params ) );
296
-
297
- if ( ! is_wp_error( $request ) ) {
298
- $request = json_decode( wp_remote_retrieve_body( $request ) );
299
- }
300
-
301
- if ( $request && isset( $request->sections ) ) {
302
- $request->sections = maybe_unserialize( $request->sections );
303
- } else {
304
- $request = false;
305
- }
306
-
307
- return $request;
308
- }
309
-
310
- public function show_changelog() {
311
-
312
-
313
- if( empty( $_REQUEST['edd_sl_action'] ) || 'view_plugin_changelog' != $_REQUEST['edd_sl_action'] ) {
314
- return;
315
- }
316
-
317
- if( empty( $_REQUEST['plugin'] ) ) {
318
- return;
319
- }
320
-
321
- if( empty( $_REQUEST['slug'] ) ) {
322
- return;
323
- }
324
-
325
- if( ! current_user_can( 'update_plugins' ) ) {
326
- wp_die( __( 'You do not have permission to install plugin updates', 'edd' ), __( 'Error', 'edd' ), array( 'response' => 403 ) );
327
- }
328
-
329
- $response = $this->api_request( 'plugin_latest_version', array( 'slug' => $_REQUEST['slug'] ) );
330
-
331
- if( $response && isset( $response->sections['changelog'] ) ) {
332
- echo '<div style="background:#fff;padding:10px;">' . $response->sections['changelog'] . '</div>';
333
- }
334
-
335
-
336
- exit;
337
- }
338
-
339
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // uncomment this line for testing
4
+ //set_site_transient( 'update_plugins', null );
5
+
6
+ // Exit if accessed directly
7
+ if ( ! defined( 'ABSPATH' ) ) exit;
8
+
9
+ /**
10
+ * Allows plugins to use their own update API.
11
+ *
12
+ * @author Pippin Williamson
13
+ * @version 1.6.7
14
+ */
15
+ class EDD_SL_Plugin_Updater {
16
+
17
+ private $api_url = '';
18
+ private $api_data = array();
19
+ private $name = '';
20
+ private $slug = '';
21
+ private $version = '';
22
+ private $wp_override = false;
23
+ private $cache_key = '';
24
+
25
+ /**
26
+ * Class constructor.
27
+ *
28
+ * @uses plugin_basename()
29
+ * @uses hook()
30
+ *
31
+ * @param string $_api_url The URL pointing to the custom API endpoint.
32
+ * @param string $_plugin_file Path to the plugin file.
33
+ * @param array $_api_data Optional data to send with API calls.
34
+ */
35
+ public function __construct( $_api_url, $_plugin_file, $_api_data = null ) {
36
+
37
+ global $edd_plugin_data;
38
+
39
+ $this->api_url = trailingslashit( $_api_url );
40
+ $this->api_data = $_api_data;
41
+ $this->name = plugin_basename( $_plugin_file );
42
+ $this->slug = basename( $_plugin_file, '.php' );
43
+ $this->version = $_api_data['version'];
44
+ $this->wp_override = isset( $_api_data['wp_override'] ) ? (bool) $_api_data['wp_override'] : false;
45
+
46
+ $this->cache_key = md5( serialize( $this->slug . $this->api_data['license'] ) );
47
+
48
+ $edd_plugin_data[ $this->slug ] = $this->api_data;
49
+
50
+ // Set up hooks.
51
+ $this->init();
52
+
53
+ }
54
+
55
+ /**
56
+ * Set up WordPress filters to hook into WP's update process.
57
+ *
58
+ * @uses add_filter()
59
+ *
60
+ * @return void
61
+ */
62
+ public function init() {
63
+
64
+ add_filter( 'pre_set_site_transient_update_plugins', array( $this, 'check_update' ) );
65
+ add_filter( 'plugins_api', array( $this, 'plugins_api_filter' ), 10, 3 );
66
+ remove_action( 'after_plugin_row_' . $this->name, 'wp_plugin_update_row', 10 );
67
+ add_action( 'after_plugin_row_' . $this->name, array( $this, 'show_update_notification' ), 10, 2 );
68
+ add_action( 'admin_init', array( $this, 'show_changelog' ) );
69
+
70
+ }
71
+
72
+ /**
73
+ * Check for Updates at the defined API endpoint and modify the update array.
74
+ *
75
+ * This function dives into the update API just when WordPress creates its update array,
76
+ * then adds a custom API call and injects the custom plugin data retrieved from the API.
77
+ * It is reassembled from parts of the native WordPress plugin update code.
78
+ * See wp-includes/update.php line 121 for the original wp_update_plugins() function.
79
+ *
80
+ * @uses api_request()
81
+ *
82
+ * @param array $_transient_data Update array build by WordPress.
83
+ * @return array Modified update array with custom plugin data.
84
+ */
85
+ public function check_update( $_transient_data ) {
86
+
87
+ global $pagenow;
88
+
89
+ if ( ! is_object( $_transient_data ) ) {
90
+ $_transient_data = new stdClass;
91
+ }
92
+
93
+ if ( 'plugins.php' == $pagenow && is_multisite() ) {
94
+ return $_transient_data;
95
+ }
96
+
97
+ if ( ! empty( $_transient_data->response ) && ! empty( $_transient_data->response[ $this->name ] ) && false === $this->wp_override ) {
98
+ return $_transient_data;
99
+ }
100
+
101
+ $version_info = $this->get_cached_version_info();
102
+
103
+ if ( false === $version_info ) {
104
+ $version_info = $this->api_request( 'plugin_latest_version', array( 'slug' => $this->slug ) );
105
+
106
+ $this->set_version_info_cache( $version_info );
107
+
108
+ }
109
+
110
+ if ( false !== $version_info && is_object( $version_info ) && isset( $version_info->new_version ) ) {
111
+
112
+ if ( version_compare( $this->version, $version_info->new_version, '<' ) ) {
113
+
114
+ $_transient_data->response[ $this->name ] = $version_info;
115
+
116
+ }
117
+
118
+ $_transient_data->last_checked = current_time( 'timestamp' );
119
+ $_transient_data->checked[ $this->name ] = $this->version;
120
+
121
+ }
122
+
123
+ return $_transient_data;
124
+ }
125
+
126
+ /**
127
+ * show update nofication row -- needed for multisite subsites, because WP won't tell you otherwise!
128
+ *
129
+ * @param string $file
130
+ * @param array $plugin
131
+ */
132
+ public function show_update_notification( $file, $plugin ) {
133
+
134
+ if ( is_network_admin() ) {
135
+ return;
136
+ }
137
+
138
+ if( ! current_user_can( 'update_plugins' ) ) {
139
+ return;
140
+ }
141
+
142
+ if( ! is_multisite() ) {
143
+ return;
144
+ }
145
+
146
+ if ( $this->name != $file ) {
147
+ return;
148
+ }
149
+
150
+ // Remove our filter on the site transient
151
+ remove_filter( 'pre_set_site_transient_update_plugins', array( $this, 'check_update' ), 10 );
152
+
153
+ $update_cache = get_site_transient( 'update_plugins' );
154
+
155
+ $update_cache = is_object( $update_cache ) ? $update_cache : new stdClass();
156
+
157
+ if ( empty( $update_cache->response ) || empty( $update_cache->response[ $this->name ] ) ) {
158
+
159
+ $version_info = $this->get_cached_version_info();
160
+
161
+ if ( false === $version_info ) {
162
+ $version_info = $this->api_request( 'plugin_latest_version', array( 'slug' => $this->slug ) );
163
+
164
+ $this->set_version_info_cache( $version_info );
165
+ }
166
+
167
+ if ( ! is_object( $version_info ) ) {
168
+ return;
169
+ }
170
+
171
+ if ( version_compare( $this->version, $version_info->new_version, '<' ) ) {
172
+
173
+ $update_cache->response[ $this->name ] = $version_info;
174
+
175
+ }
176
+
177
+ $update_cache->last_checked = current_time( 'timestamp' );
178
+ $update_cache->checked[ $this->name ] = $this->version;
179
+
180
+ set_site_transient( 'update_plugins', $update_cache );
181
+
182
+ } else {
183
+
184
+ $version_info = $update_cache->response[ $this->name ];
185
+
186
+ }
187
+
188
+ // Restore our filter
189
+ add_filter( 'pre_set_site_transient_update_plugins', array( $this, 'check_update' ) );
190
+
191
+ if ( ! empty( $update_cache->response[ $this->name ] ) && version_compare( $this->version, $version_info->new_version, '<' ) ) {
192
+
193
+ // build a plugin list row, with update notification
194
+ $wp_list_table = _get_list_table( 'WP_Plugins_List_Table' );
195
+ # <tr class="plugin-update-tr"><td colspan="' . $wp_list_table->get_column_count() . '" class="plugin-update colspanchange">
196
+ echo '<tr class="plugin-update-tr" id="' . $this->slug . '-update" data-slug="' . $this->slug . '" data-plugin="' . $this->slug . '/' . $file . '">';
197
+ echo '<td colspan="3" class="plugin-update colspanchange">';
198
+ echo '<div class="update-message notice inline notice-warning notice-alt">';
199
+
200
+ $changelog_link = self_admin_url( 'index.php?edd_sl_action=view_plugin_changelog&plugin=' . $this->name . '&slug=' . $this->slug . '&TB_iframe=true&width=772&height=911' );
201
+
202
+ if ( empty( $version_info->download_link ) ) {
203
+ printf(
204
+ __( 'There is a new version of %1$s available. %2$sView version %3$s details%4$s.', 'easy-digital-downloads' ),
205
+ esc_html( $version_info->name ),
206
+ '<a target="_blank" class="thickbox" href="' . esc_url( $changelog_link ) . '">',
207
+ esc_html( $version_info->new_version ),
208
+ '</a>'
209
+ );
210
+ } else {
211
+ printf(
212
+ __( 'There is a new version of %1$s available. %2$sView version %3$s details%4$s or %5$supdate now%6$s.', 'easy-digital-downloads' ),
213
+ esc_html( $version_info->name ),
214
+ '<a target="_blank" class="thickbox" href="' . esc_url( $changelog_link ) . '">',
215
+ esc_html( $version_info->new_version ),
216
+ '</a>',
217
+ '<a href="' . esc_url( wp_nonce_url( self_admin_url( 'update.php?action=upgrade-plugin&plugin=' ) . $this->name, 'upgrade-plugin_' . $this->name ) ) .'">',
218
+ '</a>'
219
+ );
220
+ }
221
+
222
+ do_action( "in_plugin_update_message-{$file}", $plugin, $version_info );
223
+
224
+ echo '</div></td></tr>';
225
+ }
226
+ }
227
+
228
+ /**
229
+ * Updates information on the "View version x.x details" page with custom data.
230
+ *
231
+ * @uses api_request()
232
+ *
233
+ * @param mixed $_data
234
+ * @param string $_action
235
+ * @param object $_args
236
+ * @return object $_data
237
+ */
238
+ public function plugins_api_filter( $_data, $_action = '', $_args = null ) {
239
+
240
+ if ( $_action != 'plugin_information' ) {
241
+
242
+ return $_data;
243
+
244
+ }
245
+
246
+ if ( ! isset( $_args->slug ) || ( $_args->slug != $this->slug ) ) {
247
+
248
+ return $_data;
249
+
250
+ }
251
+
252
+ $to_send = array(
253
+ 'slug' => $this->slug,
254
+ 'is_ssl' => is_ssl(),
255
+ 'fields' => array(
256
+ 'banners' => false, // These will be supported soon hopefully
257
+ 'reviews' => false
258
+ )
259
+ );
260
+
261
+ $cache_key = 'edd_api_request_' . md5( serialize( $this->slug . $this->api_data['license'] ) );
262
+
263
+ // Get the transient where we store the api request for this plugin for 24 hours
264
+ $edd_api_request_transient = $this->get_cached_version_info( $cache_key );
265
+
266
+ //If we have no transient-saved value, run the API, set a fresh transient with the API value, and return that value too right now.
267
+ if ( empty( $edd_api_request_transient ) ){
268
+
269
+ $api_response = $this->api_request( 'plugin_information', $to_send );
270
+
271
+ // Expires in 3 hours
272
+ $this->set_version_info_cache( $api_response, $cache_key );
273
+
274
+ if ( false !== $api_response ) {
275
+ $_data = $api_response;
276
+ }
277
+
278
+ }
279
+
280
+ return $_data;
281
+ }
282
+
283
+ /**
284
+ * Disable SSL verification in order to prevent download update failures
285
+ *
286
+ * @param array $args
287
+ * @param string $url
288
+ * @return object $array
289
+ */
290
+ public function http_request_args( $args, $url ) {
291
+ // If it is an https request and we are performing a package download, disable ssl verification
292
+ if ( strpos( $url, 'https://' ) !== false && strpos( $url, 'edd_action=package_download' ) ) {
293
+ $args['sslverify'] = false;
294
+ }
295
+ return $args;
296
+ }
297
+
298
+ /**
299
+ * Calls the API and, if successfull, returns the object delivered by the API.
300
+ *
301
+ * @uses get_bloginfo()
302
+ * @uses wp_remote_post()
303
+ * @uses is_wp_error()
304
+ *
305
+ * @param string $_action The requested action.
306
+ * @param array $_data Parameters for the API action.
307
+ * @return false|object
308
+ */
309
+ private function api_request( $_action, $_data ) {
310
+
311
+ global $wp_version;
312
+
313
+ $data = array_merge( $this->api_data, $_data );
314
+
315
+ if ( $data['slug'] != $this->slug ) {
316
+ return;
317
+ }
318
+
319
+ if( $this->api_url == trailingslashit (home_url() ) ) {
320
+ return false; // Don't allow a plugin to ping itself
321
+ }
322
+
323
+ $api_params = array(
324
+ 'edd_action' => 'get_version',
325
+ 'license' => ! empty( $data['license'] ) ? $data['license'] : '',
326
+ 'item_name' => isset( $data['item_name'] ) ? $data['item_name'] : false,
327
+ 'item_id' => isset( $data['item_id'] ) ? $data['item_id'] : false,
328
+ 'slug' => $data['slug'],
329
+ 'author' => $data['author'],
330
+ 'url' => home_url(),
331
+ 'beta' => isset( $data['beta'] ) ? $data['beta'] : false,
332
+ );
333
+
334
+ $request = wp_remote_post( $this->api_url, array( 'timeout' => 15, 'sslverify' => false, 'body' => $api_params ) );
335
+
336
+ if ( ! is_wp_error( $request ) ) {
337
+ $request = json_decode( wp_remote_retrieve_body( $request ) );
338
+ }
339
+
340
+ if ( $request && isset( $request->sections ) ) {
341
+ $request->sections = maybe_unserialize( $request->sections );
342
+ } else {
343
+ $request = false;
344
+ }
345
+
346
+ return $request;
347
+ }
348
+
349
+ public function show_changelog() {
350
+
351
+ global $edd_plugin_data;
352
+
353
+ if( empty( $_REQUEST['edd_sl_action'] ) || 'view_plugin_changelog' != $_REQUEST['edd_sl_action'] ) {
354
+ return;
355
+ }
356
+
357
+ if( empty( $_REQUEST['plugin'] ) ) {
358
+ return;
359
+ }
360
+
361
+ if( empty( $_REQUEST['slug'] ) ) {
362
+ return;
363
+ }
364
+
365
+ if( ! current_user_can( 'update_plugins' ) ) {
366
+ wp_die( __( 'You do not have permission to install plugin updates', 'easy-digital-downloads' ), __( 'Error', 'easy-digital-downloads' ), array( 'response' => 403 ) );
367
+ }
368
+
369
+ $data = $edd_plugin_data[ $_REQUEST['slug'] ];
370
+ $cache_key = md5( 'edd_plugin_' . sanitize_key( $_REQUEST['plugin'] ) . '_version_info' );
371
+ $version_info = $this->get_cached_version_info( $cache_key );
372
+
373
+ if( false === $version_info ) {
374
+
375
+ $api_params = array(
376
+ 'edd_action' => 'get_version',
377
+ 'item_name' => isset( $data['item_name'] ) ? $data['item_name'] : false,
378
+ 'item_id' => isset( $data['item_id'] ) ? $data['item_id'] : false,
379
+ 'slug' => $_REQUEST['slug'],
380
+ 'author' => $data['author'],
381
+ 'url' => home_url()
382
+ );
383
+
384
+ $request = wp_remote_post( $this->api_url, array( 'timeout' => 15, 'sslverify' => false, 'body' => $api_params ) );
385
+
386
+ if ( ! is_wp_error( $request ) ) {
387
+ $version_info = json_decode( wp_remote_retrieve_body( $request ) );
388
+ }
389
+
390
+ if ( ! empty( $version_info ) && isset( $version_info->sections ) ) {
391
+ $version_info->sections = maybe_unserialize( $version_info->sections );
392
+ } else {
393
+ $version_info = false;
394
+ }
395
+
396
+ $this->set_version_info_cache( $version_info, $cache_key );
397
+
398
+ }
399
+
400
+ if( ! empty( $version_info ) && isset( $version_info->sections['changelog'] ) ) {
401
+ echo '<div style="background:#fff;padding:10px;">' . $version_info->sections['changelog'] . '</div>';
402
+ }
403
+
404
+ exit;
405
+ }
406
+
407
+ public function get_cached_version_info( $cache_key = '' ) {
408
+
409
+ if( empty( $cache_key ) ) {
410
+ $cache_key = $this->cache_key;
411
+ }
412
+
413
+ $cache = get_option( $cache_key );
414
+
415
+ if( empty( $cache['timeout'] ) || current_time( 'timestamp' ) > $cache['timeout'] ) {
416
+ return false; // Cache is expired
417
+ }
418
+
419
+ return json_decode( $cache['value'] );
420
+
421
+ }
422
+
423
+ public function set_version_info_cache( $value = '', $cache_key = '' ) {
424
+
425
+ if( empty( $cache_key ) ) {
426
+ $cache_key = $this->cache_key;
427
+ }
428
+
429
+ $data = array(
430
+ 'timeout' => strtotime( '+3 hours', current_time( 'timestamp' ) ),
431
+ 'value' => json_encode( $value )
432
+ );
433
+
434
+ update_option( $cache_key, $data );
435
+
436
+ }
437
+
438
+ }
admin/js/wpsl-admin.js CHANGED
@@ -592,17 +592,18 @@ function currentPeriodCount( elem ) {
592
  function createHourOptionList( returnList ) {
593
  var openingHours, openingHourInterval, hour, hrFormat,
594
  pm = false,
 
595
  pmOrAm = "",
596
  optionList = "",
597
  openingTimes = [],
598
  openingHourOptions = {
599
  "hours": {
600
- "hr12": [ 0, 1, 2, 3 ,4 ,5 ,6, 7, 8, 9, 10, 11, 12, 1, 2, 3 , 4, 5, 6, 7, 8, 9, 10, 11 ],
601
  "hr24": [ 0, 1, 2, 3 ,4 ,5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 ,16, 17, 18, 19, 20, 21, 22, 23 ]
602
  },
603
  "interval": [ '00', '15', '30', '45' ]
604
  };
605
-
606
  if ( $( "#wpsl-editor-hour-format" ).length ) {
607
  hrFormat = $( "#wpsl-editor-hour-format" ).val();
608
  } else {
@@ -632,7 +633,9 @@ function createHourOptionList( returnList ) {
632
  */
633
  if ( hrFormat == 12 ) {
634
  if ( hour >= 12 ) {
635
- pm = true;
 
 
636
  }
637
 
638
  pmOrAm = ( pm ) ? "PM" : "AM";
592
  function createHourOptionList( returnList ) {
593
  var openingHours, openingHourInterval, hour, hrFormat,
594
  pm = false,
595
+ twelveHrsAfternoon = false,
596
  pmOrAm = "",
597
  optionList = "",
598
  openingTimes = [],
599
  openingHourOptions = {
600
  "hours": {
601
+ "hr12": [ 12, 1, 2, 3 ,4 ,5 ,6, 7, 8, 9, 10, 11, 12, 1, 2, 3 , 4, 5, 6, 7, 8, 9, 10, 11 ],
602
  "hr24": [ 0, 1, 2, 3 ,4 ,5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 ,16, 17, 18, 19, 20, 21, 22, 23 ]
603
  },
604
  "interval": [ '00', '15', '30', '45' ]
605
  };
606
+
607
  if ( $( "#wpsl-editor-hour-format" ).length ) {
608
  hrFormat = $( "#wpsl-editor-hour-format" ).val();
609
  } else {
633
  */
634
  if ( hrFormat == 12 ) {
635
  if ( hour >= 12 ) {
636
+ pm = ( twelveHrsAfternoon ) ? true : false;
637
+
638
+ twelveHrsAfternoon = true;
639
  }
640
 
641
  pmOrAm = ( pm ) ? "PM" : "AM";
admin/js/wpsl-admin.min.js CHANGED
@@ -1 +1 @@
1
- jQuery(document).ready(function(e){function s(){var e=wpslSettings.defaultLatLng.split(","),s=new google.maps.LatLng(e[0],e[1]),o={};o={zoom:parseInt(wpslSettings.defaultZoom),center:s,mapTypeId:google.maps.MapTypeId[wpslSettings.mapType.toUpperCase()],mapTypeControl:!1,streetViewControl:!1,zoomControlOptions:{position:google.maps.ControlPosition.RIGHT_TOP}},M=new google.maps.Geocoder,b=new google.maps.Map(document.getElementById("wpsl-gmap-wrap"),o),t()}function t(){var s,t=e("#wpsl-lat").val(),o=e("#wpsl-lng").val();t&&o&&(s=new google.maps.LatLng(t,o),b.setCenter(s),b.setZoom(16),l(s))}function o(){var e,s=document.getElementById("wpsl-start-name"),t={types:["geocode"]},o=new google.maps.places.Autocomplete(s,t);google.maps.event.addListener(o,"place_changed",function(){e=o.getPlace().geometry.location,n(e,"zoom")})}function l(e){var s=new google.maps.Marker({position:e,map:b,draggable:!0});_.push(s),google.maps.event.addListener(s,"dragend",function(){n(s.getPosition(),"store")})}function n(s,t){var o=d(s),l=c(o[0]),n=c(o[1]);"store"==t?(e("#wpsl-lat").val(l),e("#wpsl-lng").val(n)):"zoom"==t&&e("#wpsl-latlng").val(l+","+n)}function r(){var s,t;return a()?(w("first"),alert(wpslL10n.missingGeoData),!0):(t=i(),M.geocode({address:t},function(t,o){o===google.maps.GeocoderStatus.OK?("undefined"!=typeof _[0]&&_[0].draggable&&(_[0].setMap(null),_.splice(0,1)),b.setCenter(t[0].geometry.location),b.setZoom(16),l(t[0].geometry.location),n(t[0].geometry.location,"store"),s=p(t),e("#wpsl-country").val(s.country.long_name),e("#wpsl-country_iso").val(s.country.short_name)):alert(wpslL10n.geocodeFail+": "+o)}),!1)}function a(){var s,t,o=["address","city","country"],l=!1;for(e(".wpsl-store-meta input").removeClass("wpsl-error"),s=0;s<o.length;s++)t=e.trim(e("#wpsl-"+o[s]).val()),t||(e("#wpsl-"+o[s]).addClass("wpsl-error"),l=!0),t="";return l}function i(){var s,t,o=[],l=["address","city","state","zip","country"];for(s=0;s<l.length;s++)t=e.trim(e("#wpsl-"+l[s]).val()),t&&o.push(t),t="";return o.join()}function p(e){var s,t,o={},l={},n=e[0].address_components.length;for(s=0;n>s;s++)t=e[0].address_components[s].types,/^country,political$/.test(t)&&(o={long_name:e[0].address_components[s].long_name,short_name:e[0].address_components[s].short_name});return l={country:o}}function c(e){var s,t=6;return s=Math.round(e*Math.pow(10,t))/Math.pow(10,t)}function d(e){var s=[],t=e.toString(),o=t.split(",",2);return s[0]=o[0].replace("(",""),s[1]=o[1].replace(")",""),s}function w(s){s="first"==s?":first-child":"."+s,e("#wpsl-meta-nav li"+s+"-tab").hasClass("wpsl-active")||(e("#wpsl-meta-nav li"+s+"-tab").addClass("wpsl-active").siblings().removeClass("wpsl-active"),e(".wpsl-store-meta > div"+s).show().addClass("wpsl-active").siblings("div").hide().removeClass("wpsl-active"))}function u(e){var s={};return s={type:"id",val:e.attr("id")},"undefined"==typeof s.val&&(s={type:"class",val:e.attr("class")}),s}function h(){e("#wpsl-store-hours .wpsl-icon-cancel-circled").off(),e("#wpsl-store-hours .wpsl-icon-cancel-circled").on("click",function(){v(e(this))})}function v(e){var s=f(e),t=e.parents("tr"),o=t.find(".wpsl-opening-hours").attr("data-day");1==s&&t.find(".wpsl-opening-hours").html("<p class='wpsl-store-closed'>"+wpslL10n.closedDate+"<input type='hidden' name='wpsl[hours]["+o+"_open]' value='' /></p>"),e.parent().closest(".wpsl-current-period").remove(),t.find(".wpsl-opening-hours div:first-child").hasClass("wpsl-multiple-periods")&&t.find(".wpsl-opening-hours div:first-child").removeClass("wpsl-multiple-periods")}function f(e){var s=e.parents("tr").find(".wpsl-current-period").length;return s}function m(s){var t,o,l,n,r=!1,a="",i="",p=[],c={hours:{hr12:[0,1,2,3,4,5,6,7,8,9,10,11,12,1,2,3,4,5,6,7,8,9,10,11],hr24:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23]},interval:["00","15","30","45"]};n=e("#wpsl-editor-hour-format").length?e("#wpsl-editor-hour-format").val():wpslSettings.hourFormat,e("#wpsl-store-hours td").removeAttr("style"),12==n?(e("#wpsl-store-hours").removeClass().addClass("wpsl-twelve-format"),t=c.hours.hr12):(e("#wpsl-store-hours").removeClass().addClass("wpsl-twentyfour-format"),t=c.hours.hr24),o=c.interval;for(var d=0;d<t.length;d++){l=t[d],12==n?(l>=12&&(r=!0),a=r?"PM":"AM"):24==n&&1==l.toString().length&&(l="0"+l);for(var w=0;w<o.length;w++)p.push(l+":"+o[w]+" "+a)}for(var d=0;d<p.length;d++)i=i+'<option value="'+e.trim(p[d])+'">'+e.trim(p[d])+"</option>";return s?i:void g(i,n)}function g(s,t){var o,l,n,r={};e(".wpsl-current-period").each(function(){n=e(this),r={open:e(this).find(".wpsl-open-hour").val(),close:e(this).find(".wpsl-close-hour").val()},e(this).find("select").html(s).promise().done(function(){for(var s in r)r.hasOwnProperty(s)&&(o=r[s].split(":"),12==t?(l="",0==r[s].charAt(0)?(r[s]=r[s].substr(1),l=" AM"):2==o[0].length&&o[0]>12?(r[s]=o[0]-12+":"+o[1],l=" PM"):o[0]<12?(r[s]=o[0]+":"+o[1],l=" AM"):12==o[0]&&(r[s]=o[0]+":"+o[1],l=" PM"),-1==o[1].indexOf("PM")&&-1==o[1].indexOf("AM")&&(r[s]=r[s]+l)):24==t&&(-1!=o[1].indexOf("PM")?12==o[0]?r[s]="12:"+o[1].replace(" PM",""):r[s]=+o[0]+12+":"+o[1].replace(" PM",""):-1!=o[1].indexOf("AM")?1==o[0].toString().length?r[s]="0"+o[0]+":"+o[1].replace(" AM",""):r[s]=o[0]+":"+o[1].replace(" AM",""):r[s]=o[0]+":"+o[1]),n.find(".wpsl-"+s+"-hour option[value='"+e.trim(r[s])+"']").attr("selected","selected"))})})}function y(){var s="",t=e.trim(e("#wpsl-map-style").val());e(".wpsl-style-preview-error").remove(),t&&(s=C(t),s||e("#wpsl-style-preview").after("<div class='wpsl-style-preview-error'>"+wpslL10n.styleError+"</div>")),b.setOptions({styles:s})}function C(e){try{var s=JSON.parse(e);if(s&&"object"==typeof s&&null!==s)return s}catch(t){}return!1}var b,M,_=[];e("#wpsl-gmap-wrap").length&&s(),e("#wpsl-start-name").length&&o(),e("#wpsl-lookup-location").on("click",function(e){e.preventDefault(),r()}),e(".wpsl-marker-list input[type=radio]").click(function(){e(this).parents(".wpsl-marker-list").find("li").removeClass(),e(this).parent("li").addClass("wpsl-active-marker")}),e(".wpsl-marker-list li").click(function(){e(this).parents(".wpsl-marker-list").find("input").prop("checked",!1),e(this).find("input").prop("checked",!0),e(this).siblings().removeClass(),e(this).addClass("wpsl-active-marker")}),e(".wpsl-dismiss").click(function(){var s=e(this),t={action:"disable_location_warning",_ajax_nonce:s.attr("data-nonce")};return e.post(ajaxurl,t),e(".wpsl-dismiss").parents(".error").remove(),!1}),e(".wpsl-has-conditional-option").on("change",function(){e(this).parent().next(".wpsl-conditional-option").toggle()}),e("#wpsl-store-template").on("change",function(){var s=e("#wpsl-listing-below-no-scroll");"below_map"==e(this).val()?s.show():s.hide()}),e("#wpsl-api-region").on("change",function(){var s=e("#wpsl-geocode-component");e(this).val()?s.show():s.hide()}),e("#wpsl-editor-hour-input").on("change",function(){e(".wpsl-"+e(this).val()+"-hours").show().siblings("div").hide(),e(".wpsl-hour-notice").toggle()}),e("#wpsl-meta-nav li").on("click",function(s){var t=e(this).attr("class");t=t.split("-tab"),s.stopPropagation(),e(this).addClass("wpsl-active").siblings().removeClass("wpsl-active"),e(".wpsl-store-meta ."+t[0]).show().addClass("wpsl-active").siblings("div").hide().removeClass("wpsl-active")}),e("#wpsl-store-details").length&&e("#publish").click(function(){var s,t,o,l='<div id="message" class="error"><p>'+wpslL10n.requiredFields+"</p></div>",n=!1;return e("#wpbody-content .wrap #message").remove(),e(".wpsl-required").removeClass("wpsl-error"),e(".wpsl-required").each(function(){""==e(this).val()&&(e(this).addClass("wpsl-error"),"undefined"==typeof s&&(s=u(e(this))),n=!0)}),n?(e("#wpbody-content .wrap > h2").after(l),"undefined"!=typeof s.val&&("id"==s.type?(t=e("#"+s.val).parents(".wpsl-tab").attr("class"),e("html, body").scrollTop(Math.round(e("#"+s.val).offset().top-100))):"class"==s.type&&(o=s.val.replace(/wpsl-required|wpsl-error/g,""),t=e("."+o).parents(".wpsl-tab").attr("class"),e("html, body").scrollTop(Math.round(e("."+o).offset().top-100))),t=e.trim(t.replace(/wpsl-tab|wpsl-active/g,""))),w(t?t:"first"),e("#publish").removeClass("button-primary-disabled"),e(".spinner").hide(),!1):!0}),e("#wpsl-store-hours").length&&h(),e(".wpsl-add-period").on("click",function(s){var t,o={},l=!0,n=e(this).parents("tr"),r=f(e(this)),a=r>=1?"wpsl-current-period wpsl-multiple-periods":"wpsl-current-period",i=n.find(".wpsl-opening-hours").attr("data-day"),p=e("#wpsl-settings-form").length?"wpsl_editor[dropdown]":"wpsl[hours]";t='<div class="'+a+'">',t+='<select autocomplete="off" name="'+p+"["+i+'_open][]" class="wpsl-open-hour">'+m(l)+"</select>",t+="<span> - </span>",t+='<select autocomplete="off" name="'+p+"["+i+'_close][]" class="wpsl-close-hour">'+m(l)+"</select>",t+='<div class="wpsl-icon-cancel-circled"></div>',t+="</div>",n.find(".wpsl-store-closed").remove(),e("#wpsl-hours-"+i).append(t).end(),h(),o=24==e("#wpsl-editor-hour-format").val()?{open:"09:00",close:"17:00"}:{open:"9:00 AM",close:"5:00 PM"},n.find(".wpsl-open-hour:last option[value='"+o.open+"']").attr("selected","selected"),n.find(".wpsl-close-hour:last option[value='"+o.close+"']").attr("selected","selected"),s.preventDefault()}),e("#wpsl-editor-hour-format, #wpsl-editor-hour-interval").on("change",function(){m()}),e(".wpsl-info").on("mouseover",function(){e(this).find(".wpsl-info-text").show()}),e(".wpsl-info").on("mouseout",function(){e(this).find(".wpsl-info-text").hide()}),e("#wpsl-latlng").length&&!e("#wpsl-latlng").val()&&e("#wpsl-latlng").siblings("label").find(".wpsl-info").addClass("wpsl-required-setting"),e("#wpsl-map-style").val()&&y(),e("#wpsl-style-preview").on("click",function(){return y(),!1})});
1
+ jQuery(document).ready(function(e){function s(){var e=wpslSettings.defaultLatLng.split(","),s=new google.maps.LatLng(e[0],e[1]),o={};o={zoom:parseInt(wpslSettings.defaultZoom),center:s,mapTypeId:google.maps.MapTypeId[wpslSettings.mapType.toUpperCase()],mapTypeControl:!1,streetViewControl:!1,zoomControlOptions:{position:google.maps.ControlPosition.RIGHT_TOP}},M=new google.maps.Geocoder,b=new google.maps.Map(document.getElementById("wpsl-gmap-wrap"),o),t()}function t(){var s,t=e("#wpsl-lat").val(),o=e("#wpsl-lng").val();t&&o&&(s=new google.maps.LatLng(t,o),b.setCenter(s),b.setZoom(16),l(s))}function o(){var e,s=document.getElementById("wpsl-start-name"),t={types:["geocode"]},o=new google.maps.places.Autocomplete(s,t);google.maps.event.addListener(o,"place_changed",function(){e=o.getPlace().geometry.location,n(e,"zoom")})}function l(e){var s=new google.maps.Marker({position:e,map:b,draggable:!0});_.push(s),google.maps.event.addListener(s,"dragend",function(){n(s.getPosition(),"store")})}function n(s,t){var o=d(s),l=c(o[0]),n=c(o[1]);"store"==t?(e("#wpsl-lat").val(l),e("#wpsl-lng").val(n)):"zoom"==t&&e("#wpsl-latlng").val(l+","+n)}function r(){var s,t;return a()?(w("first"),alert(wpslL10n.missingGeoData),!0):(t=i(),M.geocode({address:t},function(t,o){o===google.maps.GeocoderStatus.OK?("undefined"!=typeof _[0]&&_[0].draggable&&(_[0].setMap(null),_.splice(0,1)),b.setCenter(t[0].geometry.location),b.setZoom(16),l(t[0].geometry.location),n(t[0].geometry.location,"store"),s=p(t),e("#wpsl-country").val(s.country.long_name),e("#wpsl-country_iso").val(s.country.short_name)):alert(wpslL10n.geocodeFail+": "+o)}),!1)}function a(){var s,t,o=["address","city","country"],l=!1;for(e(".wpsl-store-meta input").removeClass("wpsl-error"),s=0;s<o.length;s++)t=e.trim(e("#wpsl-"+o[s]).val()),t||(e("#wpsl-"+o[s]).addClass("wpsl-error"),l=!0),t="";return l}function i(){var s,t,o=[],l=["address","city","state","zip","country"];for(s=0;s<l.length;s++)t=e.trim(e("#wpsl-"+l[s]).val()),t&&o.push(t),t="";return o.join()}function p(e){var s,t,o={},l={},n=e[0].address_components.length;for(s=0;n>s;s++)t=e[0].address_components[s].types,/^country,political$/.test(t)&&(o={long_name:e[0].address_components[s].long_name,short_name:e[0].address_components[s].short_name});return l={country:o}}function c(e){var s,t=6;return s=Math.round(e*Math.pow(10,t))/Math.pow(10,t)}function d(e){var s=[],t=e.toString(),o=t.split(",",2);return s[0]=o[0].replace("(",""),s[1]=o[1].replace(")",""),s}function w(s){s="first"==s?":first-child":"."+s,e("#wpsl-meta-nav li"+s+"-tab").hasClass("wpsl-active")||(e("#wpsl-meta-nav li"+s+"-tab").addClass("wpsl-active").siblings().removeClass("wpsl-active"),e(".wpsl-store-meta > div"+s).show().addClass("wpsl-active").siblings("div").hide().removeClass("wpsl-active"))}function u(e){var s={};return s={type:"id",val:e.attr("id")},"undefined"==typeof s.val&&(s={type:"class",val:e.attr("class")}),s}function h(){e("#wpsl-store-hours .wpsl-icon-cancel-circled").off(),e("#wpsl-store-hours .wpsl-icon-cancel-circled").on("click",function(){v(e(this))})}function v(e){var s=f(e),t=e.parents("tr"),o=t.find(".wpsl-opening-hours").attr("data-day");1==s&&t.find(".wpsl-opening-hours").html("<p class='wpsl-store-closed'>"+wpslL10n.closedDate+"<input type='hidden' name='wpsl[hours]["+o+"_open]' value='' /></p>"),e.parent().closest(".wpsl-current-period").remove(),t.find(".wpsl-opening-hours div:first-child").hasClass("wpsl-multiple-periods")&&t.find(".wpsl-opening-hours div:first-child").removeClass("wpsl-multiple-periods")}function f(e){var s=e.parents("tr").find(".wpsl-current-period").length;return s}function m(s){var t,o,l,n,r=!1,a=!1,i="",p="",c=[],d={hours:{hr12:[12,1,2,3,4,5,6,7,8,9,10,11,12,1,2,3,4,5,6,7,8,9,10,11],hr24:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23]},interval:["00","15","30","45"]};n=e("#wpsl-editor-hour-format").length?e("#wpsl-editor-hour-format").val():wpslSettings.hourFormat,e("#wpsl-store-hours td").removeAttr("style"),12==n?(e("#wpsl-store-hours").removeClass().addClass("wpsl-twelve-format"),t=d.hours.hr12):(e("#wpsl-store-hours").removeClass().addClass("wpsl-twentyfour-format"),t=d.hours.hr24),o=d.interval;for(var w=0;w<t.length;w++){l=t[w],12==n?(l>=12&&(r=a?!0:!1,a=!0),i=r?"PM":"AM"):24==n&&1==l.toString().length&&(l="0"+l);for(var u=0;u<o.length;u++)c.push(l+":"+o[u]+" "+i)}for(var w=0;w<c.length;w++)p=p+'<option value="'+e.trim(c[w])+'">'+e.trim(c[w])+"</option>";return s?p:void g(p,n)}function g(s,t){var o,l,n,r={};e(".wpsl-current-period").each(function(){n=e(this),r={open:e(this).find(".wpsl-open-hour").val(),close:e(this).find(".wpsl-close-hour").val()},e(this).find("select").html(s).promise().done(function(){for(var s in r)r.hasOwnProperty(s)&&(o=r[s].split(":"),12==t?(l="",0==r[s].charAt(0)?(r[s]=r[s].substr(1),l=" AM"):2==o[0].length&&o[0]>12?(r[s]=o[0]-12+":"+o[1],l=" PM"):o[0]<12?(r[s]=o[0]+":"+o[1],l=" AM"):12==o[0]&&(r[s]=o[0]+":"+o[1],l=" PM"),-1==o[1].indexOf("PM")&&-1==o[1].indexOf("AM")&&(r[s]=r[s]+l)):24==t&&(-1!=o[1].indexOf("PM")?12==o[0]?r[s]="12:"+o[1].replace(" PM",""):r[s]=+o[0]+12+":"+o[1].replace(" PM",""):-1!=o[1].indexOf("AM")?1==o[0].toString().length?r[s]="0"+o[0]+":"+o[1].replace(" AM",""):r[s]=o[0]+":"+o[1].replace(" AM",""):r[s]=o[0]+":"+o[1]),n.find(".wpsl-"+s+"-hour option[value='"+e.trim(r[s])+"']").attr("selected","selected"))})})}function y(){var s="",t=e.trim(e("#wpsl-map-style").val());e(".wpsl-style-preview-error").remove(),t&&(s=C(t),s||e("#wpsl-style-preview").after("<div class='wpsl-style-preview-error'>"+wpslL10n.styleError+"</div>")),b.setOptions({styles:s})}function C(e){try{var s=JSON.parse(e);if(s&&"object"==typeof s&&null!==s)return s}catch(t){}return!1}var b,M,_=[];e("#wpsl-gmap-wrap").length&&s(),e("#wpsl-start-name").length&&o(),e("#wpsl-lookup-location").on("click",function(e){e.preventDefault(),r()}),e(".wpsl-marker-list input[type=radio]").click(function(){e(this).parents(".wpsl-marker-list").find("li").removeClass(),e(this).parent("li").addClass("wpsl-active-marker")}),e(".wpsl-marker-list li").click(function(){e(this).parents(".wpsl-marker-list").find("input").prop("checked",!1),e(this).find("input").prop("checked",!0),e(this).siblings().removeClass(),e(this).addClass("wpsl-active-marker")}),e(".wpsl-dismiss").click(function(){var s=e(this),t={action:"disable_location_warning",_ajax_nonce:s.attr("data-nonce")};return e.post(ajaxurl,t),e(".wpsl-dismiss").parents(".error").remove(),!1}),e(".wpsl-has-conditional-option").on("change",function(){e(this).parent().next(".wpsl-conditional-option").toggle()}),e("#wpsl-store-template").on("change",function(){var s=e("#wpsl-listing-below-no-scroll");"below_map"==e(this).val()?s.show():s.hide()}),e("#wpsl-api-region").on("change",function(){var s=e("#wpsl-geocode-component");e(this).val()?s.show():s.hide()}),e("#wpsl-editor-hour-input").on("change",function(){e(".wpsl-"+e(this).val()+"-hours").show().siblings("div").hide(),e(".wpsl-hour-notice").toggle()}),e("#wpsl-meta-nav li").on("click",function(s){var t=e(this).attr("class");t=t.split("-tab"),s.stopPropagation(),e(this).addClass("wpsl-active").siblings().removeClass("wpsl-active"),e(".wpsl-store-meta ."+t[0]).show().addClass("wpsl-active").siblings("div").hide().removeClass("wpsl-active")}),e("#wpsl-store-details").length&&e("#publish").click(function(){var s,t,o,l='<div id="message" class="error"><p>'+wpslL10n.requiredFields+"</p></div>",n=!1;return e("#wpbody-content .wrap #message").remove(),e(".wpsl-required").removeClass("wpsl-error"),e(".wpsl-required").each(function(){""==e(this).val()&&(e(this).addClass("wpsl-error"),"undefined"==typeof s&&(s=u(e(this))),n=!0)}),n?(e("#wpbody-content .wrap > h2").after(l),"undefined"!=typeof s.val&&("id"==s.type?(t=e("#"+s.val).parents(".wpsl-tab").attr("class"),e("html, body").scrollTop(Math.round(e("#"+s.val).offset().top-100))):"class"==s.type&&(o=s.val.replace(/wpsl-required|wpsl-error/g,""),t=e("."+o).parents(".wpsl-tab").attr("class"),e("html, body").scrollTop(Math.round(e("."+o).offset().top-100))),t=e.trim(t.replace(/wpsl-tab|wpsl-active/g,""))),w(t?t:"first"),e("#publish").removeClass("button-primary-disabled"),e(".spinner").hide(),!1):!0}),e("#wpsl-store-hours").length&&h(),e(".wpsl-add-period").on("click",function(s){var t,o={},l=!0,n=e(this).parents("tr"),r=f(e(this)),a=r>=1?"wpsl-current-period wpsl-multiple-periods":"wpsl-current-period",i=n.find(".wpsl-opening-hours").attr("data-day"),p=e("#wpsl-settings-form").length?"wpsl_editor[dropdown]":"wpsl[hours]";t='<div class="'+a+'">',t+='<select autocomplete="off" name="'+p+"["+i+'_open][]" class="wpsl-open-hour">'+m(l)+"</select>",t+="<span> - </span>",t+='<select autocomplete="off" name="'+p+"["+i+'_close][]" class="wpsl-close-hour">'+m(l)+"</select>",t+='<div class="wpsl-icon-cancel-circled"></div>',t+="</div>",n.find(".wpsl-store-closed").remove(),e("#wpsl-hours-"+i).append(t).end(),h(),o=24==e("#wpsl-editor-hour-format").val()?{open:"09:00",close:"17:00"}:{open:"9:00 AM",close:"5:00 PM"},n.find(".wpsl-open-hour:last option[value='"+o.open+"']").attr("selected","selected"),n.find(".wpsl-close-hour:last option[value='"+o.close+"']").attr("selected","selected"),s.preventDefault()}),e("#wpsl-editor-hour-format, #wpsl-editor-hour-interval").on("change",function(){m()}),e(".wpsl-info").on("mouseover",function(){e(this).find(".wpsl-info-text").show()}),e(".wpsl-info").on("mouseout",function(){e(this).find(".wpsl-info-text").hide()}),e("#wpsl-latlng").length&&!e("#wpsl-latlng").val()&&e("#wpsl-latlng").siblings("label").find(".wpsl-info").addClass("wpsl-required-setting"),e("#wpsl-map-style").val()&&y(),e("#wpsl-style-preview").on("click",function(){return y(),!1})});
css/styles.css CHANGED
@@ -55,6 +55,7 @@ div elements, we disable it to prevent it from messing up the map
55
  display: inline !important;
56
  opacity: 1 !important;
57
  max-height: none !important;
 
58
  }
59
 
60
  #wpsl-wrap {
55
  display: inline !important;
56
  opacity: 1 !important;
57
  max-height: none !important;
58
+ width: auto !important;
59
  }
60
 
61
  #wpsl-wrap {
css/styles.min.css CHANGED
@@ -1 +1 @@
1
- #wpsl-wrap,.wpsl-gmap-canvas{margin-bottom:20px;width:100%}#wpsl-result-list a,#wpsl-wrap [class*=" wpsl-icon-"]:focus,#wpsl-wrap [class^=wpsl-icon-]:active{outline:0}#wpsl-map-controls div:hover,#wpsl-reset-map:hover,#wpsl-search-btn:hover,.wpsl-dropdown{cursor:pointer}#wpsl-wrap,.wpsl-clearfix:after,.wpsl-contact-details{clear:both}@font-face{font-family:wpsl-fontello;src:url(../font/fontello.eot?28897909);src:url(../font/fontello.eot?28897909#iefix) format('embedded-opentype'),url(../font/fontello.woff?28897909) format('woff'),url(../font/fontello.ttf?28897909) format('truetype'),url(../font/fontello.svg?28897909#fontello) format('svg');font-weight:400;font-style:normal}#wpsl-gmap{float:right;width:66.5%;height:350px;margin-bottom:0}.wpsl-store-below #wpsl-gmap{float:none;width:100%}.wpsl-gmap-canvas{height:300px}.gm-style-mtc,.gmnoprint{z-index:9999!important}#wpsl-gmap div,#wpsl-gmap img,.wpsl-gmap-canvas div,.wpsl-gmap-canvas img{box-shadow:none!important;max-width:none!important;background:0 0}#wpsl-gmap img,.wpsl-gmap-canvas img{display:inline!important;opacity:1!important;max-height:none!important}#wpsl-wrap{position:relative;overflow:hidden}#wpsl-search-wrap{float:left;width:100%}#wpsl-search-wrap form{margin:0;padding:0;border:none;outline:0}#wpsl-gmap #wpsl-map-controls{position:absolute;height:28px;right:10px;bottom:24px;border-radius:2px;z-index:3;font-size:11px;white-space:nowrap;overflow:hidden}#wpsl-gmap #wpsl-map-controls.wpsl-street-view-exists{right:48px}#wpsl-map-controls .wpsl-direction-preloader{margin:5px 5px 0}#wpsl-map-controls div{float:left;background:#fff;border-radius:2px}#wpsl-wrap [class*=" wpsl-icon-"],#wpsl-wrap [class^=wpsl-icon-]{position:relative;float:left;padding:7px 9px 7px 8px;display:inline-block;font-family:wpsl-fontello;font-style:normal;font-weight:400;font-size:1.3em;color:#737373;speak:none;text-decoration:inherit;text-align:center;font-variant:normal;text-transform:none;line-height:1em;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}#wpsl-map-controls span{font-family:inherit;font-size:inherit}#wpsl-wrap .wpsl-ie [class*=" wpsl-icon-"],#wpsl-wrap .wpsl-ie [class^=wpsl-icon-]{padding:9px 8px 4px}#wpsl-wrap.wpsl-mobile [class*=" wpsl-icon-"],#wpsl-wrap.wpsl-mobile [class^=wpsl-icon-]{padding:8px 10px}#wpsl-wrap .wpsl-icon-reset{border-radius:2px 0 0 2px;z-index:2;padding-left:9px;padding-right:4px}#wpsl-wrap .wpsl-icon-direction{z-index:1}#wpsl-map-controls.wpsl-reset-exists .wpsl-icon-direction{border-radius:0 2px 2px 0}#wpsl-wrap .wpsl-active-icon,#wpsl-wrap [class*=" wpsl-icon-"]:hover,#wpsl-wrap [class^=wpsl-icon-]:hover{color:#000}#wpsl-wrap .wpsl-in-progress,#wpsl-wrap .wpsl-in-progress:hover{color:#c6c6c6}#wpsl-gmap #wpsl-reset-map{position:absolute;display:none;right:37px;top:37px;padding:6px 14px;background:#fff!important;background-clip:padding-box;border:1px solid rgba(0,0,0,.15);border-radius:2px;z-index:3}.gm-style-cc{word-wrap:normal}#wpsl-search-wrap .wpsl-input,#wpsl-search-wrap .wpsl-select-wrap{display:table}#wpsl-search-btn,#wpsl-search-wrap #wpsl-radius,#wpsl-search-wrap #wpsl-results,#wpsl-search-wrap .wpsl-input input,#wpsl-search-wrap .wpsl-input label{display:table-cell}#wpsl-search-wrap label{margin-bottom:0}#wpsl-search-input{width:179px;height:auto;padding:7px 12px;font-size:100%;margin:0}#wpsl-search-btn,#wpsl-search-wrap input{border:1px solid #d2d2d2;border-radius:3px}#wpsl-search-btn{padding:7px 10px;line-height:1.428571429;font-weight:400;color:#7c7c7c;background-color:#e6e6e6;background-repeat:repeat-x;background-image:-moz-linear-gradient(top,#f4f4f4,#e6e6e6);background-image:-ms-linear-gradient(top,#f4f4f4,#e6e6e6);background-image:-webkit-linear-gradient(top,#f4f4f4,#e6e6e6);background-image:-o-linear-gradient(top,#f4f4f4,#e6e6e6);background-image:linear-gradient(top,#f4f4f4,#e6e6e6);box-shadow:0 1px 2px rgba(64,64,64,.1);text-transform:none!important}#wpsl-search-input.wpsl-error{border:1px solid #bd0028!important}.wpsl-search{margin-bottom:12px;padding:12px 12px 0;background:#f4f3f3}.wpsl-search.wpsl-checkboxes-enabled{padding:12px}.wpsl-back{display:inline-block}#wpsl-result-list{width:33%;margin-right:.5%}.wpsl-store-below #wpsl-result-list{width:100%;margin:12px 0 0}#wpsl-direction-details,#wpsl-stores{height:350px;overflow-y:auto}#wpsl-direction-details,.wpsl-hide{display:none}#wpsl-result-list p{padding-left:10px}.wpsl-store-below #wpsl-result-list p{padding-left:0}.wpsl-direction-before{margin:14px 0 21px;padding-left:10px}.wpsl-store-below .wpsl-direction-before{padding-left:0}.wpsl-direction-before div{margin-top:10px}#wpsl-wrap #wpsl-result-list li{padding:10px;border-bottom:1px dotted #ccc;margin-left:0;overflow:hidden;list-style:none!important;text-indent:0}#wpsl-wrap #wpsl-result-list li li{padding:0;border-bottom:0;margin-left:14px;overflow:visible}#wpsl-wrap #wpsl-result-list ul li{list-style:disc!important}#wpsl-wrap #wpsl-result-list ol li{list-style:decimal!important}#wpsl-wrap.wpsl-store-below #wpsl-result-list li{padding:10px 10px 10px 0}#wpsl-result-list li p{padding-left:0;margin:0 0 20px}.wpsl-store-details.wpsl-store-listing{position:relative;padding-right:20px}.wpsl-store-details.wpsl-store-listing.wpsl-active-details:before,.wpsl-store-details.wpsl-store-listing:before{position:absolute;content:'';bottom:6px;right:0;border-top:5px solid #000;border-left:6px solid transparent;border-right:6px solid transparent}.wpsl-store-details.wpsl-store-listing.wpsl-active-details:before{border-bottom:5px solid #000;border-top:none;border-left:6px solid transparent;border-right:6px solid transparent}#wpsl-stores .wpsl-store-thumb{float:right;border-radius:3px;margin:7px 0 0 10px;padding:0;border:none}.wpsl-direction-index{float:left;width:8%;margin:0 5% 0 0}.wpsl-direction-txt{float:left;width:62%}.wpsl-direction-distance{float:left;width:20%;margin:0 0 0 5%}.wpsl-direction-txt span{display:block;margin-top:10px}.wpsl-country,.wpsl-directions,.wpsl-street{display:block;border-bottom:none!important}#wpsl-wrap #wpsl-result-list li.wpsl-preloader{position:relative;border-bottom:none;padding:10px 10px 10px 35px}.wpsl-preloader img{position:absolute;left:10px;top:50%;margin-top:-8px;box-shadow:none!important;border:none!important}.wpsl-preloader span{float:left;margin:-5px 0 0 11px}#wpsl-search-btn,#wpsl-search-wrap div{margin-right:10px;float:left}#wpsl-search-wrap .wpsl-select-wrap{position:relative;z-index:2;margin-right:0}#wpsl-search-wrap .wpsl-input-field{position:relative}#wpsl-radius,#wpsl-results{float:left;margin-right:15px;display:inline}#wpsl-category{z-index:1;clear:both}#wpsl-search-wrap .wpsl-dropdown div{position:absolute;float:none;margin:-1px 0 0;top:100%;left:-1px;right:-1px;border:1px solid #ccc;background:#fff;border-top:1px solid #eee;border-radius:0 0 3px 3px;opacity:0;overflow:hidden;-webkit-transition:all 150ms ease-in-out;-moz-transition:all 150ms ease-in-out;-ms-transition:all 150ms ease-in-out;transition:all 150ms ease-in-out}#wpsl-search-wrap .wpsl-dropdown.wpsl-active div{opacity:1}#wpsl-search-wrap .wpsl-input label{margin-right:0}#wpsl-radius{margin-right:10px}#wpsl-search select,#wpsl-search-wrap select,.wpsl-direction-details{display:none}#wpsl-search-wrap div label{float:left;margin-right:10px;line-height:32px}#wpsl-results label{width:auto}#wpsl-result-list ul{list-style:none;margin:0;padding:0}#wpsl-gmap .wpsl-info-window,.wpsl-gmap-canvas .wpsl-info-window{max-width:225px}.wpsl-info-window span,.wpsl-more-info-listings span{display:block}.wpsl-info-window .wpsl-no-margin{margin:0}.wpsl-more-info-listings{display:none}.wpsl-info-window span span{display:inline!important}#wpsl-wrap .wpsl-info-window p{margin:0 0 10px}.wpsl-store-hours{margin-top:10px}.wpsl-store-hours strong{display:block}#wpsl-gmap .wpsl-info-actions{display:block;margin:10px 0!important}.wpsl-info-actions a{float:left;margin-right:7px}.wpsl-info-actions .wpsl-zoom-here{margin-right:0}.wpsl-dropdown{position:relative;width:90px;border:1px solid #ccc;background:#fff;border-radius:3px;-webkit-user-select:none;-moz-user-select:none;user-select:none;margin-right:0!important;z-index:2}#wpsl-results .wpsl-dropdown{width:70px}.wpsl-dropdown ul{position:absolute;left:0;width:100%;height:100%;padding:0!important;margin:0!important;list-style:none;overflow:hidden}.wpsl-dropdown:hover{box-shadow:0 0 5px rgba(0,0,0,.15)}.wpsl-dropdown .wpsl-selected-item,.wpsl-dropdown li{position:relative;display:block;line-height:normal;color:#000;overflow:hidden}#wpsl-radius .wpsl-dropdown .wpsl-selected-item,#wpsl-radius .wpsl-dropdown li,#wpsl-results .wpsl-dropdown .wpsl-selected-item,#wpsl-results .wpsl-dropdown li{white-space:nowrap}.wpsl-selected-item:after{position:absolute;content:"";right:12px;top:50%;margin-top:-4px;border:6px solid transparent;border-top:8px solid #000}.wpsl-active .wpsl-selected-item:after{margin-top:-10px;border:6px solid transparent;border-bottom:8px solid #000}.wpsl-dropdown li:hover{background:#f8f9f8;position:relative;z-index:3;color:#000}.wpsl-dropdown .wpsl-selected-item,.wpsl-dropdown li,.wpsl-selected-item{list-style:none;padding:9px 12px!important;margin:0!important}.wpsl-selected-dropdown{font-weight:700}.wpsl-clearfix:after,.wpsl-clearfix:before{content:" ";display:table}#wpsl-wrap .wpsl-selected-item{position:static;padding-right:35px!important}#wpsl-category,.wpsl-input,.wpsl-select-wrap{position:relative;margin-bottom:10px}#wpsl-search-wrap .wpsl-scroll-required div{overflow-y:scroll}.wpsl-scroll-required ul{overflow:visible}.wpsl-provided-by{float:right;padding:5px 0;text-align:right;font-size:12px;width:100%}#wpsl-wrap .wpsl-results-only label{width:auto}.wpsl-contact-details,.wpsl-location-address,.wpsl-locations-details{margin-bottom:15px}table.wpsl-opening-hours td{vertical-align:top;padding:0 15px 0 0;text-align:left}table.wpsl-opening-hours time{display:block}table.wpsl-opening-hours{width:auto!important;font-size:100%!important}table.wpsl-opening-hours,table.wpsl-opening-hours td{border:none!important}.wpsl-gmap-canvas .wpsl-infobox{min-width:155px;max-width:350px!important;padding:10px;border-radius:4px;font-size:13px;font-weight:300;border:1px solid #ccc;background:#fff!important}.wpsl-gmap-canvas .wpsl-infobox:after,.wpsl-gmap-canvas .wpsl-infobox:before{position:absolute;content:"";left:40px;bottom:-11px}.wpsl-gmap-canvas .wpsl-infobox:after{border-left:11px solid transparent;border-right:11px solid transparent;border-top:11px solid #fff}.wpsl-gmap-canvas .wpsl-infobox:before{border-left:13px solid transparent;border-right:13px solid transparent;border-top:13px solid #ccc;bottom:-13px;left:38px}#wpsl-checkbox-filter{display:block;float:left;margin:5px 0 15px;padding:0;width:100%}#wpsl-checkbox-filter li{float:left;list-style:none;margin:0 1% 0 0}#wpsl-checkbox-filter.wpsl-checkbox-1-columns li{width:99%}#wpsl-checkbox-filter.wpsl-checkbox-2-columns li{width:49%}#wpsl-checkbox-filter.wpsl-checkbox-3-columns li{width:32%}#wpsl-checkbox-filter.wpsl-checkbox-4-columns li{width:24%}#wpsl-checkbox-filter input{margin-right:5px}#wpsl-result-list .wpsl-contact-details span{display:block!important}@media (max-width:825px){#wpsl-search-input{width:348px}.wpsl-results-only #wpsl-search-wrap .wpsl-dropdown{width:70px}#wpsl-search-wrap .wpsl-input{width:100%;margin-bottom:10px}#wpsl-category label,#wpsl-radius label,.wpsl-cat-results-filter #wpsl-search-wrap .wpsl-input,.wpsl-input label,.wpsl-no-filters #wpsl-search-wrap .wpsl-input,.wpsl-results-only #wpsl-search-wrap .wpsl-input{width:auto}}@media (max-width:720px){#wpsl-search-wrap .wpsl-dropdown{width:114px}}@media (max-width:675px){#wpsl-search-wrap #wpsl-search-btn{float:left;margin:0 5px 0 0}.wpsl-dropdown,.wpsl-results-only #wpsl-search-wrap .wpsl-input{width:100%}.wpsl-search{padding:2%}#wpsl-result-list p,#wpsl-wrap #wpsl-result-list li,.wpsl-direction-before{padding-left:0}.wpsl-input{margin-right:0}#wpsl-gmap,#wpsl-result-list{float:none;width:100%}#wpsl-gmap{margin-bottom:15px;margin-top:10px}#wpsl-result-list,.wpsl-cat-results-filter .wpsl-select-wrap,.wpsl-filter .wpsl-select-wrap{margin-bottom:10px}#wpsl-wrap #wpsl-result-list li.wpsl-preloader{padding-left:25px}.wpsl-preloader img{left:0}#wpsl-stores.wpsl-not-loaded{height:25px}#wpsl-reset-map{top:25px}#wpsl-category,#wpsl-search-btn,.wpsl-input,.wpsl-no-filters #wpsl-search-wrap .wpsl-input,.wpsl-select-wrap{margin-bottom:0}#wpsl-stores.wpsl-no-autoload{height:auto!important}#wpsl-checkbox-filter.wpsl-checkbox-3-columns li,#wpsl-checkbox-filter.wpsl-checkbox-4-columns li{width:49%}}@media (max-width:570px){#wpsl-search-wrap #wpsl-search-btn{margin-bottom:5px}.wpsl-search{padding:4%}#wpsl-search-input{width:98%!important}.wpsl-cat-results-filter #wpsl-search-input,.wpsl-cat-results-filter #wpsl-search-wrap .wpsl-input,.wpsl-no-results #wpsl-search-input,.wpsl-results-only #wpsl-search-input{width:100%!important}.wpsl-search-btn-wrap{margin-top:15px;clear:both}.wpsl-checkboxes-enabled .wpsl-search-btn-wrap{margin-top:0}#wpsl-search-btn,#wpsl-search-wrap div{margin-right:0}#wpsl-search-wrap div label{display:block;width:100%}.wpsl-select-wrap{width:100%}#wpsl-radius,#wpsl-results{width:50%}#wpsl-radius{margin-right:4%}#wpsl-search-wrap .wpsl-dropdown{width:96%!important}.wpsl-no-filters #wpsl-search-input,.wpsl-no-filters #wpsl-search-wrap .wpsl-input{width:100%!important}}@media (max-width:420px){#wpsl-checkbox-filter li{margin:0}#wpsl-checkbox-filter.wpsl-checkbox-1-columns li,#wpsl-checkbox-filter.wpsl-checkbox-2-columns li,#wpsl-checkbox-filter.wpsl-checkbox-3-columns li,#wpsl-checkbox-filter.wpsl-checkbox-4-columns li{width:100%}}
1
+ #wpsl-result-list a,#wpsl-wrap [class*=" wpsl-icon-"]:focus,#wpsl-wrap [class^=wpsl-icon-]:active{outline:0}#wpsl-map-controls div:hover,#wpsl-reset-map:hover,#wpsl-search-btn:hover,.wpsl-dropdown{cursor:pointer}#wpsl-wrap,.wpsl-clearfix:after,.wpsl-contact-details{clear:both}@font-face{font-family:wpsl-fontello;src:url(../font/fontello.eot?28897909);src:url(../font/fontello.eot?28897909#iefix) format('embedded-opentype'),url(../font/fontello.woff?28897909) format('woff'),url(../font/fontello.ttf?28897909) format('truetype'),url(../font/fontello.svg?28897909#fontello) format('svg');font-weight:400;font-style:normal}#wpsl-gmap{float:right;width:66.5%;height:350px;margin-bottom:0}.wpsl-store-below #wpsl-gmap{float:none;width:100%}.wpsl-gmap-canvas{width:100%;height:300px;margin-bottom:20px}.gm-style-mtc,.gmnoprint{z-index:9999!important}#wpsl-gmap div,#wpsl-gmap img,.wpsl-gmap-canvas div,.wpsl-gmap-canvas img{box-shadow:none!important;max-width:none!important;background:0 0}#wpsl-gmap img,.wpsl-gmap-canvas img{display:inline!important;opacity:1!important;max-height:none!important;width:auto!important}#wpsl-wrap{position:relative;width:100%;overflow:hidden;margin-bottom:20px}#wpsl-search-wrap{float:left;width:100%}#wpsl-search-wrap form{margin:0;padding:0;border:none;outline:0}#wpsl-gmap #wpsl-map-controls{position:absolute;height:28px;right:10px;bottom:24px;border-radius:2px;z-index:3;font-size:11px;white-space:nowrap;overflow:hidden}#wpsl-gmap #wpsl-map-controls.wpsl-street-view-exists{right:48px}#wpsl-map-controls .wpsl-direction-preloader{margin:5px 5px 0}#wpsl-map-controls div{float:left;background:#fff;border-radius:2px}#wpsl-wrap [class*=" wpsl-icon-"],#wpsl-wrap [class^=wpsl-icon-]{position:relative;float:left;padding:7px 9px 7px 8px;display:inline-block;font-family:wpsl-fontello;font-style:normal;font-weight:400;font-size:1.3em;color:#737373;speak:none;text-decoration:inherit;text-align:center;font-variant:normal;text-transform:none;line-height:1em;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}#wpsl-map-controls span{font-family:inherit;font-size:inherit}#wpsl-wrap .wpsl-ie [class*=" wpsl-icon-"],#wpsl-wrap .wpsl-ie [class^=wpsl-icon-]{padding:9px 8px 4px}#wpsl-wrap.wpsl-mobile [class*=" wpsl-icon-"],#wpsl-wrap.wpsl-mobile [class^=wpsl-icon-]{padding:8px 10px}#wpsl-wrap .wpsl-icon-reset{border-radius:2px 0 0 2px;z-index:2;padding-left:9px;padding-right:4px}#wpsl-wrap .wpsl-icon-direction{z-index:1}#wpsl-map-controls.wpsl-reset-exists .wpsl-icon-direction{border-radius:0 2px 2px 0}#wpsl-wrap .wpsl-active-icon,#wpsl-wrap [class*=" wpsl-icon-"]:hover,#wpsl-wrap [class^=wpsl-icon-]:hover{color:#000}#wpsl-wrap .wpsl-in-progress,#wpsl-wrap .wpsl-in-progress:hover{color:#c6c6c6}#wpsl-gmap #wpsl-reset-map{position:absolute;display:none;right:37px;top:37px;padding:6px 14px;background:#fff!important;background-clip:padding-box;border:1px solid rgba(0,0,0,.15);border-radius:2px;z-index:3}.gm-style-cc{word-wrap:normal}#wpsl-search-wrap .wpsl-input,#wpsl-search-wrap .wpsl-select-wrap{display:table}#wpsl-search-btn,#wpsl-search-wrap #wpsl-radius,#wpsl-search-wrap #wpsl-results,#wpsl-search-wrap .wpsl-input input,#wpsl-search-wrap .wpsl-input label{display:table-cell}#wpsl-search-wrap label{margin-bottom:0}#wpsl-search-input{width:179px;height:auto;padding:7px 12px;font-size:100%;margin:0}#wpsl-search-btn,#wpsl-search-wrap input{border:1px solid #d2d2d2;border-radius:3px}#wpsl-search-btn{padding:7px 10px;line-height:1.428571429;font-weight:400;color:#7c7c7c;background-color:#e6e6e6;background-repeat:repeat-x;background-image:-moz-linear-gradient(top,#f4f4f4,#e6e6e6);background-image:-ms-linear-gradient(top,#f4f4f4,#e6e6e6);background-image:-webkit-linear-gradient(top,#f4f4f4,#e6e6e6);background-image:-o-linear-gradient(top,#f4f4f4,#e6e6e6);background-image:linear-gradient(top,#f4f4f4,#e6e6e6);box-shadow:0 1px 2px rgba(64,64,64,.1);text-transform:none!important}#wpsl-search-input.wpsl-error{border:1px solid #bd0028!important}.wpsl-search{margin-bottom:12px;padding:12px 12px 0;background:#f4f3f3}.wpsl-search.wpsl-checkboxes-enabled{padding:12px}.wpsl-back{display:inline-block}#wpsl-result-list{width:33%;margin-right:.5%}.wpsl-store-below #wpsl-result-list{width:100%;margin:12px 0 0}#wpsl-direction-details,#wpsl-stores{height:350px;overflow-y:auto}#wpsl-direction-details,.wpsl-hide{display:none}#wpsl-result-list p{padding-left:10px}.wpsl-store-below #wpsl-result-list p{padding-left:0}.wpsl-direction-before{margin:14px 0 21px;padding-left:10px}.wpsl-store-below .wpsl-direction-before{padding-left:0}.wpsl-direction-before div{margin-top:10px}#wpsl-wrap #wpsl-result-list li{padding:10px;border-bottom:1px dotted #ccc;margin-left:0;overflow:hidden;list-style:none!important;text-indent:0}#wpsl-wrap #wpsl-result-list li li{padding:0;border-bottom:0;margin-left:14px;overflow:visible}#wpsl-wrap #wpsl-result-list ul li{list-style:disc!important}#wpsl-wrap #wpsl-result-list ol li{list-style:decimal!important}#wpsl-wrap.wpsl-store-below #wpsl-result-list li{padding:10px 10px 10px 0}#wpsl-result-list li p{padding-left:0;margin:0 0 20px}.wpsl-store-details.wpsl-store-listing{position:relative;padding-right:20px}.wpsl-store-details.wpsl-store-listing.wpsl-active-details:before,.wpsl-store-details.wpsl-store-listing:before{position:absolute;content:'';bottom:6px;right:0;border-top:5px solid #000;border-left:6px solid transparent;border-right:6px solid transparent}.wpsl-store-details.wpsl-store-listing.wpsl-active-details:before{border-bottom:5px solid #000;border-top:none;border-left:6px solid transparent;border-right:6px solid transparent}#wpsl-stores .wpsl-store-thumb{float:right;border-radius:3px;margin:7px 0 0 10px;padding:0;border:none}.wpsl-direction-index{float:left;width:8%;margin:0 5% 0 0}.wpsl-direction-txt{float:left;width:62%}.wpsl-direction-distance{float:left;width:20%;margin:0 0 0 5%}.wpsl-direction-txt span{display:block;margin-top:10px}.wpsl-country,.wpsl-directions,.wpsl-street{display:block;border-bottom:none!important}#wpsl-wrap #wpsl-result-list li.wpsl-preloader{position:relative;border-bottom:none;padding:10px 10px 10px 35px}.wpsl-preloader img{position:absolute;left:10px;top:50%;margin-top:-8px;box-shadow:none!important;border:none!important}.wpsl-preloader span{float:left;margin:-5px 0 0 11px}#wpsl-search-btn,#wpsl-search-wrap div{margin-right:10px;float:left}#wpsl-search-wrap .wpsl-select-wrap{position:relative;z-index:2;margin-right:0}#wpsl-search-wrap .wpsl-input-field{position:relative}#wpsl-radius,#wpsl-results{float:left;margin-right:15px;display:inline}#wpsl-category{z-index:1;clear:both}#wpsl-search-wrap .wpsl-dropdown div{position:absolute;float:none;margin:-1px 0 0;top:100%;left:-1px;right:-1px;border:1px solid #ccc;background:#fff;border-top:1px solid #eee;border-radius:0 0 3px 3px;opacity:0;overflow:hidden;-webkit-transition:all 150ms ease-in-out;-moz-transition:all 150ms ease-in-out;-ms-transition:all 150ms ease-in-out;transition:all 150ms ease-in-out}#wpsl-search-wrap .wpsl-dropdown.wpsl-active div{opacity:1}#wpsl-search-wrap .wpsl-input label{margin-right:0}#wpsl-radius{margin-right:10px}#wpsl-search select,#wpsl-search-wrap select,.wpsl-direction-details{display:none}#wpsl-search-wrap div label{float:left;margin-right:10px;line-height:32px}#wpsl-results label{width:auto}#wpsl-result-list ul{list-style:none;margin:0;padding:0}#wpsl-gmap .wpsl-info-window,.wpsl-gmap-canvas .wpsl-info-window{max-width:225px}.wpsl-info-window span,.wpsl-more-info-listings span{display:block}.wpsl-info-window .wpsl-no-margin{margin:0}.wpsl-more-info-listings{display:none}.wpsl-info-window span span{display:inline!important}#wpsl-wrap .wpsl-info-window p{margin:0 0 10px}.wpsl-store-hours{margin-top:10px}.wpsl-store-hours strong{display:block}#wpsl-gmap .wpsl-info-actions{display:block;margin:10px 0!important}.wpsl-info-actions a{float:left;margin-right:7px}.wpsl-info-actions .wpsl-zoom-here{margin-right:0}.wpsl-dropdown{position:relative;width:90px;border:1px solid #ccc;background:#fff;border-radius:3px;-webkit-user-select:none;-moz-user-select:none;user-select:none;margin-right:0!important;z-index:2}#wpsl-results .wpsl-dropdown{width:70px}.wpsl-dropdown ul{position:absolute;left:0;width:100%;height:100%;padding:0!important;margin:0!important;list-style:none;overflow:hidden}.wpsl-dropdown:hover{box-shadow:0 0 5px rgba(0,0,0,.15)}.wpsl-dropdown .wpsl-selected-item,.wpsl-dropdown li{position:relative;display:block;line-height:normal;color:#000;overflow:hidden}#wpsl-radius .wpsl-dropdown .wpsl-selected-item,#wpsl-radius .wpsl-dropdown li,#wpsl-results .wpsl-dropdown .wpsl-selected-item,#wpsl-results .wpsl-dropdown li{white-space:nowrap}.wpsl-selected-item:after{position:absolute;content:"";right:12px;top:50%;margin-top:-4px;border:6px solid transparent;border-top:8px solid #000}.wpsl-active .wpsl-selected-item:after{margin-top:-10px;border:6px solid transparent;border-bottom:8px solid #000}.wpsl-dropdown li:hover{background:#f8f9f8;position:relative;z-index:3;color:#000}.wpsl-dropdown .wpsl-selected-item,.wpsl-dropdown li,.wpsl-selected-item{list-style:none;padding:9px 12px!important;margin:0!important}.wpsl-selected-dropdown{font-weight:700}.wpsl-clearfix:after,.wpsl-clearfix:before{content:" ";display:table}#wpsl-wrap .wpsl-selected-item{position:static;padding-right:35px!important}#wpsl-category,.wpsl-input,.wpsl-select-wrap{position:relative;margin-bottom:10px}#wpsl-search-wrap .wpsl-scroll-required div{overflow-y:scroll}.wpsl-scroll-required ul{overflow:visible}.wpsl-provided-by{float:right;padding:5px 0;text-align:right;font-size:12px;width:100%}#wpsl-wrap .wpsl-results-only label{width:auto}.wpsl-contact-details,.wpsl-location-address,.wpsl-locations-details{margin-bottom:15px}table.wpsl-opening-hours td{vertical-align:top;padding:0 15px 0 0;text-align:left}table.wpsl-opening-hours time{display:block}table.wpsl-opening-hours{width:auto!important;font-size:100%!important}table.wpsl-opening-hours,table.wpsl-opening-hours td{border:none!important}.wpsl-gmap-canvas .wpsl-infobox{min-width:155px;max-width:350px!important;padding:10px;border-radius:4px;font-size:13px;font-weight:300;border:1px solid #ccc;background:#fff!important}.wpsl-gmap-canvas .wpsl-infobox:after,.wpsl-gmap-canvas .wpsl-infobox:before{position:absolute;content:"";left:40px;bottom:-11px}.wpsl-gmap-canvas .wpsl-infobox:after{border-left:11px solid transparent;border-right:11px solid transparent;border-top:11px solid #fff}.wpsl-gmap-canvas .wpsl-infobox:before{border-left:13px solid transparent;border-right:13px solid transparent;border-top:13px solid #ccc;bottom:-13px;left:38px}#wpsl-checkbox-filter{display:block;float:left;margin:5px 0 15px;padding:0;width:100%}#wpsl-checkbox-filter li{float:left;list-style:none;margin:0 1% 0 0}#wpsl-checkbox-filter.wpsl-checkbox-1-columns li{width:99%}#wpsl-checkbox-filter.wpsl-checkbox-2-columns li{width:49%}#wpsl-checkbox-filter.wpsl-checkbox-3-columns li{width:32%}#wpsl-checkbox-filter.wpsl-checkbox-4-columns li{width:24%}#wpsl-checkbox-filter input{margin-right:5px}#wpsl-result-list .wpsl-contact-details span{display:block!important}@media (max-width:825px){#wpsl-search-input{width:348px}.wpsl-results-only #wpsl-search-wrap .wpsl-dropdown{width:70px}#wpsl-search-wrap .wpsl-input{width:100%;margin-bottom:10px}#wpsl-category label,#wpsl-radius label,.wpsl-cat-results-filter #wpsl-search-wrap .wpsl-input,.wpsl-input label,.wpsl-no-filters #wpsl-search-wrap .wpsl-input,.wpsl-results-only #wpsl-search-wrap .wpsl-input{width:auto}}@media (max-width:720px){#wpsl-search-wrap .wpsl-dropdown{width:114px}}@media (max-width:675px){#wpsl-search-wrap #wpsl-search-btn{float:left;margin:0 5px 0 0}.wpsl-dropdown,.wpsl-results-only #wpsl-search-wrap .wpsl-input{width:100%}.wpsl-search{padding:2%}#wpsl-result-list p,#wpsl-wrap #wpsl-result-list li,.wpsl-direction-before{padding-left:0}.wpsl-input{margin-right:0}#wpsl-gmap,#wpsl-result-list{float:none;width:100%}#wpsl-gmap{margin-bottom:15px;margin-top:10px}#wpsl-result-list,.wpsl-cat-results-filter .wpsl-select-wrap,.wpsl-filter .wpsl-select-wrap{margin-bottom:10px}#wpsl-wrap #wpsl-result-list li.wpsl-preloader{padding-left:25px}.wpsl-preloader img{left:0}#wpsl-stores.wpsl-not-loaded{height:25px}#wpsl-reset-map{top:25px}#wpsl-category,#wpsl-search-btn,.wpsl-input,.wpsl-no-filters #wpsl-search-wrap .wpsl-input,.wpsl-select-wrap{margin-bottom:0}#wpsl-stores.wpsl-no-autoload{height:auto!important}#wpsl-checkbox-filter.wpsl-checkbox-3-columns li,#wpsl-checkbox-filter.wpsl-checkbox-4-columns li{width:49%}}@media (max-width:570px){#wpsl-search-wrap #wpsl-search-btn{margin-bottom:5px}.wpsl-search{padding:4%}#wpsl-search-input{width:98%!important}.wpsl-cat-results-filter #wpsl-search-input,.wpsl-cat-results-filter #wpsl-search-wrap .wpsl-input,.wpsl-no-results #wpsl-search-input,.wpsl-results-only #wpsl-search-input{width:100%!important}.wpsl-search-btn-wrap{margin-top:15px;clear:both}.wpsl-checkboxes-enabled .wpsl-search-btn-wrap{margin-top:0}#wpsl-search-btn,#wpsl-search-wrap div{margin-right:0}#wpsl-search-wrap div label{display:block;width:100%}.wpsl-select-wrap{width:100%}#wpsl-radius,#wpsl-results{width:50%}#wpsl-radius{margin-right:4%}#wpsl-search-wrap .wpsl-dropdown{width:96%!important}.wpsl-no-filters #wpsl-search-input,.wpsl-no-filters #wpsl-search-wrap .wpsl-input{width:100%!important}}@media (max-width:420px){#wpsl-checkbox-filter li{margin:0}#wpsl-checkbox-filter.wpsl-checkbox-1-columns li,#wpsl-checkbox-filter.wpsl-checkbox-2-columns li,#wpsl-checkbox-filter.wpsl-checkbox-3-columns li,#wpsl-checkbox-filter.wpsl-checkbox-4-columns li{width:100%}}
frontend/class-frontend.php CHANGED
@@ -1382,9 +1382,9 @@ if ( !class_exists( 'WPSL_Frontend' ) ) {
1382
  // Strip out the default values that are wrapped in [].
1383
  foreach ( $required_defaults as $required_default ) {
1384
  preg_match_all( '/\[([0-9]+?)\]/', $wpsl_settings[$required_default], $match, PREG_PATTERN_ORDER );
1385
- $output[$required_default] = $match[1][0];
1386
  }
1387
-
1388
  return $output;
1389
  }
1390
 
1382
  // Strip out the default values that are wrapped in [].
1383
  foreach ( $required_defaults as $required_default ) {
1384
  preg_match_all( '/\[([0-9]+?)\]/', $wpsl_settings[$required_default], $match, PREG_PATTERN_ORDER );
1385
+ $output[$required_default] = ( isset( $match[1][0] ) ) ? $match[1][0] : '25';
1386
  }
1387
+
1388
  return $output;
1389
  }
1390
 
js/wpsl-gmap.js CHANGED
@@ -54,12 +54,14 @@ if ( $( ".wpsl-gmap-canvas" ).length ) {
54
  * @returns {void}
55
  */
56
  function initializeGmap( mapId, mapIndex ) {
57
- var mapOptions, settings, infoWindow, latLng, bounds, mapData, locationCount,
58
- maxZoom = Number( wpslSettings.autoZoomLevel );
59
 
60
- // Get the settings that belong to the map.
61
  settings = getMapSettings( mapIndex );
62
 
 
 
63
  // Create a new infoWindow, either with the infobox libray or use the default one.
64
  infoWindow = newInfoWindow();
65
 
@@ -93,8 +95,7 @@ function initializeGmap( mapId, mapIndex ) {
93
 
94
  if ( ( typeof window[ "wpslMap_" + mapIndex ] !== "undefined" ) && ( typeof window[ "wpslMap_" + mapIndex ].locations !== "undefined" ) ) {
95
  bounds = new google.maps.LatLngBounds(),
96
- mapData = window[ "wpslMap_" + mapIndex ].locations,
97
- locationCount = mapData.length;
98
 
99
  // Loop over the map data, create the infowindow object and add each marker.
100
  $.each( mapData, function( index ) {
54
  * @returns {void}
55
  */
56
  function initializeGmap( mapId, mapIndex ) {
57
+ var mapOptions, settings, infoWindow, latLng,
58
+ bounds, mapData, maxZoom;
59
 
60
+ // Get the settings that belongs to the current map.
61
  settings = getMapSettings( mapIndex );
62
 
63
+ maxZoom = Number( settings.zoomLevel );
64
+
65
  // Create a new infoWindow, either with the infobox libray or use the default one.
66
  infoWindow = newInfoWindow();
67
 
95
 
96
  if ( ( typeof window[ "wpslMap_" + mapIndex ] !== "undefined" ) && ( typeof window[ "wpslMap_" + mapIndex ].locations !== "undefined" ) ) {
97
  bounds = new google.maps.LatLngBounds(),
98
+ mapData = window[ "wpslMap_" + mapIndex ].locations;
 
99
 
100
  // Loop over the map data, create the infowindow object and add each marker.
101
  $.each( mapData, function( index ) {
js/wpsl-gmap.min.js CHANGED
@@ -1 +1 @@
1
- jQuery(document).ready(function(e){function t(t,l){var d,u,f,h,S,b,y,L=Number(wpslSettings.autoZoomLevel);u=n(l),f=i(),X=new google.maps.Geocoder,te=new google.maps.DirectionsRenderer,se=new google.maps.DirectionsService,d={zoom:Number(u.zoomLevel),center:u.startLatLng,mapTypeId:google.maps.MapTypeId[u.mapType.toUpperCase()],mapTypeControl:Number(u.mapTypeControl)?!0:!1,scrollwheel:Number(u.scrollWheel)?!0:!1,streetViewControl:Number(u.streetView)?!0:!1,zoomControlOptions:{position:google.maps.ControlPosition[u.controlPosition.toUpperCase()+"_TOP"]}},we=r(),ee=new google.maps.Map(document.getElementById(t),d),a(ee),p(u.mapStyle),"undefined"!=typeof window["wpslMap_"+l]&&"undefined"!=typeof window["wpslMap_"+l].locations&&(S=new google.maps.LatLngBounds,b=window["wpslMap_"+l].locations,y=b.length,e.each(b,function(e){h=new google.maps.LatLng(b[e].lat,b[e].lng),B(h,b[e].id,b[e],!1,f),S.extend(h)}),ee.fitBounds(S),google.maps.event.addListenerOnce(ee,"bounds_changed",function(e){return function(){e.getZoom()>L&&e.setZoom(L)}}(ee))),e("#wpsl-gmap").length&&(1==wpslSettings.autoComplete&&s(),!w()&&e(".wpsl-dropdown").length&&1==wpslSettings.enableStyledDropdowns?Q():(e("#wpsl-search-wrap select").show(),w()?e("#wpsl-wrap").addClass("wpsl-mobile"):e("#wpsl-wrap").addClass("wpsl-default-filters")),e(".wpsl-search").hasClass("wpsl-widget")||(1==wpslSettings.autoLocate?g(u.startLatLng,f):1==wpslSettings.autoLoad&&c(u.startLatLng,f)),1!=wpslSettings.mouseFocus||w()||e("#wpsl-search-input").focus(),m(f),v(u,ee,f),J()),o()}function s(){var t,s,o,n={};"undefined"==typeof wpslSettings.geocodeComponents||e.isEmptyObject(wpslSettings.geocodeComponents)||(n.componentRestrictions=wpslSettings.geocodeComponents),t=document.getElementById("wpsl-search-input"),s=new google.maps.places.Autocomplete(t,n),s.addListener("place_changed",function(){o=s.getPlace(),o.geometry&&(ne=o.geometry.location)})}function o(){"undefined"!=typeof wpslSettings.markerZoomTo&&1==wpslSettings.markerZoomTo&&google.maps.event.addListener(ee,"zoom_changed",function(){A()})}function n(e){var t,s,o,n=["zoomLevel","mapType","mapTypeControl","mapStyle","streetView","scrollWheel","controlPosition"],i={zoomLevel:wpslSettings.zoomLevel,mapType:wpslSettings.mapType,mapTypeControl:wpslSettings.mapTypeControl,mapStyle:wpslSettings.mapStyle,streetView:wpslSettings.streetView,scrollWheel:wpslSettings.scrollWheel,controlPosition:wpslSettings.controlPosition};if("undefined"!=typeof window["wpslMap_"+e]&&"undefined"!=typeof window["wpslMap_"+e].shortCode)for(t=0,s=n.length;s>t;t++)o=window["wpslMap_"+e].shortCode[n[t]],"undefined"!=typeof o&&(i[n[t]]=o);return i.startLatLng=l(e),i}function l(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.startLatlng?(s=wpslSettings.startLatlng.split(","),t=new google.maps.LatLng(s[0],s[1])):t=new google.maps.LatLng(0,0),t}function i(){var e,t,s={};return"undefined"!=typeof wpslSettings.infoWindowStyle&&"infobox"==wpslSettings.infoWindowStyle?(e=wpslSettings.infoBoxClearance.split(","),t=wpslSettings.infoBoxPixelOffset.split(","),s={alignBottom:!0,boxClass:wpslSettings.infoBoxClass,closeBoxMargin:wpslSettings.infoBoxCloseMargin,closeBoxURL:wpslSettings.infoBoxCloseUrl,content:"",disableAutoPan:Number(wpslSettings.infoBoxDisableAutoPan)?!0:!1,enableEventPropagation:Number(wpslSettings.infoBoxEnableEventPropagation)?!0:!1,infoBoxClearance:new google.maps.Size(Number(e[0]),Number(e[1])),pixelOffset:new google.maps.Size(Number(t[0]),Number(t[1])),zIndex:Number(wpslSettings.infoBoxZindex)},ie=new InfoBox(s)):ie=new google.maps.InfoWindow,ie}function a(t){var s=parseInt(wpslSettings.draggable.disableRes),o={draggable:Boolean(wpslSettings.draggable.enabled)};"NaN"!==s&&o.draggable&&(o.draggable=e(document).width()>s?!0:!1),t.setOptions(o)}function r(){var e,t=wpslSettings.markerIconProps,s={};"undefined"!=typeof t.url?s.url=t.url:s.url=wpslSettings.url+"img/markers/";for(var o in t)t.hasOwnProperty(o)&&(e=t[o].split(","),2==e.length&&(s[o]=e));return s}function p(e){e=d(e),e&&ee.setOptions({styles:e})}function d(e){try{var t=JSON.parse(e);if(t&&"object"==typeof t&&null!==t)return t}catch(s){}return!1}function c(e,t){B(e,0,"",!0,t),M(e,fe,he,t)}function w(){return/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)}function g(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(){u(o),c(t,s)},i),navigator.geolocation.getCurrentPosition(function(i){u(o),clearTimeout(n),F(l),f(t,i,fe,s),e(".wpsl-search").addClass("wpsl-geolocation-run")},function(o){if(e(".wpsl-icon-direction").hasClass("wpsl-user-activated")&&!e(".wpsl-search").hasClass("wpsl-geolocation-run")){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 e(".wpsl-search").hasClass("wpsl-geolocation-run")||(clearTimeout(n),c(t,s))},{maximumAge:6e4,timeout:i,enableHighAccuracy:!0})}else alert(wpslGeolocationErrors.unavailable),c(t,s)}function u(t){clearInterval(t),e(".wpsl-icon-direction").removeClass("wpsl-active-icon")}function f(e,t,s,o){if("undefined"==typeof t)c(e,o);else{var n=new google.maps.LatLng(t.coords.latitude,t.coords.longitude);oe=t,N(n),ee.setCenter(n),B(n,0,"",!0,o),M(n,s,he,o)}}function m(t){e("#wpsl-search-btn").unbind("click").bind("click",function(s){var o=!1;return 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(),fe=!1,h(),F(o),b(),1==wpslSettings.autoComplete&&"undefined"!=typeof ne?x(ne,t):I(t)):e("#wpsl-search-input").addClass("wpsl-error").focus(),!1})}function h(){"undefined"!=typeof wpslSettings.infoWindowStyle&&"infobox"==wpslSettings.infoWindowStyle&&"undefined"!=typeof de[0]&&de[0].close()}function v(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&&(S(t.startLatLng,o),e(".wpsl-icon-reset").hide()),e(".wpsl-icon-direction").on("click",function(){e(this).addClass("wpsl-user-activated"),g(t.startLatLng,o)})})}function S(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&&(he=1),(ee.getCenter().lat()!==ue.centerLatlng.lat()||ee.getCenter().lng()!==ue.centerLatlng.lng()||ee.getZoom()!==ue.zoomLevel)&&(F(o),e("#wpsl-search-input").val("").removeClass(),e(".wpsl-icon-reset").addClass("wpsl-in-progress"),ae&&ae.clearMarkers(),b(),y(),1==wpslSettings.autoLocate?f(t,oe,n,s):c(t,s)),e("#wpsl-stores").show(),e("#wpsl-direction-details").hide())})}function b(){"undefined"!=typeof re&&""!==re&&(re.setMap(null),re="")}function y(){var t,s,o,n,l,i,a,r,p=e("#wpsl-wrap").hasClass("wpsl-default-filters"),d=[wpslSettings.searchRadius+" "+wpslSettings.distanceUnit,wpslSettings.maxResults],c=["wpsl-radius","wpsl-results"];for(t=0,s=c.length;s>t;t++)e("#"+c[t]+" select").val(parseInt(d[t])),e("#"+c[t]+" li").removeClass(),"wpsl-radius"==c[t]?o=wpslSettings.searchRadius:"wpsl-results"==c[t]&&(o=wpslSettings.maxResults),e("#"+c[t]+" li").each(function(){e(this).text()===d[t]&&(e(this).addClass("wpsl-selected-dropdown"),e("#"+c[t]+" .wpsl-selected-item").html(d[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)),e(".wpsl-custom-dropdown").length>0&&e(".wpsl-custom-dropdown").each(function(t){p?e(this).find("option").removeAttr("selected"):(l=e(this).siblings("div"),i=l.find("li:first-child"),a=i.text(),r=i.attr("data-value"),l.find("li").removeClass(),l.prev().html(a).attr("data-value",r))})}function L(t){var s,o,n,l,i;for(h(),i=t.parents("li").length>0?t.parents("li").data("store-id"):t.parents(".wpsl-info-window").data("store-id"),"undefined"!=typeof re&&""!==re&&(o=re.getPosition()),ge={centerLatlng:ee.getCenter(),zoomLevel:ee.getZoom()},s=0,l=ce.length;l>s;s++)0!=ce[s].storeId||"undefined"!=typeof o&&""!==o?ce[s].storeId==i&&(n=ce[s].getPosition()):o=ce[s].getPosition();o&&n?(e("#wpsl-direction-details ul").empty(),e(".wpsl-direction-before, .wpsl-direction-after").remove(),k(o,n)):alert(wpslLabels.generalError)}function C(e,t){var s,o,n;for(s=0,o=ce.length;o>s;s++)ce[s].storeId==e&&(n=ce[s],"start"==t?n.setAnimation(google.maps.Animation.BOUNCE):n.setAnimation(null))}function k(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]},se.route(g,function(t,s){if(s==google.maps.DirectionsStatus.OK){if(te.setMap(ee),te.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=ce.length;n>r;r++)ce[r].setMap(null);ae&&ae.clearMarkers(),"undefined"!=typeof re&&""!==re&&re.setMap(null),e("#wpsl-stores").hide(),1==wpslSettings.templateId&&(c=e("#wpsl-gmap").offset(),e(window).scrollTop(c.top))}}else q(s)})}function I(t){var s,o={address:e("#wpsl-search-input").val()};"undefined"==typeof wpslSettings.geocodeComponents||e.isEmptyObject(wpslSettings.geocodeComponents)||(o.componentRestrictions=wpslSettings.geocodeComponents),X.geocode(o,function(e,o){o==google.maps.GeocoderStatus.OK?(s=e[0].geometry.location,x(s,t)):H(o)})}function x(e,t){var s=!1;B(e,0,"",!0,t),M(e,fe,s,t)}function N(t){var s;X.geocode({latLng:t},function(t,o){o==google.maps.GeocoderStatus.OK?(s=E(t),""!==s&&e("#wpsl-search-input").val(s)):H(o)})}function E(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 M(e,t,s,o){1==wpslSettings.directionRedirect?R(e,function(){P(e,t,s,o)}):P(e,t,s,o)}function R(e,t){X.geocode({latLng:e},function(e,s){s==google.maps.GeocoderStatus.OK?(pe=e[0].formatted_address,t()):H(s)})}function P(t,s,o,n){var l,i,a={},r="",p=!1,d=e("#wpsl-listing-template").html(),c=e("#wpsl-stores ul"),g=wpslSettings.url+"img/ajax-loader.gif";a=O(t,s,o),c.empty().append("<li class='wpsl-preloader'><img src='"+g+"'/>"+wpslLabels.preloader+"</li>"),e.get(wpslSettings.ajaxurl,a,function(s){e(".wpsl-preloader, .no-results").remove(),s.length>0?(e.each(s,function(e){_.extend(s[e],Ce),l=new google.maps.LatLng(s[e].lat,s[e].lng),B(l,s[e].id,s[e],p,n),r+=_.template(d)(s[e])}),e("#wpsl-result-list").off("click",".wpsl-directions"),c.empty(),c.append(r),e("#wpsl-result-list").on("click",".wpsl-directions",function(){return 1!=wpslSettings.directionRedirect?(L(e(this)),!1):void 0}),Z(),e("#wpsl-result-list p:empty").remove()):(B(t,0,"",!0,n),i=T(),c.html("<li class='no-results'>"+i+"</li>")),K(),1==wpslSettings.resetMap&&(e.isEmptyObject(ue)&&google.maps.event.addListenerOnce(ee,"tilesloaded",function(){ue={centerLatlng:ee.getCenter(),zoomLevel:ee.getZoom()},e("#wpsl-map-controls").addClass("wpsl-reset-exists"),e(".wpsl-icon-reset, #wpsl-reset-map").show()}),e(".wpsl-icon-reset").removeClass("wpsl-in-progress"))}),1!=wpslSettings.mouseFocus||w()||e("#wpsl-search-input").focus()}function O(t,s,o){var n,l,i,a,r="",p=e("#wpsl-wrap").hasClass("wpsl-mobile"),d=e("#wpsl-wrap").hasClass("wpsl-default-filters"),c={action:"store_search",lat:t.lat(),lng:t.lng()};return s?(c.max_results=wpslSettings.maxResults,c.radius=wpslSettings.searchRadius):(p||d?(n=parseInt(e("#wpsl-results .wpsl-dropdown").val()),l=parseInt(e("#wpsl-radius .wpsl-dropdown").val())):(n=parseInt(e("#wpsl-results .wpsl-selected-item").attr("data-value")),l=parseInt(e("#wpsl-radius .wpsl-selected-item").attr("data-value"))),isNaN(n)?c.max_results=wpslSettings.maxResults:c.max_results=n,isNaN(l)?c.radius=wpslSettings.searchRadius:c.radius=l,"undefined"!=typeof wpslSettings.categoryIds?c.filter=wpslSettings.categoryIds:e("#wpsl-category").length>0?(r=p||d?parseInt(e("#wpsl-category .wpsl-dropdown").val()):parseInt(e("#wpsl-category .wpsl-selected-item").attr("data-value")),isNaN(r)||0===r||(c.filter=r)):e("#wpsl-checkbox-filter").length>0&&e("#wpsl-checkbox-filter input:checked").length>0&&(c.filter=z()),e(".wpsl-custom-dropdown").length>0&&e(".wpsl-custom-dropdown").each(function(t){i="",a="",p||d?(i=e(this).attr("name"),a=e(this).val()):(i=e(this).attr("name"),a=e(this).next(".wpsl-selected-item").attr("data-value")),i&&a&&(c[i]=a)})),1==o&&("undefined"!=typeof oe?c.skip_cache=1:(c.autoload=1,"undefined"!=typeof wpslSettings.categoryIds&&(c.filter=wpslSettings.categoryIds))),"undefined"!=typeof wpslSettings.collectStatistics&&0==o&&(c.search=e("#wpsl-search-input").val()),c}function T(){var e;return e="undefined"!=typeof wpslSettings.noResults&&""!==wpslSettings.noResults?wpslSettings.noResults:wpslLabels.noResults}function z(){var t=e("#wpsl-checkbox-filter input:checked").map(function(){return e(this).val()});return t=t.get(),t=t.join(",")}function Z(){if(1==wpslSettings.markerClusters){var e=Number(wpslSettings.clusterZoom),t=Number(wpslSettings.clusterSize);isNaN(e)&&(e=""),isNaN(t)&&(t=""),ae=new MarkerClusterer(ee,ce,{gridSize:t,maxZoom:e})}}function B(e,t,s,o,n){var l,i,a,r=!0;0===t?(s={store:wpslLabels.startPoint},l=we.url+wpslSettings.startMarker):l=we.url+wpslSettings.storeMarker,i={url:l,scaledSize:new google.maps.Size(Number(we.scaledSize[0]),Number(we.scaledSize[1])),origin:new google.maps.Point(Number(we.origin[0]),Number(we.origin[1])),anchor:new google.maps.Point(Number(we.anchor[0]),Number(we.anchor[1]))},a=new google.maps.Marker({position:e,map:ee,optimized:!1,title:V(s.store),draggable:o,storeId:t,icon:i}),ce.push(a),google.maps.event.addListener(a,"click",function(o){return function(){0!=t?"undefined"!=typeof wpslSettings.markerStreetView&&1==wpslSettings.markerStreetView?G(e,function(){$(a,j(s),n,o)}):$(a,j(s),n,o):$(a,wpslLabels.startPoint,n,o),google.maps.event.clearListeners(n,"domready"),google.maps.event.addListener(n,"domready",function(){U(a,o),A()})}}(ee)),o&&google.maps.event.addListener(a,"dragend",function(e){F(r),ee.setCenter(e.latLng),N(e.latLng),M(e.latLng,fe,he=!1,n)})}function V(e){return e?e.replace(/&#(\d+);/g,function(e,t){return String.fromCharCode(t)}):void 0}function $(e,t,s,o){de.length=0,s.setContent(t),s.open(o,e),de.push(s),"undefined"!=typeof wpslSettings.infoWindowStyle&&"infobox"==wpslSettings.infoWindowStyle&&1==wpslSettings.markerClusters&&(le=e.storeId,s.setVisible(!0))}function U(t,s){e(".wpsl-info-actions a").on("click",function(o){var n=Number(wpslSettings.autoZoomLevel);if(o.stopImmediatePropagation(),e(this).hasClass("wpsl-directions")){if(1==wpslSettings.directionRedirect)return!0;L(e(this))}else e(this).hasClass("wpsl-streetview")?W(t,s):e(this).hasClass("wpsl-zoom-here")&&(s.setCenter(t.getPosition()),s.setZoom(n));return!1})}function A(){var t=ee.getZoom();t>=wpslSettings.autoZoomLevel?e(".wpsl-zoom-here").hide():e(".wpsl-zoom-here").show()}function W(t,s){var o=s.getStreetView();o.setPosition(t.getPosition()),o.setVisible(!0),e("#wpsl-map-controls").hide(),D(o,s)}function D(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 G(e,t){var s=new google.maps.StreetViewService;s.getPanoramaByLocation(e,50,function(e,s){me=s==google.maps.StreetViewStatus.OK?!0:!1,t()})}function j(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 K(){var e,t,s=Number(wpslSettings.autoZoomLevel),o=new google.maps.LatLngBounds;for(google.maps.event.addListenerOnce(ee,"bounds_changed",function(e){this.getZoom()>s&&this.setZoom(s)}),e=0,t=ce.length;t>e;e++)o.extend(ce[e].position);ee.fitBounds(o)}function F(e){var t,s;if(te.setMap(null),ce){for(s=0,t=ce.length;t>s;s++)e?1!=ce[s].draggable?ce[s].setMap(null):re=ce[s]:ce[s].setMap(null);ce.length=0}ae&&ae.clearMarkers()}function H(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 q(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 Q(){var t=Number(wpslSettings.maxDropdownHeight);e(".wpsl-dropdown").each(function(s){var o,n,l=e(this);l.$dropdownWrap=l.wrap("<div class='wpsl-dropdown'></div>").parent(),l.$selectedVal=l.val(),l.$dropdownElem=e("<div><ul/></div>").appendTo(l.$dropdownWrap),l.$dropdown=l.$dropdownElem.find("ul"),l.$options=l.$dropdownWrap.find("option"),l.hide().removeClass("wpsl-dropdown"),e.each(l.$options,function(){o=e(this).val()==l.$selectedVal?'class="wpsl-selected-dropdown"':"",l.$dropdown.append("<li data-value="+e(this).val()+" "+o+">"+e(this).text()+"</li>")}),l.$dropdownElem.before("<span data-value="+l.find(":selected").val()+" class='wpsl-selected-item'>"+l.find(":selected").text()+"</span>"),l.$dropdownItem=l.$dropdownElem.find("li"),l.$dropdownWrap.on("click",function(s){return e(this).hasClass("wpsl-active")?void e(this).removeClass("wpsl-active"):(Y(),e(this).toggleClass("wpsl-active"),n=0,e(this).hasClass("wpsl-active")?(l.$dropdownItem.each(function(t){n+=e(this).outerHeight()}),l.$dropdownElem.css("height",n+2+"px")):l.$dropdownElem.css("height",0),n>t&&(e(this).addClass("wpsl-scroll-required"),l.$dropdownElem.css("height",t+"px")),void s.stopPropagation())}),l.$dropdownItem.on("click",function(t){l.$dropdownWrap.find(e(".wpsl-selected-item")).html(e(this).text()).attr("data-value",e(this).attr("data-value")),l.$dropdownItem.removeClass("wpsl-selected-dropdown"),e(this).addClass("wpsl-selected-dropdown"),Y(),t.stopPropagation()})}),e(document).click(function(){Y()})}function Y(){e(".wpsl-dropdown").removeClass("wpsl-active"),e(".wpsl-dropdown div").css("height",0)}function J(){e(".wpsl-search").hasClass("wpsl-widget")&&(e("#wpsl-search-btn").trigger("click"),e(".wpsl-search").removeClass("wpsl-widget"))}var X,ee,te,se,oe,ne,le,ie,ae,re,pe,de=[],ce=[],we={},ge={},ue={},fe=!1,me=!1,he="undefined"!=typeof wpslSettings?wpslSettings.autoLoad:"";if(_.templateSettings={evaluate:/\<\%(.+?)\%\>/g,interpolate:/\<\%=(.+?)\%\>/g,escape:/\<\%-(.+?)\%\>/g},e(".wpsl-gmap-canvas").length&&(e("<img />").attr("src",wpslSettings.url+"img/ajax-loader.gif"),e(".wpsl-gmap-canvas").each(function(s){var o=e(this).attr("id");t(o,s)})),e("#wpsl-result-list").on("click",".wpsl-back",function(){var t,s;for(te.setMap(null),t=0,s=ce.length;s>t;t++)ce[t].setMap(ee);return"undefined"!=typeof re&&""!==re&&re.setMap(ee),ae&&Z(),ee.setCenter(ge.centerLatlng),ee.setZoom(ge.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(){C(e(this).data("store-id"),"start")}),e("#wpsl-stores").on("mouseleave","li",function(){C(e(this).data("store-id"),"stop")})):"info_window"==wpslSettings.markerEffect&&e("#wpsl-stores").on("mouseenter","li",function(){var t,s;for(t=0,s=ce.length;s>t;t++)ce[t].storeId==e(this).data("store-id")&&(google.maps.event.trigger(ce[t],"click"),ee.setCenter(ce[t].position))})),"undefined"!=typeof wpslSettings.infoWindowStyle&&"infobox"==wpslSettings.infoWindowStyle&&1==wpslSettings.markerClusters){var ve,Se,be,ye,Le;google.maps.event.addListener(ee,"zoom_changed",function(){google.maps.event.addListenerOnce(ee,"idle",function(){if("undefined"!=typeof ae&&(ve=ae.clusters_,ve.length))for(ye=0,Se=ve.length;Se>ye;ye++)for(Le=0,be=ve[ye].markers_.length;be>Le;Le++)if(ve[ye].markers_[Le].storeId==le){ie.getVisible()&&null===ve[ye].markers_[Le].map?ie.setVisible(!1):ie.getVisible()||null===ve[ye].markers_[Le].map||ie.setVisible(!0);break}})})}var Ce={formatPhoneNumber:function(e){return 1==wpslSettings.phoneUrl&&w()&&(e="<a href='tel:"+Ce.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&&(me&&(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'>"+Ce.createDirectionUrl(t)+o+n+"</div>"),s},createDirectionUrl:function(t){var s,o,n,l={};return 1==wpslSettings.directionRedirect?("undefined"==typeof pe&&(pe=""),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="+Ce.rfc3986EncodeURIComponent(pe)+"&daddr="+Ce.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-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=ce.length;s>t;t++)ce[t].storeId==n&&google.maps.event.trigger(ce[t],"click");else o.find(".wpsl-more-info-listings").is(":visible")?e(this).removeClass("wpsl-active-details"):e(this).addClass("wpsl-active-details"),o.siblings().find(".wpsl-store-details").removeClass("wpsl-active-details"),o.siblings().find(".wpsl-more-info-listings").hide(),o.find(".wpsl-more-info-listings").toggle();return"default"!=wpslSettings.templateId||"store listings"==wpslSettings.moreInfoLocation?!1:void 0}),e("a[href='#"+wpslSettings.mapTabAnchor+"']").length){var ke,Ie,xe=Number(wpslSettings.mapTabAnchorReturn)?!0:!1,_e=e("a[href='#"+wpslSettings.mapTabAnchor+"']");_e.on("click",function(){return setTimeout(function(){ke=ee.getZoom(),Ie=ee.getCenter(),google.maps.event.trigger(ee,"resize"),ee.setZoom(ke),ee.setCenter(Ie),K()},50),xe})}});
1
+ jQuery(document).ready(function(e){function t(t,l){var d,u,f,h,S,b,y;u=n(l),y=Number(u.zoomLevel),f=i(),X=new google.maps.Geocoder,te=new google.maps.DirectionsRenderer,se=new google.maps.DirectionsService,d={zoom:Number(u.zoomLevel),center:u.startLatLng,mapTypeId:google.maps.MapTypeId[u.mapType.toUpperCase()],mapTypeControl:Number(u.mapTypeControl)?!0:!1,scrollwheel:Number(u.scrollWheel)?!0:!1,streetViewControl:Number(u.streetView)?!0:!1,zoomControlOptions:{position:google.maps.ControlPosition[u.controlPosition.toUpperCase()+"_TOP"]}},we=r(),ee=new google.maps.Map(document.getElementById(t),d),a(ee),p(u.mapStyle),"undefined"!=typeof window["wpslMap_"+l]&&"undefined"!=typeof window["wpslMap_"+l].locations&&(S=new google.maps.LatLngBounds,b=window["wpslMap_"+l].locations,e.each(b,function(e){h=new google.maps.LatLng(b[e].lat,b[e].lng),B(h,b[e].id,b[e],!1,f),S.extend(h)}),ee.fitBounds(S),google.maps.event.addListenerOnce(ee,"bounds_changed",function(e){return function(){e.getZoom()>y&&e.setZoom(y)}}(ee))),e("#wpsl-gmap").length&&(1==wpslSettings.autoComplete&&s(),!w()&&e(".wpsl-dropdown").length&&1==wpslSettings.enableStyledDropdowns?Q():(e("#wpsl-search-wrap select").show(),w()?e("#wpsl-wrap").addClass("wpsl-mobile"):e("#wpsl-wrap").addClass("wpsl-default-filters")),e(".wpsl-search").hasClass("wpsl-widget")||(1==wpslSettings.autoLocate?g(u.startLatLng,f):1==wpslSettings.autoLoad&&c(u.startLatLng,f)),1!=wpslSettings.mouseFocus||w()||e("#wpsl-search-input").focus(),m(f),v(u,ee,f),J()),o()}function s(){var t,s,o,n={};"undefined"==typeof wpslSettings.geocodeComponents||e.isEmptyObject(wpslSettings.geocodeComponents)||(n.componentRestrictions=wpslSettings.geocodeComponents),t=document.getElementById("wpsl-search-input"),s=new google.maps.places.Autocomplete(t,n),s.addListener("place_changed",function(){o=s.getPlace(),o.geometry&&(ne=o.geometry.location)})}function o(){"undefined"!=typeof wpslSettings.markerZoomTo&&1==wpslSettings.markerZoomTo&&google.maps.event.addListener(ee,"zoom_changed",function(){A()})}function n(e){var t,s,o,n=["zoomLevel","mapType","mapTypeControl","mapStyle","streetView","scrollWheel","controlPosition"],i={zoomLevel:wpslSettings.zoomLevel,mapType:wpslSettings.mapType,mapTypeControl:wpslSettings.mapTypeControl,mapStyle:wpslSettings.mapStyle,streetView:wpslSettings.streetView,scrollWheel:wpslSettings.scrollWheel,controlPosition:wpslSettings.controlPosition};if("undefined"!=typeof window["wpslMap_"+e]&&"undefined"!=typeof window["wpslMap_"+e].shortCode)for(t=0,s=n.length;s>t;t++)o=window["wpslMap_"+e].shortCode[n[t]],"undefined"!=typeof o&&(i[n[t]]=o);return i.startLatLng=l(e),i}function l(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.startLatlng?(s=wpslSettings.startLatlng.split(","),t=new google.maps.LatLng(s[0],s[1])):t=new google.maps.LatLng(0,0),t}function i(){var e,t,s={};return"undefined"!=typeof wpslSettings.infoWindowStyle&&"infobox"==wpslSettings.infoWindowStyle?(e=wpslSettings.infoBoxClearance.split(","),t=wpslSettings.infoBoxPixelOffset.split(","),s={alignBottom:!0,boxClass:wpslSettings.infoBoxClass,closeBoxMargin:wpslSettings.infoBoxCloseMargin,closeBoxURL:wpslSettings.infoBoxCloseUrl,content:"",disableAutoPan:Number(wpslSettings.infoBoxDisableAutoPan)?!0:!1,enableEventPropagation:Number(wpslSettings.infoBoxEnableEventPropagation)?!0:!1,infoBoxClearance:new google.maps.Size(Number(e[0]),Number(e[1])),pixelOffset:new google.maps.Size(Number(t[0]),Number(t[1])),zIndex:Number(wpslSettings.infoBoxZindex)},ie=new InfoBox(s)):ie=new google.maps.InfoWindow,ie}function a(t){var s=parseInt(wpslSettings.draggable.disableRes),o={draggable:Boolean(wpslSettings.draggable.enabled)};"NaN"!==s&&o.draggable&&(o.draggable=e(document).width()>s?!0:!1),t.setOptions(o)}function r(){var e,t=wpslSettings.markerIconProps,s={};"undefined"!=typeof t.url?s.url=t.url:s.url=wpslSettings.url+"img/markers/";for(var o in t)t.hasOwnProperty(o)&&(e=t[o].split(","),2==e.length&&(s[o]=e));return s}function p(e){e=d(e),e&&ee.setOptions({styles:e})}function d(e){try{var t=JSON.parse(e);if(t&&"object"==typeof t&&null!==t)return t}catch(s){}return!1}function c(e,t){B(e,0,"",!0,t),M(e,fe,he,t)}function w(){return/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)}function g(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(){u(o),c(t,s)},i),navigator.geolocation.getCurrentPosition(function(i){u(o),clearTimeout(n),F(l),f(t,i,fe,s),e(".wpsl-search").addClass("wpsl-geolocation-run")},function(o){if(e(".wpsl-icon-direction").hasClass("wpsl-user-activated")&&!e(".wpsl-search").hasClass("wpsl-geolocation-run")){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 e(".wpsl-search").hasClass("wpsl-geolocation-run")||(clearTimeout(n),c(t,s))},{maximumAge:6e4,timeout:i,enableHighAccuracy:!0})}else alert(wpslGeolocationErrors.unavailable),c(t,s)}function u(t){clearInterval(t),e(".wpsl-icon-direction").removeClass("wpsl-active-icon")}function f(e,t,s,o){if("undefined"==typeof t)c(e,o);else{var n=new google.maps.LatLng(t.coords.latitude,t.coords.longitude);oe=t,N(n),ee.setCenter(n),B(n,0,"",!0,o),M(n,s,he,o)}}function m(t){e("#wpsl-search-btn").unbind("click").bind("click",function(s){var o=!1;return 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(),fe=!1,h(),F(o),b(),1==wpslSettings.autoComplete&&"undefined"!=typeof ne?x(ne,t):I(t)):e("#wpsl-search-input").addClass("wpsl-error").focus(),!1})}function h(){"undefined"!=typeof wpslSettings.infoWindowStyle&&"infobox"==wpslSettings.infoWindowStyle&&"undefined"!=typeof de[0]&&de[0].close()}function v(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&&(S(t.startLatLng,o),e(".wpsl-icon-reset").hide()),e(".wpsl-icon-direction").on("click",function(){e(this).addClass("wpsl-user-activated"),g(t.startLatLng,o)})})}function S(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&&(he=1),(ee.getCenter().lat()!==ue.centerLatlng.lat()||ee.getCenter().lng()!==ue.centerLatlng.lng()||ee.getZoom()!==ue.zoomLevel)&&(F(o),e("#wpsl-search-input").val("").removeClass(),e(".wpsl-icon-reset").addClass("wpsl-in-progress"),ae&&ae.clearMarkers(),b(),y(),1==wpslSettings.autoLocate?f(t,oe,n,s):c(t,s)),e("#wpsl-stores").show(),e("#wpsl-direction-details").hide())})}function b(){"undefined"!=typeof re&&""!==re&&(re.setMap(null),re="")}function y(){var t,s,o,n,l,i,a,r,p=e("#wpsl-wrap").hasClass("wpsl-default-filters"),d=[wpslSettings.searchRadius+" "+wpslSettings.distanceUnit,wpslSettings.maxResults],c=["wpsl-radius","wpsl-results"];for(t=0,s=c.length;s>t;t++)e("#"+c[t]+" select").val(parseInt(d[t])),e("#"+c[t]+" li").removeClass(),"wpsl-radius"==c[t]?o=wpslSettings.searchRadius:"wpsl-results"==c[t]&&(o=wpslSettings.maxResults),e("#"+c[t]+" li").each(function(){e(this).text()===d[t]&&(e(this).addClass("wpsl-selected-dropdown"),e("#"+c[t]+" .wpsl-selected-item").html(d[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)),e(".wpsl-custom-dropdown").length>0&&e(".wpsl-custom-dropdown").each(function(t){p?e(this).find("option").removeAttr("selected"):(l=e(this).siblings("div"),i=l.find("li:first-child"),a=i.text(),r=i.attr("data-value"),l.find("li").removeClass(),l.prev().html(a).attr("data-value",r))})}function L(t){var s,o,n,l,i;for(h(),i=t.parents("li").length>0?t.parents("li").data("store-id"):t.parents(".wpsl-info-window").data("store-id"),"undefined"!=typeof re&&""!==re&&(o=re.getPosition()),ge={centerLatlng:ee.getCenter(),zoomLevel:ee.getZoom()},s=0,l=ce.length;l>s;s++)0!=ce[s].storeId||"undefined"!=typeof o&&""!==o?ce[s].storeId==i&&(n=ce[s].getPosition()):o=ce[s].getPosition();o&&n?(e("#wpsl-direction-details ul").empty(),e(".wpsl-direction-before, .wpsl-direction-after").remove(),k(o,n)):alert(wpslLabels.generalError)}function C(e,t){var s,o,n;for(s=0,o=ce.length;o>s;s++)ce[s].storeId==e&&(n=ce[s],"start"==t?n.setAnimation(google.maps.Animation.BOUNCE):n.setAnimation(null))}function k(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]},se.route(g,function(t,s){if(s==google.maps.DirectionsStatus.OK){if(te.setMap(ee),te.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=ce.length;n>r;r++)ce[r].setMap(null);ae&&ae.clearMarkers(),"undefined"!=typeof re&&""!==re&&re.setMap(null),e("#wpsl-stores").hide(),1==wpslSettings.templateId&&(c=e("#wpsl-gmap").offset(),e(window).scrollTop(c.top))}}else q(s)})}function I(t){var s,o={address:e("#wpsl-search-input").val()};"undefined"==typeof wpslSettings.geocodeComponents||e.isEmptyObject(wpslSettings.geocodeComponents)||(o.componentRestrictions=wpslSettings.geocodeComponents),X.geocode(o,function(e,o){o==google.maps.GeocoderStatus.OK?(s=e[0].geometry.location,x(s,t)):H(o)})}function x(e,t){var s=!1;B(e,0,"",!0,t),M(e,fe,s,t)}function N(t){var s;X.geocode({latLng:t},function(t,o){o==google.maps.GeocoderStatus.OK?(s=E(t),""!==s&&e("#wpsl-search-input").val(s)):H(o)})}function E(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 M(e,t,s,o){1==wpslSettings.directionRedirect?R(e,function(){P(e,t,s,o)}):P(e,t,s,o)}function R(e,t){X.geocode({latLng:e},function(e,s){s==google.maps.GeocoderStatus.OK?(pe=e[0].formatted_address,t()):H(s)})}function P(t,s,o,n){var l,i,a={},r="",p=!1,d=e("#wpsl-listing-template").html(),c=e("#wpsl-stores ul"),g=wpslSettings.url+"img/ajax-loader.gif";a=O(t,s,o),c.empty().append("<li class='wpsl-preloader'><img src='"+g+"'/>"+wpslLabels.preloader+"</li>"),e.get(wpslSettings.ajaxurl,a,function(s){e(".wpsl-preloader, .no-results").remove(),s.length>0?(e.each(s,function(e){_.extend(s[e],Ce),l=new google.maps.LatLng(s[e].lat,s[e].lng),B(l,s[e].id,s[e],p,n),r+=_.template(d)(s[e])}),e("#wpsl-result-list").off("click",".wpsl-directions"),c.empty(),c.append(r),e("#wpsl-result-list").on("click",".wpsl-directions",function(){return 1!=wpslSettings.directionRedirect?(L(e(this)),!1):void 0}),Z(),e("#wpsl-result-list p:empty").remove()):(B(t,0,"",!0,n),i=T(),c.html("<li class='no-results'>"+i+"</li>")),K(),1==wpslSettings.resetMap&&(e.isEmptyObject(ue)&&google.maps.event.addListenerOnce(ee,"tilesloaded",function(){ue={centerLatlng:ee.getCenter(),zoomLevel:ee.getZoom()},e("#wpsl-map-controls").addClass("wpsl-reset-exists"),e(".wpsl-icon-reset, #wpsl-reset-map").show()}),e(".wpsl-icon-reset").removeClass("wpsl-in-progress"))}),1!=wpslSettings.mouseFocus||w()||e("#wpsl-search-input").focus()}function O(t,s,o){var n,l,i,a,r="",p=e("#wpsl-wrap").hasClass("wpsl-mobile"),d=e("#wpsl-wrap").hasClass("wpsl-default-filters"),c={action:"store_search",lat:t.lat(),lng:t.lng()};return s?(c.max_results=wpslSettings.maxResults,c.radius=wpslSettings.searchRadius):(p||d?(n=parseInt(e("#wpsl-results .wpsl-dropdown").val()),l=parseInt(e("#wpsl-radius .wpsl-dropdown").val())):(n=parseInt(e("#wpsl-results .wpsl-selected-item").attr("data-value")),l=parseInt(e("#wpsl-radius .wpsl-selected-item").attr("data-value"))),isNaN(n)?c.max_results=wpslSettings.maxResults:c.max_results=n,isNaN(l)?c.radius=wpslSettings.searchRadius:c.radius=l,"undefined"!=typeof wpslSettings.categoryIds?c.filter=wpslSettings.categoryIds:e("#wpsl-category").length>0?(r=p||d?parseInt(e("#wpsl-category .wpsl-dropdown").val()):parseInt(e("#wpsl-category .wpsl-selected-item").attr("data-value")),isNaN(r)||0===r||(c.filter=r)):e("#wpsl-checkbox-filter").length>0&&e("#wpsl-checkbox-filter input:checked").length>0&&(c.filter=z()),e(".wpsl-custom-dropdown").length>0&&e(".wpsl-custom-dropdown").each(function(t){i="",a="",p||d?(i=e(this).attr("name"),a=e(this).val()):(i=e(this).attr("name"),a=e(this).next(".wpsl-selected-item").attr("data-value")),i&&a&&(c[i]=a)})),1==o&&("undefined"!=typeof oe?c.skip_cache=1:(c.autoload=1,"undefined"!=typeof wpslSettings.categoryIds&&(c.filter=wpslSettings.categoryIds))),"undefined"!=typeof wpslSettings.collectStatistics&&0==o&&(c.search=e("#wpsl-search-input").val()),c}function T(){var e;return e="undefined"!=typeof wpslSettings.noResults&&""!==wpslSettings.noResults?wpslSettings.noResults:wpslLabels.noResults}function z(){var t=e("#wpsl-checkbox-filter input:checked").map(function(){return e(this).val()});return t=t.get(),t=t.join(",")}function Z(){if(1==wpslSettings.markerClusters){var e=Number(wpslSettings.clusterZoom),t=Number(wpslSettings.clusterSize);isNaN(e)&&(e=""),isNaN(t)&&(t=""),ae=new MarkerClusterer(ee,ce,{gridSize:t,maxZoom:e})}}function B(e,t,s,o,n){var l,i,a,r=!0;0===t?(s={store:wpslLabels.startPoint},l=we.url+wpslSettings.startMarker):l=we.url+wpslSettings.storeMarker,i={url:l,scaledSize:new google.maps.Size(Number(we.scaledSize[0]),Number(we.scaledSize[1])),origin:new google.maps.Point(Number(we.origin[0]),Number(we.origin[1])),anchor:new google.maps.Point(Number(we.anchor[0]),Number(we.anchor[1]))},a=new google.maps.Marker({position:e,map:ee,optimized:!1,title:V(s.store),draggable:o,storeId:t,icon:i}),ce.push(a),google.maps.event.addListener(a,"click",function(o){return function(){0!=t?"undefined"!=typeof wpslSettings.markerStreetView&&1==wpslSettings.markerStreetView?G(e,function(){$(a,j(s),n,o)}):$(a,j(s),n,o):$(a,wpslLabels.startPoint,n,o),google.maps.event.clearListeners(n,"domready"),google.maps.event.addListener(n,"domready",function(){U(a,o),A()})}}(ee)),o&&google.maps.event.addListener(a,"dragend",function(e){F(r),ee.setCenter(e.latLng),N(e.latLng),M(e.latLng,fe,he=!1,n)})}function V(e){return e?e.replace(/&#(\d+);/g,function(e,t){return String.fromCharCode(t)}):void 0}function $(e,t,s,o){de.length=0,s.setContent(t),s.open(o,e),de.push(s),"undefined"!=typeof wpslSettings.infoWindowStyle&&"infobox"==wpslSettings.infoWindowStyle&&1==wpslSettings.markerClusters&&(le=e.storeId,s.setVisible(!0))}function U(t,s){e(".wpsl-info-actions a").on("click",function(o){var n=Number(wpslSettings.autoZoomLevel);if(o.stopImmediatePropagation(),e(this).hasClass("wpsl-directions")){if(1==wpslSettings.directionRedirect)return!0;L(e(this))}else e(this).hasClass("wpsl-streetview")?W(t,s):e(this).hasClass("wpsl-zoom-here")&&(s.setCenter(t.getPosition()),s.setZoom(n));return!1})}function A(){var t=ee.getZoom();t>=wpslSettings.autoZoomLevel?e(".wpsl-zoom-here").hide():e(".wpsl-zoom-here").show()}function W(t,s){var o=s.getStreetView();o.setPosition(t.getPosition()),o.setVisible(!0),e("#wpsl-map-controls").hide(),D(o,s)}function D(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 G(e,t){var s=new google.maps.StreetViewService;s.getPanoramaByLocation(e,50,function(e,s){me=s==google.maps.StreetViewStatus.OK?!0:!1,t()})}function j(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 K(){var e,t,s=Number(wpslSettings.autoZoomLevel),o=new google.maps.LatLngBounds;for(google.maps.event.addListenerOnce(ee,"bounds_changed",function(e){this.getZoom()>s&&this.setZoom(s)}),e=0,t=ce.length;t>e;e++)o.extend(ce[e].position);ee.fitBounds(o)}function F(e){var t,s;if(te.setMap(null),ce){for(s=0,t=ce.length;t>s;s++)e?1!=ce[s].draggable?ce[s].setMap(null):re=ce[s]:ce[s].setMap(null);ce.length=0}ae&&ae.clearMarkers()}function H(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 q(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 Q(){var t=Number(wpslSettings.maxDropdownHeight);e(".wpsl-dropdown").each(function(s){var o,n,l=e(this);l.$dropdownWrap=l.wrap("<div class='wpsl-dropdown'></div>").parent(),l.$selectedVal=l.val(),l.$dropdownElem=e("<div><ul/></div>").appendTo(l.$dropdownWrap),l.$dropdown=l.$dropdownElem.find("ul"),l.$options=l.$dropdownWrap.find("option"),l.hide().removeClass("wpsl-dropdown"),e.each(l.$options,function(){o=e(this).val()==l.$selectedVal?'class="wpsl-selected-dropdown"':"",l.$dropdown.append("<li data-value="+e(this).val()+" "+o+">"+e(this).text()+"</li>")}),l.$dropdownElem.before("<span data-value="+l.find(":selected").val()+" class='wpsl-selected-item'>"+l.find(":selected").text()+"</span>"),l.$dropdownItem=l.$dropdownElem.find("li"),l.$dropdownWrap.on("click",function(s){return e(this).hasClass("wpsl-active")?void e(this).removeClass("wpsl-active"):(Y(),e(this).toggleClass("wpsl-active"),n=0,e(this).hasClass("wpsl-active")?(l.$dropdownItem.each(function(t){n+=e(this).outerHeight()}),l.$dropdownElem.css("height",n+2+"px")):l.$dropdownElem.css("height",0),n>t&&(e(this).addClass("wpsl-scroll-required"),l.$dropdownElem.css("height",t+"px")),void s.stopPropagation())}),l.$dropdownItem.on("click",function(t){l.$dropdownWrap.find(e(".wpsl-selected-item")).html(e(this).text()).attr("data-value",e(this).attr("data-value")),l.$dropdownItem.removeClass("wpsl-selected-dropdown"),e(this).addClass("wpsl-selected-dropdown"),Y(),t.stopPropagation()})}),e(document).click(function(){Y()})}function Y(){e(".wpsl-dropdown").removeClass("wpsl-active"),e(".wpsl-dropdown div").css("height",0)}function J(){e(".wpsl-search").hasClass("wpsl-widget")&&(e("#wpsl-search-btn").trigger("click"),e(".wpsl-search").removeClass("wpsl-widget"))}var X,ee,te,se,oe,ne,le,ie,ae,re,pe,de=[],ce=[],we={},ge={},ue={},fe=!1,me=!1,he="undefined"!=typeof wpslSettings?wpslSettings.autoLoad:"";if(_.templateSettings={evaluate:/\<\%(.+?)\%\>/g,interpolate:/\<\%=(.+?)\%\>/g,escape:/\<\%-(.+?)\%\>/g},e(".wpsl-gmap-canvas").length&&(e("<img />").attr("src",wpslSettings.url+"img/ajax-loader.gif"),e(".wpsl-gmap-canvas").each(function(s){var o=e(this).attr("id");t(o,s)})),e("#wpsl-result-list").on("click",".wpsl-back",function(){var t,s;for(te.setMap(null),t=0,s=ce.length;s>t;t++)ce[t].setMap(ee);return"undefined"!=typeof re&&""!==re&&re.setMap(ee),ae&&Z(),ee.setCenter(ge.centerLatlng),ee.setZoom(ge.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(){C(e(this).data("store-id"),"start")}),e("#wpsl-stores").on("mouseleave","li",function(){C(e(this).data("store-id"),"stop")})):"info_window"==wpslSettings.markerEffect&&e("#wpsl-stores").on("mouseenter","li",function(){var t,s;for(t=0,s=ce.length;s>t;t++)ce[t].storeId==e(this).data("store-id")&&(google.maps.event.trigger(ce[t],"click"),ee.setCenter(ce[t].position))})),"undefined"!=typeof wpslSettings.infoWindowStyle&&"infobox"==wpslSettings.infoWindowStyle&&1==wpslSettings.markerClusters){var ve,Se,be,ye,Le;google.maps.event.addListener(ee,"zoom_changed",function(){google.maps.event.addListenerOnce(ee,"idle",function(){if("undefined"!=typeof ae&&(ve=ae.clusters_,ve.length))for(ye=0,Se=ve.length;Se>ye;ye++)for(Le=0,be=ve[ye].markers_.length;be>Le;Le++)if(ve[ye].markers_[Le].storeId==le){ie.getVisible()&&null===ve[ye].markers_[Le].map?ie.setVisible(!1):ie.getVisible()||null===ve[ye].markers_[Le].map||ie.setVisible(!0);break}})})}var Ce={formatPhoneNumber:function(e){return 1==wpslSettings.phoneUrl&&w()&&(e="<a href='tel:"+Ce.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&&(me&&(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'>"+Ce.createDirectionUrl(t)+o+n+"</div>"),s},createDirectionUrl:function(t){var s,o,n,l={};return 1==wpslSettings.directionRedirect?("undefined"==typeof pe&&(pe=""),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="+Ce.rfc3986EncodeURIComponent(pe)+"&daddr="+Ce.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-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=ce.length;s>t;t++)ce[t].storeId==n&&google.maps.event.trigger(ce[t],"click");else o.find(".wpsl-more-info-listings").is(":visible")?e(this).removeClass("wpsl-active-details"):e(this).addClass("wpsl-active-details"),o.siblings().find(".wpsl-store-details").removeClass("wpsl-active-details"),o.siblings().find(".wpsl-more-info-listings").hide(),o.find(".wpsl-more-info-listings").toggle();return"default"!=wpslSettings.templateId||"store listings"==wpslSettings.moreInfoLocation?!1:void 0}),e("a[href='#"+wpslSettings.mapTabAnchor+"']").length){var ke,Ie,xe=Number(wpslSettings.mapTabAnchorReturn)?!0:!1,_e=e("a[href='#"+wpslSettings.mapTabAnchor+"']");_e.on("click",function(){return setTimeout(function(){ke=ee.getZoom(),Ie=ee.getCenter(),google.maps.event.trigger(ee,"resize"),ee.setZoom(ke),ee.setCenter(Ie),K()},50),xe})}});
readme.txt CHANGED
@@ -5,7 +5,7 @@ Donate link: https://www.paypal.me/tijmensmit
5
  Tags: google maps, store locator, business locations, geocoding, stores, geo, zipcode locator, dealer locater, geocode, gmaps, google map, google map plugin, location finder, map tools, shop locator, wp google map
6
  Requires at least: 3.7
7
  Tested up to: 4.7
8
- Stable tag: 2.2.5
9
  License: GPLv3
10
  License URI: http://www.gnu.org/licenses/gpl.html
11
 
@@ -126,6 +126,14 @@ If you find a plugin or theme that causes a conflict, please report it on the [s
126
 
127
  == Changelog ==
128
 
 
 
 
 
 
 
 
 
129
  = 2.2.5, December 11, 2016 =
130
  * Fixed: Made it work with the latest WPML version.
131
  * Fixed: Remove the WPSL caps and Store Locator Manager role on uninstall. The code was always there to do so, but was never called.
5
  Tags: google maps, store locator, business locations, geocoding, stores, geo, zipcode locator, dealer locater, geocode, gmaps, google map, google map plugin, location finder, map tools, shop locator, wp google map
6
  Requires at least: 3.7
7
  Tested up to: 4.7
8
+ Stable tag: 2.2.6
9
  License: GPLv3
10
  License URI: http://www.gnu.org/licenses/gpl.html
11
 
126
 
127
  == Changelog ==
128
 
129
+ = 2.2.6, December 24, 2016 =
130
+ * Fixed: The opening hours not working correctly for Saturday / Sunday in the admin area. The 12:00 AM field was missing.
131
+ * Fixed: A PHP notice showing up when an invalid value was set for the radius / max results dropdown.
132
+ * Fixed: The zoom attribute now works correctly for the wpsl_map shortcode.
133
+ * Changed: Included the latest version of the EDD_SL_Plugin_Updater class.
134
+ * Changed: Removed unused locationCount var from wpsl-gmap.js.
135
+ * Changed: Added a CSS rule that makes it harder for themes to scaled images on the map.
136
+
137
  = 2.2.5, December 11, 2016 =
138
  * Fixed: Made it work with the latest WPML version.
139
  * Fixed: Remove the WPSL caps and Store Locator Manager role on uninstall. The code was always there to do so, but was never called.
wp-store-locator.php CHANGED
@@ -4,7 +4,7 @@ Plugin Name: WP Store Locator
4
  Description: An easy to use location management system that enables users to search for nearby physical stores
5
  Author: Tijmen Smit
6
  Author URI: https://wpstorelocator.co/
7
- Version: 2.2.5
8
  Text Domain: wpsl
9
  Domain Path: /languages/
10
  License: GPL v3
@@ -58,7 +58,7 @@ if ( !class_exists( 'WP_Store_locator' ) ) {
58
  public function define_constants() {
59
 
60
  if ( !defined( 'WPSL_VERSION_NUM' ) )
61
- define( 'WPSL_VERSION_NUM', '2.2.5' );
62
 
63
  if ( !defined( 'WPSL_URL' ) )
64
  define( 'WPSL_URL', plugin_dir_url( __FILE__ ) );
4
  Description: An easy to use location management system that enables users to search for nearby physical stores
5
  Author: Tijmen Smit
6
  Author URI: https://wpstorelocator.co/
7
+ Version: 2.2.6
8
  Text Domain: wpsl
9
  Domain Path: /languages/
10
  License: GPL v3
58
  public function define_constants() {
59
 
60
  if ( !defined( 'WPSL_VERSION_NUM' ) )
61
+ define( 'WPSL_VERSION_NUM', '2.2.6' );
62
 
63
  if ( !defined( 'WPSL_URL' ) )
64
  define( 'WPSL_URL', plugin_dir_url( __FILE__ ) );