Google Maps Widget – Ultimate Google Maps Plugin - Version 2.20

Version Description

  • 2015/02/16
  • added shortcode support
Download this release

Release Info

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

Code changes from version 2.15 to 2.20

css/gmw-admin.css CHANGED
@@ -154,7 +154,7 @@ option.promo {
154
  font-weight: 200;
155
  line-height: 32px;
156
  color: #AAAAAA;
157
- padding: 0 15px;
158
  }
159
 
160
  .ui-tabs ul.ui-tabs-nav li {
154
  font-weight: 200;
155
  line-height: 32px;
156
  color: #AAAAAA;
157
+ padding: 0 9px;
158
  }
159
 
160
  .ui-tabs ul.ui-tabs-nav li {
css/gmw.css CHANGED
@@ -13,6 +13,10 @@
13
  padding: 0;
14
  }
15
 
 
 
 
 
16
  /* Colorbox Core Style */
17
  #colorbox, #cboxOverlay, #cboxWrapper{position:absolute; top:0; left:0; z-index:9999; overflow:hidden;}
18
  #cboxWrapper {max-width:none;}
13
  padding: 0;
14
  }
15
 
16
+ .gmw-error {
17
+ color: red;
18
+ }
19
+
20
  /* Colorbox Core Style */
21
  #colorbox, #cboxOverlay, #cboxWrapper{position:absolute; top:0; left:0; z-index:9999; overflow:hidden;}
22
  #cboxWrapper {max-width:none;}
