WP Google Maps - Version 7.11.42

Version Description

:- 2019-07-30 :- Medium priority = * Added checks for ABSPATH to all PHP modules * Added a console warning when Array prototype has been improperly extended, which breaks for ... in loops * Improved parameter sanitization * Dropped deprecated usage tracking function * Dropped unused GoogleGeocoder class * Dropped old admin head function, added update notice for users running Pro < 5.24 * Fixed AJAX REST API POST calls always failing nonce security check

Download this release

Release Info

Developer perryrylance
Plugin Icon 128x128 WP Google Maps
Version 7.11.42
Comparing to
See all releases

Code changes from version 7.11.41 to 7.11.42

Files changed (52) hide show
  1. base/classes/WPGM_templates.php +3 -0
  2. base/includes/credits.php +7 -0
  3. base/includes/welcome.php +7 -0
  4. base/includes/wp-google-maps-polylines.php +2 -1
  5. constants.php +3 -0
  6. includes/3rd-party-integration/class.gutenberg.php +3 -2
  7. includes/3rd-party-integration/class.wp-migrate-db-integration.php +3 -0
  8. includes/class.auto-loader.php +3 -0
  9. includes/class.crud.php +3 -0
  10. includes/class.database.php +3 -0
  11. includes/class.distance.php +3 -0
  12. includes/class.dom-document.php +3 -0
  13. includes/class.dom-element.php +3 -0
  14. includes/class.elias-fano.php +3 -0
  15. includes/class.factory.php +3 -0
  16. includes/class.gdpr-compliance.php +3 -25
  17. includes/class.global-settings.php +2 -1
  18. includes/class.google-maps-api-loader.php +3 -0
  19. includes/class.latlng.php +3 -0
  20. includes/class.map.php +3 -0
  21. includes/class.maps-engine-dialog.php +21 -1
  22. includes/class.marker-filter.php +3 -0
  23. includes/class.marker.php +3 -0
  24. includes/class.modal-dialog.php +3 -0
  25. includes/class.plugin.php +9 -0
  26. includes/class.query-fragment.php +3 -0
  27. includes/class.query.php +3 -0
  28. includes/class.rest-api.php +12 -16
  29. includes/class.script-loader.php +3 -0
  30. includes/class.selector-to-xpath.php +3 -0
  31. includes/class.strings.php +3 -0
  32. includes/compat/backwards_compat_v6.php +10 -7
  33. includes/crud-test.php +3 -0
  34. includes/google-maps/class.google-geocoder.php +1 -76
  35. includes/google-maps/class.google-map.php +3 -0
  36. includes/google-maps/class.google-maps-loader.php +3 -0
  37. includes/open-layers/class.nominatim-geocode-cache.php +11 -1
  38. includes/open-layers/class.ol-loader.php +3 -0
  39. includes/tables/class.admin-marker-datatable.php +3 -0
  40. includes/tables/class.ajax-table.php +3 -0
  41. includes/tables/class.datatable.php +3 -0
  42. includes/tables/class.marker-datatable.php +3 -0
  43. includes/tables/class.table.php +3 -0
  44. js/v8/core.js +7 -0
  45. js/v8/elias-fano.js +5 -0
  46. js/v8/maps-engine-dialog.js +2 -1
  47. js/v8/rest-api.js +31 -18
  48. js/v8/wp-google-maps.combined.js +45 -19
  49. js/v8/wp-google-maps.min.js +1 -1
  50. legacy-core.php +963 -1453
  51. readme.txt +11 -0
  52. wpGoogleMaps.php +13 -1
base/classes/WPGM_templates.php CHANGED
@@ -1,5 +1,8 @@
1
  <?php
2
 
 
 
 
3
  class WPGMAPS_templates {
4
 
5
 
1
  <?php
2
 
3
+ if(!defined('ABSPATH'))
4
+ exit;
5
+
6
  class WPGMAPS_templates {
7
 
8
 
base/includes/credits.php CHANGED
@@ -1,3 +1,10 @@
 
 
 
 
 
 
 
1
  <div class="wrap about-wrap">
2
 
3
  <h1><?php
1
+ <?php
2
+
3
+ if(!defined('ABSPATH'))
4
+ exit;
5
+
6
+ ?>
7
+
8
  <div class="wrap about-wrap">
9
 
10
  <h1><?php
base/includes/welcome.php CHANGED
@@ -1,3 +1,10 @@
 
 
 
 
 
 
 
1
  <?php global $wpgmza_global_array; ?>
2
  <div class="wrap about-wrap">
3
  <p>&nbsp;</p>
1
+ <?php
2
+
3
+ if(!defined('ABSPATH'))
4
+ exit;
5
+
6
+ ?>
7
+
8
  <?php global $wpgmza_global_array; ?>
9
  <div class="wrap about-wrap">
10
  <p>&nbsp;</p>
base/includes/wp-google-maps-polylines.php CHANGED
@@ -3,7 +3,8 @@
3
  Polylines functionality for WP Google Maps
4
  */
5
 
6
-
 
7
 
8
  /**
9
  * Render polyline editor HTML
3
  Polylines functionality for WP Google Maps
4
  */
5
 
6
+ if(!defined('ABSPATH'))
7
+ exit;
8
 
9
  /**
10
  * Render polyline editor HTML
constants.php CHANGED
@@ -1,5 +1,8 @@
1
  <?php
2
 
 
 
 
3
  global $wpdb;
4
 
5
  global $WPGMZA_TABLE_NAME_MARKERS;
1
  <?php
2
 
3
+ if(!defined('ABSPATH'))
4
+ exit;
5
+
6
  global $wpdb;
7
 
8
  global $WPGMZA_TABLE_NAME_MARKERS;
includes/3rd-party-integration/class.gutenberg.php CHANGED
@@ -2,6 +2,9 @@
2
 
3
  namespace WPGMZA\Integration;
4
 
 
 
 
5
  /**
6
  * This module integrates the plugin with the Gutenberg editor
7
  */
@@ -88,8 +91,6 @@ class Gutenberg extends \WPGMZA\Factory
88
  */
89
  public function onRender($attr)
90
  {
91
- extract($attr);
92
-
93
  $attributes = array_merge(array('id' => 1), $attr);
94
 
95
  $str = "[wpgmza";
2
 
3
  namespace WPGMZA\Integration;
4
 
5
+ if(!defined('ABSPATH'))
6
+ return;
7
+
8
  /**
9
  * This module integrates the plugin with the Gutenberg editor
10
  */
91
  */
92
  public function onRender($attr)
93
  {
 
 
94
  $attributes = array_merge(array('id' => 1), $attr);
95
 
96
  $str = "[wpgmza";
includes/3rd-party-integration/class.wp-migrate-db-integration.php CHANGED
@@ -2,6 +2,9 @@
2
 
3
  namespace WPGMZA\Integration;
4
 
 
 
 
5
  if(!class_exists('WPGMZA\\Integration\\WPMigrateDB'))
6
  {
7
  /**
2
 
3
  namespace WPGMZA\Integration;
4
 
5
+ if(!defined('ABSPATH'))
6
+ return;
7
+
8
  if(!class_exists('WPGMZA\\Integration\\WPMigrateDB'))
9
  {
10
  /**
includes/class.auto-loader.php CHANGED
@@ -2,6 +2,9 @@
2
 
3
  namespace WPGMZA;
4
 
 
 
 
5
  /**
6
  * The AutoLoader class can be used to scan a directory and register any
7
  * classes found in the PHP files there, recursively.
2
 
3
  namespace WPGMZA;
4
 
5
+ if(!defined('ABSPATH'))
6
+ return;
7
+
8
  /**
9
  * The AutoLoader class can be used to scan a directory and register any
10
  * classes found in the PHP files there, recursively.
includes/class.crud.php CHANGED
@@ -2,6 +2,9 @@
2
 
3
  namespace WPGMZA;
4
 
 
 
 
5
  /**
6
  * The CRUD class is a base class which acts as an interface between any
7
  * objects which are stored on in the database and represented in server
2
 
3
  namespace WPGMZA;
4
 
5
+ if(!defined('ABSPATH'))
6
+ return;
7
+
8
  /**
9
  * The CRUD class is a base class which acts as an interface between any
10
  * objects which are stored on in the database and represented in server
includes/class.database.php CHANGED
@@ -2,6 +2,9 @@
2
 
3
  namespace WPGMZA;
4
 
 
 
 
5
  class Database
6
  {
7
  public function __construct()
2
 
3
  namespace WPGMZA;
4
 
5
+ if(!defined('ABSPATH'))
6
+ return;
7
+
8
  class Database
9
  {
10
  public function __construct()
includes/class.distance.php CHANGED
@@ -2,6 +2,9 @@
2
 
3
  namespace WPGMZA;
4
 
 
 
 
5
  class Distance
6
  {
7
  const UNITS_KM = "km";
2
 
3
  namespace WPGMZA;
4
 
5
+ if(!defined('ABSPATH'))
6
+ return;
7
+
8
  class Distance
9
  {
10
  const UNITS_KM = "km";
includes/class.dom-document.php CHANGED
@@ -2,6 +2,9 @@
2
 
3
  namespace WPGMZA;
4
 
 
 
 
5
  require_once(plugin_dir_path(__FILE__) . 'class.dom-element.php');
6
 
7
  class DOMDocument extends \DOMDocument
2
 
3
  namespace WPGMZA;
4
 
5
+ if(!defined('ABSPATH'))
6
+ return;
7
+
8
  require_once(plugin_dir_path(__FILE__) . 'class.dom-element.php');
9
 
10
  class DOMDocument extends \DOMDocument
includes/class.dom-element.php CHANGED
@@ -2,6 +2,9 @@
2
 
3
  namespace WPGMZA;
4
 
 
 
 
5
  require_once(plugin_dir_path(__FILE__) . 'class.selector-to-xpath.php');
6
 
7
  class DOMElement extends \DOMElement
2
 
3
  namespace WPGMZA;
4
 
5
+ if(!defined('ABSPATH'))
6
+ return;
7
+
8
  require_once(plugin_dir_path(__FILE__) . 'class.selector-to-xpath.php');
9
 
10
  class DOMElement extends \DOMElement
includes/class.elias-fano.php CHANGED
@@ -2,6 +2,9 @@
2
 
3
  namespace WPGMZA;
4
 
 
 
 
5
  class EliasFano
6
  {
7
  private static $decodingTablesInitialised = false;
2
 
3
  namespace WPGMZA;
4
 
5
+ if(!defined('ABSPATH'))
6
+ return;
7
+
8
  class EliasFano
9
  {
10
  private static $decodingTablesInitialised = false;
includes/class.factory.php CHANGED
@@ -2,6 +2,9 @@
2
 
3
  namespace WPGMZA;
4
 
 
 
 
5
  /**
6
  * The Factory class is a base class which can be used to make any classes
7
  * externally extensible. A filter is added for wpgmza_create_{class} which
2
 
3
  namespace WPGMZA;
4
 
5
+ if(!defined('ABSPATH'))
6
+ return;
7
+
8
  /**
9
  * The Factory class is a base class which can be used to make any classes
10
  * externally extensible. A filter is added for wpgmza_create_{class} which
includes/class.gdpr-compliance.php CHANGED
@@ -2,6 +2,9 @@
2
 
3
  namespace WPGMZA;
4
 
 
 
 
5
  /**
6
  * This module handles all GDPR functionality for the plugin, including
7
  * displaying notices, settings and handling logic
@@ -21,13 +24,6 @@ class GDPRCompliance
21
 
22
  GDPRCompliance::$filtersBound = true;
23
  }
24
-
25
- add_action('wp_ajax_wpgmza_gdpr_privacy_policy_notice_dismissed', array($this, 'onPrivacyPolicyNoticeDismissed'));
26
-
27
- //add_action('admin_notices', array($this, 'onAdminNotices'));
28
- //add_action('admin_post_wpgmza_dismiss_admin_gdpr_warning', array($this, 'onDismissAdminWarning'));
29
-
30
- //$this->setDefaultSettings();
31
  }
32
 
33
  /**
@@ -73,24 +69,6 @@ class GDPRCompliance
73
  return array_merge($settings, $this->getDefaultSettings());
74
  }
75
 
76
- /**
77
- * Called when the user dismisses the "check our updated privacy policy" admin notice, this call is made over AJAX. This sets a flag so the notice isn't displayed again.
78
- * @return void
79
- */
80
- public function onPrivacyPolicyNoticeDismissed()
81
- {
82
- $wpgmza_other_settings = get_option('WPGMZA_OTHER_SETTINGS');
83
- $wpgmza_other_settings['privacy_policy_notice_dismissed'] = true;
84
-
85
- update_option('WPGMZA_OTHER_SETTINGS', $wpgmza_other_settings);
86
-
87
- wp_send_json(array(
88
- 'success' => 1
89
- ));
90
-
91
- exit;
92
- }
93
-
94
  /**
95
  * Called by onGlobalSettingsTabContent to add the content to our GDPR tab on the settings page, triggered by the filter wpgmza_global_settings_tab_content.
96
  * @return DOMDocument The GDPR tab content
2
 
3
  namespace WPGMZA;
4
 
5
+ if(!defined('ABSPATH'))
6
+ return;
7
+
8
  /**
9
  * This module handles all GDPR functionality for the plugin, including
10
  * displaying notices, settings and handling logic
24
 
25
  GDPRCompliance::$filtersBound = true;
26
  }
 
 
 
 
 
 
 
27
  }
28
 
29
  /**
69
  return array_merge($settings, $this->getDefaultSettings());
70
  }
71
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
72
  /**
73
  * Called by onGlobalSettingsTabContent to add the content to our GDPR tab on the settings page, triggered by the filter wpgmza_global_settings_tab_content.
74
  * @return DOMDocument The GDPR tab content
includes/class.global-settings.php CHANGED
@@ -2,7 +2,8 @@
2
 
3
  namespace WPGMZA;
4
 
5
-
 
6
 
7
  require_once(plugin_dir_path(__DIR__) . 'lib/codecabin/class.settings.php');
8
 
2
 
3
  namespace WPGMZA;
4
 
5
+ if(!defined('ABSPATH'))
6
+ return;
7
 
8
  require_once(plugin_dir_path(__DIR__) . 'lib/codecabin/class.settings.php');
9
 
includes/class.google-maps-api-loader.php CHANGED
@@ -2,6 +2,9 @@
2
 
3
  namespace WPGMZA;
4
 
 
 
 
5
  if(class_exists('WPGMZA\\GoogleMapsAPILoader'))
6
  return;
7
 
2
 
3
  namespace WPGMZA;
4
 
5
+ if(!defined('ABSPATH'))
6
+ return;
7
+
8
  if(class_exists('WPGMZA\\GoogleMapsAPILoader'))
9
  return;
10
 
includes/class.latlng.php CHANGED
@@ -2,6 +2,9 @@
2
 
3
  namespace WPGMZA;
4
 
 
 
 
5
  /**
6
  * This class represents a latitude and longitude coordinate pair, provides type consistency for latitude and longitude, and some utility functions
7
  */
2
 
3
  namespace WPGMZA;
4
 
5
+ if(!defined('ABSPATH'))
6
+ return;
7
+
8
  /**
9
  * This class represents a latitude and longitude coordinate pair, provides type consistency for latitude and longitude, and some utility functions
10
  */
includes/class.map.php CHANGED
@@ -2,6 +2,9 @@
2
 
3
  namespace WPGMZA;
4
 
 
 
 
5
  require_once(plugin_dir_path(__FILE__) . 'class.crud.php');
6
 
7
  /**
2
 
3
  namespace WPGMZA;
4
 
5
+ if(!defined('ABSPATH'))
6
+ return;
7
+
8
  require_once(plugin_dir_path(__FILE__) . 'class.crud.php');
9
 
10
  /**
includes/class.maps-engine-dialog.php CHANGED
@@ -2,6 +2,9 @@
2
 
3
  namespace WPGMZA;
4
 
 
 
 
5
  /**
6
  * This class represents the map engine selection dialog, which is presented to the user on the map edit page.
7
  */
@@ -13,6 +16,20 @@ class MapsEngineDialog
13
  */
14
  public static function post()
15
  {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16
  $settings = get_option('WPGMZA_OTHER_SETTINGS');
17
 
18
  $settings['wpgmza_maps_engine'] = $_POST['engine'];
@@ -31,7 +48,10 @@ class MapsEngineDialog
31
  public function html()
32
  {
33
  ?>
34
- <div id="wpgmza-maps-engine-dialog" style="display: none;">
 
 
 
35
  <h1>
36
  <?php
37
  _e('Choose a maps engine', 'wp-google-maps');
2
 
3
  namespace WPGMZA;
4
 
5
+ if(!defined('ABSPATH'))
6
+ return;
7
+
8
  /**
9
  * This class represents the map engine selection dialog, which is presented to the user on the map edit page.
10
  */
16
  */
17
  public static function post()
18
  {
19
+ global $wpgmza;
20
+
21
+ if(!wp_verify_nonce($_POST['nonce'], 'wpgmza_maps_engine_dialog_set_engine'))
22
+ {
23
+ http_response_code(403);
24
+ exit;
25
+ }
26
+
27
+ if(!$wpgmza->isUserAllowedToEdit)
28
+ {
29
+ http_response_code(401);
30
+ exit;
31
+ }
32
+
33
  $settings = get_option('WPGMZA_OTHER_SETTINGS');
34
 
35
  $settings['wpgmza_maps_engine'] = $_POST['engine'];
48
  public function html()
49
  {
50
  ?>
51
+ <div
52
+ id="wpgmza-maps-engine-dialog" style="display: none;"
53
+ data-ajax-nonce="<?php wp_create_nonce('wpgmza_maps_engine_dialog_set_engine'); ?>"
54
+ >
55
  <h1>
56
  <?php
57
  _e('Choose a maps engine', 'wp-google-maps');
includes/class.marker-filter.php CHANGED
@@ -4,6 +4,9 @@
4
 
5
  namespace WPGMZA;
6
 
 
 
 
7
  class MarkerFilter extends Factory
8
  {
9
  protected $_center;
4
 
5
  namespace WPGMZA;
6
 
7
+ if(!defined('ABSPATH'))
8
+ return;
9
+
10
  class MarkerFilter extends Factory
11
  {
12
  protected $_center;
includes/class.marker.php CHANGED
@@ -2,6 +2,9 @@
2
 
3
  namespace WPGMZA;
4
 
 
 
 
5
  // TODO: Remove, autoloaders are now used
6
  require_once(plugin_dir_path(__FILE__) . '/class.crud.php');
7
 
2
 
3
  namespace WPGMZA;
4
 
5
+ if(!defined('ABSPATH'))
6
+ return;
7
+
8
  // TODO: Remove, autoloaders are now used
9
  require_once(plugin_dir_path(__FILE__) . '/class.crud.php');
10
 
includes/class.modal-dialog.php CHANGED
@@ -2,6 +2,9 @@
2
 
3
  namespace WPGMZA;
4
 
 
 
 
5
  /**
6
  * Base class for remodal dependent modal dialogs. This class enqueues the relevant scripts and styles.
7
  */
2
 
3
  namespace WPGMZA;
4
 
5
+ if(!defined('ABSPATH'))
6
+ return;
7
+
8
  /**
9
  * Base class for remodal dependent modal dialogs. This class enqueues the relevant scripts and styles.
10
  */
includes/class.plugin.php CHANGED
@@ -2,6 +2,9 @@
2
 
3
  namespace WPGMZA;
4
 
 
 
 
5
  /**
6
  * This class represents the plugin itself. Broadly, this module handles practically all interaction with the platform (WP), loading assets as needed, and hooking into the platforms interface to provide menus etc.
7
  *
@@ -337,6 +340,12 @@ class Plugin extends Factory
337
 
338
  return $mofile;
339
  }
 
 
 
 
 
 
340
  }
341
 
342
  add_action('plugins_loaded', function() {
2
 
3
  namespace WPGMZA;
4
 
5
+ if(!defined('ABSPATH'))
6
+ return;
7
+
8
  /**
9
  * This class represents the plugin itself. Broadly, this module handles practically all interaction with the platform (WP), loading assets as needed, and hooking into the platforms interface to provide menus etc.
10
  *
340
 
341
  return $mofile;
342
  }
343
+
344
+ public function isUserAllowedToEdit()
345
+ {
346
+ $capability = (empty($this->settings->wpgmza_settings_access_level) ? 'manage_options' : $this->settings->wpgmza_settings_access_level);
347
+ return current_user_can($capability);
348
+ }
349
  }
350
 
351
  add_action('plugins_loaded', function() {
includes/class.query-fragment.php CHANGED
@@ -2,6 +2,9 @@
2
 
3
  namespace WPGMZA;
4
 
 
 
 
5
  class QueryFragment implements \ArrayAccess, \Countable
6
  {
7
  private $nextIndex = 0;
2
 
3
  namespace WPGMZA;
4
 
5
+ if(!defined('ABSPATH'))
6
+ return;
7
+
8
  class QueryFragment implements \ArrayAccess, \Countable
9
  {
10
  private $nextIndex = 0;
includes/class.query.php CHANGED
@@ -2,6 +2,9 @@
2
 
3
  namespace WPGMZA;
4
 
 
 
 
5
  class Query
6
  {
7
  private $_type;
2
 
3
  namespace WPGMZA;
4
 
5
+ if(!defined('ABSPATH'))
6
+ return;
7
+
8
  class Query
9
  {
10
  private $_type;
includes/class.rest-api.php CHANGED
@@ -2,6 +2,9 @@
2
 
3
  namespace WPGMZA;
4
 
 
 
 
5
  /**
6
  * This class facilitates all communication between the client and any server side modules which can be interacted with through the WordPress REST API.
7
  */
@@ -28,7 +31,7 @@ class RestAPI extends Factory
28
  add_action('rest_api_init', array($this, 'onRestAPIInit'));
29
 
30
  add_action('parse_request', array($this, 'onParseRequest'));
31
- add_action('admin_init', array($this, 'onAdminInit'));
32
 
33
  // WP REST Cache integration
34
  add_filter('wp_rest_cache/allowed_endpoints', array($this, 'onWPRestCacheAllowedEndpoints'));
@@ -102,7 +105,8 @@ class RestAPI extends Factory
102
 
103
  $this->addRestNonce($route);
104
 
105
- return;
 
106
  }
107
 
108
  $callback = $args['callback'];
@@ -223,6 +227,8 @@ class RestAPI extends Factory
223
 
224
  protected function registerRoutes()
225
  {
 
 
226
  $this->registerRoute('/maps(\/\d+)?/', array(
227
  'methods' => 'GET',
228
  'callback' => array($this, 'maps')
@@ -242,9 +248,7 @@ class RestAPI extends Factory
242
  $this->registerRoute('/markers(\/\d+)?/', array(
243
  'methods' => array('DELETE'),
244
  'callback' => array($this, 'markers'),
245
- 'permission_callback' => function() {
246
- return current_user_can('administrator');
247
- }
248
  ));
249
 
250
  $this->registerRoute('/datatables', array(
@@ -295,19 +299,11 @@ class RestAPI extends Factory
295
  $this->registerRoutes();
296
  }
297
 
298
- public function onAdminInit()
299
  {
300
  $this->registerRoutes();
301
  }
302
 
303
- public function onRestAPI($request)
304
- {
305
- if(isset($_POST['dismiss_blocked_notice']))
306
- delete_option('wpgmza_last_rest_api_blocked');
307
-
308
- return array('success' => 1);
309
- }
310
-
311
  protected function sendAJAXResponse($result, $code=200)
312
  {
313
  if($code != 200)
@@ -356,7 +352,7 @@ class RestAPI extends Factory
356
  'status' => 404
357
  )
358
  ), 404);
359
- return;
360
  }
361
 
362
  // Check permissions
@@ -373,7 +369,7 @@ class RestAPI extends Factory
373
  'status' => 403
374
  )
375
  ), 403);
376
- return;
377
  }
378
  }
379
 
2
 
3
  namespace WPGMZA;
4
 
5
+ if(!defined('ABSPATH'))
6
+ return;
7
+
8
  /**
9
  * This class facilitates all communication between the client and any server side modules which can be interacted with through the WordPress REST API.
10
  */
31
  add_action('rest_api_init', array($this, 'onRestAPIInit'));
32
 
33
  add_action('parse_request', array($this, 'onParseRequest'));
34
+ add_action('init', array($this, 'onInit'));
35
 
36
  // WP REST Cache integration
37
  add_filter('wp_rest_cache/allowed_endpoints', array($this, 'onWPRestCacheAllowedEndpoints'));
105
 
106
  $this->addRestNonce($route);
107
 
108
+ if(!wp_doing_ajax())
109
+ return;
110
  }
111
 
112
  $callback = $args['callback'];
227
 
228
  protected function registerRoutes()
229
  {
230
+ global $wpgmza;
231
+
232
  $this->registerRoute('/maps(\/\d+)?/', array(
233
  'methods' => 'GET',
234
  'callback' => array($this, 'maps')
248
  $this->registerRoute('/markers(\/\d+)?/', array(
249
  'methods' => array('DELETE'),
250
  'callback' => array($this, 'markers'),
251
+ 'permission_callback' => array($wpgmza, 'isUserAllowedToEdit')
 
 
252
  ));
253
 
254
  $this->registerRoute('/datatables', array(
299
  $this->registerRoutes();
300
  }
301
 
302
+ public function onInit()
303
  {
304
  $this->registerRoutes();
305
  }
306
 
 
 
 
 
 
 
 
 
307
  protected function sendAJAXResponse($result, $code=200)
308
  {
309
  if($code != 200)
352
  'status' => 404
353
  )
354
  ), 404);
355
+ exit;
356
  }
357
 
358
  // Check permissions
369
  'status' => 403
370
  )
371
  ), 403);
372
+ exit;
373
  }
374
  }
375
 
includes/class.script-loader.php CHANGED
@@ -2,6 +2,9 @@
2
 
3
  namespace WPGMZA;
4
 
 
 
 
5
  // TODO: Remove, an autoloader is now used
6
  require_once(plugin_dir_path(__FILE__) . 'google-maps/class.google-maps-loader.php');
7
  require_once(plugin_dir_path(__FILE__) . 'open-layers/class.ol-loader.php');
2
 
3
  namespace WPGMZA;
4
 
5
+ if(!defined('ABSPATH'))
6
+ return;
7
+
8
  // TODO: Remove, an autoloader is now used
9
  require_once(plugin_dir_path(__FILE__) . 'google-maps/class.google-maps-loader.php');
10
  require_once(plugin_dir_path(__FILE__) . 'open-layers/class.ol-loader.php');
includes/class.selector-to-xpath.php CHANGED
@@ -6,6 +6,9 @@
6
 
7
  namespace WPGMZA\Selector;
8
 
 
 
 
9
  /**
10
  * Useful when debugging CSS selector to XPath query conversion
11
  * @param string $str The string to output
6
 
7
  namespace WPGMZA\Selector;
8
 
9
+ if(!defined('ABSPATH'))
10
+ return;
11
+
12
  /**
13
  * Useful when debugging CSS selector to XPath query conversion
14
  * @param string $str The string to output
includes/class.strings.php CHANGED
@@ -2,6 +2,9 @@
2
 
3
  namespace WPGMZA;
4
 
 
 
 
5
  /**
6
  * This class is a container for all localized strings used by the plugin.
7
  * In the future, functionality will be added to build a dummy static string file from dynamic strings in the database, this will allow 3rd party software to scan dynamic strings for translation
2
 
3
  namespace WPGMZA;
4
 
5
+ if(!defined('ABSPATH'))
6
+ return;
7
+
8
  /**
9
  * This class is a container for all localized strings used by the plugin.
10
  * In the future, functionality will be added to build a dummy static string file from dynamic strings in the database, this will allow 3rd party software to scan dynamic strings for translation
includes/compat/backwards_compat_v6.php CHANGED
@@ -45,7 +45,10 @@ add_action("wpgmza_check_map_editor_backwards_compat", "wpgmza_check_map_editor_
45
  * Checks if the Pro version is less than the last v6
46
  * Set's up backwards compatibility if this is the case
47
  */
48
- function wpgmza_check_map_editor_backwards_compat_v6(){
 
 
 
49
  if(isset($_GET['action'])){
50
  if ($_GET['action'] == "edit" && isset($_GET['map_id']) && wpgmza_check_pro_compat_required_v6()) {
51
  wp_register_script('wpgmaps-admin-backwards-compat', plugins_url('js/backwards_compat_v6.js', __FILE__), array('jquery', "jquery-ui-core"), '1.0', true);
@@ -57,23 +60,23 @@ function wpgmza_check_map_editor_backwards_compat_v6(){
57
  <h2>
58
  " . __('Add a Circle', 'wp-google-maps') . "
59
  </h2>
60
- <span><a class=\"button-primary\" href=\"" . get_option('siteurl') . "/wp-admin/admin.php?page=wp-google-maps-menu&action=add_circle&map_id=" . $_GET['map_id'] . "\">" . __("Add a Circle", "wp-google-maps") . "</a></span>
61
- " . wpgmza_get_circles_table($_GET['map_id']) . "
62
  </div>
63
 
64
  <div id=\"tabs-rectangles\">
65
  <h2>
66
  " . __('Add a Rectangle', 'wp-google-maps') . "
67
  </h2>
68
- <span><a class=\"button-primary\" href=\"" . get_option('siteurl') . "/wp-admin/admin.php?page=wp-google-maps-menu&action=add_rectangle&map_id=" . $_GET['map_id'] . "\">" . __("Add a Rectangle", "wp-google-maps") . "</a></span>
69
- " . wpgmza_get_rectangles_table($_GET['map_id']) . "
70
  </div>";
71
 
72
  wp_localize_script('wpgmaps-admin-backwards-compat', 'wpgmza_backwards_compat_v6_marker_tab_headings', $tab_heading);
73
  wp_localize_script('wpgmaps-admin-backwards-compat', 'wpgmza_backwards_compat_v6_marker_tab_content', $tab_content);
74
 
75
- wp_localize_script('wpgmaps-admin-backwards-compat', 'wpgmza_circle_data_array', wpgmza_get_circle_data($_GET['map_id']));
76
- wp_localize_script('wpgmaps-admin-backwards-compat', 'wpgmza_rectangle_data_array', wpgmza_get_rectangle_data($_GET['map_id']));
77
 
78
  wp_enqueue_script('wpgmaps-admin-backwards-compat');
79
  }
45
  * Checks if the Pro version is less than the last v6
46
  * Set's up backwards compatibility if this is the case
47
  */
48
+ function wpgmza_check_map_editor_backwards_compat_v6()
49
+ {
50
+ $map_id = isset($_GET['map_id']) ? (int)$_GET['map_id'] : null;
51
+
52
  if(isset($_GET['action'])){
53
  if ($_GET['action'] == "edit" && isset($_GET['map_id']) && wpgmza_check_pro_compat_required_v6()) {
54
  wp_register_script('wpgmaps-admin-backwards-compat', plugins_url('js/backwards_compat_v6.js', __FILE__), array('jquery', "jquery-ui-core"), '1.0', true);
60
  <h2>
61
  " . __('Add a Circle', 'wp-google-maps') . "
62
  </h2>
63
+ <span><a class=\"button-primary\" href=\"" . get_option('siteurl') . "/wp-admin/admin.php?page=wp-google-maps-menu&action=add_circle&map_id=" . $map_id . "\">" . __("Add a Circle", "wp-google-maps") . "</a></span>
64
+ " . wpgmza_get_circles_table($map_id) . "
65
  </div>
66
 
67
  <div id=\"tabs-rectangles\">
68
  <h2>
69
  " . __('Add a Rectangle', 'wp-google-maps') . "
70
  </h2>
71
+ <span><a class=\"button-primary\" href=\"" . get_option('siteurl') . "/wp-admin/admin.php?page=wp-google-maps-menu&action=add_rectangle&map_id=" . $map_id . "\">" . __("Add a Rectangle", "wp-google-maps") . "</a></span>
72
+ " . wpgmza_get_rectangles_table($map_id) . "
73
  </div>";
74
 
75
  wp_localize_script('wpgmaps-admin-backwards-compat', 'wpgmza_backwards_compat_v6_marker_tab_headings', $tab_heading);
76
  wp_localize_script('wpgmaps-admin-backwards-compat', 'wpgmza_backwards_compat_v6_marker_tab_content', $tab_content);
77
 
78
+ wp_localize_script('wpgmaps-admin-backwards-compat', 'wpgmza_circle_data_array', wpgmza_get_circle_data($map_id));
79
+ wp_localize_script('wpgmaps-admin-backwards-compat', 'wpgmza_rectangle_data_array', wpgmza_get_rectangle_data($map_id));
80
 
81
  wp_enqueue_script('wpgmaps-admin-backwards-compat');
82
  }
includes/crud-test.php CHANGED
@@ -2,6 +2,9 @@
2
 
3
  namespace WPGMZA;
4
 
 
 
 
5
  // header('Content-type: text/plain');
6
 
7
  require_once(__DIR__ . '/class.marker.php');
2
 
3
  namespace WPGMZA;
4
 
5
+ if(!defined('ABSPATH'))
6
+ return;
7
+
8
  // header('Content-type: text/plain');
9
 
10
  require_once(__DIR__ . '/class.marker.php');
includes/google-maps/class.google-geocoder.php CHANGED
@@ -1,78 +1,3 @@
1
  <?php
2
 
3
- namespace WPGMZA;
4
-
5
- /**
6
- * Server side Google Maps geocoding.
7
- */
8
- class GoogleGeocoder
9
- {
10
- /**
11
- * @var The Google API key to be used for geocoding
12
- */
13
- public $apiKey;
14
-
15
- /**
16
- * Constructor.
17
- * @param string $apiKey The Google Maps API key to use for geocoding
18
- */
19
- public function __construct($apiKey)
20
- {
21
- $this->apiKey = $apiKey;
22
- }
23
-
24
- /**
25
- * Converts an address to a latitude longitude pair.
26
- * @param string $address The address to geocode
27
- * @throws \Exception cURL must be enabled to use this feature
28
- * @throws \Exception Failed to parse JSON response
29
- * @throws \Exception Failed to geocode address for reason given by Google
30
- * @return object An object with the lat and lng of the first coordinate pair returned by Google
31
- */
32
- public function getLatLngFromAddress($address)
33
- {
34
- if(!function_exists('\curl_init'))
35
- throw new \Exception('cURL must be enabled to use this feature');
36
-
37
- $url = 'https://maps.googleapis.com/maps/api/geocode/json?address=' . urlencode($address) . '&key=' . urlencode($this->apiKey) . '&sensor=false';
38
-
39
- $ch = curl_init($url);
40
-
41
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
42
- curl_setopt($ch, CURLOPT_REFERER, $_SERVER['HTTP_HOST']);
43
-
44
- $result = curl_exec($ch);
45
-
46
- $json = json_decode($result);
47
-
48
- do_action( 'wpgmza_google_maps_geocoded_result', $json );
49
-
50
- if(!$json)
51
- {
52
- $urlWithKeyHidden = preg_replace('/key=[A-Za-z0-9_\-]+/', '[api key]', $url);
53
- throw new \Exception("Failed to parse JSON response from $urlWithKeyHidden: " . $result . " (cURL error: " . curl_error($ch) . ")");
54
- }
55
-
56
- if(!property_exists($json, 'results'))
57
- throw new \Exception('Failed to geocode address "'.$address.'": ' . print_r($json, true));
58
-
59
- if($json->status != "OK")
60
- throw new \Exception('Failed to geocode address: "' . $address . '"');
61
-
62
- if(empty($json->results))
63
- return false;
64
-
65
- $result = $json->results[0];
66
-
67
- $location = $result->geometry->location;
68
-
69
- do_action( 'wpgmza_google_maps_geocoded_result_location', $location );
70
-
71
- return (object)array(
72
- 'lat' => $location->lat,
73
- 'lng' => $location->lng
74
- );
75
- }
76
- }
77
-
78
- ?>
1
  <?php
2
 
3
+ // Deprecated as of 7.11.42 - May be reinstated in the future
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/google-maps/class.google-map.php CHANGED
@@ -2,6 +2,9 @@
2
 
3
  namespace WPGMZA;
4
 
 
 
 
5
  require_once(plugin_dir_path(__DIR__) . 'google-maps/class.google-maps-loader.php');
6
 
7
  /*
2
 
3
  namespace WPGMZA;
4
 
5
+ if(!defined('ABSPATH'))
6
+ return;
7
+
8
  require_once(plugin_dir_path(__DIR__) . 'google-maps/class.google-maps-loader.php');
9
 
10
  /*
includes/google-maps/class.google-maps-loader.php CHANGED
@@ -2,6 +2,9 @@
2
 
3
  namespace WPGMZA;
4
 
 
 
 
5
  /**
6
  * This module loads the Google Maps API unconditionally (as opposed to the GoogleMapsAPILoader)
7
  * @deprecated This functionality will be merged into one class with GoogleMapsAPILoader
2
 
3
  namespace WPGMZA;
4
 
5
+ if(!defined('ABSPATH'))
6
+ return;
7
+
8
  /**
9
  * This module loads the Google Maps API unconditionally (as opposed to the GoogleMapsAPILoader)
10
  * @deprecated This functionality will be merged into one class with GoogleMapsAPILoader
includes/open-layers/class.nominatim-geocode-cache.php CHANGED
@@ -2,6 +2,9 @@
2
 
3
  namespace WPGMZA;
4
 
 
 
 
5
  /**
6
  * Used to facilitate communication and caching between the client and the Nominatim Geocoding service
7
  */
@@ -91,7 +94,6 @@ class NominatimGeocodeCache
91
  */
92
  function query_nominatim_cache()
93
  {
94
-
95
  $cache = new NominatimGeocodeCache();
96
  $record = $cache->get($_GET['query']);
97
 
@@ -123,6 +125,14 @@ function store_nominatim_cache()
123
  */
124
  function clear_nominatim_cache()
125
  {
 
 
 
 
 
 
 
 
126
  $cache = new NominatimGeocodeCache();
127
  $cache->clear();
128
 
2
 
3
  namespace WPGMZA;
4
 
5
+ if(!defined('ABSPATH'))
6
+ return;
7
+
8
  /**
9
  * Used to facilitate communication and caching between the client and the Nominatim Geocoding service
10
  */
94
  */
95
  function query_nominatim_cache()
96
  {
 
97
  $cache = new NominatimGeocodeCache();
98
  $record = $cache->get($_GET['query']);
99
 
125
  */
126
  function clear_nominatim_cache()
127
  {
128
+ global $wpgmza;
129
+
130
+ if(!$wpgmza->isUserAllowedToEdit())
131
+ {
132
+ http_response_code(401);
133
+ return;
134
+ }
135
+
136
  $cache = new NominatimGeocodeCache();
137
  $cache->clear();
138
 
includes/open-layers/class.ol-loader.php CHANGED
@@ -2,6 +2,9 @@
2
 
3
  namespace WPGMZA;
4
 
 
 
 
5
  /**
6
  * Loads the OpenLayers map engine
7
  */
2
 
3
  namespace WPGMZA;
4
 
5
+ if(!defined('ABSPATH'))
6
+ return;
7
+
8
  /**
9
  * Loads the OpenLayers map engine
10
  */
includes/tables/class.admin-marker-datatable.php CHANGED
@@ -2,6 +2,9 @@
2
 
3
  namespace WPGMZA;
4
 
 
 
 
5
  class AdminMarkerDataTable extends MarkerDataTable
6
  {
7
  const ID_PLACEHOLDER = '__5d5621cf7b6bb90bfb7bda85a0df7293';
2
 
3
  namespace WPGMZA;
4
 
5
+ if(!defined('ABSPATH'))
6
+ return;
7
+
8
  class AdminMarkerDataTable extends MarkerDataTable
9
  {
10
  const ID_PLACEHOLDER = '__5d5621cf7b6bb90bfb7bda85a0df7293';
includes/tables/class.ajax-table.php CHANGED
@@ -2,6 +2,9 @@
2
 
3
  namespace WPGMZA;
4
 
 
 
 
5
  class AjaxTable extends Table
6
  {
7
  public function __construct($table_name, $rest_api_route, $ajax_parameters=null)
2
 
3
  namespace WPGMZA;
4
 
5
+ if(!defined('ABSPATH'))
6
+ return;
7
+
8
  class AjaxTable extends Table
9
  {
10
  public function __construct($table_name, $rest_api_route, $ajax_parameters=null)
includes/tables/class.datatable.php CHANGED
@@ -2,6 +2,9 @@
2
 
3
  namespace WPGMZA;
4
 
 
 
 
5
  class DataTable extends AjaxTable
6
  {
7
  public function __construct($table_name, $ajax_parameters=null, $datatable_options=null)
2
 
3
  namespace WPGMZA;
4
 
5
+ if(!defined('ABSPATH'))
6
+ return;
7
+
8
  class DataTable extends AjaxTable
9
  {
10
  public function __construct($table_name, $ajax_parameters=null, $datatable_options=null)
includes/tables/class.marker-datatable.php CHANGED
@@ -2,6 +2,9 @@
2
 
3
  namespace WPGMZA;
4
 
 
 
 
5
  class MarkerDataTable extends DataTable
6
  {
7
  public function __construct($ajax_parameters=null, $datatable_options=null)
2
 
3
  namespace WPGMZA;
4
 
5
+ if(!defined('ABSPATH'))
6
+ return;
7
+
8
  class MarkerDataTable extends DataTable
9
  {
10
  public function __construct($ajax_parameters=null, $datatable_options=null)
includes/tables/class.table.php CHANGED
@@ -2,6 +2,9 @@
2
 
3
  namespace WPGMZA;
4
 
 
 
 
5
  class Table extends Factory
6
  {
7
  private $_table_name;
2
 
3
  namespace WPGMZA;
4
 
5
+ if(!defined('ABSPATH'))
6
+ return;
7
+
8
  class Table extends Factory
9
  {
10
  private $_table_name;
js/v8/core.js CHANGED
@@ -603,6 +603,13 @@ jQuery(function($) {
603
 
604
  $(window).on("load", function(event) {
605
 
 
 
 
 
 
 
 
606
  // Geolocation warnings
607
  if(window.location.protocol != 'https:')
608
  {
603
 
604
  $(window).on("load", function(event) {
605
 
606
+ // Array incorrectly extended warning
607
+ var test = [];
608
+ for(var key in test) {
609
+ console.warn("The Array object has been extended incorrectly by your theme or another plugin. This can cause issues with functionality.");
610
+ break;
611
+ }
612
+
613
  // Geolocation warnings
614
  if(window.location.protocol != 'https:')
615
  {
js/v8/elias-fano.js CHANGED
@@ -77,6 +77,7 @@ jQuery(function($) {
77
  var averageDeltaLog = Math.log2(averageDelta);
78
  var lowBitsLength = Math.floor(averageDeltaLog);
79
  var lowBitsMask = (1 << lowBitsLength) - 1;
 
80
 
81
  var maxCompressedSize = Math.floor(
82
  (
@@ -104,6 +105,10 @@ jQuery(function($) {
104
 
105
  var docIDDelta = (docID - lastDocID - 1);
106
 
 
 
 
 
107
  buffer1 <<= lowBitsLength;
108
  buffer1 |= (docIDDelta & lowBitsMask);
109
  bufferLength1 += lowBitsLength;
77
  var averageDeltaLog = Math.log2(averageDelta);
78
  var lowBitsLength = Math.floor(averageDeltaLog);
79
  var lowBitsMask = (1 << lowBitsLength) - 1;
80
+ var prev = null;
81
 
82
  var maxCompressedSize = Math.floor(
83
  (
105
 
106
  var docIDDelta = (docID - lastDocID - 1);
107
 
108
+ if(prev !== null && docID <= prev)
109
+ throw new Error("Elias Fano encoding can only be used on a sorted, ascending list of unique integers.");
110
+ prev = docID;
111
+
112
  buffer1 <<= lowBitsLength;
113
  buffer1 |= (docIDDelta & lowBitsMask);
114
  bufferLength1 += lowBitsLength;
js/v8/maps-engine-dialog.js CHANGED
@@ -51,7 +51,8 @@ jQuery(function($) {
51
  method: "POST",
52
  data: {
53
  action: "wpgmza_maps_engine_dialog_set_engine",
54
- engine: $("[name='wpgmza_maps_engine']:checked").val()
 
55
  },
56
  success: function(response, status, xhr) {
57
  window.location.reload();
51
  method: "POST",
52
  data: {
53
  action: "wpgmza_maps_engine_dialog_set_engine",
54
+ engine: $("[name='wpgmza_maps_engine']:checked").val(),
55
+ nonce: $("#wpgmza-maps-engine-dialog").attr("data-ajax-nonce")
56
  },
57
  success: function(response, status, xhr) {
58
  window.location.reload();
js/v8/rest-api.js CHANGED
@@ -18,6 +18,9 @@ jQuery(function($) {
18
  this.useAJAXFallback = false;
19
  }
20
 
 
 
 
21
  /**
22
  * Creates an instance of a RestAPI, <strong>please <em>always</em> use this function rather than calling the constructor directly</strong>.
23
  * @method
@@ -98,6 +101,8 @@ jQuery(function($) {
98
  params.data.route = route;
99
  params.data.action = "wpgmza_rest_api_request";
100
 
 
 
101
  return $.ajax(WPGMZA.ajaxurl, params);
102
  }
103
 
@@ -114,6 +119,31 @@ jQuery(function($) {
114
  throw new Error("No nonce found for route");
115
  }
116
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
117
  /**
118
  * Makes an AJAX to the REST API, this function is a wrapper for $.ajax
119
  * @method
@@ -140,24 +170,7 @@ jQuery(function($) {
140
  if(!params)
141
  params = {};
142
 
143
- var setRESTNonce = function(xhr) {
144
- xhr.setRequestHeader('X-WP-Nonce', WPGMZA.restnonce);
145
-
146
- if(params && params.method && !params.method.match(/^GET$/i))
147
- xhr.setRequestHeader('X-WPGMZA-Action-Nonce', self.getNonce(route));
148
- };
149
-
150
- if(!params.beforeSend)
151
- params.beforeSend = setRESTNonce;
152
- else
153
- {
154
- var base = params.beforeSend;
155
-
156
- params.beforeSend = function(xhr) {
157
- base(xhr);
158
- setRESTNonce(xhr);
159
- }
160
- }
161
 
162
  if(!params.error)
163
  params.error = function(xhr, status, message) {
18
  this.useAJAXFallback = false;
19
  }
20
 
21
+ WPGMZA.RestAPI.CONTEXT_REST = "REST";
22
+ WPGMZA.RestAPI.CONTEXT_AJAX = "AJAX";
23
+
24
  /**
25
  * Creates an instance of a RestAPI, <strong>please <em>always</em> use this function rather than calling the constructor directly</strong>.
26
  * @method
101
  params.data.route = route;
102
  params.data.action = "wpgmza_rest_api_request";
103
 
104
+ WPGMZA.restAPI.addNonce(route, params, WPGMZA.RestAPI.CONTEXT_AJAX);
105
+
106
  return $.ajax(WPGMZA.ajaxurl, params);
107
  }
108
 
119
  throw new Error("No nonce found for route");
120
  }
121
 
122
+ WPGMZA.RestAPI.prototype.addNonce = function(route, params, context)
123
+ {
124
+ var self = this;
125
+
126
+ var setRESTNonce = function(xhr) {
127
+ if(context == WPGMZA.RestAPI.CONTEXT_REST)
128
+ xhr.setRequestHeader('X-WP-Nonce', WPGMZA.restnonce);
129
+
130
+ if(params && params.method && !params.method.match(/^GET$/i))
131
+ xhr.setRequestHeader('X-WPGMZA-Action-Nonce', self.getNonce(route));
132
+ };
133
+
134
+ if(!params.beforeSend)
135
+ params.beforeSend = setRESTNonce;
136
+ else
137
+ {
138
+ var base = params.beforeSend;
139
+
140
+ params.beforeSend = function(xhr) {
141
+ base(xhr);
142
+ setRESTNonce(xhr);
143
+ }
144
+ }
145
+ }
146
+
147
  /**
148
  * Makes an AJAX to the REST API, this function is a wrapper for $.ajax
149
  * @method
170
  if(!params)
171
  params = {};
172
 
173
+ this.addNonce(route, params, WPGMZA.RestAPI.CONTEXT_REST);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
174
 
175
  if(!params.error)
176
  params.error = function(xhr, status, message) {
js/v8/wp-google-maps.combined.js CHANGED
@@ -605,6 +605,13 @@ jQuery(function($) {
605
 
606
  $(window).on("load", function(event) {
607
 
 
 
 
 
 
 
 
608
  // Geolocation warnings
609
  if(window.location.protocol != 'https:')
610
  {
@@ -1012,6 +1019,7 @@ jQuery(function($) {
1012
  var averageDeltaLog = Math.log2(averageDelta);
1013
  var lowBitsLength = Math.floor(averageDeltaLog);
1014
  var lowBitsMask = (1 << lowBitsLength) - 1;
 
1015
 
1016
  var maxCompressedSize = Math.floor(
1017
  (
@@ -1039,6 +1047,10 @@ jQuery(function($) {
1039
 
1040
  var docIDDelta = (docID - lastDocID - 1);
1041
 
 
 
 
 
1042
  buffer1 <<= lowBitsLength;
1043
  buffer1 |= (docIDDelta & lowBitsMask);
1044
  bufferLength1 += lowBitsLength;
@@ -3647,7 +3659,8 @@ jQuery(function($) {
3647
  method: "POST",
3648
  data: {
3649
  action: "wpgmza_maps_engine_dialog_set_engine",
3650
- engine: $("[name='wpgmza_maps_engine']:checked").val()
 
3651
  },
3652
  success: function(response, status, xhr) {
3653
  window.location.reload();
@@ -5130,6 +5143,9 @@ jQuery(function($) {
5130
  this.useAJAXFallback = false;
5131
  }
5132
 
 
 
 
5133
  /**
5134
  * Creates an instance of a RestAPI, <strong>please <em>always</em> use this function rather than calling the constructor directly</strong>.
5135
  * @method
@@ -5210,6 +5226,8 @@ jQuery(function($) {
5210
  params.data.route = route;
5211
  params.data.action = "wpgmza_rest_api_request";
5212
 
 
 
5213
  return $.ajax(WPGMZA.ajaxurl, params);
5214
  }
5215
 
@@ -5226,6 +5244,31 @@ jQuery(function($) {
5226
  throw new Error("No nonce found for route");
5227
  }
5228
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5229
  /**
5230
  * Makes an AJAX to the REST API, this function is a wrapper for $.ajax
5231
  * @method
@@ -5252,24 +5295,7 @@ jQuery(function($) {
5252
  if(!params)
5253
  params = {};
5254
 
5255
- var setRESTNonce = function(xhr) {
5256
- xhr.setRequestHeader('X-WP-Nonce', WPGMZA.restnonce);
5257
-
5258
- if(params && params.method && !params.method.match(/^GET$/i))
5259
- xhr.setRequestHeader('X-WPGMZA-Action-Nonce', self.getNonce(route));
5260
- };
5261
-
5262
- if(!params.beforeSend)
5263
- params.beforeSend = setRESTNonce;
5264
- else
5265
- {
5266
- var base = params.beforeSend;
5267
-
5268
- params.beforeSend = function(xhr) {
5269
- base(xhr);
5270
- setRESTNonce(xhr);
5271
- }
5272
- }
5273
 
5274
  if(!params.error)
5275
  params.error = function(xhr, status, message) {
605
 
606
  $(window).on("load", function(event) {
607
 
608
+ // Array incorrectly extended warning
609
+ var test = [];
610
+ for(var key in test) {
611
+ console.warn("The Array object has been extended incorrectly by your theme or another plugin. This can cause issues with functionality.");
612
+ break;
613
+ }
614
+
615
  // Geolocation warnings
616
  if(window.location.protocol != 'https:')
617
  {
1019
  var averageDeltaLog = Math.log2(averageDelta);
1020
  var lowBitsLength = Math.floor(averageDeltaLog);
1021
  var lowBitsMask = (1 << lowBitsLength) - 1;
1022
+ var prev = null;
1023
 
1024
  var maxCompressedSize = Math.floor(
1025
  (
1047
 
1048
  var docIDDelta = (docID - lastDocID - 1);
1049
 
1050
+ if(prev !== null && docID <= prev)
1051
+ throw new Error("Elias Fano encoding can only be used on a sorted, ascending list of unique integers.");
1052
+ prev = docID;
1053
+
1054
  buffer1 <<= lowBitsLength;
1055
  buffer1 |= (docIDDelta & lowBitsMask);
1056
  bufferLength1 += lowBitsLength;
3659
  method: "POST",
3660
  data: {
3661
  action: "wpgmza_maps_engine_dialog_set_engine",
3662
+ engine: $("[name='wpgmza_maps_engine']:checked").val(),
3663
+ nonce: $("#wpgmza-maps-engine-dialog").attr("data-ajax-nonce")
3664
  },
3665
  success: function(response, status, xhr) {
3666
  window.location.reload();
5143
  this.useAJAXFallback = false;
5144
  }
5145
 
5146
+ WPGMZA.RestAPI.CONTEXT_REST = "REST";
5147
+ WPGMZA.RestAPI.CONTEXT_AJAX = "AJAX";
5148
+
5149
  /**
5150
  * Creates an instance of a RestAPI, <strong>please <em>always</em> use this function rather than calling the constructor directly</strong>.
5151
  * @method
5226
  params.data.route = route;
5227
  params.data.action = "wpgmza_rest_api_request";
5228
 
5229
+ WPGMZA.restAPI.addNonce(route, params, WPGMZA.RestAPI.CONTEXT_AJAX);
5230
+
5231
  return $.ajax(WPGMZA.ajaxurl, params);
5232
  }
5233
 
5244
  throw new Error("No nonce found for route");
5245
  }
5246
 
5247
+ WPGMZA.RestAPI.prototype.addNonce = function(route, params, context)
5248
+ {
5249
+ var self = this;
5250
+
5251
+ var setRESTNonce = function(xhr) {
5252
+ if(context == WPGMZA.RestAPI.CONTEXT_REST)
5253
+ xhr.setRequestHeader('X-WP-Nonce', WPGMZA.restnonce);
5254
+
5255
+ if(params && params.method && !params.method.match(/^GET$/i))
5256
+ xhr.setRequestHeader('X-WPGMZA-Action-Nonce', self.getNonce(route));
5257
+ };
5258
+
5259
+ if(!params.beforeSend)
5260
+ params.beforeSend = setRESTNonce;
5261
+ else
5262
+ {
5263
+ var base = params.beforeSend;
5264
+
5265
+ params.beforeSend = function(xhr) {
5266
+ base(xhr);
5267
+ setRESTNonce(xhr);
5268
+ }
5269
+ }
5270
+ }
5271
+
5272
  /**
5273
  * Makes an AJAX to the REST API, this function is a wrapper for $.ajax
5274
  * @method
5295
  if(!params)
5296
  params = {};
5297
 
5298
+ this.addNonce(route, params, WPGMZA.RestAPI.CONTEXT_REST);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5299
 
5300
  if(!params.error)
5301
  params.error = function(xhr, status, message) {
js/v8/wp-google-maps.min.js CHANGED
@@ -1 +1 @@
1
- jQuery(function($){var core={maps:[],events:null,settings:null,restAPI:null,localized_strings:null,loadingHTML:'<div class="wpgmza-preloader"><div class="wpgmza-loader">...</div></div>',getScrollAnimationOffset:function(){return(WPGMZA.settings.scroll_animation_offset||0)+$("#wpadminbar").height()},animateScroll:function(element,milliseconds){var offset=WPGMZA.getScrollAnimationOffset();milliseconds||(milliseconds=WPGMZA.settings.scroll_animation_milliseconds?WPGMZA.settings.scroll_animation_milliseconds:500),$("html, body").animate({scrollTop:$(element).offset().top-offset},milliseconds)},extend:function(child,parent){var constructor=child;child.prototype=Object.create(parent.prototype),child.prototype.constructor=constructor},guid:function(){var d=(new Date).getTime();return"undefined"!=typeof performance&&"function"==typeof performance.now&&(d+=performance.now()),"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(c){var r=(d+16*Math.random())%16|0;return d=Math.floor(d/16),("x"===c?r:3&r|8).toString(16)})},hexOpacityToRGBA:function(colour,opacity){return hex=parseInt(colour.replace(/^#/,""),16),[(16711680&hex)>>16,(65280&hex)>>8,255&hex,parseFloat(opacity)]},hexToRgba:function(hex){var c;return/^#([A-Fa-f0-9]{3}){1,2}$/.test(hex)?(3==(c=hex.substring(1).split("")).length&&(c=[c[0],c[0],c[1],c[1],c[2],c[2]]),c="0x"+c.join(""),{r:c>>16&255,g:c>>8&255,b:255&c,a:1}):0},rgbaToString:function(rgba){return"rgba("+rgba.r+", "+rgba.g+", "+rgba.b+", "+rgba.a+")"},latLngRegexp:/^(\-?\d+(\.\d+)?),\s*(\-?\d+(\.\d+)?)$/,isLatLngString:function(str){if("string"!=typeof str)return null;str.match(/^\(.+\)$/)&&(str=str.replace(/^\(|\)$/,""));var m=str.match(WPGMZA.latLngRegexp);return m?new WPGMZA.LatLng({lat:parseFloat(m[1]),lng:parseFloat(m[3])}):null},stringToLatLng:function(str){var result=WPGMZA.isLatLngString(str);if(!result)throw new Error("Not a valid latLng");return result},isHexColorString:function(str){return"string"==typeof str&&!!str.match(/#[0-9A-F]{6}/i)},imageDimensionsCache:{},getImageDimensions:function(src,callback){if(WPGMZA.imageDimensionsCache[src])callback(WPGMZA.imageDimensionsCache[src]);else{var img=document.createElement("img");img.onload=function(event){var result={width:img.width,height:img.height};WPGMZA.imageDimensionsCache[src]=result,callback(result)},img.src=src}},decodeEntities:function(input){return input.replace(/&(nbsp|amp|quot|lt|gt);/g,function(m,e){return m[e]}).replace(/&#(\d+);/gi,function(m,e){return String.fromCharCode(parseInt(e,10))})},isDeveloperMode:function(){return this.settings.developer_mode||window.Cookies&&window.Cookies.get("wpgmza-developer-mode")},isProVersion:function(){return"1"==this._isProVersion},openMediaDialog:function(callback){var file_frame;if(file_frame)return file_frame.uploader.uploader.param("post_id",set_to_post_id),void file_frame.open();(file_frame=wp.media.frames.file_frame=wp.media({title:"Select a image to upload",button:{text:"Use this image"},multiple:!1})).on("select",function(){attachment=file_frame.state().get("selection").first().toJSON(),callback(attachment.id,attachment.url)}),file_frame.open()},getCurrentPosition:function(callback,watch){var nativeFunction="getCurrentPosition";if(watch&&("userlocationupdated",nativeFunction="watchPosition",WPGMZA.getCurrentPosition(callback,!1)),navigator.geolocation){var options={enableHighAccuracy:!0};navigator.geolocation[nativeFunction](function(position){callback&&callback(position),WPGMZA.events.trigger("userlocationfound")},function(error){options.enableHighAccuracy=!1,navigator.geolocation[nativeFunction](function(position){callback&&callback(position),WPGMZA.events.trigger("userlocationfound")},function(error){console.warn(error.code,error.message)},options)},options)}else console.warn("No geolocation available on this device")},watchPosition:function(callback){return WPGMZA.getCurrentPosition(callback,!0)},runCatchableTask:function(callback,friendlyErrorContainer){if(WPGMZA.isDeveloperMode())callback();else try{callback()}catch(e){var friendlyError=new WPGMZA.FriendlyError(e);$(friendlyErrorContainer).html(""),$(friendlyErrorContainer).append(friendlyError.element),$(friendlyErrorContainer).show()}},assertInstanceOf:function(instance,instanceName){var engine,fullInstanceName,pro=WPGMZA.isProVersion()?"Pro":"";switch(WPGMZA.settings.engine){case"open-layers":engine="OL";break;default:engine="Google"}if(fullInstanceName=WPGMZA[engine+pro+instanceName]?engine+pro+instanceName:WPGMZA[pro+instanceName]?pro+instanceName:WPGMZA[engine+instanceName]?engine+instanceName:instanceName,!(instance instanceof WPGMZA[fullInstanceName]))throw new Error("Object must be an instance of "+fullInstanceName+" (did you call a constructor directly, rather than createInstance?)")},getMapByID:function(id){return WPGMZA.isProVersion()?MYMAP[id].map:MYMAP.map},isGoogleAutocompleteSupported:function(){return"object"==typeof google&&"object"==typeof google.maps&&"object"==typeof google.maps.places&&"function"==typeof google.maps.places.Autocomplete},googleAPIStatus:window.wpgmza_google_api_status,isSafari:function(){var ua=navigator.userAgent.toLowerCase();return-1!=ua.indexOf("safari")&&-1==ua.indexOf("chrome")},isTouchDevice:function(){return"ontouchstart"in window},isDeviceiOS:function(){return/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream||!!navigator.platform&&/iPad|iPhone|iPod/.test(navigator.platform)},getQueryParamValue:function(name){var m,regex=new RegExp(name+"=([^&]*)");return(m=window.location.href.match(regex))?m[1]:null}};window.WPGMZA?window.WPGMZA=$.extend(window.WPGMZA,core):window.WPGMZA=core;for(var key in WPGMZA_localized_data){var value=WPGMZA_localized_data[key];WPGMZA[key]=value}jQuery(function($){$("script[src*='wp-google-maps.combined.js'], script[src*='wp-google-maps-pro.combined.js']").length&&console.warn("Minified script is out of date, using combined script instead.");var elements=$("script").filter(function(){return this.src.match(/(^|\/)jquery\.(min\.)?js(\?|$)/i)});elements.length>1&&console.warn("Multiple jQuery versions detected: ",elements),WPGMZA.restAPI=WPGMZA.RestAPI.createInstance(),$(document).on("click",".wpgmza_edit_btn",function(){WPGMZA.animateScroll("#wpgmaps_tabs_markers")})}),$(window).on("load",function(event){if("https:"!=window.location.protocol){var warning='<div class="notice notice-warning"><p>'+WPGMZA.localized_strings.unsecure_geolocation+"</p></div>";$(".wpgmza-geolocation-setting").each(function(index,el){$(el).after($(warning))})}})}),jQuery(function($){WPGMZA.Compatibility=function(){this.preventDocumentWriteGoogleMapsAPI()},WPGMZA.Compatibility.prototype.preventDocumentWriteGoogleMapsAPI=function(){var old=document.write;document.write=function(content){content.match&&content.match(/maps\.google/)||old.call(document,content)}},WPGMZA.compatiblityModule=new WPGMZA.Compatibility}),function(root,factory){"object"==typeof exports?module.exports=factory(root):"function"==typeof define&&define.amd?define([],factory.bind(root,root)):factory(root)}("undefined"!=typeof global?global:this,function(root){if(root.CSS&&root.CSS.escape)return root.CSS.escape;var cssEscape=function(value){if(0==arguments.length)throw new TypeError("`CSS.escape` requires an argument.");for(var codeUnit,string=String(value),length=string.length,index=-1,result="",firstCodeUnit=string.charCodeAt(0);++index<length;)0!=(codeUnit=string.charCodeAt(index))?result+=codeUnit>=1&&codeUnit<=31||127==codeUnit||0==index&&codeUnit>=48&&codeUnit<=57||1==index&&codeUnit>=48&&codeUnit<=57&&45==firstCodeUnit?"\\"+codeUnit.toString(16)+" ":(0!=index||1!=length||45!=codeUnit)&&(codeUnit>=128||45==codeUnit||95==codeUnit||codeUnit>=48&&codeUnit<=57||codeUnit>=65&&codeUnit<=90||codeUnit>=97&&codeUnit<=122)?string.charAt(index):"\\"+string.charAt(index):result+="�";return result};return root.CSS||(root.CSS={}),root.CSS.escape=cssEscape,cssEscape}),jQuery(function($){function deg2rad(deg){return deg*(Math.PI/180)}Math.PI;WPGMZA.Distance={MILES:!0,KILOMETERS:!1,MILES_PER_KILOMETER:.621371,KILOMETERS_PER_MILE:1.60934,uiToMeters:function(uiDistance){return parseFloat(uiDistance)/(WPGMZA.settings.distance_units==WPGMZA.Distance.MILES?WPGMZA.Distance.MILES_PER_KILOMETER:1)*1e3},uiToKilometers:function(uiDistance){return.001*WPGMZA.Distance.uiToMeters(uiDistance)},uiToMiles:function(uiDistance){return WPGMZA.Distance.uiToKilometers(uiDistance)*WPGMZA.Distance.MILES_PER_KILOMETER},kilometersToUI:function(km){return WPGMZA.settings.distance_units==WPGMZA.Distance.MILES?km*WPGMZA.Distance.MILES_PER_KILOMETER:km},between:function(a,b){if(!(a instanceof WPGMZA.LatLng))throw new Error("First argument must be an instance of WPGMZA.LatLng");if(!(b instanceof WPGMZA.LatLng))throw new Error("Second argument must be an instance of WPGMZA.LatLng");if(a===b)return 0;var lat1=a.lat,lon1=a.lng,lat2=b.lat,lon2=b.lng,dLat=deg2rad(lat2-lat1),dLon=deg2rad(lon2-lon1),a=Math.sin(dLat/2)*Math.sin(dLat/2)+Math.cos(deg2rad(lat1))*Math.cos(deg2rad(lat2))*Math.sin(dLon/2)*Math.sin(dLon/2);return 6371*(2*Math.atan2(Math.sqrt(a),Math.sqrt(1-a)))}}}),jQuery(function($){WPGMZA.EliasFano=function(){if(!WPGMZA.EliasFano.isSupported)throw new Error("Elias Fano encoding is not supported on browsers without Uint8Array");WPGMZA.EliasFano.decodingTablesInitialised||WPGMZA.EliasFano.createDecodingTable()},WPGMZA.EliasFano.isSupported="Uint8Array"in window,WPGMZA.EliasFano.decodingTableHighBits=[],WPGMZA.EliasFano.decodingTableDocIDNumber=null,WPGMZA.EliasFano.decodingTableHighBitsCarryover=null,WPGMZA.EliasFano.createDecodingTable=function(){WPGMZA.EliasFano.decodingTableDocIDNumber=new Uint8Array(256),WPGMZA.EliasFano.decodingTableHighBitsCarryover=new Uint8Array(256);for(var decodingTableHighBits=WPGMZA.EliasFano.decodingTableHighBits,decodingTableDocIDNumber=WPGMZA.EliasFano.decodingTableDocIDNumber,decodingTableHighBitsCarryover=WPGMZA.EliasFano.decodingTableHighBitsCarryover,i=0;i<256;i++){var zeroCount=0;decodingTableHighBits[i]=[];for(var j=7;j>=0;j--)(i&1<<j)>0?(decodingTableHighBits[i][decodingTableDocIDNumber[i]]=zeroCount,decodingTableDocIDNumber[i]++,zeroCount=0):zeroCount=(zeroCount+1)%255;decodingTableHighBitsCarryover[i]=zeroCount}WPGMZA.EliasFano.decodingTablesInitialised=!0},WPGMZA.EliasFano.prototype.encode=function(list){function toByte(n){return 255&n}var lastDocID=0,buffer1=0,bufferLength1=0,buffer2=0,bufferLength2=0;if(0==list.length)return result;var compressedBufferPointer1=0,compressedBufferPointer2=0,averageDelta=list[list.length-1]/list.length,averageDeltaLog=Math.log2(averageDelta),lowBitsLength=Math.floor(averageDeltaLog),lowBitsMask=(1<<lowBitsLength)-1,maxCompressedSize=Math.floor((2+Math.ceil(Math.log2(averageDelta)))*list.length/8)+6,compressedBuffer=new Uint8Array(maxCompressedSize);lowBitsLength<0&&(lowBitsLength=0),compressedBufferPointer2=Math.floor(lowBitsLength*list.length/8+6),compressedBuffer[compressedBufferPointer1++]=toByte(list.length),compressedBuffer[compressedBufferPointer1++]=toByte(list.length>>8),compressedBuffer[compressedBufferPointer1++]=toByte(list.length>>16),compressedBuffer[compressedBufferPointer1++]=toByte(list.length>>24),compressedBuffer[compressedBufferPointer1++]=toByte(lowBitsLength),list.forEach(function(docID){var docIDDelta=docID-lastDocID-1;for(buffer1<<=lowBitsLength,buffer1|=docIDDelta&lowBitsMask,bufferLength1+=lowBitsLength;bufferLength1>7;)bufferLength1-=8,compressedBuffer[compressedBufferPointer1++]=toByte(buffer1>>bufferLength1);var unaryCodeLength=1+(docIDDelta>>lowBitsLength);for(buffer2<<=unaryCodeLength,buffer2|=1,bufferLength2+=unaryCodeLength;bufferLength2>7;)bufferLength2-=8,compressedBuffer[compressedBufferPointer2++]=toByte(buffer2>>bufferLength2);lastDocID=docID}),bufferLength1>0&&(compressedBuffer[compressedBufferPointer1++]=toByte(buffer1<<8-bufferLength1)),bufferLength2>0&&(compressedBuffer[compressedBufferPointer2++]=toByte(buffer2<<8-bufferLength2));var result=new Uint8Array(compressedBuffer);return result.pointer=compressedBufferPointer2,result},WPGMZA.EliasFano.prototype.decode=function(compressedBuffer){var resultPointer=0,list=[];console.log("Decoding buffer from pointer "+compressedBuffer.pointer),console.log(compressedBuffer);var decodingTableHighBits=WPGMZA.EliasFano.decodingTableHighBits,decodingTableDocIDNumber=WPGMZA.EliasFano.decodingTableDocIDNumber,decodingTableHighBitsCarryover=WPGMZA.EliasFano.decodingTableHighBitsCarryover,lowBitsPointer=0,lastDocID=0,docID=0,docIDNumber=0,listCount=compressedBuffer[lowBitsPointer++];console.log("listCount is now "+listCount),listCount|=compressedBuffer[lowBitsPointer++]<<8,console.log("listCount is now "+listCount),listCount|=compressedBuffer[lowBitsPointer++]<<16,console.log("listCount is now "+listCount),listCount|=compressedBuffer[lowBitsPointer++]<<24,console.log("Read list count "+listCount);var lowBitsLength=compressedBuffer[lowBitsPointer++];console.log("lowBitsLength = "+lowBitsLength);var highBitsPointer,lowBitsCount=0,lowBits=0,cb=1;for(highBitsPointer=Math.floor(lowBitsLength*listCount/8+6);highBitsPointer<compressedBuffer.pointer;highBitsPointer++){docID+=decodingTableHighBitsCarryover[cb],docIDNumber=decodingTableDocIDNumber[cb=compressedBuffer[highBitsPointer]];for(var i=0;i<docIDNumber;i++){for(docID<<=lowBitsCount,docID|=lowBits&(1<<lowBitsCount)-1;lowBitsCount<lowBitsLength;)docID<<=8,docID|=lowBits=compressedBuffer[lowBitsPointer++],lowBitsCount+=8;docID>>=lowBitsCount-=lowBitsLength,docID+=(decodingTableHighBits[cb][i]<<lowBitsLength)+lastDocID+1,list[resultPointer++]=docID,lastDocID=docID,docID=0}}return list}}),jQuery(function($){WPGMZA.EventDispatcher=function(){WPGMZA.assertInstanceOf(this,"EventDispatcher"),this._listenersByType={}},WPGMZA.EventDispatcher.prototype.addEventListener=function(type,listener,thisObject,useCapture){var types=type.split(/\s+/);if(types.length>1)for(var i=0;i<types.length;i++)this.addEventListener(types[i],listener,thisObject,useCapture);else{if(!(listener instanceof Function))throw new Error("Listener must be a function");var target;target=this._listenersByType.hasOwnProperty(type)?this._listenersByType[type]:this._listenersByType[type]=[];var obj={listener:listener,thisObject:thisObject||this,useCapture:!!useCapture};target.push(obj)}},WPGMZA.EventDispatcher.prototype.on=WPGMZA.EventDispatcher.prototype.addEventListener,WPGMZA.EventDispatcher.prototype.removeEventListener=function(type,listener,thisObject,useCapture){var arr,obj;if(arr=this._listenersByType[type]){thisObject||(thisObject=this),useCapture=!!useCapture;for(var i=0;i<arr.length;i++)if((obj=arr[i]).listener==listener&&obj.thisObject==thisObject&&obj.useCapture==useCapture)return void arr.splice(i,1)}},WPGMZA.EventDispatcher.prototype.off=WPGMZA.EventDispatcher.prototype.removeEventListener,WPGMZA.EventDispatcher.prototype.hasEventListener=function(type){return!!_listenersByType[type]},WPGMZA.EventDispatcher.prototype.dispatchEvent=function(event){if(!(event instanceof WPGMZA.Event))if("string"==typeof event)event=new WPGMZA.Event(event);else{var src=event;event=new WPGMZA.Event;for(var name in src)event[name]=src[name]}event.target=this;for(var path=[],obj=this.parent;null!=obj;obj=obj.parent)path.unshift(obj);event.phase=WPGMZA.Event.CAPTURING_PHASE;for(var i=0;i<path.length&&!event._cancelled;i++)path[i]._triggerListeners(event);if(!event._cancelled){for(event.phase=WPGMZA.Event.AT_TARGET,this._triggerListeners(event),event.phase=WPGMZA.Event.BUBBLING_PHASE,i=path.length-1;i>=0&&!event._cancelled;i--)path[i]._triggerListeners(event);if(this.element){var customEvent={};for(var key in event){var value=event[key];"type"==key&&(value+=".wpgmza"),customEvent[key]=value}$(this.element).trigger(customEvent)}}},WPGMZA.EventDispatcher.prototype.trigger=WPGMZA.EventDispatcher.prototype.dispatchEvent,WPGMZA.EventDispatcher.prototype._triggerListeners=function(event){var arr,obj;if(arr=this._listenersByType[event.type])for(var i=0;i<arr.length;i++)obj=arr[i],(event.phase!=WPGMZA.Event.CAPTURING_PHASE||obj.useCapture)&&obj.listener.call(arr[i].thisObject,event)},WPGMZA.events=new WPGMZA.EventDispatcher}),jQuery(function($){WPGMZA.Event=function(options){if("string"==typeof options&&(this.type=options),this.bubbles=!0,this.cancelable=!0,this.phase=WPGMZA.Event.PHASE_CAPTURE,this.target=null,this._cancelled=!1,"object"==typeof options)for(var name in options)this[name]=options[name]},WPGMZA.Event.CAPTURING_PHASE=0,WPGMZA.Event.AT_TARGET=1,WPGMZA.Event.BUBBLING_PHASE=2,WPGMZA.Event.prototype.stopPropagation=function(){this._cancelled=!0}}),jQuery(function($){WPGMZA.FriendlyError=function(){}}),jQuery(function($){WPGMZA.Geocoder=function(){WPGMZA.assertInstanceOf(this,"Geocoder")},WPGMZA.Geocoder.SUCCESS="success",WPGMZA.Geocoder.ZERO_RESULTS="zero-results",WPGMZA.Geocoder.FAIL="fail",WPGMZA.Geocoder.getConstructor=function(){switch(WPGMZA.settings.engine){case"open-layers":return WPGMZA.OLGeocoder;default:return WPGMZA.GoogleGeocoder}},WPGMZA.Geocoder.createInstance=function(){return new(WPGMZA.Geocoder.getConstructor())},WPGMZA.Geocoder.prototype.getLatLngFromAddress=function(options,callback){if(WPGMZA.isLatLngString(options.address)){var parts=options.address.split(/,\s*/);callback([new WPGMZA.LatLng({lat:parseFloat(parts[0]),lng:parseFloat(parts[1])})],WPGMZA.Geocoder.SUCCESS)}},WPGMZA.Geocoder.prototype.getAddressFromLatLng=function(options,callback){callback([new WPGMZA.LatLng(options.latLng).toString()],WPGMZA.Geocoder.SUCCESS)},WPGMZA.Geocoder.prototype.geocode=function(options,callback){if("address"in options)return this.getLatLngFromAddress(options,callback);if("latLng"in options)return this.getAddressFromLatLng(options,callback);throw new Error("You must supply either a latLng or address")}}),jQuery(function($){WPGMZA.GoogleAPIErrorHandler=function(){var self=this;if("google-maps"==WPGMZA.settings.engine&&("map-edit"==WPGMZA.currentPage||0==WPGMZA.is_admin&&1==WPGMZA.userCanAdministrator)){this.element=$(WPGMZA.html.googleMapsAPIErrorDialog),1==WPGMZA.is_admin&&this.element.find(".wpgmza-front-end-only").remove(),this.errorMessageList=this.element.find(".wpgmza-google-api-error-list"),this.templateListItem=this.element.find("li.template").remove(),this.messagesAlreadyDisplayed={};var _error=console.error;console.error=function(message){self.onErrorMessage(message),_error.apply(this,arguments)},"google-maps"!=WPGMZA.settings.engine||WPGMZA.settings.wpgmza_google_maps_api_key&&WPGMZA.settings.wpgmza_google_maps_api_key.length||this.addErrorMessage(WPGMZA.localized_strings.no_google_maps_api_key,["https://www.wpgmaps.com/get-a-google-maps-api-key/"])}},WPGMZA.GoogleAPIErrorHandler.prototype.onErrorMessage=function(message){var m;if(message)if((m=message.match(/You have exceeded your (daily )?request quota for this API/))||(m=message.match(/This API project is not authorized to use this API/))||(m=message.match(/^Geocoding Service: .+/))){var urls=message.match(/http(s)?:\/\/[^\s]+/gm);this.addErrorMessage(m[0],urls)}else(m=message.match(/^Google Maps.+error: (.+)\s+(http(s?):\/\/.+)/m))&&this.addErrorMessage(m[1].replace(/([A-Z])/g," $1"),[m[2]])},WPGMZA.GoogleAPIErrorHandler.prototype.addErrorMessage=function(message,urls){var self=this;if(!this.messagesAlreadyDisplayed[message]){var li=this.templateListItem.clone();$(li).find(".wpgmza-message").html(message);var buttonContainer=$(li).find(".wpgmza-documentation-buttons"),buttonTemplate=$(li).find(".wpgmza-documentation-buttons>a");if(buttonTemplate.remove(),urls&&urls.length){for(var i=0;i<urls.length;i++){urls[i];var button=buttonTemplate.clone(),text=WPGMZA.localized_strings.documentation;button.attr("href",urls[i]),$(button).find("i").addClass("fa-external-link"),$(button).append(text)}buttonContainer.append(button)}$(this.errorMessageList).append(li),$("#wpgmza_map, .wpgmza_map").each(function(index,el){var container=$(el).find(".wpgmza-google-maps-api-error-overlay");0==container.length&&(container=$("<div class='wpgmza-google-maps-api-error-overlay'></div>")).html(self.element.html()),setTimeout(function(){$(el).append(container)},100)}),$(".gm-err-container").parent().css({"z-index":1}),this.messagesAlreadyDisplayed[message]=!0}},WPGMZA.googleAPIErrorHandler=new WPGMZA.GoogleAPIErrorHandler}),jQuery(function($){WPGMZA.InfoWindow=function(mapObject){var self=this;WPGMZA.EventDispatcher.call(this),WPGMZA.assertInstanceOf(this,"InfoWindow"),mapObject&&(this.mapObject=mapObject,mapObject.map?setTimeout(function(){self.onMapObjectAdded(event)},100):mapObject.addEventListener("added",function(event){self.onMapObjectAdded(event)}))},WPGMZA.InfoWindow.prototype=Object.create(WPGMZA.EventDispatcher.prototype),WPGMZA.InfoWindow.prototype.constructor=WPGMZA.InfoWindow,WPGMZA.InfoWindow.OPEN_BY_CLICK=1,WPGMZA.InfoWindow.OPEN_BY_HOVER=2,WPGMZA.InfoWindow.getConstructor=function(){switch(WPGMZA.settings.engine){case"open-layers":return WPGMZA.isProVersion()?WPGMZA.OLProInfoWindow:WPGMZA.OLInfoWindow;default:return WPGMZA.isProVersion()?WPGMZA.GoogleProInfoWindow:WPGMZA.GoogleInfoWindow}},WPGMZA.InfoWindow.createInstance=function(mapObject){return new(this.getConstructor())(mapObject)},WPGMZA.InfoWindow.prototype.getContent=function(callback){var html="";this.mapObject instanceof WPGMZA.Marker&&(html=this.mapObject.address),callback(html)},WPGMZA.InfoWindow.prototype.open=function(map,mapObject){return this.mapObject=mapObject,!WPGMZA.settings.disable_infowindows&&"1"!=WPGMZA.settings.wpgmza_settings_disable_infowindows&&!this.mapObject.disableInfoWindow},WPGMZA.InfoWindow.prototype.close=function(){this.trigger("infowindowclose")},WPGMZA.InfoWindow.prototype.setContent=function(options){},WPGMZA.InfoWindow.prototype.setOptions=function(options){},WPGMZA.InfoWindow.prototype.onMapObjectAdded=function(){1==this.mapObject.settings.infoopen&&this.open()}}),jQuery(function($){WPGMZA.LatLng=function(arg,lng){if(this._lat=0,this._lng=0,0!=arguments.length)if(1==arguments.length){if("string"==typeof arg){var m;if(!(m=arg.match(WPGMZA.LatLng.REGEXP)))throw new Error("Invalid LatLng string");arg={lat:m[1],lng:m[3]}}if("object"!=typeof arg||!("lat"in arg&&"lng"in arg))throw new Error("Argument must be a LatLng literal");this.lat=arg.lat,this.lng=arg.lng}else this.lat=arg,this.lng=lng},WPGMZA.LatLng.REGEXP=/^(\-?\d+(\.\d+)?),\s*(\-?\d+(\.\d+)?)$/,WPGMZA.LatLng.isValid=function(obj){return"object"==typeof obj&&("lat"in obj&&"lng"in obj)},Object.defineProperty(WPGMZA.LatLng.prototype,"lat",{get:function(){return this._lat},set:function(val){if(!$.isNumeric(val))throw new Error("Latitude must be numeric");this._lat=parseFloat(val)}}),Object.defineProperty(WPGMZA.LatLng.prototype,"lng",{get:function(){return this._lng},set:function(val){if(!$.isNumeric(val))throw new Error("Longitude must be numeric");this._lng=parseFloat(val)}}),WPGMZA.LatLng.prototype.toString=function(){return this._lat+", "+this._lng},WPGMZA.LatLng.fromCurrentPosition=function(callback,options){options||(options={}),callback&&WPGMZA.getCurrentPosition(function(position){var latLng=new WPGMZA.LatLng({lat:position.coords.latitude,lng:position.coords.longitude});options.geocodeAddress?WPGMZA.Geocoder.createInstance().getAddressFromLatLng({latLng:latLng},function(results){results.length&&(latLng.address=results[0]),callback(latLng)}):callback(latLng)})},WPGMZA.LatLng.fromGoogleLatLng=function(googleLatLng){return new WPGMZA.LatLng(googleLatLng.lat(),googleLatLng.lng())},WPGMZA.LatLng.prototype.toGoogleLatLng=function(){return new google.maps.LatLng({lat:this.lat,lng:this.lng})},WPGMZA.LatLng.prototype.toLatLngLiteral=function(){return{lat:this.lat,lng:this.lng}},WPGMZA.LatLng.prototype.moveByDistance=function(kilometers,heading){var delta=parseFloat(kilometers)/6371,theta=parseFloat(heading)/180*Math.PI,phi1=this.lat/180*Math.PI,lambda1=this.lng/180*Math.PI,sinPhi1=Math.sin(phi1),cosPhi1=Math.cos(phi1),sinDelta=Math.sin(delta),cosDelta=Math.cos(delta),sinTheta=Math.sin(theta),sinPhi2=sinPhi1*cosDelta+cosPhi1*sinDelta*Math.cos(theta),phi2=Math.asin(sinPhi2),y=sinTheta*sinDelta*cosPhi1,x=cosDelta-sinPhi1*sinPhi2,lambda2=lambda1+Math.atan2(y,x);this.lat=180*phi2/Math.PI,this.lng=180*lambda2/Math.PI},WPGMZA.LatLng.prototype.getGreatCircleDistance=function(arg1,arg2){var other,lat1=this.lat,lon1=this.lng;if(1==arguments.length)other=new WPGMZA.LatLng(arg1);else{if(2!=arguments.length)throw new Error("Invalid number of arguments");other=new WPGMZA.LatLng(arg1,arg2)}var lat2=other.lat,lon2=other.lng,phi1=lat1.toRadians(),phi2=lat2.toRadians(),deltaPhi=(lat2-lat1).toRadians(),deltaLambda=(lon2-lon1).toRadians(),a=Math.sin(deltaPhi/2)*Math.sin(deltaPhi/2)+Math.cos(phi1)*Math.cos(phi2)*Math.sin(deltaLambda/2)*Math.sin(deltaLambda/2);return 6371*(2*Math.atan2(Math.sqrt(a),Math.sqrt(1-a)))}}),jQuery(function($){WPGMZA.LatLngBounds=function(southWest,northEast){if(southWest instanceof WPGMZA.LatLngBounds){var other=southWest;this.south=other.south,this.north=other.north,this.west=other.west,this.east=other.east}else southWest&&northEast&&(this.south=southWest.lat,this.north=northEast.lat,this.west=southWest.lng,this.east=northEast.lng)},WPGMZA.LatLngBounds.fromGoogleLatLngBounds=function(googleLatLngBounds){if(!(googleLatLngBounds instanceof google.maps.LatLngBounds))throw new Error("Argument must be an instance of google.maps.LatLngBounds");var result=new WPGMZA.LatLngBounds,southWest=googleLatLngBounds.getSouthWest(),northEast=googleLatLngBounds.getNorthEast();return result.north=northEast.lat(),result.south=southWest.lat(),result.west=southWest.lng(),result.east=northEast.lng(),result},WPGMZA.LatLngBounds.prototype.isInInitialState=function(){return void 0==this.north&&void 0==this.south&&void 0==this.west&&void 0==this.east},WPGMZA.LatLngBounds.prototype.extend=function(latLng){if(latLng instanceof WPGMZA.LatLng||(latLng=new WPGMZA.LatLng(latLng)),this.isInInitialState())return this.north=this.south=latLng.lat,void(this.west=this.east=latLng.lng);latLng.lat<this.north&&(this.north=latLng.lat),latLng.lat>this.south&&(this.south=latLng.lat),latLng.lng<this.west&&(this.west=latLng.lng),latLng.lng>this.east&&(this.east=latLng.lng)},WPGMZA.LatLngBounds.prototype.extendByPixelMargin=function(map,x,arg){var y=x;if(!(map instanceof WPGMZA.Map))throw new Error("First argument must be an instance of WPGMZA.Map");if(this.isInInitialState())throw new Error("Cannot extend by pixels in initial state");arguments.length>=3&&(y=arg);var southWest=new WPGMZA.LatLng(this.south,this.west),northEast=new WPGMZA.LatLng(this.north,this.east);southWest=map.latLngToPixels(southWest),northEast=map.latLngToPixels(northEast),southWest.x-=x,southWest.y+=y,northEast.x+=x,northEast.y-=y,southWest=map.pixelsToLatLng(southWest.x,southWest.y),northEast=map.pixelsToLatLng(northEast.x,northEast.y);this.toString();this.north=northEast.lat,this.south=southWest.lat,this.west=southWest.lng,this.east=northEast.lng},WPGMZA.LatLngBounds.prototype.contains=function(latLng){if(!(latLng instanceof WPGMZA.LatLng))throw new Error("Argument must be an instance of WPGMZA.LatLng");return!(latLng.lat<Math.min(this.north,this.south))&&(!(latLng.lat>Math.max(this.north,this.south))&&(this.west<this.east?latLng.lng>=this.west&&latLng.lng<=this.east:latLng.lng<=this.west||latLng.lng>=this.east))},WPGMZA.LatLngBounds.prototype.toString=function(){return this.north+"N "+this.south+"S "+this.west+"W "+this.east+"E"}}),jQuery(function($){WPGMZA.MapObject=function(row){if(WPGMZA.assertInstanceOf(this,"MapObject"),WPGMZA.EventDispatcher.call(this),this.id=-1,this.guid=WPGMZA.guid(),this.modified=!0,this.settings={},row)for(var name in row)if("settings"==name){if(null==row.settings)this.settings={};else switch(typeof row.settings){case"string":this.settings=JSON.parse(row[name]);break;case"object":this.settings=row[name];break;default:throw new Error("Don't know how to interpret settings")}for(var name in this.settings){var value=this.settings[name];String(value).match(/^-?\d+$/)&&(this.settings[name]=parseInt(value))}}else this[name]=row[name]},WPGMZA.MapObject.prototype=Object.create(WPGMZA.EventDispatcher.prototype),WPGMZA.MapObject.prototype.constructor=WPGMZA.MapObject,WPGMZA.MapObject.prototype.parseGeometry=function(string){var pairs,coords,results=[];pairs=string.replace(/[^ ,\d\.\-+e]/g,"").split(",");for(var i=0;i<pairs.length;i++)coords=pairs[i].split(" "),results.push({lat:parseFloat(coords[1]),lng:parseFloat(coords[0])});return results},WPGMZA.MapObject.prototype.toJSON=function(){return{id:this.id,guid:this.guid,settings:this.settings}}}),jQuery(function($){var Parent=WPGMZA.MapObject;WPGMZA.Circle=function(options,engineCircle){WPGMZA.assertInstanceOf(this,"Circle"),this.center=new WPGMZA.LatLng,this.radius=100,Parent.apply(this,arguments)},WPGMZA.Circle.prototype=Object.create(Parent.prototype),WPGMZA.Circle.prototype.constructor=WPGMZA.Circle,WPGMZA.Circle.createInstance=function(options){var constructor;switch(WPGMZA.settings.engine){case"open-layers":constructor=WPGMZA.OLCircle;break;default:constructor=WPGMZA.GoogleCircle}return new constructor(options)},WPGMZA.Circle.prototype.getCenter=function(){return this.center.clone()},WPGMZA.Circle.prototype.setCenter=function(latLng){this.center.lat=latLng.lat,this.center.lng=latLng.lng},WPGMZA.Circle.prototype.getRadius=function(){return this.radius},WPGMZA.Circle.prototype.setRadius=function(radius){this.radius=radius},WPGMZA.Circle.prototype.getMap=function(){return this.map},WPGMZA.Circle.prototype.setMap=function(map){this.map&&this.map.removeCircle(this),map&&map.addCircle(this)}}),jQuery(function($){WPGMZA.MapSettingsPage=function(){var self=this;this.updateEngineSpecificControls(),this.updateGDPRControls(),$("select[name='wpgmza_maps_engine']").on("change",function(event){self.updateEngineSpecificControls()}),$("input[name='wpgmza_gdpr_require_consent_before_load'], input[name='wpgmza_gdpr_require_consent_before_vgm_submit'], input[name='wpgmza_gdpr_override_notice']").on("change",function(event){self.updateGDPRControls()})},WPGMZA.MapSettingsPage.createInstance=function(){return new WPGMZA.MapSettingsPage},WPGMZA.MapSettingsPage.prototype.updateEngineSpecificControls=function(){var engine=$("select[name='wpgmza_maps_engine']").val();$("[data-required-maps-engine][data-required-maps-engine!='"+engine+"']").hide(),$("[data-required-maps-engine='"+engine+"']").show()},WPGMZA.MapSettingsPage.prototype.updateGDPRControls=function(){var showNoticeControls=$("input[name='wpgmza_gdpr_require_consent_before_load']").prop("checked"),vgmCheckbox=$("input[name='wpgmza_gdpr_require_consent_before_vgm_submit']");vgmCheckbox.length&&(showNoticeControls=showNoticeControls||vgmCheckbox.prop("checked"));var showOverrideTextarea=showNoticeControls&&$("input[name='wpgmza_gdpr_override_notice']").prop("checked");showNoticeControls?$("#wpgmza-gdpr-compliance-notice").show("slow"):$("#wpgmza-gdpr-compliance-notice").hide("slow"),showOverrideTextarea?$("#wpgmza_gdpr_override_notice_text").show("slow"):$("#wpgmza_gdpr_override_notice_text").hide("slow")},WPGMZA.MapSettingsPage.prototype.flushGeocodeCache=function(){(new WPGMZA.OLGeocoder).clearCache(function(response){jQuery("#wpgmza_flush_cache_btn").removeAttr("disabled")})},jQuery(function($){window.location.href.match(/wp-google-maps-menu-settings/)&&(WPGMZA.mapSettingsPage=WPGMZA.MapSettingsPage.createInstance(),jQuery(document).ready(function(){jQuery("#wpgmza_flush_cache_btn").on("click",function(){jQuery(this).attr("disabled","disabled"),WPGMZA.mapSettingsPage.flushGeocodeCache()})}))})}),jQuery(function($){WPGMZA.MapSettings=function(element){function addSettings(input){if(input)for(var key in input)if("other_settings"!=key){var value=input[key];String(value).match(/^-?\d+$/)&&(value=parseInt(value)),self[key]=value}}var json,self=this,str=element.getAttribute("data-settings");try{json=JSON.parse(str)}catch(e){str=str.replace(/\\%/g,"%"),str=str.replace(/\\\\"/g,'\\"');try{json=JSON.parse(str)}catch(e){json={},console.warn("Failed to parse map settings JSON")}}WPGMZA.assertInstanceOf(this,"MapSettings"),addSettings(WPGMZA.settings),addSettings(json),json&&json.other_settings&&addSettings(json.other_settings)},WPGMZA.MapSettings.prototype.toOLViewOptions=function(){var options={center:ol.proj.fromLonLat([-119.4179,36.7783]),zoom:4};if("string"==typeof this.start_location){var coords=this.start_location.replace(/^\(|\)$/g,"").split(",");WPGMZA.isLatLngString(this.start_location)?options.center=ol.proj.fromLonLat([parseFloat(coords[1]),parseFloat(coords[0])]):console.warn("Invalid start location")}return this.center&&(options.center=ol.proj.fromLonLat([parseFloat(this.center.lng),parseFloat(this.center.lat)])),this.zoom&&(options.zoom=parseInt(this.zoom)),this.start_zoom&&(options.zoom=parseInt(this.start_zoom)),this.map_min_zoom&&this.map_max_zoom&&(options.minZoom=Math.min(this.map_min_zoom,this.map_max_zoom),options.maxZoom=Math.max(this.map_min_zoom,this.map_max_zoom)),options},WPGMZA.MapSettings.prototype.toGoogleMapsOptions=function(){function formatCoord(coord){return $.isNumeric(coord)?coord:parseFloat(String(coord).replace(/[\(\)\s]/,""))}var self=this,latLngCoords=this.start_location&&this.start_location.length?this.start_location.split(","):[36.7783,-119.4179],latLng=new google.maps.LatLng(formatCoord(latLngCoords[0]),formatCoord(latLngCoords[1])),zoom=this.start_zoom?parseInt(this.start_zoom):4;!this.start_zoom&&this.zoom&&(zoom=parseInt(this.zoom));var options={zoom:zoom,center:latLng};switch(function(name){return!("object"==typeof self[name]||self[name]&&self[name].length)}("center")||(options.center=new google.maps.LatLng({lat:parseFloat(this.center.lat),lng:parseFloat(this.center.lng)})),this.map_min_zoom&&this.map_max_zoom&&(options.minZoom=Math.min(this.map_min_zoom,this.map_max_zoom),options.maxZoom=Math.max(this.map_min_zoom,this.map_max_zoom)),options.zoomControl=!("yes"==this.wpgmza_settings_map_zoom),options.panControl=!("yes"==this.wpgmza_settings_map_pan),options.mapTypeControl=!("yes"==this.wpgmza_settings_map_type),options.streetViewControl=!("yes"==this.wpgmza_settings_map_streetview),options.fullscreenControl=!("yes"==this.wpgmza_settings_map_full_screen_control),options.draggable=!("yes"==this.wpgmza_settings_map_draggable),options.disableDoubleClickZoom="yes"==this.wpgmza_settings_map_clickzoom,options.scrollwheel=!("yes"==this.wpgmza_settings_map_scroll),"greedy"==this.wpgmza_force_greedy_gestures||"yes"==this.wpgmza_force_greedy_gestures?options.gestureHandling="greedy":options.gestureHandling="cooperative",parseInt(this.type)){case 2:options.mapTypeId=google.maps.MapTypeId.SATELLITE;break;case 3:options.mapTypeId=google.maps.MapTypeId.HYBRID;break;case 4:options.mapTypeId=google.maps.MapTypeId.TERRAIN;break;default:options.mapTypeId=google.maps.MapTypeId.ROADMAP}if(this.theme_data&&this.theme_data.length>0)try{options.styles=JSON.parse(this.theme_data)}catch(e){alert("Your theme data is not valid JSON and has been ignored")}return options}}),jQuery(function($){function deg2rad(deg){return deg*(Math.PI/180)}WPGMZA.Map=function(element,options){if(WPGMZA.assertInstanceOf(this,"Map"),WPGMZA.EventDispatcher.call(this),!(element instanceof HTMLElement))throw new Error("Argument must be a HTMLElement");if(this.id=element.getAttribute("data-map-id"),!/\d+/.test(this.id))throw new Error("Map ID must be an integer");if(WPGMZA.maps.push(this),this.element=element,this.element.wpgmzaMap=this,this.engineElement=element,this.markers=[],this.polygons=[],this.polylines=[],this.circles=[],this.loadSettings(options),this.shortcodeAttributes={},$(this.element).attr("data-shortcode-attributes"))try{this.shortcodeAttributes=JSON.parse($(this.element).attr("data-shortcode-attributes"))}catch(e){console.warn("Error parsing shortcode attributes")}this.initStoreLocator(),this.markerFilter=WPGMZA.MarkerFilter.createInstance(this)},WPGMZA.Map.prototype=Object.create(WPGMZA.EventDispatcher.prototype),WPGMZA.Map.prototype.constructor=WPGMZA.Map,WPGMZA.Map.nightTimeThemeData=[{elementType:"geometry",stylers:[{color:"#242f3e"}]},{elementType:"labels.text.fill",stylers:[{color:"#746855"}]},{elementType:"labels.text.stroke",stylers:[{color:"#242f3e"}]},{featureType:"administrative.locality",elementType:"labels.text.fill",stylers:[{color:"#d59563"}]},{featureType:"landscape",elementType:"geometry.fill",stylers:[{color:"#575663"}]},{featureType:"poi",elementType:"labels.text.fill",stylers:[{color:"#d59563"}]},{featureType:"poi.park",elementType:"geometry",stylers:[{color:"#263c3f"}]},{featureType:"poi.park",elementType:"labels.text.fill",stylers:[{color:"#6b9a76"}]},{featureType:"road",elementType:"geometry",stylers:[{color:"#38414e"}]},{featureType:"road",elementType:"geometry.stroke",stylers:[{color:"#212a37"}]},{featureType:"road",elementType:"labels.text.fill",stylers:[{color:"#9ca5b3"}]},{featureType:"road.highway",elementType:"geometry",stylers:[{color:"#746855"}]},{featureType:"road.highway",elementType:"geometry.fill",stylers:[{color:"#80823e"}]},{featureType:"road.highway",elementType:"geometry.stroke",stylers:[{color:"#1f2835"}]},{featureType:"road.highway",elementType:"labels.text.fill",stylers:[{color:"#f3d19c"}]},{featureType:"transit",elementType:"geometry",stylers:[{color:"#2f3948"}]},{featureType:"transit.station",elementType:"labels.text.fill",stylers:[{color:"#d59563"}]},{featureType:"water",elementType:"geometry",stylers:[{color:"#17263c"}]},{featureType:"water",elementType:"geometry.fill",stylers:[{color:"#1b737a"}]},{featureType:"water",elementType:"labels.text.fill",stylers:[{color:"#515c6d"}]},{featureType:"water",elementType:"labels.text.stroke",stylers:[{color:"#17263c"}]}],WPGMZA.Map.getConstructor=function(){switch(WPGMZA.settings.engine){case"open-layers":return WPGMZA.isProVersion()?WPGMZA.OLProMap:WPGMZA.OLMap;default:return WPGMZA.isProVersion()?WPGMZA.GoogleProMap:WPGMZA.GoogleMap}},WPGMZA.Map.createInstance=function(element,options){return new(WPGMZA.Map.getConstructor())(element,options)},WPGMZA.Map.prototype.loadSettings=function(options){var settings=new WPGMZA.MapSettings(this.element);settings.other_settings;if(delete settings.other_settings,options)for(var key in options)settings[key]=options[key];this.settings=settings},WPGMZA.Map.prototype.initStoreLocator=function(){var storeLocatorElement=$(".wpgmza_sl_main_div");storeLocatorElement.length&&(this.storeLocator=WPGMZA.StoreLocator.createInstance(this,storeLocatorElement[0]))},WPGMZA.Map.prototype.setOptions=function(options){for(var name in options)this.settings[name]=options[name]};Math.PI;WPGMZA.Map.getGeographicDistance=function(lat1,lon1,lat2,lon2){var dLat=deg2rad(lat2-lat1),dLon=deg2rad(lon2-lon1),a=Math.sin(dLat/2)*Math.sin(dLat/2)+Math.cos(deg2rad(lat1))*Math.cos(deg2rad(lat2))*Math.sin(dLon/2)*Math.sin(dLon/2);return 6371*(2*Math.atan2(Math.sqrt(a),Math.sqrt(1-a)))},WPGMZA.Map.prototype.setCenter=function(latLng){if(!("lat"in latLng&&"lng"in latLng))throw new Error("Argument is not an object with lat and lng")},WPGMZA.Map.prototype.setDimensions=function(width,height){$(this.element).css({width:width}),$(this.engineElement).css({width:"100%",height:height})},WPGMZA.Map.prototype.addMarker=function(marker){if(!(marker instanceof WPGMZA.Marker))throw new Error("Argument must be an instance of WPGMZA.Marker");marker.map=this,marker.parent=this,this.markers.push(marker),this.dispatchEvent({type:"markeradded",marker:marker}),marker.dispatchEvent({type:"added"})},WPGMZA.Map.prototype.removeMarker=function(marker){if(!(marker instanceof WPGMZA.Marker))throw new Error("Argument must be an instance of WPGMZA.Marker");if(marker.map!==this)throw new Error("Wrong map error");marker.infoWindow&&marker.infoWindow.close(),marker.map=null,marker.parent=null,this.markers.splice(this.markers.indexOf(marker),1),this.dispatchEvent({type:"markerremoved",marker:marker}),marker.dispatchEvent({type:"removed"})},WPGMZA.Map.prototype.getMarkerByID=function(id){for(var i=0;i<this.markers.length;i++)if(this.markers[i].id==id)return this.markers[i];return null},WPGMZA.Map.prototype.removeMarkerByID=function(id){var marker=this.getMarkerByID(id);marker&&this.removeMarker(marker)},WPGMZA.Map.prototype.addPolygon=function(polygon){if(!(polygon instanceof WPGMZA.Polygon))throw new Error("Argument must be an instance of WPGMZA.Polygon");polygon.map=this,this.polygons.push(polygon),this.dispatchEvent({type:"polygonadded",polygon:polygon})},WPGMZA.Map.prototype.removePolygon=function(polygon){if(!(polygon instanceof WPGMZA.Polygon))throw new Error("Argument must be an instance of WPGMZA.Polygon");if(polygon.map!==this)throw new Error("Wrong map error");polygon.map=null,this.polygons.splice(this.polygons.indexOf(polygon),1),this.dispatchEvent({type:"polygonremoved",polygon:polygon})},WPGMZA.Map.prototype.getPolygonByID=function(id){for(var i=0;i<this.polygons.length;i++)if(this.polygons[i].id==id)return this.polygons[i];return null},WPGMZA.Map.prototype.removePolygonByID=function(id){var polygon=this.getPolygonByID(id);polygon&&this.removePolygon(polygon)},WPGMZA.Map.prototype.getPolylineByID=function(id){for(var i=0;i<this.polylines.length;i++)if(this.polylines[i].id==id)return this.polylines[i];return null},WPGMZA.Map.prototype.addPolyline=function(polyline){if(!(polyline instanceof WPGMZA.Polyline))throw new Error("Argument must be an instance of WPGMZA.Polyline");polyline.map=this,this.polylines.push(polyline),this.dispatchEvent({type:"polylineadded",polyline:polyline})},WPGMZA.Map.prototype.removePolyline=function(polyline){if(!(polyline instanceof WPGMZA.Polyline))throw new Error("Argument must be an instance of WPGMZA.Polyline");if(polyline.map!==this)throw new Error("Wrong map error");polyline.map=null,this.polylines.splice(this.polylines.indexOf(polyline),1),this.dispatchEvent({type:"polylineremoved",polyline:polyline})},WPGMZA.Map.prototype.getPolylineByID=function(id){for(var i=0;i<this.polylines.length;i++)if(this.polylines[i].id==id)return this.polylines[i];return null},WPGMZA.Map.prototype.removePolylineByID=function(id){var polyline=this.getPolylineByID(id);polyline&&this.removePolyline(polyline)},WPGMZA.Map.prototype.addCircle=function(circle){if(!(circle instanceof WPGMZA.Circle))throw new Error("Argument must be an instance of WPGMZA.Circle");circle.map=this,this.circles.push(circle),this.dispatchEvent({type:"circleadded",circle:circle})},WPGMZA.Map.prototype.removeCircle=function(circle){if(!(circle instanceof WPGMZA.Circle))throw new Error("Argument must be an instance of WPGMZA.Circle");if(circle.map!==this)throw new Error("Wrong map error");circle.map=null,this.circles.splice(this.circles.indexOf(circle),1),this.dispatchEvent({type:"circleremoved",circle:circle})},WPGMZA.Map.prototype.getCircleByID=function(id){for(var i=0;i<this.circles.length;i++)if(this.circles[i].id==id)return this.circles[i];return null},WPGMZA.Map.prototype.removeCircleByID=function(id){var circle=this.getCircleByID(id);circle&&this.removeCircle(circle)},WPGMZA.Map.prototype.nudge=function(x,y){var pixels=this.latLngToPixels(this.getCenter());if(pixels.x+=parseFloat(x),pixels.y+=parseFloat(y),isNaN(pixels.x)||isNaN(pixels.y))throw new Error("Invalid coordinates supplied");var latLng=this.pixelsToLatLng(pixels);this.setCenter(latLng)},WPGMZA.Map.prototype.onWindowResize=function(event){},WPGMZA.Map.prototype.onElementResized=function(event){},WPGMZA.Map.prototype.onBoundsChanged=function(event){this.trigger("boundschanged"),this.trigger("bounds_changed")},WPGMZA.Map.prototype.onIdle=function(event){this.trigger("idle")}}),jQuery(function($){WPGMZA.MapsEngineDialog=function(element){var self=this;this.element=element,window.wpgmzaUnbindSaveReminder&&window.wpgmzaUnbindSaveReminder(),$(element).show(),$(element).remodal().open(),$(element).find("input:radio").on("change",function(event){$("#wpgmza-confirm-engine").prop("disabled",!1)}),$("#wpgmza-confirm-engine").on("click",function(event){self.onButtonClicked(event)})},WPGMZA.MapsEngineDialog.prototype.onButtonClicked=function(event){$(event.target).prop("disabled",!0),$.ajax(WPGMZA.ajaxurl,{method:"POST",data:{action:"wpgmza_maps_engine_dialog_set_engine",engine:$("[name='wpgmza_maps_engine']:checked").val()},success:function(response,status,xhr){window.location.reload()}})},$(window).on("load",function(event){var element=$("#wpgmza-maps-engine-dialog");element.length&&(WPGMZA.settings.wpgmza_maps_engine_dialog_done||WPGMZA.settings.wpgmza_google_maps_api_key&&WPGMZA.settings.wpgmza_google_maps_api_key.length||(WPGMZA.mapsEngineDialog=new WPGMZA.MapsEngineDialog(element)))})}),jQuery(function($){WPGMZA.MarkerFilter=function(map){WPGMZA.EventDispatcher.call(this),this.map=map},WPGMZA.MarkerFilter.prototype=Object.create(WPGMZA.EventDispatcher.prototype),WPGMZA.MarkerFilter.prototype.constructor=WPGMZA.MarkerFilter,WPGMZA.MarkerFilter.createInstance=function(map){return new WPGMZA.MarkerFilter(map)},WPGMZA.MarkerFilter.prototype.getFilteringParameters=function(){var params={map_id:this.map.id};return this.map.storeLocator&&(params=$.extend(params,this.map.storeLocator.getFilteringParameters())),params},WPGMZA.MarkerFilter.prototype.update=function(){},WPGMZA.MarkerFilter.prototype.onFilteringComplete=function(results){}}),jQuery(function($){WPGMZA.Marker=function(row){var self=this;this._offset={x:0,y:0},WPGMZA.assertInstanceOf(this,"Marker"),this.lat="36.778261",this.lng="-119.4179323999",this.address="California",this.title=null,this.description="",this.link="",this.icon="",this.approved=1,this.pic=null,this.disableInfoWindow=!1,WPGMZA.MapObject.apply(this,arguments),row&&row.heatmap||(row&&this.on("init",function(event){row.position&&this.setPosition(row.position),row.map&&row.map.addMarker(this)}),this.addEventListener("added",function(event){self.onAdded(event)}))},WPGMZA.Marker.prototype=Object.create(WPGMZA.MapObject.prototype),WPGMZA.Marker.prototype.constructor=WPGMZA.Marker,WPGMZA.Marker.getConstructor=function(){switch(WPGMZA.settings.engine){case"open-layers":return WPGMZA.isProVersion()?WPGMZA.OLProMarker:WPGMZA.OLMarker;default:return WPGMZA.isProVersion()?WPGMZA.GoogleProMarker:WPGMZA.GoogleMarker}},WPGMZA.Marker.createInstance=function(row){return new(WPGMZA.Marker.getConstructor())(row)},WPGMZA.Marker.ANIMATION_NONE="0",WPGMZA.Marker.ANIMATION_BOUNCE="1",WPGMZA.Marker.ANIMATION_DROP="2",Object.defineProperty(WPGMZA.Marker.prototype,"offsetX",{get:function(){return this._offset.x},set:function(value){this._offset.x=value,this.updateOffset()}}),Object.defineProperty(WPGMZA.Marker.prototype,"offsetY",{get:function(){return this._offset.y},set:function(value){this._offset.y=value,this.updateOffset()}}),WPGMZA.Marker.prototype.onAdded=function(event){var self=this;this.addEventListener("click",function(event){self.onClick(event)}),this.addEventListener("mouseover",function(event){self.onMouseOver(event)}),this.addEventListener("select",function(event){self.onSelect(event)}),this.map.settings.marker==this.id&&self.trigger("select"),"1"==this.infoopen&&this.openInfoWindow()},WPGMZA.Marker.prototype.initInfoWindow=function(){this.infoWindow||(this.infoWindow=WPGMZA.InfoWindow.createInstance())},WPGMZA.Marker.prototype.openInfoWindow=function(){this.map?("map-edit"!=WPGMZA.currentPage||WPGMZA.pro_version)&&(this.map.lastInteractedMarker&&this.map.lastInteractedMarker.infoWindow.close(),this.map.lastInteractedMarker=this,this.initInfoWindow(),this.infoWindow.open(this.map,this)):console.warn("Cannot open infowindow for marker with no map")},WPGMZA.Marker.prototype.onClick=function(event){},WPGMZA.Marker.prototype.onSelect=function(event){this.openInfoWindow()},WPGMZA.Marker.prototype.onMouseOver=function(event){this.map.settings.info_window_open_by==WPGMZA.InfoWindow.OPEN_BY_HOVER&&this.openInfoWindow()},WPGMZA.Marker.prototype.getIcon=function(){function stripProtocol(url){return"string"!=typeof url?url:url.replace(/^http(s?):/,"")}return stripProtocol(WPGMZA.defaultMarkerIcon?WPGMZA.defaultMarkerIcon:WPGMZA.settings.default_marker_icon)},WPGMZA.Marker.prototype.getPosition=function(){return new WPGMZA.LatLng({lat:parseFloat(this.lat),lng:parseFloat(this.lng)})},WPGMZA.Marker.prototype.setPosition=function(latLng){latLng instanceof WPGMZA.LatLng?(this.lat=latLng.lat,this.lng=latLng.lng):(this.lat=parseFloat(latLng.lat),this.lng=parseFloat(latLng.lng))},WPGMZA.Marker.prototype.setOffset=function(x,y){this._offset.x=x,this._offset.y=y,this.updateOffset()},WPGMZA.Marker.prototype.updateOffset=function(){},WPGMZA.Marker.prototype.getAnimation=function(animation){return this.settings.animation},WPGMZA.Marker.prototype.setAnimation=function(animation){this.settings.animation=animation},WPGMZA.Marker.prototype.getVisible=function(){},WPGMZA.Marker.prototype.setVisible=function(visible){!visible&&this.infoWindow&&this.infoWindow.close()},WPGMZA.Marker.prototype.getMap=function(){return this.map},WPGMZA.Marker.prototype.setMap=function(map){map?map.addMarker(this):this.map&&this.map.removeMarker(this),this.map=map},WPGMZA.Marker.prototype.getDraggable=function(){},WPGMZA.Marker.prototype.setDraggable=function(draggable){},WPGMZA.Marker.prototype.setOptions=function(options){},WPGMZA.Marker.prototype.setOpacity=function(opacity){},WPGMZA.Marker.prototype.panIntoView=function(){if(!this.map)throw new Error("Marker hasn't been added to a map");this.map.setCenter(this.getPosition())},WPGMZA.Marker.prototype.toJSON=function(){var result=WPGMZA.MapObject.prototype.toJSON.call(this),position=this.getPosition();return $.extend(result,{lat:position.lat,lng:position.lng,address:this.address,title:this.title,description:this.description,link:this.link,icon:this.icon,pic:this.pic,approved:this.approved}),result}}),jQuery(function($){WPGMZA.ModernStoreLocatorCircle=function(map_id,settings){var map;map=WPGMZA.isProVersion()?this.map=MYMAP[map_id].map:this.map=MYMAP.map,this.map_id=map_id,this.mapElement=map.element,this.mapSize={width:$(this.mapElement).width(),height:$(this.mapElement).height()},this.initCanvasLayer(),this.settings={center:new WPGMZA.LatLng(0,0),radius:1,color:"#63AFF2",shadowColor:"white",shadowBlur:4,centerRingRadius:10,centerRingLineWidth:3,numInnerRings:9,innerRingLineWidth:1,innerRingFade:!0,numOuterRings:7,ringLineWidth:1,mainRingLineWidth:2,numSpokes:6,spokesStartAngle:Math.PI/2,numRadiusLabels:6,radiusLabelsStartAngle:Math.PI/2,radiusLabelFont:"13px sans-serif",visible:!1},settings&&this.setOptions(settings)},WPGMZA.ModernStoreLocatorCircle.createInstance=function(map,settings){return"google-maps"==WPGMZA.settings.engine?new WPGMZA.GoogleModernStoreLocatorCircle(map,settings):new WPGMZA.OLModernStoreLocatorCircle(map,settings)},WPGMZA.ModernStoreLocatorCircle.prototype.initCanvasLayer=function(){},WPGMZA.ModernStoreLocatorCircle.prototype.onResize=function(event){this.draw()},WPGMZA.ModernStoreLocatorCircle.prototype.onUpdate=function(event){this.draw()},WPGMZA.ModernStoreLocatorCircle.prototype.setOptions=function(options){for(var name in options){var functionName="set"+name.substr(0,1).toUpperCase()+name.substr(1);"function"==typeof this[functionName]?this[functionName](options[name]):this.settings[name]=options[name]}},WPGMZA.ModernStoreLocatorCircle.prototype.getResolutionScale=function(){return window.devicePixelRatio||1},WPGMZA.ModernStoreLocatorCircle.prototype.getCenter=function(){return this.getPosition()},WPGMZA.ModernStoreLocatorCircle.prototype.setCenter=function(value){this.setPosition(value)},WPGMZA.ModernStoreLocatorCircle.prototype.getPosition=function(){return this.settings.center},WPGMZA.ModernStoreLocatorCircle.prototype.setPosition=function(position){this.settings.center=position},WPGMZA.ModernStoreLocatorCircle.prototype.getRadius=function(){return this.settings.radius},WPGMZA.ModernStoreLocatorCircle.prototype.setRadius=function(radius){if(isNaN(radius))throw new Error("Invalid radius");this.settings.radius=radius},WPGMZA.ModernStoreLocatorCircle.prototype.getVisible=function(){return this.settings.visible},WPGMZA.ModernStoreLocatorCircle.prototype.setVisible=function(visible){this.settings.visible=visible},WPGMZA.ModernStoreLocatorCircle.prototype.getTransformedRadius=function(km){throw new Error("Abstract function called")},WPGMZA.ModernStoreLocatorCircle.prototype.getContext=function(type){throw new Error("Abstract function called")},WPGMZA.ModernStoreLocatorCircle.prototype.getCanvasDimensions=function(){throw new Error("Abstract function called")},WPGMZA.ModernStoreLocatorCircle.prototype.validateSettings=function(){WPGMZA.isHexColorString(this.settings.color)||(this.settings.color="#63AFF2")},WPGMZA.ModernStoreLocatorCircle.prototype.draw=function(){this.validateSettings();var settings=this.settings,canvasDimensions=this.getCanvasDimensions(),canvasWidth=canvasDimensions.width,canvasHeight=canvasDimensions.height;this.map,this.getResolutionScale();if(context=this.getContext("2d"),context.clearRect(0,0,canvasWidth,canvasHeight),settings.visible){context.shadowColor=settings.shadowColor,context.shadowBlur=settings.shadowBlur,context.setTransform(1,0,0,1,0,0);var scale=this.getScale();context.scale(scale,scale);var offset=this.getWorldOriginOffset();context.translate(offset.x,offset.y);new WPGMZA.LatLng(this.settings.center);var worldPoint=this.getCenterPixels(),rgba=WPGMZA.hexToRgba(settings.color),ringSpacing=this.getTransformedRadius(settings.radius)/(settings.numInnerRings+1);context.strokeStyle=settings.color,context.lineWidth=1/scale*settings.centerRingLineWidth,context.beginPath(),context.arc(worldPoint.x,worldPoint.y,this.getTransformedRadius(settings.centerRingRadius)/scale,0,2*Math.PI),context.stroke(),context.closePath();var end,spokeAngle,radius=this.getTransformedRadius(settings.radius)+ringSpacing*settings.numOuterRings+1,grad=context.createRadialGradient(0,0,0,0,0,radius),rgba=WPGMZA.hexToRgba(settings.color),start=WPGMZA.rgbaToString(rgba);rgba.a=0,end=WPGMZA.rgbaToString(rgba),grad.addColorStop(0,start),grad.addColorStop(1,end),context.save(),context.translate(worldPoint.x,worldPoint.y),context.strokeStyle=grad,context.lineWidth=2/scale;for(i=0;i<settings.numSpokes;i++)spokeAngle=settings.spokesStartAngle+2*Math.PI*(i/settings.numSpokes),x=Math.cos(spokeAngle)*radius,y=Math.sin(spokeAngle)*radius,context.setLineDash([2/scale,15/scale]),context.beginPath(),context.moveTo(0,0),context.lineTo(x,y),context.stroke();context.setLineDash([]),context.restore(),context.lineWidth=1/scale*settings.innerRingLineWidth;for(i=1;i<=settings.numInnerRings;i++){radius=i*ringSpacing;settings.innerRingFade&&(rgba.a=1-(i-1)/settings.numInnerRings),context.strokeStyle=WPGMZA.rgbaToString(rgba),context.beginPath(),context.arc(worldPoint.x,worldPoint.y,radius,0,2*Math.PI),context.stroke(),context.closePath()}context.strokeStyle=settings.color,context.lineWidth=1/scale*settings.centerRingLineWidth,context.beginPath(),context.arc(worldPoint.x,worldPoint.y,this.getTransformedRadius(settings.radius),0,2*Math.PI),context.stroke(),context.closePath();for(var radius=radius+ringSpacing,i=0;i<settings.numOuterRings;i++)settings.innerRingFade&&(rgba.a=1-i/settings.numOuterRings),context.strokeStyle=WPGMZA.rgbaToString(rgba),context.beginPath(),context.arc(worldPoint.x,worldPoint.y,radius,0,2*Math.PI),context.stroke(),context.closePath(),radius+=ringSpacing;if(settings.numRadiusLabels>0){var m,x,y,radius=this.getTransformedRadius(settings.radius);(m=settings.radiusLabelFont.match(/(\d+)px/))&&parseInt(m[1])/2*1.1/scale,context.font=settings.radiusLabelFont,context.textAlign="center",context.textBaseline="middle",context.fillStyle=settings.color,context.save(),context.translate(worldPoint.x,worldPoint.y);for(i=0;i<settings.numRadiusLabels;i++){var width,textAngle=(spokeAngle=settings.radiusLabelsStartAngle+2*Math.PI*(i/settings.numRadiusLabels))+Math.PI/2,text=settings.radiusString;Math.sin(spokeAngle)>0&&(textAngle-=Math.PI),x=Math.cos(spokeAngle)*radius,y=Math.sin(spokeAngle)*radius,context.save(),context.translate(x,y),context.rotate(textAngle),context.scale(1/scale,1/scale),width=context.measureText(text).width,height=width/2,context.clearRect(-width,-height,2*width,2*height),context.fillText(settings.radiusString,0,0),context.restore()}context.restore()}}}}),jQuery(function($){WPGMZA.ModernStoreLocator=function(map_id){var original,self=this,map=WPGMZA.getMapByID(map_id);if(WPGMZA.assertInstanceOf(this,"ModernStoreLocator"),(original=WPGMZA.isProVersion()?$(".wpgmza_sl_search_button[mid='"+map_id+"']").closest(".wpgmza_sl_main_div"):$(".wpgmza_sl_search_button").closest(".wpgmza_sl_main_div")).length){this.element=$("<div class='wpgmza-modern-store-locator'><div class='wpgmza-inner wpgmza-modern-hover-opaque'/></div>")[0];var inner=$(this.element).find(".wpgmza-inner"),titleSearch=$(original).find("[id='nameInput_"+map_id+"']");if(titleSearch.length){var placeholder=wpgmaps_localize[map_id].other_settings.store_locator_name_string;placeholder&&placeholder.length&&titleSearch.attr("placeholder",placeholder),inner.append(titleSearch)}var addressInput;addressInput=WPGMZA.isProVersion()?$(original).find(".addressInput"):$(original).find("#addressInput"),wpgmaps_localize[map_id].other_settings.store_locator_query_string&&wpgmaps_localize[map_id].other_settings.store_locator_query_string.length&&addressInput.attr("placeholder",wpgmaps_localize[map_id].other_settings.store_locator_query_string),inner.append(addressInput);var button;(button=$(original).find("button.wpgmza-use-my-location"))&&inner.append(button),$(addressInput).on("keydown keypress",function(event){13==event.keyCode&&self.searchButton.is(":visible")&&self.searchButton.trigger("click")}),$(addressInput).on("input",function(event){self.searchButton.show(),self.resetButton.hide()}),inner.append($(original).find("select.wpgmza_sl_radius_select")),this.searchButton=$(original).find(".wpgmza_sl_search_button"),inner.append(this.searchButton),this.resetButton=$(original).find(".wpgmza_sl_reset_button_div"),inner.append(this.resetButton),this.resetButton.on("click",function(event){resetLocations(map_id)}),this.resetButton.hide(),WPGMZA.isProVersion()&&(this.searchButton.on("click",function(event){0!=$("addressInput_"+map_id).val()&&(self.searchButton.hide(),self.resetButton.show(),map.storeLocator.state=WPGMZA.StoreLocator.STATE_APPLIED)}),this.resetButton.on("click",function(event){self.resetButton.hide(),self.searchButton.show(),map.storeLocator.state=WPGMZA.StoreLocator.STATE_INITIAL})),inner.append($("#wpgmza_distance_type_"+map_id));var container=$(original).find(".wpgmza_cat_checkbox_holder"),numCategories=($(container).children("ul"),0),icons=[];$(container).find("li").each(function(index,el){var id=$(el).attr("class").match(/\d+/);for(var category_id in wpgmza_category_data)if(id==category_id){var src=wpgmza_category_data[category_id].image,icon=$('<div class="wpgmza-chip-icon"/>');icon.css({"background-image":"url('"+src+"')",width:$("#wpgmza_cat_checkbox_"+category_id+" + label").height()+"px"}),icons.push(icon),null!=src&&""!=src&&$("#wpgmza_cat_checkbox_"+category_id+" + label").prepend(icon),numCategories++;break}}),$(this.element).append(container),numCategories&&(this.optionsButton=$('<span class="wpgmza_store_locator_options_button"><i class="fa fa-list"></i></span>'),$(this.searchButton).before(this.optionsButton)),setInterval(function(){icons.forEach(function(icon){var height=$(icon).height();$(icon).css({width:height+"px"}),$(icon).closest("label").css({"padding-left":height+8+"px"})}),$(container).css("width",$(self.element).find(".wpgmza-inner").outerWidth()+"px")},1e3),$(this.element).find(".wpgmza_store_locator_options_button").on("click",function(event){container.hasClass("wpgmza-open")?container.removeClass("wpgmza-open"):container.addClass("wpgmza-open")}),$(original).remove(),$(this.element).find("input, select").on("focus",function(){$(inner).addClass("active")}),$(this.element).find("input, select").on("blur",function(){$(inner).removeClass("active")})}},WPGMZA.ModernStoreLocator.createInstance=function(map_id){switch(WPGMZA.settings.engine){case"open-layers":return new WPGMZA.OLModernStoreLocator(map_id);default:return new WPGMZA.GoogleModernStoreLocator(map_id)}}}),jQuery(function($){WPGMZA.NativeMapsAppIcon=function(){navigator.userAgent.match(/^Apple|iPhone|iPad|iPod/)?(this.type="apple",this.element=$('<span><i class="fab fa-apple" aria-hidden="true"></i></span>')):(this.type="google",this.element=$('<span><i class="fab fa-google" aria-hidden="true"></i></span>'))}}),jQuery(function($){WPGMZA.Polygon=function(row,enginePolygon){WPGMZA.assertInstanceOf(this,"Polygon"),this.paths=null,this.title=null,this.name=null,this.link=null,WPGMZA.MapObject.apply(this,arguments)},WPGMZA.Polygon.prototype=Object.create(WPGMZA.MapObject.prototype),WPGMZA.Polygon.prototype.constructor=WPGMZA.Polygon,WPGMZA.Polygon.getConstructor=function(){switch(WPGMZA.settings.engine){case"open-layers":return WPGMZA.isProVersion()?WPGMZA.OLProPolygon:WPGMZA.OLPolygon;default:return WPGMZA.isProVersion()?WPGMZA.GoogleProPolygon:WPGMZA.GooglePolygon}},WPGMZA.Polygon.createInstance=function(row,engineObject){return new(WPGMZA.Polygon.getConstructor())(row,engineObject)},WPGMZA.Polygon.prototype.toJSON=function(){var result=WPGMZA.MapObject.prototype.toJSON.call(this);return $.extend(result,{name:this.name,title:this.title,link:this.link}),result}}),jQuery(function($){WPGMZA.Polyline=function(row,googlePolyline){WPGMZA.assertInstanceOf(this,"Polyline"),this.title=null,WPGMZA.MapObject.apply(this,arguments)},WPGMZA.Polyline.prototype=Object.create(WPGMZA.MapObject.prototype),WPGMZA.Polyline.prototype.constructor=WPGMZA.Polyline,WPGMZA.Polyline.getConstructor=function(){switch(WPGMZA.settings.engine){case"open-layers":return WPGMZA.OLPolyline;default:return WPGMZA.GooglePolyline}},WPGMZA.Polyline.createInstance=function(row,engineObject){return new(WPGMZA.Polyline.getConstructor())(row,engineObject)},WPGMZA.Polyline.prototype.getPoints=function(){return this.toJSON().points},WPGMZA.Polyline.prototype.toJSON=function(){var result=WPGMZA.MapObject.prototype.toJSON.call(this);return result.title=this.title,result}}),jQuery(function($){WPGMZA.PopoutPanel=function(){},WPGMZA.PopoutPanel.prototype.open=function(){$(this.element).addClass("wpgmza-open")},WPGMZA.PopoutPanel.prototype.close=function(){$(this.element).removeClass("wpgmza-open")}}),jQuery(function($){function sendAJAXFallbackRequest(route,params){if((params=$.extend({},params)).data||(params.data={}),"route"in params.data)throw new Error("Cannot send route through this method");if("action"in params.data)throw new Error("Cannot send action through this method");return params.data.route=route,params.data.action="wpgmza_rest_api_request",$.ajax(WPGMZA.ajaxurl,params)}WPGMZA.RestAPI=function(){WPGMZA.RestAPI.URL=WPGMZA.resturl,this.useAJAXFallback=!1},WPGMZA.RestAPI.createInstance=function(){return new WPGMZA.RestAPI},Object.defineProperty(WPGMZA.RestAPI.prototype,"isCompressedPathVariableSupported",{get:function(){return WPGMZA.serverCanInflate&&"Uint8Array"in window&&"TextEncoder"in window}}),Object.defineProperty(WPGMZA.RestAPI.prototype,"maxURLLength",{get:function(){return 2083}}),WPGMZA.RestAPI.prototype.compressParams=function(params){var suffix="";if(params.markerIDs){var markerIDs=params.markerIDs.split(","),encoded=(encoder=new WPGMZA.EliasFano).encode(markerIDs),compressed=pako.deflate(encoded),string=Array.prototype.map.call(compressed,function(ch){return String.fromCharCode(ch)}).join("");suffix="/"+btoa(string).replace(/\//g,"-"),params.midcbp=encoded.pointer,delete params.markerIDs}var string=JSON.stringify(params),encoder=new TextEncoder,input=encoder.encode(string),compressed=pako.deflate(input),raw=Array.prototype.map.call(compressed,function(ch){return String.fromCharCode(ch)}).join("");return btoa(raw).replace(/\//g,"-")+suffix},WPGMZA.RestAPI.prototype.getNonce=function(route){for(var pattern in WPGMZA.restnoncetable){var regex=new RegExp(pattern);if(route.match(regex))return WPGMZA.restnoncetable[pattern]}throw new Error("No nonce found for route")},WPGMZA.RestAPI.prototype.call=function(route,params){if(this.useAJAXFallback)return sendAJAXFallbackRequest(route,params);var self=this,attemptedCompressedPathVariable=!1,fallbackRoute=route,fallbackParams=$.extend({},params);if("string"!=typeof route||!route.match(/^\//))throw new Error("Invalid route");WPGMZA.RestAPI.URL.match(/\/$/)&&(route=route.replace(/^\//,"")),params||(params={});var setRESTNonce=function(xhr){xhr.setRequestHeader("X-WP-Nonce",WPGMZA.restnonce),params&&params.method&&!params.method.match(/^GET$/i)&&xhr.setRequestHeader("X-WPGMZA-Action-Nonce",self.getNonce(route))};if(params.beforeSend){var base=params.beforeSend;params.beforeSend=function(xhr){base(xhr),setRESTNonce(xhr)}}else params.beforeSend=setRESTNonce;if(params.error||(params.error=function(xhr,status,message){if("abort"!=status){switch(xhr.status){case 401:case 403:return $.post(WPGMZA.ajaxurl,{action:"wpgmza_report_rest_api_blocked"},function(response){}),console.warn("The REST API was blocked. This is usually due to security plugins blocking REST requests for non-authenticated users."),this.useAJAXFallback=!0,sendAJAXFallbackRequest(fallbackRoute,fallbackParams);case 414:if(!attemptedCompressedPathVariable)break;return fallbackParams.method="POST",fallbackParams.useCompressedPathVariable=!1,WPGMZA.restAPI.call(fallbackRoute,fallbackParams)}throw new Error(message)}}),params.useCompressedPathVariable&&this.isCompressedPathVariableSupported&&WPGMZA.settings.enable_compressed_path_variables){var compressedParams=$.extend({},params),data=params.data,compressedRoute=route.replace(/\/$/,"")+"/base64"+this.compressParams(data);WPGMZA.RestAPI.URL;compressedParams.method="GET",delete compressedParams.data,!1===params.cache&&(compressedParams.data={skip_cache:1}),compressedRoute.length<this.maxURLLength?(attemptedCompressedPathVariable=!0,route=compressedRoute,params=compressedParams):(WPGMZA.RestAPI.compressedPathVariableURLLimitWarningDisplayed||console.warn("Compressed path variable route would exceed URL length limit"),WPGMZA.RestAPI.compressedPathVariableURLLimitWarningDisplayed=!0)}return $.ajax(WPGMZA.RestAPI.URL+route,params)};var nativeCallFunction=WPGMZA.RestAPI.call;WPGMZA.RestAPI.call=function(){console.warn("WPGMZA.RestAPI.call was called statically, did you mean to call the function on WPGMZA.restAPI?"),nativeCallFunction.apply(this,arguments)},$(document.body).on("click","#wpgmza-rest-api-blocked button.notice-dismiss",function(event){WPGMZA.restAPI.call("/rest-api/",{method:"POST",data:{dismiss_blocked_notice:!0}})})}),jQuery(function($){WPGMZA.StoreLocator=function(map,element){var self=this;WPGMZA.EventDispatcher.call(this),this._center=null,this.map=map,this.element=element,this.state=WPGMZA.StoreLocator.STATE_INITIAL,this.map.on("storelocatorgeocodecomplete",function(event){self.onGeocodeComplete(event)}),this.map.on("init",function(event){self.map.markerFilter.on("filteringcomplete",function(event){self.onFilteringComplete(event)})}),$(document.body).on("click",".wpgmza_sl_search_button_"+map.id,function(event){self.onSearch(event)}),$(document.body).on("click",".wpgmza_sl_reset_button_"+map.id,function(event){self.onReset(event)})},WPGMZA.StoreLocator.prototype=Object.create(WPGMZA.EventDispatcher.prototype),WPGMZA.StoreLocator.prototype.constructor=WPGMZA.StoreLocator,WPGMZA.StoreLocator.STATE_INITIAL="initial",WPGMZA.StoreLocator.STATE_APPLIED="applied",WPGMZA.StoreLocator.createInstance=function(map,element){return new WPGMZA.StoreLocator(map,element)},Object.defineProperty(WPGMZA.StoreLocator.prototype,"radius",{get:function(){return $("#radiusSelect_"+this.map.id).val()}}),Object.defineProperty(WPGMZA.StoreLocator.prototype,"center",{get:function(){return this._center}}),WPGMZA.StoreLocator.prototype.onGeocodeComplete=function(event){event.results&&event.results.length?(this._center=new WPGMZA.LatLng(event.results[0].latLng),this.map.markerFilter.update()):this._center=null},WPGMZA.StoreLocator.prototype.onSearch=function(event){this.state=WPGMZA.StoreLocator.STATE_APPLIED},WPGMZA.StoreLocator.prototype.onReset=function(event){this.state=WPGMZA.StoreLocator.STATE_INITIAL,this._center=null,this.map.markerFilter.update()},WPGMZA.StoreLocator.prototype.getFilteringParameters=function(){return this.center?{center:this.center,radius:this.radius}:{}},WPGMZA.StoreLocator.prototype.onFilteringComplete=function(event){0==event.filteredMarkers.length?$(this.element).find(".wpgmza-not-found-msg").show():$(this.element).find(".wpgmza-not-found-msg").hide()}}),jQuery(function($){WPGMZA.Text=function(options){if(options)for(var name in options)this[name]=options[name]},WPGMZA.Text.createInstance=function(options){switch(WPGMZA.settings.engine){case"open-layers":return new WPGMZA.OLText(options);default:return new WPGMZA.GoogleText(options)}}}),jQuery(function($){function isPositiveInteger(x){return/^\d+$/.test(x)}function validateParts(parts){for(var i=0;i<parts.length;++i)if(!isPositiveInteger(parts[i]))return!1;return!0}WPGMZA.Version=function(){},WPGMZA.Version.GREATER_THAN=1,WPGMZA.Version.EQUAL_TO=0,WPGMZA.Version.LESS_THAN=-1,WPGMZA.Version.compare=function(v1,v2){var v1parts=v1.split("."),v2parts=v2.split(".");if(!validateParts(v1parts)||!validateParts(v2parts))return NaN;for(var i=0;i<v1parts.length;++i){if(v2parts.length===i)return 1;if(v1parts[i]!==v2parts[i])return v1parts[i]>v2parts[i]?1:-1}return v1parts.length!=v2parts.length?-1:0}}),jQuery(function($){WPGMZA.Integration={},WPGMZA.integrationModules={}}),jQuery(function($){if(window.wp&&wp.i18n&&wp.blocks&&wp.editor&&wp.components){var __=wp.i18n.__,registerBlockType=wp.blocks.registerBlockType,_wp$editor=wp.editor,InspectorControls=_wp$editor.InspectorControls,_wp$components=(_wp$editor.BlockControls,wp.components),Dashicon=_wp$components.Dashicon,PanelBody=(_wp$components.Toolbar,_wp$components.Button,_wp$components.Tooltip,_wp$components.PanelBody);_wp$components.TextareaControl,_wp$components.CheckboxControl,_wp$components.TextControl,_wp$components.SelectControl,_wp$components.RichText;WPGMZA.Integration.Gutenberg=function(){registerBlockType("gutenberg-wpgmza/block",this.getBlockDefinition())},WPGMZA.Integration.Gutenberg.prototype.getBlockTitle=function(){return __("WP Google Maps")},WPGMZA.Integration.Gutenberg.prototype.getBlockInspectorControls=function(props){return React.createElement(InspectorControls,{key:"inspector"},React.createElement(PanelBody,{title:__("Map Settings")},React.createElement("p",{class:"map-block-gutenberg-button-container"},React.createElement("a",{href:WPGMZA.adminurl+"admin.php?page=wp-google-maps-menu&action=edit&map_id=1",target:"_blank",class:"button button-primary"},React.createElement("i",{class:"fa fa-pencil-square-o","aria-hidden":"true"}),__("Go to Map Editor"))),React.createElement("p",{class:"map-block-gutenberg-button-container"},React.createElement("a",{href:"https://www.wpgmaps.com/documentation/creating-your-first-map/",target:"_blank",class:"button button-primary"},React.createElement("i",{class:"fa fa-book","aria-hidden":"true"}),__("View Documentation")))))},WPGMZA.Integration.Gutenberg.prototype.getBlockAttributes=function(){return{}},WPGMZA.Integration.Gutenberg.prototype.getBlockDefinition=function(props){var _this=this;return{title:__("WP Google Maps"),description:__("The easiest to use Google Maps plugin! Create custom Google Maps 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."),category:"common",icon:"location-alt",keywords:[__("Map"),__("Maps"),__("Google")],attributes:this.getBlockAttributes(),edit:function(props){return[!!props.isSelected&&_this.getBlockInspectorControls(props),React.createElement("div",{className:props.className+" wpgmza-gutenberg-block"},React.createElement(Dashicon,{icon:"location-alt"}),React.createElement("span",{class:"wpgmza-gutenberg-block-title"},__("Your map will appear here on your websites front end")))]},save:function(props){return null}}},WPGMZA.Integration.Gutenberg.getConstructor=function(){return WPGMZA.Integration.Gutenberg},WPGMZA.Integration.Gutenberg.createInstance=function(){return new(WPGMZA.Integration.Gutenberg.getConstructor())},WPGMZA.isProVersion()||/^6/.test(WPGMZA.pro_version)||(WPGMZA.integrationModules.gutenberg=WPGMZA.Integration.Gutenberg.createInstance())}}),jQuery(function($){WPGMZA.GoogleUICompatibility=function(){if(!(navigator.vendor&&navigator.vendor.indexOf("Apple")>-1&&navigator.userAgent&&-1==navigator.userAgent.indexOf("CriOS")&&-1==navigator.userAgent.indexOf("FxiOS"))){var style=$("<style id='wpgmza-google-ui-compatiblity-fix'/>");style.html(".wpgmza_map img:not(button img) { padding:0 !important; }"),$(document.head).append(style)}},WPGMZA.googleUICompatibility=new WPGMZA.GoogleUICompatibility}),jQuery(function($){WPGMZA.GoogleCircle=function(options,googleCircle){var self=this;if(WPGMZA.Circle.call(this,options,googleCircle),googleCircle?this.googleCircle=googleCircle:(this.googleCircle=new google.maps.Circle,this.googleCircle.wpgmzaCircle=this),google.maps.event.addListener(this.googleCircle,"click",function(){self.dispatchEvent({type:"click"})}),options){var googleOptions={};delete(googleOptions=$.extend({},options)).map,delete googleOptions.center,options.center&&(googleOptions.center=new google.maps.LatLng({lat:options.center.lat,lng:options.center.lng})),this.googleCircle.setOptions(googleOptions),options.map&&options.map.addCircle(this)}},WPGMZA.GoogleCircle.prototype=Object.create(WPGMZA.Circle.prototype),WPGMZA.GoogleCircle.prototype.constructor=WPGMZA.GoogleCircle,WPGMZA.GoogleCircle.prototype.setCenter=function(center){WPGMZA.Circle.prototype.setCenter.apply(this,arguments),this.googleCircle.setCenter(center)},WPGMZA.GoogleCircle.prototype.setRadius=function(radius){WPGMZA.Circle.prototype.setRadius.apply(this,arguments),this.googleCircle.setRadius(1e3*parseFloat(radius))},WPGMZA.GoogleCircle.prototype.setVisible=function(visible){this.googleCircle.setVisible(!!visible)}}),jQuery(function($){WPGMZA.GoogleGeocoder=function(){},WPGMZA.GoogleGeocoder.prototype=Object.create(WPGMZA.Geocoder.prototype),WPGMZA.GoogleGeocoder.prototype.constructor=WPGMZA.GoogleGeocoder,WPGMZA.GoogleGeocoder.prototype.getLatLngFromAddress=function(options,callback){if(!options||!options.address)throw new Error("No address specified");if(WPGMZA.isLatLngString(options.address))return WPGMZA.Geocoder.prototype.getLatLngFromAddress.call(this,options,callback);options.country&&(options.componentRestrictions={country:options.country}),(new google.maps.Geocoder).geocode(options,function(results,status){if(status==google.maps.GeocoderStatus.OK){var location=results[0].geometry.location,latLng={lat:location.lat(),lng:location.lng()};callback(results=[{geometry:{location:latLng},latLng:latLng,lat:latLng.lat,lng:latLng.lng}],WPGMZA.Geocoder.SUCCESS)}else{var nativeStatus=WPGMZA.Geocoder.FAIL;status==google.maps.GeocoderStatus.ZERO_RESULTS&&(nativeStatus=WPGMZA.Geocoder.ZERO_RESULTS),callback(null,nativeStatus)}})},WPGMZA.GoogleGeocoder.prototype.getAddressFromLatLng=function(options,callback){if(!options||!options.latLng)throw new Error("No latLng specified");var latLng=new WPGMZA.LatLng(options.latLng),geocoder=new google.maps.Geocoder;delete(options=$.extend(options,{location:{lat:latLng.lat,lng:latLng.lng}})).latLng,geocoder.geocode(options,function(results,status){"OK"!==status&&callback(null,WPGMZA.Geocoder.FAIL),results&&results.length||callback([],WPGMZA.Geocoder.NO_RESULTS),callback([results[0].formatted_address],WPGMZA.Geocoder.SUCCESS)})}}),jQuery(function($){WPGMZA.settings.engine&&"google-maps"!=WPGMZA.settings.engine||window.google&&window.google.maps&&(WPGMZA.GoogleHTMLOverlay=function(map){this.element=$("<div class='wpgmza-google-html-overlay'></div>"),this.visible=!0,this.position=new WPGMZA.LatLng,this.setMap(map.googleMap),this.wpgmzaMap=map},WPGMZA.GoogleHTMLOverlay.prototype=new google.maps.OverlayView,WPGMZA.GoogleHTMLOverlay.prototype.onAdd=function(){this.getPanes().overlayMouseTarget.appendChild(this.element[0])},WPGMZA.GoogleHTMLOverlay.prototype.onRemove=function(){this.element&&$(this.element).parent().length&&($(this.element).remove(),this.element=null)},WPGMZA.GoogleHTMLOverlay.prototype.draw=function(){this.updateElementPosition()},WPGMZA.GoogleHTMLOverlay.prototype.updateElementPosition=function(){var projection=this.getProjection();if(projection){var pixels=projection.fromLatLngToDivPixel(this.position.toGoogleLatLng());$(this.element).css({left:pixels.x,top:pixels.y})}})}),jQuery(function($){var Parent;WPGMZA.GoogleInfoWindow=function(mapObject){Parent.call(this,mapObject),this.setMapObject(mapObject)},Parent=WPGMZA.isProVersion()?WPGMZA.ProInfoWindow:WPGMZA.InfoWindow,WPGMZA.GoogleInfoWindow.prototype=Object.create(Parent.prototype),WPGMZA.GoogleInfoWindow.prototype.constructor=WPGMZA.GoogleInfoWindow,WPGMZA.GoogleInfoWindow.prototype.setMapObject=function(mapObject){mapObject instanceof WPGMZA.Marker?this.googleObject=mapObject.googleMarker:mapObject instanceof WPGMZA.Polygon?this.googleObject=mapObject.googlePolygon:mapObject instanceof WPGMZA.Polyline&&(this.googleObject=mapObject.googlePolyline)},WPGMZA.GoogleInfoWindow.prototype.createGoogleInfoWindow=function(){var self=this;this.googleInfoWindow||(this.googleInfoWindow=new google.maps.InfoWindow,google.maps.event.addListener(this.googleInfoWindow,"domready",function(event){self.trigger("domready")}),google.maps.event.addListener(this.googleInfoWindow,"closeclick",function(event){self.mapObject.map.trigger("infowindowclose")}))},WPGMZA.GoogleInfoWindow.prototype.open=function(map,mapObject){var self=this;if(!Parent.prototype.open.call(this,map,mapObject))return!1;this.parent=map,this.createGoogleInfoWindow(),this.setMapObject(mapObject),this.googleInfoWindow.open(this.mapObject.map.googleMap,this.googleObject);var guid=WPGMZA.guid(),html="<div id='"+guid+"'>"+this.content+"</div>";this.googleInfoWindow.setContent(html);var intervalID;return intervalID=setInterval(function(event){div=$("#"+guid),div.length&&(clearInterval(intervalID),div[0].wpgmzaMapObject=self.mapObject,div.addClass("wpgmza-infowindow"),self.element=div[0],self.trigger("infowindowopen"))},50),!0},WPGMZA.GoogleInfoWindow.prototype.close=function(){this.googleInfoWindow&&(WPGMZA.InfoWindow.prototype.close.call(this),this.googleInfoWindow.close())},WPGMZA.GoogleInfoWindow.prototype.setContent=function(html){Parent.prototype.setContent.call(this,html),this.content=html,this.createGoogleInfoWindow(),this.googleInfoWindow.setContent(html)},WPGMZA.GoogleInfoWindow.prototype.setOptions=function(options){Parent.prototype.setOptions.call(this,options),this.createGoogleInfoWindow(),this.googleInfoWindow.setOptions(options)}}),jQuery(function($){var Parent;WPGMZA.GoogleMap=function(element,options){var self=this;if(Parent.call(this,element,options),!window.google){var status=WPGMZA.googleAPIStatus,message="Google API not loaded";if(status&&status.message&&(message+=" - "+status.message),"USER_CONSENT_NOT_GIVEN"==status.code)return;throw $(element).html("<div class='notice notice-error'><p>"+WPGMZA.localized_strings.google_api_not_loaded+"<pre>"+message+"</pre></p></div>"),new Error(message)}this.loadGoogleMap(),options&&this.setOptions(options,!0),google.maps.event.addListener(this.googleMap,"click",function(event){var wpgmzaEvent=new WPGMZA.Event("click");wpgmzaEvent.latLng={lat:event.latLng.lat(),lng:event.latLng.lng()},self.dispatchEvent(wpgmzaEvent)}),google.maps.event.addListener(this.googleMap,"rightclick",function(event){var wpgmzaEvent=new WPGMZA.Event("rightclick");wpgmzaEvent.latLng={lat:event.latLng.lat(),lng:event.latLng.lng()},self.dispatchEvent(wpgmzaEvent)}),google.maps.event.addListener(this.googleMap,"dragend",function(event){self.dispatchEvent("dragend")}),google.maps.event.addListener(this.googleMap,"zoom_changed",function(event){self.dispatchEvent("zoom_changed"),self.dispatchEvent("zoomchanged")}),google.maps.event.addListener(this.googleMap,"idle",function(event){self.onIdle(event)}),WPGMZA.isProVersion()||(this.trigger("init"),this.dispatchEvent("created"),WPGMZA.events.dispatchEvent({type:"mapcreated",map:this}))},WPGMZA.isProVersion()?(Parent=WPGMZA.ProMap,WPGMZA.GoogleMap.prototype=Object.create(WPGMZA.ProMap.prototype)):(Parent=WPGMZA.Map,WPGMZA.GoogleMap.prototype=Object.create(WPGMZA.Map.prototype)),WPGMZA.GoogleMap.prototype.constructor=WPGMZA.GoogleMap,WPGMZA.GoogleMap.prototype.loadGoogleMap=function(){var self=this,options=this.settings.toGoogleMapsOptions();this.googleMap=new google.maps.Map(this.engineElement,options),google.maps.event.addListener(this.googleMap,"bounds_changed",function(){self.onBoundsChanged()}),1==this.settings.bicycle&&this.enableBicycleLayer(!0),1==this.settings.traffic&&this.enableTrafficLayer(!0),1==this.settings.transport&&this.enablePublicTransportLayer(!0),this.showPointsOfInterest(this.settings.show_point_of_interest),$(this.engineElement).append($(this.element).find(".wpgmza-loader"))},WPGMZA.GoogleMap.prototype.setOptions=function(options,initializing){if(Parent.prototype.setOptions.call(this,options),initializing){var converted=$.extend(options,this.settings.toGoogleMapsOptions()),clone=$.extend({},converted);if(!clone.center instanceof google.maps.LatLng&&(clone.center instanceof WPGMZA.LatLng||"object"==typeof clone.center)&&(clone.center={lat:parseFloat(clone.center.lat),lng:parseFloat(clone.center.lng)}),"1"==this.settings.hide_point_of_interest){clone.styles||(clone.styles=[]),clone.styles.push({featureType:"poi",elementType:"labels",stylers:[{visibility:"off"}]})}this.googleMap.setOptions(clone)}else this.googleMap.setOptions(options)},WPGMZA.GoogleMap.prototype.addMarker=function(marker){marker.googleMarker.setMap(this.googleMap),Parent.prototype.addMarker.call(this,marker)},WPGMZA.GoogleMap.prototype.removeMarker=function(marker){marker.googleMarker.setMap(null),Parent.prototype.removeMarker.call(this,marker)},WPGMZA.GoogleMap.prototype.addPolygon=function(polygon){polygon.googlePolygon.setMap(this.googleMap),Parent.prototype.addPolygon.call(this,polygon)},WPGMZA.GoogleMap.prototype.removePolygon=function(polygon){polygon.googlePolygon.setMap(null),Parent.prototype.removePolygon.call(this,polygon)},WPGMZA.GoogleMap.prototype.addPolyline=function(polyline){polyline.googlePolyline.setMap(this.googleMap),Parent.prototype.addPolyline.call(this,polyline)},WPGMZA.GoogleMap.prototype.removePolyline=function(polyline){polyline.googlePolyline.setMap(null),Parent.prototype.removePolyline.call(this,polyline)},WPGMZA.GoogleMap.prototype.addCircle=function(circle){circle.googleCircle.setMap(this.googleMap),Parent.prototype.addCircle.call(this,circle)},WPGMZA.GoogleMap.prototype.removeCircle=function(circle){circle.googleCircle.setMap(null),Parent.prototype.removeCircle.call(this,circle)},WPGMZA.GoogleMap.prototype.getCenter=function(){var latLng=this.googleMap.getCenter();return{lat:latLng.lat(),lng:latLng.lng()}},WPGMZA.GoogleMap.prototype.setCenter=function(latLng){WPGMZA.Map.prototype.setCenter.call(this,latLng),latLng instanceof WPGMZA.LatLng?this.googleMap.setCenter({lat:latLng.lat,lng:latLng.lng}):this.googleMap.setCenter(latLng)},WPGMZA.GoogleMap.prototype.panTo=function(latLng){latLng instanceof WPGMZA.LatLng?this.googleMap.panTo({lat:latLng.lat,lng:latLng.lng}):this.googleMap.panTo(latLng)},WPGMZA.GoogleMap.prototype.getZoom=function(){return this.googleMap.getZoom()},WPGMZA.GoogleMap.prototype.setZoom=function(value){if(isNaN(value))throw new Error("Value must not be NaN");return this.googleMap.setZoom(parseInt(value))},WPGMZA.GoogleMap.prototype.getBounds=function(){var bounds=this.googleMap.getBounds(),northEast=bounds.getNorthEast(),southWest=bounds.getSouthWest(),nativeBounds=new WPGMZA.LatLngBounds({});return nativeBounds.north=northEast.lat(),nativeBounds.south=southWest.lat(),nativeBounds.west=southWest.lng(),nativeBounds.east=northEast.lng(),nativeBounds.topLeft={lat:northEast.lat(),lng:southWest.lng()},nativeBounds.bottomRight={lat:southWest.lat(),lng:northEast.lng()},nativeBounds},WPGMZA.GoogleMap.prototype.fitBounds=function(southWest,northEast){if(southWest instanceof WPGMZA.LatLng&&(southWest={lat:southWest.lat,lng:southWest.lng}),northEast instanceof WPGMZA.LatLng)northEast={lat:northEast.lat,lng:northEast.lng};else if(southWest instanceof WPGMZA.LatLngBounds){var bounds=southWest;southWest={lat:bounds.south,lng:bounds.west},northEast={lat:bounds.north,lng:bounds.east}}var nativeBounds=new google.maps.LatLngBounds(southWest,northEast);this.googleMap.fitBounds(nativeBounds)},WPGMZA.GoogleMap.prototype.fitBoundsToVisibleMarkers=function(){for(var bounds=new google.maps.LatLngBounds,i=0;i<this.markers.length;i++)markers[i].getVisible()&&bounds.extend(markers[i].getPosition());this.googleMap.fitBounds(bounds)},WPGMZA.GoogleMap.prototype.enableBicycleLayer=function(enable){this.bicycleLayer||(this.bicycleLayer=new google.maps.BicyclingLayer),this.bicycleLayer.setMap(enable?this.googleMap:null)},WPGMZA.GoogleMap.prototype.enableTrafficLayer=function(enable){this.trafficLayer||(this.trafficLayer=new google.maps.TrafficLayer),this.trafficLayer.setMap(enable?this.googleMap:null)},WPGMZA.GoogleMap.prototype.enablePublicTransportLayer=function(enable){this.publicTransportLayer||(this.publicTransportLayer=new google.maps.TransitLayer),this.publicTransportLayer.setMap(enable?this.googleMap:null)},WPGMZA.GoogleMap.prototype.showPointsOfInterest=function(show){var text=$("textarea[name='theme_data']").val();if(text){var styles=JSON.parse(text);styles.push({featureType:"poi",stylers:[{visibility:show?"on":"off"}]}),this.googleMap.setOptions({styles:styles})}},WPGMZA.GoogleMap.prototype.getMinZoom=function(){return parseInt(this.settings.min_zoom)},WPGMZA.GoogleMap.prototype.setMinZoom=function(value){this.googleMap.setOptions({minZoom:value,maxZoom:this.getMaxZoom()})},WPGMZA.GoogleMap.prototype.getMaxZoom=function(){return parseInt(this.settings.max_zoom)},WPGMZA.GoogleMap.prototype.setMaxZoom=function(value){this.googleMap.setOptions({minZoom:this.getMinZoom(),maxZoom:value})},WPGMZA.GoogleMap.prototype.latLngToPixels=function(latLng){var map=this.googleMap,nativeLatLng=new google.maps.LatLng({lat:parseFloat(latLng.lat),lng:parseFloat(latLng.lng)}),topRight=map.getProjection().fromLatLngToPoint(map.getBounds().getNorthEast()),bottomLeft=map.getProjection().fromLatLngToPoint(map.getBounds().getSouthWest()),scale=Math.pow(2,map.getZoom()),worldPoint=map.getProjection().fromLatLngToPoint(nativeLatLng);return{x:(worldPoint.x-bottomLeft.x)*scale,y:(worldPoint.y-topRight.y)*scale}},WPGMZA.GoogleMap.prototype.pixelsToLatLng=function(x,y){void 0==y&&("x"in x&&"y"in x?(y=x.y,x=x.x):console.warn("Y coordinate undefined in pixelsToLatLng (did you mean to pass 2 arguments?)"));var map=this.googleMap,topRight=map.getProjection().fromLatLngToPoint(map.getBounds().getNorthEast()),bottomLeft=map.getProjection().fromLatLngToPoint(map.getBounds().getSouthWest()),scale=Math.pow(2,map.getZoom()),worldPoint=new google.maps.Point(x/scale+bottomLeft.x,y/scale+topRight.y),latLng=map.getProjection().fromPointToLatLng(worldPoint);return{lat:latLng.lat(),lng:latLng.lng()}},WPGMZA.GoogleMap.prototype.onElementResized=function(event){this.googleMap&&google.maps.event.trigger(this.googleMap,"resize")}}),jQuery(function($){var Parent;WPGMZA.GoogleMarker=function(row){var self=this;Parent.call(this,row);var settings={};if(row)for(var name in row)row[name]instanceof WPGMZA.LatLng?settings[name]=row[name].toGoogleLatLng():row[name]instanceof WPGMZA.Map||(settings[name]=row[name]);this.googleMarker=new google.maps.Marker(settings),this.googleMarker.wpgmzaMarker=this,this.googleMarker.setPosition(new google.maps.LatLng({lat:parseFloat(this.lat),lng:parseFloat(this.lng)})),this.googleMarker.setLabel(this.settings.label),this.anim&&this.googleMarker.setAnimation(this.anim),this.animation&&this.googleMarker.setAnimation(this.animation),google.maps.event.addListener(this.googleMarker,"click",function(){self.dispatchEvent("click"),self.dispatchEvent("select")}),google.maps.event.addListener(this.googleMarker,"mouseover",function(){self.dispatchEvent("mouseover")}),google.maps.event.addListener(this.googleMarker,"dragend",function(){var googleMarkerPosition=self.googleMarker.getPosition();self.setPosition({lat:googleMarkerPosition.lat(),lng:googleMarkerPosition.lng()}),self.dispatchEvent({type:"dragend",latLng:self.getPosition()})}),this.trigger("init")},Parent=WPGMZA.isProVersion()?WPGMZA.ProMarker:WPGMZA.Marker,WPGMZA.GoogleMarker.prototype=Object.create(Parent.prototype),WPGMZA.GoogleMarker.prototype.constructor=WPGMZA.GoogleMarker,WPGMZA.GoogleMarker.prototype.setLabel=function(label){label?(this.googleMarker.setLabel({text:label}),this.googleMarker.getIcon()||this.googleMarker.setIcon(WPGMZA.settings.default_marker_icon)):this.googleMarker.setLabel(null)},WPGMZA.GoogleMarker.prototype.setPosition=function(latLng){Parent.prototype.setPosition.call(this,latLng),this.googleMarker.setPosition({lat:this.lat,lng:this.lng})},WPGMZA.GoogleMarker.prototype.updateOffset=function(){var params,self=this,icon=this.googleMarker.getIcon(),img=new Image,x=this._offset.x,y=this._offset.y;icon||(icon=WPGMZA.settings.default_marker_icon),params="string"==typeof icon?{url:icon}:icon,img.onload=function(){var defaultAnchor={x:img.width/2,y:img.height};params.anchor=new google.maps.Point(defaultAnchor.x-x,defaultAnchor.y-y),self.googleMarker.setIcon(params)},img.src=params.url},WPGMZA.GoogleMarker.prototype.setOptions=function(options){this.googleMarker.setOptions(options)},WPGMZA.GoogleMarker.prototype.setAnimation=function(animation){Parent.prototype.setAnimation.call(this,animation),this.googleMarker.setAnimation(animation)},WPGMZA.GoogleMarker.prototype.setVisible=function(visible){Parent.prototype.setVisible.call(this,visible),this.googleMarker.setVisible(!!visible)},WPGMZA.GoogleMarker.prototype.getVisible=function(visible){return this.googleMarker.getVisible()},WPGMZA.GoogleMarker.prototype.setDraggable=function(draggable){this.googleMarker.setDraggable(draggable)},WPGMZA.GoogleMarker.prototype.setOpacity=function(opacity){this.googleMarker.setOpacity(opacity)}}),jQuery(function($){WPGMZA.GoogleModernStoreLocatorCircle=function(map,settings){var self=this;WPGMZA.ModernStoreLocatorCircle.call(this,map,settings),this.intervalID=setInterval(function(){var mapSize={width:$(self.mapElement).width(),height:$(self.mapElement).height()};mapSize.width==self.mapSize.width&&mapSize.height==self.mapSize.height||(self.canvasLayer.resize_(),self.canvasLayer.draw(),self.mapSize=mapSize)},1e3),$(document).bind("webkitfullscreenchange mozfullscreenchange fullscreenchange",function(){self.canvasLayer.resize_(),self.canvasLayer.draw()})},WPGMZA.GoogleModernStoreLocatorCircle.prototype=Object.create(WPGMZA.ModernStoreLocatorCircle.prototype),WPGMZA.GoogleModernStoreLocatorCircle.prototype.constructor=WPGMZA.GoogleModernStoreLocatorCircle,WPGMZA.GoogleModernStoreLocatorCircle.prototype.initCanvasLayer=function(){var self=this;this.canvasLayer&&(this.canvasLayer.setMap(null),this.canvasLayer.setAnimate(!1)),this.canvasLayer=new CanvasLayer({map:this.map.googleMap,resizeHandler:function(event){self.onResize(event)},updateHandler:function(event){self.onUpdate(event)},animate:!0,resolutionScale:this.getResolutionScale()})},WPGMZA.GoogleModernStoreLocatorCircle.prototype.setOptions=function(options){WPGMZA.ModernStoreLocatorCircle.prototype.setOptions.call(this,options),this.canvasLayer.scheduleUpdate()},WPGMZA.GoogleModernStoreLocatorCircle.prototype.setPosition=function(position){WPGMZA.ModernStoreLocatorCircle.prototype.setPosition.call(this,position),this.canvasLayer.scheduleUpdate()},WPGMZA.GoogleModernStoreLocatorCircle.prototype.setRadius=function(radius){WPGMZA.ModernStoreLocatorCircle.prototype.setRadius.call(this,radius),this.canvasLayer.scheduleUpdate()},WPGMZA.GoogleModernStoreLocatorCircle.prototype.getTransformedRadius=function(km){var spherical=google.maps.geometry.spherical,center=this.settings.center,equator=new WPGMZA.LatLng({lat:0,lng:0}),latitude=new WPGMZA.LatLng({lat:center.lat,lng:0}),offsetAtEquator=spherical.computeOffset(equator.toGoogleLatLng(),1e3*km,90),result=.006395*km*(spherical.computeOffset(latitude.toGoogleLatLng(),1e3*km,90).lng()/offsetAtEquator.lng());if(isNaN(result))throw new Error("here");return result},WPGMZA.GoogleModernStoreLocatorCircle.prototype.getCanvasDimensions=function(){return{width:this.canvasLayer.canvas.width,height:this.canvasLayer.canvas.height}},WPGMZA.GoogleModernStoreLocatorCircle.prototype.getWorldOriginOffset=function(){var position=this.map.googleMap.getProjection().fromLatLngToPoint(this.canvasLayer.getTopLeft());return{x:-position.x,y:-position.y}},WPGMZA.GoogleModernStoreLocatorCircle.prototype.getCenterPixels=function(){var center=new WPGMZA.LatLng(this.settings.center);return this.map.googleMap.getProjection().fromLatLngToPoint(center.toGoogleLatLng())},WPGMZA.GoogleModernStoreLocatorCircle.prototype.getContext=function(type){return this.canvasLayer.canvas.getContext("2d")},WPGMZA.GoogleModernStoreLocatorCircle.prototype.getScale=function(){return Math.pow(2,this.map.getZoom())*this.getResolutionScale()},WPGMZA.GoogleModernStoreLocatorCircle.prototype.setVisible=function(visible){WPGMZA.ModernStoreLocatorCircle.prototype.setVisible.call(this,visible),this.canvasLayer.scheduleUpdate()},WPGMZA.GoogleModernStoreLocatorCircle.prototype.destroy=function(){this.canvasLayer.setMap(null),this.canvasLayer=null,clearInterval(this.intervalID)}}),jQuery(function($){WPGMZA.GoogleModernStoreLocator=function(map_id){this.map=WPGMZA.getMapByID(map_id),WPGMZA.ModernStoreLocator.call(this,map_id);var options={fields:["name","formatted_address"],types:["geocode"]},restrict=wpgmaps_localize[map_id].other_settings.wpgmza_store_locator_restrict;this.addressInput=$(this.element).find(".addressInput, #addressInput")[0],this.addressInput&&(restrict&&restrict.length&&(options.componentRestrictions={country:restrict}),this.autoComplete=new google.maps.places.Autocomplete(this.addressInput,options)),this.map.googleMap.controls[google.maps.ControlPosition.TOP_CENTER].push(this.element)},WPGMZA.GoogleModernStoreLocator.prototype=Object.create(WPGMZA.ModernStoreLocator.prototype),WPGMZA.GoogleModernStoreLocator.prototype.constructor=WPGMZA.GoogleModernStoreLocator}),jQuery(function($){var Parent;WPGMZA.GooglePolygon=function(row,googlePolygon){var self=this;if(Parent.call(this,row,googlePolygon),googlePolygon)this.googlePolygon=googlePolygon;else if(this.googlePolygon=new google.maps.Polygon(this.settings),row&&row.points){var paths=this.parseGeometry(row.points);this.googlePolygon.setOptions({paths:paths})}this.googlePolygon.wpgmzaPolygon=this,google.maps.event.addListener(this.googlePolygon,"click",function(){self.dispatchEvent({type:"click"})})},Parent=WPGMZA.isProVersion()?WPGMZA.ProPolygon:WPGMZA.Polygon,WPGMZA.GooglePolygon.prototype=Object.create(Parent.prototype),WPGMZA.GooglePolygon.prototype.constructor=WPGMZA.GooglePolygon,WPGMZA.GooglePolygon.prototype.getEditable=function(){return this.googlePolygon.getOptions().editable},WPGMZA.GooglePolygon.prototype.setEditable=function(value){this.googlePolygon.setOptions({editable:value})},WPGMZA.GooglePolygon.prototype.toJSON=function(){var result=WPGMZA.Polygon.prototype.toJSON.call(this);result.points=[];for(var path=this.googlePolygon.getPath(),i=0;i<path.getLength();i++){var latLng=path.getAt(i);result.points.push({lat:latLng.lat(),lng:latLng.lng()})}return result}}),jQuery(function($){WPGMZA.GooglePolyline=function(row,googlePolyline){var self=this;if(WPGMZA.Polyline.call(this,row,googlePolyline),googlePolyline)this.googlePolyline=googlePolyline;else if(this.googlePolyline=new google.maps.Polyline(this.settings),this.googlePolyline.wpgmzaPolyline=this,row&&row.points){var path=this.parseGeometry(row.points);this.setPoints(path)}google.maps.event.addListener(this.googlePolyline,"click",function(){self.dispatchEvent({type:"click"})})},WPGMZA.GooglePolyline.prototype=Object.create(WPGMZA.Polyline.prototype),WPGMZA.GooglePolyline.prototype.constructor=WPGMZA.GooglePolyline,WPGMZA.GooglePolyline.prototype.setEditable=function(value){this.googlePolyline.setOptions({editable:value})},WPGMZA.GooglePolyline.prototype.setPoints=function(points){this.googlePolyline.setOptions({path:points})},WPGMZA.GooglePolyline.prototype.toJSON=function(){var result=WPGMZA.Polyline.prototype.toJSON.call(this);result.points=[];for(var path=this.googlePolyline.getPath(),i=0;i<path.getLength();i++){var latLng=path.getAt(i);result.points.push({lat:latLng.lat(),lng:latLng.lng()})}return result}}),jQuery(function($){WPGMZA.GoogleText=function(options){WPGMZA.Text.apply(this,arguments),this.overlay=new WPGMZA.GoogleTextOverlay(options)},WPGMZA.extend(WPGMZA.GoogleText,WPGMZA.Text)}),jQuery(function($){WPGMZA.GoogleTextOverlay=function(options){this.element=$("<div class='wpgmza-google-text-overlay'><div class='wpgmza-inner'></div></div>"),console.log(options),options||(options={}),options.position&&(this.position=options.position),options.text&&this.element.find(".wpgmza-inner").text(options.text),options.map&&this.setMap(options.map.googleMap)},window.google&&google.maps&&google.maps.OverlayView&&(WPGMZA.GoogleTextOverlay.prototype=new google.maps.OverlayView),WPGMZA.GoogleTextOverlay.prototype.onAdd=function(){var position=this.getProjection().fromLatLngToDivPixel(this.position.toGoogleLatLng());this.element.css({position:"absolute",left:position.x+"px",top:position.y+"px"}),this.getPanes().floatPane.appendChild(this.element[0])},WPGMZA.GoogleTextOverlay.prototype.draw=function(){var position=this.getProjection().fromLatLngToDivPixel(this.position.toGoogleLatLng());this.element.css({position:"absolute",left:position.x+"px",top:position.y+"px"})},WPGMZA.GoogleTextOverlay.prototype.onRemove=function(){this.element.remove()},WPGMZA.GoogleTextOverlay.prototype.hide=function(){this.element.hide()},WPGMZA.GoogleTextOverlay.prototype.show=function(){this.element.show()},WPGMZA.GoogleTextOverlay.prototype.toggle=function(){this.element.is(":visible")?this.element.hide():this.element.show()}}),jQuery(function($){"google-maps"==WPGMZA.settings.engine&&(WPGMZA.googleAPIStatus&&"USER_CONSENT_NOT_GIVEN"==WPGMZA.googleAPIStatus.code||(WPGMZA.GoogleVertexContextMenu=function(mapEditPage){var self=this;this.mapEditPage=mapEditPage,this.element=document.createElement("div"),this.element.className="wpgmza-vertex-context-menu",this.element.innerHTML="Delete",google.maps.event.addDomListener(this.element,"click",function(event){return self.removeVertex(),event.preventDefault(),event.stopPropagation(),!1})},WPGMZA.GoogleVertexContextMenu.prototype=new google.maps.OverlayView,WPGMZA.GoogleVertexContextMenu.prototype.onAdd=function(){var self=this,map=this.getMap();this.getPanes().floatPane.appendChild(this.element),this.divListener=google.maps.event.addDomListener(map.getDiv(),"mousedown",function(e){e.target!=self.element&&self.close()},!0)},WPGMZA.GoogleVertexContextMenu.prototype.onRemove=function(){google.maps.event.removeListener(this.divListener),this.element.parentNode.removeChild(this.element),this.set("position"),this.set("path"),this.set("vertex")},WPGMZA.GoogleVertexContextMenu.prototype.open=function(map,path,vertex){this.set("position",path.getAt(vertex)),this.set("path",path),this.set("vertex",vertex),this.setMap(map),this.draw()},WPGMZA.GoogleVertexContextMenu.prototype.close=function(){this.setMap(null)},WPGMZA.GoogleVertexContextMenu.prototype.draw=function(){var position=this.get("position"),projection=this.getProjection();if(position&&projection){var point=projection.fromLatLngToDivPixel(position);this.element.style.top=point.y+"px",this.element.style.left=point.x+"px"}},WPGMZA.GoogleVertexContextMenu.prototype.removeVertex=function(){var path=this.get("path"),vertex=this.get("vertex");path&&void 0!=vertex?(path.removeAt(vertex),this.close()):this.close()}))}),jQuery(function($){var Parent=WPGMZA.Circle;WPGMZA.OLCircle=function(options,olFeature){this.center={lat:0,lng:0},this.radius=0,Parent.call(this,options,olFeature),this.settings.fillColor||(this.settings.fillColor="#ff0000",this.settings.fillOpacity=.6),options.fillColor&&(this.settings.fillColor=options.fillColor),options.fillOpacity&&(this.settings.fillOpacity=options.fillOpacity),this.olStyle=new ol.style.Style(this.getStyleFromSettings()),this.vectorLayer3857=this.layer=new ol.layer.Vector({source:new ol.source.Vector,style:this.olStyle}),olFeature?this.olFeature=olFeature:this.recreate()},WPGMZA.OLCircle.prototype=Object.create(Parent.prototype),WPGMZA.OLCircle.prototype.constructor=WPGMZA.OLCircle,WPGMZA.OLCircle.prototype.recreate=function(){if(this.olFeature&&(this.layer.getSource().removeFeature(this.olFeature),delete this.olFeature),this.center&&this.radius){var x,y,wgs84Sphere=new ol.Sphere(6378137),radius=1e3*parseFloat(this.radius);x=this.center.lng,y=this.center.lat;var circle3857=ol.geom.Polygon.circular(wgs84Sphere,[x,y],radius,64).clone().transform("EPSG:4326","EPSG:3857");this.olFeature=new ol.Feature(circle3857),this.layer.getSource().addFeature(this.olFeature)}},WPGMZA.OLCircle.prototype.getStyleFromSettings=function(){var params={};return this.settings.strokeOpacity&&(params.stroke=new ol.style.Stroke({color:WPGMZA.hexOpacityToRGBA(this.settings.strokeColor,this.settings.strokeOpacity)})),this.settings.fillOpacity&&(params.fill=new ol.style.Fill({color:WPGMZA.hexOpacityToRGBA(this.settings.fillColor,this.settings.fillOpacity)})),params},WPGMZA.OLCircle.prototype.updateStyleFromSettings=function(){var params=this.getStyleFromSettings();this.olStyle=new ol.style.Style(params),this.layer.setStyle(this.olStyle)},WPGMZA.OLCircle.prototype.setVisible=function(visible){this.layer.setVisible(!!visible)},WPGMZA.OLCircle.prototype.setCenter=function(center){WPGMZA.Circle.prototype.setCenter.apply(this,arguments),this.recreate()},WPGMZA.OLCircle.prototype.setRadius=function(radius){WPGMZA.Circle.prototype.setRadius.apply(this,arguments),this.recreate()}}),jQuery(function($){WPGMZA.OLGeocoder=function(){},WPGMZA.OLGeocoder.prototype=Object.create(WPGMZA.Geocoder.prototype),WPGMZA.OLGeocoder.prototype.constructor=WPGMZA.OLGeocoder,WPGMZA.OLGeocoder.prototype.getResponseFromCache=function(query,callback){WPGMZA.restAPI.call("/geocode-cache",{data:{query:JSON.stringify(query)},success:function(response,xhr,status){response.lng=response.lon,callback(response)},useCompressedPathVariable:!0})},WPGMZA.OLGeocoder.prototype.getResponseFromNominatim=function(options,callback){var data={q:options.address,format:"json"};options.componentRestrictions&&options.componentRestrictions.country&&(data.countrycodes=options.componentRestrictions.country),$.ajax("https://nominatim.openstreetmap.org/search/",{data:data,success:function(response,xhr,status){callback(response)},error:function(response,xhr,status){callback(null,WPGMZA.Geocoder.FAIL)}})},WPGMZA.OLGeocoder.prototype.cacheResponse=function(query,response){$.ajax(WPGMZA.ajaxurl,{data:{action:"wpgmza_store_nominatim_cache",query:JSON.stringify(query),response:JSON.stringify(response)},method:"POST"})},WPGMZA.OLGeocoder.prototype.clearCache=function(callback){$.ajax(WPGMZA.ajaxurl,{data:{action:"wpgmza_clear_nominatim_cache"},method:"POST",success:function(response){callback(response)}})},WPGMZA.OLGeocoder.prototype.getLatLngFromAddress=function(options,callback){return WPGMZA.OLGeocoder.prototype.geocode(options,callback)},WPGMZA.OLGeocoder.prototype.getAddressFromLatLng=function(options,callback){return WPGMZA.OLGeocoder.prototype.geocode(options,callback)},WPGMZA.OLGeocoder.prototype.geocode=function(options,callback){var self=this;if(!options)throw new Error("Invalid options");options.location&&(options.latLng=new WPGMZA.LatLng(options.location));var finish,location;if(options.address)location=options.address,finish=function(response,status){for(var i=0;i<response.length;i++)response[i].geometry={location:new WPGMZA.LatLng({lat:parseFloat(response[i].lat),lng:parseFloat(response[i].lon)})},response[i].latLng={lat:parseFloat(response[i].lat),lng:parseFloat(response[i].lon)},response[i].lng=response[i].lon;callback(response,status)};else{if(!options.latLng)throw new Error("You must supply either a latLng or address");location=options.latLng.toString(),finish=function(response,status){var address=response[0].display_name;callback([address],status)}}var query={location:location,options:options};this.getResponseFromCache(query,function(response){response.length?finish(response,WPGMZA.Geocoder.SUCCESS):self.getResponseFromNominatim($.extend(options,{address:location}),function(response,status){status!=WPGMZA.Geocoder.FAIL?0!=response.length?(finish(response,WPGMZA.Geocoder.SUCCESS),self.cacheResponse(query,response)):callback([],WPGMZA.Geocoder.ZERO_RESULTS):callback(null,WPGMZA.Geocoder.FAIL)})})}}),jQuery(function($){var Parent;WPGMZA.OLInfoWindow=function(mapObject){var self=this;Parent.call(this,mapObject),this.element=$("<div class='wpgmza-infowindow ol-info-window-container ol-info-window-plain'></div>")[0],$(this.element).on("click",".ol-info-window-close",function(event){self.close()})},Parent=WPGMZA.isProVersion()?WPGMZA.ProInfoWindow:WPGMZA.InfoWindow,WPGMZA.OLInfoWindow.prototype=Object.create(Parent.prototype),WPGMZA.OLInfoWindow.prototype.constructor=WPGMZA.OLInfoWindow,WPGMZA.OLInfoWindow.prototype.open=function(map,mapObject){var self=this,latLng=mapObject.getPosition();if(!Parent.prototype.open.call(this,map,mapObject))return!1;this.parent=map,this.overlay&&this.mapObject.map.olMap.removeOverlay(this.overlay),this.overlay=new ol.Overlay({element:this.element,stopEvent:!1}),this.overlay.setPosition(ol.proj.fromLonLat([latLng.lng,latLng.lat])),self.mapObject.map.olMap.addOverlay(this.overlay),$(this.element).show(),this.trigger("infowindowopen"),this.trigger("domready")},WPGMZA.OLInfoWindow.prototype.close=function(event){$(this.element).hide(),this.overlay&&(WPGMZA.InfoWindow.prototype.close.call(this),this.trigger("infowindowclose"),this.mapObject.map.olMap.removeOverlay(this.overlay),this.overlay=null)},WPGMZA.OLInfoWindow.prototype.setContent=function(html){$(this.element).html("<i class='fa fa-times ol-info-window-close' aria-hidden='true'></i>"+html)},WPGMZA.OLInfoWindow.prototype.setOptions=function(options){options.maxWidth&&$(this.element).css({"max-width":options.maxWidth+"px"})}}),jQuery(function($){var Parent;WPGMZA.OLMap=function(element,options){var self=this;Parent.call(this,element),this.setOptions(options);var viewOptions=this.settings.toOLViewOptions();$(this.element).html(""),this.olMap=new ol.Map({target:$(element)[0],layers:[this.getTileLayer()],view:new ol.View(viewOptions)}),this.olMap.getInteractions().forEach(function(interaction){interaction instanceof ol.interaction.DragPan?interaction.setActive("yes"!=self.settings.wpgmza_settings_map_draggable):interaction instanceof ol.interaction.DoubleClickZoom?interaction.setActive(!self.settings.wpgmza_settings_map_clickzoom):interaction instanceof ol.interaction.MouseWheelZoom&&interaction.setActive("yes"!=self.settings.wpgmza_settings_map_scroll)},this),this.olMap.getControls().forEach(function(control){control instanceof ol.control.Zoom&&"yes"==WPGMZA.settings.wpgmza_settings_map_zoom&&self.olMap.removeControl(control)},this),"yes"!=WPGMZA.settings.wpgmza_settings_map_full_screen_control&&this.olMap.addControl(new ol.control.FullScreen),this.markerLayer=new ol.layer.Vector({source:new ol.source.Vector({features:[]})}),this.olMap.addLayer(this.markerLayer),this.olMap.on("movestart",function(event){self.isBeingDragged=!0}),this.olMap.on("moveend",function(event){self.wrapLongitude(),self.isBeingDragged=!1,self.dispatchEvent("dragend"),self.onIdle()}),this.olMap.getView().on("change:resolution",function(event){self.dispatchEvent("zoom_changed"),self.dispatchEvent("zoomchanged"),setTimeout(function(){self.onIdle()},10)}),this.olMap.getView().on("change",function(){self.onBoundsChanged()}),self.onBoundsChanged();var marker;this.storeLocator&&(marker=this.storeLocator.centerPointMarker)&&(this.olMap.addOverlay(marker.overlay),marker.setVisible(!1)),$(this.element).on("click contextmenu",function(event){var isRight;event=event||window.event;var latLng=self.pixelsToLatLng(event.offsetX,event.offsetY);if("which"in event?isRight=3==event.which:"button"in event&&(isRight=2==event.button),1!=event.which&&1!=event.button){if(isRight)return self.onRightClick(event)}else{if(self.isBeingDragged)return;if($(event.target).closest(".ol-marker").length)return;self.trigger({type:"click",latLng:latLng})}}),WPGMZA.isProVersion()||(this.trigger("init"),this.dispatchEvent("created"),WPGMZA.events.dispatchEvent({type:"mapcreated",map:this}))},Parent=WPGMZA.isProVersion()?WPGMZA.ProMap:WPGMZA.Map,WPGMZA.OLMap.prototype=Object.create(Parent.prototype),WPGMZA.OLMap.prototype.constructor=WPGMZA.OLMap,WPGMZA.OLMap.prototype.getTileLayer=function(){var options={};return WPGMZA.settings.tile_server_url&&(options.url=WPGMZA.settings.tile_server_url),new ol.layer.Tile({source:new ol.source.OSM(options)})},WPGMZA.OLMap.prototype.wrapLongitude=function(){var center=this.getCenter();center.lng>=-180&&center.lng<=180||(center.lng=center.lng-360*Math.floor(center.lng/360),center.lng>180&&(center.lng-=360),this.setCenter(center))},WPGMZA.OLMap.prototype.getCenter=function(){var lonLat=ol.proj.toLonLat(this.olMap.getView().getCenter());return{lat:lonLat[1],lng:lonLat[0]}},WPGMZA.OLMap.prototype.setCenter=function(latLng){var view=this.olMap.getView();WPGMZA.Map.prototype.setCenter.call(this,latLng),view.setCenter(ol.proj.fromLonLat([latLng.lng,latLng.lat])),this.wrapLongitude(),this.onBoundsChanged()},WPGMZA.OLMap.prototype.getBounds=function(){var bounds=this.olMap.getView().calculateExtent(this.olMap.getSize()),nativeBounds=new WPGMZA.LatLngBounds,topLeft=ol.proj.toLonLat([bounds[0],bounds[1]]),bottomRight=ol.proj.toLonLat([bounds[2],bounds[3]]);return nativeBounds.north=topLeft[1],nativeBounds.south=bottomRight[1],nativeBounds.west=topLeft[0],nativeBounds.east=bottomRight[0],nativeBounds},WPGMZA.OLMap.prototype.fitBounds=function(southWest,northEast){if(southWest instanceof WPGMZA.LatLng&&(southWest={lat:southWest.lat,lng:southWest.lng}),northEast instanceof WPGMZA.LatLng)northEast={lat:northEast.lat,lng:northEast.lng};else if(southWest instanceof WPGMZA.LatLngBounds){var bounds=southWest;southWest={lat:bounds.south,lng:bounds.west},northEast={lat:bounds.north,lng:bounds.east}}var view=this.olMap.getView(),extent=ol.extent.boundingExtent([ol.proj.fromLonLat([parseFloat(southWest.lng),parseFloat(southWest.lat)]),ol.proj.fromLonLat([parseFloat(northEast.lng),parseFloat(northEast.lat)])]);view.fit(extent,this.olMap.getSize())},WPGMZA.OLMap.prototype.panTo=function(latLng,zoom){var view=this.olMap.getView(),options={center:ol.proj.fromLonLat([parseFloat(latLng.lng),parseFloat(latLng.lat)]),duration:500};arguments.length>1&&(options.zoom=parseInt(zoom)),view.animate(options)},WPGMZA.OLMap.prototype.getZoom=function(){return Math.round(this.olMap.getView().getZoom())},WPGMZA.OLMap.prototype.setZoom=function(value){this.olMap.getView().setZoom(value)},WPGMZA.OLMap.prototype.getMinZoom=function(){return this.olMap.getView().getMinZoom()},WPGMZA.OLMap.prototype.setMinZoom=function(value){this.olMap.getView().setMinZoom(value)},WPGMZA.OLMap.prototype.getMaxZoom=function(){return this.olMap.getView().getMaxZoom()},WPGMZA.OLMap.prototype.setMaxZoom=function(value){this.olMap.getView().setMaxZoom(value)},WPGMZA.OLMap.prototype.setOptions=function(options){Parent.prototype.setOptions.call(this,options),this.olMap&&this.olMap.getView().setProperties(this.settings.toOLViewOptions())},WPGMZA.OLMap.prototype.addMarker=function(marker){this.olMap.addOverlay(marker.overlay),Parent.prototype.addMarker.call(this,marker)},WPGMZA.OLMap.prototype.removeMarker=function(marker){this.olMap.removeOverlay(marker.overlay),Parent.prototype.removeMarker.call(this,marker)},WPGMZA.OLMap.prototype.addPolygon=function(polygon){this.olMap.addLayer(polygon.layer),Parent.prototype.addPolygon.call(this,polygon)},WPGMZA.OLMap.prototype.removePolygon=function(polygon){this.olMap.removeLayer(polygon.layer),Parent.prototype.removePolygon.call(this,polygon)},WPGMZA.OLMap.prototype.addPolyline=function(polyline){this.olMap.addLayer(polyline.layer),Parent.prototype.addPolyline.call(this,polyline)},WPGMZA.OLMap.prototype.removePolyline=function(polyline){this.olMap.removeLayer(polyline.layer),Parent.prototype.removePolyline.call(this,polyline)},WPGMZA.OLMap.prototype.addCircle=function(circle){this.olMap.addLayer(circle.layer),Parent.prototype.addCircle.call(this,circle)},WPGMZA.OLMap.prototype.removeCircle=function(circle){this.olMap.removeLayer(circle.layer),Parent.prototype.removeCircle.call(this,circle)},WPGMZA.OLMap.prototype.pixelsToLatLng=function(x,y){void 0==y&&("x"in x&&"y"in x?(y=x.y,x=x.x):console.warn("Y coordinate undefined in pixelsToLatLng (did you mean to pass 2 arguments?)"));var coord=this.olMap.getCoordinateFromPixel([x,y]);if(!coord)return{x:null,y:null};var lonLat=ol.proj.toLonLat(coord);return{lat:lonLat[1],lng:lonLat[0]}},WPGMZA.OLMap.prototype.latLngToPixels=function(latLng){var coord=ol.proj.fromLonLat([latLng.lng,latLng.lat]),pixel=this.olMap.getPixelFromCoordinate(coord);return pixel?{x:pixel[0],y:pixel[1]}:{x:null,y:null}},WPGMZA.OLMap.prototype.enableBicycleLayer=function(value){if(value)this.bicycleLayer||(this.bicycleLayer=new ol.layer.Tile({source:new ol.source.OSM({url:"http://{a-c}.tile.opencyclemap.org/cycle/{z}/{x}/{y}.png"})})),this.olMap.addLayer(this.bicycleLayer);else{if(!this.bicycleLayer)return;this.olMap.removeLayer(this.bicycleLayer)}},WPGMZA.OLMap.prototype.onElementResized=function(event){this.olMap.updateSize()},WPGMZA.OLMap.prototype.onRightClick=function(event){if($(event.target).closest(".ol-marker, .wpgmza_modern_infowindow, .wpgmza-modern-store-locator").length)return!0;var parentOffset=$(this.element).offset(),relX=event.pageX-parentOffset.left,relY=event.pageY-parentOffset.top,latLng=this.pixelsToLatLng(relX,relY);return this.trigger({type:"rightclick",latLng:latLng}),$(this.element).trigger({type:"rightclick",latLng:latLng}),event.preventDefault(),!1}}),jQuery(function($){var Parent;WPGMZA.OLMarker=function(row){var self=this;Parent.call(this,row);var origin=ol.proj.fromLonLat([parseFloat(this.lng),parseFloat(this.lat)]),img=$("<img alt=''/>")[0];img.onload=function(event){self.map&&self.map.olMap.updateSize()},img.src=WPGMZA.defaultMarkerIcon,this.element=$("<div class='ol-marker'></div>")[0],this.element.append(img),this.element.wpgmzaMarker=this,$(this.element).on("mouseover",function(event){self.dispatchEvent("mouseover")}),this.overlay=new ol.Overlay({element:this.element,position:origin,positioning:"bottom-center",stopEvent:!1}),this.overlay.setPosition(origin),this.animation&&this.setAnimation(this.animation),this.setLabel(this.settings.label),row&&row.draggable&&this.setDraggable(!0),this.rebindClickListener(),this.trigger("init")},Parent=WPGMZA.isProVersion()?WPGMZA.ProMarker:WPGMZA.Marker,WPGMZA.OLMarker.prototype=Object.create(Parent.prototype),WPGMZA.OLMarker.prototype.constructor=WPGMZA.OLMarker,WPGMZA.OLMarker.prototype.addLabel=function(){this.setLabel(this.getLabelText())},WPGMZA.OLMarker.prototype.setLabel=function(label){label?(this.label||(this.label=$("<div class='ol-marker-label'/>"),$(this.element).append(this.label)),this.label.html(label)):this.label&&$(this.element).find(".ol-marker-label").remove()},WPGMZA.OLMarker.prototype.getVisible=function(visible){return"none"!=this.overlay.getElement().style.display},WPGMZA.OLMarker.prototype.setVisible=function(visible){Parent.prototype.setVisible.call(this,visible),this.overlay.getElement().style.display=visible?"block":"none"},WPGMZA.OLMarker.prototype.setPosition=function(latLng){Parent.prototype.setPosition.call(this,latLng);var origin=ol.proj.fromLonLat([parseFloat(this.lng),parseFloat(this.lat)]);this.overlay.setPosition(origin)},WPGMZA.OLMarker.prototype.updateOffset=function(x,y){var x=this._offset.x,y=this._offset.y;this.element.style.position="relative",this.element.style.left=x+"px",this.element.style.top=y+"px"},WPGMZA.OLMarker.prototype.setAnimation=function(anim){switch(Parent.prototype.setAnimation.call(this,anim),anim){case WPGMZA.Marker.ANIMATION_NONE:$(this.element).removeAttr("data-anim");break;case WPGMZA.Marker.ANIMATION_BOUNCE:$(this.element).attr("data-anim","bounce");break;case WPGMZA.Marker.ANIMATION_DROP:$(this.element).attr("data-anim","drop")}},WPGMZA.OLMarker.prototype.setDraggable=function(draggable){var self=this;if(draggable){var options={disabled:!1};this.jQueryDraggableInitialized||(options.start=function(event){self.onDragStart(event)},options.stop=function(event){self.onDragEnd(event)}),$(this.element).draggable(options),this.jQueryDraggableInitialized=!0,this.rebindClickListener()}else $(this.element).draggable({disabled:!0})},WPGMZA.OLMarker.prototype.setOpacity=function(opacity){$(this.element).css({opacity:opacity})},WPGMZA.OLMarker.prototype.onDragStart=function(event){this.isBeingDragged=!0},WPGMZA.OLMarker.prototype.onDragEnd=function(event){var offset={top:parseFloat($(this.element).css("top").match(/-?\d+/)[0]),left:parseFloat($(this.element).css("left").match(/-?\d+/)[0])};$(this.element).css({top:"0px",left:"0px"});var currentLatLng=this.getPosition(),pixelsBeforeDrag=this.map.latLngToPixels(currentLatLng),pixelsAfterDrag={x:pixelsBeforeDrag.x+offset.left,y:pixelsBeforeDrag.y+offset.top},latLngAfterDrag=this.map.pixelsToLatLng(pixelsAfterDrag);this.setPosition(latLngAfterDrag),this.isBeingDragged=!1,this.trigger({type:"dragend",latLng:latLngAfterDrag})},WPGMZA.OLMarker.prototype.onElementClick=function(event){var self=event.currentTarget.wpgmzaMarker;self.isBeingDragged||(self.dispatchEvent("click"),self.dispatchEvent("select"))},WPGMZA.OLMarker.prototype.rebindClickListener=function(){$(this.element).off("click",this.onElementClick),$(this.element).on("click",this.onElementClick)}}),jQuery(function($){WPGMZA.OLModernStoreLocatorCircle=function(map,settings){WPGMZA.ModernStoreLocatorCircle.call(this,map,settings)},WPGMZA.OLModernStoreLocatorCircle.prototype=Object.create(WPGMZA.ModernStoreLocatorCircle.prototype),WPGMZA.OLModernStoreLocatorCircle.prototype.constructor=WPGMZA.OLModernStoreLocatorCircle,WPGMZA.OLModernStoreLocatorCircle.prototype.initCanvasLayer=function(){var self=this,mapElement=$(this.map.element),olViewportElement=mapElement.children(".ol-viewport");this.canvas=document.createElement("canvas"),this.canvas.className="wpgmza-ol-canvas-overlay",mapElement.append(this.canvas),this.renderFunction=function(event){self.canvas.width==olViewportElement.width()&&self.canvas.height==olViewportElement.height()||(self.canvas.width=olViewportElement.width(),self.canvas.height=olViewportElement.height(),$(this.canvas).css({width:olViewportElement.width()+"px",height:olViewportElement.height()+"px"})),self.draw()},this.map.olMap.on("postrender",this.renderFunction)},WPGMZA.OLModernStoreLocatorCircle.prototype.getContext=function(type){return this.canvas.getContext(type)},WPGMZA.OLModernStoreLocatorCircle.prototype.getCanvasDimensions=function(){return{width:this.canvas.width,height:this.canvas.height}},WPGMZA.OLModernStoreLocatorCircle.prototype.getCenterPixels=function(){return this.map.latLngToPixels(this.settings.center)},WPGMZA.OLModernStoreLocatorCircle.prototype.getWorldOriginOffset=function(){return{x:0,y:0}},WPGMZA.OLModernStoreLocatorCircle.prototype.getTransformedRadius=function(km){var center=new WPGMZA.LatLng(this.settings.center),outer=new WPGMZA.LatLng(center);outer.moveByDistance(km,90);var centerPixels=this.map.latLngToPixels(center),outerPixels=this.map.latLngToPixels(outer);return Math.abs(outerPixels.x-centerPixels.x)},WPGMZA.OLModernStoreLocatorCircle.prototype.getScale=function(){return 1},WPGMZA.OLModernStoreLocatorCircle.prototype.destroy=function(){$(this.canvas).remove(),this.map.olMap.un("postrender",this.renderFunction),this.map=null,this.canvas=null}}),jQuery(function($){WPGMZA.OLModernStoreLocator=function(map_id){WPGMZA.ModernStoreLocator.call(this,map_id),$(WPGMZA.isProVersion()?".wpgmza_map[data-map-id='"+map_id+"']":"#wpgmza_map").append(this.element)},WPGMZA.OLModernStoreLocator.prototype=Object.create(WPGMZA.ModernStoreLocator),WPGMZA.OLModernStoreLocator.prototype.constructor=WPGMZA.OLModernStoreLocator}),jQuery(function($){var Parent;WPGMZA.OLPolygon=function(row,olFeature){if(Parent.call(this,row,olFeature),this.olStyle=new ol.style.Style,olFeature)this.olFeature=olFeature;else{var coordinates=[[]];if(row&&row.points){for(var paths=this.parseGeometry(row.points),i=0;i<paths.length;i++)coordinates[0].push(ol.proj.fromLonLat([parseFloat(paths[i].lng),parseFloat(paths[i].lat)]));this.olStyle=new ol.style.Style(this.getStyleFromSettings())}this.olFeature=new ol.Feature({geometry:new ol.geom.Polygon(coordinates)})}this.layer=new ol.layer.Vector({source:new ol.source.Vector({features:[this.olFeature]}),style:this.olStyle}),this.layer.getSource().getFeatures()[0].setProperties({wpgmzaPolygon:this})},Parent=WPGMZA.isProVersion()?WPGMZA.ProPolygon:WPGMZA.Polygon,WPGMZA.OLPolygon.prototype=Object.create(Parent.prototype),WPGMZA.OLPolygon.prototype.constructor=WPGMZA.OLPolygon,WPGMZA.OLPolygon.prototype.getStyleFromSettings=function(){var params={};return this.settings.strokeOpacity&&(params.stroke=new ol.style.Stroke({color:WPGMZA.hexOpacityToRGBA(this.settings.strokeColor,this.settings.strokeOpacity)})),this.settings.fillOpacity&&(params.fill=new ol.style.Fill({color:WPGMZA.hexOpacityToRGBA(this.settings.fillColor,this.settings.fillOpacity)})),params},WPGMZA.OLPolygon.prototype.updateStyleFromSettings=function(){var params=this.getStyleFromSettings();this.olStyle=new ol.style.Style(params),this.layer.setStyle(this.olStyle)},WPGMZA.OLPolygon.prototype.setEditable=function(editable){},WPGMZA.OLPolygon.prototype.toJSON=function(){var result=Parent.prototype.toJSON.call(this),coordinates=this.olFeature.getGeometry().getCoordinates()[0];result.points=[];for(var i=0;i<coordinates.length;i++){var lonLat=ol.proj.toLonLat(coordinates[i]),latLng={lat:lonLat[1],lng:lonLat[0]};result.points.push(latLng)}return result}}),jQuery(function($){var Parent;WPGMZA.OLPolyline=function(row,olFeature){if(WPGMZA.Polyline.call(this,row),this.olStyle=new ol.style.Style,olFeature)this.olFeature=olFeature;else{var coordinates=[];if(row&&row.points)for(var path=this.parseGeometry(row.points),i=0;i<path.length;i++)coordinates.push(ol.proj.fromLonLat([parseFloat(path[i].lng),parseFloat(path[i].lat)]));var params=this.getStyleFromSettings();this.olStyle=new ol.style.Style(params),this.olFeature=new ol.Feature({geometry:new ol.geom.LineString(coordinates)})}this.layer=new ol.layer.Vector({source:new ol.source.Vector({features:[this.olFeature]}),style:this.olStyle}),this.layer.getSource().getFeatures()[0].setProperties({wpgmzaPolyline:this})},Parent=WPGMZA.Polyline,WPGMZA.OLPolyline.prototype=Object.create(Parent.prototype),WPGMZA.OLPolyline.prototype.constructor=WPGMZA.OLPolyline,WPGMZA.OLPolyline.prototype.getStyleFromSettings=function(){var params={};return this.settings.strokeOpacity&&(params.stroke=new ol.style.Stroke({color:WPGMZA.hexOpacityToRGBA(this.settings.strokeColor,this.settings.strokeOpacity),width:parseInt(this.settings.strokeWeight)})),params},WPGMZA.OLPolyline.prototype.updateStyleFromSettings=function(){var params=this.getStyleFromSettings();this.olStyle=new ol.style.Style(params),this.layer.setStyle(this.olStyle)},WPGMZA.OLPolyline.prototype.setEditable=function(editable){},WPGMZA.OLPolyline.prototype.setPoints=function(points){this.olFeature&&this.layer.getSource().removeFeature(this.olFeature);for(var coordinates=[],i=0;i<points.length;i++)coordinates.push(ol.proj.fromLonLat([parseFloat(points[i].lng),parseFloat(points[i].lat)]));this.olFeature=new ol.Feature({geometry:new ol.geom.LineString(coordinates)}),this.layer.getSource().addFeature(this.olFeature)},WPGMZA.OLPolyline.prototype.toJSON=function(){var result=Parent.prototype.toJSON.call(this),coordinates=this.olFeature.getGeometry().getCoordinates();result.points=[];for(var i=0;i<coordinates.length;i++){var lonLat=ol.proj.toLonLat(coordinates[i]),latLng={lat:lonLat[1],lng:lonLat[0]};result.points.push(latLng)}return result}}),jQuery(function($){WPGMZA.OLText=function(){}}),jQuery(function($){WPGMZA.DataTable=function(element){if($.fn.dataTable.ext)$.fn.dataTable.ext.errMode="throw";else{var version=$.fn.dataTable.version?$.fn.dataTable.version:"unknown";console.log("You appear to be running an outdated or modified version of the dataTables library. This may cause issues with table functionality. This is usually caused by 3rd party software loading an older version of DataTables. The loaded version is "+version+", we recommend version 1.10.12 or above.")}this.element=element,this.element.wpgmzaDataTable=this,this.dataTableElement=this.getDataTableElement();var settings=this.getDataTableSettings();this.phpClass=$(element).attr("data-wpgmza-php-class"),this.dataTable=$(this.dataTableElement).DataTable(settings),this.wpgmzaDataTable=this,this.useCompressedPathVariable=WPGMZA.restAPI.isCompressedPathVariableSupported&&WPGMZA.settings.enable_compressed_path_variables,this.method=this.useCompressedPathVariable?"GET":"POST",this.dataTable.ajax.reload()},WPGMZA.DataTable.prototype.getDataTableElement=function(){return $(this.element).find("table")},WPGMZA.DataTable.prototype.onAJAXRequest=function(data,settings){var params={phpClass:this.phpClass},attr=$(this.element).attr("data-wpgmza-ajax-parameters");return attr&&$.extend(params,JSON.parse(attr)),$.extend(data,params)},WPGMZA.DataTable.prototype.onDataTableAjaxRequest=function(data,callback,settings){var self=this,element=this.element,route=$(element).attr("data-wpgmza-rest-api-route"),params=this.onAJAXRequest(data,settings),draw=params.draw;if(delete params.draw,!route)throw new Error("No data-wpgmza-rest-api-route attribute specified");var options={method:"POST",useCompressedPathVariable:!0,data:params,dataType:"json",cache:!this.preventCaching,beforeSend:function(xhr){xhr.setRequestHeader("X-DataTables-Draw",draw)},success:function(response,status,xhr){response.draw=draw,self.lastResponse=response,callback(response)}};return WPGMZA.restAPI.call(route,options)},WPGMZA.DataTable.prototype.getDataTableSettings=function(){var self=this,element=this.element,options={};$(element).attr("data-wpgmza-datatable-options")&&(options=JSON.parse($(element).attr("data-wpgmza-datatable-options"))),options.deferLoading=!0,options.processing=!0,options.serverSide=!0,options.ajax=function(data,callback,settings){return WPGMZA.DataTable.prototype.onDataTableAjaxRequest.apply(self,arguments)},WPGMZA.AdvancedTableDataTable&&this instanceof WPGMZA.AdvancedTableDataTable&&WPGMZA.settings.wpgmza_default_items&&(options.iDisplayLength=parseInt(WPGMZA.settings.wpgmza_default_items)),options.aLengthMenu=[5,10,25,50,100];var languageURL=this.getLanguageURL();return languageURL&&(options.language={url:languageURL}),options},WPGMZA.DataTable.prototype.getLanguageURL=function(){if(!WPGMZA.locale)return null;var languageURL;switch(WPGMZA.locale.substr(0,2)){case"af":languageURL="//cdn.datatables.net/plug-ins/1.10.12/i18n/Afrikaans.json";break;case"sq":languageURL="//cdn.datatables.net/plug-ins/1.10.12/i18n/Albanian.json";break;case"am":languageURL="//cdn.datatables.net/plug-ins/1.10.12/i18n/Amharic.json";break;case"ar":languageURL="//cdn.datatables.net/plug-ins/1.10.12/i18n/Arabic.json";break;case"hy":languageURL="//cdn.datatables.net/plug-ins/1.10.12/i18n/Armenian.json";break;case"az":languageURL="//cdn.datatables.net/plug-ins/1.10.12/i18n/Azerbaijan.json";break;case"bn":languageURL="//cdn.datatables.net/plug-ins/1.10.12/i18n/Bangla.json";break;case"eu":languageURL="//cdn.datatables.net/plug-ins/1.10.12/i18n/Basque.json";break;case"be":languageURL="//cdn.datatables.net/plug-ins/1.10.12/i18n/Belarusian.json";break;case"bg":languageURL="//cdn.datatables.net/plug-ins/1.10.12/i18n/Bulgarian.json";break;case"ca":languageURL="//cdn.datatables.net/plug-ins/1.10.12/i18n/Catalan.json";break;case"zh":languageURL="zh_TW"==WPGMZA.locale?"//cdn.datatables.net/plug-ins/1.10.12/i18n/Chinese-traditional.json":"//cdn.datatables.net/plug-ins/1.10.12/i18n/Chinese.json";break;case"hr":languageURL="//cdn.datatables.net/plug-ins/1.10.12/i18n/Croatian.json";break;case"cs":languageURL="//cdn.datatables.net/plug-ins/1.10.12/i18n/Czech.json";break;case"da":languageURL="//cdn.datatables.net/plug-ins/1.10.12/i18n/Danish.json";break;case"nl":languageURL="//cdn.datatables.net/plug-ins/1.10.12/i18n/Dutch.json";break;case"et":languageURL="//cdn.datatables.net/plug-ins/1.10.12/i18n/Estonian.json";break;case"fi":languageURL=WPGMZA.locale.match(/^fil/)?"//cdn.datatables.net/plug-ins/1.10.12/i18n/Filipino.json":"//cdn.datatables.net/plug-ins/1.10.12/i18n/Finnish.json";break;case"fr":languageURL="//cdn.datatables.net/plug-ins/1.10.12/i18n/French.json";break;case"gl":languageURL="//cdn.datatables.net/plug-ins/1.10.12/i18n/Galician.json";break;case"ka":languageURL="//cdn.datatables.net/plug-ins/1.10.12/i18n/Georgian.json";break;case"de":languageURL="//cdn.datatables.net/plug-ins/1.10.12/i18n/German.json";break;case"el":languageURL="//cdn.datatables.net/plug-ins/1.10.12/i18n/Greek.json";break;case"gu":languageURL="//cdn.datatables.net/plug-ins/1.10.12/i18n/Gujarati.json";break;case"he":languageURL="//cdn.datatables.net/plug-ins/1.10.12/i18n/Hebrew.json";break;case"hi":languageURL="//cdn.datatables.net/plug-ins/1.10.12/i18n/Hindi.json";break;case"hu":languageURL="//cdn.datatables.net/plug-ins/1.10.12/i18n/Hungarian.json";break;case"is":languageURL="//cdn.datatables.net/plug-ins/1.10.12/i18n/Icelandic.json";break;case"id":languageURL="//cdn.datatables.net/plug-ins/1.10.12/i18n/Indonesian.json";break;case"ga":languageURL="//cdn.datatables.net/plug-ins/1.10.12/i18n/Irish.json";break;case"it":languageURL="//cdn.datatables.net/plug-ins/1.10.12/i18n/Italian.json";break;case"ja":languageURL="//cdn.datatables.net/plug-ins/1.10.12/i18n/Japanese.json";break;case"kk":languageURL="//cdn.datatables.net/plug-ins/1.10.12/i18n/Kazakh.json";break;case"ko":languageURL="//cdn.datatables.net/plug-ins/1.10.12/i18n/Korean.json";break;case"ky":languageURL="//cdn.datatables.net/plug-ins/1.10.12/i18n/Kyrgyz.json";break;case"lv":languageURL="//cdn.datatables.net/plug-ins/1.10.12/i18n/Latvian.json";break;case"lt":languageURL="//cdn.datatables.net/plug-ins/1.10.12/i18n/Lithuanian.json";break;case"mk":languageURL="//cdn.datatables.net/plug-ins/1.10.12/i18n/Macedonian.json";break;case"ml":languageURL="//cdn.datatables.net/plug-ins/1.10.12/i18n/Malay.json";break;case"mn":languageURL="//cdn.datatables.net/plug-ins/1.10.12/i18n/Mongolian.json";break;case"ne":languageURL="//cdn.datatables.net/plug-ins/1.10.12/i18n/Nepali.json";break;case"nb":languageURL="//cdn.datatables.net/plug-ins/1.10.12/i18n/Norwegian-Bokmal.json";break;case"nn":languageURL="//cdn.datatables.net/plug-ins/1.10.12/i18n/Norwegian-Nynorsk.json";break;case"ps":languageURL="//cdn.datatables.net/plug-ins/1.10.12/i18n/Pashto.json";break;case"fa":languageURL="//cdn.datatables.net/plug-ins/1.10.12/i18n/Persian.json";break;case"pl":languageURL="//cdn.datatables.net/plug-ins/1.10.12/i18n/Polish.json";break;case"pt":languageURL="pt_BR"==WPGMZA.locale?"//cdn.datatables.net/plug-ins/1.10.12/i18n/Portuguese-Brasil.json":"//cdn.datatables.net/plug-ins/1.10.12/i18n/Portuguese.json";break;case"ro":languageURL="//cdn.datatables.net/plug-ins/1.10.12/i18n/Romanian.json";break;case"ru":languageURL="//cdn.datatables.net/plug-ins/1.10.12/i18n/Russian.json";break;case"sr":languageURL="//cdn.datatables.net/plug-ins/1.10.12/i18n/Serbian.json";break;case"si":languageURL="//cdn.datatables.net/plug-ins/1.10.12/i18n/Sinhala.json";break;case"sk":languageURL="//cdn.datatables.net/plug-ins/1.10.12/i18n/Slovak.json";break;case"sl":languageURL="//cdn.datatables.net/plug-ins/1.10.12/i18n/Slovenian.json";break;case"es":languageURL="//cdn.datatables.net/plug-ins/1.10.12/i18n/Spanish.json";break;case"sw":languageURL="//cdn.datatables.net/plug-ins/1.10.12/i18n/Swahili.json";break;case"sv":languageURL="//cdn.datatables.net/plug-ins/1.10.12/i18n/Swedish.json";break;case"ta":languageURL="//cdn.datatables.net/plug-ins/1.10.12/i18n/Tamil.json";break;case"te":languageURL="//cdn.datatables.net/plug-ins/1.10.12/i18n/telugu.json";break;case"th":languageURL="//cdn.datatables.net/plug-ins/1.10.12/i18n/Thai.json";break;case"tr":languageURL="//cdn.datatables.net/plug-ins/1.10.12/i18n/Turkish.json";break;case"uk":languageURL="//cdn.datatables.net/plug-ins/1.10.12/i18n/Ukrainian.json";break;case"ur":languageURL="//cdn.datatables.net/plug-ins/1.10.12/i18n/Urdu.json";break;case"uz":languageURL="//cdn.datatables.net/plug-ins/1.10.12/i18n/Uzbek.json";break;case"vi":languageURL="//cdn.datatables.net/plug-ins/1.10.12/i18n/Vietnamese.json";break;case"cy":languageURL="//cdn.datatables.net/plug-ins/1.10.12/i18n/Welsh.json"}return languageURL},WPGMZA.DataTable.prototype.onAJAXResponse=function(response){},WPGMZA.DataTable.prototype.reload=function(){this.dataTable.ajax.reload(null,!1)}}),jQuery(function($){WPGMZA.AdminMarkerDataTable=function(element){var self=this;this.preventCaching=!0,WPGMZA.DataTable.call(this,element),$(element).find(".wpgmza.select_all_markers").on("click",function(event){self.onSelectAll(event)}),$(element).find(".wpgmza.bulk_delete").on("click",function(event){self.onBulkDelete(event)})},WPGMZA.AdminMarkerDataTable.prototype=Object.create(WPGMZA.DataTable.prototype),WPGMZA.AdminMarkerDataTable.prototype.constructor=WPGMZA.AdminMarkerDataTable,WPGMZA.AdminMarkerDataTable.prototype.getDataTableSettings=function(){var self=this,options=WPGMZA.DataTable.prototype.getDataTableSettings.call(this);return options.createdRow=function(row,data,index){var meta=self.lastResponse.meta[index];row.wpgmzaMarkerData=meta},options},WPGMZA.AdminMarkerDataTable.prototype.onSelectAll=function(event){$(this.element).find("input[name='mark']").prop("checked",!0)},WPGMZA.AdminMarkerDataTable.prototype.onBulkDelete=function(event){var self=this,ids=[],map=WPGMZA.maps[0];$(this.element).find("input[name='mark']:checked").each(function(index,el){var row=$(el).closest("tr")[0];ids.push(row.wpgmzaMarkerData.id)}),ids.forEach(function(marker_id){var marker=map.getMarkerByID(marker_id);marker&&map.removeMarker(marker)}),WPGMZA.restAPI.call("/markers/?skip_cache=1",{method:"DELETE",data:{ids:ids},complete:function(){self.reload()}})},$(document).ready(function(event){$("[data-wpgmza-admin-marker-datatable]").each(function(index,el){WPGMZA.adminMarkerDataTable=new WPGMZA.AdminMarkerDataTable(el)})})});
1
+ jQuery(function($){var core={maps:[],events:null,settings:null,restAPI:null,localized_strings:null,loadingHTML:'<div class="wpgmza-preloader"><div class="wpgmza-loader">...</div></div>',getScrollAnimationOffset:function(){return(WPGMZA.settings.scroll_animation_offset||0)+$("#wpadminbar").height()},animateScroll:function(element,milliseconds){var offset=WPGMZA.getScrollAnimationOffset();milliseconds||(milliseconds=WPGMZA.settings.scroll_animation_milliseconds?WPGMZA.settings.scroll_animation_milliseconds:500),$("html, body").animate({scrollTop:$(element).offset().top-offset},milliseconds)},extend:function(child,parent){var constructor=child;child.prototype=Object.create(parent.prototype),child.prototype.constructor=constructor},guid:function(){var d=(new Date).getTime();return"undefined"!=typeof performance&&"function"==typeof performance.now&&(d+=performance.now()),"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(c){var r=(d+16*Math.random())%16|0;return d=Math.floor(d/16),("x"===c?r:3&r|8).toString(16)})},hexOpacityToRGBA:function(colour,opacity){return hex=parseInt(colour.replace(/^#/,""),16),[(16711680&hex)>>16,(65280&hex)>>8,255&hex,parseFloat(opacity)]},hexToRgba:function(hex){var c;return/^#([A-Fa-f0-9]{3}){1,2}$/.test(hex)?(3==(c=hex.substring(1).split("")).length&&(c=[c[0],c[0],c[1],c[1],c[2],c[2]]),c="0x"+c.join(""),{r:c>>16&255,g:c>>8&255,b:255&c,a:1}):0},rgbaToString:function(rgba){return"rgba("+rgba.r+", "+rgba.g+", "+rgba.b+", "+rgba.a+")"},latLngRegexp:/^(\-?\d+(\.\d+)?),\s*(\-?\d+(\.\d+)?)$/,isLatLngString:function(str){if("string"!=typeof str)return null;str.match(/^\(.+\)$/)&&(str=str.replace(/^\(|\)$/,""));var m=str.match(WPGMZA.latLngRegexp);return m?new WPGMZA.LatLng({lat:parseFloat(m[1]),lng:parseFloat(m[3])}):null},stringToLatLng:function(str){var result=WPGMZA.isLatLngString(str);if(!result)throw new Error("Not a valid latLng");return result},isHexColorString:function(str){return"string"==typeof str&&!!str.match(/#[0-9A-F]{6}/i)},imageDimensionsCache:{},getImageDimensions:function(src,callback){if(WPGMZA.imageDimensionsCache[src])callback(WPGMZA.imageDimensionsCache[src]);else{var img=document.createElement("img");img.onload=function(event){var result={width:img.width,height:img.height};WPGMZA.imageDimensionsCache[src]=result,callback(result)},img.src=src}},decodeEntities:function(input){return input.replace(/&(nbsp|amp|quot|lt|gt);/g,function(m,e){return m[e]}).replace(/&#(\d+);/gi,function(m,e){return String.fromCharCode(parseInt(e,10))})},isDeveloperMode:function(){return this.settings.developer_mode||window.Cookies&&window.Cookies.get("wpgmza-developer-mode")},isProVersion:function(){return"1"==this._isProVersion},openMediaDialog:function(callback){var file_frame;if(file_frame)return file_frame.uploader.uploader.param("post_id",set_to_post_id),void file_frame.open();(file_frame=wp.media.frames.file_frame=wp.media({title:"Select a image to upload",button:{text:"Use this image"},multiple:!1})).on("select",function(){attachment=file_frame.state().get("selection").first().toJSON(),callback(attachment.id,attachment.url)}),file_frame.open()},getCurrentPosition:function(callback,watch){var nativeFunction="getCurrentPosition";if(watch&&("userlocationupdated",nativeFunction="watchPosition",WPGMZA.getCurrentPosition(callback,!1)),navigator.geolocation){var options={enableHighAccuracy:!0};navigator.geolocation[nativeFunction](function(position){callback&&callback(position),WPGMZA.events.trigger("userlocationfound")},function(error){options.enableHighAccuracy=!1,navigator.geolocation[nativeFunction](function(position){callback&&callback(position),WPGMZA.events.trigger("userlocationfound")},function(error){console.warn(error.code,error.message)},options)},options)}else console.warn("No geolocation available on this device")},watchPosition:function(callback){return WPGMZA.getCurrentPosition(callback,!0)},runCatchableTask:function(callback,friendlyErrorContainer){if(WPGMZA.isDeveloperMode())callback();else try{callback()}catch(e){var friendlyError=new WPGMZA.FriendlyError(e);$(friendlyErrorContainer).html(""),$(friendlyErrorContainer).append(friendlyError.element),$(friendlyErrorContainer).show()}},assertInstanceOf:function(instance,instanceName){var engine,fullInstanceName,pro=WPGMZA.isProVersion()?"Pro":"";switch(WPGMZA.settings.engine){case"open-layers":engine="OL";break;default:engine="Google"}if(fullInstanceName=WPGMZA[engine+pro+instanceName]?engine+pro+instanceName:WPGMZA[pro+instanceName]?pro+instanceName:WPGMZA[engine+instanceName]?engine+instanceName:instanceName,!(instance instanceof WPGMZA[fullInstanceName]))throw new Error("Object must be an instance of "+fullInstanceName+" (did you call a constructor directly, rather than createInstance?)")},getMapByID:function(id){return WPGMZA.isProVersion()?MYMAP[id].map:MYMAP.map},isGoogleAutocompleteSupported:function(){return"object"==typeof google&&"object"==typeof google.maps&&"object"==typeof google.maps.places&&"function"==typeof google.maps.places.Autocomplete},googleAPIStatus:window.wpgmza_google_api_status,isSafari:function(){var ua=navigator.userAgent.toLowerCase();return-1!=ua.indexOf("safari")&&-1==ua.indexOf("chrome")},isTouchDevice:function(){return"ontouchstart"in window},isDeviceiOS:function(){return/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream||!!navigator.platform&&/iPad|iPhone|iPod/.test(navigator.platform)},getQueryParamValue:function(name){var m,regex=new RegExp(name+"=([^&]*)");return(m=window.location.href.match(regex))?m[1]:null}};window.WPGMZA?window.WPGMZA=$.extend(window.WPGMZA,core):window.WPGMZA=core;for(var key in WPGMZA_localized_data){var value=WPGMZA_localized_data[key];WPGMZA[key]=value}jQuery(function($){$("script[src*='wp-google-maps.combined.js'], script[src*='wp-google-maps-pro.combined.js']").length&&console.warn("Minified script is out of date, using combined script instead.");var elements=$("script").filter(function(){return this.src.match(/(^|\/)jquery\.(min\.)?js(\?|$)/i)});elements.length>1&&console.warn("Multiple jQuery versions detected: ",elements),WPGMZA.restAPI=WPGMZA.RestAPI.createInstance(),$(document).on("click",".wpgmza_edit_btn",function(){WPGMZA.animateScroll("#wpgmaps_tabs_markers")})}),$(window).on("load",function(event){for(var key in[]){console.warn("The Array object has been extended incorrectly by your theme or another plugin. This can cause issues with functionality.");break}if("https:"!=window.location.protocol){var warning='<div class="notice notice-warning"><p>'+WPGMZA.localized_strings.unsecure_geolocation+"</p></div>";$(".wpgmza-geolocation-setting").each(function(index,el){$(el).after($(warning))})}})}),jQuery(function($){WPGMZA.Compatibility=function(){this.preventDocumentWriteGoogleMapsAPI()},WPGMZA.Compatibility.prototype.preventDocumentWriteGoogleMapsAPI=function(){var old=document.write;document.write=function(content){content.match&&content.match(/maps\.google/)||old.call(document,content)}},WPGMZA.compatiblityModule=new WPGMZA.Compatibility}),function(root,factory){"object"==typeof exports?module.exports=factory(root):"function"==typeof define&&define.amd?define([],factory.bind(root,root)):factory(root)}("undefined"!=typeof global?global:this,function(root){if(root.CSS&&root.CSS.escape)return root.CSS.escape;var cssEscape=function(value){if(0==arguments.length)throw new TypeError("`CSS.escape` requires an argument.");for(var codeUnit,string=String(value),length=string.length,index=-1,result="",firstCodeUnit=string.charCodeAt(0);++index<length;)0!=(codeUnit=string.charCodeAt(index))?result+=codeUnit>=1&&codeUnit<=31||127==codeUnit||0==index&&codeUnit>=48&&codeUnit<=57||1==index&&codeUnit>=48&&codeUnit<=57&&45==firstCodeUnit?"\\"+codeUnit.toString(16)+" ":(0!=index||1!=length||45!=codeUnit)&&(codeUnit>=128||45==codeUnit||95==codeUnit||codeUnit>=48&&codeUnit<=57||codeUnit>=65&&codeUnit<=90||codeUnit>=97&&codeUnit<=122)?string.charAt(index):"\\"+string.charAt(index):result+="�";return result};return root.CSS||(root.CSS={}),root.CSS.escape=cssEscape,cssEscape}),jQuery(function($){function deg2rad(deg){return deg*(Math.PI/180)}Math.PI;WPGMZA.Distance={MILES:!0,KILOMETERS:!1,MILES_PER_KILOMETER:.621371,KILOMETERS_PER_MILE:1.60934,uiToMeters:function(uiDistance){return parseFloat(uiDistance)/(WPGMZA.settings.distance_units==WPGMZA.Distance.MILES?WPGMZA.Distance.MILES_PER_KILOMETER:1)*1e3},uiToKilometers:function(uiDistance){return.001*WPGMZA.Distance.uiToMeters(uiDistance)},uiToMiles:function(uiDistance){return WPGMZA.Distance.uiToKilometers(uiDistance)*WPGMZA.Distance.MILES_PER_KILOMETER},kilometersToUI:function(km){return WPGMZA.settings.distance_units==WPGMZA.Distance.MILES?km*WPGMZA.Distance.MILES_PER_KILOMETER:km},between:function(a,b){if(!(a instanceof WPGMZA.LatLng))throw new Error("First argument must be an instance of WPGMZA.LatLng");if(!(b instanceof WPGMZA.LatLng))throw new Error("Second argument must be an instance of WPGMZA.LatLng");if(a===b)return 0;var lat1=a.lat,lon1=a.lng,lat2=b.lat,lon2=b.lng,dLat=deg2rad(lat2-lat1),dLon=deg2rad(lon2-lon1),a=Math.sin(dLat/2)*Math.sin(dLat/2)+Math.cos(deg2rad(lat1))*Math.cos(deg2rad(lat2))*Math.sin(dLon/2)*Math.sin(dLon/2);return 6371*(2*Math.atan2(Math.sqrt(a),Math.sqrt(1-a)))}}}),jQuery(function($){WPGMZA.EliasFano=function(){if(!WPGMZA.EliasFano.isSupported)throw new Error("Elias Fano encoding is not supported on browsers without Uint8Array");WPGMZA.EliasFano.decodingTablesInitialised||WPGMZA.EliasFano.createDecodingTable()},WPGMZA.EliasFano.isSupported="Uint8Array"in window,WPGMZA.EliasFano.decodingTableHighBits=[],WPGMZA.EliasFano.decodingTableDocIDNumber=null,WPGMZA.EliasFano.decodingTableHighBitsCarryover=null,WPGMZA.EliasFano.createDecodingTable=function(){WPGMZA.EliasFano.decodingTableDocIDNumber=new Uint8Array(256),WPGMZA.EliasFano.decodingTableHighBitsCarryover=new Uint8Array(256);for(var decodingTableHighBits=WPGMZA.EliasFano.decodingTableHighBits,decodingTableDocIDNumber=WPGMZA.EliasFano.decodingTableDocIDNumber,decodingTableHighBitsCarryover=WPGMZA.EliasFano.decodingTableHighBitsCarryover,i=0;i<256;i++){var zeroCount=0;decodingTableHighBits[i]=[];for(var j=7;j>=0;j--)(i&1<<j)>0?(decodingTableHighBits[i][decodingTableDocIDNumber[i]]=zeroCount,decodingTableDocIDNumber[i]++,zeroCount=0):zeroCount=(zeroCount+1)%255;decodingTableHighBitsCarryover[i]=zeroCount}WPGMZA.EliasFano.decodingTablesInitialised=!0},WPGMZA.EliasFano.prototype.encode=function(list){function toByte(n){return 255&n}var lastDocID=0,buffer1=0,bufferLength1=0,buffer2=0,bufferLength2=0;if(0==list.length)return result;var compressedBufferPointer1=0,compressedBufferPointer2=0,averageDelta=list[list.length-1]/list.length,averageDeltaLog=Math.log2(averageDelta),lowBitsLength=Math.floor(averageDeltaLog),lowBitsMask=(1<<lowBitsLength)-1,prev=null,maxCompressedSize=Math.floor((2+Math.ceil(Math.log2(averageDelta)))*list.length/8)+6,compressedBuffer=new Uint8Array(maxCompressedSize);lowBitsLength<0&&(lowBitsLength=0),compressedBufferPointer2=Math.floor(lowBitsLength*list.length/8+6),compressedBuffer[compressedBufferPointer1++]=toByte(list.length),compressedBuffer[compressedBufferPointer1++]=toByte(list.length>>8),compressedBuffer[compressedBufferPointer1++]=toByte(list.length>>16),compressedBuffer[compressedBufferPointer1++]=toByte(list.length>>24),compressedBuffer[compressedBufferPointer1++]=toByte(lowBitsLength),list.forEach(function(docID){var docIDDelta=docID-lastDocID-1;if(null!==prev&&docID<=prev)throw new Error("Elias Fano encoding can only be used on a sorted, ascending list of unique integers.");for(prev=docID,buffer1<<=lowBitsLength,buffer1|=docIDDelta&lowBitsMask,bufferLength1+=lowBitsLength;bufferLength1>7;)bufferLength1-=8,compressedBuffer[compressedBufferPointer1++]=toByte(buffer1>>bufferLength1);var unaryCodeLength=1+(docIDDelta>>lowBitsLength);for(buffer2<<=unaryCodeLength,buffer2|=1,bufferLength2+=unaryCodeLength;bufferLength2>7;)bufferLength2-=8,compressedBuffer[compressedBufferPointer2++]=toByte(buffer2>>bufferLength2);lastDocID=docID}),bufferLength1>0&&(compressedBuffer[compressedBufferPointer1++]=toByte(buffer1<<8-bufferLength1)),bufferLength2>0&&(compressedBuffer[compressedBufferPointer2++]=toByte(buffer2<<8-bufferLength2));var result=new Uint8Array(compressedBuffer);return result.pointer=compressedBufferPointer2,result},WPGMZA.EliasFano.prototype.decode=function(compressedBuffer){var resultPointer=0,list=[];console.log("Decoding buffer from pointer "+compressedBuffer.pointer),console.log(compressedBuffer);var decodingTableHighBits=WPGMZA.EliasFano.decodingTableHighBits,decodingTableDocIDNumber=WPGMZA.EliasFano.decodingTableDocIDNumber,decodingTableHighBitsCarryover=WPGMZA.EliasFano.decodingTableHighBitsCarryover,lowBitsPointer=0,lastDocID=0,docID=0,docIDNumber=0,listCount=compressedBuffer[lowBitsPointer++];console.log("listCount is now "+listCount),listCount|=compressedBuffer[lowBitsPointer++]<<8,console.log("listCount is now "+listCount),listCount|=compressedBuffer[lowBitsPointer++]<<16,console.log("listCount is now "+listCount),listCount|=compressedBuffer[lowBitsPointer++]<<24,console.log("Read list count "+listCount);var lowBitsLength=compressedBuffer[lowBitsPointer++];console.log("lowBitsLength = "+lowBitsLength);var highBitsPointer,lowBitsCount=0,lowBits=0,cb=1;for(highBitsPointer=Math.floor(lowBitsLength*listCount/8+6);highBitsPointer<compressedBuffer.pointer;highBitsPointer++){docID+=decodingTableHighBitsCarryover[cb],docIDNumber=decodingTableDocIDNumber[cb=compressedBuffer[highBitsPointer]];for(var i=0;i<docIDNumber;i++){for(docID<<=lowBitsCount,docID|=lowBits&(1<<lowBitsCount)-1;lowBitsCount<lowBitsLength;)docID<<=8,docID|=lowBits=compressedBuffer[lowBitsPointer++],lowBitsCount+=8;docID>>=lowBitsCount-=lowBitsLength,docID+=(decodingTableHighBits[cb][i]<<lowBitsLength)+lastDocID+1,list[resultPointer++]=docID,lastDocID=docID,docID=0}}return list}}),jQuery(function($){WPGMZA.EventDispatcher=function(){WPGMZA.assertInstanceOf(this,"EventDispatcher"),this._listenersByType={}},WPGMZA.EventDispatcher.prototype.addEventListener=function(type,listener,thisObject,useCapture){var types=type.split(/\s+/);if(types.length>1)for(var i=0;i<types.length;i++)this.addEventListener(types[i],listener,thisObject,useCapture);else{if(!(listener instanceof Function))throw new Error("Listener must be a function");var target;target=this._listenersByType.hasOwnProperty(type)?this._listenersByType[type]:this._listenersByType[type]=[];var obj={listener:listener,thisObject:thisObject||this,useCapture:!!useCapture};target.push(obj)}},WPGMZA.EventDispatcher.prototype.on=WPGMZA.EventDispatcher.prototype.addEventListener,WPGMZA.EventDispatcher.prototype.removeEventListener=function(type,listener,thisObject,useCapture){var arr,obj;if(arr=this._listenersByType[type]){thisObject||(thisObject=this),useCapture=!!useCapture;for(var i=0;i<arr.length;i++)if((obj=arr[i]).listener==listener&&obj.thisObject==thisObject&&obj.useCapture==useCapture)return void arr.splice(i,1)}},WPGMZA.EventDispatcher.prototype.off=WPGMZA.EventDispatcher.prototype.removeEventListener,WPGMZA.EventDispatcher.prototype.hasEventListener=function(type){return!!_listenersByType[type]},WPGMZA.EventDispatcher.prototype.dispatchEvent=function(event){if(!(event instanceof WPGMZA.Event))if("string"==typeof event)event=new WPGMZA.Event(event);else{var src=event;event=new WPGMZA.Event;for(var name in src)event[name]=src[name]}event.target=this;for(var path=[],obj=this.parent;null!=obj;obj=obj.parent)path.unshift(obj);event.phase=WPGMZA.Event.CAPTURING_PHASE;for(var i=0;i<path.length&&!event._cancelled;i++)path[i]._triggerListeners(event);if(!event._cancelled){for(event.phase=WPGMZA.Event.AT_TARGET,this._triggerListeners(event),event.phase=WPGMZA.Event.BUBBLING_PHASE,i=path.length-1;i>=0&&!event._cancelled;i--)path[i]._triggerListeners(event);if(this.element){var customEvent={};for(var key in event){var value=event[key];"type"==key&&(value+=".wpgmza"),customEvent[key]=value}$(this.element).trigger(customEvent)}}},WPGMZA.EventDispatcher.prototype.trigger=WPGMZA.EventDispatcher.prototype.dispatchEvent,WPGMZA.EventDispatcher.prototype._triggerListeners=function(event){var arr,obj;if(arr=this._listenersByType[event.type])for(var i=0;i<arr.length;i++)obj=arr[i],(event.phase!=WPGMZA.Event.CAPTURING_PHASE||obj.useCapture)&&obj.listener.call(arr[i].thisObject,event)},WPGMZA.events=new WPGMZA.EventDispatcher}),jQuery(function($){WPGMZA.Event=function(options){if("string"==typeof options&&(this.type=options),this.bubbles=!0,this.cancelable=!0,this.phase=WPGMZA.Event.PHASE_CAPTURE,this.target=null,this._cancelled=!1,"object"==typeof options)for(var name in options)this[name]=options[name]},WPGMZA.Event.CAPTURING_PHASE=0,WPGMZA.Event.AT_TARGET=1,WPGMZA.Event.BUBBLING_PHASE=2,WPGMZA.Event.prototype.stopPropagation=function(){this._cancelled=!0}}),jQuery(function($){WPGMZA.FriendlyError=function(){}}),jQuery(function($){WPGMZA.Geocoder=function(){WPGMZA.assertInstanceOf(this,"Geocoder")},WPGMZA.Geocoder.SUCCESS="success",WPGMZA.Geocoder.ZERO_RESULTS="zero-results",WPGMZA.Geocoder.FAIL="fail",WPGMZA.Geocoder.getConstructor=function(){switch(WPGMZA.settings.engine){case"open-layers":return WPGMZA.OLGeocoder;default:return WPGMZA.GoogleGeocoder}},WPGMZA.Geocoder.createInstance=function(){return new(WPGMZA.Geocoder.getConstructor())},WPGMZA.Geocoder.prototype.getLatLngFromAddress=function(options,callback){if(WPGMZA.isLatLngString(options.address)){var parts=options.address.split(/,\s*/);callback([new WPGMZA.LatLng({lat:parseFloat(parts[0]),lng:parseFloat(parts[1])})],WPGMZA.Geocoder.SUCCESS)}},WPGMZA.Geocoder.prototype.getAddressFromLatLng=function(options,callback){callback([new WPGMZA.LatLng(options.latLng).toString()],WPGMZA.Geocoder.SUCCESS)},WPGMZA.Geocoder.prototype.geocode=function(options,callback){if("address"in options)return this.getLatLngFromAddress(options,callback);if("latLng"in options)return this.getAddressFromLatLng(options,callback);throw new Error("You must supply either a latLng or address")}}),jQuery(function($){WPGMZA.GoogleAPIErrorHandler=function(){var self=this;if("google-maps"==WPGMZA.settings.engine&&("map-edit"==WPGMZA.currentPage||0==WPGMZA.is_admin&&1==WPGMZA.userCanAdministrator)){this.element=$(WPGMZA.html.googleMapsAPIErrorDialog),1==WPGMZA.is_admin&&this.element.find(".wpgmza-front-end-only").remove(),this.errorMessageList=this.element.find(".wpgmza-google-api-error-list"),this.templateListItem=this.element.find("li.template").remove(),this.messagesAlreadyDisplayed={};var _error=console.error;console.error=function(message){self.onErrorMessage(message),_error.apply(this,arguments)},"google-maps"!=WPGMZA.settings.engine||WPGMZA.settings.wpgmza_google_maps_api_key&&WPGMZA.settings.wpgmza_google_maps_api_key.length||this.addErrorMessage(WPGMZA.localized_strings.no_google_maps_api_key,["https://www.wpgmaps.com/get-a-google-maps-api-key/"])}},WPGMZA.GoogleAPIErrorHandler.prototype.onErrorMessage=function(message){var m;if(message)if((m=message.match(/You have exceeded your (daily )?request quota for this API/))||(m=message.match(/This API project is not authorized to use this API/))||(m=message.match(/^Geocoding Service: .+/))){var urls=message.match(/http(s)?:\/\/[^\s]+/gm);this.addErrorMessage(m[0],urls)}else(m=message.match(/^Google Maps.+error: (.+)\s+(http(s?):\/\/.+)/m))&&this.addErrorMessage(m[1].replace(/([A-Z])/g," $1"),[m[2]])},WPGMZA.GoogleAPIErrorHandler.prototype.addErrorMessage=function(message,urls){var self=this;if(!this.messagesAlreadyDisplayed[message]){var li=this.templateListItem.clone();$(li).find(".wpgmza-message").html(message);var buttonContainer=$(li).find(".wpgmza-documentation-buttons"),buttonTemplate=$(li).find(".wpgmza-documentation-buttons>a");if(buttonTemplate.remove(),urls&&urls.length){for(var i=0;i<urls.length;i++){urls[i];var button=buttonTemplate.clone(),text=WPGMZA.localized_strings.documentation;button.attr("href",urls[i]),$(button).find("i").addClass("fa-external-link"),$(button).append(text)}buttonContainer.append(button)}$(this.errorMessageList).append(li),$("#wpgmza_map, .wpgmza_map").each(function(index,el){var container=$(el).find(".wpgmza-google-maps-api-error-overlay");0==container.length&&(container=$("<div class='wpgmza-google-maps-api-error-overlay'></div>")).html(self.element.html()),setTimeout(function(){$(el).append(container)},100)}),$(".gm-err-container").parent().css({"z-index":1}),this.messagesAlreadyDisplayed[message]=!0}},WPGMZA.googleAPIErrorHandler=new WPGMZA.GoogleAPIErrorHandler}),jQuery(function($){WPGMZA.InfoWindow=function(mapObject){var self=this;WPGMZA.EventDispatcher.call(this),WPGMZA.assertInstanceOf(this,"InfoWindow"),mapObject&&(this.mapObject=mapObject,mapObject.map?setTimeout(function(){self.onMapObjectAdded(event)},100):mapObject.addEventListener("added",function(event){self.onMapObjectAdded(event)}))},WPGMZA.InfoWindow.prototype=Object.create(WPGMZA.EventDispatcher.prototype),WPGMZA.InfoWindow.prototype.constructor=WPGMZA.InfoWindow,WPGMZA.InfoWindow.OPEN_BY_CLICK=1,WPGMZA.InfoWindow.OPEN_BY_HOVER=2,WPGMZA.InfoWindow.getConstructor=function(){switch(WPGMZA.settings.engine){case"open-layers":return WPGMZA.isProVersion()?WPGMZA.OLProInfoWindow:WPGMZA.OLInfoWindow;default:return WPGMZA.isProVersion()?WPGMZA.GoogleProInfoWindow:WPGMZA.GoogleInfoWindow}},WPGMZA.InfoWindow.createInstance=function(mapObject){return new(this.getConstructor())(mapObject)},WPGMZA.InfoWindow.prototype.getContent=function(callback){var html="";this.mapObject instanceof WPGMZA.Marker&&(html=this.mapObject.address),callback(html)},WPGMZA.InfoWindow.prototype.open=function(map,mapObject){return this.mapObject=mapObject,!WPGMZA.settings.disable_infowindows&&"1"!=WPGMZA.settings.wpgmza_settings_disable_infowindows&&!this.mapObject.disableInfoWindow},WPGMZA.InfoWindow.prototype.close=function(){this.trigger("infowindowclose")},WPGMZA.InfoWindow.prototype.setContent=function(options){},WPGMZA.InfoWindow.prototype.setOptions=function(options){},WPGMZA.InfoWindow.prototype.onMapObjectAdded=function(){1==this.mapObject.settings.infoopen&&this.open()}}),jQuery(function($){WPGMZA.LatLng=function(arg,lng){if(this._lat=0,this._lng=0,0!=arguments.length)if(1==arguments.length){if("string"==typeof arg){var m;if(!(m=arg.match(WPGMZA.LatLng.REGEXP)))throw new Error("Invalid LatLng string");arg={lat:m[1],lng:m[3]}}if("object"!=typeof arg||!("lat"in arg&&"lng"in arg))throw new Error("Argument must be a LatLng literal");this.lat=arg.lat,this.lng=arg.lng}else this.lat=arg,this.lng=lng},WPGMZA.LatLng.REGEXP=/^(\-?\d+(\.\d+)?),\s*(\-?\d+(\.\d+)?)$/,WPGMZA.LatLng.isValid=function(obj){return"object"==typeof obj&&("lat"in obj&&"lng"in obj)},Object.defineProperty(WPGMZA.LatLng.prototype,"lat",{get:function(){return this._lat},set:function(val){if(!$.isNumeric(val))throw new Error("Latitude must be numeric");this._lat=parseFloat(val)}}),Object.defineProperty(WPGMZA.LatLng.prototype,"lng",{get:function(){return this._lng},set:function(val){if(!$.isNumeric(val))throw new Error("Longitude must be numeric");this._lng=parseFloat(val)}}),WPGMZA.LatLng.prototype.toString=function(){return this._lat+", "+this._lng},WPGMZA.LatLng.fromCurrentPosition=function(callback,options){options||(options={}),callback&&WPGMZA.getCurrentPosition(function(position){var latLng=new WPGMZA.LatLng({lat:position.coords.latitude,lng:position.coords.longitude});options.geocodeAddress?WPGMZA.Geocoder.createInstance().getAddressFromLatLng({latLng:latLng},function(results){results.length&&(latLng.address=results[0]),callback(latLng)}):callback(latLng)})},WPGMZA.LatLng.fromGoogleLatLng=function(googleLatLng){return new WPGMZA.LatLng(googleLatLng.lat(),googleLatLng.lng())},WPGMZA.LatLng.prototype.toGoogleLatLng=function(){return new google.maps.LatLng({lat:this.lat,lng:this.lng})},WPGMZA.LatLng.prototype.toLatLngLiteral=function(){return{lat:this.lat,lng:this.lng}},WPGMZA.LatLng.prototype.moveByDistance=function(kilometers,heading){var delta=parseFloat(kilometers)/6371,theta=parseFloat(heading)/180*Math.PI,phi1=this.lat/180*Math.PI,lambda1=this.lng/180*Math.PI,sinPhi1=Math.sin(phi1),cosPhi1=Math.cos(phi1),sinDelta=Math.sin(delta),cosDelta=Math.cos(delta),sinTheta=Math.sin(theta),sinPhi2=sinPhi1*cosDelta+cosPhi1*sinDelta*Math.cos(theta),phi2=Math.asin(sinPhi2),y=sinTheta*sinDelta*cosPhi1,x=cosDelta-sinPhi1*sinPhi2,lambda2=lambda1+Math.atan2(y,x);this.lat=180*phi2/Math.PI,this.lng=180*lambda2/Math.PI},WPGMZA.LatLng.prototype.getGreatCircleDistance=function(arg1,arg2){var other,lat1=this.lat,lon1=this.lng;if(1==arguments.length)other=new WPGMZA.LatLng(arg1);else{if(2!=arguments.length)throw new Error("Invalid number of arguments");other=new WPGMZA.LatLng(arg1,arg2)}var lat2=other.lat,lon2=other.lng,phi1=lat1.toRadians(),phi2=lat2.toRadians(),deltaPhi=(lat2-lat1).toRadians(),deltaLambda=(lon2-lon1).toRadians(),a=Math.sin(deltaPhi/2)*Math.sin(deltaPhi/2)+Math.cos(phi1)*Math.cos(phi2)*Math.sin(deltaLambda/2)*Math.sin(deltaLambda/2);return 6371*(2*Math.atan2(Math.sqrt(a),Math.sqrt(1-a)))}}),jQuery(function($){WPGMZA.LatLngBounds=function(southWest,northEast){if(southWest instanceof WPGMZA.LatLngBounds){var other=southWest;this.south=other.south,this.north=other.north,this.west=other.west,this.east=other.east}else southWest&&northEast&&(this.south=southWest.lat,this.north=northEast.lat,this.west=southWest.lng,this.east=northEast.lng)},WPGMZA.LatLngBounds.fromGoogleLatLngBounds=function(googleLatLngBounds){if(!(googleLatLngBounds instanceof google.maps.LatLngBounds))throw new Error("Argument must be an instance of google.maps.LatLngBounds");var result=new WPGMZA.LatLngBounds,southWest=googleLatLngBounds.getSouthWest(),northEast=googleLatLngBounds.getNorthEast();return result.north=northEast.lat(),result.south=southWest.lat(),result.west=southWest.lng(),result.east=northEast.lng(),result},WPGMZA.LatLngBounds.prototype.isInInitialState=function(){return void 0==this.north&&void 0==this.south&&void 0==this.west&&void 0==this.east},WPGMZA.LatLngBounds.prototype.extend=function(latLng){if(latLng instanceof WPGMZA.LatLng||(latLng=new WPGMZA.LatLng(latLng)),this.isInInitialState())return this.north=this.south=latLng.lat,void(this.west=this.east=latLng.lng);latLng.lat<this.north&&(this.north=latLng.lat),latLng.lat>this.south&&(this.south=latLng.lat),latLng.lng<this.west&&(this.west=latLng.lng),latLng.lng>this.east&&(this.east=latLng.lng)},WPGMZA.LatLngBounds.prototype.extendByPixelMargin=function(map,x,arg){var y=x;if(!(map instanceof WPGMZA.Map))throw new Error("First argument must be an instance of WPGMZA.Map");if(this.isInInitialState())throw new Error("Cannot extend by pixels in initial state");arguments.length>=3&&(y=arg);var southWest=new WPGMZA.LatLng(this.south,this.west),northEast=new WPGMZA.LatLng(this.north,this.east);southWest=map.latLngToPixels(southWest),northEast=map.latLngToPixels(northEast),southWest.x-=x,southWest.y+=y,northEast.x+=x,northEast.y-=y,southWest=map.pixelsToLatLng(southWest.x,southWest.y),northEast=map.pixelsToLatLng(northEast.x,northEast.y);this.toString();this.north=northEast.lat,this.south=southWest.lat,this.west=southWest.lng,this.east=northEast.lng},WPGMZA.LatLngBounds.prototype.contains=function(latLng){if(!(latLng instanceof WPGMZA.LatLng))throw new Error("Argument must be an instance of WPGMZA.LatLng");return!(latLng.lat<Math.min(this.north,this.south))&&(!(latLng.lat>Math.max(this.north,this.south))&&(this.west<this.east?latLng.lng>=this.west&&latLng.lng<=this.east:latLng.lng<=this.west||latLng.lng>=this.east))},WPGMZA.LatLngBounds.prototype.toString=function(){return this.north+"N "+this.south+"S "+this.west+"W "+this.east+"E"}}),jQuery(function($){WPGMZA.MapObject=function(row){if(WPGMZA.assertInstanceOf(this,"MapObject"),WPGMZA.EventDispatcher.call(this),this.id=-1,this.guid=WPGMZA.guid(),this.modified=!0,this.settings={},row)for(var name in row)if("settings"==name){if(null==row.settings)this.settings={};else switch(typeof row.settings){case"string":this.settings=JSON.parse(row[name]);break;case"object":this.settings=row[name];break;default:throw new Error("Don't know how to interpret settings")}for(var name in this.settings){var value=this.settings[name];String(value).match(/^-?\d+$/)&&(this.settings[name]=parseInt(value))}}else this[name]=row[name]},WPGMZA.MapObject.prototype=Object.create(WPGMZA.EventDispatcher.prototype),WPGMZA.MapObject.prototype.constructor=WPGMZA.MapObject,WPGMZA.MapObject.prototype.parseGeometry=function(string){var pairs,coords,results=[];pairs=string.replace(/[^ ,\d\.\-+e]/g,"").split(",");for(var i=0;i<pairs.length;i++)coords=pairs[i].split(" "),results.push({lat:parseFloat(coords[1]),lng:parseFloat(coords[0])});return results},WPGMZA.MapObject.prototype.toJSON=function(){return{id:this.id,guid:this.guid,settings:this.settings}}}),jQuery(function($){var Parent=WPGMZA.MapObject;WPGMZA.Circle=function(options,engineCircle){WPGMZA.assertInstanceOf(this,"Circle"),this.center=new WPGMZA.LatLng,this.radius=100,Parent.apply(this,arguments)},WPGMZA.Circle.prototype=Object.create(Parent.prototype),WPGMZA.Circle.prototype.constructor=WPGMZA.Circle,WPGMZA.Circle.createInstance=function(options){var constructor;switch(WPGMZA.settings.engine){case"open-layers":constructor=WPGMZA.OLCircle;break;default:constructor=WPGMZA.GoogleCircle}return new constructor(options)},WPGMZA.Circle.prototype.getCenter=function(){return this.center.clone()},WPGMZA.Circle.prototype.setCenter=function(latLng){this.center.lat=latLng.lat,this.center.lng=latLng.lng},WPGMZA.Circle.prototype.getRadius=function(){return this.radius},WPGMZA.Circle.prototype.setRadius=function(radius){this.radius=radius},WPGMZA.Circle.prototype.getMap=function(){return this.map},WPGMZA.Circle.prototype.setMap=function(map){this.map&&this.map.removeCircle(this),map&&map.addCircle(this)}}),jQuery(function($){WPGMZA.MapSettingsPage=function(){var self=this;this.updateEngineSpecificControls(),this.updateGDPRControls(),$("select[name='wpgmza_maps_engine']").on("change",function(event){self.updateEngineSpecificControls()}),$("input[name='wpgmza_gdpr_require_consent_before_load'], input[name='wpgmza_gdpr_require_consent_before_vgm_submit'], input[name='wpgmza_gdpr_override_notice']").on("change",function(event){self.updateGDPRControls()})},WPGMZA.MapSettingsPage.createInstance=function(){return new WPGMZA.MapSettingsPage},WPGMZA.MapSettingsPage.prototype.updateEngineSpecificControls=function(){var engine=$("select[name='wpgmza_maps_engine']").val();$("[data-required-maps-engine][data-required-maps-engine!='"+engine+"']").hide(),$("[data-required-maps-engine='"+engine+"']").show()},WPGMZA.MapSettingsPage.prototype.updateGDPRControls=function(){var showNoticeControls=$("input[name='wpgmza_gdpr_require_consent_before_load']").prop("checked"),vgmCheckbox=$("input[name='wpgmza_gdpr_require_consent_before_vgm_submit']");vgmCheckbox.length&&(showNoticeControls=showNoticeControls||vgmCheckbox.prop("checked"));var showOverrideTextarea=showNoticeControls&&$("input[name='wpgmza_gdpr_override_notice']").prop("checked");showNoticeControls?$("#wpgmza-gdpr-compliance-notice").show("slow"):$("#wpgmza-gdpr-compliance-notice").hide("slow"),showOverrideTextarea?$("#wpgmza_gdpr_override_notice_text").show("slow"):$("#wpgmza_gdpr_override_notice_text").hide("slow")},WPGMZA.MapSettingsPage.prototype.flushGeocodeCache=function(){(new WPGMZA.OLGeocoder).clearCache(function(response){jQuery("#wpgmza_flush_cache_btn").removeAttr("disabled")})},jQuery(function($){window.location.href.match(/wp-google-maps-menu-settings/)&&(WPGMZA.mapSettingsPage=WPGMZA.MapSettingsPage.createInstance(),jQuery(document).ready(function(){jQuery("#wpgmza_flush_cache_btn").on("click",function(){jQuery(this).attr("disabled","disabled"),WPGMZA.mapSettingsPage.flushGeocodeCache()})}))})}),jQuery(function($){WPGMZA.MapSettings=function(element){function addSettings(input){if(input)for(var key in input)if("other_settings"!=key){var value=input[key];String(value).match(/^-?\d+$/)&&(value=parseInt(value)),self[key]=value}}var json,self=this,str=element.getAttribute("data-settings");try{json=JSON.parse(str)}catch(e){str=str.replace(/\\%/g,"%"),str=str.replace(/\\\\"/g,'\\"');try{json=JSON.parse(str)}catch(e){json={},console.warn("Failed to parse map settings JSON")}}WPGMZA.assertInstanceOf(this,"MapSettings"),addSettings(WPGMZA.settings),addSettings(json),json&&json.other_settings&&addSettings(json.other_settings)},WPGMZA.MapSettings.prototype.toOLViewOptions=function(){var options={center:ol.proj.fromLonLat([-119.4179,36.7783]),zoom:4};if("string"==typeof this.start_location){var coords=this.start_location.replace(/^\(|\)$/g,"").split(",");WPGMZA.isLatLngString(this.start_location)?options.center=ol.proj.fromLonLat([parseFloat(coords[1]),parseFloat(coords[0])]):console.warn("Invalid start location")}return this.center&&(options.center=ol.proj.fromLonLat([parseFloat(this.center.lng),parseFloat(this.center.lat)])),this.zoom&&(options.zoom=parseInt(this.zoom)),this.start_zoom&&(options.zoom=parseInt(this.start_zoom)),this.map_min_zoom&&this.map_max_zoom&&(options.minZoom=Math.min(this.map_min_zoom,this.map_max_zoom),options.maxZoom=Math.max(this.map_min_zoom,this.map_max_zoom)),options},WPGMZA.MapSettings.prototype.toGoogleMapsOptions=function(){function formatCoord(coord){return $.isNumeric(coord)?coord:parseFloat(String(coord).replace(/[\(\)\s]/,""))}var self=this,latLngCoords=this.start_location&&this.start_location.length?this.start_location.split(","):[36.7783,-119.4179],latLng=new google.maps.LatLng(formatCoord(latLngCoords[0]),formatCoord(latLngCoords[1])),zoom=this.start_zoom?parseInt(this.start_zoom):4;!this.start_zoom&&this.zoom&&(zoom=parseInt(this.zoom));var options={zoom:zoom,center:latLng};switch(function(name){return!("object"==typeof self[name]||self[name]&&self[name].length)}("center")||(options.center=new google.maps.LatLng({lat:parseFloat(this.center.lat),lng:parseFloat(this.center.lng)})),this.map_min_zoom&&this.map_max_zoom&&(options.minZoom=Math.min(this.map_min_zoom,this.map_max_zoom),options.maxZoom=Math.max(this.map_min_zoom,this.map_max_zoom)),options.zoomControl=!("yes"==this.wpgmza_settings_map_zoom),options.panControl=!("yes"==this.wpgmza_settings_map_pan),options.mapTypeControl=!("yes"==this.wpgmza_settings_map_type),options.streetViewControl=!("yes"==this.wpgmza_settings_map_streetview),options.fullscreenControl=!("yes"==this.wpgmza_settings_map_full_screen_control),options.draggable=!("yes"==this.wpgmza_settings_map_draggable),options.disableDoubleClickZoom="yes"==this.wpgmza_settings_map_clickzoom,options.scrollwheel=!("yes"==this.wpgmza_settings_map_scroll),"greedy"==this.wpgmza_force_greedy_gestures||"yes"==this.wpgmza_force_greedy_gestures?options.gestureHandling="greedy":options.gestureHandling="cooperative",parseInt(this.type)){case 2:options.mapTypeId=google.maps.MapTypeId.SATELLITE;break;case 3:options.mapTypeId=google.maps.MapTypeId.HYBRID;break;case 4:options.mapTypeId=google.maps.MapTypeId.TERRAIN;break;default:options.mapTypeId=google.maps.MapTypeId.ROADMAP}if(this.theme_data&&this.theme_data.length>0)try{options.styles=JSON.parse(this.theme_data)}catch(e){alert("Your theme data is not valid JSON and has been ignored")}return options}}),jQuery(function($){function deg2rad(deg){return deg*(Math.PI/180)}WPGMZA.Map=function(element,options){if(WPGMZA.assertInstanceOf(this,"Map"),WPGMZA.EventDispatcher.call(this),!(element instanceof HTMLElement))throw new Error("Argument must be a HTMLElement");if(this.id=element.getAttribute("data-map-id"),!/\d+/.test(this.id))throw new Error("Map ID must be an integer");if(WPGMZA.maps.push(this),this.element=element,this.element.wpgmzaMap=this,this.engineElement=element,this.markers=[],this.polygons=[],this.polylines=[],this.circles=[],this.loadSettings(options),this.shortcodeAttributes={},$(this.element).attr("data-shortcode-attributes"))try{this.shortcodeAttributes=JSON.parse($(this.element).attr("data-shortcode-attributes"))}catch(e){console.warn("Error parsing shortcode attributes")}this.initStoreLocator(),this.markerFilter=WPGMZA.MarkerFilter.createInstance(this)},WPGMZA.Map.prototype=Object.create(WPGMZA.EventDispatcher.prototype),WPGMZA.Map.prototype.constructor=WPGMZA.Map,WPGMZA.Map.nightTimeThemeData=[{elementType:"geometry",stylers:[{color:"#242f3e"}]},{elementType:"labels.text.fill",stylers:[{color:"#746855"}]},{elementType:"labels.text.stroke",stylers:[{color:"#242f3e"}]},{featureType:"administrative.locality",elementType:"labels.text.fill",stylers:[{color:"#d59563"}]},{featureType:"landscape",elementType:"geometry.fill",stylers:[{color:"#575663"}]},{featureType:"poi",elementType:"labels.text.fill",stylers:[{color:"#d59563"}]},{featureType:"poi.park",elementType:"geometry",stylers:[{color:"#263c3f"}]},{featureType:"poi.park",elementType:"labels.text.fill",stylers:[{color:"#6b9a76"}]},{featureType:"road",elementType:"geometry",stylers:[{color:"#38414e"}]},{featureType:"road",elementType:"geometry.stroke",stylers:[{color:"#212a37"}]},{featureType:"road",elementType:"labels.text.fill",stylers:[{color:"#9ca5b3"}]},{featureType:"road.highway",elementType:"geometry",stylers:[{color:"#746855"}]},{featureType:"road.highway",elementType:"geometry.fill",stylers:[{color:"#80823e"}]},{featureType:"road.highway",elementType:"geometry.stroke",stylers:[{color:"#1f2835"}]},{featureType:"road.highway",elementType:"labels.text.fill",stylers:[{color:"#f3d19c"}]},{featureType:"transit",elementType:"geometry",stylers:[{color:"#2f3948"}]},{featureType:"transit.station",elementType:"labels.text.fill",stylers:[{color:"#d59563"}]},{featureType:"water",elementType:"geometry",stylers:[{color:"#17263c"}]},{featureType:"water",elementType:"geometry.fill",stylers:[{color:"#1b737a"}]},{featureType:"water",elementType:"labels.text.fill",stylers:[{color:"#515c6d"}]},{featureType:"water",elementType:"labels.text.stroke",stylers:[{color:"#17263c"}]}],WPGMZA.Map.getConstructor=function(){switch(WPGMZA.settings.engine){case"open-layers":return WPGMZA.isProVersion()?WPGMZA.OLProMap:WPGMZA.OLMap;default:return WPGMZA.isProVersion()?WPGMZA.GoogleProMap:WPGMZA.GoogleMap}},WPGMZA.Map.createInstance=function(element,options){return new(WPGMZA.Map.getConstructor())(element,options)},WPGMZA.Map.prototype.loadSettings=function(options){var settings=new WPGMZA.MapSettings(this.element);settings.other_settings;if(delete settings.other_settings,options)for(var key in options)settings[key]=options[key];this.settings=settings},WPGMZA.Map.prototype.initStoreLocator=function(){var storeLocatorElement=$(".wpgmza_sl_main_div");storeLocatorElement.length&&(this.storeLocator=WPGMZA.StoreLocator.createInstance(this,storeLocatorElement[0]))},WPGMZA.Map.prototype.setOptions=function(options){for(var name in options)this.settings[name]=options[name]};Math.PI;WPGMZA.Map.getGeographicDistance=function(lat1,lon1,lat2,lon2){var dLat=deg2rad(lat2-lat1),dLon=deg2rad(lon2-lon1),a=Math.sin(dLat/2)*Math.sin(dLat/2)+Math.cos(deg2rad(lat1))*Math.cos(deg2rad(lat2))*Math.sin(dLon/2)*Math.sin(dLon/2);return 6371*(2*Math.atan2(Math.sqrt(a),Math.sqrt(1-a)))},WPGMZA.Map.prototype.setCenter=function(latLng){if(!("lat"in latLng&&"lng"in latLng))throw new Error("Argument is not an object with lat and lng")},WPGMZA.Map.prototype.setDimensions=function(width,height){$(this.element).css({width:width}),$(this.engineElement).css({width:"100%",height:height})},WPGMZA.Map.prototype.addMarker=function(marker){if(!(marker instanceof WPGMZA.Marker))throw new Error("Argument must be an instance of WPGMZA.Marker");marker.map=this,marker.parent=this,this.markers.push(marker),this.dispatchEvent({type:"markeradded",marker:marker}),marker.dispatchEvent({type:"added"})},WPGMZA.Map.prototype.removeMarker=function(marker){if(!(marker instanceof WPGMZA.Marker))throw new Error("Argument must be an instance of WPGMZA.Marker");if(marker.map!==this)throw new Error("Wrong map error");marker.infoWindow&&marker.infoWindow.close(),marker.map=null,marker.parent=null,this.markers.splice(this.markers.indexOf(marker),1),this.dispatchEvent({type:"markerremoved",marker:marker}),marker.dispatchEvent({type:"removed"})},WPGMZA.Map.prototype.getMarkerByID=function(id){for(var i=0;i<this.markers.length;i++)if(this.markers[i].id==id)return this.markers[i];return null},WPGMZA.Map.prototype.removeMarkerByID=function(id){var marker=this.getMarkerByID(id);marker&&this.removeMarker(marker)},WPGMZA.Map.prototype.addPolygon=function(polygon){if(!(polygon instanceof WPGMZA.Polygon))throw new Error("Argument must be an instance of WPGMZA.Polygon");polygon.map=this,this.polygons.push(polygon),this.dispatchEvent({type:"polygonadded",polygon:polygon})},WPGMZA.Map.prototype.removePolygon=function(polygon){if(!(polygon instanceof WPGMZA.Polygon))throw new Error("Argument must be an instance of WPGMZA.Polygon");if(polygon.map!==this)throw new Error("Wrong map error");polygon.map=null,this.polygons.splice(this.polygons.indexOf(polygon),1),this.dispatchEvent({type:"polygonremoved",polygon:polygon})},WPGMZA.Map.prototype.getPolygonByID=function(id){for(var i=0;i<this.polygons.length;i++)if(this.polygons[i].id==id)return this.polygons[i];return null},WPGMZA.Map.prototype.removePolygonByID=function(id){var polygon=this.getPolygonByID(id);polygon&&this.removePolygon(polygon)},WPGMZA.Map.prototype.getPolylineByID=function(id){for(var i=0;i<this.polylines.length;i++)if(this.polylines[i].id==id)return this.polylines[i];return null},WPGMZA.Map.prototype.addPolyline=function(polyline){if(!(polyline instanceof WPGMZA.Polyline))throw new Error("Argument must be an instance of WPGMZA.Polyline");polyline.map=this,this.polylines.push(polyline),this.dispatchEvent({type:"polylineadded",polyline:polyline})},WPGMZA.Map.prototype.removePolyline=function(polyline){if(!(polyline instanceof WPGMZA.Polyline))throw new Error("Argument must be an instance of WPGMZA.Polyline");if(polyline.map!==this)throw new Error("Wrong map error");polyline.map=null,this.polylines.splice(this.polylines.indexOf(polyline),1),this.dispatchEvent({type:"polylineremoved",polyline:polyline})},WPGMZA.Map.prototype.getPolylineByID=function(id){for(var i=0;i<this.polylines.length;i++)if(this.polylines[i].id==id)return this.polylines[i];return null},WPGMZA.Map.prototype.removePolylineByID=function(id){var polyline=this.getPolylineByID(id);polyline&&this.removePolyline(polyline)},WPGMZA.Map.prototype.addCircle=function(circle){if(!(circle instanceof WPGMZA.Circle))throw new Error("Argument must be an instance of WPGMZA.Circle");circle.map=this,this.circles.push(circle),this.dispatchEvent({type:"circleadded",circle:circle})},WPGMZA.Map.prototype.removeCircle=function(circle){if(!(circle instanceof WPGMZA.Circle))throw new Error("Argument must be an instance of WPGMZA.Circle");if(circle.map!==this)throw new Error("Wrong map error");circle.map=null,this.circles.splice(this.circles.indexOf(circle),1),this.dispatchEvent({type:"circleremoved",circle:circle})},WPGMZA.Map.prototype.getCircleByID=function(id){for(var i=0;i<this.circles.length;i++)if(this.circles[i].id==id)return this.circles[i];return null},WPGMZA.Map.prototype.removeCircleByID=function(id){var circle=this.getCircleByID(id);circle&&this.removeCircle(circle)},WPGMZA.Map.prototype.nudge=function(x,y){var pixels=this.latLngToPixels(this.getCenter());if(pixels.x+=parseFloat(x),pixels.y+=parseFloat(y),isNaN(pixels.x)||isNaN(pixels.y))throw new Error("Invalid coordinates supplied");var latLng=this.pixelsToLatLng(pixels);this.setCenter(latLng)},WPGMZA.Map.prototype.onWindowResize=function(event){},WPGMZA.Map.prototype.onElementResized=function(event){},WPGMZA.Map.prototype.onBoundsChanged=function(event){this.trigger("boundschanged"),this.trigger("bounds_changed")},WPGMZA.Map.prototype.onIdle=function(event){this.trigger("idle")}}),jQuery(function($){WPGMZA.MapsEngineDialog=function(element){var self=this;this.element=element,window.wpgmzaUnbindSaveReminder&&window.wpgmzaUnbindSaveReminder(),$(element).show(),$(element).remodal().open(),$(element).find("input:radio").on("change",function(event){$("#wpgmza-confirm-engine").prop("disabled",!1)}),$("#wpgmza-confirm-engine").on("click",function(event){self.onButtonClicked(event)})},WPGMZA.MapsEngineDialog.prototype.onButtonClicked=function(event){$(event.target).prop("disabled",!0),$.ajax(WPGMZA.ajaxurl,{method:"POST",data:{action:"wpgmza_maps_engine_dialog_set_engine",engine:$("[name='wpgmza_maps_engine']:checked").val(),nonce:$("#wpgmza-maps-engine-dialog").attr("data-ajax-nonce")},success:function(response,status,xhr){window.location.reload()}})},$(window).on("load",function(event){var element=$("#wpgmza-maps-engine-dialog");element.length&&(WPGMZA.settings.wpgmza_maps_engine_dialog_done||WPGMZA.settings.wpgmza_google_maps_api_key&&WPGMZA.settings.wpgmza_google_maps_api_key.length||(WPGMZA.mapsEngineDialog=new WPGMZA.MapsEngineDialog(element)))})}),jQuery(function($){WPGMZA.MarkerFilter=function(map){WPGMZA.EventDispatcher.call(this),this.map=map},WPGMZA.MarkerFilter.prototype=Object.create(WPGMZA.EventDispatcher.prototype),WPGMZA.MarkerFilter.prototype.constructor=WPGMZA.MarkerFilter,WPGMZA.MarkerFilter.createInstance=function(map){return new WPGMZA.MarkerFilter(map)},WPGMZA.MarkerFilter.prototype.getFilteringParameters=function(){var params={map_id:this.map.id};return this.map.storeLocator&&(params=$.extend(params,this.map.storeLocator.getFilteringParameters())),params},WPGMZA.MarkerFilter.prototype.update=function(){},WPGMZA.MarkerFilter.prototype.onFilteringComplete=function(results){}}),jQuery(function($){WPGMZA.Marker=function(row){var self=this;this._offset={x:0,y:0},WPGMZA.assertInstanceOf(this,"Marker"),this.lat="36.778261",this.lng="-119.4179323999",this.address="California",this.title=null,this.description="",this.link="",this.icon="",this.approved=1,this.pic=null,this.disableInfoWindow=!1,WPGMZA.MapObject.apply(this,arguments),row&&row.heatmap||(row&&this.on("init",function(event){row.position&&this.setPosition(row.position),row.map&&row.map.addMarker(this)}),this.addEventListener("added",function(event){self.onAdded(event)}))},WPGMZA.Marker.prototype=Object.create(WPGMZA.MapObject.prototype),WPGMZA.Marker.prototype.constructor=WPGMZA.Marker,WPGMZA.Marker.getConstructor=function(){switch(WPGMZA.settings.engine){case"open-layers":return WPGMZA.isProVersion()?WPGMZA.OLProMarker:WPGMZA.OLMarker;default:return WPGMZA.isProVersion()?WPGMZA.GoogleProMarker:WPGMZA.GoogleMarker}},WPGMZA.Marker.createInstance=function(row){return new(WPGMZA.Marker.getConstructor())(row)},WPGMZA.Marker.ANIMATION_NONE="0",WPGMZA.Marker.ANIMATION_BOUNCE="1",WPGMZA.Marker.ANIMATION_DROP="2",Object.defineProperty(WPGMZA.Marker.prototype,"offsetX",{get:function(){return this._offset.x},set:function(value){this._offset.x=value,this.updateOffset()}}),Object.defineProperty(WPGMZA.Marker.prototype,"offsetY",{get:function(){return this._offset.y},set:function(value){this._offset.y=value,this.updateOffset()}}),WPGMZA.Marker.prototype.onAdded=function(event){var self=this;this.addEventListener("click",function(event){self.onClick(event)}),this.addEventListener("mouseover",function(event){self.onMouseOver(event)}),this.addEventListener("select",function(event){self.onSelect(event)}),this.map.settings.marker==this.id&&self.trigger("select"),"1"==this.infoopen&&this.openInfoWindow()},WPGMZA.Marker.prototype.initInfoWindow=function(){this.infoWindow||(this.infoWindow=WPGMZA.InfoWindow.createInstance())},WPGMZA.Marker.prototype.openInfoWindow=function(){this.map?("map-edit"!=WPGMZA.currentPage||WPGMZA.pro_version)&&(this.map.lastInteractedMarker&&this.map.lastInteractedMarker.infoWindow.close(),this.map.lastInteractedMarker=this,this.initInfoWindow(),this.infoWindow.open(this.map,this)):console.warn("Cannot open infowindow for marker with no map")},WPGMZA.Marker.prototype.onClick=function(event){},WPGMZA.Marker.prototype.onSelect=function(event){this.openInfoWindow()},WPGMZA.Marker.prototype.onMouseOver=function(event){this.map.settings.info_window_open_by==WPGMZA.InfoWindow.OPEN_BY_HOVER&&this.openInfoWindow()},WPGMZA.Marker.prototype.getIcon=function(){function stripProtocol(url){return"string"!=typeof url?url:url.replace(/^http(s?):/,"")}return stripProtocol(WPGMZA.defaultMarkerIcon?WPGMZA.defaultMarkerIcon:WPGMZA.settings.default_marker_icon)},WPGMZA.Marker.prototype.getPosition=function(){return new WPGMZA.LatLng({lat:parseFloat(this.lat),lng:parseFloat(this.lng)})},WPGMZA.Marker.prototype.setPosition=function(latLng){latLng instanceof WPGMZA.LatLng?(this.lat=latLng.lat,this.lng=latLng.lng):(this.lat=parseFloat(latLng.lat),this.lng=parseFloat(latLng.lng))},WPGMZA.Marker.prototype.setOffset=function(x,y){this._offset.x=x,this._offset.y=y,this.updateOffset()},WPGMZA.Marker.prototype.updateOffset=function(){},WPGMZA.Marker.prototype.getAnimation=function(animation){return this.settings.animation},WPGMZA.Marker.prototype.setAnimation=function(animation){this.settings.animation=animation},WPGMZA.Marker.prototype.getVisible=function(){},WPGMZA.Marker.prototype.setVisible=function(visible){!visible&&this.infoWindow&&this.infoWindow.close()},WPGMZA.Marker.prototype.getMap=function(){return this.map},WPGMZA.Marker.prototype.setMap=function(map){map?map.addMarker(this):this.map&&this.map.removeMarker(this),this.map=map},WPGMZA.Marker.prototype.getDraggable=function(){},WPGMZA.Marker.prototype.setDraggable=function(draggable){},WPGMZA.Marker.prototype.setOptions=function(options){},WPGMZA.Marker.prototype.setOpacity=function(opacity){},WPGMZA.Marker.prototype.panIntoView=function(){if(!this.map)throw new Error("Marker hasn't been added to a map");this.map.setCenter(this.getPosition())},WPGMZA.Marker.prototype.toJSON=function(){var result=WPGMZA.MapObject.prototype.toJSON.call(this),position=this.getPosition();return $.extend(result,{lat:position.lat,lng:position.lng,address:this.address,title:this.title,description:this.description,link:this.link,icon:this.icon,pic:this.pic,approved:this.approved}),result}}),jQuery(function($){WPGMZA.ModernStoreLocatorCircle=function(map_id,settings){var map;map=WPGMZA.isProVersion()?this.map=MYMAP[map_id].map:this.map=MYMAP.map,this.map_id=map_id,this.mapElement=map.element,this.mapSize={width:$(this.mapElement).width(),height:$(this.mapElement).height()},this.initCanvasLayer(),this.settings={center:new WPGMZA.LatLng(0,0),radius:1,color:"#63AFF2",shadowColor:"white",shadowBlur:4,centerRingRadius:10,centerRingLineWidth:3,numInnerRings:9,innerRingLineWidth:1,innerRingFade:!0,numOuterRings:7,ringLineWidth:1,mainRingLineWidth:2,numSpokes:6,spokesStartAngle:Math.PI/2,numRadiusLabels:6,radiusLabelsStartAngle:Math.PI/2,radiusLabelFont:"13px sans-serif",visible:!1},settings&&this.setOptions(settings)},WPGMZA.ModernStoreLocatorCircle.createInstance=function(map,settings){return"google-maps"==WPGMZA.settings.engine?new WPGMZA.GoogleModernStoreLocatorCircle(map,settings):new WPGMZA.OLModernStoreLocatorCircle(map,settings)},WPGMZA.ModernStoreLocatorCircle.prototype.initCanvasLayer=function(){},WPGMZA.ModernStoreLocatorCircle.prototype.onResize=function(event){this.draw()},WPGMZA.ModernStoreLocatorCircle.prototype.onUpdate=function(event){this.draw()},WPGMZA.ModernStoreLocatorCircle.prototype.setOptions=function(options){for(var name in options){var functionName="set"+name.substr(0,1).toUpperCase()+name.substr(1);"function"==typeof this[functionName]?this[functionName](options[name]):this.settings[name]=options[name]}},WPGMZA.ModernStoreLocatorCircle.prototype.getResolutionScale=function(){return window.devicePixelRatio||1},WPGMZA.ModernStoreLocatorCircle.prototype.getCenter=function(){return this.getPosition()},WPGMZA.ModernStoreLocatorCircle.prototype.setCenter=function(value){this.setPosition(value)},WPGMZA.ModernStoreLocatorCircle.prototype.getPosition=function(){return this.settings.center},WPGMZA.ModernStoreLocatorCircle.prototype.setPosition=function(position){this.settings.center=position},WPGMZA.ModernStoreLocatorCircle.prototype.getRadius=function(){return this.settings.radius},WPGMZA.ModernStoreLocatorCircle.prototype.setRadius=function(radius){if(isNaN(radius))throw new Error("Invalid radius");this.settings.radius=radius},WPGMZA.ModernStoreLocatorCircle.prototype.getVisible=function(){return this.settings.visible},WPGMZA.ModernStoreLocatorCircle.prototype.setVisible=function(visible){this.settings.visible=visible},WPGMZA.ModernStoreLocatorCircle.prototype.getTransformedRadius=function(km){throw new Error("Abstract function called")},WPGMZA.ModernStoreLocatorCircle.prototype.getContext=function(type){throw new Error("Abstract function called")},WPGMZA.ModernStoreLocatorCircle.prototype.getCanvasDimensions=function(){throw new Error("Abstract function called")},WPGMZA.ModernStoreLocatorCircle.prototype.validateSettings=function(){WPGMZA.isHexColorString(this.settings.color)||(this.settings.color="#63AFF2")},WPGMZA.ModernStoreLocatorCircle.prototype.draw=function(){this.validateSettings();var settings=this.settings,canvasDimensions=this.getCanvasDimensions(),canvasWidth=canvasDimensions.width,canvasHeight=canvasDimensions.height;this.map,this.getResolutionScale();if(context=this.getContext("2d"),context.clearRect(0,0,canvasWidth,canvasHeight),settings.visible){context.shadowColor=settings.shadowColor,context.shadowBlur=settings.shadowBlur,context.setTransform(1,0,0,1,0,0);var scale=this.getScale();context.scale(scale,scale);var offset=this.getWorldOriginOffset();context.translate(offset.x,offset.y);new WPGMZA.LatLng(this.settings.center);var worldPoint=this.getCenterPixels(),rgba=WPGMZA.hexToRgba(settings.color),ringSpacing=this.getTransformedRadius(settings.radius)/(settings.numInnerRings+1);context.strokeStyle=settings.color,context.lineWidth=1/scale*settings.centerRingLineWidth,context.beginPath(),context.arc(worldPoint.x,worldPoint.y,this.getTransformedRadius(settings.centerRingRadius)/scale,0,2*Math.PI),context.stroke(),context.closePath();var end,spokeAngle,radius=this.getTransformedRadius(settings.radius)+ringSpacing*settings.numOuterRings+1,grad=context.createRadialGradient(0,0,0,0,0,radius),rgba=WPGMZA.hexToRgba(settings.color),start=WPGMZA.rgbaToString(rgba);rgba.a=0,end=WPGMZA.rgbaToString(rgba),grad.addColorStop(0,start),grad.addColorStop(1,end),context.save(),context.translate(worldPoint.x,worldPoint.y),context.strokeStyle=grad,context.lineWidth=2/scale;for(i=0;i<settings.numSpokes;i++)spokeAngle=settings.spokesStartAngle+2*Math.PI*(i/settings.numSpokes),x=Math.cos(spokeAngle)*radius,y=Math.sin(spokeAngle)*radius,context.setLineDash([2/scale,15/scale]),context.beginPath(),context.moveTo(0,0),context.lineTo(x,y),context.stroke();context.setLineDash([]),context.restore(),context.lineWidth=1/scale*settings.innerRingLineWidth;for(i=1;i<=settings.numInnerRings;i++){radius=i*ringSpacing;settings.innerRingFade&&(rgba.a=1-(i-1)/settings.numInnerRings),context.strokeStyle=WPGMZA.rgbaToString(rgba),context.beginPath(),context.arc(worldPoint.x,worldPoint.y,radius,0,2*Math.PI),context.stroke(),context.closePath()}context.strokeStyle=settings.color,context.lineWidth=1/scale*settings.centerRingLineWidth,context.beginPath(),context.arc(worldPoint.x,worldPoint.y,this.getTransformedRadius(settings.radius),0,2*Math.PI),context.stroke(),context.closePath();for(var radius=radius+ringSpacing,i=0;i<settings.numOuterRings;i++)settings.innerRingFade&&(rgba.a=1-i/settings.numOuterRings),context.strokeStyle=WPGMZA.rgbaToString(rgba),context.beginPath(),context.arc(worldPoint.x,worldPoint.y,radius,0,2*Math.PI),context.stroke(),context.closePath(),radius+=ringSpacing;if(settings.numRadiusLabels>0){var m,x,y,radius=this.getTransformedRadius(settings.radius);(m=settings.radiusLabelFont.match(/(\d+)px/))&&parseInt(m[1])/2*1.1/scale,context.font=settings.radiusLabelFont,context.textAlign="center",context.textBaseline="middle",context.fillStyle=settings.color,context.save(),context.translate(worldPoint.x,worldPoint.y);for(i=0;i<settings.numRadiusLabels;i++){var width,textAngle=(spokeAngle=settings.radiusLabelsStartAngle+2*Math.PI*(i/settings.numRadiusLabels))+Math.PI/2,text=settings.radiusString;Math.sin(spokeAngle)>0&&(textAngle-=Math.PI),x=Math.cos(spokeAngle)*radius,y=Math.sin(spokeAngle)*radius,context.save(),context.translate(x,y),context.rotate(textAngle),context.scale(1/scale,1/scale),width=context.measureText(text).width,height=width/2,context.clearRect(-width,-height,2*width,2*height),context.fillText(settings.radiusString,0,0),context.restore()}context.restore()}}}}),jQuery(function($){WPGMZA.ModernStoreLocator=function(map_id){var original,self=this,map=WPGMZA.getMapByID(map_id);if(WPGMZA.assertInstanceOf(this,"ModernStoreLocator"),(original=WPGMZA.isProVersion()?$(".wpgmza_sl_search_button[mid='"+map_id+"']").closest(".wpgmza_sl_main_div"):$(".wpgmza_sl_search_button").closest(".wpgmza_sl_main_div")).length){this.element=$("<div class='wpgmza-modern-store-locator'><div class='wpgmza-inner wpgmza-modern-hover-opaque'/></div>")[0];var inner=$(this.element).find(".wpgmza-inner"),titleSearch=$(original).find("[id='nameInput_"+map_id+"']");if(titleSearch.length){var placeholder=wpgmaps_localize[map_id].other_settings.store_locator_name_string;placeholder&&placeholder.length&&titleSearch.attr("placeholder",placeholder),inner.append(titleSearch)}var addressInput;addressInput=WPGMZA.isProVersion()?$(original).find(".addressInput"):$(original).find("#addressInput"),wpgmaps_localize[map_id].other_settings.store_locator_query_string&&wpgmaps_localize[map_id].other_settings.store_locator_query_string.length&&addressInput.attr("placeholder",wpgmaps_localize[map_id].other_settings.store_locator_query_string),inner.append(addressInput);var button;(button=$(original).find("button.wpgmza-use-my-location"))&&inner.append(button),$(addressInput).on("keydown keypress",function(event){13==event.keyCode&&self.searchButton.is(":visible")&&self.searchButton.trigger("click")}),$(addressInput).on("input",function(event){self.searchButton.show(),self.resetButton.hide()}),inner.append($(original).find("select.wpgmza_sl_radius_select")),this.searchButton=$(original).find(".wpgmza_sl_search_button"),inner.append(this.searchButton),this.resetButton=$(original).find(".wpgmza_sl_reset_button_div"),inner.append(this.resetButton),this.resetButton.on("click",function(event){resetLocations(map_id)}),this.resetButton.hide(),WPGMZA.isProVersion()&&(this.searchButton.on("click",function(event){0!=$("addressInput_"+map_id).val()&&(self.searchButton.hide(),self.resetButton.show(),map.storeLocator.state=WPGMZA.StoreLocator.STATE_APPLIED)}),this.resetButton.on("click",function(event){self.resetButton.hide(),self.searchButton.show(),map.storeLocator.state=WPGMZA.StoreLocator.STATE_INITIAL})),inner.append($("#wpgmza_distance_type_"+map_id));var container=$(original).find(".wpgmza_cat_checkbox_holder"),numCategories=($(container).children("ul"),0),icons=[];$(container).find("li").each(function(index,el){var id=$(el).attr("class").match(/\d+/);for(var category_id in wpgmza_category_data)if(id==category_id){var src=wpgmza_category_data[category_id].image,icon=$('<div class="wpgmza-chip-icon"/>');icon.css({"background-image":"url('"+src+"')",width:$("#wpgmza_cat_checkbox_"+category_id+" + label").height()+"px"}),icons.push(icon),null!=src&&""!=src&&$("#wpgmza_cat_checkbox_"+category_id+" + label").prepend(icon),numCategories++;break}}),$(this.element).append(container),numCategories&&(this.optionsButton=$('<span class="wpgmza_store_locator_options_button"><i class="fa fa-list"></i></span>'),$(this.searchButton).before(this.optionsButton)),setInterval(function(){icons.forEach(function(icon){var height=$(icon).height();$(icon).css({width:height+"px"}),$(icon).closest("label").css({"padding-left":height+8+"px"})}),$(container).css("width",$(self.element).find(".wpgmza-inner").outerWidth()+"px")},1e3),$(this.element).find(".wpgmza_store_locator_options_button").on("click",function(event){container.hasClass("wpgmza-open")?container.removeClass("wpgmza-open"):container.addClass("wpgmza-open")}),$(original).remove(),$(this.element).find("input, select").on("focus",function(){$(inner).addClass("active")}),$(this.element).find("input, select").on("blur",function(){$(inner).removeClass("active")})}},WPGMZA.ModernStoreLocator.createInstance=function(map_id){switch(WPGMZA.settings.engine){case"open-layers":return new WPGMZA.OLModernStoreLocator(map_id);default:return new WPGMZA.GoogleModernStoreLocator(map_id)}}}),jQuery(function($){WPGMZA.NativeMapsAppIcon=function(){navigator.userAgent.match(/^Apple|iPhone|iPad|iPod/)?(this.type="apple",this.element=$('<span><i class="fab fa-apple" aria-hidden="true"></i></span>')):(this.type="google",this.element=$('<span><i class="fab fa-google" aria-hidden="true"></i></span>'))}}),jQuery(function($){WPGMZA.Polygon=function(row,enginePolygon){WPGMZA.assertInstanceOf(this,"Polygon"),this.paths=null,this.title=null,this.name=null,this.link=null,WPGMZA.MapObject.apply(this,arguments)},WPGMZA.Polygon.prototype=Object.create(WPGMZA.MapObject.prototype),WPGMZA.Polygon.prototype.constructor=WPGMZA.Polygon,WPGMZA.Polygon.getConstructor=function(){switch(WPGMZA.settings.engine){case"open-layers":return WPGMZA.isProVersion()?WPGMZA.OLProPolygon:WPGMZA.OLPolygon;default:return WPGMZA.isProVersion()?WPGMZA.GoogleProPolygon:WPGMZA.GooglePolygon}},WPGMZA.Polygon.createInstance=function(row,engineObject){return new(WPGMZA.Polygon.getConstructor())(row,engineObject)},WPGMZA.Polygon.prototype.toJSON=function(){var result=WPGMZA.MapObject.prototype.toJSON.call(this);return $.extend(result,{name:this.name,title:this.title,link:this.link}),result}}),jQuery(function($){WPGMZA.Polyline=function(row,googlePolyline){WPGMZA.assertInstanceOf(this,"Polyline"),this.title=null,WPGMZA.MapObject.apply(this,arguments)},WPGMZA.Polyline.prototype=Object.create(WPGMZA.MapObject.prototype),WPGMZA.Polyline.prototype.constructor=WPGMZA.Polyline,WPGMZA.Polyline.getConstructor=function(){switch(WPGMZA.settings.engine){case"open-layers":return WPGMZA.OLPolyline;default:return WPGMZA.GooglePolyline}},WPGMZA.Polyline.createInstance=function(row,engineObject){return new(WPGMZA.Polyline.getConstructor())(row,engineObject)},WPGMZA.Polyline.prototype.getPoints=function(){return this.toJSON().points},WPGMZA.Polyline.prototype.toJSON=function(){var result=WPGMZA.MapObject.prototype.toJSON.call(this);return result.title=this.title,result}}),jQuery(function($){WPGMZA.PopoutPanel=function(){},WPGMZA.PopoutPanel.prototype.open=function(){$(this.element).addClass("wpgmza-open")},WPGMZA.PopoutPanel.prototype.close=function(){$(this.element).removeClass("wpgmza-open")}}),jQuery(function($){function sendAJAXFallbackRequest(route,params){if((params=$.extend({},params)).data||(params.data={}),"route"in params.data)throw new Error("Cannot send route through this method");if("action"in params.data)throw new Error("Cannot send action through this method");return params.data.route=route,params.data.action="wpgmza_rest_api_request",WPGMZA.restAPI.addNonce(route,params,WPGMZA.RestAPI.CONTEXT_AJAX),$.ajax(WPGMZA.ajaxurl,params)}WPGMZA.RestAPI=function(){WPGMZA.RestAPI.URL=WPGMZA.resturl,this.useAJAXFallback=!1},WPGMZA.RestAPI.CONTEXT_REST="REST",WPGMZA.RestAPI.CONTEXT_AJAX="AJAX",WPGMZA.RestAPI.createInstance=function(){return new WPGMZA.RestAPI},Object.defineProperty(WPGMZA.RestAPI.prototype,"isCompressedPathVariableSupported",{get:function(){return WPGMZA.serverCanInflate&&"Uint8Array"in window&&"TextEncoder"in window}}),Object.defineProperty(WPGMZA.RestAPI.prototype,"maxURLLength",{get:function(){return 2083}}),WPGMZA.RestAPI.prototype.compressParams=function(params){var suffix="";if(params.markerIDs){var markerIDs=params.markerIDs.split(","),encoded=(encoder=new WPGMZA.EliasFano).encode(markerIDs),compressed=pako.deflate(encoded),string=Array.prototype.map.call(compressed,function(ch){return String.fromCharCode(ch)}).join("");suffix="/"+btoa(string).replace(/\//g,"-"),params.midcbp=encoded.pointer,delete params.markerIDs}var string=JSON.stringify(params),encoder=new TextEncoder,input=encoder.encode(string),compressed=pako.deflate(input),raw=Array.prototype.map.call(compressed,function(ch){return String.fromCharCode(ch)}).join("");return btoa(raw).replace(/\//g,"-")+suffix},WPGMZA.RestAPI.prototype.getNonce=function(route){for(var pattern in WPGMZA.restnoncetable){var regex=new RegExp(pattern);if(route.match(regex))return WPGMZA.restnoncetable[pattern]}throw new Error("No nonce found for route")},WPGMZA.RestAPI.prototype.addNonce=function(route,params,context){var self=this,setRESTNonce=function(xhr){context==WPGMZA.RestAPI.CONTEXT_REST&&xhr.setRequestHeader("X-WP-Nonce",WPGMZA.restnonce),params&&params.method&&!params.method.match(/^GET$/i)&&xhr.setRequestHeader("X-WPGMZA-Action-Nonce",self.getNonce(route))};if(params.beforeSend){var base=params.beforeSend;params.beforeSend=function(xhr){base(xhr),setRESTNonce(xhr)}}else params.beforeSend=setRESTNonce},WPGMZA.RestAPI.prototype.call=function(route,params){if(this.useAJAXFallback)return sendAJAXFallbackRequest(route,params);var attemptedCompressedPathVariable=!1,fallbackRoute=route,fallbackParams=$.extend({},params);if("string"!=typeof route||!route.match(/^\//))throw new Error("Invalid route");if(WPGMZA.RestAPI.URL.match(/\/$/)&&(route=route.replace(/^\//,"")),params||(params={}),this.addNonce(route,params,WPGMZA.RestAPI.CONTEXT_REST),params.error||(params.error=function(xhr,status,message){if("abort"!=status){switch(xhr.status){case 401:case 403:return $.post(WPGMZA.ajaxurl,{action:"wpgmza_report_rest_api_blocked"},function(response){}),console.warn("The REST API was blocked. This is usually due to security plugins blocking REST requests for non-authenticated users."),this.useAJAXFallback=!0,sendAJAXFallbackRequest(fallbackRoute,fallbackParams);case 414:if(!attemptedCompressedPathVariable)break;return fallbackParams.method="POST",fallbackParams.useCompressedPathVariable=!1,WPGMZA.restAPI.call(fallbackRoute,fallbackParams)}throw new Error(message)}}),params.useCompressedPathVariable&&this.isCompressedPathVariableSupported&&WPGMZA.settings.enable_compressed_path_variables){var compressedParams=$.extend({},params),data=params.data,compressedRoute=route.replace(/\/$/,"")+"/base64"+this.compressParams(data);WPGMZA.RestAPI.URL;compressedParams.method="GET",delete compressedParams.data,!1===params.cache&&(compressedParams.data={skip_cache:1}),compressedRoute.length<this.maxURLLength?(attemptedCompressedPathVariable=!0,route=compressedRoute,params=compressedParams):(WPGMZA.RestAPI.compressedPathVariableURLLimitWarningDisplayed||console.warn("Compressed path variable route would exceed URL length limit"),WPGMZA.RestAPI.compressedPathVariableURLLimitWarningDisplayed=!0)}return $.ajax(WPGMZA.RestAPI.URL+route,params)};var nativeCallFunction=WPGMZA.RestAPI.call;WPGMZA.RestAPI.call=function(){console.warn("WPGMZA.RestAPI.call was called statically, did you mean to call the function on WPGMZA.restAPI?"),nativeCallFunction.apply(this,arguments)},$(document.body).on("click","#wpgmza-rest-api-blocked button.notice-dismiss",function(event){WPGMZA.restAPI.call("/rest-api/",{method:"POST",data:{dismiss_blocked_notice:!0}})})}),jQuery(function($){WPGMZA.StoreLocator=function(map,element){var self=this;WPGMZA.EventDispatcher.call(this),this._center=null,this.map=map,this.element=element,this.state=WPGMZA.StoreLocator.STATE_INITIAL,this.map.on("storelocatorgeocodecomplete",function(event){self.onGeocodeComplete(event)}),this.map.on("init",function(event){self.map.markerFilter.on("filteringcomplete",function(event){self.onFilteringComplete(event)})}),$(document.body).on("click",".wpgmza_sl_search_button_"+map.id,function(event){self.onSearch(event)}),$(document.body).on("click",".wpgmza_sl_reset_button_"+map.id,function(event){self.onReset(event)})},WPGMZA.StoreLocator.prototype=Object.create(WPGMZA.EventDispatcher.prototype),WPGMZA.StoreLocator.prototype.constructor=WPGMZA.StoreLocator,WPGMZA.StoreLocator.STATE_INITIAL="initial",WPGMZA.StoreLocator.STATE_APPLIED="applied",WPGMZA.StoreLocator.createInstance=function(map,element){return new WPGMZA.StoreLocator(map,element)},Object.defineProperty(WPGMZA.StoreLocator.prototype,"radius",{get:function(){return $("#radiusSelect_"+this.map.id).val()}}),Object.defineProperty(WPGMZA.StoreLocator.prototype,"center",{get:function(){return this._center}}),WPGMZA.StoreLocator.prototype.onGeocodeComplete=function(event){event.results&&event.results.length?(this._center=new WPGMZA.LatLng(event.results[0].latLng),this.map.markerFilter.update()):this._center=null},WPGMZA.StoreLocator.prototype.onSearch=function(event){this.state=WPGMZA.StoreLocator.STATE_APPLIED},WPGMZA.StoreLocator.prototype.onReset=function(event){this.state=WPGMZA.StoreLocator.STATE_INITIAL,this._center=null,this.map.markerFilter.update()},WPGMZA.StoreLocator.prototype.getFilteringParameters=function(){return this.center?{center:this.center,radius:this.radius}:{}},WPGMZA.StoreLocator.prototype.onFilteringComplete=function(event){0==event.filteredMarkers.length?$(this.element).find(".wpgmza-not-found-msg").show():$(this.element).find(".wpgmza-not-found-msg").hide()}}),jQuery(function($){WPGMZA.Text=function(options){if(options)for(var name in options)this[name]=options[name]},WPGMZA.Text.createInstance=function(options){switch(WPGMZA.settings.engine){case"open-layers":return new WPGMZA.OLText(options);default:return new WPGMZA.GoogleText(options)}}}),jQuery(function($){function isPositiveInteger(x){return/^\d+$/.test(x)}function validateParts(parts){for(var i=0;i<parts.length;++i)if(!isPositiveInteger(parts[i]))return!1;return!0}WPGMZA.Version=function(){},WPGMZA.Version.GREATER_THAN=1,WPGMZA.Version.EQUAL_TO=0,WPGMZA.Version.LESS_THAN=-1,WPGMZA.Version.compare=function(v1,v2){var v1parts=v1.split("."),v2parts=v2.split(".");if(!validateParts(v1parts)||!validateParts(v2parts))return NaN;for(var i=0;i<v1parts.length;++i){if(v2parts.length===i)return 1;if(v1parts[i]!==v2parts[i])return v1parts[i]>v2parts[i]?1:-1}return v1parts.length!=v2parts.length?-1:0}}),jQuery(function($){WPGMZA.Integration={},WPGMZA.integrationModules={}}),jQuery(function($){if(window.wp&&wp.i18n&&wp.blocks&&wp.editor&&wp.components){var __=wp.i18n.__,registerBlockType=wp.blocks.registerBlockType,_wp$editor=wp.editor,InspectorControls=_wp$editor.InspectorControls,_wp$components=(_wp$editor.BlockControls,wp.components),Dashicon=_wp$components.Dashicon,PanelBody=(_wp$components.Toolbar,_wp$components.Button,_wp$components.Tooltip,_wp$components.PanelBody);_wp$components.TextareaControl,_wp$components.CheckboxControl,_wp$components.TextControl,_wp$components.SelectControl,_wp$components.RichText;WPGMZA.Integration.Gutenberg=function(){registerBlockType("gutenberg-wpgmza/block",this.getBlockDefinition())},WPGMZA.Integration.Gutenberg.prototype.getBlockTitle=function(){return __("WP Google Maps")},WPGMZA.Integration.Gutenberg.prototype.getBlockInspectorControls=function(props){return React.createElement(InspectorControls,{key:"inspector"},React.createElement(PanelBody,{title:__("Map Settings")},React.createElement("p",{class:"map-block-gutenberg-button-container"},React.createElement("a",{href:WPGMZA.adminurl+"admin.php?page=wp-google-maps-menu&action=edit&map_id=1",target:"_blank",class:"button button-primary"},React.createElement("i",{class:"fa fa-pencil-square-o","aria-hidden":"true"}),__("Go to Map Editor"))),React.createElement("p",{class:"map-block-gutenberg-button-container"},React.createElement("a",{href:"https://www.wpgmaps.com/documentation/creating-your-first-map/",target:"_blank",class:"button button-primary"},React.createElement("i",{class:"fa fa-book","aria-hidden":"true"}),__("View Documentation")))))},WPGMZA.Integration.Gutenberg.prototype.getBlockAttributes=function(){return{}},WPGMZA.Integration.Gutenberg.prototype.getBlockDefinition=function(props){var _this=this;return{title:__("WP Google Maps"),description:__("The easiest to use Google Maps plugin! Create custom Google Maps 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."),category:"common",icon:"location-alt",keywords:[__("Map"),__("Maps"),__("Google")],attributes:this.getBlockAttributes(),edit:function(props){return[!!props.isSelected&&_this.getBlockInspectorControls(props),React.createElement("div",{className:props.className+" wpgmza-gutenberg-block"},React.createElement(Dashicon,{icon:"location-alt"}),React.createElement("span",{class:"wpgmza-gutenberg-block-title"},__("Your map will appear here on your websites front end")))]},save:function(props){return null}}},WPGMZA.Integration.Gutenberg.getConstructor=function(){return WPGMZA.Integration.Gutenberg},WPGMZA.Integration.Gutenberg.createInstance=function(){return new(WPGMZA.Integration.Gutenberg.getConstructor())},WPGMZA.isProVersion()||/^6/.test(WPGMZA.pro_version)||(WPGMZA.integrationModules.gutenberg=WPGMZA.Integration.Gutenberg.createInstance())}}),jQuery(function($){WPGMZA.GoogleUICompatibility=function(){if(!(navigator.vendor&&navigator.vendor.indexOf("Apple")>-1&&navigator.userAgent&&-1==navigator.userAgent.indexOf("CriOS")&&-1==navigator.userAgent.indexOf("FxiOS"))){var style=$("<style id='wpgmza-google-ui-compatiblity-fix'/>");style.html(".wpgmza_map img:not(button img) { padding:0 !important; }"),$(document.head).append(style)}},WPGMZA.googleUICompatibility=new WPGMZA.GoogleUICompatibility}),jQuery(function($){WPGMZA.GoogleCircle=function(options,googleCircle){var self=this;if(WPGMZA.Circle.call(this,options,googleCircle),googleCircle?this.googleCircle=googleCircle:(this.googleCircle=new google.maps.Circle,this.googleCircle.wpgmzaCircle=this),google.maps.event.addListener(this.googleCircle,"click",function(){self.dispatchEvent({type:"click"})}),options){var googleOptions={};delete(googleOptions=$.extend({},options)).map,delete googleOptions.center,options.center&&(googleOptions.center=new google.maps.LatLng({lat:options.center.lat,lng:options.center.lng})),this.googleCircle.setOptions(googleOptions),options.map&&options.map.addCircle(this)}},WPGMZA.GoogleCircle.prototype=Object.create(WPGMZA.Circle.prototype),WPGMZA.GoogleCircle.prototype.constructor=WPGMZA.GoogleCircle,WPGMZA.GoogleCircle.prototype.setCenter=function(center){WPGMZA.Circle.prototype.setCenter.apply(this,arguments),this.googleCircle.setCenter(center)},WPGMZA.GoogleCircle.prototype.setRadius=function(radius){WPGMZA.Circle.prototype.setRadius.apply(this,arguments),this.googleCircle.setRadius(1e3*parseFloat(radius))},WPGMZA.GoogleCircle.prototype.setVisible=function(visible){this.googleCircle.setVisible(!!visible)}}),jQuery(function($){WPGMZA.GoogleGeocoder=function(){},WPGMZA.GoogleGeocoder.prototype=Object.create(WPGMZA.Geocoder.prototype),WPGMZA.GoogleGeocoder.prototype.constructor=WPGMZA.GoogleGeocoder,WPGMZA.GoogleGeocoder.prototype.getLatLngFromAddress=function(options,callback){if(!options||!options.address)throw new Error("No address specified");if(WPGMZA.isLatLngString(options.address))return WPGMZA.Geocoder.prototype.getLatLngFromAddress.call(this,options,callback);options.country&&(options.componentRestrictions={country:options.country}),(new google.maps.Geocoder).geocode(options,function(results,status){if(status==google.maps.GeocoderStatus.OK){var location=results[0].geometry.location,latLng={lat:location.lat(),lng:location.lng()};callback(results=[{geometry:{location:latLng},latLng:latLng,lat:latLng.lat,lng:latLng.lng}],WPGMZA.Geocoder.SUCCESS)}else{var nativeStatus=WPGMZA.Geocoder.FAIL;status==google.maps.GeocoderStatus.ZERO_RESULTS&&(nativeStatus=WPGMZA.Geocoder.ZERO_RESULTS),callback(null,nativeStatus)}})},WPGMZA.GoogleGeocoder.prototype.getAddressFromLatLng=function(options,callback){if(!options||!options.latLng)throw new Error("No latLng specified");var latLng=new WPGMZA.LatLng(options.latLng),geocoder=new google.maps.Geocoder;delete(options=$.extend(options,{location:{lat:latLng.lat,lng:latLng.lng}})).latLng,geocoder.geocode(options,function(results,status){"OK"!==status&&callback(null,WPGMZA.Geocoder.FAIL),results&&results.length||callback([],WPGMZA.Geocoder.NO_RESULTS),callback([results[0].formatted_address],WPGMZA.Geocoder.SUCCESS)})}}),jQuery(function($){WPGMZA.settings.engine&&"google-maps"!=WPGMZA.settings.engine||window.google&&window.google.maps&&(WPGMZA.GoogleHTMLOverlay=function(map){this.element=$("<div class='wpgmza-google-html-overlay'></div>"),this.visible=!0,this.position=new WPGMZA.LatLng,this.setMap(map.googleMap),this.wpgmzaMap=map},WPGMZA.GoogleHTMLOverlay.prototype=new google.maps.OverlayView,WPGMZA.GoogleHTMLOverlay.prototype.onAdd=function(){this.getPanes().overlayMouseTarget.appendChild(this.element[0])},WPGMZA.GoogleHTMLOverlay.prototype.onRemove=function(){this.element&&$(this.element).parent().length&&($(this.element).remove(),this.element=null)},WPGMZA.GoogleHTMLOverlay.prototype.draw=function(){this.updateElementPosition()},WPGMZA.GoogleHTMLOverlay.prototype.updateElementPosition=function(){var projection=this.getProjection();if(projection){var pixels=projection.fromLatLngToDivPixel(this.position.toGoogleLatLng());$(this.element).css({left:pixels.x,top:pixels.y})}})}),jQuery(function($){var Parent;WPGMZA.GoogleInfoWindow=function(mapObject){Parent.call(this,mapObject),this.setMapObject(mapObject)},Parent=WPGMZA.isProVersion()?WPGMZA.ProInfoWindow:WPGMZA.InfoWindow,WPGMZA.GoogleInfoWindow.prototype=Object.create(Parent.prototype),WPGMZA.GoogleInfoWindow.prototype.constructor=WPGMZA.GoogleInfoWindow,WPGMZA.GoogleInfoWindow.prototype.setMapObject=function(mapObject){mapObject instanceof WPGMZA.Marker?this.googleObject=mapObject.googleMarker:mapObject instanceof WPGMZA.Polygon?this.googleObject=mapObject.googlePolygon:mapObject instanceof WPGMZA.Polyline&&(this.googleObject=mapObject.googlePolyline)},WPGMZA.GoogleInfoWindow.prototype.createGoogleInfoWindow=function(){var self=this;this.googleInfoWindow||(this.googleInfoWindow=new google.maps.InfoWindow,google.maps.event.addListener(this.googleInfoWindow,"domready",function(event){self.trigger("domready")}),google.maps.event.addListener(this.googleInfoWindow,"closeclick",function(event){self.mapObject.map.trigger("infowindowclose")}))},WPGMZA.GoogleInfoWindow.prototype.open=function(map,mapObject){var self=this;if(!Parent.prototype.open.call(this,map,mapObject))return!1;this.parent=map,this.createGoogleInfoWindow(),this.setMapObject(mapObject),this.googleInfoWindow.open(this.mapObject.map.googleMap,this.googleObject);var guid=WPGMZA.guid(),html="<div id='"+guid+"'>"+this.content+"</div>";this.googleInfoWindow.setContent(html);var intervalID;return intervalID=setInterval(function(event){div=$("#"+guid),div.length&&(clearInterval(intervalID),div[0].wpgmzaMapObject=self.mapObject,div.addClass("wpgmza-infowindow"),self.element=div[0],self.trigger("infowindowopen"))},50),!0},WPGMZA.GoogleInfoWindow.prototype.close=function(){this.googleInfoWindow&&(WPGMZA.InfoWindow.prototype.close.call(this),this.googleInfoWindow.close())},WPGMZA.GoogleInfoWindow.prototype.setContent=function(html){Parent.prototype.setContent.call(this,html),this.content=html,this.createGoogleInfoWindow(),this.googleInfoWindow.setContent(html)},WPGMZA.GoogleInfoWindow.prototype.setOptions=function(options){Parent.prototype.setOptions.call(this,options),this.createGoogleInfoWindow(),this.googleInfoWindow.setOptions(options)}}),jQuery(function($){var Parent;WPGMZA.GoogleMap=function(element,options){var self=this;if(Parent.call(this,element,options),!window.google){var status=WPGMZA.googleAPIStatus,message="Google API not loaded";if(status&&status.message&&(message+=" - "+status.message),"USER_CONSENT_NOT_GIVEN"==status.code)return;throw $(element).html("<div class='notice notice-error'><p>"+WPGMZA.localized_strings.google_api_not_loaded+"<pre>"+message+"</pre></p></div>"),new Error(message)}this.loadGoogleMap(),options&&this.setOptions(options,!0),google.maps.event.addListener(this.googleMap,"click",function(event){var wpgmzaEvent=new WPGMZA.Event("click");wpgmzaEvent.latLng={lat:event.latLng.lat(),lng:event.latLng.lng()},self.dispatchEvent(wpgmzaEvent)}),google.maps.event.addListener(this.googleMap,"rightclick",function(event){var wpgmzaEvent=new WPGMZA.Event("rightclick");wpgmzaEvent.latLng={lat:event.latLng.lat(),lng:event.latLng.lng()},self.dispatchEvent(wpgmzaEvent)}),google.maps.event.addListener(this.googleMap,"dragend",function(event){self.dispatchEvent("dragend")}),google.maps.event.addListener(this.googleMap,"zoom_changed",function(event){self.dispatchEvent("zoom_changed"),self.dispatchEvent("zoomchanged")}),google.maps.event.addListener(this.googleMap,"idle",function(event){self.onIdle(event)}),WPGMZA.isProVersion()||(this.trigger("init"),this.dispatchEvent("created"),WPGMZA.events.dispatchEvent({type:"mapcreated",map:this}))},WPGMZA.isProVersion()?(Parent=WPGMZA.ProMap,WPGMZA.GoogleMap.prototype=Object.create(WPGMZA.ProMap.prototype)):(Parent=WPGMZA.Map,WPGMZA.GoogleMap.prototype=Object.create(WPGMZA.Map.prototype)),WPGMZA.GoogleMap.prototype.constructor=WPGMZA.GoogleMap,WPGMZA.GoogleMap.prototype.loadGoogleMap=function(){var self=this,options=this.settings.toGoogleMapsOptions();this.googleMap=new google.maps.Map(this.engineElement,options),google.maps.event.addListener(this.googleMap,"bounds_changed",function(){self.onBoundsChanged()}),1==this.settings.bicycle&&this.enableBicycleLayer(!0),1==this.settings.traffic&&this.enableTrafficLayer(!0),1==this.settings.transport&&this.enablePublicTransportLayer(!0),this.showPointsOfInterest(this.settings.show_point_of_interest),$(this.engineElement).append($(this.element).find(".wpgmza-loader"))},WPGMZA.GoogleMap.prototype.setOptions=function(options,initializing){if(Parent.prototype.setOptions.call(this,options),initializing){var converted=$.extend(options,this.settings.toGoogleMapsOptions()),clone=$.extend({},converted);if(!clone.center instanceof google.maps.LatLng&&(clone.center instanceof WPGMZA.LatLng||"object"==typeof clone.center)&&(clone.center={lat:parseFloat(clone.center.lat),lng:parseFloat(clone.center.lng)}),"1"==this.settings.hide_point_of_interest){clone.styles||(clone.styles=[]),clone.styles.push({featureType:"poi",elementType:"labels",stylers:[{visibility:"off"}]})}this.googleMap.setOptions(clone)}else this.googleMap.setOptions(options)},WPGMZA.GoogleMap.prototype.addMarker=function(marker){marker.googleMarker.setMap(this.googleMap),Parent.prototype.addMarker.call(this,marker)},WPGMZA.GoogleMap.prototype.removeMarker=function(marker){marker.googleMarker.setMap(null),Parent.prototype.removeMarker.call(this,marker)},WPGMZA.GoogleMap.prototype.addPolygon=function(polygon){polygon.googlePolygon.setMap(this.googleMap),Parent.prototype.addPolygon.call(this,polygon)},WPGMZA.GoogleMap.prototype.removePolygon=function(polygon){polygon.googlePolygon.setMap(null),Parent.prototype.removePolygon.call(this,polygon)},WPGMZA.GoogleMap.prototype.addPolyline=function(polyline){polyline.googlePolyline.setMap(this.googleMap),Parent.prototype.addPolyline.call(this,polyline)},WPGMZA.GoogleMap.prototype.removePolyline=function(polyline){polyline.googlePolyline.setMap(null),Parent.prototype.removePolyline.call(this,polyline)},WPGMZA.GoogleMap.prototype.addCircle=function(circle){circle.googleCircle.setMap(this.googleMap),Parent.prototype.addCircle.call(this,circle)},WPGMZA.GoogleMap.prototype.removeCircle=function(circle){circle.googleCircle.setMap(null),Parent.prototype.removeCircle.call(this,circle)},WPGMZA.GoogleMap.prototype.getCenter=function(){var latLng=this.googleMap.getCenter();return{lat:latLng.lat(),lng:latLng.lng()}},WPGMZA.GoogleMap.prototype.setCenter=function(latLng){WPGMZA.Map.prototype.setCenter.call(this,latLng),latLng instanceof WPGMZA.LatLng?this.googleMap.setCenter({lat:latLng.lat,lng:latLng.lng}):this.googleMap.setCenter(latLng)},WPGMZA.GoogleMap.prototype.panTo=function(latLng){latLng instanceof WPGMZA.LatLng?this.googleMap.panTo({lat:latLng.lat,lng:latLng.lng}):this.googleMap.panTo(latLng)},WPGMZA.GoogleMap.prototype.getZoom=function(){return this.googleMap.getZoom()},WPGMZA.GoogleMap.prototype.setZoom=function(value){if(isNaN(value))throw new Error("Value must not be NaN");return this.googleMap.setZoom(parseInt(value))},WPGMZA.GoogleMap.prototype.getBounds=function(){var bounds=this.googleMap.getBounds(),northEast=bounds.getNorthEast(),southWest=bounds.getSouthWest(),nativeBounds=new WPGMZA.LatLngBounds({});return nativeBounds.north=northEast.lat(),nativeBounds.south=southWest.lat(),nativeBounds.west=southWest.lng(),nativeBounds.east=northEast.lng(),nativeBounds.topLeft={lat:northEast.lat(),lng:southWest.lng()},nativeBounds.bottomRight={lat:southWest.lat(),lng:northEast.lng()},nativeBounds},WPGMZA.GoogleMap.prototype.fitBounds=function(southWest,northEast){if(southWest instanceof WPGMZA.LatLng&&(southWest={lat:southWest.lat,lng:southWest.lng}),northEast instanceof WPGMZA.LatLng)northEast={lat:northEast.lat,lng:northEast.lng};else if(southWest instanceof WPGMZA.LatLngBounds){var bounds=southWest;southWest={lat:bounds.south,lng:bounds.west},northEast={lat:bounds.north,lng:bounds.east}}var nativeBounds=new google.maps.LatLngBounds(southWest,northEast);this.googleMap.fitBounds(nativeBounds)},WPGMZA.GoogleMap.prototype.fitBoundsToVisibleMarkers=function(){for(var bounds=new google.maps.LatLngBounds,i=0;i<this.markers.length;i++)markers[i].getVisible()&&bounds.extend(markers[i].getPosition());this.googleMap.fitBounds(bounds)},WPGMZA.GoogleMap.prototype.enableBicycleLayer=function(enable){this.bicycleLayer||(this.bicycleLayer=new google.maps.BicyclingLayer),this.bicycleLayer.setMap(enable?this.googleMap:null)},WPGMZA.GoogleMap.prototype.enableTrafficLayer=function(enable){this.trafficLayer||(this.trafficLayer=new google.maps.TrafficLayer),this.trafficLayer.setMap(enable?this.googleMap:null)},WPGMZA.GoogleMap.prototype.enablePublicTransportLayer=function(enable){this.publicTransportLayer||(this.publicTransportLayer=new google.maps.TransitLayer),this.publicTransportLayer.setMap(enable?this.googleMap:null)},WPGMZA.GoogleMap.prototype.showPointsOfInterest=function(show){var text=$("textarea[name='theme_data']").val();if(text){var styles=JSON.parse(text);styles.push({featureType:"poi",stylers:[{visibility:show?"on":"off"}]}),this.googleMap.setOptions({styles:styles})}},WPGMZA.GoogleMap.prototype.getMinZoom=function(){return parseInt(this.settings.min_zoom)},WPGMZA.GoogleMap.prototype.setMinZoom=function(value){this.googleMap.setOptions({minZoom:value,maxZoom:this.getMaxZoom()})},WPGMZA.GoogleMap.prototype.getMaxZoom=function(){return parseInt(this.settings.max_zoom)},WPGMZA.GoogleMap.prototype.setMaxZoom=function(value){this.googleMap.setOptions({minZoom:this.getMinZoom(),maxZoom:value})},WPGMZA.GoogleMap.prototype.latLngToPixels=function(latLng){var map=this.googleMap,nativeLatLng=new google.maps.LatLng({lat:parseFloat(latLng.lat),lng:parseFloat(latLng.lng)}),topRight=map.getProjection().fromLatLngToPoint(map.getBounds().getNorthEast()),bottomLeft=map.getProjection().fromLatLngToPoint(map.getBounds().getSouthWest()),scale=Math.pow(2,map.getZoom()),worldPoint=map.getProjection().fromLatLngToPoint(nativeLatLng);return{x:(worldPoint.x-bottomLeft.x)*scale,y:(worldPoint.y-topRight.y)*scale}},WPGMZA.GoogleMap.prototype.pixelsToLatLng=function(x,y){void 0==y&&("x"in x&&"y"in x?(y=x.y,x=x.x):console.warn("Y coordinate undefined in pixelsToLatLng (did you mean to pass 2 arguments?)"));var map=this.googleMap,topRight=map.getProjection().fromLatLngToPoint(map.getBounds().getNorthEast()),bottomLeft=map.getProjection().fromLatLngToPoint(map.getBounds().getSouthWest()),scale=Math.pow(2,map.getZoom()),worldPoint=new google.maps.Point(x/scale+bottomLeft.x,y/scale+topRight.y),latLng=map.getProjection().fromPointToLatLng(worldPoint);return{lat:latLng.lat(),lng:latLng.lng()}},WPGMZA.GoogleMap.prototype.onElementResized=function(event){this.googleMap&&google.maps.event.trigger(this.googleMap,"resize")}}),jQuery(function($){var Parent;WPGMZA.GoogleMarker=function(row){var self=this;Parent.call(this,row);var settings={};if(row)for(var name in row)row[name]instanceof WPGMZA.LatLng?settings[name]=row[name].toGoogleLatLng():row[name]instanceof WPGMZA.Map||(settings[name]=row[name]);this.googleMarker=new google.maps.Marker(settings),this.googleMarker.wpgmzaMarker=this,this.googleMarker.setPosition(new google.maps.LatLng({lat:parseFloat(this.lat),lng:parseFloat(this.lng)})),this.googleMarker.setLabel(this.settings.label),this.anim&&this.googleMarker.setAnimation(this.anim),this.animation&&this.googleMarker.setAnimation(this.animation),google.maps.event.addListener(this.googleMarker,"click",function(){self.dispatchEvent("click"),self.dispatchEvent("select")}),google.maps.event.addListener(this.googleMarker,"mouseover",function(){self.dispatchEvent("mouseover")}),google.maps.event.addListener(this.googleMarker,"dragend",function(){var googleMarkerPosition=self.googleMarker.getPosition();self.setPosition({lat:googleMarkerPosition.lat(),lng:googleMarkerPosition.lng()}),self.dispatchEvent({type:"dragend",latLng:self.getPosition()})}),this.trigger("init")},Parent=WPGMZA.isProVersion()?WPGMZA.ProMarker:WPGMZA.Marker,WPGMZA.GoogleMarker.prototype=Object.create(Parent.prototype),WPGMZA.GoogleMarker.prototype.constructor=WPGMZA.GoogleMarker,WPGMZA.GoogleMarker.prototype.setLabel=function(label){label?(this.googleMarker.setLabel({text:label}),this.googleMarker.getIcon()||this.googleMarker.setIcon(WPGMZA.settings.default_marker_icon)):this.googleMarker.setLabel(null)},WPGMZA.GoogleMarker.prototype.setPosition=function(latLng){Parent.prototype.setPosition.call(this,latLng),this.googleMarker.setPosition({lat:this.lat,lng:this.lng})},WPGMZA.GoogleMarker.prototype.updateOffset=function(){var params,self=this,icon=this.googleMarker.getIcon(),img=new Image,x=this._offset.x,y=this._offset.y;icon||(icon=WPGMZA.settings.default_marker_icon),params="string"==typeof icon?{url:icon}:icon,img.onload=function(){var defaultAnchor={x:img.width/2,y:img.height};params.anchor=new google.maps.Point(defaultAnchor.x-x,defaultAnchor.y-y),self.googleMarker.setIcon(params)},img.src=params.url},WPGMZA.GoogleMarker.prototype.setOptions=function(options){this.googleMarker.setOptions(options)},WPGMZA.GoogleMarker.prototype.setAnimation=function(animation){Parent.prototype.setAnimation.call(this,animation),this.googleMarker.setAnimation(animation)},WPGMZA.GoogleMarker.prototype.setVisible=function(visible){Parent.prototype.setVisible.call(this,visible),this.googleMarker.setVisible(!!visible)},WPGMZA.GoogleMarker.prototype.getVisible=function(visible){return this.googleMarker.getVisible()},WPGMZA.GoogleMarker.prototype.setDraggable=function(draggable){this.googleMarker.setDraggable(draggable)},WPGMZA.GoogleMarker.prototype.setOpacity=function(opacity){this.googleMarker.setOpacity(opacity)}}),jQuery(function($){WPGMZA.GoogleModernStoreLocatorCircle=function(map,settings){var self=this;WPGMZA.ModernStoreLocatorCircle.call(this,map,settings),this.intervalID=setInterval(function(){var mapSize={width:$(self.mapElement).width(),height:$(self.mapElement).height()};mapSize.width==self.mapSize.width&&mapSize.height==self.mapSize.height||(self.canvasLayer.resize_(),self.canvasLayer.draw(),self.mapSize=mapSize)},1e3),$(document).bind("webkitfullscreenchange mozfullscreenchange fullscreenchange",function(){self.canvasLayer.resize_(),self.canvasLayer.draw()})},WPGMZA.GoogleModernStoreLocatorCircle.prototype=Object.create(WPGMZA.ModernStoreLocatorCircle.prototype),WPGMZA.GoogleModernStoreLocatorCircle.prototype.constructor=WPGMZA.GoogleModernStoreLocatorCircle,WPGMZA.GoogleModernStoreLocatorCircle.prototype.initCanvasLayer=function(){var self=this;this.canvasLayer&&(this.canvasLayer.setMap(null),this.canvasLayer.setAnimate(!1)),this.canvasLayer=new CanvasLayer({map:this.map.googleMap,resizeHandler:function(event){self.onResize(event)},updateHandler:function(event){self.onUpdate(event)},animate:!0,resolutionScale:this.getResolutionScale()})},WPGMZA.GoogleModernStoreLocatorCircle.prototype.setOptions=function(options){WPGMZA.ModernStoreLocatorCircle.prototype.setOptions.call(this,options),this.canvasLayer.scheduleUpdate()},WPGMZA.GoogleModernStoreLocatorCircle.prototype.setPosition=function(position){WPGMZA.ModernStoreLocatorCircle.prototype.setPosition.call(this,position),this.canvasLayer.scheduleUpdate()},WPGMZA.GoogleModernStoreLocatorCircle.prototype.setRadius=function(radius){WPGMZA.ModernStoreLocatorCircle.prototype.setRadius.call(this,radius),this.canvasLayer.scheduleUpdate()},WPGMZA.GoogleModernStoreLocatorCircle.prototype.getTransformedRadius=function(km){var spherical=google.maps.geometry.spherical,center=this.settings.center,equator=new WPGMZA.LatLng({lat:0,lng:0}),latitude=new WPGMZA.LatLng({lat:center.lat,lng:0}),offsetAtEquator=spherical.computeOffset(equator.toGoogleLatLng(),1e3*km,90),result=.006395*km*(spherical.computeOffset(latitude.toGoogleLatLng(),1e3*km,90).lng()/offsetAtEquator.lng());if(isNaN(result))throw new Error("here");return result},WPGMZA.GoogleModernStoreLocatorCircle.prototype.getCanvasDimensions=function(){return{width:this.canvasLayer.canvas.width,height:this.canvasLayer.canvas.height}},WPGMZA.GoogleModernStoreLocatorCircle.prototype.getWorldOriginOffset=function(){var position=this.map.googleMap.getProjection().fromLatLngToPoint(this.canvasLayer.getTopLeft());return{x:-position.x,y:-position.y}},WPGMZA.GoogleModernStoreLocatorCircle.prototype.getCenterPixels=function(){var center=new WPGMZA.LatLng(this.settings.center);return this.map.googleMap.getProjection().fromLatLngToPoint(center.toGoogleLatLng())},WPGMZA.GoogleModernStoreLocatorCircle.prototype.getContext=function(type){return this.canvasLayer.canvas.getContext("2d")},WPGMZA.GoogleModernStoreLocatorCircle.prototype.getScale=function(){return Math.pow(2,this.map.getZoom())*this.getResolutionScale()},WPGMZA.GoogleModernStoreLocatorCircle.prototype.setVisible=function(visible){WPGMZA.ModernStoreLocatorCircle.prototype.setVisible.call(this,visible),this.canvasLayer.scheduleUpdate()},WPGMZA.GoogleModernStoreLocatorCircle.prototype.destroy=function(){this.canvasLayer.setMap(null),this.canvasLayer=null,clearInterval(this.intervalID)}}),jQuery(function($){WPGMZA.GoogleModernStoreLocator=function(map_id){this.map=WPGMZA.getMapByID(map_id),WPGMZA.ModernStoreLocator.call(this,map_id);var options={fields:["name","formatted_address"],types:["geocode"]},restrict=wpgmaps_localize[map_id].other_settings.wpgmza_store_locator_restrict;this.addressInput=$(this.element).find(".addressInput, #addressInput")[0],this.addressInput&&(restrict&&restrict.length&&(options.componentRestrictions={country:restrict}),this.autoComplete=new google.maps.places.Autocomplete(this.addressInput,options)),this.map.googleMap.controls[google.maps.ControlPosition.TOP_CENTER].push(this.element)},WPGMZA.GoogleModernStoreLocator.prototype=Object.create(WPGMZA.ModernStoreLocator.prototype),WPGMZA.GoogleModernStoreLocator.prototype.constructor=WPGMZA.GoogleModernStoreLocator}),jQuery(function($){var Parent;WPGMZA.GooglePolygon=function(row,googlePolygon){var self=this;if(Parent.call(this,row,googlePolygon),googlePolygon)this.googlePolygon=googlePolygon;else if(this.googlePolygon=new google.maps.Polygon(this.settings),row&&row.points){var paths=this.parseGeometry(row.points);this.googlePolygon.setOptions({paths:paths})}this.googlePolygon.wpgmzaPolygon=this,google.maps.event.addListener(this.googlePolygon,"click",function(){self.dispatchEvent({type:"click"})})},Parent=WPGMZA.isProVersion()?WPGMZA.ProPolygon:WPGMZA.Polygon,WPGMZA.GooglePolygon.prototype=Object.create(Parent.prototype),WPGMZA.GooglePolygon.prototype.constructor=WPGMZA.GooglePolygon,WPGMZA.GooglePolygon.prototype.getEditable=function(){return this.googlePolygon.getOptions().editable},WPGMZA.GooglePolygon.prototype.setEditable=function(value){this.googlePolygon.setOptions({editable:value})},WPGMZA.GooglePolygon.prototype.toJSON=function(){var result=WPGMZA.Polygon.prototype.toJSON.call(this);result.points=[];for(var path=this.googlePolygon.getPath(),i=0;i<path.getLength();i++){var latLng=path.getAt(i);result.points.push({lat:latLng.lat(),lng:latLng.lng()})}return result}}),jQuery(function($){WPGMZA.GooglePolyline=function(row,googlePolyline){var self=this;if(WPGMZA.Polyline.call(this,row,googlePolyline),googlePolyline)this.googlePolyline=googlePolyline;else if(this.googlePolyline=new google.maps.Polyline(this.settings),this.googlePolyline.wpgmzaPolyline=this,row&&row.points){var path=this.parseGeometry(row.points);this.setPoints(path)}google.maps.event.addListener(this.googlePolyline,"click",function(){self.dispatchEvent({type:"click"})})},WPGMZA.GooglePolyline.prototype=Object.create(WPGMZA.Polyline.prototype),WPGMZA.GooglePolyline.prototype.constructor=WPGMZA.GooglePolyline,WPGMZA.GooglePolyline.prototype.setEditable=function(value){this.googlePolyline.setOptions({editable:value})},WPGMZA.GooglePolyline.prototype.setPoints=function(points){this.googlePolyline.setOptions({path:points})},WPGMZA.GooglePolyline.prototype.toJSON=function(){var result=WPGMZA.Polyline.prototype.toJSON.call(this);result.points=[];for(var path=this.googlePolyline.getPath(),i=0;i<path.getLength();i++){var latLng=path.getAt(i);result.points.push({lat:latLng.lat(),lng:latLng.lng()})}return result}}),jQuery(function($){WPGMZA.GoogleText=function(options){WPGMZA.Text.apply(this,arguments),this.overlay=new WPGMZA.GoogleTextOverlay(options)},WPGMZA.extend(WPGMZA.GoogleText,WPGMZA.Text)}),jQuery(function($){WPGMZA.GoogleTextOverlay=function(options){this.element=$("<div class='wpgmza-google-text-overlay'><div class='wpgmza-inner'></div></div>"),console.log(options),options||(options={}),options.position&&(this.position=options.position),options.text&&this.element.find(".wpgmza-inner").text(options.text),options.map&&this.setMap(options.map.googleMap)},window.google&&google.maps&&google.maps.OverlayView&&(WPGMZA.GoogleTextOverlay.prototype=new google.maps.OverlayView),WPGMZA.GoogleTextOverlay.prototype.onAdd=function(){var position=this.getProjection().fromLatLngToDivPixel(this.position.toGoogleLatLng());this.element.css({position:"absolute",left:position.x+"px",top:position.y+"px"}),this.getPanes().floatPane.appendChild(this.element[0])},WPGMZA.GoogleTextOverlay.prototype.draw=function(){var position=this.getProjection().fromLatLngToDivPixel(this.position.toGoogleLatLng());this.element.css({position:"absolute",left:position.x+"px",top:position.y+"px"})},WPGMZA.GoogleTextOverlay.prototype.onRemove=function(){this.element.remove()},WPGMZA.GoogleTextOverlay.prototype.hide=function(){this.element.hide()},WPGMZA.GoogleTextOverlay.prototype.show=function(){this.element.show()},WPGMZA.GoogleTextOverlay.prototype.toggle=function(){this.element.is(":visible")?this.element.hide():this.element.show()}}),jQuery(function($){"google-maps"==WPGMZA.settings.engine&&(WPGMZA.googleAPIStatus&&"USER_CONSENT_NOT_GIVEN"==WPGMZA.googleAPIStatus.code||(WPGMZA.GoogleVertexContextMenu=function(mapEditPage){var self=this;this.mapEditPage=mapEditPage,this.element=document.createElement("div"),this.element.className="wpgmza-vertex-context-menu",this.element.innerHTML="Delete",google.maps.event.addDomListener(this.element,"click",function(event){return self.removeVertex(),event.preventDefault(),event.stopPropagation(),!1})},WPGMZA.GoogleVertexContextMenu.prototype=new google.maps.OverlayView,WPGMZA.GoogleVertexContextMenu.prototype.onAdd=function(){var self=this,map=this.getMap();this.getPanes().floatPane.appendChild(this.element),this.divListener=google.maps.event.addDomListener(map.getDiv(),"mousedown",function(e){e.target!=self.element&&self.close()},!0)},WPGMZA.GoogleVertexContextMenu.prototype.onRemove=function(){google.maps.event.removeListener(this.divListener),this.element.parentNode.removeChild(this.element),this.set("position"),this.set("path"),this.set("vertex")},WPGMZA.GoogleVertexContextMenu.prototype.open=function(map,path,vertex){this.set("position",path.getAt(vertex)),this.set("path",path),this.set("vertex",vertex),this.setMap(map),this.draw()},WPGMZA.GoogleVertexContextMenu.prototype.close=function(){this.setMap(null)},WPGMZA.GoogleVertexContextMenu.prototype.draw=function(){var position=this.get("position"),projection=this.getProjection();if(position&&projection){var point=projection.fromLatLngToDivPixel(position);this.element.style.top=point.y+"px",this.element.style.left=point.x+"px"}},WPGMZA.GoogleVertexContextMenu.prototype.removeVertex=function(){var path=this.get("path"),vertex=this.get("vertex");path&&void 0!=vertex?(path.removeAt(vertex),this.close()):this.close()}))}),jQuery(function($){var Parent=WPGMZA.Circle;WPGMZA.OLCircle=function(options,olFeature){this.center={lat:0,lng:0},this.radius=0,Parent.call(this,options,olFeature),this.settings.fillColor||(this.settings.fillColor="#ff0000",this.settings.fillOpacity=.6),options.fillColor&&(this.settings.fillColor=options.fillColor),options.fillOpacity&&(this.settings.fillOpacity=options.fillOpacity),this.olStyle=new ol.style.Style(this.getStyleFromSettings()),this.vectorLayer3857=this.layer=new ol.layer.Vector({source:new ol.source.Vector,style:this.olStyle}),olFeature?this.olFeature=olFeature:this.recreate()},WPGMZA.OLCircle.prototype=Object.create(Parent.prototype),WPGMZA.OLCircle.prototype.constructor=WPGMZA.OLCircle,WPGMZA.OLCircle.prototype.recreate=function(){if(this.olFeature&&(this.layer.getSource().removeFeature(this.olFeature),delete this.olFeature),this.center&&this.radius){var x,y,wgs84Sphere=new ol.Sphere(6378137),radius=1e3*parseFloat(this.radius);x=this.center.lng,y=this.center.lat;var circle3857=ol.geom.Polygon.circular(wgs84Sphere,[x,y],radius,64).clone().transform("EPSG:4326","EPSG:3857");this.olFeature=new ol.Feature(circle3857),this.layer.getSource().addFeature(this.olFeature)}},WPGMZA.OLCircle.prototype.getStyleFromSettings=function(){var params={};return this.settings.strokeOpacity&&(params.stroke=new ol.style.Stroke({color:WPGMZA.hexOpacityToRGBA(this.settings.strokeColor,this.settings.strokeOpacity)})),this.settings.fillOpacity&&(params.fill=new ol.style.Fill({color:WPGMZA.hexOpacityToRGBA(this.settings.fillColor,this.settings.fillOpacity)})),params},WPGMZA.OLCircle.prototype.updateStyleFromSettings=function(){var params=this.getStyleFromSettings();this.olStyle=new ol.style.Style(params),this.layer.setStyle(this.olStyle)},WPGMZA.OLCircle.prototype.setVisible=function(visible){this.layer.setVisible(!!visible)},WPGMZA.OLCircle.prototype.setCenter=function(center){WPGMZA.Circle.prototype.setCenter.apply(this,arguments),this.recreate()},WPGMZA.OLCircle.prototype.setRadius=function(radius){WPGMZA.Circle.prototype.setRadius.apply(this,arguments),this.recreate()}}),jQuery(function($){WPGMZA.OLGeocoder=function(){},WPGMZA.OLGeocoder.prototype=Object.create(WPGMZA.Geocoder.prototype),WPGMZA.OLGeocoder.prototype.constructor=WPGMZA.OLGeocoder,WPGMZA.OLGeocoder.prototype.getResponseFromCache=function(query,callback){WPGMZA.restAPI.call("/geocode-cache",{data:{query:JSON.stringify(query)},success:function(response,xhr,status){response.lng=response.lon,callback(response)},useCompressedPathVariable:!0})},WPGMZA.OLGeocoder.prototype.getResponseFromNominatim=function(options,callback){var data={q:options.address,format:"json"};options.componentRestrictions&&options.componentRestrictions.country&&(data.countrycodes=options.componentRestrictions.country),$.ajax("https://nominatim.openstreetmap.org/search/",{data:data,success:function(response,xhr,status){callback(response)},error:function(response,xhr,status){callback(null,WPGMZA.Geocoder.FAIL)}})},WPGMZA.OLGeocoder.prototype.cacheResponse=function(query,response){$.ajax(WPGMZA.ajaxurl,{data:{action:"wpgmza_store_nominatim_cache",query:JSON.stringify(query),response:JSON.stringify(response)},method:"POST"})},WPGMZA.OLGeocoder.prototype.clearCache=function(callback){$.ajax(WPGMZA.ajaxurl,{data:{action:"wpgmza_clear_nominatim_cache"},method:"POST",success:function(response){callback(response)}})},WPGMZA.OLGeocoder.prototype.getLatLngFromAddress=function(options,callback){return WPGMZA.OLGeocoder.prototype.geocode(options,callback)},WPGMZA.OLGeocoder.prototype.getAddressFromLatLng=function(options,callback){return WPGMZA.OLGeocoder.prototype.geocode(options,callback)},WPGMZA.OLGeocoder.prototype.geocode=function(options,callback){var self=this;if(!options)throw new Error("Invalid options");options.location&&(options.latLng=new WPGMZA.LatLng(options.location));var finish,location;if(options.address)location=options.address,finish=function(response,status){for(var i=0;i<response.length;i++)response[i].geometry={location:new WPGMZA.LatLng({lat:parseFloat(response[i].lat),lng:parseFloat(response[i].lon)})},response[i].latLng={lat:parseFloat(response[i].lat),lng:parseFloat(response[i].lon)},response[i].lng=response[i].lon;callback(response,status)};else{if(!options.latLng)throw new Error("You must supply either a latLng or address");location=options.latLng.toString(),finish=function(response,status){var address=response[0].display_name;callback([address],status)}}var query={location:location,options:options};this.getResponseFromCache(query,function(response){response.length?finish(response,WPGMZA.Geocoder.SUCCESS):self.getResponseFromNominatim($.extend(options,{address:location}),function(response,status){status!=WPGMZA.Geocoder.FAIL?0!=response.length?(finish(response,WPGMZA.Geocoder.SUCCESS),self.cacheResponse(query,response)):callback([],WPGMZA.Geocoder.ZERO_RESULTS):callback(null,WPGMZA.Geocoder.FAIL)})})}}),jQuery(function($){var Parent;WPGMZA.OLInfoWindow=function(mapObject){var self=this;Parent.call(this,mapObject),this.element=$("<div class='wpgmza-infowindow ol-info-window-container ol-info-window-plain'></div>")[0],$(this.element).on("click",".ol-info-window-close",function(event){self.close()})},Parent=WPGMZA.isProVersion()?WPGMZA.ProInfoWindow:WPGMZA.InfoWindow,WPGMZA.OLInfoWindow.prototype=Object.create(Parent.prototype),WPGMZA.OLInfoWindow.prototype.constructor=WPGMZA.OLInfoWindow,WPGMZA.OLInfoWindow.prototype.open=function(map,mapObject){var self=this,latLng=mapObject.getPosition();if(!Parent.prototype.open.call(this,map,mapObject))return!1;this.parent=map,this.overlay&&this.mapObject.map.olMap.removeOverlay(this.overlay),this.overlay=new ol.Overlay({element:this.element,stopEvent:!1}),this.overlay.setPosition(ol.proj.fromLonLat([latLng.lng,latLng.lat])),self.mapObject.map.olMap.addOverlay(this.overlay),$(this.element).show(),this.trigger("infowindowopen"),this.trigger("domready")},WPGMZA.OLInfoWindow.prototype.close=function(event){$(this.element).hide(),this.overlay&&(WPGMZA.InfoWindow.prototype.close.call(this),this.trigger("infowindowclose"),this.mapObject.map.olMap.removeOverlay(this.overlay),this.overlay=null)},WPGMZA.OLInfoWindow.prototype.setContent=function(html){$(this.element).html("<i class='fa fa-times ol-info-window-close' aria-hidden='true'></i>"+html)},WPGMZA.OLInfoWindow.prototype.setOptions=function(options){options.maxWidth&&$(this.element).css({"max-width":options.maxWidth+"px"})}}),jQuery(function($){var Parent;WPGMZA.OLMap=function(element,options){var self=this;Parent.call(this,element),this.setOptions(options);var viewOptions=this.settings.toOLViewOptions();$(this.element).html(""),this.olMap=new ol.Map({target:$(element)[0],layers:[this.getTileLayer()],view:new ol.View(viewOptions)}),this.olMap.getInteractions().forEach(function(interaction){interaction instanceof ol.interaction.DragPan?interaction.setActive("yes"!=self.settings.wpgmza_settings_map_draggable):interaction instanceof ol.interaction.DoubleClickZoom?interaction.setActive(!self.settings.wpgmza_settings_map_clickzoom):interaction instanceof ol.interaction.MouseWheelZoom&&interaction.setActive("yes"!=self.settings.wpgmza_settings_map_scroll)},this),this.olMap.getControls().forEach(function(control){control instanceof ol.control.Zoom&&"yes"==WPGMZA.settings.wpgmza_settings_map_zoom&&self.olMap.removeControl(control)},this),"yes"!=WPGMZA.settings.wpgmza_settings_map_full_screen_control&&this.olMap.addControl(new ol.control.FullScreen),this.markerLayer=new ol.layer.Vector({source:new ol.source.Vector({features:[]})}),this.olMap.addLayer(this.markerLayer),this.olMap.on("movestart",function(event){self.isBeingDragged=!0}),this.olMap.on("moveend",function(event){self.wrapLongitude(),self.isBeingDragged=!1,self.dispatchEvent("dragend"),self.onIdle()}),this.olMap.getView().on("change:resolution",function(event){self.dispatchEvent("zoom_changed"),self.dispatchEvent("zoomchanged"),setTimeout(function(){self.onIdle()},10)}),this.olMap.getView().on("change",function(){self.onBoundsChanged()}),self.onBoundsChanged();var marker;this.storeLocator&&(marker=this.storeLocator.centerPointMarker)&&(this.olMap.addOverlay(marker.overlay),marker.setVisible(!1)),$(this.element).on("click contextmenu",function(event){var isRight;event=event||window.event;var latLng=self.pixelsToLatLng(event.offsetX,event.offsetY);if("which"in event?isRight=3==event.which:"button"in event&&(isRight=2==event.button),1!=event.which&&1!=event.button){if(isRight)return self.onRightClick(event)}else{if(self.isBeingDragged)return;if($(event.target).closest(".ol-marker").length)return;self.trigger({type:"click",latLng:latLng})}}),WPGMZA.isProVersion()||(this.trigger("init"),this.dispatchEvent("created"),WPGMZA.events.dispatchEvent({type:"mapcreated",map:this}))},Parent=WPGMZA.isProVersion()?WPGMZA.ProMap:WPGMZA.Map,WPGMZA.OLMap.prototype=Object.create(Parent.prototype),WPGMZA.OLMap.prototype.constructor=WPGMZA.OLMap,WPGMZA.OLMap.prototype.getTileLayer=function(){var options={};return WPGMZA.settings.tile_server_url&&(options.url=WPGMZA.settings.tile_server_url),new ol.layer.Tile({source:new ol.source.OSM(options)})},WPGMZA.OLMap.prototype.wrapLongitude=function(){var center=this.getCenter();center.lng>=-180&&center.lng<=180||(center.lng=center.lng-360*Math.floor(center.lng/360),center.lng>180&&(center.lng-=360),this.setCenter(center))},WPGMZA.OLMap.prototype.getCenter=function(){var lonLat=ol.proj.toLonLat(this.olMap.getView().getCenter());return{lat:lonLat[1],lng:lonLat[0]}},WPGMZA.OLMap.prototype.setCenter=function(latLng){var view=this.olMap.getView();WPGMZA.Map.prototype.setCenter.call(this,latLng),view.setCenter(ol.proj.fromLonLat([latLng.lng,latLng.lat])),this.wrapLongitude(),this.onBoundsChanged()},WPGMZA.OLMap.prototype.getBounds=function(){var bounds=this.olMap.getView().calculateExtent(this.olMap.getSize()),nativeBounds=new WPGMZA.LatLngBounds,topLeft=ol.proj.toLonLat([bounds[0],bounds[1]]),bottomRight=ol.proj.toLonLat([bounds[2],bounds[3]]);return nativeBounds.north=topLeft[1],nativeBounds.south=bottomRight[1],nativeBounds.west=topLeft[0],nativeBounds.east=bottomRight[0],nativeBounds},WPGMZA.OLMap.prototype.fitBounds=function(southWest,northEast){if(southWest instanceof WPGMZA.LatLng&&(southWest={lat:southWest.lat,lng:southWest.lng}),northEast instanceof WPGMZA.LatLng)northEast={lat:northEast.lat,lng:northEast.lng};else if(southWest instanceof WPGMZA.LatLngBounds){var bounds=southWest;southWest={lat:bounds.south,lng:bounds.west},northEast={lat:bounds.north,lng:bounds.east}}var view=this.olMap.getView(),extent=ol.extent.boundingExtent([ol.proj.fromLonLat([parseFloat(southWest.lng),parseFloat(southWest.lat)]),ol.proj.fromLonLat([parseFloat(northEast.lng),parseFloat(northEast.lat)])]);view.fit(extent,this.olMap.getSize())},WPGMZA.OLMap.prototype.panTo=function(latLng,zoom){var view=this.olMap.getView(),options={center:ol.proj.fromLonLat([parseFloat(latLng.lng),parseFloat(latLng.lat)]),duration:500};arguments.length>1&&(options.zoom=parseInt(zoom)),view.animate(options)},WPGMZA.OLMap.prototype.getZoom=function(){return Math.round(this.olMap.getView().getZoom())},WPGMZA.OLMap.prototype.setZoom=function(value){this.olMap.getView().setZoom(value)},WPGMZA.OLMap.prototype.getMinZoom=function(){return this.olMap.getView().getMinZoom()},WPGMZA.OLMap.prototype.setMinZoom=function(value){this.olMap.getView().setMinZoom(value)},WPGMZA.OLMap.prototype.getMaxZoom=function(){return this.olMap.getView().getMaxZoom()},WPGMZA.OLMap.prototype.setMaxZoom=function(value){this.olMap.getView().setMaxZoom(value)},WPGMZA.OLMap.prototype.setOptions=function(options){Parent.prototype.setOptions.call(this,options),this.olMap&&this.olMap.getView().setProperties(this.settings.toOLViewOptions())},WPGMZA.OLMap.prototype.addMarker=function(marker){this.olMap.addOverlay(marker.overlay),Parent.prototype.addMarker.call(this,marker)},WPGMZA.OLMap.prototype.removeMarker=function(marker){this.olMap.removeOverlay(marker.overlay),Parent.prototype.removeMarker.call(this,marker)},WPGMZA.OLMap.prototype.addPolygon=function(polygon){this.olMap.addLayer(polygon.layer),Parent.prototype.addPolygon.call(this,polygon)},WPGMZA.OLMap.prototype.removePolygon=function(polygon){this.olMap.removeLayer(polygon.layer),Parent.prototype.removePolygon.call(this,polygon)},WPGMZA.OLMap.prototype.addPolyline=function(polyline){this.olMap.addLayer(polyline.layer),Parent.prototype.addPolyline.call(this,polyline)},WPGMZA.OLMap.prototype.removePolyline=function(polyline){this.olMap.removeLayer(polyline.layer),Parent.prototype.removePolyline.call(this,polyline)},WPGMZA.OLMap.prototype.addCircle=function(circle){this.olMap.addLayer(circle.layer),Parent.prototype.addCircle.call(this,circle)},WPGMZA.OLMap.prototype.removeCircle=function(circle){this.olMap.removeLayer(circle.layer),Parent.prototype.removeCircle.call(this,circle)},WPGMZA.OLMap.prototype.pixelsToLatLng=function(x,y){void 0==y&&("x"in x&&"y"in x?(y=x.y,x=x.x):console.warn("Y coordinate undefined in pixelsToLatLng (did you mean to pass 2 arguments?)"));var coord=this.olMap.getCoordinateFromPixel([x,y]);if(!coord)return{x:null,y:null};var lonLat=ol.proj.toLonLat(coord);return{lat:lonLat[1],lng:lonLat[0]}},WPGMZA.OLMap.prototype.latLngToPixels=function(latLng){var coord=ol.proj.fromLonLat([latLng.lng,latLng.lat]),pixel=this.olMap.getPixelFromCoordinate(coord);return pixel?{x:pixel[0],y:pixel[1]}:{x:null,y:null}},WPGMZA.OLMap.prototype.enableBicycleLayer=function(value){if(value)this.bicycleLayer||(this.bicycleLayer=new ol.layer.Tile({source:new ol.source.OSM({url:"http://{a-c}.tile.opencyclemap.org/cycle/{z}/{x}/{y}.png"})})),this.olMap.addLayer(this.bicycleLayer);else{if(!this.bicycleLayer)return;this.olMap.removeLayer(this.bicycleLayer)}},WPGMZA.OLMap.prototype.onElementResized=function(event){this.olMap.updateSize()},WPGMZA.OLMap.prototype.onRightClick=function(event){if($(event.target).closest(".ol-marker, .wpgmza_modern_infowindow, .wpgmza-modern-store-locator").length)return!0;var parentOffset=$(this.element).offset(),relX=event.pageX-parentOffset.left,relY=event.pageY-parentOffset.top,latLng=this.pixelsToLatLng(relX,relY);return this.trigger({type:"rightclick",latLng:latLng}),$(this.element).trigger({type:"rightclick",latLng:latLng}),event.preventDefault(),!1}}),jQuery(function($){var Parent;WPGMZA.OLMarker=function(row){var self=this;Parent.call(this,row);var origin=ol.proj.fromLonLat([parseFloat(this.lng),parseFloat(this.lat)]),img=$("<img alt=''/>")[0];img.onload=function(event){self.map&&self.map.olMap.updateSize()},img.src=WPGMZA.defaultMarkerIcon,this.element=$("<div class='ol-marker'></div>")[0],this.element.append(img),this.element.wpgmzaMarker=this,$(this.element).on("mouseover",function(event){self.dispatchEvent("mouseover")}),this.overlay=new ol.Overlay({element:this.element,position:origin,positioning:"bottom-center",stopEvent:!1}),this.overlay.setPosition(origin),this.animation&&this.setAnimation(this.animation),this.setLabel(this.settings.label),row&&row.draggable&&this.setDraggable(!0),this.rebindClickListener(),this.trigger("init")},Parent=WPGMZA.isProVersion()?WPGMZA.ProMarker:WPGMZA.Marker,WPGMZA.OLMarker.prototype=Object.create(Parent.prototype),WPGMZA.OLMarker.prototype.constructor=WPGMZA.OLMarker,WPGMZA.OLMarker.prototype.addLabel=function(){this.setLabel(this.getLabelText())},WPGMZA.OLMarker.prototype.setLabel=function(label){label?(this.label||(this.label=$("<div class='ol-marker-label'/>"),$(this.element).append(this.label)),this.label.html(label)):this.label&&$(this.element).find(".ol-marker-label").remove()},WPGMZA.OLMarker.prototype.getVisible=function(visible){return"none"!=this.overlay.getElement().style.display},WPGMZA.OLMarker.prototype.setVisible=function(visible){Parent.prototype.setVisible.call(this,visible),this.overlay.getElement().style.display=visible?"block":"none"},WPGMZA.OLMarker.prototype.setPosition=function(latLng){Parent.prototype.setPosition.call(this,latLng);var origin=ol.proj.fromLonLat([parseFloat(this.lng),parseFloat(this.lat)]);this.overlay.setPosition(origin)},WPGMZA.OLMarker.prototype.updateOffset=function(x,y){var x=this._offset.x,y=this._offset.y;this.element.style.position="relative",this.element.style.left=x+"px",this.element.style.top=y+"px"},WPGMZA.OLMarker.prototype.setAnimation=function(anim){switch(Parent.prototype.setAnimation.call(this,anim),anim){case WPGMZA.Marker.ANIMATION_NONE:$(this.element).removeAttr("data-anim");break;case WPGMZA.Marker.ANIMATION_BOUNCE:$(this.element).attr("data-anim","bounce");break;case WPGMZA.Marker.ANIMATION_DROP:$(this.element).attr("data-anim","drop")}},WPGMZA.OLMarker.prototype.setDraggable=function(draggable){var self=this;if(draggable){var options={disabled:!1};this.jQueryDraggableInitialized||(options.start=function(event){self.onDragStart(event)},options.stop=function(event){self.onDragEnd(event)}),$(this.element).draggable(options),this.jQueryDraggableInitialized=!0,this.rebindClickListener()}else $(this.element).draggable({disabled:!0})},WPGMZA.OLMarker.prototype.setOpacity=function(opacity){$(this.element).css({opacity:opacity})},WPGMZA.OLMarker.prototype.onDragStart=function(event){this.isBeingDragged=!0},WPGMZA.OLMarker.prototype.onDragEnd=function(event){var offset={top:parseFloat($(this.element).css("top").match(/-?\d+/)[0]),left:parseFloat($(this.element).css("left").match(/-?\d+/)[0])};$(this.element).css({top:"0px",left:"0px"});var currentLatLng=this.getPosition(),pixelsBeforeDrag=this.map.latLngToPixels(currentLatLng),pixelsAfterDrag={x:pixelsBeforeDrag.x+offset.left,y:pixelsBeforeDrag.y+offset.top},latLngAfterDrag=this.map.pixelsToLatLng(pixelsAfterDrag);this.setPosition(latLngAfterDrag),this.isBeingDragged=!1,this.trigger({type:"dragend",latLng:latLngAfterDrag})},WPGMZA.OLMarker.prototype.onElementClick=function(event){var self=event.currentTarget.wpgmzaMarker;self.isBeingDragged||(self.dispatchEvent("click"),self.dispatchEvent("select"))},WPGMZA.OLMarker.prototype.rebindClickListener=function(){$(this.element).off("click",this.onElementClick),$(this.element).on("click",this.onElementClick)}}),jQuery(function($){WPGMZA.OLModernStoreLocatorCircle=function(map,settings){WPGMZA.ModernStoreLocatorCircle.call(this,map,settings)},WPGMZA.OLModernStoreLocatorCircle.prototype=Object.create(WPGMZA.ModernStoreLocatorCircle.prototype),WPGMZA.OLModernStoreLocatorCircle.prototype.constructor=WPGMZA.OLModernStoreLocatorCircle,WPGMZA.OLModernStoreLocatorCircle.prototype.initCanvasLayer=function(){var self=this,mapElement=$(this.map.element),olViewportElement=mapElement.children(".ol-viewport");this.canvas=document.createElement("canvas"),this.canvas.className="wpgmza-ol-canvas-overlay",mapElement.append(this.canvas),this.renderFunction=function(event){self.canvas.width==olViewportElement.width()&&self.canvas.height==olViewportElement.height()||(self.canvas.width=olViewportElement.width(),self.canvas.height=olViewportElement.height(),$(this.canvas).css({width:olViewportElement.width()+"px",height:olViewportElement.height()+"px"})),self.draw()},this.map.olMap.on("postrender",this.renderFunction)},WPGMZA.OLModernStoreLocatorCircle.prototype.getContext=function(type){return this.canvas.getContext(type)},WPGMZA.OLModernStoreLocatorCircle.prototype.getCanvasDimensions=function(){return{width:this.canvas.width,height:this.canvas.height}},WPGMZA.OLModernStoreLocatorCircle.prototype.getCenterPixels=function(){return this.map.latLngToPixels(this.settings.center)},WPGMZA.OLModernStoreLocatorCircle.prototype.getWorldOriginOffset=function(){return{x:0,y:0}},WPGMZA.OLModernStoreLocatorCircle.prototype.getTransformedRadius=function(km){var center=new WPGMZA.LatLng(this.settings.center),outer=new WPGMZA.LatLng(center);outer.moveByDistance(km,90);var centerPixels=this.map.latLngToPixels(center),outerPixels=this.map.latLngToPixels(outer);return Math.abs(outerPixels.x-centerPixels.x)},WPGMZA.OLModernStoreLocatorCircle.prototype.getScale=function(){return 1},WPGMZA.OLModernStoreLocatorCircle.prototype.destroy=function(){$(this.canvas).remove(),this.map.olMap.un("postrender",this.renderFunction),this.map=null,this.canvas=null}}),jQuery(function($){WPGMZA.OLModernStoreLocator=function(map_id){WPGMZA.ModernStoreLocator.call(this,map_id),$(WPGMZA.isProVersion()?".wpgmza_map[data-map-id='"+map_id+"']":"#wpgmza_map").append(this.element)},WPGMZA.OLModernStoreLocator.prototype=Object.create(WPGMZA.ModernStoreLocator),WPGMZA.OLModernStoreLocator.prototype.constructor=WPGMZA.OLModernStoreLocator}),jQuery(function($){var Parent;WPGMZA.OLPolygon=function(row,olFeature){if(Parent.call(this,row,olFeature),this.olStyle=new ol.style.Style,olFeature)this.olFeature=olFeature;else{var coordinates=[[]];if(row&&row.points){for(var paths=this.parseGeometry(row.points),i=0;i<paths.length;i++)coordinates[0].push(ol.proj.fromLonLat([parseFloat(paths[i].lng),parseFloat(paths[i].lat)]));this.olStyle=new ol.style.Style(this.getStyleFromSettings())}this.olFeature=new ol.Feature({geometry:new ol.geom.Polygon(coordinates)})}this.layer=new ol.layer.Vector({source:new ol.source.Vector({features:[this.olFeature]}),style:this.olStyle}),this.layer.getSource().getFeatures()[0].setProperties({wpgmzaPolygon:this})},Parent=WPGMZA.isProVersion()?WPGMZA.ProPolygon:WPGMZA.Polygon,WPGMZA.OLPolygon.prototype=Object.create(Parent.prototype),WPGMZA.OLPolygon.prototype.constructor=WPGMZA.OLPolygon,WPGMZA.OLPolygon.prototype.getStyleFromSettings=function(){var params={};return this.settings.strokeOpacity&&(params.stroke=new ol.style.Stroke({color:WPGMZA.hexOpacityToRGBA(this.settings.strokeColor,this.settings.strokeOpacity)})),this.settings.fillOpacity&&(params.fill=new ol.style.Fill({color:WPGMZA.hexOpacityToRGBA(this.settings.fillColor,this.settings.fillOpacity)})),params},WPGMZA.OLPolygon.prototype.updateStyleFromSettings=function(){var params=this.getStyleFromSettings();this.olStyle=new ol.style.Style(params),this.layer.setStyle(this.olStyle)},WPGMZA.OLPolygon.prototype.setEditable=function(editable){},WPGMZA.OLPolygon.prototype.toJSON=function(){var result=Parent.prototype.toJSON.call(this),coordinates=this.olFeature.getGeometry().getCoordinates()[0];result.points=[];for(var i=0;i<coordinates.length;i++){var lonLat=ol.proj.toLonLat(coordinates[i]),latLng={lat:lonLat[1],lng:lonLat[0]};result.points.push(latLng)}return result}}),jQuery(function($){var Parent;WPGMZA.OLPolyline=function(row,olFeature){if(WPGMZA.Polyline.call(this,row),this.olStyle=new ol.style.Style,olFeature)this.olFeature=olFeature;else{var coordinates=[];if(row&&row.points)for(var path=this.parseGeometry(row.points),i=0;i<path.length;i++)coordinates.push(ol.proj.fromLonLat([parseFloat(path[i].lng),parseFloat(path[i].lat)]));var params=this.getStyleFromSettings();this.olStyle=new ol.style.Style(params),this.olFeature=new ol.Feature({geometry:new ol.geom.LineString(coordinates)})}this.layer=new ol.layer.Vector({source:new ol.source.Vector({features:[this.olFeature]}),style:this.olStyle}),this.layer.getSource().getFeatures()[0].setProperties({wpgmzaPolyline:this})},Parent=WPGMZA.Polyline,WPGMZA.OLPolyline.prototype=Object.create(Parent.prototype),WPGMZA.OLPolyline.prototype.constructor=WPGMZA.OLPolyline,WPGMZA.OLPolyline.prototype.getStyleFromSettings=function(){var params={};return this.settings.strokeOpacity&&(params.stroke=new ol.style.Stroke({color:WPGMZA.hexOpacityToRGBA(this.settings.strokeColor,this.settings.strokeOpacity),width:parseInt(this.settings.strokeWeight)})),params},WPGMZA.OLPolyline.prototype.updateStyleFromSettings=function(){var params=this.getStyleFromSettings();this.olStyle=new ol.style.Style(params),this.layer.setStyle(this.olStyle)},WPGMZA.OLPolyline.prototype.setEditable=function(editable){},WPGMZA.OLPolyline.prototype.setPoints=function(points){this.olFeature&&this.layer.getSource().removeFeature(this.olFeature);for(var coordinates=[],i=0;i<points.length;i++)coordinates.push(ol.proj.fromLonLat([parseFloat(points[i].lng),parseFloat(points[i].lat)]));this.olFeature=new ol.Feature({geometry:new ol.geom.LineString(coordinates)}),this.layer.getSource().addFeature(this.olFeature)},WPGMZA.OLPolyline.prototype.toJSON=function(){var result=Parent.prototype.toJSON.call(this),coordinates=this.olFeature.getGeometry().getCoordinates();result.points=[];for(var i=0;i<coordinates.length;i++){var lonLat=ol.proj.toLonLat(coordinates[i]),latLng={lat:lonLat[1],lng:lonLat[0]};result.points.push(latLng)}return result}}),jQuery(function($){WPGMZA.OLText=function(){}}),jQuery(function($){WPGMZA.DataTable=function(element){if($.fn.dataTable.ext)$.fn.dataTable.ext.errMode="throw";else{var version=$.fn.dataTable.version?$.fn.dataTable.version:"unknown";console.log("You appear to be running an outdated or modified version of the dataTables library. This may cause issues with table functionality. This is usually caused by 3rd party software loading an older version of DataTables. The loaded version is "+version+", we recommend version 1.10.12 or above.")}this.element=element,this.element.wpgmzaDataTable=this,this.dataTableElement=this.getDataTableElement();var settings=this.getDataTableSettings();this.phpClass=$(element).attr("data-wpgmza-php-class"),this.dataTable=$(this.dataTableElement).DataTable(settings),this.wpgmzaDataTable=this,this.useCompressedPathVariable=WPGMZA.restAPI.isCompressedPathVariableSupported&&WPGMZA.settings.enable_compressed_path_variables,this.method=this.useCompressedPathVariable?"GET":"POST",this.dataTable.ajax.reload()},WPGMZA.DataTable.prototype.getDataTableElement=function(){return $(this.element).find("table")},WPGMZA.DataTable.prototype.onAJAXRequest=function(data,settings){var params={phpClass:this.phpClass},attr=$(this.element).attr("data-wpgmza-ajax-parameters");return attr&&$.extend(params,JSON.parse(attr)),$.extend(data,params)},WPGMZA.DataTable.prototype.onDataTableAjaxRequest=function(data,callback,settings){var self=this,element=this.element,route=$(element).attr("data-wpgmza-rest-api-route"),params=this.onAJAXRequest(data,settings),draw=params.draw;if(delete params.draw,!route)throw new Error("No data-wpgmza-rest-api-route attribute specified");var options={method:"POST",useCompressedPathVariable:!0,data:params,dataType:"json",cache:!this.preventCaching,beforeSend:function(xhr){xhr.setRequestHeader("X-DataTables-Draw",draw)},success:function(response,status,xhr){response.draw=draw,self.lastResponse=response,callback(response)}};return WPGMZA.restAPI.call(route,options)},WPGMZA.DataTable.prototype.getDataTableSettings=function(){var self=this,element=this.element,options={};$(element).attr("data-wpgmza-datatable-options")&&(options=JSON.parse($(element).attr("data-wpgmza-datatable-options"))),options.deferLoading=!0,options.processing=!0,options.serverSide=!0,options.ajax=function(data,callback,settings){return WPGMZA.DataTable.prototype.onDataTableAjaxRequest.apply(self,arguments)},WPGMZA.AdvancedTableDataTable&&this instanceof WPGMZA.AdvancedTableDataTable&&WPGMZA.settings.wpgmza_default_items&&(options.iDisplayLength=parseInt(WPGMZA.settings.wpgmza_default_items)),options.aLengthMenu=[5,10,25,50,100];var languageURL=this.getLanguageURL();return languageURL&&(options.language={url:languageURL}),options},WPGMZA.DataTable.prototype.getLanguageURL=function(){if(!WPGMZA.locale)return null;var languageURL;switch(WPGMZA.locale.substr(0,2)){case"af":languageURL="//cdn.datatables.net/plug-ins/1.10.12/i18n/Afrikaans.json";break;case"sq":languageURL="//cdn.datatables.net/plug-ins/1.10.12/i18n/Albanian.json";break;case"am":languageURL="//cdn.datatables.net/plug-ins/1.10.12/i18n/Amharic.json";break;case"ar":languageURL="//cdn.datatables.net/plug-ins/1.10.12/i18n/Arabic.json";break;case"hy":languageURL="//cdn.datatables.net/plug-ins/1.10.12/i18n/Armenian.json";break;case"az":languageURL="//cdn.datatables.net/plug-ins/1.10.12/i18n/Azerbaijan.json";break;case"bn":languageURL="//cdn.datatables.net/plug-ins/1.10.12/i18n/Bangla.json";break;case"eu":languageURL="//cdn.datatables.net/plug-ins/1.10.12/i18n/Basque.json";break;case"be":languageURL="//cdn.datatables.net/plug-ins/1.10.12/i18n/Belarusian.json";break;case"bg":languageURL="//cdn.datatables.net/plug-ins/1.10.12/i18n/Bulgarian.json";break;case"ca":languageURL="//cdn.datatables.net/plug-ins/1.10.12/i18n/Catalan.json";break;case"zh":languageURL="zh_TW"==WPGMZA.locale?"//cdn.datatables.net/plug-ins/1.10.12/i18n/Chinese-traditional.json":"//cdn.datatables.net/plug-ins/1.10.12/i18n/Chinese.json";break;case"hr":languageURL="//cdn.datatables.net/plug-ins/1.10.12/i18n/Croatian.json";break;case"cs":languageURL="//cdn.datatables.net/plug-ins/1.10.12/i18n/Czech.json";break;case"da":languageURL="//cdn.datatables.net/plug-ins/1.10.12/i18n/Danish.json";break;case"nl":languageURL="//cdn.datatables.net/plug-ins/1.10.12/i18n/Dutch.json";break;case"et":languageURL="//cdn.datatables.net/plug-ins/1.10.12/i18n/Estonian.json";break;case"fi":languageURL=WPGMZA.locale.match(/^fil/)?"//cdn.datatables.net/plug-ins/1.10.12/i18n/Filipino.json":"//cdn.datatables.net/plug-ins/1.10.12/i18n/Finnish.json";break;case"fr":languageURL="//cdn.datatables.net/plug-ins/1.10.12/i18n/French.json";break;case"gl":languageURL="//cdn.datatables.net/plug-ins/1.10.12/i18n/Galician.json";break;case"ka":languageURL="//cdn.datatables.net/plug-ins/1.10.12/i18n/Georgian.json";break;case"de":languageURL="//cdn.datatables.net/plug-ins/1.10.12/i18n/German.json";break;case"el":languageURL="//cdn.datatables.net/plug-ins/1.10.12/i18n/Greek.json";break;case"gu":languageURL="//cdn.datatables.net/plug-ins/1.10.12/i18n/Gujarati.json";break;case"he":languageURL="//cdn.datatables.net/plug-ins/1.10.12/i18n/Hebrew.json";break;case"hi":languageURL="//cdn.datatables.net/plug-ins/1.10.12/i18n/Hindi.json";break;case"hu":languageURL="//cdn.datatables.net/plug-ins/1.10.12/i18n/Hungarian.json";break;case"is":languageURL="//cdn.datatables.net/plug-ins/1.10.12/i18n/Icelandic.json";break;case"id":languageURL="//cdn.datatables.net/plug-ins/1.10.12/i18n/Indonesian.json";break;case"ga":languageURL="//cdn.datatables.net/plug-ins/1.10.12/i18n/Irish.json";break;case"it":languageURL="//cdn.datatables.net/plug-ins/1.10.12/i18n/Italian.json";break;case"ja":languageURL="//cdn.datatables.net/plug-ins/1.10.12/i18n/Japanese.json";break;case"kk":languageURL="//cdn.datatables.net/plug-ins/1.10.12/i18n/Kazakh.json";break;case"ko":languageURL="//cdn.datatables.net/plug-ins/1.10.12/i18n/Korean.json";break;case"ky":languageURL="//cdn.datatables.net/plug-ins/1.10.12/i18n/Kyrgyz.json";break;case"lv":languageURL="//cdn.datatables.net/plug-ins/1.10.12/i18n/Latvian.json";break;case"lt":languageURL="//cdn.datatables.net/plug-ins/1.10.12/i18n/Lithuanian.json";break;case"mk":languageURL="//cdn.datatables.net/plug-ins/1.10.12/i18n/Macedonian.json";break;case"ml":languageURL="//cdn.datatables.net/plug-ins/1.10.12/i18n/Malay.json";break;case"mn":languageURL="//cdn.datatables.net/plug-ins/1.10.12/i18n/Mongolian.json";break;case"ne":languageURL="//cdn.datatables.net/plug-ins/1.10.12/i18n/Nepali.json";break;case"nb":languageURL="//cdn.datatables.net/plug-ins/1.10.12/i18n/Norwegian-Bokmal.json";break;case"nn":languageURL="//cdn.datatables.net/plug-ins/1.10.12/i18n/Norwegian-Nynorsk.json";break;case"ps":languageURL="//cdn.datatables.net/plug-ins/1.10.12/i18n/Pashto.json";break;case"fa":languageURL="//cdn.datatables.net/plug-ins/1.10.12/i18n/Persian.json";break;case"pl":languageURL="//cdn.datatables.net/plug-ins/1.10.12/i18n/Polish.json";break;case"pt":languageURL="pt_BR"==WPGMZA.locale?"//cdn.datatables.net/plug-ins/1.10.12/i18n/Portuguese-Brasil.json":"//cdn.datatables.net/plug-ins/1.10.12/i18n/Portuguese.json";break;case"ro":languageURL="//cdn.datatables.net/plug-ins/1.10.12/i18n/Romanian.json";break;case"ru":languageURL="//cdn.datatables.net/plug-ins/1.10.12/i18n/Russian.json";break;case"sr":languageURL="//cdn.datatables.net/plug-ins/1.10.12/i18n/Serbian.json";break;case"si":languageURL="//cdn.datatables.net/plug-ins/1.10.12/i18n/Sinhala.json";break;case"sk":languageURL="//cdn.datatables.net/plug-ins/1.10.12/i18n/Slovak.json";break;case"sl":languageURL="//cdn.datatables.net/plug-ins/1.10.12/i18n/Slovenian.json";break;case"es":languageURL="//cdn.datatables.net/plug-ins/1.10.12/i18n/Spanish.json";break;case"sw":languageURL="//cdn.datatables.net/plug-ins/1.10.12/i18n/Swahili.json";break;case"sv":languageURL="//cdn.datatables.net/plug-ins/1.10.12/i18n/Swedish.json";break;case"ta":languageURL="//cdn.datatables.net/plug-ins/1.10.12/i18n/Tamil.json";break;case"te":languageURL="//cdn.datatables.net/plug-ins/1.10.12/i18n/telugu.json";break;case"th":languageURL="//cdn.datatables.net/plug-ins/1.10.12/i18n/Thai.json";break;case"tr":languageURL="//cdn.datatables.net/plug-ins/1.10.12/i18n/Turkish.json";break;case"uk":languageURL="//cdn.datatables.net/plug-ins/1.10.12/i18n/Ukrainian.json";break;case"ur":languageURL="//cdn.datatables.net/plug-ins/1.10.12/i18n/Urdu.json";break;case"uz":languageURL="//cdn.datatables.net/plug-ins/1.10.12/i18n/Uzbek.json";break;case"vi":languageURL="//cdn.datatables.net/plug-ins/1.10.12/i18n/Vietnamese.json";break;case"cy":languageURL="//cdn.datatables.net/plug-ins/1.10.12/i18n/Welsh.json"}return languageURL},WPGMZA.DataTable.prototype.onAJAXResponse=function(response){},WPGMZA.DataTable.prototype.reload=function(){this.dataTable.ajax.reload(null,!1)}}),jQuery(function($){WPGMZA.AdminMarkerDataTable=function(element){var self=this;this.preventCaching=!0,WPGMZA.DataTable.call(this,element),$(element).find(".wpgmza.select_all_markers").on("click",function(event){self.onSelectAll(event)}),$(element).find(".wpgmza.bulk_delete").on("click",function(event){self.onBulkDelete(event)})},WPGMZA.AdminMarkerDataTable.prototype=Object.create(WPGMZA.DataTable.prototype),WPGMZA.AdminMarkerDataTable.prototype.constructor=WPGMZA.AdminMarkerDataTable,WPGMZA.AdminMarkerDataTable.prototype.getDataTableSettings=function(){var self=this,options=WPGMZA.DataTable.prototype.getDataTableSettings.call(this);return options.createdRow=function(row,data,index){var meta=self.lastResponse.meta[index];row.wpgmzaMarkerData=meta},options},WPGMZA.AdminMarkerDataTable.prototype.onSelectAll=function(event){$(this.element).find("input[name='mark']").prop("checked",!0)},WPGMZA.AdminMarkerDataTable.prototype.onBulkDelete=function(event){var self=this,ids=[],map=WPGMZA.maps[0];$(this.element).find("input[name='mark']:checked").each(function(index,el){var row=$(el).closest("tr")[0];ids.push(row.wpgmzaMarkerData.id)}),ids.forEach(function(marker_id){var marker=map.getMarkerByID(marker_id);marker&&map.removeMarker(marker)}),WPGMZA.restAPI.call("/markers/?skip_cache=1",{method:"DELETE",data:{ids:ids},complete:function(){self.reload()}})},$(document).ready(function(event){$("[data-wpgmza-admin-marker-datatable]").each(function(index,el){WPGMZA.adminMarkerDataTable=new WPGMZA.AdminMarkerDataTable(el)})})});
legacy-core.php CHANGED
@@ -1,5 +1,8 @@
1
  <?php
2
 
 
 
 
3
  if(!function_exists('wpgmza_require_once'))
4
  {
5
  function wpgmza_require_once($filename)
@@ -134,14 +137,31 @@ if (function_exists('wpgmaps_head_pro' )) {
134
  } else {
135
 
136
  if (function_exists( 'wpgmaps_pro_activate' ) && floatval($wpgmza_version) < 5.24) {
137
- add_action( 'admin_head', 'wpgmaps_head_old' );
 
 
 
 
 
 
 
 
 
 
 
 
138
  } else {
139
  add_action( 'admin_head', 'wpgmaps_head' );
140
  }
141
 
142
  }
143
 
144
- add_action( 'init', 'wpgmaps_init' );
 
 
 
 
 
145
  add_action( 'admin_menu', 'wpgmaps_admin_menu' );
146
  add_filter( 'widget_text', 'do_shortcode' );
147
 
@@ -740,187 +760,200 @@ function wpgmaps_admin_edit_marker_javascript() {
740
  * @return void
741
  */
742
  function wpgmaps_admin_javascript_basic() {
743
- if (is_admin()) {
744
- global $wpgmza;
745
- global $wpdb;
746
- global $wpgmza_version;
747
- global $wpgmza_tblname_maps;
748
- $ajax_nonce = wp_create_nonce("wpgmza");
749
-
750
- if( isset( $_POST['wpgmza_save_google_api_key_list'] ) ){
751
- if( $_POST['wpgmza_google_maps_api_key'] !== '' ){
752
- update_option('wpgmza_google_maps_api_key', sanitize_text_field(trim($_POST['wpgmza_google_maps_api_key'])));
753
- echo "<div class='updated'><p>";
754
- $settings_page = "<a href='".admin_url('/admin.php?page=wp-google-maps-menu-settings#tabs-4')."'>".__('settings', 'wp-google-maps')."</a>";
755
- echo sprintf( __('Your Google Maps API key has been successfully saved. This API key can be changed in the %s page', 'wp-google-maps'), $settings_page );
756
- echo "</p></div>";
757
- }
758
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
759
 
760
- if (is_admin() && isset( $_GET['page'] ) && $_GET['page'] == 'wp-google-maps-menu' && isset( $_GET['action'] ) && $_GET['action'] == "edit_marker") {
761
- wpgmaps_admin_edit_marker_javascript();
762
- }
763
- else if (is_admin() && isset($_GET['action']) && isset($_GET['page']) && $_GET['page'] == 'wp-google-maps-menu' && $_GET['action'] == "add_poly") { wpgmaps_b_admin_add_poly_javascript(sanitize_text_field($_GET['map_id'])); }
764
- else if (is_admin() && isset($_GET['action']) && isset($_GET['page']) && $_GET['page'] == 'wp-google-maps-menu' && $_GET['action'] == "edit_poly") { wpgmaps_b_admin_edit_poly_javascript(sanitize_text_field($_GET['map_id']),sanitize_text_field($_GET['poly_id'])); }
765
- else if (is_admin() && isset($_GET['action']) && isset($_GET['page']) && $_GET['page'] == 'wp-google-maps-menu' && $_GET['action'] == "add_polyline") { wpgmaps_b_admin_add_polyline_javascript(sanitize_text_field($_GET['map_id'])); }
766
- else if (is_admin() && isset($_GET['action']) && isset($_GET['page']) && $_GET['page'] == 'wp-google-maps-menu' && $_GET['action'] == "edit_polyline") { wpgmaps_b_admin_edit_polyline_javascript(sanitize_text_field($_GET['map_id']),sanitize_text_field($_GET['poly_id'])); }
767
 
768
- else if (is_admin() && isset( $_GET['page'] ) && $_GET['page'] == 'wp-google-maps-menu' && isset( $_GET['action'] ) && $_GET['action'] == "edit") {
769
 
770
- if (!$_GET['map_id']) { return; }
771
- $wpgmza_check = wpgmaps_update_xml_file(sanitize_text_field($_GET['map_id']));
772
- if ( is_wp_error($wpgmza_check) ) wpgmza_return_error($wpgmza_check);
773
-
774
- $wpgmza_settings = get_option("WPGMZA_OTHER_SETTINGS");
775
-
776
- /* LOAD GOOGLE MAPS */
777
- $wpgmza_locale = get_locale();
778
- $wpgmza_suffix = ".com";
779
- /* Hebrew correction */
780
- if ($wpgmza_locale == "he_IL") { $wpgmza_locale = "iw"; }
781
- /* Chinese integration */
782
- if ($wpgmza_locale == "zh_CN") { $wpgmza_suffix = ".cn"; } else { $wpgmza_suffix = ".com"; }
783
-
784
- $wpgmza_locale = substr( $wpgmza_locale, 0, 2 );
785
- /**
786
- * Only register the below scrips so that they are available on demand.
787
- */
788
- if(isset($wpgmza_settings['wpgmza_settings_remove_api']) && $wpgmza_settings['wpgmza_settings_remove_api'] == "yes")
789
- $wpgaps_core_dependancy = array();
 
 
 
 
790
  else
791
- {
792
- if($wpgmza->settings->engine == 'google-maps')
793
- $wpgaps_core_dependancy = array( 'wpgmza_api_call' );
794
- else
795
- $wpgaps_core_dependancy = array( 'wpgmza_ol_api_call' );
796
- }
797
-
798
- wp_enqueue_style( 'wpgmaps_admin_style', plugins_url('css/wpgmza_style.css', __FILE__),array(),$wpgmza_version.'b');
799
- wp_enqueue_style( 'wpgmaps_admin_datatables_style', plugins_url('css/data_table.css', __FILE__),array(),$wpgmza_version.'b');
800
- //wp_enqueue_script('wpgmaps_admin_datatables', plugins_url('/js/jquery.dataTables.min.js',__FILE__), $wpgaps_core_dependancy, $wpgmza_version.'b' , false);
801
 
802
 
803
 
804
- $wpgmza_current_map_id = (int)$_GET['map_id'];
805
 
806
- global $wpgmza;
807
- $wpgmza->loadScripts();
808
-
809
- wp_enqueue_script('wpgmaps_admin_core', plugins_url('/js/wpgmaps-admin-core.js',__FILE__), $wpgaps_core_dependancy, $wpgmza_version.'b' , false);
810
- do_action("wpgooglemaps_hook_user_js_after_core");
811
-
812
- wp_localize_script('wpgmaps_admin_core', 'wpgmza_circle_data_array', wpgmza_get_circle_data(1));
813
- wp_localize_script('wpgmaps_admin_core', 'wpgmza_rectangle_data_array', wpgmza_get_rectangle_data(1));
814
-
815
 
816
- $res = array();
817
- $res[$wpgmza_current_map_id] = wpgmza_get_map_data($wpgmza_current_map_id);
818
-
819
- $api_version_string = 'v=quarterly';
820
-
821
- $map_other_settings = maybe_unserialize($res[$wpgmza_current_map_id]->other_settings);
822
- $res[$wpgmza_current_map_id]->other_settings = $map_other_settings;
823
- $res[$wpgmza_current_map_id]->map_width_type = stripslashes($res[$wpgmza_current_map_id]->map_width_type);
824
-
825
-
826
- if ( isset( $res[$wpgmza_current_map_id]->other_settings['wpgmza_theme_data'] ) && $res[$wpgmza_current_map_id]->other_settings['wpgmza_theme_data'] != '') {
827
- $res[$wpgmza_current_map_id]->other_settings['wpgmza_theme_data'] = html_entity_decode(stripslashes($res[$wpgmza_current_map_id]->other_settings['wpgmza_theme_data']));
828
- }
829
-
830
-
831
- $polygonoptions = array();
832
- $total_poly_array = wpgmza_b_return_polygon_id_array($wpgmza_current_map_id);
833
- if ($total_poly_array > 0) {
834
- foreach ($total_poly_array as $poly_id) {
835
- $polygonoptions[$poly_id] = wpgmza_b_return_poly_options($poly_id);
836
-
837
- $tmp_poly_array = wpgmza_b_return_polygon_array($poly_id);
838
- $poly_data_raw_array = array();
839
- foreach ($tmp_poly_array as $single_poly) {
840
- $poly_data_raw = str_replace(" ","",$single_poly);
841
- $poly_data_raw = explode(",",$poly_data_raw);
842
- if (isset($poly_data_raw[0]) && isset($poly_data_raw[1])) {
843
- $lat = $poly_data_raw[0];
844
- $lng = $poly_data_raw[1];
845
- $poly_data_raw_array[] = $poly_data_raw;
846
- }
847
- }
848
- $polygonoptions[$poly_id]->polydata = $poly_data_raw_array;
849
-
850
- $linecolor = $polygonoptions[$poly_id]->linecolor;
851
- $fillcolor = $polygonoptions[$poly_id]->fillcolor;
852
- $fillopacity = $polygonoptions[$poly_id]->opacity;
853
- if (!$linecolor) { $polygonoptions[$poly_id]->linecolor = "000000"; }
854
- if (!$fillcolor) { $polygonoptions[$poly_id]->fillcolor = "66FF00"; }
855
- if (!$fillopacity) { $polygonoptions[$poly_id]->opacity = "0.5"; }
856
- }
857
- } else { $polygonoptions = array(); }
858
-
859
-
860
- $polylineoptions = array();
861
-
862
- $total_poly_array = wpgmza_b_return_polyline_id_array($wpgmza_current_map_id);
863
- if ($total_poly_array > 0) {
864
- foreach ($total_poly_array as $poly_id) {
865
- $polylineoptions[$poly_id] = wpgmza_b_return_polyline_options($poly_id);
866
-
867
- $tmp_poly_array = wpgmza_b_return_polyline_array($poly_id);
868
- $poly_data_raw_array = array();
869
- foreach ($tmp_poly_array as $single_poly) {
870
- $poly_data_raw = str_replace(" ","",$single_poly);
871
- $poly_data_raw = str_replace(")","",$poly_data_raw );
872
- $poly_data_raw = str_replace("(","",$poly_data_raw );
873
- $poly_data_raw = explode(",",$poly_data_raw);
874
- if (isset($poly_data_raw[0]) && isset($poly_data_raw[1])) {
875
- $lat = $poly_data_raw[0];
876
- $lng = $poly_data_raw[1];
877
- $poly_data_raw_array[] = $poly_data_raw;
878
- }
879
- }
880
- $polylineoptions[$poly_id]->polydata = $poly_data_raw_array;
881
-
882
-
883
- if (isset($polylineoptions[$poly_id]->linecolor)) { $linecolor = $polylineoptions[$poly_id]->linecolor; } else { $linecolor = false; }
884
- if (isset($polylineoptions[$poly_id]->fillcolor)) { $fillcolor = $polylineoptions[$poly_id]->fillcolor; } else { $fillcolor = false; }
885
- if (isset($polylineoptions[$poly_id]->opacity)) { $fillopacity = $polylineoptions[$poly_id]->opacity; } else { $fillopacity = false; }
886
- if (!$linecolor) { $polylineoptions[$poly_id]->linecolor = "000000"; }
887
- if (!$fillcolor) { $polylineoptions[$poly_id]->fillcolor = "66FF00"; }
888
- if (!$fillopacity) { $polylineoptions[$poly_id]->opacity = "0.5"; }
889
- }
890
- } else { $polylineoptions = array(); }
891
 
892
- if (isset($wpgmza_settings['wpgmza_settings_marker_pull']) && $wpgmza_settings['wpgmza_settings_marker_pull'] == "0") {
893
- $markers = wpgmaps_return_markers($wpgmza_current_map_id);
894
- }
895
-
896
- do_action("wpgooglemaps_basic_hook_user_js_after_core");
897
 
898
- wp_localize_script( 'wpgmaps_admin_core', 'wpgmaps_mapid', (string)$wpgmza_current_map_id);
899
- wp_localize_script( 'wpgmaps_admin_core', 'wpgmaps_localize', $res);
900
- wp_localize_script( 'wpgmaps_admin_core', 'wpgmaps_localize_polygon_settings', $polygonoptions);
901
- wp_localize_script( 'wpgmaps_admin_core', 'wpgmaps_localize_polyline_settings', $polylineoptions);
 
 
 
 
902
 
903
- wp_localize_script( 'wpgmaps_admin_core', 'wpgmaps_markerurl', wpgmaps_get_marker_url($wpgmza_current_map_id));
 
 
 
 
904
 
905
- if ($wpgmza_settings['wpgmza_settings_marker_pull'] == "0") {
906
- wp_localize_script( 'wpgmaps_admin_core', 'wpgmaps_localize_marker_data', $markers);
907
- }
908
-
909
- $wpgmza_settings = apply_filters("wpgmza_basic_filter_localize_settings",$wpgmza_settings);
910
 
911
- wp_localize_script( 'wpgmaps_admin_core', 'wpgmaps_localize_global_settings', $wpgmza_settings);
912
 
913
- wp_localize_script( 'wpgmaps_admin_core', 'wpgmaps_lang_km_away', __("km away","wp-google-maps"));
914
- wp_localize_script( 'wpgmaps_admin_core', 'wpgmaps_lang_m_away', __("miles away","wp-google-maps"));
915
- wp_localize_script( 'wpgmaps_admin_core', 'wpgmaps_nonce', $ajax_nonce);
916
- do_action("wpgooglemaps_hook_user_js_after_localize",$res);
 
917
 
918
- return true;
919
 
920
- }
921
- return true;
 
 
922
 
 
923
 
 
 
924
 
925
 
926
 
@@ -929,407 +962,407 @@ function wpgmaps_admin_javascript_basic() {
929
 
930
 
931
 
932
- /************************************** */
933
 
934
- ?>
935
- <script type="text/javascript" >
936
- var marker_pull = '<?php echo $marker_pull; ?>';
937
- var placeSearch, autocomplete;
938
- var wpgmza_table_length;
939
- var wpgmzaTable;
940
 
 
941
 
942
- <?php if (isset($markers) && strlen($markers) > 0 && $markers != "[]"){ ?>var db_marker_array = JSON.stringify(<?php echo $markers; ?>);<?php } else { echo "var db_marker_array = '';"; } ?>
943
-
 
 
 
 
944
 
945
 
946
- if ('undefined' == typeof window.jQuery) {
947
- alert("jQuery is not installed. WP Google Maps requires jQuery in order to function properly. Please ensure you have jQuery installed.")
948
- } else {
949
- // all good.. continue...
950
- }
951
 
952
 
 
 
 
 
 
953
 
954
 
955
- var marker_added = false;
956
- var MYMAP = {
957
- map: null,
958
- bounds: null
959
- }
960
- MYMAP.init = function(selector, latLng, zoom) {
961
- var myOptions = {
962
- minZoom: <?php echo $wpgmza_max_zoom; ?>,
963
- maxZoom: 21,
964
- zoom:zoom,
965
- center: latLng,
966
- zoomControl: <?php if (isset($wpgmza_settings['wpgmza_settings_map_zoom']) && $wpgmza_settings['wpgmza_settings_map_zoom'] == "yes") { echo "false"; } else { echo "true"; } ?>,
967
- panControl: <?php if (isset($wpgmza_settings['wpgmza_settings_map_pan']) && $wpgmza_settings['wpgmza_settings_map_pan'] == "yes") { echo "false"; } else { echo "true"; } ?>,
968
- mapTypeControl: <?php if (isset($wpgmza_settings['wpgmza_settings_map_type']) && $wpgmza_settings['wpgmza_settings_map_type'] == "yes") { echo "false"; } else { echo "true"; } ?>,
969
- streetViewControl: <?php if (isset($wpgmza_settings['wpgmza_settings_map_streetview']) && $wpgmza_settings['wpgmza_settings_map_streetview'] == "yes") { echo "false"; } else { echo "true"; } ?>,
970
- fullscreenControl: <?php if (isset($wpgmza_settings['wpgmza_settings_map_full_screen_control']) && $wpgmza_settings['wpgmza_settings_map_full_screen_control'] == "yes") { echo "false"; } else { echo "true"; } ?>,
971
- draggable: <?php if (isset($wpgmza_settings['wpgmza_settings_map_draggable']) && $wpgmza_settings['wpgmza_settings_map_draggable'] == "yes") { echo "false"; } else { echo "true"; } ?>,
972
- disableDoubleClickZoom: <?php if (isset($wpgmza_settings['wpgmza_settings_map_clickzoom']) && $wpgmza_settings['wpgmza_settings_map_clickzoom'] == "yes") { echo "true"; } else { echo "false"; } ?>,
973
- scrollwheel: <?php if (isset($wpgmza_settings['wpgmza_settings_map_scroll']) && $wpgmza_settings['wpgmza_settings_map_scroll'] == "yes") { echo "false"; } else { echo "true"; } ?>,
974
- mapTypeId: google.maps.MapTypeId.<?php echo $wpgmza_map_type; ?>
975
- }
976
- this.map = new google.maps.Map(jQuery(selector)[0], myOptions);
977
- this.bounds = new WPGMZA.LatLngBounds();
978
 
979
 
980
- <?php if ($wpgmza_theme_data !== false && isset($wpgmza_theme_data) && $wpgmza_theme_data != '') { ?>
981
- this.map.setOptions({styles: <?php echo stripslashes($wpgmza_theme_data); ?>});
982
- <?php } ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
983
 
984
- google.maps.event.addListener(MYMAP.map, 'rightclick', function(event) {
985
- if (marker_added === false) {
986
- console.log("Creating marker on line <?php echo __LINE__ ?>");
987
- var marker = WPGMZA.Marker.createInstance({
988
- position: event.latLng,
989
- map: MYMAP.map
990
- });
991
- marker.setDraggable(true);
992
- google.maps.event.addListener(marker, 'dragend', function(event) {
993
- jQuery("#wpgmza_add_address").val(event.latLng.lat()+', '+event.latLng.lng());
994
- } );
995
- jQuery("#wpgmza_add_address").val(event.latLng.lat()+', '+event.latLng.lng());
996
- jQuery("#wpgm_notice_message_save_marker").show();
997
- marker_added = true;
998
- setTimeout(function() {
999
- jQuery("#wpgm_notice_message_save_marker").fadeOut('slow')
1000
- }, 3000);
1001
- } else {
1002
- jQuery("#wpgm_notice_message_addfirst_marker").fadeIn('fast')
1003
- setTimeout(function() {
1004
- jQuery("#wpgm_notice_message_addfirst_marker").fadeOut('slow')
1005
- }, 3000);
1006
- }
1007
-
1008
- });
1009
-
1010
- /**
1011
- * Deprecated in 6.4.05
1012
- * This was deprecated in wpgmaps-admin-core.js however caused a bug instead
1013
 
1014
- google.maps.event.addListener(MYMAP.map, 'zoom_changed', function() {
1015
- zoomLevel = MYMAP.map.getZoom();
 
1016
 
1017
- jQuery("#wpgmza_start_zoom").val(zoomLevel);
1018
- if (zoomLevel == 0) {
1019
- MYMAP.map.setZoom(10);
1020
- }
1021
- });
1022
-
1023
- */
1024
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1025
  <?php
1026
- $total_poly_array = wpgmza_b_return_polygon_id_array(sanitize_text_field($_GET['map_id']));
1027
- if ($total_poly_array > 0) {
1028
- foreach ($total_poly_array as $poly_id) {
1029
- $polyoptions = wpgmza_b_return_poly_options($poly_id);
1030
- $linecolor = $polyoptions->linecolor;
1031
- $fillcolor = $polyoptions->fillcolor;
1032
- $fillopacity = $polyoptions->opacity;
1033
- $lineopacity = $polyoptions->lineopacity;
1034
- $title = $polyoptions->title;
1035
- $link = $polyoptions->link;
1036
- $ohlinecolor = $polyoptions->ohlinecolor;
1037
- $ohfillcolor = $polyoptions->ohfillcolor;
1038
- $ohopacity = $polyoptions->ohopacity;
1039
- if (!$linecolor) { $linecolor = "000000"; }
1040
- if (!$fillcolor) { $fillcolor = "66FF00"; }
1041
- if ($fillopacity == "") { $fillopacity = "0.5"; }
1042
- if ($lineopacity == "") { $lineopacity = "1.0"; }
1043
- if ($ohlinecolor == "") { $ohlinecolor = $linecolor; }
1044
- if ($ohfillcolor == "") { $ohfillcolor = $fillcolor; }
1045
- if ($ohopacity == "") { $ohopacity = $fillopacity; }
1046
- $linecolor = "#".$linecolor;
1047
- $fillcolor = "#".$fillcolor;
1048
- $ohlinecolor = "#".$ohlinecolor;
1049
- $ohfillcolor = "#".$ohfillcolor;
1050
-
1051
- $poly_array = wpgmza_b_return_polygon_array($poly_id);
1052
-
1053
-
1054
- ?>
1055
-
1056
- <?php if (sizeof($poly_array) > 1) { ?>
1057
-
1058
- var WPGM_PathData_<?php echo $poly_id; ?> = [
1059
- <?php
1060
- foreach ($poly_array as $single_poly) {
1061
- $poly_data_raw = str_replace(" ","",$single_poly);
1062
- $poly_data_raw = explode(",",$poly_data_raw);
1063
- $lat = $poly_data_raw[0];
1064
- $lng = $poly_data_raw[1];
1065
- ?>
1066
- new WPGMZA.LatLng(<?php echo $lat; ?>, <?php echo $lng; ?>),
1067
- <?php
1068
- }
1069
- ?>
1070
-
1071
-
1072
- ];
1073
- console.log("Creating polygon on line <?php echo __LINE__; ?>");
1074
- var WPGM_Path_<?php echo $poly_id; ?> = new google.maps.Polygon({
1075
- path: WPGM_PathData_<?php echo $poly_id; ?>,
1076
- strokeColor: "<?php echo $linecolor; ?>",
1077
- fillOpacity: "<?php echo $fillopacity; ?>",
1078
- strokeOpacity: "<?php echo $lineopacity; ?>",
1079
- fillColor: "<?php echo $fillcolor; ?>",
1080
- strokeWeight: 2
1081
- });
1082
 
1083
- WPGM_Path_<?php echo $poly_id; ?>.setMap(this.map);
1084
- <?php } } ?>
1085
 
1086
- <?php } ?>
1087
 
1088
 
1089
-
1090
  <?php
1091
- /* polylines */
1092
- $total_polyline_array = wpgmza_b_return_polyline_id_array(sanitize_text_field($_GET['map_id']));
1093
- if ($total_polyline_array > 0) {
1094
- foreach ($total_polyline_array as $poly_id) {
1095
- $polyoptions = wpgmza_b_return_polyline_options($poly_id);
1096
- $linecolor = $polyoptions->linecolor;
1097
- $fillopacity = $polyoptions->opacity;
1098
- $linethickness = $polyoptions->linethickness;
1099
- if (!$linecolor) { $linecolor = "000000"; }
1100
- if (!$linethickness) { $linethickness = "4"; }
1101
- if (!$fillopacity) { $fillopacity = "0.5"; }
1102
- $linecolor = "#".$linecolor;
1103
- $poly_array = wpgmza_b_return_polyline_array($poly_id);
1104
- ?>
1105
-
1106
- <?php if (sizeof($poly_array) > 1) { ?>
1107
- var WPGM_PathLineData_<?php echo $poly_id; ?> = [
1108
- <?php
1109
- $poly_array = wpgmza_b_return_polyline_array($poly_id);
1110
-
1111
- foreach ($poly_array as $single_poly) {
1112
- $poly_data_raw = str_replace(" ","",$single_poly);
1113
- $poly_data_raw = explode(",",$poly_data_raw);
1114
- $lat = $poly_data_raw[0];
1115
- $lng = $poly_data_raw[1];
1116
- ?>
1117
- new WPGMZA.LatLng(<?php echo $lat; ?>, <?php echo $lng; ?>),
1118
- <?php
1119
- }
1120
- ?>
1121
- ];
1122
 
1123
- var WPGM_PathLine_<?php echo $poly_id; ?> = new google.maps.Polyline({
1124
- path: WPGM_PathLineData_<?php echo $poly_id; ?>,
1125
- strokeColor: "<?php echo $linecolor; ?>",
1126
- strokeOpacity: "<?php echo $fillopacity; ?>",
1127
- strokeWeight: "<?php echo $linethickness; ?>"
1128
-
1129
- });
1130
-
1131
- WPGM_PathLine_<?php echo $poly_id; ?>.setMap(this.map);
1132
- <?php } } } ?>
1133
-
1134
-
1135
-
1136
-
1137
-
1138
- google.maps.event.addListener(MYMAP.map, 'center_changed', function() {
1139
- var location = MYMAP.map.getCenter();
1140
- jQuery("#wpgmza_start_location").val(location.lat()+","+location.lng());
1141
- jQuery("#wpgmaps_save_reminder").show();
1142
- });
 
 
 
 
1143
 
1144
- <?php if ($wpgmza_bicycle == "1") { ?>
1145
- var bikeLayer = new google.maps.BicyclingLayer();
1146
- bikeLayer.setMap(MYMAP.map);
1147
- <?php } ?>
1148
- <?php if ($wpgmza_traffic == "1") { ?>
1149
- var trafficLayer = new google.maps.TrafficLayer();
1150
- trafficLayer.setMap(MYMAP.map);
1151
- <?php } ?>
1152
-
1153
- <?php if ($transport_layer == 1) { ?>
1154
- var transitLayer = new google.maps.TransitLayer();
1155
- transitLayer.setMap(MYMAP.map);
1156
- <?php } ?>
1157
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1158
 
1159
 
1160
- google.maps.event.addListener(MYMAP.map, 'click', function() {
1161
- infoWindow.close();
1162
- });
1163
 
 
 
 
1164
 
1165
- }
1166
 
1167
- var infoWindow = new google.maps.InfoWindow();
1168
- <?php
1169
- $wpgmza_settings = get_option("WPGMZA_OTHER_SETTINGS");
1170
- $wpgmza_settings_infowindow_width = "250";
1171
- if (isset($wpgmza_settings['wpgmza_settings_infowindow_width'])) { $wpgmza_settings_infowindow_width = $wpgmza_settings['wpgmza_settings_infowindow_width']; }
1172
- if (!isset($wpgmza_settings_infowindow_width) || !$wpgmza_settings_infowindow_width) { $wpgmza_settings_infowindow_width = "250"; }
1173
- ?>
1174
- infoWindow.setOptions({maxWidth:<?php echo $wpgmza_settings_infowindow_width; ?>});
1175
 
 
 
 
 
 
 
 
 
1176
 
1177
-
1178
 
1179
- MYMAP.placeMarkers = function(filename,map_id) {
1180
- marker_array = [];
1181
-
1182
- if (marker_pull === '1') {
1183
-
1184
-
1185
- jQuery.get(filename, function(xml){
1186
- jQuery(xml).find("marker").each(function(){
1187
- var wpmgza_map_id = jQuery(this).find('map_id').text();
1188
- if (wpmgza_map_id == map_id) {
1189
- var wpmgza_address = jQuery(this).find('address').text();
1190
- var wpmgza_anim = jQuery(this).find('anim').text();
1191
- var wpmgza_infoopen = jQuery(this).find('infoopen').text();
1192
- var lat = jQuery(this).find('lat').text();
1193
- var lng = jQuery(this).find('lng').text();
1194
- var point = new WPGMZA.LatLng(parseFloat(lat),parseFloat(lng));
1195
- MYMAP.bounds.extend(point);
1196
-
1197
- if (wpmgza_anim === "1") {
1198
- console.log("Creating marker on line <?php echo __LINE__ ?>");
1199
- var marker = WPGMZA.Marker.createInstance({
1200
- position: point,
1201
- map: MYMAP.map,
1202
- animation: google.maps.Animation.BOUNCE
1203
- });
1204
- }
1205
- else if (wpmgza_anim === "2") {
1206
- console.log("Creating marker on line <?php echo __LINE__ ?>");
1207
- var marker = WPGMZA.Marker.createInstance({
1208
- position: point,
1209
- map: MYMAP.map,
1210
- animation: google.maps.Animation.DROP
1211
- });
1212
- }
1213
- else {
1214
- console.log("Creating marker on line <?php echo __LINE__ ?>");
1215
- var marker = WPGMZA.Marker.createInstance({
1216
- position: point,
1217
- map: MYMAP.map
1218
- });
1219
- }
1220
-
1221
-
1222
- var html='<p class="wpgmza_infowinfow_address" style="margin-top:0; padding-top:0; margin-bottom:2px; padding-bottom:2px; font-weight:bold;">'+wpmgza_address+'</p>';
1223
-
1224
- if (wpmgza_infoopen === "1") {
1225
-
1226
- infoWindow.setContent(html);
1227
- infoWindow.open(MYMAP.map, marker);
1228
- }
1229
-
1230
- <?php if ($wpgmza_open_infowindow_by == '2') { ?>
1231
- google.maps.event.addListener(marker, 'mouseover', function() {
1232
- infoWindow.close();
1233
- infoWindow.setContent(html);
1234
- infoWindow.open(MYMAP.map, marker);
1235
-
1236
- });
1237
- <?php } else { ?>
1238
- google.maps.event.addListener(marker, 'click', function() {
1239
- infoWindow.close();
1240
- infoWindow.setContent(html);
1241
- infoWindow.open(MYMAP.map, marker);
1242
-
1243
- });
1244
- <?php } ?>
1245
-
1246
- }
1247
-
1248
- });
1249
- });
1250
- } else {
1251
- if (db_marker_array.length > 0) {
1252
- var dec_marker_array = JSON.parse(db_marker_array);
1253
- jQuery.each(dec_marker_array, function(i, val) {
1254
-
1255
-
1256
- var wpmgza_address = val.address;
1257
- var wpmgza_anim = val.anim;
1258
- var wpmgza_infoopen = val.infoopen;
1259
- var lat = val.lat;
1260
- var lng = val.lng;
1261
- var point = new WPGMZA.LatLng(parseFloat(lat),parseFloat(lng));
1262
- MYMAP.bounds.extend(point);
1263
-
1264
- if (wpmgza_anim === "1") {
1265
- console.log("Creating marker on line <?php echo __LINE__ ?>");
1266
- var marker = WPGMZA.Marker.createInstance({
1267
- position: point,
1268
- map: MYMAP.map,
1269
- animation: google.maps.Animation.BOUNCE
1270
- });
1271
- }
1272
- else if (wpmgza_anim === "2") {
1273
- console.log("Creating marker on line <?php echo __LINE__ ?>");
1274
- var marker = WPGMZA.Marker.createInstance({
1275
- position: point,
1276
- map: MYMAP.map,
1277
- animation: google.maps.Animation.DROP
1278
- });
1279
- }
1280
- else {
1281
- console.log("Creating marker on line <?php echo __LINE__ ?>");
1282
- var marker = WPGMZA.Marker.createInstance({
1283
- position: point,
1284
- map: MYMAP.map
1285
- });
1286
- }
1287
-
1288
-
1289
- var html='<p class="wpgmza_infowinfow_address" style="margin-top:0; padding-top:0; margin-bottom:2px; padding-bottom:2px; font-weight:bold;">'+wpmgza_address+'</p>';
1290
-
1291
- if (wpmgza_infoopen === "1") {
1292
-
1293
- infoWindow.setContent(html);
1294
- infoWindow.open(MYMAP.map, marker);
1295
- }
1296
-
1297
- <?php if ($wpgmza_open_infowindow_by == '2') { ?>
1298
- google.maps.event.addListener(marker, 'mouseover', function() {
1299
- infoWindow.close();
1300
- infoWindow.setContent(html);
1301
- infoWindow.open(MYMAP.map, marker);
1302
-
1303
- });
1304
- <?php } else { ?>
1305
- google.maps.event.addListener(marker, 'click', function() {
1306
- infoWindow.close();
1307
- infoWindow.setContent(html);
1308
- infoWindow.open(MYMAP.map, marker);
1309
-
1310
- });
1311
- <?php } ?>
1312
-
1313
-
1314
-
1315
-
1316
-
1317
-
1318
- });
1319
-
1320
- }
1321
- }
1322
- }
1323
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1324
 
 
 
 
 
 
1325
 
 
 
 
 
 
 
1326
 
 
 
1327
 
 
1328
 
1329
- </script>
1330
- <?php
1331
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1332
 
 
 
 
 
 
 
 
1333
  }
1334
 
1335
 
@@ -1360,53 +1393,7 @@ function wpgmaps_user_javascript_basic() {
1360
  if ($res[$wpgmza_current_map_id]->other_settings['wpgmza_theme_data'] != '') {
1361
  $res[$wpgmza_current_map_id]->other_settings['wpgmza_theme_data'] = html_entity_decode(stripslashes($res[$wpgmza_current_map_id]->other_settings['wpgmza_theme_data']));
1362
  }
1363
- /*
1364
- * deprecated in 6.2.0
1365
-
1366
- if (isset($map_other_settings['weather_layer'])) { $weather_layer = $map_other_settings['weather_layer']; } else { $weather_layer = false; }
1367
- if (isset($map_other_settings['weather_layer_temp_type'])) { $weather_layer_temp_type = $map_other_settings['weather_layer_temp_type']; } else { $weather_layer_temp_type = false; }
1368
- if (isset($map_other_settings['cloud_layer'])) { $cloud_layer = $map_other_settings['cloud_layer']; } else { $cloud_layer = false; }
1369
- */
1370
 
1371
-
1372
- /*
1373
- if (isset($map_other_settings['transport_layer'])) { $transport_layer = $map_other_settings['transport_layer']; } else { $transport_layer = false; }
1374
- if (isset($map_other_settings['store_locator_bounce'])) { $store_locator_bounce = $map_other_settings['store_locator_bounce']; } else { $store_locator_bounce = 1; }
1375
-
1376
- $wpgmza_lat = $res->map_start_lat;
1377
- $wpgmza_lng = $res->map_start_lng;
1378
- $wpgmza_width = $res->map_width;
1379
- $wpgmza_height = $res->map_height;
1380
- $wpgmza_width_type = $res->map_width_type;
1381
- $wpgmza_height_type = $res->map_height_type;
1382
- $wpgmza_map_type = $res->type;
1383
- $wpgmza_traffic = $res->traffic;
1384
- $wpgmza_bicycle = $res->bicycle;
1385
-
1386
- if (isset($map_other_settings['map_max_zoom'])) { $wpgmza_max_zoom = intval($map_other_settings['map_max_zoom']); } else { $wpgmza_max_zoom = 2; }
1387
- if (isset($map_other_settings['wpgmza_theme_data'])) { $wpgmza_theme_data = $map_other_settings['wpgmza_theme_data']; } else { $wpgmza_theme_data = false; }
1388
-
1389
-
1390
- if (isset($wpgmza_settings['wpgmza_settings_map_open_marker_by'])) { $wpgmza_open_infowindow_by = $wpgmza_settings['wpgmza_settings_map_open_marker_by']; } else { $wpgmza_open_infowindow_by = '1'; }
1391
- if ($wpgmza_open_infowindow_by == null || !isset($wpgmza_open_infowindow_by)) { $wpgmza_open_infowindow_by = '1'; }
1392
-
1393
- if (!$wpgmza_map_type || $wpgmza_map_type == "" || $wpgmza_map_type == "1") { $wpgmza_map_type = "ROADMAP"; }
1394
- else if ($wpgmza_map_type == "2") { $wpgmza_map_type = "SATELLITE"; }
1395
- else if ($wpgmza_map_type == "3") { $wpgmza_map_type = "HYBRID"; }
1396
- else if ($wpgmza_map_type == "4") { $wpgmza_map_type = "TERRAIN"; }
1397
- else { $wpgmza_map_type = "ROADMAP"; }
1398
-
1399
-
1400
- $start_zoom = $res->map_start_zoom;
1401
- if ($start_zoom < 1 || !$start_zoom) { $start_zoom = 5; }
1402
- if (!$wpgmza_lat || !$wpgmza_lng) { $wpgmza_lat = "51.5081290"; $wpgmza_lng = "-0.1280050"; }
1403
-
1404
-
1405
- if (isset($wpgmza_settings['wpgmza_settings_marker_pull'])) { $marker_pull = $wpgmza_settings['wpgmza_settings_marker_pull']; } else { $marker_pull = "1"; }
1406
- $restrict_search = false;
1407
- if (isset($map_other_settings['wpgmza_store_locator_restrict'])) { $restrict_search = $map_other_settings['wpgmza_store_locator_restrict']; } else { $restrict_search = false; }
1408
- */
1409
-
1410
  $polygonoptions = array();
1411
  $total_poly_array = wpgmza_b_return_polygon_id_array($wpgmza_current_map_id);
1412
 
@@ -1512,8 +1499,7 @@ function wpgooglemaps_basic_hook_control_overrides_user_js_after_core() {
1512
 
1513
  /**
1514
  * Build the marker XML file
1515
- * @param boolean $mapid Map Id
1516
- * @return boolean true by default
1517
  */
1518
  function wpgmaps_update_xml_file($mapid = false) {
1519
 
@@ -1968,143 +1954,162 @@ function wpgmaps_action_callback_basic() {
1968
  global $wpgmza_tblname_polylines;
1969
  $check = check_ajax_referer( 'wpgmza', 'security' );
1970
  $table_name = $wpdb->prefix . "wpgmza";
1971
-
1972
- if ($check == 1) {
1973
-
1974
- if ($_POST['action'] == "add_marker") {
1975
-
1976
- $fields = array(
1977
- 'map_id' => '%d',
1978
- 'address' => '%s',
1979
- 'lat' => '%f',
1980
- 'lng' => '%f',
1981
- 'latlng' => "{$wpgmza->spatialFunctionPrefix}GeomFromText(%s)",
1982
- 'infoopen' => '%d',
1983
- 'description' => '%s',
1984
- 'title' => '%s',
1985
- 'anim' => '%d',
1986
- 'link' => '%s',
1987
- 'icon' => '%s',
1988
- 'pic' => '%s'
1989
- );
1990
 
1991
- $keys = array_keys($fields);
1992
- $placeholders = array_values($fields);
 
 
 
 
 
 
 
 
 
1993
 
1994
- $qstr = "INSERT INTO $table_name (" . implode(',', $keys) . ") VALUES (" . implode(',', $placeholders) . ")";
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1995
 
1996
- $params = array();
1997
- foreach($fields as $key => $placeholder)
1998
  {
1999
- if($key == 'latlng')
2000
- {
2001
- $params[] = "POINT({$_POST['lat']} {$_POST['lng']})";
2002
- continue;
2003
- }
2004
-
2005
- if(!isset($_POST[$key]))
2006
- {
2007
- $params[] = "";
2008
- continue;
2009
- }
2010
-
2011
- $params[] = $_POST[$key];
2012
  }
2013
 
2014
- $stmt = $wpdb->prepare($qstr, $params);
2015
- $rows_affected = $wpdb->query($stmt);
2016
-
2017
- $wpgmza_check = wpgmaps_update_xml_file(sanitize_text_field((int)$_POST['map_id']));
2018
-
2019
- if ( is_wp_error($wpgmza_check) ) wpgmza_return_error($wpgmza_check);
2020
- $return_a = array(
2021
- "marker_id" => $wpdb->insert_id,
2022
- "marker_data" => wpgmaps_return_markers(sanitize_text_field($_POST['map_id']),$wpdb->insert_id)
2023
- );
2024
- echo json_encode($return_a);
2025
-
2026
- }
2027
- if ($_POST['action'] == "edit_marker") {
2028
- $cur_id = sanitize_text_field($_POST['edit_id']);
2029
-
2030
- $qstr = "UPDATE $table_name SET
2031
- address = %s,
2032
- lat = %f,
2033
- lng = %f,
2034
- latlng = {$wpgmza->spatialFunctionPrefix}GeomFromText(%s),
2035
- anim = %d,
2036
- infoopen = %d
2037
- WHERE
2038
- id = %d
2039
- ";
2040
-
2041
- $param = array(
2042
- $_POST['address'],
2043
- $_POST['lat'],
2044
- $_POST['lng'],
2045
- "POINT(" . $_POST['lat'] . " " . $_POST['lng'] . ")",
2046
- $_POST['anim'],
2047
- $_POST['infoopen'],
2048
- $cur_id
2049
- );
2050
-
2051
- foreach($param as $key => $value)
2052
- $param[$key] = sanitize_text_field($value);
2053
-
2054
- $stmt = $wpdb->prepare($qstr, $param);
2055
- $rows_affected = $wpdb->query($stmt);
 
 
 
2056
 
2057
- $wpgmza_check = wpgmaps_update_xml_file(sanitize_text_field((int)$_POST['map_id']));
2058
- if ( is_wp_error($wpgmza_check) ) wpgmza_return_error($wpgmza_check);
2059
- $return_a = array(
2060
- "marker_id" => $cur_id,
2061
- "marker_data" => wpgmaps_return_markers(sanitize_text_field($_POST['map_id']),$cur_id)
2062
- );
2063
- echo json_encode($return_a);
2064
-
2065
- }
2066
- if ($_POST['action'] == "delete_marker") {
2067
- $marker_id = sanitize_text_field($_POST['marker_id']);
2068
- $wpdb->query( $wpdb->prepare("DELETE FROM $wpgmza_tblname WHERE `id` = %d LIMIT 1",intval($marker_id)) );
2069
 
2070
- $wpgmza_check = wpgmaps_update_xml_file(sanitize_text_field($_POST['map_id']));
2071
- if ( is_wp_error($wpgmza_check) ) wpgmza_return_error($wpgmza_check);
2072
- $return_a = array(
2073
- "marker_id" => $marker_id,
2074
- "marker_data" => wpgmaps_return_markers(sanitize_text_field($_POST['map_id']))
2075
- );
2076
- echo json_encode($return_a);
 
 
 
 
 
 
2077
 
2078
 
2079
- }
2080
- if ($_POST['action'] == "delete_poly") {
2081
- $poly_id = sanitize_text_field($_POST['poly_id']);
2082
- $wpdb->query($wpdb->prepare("DELETE FROM $wpgmza_tblname_poly WHERE `id` = %d LIMIT 1",intval($poly_id)) );
2083
- echo wpgmza_b_return_polygon_list(sanitize_text_field($_POST['map_id']));
2084
- }
2085
- if ($_POST['action'] == "delete_polyline") {
2086
- $poly_id = sanitize_text_field($_POST['poly_id']);
2087
- $wpdb->query($wpdb->prepare("DELETE FROM $wpgmza_tblname_polylines WHERE `id` = %d LIMIT 1",intval($poly_id)) );
2088
- echo wpgmza_b_return_polyline_list(sanitize_text_field($_POST['map_id']));
2089
- }
 
 
 
 
 
2090
 
2091
- if($_POST['action'] == "delete_circle") {
2092
- global $wpgmza_tblname_circles;
2093
- $stmt = $wpdb->prepare("DELETE FROM $wpgmza_tblname_circles WHERE id=%d", array($_POST['circle_id']));
2094
- $wpdb->query($stmt);
2095
-
2096
- echo wpgmza_get_circles_table($_POST['map_id']);
2097
- }
2098
 
2099
- if($_POST['action'] == "delete_rectangle") {
2100
- global $wpgmza_tblname_rectangles;
2101
- $stmt = $wpdb->prepare("DELETE FROM $wpgmza_tblname_rectangles WHERE id=%d", array($_POST['rectangle_id']));
2102
- $wpdb->query($stmt);
2103
-
2104
- echo wpgmza_get_rectangles_table($_POST['map_id']);
2105
- }
2106
- }
2107
- die();
2108
  }
2109
 
2110
  /**
@@ -2121,8 +2126,8 @@ function wpgmaps_load_maps_api() {
2121
  * @param array $atts array of shortcode attributes
2122
  * @return void
2123
  */
2124
- function wpgmaps_tag_basic( $atts ) {
2125
-
2126
  global $wpgmza_current_map_id;
2127
  global $wpgmza_version;
2128
  global $short_code_active;
@@ -2131,16 +2136,16 @@ function wpgmaps_tag_basic( $atts ) {
2131
 
2132
  $short_code_active = true;
2133
 
2134
- extract( shortcode_atts( array(
2135
  'id' => '1',
2136
  'width' => 'inherit',
2137
  'height' => 'inherit'
2138
- ), $atts ) );
2139
 
2140
  $ret_msg = "";
2141
 
2142
  if(isset($atts['id']))
2143
- $wpgmza_current_map_id = $atts['id'];
2144
  else
2145
  $wpgmza_current_map_id = 1;
2146
 
@@ -2180,7 +2185,7 @@ function wpgmaps_tag_basic( $atts ) {
2180
 
2181
  }
2182
  if (isset($atts['zoom'])) {
2183
- $zoom_override = $atts['zoom'];
2184
  $wpgmza_override['zoom'] = $zoom_override;
2185
  }
2186
 
@@ -2204,9 +2209,9 @@ function wpgmaps_tag_basic( $atts ) {
2204
  $map_attributes = '';
2205
 
2206
  if(isset($atts['width']) && $atts['width'] != 'inherit')
2207
- $map_attributes .= "data-shortcode-width='{$atts["width"]}' ";
2208
  if(isset($atts['height']) && $atts['height'] != 'inherit')
2209
- $map_attributes .= "data-shortcode-height='{$atts["height"]}' ";
2210
 
2211
  // Using DOMDocument here to properly format the data-settings attribute
2212
  $document = new WPGMZA\DOMDocument();
@@ -2254,7 +2259,7 @@ function wpgmaps_tag_basic( $atts ) {
2254
 
2255
  if(!empty($atts['classname']))
2256
  {
2257
- $map_attributes .= " class='{$atts['classname']}'";
2258
  }
2259
 
2260
  if (!$map_align || $map_align == "" || $map_align == "1") { $map_align = "float:left;"; }
@@ -2484,6 +2489,8 @@ function wpgmza_check_if_marker_file_exists($mapid) {
2484
  * @return string HTML output for the store locator
2485
  */
2486
  function wpgmaps_sl_user_output_basic($map_id) {
 
 
2487
  $global_settings = get_option('WPGMZA_OTHER_SETTINGS');
2488
  $map_settings = wpgmza_get_map_data($map_id);
2489
 
@@ -2581,6 +2588,12 @@ function wpgmza_settings_page_post()
2581
  exit;
2582
  }
2583
 
 
 
 
 
 
 
2584
  if($wpgmza)
2585
  $wpgmza->gdprCompliance->onPOST();
2586
 
@@ -2634,22 +2647,22 @@ function wpgmza_settings_page_post()
2634
  }
2635
 
2636
  if(isset($_POST['tile_server_url']))
2637
- $wpgmza->settings['tile_server_url'] = $_POST['tile_server_url'];
2638
 
2639
  if(isset($_POST['wpgmza_load_engine_api_condition']))
2640
- $wpgmza->settings['wpgmza_load_engine_api_condition'] = $_POST['wpgmza_load_engine_api_condition'];
2641
 
2642
  if(isset($_POST['wpgmza_always_include_engine_api_on_pages']))
2643
- $wpgmza->settings['wpgmza_always_include_engine_api_on_pages'] = $_POST['wpgmza_always_include_engine_api_on_pages'];
2644
 
2645
  if(isset($_POST['wpgmza_always_exclude_engine_api_on_pages']))
2646
- $wpgmza->settings['wpgmza_always_exclude_engine_api_on_pages'] = $_POST['wpgmza_always_exclude_engine_api_on_pages'];
2647
 
2648
  if(isset($_POST['wpgmza_use_fontawesome']))
2649
- $wpgmza->settings['use_fontawesome'] = $_POST['wpgmza_use_fontawesome'];
2650
 
2651
  if(isset($_POST['wpgmza_maps_engine']))
2652
- $wpgmza->settings['wpgmza_maps_engine'] = $_POST['wpgmza_maps_engine'];
2653
 
2654
 
2655
  if (isset($_POST['wpgmza_settings_map_open_marker_by'])) { $wpgmza->settings['wpgmza_settings_map_open_marker_by'] = sanitize_text_field($_POST['wpgmza_settings_map_open_marker_by']); }
@@ -2662,7 +2675,10 @@ function wpgmza_settings_page_post()
2662
 
2663
  if (isset($_POST['wpgmza_marker_xml_location'])) { update_option("wpgmza_xml_location",sanitize_text_field($_POST['wpgmza_marker_xml_location'])); }
2664
  if (isset($_POST['wpgmza_marker_xml_url'])) { update_option("wpgmza_xml_url",sanitize_text_field($_POST['wpgmza_marker_xml_url'])); }
2665
- if (isset($_POST['wpgmza_access_level'])) { $wpgmza->settings['wpgmza_settings_access_level'] = sanitize_text_field($_POST['wpgmza_access_level']); }
 
 
 
2666
  if (isset($_POST['wpgmza_settings_marker_pull'])) { $wpgmza->settings['wpgmza_settings_marker_pull'] = sanitize_text_field($_POST['wpgmza_settings_marker_pull']); }
2667
 
2668
  // Maps -> Settings -> Store Locator -> option Store Locator Radius
@@ -2696,8 +2712,6 @@ function wpgmaps_head() {
2696
  global $wpgmza_tblname_maps;
2697
  global $wpgmza_version;
2698
 
2699
-
2700
-
2701
  if ((isset($_GET['page']) && $_GET['page'] == "wp-google-maps-menu") || (isset($_GET['page']) && $_GET['page'] == "wp-google-maps-menu-settings")) {
2702
  wpgmaps_folder_check();
2703
  }
@@ -2711,8 +2725,6 @@ function wpgmaps_head() {
2711
 
2712
  global $wpdb;
2713
 
2714
-
2715
-
2716
  $map_id = intval(sanitize_text_field($_POST['wpgmza_id']));
2717
  $map_title = sanitize_text_field(esc_attr($_POST['wpgmza_title']));
2718
  $map_height = sanitize_text_field($_POST['wpgmza_height']);
@@ -2762,11 +2774,6 @@ function wpgmaps_head() {
2762
 
2763
  $other_settings['map_max_zoom'] = sanitize_text_field($map_max_zoom);
2764
 
2765
- /* deprecated in 6.2.0
2766
- $other_settings['weather_layer'] = intval($_POST['wpgmza_weather']);
2767
- $other_settings['weather_layer_temp_type'] = intval($_POST['wpgmza_weather_temp_type']);
2768
- $other_settings['cloud_layer'] = intval($_POST['wpgmza_cloud']);
2769
- */
2770
  $other_settings['transport_layer'] = isset($_POST['wpgmza_transport']) ? 1 : 2;
2771
 
2772
 
@@ -3059,543 +3066,188 @@ function wpgmaps_head() {
3059
  wp_die( __( 'You do not have permission to perform this function', 'wp-google-maps' ) );
3060
  }
3061
 
3062
-
3063
- global $wpdb;
3064
- global $wpgmza_tblname_polylines;
3065
- $mid = sanitize_text_field($_POST['wpgmaps_map_id']);
3066
- $pid = sanitize_text_field($_POST['wpgmaps_poly_id']);
3067
- if (!isset($_POST['wpgmza_polyline']) || $_POST['wpgmza_polyline'] == "") {
3068
- echo "<div class='error'>";
3069
- _e("You cannot save a blank polyline","wp-google-maps");
3070
- echo "</div>";
3071
-
3072
- } else {
3073
- $wpgmaps_polydata = sanitize_text_field($_POST['wpgmza_polyline']);
3074
- if (isset($_POST['poly_name'])) { $polyname = sanitize_text_field($_POST['poly_name']); } else { $polyname = ""; }
3075
- if (isset($_POST['poly_line'])) { $linecolor = sanitize_text_field($_POST['poly_line']); } else { $linecolor = "000000"; }
3076
- if (isset($_POST['poly_thickness'])) { $linethickness = sanitize_text_field($_POST['poly_thickness']); } else { $linethickness = "0"; }
3077
- if (isset($_POST['poly_opacity'])) { $opacity = sanitize_text_field($_POST['poly_opacity']); } else { $opacity = "1"; }
3078
-
3079
- $rows_affected = $wpdb->query( $wpdb->prepare(
3080
- "UPDATE $wpgmza_tblname_polylines SET
3081
- polydata = %s,
3082
- polyname = %s,
3083
- linecolor = %s,
3084
- linethickness = %s,
3085
- opacity = %s
3086
- WHERE `id` = %d"
3087
- ,
3088
-
3089
- $wpgmaps_polydata,
3090
- $polyname,
3091
- $linecolor,
3092
- $linethickness,
3093
- $opacity,
3094
- $pid
3095
- )
3096
- );
3097
- echo "<div class='updated'>";
3098
- _e("Your polyline has been saved.","wp-google-maps");
3099
- echo "</div>";
3100
- }
3101
-
3102
-
3103
- }
3104
- else if (isset($_POST['wpgmza_save_circle'])){
3105
-
3106
- if ( !isset( $_POST['wpgmaps_circle-nonce'] ) || !wp_verify_nonce( $_POST['wpgmaps_circle-nonce'], 'wpgmaps_circle-nonce' ) ) {
3107
- wp_die( __( 'You do not have permission to perform this function', 'wp-google-maps' ) );
3108
- }
3109
-
3110
- global $wpdb;
3111
- global $wpgmza_tblname_circles;
3112
-
3113
- $center = preg_replace('/[(),]/', '', sanitize_text_field($_POST['center']));
3114
-
3115
- if(isset($_POST['circle_id']))
3116
- {
3117
- $stmt = $wpdb->prepare("
3118
- UPDATE $wpgmza_tblname_circles SET
3119
- center = {$wpgmza->spatialFunctionPrefix}GeomFromText(%s),
3120
- name = %s,
3121
- color = %s,
3122
- opacity = %f,
3123
- radius = %f
3124
- WHERE id = %d
3125
- ", array(
3126
- "POINT($center)",
3127
- sanitize_text_field($_POST['circle_name']),
3128
- sanitize_hex_color($_POST['circle_color']),
3129
- floatval($_POST['circle_opacity']),
3130
- intval($_POST['circle_radius']),
3131
- intval($_POST['circle_id'])
3132
- ));
3133
- }
3134
- else
3135
- {
3136
- $stmt = $wpdb->prepare("
3137
- INSERT INTO $wpgmza_tblname_circles
3138
- (center, map_id, name, color, opacity, radius)
3139
- VALUES
3140
- ({$wpgmza->spatialFunctionPrefix}GeomFromText(%s), %d, %s, %s, %f, %f)
3141
- ", array(
3142
- "POINT($center)",
3143
- intval($_POST['wpgmaps_map_id']),
3144
- sanitize_text_field($_POST['circle_name']),
3145
- sanitize_hex_color($_POST['circle_color']),
3146
- intval($_POST['circle_opacity']),
3147
- intval($_POST['circle_radius'])
3148
- ));
3149
- }
3150
-
3151
- $wpdb->query($stmt);
3152
-
3153
- ?>
3154
- <script type='text/javascript'>
3155
-
3156
- jQuery(function($) {
3157
- window.location.reload();
3158
- });
3159
-
3160
- </script>
3161
- <?php
3162
-
3163
- }
3164
- else if (isset($_POST['wpgmza_save_rectangle'])){
3165
-
3166
- if ( !isset( $_POST['wpgmaps_rectangle-nonce'] ) || !wp_verify_nonce( $_POST['wpgmaps_rectangle-nonce'], 'wpgmaps_rectangle-nonce' ) ) {
3167
- wp_die( __( 'You do not have permission to perform this function', 'wp-google-maps' ) );
3168
- }
3169
-
3170
- global $wpdb;
3171
- global $wpgmza_tblname_rectangles;
3172
-
3173
- $m = null;
3174
- preg_match_all('/-?\d+(\.\d+)?/', sanitize_text_field($_POST['bounds']), $m);
3175
-
3176
- $north = $m[0][0];
3177
- $east = $m[0][1];
3178
- $south = $m[0][2];
3179
- $west = $m[0][3];
3180
-
3181
- $cornerA = "POINT($north $east)";
3182
- $cornerB = "POINT($south $west)";
3183
-
3184
- if(isset($_POST['rectangle_id']))
3185
- {
3186
- $stmt = $wpdb->prepare("
3187
- UPDATE $wpgmza_tblname_rectangles SET
3188
- name = %s,
3189
- color = %s,
3190
- opacity = %f,
3191
- cornerA = {$wpgmza->spatialFunctionPrefix}GeomFromText(%s),
3192
- cornerB = {$wpgmza->spatialFunctionPrefix}GeomFromText(%s)
3193
- WHERE id = %d
3194
- ", array(
3195
- sanitize_text_field($_POST['rectangle_name']),
3196
- sanitize_hex_color($_POST['rectangle_color']),
3197
- floatval($_POST['rectangle_opacity']),
3198
- $cornerA,
3199
- $cornerB,
3200
- intval($_POST['rectangle_id'])
3201
- ));
3202
- }
3203
- else
3204
- {
3205
- $stmt = $wpdb->prepare("
3206
- INSERT INTO $wpgmza_tblname_rectangles
3207
- (map_id, name, color, opacity, cornerA, cornerB)
3208
- VALUES
3209
- (%d, %s, %s, %f, {$wpgmza->spatialFunctionPrefix}GeomFromText(%s), {$wpgmza->spatialFunctionPrefix}GeomFromText(%s))
3210
- ", array(
3211
- intval($_POST['wpgmaps_map_id']),
3212
- sanitize_text_field($_POST['rectangle_name']),
3213
- sanitize_hex_color($_POST['rectangle_color']),
3214
- floatval($_POST['rectangle_opacity']),
3215
- $cornerA,
3216
- $cornerB
3217
- ));
3218
- }
3219
-
3220
- $rows = $wpdb->query($stmt);
3221
-
3222
- ?>
3223
- <script type='text/javascript'>
3224
-
3225
- jQuery(function($) {
3226
- window.location.reload();
3227
- });
3228
-
3229
- </script>
3230
- <?php
3231
- }
3232
- else if (isset($_POST['wpgmza_save_settings']) && current_user_can('administrator')){
3233
-
3234
-
3235
-
3236
- }
3237
-
3238
-
3239
-
3240
-
3241
-
3242
-
3243
- }
3244
-
3245
- /**
3246
- * POST handling for version 5.24 or less
3247
- * @return void
3248
- */
3249
- function wpgmaps_head_old() {
3250
-
3251
- // SECURITY TODO: Secure with nonce
3252
-
3253
- if (!current_user_can('administrator')) {
3254
- return false;
3255
- }
3256
-
3257
- global $wpgmza_tblname_maps;
3258
- if (isset($_POST['wpgmza_savemap'])){
3259
- global $wpdb;
3260
-
3261
-
3262
- $map_id = sanitize_text_field($_POST['wpgmza_id']);
3263
- $map_title = sanitize_text_field($_POST['wpgmza_title']);
3264
- $map_height = sanitize_text_field($_POST['wpgmza_height']);
3265
- $map_width = sanitize_text_field($_POST['wpgmza_width']);
3266
-
3267
-
3268
- $map_width_type = sanitize_text_field($_POST['wpgmza_map_width_type']);
3269
- if ($map_width_type == "%") { $map_width_type = "\%"; }
3270
- $map_height_type = sanitize_text_field($_POST['wpgmza_map_height_type']);
3271
- if ($map_height_type == "%") { $map_height_type = "\%"; }
3272
- $map_start_location = sanitize_text_field($_POST['wpgmza_start_location']);
3273
- $map_start_zoom = intval($_POST['wpgmza_start_zoom']);
3274
- $type = intval($_POST['wpgmza_map_type']);
3275
- $alignment = intval($_POST['wpgmza_map_align']);
3276
- $order_markers_by = intval($_POST['wpgmza_order_markers_by']);
3277
- $order_markers_choice = intval($_POST['wpgmza_order_markers_choice']);
3278
- $show_user_location = intval($_POST['wpgmza_show_user_location']);
3279
- $directions_enabled = intval($_POST['wpgmza_directions']);
3280
- $bicycle_enabled = intval($_POST['wpgmza_bicycle']);
3281
- $traffic_enabled = intval($_POST['wpgmza_traffic']);
3282
- $dbox = intval($_POST['wpgmza_dbox']);
3283
- $dbox_width = sanitize_text_field($_POST['wpgmza_dbox_width']);
3284
- $default_to = sanitize_text_field($_POST['wpgmza_default_to']);
3285
- $listmarkers = intval($_POST['wpgmza_listmarkers']);
3286
- $listmarkers_advanced = intval($_POST['wpgmza_listmarkers_advanced']);
3287
- $filterbycat = intval($_POST['wpgmza_filterbycat']);
3288
-
3289
-
3290
- $gps = explode(",",$map_start_location);
3291
- $map_start_lat = $gps[0];
3292
- $map_start_lng = $gps[1];
3293
- $map_default_marker = sanitize_text_field($_POST['upload_default_marker']);
3294
- $kml = sanitize_text_field($_POST['wpgmza_kml']);
3295
- $fusion = sanitize_text_field($_POST['wpgmza_fusion']);
3296
-
3297
- $data['map_default_starting_lat'] = $map_start_lat;
3298
- $data['map_default_starting_lng'] = $map_start_lng;
3299
- $data['map_default_height'] = $map_height;
3300
- $data['map_default_width'] = $map_width;
3301
- $data['map_default_zoom'] = $map_start_zoom;
3302
- $data['map_default_type'] = $type;
3303
- $data['map_default_alignment'] = $alignment;
3304
- $data['map_default_order_markers_by'] = $order_markers_by;
3305
- $data['map_default_order_markers_choice'] = $order_markers_choice;
3306
- $data['map_default_show_user_location'] = $show_user_location;
3307
- $data['map_default_directions'] = $directions_enabled;
3308
- $data['map_default_bicycle'] = $bicycle_enabled;
3309
- $data['map_default_traffic'] = $traffic_enabled;
3310
- $data['map_default_dbox'] = $dbox;
3311
- $data['map_default_dbox_width'] = $dbox_width;
3312
- $data['map_default_default_to'] = $default_to;
3313
- $data['map_default_listmarkers'] = $listmarkers;
3314
- $data['map_default_listmarkers_advanced'] = $listmarkers_advanced;
3315
- $data['map_default_filterbycat'] = $filterbycat;
3316
- $data['map_default_marker'] = $map_default_marker;
3317
- $data['map_default_width_type'] = $map_width_type;
3318
- $data['map_default_height_type'] = $map_height_type;
3319
-
3320
-
3321
-
3322
-
3323
-
3324
- $rows_affected = $wpdb->query( $wpdb->prepare(
3325
- "UPDATE $wpgmza_tblname_maps SET
3326
- map_title = %s,
3327
- map_width = %s,
3328
- map_height = %s,
3329
- map_start_lat = %f,
3330
- map_start_lng = %f,
3331
- map_start_location = %s,
3332
- map_start_zoom = %d,
3333
- default_marker = %s,
3334
- type = %d,
3335
- alignment = %d,
3336
- order_markers_by = %d,
3337
- order_markers_choice = %d,
3338
- show_user_location = %d,
3339
- directions_enabled = %d,
3340
- kml = %s,
3341
- bicycle = %d,
3342
- traffic = %d,
3343
- dbox = %d,
3344
- dbox_width = %s,
3345
- default_to = %s,
3346
- listmarkers = %d,
3347
- listmarkers_advanced = %d,
3348
- filterbycat = %d,
3349
- fusion = %s,
3350
- map_width_type = %s,
3351
- map_height_type = %s
3352
- WHERE id = %d",
3353
-
3354
- $map_title,
3355
- $map_width,
3356
- $map_height,
3357
- $map_start_lat,
3358
- $map_start_lng,
3359
- $map_start_location,
3360
- $map_start_zoom,
3361
- $map_default_marker,
3362
- $type,
3363
- $alignment,
3364
- $order_markers_by,
3365
- $order_markers_choice,
3366
- $show_user_location,
3367
- $directions_enabled,
3368
- $kml,
3369
- $bicycle_enabled,
3370
- $traffic_enabled,
3371
- $dbox,
3372
- $dbox_width,
3373
- $default_to,
3374
- $listmarkers,
3375
- $listmarkers_advanced,
3376
- $filterbycat,
3377
- $fusion,
3378
- $map_width_type,
3379
- $map_height_type,
3380
- $map_id)
3381
- );
3382
-
3383
-
3384
-
3385
- update_option('WPGMZA_SETTINGS', $data);
3386
-
3387
-
3388
- echo "<div class='updated'>";
3389
- _e("Your settings have been saved.","wp-google-maps");
3390
- echo "</div>";
3391
-
3392
- }
3393
-
3394
- else if (isset($_POST['wpgmza_save_maker_location'])){
3395
- global $wpdb;
3396
- global $wpgmza_tblname;
3397
- $mid = sanitize_text_field($_POST['wpgmaps_marker_id']);
3398
- $wpgmaps_marker_lat = sanitize_text_field($_POST['wpgmaps_marker_lat']);
3399
- $wpgmaps_marker_lng = sanitize_text_field($_POST['wpgmaps_marker_lng']);
3400
-
3401
- $rows_affected = $wpdb->query( $wpdb->prepare(
3402
- "UPDATE $wpgmza_tblname SET
3403
- lat = %s,
3404
- lng = %s,
3405
- latlng = {$wpgmza->spatialFunctionPrefix}GeomFromText('POINT(%f %f)')
3406
- WHERE id = %d",
3407
-
3408
- $wpgmaps_marker_lat,
3409
- $wpgmaps_marker_lng,
3410
- $wpgmaps_marker_lat,
3411
- $wpgmaps_marker_lng,
3412
- $mid)
3413
- );
3414
-
3415
-
3416
-
3417
-
3418
-
3419
- echo "<div class='updated'>";
3420
- _e("Your marker location has been saved.","wp-google-maps");
3421
- echo "</div>";
3422
-
3423
-
3424
- }
3425
- else if (isset($_POST['wpgmza_save_poly'])){
3426
- global $wpdb;
3427
- global $wpgmza_tblname_poly;
3428
- $mid = sanitize_text_field($_POST['wpgmaps_map_id']);
3429
- $wpgmaps_polydata = sanitize_text_field($_POST['wpgmza_polygon']);
3430
- $wpgmaps_polydatainner = sanitize_text_field($_POST['wpgmza_polygon_inner']);
3431
- $linecolor = sanitize_text_field($_POST['poly_line']);
3432
- $fillcolor = sanitize_text_field($_POST['poly_fill']);
3433
- $opacity = sanitize_text_field($_POST['poly_opacity']);
3434
-
3435
- $rows_affected = $wpdb->query( $wpdb->prepare(
3436
- "INSERT INTO $wpgmza_tblname_poly SET
3437
- map_id = %d,
3438
- polydata = %s,
3439
- innerpolydata = %s,
3440
- linecolor = %s,
3441
- fillcolor = %s,
3442
- opacity = %s
3443
- ",
3444
-
3445
- $mid,
3446
- $wpgmaps_polydata,
3447
- $wpgmaps_polydatainner,
3448
- $linecolor,
3449
- $fillcolor,
3450
- $opacity
3451
- )
3452
- );
3453
- echo "<div class='updated'>";
3454
- _e("Your polygon has been created.","wp-google-maps");
3455
- echo "</div>";
3456
-
3457
-
3458
- }
3459
- else if (isset($_POST['wpgmza_edit_poly'])){
3460
-
3461
- global $wpdb;
3462
- global $wpgmza_tblname_poly;
3463
- $mid = sanitize_text_field($_POST['wpgmaps_map_id']);
3464
- $pid = sanitize_text_field($_POST['wpgmaps_poly_id']);
3465
- $wpgmaps_polydata = sanitize_text_field($_POST['wpgmza_polygon']);
3466
- $wpgmaps_polydatainner = sanitize_text_field($_POST['wpgmza_polygon_inner']);
3467
- $linecolor = sanitize_text_field($_POST['poly_line']);
3468
- $fillcolor = sanitize_text_field($_POST['poly_fill']);
3469
- $opacity = sanitize_text_field($_POST['poly_opacity']);
3470
-
3471
- $rows_affected = $wpdb->query( $wpdb->prepare(
3472
- "UPDATE $wpgmza_tblname_poly SET
3473
- polydata = %s,
3474
- innerpolydata = %s,
3475
- linecolor = %s,
3476
- fillcolor = %s,
3477
- opacity = %s
3478
- WHERE `id` = %d"
3479
- ,
3480
-
3481
- $wpgmaps_polydata,
3482
- $wpgmaps_polydatainner,
3483
- $linecolor,
3484
- $fillcolor,
3485
- $opacity,
3486
- $pid
3487
- )
3488
- );
3489
- echo "<div class='updated'>";
3490
- _e("Your polygon has been saved.","wp-google-maps");
3491
- echo "</div>";
3492
-
3493
-
3494
- }
3495
- else if (isset($_POST['wpgmza_save_polyline'])){
3496
- global $wpdb;
3497
- global $wpgmza_tblname_polylines;
3498
- $mid = sanitize_text_field($_POST['wpgmaps_map_id']);
3499
- $wpgmaps_polydata = sanitize_text_field($_POST['wpgmza_polyline']);
3500
- $linecolor = sanitize_text_field($_POST['poly_line']);
3501
- $linethickness = sanitize_text_field($_POST['poly_thickness']);
3502
- $opacity = sanitize_text_field($_POST['poly_opacity']);
3503
-
3504
- $rows_affected = $wpdb->query( $wpdb->prepare(
3505
- "INSERT INTO $wpgmza_tblname_polylines SET
3506
- map_id = %d,
3507
- polydata = %s,
3508
- linecolor = %s,
3509
- linethickness = %s,
3510
- opacity = %s
3511
- ",
3512
-
3513
- $mid,
3514
- $wpgmaps_polydata,
3515
- $linecolor,
3516
- $linethickness,
3517
- $opacity
3518
- )
3519
- );
3520
- echo "<div class='updated'>";
3521
- _e("Your polyline has been created.","wp-google-maps");
3522
- echo "</div>";
3523
-
3524
-
3525
- }
3526
- else if (isset($_POST['wpgmza_edit_polyline'])){
3527
  global $wpdb;
3528
  global $wpgmza_tblname_polylines;
3529
  $mid = sanitize_text_field($_POST['wpgmaps_map_id']);
3530
  $pid = sanitize_text_field($_POST['wpgmaps_poly_id']);
3531
- $wpgmaps_polydata = sanitize_text_field($_POST['wpgmza_polyline']);
3532
- $linecolor = sanitize_text_field($_POST['poly_line']);
3533
- $linethickness = sanitize_text_field($_POST['poly_thickness']);
3534
- $opacity = sanitize_text_field($_POST['poly_opacity']);
 
 
 
 
 
 
 
3535
 
3536
- $rows_affected = $wpdb->query( $wpdb->prepare(
3537
- "UPDATE $wpgmza_tblname_polylines SET
3538
- polydata = %s,
3539
- linecolor = %s,
3540
- linethickness = %s,
3541
- opacity = %s
3542
- WHERE `id` = %d"
3543
- ,
3544
-
3545
- $wpgmaps_polydata,
3546
- $linecolor,
3547
- $linethickness,
3548
- $opacity,
3549
- $pid
3550
- )
3551
- );
3552
- echo "<div class='updated'>";
3553
- _e("Your polyline has been saved.","wp-google-maps");
3554
- echo "</div>";
 
 
 
3555
 
3556
 
3557
  }
3558
- else if (isset($_POST['wpgmza_save_settings'])){
3559
- global $wpdb;
3560
- $wpgmza_data['wpgmza_settings_image_width'] = sanitize_text_field($_POST['wpgmza_settings_image_width']);
3561
- $wpgmza_data['wpgmza_settings_image_height'] = sanitize_text_field($_POST['wpgmza_settings_image_height']);
3562
- $wpgmza_data['wpgmza_settings_use_timthumb'] = sanitize_text_field($_POST['wpgmza_settings_use_timthumb']);
3563
- $wpgmza_data['wpgmza_settings_infowindow_width'] = sanitize_text_field($_POST['wpgmza_settings_infowindow_width']);
3564
- $wpgmza_data['wpgmza_settings_infowindow_links'] = sanitize_text_field($_POST['wpgmza_settings_infowindow_links']);
3565
- $wpgmza_data['wpgmza_settings_infowindow_address'] = sanitize_text_field($_POST['wpgmza_settings_infowindow_address']);
3566
- $wpgmza_data['wpgmza_settings_infowindow_link_text'] = sanitize_text_field($_POST['wpgmza_settings_infowindow_link_text']);
3567
- $wpgmza_data['wpgmza_settings_map_streetview'] = sanitize_text_field($_POST['wpgmza_settings_map_streetview']);
3568
- $wpgmza_data['wpgmza_settings_map_full_screen_control'] = sanitize_text_field($_POST['wpgmza_settings_map_full_screen_control']);
3569
- $wpgmza_data['wpgmza_settings_map_zoom'] = sanitize_text_field($_POST['wpgmza_settings_map_zoom']);
3570
- $wpgmza_data['wpgmza_settings_map_pan'] = sanitize_text_field($_POST['wpgmza_settings_map_pan']);
3571
- $wpgmza_data['wpgmza_settings_map_type'] = sanitize_text_field($_POST['wpgmza_settings_map_type']);
3572
- $wpgmza_data['wpgmza_settings_map_scroll'] = sanitize_text_field($_POST['wpgmza_settings_map_scroll']);
3573
- $wpgmza_data['wpgmza_settings_map_draggable'] = sanitize_text_field($_POST['wpgmza_settings_map_draggable']);
3574
- $wpgmza_data['wpgmza_settings_map_clickzoom'] = sanitize_text_field($_POST['wpgmza_settings_map_clickzoom']);
3575
- $wpgmza_data['wpgmza_settings_ugm_striptags'] = sanitize_text_field($_POST['wpgmza_settings_map_striptags']);
3576
- $wpgmza_data['wpgmza_settings_force_jquery'] = sanitize_text_field($_POST['wpgmza_settings_force_jquery']);
3577
- $wpgmza_data['wpgmza_settings_markerlist_category'] = sanitize_text_field($_POST['wpgmza_settings_markerlist_category']);
3578
- $wpgmza_data['wpgmza_settings_markerlist_icon'] = sanitize_text_field($_POST['wpgmza_settings_markerlist_icon']);
3579
- $wpgmza_data['wpgmza_settings_markerlist_link'] = sanitize_text_field($_POST['wpgmza_settings_markerlist_link']);
3580
- $wpgmza_data['wpgmza_settings_markerlist_title'] = sanitize_text_field($_POST['wpgmza_settings_markerlist_title']);
3581
- $wpgmza_data['wpgmza_settings_markerlist_address'] = sanitize_text_field($_POST['wpgmza_settings_markerlist_address']);
3582
- $wpgmza_data['wpgmza_settings_markerlist_description'] = sanitize_text_field($_POST['wpgmza_settings_markerlist_description']);
3583
- update_option('WPGMZA_OTHER_SETTINGS', $wpgmza_data);
3584
- echo "<div class='updated'>";
3585
- _e("Your settings have been saved.","wp-google-maps");
3586
- echo "</div>";
3587
 
 
 
 
3588
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3589
  }
 
3590
 
 
 
 
3591
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3592
 
3593
- }
3594
 
 
 
3595
 
 
3596
 
3597
 
3598
 
 
3599
 
3600
  function wpgmaps_admin_menu() {
3601
  $wpgmza_settings = get_option("WPGMZA_OTHER_SETTINGS");
@@ -3635,10 +3287,12 @@ function wpgmaps_admin_menu() {
3635
 
3636
  function wpgmaps_menu_layout() {
3637
 
3638
-
3639
-
 
3640
  $handle = 'avia-google-maps-api';
3641
  $list = 'enqueued';
 
3642
  if (wp_script_is( $handle, $list )) {
3643
  wp_deregister_script('avia-google-maps-api');
3644
  }
@@ -3651,22 +3305,40 @@ function wpgmaps_menu_layout() {
3651
  if ($_GET['action'] == "welcome_page" || $_GET['action'] == "credits") { } else {
3652
  echo"<br /><div class='wpgmza-support-notice' style='float:right; display:block; width:250px; height:65px; padding:6px; text-align:center; background-color: white; border-top: 4px solid #0073AA; margin-right:17px;'><strong>".__("Experiencing problems with the plugin?","wp-google-maps")."</strong><br /><a href='http://www.wpgmaps.com/documentation/troubleshooting/' title='WP Google Maps Troubleshooting Section' target='_BLANK'>".__("See the troubleshooting manual.","wp-google-maps")."</a> <br />".__("Or ask a question on our ","wp-google-maps")." <a href='http://www.wpgmaps.com/forums/forum/support-forum/' title='WP Google Maps Support Forum' target='_BLANK'>".__("Support forum.","wp-google-maps")."</a></div>";
3653
  }
3654
- if ($_GET['action'] == "trash" && isset($_GET['map_id'])) {
 
3655
  if (isset( $_GET['s'] ) && $_GET['s'] == "1") {
3656
- if (wpgmaps_trash_map(sanitize_text_field($_GET['map_id']))) {
 
 
 
 
 
 
 
3657
  echo "<script>window.location = \"".get_option('siteurl')."/wp-admin/admin.php?page=wp-google-maps-menu\"</script>";
3658
  } else {
3659
  _e("There was a problem deleting the map.","wp-google-maps");
3660
  }
 
3661
  } else {
3662
- $res = wpgmza_get_map_data(sanitize_text_field($_GET['map_id']));
3663
- echo "<h2>".__("Delete your map","wp-google-maps")."</h2><p>".__("Are you sure you want to delete the map","wp-google-maps")." <strong>\"".$res->map_title."?\"</strong> <br /><a href='?page=wp-google-maps-menu&action=trash&map_id=".sanitize_text_field($_GET['map_id'])."&s=1'>".__("Yes","wp-google-maps")."</a> | <a href='?page=wp-google-maps-menu'>".__("No","wp-google-maps")."</a></p>";
3664
  return;
3665
  }
3666
  }
3667
- if (isset($_GET['action']) && $_GET['action'] == "duplicate" && isset($_GET['map_id'])) {
3668
- if (function_exists('wpgmaps_duplicate_map')) {
3669
- $new_id = wpgmaps_duplicate_map(sanitize_text_field($_GET['map_id']));
 
 
 
 
 
 
 
 
 
3670
  if ($new_id > 0) {
3671
  wpgmza_map_page();
3672
  } else {
@@ -3681,51 +3353,51 @@ function wpgmaps_menu_layout() {
3681
  wpgmza_edit_marker(sanitize_text_field($_GET['id']));
3682
 
3683
  }
3684
- else if ($_GET['action'] == "add_poly" && isset($_GET['map_id'])) {
3685
 
3686
  if (function_exists("wpgmza_b_real_pro_add_poly")) {
3687
- wpgmza_b_real_pro_add_poly(sanitize_text_field($_GET['map_id']));
3688
  } else {
3689
- wpgmza_b_pro_add_poly(sanitize_text_field($_GET['map_id']));
3690
  }
3691
 
3692
  }
3693
- else if ($_GET['action'] == "edit_poly" && isset($_GET['map_id'])) {
3694
 
3695
  if (function_exists("wpgmza_b_real_pro_edit_poly")) {
3696
- wpgmza_b_real_pro_edit_poly(sanitize_text_field($_GET['map_id']));
3697
  } else {
3698
- wpgmza_b_pro_edit_poly(sanitize_text_field($_GET['map_id']));
3699
  }
3700
 
3701
 
3702
  }
3703
- else if ($_GET['action'] == "add_polyline" && isset($_GET['map_id'])) {
3704
 
3705
- wpgmza_b_pro_add_polyline(sanitize_text_field($_GET['map_id']));
3706
 
3707
  }
3708
- else if ($_GET['action'] == "edit_polyline" && isset($_GET['map_id'])) {
3709
 
3710
- wpgmza_b_pro_edit_polyline(sanitize_text_field($_GET['map_id']));
3711
  }
3712
- else if ($_GET['action'] == "add_heatmap" && isset($_GET['map_id'])) {
3713
- if (function_exists("wpgmza_b_pro_add_heatmap")) { wpgmza_b_pro_add_heatmap(sanitize_text_field($_GET['map_id'])); }
3714
  }
3715
- else if ($_GET['action'] == "edit_heatmap" && isset($_GET['map_id'])) {
3716
- if (function_exists("wpgmza_b_pro_edit_heatmap")) { wpgmza_b_pro_edit_heatmap(sanitize_text_field($_GET['map_id'])); }
3717
  }
3718
- else if ($_GET['action'] == "add_circle" && isset($_GET['map_id'])) {
3719
- wpgmza_b_add_circle(sanitize_text_field($_GET['map_id']));
3720
  }
3721
- else if ($_GET['action'] == "edit_circle" && isset($_GET['map_id'])) {
3722
- wpgmza_b_edit_circle(sanitize_text_field($_GET['map_id']));
3723
  }
3724
- else if ($_GET['action'] == "add_rectangle" && isset($_GET['map_id'])) {
3725
- wpgmza_b_add_rectangle(sanitize_text_field($_GET['map_id']));
3726
  }
3727
- else if ($_GET['action'] == "edit_rectangle" && isset($_GET['map_id'])) {
3728
- wpgmza_b_edit_rectangle(sanitize_text_field($_GET['map_id']));
3729
  }
3730
  else if ($_GET['action'] == 'welcome_page') {
3731
  $file = dirname(__FILE__).'/base/classes/WPGM_templates.php';
@@ -3784,14 +3456,14 @@ function wpgmaps_menu_marker_layout() {
3784
  if ($_GET['action'] == "trash" && isset($_GET['marker_id'])) {
3785
 
3786
  if ($_GET['s'] == "1") {
3787
- if (wpgmaps_trash_marker(sanitize_text_field($_GET['marker_id']))) {
3788
  echo "<script>window.location = \"".get_option('siteurl')."/wp-admin/admin.php?page=wp-google-maps-marker-menu\"</script>";
3789
  } else {
3790
  _e("There was a problem deleting the marker.");;
3791
  }
3792
  } else {
3793
- $res = wpgmza_get_marker_data(sanitize_text_field($_GET['map_id']));
3794
- echo "<h2>".__("Delete Marker","wp-google-maps")."</h2><p>".__("Are you sure you want to delete this marker:","wp-google-maps")." <strong>\"".$res->address."?\"</strong> <br /><a href='?page=wp-google-maps-marker-menu&action=trash&marker_id=".sanitize_text_field($_GET['marker_id'])."&s=1'>".__("Yes","wp-google-maps")."</a> | <a href='?page=wp-google-maps-marker-menu'>".__("No","wp-google-maps")."</a></p>";
3795
  }
3796
 
3797
 
@@ -4602,14 +4274,13 @@ function wpgmaps_check_versions() {
4602
 
4603
  function wpgmza_basic_menu() {
4604
 
4605
-
4606
  global $wpgmza_tblname_maps;
4607
  global $wpdb;
4608
- /* deprecated
4609
- * if (!wpgmaps_check_permissions()) { wpgmaps_permission_warning(); }
4610
- */
4611
- if ($_GET['action'] == "edit" && isset($_GET['map_id'])) {
4612
- $res = wpgmza_get_map_data(sanitize_text_field($_GET['map_id']));
4613
  if (function_exists("wpgmaps_marker_permission_check")) { wpgmaps_marker_permission_check(); }
4614
 
4615
 
@@ -4790,7 +4461,7 @@ function wpgmza_basic_menu() {
4790
 
4791
  // Admin marker table
4792
  $ajaxParameters = array(
4793
- 'map_id' => $_GET['map_id']
4794
  );
4795
 
4796
  $adminMarkerTable = WPGMZA\AdminMarkerDataTable::createInstance($ajaxParameters);
@@ -5668,29 +5339,29 @@ function wpgmza_basic_menu() {
5668
 
5669
  <div id=\"tabs-m-3\" class='wpgmza-open-layers-feature-coming-soon'>
5670
  <h2 style=\"padding-top:0; margin-top:0;\"> ".__("Polygons","wp-google-maps")."</h2>
5671
- <span id=\"wpgmza_addpolygon_div\"><a href='".get_option('siteurl')."/wp-admin/admin.php?page=wp-google-maps-menu&action=add_poly&map_id=".sanitize_text_field($_GET['map_id'])."' id='wpgmza_addpoly' class='button-primary' value='".__("Add a New Polygon","wp-google-maps")."' />".__("Add a New Polygon","wp-google-maps")."</a></span>
5672
- <div id=\"wpgmza_poly_holder\">".wpgmza_b_return_polygon_list(sanitize_text_field($_GET['map_id']))."</div>
5673
  </div>
5674
  <div id=\"tabs-m-4\" class='wpgmza-open-layers-feature-coming-soon'>
5675
  <h2 style=\"padding-top:0; margin-top:0;\"> ".__("Polylines","wp-google-maps")."</h2>
5676
- <span id=\"wpgmza_addpolyline_div\"><a href='".get_option('siteurl')."/wp-admin/admin.php?page=wp-google-maps-menu&action=add_polyline&map_id=".sanitize_text_field($_GET['map_id'])."' id='wpgmza_addpolyline' class='button-primary' value='".__("Add a New Polyline","wp-google-maps")."' />".__("Add a New Polyline","wp-google-maps")."</a></span>
5677
- <div id=\"wpgmza_polyline_holder\">".wpgmza_b_return_polyline_list(sanitize_text_field($_GET['map_id']))."</div>
5678
  </div>
5679
 
5680
  <div id=\"tabs-circles\" class='wpgmza-open-layers-feature-coming-soon'>
5681
  <h2>
5682
  " . __('Add a Circle', 'wp-google-maps') . "
5683
  </h2>
5684
- <span><a class=\"button-primary\" href=\"" . get_option('siteurl') . "/wp-admin/admin.php?page=wp-google-maps-menu&action=add_circle&map_id=" . $_GET['map_id'] . "\">" . __("Add a Circle", "wp-google-maps") . "</a></span>
5685
- " . wpgmza_get_circles_table($_GET['map_id']) . "
5686
  </div>
5687
 
5688
  <div id=\"tabs-rectangles\" class='wpgmza-open-layers-feature-coming-soon'>
5689
  <h2>
5690
  " . __('Add a Rectangle', 'wp-google-maps') . "
5691
  </h2>
5692
- <span><a class=\"button-primary\" href=\"" . get_option('siteurl') . "/wp-admin/admin.php?page=wp-google-maps-menu&action=add_rectangle&map_id=" . $_GET['map_id'] . "\">" . __("Add a Rectangle", "wp-google-maps") . "</a></span>
5693
- " . wpgmza_get_rectangles_table($_GET['map_id']) . "
5694
  </div>
5695
 
5696
  <div id=\"tabs-m-5\" class='wpgmza-open-layers-feature-coming-soon'>
@@ -6999,167 +6670,6 @@ function wpgm_pro_link($link) {
6999
  }
7000
  }
7001
 
7002
- function wpgmza_track_usage( $map_id ){
7003
-
7004
- global $wpdb;
7005
- global $wpgmza_tblname_maps;
7006
-
7007
- $wpgmza_data = array();
7008
-
7009
- $wpgmza_settings = get_option('WPGMZA_OTHER_SETTINGS');
7010
-
7011
- if( isset( $wpgmza_settings['wpgmza_settings_enable_usage_tracking'] ) && $wpgmza_settings['wpgmza_settings_enable_usage_tracking'] == 'yes' ){
7012
-
7013
- $map_data = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpgmza_tblname_maps WHERE `id` = %d LIMIT 1" , intval( $map_id ) ), ARRAY_A );
7014
-
7015
- if( isset( $map_data->other_settings ) && $map_data->other_settings == '' ){
7016
-
7017
- /* New map - no changes have been made to it */
7018
-
7019
- } else {
7020
-
7021
- $wpgmza_data['map_data'] = maybe_serialize( $map_data );
7022
-
7023
- /**
7024
- * Quantity of maps
7025
- */
7026
- $qty_maps = $wpdb->get_row( "SELECT COUNT(*) as `map_count` FROM ".$wpdb->prefix."wpgmza_maps" );
7027
- $wpgmza_total_maps = isset( $qty_maps->map_count ) ? $qty_maps->map_count : 'error';
7028
-
7029
- $wpgmza_data['map_data_total_maps'] = $wpgmza_total_maps;
7030
-
7031
- /**
7032
- * Quantity of markers
7033
- */
7034
- $qty_markers = $wpdb->get_row( "SELECT COUNT(*) as `marker_count` FROM ".$wpdb->prefix."wpgmza" );
7035
- $wpgmza_total_markers = isset( $qty_markers->marker_count ) ? $qty_markers->marker_count : 'error';
7036
-
7037
- $wpgmza_data['map_data_total_markers'] = $wpgmza_total_markers;
7038
-
7039
- /**
7040
- * WP Version
7041
- */
7042
- $wpgmza_wp_version = get_bloginfo( "version" );
7043
-
7044
- $wpgmza_data['wp_version'] = $wpgmza_wp_version;
7045
-
7046
- /**
7047
- * Basic & Pro Current versions
7048
- */
7049
- global $wpgmza_version;
7050
- global $wpgmza_pro_version;
7051
-
7052
- $wpgmza_data['basic_version_number'] = $wpgmza_version;
7053
- $wpgmza_data['pro_version_number'] = $wpgmza_pro_version;
7054
-
7055
- /**
7056
- * Global settings
7057
- */
7058
-
7059
- $wpgmza_data['global_settings'] = maybe_serialize( $wpgmza_settings );
7060
-
7061
- /**
7062
- * Other settings for map
7063
- */
7064
-
7065
- if( isset( $map_data['other_settings'] ) ){
7066
-
7067
- if( $map_data['other_settings'] != '' ){
7068
-
7069
- $other_data = maybe_unserialize( $map_data['other_settings'] );
7070
-
7071
- if( $other_data ){
7072
-
7073
- $wpgmza_data['other_map_data'] = maybe_serialize( $other_data );
7074
-
7075
- }
7076
-
7077
- }
7078
-
7079
- }
7080
-
7081
- /**
7082
- * Current theme active
7083
- */
7084
- $current_theme = wp_get_theme();
7085
- if( $current_theme ){
7086
-
7087
- $wpgmza_data['current_theme_name'] = $current_theme->get('Name');
7088
- $wpgmza_data['current_theme_version'] = $current_theme->get('Version');
7089
-
7090
- } else {
7091
-
7092
- $wpgmza_data['current_theme_name'] = 'unknown';
7093
- $wpgmza_data['current_theme_version'] = 'unknown';
7094
-
7095
- }
7096
-
7097
- /**
7098
- * Current PHP Version
7099
- */
7100
- if( function_exists( 'phpversion' ) ){
7101
- $wpgmza_php_version = phpversion();
7102
- } else {
7103
- $wpgmza_php_version = 'unknown';
7104
- }
7105
-
7106
- $wpgmza_data['php_version'] = $wpgmza_php_version;
7107
-
7108
- /**
7109
- * Current memory allocated to WP
7110
- */
7111
- if( defined( 'WP_MEMORY_LIMIT' ) ){
7112
- $wpgmza_memory_limit = WP_MEMORY_LIMIT;
7113
- } else {
7114
- $wpgmza_memory_limit = 'unknown';
7115
- }
7116
-
7117
- $wpgmza_data['allocated_memory'] = $wpgmza_memory_limit;
7118
-
7119
- /**
7120
- * Is Debugging Enabled
7121
- */
7122
- if( defined( 'WP_DEBUG' ) ){
7123
- $wpgmza_debug = WP_DEBUG;
7124
- } else {
7125
- $wpgmza_debug = 'unknown';
7126
- }
7127
-
7128
- $wpgmza_data['wp_debug'] = $wpgmza_debug;
7129
-
7130
- /**
7131
- * Site Language
7132
- */
7133
- if( function_exists( 'get_locale' ) ){
7134
- $wpgmza_locale = get_locale();
7135
- } else {
7136
- $wpgmza_locale = 'unknown';
7137
- }
7138
-
7139
- $wpgmza_data['locale'] = $wpgmza_locale;
7140
-
7141
- if (function_exists('curl_version')) {
7142
-
7143
- $request_url = "http://ccplugins.co/usage-tracking/record_comprehensive.php";
7144
-
7145
- $ch = curl_init();
7146
- curl_setopt($ch, CURLOPT_URL, $request_url);
7147
- curl_setopt($ch, CURLOPT_POST, 1);
7148
- curl_setopt($ch, CURLOPT_POSTFIELDS, $wpgmza_data);
7149
- curl_setopt($ch, CURLOPT_REFERER, $_SERVER['HTTP_HOST']);
7150
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
7151
-
7152
- $output = curl_exec($ch);
7153
-
7154
- curl_close($ch);
7155
-
7156
- }
7157
-
7158
- }
7159
-
7160
- }
7161
- }
7162
-
7163
  /**
7164
  * Migrates text lat/lng columns into spatial latlng column if necessary
7165
  * @return void
1
  <?php
2
 
3
+ if(!defined('ABSPATH'))
4
+ exit;
5
+
6
  if(!function_exists('wpgmza_require_once'))
7
  {
8
  function wpgmza_require_once($filename)
137
  } else {
138
 
139
  if (function_exists( 'wpgmaps_pro_activate' ) && floatval($wpgmza_version) < 5.24) {
140
+ add_action( 'admin_notices', function() {
141
+
142
+ ?>
143
+ <div class="notice notice-error">
144
+ <p>
145
+ <?php
146
+ _e('<strong>WP Google Maps:</strong> The Pro add-on is not compatible with this version of WP Google Maps. Please update your Pro addon to 5.24 or above', 'wp-google-maps');
147
+ ?>
148
+ </p>
149
+ </div>
150
+ <?php
151
+
152
+ });
153
  } else {
154
  add_action( 'admin_head', 'wpgmaps_head' );
155
  }
156
 
157
  }
158
 
159
+ function wpgmaps_head_old()
160
+ {
161
+
162
+ }
163
+
164
+ add_action( 'admin_init', 'wpgmaps_init' );
165
  add_action( 'admin_menu', 'wpgmaps_admin_menu' );
166
  add_filter( 'widget_text', 'do_shortcode' );
167
 
760
  * @return void
761
  */
762
  function wpgmaps_admin_javascript_basic() {
763
+ if (!is_admin())
764
+ return;
765
+
766
+ global $wpgmza;
767
+ global $wpdb;
768
+ global $wpgmza_version;
769
+ global $wpgmza_tblname_maps;
770
+
771
+ if(!empty($_POST['wpgmaps_marker-nonce']) && !wp_verify_nonce($_POST['wpgmaps_marker-nonce'], 'wpgmza'))
772
+ {
773
+ http_response_code(403);
774
+ exit;
775
+ }
776
+
777
+ if(!$wpgmza->isUserAllowedToEdit())
778
+ {
779
+ http_response_code(401);
780
+ exit;
781
+ }
782
+
783
+ $ajax_nonce = wp_create_nonce("wpgmza");
784
+
785
+ if( isset( $_POST['wpgmza_save_google_api_key_list'] ) ){
786
+ if( $_POST['wpgmza_google_maps_api_key'] !== '' ){
787
+ update_option('wpgmza_google_maps_api_key', sanitize_text_field(trim($_POST['wpgmza_google_maps_api_key'])));
788
+ echo "<div class='updated'><p>";
789
+ $settings_page = "<a href='".admin_url('/admin.php?page=wp-google-maps-menu-settings#tabs-4')."'>".__('settings', 'wp-google-maps')."</a>";
790
+ echo sprintf( __('Your Google Maps API key has been successfully saved. This API key can be changed in the %s page', 'wp-google-maps'), $settings_page );
791
+ echo "</p></div>";
792
+ }
793
+ }
794
 
795
+ if (is_admin() && isset( $_GET['page'] ) && $_GET['page'] == 'wp-google-maps-menu' && isset( $_GET['action'] ) && $_GET['action'] == "edit_marker") {
796
+ wpgmaps_admin_edit_marker_javascript();
797
+ }
798
+ else if (is_admin() && isset($_GET['action']) && isset($_GET['page']) && $_GET['page'] == 'wp-google-maps-menu' && $_GET['action'] == "add_poly") { wpgmaps_b_admin_add_poly_javascript(sanitize_text_field($_GET['map_id'])); }
799
+ else if (is_admin() && isset($_GET['action']) && isset($_GET['page']) && $_GET['page'] == 'wp-google-maps-menu' && $_GET['action'] == "edit_poly") { wpgmaps_b_admin_edit_poly_javascript(sanitize_text_field($_GET['map_id']),sanitize_text_field($_GET['poly_id'])); }
800
+ else if (is_admin() && isset($_GET['action']) && isset($_GET['page']) && $_GET['page'] == 'wp-google-maps-menu' && $_GET['action'] == "add_polyline") { wpgmaps_b_admin_add_polyline_javascript(sanitize_text_field($_GET['map_id'])); }
801
+ else if (is_admin() && isset($_GET['action']) && isset($_GET['page']) && $_GET['page'] == 'wp-google-maps-menu' && $_GET['action'] == "edit_polyline") { wpgmaps_b_admin_edit_polyline_javascript(sanitize_text_field($_GET['map_id']),sanitize_text_field($_GET['poly_id'])); }
802
 
803
+ else if (is_admin() && isset( $_GET['page'] ) && $_GET['page'] == 'wp-google-maps-menu' && isset( $_GET['action'] ) && $_GET['action'] == "edit") {
804
 
805
+ if (!$_GET['map_id']) { return; }
806
+ $wpgmza_check = wpgmaps_update_xml_file(sanitize_text_field($_GET['map_id']));
807
+ if ( is_wp_error($wpgmza_check) ) wpgmza_return_error($wpgmza_check);
808
+
809
+ $wpgmza_settings = get_option("WPGMZA_OTHER_SETTINGS");
810
+
811
+ /* LOAD GOOGLE MAPS */
812
+ $wpgmza_locale = get_locale();
813
+ $wpgmza_suffix = ".com";
814
+ /* Hebrew correction */
815
+ if ($wpgmza_locale == "he_IL") { $wpgmza_locale = "iw"; }
816
+ /* Chinese integration */
817
+ if ($wpgmza_locale == "zh_CN") { $wpgmza_suffix = ".cn"; } else { $wpgmza_suffix = ".com"; }
818
+
819
+ $wpgmza_locale = substr( $wpgmza_locale, 0, 2 );
820
+ /**
821
+ * Only register the below scrips so that they are available on demand.
822
+ */
823
+ if(isset($wpgmza_settings['wpgmza_settings_remove_api']) && $wpgmza_settings['wpgmza_settings_remove_api'] == "yes")
824
+ $wpgaps_core_dependancy = array();
825
+ else
826
+ {
827
+ if($wpgmza->settings->engine == 'google-maps')
828
+ $wpgaps_core_dependancy = array( 'wpgmza_api_call' );
829
  else
830
+ $wpgaps_core_dependancy = array( 'wpgmza_ol_api_call' );
831
+ }
832
+
833
+ wp_enqueue_style( 'wpgmaps_admin_style', plugins_url('css/wpgmza_style.css', __FILE__),array(),$wpgmza_version.'b');
834
+ wp_enqueue_style( 'wpgmaps_admin_datatables_style', plugins_url('css/data_table.css', __FILE__),array(),$wpgmza_version.'b');
835
+ //wp_enqueue_script('wpgmaps_admin_datatables', plugins_url('/js/jquery.dataTables.min.js',__FILE__), $wpgaps_core_dependancy, $wpgmza_version.'b' , false);
 
 
 
 
836
 
837
 
838
 
839
+ $wpgmza_current_map_id = (int)$_GET['map_id'];
840
 
841
+ global $wpgmza;
842
+ $wpgmza->loadScripts();
843
+
844
+ wp_enqueue_script('wpgmaps_admin_core', plugins_url('/js/wpgmaps-admin-core.js',__FILE__), $wpgaps_core_dependancy, $wpgmza_version.'b' , false);
845
+ do_action("wpgooglemaps_hook_user_js_after_core");
846
+
847
+ wp_localize_script('wpgmaps_admin_core', 'wpgmza_circle_data_array', wpgmza_get_circle_data(1));
848
+ wp_localize_script('wpgmaps_admin_core', 'wpgmza_rectangle_data_array', wpgmza_get_rectangle_data(1));
849
+
850
 
851
+ $res = array();
852
+ $res[$wpgmza_current_map_id] = wpgmza_get_map_data($wpgmza_current_map_id);
853
+
854
+ $api_version_string = 'v=quarterly';
855
+
856
+ $map_other_settings = maybe_unserialize($res[$wpgmza_current_map_id]->other_settings);
857
+ $res[$wpgmza_current_map_id]->other_settings = $map_other_settings;
858
+ $res[$wpgmza_current_map_id]->map_width_type = stripslashes($res[$wpgmza_current_map_id]->map_width_type);
859
+
860
+
861
+ if ( isset( $res[$wpgmza_current_map_id]->other_settings['wpgmza_theme_data'] ) && $res[$wpgmza_current_map_id]->other_settings['wpgmza_theme_data'] != '') {
862
+ $res[$wpgmza_current_map_id]->other_settings['wpgmza_theme_data'] = html_entity_decode(stripslashes($res[$wpgmza_current_map_id]->other_settings['wpgmza_theme_data']));
863
+ }
864
+
865
+
866
+ $polygonoptions = array();
867
+ $total_poly_array = wpgmza_b_return_polygon_id_array($wpgmza_current_map_id);
868
+ if ($total_poly_array > 0) {
869
+ foreach ($total_poly_array as $poly_id) {
870
+ $polygonoptions[$poly_id] = wpgmza_b_return_poly_options($poly_id);
871
+
872
+ $tmp_poly_array = wpgmza_b_return_polygon_array($poly_id);
873
+ $poly_data_raw_array = array();
874
+ foreach ($tmp_poly_array as $single_poly) {
875
+ $poly_data_raw = str_replace(" ","",$single_poly);
876
+ $poly_data_raw = explode(",",$poly_data_raw);
877
+ if (isset($poly_data_raw[0]) && isset($poly_data_raw[1])) {
878
+ $lat = $poly_data_raw[0];
879
+ $lng = $poly_data_raw[1];
880
+ $poly_data_raw_array[] = $poly_data_raw;
881
+ }
882
+ }
883
+ $polygonoptions[$poly_id]->polydata = $poly_data_raw_array;
884
+
885
+ $linecolor = $polygonoptions[$poly_id]->linecolor;
886
+ $fillcolor = $polygonoptions[$poly_id]->fillcolor;
887
+ $fillopacity = $polygonoptions[$poly_id]->opacity;
888
+ if (!$linecolor) { $polygonoptions[$poly_id]->linecolor = "000000"; }
889
+ if (!$fillcolor) { $polygonoptions[$poly_id]->fillcolor = "66FF00"; }
890
+ if (!$fillopacity) { $polygonoptions[$poly_id]->opacity = "0.5"; }
891
+ }
892
+ } else { $polygonoptions = array(); }
893
+
894
+
895
+ $polylineoptions = array();
896
+
897
+ $total_poly_array = wpgmza_b_return_polyline_id_array($wpgmza_current_map_id);
898
+ if ($total_poly_array > 0) {
899
+ foreach ($total_poly_array as $poly_id) {
900
+ $polylineoptions[$poly_id] = wpgmza_b_return_polyline_options($poly_id);
901
+
902
+ $tmp_poly_array = wpgmza_b_return_polyline_array($poly_id);
903
+ $poly_data_raw_array = array();
904
+ foreach ($tmp_poly_array as $single_poly) {
905
+ $poly_data_raw = str_replace(" ","",$single_poly);
906
+ $poly_data_raw = str_replace(")","",$poly_data_raw );
907
+ $poly_data_raw = str_replace("(","",$poly_data_raw );
908
+ $poly_data_raw = explode(",",$poly_data_raw);
909
+ if (isset($poly_data_raw[0]) && isset($poly_data_raw[1])) {
910
+ $lat = $poly_data_raw[0];
911
+ $lng = $poly_data_raw[1];
912
+ $poly_data_raw_array[] = $poly_data_raw;
913
+ }
914
+ }
915
+ $polylineoptions[$poly_id]->polydata = $poly_data_raw_array;
 
 
 
 
 
 
 
 
 
 
916
 
 
 
 
 
 
917
 
918
+ if (isset($polylineoptions[$poly_id]->linecolor)) { $linecolor = $polylineoptions[$poly_id]->linecolor; } else { $linecolor = false; }
919
+ if (isset($polylineoptions[$poly_id]->fillcolor)) { $fillcolor = $polylineoptions[$poly_id]->fillcolor; } else { $fillcolor = false; }
920
+ if (isset($polylineoptions[$poly_id]->opacity)) { $fillopacity = $polylineoptions[$poly_id]->opacity; } else { $fillopacity = false; }
921
+ if (!$linecolor) { $polylineoptions[$poly_id]->linecolor = "000000"; }
922
+ if (!$fillcolor) { $polylineoptions[$poly_id]->fillcolor = "66FF00"; }
923
+ if (!$fillopacity) { $polylineoptions[$poly_id]->opacity = "0.5"; }
924
+ }
925
+ } else { $polylineoptions = array(); }
926
 
927
+ if (isset($wpgmza_settings['wpgmza_settings_marker_pull']) && $wpgmza_settings['wpgmza_settings_marker_pull'] == "0") {
928
+ $markers = wpgmaps_return_markers($wpgmza_current_map_id);
929
+ }
930
+
931
+ do_action("wpgooglemaps_basic_hook_user_js_after_core");
932
 
933
+ wp_localize_script( 'wpgmaps_admin_core', 'wpgmaps_mapid', (string)$wpgmza_current_map_id);
934
+ wp_localize_script( 'wpgmaps_admin_core', 'wpgmaps_localize', $res);
935
+ wp_localize_script( 'wpgmaps_admin_core', 'wpgmaps_localize_polygon_settings', $polygonoptions);
936
+ wp_localize_script( 'wpgmaps_admin_core', 'wpgmaps_localize_polyline_settings', $polylineoptions);
 
937
 
938
+ wp_localize_script( 'wpgmaps_admin_core', 'wpgmaps_markerurl', wpgmaps_get_marker_url($wpgmza_current_map_id));
939
 
940
+ if ($wpgmza_settings['wpgmza_settings_marker_pull'] == "0") {
941
+ wp_localize_script( 'wpgmaps_admin_core', 'wpgmaps_localize_marker_data', $markers);
942
+ }
943
+
944
+ $wpgmza_settings = apply_filters("wpgmza_basic_filter_localize_settings",$wpgmza_settings);
945
 
946
+ wp_localize_script( 'wpgmaps_admin_core', 'wpgmaps_localize_global_settings', $wpgmza_settings);
947
 
948
+ wp_localize_script( 'wpgmaps_admin_core', 'wpgmaps_lang_km_away', __("km away","wp-google-maps"));
949
+ wp_localize_script( 'wpgmaps_admin_core', 'wpgmaps_lang_m_away', __("miles away","wp-google-maps"));
950
+ wp_localize_script( 'wpgmaps_admin_core', 'wpgmaps_nonce', $ajax_nonce);
951
+ do_action("wpgooglemaps_hook_user_js_after_localize",$res);
952
 
953
+ return true;
954
 
955
+ }
956
+ return true;
957
 
958
 
959
 
962
 
963
 
964
 
 
965
 
 
 
 
 
 
 
966
 
967
+ /************************************** */
968
 
969
+ ?>
970
+ <script type="text/javascript" >
971
+ var marker_pull = '<?php echo $marker_pull; ?>';
972
+ var placeSearch, autocomplete;
973
+ var wpgmza_table_length;
974
+ var wpgmzaTable;
975
 
976
 
977
+ <?php if (isset($markers) && strlen($markers) > 0 && $markers != "[]"){ ?>var db_marker_array = JSON.stringify(<?php echo $markers; ?>);<?php } else { echo "var db_marker_array = '';"; } ?>
978
+
 
 
 
979
 
980
 
981
+ if ('undefined' == typeof window.jQuery) {
982
+ alert("jQuery is not installed. WP Google Maps requires jQuery in order to function properly. Please ensure you have jQuery installed.")
983
+ } else {
984
+ // all good.. continue...
985
+ }
986
 
987
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
988
 
989
 
990
+ var marker_added = false;
991
+ var MYMAP = {
992
+ map: null,
993
+ bounds: null
994
+ }
995
+ MYMAP.init = function(selector, latLng, zoom) {
996
+ var myOptions = {
997
+ minZoom: <?php echo $wpgmza_max_zoom; ?>,
998
+ maxZoom: 21,
999
+ zoom:zoom,
1000
+ center: latLng,
1001
+ zoomControl: <?php if (isset($wpgmza_settings['wpgmza_settings_map_zoom']) && $wpgmza_settings['wpgmza_settings_map_zoom'] == "yes") { echo "false"; } else { echo "true"; } ?>,
1002
+ panControl: <?php if (isset($wpgmza_settings['wpgmza_settings_map_pan']) && $wpgmza_settings['wpgmza_settings_map_pan'] == "yes") { echo "false"; } else { echo "true"; } ?>,
1003
+ mapTypeControl: <?php if (isset($wpgmza_settings['wpgmza_settings_map_type']) && $wpgmza_settings['wpgmza_settings_map_type'] == "yes") { echo "false"; } else { echo "true"; } ?>,
1004
+ streetViewControl: <?php if (isset($wpgmza_settings['wpgmza_settings_map_streetview']) && $wpgmza_settings['wpgmza_settings_map_streetview'] == "yes") { echo "false"; } else { echo "true"; } ?>,
1005
+ fullscreenControl: <?php if (isset($wpgmza_settings['wpgmza_settings_map_full_screen_control']) && $wpgmza_settings['wpgmza_settings_map_full_screen_control'] == "yes") { echo "false"; } else { echo "true"; } ?>,
1006
+ draggable: <?php if (isset($wpgmza_settings['wpgmza_settings_map_draggable']) && $wpgmza_settings['wpgmza_settings_map_draggable'] == "yes") { echo "false"; } else { echo "true"; } ?>,
1007
+ disableDoubleClickZoom: <?php if (isset($wpgmza_settings['wpgmza_settings_map_clickzoom']) && $wpgmza_settings['wpgmza_settings_map_clickzoom'] == "yes") { echo "true"; } else { echo "false"; } ?>,
1008
+ scrollwheel: <?php if (isset($wpgmza_settings['wpgmza_settings_map_scroll']) && $wpgmza_settings['wpgmza_settings_map_scroll'] == "yes") { echo "false"; } else { echo "true"; } ?>,
1009
+ mapTypeId: google.maps.MapTypeId.<?php echo $wpgmza_map_type; ?>
1010
+ }
1011
+ this.map = new google.maps.Map(jQuery(selector)[0], myOptions);
1012
+ this.bounds = new WPGMZA.LatLngBounds();
1013
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1014
 
1015
+ <?php if ($wpgmza_theme_data !== false && isset($wpgmza_theme_data) && $wpgmza_theme_data != '') { ?>
1016
+ this.map.setOptions({styles: <?php echo stripslashes($wpgmza_theme_data); ?>});
1017
+ <?php } ?>
1018
 
1019
+ google.maps.event.addListener(MYMAP.map, 'rightclick', function(event) {
1020
+ if (marker_added === false) {
1021
+ console.log("Creating marker on line <?php echo __LINE__ ?>");
1022
+ var marker = WPGMZA.Marker.createInstance({
1023
+ position: event.latLng,
1024
+ map: MYMAP.map
1025
+ });
1026
+ marker.setDraggable(true);
1027
+ google.maps.event.addListener(marker, 'dragend', function(event) {
1028
+ jQuery("#wpgmza_add_address").val(event.latLng.lat()+', '+event.latLng.lng());
1029
+ } );
1030
+ jQuery("#wpgmza_add_address").val(event.latLng.lat()+', '+event.latLng.lng());
1031
+ jQuery("#wpgm_notice_message_save_marker").show();
1032
+ marker_added = true;
1033
+ setTimeout(function() {
1034
+ jQuery("#wpgm_notice_message_save_marker").fadeOut('slow')
1035
+ }, 3000);
1036
+ } else {
1037
+ jQuery("#wpgm_notice_message_addfirst_marker").fadeIn('fast')
1038
+ setTimeout(function() {
1039
+ jQuery("#wpgm_notice_message_addfirst_marker").fadeOut('slow')
1040
+ }, 3000);
1041
+ }
1042
+
1043
+ });
1044
+
1045
+ /**
1046
+ * Deprecated in 6.4.05
1047
+ * This was deprecated in wpgmaps-admin-core.js however caused a bug instead
1048
+
1049
+ google.maps.event.addListener(MYMAP.map, 'zoom_changed', function() {
1050
+ zoomLevel = MYMAP.map.getZoom();
1051
+
1052
+ jQuery("#wpgmza_start_zoom").val(zoomLevel);
1053
+ if (zoomLevel == 0) {
1054
+ MYMAP.map.setZoom(10);
1055
+ }
1056
+ });
1057
+
1058
+ */
1059
+
1060
  <?php
1061
+ $total_poly_array = wpgmza_b_return_polygon_id_array(sanitize_text_field($_GET['map_id']));
1062
+ if ($total_poly_array > 0) {
1063
+ foreach ($total_poly_array as $poly_id) {
1064
+ $polyoptions = wpgmza_b_return_poly_options($poly_id);
1065
+ $linecolor = $polyoptions->linecolor;
1066
+ $fillcolor = $polyoptions->fillcolor;
1067
+ $fillopacity = $polyoptions->opacity;
1068
+ $lineopacity = $polyoptions->lineopacity;
1069
+ $title = $polyoptions->title;
1070
+ $link = $polyoptions->link;
1071
+ $ohlinecolor = $polyoptions->ohlinecolor;
1072
+ $ohfillcolor = $polyoptions->ohfillcolor;
1073
+ $ohopacity = $polyoptions->ohopacity;
1074
+ if (!$linecolor) { $linecolor = "000000"; }
1075
+ if (!$fillcolor) { $fillcolor = "66FF00"; }
1076
+ if ($fillopacity == "") { $fillopacity = "0.5"; }
1077
+ if ($lineopacity == "") { $lineopacity = "1.0"; }
1078
+ if ($ohlinecolor == "") { $ohlinecolor = $linecolor; }
1079
+ if ($ohfillcolor == "") { $ohfillcolor = $fillcolor; }
1080
+ if ($ohopacity == "") { $ohopacity = $fillopacity; }
1081
+ $linecolor = "#".$linecolor;
1082
+ $fillcolor = "#".$fillcolor;
1083
+ $ohlinecolor = "#".$ohlinecolor;
1084
+ $ohfillcolor = "#".$ohfillcolor;
1085
+
1086
+ $poly_array = wpgmza_b_return_polygon_array($poly_id);
1087
+
1088
+
1089
+ ?>
1090
+
1091
+ <?php if (sizeof($poly_array) > 1) { ?>
1092
+
1093
+ var WPGM_PathData_<?php echo $poly_id; ?> = [
1094
+ <?php
1095
+ foreach ($poly_array as $single_poly) {
1096
+ $poly_data_raw = str_replace(" ","",$single_poly);
1097
+ $poly_data_raw = explode(",",$poly_data_raw);
1098
+ $lat = $poly_data_raw[0];
1099
+ $lng = $poly_data_raw[1];
1100
+ ?>
1101
+ new WPGMZA.LatLng(<?php echo $lat; ?>, <?php echo $lng; ?>),
1102
+ <?php
1103
+ }
1104
+ ?>
1105
+
1106
+
1107
+ ];
1108
+ console.log("Creating polygon on line <?php echo __LINE__; ?>");
1109
+ var WPGM_Path_<?php echo $poly_id; ?> = new google.maps.Polygon({
1110
+ path: WPGM_PathData_<?php echo $poly_id; ?>,
1111
+ strokeColor: "<?php echo $linecolor; ?>",
1112
+ fillOpacity: "<?php echo $fillopacity; ?>",
1113
+ strokeOpacity: "<?php echo $lineopacity; ?>",
1114
+ fillColor: "<?php echo $fillcolor; ?>",
1115
+ strokeWeight: 2
1116
+ });
1117
 
1118
+ WPGM_Path_<?php echo $poly_id; ?>.setMap(this.map);
1119
+ <?php } } ?>
1120
 
1121
+ <?php } ?>
1122
 
1123
 
1124
+
1125
  <?php
1126
+ /* polylines */
1127
+ $total_polyline_array = wpgmza_b_return_polyline_id_array(sanitize_text_field($_GET['map_id']));
1128
+ if ($total_polyline_array > 0) {
1129
+ foreach ($total_polyline_array as $poly_id) {
1130
+ $polyoptions = wpgmza_b_return_polyline_options($poly_id);
1131
+ $linecolor = $polyoptions->linecolor;
1132
+ $fillopacity = $polyoptions->opacity;
1133
+ $linethickness = $polyoptions->linethickness;
1134
+ if (!$linecolor) { $linecolor = "000000"; }
1135
+ if (!$linethickness) { $linethickness = "4"; }
1136
+ if (!$fillopacity) { $fillopacity = "0.5"; }
1137
+ $linecolor = "#".$linecolor;
1138
+ $poly_array = wpgmza_b_return_polyline_array($poly_id);
1139
+ ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1140
 
1141
+ <?php if (sizeof($poly_array) > 1) { ?>
1142
+ var WPGM_PathLineData_<?php echo $poly_id; ?> = [
1143
+ <?php
1144
+ $poly_array = wpgmza_b_return_polyline_array($poly_id);
1145
+
1146
+ foreach ($poly_array as $single_poly) {
1147
+ $poly_data_raw = str_replace(" ","",$single_poly);
1148
+ $poly_data_raw = explode(",",$poly_data_raw);
1149
+ $lat = $poly_data_raw[0];
1150
+ $lng = $poly_data_raw[1];
1151
+ ?>
1152
+ new WPGMZA.LatLng(<?php echo $lat; ?>, <?php echo $lng; ?>),
1153
+ <?php
1154
+ }
1155
+ ?>
1156
+ ];
1157
+
1158
+ var WPGM_PathLine_<?php echo $poly_id; ?> = new google.maps.Polyline({
1159
+ path: WPGM_PathLineData_<?php echo $poly_id; ?>,
1160
+ strokeColor: "<?php echo $linecolor; ?>",
1161
+ strokeOpacity: "<?php echo $fillopacity; ?>",
1162
+ strokeWeight: "<?php echo $linethickness; ?>"
1163
+
1164
+ });
1165
 
1166
+ WPGM_PathLine_<?php echo $poly_id; ?>.setMap(this.map);
1167
+ <?php } } } ?>
1168
+
1169
+
1170
+
1171
+
1172
+
1173
+ google.maps.event.addListener(MYMAP.map, 'center_changed', function() {
1174
+ var location = MYMAP.map.getCenter();
1175
+ jQuery("#wpgmza_start_location").val(location.lat()+","+location.lng());
1176
+ jQuery("#wpgmaps_save_reminder").show();
1177
+ });
 
1178
 
1179
+ <?php if ($wpgmza_bicycle == "1") { ?>
1180
+ var bikeLayer = new google.maps.BicyclingLayer();
1181
+ bikeLayer.setMap(MYMAP.map);
1182
+ <?php } ?>
1183
+ <?php if ($wpgmza_traffic == "1") { ?>
1184
+ var trafficLayer = new google.maps.TrafficLayer();
1185
+ trafficLayer.setMap(MYMAP.map);
1186
+ <?php } ?>
1187
+
1188
+ <?php if ($transport_layer == 1) { ?>
1189
+ var transitLayer = new google.maps.TransitLayer();
1190
+ transitLayer.setMap(MYMAP.map);
1191
+ <?php } ?>
1192
 
1193
 
 
 
 
1194
 
1195
+ google.maps.event.addListener(MYMAP.map, 'click', function() {
1196
+ infoWindow.close();
1197
+ });
1198
 
 
1199
 
1200
+ }
 
 
 
 
 
 
 
1201
 
1202
+ var infoWindow = new google.maps.InfoWindow();
1203
+ <?php
1204
+ $wpgmza_settings = get_option("WPGMZA_OTHER_SETTINGS");
1205
+ $wpgmza_settings_infowindow_width = "250";
1206
+ if (isset($wpgmza_settings['wpgmza_settings_infowindow_width'])) { $wpgmza_settings_infowindow_width = $wpgmza_settings['wpgmza_settings_infowindow_width']; }
1207
+ if (!isset($wpgmza_settings_infowindow_width) || !$wpgmza_settings_infowindow_width) { $wpgmza_settings_infowindow_width = "250"; }
1208
+ ?>
1209
+ infoWindow.setOptions({maxWidth:<?php echo $wpgmza_settings_infowindow_width; ?>});
1210
 
 
1211
 
1212
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1213
 
1214
+ MYMAP.placeMarkers = function(filename,map_id) {
1215
+ marker_array = [];
1216
+
1217
+ if (marker_pull === '1') {
1218
+
1219
+
1220
+ jQuery.get(filename, function(xml){
1221
+ jQuery(xml).find("marker").each(function(){
1222
+ var wpmgza_map_id = jQuery(this).find('map_id').text();
1223
+ if (wpmgza_map_id == map_id) {
1224
+ var wpmgza_address = jQuery(this).find('address').text();
1225
+ var wpmgza_anim = jQuery(this).find('anim').text();
1226
+ var wpmgza_infoopen = jQuery(this).find('infoopen').text();
1227
+ var lat = jQuery(this).find('lat').text();
1228
+ var lng = jQuery(this).find('lng').text();
1229
+ var point = new WPGMZA.LatLng(parseFloat(lat),parseFloat(lng));
1230
+ MYMAP.bounds.extend(point);
1231
+
1232
+ if (wpmgza_anim === "1") {
1233
+ console.log("Creating marker on line <?php echo __LINE__ ?>");
1234
+ var marker = WPGMZA.Marker.createInstance({
1235
+ position: point,
1236
+ map: MYMAP.map,
1237
+ animation: google.maps.Animation.BOUNCE
1238
+ });
1239
+ }
1240
+ else if (wpmgza_anim === "2") {
1241
+ console.log("Creating marker on line <?php echo __LINE__ ?>");
1242
+ var marker = WPGMZA.Marker.createInstance({
1243
+ position: point,
1244
+ map: MYMAP.map,
1245
+ animation: google.maps.Animation.DROP
1246
+ });
1247
+ }
1248
+ else {
1249
+ console.log("Creating marker on line <?php echo __LINE__ ?>");
1250
+ var marker = WPGMZA.Marker.createInstance({
1251
+ position: point,
1252
+ map: MYMAP.map
1253
+ });
1254
+ }
1255
+
1256
+
1257
+ var html='<p class="wpgmza_infowinfow_address" style="margin-top:0; padding-top:0; margin-bottom:2px; padding-bottom:2px; font-weight:bold;">'+wpmgza_address+'</p>';
1258
+
1259
+ if (wpmgza_infoopen === "1") {
1260
+
1261
+ infoWindow.setContent(html);
1262
+ infoWindow.open(MYMAP.map, marker);
1263
+ }
1264
 
1265
+ <?php if ($wpgmza_open_infowindow_by == '2') { ?>
1266
+ google.maps.event.addListener(marker, 'mouseover', function() {
1267
+ infoWindow.close();
1268
+ infoWindow.setContent(html);
1269
+ infoWindow.open(MYMAP.map, marker);
1270
 
1271
+ });
1272
+ <?php } else { ?>
1273
+ google.maps.event.addListener(marker, 'click', function() {
1274
+ infoWindow.close();
1275
+ infoWindow.setContent(html);
1276
+ infoWindow.open(MYMAP.map, marker);
1277
 
1278
+ });
1279
+ <?php } ?>
1280
 
1281
+ }
1282
 
1283
+ });
1284
+ });
1285
+ } else {
1286
+ if (db_marker_array.length > 0) {
1287
+ var dec_marker_array = JSON.parse(db_marker_array);
1288
+ jQuery.each(dec_marker_array, function(i, val) {
1289
+
1290
+
1291
+ var wpmgza_address = val.address;
1292
+ var wpmgza_anim = val.anim;
1293
+ var wpmgza_infoopen = val.infoopen;
1294
+ var lat = val.lat;
1295
+ var lng = val.lng;
1296
+ var point = new WPGMZA.LatLng(parseFloat(lat),parseFloat(lng));
1297
+ MYMAP.bounds.extend(point);
1298
+
1299
+ if (wpmgza_anim === "1") {
1300
+ console.log("Creating marker on line <?php echo __LINE__ ?>");
1301
+ var marker = WPGMZA.Marker.createInstance({
1302
+ position: point,
1303
+ map: MYMAP.map,
1304
+ animation: google.maps.Animation.BOUNCE
1305
+ });
1306
+ }
1307
+ else if (wpmgza_anim === "2") {
1308
+ console.log("Creating marker on line <?php echo __LINE__ ?>");
1309
+ var marker = WPGMZA.Marker.createInstance({
1310
+ position: point,
1311
+ map: MYMAP.map,
1312
+ animation: google.maps.Animation.DROP
1313
+ });
1314
+ }
1315
+ else {
1316
+ console.log("Creating marker on line <?php echo __LINE__ ?>");
1317
+ var marker = WPGMZA.Marker.createInstance({
1318
+ position: point,
1319
+ map: MYMAP.map
1320
+ });
1321
+ }
1322
+
1323
+
1324
+ var html='<p class="wpgmza_infowinfow_address" style="margin-top:0; padding-top:0; margin-bottom:2px; padding-bottom:2px; font-weight:bold;">'+wpmgza_address+'</p>';
1325
+
1326
+ if (wpmgza_infoopen === "1") {
1327
+
1328
+ infoWindow.setContent(html);
1329
+ infoWindow.open(MYMAP.map, marker);
1330
+ }
1331
+
1332
+ <?php if ($wpgmza_open_infowindow_by == '2') { ?>
1333
+ google.maps.event.addListener(marker, 'mouseover', function() {
1334
+ infoWindow.close();
1335
+ infoWindow.setContent(html);
1336
+ infoWindow.open(MYMAP.map, marker);
1337
+
1338
+ });
1339
+ <?php } else { ?>
1340
+ google.maps.event.addListener(marker, 'click', function() {
1341
+ infoWindow.close();
1342
+ infoWindow.setContent(html);
1343
+ infoWindow.open(MYMAP.map, marker);
1344
+
1345
+ });
1346
+ <?php } ?>
1347
+
1348
+
1349
+
1350
+
1351
+
1352
+
1353
+ });
1354
+
1355
+ }
1356
+ }
1357
+ }
1358
 
1359
+
1360
+
1361
+
1362
+
1363
+
1364
+ </script>
1365
+ <?php
1366
  }
1367
 
1368
 
1393
  if ($res[$wpgmza_current_map_id]->other_settings['wpgmza_theme_data'] != '') {
1394
  $res[$wpgmza_current_map_id]->other_settings['wpgmza_theme_data'] = html_entity_decode(stripslashes($res[$wpgmza_current_map_id]->other_settings['wpgmza_theme_data']));
1395
  }
 
 
 
 
 
 
 
1396
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1397
  $polygonoptions = array();
1398
  $total_poly_array = wpgmza_b_return_polygon_id_array($wpgmza_current_map_id);
1399
 
1499
 
1500
  /**
1501
  * Build the marker XML file
1502
+ * @param int $mapid Map Id
 
1503
  */
1504
  function wpgmaps_update_xml_file($mapid = false) {
1505
 
1954
  global $wpgmza_tblname_polylines;
1955
  $check = check_ajax_referer( 'wpgmza', 'security' );
1956
  $table_name = $wpdb->prefix . "wpgmza";
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1957
 
1958
+ if(!$check)
1959
+ {
1960
+ http_response_code(403);
1961
+ exit;
1962
+ }
1963
+
1964
+ if(!$wpgmza->isUserAllowedToEdit())
1965
+ {
1966
+ http_response_code(401);
1967
+ exit;
1968
+ }
1969
 
1970
+ $map_id = (isset($_POST['map_id']) ? (int)$_POST['map_id'] : null);
1971
+
1972
+ if ($_POST['action'] == "add_marker") {
1973
+
1974
+ $fields = array(
1975
+ 'map_id' => '%d',
1976
+ 'address' => '%s',
1977
+ 'lat' => '%f',
1978
+ 'lng' => '%f',
1979
+ 'latlng' => "{$wpgmza->spatialFunctionPrefix}GeomFromText(%s)",
1980
+ 'infoopen' => '%d',
1981
+ 'description' => '%s',
1982
+ 'title' => '%s',
1983
+ 'anim' => '%d',
1984
+ 'link' => '%s',
1985
+ 'icon' => '%s',
1986
+ 'pic' => '%s'
1987
+ );
1988
+
1989
+ $keys = array_keys($fields);
1990
+ $placeholders = array_values($fields);
1991
+
1992
+ $lat = floatval($_POST['lat']);
1993
+ $lng = floatval($_POST['lng']);
1994
+
1995
+ $qstr = "INSERT INTO $table_name (" . implode(',', $keys) . ") VALUES (" . implode(',', $placeholders) . ")";
1996
+
1997
+ $params = array();
1998
+ foreach($fields as $key => $placeholder)
1999
+ {
2000
+ if($key == 'latlng')
2001
+ {
2002
+ $params[] = "POINT($lat $lng)";
2003
+ continue;
2004
+ }
2005
 
2006
+ if(!isset($_POST[$key]))
 
2007
  {
2008
+ $params[] = "";
2009
+ continue;
 
 
 
 
 
 
 
 
 
 
 
2010
  }
2011
 
2012
+ $params[] = $_POST[$key];
2013
+ }
2014
+
2015
+ $stmt = $wpdb->prepare($qstr, $params);
2016
+ $rows_affected = $wpdb->query($stmt);
2017
+
2018
+ $wpgmza_check = wpgmaps_update_xml_file($map_id);
2019
+
2020
+ if ( is_wp_error($wpgmza_check) ) wpgmza_return_error($wpgmza_check);
2021
+ $return_a = array(
2022
+ "marker_id" => $wpdb->insert_id,
2023
+ "marker_data" => wpgmaps_return_markers($map_id, $wpdb->insert_id)
2024
+ );
2025
+ echo json_encode($return_a);
2026
+
2027
+ }
2028
+ if ($_POST['action'] == "edit_marker") {
2029
+ $cur_id = (int)$_POST['edit_id'];
2030
+
2031
+ $lat = floatval($_POST['lat']);
2032
+ $lng = floatval($_POST['lng']);
2033
+
2034
+ $qstr = "UPDATE $table_name SET
2035
+ address = %s,
2036
+ lat = %f,
2037
+ lng = %f,
2038
+ latlng = {$wpgmza->spatialFunctionPrefix}GeomFromText(%s),
2039
+ anim = %d,
2040
+ infoopen = %d
2041
+ WHERE
2042
+ id = %d
2043
+ ";
2044
+
2045
+ $param = array(
2046
+ $_POST['address'],
2047
+ $_POST['lat'],
2048
+ $_POST['lng'],
2049
+ "POINT($lat $lng)",
2050
+ $_POST['anim'],
2051
+ $_POST['infoopen'],
2052
+ $cur_id
2053
+ );
2054
+
2055
+ foreach($param as $key => $value)
2056
+ $param[$key] = sanitize_text_field($value);
2057
 
2058
+ $stmt = $wpdb->prepare($qstr, $param);
2059
+ $rows_affected = $wpdb->query($stmt);
2060
+
2061
+ $wpgmza_check = wpgmaps_update_xml_file($map_id);
2062
+ if ( is_wp_error($wpgmza_check) ) wpgmza_return_error($wpgmza_check);
2063
+ $return_a = array(
2064
+ "marker_id" => $cur_id,
2065
+ "marker_data" => wpgmaps_return_markers($map_id, $cur_id)
2066
+ );
2067
+ echo json_encode($return_a);
 
 
2068
 
2069
+ }
2070
+ if ($_POST['action'] == "delete_marker") {
2071
+
2072
+ $marker_id = (int)$_POST['marker_id'];
2073
+ $wpdb->query( $wpdb->prepare("DELETE FROM $wpgmza_tblname WHERE `id` = %d LIMIT 1",intval($marker_id)) );
2074
+
2075
+ $wpgmza_check = wpgmaps_update_xml_file($map_id);
2076
+ if ( is_wp_error($wpgmza_check) ) wpgmza_return_error($wpgmza_check);
2077
+ $return_a = array(
2078
+ "marker_id" => $marker_id,
2079
+ "marker_data" => wpgmaps_return_markers($map_id)
2080
+ );
2081
+ echo json_encode($return_a);
2082
 
2083
 
2084
+ }
2085
+ if ($_POST['action'] == "delete_poly") {
2086
+ $poly_id = (int)$_POST['poly_id'];
2087
+ $wpdb->query($wpdb->prepare("DELETE FROM $wpgmza_tblname_poly WHERE `id` = %d LIMIT 1",intval($poly_id)) );
2088
+ echo wpgmza_b_return_polygon_list($map_id);
2089
+ }
2090
+ if ($_POST['action'] == "delete_polyline") {
2091
+ $poly_id = (int)$_POST['poly_id'];
2092
+ $wpdb->query($wpdb->prepare("DELETE FROM $wpgmza_tblname_polylines WHERE `id` = %d LIMIT 1",intval($poly_id)) );
2093
+ echo wpgmza_b_return_polyline_list($map_id);
2094
+ }
2095
+
2096
+ if($_POST['action'] == "delete_circle") {
2097
+ global $wpgmza_tblname_circles;
2098
+ $stmt = $wpdb->prepare("DELETE FROM $wpgmza_tblname_circles WHERE id=%d", array($_POST['circle_id']));
2099
+ $wpdb->query($stmt);
2100
 
2101
+ echo wpgmza_get_circles_table($map_id);
2102
+ }
2103
+
2104
+ if($_POST['action'] == "delete_rectangle") {
2105
+ global $wpgmza_tblname_rectangles;
2106
+ $stmt = $wpdb->prepare("DELETE FROM $wpgmza_tblname_rectangles WHERE id=%d", array($_POST['rectangle_id']));
2107
+ $wpdb->query($stmt);
2108
 
2109
+ echo wpgmza_get_rectangles_table($map_id);
2110
+ }
2111
+
2112
+ exit;
 
 
 
 
 
2113
  }
2114
 
2115
  /**
2126
  * @param array $atts array of shortcode attributes
2127
  * @return void
2128
  */
2129
+ function wpgmaps_tag_basic( $atts )
2130
+ {
2131
  global $wpgmza_current_map_id;
2132
  global $wpgmza_version;
2133
  global $short_code_active;
2136
 
2137
  $short_code_active = true;
2138
 
2139
+ shortcode_atts( array(
2140
  'id' => '1',
2141
  'width' => 'inherit',
2142
  'height' => 'inherit'
2143
+ ), $atts );
2144
 
2145
  $ret_msg = "";
2146
 
2147
  if(isset($atts['id']))
2148
+ $wpgmza_current_map_id = (int)$atts['id'];
2149
  else
2150
  $wpgmza_current_map_id = 1;
2151
 
2185
 
2186
  }
2187
  if (isset($atts['zoom'])) {
2188
+ $zoom_override = (int)$atts['zoom'];
2189
  $wpgmza_override['zoom'] = $zoom_override;
2190
  }
2191
 
2209
  $map_attributes = '';
2210
 
2211
  if(isset($atts['width']) && $atts['width'] != 'inherit')
2212
+ $map_attributes .= "data-shortcode-width='" . esc_attr($atts["width"]) . "' ";
2213
  if(isset($atts['height']) && $atts['height'] != 'inherit')
2214
+ $map_attributes .= "data-shortcode-height='" . esc_attr($atts["height"]) . "' ";
2215
 
2216
  // Using DOMDocument here to properly format the data-settings attribute
2217
  $document = new WPGMZA\DOMDocument();
2259
 
2260
  if(!empty($atts['classname']))
2261
  {
2262
+ $map_attributes .= " class='" . esc_attr($atts['classname']) . "'";
2263
  }
2264
 
2265
  if (!$map_align || $map_align == "" || $map_align == "1") { $map_align = "float:left;"; }
2489
  * @return string HTML output for the store locator
2490
  */
2491
  function wpgmaps_sl_user_output_basic($map_id) {
2492
+ global $wpgmza;
2493
+
2494
  $global_settings = get_option('WPGMZA_OTHER_SETTINGS');
2495
  $map_settings = wpgmza_get_map_data($map_id);
2496
 
2588
  exit;
2589
  }
2590
 
2591
+ if($wpgmza->isUserAllowedToEdit())
2592
+ {
2593
+ http_response_code(401);
2594
+ exit;
2595
+ }
2596
+
2597
  if($wpgmza)
2598
  $wpgmza->gdprCompliance->onPOST();
2599
 
2647
  }
2648
 
2649
  if(isset($_POST['tile_server_url']))
2650
+ $wpgmza->settings['tile_server_url'] = sanitize_text_field($_POST['tile_server_url']);
2651
 
2652
  if(isset($_POST['wpgmza_load_engine_api_condition']))
2653
+ $wpgmza->settings['wpgmza_load_engine_api_condition'] = sanitize_text_field($_POST['wpgmza_load_engine_api_condition']);
2654
 
2655
  if(isset($_POST['wpgmza_always_include_engine_api_on_pages']))
2656
+ $wpgmza->settings['wpgmza_always_include_engine_api_on_pages'] = sanitize_text_field($_POST['wpgmza_always_include_engine_api_on_pages']);
2657
 
2658
  if(isset($_POST['wpgmza_always_exclude_engine_api_on_pages']))
2659
+ $wpgmza->settings['wpgmza_always_exclude_engine_api_on_pages'] = sanitize_text_field($_POST['wpgmza_always_exclude_engine_api_on_pages']);
2660
 
2661
  if(isset($_POST['wpgmza_use_fontawesome']))
2662
+ $wpgmza->settings['use_fontawesome'] = sanitize_text_field($_POST['wpgmza_use_fontawesome']);
2663
 
2664
  if(isset($_POST['wpgmza_maps_engine']))
2665
+ $wpgmza->settings['wpgmza_maps_engine'] = sanitize_text_field($_POST['wpgmza_maps_engine']);
2666
 
2667
 
2668
  if (isset($_POST['wpgmza_settings_map_open_marker_by'])) { $wpgmza->settings['wpgmza_settings_map_open_marker_by'] = sanitize_text_field($_POST['wpgmza_settings_map_open_marker_by']); }
2675
 
2676
  if (isset($_POST['wpgmza_marker_xml_location'])) { update_option("wpgmza_xml_location",sanitize_text_field($_POST['wpgmza_marker_xml_location'])); }
2677
  if (isset($_POST['wpgmza_marker_xml_url'])) { update_option("wpgmza_xml_url",sanitize_text_field($_POST['wpgmza_marker_xml_url'])); }
2678
+
2679
+ if(current_user_can('administrator'))
2680
+ if (isset($_POST['wpgmza_access_level'])) { $wpgmza->settings['wpgmza_settings_access_level'] = sanitize_text_field($_POST['wpgmza_access_level']); }
2681
+
2682
  if (isset($_POST['wpgmza_settings_marker_pull'])) { $wpgmza->settings['wpgmza_settings_marker_pull'] = sanitize_text_field($_POST['wpgmza_settings_marker_pull']); }
2683
 
2684
  // Maps -> Settings -> Store Locator -> option Store Locator Radius
2712
  global $wpgmza_tblname_maps;
2713
  global $wpgmza_version;
2714
 
 
 
2715
  if ((isset($_GET['page']) && $_GET['page'] == "wp-google-maps-menu") || (isset($_GET['page']) && $_GET['page'] == "wp-google-maps-menu-settings")) {
2716
  wpgmaps_folder_check();
2717
  }
2725
 
2726
  global $wpdb;
2727
 
 
 
2728
  $map_id = intval(sanitize_text_field($_POST['wpgmza_id']));
2729
  $map_title = sanitize_text_field(esc_attr($_POST['wpgmza_title']));
2730
  $map_height = sanitize_text_field($_POST['wpgmza_height']);
2774
 
2775
  $other_settings['map_max_zoom'] = sanitize_text_field($map_max_zoom);
2776
 
 
 
 
 
 
2777
  $other_settings['transport_layer'] = isset($_POST['wpgmza_transport']) ? 1 : 2;
2778
 
2779
 
3066
  wp_die( __( 'You do not have permission to perform this function', 'wp-google-maps' ) );
3067
  }
3068
 
3069
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3070
  global $wpdb;
3071
  global $wpgmza_tblname_polylines;
3072
  $mid = sanitize_text_field($_POST['wpgmaps_map_id']);
3073
  $pid = sanitize_text_field($_POST['wpgmaps_poly_id']);
3074
+ if (!isset($_POST['wpgmza_polyline']) || $_POST['wpgmza_polyline'] == "") {
3075
+ echo "<div class='error'>";
3076
+ _e("You cannot save a blank polyline","wp-google-maps");
3077
+ echo "</div>";
3078
+
3079
+ } else {
3080
+ $wpgmaps_polydata = sanitize_text_field($_POST['wpgmza_polyline']);
3081
+ if (isset($_POST['poly_name'])) { $polyname = sanitize_text_field($_POST['poly_name']); } else { $polyname = ""; }
3082
+ if (isset($_POST['poly_line'])) { $linecolor = sanitize_text_field($_POST['poly_line']); } else { $linecolor = "000000"; }
3083
+ if (isset($_POST['poly_thickness'])) { $linethickness = sanitize_text_field($_POST['poly_thickness']); } else { $linethickness = "0"; }
3084
+ if (isset($_POST['poly_opacity'])) { $opacity = sanitize_text_field($_POST['poly_opacity']); } else { $opacity = "1"; }
3085
 
3086
+ $rows_affected = $wpdb->query( $wpdb->prepare(
3087
+ "UPDATE $wpgmza_tblname_polylines SET
3088
+ polydata = %s,
3089
+ polyname = %s,
3090
+ linecolor = %s,
3091
+ linethickness = %s,
3092
+ opacity = %s
3093
+ WHERE `id` = %d"
3094
+ ,
3095
+
3096
+ $wpgmaps_polydata,
3097
+ $polyname,
3098
+ $linecolor,
3099
+ $linethickness,
3100
+ $opacity,
3101
+ $pid
3102
+ )
3103
+ );
3104
+ echo "<div class='updated'>";
3105
+ _e("Your polyline has been saved.","wp-google-maps");
3106
+ echo "</div>";
3107
+ }
3108
 
3109
 
3110
  }
3111
+ else if (isset($_POST['wpgmza_save_circle'])){
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3112
 
3113
+ if ( !isset( $_POST['wpgmaps_circle-nonce'] ) || !wp_verify_nonce( $_POST['wpgmaps_circle-nonce'], 'wpgmaps_circle-nonce' ) ) {
3114
+ wp_die( __( 'You do not have permission to perform this function', 'wp-google-maps' ) );
3115
+ }
3116
 
3117
+ global $wpdb;
3118
+ global $wpgmza_tblname_circles;
3119
+
3120
+ $center = preg_replace('/[(),]/', '', sanitize_text_field($_POST['center']));
3121
+
3122
+ if(isset($_POST['circle_id']))
3123
+ {
3124
+ $stmt = $wpdb->prepare("
3125
+ UPDATE $wpgmza_tblname_circles SET
3126
+ center = {$wpgmza->spatialFunctionPrefix}GeomFromText(%s),
3127
+ name = %s,
3128
+ color = %s,
3129
+ opacity = %f,
3130
+ radius = %f
3131
+ WHERE id = %d
3132
+ ", array(
3133
+ "POINT($center)",
3134
+ sanitize_text_field($_POST['circle_name']),
3135
+ sanitize_hex_color($_POST['circle_color']),
3136
+ floatval($_POST['circle_opacity']),
3137
+ intval($_POST['circle_radius']),
3138
+ intval($_POST['circle_id'])
3139
+ ));
3140
+ }
3141
+ else
3142
+ {
3143
+ $stmt = $wpdb->prepare("
3144
+ INSERT INTO $wpgmza_tblname_circles
3145
+ (center, map_id, name, color, opacity, radius)
3146
+ VALUES
3147
+ ({$wpgmza->spatialFunctionPrefix}GeomFromText(%s), %d, %s, %s, %f, %f)
3148
+ ", array(
3149
+ "POINT($center)",
3150
+ intval($_POST['wpgmaps_map_id']),
3151
+ sanitize_text_field($_POST['circle_name']),
3152
+ sanitize_hex_color($_POST['circle_color']),
3153
+ intval($_POST['circle_opacity']),
3154
+ intval($_POST['circle_radius'])
3155
+ ));
3156
+ }
3157
+
3158
+ $wpdb->query($stmt);
3159
+
3160
+ ?>
3161
+ <script type='text/javascript'>
3162
+
3163
+ jQuery(function($) {
3164
+ window.location.reload();
3165
+ });
3166
+
3167
+ </script>
3168
+ <?php
3169
+
3170
  }
3171
+ else if (isset($_POST['wpgmza_save_rectangle'])){
3172
 
3173
+ if ( !isset( $_POST['wpgmaps_rectangle-nonce'] ) || !wp_verify_nonce( $_POST['wpgmaps_rectangle-nonce'], 'wpgmaps_rectangle-nonce' ) ) {
3174
+ wp_die( __( 'You do not have permission to perform this function', 'wp-google-maps' ) );
3175
+ }
3176
 
3177
+ global $wpdb;
3178
+ global $wpgmza_tblname_rectangles;
3179
+
3180
+ $m = null;
3181
+ preg_match_all('/-?\d+(\.\d+)?/', sanitize_text_field($_POST['bounds']), $m);
3182
+
3183
+ $north = $m[0][0];
3184
+ $east = $m[0][1];
3185
+ $south = $m[0][2];
3186
+ $west = $m[0][3];
3187
+
3188
+ $cornerA = "POINT($north $east)";
3189
+ $cornerB = "POINT($south $west)";
3190
+
3191
+ if(isset($_POST['rectangle_id']))
3192
+ {
3193
+ $stmt = $wpdb->prepare("
3194
+ UPDATE $wpgmza_tblname_rectangles SET
3195
+ name = %s,
3196
+ color = %s,
3197
+ opacity = %f,
3198
+ cornerA = {$wpgmza->spatialFunctionPrefix}GeomFromText(%s),
3199
+ cornerB = {$wpgmza->spatialFunctionPrefix}GeomFromText(%s)
3200
+ WHERE id = %d
3201
+ ", array(
3202
+ sanitize_text_field($_POST['rectangle_name']),
3203
+ sanitize_hex_color($_POST['rectangle_color']),
3204
+ floatval($_POST['rectangle_opacity']),
3205
+ $cornerA,
3206
+ $cornerB,
3207
+ intval($_POST['rectangle_id'])
3208
+ ));
3209
+ }
3210
+ else
3211
+ {
3212
+ $stmt = $wpdb->prepare("
3213
+ INSERT INTO $wpgmza_tblname_rectangles
3214
+ (map_id, name, color, opacity, cornerA, cornerB)
3215
+ VALUES
3216
+ (%d, %s, %s, %f, {$wpgmza->spatialFunctionPrefix}GeomFromText(%s), {$wpgmza->spatialFunctionPrefix}GeomFromText(%s))
3217
+ ", array(
3218
+ intval($_POST['wpgmaps_map_id']),
3219
+ sanitize_text_field($_POST['rectangle_name']),
3220
+ sanitize_hex_color($_POST['rectangle_color']),
3221
+ floatval($_POST['rectangle_opacity']),
3222
+ $cornerA,
3223
+ $cornerB
3224
+ ));
3225
+ }
3226
+
3227
+ $rows = $wpdb->query($stmt);
3228
+
3229
+ ?>
3230
+ <script type='text/javascript'>
3231
+
3232
+ jQuery(function($) {
3233
+ window.location.reload();
3234
+ });
3235
+
3236
+ </script>
3237
+ <?php
3238
+ }
3239
+ else if (isset($_POST['wpgmza_save_settings']) && current_user_can('administrator')){
3240
+
3241
 
 
3242
 
3243
+ }
3244
+
3245
 
3246
+
3247
 
3248
 
3249
 
3250
+ }
3251
 
3252
  function wpgmaps_admin_menu() {
3253
  $wpgmza_settings = get_option("WPGMZA_OTHER_SETTINGS");
3287
 
3288
  function wpgmaps_menu_layout() {
3289
 
3290
+ $map_id = isset($_GET['map_id']) ? (int)$_GET['map_id'] : null;
3291
+ $nonce = wp_create_nonce('wpgmza_menu_layout_nonce');
3292
+
3293
  $handle = 'avia-google-maps-api';
3294
  $list = 'enqueued';
3295
+
3296
  if (wp_script_is( $handle, $list )) {
3297
  wp_deregister_script('avia-google-maps-api');
3298
  }
3305
  if ($_GET['action'] == "welcome_page" || $_GET['action'] == "credits") { } else {
3306
  echo"<br /><div class='wpgmza-support-notice' style='float:right; display:block; width:250px; height:65px; padding:6px; text-align:center; background-color: white; border-top: 4px solid #0073AA; margin-right:17px;'><strong>".__("Experiencing problems with the plugin?","wp-google-maps")."</strong><br /><a href='http://www.wpgmaps.com/documentation/troubleshooting/' title='WP Google Maps Troubleshooting Section' target='_BLANK'>".__("See the troubleshooting manual.","wp-google-maps")."</a> <br />".__("Or ask a question on our ","wp-google-maps")." <a href='http://www.wpgmaps.com/forums/forum/support-forum/' title='WP Google Maps Support Forum' target='_BLANK'>".__("Support forum.","wp-google-maps")."</a></div>";
3307
  }
3308
+
3309
+ if ($_GET['action'] == "trash" && $map_id) {
3310
  if (isset( $_GET['s'] ) && $_GET['s'] == "1") {
3311
+
3312
+ if(!wp_verify_nonce($_GET['nonce'], 'wpgmza_menu_layout_nonce'))
3313
+ {
3314
+ http_response_code(401);
3315
+ exit;
3316
+ }
3317
+
3318
+ if (wpgmaps_trash_map($map_id)) {
3319
  echo "<script>window.location = \"".get_option('siteurl')."/wp-admin/admin.php?page=wp-google-maps-menu\"</script>";
3320
  } else {
3321
  _e("There was a problem deleting the map.","wp-google-maps");
3322
  }
3323
+
3324
  } else {
3325
+ $res = wpgmza_get_map_data($map_id);
3326
+ echo "<h2>".__("Delete your map","wp-google-maps")."</h2><p>".__("Are you sure you want to delete the map","wp-google-maps")." <strong>\"".$res->map_title."?\"</strong> <br /><a href='?page=wp-google-maps-menu&action=trash&map_id=".$map_id."&s=1&nonce=$nonce'>".__("Yes","wp-google-maps")."</a> | <a href='?page=wp-google-maps-menu'>".__("No","wp-google-maps")."</a></p>";
3327
  return;
3328
  }
3329
  }
3330
+
3331
+ if (isset($_GET['action']) && $_GET['action'] == "duplicate" && $map_id) {
3332
+ if (function_exists('wpgmaps_duplicate_map')) {
3333
+
3334
+ if(!wp_verify_nonce($_GET['nonce'], 'wpgmza_list_maps_pro_nonce'))
3335
+ {
3336
+ http_response_code(403);
3337
+ exit;
3338
+ }
3339
+
3340
+ $new_id = wpgmaps_duplicate_map($map_id);
3341
+
3342
  if ($new_id > 0) {
3343
  wpgmza_map_page();
3344
  } else {
3353
  wpgmza_edit_marker(sanitize_text_field($_GET['id']));
3354
 
3355
  }
3356
+ elseif ($_GET['action'] == "add_poly" && $map_id) {
3357
 
3358
  if (function_exists("wpgmza_b_real_pro_add_poly")) {
3359
+ wpgmza_b_real_pro_add_poly($map_id);
3360
  } else {
3361
+ wpgmza_b_pro_add_poly($map_id);
3362
  }
3363
 
3364
  }
3365
+ else if ($_GET['action'] == "edit_poly" && $map_id) {
3366
 
3367
  if (function_exists("wpgmza_b_real_pro_edit_poly")) {
3368
+ wpgmza_b_real_pro_edit_poly($map_id);
3369
  } else {
3370
+ wpgmza_b_pro_edit_poly($map_id);
3371
  }
3372
 
3373
 
3374
  }
3375
+ else if ($_GET['action'] == "add_polyline" && $map_id) {
3376
 
3377
+ wpgmza_b_pro_add_polyline($map_id);
3378
 
3379
  }
3380
+ else if ($_GET['action'] == "edit_polyline" && $map_id) {
3381
 
3382
+ wpgmza_b_pro_edit_polyline($map_id);
3383
  }
3384
+ else if ($_GET['action'] == "add_heatmap" && $map_id) {
3385
+ if (function_exists("wpgmza_b_pro_add_heatmap")) { wpgmza_b_pro_add_heatmap($map_id); }
3386
  }
3387
+ else if ($_GET['action'] == "edit_heatmap" && $map_id) {
3388
+ if (function_exists("wpgmza_b_pro_edit_heatmap")) { wpgmza_b_pro_edit_heatmap($map_id); }
3389
  }
3390
+ else if ($_GET['action'] == "add_circle" && $map_id) {
3391
+ wpgmza_b_add_circle($map_id);
3392
  }
3393
+ else if ($_GET['action'] == "edit_circle" && $map_id) {
3394
+ wpgmza_b_edit_circle($map_id);
3395
  }
3396
+ else if ($_GET['action'] == "add_rectangle" && $map_id) {
3397
+ wpgmza_b_add_rectangle($map_id);
3398
  }
3399
+ else if ($_GET['action'] == "edit_rectangle" && $map_id) {
3400
+ wpgmza_b_edit_rectangle($map_id);
3401
  }
3402
  else if ($_GET['action'] == 'welcome_page') {
3403
  $file = dirname(__FILE__).'/base/classes/WPGM_templates.php';
3456
  if ($_GET['action'] == "trash" && isset($_GET['marker_id'])) {
3457
 
3458
  if ($_GET['s'] == "1") {
3459
+ if (wpgmaps_trash_marker((int)$_GET['marker_id'])) {
3460
  echo "<script>window.location = \"".get_option('siteurl')."/wp-admin/admin.php?page=wp-google-maps-marker-menu\"</script>";
3461
  } else {
3462
  _e("There was a problem deleting the marker.");;
3463
  }
3464
  } else {
3465
+ $res = wpgmza_get_marker_data((int)$_GET['map_id']);
3466
+ echo "<h2>".__("Delete Marker","wp-google-maps")."</h2><p>".__("Are you sure you want to delete this marker:","wp-google-maps")." <strong>\"".$res->address."?\"</strong> <br /><a href='?page=wp-google-maps-marker-menu&action=trash&marker_id=".(int)$_GET['marker_id']."&s=1'>".__("Yes","wp-google-maps")."</a> | <a href='?page=wp-google-maps-marker-menu'>".__("No","wp-google-maps")."</a></p>";
3467
  }
3468
 
3469
 
4274
 
4275
  function wpgmza_basic_menu() {
4276
 
 
4277
  global $wpgmza_tblname_maps;
4278
  global $wpdb;
4279
+
4280
+ $map_id = isset($_GET['map_id']) ? (int)$_GET['map_id'] : null;
4281
+
4282
+ if ($_GET['action'] == "edit" && $map_id) {
4283
+ $res = wpgmza_get_map_data($map_id);
4284
  if (function_exists("wpgmaps_marker_permission_check")) { wpgmaps_marker_permission_check(); }
4285
 
4286
 
4461
 
4462
  // Admin marker table
4463
  $ajaxParameters = array(
4464
+ 'map_id' => (int)$map_id
4465
  );
4466
 
4467
  $adminMarkerTable = WPGMZA\AdminMarkerDataTable::createInstance($ajaxParameters);
5339
 
5340
  <div id=\"tabs-m-3\" class='wpgmza-open-layers-feature-coming-soon'>
5341
  <h2 style=\"padding-top:0; margin-top:0;\"> ".__("Polygons","wp-google-maps")."</h2>
5342
+ <span id=\"wpgmza_addpolygon_div\"><a href='".get_option('siteurl')."/wp-admin/admin.php?page=wp-google-maps-menu&action=add_poly&map_id=".$map_id."' id='wpgmza_addpoly' class='button-primary' value='".__("Add a New Polygon","wp-google-maps")."' />".__("Add a New Polygon","wp-google-maps")."</a></span>
5343
+ <div id=\"wpgmza_poly_holder\">".wpgmza_b_return_polygon_list($map_id)."</div>
5344
  </div>
5345
  <div id=\"tabs-m-4\" class='wpgmza-open-layers-feature-coming-soon'>
5346
  <h2 style=\"padding-top:0; margin-top:0;\"> ".__("Polylines","wp-google-maps")."</h2>
5347
+ <span id=\"wpgmza_addpolyline_div\"><a href='".get_option('siteurl')."/wp-admin/admin.php?page=wp-google-maps-menu&action=add_polyline&map_id=".$map_id."' id='wpgmza_addpolyline' class='button-primary' value='".__("Add a New Polyline","wp-google-maps")."' />".__("Add a New Polyline","wp-google-maps")."</a></span>
5348
+ <div id=\"wpgmza_polyline_holder\">".wpgmza_b_return_polyline_list($map_id)."</div>
5349
  </div>
5350
 
5351
  <div id=\"tabs-circles\" class='wpgmza-open-layers-feature-coming-soon'>
5352
  <h2>
5353
  " . __('Add a Circle', 'wp-google-maps') . "
5354
  </h2>
5355
+ <span><a class=\"button-primary\" href=\"" . get_option('siteurl') . "/wp-admin/admin.php?page=wp-google-maps-menu&action=add_circle&map_id=" . $map_id . "\">" . __("Add a Circle", "wp-google-maps") . "</a></span>
5356
+ " . wpgmza_get_circles_table($map_id) . "
5357
  </div>
5358
 
5359
  <div id=\"tabs-rectangles\" class='wpgmza-open-layers-feature-coming-soon'>
5360
  <h2>
5361
  " . __('Add a Rectangle', 'wp-google-maps') . "
5362
  </h2>
5363
+ <span><a class=\"button-primary\" href=\"" . get_option('siteurl') . "/wp-admin/admin.php?page=wp-google-maps-menu&action=add_rectangle&map_id=" . $map_id . "\">" . __("Add a Rectangle", "wp-google-maps") . "</a></span>
5364
+ " . wpgmza_get_rectangles_table($map_id) . "
5365
  </div>
5366
 
5367
  <div id=\"tabs-m-5\" class='wpgmza-open-layers-feature-coming-soon'>
6670
  }
6671
  }
6672
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6673
  /**
6674
  * Migrates text lat/lng columns into spatial latlng column if necessary
6675
  * @return void
readme.txt CHANGED
@@ -220,6 +220,15 @@ Please upgrade your version of WP Google Maps to version 6.0.27 as it includes m
220
 
221
  == Changelog ==
222
 
 
 
 
 
 
 
 
 
 
223
  = 7.11.41 :- 2019-07-29 :- Medium priority =
224
  * Fixed store locator not working in OpenLayers since 7.11.40 due to missing nonce
225
 
@@ -1234,3 +1243,5 @@ For more, please view the WP Google Maps site
1234
 
1235
 
1236
 
 
 
220
 
221
  == Changelog ==
222
 
223
+ = 7.11.42 :- 2019-07-30 :- Medium priority =
224
+ * Added checks for ABSPATH to all PHP modules
225
+ * Added a console warning when Array prototype has been improperly extended, which breaks for ... in loops
226
+ * Improved parameter sanitization
227
+ * Dropped deprecated usage tracking function
228
+ * Dropped unused GoogleGeocoder class
229
+ * Dropped old admin head function, added update notice for users running Pro < 5.24
230
+ * Fixed AJAX REST API POST calls always failing nonce security check
231
+
232
  = 7.11.41 :- 2019-07-29 :- Medium priority =
233
  * Fixed store locator not working in OpenLayers since 7.11.40 due to missing nonce
234
 
1243
 
1244
 
1245
 
1246
+
1247
+
wpGoogleMaps.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: WP Google Maps
4
  Plugin URI: https://www.wpgmaps.com
5
  Description: The easiest to use Google Maps plugin! Create custom Google Maps 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.
6
- Version: 7.11.40
7
  Author: WP Google Maps
8
  Author URI: https://www.wpgmaps.com
9
  Text Domain: wp-google-maps
@@ -11,6 +11,15 @@ Domain Path: /languages
11
  */
12
 
13
  /*
 
 
 
 
 
 
 
 
 
14
  * 7.11.41 :- 2019-07-29 :- Medium priority
15
  * Fixed store locator not working in OpenLayers since 7.11.40 due to missing nonce
16
  *
@@ -1032,6 +1041,9 @@ Domain Path: /languages
1032
  *
1033
  */
1034
 
 
 
 
1035
  if(!function_exists('wpgmza_show_php_version_error'))
1036
  {
1037
  function wpgmza_show_php_version_error()
3
  Plugin Name: WP Google Maps
4
  Plugin URI: https://www.wpgmaps.com
5
  Description: The easiest to use Google Maps plugin! Create custom Google Maps 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.
6
+ Version: 7.11.42
7
  Author: WP Google Maps
8
  Author URI: https://www.wpgmaps.com
9
  Text Domain: wp-google-maps
11
  */
12
 
13
  /*
14
+ * 7.11.42 :- 2019-07-30 :- Medium priority
15
+ * Added checks for ABSPATH to all PHP modules
16
+ * Added a console warning when Array prototype has been improperly extended, which breaks for ... in loops
17
+ * Improved parameter sanitization
18
+ * Dropped deprecated usage tracking function
19
+ * Dropped unused GoogleGeocoder class
20
+ * Dropped old admin head function, added update notice for users running Pro < 5.24
21
+ * Fixed AJAX REST API POST calls always failing nonce security check
22
+ *
23
  * 7.11.41 :- 2019-07-29 :- Medium priority
24
  * Fixed store locator not working in OpenLayers since 7.11.40 due to missing nonce
25
  *
1041
  *
1042
  */
1043
 
1044
+ if(!defined('ABSPATH'))
1045
+ exit;
1046
+
1047
  if(!function_exists('wpgmza_show_php_version_error'))
1048
  {
1049
  function wpgmza_show_php_version_error()