Google Maps Widget – Ultimate Google Maps Plugin - Version 4.17

Version Description

  • 2019/08/03
  • removed all tracking functionality
Download this release

Release Info

Developer WebFactory
Plugin Icon 128x128 Google Maps Widget – Ultimate Google Maps Plugin
Version 4.17
Comparing to
See all releases

Code changes from version 4.16 to 4.17

Files changed (3) hide show
  1. gmw-tracking.php +0 -174
  2. google-maps-widget.php +34 -21
  3. readme.txt +6 -2
gmw-tracking.php DELETED
@@ -1,174 +0,0 @@
1
- <?php
2
- /*
3
- * Maps Widget for Google Maps
4
- * Plugin usage tracking
5
- * (c) Web factory Ltd, 2012 - 2018
6
- */
7
-
8
-
9
- // this is an include only WP file
10
- if (!defined('ABSPATH')) {
11
- die;
12
- }
13
-
14
-
15
- class GMW_tracking {
16
- static $cron_biweekly = 'gmw_biweekly_cron';
17
-
18
- // set things up
19
- static function init() {
20
- self::check_opt_in_out();
21
-
22
- add_action(self::$cron_biweekly, array(__CLASS__, 'send_data'));
23
- GMW_tracking::setup_cron();
24
- } // init
25
-
26
-
27
- // register additional cron interval
28
- static function register_cron_intervals($schedules) {
29
- $schedules['gmw_weekly'] = array(
30
- 'interval' => DAY_IN_SECONDS * 7,
31
- 'display' => 'Once a Week');
32
- $schedules['gmw_biweekly'] = array(
33
- 'interval' => DAY_IN_SECONDS * 14,
34
- 'display' => 'Once every two Weeks');
35
-
36
- return $schedules;
37
- } // cron_intervals
38
-
39
-
40
- // clear cron scheadule
41
- static function clear_cron() {
42
- wp_clear_scheduled_hook(self::$cron_biweekly);
43
- } // clear_cron
44
-
45
-
46
- // setup cron job when user allows tracking
47
- static function setup_cron() {
48
- $options = GMW::get_options();
49
-
50
- if (isset($options['allow_tracking']) && $options['allow_tracking'] === true) {
51
- if (!wp_next_scheduled(self::$cron_biweekly)) {
52
- wp_schedule_event(current_time('timestamp') + 60, 'gmw_biweekly', self::$cron_biweekly);
53
- }
54
- } else {
55
- self::clear_cron();
56
- }
57
- } // setup_cron
58
-
59
-
60
- // save user's choice for (not) allowing tracking
61
- static function check_opt_in_out() {
62
- $gmw_tracking = substr(sanitize_key(@$_GET['gmw_tracking']), 0, 32);
63
-
64
- if ($gmw_tracking == 'opt_in') {
65
- GMW::set_options(array('allow_tracking' => true));
66
- self::send_data(true);
67
- wp_safe_redirect(esc_url_raw(remove_query_arg('gmw_tracking')));
68
- die();
69
- } elseif ($gmw_tracking == 'opt_out') {
70
- GMW::set_options(array('allow_tracking' => false));
71
- wp_safe_redirect(esc_url_raw(remove_query_arg('gmw_tracking')));
72
- die();
73
- }
74
- } // check_opt_in_out
75
-
76
-
77
- // display tracking notice
78
- static function tracking_notice() {
79
- $optin_url = add_query_arg('gmw_tracking', 'opt_in');
80
- $optout_url = add_query_arg('gmw_tracking', 'opt_out');
81
-
82
- echo '<div class="updated"><p>';
83
- echo __('Please help us improve <strong>Maps Widget for Google Maps</strong> by allowing tracking of anonymous usage data. Absolutely <strong>no sensitive data is tracked</strong> (<a href="http://www.gmapswidget.com/plugin-tracking-info/" target="_blank">complete disclosure &amp; details of our tracking policy</a>).', 'google-maps-widget');
84
- echo '<br /><a href="' . esc_url($optin_url) . '" style="vertical-align: baseline; margin-top: 15px;" class="button-primary">' . __('Allow', 'google-maps-widget') . '</a>';
85
- echo '&nbsp;&nbsp;<a href="' . esc_url($optout_url) . '" class="">' . __('Do not allow tracking', 'google-maps-widget') . '</a>';
86
- echo '</p></div>';
87
- } // tracking_notice
88
-
89
-
90
- // send usage data once a week to our server
91
- static function send_data($force = false) {
92
- $options = GMW::get_options();
93
-
94
- if ($force == false && (!isset($options['allow_tracking']) || $options['allow_tracking'] !== true)) {
95
- return;
96
- }
97
- if ($force == false && ($options['last_tracking'] && $options['last_tracking'] > strtotime( '-6 days'))) {
98
- return;
99
- }
100
-
101
- $data = self::prepare_data();
102
- $request = wp_remote_post('http://www.gmapswidget.com/tracking.php', array(
103
- 'method' => 'POST',
104
- 'timeout' => 10,
105
- 'redirection' => 3,
106
- 'httpversion' => '1.0',
107
- 'body' => $data,
108
- 'user-agent' => 'GMW/' . GMW::$version));
109
-
110
- $options['last_tracking'] = current_time('timestamp');
111
- update_option(GMW::$options, $options);
112
- } // send_data
113
-
114
-
115
- // get and prepare data that will be sent out
116
- static function prepare_data() {
117
- $options = GMW::get_options();
118
- $data = array();
119
- $current_user = wp_get_current_user();
120
-
121
- $data['url'] = home_url();
122
- if ($current_user && isset($current_user->user_email) && !empty($current_user->user_email)) {
123
- $data['admin_email'] = $current_user->user_email;
124
- } else {
125
- $data['admin_email'] = get_bloginfo('admin_email');
126
- }
127
- $data['wp_version'] = get_bloginfo('version');
128
- $data['gmw_version'] = GMW::$version;
129
- $data['gmw_first_version'] = $options['first_version'];
130
- $data['gmw_first_install'] = $options['first_install'];
131
- $data['ioncube'] = extension_loaded('IonCube Loader');
132
- $data['gmw_count'] = self::count_active_widgets();
133
-
134
- $theme = wp_get_theme();
135
- $data['theme_name'] = $theme->Name;
136
- $data['theme_version'] = $theme->Version;
137
-
138
- // get current plugin information
139
- if (!function_exists('get_plugins')) {
140
- include ABSPATH . '/wp-admin/includes/plugin.php';
141
- }
142
-
143
- $plugins = get_plugins();
144
- $active_plugins = get_option('active_plugins', array());
145
-
146
- foreach ($active_plugins as $plugin) {
147
- $data['plugins'][$plugin] = @$plugins[$plugin];
148
- }
149
-
150
- return $data;
151
- } // prepare_data
152
-
153
-
154
- // counts the number of active GMW widgets in sidebars
155
- static function count_active_widgets() {
156
- $count = 0;
157
-
158
- $sidebars = get_option('sidebars_widgets', array());
159
- foreach ($sidebars as $sidebar_name => $widgets) {
160
- if (strpos($sidebar_name, 'inactive') !== false || strpos($sidebar_name, 'orphaned') !== false) {
161
- continue;
162
- }
163
- if (is_array($widgets)) {
164
- foreach ($widgets as $widget_name) {
165
- if (strpos($widget_name, 'googlemapswidget') !== false) {
166
- $count++;
167
- }
168
- }
169
- }
170
- } // foreach sidebar
171
-
172
- return $count;
173
- } // count_active_widgets
174
- } // class GMW_tracking
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
google-maps-widget.php CHANGED
@@ -4,7 +4,7 @@ Plugin Name: Maps Widget for Google Maps
4
  Plugin URI: https://www.gmapswidget.com/
