Version Description
- 2016/03/07
- widgets can now be cloned
- minor fixes
Download this release
Release Info
Developer | WebFactory |
Plugin | Google Maps Widget – Ultimate Google Maps Plugin |
Version | 3.15 |
Comparing to | |
See all releases |
Code changes from version 3.10 to 3.15
- css/gmw-admin.css +27 -5
- gmw-widget.php +3 -3
- google-maps-widget.php +25 -12
- js/gmw-admin.js +103 -2
- readme.txt +8 -1
css/gmw-admin.css
CHANGED
@@ -154,7 +154,7 @@ body.widgets-php .select2-container--default .select2-results__option[aria-disab
|
|
154 |
.gmw-dialog .footer {
|
155 |
padding: 20px 135px;
|
156 |
background-color: #303030;
|
157 |
-
color:
|
158 |
}
|
159 |
|
160 |
.gmw-dialog .content {
|
@@ -261,10 +261,6 @@ body.widgets-php .select2-container--default .select2-results__option[aria-disab
|
|
261 |
text-shadow: none;
|
262 |
}
|
263 |
|
264 |
-
.gmw-dialog a {
|
265 |
-
color: #999;
|
266 |
-
}
|
267 |
-
|
268 |
#gmw_promo_dialog span.error {
|
269 |
color: #dd3d36;
|
270 |
padding: 8px 0 0 1px;
|
@@ -587,6 +583,32 @@ ul.ui-tabs-nav{
|
|
587 |
background: rgba(0,0,0,0.15);
|
588 |
}
|
589 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
590 |
.gmw-footer-intro {
|
591 |
display: block;
|
592 |
padding: 25px 0px;
|
154 |
.gmw-dialog .footer {
|
155 |
padding: 20px 135px;
|
156 |
background-color: #303030;
|
157 |
+
color: #333;
|
158 |
}
|
159 |
|
160 |
.gmw-dialog .content {
|
261 |
text-shadow: none;
|
262 |
}
|
263 |
|
|
|
|
|
|
|
|
|
264 |
#gmw_promo_dialog span.error {
|
265 |
color: #dd3d36;
|
266 |
padding: 8px 0 0 1px;
|
583 |
background: rgba(0,0,0,0.15);
|
584 |
}
|
585 |
|
586 |
+
.gmw_goto_trial.button-secondary {
|
587 |
+
border: 2px solid #666;
|
588 |
+
box-shadow: none !important;
|
589 |
+
border-radius: 4px;
|
590 |
+
background: #fff;
|
591 |
+
color: #666;
|
592 |
+
font-weight: bold;
|
593 |
+
text-transform: uppercase;
|
594 |
+
font-size: 12px;
|
595 |
+
padding: 10px 20px;
|
596 |
+
text-shadow:none !important;
|
597 |
+
height: auto !important;
|
598 |
+
margin-left: 20px;
|
599 |
+
margin-top: 20px;
|
600 |
+
display: none;
|
601 |
+
}
|
602 |
+
|
603 |
+
.gmw_goto_trial.button-secondary:hover {
|
604 |
+
background: rgba(0,0,0,0.15);
|
605 |
+
}
|
606 |
+
|
607 |
+
.footer .gmw_goto_trial {
|
608 |
+
background: #f5f5f5;
|
609 |
+
margin-top: 0;
|
610 |
+
}
|
611 |
+
|
612 |
.gmw-footer-intro {
|
613 |
display: block;
|
614 |
padding: 25px 0px;
|
gmw-widget.php
CHANGED
@@ -75,7 +75,7 @@ class GoogleMapsWidget extends WP_Widget {
|
|
75 |
// widget edit form HTML
|
76 |
function form($instance) {
|
77 |
$options = GMW::get_options();
|
78 |
-
$instance =
|
79 |
extract($instance, EXTR_SKIP);
|
80 |
|
81 |
$thumb_map_types = array(array('val' => 'roadmap', 'label' => __('Road (default)', 'google-maps-widget')),
|
@@ -599,7 +599,7 @@ class GoogleMapsWidget extends WP_Widget {
|
|
599 |
$map_params = array();
|
600 |
|
601 |
$options = GMW::get_options();
|
602 |
-
$instance =
|
603 |
|
604 |
$map_src = '//maps.googleapis.com/maps/api/staticmap';
|
605 |
|
@@ -701,7 +701,7 @@ class GoogleMapsWidget extends WP_Widget {
|
|
701 |
|
702 |
|
703 |
// compatibility fixes for widgets prior to v3.0
|
704 |
-
|
705 |
$instance = wp_parse_args((array) $instance, self::$defaults);
|
706 |
|
707 |
if (isset($instance['core_ver']) && version_compare($instance['core_ver'], '3.0', '>=')) {
|
75 |
// widget edit form HTML
|
76 |
function form($instance) {
|
77 |
$options = GMW::get_options();
|
78 |
+
$instance = $this->upgrade_wiget_instance($instance);
|
79 |
extract($instance, EXTR_SKIP);
|
80 |
|
81 |
$thumb_map_types = array(array('val' => 'roadmap', 'label' => __('Road (default)', 'google-maps-widget')),
|
599 |
$map_params = array();
|
600 |
|
601 |
$options = GMW::get_options();
|
602 |
+
$instance = $this->upgrade_wiget_instance($instance);
|
603 |
|
604 |
$map_src = '//maps.googleapis.com/maps/api/staticmap';
|
605 |
|
701 |
|
702 |
|
703 |
// compatibility fixes for widgets prior to v3.0
|
704 |
+
function upgrade_wiget_instance($instance) {
|
705 |
$instance = wp_parse_args((array) $instance, self::$defaults);
|
706 |
|
707 |
if (isset($instance['core_ver']) && version_compare($instance['core_ver'], '3.0', '>=')) {
|
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 |
|
@@ -278,7 +278,7 @@ class GMW {
|
|
278 |
static function plugin_meta_links($links, $file) {
|
279 |
$documentation_link = '<a target="_blank" href="http://www.gmapswidget.com/documentation/" title="' . __('View Google Maps Widget documentation', 'google-maps-widget') . '">'. __('Documentation', 'google-maps-widget') . '</a>';
|
280 |
if (GMW::is_activated()) {
|
281 |
-
$support_link = '<a
|
282 |
} else {
|
283 |
$support_link = '<a target="_blank" href="http://wordpress.org/support/plugin/google-maps-widget" title="' . __('Problems? We are here to help!', 'google-maps-widget') . '">' . __('Support', 'google-maps-widget') . '</a>';
|
284 |
}
|
@@ -318,7 +318,12 @@ class GMW {
|
|
318 |
// get users maps api key or one of temporary plugin ones
|
319 |
static function get_api_key($type = 'static') {
|
320 |
$options = GMW::get_options();
|
321 |
-
$default_api_keys = array('AIzaSyB35Ukt8bKRSY-mII-1Q7DmVx8LnlpmND0',
|
|
|
|
|
|
|
|
|
|
|
322 |
|
323 |
if ($type == 'static') {
|
324 |
return $options['api_key'];
|
@@ -792,7 +797,7 @@ class GMW {
|
|
792 |
if (isset($options['license_active']) && $options['license_active'] === true &&
|
793 |
isset($options['license_expires']) && $options['license_expires'] >= date('Y-m-d')) {
|
794 |
|
795 |
-
if (mt_rand(0, 1000)
|
796 |
$tmp = GMW::validate_activation_code($options['activation_code']);
|
797 |
if ($tmp['success']) {
|
798 |
$update['license_type'] = $tmp['license_type'];
|
@@ -827,7 +832,7 @@ class GMW {
|
|
827 |
|
828 |
$out .= '<div id="gmw_dialog_intro" class="gmw_promo_dialog_screen">
|
829 |
<div class="content">
|
830 |
-
<div class="center boxed-h">Not sure if it\'s worth it? See everything <span class="gmw-pro-red">PRO</span> has to offer.<br><a href="#" class="button-secondary gmw_goto_pro">See PRO features</a></div>';
|
831 |
$out .= '<div class="gmw-left-box gmw-content-box">
|
832 |
<h3>Buy PRO</h3>
|
833 |
<p><strike><i>$29</i></strike> $19 for unlimited sites</p>
|
@@ -890,7 +895,8 @@ class GMW {
|
|
890 |
<li>4 map modes; directions, view, street & streetview</li>
|
891 |
<li>fully customizable pin options for thumbnail map</li>
|
892 |
<li>Advanced cache & fastest loading times</li>
|
893 |
-
<li>JS & CSS optimization options</li>
|
|
|
894 |
$out .= '</ul>';
|
895 |
$out .= '<ul class="list-right">';
|
896 |
$out .= '<li>3 additional map link types</li>
|
@@ -898,6 +904,7 @@ class GMW {
|
|
898 |
<li>extra lightbox features</li>
|
899 |
<li>19 lightbox skins</li>
|
900 |
<li>full shortcode support</li>
|
|
|
901 |
<li>export & import tools</li>
|
902 |
<li>Google Analytics integration</li>
|
903 |
<li>no ads</li>
|
@@ -906,11 +913,16 @@ class GMW {
|
|
906 |
$out .= '</ul>';
|
907 |
$out .= ' </div>';
|
908 |
$out .= '<div class="footer">';
|
909 |
-
$out .= '<p class="center"><a href="#" class="button-secondary gmw_goto_intro">Go PRO now</a><br>
|
910 |
Or <a href="#" class="gmw_goto_activation">enter the license key</a> if you already have it.</p>';
|
911 |
$out .= '</div>';
|
912 |
$out .= '</div>'; // pro features screen
|
913 |
|
|
|
|
|
|
|
|
|
|
|
914 |
$out .= '</div>'; // dialog
|
915 |
} // promo dialog
|
916 |
|
@@ -979,14 +991,15 @@ class GMW {
|
|
979 |
echo '<li><a href="#gmw-license">' . __('License', 'google-maps-widget') . '</a></li>';
|
980 |
echo '</ul>';
|
981 |
|
982 |
-
echo '<div id="gmw-settings">';
|
983 |
echo '<table class="form-table">';
|
984 |
echo '<tr>
|
985 |
<th scope="row"><label for="api_key">' . __('Google Maps API Key', 'google-maps-widget') . '</label></th>
|
986 |
<td><input name="' . GMW::$options . '[api_key]" type="text" id="api_key" value="' . esc_attr($options['api_key']) . '" class="regular-text" placeholder="Google Maps API key" oninput="setCustomValidity(\'\')" oninvalid="this.setCustomValidity(\'Please use Google Developers Console to generate an API key and enter it here. It is completely free.\')"> <a href="#" class="button button-secondary gmw-test-api-key">Test API key</a>
|
987 |
<p class="description">New Google Maps usage policy dictates that everyone using the maps should register for a free API key.<br>
|
988 |
Please create a key for "Google Static Maps API" and "Google Maps Embed API" using the <a href="https://console.developers.google.com/project" target="blank">Google Developers Console</a>.<br>
|
989 |
-
Or use <a href="https://console.developers.google.com/flows/enableapi?apiid=maps_embed_backend&keyType=CLIENT_SIDE&reusekey=true" target="_blank">wizard step #1</a> - login, click next a few times & copy the key. Then use <a href="https://console.developers.google.com/flows/enableapi?apiid=static_maps_backend&keyType=CLIENT_SIDE&reusekey=true" target="_blank">wizard step #2</a> and select the same "My Project"
|
|
|
990 |
</tr>';
|
991 |
if (GMW::is_activated()) {
|
992 |
echo '<tr>
|
@@ -1034,7 +1047,7 @@ class GMW {
|
|
1034 |
echo get_submit_button(__('Save Settings', 'google-maps-widget'));
|
1035 |
echo '</div>'; // settings tab
|
1036 |
|
1037 |
-
echo '<div id="gmw-export">';
|
1038 |
if (GMW::is_activated('pro')) {
|
1039 |
echo '<table class="form-table">';
|
1040 |
echo '<tr>
|
@@ -1055,7 +1068,7 @@ class GMW {
|
|
1055 |
}
|
1056 |
echo '</div>'; // export/import tab
|
1057 |
|
1058 |
-
echo '<div id="gmw-license">';
|
1059 |
if (!GMW::is_activated()) {
|
1060 |
echo '<p>Not sure if you should upgrade to <span class="gmw-pro-red">PRO</span>? It offers more than 50 extra features; <a href="#" class="open_promo_dialog">compare features now</a>.</p>';
|
1061 |
}
|
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.15
|
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.15';
|
50 |
static $options = 'gmw_options';
|
51 |
|
52 |
|
278 |
static function plugin_meta_links($links, $file) {
|
279 |
$documentation_link = '<a target="_blank" href="http://www.gmapswidget.com/documentation/" title="' . __('View Google Maps Widget documentation', 'google-maps-widget') . '">'. __('Documentation', 'google-maps-widget') . '</a>';
|
280 |
if (GMW::is_activated()) {
|
281 |
+
$support_link = '<a href="mailto:gmw@webfactoryltd.com?subject=GMW%20support" title="' . __('Problems? We are here to help!', 'google-maps-widget') . '">' . __('Support', 'google-maps-widget') . '</a>';
|
282 |
} else {
|
283 |
$support_link = '<a target="_blank" href="http://wordpress.org/support/plugin/google-maps-widget" title="' . __('Problems? We are here to help!', 'google-maps-widget') . '">' . __('Support', 'google-maps-widget') . '</a>';
|
284 |
}
|
318 |
// get users maps api key or one of temporary plugin ones
|
319 |
static function get_api_key($type = 'static') {
|
320 |
$options = GMW::get_options();
|
321 |
+
$default_api_keys = array('AIzaSyB35Ukt8bKRSY-mII-1Q7DmVx8LnlpmND0',
|
322 |
+
'AIzaSyCsY7jqJLTFBtRsGLcb-JQOhW6910qh1ts',
|
323 |
+
'AIzaSyDawXzxQurkSkkTxzzW-WRYKmia_Y28S1Q',
|
324 |
+
'AIzaSyArcXkQ15FoOTS2Z7El2SJHDIlTMW7Rxxg',
|
325 |
+
'AIzaSyBVJ4JR63d1JIL8L6b_emat-_jXMcHveR0',
|
326 |
+
'AIzaSyDOobziwX_9-4JuAgqIlTUZgXAss7zIIEM');
|
327 |
|
328 |
if ($type == 'static') {
|
329 |
return $options['api_key'];
|
797 |
if (isset($options['license_active']) && $options['license_active'] === true &&
|
798 |
isset($options['license_expires']) && $options['license_expires'] >= date('Y-m-d')) {
|
799 |
|
800 |
+
if (mt_rand(0, 1000) > 995 && is_admin()) {
|
801 |
$tmp = GMW::validate_activation_code($options['activation_code']);
|
802 |
if ($tmp['success']) {
|
803 |
$update['license_type'] = $tmp['license_type'];
|
832 |
|
833 |
$out .= '<div id="gmw_dialog_intro" class="gmw_promo_dialog_screen">
|
834 |
<div class="content">
|
835 |
+
<div class="center boxed-h">Not sure if it\'s worth it? See everything <span class="gmw-pro-red">PRO</span> has to offer.<br><a href="#" class="button-secondary gmw_goto_pro">See PRO features</a> <a href="#" class="button-secondary gmw_goto_trial">Start a free trial</a></div>';
|
836 |
$out .= '<div class="gmw-left-box gmw-content-box">
|
837 |
<h3>Buy PRO</h3>
|
838 |
<p><strike><i>$29</i></strike> $19 for unlimited sites</p>
|
895 |
<li>4 map modes; directions, view, street & streetview</li>
|
896 |
<li>fully customizable pin options for thumbnail map</li>
|
897 |
<li>Advanced cache & fastest loading times</li>
|
898 |
+
<li>JS & CSS optimization options</li>
|
899 |
+
<li>Continuous updates & new features</li>';
|
900 |
$out .= '</ul>';
|
901 |
$out .= '<ul class="list-right">';
|
902 |
$out .= '<li>3 additional map link types</li>
|
904 |
<li>extra lightbox features</li>
|
905 |
<li>19 lightbox skins</li>
|
906 |
<li>full shortcode support</li>
|
907 |
+
<li>Clone widget feature</li>
|
908 |
<li>export & import tools</li>
|
909 |
<li>Google Analytics integration</li>
|
910 |
<li>no ads</li>
|
913 |
$out .= '</ul>';
|
914 |
$out .= ' </div>';
|
915 |
$out .= '<div class="footer">';
|
916 |
+
$out .= '<p class="center"><a href="#" class="button-secondary gmw_goto_intro">Go PRO now</a> <a href="#" class="button-secondary gmw_goto_trial">Start a free trial</a><br>
|
917 |
Or <a href="#" class="gmw_goto_activation">enter the license key</a> if you already have it.</p>';
|
918 |
$out .= '</div>';
|
919 |
$out .= '</div>'; // pro features screen
|
920 |
|
921 |
+
$out .= '<div id="gmw_dialog_trial" style="display: none;" class="gmw_promo_dialog_screen">
|
922 |
+
<div class="content">test';
|
923 |
+
$out .= '</div>';
|
924 |
+
$out .= '</div>'; // trial screen
|
925 |
+
|
926 |
$out .= '</div>'; // dialog
|
927 |
} // promo dialog
|
928 |
|
991 |
echo '<li><a href="#gmw-license">' . __('License', 'google-maps-widget') . '</a></li>';
|
992 |
echo '</ul>';
|
993 |
|
994 |
+
echo '<div id="gmw-settings" style="display: none;">';
|
995 |
echo '<table class="form-table">';
|
996 |
echo '<tr>
|
997 |
<th scope="row"><label for="api_key">' . __('Google Maps API Key', 'google-maps-widget') . '</label></th>
|
998 |
<td><input name="' . GMW::$options . '[api_key]" type="text" id="api_key" value="' . esc_attr($options['api_key']) . '" class="regular-text" placeholder="Google Maps API key" oninput="setCustomValidity(\'\')" oninvalid="this.setCustomValidity(\'Please use Google Developers Console to generate an API key and enter it here. It is completely free.\')"> <a href="#" class="button button-secondary gmw-test-api-key">Test API key</a>
|
999 |
<p class="description">New Google Maps usage policy dictates that everyone using the maps should register for a free API key.<br>
|
1000 |
Please create a key for "Google Static Maps API" and "Google Maps Embed API" using the <a href="https://console.developers.google.com/project" target="blank">Google Developers Console</a>.<br>
|
1001 |
+
Or use <a href="https://console.developers.google.com/flows/enableapi?apiid=maps_embed_backend&keyType=CLIENT_SIDE&reusekey=true" target="_blank">wizard step #1</a> - login, click next a few times & copy the key. Then use <a href="https://console.developers.google.com/flows/enableapi?apiid=static_maps_backend&keyType=CLIENT_SIDE&reusekey=true" target="_blank">wizard step #2</a> and select the same "My Project".<br>
|
1002 |
+
If you want to protect your API key by using the "Accept requests from these HTTP referrers" option in Google Console add your domain<br>in these two formats: *.mydomain.com/* and mydomain.com/*</p></td>
|
1003 |
</tr>';
|
1004 |
if (GMW::is_activated()) {
|
1005 |
echo '<tr>
|
1047 |
echo get_submit_button(__('Save Settings', 'google-maps-widget'));
|
1048 |
echo '</div>'; // settings tab
|
1049 |
|
1050 |
+
echo '<div id="gmw-export" style="display: none;">';
|
1051 |
if (GMW::is_activated('pro')) {
|
1052 |
echo '<table class="form-table">';
|
1053 |
echo '<tr>
|
1068 |
}
|
1069 |
echo '</div>'; // export/import tab
|
1070 |
|
1071 |
+
echo '<div id="gmw-license" style="display: none;">';
|
1072 |
if (!GMW::is_activated()) {
|
1073 |
echo '<p>Not sure if you should upgrade to <span class="gmw-pro-red">PRO</span>? It offers more than 50 extra features; <a href="#" class="open_promo_dialog">compare features now</a>.</p>';
|
1074 |
}
|
js/gmw-admin.js
CHANGED
@@ -46,6 +46,21 @@ jQuery(function($) {
|
|
46 |
gmw.map = gmw.marker = false;
|
47 |
|
48 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
49 |
// init JS for each active widget
|
50 |
$(".widget-liquid-right [id*='" + gmw.id_base + "-'].widget, .inactive-sidebar [id*='" + gmw.id_base + "'].widget").each(function (i, widget) {
|
51 |
gmw_init_widget_ui(widget);
|
@@ -64,7 +79,16 @@ jQuery(function($) {
|
|
64 |
if (id.indexOf(gmw.id_base) != -1) {
|
65 |
gmw_init_widget_ui(widget);
|
66 |
}
|
67 |
-
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
68 |
|
69 |
|
70 |
// init JS UI for an individual GMW
|
@@ -315,6 +339,17 @@ jQuery(function($) {
|
|
315 |
}); // go to PRO features click
|
316 |
|
317 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
318 |
// enter is pressed in license key field
|
319 |
$('#gmw_code').on('keypress', function(e) {
|
320 |
if (e.which === 13) {
|
@@ -464,7 +499,7 @@ jQuery(function($) {
|
|
464 |
},
|
465 |
resizeStop: function(event, ui) {
|
466 |
$('#gmw_map_dialog').dialog('option', 'position', {my: 'center', at: 'center', of: window});
|
467 |
-
$('#gmw_map_canvas').height($('#gmw_map_dialog').dialog('option', 'height') - $('#gmw_map_dialog_footer').height() -
|
468 |
google.maps.event.trigger(gmw.map, 'resize');
|
469 |
},
|
470 |
close: function(event, ui) {}
|
@@ -643,4 +678,70 @@ jQuery(function($) {
|
|
643 |
|
644 |
return false;
|
645 |
}); // test api key
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
646 |
}); // onload
|
46 |
gmw.map = gmw.marker = false;
|
47 |
|
48 |
|
49 |
+
// add clone button only to GMW widgets
|
50 |
+
if (gmw.is_activated) {
|
51 |
+
$('div[id*="' + gmw.id_base + '"] .widget-control-actions').each(function() {
|
52 |
+
var $clone = $('<a>');
|
53 |
+
var clone = $clone.get()[0];
|
54 |
+
$clone.addClass('gmw-clone-me')
|
55 |
+
.attr('title', 'Clone and save the widget in the same sidebar')
|
56 |
+
.attr('href', '#')
|
57 |
+
.html('Clone');
|
58 |
+
$clone.insertAfter($(this).find('.alignleft .widget-control-remove'));
|
59 |
+
clone.insertAdjacentHTML('beforebegin', ' | ');
|
60 |
+
}); // add clone button
|
61 |
+
} // if activated - clone
|
62 |
+
|
63 |
+
|
64 |
// init JS for each active widget
|
65 |
$(".widget-liquid-right [id*='" + gmw.id_base + "-'].widget, .inactive-sidebar [id*='" + gmw.id_base + "'].widget").each(function (i, widget) {
|
66 |
gmw_init_widget_ui(widget);
|
79 |
if (id.indexOf(gmw.id_base) != -1) {
|
80 |
gmw_init_widget_ui(widget);
|
81 |
}
|
82 |
+
}); // refresh GUI on widget add/update
|
83 |
+
|
84 |
+
|
85 |
+
// clone button click
|
86 |
+
$(document).on('click', '.gmw-clone-me', function(e) {
|
87 |
+
gmw_clone(e, this);
|
88 |
+
|
89 |
+
e.preventDefault();
|
90 |
+
return false;
|
91 |
+
}); // clone button click
|
92 |
|
93 |
|
94 |
// init JS UI for an individual GMW
|
339 |
}); // go to PRO features click
|
340 |
|
341 |
|
342 |
+
// go to trial button in dialog
|
343 |
+
$('.gmw_goto_trial').on('click', function(e) {
|
344 |
+
e.preventDefault();
|
345 |
+
|
346 |
+
$('.gmw_promo_dialog_screen').hide();
|
347 |
+
$('#gmw_dialog_trial').show();
|
348 |
+
|
349 |
+
return false;
|
350 |
+
}); // go to trial click
|
351 |
+
|
352 |
+
|
353 |
// enter is pressed in license key field
|
354 |
$('#gmw_code').on('keypress', function(e) {
|
355 |
if (e.which === 13) {
|
499 |
},
|
500 |
resizeStop: function(event, ui) {
|
501 |
$('#gmw_map_dialog').dialog('option', 'position', {my: 'center', at: 'center', of: window});
|
502 |
+
$('#gmw_map_canvas').height($('#gmw_map_dialog').dialog('option', 'height') - $('#gmw_map_dialog_footer').height() - 120);
|
503 |
google.maps.event.trigger(gmw.map, 'resize');
|
504 |
},
|
505 |
close: function(event, ui) {}
|
678 |
|
679 |
return false;
|
680 |
}); // test api key
|
681 |
+
|
682 |
+
|
683 |
+
// clone and save new instance of GMW
|
684 |
+
function gmw_clone(ev, org_widget) {
|
685 |
+
var $original = $(org_widget).parents('.widget');
|
686 |
+
var $widget = $original.clone();
|
687 |
+
var idbase = $widget.find('input[name="id_base"]').val();
|
688 |
+
var number = $widget.find('input[name="widget_number"]').val();
|
689 |
+
var mnumber = $widget.find('input[name="multi_number"]').val();
|
690 |
+
var highest = 0;
|
691 |
+
|
692 |
+
if (mnumber != '') {
|
693 |
+
number = mnumber;
|
694 |
+
}
|
695 |
+
|
696 |
+
$('input.widget-id[value|="' + idbase + '"]').each(function() {
|
697 |
+
var match = this.value.match(/-(\d+)$/);
|
698 |
+
if (match && parseInt(match[1]) > highest) {
|
699 |
+
highest = parseInt(match[1]);
|
700 |
+
}
|
701 |
+
});
|
702 |
+
|
703 |
+
var newnum = highest + 1;
|
704 |
+
|
705 |
+
$widget.find('.widget-content').find('input, select, textarea, label').each(function() {
|
706 |
+
if ($(this).attr('name')) {
|
707 |
+
$(this).attr('name', $(this).attr('name').replace(number, newnum));
|
708 |
+
}
|
709 |
+
if ($(this).attr('id')) {
|
710 |
+
$(this).attr('id', $(this).attr('id').replace(number, newnum));
|
711 |
+
}
|
712 |
+
if ($(this).attr('for')) {
|
713 |
+
$(this).attr('for', $(this).attr('for').replace(number, newnum));
|
714 |
+
}
|
715 |
+
});
|
716 |
+
|
717 |
+
var match = $widget[0].id.match(/^widget-(\d+)/i);
|
718 |
+
if (match && parseInt(match[1])) {
|
719 |
+
newid = parseInt(match[1]);
|
720 |
+
}
|
721 |
+
|
722 |
+
$widget.find('input.add_new').val('multi');
|
723 |
+
$widget[0].id = 'widget-' + newid + '_' + idbase + '-' + newnum;
|
724 |
+
$widget.find('input.widget-id').val(idbase + '-' + newnum);
|
725 |
+
$widget.find('input.widget_number').val(newnum);
|
726 |
+
$widget.hide();
|
727 |
+
$original.after($widget);
|
728 |
+
$widget.fadeIn();
|
729 |
+
|
730 |
+
$widget.find('.multi_number').val(newnum);
|
731 |
+
|
732 |
+
$(document).ajaxSuccess(function(event, xhr, settings) {
|
733 |
+
if (xhr.responseText == '' && xhr.status == 200 && settings.data.search('&action=save-widget&')) {
|
734 |
+
wpWidgets.save($widget, 0, 0, 1);
|
735 |
+
$(document).unbind('ajaxSuccess');
|
736 |
+
}
|
737 |
+
});
|
738 |
+
|
739 |
+
wpWidgets.save($widget, 0, 0, 1);
|
740 |
+
|
741 |
+
$widget.find('input.multi_number').val('');
|
742 |
+
$widget.find('input.add_new').val('');
|
743 |
+
|
744 |
+
ev.stopPropagation();
|
745 |
+
ev.preventDefault();
|
746 |
+
} // clone widget
|
747 |
}); // onload
|
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 |
|
@@ -89,6 +89,7 @@ http://www.youtube.com/watch?v=y1siX9ha7Pw&hd=1
|
|
89 |
* Most <a href="https://mapicons.mapsmarker.com/">icons</a> are created by Nicolas Mollet under the Creative Commons Attribution-Share Alike 3.0 Unported license
|
90 |
* <a href="https://select2.github.io/">Select2 v4</a>, licensed under MIT
|
91 |
* <a href="http://www.jacklmoore.com/colorbox">Colorbox 1.6</a>, licensed under MIT
|
|
|
92 |
|
93 |
|
94 |
== Installation ==
|
@@ -122,6 +123,7 @@ Write the address differently, or more precisely. Make sure you enter the street
|
|
122 |
|
123 |
We understand that creating an API key is frustrating but it takes less than a minute and it's something Google requires.
|
124 |
Follow <a href="https://console.developers.google.com/flows/enableapi?apiid=maps_embed_backend&keyType=CLIENT_SIDE&reusekey=true" target="_blank">wizard step #1</a> - login with any Gmail account, click next/confirm a few times with the default settings & copy the key you see on the screen; it's the key you need. Then use <a href="https://console.developers.google.com/flows/enableapi?apiid=static_maps_backend&keyType=CLIENT_SIDE&reusekey=true" target="_blank">wizard step #2</a>, select the same "My Project" project from the list and that's it. Save the key in GMW settings.
|
|
|
125 |
|
126 |
= Thumbnail map works but lightbox won't open on click =
|
127 |
|
@@ -142,6 +144,11 @@ Read the <a href="http://wordpress.org/support/plugin/google-maps-widget">suppor
|
|
142 |
|
143 |
== Changelog ==
|
144 |
|
|
|
|
|
|
|
|
|
|
|
145 |
= 3.10 =
|
146 |
* 2016/02/23
|
147 |
* security enhancements
|
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.15
|
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 |
|
89 |
* Most <a href="https://mapicons.mapsmarker.com/">icons</a> are created by Nicolas Mollet under the Creative Commons Attribution-Share Alike 3.0 Unported license
|
90 |
* <a href="https://select2.github.io/">Select2 v4</a>, licensed under MIT
|
91 |
* <a href="http://www.jacklmoore.com/colorbox">Colorbox 1.6</a>, licensed under MIT
|
92 |
+
* Widget cloning is based on <a href="https://wordpress.org/plugins/widget-clone/">Widget Clone</a> plugin by 93digital, licensed under GPLv3
|
93 |
|
94 |
|
95 |
== Installation ==
|
123 |
|
124 |
We understand that creating an API key is frustrating but it takes less than a minute and it's something Google requires.
|
125 |
Follow <a href="https://console.developers.google.com/flows/enableapi?apiid=maps_embed_backend&keyType=CLIENT_SIDE&reusekey=true" target="_blank">wizard step #1</a> - login with any Gmail account, click next/confirm a few times with the default settings & copy the key you see on the screen; it's the key you need. Then use <a href="https://console.developers.google.com/flows/enableapi?apiid=static_maps_backend&keyType=CLIENT_SIDE&reusekey=true" target="_blank">wizard step #2</a>, select the same "My Project" project from the list and that's it. Save the key in GMW settings.
|
126 |
+
If you want to protect your API key by using the "Accept requests from these HTTP referrers (web sites)" option in Google Console make sure to add your domain in these two formats: _*.mydomain.com/*_ and _mydomain.com/*_ and wait a few minutes until Google makes the necessary changes.
|
127 |
|
128 |
= Thumbnail map works but lightbox won't open on click =
|
129 |
|
144 |
|
145 |
== Changelog ==
|
146 |
|
147 |
+
= 3.15 =
|
148 |
+
* 2016/03/07
|
149 |
+
* widgets can now be cloned
|
150 |
+
* minor fixes
|
151 |
+
|
152 |
= 3.10 =
|
153 |
* 2016/02/23
|
154 |
* security enhancements
|