WP Store Locator - Version 2.2.233

Version Description

Download this release

Release Info

Developer tijmensmit
Plugin Icon 128x128 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 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'] || stripos( $post->post_content, '[borlabs_cookie_blocked_content type="wpstorelocator"' ) === false ) {
 
 
 
 
 
 
 
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
- add_filter( 'borlabsCookie/bct/modify_content/wpstorelocator', array( $this, 'update_content_blocker' ), 10, 2 );
22
- }
23
- }
24
-
25
- /**
26
- * Check if the 'wpstorelocator' blocked content type exists.
27
- * If this is not the case, then we create it.
28
- *
29
- * @since 2.2.22
30
- * @return void
31
- */
32
- public function maybe_enable_bct() {
33
-
34
- $wpsl_bct_data = BorlabsCookieHelper()->getBlockedContentTypeDataByTypeId( 'wpstorelocator' );
35
-
36
- if ( !$wpsl_bct_data ) {
37
- $this->enable();
38
- }
39
- }
40
-
41
- /**
42
- * Add support for the delayed loading of the
43
- * Google Maps library in the Borlabs Cookies plugin
44
- * by adding a 'wpstorelocator' blocked content type.
45
- *
46
- * @since 2.2.22
47
- * @return void
48
- */
49
- public function enable() {
50
-
51
- /**
52
- * First, we delete old Blocked Content Types with the id wpstorelocator.
53
- * If the id doesn't exist, nothing happens.
54
- *
55
- * Doing so ensures that both plugins work as intended.
56
- */
57
- BorlabsCookieHelper()->deleteBlockedContentType( 'wpstorelocator' );
58
-
59
- // Add new Blocked Content Type wpstorelocator - if the BCT exists nothing happens
60
- BorlabsCookieHelper()->addBlockedContentType(
61
- 'wpstorelocator',
62
- 'WP Store Locator',
63
- '',
64
- [],
65
- '<div class="borlabs-cookie-bct bc-bct-iframe bc-bct-google-maps">
66
- <p class="bc-thumbnail"><img src="%%thumbnail%%" alt="%%name%%"></p>
67
- <div class="bc-text">
68
- <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&amp;gl=en" target="_blank" rel="nofollow">Google - Privacy &amp; Terms</a> . ', 'Borlabs Cookie', 'wpsl' ) . '</p>
69
- <p><label><input type="checkbox" name="unblockAll" value="1" checked> ' . _x( 'Do not block Google Maps in the future anymore.', 'Borlabs Cookie', 'wpsl' ) . '</label>
70
- <a role="button" data-borlabs-cookie-unblock>' . _x( 'Load map', 'Borlabs Cookie', 'wpsl' ) . '</a></p>
71
- </div>
72
- </div>',
73
- '',
74
- '',
75
- [
76
- 'responsiveIframe' => false,
77
- ],
78
- true,
79
- true
80
- );
81
- }
82
-
83
- /**
84
- * Remove the 'wpstorelocator' blocked content type
85
- * from the Borlabs Cookie plugin.
86
- *
87
- * @since 2.2.22
88
- */
89
- public function disable() {
90
- if ( function_exists('BorlabsCookieHelper' ) ) {
91
- BorlabsCookieHelper()->deleteBlockedContentType( 'wpstorelocator' );
92
- }
93
- }
94
-
95
- /**
96
- * modifyWPStoreLocatorContentBlocker function.
97
- *
98
- * @since 2.2.22
99
- * @param mixed $id
100
- * @param mixed $content
101
- * @return void
102
- */
103
- public function update_content_blocker( $id, $content ) {
104
-
105
- // Get settings of the Blocked Content Type
106
- $wpsl_data = BorlabsCookieHelper()->getBlockedContentTypeDataByTypeId( 'wpstorelocator' );
107
-
108
- // Workaround, fixed in newer versions of Borlabs Cookie
109
- if ( !isset($wpsl_data['settings']['unblockAll'] ) ) {
110
- $wpsl_data['settings']['unblockAll'] = false;
111
- }
112
-
113
- BorlabsCookieHelper()->updateBlockedContentTypeJavaScript(
114
- 'wpstorelocator',
115
- '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);',
116
- 'initWpslMap();',
117
- $wpsl_data['settings']
118
- );
119
-
120
- // Default thumbnail
121
- $thumbnail = BORLABS_COOKIE_PLUGIN_URL.'images/bct-google-maps.png';
122
-
123
- // Get the title which was maybe set via title-attribute in a shortcode
124
- $title = BorlabsCookieHelper()->getCurrentTitleOfBlockedContentType();
125
-
126
- // If no title was set use the Blocked Content Type name as title
127
- if ( empty( $title ) ) {
128
- $title = $wpsl_data['name'];
129
- }
130
-
131
- // Replace text variables
132
- $wpsl_data['previewHTML'] = str_replace(
133
- [
134
- '%%name%%',
135
- '%%thumbnail%%',
136
- ],
137
- [
138
- $title,
139
- $thumbnail
140
- ],
141
- $wpsl_data['previewHTML']
142
- );
143
-
144
- /* Return the HTML that displays the information, that the original content was blocked */
145
- return $wpsl_data['previewHTML'];
146
- }
147
- }
148
-
149
- new WPSL_Borlabs_Cookie();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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&amp;gl=en" target="_blank" rel="nofollow">Google - Privacy &amp; 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', '3.39' );
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.4
8
- Stable tag: 2.2.232
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.232
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.232' );
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__ ) );