5
  Description: Display a single image super-fast loading Google Map in a widget. A larger, full featured map is available in a lightbox. Includes a user-friendly interface and numerous appearance options.
6
  Author: WebFactory Ltd
7
- Version: 4.16
8
  Author URI: https://www.gmapswidget.com/
9
  Text Domain: google-maps-widget
10
  Domain Path: lang
@@ -38,7 +38,6 @@ define('GMW_PLUGIN_DIR', plugin_dir_path(__FILE__));
38
  define('GMW_PLUGIN_URL', plugin_dir_url(__FILE__));
39
  define('GMW_BASE_FILE', basename(__FILE__));
40
 
41
- require_once GMW_PLUGIN_DIR . 'gmw-tracking.php';
42
  require_once GMW_PLUGIN_DIR . 'gmw-widget.php';
43
 
44
  class GMW {
@@ -104,9 +103,6 @@ class GMW {
104
  add_action('wp_enqueue_scripts', array('GMW', 'register_scripts'));
105
  add_action('wp_footer', array('GMW', 'dialogs_markup'));
106
  }
107
-
108
- // track plugin usage
109
- GMW_tracking::init();
110
  } // init
111
 
112
 
@@ -115,7 +111,6 @@ class GMW {
115
  GMW::get_plugin_version();
116
 
117
  load_plugin_textdomain('google-maps-widget', false, basename(dirname(__FILE__)) . '/lang');
118
- add_filter('cron_schedules', array('GMW_tracking', 'register_cron_intervals'));
119
  } // plugins_loaded
