Version Description
Download this release
Release Info
Developer | tijmensmit |
Plugin | WP Store Locator |
Version | 2.2.233 |
Comparing to | |
See all releases |
Code changes from version 2.2.232 to 2.2.233
- frontend/class-frontend.php +12 -5
- inc/class-borlabs-cookie.php +174 -149
- inc/wpsl-functions.php +1 -1
- readme.txt +6 -2
- wp-store-locator.php +2 -2
frontend/class-frontend.php
CHANGED
@@ -279,14 +279,14 @@ if ( !class_exists( 'WPSL_Frontend' ) ) {
|
|
279 |
$sql = apply_filters( 'wpsl_sql',
|
280 |
"SELECT post_lat.meta_value AS lat,
|
281 |
post_lng.meta_value AS lng,
|
282 |
-
posts.ID,
|
283 |
-
( %d * acos( cos( radians( %s ) ) * cos( radians( post_lat.meta_value ) ) * cos( radians( post_lng.meta_value ) - radians( %s ) ) + sin( radians( %s ) ) * sin( radians( post_lat.meta_value ) ) ) )
|
284 |
AS distance
|
285 |
FROM $wpdb->posts AS posts
|
286 |
INNER JOIN $wpdb->postmeta AS post_lat ON post_lat.post_id = posts.ID AND post_lat.meta_key = 'wpsl_lat'
|
287 |
INNER JOIN $wpdb->postmeta AS post_lng ON post_lng.post_id = posts.ID AND post_lng.meta_key = 'wpsl_lng'
|
288 |
$cat_filter
|
289 |
-
WHERE posts.post_type = 'wpsl_stores'
|
290 |
AND posts.post_status = 'publish' $group_by $sql_sort"
|
291 |
);
|
292 |
|
@@ -1295,7 +1295,7 @@ if ( !class_exists( 'WPSL_Frontend' ) ) {
|
|
1295 |
if ( get_option( 'template' ) === 'twentynineteen' ) {
|
1296 |
$classes[] = 'wpsl-twentynineteen';
|
1297 |
}
|
1298 |
-
|
1299 |
$classes = apply_filters( 'wpsl_template_css_classes', $classes );
|
1300 |
|
1301 |
if ( !empty( $classes ) ) {
|
@@ -1729,7 +1729,14 @@ if ( !class_exists( 'WPSL_Frontend' ) ) {
|
|
1729 |
if ( !function_exists( 'BorlabsCookieHelper' ) ) {
|
1730 |
wp_enqueue_script( 'wpsl-gmap', ( 'https://maps.google.com/maps/api/js' . wpsl_get_gmap_api_params( 'browser_key' ) . '' ), '', null, true );
|
1731 |
} else {
|
1732 |
-
if ( !$wpsl_settings['delay_loading']
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1733 |
wp_enqueue_script( 'wpsl-gmap', ( 'https://maps.google.com/maps/api/js' . wpsl_get_gmap_api_params( 'browser_key' ) . '' ), '', null, true );
|
1734 |
}
|
1735 |
}
|
279 |
$sql = apply_filters( 'wpsl_sql',
|
280 |
"SELECT post_lat.meta_value AS lat,
|
281 |
post_lng.meta_value AS lng,
|
282 |
+
posts.ID,
|
283 |
+
( %d * acos( cos( radians( %s ) ) * cos( radians( post_lat.meta_value ) ) * cos( radians( post_lng.meta_value ) - radians( %s ) ) + sin( radians( %s ) ) * sin( radians( post_lat.meta_value ) ) ) )
|
284 |
AS distance
|
285 |
FROM $wpdb->posts AS posts
|
286 |
INNER JOIN $wpdb->postmeta AS post_lat ON post_lat.post_id = posts.ID AND post_lat.meta_key = 'wpsl_lat'
|
287 |
INNER JOIN $wpdb->postmeta AS post_lng ON post_lng.post_id = posts.ID AND post_lng.meta_key = 'wpsl_lng'
|
288 |
$cat_filter
|
289 |
+
WHERE posts.post_type = 'wpsl_stores'
|
290 |
AND posts.post_status = 'publish' $group_by $sql_sort"
|
291 |
);
|
292 |
|
1295 |
if ( get_option( 'template' ) === 'twentynineteen' ) {
|
1296 |
$classes[] = 'wpsl-twentynineteen';
|
1297 |
}
|
1298 |
+
|
1299 |
$classes = apply_filters( 'wpsl_template_css_classes', $classes );
|
1300 |
|
1301 |
if ( !empty( $classes ) ) {
|
1729 |
if ( !function_exists( 'BorlabsCookieHelper' ) ) {
|
1730 |
wp_enqueue_script( 'wpsl-gmap', ( 'https://maps.google.com/maps/api/js' . wpsl_get_gmap_api_params( 'browser_key' ) . '' ), '', null, true );
|
1731 |
} else {
|
1732 |
+
if ( !$wpsl_settings['delay_loading']
|
1733 |
+
||
|
1734 |
+
(
|
1735 |
+
stripos( $post->post_content, '[borlabs_cookie_blocked_content type="wpstorelocator"' ) === false
|
1736 |
+
&&
|
1737 |
+
stripos( $post->post_content, '[borlabs-cookie id="wpstorelocator" type="content-blocker"' ) === false
|
1738 |
+
)
|
1739 |
+
) {
|
1740 |
wp_enqueue_script( 'wpsl-gmap', ( 'https://maps.google.com/maps/api/js' . wpsl_get_gmap_api_params( 'browser_key' ) . '' ), '', null, true );
|
1741 |
}
|
1742 |
}
|
inc/class-borlabs-cookie.php
CHANGED
@@ -1,150 +1,175 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* WPSL / Borlabs Cookie class
|
4 |
-
*
|
5 |
-
* @author Tijmen Smit
|
6 |
-
* @since 2.2.22
|
7 |
-
*/
|
8 |
-
|
9 |
-
if ( !defined( 'ABSPATH' ) ) exit;
|
10 |
-
|
11 |
-
if ( !class_exists( 'WPSL_Borlabs_Cookie' ) ) {
|
12 |
-
|
13 |
-
class WPSL_Borlabs_Cookie {
|
14 |
-
|
15 |
-
/**
|
16 |
-
* Class constructor
|
17 |
-
*/
|
18 |
-
public function __construct() {
|
19 |
-
|
20 |
-
if ( !is_admin() ) {
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
*
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
*
|
47 |
-
*
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
'
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
*
|
101 |
-
*
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
[
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
150 |
}
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* WPSL / Borlabs Cookie class
|
4 |
+
*
|
5 |
+
* @author Tijmen Smit
|
6 |
+
* @since 2.2.22
|
7 |
+
*/
|
8 |
+
|
9 |
+
if ( !defined( 'ABSPATH' ) ) exit;
|
10 |
+
|
11 |
+
if ( !class_exists( 'WPSL_Borlabs_Cookie' ) ) {
|
12 |
+
|
13 |
+
class WPSL_Borlabs_Cookie {
|
14 |
+
|
15 |
+
/**
|
16 |
+
* Class constructor
|
17 |
+
*/
|
18 |
+
public function __construct() {
|
19 |
+
|
20 |
+
if ( !is_admin() ) {
|
21 |
+
if (defined('BORLABS_COOKIE_VERSION') && version_compare(BORLABS_COOKIE_VERSION, '2.0', '>=')) {
|
22 |
+
add_filter( 'borlabsCookie/contentBlocker/modify/content/wpstorelocator', array( $this, 'update_content_blocker' ), 10, 2 );
|
23 |
+
} else {
|
24 |
+
add_filter( 'borlabsCookie/bct/modify_content/wpstorelocator', array( $this, 'update_content_blocker_backwards_compatibility' ), 10, 2 );
|
25 |
+
}
|
26 |
+
}
|
27 |
+
}
|
28 |
+
|
29 |
+
/**
|
30 |
+
* Check if the 'wpstorelocator' blocked content type exists.
|
31 |
+
* If this is not the case, then we create it.
|
32 |
+
*
|
33 |
+
* @since 2.2.22
|
34 |
+
* @return void
|
35 |
+
*/
|
36 |
+
public function maybe_enable_bct() {
|
37 |
+
|
38 |
+
$wpsl_bct_data = BorlabsCookieHelper()->getBlockedContentTypeDataByTypeId( 'wpstorelocator' );
|
39 |
+
|
40 |
+
if ( !$wpsl_bct_data ) {
|
41 |
+
$this->enable();
|
42 |
+
}
|
43 |
+
}
|
44 |
+
|
45 |
+
/**
|
46 |
+
* Add support for the delayed loading of the
|
47 |
+
* Google Maps library in the Borlabs Cookies plugin
|
48 |
+
* by adding a 'wpstorelocator' blocked content type.
|
49 |
+
*
|
50 |
+
* @since 2.2.22
|
51 |
+
* @return void
|
52 |
+
*/
|
53 |
+
public function enable() {
|
54 |
+
|
55 |
+
/**
|
56 |
+
* First, we delete old Blocked Content Types with the id wpstorelocator.
|
57 |
+
* If the id doesn't exist, nothing happens.
|
58 |
+
*
|
59 |
+
* Doing so ensures that both plugins work as intended.
|
60 |
+
*/
|
61 |
+
BorlabsCookieHelper()->deleteBlockedContentType( 'wpstorelocator' );
|
62 |
+
|
63 |
+
// Add new Blocked Content Type wpstorelocator - if the BCT exists nothing happens
|
64 |
+
BorlabsCookieHelper()->addBlockedContentType(
|
65 |
+
'wpstorelocator',
|
66 |
+
'WP Store Locator',
|
67 |
+
'',
|
68 |
+
[],
|
69 |
+
'<div class="borlabs-cookie-bct bc-bct-iframe bc-bct-google-maps">
|
70 |
+
<p class="bc-thumbnail"><img src="%%thumbnail%%" alt="%%name%%"></p>
|
71 |
+
<div class="bc-text">
|
72 |
+
<p>' . _x( 'To protect your personal data, your connection to Google Maps has been blocked.<br>Click on <strong>Load map</strong> to unblock Google Maps.<br>By loading the map you accept the privacy policy of Google.<br>More information about Google\'s privacy policy can be found here <a href="https://policies.google.com/privacy?hl=en&gl=en" target="_blank" rel="nofollow">Google - Privacy & Terms</a> . ', 'Borlabs Cookie', 'wpsl' ) . '</p>
|
73 |
+
<p><label><input type="checkbox" name="unblockAll" value="1" checked> ' . _x( 'Do not block Google Maps in the future anymore.', 'Borlabs Cookie', 'wpsl' ) . '</label>
|
74 |
+
<a role="button" data-borlabs-cookie-unblock>' . _x( 'Load map', 'Borlabs Cookie', 'wpsl' ) . '</a></p>
|
75 |
+
</div>
|
76 |
+
</div>',
|
77 |
+
'',
|
78 |
+
'',
|
79 |
+
[
|
80 |
+
'responsiveIframe' => false,
|
81 |
+
],
|
82 |
+
true,
|
83 |
+
true
|
84 |
+
);
|
85 |
+
}
|
86 |
+
|
87 |
+
/**
|
88 |
+
* Remove the 'wpstorelocator' blocked content type
|
89 |
+
* from the Borlabs Cookie plugin.
|
90 |
+
*
|
91 |
+
* @since 2.2.22
|
92 |
+
*/
|
93 |
+
public function disable() {
|
94 |
+
if ( function_exists('BorlabsCookieHelper' ) ) {
|
95 |
+
BorlabsCookieHelper()->deleteBlockedContentType( 'wpstorelocator' );
|
96 |
+
}
|
97 |
+
}
|
98 |
+
|
99 |
+
/**
|
100 |
+
* modifyWPStoreLocatorContentBlockerBackwardsCompatibility function.
|
101 |
+
*
|
102 |
+
* @since 2.2.233
|
103 |
+
* @param mixed $id
|
104 |
+
* @param mixed $content
|
105 |
+
* @return void
|
106 |
+
*/
|
107 |
+
public function update_content_blocker_backwards_compatibility( $id, $content ) {
|
108 |
+
return $this->update_content_blocker($content);
|
109 |
+
}
|
110 |
+
|
111 |
+
/**
|
112 |
+
* modifyWPStoreLocatorContentBlocker function.
|
113 |
+
*
|
114 |
+
* @since 2.2.22
|
115 |
+
* @param mixed $content
|
116 |
+
* @param mixed $atts
|
117 |
+
* @return void
|
118 |
+
*/
|
119 |
+
public function update_content_blocker( $content, $atts = [] ) {
|
120 |
+
|
121 |
+
// Get settings of the Blocked Content Type
|
122 |
+
$wpsl_data = BorlabsCookieHelper()->getBlockedContentTypeDataByTypeId( 'wpstorelocator' );
|
123 |
+
|
124 |
+
// Workaround, fixed in newer versions of Borlabs Cookie
|
125 |
+
if ( !isset($wpsl_data['settings']['unblockAll'] ) ) {
|
126 |
+
$wpsl_data['settings']['unblockAll'] = false;
|
127 |
+
}
|
128 |
+
|
129 |
+
BorlabsCookieHelper()->updateBlockedContentTypeJavaScript(
|
130 |
+
'wpstorelocator',
|
131 |
+
'var myScriptTag = document.createElement("script"); myScriptTag.type = "text/javascript"; myScriptTag.src = "https://maps.google.com/maps/api/js' . wpsl_get_gmap_api_params( "browser_key" ) .'";jQuery("body").append(myScriptTag);',
|
132 |
+
'initWpslMap();',
|
133 |
+
$wpsl_data['settings']
|
134 |
+
);
|
135 |
+
|
136 |
+
// Default thumbnail
|
137 |
+
$thumbnail = BORLABS_COOKIE_PLUGIN_URL.'images/bct-google-maps.png';
|
138 |
+
|
139 |
+
// Get the title which was maybe set via title-attribute in a shortcode
|
140 |
+
$title = BorlabsCookieHelper()->getCurrentTitleOfBlockedContentType();
|
141 |
+
|
142 |
+
// If no title was set use the Blocked Content Type name as title
|
143 |
+
if ( empty( $title ) ) {
|
144 |
+
$title = $wpsl_data['name'];
|
145 |
+
}
|
146 |
+
|
147 |
+
// Replace text variables
|
148 |
+
if (!empty($atts)) {
|
149 |
+
|
150 |
+
foreach ($atts as $key => $value) {
|
151 |
+
$wpsl_data['previewHTML'] = str_replace('%%'.$key.'%%', $value, $wpsl_data['previewHTML']);
|
152 |
+
}
|
153 |
+
}
|
154 |
+
|
155 |
+
$wpsl_data['previewHTML'] = str_replace(
|
156 |
+
[
|
157 |
+
'%%name%%',
|
158 |
+
'%%thumbnail%%',
|
159 |
+
'%%privacy_policy_url%%',
|
160 |
+
],
|
161 |
+
[
|
162 |
+
$title,
|
163 |
+
$thumbnail,
|
164 |
+
$wpsl_data['privacyPolicyURL'],
|
165 |
+
],
|
166 |
+
$wpsl_data['previewHTML']
|
167 |
+
);
|
168 |
+
|
169 |
+
/* Return the HTML that displays the information, that the original content was blocked */
|
170 |
+
return $wpsl_data['previewHTML'];
|
171 |
+
}
|
172 |
+
}
|
173 |
+
|
174 |
+
new WPSL_Borlabs_Cookie();
|
175 |
}
|
inc/wpsl-functions.php
CHANGED
@@ -51,7 +51,7 @@ function wpsl_get_gmap_api_params( $api_key_type, $geocode_params = false ) {
|
|
51 |
}
|
52 |
|
53 |
if ( $api_key_type == 'browser_key' ) {
|
54 |
-
$api_version = apply_filters( 'wpsl_gmap_api_version', '
|
55 |
$api_params .= '&v=' . $api_version;
|
56 |
}
|
57 |
|
51 |
}
|
52 |
|
53 |
if ( $api_key_type == 'browser_key' ) {
|
54 |
+
$api_version = apply_filters( 'wpsl_gmap_api_version', 'quarterly' );
|
55 |
$api_params .= '&v=' . $api_version;
|
56 |
}
|
57 |
|
readme.txt
CHANGED
@@ -4,8 +4,8 @@ Contributors: tijmensmit
|
|
4 |
Donate link: https://www.paypal.me/tijmensmit
|
5 |
Tags: google maps, store locator, business locations, geocoding, stores, geo, zipcode locator, dealer locater, geocode, gmaps, google map, google map plugin, location finder, map tools, shop locator, wp google map
|
6 |
Requires at least: 3.7
|
7 |
-
Tested up to: 5.
|
8 |
-
Stable tag: 2.2.
|
9 |
License: GPLv3
|
10 |
License URI: http://www.gnu.org/licenses/gpl.html
|
11 |
|
@@ -127,6 +127,10 @@ If you find a plugin or theme that causes a conflict, please report it on the [s
|
|
127 |
|
128 |
== Changelog ==
|
129 |
|
|
|
|
|
|
|
|
|
130 |
= 2.2.232, Nov 27, 2019 =
|
131 |
* Fixed: The opening hours triggering an error on some server configurations.
|
132 |
* Fixed: Restored the [wpsl_skip_cpt_template](https://wpstorelocator.co/document/wpsl_skip_cpt_template/) filter which was accidently removed in a previous update.
|
4 |
Donate link: https://www.paypal.me/tijmensmit
|
5 |
Tags: google maps, store locator, business locations, geocoding, stores, geo, zipcode locator, dealer locater, geocode, gmaps, google map, google map plugin, location finder, map tools, shop locator, wp google map
|
6 |
Requires at least: 3.7
|
7 |
+
Tested up to: 5.5
|
8 |
+
Stable tag: 2.2.233
|
9 |
License: GPLv3
|
10 |
License URI: http://www.gnu.org/licenses/gpl.html
|
11 |
|
127 |
|
128 |
== Changelog ==
|
129 |
|
130 |
+
= 2.2.233, July 10, 2020 =
|
131 |
+
* Fixed: A problem with the [Borlabs Cookie](https://borlabs.io/borlabs-cookie/) plugin where Google Maps wasn't blocked correctly.
|
132 |
+
* Changed: Set the loaded Google Maps JavaScript [version](https://developers.google.com/maps/documentation/javascript/versions) to quarterly. So every quarter it will automatically load the latest version.
|
133 |
+
|
134 |
= 2.2.232, Nov 27, 2019 =
|
135 |
* Fixed: The opening hours triggering an error on some server configurations.
|
136 |
* Fixed: Restored the [wpsl_skip_cpt_template](https://wpstorelocator.co/document/wpsl_skip_cpt_template/) filter which was accidently removed in a previous update.
|
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.
|
8 |
Text Domain: wpsl
|
9 |
Domain Path: /languages/
|
10 |
License: GPL v3
|
@@ -61,7 +61,7 @@ if ( !class_exists( 'WP_Store_locator' ) ) {
|
|
61 |
public function define_constants() {
|
62 |
|
63 |
if ( !defined( 'WPSL_VERSION_NUM' ) )
|
64 |
-
define( 'WPSL_VERSION_NUM', '2.2.
|
65 |
|
66 |
if ( !defined( 'WPSL_URL' ) )
|
67 |
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.233
|
8 |
Text Domain: wpsl
|
9 |
Domain Path: /languages/
|
10 |
License: GPL v3
|
61 |
public function define_constants() {
|
62 |
|
63 |
if ( !defined( 'WPSL_VERSION_NUM' ) )
|
64 |
+
define( 'WPSL_VERSION_NUM', '2.2.233' );
|
65 |
|
66 |
if ( !defined( 'WPSL_URL' ) )
|
67 |
define( 'WPSL_URL', plugin_dir_url( __FILE__ ) );
|