gmw-widget.php CHANGED
@@ -127,7 +127,7 @@ class GoogleMapsWidget extends WP_Widget {
127
  echo '<p><label for="' . $this->get_field_id('title') . '">' . __('Title', 'google-maps-widget') . ':</label><input class="widefat" id="' . $this->get_field_id('title') . '" name="' . $this->get_field_name('title') . '" type="text" value="' . esc_attr($title) . '" /></p>';
128
  echo '<p><label for="' . $this->get_field_id('address') . '">' . __('Address', 'google-maps-widget') . ':</label><input class="widefat" id="' . $this->get_field_id('address') . '" name="' . $this->get_field_name('address') . '" type="text" value="' . esc_attr($address) . '" /></p>';
129
 
130
- echo '<div class="gmw-tabs" id="tab-' . $this->id . '"><ul><li><a href="#gmw-thumb">' . __('Thumbnail map', 'google-maps-widget') . '</a></li><li><a href="#gmw-lightbox">' . __('Lightbox map', 'google-maps-widget') . '</a></li><li><a href="#gmw-info">' . __('Info &amp; Support', 'google-maps-widget') . '</a></li></ul>';
131
  echo '<div id="gmw-thumb">';
132
 
133
  echo '<p><label class="gmw-label" for="' . $this->get_field_id('thumb_width') . '">' . __('Map Size', 'google-maps-widget') . ':</label>';
@@ -229,11 +229,27 @@ class GoogleMapsWidget extends WP_Widget {
229
 
230
  echo '</div>'; // lightbox tab
231
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
232
  echo '<div id="gmw-info">';
233
  echo '<h3>' . __('Support', 'google-maps-widget') . '</h3>';
234
  echo '<p>If you have any problems, questions or would like a new feature added post it on the <a href="https://wordpress.org/support/plugin/google-maps-widget" target="_blank">official support forum</a>. It\'s the only place to get support. Since it\'s free and community powered please be patient. <a target="_blank" href="https://www.paypal.com/cgi-bin/webscr?business=gordan@webfactoryltd.com&cmd=_xclick&currency_code=USD&amount=19&item_name=Premium%20support%20for%20Google%20Maps%20Widget">Premium support</a> is available for $19.</p>';
235
  echo '<h3>' . __('Activate extra features &amp; options', 'google-maps-widget') . '</h3>';
236
- echo '<p>' . __('If you subscribe to our mailing list we\'ll instantly activate additional features in the plugin! At the moment those features are 3 additional thumbnail map skins and 2 additional lightbox skins. More <i>activate by subscribing</i> features will be available soon!', 'google-maps-widget') . '<br>';
237
  if (GMW::is_activated()) {
238
  echo __('You\'ve already subscribed and activated extra features. Thank you!', 'google-maps-widget');
239
  } else {
127
  echo '<p><label for="' . $this->get_field_id('title') . '">' . __('Title', 'google-maps-widget') . ':</label><input class="widefat" id="' . $this->get_field_id('title') . '" name="' . $this->get_field_name('title') . '" type="text" value="' . esc_attr($title) . '" /></p>';
128
  echo '<p><label for="' . $this->get_field_id('address') . '">' . __('Address', 'google-maps-widget') . ':</label><input class="widefat" id="' . $this->get_field_id('address') . '" name="' . $this->get_field_name('address') . '" type="text" value="' . esc_attr($address) . '" /></p>';
129
 
130
+ echo '<div class="gmw-tabs" id="tab-' . $this->id . '"><ul><li><a href="#gmw-thumb">' . __('Thumbnail map', 'google-maps-widget') . '</a></li><li><a href="#gmw-lightbox">' . __('Lightbox map', 'google-maps-widget') . '</a></li><li><a href="#gmw-shortcode">' . __('Shortcode', 'google-maps-widget') . '</a></li><li><a href="#gmw-info">' . __('Info &amp; Support', 'google-maps-widget') . '</a></li></ul>';
131
  echo '<div id="gmw-thumb">';
132
 
133
  echo '<p><label class="gmw-label" for="' . $this->get_field_id('thumb_width') . '">' . __('Map Size', 'google-maps-widget') . ':</label>';
229
 
230
  echo '</div>'; // lightbox tab
231
 
232
+ // shortcode tab
233
+ echo '<div id="gmw-shortcode">';
234
+ if (GMW::is_activated()) {
235
+ $id = str_replace('googlemapswidget-', '', $this->id);
236
+
237
+ if (!$id || !is_numeric($id)) {
238
+ echo __('Please save the widget so that the shortcode can be generated.', 'google-maps-widget');
239
+ } else {
240
+ echo '<p><code>[gmw id="' . $id . '"]</code><br></p>';
241
+ echo '<p>' . __('Use the above shortcode to display this Google Maps Widget instance in any page or post. <br>Please note that your theme might style the widget in the post as if it is placed in a sidebar. In that case use the <code>span.gmw-shortcode-widget</code> class to target the shortcode and make necessary changes via CSS.', 'google-maps-widget') . '</p>';
242
+ }
243
+ } else {
244
+ echo '<p>Shortcode support is an extra feature. You can activate it <b>for free</b> and get more features &amp; options for free as well.<br><br><a class="button open_promo_dialog" href="#">Activate extra features</a></p>';
245
+ }
246
+ echo '</div>'; // shortcode tab
247
+
248
  echo '<div id="gmw-info">';
249
  echo '<h3>' . __('Support', 'google-maps-widget') . '</h3>';
250
  echo '<p>If you have any problems, questions or would like a new feature added post it on the <a href="https://wordpress.org/support/plugin/google-maps-widget" target="_blank">official support forum</a>. It\'s the only place to get support. Since it\'s free and community powered please be patient. <a target="_blank" href="https://www.paypal.com/cgi-bin/webscr?business=gordan@webfactoryltd.com&cmd=_xclick&currency_code=USD&amount=19&item_name=Premium%20support%20for%20Google%20Maps%20Widget">Premium support</a> is available for $19.</p>';
251
  echo '<h3>' . __('Activate extra features &amp; options', 'google-maps-widget') . '</h3>';
252
+ echo '<p>' . __('If you subscribe to our mailing list we\'ll instantly activate additional features in the plugin! At the moment those features are: shortcode support, 3 additional thumbnail map skins and 2 additional lightbox skins. More <i>activate by subscribing</i> features will be available soon!', 'google-maps-widget') . '<br>';
253
  if (GMW::is_activated()) {
254
  echo __('You\'ve already subscribed and activated extra features. Thank you!', 'google-maps-widget');
255
  } else {
google-maps-widget.php CHANGED
@@ -2,9 +2,9 @@
2
  /*
3
  Plugin Name: Google Maps Widget
4
  Plugin URI: http://www.googlemapswidget.com/
5
- Description: Display a single-image super-fast loading Google map in a widget. A larger, full featured map is available on click in a lightbox.
6
  Author: Web factory Ltd
7
- Version: 2.15
8
  Author URI: http://www.webfactoryltd.com/
9
  Text Domain: google-maps-widget
10
  Domain Path: lang
@@ -31,7 +31,7 @@ if (!defined('ABSPATH')) {
31
  }
32
 
33
 
34
- define('GMW_VER', '2.15');
35
  define('GMW_OPTIONS', 'gmw_options');
36
  define('GMW_CRON', 'gmw_cron');
37
 
@@ -72,6 +72,9 @@ class GMW {
72
  add_action('wp_enqueue_scripts', array(__CLASS__, 'enqueue_scripts'));
73
  add_action('wp_footer', array(__CLASS__, 'dialogs_markup'));
74
  }
 
 
 
75
  } // init
76
 
77
 
@@ -174,6 +177,13 @@ class GMW {
174
  } // dialogs_markup
175
 
176
 
 
 
 
 
 
 
 
177
  // enqueue frontend scripts if necessary
178
  static function enqueue_scripts() {
179
  if (is_active_widget(false, false, 'googlemapswidget', true)) {
@@ -376,6 +386,31 @@ class GMW {
376
  } // get_coordinates
377
 
378
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
379
  // activate doesn't get fired on upgrades so we have to compensate
380
  public static function upgrade() {
381
  $options = get_option(GMW_OPTIONS);
2
  /*
3
  Plugin Name: Google Maps Widget
4
  Plugin URI: http://www.googlemapswidget.com/
5
+ Description: Display a single-image super-fast loading Google map in a widget. A larger, full featured map is available on click in a lightbox. Includes shortcode support and numerous options.
6
  Author: Web factory Ltd
7
+ Version: 2.20
8
  Author URI: http://www.webfactoryltd.com/
9
  Text Domain: google-maps-widget
10
  Domain Path: lang
31
  }
32
 
33
 
34
+ define('GMW_VER', '2.20');
35
  define('GMW_OPTIONS', 'gmw_options');
36
  define('GMW_CRON', 'gmw_cron');
37
 
72
  add_action('wp_enqueue_scripts', array(__CLASS__, 'enqueue_scripts'));
73
  add_action('wp_footer', array(__CLASS__, 'dialogs_markup'));
74
  }
75
+
76
+ // add shortcode support
77
+ self::add_shortcode();
78
  } // init
79
 
80
 
177
  } // dialogs_markup
178
 
179
 
180
+ // check availability and register shortcode
181
+ // todo - add check fot already registered shortcodes and display error
182
+ static function add_shortcode() {
183
+ add_shortcode('gmw', array(__CLASS__, 'do_shortcode'));
184
+ } // add_shortcode
185
+
186
+
187
  // enqueue frontend scripts if necessary
188
  static function enqueue_scripts() {
189
  if (is_active_widget(false, false, 'googlemapswidget', true)) {
386
  } // get_coordinates
387
 
388
 
389
+ // shortcode support for any GMW instance
390
+ static function do_shortcode($atts, $content = null) {
391
+ if (!self::is_activated()) {
392
+ return;
393
+ }
394
+
395
+ global $wp_widget_factory;
396
+ $atts = shortcode_atts(array('id' => 0), $atts);
397
+ $id = (int) $atts['id'];
398
+ $widgets = get_option('widget_googlemapswidget');
399
+
400
+ if (!$id || !isset($widgets[$id]) || empty($widgets[$id])) {
401
+ echo '<span class="gmw-error">Google Maps Widget shortcode error - please double-check the widget ID.</span>';
402
+ } else {
403
+ $widget_args = $widgets[$id];
404
+ $widget_instance['widget_id'] = 'googlemapswidget-' . $id;
405
+ $widget_instance['widget_name'] = 'Google Maps Widget';
406
+
407
+ echo '<span class="gmw-shortcode-widget">';
408
+ the_widget('GoogleMapsWidget', $widget_args, $widget_instance);
409
+ echo '</span>';
410
+ }
411
+ } // do_shortcode
412
+
413
+
414
  // activate doesn't get fired on upgrades so we have to compensate
415
  public static function upgrade() {
416
  $options = get_option(GMW_OPTIONS);
lang/google-maps-widget.pot CHANGED
@@ -2,7 +2,7 @@
2
  # This file is distributed under the same license as the Google Maps Widget package.
3
  msgid ""
4
  msgstr ""
5
- "Project-Id-Version: Google Maps Widget 2.1\n"
6
  "Report-Msgid-Bugs-To: http://wordpress.org/tag/google-maps-widget\n"
7
  "POT-Creation-Date: \n"
8
  "PO-Revision-Date: 2015-02-08 20:17+0100\n"
2
  # This file is distributed under the same license as the Google Maps Widget package.
3
  msgid ""
4
  msgstr ""
5
+ "Project-Id-Version: Google Maps Widget 2.15\n"
6
  "Report-Msgid-Bugs-To: http://wordpress.org/tag/google-maps-widget\n"
7
  "POT-Creation-Date: \n"
8
  "PO-Revision-Date: 2015-02-08 20:17+0100\n"
readme.txt CHANGED
@@ -1,12 +1,12 @@
1
  === Google Maps Widget ===
2
  Contributors: WebFactory
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=gordan%40webfactoryltd%2ecom&lc=US&item_name=Google%20Maps%20Widget&no_note=0&currency_code=USD&bn=PP%2dDonationsBF%3abtn_donateCC_LG%2egif%3aNonHostedGuest
4
- Tags: google maps, maps, gmaps, widget, lightbox, map, google map, fancybox, fancybox2, multilingual, sidebar, chinese
5
  License: GPLv2 or later
6
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
7
  Requires at least: 3.3
8
  Tested up to: 4.1
9
- Stable tag: 2.15
10
 
11
  Displays a single-image super-fast loading Google map in a widget. A larger map with all the usual features is available on click in a lightbox.
12
 
@@ -45,6 +45,11 @@ http://www.youtube.com/watch?v=y1siX9ha7Pw&hd=1
45
  * header text
46
  * footer text
47
 
 
 
 
 
 
48
  > If you need a Google Maps shortcode plugin you might be interested in purchasing our premium <a title="5sec Google Maps" href="http://5sec-google-maps-pro.webfactoryltd.com/">5sec Google Maps PRO</a> plugin.
49
 
50
 
@@ -94,7 +99,7 @@ Or if needed, upload manually;
94
 
95
  = Who is this plugin for? =
96
 
97
- For just about anyone who needs a map on their site.
98
 
99
  = Thumbnail map works but lightbox won't open on click =
100
 
@@ -102,8 +107,8 @@ You most probably have Fancybox JS and CSS files included twice; once by the the
102
 
103
  = It's not working!!! Arrrrrrrrr =
104
 
105
- A more detailed help is coming soon. Till then check 2 things: does your theme have wp_footer() function call in the footer and if there are any jQuery errors on the site.
106
- If you can figure it out open a thread in the support forums.
107
 
108
  == Screenshots ==
109
 
@@ -113,9 +118,13 @@ If you can figure it out open a thread in the support forums.
113
  4. Widget options - lightbox map
114
 
115
  == Changelog ==
 
 
 
 
116
  = 2.15 =
117
  * 2015/02/09
118
- * fixed a plugin_deactivate bug nobody noticed for 2 years :(
119
  * all JS texts are now loaded via wp_localize_script()
120
 
121
  = 2.10 =
1
  === Google Maps Widget ===
2
  Contributors: WebFactory
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=gordan%40webfactoryltd%2ecom&lc=US&item_name=Google%20Maps%20Widget&no_note=0&currency_code=USD&bn=PP%2dDonationsBF%3abtn_donateCC_LG%2egif%3aNonHostedGuest
4
+ Tags: google maps, maps, gmaps, widget, lightbox, map, google map, fancybox, fancybox2, multilingual, sidebar, chinese, shortcode, gmw, fast
5
  License: GPLv2 or later
6
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
7
  Requires at least: 3.3
8
  Tested up to: 4.1
9
+ Stable tag: 2.20
10
 
11
  Displays a single-image super-fast loading Google map in a widget. A larger map with all the usual features is available on click in a lightbox.
12
 
45
  * header text
46
  * footer text
47
 
48
+ **Shortcode**
49
+
50
+ * by using the _[gmw id="#"]_ shortcode you can display the map in any page, post, or custom post type
51
+
52
+
53
  > If you need a Google Maps shortcode plugin you might be interested in purchasing our premium <a title="5sec Google Maps" href="http://5sec-google-maps-pro.webfactoryltd.com/">5sec Google Maps PRO</a> plugin.
54
 
55
 
99
 
100
  = Who is this plugin for? =
101
 
102
+ For just about anyone who needs a map on their site in 5 seconds.
103
 
104
  = Thumbnail map works but lightbox won't open on click =
105
 
107
 
108
  = It's not working!!! Arrrrrrrrr =
109
 
110
+ A more detailed help is coming soon. Till then check 2 things: does your theme have _wp_footer()_ function call in the footer and if there are any jQuery errors on the site.
111
+ If you can't figure it out open a thread in the support forums.
112
 
113
  == Screenshots ==
114
 
118
  4. Widget options - lightbox map
119
 
120
  == Changelog ==
121
+ = 2.20 =
122
+ * 2015/02/16
123
+ * added shortcode support
124
+
125
  = 2.15 =
126
  * 2015/02/09
127
+ * fixed a _plugin_deactivate_ bug nobody noticed for 2 years :(
128
  * all JS texts are now loaded via wp_localize_script()
129
 
130
  = 2.10 =