120
 
121
 
@@ -524,21 +519,12 @@ class GMW {
524
 
525
  // rating notification is shown after 7 days if you have active widgets
526
  if (!$notice && empty($options['dismiss_notice_rate']) &&
527
- GMW_tracking::count_active_widgets() > 0 &&
528
  (current_time('timestamp') - $options['first_install']) > (DAY_IN_SECONDS * 3)) {
529
  add_action('admin_notices', array('GMW', 'notice_rate_plugin'));
530
  $notice = true;
531
  } // show rate notice
532
 
533
- // tracking notification is shown after 20 days
534
- // disabled - will be completely removed soon
535
- if (false && !$notice && !isset($options['allow_tracking']) &&
536
- GMW::is_plugin_admin_page('widgets') &&
537
- ((current_time('timestamp') - $options['first_install']) > (DAY_IN_SECONDS * 20))) {
538
- add_action('admin_notices', array('GMW_tracking', 'tracking_notice'));
539
- $notice = true;
540
- } // show tracking notice
541
-
542
  // upsell to old users
543
  if (!$notice && empty($options['dismiss_notice_olduser']) &&
544
  ((current_time('timestamp') - $options['first_install']) > (DAY_IN_SECONDS * 60))) {
@@ -1054,7 +1040,7 @@ class GMW {
1054
  echo '<tr>
1055
  <th scope="row"><label for="track_ga">' . __('Track with Google Analytics', 'google-maps-widget') . '</label></th>
1056
  <td><input name="' . GMW::$options . '[track_ga]" disabled="disabled" type="checkbox" id="track_ga" value="1"' . checked('1', $options['track_ga'], false) . '>
1057
- <span class="description">Each time the interactive map is opened either in lightbox or as a thumbnail replacement a Google Analytics Event will be tracked.<br>You need to have GA already configured on the site. It is fully compatibile with all GA plugins and all GA tracking code versions. Default: unchecked.</span></td></tr>';
1058
  echo '<tr>
1059
  <th scope="row"><label for="include_jquery">' . __('Include jQuery', 'google-maps-widget') . '</label></th>
1060
  <td><input name="' . GMW::$options . '[include_jquery]" disabled="disabled" type="checkbox" id="include_jquery" value="1"' . checked('1', $options['include_jquery'], false) . '>
@@ -1344,10 +1330,13 @@ class GMW {
1344
  if (!isset($options['first_version']) || !isset($options['first_install'])) {
1345
  $options['first_version'] = GMW::$version;
1346
  $options['first_install'] = current_time('timestamp');
1347
- $options['last_tracking'] = false;
1348
  GMW::set_options($options);
1349
  }
1350
 
 
 
 
 
1351
  self::reset_pointers();
1352
  } // activate
1353
 
@@ -1405,12 +1394,34 @@ class GMW {
1405
  } // plugins_api_result
1406
 
1407
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1408
  // clean up on deactivation
1409
  static function deactivate() {
1410
  $options = GMW::get_options();
1411
 
1412
  if (isset($options['allow_tracking']) && $options['allow_tracking'] === true) {
1413
- GMW_tracking::clear_cron();
1414
  }
1415
 
1416
  delete_transient('gmw_pointers');
@@ -1420,8 +1431,10 @@ class GMW {
1420
  // clean up on uninstall / delete
1421
  static function uninstall() {
1422
  // at the moment, due to lite/pro upgrade we never delete options
1423
- if (false) {
1424
- delete_option(GMW::$options);
 
 
1425
  }
1426
 
1427
  delete_transient('gmw_pointers');
4
  Plugin URI: https://www.gmapswidget.com/
5
  Description: Display a single image super-fast loading Google Map in a widget. A larger, full featured map is available in a lightbox. Includes a user-friendly interface and numerous appearance options.
6
  Author: WebFactory Ltd
7
+ Version: 4.17
8
  Author URI: https://www.gmapswidget.com/
9
  Text Domain: google-maps-widget
10
  Domain Path: lang
38
  define('GMW_PLUGIN_URL', plugin_dir_url(__FILE__));
39
  define('GMW_BASE_FILE', basename(__FILE__));
40
 
 
41
  require_once GMW_PLUGIN_DIR . 'gmw-widget.php';
42
 
43
  class GMW {
103
  add_action('wp_enqueue_scripts', array('GMW', 'register_scripts'));
104
  add_action('wp_footer', array('GMW', 'dialogs_markup'));
105
  }
 
 
 
106
  } // init
107
 
108
 
111
  GMW::get_plugin_version();
112
 
113
  load_plugin_textdomain('google-maps-widget', false, basename(dirname(__FILE__)) . '/lang');
 
114
  } // plugins_loaded
115
 
116
 
519
 
520
  // rating notification is shown after 7 days if you have active widgets
521
  if (!$notice && empty($options['dismiss_notice_rate']) &&
522
+ self::count_active_widgets() > 0 &&
523
  (current_time('timestamp') - $options['first_install']) > (DAY_IN_SECONDS * 3)) {
524
  add_action('admin_notices', array('GMW', 'notice_rate_plugin'));
525
  $notice = true;
526
  } // show rate notice
527
 
 
 
 
 
 
 
 
 
 
528
  // upsell to old users
529
  if (!$notice && empty($options['dismiss_notice_olduser']) &&
530
  ((current_time('timestamp') - $options['first_install']) > (DAY_IN_SECONDS * 60))) {
1040
  echo '<tr>
1041
  <th scope="row"><label for="track_ga">' . __('Track with Google Analytics', 'google-maps-widget') . '</label></th>
1042
  <td><input name="' . GMW::$options . '[track_ga]" disabled="disabled" type="checkbox" id="track_ga" value="1"' . checked('1', $options['track_ga'], false) . '>
1043
+ <span class="description">Each time the interactive map is opened either in lightbox or as a thumbnail replacement a Google Analytics Event will be tracked.<br>You need to have GA already configured on the site. It is fully compatible with all GA plugins and all GA tracking code versions. Default: unchecked.</span></td></tr>';
1044
  echo '<tr>
1045
  <th scope="row"><label for="include_jquery">' . __('Include jQuery', 'google-maps-widget') . '</label></th>
1046
  <td><input name="' . GMW::$options . '[include_jquery]" disabled="disabled" type="checkbox" id="include_jquery" value="1"' . checked('1', $options['include_jquery'], false) . '>
1330
  if (!isset($options['first_version']) || !isset($options['first_install'])) {
1331
  $options['first_version'] = GMW::$version;
1332
  $options['first_install'] = current_time('timestamp');
 
1333
  GMW::set_options($options);
1334
  }
1335
 
1336
+ if (isset($options['allow_tracking']) && $options['allow_tracking'] === true) {
1337
+ wp_clear_scheduled_hook('gmw_biweekly_cron');
1338
+ }
1339
+
1340
  self::reset_pointers();
1341
  } // activate
1342
 
1394
  } // plugins_api_result
1395
 
1396
 
1397
+ // counts the number of active GMW widgets in all sidebars
1398
+ static function count_active_widgets() {
1399
+ $count = 0;
1400
+
1401
+ $sidebars = get_option('sidebars_widgets', array());
1402
+ foreach ($sidebars as $sidebar_name => $widgets) {
1403
+ if (strpos($sidebar_name, 'inactive') !== false || strpos($sidebar_name, 'orphaned') !== false) {
1404
+ continue;
1405
+ }
1406
+ if (is_array($widgets)) {
1407
+ foreach ($widgets as $widget_name) {
1408
+ if (strpos($widget_name, 'googlemapswidget') !== false) {
1409
+ $count++;
1410
+ }
1411
+ }
1412
+ }
1413
+ } // foreach sidebar
1414
+
1415
+ return $count;
1416
+ } // count_active_widgets
1417
+
1418
+
1419
  // clean up on deactivation
1420
  static function deactivate() {
1421
  $options = GMW::get_options();
1422
 
1423
  if (isset($options['allow_tracking']) && $options['allow_tracking'] === true) {
1424
+ wp_clear_scheduled_hook('gmw_biweekly_cron');
1425
  }
1426
 
1427
  delete_transient('gmw_pointers');
1431
  // clean up on uninstall / delete
1432
  static function uninstall() {
1433
  // at the moment, due to lite/pro upgrade we never delete options
1434
+ $options = GMW::get_options();
1435
+
1436
+ if (isset($options['allow_tracking']) && $options['allow_tracking'] === true) {
1437
+ wp_clear_scheduled_hook('gmw_biweekly_cron');
1438
  }
1439
 
1440
  delete_transient('gmw_pointers');
readme.txt CHANGED
@@ -1,11 +1,11 @@
1
- === Maps Widget for Google Maps - Best Maps Plugin ===
2
  Contributors: WebFactory, GoogleMapsWidget, WPReset, securityninja, underconstructionpage
3
  Tags: google maps, maps, map, google map, google maps widget, map markers, wp google maps, wp google map, map plugin, directions, google map plugin, map widget
4
  License: GPLv2 or later
5
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
6
  Requires at least: 4.0
7
  Tested up to: 5.2
8
- Stable tag: 4.16
9
  Requires PHP: 5.2
10
 
11
  Are your Google Maps slow? Try Map Widget for Google Maps. You'll have a fast Google Maps widget with a thumbnail & lightbox in minutes!
@@ -181,6 +181,10 @@ Try <a href="http://www.niftymaps.co">Nifty Maps</a> - a comprehensive Map Build
181
 
182
  == Changelog ==
183
 
 
 
 
 
184
  = 4.16 =
185
  * 2019/07/31
186
  * changed name from Google Maps Widget to Maps Widget for Google Maps
1
+ === Maps Widget for Google Maps - Google Maps Builder ===
2
  Contributors: WebFactory, GoogleMapsWidget, WPReset, securityninja, underconstructionpage
3
  Tags: google maps, maps, map, google map, google maps widget, map markers, wp google maps, wp google map, map plugin, directions, google map plugin, map widget
4
  License: GPLv2 or later
5
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
6
  Requires at least: 4.0
7
  Tested up to: 5.2
8
+ Stable tag: 4.17
9
  Requires PHP: 5.2
10
 
11
  Are your Google Maps slow? Try Map Widget for Google Maps. You'll have a fast Google Maps widget with a thumbnail & lightbox in minutes!
181
 
182
  == Changelog ==
183
 
184
+ = 4.17 =
185
+ * 2019/08/03
186
+ * removed all tracking functionality
187
+
188
  = 4.16 =
189
  * 2019/07/31
190
  * changed name from Google Maps Widget to Maps Widget for Google Maps