Version Description
- 2016/02/23
- security enhancements
Download this release
Release Info
Developer | WebFactory |
Plugin | Google Maps Widget – Ultimate Google Maps Plugin |
Version | 3.10 |
Comparing to | |
See all releases |
Code changes from version 3.05 to 3.10
- google-maps-widget.php +38 -17
- js/gmw-admin.js +23 -16
- readme.txt +5 -1
google-maps-widget.php
CHANGED
@@ -4,7 +4,7 @@ Plugin Name: Google Maps Widget
|
|
4 |
Plugin URI: http://www.gmapswidget.com/
|
5 |
Description: Display a single-image super-fast loading Google map in a widget. A larger, full featured map is available as an image replacement or in a lightbox. Includes shortcode support and numerous options.
|
6 |
Author: Web factory Ltd
|
7 |
-
Version: 3.
|
8 |
Author URI: http://www.webfactoryltd.com/
|
9 |
Text Domain: google-maps-widget
|
10 |
Domain Path: lang
|
@@ -46,7 +46,7 @@ if (file_exists(GMW_PLUGIN_DIR . 'gmw-pro-license.php')) {
|
|
46 |
|
47 |
|
48 |
class GMW {
|
49 |
-
static $version = '3.
|
50 |
static $options = 'gmw_options';
|
51 |
|
52 |
|
@@ -112,9 +112,11 @@ class GMW {
|
|
112 |
|
113 |
// initialize widgets
|
114 |
static function widgets_init() {
|
|
|
|
|
115 |
register_widget('GoogleMapsWidget');
|
116 |
|
117 |
-
if (GMW::is_activated()) {
|
118 |
register_sidebar( array(
|
119 |
'name' => __('Google Maps Widget PRO hidden sidebar', 'google-maps-widget'),
|
120 |
'id' => 'google-maps-widget-hidden',
|
@@ -180,13 +182,14 @@ class GMW {
|
|
180 |
case 'include_lightbox_css':
|
181 |
case 'include_lightbox_js':
|
182 |
case 'disable_tooltips':
|
|
|
183 |
$values[$key] = (int) $value;
|
184 |
break;
|
185 |
} // switch
|
186 |
} // foreach
|
187 |
|
188 |
if (GMW::is_activated()) {
|
189 |
-
$values = GMW::check_var_isset($values, array('track_ga' => 0, 'include_jquery' => 0, 'include_lightbox_js' => '0', 'include_lightbox_css' => '0', 'disable_tooltips' => '0'));
|
190 |
}
|
191 |
|
192 |
if (strlen($values['api_key']) < 30) {
|
@@ -220,6 +223,7 @@ class GMW {
|
|
220 |
'include_lightbox_js' => '1',
|
221 |
'include_lightbox_css' => '1',
|
222 |
'disable_tooltips' => '0',
|
|
|
223 |
'activation_code' => '',
|
224 |
'license_active' => '',
|
225 |
'license_expires' => '',
|
@@ -237,10 +241,7 @@ class GMW {
|
|
237 |
if (!is_array($options)) {
|
238 |
$options = array();
|
239 |
}
|
240 |
-
|
241 |
-
$options = array_merge(GMW::default_options(), $options);
|
242 |
-
update_option(GMW::$options, $options, true);
|
243 |
-
}
|
244 |
|
245 |
return $options;
|
246 |
} // get_options
|
@@ -336,11 +337,13 @@ class GMW {
|
|
336 |
|
337 |
// checkes if API key is active for all needed API services
|
338 |
static function test_api_key_ajax() {
|
|
|
|
|
339 |
$msg = '';
|
340 |
$error = false;
|
341 |
$api_key = trim(@$_GET['api_key']);
|
342 |
|
343 |
-
$test = wp_remote_get('https://maps.googleapis.com/maps/api/staticmap?center=new+york+usa&size=100x100&key=' . $api_key);
|
344 |
if (wp_remote_retrieve_response_message($test) == 'OK') {
|
345 |
$msg .= 'Google Static Maps API test - OK' . "\n";
|
346 |
} else {
|
@@ -348,7 +351,7 @@ class GMW {
|
|
348 |
$error = true;
|
349 |
}
|
350 |
|
351 |
-
$test = wp_remote_get('https://www.google.com/maps/embed/v1/place?q=new+york+usa&key=' . $api_key);
|
352 |
if (wp_remote_retrieve_response_message($test) == 'OK') {
|
353 |
$msg .= 'Google Embed Maps API test - OK' . "\n\n";
|
354 |
} else {
|
@@ -430,7 +433,7 @@ class GMW {
|
|
430 |
|
431 |
if ($force_refresh || ($data = get_transient($address_hash)) === false) {
|
432 |
$url = 'https://maps.googleapis.com/maps/api/geocode/xml?address=' . urlencode($address) . '&sensor=false';
|
433 |
-
$result = wp_remote_get($url, array('sslverify' => false, 'timeout' => 5));
|
434 |
|
435 |
if (!is_wp_error($result) && $result['response']['code'] == 200) {
|
436 |
$data = new SimpleXMLElement($result['body']);
|
@@ -588,8 +591,10 @@ class GMW {
|
|
588 |
$notice = false;
|
589 |
|
590 |
// license expire notice is always shown
|
591 |
-
if (!$notice && GMW::is_activated() && empty($options['dismiss_notice_license_expires']) &&
|
592 |
-
(strtotime($options['license_expires']) - time() < DAY_IN_SECONDS * 15))
|
|
|
|
|
593 |
add_action('admin_notices', array('GMW', 'notice_license_expires'));
|
594 |
$notice = true;
|
595 |
} // show license expire notice
|
@@ -643,11 +648,15 @@ class GMW {
|
|
643 |
} else {
|
644 |
echo '<b>has expired</b>!';
|
645 |
}
|
646 |
-
echo ' <a href="' . esc_url($buy_url) . '">Renew now</a> and for a limited time pay only as much as
|
647 |
-
|
|
|
|
|
|
|
|
|
648 |
|
649 |
echo '<br><a href="' . esc_url($buy_url) . '" style="vertical-align: baseline; margin-top: 15px;" class="button-primary">' . __('Pay what you think is fair', 'google-maps-widget') . '</a>';
|
650 |
-
echo ' <a href="' . esc_url($dismiss_url) . '" class="">' . __('I will pay the full price later', 'google-maps-widget') . '</a>';
|
651 |
echo '</p></div>';
|
652 |
} // notice_license_expires
|
653 |
|
@@ -748,7 +757,9 @@ class GMW {
|
|
748 |
'marker' => false,
|
749 |
'pins_library' => plugins_url('/images/pins/', __FILE__),
|
750 |
'disable_tooltips' => $options['disable_tooltips'],
|
751 |
-
'is_activated' => GMW::is_activated()
|
|
|
|
|
752 |
wp_localize_script('gmw-admin', 'gmw', $js_localize);
|
753 |
} // if
|
754 |
} // admin_enqueue_scripts
|
@@ -946,6 +957,10 @@ class GMW {
|
|
946 |
|
947 |
// complete options screen markup
|
948 |
static function settings_screen() {
|
|
|
|
|
|
|
|
|
949 |
$options = GMW::get_options();
|
950 |
|
951 |
echo '<div class="wrap gmw-options">';
|
@@ -1005,6 +1020,10 @@ class GMW {
|
|
1005 |
<th scope="row"><label for="disable_tooltips">' . __('Disable Admin Tooltips', 'google-maps-widget') . '</label></th>
|
1006 |
<td><input name="' . GMW::$options . '[disable_tooltips]" type="checkbox" id="disable_tooltips" value="1"' . checked('1', $options['disable_tooltips'], false) . '>
|
1007 |
<span class="description">All settings in widget edit GUI have tooltips. This setting completely disables them. Default: unchecked.</span></td></tr>';
|
|
|
|
|
|
|
|
|
1008 |
echo '</table>';
|
1009 |
} // advanced settings
|
1010 |
|
@@ -1070,6 +1089,8 @@ class GMW {
|
|
1070 |
|
1071 |
// check activation code and save if valid
|
1072 |
static function activate_license_key_ajax() {
|
|
|
|
|
1073 |
$code = str_replace(' ', '', $_POST['code']);
|
1074 |
|
1075 |
if (strlen($code) < 6 || strlen($code) > 50) {
|
4 |
Plugin URI: http://www.gmapswidget.com/
|
5 |
Description: Display a single-image super-fast loading Google map in a widget. A larger, full featured map is available as an image replacement or in a lightbox. Includes shortcode support and numerous options.
|
6 |
Author: Web factory Ltd
|
7 |
+
Version: 3.10
|
8 |
Author URI: http://www.webfactoryltd.com/
|
9 |
Text Domain: google-maps-widget
|
10 |
Domain Path: lang
|
46 |
|
47 |
|
48 |
class GMW {
|
49 |
+
static $version = '3.10';
|
50 |
static $options = 'gmw_options';
|
51 |
|
52 |
|
112 |
|
113 |
// initialize widgets
|
114 |
static function widgets_init() {
|
115 |
+
$options = GMW::get_options();
|
116 |
+
|
117 |
register_widget('GoogleMapsWidget');
|
118 |
|
119 |
+
if (GMW::is_activated() && !$options['disable_sidebar']) {
|
120 |
register_sidebar( array(
|
121 |
'name' => __('Google Maps Widget PRO hidden sidebar', 'google-maps-widget'),
|
122 |
'id' => 'google-maps-widget-hidden',
|
182 |
case 'include_lightbox_css':
|
183 |
case 'include_lightbox_js':
|
184 |
case 'disable_tooltips':
|
185 |
+
case 'disable_sidebar':
|
186 |
$values[$key] = (int) $value;
|
187 |
break;
|
188 |
} // switch
|
189 |
} // foreach
|
190 |
|
191 |
if (GMW::is_activated()) {
|
192 |
+
$values = GMW::check_var_isset($values, array('track_ga' => 0, 'include_jquery' => 0, 'include_lightbox_js' => '0', 'include_lightbox_css' => '0', 'disable_tooltips' => '0', 'disable_sidebar' => '0'));
|
193 |
}
|
194 |
|
195 |
if (strlen($values['api_key']) < 30) {
|
223 |
'include_lightbox_js' => '1',
|
224 |
'include_lightbox_css' => '1',
|
225 |
'disable_tooltips' => '0',
|
226 |
+
'disable_sidebar' => '0',
|
227 |
'activation_code' => '',
|
228 |
'license_active' => '',
|
229 |
'license_expires' => '',
|
241 |
if (!is_array($options)) {
|
242 |
$options = array();
|
243 |
}
|
244 |
+
$options = array_merge(GMW::default_options(), $options);
|
|
|
|
|
|
|
245 |
|
246 |
return $options;
|
247 |
} // get_options
|
337 |
|
338 |
// checkes if API key is active for all needed API services
|
339 |
static function test_api_key_ajax() {
|
340 |
+
check_ajax_referer('gmw_test_api_key');
|
341 |
+
|
342 |
$msg = '';
|
343 |
$error = false;
|
344 |
$api_key = trim(@$_GET['api_key']);
|
345 |
|
346 |
+
$test = wp_remote_get(esc_url_raw('https://maps.googleapis.com/maps/api/staticmap?center=new+york+usa&size=100x100&key=' . $api_key));
|
347 |
if (wp_remote_retrieve_response_message($test) == 'OK') {
|
348 |
$msg .= 'Google Static Maps API test - OK' . "\n";
|
349 |
} else {
|
351 |
$error = true;
|
352 |
}
|
353 |
|
354 |
+
$test = wp_remote_get(esc_url_raw('https://www.google.com/maps/embed/v1/place?q=new+york+usa&key=' . $api_key));
|
355 |
if (wp_remote_retrieve_response_message($test) == 'OK') {
|
356 |
$msg .= 'Google Embed Maps API test - OK' . "\n\n";
|
357 |
} else {
|
433 |
|
434 |
if ($force_refresh || ($data = get_transient($address_hash)) === false) {
|
435 |
$url = 'https://maps.googleapis.com/maps/api/geocode/xml?address=' . urlencode($address) . '&sensor=false';
|
436 |
+
$result = wp_remote_get(esc_url_raw($url), array('sslverify' => false, 'timeout' => 5));
|
437 |
|
438 |
if (!is_wp_error($result) && $result['response']['code'] == 200) {
|
439 |
$data = new SimpleXMLElement($result['body']);
|
591 |
$notice = false;
|
592 |
|
593 |
// license expire notice is always shown
|
594 |
+
if ((!$notice && GMW::is_activated() && empty($options['dismiss_notice_license_expires']) &&
|
595 |
+
(strtotime($options['license_expires']) - time() < DAY_IN_SECONDS * 15)) ||
|
596 |
+
(!$notice && empty($options['dismiss_notice_license_expires']) &&
|
597 |
+
$options['license_expires'] < date('Y-m-d') && $options['license_active'] == true)) {
|
598 |
add_action('admin_notices', array('GMW', 'notice_license_expires'));
|
599 |
$notice = true;
|
600 |
} // show license expire notice
|
648 |
} else {
|
649 |
echo '<b>has expired</b>!';
|
650 |
}
|
651 |
+
echo ' <a href="' . esc_url($buy_url) . '">Renew now</a> and for a limited time pay only as much as <b>you think is fair</b>!<br>';
|
652 |
+
if ($days >= 0) {
|
653 |
+
echo 'All <b style="color: #d54e21;">PRO</b> features will be disabled once the license expires.';
|
654 |
+
} else {
|
655 |
+
echo 'All <b style="color: #d54e21;">PRO</b> features have been disabled.';
|
656 |
+
}
|
657 |
|
658 |
echo '<br><a href="' . esc_url($buy_url) . '" style="vertical-align: baseline; margin-top: 15px;" class="button-primary">' . __('Pay what you think is fair', 'google-maps-widget') . '</a>';
|
659 |
+
echo ' <a href="' . esc_url($dismiss_url) . '" class="">' . __('I will pay the full price ($29) later', 'google-maps-widget') . '</a>';
|
660 |
echo '</p></div>';
|
661 |
} // notice_license_expires
|
662 |
|
757 |
'marker' => false,
|
758 |
'pins_library' => plugins_url('/images/pins/', __FILE__),
|
759 |
'disable_tooltips' => $options['disable_tooltips'],
|
760 |
+
'is_activated' => GMW::is_activated(),
|
761 |
+
'nonce_test_api_key' => wp_create_nonce('gmw_test_api_key'),
|
762 |
+
'nonce_activate_license_key' => wp_create_nonce('gmw_activate_license_key'));
|
763 |
wp_localize_script('gmw-admin', 'gmw', $js_localize);
|
764 |
} // if
|
765 |
} // admin_enqueue_scripts
|
957 |
|
958 |
// complete options screen markup
|
959 |
static function settings_screen() {
|
960 |
+
if (!current_user_can('manage_options')) {
|
961 |
+
wp_die('Cheating? You don\'t have the right to access this page.', 'Google Maps Widget', array('back_link' => true));
|
962 |
+
}
|
963 |
+
|
964 |
$options = GMW::get_options();
|
965 |
|
966 |
echo '<div class="wrap gmw-options">';
|
1020 |
<th scope="row"><label for="disable_tooltips">' . __('Disable Admin Tooltips', 'google-maps-widget') . '</label></th>
|
1021 |
<td><input name="' . GMW::$options . '[disable_tooltips]" type="checkbox" id="disable_tooltips" value="1"' . checked('1', $options['disable_tooltips'], false) . '>
|
1022 |
<span class="description">All settings in widget edit GUI have tooltips. This setting completely disables them. Default: unchecked.</span></td></tr>';
|
1023 |
+
echo '<tr>
|
1024 |
+
<th scope="row"><label for="disable_sidebar">' . __('Disable Hidden Sidebar', 'google-maps-widget') . '</label></th>
|
1025 |
+
<td><input name="' . GMW::$options . '[disable_sidebar]" type="checkbox" id="disable_sidebar" value="1"' . checked('1', $options['disable_sidebar'], false) . '>
|
1026 |
+
<span class="description">Hidden sidebar helps you to build maps that are displayed with shortcodes. If it bothers you in the admin, disable it. Default: unchecked.</span></td></tr>';
|
1027 |
echo '</table>';
|
1028 |
} // advanced settings
|
1029 |
|
1089 |
|
1090 |
// check activation code and save if valid
|
1091 |
static function activate_license_key_ajax() {
|
1092 |
+
check_ajax_referer('gmw_activate_license_key');
|
1093 |
+
|
1094 |
$code = str_replace(' ', '', $_POST['code']);
|
1095 |
|
1096 |
if (strlen($code) < 6 || strlen($code) > 50) {
|
js/gmw-admin.js
CHANGED
@@ -24,7 +24,7 @@ jQuery(function($) {
|
|
24 |
|
25 |
return false;
|
26 |
}); // open promo dialog
|
27 |
-
|
28 |
|
29 |
// branding for widget title
|
30 |
if (gmw.is_activated) {
|
@@ -344,18 +344,21 @@ jQuery(function($) {
|
|
344 |
$('#gmw_promo_dialog input').addClass('gmw_spinner').addClass('gmw_disabled');
|
345 |
$('#gmw_activate').addClass('gmw_disabled');
|
346 |
|
347 |
-
$.post(ajaxurl, { action: 'gmw_activate', 'code': $('#gmw_code').val()
|
348 |
-
|
349 |
-
|
350 |
-
|
351 |
-
|
352 |
-
|
353 |
-
|
354 |
-
|
355 |
-
|
356 |
-
|
357 |
-
|
358 |
-
|
|
|
|
|
|
|
359 |
.fail(function() {
|
360 |
alert(gmw.undocumented_error);
|
361 |
})
|
@@ -624,10 +627,14 @@ jQuery(function($) {
|
|
624 |
|
625 |
$(button).addClass('gmw_spinner').addClass('gmw_disabled');
|
626 |
|
627 |
-
$.get(ajaxurl, {'action': 'gmw_test_api_key', 'api_key': api_key},
|
628 |
function(response) {
|
629 |
-
|
630 |
-
|
|
|
|
|
|
|
|
|
631 |
).fail(function(response) {
|
632 |
alert(gmw.undocumented_error);
|
633 |
}).always(function(response) {
|
24 |
|
25 |
return false;
|
26 |
}); // open promo dialog
|
27 |
+
|
28 |
|
29 |
// branding for widget title
|
30 |
if (gmw.is_activated) {
|
344 |
$('#gmw_promo_dialog input').addClass('gmw_spinner').addClass('gmw_disabled');
|
345 |
$('#gmw_activate').addClass('gmw_disabled');
|
346 |
|
347 |
+
$.post(ajaxurl, { 'action': 'gmw_activate', 'code': $('#gmw_code').val(), '_ajax_nonce': gmw.nonce_activate_license_key},
|
348 |
+
function(response) {
|
349 |
+
if (typeof response != 'object') {
|
350 |
+
alert(gmw.undocumented_error);
|
351 |
+
} else if (response.success === true) {
|
352 |
+
alert(gmw.activate_ok);
|
353 |
+
tmp = window.location.pathname + window.location.search;
|
354 |
+
tmp = tmp.replace('gmw_open_promo_dialog', '');
|
355 |
+
window.location = tmp;
|
356 |
+
} else {
|
357 |
+
$('#gmw_promo_dialog input').addClass('error');
|
358 |
+
$('#gmw_promo_dialog span.error.gmw_code').html(response.data).show();
|
359 |
+
$('#gmw_code').focus().select();
|
360 |
+
}
|
361 |
+
}, 'json')
|
362 |
.fail(function() {
|
363 |
alert(gmw.undocumented_error);
|
364 |
})
|
627 |
|
628 |
$(button).addClass('gmw_spinner').addClass('gmw_disabled');
|
629 |
|
630 |
+
$.get(ajaxurl, {'action': 'gmw_test_api_key', 'api_key': api_key, '_ajax_nonce': gmw.nonce_test_api_key},
|
631 |
function(response) {
|
632 |
+
if (typeof response == 'object') {
|
633 |
+
alert(response.data);
|
634 |
+
} else {
|
635 |
+
alert(gmw.undocumented_error);
|
636 |
+
}
|
637 |
+
}, 'json'
|
638 |
).fail(function(response) {
|
639 |
alert(gmw.undocumented_error);
|
640 |
}).always(function(response) {
|
readme.txt
CHANGED
@@ -6,7 +6,7 @@ License: GPLv2 or later
|
|
6 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
7 |
Requires at least: 3.8
|
8 |
Tested up to: 4.4
|
9 |
-
Stable tag: 3.
|
10 |
|
11 |
Displays a single image, super-fast loading Google map in a widget. A larger map with all interactive features is available on click in a lightbox.
|
12 |
|
@@ -142,6 +142,10 @@ Read the <a href="http://wordpress.org/support/plugin/google-maps-widget">suppor
|
|
142 |
|
143 |
== Changelog ==
|
144 |
|
|
|
|
|
|
|
|
|
145 |
= 3.05 =
|
146 |
* 2016/02/19
|
147 |
* few minor bug fixes
|
6 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
7 |
Requires at least: 3.8
|
8 |
Tested up to: 4.4
|
9 |
+
Stable tag: 3.10
|
10 |
|
11 |
Displays a single image, super-fast loading Google map in a widget. A larger map with all interactive features is available on click in a lightbox.
|
12 |
|
142 |
|
143 |
== Changelog ==
|
144 |
|
145 |
+
= 3.10 =
|
146 |
+
* 2016/02/23
|
147 |
+
* security enhancements
|
148 |
+
|
149 |
= 3.05 =
|
150 |
* 2016/02/19
|
151 |
* few minor bug fixes
|