-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathwpGoogleMaps.php
More file actions
426 lines (389 loc) · 18.6 KB
/
wpGoogleMaps.php
File metadata and controls
426 lines (389 loc) · 18.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
<?php
/*
Plugin Name: WP Go Maps (formerly WP Google Maps)
Plugin URI: https://www.wpgmaps.com
Description: The easiest to use Google Maps plugin! Create custom Google Maps or a map block with high quality markers containing locations, descriptions, images and links. Add your customized map to your WordPress posts and/or pages quickly and easily with the supplied shortcode. No fuss.
Version: 10.0.05
Author: WP Go Maps (formerly WP Google Maps)
Author URI: https://www.wpgmaps.com
Text Domain: wp-google-maps
Domain Path: /languages
*/
/*
* 10.0.05 - 2026-01-14
* Fixed issue where notice actions were missing permission checks. Low level users could trigger actions like switching map engines. Security issue. Thanks Moose Love (Nagasaki Prefectural University) (Wordfence)
* Fixed issue where deferred loading with WP Rocket would lead to initialization error. We now exclude inline initializer and settings object from this system. Can be disabled in settings
* Fixed issue where batch marker loading would incorrectly trigger final shape fetch request
* Fixed issue where internal map library loaders would not respect force-load flag when enqueueing scripts
* Fixed issue with setMap calls on point labels
* Improved point label architecture to support regeneration and map ID changes if needed
*
* 10.0.04 - 2025-12-04
* Added pro features page and menu item
* Added additional page construction hooks
* Added demo list to maps view page
* Added LocationIQ to engine swap toolbar
* Improved PHP 8.5 stability & compatibility
* Fixed issue where engine swap toolbar would not set tileserver defaults for first time users
* Fixed issue where map list clicks were not being handled correctly for action buttons
* Fixed issue where PHP 8.5 would throw a deprecation warning due to an outdated switch case
* Fixed issue with our internal links, docs, site, support, forums, throughout the plugin
* Fixed issue where bulk marker selection button would not work in some environments
* Fixed issue where info-window link controls were available in basic
* Updated marker listing demo image
*
* 10.0.03 - 2025-11-27
* Added first time usage flow which opens the marker creator once for new users (UX Improvement)
* Added engine swap toolbar to map editor for first time usage, once dismissed does not show again (UX Improvement)
* Added a new setting to enable dynamic translations, as this must be an opt in for large data sites
* Updated internal CTA buttons and controls from gold to blue (UX Improvement)
* Removed a console log within the map initialization controller, it is not relevant with delayed loading
* Removed the disable dynamic translation, instead we now allow this via an opt in instead
*
* 10.0.02 - 2025-11-17
* Added shapes and overlays sub-section to map editor, moving all relevant datasets into that panel (UX Improvement)
* Added ability to click on a map from the map list to open the editor (UX Improvement)
* Added primary button color to edit map button within map list (UX Improvement)
* Added blue highlight to primary dataset creation buttons to make it clearer how to add datasets (UX Improvement)
* Added button to marker quick tip notice to jump straight to marker creation (UX Improvement)
* Added conditional checks for major version mismatches in compiler, preventing mismatched major versions from throwing build errors
* Added a one time hint tool to our internal map editor tour system, which will show helpful usage hints after the main tour is completed.
* Fixed issue where Google Maps logo would not display on some installations, within the engine selector
* Fixed issue where plugins that load bootstrap in our editor might cause editor placement issues, plugin conflict
* Fixed issue where map preview would not generate on some themes. We now generate a draft page, which is reused and pruned when new previews are created
* Moved save map notice in map editor to top anchor
* Moved add marker quick tip notice in map editor to bottom left anchor
* Removed bounds reset system when adding a marker to a map, to allow multiple markers to be added to the same region without reset
*
* 10.0.01 - 2025-11-10
* Fixed issue with compatibility layer for older versions of Pro add-on (V8 and below)
*
* 10.0.00 - 2025-11-10
* Added Leaflet engine support
* Added Azure engine, powered by Leaflet
* Added Stadia engine, powered by Leaflet
* Added Maptiler engine, powered by Leaflet
* Added LocationIQ engine, powered by Leaflet
* Added support for OpenLayers V10
* Added ability to use legacy (V6) OpenLayers, should be considered deprecated. Will be removed in the future
* Added ability to change address providers, for autocomplete and client side geocoding
* Added additional address providers including Google Maps, Azure Maps, Nominatim, LocationIQ and engine default
* Added ability to provide a supplementary address provider API key if needed
* Added ability to switch tile servers, with another from the same provider, on a per map basis
* Added additional tile server options, with providers and automated groupings
* Added ability to set line thickness on both rectangles and circles
* Added tile server previews for improved customization
* Added support for dynamic content translations with WPML
* Added Atlas Novus as the default internal build
* Added danger zone tool to reindex any spatial coordinate data for markers, where a spatial coordinate has gone missing
* Added ability to adjust rectangle boundaries with boundary input
* Added ability to bulk delete shapes
* Added ability to center on shapes and datasets within the editor
* Added dropdown context meny to shape datatables
* Added option to cachebust REST API requests
* Added improved GDPR styling, it becomes the new default
* Added quick delete button to info-window within the map editor
* Added ability to override any HTML template part via a child theme override
* Added map preview system, allowing maps to be previewed on frontpage
* Added default indexes to all tables to improve performance
* Added spatial indexes to tables where applicable to improve performance
* Added fullscreen map editor panel mode, for dataset listings, allowing more data to be viewed
* Added extended maximum zoom level (22) which is supported by all map engines
* Added mobile settings tab to editor
* Added ability to set a different map width/height for mobile devices
* Added new default engine/installer preset for zero cost mapping, for all new installations
* Added ability to reduce marker editor geocoder usage. Skips geocoding if lat/lng coordinates are present, opt in available in settings
* Added ability to select store locator button style (Icons (default), or Text) on a per map basis
* Added accessibility support, with the goal of being WCAG Level AA compliant
* - Aria labels and roles added where needed
* - Improved focus cues and managing of indexing
* - Keyboard navigation added (tab, enter, space, and escape for panels)
* - Hierarchy restructuring where needed to better support navigation
* - Tested with various tools:
* - - Microsoft Accessibility Insights: Pass (FastPass)
* - - Axe DevTools: Pass (WCAG Level AA)
* - - Google Lighthouse: Pass (100% Accessible)
* - - Wave Tools: Pass
* - Manual testing completed for navigation with a keyboard
* - We will continue to improve this over time
* - Known Issues
* - - Only supported on the frontend
* - - Does not allow marker selection via the map container (Marker listings supported, and encouraged for accessibility focused installations)
* - - Although a substantial rework has been implemented, this has not been verified by 3rd party compliance testers at this stage
* - - - We know that accessibility is more nuanced than simple machine driven tests, we'd like to work with our community to ensure we improve this further
* - - - Please reach out to us if you find anything that you feel should be improved as a priority!
* Improved internal autocomplete modules for better user experience and management
* Improved theme preset user interface
* Improved theme CSS editor
* Improved tile server system to handle params and authentication more efficiently
* Improved tile server system to properly attribute various service providers
* Improved settings user interface, adding sections and descriptors for better clarity
* Improved Google Maps Advanced Marker render mode support
* Improved Google Async support
* Improved zoom sliders within editor
* Improved map initialization state control
* Improved map initialization error correction
* Improved map initialization automatic delayed retry module
* Improved info-window open calls to include data-props in container for styling
* Improved styling system to allow native info-windows to inherit brand styling
* Improved open layers native info-window, now includes border radius and shadows
* Improved checkbox styling within the map viewport
* Improved available WP filters within our AjaxTable class, allowing count values to be filtered
* Improved internal shape architecture
* Improved batch loader logic and modularized method
* Improved welcome page to include new features
* Improved all option management by disabling autoloading, reducing impact on server resources
* Improved Legacy to Atlas Novus migration flow by introducing automatic map settings migration modules
* Improved DomDocument param handlers where needed
* Fixed issue where marker labels would not render & symbols correctly
* Fixed issue where major version mismatch would cause UI error to be thrown in REST API requests
* Fixed issue where shape datatables within the editor couldn't be searched fully
* Fixed issue where touch events would not dispatch on OpenLayers shapes
* Fixed issue with error suppression in DomDocument class, added LIBXML_NOERROR when
* Fixed issue where some overlays would overlap info-windows in Open Layers (Example clusters)
* Fixed issue with clustering translations in DE language files
* Fixed issue where engine switch notice would show even if the user has already switched to Atlas Novus (manually)
* Moved build selection Danger Zone
* Moved optimization options out of beta
* Moved map mobile zoom level control to mobile panel section
* Removed Stamen Design tile servers, as they have moved to Stadia
* Removed OpenPtMap tile server due to missing SSL
* Removed duplicate map fetch methods, which were unused
* Archived V9 changelogs
*
*/
/*
* NOTICE:
*
* Core code moved to legacy-core.php. This file checks two things:
*
* 1) PHP version >= 5.3 - needed for namespace and anonymous functions
* 2) DOMDocument, increasingly used throughout the plugin
*
* The following checks will cause the script to return rather than loading legacy-core.php,
* which would cause syntax errors in case of 1) and fatal errors in case of 2)
*
*/
if(!defined('ABSPATH'))
exit;
// NB: Removed - plugin class was being initialised twice previously. This should no longer be necessary
// if(defined('WPGMZA_FILE'))
// return; // NB: For some reason, the plugin activation process executes this file twice. Don't let it.
define('WPGMZA_FILE', __FILE__);
require_once(plugin_dir_path(__FILE__) . 'constants.php');
if(!function_exists('wpgmza_show_php_version_error'))
{
function wpgmza_show_php_version_error()
{
?>
<div class="notice notice-error">
<p>
<?php
_e('<strong>WP Go Maps:</strong> This plugin does not support PHP version 5.2 or below. Please use your cPanel or contact your host to switch version.', 'wp-google-maps');
?>
</p>
</div>
<?php
}
}
if(!function_exists('wpgmza_show_dom_document_error'))
{
function wpgmza_show_dom_document_error()
{
?>
<div class="notice notice-error">
<p>
<?php
_e('<strong>WP Go Maps:</strong> This plugin uses the DOMDocument class, which is unavailable on this server. Please contact your host to request they enable this library.', 'wp-google-maps');
?>
</p>
</div>
<?php
}
}
if(!function_exists('wpgmza_show_rest_api_missing_error'))
{
function wpgmza_show_rest_api_missing_error()
{
?>
<div class="notice notice-error">
<p>
<?php
_e('<strong>WP Go Maps:</strong> This plugin requires the WordPress REST API, which does not appear to be present on this installation. Please update WordPress to version 4.7 or above.', 'wp-google-maps');
?>
</p>
</div>
<?php
}
}
if (isset($_GET['page']) && ($_GET['page'] == 'wp-google-maps-menu' || $_GET['page'] == 'wp-google-maps-menu-settings')) {
global $wpgmza_pro_version;
if (isset($wpgmza_pro_version)) {
/* Check Pro Compat - V8.1.0 */
if(version_compare($wpgmza_pro_version, '8.1.0', '<')){
add_action('admin_notices', 'wpgmaps_basic_81_notice');
function wpgmaps_basic_81_notice() {
?>
<div class="notice notice-error">
<h1><?php _e('Urgent notice', 'wp-google-maps'); ?></h1>
<h3><?php _e('WP Go Maps', 'wp-google-maps'); ?></h3>
<p><?php
echo sprintf(__('You are currently using an outdated PRO version. You need to <a href="%s">update your PRO version</a> to the latest version (8.*).', 'wp-google-maps'),'update-core.php');
?></p><br />
<p>
<?php
_e('We have automatically given all PRO users the ability to update to 8.0.34 and then further to 8.1. Any major versions below 8 will no longer be supported.', 'wp-google-maps');
?>
</p><br />
<p><?php
echo sprintf(__('If you are struggling to update your Pro version from within WordPress, please get the latest ZIP file <a target="_BLANK" href="%s">here</a>.', 'wp-google-maps'),'https://www.wpgmaps.com/get-updated-version/');
?></p>
<p> </p>
</div><br />
<?php
}
}
/* Check Pro Compat - V9.0.0 */
if(version_compare($wpgmza_pro_version, '9.0.0', '<')){
// Temporary disabling, it's causing confusion mostly
//add_action('admin_notices', 'wpgmaps_basic_90_notice');
function wpgmaps_basic_90_notice() {
/* Pro9Compat will take care of switching back to legacy */
?>
<div class="notice notice-error">
<h3><?php _e('WP Go Maps', 'wp-google-maps'); ?> - <?php _e('Urgent notice', 'wp-google-maps'); ?></h3>
<p><?php
echo sprintf(__('You are currently using an outdated PRO version. You need to <a href="%s">update your PRO version</a> to the latest version (9.*).', 'wp-google-maps'),'update-core.php');
?></p><br />
<p>
<?php
_e('The plugin will remain mostly functional, but some modules may become less stable if you do not update to the latest PRO version.', 'wp-google-maps');
?>
</p><br />
<p><?php
echo sprintf(__('If you are struggling to update your Pro version from within WordPress, please get the latest ZIP file <a target="_BLANK" href="%s">here</a>.', 'wp-google-maps'),'https://www.wpgmaps.com/get-updated-version/');
?></p><br />
<p><?php
echo __('Please note, in this configuration our new Atlas Novus build cannot be enabled, which means some new features will not be available.', 'wp-google-maps');
?></p>
<p> </p>
</div><br />
<?php
}
}
}
}
if(version_compare(phpversion(), '5.3', '<'))
{
add_action('admin_notices', 'wpgmza_show_php_version_error');
return;
}
if(!class_exists('DOMDocument'))
{
add_action('admin_notices', 'wpgmza_show_dom_document_error');
return;
}
if(!function_exists('get_rest_url'))
{
add_action('admin_notices', 'wpgmza_show_rest_api_missing_error');
return;
}
if(!function_exists('wpgmza_preload_is_in_developer_mode'))
{
function wpgmza_preload_is_in_developer_mode()
{
$globalSettings = get_option('wpgmza_global_settings');
if(empty($globalSettings))
return !empty($_COOKIE['wpgmza-developer-mode']);
if(!($globalSettings = json_decode($globalSettings)))
return false;
return isset($globalSettings->developer_mode) && $globalSettings->developer_mode == true;
}
}
if(!function_exists('wpgmza_show_php8_incompatibility_error'))
{
function wpgmza_show_php8_incompatibility_error()
{
?>
<div class="notice notice-error">
<h4>WP Go Maps - Error Found</h4>
<p>
<?php
_e('PHP 8 includes significant changes from PHP 7, which may cause unexpected issues with our core functionality. WP Go Maps is not officially supported with PHP 8, but support will be added in the near future.', 'wp-google-maps');
?>
</p>
<p>
<?php
_e('To continue using WP Go Maps, please downgrade to PHP 7, as it is fully supported by our plugin.', 'wp-google-maps');
?>
</p>
</div>
<?php
}
}
if(!function_exists('wpgmzaGetUpsellLinkParams')){
/**
* Get additional upsell link params, these are query params that are appended to the
* upsell links throughout the plugin
*
* This was specifically added to allow us to track which referral users was responsible for the free installation
* which allows us to attribute any sales from that affiliate correctly on our side
*
* The method itself is being kept open ended, so that we can better control the links in the future
*
* Note: This is a procedural function just for easy scope access, but I'm not 100% happy with this. We will fix this later, I imagine
*
* @return string
*/
function wpgmzaGetUpsellLinkParams($prefix = "&"){
$params = array();
$filters = array(
'wpgmza_referral' => '__ref',
'wpgmza_fpr_referral' => 'fpr',
);
$filters = apply_filters('wpgmza_upsell_link_param_filters', $filters);
if(!empty($filters)){
foreach($filters as $action => $paramName){
$paramValue = apply_filters($action, "");
if(!empty($paramValue)){
$params[$paramName] = $paramValue;
}
}
}
$params = apply_filters('wpgmza_upsell_link_params', $params);
$params = !empty($params) ? http_build_query($params) : "";
return !empty($params) ? "{$prefix}{$params}" : "";
}
}
/**
* We now support PHP 8, so this check becomes redundant and we do ot need to prevent the core from loading
*/
/*if(version_compare(phpversion(), '8.0', '>=')){
add_action('admin_notices', 'wpgmza_show_php8_incompatibility_error');
return;
}*/
if(wpgmza_preload_is_in_developer_mode())
{
require_once(plugin_dir_path(__FILE__) . 'legacy-core.php');
}else{
try{
require_once(plugin_dir_path(__FILE__) . 'legacy-core.php');
}catch(Exception $e) {
add_action('admin_notices', function() use ($e) {
?>
<div class="notice notice-error is-dismissible">
<p>
<strong>
<?php
_e('WP Go Maps', 'wp-google-maps');
?></strong>:
<?php
_e('The plugin failed to load due to a fatal error. This is usually due to missing files, or incompatible software. Please re-install the plugin. We recommend you use PHP 5.6 or above. Technical details are as follows: ', 'wp-google-maps');
echo $e->getMessage();
?>
</p>
</div>
<?php
});
}
}